From: support Date: Thu, 30 Jun 2022 17:06:23 +0000 (+0000) Subject: Built motion from commit 1330cc62.|2.6.11 X-Git-Url: http://repos.xcallymotion.com/?a=commitdiff_plain;h=cb3a3cae0a6b0bc8443f643a1c1f8c98b075416a;p=motion2.git Built motion from commit 1330cc62.|2.6.11 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index e0810d4..bee3919 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-06-29T15:17:52.204Z", + "time": "2022-06-30T16:58:01.439Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 6a4fc39..2734535 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-06-29T15:17:52.204Z", + "time": "2022-06-30T16:58:01.439Z", "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 e770602..beb0e1a 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 _0x886e=['urlForward[body]','sequelize','VIRTUAL','getDataValue','action','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[headers],\x20browser[wsindowHeight]'];(function(_0xc74312,_0x3d8ef0){var _0x3a9838=function(_0x49cfac){while(--_0x49cfac){_0xc74312['push'](_0xc74312['shift']());}};_0x3a9838(++_0x3d8ef0);}(_0x886e,0x157));var _0xe886=function(_0xdb7f25,_0x170636){_0xdb7f25=_0xdb7f25-0x0;var _0xce7457=_0x886e[_0xdb7f25];return _0xce7457;};'use strict';var Sequelize=require(_0xe886('0x0'));module['exports']={'name':{'type':Sequelize[_0xe886('0x1')],'get':function(_0x55e572){return this[_0xe886('0x2')](_0xe886('0x3'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0xe886('0x4'),_0xe886('0x5'),_0xe886('0x6'),_0xe886('0x7'),_0xe886('0x8'),_0xe886('0x9'),_0xe886('0xa'),_0xe886('0xb')]],'msg':_0xe886('0xc')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0xe886('0xd')](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0xe886('0xe')},'data3':{'type':Sequelize[_0xe886('0xd')](0x1000),'comment':_0xe886('0xf')},'data4':{'type':Sequelize[_0xe886('0xd')](0x1000),'comments':_0xe886('0x10')},'data5':{'type':Sequelize[_0xe886('0xd')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0xe886('0xd')],'comments':_0xe886('0x11')},'data7':{'type':Sequelize['TEXT'],'comments':_0xe886('0x12')}}; \ No newline at end of file +var _0x04b7=['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]','TEXT','urlForward[body]','getDataValue','action','STRING','contactManager','integration','motionbar','urlForward','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x04b7,0x105));var _0x704b=function(_0x76a7ae,_0x490d47){_0x76a7ae=_0x76a7ae-0x0;var _0x12eeb4=_0x04b7[_0x76a7ae];return _0x12eeb4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x4814e0){return this[_0x704b('0x0')](_0x704b('0x1'));}},'action':{'type':Sequelize[_0x704b('0x2')],'allowNull':![],'validate':{'isIn':{'args':[[_0x704b('0x3'),_0x704b('0x4'),_0x704b('0x5'),'jscripty',_0x704b('0x6'),'browser',_0x704b('0x7'),_0x704b('0x8')]],'msg':_0x704b('0x9')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x704b('0x2')](0x1000),'comment':_0x704b('0xa')},'data2':{'type':Sequelize[_0x704b('0x2')](0x1000),'comment':_0x704b('0xb')},'data3':{'type':Sequelize[_0x704b('0x2')](0x1000),'comment':_0x704b('0xc')},'data4':{'type':Sequelize[_0x704b('0x2')](0x1000),'comments':_0x704b('0xd')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0x704b('0x2')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0x704b('0xe')],'comments':_0x704b('0xf')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index eee7359..7539178 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 _0x9d0e=['fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','then','destroy','error','stack','name','body','find','params','catch','zip-dir'];(function(_0x53d4dd,_0xabedc2){var _0x5d4700=function(_0x11e98c){while(--_0x11e98c){_0x53d4dd['push'](_0x53d4dd['shift']());}};_0x5d4700(++_0xabedc2);}(_0x9d0e,0x1cd));var _0xe9d0=function(_0x512bfc,_0x26f639){_0x512bfc=_0x512bfc-0x0;var _0x386bcc=_0x9d0e[_0x512bfc];return _0x386bcc;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe9d0('0x0'));var jsonpatch=require(_0xe9d0('0x1'));var rp=require(_0xe9d0('0x2'));var moment=require('moment');var BPromise=require(_0xe9d0('0x3'));var Mustache=require(_0xe9d0('0x4'));var util=require('util');var path=require(_0xe9d0('0x5'));var sox=require(_0xe9d0('0x6'));var csv=require(_0xe9d0('0x7'));var ejs=require(_0xe9d0('0x8'));var fs=require('fs');var fs_extra=require(_0xe9d0('0x9'));var _=require(_0xe9d0('0xa'));var squel=require(_0xe9d0('0xb'));var crypto=require(_0xe9d0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe9d0('0xd'));var toCsv=require(_0xe9d0('0x7'));var querystring=require(_0xe9d0('0xe'));var Papa=require(_0xe9d0('0xf'));var Redis=require(_0xe9d0('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe9d0('0x11'));var as=require(_0xe9d0('0x12'));var hardwareService=require(_0xe9d0('0x13'));var logger=require('../../config/logger')(_0xe9d0('0x14'));var utils=require(_0xe9d0('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xe9d0('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28de9e,_0xcb1d63){_0xcb1d63=_0xcb1d63||0xcc;return function(_0x45071b){if(_0x45071b){return _0x28de9e['sendStatus'](_0xcb1d63);}return _0x28de9e[_0xe9d0('0x17')](_0xcb1d63)[_0xe9d0('0x18')]();};}function respondWithResult(_0x10b9bd,_0x3266ab){_0x3266ab=_0x3266ab||0xc8;return function(_0x58f81b){if(_0x58f81b){return _0x10b9bd[_0xe9d0('0x17')](_0x3266ab)['json'](_0x58f81b);}};}function respondWithFilteredResult(_0x6d64f,_0x12f3c7){return function(_0x5bd829){if(_0x5bd829){var _0x584508=typeof _0x12f3c7[_0xe9d0('0x19')]===_0xe9d0('0x1a')&&typeof _0x12f3c7[_0xe9d0('0x1b')]===_0xe9d0('0x1a');var _0x2de380=_0x5bd829[_0xe9d0('0x1c')];var _0x25e433=_0x584508?0x0:_0x12f3c7[_0xe9d0('0x19')];var _0x5c6b65=_0x584508?_0x5bd829[_0xe9d0('0x1c')]:_0x12f3c7[_0xe9d0('0x19')]+_0x12f3c7[_0xe9d0('0x1b')];var _0x4ae0bd;if(_0x5c6b65>=_0x2de380){_0x5c6b65=_0x2de380;_0x4ae0bd=0xc8;}else{_0x4ae0bd=0xce;}_0x6d64f[_0xe9d0('0x17')](_0x4ae0bd);return _0x6d64f[_0xe9d0('0x1d')](_0xe9d0('0x1e'),_0x25e433+'-'+_0x5c6b65+'/'+_0x2de380)[_0xe9d0('0x1f')](_0x5bd829);}return null;};}function patchUpdates(_0x288b21){return function(_0x58bb1f){try{jsonpatch[_0xe9d0('0x20')](_0x58bb1f,_0x288b21,!![]);}catch(_0x4da68c){return BPromise['reject'](_0x4da68c);}return _0x58bb1f['save']();};}function saveUpdates(_0xcedbb7,_0x2d04fc){return function(_0x407e72){if(_0x407e72){return _0x407e72['update'](_0xcedbb7)[_0xe9d0('0x21')](function(_0x18c004){return _0x18c004;});}return null;};}function removeEntity(_0x1d8577,_0x547cc7){return function(_0x8f25c8){if(_0x8f25c8){return _0x8f25c8[_0xe9d0('0x22')]()[_0xe9d0('0x21')](function(){_0x1d8577[_0xe9d0('0x17')](0xcc)[_0xe9d0('0x18')]();});}};}function handleEntityNotFound(_0x24dc4e,_0x22cc74){return function(_0x57d855){if(!_0x57d855){_0x24dc4e['sendStatus'](0x194);}return _0x57d855;};}function handleError(_0x5681c8,_0x50e883){_0x50e883=_0x50e883||0x1f4;return function(_0x3ebf8f){logger[_0xe9d0('0x23')](_0x3ebf8f[_0xe9d0('0x24')]);if(_0x3ebf8f[_0xe9d0('0x25')]){delete _0x3ebf8f[_0xe9d0('0x25')];}_0x5681c8[_0xe9d0('0x17')](_0x50e883)['send'](_0x3ebf8f);};}exports['update']=function(_0x32c41c,_0xe07350){if(_0x32c41c[_0xe9d0('0x26')]['id']){delete _0x32c41c['body']['id'];}return db['Action'][_0xe9d0('0x27')]({'where':{'id':_0x32c41c[_0xe9d0('0x28')]['id']}})[_0xe9d0('0x21')](handleEntityNotFound(_0xe07350,null))[_0xe9d0('0x21')](saveUpdates(_0x32c41c[_0xe9d0('0x26')],null))[_0xe9d0('0x21')](respondWithResult(_0xe07350,null))[_0xe9d0('0x29')](handleError(_0xe07350,null));};exports['destroy']=function(_0x33353a,_0x293b20){return db['Action'][_0xe9d0('0x27')]({'where':{'id':_0x33353a[_0xe9d0('0x28')]['id']}})[_0xe9d0('0x21')](handleEntityNotFound(_0x293b20,null))[_0xe9d0('0x21')](removeEntity(_0x293b20,null))['catch'](handleError(_0x293b20,null));}; \ No newline at end of file +var _0xa35e=['eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','status','json','undefined','limit','offset','count','Content-Range','apply','save','update','then','sendStatus','error','stack','name','send','body','Action','params','catch','destroy','find'];(function(_0x517456,_0x18c8d2){var _0x239445=function(_0x1f8d73){while(--_0x1f8d73){_0x517456['push'](_0x517456['shift']());}};_0x239445(++_0x18c8d2);}(_0xa35e,0xdc));var _0xea35=function(_0x4ba3c4,_0x24842d){_0x4ba3c4=_0x4ba3c4-0x0;var _0x2b6605=_0xa35e[_0x4ba3c4];return _0x2b6605;};'use strict';var emlformat=require(_0xea35('0x0'));var rimraf=require(_0xea35('0x1'));var zipdir=require(_0xea35('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xea35('0x3'));var moment=require(_0xea35('0x4'));var BPromise=require(_0xea35('0x5'));var Mustache=require('mustache');var util=require(_0xea35('0x6'));var path=require(_0xea35('0x7'));var sox=require(_0xea35('0x8'));var csv=require('to-csv');var ejs=require(_0xea35('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xea35('0xa'));var squel=require(_0xea35('0xb'));var crypto=require(_0xea35('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xea35('0xd'));var toCsv=require(_0xea35('0xe'));var querystring=require('querystring');var Papa=require(_0xea35('0xf'));var Redis=require(_0xea35('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xea35('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xea35('0x12'));var logger=require(_0xea35('0x13'))('api');var utils=require(_0xea35('0x14'));var config=require(_0xea35('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3be1a7,_0x559c04){_0x559c04=_0x559c04||0xcc;return function(_0x2276d1){if(_0x2276d1){return _0x3be1a7['sendStatus'](_0x559c04);}return _0x3be1a7[_0xea35('0x16')](_0x559c04)['end']();};}function respondWithResult(_0x30db14,_0x58fd48){_0x58fd48=_0x58fd48||0xc8;return function(_0x256d1d){if(_0x256d1d){return _0x30db14['status'](_0x58fd48)[_0xea35('0x17')](_0x256d1d);}};}function respondWithFilteredResult(_0x4d210e,_0x18972e){return function(_0x4fc442){if(_0x4fc442){var _0x23a2b5=typeof _0x18972e['offset']===_0xea35('0x18')&&typeof _0x18972e[_0xea35('0x19')]===_0xea35('0x18');var _0x5d1800=_0x4fc442['count'];var _0x50b25b=_0x23a2b5?0x0:_0x18972e[_0xea35('0x1a')];var _0x48cc66=_0x23a2b5?_0x4fc442[_0xea35('0x1b')]:_0x18972e[_0xea35('0x1a')]+_0x18972e[_0xea35('0x19')];var _0x45b6f4;if(_0x48cc66>=_0x5d1800){_0x48cc66=_0x5d1800;_0x45b6f4=0xc8;}else{_0x45b6f4=0xce;}_0x4d210e[_0xea35('0x16')](_0x45b6f4);return _0x4d210e['set'](_0xea35('0x1c'),_0x50b25b+'-'+_0x48cc66+'/'+_0x5d1800)['json'](_0x4fc442);}return null;};}function patchUpdates(_0x449974){return function(_0x58c96b){try{jsonpatch[_0xea35('0x1d')](_0x58c96b,_0x449974,!![]);}catch(_0x1d5c9f){return BPromise['reject'](_0x1d5c9f);}return _0x58c96b[_0xea35('0x1e')]();};}function saveUpdates(_0x29b2ec,_0x1eba7b){return function(_0x2d0942){if(_0x2d0942){return _0x2d0942[_0xea35('0x1f')](_0x29b2ec)[_0xea35('0x20')](function(_0xeec05d){return _0xeec05d;});}return null;};}function removeEntity(_0x5c804f,_0x5ccb22){return function(_0x50b637){if(_0x50b637){return _0x50b637['destroy']()[_0xea35('0x20')](function(){_0x5c804f[_0xea35('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0xef1cb8,_0x45cc7e){return function(_0x4f632d){if(!_0x4f632d){_0xef1cb8[_0xea35('0x21')](0x194);}return _0x4f632d;};}function handleError(_0x62ed25,_0x50bb77){_0x50bb77=_0x50bb77||0x1f4;return function(_0x1a5b04){logger[_0xea35('0x22')](_0x1a5b04[_0xea35('0x23')]);if(_0x1a5b04[_0xea35('0x24')]){delete _0x1a5b04[_0xea35('0x24')];}_0x62ed25['status'](_0x50bb77)[_0xea35('0x25')](_0x1a5b04);};}exports[_0xea35('0x1f')]=function(_0x4016a3,_0x29afd4){if(_0x4016a3[_0xea35('0x26')]['id']){delete _0x4016a3[_0xea35('0x26')]['id'];}return db[_0xea35('0x27')]['find']({'where':{'id':_0x4016a3[_0xea35('0x28')]['id']}})[_0xea35('0x20')](handleEntityNotFound(_0x29afd4,null))[_0xea35('0x20')](saveUpdates(_0x4016a3[_0xea35('0x26')],null))['then'](respondWithResult(_0x29afd4,null))[_0xea35('0x29')](handleError(_0x29afd4,null));};exports[_0xea35('0x2a')]=function(_0x26d8b2,_0x481199){return db[_0xea35('0x27')][_0xea35('0x2b')]({'where':{'id':_0x26d8b2[_0xea35('0x28')]['id']}})[_0xea35('0x20')](handleEntityNotFound(_0x481199,null))['then'](removeEntity(_0x481199,null))['catch'](handleError(_0x481199,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 1d242a4..b3b32ba 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 _0x2be2=['bluebird','path','rimraf','../../config/environment','./action.attributes','exports','define','Action','tools_actions','lodash','util','api'];(function(_0x3219f9,_0x31182b){var _0x194d4c=function(_0x27ca41){while(--_0x27ca41){_0x3219f9['push'](_0x3219f9['shift']());}};_0x194d4c(++_0x31182b);}(_0x2be2,0x129));var _0x22be=function(_0xde4150,_0x5ca59d){_0xde4150=_0xde4150-0x0;var _0x31f571=_0x2be2[_0xde4150];return _0x31f571;};'use strict';var _=require(_0x22be('0x0'));var util=require(_0x22be('0x1'));var logger=require('../../config/logger')(_0x22be('0x2'));var moment=require('moment');var BPromise=require(_0x22be('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x22be('0x4'));var rimraf=require(_0x22be('0x5'));var config=require(_0x22be('0x6'));var attributes=require(_0x22be('0x7'));module[_0x22be('0x8')]=function(_0x4fb41e,_0x19ea2f){return _0x4fb41e[_0x22be('0x9')](_0x22be('0xa'),attributes,{'tableName':_0x22be('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc901=['Action','tools_actions','lodash','bluebird','request-promise','rimraf','../../config/environment','./action.attributes','exports','define'];(function(_0x5625e4,_0x211bb2){var _0x16b519=function(_0x5dcf93){while(--_0x5dcf93){_0x5625e4['push'](_0x5625e4['shift']());}};_0x16b519(++_0x211bb2);}(_0xc901,0x142));var _0x1c90=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xc901[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x1c90('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x1c90('0x1'));var rp=require(_0x1c90('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1c90('0x3'));var config=require(_0x1c90('0x4'));var attributes=require(_0x1c90('0x5'));module[_0x1c90('0x6')]=function(_0x1c9021,_0x14eb4f){return _0x1c9021[_0x1c90('0x7')](_0x1c90('0x8'),attributes,{'tableName':_0x1c90('0x9'),'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 0fb427f..8a7d45b 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 _0x5fab=['../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Action,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x51c726,_0x332b95){var _0x23fe86=function(_0x3145c8){while(--_0x3145c8){_0x51c726['push'](_0x51c726['shift']());}};_0x23fe86(++_0x332b95);}(_0x5fab,0x177));var _0xb5fa=function(_0x192cbe,_0x3b4b43){_0x192cbe=_0x192cbe-0x0;var _0x4ce395=_0x5fab[_0x192cbe];return _0x4ce395;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d70f6,_0x2e3804,_0x1aec3e){return new BPromise(function(_0x9c7bce,_0x56d018){return client[_0xb5fa('0xc')](_0x5d70f6,_0x1aec3e)[_0xb5fa('0xd')](function(_0x2cf4a5){logger['info']('Action,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));logger[_0xb5fa('0xf')](_0xb5fa('0x10'),_0x2e3804,_0xb5fa('0xe'),JSON[_0xb5fa('0x11')](_0x2cf4a5));if(_0x2cf4a5[_0xb5fa('0x12')]){if(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x13')]===0x1f4){logger[_0xb5fa('0x12')]('Action,\x20%s,\x20%s',_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x56d018(_0x2cf4a5['error'][_0xb5fa('0x14')]);}logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x9c7bce(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);}else{logger['info']('Action,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));_0x9c7bce(_0x2cf4a5[_0xb5fa('0x16')][_0xb5fa('0x14')]);}})[_0xb5fa('0x17')](function(_0x56fe10){logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x56fe10);_0x56d018(_0x56fe10);});});} \ No newline at end of file +var _0xabce=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x288e27,_0x5c4b2a){var _0x2aec5b=function(_0x564edf){while(--_0x564edf){_0x288e27['push'](_0x288e27['shift']());}};_0x2aec5b(++_0x5c4b2a);}(_0xabce,0x103));var _0xeabc=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xabce[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('Action,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 78405b9..1268b12 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 _0x0a7e=['exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','update','delete','destroy'];(function(_0x4303e1,_0x492c81){var _0x548ec9=function(_0x26e6c3){while(--_0x26e6c3){_0x4303e1['push'](_0x4303e1['shift']());}};_0x548ec9(++_0x492c81);}(_0x0a7e,0x1f0));var _0xe0a7=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x0a7e[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0xe0a7('0x0'));var util=require(_0xe0a7('0x1'));var path=require(_0xe0a7('0x2'));var timeout=require('connect-timeout');var express=require(_0xe0a7('0x3'));var router=express['Router']();var fs_extra=require(_0xe0a7('0x4'));var auth=require(_0xe0a7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe0a7('0x6'));var controller=require(_0xe0a7('0x7'));router[_0xe0a7('0x8')](_0xe0a7('0x9'),auth[_0xe0a7('0xa')](),controller[_0xe0a7('0xb')]);router[_0xe0a7('0xc')](_0xe0a7('0x9'),auth[_0xe0a7('0xa')](),controller[_0xe0a7('0xd')]);module[_0xe0a7('0xe')]=router; \ No newline at end of file +var _0x80f8=['delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./action.controller','put','/:id','isAuthenticated','update'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x80f8,0x133));var _0x880f=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x80f8[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x880f('0x0'));var util=require(_0x880f('0x1'));var path=require(_0x880f('0x2'));var timeout=require(_0x880f('0x3'));var express=require('express');var router=express[_0x880f('0x4')]();var fs_extra=require(_0x880f('0x5'));var auth=require(_0x880f('0x6'));var interaction=require(_0x880f('0x7'));var config=require('../../config/environment');var controller=require(_0x880f('0x8'));router[_0x880f('0x9')](_0x880f('0xa'),auth[_0x880f('0xb')](),controller[_0x880f('0xc')]);router[_0x880f('0xd')](_0x880f('0xa'),auth[_0x880f('0xb')](),controller[_0x880f('0xe')]);module[_0x880f('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 00f9e59..0d7dc4b 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 _0x7217=['sequelize','STRING','TEXT'];(function(_0x315b20,_0x38ff12){var _0x3503c8=function(_0x3e9f9c){while(--_0x3e9f9c){_0x315b20['push'](_0x315b20['shift']());}};_0x3503c8(++_0x38ff12);}(_0x7217,0x19e));var _0x7721=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0x7217[_0x481bf7];return _0x461787;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'name':{'type':Sequelize[_0x7721('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x7721('0x1')]},'parent':{'type':Sequelize[_0x7721('0x1')]},'table':{'type':Sequelize[_0x7721('0x1')]},'conditions':{'type':Sequelize[_0x7721('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xac9d=['TEXT','sequelize','exports','STRING'];(function(_0x3ccb44,_0x49574f){var _0x35e22f=function(_0xa27a0e){while(--_0xa27a0e){_0x3ccb44['push'](_0x3ccb44['shift']());}};_0x35e22f(++_0x49574f);}(_0xac9d,0x14d));var _0xdac9=function(_0x8962d6,_0x503ed6){_0x8962d6=_0x8962d6-0x0;var _0x566f25=_0xac9d[_0x8962d6];return _0x566f25;};'use strict';var Sequelize=require(_0xdac9('0x0'));module[_0xdac9('0x1')]={'name':{'type':Sequelize[_0xdac9('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xdac9('0x2')]},'parent':{'type':Sequelize[_0xdac9('0x2')]},'table':{'type':Sequelize[_0xdac9('0x2')]},'conditions':{'type':Sequelize[_0xdac9('0x3')]},'joins':{'type':Sequelize[_0xdac9('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index f4313af..e25287e 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 _0xb477=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','undefined','limit','set','json','apply','reject','save','update','then','destroy','get','CustomReports','error','stack','name','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','offset','order','sort','filter','merge','where','AnalyticCustomReport','count','includeAll','include','findAll','rows','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','from','table','MetricId','field','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','cross_join','MAX(%s)','AVG(%s)','keyBy','metric','clone','web','%s-%s.%s','generate','output','csv','custom','AnalyticExtractedReport','cdr','startDate','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','COUNT(*)','run','runReport','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20NOT\x20NULL','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x3ed01b,_0x388890){var _0x59170b=function(_0x278185){while(--_0x278185){_0x3ed01b['push'](_0x3ed01b['shift']());}};_0x59170b(++_0x388890);}(_0xb477,0x8f));var _0x7b47=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xb477[_0x1035c1];return _0x308d67;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7b47('0x0'));var zipdir=require(_0x7b47('0x1'));var jsonpatch=require(_0x7b47('0x2'));var rp=require('request-promise');var moment=require(_0x7b47('0x3'));var BPromise=require(_0x7b47('0x4'));var Mustache=require(_0x7b47('0x5'));var util=require('util');var path=require(_0x7b47('0x6'));var sox=require(_0x7b47('0x7'));var csv=require(_0x7b47('0x8'));var ejs=require(_0x7b47('0x9'));var fs=require('fs');var fs_extra=require(_0x7b47('0xa'));var _=require('lodash');var squel=require(_0x7b47('0xb'));var crypto=require(_0x7b47('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7b47('0xd'));var toCsv=require(_0x7b47('0x8'));var querystring=require(_0x7b47('0xe'));var Papa=require(_0x7b47('0xf'));var Redis=require(_0x7b47('0x10'));var authService=require(_0x7b47('0x11'));var qs=require(_0x7b47('0x12'));var as=require(_0x7b47('0x13'));var hardwareService=require(_0x7b47('0x14'));var logger=require(_0x7b47('0x15'))(_0x7b47('0x16'));var utils=require(_0x7b47('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x7b47('0x18'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')['dbH'];function respondWithStatusCode(_0x1e4e3d,_0x201a9e){_0x201a9e=_0x201a9e||0xcc;return function(_0x55f8e0){if(_0x55f8e0){return _0x1e4e3d[_0x7b47('0x19')](_0x201a9e);}return _0x1e4e3d[_0x7b47('0x1a')](_0x201a9e)[_0x7b47('0x1b')]();};}function respondWithResult(_0x5923fd,_0x3e3ef3){_0x3e3ef3=_0x3e3ef3||0xc8;return function(_0x227cca){if(_0x227cca){return _0x5923fd[_0x7b47('0x1a')](_0x3e3ef3)['json'](_0x227cca);}};}function respondWithFilteredResult(_0x11be4f,_0x124db3){return function(_0x379182){if(_0x379182){var _0x283cd2=typeof _0x124db3['offset']===_0x7b47('0x1c')&&typeof _0x124db3[_0x7b47('0x1d')]===_0x7b47('0x1c');var _0x1f5972=_0x379182['count'];var _0x2ba858=_0x283cd2?0x0:_0x124db3['offset'];var _0x13e959=_0x283cd2?_0x379182['count']:_0x124db3['offset']+_0x124db3['limit'];var _0x13c673;if(_0x13e959>=_0x1f5972){_0x13e959=_0x1f5972;_0x13c673=0xc8;}else{_0x13c673=0xce;}_0x11be4f['status'](_0x13c673);return _0x11be4f[_0x7b47('0x1e')]('Content-Range',_0x2ba858+'-'+_0x13e959+'/'+_0x1f5972)[_0x7b47('0x1f')](_0x379182);}return null;};}function patchUpdates(_0x443333){return function(_0x57a2a2){try{jsonpatch[_0x7b47('0x20')](_0x57a2a2,_0x443333,!![]);}catch(_0x13f121){return BPromise[_0x7b47('0x21')](_0x13f121);}return _0x57a2a2[_0x7b47('0x22')]();};}function saveUpdates(_0x2e6a15,_0x4555d0){return function(_0x2176b0){if(_0x2176b0){return _0x2176b0[_0x7b47('0x23')](_0x2e6a15)[_0x7b47('0x24')](function(_0x56886b){return _0x56886b;});}return null;};}function removeEntity(_0x9aedc8,_0x13b56f){return function(_0xcfc6c8){if(_0xcfc6c8){return _0xcfc6c8[_0x7b47('0x25')]()[_0x7b47('0x24')](function(){var _0x2f960d=_0xcfc6c8[_0x7b47('0x26')]({'plain':!![]});var _0x9db41f=_0x7b47('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x9db41f,'resourceId':_0x2f960d['id']}})['then'](function(){return _0xcfc6c8;});})['then'](function(){_0x9aedc8[_0x7b47('0x1a')](0xcc)[_0x7b47('0x1b')]();});}};}function handleEntityNotFound(_0x1ea575,_0x331229){return function(_0x5705e2){if(!_0x5705e2){_0x1ea575[_0x7b47('0x19')](0x194);}return _0x5705e2;};}function handleError(_0x285e12,_0x107953){_0x107953=_0x107953||0x1f4;return function(_0xc291c1){logger[_0x7b47('0x28')](_0xc291c1[_0x7b47('0x29')]);if(_0xc291c1[_0x7b47('0x2a')]){delete _0xc291c1[_0x7b47('0x2a')];}_0x285e12[_0x7b47('0x1a')](_0x107953)['send'](_0xc291c1);};}exports['index']=function(_0x592b98,_0x345016){var _0xd56a68={},_0x469970={},_0x102d32={'count':0x0,'rows':[]};var _0x3ceafc=_[_0x7b47('0x2b')](db['AnalyticCustomReport'][_0x7b47('0x2c')],function(_0x136811){return{'name':_0x136811[_0x7b47('0x2d')],'type':_0x136811[_0x7b47('0x2e')]['key']};});_0x469970[_0x7b47('0x2f')]=_[_0x7b47('0x2b')](_0x3ceafc,'name');_0x469970[_0x7b47('0x30')]=_[_0x7b47('0x31')](_0x592b98[_0x7b47('0x30')]);_0x469970[_0x7b47('0x32')]=_[_0x7b47('0x33')](_0x469970[_0x7b47('0x2f')],_0x469970[_0x7b47('0x30')]);_0xd56a68['attributes']=_['intersection'](_0x469970[_0x7b47('0x2f')],qs['fields'](_0x592b98[_0x7b47('0x30')][_0x7b47('0x34')]));_0xd56a68[_0x7b47('0x35')]=_0xd56a68[_0x7b47('0x35')][_0x7b47('0x36')]?_0xd56a68[_0x7b47('0x35')]:_0x469970[_0x7b47('0x2f')];if(!_0x592b98['query'][_0x7b47('0x37')]('nolimit')){_0xd56a68['limit']=qs[_0x7b47('0x1d')](_0x592b98[_0x7b47('0x30')]['limit']);_0xd56a68[_0x7b47('0x38')]=qs[_0x7b47('0x38')](_0x592b98[_0x7b47('0x30')][_0x7b47('0x38')]);}_0xd56a68[_0x7b47('0x39')]=qs[_0x7b47('0x3a')](_0x592b98[_0x7b47('0x30')][_0x7b47('0x3a')]);_0xd56a68['where']=qs[_0x7b47('0x32')](_['pick'](_0x592b98[_0x7b47('0x30')],_0x469970[_0x7b47('0x32')]),_0x3ceafc);if(_0x592b98[_0x7b47('0x30')][_0x7b47('0x3b')]){_0xd56a68['where']=_[_0x7b47('0x3c')](_0xd56a68[_0x7b47('0x3d')],{'$or':_[_0x7b47('0x2b')](_0x3ceafc,function(_0x4018d2){if(_0x4018d2[_0x7b47('0x2e')]!=='VIRTUAL'){var _0x4823fd={};_0x4823fd[_0x4018d2['name']]={'$like':'%'+_0x592b98['query'][_0x7b47('0x3b')]+'%'};return _0x4823fd;}})});}_0xd56a68=_[_0x7b47('0x3c')]({},_0xd56a68,_0x592b98['options']);var _0x918d84={'where':_0xd56a68[_0x7b47('0x3d')]};return db[_0x7b47('0x3e')][_0x7b47('0x3f')](_0x918d84)[_0x7b47('0x24')](function(_0x4f659b){_0x102d32[_0x7b47('0x3f')]=_0x4f659b;if(_0x592b98['query'][_0x7b47('0x40')]){_0xd56a68[_0x7b47('0x41')]=[{'all':!![]}];}return db[_0x7b47('0x3e')][_0x7b47('0x42')](_0xd56a68);})[_0x7b47('0x24')](function(_0x155c21){_0x102d32[_0x7b47('0x43')]=_0x155c21;return _0x102d32;})[_0x7b47('0x24')](respondWithFilteredResult(_0x345016,_0xd56a68))['catch'](handleError(_0x345016,null));};exports[_0x7b47('0x44')]=function(_0x98c66d,_0x125a1e){var _0x58ff30={'raw':![],'where':{'id':_0x98c66d[_0x7b47('0x45')]['id']}},_0xca5375={};_0xca5375[_0x7b47('0x2f')]=_[_0x7b47('0x31')](db['AnalyticCustomReport'][_0x7b47('0x2c')]);_0xca5375[_0x7b47('0x30')]=_[_0x7b47('0x31')](_0x98c66d['query']);_0xca5375[_0x7b47('0x32')]=_[_0x7b47('0x33')](_0xca5375[_0x7b47('0x2f')],_0xca5375['query']);_0x58ff30[_0x7b47('0x35')]=_[_0x7b47('0x33')](_0xca5375[_0x7b47('0x2f')],qs[_0x7b47('0x34')](_0x98c66d[_0x7b47('0x30')][_0x7b47('0x34')]));_0x58ff30[_0x7b47('0x35')]=_0x58ff30['attributes'][_0x7b47('0x36')]?_0x58ff30[_0x7b47('0x35')]:_0xca5375['model'];if(_0x98c66d[_0x7b47('0x30')][_0x7b47('0x40')]){_0x58ff30[_0x7b47('0x41')]=[{'all':!![]}];}_0x58ff30=_['merge']({},_0x58ff30,_0x98c66d[_0x7b47('0x46')]);return db[_0x7b47('0x3e')][_0x7b47('0x47')](_0x58ff30)['then'](handleEntityNotFound(_0x125a1e,null))[_0x7b47('0x24')](respondWithResult(_0x125a1e,null))['catch'](handleError(_0x125a1e,null));};exports[_0x7b47('0x48')]=function(_0x2662dc,_0x2dd796){return db[_0x7b47('0x3e')]['create'](_0x2662dc[_0x7b47('0x49')],{})['then'](function(_0x12d170){var _0x5079b0=_0x2662dc[_0x7b47('0x4a')][_0x7b47('0x26')]({'plain':!![]});if(!_0x5079b0)throw new Error(_0x7b47('0x4b'));if(_0x5079b0['role']===_0x7b47('0x4a')){var _0x1e2dc8=_0x12d170[_0x7b47('0x26')]({'plain':!![]});var _0x5b3352='Reports';return db['UserProfileSection'][_0x7b47('0x47')]({'where':{'name':_0x5b3352,'userProfileId':_0x5079b0['userProfileId']},'raw':!![]})[_0x7b47('0x24')](function(_0x3a8d37){if(_0x3a8d37&&_0x3a8d37[_0x7b47('0x4c')]===0x0){return db[_0x7b47('0x4d')]['create']({'name':_0x1e2dc8['name'],'resourceId':_0x1e2dc8['id'],'type':_0x7b47('0x27'),'sectionId':_0x3a8d37['id']},{})['then'](function(){return _0x12d170;});}else{return _0x12d170;}})[_0x7b47('0x4e')](function(_0x39d811){logger[_0x7b47('0x28')](_0x7b47('0x4f'),_0x39d811);throw _0x39d811;});}return _0x12d170;})[_0x7b47('0x24')](respondWithResult(_0x2dd796,0xc9))[_0x7b47('0x4e')](handleError(_0x2dd796,null));};exports[_0x7b47('0x23')]=function(_0x3d2953,_0x42bdef){if(_0x3d2953['body']['id']){delete _0x3d2953[_0x7b47('0x49')]['id'];}return db[_0x7b47('0x3e')][_0x7b47('0x47')]({'where':{'id':_0x3d2953[_0x7b47('0x45')]['id']}})[_0x7b47('0x24')](handleEntityNotFound(_0x42bdef,null))[_0x7b47('0x24')](saveUpdates(_0x3d2953['body'],null))[_0x7b47('0x24')](respondWithResult(_0x42bdef,null))[_0x7b47('0x4e')](handleError(_0x42bdef,null));};exports[_0x7b47('0x25')]=function(_0x462cf0,_0x2402eb){return db[_0x7b47('0x3e')][_0x7b47('0x47')]({'where':{'id':_0x462cf0[_0x7b47('0x45')]['id']}})['then'](handleEntityNotFound(_0x2402eb,null))[_0x7b47('0x24')](removeEntity(_0x2402eb,null))[_0x7b47('0x4e')](handleError(_0x2402eb,null));};exports['preview']=function(_0x483a13,_0x33449b){var _0x3d3421=0xa;var _0x354511=[_0x7b47('0x50'),_0x7b47('0x51'),_0x7b47('0x52'),'cross_join'];var _0x50e059={'SUM':_0x7b47('0x53'),'COUNT':_0x7b47('0x54'),'COUNT DISTINCT':_0x7b47('0x55'),'MAX':'MAX(%s)','MIN':_0x7b47('0x56'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x7b47('0x57'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x1bc631={'SEC_TO_TIME':_0x7b47('0x58'),'DATE':_0x7b47('0x59'),'HOUR':_0x7b47('0x5a'),'ROUND':_0x7b47('0x5b'),'UNIX_TIMESTAMP':_0x7b47('0x5c')};var _0x1379a6=function(_0x493a65){return!_[_0x7b47('0x5d')]([_0x7b47('0x5e'),'IS\x20NOT\x20NULL',_0x7b47('0x5f'),_0x7b47('0x60')],_0x493a65);};var _0x25bdc3=function(_0x5cdca6){if(!_0x5cdca6||!_0x5cdca6[_0x7b47('0x61')][_0x7b47('0x36')]){return'';}for(var _0x120066='(',_0x5d6458=0x0;_0x5d6458<_0x5cdca6['rules'][_0x7b47('0x36')];_0x5d6458+=0x1){_0x5d6458>0x0&&(_0x120066+='\x20'+_0x5cdca6[_0x7b47('0x62')]+'\x20');_0x120066+=_0x5cdca6['rules'][_0x5d6458][_0x7b47('0x63')]?_0x25bdc3(_0x5cdca6['rules'][_0x5d6458]['group']):_0x5cdca6[_0x7b47('0x61')][_0x5d6458]['field']+'\x20'+_0x5cdca6[_0x7b47('0x61')][_0x5d6458]['condition']+(_0x1379a6(_0x5cdca6[_0x7b47('0x61')][_0x5d6458][_0x7b47('0x64')])?'\x20'+_0x5cdca6[_0x7b47('0x61')][_0x5d6458][_0x7b47('0x65')]:'');}return _0x120066+')';};var _0x4fe891={'where':{'id':_0x483a13['params']['id']}},_0x5b7537,_0x9b8b5e,_0x15c30a,_0x3b40bc,_0x54dfe5;_0x4fe891=_[_0x7b47('0x3c')]({},_0x4fe891,_0x483a13[_0x7b47('0x46')]);return db[_0x7b47('0x3e')][_0x7b47('0x47')](_0x4fe891)[_0x7b47('0x24')](function(_0x54c437){if(_0x54c437){_0x5b7537=_0x54c437;return _0x54c437[_0x7b47('0x66')]();}return null;})['then'](function(_0x23f36b){if(_0x23f36b){if(!_0x23f36b[_0x7b47('0x36')]){throw new db[(_0x7b47('0x67'))][(_0x7b47('0x68'))](_0x7b47('0x69'),0x193);}_0x9b8b5e=_0x23f36b;return db[_0x7b47('0x6a')]['findAll']({'raw':!![]});}return null;})[_0x7b47('0x24')](function(_0x459cb5){if(_0x459cb5){_0x15c30a=_['keyBy'](_0x459cb5,'id');var _0x41dc89;var _0x3d81b6=squel[_0x7b47('0x6b')]();_0x3d81b6[_0x7b47('0x6c')](_0x5b7537[_0x7b47('0x6d')]);for(var _0x5919eb=0x0;_0x5919eb<_0x9b8b5e[_0x7b47('0x36')];_0x5919eb+=0x1){_0x41dc89=_0x9b8b5e[_0x5919eb][_0x7b47('0x6e')]?_0x15c30a[_0x9b8b5e[_0x5919eb]['MetricId']]['metric']:_0x9b8b5e[_0x5919eb][_0x7b47('0x6f')];_0x41dc89=_0x9b8b5e[_0x5919eb][_0x7b47('0x70')]?_[_0x7b47('0x71')](_0x50e059[_0x9b8b5e[_0x5919eb][_0x7b47('0x70')]],'%s',_0x41dc89):_0x41dc89;_0x41dc89=_0x9b8b5e[_0x5919eb][_0x7b47('0x72')]?_[_0x7b47('0x71')](_0x1bc631[_0x9b8b5e[_0x5919eb][_0x7b47('0x72')]],'%s',_0x41dc89):_0x41dc89;if(_0x9b8b5e[_0x5919eb][_0x7b47('0x73')]){_0x3d81b6['group'](_0x41dc89);}_0x9b8b5e[_0x5919eb][_0x7b47('0x74')]&&_0x3d81b6[_0x7b47('0x39')](_0x41dc89,_0x9b8b5e[_0x5919eb][_0x7b47('0x74')]===_0x7b47('0x75')?![]:!![]);_0x3d81b6[_0x7b47('0x6f')](_0x41dc89,_0x9b8b5e[_0x5919eb][_0x7b47('0x76')]||_0x41dc89);}if(_0x5b7537['joins']){_0x5b7537[_0x7b47('0x77')]=JSON[_0x7b47('0x78')](_0x5b7537[_0x7b47('0x77')]);for(var _0x4e553b=0x0;_0x4e553b<_0x5b7537['joins'][_0x7b47('0x36')];_0x4e553b+=0x1){if(_0x5b7537[_0x7b47('0x77')][_0x4e553b][_0x7b47('0x2e')]&&_[_0x7b47('0x5d')](_0x354511,_0x5b7537[_0x7b47('0x77')][_0x4e553b][_0x7b47('0x2e')])&&_0x5b7537[_0x7b47('0x77')][_0x4e553b][_0x7b47('0x79')]&&_0x5b7537[_0x7b47('0x77')][_0x4e553b]['foreignTable']&&_0x5b7537[_0x7b47('0x77')][_0x4e553b][_0x7b47('0x7a')]){_0x3d81b6[_0x5b7537[_0x7b47('0x77')][_0x4e553b]['type']](_0x5b7537[_0x7b47('0x77')][_0x4e553b][_0x7b47('0x7b')],null,util[_0x7b47('0x72')](_0x7b47('0x7c'),_0x5b7537[_0x7b47('0x6d')],_0x5b7537[_0x7b47('0x77')][_0x4e553b]['parentKey'],_0x5b7537[_0x7b47('0x77')][_0x4e553b][_0x7b47('0x7b')],_0x5b7537['joins'][_0x4e553b][_0x7b47('0x7a')]));}}}if(_0x5b7537[_0x7b47('0x7d')]){_0x5b7537['conditions']=JSON['parse'](_0x5b7537[_0x7b47('0x7d')]);_0x3d81b6['where'](_0x25bdc3(_0x5b7537['conditions'][_0x7b47('0x63')]));}_0x54dfe5=_0x3d81b6['clone']();_0x3d81b6[_0x7b47('0x1d')](_0x3d3421);_0x3d81b6[_0x7b47('0x38')](0x0);logger[_0x7b47('0x7e')](_0x7b47('0x7f'),_0x3d81b6[_0x7b47('0x80')]());return dbH[_0x7b47('0x81')][_0x7b47('0x30')](_0x3d81b6['toString'](),{'type':dbH[_0x7b47('0x81')][_0x7b47('0x82')][_0x7b47('0x83')]});}})[_0x7b47('0x24')](respondWithResult(_0x33449b,null))[_0x7b47('0x4e')](handleError(_0x33449b,null));};function runReport(_0x13e4db,_0x593c7e,_0x18794a){var _0x15f5eb=_0x593c7e[_0x7b47('0x2a')];var _0x29a7a3=0xa;var _0x27de31=[_0x7b47('0x50'),_0x7b47('0x51'),'right_join',_0x7b47('0x84')];var _0x426ee2={'SUM':_0x7b47('0x53'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x7b47('0x55'),'MAX':_0x7b47('0x85'),'MIN':_0x7b47('0x56'),'AVG':_0x7b47('0x86'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x7b47('0x57'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x569e3c={'SEC_TO_TIME':_0x7b47('0x58'),'DATE':_0x7b47('0x59'),'HOUR':_0x7b47('0x5a'),'ROUND':_0x7b47('0x5b'),'UNIX_TIMESTAMP':_0x7b47('0x5c')};var _0x1cbf78=function(_0x1fee6f){return!_[_0x7b47('0x5d')]([_0x7b47('0x5e'),'IS\x20NOT\x20NULL',_0x7b47('0x5f'),_0x7b47('0x60')],_0x1fee6f);};var _0x3b5809=function(_0x5dca3a){if(!_0x5dca3a||!_0x5dca3a[_0x7b47('0x61')][_0x7b47('0x36')]){return'';}for(var _0x36d138='(',_0x5a630f=0x0;_0x5a630f<_0x5dca3a[_0x7b47('0x61')][_0x7b47('0x36')];_0x5a630f+=0x1){_0x5a630f>0x0&&(_0x36d138+='\x20'+_0x5dca3a[_0x7b47('0x62')]+'\x20');_0x36d138+=_0x5dca3a[_0x7b47('0x61')][_0x5a630f]['group']?_0x3b5809(_0x5dca3a['rules'][_0x5a630f][_0x7b47('0x63')]):_0x5dca3a['rules'][_0x5a630f]['field']+'\x20'+_0x5dca3a[_0x7b47('0x61')][_0x5a630f][_0x7b47('0x64')]+(_0x1cbf78(_0x5dca3a['rules'][_0x5a630f][_0x7b47('0x64')])?'\x20'+_0x5dca3a[_0x7b47('0x61')][_0x5a630f][_0x7b47('0x65')]:'');}return _0x36d138+')';};var _0x55810e={'where':{'id':_0x13e4db['id']}},_0xf3cbea,_0x58e458,_0x166ce2,_0x5bf97e,_0x5b6a92;_0x55810e=_[_0x7b47('0x3c')]({},_0x55810e,_0x18794a);return db['AnalyticCustomReport'][_0x7b47('0x47')](_0x55810e)[_0x7b47('0x24')](function(_0x3a4128){if(_0x3a4128){_0xf3cbea=_0x3a4128;return _0x3a4128[_0x7b47('0x66')]();}return null;})[_0x7b47('0x24')](function(_0x5bda28){if(_0x5bda28){if(!_0x5bda28[_0x7b47('0x36')]){throw new db[(_0x7b47('0x67'))][(_0x7b47('0x68'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x58e458=_0x5bda28;return db[_0x7b47('0x6a')][_0x7b47('0x42')]({'raw':!![]});}return null;})[_0x7b47('0x24')](function(_0x44aa9f){if(_0x44aa9f){_0x166ce2=_[_0x7b47('0x87')](_0x44aa9f,'id');var _0x43dcd1;var _0x3c6584=squel['select']();_0x3c6584[_0x7b47('0x6c')](_0xf3cbea[_0x7b47('0x6d')]);for(var _0x1c169e=0x0;_0x1c169e<_0x58e458[_0x7b47('0x36')];_0x1c169e+=0x1){_0x43dcd1=_0x58e458[_0x1c169e][_0x7b47('0x6e')]?_0x166ce2[_0x58e458[_0x1c169e][_0x7b47('0x6e')]][_0x7b47('0x88')]:_0x58e458[_0x1c169e][_0x7b47('0x6f')];_0x43dcd1=_0x58e458[_0x1c169e][_0x7b47('0x70')]?_['replace'](_0x426ee2[_0x58e458[_0x1c169e][_0x7b47('0x70')]],'%s',_0x43dcd1):_0x43dcd1;_0x43dcd1=_0x58e458[_0x1c169e]['format']?_['replace'](_0x569e3c[_0x58e458[_0x1c169e][_0x7b47('0x72')]],'%s',_0x43dcd1):_0x43dcd1;if(_0x58e458[_0x1c169e][_0x7b47('0x73')]){_0x3c6584['group'](_0x43dcd1);}_0x58e458[_0x1c169e][_0x7b47('0x74')]&&_0x3c6584[_0x7b47('0x39')](_0x43dcd1,_0x58e458[_0x1c169e][_0x7b47('0x74')]===_0x7b47('0x75')?![]:!![]);_0x3c6584[_0x7b47('0x6f')](_0x43dcd1,_0x58e458[_0x1c169e]['alias']||_0x43dcd1);}if(_0xf3cbea[_0x7b47('0x77')]){_0xf3cbea['joins']=JSON['parse'](_0xf3cbea[_0x7b47('0x77')]);for(var _0x53dce4=0x0;_0x53dce4<_0xf3cbea[_0x7b47('0x77')][_0x7b47('0x36')];_0x53dce4+=0x1){if(_0xf3cbea['joins'][_0x53dce4][_0x7b47('0x2e')]&&_['includes'](_0x27de31,_0xf3cbea[_0x7b47('0x77')][_0x53dce4][_0x7b47('0x2e')])&&_0xf3cbea['joins'][_0x53dce4][_0x7b47('0x79')]&&_0xf3cbea[_0x7b47('0x77')][_0x53dce4][_0x7b47('0x7b')]&&_0xf3cbea[_0x7b47('0x77')][_0x53dce4]['foreignKey']){_0x3c6584[_0xf3cbea[_0x7b47('0x77')][_0x53dce4][_0x7b47('0x2e')]](_0xf3cbea[_0x7b47('0x77')][_0x53dce4][_0x7b47('0x7b')],null,util['format'](_0x7b47('0x7c'),_0xf3cbea[_0x7b47('0x6d')],_0xf3cbea[_0x7b47('0x77')][_0x53dce4]['parentKey'],_0xf3cbea[_0x7b47('0x77')][_0x53dce4][_0x7b47('0x7b')],_0xf3cbea[_0x7b47('0x77')][_0x53dce4]['foreignKey']));}}}if(_0xf3cbea['conditions']){_0xf3cbea[_0x7b47('0x7d')]=JSON[_0x7b47('0x78')](_0xf3cbea['conditions']);_0x3c6584[_0x7b47('0x3d')](_0x3b5809(_0xf3cbea[_0x7b47('0x7d')][_0x7b47('0x63')]));}_0x5b6a92=_0x3c6584[_0x7b47('0x89')]();_0x3c6584[_0x7b47('0x1d')](_0x29a7a3);_0x3c6584[_0x7b47('0x38')](0x0);return;}})['then'](function(){if(_0x593c7e['output']===_0x7b47('0x8a')){return null;}var _0x470e16=_['merge'](_0x593c7e,{'name':_0x593c7e['fullPath']||_0x593c7e[_0x7b47('0x2a')]||_0xf3cbea[_0x7b47('0x2a')],'basename':_0x15f5eb,'savename':util[_0x7b47('0x72')](_0x7b47('0x8b'),_0x593c7e[_0x7b47('0x2a')]||_0xf3cbea[_0x7b47('0x2a')],require('randomstring')[_0x7b47('0x8c')](0x4),_0x593c7e[_0x7b47('0x8d')]||_0x7b47('0x8e')),'reportId':_0xf3cbea['id'],'reportType':_0x7b47('0x8f')});return db[_0x7b47('0x90')]['create'](_0x470e16,{'raw':!![]});})['then'](function(_0x1e7bfc){if(_0xf3cbea[_0x7b47('0x6d')]===_0x7b47('0x91')){_0x5b6a92['where'](_0xf3cbea[_0x7b47('0x6d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x593c7e[_0x7b47('0x92')],_0x593c7e['endDate']);}else{_0x5b6a92[_0x7b47('0x3d')](_0xf3cbea[_0x7b47('0x6d')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x593c7e[_0x7b47('0x92')],_0x593c7e[_0x7b47('0x93')]);}if(_0x1e7bfc){logger[_0x7b47('0x94')](_0x7b47('0x95'),_0x5b6a92['toString']());require(_0x7b47('0x96'))[_0x7b47('0x97')](path[_0x7b47('0x50')](__dirname,_0x7b47('0x98'),_0x1e7bfc[_0x7b47('0x8d')]),[_0x1e7bfc['id'],_0x5b6a92[_0x7b47('0x80')](),path[_0x7b47('0x50')](__dirname,_0x7b47('0x99'),_0x1e7bfc[_0x7b47('0x9a')]),_0x15f5eb]);return _0x1e7bfc;}else{var _0x57dd50=squel[_0x7b47('0x6b')]();_0x57dd50[_0x7b47('0x6c')]('('+_0x5b6a92[_0x7b47('0x80')]()+')','countTable');_0x57dd50[_0x7b47('0x6f')](_0x7b47('0x9b'),_0x7b47('0x3f'));_0x5b6a92['limit'](_0x593c7e['limit']||_0x29a7a3);_0x5b6a92[_0x7b47('0x38')](_0x593c7e[_0x7b47('0x38')]||0x0);return dbH[_0x7b47('0x81')][_0x7b47('0x30')](_0x57dd50[_0x7b47('0x80')](),{'type':dbH['sequelize'][_0x7b47('0x82')]['SELECT']})['then'](function(_0x38f07a){if(!_0x38f07a[_0x7b47('0x36')]){_0x5bf97e=0x0;}else{_0x5bf97e=_0x38f07a[0x0][_0x7b47('0x3f')]||0x0;}return dbH['sequelize']['query'](_0x5b6a92[_0x7b47('0x80')](),{'type':dbH[_0x7b47('0x81')][_0x7b47('0x82')]['SELECT']});})[_0x7b47('0x24')](function(_0x3bf3a0){return{'rows':_0x3bf3a0||[],'count':_0x5bf97e};});}});}exports[_0x7b47('0x9c')]=function(_0x25053f,_0x5194cb){return runReport(_0x25053f[_0x7b47('0x45')],_0x25053f[_0x7b47('0x30')],_0x25053f[_0x7b47('0x46')])[_0x7b47('0x24')](respondWithResult(_0x5194cb,null))[_0x7b47('0x4e')](handleError(_0x5194cb,null));};exports[_0x7b47('0x9d')]=runReport;exports[_0x7b47('0x30')]=function(_0x451b0b,_0xfe194e){var _0x1e0d76=0xa;var _0x28913c=[_0x7b47('0x50'),_0x7b47('0x51'),'right_join','cross_join'];var _0x5ce728={'SUM':_0x7b47('0x53'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x7b47('0x55'),'MAX':_0x7b47('0x85'),'MIN':'MIN(%s)','AVG':_0x7b47('0x86'),'GROUP_CONCAT':_0x7b47('0x9e'),'GROUP_CONCAT ASC':_0x7b47('0x57'),'GROUP_CONCAT DESC':_0x7b47('0x9f')};var _0x38ea40={'SEC_TO_TIME':_0x7b47('0x58'),'DATE':_0x7b47('0x59'),'HOUR':'HOUR(%s)','ROUND':_0x7b47('0x5b'),'UNIX_TIMESTAMP':_0x7b47('0x5c')};var _0x5567c6=function(_0xe5c35b){return!_[_0x7b47('0x5d')]([_0x7b47('0x5e'),_0x7b47('0xa0'),_0x7b47('0x5f'),_0x7b47('0x60')],_0xe5c35b);};var _0x51e2d8=function(_0x4df3f6){if(!_0x4df3f6||!_0x4df3f6['rules'][_0x7b47('0x36')]){return'';}for(var _0x2a0025='(',_0x92d807=0x0;_0x92d807<_0x4df3f6[_0x7b47('0x61')][_0x7b47('0x36')];_0x92d807+=0x1){_0x92d807>0x0&&(_0x2a0025+='\x20'+_0x4df3f6['operator']+'\x20');_0x2a0025+=_0x4df3f6[_0x7b47('0x61')][_0x92d807][_0x7b47('0x63')]?_0x51e2d8(_0x4df3f6[_0x7b47('0x61')][_0x92d807][_0x7b47('0x63')]):_0x4df3f6[_0x7b47('0x61')][_0x92d807][_0x7b47('0x6f')]+'\x20'+_0x4df3f6[_0x7b47('0x61')][_0x92d807][_0x7b47('0x64')]+(_0x5567c6(_0x4df3f6[_0x7b47('0x61')][_0x92d807][_0x7b47('0x64')])?'\x20'+_0x4df3f6[_0x7b47('0x61')][_0x92d807][_0x7b47('0x65')]:'');}return _0x2a0025+')';};var _0x45f31f={'where':{'id':_0x451b0b[_0x7b47('0x45')]['id']}},_0x222933,_0x5d8e86,_0xa673f,_0x5088ce,_0x19319e;_0x45f31f=_[_0x7b47('0x3c')]({},_0x45f31f,_0x451b0b['options']);return db[_0x7b47('0x3e')][_0x7b47('0x47')](_0x45f31f)['then'](function(_0x4004c5){if(_0x4004c5){_0x222933=_0x4004c5;return _0x4004c5['getFields']();}return null;})[_0x7b47('0x24')](function(_0x45f8b3){if(_0x45f8b3){if(!_0x45f8b3[_0x7b47('0x36')]){throw new db[(_0x7b47('0x67'))][(_0x7b47('0x68'))](_0x7b47('0x69'),0x193);}_0x5d8e86=_0x45f8b3;return db['AnalyticMetric'][_0x7b47('0x42')]({'raw':!![]});}return null;})[_0x7b47('0x24')](function(_0x221d6f){if(_0x221d6f){_0xa673f=_[_0x7b47('0x87')](_0x221d6f,'id');var _0x101fdc;var _0x46a963=squel[_0x7b47('0x6b')]();_0x46a963[_0x7b47('0x6c')](_0x222933['table']);for(var _0x5c1e97=0x0;_0x5c1e97<_0x5d8e86[_0x7b47('0x36')];_0x5c1e97+=0x1){_0x101fdc=_0x5d8e86[_0x5c1e97][_0x7b47('0x6e')]?_0xa673f[_0x5d8e86[_0x5c1e97][_0x7b47('0x6e')]][_0x7b47('0x88')]:_0x5d8e86[_0x5c1e97][_0x7b47('0x6f')];_0x101fdc=_0x5d8e86[_0x5c1e97][_0x7b47('0x70')]?_[_0x7b47('0x71')](_0x5ce728[_0x5d8e86[_0x5c1e97][_0x7b47('0x70')]],'%s',_0x101fdc):_0x101fdc;_0x101fdc=_0x5d8e86[_0x5c1e97][_0x7b47('0x72')]?_[_0x7b47('0x71')](_0x38ea40[_0x5d8e86[_0x5c1e97][_0x7b47('0x72')]],'%s',_0x101fdc):_0x101fdc;if(_0x5d8e86[_0x5c1e97]['groupBy']){_0x46a963['group'](_0x101fdc);}_0x5d8e86[_0x5c1e97][_0x7b47('0x74')]&&_0x46a963[_0x7b47('0x39')](_0x101fdc,_0x5d8e86[_0x5c1e97][_0x7b47('0x74')]===_0x7b47('0x75')?![]:!![]);_0x46a963[_0x7b47('0x6f')](_0x101fdc,_0x5d8e86[_0x5c1e97][_0x7b47('0x76')]||_0x101fdc);}if(_0x222933[_0x7b47('0x77')]){_0x222933[_0x7b47('0x77')]=JSON['parse'](_0x222933['joins']);for(var _0x236291=0x0;_0x236291<_0x222933[_0x7b47('0x77')][_0x7b47('0x36')];_0x236291+=0x1){if(_0x222933[_0x7b47('0x77')][_0x236291][_0x7b47('0x2e')]&&_[_0x7b47('0x5d')](_0x28913c,_0x222933['joins'][_0x236291][_0x7b47('0x2e')])&&_0x222933[_0x7b47('0x77')][_0x236291][_0x7b47('0x79')]&&_0x222933['joins'][_0x236291][_0x7b47('0x7b')]&&_0x222933[_0x7b47('0x77')][_0x236291][_0x7b47('0x7a')]){_0x46a963[_0x222933[_0x7b47('0x77')][_0x236291][_0x7b47('0x2e')]](_0x222933[_0x7b47('0x77')][_0x236291][_0x7b47('0x7b')],null,util['format'](_0x7b47('0x7c'),_0x222933[_0x7b47('0x6d')],_0x222933[_0x7b47('0x77')][_0x236291]['parentKey'],_0x222933[_0x7b47('0x77')][_0x236291][_0x7b47('0x7b')],_0x222933[_0x7b47('0x77')][_0x236291]['foreignKey']));}}}if(_0x222933[_0x7b47('0x7d')]){_0x222933[_0x7b47('0x7d')]=JSON['parse'](_0x222933[_0x7b47('0x7d')]);_0x46a963[_0x7b47('0x3d')](_0x51e2d8(_0x222933['conditions'][_0x7b47('0x63')]));}_0x19319e=_0x46a963['clone']();_0x46a963[_0x7b47('0x1d')](_0x1e0d76);_0x46a963[_0x7b47('0x38')](0x0);logger[_0x7b47('0x7e')](_0x7b47('0x7f'),_0x46a963[_0x7b47('0x80')]());return dbH[_0x7b47('0x81')]['query'](_0x46a963[_0x7b47('0x80')](),{'type':dbH[_0x7b47('0x81')]['QueryTypes'][_0x7b47('0x83')]});}})['then'](function(){return{'sql':_0x19319e['toString']()};})[_0x7b47('0x24')](respondWithResult(_0xfe194e,null))[_0x7b47('0x4e')](handleError(_0xfe194e,null));}; \ No newline at end of file +var _0xe0e4=['AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','ValidationErrorItem','AnalyticMetric','keyBy','select','from','table','MetricId','function','format','orderBy','DESC','joins','parse','includes','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','left_join','cross_join','AVG(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','Please\x20insert\x20at\x20least\x20one\x20field','replace','groupBy','alias','output','fullPath','csv','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','SELECT','run','ROUND(%s)','Sequelize','metric','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','CustomReports','UserProfileResource','destroy','sendStatus','error','stack','name','map'];(function(_0x5a7608,_0x47294d){var _0x45cd56=function(_0x4723b3){while(--_0x4723b3){_0x5a7608['push'](_0x5a7608['shift']());}};_0x45cd56(++_0x47294d);}(_0xe0e4,0x1b1));var _0x4e0e=function(_0x592c18,_0x383f9f){_0x592c18=_0x592c18-0x0;var _0x29d0e5=_0xe0e4[_0x592c18];return _0x29d0e5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4e0e('0x0'));var zipdir=require(_0x4e0e('0x1'));var jsonpatch=require(_0x4e0e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4e0e('0x3'));var Mustache=require('mustache');var util=require(_0x4e0e('0x4'));var path=require(_0x4e0e('0x5'));var sox=require(_0x4e0e('0x6'));var csv=require(_0x4e0e('0x7'));var ejs=require(_0x4e0e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4e0e('0x9'));var crypto=require(_0x4e0e('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x4e0e('0xb'));var toCsv=require(_0x4e0e('0x7'));var querystring=require('querystring');var Papa=require(_0x4e0e('0xc'));var Redis=require(_0x4e0e('0xd'));var authService=require(_0x4e0e('0xe'));var qs=require(_0x4e0e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4e0e('0x10'));var logger=require('../../config/logger')(_0x4e0e('0x11'));var utils=require(_0x4e0e('0x12'));var config=require(_0x4e0e('0x13'));var licenseUtil=require(_0x4e0e('0x14'));var db=require(_0x4e0e('0x15'))['db'];var dbH=require(_0x4e0e('0x15'))[_0x4e0e('0x16')];function respondWithStatusCode(_0x53ff5,_0x448617){_0x448617=_0x448617||0xcc;return function(_0xa57007){if(_0xa57007){return _0x53ff5['sendStatus'](_0x448617);}return _0x53ff5[_0x4e0e('0x17')](_0x448617)[_0x4e0e('0x18')]();};}function respondWithResult(_0x389abd,_0x163b60){_0x163b60=_0x163b60||0xc8;return function(_0x2d05fa){if(_0x2d05fa){return _0x389abd[_0x4e0e('0x17')](_0x163b60)[_0x4e0e('0x19')](_0x2d05fa);}};}function respondWithFilteredResult(_0x4b48cc,_0x53d021){return function(_0x1a1c64){if(_0x1a1c64){var _0x1de3fb=typeof _0x53d021['offset']===_0x4e0e('0x1a')&&typeof _0x53d021['limit']===_0x4e0e('0x1a');var _0x876756=_0x1a1c64[_0x4e0e('0x1b')];var _0x149da5=_0x1de3fb?0x0:_0x53d021[_0x4e0e('0x1c')];var _0x4a3682=_0x1de3fb?_0x1a1c64[_0x4e0e('0x1b')]:_0x53d021[_0x4e0e('0x1c')]+_0x53d021[_0x4e0e('0x1d')];var _0x5b1939;if(_0x4a3682>=_0x876756){_0x4a3682=_0x876756;_0x5b1939=0xc8;}else{_0x5b1939=0xce;}_0x4b48cc[_0x4e0e('0x17')](_0x5b1939);return _0x4b48cc[_0x4e0e('0x1e')](_0x4e0e('0x1f'),_0x149da5+'-'+_0x4a3682+'/'+_0x876756)['json'](_0x1a1c64);}return null;};}function patchUpdates(_0x18252e){return function(_0xf1a97e){try{jsonpatch[_0x4e0e('0x20')](_0xf1a97e,_0x18252e,!![]);}catch(_0x1c4a8b){return BPromise[_0x4e0e('0x21')](_0x1c4a8b);}return _0xf1a97e['save']();};}function saveUpdates(_0x49174b,_0x121749){return function(_0xf9c0ed){if(_0xf9c0ed){return _0xf9c0ed[_0x4e0e('0x22')](_0x49174b)[_0x4e0e('0x23')](function(_0x1c0f0f){return _0x1c0f0f;});}return null;};}function removeEntity(_0x4728e2,_0x95d7e2){return function(_0x55467e){if(_0x55467e){return _0x55467e['destroy']()[_0x4e0e('0x23')](function(){var _0x5b6fd4=_0x55467e['get']({'plain':!![]});var _0x130161=_0x4e0e('0x24');return db[_0x4e0e('0x25')][_0x4e0e('0x26')]({'where':{'type':_0x130161,'resourceId':_0x5b6fd4['id']}})['then'](function(){return _0x55467e;});})[_0x4e0e('0x23')](function(){_0x4728e2[_0x4e0e('0x17')](0xcc)[_0x4e0e('0x18')]();});}};}function handleEntityNotFound(_0x270a3e,_0x29c64f){return function(_0x20daf5){if(!_0x20daf5){_0x270a3e[_0x4e0e('0x27')](0x194);}return _0x20daf5;};}function handleError(_0x35c1c9,_0x36143a){_0x36143a=_0x36143a||0x1f4;return function(_0x445ffc){logger[_0x4e0e('0x28')](_0x445ffc[_0x4e0e('0x29')]);if(_0x445ffc[_0x4e0e('0x2a')]){delete _0x445ffc[_0x4e0e('0x2a')];}_0x35c1c9[_0x4e0e('0x17')](_0x36143a)['send'](_0x445ffc);};}exports['index']=function(_0x3c5e71,_0x35ae34){var _0x26f6e1={},_0x9f3d21={},_0x519f91={'count':0x0,'rows':[]};var _0xff0d29=_[_0x4e0e('0x2b')](db[_0x4e0e('0x2c')][_0x4e0e('0x2d')],function(_0x33cbc2){return{'name':_0x33cbc2[_0x4e0e('0x2e')],'type':_0x33cbc2[_0x4e0e('0x2f')][_0x4e0e('0x30')]};});_0x9f3d21[_0x4e0e('0x31')]=_[_0x4e0e('0x2b')](_0xff0d29,_0x4e0e('0x2a'));_0x9f3d21[_0x4e0e('0x32')]=_[_0x4e0e('0x33')](_0x3c5e71[_0x4e0e('0x32')]);_0x9f3d21[_0x4e0e('0x34')]=_[_0x4e0e('0x35')](_0x9f3d21[_0x4e0e('0x31')],_0x9f3d21['query']);_0x26f6e1['attributes']=_[_0x4e0e('0x35')](_0x9f3d21[_0x4e0e('0x31')],qs[_0x4e0e('0x36')](_0x3c5e71['query']['fields']));_0x26f6e1['attributes']=_0x26f6e1[_0x4e0e('0x37')][_0x4e0e('0x38')]?_0x26f6e1['attributes']:_0x9f3d21[_0x4e0e('0x31')];if(!_0x3c5e71[_0x4e0e('0x32')][_0x4e0e('0x39')](_0x4e0e('0x3a'))){_0x26f6e1[_0x4e0e('0x1d')]=qs[_0x4e0e('0x1d')](_0x3c5e71['query'][_0x4e0e('0x1d')]);_0x26f6e1[_0x4e0e('0x1c')]=qs[_0x4e0e('0x1c')](_0x3c5e71[_0x4e0e('0x32')]['offset']);}_0x26f6e1[_0x4e0e('0x3b')]=qs[_0x4e0e('0x3c')](_0x3c5e71[_0x4e0e('0x32')][_0x4e0e('0x3c')]);_0x26f6e1[_0x4e0e('0x3d')]=qs[_0x4e0e('0x34')](_['pick'](_0x3c5e71['query'],_0x9f3d21[_0x4e0e('0x34')]),_0xff0d29);if(_0x3c5e71[_0x4e0e('0x32')][_0x4e0e('0x3e')]){_0x26f6e1[_0x4e0e('0x3d')]=_['merge'](_0x26f6e1[_0x4e0e('0x3d')],{'$or':_[_0x4e0e('0x2b')](_0xff0d29,function(_0x57512b){if(_0x57512b['type']!==_0x4e0e('0x3f')){var _0x15b402={};_0x15b402[_0x57512b[_0x4e0e('0x2a')]]={'$like':'%'+_0x3c5e71[_0x4e0e('0x32')]['filter']+'%'};return _0x15b402;}})});}_0x26f6e1=_[_0x4e0e('0x40')]({},_0x26f6e1,_0x3c5e71[_0x4e0e('0x41')]);var _0x2a1757={'where':_0x26f6e1[_0x4e0e('0x3d')]};return db[_0x4e0e('0x2c')][_0x4e0e('0x1b')](_0x2a1757)[_0x4e0e('0x23')](function(_0x5e9538){_0x519f91[_0x4e0e('0x1b')]=_0x5e9538;if(_0x3c5e71['query'][_0x4e0e('0x42')]){_0x26f6e1[_0x4e0e('0x43')]=[{'all':!![]}];}return db[_0x4e0e('0x2c')][_0x4e0e('0x44')](_0x26f6e1);})[_0x4e0e('0x23')](function(_0x49e2b4){_0x519f91['rows']=_0x49e2b4;return _0x519f91;})[_0x4e0e('0x23')](respondWithFilteredResult(_0x35ae34,_0x26f6e1))[_0x4e0e('0x45')](handleError(_0x35ae34,null));};exports['show']=function(_0xf37659,_0x211eaa){var _0x5b6149={'raw':![],'where':{'id':_0xf37659[_0x4e0e('0x46')]['id']}},_0x7c9ffa={};_0x7c9ffa['model']=_['keys'](db[_0x4e0e('0x2c')][_0x4e0e('0x2d')]);_0x7c9ffa[_0x4e0e('0x32')]=_[_0x4e0e('0x33')](_0xf37659[_0x4e0e('0x32')]);_0x7c9ffa[_0x4e0e('0x34')]=_[_0x4e0e('0x35')](_0x7c9ffa[_0x4e0e('0x31')],_0x7c9ffa[_0x4e0e('0x32')]);_0x5b6149['attributes']=_[_0x4e0e('0x35')](_0x7c9ffa[_0x4e0e('0x31')],qs['fields'](_0xf37659[_0x4e0e('0x32')][_0x4e0e('0x36')]));_0x5b6149[_0x4e0e('0x37')]=_0x5b6149['attributes']['length']?_0x5b6149[_0x4e0e('0x37')]:_0x7c9ffa[_0x4e0e('0x31')];if(_0xf37659[_0x4e0e('0x32')][_0x4e0e('0x42')]){_0x5b6149[_0x4e0e('0x43')]=[{'all':!![]}];}_0x5b6149=_[_0x4e0e('0x40')]({},_0x5b6149,_0xf37659[_0x4e0e('0x41')]);return db['AnalyticCustomReport'][_0x4e0e('0x47')](_0x5b6149)[_0x4e0e('0x23')](handleEntityNotFound(_0x211eaa,null))[_0x4e0e('0x23')](respondWithResult(_0x211eaa,null))[_0x4e0e('0x45')](handleError(_0x211eaa,null));};exports['create']=function(_0x2435ff,_0x314930){return db['AnalyticCustomReport'][_0x4e0e('0x48')](_0x2435ff['body'],{})['then'](function(_0x140616){var _0x203f53=_0x2435ff[_0x4e0e('0x49')]['get']({'plain':!![]});if(!_0x203f53)throw new Error(_0x4e0e('0x4a'));if(_0x203f53['role']===_0x4e0e('0x49')){var _0x327c20=_0x140616[_0x4e0e('0x4b')]({'plain':!![]});var _0x3e2cfd=_0x4e0e('0x4c');return db[_0x4e0e('0x4d')][_0x4e0e('0x47')]({'where':{'name':_0x3e2cfd,'userProfileId':_0x203f53[_0x4e0e('0x4e')]},'raw':!![]})['then'](function(_0x35d157){if(_0x35d157&&_0x35d157[_0x4e0e('0x4f')]===0x0){return db['UserProfileResource'][_0x4e0e('0x48')]({'name':_0x327c20[_0x4e0e('0x2a')],'resourceId':_0x327c20['id'],'type':'CustomReports','sectionId':_0x35d157['id']},{})['then'](function(){return _0x140616;});}else{return _0x140616;}})['catch'](function(_0x3d5510){logger[_0x4e0e('0x28')](_0x4e0e('0x50'),_0x3d5510);throw _0x3d5510;});}return _0x140616;})[_0x4e0e('0x23')](respondWithResult(_0x314930,0xc9))[_0x4e0e('0x45')](handleError(_0x314930,null));};exports[_0x4e0e('0x22')]=function(_0x2537a2,_0x49143a){if(_0x2537a2['body']['id']){delete _0x2537a2['body']['id'];}return db[_0x4e0e('0x2c')][_0x4e0e('0x47')]({'where':{'id':_0x2537a2[_0x4e0e('0x46')]['id']}})[_0x4e0e('0x23')](handleEntityNotFound(_0x49143a,null))['then'](saveUpdates(_0x2537a2[_0x4e0e('0x51')],null))[_0x4e0e('0x23')](respondWithResult(_0x49143a,null))[_0x4e0e('0x45')](handleError(_0x49143a,null));};exports[_0x4e0e('0x26')]=function(_0x2d856c,_0x2a1933){return db[_0x4e0e('0x2c')][_0x4e0e('0x47')]({'where':{'id':_0x2d856c['params']['id']}})[_0x4e0e('0x23')](handleEntityNotFound(_0x2a1933,null))['then'](removeEntity(_0x2a1933,null))['catch'](handleError(_0x2a1933,null));};exports['preview']=function(_0x5c1dd8,_0x40fc89){var _0x2fefdf=0xa;var _0x26766f=[_0x4e0e('0x52'),'left_join',_0x4e0e('0x53'),'cross_join'];var _0x1bdb27={'SUM':_0x4e0e('0x54'),'COUNT':_0x4e0e('0x55'),'COUNT DISTINCT':_0x4e0e('0x56'),'MAX':_0x4e0e('0x57'),'MIN':_0x4e0e('0x58'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4e0e('0x59'),'GROUP_CONCAT ASC':_0x4e0e('0x5a'),'GROUP_CONCAT DESC':_0x4e0e('0x5b')};var _0x42a652={'SEC_TO_TIME':_0x4e0e('0x5c'),'DATE':_0x4e0e('0x5d'),'HOUR':_0x4e0e('0x5e'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x405696=function(_0x2a23be){return!_['includes'](['IS\x20NULL',_0x4e0e('0x5f'),_0x4e0e('0x60'),_0x4e0e('0x61')],_0x2a23be);};var _0x32d612=function(_0x31be0f){if(!_0x31be0f||!_0x31be0f[_0x4e0e('0x62')]['length']){return'';}for(var _0x21860a='(',_0x4bc301=0x0;_0x4bc301<_0x31be0f[_0x4e0e('0x62')][_0x4e0e('0x38')];_0x4bc301+=0x1){_0x4bc301>0x0&&(_0x21860a+='\x20'+_0x31be0f[_0x4e0e('0x63')]+'\x20');_0x21860a+=_0x31be0f[_0x4e0e('0x62')][_0x4bc301][_0x4e0e('0x64')]?_0x32d612(_0x31be0f[_0x4e0e('0x62')][_0x4bc301][_0x4e0e('0x64')]):_0x31be0f['rules'][_0x4bc301][_0x4e0e('0x65')]+'\x20'+_0x31be0f['rules'][_0x4bc301]['condition']+(_0x405696(_0x31be0f[_0x4e0e('0x62')][_0x4bc301][_0x4e0e('0x66')])?'\x20'+_0x31be0f['rules'][_0x4bc301][_0x4e0e('0x67')]:'');}return _0x21860a+')';};var _0x58ba97={'where':{'id':_0x5c1dd8[_0x4e0e('0x46')]['id']}},_0x42d5f3,_0x11e60e,_0x2a09d0,_0x3d17e4,_0xfc0dc2;_0x58ba97=_['merge']({},_0x58ba97,_0x5c1dd8[_0x4e0e('0x41')]);return db[_0x4e0e('0x2c')][_0x4e0e('0x47')](_0x58ba97)[_0x4e0e('0x23')](function(_0x2bbb35){if(_0x2bbb35){_0x42d5f3=_0x2bbb35;return _0x2bbb35[_0x4e0e('0x68')]();}return null;})['then'](function(_0x4922a6){if(_0x4922a6){if(!_0x4922a6['length']){throw new db['Sequelize'][(_0x4e0e('0x69'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x11e60e=_0x4922a6;return db[_0x4e0e('0x6a')][_0x4e0e('0x44')]({'raw':!![]});}return null;})[_0x4e0e('0x23')](function(_0x4412f2){if(_0x4412f2){_0x2a09d0=_[_0x4e0e('0x6b')](_0x4412f2,'id');var _0x3a24ac;var _0x48d7b6=squel[_0x4e0e('0x6c')]();_0x48d7b6[_0x4e0e('0x6d')](_0x42d5f3[_0x4e0e('0x6e')]);for(var _0x5f03a4=0x0;_0x5f03a4<_0x11e60e['length'];_0x5f03a4+=0x1){_0x3a24ac=_0x11e60e[_0x5f03a4][_0x4e0e('0x6f')]?_0x2a09d0[_0x11e60e[_0x5f03a4][_0x4e0e('0x6f')]]['metric']:_0x11e60e[_0x5f03a4][_0x4e0e('0x65')];_0x3a24ac=_0x11e60e[_0x5f03a4]['function']?_['replace'](_0x1bdb27[_0x11e60e[_0x5f03a4][_0x4e0e('0x70')]],'%s',_0x3a24ac):_0x3a24ac;_0x3a24ac=_0x11e60e[_0x5f03a4]['format']?_['replace'](_0x42a652[_0x11e60e[_0x5f03a4][_0x4e0e('0x71')]],'%s',_0x3a24ac):_0x3a24ac;if(_0x11e60e[_0x5f03a4]['groupBy']){_0x48d7b6[_0x4e0e('0x64')](_0x3a24ac);}_0x11e60e[_0x5f03a4][_0x4e0e('0x72')]&&_0x48d7b6[_0x4e0e('0x3b')](_0x3a24ac,_0x11e60e[_0x5f03a4][_0x4e0e('0x72')]===_0x4e0e('0x73')?![]:!![]);_0x48d7b6[_0x4e0e('0x65')](_0x3a24ac,_0x11e60e[_0x5f03a4]['alias']||_0x3a24ac);}if(_0x42d5f3['joins']){_0x42d5f3[_0x4e0e('0x74')]=JSON[_0x4e0e('0x75')](_0x42d5f3[_0x4e0e('0x74')]);for(var _0x45ce1e=0x0;_0x45ce1e<_0x42d5f3[_0x4e0e('0x74')][_0x4e0e('0x38')];_0x45ce1e+=0x1){if(_0x42d5f3[_0x4e0e('0x74')][_0x45ce1e][_0x4e0e('0x2f')]&&_[_0x4e0e('0x76')](_0x26766f,_0x42d5f3[_0x4e0e('0x74')][_0x45ce1e]['type'])&&_0x42d5f3['joins'][_0x45ce1e]['parentKey']&&_0x42d5f3[_0x4e0e('0x74')][_0x45ce1e][_0x4e0e('0x77')]&&_0x42d5f3[_0x4e0e('0x74')][_0x45ce1e][_0x4e0e('0x78')]){_0x48d7b6[_0x42d5f3[_0x4e0e('0x74')][_0x45ce1e][_0x4e0e('0x2f')]](_0x42d5f3['joins'][_0x45ce1e][_0x4e0e('0x77')],null,util[_0x4e0e('0x71')](_0x4e0e('0x79'),_0x42d5f3['table'],_0x42d5f3[_0x4e0e('0x74')][_0x45ce1e][_0x4e0e('0x7a')],_0x42d5f3[_0x4e0e('0x74')][_0x45ce1e][_0x4e0e('0x77')],_0x42d5f3[_0x4e0e('0x74')][_0x45ce1e][_0x4e0e('0x78')]));}}}if(_0x42d5f3[_0x4e0e('0x7b')]){_0x42d5f3[_0x4e0e('0x7b')]=JSON[_0x4e0e('0x75')](_0x42d5f3[_0x4e0e('0x7b')]);_0x48d7b6[_0x4e0e('0x3d')](_0x32d612(_0x42d5f3[_0x4e0e('0x7b')][_0x4e0e('0x64')]));}_0xfc0dc2=_0x48d7b6[_0x4e0e('0x7c')]();_0x48d7b6['limit'](_0x2fefdf);_0x48d7b6[_0x4e0e('0x1c')](0x0);logger[_0x4e0e('0x7d')](_0x4e0e('0x7e'),_0x48d7b6[_0x4e0e('0x7f')]());return dbH[_0x4e0e('0x80')]['query'](_0x48d7b6[_0x4e0e('0x7f')](),{'type':dbH['sequelize'][_0x4e0e('0x81')]['SELECT']});}})[_0x4e0e('0x23')](respondWithResult(_0x40fc89,null))[_0x4e0e('0x45')](handleError(_0x40fc89,null));};function runReport(_0x3624d2,_0x574a43,_0x2eb55c){var _0x224f7d=_0x574a43[_0x4e0e('0x2a')];var _0x18bdd7=0xa;var _0x1599ec=[_0x4e0e('0x52'),_0x4e0e('0x82'),_0x4e0e('0x53'),_0x4e0e('0x83')];var _0x49ab51={'SUM':_0x4e0e('0x54'),'COUNT':_0x4e0e('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x4e0e('0x57'),'MIN':'MIN(%s)','AVG':_0x4e0e('0x84'),'GROUP_CONCAT':_0x4e0e('0x59'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4e0e('0x5b')};var _0x4cb6e2={'SEC_TO_TIME':_0x4e0e('0x5c'),'DATE':'DATE(%s)','HOUR':_0x4e0e('0x5e'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x4e0e('0x85')};var _0x1a3263=function(_0x4d4035){return!_['includes']([_0x4e0e('0x86'),_0x4e0e('0x5f'),_0x4e0e('0x60'),_0x4e0e('0x61')],_0x4d4035);};var _0x4ac8b5=function(_0x31ae3f){if(!_0x31ae3f||!_0x31ae3f[_0x4e0e('0x62')][_0x4e0e('0x38')]){return'';}for(var _0xd38b25='(',_0x509e49=0x0;_0x509e49<_0x31ae3f['rules'][_0x4e0e('0x38')];_0x509e49+=0x1){_0x509e49>0x0&&(_0xd38b25+='\x20'+_0x31ae3f[_0x4e0e('0x63')]+'\x20');_0xd38b25+=_0x31ae3f[_0x4e0e('0x62')][_0x509e49]['group']?_0x4ac8b5(_0x31ae3f[_0x4e0e('0x62')][_0x509e49][_0x4e0e('0x64')]):_0x31ae3f['rules'][_0x509e49][_0x4e0e('0x65')]+'\x20'+_0x31ae3f[_0x4e0e('0x62')][_0x509e49]['condition']+(_0x1a3263(_0x31ae3f['rules'][_0x509e49][_0x4e0e('0x66')])?'\x20'+_0x31ae3f['rules'][_0x509e49][_0x4e0e('0x67')]:'');}return _0xd38b25+')';};var _0x138421={'where':{'id':_0x3624d2['id']}},_0x7c8928,_0x49a356,_0x2f35cf,_0x26f141,_0x11350c;_0x138421=_[_0x4e0e('0x40')]({},_0x138421,_0x2eb55c);return db['AnalyticCustomReport'][_0x4e0e('0x47')](_0x138421)[_0x4e0e('0x23')](function(_0x593736){if(_0x593736){_0x7c8928=_0x593736;return _0x593736[_0x4e0e('0x68')]();}return null;})[_0x4e0e('0x23')](function(_0x33860d){if(_0x33860d){if(!_0x33860d[_0x4e0e('0x38')]){throw new db['Sequelize']['ValidationErrorItem'](_0x4e0e('0x87'),0x193);}_0x49a356=_0x33860d;return db[_0x4e0e('0x6a')][_0x4e0e('0x44')]({'raw':!![]});}return null;})['then'](function(_0x1f0b64){if(_0x1f0b64){_0x2f35cf=_['keyBy'](_0x1f0b64,'id');var _0xa98b2c;var _0x447469=squel['select']();_0x447469[_0x4e0e('0x6d')](_0x7c8928[_0x4e0e('0x6e')]);for(var _0x1984ed=0x0;_0x1984ed<_0x49a356[_0x4e0e('0x38')];_0x1984ed+=0x1){_0xa98b2c=_0x49a356[_0x1984ed][_0x4e0e('0x6f')]?_0x2f35cf[_0x49a356[_0x1984ed][_0x4e0e('0x6f')]]['metric']:_0x49a356[_0x1984ed][_0x4e0e('0x65')];_0xa98b2c=_0x49a356[_0x1984ed][_0x4e0e('0x70')]?_[_0x4e0e('0x88')](_0x49ab51[_0x49a356[_0x1984ed][_0x4e0e('0x70')]],'%s',_0xa98b2c):_0xa98b2c;_0xa98b2c=_0x49a356[_0x1984ed]['format']?_['replace'](_0x4cb6e2[_0x49a356[_0x1984ed]['format']],'%s',_0xa98b2c):_0xa98b2c;if(_0x49a356[_0x1984ed][_0x4e0e('0x89')]){_0x447469[_0x4e0e('0x64')](_0xa98b2c);}_0x49a356[_0x1984ed]['orderBy']&&_0x447469[_0x4e0e('0x3b')](_0xa98b2c,_0x49a356[_0x1984ed][_0x4e0e('0x72')]==='DESC'?![]:!![]);_0x447469[_0x4e0e('0x65')](_0xa98b2c,_0x49a356[_0x1984ed][_0x4e0e('0x8a')]||_0xa98b2c);}if(_0x7c8928['joins']){_0x7c8928[_0x4e0e('0x74')]=JSON['parse'](_0x7c8928[_0x4e0e('0x74')]);for(var _0x53d824=0x0;_0x53d824<_0x7c8928['joins'][_0x4e0e('0x38')];_0x53d824+=0x1){if(_0x7c8928['joins'][_0x53d824][_0x4e0e('0x2f')]&&_['includes'](_0x1599ec,_0x7c8928[_0x4e0e('0x74')][_0x53d824]['type'])&&_0x7c8928[_0x4e0e('0x74')][_0x53d824][_0x4e0e('0x7a')]&&_0x7c8928[_0x4e0e('0x74')][_0x53d824][_0x4e0e('0x77')]&&_0x7c8928[_0x4e0e('0x74')][_0x53d824][_0x4e0e('0x78')]){_0x447469[_0x7c8928['joins'][_0x53d824]['type']](_0x7c8928[_0x4e0e('0x74')][_0x53d824][_0x4e0e('0x77')],null,util[_0x4e0e('0x71')](_0x4e0e('0x79'),_0x7c8928[_0x4e0e('0x6e')],_0x7c8928[_0x4e0e('0x74')][_0x53d824]['parentKey'],_0x7c8928[_0x4e0e('0x74')][_0x53d824][_0x4e0e('0x77')],_0x7c8928[_0x4e0e('0x74')][_0x53d824][_0x4e0e('0x78')]));}}}if(_0x7c8928[_0x4e0e('0x7b')]){_0x7c8928[_0x4e0e('0x7b')]=JSON['parse'](_0x7c8928[_0x4e0e('0x7b')]);_0x447469[_0x4e0e('0x3d')](_0x4ac8b5(_0x7c8928[_0x4e0e('0x7b')][_0x4e0e('0x64')]));}_0x11350c=_0x447469['clone']();_0x447469['limit'](_0x18bdd7);_0x447469[_0x4e0e('0x1c')](0x0);return;}})[_0x4e0e('0x23')](function(){if(_0x574a43[_0x4e0e('0x8b')]==='web'){return null;}var _0x149f36=_[_0x4e0e('0x40')](_0x574a43,{'name':_0x574a43[_0x4e0e('0x8c')]||_0x574a43[_0x4e0e('0x2a')]||_0x7c8928[_0x4e0e('0x2a')],'basename':_0x224f7d,'savename':util[_0x4e0e('0x71')]('%s-%s.%s',_0x574a43[_0x4e0e('0x2a')]||_0x7c8928[_0x4e0e('0x2a')],require('randomstring')['generate'](0x4),_0x574a43[_0x4e0e('0x8b')]||_0x4e0e('0x8d')),'reportId':_0x7c8928['id'],'reportType':'custom'});return db['AnalyticExtractedReport'][_0x4e0e('0x48')](_0x149f36,{'raw':!![]});})[_0x4e0e('0x23')](function(_0x24daf0){if(_0x7c8928['table']==='cdr'){_0x11350c[_0x4e0e('0x3d')](_0x7c8928[_0x4e0e('0x6e')]+_0x4e0e('0x8e'),_0x574a43['startDate'],_0x574a43[_0x4e0e('0x8f')]);}else{_0x11350c[_0x4e0e('0x3d')](_0x7c8928[_0x4e0e('0x6e')]+_0x4e0e('0x90'),_0x574a43[_0x4e0e('0x91')],_0x574a43['endDate']);}if(_0x24daf0){logger[_0x4e0e('0x92')]('Run\x20Query:',_0x11350c[_0x4e0e('0x7f')]());require(_0x4e0e('0x93'))[_0x4e0e('0x94')](path[_0x4e0e('0x52')](__dirname,_0x4e0e('0x95'),_0x24daf0['output']),[_0x24daf0['id'],_0x11350c[_0x4e0e('0x7f')](),path['join'](__dirname,_0x4e0e('0x96'),_0x24daf0[_0x4e0e('0x97')]),_0x224f7d]);return _0x24daf0;}else{var _0x131641=squel[_0x4e0e('0x6c')]();_0x131641[_0x4e0e('0x6d')]('('+_0x11350c['toString']()+')',_0x4e0e('0x98'));_0x131641[_0x4e0e('0x65')](_0x4e0e('0x99'),_0x4e0e('0x1b'));_0x11350c[_0x4e0e('0x1d')](_0x574a43[_0x4e0e('0x1d')]||_0x18bdd7);_0x11350c[_0x4e0e('0x1c')](_0x574a43[_0x4e0e('0x1c')]||0x0);return dbH[_0x4e0e('0x80')][_0x4e0e('0x32')](_0x131641['toString'](),{'type':dbH[_0x4e0e('0x80')][_0x4e0e('0x81')][_0x4e0e('0x9a')]})[_0x4e0e('0x23')](function(_0xd3c7a0){if(!_0xd3c7a0[_0x4e0e('0x38')]){_0x26f141=0x0;}else{_0x26f141=_0xd3c7a0[0x0][_0x4e0e('0x1b')]||0x0;}return dbH[_0x4e0e('0x80')][_0x4e0e('0x32')](_0x11350c['toString'](),{'type':dbH['sequelize'][_0x4e0e('0x81')][_0x4e0e('0x9a')]});})[_0x4e0e('0x23')](function(_0xd2bdfb){return{'rows':_0xd2bdfb||[],'count':_0x26f141};});}});}exports[_0x4e0e('0x9b')]=function(_0x1ea203,_0x39c345){return runReport(_0x1ea203[_0x4e0e('0x46')],_0x1ea203[_0x4e0e('0x32')],_0x1ea203[_0x4e0e('0x41')])[_0x4e0e('0x23')](respondWithResult(_0x39c345,null))[_0x4e0e('0x45')](handleError(_0x39c345,null));};exports['runReport']=runReport;exports[_0x4e0e('0x32')]=function(_0x44b370,_0x508c31){var _0x57f554=0xa;var _0x341269=[_0x4e0e('0x52'),_0x4e0e('0x82'),'right_join',_0x4e0e('0x83')];var _0x335571={'SUM':'SUM(%s)','COUNT':_0x4e0e('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x4e0e('0x84'),'GROUP_CONCAT':_0x4e0e('0x59'),'GROUP_CONCAT ASC':_0x4e0e('0x5a'),'GROUP_CONCAT DESC':_0x4e0e('0x5b')};var _0x26f5b3={'SEC_TO_TIME':_0x4e0e('0x5c'),'DATE':_0x4e0e('0x5d'),'HOUR':'HOUR(%s)','ROUND':_0x4e0e('0x9c'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5a96f=function(_0x30a625){return!_[_0x4e0e('0x76')]([_0x4e0e('0x86'),_0x4e0e('0x5f'),_0x4e0e('0x60'),_0x4e0e('0x61')],_0x30a625);};var _0x4ec8ff=function(_0xd0f86a){if(!_0xd0f86a||!_0xd0f86a[_0x4e0e('0x62')][_0x4e0e('0x38')]){return'';}for(var _0x42b1cb='(',_0x45516b=0x0;_0x45516b<_0xd0f86a['rules'][_0x4e0e('0x38')];_0x45516b+=0x1){_0x45516b>0x0&&(_0x42b1cb+='\x20'+_0xd0f86a['operator']+'\x20');_0x42b1cb+=_0xd0f86a[_0x4e0e('0x62')][_0x45516b][_0x4e0e('0x64')]?_0x4ec8ff(_0xd0f86a[_0x4e0e('0x62')][_0x45516b][_0x4e0e('0x64')]):_0xd0f86a[_0x4e0e('0x62')][_0x45516b]['field']+'\x20'+_0xd0f86a['rules'][_0x45516b][_0x4e0e('0x66')]+(_0x5a96f(_0xd0f86a[_0x4e0e('0x62')][_0x45516b]['condition'])?'\x20'+_0xd0f86a['rules'][_0x45516b][_0x4e0e('0x67')]:'');}return _0x42b1cb+')';};var _0x468984={'where':{'id':_0x44b370['params']['id']}},_0x13745d,_0x5d29b1,_0x1efdcc,_0x51251f,_0x1e1d7d;_0x468984=_[_0x4e0e('0x40')]({},_0x468984,_0x44b370[_0x4e0e('0x41')]);return db[_0x4e0e('0x2c')][_0x4e0e('0x47')](_0x468984)[_0x4e0e('0x23')](function(_0x304cce){if(_0x304cce){_0x13745d=_0x304cce;return _0x304cce[_0x4e0e('0x68')]();}return null;})[_0x4e0e('0x23')](function(_0x4eb60d){if(_0x4eb60d){if(!_0x4eb60d[_0x4e0e('0x38')]){throw new db[(_0x4e0e('0x9d'))]['ValidationErrorItem'](_0x4e0e('0x87'),0x193);}_0x5d29b1=_0x4eb60d;return db[_0x4e0e('0x6a')][_0x4e0e('0x44')]({'raw':!![]});}return null;})[_0x4e0e('0x23')](function(_0xb8430b){if(_0xb8430b){_0x1efdcc=_[_0x4e0e('0x6b')](_0xb8430b,'id');var _0x5b912f;var _0x1534fb=squel[_0x4e0e('0x6c')]();_0x1534fb[_0x4e0e('0x6d')](_0x13745d[_0x4e0e('0x6e')]);for(var _0x206595=0x0;_0x206595<_0x5d29b1[_0x4e0e('0x38')];_0x206595+=0x1){_0x5b912f=_0x5d29b1[_0x206595][_0x4e0e('0x6f')]?_0x1efdcc[_0x5d29b1[_0x206595][_0x4e0e('0x6f')]][_0x4e0e('0x9e')]:_0x5d29b1[_0x206595][_0x4e0e('0x65')];_0x5b912f=_0x5d29b1[_0x206595][_0x4e0e('0x70')]?_['replace'](_0x335571[_0x5d29b1[_0x206595][_0x4e0e('0x70')]],'%s',_0x5b912f):_0x5b912f;_0x5b912f=_0x5d29b1[_0x206595][_0x4e0e('0x71')]?_[_0x4e0e('0x88')](_0x26f5b3[_0x5d29b1[_0x206595][_0x4e0e('0x71')]],'%s',_0x5b912f):_0x5b912f;if(_0x5d29b1[_0x206595][_0x4e0e('0x89')]){_0x1534fb[_0x4e0e('0x64')](_0x5b912f);}_0x5d29b1[_0x206595][_0x4e0e('0x72')]&&_0x1534fb[_0x4e0e('0x3b')](_0x5b912f,_0x5d29b1[_0x206595][_0x4e0e('0x72')]==='DESC'?![]:!![]);_0x1534fb['field'](_0x5b912f,_0x5d29b1[_0x206595][_0x4e0e('0x8a')]||_0x5b912f);}if(_0x13745d[_0x4e0e('0x74')]){_0x13745d[_0x4e0e('0x74')]=JSON[_0x4e0e('0x75')](_0x13745d[_0x4e0e('0x74')]);for(var _0x457392=0x0;_0x457392<_0x13745d[_0x4e0e('0x74')]['length'];_0x457392+=0x1){if(_0x13745d['joins'][_0x457392][_0x4e0e('0x2f')]&&_[_0x4e0e('0x76')](_0x341269,_0x13745d[_0x4e0e('0x74')][_0x457392][_0x4e0e('0x2f')])&&_0x13745d[_0x4e0e('0x74')][_0x457392][_0x4e0e('0x7a')]&&_0x13745d['joins'][_0x457392][_0x4e0e('0x77')]&&_0x13745d[_0x4e0e('0x74')][_0x457392][_0x4e0e('0x78')]){_0x1534fb[_0x13745d[_0x4e0e('0x74')][_0x457392]['type']](_0x13745d[_0x4e0e('0x74')][_0x457392][_0x4e0e('0x77')],null,util['format'](_0x4e0e('0x79'),_0x13745d[_0x4e0e('0x6e')],_0x13745d['joins'][_0x457392][_0x4e0e('0x7a')],_0x13745d[_0x4e0e('0x74')][_0x457392][_0x4e0e('0x77')],_0x13745d[_0x4e0e('0x74')][_0x457392][_0x4e0e('0x78')]));}}}if(_0x13745d['conditions']){_0x13745d[_0x4e0e('0x7b')]=JSON[_0x4e0e('0x75')](_0x13745d[_0x4e0e('0x7b')]);_0x1534fb['where'](_0x4ec8ff(_0x13745d['conditions'][_0x4e0e('0x64')]));}_0x1e1d7d=_0x1534fb[_0x4e0e('0x7c')]();_0x1534fb[_0x4e0e('0x1d')](_0x57f554);_0x1534fb[_0x4e0e('0x1c')](0x0);logger[_0x4e0e('0x7d')](_0x4e0e('0x7e'),_0x1534fb[_0x4e0e('0x7f')]());return dbH[_0x4e0e('0x80')][_0x4e0e('0x32')](_0x1534fb[_0x4e0e('0x7f')](),{'type':dbH[_0x4e0e('0x80')][_0x4e0e('0x81')][_0x4e0e('0x9a')]});}})[_0x4e0e('0x23')](function(){return{'sql':_0x1e1d7d[_0x4e0e('0x7f')]()};})['then'](respondWithResult(_0x508c31,null))['catch'](handleError(_0x508c31,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 8a2c8a1..71f3e91 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 _0xa583=['path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','util','../../config/logger','api','moment','bluebird'];(function(_0x3ff5de,_0x1c0844){var _0x323b7a=function(_0x14fd47){while(--_0x14fd47){_0x3ff5de['push'](_0x3ff5de['shift']());}};_0x323b7a(++_0x1c0844);}(_0xa583,0x14d));var _0x3a58=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa583[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x3a58('0x0'));var logger=require(_0x3a58('0x1'))(_0x3a58('0x2'));var moment=require(_0x3a58('0x3'));var BPromise=require(_0x3a58('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3a58('0x5'));var rimraf=require(_0x3a58('0x6'));var config=require(_0x3a58('0x7'));var attributes=require(_0x3a58('0x8'));module[_0x3a58('0x9')]=function(_0x1d26e4,_0x15e42e){return _0x1d26e4[_0x3a58('0xa')](_0x3a58('0xb'),attributes,{'tableName':_0x3a58('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9750=['analytics_custom_reports','lodash','util','../../config/logger','api','moment','request-promise','path','./analyticCustomReport.attributes','exports','define'];(function(_0x54e7cd,_0x58ab5){var _0x410f18=function(_0x33f7d1){while(--_0x33f7d1){_0x54e7cd['push'](_0x54e7cd['shift']());}};_0x410f18(++_0x58ab5);}(_0x9750,0x156));var _0x0975=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9750[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x0975('0x0'));var util=require(_0x0975('0x1'));var logger=require(_0x0975('0x2'))(_0x0975('0x3'));var moment=require(_0x0975('0x4'));var BPromise=require('bluebird');var rp=require(_0x0975('0x5'));var fs=require('fs');var path=require(_0x0975('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0975('0x7'));module[_0x0975('0x8')]=function(_0x5a1aac,_0x3df05a){return _0x5a1aac[_0x0975('0x9')]('AnalyticCustomReport',attributes,{'tableName':_0x0975('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 460bba0..df04631 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 _0x1e01=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','lodash','util','moment','randomstring','ioredis'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x1e01,0xd7));var _0x11e0=function(_0x3f2355,_0x2ce267){_0x3f2355=_0x3f2355-0x0;var _0x3f622c=_0x1e01[_0x3f2355];return _0x3f622c;};'use strict';var _=require(_0x11e0('0x0'));var util=require(_0x11e0('0x1'));var moment=require(_0x11e0('0x2'));var BPromise=require('bluebird');var rs=require(_0x11e0('0x3'));var fs=require('fs');var Redis=require(_0x11e0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x11e0('0x5'));var logger=require(_0x11e0('0x6'))(_0x11e0('0x7'));var config=require(_0x11e0('0x8'));var jayson=require(_0x11e0('0x9'));var client=jayson[_0x11e0('0xa')][_0x11e0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1cf6b4,_0x27b6c7,_0x379780){return new BPromise(function(_0x3ea9ab,_0x58c419){return client[_0x11e0('0xc')](_0x1cf6b4,_0x379780)[_0x11e0('0xd')](function(_0x35369e){logger['info'](_0x11e0('0xe'),_0x27b6c7,_0x11e0('0xf'));logger[_0x11e0('0x10')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x27b6c7,_0x11e0('0xf'),JSON[_0x11e0('0x11')](_0x35369e));if(_0x35369e[_0x11e0('0x12')]){if(_0x35369e[_0x11e0('0x12')]['code']===0x1f4){logger[_0x11e0('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x27b6c7,_0x35369e['error'][_0x11e0('0x13')]);return _0x58c419(_0x35369e[_0x11e0('0x12')][_0x11e0('0x13')]);}logger[_0x11e0('0x12')](_0x11e0('0xe'),_0x27b6c7,_0x35369e[_0x11e0('0x12')]['message']);return _0x3ea9ab(_0x35369e[_0x11e0('0x12')][_0x11e0('0x13')]);}else{logger[_0x11e0('0x14')]('AnalyticCustomReport,\x20%s,\x20%s',_0x27b6c7,_0x11e0('0xf'));_0x3ea9ab(_0x35369e[_0x11e0('0x15')][_0x11e0('0x13')]);}})['catch'](function(_0x4d36d7){logger[_0x11e0('0x12')](_0x11e0('0xe'),_0x27b6c7,_0x4d36d7);_0x58c419(_0x4d36d7);});});} \ No newline at end of file +var _0x36de=['rpc','../../config/environment','jayson/promise','client','http','info','AnalyticCustomReport,\x20%s,\x20%s','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x14b0f4,_0x4b32e2){var _0x8e120e=function(_0xbf796a){while(--_0xbf796a){_0x14b0f4['push'](_0x14b0f4['shift']());}};_0x8e120e(++_0x4b32e2);}(_0x36de,0x186));var _0xe36d=function(_0x141abe,_0xf01280){_0x141abe=_0x141abe-0x0;var _0x5ee689=_0x36de[_0x141abe];return _0x5ee689;};'use strict';var _=require(_0xe36d('0x0'));var util=require('util');var moment=require(_0xe36d('0x1'));var BPromise=require(_0xe36d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe36d('0x3'))['db'];var utils=require(_0xe36d('0x4'));var logger=require(_0xe36d('0x5'))(_0xe36d('0x6'));var config=require(_0xe36d('0x7'));var jayson=require(_0xe36d('0x8'));var client=jayson[_0xe36d('0x9')][_0xe36d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x514f03,_0x22d73d,_0x55b7ac){return new BPromise(function(_0xa8c7e7,_0x1d185c){return client['request'](_0x514f03,_0x55b7ac)['then'](function(_0x1600ec){logger[_0xe36d('0xb')](_0xe36d('0xc'),_0x22d73d,'request\x20sent');logger[_0xe36d('0xd')](_0xe36d('0xe'),_0x22d73d,_0xe36d('0xf'),JSON[_0xe36d('0x10')](_0x1600ec));if(_0x1600ec[_0xe36d('0x11')]){if(_0x1600ec[_0xe36d('0x11')][_0xe36d('0x12')]===0x1f4){logger[_0xe36d('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x22d73d,_0x1600ec['error'][_0xe36d('0x13')]);return _0x1d185c(_0x1600ec[_0xe36d('0x11')]['message']);}logger[_0xe36d('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x22d73d,_0x1600ec[_0xe36d('0x11')][_0xe36d('0x13')]);return _0xa8c7e7(_0x1600ec[_0xe36d('0x11')][_0xe36d('0x13')]);}else{logger[_0xe36d('0xb')](_0xe36d('0xc'),_0x22d73d,_0xe36d('0xf'));_0xa8c7e7(_0x1600ec[_0xe36d('0x14')][_0xe36d('0x13')]);}})[_0xe36d('0x15')](function(_0x1de21a){logger['error'](_0xe36d('0xc'),_0x22d73d,_0x1de21a);_0x1d185c(_0x1de21a);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index f0833d0..ef532c5 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 _0x4e6d=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','index','get','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','post','create','put','update','delete','destroy','exports','multer'];(function(_0x5bd677,_0x4341b0){var _0x2dbd6a=function(_0x3d7a8a){while(--_0x3d7a8a){_0x5bd677['push'](_0x5bd677['shift']());}};_0x2dbd6a(++_0x4341b0);}(_0x4e6d,0xf2));var _0xd4e6=function(_0x3e4285,_0x83a4f0){_0x3e4285=_0x3e4285-0x0;var _0xce09e7=_0x4e6d[_0x3e4285];return _0xce09e7;};'use strict';var multer=require(_0xd4e6('0x0'));var util=require(_0xd4e6('0x1'));var path=require(_0xd4e6('0x2'));var timeout=require(_0xd4e6('0x3'));var express=require(_0xd4e6('0x4'));var router=express[_0xd4e6('0x5')]();var fs_extra=require(_0xd4e6('0x6'));var auth=require(_0xd4e6('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xd4e6('0x8'));var controller=require(_0xd4e6('0x9'));router['get']('/',auth[_0xd4e6('0xa')](),controller[_0xd4e6('0xb')]);router[_0xd4e6('0xc')](_0xd4e6('0xd'),auth['isAuthenticated'](),controller[_0xd4e6('0xe')]);router[_0xd4e6('0xc')](_0xd4e6('0xf'),auth['isAuthenticated'](),controller[_0xd4e6('0x10')]);router[_0xd4e6('0xc')](_0xd4e6('0x11'),auth[_0xd4e6('0xa')](),controller[_0xd4e6('0x12')]);router[_0xd4e6('0xc')](_0xd4e6('0x13'),auth[_0xd4e6('0xa')](),controller['query']);router[_0xd4e6('0x14')]('/',auth['isAuthenticated'](),controller[_0xd4e6('0x15')]);router[_0xd4e6('0x16')](_0xd4e6('0xd'),auth[_0xd4e6('0xa')](),controller[_0xd4e6('0x17')]);router[_0xd4e6('0x18')](_0xd4e6('0xd'),auth['isAuthenticated'](),controller[_0xd4e6('0x19')]);module[_0xd4e6('0x1a')]=router; \ No newline at end of file +var _0xacb3=['/:id','/:id/preview','preview','/:id/run','/:id/query','query','post','create','put','update','delete','destroy','multer','util','path','fs-extra','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index'];(function(_0xd24b43,_0x11caa4){var _0x2b1b44=function(_0x5b84af){while(--_0x5b84af){_0xd24b43['push'](_0xd24b43['shift']());}};_0x2b1b44(++_0x11caa4);}(_0xacb3,0x90));var _0x3acb=function(_0x550a61,_0x1c5d8c){_0x550a61=_0x550a61-0x0;var _0x248bfc=_0xacb3[_0x550a61];return _0x248bfc;};'use strict';var multer=require(_0x3acb('0x0'));var util=require(_0x3acb('0x1'));var path=require(_0x3acb('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x3acb('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x3acb('0x4'));var config=require(_0x3acb('0x5'));var controller=require(_0x3acb('0x6'));router[_0x3acb('0x7')]('/',auth[_0x3acb('0x8')](),controller[_0x3acb('0x9')]);router[_0x3acb('0x7')](_0x3acb('0xa'),auth[_0x3acb('0x8')](),controller['show']);router[_0x3acb('0x7')](_0x3acb('0xb'),auth['isAuthenticated'](),controller[_0x3acb('0xc')]);router[_0x3acb('0x7')](_0x3acb('0xd'),auth[_0x3acb('0x8')](),controller['run']);router[_0x3acb('0x7')](_0x3acb('0xe'),auth[_0x3acb('0x8')](),controller[_0x3acb('0xf')]);router[_0x3acb('0x10')]('/',auth['isAuthenticated'](),controller[_0x3acb('0x11')]);router[_0x3acb('0x12')](_0x3acb('0xa'),auth['isAuthenticated'](),controller[_0x3acb('0x13')]);router[_0x3acb('0x14')](_0x3acb('0xa'),auth[_0x3acb('0x8')](),controller[_0x3acb('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 7c69e35..de3b8b9 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 _0x7217=['sequelize','STRING','TEXT'];(function(_0x36979f,_0x2b8951){var _0x462c6d=function(_0x3e8027){while(--_0x3e8027){_0x36979f['push'](_0x36979f['shift']());}};_0x462c6d(++_0x2b8951);}(_0x7217,0x19e));var _0x7721=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x7217[_0x187ee1];return _0x388160;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'name':{'type':Sequelize[_0x7721('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x7721('0x1')]},'parent':{'type':Sequelize[_0x7721('0x1')]},'table':{'type':Sequelize[_0x7721('0x1')]},'conditions':{'type':Sequelize[_0x7721('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x7dfd=['STRING','TEXT','sequelize','exports'];(function(_0x2460df,_0xc9e7d9){var _0x5b5cd1=function(_0x3d2d32){while(--_0x3d2d32){_0x2460df['push'](_0x2460df['shift']());}};_0x5b5cd1(++_0xc9e7d9);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd7df('0x0'));module[_0xd7df('0x1')]={'name':{'type':Sequelize[_0xd7df('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xd7df('0x2')]},'parent':{'type':Sequelize[_0xd7df('0x2')]},'table':{'type':Sequelize[_0xd7df('0x2')]},'conditions':{'type':Sequelize[_0xd7df('0x3')]},'joins':{'type':Sequelize[_0xd7df('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 094b1b2..c0147d1 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 _0x2ef3=['Sequelize','from','foreignKey','output','web','fullPath','generate','csv','cdr','startDate','endDate','info','child_process','fork','../../components/export/','savename','countTable','COUNT(*)','runReport','IS\x20NULL','IS\x20NOT\x20EMPTY','metric','Limited\x20Query:','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','../../mysqldb','status','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','get','DefaultReports','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','type','key','model','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','AnalyticDefaultReport','includeAll','include','findAll','rows','catch','show','params','keys','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','autoAssociation','update','preview','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20EMPTY','operator','rules','group','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','MetricId','field','function','replace','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','table','conditions','parse','clone','debug','toString','sequelize','QueryTypes','SELECT','join','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x2ef3,0xba));var _0x32ef=function(_0x5eccb6,_0x3c4f00){_0x5eccb6=_0x5eccb6-0x0;var _0x5ab220=_0x2ef3[_0x5eccb6];return _0x5ab220;};'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'];var dbH=require(_0x32ef('0x18'))['dbH'];function respondWithStatusCode(_0x3e98df,_0x1ef1ae){_0x1ef1ae=_0x1ef1ae||0xcc;return function(_0x5c3eb9){if(_0x5c3eb9){return _0x3e98df['sendStatus'](_0x1ef1ae);}return _0x3e98df[_0x32ef('0x19')](_0x1ef1ae)['end']();};}function respondWithResult(_0x326fce,_0x40a6e6){_0x40a6e6=_0x40a6e6||0xc8;return function(_0x93d492){if(_0x93d492){return _0x326fce[_0x32ef('0x19')](_0x40a6e6)['json'](_0x93d492);}};}function respondWithFilteredResult(_0x55bf0b,_0x531e30){return function(_0x13db1a){if(_0x13db1a){var _0x3950e6=typeof _0x531e30[_0x32ef('0x1a')]==='undefined'&&typeof _0x531e30['limit']===_0x32ef('0x1b');var _0x1a9476=_0x13db1a[_0x32ef('0x1c')];var _0x57863c=_0x3950e6?0x0:_0x531e30[_0x32ef('0x1a')];var _0x33e230=_0x3950e6?_0x13db1a['count']:_0x531e30[_0x32ef('0x1a')]+_0x531e30[_0x32ef('0x1d')];var _0x26aff3;if(_0x33e230>=_0x1a9476){_0x33e230=_0x1a9476;_0x26aff3=0xc8;}else{_0x26aff3=0xce;}_0x55bf0b[_0x32ef('0x19')](_0x26aff3);return _0x55bf0b[_0x32ef('0x1e')](_0x32ef('0x1f'),_0x57863c+'-'+_0x33e230+'/'+_0x1a9476)['json'](_0x13db1a);}return null;};}function patchUpdates(_0x3c5b78){return function(_0x5cc3ef){try{jsonpatch[_0x32ef('0x20')](_0x5cc3ef,_0x3c5b78,!![]);}catch(_0x3a20ca){return BPromise['reject'](_0x3a20ca);}return _0x5cc3ef[_0x32ef('0x21')]();};}function saveUpdates(_0x97780,_0x5e8898){return function(_0x55f7f2){if(_0x55f7f2){return _0x55f7f2['update'](_0x97780)[_0x32ef('0x22')](function(_0xb30fab){return _0xb30fab;});}return null;};}function removeEntity(_0x225feb,_0x478bef){return function(_0x59585f){if(_0x59585f){return _0x59585f[_0x32ef('0x23')]()['then'](function(){var _0x51a412=_0x59585f[_0x32ef('0x24')]({'plain':!![]});var _0x14d4b3=_0x32ef('0x25');return db[_0x32ef('0x26')][_0x32ef('0x23')]({'where':{'type':_0x14d4b3,'resourceId':_0x51a412['id']}})[_0x32ef('0x22')](function(){return _0x59585f;});})[_0x32ef('0x22')](function(){_0x225feb[_0x32ef('0x19')](0xcc)[_0x32ef('0x27')]();});}};}function handleEntityNotFound(_0x2f52d7,_0x1335e2){return function(_0xba4b3f){if(!_0xba4b3f){_0x2f52d7['sendStatus'](0x194);}return _0xba4b3f;};}function handleError(_0xd65fde,_0x2f5d06){_0x2f5d06=_0x2f5d06||0x1f4;return function(_0x5a04cd){logger[_0x32ef('0x28')](_0x5a04cd[_0x32ef('0x29')]);if(_0x5a04cd[_0x32ef('0x2a')]){delete _0x5a04cd[_0x32ef('0x2a')];}_0xd65fde['status'](_0x2f5d06)[_0x32ef('0x2b')](_0x5a04cd);};}exports[_0x32ef('0x2c')]=function(_0x31dbc3,_0x2ac686){var _0x1b668a={},_0x1a6ed2={},_0x1a122d={'count':0x0,'rows':[]};var _0x575f3e=_[_0x32ef('0x2d')](db['AnalyticDefaultReport'][_0x32ef('0x2e')],function(_0x2b6c6a){return{'name':_0x2b6c6a['fieldName'],'type':_0x2b6c6a[_0x32ef('0x2f')][_0x32ef('0x30')]};});_0x1a6ed2[_0x32ef('0x31')]=_[_0x32ef('0x2d')](_0x575f3e,_0x32ef('0x2a'));_0x1a6ed2['query']=_['keys'](_0x31dbc3[_0x32ef('0x32')]);_0x1a6ed2['filters']=_[_0x32ef('0x33')](_0x1a6ed2[_0x32ef('0x31')],_0x1a6ed2[_0x32ef('0x32')]);_0x1b668a[_0x32ef('0x34')]=_[_0x32ef('0x33')](_0x1a6ed2[_0x32ef('0x31')],qs['fields'](_0x31dbc3['query']['fields']));_0x1b668a[_0x32ef('0x34')]=_0x1b668a[_0x32ef('0x34')][_0x32ef('0x35')]?_0x1b668a['attributes']:_0x1a6ed2['model'];if(!_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x36')](_0x32ef('0x37'))){_0x1b668a['limit']=qs['limit'](_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x1d')]);_0x1b668a[_0x32ef('0x1a')]=qs[_0x32ef('0x1a')](_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x1a')]);}_0x1b668a[_0x32ef('0x38')]=qs[_0x32ef('0x39')](_0x31dbc3[_0x32ef('0x32')]['sort']);_0x1b668a[_0x32ef('0x3a')]=qs[_0x32ef('0x3b')](_[_0x32ef('0x3c')](_0x31dbc3['query'],_0x1a6ed2[_0x32ef('0x3b')]),_0x575f3e);if(_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x3d')]){_0x1b668a[_0x32ef('0x3a')]=_[_0x32ef('0x3e')](_0x1b668a[_0x32ef('0x3a')],{'$or':_[_0x32ef('0x2d')](_0x575f3e,function(_0x1cebed){if(_0x1cebed[_0x32ef('0x2f')]!==_0x32ef('0x3f')){var _0xb4db74={};_0xb4db74[_0x1cebed[_0x32ef('0x2a')]]={'$like':'%'+_0x31dbc3['query'][_0x32ef('0x3d')]+'%'};return _0xb4db74;}})});}_0x1b668a=_[_0x32ef('0x3e')]({},_0x1b668a,_0x31dbc3[_0x32ef('0x40')]);var _0x1733e3={'where':_0x1b668a[_0x32ef('0x3a')]};return db[_0x32ef('0x41')][_0x32ef('0x1c')](_0x1733e3)['then'](function(_0x538758){_0x1a122d[_0x32ef('0x1c')]=_0x538758;if(_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x42')]){_0x1b668a[_0x32ef('0x43')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x32ef('0x44')](_0x1b668a);})[_0x32ef('0x22')](function(_0x5d2f06){_0x1a122d[_0x32ef('0x45')]=_0x5d2f06;return _0x1a122d;})['then'](respondWithFilteredResult(_0x2ac686,_0x1b668a))[_0x32ef('0x46')](handleError(_0x2ac686,null));};exports[_0x32ef('0x47')]=function(_0x37a497,_0x3be46d){var _0x2c2b62={'raw':!![],'where':{'id':_0x37a497[_0x32ef('0x48')]['id']}},_0x2310ae={};_0x2310ae[_0x32ef('0x31')]=_[_0x32ef('0x49')](db[_0x32ef('0x41')]['rawAttributes']);_0x2310ae[_0x32ef('0x32')]=_['keys'](_0x37a497[_0x32ef('0x32')]);_0x2310ae[_0x32ef('0x3b')]=_[_0x32ef('0x33')](_0x2310ae['model'],_0x2310ae[_0x32ef('0x32')]);_0x2c2b62[_0x32ef('0x34')]=_[_0x32ef('0x33')](_0x2310ae[_0x32ef('0x31')],qs[_0x32ef('0x4a')](_0x37a497[_0x32ef('0x32')][_0x32ef('0x4a')]));_0x2c2b62['attributes']=_0x2c2b62['attributes'][_0x32ef('0x35')]?_0x2c2b62[_0x32ef('0x34')]:_0x2310ae[_0x32ef('0x31')];if(_0x37a497[_0x32ef('0x32')][_0x32ef('0x42')]){_0x2c2b62[_0x32ef('0x43')]=[{'all':!![]}];}_0x2c2b62=_[_0x32ef('0x3e')]({},_0x2c2b62,_0x37a497[_0x32ef('0x40')]);return db[_0x32ef('0x41')][_0x32ef('0x4b')](_0x2c2b62)[_0x32ef('0x22')](handleEntityNotFound(_0x3be46d,null))[_0x32ef('0x22')](respondWithResult(_0x3be46d,null))[_0x32ef('0x46')](handleError(_0x3be46d,null));};exports['create']=function(_0x420f00,_0x12fbd7){return db[_0x32ef('0x41')][_0x32ef('0x4c')](_0x420f00[_0x32ef('0x4d')],{})[_0x32ef('0x22')](function(_0x278696){var _0x1acded=_0x420f00[_0x32ef('0x4e')][_0x32ef('0x24')]({'plain':!![]});if(!_0x1acded)throw new Error(_0x32ef('0x4f'));if(_0x1acded[_0x32ef('0x50')]===_0x32ef('0x4e')){var _0x326445=_0x278696[_0x32ef('0x24')]({'plain':!![]});var _0x3fb4d8=_0x32ef('0x51');return db[_0x32ef('0x52')]['find']({'where':{'name':_0x3fb4d8,'userProfileId':_0x1acded['userProfileId']},'raw':!![]})[_0x32ef('0x22')](function(_0x259c32){if(_0x259c32&&_0x259c32[_0x32ef('0x53')]===0x0){return db[_0x32ef('0x26')][_0x32ef('0x4c')]({'name':_0x326445[_0x32ef('0x2a')],'resourceId':_0x326445['id'],'type':_0x32ef('0x25'),'sectionId':_0x259c32['id']},{})[_0x32ef('0x22')](function(){return _0x278696;});}else{return _0x278696;}})[_0x32ef('0x46')](function(_0x368bf1){logger[_0x32ef('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x368bf1);throw _0x368bf1;});}return _0x278696;})[_0x32ef('0x22')](respondWithResult(_0x12fbd7,0xc9))[_0x32ef('0x46')](handleError(_0x12fbd7,null));};exports[_0x32ef('0x54')]=function(_0x3fe01f,_0x38314a){if(_0x3fe01f[_0x32ef('0x4d')]['id']){delete _0x3fe01f['body']['id'];}return db[_0x32ef('0x41')][_0x32ef('0x4b')]({'where':{'id':_0x3fe01f[_0x32ef('0x48')]['id']}})['then'](handleEntityNotFound(_0x38314a,null))[_0x32ef('0x22')](saveUpdates(_0x3fe01f['body'],null))[_0x32ef('0x22')](respondWithResult(_0x38314a,null))[_0x32ef('0x46')](handleError(_0x38314a,null));};exports['destroy']=function(_0x206ad5,_0x59e5f9){return db[_0x32ef('0x41')][_0x32ef('0x4b')]({'where':{'id':_0x206ad5[_0x32ef('0x48')]['id']}})[_0x32ef('0x22')](handleEntityNotFound(_0x59e5f9,null))[_0x32ef('0x22')](removeEntity(_0x59e5f9,null))[_0x32ef('0x46')](handleError(_0x59e5f9,null));};exports[_0x32ef('0x55')]=function(_0x56260f,_0x56cc75){var _0xdfa103=0xa;var _0x52232a=['join',_0x32ef('0x56'),_0x32ef('0x57'),_0x32ef('0x58')];var _0x6aae59={'SUM':_0x32ef('0x59'),'COUNT':_0x32ef('0x5a'),'COUNT DISTINCT':_0x32ef('0x5b'),'MAX':_0x32ef('0x5c'),'MIN':_0x32ef('0x5d'),'AVG':_0x32ef('0x5e'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x32ef('0x5f')};var _0xbd059e={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x32ef('0x60'),'HOUR':_0x32ef('0x61'),'ROUND':_0x32ef('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2ac877=function(_0x3c31d0){return!_[_0x32ef('0x63')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x32ef('0x64'),'IS\x20NOT\x20EMPTY'],_0x3c31d0);};var _0x17f447=function(_0x5bb114){if(!_0x5bb114||!_0x5bb114['rules'][_0x32ef('0x35')]){return'';}for(var _0x208989='(',_0x10cb37=0x0;_0x10cb37<_0x5bb114['rules'][_0x32ef('0x35')];_0x10cb37+=0x1){_0x10cb37>0x0&&(_0x208989+='\x20'+_0x5bb114[_0x32ef('0x65')]+'\x20');_0x208989+=_0x5bb114[_0x32ef('0x66')][_0x10cb37]['group']?_0x17f447(_0x5bb114[_0x32ef('0x66')][_0x10cb37][_0x32ef('0x67')]):_0x5bb114['rules'][_0x10cb37]['field']+'\x20'+_0x5bb114[_0x32ef('0x66')][_0x10cb37][_0x32ef('0x68')]+(_0x2ac877(_0x5bb114[_0x32ef('0x66')][_0x10cb37][_0x32ef('0x68')])?'\x20'+_0x5bb114[_0x32ef('0x66')][_0x10cb37][_0x32ef('0x69')]:'');}return _0x208989+')';};var _0x4c89e8={'where':{'id':_0x56260f[_0x32ef('0x48')]['id']}},_0x285330,_0x63b65,_0x25b6d6,_0x36ed97,_0x21e930;_0x4c89e8=_[_0x32ef('0x3e')]({},_0x4c89e8,_0x56260f[_0x32ef('0x40')]);return db[_0x32ef('0x41')]['find'](_0x4c89e8)[_0x32ef('0x22')](function(_0x29ff58){if(_0x29ff58){_0x285330=_0x29ff58;return _0x29ff58[_0x32ef('0x6a')]();}return null;})[_0x32ef('0x22')](function(_0x79ae28){if(_0x79ae28){if(!_0x79ae28['length']){throw new db['Sequelize'][(_0x32ef('0x6b'))](_0x32ef('0x6c'),0x193);}_0x63b65=_0x79ae28;return db[_0x32ef('0x6d')][_0x32ef('0x44')]({'raw':!![]});}return null;})[_0x32ef('0x22')](function(_0x526fb1){if(_0x526fb1){_0x25b6d6=_[_0x32ef('0x6e')](_0x526fb1,'id');var _0x544045;var _0x216e2f=squel[_0x32ef('0x6f')]();_0x216e2f['from'](_0x285330['table']);for(var _0x2c9f7a=0x0;_0x2c9f7a<_0x63b65[_0x32ef('0x35')];_0x2c9f7a+=0x1){_0x544045=_0x63b65[_0x2c9f7a][_0x32ef('0x70')]?_0x25b6d6[_0x63b65[_0x2c9f7a]['MetricId']]['metric']:_0x63b65[_0x2c9f7a][_0x32ef('0x71')];_0x544045=_0x63b65[_0x2c9f7a][_0x32ef('0x72')]?_[_0x32ef('0x73')](_0x6aae59[_0x63b65[_0x2c9f7a][_0x32ef('0x72')]],'%s',_0x544045):_0x544045;_0x544045=_0x63b65[_0x2c9f7a]['format']?_[_0x32ef('0x73')](_0xbd059e[_0x63b65[_0x2c9f7a][_0x32ef('0x74')]],'%s',_0x544045):_0x544045;if(_0x63b65[_0x2c9f7a][_0x32ef('0x75')]){_0x216e2f[_0x32ef('0x67')](_0x544045);}_0x63b65[_0x2c9f7a][_0x32ef('0x76')]&&_0x216e2f[_0x32ef('0x38')](_0x544045,_0x63b65[_0x2c9f7a][_0x32ef('0x76')]===_0x32ef('0x77')?![]:!![]);_0x216e2f[_0x32ef('0x71')](_0x544045,_0x63b65[_0x2c9f7a][_0x32ef('0x78')]||_0x544045);}if(_0x285330[_0x32ef('0x79')]){_0x285330[_0x32ef('0x79')]=JSON['parse'](_0x285330['joins']);for(var _0x3a9c97=0x0;_0x3a9c97<_0x285330[_0x32ef('0x79')]['length'];_0x3a9c97+=0x1){if(_0x285330[_0x32ef('0x79')][_0x3a9c97]['type']&&_[_0x32ef('0x63')](_0x52232a,_0x285330[_0x32ef('0x79')][_0x3a9c97][_0x32ef('0x2f')])&&_0x285330['joins'][_0x3a9c97][_0x32ef('0x7a')]&&_0x285330['joins'][_0x3a9c97][_0x32ef('0x7b')]&&_0x285330[_0x32ef('0x79')][_0x3a9c97]['foreignKey']){_0x216e2f[_0x285330['joins'][_0x3a9c97][_0x32ef('0x2f')]](_0x285330['joins'][_0x3a9c97][_0x32ef('0x7b')],null,util['format'](_0x32ef('0x7c'),_0x285330[_0x32ef('0x7d')],_0x285330[_0x32ef('0x79')][_0x3a9c97]['parentKey'],_0x285330['joins'][_0x3a9c97]['foreignTable'],_0x285330[_0x32ef('0x79')][_0x3a9c97]['foreignKey']));}}}if(_0x285330[_0x32ef('0x7e')]){_0x285330[_0x32ef('0x7e')]=JSON[_0x32ef('0x7f')](_0x285330[_0x32ef('0x7e')]);_0x216e2f[_0x32ef('0x3a')](_0x17f447(_0x285330[_0x32ef('0x7e')]['group']));}_0x21e930=_0x216e2f[_0x32ef('0x80')]();_0x216e2f['limit'](_0xdfa103);_0x216e2f['offset'](0x0);logger[_0x32ef('0x81')]('Limited\x20Query:',_0x216e2f[_0x32ef('0x82')]());return dbH[_0x32ef('0x83')]['query'](_0x216e2f[_0x32ef('0x82')](),{'type':dbH[_0x32ef('0x83')][_0x32ef('0x84')][_0x32ef('0x85')]});}})[_0x32ef('0x22')](respondWithResult(_0x56cc75,null))[_0x32ef('0x46')](handleError(_0x56cc75,null));};function runReport(_0x4b5506,_0x51736f,_0x35b10d){var _0x5e0b55=_0x51736f[_0x32ef('0x2a')];var _0x266688=0xa;var _0x114d8e=[_0x32ef('0x86'),_0x32ef('0x56'),_0x32ef('0x57'),'cross_join'];var _0x3232ca={'SUM':_0x32ef('0x59'),'COUNT':_0x32ef('0x5a'),'COUNT DISTINCT':_0x32ef('0x5b'),'MAX':_0x32ef('0x5c'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x32ef('0x87'),'GROUP_CONCAT ASC':_0x32ef('0x88'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x211fb1={'SEC_TO_TIME':_0x32ef('0x89'),'DATE':_0x32ef('0x60'),'HOUR':_0x32ef('0x61'),'ROUND':_0x32ef('0x62'),'UNIX_TIMESTAMP':_0x32ef('0x8a')};var _0xfb4845=function(_0x21067e){return!_[_0x32ef('0x63')](['IS\x20NULL',_0x32ef('0x8b'),_0x32ef('0x64'),'IS\x20NOT\x20EMPTY'],_0x21067e);};var _0x35653b=function(_0x5ea727){if(!_0x5ea727||!_0x5ea727[_0x32ef('0x66')]['length']){return'';}for(var _0x43f36e='(',_0x39300f=0x0;_0x39300f<_0x5ea727[_0x32ef('0x66')][_0x32ef('0x35')];_0x39300f+=0x1){_0x39300f>0x0&&(_0x43f36e+='\x20'+_0x5ea727['operator']+'\x20');_0x43f36e+=_0x5ea727[_0x32ef('0x66')][_0x39300f][_0x32ef('0x67')]?_0x35653b(_0x5ea727[_0x32ef('0x66')][_0x39300f]['group']):_0x5ea727['rules'][_0x39300f]['field']+'\x20'+_0x5ea727[_0x32ef('0x66')][_0x39300f][_0x32ef('0x68')]+(_0xfb4845(_0x5ea727[_0x32ef('0x66')][_0x39300f][_0x32ef('0x68')])?'\x20'+_0x5ea727[_0x32ef('0x66')][_0x39300f]['value']:'');}return _0x43f36e+')';};var _0x2678e3={'where':{'id':_0x4b5506['id']}},_0x5b3deb,_0x471de6,_0x7b0ea5,_0xc43e1,_0x4baa7a;_0x2678e3=_[_0x32ef('0x3e')]({},_0x2678e3,_0x35b10d);return db[_0x32ef('0x41')][_0x32ef('0x4b')](_0x2678e3)[_0x32ef('0x22')](function(_0x28bebb){if(_0x28bebb){_0x5b3deb=_0x28bebb;return _0x28bebb['getFields']();}return null;})[_0x32ef('0x22')](function(_0x484df0){if(_0x484df0){if(!_0x484df0[_0x32ef('0x35')]){throw new db[(_0x32ef('0x8c'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x471de6=_0x484df0;return db[_0x32ef('0x6d')][_0x32ef('0x44')]({'raw':!![]});}return null;})[_0x32ef('0x22')](function(_0x3b9896){if(_0x3b9896){_0x7b0ea5=_['keyBy'](_0x3b9896,'id');var _0x356fd4;var _0x51ca6e=squel['select']();_0x51ca6e[_0x32ef('0x8d')](_0x5b3deb['table']);for(var _0x2237cf=0x0;_0x2237cf<_0x471de6[_0x32ef('0x35')];_0x2237cf+=0x1){_0x356fd4=_0x471de6[_0x2237cf][_0x32ef('0x70')]?_0x7b0ea5[_0x471de6[_0x2237cf]['MetricId']]['metric']:_0x471de6[_0x2237cf][_0x32ef('0x71')];_0x356fd4=_0x471de6[_0x2237cf][_0x32ef('0x72')]?_[_0x32ef('0x73')](_0x3232ca[_0x471de6[_0x2237cf][_0x32ef('0x72')]],'%s',_0x356fd4):_0x356fd4;_0x356fd4=_0x471de6[_0x2237cf][_0x32ef('0x74')]?_[_0x32ef('0x73')](_0x211fb1[_0x471de6[_0x2237cf][_0x32ef('0x74')]],'%s',_0x356fd4):_0x356fd4;if(_0x471de6[_0x2237cf]['groupBy']){_0x51ca6e[_0x32ef('0x67')](_0x356fd4);}_0x471de6[_0x2237cf][_0x32ef('0x76')]&&_0x51ca6e[_0x32ef('0x38')](_0x356fd4,_0x471de6[_0x2237cf][_0x32ef('0x76')]==='DESC'?![]:!![]);_0x51ca6e['field'](_0x356fd4,_0x471de6[_0x2237cf][_0x32ef('0x78')]||_0x356fd4);}if(_0x5b3deb['joins']){_0x5b3deb[_0x32ef('0x79')]=JSON[_0x32ef('0x7f')](_0x5b3deb['joins']);for(var _0x5c7594=0x0;_0x5c7594<_0x5b3deb['joins'][_0x32ef('0x35')];_0x5c7594+=0x1){if(_0x5b3deb[_0x32ef('0x79')][_0x5c7594][_0x32ef('0x2f')]&&_[_0x32ef('0x63')](_0x114d8e,_0x5b3deb['joins'][_0x5c7594][_0x32ef('0x2f')])&&_0x5b3deb[_0x32ef('0x79')][_0x5c7594][_0x32ef('0x7a')]&&_0x5b3deb['joins'][_0x5c7594][_0x32ef('0x7b')]&&_0x5b3deb['joins'][_0x5c7594][_0x32ef('0x8e')]){_0x51ca6e[_0x5b3deb[_0x32ef('0x79')][_0x5c7594]['type']](_0x5b3deb['joins'][_0x5c7594][_0x32ef('0x7b')],null,util[_0x32ef('0x74')](_0x32ef('0x7c'),_0x5b3deb[_0x32ef('0x7d')],_0x5b3deb[_0x32ef('0x79')][_0x5c7594][_0x32ef('0x7a')],_0x5b3deb[_0x32ef('0x79')][_0x5c7594][_0x32ef('0x7b')],_0x5b3deb[_0x32ef('0x79')][_0x5c7594]['foreignKey']));}}}if(_0x5b3deb[_0x32ef('0x7e')]){_0x5b3deb['conditions']=JSON[_0x32ef('0x7f')](_0x5b3deb[_0x32ef('0x7e')]);_0x51ca6e[_0x32ef('0x3a')](_0x35653b(_0x5b3deb[_0x32ef('0x7e')][_0x32ef('0x67')]));}_0x4baa7a=_0x51ca6e['clone']();_0x51ca6e[_0x32ef('0x1d')](_0x266688);_0x51ca6e[_0x32ef('0x1a')](0x0);return;}})[_0x32ef('0x22')](function(){if(_0x51736f[_0x32ef('0x8f')]===_0x32ef('0x90')){return null;}var _0x1cfdd8=_[_0x32ef('0x3e')](_0x51736f,{'name':_0x51736f[_0x32ef('0x91')]||_0x51736f[_0x32ef('0x2a')]||_0x5b3deb['name'],'basename':_0x5e0b55,'savename':util['format']('%s-%s.%s',_0x51736f[_0x32ef('0x2a')]||_0x5b3deb[_0x32ef('0x2a')],require('randomstring')[_0x32ef('0x92')](0x4),_0x51736f['output']||_0x32ef('0x93')),'reportId':_0x5b3deb['id'],'reportType':'default'});return db['AnalyticExtractedReport'][_0x32ef('0x4c')](_0x1cfdd8,{'raw':!![]});})[_0x32ef('0x22')](function(_0x118d2e){if(_0x5b3deb[_0x32ef('0x7d')]===_0x32ef('0x94')){_0x4baa7a['where'](_0x5b3deb[_0x32ef('0x7d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x51736f[_0x32ef('0x95')],_0x51736f['endDate']);}else{_0x4baa7a['where'](_0x5b3deb['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x51736f['startDate'],_0x51736f[_0x32ef('0x96')]);}if(_0x118d2e){logger[_0x32ef('0x97')]('Run\x20Query:',_0x4baa7a[_0x32ef('0x82')]());require(_0x32ef('0x98'))[_0x32ef('0x99')](path[_0x32ef('0x86')](__dirname,_0x32ef('0x9a'),_0x118d2e[_0x32ef('0x8f')]),[_0x118d2e['id'],_0x4baa7a['toString'](),path[_0x32ef('0x86')](__dirname,'../../files/reports',_0x118d2e[_0x32ef('0x9b')]),_0x5e0b55]);return _0x118d2e;}else{var _0x1be713=squel['select']();_0x1be713[_0x32ef('0x8d')]('('+_0x4baa7a['toString']()+')',_0x32ef('0x9c'));_0x1be713[_0x32ef('0x71')](_0x32ef('0x9d'),_0x32ef('0x1c'));_0x4baa7a['limit'](_0x51736f[_0x32ef('0x1d')]||_0x266688);_0x4baa7a[_0x32ef('0x1a')](_0x51736f[_0x32ef('0x1a')]||0x0);return dbH[_0x32ef('0x83')]['query'](_0x1be713[_0x32ef('0x82')](),{'type':dbH['sequelize'][_0x32ef('0x84')][_0x32ef('0x85')]})[_0x32ef('0x22')](function(_0x28ef17){if(!_0x28ef17[_0x32ef('0x35')]){_0xc43e1=0x0;}else{_0xc43e1=_0x28ef17[0x0][_0x32ef('0x1c')]||0x0;}return dbH['sequelize'][_0x32ef('0x32')](_0x4baa7a['toString'](),{'type':dbH['sequelize'][_0x32ef('0x84')][_0x32ef('0x85')]});})[_0x32ef('0x22')](function(_0x3956e7){return{'rows':_0x3956e7||[],'count':_0xc43e1};});}});}exports['run']=function(_0x8d3b24,_0x642716){return runReport(_0x8d3b24[_0x32ef('0x48')],_0x8d3b24[_0x32ef('0x32')],_0x8d3b24['options'])['then'](respondWithResult(_0x642716,null))['catch'](handleError(_0x642716,null));};exports[_0x32ef('0x9e')]=runReport;exports[_0x32ef('0x32')]=function(_0x4454f3,_0xc92dcc){var _0x3d18b9=0xa;var _0x9233cb=[_0x32ef('0x86'),_0x32ef('0x56'),_0x32ef('0x57'),_0x32ef('0x58')];var _0xa76912={'SUM':'SUM(%s)','COUNT':_0x32ef('0x5a'),'COUNT DISTINCT':_0x32ef('0x5b'),'MAX':_0x32ef('0x5c'),'MIN':_0x32ef('0x5d'),'AVG':_0x32ef('0x5e'),'GROUP_CONCAT':_0x32ef('0x87'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x32ef('0x5f')};var _0x1526a1={'SEC_TO_TIME':_0x32ef('0x89'),'DATE':_0x32ef('0x60'),'HOUR':_0x32ef('0x61'),'ROUND':_0x32ef('0x62'),'UNIX_TIMESTAMP':_0x32ef('0x8a')};var _0x2d4d2f=function(_0x292488){return!_[_0x32ef('0x63')]([_0x32ef('0x9f'),_0x32ef('0x8b'),_0x32ef('0x64'),_0x32ef('0xa0')],_0x292488);};var _0x50b674=function(_0x379d40){if(!_0x379d40||!_0x379d40[_0x32ef('0x66')][_0x32ef('0x35')]){return'';}for(var _0x4b7a4d='(',_0x16525b=0x0;_0x16525b<_0x379d40['rules'][_0x32ef('0x35')];_0x16525b+=0x1){_0x16525b>0x0&&(_0x4b7a4d+='\x20'+_0x379d40[_0x32ef('0x65')]+'\x20');_0x4b7a4d+=_0x379d40[_0x32ef('0x66')][_0x16525b]['group']?_0x50b674(_0x379d40[_0x32ef('0x66')][_0x16525b]['group']):_0x379d40[_0x32ef('0x66')][_0x16525b][_0x32ef('0x71')]+'\x20'+_0x379d40['rules'][_0x16525b][_0x32ef('0x68')]+(_0x2d4d2f(_0x379d40[_0x32ef('0x66')][_0x16525b][_0x32ef('0x68')])?'\x20'+_0x379d40[_0x32ef('0x66')][_0x16525b][_0x32ef('0x69')]:'');}return _0x4b7a4d+')';};var _0x264075={'where':{'id':_0x4454f3[_0x32ef('0x48')]['id']}},_0x3798d1,_0x4befa9,_0x493ae9,_0x143d39,_0x497948;_0x264075=_[_0x32ef('0x3e')]({},_0x264075,_0x4454f3['options']);return db[_0x32ef('0x41')][_0x32ef('0x4b')](_0x264075)['then'](function(_0x1200c9){if(_0x1200c9){_0x3798d1=_0x1200c9;return _0x1200c9[_0x32ef('0x6a')]();}return null;})[_0x32ef('0x22')](function(_0xa5f787){if(_0xa5f787){if(!_0xa5f787[_0x32ef('0x35')]){throw new db['Sequelize'][(_0x32ef('0x6b'))](_0x32ef('0x6c'),0x193);}_0x4befa9=_0xa5f787;return db['AnalyticMetric'][_0x32ef('0x44')]({'raw':!![]});}return null;})[_0x32ef('0x22')](function(_0x55ad11){if(_0x55ad11){_0x493ae9=_[_0x32ef('0x6e')](_0x55ad11,'id');var _0x2971a8;var _0x522c22=squel[_0x32ef('0x6f')]();_0x522c22[_0x32ef('0x8d')](_0x3798d1['table']);for(var _0xb41a01=0x0;_0xb41a01<_0x4befa9[_0x32ef('0x35')];_0xb41a01+=0x1){_0x2971a8=_0x4befa9[_0xb41a01][_0x32ef('0x70')]?_0x493ae9[_0x4befa9[_0xb41a01][_0x32ef('0x70')]][_0x32ef('0xa1')]:_0x4befa9[_0xb41a01][_0x32ef('0x71')];_0x2971a8=_0x4befa9[_0xb41a01][_0x32ef('0x72')]?_['replace'](_0xa76912[_0x4befa9[_0xb41a01]['function']],'%s',_0x2971a8):_0x2971a8;_0x2971a8=_0x4befa9[_0xb41a01][_0x32ef('0x74')]?_[_0x32ef('0x73')](_0x1526a1[_0x4befa9[_0xb41a01][_0x32ef('0x74')]],'%s',_0x2971a8):_0x2971a8;if(_0x4befa9[_0xb41a01]['groupBy']){_0x522c22[_0x32ef('0x67')](_0x2971a8);}_0x4befa9[_0xb41a01][_0x32ef('0x76')]&&_0x522c22['order'](_0x2971a8,_0x4befa9[_0xb41a01][_0x32ef('0x76')]===_0x32ef('0x77')?![]:!![]);_0x522c22['field'](_0x2971a8,_0x4befa9[_0xb41a01]['alias']||_0x2971a8);}if(_0x3798d1[_0x32ef('0x79')]){_0x3798d1[_0x32ef('0x79')]=JSON[_0x32ef('0x7f')](_0x3798d1['joins']);for(var _0x5f4eab=0x0;_0x5f4eab<_0x3798d1['joins'][_0x32ef('0x35')];_0x5f4eab+=0x1){if(_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x2f')]&&_['includes'](_0x9233cb,_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x2f')])&&_0x3798d1[_0x32ef('0x79')][_0x5f4eab]['parentKey']&&_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x7b')]&&_0x3798d1['joins'][_0x5f4eab]['foreignKey']){_0x522c22[_0x3798d1[_0x32ef('0x79')][_0x5f4eab]['type']](_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x7b')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x3798d1[_0x32ef('0x7d')],_0x3798d1['joins'][_0x5f4eab][_0x32ef('0x7a')],_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x7b')],_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x8e')]));}}}if(_0x3798d1[_0x32ef('0x7e')]){_0x3798d1[_0x32ef('0x7e')]=JSON[_0x32ef('0x7f')](_0x3798d1[_0x32ef('0x7e')]);_0x522c22[_0x32ef('0x3a')](_0x50b674(_0x3798d1['conditions']['group']));}_0x497948=_0x522c22[_0x32ef('0x80')]();_0x522c22[_0x32ef('0x1d')](_0x3d18b9);_0x522c22[_0x32ef('0x1a')](0x0);logger[_0x32ef('0x81')](_0x32ef('0xa2'),_0x522c22[_0x32ef('0x82')]());return dbH[_0x32ef('0x83')][_0x32ef('0x32')](_0x522c22[_0x32ef('0x82')](),{'type':dbH[_0x32ef('0x83')]['QueryTypes'][_0x32ef('0x85')]});}})[_0x32ef('0x22')](function(){return{'sql':_0x497948[_0x32ef('0x82')]()};})[_0x32ef('0x22')](respondWithResult(_0xc92dcc,null))[_0x32ef('0x46')](handleError(_0xc92dcc,null));}; \ No newline at end of file +var _0xf494=['name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','includeAll','find','create','body','user','Reports','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','join','left_join','cross_join','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','field','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','DESC','alias','joins','parse','foreignTable','%s.%s\x20=\x20%s.%s','parentKey','foreignKey','conditions','debug','Limited\x20Query:','sequelize','toString','QueryTypes','right_join','SUM(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','ROUND(%s)','IS\x20NULL','operator','condition','getFields','groupBy','clone','output','fullPath','%s-%s.%s','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','SELECT','run','runReport','IS\x20NOT\x20EMPTY','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','get','DefaultReports','error','stack'];(function(_0x4bd89a,_0x55a58f){var _0x35454f=function(_0x512f23){while(--_0x512f23){_0x4bd89a['push'](_0x4bd89a['shift']());}};_0x35454f(++_0x55a58f);}(_0xf494,0x1c6));var _0x4f49=function(_0x2f023d,_0x4ea17a){_0x2f023d=_0x2f023d-0x0;var _0x17557d=_0xf494[_0x2f023d];return _0x17557d;};'use strict';var emlformat=require(_0x4f49('0x0'));var rimraf=require(_0x4f49('0x1'));var zipdir=require(_0x4f49('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4f49('0x3'));var moment=require(_0x4f49('0x4'));var BPromise=require(_0x4f49('0x5'));var Mustache=require(_0x4f49('0x6'));var util=require(_0x4f49('0x7'));var path=require(_0x4f49('0x8'));var sox=require(_0x4f49('0x9'));var csv=require(_0x4f49('0xa'));var ejs=require(_0x4f49('0xb'));var fs=require('fs');var fs_extra=require(_0x4f49('0xc'));var _=require(_0x4f49('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f49('0xe'));var deskjs=require(_0x4f49('0xf'));var toCsv=require(_0x4f49('0xa'));var querystring=require(_0x4f49('0x10'));var Papa=require(_0x4f49('0x11'));var Redis=require(_0x4f49('0x12'));var authService=require(_0x4f49('0x13'));var qs=require(_0x4f49('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f49('0x15'));var logger=require(_0x4f49('0x16'))('api');var utils=require(_0x4f49('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4f49('0x18'))['db'];var dbH=require(_0x4f49('0x18'))['dbH'];function respondWithStatusCode(_0x1e1c37,_0x111a8b){_0x111a8b=_0x111a8b||0xcc;return function(_0x1b9145){if(_0x1b9145){return _0x1e1c37[_0x4f49('0x19')](_0x111a8b);}return _0x1e1c37[_0x4f49('0x1a')](_0x111a8b)[_0x4f49('0x1b')]();};}function respondWithResult(_0xfdb477,_0x5c373e){_0x5c373e=_0x5c373e||0xc8;return function(_0x515ace){if(_0x515ace){return _0xfdb477[_0x4f49('0x1a')](_0x5c373e)[_0x4f49('0x1c')](_0x515ace);}};}function respondWithFilteredResult(_0x5878f4,_0x5bdfaf){return function(_0x2f0a0d){if(_0x2f0a0d){var _0x2ecaaa=typeof _0x5bdfaf[_0x4f49('0x1d')]==='undefined'&&typeof _0x5bdfaf[_0x4f49('0x1e')]===_0x4f49('0x1f');var _0x4e85df=_0x2f0a0d['count'];var _0x5bb23b=_0x2ecaaa?0x0:_0x5bdfaf['offset'];var _0x47f1e8=_0x2ecaaa?_0x2f0a0d[_0x4f49('0x20')]:_0x5bdfaf[_0x4f49('0x1d')]+_0x5bdfaf[_0x4f49('0x1e')];var _0x407042;if(_0x47f1e8>=_0x4e85df){_0x47f1e8=_0x4e85df;_0x407042=0xc8;}else{_0x407042=0xce;}_0x5878f4['status'](_0x407042);return _0x5878f4[_0x4f49('0x21')](_0x4f49('0x22'),_0x5bb23b+'-'+_0x47f1e8+'/'+_0x4e85df)[_0x4f49('0x1c')](_0x2f0a0d);}return null;};}function patchUpdates(_0xaab5e7){return function(_0xea82f8){try{jsonpatch['apply'](_0xea82f8,_0xaab5e7,!![]);}catch(_0x3e7e28){return BPromise[_0x4f49('0x23')](_0x3e7e28);}return _0xea82f8[_0x4f49('0x24')]();};}function saveUpdates(_0x53b57d,_0x40755e){return function(_0x1d70a7){if(_0x1d70a7){return _0x1d70a7[_0x4f49('0x25')](_0x53b57d)[_0x4f49('0x26')](function(_0x9d30aa){return _0x9d30aa;});}return null;};}function removeEntity(_0x36187b,_0x559d98){return function(_0x4e9041){if(_0x4e9041){return _0x4e9041[_0x4f49('0x27')]()[_0x4f49('0x26')](function(){var _0x4fedbb=_0x4e9041[_0x4f49('0x28')]({'plain':!![]});var _0x2c1519=_0x4f49('0x29');return db['UserProfileResource'][_0x4f49('0x27')]({'where':{'type':_0x2c1519,'resourceId':_0x4fedbb['id']}})[_0x4f49('0x26')](function(){return _0x4e9041;});})[_0x4f49('0x26')](function(){_0x36187b[_0x4f49('0x1a')](0xcc)[_0x4f49('0x1b')]();});}};}function handleEntityNotFound(_0x122404,_0x4915af){return function(_0x50c571){if(!_0x50c571){_0x122404[_0x4f49('0x19')](0x194);}return _0x50c571;};}function handleError(_0x2c00ee,_0x605c91){_0x605c91=_0x605c91||0x1f4;return function(_0x560050){logger[_0x4f49('0x2a')](_0x560050[_0x4f49('0x2b')]);if(_0x560050[_0x4f49('0x2c')]){delete _0x560050['name'];}_0x2c00ee['status'](_0x605c91)[_0x4f49('0x2d')](_0x560050);};}exports[_0x4f49('0x2e')]=function(_0x7a6ea0,_0x5e7076){var _0x1eaac6={},_0x35aa33={},_0x173657={'count':0x0,'rows':[]};var _0x2ceda4=_[_0x4f49('0x2f')](db[_0x4f49('0x30')][_0x4f49('0x31')],function(_0x45ae19){return{'name':_0x45ae19[_0x4f49('0x32')],'type':_0x45ae19[_0x4f49('0x33')][_0x4f49('0x34')]};});_0x35aa33[_0x4f49('0x35')]=_[_0x4f49('0x2f')](_0x2ceda4,_0x4f49('0x2c'));_0x35aa33[_0x4f49('0x36')]=_[_0x4f49('0x37')](_0x7a6ea0[_0x4f49('0x36')]);_0x35aa33[_0x4f49('0x38')]=_[_0x4f49('0x39')](_0x35aa33['model'],_0x35aa33[_0x4f49('0x36')]);_0x1eaac6[_0x4f49('0x3a')]=_[_0x4f49('0x39')](_0x35aa33[_0x4f49('0x35')],qs[_0x4f49('0x3b')](_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x3b')]));_0x1eaac6[_0x4f49('0x3a')]=_0x1eaac6[_0x4f49('0x3a')][_0x4f49('0x3c')]?_0x1eaac6[_0x4f49('0x3a')]:_0x35aa33[_0x4f49('0x35')];if(!_0x7a6ea0[_0x4f49('0x36')]['hasOwnProperty'](_0x4f49('0x3d'))){_0x1eaac6[_0x4f49('0x1e')]=qs[_0x4f49('0x1e')](_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x1e')]);_0x1eaac6[_0x4f49('0x1d')]=qs[_0x4f49('0x1d')](_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x1d')]);}_0x1eaac6[_0x4f49('0x3e')]=qs[_0x4f49('0x3f')](_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x3f')]);_0x1eaac6[_0x4f49('0x40')]=qs['filters'](_[_0x4f49('0x41')](_0x7a6ea0[_0x4f49('0x36')],_0x35aa33['filters']),_0x2ceda4);if(_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x42')]){_0x1eaac6['where']=_[_0x4f49('0x43')](_0x1eaac6[_0x4f49('0x40')],{'$or':_[_0x4f49('0x2f')](_0x2ceda4,function(_0x200b1d){if(_0x200b1d[_0x4f49('0x33')]!==_0x4f49('0x44')){var _0x29e910={};_0x29e910[_0x200b1d['name']]={'$like':'%'+_0x7a6ea0['query']['filter']+'%'};return _0x29e910;}})});}_0x1eaac6=_[_0x4f49('0x43')]({},_0x1eaac6,_0x7a6ea0[_0x4f49('0x45')]);var _0x2e4355={'where':_0x1eaac6[_0x4f49('0x40')]};return db[_0x4f49('0x30')][_0x4f49('0x20')](_0x2e4355)[_0x4f49('0x26')](function(_0x23720a){_0x173657[_0x4f49('0x20')]=_0x23720a;if(_0x7a6ea0['query']['includeAll']){_0x1eaac6[_0x4f49('0x46')]=[{'all':!![]}];}return db[_0x4f49('0x30')][_0x4f49('0x47')](_0x1eaac6);})['then'](function(_0x2d6b56){_0x173657['rows']=_0x2d6b56;return _0x173657;})['then'](respondWithFilteredResult(_0x5e7076,_0x1eaac6))[_0x4f49('0x48')](handleError(_0x5e7076,null));};exports[_0x4f49('0x49')]=function(_0x40eadc,_0x497cb8){var _0x287781={'raw':!![],'where':{'id':_0x40eadc['params']['id']}},_0x11b4df={};_0x11b4df[_0x4f49('0x35')]=_['keys'](db[_0x4f49('0x30')][_0x4f49('0x31')]);_0x11b4df[_0x4f49('0x36')]=_['keys'](_0x40eadc[_0x4f49('0x36')]);_0x11b4df[_0x4f49('0x38')]=_[_0x4f49('0x39')](_0x11b4df[_0x4f49('0x35')],_0x11b4df[_0x4f49('0x36')]);_0x287781[_0x4f49('0x3a')]=_[_0x4f49('0x39')](_0x11b4df[_0x4f49('0x35')],qs[_0x4f49('0x3b')](_0x40eadc[_0x4f49('0x36')]['fields']));_0x287781[_0x4f49('0x3a')]=_0x287781[_0x4f49('0x3a')]['length']?_0x287781[_0x4f49('0x3a')]:_0x11b4df['model'];if(_0x40eadc[_0x4f49('0x36')][_0x4f49('0x4a')]){_0x287781[_0x4f49('0x46')]=[{'all':!![]}];}_0x287781=_[_0x4f49('0x43')]({},_0x287781,_0x40eadc['options']);return db[_0x4f49('0x30')][_0x4f49('0x4b')](_0x287781)[_0x4f49('0x26')](handleEntityNotFound(_0x497cb8,null))[_0x4f49('0x26')](respondWithResult(_0x497cb8,null))[_0x4f49('0x48')](handleError(_0x497cb8,null));};exports[_0x4f49('0x4c')]=function(_0x37fdb7,_0xd282c){return db[_0x4f49('0x30')][_0x4f49('0x4c')](_0x37fdb7[_0x4f49('0x4d')],{})[_0x4f49('0x26')](function(_0x148031){var _0x2104d0=_0x37fdb7[_0x4f49('0x4e')][_0x4f49('0x28')]({'plain':!![]});if(!_0x2104d0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2104d0['role']===_0x4f49('0x4e')){var _0x197670=_0x148031[_0x4f49('0x28')]({'plain':!![]});var _0xe46c90=_0x4f49('0x4f');return db[_0x4f49('0x50')][_0x4f49('0x4b')]({'where':{'name':_0xe46c90,'userProfileId':_0x2104d0['userProfileId']},'raw':!![]})[_0x4f49('0x26')](function(_0x4ff0a2){if(_0x4ff0a2&&_0x4ff0a2[_0x4f49('0x51')]===0x0){return db[_0x4f49('0x52')][_0x4f49('0x4c')]({'name':_0x197670[_0x4f49('0x2c')],'resourceId':_0x197670['id'],'type':'DefaultReports','sectionId':_0x4ff0a2['id']},{})[_0x4f49('0x26')](function(){return _0x148031;});}else{return _0x148031;}})['catch'](function(_0x52d18c){logger[_0x4f49('0x2a')](_0x4f49('0x53'),_0x52d18c);throw _0x52d18c;});}return _0x148031;})[_0x4f49('0x26')](respondWithResult(_0xd282c,0xc9))[_0x4f49('0x48')](handleError(_0xd282c,null));};exports['update']=function(_0x599c51,_0xd7f47b){if(_0x599c51[_0x4f49('0x4d')]['id']){delete _0x599c51['body']['id'];}return db[_0x4f49('0x30')]['find']({'where':{'id':_0x599c51['params']['id']}})[_0x4f49('0x26')](handleEntityNotFound(_0xd7f47b,null))['then'](saveUpdates(_0x599c51[_0x4f49('0x4d')],null))['then'](respondWithResult(_0xd7f47b,null))[_0x4f49('0x48')](handleError(_0xd7f47b,null));};exports[_0x4f49('0x27')]=function(_0x2472c9,_0x883408){return db[_0x4f49('0x30')][_0x4f49('0x4b')]({'where':{'id':_0x2472c9[_0x4f49('0x54')]['id']}})[_0x4f49('0x26')](handleEntityNotFound(_0x883408,null))['then'](removeEntity(_0x883408,null))[_0x4f49('0x48')](handleError(_0x883408,null));};exports['preview']=function(_0x213608,_0x1f640d){var _0xc4fc6b=0xa;var _0x467f12=[_0x4f49('0x55'),_0x4f49('0x56'),'right_join',_0x4f49('0x57')];var _0xd3689c={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4f49('0x58'),'MAX':_0x4f49('0x59'),'MIN':_0x4f49('0x5a'),'AVG':_0x4f49('0x5b'),'GROUP_CONCAT':_0x4f49('0x5c'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4f49('0x5d')};var _0x564bf5={'SEC_TO_TIME':_0x4f49('0x5e'),'DATE':_0x4f49('0x5f'),'HOUR':_0x4f49('0x60'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x4f49('0x61')};var _0x21807e=function(_0x265988){return!_[_0x4f49('0x62')](['IS\x20NULL',_0x4f49('0x63'),_0x4f49('0x64'),'IS\x20NOT\x20EMPTY'],_0x265988);};var _0x293839=function(_0x17b15){if(!_0x17b15||!_0x17b15[_0x4f49('0x65')][_0x4f49('0x3c')]){return'';}for(var _0x28ea73='(',_0x1b80f2=0x0;_0x1b80f2<_0x17b15[_0x4f49('0x65')][_0x4f49('0x3c')];_0x1b80f2+=0x1){_0x1b80f2>0x0&&(_0x28ea73+='\x20'+_0x17b15['operator']+'\x20');_0x28ea73+=_0x17b15[_0x4f49('0x65')][_0x1b80f2][_0x4f49('0x66')]?_0x293839(_0x17b15[_0x4f49('0x65')][_0x1b80f2][_0x4f49('0x66')]):_0x17b15[_0x4f49('0x65')][_0x1b80f2][_0x4f49('0x67')]+'\x20'+_0x17b15[_0x4f49('0x65')][_0x1b80f2]['condition']+(_0x21807e(_0x17b15[_0x4f49('0x65')][_0x1b80f2]['condition'])?'\x20'+_0x17b15[_0x4f49('0x65')][_0x1b80f2][_0x4f49('0x68')]:'');}return _0x28ea73+')';};var _0x4714c7={'where':{'id':_0x213608[_0x4f49('0x54')]['id']}},_0xf29378,_0xc7743e,_0x3f2f3f,_0x61a565,_0x297698;_0x4714c7=_[_0x4f49('0x43')]({},_0x4714c7,_0x213608['options']);return db[_0x4f49('0x30')][_0x4f49('0x4b')](_0x4714c7)[_0x4f49('0x26')](function(_0x2cdaa4){if(_0x2cdaa4){_0xf29378=_0x2cdaa4;return _0x2cdaa4['getFields']();}return null;})['then'](function(_0x28e8ae){if(_0x28e8ae){if(!_0x28e8ae['length']){throw new db[(_0x4f49('0x69'))][(_0x4f49('0x6a'))](_0x4f49('0x6b'),0x193);}_0xc7743e=_0x28e8ae;return db[_0x4f49('0x6c')][_0x4f49('0x47')]({'raw':!![]});}return null;})[_0x4f49('0x26')](function(_0x179431){if(_0x179431){_0x3f2f3f=_[_0x4f49('0x6d')](_0x179431,'id');var _0x3823f0;var _0x3e9b47=squel[_0x4f49('0x6e')]();_0x3e9b47[_0x4f49('0x6f')](_0xf29378[_0x4f49('0x70')]);for(var _0xd53de8=0x0;_0xd53de8<_0xc7743e[_0x4f49('0x3c')];_0xd53de8+=0x1){_0x3823f0=_0xc7743e[_0xd53de8][_0x4f49('0x71')]?_0x3f2f3f[_0xc7743e[_0xd53de8][_0x4f49('0x71')]][_0x4f49('0x72')]:_0xc7743e[_0xd53de8][_0x4f49('0x67')];_0x3823f0=_0xc7743e[_0xd53de8][_0x4f49('0x73')]?_[_0x4f49('0x74')](_0xd3689c[_0xc7743e[_0xd53de8][_0x4f49('0x73')]],'%s',_0x3823f0):_0x3823f0;_0x3823f0=_0xc7743e[_0xd53de8][_0x4f49('0x75')]?_[_0x4f49('0x74')](_0x564bf5[_0xc7743e[_0xd53de8][_0x4f49('0x75')]],'%s',_0x3823f0):_0x3823f0;if(_0xc7743e[_0xd53de8]['groupBy']){_0x3e9b47[_0x4f49('0x66')](_0x3823f0);}_0xc7743e[_0xd53de8]['orderBy']&&_0x3e9b47[_0x4f49('0x3e')](_0x3823f0,_0xc7743e[_0xd53de8][_0x4f49('0x76')]===_0x4f49('0x77')?![]:!![]);_0x3e9b47[_0x4f49('0x67')](_0x3823f0,_0xc7743e[_0xd53de8][_0x4f49('0x78')]||_0x3823f0);}if(_0xf29378[_0x4f49('0x79')]){_0xf29378[_0x4f49('0x79')]=JSON[_0x4f49('0x7a')](_0xf29378[_0x4f49('0x79')]);for(var _0x541ac6=0x0;_0x541ac6<_0xf29378['joins'][_0x4f49('0x3c')];_0x541ac6+=0x1){if(_0xf29378['joins'][_0x541ac6][_0x4f49('0x33')]&&_[_0x4f49('0x62')](_0x467f12,_0xf29378[_0x4f49('0x79')][_0x541ac6][_0x4f49('0x33')])&&_0xf29378[_0x4f49('0x79')][_0x541ac6]['parentKey']&&_0xf29378['joins'][_0x541ac6][_0x4f49('0x7b')]&&_0xf29378[_0x4f49('0x79')][_0x541ac6]['foreignKey']){_0x3e9b47[_0xf29378[_0x4f49('0x79')][_0x541ac6][_0x4f49('0x33')]](_0xf29378['joins'][_0x541ac6][_0x4f49('0x7b')],null,util['format'](_0x4f49('0x7c'),_0xf29378[_0x4f49('0x70')],_0xf29378['joins'][_0x541ac6][_0x4f49('0x7d')],_0xf29378[_0x4f49('0x79')][_0x541ac6][_0x4f49('0x7b')],_0xf29378[_0x4f49('0x79')][_0x541ac6][_0x4f49('0x7e')]));}}}if(_0xf29378[_0x4f49('0x7f')]){_0xf29378['conditions']=JSON[_0x4f49('0x7a')](_0xf29378['conditions']);_0x3e9b47[_0x4f49('0x40')](_0x293839(_0xf29378['conditions'][_0x4f49('0x66')]));}_0x297698=_0x3e9b47['clone']();_0x3e9b47[_0x4f49('0x1e')](_0xc4fc6b);_0x3e9b47[_0x4f49('0x1d')](0x0);logger[_0x4f49('0x80')](_0x4f49('0x81'),_0x3e9b47['toString']());return dbH[_0x4f49('0x82')]['query'](_0x3e9b47[_0x4f49('0x83')](),{'type':dbH['sequelize'][_0x4f49('0x84')]['SELECT']});}})['then'](respondWithResult(_0x1f640d,null))[_0x4f49('0x48')](handleError(_0x1f640d,null));};function runReport(_0x20b2be,_0x16cb4d,_0x4c0e7a){var _0x289810=_0x16cb4d[_0x4f49('0x2c')];var _0x5c33c9=0xa;var _0x5d52ae=['join',_0x4f49('0x56'),_0x4f49('0x85'),_0x4f49('0x57')];var _0x87439={'SUM':_0x4f49('0x86'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4f49('0x58'),'MAX':_0x4f49('0x59'),'MIN':_0x4f49('0x5a'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4f49('0x5c'),'GROUP_CONCAT ASC':_0x4f49('0x87'),'GROUP_CONCAT DESC':_0x4f49('0x5d')};var _0x2902a1={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x4f49('0x5f'),'HOUR':_0x4f49('0x60'),'ROUND':_0x4f49('0x88'),'UNIX_TIMESTAMP':_0x4f49('0x61')};var _0x389679=function(_0x5304c3){return!_[_0x4f49('0x62')]([_0x4f49('0x89'),'IS\x20NOT\x20NULL',_0x4f49('0x64'),'IS\x20NOT\x20EMPTY'],_0x5304c3);};var _0x351a33=function(_0x4d72a0){if(!_0x4d72a0||!_0x4d72a0[_0x4f49('0x65')][_0x4f49('0x3c')]){return'';}for(var _0x2ef19e='(',_0x6ad599=0x0;_0x6ad599<_0x4d72a0[_0x4f49('0x65')]['length'];_0x6ad599+=0x1){_0x6ad599>0x0&&(_0x2ef19e+='\x20'+_0x4d72a0[_0x4f49('0x8a')]+'\x20');_0x2ef19e+=_0x4d72a0[_0x4f49('0x65')][_0x6ad599][_0x4f49('0x66')]?_0x351a33(_0x4d72a0[_0x4f49('0x65')][_0x6ad599]['group']):_0x4d72a0[_0x4f49('0x65')][_0x6ad599]['field']+'\x20'+_0x4d72a0[_0x4f49('0x65')][_0x6ad599]['condition']+(_0x389679(_0x4d72a0[_0x4f49('0x65')][_0x6ad599][_0x4f49('0x8b')])?'\x20'+_0x4d72a0[_0x4f49('0x65')][_0x6ad599][_0x4f49('0x68')]:'');}return _0x2ef19e+')';};var _0x111e90={'where':{'id':_0x20b2be['id']}},_0xd253ed,_0x323a3a,_0xe0adc3,_0x3a26ff,_0x64f0ee;_0x111e90=_['merge']({},_0x111e90,_0x4c0e7a);return db[_0x4f49('0x30')][_0x4f49('0x4b')](_0x111e90)[_0x4f49('0x26')](function(_0x299849){if(_0x299849){_0xd253ed=_0x299849;return _0x299849[_0x4f49('0x8c')]();}return null;})[_0x4f49('0x26')](function(_0x55b28b){if(_0x55b28b){if(!_0x55b28b[_0x4f49('0x3c')]){throw new db[(_0x4f49('0x69'))][(_0x4f49('0x6a'))](_0x4f49('0x6b'),0x193);}_0x323a3a=_0x55b28b;return db['AnalyticMetric'][_0x4f49('0x47')]({'raw':!![]});}return null;})['then'](function(_0x3c4e88){if(_0x3c4e88){_0xe0adc3=_[_0x4f49('0x6d')](_0x3c4e88,'id');var _0x5c5d2;var _0xa880a2=squel['select']();_0xa880a2[_0x4f49('0x6f')](_0xd253ed[_0x4f49('0x70')]);for(var _0x11c0a0=0x0;_0x11c0a0<_0x323a3a[_0x4f49('0x3c')];_0x11c0a0+=0x1){_0x5c5d2=_0x323a3a[_0x11c0a0][_0x4f49('0x71')]?_0xe0adc3[_0x323a3a[_0x11c0a0][_0x4f49('0x71')]][_0x4f49('0x72')]:_0x323a3a[_0x11c0a0][_0x4f49('0x67')];_0x5c5d2=_0x323a3a[_0x11c0a0][_0x4f49('0x73')]?_[_0x4f49('0x74')](_0x87439[_0x323a3a[_0x11c0a0][_0x4f49('0x73')]],'%s',_0x5c5d2):_0x5c5d2;_0x5c5d2=_0x323a3a[_0x11c0a0][_0x4f49('0x75')]?_[_0x4f49('0x74')](_0x2902a1[_0x323a3a[_0x11c0a0][_0x4f49('0x75')]],'%s',_0x5c5d2):_0x5c5d2;if(_0x323a3a[_0x11c0a0][_0x4f49('0x8d')]){_0xa880a2[_0x4f49('0x66')](_0x5c5d2);}_0x323a3a[_0x11c0a0][_0x4f49('0x76')]&&_0xa880a2[_0x4f49('0x3e')](_0x5c5d2,_0x323a3a[_0x11c0a0]['orderBy']===_0x4f49('0x77')?![]:!![]);_0xa880a2[_0x4f49('0x67')](_0x5c5d2,_0x323a3a[_0x11c0a0][_0x4f49('0x78')]||_0x5c5d2);}if(_0xd253ed[_0x4f49('0x79')]){_0xd253ed['joins']=JSON[_0x4f49('0x7a')](_0xd253ed[_0x4f49('0x79')]);for(var _0x594460=0x0;_0x594460<_0xd253ed[_0x4f49('0x79')]['length'];_0x594460+=0x1){if(_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x33')]&&_[_0x4f49('0x62')](_0x5d52ae,_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x33')])&&_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x7d')]&&_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x7b')]&&_0xd253ed[_0x4f49('0x79')][_0x594460]['foreignKey']){_0xa880a2[_0xd253ed['joins'][_0x594460][_0x4f49('0x33')]](_0xd253ed['joins'][_0x594460][_0x4f49('0x7b')],null,util[_0x4f49('0x75')]('%s.%s\x20=\x20%s.%s',_0xd253ed['table'],_0xd253ed[_0x4f49('0x79')][_0x594460]['parentKey'],_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x7b')],_0xd253ed[_0x4f49('0x79')][_0x594460]['foreignKey']));}}}if(_0xd253ed[_0x4f49('0x7f')]){_0xd253ed['conditions']=JSON[_0x4f49('0x7a')](_0xd253ed[_0x4f49('0x7f')]);_0xa880a2[_0x4f49('0x40')](_0x351a33(_0xd253ed['conditions'][_0x4f49('0x66')]));}_0x64f0ee=_0xa880a2[_0x4f49('0x8e')]();_0xa880a2[_0x4f49('0x1e')](_0x5c33c9);_0xa880a2['offset'](0x0);return;}})['then'](function(){if(_0x16cb4d[_0x4f49('0x8f')]==='web'){return null;}var _0x2bc9df=_[_0x4f49('0x43')](_0x16cb4d,{'name':_0x16cb4d[_0x4f49('0x90')]||_0x16cb4d['name']||_0xd253ed[_0x4f49('0x2c')],'basename':_0x289810,'savename':util['format'](_0x4f49('0x91'),_0x16cb4d[_0x4f49('0x2c')]||_0xd253ed[_0x4f49('0x2c')],require('randomstring')[_0x4f49('0x92')](0x4),_0x16cb4d[_0x4f49('0x8f')]||_0x4f49('0x93')),'reportId':_0xd253ed['id'],'reportType':_0x4f49('0x94')});return db[_0x4f49('0x95')][_0x4f49('0x4c')](_0x2bc9df,{'raw':!![]});})['then'](function(_0x5b6ac7){if(_0xd253ed[_0x4f49('0x70')]===_0x4f49('0x96')){_0x64f0ee[_0x4f49('0x40')](_0xd253ed[_0x4f49('0x70')]+_0x4f49('0x97'),_0x16cb4d[_0x4f49('0x98')],_0x16cb4d[_0x4f49('0x99')]);}else{_0x64f0ee[_0x4f49('0x40')](_0xd253ed[_0x4f49('0x70')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x16cb4d[_0x4f49('0x98')],_0x16cb4d[_0x4f49('0x99')]);}if(_0x5b6ac7){logger[_0x4f49('0x9a')]('Run\x20Query:',_0x64f0ee[_0x4f49('0x83')]());require(_0x4f49('0x9b'))[_0x4f49('0x9c')](path['join'](__dirname,_0x4f49('0x9d'),_0x5b6ac7[_0x4f49('0x8f')]),[_0x5b6ac7['id'],_0x64f0ee[_0x4f49('0x83')](),path['join'](__dirname,_0x4f49('0x9e'),_0x5b6ac7[_0x4f49('0x9f')]),_0x289810]);return _0x5b6ac7;}else{var _0x5efb11=squel['select']();_0x5efb11[_0x4f49('0x6f')]('('+_0x64f0ee[_0x4f49('0x83')]()+')',_0x4f49('0xa0'));_0x5efb11[_0x4f49('0x67')](_0x4f49('0xa1'),_0x4f49('0x20'));_0x64f0ee['limit'](_0x16cb4d['limit']||_0x5c33c9);_0x64f0ee['offset'](_0x16cb4d[_0x4f49('0x1d')]||0x0);return dbH[_0x4f49('0x82')]['query'](_0x5efb11[_0x4f49('0x83')](),{'type':dbH[_0x4f49('0x82')][_0x4f49('0x84')]['SELECT']})['then'](function(_0x3633b5){if(!_0x3633b5['length']){_0x3a26ff=0x0;}else{_0x3a26ff=_0x3633b5[0x0][_0x4f49('0x20')]||0x0;}return dbH[_0x4f49('0x82')][_0x4f49('0x36')](_0x64f0ee[_0x4f49('0x83')](),{'type':dbH[_0x4f49('0x82')]['QueryTypes'][_0x4f49('0xa2')]});})[_0x4f49('0x26')](function(_0x45c938){return{'rows':_0x45c938||[],'count':_0x3a26ff};});}});}exports[_0x4f49('0xa3')]=function(_0x4a4d75,_0x93e85d){return runReport(_0x4a4d75[_0x4f49('0x54')],_0x4a4d75['query'],_0x4a4d75[_0x4f49('0x45')])[_0x4f49('0x26')](respondWithResult(_0x93e85d,null))[_0x4f49('0x48')](handleError(_0x93e85d,null));};exports[_0x4f49('0xa4')]=runReport;exports[_0x4f49('0x36')]=function(_0x40991b,_0x56290f){var _0x4994b6=0xa;var _0x1c7d87=[_0x4f49('0x55'),_0x4f49('0x56'),_0x4f49('0x85'),_0x4f49('0x57')];var _0x5cd00a={'SUM':_0x4f49('0x86'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4f49('0x58'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x4f49('0x5b'),'GROUP_CONCAT':_0x4f49('0x5c'),'GROUP_CONCAT ASC':_0x4f49('0x87'),'GROUP_CONCAT DESC':_0x4f49('0x5d')};var _0xd876f1={'SEC_TO_TIME':_0x4f49('0x5e'),'DATE':_0x4f49('0x5f'),'HOUR':'HOUR(%s)','ROUND':_0x4f49('0x88'),'UNIX_TIMESTAMP':_0x4f49('0x61')};var _0x1ae2c9=function(_0x566634){return!_[_0x4f49('0x62')]([_0x4f49('0x89'),_0x4f49('0x63'),'IS\x20EMPTY',_0x4f49('0xa5')],_0x566634);};var _0x541dc2=function(_0x4061bf){if(!_0x4061bf||!_0x4061bf[_0x4f49('0x65')][_0x4f49('0x3c')]){return'';}for(var _0x1bc18d='(',_0x5e6103=0x0;_0x5e6103<_0x4061bf[_0x4f49('0x65')][_0x4f49('0x3c')];_0x5e6103+=0x1){_0x5e6103>0x0&&(_0x1bc18d+='\x20'+_0x4061bf[_0x4f49('0x8a')]+'\x20');_0x1bc18d+=_0x4061bf[_0x4f49('0x65')][_0x5e6103][_0x4f49('0x66')]?_0x541dc2(_0x4061bf[_0x4f49('0x65')][_0x5e6103][_0x4f49('0x66')]):_0x4061bf[_0x4f49('0x65')][_0x5e6103]['field']+'\x20'+_0x4061bf['rules'][_0x5e6103][_0x4f49('0x8b')]+(_0x1ae2c9(_0x4061bf[_0x4f49('0x65')][_0x5e6103][_0x4f49('0x8b')])?'\x20'+_0x4061bf[_0x4f49('0x65')][_0x5e6103][_0x4f49('0x68')]:'');}return _0x1bc18d+')';};var _0x29dbab={'where':{'id':_0x40991b[_0x4f49('0x54')]['id']}},_0x5f459b,_0x1d090f,_0x37d2f4,_0x5bcb36,_0x3f04fa;_0x29dbab=_[_0x4f49('0x43')]({},_0x29dbab,_0x40991b['options']);return db['AnalyticDefaultReport'][_0x4f49('0x4b')](_0x29dbab)[_0x4f49('0x26')](function(_0x200848){if(_0x200848){_0x5f459b=_0x200848;return _0x200848['getFields']();}return null;})[_0x4f49('0x26')](function(_0x48f4bc){if(_0x48f4bc){if(!_0x48f4bc[_0x4f49('0x3c')]){throw new db['Sequelize'][(_0x4f49('0x6a'))](_0x4f49('0x6b'),0x193);}_0x1d090f=_0x48f4bc;return db['AnalyticMetric'][_0x4f49('0x47')]({'raw':!![]});}return null;})[_0x4f49('0x26')](function(_0x513bc9){if(_0x513bc9){_0x37d2f4=_[_0x4f49('0x6d')](_0x513bc9,'id');var _0x47567c;var _0x5f1538=squel[_0x4f49('0x6e')]();_0x5f1538[_0x4f49('0x6f')](_0x5f459b[_0x4f49('0x70')]);for(var _0xd91e48=0x0;_0xd91e48<_0x1d090f[_0x4f49('0x3c')];_0xd91e48+=0x1){_0x47567c=_0x1d090f[_0xd91e48][_0x4f49('0x71')]?_0x37d2f4[_0x1d090f[_0xd91e48]['MetricId']][_0x4f49('0x72')]:_0x1d090f[_0xd91e48][_0x4f49('0x67')];_0x47567c=_0x1d090f[_0xd91e48][_0x4f49('0x73')]?_['replace'](_0x5cd00a[_0x1d090f[_0xd91e48][_0x4f49('0x73')]],'%s',_0x47567c):_0x47567c;_0x47567c=_0x1d090f[_0xd91e48][_0x4f49('0x75')]?_[_0x4f49('0x74')](_0xd876f1[_0x1d090f[_0xd91e48][_0x4f49('0x75')]],'%s',_0x47567c):_0x47567c;if(_0x1d090f[_0xd91e48][_0x4f49('0x8d')]){_0x5f1538[_0x4f49('0x66')](_0x47567c);}_0x1d090f[_0xd91e48][_0x4f49('0x76')]&&_0x5f1538['order'](_0x47567c,_0x1d090f[_0xd91e48][_0x4f49('0x76')]==='DESC'?![]:!![]);_0x5f1538['field'](_0x47567c,_0x1d090f[_0xd91e48][_0x4f49('0x78')]||_0x47567c);}if(_0x5f459b['joins']){_0x5f459b[_0x4f49('0x79')]=JSON[_0x4f49('0x7a')](_0x5f459b[_0x4f49('0x79')]);for(var _0x85eb3f=0x0;_0x85eb3f<_0x5f459b[_0x4f49('0x79')][_0x4f49('0x3c')];_0x85eb3f+=0x1){if(_0x5f459b['joins'][_0x85eb3f][_0x4f49('0x33')]&&_[_0x4f49('0x62')](_0x1c7d87,_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x33')])&&_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7d')]&&_0x5f459b[_0x4f49('0x79')][_0x85eb3f]['foreignTable']&&_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7e')]){_0x5f1538[_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x33')]](_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7b')],null,util[_0x4f49('0x75')](_0x4f49('0x7c'),_0x5f459b[_0x4f49('0x70')],_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7d')],_0x5f459b[_0x4f49('0x79')][_0x85eb3f]['foreignTable'],_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7e')]));}}}if(_0x5f459b['conditions']){_0x5f459b[_0x4f49('0x7f')]=JSON[_0x4f49('0x7a')](_0x5f459b[_0x4f49('0x7f')]);_0x5f1538[_0x4f49('0x40')](_0x541dc2(_0x5f459b[_0x4f49('0x7f')][_0x4f49('0x66')]));}_0x3f04fa=_0x5f1538['clone']();_0x5f1538['limit'](_0x4994b6);_0x5f1538['offset'](0x0);logger['debug'](_0x4f49('0x81'),_0x5f1538['toString']());return dbH[_0x4f49('0x82')][_0x4f49('0x36')](_0x5f1538[_0x4f49('0x83')](),{'type':dbH[_0x4f49('0x82')][_0x4f49('0x84')][_0x4f49('0xa2')]});}})['then'](function(){return{'sql':_0x3f04fa[_0x4f49('0x83')]()};})['then'](respondWithResult(_0x56290f,null))[_0x4f49('0x48')](handleError(_0x56290f,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 8c16589..8d93638 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 _0x3abf=['request-promise','path','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','util','api','moment','bluebird'];(function(_0x2be9a5,_0x1363e5){var _0x3b07a4=function(_0x58b56b){while(--_0x58b56b){_0x2be9a5['push'](_0x2be9a5['shift']());}};_0x3b07a4(++_0x1363e5);}(_0x3abf,0x15c));var _0xf3ab=function(_0x217838,_0x43466a){_0x217838=_0x217838-0x0;var _0x4ae0fd=_0x3abf[_0x217838];return _0x4ae0fd;};'use strict';var _=require('lodash');var util=require(_0xf3ab('0x0'));var logger=require('../../config/logger')(_0xf3ab('0x1'));var moment=require(_0xf3ab('0x2'));var BPromise=require(_0xf3ab('0x3'));var rp=require(_0xf3ab('0x4'));var fs=require('fs');var path=require(_0xf3ab('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf3ab('0x6'));module[_0xf3ab('0x7')]=function(_0x110652,_0x21eb54){return _0x110652[_0xf3ab('0x8')](_0xf3ab('0x9'),attributes,{'tableName':_0xf3ab('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ddf=['./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8ddf,0xa1));var _0xf8dd=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0x8ddf[_0x387777];return _0x3f84c0;};'use strict';var _=require(_0xf8dd('0x0'));var util=require('util');var logger=require(_0xf8dd('0x1'))('api');var moment=require(_0xf8dd('0x2'));var BPromise=require(_0xf8dd('0x3'));var rp=require(_0xf8dd('0x4'));var fs=require('fs');var path=require(_0xf8dd('0x5'));var rimraf=require(_0xf8dd('0x6'));var config=require(_0xf8dd('0x7'));var attributes=require(_0xf8dd('0x8'));module[_0xf8dd('0x9')]=function(_0x5ed349,_0x442677){return _0x5ed349[_0xf8dd('0xa')](_0xf8dd('0xb'),attributes,{'tableName':_0xf8dd('0xc'),'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 cd87234..e2a56cf 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 _0xb210=['../../config/logger','../../config/environment','jayson/promise','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code','message','result','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1f641b,_0x2f15a1){var _0x2fb99b=function(_0x2f1ab2){while(--_0x2f1ab2){_0x1f641b['push'](_0x1f641b['shift']());}};_0x2fb99b(++_0x2f15a1);}(_0xb210,0x19d));var _0x0b21=function(_0x2a8d9d,_0x11e582){_0x2a8d9d=_0x2a8d9d-0x0;var _0x451659=_0xb210[_0x2a8d9d];return _0x451659;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x0b21('0x0'));var rs=require(_0x0b21('0x1'));var fs=require('fs');var Redis=require(_0x0b21('0x2'));var db=require(_0x0b21('0x3'))['db'];var utils=require(_0x0b21('0x4'));var logger=require(_0x0b21('0x5'))('rpc');var config=require(_0x0b21('0x6'));var jayson=require(_0x0b21('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x29a25f,_0xdab92b,_0x295d47){return new BPromise(function(_0x4864ed,_0x5f4565){return client[_0x0b21('0x8')](_0x29a25f,_0x295d47)[_0x0b21('0x9')](function(_0x15f639){logger[_0x0b21('0xa')](_0x0b21('0xb'),_0xdab92b,_0x0b21('0xc'));logger[_0x0b21('0xd')](_0x0b21('0xe'),_0xdab92b,'request\x20sent',JSON['stringify'](_0x15f639));if(_0x15f639[_0x0b21('0xf')]){if(_0x15f639['error'][_0x0b21('0x10')]===0x1f4){logger[_0x0b21('0xf')](_0x0b21('0xb'),_0xdab92b,_0x15f639['error'][_0x0b21('0x11')]);return _0x5f4565(_0x15f639['error'][_0x0b21('0x11')]);}logger[_0x0b21('0xf')](_0x0b21('0xb'),_0xdab92b,_0x15f639[_0x0b21('0xf')][_0x0b21('0x11')]);return _0x4864ed(_0x15f639['error']['message']);}else{logger['info'](_0x0b21('0xb'),_0xdab92b,_0x0b21('0xc'));_0x4864ed(_0x15f639[_0x0b21('0x12')][_0x0b21('0x11')]);}})['catch'](function(_0x5cc436){logger[_0x0b21('0xf')](_0x0b21('0xb'),_0xdab92b,_0x5cc436);_0x5f4565(_0x5cc436);});});} \ No newline at end of file +var _0x7d25=['stringify','error','AnalyticDefaultReport,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s'];(function(_0x378222,_0x23ee64){var _0x4dc43f=function(_0xa074ac){while(--_0xa074ac){_0x378222['push'](_0x378222['shift']());}};_0x4dc43f(++_0x23ee64);}(_0x7d25,0x10d));var _0x57d2=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0x7d25[_0x2080a3];return _0x8d7d17;};'use strict';var _=require(_0x57d2('0x0'));var util=require(_0x57d2('0x1'));var moment=require(_0x57d2('0x2'));var BPromise=require(_0x57d2('0x3'));var rs=require(_0x57d2('0x4'));var fs=require('fs');var Redis=require(_0x57d2('0x5'));var db=require(_0x57d2('0x6'))['db'];var utils=require(_0x57d2('0x7'));var logger=require('../../config/logger')(_0x57d2('0x8'));var config=require(_0x57d2('0x9'));var jayson=require(_0x57d2('0xa'));var client=jayson[_0x57d2('0xb')][_0x57d2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x32b1ce,_0x4ed5aa,_0x2baef3){return new BPromise(function(_0x4f82f2,_0x5d1b72){return client[_0x57d2('0xd')](_0x32b1ce,_0x2baef3)[_0x57d2('0xe')](function(_0x16bd33){logger[_0x57d2('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4ed5aa,_0x57d2('0x10'));logger[_0x57d2('0x11')](_0x57d2('0x12'),_0x4ed5aa,'request\x20sent',JSON[_0x57d2('0x13')](_0x16bd33));if(_0x16bd33['error']){if(_0x16bd33[_0x57d2('0x14')]['code']===0x1f4){logger['error'](_0x57d2('0x15'),_0x4ed5aa,_0x16bd33['error'][_0x57d2('0x16')]);return _0x5d1b72(_0x16bd33[_0x57d2('0x14')][_0x57d2('0x16')]);}logger[_0x57d2('0x14')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4ed5aa,_0x16bd33[_0x57d2('0x14')][_0x57d2('0x16')]);return _0x4f82f2(_0x16bd33[_0x57d2('0x14')]['message']);}else{logger['info'](_0x57d2('0x15'),_0x4ed5aa,_0x57d2('0x10'));_0x4f82f2(_0x16bd33['result'][_0x57d2('0x16')]);}})[_0x57d2('0x17')](function(_0x156800){logger['error'](_0x57d2('0x15'),_0x4ed5aa,_0x156800);_0x5d1b72(_0x156800);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 657f98f..47c83ee 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 _0xaa65=['get','/:id','show','/:id/preview','preview','/:id/run','/:id/query','query','post','create','update','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','isAuthenticated','index'];(function(_0x141993,_0x5cd8c2){var _0x55203a=function(_0x1797cd){while(--_0x1797cd){_0x141993['push'](_0x141993['shift']());}};_0x55203a(++_0x5cd8c2);}(_0xaa65,0x108));var _0x5aa6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xaa65[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x5aa6('0x0'));var util=require(_0x5aa6('0x1'));var path=require(_0x5aa6('0x2'));var timeout=require(_0x5aa6('0x3'));var express=require('express');var router=express[_0x5aa6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5aa6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5aa6('0x6'));var controller=require('./analyticDefaultReport.controller');router['get']('/',auth[_0x5aa6('0x7')](),controller[_0x5aa6('0x8')]);router[_0x5aa6('0x9')](_0x5aa6('0xa'),auth[_0x5aa6('0x7')](),controller[_0x5aa6('0xb')]);router[_0x5aa6('0x9')](_0x5aa6('0xc'),auth[_0x5aa6('0x7')](),controller[_0x5aa6('0xd')]);router[_0x5aa6('0x9')](_0x5aa6('0xe'),auth[_0x5aa6('0x7')](),controller['run']);router['get'](_0x5aa6('0xf'),auth[_0x5aa6('0x7')](),controller[_0x5aa6('0x10')]);router[_0x5aa6('0x11')]('/',auth[_0x5aa6('0x7')](),controller[_0x5aa6('0x12')]);router['put'](_0x5aa6('0xa'),auth[_0x5aa6('0x7')](),controller[_0x5aa6('0x13')]);router['delete'](_0x5aa6('0xa'),auth[_0x5aa6('0x7')](),controller['destroy']);module[_0x5aa6('0x14')]=router; \ No newline at end of file +var _0xa7be=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/preview','/:id/run','run','/:id/query','post','create','put','update','delete','destroy'];(function(_0x2b743c,_0x315030){var _0x41de89=function(_0xc11f6a){while(--_0xc11f6a){_0x2b743c['push'](_0x2b743c['shift']());}};_0x41de89(++_0x315030);}(_0xa7be,0xfd));var _0xea7b=function(_0x5d58c8,_0x4eab3c){_0x5d58c8=_0x5d58c8-0x0;var _0xfbbd9c=_0xa7be[_0x5d58c8];return _0xfbbd9c;};'use strict';var multer=require(_0xea7b('0x0'));var util=require(_0xea7b('0x1'));var path=require(_0xea7b('0x2'));var timeout=require(_0xea7b('0x3'));var express=require(_0xea7b('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xea7b('0x5'));var interaction=require(_0xea7b('0x6'));var config=require(_0xea7b('0x7'));var controller=require('./analyticDefaultReport.controller');router[_0xea7b('0x8')]('/',auth[_0xea7b('0x9')](),controller[_0xea7b('0xa')]);router[_0xea7b('0x8')](_0xea7b('0xb'),auth[_0xea7b('0x9')](),controller[_0xea7b('0xc')]);router[_0xea7b('0x8')](_0xea7b('0xd'),auth[_0xea7b('0x9')](),controller['preview']);router[_0xea7b('0x8')](_0xea7b('0xe'),auth[_0xea7b('0x9')](),controller[_0xea7b('0xf')]);router['get'](_0xea7b('0x10'),auth[_0xea7b('0x9')](),controller['query']);router[_0xea7b('0x11')]('/',auth[_0xea7b('0x9')](),controller[_0xea7b('0x12')]);router[_0xea7b('0x13')](_0xea7b('0xb'),auth[_0xea7b('0x9')](),controller[_0xea7b('0x14')]);router[_0xea7b('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xea7b('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 3a0e9b4..1d0143e 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 _0xcb6b=['csv','DATE','scheduled','manual','UNSIGNED','sequelize','moment','exports','STRING','pdf'];(function(_0x243d54,_0x116cc8){var _0x18bb09=function(_0x3cde25){while(--_0x3cde25){_0x243d54['push'](_0x243d54['shift']());}};_0x18bb09(++_0x116cc8);}(_0xcb6b,0x11d));var _0xbcb6=function(_0x2e20f4,_0x410781){_0x2e20f4=_0x2e20f4-0x0;var _0x2d98f1=_0xcb6b[_0x2e20f4];return _0x2d98f1;};'use strict';var Sequelize=require(_0xbcb6('0x0'));var moment=require(_0xbcb6('0x1'));module[_0xbcb6('0x2')]={'name':{'type':Sequelize[_0xbcb6('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0xbcb6('0x3')],'allowNull':![]},'output':{'type':Sequelize['ENUM']('csv',_0xbcb6('0x4'),'xlsx'),'allowNull':![],'defaultValue':_0xbcb6('0x5')},'savename':{'type':Sequelize[_0xbcb6('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0xbcb6('0x6')]},'endDate':{'type':Sequelize[_0xbcb6('0x6')]},'status':{'type':Sequelize['STRING'],'defaultValue':'Loading'},'type':{'type':Sequelize['ENUM']('manual',_0xbcb6('0x7')),'allowNull':![],'defaultValue':_0xbcb6('0x8')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0xbcb6('0x9')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7224=['UNSIGNED','sequelize','exports','STRING','ENUM','csv','pdf','xlsx','DATE','scheduled','manual','INTEGER'];(function(_0x130705,_0x2d266b){var _0x1fa991=function(_0x395639){while(--_0x395639){_0x130705['push'](_0x130705['shift']());}};_0x1fa991(++_0x2d266b);}(_0x7224,0xa9));var _0x4722=function(_0x4b5dbf,_0x286263){_0x4b5dbf=_0x4b5dbf-0x0;var _0x1a202d=_0x7224[_0x4b5dbf];return _0x1a202d;};'use strict';var Sequelize=require(_0x4722('0x0'));var moment=require('moment');module[_0x4722('0x1')]={'name':{'type':Sequelize[_0x4722('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x4722('0x3')](_0x4722('0x4'),_0x4722('0x5'),_0x4722('0x6')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x4722('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x4722('0x7')]},'endDate':{'type':Sequelize[_0x4722('0x7')]},'status':{'type':Sequelize['STRING'],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x4722('0x3')]('manual',_0x4722('0x8')),'allowNull':![],'defaultValue':_0x4722('0x9')},'reportId':{'type':Sequelize[_0x4722('0xa')](0xb)[_0x4722('0xb')]},'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 2496332..8309630 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 _0x72da=['end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','get','ExtractedReports','error','stack','name','send','index','map','rawAttributes','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','AnalyticExtractedReport','includeAll','findAll','rows','catch','show','params','keys','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','exists','%s.%s','toLowerCase','eml-format','rimraf','fast-json-patch','request-promise','moment','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','../../mysqldb','sendStatus','status'];(function(_0x3e9c60,_0x4582ae){var _0x569f61=function(_0x43db1a){while(--_0x43db1a){_0x3e9c60['push'](_0x3e9c60['shift']());}};_0x569f61(++_0x4582ae);}(_0x72da,0x15d));var _0xa72d=function(_0x4d8764,_0xd13d7b){_0x4d8764=_0x4d8764-0x0;var _0x4e0b49=_0x72da[_0x4d8764];return _0x4e0b49;};'use strict';var emlformat=require(_0xa72d('0x0'));var rimraf=require(_0xa72d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa72d('0x2'));var rp=require(_0xa72d('0x3'));var moment=require(_0xa72d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa72d('0x5'));var util=require(_0xa72d('0x6'));var path=require(_0xa72d('0x7'));var sox=require(_0xa72d('0x8'));var csv=require(_0xa72d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa72d('0xa'));var _=require(_0xa72d('0xb'));var squel=require(_0xa72d('0xc'));var crypto=require(_0xa72d('0xd'));var jsforce=require(_0xa72d('0xe'));var deskjs=require(_0xa72d('0xf'));var toCsv=require(_0xa72d('0x9'));var querystring=require('querystring');var Papa=require(_0xa72d('0x10'));var Redis=require(_0xa72d('0x11'));var authService=require(_0xa72d('0x12'));var qs=require(_0xa72d('0x13'));var as=require(_0xa72d('0x14'));var hardwareService=require(_0xa72d('0x15'));var logger=require(_0xa72d('0x16'))(_0xa72d('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa72d('0x18'))['db'];function respondWithStatusCode(_0x1f7ef7,_0x2b4d73){_0x2b4d73=_0x2b4d73||0xcc;return function(_0xf6cff2){if(_0xf6cff2){return _0x1f7ef7[_0xa72d('0x19')](_0x2b4d73);}return _0x1f7ef7[_0xa72d('0x1a')](_0x2b4d73)[_0xa72d('0x1b')]();};}function respondWithResult(_0x33b831,_0x58c626){_0x58c626=_0x58c626||0xc8;return function(_0x346bcf){if(_0x346bcf){return _0x33b831[_0xa72d('0x1a')](_0x58c626)[_0xa72d('0x1c')](_0x346bcf);}};}function respondWithFilteredResult(_0x5d7ada,_0x51e847){return function(_0x260210){if(_0x260210){var _0x3b2647=typeof _0x51e847[_0xa72d('0x1d')]===_0xa72d('0x1e')&&typeof _0x51e847[_0xa72d('0x1f')]===_0xa72d('0x1e');var _0x49dfbb=_0x260210[_0xa72d('0x20')];var _0x5a496c=_0x3b2647?0x0:_0x51e847['offset'];var _0x3714ba=_0x3b2647?_0x260210['count']:_0x51e847[_0xa72d('0x1d')]+_0x51e847['limit'];var _0x5b20cd;if(_0x3714ba>=_0x49dfbb){_0x3714ba=_0x49dfbb;_0x5b20cd=0xc8;}else{_0x5b20cd=0xce;}_0x5d7ada[_0xa72d('0x1a')](_0x5b20cd);return _0x5d7ada[_0xa72d('0x21')](_0xa72d('0x22'),_0x5a496c+'-'+_0x3714ba+'/'+_0x49dfbb)[_0xa72d('0x1c')](_0x260210);}return null;};}function patchUpdates(_0x5d074e){return function(_0x3c9913){try{jsonpatch['apply'](_0x3c9913,_0x5d074e,!![]);}catch(_0x5296b0){return BPromise['reject'](_0x5296b0);}return _0x3c9913['save']();};}function saveUpdates(_0x5058c6,_0x504b8d){return function(_0x2d9557){if(_0x2d9557){return _0x2d9557['update'](_0x5058c6)[_0xa72d('0x23')](function(_0xb01880){return _0xb01880;});}return null;};}function removeEntity(_0x4a67f2,_0x364b9c){return function(_0x5b2daa){if(_0x5b2daa){return _0x5b2daa[_0xa72d('0x24')]()[_0xa72d('0x23')](function(){var _0x231d8=_0x5b2daa[_0xa72d('0x25')]({'plain':!![]});var _0x4e945b=_0xa72d('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x4e945b,'resourceId':_0x231d8['id']}})['then'](function(){return _0x5b2daa;});})[_0xa72d('0x23')](function(){_0x4a67f2[_0xa72d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cb1a4,_0x49d49b){return function(_0x1d2407){if(!_0x1d2407){_0x4cb1a4[_0xa72d('0x19')](0x194);}return _0x1d2407;};}function handleError(_0x593f4c,_0x39664b){_0x39664b=_0x39664b||0x1f4;return function(_0x1114d6){logger[_0xa72d('0x27')](_0x1114d6[_0xa72d('0x28')]);if(_0x1114d6[_0xa72d('0x29')]){delete _0x1114d6[_0xa72d('0x29')];}_0x593f4c[_0xa72d('0x1a')](_0x39664b)[_0xa72d('0x2a')](_0x1114d6);};}exports[_0xa72d('0x2b')]=function(_0x33b12e,_0x1e21ab){var _0x40e262={},_0x4900f6={},_0x63e634={'count':0x0,'rows':[]};var _0x52220a=_[_0xa72d('0x2c')](db['AnalyticExtractedReport'][_0xa72d('0x2d')],function(_0x354d31){return{'name':_0x354d31['fieldName'],'type':_0x354d31['type'][_0xa72d('0x2e')]};});_0x4900f6[_0xa72d('0x2f')]=_[_0xa72d('0x2c')](_0x52220a,_0xa72d('0x29'));_0x4900f6['query']=_['keys'](_0x33b12e[_0xa72d('0x30')]);_0x4900f6['filters']=_[_0xa72d('0x31')](_0x4900f6[_0xa72d('0x2f')],_0x4900f6[_0xa72d('0x30')]);_0x40e262[_0xa72d('0x32')]=_['intersection'](_0x4900f6[_0xa72d('0x2f')],qs[_0xa72d('0x33')](_0x33b12e[_0xa72d('0x30')]['fields']));_0x40e262['attributes']=_0x40e262[_0xa72d('0x32')][_0xa72d('0x34')]?_0x40e262[_0xa72d('0x32')]:_0x4900f6[_0xa72d('0x2f')];if(!_0x33b12e[_0xa72d('0x30')][_0xa72d('0x35')]('nolimit')){_0x40e262[_0xa72d('0x1f')]=qs[_0xa72d('0x1f')](_0x33b12e[_0xa72d('0x30')][_0xa72d('0x1f')]);_0x40e262['offset']=qs['offset'](_0x33b12e[_0xa72d('0x30')]['offset']);}_0x40e262[_0xa72d('0x36')]=qs[_0xa72d('0x37')](_0x33b12e[_0xa72d('0x30')]['sort']);_0x40e262[_0xa72d('0x38')]=qs[_0xa72d('0x39')](_[_0xa72d('0x3a')](_0x33b12e[_0xa72d('0x30')],_0x4900f6[_0xa72d('0x39')]),_0x52220a);if(_0x33b12e['query'][_0xa72d('0x3b')]){_0x40e262[_0xa72d('0x38')]=_['merge'](_0x40e262[_0xa72d('0x38')],{'$or':_[_0xa72d('0x2c')](_0x52220a,function(_0x2ffe16){if(_0x2ffe16[_0xa72d('0x3c')]!==_0xa72d('0x3d')){var _0x2b4a7b={};_0x2b4a7b[_0x2ffe16[_0xa72d('0x29')]]={'$like':'%'+_0x33b12e[_0xa72d('0x30')][_0xa72d('0x3b')]+'%'};return _0x2b4a7b;}})});}_0x40e262=_[_0xa72d('0x3e')]({},_0x40e262,_0x33b12e[_0xa72d('0x3f')]);var _0x3eebe0={'where':_0x40e262[_0xa72d('0x38')]};return db[_0xa72d('0x40')][_0xa72d('0x20')](_0x3eebe0)[_0xa72d('0x23')](function(_0x4b65e0){_0x63e634[_0xa72d('0x20')]=_0x4b65e0;if(_0x33b12e['query'][_0xa72d('0x41')]){_0x40e262['include']=[{'all':!![]}];}return db[_0xa72d('0x40')][_0xa72d('0x42')](_0x40e262);})[_0xa72d('0x23')](function(_0x4f814d){_0x63e634[_0xa72d('0x43')]=_0x4f814d;return _0x63e634;})[_0xa72d('0x23')](respondWithFilteredResult(_0x1e21ab,_0x40e262))[_0xa72d('0x44')](handleError(_0x1e21ab,null));};exports[_0xa72d('0x45')]=function(_0x588cc9,_0x3aa15c){var _0x45d1ba={'raw':!![],'where':{'id':_0x588cc9[_0xa72d('0x46')]['id']}},_0x4ac6ab={};_0x4ac6ab[_0xa72d('0x2f')]=_[_0xa72d('0x47')](db[_0xa72d('0x40')][_0xa72d('0x2d')]);_0x4ac6ab[_0xa72d('0x30')]=_[_0xa72d('0x47')](_0x588cc9['query']);_0x4ac6ab['filters']=_[_0xa72d('0x31')](_0x4ac6ab[_0xa72d('0x2f')],_0x4ac6ab['query']);_0x45d1ba[_0xa72d('0x32')]=_[_0xa72d('0x31')](_0x4ac6ab['model'],qs[_0xa72d('0x33')](_0x588cc9['query']['fields']));_0x45d1ba[_0xa72d('0x32')]=_0x45d1ba[_0xa72d('0x32')]['length']?_0x45d1ba[_0xa72d('0x32')]:_0x4ac6ab[_0xa72d('0x2f')];if(_0x588cc9['query'][_0xa72d('0x41')]){_0x45d1ba[_0xa72d('0x48')]=[{'all':!![]}];}_0x45d1ba=_[_0xa72d('0x3e')]({},_0x45d1ba,_0x588cc9[_0xa72d('0x3f')]);return db[_0xa72d('0x40')]['find'](_0x45d1ba)[_0xa72d('0x23')](handleEntityNotFound(_0x3aa15c,null))['then'](respondWithResult(_0x3aa15c,null))[_0xa72d('0x44')](handleError(_0x3aa15c,null));};exports[_0xa72d('0x49')]=function(_0x1b8506,_0x25b082){return db[_0xa72d('0x40')][_0xa72d('0x49')](_0x1b8506[_0xa72d('0x4a')],{})['then'](function(_0x5044d4){var _0x2a9b21=_0x1b8506['user']['get']({'plain':!![]});if(!_0x2a9b21)throw new Error(_0xa72d('0x4b'));if(_0x2a9b21[_0xa72d('0x4c')]==='user'){var _0x4c711e=_0x5044d4[_0xa72d('0x25')]({'plain':!![]});var _0x30269e=_0xa72d('0x26');return db[_0xa72d('0x4d')][_0xa72d('0x4e')]({'where':{'name':_0x30269e,'userProfileId':_0x2a9b21[_0xa72d('0x4f')]},'raw':!![]})[_0xa72d('0x23')](function(_0x593f1e){if(_0x593f1e&&_0x593f1e['autoAssociation']===0x0){return db['UserProfileResource'][_0xa72d('0x49')]({'name':_0x4c711e[_0xa72d('0x29')],'resourceId':_0x4c711e['id'],'type':_0x593f1e['name'],'sectionId':_0x593f1e['id']},{})[_0xa72d('0x23')](function(){return _0x5044d4;});}else{return _0x5044d4;}})[_0xa72d('0x44')](function(_0x528ac7){logger[_0xa72d('0x27')](_0xa72d('0x50'),_0x528ac7);throw _0x528ac7;});}return _0x5044d4;})[_0xa72d('0x23')](respondWithResult(_0x25b082,0xc9))['catch'](handleError(_0x25b082,null));};exports['update']=function(_0x20633c,_0x24f6a1){if(_0x20633c[_0xa72d('0x4a')]['id']){delete _0x20633c[_0xa72d('0x4a')]['id'];}return db[_0xa72d('0x40')][_0xa72d('0x4e')]({'where':{'id':_0x20633c['params']['id']}})[_0xa72d('0x23')](handleEntityNotFound(_0x24f6a1,null))[_0xa72d('0x23')](saveUpdates(_0x20633c[_0xa72d('0x4a')],null))[_0xa72d('0x23')](respondWithResult(_0x24f6a1,null))['catch'](handleError(_0x24f6a1,null));};exports[_0xa72d('0x24')]=function(_0x1b5ca4,_0x3aadfe){return db[_0xa72d('0x40')][_0xa72d('0x4e')]({'where':{'id':_0x1b5ca4[_0xa72d('0x46')]['id']}})[_0xa72d('0x23')](handleEntityNotFound(_0x3aadfe,null))['then'](removeEntity(_0x3aadfe,null))[_0xa72d('0x44')](handleError(_0x3aadfe,null));};exports[_0xa72d('0x51')]=function(_0x11ec12,_0x452e71,_0x36fc6b){return db[_0xa72d('0x40')][_0xa72d('0x4e')]({'where':{'id':_0x11ec12[_0xa72d('0x46')]['id']},'attributes':[_0xa72d('0x29'),_0xa72d('0x52'),_0xa72d('0x53'),_0xa72d('0x54')],'raw':!![]})[_0xa72d('0x23')](handleEntityNotFound(_0x452e71,null))[_0xa72d('0x23')](function(_0x56f11e){if(_0x56f11e){if(!fs[_0xa72d('0x55')](path[_0xa72d('0x56')](config[_0xa72d('0x57')],_0xa72d('0x58'),_0x56f11e[_0xa72d('0x53')]))){throw new db[(_0xa72d('0x59'))][(_0xa72d('0x5a'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x11ec12[_0xa72d('0x30')][_0xa72d('0x5b')]){return _0x452e71['sendStatus'](0xc8);}return _0x452e71['download'](path[_0xa72d('0x56')](config[_0xa72d('0x57')],_0xa72d('0x58'),_0x56f11e['savename']),util['format'](_0xa72d('0x5c'),_0x56f11e[_0xa72d('0x52')]||_0x56f11e[_0xa72d('0x29')],_0x56f11e[_0xa72d('0x54')][_0xa72d('0x5d')]()));}})[_0xa72d('0x44')](handleError(_0x452e71,null));}; \ No newline at end of file +var _0x2854=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','json','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','includeAll','include','AnalyticExtractedReport','findAll','catch','show','keys','find','create','user','role','ExtractedReports','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','basename','savename','output','join','root','server/files/reports','Sequelize','exists','download','format','toLowerCase','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','ioredis'];(function(_0x546ac5,_0x59e59b){var _0x56a6d8=function(_0x2aff07){while(--_0x2aff07){_0x546ac5['push'](_0x546ac5['shift']());}};_0x56a6d8(++_0x59e59b);}(_0x2854,0xaf));var _0x4285=function(_0x45d70e,_0x189ca1){_0x45d70e=_0x45d70e-0x0;var _0x13de9a=_0x2854[_0x45d70e];return _0x13de9a;};'use strict';var emlformat=require(_0x4285('0x0'));var rimraf=require(_0x4285('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4285('0x2'));var rp=require('request-promise');var moment=require(_0x4285('0x3'));var BPromise=require(_0x4285('0x4'));var Mustache=require('mustache');var util=require(_0x4285('0x5'));var path=require(_0x4285('0x6'));var sox=require(_0x4285('0x7'));var csv=require(_0x4285('0x8'));var ejs=require(_0x4285('0x9'));var fs=require('fs');var fs_extra=require(_0x4285('0xa'));var _=require('lodash');var squel=require(_0x4285('0xb'));var crypto=require('crypto');var jsforce=require(_0x4285('0xc'));var deskjs=require(_0x4285('0xd'));var toCsv=require(_0x4285('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4285('0xe'));var authService=require(_0x4285('0xf'));var qs=require(_0x4285('0x10'));var as=require(_0x4285('0x11'));var hardwareService=require(_0x4285('0x12'));var logger=require(_0x4285('0x13'))(_0x4285('0x14'));var utils=require(_0x4285('0x15'));var config=require(_0x4285('0x16'));var licenseUtil=require(_0x4285('0x17'));var db=require(_0x4285('0x18'))['db'];function respondWithStatusCode(_0x34531c,_0x4de38d){_0x4de38d=_0x4de38d||0xcc;return function(_0x3fc8eb){if(_0x3fc8eb){return _0x34531c[_0x4285('0x19')](_0x4de38d);}return _0x34531c[_0x4285('0x1a')](_0x4de38d)[_0x4285('0x1b')]();};}function respondWithResult(_0xd4dab3,_0x2083c4){_0x2083c4=_0x2083c4||0xc8;return function(_0x33422d){if(_0x33422d){return _0xd4dab3[_0x4285('0x1a')](_0x2083c4)['json'](_0x33422d);}};}function respondWithFilteredResult(_0x3b2c07,_0x432af9){return function(_0x89c146){if(_0x89c146){var _0x1b142f=typeof _0x432af9[_0x4285('0x1c')]===_0x4285('0x1d')&&typeof _0x432af9[_0x4285('0x1e')]===_0x4285('0x1d');var _0x126c22=_0x89c146[_0x4285('0x1f')];var _0x1ca928=_0x1b142f?0x0:_0x432af9['offset'];var _0x19e42f=_0x1b142f?_0x89c146[_0x4285('0x1f')]:_0x432af9['offset']+_0x432af9[_0x4285('0x1e')];var _0x1a4b1e;if(_0x19e42f>=_0x126c22){_0x19e42f=_0x126c22;_0x1a4b1e=0xc8;}else{_0x1a4b1e=0xce;}_0x3b2c07[_0x4285('0x1a')](_0x1a4b1e);return _0x3b2c07['set']('Content-Range',_0x1ca928+'-'+_0x19e42f+'/'+_0x126c22)[_0x4285('0x20')](_0x89c146);}return null;};}function patchUpdates(_0x1296e9){return function(_0x3ec038){try{jsonpatch[_0x4285('0x21')](_0x3ec038,_0x1296e9,!![]);}catch(_0x335958){return BPromise[_0x4285('0x22')](_0x335958);}return _0x3ec038[_0x4285('0x23')]();};}function saveUpdates(_0x2aaa4e,_0x4b426e){return function(_0x30ff1d){if(_0x30ff1d){return _0x30ff1d['update'](_0x2aaa4e)[_0x4285('0x24')](function(_0x33599e){return _0x33599e;});}return null;};}function removeEntity(_0x942ed1,_0x501da9){return function(_0x171bc2){if(_0x171bc2){return _0x171bc2[_0x4285('0x25')]()['then'](function(){var _0x5b76de=_0x171bc2[_0x4285('0x26')]({'plain':!![]});var _0x22fce2='ExtractedReports';return db[_0x4285('0x27')][_0x4285('0x25')]({'where':{'type':_0x22fce2,'resourceId':_0x5b76de['id']}})[_0x4285('0x24')](function(){return _0x171bc2;});})[_0x4285('0x24')](function(){_0x942ed1[_0x4285('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x427446,_0x1ea1d1){return function(_0x284a08){if(!_0x284a08){_0x427446[_0x4285('0x19')](0x194);}return _0x284a08;};}function handleError(_0x17c99b,_0xbdfa0b){_0xbdfa0b=_0xbdfa0b||0x1f4;return function(_0x1822c9){logger[_0x4285('0x28')](_0x1822c9[_0x4285('0x29')]);if(_0x1822c9[_0x4285('0x2a')]){delete _0x1822c9[_0x4285('0x2a')];}_0x17c99b[_0x4285('0x1a')](_0xbdfa0b)[_0x4285('0x2b')](_0x1822c9);};}exports[_0x4285('0x2c')]=function(_0x25d274,_0x254658){var _0x1b9e56={},_0x576b49={},_0xbcf8={'count':0x0,'rows':[]};var _0x17ae08=_[_0x4285('0x2d')](db['AnalyticExtractedReport'][_0x4285('0x2e')],function(_0x4436be){return{'name':_0x4436be[_0x4285('0x2f')],'type':_0x4436be[_0x4285('0x30')][_0x4285('0x31')]};});_0x576b49[_0x4285('0x32')]=_['map'](_0x17ae08,'name');_0x576b49[_0x4285('0x33')]=_['keys'](_0x25d274[_0x4285('0x33')]);_0x576b49['filters']=_[_0x4285('0x34')](_0x576b49[_0x4285('0x32')],_0x576b49['query']);_0x1b9e56['attributes']=_[_0x4285('0x34')](_0x576b49[_0x4285('0x32')],qs[_0x4285('0x35')](_0x25d274[_0x4285('0x33')][_0x4285('0x35')]));_0x1b9e56[_0x4285('0x36')]=_0x1b9e56[_0x4285('0x36')][_0x4285('0x37')]?_0x1b9e56[_0x4285('0x36')]:_0x576b49[_0x4285('0x32')];if(!_0x25d274[_0x4285('0x33')][_0x4285('0x38')](_0x4285('0x39'))){_0x1b9e56[_0x4285('0x1e')]=qs[_0x4285('0x1e')](_0x25d274[_0x4285('0x33')][_0x4285('0x1e')]);_0x1b9e56[_0x4285('0x1c')]=qs[_0x4285('0x1c')](_0x25d274[_0x4285('0x33')][_0x4285('0x1c')]);}_0x1b9e56[_0x4285('0x3a')]=qs[_0x4285('0x3b')](_0x25d274[_0x4285('0x33')][_0x4285('0x3b')]);_0x1b9e56['where']=qs[_0x4285('0x3c')](_[_0x4285('0x3d')](_0x25d274[_0x4285('0x33')],_0x576b49[_0x4285('0x3c')]),_0x17ae08);if(_0x25d274['query'][_0x4285('0x3e')]){_0x1b9e56['where']=_[_0x4285('0x3f')](_0x1b9e56[_0x4285('0x40')],{'$or':_[_0x4285('0x2d')](_0x17ae08,function(_0x4fdee0){if(_0x4fdee0['type']!==_0x4285('0x41')){var _0x17e233={};_0x17e233[_0x4fdee0[_0x4285('0x2a')]]={'$like':'%'+_0x25d274[_0x4285('0x33')][_0x4285('0x3e')]+'%'};return _0x17e233;}})});}_0x1b9e56=_['merge']({},_0x1b9e56,_0x25d274[_0x4285('0x42')]);var _0x31ccd1={'where':_0x1b9e56[_0x4285('0x40')]};return db['AnalyticExtractedReport'][_0x4285('0x1f')](_0x31ccd1)['then'](function(_0x344a3d){_0xbcf8[_0x4285('0x1f')]=_0x344a3d;if(_0x25d274['query'][_0x4285('0x43')]){_0x1b9e56[_0x4285('0x44')]=[{'all':!![]}];}return db[_0x4285('0x45')][_0x4285('0x46')](_0x1b9e56);})[_0x4285('0x24')](function(_0x532d87){_0xbcf8['rows']=_0x532d87;return _0xbcf8;})[_0x4285('0x24')](respondWithFilteredResult(_0x254658,_0x1b9e56))[_0x4285('0x47')](handleError(_0x254658,null));};exports[_0x4285('0x48')]=function(_0x3347fc,_0x5403bd){var _0x20ffd8={'raw':!![],'where':{'id':_0x3347fc['params']['id']}},_0x3851f8={};_0x3851f8[_0x4285('0x32')]=_[_0x4285('0x49')](db[_0x4285('0x45')]['rawAttributes']);_0x3851f8[_0x4285('0x33')]=_['keys'](_0x3347fc[_0x4285('0x33')]);_0x3851f8[_0x4285('0x3c')]=_['intersection'](_0x3851f8['model'],_0x3851f8[_0x4285('0x33')]);_0x20ffd8[_0x4285('0x36')]=_['intersection'](_0x3851f8[_0x4285('0x32')],qs[_0x4285('0x35')](_0x3347fc[_0x4285('0x33')][_0x4285('0x35')]));_0x20ffd8['attributes']=_0x20ffd8[_0x4285('0x36')][_0x4285('0x37')]?_0x20ffd8[_0x4285('0x36')]:_0x3851f8[_0x4285('0x32')];if(_0x3347fc[_0x4285('0x33')]['includeAll']){_0x20ffd8[_0x4285('0x44')]=[{'all':!![]}];}_0x20ffd8=_[_0x4285('0x3f')]({},_0x20ffd8,_0x3347fc[_0x4285('0x42')]);return db[_0x4285('0x45')][_0x4285('0x4a')](_0x20ffd8)[_0x4285('0x24')](handleEntityNotFound(_0x5403bd,null))[_0x4285('0x24')](respondWithResult(_0x5403bd,null))['catch'](handleError(_0x5403bd,null));};exports['create']=function(_0x4aa47d,_0x590f49){return db[_0x4285('0x45')][_0x4285('0x4b')](_0x4aa47d['body'],{})['then'](function(_0x1c353f){var _0x36ca20=_0x4aa47d[_0x4285('0x4c')][_0x4285('0x26')]({'plain':!![]});if(!_0x36ca20)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x36ca20[_0x4285('0x4d')]===_0x4285('0x4c')){var _0x43f813=_0x1c353f[_0x4285('0x26')]({'plain':!![]});var _0x587817=_0x4285('0x4e');return db[_0x4285('0x4f')][_0x4285('0x4a')]({'where':{'name':_0x587817,'userProfileId':_0x36ca20['userProfileId']},'raw':!![]})[_0x4285('0x24')](function(_0x31b000){if(_0x31b000&&_0x31b000['autoAssociation']===0x0){return db[_0x4285('0x27')][_0x4285('0x4b')]({'name':_0x43f813[_0x4285('0x2a')],'resourceId':_0x43f813['id'],'type':_0x31b000[_0x4285('0x2a')],'sectionId':_0x31b000['id']},{})[_0x4285('0x24')](function(){return _0x1c353f;});}else{return _0x1c353f;}})[_0x4285('0x47')](function(_0x3b5bf5){logger[_0x4285('0x28')](_0x4285('0x50'),_0x3b5bf5);throw _0x3b5bf5;});}return _0x1c353f;})['then'](respondWithResult(_0x590f49,0xc9))[_0x4285('0x47')](handleError(_0x590f49,null));};exports[_0x4285('0x51')]=function(_0x1893a0,_0x4cbbbe){if(_0x1893a0[_0x4285('0x52')]['id']){delete _0x1893a0['body']['id'];}return db[_0x4285('0x45')][_0x4285('0x4a')]({'where':{'id':_0x1893a0[_0x4285('0x53')]['id']}})[_0x4285('0x24')](handleEntityNotFound(_0x4cbbbe,null))[_0x4285('0x24')](saveUpdates(_0x1893a0[_0x4285('0x52')],null))[_0x4285('0x24')](respondWithResult(_0x4cbbbe,null))[_0x4285('0x47')](handleError(_0x4cbbbe,null));};exports[_0x4285('0x25')]=function(_0x2e948a,_0x1271b0){return db['AnalyticExtractedReport'][_0x4285('0x4a')]({'where':{'id':_0x2e948a[_0x4285('0x53')]['id']}})[_0x4285('0x24')](handleEntityNotFound(_0x1271b0,null))[_0x4285('0x24')](removeEntity(_0x1271b0,null))[_0x4285('0x47')](handleError(_0x1271b0,null));};exports['download']=function(_0x1c5a17,_0x424cd4,_0x1332ed){return db[_0x4285('0x45')][_0x4285('0x4a')]({'where':{'id':_0x1c5a17['params']['id']},'attributes':[_0x4285('0x2a'),_0x4285('0x54'),_0x4285('0x55'),_0x4285('0x56')],'raw':!![]})[_0x4285('0x24')](handleEntityNotFound(_0x424cd4,null))['then'](function(_0x24ad9c){if(_0x24ad9c){if(!fs['existsSync'](path[_0x4285('0x57')](config[_0x4285('0x58')],_0x4285('0x59'),_0x24ad9c[_0x4285('0x55')]))){throw new db[(_0x4285('0x5a'))]['ValidationError']('Report\x20not\x20found\x20or\x20empty');}if(_0x1c5a17[_0x4285('0x33')][_0x4285('0x5b')]){return _0x424cd4['sendStatus'](0xc8);}return _0x424cd4[_0x4285('0x5c')](path[_0x4285('0x57')](config['root'],_0x4285('0x59'),_0x24ad9c[_0x4285('0x55')]),util[_0x4285('0x5d')]('%s.%s',_0x24ad9c[_0x4285('0x54')]||_0x24ad9c['name'],_0x24ad9c[_0x4285('0x56')][_0x4285('0x5e')]()));}})[_0x4285('0x47')](handleError(_0x424cd4,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 8a9c34c..fde2002 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 _0xc487=['api','bluebird','request-promise','path','./analyticExtractedReport.attributes','exports','define'];(function(_0x12d6d1,_0x468f27){var _0x3c85de=function(_0x532c43){while(--_0x532c43){_0x12d6d1['push'](_0x12d6d1['shift']());}};_0x3c85de(++_0x468f27);}(_0xc487,0x181));var _0x7c48=function(_0x58b647,_0xe24336){_0x58b647=_0x58b647-0x0;var _0x233b67=_0xc487[_0x58b647];return _0x233b67;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x7c48('0x0'));var moment=require('moment');var BPromise=require(_0x7c48('0x1'));var rp=require(_0x7c48('0x2'));var fs=require('fs');var path=require(_0x7c48('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7c48('0x4'));module[_0x7c48('0x5')]=function(_0x28a5c1,_0x106709){return _0x28a5c1[_0x7c48('0x6')]('AnalyticExtractedReport',attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x230d=['moment','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','AnalyticExtractedReport','analytics_extracted_reports','lodash','util'];(function(_0x55cd7d,_0x37cb9c){var _0x177358=function(_0x47f589){while(--_0x47f589){_0x55cd7d['push'](_0x55cd7d['shift']());}};_0x177358(++_0x37cb9c);}(_0x230d,0x120));var _0xd230=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x230d[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xd230('0x0'));var util=require(_0xd230('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd230('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd230('0x3'));var rimraf=require(_0xd230('0x4'));var config=require(_0xd230('0x5'));var attributes=require(_0xd230('0x6'));module[_0xd230('0x7')]=function(_0x4e347c,_0x689c9d){return _0x4e347c['define'](_0xd230('0x8'),attributes,{'tableName':_0xd230('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index efdcea0..8db2498 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 _0x05ca=['catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','then','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result'];(function(_0x258d11,_0xc62302){var _0x230fd2=function(_0x3239e1){while(--_0x3239e1){_0x258d11['push'](_0x258d11['shift']());}};_0x230fd2(++_0xc62302);}(_0x05ca,0xbf));var _0xa05c=function(_0x1fdda9,_0x5c74bd){_0x1fdda9=_0x1fdda9-0x0;var _0x25e192=_0x05ca[_0x1fdda9];return _0x25e192;};'use strict';var _=require(_0xa05c('0x0'));var util=require('util');var moment=require(_0xa05c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa05c('0x2'));var fs=require('fs');var Redis=require(_0xa05c('0x3'));var db=require(_0xa05c('0x4'))['db'];var utils=require(_0xa05c('0x5'));var logger=require('../../config/logger')(_0xa05c('0x6'));var config=require(_0xa05c('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x424e34,_0xb06377,_0x256dc0){return new BPromise(function(_0x1cc047,_0x430a98){return client['request'](_0x424e34,_0x256dc0)[_0xa05c('0x8')](function(_0x508187){logger[_0xa05c('0x9')](_0xa05c('0xa'),_0xb06377,'request\x20sent');logger[_0xa05c('0xb')](_0xa05c('0xc'),_0xb06377,_0xa05c('0xd'),JSON['stringify'](_0x508187));if(_0x508187[_0xa05c('0xe')]){if(_0x508187[_0xa05c('0xe')][_0xa05c('0xf')]===0x1f4){logger[_0xa05c('0xe')](_0xa05c('0xa'),_0xb06377,_0x508187['error'][_0xa05c('0x10')]);return _0x430a98(_0x508187['error']['message']);}logger[_0xa05c('0xe')](_0xa05c('0xa'),_0xb06377,_0x508187[_0xa05c('0xe')][_0xa05c('0x10')]);return _0x1cc047(_0x508187['error'][_0xa05c('0x10')]);}else{logger['info'](_0xa05c('0xa'),_0xb06377,_0xa05c('0xd'));_0x1cc047(_0x508187[_0xa05c('0x11')][_0xa05c('0x10')]);}})[_0xa05c('0x12')](function(_0x40fcdf){logger[_0xa05c('0xe')](_0xa05c('0xa'),_0xb06377,_0x40fcdf);_0x430a98(_0x40fcdf);});});} \ No newline at end of file +var _0x5c69=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','AnalyticExtractedReport,\x20%s,\x20%s','result','lodash'];(function(_0x2c25cf,_0x367e03){var _0x585d17=function(_0x54b545){while(--_0x54b545){_0x2c25cf['push'](_0x2c25cf['shift']());}};_0x585d17(++_0x367e03);}(_0x5c69,0xa0));var _0x95c6=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x5c69[_0x411017];return _0x2adeea;};'use strict';var _=require(_0x95c6('0x0'));var util=require('util');var moment=require(_0x95c6('0x1'));var BPromise=require(_0x95c6('0x2'));var rs=require(_0x95c6('0x3'));var fs=require('fs');var Redis=require(_0x95c6('0x4'));var db=require(_0x95c6('0x5'))['db'];var utils=require(_0x95c6('0x6'));var logger=require(_0x95c6('0x7'))(_0x95c6('0x8'));var config=require(_0x95c6('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x95c6('0xa')][_0x95c6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e858a,_0x1f4ac1,_0x4dfddc){return new BPromise(function(_0x2c2ab2,_0x55b728){return client[_0x95c6('0xc')](_0x5e858a,_0x4dfddc)[_0x95c6('0xd')](function(_0x23cfec){logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x1f4ac1,_0x95c6('0xe'));logger[_0x95c6('0xf')](_0x95c6('0x10'),_0x1f4ac1,_0x95c6('0xe'),JSON[_0x95c6('0x11')](_0x23cfec));if(_0x23cfec['error']){if(_0x23cfec[_0x95c6('0x12')][_0x95c6('0x13')]===0x1f4){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x1f4ac1,_0x23cfec['error'][_0x95c6('0x14')]);return _0x55b728(_0x23cfec[_0x95c6('0x12')][_0x95c6('0x14')]);}logger[_0x95c6('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x1f4ac1,_0x23cfec[_0x95c6('0x12')][_0x95c6('0x14')]);return _0x2c2ab2(_0x23cfec['error'][_0x95c6('0x14')]);}else{logger['info'](_0x95c6('0x15'),_0x1f4ac1,_0x95c6('0xe'));_0x2c2ab2(_0x23cfec[_0x95c6('0x16')][_0x95c6('0x14')]);}})['catch'](function(_0x8c8783){logger[_0x95c6('0x12')](_0x95c6('0x15'),_0x1f4ac1,_0x8c8783);_0x55b728(_0x8c8783);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 709c697..32adfde 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 _0x22d8=['exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','/:id/download','download','post','create','put','update','delete','destroy'];(function(_0x30dbe6,_0x22e984){var _0x56bb53=function(_0x1ec502){while(--_0x1ec502){_0x30dbe6['push'](_0x30dbe6['shift']());}};_0x56bb53(++_0x22e984);}(_0x22d8,0xfd));var _0x822d=function(_0x547c55,_0x9ad851){_0x547c55=_0x547c55-0x0;var _0x266042=_0x22d8[_0x547c55];return _0x266042;};'use strict';var multer=require('multer');var util=require(_0x822d('0x0'));var path=require(_0x822d('0x1'));var timeout=require('connect-timeout');var express=require(_0x822d('0x2'));var router=express['Router']();var fs_extra=require(_0x822d('0x3'));var auth=require(_0x822d('0x4'));var interaction=require(_0x822d('0x5'));var config=require(_0x822d('0x6'));var controller=require(_0x822d('0x7'));router[_0x822d('0x8')]('/',auth[_0x822d('0x9')](),controller[_0x822d('0xa')]);router[_0x822d('0x8')](_0x822d('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x822d('0x8')](_0x822d('0xc'),auth[_0x822d('0x9')](),controller[_0x822d('0xd')]);router[_0x822d('0xe')]('/',auth['isAuthenticated'](),controller[_0x822d('0xf')]);router[_0x822d('0x10')](_0x822d('0xb'),auth[_0x822d('0x9')](),controller[_0x822d('0x11')]);router[_0x822d('0x12')]('/:id',auth[_0x822d('0x9')](),controller[_0x822d('0x13')]);module[_0x822d('0x14')]=router; \ No newline at end of file +var _0xae42=['fs-extra','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','show','/:id/download','download','post','create','/:id','update','delete','destroy','multer','util','connect-timeout'];(function(_0x1177d5,_0x22b649){var _0xc3ddc2=function(_0x43ff95){while(--_0x43ff95){_0x1177d5['push'](_0x1177d5['shift']());}};_0xc3ddc2(++_0x22b649);}(_0xae42,0x8d));var _0x2ae4=function(_0x460404,_0x16622a){_0x460404=_0x460404-0x0;var _0x1ee60c=_0xae42[_0x460404];return _0x1ee60c;};'use strict';var multer=require(_0x2ae4('0x0'));var util=require(_0x2ae4('0x1'));var path=require('path');var timeout=require(_0x2ae4('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2ae4('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2ae4('0x4'));var controller=require(_0x2ae4('0x5'));router[_0x2ae4('0x6')]('/',auth[_0x2ae4('0x7')](),controller[_0x2ae4('0x8')]);router[_0x2ae4('0x6')]('/:id',auth[_0x2ae4('0x7')](),controller[_0x2ae4('0x9')]);router[_0x2ae4('0x6')](_0x2ae4('0xa'),auth[_0x2ae4('0x7')](),controller[_0x2ae4('0xb')]);router[_0x2ae4('0xc')]('/',auth[_0x2ae4('0x7')](),controller[_0x2ae4('0xd')]);router['put'](_0x2ae4('0xe'),auth[_0x2ae4('0x7')](),controller[_0x2ae4('0xf')]);router[_0x2ae4('0x10')]('/:id',auth[_0x2ae4('0x7')](),controller[_0x2ae4('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index edf4d60..1e3be0f 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 _0x2945=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x2c9b79,_0x7cf58b){var _0x265032=function(_0x188a92){while(--_0x188a92){_0x2c9b79['push'](_0x2c9b79['shift']());}};_0x265032(++_0x7cf58b);}(_0x2945,0xf3));var _0x5294=function(_0x1c9fc4,_0x240343){_0x1c9fc4=_0x1c9fc4-0x0;var _0x2efcba=_0x2945[_0x1c9fc4];return _0x2efcba;};'use strict';var Sequelize=require(_0x5294('0x0'));module[_0x5294('0x1')]={'field':{'type':Sequelize[_0x5294('0x2')]},'alias':{'type':Sequelize[_0x5294('0x3')]},'function':{'type':Sequelize[_0x5294('0x3')]},'format':{'type':Sequelize[_0x5294('0x3')]},'groupBy':{'type':Sequelize[_0x5294('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x6ce1=['STRING','BOOLEAN','sequelize','TEXT'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6ce1,0xaa));var _0x16ce=function(_0x6540ce,_0x401528){_0x6540ce=_0x6540ce-0x0;var _0x58d2e3=_0x6ce1[_0x6540ce];return _0x58d2e3;};'use strict';var Sequelize=require(_0x16ce('0x0'));module['exports']={'field':{'type':Sequelize[_0x16ce('0x1')]},'alias':{'type':Sequelize[_0x16ce('0x2')]},'function':{'type':Sequelize[_0x16ce('0x2')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0x16ce('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0x16ce('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 fb1e937..e856bfe 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 _0xb057=['fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','then','includeAll','include','catch','show','params','find','bulkCreate','body','addFields','AnalyticCustomReport','findOne','sequelize','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','error','name','index','map','AnalyticFieldReport','rawAttributes'];(function(_0x229776,_0x13732d){var _0x4f32b5=function(_0x48958d){while(--_0x48958d){_0x229776['push'](_0x229776['shift']());}};_0x4f32b5(++_0x13732d);}(_0xb057,0x1f0));var _0x7b05=function(_0x226a19,_0x4a2fde){_0x226a19=_0x226a19-0x0;var _0x1dd55d=_0xb057[_0x226a19];return _0x1dd55d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7b05('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7b05('0x1'));var BPromise=require(_0x7b05('0x2'));var Mustache=require(_0x7b05('0x3'));var util=require(_0x7b05('0x4'));var path=require(_0x7b05('0x5'));var sox=require(_0x7b05('0x6'));var csv=require(_0x7b05('0x7'));var ejs=require(_0x7b05('0x8'));var fs=require('fs');var fs_extra=require(_0x7b05('0x9'));var _=require(_0x7b05('0xa'));var squel=require(_0x7b05('0xb'));var crypto=require(_0x7b05('0xc'));var jsforce=require(_0x7b05('0xd'));var deskjs=require(_0x7b05('0xe'));var toCsv=require(_0x7b05('0x7'));var querystring=require(_0x7b05('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7b05('0x10'));var as=require(_0x7b05('0x11'));var hardwareService=require(_0x7b05('0x12'));var logger=require(_0x7b05('0x13'))(_0x7b05('0x14'));var utils=require('../../config/utils');var config=require(_0x7b05('0x15'));var licenseUtil=require(_0x7b05('0x16'));var db=require(_0x7b05('0x17'))['db'];function respondWithStatusCode(_0x125f37,_0x3772be){_0x3772be=_0x3772be||0xcc;return function(_0x3f338c){if(_0x3f338c){return _0x125f37[_0x7b05('0x18')](_0x3772be);}return _0x125f37['status'](_0x3772be)[_0x7b05('0x19')]();};}function respondWithResult(_0x4b76b4,_0x245122){_0x245122=_0x245122||0xc8;return function(_0xf65800){if(_0xf65800){return _0x4b76b4[_0x7b05('0x1a')](_0x245122)[_0x7b05('0x1b')](_0xf65800);}};}function respondWithFilteredResult(_0x3869ee,_0x1eb53c){return function(_0x223de7){if(_0x223de7){var _0x145685=typeof _0x1eb53c[_0x7b05('0x1c')]===_0x7b05('0x1d')&&typeof _0x1eb53c[_0x7b05('0x1e')]===_0x7b05('0x1d');var _0x3dd197=_0x223de7[_0x7b05('0x1f')];var _0x4517a5=_0x145685?0x0:_0x1eb53c[_0x7b05('0x1c')];var _0x1f1fa9=_0x145685?_0x223de7[_0x7b05('0x1f')]:_0x1eb53c[_0x7b05('0x1c')]+_0x1eb53c[_0x7b05('0x1e')];var _0x322762;if(_0x1f1fa9>=_0x3dd197){_0x1f1fa9=_0x3dd197;_0x322762=0xc8;}else{_0x322762=0xce;}_0x3869ee[_0x7b05('0x1a')](_0x322762);return _0x3869ee[_0x7b05('0x20')](_0x7b05('0x21'),_0x4517a5+'-'+_0x1f1fa9+'/'+_0x3dd197)[_0x7b05('0x1b')](_0x223de7);}return null;};}function patchUpdates(_0x5c990a){return function(_0x3bc51d){try{jsonpatch[_0x7b05('0x22')](_0x3bc51d,_0x5c990a,!![]);}catch(_0x10b127){return BPromise['reject'](_0x10b127);}return _0x3bc51d['save']();};}function saveUpdates(_0x7c6f3b,_0x1fe941){return function(_0x52dc10){if(_0x52dc10){return _0x52dc10[_0x7b05('0x23')](_0x7c6f3b)['then'](function(_0x264ae8){return _0x264ae8;});}return null;};}function removeEntity(_0x166757,_0x3ef78a){return function(_0x10a869){if(_0x10a869){return _0x10a869[_0x7b05('0x24')]()['then'](function(){_0x166757['status'](0xcc)[_0x7b05('0x19')]();});}};}function handleEntityNotFound(_0x8a4ab3,_0x2537f5){return function(_0x5d709b){if(!_0x5d709b){_0x8a4ab3[_0x7b05('0x18')](0x194);}return _0x5d709b;};}function handleError(_0x5529a5,_0x580b96){_0x580b96=_0x580b96||0x1f4;return function(_0x232e28){logger[_0x7b05('0x25')](_0x232e28['stack']);if(_0x232e28[_0x7b05('0x26')]){delete _0x232e28[_0x7b05('0x26')];}_0x5529a5['status'](_0x580b96)['send'](_0x232e28);};}exports[_0x7b05('0x27')]=function(_0x19fe71,_0x364b8e){var _0x4e058e={},_0x1e6510={},_0x3a72ac={'count':0x0,'rows':[]};var _0x2674d8=_[_0x7b05('0x28')](db[_0x7b05('0x29')][_0x7b05('0x2a')],function(_0x39ea16){return{'name':_0x39ea16[_0x7b05('0x2b')],'type':_0x39ea16['type'][_0x7b05('0x2c')]};});_0x1e6510[_0x7b05('0x2d')]=_['map'](_0x2674d8,_0x7b05('0x26'));_0x1e6510[_0x7b05('0x2e')]=_[_0x7b05('0x2f')](_0x19fe71[_0x7b05('0x2e')]);_0x1e6510[_0x7b05('0x30')]=_[_0x7b05('0x31')](_0x1e6510[_0x7b05('0x2d')],_0x1e6510[_0x7b05('0x2e')]);_0x4e058e['attributes']=_['intersection'](_0x1e6510[_0x7b05('0x2d')],qs[_0x7b05('0x32')](_0x19fe71[_0x7b05('0x2e')][_0x7b05('0x32')]));_0x4e058e['attributes']=_0x4e058e[_0x7b05('0x33')][_0x7b05('0x34')]?_0x4e058e[_0x7b05('0x33')]:_0x1e6510['model'];if(!_0x19fe71[_0x7b05('0x2e')][_0x7b05('0x35')](_0x7b05('0x36'))){_0x4e058e[_0x7b05('0x1e')]=qs[_0x7b05('0x1e')](_0x19fe71[_0x7b05('0x2e')][_0x7b05('0x1e')]);_0x4e058e[_0x7b05('0x1c')]=qs['offset'](_0x19fe71[_0x7b05('0x2e')][_0x7b05('0x1c')]);}_0x4e058e[_0x7b05('0x37')]=qs['sort'](_0x19fe71[_0x7b05('0x2e')][_0x7b05('0x38')]);_0x4e058e[_0x7b05('0x39')]=qs['filters'](_[_0x7b05('0x3a')](_0x19fe71[_0x7b05('0x2e')],_0x1e6510['filters']),_0x2674d8);if(_0x19fe71[_0x7b05('0x2e')][_0x7b05('0x3b')]){_0x4e058e[_0x7b05('0x39')]=_['merge'](_0x4e058e[_0x7b05('0x39')],{'$or':_[_0x7b05('0x28')](_0x2674d8,function(_0x18954e){if(_0x18954e[_0x7b05('0x3c')]!==_0x7b05('0x3d')){var _0x1d961c={};_0x1d961c[_0x18954e[_0x7b05('0x26')]]={'$like':'%'+_0x19fe71[_0x7b05('0x2e')]['filter']+'%'};return _0x1d961c;}})});}_0x4e058e=_[_0x7b05('0x3e')]({},_0x4e058e,_0x19fe71[_0x7b05('0x3f')]);var _0x1af6f3={'where':_0x4e058e['where']};return db[_0x7b05('0x29')][_0x7b05('0x1f')](_0x1af6f3)[_0x7b05('0x40')](function(_0x3434b6){_0x3a72ac[_0x7b05('0x1f')]=_0x3434b6;if(_0x19fe71[_0x7b05('0x2e')][_0x7b05('0x41')]){_0x4e058e[_0x7b05('0x42')]=[{'all':!![]}];}return db[_0x7b05('0x29')]['findAll'](_0x4e058e);})[_0x7b05('0x40')](function(_0x32183d){_0x3a72ac['rows']=_0x32183d;return _0x3a72ac;})['then'](respondWithFilteredResult(_0x364b8e,_0x4e058e))[_0x7b05('0x43')](handleError(_0x364b8e,null));};exports[_0x7b05('0x44')]=function(_0x1d516d,_0x220477){var _0x1d0c00={'raw':![],'where':{'id':_0x1d516d[_0x7b05('0x45')]['id']}},_0x350e1d={};_0x350e1d[_0x7b05('0x2d')]=_['keys'](db[_0x7b05('0x29')][_0x7b05('0x2a')]);_0x350e1d[_0x7b05('0x2e')]=_[_0x7b05('0x2f')](_0x1d516d['query']);_0x350e1d[_0x7b05('0x30')]=_['intersection'](_0x350e1d[_0x7b05('0x2d')],_0x350e1d['query']);_0x1d0c00[_0x7b05('0x33')]=_['intersection'](_0x350e1d['model'],qs[_0x7b05('0x32')](_0x1d516d[_0x7b05('0x2e')][_0x7b05('0x32')]));_0x1d0c00[_0x7b05('0x33')]=_0x1d0c00[_0x7b05('0x33')]['length']?_0x1d0c00['attributes']:_0x350e1d[_0x7b05('0x2d')];if(_0x1d516d[_0x7b05('0x2e')][_0x7b05('0x41')]){_0x1d0c00['include']=[{'all':!![]}];}_0x1d0c00=_['merge']({},_0x1d0c00,_0x1d516d['options']);return db[_0x7b05('0x29')][_0x7b05('0x46')](_0x1d0c00)['then'](handleEntityNotFound(_0x220477,null))[_0x7b05('0x40')](respondWithResult(_0x220477,null))[_0x7b05('0x43')](handleError(_0x220477,null));};exports['create']=function(_0x2ae07a,_0x14d2c1){return db[_0x7b05('0x29')]['create'](_0x2ae07a['body'],{})[_0x7b05('0x40')](respondWithResult(_0x14d2c1,0xc9))[_0x7b05('0x43')](handleError(_0x14d2c1,null));};exports[_0x7b05('0x47')]=function(_0x7a5928,_0x4258db){return db[_0x7b05('0x29')][_0x7b05('0x47')](_0x7a5928[_0x7b05('0x48')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x4258db,0xc9))[_0x7b05('0x43')](handleError(_0x4258db,null));};exports[_0x7b05('0x23')]=function(_0x779944,_0x4b2646){if(_0x779944[_0x7b05('0x48')]['id']){delete _0x779944[_0x7b05('0x48')]['id'];}return db[_0x7b05('0x29')][_0x7b05('0x46')]({'where':{'id':_0x779944[_0x7b05('0x45')]['id']}})['then'](handleEntityNotFound(_0x4b2646,null))[_0x7b05('0x40')](saveUpdates(_0x779944[_0x7b05('0x48')],null))[_0x7b05('0x40')](respondWithResult(_0x4b2646,null))[_0x7b05('0x43')](handleError(_0x4b2646,null));};exports[_0x7b05('0x24')]=function(_0x2380da,_0x5f494d){return db[_0x7b05('0x29')]['find']({'where':{'id':_0x2380da[_0x7b05('0x45')]['id']}})[_0x7b05('0x40')](handleEntityNotFound(_0x5f494d,null))[_0x7b05('0x40')](removeEntity(_0x5f494d,null))[_0x7b05('0x43')](handleError(_0x5f494d,null));};exports['bulkDestroy']=function(_0x51b28a,_0x1bef95){return db[_0x7b05('0x29')]['destroy']({'where':{'id':_0x51b28a[_0x7b05('0x2e')]['ids']||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x1bef95,0xcc))[_0x7b05('0x43')](handleError(_0x1bef95,null));};exports[_0x7b05('0x49')]=function(_0x48e860,_0x3988b1,_0x59d71e){return db[_0x7b05('0x4a')][_0x7b05('0x4b')]({'where':{'id':_0x48e860['params']['id']}})[_0x7b05('0x40')](handleEntityNotFound(_0x3988b1,null))['then'](function(_0x27b656){if(_0x27b656){return db[_0x7b05('0x4c')]['transaction'](function(_0x2e958e){return db['AnalyticFieldReport'][_0x7b05('0x24')]({'where':{'CustomReportId':_0x48e860['params']['id']},'transaction':_0x2e958e})['then'](function(_0x6a821a){var _0x394d6e=_['map'](_0x48e860['body'],function(_0x3ba940){delete _0x3ba940['id'];_0x3ba940['CustomReportId']=_0x48e860[_0x7b05('0x45')]['id'];return _0x3ba940;});return db[_0x7b05('0x29')][_0x7b05('0x47')](_0x394d6e,{'transaction':_0x2e958e});});})[_0x7b05('0x40')](function(){return db['AnalyticFieldReport']['findAll']({'where':{'CustomReportId':_0x48e860[_0x7b05('0x45')]['id']}});});}})[_0x7b05('0x40')](respondWithResult(_0x3988b1,null))[_0x7b05('0x43')](handleError(_0x3988b1,null));}; \ No newline at end of file +var _0xc391=['findAll','rows','show','params','keys','rawAttributes','intersection','include','options','catch','create','body','bulkCreate','find','bulkDestroy','destroy','ids','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','status','error','stack','name','send','index','map','AnalyticFieldReport','type','model','query','filters','fields','attributes','length','hasOwnProperty','offset','order','sort','where','pick','filter','merge','VIRTUAL','includeAll'];(function(_0xec1b0,_0x3e6c72){var _0x86aab1=function(_0xacfda){while(--_0xacfda){_0xec1b0['push'](_0xec1b0['shift']());}};_0x86aab1(++_0x3e6c72);}(_0xc391,0x115));var _0x1c39=function(_0x345902,_0x7bd064){_0x345902=_0x345902-0x0;var _0x397297=_0xc391[_0x345902];return _0x397297;};'use strict';var emlformat=require(_0x1c39('0x0'));var rimraf=require(_0x1c39('0x1'));var zipdir=require(_0x1c39('0x2'));var jsonpatch=require(_0x1c39('0x3'));var rp=require('request-promise');var moment=require(_0x1c39('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1c39('0x5'));var util=require('util');var path=require(_0x1c39('0x6'));var sox=require(_0x1c39('0x7'));var csv=require('to-csv');var ejs=require(_0x1c39('0x8'));var fs=require('fs');var fs_extra=require(_0x1c39('0x9'));var _=require(_0x1c39('0xa'));var squel=require(_0x1c39('0xb'));var crypto=require(_0x1c39('0xc'));var jsforce=require(_0x1c39('0xd'));var deskjs=require(_0x1c39('0xe'));var toCsv=require(_0x1c39('0xf'));var querystring=require(_0x1c39('0x10'));var Papa=require(_0x1c39('0x11'));var Redis=require('ioredis');var authService=require(_0x1c39('0x12'));var qs=require(_0x1c39('0x13'));var as=require(_0x1c39('0x14'));var hardwareService=require(_0x1c39('0x15'));var logger=require(_0x1c39('0x16'))(_0x1c39('0x17'));var utils=require(_0x1c39('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1c39('0x19'))['db'];function respondWithStatusCode(_0x13ddf1,_0x4745da){_0x4745da=_0x4745da||0xcc;return function(_0x314498){if(_0x314498){return _0x13ddf1[_0x1c39('0x1a')](_0x4745da);}return _0x13ddf1['status'](_0x4745da)[_0x1c39('0x1b')]();};}function respondWithResult(_0x322041,_0x5f3c1c){_0x5f3c1c=_0x5f3c1c||0xc8;return function(_0x3964a6){if(_0x3964a6){return _0x322041['status'](_0x5f3c1c)['json'](_0x3964a6);}};}function respondWithFilteredResult(_0x2de445,_0x6ebb82){return function(_0x30fb3a){if(_0x30fb3a){var _0x30f522=typeof _0x6ebb82['offset']===_0x1c39('0x1c')&&typeof _0x6ebb82[_0x1c39('0x1d')]==='undefined';var _0x10240b=_0x30fb3a[_0x1c39('0x1e')];var _0x40050e=_0x30f522?0x0:_0x6ebb82['offset'];var _0x57878d=_0x30f522?_0x30fb3a['count']:_0x6ebb82['offset']+_0x6ebb82[_0x1c39('0x1d')];var _0x45ff86;if(_0x57878d>=_0x10240b){_0x57878d=_0x10240b;_0x45ff86=0xc8;}else{_0x45ff86=0xce;}_0x2de445['status'](_0x45ff86);return _0x2de445[_0x1c39('0x1f')](_0x1c39('0x20'),_0x40050e+'-'+_0x57878d+'/'+_0x10240b)['json'](_0x30fb3a);}return null;};}function patchUpdates(_0x14fd7f){return function(_0x131161){try{jsonpatch[_0x1c39('0x21')](_0x131161,_0x14fd7f,!![]);}catch(_0x102223){return BPromise[_0x1c39('0x22')](_0x102223);}return _0x131161[_0x1c39('0x23')]();};}function saveUpdates(_0x1770bc,_0x350d72){return function(_0x437be6){if(_0x437be6){return _0x437be6[_0x1c39('0x24')](_0x1770bc)[_0x1c39('0x25')](function(_0x2ff992){return _0x2ff992;});}return null;};}function removeEntity(_0x1b8224,_0xe3c8d4){return function(_0x1cd7f7){if(_0x1cd7f7){return _0x1cd7f7['destroy']()[_0x1c39('0x25')](function(){_0x1b8224[_0x1c39('0x26')](0xcc)[_0x1c39('0x1b')]();});}};}function handleEntityNotFound(_0x430202,_0x369689){return function(_0x1aafb4){if(!_0x1aafb4){_0x430202['sendStatus'](0x194);}return _0x1aafb4;};}function handleError(_0x1e656c,_0x133c7a){_0x133c7a=_0x133c7a||0x1f4;return function(_0x517552){logger[_0x1c39('0x27')](_0x517552[_0x1c39('0x28')]);if(_0x517552[_0x1c39('0x29')]){delete _0x517552[_0x1c39('0x29')];}_0x1e656c[_0x1c39('0x26')](_0x133c7a)[_0x1c39('0x2a')](_0x517552);};}exports[_0x1c39('0x2b')]=function(_0x301ab4,_0x327d54){var _0x349c39={},_0xfb2cb5={},_0x4743e7={'count':0x0,'rows':[]};var _0x1335ae=_[_0x1c39('0x2c')](db[_0x1c39('0x2d')]['rawAttributes'],function(_0x4f5d22){return{'name':_0x4f5d22['fieldName'],'type':_0x4f5d22[_0x1c39('0x2e')]['key']};});_0xfb2cb5[_0x1c39('0x2f')]=_['map'](_0x1335ae,'name');_0xfb2cb5['query']=_['keys'](_0x301ab4[_0x1c39('0x30')]);_0xfb2cb5[_0x1c39('0x31')]=_['intersection'](_0xfb2cb5[_0x1c39('0x2f')],_0xfb2cb5[_0x1c39('0x30')]);_0x349c39['attributes']=_['intersection'](_0xfb2cb5['model'],qs[_0x1c39('0x32')](_0x301ab4[_0x1c39('0x30')][_0x1c39('0x32')]));_0x349c39[_0x1c39('0x33')]=_0x349c39[_0x1c39('0x33')][_0x1c39('0x34')]?_0x349c39[_0x1c39('0x33')]:_0xfb2cb5[_0x1c39('0x2f')];if(!_0x301ab4[_0x1c39('0x30')][_0x1c39('0x35')]('nolimit')){_0x349c39[_0x1c39('0x1d')]=qs[_0x1c39('0x1d')](_0x301ab4[_0x1c39('0x30')][_0x1c39('0x1d')]);_0x349c39[_0x1c39('0x36')]=qs[_0x1c39('0x36')](_0x301ab4[_0x1c39('0x30')][_0x1c39('0x36')]);}_0x349c39[_0x1c39('0x37')]=qs['sort'](_0x301ab4[_0x1c39('0x30')][_0x1c39('0x38')]);_0x349c39[_0x1c39('0x39')]=qs[_0x1c39('0x31')](_[_0x1c39('0x3a')](_0x301ab4['query'],_0xfb2cb5['filters']),_0x1335ae);if(_0x301ab4['query'][_0x1c39('0x3b')]){_0x349c39[_0x1c39('0x39')]=_[_0x1c39('0x3c')](_0x349c39['where'],{'$or':_[_0x1c39('0x2c')](_0x1335ae,function(_0x47e421){if(_0x47e421[_0x1c39('0x2e')]!==_0x1c39('0x3d')){var _0x576b0e={};_0x576b0e[_0x47e421[_0x1c39('0x29')]]={'$like':'%'+_0x301ab4['query']['filter']+'%'};return _0x576b0e;}})});}_0x349c39=_[_0x1c39('0x3c')]({},_0x349c39,_0x301ab4['options']);var _0x1956ca={'where':_0x349c39[_0x1c39('0x39')]};return db['AnalyticFieldReport'][_0x1c39('0x1e')](_0x1956ca)[_0x1c39('0x25')](function(_0x490694){_0x4743e7['count']=_0x490694;if(_0x301ab4[_0x1c39('0x30')][_0x1c39('0x3e')]){_0x349c39['include']=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x1c39('0x3f')](_0x349c39);})[_0x1c39('0x25')](function(_0x314579){_0x4743e7[_0x1c39('0x40')]=_0x314579;return _0x4743e7;})[_0x1c39('0x25')](respondWithFilteredResult(_0x327d54,_0x349c39))['catch'](handleError(_0x327d54,null));};exports[_0x1c39('0x41')]=function(_0x51b145,_0x4cab8e){var _0x46ff99={'raw':![],'where':{'id':_0x51b145[_0x1c39('0x42')]['id']}},_0x297077={};_0x297077['model']=_[_0x1c39('0x43')](db[_0x1c39('0x2d')][_0x1c39('0x44')]);_0x297077[_0x1c39('0x30')]=_[_0x1c39('0x43')](_0x51b145[_0x1c39('0x30')]);_0x297077[_0x1c39('0x31')]=_[_0x1c39('0x45')](_0x297077[_0x1c39('0x2f')],_0x297077[_0x1c39('0x30')]);_0x46ff99[_0x1c39('0x33')]=_['intersection'](_0x297077['model'],qs['fields'](_0x51b145['query']['fields']));_0x46ff99[_0x1c39('0x33')]=_0x46ff99[_0x1c39('0x33')][_0x1c39('0x34')]?_0x46ff99['attributes']:_0x297077[_0x1c39('0x2f')];if(_0x51b145[_0x1c39('0x30')][_0x1c39('0x3e')]){_0x46ff99[_0x1c39('0x46')]=[{'all':!![]}];}_0x46ff99=_[_0x1c39('0x3c')]({},_0x46ff99,_0x51b145[_0x1c39('0x47')]);return db[_0x1c39('0x2d')]['find'](_0x46ff99)[_0x1c39('0x25')](handleEntityNotFound(_0x4cab8e,null))['then'](respondWithResult(_0x4cab8e,null))[_0x1c39('0x48')](handleError(_0x4cab8e,null));};exports[_0x1c39('0x49')]=function(_0x4ad0c0,_0x4a7f08){return db[_0x1c39('0x2d')][_0x1c39('0x49')](_0x4ad0c0[_0x1c39('0x4a')],{})[_0x1c39('0x25')](respondWithResult(_0x4a7f08,0xc9))[_0x1c39('0x48')](handleError(_0x4a7f08,null));};exports['bulkCreate']=function(_0x2d096f,_0x321ea0){return db['AnalyticFieldReport'][_0x1c39('0x4b')](_0x2d096f[_0x1c39('0x4a')],{'raw':![],'individualHooks':!![]})[_0x1c39('0x25')](respondWithResult(_0x321ea0,0xc9))[_0x1c39('0x48')](handleError(_0x321ea0,null));};exports[_0x1c39('0x24')]=function(_0x2fef77,_0x1e58c0){if(_0x2fef77[_0x1c39('0x4a')]['id']){delete _0x2fef77[_0x1c39('0x4a')]['id'];}return db[_0x1c39('0x2d')][_0x1c39('0x4c')]({'where':{'id':_0x2fef77['params']['id']}})['then'](handleEntityNotFound(_0x1e58c0,null))['then'](saveUpdates(_0x2fef77['body'],null))[_0x1c39('0x25')](respondWithResult(_0x1e58c0,null))[_0x1c39('0x48')](handleError(_0x1e58c0,null));};exports['destroy']=function(_0x111a89,_0x23c57d){return db[_0x1c39('0x2d')][_0x1c39('0x4c')]({'where':{'id':_0x111a89[_0x1c39('0x42')]['id']}})['then'](handleEntityNotFound(_0x23c57d,null))[_0x1c39('0x25')](removeEntity(_0x23c57d,null))[_0x1c39('0x48')](handleError(_0x23c57d,null));};exports[_0x1c39('0x4d')]=function(_0x1b9c6f,_0x910a61){return db[_0x1c39('0x2d')][_0x1c39('0x4e')]({'where':{'id':_0x1b9c6f[_0x1c39('0x30')][_0x1c39('0x4f')]||[]},'raw':![],'individualHooks':!![]})[_0x1c39('0x25')](respondWithResult(_0x910a61,0xcc))[_0x1c39('0x48')](handleError(_0x910a61,null));};exports['addFields']=function(_0x1428c5,_0x54506d,_0x536cb2){return db[_0x1c39('0x50')][_0x1c39('0x51')]({'where':{'id':_0x1428c5[_0x1c39('0x42')]['id']}})['then'](handleEntityNotFound(_0x54506d,null))[_0x1c39('0x25')](function(_0xbdd5e2){if(_0xbdd5e2){return db[_0x1c39('0x52')][_0x1c39('0x53')](function(_0x727524){return db['AnalyticFieldReport'][_0x1c39('0x4e')]({'where':{'CustomReportId':_0x1428c5[_0x1c39('0x42')]['id']},'transaction':_0x727524})[_0x1c39('0x25')](function(_0x517293){var _0x100a0c=_[_0x1c39('0x2c')](_0x1428c5['body'],function(_0x289eaf){delete _0x289eaf['id'];_0x289eaf[_0x1c39('0x54')]=_0x1428c5['params']['id'];return _0x289eaf;});return db[_0x1c39('0x2d')][_0x1c39('0x4b')](_0x100a0c,{'transaction':_0x727524});});})['then'](function(){return db['AnalyticFieldReport'][_0x1c39('0x3f')]({'where':{'CustomReportId':_0x1428c5['params']['id']}});});}})['then'](respondWithResult(_0x54506d,null))[_0x1c39('0x48')](handleError(_0x54506d,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index b3f756c..5e2e008 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 _0x19f8=['define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','path','../../config/environment','./analyticFieldReport.attributes','exports'];(function(_0x21c6b8,_0x16d6f6){var _0x39d474=function(_0x27dbf5){while(--_0x27dbf5){_0x21c6b8['push'](_0x21c6b8['shift']());}};_0x39d474(++_0x16d6f6);}(_0x19f8,0xad));var _0x819f=function(_0x3acb67,_0xbe0faa){_0x3acb67=_0x3acb67-0x0;var _0x534936=_0x19f8[_0x3acb67];return _0x534936;};'use strict';var _=require(_0x819f('0x0'));var util=require(_0x819f('0x1'));var logger=require(_0x819f('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x819f('0x3'));var rimraf=require('rimraf');var config=require(_0x819f('0x4'));var attributes=require(_0x819f('0x5'));module[_0x819f('0x6')]=function(_0x398af0,_0x29f4c3){return _0x398af0[_0x819f('0x7')](_0x819f('0x8'),attributes,{'tableName':_0x819f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x10dc=['path','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','api','moment','bluebird','request-promise'];(function(_0x319df2,_0x4085fb){var _0x41f9df=function(_0x8b9a53){while(--_0x8b9a53){_0x319df2['push'](_0x319df2['shift']());}};_0x41f9df(++_0x4085fb);}(_0x10dc,0x1ce));var _0xc10d=function(_0x493c7a,_0x30ea93){_0x493c7a=_0x493c7a-0x0;var _0x1ad499=_0x10dc[_0x493c7a];return _0x1ad499;};'use strict';var _=require(_0xc10d('0x0'));var util=require(_0xc10d('0x1'));var logger=require('../../config/logger')(_0xc10d('0x2'));var moment=require(_0xc10d('0x3'));var BPromise=require(_0xc10d('0x4'));var rp=require(_0xc10d('0x5'));var fs=require('fs');var path=require(_0xc10d('0x6'));var rimraf=require('rimraf');var config=require(_0xc10d('0x7'));var attributes=require(_0xc10d('0x8'));module[_0xc10d('0x9')]=function(_0x50dc39,_0xd5a77a){return _0x50dc39[_0xc10d('0xa')](_0xc10d('0xb'),attributes,{'tableName':_0xc10d('0xc'),'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 6a23bfe..368c674 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 _0xb517=['error','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x21eb73,_0x2816ef){var _0x15817a=function(_0x109cc7){while(--_0x109cc7){_0x21eb73['push'](_0x21eb73['shift']());}};_0x15817a(++_0x2816ef);}(_0xb517,0x1d0));var _0x7b51=function(_0x291f8b,_0x3b5591){_0x291f8b=_0x291f8b-0x0;var _0x275171=_0xb517[_0x291f8b];return _0x275171;};'use strict';var _=require('lodash');var util=require(_0x7b51('0x0'));var moment=require(_0x7b51('0x1'));var BPromise=require(_0x7b51('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7b51('0x3'));var db=require(_0x7b51('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b51('0x5'))(_0x7b51('0x6'));var config=require('../../config/environment');var jayson=require(_0x7b51('0x7'));var client=jayson[_0x7b51('0x8')][_0x7b51('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1da9f5,_0x113422,_0x52d9ea){return new BPromise(function(_0x164a25,_0x4dcda8){return client[_0x7b51('0xa')](_0x1da9f5,_0x52d9ea)[_0x7b51('0xb')](function(_0x2da363){logger[_0x7b51('0xc')](_0x7b51('0xd'),_0x113422,_0x7b51('0xe'));logger['debug']('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x113422,_0x7b51('0xe'),JSON[_0x7b51('0xf')](_0x2da363));if(_0x2da363[_0x7b51('0x10')]){if(_0x2da363[_0x7b51('0x10')]['code']===0x1f4){logger[_0x7b51('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x113422,_0x2da363[_0x7b51('0x10')]['message']);return _0x4dcda8(_0x2da363[_0x7b51('0x10')]['message']);}logger[_0x7b51('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x113422,_0x2da363['error'][_0x7b51('0x11')]);return _0x164a25(_0x2da363[_0x7b51('0x10')][_0x7b51('0x11')]);}else{logger['info'](_0x7b51('0xd'),_0x113422,_0x7b51('0xe'));_0x164a25(_0x2da363[_0x7b51('0x12')][_0x7b51('0x11')]);}})[_0x7b51('0x13')](function(_0x244cb9){logger[_0x7b51('0x10')](_0x7b51('0xd'),_0x113422,_0x244cb9);_0x4dcda8(_0x244cb9);});});} \ No newline at end of file +var _0x1f51=['message','info','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x265562,_0x1c42a8){var _0x120af5=function(_0x165f0d){while(--_0x165f0d){_0x265562['push'](_0x265562['shift']());}};_0x120af5(++_0x1c42a8);}(_0x1f51,0x1ea));var _0x11f5=function(_0x5b5641,_0x439102){_0x5b5641=_0x5b5641-0x0;var _0xb51db1=_0x1f51[_0x5b5641];return _0xb51db1;};'use strict';var _=require(_0x11f5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x11f5('0x1'));var rs=require(_0x11f5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x11f5('0x3'))['db'];var utils=require(_0x11f5('0x4'));var logger=require('../../config/logger')(_0x11f5('0x5'));var config=require(_0x11f5('0x6'));var jayson=require(_0x11f5('0x7'));var client=jayson['client'][_0x11f5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33c5bf,_0x1c0f1a,_0x369397){return new BPromise(function(_0x3b452f,_0x5eda88){return client['request'](_0x33c5bf,_0x369397)['then'](function(_0x1532fb){logger['info'](_0x11f5('0x9'),_0x1c0f1a,_0x11f5('0xa'));logger['debug']('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x1c0f1a,_0x11f5('0xa'),JSON[_0x11f5('0xb')](_0x1532fb));if(_0x1532fb[_0x11f5('0xc')]){if(_0x1532fb[_0x11f5('0xc')][_0x11f5('0xd')]===0x1f4){logger[_0x11f5('0xc')](_0x11f5('0x9'),_0x1c0f1a,_0x1532fb[_0x11f5('0xc')][_0x11f5('0xe')]);return _0x5eda88(_0x1532fb[_0x11f5('0xc')][_0x11f5('0xe')]);}logger['error'](_0x11f5('0x9'),_0x1c0f1a,_0x1532fb[_0x11f5('0xc')]['message']);return _0x3b452f(_0x1532fb[_0x11f5('0xc')]['message']);}else{logger[_0x11f5('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x1c0f1a,_0x11f5('0xa'));_0x3b452f(_0x1532fb[_0x11f5('0x10')]['message']);}})[_0x11f5('0x11')](function(_0x1a675b){logger['error'](_0x11f5('0x9'),_0x1c0f1a,_0x1a675b);_0x5eda88(_0x1a675b);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 8e0f766..dbb0e5c 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(_0x31b812,_0x212b99){var _0x15a5c9=function(_0x5a6088){while(--_0x5a6088){_0x31b812['push'](_0x31b812['shift']());}};_0x15a5c9(++_0x212b99);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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(_0x1c8caf,_0x49bd2a){var _0x1ff482=function(_0x470261){while(--_0x470261){_0x1c8caf['push'](_0x1c8caf['shift']());}};_0x1ff482(++_0x49bd2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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 2772bcd..7d85aab 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 _0x639a=['exports','STRING','name','TEXT'];(function(_0x243e90,_0xf6cb71){var _0x3f2699=function(_0x38f76a){while(--_0x38f76a){_0x243e90['push'](_0x243e90['shift']());}};_0x3f2699(++_0xf6cb71);}(_0x639a,0xec));var _0xa639=function(_0x2c339b,_0x153b16){_0x2c339b=_0x2c339b-0x0;var _0x558a46=_0x639a[_0x2c339b];return _0x558a46;};'use strict';var Sequelize=require('sequelize');module[_0xa639('0x0')]={'name':{'type':Sequelize[_0xa639('0x1')],'allowNull':![],'unique':_0xa639('0x2')},'table':{'type':Sequelize[_0xa639('0x1')]},'metric':{'type':Sequelize[_0xa639('0x3')]},'description':{'type':Sequelize[_0xa639('0x1')]}}; \ No newline at end of file +var _0x3a79=['TEXT','exports','STRING'];(function(_0x8c8eb7,_0x12393f){var _0x15b190=function(_0x5f14a7){while(--_0x5f14a7){_0x8c8eb7['push'](_0x8c8eb7['shift']());}};_0x15b190(++_0x12393f);}(_0x3a79,0xca));var _0x93a7=function(_0x4433db,_0x42d308){_0x4433db=_0x4433db-0x0;var _0x38bbe9=_0x3a79[_0x4433db];return _0x38bbe9;};'use strict';var Sequelize=require('sequelize');module[_0x93a7('0x0')]={'name':{'type':Sequelize[_0x93a7('0x1')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x93a7('0x1')]},'metric':{'type':Sequelize[_0x93a7('0x2')]},'description':{'type':Sequelize[_0x93a7('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index ccccfb9..491d86a 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 _0x7fbe=['util','path','sox','to-csv','ejs','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','get','UserProfileResource','destroy','end','error','stack','name','send','index','AnalyticMetric','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','rows','show','params','create','body','role','user','Metrics','find','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x20bf8b,_0xd36fdc){var _0x1a9de7=function(_0x1d0dff){while(--_0x1d0dff){_0x20bf8b['push'](_0x20bf8b['shift']());}};_0x1a9de7(++_0xd36fdc);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x34c2d4,_0x418ed2){_0x34c2d4=_0x34c2d4-0x0;var _0x38796a=_0x7fbe[_0x34c2d4];return _0x38796a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe7fb('0x0'));var jsonpatch=require(_0xe7fb('0x1'));var rp=require(_0xe7fb('0x2'));var moment=require(_0xe7fb('0x3'));var BPromise=require(_0xe7fb('0x4'));var Mustache=require(_0xe7fb('0x5'));var util=require(_0xe7fb('0x6'));var path=require(_0xe7fb('0x7'));var sox=require(_0xe7fb('0x8'));var csv=require(_0xe7fb('0x9'));var ejs=require(_0xe7fb('0xa'));var fs=require('fs');var fs_extra=require(_0xe7fb('0xb'));var _=require(_0xe7fb('0xc'));var squel=require(_0xe7fb('0xd'));var crypto=require('crypto');var jsforce=require(_0xe7fb('0xe'));var deskjs=require(_0xe7fb('0xf'));var toCsv=require(_0xe7fb('0x9'));var querystring=require(_0xe7fb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe7fb('0x11'));var qs=require(_0xe7fb('0x12'));var as=require(_0xe7fb('0x13'));var hardwareService=require(_0xe7fb('0x14'));var logger=require(_0xe7fb('0x15'))(_0xe7fb('0x16'));var utils=require(_0xe7fb('0x17'));var config=require(_0xe7fb('0x18'));var licenseUtil=require(_0xe7fb('0x19'));var db=require(_0xe7fb('0x1a'))['db'];function respondWithStatusCode(_0x2437d4,_0x188e1d){_0x188e1d=_0x188e1d||0xcc;return function(_0xdf9760){if(_0xdf9760){return _0x2437d4[_0xe7fb('0x1b')](_0x188e1d);}return _0x2437d4[_0xe7fb('0x1c')](_0x188e1d)['end']();};}function respondWithResult(_0x278b75,_0x2225e5){_0x2225e5=_0x2225e5||0xc8;return function(_0x5573ab){if(_0x5573ab){return _0x278b75[_0xe7fb('0x1c')](_0x2225e5)[_0xe7fb('0x1d')](_0x5573ab);}};}function respondWithFilteredResult(_0x482f7d,_0xa76acf){return function(_0x559129){if(_0x559129){var _0x12fff6=typeof _0xa76acf[_0xe7fb('0x1e')]===_0xe7fb('0x1f')&&typeof _0xa76acf[_0xe7fb('0x20')]==='undefined';var _0x892b0f=_0x559129['count'];var _0x293a47=_0x12fff6?0x0:_0xa76acf['offset'];var _0x1e77fd=_0x12fff6?_0x559129[_0xe7fb('0x21')]:_0xa76acf[_0xe7fb('0x1e')]+_0xa76acf[_0xe7fb('0x20')];var _0x5df1a1;if(_0x1e77fd>=_0x892b0f){_0x1e77fd=_0x892b0f;_0x5df1a1=0xc8;}else{_0x5df1a1=0xce;}_0x482f7d[_0xe7fb('0x1c')](_0x5df1a1);return _0x482f7d['set'](_0xe7fb('0x22'),_0x293a47+'-'+_0x1e77fd+'/'+_0x892b0f)['json'](_0x559129);}return null;};}function patchUpdates(_0x15f7a4){return function(_0x4ea664){try{jsonpatch[_0xe7fb('0x23')](_0x4ea664,_0x15f7a4,!![]);}catch(_0x135624){return BPromise['reject'](_0x135624);}return _0x4ea664[_0xe7fb('0x24')]();};}function saveUpdates(_0x4742bd,_0x3ae8f1){return function(_0x4dcb4b){if(_0x4dcb4b){return _0x4dcb4b[_0xe7fb('0x25')](_0x4742bd)[_0xe7fb('0x26')](function(_0x5da3d9){return _0x5da3d9;});}return null;};}function removeEntity(_0x5bea27,_0x52f08b){return function(_0x35e4db){if(_0x35e4db){return _0x35e4db['destroy']()['then'](function(){var _0x4026b1=_0x35e4db[_0xe7fb('0x27')]({'plain':!![]});var _0x2996ae='Metrics';return db[_0xe7fb('0x28')][_0xe7fb('0x29')]({'where':{'type':_0x2996ae,'resourceId':_0x4026b1['id']}})[_0xe7fb('0x26')](function(){return _0x35e4db;});})[_0xe7fb('0x26')](function(){_0x5bea27[_0xe7fb('0x1c')](0xcc)[_0xe7fb('0x2a')]();});}};}function handleEntityNotFound(_0x380130,_0x59e015){return function(_0x5df9f2){if(!_0x5df9f2){_0x380130[_0xe7fb('0x1b')](0x194);}return _0x5df9f2;};}function handleError(_0x3bdee9,_0xead63){_0xead63=_0xead63||0x1f4;return function(_0x4fd290){logger[_0xe7fb('0x2b')](_0x4fd290[_0xe7fb('0x2c')]);if(_0x4fd290[_0xe7fb('0x2d')]){delete _0x4fd290[_0xe7fb('0x2d')];}_0x3bdee9[_0xe7fb('0x1c')](_0xead63)[_0xe7fb('0x2e')](_0x4fd290);};}exports[_0xe7fb('0x2f')]=function(_0x3dd0be,_0x4ce993){var _0x3d1fb5={},_0x1742f3={},_0x29d1ca={'count':0x0,'rows':[]};var _0x547a04=_['map'](db[_0xe7fb('0x30')]['rawAttributes'],function(_0xac56b4){return{'name':_0xac56b4[_0xe7fb('0x31')],'type':_0xac56b4[_0xe7fb('0x32')][_0xe7fb('0x33')]};});_0x1742f3['model']=_[_0xe7fb('0x34')](_0x547a04,_0xe7fb('0x2d'));_0x1742f3[_0xe7fb('0x35')]=_[_0xe7fb('0x36')](_0x3dd0be[_0xe7fb('0x35')]);_0x1742f3['filters']=_[_0xe7fb('0x37')](_0x1742f3[_0xe7fb('0x38')],_0x1742f3[_0xe7fb('0x35')]);_0x3d1fb5[_0xe7fb('0x39')]=_[_0xe7fb('0x37')](_0x1742f3[_0xe7fb('0x38')],qs[_0xe7fb('0x3a')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3a')]));_0x3d1fb5['attributes']=_0x3d1fb5[_0xe7fb('0x39')][_0xe7fb('0x3b')]?_0x3d1fb5[_0xe7fb('0x39')]:_0x1742f3['model'];if(!_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3c')](_0xe7fb('0x3d'))){_0x3d1fb5[_0xe7fb('0x20')]=qs[_0xe7fb('0x20')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x20')]);_0x3d1fb5[_0xe7fb('0x1e')]=qs[_0xe7fb('0x1e')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x1e')]);}_0x3d1fb5[_0xe7fb('0x3e')]=qs[_0xe7fb('0x3f')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3f')]);_0x3d1fb5[_0xe7fb('0x40')]=qs[_0xe7fb('0x41')](_[_0xe7fb('0x42')](_0x3dd0be[_0xe7fb('0x35')],_0x1742f3['filters']),_0x547a04);if(_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x43')]){_0x3d1fb5[_0xe7fb('0x40')]=_[_0xe7fb('0x44')](_0x3d1fb5['where'],{'$or':_[_0xe7fb('0x34')](_0x547a04,function(_0x186418){if(_0x186418[_0xe7fb('0x32')]!==_0xe7fb('0x45')){var _0x49fe9d={};_0x49fe9d[_0x186418[_0xe7fb('0x2d')]]={'$like':'%'+_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x43')]+'%'};return _0x49fe9d;}})});}_0x3d1fb5=_[_0xe7fb('0x44')]({},_0x3d1fb5,_0x3dd0be[_0xe7fb('0x46')]);var _0xb729fc={'where':_0x3d1fb5['where']};return db[_0xe7fb('0x30')][_0xe7fb('0x21')](_0xb729fc)[_0xe7fb('0x26')](function(_0x4b263d){_0x29d1ca[_0xe7fb('0x21')]=_0x4b263d;if(_0x3dd0be[_0xe7fb('0x35')]['includeAll']){_0x3d1fb5['include']=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x3d1fb5);})['then'](function(_0x900d67){_0x29d1ca[_0xe7fb('0x47')]=_0x900d67;return _0x29d1ca;})[_0xe7fb('0x26')](respondWithFilteredResult(_0x4ce993,_0x3d1fb5))['catch'](handleError(_0x4ce993,null));};exports[_0xe7fb('0x48')]=function(_0x58d743,_0x19277f){var _0x32cfa4={'raw':!![],'where':{'id':_0x58d743[_0xe7fb('0x49')]['id']}},_0x4d29d3={};_0x4d29d3[_0xe7fb('0x38')]=_[_0xe7fb('0x36')](db[_0xe7fb('0x30')]['rawAttributes']);_0x4d29d3[_0xe7fb('0x35')]=_[_0xe7fb('0x36')](_0x58d743[_0xe7fb('0x35')]);_0x4d29d3['filters']=_[_0xe7fb('0x37')](_0x4d29d3[_0xe7fb('0x38')],_0x4d29d3[_0xe7fb('0x35')]);_0x32cfa4[_0xe7fb('0x39')]=_[_0xe7fb('0x37')](_0x4d29d3['model'],qs[_0xe7fb('0x3a')](_0x58d743['query'][_0xe7fb('0x3a')]));_0x32cfa4[_0xe7fb('0x39')]=_0x32cfa4[_0xe7fb('0x39')][_0xe7fb('0x3b')]?_0x32cfa4[_0xe7fb('0x39')]:_0x4d29d3['model'];if(_0x58d743[_0xe7fb('0x35')]['includeAll']){_0x32cfa4['include']=[{'all':!![]}];}_0x32cfa4=_[_0xe7fb('0x44')]({},_0x32cfa4,_0x58d743[_0xe7fb('0x46')]);return db[_0xe7fb('0x30')]['find'](_0x32cfa4)[_0xe7fb('0x26')](handleEntityNotFound(_0x19277f,null))[_0xe7fb('0x26')](respondWithResult(_0x19277f,null))['catch'](handleError(_0x19277f,null));};exports['create']=function(_0x284bcb,_0x42270b){return db[_0xe7fb('0x30')][_0xe7fb('0x4a')](_0x284bcb[_0xe7fb('0x4b')],{})[_0xe7fb('0x26')](function(_0x18a590){var _0x347177=_0x284bcb['user'][_0xe7fb('0x27')]({'plain':!![]});if(!_0x347177)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x347177[_0xe7fb('0x4c')]===_0xe7fb('0x4d')){var _0x5cedfb=_0x18a590[_0xe7fb('0x27')]({'plain':!![]});var _0x5efd24=_0xe7fb('0x4e');return db['UserProfileSection'][_0xe7fb('0x4f')]({'where':{'name':_0x5efd24,'userProfileId':_0x347177['userProfileId']},'raw':!![]})[_0xe7fb('0x26')](function(_0x59158c){if(_0x59158c&&_0x59158c[_0xe7fb('0x50')]===0x0){return db[_0xe7fb('0x28')][_0xe7fb('0x4a')]({'name':_0x5cedfb[_0xe7fb('0x2d')],'resourceId':_0x5cedfb['id'],'type':_0x59158c[_0xe7fb('0x2d')],'sectionId':_0x59158c['id']},{})[_0xe7fb('0x26')](function(){return _0x18a590;});}else{return _0x18a590;}})[_0xe7fb('0x51')](function(_0x582a4a){logger['error'](_0xe7fb('0x52'),_0x582a4a);throw _0x582a4a;});}return _0x18a590;})['then'](respondWithResult(_0x42270b,0xc9))['catch'](handleError(_0x42270b,null));};exports['update']=function(_0x50b8df,_0x539252){if(_0x50b8df[_0xe7fb('0x4b')]['id']){delete _0x50b8df[_0xe7fb('0x4b')]['id'];}return db[_0xe7fb('0x30')][_0xe7fb('0x4f')]({'where':{'id':_0x50b8df['params']['id']}})[_0xe7fb('0x26')](handleEntityNotFound(_0x539252,null))[_0xe7fb('0x26')](saveUpdates(_0x50b8df[_0xe7fb('0x4b')],null))['then'](respondWithResult(_0x539252,null))['catch'](handleError(_0x539252,null));};exports[_0xe7fb('0x29')]=function(_0x377e5f,_0x300b8e){return db['AnalyticMetric'][_0xe7fb('0x4f')]({'where':{'id':_0x377e5f[_0xe7fb('0x49')]['id']}})[_0xe7fb('0x26')](handleEntityNotFound(_0x300b8e,null))[_0xe7fb('0x26')](removeEntity(_0x300b8e,null))['catch'](handleError(_0x300b8e,null));}; \ No newline at end of file +var _0x00bb=['create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','json','undefined','limit','offset','apply','reject','update','destroy','get','Metrics','then','stack','name','send','map','AnalyticMetric','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','count','includeAll','include','findAll','rows','catch','show','params','keys','find'];(function(_0x3163ec,_0x45662c){var _0x4e6b04=function(_0x387051){while(--_0x387051){_0x3163ec['push'](_0x3163ec['shift']());}};_0x4e6b04(++_0x45662c);}(_0x00bb,0x1d8));var _0xb00b=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x00bb[_0x4e9628];return _0x27bc8c;};'use strict';var emlformat=require(_0xb00b('0x0'));var rimraf=require(_0xb00b('0x1'));var zipdir=require(_0xb00b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb00b('0x3'));var moment=require('moment');var BPromise=require(_0xb00b('0x4'));var Mustache=require(_0xb00b('0x5'));var util=require('util');var path=require(_0xb00b('0x6'));var sox=require(_0xb00b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb00b('0xe'));var authService=require(_0xb00b('0xf'));var qs=require(_0xb00b('0x10'));var as=require(_0xb00b('0x11'));var hardwareService=require(_0xb00b('0x12'));var logger=require('../../config/logger')(_0xb00b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb00b('0x14'))['db'];function respondWithStatusCode(_0x2d8ddf,_0x1be8aa){_0x1be8aa=_0x1be8aa||0xcc;return function(_0x466b9b){if(_0x466b9b){return _0x2d8ddf[_0xb00b('0x15')](_0x1be8aa);}return _0x2d8ddf[_0xb00b('0x16')](_0x1be8aa)['end']();};}function respondWithResult(_0x218de2,_0xb0d42e){_0xb0d42e=_0xb0d42e||0xc8;return function(_0x482fe6){if(_0x482fe6){return _0x218de2[_0xb00b('0x16')](_0xb0d42e)[_0xb00b('0x17')](_0x482fe6);}};}function respondWithFilteredResult(_0x540b79,_0x5da36b){return function(_0x9b471e){if(_0x9b471e){var _0x4dcd45=typeof _0x5da36b['offset']===_0xb00b('0x18')&&typeof _0x5da36b[_0xb00b('0x19')]===_0xb00b('0x18');var _0xbb72fc=_0x9b471e['count'];var _0x2a7231=_0x4dcd45?0x0:_0x5da36b['offset'];var _0x415f91=_0x4dcd45?_0x9b471e['count']:_0x5da36b[_0xb00b('0x1a')]+_0x5da36b['limit'];var _0xb26ebb;if(_0x415f91>=_0xbb72fc){_0x415f91=_0xbb72fc;_0xb26ebb=0xc8;}else{_0xb26ebb=0xce;}_0x540b79[_0xb00b('0x16')](_0xb26ebb);return _0x540b79['set']('Content-Range',_0x2a7231+'-'+_0x415f91+'/'+_0xbb72fc)[_0xb00b('0x17')](_0x9b471e);}return null;};}function patchUpdates(_0x4a334b){return function(_0x1344c4){try{jsonpatch[_0xb00b('0x1b')](_0x1344c4,_0x4a334b,!![]);}catch(_0x2fe48d){return BPromise[_0xb00b('0x1c')](_0x2fe48d);}return _0x1344c4['save']();};}function saveUpdates(_0x362ee0,_0x4df284){return function(_0x25a973){if(_0x25a973){return _0x25a973[_0xb00b('0x1d')](_0x362ee0)['then'](function(_0x231293){return _0x231293;});}return null;};}function removeEntity(_0x2896d1,_0x520444){return function(_0x3ab3cc){if(_0x3ab3cc){return _0x3ab3cc[_0xb00b('0x1e')]()['then'](function(){var _0x44efe5=_0x3ab3cc[_0xb00b('0x1f')]({'plain':!![]});var _0x3c9500=_0xb00b('0x20');return db['UserProfileResource']['destroy']({'where':{'type':_0x3c9500,'resourceId':_0x44efe5['id']}})[_0xb00b('0x21')](function(){return _0x3ab3cc;});})['then'](function(){_0x2896d1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x16ac55,_0x73b6b0){return function(_0x2592cf){if(!_0x2592cf){_0x16ac55[_0xb00b('0x15')](0x194);}return _0x2592cf;};}function handleError(_0x1f14fa,_0x197379){_0x197379=_0x197379||0x1f4;return function(_0x15d3b9){logger['error'](_0x15d3b9[_0xb00b('0x22')]);if(_0x15d3b9['name']){delete _0x15d3b9[_0xb00b('0x23')];}_0x1f14fa[_0xb00b('0x16')](_0x197379)[_0xb00b('0x24')](_0x15d3b9);};}exports['index']=function(_0x2fc11a,_0x280ed3){var _0x16fbd5={},_0x183233={},_0x303625={'count':0x0,'rows':[]};var _0x2b9824=_[_0xb00b('0x25')](db[_0xb00b('0x26')][_0xb00b('0x27')],function(_0x54e247){return{'name':_0x54e247[_0xb00b('0x28')],'type':_0x54e247[_0xb00b('0x29')]['key']};});_0x183233[_0xb00b('0x2a')]=_[_0xb00b('0x25')](_0x2b9824,'name');_0x183233[_0xb00b('0x2b')]=_['keys'](_0x2fc11a[_0xb00b('0x2b')]);_0x183233[_0xb00b('0x2c')]=_[_0xb00b('0x2d')](_0x183233[_0xb00b('0x2a')],_0x183233[_0xb00b('0x2b')]);_0x16fbd5[_0xb00b('0x2e')]=_[_0xb00b('0x2d')](_0x183233['model'],qs['fields'](_0x2fc11a['query'][_0xb00b('0x2f')]));_0x16fbd5[_0xb00b('0x2e')]=_0x16fbd5[_0xb00b('0x2e')][_0xb00b('0x30')]?_0x16fbd5['attributes']:_0x183233[_0xb00b('0x2a')];if(!_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x31')](_0xb00b('0x32'))){_0x16fbd5[_0xb00b('0x19')]=qs[_0xb00b('0x19')](_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x19')]);_0x16fbd5['offset']=qs['offset'](_0x2fc11a[_0xb00b('0x2b')]['offset']);}_0x16fbd5[_0xb00b('0x33')]=qs[_0xb00b('0x34')](_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x34')]);_0x16fbd5[_0xb00b('0x35')]=qs[_0xb00b('0x2c')](_[_0xb00b('0x36')](_0x2fc11a['query'],_0x183233[_0xb00b('0x2c')]),_0x2b9824);if(_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x37')]){_0x16fbd5[_0xb00b('0x35')]=_[_0xb00b('0x38')](_0x16fbd5[_0xb00b('0x35')],{'$or':_['map'](_0x2b9824,function(_0x36980a){if(_0x36980a[_0xb00b('0x29')]!=='VIRTUAL'){var _0x17ff34={};_0x17ff34[_0x36980a[_0xb00b('0x23')]]={'$like':'%'+_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x37')]+'%'};return _0x17ff34;}})});}_0x16fbd5=_[_0xb00b('0x38')]({},_0x16fbd5,_0x2fc11a['options']);var _0x14ff6a={'where':_0x16fbd5[_0xb00b('0x35')]};return db[_0xb00b('0x26')][_0xb00b('0x39')](_0x14ff6a)['then'](function(_0x4867fe){_0x303625[_0xb00b('0x39')]=_0x4867fe;if(_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x3a')]){_0x16fbd5[_0xb00b('0x3b')]=[{'all':!![]}];}return db[_0xb00b('0x26')][_0xb00b('0x3c')](_0x16fbd5);})[_0xb00b('0x21')](function(_0x493841){_0x303625[_0xb00b('0x3d')]=_0x493841;return _0x303625;})[_0xb00b('0x21')](respondWithFilteredResult(_0x280ed3,_0x16fbd5))[_0xb00b('0x3e')](handleError(_0x280ed3,null));};exports[_0xb00b('0x3f')]=function(_0x302ded,_0x1dc4c5){var _0x2e3d83={'raw':!![],'where':{'id':_0x302ded[_0xb00b('0x40')]['id']}},_0x974a29={};_0x974a29[_0xb00b('0x2a')]=_[_0xb00b('0x41')](db[_0xb00b('0x26')]['rawAttributes']);_0x974a29[_0xb00b('0x2b')]=_[_0xb00b('0x41')](_0x302ded[_0xb00b('0x2b')]);_0x974a29[_0xb00b('0x2c')]=_[_0xb00b('0x2d')](_0x974a29[_0xb00b('0x2a')],_0x974a29[_0xb00b('0x2b')]);_0x2e3d83[_0xb00b('0x2e')]=_[_0xb00b('0x2d')](_0x974a29[_0xb00b('0x2a')],qs[_0xb00b('0x2f')](_0x302ded[_0xb00b('0x2b')]['fields']));_0x2e3d83['attributes']=_0x2e3d83['attributes'][_0xb00b('0x30')]?_0x2e3d83[_0xb00b('0x2e')]:_0x974a29['model'];if(_0x302ded[_0xb00b('0x2b')][_0xb00b('0x3a')]){_0x2e3d83[_0xb00b('0x3b')]=[{'all':!![]}];}_0x2e3d83=_[_0xb00b('0x38')]({},_0x2e3d83,_0x302ded['options']);return db['AnalyticMetric'][_0xb00b('0x42')](_0x2e3d83)[_0xb00b('0x21')](handleEntityNotFound(_0x1dc4c5,null))['then'](respondWithResult(_0x1dc4c5,null))['catch'](handleError(_0x1dc4c5,null));};exports[_0xb00b('0x43')]=function(_0x3a205d,_0x4e0be4){return db[_0xb00b('0x26')]['create'](_0x3a205d['body'],{})['then'](function(_0x465d90){var _0x481515=_0x3a205d[_0xb00b('0x44')][_0xb00b('0x1f')]({'plain':!![]});if(!_0x481515)throw new Error(_0xb00b('0x45'));if(_0x481515[_0xb00b('0x46')]===_0xb00b('0x44')){var _0xda60ca=_0x465d90['get']({'plain':!![]});var _0x5bd40c=_0xb00b('0x20');return db[_0xb00b('0x47')]['find']({'where':{'name':_0x5bd40c,'userProfileId':_0x481515[_0xb00b('0x48')]},'raw':!![]})[_0xb00b('0x21')](function(_0x57f6ab){if(_0x57f6ab&&_0x57f6ab[_0xb00b('0x49')]===0x0){return db[_0xb00b('0x4a')][_0xb00b('0x43')]({'name':_0xda60ca['name'],'resourceId':_0xda60ca['id'],'type':_0x57f6ab['name'],'sectionId':_0x57f6ab['id']},{})[_0xb00b('0x21')](function(){return _0x465d90;});}else{return _0x465d90;}})[_0xb00b('0x3e')](function(_0x12737d){logger[_0xb00b('0x4b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x12737d);throw _0x12737d;});}return _0x465d90;})[_0xb00b('0x21')](respondWithResult(_0x4e0be4,0xc9))[_0xb00b('0x3e')](handleError(_0x4e0be4,null));};exports['update']=function(_0x4cd9fd,_0x160965){if(_0x4cd9fd['body']['id']){delete _0x4cd9fd[_0xb00b('0x4c')]['id'];}return db[_0xb00b('0x26')][_0xb00b('0x42')]({'where':{'id':_0x4cd9fd[_0xb00b('0x40')]['id']}})[_0xb00b('0x21')](handleEntityNotFound(_0x160965,null))[_0xb00b('0x21')](saveUpdates(_0x4cd9fd['body'],null))[_0xb00b('0x21')](respondWithResult(_0x160965,null))['catch'](handleError(_0x160965,null));};exports[_0xb00b('0x1e')]=function(_0x98caa9,_0x4129ba){return db['AnalyticMetric'][_0xb00b('0x42')]({'where':{'id':_0x98caa9[_0xb00b('0x40')]['id']}})[_0xb00b('0x21')](handleEntityNotFound(_0x4129ba,null))['then'](removeEntity(_0x4129ba,null))[_0xb00b('0x3e')](handleError(_0x4129ba,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 729a830..7ca6289 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 _0x3f1c=['AnalyticMetric','analytics_metrics','lodash','api','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','define'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x3f1c,0xd4));var _0xc3f1=function(_0x2ea0a2,_0xeadd1a){_0x2ea0a2=_0x2ea0a2-0x0;var _0x3d8b3c=_0x3f1c[_0x2ea0a2];return _0x3d8b3c;};'use strict';var _=require(_0xc3f1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc3f1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc3f1('0x2'));var fs=require('fs');var path=require(_0xc3f1('0x3'));var rimraf=require(_0xc3f1('0x4'));var config=require(_0xc3f1('0x5'));var attributes=require(_0xc3f1('0x6'));module['exports']=function(_0x12e78a,_0x4ebd4c){return _0x12e78a[_0xc3f1('0x7')](_0xc3f1('0x8'),attributes,{'tableName':_0xc3f1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a14=['define','AnalyticMetric','analytics_metrics','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9a14,0xa8));var _0x49a1=function(_0x24282f,_0xdec5f4){_0x24282f=_0x24282f-0x0;var _0x4d6c63=_0x9a14[_0x24282f];return _0x4d6c63;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49a1('0x0'))(_0x49a1('0x1'));var moment=require(_0x49a1('0x2'));var BPromise=require(_0x49a1('0x3'));var rp=require(_0x49a1('0x4'));var fs=require('fs');var path=require(_0x49a1('0x5'));var rimraf=require(_0x49a1('0x6'));var config=require(_0x49a1('0x7'));var attributes=require('./analyticMetric.attributes');module['exports']=function(_0x479018,_0x5283aa){return _0x479018[_0x49a1('0x8')](_0x49a1('0x9'),attributes,{'tableName':_0x49a1('0xa'),'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 78b5178..4adcf7c 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 _0x6b30=['error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x35e083,_0x3ba806){var _0x555a8a=function(_0x5a32a0){while(--_0x5a32a0){_0x35e083['push'](_0x35e083['shift']());}};_0x555a8a(++_0x3ba806);}(_0x6b30,0x14b));var _0x06b3=function(_0x30bd01,_0x557a2c){_0x30bd01=_0x30bd01-0x0;var _0x44cdc3=_0x6b30[_0x30bd01];return _0x44cdc3;};'use strict';var _=require(_0x06b3('0x0'));var util=require(_0x06b3('0x1'));var moment=require(_0x06b3('0x2'));var BPromise=require(_0x06b3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x06b3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x06b3('0x5'));var logger=require(_0x06b3('0x6'))(_0x06b3('0x7'));var config=require(_0x06b3('0x8'));var jayson=require(_0x06b3('0x9'));var client=jayson[_0x06b3('0xa')][_0x06b3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b228c,_0x5ca309,_0x4406d1){return new BPromise(function(_0x11f583,_0x259fe7){return client[_0x06b3('0xc')](_0x1b228c,_0x4406d1)[_0x06b3('0xd')](function(_0xf92b2e){logger[_0x06b3('0xe')](_0x06b3('0xf'),_0x5ca309,'request\x20sent');logger[_0x06b3('0x10')](_0x06b3('0x11'),_0x5ca309,'request\x20sent',JSON[_0x06b3('0x12')](_0xf92b2e));if(_0xf92b2e[_0x06b3('0x13')]){if(_0xf92b2e[_0x06b3('0x13')][_0x06b3('0x14')]===0x1f4){logger['error'](_0x06b3('0xf'),_0x5ca309,_0xf92b2e['error'][_0x06b3('0x15')]);return _0x259fe7(_0xf92b2e[_0x06b3('0x13')][_0x06b3('0x15')]);}logger[_0x06b3('0x13')](_0x06b3('0xf'),_0x5ca309,_0xf92b2e[_0x06b3('0x13')]['message']);return _0x11f583(_0xf92b2e[_0x06b3('0x13')]['message']);}else{logger[_0x06b3('0xe')](_0x06b3('0xf'),_0x5ca309,_0x06b3('0x16'));_0x11f583(_0xf92b2e[_0x06b3('0x17')][_0x06b3('0x15')]);}})[_0x06b3('0x18')](function(_0x1eb777){logger['error'](_0x06b3('0xf'),_0x5ca309,_0x1eb777);_0x259fe7(_0x1eb777);});});} \ No newline at end of file +var _0x4347=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','AnalyticMetric,\x20%s,\x20%s','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x2d96aa,_0x302227){var _0xba1fa1=function(_0x21ed52){while(--_0x21ed52){_0x2d96aa['push'](_0x2d96aa['shift']());}};_0xba1fa1(++_0x302227);}(_0x4347,0x13f));var _0x7434=function(_0x498334,_0x27b6fe){_0x498334=_0x498334-0x0;var _0x13bb70=_0x4347[_0x498334];return _0x13bb70;};'use strict';var _=require(_0x7434('0x0'));var util=require(_0x7434('0x1'));var moment=require(_0x7434('0x2'));var BPromise=require(_0x7434('0x3'));var rs=require(_0x7434('0x4'));var fs=require('fs');var Redis=require(_0x7434('0x5'));var db=require(_0x7434('0x6'))['db'];var utils=require(_0x7434('0x7'));var logger=require(_0x7434('0x8'))(_0x7434('0x9'));var config=require('../../config/environment');var jayson=require(_0x7434('0xa'));var client=jayson[_0x7434('0xb')][_0x7434('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x52272f,_0x445768,_0x3f986b){return new BPromise(function(_0x31ed6c,_0x1dfa88){return client['request'](_0x52272f,_0x3f986b)[_0x7434('0xd')](function(_0x2e4f47){logger[_0x7434('0xe')](_0x7434('0xf'),_0x445768,'request\x20sent');logger[_0x7434('0x10')](_0x7434('0x11'),_0x445768,_0x7434('0x12'),JSON[_0x7434('0x13')](_0x2e4f47));if(_0x2e4f47[_0x7434('0x14')]){if(_0x2e4f47[_0x7434('0x14')][_0x7434('0x15')]===0x1f4){logger['error'](_0x7434('0xf'),_0x445768,_0x2e4f47['error'][_0x7434('0x16')]);return _0x1dfa88(_0x2e4f47[_0x7434('0x14')][_0x7434('0x16')]);}logger[_0x7434('0x14')](_0x7434('0xf'),_0x445768,_0x2e4f47[_0x7434('0x14')][_0x7434('0x16')]);return _0x31ed6c(_0x2e4f47['error'][_0x7434('0x16')]);}else{logger[_0x7434('0xe')](_0x7434('0xf'),_0x445768,_0x7434('0x12'));_0x31ed6c(_0x2e4f47[_0x7434('0x17')][_0x7434('0x16')]);}})[_0x7434('0x18')](function(_0x4a83f5){logger['error'](_0x7434('0xf'),_0x445768,_0x4a83f5);_0x1dfa88(_0x4a83f5);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index e92edff..a69d04d 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 _0x3eea=['get','isAuthenticated','/:id','show','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller'];(function(_0x54a25e,_0x10311c){var _0x4f4d2b=function(_0x4f587a){while(--_0x4f587a){_0x54a25e['push'](_0x54a25e['shift']());}};_0x4f4d2b(++_0x10311c);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x19df14,_0x15cd6e){_0x19df14=_0x19df14-0x0;var _0x143c54=_0x3eea[_0x19df14];return _0x143c54;};'use strict';var multer=require(_0xa3ee('0x0'));var util=require('util');var path=require(_0xa3ee('0x1'));var timeout=require(_0xa3ee('0x2'));var express=require(_0xa3ee('0x3'));var router=express[_0xa3ee('0x4')]();var fs_extra=require(_0xa3ee('0x5'));var auth=require(_0xa3ee('0x6'));var interaction=require(_0xa3ee('0x7'));var config=require(_0xa3ee('0x8'));var controller=require(_0xa3ee('0x9'));router[_0xa3ee('0xa')]('/',auth[_0xa3ee('0xb')](),controller['index']);router['get'](_0xa3ee('0xc'),auth['isAuthenticated'](),controller[_0xa3ee('0xd')]);router['post']('/',auth[_0xa3ee('0xb')](),controller['create']);router[_0xa3ee('0xe')]('/:id',auth[_0xa3ee('0xb')](),controller[_0xa3ee('0xf')]);router[_0xa3ee('0x10')]('/:id',auth[_0xa3ee('0xb')](),controller[_0xa3ee('0x11')]);module['exports']=router; \ No newline at end of file +var _0x861a=['put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x47df54,_0x1aeb61){var _0x261b87=function(_0x54bc77){while(--_0x54bc77){_0x47df54['push'](_0x47df54['shift']());}};_0x261b87(++_0x1aeb61);}(_0x861a,0x194));var _0xa861=function(_0x95ec8a,_0x2acf88){_0x95ec8a=_0x95ec8a-0x0;var _0x5e17b0=_0x861a[_0x95ec8a];return _0x5e17b0;};'use strict';var multer=require(_0xa861('0x0'));var util=require('util');var path=require(_0xa861('0x1'));var timeout=require(_0xa861('0x2'));var express=require(_0xa861('0x3'));var router=express[_0xa861('0x4')]();var fs_extra=require(_0xa861('0x5'));var auth=require(_0xa861('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa861('0x7'));var controller=require(_0xa861('0x8'));router[_0xa861('0x9')]('/',auth[_0xa861('0xa')](),controller[_0xa861('0xb')]);router['get'](_0xa861('0xc'),auth[_0xa861('0xa')](),controller[_0xa861('0xd')]);router[_0xa861('0xe')]('/',auth[_0xa861('0xa')](),controller[_0xa861('0xf')]);router[_0xa861('0x10')](_0xa861('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xa861('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xa861('0x12')]);module[_0xa861('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 1285a37..2338178 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 _0xbf9a=['exports','TEXT'];(function(_0x4c4c86,_0x28a958){var _0x282ef8=function(_0x2f50f7){while(--_0x2f50f7){_0x4c4c86['push'](_0x4c4c86['shift']());}};_0x282ef8(++_0x28a958);}(_0xbf9a,0x18c));var _0xabf9=function(_0x2998db,_0x3424f1){_0x2998db=_0x2998db-0x0;var _0x115fea=_0xbf9a[_0x2998db];return _0x115fea;};'use strict';var Sequelize=require('sequelize');module[_0xabf9('0x0')]={'tree':{'type':Sequelize[_0xabf9('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x613c=['exports','sequelize'];(function(_0x5b4191,_0x127ecd){var _0x6da169=function(_0x18d387){while(--_0x18d387){_0x5b4191['push'](_0x5b4191['shift']());}};_0x6da169(++_0x127ecd);}(_0x613c,0xd9));var _0xc613=function(_0x1aa726,_0x2f4234){_0x1aa726=_0x1aa726-0x0;var _0x704281=_0x613c[_0x1aa726];return _0x704281;};'use strict';var Sequelize=require(_0xc613('0x0'));module[_0xc613('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 1663d95..18d8bf7 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 _0x9057=['destroy','then','error','stack','name','send','map','fieldName','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','AnalyticTreeReport','includeAll','include','findAll','rows','catch','show','rawAttributes','create','body','params','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','update'];(function(_0x29f2e7,_0x31287f){var _0x382f7b=function(_0x5bf241){while(--_0x5bf241){_0x29f2e7['push'](_0x29f2e7['shift']());}};_0x382f7b(++_0x31287f);}(_0x9057,0x154));var _0x7905=function(_0x101134,_0x1ed1d3){_0x101134=_0x101134-0x0;var _0xc47acc=_0x9057[_0x101134];return _0xc47acc;};'use strict';var emlformat=require(_0x7905('0x0'));var rimraf=require(_0x7905('0x1'));var zipdir=require(_0x7905('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7905('0x3'));var moment=require(_0x7905('0x4'));var BPromise=require(_0x7905('0x5'));var Mustache=require(_0x7905('0x6'));var util=require('util');var path=require('path');var sox=require(_0x7905('0x7'));var csv=require(_0x7905('0x8'));var ejs=require(_0x7905('0x9'));var fs=require('fs');var fs_extra=require(_0x7905('0xa'));var _=require(_0x7905('0xb'));var squel=require('squel');var crypto=require(_0x7905('0xc'));var jsforce=require(_0x7905('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7905('0x8'));var querystring=require('querystring');var Papa=require(_0x7905('0xe'));var Redis=require(_0x7905('0xf'));var authService=require(_0x7905('0x10'));var qs=require(_0x7905('0x11'));var as=require(_0x7905('0x12'));var hardwareService=require(_0x7905('0x13'));var logger=require(_0x7905('0x14'))(_0x7905('0x15'));var utils=require(_0x7905('0x16'));var config=require(_0x7905('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3bd483,_0x180c13){_0x180c13=_0x180c13||0xcc;return function(_0x2fb1dd){if(_0x2fb1dd){return _0x3bd483[_0x7905('0x18')](_0x180c13);}return _0x3bd483[_0x7905('0x19')](_0x180c13)[_0x7905('0x1a')]();};}function respondWithResult(_0x37f885,_0x49916c){_0x49916c=_0x49916c||0xc8;return function(_0x31725f){if(_0x31725f){return _0x37f885[_0x7905('0x19')](_0x49916c)[_0x7905('0x1b')](_0x31725f);}};}function respondWithFilteredResult(_0x425ae6,_0x40db76){return function(_0x1daf8a){if(_0x1daf8a){var _0x3e5b0c=typeof _0x40db76[_0x7905('0x1c')]==='undefined'&&typeof _0x40db76[_0x7905('0x1d')]===_0x7905('0x1e');var _0x5670a6=_0x1daf8a[_0x7905('0x1f')];var _0x57cd80=_0x3e5b0c?0x0:_0x40db76[_0x7905('0x1c')];var _0x6eb6f4=_0x3e5b0c?_0x1daf8a[_0x7905('0x1f')]:_0x40db76[_0x7905('0x1c')]+_0x40db76[_0x7905('0x1d')];var _0x157c22;if(_0x6eb6f4>=_0x5670a6){_0x6eb6f4=_0x5670a6;_0x157c22=0xc8;}else{_0x157c22=0xce;}_0x425ae6[_0x7905('0x19')](_0x157c22);return _0x425ae6['set'](_0x7905('0x20'),_0x57cd80+'-'+_0x6eb6f4+'/'+_0x5670a6)[_0x7905('0x1b')](_0x1daf8a);}return null;};}function patchUpdates(_0x2f72a5){return function(_0x555d37){try{jsonpatch['apply'](_0x555d37,_0x2f72a5,!![]);}catch(_0x53e719){return BPromise[_0x7905('0x21')](_0x53e719);}return _0x555d37['save']();};}function saveUpdates(_0x2e08c9,_0x136a2a){return function(_0x152f55){if(_0x152f55){return _0x152f55[_0x7905('0x22')](_0x2e08c9)['then'](function(_0x3dfdb3){return _0x3dfdb3;});}return null;};}function removeEntity(_0x2c1f85,_0x5daa8e){return function(_0x103a1b){if(_0x103a1b){return _0x103a1b[_0x7905('0x23')]()[_0x7905('0x24')](function(){_0x2c1f85[_0x7905('0x19')](0xcc)[_0x7905('0x1a')]();});}};}function handleEntityNotFound(_0x5daac2,_0x5a884e){return function(_0x2d0bc0){if(!_0x2d0bc0){_0x5daac2['sendStatus'](0x194);}return _0x2d0bc0;};}function handleError(_0x2a7619,_0x3c5b22){_0x3c5b22=_0x3c5b22||0x1f4;return function(_0x301785){logger[_0x7905('0x25')](_0x301785[_0x7905('0x26')]);if(_0x301785['name']){delete _0x301785[_0x7905('0x27')];}_0x2a7619['status'](_0x3c5b22)[_0x7905('0x28')](_0x301785);};}exports['index']=function(_0x5975ff,_0x3ddaf7){var _0x25ecce={},_0x54ac26={},_0x2401fb={'count':0x0,'rows':[]};var _0x2c81c0=_[_0x7905('0x29')](db['AnalyticTreeReport']['rawAttributes'],function(_0x5a03a8){return{'name':_0x5a03a8[_0x7905('0x2a')],'type':_0x5a03a8['type'][_0x7905('0x2b')]};});_0x54ac26['model']=_['map'](_0x2c81c0,_0x7905('0x27'));_0x54ac26[_0x7905('0x2c')]=_[_0x7905('0x2d')](_0x5975ff[_0x7905('0x2c')]);_0x54ac26[_0x7905('0x2e')]=_[_0x7905('0x2f')](_0x54ac26['model'],_0x54ac26[_0x7905('0x2c')]);_0x25ecce[_0x7905('0x30')]=_[_0x7905('0x2f')](_0x54ac26['model'],qs[_0x7905('0x31')](_0x5975ff[_0x7905('0x2c')][_0x7905('0x31')]));_0x25ecce[_0x7905('0x30')]=_0x25ecce['attributes'][_0x7905('0x32')]?_0x25ecce['attributes']:_0x54ac26[_0x7905('0x33')];if(!_0x5975ff[_0x7905('0x2c')][_0x7905('0x34')](_0x7905('0x35'))){_0x25ecce['limit']=qs['limit'](_0x5975ff[_0x7905('0x2c')][_0x7905('0x1d')]);_0x25ecce[_0x7905('0x1c')]=qs[_0x7905('0x1c')](_0x5975ff[_0x7905('0x2c')][_0x7905('0x1c')]);}_0x25ecce[_0x7905('0x36')]=qs[_0x7905('0x37')](_0x5975ff['query'][_0x7905('0x37')]);_0x25ecce[_0x7905('0x38')]=qs[_0x7905('0x2e')](_[_0x7905('0x39')](_0x5975ff[_0x7905('0x2c')],_0x54ac26[_0x7905('0x2e')]),_0x2c81c0);if(_0x5975ff['query'][_0x7905('0x3a')]){_0x25ecce['where']=_[_0x7905('0x3b')](_0x25ecce[_0x7905('0x38')],{'$or':_[_0x7905('0x29')](_0x2c81c0,function(_0x539424){if(_0x539424[_0x7905('0x3c')]!==_0x7905('0x3d')){var _0x2280c4={};_0x2280c4[_0x539424[_0x7905('0x27')]]={'$like':'%'+_0x5975ff[_0x7905('0x2c')]['filter']+'%'};return _0x2280c4;}})});}_0x25ecce=_[_0x7905('0x3b')]({},_0x25ecce,_0x5975ff[_0x7905('0x3e')]);var _0x4b5704={'where':_0x25ecce[_0x7905('0x38')]};return db[_0x7905('0x3f')][_0x7905('0x1f')](_0x4b5704)[_0x7905('0x24')](function(_0x1e62ec){_0x2401fb[_0x7905('0x1f')]=_0x1e62ec;if(_0x5975ff[_0x7905('0x2c')][_0x7905('0x40')]){_0x25ecce[_0x7905('0x41')]=[{'all':!![]}];}return db[_0x7905('0x3f')][_0x7905('0x42')](_0x25ecce);})['then'](function(_0xf05f56){_0x2401fb[_0x7905('0x43')]=_0xf05f56;return _0x2401fb;})[_0x7905('0x24')](respondWithFilteredResult(_0x3ddaf7,_0x25ecce))[_0x7905('0x44')](handleError(_0x3ddaf7,null));};exports[_0x7905('0x45')]=function(_0xd3d0f,_0x2c137a){var _0x362f68={'raw':!![],'where':{'id':_0xd3d0f['params']['id']}},_0x5369be={};_0x5369be[_0x7905('0x33')]=_[_0x7905('0x2d')](db['AnalyticTreeReport'][_0x7905('0x46')]);_0x5369be[_0x7905('0x2c')]=_['keys'](_0xd3d0f[_0x7905('0x2c')]);_0x5369be[_0x7905('0x2e')]=_[_0x7905('0x2f')](_0x5369be['model'],_0x5369be[_0x7905('0x2c')]);_0x362f68[_0x7905('0x30')]=_[_0x7905('0x2f')](_0x5369be[_0x7905('0x33')],qs['fields'](_0xd3d0f['query']['fields']));_0x362f68[_0x7905('0x30')]=_0x362f68[_0x7905('0x30')][_0x7905('0x32')]?_0x362f68[_0x7905('0x30')]:_0x5369be[_0x7905('0x33')];if(_0xd3d0f['query'][_0x7905('0x40')]){_0x362f68[_0x7905('0x41')]=[{'all':!![]}];}_0x362f68=_[_0x7905('0x3b')]({},_0x362f68,_0xd3d0f['options']);return db[_0x7905('0x3f')]['find'](_0x362f68)[_0x7905('0x24')](handleEntityNotFound(_0x2c137a,null))['then'](respondWithResult(_0x2c137a,null))[_0x7905('0x44')](handleError(_0x2c137a,null));};exports['create']=function(_0x382ea6,_0x1ecf31){return db['AnalyticTreeReport'][_0x7905('0x47')](_0x382ea6[_0x7905('0x48')],{})[_0x7905('0x24')](respondWithResult(_0x1ecf31,0xc9))[_0x7905('0x44')](handleError(_0x1ecf31,null));};exports[_0x7905('0x22')]=function(_0x118e2b,_0x577724){if(_0x118e2b[_0x7905('0x48')]['id']){delete _0x118e2b['body']['id'];}return db[_0x7905('0x3f')]['find']({'where':{'id':_0x118e2b[_0x7905('0x49')]['id']}})[_0x7905('0x24')](handleEntityNotFound(_0x577724,null))['then'](saveUpdates(_0x118e2b[_0x7905('0x48')],null))[_0x7905('0x24')](respondWithResult(_0x577724,null))[_0x7905('0x44')](handleError(_0x577724,null));};exports[_0x7905('0x23')]=function(_0x5c0988,_0x247325){return db[_0x7905('0x3f')][_0x7905('0x4a')]({'where':{'id':_0x5c0988[_0x7905('0x49')]['id']}})['then'](handleEntityNotFound(_0x247325,null))['then'](removeEntity(_0x247325,null))[_0x7905('0x44')](handleError(_0x247325,null));}; \ No newline at end of file +var _0xf8b8=['to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','offset','count','set','Content-Range','json','apply','then','destroy','stack','name','map','rawAttributes','fieldName','type','keys','filters','intersection','model','attributes','fields','query','hasOwnProperty','nolimit','pick','filter','merge','where','VIRTUAL','options','AnalyticTreeReport','includeAll','findAll','rows','catch','params','length','include','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x3b2244,_0x54873f){var _0x2dcc14=function(_0x53d73f){while(--_0x53d73f){_0x3b2244['push'](_0x3b2244['shift']());}};_0x2dcc14(++_0x54873f);}(_0xf8b8,0x165));var _0x8f8b=function(_0x5bf57f,_0x246334){_0x5bf57f=_0x5bf57f-0x0;var _0x114587=_0xf8b8[_0x5bf57f];return _0x114587;};'use strict';var emlformat=require(_0x8f8b('0x0'));var rimraf=require(_0x8f8b('0x1'));var zipdir=require(_0x8f8b('0x2'));var jsonpatch=require(_0x8f8b('0x3'));var rp=require(_0x8f8b('0x4'));var moment=require('moment');var BPromise=require(_0x8f8b('0x5'));var Mustache=require(_0x8f8b('0x6'));var util=require(_0x8f8b('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x8f8b('0x8'));var ejs=require(_0x8f8b('0x9'));var fs=require('fs');var fs_extra=require(_0x8f8b('0xa'));var _=require(_0x8f8b('0xb'));var squel=require('squel');var crypto=require(_0x8f8b('0xc'));var jsforce=require(_0x8f8b('0xd'));var deskjs=require(_0x8f8b('0xe'));var toCsv=require(_0x8f8b('0x8'));var querystring=require(_0x8f8b('0xf'));var Papa=require(_0x8f8b('0x10'));var Redis=require(_0x8f8b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8f8b('0x12'));var as=require(_0x8f8b('0x13'));var hardwareService=require(_0x8f8b('0x14'));var logger=require(_0x8f8b('0x15'))(_0x8f8b('0x16'));var utils=require(_0x8f8b('0x17'));var config=require(_0x8f8b('0x18'));var licenseUtil=require(_0x8f8b('0x19'));var db=require(_0x8f8b('0x1a'))['db'];function respondWithStatusCode(_0x41a1aa,_0xbc6acf){_0xbc6acf=_0xbc6acf||0xcc;return function(_0x3ed435){if(_0x3ed435){return _0x41a1aa[_0x8f8b('0x1b')](_0xbc6acf);}return _0x41a1aa['status'](_0xbc6acf)[_0x8f8b('0x1c')]();};}function respondWithResult(_0x16174e,_0x2c527f){_0x2c527f=_0x2c527f||0xc8;return function(_0x5f342f){if(_0x5f342f){return _0x16174e[_0x8f8b('0x1d')](_0x2c527f)['json'](_0x5f342f);}};}function respondWithFilteredResult(_0x20bdc9,_0x1b2814){return function(_0x16073b){if(_0x16073b){var _0x3bb2ca=typeof _0x1b2814['offset']===_0x8f8b('0x1e')&&typeof _0x1b2814[_0x8f8b('0x1f')]===_0x8f8b('0x1e');var _0x36a3e1=_0x16073b['count'];var _0x55a467=_0x3bb2ca?0x0:_0x1b2814[_0x8f8b('0x20')];var _0x2ded88=_0x3bb2ca?_0x16073b[_0x8f8b('0x21')]:_0x1b2814[_0x8f8b('0x20')]+_0x1b2814['limit'];var _0x53f169;if(_0x2ded88>=_0x36a3e1){_0x2ded88=_0x36a3e1;_0x53f169=0xc8;}else{_0x53f169=0xce;}_0x20bdc9[_0x8f8b('0x1d')](_0x53f169);return _0x20bdc9[_0x8f8b('0x22')](_0x8f8b('0x23'),_0x55a467+'-'+_0x2ded88+'/'+_0x36a3e1)[_0x8f8b('0x24')](_0x16073b);}return null;};}function patchUpdates(_0x39d965){return function(_0x25b412){try{jsonpatch[_0x8f8b('0x25')](_0x25b412,_0x39d965,!![]);}catch(_0x5551b2){return BPromise['reject'](_0x5551b2);}return _0x25b412['save']();};}function saveUpdates(_0x3e11b9,_0x409916){return function(_0x2c40e3){if(_0x2c40e3){return _0x2c40e3['update'](_0x3e11b9)[_0x8f8b('0x26')](function(_0x2c3db2){return _0x2c3db2;});}return null;};}function removeEntity(_0xc6b6a,_0x43c6f4){return function(_0x1fdf48){if(_0x1fdf48){return _0x1fdf48[_0x8f8b('0x27')]()['then'](function(){_0xc6b6a[_0x8f8b('0x1d')](0xcc)[_0x8f8b('0x1c')]();});}};}function handleEntityNotFound(_0xf7ea3c,_0x5a2983){return function(_0x21b896){if(!_0x21b896){_0xf7ea3c[_0x8f8b('0x1b')](0x194);}return _0x21b896;};}function handleError(_0x525597,_0x58bcb6){_0x58bcb6=_0x58bcb6||0x1f4;return function(_0x1d521c){logger['error'](_0x1d521c[_0x8f8b('0x28')]);if(_0x1d521c[_0x8f8b('0x29')]){delete _0x1d521c[_0x8f8b('0x29')];}_0x525597[_0x8f8b('0x1d')](_0x58bcb6)['send'](_0x1d521c);};}exports['index']=function(_0x4b80f2,_0x7718ab){var _0x924e86={},_0x6f9d1d={},_0x5efcd0={'count':0x0,'rows':[]};var _0x36e38d=_[_0x8f8b('0x2a')](db['AnalyticTreeReport'][_0x8f8b('0x2b')],function(_0x169b57){return{'name':_0x169b57[_0x8f8b('0x2c')],'type':_0x169b57[_0x8f8b('0x2d')]['key']};});_0x6f9d1d['model']=_[_0x8f8b('0x2a')](_0x36e38d,_0x8f8b('0x29'));_0x6f9d1d['query']=_[_0x8f8b('0x2e')](_0x4b80f2['query']);_0x6f9d1d[_0x8f8b('0x2f')]=_[_0x8f8b('0x30')](_0x6f9d1d[_0x8f8b('0x31')],_0x6f9d1d['query']);_0x924e86[_0x8f8b('0x32')]=_[_0x8f8b('0x30')](_0x6f9d1d[_0x8f8b('0x31')],qs[_0x8f8b('0x33')](_0x4b80f2[_0x8f8b('0x34')][_0x8f8b('0x33')]));_0x924e86['attributes']=_0x924e86[_0x8f8b('0x32')]['length']?_0x924e86[_0x8f8b('0x32')]:_0x6f9d1d['model'];if(!_0x4b80f2[_0x8f8b('0x34')][_0x8f8b('0x35')](_0x8f8b('0x36'))){_0x924e86[_0x8f8b('0x1f')]=qs[_0x8f8b('0x1f')](_0x4b80f2[_0x8f8b('0x34')][_0x8f8b('0x1f')]);_0x924e86[_0x8f8b('0x20')]=qs[_0x8f8b('0x20')](_0x4b80f2[_0x8f8b('0x34')]['offset']);}_0x924e86['order']=qs['sort'](_0x4b80f2['query']['sort']);_0x924e86['where']=qs[_0x8f8b('0x2f')](_[_0x8f8b('0x37')](_0x4b80f2['query'],_0x6f9d1d[_0x8f8b('0x2f')]),_0x36e38d);if(_0x4b80f2['query'][_0x8f8b('0x38')]){_0x924e86['where']=_[_0x8f8b('0x39')](_0x924e86[_0x8f8b('0x3a')],{'$or':_[_0x8f8b('0x2a')](_0x36e38d,function(_0x9b475f){if(_0x9b475f[_0x8f8b('0x2d')]!==_0x8f8b('0x3b')){var _0x2c9c35={};_0x2c9c35[_0x9b475f[_0x8f8b('0x29')]]={'$like':'%'+_0x4b80f2[_0x8f8b('0x34')][_0x8f8b('0x38')]+'%'};return _0x2c9c35;}})});}_0x924e86=_[_0x8f8b('0x39')]({},_0x924e86,_0x4b80f2[_0x8f8b('0x3c')]);var _0x26fd0b={'where':_0x924e86[_0x8f8b('0x3a')]};return db[_0x8f8b('0x3d')]['count'](_0x26fd0b)[_0x8f8b('0x26')](function(_0x46e34a){_0x5efcd0[_0x8f8b('0x21')]=_0x46e34a;if(_0x4b80f2[_0x8f8b('0x34')][_0x8f8b('0x3e')]){_0x924e86['include']=[{'all':!![]}];}return db[_0x8f8b('0x3d')][_0x8f8b('0x3f')](_0x924e86);})[_0x8f8b('0x26')](function(_0x3b74fb){_0x5efcd0[_0x8f8b('0x40')]=_0x3b74fb;return _0x5efcd0;})[_0x8f8b('0x26')](respondWithFilteredResult(_0x7718ab,_0x924e86))[_0x8f8b('0x41')](handleError(_0x7718ab,null));};exports['show']=function(_0x16e6b6,_0xa8901a){var _0x5f4b95={'raw':!![],'where':{'id':_0x16e6b6[_0x8f8b('0x42')]['id']}},_0x599db0={};_0x599db0[_0x8f8b('0x31')]=_[_0x8f8b('0x2e')](db[_0x8f8b('0x3d')][_0x8f8b('0x2b')]);_0x599db0[_0x8f8b('0x34')]=_[_0x8f8b('0x2e')](_0x16e6b6[_0x8f8b('0x34')]);_0x599db0['filters']=_['intersection'](_0x599db0[_0x8f8b('0x31')],_0x599db0['query']);_0x5f4b95[_0x8f8b('0x32')]=_[_0x8f8b('0x30')](_0x599db0[_0x8f8b('0x31')],qs[_0x8f8b('0x33')](_0x16e6b6[_0x8f8b('0x34')][_0x8f8b('0x33')]));_0x5f4b95[_0x8f8b('0x32')]=_0x5f4b95[_0x8f8b('0x32')][_0x8f8b('0x43')]?_0x5f4b95[_0x8f8b('0x32')]:_0x599db0[_0x8f8b('0x31')];if(_0x16e6b6[_0x8f8b('0x34')][_0x8f8b('0x3e')]){_0x5f4b95[_0x8f8b('0x44')]=[{'all':!![]}];}_0x5f4b95=_[_0x8f8b('0x39')]({},_0x5f4b95,_0x16e6b6[_0x8f8b('0x3c')]);return db[_0x8f8b('0x3d')][_0x8f8b('0x45')](_0x5f4b95)[_0x8f8b('0x26')](handleEntityNotFound(_0xa8901a,null))[_0x8f8b('0x26')](respondWithResult(_0xa8901a,null))['catch'](handleError(_0xa8901a,null));};exports[_0x8f8b('0x46')]=function(_0x526bfa,_0x27b6a9){return db[_0x8f8b('0x3d')][_0x8f8b('0x46')](_0x526bfa[_0x8f8b('0x47')],{})[_0x8f8b('0x26')](respondWithResult(_0x27b6a9,0xc9))[_0x8f8b('0x41')](handleError(_0x27b6a9,null));};exports[_0x8f8b('0x48')]=function(_0x23cf3b,_0x2c623f){if(_0x23cf3b[_0x8f8b('0x47')]['id']){delete _0x23cf3b[_0x8f8b('0x47')]['id'];}return db[_0x8f8b('0x3d')]['find']({'where':{'id':_0x23cf3b[_0x8f8b('0x42')]['id']}})[_0x8f8b('0x26')](handleEntityNotFound(_0x2c623f,null))[_0x8f8b('0x26')](saveUpdates(_0x23cf3b[_0x8f8b('0x47')],null))[_0x8f8b('0x26')](respondWithResult(_0x2c623f,null))[_0x8f8b('0x41')](handleError(_0x2c623f,null));};exports['destroy']=function(_0x190bc6,_0x102f8c){return db[_0x8f8b('0x3d')]['find']({'where':{'id':_0x190bc6[_0x8f8b('0x42')]['id']}})['then'](handleEntityNotFound(_0x102f8c,null))[_0x8f8b('0x26')](removeEntity(_0x102f8c,null))['catch'](handleError(_0x102f8c,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 6c2ff7d..38126b3 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 _0x3aec=['AnalyticTreeReport','analytics_report_trees','../../config/logger','api','moment','../../config/environment','./analyticTreeReport.attributes','exports','define'];(function(_0x14f445,_0x2b24f9){var _0x3d4951=function(_0x2a5573){while(--_0x2a5573){_0x14f445['push'](_0x14f445['shift']());}};_0x3d4951(++_0x2b24f9);}(_0x3aec,0xfe));var _0xc3ae=function(_0x22f85a,_0x195ed5){_0x22f85a=_0x22f85a-0x0;var _0xaa717=_0x3aec[_0x22f85a];return _0xaa717;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc3ae('0x0'))(_0xc3ae('0x1'));var moment=require(_0xc3ae('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc3ae('0x3'));var attributes=require(_0xc3ae('0x4'));module[_0xc3ae('0x5')]=function(_0x5d58a1,_0x7240de){return _0x5d58a1[_0xc3ae('0x6')](_0xc3ae('0x7'),attributes,{'tableName':_0xc3ae('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda57=['bluebird','request-promise','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','lodash','util','moment'];(function(_0x27d66e,_0x1eeff6){var _0x2f7081=function(_0x2f8d23){while(--_0x2f8d23){_0x27d66e['push'](_0x27d66e['shift']());}};_0x2f7081(++_0x1eeff6);}(_0xda57,0x105));var _0x7da5=function(_0x5a7883,_0x384049){_0x5a7883=_0x5a7883-0x0;var _0x17c8da=_0xda57[_0x5a7883];return _0x17c8da;};'use strict';var _=require(_0x7da5('0x0'));var util=require(_0x7da5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7da5('0x2'));var BPromise=require(_0x7da5('0x3'));var rp=require(_0x7da5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7da5('0x5'));var config=require(_0x7da5('0x6'));var attributes=require(_0x7da5('0x7'));module[_0x7da5('0x8')]=function(_0x4692f4,_0x9f6bc7){return _0x4692f4[_0x7da5('0x9')](_0x7da5('0xa'),attributes,{'tableName':'analytics_report_trees','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 094494b..de3c876 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(_0x1ed791,_0x3c86aa){var _0xea6482=function(_0x168cc9){while(--_0x168cc9){_0x1ed791['push'](_0x1ed791['shift']());}};_0xea6482(++_0x3c86aa);}(_0x2ef3,0xba));var _0x32ef=function(_0x22afde,_0x4ae892){_0x22afde=_0x22afde-0x0;var _0x19651b=_0x2ef3[_0x22afde];return _0x19651b;};'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 _0x1261=['then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x5f47c0,_0x30671c){var _0x52639d=function(_0x35cfd7){while(--_0x35cfd7){_0x5f47c0['push'](_0x5f47c0['shift']());}};_0x52639d(++_0x30671c);}(_0x1261,0x144));var _0x1126=function(_0x1265ed,_0x4b85e8){_0x1265ed=_0x1265ed-0x0;var _0x5ac459=_0x1261[_0x1265ed];return _0x5ac459;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 510bc05..b5ecef3 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 _0x3dc2=['create','put','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','post'];(function(_0x1121db,_0x54f0a1){var _0x54dae0=function(_0x46e738){while(--_0x46e738){_0x1121db['push'](_0x1121db['shift']());}};_0x54dae0(++_0x54f0a1);}(_0x3dc2,0x1f2));var _0x23dc=function(_0x5dc3b2,_0x4a4d7f){_0x5dc3b2=_0x5dc3b2-0x0;var _0x4e3382=_0x3dc2[_0x5dc3b2];return _0x4e3382;};'use strict';var multer=require(_0x23dc('0x0'));var util=require(_0x23dc('0x1'));var path=require('path');var timeout=require(_0x23dc('0x2'));var express=require('express');var router=express[_0x23dc('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x23dc('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x23dc('0x5'));var controller=require('./analyticTreeReport.controller');router['get']('/',auth[_0x23dc('0x6')](),controller[_0x23dc('0x7')]);router[_0x23dc('0x8')](_0x23dc('0x9'),auth['isAuthenticated'](),controller[_0x23dc('0xa')]);router[_0x23dc('0xb')]('/',auth[_0x23dc('0x6')](),controller[_0x23dc('0xc')]);router[_0x23dc('0xd')](_0x23dc('0x9'),auth[_0x23dc('0x6')](),controller['update']);router[_0x23dc('0xe')](_0x23dc('0x9'),auth[_0x23dc('0x6')](),controller[_0x23dc('0xf')]);module[_0x23dc('0x10')]=router; \ No newline at end of file +var _0x7d7b=['/:id','show','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index'];(function(_0x52138f,_0x18dbd6){var _0x3b1572=function(_0x56fa7f){while(--_0x56fa7f){_0x52138f['push'](_0x52138f['shift']());}};_0x3b1572(++_0x18dbd6);}(_0x7d7b,0xd3));var _0xb7d7=function(_0x24f03d,_0x128f52){_0x24f03d=_0x24f03d-0x0;var _0xa80509=_0x7d7b[_0x24f03d];return _0xa80509;};'use strict';var multer=require('multer');var util=require(_0xb7d7('0x0'));var path=require(_0xb7d7('0x1'));var timeout=require(_0xb7d7('0x2'));var express=require(_0xb7d7('0x3'));var router=express[_0xb7d7('0x4')]();var fs_extra=require(_0xb7d7('0x5'));var auth=require(_0xb7d7('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticTreeReport.controller');router[_0xb7d7('0x7')]('/',auth[_0xb7d7('0x8')](),controller[_0xb7d7('0x9')]);router['get'](_0xb7d7('0xa'),auth[_0xb7d7('0x8')](),controller[_0xb7d7('0xb')]);router['post']('/',auth[_0xb7d7('0x8')](),controller['create']);router[_0xb7d7('0xc')]('/:id',auth[_0xb7d7('0x8')](),controller[_0xb7d7('0xd')]);router[_0xb7d7('0xe')](_0xb7d7('0xa'),auth[_0xb7d7('0x8')](),controller[_0xb7d7('0xf')]);module[_0xb7d7('0x10')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index f5ed718..3dfd8a9 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 _0x46fc=['STRING','sequelize','exports'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x46fc,0x103));var _0xc46f=function(_0x4ca26c,_0x44d6f1){_0x4ca26c=_0x4ca26c-0x0;var _0x25b914=_0x46fc[_0x4ca26c];return _0x25b914;};'use strict';var Sequelize=require(_0xc46f('0x0'));module[_0xc46f('0x1')]={'name':{'type':Sequelize[_0xc46f('0x2')]},'basename':{'type':Sequelize[_0xc46f('0x2')]},'type':{'type':Sequelize[_0xc46f('0x2')]}}; \ No newline at end of file +var _0x0a9a=['STRING','exports'];(function(_0x19212f,_0x2307be){var _0x4fc573=function(_0x55827f){while(--_0x55827f){_0x19212f['push'](_0x19212f['shift']());}};_0x4fc573(++_0x2307be);}(_0x0a9a,0x183));var _0xa0a9=function(_0x1bfe4c,_0x58522c){_0x1bfe4c=_0x1bfe4c-0x0;var _0x538345=_0x0a9a[_0x1bfe4c];return _0x538345;};'use strict';var Sequelize=require('sequelize');module[_0xa0a9('0x0')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0xa0a9('0x1')]},'type':{'type':Sequelize[_0xa0a9('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index aa57b50..1f430da 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 _0xc2e9=['lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','apply','reject','update','then','destroy','error','stack','name','index','map','Attachment','rawAttributes','fieldName','key','keys','query','filters','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','includeAll','include','catch','show','params','intersection','options','find','clone','get','omit','updatedAt','body','createdAt','create','file','originalname','filename','mimetype','download','findOne','server/files/attachments/','join','offline-chat/','basename','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0xc2e9,0x1f4));var _0x9c2e=function(_0x47db8d,_0x268411){_0x47db8d=_0x47db8d-0x0;var _0x3283ef=_0xc2e9[_0x47db8d];return _0x3283ef;};'use strict';var emlformat=require(_0x9c2e('0x0'));var rimraf=require(_0x9c2e('0x1'));var zipdir=require(_0x9c2e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9c2e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9c2e('0x4'));var util=require(_0x9c2e('0x5'));var path=require(_0x9c2e('0x6'));var sox=require(_0x9c2e('0x7'));var csv=require(_0x9c2e('0x8'));var ejs=require(_0x9c2e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9c2e('0xa'));var squel=require(_0x9c2e('0xb'));var crypto=require('crypto');var jsforce=require(_0x9c2e('0xc'));var deskjs=require(_0x9c2e('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9c2e('0xe'));var Papa=require(_0x9c2e('0xf'));var Redis=require(_0x9c2e('0x10'));var authService=require(_0x9c2e('0x11'));var qs=require(_0x9c2e('0x12'));var as=require(_0x9c2e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x9c2e('0x14'));var licenseUtil=require(_0x9c2e('0x15'));var db=require(_0x9c2e('0x16'))['db'];function respondWithStatusCode(_0x31a719,_0xe1a4d){_0xe1a4d=_0xe1a4d||0xcc;return function(_0x5571b1){if(_0x5571b1){return _0x31a719[_0x9c2e('0x17')](_0xe1a4d);}return _0x31a719['status'](_0xe1a4d)[_0x9c2e('0x18')]();};}function respondWithResult(_0x4aa843,_0x39e132){_0x39e132=_0x39e132||0xc8;return function(_0x19d144){if(_0x19d144){return _0x4aa843['status'](_0x39e132)[_0x9c2e('0x19')](_0x19d144);}};}function respondWithFilteredResult(_0x3a5e8d,_0x91b655){return function(_0xb8a614){if(_0xb8a614){var _0xa2a9b=typeof _0x91b655[_0x9c2e('0x1a')]===_0x9c2e('0x1b')&&typeof _0x91b655[_0x9c2e('0x1c')]==='undefined';var _0x56c9d9=_0xb8a614[_0x9c2e('0x1d')];var _0x55d7b6=_0xa2a9b?0x0:_0x91b655[_0x9c2e('0x1a')];var _0x1961b7=_0xa2a9b?_0xb8a614['count']:_0x91b655[_0x9c2e('0x1a')]+_0x91b655[_0x9c2e('0x1c')];var _0x58c911;if(_0x1961b7>=_0x56c9d9){_0x1961b7=_0x56c9d9;_0x58c911=0xc8;}else{_0x58c911=0xce;}_0x3a5e8d[_0x9c2e('0x1e')](_0x58c911);return _0x3a5e8d['set']('Content-Range',_0x55d7b6+'-'+_0x1961b7+'/'+_0x56c9d9)['json'](_0xb8a614);}return null;};}function patchUpdates(_0x1fff81){return function(_0x462130){try{jsonpatch[_0x9c2e('0x1f')](_0x462130,_0x1fff81,!![]);}catch(_0x2edf21){return BPromise[_0x9c2e('0x20')](_0x2edf21);}return _0x462130['save']();};}function saveUpdates(_0x4910ef,_0x389102){return function(_0xfd9df6){if(_0xfd9df6){return _0xfd9df6[_0x9c2e('0x21')](_0x4910ef)[_0x9c2e('0x22')](function(_0x318395){return _0x318395;});}return null;};}function removeEntity(_0x48ba09,_0x2dd314){return function(_0x29fb74){if(_0x29fb74){return _0x29fb74[_0x9c2e('0x23')]()['then'](function(){_0x48ba09[_0x9c2e('0x1e')](0xcc)[_0x9c2e('0x18')]();});}};}function handleEntityNotFound(_0x3f03dc,_0x157630){return function(_0xda0f54){if(!_0xda0f54){_0x3f03dc[_0x9c2e('0x17')](0x194);}return _0xda0f54;};}function handleError(_0x6cfc13,_0x5cc656){_0x5cc656=_0x5cc656||0x1f4;return function(_0x4ecf1c){logger[_0x9c2e('0x24')](_0x4ecf1c[_0x9c2e('0x25')]);if(_0x4ecf1c[_0x9c2e('0x26')]){delete _0x4ecf1c[_0x9c2e('0x26')];}_0x6cfc13['status'](_0x5cc656)['send'](_0x4ecf1c);};}exports[_0x9c2e('0x27')]=function(_0x44f003,_0x411254){var _0x1e5b38={},_0x519601={},_0x2b5949={'count':0x0,'rows':[]};var _0x4b4cfa=_[_0x9c2e('0x28')](db[_0x9c2e('0x29')][_0x9c2e('0x2a')],function(_0x23bd4c){return{'name':_0x23bd4c[_0x9c2e('0x2b')],'type':_0x23bd4c['type'][_0x9c2e('0x2c')]};});_0x519601['model']=_[_0x9c2e('0x28')](_0x4b4cfa,_0x9c2e('0x26'));_0x519601['query']=_[_0x9c2e('0x2d')](_0x44f003[_0x9c2e('0x2e')]);_0x519601[_0x9c2e('0x2f')]=_['intersection'](_0x519601[_0x9c2e('0x30')],_0x519601[_0x9c2e('0x2e')]);_0x1e5b38[_0x9c2e('0x31')]=_['intersection'](_0x519601[_0x9c2e('0x30')],qs['fields'](_0x44f003[_0x9c2e('0x2e')][_0x9c2e('0x32')]));_0x1e5b38[_0x9c2e('0x31')]=_0x1e5b38[_0x9c2e('0x31')][_0x9c2e('0x33')]?_0x1e5b38['attributes']:_0x519601[_0x9c2e('0x30')];if(!_0x44f003[_0x9c2e('0x2e')][_0x9c2e('0x34')]('nolimit')){_0x1e5b38[_0x9c2e('0x1c')]=qs[_0x9c2e('0x1c')](_0x44f003[_0x9c2e('0x2e')][_0x9c2e('0x1c')]);_0x1e5b38[_0x9c2e('0x1a')]=qs[_0x9c2e('0x1a')](_0x44f003[_0x9c2e('0x2e')][_0x9c2e('0x1a')]);}_0x1e5b38[_0x9c2e('0x35')]=qs[_0x9c2e('0x36')](_0x44f003['query'][_0x9c2e('0x36')]);_0x1e5b38[_0x9c2e('0x37')]=qs[_0x9c2e('0x2f')](_[_0x9c2e('0x38')](_0x44f003[_0x9c2e('0x2e')],_0x519601[_0x9c2e('0x2f')]),_0x4b4cfa);if(_0x44f003[_0x9c2e('0x2e')][_0x9c2e('0x39')]){_0x1e5b38[_0x9c2e('0x37')]=_[_0x9c2e('0x3a')](_0x1e5b38[_0x9c2e('0x37')],{'$or':_[_0x9c2e('0x28')](_0x4b4cfa,function(_0x493e84){if(_0x493e84[_0x9c2e('0x3b')]!=='VIRTUAL'){var _0xd9a530={};_0xd9a530[_0x493e84[_0x9c2e('0x26')]]={'$like':'%'+_0x44f003[_0x9c2e('0x2e')][_0x9c2e('0x39')]+'%'};return _0xd9a530;}})});}_0x1e5b38=_[_0x9c2e('0x3a')]({},_0x1e5b38,_0x44f003['options']);var _0x31eb42={'where':_0x1e5b38[_0x9c2e('0x37')]};return db[_0x9c2e('0x29')][_0x9c2e('0x1d')](_0x31eb42)[_0x9c2e('0x22')](function(_0x3eade4){_0x2b5949[_0x9c2e('0x1d')]=_0x3eade4;if(_0x44f003[_0x9c2e('0x2e')][_0x9c2e('0x3c')]){_0x1e5b38[_0x9c2e('0x3d')]=[{'all':!![]}];}return db[_0x9c2e('0x29')]['findAll'](_0x1e5b38);})[_0x9c2e('0x22')](function(_0x3d3ac0){_0x2b5949['rows']=_0x3d3ac0;return _0x2b5949;})[_0x9c2e('0x22')](respondWithFilteredResult(_0x411254,_0x1e5b38))[_0x9c2e('0x3e')](handleError(_0x411254,null));};exports[_0x9c2e('0x3f')]=function(_0x31ce09,_0x542de2){var _0x519fd1={'raw':!![],'where':{'id':_0x31ce09[_0x9c2e('0x40')]['id']}},_0x3dc042={};_0x3dc042['model']=_[_0x9c2e('0x2d')](db[_0x9c2e('0x29')][_0x9c2e('0x2a')]);_0x3dc042['query']=_[_0x9c2e('0x2d')](_0x31ce09[_0x9c2e('0x2e')]);_0x3dc042[_0x9c2e('0x2f')]=_['intersection'](_0x3dc042[_0x9c2e('0x30')],_0x3dc042[_0x9c2e('0x2e')]);_0x519fd1[_0x9c2e('0x31')]=_[_0x9c2e('0x41')](_0x3dc042[_0x9c2e('0x30')],qs[_0x9c2e('0x32')](_0x31ce09[_0x9c2e('0x2e')][_0x9c2e('0x32')]));_0x519fd1['attributes']=_0x519fd1[_0x9c2e('0x31')]['length']?_0x519fd1[_0x9c2e('0x31')]:_0x3dc042[_0x9c2e('0x30')];if(_0x31ce09[_0x9c2e('0x2e')]['includeAll']){_0x519fd1[_0x9c2e('0x3d')]=[{'all':!![]}];}_0x519fd1=_[_0x9c2e('0x3a')]({},_0x519fd1,_0x31ce09[_0x9c2e('0x42')]);return db['Attachment'][_0x9c2e('0x43')](_0x519fd1)['then'](handleEntityNotFound(_0x542de2,null))[_0x9c2e('0x22')](respondWithResult(_0x542de2,null))[_0x9c2e('0x3e')](handleError(_0x542de2,null));};exports[_0x9c2e('0x44')]=function(_0x3cfa39,_0x1b36c6){var _0x45ac9e={'where':{'id':_0x3cfa39[_0x9c2e('0x40')]['id']}},_0x10a379={};_0x10a379[_0x9c2e('0x30')]=_[_0x9c2e('0x2d')](db[_0x9c2e('0x29')]['rawAttributes']);_0x45ac9e['attributes']=_['intersection'](_0x10a379['model'],qs['fields'](_0x3cfa39['query'][_0x9c2e('0x32')]));_0x45ac9e['attributes']=_0x45ac9e[_0x9c2e('0x31')][_0x9c2e('0x33')]?_0x45ac9e[_0x9c2e('0x31')]:_0x10a379[_0x9c2e('0x30')];if(_0x3cfa39[_0x9c2e('0x2e')][_0x9c2e('0x3c')]){_0x45ac9e[_0x9c2e('0x3d')]=[{'all':!![]}];}_0x45ac9e=_[_0x9c2e('0x3a')]({},_0x45ac9e,_0x3cfa39['options']);return db['Attachment']['find'](_0x45ac9e)[_0x9c2e('0x22')](handleEntityNotFound(_0x1b36c6,null))[_0x9c2e('0x22')](function(_0x164462){if(_0x164462){var _0x7cc16d=_0x164462[_0x9c2e('0x45')]({'plain':!![]});_0x7cc16d=qs[_0x9c2e('0x46')](_0x7cc16d,['id','createdAt',_0x9c2e('0x47')]);_0x3cfa39['body']=_[_0x9c2e('0x46')](_0x3cfa39[_0x9c2e('0x48')],['id',_0x9c2e('0x49'),_0x9c2e('0x47')]);return db[_0x9c2e('0x29')]['create'](_[_0x9c2e('0x3a')](_0x7cc16d,_0x3cfa39[_0x9c2e('0x48')]),{'include':_0x3cfa39[_0x9c2e('0x2e')][_0x9c2e('0x3c')]?[{'all':!![]}]:undefined});}})[_0x9c2e('0x22')](respondWithResult(_0x1b36c6,0xc9))[_0x9c2e('0x3e')](handleError(_0x1b36c6,null));};exports[_0x9c2e('0x21')]=function(_0xed4b5d,_0x55c0c5){if(_0xed4b5d['body']['id']){delete _0xed4b5d[_0x9c2e('0x48')]['id'];}return db['Attachment'][_0x9c2e('0x43')]({'where':{'id':_0xed4b5d['params']['id']}})[_0x9c2e('0x22')](handleEntityNotFound(_0x55c0c5,null))[_0x9c2e('0x22')](saveUpdates(_0xed4b5d[_0x9c2e('0x48')],null))['then'](respondWithResult(_0x55c0c5,null))[_0x9c2e('0x3e')](handleError(_0x55c0c5,null));};exports[_0x9c2e('0x23')]=function(_0x2df3c5,_0x2a6914){return db['Attachment'][_0x9c2e('0x43')]({'where':{'id':_0x2df3c5[_0x9c2e('0x40')]['id']}})[_0x9c2e('0x22')](handleEntityNotFound(_0x2a6914,null))[_0x9c2e('0x22')](removeEntity(_0x2a6914,null))[_0x9c2e('0x3e')](handleError(_0x2a6914,null));};exports[_0x9c2e('0x4a')]=function(_0xa5a0a7,_0x454ad1,_0x535b6a){_0xa5a0a7['body'][_0x9c2e('0x26')]=_0xa5a0a7[_0x9c2e('0x4b')][_0x9c2e('0x4c')];_0xa5a0a7[_0x9c2e('0x48')]['basename']=_0xa5a0a7[_0x9c2e('0x4b')][_0x9c2e('0x4d')];_0xa5a0a7['body']['type']=_0xa5a0a7[_0x9c2e('0x4b')][_0x9c2e('0x4e')];return db[_0x9c2e('0x29')][_0x9c2e('0x4a')](_0xa5a0a7[_0x9c2e('0x48')])[_0x9c2e('0x22')](respondWithResult(_0x454ad1,0xc9))[_0x9c2e('0x3e')](handleError(_0x454ad1,null));};exports[_0x9c2e('0x4f')]=function(_0x3cace5,_0x473680,_0x1b87f9){return db['Attachment'][_0x9c2e('0x50')]({'where':{'id':_0x3cace5[_0x9c2e('0x40')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x473680,null))[_0x9c2e('0x22')](function(_0x1e14d9){if(_0x1e14d9){var _0x45073a=_0x1e14d9['ChatOfflineMessageId']!==null;var _0x10db42=path['join'](config['root'],_0x9c2e('0x51'));if(_0x45073a){_0x10db42=path[_0x9c2e('0x52')](_0x10db42,_0x9c2e('0x53'));}var _0x286fba=path[_0x9c2e('0x52')](_0x10db42,_0x1e14d9[_0x9c2e('0x54')]);return _0x473680[_0x9c2e('0x4f')](_0x286fba);}})[_0x9c2e('0x3e')](handleError(_0x473680,null));}; \ No newline at end of file +var _0x9340=['request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','count','set','json','apply','reject','save','update','then','stack','name','index','map','Attachment','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','VIRTUAL','filter','includeAll','include','rows','show','length','merge','find','catch','params','options','omit','createdAt','updatedAt','body','create','destroy','file','originalname','basename','download','join','root','offline-chat/','rimraf'];(function(_0xa32cab,_0x560f06){var _0x1f42be=function(_0x90b22b){while(--_0x90b22b){_0xa32cab['push'](_0xa32cab['shift']());}};_0x1f42be(++_0x560f06);}(_0x9340,0x1d9));var _0x0934=function(_0x198f48,_0x773f96){_0x198f48=_0x198f48-0x0;var _0x26428e=_0x9340[_0x198f48];return _0x26428e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0934('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0934('0x1'));var moment=require(_0x0934('0x2'));var BPromise=require(_0x0934('0x3'));var Mustache=require(_0x0934('0x4'));var util=require(_0x0934('0x5'));var path=require(_0x0934('0x6'));var sox=require('sox');var csv=require(_0x0934('0x7'));var ejs=require(_0x0934('0x8'));var fs=require('fs');var fs_extra=require(_0x0934('0x9'));var _=require('lodash');var squel=require(_0x0934('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0934('0xb'));var toCsv=require('to-csv');var querystring=require(_0x0934('0xc'));var Papa=require(_0x0934('0xd'));var Redis=require('ioredis');var authService=require(_0x0934('0xe'));var qs=require(_0x0934('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0934('0x10'))('api');var utils=require(_0x0934('0x11'));var config=require(_0x0934('0x12'));var licenseUtil=require(_0x0934('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48bce3,_0x446410){_0x446410=_0x446410||0xcc;return function(_0x5e87d2){if(_0x5e87d2){return _0x48bce3[_0x0934('0x14')](_0x446410);}return _0x48bce3[_0x0934('0x15')](_0x446410)['end']();};}function respondWithResult(_0x181ec6,_0xcf763e){_0xcf763e=_0xcf763e||0xc8;return function(_0x5ddde0){if(_0x5ddde0){return _0x181ec6['status'](_0xcf763e)['json'](_0x5ddde0);}};}function respondWithFilteredResult(_0x32a1ba,_0x517e8f){return function(_0x35a806){if(_0x35a806){var _0x4ce586=typeof _0x517e8f[_0x0934('0x16')]===_0x0934('0x17')&&typeof _0x517e8f['limit']===_0x0934('0x17');var _0x57df0d=_0x35a806[_0x0934('0x18')];var _0x4fbc1a=_0x4ce586?0x0:_0x517e8f[_0x0934('0x16')];var _0x12e6d0=_0x4ce586?_0x35a806[_0x0934('0x18')]:_0x517e8f[_0x0934('0x16')]+_0x517e8f['limit'];var _0x1ab386;if(_0x12e6d0>=_0x57df0d){_0x12e6d0=_0x57df0d;_0x1ab386=0xc8;}else{_0x1ab386=0xce;}_0x32a1ba[_0x0934('0x15')](_0x1ab386);return _0x32a1ba[_0x0934('0x19')]('Content-Range',_0x4fbc1a+'-'+_0x12e6d0+'/'+_0x57df0d)[_0x0934('0x1a')](_0x35a806);}return null;};}function patchUpdates(_0x20ac3e){return function(_0x54122d){try{jsonpatch[_0x0934('0x1b')](_0x54122d,_0x20ac3e,!![]);}catch(_0x310f02){return BPromise[_0x0934('0x1c')](_0x310f02);}return _0x54122d[_0x0934('0x1d')]();};}function saveUpdates(_0x28993e,_0x3454be){return function(_0x148051){if(_0x148051){return _0x148051[_0x0934('0x1e')](_0x28993e)[_0x0934('0x1f')](function(_0x36780c){return _0x36780c;});}return null;};}function removeEntity(_0x446723,_0x354191){return function(_0x18f303){if(_0x18f303){return _0x18f303['destroy']()[_0x0934('0x1f')](function(){_0x446723[_0x0934('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13d925,_0x133e7f){return function(_0x5f85fb){if(!_0x5f85fb){_0x13d925['sendStatus'](0x194);}return _0x5f85fb;};}function handleError(_0x57237b,_0x1e2814){_0x1e2814=_0x1e2814||0x1f4;return function(_0x3dbdeb){logger['error'](_0x3dbdeb[_0x0934('0x20')]);if(_0x3dbdeb[_0x0934('0x21')]){delete _0x3dbdeb['name'];}_0x57237b[_0x0934('0x15')](_0x1e2814)['send'](_0x3dbdeb);};}exports[_0x0934('0x22')]=function(_0x3b095,_0x2fd0d3){var _0x475934={},_0x16dcdf={},_0x46b49d={'count':0x0,'rows':[]};var _0x2faabb=_[_0x0934('0x23')](db[_0x0934('0x24')][_0x0934('0x25')],function(_0x380c84){return{'name':_0x380c84[_0x0934('0x26')],'type':_0x380c84[_0x0934('0x27')][_0x0934('0x28')]};});_0x16dcdf['model']=_[_0x0934('0x23')](_0x2faabb,_0x0934('0x21'));_0x16dcdf[_0x0934('0x29')]=_[_0x0934('0x2a')](_0x3b095[_0x0934('0x29')]);_0x16dcdf[_0x0934('0x2b')]=_['intersection'](_0x16dcdf[_0x0934('0x2c')],_0x16dcdf[_0x0934('0x29')]);_0x475934[_0x0934('0x2d')]=_[_0x0934('0x2e')](_0x16dcdf['model'],qs[_0x0934('0x2f')](_0x3b095[_0x0934('0x29')][_0x0934('0x2f')]));_0x475934[_0x0934('0x2d')]=_0x475934[_0x0934('0x2d')]['length']?_0x475934['attributes']:_0x16dcdf[_0x0934('0x2c')];if(!_0x3b095[_0x0934('0x29')][_0x0934('0x30')](_0x0934('0x31'))){_0x475934['limit']=qs[_0x0934('0x32')](_0x3b095['query'][_0x0934('0x32')]);_0x475934['offset']=qs[_0x0934('0x16')](_0x3b095['query'][_0x0934('0x16')]);}_0x475934[_0x0934('0x33')]=qs[_0x0934('0x34')](_0x3b095[_0x0934('0x29')][_0x0934('0x34')]);_0x475934[_0x0934('0x35')]=qs[_0x0934('0x2b')](_['pick'](_0x3b095[_0x0934('0x29')],_0x16dcdf['filters']),_0x2faabb);if(_0x3b095['query']['filter']){_0x475934['where']=_['merge'](_0x475934[_0x0934('0x35')],{'$or':_[_0x0934('0x23')](_0x2faabb,function(_0xf6f147){if(_0xf6f147['type']!==_0x0934('0x36')){var _0x9d31d3={};_0x9d31d3[_0xf6f147[_0x0934('0x21')]]={'$like':'%'+_0x3b095[_0x0934('0x29')][_0x0934('0x37')]+'%'};return _0x9d31d3;}})});}_0x475934=_['merge']({},_0x475934,_0x3b095['options']);var _0x4ebde4={'where':_0x475934['where']};return db[_0x0934('0x24')][_0x0934('0x18')](_0x4ebde4)['then'](function(_0x2b24c6){_0x46b49d[_0x0934('0x18')]=_0x2b24c6;if(_0x3b095[_0x0934('0x29')][_0x0934('0x38')]){_0x475934[_0x0934('0x39')]=[{'all':!![]}];}return db['Attachment']['findAll'](_0x475934);})[_0x0934('0x1f')](function(_0x21fb51){_0x46b49d[_0x0934('0x3a')]=_0x21fb51;return _0x46b49d;})[_0x0934('0x1f')](respondWithFilteredResult(_0x2fd0d3,_0x475934))['catch'](handleError(_0x2fd0d3,null));};exports[_0x0934('0x3b')]=function(_0x248d06,_0x5523c2){var _0x3cb1ce={'raw':!![],'where':{'id':_0x248d06['params']['id']}},_0xedb3ad={};_0xedb3ad[_0x0934('0x2c')]=_['keys'](db[_0x0934('0x24')]['rawAttributes']);_0xedb3ad['query']=_[_0x0934('0x2a')](_0x248d06[_0x0934('0x29')]);_0xedb3ad['filters']=_[_0x0934('0x2e')](_0xedb3ad[_0x0934('0x2c')],_0xedb3ad[_0x0934('0x29')]);_0x3cb1ce[_0x0934('0x2d')]=_['intersection'](_0xedb3ad[_0x0934('0x2c')],qs[_0x0934('0x2f')](_0x248d06['query'][_0x0934('0x2f')]));_0x3cb1ce[_0x0934('0x2d')]=_0x3cb1ce[_0x0934('0x2d')][_0x0934('0x3c')]?_0x3cb1ce[_0x0934('0x2d')]:_0xedb3ad[_0x0934('0x2c')];if(_0x248d06[_0x0934('0x29')][_0x0934('0x38')]){_0x3cb1ce[_0x0934('0x39')]=[{'all':!![]}];}_0x3cb1ce=_[_0x0934('0x3d')]({},_0x3cb1ce,_0x248d06['options']);return db[_0x0934('0x24')][_0x0934('0x3e')](_0x3cb1ce)[_0x0934('0x1f')](handleEntityNotFound(_0x5523c2,null))['then'](respondWithResult(_0x5523c2,null))[_0x0934('0x3f')](handleError(_0x5523c2,null));};exports['clone']=function(_0x13effd,_0x46f2a9){var _0x810045={'where':{'id':_0x13effd[_0x0934('0x40')]['id']}},_0x117d5a={};_0x117d5a[_0x0934('0x2c')]=_[_0x0934('0x2a')](db['Attachment']['rawAttributes']);_0x810045['attributes']=_[_0x0934('0x2e')](_0x117d5a[_0x0934('0x2c')],qs[_0x0934('0x2f')](_0x13effd[_0x0934('0x29')]['fields']));_0x810045[_0x0934('0x2d')]=_0x810045['attributes']['length']?_0x810045[_0x0934('0x2d')]:_0x117d5a['model'];if(_0x13effd[_0x0934('0x29')][_0x0934('0x38')]){_0x810045[_0x0934('0x39')]=[{'all':!![]}];}_0x810045=_[_0x0934('0x3d')]({},_0x810045,_0x13effd[_0x0934('0x41')]);return db[_0x0934('0x24')][_0x0934('0x3e')](_0x810045)[_0x0934('0x1f')](handleEntityNotFound(_0x46f2a9,null))[_0x0934('0x1f')](function(_0x57f6da){if(_0x57f6da){var _0x59193a=_0x57f6da['get']({'plain':!![]});_0x59193a=qs[_0x0934('0x42')](_0x59193a,['id',_0x0934('0x43'),_0x0934('0x44')]);_0x13effd[_0x0934('0x45')]=_['omit'](_0x13effd['body'],['id',_0x0934('0x43'),'updatedAt']);return db[_0x0934('0x24')][_0x0934('0x46')](_[_0x0934('0x3d')](_0x59193a,_0x13effd['body']),{'include':_0x13effd[_0x0934('0x29')][_0x0934('0x38')]?[{'all':!![]}]:undefined});}})[_0x0934('0x1f')](respondWithResult(_0x46f2a9,0xc9))['catch'](handleError(_0x46f2a9,null));};exports[_0x0934('0x1e')]=function(_0x3e23ab,_0x521e15){if(_0x3e23ab[_0x0934('0x45')]['id']){delete _0x3e23ab[_0x0934('0x45')]['id'];}return db[_0x0934('0x24')][_0x0934('0x3e')]({'where':{'id':_0x3e23ab[_0x0934('0x40')]['id']}})[_0x0934('0x1f')](handleEntityNotFound(_0x521e15,null))[_0x0934('0x1f')](saveUpdates(_0x3e23ab[_0x0934('0x45')],null))[_0x0934('0x1f')](respondWithResult(_0x521e15,null))[_0x0934('0x3f')](handleError(_0x521e15,null));};exports[_0x0934('0x47')]=function(_0x50e899,_0x5a1955){return db[_0x0934('0x24')][_0x0934('0x3e')]({'where':{'id':_0x50e899[_0x0934('0x40')]['id']}})['then'](handleEntityNotFound(_0x5a1955,null))[_0x0934('0x1f')](removeEntity(_0x5a1955,null))[_0x0934('0x3f')](handleError(_0x5a1955,null));};exports[_0x0934('0x46')]=function(_0x25ee3f,_0xab34ee,_0x27c0ad){_0x25ee3f[_0x0934('0x45')][_0x0934('0x21')]=_0x25ee3f[_0x0934('0x48')][_0x0934('0x49')];_0x25ee3f[_0x0934('0x45')][_0x0934('0x4a')]=_0x25ee3f[_0x0934('0x48')]['filename'];_0x25ee3f['body'][_0x0934('0x27')]=_0x25ee3f['file']['mimetype'];return db['Attachment'][_0x0934('0x46')](_0x25ee3f[_0x0934('0x45')])[_0x0934('0x1f')](respondWithResult(_0xab34ee,0xc9))[_0x0934('0x3f')](handleError(_0xab34ee,null));};exports[_0x0934('0x4b')]=function(_0x330026,_0x2c7a9f,_0x5be7fb){return db[_0x0934('0x24')]['findOne']({'where':{'id':_0x330026['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x2c7a9f,null))[_0x0934('0x1f')](function(_0x58a3b1){if(_0x58a3b1){var _0x4fb5a7=_0x58a3b1['ChatOfflineMessageId']!==null;var _0x597188=path[_0x0934('0x4c')](config[_0x0934('0x4d')],'server/files/attachments/');if(_0x4fb5a7){_0x597188=path[_0x0934('0x4c')](_0x597188,_0x0934('0x4e'));}var _0x49f4fc=path[_0x0934('0x4c')](_0x597188,_0x58a3b1['basename']);return _0x2c7a9f[_0x0934('0x4b')](_0x49f4fc);}})[_0x0934('0x3f')](handleError(_0x2c7a9f,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 704f186..3f374f0 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 _0xf957=['rimraf','../../config/environment','./attachment.attributes','Attachment','attachments','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x5004ed,_0x2b1ab6){var _0x467590=function(_0x495ada){while(--_0x495ada){_0x5004ed['push'](_0x5004ed['shift']());}};_0x467590(++_0x2b1ab6);}(_0xf957,0xaa));var _0x7f95=function(_0x421612,_0x1ed085){_0x421612=_0x421612-0x0;var _0x5a4787=_0xf957[_0x421612];return _0x5a4787;};'use strict';var _=require(_0x7f95('0x0'));var util=require('util');var logger=require(_0x7f95('0x1'))(_0x7f95('0x2'));var moment=require('moment');var BPromise=require(_0x7f95('0x3'));var rp=require(_0x7f95('0x4'));var fs=require('fs');var path=require(_0x7f95('0x5'));var rimraf=require(_0x7f95('0x6'));var config=require(_0x7f95('0x7'));var attributes=require(_0x7f95('0x8'));module['exports']=function(_0x512ae0,_0x523ffd){return _0x512ae0['define'](_0x7f95('0x9'),attributes,{'tableName':_0x7f95('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8a9c=['rimraf','../../config/environment','exports','define','attachments','lodash','util','api','moment','request-promise','path'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x8a9c,0x144));var _0xc8a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8a9c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc8a9('0x0'));var util=require(_0xc8a9('0x1'));var logger=require('../../config/logger')(_0xc8a9('0x2'));var moment=require(_0xc8a9('0x3'));var BPromise=require('bluebird');var rp=require(_0xc8a9('0x4'));var fs=require('fs');var path=require(_0xc8a9('0x5'));var rimraf=require(_0xc8a9('0x6'));var config=require(_0xc8a9('0x7'));var attributes=require('./attachment.attributes');module[_0xc8a9('0x8')]=function(_0xb06e5b,_0x23ea5d){return _0xb06e5b[_0xc8a9('0x9')]('Attachment',attributes,{'tableName':_0xc8a9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 7ed8503..7a7c8c7 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 _0x4c6d=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','Attachment,\x20%s,\x20%s','debug','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateAttachment','Attachment','create','body','options','raw','then'];(function(_0xe2e672,_0x1263c9){var _0x4d8e80=function(_0x2811e9){while(--_0x2811e9){_0xe2e672['push'](_0xe2e672['shift']());}};_0x4d8e80(++_0x1263c9);}(_0x4c6d,0x1d0));var _0xd4c6=function(_0xfea29f,_0x1d2f22){_0xfea29f=_0xfea29f-0x0;var _0x2935ba=_0x4c6d[_0xfea29f];return _0x2935ba;};'use strict';var _=require(_0xd4c6('0x0'));var util=require(_0xd4c6('0x1'));var moment=require(_0xd4c6('0x2'));var BPromise=require(_0xd4c6('0x3'));var rs=require(_0xd4c6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd4c6('0x5'))['db'];var utils=require(_0xd4c6('0x6'));var logger=require(_0xd4c6('0x7'))('rpc');var config=require(_0xd4c6('0x8'));var jayson=require(_0xd4c6('0x9'));var client=jayson['client'][_0xd4c6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x316314,_0x4329e3,_0x5d4fce){return new BPromise(function(_0x440ee3,_0x19ce1c){return client[_0xd4c6('0xb')](_0x316314,_0x5d4fce)['then'](function(_0xe2f90b){logger[_0xd4c6('0xc')](_0xd4c6('0xd'),_0x4329e3,'request\x20sent');logger[_0xd4c6('0xe')](_0xd4c6('0xf'),_0x4329e3,_0xd4c6('0x10'),JSON[_0xd4c6('0x11')](_0xe2f90b));if(_0xe2f90b[_0xd4c6('0x12')]){if(_0xe2f90b[_0xd4c6('0x12')]['code']===0x1f4){logger['error'](_0xd4c6('0xd'),_0x4329e3,_0xe2f90b['error'][_0xd4c6('0x13')]);return _0x19ce1c(_0xe2f90b[_0xd4c6('0x12')][_0xd4c6('0x13')]);}logger[_0xd4c6('0x12')](_0xd4c6('0xd'),_0x4329e3,_0xe2f90b[_0xd4c6('0x12')][_0xd4c6('0x13')]);return _0x440ee3(_0xe2f90b['error']['message']);}else{logger[_0xd4c6('0xc')](_0xd4c6('0xd'),_0x4329e3,_0xd4c6('0x10'));_0x440ee3(_0xe2f90b[_0xd4c6('0x14')][_0xd4c6('0x13')]);}})[_0xd4c6('0x15')](function(_0xe52075){logger['error'](_0xd4c6('0xd'),_0x4329e3,_0xe52075);_0x19ce1c(_0xe52075);});});}exports[_0xd4c6('0x16')]=function(_0x23a16f){var _0x2c97b=this;return new Promise(function(_0x31f328,_0x54e0a5){return db[_0xd4c6('0x17')][_0xd4c6('0x18')](_0x23a16f[_0xd4c6('0x19')],{'raw':_0x23a16f['options']?_0x23a16f[_0xd4c6('0x1a')][_0xd4c6('0x1b')]===undefined?!![]:![]:!![]})[_0xd4c6('0x1c')](function(_0x3b1658){logger['info'](_0xd4c6('0x16'),_0x23a16f);logger['debug'](_0xd4c6('0x16'),_0x23a16f,JSON[_0xd4c6('0x11')](_0x3b1658));_0x31f328(_0x3b1658);})[_0xd4c6('0x15')](function(_0x222813){logger[_0xd4c6('0x12')](_0xd4c6('0x16'),_0x222813[_0xd4c6('0x13')],_0x23a16f);_0x54e0a5(_0x2c97b[_0xd4c6('0x12')](0x1f4,_0x222813[_0xd4c6('0x13')]));});});}; \ No newline at end of file +var _0xdab2=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Attachment,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','CreateAttachment','Attachment','create','options','raw','lodash','util','bluebird','randomstring'];(function(_0x114920,_0x4fbd50){var _0x3f13ce=function(_0x47c2c7){while(--_0x47c2c7){_0x114920['push'](_0x114920['shift']());}};_0x3f13ce(++_0x4fbd50);}(_0xdab2,0x130));var _0x2dab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdab2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2dab('0x0'));var util=require(_0x2dab('0x1'));var moment=require('moment');var BPromise=require(_0x2dab('0x2'));var rs=require(_0x2dab('0x3'));var fs=require('fs');var Redis=require(_0x2dab('0x4'));var db=require(_0x2dab('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2dab('0x6'))(_0x2dab('0x7'));var config=require(_0x2dab('0x8'));var jayson=require(_0x2dab('0x9'));var client=jayson[_0x2dab('0xa')][_0x2dab('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x11da80,_0x627cdb,_0x218d6b){return new BPromise(function(_0x188cef,_0x215faa){return client[_0x2dab('0xc')](_0x11da80,_0x218d6b)[_0x2dab('0xd')](function(_0x533046){logger['info'](_0x2dab('0xe'),_0x627cdb,_0x2dab('0xf'));logger[_0x2dab('0x10')]('Attachment,\x20%s,\x20%s,\x20%s',_0x627cdb,'request\x20sent',JSON[_0x2dab('0x11')](_0x533046));if(_0x533046[_0x2dab('0x12')]){if(_0x533046[_0x2dab('0x12')][_0x2dab('0x13')]===0x1f4){logger[_0x2dab('0x12')]('Attachment,\x20%s,\x20%s',_0x627cdb,_0x533046[_0x2dab('0x12')][_0x2dab('0x14')]);return _0x215faa(_0x533046['error'][_0x2dab('0x14')]);}logger[_0x2dab('0x12')](_0x2dab('0xe'),_0x627cdb,_0x533046['error'][_0x2dab('0x14')]);return _0x188cef(_0x533046[_0x2dab('0x12')]['message']);}else{logger[_0x2dab('0x15')](_0x2dab('0xe'),_0x627cdb,_0x2dab('0xf'));_0x188cef(_0x533046[_0x2dab('0x16')][_0x2dab('0x14')]);}})['catch'](function(_0x128004){logger[_0x2dab('0x12')](_0x2dab('0xe'),_0x627cdb,_0x128004);_0x215faa(_0x128004);});});}exports[_0x2dab('0x17')]=function(_0x30bbde){var _0x2a86b5=this;return new Promise(function(_0x4ff9be,_0x9436f0){return db[_0x2dab('0x18')][_0x2dab('0x19')](_0x30bbde['body'],{'raw':_0x30bbde[_0x2dab('0x1a')]?_0x30bbde[_0x2dab('0x1a')][_0x2dab('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x477494){logger[_0x2dab('0x15')](_0x2dab('0x17'),_0x30bbde);logger[_0x2dab('0x10')](_0x2dab('0x17'),_0x30bbde,JSON[_0x2dab('0x11')](_0x477494));_0x4ff9be(_0x477494);})['catch'](function(_0x343bfc){logger[_0x2dab('0x12')]('CreateAttachment',_0x343bfc[_0x2dab('0x14')],_0x30bbde);_0x9436f0(_0x2a86b5[_0x2dab('0x12')](0x1f4,_0x343bfc[_0x2dab('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index a947f6d..0641795 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 _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','/:id/clone','clone','join','root','server/files/attachments/','%s-%s','now','originalname','replace','post','single','file','create','put','update','delete','destroy','exports','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb28,0x106));var _0x8db2=function(_0x823b63,_0x57f919){_0x823b63=_0x823b63-0x0;var _0x359766=_0xdb28[_0x823b63];return _0x359766;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./attachment.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['post'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1d9371,_0x150942,_0x576475){_0x576475(null,path[_0x8db2('0x11')](config[_0x8db2('0x12')],_0x8db2('0x13')));},'filename':function(_0x204f49,_0x37d017,_0x559fb1){_0x559fb1(null,util['format'](_0x8db2('0x14'),Date[_0x8db2('0x15')](),_0x37d017[_0x8db2('0x16')][_0x8db2('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8db2('0x18')]('/',upload[_0x8db2('0x19')](_0x8db2('0x1a')),controller[_0x8db2('0x1b')]);router[_0x8db2('0x1c')](_0x8db2('0xb'),auth['isAuthenticated'](),controller[_0x8db2('0x1d')]);router[_0x8db2('0x1e')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x1f')]);module[_0x8db2('0x20')]=router; \ No newline at end of file +var _0x2032=['./attachment.controller','get','isAuthenticated','index','/:id','show','download','/:id/clone','clone','root','server/files/attachments/','now','post','single','file','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x295e5c,_0x4e2760){var _0x1705e6=function(_0x606be4){while(--_0x606be4){_0x295e5c['push'](_0x295e5c['shift']());}};_0x1705e6(++_0x4e2760);}(_0x2032,0xd9));var _0x2203=function(_0x303ba3,_0x4e2b10){_0x303ba3=_0x303ba3-0x0;var _0x469e41=_0x2032[_0x303ba3];return _0x469e41;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['post'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x849049,_0x4a6832,_0x3f690a){_0x3f690a(null,path['join'](config[_0x2203('0x10')],_0x2203('0x11')));},'filename':function(_0x4b9376,_0x583bc7,_0x585c76){_0x585c76(null,util['format']('%s-%s',Date[_0x2203('0x12')](),_0x583bc7['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2203('0x13')]('/',upload[_0x2203('0x14')](_0x2203('0x15')),controller[_0x2203('0x16')]);router[_0x2203('0x17')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0x18')]);router[_0x2203('0x19')](_0x2203('0xb'),auth['isAuthenticated'](),controller[_0x2203('0x1a')]);module[_0x2203('0x1b')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 5addbd7..aac2cba 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 _0x5fba=['use','User','passport','passport-local','Strategy','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/logger','api','activedirectory','undefined','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','adSsoEnabled','blockDuration','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','findOne','name','password','salt','disabled','blocked','blockedAt','online','user','agent','then','add','minutes','clearBlockUser','getLicense','status','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken'];(function(_0x15a3e4,_0x1287d7){var _0x1b8205=function(_0x406982){while(--_0x406982){_0x15a3e4['push'](_0x15a3e4['shift']());}};_0x1b8205(++_0x1287d7);}(_0x5fba,0x128));var _0xa5fb=function(_0x331c5d,_0x3a6652){_0x331c5d=_0x331c5d-0x0;var _0x808c40=_0x5fba[_0x331c5d];return _0x808c40;};'use strict';var passport=require(_0xa5fb('0x0'));var LocalStrategy=require(_0xa5fb('0x1'))[_0xa5fb('0x2')];var moment=require('moment');var ActiveDirectory=require('activedirectory2');var BPromise=require(_0xa5fb('0x3'));var util=require(_0xa5fb('0x4'));var db=require(_0xa5fb('0x5'))['db'];var authService=require(_0xa5fb('0x6'));var utils=require(_0xa5fb('0x7'));var config=require('../../config/environment');var logger=require(_0xa5fb('0x8'))(_0xa5fb('0x9'));function isActiveDirectoryConfigured(_0x34d189){var _0x287d0b=![];if(typeof _0x34d189[_0xa5fb('0xa')]!==_0xa5fb('0xb')){_0x287d0b=_0x34d189[_0xa5fb('0xa')]['baseDN']&&_0x34d189[_0xa5fb('0xa')][_0xa5fb('0xc')]&&_0x34d189[_0xa5fb('0xa')][_0xa5fb('0xd')];}return _0x287d0b;}function adAuthenticate(_0x20e590,_0x30fb7a,_0x18e80c){return new BPromise(function(_0x3e5393,_0x59e5c9){try{var _0x27258e=new ActiveDirectory(_0x20e590);_0x27258e[_0xa5fb('0xe')](_0x30fb7a,_0x18e80c,function(_0xb6b38f,_0x16c6c0){if(_0xb6b38f){logger[_0xa5fb('0xf')](_0xa5fb('0x10'),_0x30fb7a,util[_0xa5fb('0x11')](_0xb6b38f,{'showHidden':![],'depth':null}));_0x59e5c9(_0xa5fb('0x12'));}else if(!_0x16c6c0){logger[_0xa5fb('0xf')](_0xa5fb('0x13'),_0x30fb7a);_0x59e5c9(_0xa5fb('0x12'));}else{_0x3e5393(_0x16c6c0);}});}catch(_0x7fce84){_0x59e5c9(_0x7fce84);}});}function ActiveDirectoryAuthenticate(_0x20818d,_0x262c07,_0x1553ad,_0x7b18d9){var _0x493099,_0x2712d2;if(!isActiveDirectoryConfigured(config)){logger[_0xa5fb('0xf')](_0xa5fb('0x14'),_0x262c07);return _0x7b18d9(null,![],{'message':_0xa5fb('0x12')});}return db[_0xa5fb('0x15')]['findOne']({'where':{'id':0x1},'attributes':[_0xa5fb('0x16'),_0xa5fb('0x17')],'raw':!![]})['then'](function(_0x3b4d4f){_0x493099=_0x3b4d4f;if(!_0x493099['adSsoEnabled']){logger[_0xa5fb('0xf')](_0xa5fb('0x18'),_0x262c07);throw new Error(_0xa5fb('0x12'));}return _0x20818d[_0xa5fb('0x19')]({'attributes':['id',_0xa5fb('0x1a'),_0xa5fb('0x1b'),_0xa5fb('0x1c'),'role',_0xa5fb('0x1d'),_0xa5fb('0x1e'),_0xa5fb('0x1f'),_0xa5fb('0x20')],'where':{'name':_0x262c07,'role':{'$or':['admin',_0xa5fb('0x21'),_0xa5fb('0x22')]},'adSsoEnabled':!![]}});})[_0xa5fb('0x23')](function(_0x5b01b0){if(!_0x5b01b0||_0x5b01b0&&_0x5b01b0[_0xa5fb('0x1a')]!==_0x262c07){throw new Error(_0xa5fb('0x12'));}_0x2712d2=_0x5b01b0;var _0x33d50b=_0x2712d2[_0xa5fb('0x1a')]+'@'+config['activedirectory'][_0xa5fb('0xd')];return adAuthenticate(config['activedirectory'],_0x33d50b,_0x1553ad);})[_0xa5fb('0x23')](function(_0x169a4e){if(_0x2712d2['disabled']){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x493099[_0xa5fb('0x17')]>0x0){if(_0x2712d2[_0xa5fb('0x1e')]){if(moment(_0x2712d2['blockedAt'])[_0xa5fb('0x24')](_0x493099[_0xa5fb('0x17')],_0xa5fb('0x25'))>moment()){throw new Error(_0xa5fb('0x12'));}return utils[_0xa5fb('0x26')](_0x2712d2,0x0,![],null)[_0xa5fb('0x23')](function(){return utils[_0xa5fb('0x27')](_0x2712d2);})['then'](function(){return _0x7b18d9(null,_0x2712d2);});}else{return utils[_0xa5fb('0x27')](_0x2712d2)[_0xa5fb('0x23')](function(){return _0x7b18d9(null,_0x2712d2);});}}else{return utils[_0xa5fb('0x27')](_0x2712d2)[_0xa5fb('0x23')](function(){return _0x7b18d9(null,_0x2712d2);});}})['catch'](function(_0x1036e7){return _0x7b18d9(null,![],_0x1036e7);});}function handleError(_0x27ebe3,_0x318b4c,_0x2a2e60){return _0x27ebe3[_0xa5fb('0x28')](_0x318b4c||0x1f4)['send']({'message':_0x2a2e60?_0x2a2e60[_0xa5fb('0x29')]||_0x2a2e60:''});}exports[_0xa5fb('0x2a')]=function(_0x719a70,_0x27a19c,_0x20f5be){passport[_0xa5fb('0xe')](_0xa5fb('0x2b'),function(_0x5bcd59,_0x1a9eaa,_0x184066){var _0x2649f8=_0x5bcd59||_0x184066;if(_0x2649f8){return handleError(_0x27a19c,0x191,_0x2649f8);}if(!_0x1a9eaa){return handleError(_0x27a19c,0x194,{'message':_0xa5fb('0x2c')});}else{var _0x4cad41={'payload':{'id':_0x1a9eaa['id'],'role':_0x1a9eaa[_0xa5fb('0x2d')]},'options':{'expiresIn':0x15180}};return authService[_0xa5fb('0x2e')](_0x4cad41)[_0xa5fb('0x23')](function(_0x380e68){_0x27a19c['json']({'id':_0x1a9eaa['id'],'token':_0x380e68,'statusCall':'','isAlreadyLogged':_0x1a9eaa['online']});});}})(_0x719a70,_0x27a19c,_0x20f5be);};passport[_0xa5fb('0x2f')]('ad-login',new LocalStrategy({'usernameField':_0xa5fb('0x1a'),'passwordField':_0xa5fb('0x1b')},function(_0x1210ea,_0x1ca235,_0x4ab884){return ActiveDirectoryAuthenticate(db[_0xa5fb('0x30')],_0x1210ea,_0x1ca235,_0x4ab884);})); \ No newline at end of file +var _0x354e=['send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','use','passport','passport-local','moment','activedirectory2','util','../../mysqldb','../../components/auth/service','../../config/environment','../../config/logger','api','activedirectory','undefined','url','domain','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','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','blocked','online','user','agent','disabled','blockedAt','add','minutes','clearBlockUser','getLicense','catch','status'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x354e,0x186));var _0xe354=function(_0x5cbdc2,_0x408ffe){_0x5cbdc2=_0x5cbdc2-0x0;var _0x5ade03=_0x354e[_0x5cbdc2];return _0x5ade03;};'use strict';var passport=require(_0xe354('0x0'));var LocalStrategy=require(_0xe354('0x1'))['Strategy'];var moment=require(_0xe354('0x2'));var ActiveDirectory=require(_0xe354('0x3'));var BPromise=require('bluebird');var util=require(_0xe354('0x4'));var db=require(_0xe354('0x5'))['db'];var authService=require(_0xe354('0x6'));var utils=require('../../config/utils');var config=require(_0xe354('0x7'));var logger=require(_0xe354('0x8'))(_0xe354('0x9'));function isActiveDirectoryConfigured(_0x4b908a){var _0x7b4018=![];if(typeof _0x4b908a[_0xe354('0xa')]!==_0xe354('0xb')){_0x7b4018=_0x4b908a['activedirectory']['baseDN']&&_0x4b908a[_0xe354('0xa')][_0xe354('0xc')]&&_0x4b908a[_0xe354('0xa')][_0xe354('0xd')];}return _0x7b4018;}function adAuthenticate(_0x5391ed,_0x3aa277,_0x3e99e0){return new BPromise(function(_0xb958c0,_0x345cd5){try{var _0x89fc6c=new ActiveDirectory(_0x5391ed);_0x89fc6c['authenticate'](_0x3aa277,_0x3e99e0,function(_0x5221be,_0x344624){if(_0x5221be){logger[_0xe354('0xe')](_0xe354('0xf'),_0x3aa277,util[_0xe354('0x10')](_0x5221be,{'showHidden':![],'depth':null}));_0x345cd5(_0xe354('0x11'));}else if(!_0x344624){logger[_0xe354('0xe')](_0xe354('0x12'),_0x3aa277);_0x345cd5('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0xb958c0(_0x344624);}});}catch(_0x4f49a7){_0x345cd5(_0x4f49a7);}});}function ActiveDirectoryAuthenticate(_0x201aa8,_0x16ff7d,_0x58ec4a,_0x398db4){var _0x4e271e,_0x56076e;if(!isActiveDirectoryConfigured(config)){logger[_0xe354('0xe')](_0xe354('0x13'),_0x16ff7d);return _0x398db4(null,![],{'message':_0xe354('0x11')});}return db[_0xe354('0x14')][_0xe354('0x15')]({'where':{'id':0x1},'attributes':[_0xe354('0x16'),_0xe354('0x17')],'raw':!![]})[_0xe354('0x18')](function(_0x53e05f){_0x4e271e=_0x53e05f;if(!_0x4e271e[_0xe354('0x16')]){logger['error'](_0xe354('0x19'),_0x16ff7d);throw new Error(_0xe354('0x11'));}return _0x201aa8[_0xe354('0x15')]({'attributes':['id',_0xe354('0x1a'),_0xe354('0x1b'),_0xe354('0x1c'),_0xe354('0x1d'),'disabled',_0xe354('0x1e'),'blockedAt',_0xe354('0x1f')],'where':{'name':_0x16ff7d,'role':{'$or':['admin',_0xe354('0x20'),_0xe354('0x21')]},'adSsoEnabled':!![]}});})[_0xe354('0x18')](function(_0x25bde4){if(!_0x25bde4||_0x25bde4&&_0x25bde4[_0xe354('0x1a')]!==_0x16ff7d){throw new Error(_0xe354('0x11'));}_0x56076e=_0x25bde4;var _0x3f22b7=_0x56076e[_0xe354('0x1a')]+'@'+config[_0xe354('0xa')]['domain'];return adAuthenticate(config['activedirectory'],_0x3f22b7,_0x58ec4a);})[_0xe354('0x18')](function(_0x58acee){if(_0x56076e[_0xe354('0x22')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x4e271e['blockDuration']>0x0){if(_0x56076e['blocked']){if(moment(_0x56076e[_0xe354('0x23')])[_0xe354('0x24')](_0x4e271e[_0xe354('0x17')],_0xe354('0x25'))>moment()){throw new Error(_0xe354('0x11'));}return utils[_0xe354('0x26')](_0x56076e,0x0,![],null)['then'](function(){return utils['getLicense'](_0x56076e);})[_0xe354('0x18')](function(){return _0x398db4(null,_0x56076e);});}else{return utils[_0xe354('0x27')](_0x56076e)[_0xe354('0x18')](function(){return _0x398db4(null,_0x56076e);});}}else{return utils[_0xe354('0x27')](_0x56076e)[_0xe354('0x18')](function(){return _0x398db4(null,_0x56076e);});}})[_0xe354('0x28')](function(_0x3d0f1f){return _0x398db4(null,![],_0x3d0f1f);});}function handleError(_0x456c99,_0xe3088a,_0x1d1af5){return _0x456c99[_0xe354('0x29')](_0xe3088a||0x1f4)[_0xe354('0x2a')]({'message':_0x1d1af5?_0x1d1af5[_0xe354('0x2b')]||_0x1d1af5:''});}exports[_0xe354('0x2c')]=function(_0x501e5c,_0x7fffe8,_0x126254){passport['authenticate'](_0xe354('0x2d'),function(_0x538f86,_0x57c359,_0x4d689d){var _0x3a6034=_0x538f86||_0x4d689d;if(_0x3a6034){return handleError(_0x7fffe8,0x191,_0x3a6034);}if(!_0x57c359){return handleError(_0x7fffe8,0x194,{'message':_0xe354('0x2e')});}else{var _0x406063={'payload':{'id':_0x57c359['id'],'role':_0x57c359[_0xe354('0x1d')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x406063)[_0xe354('0x18')](function(_0x4af644){_0x7fffe8['json']({'id':_0x57c359['id'],'token':_0x4af644,'statusCall':'','isAlreadyLogged':_0x57c359['online']});});}})(_0x501e5c,_0x7fffe8,_0x126254);};passport[_0xe354('0x2f')](_0xe354('0x2d'),new LocalStrategy({'usernameField':_0xe354('0x1a'),'passwordField':_0xe354('0x1b')},function(_0x26a3c7,_0x231181,_0x295186){return ActiveDirectoryAuthenticate(db['User'],_0x26a3c7,_0x231181,_0x295186);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 849e8b0..513d58d 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 _0x501c=['login','express','Router','./authActiveDirectory.controller','post'];(function(_0x554e66,_0x4c7936){var _0x487a08=function(_0x3e43ba){while(--_0x3e43ba){_0x554e66['push'](_0x554e66['shift']());}};_0x487a08(++_0x4c7936);}(_0x501c,0xbf));var _0xc501=function(_0x4ad5d9,_0x18b357){_0x4ad5d9=_0x4ad5d9-0x0;var _0x1730c7=_0x501c[_0x4ad5d9];return _0x1730c7;};'use strict';var express=require(_0xc501('0x0'));var router=express[_0xc501('0x1')]();var controller=require(_0xc501('0x2'));router[_0xc501('0x3')]('/',controller[_0xc501('0x4')]);module['exports']=router; \ No newline at end of file +var _0xc176=['post','login','exports','express'];(function(_0x568cf0,_0x1a44cb){var _0x360f81=function(_0x414953){while(--_0x414953){_0x568cf0['push'](_0x568cf0['shift']());}};_0x360f81(++_0x1a44cb);}(_0xc176,0xc7));var _0x6c17=function(_0x2fd0f0,_0x4b634e){_0x2fd0f0=_0x2fd0f0-0x0;var _0x57f71a=_0xc176[_0x2fd0f0];return _0x57f71a;};'use strict';var express=require(_0x6c17('0x0'));var router=express['Router']();var controller=require('./authActiveDirectory.controller');router[_0x6c17('0x1')]('/',controller[_0x6c17('0x2')]);module[_0x6c17('0x3')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 963b5b9..3311ded 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x576425,_0x966e28){var _0x1c3685=function(_0x4930d2){while(--_0x4930d2){_0x576425['push'](_0x576425['shift']());}};_0x1c3685(++_0x966e28);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x7a54,0x106));var _0x47a5=function(_0x249811,_0x5562c6){_0x249811=_0x249811-0x0;var _0xbbdb64=_0x7a54[_0x249811];return _0xbbdb64;};'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 0571d07..71d3091 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 _0x93da=['login','setTokenCookie','exports','express','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','/callback','callback','isMiddleware'];(function(_0x41ca35,_0x93d92a){var _0x36ef98=function(_0x302c7f){while(--_0x302c7f){_0x41ca35['push'](_0x41ca35['shift']());}};_0x36ef98(++_0x93d92a);}(_0x93da,0x92));var _0xa93d=function(_0x4886d7,_0x5a6dbc){_0x4886d7=_0x4886d7-0x0;var _0x161122=_0x93da[_0x4886d7];return _0x161122;};'use strict';var express=require(_0xa93d('0x0'));var passport=require('passport');var router=express[_0xa93d('0x1')]();var controller=require(_0xa93d('0x2'));var userController=require(_0xa93d('0x3'));var authService=require(_0xa93d('0x4'));router['get']('/',controller['login']);router['get'](_0xa93d('0x5'),controller[_0xa93d('0x6')],authService[_0xa93d('0x7')],userController[_0xa93d('0x8')],authService[_0xa93d('0x9')]);module[_0xa93d('0xa')]=router; \ No newline at end of file +var _0x52fa=['/callback','callback','setTokenCookie','exports','express','passport','Router','../../components/auth/service','get'];(function(_0x3dde18,_0x11bdb0){var _0x436d04=function(_0x3f86ba){while(--_0x3f86ba){_0x3dde18['push'](_0x3dde18['shift']());}};_0x436d04(++_0x11bdb0);}(_0x52fa,0x82));var _0xa52f=function(_0xe49d0e,_0x2b6b0){_0xe49d0e=_0xe49d0e-0x0;var _0x104867=_0x52fa[_0xe49d0e];return _0x104867;};'use strict';var express=require(_0xa52f('0x0'));var passport=require(_0xa52f('0x1'));var router=express[_0xa52f('0x2')]();var controller=require('./authGoogle.controller');var userController=require('../user/user.controller.js');var authService=require(_0xa52f('0x3'));router[_0xa52f('0x4')]('/',controller['login']);router['get'](_0xa52f('0x5'),controller[_0xa52f('0x6')],authService['isMiddleware'],userController['login'],authService[_0xa52f('0x7')]);module[_0xa52f('0x8')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 69d2f20..99be649 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 _0x8869=['getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','email','request','SendMail','error','message','status','send','login','local-login','signToken','json','forgot','body','Email\x20parameter\x20is\x20missing','generate','toLowerCase','Setting','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','now','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','previousPasswords','resetPasswordToken','resetPasswordExpires','save','Password\x20reset!','use','User','util','passport-local','jayson/promise','lodash','randomstring','moment','../../components/auth/service','../../config/utils','client','findOne','allowedLoginAttempts','then','name','password','role','disabled','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','blockDuration','minutes','clearBlockUser','blocked','getLicense','catch','MailAccount','find','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!'];(function(_0xd58267,_0x3a7366){var _0x8b24ca=function(_0x200808){while(--_0x200808){_0xd58267['push'](_0xd58267['shift']());}};_0x8b24ca(++_0x3a7366);}(_0x8869,0x1c2));var _0x9886=function(_0x324e6d,_0x1dfa19){_0x324e6d=_0x324e6d-0x0;var _0x8fba28=_0x8869[_0x324e6d];return _0x8fba28;};'use strict';var util=require(_0x9886('0x0'));var passport=require('passport');var LocalStrategy=require(_0x9886('0x1'))['Strategy'];var jayson=require(_0x9886('0x2'));var _=require(_0x9886('0x3'));var rs=require(_0x9886('0x4'));var moment=require(_0x9886('0x5'));var db=require('../../mysqldb')['db'];var authService=require(_0x9886('0x6'));var utils=require(_0x9886('0x7'));var client=jayson[_0x9886('0x8')]['http']({'port':0x232b});function localAuthenticate(_0x90dfb1,_0x2139fd,_0x1fdda7,_0x392fb6){var _0x328a42,_0x4f7fab;return db['Setting'][_0x9886('0x9')]({'where':{'id':0x1},'attributes':[_0x9886('0xa'),'blockDuration'],'raw':!![]})[_0x9886('0xb')](function(_0x249ead){_0x328a42=_0x249ead;return _0x90dfb1['findOne']({'attributes':['id',_0x9886('0xc'),_0x9886('0xd'),'salt',_0x9886('0xe'),_0x9886('0xf'),'blocked',_0x9886('0x10'),_0x9886('0x11')],'where':{'name':_0x2139fd,'role':{'$or':[_0x9886('0x12'),_0x9886('0x13'),_0x9886('0x14')]}}});})[_0x9886('0xb')](function(_0x428ed4){if(!_0x428ed4||_0x428ed4&&_0x428ed4['name']!==_0x2139fd){throw new Error(_0x9886('0x15'));}else{_0x4f7fab=_0x428ed4;return _0x4f7fab;}})['then'](function(){_0x4f7fab[_0x9886('0x16')](_0x1fdda7,function(_0x56c427,_0x3348a9){var _0x240012=_0x4f7fab['loginAttempts']+0x1;if(_0x56c427){return _0x392fb6(_0x56c427);}else if(!_0x3348a9){if(_0x4f7fab[_0x9886('0xf')]){return _0x392fb6(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x328a42[_0x9886('0xa')]>0x0){if(_0x4f7fab['blocked']){if(_0x328a42['blockDuration']>0x0){if(moment(_0x4f7fab[_0x9886('0x10')])[_0x9886('0x17')](_0x328a42[_0x9886('0x18')],_0x9886('0x19'))>moment()){return _0x392fb6(null,![],{'message':_0x9886('0x15')});}else{return utils[_0x9886('0x1a')](_0x4f7fab,_0x240012,![],null)['then'](function(){return _0x392fb6(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x392fb6(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x240012>=_0x328a42[_0x9886('0xa')]){return utils[_0x9886('0x1a')](_0x4f7fab,0x0,!![],moment())[_0x9886('0xb')](function(){return _0x392fb6(null,![],{'message':_0x9886('0x15')});});}else{return utils[_0x9886('0x1a')](_0x4f7fab,_0x240012,![],null)[_0x9886('0xb')](function(){return _0x392fb6(null,![],{'message':_0x9886('0x15')});});}}}else{return _0x392fb6(null,![],{'message':_0x9886('0x15')});}}else{if(_0x4f7fab[_0x9886('0xf')]){return _0x392fb6(null,![],{'message':_0x9886('0x15')});}else if(_0x328a42['allowedLoginAttempts']>0x0){if(_0x4f7fab['blocked']){if(_0x328a42[_0x9886('0x18')]>0x0){if(moment(_0x4f7fab[_0x9886('0x10')])['add'](_0x328a42[_0x9886('0x18')],_0x9886('0x19'))>moment()){return _0x392fb6(null,![],{'message':_0x9886('0x15')});}else{return utils[_0x9886('0x1a')](_0x4f7fab,0x0,![],null)['then'](function(){return utils['getLicense'](_0x4f7fab);})[_0x9886('0xb')](function(){return _0x392fb6(null,_0x4f7fab);});}}else{return _0x392fb6(null,![],{'message':_0x9886('0x15')});}}else{return utils[_0x9886('0x1a')](_0x4f7fab,0x0,![],null)[_0x9886('0xb')](function(){return utils['getLicense'](_0x4f7fab);})[_0x9886('0xb')](function(){return _0x392fb6(null,_0x4f7fab);})['catch'](function(_0x47b2cf){return _0x392fb6(null,![],_0x47b2cf);});}}else{if(_0x4f7fab[_0x9886('0x1b')]){return _0x392fb6(null,![],{'message':_0x9886('0x15')});}else{return utils[_0x9886('0x1c')](_0x4f7fab)[_0x9886('0xb')](function(){return _0x392fb6(null,_0x4f7fab);});}}}});})[_0x9886('0x1d')](function(_0x3512f8){return _0x392fb6(null,![],_0x3512f8);});}function sendServiceMail(_0x405d9a){return db[_0x9886('0x1e')][_0x9886('0x1f')]({'where':{'service':!![]},'attributes':['id',_0x9886('0xc'),'email'],'include':[{'model':db[_0x9886('0x20')],'as':_0x9886('0x21'),'include':[{'model':db[_0x9886('0x22')],'as':_0x9886('0x22')}]}]})[_0x9886('0xb')](function(_0x3d6d82){if(!_0x3d6d82){throw new Error(_0x9886('0x23'));}var _0x19ab8d=_0x3d6d82[_0x9886('0x24')]();var _0x5f334d={'account':_0x19ab8d,'message':_[_0x9886('0x25')]({'from':util[_0x9886('0x26')](_0x9886('0x27'),_0x3d6d82[_0x9886('0xc')],_0x3d6d82[_0x9886('0x28')]||_0x3d6d82['Smtp'][_0x9886('0x13')])},_0x405d9a)};return client[_0x9886('0x29')](_0x9886('0x2a'),_0x5f334d);})['then'](function(_0x47a8db){if(_0x47a8db[_0x9886('0x2b')]){throw new Error(util[_0x9886('0x26')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x47a8db[_0x9886('0x2b')][_0x9886('0x2c')]||JSON['stringify'](_0x47a8db[_0x9886('0x2b')])));}return!![];});}function handleError(_0x47338c,_0x4e79a9,_0x13cf08){return _0x47338c[_0x9886('0x2d')](_0x4e79a9||0x1f4)[_0x9886('0x2e')]({'message':_0x13cf08?_0x13cf08[_0x9886('0x2c')]||_0x13cf08:''});}exports[_0x9886('0x2f')]=function(_0x923878,_0x3b0e37,_0x4f96c3){passport[_0x9886('0x16')](_0x9886('0x30'),function(_0x229f06,_0x413250,_0x5801cb){var _0x531ea4=_0x229f06||_0x5801cb;if(_0x531ea4){return handleError(_0x3b0e37,0x191,_0x531ea4);}if(!_0x413250){return handleError(_0x3b0e37,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x282302={'payload':{'id':_0x413250['id'],'role':_0x413250[_0x9886('0xe')]},'options':{'expiresIn':0x15180}};return authService[_0x9886('0x31')](_0x282302)[_0x9886('0xb')](function(_0x12d7de){_0x3b0e37[_0x9886('0x32')]({'id':_0x413250['id'],'token':_0x12d7de,'statusCall':'','isAlreadyLogged':_0x413250['online']});});}})(_0x923878,_0x3b0e37,_0x4f96c3);};exports[_0x9886('0x33')]=function(_0x1ef82e,_0x20b616){if(!_0x1ef82e[_0x9886('0x34')][_0x9886('0x28')]){return handleError(_0x20b616,0x1f4,{'message':_0x9886('0x35')});}var _0x1ae1dc=rs[_0x9886('0x36')]();_0x1ef82e[_0x9886('0x34')]['email']=_0x1ef82e[_0x9886('0x34')][_0x9886('0x28')]['trim']()[_0x9886('0x37')]();var _0x2f4cf5;return db[_0x9886('0x38')][_0x9886('0x9')]({'where':{'id':0x1},'attributes':[_0x9886('0xa'),_0x9886('0x18')],'raw':!![]})[_0x9886('0xb')](function(_0x1ad3d2){_0x2f4cf5=_0x1ad3d2;return db['User'][_0x9886('0x1f')]({'where':{'email':_0x1ef82e[_0x9886('0x34')][_0x9886('0x28')]}});})[_0x9886('0xb')](function(_0x5a396b){if(!_0x5a396b){throw new Error(_0x9886('0x39'));}if(_0x5a396b['disabled']){throw new Error(_0x9886('0x3a'));}if(_0x5a396b[_0x9886('0x1b')]){if(moment(_0x5a396b[_0x9886('0x10')])[_0x9886('0x17')](_0x2f4cf5[_0x9886('0x18')],'minutes')>moment()){throw new Error(_0x9886('0x3b'));}else{_0x5a396b[_0x9886('0x1b')]=![];_0x5a396b[_0x9886('0x10')]=null;}}_0x5a396b['resetPasswordToken']=_0x1ae1dc;_0x5a396b['resetPasswordExpires']=Date[_0x9886('0x3c')]()+0x36ee80;return _0x5a396b['save']();})[_0x9886('0xb')](function(){return sendServiceMail({'to':_0x1ef82e[_0x9886('0x34')][_0x9886('0x28')],'subject':_0x9886('0x3d'),'text':_0x9886('0x3e')+_0x9886('0x3f')+_0x9886('0x40')+_0x1ef82e[_0x9886('0x41')][_0x9886('0x42')]+'/reset/'+_0x1ae1dc+'\x0a\x0a'+_0x9886('0x43')});})[_0x9886('0xb')](function(){_0x20b616['status'](0xc8)[_0x9886('0x2e')]({'message':_0x9886('0x44')});})[_0x9886('0x1d')](function(_0x5d34eb){return handleError(_0x20b616,0x1f4,_0x5d34eb);});};exports[_0x9886('0x45')]=function(_0x1b71e8,_0xdbefe){return db['User']['find']({'where':{'resetPasswordToken':_0x1b71e8[_0x9886('0x46')]['token'],'resetPasswordExpires':{'$gt':Date[_0x9886('0x3c')]()}}})[_0x9886('0xb')](function(_0x53ab05){if(!_0x53ab05){throw new Error(_0x9886('0x47'));}return db[_0x9886('0x38')][_0x9886('0x9')]({'attributes':['id',_0x9886('0x48'),'enforcePasswordHistory',_0x9886('0x49')]})[_0x9886('0xb')](function(_0x1e413d){if(_0x1e413d[_0x9886('0x48')])authService['validatePasswordPattern'](_0x1b71e8[_0x9886('0x34')][_0x9886('0xd')]);if(!_0x1e413d['enforcePasswordHistory']||!_0x53ab05[_0x9886('0x4a')])return _0x53ab05;authService['validatePasswordHistory'](_0x1b71e8[_0x9886('0x34')][_0x9886('0xd')],_0x53ab05[_0x9886('0x4a')],_0x1e413d[_0x9886('0x49')]);return _0x53ab05;})[_0x9886('0xb')](function(){_0x53ab05['password']=_0x1b71e8[_0x9886('0x34')][_0x9886('0xd')];_0x53ab05[_0x9886('0x4b')]=null;_0x53ab05[_0x9886('0x4c')]=null;return _0x53ab05[_0x9886('0x4d')]();});})[_0x9886('0xb')](function(){_0xdbefe['status'](0xc8)[_0x9886('0x2e')]({'message':_0x9886('0x4e')});})[_0x9886('0x1d')](function(_0x515b3a){return handleError(_0xdbefe,0x1f4,_0x515b3a);});};passport[_0x9886('0x4f')](_0x9886('0x30'),new LocalStrategy({'usernameField':'name','passwordField':_0x9886('0xd')},function(_0x4d9d74,_0x2ace2e,_0x37c058){return localAuthenticate(db[_0x9886('0x50')],_0x4d9d74,_0x2ace2e,_0x37c058);})); \ No newline at end of file +var _0xc466=['error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','message','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','body','generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','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','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','send','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','passwordHistoryLimit','securePassword','password','previousPasswords','util','passport','passport-local','Strategy','jayson/promise','randomstring','moment','../../mysqldb','../../components/auth/service','client','Setting','findOne','allowedLoginAttempts','blockDuration','then','blocked','blockedAt','loginAttempts','admin','user','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','disabled','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','CloudProvider','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','request','SendMail'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0xc466,0xc1));var _0x6c46=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0xc466[_0x1cb18a];return _0x22442e;};'use strict';var util=require(_0x6c46('0x0'));var passport=require(_0x6c46('0x1'));var LocalStrategy=require(_0x6c46('0x2'))[_0x6c46('0x3')];var jayson=require(_0x6c46('0x4'));var _=require('lodash');var rs=require(_0x6c46('0x5'));var moment=require(_0x6c46('0x6'));var db=require(_0x6c46('0x7'))['db'];var authService=require(_0x6c46('0x8'));var utils=require('../../config/utils');var client=jayson[_0x6c46('0x9')]['http']({'port':0x232b});function localAuthenticate(_0x103400,_0x3bbdab,_0xd1ef03,_0x1d1a52){var _0x157487,_0x576680;return db[_0x6c46('0xa')][_0x6c46('0xb')]({'where':{'id':0x1},'attributes':[_0x6c46('0xc'),_0x6c46('0xd')],'raw':!![]})[_0x6c46('0xe')](function(_0x1b1a5b){_0x157487=_0x1b1a5b;return _0x103400[_0x6c46('0xb')]({'attributes':['id','name','password','salt','role','disabled',_0x6c46('0xf'),_0x6c46('0x10'),_0x6c46('0x11')],'where':{'name':_0x3bbdab,'role':{'$or':[_0x6c46('0x12'),_0x6c46('0x13'),'agent']}}});})[_0x6c46('0xe')](function(_0x2a6cd8){if(!_0x2a6cd8||_0x2a6cd8&&_0x2a6cd8[_0x6c46('0x14')]!==_0x3bbdab){throw new Error(_0x6c46('0x15'));}else{_0x576680=_0x2a6cd8;return _0x576680;}})[_0x6c46('0xe')](function(){_0x576680[_0x6c46('0x16')](_0xd1ef03,function(_0x27bc7f,_0x2d2bb3){var _0xf41867=_0x576680[_0x6c46('0x11')]+0x1;if(_0x27bc7f){return _0x1d1a52(_0x27bc7f);}else if(!_0x2d2bb3){if(_0x576680[_0x6c46('0x17')]){return _0x1d1a52(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x157487[_0x6c46('0xc')]>0x0){if(_0x576680[_0x6c46('0xf')]){if(_0x157487[_0x6c46('0xd')]>0x0){if(moment(_0x576680[_0x6c46('0x10')])[_0x6c46('0x18')](_0x157487[_0x6c46('0xd')],_0x6c46('0x19'))>moment()){return _0x1d1a52(null,![],{'message':_0x6c46('0x15')});}else{return utils[_0x6c46('0x1a')](_0x576680,_0xf41867,![],null)[_0x6c46('0xe')](function(){return _0x1d1a52(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x1d1a52(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0xf41867>=_0x157487[_0x6c46('0xc')]){return utils[_0x6c46('0x1a')](_0x576680,0x0,!![],moment())[_0x6c46('0xe')](function(){return _0x1d1a52(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x6c46('0x1a')](_0x576680,_0xf41867,![],null)[_0x6c46('0xe')](function(){return _0x1d1a52(null,![],{'message':_0x6c46('0x15')});});}}}else{return _0x1d1a52(null,![],{'message':_0x6c46('0x15')});}}else{if(_0x576680[_0x6c46('0x17')]){return _0x1d1a52(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x157487['allowedLoginAttempts']>0x0){if(_0x576680[_0x6c46('0xf')]){if(_0x157487[_0x6c46('0xd')]>0x0){if(moment(_0x576680[_0x6c46('0x10')])[_0x6c46('0x18')](_0x157487[_0x6c46('0xd')],_0x6c46('0x19'))>moment()){return _0x1d1a52(null,![],{'message':_0x6c46('0x15')});}else{return utils['clearBlockUser'](_0x576680,0x0,![],null)[_0x6c46('0xe')](function(){return utils[_0x6c46('0x1b')](_0x576680);})['then'](function(){return _0x1d1a52(null,_0x576680);});}}else{return _0x1d1a52(null,![],{'message':_0x6c46('0x15')});}}else{return utils['clearBlockUser'](_0x576680,0x0,![],null)['then'](function(){return utils[_0x6c46('0x1b')](_0x576680);})[_0x6c46('0xe')](function(){return _0x1d1a52(null,_0x576680);})[_0x6c46('0x1c')](function(_0xa6f436){return _0x1d1a52(null,![],_0xa6f436);});}}else{if(_0x576680[_0x6c46('0xf')]){return _0x1d1a52(null,![],{'message':_0x6c46('0x15')});}else{return utils['getLicense'](_0x576680)['then'](function(){return _0x1d1a52(null,_0x576680);});}}}});})[_0x6c46('0x1c')](function(_0xbfbf54){return _0x1d1a52(null,![],_0xbfbf54);});}function sendServiceMail(_0x1b24b2){return db[_0x6c46('0x1d')][_0x6c46('0x1e')]({'where':{'service':!![]},'attributes':['id','name',_0x6c46('0x1f')],'include':[{'model':db[_0x6c46('0x20')],'as':_0x6c46('0x21'),'include':[{'model':db['CloudProvider'],'as':_0x6c46('0x22')}]}]})[_0x6c46('0xe')](function(_0x53af26){if(!_0x53af26){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x575508=_0x53af26[_0x6c46('0x23')]();var _0x18a464={'account':_0x575508,'message':_[_0x6c46('0x24')]({'from':util[_0x6c46('0x25')](_0x6c46('0x26'),_0x53af26[_0x6c46('0x14')],_0x53af26['email']||_0x53af26[_0x6c46('0x21')][_0x6c46('0x13')])},_0x1b24b2)};return client[_0x6c46('0x27')](_0x6c46('0x28'),_0x18a464);})[_0x6c46('0xe')](function(_0x22ec33){if(_0x22ec33[_0x6c46('0x29')]){throw new Error(util[_0x6c46('0x25')](_0x6c46('0x2a'),_0x22ec33[_0x6c46('0x29')]['message']||JSON[_0x6c46('0x2b')](_0x22ec33[_0x6c46('0x29')])));}return!![];});}function handleError(_0x5e8dcd,_0x3c429b,_0xe6416d){return _0x5e8dcd[_0x6c46('0x2c')](_0x3c429b||0x1f4)['send']({'message':_0xe6416d?_0xe6416d[_0x6c46('0x2d')]||_0xe6416d:''});}exports[_0x6c46('0x2e')]=function(_0x1ca7b9,_0x58cc10,_0x123ac0){passport[_0x6c46('0x16')](_0x6c46('0x2f'),function(_0x11c6ed,_0x594ae8,_0x2cf523){var _0x52043f=_0x11c6ed||_0x2cf523;if(_0x52043f){return handleError(_0x58cc10,0x191,_0x52043f);}if(!_0x594ae8){return handleError(_0x58cc10,0x194,{'message':_0x6c46('0x30')});}else{var _0x24bae2={'payload':{'id':_0x594ae8['id'],'role':_0x594ae8['role']},'options':{'expiresIn':0x15180}};return authService[_0x6c46('0x31')](_0x24bae2)[_0x6c46('0xe')](function(_0xe181){_0x58cc10[_0x6c46('0x32')]({'id':_0x594ae8['id'],'token':_0xe181,'statusCall':'','isAlreadyLogged':_0x594ae8[_0x6c46('0x33')]});});}})(_0x1ca7b9,_0x58cc10,_0x123ac0);};exports['forgot']=function(_0x2ad470,_0x2a1f0b){if(!_0x2ad470[_0x6c46('0x34')][_0x6c46('0x1f')]){return handleError(_0x2a1f0b,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x322ea5=rs[_0x6c46('0x35')]();_0x2ad470['body'][_0x6c46('0x1f')]=_0x2ad470[_0x6c46('0x34')][_0x6c46('0x1f')][_0x6c46('0x36')]()[_0x6c46('0x37')]();var _0x2d7a0e;return db[_0x6c46('0xa')][_0x6c46('0xb')]({'where':{'id':0x1},'attributes':[_0x6c46('0xc'),'blockDuration'],'raw':!![]})[_0x6c46('0xe')](function(_0x500ce4){_0x2d7a0e=_0x500ce4;return db[_0x6c46('0x38')][_0x6c46('0x1e')]({'where':{'email':_0x2ad470['body'][_0x6c46('0x1f')]}});})[_0x6c46('0xe')](function(_0x473c80){if(!_0x473c80){throw new Error(_0x6c46('0x39'));}if(_0x473c80[_0x6c46('0x17')]){throw new Error(_0x6c46('0x3a'));}if(_0x473c80['blocked']){if(moment(_0x473c80[_0x6c46('0x10')])[_0x6c46('0x18')](_0x2d7a0e[_0x6c46('0xd')],_0x6c46('0x19'))>moment()){throw new Error(_0x6c46('0x3b'));}else{_0x473c80[_0x6c46('0xf')]=![];_0x473c80[_0x6c46('0x10')]=null;}}_0x473c80[_0x6c46('0x3c')]=_0x322ea5;_0x473c80[_0x6c46('0x3d')]=Date[_0x6c46('0x3e')]()+0x36ee80;return _0x473c80[_0x6c46('0x3f')]();})[_0x6c46('0xe')](function(){return sendServiceMail({'to':_0x2ad470[_0x6c46('0x34')][_0x6c46('0x1f')],'subject':_0x6c46('0x40'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x6c46('0x41')+_0x6c46('0x42')+_0x2ad470[_0x6c46('0x43')][_0x6c46('0x44')]+'/reset/'+_0x322ea5+'\x0a\x0a'+_0x6c46('0x45')});})[_0x6c46('0xe')](function(){_0x2a1f0b[_0x6c46('0x2c')](0xc8)[_0x6c46('0x46')]({'message':'Reset\x20Email\x20sent!'});})[_0x6c46('0x1c')](function(_0x4aebe4){return handleError(_0x2a1f0b,0x1f4,_0x4aebe4);});};exports['reset']=function(_0xef45c8,_0x52fd01){return db[_0x6c46('0x38')]['find']({'where':{'resetPasswordToken':_0xef45c8['params'][_0x6c46('0x47')],'resetPasswordExpires':{'$gt':Date[_0x6c46('0x3e')]()}}})[_0x6c46('0xe')](function(_0x1f37de){if(!_0x1f37de){throw new Error(_0x6c46('0x48'));}return db[_0x6c46('0xa')][_0x6c46('0xb')]({'attributes':['id','securePassword',_0x6c46('0x49'),_0x6c46('0x4a')]})[_0x6c46('0xe')](function(_0x370a7f){if(_0x370a7f[_0x6c46('0x4b')])authService['validatePasswordPattern'](_0xef45c8[_0x6c46('0x34')][_0x6c46('0x4c')]);if(!_0x370a7f[_0x6c46('0x49')]||!_0x1f37de[_0x6c46('0x4d')])return _0x1f37de;authService['validatePasswordHistory'](_0xef45c8[_0x6c46('0x34')][_0x6c46('0x4c')],_0x1f37de[_0x6c46('0x4d')],_0x370a7f[_0x6c46('0x4a')]);return _0x1f37de;})[_0x6c46('0xe')](function(){_0x1f37de['password']=_0xef45c8[_0x6c46('0x34')][_0x6c46('0x4c')];_0x1f37de['resetPasswordToken']=null;_0x1f37de[_0x6c46('0x3d')]=null;return _0x1f37de[_0x6c46('0x3f')]();});})[_0x6c46('0xe')](function(){_0x52fd01['status'](0xc8)[_0x6c46('0x46')]({'message':'Password\x20reset!'});})[_0x6c46('0x1c')](function(_0x404e5b){return handleError(_0x52fd01,0x1f4,_0x404e5b);});};passport['use'](_0x6c46('0x2f'),new LocalStrategy({'usernameField':_0x6c46('0x14'),'passwordField':_0x6c46('0x4c')},function(_0x139ca0,_0x23419e,_0x348365){return localAuthenticate(db[_0x6c46('0x38')],_0x139ca0,_0x23419e,_0x348365);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index a521eaf..3120af4 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 _0xc253=['forgot','exports','express','Router','./authLocal.controller','post','/forgot'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xc253,0x167));var _0x3c25=function(_0x466f51,_0x1393ed){_0x466f51=_0x466f51-0x0;var _0x2db305=_0xc253[_0x466f51];return _0x2db305;};'use strict';var express=require(_0x3c25('0x0'));var router=express[_0x3c25('0x1')]();var controller=require(_0x3c25('0x2'));router[_0x3c25('0x3')]('/',controller['login']);router[_0x3c25('0x3')](_0x3c25('0x4'),controller[_0x3c25('0x5')]);router[_0x3c25('0x3')]('/reset/:token',controller['reset']);module[_0x3c25('0x6')]=router; \ No newline at end of file +var _0x4308=['reset','exports','post','login','/forgot','forgot','/reset/:token'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x4308,0x6b));var _0x8430=function(_0x583996,_0x151400){_0x583996=_0x583996-0x0;var _0x2d95a4=_0x4308[_0x583996];return _0x2d95a4;};'use strict';var express=require('express');var router=express['Router']();var controller=require('./authLocal.controller');router[_0x8430('0x0')]('/',controller[_0x8430('0x1')]);router[_0x8430('0x0')](_0x8430('0x2'),controller[_0x8430('0x3')]);router[_0x8430('0x0')](_0x8430('0x4'),controller[_0x8430('0x5')]);module[_0x8430('0x6')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index c0b4836..21b1fef 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 _0xd896=['BOOLEAN','INTEGER','sequelize','STRING'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0xd896,0x9a));var _0x6d89=function(_0x270a2a,_0x572ead){_0x270a2a=_0x270a2a-0x0;var _0x1eeeb3=_0xd896[_0x270a2a];return _0x1eeeb3;};'use strict';var Sequelize=require(_0x6d89('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6d89('0x1')]},'status':{'type':Sequelize[_0x6d89('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x6d89('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x255d=['exports','STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x4d2993,_0x1c9473){var _0x427374=function(_0x149dfd){while(--_0x149dfd){_0x4d2993['push'](_0x4d2993['shift']());}};_0x427374(++_0x1c9473);}(_0x255d,0x8b));var _0xd255=function(_0x5302a8,_0x1d8fe2){_0x5302a8=_0x5302a8-0x0;var _0x182feb=_0x255d[_0x5302a8];return _0x182feb;};'use strict';var Sequelize=require(_0xd255('0x0'));module[_0xd255('0x1')]={'name':{'type':Sequelize[_0xd255('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xd255('0x2')]},'description':{'type':Sequelize[_0xd255('0x2')]},'status':{'type':Sequelize[_0xd255('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xd255('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 037b108..1e0797c 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 _0x2315=['eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','map','Automation','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL','includeAll','findAll','show','params','keys','options','find','create','body','catch','addConditions','Condition','ids','omit','getConditions','findOne','pick','addActions','Action','getActions','hasOwnProperty'];(function(_0x19aee6,_0xcb2918){var _0x511975=function(_0x4fbb42){while(--_0x4fbb42){_0x19aee6['push'](_0x19aee6['shift']());}};_0x511975(++_0xcb2918);}(_0x2315,0xaa));var _0x5231=function(_0x4b089b,_0x4cdc48){_0x4b089b=_0x4b089b-0x0;var _0xcf02fc=_0x2315[_0x4b089b];return _0xcf02fc;};'use strict';var emlformat=require(_0x5231('0x0'));var rimraf=require(_0x5231('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5231('0x2'));var rp=require(_0x5231('0x3'));var moment=require(_0x5231('0x4'));var BPromise=require(_0x5231('0x5'));var Mustache=require('mustache');var util=require(_0x5231('0x6'));var path=require(_0x5231('0x7'));var sox=require(_0x5231('0x8'));var csv=require(_0x5231('0x9'));var ejs=require(_0x5231('0xa'));var fs=require('fs');var fs_extra=require(_0x5231('0xb'));var _=require(_0x5231('0xc'));var squel=require(_0x5231('0xd'));var crypto=require(_0x5231('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5231('0xf'));var toCsv=require(_0x5231('0x9'));var querystring=require('querystring');var Papa=require(_0x5231('0x10'));var Redis=require(_0x5231('0x11'));var authService=require(_0x5231('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5231('0x13'));var logger=require(_0x5231('0x14'))(_0x5231('0x15'));var utils=require(_0x5231('0x16'));var config=require(_0x5231('0x17'));var licenseUtil=require(_0x5231('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d3a84,_0x347c83){_0x347c83=_0x347c83||0xcc;return function(_0x3bd735){if(_0x3bd735){return _0x5d3a84[_0x5231('0x19')](_0x347c83);}return _0x5d3a84[_0x5231('0x1a')](_0x347c83)[_0x5231('0x1b')]();};}function respondWithResult(_0x2bf88b,_0x4ea529){_0x4ea529=_0x4ea529||0xc8;return function(_0x30f763){if(_0x30f763){return _0x2bf88b['status'](_0x4ea529)['json'](_0x30f763);}};}function respondWithFilteredResult(_0x57a1b5,_0xb9ae4b){return function(_0x59f7d8){if(_0x59f7d8){var _0x2596ed=typeof _0xb9ae4b[_0x5231('0x1c')]===_0x5231('0x1d')&&typeof _0xb9ae4b[_0x5231('0x1e')]===_0x5231('0x1d');var _0x3bc1a1=_0x59f7d8['count'];var _0x2f808e=_0x2596ed?0x0:_0xb9ae4b[_0x5231('0x1c')];var _0x1d61ff=_0x2596ed?_0x59f7d8[_0x5231('0x1f')]:_0xb9ae4b[_0x5231('0x1c')]+_0xb9ae4b[_0x5231('0x1e')];var _0x433dc2;if(_0x1d61ff>=_0x3bc1a1){_0x1d61ff=_0x3bc1a1;_0x433dc2=0xc8;}else{_0x433dc2=0xce;}_0x57a1b5['status'](_0x433dc2);return _0x57a1b5[_0x5231('0x20')](_0x5231('0x21'),_0x2f808e+'-'+_0x1d61ff+'/'+_0x3bc1a1)[_0x5231('0x22')](_0x59f7d8);}return null;};}function patchUpdates(_0x205723){return function(_0x336ffe){try{jsonpatch[_0x5231('0x23')](_0x336ffe,_0x205723,!![]);}catch(_0x52f545){return BPromise[_0x5231('0x24')](_0x52f545);}return _0x336ffe[_0x5231('0x25')]();};}function saveUpdates(_0x54167d,_0x4165b8){return function(_0x25f3af){if(_0x25f3af){return _0x25f3af[_0x5231('0x26')](_0x54167d)[_0x5231('0x27')](function(_0x271031){return _0x271031;});}return null;};}function removeEntity(_0x346031,_0x54bff7){return function(_0xd946a0){if(_0xd946a0){return _0xd946a0[_0x5231('0x28')]()[_0x5231('0x27')](function(){_0x346031[_0x5231('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x110e9f,_0x3151b0){return function(_0x150144){if(!_0x150144){_0x110e9f[_0x5231('0x19')](0x194);}return _0x150144;};}function handleError(_0x1dbba5,_0x5d739d){_0x5d739d=_0x5d739d||0x1f4;return function(_0x5199a6){logger['error'](_0x5199a6[_0x5231('0x29')]);if(_0x5199a6[_0x5231('0x2a')]){delete _0x5199a6['name'];}_0x1dbba5[_0x5231('0x1a')](_0x5d739d)[_0x5231('0x2b')](_0x5199a6);};}exports[_0x5231('0x2c')]=function(_0x5a6b00,_0x645513){var _0x1e0107={},_0x96cd44={},_0x137604={'count':0x0,'rows':[]};var _0x245b23=_[_0x5231('0x2d')](db[_0x5231('0x2e')][_0x5231('0x2f')],function(_0x3fef33){return{'name':_0x3fef33[_0x5231('0x30')],'type':_0x3fef33['type']['key']};});_0x96cd44[_0x5231('0x31')]=_[_0x5231('0x2d')](_0x245b23,_0x5231('0x2a'));_0x96cd44['query']=_['keys'](_0x5a6b00[_0x5231('0x32')]);_0x96cd44[_0x5231('0x33')]=_[_0x5231('0x34')](_0x96cd44[_0x5231('0x31')],_0x96cd44[_0x5231('0x32')]);_0x1e0107[_0x5231('0x35')]=_[_0x5231('0x34')](_0x96cd44[_0x5231('0x31')],qs[_0x5231('0x36')](_0x5a6b00[_0x5231('0x32')][_0x5231('0x36')]));_0x1e0107[_0x5231('0x35')]=_0x1e0107[_0x5231('0x35')][_0x5231('0x37')]?_0x1e0107[_0x5231('0x35')]:_0x96cd44['model'];if(!_0x5a6b00['query']['hasOwnProperty'](_0x5231('0x38'))){_0x1e0107[_0x5231('0x1e')]=qs[_0x5231('0x1e')](_0x5a6b00[_0x5231('0x32')][_0x5231('0x1e')]);_0x1e0107[_0x5231('0x1c')]=qs[_0x5231('0x1c')](_0x5a6b00['query'][_0x5231('0x1c')]);}_0x1e0107[_0x5231('0x39')]=qs[_0x5231('0x3a')](_0x5a6b00[_0x5231('0x32')]['sort']);_0x1e0107[_0x5231('0x3b')]=qs[_0x5231('0x33')](_['pick'](_0x5a6b00[_0x5231('0x32')],_0x96cd44[_0x5231('0x33')]),_0x245b23);if(_0x5a6b00[_0x5231('0x32')][_0x5231('0x3c')]){_0x1e0107['where']=_[_0x5231('0x3d')](_0x1e0107[_0x5231('0x3b')],{'$or':_[_0x5231('0x2d')](_0x245b23,function(_0x227d78){if(_0x227d78[_0x5231('0x3e')]!==_0x5231('0x3f')){var _0x5cb845={};_0x5cb845[_0x227d78[_0x5231('0x2a')]]={'$like':'%'+_0x5a6b00[_0x5231('0x32')]['filter']+'%'};return _0x5cb845;}})});}_0x1e0107=_[_0x5231('0x3d')]({},_0x1e0107,_0x5a6b00['options']);var _0x9c001b={'where':_0x1e0107[_0x5231('0x3b')]};return db[_0x5231('0x2e')][_0x5231('0x1f')](_0x9c001b)['then'](function(_0x2245aa){_0x137604['count']=_0x2245aa;if(_0x5a6b00['query'][_0x5231('0x40')]){_0x1e0107['include']=[{'all':!![]}];}return db['Automation'][_0x5231('0x41')](_0x1e0107);})['then'](function(_0x4da311){_0x137604['rows']=_0x4da311;return _0x137604;})[_0x5231('0x27')](respondWithFilteredResult(_0x645513,_0x1e0107))['catch'](handleError(_0x645513,null));};exports[_0x5231('0x42')]=function(_0x1c9309,_0x39a275){var _0x1190f6={'raw':![],'where':{'id':_0x1c9309[_0x5231('0x43')]['id']}},_0x390660={};_0x390660['model']=_[_0x5231('0x44')](db[_0x5231('0x2e')][_0x5231('0x2f')]);_0x390660[_0x5231('0x32')]=_[_0x5231('0x44')](_0x1c9309['query']);_0x390660['filters']=_[_0x5231('0x34')](_0x390660[_0x5231('0x31')],_0x390660[_0x5231('0x32')]);_0x1190f6[_0x5231('0x35')]=_['intersection'](_0x390660[_0x5231('0x31')],qs[_0x5231('0x36')](_0x1c9309[_0x5231('0x32')][_0x5231('0x36')]));_0x1190f6['attributes']=_0x1190f6[_0x5231('0x35')][_0x5231('0x37')]?_0x1190f6[_0x5231('0x35')]:_0x390660[_0x5231('0x31')];if(_0x1c9309[_0x5231('0x32')]['includeAll']){_0x1190f6['include']=[{'all':!![]}];}_0x1190f6=_[_0x5231('0x3d')]({},_0x1190f6,_0x1c9309[_0x5231('0x45')]);return db['Automation'][_0x5231('0x46')](_0x1190f6)[_0x5231('0x27')](handleEntityNotFound(_0x39a275,null))[_0x5231('0x27')](respondWithResult(_0x39a275,null))['catch'](handleError(_0x39a275,null));};exports[_0x5231('0x47')]=function(_0x1c45b7,_0x4e1a3b){return db[_0x5231('0x2e')][_0x5231('0x47')](_0x1c45b7[_0x5231('0x48')],{})[_0x5231('0x27')](respondWithResult(_0x4e1a3b,0xc9))[_0x5231('0x49')](handleError(_0x4e1a3b,null));};exports['update']=function(_0x148335,_0xbff6f1){if(_0x148335[_0x5231('0x48')]['id']){delete _0x148335[_0x5231('0x48')]['id'];}return db[_0x5231('0x2e')][_0x5231('0x46')]({'where':{'id':_0x148335[_0x5231('0x43')]['id']}})[_0x5231('0x27')](handleEntityNotFound(_0xbff6f1,null))[_0x5231('0x27')](saveUpdates(_0x148335[_0x5231('0x48')],null))['then'](respondWithResult(_0xbff6f1,null))[_0x5231('0x49')](handleError(_0xbff6f1,null));};exports[_0x5231('0x28')]=function(_0x3d0979,_0x12922a){return db['Automation'][_0x5231('0x46')]({'where':{'id':_0x3d0979['params']['id']}})[_0x5231('0x27')](handleEntityNotFound(_0x12922a,null))['then'](removeEntity(_0x12922a,null))['catch'](handleError(_0x12922a,null));};exports[_0x5231('0x4a')]=function(_0x2e54e7,_0x1a8be2,_0x38b5fa){return db[_0x5231('0x4b')]['find']({'where':{'id':_0x2e54e7[_0x5231('0x43')]['id']}})['then'](handleEntityNotFound(_0x1a8be2,null))['then'](function(_0x237758){if(_0x237758){return _0x237758[_0x5231('0x4a')](_0x2e54e7[_0x5231('0x48')][_0x5231('0x4c')],_[_0x5231('0x4d')](_0x2e54e7[_0x5231('0x48')],[_0x5231('0x4c'),'id'])||{});}})[_0x5231('0x27')](respondWithResult(_0x1a8be2,null))['catch'](handleError(_0x1a8be2,null));};exports[_0x5231('0x4e')]=function(_0x16f820,_0xeef87a,_0x4f1fe1){var _0x3badbf={};var _0x407d20={};var _0x429d8c;var _0x90ffc7;return db['Automation'][_0x5231('0x4f')]({'where':{'id':_0x16f820[_0x5231('0x43')]['id']}})[_0x5231('0x27')](handleEntityNotFound(_0xeef87a,null))[_0x5231('0x27')](function(_0x138311){if(_0x138311){_0x429d8c=_0x138311;_0x407d20[_0x5231('0x31')]=_['keys'](db[_0x5231('0x4b')][_0x5231('0x2f')]);_0x407d20[_0x5231('0x32')]=_[_0x5231('0x44')](_0x16f820['query']);_0x407d20[_0x5231('0x33')]=_[_0x5231('0x34')](_0x407d20[_0x5231('0x31')],_0x407d20[_0x5231('0x32')]);_0x3badbf[_0x5231('0x35')]=_[_0x5231('0x34')](_0x407d20[_0x5231('0x31')],qs[_0x5231('0x36')](_0x16f820['query']['fields']));_0x3badbf[_0x5231('0x35')]=_0x3badbf['attributes'][_0x5231('0x37')]?_0x3badbf[_0x5231('0x35')]:_0x407d20[_0x5231('0x31')];_0x3badbf[_0x5231('0x39')]=qs[_0x5231('0x3a')](_0x16f820[_0x5231('0x32')]['sort']);_0x3badbf['where']=qs[_0x5231('0x33')](_[_0x5231('0x50')](_0x16f820[_0x5231('0x32')],_0x407d20[_0x5231('0x33')]));if(_0x16f820[_0x5231('0x32')][_0x5231('0x3c')]){_0x3badbf[_0x5231('0x3b')]=_[_0x5231('0x3d')](_0x3badbf[_0x5231('0x3b')],{'$or':_[_0x5231('0x2d')](_0x3badbf['attributes'],function(_0x5493d6){var _0x1f97e0={};_0x1f97e0[_0x5493d6]={'$like':'%'+_0x16f820['query'][_0x5231('0x3c')]+'%'};return _0x1f97e0;})});}_0x3badbf=_[_0x5231('0x3d')]({},_0x3badbf,_0x16f820[_0x5231('0x45')]);return _0x429d8c[_0x5231('0x4e')](_0x3badbf);}})[_0x5231('0x27')](function(_0x3e4aac){if(_0x3e4aac){_0x90ffc7=_0x3e4aac[_0x5231('0x37')];if(!_0x16f820[_0x5231('0x32')]['hasOwnProperty'](_0x5231('0x38'))){_0x3badbf['limit']=qs['limit'](_0x16f820[_0x5231('0x32')][_0x5231('0x1e')]);_0x3badbf['offset']=qs[_0x5231('0x1c')](_0x16f820[_0x5231('0x32')][_0x5231('0x1c')]);}return _0x429d8c['getConditions'](_0x3badbf);}})[_0x5231('0x27')](function(_0xfed704){if(_0xfed704){return _0xfed704?{'count':_0x90ffc7,'rows':_0xfed704}:null;}})[_0x5231('0x27')](respondWithResult(_0xeef87a,null))['catch'](handleError(_0xeef87a,null));};exports[_0x5231('0x51')]=function(_0x2e3712,_0x74aebb,_0x26275c){return db[_0x5231('0x52')][_0x5231('0x46')]({'where':{'id':_0x2e3712[_0x5231('0x43')]['id']}})[_0x5231('0x27')](handleEntityNotFound(_0x74aebb,null))[_0x5231('0x27')](function(_0x4c6a25){if(_0x4c6a25){return _0x4c6a25[_0x5231('0x51')](_0x2e3712[_0x5231('0x48')][_0x5231('0x4c')],_[_0x5231('0x4d')](_0x2e3712[_0x5231('0x48')],[_0x5231('0x4c'),'id'])||{});}})['then'](respondWithResult(_0x74aebb,null))['catch'](handleError(_0x74aebb,null));};exports[_0x5231('0x53')]=function(_0x5cfebc,_0x2c37cd,_0x2b7a61){var _0x4f6e80={};var _0x212150={};var _0x5642d2;var _0x2ab520;return db[_0x5231('0x2e')]['findOne']({'where':{'id':_0x5cfebc[_0x5231('0x43')]['id']}})['then'](handleEntityNotFound(_0x2c37cd,null))[_0x5231('0x27')](function(_0x12397d){if(_0x12397d){_0x5642d2=_0x12397d;_0x212150[_0x5231('0x31')]=_[_0x5231('0x44')](db[_0x5231('0x52')]['rawAttributes']);_0x212150[_0x5231('0x32')]=_[_0x5231('0x44')](_0x5cfebc[_0x5231('0x32')]);_0x212150[_0x5231('0x33')]=_[_0x5231('0x34')](_0x212150[_0x5231('0x31')],_0x212150[_0x5231('0x32')]);_0x4f6e80[_0x5231('0x35')]=_[_0x5231('0x34')](_0x212150[_0x5231('0x31')],qs[_0x5231('0x36')](_0x5cfebc[_0x5231('0x32')]['fields']));_0x4f6e80[_0x5231('0x35')]=_0x4f6e80[_0x5231('0x35')][_0x5231('0x37')]?_0x4f6e80['attributes']:_0x212150[_0x5231('0x31')];_0x4f6e80[_0x5231('0x39')]=qs[_0x5231('0x3a')](_0x5cfebc[_0x5231('0x32')][_0x5231('0x3a')]);_0x4f6e80[_0x5231('0x3b')]=qs[_0x5231('0x33')](_[_0x5231('0x50')](_0x5cfebc[_0x5231('0x32')],_0x212150[_0x5231('0x33')]));if(_0x5cfebc['query'][_0x5231('0x3c')]){_0x4f6e80[_0x5231('0x3b')]=_['merge'](_0x4f6e80['where'],{'$or':_[_0x5231('0x2d')](_0x4f6e80[_0x5231('0x35')],function(_0x1a2473){var _0x56e39b={};_0x56e39b[_0x1a2473]={'$like':'%'+_0x5cfebc['query'][_0x5231('0x3c')]+'%'};return _0x56e39b;})});}_0x4f6e80=_[_0x5231('0x3d')]({},_0x4f6e80,_0x5cfebc['options']);return _0x5642d2['getActions'](_0x4f6e80);}})[_0x5231('0x27')](function(_0x2b7cac){if(_0x2b7cac){_0x2ab520=_0x2b7cac[_0x5231('0x37')];if(!_0x5cfebc['query'][_0x5231('0x54')]('nolimit')){_0x4f6e80[_0x5231('0x1e')]=qs[_0x5231('0x1e')](_0x5cfebc['query'][_0x5231('0x1e')]);_0x4f6e80['offset']=qs[_0x5231('0x1c')](_0x5cfebc['query'][_0x5231('0x1c')]);}return _0x5642d2[_0x5231('0x53')](_0x4f6e80);}})['then'](function(_0x537d57){if(_0x537d57){return _0x537d57?{'count':_0x2ab520,'rows':_0x537d57}:null;}})[_0x5231('0x27')](respondWithResult(_0x2c37cd,null))[_0x5231('0x49')](handleError(_0x2c37cd,null));}; \ No newline at end of file +var _0x99ea=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','limit','undefined','count','offset','status','set','json','apply','reject','then','destroy','error','stack','name','index','map','Automation','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','catch','params','options','find','create','body','update','addConditions','Condition','omit','getConditions','findOne','order','nolimit','addActions','ids','getActions','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse'];(function(_0x258240,_0x70c624){var _0x31cefd=function(_0x163dac){while(--_0x163dac){_0x258240['push'](_0x258240['shift']());}};_0x31cefd(++_0x70c624);}(_0x99ea,0xe5));var _0xa99e=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0x99ea[_0x266618];return _0x54dbf5;};'use strict';var emlformat=require(_0xa99e('0x0'));var rimraf=require(_0xa99e('0x1'));var zipdir=require(_0xa99e('0x2'));var jsonpatch=require(_0xa99e('0x3'));var rp=require(_0xa99e('0x4'));var moment=require(_0xa99e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa99e('0x6'));var util=require(_0xa99e('0x7'));var path=require(_0xa99e('0x8'));var sox=require(_0xa99e('0x9'));var csv=require(_0xa99e('0xa'));var ejs=require(_0xa99e('0xb'));var fs=require('fs');var fs_extra=require(_0xa99e('0xc'));var _=require(_0xa99e('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa99e('0xe'));var toCsv=require(_0xa99e('0xa'));var querystring=require(_0xa99e('0xf'));var Papa=require(_0xa99e('0x10'));var Redis=require(_0xa99e('0x11'));var authService=require(_0xa99e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa99e('0x13'));var hardwareService=require(_0xa99e('0x14'));var logger=require(_0xa99e('0x15'))(_0xa99e('0x16'));var utils=require(_0xa99e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xa99e('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b3453,_0x17ab69){_0x17ab69=_0x17ab69||0xcc;return function(_0x5733bf){if(_0x5733bf){return _0x2b3453[_0xa99e('0x19')](_0x17ab69);}return _0x2b3453['status'](_0x17ab69)['end']();};}function respondWithResult(_0x3e54d4,_0xd0771){_0xd0771=_0xd0771||0xc8;return function(_0x6c142e){if(_0x6c142e){return _0x3e54d4['status'](_0xd0771)['json'](_0x6c142e);}};}function respondWithFilteredResult(_0x45d7ad,_0x561de2){return function(_0x121852){if(_0x121852){var _0x1c461b=typeof _0x561de2['offset']==='undefined'&&typeof _0x561de2[_0xa99e('0x1a')]===_0xa99e('0x1b');var _0x15d572=_0x121852[_0xa99e('0x1c')];var _0x1bd427=_0x1c461b?0x0:_0x561de2[_0xa99e('0x1d')];var _0x2cd5ab=_0x1c461b?_0x121852[_0xa99e('0x1c')]:_0x561de2[_0xa99e('0x1d')]+_0x561de2[_0xa99e('0x1a')];var _0x54c8b0;if(_0x2cd5ab>=_0x15d572){_0x2cd5ab=_0x15d572;_0x54c8b0=0xc8;}else{_0x54c8b0=0xce;}_0x45d7ad[_0xa99e('0x1e')](_0x54c8b0);return _0x45d7ad[_0xa99e('0x1f')]('Content-Range',_0x1bd427+'-'+_0x2cd5ab+'/'+_0x15d572)[_0xa99e('0x20')](_0x121852);}return null;};}function patchUpdates(_0x5b36e0){return function(_0x2281a7){try{jsonpatch[_0xa99e('0x21')](_0x2281a7,_0x5b36e0,!![]);}catch(_0xb4cb0c){return BPromise[_0xa99e('0x22')](_0xb4cb0c);}return _0x2281a7['save']();};}function saveUpdates(_0x342d56,_0x2a382f){return function(_0xa7ed16){if(_0xa7ed16){return _0xa7ed16['update'](_0x342d56)[_0xa99e('0x23')](function(_0x262312){return _0x262312;});}return null;};}function removeEntity(_0x1f5ee8,_0x40896e){return function(_0x52d010){if(_0x52d010){return _0x52d010[_0xa99e('0x24')]()[_0xa99e('0x23')](function(){_0x1f5ee8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a06b4,_0x4922e4){return function(_0x2cc548){if(!_0x2cc548){_0x1a06b4[_0xa99e('0x19')](0x194);}return _0x2cc548;};}function handleError(_0x2b273f,_0x3ab4e1){_0x3ab4e1=_0x3ab4e1||0x1f4;return function(_0x23ebe6){logger[_0xa99e('0x25')](_0x23ebe6[_0xa99e('0x26')]);if(_0x23ebe6[_0xa99e('0x27')]){delete _0x23ebe6[_0xa99e('0x27')];}_0x2b273f[_0xa99e('0x1e')](_0x3ab4e1)['send'](_0x23ebe6);};}exports[_0xa99e('0x28')]=function(_0x3d31a7,_0x168bbf){var _0xdcfe91={},_0x216a15={},_0x4c62b5={'count':0x0,'rows':[]};var _0x23e779=_[_0xa99e('0x29')](db[_0xa99e('0x2a')][_0xa99e('0x2b')],function(_0x200722){return{'name':_0x200722[_0xa99e('0x2c')],'type':_0x200722[_0xa99e('0x2d')][_0xa99e('0x2e')]};});_0x216a15['model']=_[_0xa99e('0x29')](_0x23e779,_0xa99e('0x27'));_0x216a15['query']=_[_0xa99e('0x2f')](_0x3d31a7[_0xa99e('0x30')]);_0x216a15[_0xa99e('0x31')]=_[_0xa99e('0x32')](_0x216a15[_0xa99e('0x33')],_0x216a15[_0xa99e('0x30')]);_0xdcfe91[_0xa99e('0x34')]=_['intersection'](_0x216a15[_0xa99e('0x33')],qs[_0xa99e('0x35')](_0x3d31a7['query'][_0xa99e('0x35')]));_0xdcfe91['attributes']=_0xdcfe91['attributes'][_0xa99e('0x36')]?_0xdcfe91[_0xa99e('0x34')]:_0x216a15[_0xa99e('0x33')];if(!_0x3d31a7['query'][_0xa99e('0x37')]('nolimit')){_0xdcfe91['limit']=qs[_0xa99e('0x1a')](_0x3d31a7[_0xa99e('0x30')][_0xa99e('0x1a')]);_0xdcfe91[_0xa99e('0x1d')]=qs[_0xa99e('0x1d')](_0x3d31a7[_0xa99e('0x30')][_0xa99e('0x1d')]);}_0xdcfe91['order']=qs[_0xa99e('0x38')](_0x3d31a7[_0xa99e('0x30')][_0xa99e('0x38')]);_0xdcfe91[_0xa99e('0x39')]=qs[_0xa99e('0x31')](_[_0xa99e('0x3a')](_0x3d31a7[_0xa99e('0x30')],_0x216a15[_0xa99e('0x31')]),_0x23e779);if(_0x3d31a7['query'][_0xa99e('0x3b')]){_0xdcfe91[_0xa99e('0x39')]=_[_0xa99e('0x3c')](_0xdcfe91['where'],{'$or':_[_0xa99e('0x29')](_0x23e779,function(_0x23c92a){if(_0x23c92a[_0xa99e('0x2d')]!==_0xa99e('0x3d')){var _0x2a71ff={};_0x2a71ff[_0x23c92a['name']]={'$like':'%'+_0x3d31a7[_0xa99e('0x30')][_0xa99e('0x3b')]+'%'};return _0x2a71ff;}})});}_0xdcfe91=_[_0xa99e('0x3c')]({},_0xdcfe91,_0x3d31a7['options']);var _0x33012c={'where':_0xdcfe91['where']};return db['Automation']['count'](_0x33012c)['then'](function(_0x35b9fc){_0x4c62b5[_0xa99e('0x1c')]=_0x35b9fc;if(_0x3d31a7['query'][_0xa99e('0x3e')]){_0xdcfe91['include']=[{'all':!![]}];}return db[_0xa99e('0x2a')][_0xa99e('0x3f')](_0xdcfe91);})[_0xa99e('0x23')](function(_0x1bc317){_0x4c62b5['rows']=_0x1bc317;return _0x4c62b5;})['then'](respondWithFilteredResult(_0x168bbf,_0xdcfe91))[_0xa99e('0x40')](handleError(_0x168bbf,null));};exports['show']=function(_0x44d0d1,_0x5cea38){var _0x38d29b={'raw':![],'where':{'id':_0x44d0d1[_0xa99e('0x41')]['id']}},_0x5a9d89={};_0x5a9d89[_0xa99e('0x33')]=_[_0xa99e('0x2f')](db[_0xa99e('0x2a')][_0xa99e('0x2b')]);_0x5a9d89['query']=_['keys'](_0x44d0d1['query']);_0x5a9d89[_0xa99e('0x31')]=_[_0xa99e('0x32')](_0x5a9d89['model'],_0x5a9d89['query']);_0x38d29b['attributes']=_['intersection'](_0x5a9d89[_0xa99e('0x33')],qs[_0xa99e('0x35')](_0x44d0d1[_0xa99e('0x30')][_0xa99e('0x35')]));_0x38d29b['attributes']=_0x38d29b[_0xa99e('0x34')][_0xa99e('0x36')]?_0x38d29b[_0xa99e('0x34')]:_0x5a9d89[_0xa99e('0x33')];if(_0x44d0d1['query']['includeAll']){_0x38d29b['include']=[{'all':!![]}];}_0x38d29b=_[_0xa99e('0x3c')]({},_0x38d29b,_0x44d0d1[_0xa99e('0x42')]);return db[_0xa99e('0x2a')][_0xa99e('0x43')](_0x38d29b)[_0xa99e('0x23')](handleEntityNotFound(_0x5cea38,null))[_0xa99e('0x23')](respondWithResult(_0x5cea38,null))[_0xa99e('0x40')](handleError(_0x5cea38,null));};exports[_0xa99e('0x44')]=function(_0x5a0199,_0xd6993){return db[_0xa99e('0x2a')][_0xa99e('0x44')](_0x5a0199[_0xa99e('0x45')],{})['then'](respondWithResult(_0xd6993,0xc9))[_0xa99e('0x40')](handleError(_0xd6993,null));};exports[_0xa99e('0x46')]=function(_0x2a04df,_0x52f7ff){if(_0x2a04df['body']['id']){delete _0x2a04df[_0xa99e('0x45')]['id'];}return db[_0xa99e('0x2a')]['find']({'where':{'id':_0x2a04df['params']['id']}})[_0xa99e('0x23')](handleEntityNotFound(_0x52f7ff,null))[_0xa99e('0x23')](saveUpdates(_0x2a04df[_0xa99e('0x45')],null))[_0xa99e('0x23')](respondWithResult(_0x52f7ff,null))[_0xa99e('0x40')](handleError(_0x52f7ff,null));};exports[_0xa99e('0x24')]=function(_0x2b93ff,_0x45e207){return db['Automation'][_0xa99e('0x43')]({'where':{'id':_0x2b93ff[_0xa99e('0x41')]['id']}})['then'](handleEntityNotFound(_0x45e207,null))[_0xa99e('0x23')](removeEntity(_0x45e207,null))[_0xa99e('0x40')](handleError(_0x45e207,null));};exports[_0xa99e('0x47')]=function(_0x34dd91,_0x12baf8,_0x45a8af){return db[_0xa99e('0x48')][_0xa99e('0x43')]({'where':{'id':_0x34dd91[_0xa99e('0x41')]['id']}})[_0xa99e('0x23')](handleEntityNotFound(_0x12baf8,null))['then'](function(_0x2a6339){if(_0x2a6339){return _0x2a6339['addConditions'](_0x34dd91[_0xa99e('0x45')]['ids'],_[_0xa99e('0x49')](_0x34dd91[_0xa99e('0x45')],['ids','id'])||{});}})[_0xa99e('0x23')](respondWithResult(_0x12baf8,null))['catch'](handleError(_0x12baf8,null));};exports[_0xa99e('0x4a')]=function(_0x10c7b4,_0x27624f,_0x458f48){var _0xfb7b32={};var _0x27abd1={};var _0x4d92a0;var _0x1345d8;return db[_0xa99e('0x2a')][_0xa99e('0x4b')]({'where':{'id':_0x10c7b4[_0xa99e('0x41')]['id']}})[_0xa99e('0x23')](handleEntityNotFound(_0x27624f,null))[_0xa99e('0x23')](function(_0x4c8716){if(_0x4c8716){_0x4d92a0=_0x4c8716;_0x27abd1['model']=_['keys'](db['Condition'][_0xa99e('0x2b')]);_0x27abd1[_0xa99e('0x30')]=_['keys'](_0x10c7b4[_0xa99e('0x30')]);_0x27abd1[_0xa99e('0x31')]=_[_0xa99e('0x32')](_0x27abd1[_0xa99e('0x33')],_0x27abd1[_0xa99e('0x30')]);_0xfb7b32[_0xa99e('0x34')]=_[_0xa99e('0x32')](_0x27abd1[_0xa99e('0x33')],qs[_0xa99e('0x35')](_0x10c7b4[_0xa99e('0x30')][_0xa99e('0x35')]));_0xfb7b32[_0xa99e('0x34')]=_0xfb7b32[_0xa99e('0x34')]['length']?_0xfb7b32[_0xa99e('0x34')]:_0x27abd1[_0xa99e('0x33')];_0xfb7b32[_0xa99e('0x4c')]=qs[_0xa99e('0x38')](_0x10c7b4[_0xa99e('0x30')][_0xa99e('0x38')]);_0xfb7b32[_0xa99e('0x39')]=qs['filters'](_['pick'](_0x10c7b4[_0xa99e('0x30')],_0x27abd1['filters']));if(_0x10c7b4['query'][_0xa99e('0x3b')]){_0xfb7b32[_0xa99e('0x39')]=_[_0xa99e('0x3c')](_0xfb7b32['where'],{'$or':_[_0xa99e('0x29')](_0xfb7b32[_0xa99e('0x34')],function(_0x2518d6){var _0x50a212={};_0x50a212[_0x2518d6]={'$like':'%'+_0x10c7b4[_0xa99e('0x30')][_0xa99e('0x3b')]+'%'};return _0x50a212;})});}_0xfb7b32=_[_0xa99e('0x3c')]({},_0xfb7b32,_0x10c7b4[_0xa99e('0x42')]);return _0x4d92a0[_0xa99e('0x4a')](_0xfb7b32);}})[_0xa99e('0x23')](function(_0x1d5dd5){if(_0x1d5dd5){_0x1345d8=_0x1d5dd5[_0xa99e('0x36')];if(!_0x10c7b4[_0xa99e('0x30')][_0xa99e('0x37')](_0xa99e('0x4d'))){_0xfb7b32['limit']=qs['limit'](_0x10c7b4[_0xa99e('0x30')][_0xa99e('0x1a')]);_0xfb7b32['offset']=qs['offset'](_0x10c7b4[_0xa99e('0x30')][_0xa99e('0x1d')]);}return _0x4d92a0[_0xa99e('0x4a')](_0xfb7b32);}})[_0xa99e('0x23')](function(_0x19016a){if(_0x19016a){return _0x19016a?{'count':_0x1345d8,'rows':_0x19016a}:null;}})[_0xa99e('0x23')](respondWithResult(_0x27624f,null))[_0xa99e('0x40')](handleError(_0x27624f,null));};exports[_0xa99e('0x4e')]=function(_0x3c1140,_0x3c65b3,_0x2c209d){return db['Action']['find']({'where':{'id':_0x3c1140['params']['id']}})[_0xa99e('0x23')](handleEntityNotFound(_0x3c65b3,null))['then'](function(_0x487dd3){if(_0x487dd3){return _0x487dd3[_0xa99e('0x4e')](_0x3c1140[_0xa99e('0x45')]['ids'],_[_0xa99e('0x49')](_0x3c1140[_0xa99e('0x45')],[_0xa99e('0x4f'),'id'])||{});}})[_0xa99e('0x23')](respondWithResult(_0x3c65b3,null))[_0xa99e('0x40')](handleError(_0x3c65b3,null));};exports[_0xa99e('0x50')]=function(_0x4b44cd,_0x1d4218,_0x57056f){var _0x56cd0d={};var _0x10525f={};var _0x3aef37;var _0x37a334;return db[_0xa99e('0x2a')][_0xa99e('0x4b')]({'where':{'id':_0x4b44cd['params']['id']}})['then'](handleEntityNotFound(_0x1d4218,null))[_0xa99e('0x23')](function(_0x2f5cad){if(_0x2f5cad){_0x3aef37=_0x2f5cad;_0x10525f[_0xa99e('0x33')]=_[_0xa99e('0x2f')](db[_0xa99e('0x51')]['rawAttributes']);_0x10525f[_0xa99e('0x30')]=_[_0xa99e('0x2f')](_0x4b44cd[_0xa99e('0x30')]);_0x10525f[_0xa99e('0x31')]=_[_0xa99e('0x32')](_0x10525f[_0xa99e('0x33')],_0x10525f[_0xa99e('0x30')]);_0x56cd0d[_0xa99e('0x34')]=_[_0xa99e('0x32')](_0x10525f['model'],qs[_0xa99e('0x35')](_0x4b44cd[_0xa99e('0x30')][_0xa99e('0x35')]));_0x56cd0d[_0xa99e('0x34')]=_0x56cd0d[_0xa99e('0x34')]['length']?_0x56cd0d[_0xa99e('0x34')]:_0x10525f[_0xa99e('0x33')];_0x56cd0d[_0xa99e('0x4c')]=qs[_0xa99e('0x38')](_0x4b44cd[_0xa99e('0x30')][_0xa99e('0x38')]);_0x56cd0d[_0xa99e('0x39')]=qs[_0xa99e('0x31')](_[_0xa99e('0x3a')](_0x4b44cd[_0xa99e('0x30')],_0x10525f[_0xa99e('0x31')]));if(_0x4b44cd['query'][_0xa99e('0x3b')]){_0x56cd0d[_0xa99e('0x39')]=_['merge'](_0x56cd0d[_0xa99e('0x39')],{'$or':_[_0xa99e('0x29')](_0x56cd0d[_0xa99e('0x34')],function(_0x42989e){var _0x3645fc={};_0x3645fc[_0x42989e]={'$like':'%'+_0x4b44cd[_0xa99e('0x30')][_0xa99e('0x3b')]+'%'};return _0x3645fc;})});}_0x56cd0d=_[_0xa99e('0x3c')]({},_0x56cd0d,_0x4b44cd[_0xa99e('0x42')]);return _0x3aef37['getActions'](_0x56cd0d);}})['then'](function(_0x16aa40){if(_0x16aa40){_0x37a334=_0x16aa40[_0xa99e('0x36')];if(!_0x4b44cd[_0xa99e('0x30')][_0xa99e('0x37')](_0xa99e('0x4d'))){_0x56cd0d[_0xa99e('0x1a')]=qs[_0xa99e('0x1a')](_0x4b44cd[_0xa99e('0x30')]['limit']);_0x56cd0d[_0xa99e('0x1d')]=qs[_0xa99e('0x1d')](_0x4b44cd[_0xa99e('0x30')][_0xa99e('0x1d')]);}return _0x3aef37[_0xa99e('0x50')](_0x56cd0d);}})['then'](function(_0x2c60ec){if(_0x2c60ec){return _0x2c60ec?{'count':_0x37a334,'rows':_0x2c60ec}:null;}})[_0xa99e('0x23')](respondWithResult(_0x1d4218,null))[_0xa99e('0x40')](handleError(_0x1d4218,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 4a00df1..9dc985f 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 _0xbfae=['path','rimraf','./automation.attributes','exports','define','Automation','tools_automations','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x1073ad,_0x44bf0b){var _0x528474=function(_0x3450f7){while(--_0x3450f7){_0x1073ad['push'](_0x1073ad['shift']());}};_0x528474(++_0x44bf0b);}(_0xbfae,0x1b4));var _0xebfa=function(_0xdf4182,_0xd869ff){_0xdf4182=_0xdf4182-0x0;var _0x1d10c7=_0xbfae[_0xdf4182];return _0x1d10c7;};'use strict';var _=require(_0xebfa('0x0'));var util=require(_0xebfa('0x1'));var logger=require(_0xebfa('0x2'))(_0xebfa('0x3'));var moment=require(_0xebfa('0x4'));var BPromise=require('bluebird');var rp=require(_0xebfa('0x5'));var fs=require('fs');var path=require(_0xebfa('0x6'));var rimraf=require(_0xebfa('0x7'));var config=require('../../config/environment');var attributes=require(_0xebfa('0x8'));module[_0xebfa('0x9')]=function(_0x5f15c0,_0x2577d4){return _0x5f15c0[_0xebfa('0xa')](_0xebfa('0xb'),attributes,{'tableName':_0xebfa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb5d5=['rimraf','./automation.attributes','exports','define','tools_automations','util','api','moment','bluebird','request-promise','path'];(function(_0xdd0303,_0x2ea293){var _0x3fe337=function(_0x20e271){while(--_0x20e271){_0xdd0303['push'](_0xdd0303['shift']());}};_0x3fe337(++_0x2ea293);}(_0xb5d5,0x12e));var _0x5b5d=function(_0x1844c8,_0x2078b8){_0x1844c8=_0x1844c8-0x0;var _0x3628bd=_0xb5d5[_0x1844c8];return _0x3628bd;};'use strict';var _=require('lodash');var util=require(_0x5b5d('0x0'));var logger=require('../../config/logger')(_0x5b5d('0x1'));var moment=require(_0x5b5d('0x2'));var BPromise=require(_0x5b5d('0x3'));var rp=require(_0x5b5d('0x4'));var fs=require('fs');var path=require(_0x5b5d('0x5'));var rimraf=require(_0x5b5d('0x6'));var config=require('../../config/environment');var attributes=require(_0x5b5d('0x7'));module[_0x5b5d('0x8')]=function(_0x4119fb,_0x299802){return _0x4119fb[_0x5b5d('0x9')]('Automation',attributes,{'tableName':_0x5b5d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 9f9d123..fcb0e6a 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 _0xb2af=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xb2af,0xd2));var _0xfb2a=function(_0x26b69c,_0x94157c){_0x26b69c=_0x26b69c-0x0;var _0x27bbda=_0xb2af[_0x26b69c];return _0x27bbda;};'use strict';var _=require(_0xfb2a('0x0'));var util=require(_0xfb2a('0x1'));var moment=require(_0xfb2a('0x2'));var BPromise=require(_0xfb2a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfb2a('0x4'));var db=require(_0xfb2a('0x5'))['db'];var utils=require(_0xfb2a('0x6'));var logger=require(_0xfb2a('0x7'))(_0xfb2a('0x8'));var config=require('../../config/environment');var jayson=require(_0xfb2a('0x9'));var client=jayson[_0xfb2a('0xa')][_0xfb2a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x55cf25,_0x715404,_0x3e20de){return new BPromise(function(_0x1f3315,_0x55bb4e){return client[_0xfb2a('0xc')](_0x55cf25,_0x3e20de)[_0xfb2a('0xd')](function(_0x3d3333){logger[_0xfb2a('0xe')](_0xfb2a('0xf'),_0x715404,_0xfb2a('0x10'));logger[_0xfb2a('0x11')](_0xfb2a('0x12'),_0x715404,_0xfb2a('0x10'),JSON[_0xfb2a('0x13')](_0x3d3333));if(_0x3d3333[_0xfb2a('0x14')]){if(_0x3d3333[_0xfb2a('0x14')]['code']===0x1f4){logger['error']('Automation,\x20%s,\x20%s',_0x715404,_0x3d3333[_0xfb2a('0x14')][_0xfb2a('0x15')]);return _0x55bb4e(_0x3d3333[_0xfb2a('0x14')][_0xfb2a('0x15')]);}logger['error'](_0xfb2a('0xf'),_0x715404,_0x3d3333['error']['message']);return _0x1f3315(_0x3d3333[_0xfb2a('0x14')]['message']);}else{logger['info'](_0xfb2a('0xf'),_0x715404,_0xfb2a('0x10'));_0x1f3315(_0x3d3333[_0xfb2a('0x16')][_0xfb2a('0x15')]);}})[_0xfb2a('0x17')](function(_0xc85abf){logger[_0xfb2a('0x14')](_0xfb2a('0xf'),_0x715404,_0xc85abf);_0x55bb4e(_0xc85abf);});});} \ No newline at end of file +var _0x594d=['Automation,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','Automation,\x20%s,\x20%s','debug'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x594d,0x92));var _0xd594=function(_0x277757,_0x7a3eb6){_0x277757=_0x277757-0x0;var _0x4cdeac=_0x594d[_0x277757];return _0x4cdeac;};'use strict';var _=require(_0xd594('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd594('0x1'));var rs=require(_0xd594('0x2'));var fs=require('fs');var Redis=require(_0xd594('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd594('0x4'));var logger=require(_0xd594('0x5'))(_0xd594('0x6'));var config=require(_0xd594('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd594('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b1c64,_0x446711,_0xeedad0){return new BPromise(function(_0x20325a,_0x20718a){return client[_0xd594('0x9')](_0x3b1c64,_0xeedad0)[_0xd594('0xa')](function(_0xf3043e){logger[_0xd594('0xb')](_0xd594('0xc'),_0x446711,'request\x20sent');logger[_0xd594('0xd')](_0xd594('0xe'),_0x446711,_0xd594('0xf'),JSON['stringify'](_0xf3043e));if(_0xf3043e[_0xd594('0x10')]){if(_0xf3043e[_0xd594('0x10')][_0xd594('0x11')]===0x1f4){logger[_0xd594('0x10')](_0xd594('0xc'),_0x446711,_0xf3043e[_0xd594('0x10')][_0xd594('0x12')]);return _0x20718a(_0xf3043e['error']['message']);}logger[_0xd594('0x10')](_0xd594('0xc'),_0x446711,_0xf3043e['error'][_0xd594('0x12')]);return _0x20325a(_0xf3043e['error'][_0xd594('0x12')]);}else{logger[_0xd594('0xb')](_0xd594('0xc'),_0x446711,'request\x20sent');_0x20325a(_0xf3043e[_0xd594('0x13')]['message']);}})['catch'](function(_0x2a5f17){logger[_0xd594('0x10')]('Automation,\x20%s,\x20%s',_0x446711,_0x2a5f17);_0x20718a(_0x2a5f17);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 946713f..c13e797 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 _0x9860=['show','/:id/conditions','getConditions','getActions','post','create','/:id/actions','addActions','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x579c34,_0x743122){var _0x28a925=function(_0x537efe){while(--_0x537efe){_0x579c34['push'](_0x579c34['shift']());}};_0x28a925(++_0x743122);}(_0x9860,0x15f));var _0x0986=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9860[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x0986('0x0'));var path=require(_0x0986('0x1'));var timeout=require(_0x0986('0x2'));var express=require(_0x0986('0x3'));var router=express[_0x0986('0x4')]();var fs_extra=require(_0x0986('0x5'));var auth=require(_0x0986('0x6'));var interaction=require(_0x0986('0x7'));var config=require(_0x0986('0x8'));var controller=require('./automation.controller');router[_0x0986('0x9')]('/',auth[_0x0986('0xa')](),controller[_0x0986('0xb')]);router['get'](_0x0986('0xc'),auth[_0x0986('0xa')](),controller[_0x0986('0xd')]);router[_0x0986('0x9')](_0x0986('0xe'),auth['isAuthenticated'](),controller[_0x0986('0xf')]);router[_0x0986('0x9')]('/:id/actions',auth[_0x0986('0xa')](),controller[_0x0986('0x10')]);router[_0x0986('0x11')]('/',auth[_0x0986('0xa')](),controller[_0x0986('0x12')]);router['post'](_0x0986('0xe'),auth[_0x0986('0xa')](),controller['addConditions']);router['post'](_0x0986('0x13'),auth[_0x0986('0xa')](),controller[_0x0986('0x14')]);router[_0x0986('0x15')](_0x0986('0xc'),auth['isAuthenticated'](),controller[_0x0986('0x16')]);router[_0x0986('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x0986('0x18')]);module[_0x0986('0x19')]=router; \ No newline at end of file +var _0x567c=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions','post','addConditions','addActions','put','update','delete','destroy'];(function(_0x1ee3d1,_0x417375){var _0xef85fb=function(_0x3d8e65){while(--_0x3d8e65){_0x1ee3d1['push'](_0x1ee3d1['shift']());}};_0xef85fb(++_0x417375);}(_0x567c,0x8d));var _0xc567=function(_0x497c50,_0x46afa1){_0x497c50=_0x497c50-0x0;var _0x302a37=_0x567c[_0x497c50];return _0x302a37;};'use strict';var multer=require(_0xc567('0x0'));var util=require(_0xc567('0x1'));var path=require(_0xc567('0x2'));var timeout=require(_0xc567('0x3'));var express=require(_0xc567('0x4'));var router=express[_0xc567('0x5')]();var fs_extra=require(_0xc567('0x6'));var auth=require(_0xc567('0x7'));var interaction=require(_0xc567('0x8'));var config=require(_0xc567('0x9'));var controller=require(_0xc567('0xa'));router[_0xc567('0xb')]('/',auth[_0xc567('0xc')](),controller[_0xc567('0xd')]);router[_0xc567('0xb')](_0xc567('0xe'),auth[_0xc567('0xc')](),controller[_0xc567('0xf')]);router[_0xc567('0xb')](_0xc567('0x10'),auth[_0xc567('0xc')](),controller[_0xc567('0x11')]);router['get'](_0xc567('0x12'),auth['isAuthenticated'](),controller[_0xc567('0x13')]);router[_0xc567('0x14')]('/',auth[_0xc567('0xc')](),controller['create']);router[_0xc567('0x14')]('/:id/conditions',auth[_0xc567('0xc')](),controller[_0xc567('0x15')]);router[_0xc567('0x14')](_0xc567('0x12'),auth['isAuthenticated'](),controller[_0xc567('0x16')]);router[_0xc567('0x17')](_0xc567('0xe'),auth['isAuthenticated'](),controller[_0xc567('0x18')]);router[_0xc567('0x19')](_0xc567('0xe'),auth['isAuthenticated'](),controller[_0xc567('0x1a')]);module[_0xc567('0x1b')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index a388e33..485aeff 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 _0x1ecf=['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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','STRING','name','ivr','BOOLEAN','UNSIGNED','Max\x20200\x20calls.','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','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,*,*,*','ENUM','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'];(function(_0x2d03d0,_0x529ee7){var _0x43b480=function(_0x10a2bc){while(--_0x10a2bc){_0x2d03d0['push'](_0x2d03d0['shift']());}};_0x43b480(++_0x529ee7);}(_0x1ecf,0x15d));var _0xf1ec=function(_0x118139,_0x7ce965){_0x118139=_0x118139-0x0;var _0x2fece9=_0x1ecf[_0x118139];return _0x2fece9;};'use strict';var Sequelize=require('sequelize');module[_0xf1ec('0x0')]={'name':{'type':Sequelize[_0xf1ec('0x1')],'unique':_0xf1ec('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xf1ec('0x3')),'allowNull':![],'defaultValue':_0xf1ec('0x3')},'description':{'type':Sequelize[_0xf1ec('0x1')]},'active':{'type':Sequelize[_0xf1ec('0x4')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0xf1ec('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xf1ec('0x6')},'dialOriginateCallerIdName':{'type':Sequelize[_0xf1ec('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xf1ec('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0xf1ec('0x7')](0x3)[_0xf1ec('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf1ec('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0xf1ec('0x7')](0x3)[_0xf1ec('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf1ec('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xf1ec('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf1ec('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0xf1ec('0x7')](0x3)[_0xf1ec('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf1ec('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0xf1ec('0x7')](0x5)[_0xf1ec('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf1ec('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xf1ec('0x7')](0x3)[_0xf1ec('0x5')],'defaultValue':0x3,'comment':_0xf1ec('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xf1ec('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf1ec('0xe')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xf1ec('0x5')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xf1ec('0xf')},'dialTimezone':{'type':Sequelize[_0xf1ec('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xf1ec('0x1')],'defaultValue':_0xf1ec('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0xf1ec('0x11')](_0xf1ec('0x12'),'never',_0xf1ec('0x13')),'defaultValue':_0xf1ec('0x12')},'dialAMDActive':{'type':Sequelize[_0xf1ec('0x4')],'defaultValue':0x0,'comment':_0xf1ec('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0xf1ec('0x7')](0x9)[_0xf1ec('0x5')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xf1ec('0x5')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xf1ec('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xf1ec('0x7')](0x9)[_0xf1ec('0x5')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xf1ec('0x7')](0x9)[_0xf1ec('0x5')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xf1ec('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0xf1ec('0x7')](0x9)[_0xf1ec('0x5')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xf1ec('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xf1ec('0x5')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xf1ec('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xf1ec('0x7')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xf1ec('0x7')](0x5)[_0xf1ec('0x5')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xf1ec('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xf1ec('0x7')](0x9)[_0xf1ec('0x5')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xf1ec('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0xf1ec('0x11')](_0xf1ec('0x1b'),'ASC'),'defaultValue':_0xf1ec('0x1b')},'dialPrefix':{'type':Sequelize[_0xf1ec('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xf1ec('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xf1ec('0x1c')},'dialCutDigit':{'type':Sequelize[_0xf1ec('0x7')](0x3)[_0xf1ec('0x5')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xf1ec('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf1ec('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xf1ec('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf1ec('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0xf1ec('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf1ec('0x20')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xf1ec('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xf1ec('0x7')](0x3)[_0xf1ec('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf1ec('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xf1ec('0x7')](0x5)[_0xf1ec('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf1ec('0x22')},'dialMachineMaxRetry':{'type':Sequelize[_0xf1ec('0x7')](0x3)[_0xf1ec('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xf1ec('0x7')](0x5)[_0xf1ec('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf1ec('0x23')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xf1ec('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf1ec('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xf1ec('0x7')](0x5)[_0xf1ec('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf1ec('0x25')}}; \ No newline at end of file +var _0x712f=['ENUM','ivr','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name'];(function(_0x3ac95e,_0x43eefa){var _0x11c624=function(_0x302809){while(--_0x302809){_0x3ac95e['push'](_0x3ac95e['shift']());}};_0x11c624(++_0x43eefa);}(_0x712f,0x71));var _0xf712=function(_0x3f17cc,_0x1d8133){_0x3f17cc=_0x3f17cc-0x0;var _0x5085d3=_0x712f[_0x3f17cc];return _0x5085d3;};'use strict';var Sequelize=require(_0xf712('0x0'));module[_0xf712('0x1')]={'name':{'type':Sequelize[_0xf712('0x2')],'unique':_0xf712('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xf712('0x4')](_0xf712('0x5')),'allowNull':![],'defaultValue':_0xf712('0x5')},'description':{'type':Sequelize[_0xf712('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xf712('0x6')},'limitCalls':{'type':Sequelize[_0xf712('0x7')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xf712('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0xf712('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xf712('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xf712('0x7')](0x3)[_0xf712('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf712('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0xf712('0x7')](0x3)[_0xf712('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf712('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xf712('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xf712('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf712('0xc')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xf712('0x7')](0x3)[_0xf712('0x9')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xf712('0x7')](0x5)[_0xf712('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf712('0xd')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xf712('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xf712('0xe')},'dialTimezone':{'type':Sequelize[_0xf712('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xf712('0x2')],'defaultValue':_0xf712('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0xf712('0x4')](_0xf712('0x10'),'never',_0xf712('0x11')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xf712('0x12')],'defaultValue':0x0,'comment':_0xf712('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0xf712('0x7')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xf712('0x14')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xf712('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xf712('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xf712('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xf712('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xf712('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0xf712('0x7')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xf712('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xf712('0x7')](0x9)[_0xf712('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xf712('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xf712('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xf712('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xf712('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xf712('0x7')](0x9)[_0xf712('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xf712('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize[_0xf712('0x4')](_0xf712('0x1c'),_0xf712('0x1d')),'defaultValue':_0xf712('0x1c')},'dialPrefix':{'type':Sequelize[_0xf712('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xf712('0x7')](0x3)[_0xf712('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xf712('0x1e')},'dialCutDigit':{'type':Sequelize[_0xf712('0x7')](0x3)[_0xf712('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xf712('0x1f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xf712('0x7')](0x3)[_0xf712('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf712('0x20')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xf712('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf712('0x21')},'dialDropMaxRetry':{'type':Sequelize[_0xf712('0x7')](0x3)[_0xf712('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf712('0x22')},'dialDropRetryFrequency':{'type':Sequelize[_0xf712('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xf712('0x7')](0x3)[_0xf712('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf712('0x23')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xf712('0x7')](0x5)[_0xf712('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xf712('0x7')](0x3)[_0xf712('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf712('0x24')},'dialMachineRetryFrequency':{'type':Sequelize[_0xf712('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf712('0x25')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xf712('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xf712('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf712('0x26')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 1dd2d7d..9a99a6b 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 _0xe5b5=['apply','reject','then','error','name','send','index','map','Campaign','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','order','sort','filters','filter','merge','VIRTUAL','options','where','includeAll','include','findAll','rows','catch','params','find','create','body','user','IvrCampaigns','UserProfileSection','userProfileId','autoAssociation','clone','get','omit','updatedAt','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileResource','update','destroy','getHoppers','CmHopper','nolimit','pick','CampaignId','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','hasOwnProperty','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','into','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_hopper','insert','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range'];(function(_0x1a9bce,_0x4d25b2){var _0x23724d=function(_0x2502d6){while(--_0x2502d6){_0x1a9bce['push'](_0x1a9bce['shift']());}};_0x23724d(++_0x4d25b2);}(_0xe5b5,0x73));var _0x5e5b=function(_0x4b4b0e,_0x6c674){_0x4b4b0e=_0x4b4b0e-0x0;var _0x4c2d91=_0xe5b5[_0x4b4b0e];return _0x4c2d91;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5e5b('0x0'));var zipdir=require(_0x5e5b('0x1'));var jsonpatch=require(_0x5e5b('0x2'));var rp=require(_0x5e5b('0x3'));var moment=require(_0x5e5b('0x4'));var BPromise=require(_0x5e5b('0x5'));var Mustache=require(_0x5e5b('0x6'));var util=require(_0x5e5b('0x7'));var path=require(_0x5e5b('0x8'));var sox=require(_0x5e5b('0x9'));var csv=require(_0x5e5b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5e5b('0xb'));var _=require(_0x5e5b('0xc'));var squel=require(_0x5e5b('0xd'));var crypto=require(_0x5e5b('0xe'));var jsforce=require(_0x5e5b('0xf'));var deskjs=require(_0x5e5b('0x10'));var toCsv=require(_0x5e5b('0xa'));var querystring=require(_0x5e5b('0x11'));var Papa=require('papaparse');var Redis=require(_0x5e5b('0x12'));var authService=require(_0x5e5b('0x13'));var qs=require(_0x5e5b('0x14'));var as=require(_0x5e5b('0x15'));var hardwareService=require(_0x5e5b('0x16'));var logger=require(_0x5e5b('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x5e5b('0x18'));var licenseUtil=require(_0x5e5b('0x19'));var db=require(_0x5e5b('0x1a'))['db'];function respondWithStatusCode(_0x28668a,_0x42e548){_0x42e548=_0x42e548||0xcc;return function(_0x3e0cbe){if(_0x3e0cbe){return _0x28668a['sendStatus'](_0x42e548);}return _0x28668a[_0x5e5b('0x1b')](_0x42e548)[_0x5e5b('0x1c')]();};}function respondWithResult(_0x38dabd,_0x492ef7){_0x492ef7=_0x492ef7||0xc8;return function(_0x18bd59){if(_0x18bd59){return _0x38dabd[_0x5e5b('0x1b')](_0x492ef7)[_0x5e5b('0x1d')](_0x18bd59);}};}function respondWithFilteredResult(_0x4512c4,_0x2639d6){return function(_0x3d8b7f){if(_0x3d8b7f){var _0xa17e55=typeof _0x2639d6[_0x5e5b('0x1e')]==='undefined'&&typeof _0x2639d6[_0x5e5b('0x1f')]===_0x5e5b('0x20');var _0x3ed951=_0x3d8b7f[_0x5e5b('0x21')];var _0x498d68=_0xa17e55?0x0:_0x2639d6[_0x5e5b('0x1e')];var _0xe24365=_0xa17e55?_0x3d8b7f[_0x5e5b('0x21')]:_0x2639d6[_0x5e5b('0x1e')]+_0x2639d6['limit'];var _0x55ffae;if(_0xe24365>=_0x3ed951){_0xe24365=_0x3ed951;_0x55ffae=0xc8;}else{_0x55ffae=0xce;}_0x4512c4[_0x5e5b('0x1b')](_0x55ffae);return _0x4512c4[_0x5e5b('0x22')](_0x5e5b('0x23'),_0x498d68+'-'+_0xe24365+'/'+_0x3ed951)[_0x5e5b('0x1d')](_0x3d8b7f);}return null;};}function patchUpdates(_0x479ae5){return function(_0x2f85e5){try{jsonpatch[_0x5e5b('0x24')](_0x2f85e5,_0x479ae5,!![]);}catch(_0x4f1524){return BPromise[_0x5e5b('0x25')](_0x4f1524);}return _0x2f85e5['save']();};}function saveUpdates(_0x216e80,_0x36cce7){return function(_0x3680a3){if(_0x3680a3){return _0x3680a3['update'](_0x216e80)[_0x5e5b('0x26')](function(_0x53b56b){return _0x53b56b;});}return null;};}function removeEntity(_0x1a06e1,_0x18deec){return function(_0x49b15b){if(_0x49b15b){return _0x49b15b['destroy']()['then'](function(){var _0x5558b3=_0x49b15b['get']({'plain':!![]});var _0x32d94c='IvrCampaigns';return db['UserProfileResource']['destroy']({'where':{'type':_0x32d94c,'resourceId':_0x5558b3['id']}})['then'](function(){return _0x49b15b;});})[_0x5e5b('0x26')](function(){_0x1a06e1[_0x5e5b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x308009,_0x1f76db){return function(_0x5b8b6f){if(!_0x5b8b6f){_0x308009['sendStatus'](0x194);}return _0x5b8b6f;};}function handleError(_0x28290c,_0x2c5e1a){_0x2c5e1a=_0x2c5e1a||0x1f4;return function(_0x545062){logger[_0x5e5b('0x27')](_0x545062['stack']);if(_0x545062[_0x5e5b('0x28')]){delete _0x545062[_0x5e5b('0x28')];}_0x28290c[_0x5e5b('0x1b')](_0x2c5e1a)[_0x5e5b('0x29')](_0x545062);};}exports[_0x5e5b('0x2a')]=function(_0x7c84a4,_0x1a40ba){var _0x1b6cdf={},_0x38bc88={},_0x545a86={'count':0x0,'rows':[]};var _0x543622=_[_0x5e5b('0x2b')](db[_0x5e5b('0x2c')][_0x5e5b('0x2d')],function(_0xd5928){return{'name':_0xd5928['fieldName'],'type':_0xd5928[_0x5e5b('0x2e')]['key']};});_0x38bc88[_0x5e5b('0x2f')]=_[_0x5e5b('0x2b')](_0x543622,'name');_0x38bc88[_0x5e5b('0x30')]=_[_0x5e5b('0x31')](_0x7c84a4[_0x5e5b('0x30')]);_0x38bc88['filters']=_[_0x5e5b('0x32')](_0x38bc88['model'],_0x38bc88[_0x5e5b('0x30')]);_0x1b6cdf[_0x5e5b('0x33')]=_[_0x5e5b('0x32')](_0x38bc88[_0x5e5b('0x2f')],qs[_0x5e5b('0x34')](_0x7c84a4[_0x5e5b('0x30')][_0x5e5b('0x34')]));_0x1b6cdf[_0x5e5b('0x33')]=_0x1b6cdf[_0x5e5b('0x33')][_0x5e5b('0x35')]?_0x1b6cdf[_0x5e5b('0x33')]:_0x38bc88[_0x5e5b('0x2f')];if(!_0x7c84a4[_0x5e5b('0x30')]['hasOwnProperty']('nolimit')){_0x1b6cdf['limit']=qs[_0x5e5b('0x1f')](_0x7c84a4['query'][_0x5e5b('0x1f')]);_0x1b6cdf['offset']=qs[_0x5e5b('0x1e')](_0x7c84a4[_0x5e5b('0x30')][_0x5e5b('0x1e')]);}_0x1b6cdf[_0x5e5b('0x36')]=qs[_0x5e5b('0x37')](_0x7c84a4[_0x5e5b('0x30')][_0x5e5b('0x37')]);_0x1b6cdf['where']=qs[_0x5e5b('0x38')](_['pick'](_0x7c84a4[_0x5e5b('0x30')],_0x38bc88[_0x5e5b('0x38')]),_0x543622);if(_0x7c84a4[_0x5e5b('0x30')][_0x5e5b('0x39')]){_0x1b6cdf['where']=_[_0x5e5b('0x3a')](_0x1b6cdf['where'],{'$or':_[_0x5e5b('0x2b')](_0x543622,function(_0x28d50e){if(_0x28d50e[_0x5e5b('0x2e')]!==_0x5e5b('0x3b')){var _0x423fe6={};_0x423fe6[_0x28d50e['name']]={'$like':'%'+_0x7c84a4['query'][_0x5e5b('0x39')]+'%'};return _0x423fe6;}})});}_0x1b6cdf=_[_0x5e5b('0x3a')]({},_0x1b6cdf,_0x7c84a4[_0x5e5b('0x3c')]);var _0x410ca9={'where':_0x1b6cdf[_0x5e5b('0x3d')]};return db[_0x5e5b('0x2c')]['count'](_0x410ca9)[_0x5e5b('0x26')](function(_0x560a6e){_0x545a86[_0x5e5b('0x21')]=_0x560a6e;if(_0x7c84a4[_0x5e5b('0x30')][_0x5e5b('0x3e')]){_0x1b6cdf[_0x5e5b('0x3f')]=[{'all':!![]}];}return db[_0x5e5b('0x2c')][_0x5e5b('0x40')](_0x1b6cdf);})['then'](function(_0x7ebcbd){_0x545a86[_0x5e5b('0x41')]=_0x7ebcbd;return _0x545a86;})[_0x5e5b('0x26')](respondWithFilteredResult(_0x1a40ba,_0x1b6cdf))[_0x5e5b('0x42')](handleError(_0x1a40ba,null));};exports['show']=function(_0x11d0ce,_0x5eb00b){var _0x45612b={'raw':![],'where':{'id':_0x11d0ce[_0x5e5b('0x43')]['id']}},_0x4a1c79={};_0x4a1c79[_0x5e5b('0x2f')]=_[_0x5e5b('0x31')](db[_0x5e5b('0x2c')]['rawAttributes']);_0x4a1c79['query']=_['keys'](_0x11d0ce[_0x5e5b('0x30')]);_0x4a1c79['filters']=_[_0x5e5b('0x32')](_0x4a1c79[_0x5e5b('0x2f')],_0x4a1c79['query']);_0x45612b[_0x5e5b('0x33')]=_['intersection'](_0x4a1c79['model'],qs[_0x5e5b('0x34')](_0x11d0ce[_0x5e5b('0x30')]['fields']));_0x45612b['attributes']=_0x45612b[_0x5e5b('0x33')][_0x5e5b('0x35')]?_0x45612b['attributes']:_0x4a1c79[_0x5e5b('0x2f')];if(_0x11d0ce[_0x5e5b('0x30')][_0x5e5b('0x3e')]){_0x45612b[_0x5e5b('0x3f')]=[{'all':!![]}];}_0x45612b=_['merge']({},_0x45612b,_0x11d0ce['options']);return db[_0x5e5b('0x2c')][_0x5e5b('0x44')](_0x45612b)[_0x5e5b('0x26')](handleEntityNotFound(_0x5eb00b,null))[_0x5e5b('0x26')](respondWithResult(_0x5eb00b,null))[_0x5e5b('0x42')](handleError(_0x5eb00b,null));};exports[_0x5e5b('0x45')]=function(_0x560132,_0xbcdaad){return db[_0x5e5b('0x2c')][_0x5e5b('0x45')](_0x560132[_0x5e5b('0x46')],{})[_0x5e5b('0x26')](function(_0x3ed7ee){var _0x30fb7c=_0x560132[_0x5e5b('0x47')]['get']({'plain':!![]});if(!_0x30fb7c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x30fb7c['role']==='user'){var _0x22cc1f=_0x3ed7ee['get']({'plain':!![]});var _0x59c28b=_0x5e5b('0x48');return db[_0x5e5b('0x49')]['find']({'where':{'name':_0x59c28b,'userProfileId':_0x30fb7c[_0x5e5b('0x4a')]},'raw':!![]})[_0x5e5b('0x26')](function(_0x4060f6){if(_0x4060f6&&_0x4060f6[_0x5e5b('0x4b')]===0x0){return db['UserProfileResource']['create']({'name':_0x22cc1f[_0x5e5b('0x28')],'resourceId':_0x22cc1f['id'],'type':_0x4060f6[_0x5e5b('0x28')],'sectionId':_0x4060f6['id']},{})[_0x5e5b('0x26')](function(){return _0x3ed7ee;});}else{return _0x3ed7ee;}})[_0x5e5b('0x42')](function(_0x1281b2){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1281b2);throw _0x1281b2;});}return _0x3ed7ee;})['then'](respondWithResult(_0xbcdaad,0xc9))['catch'](handleError(_0xbcdaad,null));};exports[_0x5e5b('0x4c')]=function(_0x3c19a5,_0x5b3fe0){var _0x2b924d={'where':{'id':_0x3c19a5[_0x5e5b('0x43')]['id']}},_0x1ce1a6={};_0x1ce1a6[_0x5e5b('0x2f')]=_[_0x5e5b('0x31')](db['Campaign'][_0x5e5b('0x2d')]);_0x2b924d[_0x5e5b('0x33')]=_[_0x5e5b('0x32')](_0x1ce1a6[_0x5e5b('0x2f')],qs[_0x5e5b('0x34')](_0x3c19a5[_0x5e5b('0x30')]['fields']));_0x2b924d['attributes']=_0x2b924d[_0x5e5b('0x33')][_0x5e5b('0x35')]?_0x2b924d['attributes']:_0x1ce1a6[_0x5e5b('0x2f')];if(_0x3c19a5[_0x5e5b('0x30')][_0x5e5b('0x3e')]){_0x2b924d['include']=[{'all':!![]}];}_0x2b924d=_[_0x5e5b('0x3a')]({},_0x2b924d,_0x3c19a5[_0x5e5b('0x3c')]);return db['Campaign']['find'](_0x2b924d)[_0x5e5b('0x26')](handleEntityNotFound(_0x5b3fe0,null))['then'](function(_0x158082){if(_0x158082){var _0x5d6488=_0x158082[_0x5e5b('0x4d')]({'plain':!![]});_0x5d6488=qs[_0x5e5b('0x4e')](_0x5d6488,['id','createdAt',_0x5e5b('0x4f')]);_0x3c19a5[_0x5e5b('0x46')]=_['omit'](_0x3c19a5[_0x5e5b('0x46')],['id',_0x5e5b('0x50'),'updatedAt']);return db[_0x5e5b('0x2c')][_0x5e5b('0x45')](_[_0x5e5b('0x3a')](_0x5d6488,_0x3c19a5[_0x5e5b('0x46')]),{'include':_0x3c19a5['query'][_0x5e5b('0x3e')]?[{'all':!![]}]:undefined})[_0x5e5b('0x26')](function(_0x37495d){var _0x582fdc=_0x3c19a5[_0x5e5b('0x47')][_0x5e5b('0x4d')]({'plain':!![]});if(!_0x582fdc)throw new Error(_0x5e5b('0x51'));if(_0x582fdc[_0x5e5b('0x52')]===_0x5e5b('0x47')){var _0x28c8f1=_0x37495d[_0x5e5b('0x4d')]({'plain':!![]});var _0x458342=_0x5e5b('0x48');return db['UserProfileSection'][_0x5e5b('0x44')]({'where':{'name':_0x458342,'userProfileId':_0x582fdc[_0x5e5b('0x4a')]},'raw':!![]})[_0x5e5b('0x26')](function(_0x4e1744){if(_0x4e1744&&_0x4e1744['autoAssociation']===0x0){return db[_0x5e5b('0x53')][_0x5e5b('0x45')]({'name':_0x28c8f1[_0x5e5b('0x28')],'resourceId':_0x28c8f1['id'],'type':_0x4e1744['name'],'sectionId':_0x4e1744['id']},{})[_0x5e5b('0x26')](function(){return _0x37495d;});}else{return _0x37495d;}})[_0x5e5b('0x42')](function(_0x2ca87c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ca87c);throw _0x2ca87c;});}return _0x37495d;});}})[_0x5e5b('0x26')](respondWithResult(_0x5b3fe0,0xc9))[_0x5e5b('0x42')](handleError(_0x5b3fe0,null));};exports[_0x5e5b('0x54')]=function(_0x23257c,_0x1f9233){if(_0x23257c[_0x5e5b('0x46')]['id']){delete _0x23257c[_0x5e5b('0x46')]['id'];}return db[_0x5e5b('0x2c')][_0x5e5b('0x44')]({'where':{'id':_0x23257c[_0x5e5b('0x43')]['id']}})[_0x5e5b('0x26')](handleEntityNotFound(_0x1f9233,null))['then'](saveUpdates(_0x23257c[_0x5e5b('0x46')],null))[_0x5e5b('0x26')](respondWithResult(_0x1f9233,null))[_0x5e5b('0x42')](handleError(_0x1f9233,null));};exports[_0x5e5b('0x55')]=function(_0x129141,_0x3588cf){return db['Campaign']['find']({'where':{'id':_0x129141['params']['id']}})[_0x5e5b('0x26')](handleEntityNotFound(_0x3588cf,null))['then'](removeEntity(_0x3588cf,null))[_0x5e5b('0x42')](handleError(_0x3588cf,null));};exports[_0x5e5b('0x56')]=function(_0xcce46d,_0x543f38,_0xbceca6){var _0x53f1cc={'raw':!![],'where':{}};var _0x3a8923={};var _0x2ad7f8={'count':0x0,'rows':[]};return db[_0x5e5b('0x2c')]['findOne']({'where':{'id':_0xcce46d[_0x5e5b('0x43')]['id']}})['then'](handleEntityNotFound(_0x543f38,null))['then'](function(_0x430c1a){if(_0x430c1a){_0x3a8923[_0x5e5b('0x2f')]=_[_0x5e5b('0x31')](db[_0x5e5b('0x57')][_0x5e5b('0x2d')]);_0x3a8923[_0x5e5b('0x30')]=_['keys'](_0xcce46d[_0x5e5b('0x30')]);_0x3a8923['filters']=_[_0x5e5b('0x32')](_0x3a8923['model'],_0x3a8923['query']);_0x53f1cc[_0x5e5b('0x33')]=_[_0x5e5b('0x32')](_0x3a8923[_0x5e5b('0x2f')],qs[_0x5e5b('0x34')](_0xcce46d[_0x5e5b('0x30')][_0x5e5b('0x34')]));_0x53f1cc[_0x5e5b('0x33')]=_0x53f1cc['attributes'][_0x5e5b('0x35')]?_0x53f1cc[_0x5e5b('0x33')]:_0x3a8923[_0x5e5b('0x2f')];if(!_0xcce46d[_0x5e5b('0x30')]['hasOwnProperty'](_0x5e5b('0x58'))){_0x53f1cc['limit']=qs[_0x5e5b('0x1f')](_0xcce46d[_0x5e5b('0x30')][_0x5e5b('0x1f')]);_0x53f1cc[_0x5e5b('0x1e')]=qs[_0x5e5b('0x1e')](_0xcce46d[_0x5e5b('0x30')][_0x5e5b('0x1e')]);}_0x53f1cc[_0x5e5b('0x36')]=qs[_0x5e5b('0x37')](_0xcce46d['query'][_0x5e5b('0x37')]);_0x53f1cc[_0x5e5b('0x3d')]=qs[_0x5e5b('0x38')](_[_0x5e5b('0x59')](_0xcce46d[_0x5e5b('0x30')],_0x3a8923[_0x5e5b('0x38')]));_0x53f1cc['where'][_0x5e5b('0x5a')]=_0x430c1a['id'];if(_0xcce46d[_0x5e5b('0x30')][_0x5e5b('0x39')]){_0x53f1cc[_0x5e5b('0x3d')]=_[_0x5e5b('0x3a')](_0x53f1cc[_0x5e5b('0x3d')],{'$or':_[_0x5e5b('0x2b')](_0x53f1cc['attributes'],function(_0x1cab47){var _0x4f69ff={};_0x4f69ff[_0x1cab47]={'$like':'%'+_0xcce46d[_0x5e5b('0x30')][_0x5e5b('0x39')]+'%'};return _0x4f69ff;})});}_0x53f1cc=_[_0x5e5b('0x3a')]({},_0x53f1cc,_0xcce46d[_0x5e5b('0x3c')]);return db[_0x5e5b('0x57')][_0x5e5b('0x21')]({'where':_0x53f1cc[_0x5e5b('0x3d')]})['then'](function(_0x15214c){_0x2ad7f8[_0x5e5b('0x21')]=_0x15214c;if(_0xcce46d[_0x5e5b('0x30')][_0x5e5b('0x3e')]){_0x53f1cc[_0x5e5b('0x3f')]=[{'all':!![]}];}return db[_0x5e5b('0x57')][_0x5e5b('0x40')](_0x53f1cc);})[_0x5e5b('0x26')](function(_0x1d1367){_0x2ad7f8[_0x5e5b('0x41')]=_0x1d1367;return _0x2ad7f8;});}})[_0x5e5b('0x26')](respondWithFilteredResult(_0x543f38,_0x53f1cc))[_0x5e5b('0x42')](handleError(_0x543f38,null));};exports[_0x5e5b('0x5b')]=function(_0x4c1068,_0x127872,_0x218935){var _0x3d8c79={'raw':!![],'where':{}};var _0x386a9f={};var _0x565477={'count':0x0,'rows':[]};return db[_0x5e5b('0x2c')][_0x5e5b('0x5c')]({'where':{'id':_0x4c1068[_0x5e5b('0x43')]['id']}})[_0x5e5b('0x26')](handleEntityNotFound(_0x127872,null))[_0x5e5b('0x26')](function(_0x220103){if(_0x220103){_0x386a9f[_0x5e5b('0x2f')]=_[_0x5e5b('0x31')](db[_0x5e5b('0x5d')]['rawAttributes']);_0x386a9f[_0x5e5b('0x30')]=_[_0x5e5b('0x31')](_0x4c1068[_0x5e5b('0x30')]);_0x386a9f[_0x5e5b('0x38')]=_['intersection'](_0x386a9f[_0x5e5b('0x2f')],_0x386a9f['query']);_0x3d8c79[_0x5e5b('0x33')]=_[_0x5e5b('0x32')](_0x386a9f[_0x5e5b('0x2f')],qs[_0x5e5b('0x34')](_0x4c1068[_0x5e5b('0x30')]['fields']));_0x3d8c79[_0x5e5b('0x33')]=_0x3d8c79[_0x5e5b('0x33')]['length']?_0x3d8c79[_0x5e5b('0x33')]:_0x386a9f[_0x5e5b('0x2f')];if(!_0x4c1068['query']['hasOwnProperty'](_0x5e5b('0x58'))){_0x3d8c79[_0x5e5b('0x1f')]=qs[_0x5e5b('0x1f')](_0x4c1068[_0x5e5b('0x30')][_0x5e5b('0x1f')]);_0x3d8c79[_0x5e5b('0x1e')]=qs[_0x5e5b('0x1e')](_0x4c1068[_0x5e5b('0x30')][_0x5e5b('0x1e')]);}_0x3d8c79[_0x5e5b('0x36')]=qs[_0x5e5b('0x37')](_0x4c1068[_0x5e5b('0x30')][_0x5e5b('0x37')]);_0x3d8c79[_0x5e5b('0x3d')]=qs[_0x5e5b('0x38')](_[_0x5e5b('0x59')](_0x4c1068[_0x5e5b('0x30')],_0x386a9f[_0x5e5b('0x38')]));_0x3d8c79['where']['CampaignId']=_0x220103['id'];if(_0x4c1068[_0x5e5b('0x30')][_0x5e5b('0x39')]){_0x3d8c79[_0x5e5b('0x3d')]=_['merge'](_0x3d8c79['where'],{'$or':_[_0x5e5b('0x2b')](_0x3d8c79[_0x5e5b('0x33')],function(_0x35cbc4){var _0x34e34a={};_0x34e34a[_0x35cbc4]={'$like':'%'+_0x4c1068[_0x5e5b('0x30')][_0x5e5b('0x39')]+'%'};return _0x34e34a;})});}_0x3d8c79=_['merge']({},_0x3d8c79,_0x4c1068[_0x5e5b('0x3c')]);return db[_0x5e5b('0x5d')][_0x5e5b('0x21')]({'where':_0x3d8c79[_0x5e5b('0x3d')]})[_0x5e5b('0x26')](function(_0x384e0c){_0x565477[_0x5e5b('0x21')]=_0x384e0c;if(_0x4c1068[_0x5e5b('0x30')]['includeAll']){_0x3d8c79[_0x5e5b('0x3f')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x5e5b('0x40')](_0x3d8c79);})[_0x5e5b('0x26')](function(_0x12ecfe){_0x565477[_0x5e5b('0x41')]=_0x12ecfe;return _0x565477;});}})['then'](respondWithFilteredResult(_0x127872,_0x3d8c79))[_0x5e5b('0x42')](handleError(_0x127872,null));};exports[_0x5e5b('0x5e')]=function(_0x91b57e,_0x556a4b,_0x2590d1){var _0x59e36e={'raw':!![],'where':{}};var _0x308c1b={};var _0x4298e5={'count':0x0,'rows':[]};return db[_0x5e5b('0x2c')][_0x5e5b('0x5c')]({'where':{'id':_0x91b57e[_0x5e5b('0x43')]['id']}})[_0x5e5b('0x26')](handleEntityNotFound(_0x556a4b,null))[_0x5e5b('0x26')](function(_0x43dd42){if(_0x43dd42){_0x308c1b[_0x5e5b('0x2f')]=_[_0x5e5b('0x31')](db[_0x5e5b('0x5f')]['rawAttributes']);_0x308c1b[_0x5e5b('0x30')]=_[_0x5e5b('0x31')](_0x91b57e[_0x5e5b('0x30')]);_0x308c1b[_0x5e5b('0x38')]=_[_0x5e5b('0x32')](_0x308c1b[_0x5e5b('0x2f')],_0x308c1b[_0x5e5b('0x30')]);_0x59e36e[_0x5e5b('0x33')]=_[_0x5e5b('0x32')](_0x308c1b[_0x5e5b('0x2f')],qs[_0x5e5b('0x34')](_0x91b57e['query'][_0x5e5b('0x34')]));_0x59e36e['attributes']=_0x59e36e[_0x5e5b('0x33')][_0x5e5b('0x35')]?_0x59e36e['attributes']:_0x308c1b[_0x5e5b('0x2f')];if(!_0x91b57e[_0x5e5b('0x30')]['hasOwnProperty']('nolimit')){_0x59e36e['limit']=qs[_0x5e5b('0x1f')](_0x91b57e[_0x5e5b('0x30')][_0x5e5b('0x1f')]);_0x59e36e[_0x5e5b('0x1e')]=qs[_0x5e5b('0x1e')](_0x91b57e[_0x5e5b('0x30')]['offset']);}_0x59e36e[_0x5e5b('0x36')]=qs[_0x5e5b('0x37')](_0x91b57e[_0x5e5b('0x30')][_0x5e5b('0x37')]);_0x59e36e[_0x5e5b('0x3d')]=qs[_0x5e5b('0x38')](_['pick'](_0x91b57e[_0x5e5b('0x30')],_0x308c1b[_0x5e5b('0x38')]));_0x59e36e[_0x5e5b('0x3d')][_0x5e5b('0x5a')]=_0x43dd42['id'];if(_0x91b57e['query'][_0x5e5b('0x39')]){_0x59e36e[_0x5e5b('0x3d')]=_['merge'](_0x59e36e[_0x5e5b('0x3d')],{'$or':_[_0x5e5b('0x2b')](_0x59e36e[_0x5e5b('0x33')],function(_0x546510){var _0x49ea11={};_0x49ea11[_0x546510]={'$like':'%'+_0x91b57e[_0x5e5b('0x30')][_0x5e5b('0x39')]+'%'};return _0x49ea11;})});}_0x59e36e=_[_0x5e5b('0x3a')]({},_0x59e36e,_0x91b57e[_0x5e5b('0x3c')]);return db[_0x5e5b('0x5f')]['count']({'where':_0x59e36e[_0x5e5b('0x3d')]})['then'](function(_0xd9a6ee){_0x4298e5['count']=_0xd9a6ee;if(_0x91b57e[_0x5e5b('0x30')][_0x5e5b('0x3e')]){_0x59e36e['include']=[{'all':!![]}];}return db[_0x5e5b('0x5f')][_0x5e5b('0x40')](_0x59e36e);})[_0x5e5b('0x26')](function(_0x430291){_0x4298e5['rows']=_0x430291;return _0x4298e5;});}})[_0x5e5b('0x26')](respondWithFilteredResult(_0x556a4b,_0x59e36e))[_0x5e5b('0x42')](handleError(_0x556a4b,null));};exports[_0x5e5b('0x60')]=function(_0x2401f9,_0x46c8b4,_0xb8f0fd){var _0x2cfff0={'raw':!![],'where':{}};var _0x4d9562={};var _0xc8adfb={'count':0x0,'rows':[]};return db[_0x5e5b('0x2c')][_0x5e5b('0x5c')]({'where':{'id':_0x2401f9[_0x5e5b('0x43')]['id']}})[_0x5e5b('0x26')](handleEntityNotFound(_0x46c8b4,null))['then'](function(_0x499d4b){if(_0x499d4b){_0x4d9562[_0x5e5b('0x2f')]=_['keys'](db[_0x5e5b('0x61')][_0x5e5b('0x2d')]);_0x4d9562[_0x5e5b('0x30')]=_[_0x5e5b('0x31')](_0x2401f9['query']);_0x4d9562[_0x5e5b('0x38')]=_['intersection'](_0x4d9562[_0x5e5b('0x2f')],_0x4d9562[_0x5e5b('0x30')]);_0x2cfff0[_0x5e5b('0x33')]=_[_0x5e5b('0x32')](_0x4d9562[_0x5e5b('0x2f')],qs[_0x5e5b('0x34')](_0x2401f9[_0x5e5b('0x30')][_0x5e5b('0x34')]));_0x2cfff0[_0x5e5b('0x33')]=_0x2cfff0[_0x5e5b('0x33')]['length']?_0x2cfff0[_0x5e5b('0x33')]:_0x4d9562[_0x5e5b('0x2f')];if(!_0x2401f9[_0x5e5b('0x30')]['hasOwnProperty'](_0x5e5b('0x58'))){_0x2cfff0[_0x5e5b('0x1f')]=qs[_0x5e5b('0x1f')](_0x2401f9[_0x5e5b('0x30')][_0x5e5b('0x1f')]);_0x2cfff0[_0x5e5b('0x1e')]=qs[_0x5e5b('0x1e')](_0x2401f9[_0x5e5b('0x30')][_0x5e5b('0x1e')]);}_0x2cfff0[_0x5e5b('0x36')]=qs[_0x5e5b('0x37')](_0x2401f9[_0x5e5b('0x30')]['sort']);_0x2cfff0[_0x5e5b('0x3d')]=qs[_0x5e5b('0x38')](_[_0x5e5b('0x59')](_0x2401f9['query'],_0x4d9562['filters']));_0x2cfff0[_0x5e5b('0x3d')][_0x5e5b('0x5a')]=_0x499d4b['id'];if(_0x2401f9['query'][_0x5e5b('0x39')]){_0x2cfff0['where']=_[_0x5e5b('0x3a')](_0x2cfff0[_0x5e5b('0x3d')],{'$or':_[_0x5e5b('0x2b')](_0x2cfff0[_0x5e5b('0x33')],function(_0x429084){var _0x4c07f0={};_0x4c07f0[_0x429084]={'$like':'%'+_0x2401f9[_0x5e5b('0x30')][_0x5e5b('0x39')]+'%'};return _0x4c07f0;})});}_0x2cfff0=_['merge']({},_0x2cfff0,_0x2401f9[_0x5e5b('0x3c')]);return db[_0x5e5b('0x61')]['count']({'where':_0x2cfff0[_0x5e5b('0x3d')]})[_0x5e5b('0x26')](function(_0x416941){_0xc8adfb['count']=_0x416941;if(_0x2401f9['query'][_0x5e5b('0x3e')]){_0x2cfff0[_0x5e5b('0x3f')]=[{'all':!![]}];}return db[_0x5e5b('0x61')][_0x5e5b('0x40')](_0x2cfff0);})[_0x5e5b('0x26')](function(_0x47c605){_0xc8adfb['rows']=_0x47c605;return _0xc8adfb;});}})[_0x5e5b('0x26')](respondWithFilteredResult(_0x46c8b4,_0x2cfff0))[_0x5e5b('0x42')](handleError(_0x46c8b4,null));};exports['getLists']=function(_0x1da4af,_0x2a691f,_0x440b4c){var _0x2e047b={};var _0xc9ea89={};var _0x381744;var _0x1026e0;return db['Campaign']['findOne']({'where':{'id':_0x1da4af[_0x5e5b('0x43')]['id']}})[_0x5e5b('0x26')](handleEntityNotFound(_0x2a691f,null))[_0x5e5b('0x26')](function(_0x4113a4){if(_0x4113a4){_0x381744=_0x4113a4;_0xc9ea89[_0x5e5b('0x2f')]=_[_0x5e5b('0x31')](db[_0x5e5b('0x62')]['rawAttributes']);_0xc9ea89['query']=_[_0x5e5b('0x31')](_0x1da4af[_0x5e5b('0x30')]);_0xc9ea89['filters']=_[_0x5e5b('0x32')](_0xc9ea89[_0x5e5b('0x2f')],_0xc9ea89['query']);_0x2e047b[_0x5e5b('0x33')]=_[_0x5e5b('0x32')](_0xc9ea89[_0x5e5b('0x2f')],qs[_0x5e5b('0x34')](_0x1da4af['query'][_0x5e5b('0x34')]));_0x2e047b[_0x5e5b('0x33')]=_0x2e047b[_0x5e5b('0x33')][_0x5e5b('0x35')]?_0x2e047b['attributes']:_0xc9ea89['model'];_0x2e047b['order']=qs[_0x5e5b('0x37')](_0x1da4af[_0x5e5b('0x30')][_0x5e5b('0x37')]);_0x2e047b[_0x5e5b('0x3d')]=qs[_0x5e5b('0x38')](_[_0x5e5b('0x59')](_0x1da4af['query'],_0xc9ea89['filters']));if(_0x1da4af[_0x5e5b('0x30')][_0x5e5b('0x39')]){_0x2e047b['where']=_[_0x5e5b('0x3a')](_0x2e047b[_0x5e5b('0x3d')],{'$or':_[_0x5e5b('0x2b')](_0x2e047b[_0x5e5b('0x33')],function(_0x5b3157){var _0x115a42={};_0x115a42[_0x5b3157]={'$like':'%'+_0x1da4af[_0x5e5b('0x30')][_0x5e5b('0x39')]+'%'};return _0x115a42;})});}_0x2e047b=_[_0x5e5b('0x3a')]({},_0x2e047b,_0x1da4af[_0x5e5b('0x3c')]);return _0x381744[_0x5e5b('0x63')](_0x2e047b);}})[_0x5e5b('0x26')](function(_0x36bcc7){if(_0x36bcc7){_0x1026e0=_0x36bcc7[_0x5e5b('0x35')];if(!_0x1da4af[_0x5e5b('0x30')][_0x5e5b('0x64')](_0x5e5b('0x58'))){_0x2e047b[_0x5e5b('0x1f')]=qs['limit'](_0x1da4af['query'][_0x5e5b('0x1f')]);_0x2e047b[_0x5e5b('0x1e')]=qs['offset'](_0x1da4af[_0x5e5b('0x30')][_0x5e5b('0x1e')]);}return _0x381744[_0x5e5b('0x63')](_0x2e047b);}})[_0x5e5b('0x26')](function(_0x423e75){if(_0x423e75){return _0x423e75?{'count':_0x1026e0,'rows':_0x423e75}:null;}})[_0x5e5b('0x26')](respondWithResult(_0x2a691f,null))['catch'](handleError(_0x2a691f,null));};exports[_0x5e5b('0x65')]=function(_0x3453d2,_0x45931e,_0x2c5a23){var _0x10b74d,_0x3b03e9;var _0x3e0b30=[];var _0xa31f34=moment()[_0x5e5b('0x66')](_0x5e5b('0x67'));return db[_0x5e5b('0x2c')][_0x5e5b('0x44')]({'where':{'id':_0x3453d2[_0x5e5b('0x43')]['id']}})['then'](handleEntityNotFound(_0x45931e,null))[_0x5e5b('0x26')](function(_0x59187b){if(_0x59187b){_0x3b03e9=_0x59187b;return _0x59187b['addLists'](_0x3453d2[_0x5e5b('0x46')][_0x5e5b('0x68')],_[_0x5e5b('0x4e')](_0x3453d2[_0x5e5b('0x46')],[_0x5e5b('0x68'),'id'])||{});}return null;})[_0x5e5b('0x69')](function(_0x538256){var _0x248069;var _0x806763;_0x10b74d=_0x538256||[];var _0x1632c4=[];if(_0x538256){for(var _0x19dfb2=0x0;_0x19dfb2<_0x538256[_0x5e5b('0x35')];_0x19dfb2+=0x1){var _0xd5a993=_0x538256[_0x19dfb2][_0x5e5b('0x4d')]({'plain':!![]});_0x3b03e9[_0x5e5b('0x6a')]=_0x3453d2[_0x5e5b('0x46')][_0x5e5b('0x6a')]?_0x3453d2[_0x5e5b('0x46')]['dialCheckDuplicateType']:_0x3b03e9[_0x5e5b('0x6a')];switch(_0x3b03e9[_0x5e5b('0x6a')]){case _0x5e5b('0x6b'):_0x248069=squel['insert']()[_0x5e5b('0x6c')]('cm_hopper')[_0x5e5b('0x6d')]([_0x5e5b('0x6e'),_0x5e5b('0x6f'),_0x5e5b('0x70'),_0x5e5b('0x71'),_0x5e5b('0x5a'),_0x5e5b('0x50'),_0x5e5b('0x4f')],squel[_0x5e5b('0x72')]()[_0x5e5b('0x73')]('phone',_0x5e5b('0x6e'))[_0x5e5b('0x73')](_0x5e5b('0x74'),_0x5e5b('0x6f'))[_0x5e5b('0x73')]('id',_0x5e5b('0x70'))[_0x5e5b('0x73')](_0xd5a993[_0x5e5b('0x75')][_0x5e5b('0x76')](),_0x5e5b('0x71'))['field'](_0x3453d2[_0x5e5b('0x43')]['id']['toString'](),_0x5e5b('0x5a'))[_0x5e5b('0x73')]('\x27'+_0xa31f34+'\x27',_0x5e5b('0x50'))[_0x5e5b('0x73')]('\x27'+_0xa31f34+'\x27','updatedAt')[_0x5e5b('0x77')](_0x5e5b('0x78'))[_0x5e5b('0x3d')](_0x5e5b('0x79'))[_0x5e5b('0x3d')](_0x5e5b('0x7a'),_0xd5a993[_0x5e5b('0x75')]['toString']())[_0x5e5b('0x3d')](_0x5e5b('0x7b'))['where'](_0x5e5b('0x7c'),squel[_0x5e5b('0x72')]()['field'](_0x5e5b('0x7d'))[_0x5e5b('0x77')](_0x5e5b('0x7e'))[_0x5e5b('0x3d')](_0x5e5b('0x7f'),_0x3453d2['params']['id'][_0x5e5b('0x76')]()))[_0x5e5b('0x3d')](_0x5e5b('0x7c'),squel[_0x5e5b('0x72')]()[_0x5e5b('0x73')](_0x5e5b('0x80'))[_0x5e5b('0x77')]('cm_hopper')[_0x5e5b('0x3d')](_0x5e5b('0x7f'),_0x3453d2[_0x5e5b('0x43')]['id'][_0x5e5b('0x76')]())))[_0x5e5b('0x76')]();break;case _0x5e5b('0x81'):_0x248069=squel['insert']()[_0x5e5b('0x6c')](_0x5e5b('0x82'))[_0x5e5b('0x6d')](['phone',_0x5e5b('0x6f'),'ContactId',_0x5e5b('0x71'),_0x5e5b('0x5a'),_0x5e5b('0x50'),_0x5e5b('0x4f')],squel['select']()[_0x5e5b('0x73')]('phone','phone')[_0x5e5b('0x73')](_0x5e5b('0x74'),_0x5e5b('0x6f'))[_0x5e5b('0x73')]('id',_0x5e5b('0x70'))[_0x5e5b('0x73')](_0xd5a993['CmListId'][_0x5e5b('0x76')](),'ListId')[_0x5e5b('0x73')](_0x3453d2[_0x5e5b('0x43')]['id'][_0x5e5b('0x76')](),_0x5e5b('0x5a'))[_0x5e5b('0x73')]('\x27'+_0xa31f34+'\x27',_0x5e5b('0x50'))['field']('\x27'+_0xa31f34+'\x27',_0x5e5b('0x4f'))['from'](_0x5e5b('0x78'))[_0x5e5b('0x3d')](_0x5e5b('0x79'))['where']('ListId\x20=\x20?',_0xd5a993['CmListId'][_0x5e5b('0x76')]())[_0x5e5b('0x3d')](_0x5e5b('0x7b'))[_0x5e5b('0x3d')](_0x5e5b('0x7c'),squel[_0x5e5b('0x72')]()['field'](_0x5e5b('0x80'))[_0x5e5b('0x77')](_0x5e5b('0x82'))[_0x5e5b('0x3d')](_0x5e5b('0x7f'),_0x3453d2[_0x5e5b('0x43')]['id'][_0x5e5b('0x76')]())))[_0x5e5b('0x76')]();break;default:_0x248069=squel['insert']()[_0x5e5b('0x6c')](_0x5e5b('0x82'))[_0x5e5b('0x6d')]([_0x5e5b('0x6e'),'scheduledAt',_0x5e5b('0x70'),'ListId',_0x5e5b('0x5a'),_0x5e5b('0x50'),_0x5e5b('0x4f')],squel[_0x5e5b('0x72')]()['field'](_0x5e5b('0x6e'),_0x5e5b('0x6e'))[_0x5e5b('0x73')]('NOW()',_0x5e5b('0x6f'))[_0x5e5b('0x73')]('id',_0x5e5b('0x70'))['field'](_0xd5a993[_0x5e5b('0x75')][_0x5e5b('0x76')](),_0x5e5b('0x71'))[_0x5e5b('0x73')](_0x3453d2[_0x5e5b('0x43')]['id'][_0x5e5b('0x76')](),_0x5e5b('0x5a'))['field']('\x27'+_0xa31f34+'\x27',_0x5e5b('0x50'))[_0x5e5b('0x73')]('\x27'+_0xa31f34+'\x27','updatedAt')['from'](_0x5e5b('0x78'))[_0x5e5b('0x3d')]('deletedAt\x20IS\x20NULL')[_0x5e5b('0x3d')](_0x5e5b('0x7a'),_0xd5a993['CmListId']['toString']())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x5e5b('0x76')]();}_0x806763=squel[_0x5e5b('0x83')]()['into'](_0x5e5b('0x84'))[_0x5e5b('0x6d')]([_0x5e5b('0x85'),_0x5e5b('0x6f'),_0x5e5b('0x6e'),_0x5e5b('0x86'),_0x5e5b('0x50'),_0x5e5b('0x4f')],squel[_0x5e5b('0x72')]()['field'](_0x5e5b('0x87'),'id')[_0x5e5b('0x73')]('NOW()',_0x5e5b('0x6f'))['field'](_0x5e5b('0x88'),_0x5e5b('0x6e'))[_0x5e5b('0x73')](_0x5e5b('0x89'),_0x5e5b('0x86'))[_0x5e5b('0x73')]('\x27'+_0xa31f34+'\x27','createdAt')[_0x5e5b('0x73')]('\x27'+_0xa31f34+'\x27',_0x5e5b('0x4f'))[_0x5e5b('0x77')](_0x5e5b('0x8a'),'ci')[_0x5e5b('0x8b')](_0x5e5b('0x82'),'h',_0x5e5b('0x8c'))[_0x5e5b('0x3d')](_0x5e5b('0x8d'),_0xd5a993[_0x5e5b('0x75')][_0x5e5b('0x76')]())[_0x5e5b('0x3d')](_0x5e5b('0x8e'),_0x3453d2[_0x5e5b('0x43')]['id'][_0x5e5b('0x76')]())['where']('h.createdAt\x20=\x20?',_0xa31f34))[_0x5e5b('0x76')]();_0x1632c4[_0x5e5b('0x8f')](db[_0x5e5b('0x90')][_0x5e5b('0x30')](_0x248069));_0x3e0b30['push'](db[_0x5e5b('0x90')][_0x5e5b('0x30')](_0x806763));}return BPromise[_0x5e5b('0x91')](_0x1632c4);}})[_0x5e5b('0x26')](function(){return BPromise[_0x5e5b('0x91')](_0x3e0b30);})['then'](function(){return _0x10b74d;})[_0x5e5b('0x26')](respondWithResult(_0x45931e,null))[_0x5e5b('0x42')](handleError(_0x45931e,null));};exports[_0x5e5b('0x92')]=function(_0xb5293a,_0x1eb268,_0xb7925b){return db['Campaign'][_0x5e5b('0x44')]({'where':{'id':_0xb5293a[_0x5e5b('0x43')]['id']}})[_0x5e5b('0x26')](handleEntityNotFound(_0x1eb268,null))[_0x5e5b('0x26')](function(_0x3b561f){if(_0x3b561f){return _0x3b561f[_0x5e5b('0x92')](_0xb5293a[_0x5e5b('0x30')][_0x5e5b('0x68')]);}})[_0x5e5b('0x26')](function(_0x20479e){if(_0x20479e){return db['CmHopper']['destroy']({'where':{'ListId':_0xb5293a[_0x5e5b('0x30')]['ids'],'CampaignId':_0xb5293a[_0x5e5b('0x43')]['id']}})['then'](function(){return _0x20479e;});}})['then'](respondWithStatusCode(_0x1eb268,null))[_0x5e5b('0x42')](handleError(_0x1eb268,null));};exports[_0x5e5b('0x93')]=function(_0x93f950,_0x4804c6,_0x2e66fa){var _0x2fb482={};var _0x20956f={};var _0x2f4279;var _0x1e4dd0;return db[_0x5e5b('0x2c')][_0x5e5b('0x5c')]({'where':{'id':_0x93f950[_0x5e5b('0x43')]['id']}})[_0x5e5b('0x26')](handleEntityNotFound(_0x4804c6,null))['then'](function(_0x1186b3){if(_0x1186b3){_0x2f4279=_0x1186b3;_0x20956f[_0x5e5b('0x2f')]=_[_0x5e5b('0x31')](db['CmList']['rawAttributes']);_0x20956f[_0x5e5b('0x30')]=_[_0x5e5b('0x31')](_0x93f950[_0x5e5b('0x30')]);_0x20956f[_0x5e5b('0x38')]=_[_0x5e5b('0x32')](_0x20956f[_0x5e5b('0x2f')],_0x20956f[_0x5e5b('0x30')]);_0x2fb482[_0x5e5b('0x33')]=_[_0x5e5b('0x32')](_0x20956f[_0x5e5b('0x2f')],qs[_0x5e5b('0x34')](_0x93f950[_0x5e5b('0x30')][_0x5e5b('0x34')]));_0x2fb482[_0x5e5b('0x33')]=_0x2fb482[_0x5e5b('0x33')][_0x5e5b('0x35')]?_0x2fb482['attributes']:_0x20956f['model'];_0x2fb482['order']=qs[_0x5e5b('0x37')](_0x93f950['query'][_0x5e5b('0x37')]);_0x2fb482['where']=qs[_0x5e5b('0x38')](_[_0x5e5b('0x59')](_0x93f950[_0x5e5b('0x30')],_0x20956f[_0x5e5b('0x38')]));if(_0x93f950['query']['filter']){_0x2fb482[_0x5e5b('0x3d')]=_[_0x5e5b('0x3a')](_0x2fb482[_0x5e5b('0x3d')],{'$or':_[_0x5e5b('0x2b')](_0x2fb482[_0x5e5b('0x33')],function(_0x38025e){var _0x37f714={};_0x37f714[_0x38025e]={'$like':'%'+_0x93f950[_0x5e5b('0x30')]['filter']+'%'};return _0x37f714;})});}_0x2fb482=_[_0x5e5b('0x3a')]({},_0x2fb482,_0x93f950['options']);return _0x2f4279[_0x5e5b('0x93')](_0x2fb482);}})['then'](function(_0x5bfd97){if(_0x5bfd97){_0x1e4dd0=_0x5bfd97[_0x5e5b('0x35')];if(!_0x93f950[_0x5e5b('0x30')]['hasOwnProperty']('nolimit')){_0x2fb482['limit']=qs[_0x5e5b('0x1f')](_0x93f950[_0x5e5b('0x30')][_0x5e5b('0x1f')]);_0x2fb482[_0x5e5b('0x1e')]=qs[_0x5e5b('0x1e')](_0x93f950[_0x5e5b('0x30')][_0x5e5b('0x1e')]);}return _0x2f4279[_0x5e5b('0x93')](_0x2fb482);}})[_0x5e5b('0x26')](function(_0x2301da){if(_0x2301da){return _0x2301da?{'count':_0x1e4dd0,'rows':_0x2301da}:null;}})[_0x5e5b('0x26')](respondWithResult(_0x4804c6,null))['catch'](handleError(_0x4804c6,null));};exports['addBlackLists']=function(_0x1da201,_0x3bee32,_0x185c84){var _0x4b170b,_0x4c1025;var _0x2dddeb=[];var _0x25a887=moment()[_0x5e5b('0x66')](_0x5e5b('0x67'));return db[_0x5e5b('0x2c')][_0x5e5b('0x44')]({'where':{'id':_0x1da201[_0x5e5b('0x43')]['id']}})[_0x5e5b('0x26')](handleEntityNotFound(_0x3bee32,null))[_0x5e5b('0x26')](function(_0x15fb75){if(_0x15fb75){_0x4c1025=_0x15fb75;return _0x15fb75[_0x5e5b('0x94')](_0x1da201['body'][_0x5e5b('0x68')],_[_0x5e5b('0x4e')](_0x1da201[_0x5e5b('0x46')],[_0x5e5b('0x68'),'id'])||{});}return null;})[_0x5e5b('0x69')](function(_0x28e0ad){var _0x25495f;var _0xb45473;_0x4b170b=_0x28e0ad||[];var _0x4e7801=[];if(_0x28e0ad){for(var _0x11d758=0x0;_0x11d758<_0x28e0ad[_0x5e5b('0x35')];_0x11d758+=0x1){var _0x5401cc=_0x28e0ad[_0x11d758][_0x5e5b('0x4d')]({'plain':!![]});_0x25495f=squel[_0x5e5b('0x83')]()[_0x5e5b('0x6c')](_0x5e5b('0x95'))[_0x5e5b('0x6d')]([_0x5e5b('0x6e'),_0x5e5b('0x70'),_0x5e5b('0x71'),_0x5e5b('0x5a'),_0x5e5b('0x50'),_0x5e5b('0x4f')],squel[_0x5e5b('0x72')]()['field'](_0x5e5b('0x6e'),_0x5e5b('0x6e'))[_0x5e5b('0x73')]('id',_0x5e5b('0x70'))[_0x5e5b('0x73')](_0x5401cc[_0x5e5b('0x75')]['toString'](),_0x5e5b('0x71'))[_0x5e5b('0x73')](_0x1da201['params']['id'][_0x5e5b('0x76')](),_0x5e5b('0x5a'))[_0x5e5b('0x73')]('NOW()','createdAt')[_0x5e5b('0x73')](_0x5e5b('0x74'),_0x5e5b('0x4f'))['from'](_0x5e5b('0x78'))[_0x5e5b('0x3d')]('deletedAt\x20IS\x20NULL')['where'](_0x5e5b('0x7a'),_0x5401cc[_0x5e5b('0x75')][_0x5e5b('0x76')]())['where'](_0x5e5b('0x7b')))[_0x5e5b('0x76')]();_0x4e7801[_0x5e5b('0x8f')](db['sequelize'][_0x5e5b('0x30')](_0x25495f));}return BPromise[_0x5e5b('0x91')](_0x4e7801);}})['then'](function(){return _0x4b170b;})[_0x5e5b('0x26')](respondWithResult(_0x3bee32,null))['catch'](handleError(_0x3bee32,null));};exports['removeBlackLists']=function(_0x32a261,_0x5ef810,_0x407a96){return db['Campaign']['find']({'where':{'id':_0x32a261['params']['id']}})[_0x5e5b('0x26')](handleEntityNotFound(_0x5ef810,null))[_0x5e5b('0x26')](function(_0x6b0cae){if(_0x6b0cae){return _0x6b0cae[_0x5e5b('0x96')](_0x32a261['query']['ids']);}})[_0x5e5b('0x26')](function(_0x49d076){if(_0x49d076){return db[_0x5e5b('0x61')][_0x5e5b('0x55')]({'where':{'ListId':_0x32a261['query'][_0x5e5b('0x68')],'CampaignId':_0x32a261[_0x5e5b('0x43')]['id']}})[_0x5e5b('0x26')](function(){return _0x49d076;});}})[_0x5e5b('0x26')](respondWithStatusCode(_0x5ef810,null))[_0x5e5b('0x42')](handleError(_0x5ef810,null));}; \ No newline at end of file +var _0x9d26=['intersection','fields','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','rows','params','length','include','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','getHoppers','findOne','CmHopper','CampaignId','findAll','getHopperHistories','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','spread','dialCheckDuplicateType','always','fromQuery','scheduledAt','ContactId','ListId','select','phone','field','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_hopper','insert','into','NOW()','cm_hopper_additional_phones','ci.item','ci.OrderBY','OrderBy','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.createdAt\x20=\x20?','sequelize','push','all','removeLists','getBlackLists','addBlackLists','ids','cm_hopper_black','removeBlackLists','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','error','name','send','Campaign','rawAttributes','type','key','model','map','query','keys','filters','attributes'];(function(_0x30986c,_0x39ce58){var _0x57c209=function(_0x557c36){while(--_0x557c36){_0x30986c['push'](_0x30986c['shift']());}};_0x57c209(++_0x39ce58);}(_0x9d26,0x17d));var _0x69d2=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9d26[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0x69d2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x69d2('0x1'));var jsonpatch=require(_0x69d2('0x2'));var rp=require(_0x69d2('0x3'));var moment=require(_0x69d2('0x4'));var BPromise=require(_0x69d2('0x5'));var Mustache=require('mustache');var util=require(_0x69d2('0x6'));var path=require('path');var sox=require(_0x69d2('0x7'));var csv=require(_0x69d2('0x8'));var ejs=require(_0x69d2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x69d2('0xa'));var squel=require(_0x69d2('0xb'));var crypto=require(_0x69d2('0xc'));var jsforce=require(_0x69d2('0xd'));var deskjs=require(_0x69d2('0xe'));var toCsv=require(_0x69d2('0x8'));var querystring=require(_0x69d2('0xf'));var Papa=require(_0x69d2('0x10'));var Redis=require(_0x69d2('0x11'));var authService=require(_0x69d2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x69d2('0x13'));var hardwareService=require(_0x69d2('0x14'));var logger=require(_0x69d2('0x15'))(_0x69d2('0x16'));var utils=require(_0x69d2('0x17'));var config=require(_0x69d2('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x69d2('0x19'))['db'];function respondWithStatusCode(_0x372181,_0x31093c){_0x31093c=_0x31093c||0xcc;return function(_0x21379a){if(_0x21379a){return _0x372181[_0x69d2('0x1a')](_0x31093c);}return _0x372181[_0x69d2('0x1b')](_0x31093c)[_0x69d2('0x1c')]();};}function respondWithResult(_0x2b91be,_0x510f1e){_0x510f1e=_0x510f1e||0xc8;return function(_0x3a4a66){if(_0x3a4a66){return _0x2b91be[_0x69d2('0x1b')](_0x510f1e)['json'](_0x3a4a66);}};}function respondWithFilteredResult(_0x41ed13,_0x1e0013){return function(_0x1b169f){if(_0x1b169f){var _0x4b45b7=typeof _0x1e0013['offset']==='undefined'&&typeof _0x1e0013[_0x69d2('0x1d')]===_0x69d2('0x1e');var _0x2d65a3=_0x1b169f[_0x69d2('0x1f')];var _0xc38f9=_0x4b45b7?0x0:_0x1e0013[_0x69d2('0x20')];var _0x36f445=_0x4b45b7?_0x1b169f[_0x69d2('0x1f')]:_0x1e0013[_0x69d2('0x20')]+_0x1e0013[_0x69d2('0x1d')];var _0x372e7c;if(_0x36f445>=_0x2d65a3){_0x36f445=_0x2d65a3;_0x372e7c=0xc8;}else{_0x372e7c=0xce;}_0x41ed13[_0x69d2('0x1b')](_0x372e7c);return _0x41ed13[_0x69d2('0x21')](_0x69d2('0x22'),_0xc38f9+'-'+_0x36f445+'/'+_0x2d65a3)['json'](_0x1b169f);}return null;};}function patchUpdates(_0x459dbd){return function(_0x4a20ec){try{jsonpatch[_0x69d2('0x23')](_0x4a20ec,_0x459dbd,!![]);}catch(_0x3e2d05){return BPromise[_0x69d2('0x24')](_0x3e2d05);}return _0x4a20ec[_0x69d2('0x25')]();};}function saveUpdates(_0x240723,_0x234bb3){return function(_0x2327ef){if(_0x2327ef){return _0x2327ef[_0x69d2('0x26')](_0x240723)[_0x69d2('0x27')](function(_0x35fff6){return _0x35fff6;});}return null;};}function removeEntity(_0x25550c,_0x44f9ac){return function(_0xd4a95f){if(_0xd4a95f){return _0xd4a95f[_0x69d2('0x28')]()['then'](function(){var _0x115e46=_0xd4a95f[_0x69d2('0x29')]({'plain':!![]});var _0x563c5f=_0x69d2('0x2a');return db[_0x69d2('0x2b')]['destroy']({'where':{'type':_0x563c5f,'resourceId':_0x115e46['id']}})[_0x69d2('0x27')](function(){return _0xd4a95f;});})[_0x69d2('0x27')](function(){_0x25550c[_0x69d2('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ca4ae,_0x2f6e7a){return function(_0x474268){if(!_0x474268){_0x4ca4ae[_0x69d2('0x1a')](0x194);}return _0x474268;};}function handleError(_0x410418,_0xa680d7){_0xa680d7=_0xa680d7||0x1f4;return function(_0x22a1ad){logger[_0x69d2('0x2c')](_0x22a1ad['stack']);if(_0x22a1ad['name']){delete _0x22a1ad[_0x69d2('0x2d')];}_0x410418[_0x69d2('0x1b')](_0xa680d7)[_0x69d2('0x2e')](_0x22a1ad);};}exports['index']=function(_0xe8e147,_0x25bc5e){var _0x5349f0={},_0x1c237d={},_0x478e16={'count':0x0,'rows':[]};var _0x4d8831=_['map'](db[_0x69d2('0x2f')][_0x69d2('0x30')],function(_0x3a335b){return{'name':_0x3a335b['fieldName'],'type':_0x3a335b[_0x69d2('0x31')][_0x69d2('0x32')]};});_0x1c237d[_0x69d2('0x33')]=_[_0x69d2('0x34')](_0x4d8831,'name');_0x1c237d[_0x69d2('0x35')]=_[_0x69d2('0x36')](_0xe8e147[_0x69d2('0x35')]);_0x1c237d[_0x69d2('0x37')]=_['intersection'](_0x1c237d[_0x69d2('0x33')],_0x1c237d[_0x69d2('0x35')]);_0x5349f0[_0x69d2('0x38')]=_[_0x69d2('0x39')](_0x1c237d[_0x69d2('0x33')],qs[_0x69d2('0x3a')](_0xe8e147[_0x69d2('0x35')][_0x69d2('0x3a')]));_0x5349f0[_0x69d2('0x38')]=_0x5349f0[_0x69d2('0x38')]['length']?_0x5349f0['attributes']:_0x1c237d[_0x69d2('0x33')];if(!_0xe8e147['query'][_0x69d2('0x3b')](_0x69d2('0x3c'))){_0x5349f0[_0x69d2('0x1d')]=qs[_0x69d2('0x1d')](_0xe8e147[_0x69d2('0x35')][_0x69d2('0x1d')]);_0x5349f0['offset']=qs[_0x69d2('0x20')](_0xe8e147[_0x69d2('0x35')][_0x69d2('0x20')]);}_0x5349f0[_0x69d2('0x3d')]=qs[_0x69d2('0x3e')](_0xe8e147[_0x69d2('0x35')]['sort']);_0x5349f0['where']=qs[_0x69d2('0x37')](_[_0x69d2('0x3f')](_0xe8e147['query'],_0x1c237d[_0x69d2('0x37')]),_0x4d8831);if(_0xe8e147[_0x69d2('0x35')]['filter']){_0x5349f0[_0x69d2('0x40')]=_['merge'](_0x5349f0['where'],{'$or':_[_0x69d2('0x34')](_0x4d8831,function(_0x396e2){if(_0x396e2[_0x69d2('0x31')]!==_0x69d2('0x41')){var _0x36f615={};_0x36f615[_0x396e2['name']]={'$like':'%'+_0xe8e147[_0x69d2('0x35')][_0x69d2('0x42')]+'%'};return _0x36f615;}})});}_0x5349f0=_[_0x69d2('0x43')]({},_0x5349f0,_0xe8e147[_0x69d2('0x44')]);var _0x20fcd7={'where':_0x5349f0['where']};return db[_0x69d2('0x2f')][_0x69d2('0x1f')](_0x20fcd7)[_0x69d2('0x27')](function(_0x266483){_0x478e16[_0x69d2('0x1f')]=_0x266483;if(_0xe8e147['query'][_0x69d2('0x45')]){_0x5349f0['include']=[{'all':!![]}];}return db[_0x69d2('0x2f')]['findAll'](_0x5349f0);})['then'](function(_0x2df0b2){_0x478e16[_0x69d2('0x46')]=_0x2df0b2;return _0x478e16;})[_0x69d2('0x27')](respondWithFilteredResult(_0x25bc5e,_0x5349f0))['catch'](handleError(_0x25bc5e,null));};exports['show']=function(_0x3fa70f,_0x4d58ca){var _0x4e95be={'raw':![],'where':{'id':_0x3fa70f[_0x69d2('0x47')]['id']}},_0x3d5ca8={};_0x3d5ca8[_0x69d2('0x33')]=_[_0x69d2('0x36')](db[_0x69d2('0x2f')][_0x69d2('0x30')]);_0x3d5ca8['query']=_[_0x69d2('0x36')](_0x3fa70f[_0x69d2('0x35')]);_0x3d5ca8[_0x69d2('0x37')]=_[_0x69d2('0x39')](_0x3d5ca8[_0x69d2('0x33')],_0x3d5ca8[_0x69d2('0x35')]);_0x4e95be[_0x69d2('0x38')]=_[_0x69d2('0x39')](_0x3d5ca8['model'],qs[_0x69d2('0x3a')](_0x3fa70f[_0x69d2('0x35')][_0x69d2('0x3a')]));_0x4e95be[_0x69d2('0x38')]=_0x4e95be[_0x69d2('0x38')][_0x69d2('0x48')]?_0x4e95be[_0x69d2('0x38')]:_0x3d5ca8['model'];if(_0x3fa70f[_0x69d2('0x35')][_0x69d2('0x45')]){_0x4e95be[_0x69d2('0x49')]=[{'all':!![]}];}_0x4e95be=_['merge']({},_0x4e95be,_0x3fa70f[_0x69d2('0x44')]);return db[_0x69d2('0x2f')][_0x69d2('0x4a')](_0x4e95be)[_0x69d2('0x27')](handleEntityNotFound(_0x4d58ca,null))['then'](respondWithResult(_0x4d58ca,null))[_0x69d2('0x4b')](handleError(_0x4d58ca,null));};exports[_0x69d2('0x4c')]=function(_0x5c4a6d,_0x40db70){return db[_0x69d2('0x2f')]['create'](_0x5c4a6d[_0x69d2('0x4d')],{})[_0x69d2('0x27')](function(_0x67d8af){var _0x80fcbd=_0x5c4a6d['user'][_0x69d2('0x29')]({'plain':!![]});if(!_0x80fcbd)throw new Error(_0x69d2('0x4e'));if(_0x80fcbd[_0x69d2('0x4f')]===_0x69d2('0x50')){var _0x581923=_0x67d8af[_0x69d2('0x29')]({'plain':!![]});var _0x29ebc9=_0x69d2('0x2a');return db[_0x69d2('0x51')][_0x69d2('0x4a')]({'where':{'name':_0x29ebc9,'userProfileId':_0x80fcbd[_0x69d2('0x52')]},'raw':!![]})[_0x69d2('0x27')](function(_0x17f448){if(_0x17f448&&_0x17f448[_0x69d2('0x53')]===0x0){return db['UserProfileResource'][_0x69d2('0x4c')]({'name':_0x581923[_0x69d2('0x2d')],'resourceId':_0x581923['id'],'type':_0x17f448[_0x69d2('0x2d')],'sectionId':_0x17f448['id']},{})[_0x69d2('0x27')](function(){return _0x67d8af;});}else{return _0x67d8af;}})[_0x69d2('0x4b')](function(_0x58ee5f){logger[_0x69d2('0x2c')](_0x69d2('0x54'),_0x58ee5f);throw _0x58ee5f;});}return _0x67d8af;})[_0x69d2('0x27')](respondWithResult(_0x40db70,0xc9))[_0x69d2('0x4b')](handleError(_0x40db70,null));};exports[_0x69d2('0x55')]=function(_0x54af82,_0x230388){var _0x4eb84b={'where':{'id':_0x54af82[_0x69d2('0x47')]['id']}},_0x410c31={};_0x410c31[_0x69d2('0x33')]=_['keys'](db[_0x69d2('0x2f')][_0x69d2('0x30')]);_0x4eb84b[_0x69d2('0x38')]=_[_0x69d2('0x39')](_0x410c31['model'],qs[_0x69d2('0x3a')](_0x54af82[_0x69d2('0x35')][_0x69d2('0x3a')]));_0x4eb84b[_0x69d2('0x38')]=_0x4eb84b[_0x69d2('0x38')][_0x69d2('0x48')]?_0x4eb84b[_0x69d2('0x38')]:_0x410c31[_0x69d2('0x33')];if(_0x54af82[_0x69d2('0x35')]['includeAll']){_0x4eb84b[_0x69d2('0x49')]=[{'all':!![]}];}_0x4eb84b=_[_0x69d2('0x43')]({},_0x4eb84b,_0x54af82[_0x69d2('0x44')]);return db[_0x69d2('0x2f')][_0x69d2('0x4a')](_0x4eb84b)[_0x69d2('0x27')](handleEntityNotFound(_0x230388,null))['then'](function(_0x1957da){if(_0x1957da){var _0x74e01f=_0x1957da[_0x69d2('0x29')]({'plain':!![]});_0x74e01f=qs[_0x69d2('0x56')](_0x74e01f,['id',_0x69d2('0x57'),_0x69d2('0x58')]);_0x54af82[_0x69d2('0x4d')]=_[_0x69d2('0x56')](_0x54af82[_0x69d2('0x4d')],['id',_0x69d2('0x57'),_0x69d2('0x58')]);return db[_0x69d2('0x2f')][_0x69d2('0x4c')](_[_0x69d2('0x43')](_0x74e01f,_0x54af82[_0x69d2('0x4d')]),{'include':_0x54af82[_0x69d2('0x35')][_0x69d2('0x45')]?[{'all':!![]}]:undefined})[_0x69d2('0x27')](function(_0x12ba41){var _0x1d3cc1=_0x54af82[_0x69d2('0x50')]['get']({'plain':!![]});if(!_0x1d3cc1)throw new Error(_0x69d2('0x4e'));if(_0x1d3cc1[_0x69d2('0x4f')]===_0x69d2('0x50')){var _0x2938e1=_0x12ba41[_0x69d2('0x29')]({'plain':!![]});var _0x5de2a7=_0x69d2('0x2a');return db[_0x69d2('0x51')][_0x69d2('0x4a')]({'where':{'name':_0x5de2a7,'userProfileId':_0x1d3cc1[_0x69d2('0x52')]},'raw':!![]})[_0x69d2('0x27')](function(_0x46599b){if(_0x46599b&&_0x46599b[_0x69d2('0x53')]===0x0){return db['UserProfileResource'][_0x69d2('0x4c')]({'name':_0x2938e1[_0x69d2('0x2d')],'resourceId':_0x2938e1['id'],'type':_0x46599b[_0x69d2('0x2d')],'sectionId':_0x46599b['id']},{})[_0x69d2('0x27')](function(){return _0x12ba41;});}else{return _0x12ba41;}})[_0x69d2('0x4b')](function(_0x51c226){logger[_0x69d2('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x51c226);throw _0x51c226;});}return _0x12ba41;});}})[_0x69d2('0x27')](respondWithResult(_0x230388,0xc9))[_0x69d2('0x4b')](handleError(_0x230388,null));};exports[_0x69d2('0x26')]=function(_0xeb8f9b,_0x4ecbb3){if(_0xeb8f9b['body']['id']){delete _0xeb8f9b[_0x69d2('0x4d')]['id'];}return db[_0x69d2('0x2f')]['find']({'where':{'id':_0xeb8f9b[_0x69d2('0x47')]['id']}})[_0x69d2('0x27')](handleEntityNotFound(_0x4ecbb3,null))[_0x69d2('0x27')](saveUpdates(_0xeb8f9b['body'],null))[_0x69d2('0x27')](respondWithResult(_0x4ecbb3,null))[_0x69d2('0x4b')](handleError(_0x4ecbb3,null));};exports['destroy']=function(_0x47e48f,_0x524e12){return db[_0x69d2('0x2f')][_0x69d2('0x4a')]({'where':{'id':_0x47e48f[_0x69d2('0x47')]['id']}})[_0x69d2('0x27')](handleEntityNotFound(_0x524e12,null))[_0x69d2('0x27')](removeEntity(_0x524e12,null))[_0x69d2('0x4b')](handleError(_0x524e12,null));};exports[_0x69d2('0x59')]=function(_0x33f213,_0x62ead,_0x115986){var _0x504a42={'raw':!![],'where':{}};var _0x49ce4f={};var _0x575fea={'count':0x0,'rows':[]};return db['Campaign'][_0x69d2('0x5a')]({'where':{'id':_0x33f213[_0x69d2('0x47')]['id']}})[_0x69d2('0x27')](handleEntityNotFound(_0x62ead,null))['then'](function(_0x31ab91){if(_0x31ab91){_0x49ce4f[_0x69d2('0x33')]=_[_0x69d2('0x36')](db[_0x69d2('0x5b')][_0x69d2('0x30')]);_0x49ce4f['query']=_['keys'](_0x33f213[_0x69d2('0x35')]);_0x49ce4f[_0x69d2('0x37')]=_[_0x69d2('0x39')](_0x49ce4f[_0x69d2('0x33')],_0x49ce4f[_0x69d2('0x35')]);_0x504a42[_0x69d2('0x38')]=_[_0x69d2('0x39')](_0x49ce4f[_0x69d2('0x33')],qs[_0x69d2('0x3a')](_0x33f213[_0x69d2('0x35')][_0x69d2('0x3a')]));_0x504a42[_0x69d2('0x38')]=_0x504a42[_0x69d2('0x38')][_0x69d2('0x48')]?_0x504a42[_0x69d2('0x38')]:_0x49ce4f[_0x69d2('0x33')];if(!_0x33f213[_0x69d2('0x35')][_0x69d2('0x3b')](_0x69d2('0x3c'))){_0x504a42[_0x69d2('0x1d')]=qs[_0x69d2('0x1d')](_0x33f213['query'][_0x69d2('0x1d')]);_0x504a42['offset']=qs[_0x69d2('0x20')](_0x33f213[_0x69d2('0x35')][_0x69d2('0x20')]);}_0x504a42[_0x69d2('0x3d')]=qs[_0x69d2('0x3e')](_0x33f213[_0x69d2('0x35')][_0x69d2('0x3e')]);_0x504a42[_0x69d2('0x40')]=qs[_0x69d2('0x37')](_[_0x69d2('0x3f')](_0x33f213['query'],_0x49ce4f['filters']));_0x504a42['where'][_0x69d2('0x5c')]=_0x31ab91['id'];if(_0x33f213['query'][_0x69d2('0x42')]){_0x504a42[_0x69d2('0x40')]=_[_0x69d2('0x43')](_0x504a42[_0x69d2('0x40')],{'$or':_[_0x69d2('0x34')](_0x504a42['attributes'],function(_0x334a8a){var _0x4c6c90={};_0x4c6c90[_0x334a8a]={'$like':'%'+_0x33f213[_0x69d2('0x35')][_0x69d2('0x42')]+'%'};return _0x4c6c90;})});}_0x504a42=_[_0x69d2('0x43')]({},_0x504a42,_0x33f213[_0x69d2('0x44')]);return db[_0x69d2('0x5b')]['count']({'where':_0x504a42[_0x69d2('0x40')]})[_0x69d2('0x27')](function(_0x4f0618){_0x575fea[_0x69d2('0x1f')]=_0x4f0618;if(_0x33f213[_0x69d2('0x35')][_0x69d2('0x45')]){_0x504a42[_0x69d2('0x49')]=[{'all':!![]}];}return db['CmHopper'][_0x69d2('0x5d')](_0x504a42);})[_0x69d2('0x27')](function(_0x36de48){_0x575fea['rows']=_0x36de48;return _0x575fea;});}})[_0x69d2('0x27')](respondWithFilteredResult(_0x62ead,_0x504a42))[_0x69d2('0x4b')](handleError(_0x62ead,null));};exports[_0x69d2('0x5e')]=function(_0x4601e5,_0x2aa92d,_0x3f023f){var _0x2d749f={'raw':!![],'where':{}};var _0x512748={};var _0x51e5b6={'count':0x0,'rows':[]};return db[_0x69d2('0x2f')][_0x69d2('0x5a')]({'where':{'id':_0x4601e5[_0x69d2('0x47')]['id']}})[_0x69d2('0x27')](handleEntityNotFound(_0x2aa92d,null))['then'](function(_0x4a0617){if(_0x4a0617){_0x512748[_0x69d2('0x33')]=_[_0x69d2('0x36')](db['CmHopperHistory'][_0x69d2('0x30')]);_0x512748[_0x69d2('0x35')]=_[_0x69d2('0x36')](_0x4601e5[_0x69d2('0x35')]);_0x512748[_0x69d2('0x37')]=_[_0x69d2('0x39')](_0x512748[_0x69d2('0x33')],_0x512748['query']);_0x2d749f[_0x69d2('0x38')]=_['intersection'](_0x512748[_0x69d2('0x33')],qs[_0x69d2('0x3a')](_0x4601e5['query']['fields']));_0x2d749f[_0x69d2('0x38')]=_0x2d749f[_0x69d2('0x38')][_0x69d2('0x48')]?_0x2d749f[_0x69d2('0x38')]:_0x512748[_0x69d2('0x33')];if(!_0x4601e5['query'][_0x69d2('0x3b')](_0x69d2('0x3c'))){_0x2d749f[_0x69d2('0x1d')]=qs[_0x69d2('0x1d')](_0x4601e5[_0x69d2('0x35')]['limit']);_0x2d749f[_0x69d2('0x20')]=qs[_0x69d2('0x20')](_0x4601e5['query'][_0x69d2('0x20')]);}_0x2d749f[_0x69d2('0x3d')]=qs['sort'](_0x4601e5['query'][_0x69d2('0x3e')]);_0x2d749f[_0x69d2('0x40')]=qs[_0x69d2('0x37')](_['pick'](_0x4601e5[_0x69d2('0x35')],_0x512748[_0x69d2('0x37')]));_0x2d749f[_0x69d2('0x40')][_0x69d2('0x5c')]=_0x4a0617['id'];if(_0x4601e5['query'][_0x69d2('0x42')]){_0x2d749f[_0x69d2('0x40')]=_[_0x69d2('0x43')](_0x2d749f[_0x69d2('0x40')],{'$or':_['map'](_0x2d749f[_0x69d2('0x38')],function(_0x17e2e0){var _0x4e2e63={};_0x4e2e63[_0x17e2e0]={'$like':'%'+_0x4601e5[_0x69d2('0x35')]['filter']+'%'};return _0x4e2e63;})});}_0x2d749f=_['merge']({},_0x2d749f,_0x4601e5['options']);return db['CmHopperHistory'][_0x69d2('0x1f')]({'where':_0x2d749f[_0x69d2('0x40')]})['then'](function(_0x18f008){_0x51e5b6['count']=_0x18f008;if(_0x4601e5['query'][_0x69d2('0x45')]){_0x2d749f[_0x69d2('0x49')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x69d2('0x5d')](_0x2d749f);})['then'](function(_0x51799e){_0x51e5b6['rows']=_0x51799e;return _0x51e5b6;});}})[_0x69d2('0x27')](respondWithFilteredResult(_0x2aa92d,_0x2d749f))['catch'](handleError(_0x2aa92d,null));};exports[_0x69d2('0x5f')]=function(_0x1c6e12,_0x3eed6c,_0x1225e2){var _0x105ac1={'raw':!![],'where':{}};var _0x2c1d53={};var _0x4633ae={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x1c6e12[_0x69d2('0x47')]['id']}})[_0x69d2('0x27')](handleEntityNotFound(_0x3eed6c,null))[_0x69d2('0x27')](function(_0x189036){if(_0x189036){_0x2c1d53[_0x69d2('0x33')]=_[_0x69d2('0x36')](db[_0x69d2('0x60')][_0x69d2('0x30')]);_0x2c1d53['query']=_[_0x69d2('0x36')](_0x1c6e12[_0x69d2('0x35')]);_0x2c1d53['filters']=_['intersection'](_0x2c1d53['model'],_0x2c1d53[_0x69d2('0x35')]);_0x105ac1[_0x69d2('0x38')]=_[_0x69d2('0x39')](_0x2c1d53['model'],qs[_0x69d2('0x3a')](_0x1c6e12[_0x69d2('0x35')][_0x69d2('0x3a')]));_0x105ac1[_0x69d2('0x38')]=_0x105ac1['attributes'][_0x69d2('0x48')]?_0x105ac1[_0x69d2('0x38')]:_0x2c1d53[_0x69d2('0x33')];if(!_0x1c6e12[_0x69d2('0x35')][_0x69d2('0x3b')](_0x69d2('0x3c'))){_0x105ac1[_0x69d2('0x1d')]=qs[_0x69d2('0x1d')](_0x1c6e12['query']['limit']);_0x105ac1[_0x69d2('0x20')]=qs['offset'](_0x1c6e12[_0x69d2('0x35')]['offset']);}_0x105ac1[_0x69d2('0x3d')]=qs[_0x69d2('0x3e')](_0x1c6e12[_0x69d2('0x35')]['sort']);_0x105ac1['where']=qs[_0x69d2('0x37')](_[_0x69d2('0x3f')](_0x1c6e12['query'],_0x2c1d53[_0x69d2('0x37')]));_0x105ac1[_0x69d2('0x40')][_0x69d2('0x5c')]=_0x189036['id'];if(_0x1c6e12['query']['filter']){_0x105ac1[_0x69d2('0x40')]=_[_0x69d2('0x43')](_0x105ac1[_0x69d2('0x40')],{'$or':_[_0x69d2('0x34')](_0x105ac1[_0x69d2('0x38')],function(_0x3b0b8e){var _0x3bfe0e={};_0x3bfe0e[_0x3b0b8e]={'$like':'%'+_0x1c6e12[_0x69d2('0x35')][_0x69d2('0x42')]+'%'};return _0x3bfe0e;})});}_0x105ac1=_[_0x69d2('0x43')]({},_0x105ac1,_0x1c6e12[_0x69d2('0x44')]);return db['CmHopperFinal'][_0x69d2('0x1f')]({'where':_0x105ac1[_0x69d2('0x40')]})[_0x69d2('0x27')](function(_0x3b35bf){_0x4633ae[_0x69d2('0x1f')]=_0x3b35bf;if(_0x1c6e12['query']['includeAll']){_0x105ac1[_0x69d2('0x49')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x69d2('0x5d')](_0x105ac1);})[_0x69d2('0x27')](function(_0x1292d9){_0x4633ae['rows']=_0x1292d9;return _0x4633ae;});}})['then'](respondWithFilteredResult(_0x3eed6c,_0x105ac1))[_0x69d2('0x4b')](handleError(_0x3eed6c,null));};exports[_0x69d2('0x61')]=function(_0x45c534,_0x1ee037,_0x377dcd){var _0x5df7b9={'raw':!![],'where':{}};var _0xfe2b3b={};var _0x1b3b1f={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x45c534[_0x69d2('0x47')]['id']}})[_0x69d2('0x27')](handleEntityNotFound(_0x1ee037,null))[_0x69d2('0x27')](function(_0x34bce9){if(_0x34bce9){_0xfe2b3b['model']=_[_0x69d2('0x36')](db[_0x69d2('0x62')][_0x69d2('0x30')]);_0xfe2b3b[_0x69d2('0x35')]=_[_0x69d2('0x36')](_0x45c534[_0x69d2('0x35')]);_0xfe2b3b[_0x69d2('0x37')]=_['intersection'](_0xfe2b3b[_0x69d2('0x33')],_0xfe2b3b[_0x69d2('0x35')]);_0x5df7b9['attributes']=_[_0x69d2('0x39')](_0xfe2b3b[_0x69d2('0x33')],qs[_0x69d2('0x3a')](_0x45c534[_0x69d2('0x35')][_0x69d2('0x3a')]));_0x5df7b9[_0x69d2('0x38')]=_0x5df7b9[_0x69d2('0x38')]['length']?_0x5df7b9[_0x69d2('0x38')]:_0xfe2b3b[_0x69d2('0x33')];if(!_0x45c534[_0x69d2('0x35')][_0x69d2('0x3b')]('nolimit')){_0x5df7b9['limit']=qs[_0x69d2('0x1d')](_0x45c534[_0x69d2('0x35')][_0x69d2('0x1d')]);_0x5df7b9['offset']=qs[_0x69d2('0x20')](_0x45c534[_0x69d2('0x35')][_0x69d2('0x20')]);}_0x5df7b9[_0x69d2('0x3d')]=qs[_0x69d2('0x3e')](_0x45c534['query'][_0x69d2('0x3e')]);_0x5df7b9['where']=qs[_0x69d2('0x37')](_['pick'](_0x45c534[_0x69d2('0x35')],_0xfe2b3b[_0x69d2('0x37')]));_0x5df7b9['where'][_0x69d2('0x5c')]=_0x34bce9['id'];if(_0x45c534[_0x69d2('0x35')][_0x69d2('0x42')]){_0x5df7b9['where']=_[_0x69d2('0x43')](_0x5df7b9['where'],{'$or':_[_0x69d2('0x34')](_0x5df7b9[_0x69d2('0x38')],function(_0x3a43e4){var _0x3d897f={};_0x3d897f[_0x3a43e4]={'$like':'%'+_0x45c534[_0x69d2('0x35')][_0x69d2('0x42')]+'%'};return _0x3d897f;})});}_0x5df7b9=_[_0x69d2('0x43')]({},_0x5df7b9,_0x45c534[_0x69d2('0x44')]);return db[_0x69d2('0x62')][_0x69d2('0x1f')]({'where':_0x5df7b9['where']})['then'](function(_0x32307b){_0x1b3b1f[_0x69d2('0x1f')]=_0x32307b;if(_0x45c534[_0x69d2('0x35')][_0x69d2('0x45')]){_0x5df7b9[_0x69d2('0x49')]=[{'all':!![]}];}return db[_0x69d2('0x62')][_0x69d2('0x5d')](_0x5df7b9);})[_0x69d2('0x27')](function(_0x10b896){_0x1b3b1f[_0x69d2('0x46')]=_0x10b896;return _0x1b3b1f;});}})['then'](respondWithFilteredResult(_0x1ee037,_0x5df7b9))[_0x69d2('0x4b')](handleError(_0x1ee037,null));};exports[_0x69d2('0x63')]=function(_0x35144d,_0x30f318,_0x4068d3){var _0x19a591={};var _0x44150b={};var _0x213e00;var _0x22f3af;return db[_0x69d2('0x2f')][_0x69d2('0x5a')]({'where':{'id':_0x35144d['params']['id']}})[_0x69d2('0x27')](handleEntityNotFound(_0x30f318,null))[_0x69d2('0x27')](function(_0x58d5e0){if(_0x58d5e0){_0x213e00=_0x58d5e0;_0x44150b[_0x69d2('0x33')]=_[_0x69d2('0x36')](db[_0x69d2('0x64')]['rawAttributes']);_0x44150b[_0x69d2('0x35')]=_[_0x69d2('0x36')](_0x35144d[_0x69d2('0x35')]);_0x44150b[_0x69d2('0x37')]=_[_0x69d2('0x39')](_0x44150b[_0x69d2('0x33')],_0x44150b[_0x69d2('0x35')]);_0x19a591[_0x69d2('0x38')]=_[_0x69d2('0x39')](_0x44150b[_0x69d2('0x33')],qs[_0x69d2('0x3a')](_0x35144d[_0x69d2('0x35')][_0x69d2('0x3a')]));_0x19a591['attributes']=_0x19a591[_0x69d2('0x38')][_0x69d2('0x48')]?_0x19a591[_0x69d2('0x38')]:_0x44150b['model'];_0x19a591[_0x69d2('0x3d')]=qs[_0x69d2('0x3e')](_0x35144d['query']['sort']);_0x19a591[_0x69d2('0x40')]=qs[_0x69d2('0x37')](_['pick'](_0x35144d['query'],_0x44150b[_0x69d2('0x37')]));if(_0x35144d[_0x69d2('0x35')]['filter']){_0x19a591[_0x69d2('0x40')]=_[_0x69d2('0x43')](_0x19a591['where'],{'$or':_[_0x69d2('0x34')](_0x19a591[_0x69d2('0x38')],function(_0x44ea0d){var _0x4b9cb2={};_0x4b9cb2[_0x44ea0d]={'$like':'%'+_0x35144d[_0x69d2('0x35')][_0x69d2('0x42')]+'%'};return _0x4b9cb2;})});}_0x19a591=_[_0x69d2('0x43')]({},_0x19a591,_0x35144d[_0x69d2('0x44')]);return _0x213e00['getLists'](_0x19a591);}})['then'](function(_0x3c8bd7){if(_0x3c8bd7){_0x22f3af=_0x3c8bd7[_0x69d2('0x48')];if(!_0x35144d['query'][_0x69d2('0x3b')](_0x69d2('0x3c'))){_0x19a591['limit']=qs[_0x69d2('0x1d')](_0x35144d['query'][_0x69d2('0x1d')]);_0x19a591[_0x69d2('0x20')]=qs[_0x69d2('0x20')](_0x35144d['query']['offset']);}return _0x213e00[_0x69d2('0x63')](_0x19a591);}})[_0x69d2('0x27')](function(_0x342193){if(_0x342193){return _0x342193?{'count':_0x22f3af,'rows':_0x342193}:null;}})[_0x69d2('0x27')](respondWithResult(_0x30f318,null))[_0x69d2('0x4b')](handleError(_0x30f318,null));};exports[_0x69d2('0x65')]=function(_0x49215b,_0x57201d,_0x4fb049){var _0x28cacb,_0x268d2d;var _0x56ebe4=[];var _0x54c6bb=moment()[_0x69d2('0x66')](_0x69d2('0x67'));return db[_0x69d2('0x2f')]['find']({'where':{'id':_0x49215b[_0x69d2('0x47')]['id']}})['then'](handleEntityNotFound(_0x57201d,null))[_0x69d2('0x27')](function(_0x292d11){if(_0x292d11){_0x268d2d=_0x292d11;return _0x292d11['addLists'](_0x49215b[_0x69d2('0x4d')]['ids'],_[_0x69d2('0x56')](_0x49215b[_0x69d2('0x4d')],['ids','id'])||{});}return null;})[_0x69d2('0x68')](function(_0x4e3a9d){var _0x384cbe;var _0x3c2532;_0x28cacb=_0x4e3a9d||[];var _0x4b2ede=[];if(_0x4e3a9d){for(var _0x4b266a=0x0;_0x4b266a<_0x4e3a9d['length'];_0x4b266a+=0x1){var _0xfd0a13=_0x4e3a9d[_0x4b266a][_0x69d2('0x29')]({'plain':!![]});_0x268d2d['dialCheckDuplicateType']=_0x49215b[_0x69d2('0x4d')][_0x69d2('0x69')]?_0x49215b[_0x69d2('0x4d')][_0x69d2('0x69')]:_0x268d2d[_0x69d2('0x69')];switch(_0x268d2d[_0x69d2('0x69')]){case _0x69d2('0x6a'):_0x384cbe=squel['insert']()['into']('cm_hopper')[_0x69d2('0x6b')](['phone',_0x69d2('0x6c'),_0x69d2('0x6d'),_0x69d2('0x6e'),_0x69d2('0x5c'),_0x69d2('0x57'),_0x69d2('0x58')],squel[_0x69d2('0x6f')]()['field'](_0x69d2('0x70'),_0x69d2('0x70'))['field']('NOW()','scheduledAt')['field']('id',_0x69d2('0x6d'))[_0x69d2('0x71')](_0xfd0a13[_0x69d2('0x72')][_0x69d2('0x73')](),_0x69d2('0x6e'))[_0x69d2('0x71')](_0x49215b[_0x69d2('0x47')]['id'][_0x69d2('0x73')](),_0x69d2('0x5c'))[_0x69d2('0x71')]('\x27'+_0x54c6bb+'\x27',_0x69d2('0x57'))[_0x69d2('0x71')]('\x27'+_0x54c6bb+'\x27',_0x69d2('0x58'))[_0x69d2('0x74')](_0x69d2('0x75'))['where'](_0x69d2('0x76'))[_0x69d2('0x40')](_0x69d2('0x77'),_0xfd0a13[_0x69d2('0x72')][_0x69d2('0x73')]())[_0x69d2('0x40')](_0x69d2('0x78'))[_0x69d2('0x40')](_0x69d2('0x79'),squel[_0x69d2('0x6f')]()[_0x69d2('0x71')]('COALESCE(calleridnum,\x27\x27)')[_0x69d2('0x74')](_0x69d2('0x7a'))[_0x69d2('0x40')](_0x69d2('0x7b'),_0x49215b['params']['id'][_0x69d2('0x73')]()))[_0x69d2('0x40')](_0x69d2('0x79'),squel[_0x69d2('0x6f')]()[_0x69d2('0x71')](_0x69d2('0x7c'))[_0x69d2('0x74')](_0x69d2('0x7d'))['where'](_0x69d2('0x7b'),_0x49215b[_0x69d2('0x47')]['id'][_0x69d2('0x73')]())))[_0x69d2('0x73')]();break;case'onlyIfOpen':_0x384cbe=squel[_0x69d2('0x7e')]()[_0x69d2('0x7f')](_0x69d2('0x7d'))[_0x69d2('0x6b')]([_0x69d2('0x70'),_0x69d2('0x6c'),'ContactId',_0x69d2('0x6e'),_0x69d2('0x5c'),_0x69d2('0x57'),_0x69d2('0x58')],squel[_0x69d2('0x6f')]()['field'](_0x69d2('0x70'),_0x69d2('0x70'))[_0x69d2('0x71')]('NOW()',_0x69d2('0x6c'))[_0x69d2('0x71')]('id',_0x69d2('0x6d'))[_0x69d2('0x71')](_0xfd0a13['CmListId'][_0x69d2('0x73')](),_0x69d2('0x6e'))[_0x69d2('0x71')](_0x49215b[_0x69d2('0x47')]['id'][_0x69d2('0x73')](),_0x69d2('0x5c'))[_0x69d2('0x71')]('\x27'+_0x54c6bb+'\x27',_0x69d2('0x57'))[_0x69d2('0x71')]('\x27'+_0x54c6bb+'\x27',_0x69d2('0x58'))[_0x69d2('0x74')](_0x69d2('0x75'))[_0x69d2('0x40')](_0x69d2('0x76'))['where'](_0x69d2('0x77'),_0xfd0a13[_0x69d2('0x72')]['toString']())[_0x69d2('0x40')](_0x69d2('0x78'))['where'](_0x69d2('0x79'),squel[_0x69d2('0x6f')]()['field'](_0x69d2('0x7c'))['from'](_0x69d2('0x7d'))[_0x69d2('0x40')]('CampaignId\x20=\x20?',_0x49215b[_0x69d2('0x47')]['id'][_0x69d2('0x73')]())))[_0x69d2('0x73')]();break;default:_0x384cbe=squel[_0x69d2('0x7e')]()[_0x69d2('0x7f')]('cm_hopper')['fromQuery'](['phone',_0x69d2('0x6c'),_0x69d2('0x6d'),_0x69d2('0x6e'),'CampaignId',_0x69d2('0x57'),'updatedAt'],squel[_0x69d2('0x6f')]()[_0x69d2('0x71')](_0x69d2('0x70'),_0x69d2('0x70'))[_0x69d2('0x71')](_0x69d2('0x80'),_0x69d2('0x6c'))[_0x69d2('0x71')]('id','ContactId')[_0x69d2('0x71')](_0xfd0a13[_0x69d2('0x72')]['toString'](),_0x69d2('0x6e'))[_0x69d2('0x71')](_0x49215b[_0x69d2('0x47')]['id'][_0x69d2('0x73')](),_0x69d2('0x5c'))['field']('\x27'+_0x54c6bb+'\x27','createdAt')[_0x69d2('0x71')]('\x27'+_0x54c6bb+'\x27',_0x69d2('0x58'))[_0x69d2('0x74')](_0x69d2('0x75'))[_0x69d2('0x40')](_0x69d2('0x76'))['where']('ListId\x20=\x20?',_0xfd0a13[_0x69d2('0x72')]['toString']())[_0x69d2('0x40')](_0x69d2('0x78')))['toString']();}_0x3c2532=squel['insert']()[_0x69d2('0x7f')](_0x69d2('0x81'))[_0x69d2('0x6b')](['cmHopperId','scheduledAt','phone','OrderBy',_0x69d2('0x57'),'updatedAt'],squel['select']()[_0x69d2('0x71')]('h.id','id')[_0x69d2('0x71')](_0x69d2('0x80'),_0x69d2('0x6c'))[_0x69d2('0x71')](_0x69d2('0x82'),_0x69d2('0x70'))[_0x69d2('0x71')](_0x69d2('0x83'),_0x69d2('0x84'))[_0x69d2('0x71')]('\x27'+_0x54c6bb+'\x27',_0x69d2('0x57'))[_0x69d2('0x71')]('\x27'+_0x54c6bb+'\x27',_0x69d2('0x58'))['from'](_0x69d2('0x85'),'ci')[_0x69d2('0x86')](_0x69d2('0x7d'),'h',_0x69d2('0x87'))[_0x69d2('0x40')]('h.ListId\x20=\x20?',_0xfd0a13['CmListId']['toString']())[_0x69d2('0x40')]('h.CampaignId=?',_0x49215b[_0x69d2('0x47')]['id']['toString']())[_0x69d2('0x40')](_0x69d2('0x88'),_0x54c6bb))[_0x69d2('0x73')]();_0x4b2ede['push'](db[_0x69d2('0x89')][_0x69d2('0x35')](_0x384cbe));_0x56ebe4[_0x69d2('0x8a')](db[_0x69d2('0x89')][_0x69d2('0x35')](_0x3c2532));}return BPromise[_0x69d2('0x8b')](_0x4b2ede);}})[_0x69d2('0x27')](function(){return BPromise[_0x69d2('0x8b')](_0x56ebe4);})[_0x69d2('0x27')](function(){return _0x28cacb;})[_0x69d2('0x27')](respondWithResult(_0x57201d,null))[_0x69d2('0x4b')](handleError(_0x57201d,null));};exports['removeLists']=function(_0x1dc638,_0x59874d,_0x89d7d){return db['Campaign'][_0x69d2('0x4a')]({'where':{'id':_0x1dc638[_0x69d2('0x47')]['id']}})[_0x69d2('0x27')](handleEntityNotFound(_0x59874d,null))[_0x69d2('0x27')](function(_0x50bf5a){if(_0x50bf5a){return _0x50bf5a[_0x69d2('0x8c')](_0x1dc638[_0x69d2('0x35')]['ids']);}})[_0x69d2('0x27')](function(_0x455805){if(_0x455805){return db['CmHopper']['destroy']({'where':{'ListId':_0x1dc638[_0x69d2('0x35')]['ids'],'CampaignId':_0x1dc638['params']['id']}})[_0x69d2('0x27')](function(){return _0x455805;});}})[_0x69d2('0x27')](respondWithStatusCode(_0x59874d,null))[_0x69d2('0x4b')](handleError(_0x59874d,null));};exports[_0x69d2('0x8d')]=function(_0x263db7,_0x3f156d,_0x21f682){var _0x4debe2={};var _0x39ee3c={};var _0x1003e0;var _0x14421a;return db[_0x69d2('0x2f')][_0x69d2('0x5a')]({'where':{'id':_0x263db7[_0x69d2('0x47')]['id']}})[_0x69d2('0x27')](handleEntityNotFound(_0x3f156d,null))[_0x69d2('0x27')](function(_0x2f760f){if(_0x2f760f){_0x1003e0=_0x2f760f;_0x39ee3c['model']=_[_0x69d2('0x36')](db[_0x69d2('0x64')][_0x69d2('0x30')]);_0x39ee3c[_0x69d2('0x35')]=_['keys'](_0x263db7[_0x69d2('0x35')]);_0x39ee3c[_0x69d2('0x37')]=_['intersection'](_0x39ee3c[_0x69d2('0x33')],_0x39ee3c[_0x69d2('0x35')]);_0x4debe2[_0x69d2('0x38')]=_[_0x69d2('0x39')](_0x39ee3c[_0x69d2('0x33')],qs[_0x69d2('0x3a')](_0x263db7[_0x69d2('0x35')][_0x69d2('0x3a')]));_0x4debe2['attributes']=_0x4debe2[_0x69d2('0x38')][_0x69d2('0x48')]?_0x4debe2[_0x69d2('0x38')]:_0x39ee3c[_0x69d2('0x33')];_0x4debe2[_0x69d2('0x3d')]=qs[_0x69d2('0x3e')](_0x263db7['query'][_0x69d2('0x3e')]);_0x4debe2['where']=qs['filters'](_['pick'](_0x263db7[_0x69d2('0x35')],_0x39ee3c[_0x69d2('0x37')]));if(_0x263db7[_0x69d2('0x35')][_0x69d2('0x42')]){_0x4debe2['where']=_[_0x69d2('0x43')](_0x4debe2[_0x69d2('0x40')],{'$or':_[_0x69d2('0x34')](_0x4debe2[_0x69d2('0x38')],function(_0x12a4fb){var _0x4d1738={};_0x4d1738[_0x12a4fb]={'$like':'%'+_0x263db7[_0x69d2('0x35')][_0x69d2('0x42')]+'%'};return _0x4d1738;})});}_0x4debe2=_[_0x69d2('0x43')]({},_0x4debe2,_0x263db7[_0x69d2('0x44')]);return _0x1003e0['getBlackLists'](_0x4debe2);}})[_0x69d2('0x27')](function(_0x28f570){if(_0x28f570){_0x14421a=_0x28f570[_0x69d2('0x48')];if(!_0x263db7[_0x69d2('0x35')][_0x69d2('0x3b')](_0x69d2('0x3c'))){_0x4debe2[_0x69d2('0x1d')]=qs[_0x69d2('0x1d')](_0x263db7[_0x69d2('0x35')][_0x69d2('0x1d')]);_0x4debe2[_0x69d2('0x20')]=qs[_0x69d2('0x20')](_0x263db7[_0x69d2('0x35')][_0x69d2('0x20')]);}return _0x1003e0[_0x69d2('0x8d')](_0x4debe2);}})[_0x69d2('0x27')](function(_0x4c4e0d){if(_0x4c4e0d){return _0x4c4e0d?{'count':_0x14421a,'rows':_0x4c4e0d}:null;}})['then'](respondWithResult(_0x3f156d,null))[_0x69d2('0x4b')](handleError(_0x3f156d,null));};exports[_0x69d2('0x8e')]=function(_0x200f41,_0x378176,_0x2a3e1d){var _0x395130,_0x400da2;var _0x12273e=[];var _0x3105ae=moment()[_0x69d2('0x66')](_0x69d2('0x67'));return db[_0x69d2('0x2f')][_0x69d2('0x4a')]({'where':{'id':_0x200f41[_0x69d2('0x47')]['id']}})[_0x69d2('0x27')](handleEntityNotFound(_0x378176,null))[_0x69d2('0x27')](function(_0x3ac3ad){if(_0x3ac3ad){_0x400da2=_0x3ac3ad;return _0x3ac3ad[_0x69d2('0x8e')](_0x200f41[_0x69d2('0x4d')][_0x69d2('0x8f')],_['omit'](_0x200f41['body'],['ids','id'])||{});}return null;})[_0x69d2('0x68')](function(_0x3aa0c4){var _0x2a5f79;var _0x1d1908;_0x395130=_0x3aa0c4||[];var _0x4ec8a7=[];if(_0x3aa0c4){for(var _0xd3bbe6=0x0;_0xd3bbe6<_0x3aa0c4['length'];_0xd3bbe6+=0x1){var _0x309e88=_0x3aa0c4[_0xd3bbe6]['get']({'plain':!![]});_0x2a5f79=squel[_0x69d2('0x7e')]()[_0x69d2('0x7f')](_0x69d2('0x90'))[_0x69d2('0x6b')]([_0x69d2('0x70'),_0x69d2('0x6d'),_0x69d2('0x6e'),'CampaignId',_0x69d2('0x57'),'updatedAt'],squel[_0x69d2('0x6f')]()[_0x69d2('0x71')](_0x69d2('0x70'),_0x69d2('0x70'))['field']('id',_0x69d2('0x6d'))['field'](_0x309e88[_0x69d2('0x72')][_0x69d2('0x73')](),_0x69d2('0x6e'))['field'](_0x200f41['params']['id']['toString'](),_0x69d2('0x5c'))['field'](_0x69d2('0x80'),_0x69d2('0x57'))[_0x69d2('0x71')](_0x69d2('0x80'),'updatedAt')['from']('cm_contacts')[_0x69d2('0x40')](_0x69d2('0x76'))[_0x69d2('0x40')](_0x69d2('0x77'),_0x309e88[_0x69d2('0x72')][_0x69d2('0x73')]())[_0x69d2('0x40')](_0x69d2('0x78')))[_0x69d2('0x73')]();_0x4ec8a7[_0x69d2('0x8a')](db[_0x69d2('0x89')][_0x69d2('0x35')](_0x2a5f79));}return BPromise[_0x69d2('0x8b')](_0x4ec8a7);}})[_0x69d2('0x27')](function(){return _0x395130;})[_0x69d2('0x27')](respondWithResult(_0x378176,null))[_0x69d2('0x4b')](handleError(_0x378176,null));};exports['removeBlackLists']=function(_0xacf402,_0x17ae39,_0x51be91){return db[_0x69d2('0x2f')]['find']({'where':{'id':_0xacf402[_0x69d2('0x47')]['id']}})['then'](handleEntityNotFound(_0x17ae39,null))['then'](function(_0x2b30b3){if(_0x2b30b3){return _0x2b30b3[_0x69d2('0x91')](_0xacf402[_0x69d2('0x35')]['ids']);}})[_0x69d2('0x27')](function(_0x3ae890){if(_0x3ae890){return db[_0x69d2('0x62')][_0x69d2('0x28')]({'where':{'ListId':_0xacf402[_0x69d2('0x35')][_0x69d2('0x8f')],'CampaignId':_0xacf402[_0x69d2('0x47')]['id']}})[_0x69d2('0x27')](function(){return _0x3ae890;});}})['then'](respondWithStatusCode(_0x17ae39,null))[_0x69d2('0x4b')](handleError(_0x17ae39,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index f04a187..86e5d7e 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 _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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 +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0xbf23b4,_0x14c39c){var _0x24dfb2=function(_0x5abaac){while(--_0x5abaac){_0xbf23b4['push'](_0xbf23b4['shift']());}};_0x24dfb2(++_0x14c39c);}(_0x7a54,0x106));var _0x47a5=function(_0x36f724,_0x231b6e){_0x36f724=_0x36f724-0x0;var _0x146537=_0x7a54[_0x36f724];return _0x146537;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index b1fe5c5..fddb991 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 _0x19ea=['where','attributes','limit','include','map','model','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetCampaign','findAll','raw','options'];(function(_0x1e2327,_0x52e463){var _0x33ef71=function(_0x34f7f1){while(--_0x34f7f1){_0x1e2327['push'](_0x1e2327['shift']());}};_0x33ef71(++_0x52e463);}(_0x19ea,0xfe));var _0xa19e=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0x19ea[_0xe66cf2];return _0x2d84e7;};'use strict';var _=require(_0xa19e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa19e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa19e('0x2'));var db=require(_0xa19e('0x3'))['db'];var utils=require(_0xa19e('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xa19e('0x5'));var jayson=require(_0xa19e('0x6'));var client=jayson[_0xa19e('0x7')][_0xa19e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1087e7,_0x30fd4a,_0x336e23){return new BPromise(function(_0x1867cb,_0x44e468){return client[_0xa19e('0x9')](_0x1087e7,_0x336e23)[_0xa19e('0xa')](function(_0x59b907){logger[_0xa19e('0xb')](_0xa19e('0xc'),_0x30fd4a,_0xa19e('0xd'));logger[_0xa19e('0xe')]('Campaign,\x20%s,\x20%s,\x20%s',_0x30fd4a,_0xa19e('0xd'),JSON[_0xa19e('0xf')](_0x59b907));if(_0x59b907[_0xa19e('0x10')]){if(_0x59b907['error'][_0xa19e('0x11')]===0x1f4){logger[_0xa19e('0x10')](_0xa19e('0xc'),_0x30fd4a,_0x59b907[_0xa19e('0x10')][_0xa19e('0x12')]);return _0x44e468(_0x59b907['error'][_0xa19e('0x12')]);}logger[_0xa19e('0x10')](_0xa19e('0xc'),_0x30fd4a,_0x59b907[_0xa19e('0x10')][_0xa19e('0x12')]);return _0x1867cb(_0x59b907[_0xa19e('0x10')][_0xa19e('0x12')]);}else{logger[_0xa19e('0xb')](_0xa19e('0xc'),_0x30fd4a,_0xa19e('0xd'));_0x1867cb(_0x59b907[_0xa19e('0x13')]['message']);}})[_0xa19e('0x14')](function(_0x34066a){logger[_0xa19e('0x10')](_0xa19e('0xc'),_0x30fd4a,_0x34066a);_0x44e468(_0x34066a);});});}exports[_0xa19e('0x15')]=function(_0x38e398){var _0x1f37c4=this;return new Promise(function(_0x530a75,_0xd3e0ff){return db['Campaign'][_0xa19e('0x16')]({'raw':_0x38e398['options']?_0x38e398['options'][_0xa19e('0x17')]===undefined?!![]:![]:!![],'where':_0x38e398[_0xa19e('0x18')]?_0x38e398['options'][_0xa19e('0x19')]||null:null,'attributes':_0x38e398[_0xa19e('0x18')]?_0x38e398[_0xa19e('0x18')][_0xa19e('0x1a')]||null:null,'limit':_0x38e398['options']?_0x38e398[_0xa19e('0x18')][_0xa19e('0x1b')]||null:null,'include':_0x38e398[_0xa19e('0x18')]?_0x38e398[_0xa19e('0x18')][_0xa19e('0x1c')]?_[_0xa19e('0x1d')](_0x38e398[_0xa19e('0x18')][_0xa19e('0x1c')],function(_0xc16a44){return{'model':db[_0xc16a44['model']],'as':_0xc16a44['as'],'attributes':_0xc16a44[_0xa19e('0x1a')],'include':_0xc16a44[_0xa19e('0x1c')]?_['map'](_0xc16a44[_0xa19e('0x1c')],function(_0x1d3ce6){return{'model':db[_0x1d3ce6['model']],'as':_0x1d3ce6['as'],'attributes':_0x1d3ce6[_0xa19e('0x1a')],'include':_0x1d3ce6[_0xa19e('0x1c')]?_['map'](_0x1d3ce6[_0xa19e('0x1c')],function(_0x10682d){return{'model':db[_0x10682d[_0xa19e('0x1e')]],'as':_0x10682d['as'],'attributes':_0x10682d[_0xa19e('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa19e('0xa')](function(_0x180407){logger[_0xa19e('0xb')](_0xa19e('0x15'),_0x38e398);logger[_0xa19e('0xe')](_0xa19e('0x15'),_0x38e398,JSON[_0xa19e('0xf')](_0x180407));_0x530a75(_0x180407);})[_0xa19e('0x14')](function(_0x1ce643){logger[_0xa19e('0x10')](_0xa19e('0x15'),_0x1ce643[_0xa19e('0x12')],_0x38e398);_0xd3e0ff(_0x1f37c4[_0xa19e('0x10')](0x1f4,_0x1ce643[_0xa19e('0x12')]));});});}; \ No newline at end of file +var _0xecd5=['options','raw','where','limit','map','include','model','attributes','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','GetCampaign','Campaign','findAll'];(function(_0x4f0931,_0x508249){var _0x2d6d8b=function(_0x5514d5){while(--_0x5514d5){_0x4f0931['push'](_0x4f0931['shift']());}};_0x2d6d8b(++_0x508249);}(_0xecd5,0x110));var _0x5ecd=function(_0x24a181,_0x13a535){_0x24a181=_0x24a181-0x0;var _0xce80fe=_0xecd5[_0x24a181];return _0xce80fe;};'use strict';var _=require('lodash');var util=require(_0x5ecd('0x0'));var moment=require(_0x5ecd('0x1'));var BPromise=require(_0x5ecd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5ecd('0x3'));var db=require(_0x5ecd('0x4'))['db'];var utils=require(_0x5ecd('0x5'));var logger=require(_0x5ecd('0x6'))('rpc');var config=require(_0x5ecd('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5ecd('0x8')][_0x5ecd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a1870,_0x42c752,_0x26d951){return new BPromise(function(_0x2cb71b,_0x946412){return client[_0x5ecd('0xa')](_0x4a1870,_0x26d951)[_0x5ecd('0xb')](function(_0x305f1b){logger[_0x5ecd('0xc')](_0x5ecd('0xd'),_0x42c752,_0x5ecd('0xe'));logger[_0x5ecd('0xf')](_0x5ecd('0x10'),_0x42c752,'request\x20sent',JSON[_0x5ecd('0x11')](_0x305f1b));if(_0x305f1b['error']){if(_0x305f1b['error'][_0x5ecd('0x12')]===0x1f4){logger[_0x5ecd('0x13')]('Campaign,\x20%s,\x20%s',_0x42c752,_0x305f1b['error'][_0x5ecd('0x14')]);return _0x946412(_0x305f1b[_0x5ecd('0x13')][_0x5ecd('0x14')]);}logger[_0x5ecd('0x13')]('Campaign,\x20%s,\x20%s',_0x42c752,_0x305f1b[_0x5ecd('0x13')][_0x5ecd('0x14')]);return _0x2cb71b(_0x305f1b['error'][_0x5ecd('0x14')]);}else{logger[_0x5ecd('0xc')]('Campaign,\x20%s,\x20%s',_0x42c752,_0x5ecd('0xe'));_0x2cb71b(_0x305f1b['result'][_0x5ecd('0x14')]);}})[_0x5ecd('0x15')](function(_0x1e8e64){logger[_0x5ecd('0x13')](_0x5ecd('0xd'),_0x42c752,_0x1e8e64);_0x946412(_0x1e8e64);});});}exports[_0x5ecd('0x16')]=function(_0x231da2){var _0x189c3b=this;return new Promise(function(_0x3078ea,_0x1f7309){return db[_0x5ecd('0x17')][_0x5ecd('0x18')]({'raw':_0x231da2['options']?_0x231da2[_0x5ecd('0x19')][_0x5ecd('0x1a')]===undefined?!![]:![]:!![],'where':_0x231da2[_0x5ecd('0x19')]?_0x231da2[_0x5ecd('0x19')][_0x5ecd('0x1b')]||null:null,'attributes':_0x231da2['options']?_0x231da2[_0x5ecd('0x19')]['attributes']||null:null,'limit':_0x231da2[_0x5ecd('0x19')]?_0x231da2[_0x5ecd('0x19')][_0x5ecd('0x1c')]||null:null,'include':_0x231da2[_0x5ecd('0x19')]?_0x231da2[_0x5ecd('0x19')]['include']?_[_0x5ecd('0x1d')](_0x231da2[_0x5ecd('0x19')][_0x5ecd('0x1e')],function(_0x57168b){return{'model':db[_0x57168b[_0x5ecd('0x1f')]],'as':_0x57168b['as'],'attributes':_0x57168b[_0x5ecd('0x20')],'include':_0x57168b[_0x5ecd('0x1e')]?_[_0x5ecd('0x1d')](_0x57168b[_0x5ecd('0x1e')],function(_0x20f134){return{'model':db[_0x20f134[_0x5ecd('0x1f')]],'as':_0x20f134['as'],'attributes':_0x20f134[_0x5ecd('0x20')],'include':_0x20f134['include']?_[_0x5ecd('0x1d')](_0x20f134['include'],function(_0x12a109){return{'model':db[_0x12a109[_0x5ecd('0x1f')]],'as':_0x12a109['as'],'attributes':_0x12a109[_0x5ecd('0x20')]};}):[]};}):[]};}):[]:[]})[_0x5ecd('0xb')](function(_0x1729c2){logger['info'](_0x5ecd('0x16'),_0x231da2);logger[_0x5ecd('0xf')](_0x5ecd('0x16'),_0x231da2,JSON[_0x5ecd('0x11')](_0x1729c2));_0x3078ea(_0x1729c2);})[_0x5ecd('0x15')](function(_0x1c3eb8){logger[_0x5ecd('0x13')](_0x5ecd('0x16'),_0x1c3eb8[_0x5ecd('0x14')],_0x231da2);_0x1f7309(_0x189c3b[_0x5ecd('0x13')](0x1f4,_0x1c3eb8[_0x5ecd('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 88fed46..33627e2 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 _0x0d4e=['/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addLists','put','/:id','update','delete','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','isAuthenticated','index','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists'];(function(_0x413ab5,_0x25fe01){var _0x482c24=function(_0x11c1e1){while(--_0x11c1e1){_0x413ab5['push'](_0x413ab5['shift']());}};_0x482c24(++_0x25fe01);}(_0x0d4e,0x1ca));var _0xe0d4=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x0d4e[_0x27af45];return _0x18df21;};'use strict';var multer=require(_0xe0d4('0x0'));var util=require(_0xe0d4('0x1'));var path=require(_0xe0d4('0x2'));var timeout=require(_0xe0d4('0x3'));var express=require(_0xe0d4('0x4'));var router=express[_0xe0d4('0x5')]();var fs_extra=require(_0xe0d4('0x6'));var auth=require(_0xe0d4('0x7'));var interaction=require(_0xe0d4('0x8'));var config=require('../../config/environment');var controller=require(_0xe0d4('0x9'));router[_0xe0d4('0xa')]('/',auth[_0xe0d4('0xb')](),controller[_0xe0d4('0xc')]);router['get']('/:id',auth[_0xe0d4('0xb')](),controller[_0xe0d4('0xd')]);router[_0xe0d4('0xa')](_0xe0d4('0xe'),auth[_0xe0d4('0xb')](),controller[_0xe0d4('0xf')]);router[_0xe0d4('0xa')](_0xe0d4('0x10'),auth[_0xe0d4('0xb')](),controller[_0xe0d4('0x11')]);router[_0xe0d4('0xa')](_0xe0d4('0x12'),auth[_0xe0d4('0xb')](),controller['getHopperFinals']);router[_0xe0d4('0xa')](_0xe0d4('0x13'),auth[_0xe0d4('0xb')](),controller[_0xe0d4('0x14')]);router[_0xe0d4('0xa')](_0xe0d4('0x15'),auth[_0xe0d4('0xb')](),controller[_0xe0d4('0x16')]);router[_0xe0d4('0xa')](_0xe0d4('0x17'),auth[_0xe0d4('0xb')](),controller[_0xe0d4('0x18')]);router[_0xe0d4('0x19')]('/',auth[_0xe0d4('0xb')](),controller[_0xe0d4('0x1a')]);router['post'](_0xe0d4('0x1b'),auth[_0xe0d4('0xb')](),controller[_0xe0d4('0x1c')]);router['post']('/:id/lists',auth[_0xe0d4('0xb')](),controller[_0xe0d4('0x1d')]);router[_0xe0d4('0x19')](_0xe0d4('0x17'),auth[_0xe0d4('0xb')](),controller['addBlackLists']);router[_0xe0d4('0x1e')](_0xe0d4('0x1f'),auth[_0xe0d4('0xb')](),controller[_0xe0d4('0x20')]);router[_0xe0d4('0x21')]('/:id',auth[_0xe0d4('0xb')](),controller['destroy']);router['delete'](_0xe0d4('0x15'),auth[_0xe0d4('0xb')](),controller[_0xe0d4('0x22')]);router['delete'](_0xe0d4('0x17'),auth[_0xe0d4('0xb')](),controller[_0xe0d4('0x23')]);module[_0xe0d4('0x24')]=router; \ No newline at end of file +var _0x083e=['multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','index','/:id','isAuthenticated','show','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/lists','getLists','getBlackLists','post','create','/:id/blacklists','addBlackLists','put','update','delete','destroy','removeLists','removeBlackLists'];(function(_0x4e82ff,_0x3cbf4b){var _0x495205=function(_0x21bc88){while(--_0x21bc88){_0x4e82ff['push'](_0x4e82ff['shift']());}};_0x495205(++_0x3cbf4b);}(_0x083e,0x140));var _0xe083=function(_0x2da45d,_0x35397b){_0x2da45d=_0x2da45d-0x0;var _0x1012a0=_0x083e[_0x2da45d];return _0x1012a0;};'use strict';var multer=require(_0xe083('0x0'));var util=require(_0xe083('0x1'));var path=require('path');var timeout=require(_0xe083('0x2'));var express=require('express');var router=express[_0xe083('0x3')]();var fs_extra=require(_0xe083('0x4'));var auth=require(_0xe083('0x5'));var interaction=require(_0xe083('0x6'));var config=require(_0xe083('0x7'));var controller=require(_0xe083('0x8'));router[_0xe083('0x9')]('/',auth['isAuthenticated'](),controller[_0xe083('0xa')]);router[_0xe083('0x9')](_0xe083('0xb'),auth[_0xe083('0xc')](),controller[_0xe083('0xd')]);router[_0xe083('0x9')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0xe083('0xe')]);router[_0xe083('0x9')]('/:id/hopper_histories',auth[_0xe083('0xc')](),controller[_0xe083('0xf')]);router[_0xe083('0x9')](_0xe083('0x10'),auth[_0xe083('0xc')](),controller[_0xe083('0x11')]);router[_0xe083('0x9')](_0xe083('0x12'),auth['isAuthenticated'](),controller['getHopperBlacks']);router['get'](_0xe083('0x13'),auth[_0xe083('0xc')](),controller[_0xe083('0x14')]);router[_0xe083('0x9')]('/:id/blacklists',auth[_0xe083('0xc')](),controller[_0xe083('0x15')]);router[_0xe083('0x16')]('/',auth['isAuthenticated'](),controller[_0xe083('0x17')]);router[_0xe083('0x16')]('/:id/clone',auth[_0xe083('0xc')](),controller['clone']);router[_0xe083('0x16')]('/:id/lists',auth[_0xe083('0xc')](),controller['addLists']);router[_0xe083('0x16')](_0xe083('0x18'),auth[_0xe083('0xc')](),controller[_0xe083('0x19')]);router[_0xe083('0x1a')]('/:id',auth[_0xe083('0xc')](),controller[_0xe083('0x1b')]);router[_0xe083('0x1c')](_0xe083('0xb'),auth[_0xe083('0xc')](),controller[_0xe083('0x1d')]);router[_0xe083('0x1c')](_0xe083('0x13'),auth[_0xe083('0xc')](),controller[_0xe083('0x1e')]);router['delete']('/:id/blacklists',auth[_0xe083('0xc')](),controller[_0xe083('0x1f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index f0a826b..7fc57b1 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 _0x65eb=['TEXT','getDataValue','key','sequelize','exports','STRING'];(function(_0x4bc035,_0x46da0a){var _0x588288=function(_0x5d2a40){while(--_0x5d2a40){_0x4bc035['push'](_0x4bc035['shift']());}};_0x588288(++_0x46da0a);}(_0x65eb,0x17d));var _0xb65e=function(_0x105d03,_0x488b95){_0x105d03=_0x105d03-0x0;var _0x2dd889=_0x65eb[_0x105d03];return _0x2dd889;};'use strict';var Sequelize=require(_0xb65e('0x0'));module[_0xb65e('0x1')]={'key':{'type':Sequelize[_0xb65e('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xb65e('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0xb65e('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xb65e('0x4')](_0xb65e('0x5'));}}}; \ No newline at end of file +var _0x52fd=['key','sequelize','exports','STRING','TEXT','getDataValue'];(function(_0x5d52a4,_0x54e8d1){var _0x55dfcd=function(_0x38a301){while(--_0x38a301){_0x5d52a4['push'](_0x5d52a4['shift']());}};_0x55dfcd(++_0x54e8d1);}(_0x52fd,0xa9));var _0xd52f=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x52fd[_0x6cf19c];return _0xce14f3;};'use strict';var Sequelize=require(_0xd52f('0x0'));module[_0xd52f('0x1')]={'key':{'type':Sequelize[_0xd52f('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xd52f('0x3')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xd52f('0x4')](_0xd52f('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 2eef8c9..bf8ed4c 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 _0x7d25=['params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','zip-dir','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','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','limit','count','set','apply','save','update','then','destroy','get','CannedAnswers','UserProfileResource','error','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','length','options','find','body'];(function(_0x80b36e,_0x4d4528){var _0x1eacc5=function(_0x3b032f){while(--_0x3b032f){_0x80b36e['push'](_0x80b36e['shift']());}};_0x1eacc5(++_0x4d4528);}(_0x7d25,0x177));var _0x57d2=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0x7d25[_0x40a825];return _0x273a54;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x57d2('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x57d2('0x1'));var moment=require(_0x57d2('0x2'));var BPromise=require(_0x57d2('0x3'));var Mustache=require(_0x57d2('0x4'));var util=require(_0x57d2('0x5'));var path=require(_0x57d2('0x6'));var sox=require(_0x57d2('0x7'));var csv=require(_0x57d2('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x57d2('0x9'));var _=require(_0x57d2('0xa'));var squel=require(_0x57d2('0xb'));var crypto=require(_0x57d2('0xc'));var jsforce=require(_0x57d2('0xd'));var deskjs=require(_0x57d2('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x57d2('0xf'));var Redis=require(_0x57d2('0x10'));var authService=require(_0x57d2('0x11'));var qs=require(_0x57d2('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x57d2('0x13'));var logger=require('../../config/logger')(_0x57d2('0x14'));var utils=require(_0x57d2('0x15'));var config=require(_0x57d2('0x16'));var licenseUtil=require(_0x57d2('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ac070,_0x4a535d){_0x4a535d=_0x4a535d||0xcc;return function(_0x3f74f2){if(_0x3f74f2){return _0x1ac070[_0x57d2('0x18')](_0x4a535d);}return _0x1ac070['status'](_0x4a535d)[_0x57d2('0x19')]();};}function respondWithResult(_0x60e547,_0x343c40){_0x343c40=_0x343c40||0xc8;return function(_0x2c9bda){if(_0x2c9bda){return _0x60e547[_0x57d2('0x1a')](_0x343c40)['json'](_0x2c9bda);}};}function respondWithFilteredResult(_0xad5a39,_0x27b719){return function(_0xb75974){if(_0xb75974){var _0x5325c=typeof _0x27b719[_0x57d2('0x1b')]==='undefined'&&typeof _0x27b719[_0x57d2('0x1c')]==='undefined';var _0xfb2f45=_0xb75974[_0x57d2('0x1d')];var _0x39c099=_0x5325c?0x0:_0x27b719[_0x57d2('0x1b')];var _0xe8b091=_0x5325c?_0xb75974[_0x57d2('0x1d')]:_0x27b719[_0x57d2('0x1b')]+_0x27b719[_0x57d2('0x1c')];var _0x31a657;if(_0xe8b091>=_0xfb2f45){_0xe8b091=_0xfb2f45;_0x31a657=0xc8;}else{_0x31a657=0xce;}_0xad5a39[_0x57d2('0x1a')](_0x31a657);return _0xad5a39[_0x57d2('0x1e')]('Content-Range',_0x39c099+'-'+_0xe8b091+'/'+_0xfb2f45)['json'](_0xb75974);}return null;};}function patchUpdates(_0x21322d){return function(_0x25d0b3){try{jsonpatch[_0x57d2('0x1f')](_0x25d0b3,_0x21322d,!![]);}catch(_0x12710e){return BPromise['reject'](_0x12710e);}return _0x25d0b3[_0x57d2('0x20')]();};}function saveUpdates(_0x3ee7d1,_0x3ba13b){return function(_0x1dc2c3){if(_0x1dc2c3){return _0x1dc2c3[_0x57d2('0x21')](_0x3ee7d1)[_0x57d2('0x22')](function(_0x49d363){return _0x49d363;});}return null;};}function removeEntity(_0x33a88b,_0x5ea78a){return function(_0x30674f){if(_0x30674f){return _0x30674f[_0x57d2('0x23')]()[_0x57d2('0x22')](function(){var _0x2d7ebf=_0x30674f[_0x57d2('0x24')]({'plain':!![]});var _0x2766c1=_0x57d2('0x25');return db[_0x57d2('0x26')][_0x57d2('0x23')]({'where':{'type':_0x2766c1,'resourceId':_0x2d7ebf['id']}})['then'](function(){return _0x30674f;});})[_0x57d2('0x22')](function(){_0x33a88b[_0x57d2('0x1a')](0xcc)[_0x57d2('0x19')]();});}};}function handleEntityNotFound(_0x3fb40b,_0x5e22ca){return function(_0x533868){if(!_0x533868){_0x3fb40b['sendStatus'](0x194);}return _0x533868;};}function handleError(_0x30fb95,_0x3c9f61){_0x3c9f61=_0x3c9f61||0x1f4;return function(_0x454a10){logger[_0x57d2('0x27')](_0x454a10[_0x57d2('0x28')]);if(_0x454a10[_0x57d2('0x29')]){delete _0x454a10[_0x57d2('0x29')];}_0x30fb95[_0x57d2('0x1a')](_0x3c9f61)[_0x57d2('0x2a')](_0x454a10);};}exports[_0x57d2('0x2b')]=function(_0x5c69fe,_0x48f987){var _0xdd1e3f={},_0x12d23f={},_0x28c3ee={'count':0x0,'rows':[]};var _0x1e56fa=_[_0x57d2('0x2c')](db[_0x57d2('0x2d')][_0x57d2('0x2e')],function(_0x21cdca){return{'name':_0x21cdca[_0x57d2('0x2f')],'type':_0x21cdca[_0x57d2('0x30')][_0x57d2('0x31')]};});_0x12d23f[_0x57d2('0x32')]=_[_0x57d2('0x2c')](_0x1e56fa,'name');_0x12d23f[_0x57d2('0x33')]=_[_0x57d2('0x34')](_0x5c69fe[_0x57d2('0x33')]);_0x12d23f[_0x57d2('0x35')]=_[_0x57d2('0x36')](_0x12d23f[_0x57d2('0x32')],_0x12d23f[_0x57d2('0x33')]);_0xdd1e3f[_0x57d2('0x37')]=_[_0x57d2('0x36')](_0x12d23f[_0x57d2('0x32')],qs['fields'](_0x5c69fe['query'][_0x57d2('0x38')]));_0xdd1e3f['attributes']=_0xdd1e3f[_0x57d2('0x37')]['length']?_0xdd1e3f[_0x57d2('0x37')]:_0x12d23f['model'];if(!_0x5c69fe[_0x57d2('0x33')][_0x57d2('0x39')](_0x57d2('0x3a'))){_0xdd1e3f[_0x57d2('0x1c')]=qs[_0x57d2('0x1c')](_0x5c69fe['query'][_0x57d2('0x1c')]);_0xdd1e3f[_0x57d2('0x1b')]=qs[_0x57d2('0x1b')](_0x5c69fe[_0x57d2('0x33')]['offset']);}_0xdd1e3f[_0x57d2('0x3b')]=qs['sort'](_0x5c69fe[_0x57d2('0x33')][_0x57d2('0x3c')]);_0xdd1e3f[_0x57d2('0x3d')]=qs[_0x57d2('0x35')](_[_0x57d2('0x3e')](_0x5c69fe[_0x57d2('0x33')],_0x12d23f[_0x57d2('0x35')]),_0x1e56fa);if(_0x5c69fe[_0x57d2('0x33')][_0x57d2('0x3f')]){_0xdd1e3f[_0x57d2('0x3d')]=_[_0x57d2('0x40')](_0xdd1e3f[_0x57d2('0x3d')],{'$or':[{'key':{'$like':'%'+_0x5c69fe[_0x57d2('0x33')]['filter']+'%'}},{'value':{'$like':'%'+_0x5c69fe[_0x57d2('0x33')][_0x57d2('0x3f')]+'%'}}]});}_0xdd1e3f=_[_0x57d2('0x40')]({},_0xdd1e3f,_0x5c69fe['options']);var _0x52a35f={'where':_0xdd1e3f['where']};return db[_0x57d2('0x2d')][_0x57d2('0x1d')](_0x52a35f)['then'](function(_0x383e0a){_0x28c3ee[_0x57d2('0x1d')]=_0x383e0a;if(_0x5c69fe['query'][_0x57d2('0x41')]){_0xdd1e3f[_0x57d2('0x42')]=[{'all':!![]}];}return db[_0x57d2('0x2d')][_0x57d2('0x43')](_0xdd1e3f);})[_0x57d2('0x22')](function(_0xdeb288){_0x28c3ee[_0x57d2('0x44')]=_0xdeb288;return _0x28c3ee;})[_0x57d2('0x22')](respondWithFilteredResult(_0x48f987,_0xdd1e3f))[_0x57d2('0x45')](handleError(_0x48f987,null));};exports[_0x57d2('0x46')]=function(_0x4f7ff0,_0x38c46e){var _0x42d618={'raw':!![],'where':{'id':_0x4f7ff0['params']['id']}},_0x50d687={};_0x50d687['model']=_['keys'](db[_0x57d2('0x2d')][_0x57d2('0x2e')]);_0x50d687[_0x57d2('0x33')]=_[_0x57d2('0x34')](_0x4f7ff0[_0x57d2('0x33')]);_0x50d687['filters']=_[_0x57d2('0x36')](_0x50d687[_0x57d2('0x32')],_0x50d687[_0x57d2('0x33')]);_0x42d618[_0x57d2('0x37')]=_['intersection'](_0x50d687['model'],qs[_0x57d2('0x38')](_0x4f7ff0[_0x57d2('0x33')]['fields']));_0x42d618[_0x57d2('0x37')]=_0x42d618[_0x57d2('0x37')][_0x57d2('0x47')]?_0x42d618[_0x57d2('0x37')]:_0x50d687['model'];if(_0x4f7ff0[_0x57d2('0x33')][_0x57d2('0x41')]){_0x42d618[_0x57d2('0x42')]=[{'all':!![]}];}_0x42d618=_[_0x57d2('0x40')]({},_0x42d618,_0x4f7ff0[_0x57d2('0x48')]);return db['CannedAnswer'][_0x57d2('0x49')](_0x42d618)[_0x57d2('0x22')](handleEntityNotFound(_0x38c46e,null))[_0x57d2('0x22')](respondWithResult(_0x38c46e,null))['catch'](handleError(_0x38c46e,null));};exports[_0x57d2('0x21')]=function(_0x1d82f2,_0x166275){if(_0x1d82f2[_0x57d2('0x4a')]['id']){delete _0x1d82f2['body']['id'];}return db[_0x57d2('0x2d')][_0x57d2('0x49')]({'where':{'id':_0x1d82f2[_0x57d2('0x4b')]['id']}})[_0x57d2('0x22')](handleEntityNotFound(_0x166275,null))[_0x57d2('0x22')](saveUpdates(_0x1d82f2['body'],null))[_0x57d2('0x22')](respondWithResult(_0x166275,null))[_0x57d2('0x45')](handleError(_0x166275,null));};exports[_0x57d2('0x23')]=function(_0x493f59,_0x597c11){return db[_0x57d2('0x2d')]['find']({'where':{'id':_0x493f59[_0x57d2('0x4b')]['id']}})[_0x57d2('0x22')](handleEntityNotFound(_0x597c11,null))['then'](removeEntity(_0x597c11,null))[_0x57d2('0x45')](handleError(_0x597c11,null));};exports[_0x57d2('0x4c')]=function(_0x32e6b9,_0xf0f816){var _0x163e37={'key':_0x32e6b9[_0x57d2('0x4a')][_0x57d2('0x31')]};if(_0x32e6b9[_0x57d2('0x4a')]['MailAccountId']){_0x163e37[_0x57d2('0x4d')]=_0x32e6b9[_0x57d2('0x4a')][_0x57d2('0x4d')];}else if(_0x32e6b9[_0x57d2('0x4a')][_0x57d2('0x4e')]){_0x163e37[_0x57d2('0x4e')]=_0x32e6b9['body'][_0x57d2('0x4e')];}else if(_0x32e6b9['body'][_0x57d2('0x4f')]){_0x163e37[_0x57d2('0x4f')]=_0x32e6b9['body'][_0x57d2('0x4f')];}else if(_0x32e6b9[_0x57d2('0x4a')][_0x57d2('0x50')]){_0x163e37[_0x57d2('0x50')]=_0x32e6b9[_0x57d2('0x4a')][_0x57d2('0x50')];}return db[_0x57d2('0x2d')][_0x57d2('0x49')]({'where':_0x163e37})[_0x57d2('0x22')](function(_0x5a9766){if(_0x5a9766){throw new db[(_0x57d2('0x51'))][(_0x57d2('0x52'))](_0x57d2('0x53'));}return db[_0x57d2('0x2d')][_0x57d2('0x4c')](_0x32e6b9[_0x57d2('0x4a')]);})[_0x57d2('0x22')](function(_0x59564f){var _0x5ca95e=_0x32e6b9[_0x57d2('0x54')][_0x57d2('0x24')]({'plain':!![]});if(!_0x5ca95e)throw new Error(_0x57d2('0x55'));if(_0x5ca95e[_0x57d2('0x56')]===_0x57d2('0x54')){var _0x5e9b6a=_0x59564f[_0x57d2('0x24')]({'plain':!![]});return db[_0x57d2('0x57')][_0x57d2('0x49')]({'where':{'name':'CannedAnswers','userProfileId':_0x5ca95e[_0x57d2('0x58')]},'raw':!![]})['then'](function(_0x4eb3f0){if(_0x4eb3f0&&_0x4eb3f0[_0x57d2('0x59')]===0x0){return db[_0x57d2('0x26')][_0x57d2('0x4c')]({'name':_0x5e9b6a[_0x57d2('0x29')],'resourceId':_0x5e9b6a['id'],'type':_0x4eb3f0[_0x57d2('0x29')],'sectionId':_0x4eb3f0['id']},{})['then'](function(){return _0x59564f;});}else{return _0x59564f;}})[_0x57d2('0x45')](function(_0x17dd8f){logger[_0x57d2('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17dd8f);throw _0x17dd8f;});}return _0x59564f;})[_0x57d2('0x22')](respondWithResult(_0xf0f816,0xc9))[_0x57d2('0x45')](handleError(_0xf0f816,null));}; \ No newline at end of file +var _0x6215=['rawAttributes','find','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','get','CannedAnswers','UserProfileResource','end','error','stack','name','send','index','CannedAnswer','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x6215,0xcf));var _0x5621=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6215[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5621('0x0'));var zipdir=require(_0x5621('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5621('0x2'));var moment=require(_0x5621('0x3'));var BPromise=require(_0x5621('0x4'));var Mustache=require('mustache');var util=require(_0x5621('0x5'));var path=require(_0x5621('0x6'));var sox=require('sox');var csv=require(_0x5621('0x7'));var ejs=require(_0x5621('0x8'));var fs=require('fs');var fs_extra=require(_0x5621('0x9'));var _=require(_0x5621('0xa'));var squel=require(_0x5621('0xb'));var crypto=require(_0x5621('0xc'));var jsforce=require(_0x5621('0xd'));var deskjs=require(_0x5621('0xe'));var toCsv=require(_0x5621('0x7'));var querystring=require(_0x5621('0xf'));var Papa=require(_0x5621('0x10'));var Redis=require(_0x5621('0x11'));var authService=require(_0x5621('0x12'));var qs=require(_0x5621('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5621('0x14'));var logger=require('../../config/logger')(_0x5621('0x15'));var utils=require(_0x5621('0x16'));var config=require(_0x5621('0x17'));var licenseUtil=require(_0x5621('0x18'));var db=require(_0x5621('0x19'))['db'];function respondWithStatusCode(_0x565a90,_0x433f03){_0x433f03=_0x433f03||0xcc;return function(_0x579995){if(_0x579995){return _0x565a90[_0x5621('0x1a')](_0x433f03);}return _0x565a90['status'](_0x433f03)['end']();};}function respondWithResult(_0x2b9742,_0x501524){_0x501524=_0x501524||0xc8;return function(_0x2425c1){if(_0x2425c1){return _0x2b9742[_0x5621('0x1b')](_0x501524)[_0x5621('0x1c')](_0x2425c1);}};}function respondWithFilteredResult(_0x43ddd2,_0x43d692){return function(_0x5cf979){if(_0x5cf979){var _0x28fbb0=typeof _0x43d692['offset']===_0x5621('0x1d')&&typeof _0x43d692[_0x5621('0x1e')]===_0x5621('0x1d');var _0x56a726=_0x5cf979['count'];var _0x4873c6=_0x28fbb0?0x0:_0x43d692['offset'];var _0x183918=_0x28fbb0?_0x5cf979[_0x5621('0x1f')]:_0x43d692[_0x5621('0x20')]+_0x43d692[_0x5621('0x1e')];var _0x50b4a6;if(_0x183918>=_0x56a726){_0x183918=_0x56a726;_0x50b4a6=0xc8;}else{_0x50b4a6=0xce;}_0x43ddd2[_0x5621('0x1b')](_0x50b4a6);return _0x43ddd2[_0x5621('0x21')](_0x5621('0x22'),_0x4873c6+'-'+_0x183918+'/'+_0x56a726)[_0x5621('0x1c')](_0x5cf979);}return null;};}function patchUpdates(_0x597eb1){return function(_0xa5f502){try{jsonpatch['apply'](_0xa5f502,_0x597eb1,!![]);}catch(_0x1384a5){return BPromise[_0x5621('0x23')](_0x1384a5);}return _0xa5f502[_0x5621('0x24')]();};}function saveUpdates(_0xd97922,_0x270f27){return function(_0x37d96f){if(_0x37d96f){return _0x37d96f[_0x5621('0x25')](_0xd97922)[_0x5621('0x26')](function(_0x38c2a8){return _0x38c2a8;});}return null;};}function removeEntity(_0x4ec41e,_0x5dabad){return function(_0x1c33a9){if(_0x1c33a9){return _0x1c33a9[_0x5621('0x27')]()['then'](function(){var _0x447a74=_0x1c33a9[_0x5621('0x28')]({'plain':!![]});var _0x47fa54=_0x5621('0x29');return db[_0x5621('0x2a')][_0x5621('0x27')]({'where':{'type':_0x47fa54,'resourceId':_0x447a74['id']}})[_0x5621('0x26')](function(){return _0x1c33a9;});})[_0x5621('0x26')](function(){_0x4ec41e[_0x5621('0x1b')](0xcc)[_0x5621('0x2b')]();});}};}function handleEntityNotFound(_0x59d009,_0x31cd4a){return function(_0xc00f4d){if(!_0xc00f4d){_0x59d009['sendStatus'](0x194);}return _0xc00f4d;};}function handleError(_0x552a0e,_0x1b44d7){_0x1b44d7=_0x1b44d7||0x1f4;return function(_0x2adab7){logger[_0x5621('0x2c')](_0x2adab7[_0x5621('0x2d')]);if(_0x2adab7[_0x5621('0x2e')]){delete _0x2adab7['name'];}_0x552a0e[_0x5621('0x1b')](_0x1b44d7)[_0x5621('0x2f')](_0x2adab7);};}exports[_0x5621('0x30')]=function(_0x1e561f,_0x591736){var _0xa8dfd6={},_0x425ac5={},_0x4e6359={'count':0x0,'rows':[]};var _0x5c7f58=_['map'](db[_0x5621('0x31')]['rawAttributes'],function(_0x156214){return{'name':_0x156214[_0x5621('0x32')],'type':_0x156214['type'][_0x5621('0x33')]};});_0x425ac5[_0x5621('0x34')]=_[_0x5621('0x35')](_0x5c7f58,_0x5621('0x2e'));_0x425ac5['query']=_[_0x5621('0x36')](_0x1e561f[_0x5621('0x37')]);_0x425ac5[_0x5621('0x38')]=_[_0x5621('0x39')](_0x425ac5[_0x5621('0x34')],_0x425ac5['query']);_0xa8dfd6[_0x5621('0x3a')]=_[_0x5621('0x39')](_0x425ac5['model'],qs[_0x5621('0x3b')](_0x1e561f[_0x5621('0x37')][_0x5621('0x3b')]));_0xa8dfd6[_0x5621('0x3a')]=_0xa8dfd6[_0x5621('0x3a')][_0x5621('0x3c')]?_0xa8dfd6[_0x5621('0x3a')]:_0x425ac5[_0x5621('0x34')];if(!_0x1e561f[_0x5621('0x37')][_0x5621('0x3d')](_0x5621('0x3e'))){_0xa8dfd6[_0x5621('0x1e')]=qs[_0x5621('0x1e')](_0x1e561f['query'][_0x5621('0x1e')]);_0xa8dfd6['offset']=qs[_0x5621('0x20')](_0x1e561f[_0x5621('0x37')][_0x5621('0x20')]);}_0xa8dfd6[_0x5621('0x3f')]=qs['sort'](_0x1e561f[_0x5621('0x37')][_0x5621('0x40')]);_0xa8dfd6[_0x5621('0x41')]=qs[_0x5621('0x38')](_['pick'](_0x1e561f['query'],_0x425ac5['filters']),_0x5c7f58);if(_0x1e561f[_0x5621('0x37')][_0x5621('0x42')]){_0xa8dfd6[_0x5621('0x41')]=_['merge'](_0xa8dfd6['where'],{'$or':[{'key':{'$like':'%'+_0x1e561f[_0x5621('0x37')][_0x5621('0x42')]+'%'}},{'value':{'$like':'%'+_0x1e561f[_0x5621('0x37')][_0x5621('0x42')]+'%'}}]});}_0xa8dfd6=_[_0x5621('0x43')]({},_0xa8dfd6,_0x1e561f[_0x5621('0x44')]);var _0x2462f1={'where':_0xa8dfd6['where']};return db['CannedAnswer'][_0x5621('0x1f')](_0x2462f1)[_0x5621('0x26')](function(_0x2f8879){_0x4e6359['count']=_0x2f8879;if(_0x1e561f[_0x5621('0x37')][_0x5621('0x45')]){_0xa8dfd6[_0x5621('0x46')]=[{'all':!![]}];}return db[_0x5621('0x31')][_0x5621('0x47')](_0xa8dfd6);})['then'](function(_0x445f44){_0x4e6359[_0x5621('0x48')]=_0x445f44;return _0x4e6359;})[_0x5621('0x26')](respondWithFilteredResult(_0x591736,_0xa8dfd6))[_0x5621('0x49')](handleError(_0x591736,null));};exports[_0x5621('0x4a')]=function(_0x5cfcf5,_0x2f2fce){var _0x4205b6={'raw':!![],'where':{'id':_0x5cfcf5['params']['id']}},_0x5de99c={};_0x5de99c[_0x5621('0x34')]=_[_0x5621('0x36')](db[_0x5621('0x31')][_0x5621('0x4b')]);_0x5de99c['query']=_['keys'](_0x5cfcf5['query']);_0x5de99c[_0x5621('0x38')]=_[_0x5621('0x39')](_0x5de99c[_0x5621('0x34')],_0x5de99c[_0x5621('0x37')]);_0x4205b6[_0x5621('0x3a')]=_[_0x5621('0x39')](_0x5de99c[_0x5621('0x34')],qs[_0x5621('0x3b')](_0x5cfcf5['query'][_0x5621('0x3b')]));_0x4205b6[_0x5621('0x3a')]=_0x4205b6['attributes'][_0x5621('0x3c')]?_0x4205b6['attributes']:_0x5de99c[_0x5621('0x34')];if(_0x5cfcf5[_0x5621('0x37')]['includeAll']){_0x4205b6[_0x5621('0x46')]=[{'all':!![]}];}_0x4205b6=_['merge']({},_0x4205b6,_0x5cfcf5[_0x5621('0x44')]);return db[_0x5621('0x31')][_0x5621('0x4c')](_0x4205b6)[_0x5621('0x26')](handleEntityNotFound(_0x2f2fce,null))[_0x5621('0x26')](respondWithResult(_0x2f2fce,null))[_0x5621('0x49')](handleError(_0x2f2fce,null));};exports['update']=function(_0x2ab23c,_0x4199d3){if(_0x2ab23c[_0x5621('0x4d')]['id']){delete _0x2ab23c['body']['id'];}return db['CannedAnswer'][_0x5621('0x4c')]({'where':{'id':_0x2ab23c[_0x5621('0x4e')]['id']}})[_0x5621('0x26')](handleEntityNotFound(_0x4199d3,null))[_0x5621('0x26')](saveUpdates(_0x2ab23c[_0x5621('0x4d')],null))['then'](respondWithResult(_0x4199d3,null))[_0x5621('0x49')](handleError(_0x4199d3,null));};exports[_0x5621('0x27')]=function(_0x4ab046,_0x1370df){return db[_0x5621('0x31')][_0x5621('0x4c')]({'where':{'id':_0x4ab046['params']['id']}})[_0x5621('0x26')](handleEntityNotFound(_0x1370df,null))[_0x5621('0x26')](removeEntity(_0x1370df,null))['catch'](handleError(_0x1370df,null));};exports[_0x5621('0x4f')]=function(_0x556b96,_0x2e6dab){var _0x54223c={'key':_0x556b96['body']['key']};if(_0x556b96[_0x5621('0x4d')][_0x5621('0x50')]){_0x54223c[_0x5621('0x50')]=_0x556b96[_0x5621('0x4d')][_0x5621('0x50')];}else if(_0x556b96[_0x5621('0x4d')]['SmsAccountId']){_0x54223c[_0x5621('0x51')]=_0x556b96[_0x5621('0x4d')][_0x5621('0x51')];}else if(_0x556b96[_0x5621('0x4d')][_0x5621('0x52')]){_0x54223c[_0x5621('0x52')]=_0x556b96['body'][_0x5621('0x52')];}else if(_0x556b96['body'][_0x5621('0x53')]){_0x54223c['ChatWebsiteId']=_0x556b96[_0x5621('0x4d')][_0x5621('0x53')];}return db['CannedAnswer'][_0x5621('0x4c')]({'where':_0x54223c})[_0x5621('0x26')](function(_0x920fea){if(_0x920fea){throw new db[(_0x5621('0x54'))][(_0x5621('0x55'))](_0x5621('0x56'));}return db[_0x5621('0x31')][_0x5621('0x4f')](_0x556b96[_0x5621('0x4d')]);})['then'](function(_0x9467b1){var _0x238203=_0x556b96['user'][_0x5621('0x28')]({'plain':!![]});if(!_0x238203)throw new Error(_0x5621('0x57'));if(_0x238203[_0x5621('0x58')]===_0x5621('0x59')){var _0x17baaf=_0x9467b1[_0x5621('0x28')]({'plain':!![]});return db[_0x5621('0x5a')]['find']({'where':{'name':_0x5621('0x29'),'userProfileId':_0x238203[_0x5621('0x5b')]},'raw':!![]})[_0x5621('0x26')](function(_0x1e6261){if(_0x1e6261&&_0x1e6261[_0x5621('0x5c')]===0x0){return db['UserProfileResource'][_0x5621('0x4f')]({'name':_0x17baaf[_0x5621('0x2e')],'resourceId':_0x17baaf['id'],'type':_0x1e6261[_0x5621('0x2e')],'sectionId':_0x1e6261['id']},{})[_0x5621('0x26')](function(){return _0x9467b1;});}else{return _0x9467b1;}})[_0x5621('0x49')](function(_0x4551f8){logger['error'](_0x5621('0x5d'),_0x4551f8);throw _0x4551f8;});}return _0x9467b1;})[_0x5621('0x26')](respondWithResult(_0x2e6dab,0xc9))[_0x5621('0x49')](handleError(_0x2e6dab,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 6831e28..38758fe 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 _0xfa70=['define','CannedAnswer','tools_canned_answers','utf8mb4_unicode_ci','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xfa70,0x156));var _0x0fa7=function(_0x330f00,_0x2208d8){_0x330f00=_0x330f00-0x0;var _0x3c79d8=_0xfa70[_0x330f00];return _0x3c79d8;};'use strict';var _=require(_0x0fa7('0x0'));var util=require(_0x0fa7('0x1'));var logger=require(_0x0fa7('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0fa7('0x3'));var fs=require('fs');var path=require(_0x0fa7('0x4'));var rimraf=require(_0x0fa7('0x5'));var config=require(_0x0fa7('0x6'));var attributes=require(_0x0fa7('0x7'));module[_0x0fa7('0x8')]=function(_0x24ee39,_0x46ef20){return _0x24ee39[_0x0fa7('0x9')](_0x0fa7('0xa'),attributes,{'tableName':_0x0fa7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0fa7('0xc')});}; \ No newline at end of file +var _0x0be6=['request-promise','rimraf','../../config/environment','exports','tools_canned_answers','utf8mb4','../../config/logger','api','moment'];(function(_0x3d7fc1,_0x12f61d){var _0x58c4f9=function(_0x250b01){while(--_0x250b01){_0x3d7fc1['push'](_0x3d7fc1['shift']());}};_0x58c4f9(++_0x12f61d);}(_0x0be6,0xa8));var _0x60be=function(_0x5f2d01,_0x146735){_0x5f2d01=_0x5f2d01-0x0;var _0x32b232=_0x0be6[_0x5f2d01];return _0x32b232;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x60be('0x0'))(_0x60be('0x1'));var moment=require(_0x60be('0x2'));var BPromise=require('bluebird');var rp=require(_0x60be('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x60be('0x4'));var config=require(_0x60be('0x5'));var attributes=require('./cannedAnswer.attributes');module[_0x60be('0x6')]=function(_0x3c717e,_0x1a53c9){return _0x3c717e['define']('CannedAnswer',attributes,{'tableName':_0x60be('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x60be('0x8'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 1a6527e..e234bff 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(_0x5f472e,_0x563808){var _0x4adebc=function(_0x54edad){while(--_0x54edad){_0x5f472e['push'](_0x5f472e['shift']());}};_0x4adebc(++_0x563808);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ 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(_0x20d398,_0x1845cb){var _0x26e881=function(_0xc6cda8){while(--_0xc6cda8){_0x20d398['push'](_0x20d398['shift']());}};_0x26e881(++_0x1845cb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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 335aa52..9d4f887 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 _0xbfd6=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./cannedAnswer.controller','isAuthenticated','index','/:id','show','post','put','update'];(function(_0x2047eb,_0x563c6b){var _0x4a2123=function(_0x11142d){while(--_0x11142d){_0x2047eb['push'](_0x2047eb['shift']());}};_0x4a2123(++_0x563c6b);}(_0xbfd6,0x16b));var _0x6bfd=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xbfd6[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x6bfd('0x0'));var util=require(_0x6bfd('0x1'));var path=require(_0x6bfd('0x2'));var timeout=require(_0x6bfd('0x3'));var express=require(_0x6bfd('0x4'));var router=express[_0x6bfd('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6bfd('0x6'));var config=require('../../config/environment');var controller=require(_0x6bfd('0x7'));router['get']('/',auth[_0x6bfd('0x8')](),controller[_0x6bfd('0x9')]);router['get'](_0x6bfd('0xa'),auth[_0x6bfd('0x8')](),controller[_0x6bfd('0xb')]);router[_0x6bfd('0xc')]('/',auth[_0x6bfd('0x8')](),controller['create']);router[_0x6bfd('0xd')](_0x6bfd('0xa'),auth[_0x6bfd('0x8')](),controller[_0x6bfd('0xe')]);router[_0x6bfd('0xf')](_0x6bfd('0xa'),auth[_0x6bfd('0x8')](),controller[_0x6bfd('0x10')]);module[_0x6bfd('0x11')]=router; \ No newline at end of file +var _0x0fa9=['get','index','show','post','put','/:id','delete','isAuthenticated','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./cannedAnswer.controller'];(function(_0x144728,_0x11b05b){var _0x54cde2=function(_0x532b8b){while(--_0x532b8b){_0x144728['push'](_0x144728['shift']());}};_0x54cde2(++_0x11b05b);}(_0x0fa9,0x1a8));var _0x90fa=function(_0xcb5360,_0x5efb60){_0xcb5360=_0xcb5360-0x0;var _0x37d0d4=_0x0fa9[_0xcb5360];return _0x37d0d4;};'use strict';var multer=require(_0x90fa('0x0'));var util=require(_0x90fa('0x1'));var path=require(_0x90fa('0x2'));var timeout=require('connect-timeout');var express=require(_0x90fa('0x3'));var router=express['Router']();var fs_extra=require(_0x90fa('0x4'));var auth=require(_0x90fa('0x5'));var interaction=require(_0x90fa('0x6'));var config=require('../../config/environment');var controller=require(_0x90fa('0x7'));router[_0x90fa('0x8')]('/',auth['isAuthenticated'](),controller[_0x90fa('0x9')]);router[_0x90fa('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x90fa('0xa')]);router[_0x90fa('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x90fa('0xc')](_0x90fa('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x90fa('0xe')](_0x90fa('0xd'),auth[_0x90fa('0xf')](),controller[_0x90fa('0x10')]);module[_0x90fa('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 e037559..9c7e8cd 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 _0x3d15=['DATE','STRING','INTEGER','exports'];(function(_0x502d72,_0x22d8f5){var _0x4cbe7c=function(_0x5ecad5){while(--_0x5ecad5){_0x502d72['push'](_0x502d72['shift']());}};_0x4cbe7c(++_0x22d8f5);}(_0x3d15,0x127));var _0x53d1=function(_0x5b2809,_0x48b226){_0x5b2809=_0x5b2809-0x0;var _0x572dee=_0x3d15[_0x5b2809];return _0x572dee;};'use strict';var Sequelize=require('sequelize');module[_0x53d1('0x0')]={'calldate':{'type':Sequelize[_0x53d1('0x1')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x53d1('0x2')]},'src':{'type':Sequelize[_0x53d1('0x2')]},'dst':{'type':Sequelize[_0x53d1('0x2')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x53d1('0x2')]},'dstchannel':{'type':Sequelize[_0x53d1('0x2')]},'lastapp':{'type':Sequelize[_0x53d1('0x2')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x53d1('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x53d1('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x53d1('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x53d1('0x2')]},'userfield':{'type':Sequelize[_0x53d1('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x53d1('0x2')]},'sequence':{'type':Sequelize[_0x53d1('0x2')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x53d1('0x2')]}}; \ No newline at end of file +var _0xa25d=['STRING','INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01'];(function(_0x3083ef,_0x258404){var _0x4aff52=function(_0x49fb2d){while(--_0x49fb2d){_0x3083ef['push'](_0x3083ef['shift']());}};_0x4aff52(++_0x258404);}(_0xa25d,0x194));var _0xda25=function(_0xd0cd54,_0x613e58){_0xd0cd54=_0xd0cd54-0x0;var _0x5f3f4f=_0xa25d[_0xd0cd54];return _0x5f3f4f;};'use strict';var Sequelize=require(_0xda25('0x0'));module[_0xda25('0x1')]={'calldate':{'type':Sequelize[_0xda25('0x2')],'allowNull':![],'defaultValue':_0xda25('0x3')},'clid':{'type':Sequelize[_0xda25('0x4')]},'src':{'type':Sequelize[_0xda25('0x4')]},'dst':{'type':Sequelize[_0xda25('0x4')]},'dcontext':{'type':Sequelize[_0xda25('0x4')]},'channel':{'type':Sequelize[_0xda25('0x4')]},'dstchannel':{'type':Sequelize[_0xda25('0x4')]},'lastapp':{'type':Sequelize[_0xda25('0x4')]},'lastdata':{'type':Sequelize[_0xda25('0x4')]},'duration':{'type':Sequelize[_0xda25('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xda25('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xda25('0x4')]},'amaflags':{'type':Sequelize[_0xda25('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xda25('0x4')]},'userfield':{'type':Sequelize[_0xda25('0x4')]},'uniqueid':{'type':Sequelize[_0xda25('0x4')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xda25('0x4')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 56151ed..20a25a5 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 _0xe14b=['rimraf','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','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','Cdr','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','body','destroy','describe','eml-format'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xe14b,0x93));var _0xbe14=function(_0x522710,_0x35be54){_0x522710=_0x522710-0x0;var _0x4845b4=_0xe14b[_0x522710];return _0x4845b4;};'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['Cdr'][_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('0x21')]=function(_0x4a1a37,_0x5acf90){if(_0x4a1a37[_0xbe14('0x47')]['id']){delete _0x4a1a37[_0xbe14('0x47')]['id'];}return db[_0xbe14('0x28')][_0xbe14('0x44')]({'where':{'id':_0x4a1a37[_0xbe14('0x43')]['id']}})[_0xbe14('0x22')](handleEntityNotFound(_0x5acf90,null))[_0xbe14('0x22')](saveUpdates(_0x4a1a37['body'],null))[_0xbe14('0x22')](respondWithResult(_0x5acf90,null))[_0xbe14('0x45')](handleError(_0x5acf90,null));};exports[_0xbe14('0x48')]=function(_0x22b1f8,_0x2fc073){return db['Cdr'][_0xbe14('0x44')]({'where':{'id':_0x22b1f8[_0xbe14('0x43')]['id']}})[_0xbe14('0x22')](handleEntityNotFound(_0x2fc073,null))[_0xbe14('0x22')](removeEntity(_0x2fc073,null))[_0xbe14('0x45')](handleError(_0x2fc073,null));};exports[_0xbe14('0x49')]=function(_0x505829,_0x5aeea9){return db[_0xbe14('0x28')][_0xbe14('0x49')]()[_0xbe14('0x22')](respondWithResult(_0x5aeea9,null))['catch'](handleError(_0x5aeea9,null));}; \ No newline at end of file +var _0xbacd=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','Cdr','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x174b89,_0x3b749f){var _0x353e87=function(_0x1fc19c){while(--_0x1fc19c){_0x174b89['push'](_0x174b89['shift']());}};_0x353e87(++_0x3b749f);}(_0xbacd,0x1c5));var _0xdbac=function(_0x1e99f0,_0x32f11b){_0x1e99f0=_0x1e99f0-0x0;var _0x575377=_0xbacd[_0x1e99f0];return _0x575377;};'use strict';var emlformat=require(_0xdbac('0x0'));var rimraf=require(_0xdbac('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdbac('0x2'));var rp=require(_0xdbac('0x3'));var moment=require(_0xdbac('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdbac('0x5'));var util=require(_0xdbac('0x6'));var path=require(_0xdbac('0x7'));var sox=require(_0xdbac('0x8'));var csv=require(_0xdbac('0x9'));var ejs=require(_0xdbac('0xa'));var fs=require('fs');var fs_extra=require(_0xdbac('0xb'));var _=require(_0xdbac('0xc'));var squel=require(_0xdbac('0xd'));var crypto=require(_0xdbac('0xe'));var jsforce=require(_0xdbac('0xf'));var deskjs=require(_0xdbac('0x10'));var toCsv=require(_0xdbac('0x9'));var querystring=require(_0xdbac('0x11'));var Papa=require(_0xdbac('0x12'));var Redis=require('ioredis');var authService=require(_0xdbac('0x13'));var qs=require(_0xdbac('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdbac('0x15'));var logger=require('../../config/logger')(_0xdbac('0x16'));var utils=require(_0xdbac('0x17'));var config=require(_0xdbac('0x18'));var licenseUtil=require(_0xdbac('0x19'));var db=require(_0xdbac('0x1a'))['db'];function respondWithStatusCode(_0x1ebee0,_0xd9ec70){_0xd9ec70=_0xd9ec70||0xcc;return function(_0x2c7f44){if(_0x2c7f44){return _0x1ebee0[_0xdbac('0x1b')](_0xd9ec70);}return _0x1ebee0['status'](_0xd9ec70)[_0xdbac('0x1c')]();};}function respondWithResult(_0x1793b9,_0x1eed36){_0x1eed36=_0x1eed36||0xc8;return function(_0x14ebaa){if(_0x14ebaa){return _0x1793b9[_0xdbac('0x1d')](_0x1eed36)[_0xdbac('0x1e')](_0x14ebaa);}};}function respondWithFilteredResult(_0x94a61,_0x176da6){return function(_0x574e58){if(_0x574e58){var _0x2694ef=typeof _0x176da6[_0xdbac('0x1f')]===_0xdbac('0x20')&&typeof _0x176da6['limit']===_0xdbac('0x20');var _0x36e0de=_0x574e58[_0xdbac('0x21')];var _0x252fc1=_0x2694ef?0x0:_0x176da6[_0xdbac('0x1f')];var _0x1a9690=_0x2694ef?_0x574e58[_0xdbac('0x21')]:_0x176da6[_0xdbac('0x1f')]+_0x176da6[_0xdbac('0x22')];var _0x1301d2;if(_0x1a9690>=_0x36e0de){_0x1a9690=_0x36e0de;_0x1301d2=0xc8;}else{_0x1301d2=0xce;}_0x94a61[_0xdbac('0x1d')](_0x1301d2);return _0x94a61[_0xdbac('0x23')]('Content-Range',_0x252fc1+'-'+_0x1a9690+'/'+_0x36e0de)[_0xdbac('0x1e')](_0x574e58);}return null;};}function patchUpdates(_0x323801){return function(_0x4e4af9){try{jsonpatch[_0xdbac('0x24')](_0x4e4af9,_0x323801,!![]);}catch(_0x582c0b){return BPromise[_0xdbac('0x25')](_0x582c0b);}return _0x4e4af9['save']();};}function saveUpdates(_0x1ead7b,_0x2bcf69){return function(_0x20642c){if(_0x20642c){return _0x20642c[_0xdbac('0x26')](_0x1ead7b)[_0xdbac('0x27')](function(_0x4148fc){return _0x4148fc;});}return null;};}function removeEntity(_0x28393a,_0x4e68b0){return function(_0x361930){if(_0x361930){return _0x361930[_0xdbac('0x28')]()[_0xdbac('0x27')](function(){_0x28393a[_0xdbac('0x1d')](0xcc)[_0xdbac('0x1c')]();});}};}function handleEntityNotFound(_0x2b4cda,_0x3a0f3f){return function(_0x15653d){if(!_0x15653d){_0x2b4cda[_0xdbac('0x1b')](0x194);}return _0x15653d;};}function handleError(_0x175ebc,_0x2cb8b4){_0x2cb8b4=_0x2cb8b4||0x1f4;return function(_0x1ea3c3){logger[_0xdbac('0x29')](_0x1ea3c3[_0xdbac('0x2a')]);if(_0x1ea3c3[_0xdbac('0x2b')]){delete _0x1ea3c3[_0xdbac('0x2b')];}_0x175ebc[_0xdbac('0x1d')](_0x2cb8b4)[_0xdbac('0x2c')](_0x1ea3c3);};}exports[_0xdbac('0x2d')]=function(_0xe744cc,_0x1caa18){var _0x4e7ef9={},_0x446a32={},_0x397f3d={'count':0x0,'rows':[]};var _0x43c0a3=_[_0xdbac('0x2e')](db['Cdr']['rawAttributes'],function(_0x10c3c8){return{'name':_0x10c3c8[_0xdbac('0x2f')],'type':_0x10c3c8[_0xdbac('0x30')][_0xdbac('0x31')]};});_0x446a32['model']=_[_0xdbac('0x2e')](_0x43c0a3,_0xdbac('0x2b'));_0x446a32[_0xdbac('0x32')]=_[_0xdbac('0x33')](_0xe744cc[_0xdbac('0x32')]);_0x446a32[_0xdbac('0x34')]=_[_0xdbac('0x35')](_0x446a32[_0xdbac('0x36')],_0x446a32['query']);_0x4e7ef9['attributes']=_[_0xdbac('0x35')](_0x446a32[_0xdbac('0x36')],qs[_0xdbac('0x37')](_0xe744cc[_0xdbac('0x32')]['fields']));_0x4e7ef9['attributes']=_0x4e7ef9[_0xdbac('0x38')][_0xdbac('0x39')]?_0x4e7ef9[_0xdbac('0x38')]:_0x446a32[_0xdbac('0x36')];if(!_0xe744cc[_0xdbac('0x32')][_0xdbac('0x3a')](_0xdbac('0x3b'))){_0x4e7ef9[_0xdbac('0x22')]=qs[_0xdbac('0x22')](_0xe744cc[_0xdbac('0x32')][_0xdbac('0x22')]);_0x4e7ef9[_0xdbac('0x1f')]=qs[_0xdbac('0x1f')](_0xe744cc['query'][_0xdbac('0x1f')]);}_0x4e7ef9['order']=qs[_0xdbac('0x3c')](_0xe744cc[_0xdbac('0x32')][_0xdbac('0x3c')]);_0x4e7ef9[_0xdbac('0x3d')]=qs['filters'](_[_0xdbac('0x3e')](_0xe744cc[_0xdbac('0x32')],_0x446a32['filters']),_0x43c0a3);if(_0xe744cc['query'][_0xdbac('0x3f')]){_0x4e7ef9['where']=_['merge'](_0x4e7ef9[_0xdbac('0x3d')],{'$or':_[_0xdbac('0x2e')](_0x43c0a3,function(_0x6c5ecc){if(_0x6c5ecc['type']!==_0xdbac('0x40')){var _0x35f8b7={};_0x35f8b7[_0x6c5ecc[_0xdbac('0x2b')]]={'$like':'%'+_0xe744cc[_0xdbac('0x32')]['filter']+'%'};return _0x35f8b7;}})});}_0x4e7ef9=_['merge']({},_0x4e7ef9,_0xe744cc[_0xdbac('0x41')]);var _0x124904={'where':_0x4e7ef9[_0xdbac('0x3d')]};return db[_0xdbac('0x42')][_0xdbac('0x21')](_0x124904)['then'](function(_0x1a27a4){_0x397f3d[_0xdbac('0x21')]=_0x1a27a4;if(_0xe744cc['query'][_0xdbac('0x43')]){_0x4e7ef9[_0xdbac('0x44')]=[{'all':!![]}];}return db[_0xdbac('0x42')][_0xdbac('0x45')](_0x4e7ef9);})[_0xdbac('0x27')](function(_0x575b59){_0x397f3d[_0xdbac('0x46')]=_0x575b59;return _0x397f3d;})[_0xdbac('0x27')](respondWithFilteredResult(_0x1caa18,_0x4e7ef9))[_0xdbac('0x47')](handleError(_0x1caa18,null));};exports[_0xdbac('0x48')]=function(_0x726ba4,_0x25344a){var _0x2589e1={'raw':!![],'where':{'id':_0x726ba4[_0xdbac('0x49')]['id']}},_0x3c1894={};_0x3c1894[_0xdbac('0x36')]=_[_0xdbac('0x33')](db[_0xdbac('0x42')]['rawAttributes']);_0x3c1894['query']=_['keys'](_0x726ba4['query']);_0x3c1894[_0xdbac('0x34')]=_[_0xdbac('0x35')](_0x3c1894[_0xdbac('0x36')],_0x3c1894[_0xdbac('0x32')]);_0x2589e1[_0xdbac('0x38')]=_[_0xdbac('0x35')](_0x3c1894[_0xdbac('0x36')],qs[_0xdbac('0x37')](_0x726ba4[_0xdbac('0x32')]['fields']));_0x2589e1['attributes']=_0x2589e1['attributes'][_0xdbac('0x39')]?_0x2589e1[_0xdbac('0x38')]:_0x3c1894['model'];if(_0x726ba4['query']['includeAll']){_0x2589e1[_0xdbac('0x44')]=[{'all':!![]}];}_0x2589e1=_[_0xdbac('0x4a')]({},_0x2589e1,_0x726ba4[_0xdbac('0x41')]);return db['Cdr'][_0xdbac('0x4b')](_0x2589e1)[_0xdbac('0x27')](handleEntityNotFound(_0x25344a,null))[_0xdbac('0x27')](respondWithResult(_0x25344a,null))[_0xdbac('0x47')](handleError(_0x25344a,null));};exports[_0xdbac('0x4c')]=function(_0x5b8aca,_0x35696f){return db[_0xdbac('0x42')][_0xdbac('0x4c')](_0x5b8aca[_0xdbac('0x4d')],{})['then'](respondWithResult(_0x35696f,0xc9))[_0xdbac('0x47')](handleError(_0x35696f,null));};exports[_0xdbac('0x26')]=function(_0x1463ca,_0x5d6e86){if(_0x1463ca[_0xdbac('0x4d')]['id']){delete _0x1463ca[_0xdbac('0x4d')]['id'];}return db[_0xdbac('0x42')][_0xdbac('0x4b')]({'where':{'id':_0x1463ca[_0xdbac('0x49')]['id']}})[_0xdbac('0x27')](handleEntityNotFound(_0x5d6e86,null))['then'](saveUpdates(_0x1463ca[_0xdbac('0x4d')],null))[_0xdbac('0x27')](respondWithResult(_0x5d6e86,null))['catch'](handleError(_0x5d6e86,null));};exports[_0xdbac('0x28')]=function(_0x12b600,_0x26ee2e){return db[_0xdbac('0x42')]['find']({'where':{'id':_0x12b600['params']['id']}})[_0xdbac('0x27')](handleEntityNotFound(_0x26ee2e,null))[_0xdbac('0x27')](removeEntity(_0x26ee2e,null))['catch'](handleError(_0x26ee2e,null));};exports['describe']=function(_0x3f0b35,_0x538747){return db[_0xdbac('0x42')][_0xdbac('0x4e')]()[_0xdbac('0x27')](respondWithResult(_0x538747,null))['catch'](handleError(_0x538747,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 4249787..1ef2143 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(_0x5b987b,_0x127cbc){var _0xa973b9=function(_0x17a9f4){while(--_0x17a9f4){_0x5b987b['push'](_0x5b987b['shift']());}};_0xa973b9(++_0x127cbc);}(_0x7a54,0x106));var _0x47a5=function(_0x3e049e,_0x3a63b6){_0x3e049e=_0x3e049e-0x0;var _0x59e196=_0x7a54[_0x3e049e];return _0x59e196;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x40369e,_0x1a7a0c){var _0x2945af=function(_0x4f11ef){while(--_0x4f11ef){_0x40369e['push'](_0x40369e['shift']());}};_0x2945af(++_0x1a7a0c);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 6534b6b..cde9931 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 _0x8155=['then','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x48aaca,_0x140945){var _0xac5ed9=function(_0x180b19){while(--_0x180b19){_0x48aaca['push'](_0x48aaca['shift']());}};_0xac5ed9(++_0x140945);}(_0x8155,0x196));var _0x5815=function(_0xd4d59a,_0x524fc0){_0xd4d59a=_0xd4d59a-0x0;var _0x52eacc=_0x8155[_0xd4d59a];return _0x52eacc;};'use strict';var _=require(_0x5815('0x0'));var util=require(_0x5815('0x1'));var moment=require(_0x5815('0x2'));var BPromise=require('bluebird');var rs=require(_0x5815('0x3'));var fs=require('fs');var Redis=require(_0x5815('0x4'));var db=require(_0x5815('0x5'))['db'];var utils=require(_0x5815('0x6'));var logger=require(_0x5815('0x7'))(_0x5815('0x8'));var config=require(_0x5815('0x9'));var jayson=require(_0x5815('0xa'));var client=jayson[_0x5815('0xb')][_0x5815('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x298927,_0x478e67,_0xd3a605){return new BPromise(function(_0x5ece98,_0x417ae5){return client[_0x5815('0xd')](_0x298927,_0xd3a605)[_0x5815('0xe')](function(_0x6ee732){logger['info'](_0x5815('0xf'),_0x478e67,_0x5815('0x10'));logger['debug'](_0x5815('0x11'),_0x478e67,_0x5815('0x10'),JSON['stringify'](_0x6ee732));if(_0x6ee732[_0x5815('0x12')]){if(_0x6ee732['error']['code']===0x1f4){logger[_0x5815('0x12')](_0x5815('0xf'),_0x478e67,_0x6ee732['error'][_0x5815('0x13')]);return _0x417ae5(_0x6ee732[_0x5815('0x12')][_0x5815('0x13')]);}logger[_0x5815('0x12')](_0x5815('0xf'),_0x478e67,_0x6ee732['error'][_0x5815('0x13')]);return _0x5ece98(_0x6ee732['error'][_0x5815('0x13')]);}else{logger['info']('Cdr,\x20%s,\x20%s',_0x478e67,_0x5815('0x10'));_0x5ece98(_0x6ee732['result']['message']);}})[_0x5815('0x14')](function(_0x3ecb7e){logger[_0x5815('0x12')]('Cdr,\x20%s,\x20%s',_0x478e67,_0x3ecb7e);_0x417ae5(_0x3ecb7e);});});} \ No newline at end of file +var _0xc2a7=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5f382f,_0x3f1432){var _0x3bb11b=function(_0x4daf9b){while(--_0x4daf9b){_0x5f382f['push'](_0x5f382f['shift']());}};_0x3bb11b(++_0x3f1432);}(_0xc2a7,0x1aa));var _0x7c2a=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xc2a7[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x7c2a('0x0'));var util=require(_0x7c2a('0x1'));var moment=require('moment');var BPromise=require(_0x7c2a('0x2'));var rs=require(_0x7c2a('0x3'));var fs=require('fs');var Redis=require(_0x7c2a('0x4'));var db=require(_0x7c2a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7c2a('0x6'))(_0x7c2a('0x7'));var config=require(_0x7c2a('0x8'));var jayson=require(_0x7c2a('0x9'));var client=jayson[_0x7c2a('0xa')][_0x7c2a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e2b70,_0x4cc237,_0x2368ca){return new BPromise(function(_0xc444e7,_0x1fae5a){return client[_0x7c2a('0xc')](_0x4e2b70,_0x2368ca)[_0x7c2a('0xd')](function(_0x4c450b){logger[_0x7c2a('0xe')](_0x7c2a('0xf'),_0x4cc237,'request\x20sent');logger[_0x7c2a('0x10')](_0x7c2a('0x11'),_0x4cc237,_0x7c2a('0x12'),JSON['stringify'](_0x4c450b));if(_0x4c450b[_0x7c2a('0x13')]){if(_0x4c450b['error'][_0x7c2a('0x14')]===0x1f4){logger[_0x7c2a('0x13')](_0x7c2a('0xf'),_0x4cc237,_0x4c450b[_0x7c2a('0x13')][_0x7c2a('0x15')]);return _0x1fae5a(_0x4c450b['error'][_0x7c2a('0x15')]);}logger[_0x7c2a('0x13')](_0x7c2a('0xf'),_0x4cc237,_0x4c450b[_0x7c2a('0x13')][_0x7c2a('0x15')]);return _0xc444e7(_0x4c450b['error'][_0x7c2a('0x15')]);}else{logger[_0x7c2a('0xe')]('Cdr,\x20%s,\x20%s',_0x4cc237,_0x7c2a('0x12'));_0xc444e7(_0x4c450b[_0x7c2a('0x16')][_0x7c2a('0x15')]);}})[_0x7c2a('0x17')](function(_0x43a36a){logger[_0x7c2a('0x13')](_0x7c2a('0xf'),_0x4cc237,_0x43a36a);_0x1fae5a(_0x43a36a);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 952dcc2..93e519c 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x1e9424,_0x191cba){var _0x1bd96c=function(_0x5e952d){while(--_0x5e952d){_0x1e9424['push'](_0x1e9424['shift']());}};_0x1bd96c(++_0x191cba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _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(_0x254040,_0x10a23a){var _0xab5fa5=function(_0x18f9fd){while(--_0x18f9fd){_0x254040['push'](_0x254040['shift']());}};_0xab5fa5(++_0x10a23a);}(_0xb10b,0x12a));var _0xbb10=function(_0x5e9b23,_0x3069fd){_0x5e9b23=_0x5e9b23-0x0;var _0x27501f=_0xb10b[_0x5e9b23];return _0x27501f;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 0996ad2..9c062d0 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 _0xa87a=['STRING','*,*,*,*','sequelize','exports','INTEGER','noop','TEXT'];(function(_0x33aeff,_0x5ca889){var _0xa1f400=function(_0x25cf9a){while(--_0x25cf9a){_0x33aeff['push'](_0x33aeff['shift']());}};_0xa1f400(++_0x5ca889);}(_0xa87a,0xfe));var _0xaa87=function(_0x18abd2,_0x22d4b3){_0x18abd2=_0x18abd2-0x0;var _0x1dcad6=_0xa87a[_0x18abd2];return _0x1dcad6;};'use strict';var Sequelize=require(_0xaa87('0x0'));module[_0xaa87('0x1')]={'priority':{'type':Sequelize[_0xaa87('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xaa87('0x3')},'appdata':{'type':Sequelize[_0xaa87('0x4')]()},'description':{'type':Sequelize[_0xaa87('0x5')]},'interval':{'type':Sequelize[_0xaa87('0x5')],'defaultValue':_0xaa87('0x6')}}; \ No newline at end of file +var _0xa0cb=['TEXT','*,*,*,*','exports','INTEGER','STRING'];(function(_0x524e39,_0x5b9fb6){var _0xd0aeb5=function(_0x4e5e08){while(--_0x4e5e08){_0x524e39['push'](_0x524e39['shift']());}};_0xd0aeb5(++_0x5b9fb6);}(_0xa0cb,0x70));var _0xba0c=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xa0cb[_0x2064e5];return _0x21a233;};'use strict';var Sequelize=require('sequelize');module[_0xba0c('0x0')]={'priority':{'type':Sequelize[_0xba0c('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xba0c('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xba0c('0x3')]()},'description':{'type':Sequelize[_0xba0c('0x2')]},'interval':{'type':Sequelize[_0xba0c('0x2')],'defaultValue':_0xba0c('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index f06fea8..0cc14c4 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 _0x4e5c=['merge','options','then','catch','body','eml-format','zip-dir','request-promise','moment','bluebird','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','status','offset','undefined','limit','count','set','save','update','destroy','error','stack','name','send','params','keys','ChatApplication','query','intersection','model','fields','attributes','length','includeAll','include'];(function(_0x3cbd16,_0x452307){var _0x41f5eb=function(_0x3bfe89){while(--_0x3bfe89){_0x3cbd16['push'](_0x3cbd16['shift']());}};_0x41f5eb(++_0x452307);}(_0x4e5c,0x149));var _0xc4e5=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x4e5c[_0x53ccf2];return _0x5a2964;};'use strict';var emlformat=require(_0xc4e5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc4e5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc4e5('0x2'));var moment=require(_0xc4e5('0x3'));var BPromise=require(_0xc4e5('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc4e5('0x5'));var csv=require(_0xc4e5('0x6'));var ejs=require(_0xc4e5('0x7'));var fs=require('fs');var fs_extra=require(_0xc4e5('0x8'));var _=require(_0xc4e5('0x9'));var squel=require(_0xc4e5('0xa'));var crypto=require(_0xc4e5('0xb'));var jsforce=require(_0xc4e5('0xc'));var deskjs=require(_0xc4e5('0xd'));var toCsv=require(_0xc4e5('0x6'));var querystring=require(_0xc4e5('0xe'));var Papa=require(_0xc4e5('0xf'));var Redis=require('ioredis');var authService=require(_0xc4e5('0x10'));var qs=require(_0xc4e5('0x11'));var as=require(_0xc4e5('0x12'));var hardwareService=require(_0xc4e5('0x13'));var logger=require('../../config/logger')(_0xc4e5('0x14'));var utils=require(_0xc4e5('0x15'));var config=require(_0xc4e5('0x16'));var licenseUtil=require(_0xc4e5('0x17'));var db=require(_0xc4e5('0x18'))['db'];function respondWithStatusCode(_0x418b8b,_0x3fa318){_0x3fa318=_0x3fa318||0xcc;return function(_0x54c5a7){if(_0x54c5a7){return _0x418b8b['sendStatus'](_0x3fa318);}return _0x418b8b[_0xc4e5('0x19')](_0x3fa318)['end']();};}function respondWithResult(_0x3f8150,_0x7cd002){_0x7cd002=_0x7cd002||0xc8;return function(_0x303037){if(_0x303037){return _0x3f8150[_0xc4e5('0x19')](_0x7cd002)['json'](_0x303037);}};}function respondWithFilteredResult(_0x1b7d62,_0x528de4){return function(_0x338c37){if(_0x338c37){var _0x3beb59=typeof _0x528de4[_0xc4e5('0x1a')]===_0xc4e5('0x1b')&&typeof _0x528de4[_0xc4e5('0x1c')]===_0xc4e5('0x1b');var _0x228232=_0x338c37[_0xc4e5('0x1d')];var _0x170c0c=_0x3beb59?0x0:_0x528de4['offset'];var _0x252b5a=_0x3beb59?_0x338c37[_0xc4e5('0x1d')]:_0x528de4['offset']+_0x528de4[_0xc4e5('0x1c')];var _0x33eef8;if(_0x252b5a>=_0x228232){_0x252b5a=_0x228232;_0x33eef8=0xc8;}else{_0x33eef8=0xce;}_0x1b7d62['status'](_0x33eef8);return _0x1b7d62[_0xc4e5('0x1e')]('Content-Range',_0x170c0c+'-'+_0x252b5a+'/'+_0x228232)['json'](_0x338c37);}return null;};}function patchUpdates(_0x2f2970){return function(_0x7dbe6d){try{jsonpatch['apply'](_0x7dbe6d,_0x2f2970,!![]);}catch(_0x34f4e8){return BPromise['reject'](_0x34f4e8);}return _0x7dbe6d[_0xc4e5('0x1f')]();};}function saveUpdates(_0x37e869,_0x505078){return function(_0x546949){if(_0x546949){return _0x546949[_0xc4e5('0x20')](_0x37e869)['then'](function(_0x69cb24){return _0x69cb24;});}return null;};}function removeEntity(_0x41467f,_0x4bb973){return function(_0x4ed1ff){if(_0x4ed1ff){return _0x4ed1ff[_0xc4e5('0x21')]()['then'](function(){_0x41467f[_0xc4e5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x460fd8,_0x234b31){return function(_0x53f7cd){if(!_0x53f7cd){_0x460fd8['sendStatus'](0x194);}return _0x53f7cd;};}function handleError(_0x4b379b,_0x23889c){_0x23889c=_0x23889c||0x1f4;return function(_0x183ec7){logger[_0xc4e5('0x22')](_0x183ec7[_0xc4e5('0x23')]);if(_0x183ec7[_0xc4e5('0x24')]){delete _0x183ec7[_0xc4e5('0x24')];}_0x4b379b[_0xc4e5('0x19')](_0x23889c)[_0xc4e5('0x25')](_0x183ec7);};}exports['show']=function(_0x1cd4d9,_0x2ad4be){var _0x261b88={'raw':!![],'where':{'id':_0x1cd4d9[_0xc4e5('0x26')]['id']}},_0x23383b={};_0x23383b['model']=_[_0xc4e5('0x27')](db[_0xc4e5('0x28')]['rawAttributes']);_0x23383b[_0xc4e5('0x29')]=_['keys'](_0x1cd4d9[_0xc4e5('0x29')]);_0x23383b['filters']=_[_0xc4e5('0x2a')](_0x23383b['model'],_0x23383b[_0xc4e5('0x29')]);_0x261b88['attributes']=_['intersection'](_0x23383b[_0xc4e5('0x2b')],qs[_0xc4e5('0x2c')](_0x1cd4d9[_0xc4e5('0x29')][_0xc4e5('0x2c')]));_0x261b88['attributes']=_0x261b88[_0xc4e5('0x2d')][_0xc4e5('0x2e')]?_0x261b88[_0xc4e5('0x2d')]:_0x23383b[_0xc4e5('0x2b')];if(_0x1cd4d9['query'][_0xc4e5('0x2f')]){_0x261b88[_0xc4e5('0x30')]=[{'all':!![]}];}_0x261b88=_[_0xc4e5('0x31')]({},_0x261b88,_0x1cd4d9[_0xc4e5('0x32')]);return db[_0xc4e5('0x28')]['find'](_0x261b88)[_0xc4e5('0x33')](handleEntityNotFound(_0x2ad4be,null))[_0xc4e5('0x33')](respondWithResult(_0x2ad4be,null))[_0xc4e5('0x34')](handleError(_0x2ad4be,null));};exports['update']=function(_0x44551b,_0x1c78ec){if(_0x44551b[_0xc4e5('0x35')]['id']){delete _0x44551b[_0xc4e5('0x35')]['id'];}return db['ChatApplication']['find']({'where':{'id':_0x44551b[_0xc4e5('0x26')]['id']}})[_0xc4e5('0x33')](handleEntityNotFound(_0x1c78ec,null))[_0xc4e5('0x33')](saveUpdates(_0x44551b[_0xc4e5('0x35')],null))[_0xc4e5('0x33')](respondWithResult(_0x1c78ec,null))[_0xc4e5('0x34')](handleError(_0x1c78ec,null));};exports[_0xc4e5('0x21')]=function(_0x2439ee,_0x20bbce){return db['ChatApplication']['find']({'where':{'id':_0x2439ee[_0xc4e5('0x26')]['id']}})[_0xc4e5('0x33')](handleEntityNotFound(_0x20bbce,null))[_0xc4e5('0x33')](removeEntity(_0x20bbce,null))[_0xc4e5('0x34')](handleError(_0x20bbce,null));}; \ No newline at end of file +var _0xd3a0=['ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','stack','name','send','show','params','model','rawAttributes','query','keys','intersection','attributes','length','includeAll','include','merge','options','ChatApplication','catch','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv'];(function(_0x490321,_0x4fc6f7){var _0x40c642=function(_0x51c643){while(--_0x51c643){_0x490321['push'](_0x490321['shift']());}};_0x40c642(++_0x4fc6f7);}(_0xd3a0,0xaa));var _0x0d3a=function(_0x4dbcf9,_0x60c00){_0x4dbcf9=_0x4dbcf9-0x0;var _0x15fea7=_0xd3a0[_0x4dbcf9];return _0x15fea7;};'use strict';var emlformat=require(_0x0d3a('0x0'));var rimraf=require(_0x0d3a('0x1'));var zipdir=require(_0x0d3a('0x2'));var jsonpatch=require(_0x0d3a('0x3'));var rp=require('request-promise');var moment=require(_0x0d3a('0x4'));var BPromise=require(_0x0d3a('0x5'));var Mustache=require(_0x0d3a('0x6'));var util=require(_0x0d3a('0x7'));var path=require(_0x0d3a('0x8'));var sox=require('sox');var csv=require(_0x0d3a('0x9'));var ejs=require(_0x0d3a('0xa'));var fs=require('fs');var fs_extra=require(_0x0d3a('0xb'));var _=require(_0x0d3a('0xc'));var squel=require(_0x0d3a('0xd'));var crypto=require('crypto');var jsforce=require(_0x0d3a('0xe'));var deskjs=require(_0x0d3a('0xf'));var toCsv=require(_0x0d3a('0x9'));var querystring=require(_0x0d3a('0x10'));var Papa=require(_0x0d3a('0x11'));var Redis=require(_0x0d3a('0x12'));var authService=require(_0x0d3a('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0d3a('0x14'));var hardwareService=require(_0x0d3a('0x15'));var logger=require('../../config/logger')(_0x0d3a('0x16'));var utils=require(_0x0d3a('0x17'));var config=require(_0x0d3a('0x18'));var licenseUtil=require(_0x0d3a('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47f5a8,_0x1d5f00){_0x1d5f00=_0x1d5f00||0xcc;return function(_0x36f478){if(_0x36f478){return _0x47f5a8[_0x0d3a('0x1a')](_0x1d5f00);}return _0x47f5a8[_0x0d3a('0x1b')](_0x1d5f00)[_0x0d3a('0x1c')]();};}function respondWithResult(_0x744a13,_0x2aa44b){_0x2aa44b=_0x2aa44b||0xc8;return function(_0x18a590){if(_0x18a590){return _0x744a13[_0x0d3a('0x1b')](_0x2aa44b)[_0x0d3a('0x1d')](_0x18a590);}};}function respondWithFilteredResult(_0x220f73,_0x5cadf7){return function(_0x516451){if(_0x516451){var _0x37c833=typeof _0x5cadf7[_0x0d3a('0x1e')]===_0x0d3a('0x1f')&&typeof _0x5cadf7[_0x0d3a('0x20')]===_0x0d3a('0x1f');var _0x2c8cd9=_0x516451[_0x0d3a('0x21')];var _0x456db7=_0x37c833?0x0:_0x5cadf7['offset'];var _0x1aad89=_0x37c833?_0x516451['count']:_0x5cadf7[_0x0d3a('0x1e')]+_0x5cadf7[_0x0d3a('0x20')];var _0x44413a;if(_0x1aad89>=_0x2c8cd9){_0x1aad89=_0x2c8cd9;_0x44413a=0xc8;}else{_0x44413a=0xce;}_0x220f73['status'](_0x44413a);return _0x220f73[_0x0d3a('0x22')]('Content-Range',_0x456db7+'-'+_0x1aad89+'/'+_0x2c8cd9)['json'](_0x516451);}return null;};}function patchUpdates(_0x31412f){return function(_0x4b9ca4){try{jsonpatch[_0x0d3a('0x23')](_0x4b9ca4,_0x31412f,!![]);}catch(_0x34278e){return BPromise[_0x0d3a('0x24')](_0x34278e);}return _0x4b9ca4[_0x0d3a('0x25')]();};}function saveUpdates(_0x339ffb,_0x1a2524){return function(_0x2ec7c8){if(_0x2ec7c8){return _0x2ec7c8[_0x0d3a('0x26')](_0x339ffb)[_0x0d3a('0x27')](function(_0x69e26d){return _0x69e26d;});}return null;};}function removeEntity(_0x4c54f9,_0x56f062){return function(_0x1b20d4){if(_0x1b20d4){return _0x1b20d4['destroy']()['then'](function(){_0x4c54f9[_0x0d3a('0x1b')](0xcc)[_0x0d3a('0x1c')]();});}};}function handleEntityNotFound(_0x1e8873,_0xd3d2bc){return function(_0xd4af83){if(!_0xd4af83){_0x1e8873[_0x0d3a('0x1a')](0x194);}return _0xd4af83;};}function handleError(_0x1ead03,_0x13bc05){_0x13bc05=_0x13bc05||0x1f4;return function(_0x2eeaf0){logger['error'](_0x2eeaf0[_0x0d3a('0x28')]);if(_0x2eeaf0[_0x0d3a('0x29')]){delete _0x2eeaf0['name'];}_0x1ead03[_0x0d3a('0x1b')](_0x13bc05)[_0x0d3a('0x2a')](_0x2eeaf0);};}exports[_0x0d3a('0x2b')]=function(_0x19ada3,_0x222c56){var _0x4ab37b={'raw':!![],'where':{'id':_0x19ada3[_0x0d3a('0x2c')]['id']}},_0x3b1875={};_0x3b1875[_0x0d3a('0x2d')]=_['keys'](db['ChatApplication'][_0x0d3a('0x2e')]);_0x3b1875[_0x0d3a('0x2f')]=_[_0x0d3a('0x30')](_0x19ada3[_0x0d3a('0x2f')]);_0x3b1875['filters']=_[_0x0d3a('0x31')](_0x3b1875[_0x0d3a('0x2d')],_0x3b1875[_0x0d3a('0x2f')]);_0x4ab37b['attributes']=_[_0x0d3a('0x31')](_0x3b1875[_0x0d3a('0x2d')],qs['fields'](_0x19ada3[_0x0d3a('0x2f')]['fields']));_0x4ab37b[_0x0d3a('0x32')]=_0x4ab37b[_0x0d3a('0x32')][_0x0d3a('0x33')]?_0x4ab37b[_0x0d3a('0x32')]:_0x3b1875[_0x0d3a('0x2d')];if(_0x19ada3[_0x0d3a('0x2f')][_0x0d3a('0x34')]){_0x4ab37b[_0x0d3a('0x35')]=[{'all':!![]}];}_0x4ab37b=_[_0x0d3a('0x36')]({},_0x4ab37b,_0x19ada3[_0x0d3a('0x37')]);return db[_0x0d3a('0x38')]['find'](_0x4ab37b)[_0x0d3a('0x27')](handleEntityNotFound(_0x222c56,null))[_0x0d3a('0x27')](respondWithResult(_0x222c56,null))[_0x0d3a('0x39')](handleError(_0x222c56,null));};exports[_0x0d3a('0x26')]=function(_0x579134,_0x5d9e43){if(_0x579134[_0x0d3a('0x3a')]['id']){delete _0x579134['body']['id'];}return db[_0x0d3a('0x38')]['find']({'where':{'id':_0x579134[_0x0d3a('0x2c')]['id']}})[_0x0d3a('0x27')](handleEntityNotFound(_0x5d9e43,null))['then'](saveUpdates(_0x579134[_0x0d3a('0x3a')],null))[_0x0d3a('0x27')](respondWithResult(_0x5d9e43,null))[_0x0d3a('0x39')](handleError(_0x5d9e43,null));};exports['destroy']=function(_0x164b1c,_0x47edc5){return db[_0x0d3a('0x38')][_0x0d3a('0x3b')]({'where':{'id':_0x164b1c[_0x0d3a('0x2c')]['id']}})[_0x0d3a('0x27')](handleEntityNotFound(_0x47edc5,null))['then'](removeEntity(_0x47edc5,null))[_0x0d3a('0x39')](handleError(_0x47edc5,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 4d281ec..47b34e0 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 _0xf0cc=['./chatApplication.attributes','exports','define','ChatApplication','chat_applications','lodash','api','request-promise','path'];(function(_0x4b91a7,_0x3a9a0b){var _0x598700=function(_0x2465aa){while(--_0x2465aa){_0x4b91a7['push'](_0x4b91a7['shift']());}};_0x598700(++_0x3a9a0b);}(_0xf0cc,0xa7));var _0xcf0c=function(_0x477b32,_0x5135ca){_0x477b32=_0x477b32-0x0;var _0x1d99be=_0xf0cc[_0x477b32];return _0x1d99be;};'use strict';var _=require(_0xcf0c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xcf0c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcf0c('0x2'));var fs=require('fs');var path=require(_0xcf0c('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcf0c('0x4'));module[_0xcf0c('0x5')]=function(_0x1a6003,_0x497363){return _0x1a6003[_0xcf0c('0x6')](_0xcf0c('0x7'),attributes,{'tableName':_0xcf0c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3617=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','chat_applications'];(function(_0x4818d1,_0x5f58bb){var _0x509563=function(_0x2f2768){while(--_0x2f2768){_0x4818d1['push'](_0x4818d1['shift']());}};_0x509563(++_0x5f58bb);}(_0x3617,0xec));var _0x7361=function(_0x497441,_0x4bdf27){_0x497441=_0x497441-0x0;var _0x59dd2e=_0x3617[_0x497441];return _0x59dd2e;};'use strict';var _=require(_0x7361('0x0'));var util=require(_0x7361('0x1'));var logger=require(_0x7361('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7361('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7361('0x4'));var rimraf=require(_0x7361('0x5'));var config=require(_0x7361('0x6'));var attributes=require(_0x7361('0x7'));module[_0x7361('0x8')]=function(_0x5de3a6,_0x414815){return _0x5de3a6[_0x7361('0x9')]('ChatApplication',attributes,{'tableName':_0x7361('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7361('0xb'),'collate':_0x7361('0xc')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 6d34a8a..91c01ad 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 _0x06a9=['../../config/environment','jayson/promise','client','http','request','then','info','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatApplication,\x20%s,\x20%s','message','request\x20sent','result','util','moment','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x5e6cb8,_0x16cf56){var _0x3faeb3=function(_0x1a7355){while(--_0x1a7355){_0x5e6cb8['push'](_0x5e6cb8['shift']());}};_0x3faeb3(++_0x16cf56);}(_0x06a9,0x144));var _0x906a=function(_0x4e8224,_0x3d9649){_0x4e8224=_0x4e8224-0x0;var _0x78c86e=_0x06a9[_0x4e8224];return _0x78c86e;};'use strict';var _=require('lodash');var util=require(_0x906a('0x0'));var moment=require(_0x906a('0x1'));var BPromise=require('bluebird');var rs=require(_0x906a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x906a('0x3'));var logger=require(_0x906a('0x4'))(_0x906a('0x5'));var config=require(_0x906a('0x6'));var jayson=require(_0x906a('0x7'));var client=jayson[_0x906a('0x8')][_0x906a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a1a6d,_0x184d27,_0x19de5b){return new BPromise(function(_0x417f21,_0x3c9341){return client[_0x906a('0xa')](_0x4a1a6d,_0x19de5b)[_0x906a('0xb')](function(_0x56e6a7){logger[_0x906a('0xc')]('ChatApplication,\x20%s,\x20%s',_0x184d27,'request\x20sent');logger[_0x906a('0xd')](_0x906a('0xe'),_0x184d27,'request\x20sent',JSON[_0x906a('0xf')](_0x56e6a7));if(_0x56e6a7[_0x906a('0x10')]){if(_0x56e6a7['error'][_0x906a('0x11')]===0x1f4){logger[_0x906a('0x10')](_0x906a('0x12'),_0x184d27,_0x56e6a7[_0x906a('0x10')]['message']);return _0x3c9341(_0x56e6a7[_0x906a('0x10')][_0x906a('0x13')]);}logger[_0x906a('0x10')](_0x906a('0x12'),_0x184d27,_0x56e6a7[_0x906a('0x10')]['message']);return _0x417f21(_0x56e6a7['error'][_0x906a('0x13')]);}else{logger[_0x906a('0xc')](_0x906a('0x12'),_0x184d27,_0x906a('0x14'));_0x417f21(_0x56e6a7[_0x906a('0x15')][_0x906a('0x13')]);}})['catch'](function(_0x3a9c80){logger[_0x906a('0x10')](_0x906a('0x12'),_0x184d27,_0x3a9c80);_0x3c9341(_0x3a9c80);});});} \ No newline at end of file +var _0xc46c=['lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','ChatApplication,\x20%s,\x20%s'];(function(_0x5193ea,_0x37ba91){var _0xe71de=function(_0x4de0d5){while(--_0x4de0d5){_0x5193ea['push'](_0x5193ea['shift']());}};_0xe71de(++_0x37ba91);}(_0xc46c,0x17c));var _0xcc46=function(_0x172948,_0x4262cc){_0x172948=_0x172948-0x0;var _0x4aeaa9=_0xc46c[_0x172948];return _0x4aeaa9;};'use strict';var _=require(_0xcc46('0x0'));var util=require('util');var moment=require(_0xcc46('0x1'));var BPromise=require(_0xcc46('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcc46('0x3'));var db=require(_0xcc46('0x4'))['db'];var utils=require(_0xcc46('0x5'));var logger=require('../../config/logger')(_0xcc46('0x6'));var config=require(_0xcc46('0x7'));var jayson=require(_0xcc46('0x8'));var client=jayson['client'][_0xcc46('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x318c0b,_0x27aaa8,_0xeead76){return new BPromise(function(_0x2a40aa,_0x6a062e){return client['request'](_0x318c0b,_0xeead76)[_0xcc46('0xa')](function(_0x1fb3e2){logger['info']('ChatApplication,\x20%s,\x20%s',_0x27aaa8,_0xcc46('0xb'));logger[_0xcc46('0xc')](_0xcc46('0xd'),_0x27aaa8,_0xcc46('0xb'),JSON[_0xcc46('0xe')](_0x1fb3e2));if(_0x1fb3e2[_0xcc46('0xf')]){if(_0x1fb3e2[_0xcc46('0xf')]['code']===0x1f4){logger[_0xcc46('0xf')]('ChatApplication,\x20%s,\x20%s',_0x27aaa8,_0x1fb3e2[_0xcc46('0xf')][_0xcc46('0x10')]);return _0x6a062e(_0x1fb3e2[_0xcc46('0xf')][_0xcc46('0x10')]);}logger[_0xcc46('0xf')]('ChatApplication,\x20%s,\x20%s',_0x27aaa8,_0x1fb3e2[_0xcc46('0xf')][_0xcc46('0x10')]);return _0x2a40aa(_0x1fb3e2[_0xcc46('0xf')][_0xcc46('0x10')]);}else{logger[_0xcc46('0x11')]('ChatApplication,\x20%s,\x20%s',_0x27aaa8,'request\x20sent');_0x2a40aa(_0x1fb3e2['result'][_0xcc46('0x10')]);}})[_0xcc46('0x12')](function(_0x21b8f3){logger[_0xcc46('0xf')](_0xcc46('0x13'),_0x27aaa8,_0x21b8f3);_0x6a062e(_0x21b8f3);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 1d94d94..865c79d 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 _0xf5c9=['multer','path','express','Router','fs-extra','../../components/interaction/service','./chatApplication.controller','/:id','isAuthenticated','show','put','update','delete','destroy','exports'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xf5c9,0x69));var _0x9f5c=function(_0x2200c6,_0x45b748){_0x2200c6=_0x2200c6-0x0;var _0x156997=_0xf5c9[_0x2200c6];return _0x156997;};'use strict';var multer=require(_0x9f5c('0x0'));var util=require('util');var path=require(_0x9f5c('0x1'));var timeout=require('connect-timeout');var express=require(_0x9f5c('0x2'));var router=express[_0x9f5c('0x3')]();var fs_extra=require(_0x9f5c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9f5c('0x5'));var config=require('../../config/environment');var controller=require(_0x9f5c('0x6'));router['get'](_0x9f5c('0x7'),auth[_0x9f5c('0x8')](),controller[_0x9f5c('0x9')]);router[_0x9f5c('0xa')](_0x9f5c('0x7'),auth[_0x9f5c('0x8')](),controller[_0x9f5c('0xb')]);router[_0x9f5c('0xc')](_0x9f5c('0x7'),auth[_0x9f5c('0x8')](),controller[_0x9f5c('0xd')]);module[_0x9f5c('0xe')]=router; \ No newline at end of file +var _0x31db=['../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x160182,_0x4cf21a){var _0x1c1e78=function(_0x248245){while(--_0x248245){_0x160182['push'](_0x160182['shift']());}};_0x1c1e78(++_0x4cf21a);}(_0x31db,0xe4));var _0xb31d=function(_0x13187a,_0x2fcec4){_0x13187a=_0x13187a-0x0;var _0x65b85f=_0x31db[_0x13187a];return _0x65b85f;};'use strict';var multer=require('multer');var util=require(_0xb31d('0x0'));var path=require(_0xb31d('0x1'));var timeout=require(_0xb31d('0x2'));var express=require(_0xb31d('0x3'));var router=express['Router']();var fs_extra=require(_0xb31d('0x4'));var auth=require(_0xb31d('0x5'));var interaction=require(_0xb31d('0x6'));var config=require(_0xb31d('0x7'));var controller=require(_0xb31d('0x8'));router[_0xb31d('0x9')](_0xb31d('0xa'),auth[_0xb31d('0xb')](),controller[_0xb31d('0xc')]);router[_0xb31d('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xb31d('0xe')]);router[_0xb31d('0xf')](_0xb31d('0xa'),auth[_0xb31d('0xb')](),controller[_0xb31d('0x10')]);module[_0xb31d('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index c851f13..1e86822 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 _0xbd54=['exports','STRING','BOOLEAN','sequelize'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xbd54,0x67));var _0x4bd5=function(_0x5d990e,_0x4ba9f5){_0x5d990e=_0x5d990e-0x0;var _0x36c763=_0xbd54[_0x5d990e];return _0x36c763;};'use strict';var Sequelize=require(_0x4bd5('0x0'));module[_0x4bd5('0x1')]={'name':{'type':Sequelize[_0x4bd5('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x4bd5('0x2')]},'write':{'type':Sequelize[_0x4bd5('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xb1c5=['STRING','BOOLEAN','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb1c5,0x182));var _0x5b1c=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xb1c5[_0x11005e];return _0x29338f;};'use strict';var Sequelize=require('sequelize');module[_0x5b1c('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x5b1c('0x1')]},'write':{'type':Sequelize[_0x5b1c('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 05258d6..cc2707c 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 _0xcb85=['ids','addMessage','ChatGroupId','$gte','format','getMessages','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','ChatGroup','rawAttributes','fieldName','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','catch','keys','find','create','body','params','describe','getUnread','ChatInternalMessage','toInteger','addMembers','omit','getMembers','findOne','User','removeMembers'];(function(_0x59a436,_0x196b36){var _0x36554d=function(_0x3676dd){while(--_0x3676dd){_0x59a436['push'](_0x59a436['shift']());}};_0x36554d(++_0x196b36);}(_0xcb85,0x18a));var _0x5cb8=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xcb85[_0x2b10c6];return _0x3789d2;};'use strict';var emlformat=require(_0x5cb8('0x0'));var rimraf=require(_0x5cb8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5cb8('0x2'));var rp=require(_0x5cb8('0x3'));var moment=require(_0x5cb8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5cb8('0x5'));var util=require(_0x5cb8('0x6'));var path=require(_0x5cb8('0x7'));var sox=require('sox');var csv=require(_0x5cb8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5cb8('0x9'));var _=require(_0x5cb8('0xa'));var squel=require('squel');var crypto=require(_0x5cb8('0xb'));var jsforce=require(_0x5cb8('0xc'));var deskjs=require(_0x5cb8('0xd'));var toCsv=require(_0x5cb8('0x8'));var querystring=require('querystring');var Papa=require(_0x5cb8('0xe'));var Redis=require(_0x5cb8('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5cb8('0x10'));var as=require(_0x5cb8('0x11'));var hardwareService=require(_0x5cb8('0x12'));var logger=require(_0x5cb8('0x13'))(_0x5cb8('0x14'));var utils=require('../../config/utils');var config=require(_0x5cb8('0x15'));var licenseUtil=require(_0x5cb8('0x16'));var db=require(_0x5cb8('0x17'))['db'];config[_0x5cb8('0x18')]=_[_0x5cb8('0x19')](config['redis'],{'host':_0x5cb8('0x1a'),'port':0x18eb});var socket=require(_0x5cb8('0x1b'))(new Redis(config[_0x5cb8('0x18')]));require(_0x5cb8('0x1c'))[_0x5cb8('0x1d')](socket);function respondWithStatusCode(_0x13625a,_0x5735da){_0x5735da=_0x5735da||0xcc;return function(_0xc890ab){if(_0xc890ab){return _0x13625a[_0x5cb8('0x1e')](_0x5735da);}return _0x13625a[_0x5cb8('0x1f')](_0x5735da)[_0x5cb8('0x20')]();};}function respondWithResult(_0x17bfae,_0xddf22c){_0xddf22c=_0xddf22c||0xc8;return function(_0x2d3328){if(_0x2d3328){return _0x17bfae[_0x5cb8('0x1f')](_0xddf22c)['json'](_0x2d3328);}};}function respondWithFilteredResult(_0x11c70c,_0x1f94d5){return function(_0x3a7f9a){if(_0x3a7f9a){var _0x5919ad=typeof _0x1f94d5[_0x5cb8('0x21')]===_0x5cb8('0x22')&&typeof _0x1f94d5['limit']===_0x5cb8('0x22');var _0x425693=_0x3a7f9a[_0x5cb8('0x23')];var _0x479f29=_0x5919ad?0x0:_0x1f94d5[_0x5cb8('0x21')];var _0x1f6bae=_0x5919ad?_0x3a7f9a[_0x5cb8('0x23')]:_0x1f94d5[_0x5cb8('0x21')]+_0x1f94d5[_0x5cb8('0x24')];var _0x5287c0;if(_0x1f6bae>=_0x425693){_0x1f6bae=_0x425693;_0x5287c0=0xc8;}else{_0x5287c0=0xce;}_0x11c70c[_0x5cb8('0x1f')](_0x5287c0);return _0x11c70c[_0x5cb8('0x25')](_0x5cb8('0x26'),_0x479f29+'-'+_0x1f6bae+'/'+_0x425693)[_0x5cb8('0x27')](_0x3a7f9a);}return null;};}function patchUpdates(_0x48af23){return function(_0x54f124){try{jsonpatch[_0x5cb8('0x28')](_0x54f124,_0x48af23,!![]);}catch(_0x2e707d){return BPromise[_0x5cb8('0x29')](_0x2e707d);}return _0x54f124[_0x5cb8('0x2a')]();};}function saveUpdates(_0x571215,_0x431482){return function(_0x3b29e4){if(_0x3b29e4){return _0x3b29e4[_0x5cb8('0x2b')](_0x571215)[_0x5cb8('0x2c')](function(_0x4a0c7e){return _0x4a0c7e;});}return null;};}function removeEntity(_0x3926ce,_0x2bd69f){return function(_0x4287b4){if(_0x4287b4){return _0x4287b4[_0x5cb8('0x2d')]()[_0x5cb8('0x2c')](function(){_0x3926ce[_0x5cb8('0x1f')](0xcc)[_0x5cb8('0x20')]();});}};}function handleEntityNotFound(_0x2945d9,_0x150f9e){return function(_0x4b3c73){if(!_0x4b3c73){_0x2945d9[_0x5cb8('0x1e')](0x194);}return _0x4b3c73;};}function handleError(_0x1a5125,_0x14dfaf){_0x14dfaf=_0x14dfaf||0x1f4;return function(_0xf5b7b9){logger[_0x5cb8('0x2e')](_0xf5b7b9['stack']);if(_0xf5b7b9[_0x5cb8('0x2f')]){delete _0xf5b7b9[_0x5cb8('0x2f')];}_0x1a5125['status'](_0x14dfaf)[_0x5cb8('0x30')](_0xf5b7b9);};}exports[_0x5cb8('0x31')]=function(_0x3be227,_0x150a36){var _0x50ef98={},_0x33fa36={},_0x40ee08={'count':0x0,'rows':[]};var _0x5206ec=_['map'](db[_0x5cb8('0x32')][_0x5cb8('0x33')],function(_0xf50cb3){return{'name':_0xf50cb3[_0x5cb8('0x34')],'type':_0xf50cb3['type'][_0x5cb8('0x35')]};});_0x33fa36[_0x5cb8('0x36')]=_[_0x5cb8('0x37')](_0x5206ec,_0x5cb8('0x2f'));_0x33fa36[_0x5cb8('0x38')]=_['keys'](_0x3be227['query']);_0x33fa36['filters']=_[_0x5cb8('0x39')](_0x33fa36[_0x5cb8('0x36')],_0x33fa36['query']);_0x50ef98[_0x5cb8('0x3a')]=_[_0x5cb8('0x39')](_0x33fa36[_0x5cb8('0x36')],qs[_0x5cb8('0x3b')](_0x3be227[_0x5cb8('0x38')]['fields']));_0x50ef98[_0x5cb8('0x3a')]=_0x50ef98[_0x5cb8('0x3a')][_0x5cb8('0x3c')]?_0x50ef98['attributes']:_0x33fa36[_0x5cb8('0x36')];if(!_0x3be227['query'][_0x5cb8('0x3d')](_0x5cb8('0x3e'))){_0x50ef98[_0x5cb8('0x24')]=qs[_0x5cb8('0x24')](_0x3be227[_0x5cb8('0x38')]['limit']);_0x50ef98[_0x5cb8('0x21')]=qs[_0x5cb8('0x21')](_0x3be227['query'][_0x5cb8('0x21')]);}_0x50ef98[_0x5cb8('0x3f')]=qs[_0x5cb8('0x40')](_0x3be227['query'][_0x5cb8('0x40')]);_0x50ef98['where']=qs[_0x5cb8('0x41')](_[_0x5cb8('0x42')](_0x3be227[_0x5cb8('0x38')],_0x33fa36[_0x5cb8('0x41')]),_0x5206ec);if(_0x3be227[_0x5cb8('0x38')][_0x5cb8('0x43')]){_0x50ef98[_0x5cb8('0x44')]=_[_0x5cb8('0x45')](_0x50ef98['where'],{'$or':_[_0x5cb8('0x37')](_0x5206ec,function(_0x2985db){if(_0x2985db[_0x5cb8('0x46')]!==_0x5cb8('0x47')){var _0x22ec17={};_0x22ec17[_0x2985db[_0x5cb8('0x2f')]]={'$like':'%'+_0x3be227[_0x5cb8('0x38')][_0x5cb8('0x43')]+'%'};return _0x22ec17;}})});}_0x50ef98=_[_0x5cb8('0x45')]({},_0x50ef98,_0x3be227[_0x5cb8('0x48')]);var _0x3caf50={'where':_0x50ef98['where']};return db[_0x5cb8('0x32')][_0x5cb8('0x23')](_0x3caf50)[_0x5cb8('0x2c')](function(_0x28890c){_0x40ee08[_0x5cb8('0x23')]=_0x28890c;if(_0x3be227['query'][_0x5cb8('0x49')]){_0x50ef98['include']=[{'all':!![]}];}return db[_0x5cb8('0x32')][_0x5cb8('0x4a')](_0x50ef98);})[_0x5cb8('0x2c')](function(_0x3d285b){_0x40ee08['rows']=_0x3d285b;return _0x40ee08;})[_0x5cb8('0x2c')](respondWithFilteredResult(_0x150a36,_0x50ef98))[_0x5cb8('0x4b')](handleError(_0x150a36,null));};exports['show']=function(_0x2897d4,_0x39fc58){var _0x787cc9={'raw':!![],'where':{'id':_0x2897d4['params']['id']}},_0x4cd878={};_0x4cd878[_0x5cb8('0x36')]=_[_0x5cb8('0x4c')](db[_0x5cb8('0x32')]['rawAttributes']);_0x4cd878[_0x5cb8('0x38')]=_[_0x5cb8('0x4c')](_0x2897d4[_0x5cb8('0x38')]);_0x4cd878[_0x5cb8('0x41')]=_[_0x5cb8('0x39')](_0x4cd878['model'],_0x4cd878['query']);_0x787cc9[_0x5cb8('0x3a')]=_[_0x5cb8('0x39')](_0x4cd878['model'],qs[_0x5cb8('0x3b')](_0x2897d4[_0x5cb8('0x38')]['fields']));_0x787cc9[_0x5cb8('0x3a')]=_0x787cc9[_0x5cb8('0x3a')]['length']?_0x787cc9[_0x5cb8('0x3a')]:_0x4cd878[_0x5cb8('0x36')];if(_0x2897d4[_0x5cb8('0x38')][_0x5cb8('0x49')]){_0x787cc9['include']=[{'all':!![]}];}_0x787cc9=_[_0x5cb8('0x45')]({},_0x787cc9,_0x2897d4[_0x5cb8('0x48')]);return db[_0x5cb8('0x32')][_0x5cb8('0x4d')](_0x787cc9)[_0x5cb8('0x2c')](handleEntityNotFound(_0x39fc58,null))[_0x5cb8('0x2c')](respondWithResult(_0x39fc58,null))[_0x5cb8('0x4b')](handleError(_0x39fc58,null));};exports[_0x5cb8('0x4e')]=function(_0x1394f0,_0x8efd67){return db[_0x5cb8('0x32')][_0x5cb8('0x4e')](_0x1394f0[_0x5cb8('0x4f')],{})[_0x5cb8('0x2c')](respondWithResult(_0x8efd67,0xc9))[_0x5cb8('0x4b')](handleError(_0x8efd67,null));};exports['update']=function(_0x4b48b4,_0x103b06){if(_0x4b48b4[_0x5cb8('0x4f')]['id']){delete _0x4b48b4[_0x5cb8('0x4f')]['id'];}return db[_0x5cb8('0x32')]['find']({'where':{'id':_0x4b48b4[_0x5cb8('0x50')]['id']}})[_0x5cb8('0x2c')](handleEntityNotFound(_0x103b06,null))['then'](saveUpdates(_0x4b48b4[_0x5cb8('0x4f')],null))[_0x5cb8('0x2c')](respondWithResult(_0x103b06,null))[_0x5cb8('0x4b')](handleError(_0x103b06,null));};exports[_0x5cb8('0x2d')]=function(_0x5a327a,_0x43cb0b){return db[_0x5cb8('0x32')][_0x5cb8('0x4d')]({'where':{'id':_0x5a327a[_0x5cb8('0x50')]['id']}})[_0x5cb8('0x2c')](handleEntityNotFound(_0x43cb0b,null))['then'](removeEntity(_0x43cb0b,null))['catch'](handleError(_0x43cb0b,null));};exports[_0x5cb8('0x51')]=function(_0x4535ba,_0x37db9c){return db[_0x5cb8('0x32')][_0x5cb8('0x51')]()[_0x5cb8('0x2c')](respondWithResult(_0x37db9c,null))[_0x5cb8('0x4b')](handleError(_0x37db9c,null));};exports[_0x5cb8('0x52')]=function(_0x4d9f9c,_0x4f0bf2,_0x4dafc9){return db[_0x5cb8('0x53')][_0x5cb8('0x23')]({'where':{'ChatGroupId':_0x4d9f9c[_0x5cb8('0x50')]['id'],'ToId':_0x4d9f9c['user']['id'],'read':![]}})[_0x5cb8('0x2c')](function(_0x1e4466){return{'id':_[_0x5cb8('0x54')](_0x4d9f9c['params']['id']),'count':_0x1e4466};})[_0x5cb8('0x2c')](respondWithResult(_0x4f0bf2,null))[_0x5cb8('0x4b')](handleError(_0x4f0bf2,null));};exports[_0x5cb8('0x55')]=function(_0x3a0ce6,_0x52b48f,_0x4dd5c6){return db['ChatGroup']['find']({'where':{'id':_0x3a0ce6[_0x5cb8('0x50')]['id']}})[_0x5cb8('0x2c')](handleEntityNotFound(_0x52b48f,null))['then'](function(_0x437742){if(_0x437742){return _0x437742[_0x5cb8('0x55')](_0x3a0ce6[_0x5cb8('0x4f')]['ids'],_[_0x5cb8('0x56')](_0x3a0ce6[_0x5cb8('0x4f')],['ids','id'])||{});}})[_0x5cb8('0x2c')](respondWithResult(_0x52b48f,null))['catch'](handleError(_0x52b48f,null));};exports[_0x5cb8('0x57')]=function(_0x2b25fd,_0x22a642,_0x3d920b){var _0x12b014={};var _0x39f8a={};var _0x12e3f9;var _0x44370b;return db[_0x5cb8('0x32')][_0x5cb8('0x58')]({'where':{'id':_0x2b25fd[_0x5cb8('0x50')]['id']}})[_0x5cb8('0x2c')](handleEntityNotFound(_0x22a642,null))[_0x5cb8('0x2c')](function(_0x146d6c){if(_0x146d6c){_0x12e3f9=_0x146d6c;_0x39f8a[_0x5cb8('0x36')]=_[_0x5cb8('0x4c')](db[_0x5cb8('0x59')][_0x5cb8('0x33')]);_0x39f8a[_0x5cb8('0x38')]=_[_0x5cb8('0x4c')](_0x2b25fd[_0x5cb8('0x38')]);_0x39f8a[_0x5cb8('0x41')]=_[_0x5cb8('0x39')](_0x39f8a['model'],_0x39f8a[_0x5cb8('0x38')]);_0x12b014['attributes']=_[_0x5cb8('0x39')](_0x39f8a[_0x5cb8('0x36')],qs[_0x5cb8('0x3b')](_0x2b25fd[_0x5cb8('0x38')][_0x5cb8('0x3b')]));_0x12b014['attributes']=_0x12b014[_0x5cb8('0x3a')]['length']?_0x12b014[_0x5cb8('0x3a')]:_0x39f8a[_0x5cb8('0x36')];_0x12b014[_0x5cb8('0x3f')]=qs[_0x5cb8('0x40')](_0x2b25fd[_0x5cb8('0x38')][_0x5cb8('0x40')]);_0x12b014[_0x5cb8('0x44')]=qs['filters'](_['pick'](_0x2b25fd['query'],_0x39f8a['filters']));if(_0x2b25fd[_0x5cb8('0x38')][_0x5cb8('0x43')]){_0x12b014[_0x5cb8('0x44')]=_[_0x5cb8('0x45')](_0x12b014[_0x5cb8('0x44')],{'$or':_[_0x5cb8('0x37')](_0x12b014[_0x5cb8('0x3a')],function(_0x265733){var _0x279875={};_0x279875[_0x265733]={'$like':'%'+_0x2b25fd[_0x5cb8('0x38')][_0x5cb8('0x43')]+'%'};return _0x279875;})});}_0x12b014=_['merge']({},_0x12b014,_0x2b25fd[_0x5cb8('0x48')]);return _0x12e3f9['getMembers'](_0x12b014);}})[_0x5cb8('0x2c')](function(_0x59425){if(_0x59425){_0x44370b=_0x59425[_0x5cb8('0x3c')];if(!_0x2b25fd[_0x5cb8('0x38')][_0x5cb8('0x3d')](_0x5cb8('0x3e'))){_0x12b014[_0x5cb8('0x24')]=qs[_0x5cb8('0x24')](_0x2b25fd[_0x5cb8('0x38')][_0x5cb8('0x24')]);_0x12b014['offset']=qs['offset'](_0x2b25fd[_0x5cb8('0x38')][_0x5cb8('0x21')]);}return _0x12e3f9[_0x5cb8('0x57')](_0x12b014);}})[_0x5cb8('0x2c')](function(_0x488f25){if(_0x488f25){return _0x488f25?{'count':_0x44370b,'rows':_0x488f25}:null;}})['then'](respondWithResult(_0x22a642,null))[_0x5cb8('0x4b')](handleError(_0x22a642,null));};exports[_0x5cb8('0x5a')]=function(_0xa0ba4,_0x193682,_0x2a2c43){return db['ChatGroup'][_0x5cb8('0x4d')]({'where':{'id':_0xa0ba4[_0x5cb8('0x50')]['id']}})[_0x5cb8('0x2c')](handleEntityNotFound(_0x193682,null))[_0x5cb8('0x2c')](function(_0x81bbf2){if(_0x81bbf2){return _0x81bbf2[_0x5cb8('0x5a')](_0xa0ba4['query'][_0x5cb8('0x5b')]);}})['then'](respondWithStatusCode(_0x193682,null))[_0x5cb8('0x4b')](handleError(_0x193682,null));};exports[_0x5cb8('0x5c')]=function(_0x3c6997,_0x21b4d1,_0x3369fc){if(_0x3c6997[_0x5cb8('0x4f')]['id']){delete _0x3c6997[_0x5cb8('0x4f')]['id'];}return db[_0x5cb8('0x32')]['find']({'where':{'id':_0x3c6997[_0x5cb8('0x50')]['id']}})[_0x5cb8('0x2c')](handleEntityNotFound(_0x21b4d1,null))[_0x5cb8('0x2c')](function(_0x1459b3){if(_0x1459b3){_0x3c6997[_0x5cb8('0x4f')][_0x5cb8('0x5d')]=_0x1459b3['id'];return db['ChatInternalMessage'][_0x5cb8('0x4e')](_0x3c6997[_0x5cb8('0x4f')]);}})[_0x5cb8('0x2c')](respondWithResult(_0x21b4d1,null))[_0x5cb8('0x4b')](handleError(_0x21b4d1,null));};exports['getMessages']=function(_0x5b6763,_0x36446b,_0x1f2513){var _0x4644de={};var _0x211f6a={};var _0x514fc8;var _0x17c3a8;return db[_0x5cb8('0x32')]['findOne']({'where':{'id':_0x5b6763[_0x5cb8('0x50')]['id']}})[_0x5cb8('0x2c')](handleEntityNotFound(_0x36446b,null))[_0x5cb8('0x2c')](function(_0x2ea703){if(_0x2ea703){_0x514fc8=_0x2ea703;_0x211f6a[_0x5cb8('0x36')]=_[_0x5cb8('0x4c')](db['ChatInternalMessage'][_0x5cb8('0x33')]);_0x211f6a[_0x5cb8('0x38')]=_['keys'](_0x5b6763[_0x5cb8('0x38')]);_0x211f6a['filters']=_['intersection'](_0x211f6a[_0x5cb8('0x36')],_0x211f6a[_0x5cb8('0x38')]);_0x4644de[_0x5cb8('0x3a')]=_[_0x5cb8('0x39')](_0x211f6a['model'],qs[_0x5cb8('0x3b')](_0x5b6763[_0x5cb8('0x38')][_0x5cb8('0x3b')]));_0x4644de[_0x5cb8('0x3a')]=_0x4644de['attributes']['length']?_0x4644de['attributes']:_0x211f6a['model'];_0x4644de['order']=qs[_0x5cb8('0x40')](_0x5b6763['query'][_0x5cb8('0x40')]);_0x4644de[_0x5cb8('0x44')]=qs['filters'](_[_0x5cb8('0x42')](_0x5b6763[_0x5cb8('0x38')],_0x211f6a[_0x5cb8('0x41')]));if(_0x5b6763['query'][_0x5cb8('0x43')]){_0x4644de[_0x5cb8('0x44')]=_[_0x5cb8('0x45')](_0x4644de['where'],{'$or':_[_0x5cb8('0x37')](_0x4644de['attributes'],function(_0x6fb61b){var _0x3020e5={};_0x3020e5[_0x6fb61b]={'$like':'%'+_0x5b6763['query'][_0x5cb8('0x43')]+'%'};return _0x3020e5;})});}if(_0x5b6763[_0x5cb8('0x38')][_0x5cb8('0x5e')]){var _0x2947b5=_0x5b6763[_0x5cb8('0x38')][_0x5cb8('0x5e')]['split'](',');var _0x3d8c59={};_0x3d8c59[_0x2947b5[0x0]]={'$gte':moment(_0x2947b5[0x1])[_0x5cb8('0x5f')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4644de[_0x5cb8('0x44')]=_[_0x5cb8('0x45')](_0x4644de[_0x5cb8('0x44')],_0x3d8c59);}_0x4644de=_['merge']({},_0x4644de,_0x5b6763['options']);return _0x514fc8['getMessages'](_0x4644de);}})[_0x5cb8('0x2c')](function(_0x3852d){if(_0x3852d){_0x17c3a8=_0x3852d[_0x5cb8('0x3c')];if(!_0x5b6763[_0x5cb8('0x38')][_0x5cb8('0x3d')](_0x5cb8('0x3e'))){_0x4644de[_0x5cb8('0x24')]=qs[_0x5cb8('0x24')](_0x5b6763[_0x5cb8('0x38')]['limit']);_0x4644de[_0x5cb8('0x21')]=qs[_0x5cb8('0x21')](_0x5b6763[_0x5cb8('0x38')]['offset']);}return _0x514fc8[_0x5cb8('0x60')](_0x4644de);}})[_0x5cb8('0x2c')](function(_0x2acf93){if(_0x2acf93){return _0x2acf93?{'count':_0x17c3a8,'rows':_0x2acf93}:null;}})[_0x5cb8('0x2c')](respondWithResult(_0x36446b,null))[_0x5cb8('0x4b')](handleError(_0x36446b,null));}; \ No newline at end of file +var _0x4c97=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','ChatGroup','rawAttributes','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','catch','show','params','keys','intersection','find','create','update','body','describe','getUnread','ChatInternalMessage','user','toInteger','ids','omit','getMembers','findOne','User','options','removeMembers','addMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','getMessages'];(function(_0x126bd2,_0x2bab5b){var _0x3b806b=function(_0x9c2f74){while(--_0x9c2f74){_0x126bd2['push'](_0x126bd2['shift']());}};_0x3b806b(++_0x2bab5b);}(_0x4c97,0x184));var _0x74c9=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x4c97[_0x15bc81];return _0x59440e;};'use strict';var emlformat=require(_0x74c9('0x0'));var rimraf=require(_0x74c9('0x1'));var zipdir=require(_0x74c9('0x2'));var jsonpatch=require(_0x74c9('0x3'));var rp=require('request-promise');var moment=require(_0x74c9('0x4'));var BPromise=require(_0x74c9('0x5'));var Mustache=require(_0x74c9('0x6'));var util=require(_0x74c9('0x7'));var path=require('path');var sox=require(_0x74c9('0x8'));var csv=require(_0x74c9('0x9'));var ejs=require(_0x74c9('0xa'));var fs=require('fs');var fs_extra=require(_0x74c9('0xb'));var _=require(_0x74c9('0xc'));var squel=require(_0x74c9('0xd'));var crypto=require(_0x74c9('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x74c9('0x9'));var querystring=require(_0x74c9('0xf'));var Papa=require(_0x74c9('0x10'));var Redis=require(_0x74c9('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x74c9('0x12'));var as=require(_0x74c9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x74c9('0x14'))('api');var utils=require(_0x74c9('0x15'));var config=require(_0x74c9('0x16'));var licenseUtil=require(_0x74c9('0x17'));var db=require(_0x74c9('0x18'))['db'];config[_0x74c9('0x19')]=_[_0x74c9('0x1a')](config[_0x74c9('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x74c9('0x1b'))(new Redis(config[_0x74c9('0x19')]));require('./chatGroup.socket')[_0x74c9('0x1c')](socket);function respondWithStatusCode(_0x1a1319,_0x2589cd){_0x2589cd=_0x2589cd||0xcc;return function(_0x56c0b2){if(_0x56c0b2){return _0x1a1319[_0x74c9('0x1d')](_0x2589cd);}return _0x1a1319[_0x74c9('0x1e')](_0x2589cd)[_0x74c9('0x1f')]();};}function respondWithResult(_0x90287b,_0x506df4){_0x506df4=_0x506df4||0xc8;return function(_0x9f201c){if(_0x9f201c){return _0x90287b['status'](_0x506df4)[_0x74c9('0x20')](_0x9f201c);}};}function respondWithFilteredResult(_0x3198f8,_0x5838a5){return function(_0x5a19d6){if(_0x5a19d6){var _0x3118b1=typeof _0x5838a5['offset']===_0x74c9('0x21')&&typeof _0x5838a5['limit']==='undefined';var _0x1c9790=_0x5a19d6[_0x74c9('0x22')];var _0x11b9e6=_0x3118b1?0x0:_0x5838a5[_0x74c9('0x23')];var _0x51bb35=_0x3118b1?_0x5a19d6[_0x74c9('0x22')]:_0x5838a5['offset']+_0x5838a5[_0x74c9('0x24')];var _0x345e60;if(_0x51bb35>=_0x1c9790){_0x51bb35=_0x1c9790;_0x345e60=0xc8;}else{_0x345e60=0xce;}_0x3198f8[_0x74c9('0x1e')](_0x345e60);return _0x3198f8[_0x74c9('0x25')](_0x74c9('0x26'),_0x11b9e6+'-'+_0x51bb35+'/'+_0x1c9790)[_0x74c9('0x20')](_0x5a19d6);}return null;};}function patchUpdates(_0x35ded6){return function(_0x4971f6){try{jsonpatch[_0x74c9('0x27')](_0x4971f6,_0x35ded6,!![]);}catch(_0x28bee5){return BPromise['reject'](_0x28bee5);}return _0x4971f6[_0x74c9('0x28')]();};}function saveUpdates(_0xdbce7d,_0x2c3a08){return function(_0x253fac){if(_0x253fac){return _0x253fac['update'](_0xdbce7d)[_0x74c9('0x29')](function(_0x4ef1c0){return _0x4ef1c0;});}return null;};}function removeEntity(_0x1b47b0,_0x9b4e8a){return function(_0x46e708){if(_0x46e708){return _0x46e708[_0x74c9('0x2a')]()[_0x74c9('0x29')](function(){_0x1b47b0[_0x74c9('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33ea5c,_0x5cfef3){return function(_0x25f562){if(!_0x25f562){_0x33ea5c[_0x74c9('0x1d')](0x194);}return _0x25f562;};}function handleError(_0x1602ab,_0x498ed2){_0x498ed2=_0x498ed2||0x1f4;return function(_0x4d5c35){logger[_0x74c9('0x2b')](_0x4d5c35[_0x74c9('0x2c')]);if(_0x4d5c35[_0x74c9('0x2d')]){delete _0x4d5c35['name'];}_0x1602ab[_0x74c9('0x1e')](_0x498ed2)[_0x74c9('0x2e')](_0x4d5c35);};}exports[_0x74c9('0x2f')]=function(_0x199733,_0x52acc4){var _0xeb5b7b={},_0x459681={},_0x5ab246={'count':0x0,'rows':[]};var _0x691a97=_[_0x74c9('0x30')](db[_0x74c9('0x31')][_0x74c9('0x32')],function(_0x4ad505){return{'name':_0x4ad505['fieldName'],'type':_0x4ad505[_0x74c9('0x33')][_0x74c9('0x34')]};});_0x459681[_0x74c9('0x35')]=_[_0x74c9('0x30')](_0x691a97,_0x74c9('0x2d'));_0x459681[_0x74c9('0x36')]=_['keys'](_0x199733[_0x74c9('0x36')]);_0x459681[_0x74c9('0x37')]=_['intersection'](_0x459681['model'],_0x459681[_0x74c9('0x36')]);_0xeb5b7b[_0x74c9('0x38')]=_['intersection'](_0x459681[_0x74c9('0x35')],qs[_0x74c9('0x39')](_0x199733[_0x74c9('0x36')][_0x74c9('0x39')]));_0xeb5b7b[_0x74c9('0x38')]=_0xeb5b7b[_0x74c9('0x38')][_0x74c9('0x3a')]?_0xeb5b7b[_0x74c9('0x38')]:_0x459681[_0x74c9('0x35')];if(!_0x199733[_0x74c9('0x36')][_0x74c9('0x3b')](_0x74c9('0x3c'))){_0xeb5b7b['limit']=qs[_0x74c9('0x24')](_0x199733[_0x74c9('0x36')][_0x74c9('0x24')]);_0xeb5b7b[_0x74c9('0x23')]=qs[_0x74c9('0x23')](_0x199733[_0x74c9('0x36')][_0x74c9('0x23')]);}_0xeb5b7b[_0x74c9('0x3d')]=qs[_0x74c9('0x3e')](_0x199733['query']['sort']);_0xeb5b7b[_0x74c9('0x3f')]=qs[_0x74c9('0x37')](_[_0x74c9('0x40')](_0x199733['query'],_0x459681[_0x74c9('0x37')]),_0x691a97);if(_0x199733[_0x74c9('0x36')][_0x74c9('0x41')]){_0xeb5b7b[_0x74c9('0x3f')]=_[_0x74c9('0x42')](_0xeb5b7b[_0x74c9('0x3f')],{'$or':_[_0x74c9('0x30')](_0x691a97,function(_0x27c590){if(_0x27c590[_0x74c9('0x33')]!==_0x74c9('0x43')){var _0x5cd6cd={};_0x5cd6cd[_0x27c590['name']]={'$like':'%'+_0x199733[_0x74c9('0x36')]['filter']+'%'};return _0x5cd6cd;}})});}_0xeb5b7b=_[_0x74c9('0x42')]({},_0xeb5b7b,_0x199733['options']);var _0x295b72={'where':_0xeb5b7b[_0x74c9('0x3f')]};return db[_0x74c9('0x31')][_0x74c9('0x22')](_0x295b72)['then'](function(_0x2497ce){_0x5ab246['count']=_0x2497ce;if(_0x199733[_0x74c9('0x36')][_0x74c9('0x44')]){_0xeb5b7b[_0x74c9('0x45')]=[{'all':!![]}];}return db['ChatGroup']['findAll'](_0xeb5b7b);})[_0x74c9('0x29')](function(_0x4da3c0){_0x5ab246['rows']=_0x4da3c0;return _0x5ab246;})['then'](respondWithFilteredResult(_0x52acc4,_0xeb5b7b))[_0x74c9('0x46')](handleError(_0x52acc4,null));};exports[_0x74c9('0x47')]=function(_0x3d624e,_0x674c92){var _0x366467={'raw':!![],'where':{'id':_0x3d624e[_0x74c9('0x48')]['id']}},_0x420afa={};_0x420afa[_0x74c9('0x35')]=_[_0x74c9('0x49')](db[_0x74c9('0x31')]['rawAttributes']);_0x420afa[_0x74c9('0x36')]=_['keys'](_0x3d624e['query']);_0x420afa[_0x74c9('0x37')]=_['intersection'](_0x420afa[_0x74c9('0x35')],_0x420afa[_0x74c9('0x36')]);_0x366467[_0x74c9('0x38')]=_[_0x74c9('0x4a')](_0x420afa[_0x74c9('0x35')],qs['fields'](_0x3d624e[_0x74c9('0x36')]['fields']));_0x366467[_0x74c9('0x38')]=_0x366467[_0x74c9('0x38')]['length']?_0x366467['attributes']:_0x420afa['model'];if(_0x3d624e[_0x74c9('0x36')][_0x74c9('0x44')]){_0x366467[_0x74c9('0x45')]=[{'all':!![]}];}_0x366467=_[_0x74c9('0x42')]({},_0x366467,_0x3d624e['options']);return db['ChatGroup'][_0x74c9('0x4b')](_0x366467)['then'](handleEntityNotFound(_0x674c92,null))[_0x74c9('0x29')](respondWithResult(_0x674c92,null))[_0x74c9('0x46')](handleError(_0x674c92,null));};exports['create']=function(_0x4baa9b,_0x25f7ee){return db[_0x74c9('0x31')][_0x74c9('0x4c')](_0x4baa9b['body'],{})[_0x74c9('0x29')](respondWithResult(_0x25f7ee,0xc9))[_0x74c9('0x46')](handleError(_0x25f7ee,null));};exports[_0x74c9('0x4d')]=function(_0x471afb,_0x313848){if(_0x471afb[_0x74c9('0x4e')]['id']){delete _0x471afb[_0x74c9('0x4e')]['id'];}return db[_0x74c9('0x31')]['find']({'where':{'id':_0x471afb[_0x74c9('0x48')]['id']}})[_0x74c9('0x29')](handleEntityNotFound(_0x313848,null))[_0x74c9('0x29')](saveUpdates(_0x471afb['body'],null))[_0x74c9('0x29')](respondWithResult(_0x313848,null))[_0x74c9('0x46')](handleError(_0x313848,null));};exports[_0x74c9('0x2a')]=function(_0x58040b,_0xeb39e0){return db[_0x74c9('0x31')]['find']({'where':{'id':_0x58040b[_0x74c9('0x48')]['id']}})[_0x74c9('0x29')](handleEntityNotFound(_0xeb39e0,null))[_0x74c9('0x29')](removeEntity(_0xeb39e0,null))[_0x74c9('0x46')](handleError(_0xeb39e0,null));};exports[_0x74c9('0x4f')]=function(_0x528374,_0x2323d8){return db['ChatGroup']['describe']()['then'](respondWithResult(_0x2323d8,null))[_0x74c9('0x46')](handleError(_0x2323d8,null));};exports[_0x74c9('0x50')]=function(_0x162655,_0x5110d9,_0xfddc3e){return db[_0x74c9('0x51')][_0x74c9('0x22')]({'where':{'ChatGroupId':_0x162655[_0x74c9('0x48')]['id'],'ToId':_0x162655[_0x74c9('0x52')]['id'],'read':![]}})['then'](function(_0x2fa1b0){return{'id':_[_0x74c9('0x53')](_0x162655[_0x74c9('0x48')]['id']),'count':_0x2fa1b0};})[_0x74c9('0x29')](respondWithResult(_0x5110d9,null))[_0x74c9('0x46')](handleError(_0x5110d9,null));};exports['addMembers']=function(_0x4f0d34,_0x27c1c3,_0xbf3cff){return db[_0x74c9('0x31')]['find']({'where':{'id':_0x4f0d34[_0x74c9('0x48')]['id']}})[_0x74c9('0x29')](handleEntityNotFound(_0x27c1c3,null))[_0x74c9('0x29')](function(_0x4efccd){if(_0x4efccd){return _0x4efccd['addMembers'](_0x4f0d34['body'][_0x74c9('0x54')],_[_0x74c9('0x55')](_0x4f0d34[_0x74c9('0x4e')],[_0x74c9('0x54'),'id'])||{});}})[_0x74c9('0x29')](respondWithResult(_0x27c1c3,null))['catch'](handleError(_0x27c1c3,null));};exports[_0x74c9('0x56')]=function(_0x437137,_0x37d502,_0x38f108){var _0x2d120e={};var _0x1a689c={};var _0x1b54b5;var _0x3193ae;return db[_0x74c9('0x31')][_0x74c9('0x57')]({'where':{'id':_0x437137[_0x74c9('0x48')]['id']}})[_0x74c9('0x29')](handleEntityNotFound(_0x37d502,null))[_0x74c9('0x29')](function(_0x178af5){if(_0x178af5){_0x1b54b5=_0x178af5;_0x1a689c[_0x74c9('0x35')]=_[_0x74c9('0x49')](db[_0x74c9('0x58')]['rawAttributes']);_0x1a689c[_0x74c9('0x36')]=_['keys'](_0x437137[_0x74c9('0x36')]);_0x1a689c['filters']=_['intersection'](_0x1a689c[_0x74c9('0x35')],_0x1a689c[_0x74c9('0x36')]);_0x2d120e['attributes']=_[_0x74c9('0x4a')](_0x1a689c[_0x74c9('0x35')],qs[_0x74c9('0x39')](_0x437137[_0x74c9('0x36')][_0x74c9('0x39')]));_0x2d120e['attributes']=_0x2d120e[_0x74c9('0x38')][_0x74c9('0x3a')]?_0x2d120e['attributes']:_0x1a689c[_0x74c9('0x35')];_0x2d120e[_0x74c9('0x3d')]=qs[_0x74c9('0x3e')](_0x437137['query'][_0x74c9('0x3e')]);_0x2d120e['where']=qs[_0x74c9('0x37')](_[_0x74c9('0x40')](_0x437137['query'],_0x1a689c[_0x74c9('0x37')]));if(_0x437137[_0x74c9('0x36')][_0x74c9('0x41')]){_0x2d120e[_0x74c9('0x3f')]=_[_0x74c9('0x42')](_0x2d120e['where'],{'$or':_[_0x74c9('0x30')](_0x2d120e[_0x74c9('0x38')],function(_0x1ff015){var _0x46f4e1={};_0x46f4e1[_0x1ff015]={'$like':'%'+_0x437137[_0x74c9('0x36')]['filter']+'%'};return _0x46f4e1;})});}_0x2d120e=_['merge']({},_0x2d120e,_0x437137[_0x74c9('0x59')]);return _0x1b54b5[_0x74c9('0x56')](_0x2d120e);}})[_0x74c9('0x29')](function(_0x3cab18){if(_0x3cab18){_0x3193ae=_0x3cab18[_0x74c9('0x3a')];if(!_0x437137[_0x74c9('0x36')][_0x74c9('0x3b')]('nolimit')){_0x2d120e['limit']=qs['limit'](_0x437137[_0x74c9('0x36')][_0x74c9('0x24')]);_0x2d120e['offset']=qs['offset'](_0x437137[_0x74c9('0x36')][_0x74c9('0x23')]);}return _0x1b54b5['getMembers'](_0x2d120e);}})[_0x74c9('0x29')](function(_0x32bdef){if(_0x32bdef){return _0x32bdef?{'count':_0x3193ae,'rows':_0x32bdef}:null;}})[_0x74c9('0x29')](respondWithResult(_0x37d502,null))['catch'](handleError(_0x37d502,null));};exports[_0x74c9('0x5a')]=function(_0x169e66,_0x81ae0,_0x5ed52a){return db[_0x74c9('0x31')][_0x74c9('0x4b')]({'where':{'id':_0x169e66[_0x74c9('0x48')]['id']}})[_0x74c9('0x29')](handleEntityNotFound(_0x81ae0,null))[_0x74c9('0x29')](function(_0x15f49f){if(_0x15f49f){return _0x15f49f[_0x74c9('0x5a')](_0x169e66[_0x74c9('0x36')][_0x74c9('0x54')]);}})[_0x74c9('0x29')](respondWithStatusCode(_0x81ae0,null))[_0x74c9('0x46')](handleError(_0x81ae0,null));};exports[_0x74c9('0x5b')]=function(_0x72298c,_0x2bd2c7,_0x5d114d){if(_0x72298c[_0x74c9('0x4e')]['id']){delete _0x72298c[_0x74c9('0x4e')]['id'];}return db[_0x74c9('0x31')][_0x74c9('0x4b')]({'where':{'id':_0x72298c['params']['id']}})[_0x74c9('0x29')](handleEntityNotFound(_0x2bd2c7,null))[_0x74c9('0x29')](function(_0x2428fe){if(_0x2428fe){_0x72298c[_0x74c9('0x4e')]['ChatGroupId']=_0x2428fe['id'];return db[_0x74c9('0x51')][_0x74c9('0x4c')](_0x72298c[_0x74c9('0x4e')]);}})[_0x74c9('0x29')](respondWithResult(_0x2bd2c7,null))['catch'](handleError(_0x2bd2c7,null));};exports['getMessages']=function(_0x7e85c5,_0x318c8b,_0x3fd6b1){var _0x2ae3cd={};var _0x3cd213={};var _0x1908e4;var _0x24f33a;return db['ChatGroup'][_0x74c9('0x57')]({'where':{'id':_0x7e85c5['params']['id']}})['then'](handleEntityNotFound(_0x318c8b,null))['then'](function(_0xc3e524){if(_0xc3e524){_0x1908e4=_0xc3e524;_0x3cd213['model']=_[_0x74c9('0x49')](db[_0x74c9('0x51')]['rawAttributes']);_0x3cd213[_0x74c9('0x36')]=_[_0x74c9('0x49')](_0x7e85c5[_0x74c9('0x36')]);_0x3cd213[_0x74c9('0x37')]=_[_0x74c9('0x4a')](_0x3cd213['model'],_0x3cd213[_0x74c9('0x36')]);_0x2ae3cd[_0x74c9('0x38')]=_[_0x74c9('0x4a')](_0x3cd213[_0x74c9('0x35')],qs[_0x74c9('0x39')](_0x7e85c5[_0x74c9('0x36')][_0x74c9('0x39')]));_0x2ae3cd[_0x74c9('0x38')]=_0x2ae3cd['attributes'][_0x74c9('0x3a')]?_0x2ae3cd[_0x74c9('0x38')]:_0x3cd213[_0x74c9('0x35')];_0x2ae3cd['order']=qs['sort'](_0x7e85c5[_0x74c9('0x36')]['sort']);_0x2ae3cd[_0x74c9('0x3f')]=qs[_0x74c9('0x37')](_['pick'](_0x7e85c5[_0x74c9('0x36')],_0x3cd213[_0x74c9('0x37')]));if(_0x7e85c5['query'][_0x74c9('0x41')]){_0x2ae3cd[_0x74c9('0x3f')]=_[_0x74c9('0x42')](_0x2ae3cd[_0x74c9('0x3f')],{'$or':_[_0x74c9('0x30')](_0x2ae3cd['attributes'],function(_0x4e63e9){var _0x2d26c8={};_0x2d26c8[_0x4e63e9]={'$like':'%'+_0x7e85c5[_0x74c9('0x36')][_0x74c9('0x41')]+'%'};return _0x2d26c8;})});}if(_0x7e85c5[_0x74c9('0x36')][_0x74c9('0x5c')]){var _0x3c1014=_0x7e85c5['query']['$gte'][_0x74c9('0x5d')](',');var _0x39ab25={};_0x39ab25[_0x3c1014[0x0]]={'$gte':moment(_0x3c1014[0x1])[_0x74c9('0x5e')](_0x74c9('0x5f'))};_0x2ae3cd[_0x74c9('0x3f')]=_[_0x74c9('0x42')](_0x2ae3cd[_0x74c9('0x3f')],_0x39ab25);}_0x2ae3cd=_[_0x74c9('0x42')]({},_0x2ae3cd,_0x7e85c5['options']);return _0x1908e4[_0x74c9('0x60')](_0x2ae3cd);}})['then'](function(_0x39d64e){if(_0x39d64e){_0x24f33a=_0x39d64e[_0x74c9('0x3a')];if(!_0x7e85c5['query'][_0x74c9('0x3b')](_0x74c9('0x3c'))){_0x2ae3cd[_0x74c9('0x24')]=qs['limit'](_0x7e85c5[_0x74c9('0x36')][_0x74c9('0x24')]);_0x2ae3cd[_0x74c9('0x23')]=qs['offset'](_0x7e85c5[_0x74c9('0x36')][_0x74c9('0x23')]);}return _0x1908e4['getMessages'](_0x2ae3cd);}})['then'](function(_0x18ce49){if(_0x18ce49){return _0x18ce49?{'count':_0x24f33a,'rows':_0x18ce49}:null;}})[_0x74c9('0x29')](respondWithResult(_0x318c8b,null))[_0x74c9('0x46')](handleError(_0x318c8b,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index ecee113..0de0caa 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 _0x4a9f=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatGroup','save','update','remove','emit'];(function(_0x1702b8,_0x28c7da){var _0x50028a=function(_0x4135b1){while(--_0x4135b1){_0x1702b8['push'](_0x1702b8['shift']());}};_0x50028a(++_0x28c7da);}(_0x4a9f,0x67));var _0xf4a9=function(_0x593310,_0x17b9e9){_0x593310=_0x593310-0x0;var _0x1ea007=_0x4a9f[_0x593310];return _0x1ea007;};'use strict';var EventEmitter=require(_0xf4a9('0x0'));var ChatGroup=require(_0xf4a9('0x1'))['db'][_0xf4a9('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf4a9('0x3'),'afterUpdate':_0xf4a9('0x4'),'afterDestroy':_0xf4a9('0x5')};function emitEvent(_0x39a5a3){return function(_0x3995a4,_0x27327f,_0x12e29d){ChatGroupEvents[_0xf4a9('0x6')](_0x39a5a3+':'+_0x3995a4['id'],_0x3995a4);ChatGroupEvents['emit'](_0x39a5a3,_0x3995a4);_0x12e29d(null);};}for(var e in events){if(events[_0xf4a9('0x7')](e)){var event=events[e];ChatGroup[_0xf4a9('0x8')](e,emitEvent(event));}}module[_0xf4a9('0x9')]=ChatGroupEvents; \ No newline at end of file +var _0xcf2e=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','ChatGroup'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xcf2e,0x197));var _0xecf2=function(_0x11bf38,_0x213d7f){_0x11bf38=_0x11bf38-0x0;var _0x202699=_0xcf2e[_0x11bf38];return _0x202699;};'use strict';var EventEmitter=require(_0xecf2('0x0'));var ChatGroup=require(_0xecf2('0x1'))['db'][_0xecf2('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xecf2('0x3')](0x0);var events={'afterCreate':_0xecf2('0x4'),'afterUpdate':_0xecf2('0x5'),'afterDestroy':_0xecf2('0x6')};function emitEvent(_0x26b249){return function(_0x4306cc,_0x57f63f,_0x14a022){ChatGroupEvents[_0xecf2('0x7')](_0x26b249+':'+_0x4306cc['id'],_0x4306cc);ChatGroupEvents[_0xecf2('0x7')](_0x26b249,_0x4306cc);_0x14a022(null);};}for(var e in events){if(events[_0xecf2('0x8')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0xecf2('0x9')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 75aaa25..8a06c27 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 _0x6f1d=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatGroup.attributes','define','ChatGroup'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6f1d,0x108));var _0xd6f1=function(_0x5f5755,_0x16da30){_0x5f5755=_0x5f5755-0x0;var _0x37443b=_0x6f1d[_0x5f5755];return _0x37443b;};'use strict';var _=require(_0xd6f1('0x0'));var util=require(_0xd6f1('0x1'));var logger=require(_0xd6f1('0x2'))(_0xd6f1('0x3'));var moment=require(_0xd6f1('0x4'));var BPromise=require(_0xd6f1('0x5'));var rp=require(_0xd6f1('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd6f1('0x7'));var config=require(_0xd6f1('0x8'));var attributes=require(_0xd6f1('0x9'));module['exports']=function(_0xd253d8,_0x5055eb){return _0xd253d8[_0xd6f1('0xa')](_0xd6f1('0xb'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x59e5=['path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','util','../../config/logger','api','moment','request-promise'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x59e5,0x167));var _0x559e=function(_0xee7df5,_0x90827c){_0xee7df5=_0xee7df5-0x0;var _0x149d03=_0x59e5[_0xee7df5];return _0x149d03;};'use strict';var _=require('lodash');var util=require(_0x559e('0x0'));var logger=require(_0x559e('0x1'))(_0x559e('0x2'));var moment=require(_0x559e('0x3'));var BPromise=require('bluebird');var rp=require(_0x559e('0x4'));var fs=require('fs');var path=require(_0x559e('0x5'));var rimraf=require(_0x559e('0x6'));var config=require(_0x559e('0x7'));var attributes=require(_0x559e('0x8'));module[_0x559e('0x9')]=function(_0xf192c5,_0x3b6229){return _0xf192c5[_0x559e('0xa')](_0x559e('0xb'),attributes,{'tableName':_0x559e('0xc'),'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 612399f..463f501 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 _0xe002=['localhost','socket.io-emitter','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x317a57,_0x132716){var _0x12ac0f=function(_0xdc6529){while(--_0xdc6529){_0x317a57['push'](_0x317a57['shift']());}};_0x12ac0f(++_0x132716);}(_0xe002,0xf7));var _0x2e00=function(_0x628eee,_0x3f3fba){_0x628eee=_0x628eee-0x0;var _0x447718=_0xe002[_0x628eee];return _0x447718;};'use strict';var _=require(_0x2e00('0x0'));var util=require(_0x2e00('0x1'));var moment=require(_0x2e00('0x2'));var BPromise=require('bluebird');var rs=require(_0x2e00('0x3'));var fs=require('fs');var Redis=require(_0x2e00('0x4'));var db=require(_0x2e00('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2e00('0x6'))(_0x2e00('0x7'));var config=require(_0x2e00('0x8'));var jayson=require(_0x2e00('0x9'));var client=jayson[_0x2e00('0xa')][_0x2e00('0xb')]({'port':0x232a});config[_0x2e00('0xc')]=_[_0x2e00('0xd')](config['redis'],{'host':_0x2e00('0xe'),'port':0x18eb});var socket=require(_0x2e00('0xf'))(new Redis(config['redis']));require(_0x2e00('0x10'))[_0x2e00('0x11')](socket);function respondWithRpcPromise(_0x1797c4,_0x2e5f9d,_0x4ad57e){return new BPromise(function(_0x5dc42f,_0x3841a0){return client[_0x2e00('0x12')](_0x1797c4,_0x4ad57e)[_0x2e00('0x13')](function(_0x4963cc){logger[_0x2e00('0x14')](_0x2e00('0x15'),_0x2e5f9d,_0x2e00('0x16'));logger[_0x2e00('0x17')](_0x2e00('0x18'),_0x2e5f9d,'request\x20sent',JSON['stringify'](_0x4963cc));if(_0x4963cc[_0x2e00('0x19')]){if(_0x4963cc[_0x2e00('0x19')][_0x2e00('0x1a')]===0x1f4){logger[_0x2e00('0x19')](_0x2e00('0x15'),_0x2e5f9d,_0x4963cc['error'][_0x2e00('0x1b')]);return _0x3841a0(_0x4963cc['error'][_0x2e00('0x1b')]);}logger[_0x2e00('0x19')]('ChatGroup,\x20%s,\x20%s',_0x2e5f9d,_0x4963cc[_0x2e00('0x19')][_0x2e00('0x1b')]);return _0x5dc42f(_0x4963cc[_0x2e00('0x19')][_0x2e00('0x1b')]);}else{logger['info'](_0x2e00('0x15'),_0x2e5f9d,_0x2e00('0x16'));_0x5dc42f(_0x4963cc['result'][_0x2e00('0x1b')]);}})[_0x2e00('0x1c')](function(_0x1620ec){logger['error'](_0x2e00('0x15'),_0x2e5f9d,_0x1620ec);_0x3841a0(_0x1620ec);});});} \ No newline at end of file +var _0x639d=['code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x2742db,_0x58e00c){var _0x18659e=function(_0x5bd3ac){while(--_0x5bd3ac){_0x2742db['push'](_0x2742db['shift']());}};_0x18659e(++_0x58e00c);}(_0x639d,0xbb));var _0xd639=function(_0xcb140d,_0x29ceca){_0xcb140d=_0xcb140d-0x0;var _0x3cf4b7=_0x639d[_0xcb140d];return _0x3cf4b7;};'use strict';var _=require(_0xd639('0x0'));var util=require(_0xd639('0x1'));var moment=require(_0xd639('0x2'));var BPromise=require('bluebird');var rs=require(_0xd639('0x3'));var fs=require('fs');var Redis=require(_0xd639('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd639('0x5'));var logger=require('../../config/logger')(_0xd639('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd639('0x7')][_0xd639('0x8')]({'port':0x232a});config[_0xd639('0x9')]=_[_0xd639('0xa')](config[_0xd639('0x9')],{'host':_0xd639('0xb'),'port':0x18eb});var socket=require(_0xd639('0xc'))(new Redis(config[_0xd639('0x9')]));require('./chatGroup.socket')[_0xd639('0xd')](socket);function respondWithRpcPromise(_0x2a48dc,_0x1f12aa,_0x44bcb1){return new BPromise(function(_0x135268,_0x2a6bf5){return client[_0xd639('0xe')](_0x2a48dc,_0x44bcb1)[_0xd639('0xf')](function(_0x3d93dc){logger['info'](_0xd639('0x10'),_0x1f12aa,_0xd639('0x11'));logger[_0xd639('0x12')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x1f12aa,_0xd639('0x11'),JSON[_0xd639('0x13')](_0x3d93dc));if(_0x3d93dc[_0xd639('0x14')]){if(_0x3d93dc['error'][_0xd639('0x15')]===0x1f4){logger[_0xd639('0x14')]('ChatGroup,\x20%s,\x20%s',_0x1f12aa,_0x3d93dc[_0xd639('0x14')][_0xd639('0x16')]);return _0x2a6bf5(_0x3d93dc['error'][_0xd639('0x16')]);}logger[_0xd639('0x14')](_0xd639('0x10'),_0x1f12aa,_0x3d93dc[_0xd639('0x14')][_0xd639('0x16')]);return _0x135268(_0x3d93dc['error'][_0xd639('0x16')]);}else{logger[_0xd639('0x17')](_0xd639('0x10'),_0x1f12aa,'request\x20sent');_0x135268(_0x3d93dc[_0xd639('0x18')][_0xd639('0x16')]);}})[_0xd639('0x19')](function(_0x5cc42a){logger[_0xd639('0x14')](_0xd639('0x10'),_0x1f12aa,_0x5cc42a);_0x2a6bf5(_0x5cc42a);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index bf65403..8baa742 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 _0x0221=['removeListener','register','length','chatGroup:','remove','update'];(function(_0x3c4a7c,_0x2f4e3c){var _0xf13d1e=function(_0x24cb78){while(--_0x24cb78){_0x3c4a7c['push'](_0x3c4a7c['shift']());}};_0xf13d1e(++_0x2f4e3c);}(_0x0221,0x13c));var _0x1022=function(_0x294934,_0x502e35){_0x294934=_0x294934-0x0;var _0x2aa538=_0x0221[_0x294934];return _0x2aa538;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=['save',_0x1022('0x0'),_0x1022('0x1')];function createListener(_0x6398f6,_0x4f2565){return function(_0x41ac37){_0x4f2565['emit'](_0x6398f6,_0x41ac37);};}function removeListener(_0x358672,_0x92c096){return function(){ChatGroupEvents[_0x1022('0x2')](_0x358672,_0x92c096);};}exports[_0x1022('0x3')]=function(_0x5eebba){for(var _0x5a295f=0x0,_0x39e0ad=events[_0x1022('0x4')];_0x5a295f<_0x39e0ad;_0x5a295f++){var _0x2863f9=events[_0x5a295f];var _0x2907ec=createListener(_0x1022('0x5')+_0x2863f9,_0x5eebba);ChatGroupEvents['on'](_0x2863f9,_0x2907ec);}}; \ No newline at end of file +var _0x1887=['emit','removeListener','length','chatGroup:','./chatGroup.events','remove','update'];(function(_0x3dfa3e,_0x293558){var _0x3ff9ed=function(_0x400e9b){while(--_0x400e9b){_0x3dfa3e['push'](_0x3dfa3e['shift']());}};_0x3ff9ed(++_0x293558);}(_0x1887,0x1a1));var _0x7188=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1887[_0x3dd15e];return _0x231fd0;};'use strict';var ChatGroupEvents=require(_0x7188('0x0'));var events=['save',_0x7188('0x1'),_0x7188('0x2')];function createListener(_0x1715f8,_0x1ec03c){return function(_0x826126){_0x1ec03c[_0x7188('0x3')](_0x1715f8,_0x826126);};}function removeListener(_0x4f6016,_0x2876d3){return function(){ChatGroupEvents[_0x7188('0x4')](_0x4f6016,_0x2876d3);};}exports['register']=function(_0x185bbc){for(var _0x1b1796=0x0,_0x891264=events[_0x7188('0x5')];_0x1b1796<_0x891264;_0x1b1796++){var _0x8d33cc=events[_0x1b1796];var _0x56137d=createListener(_0x7188('0x6')+_0x8d33cc,_0x185bbc);ChatGroupEvents['on'](_0x8d33cc,_0x56137d);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 0a58198..7857e1a 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 _0xa968=['delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/unread','getMembers','/:id/messages','getMessages','post','create','/:id/members','addMembers','addMessage','put'];(function(_0x263f4c,_0x438626){var _0x3a78d3=function(_0xbdb00f){while(--_0xbdb00f){_0x263f4c['push'](_0x263f4c['shift']());}};_0x3a78d3(++_0x438626);}(_0xa968,0xe2));var _0x8a96=function(_0x356f0b,_0x3cc06a){_0x356f0b=_0x356f0b-0x0;var _0x3b0910=_0xa968[_0x356f0b];return _0x3b0910;};'use strict';var multer=require(_0x8a96('0x0'));var util=require(_0x8a96('0x1'));var path=require(_0x8a96('0x2'));var timeout=require(_0x8a96('0x3'));var express=require(_0x8a96('0x4'));var router=express[_0x8a96('0x5')]();var fs_extra=require(_0x8a96('0x6'));var auth=require(_0x8a96('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8a96('0x8'));var controller=require('./chatGroup.controller');router[_0x8a96('0x9')]('/',auth['isAuthenticated'](),controller[_0x8a96('0xa')]);router[_0x8a96('0x9')](_0x8a96('0xb'),auth[_0x8a96('0xc')](),controller[_0x8a96('0xd')]);router[_0x8a96('0x9')](_0x8a96('0xe'),auth[_0x8a96('0xc')](),controller[_0x8a96('0xf')]);router['get'](_0x8a96('0x10'),auth[_0x8a96('0xc')](),controller['getUnread']);router['get']('/:id/members',auth[_0x8a96('0xc')](),controller[_0x8a96('0x11')]);router[_0x8a96('0x9')](_0x8a96('0x12'),auth[_0x8a96('0xc')](),controller[_0x8a96('0x13')]);router[_0x8a96('0x14')]('/',auth[_0x8a96('0xc')](),controller[_0x8a96('0x15')]);router['post'](_0x8a96('0x16'),auth[_0x8a96('0xc')](),controller[_0x8a96('0x17')]);router[_0x8a96('0x14')](_0x8a96('0x12'),auth[_0x8a96('0xc')](),controller[_0x8a96('0x18')]);router[_0x8a96('0x19')](_0x8a96('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x8a96('0x1a')](_0x8a96('0xe'),auth[_0x8a96('0xc')](),controller[_0x8a96('0x1b')]);router[_0x8a96('0x1a')](_0x8a96('0x16'),auth['isAuthenticated'](),controller['removeMembers']);module['exports']=router; \ No newline at end of file +var _0x485b=['delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','create','post','put','update'];(function(_0x8b83dd,_0x495e25){var _0x456f0f=function(_0x20b0bf){while(--_0x20b0bf){_0x8b83dd['push'](_0x8b83dd['shift']());}};_0x456f0f(++_0x495e25);}(_0x485b,0x6b));var _0xb485=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0x485b[_0x1b349a];return _0x5d1f7c;};'use strict';var multer=require(_0xb485('0x0'));var util=require('util');var path=require(_0xb485('0x1'));var timeout=require(_0xb485('0x2'));var express=require('express');var router=express[_0xb485('0x3')]();var fs_extra=require(_0xb485('0x4'));var auth=require(_0xb485('0x5'));var interaction=require(_0xb485('0x6'));var config=require(_0xb485('0x7'));var controller=require('./chatGroup.controller');router[_0xb485('0x8')]('/',auth[_0xb485('0x9')](),controller[_0xb485('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xb485('0x8')](_0xb485('0xb'),auth['isAuthenticated'](),controller[_0xb485('0xc')]);router[_0xb485('0x8')](_0xb485('0xd'),auth[_0xb485('0x9')](),controller[_0xb485('0xe')]);router[_0xb485('0x8')](_0xb485('0xf'),auth[_0xb485('0x9')](),controller[_0xb485('0x10')]);router[_0xb485('0x8')](_0xb485('0x11'),auth[_0xb485('0x9')](),controller[_0xb485('0x12')]);router['post']('/',auth[_0xb485('0x9')](),controller[_0xb485('0x13')]);router[_0xb485('0x14')](_0xb485('0xf'),auth[_0xb485('0x9')](),controller['addMembers']);router['post'](_0xb485('0x11'),auth[_0xb485('0x9')](),controller['addMessage']);router[_0xb485('0x15')](_0xb485('0xb'),auth[_0xb485('0x9')](),controller[_0xb485('0x16')]);router[_0xb485('0x17')](_0xb485('0xb'),auth[_0xb485('0x9')](),controller[_0xb485('0x18')]);router['delete'](_0xb485('0xf'),auth[_0xb485('0x9')](),controller['removeMembers']);module[_0xb485('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 0ad5cb9..4c40118 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 _0x6947=['DATE','long','out','BOOLEAN','exports','INTEGER','ENUM','star','thumb','TEXT','STRING'];(function(_0x5eb5ce,_0xeb9b44){var _0xaa7cf8=function(_0x379535){while(--_0x379535){_0x5eb5ce['push'](_0x5eb5ce['shift']());}};_0xaa7cf8(++_0xeb9b44);}(_0x6947,0x72));var _0x7694=function(_0x2c9a9a,_0xeadcbb){_0x2c9a9a=_0x2c9a9a-0x0;var _0x4210d8=_0x6947[_0x2c9a9a];return _0x4210d8;};'use strict';var Sequelize=require('sequelize');module[_0x7694('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x7694('0x1')]},'ratingType':{'type':Sequelize[_0x7694('0x2')](_0x7694('0x3'),_0x7694('0x4')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x7694('0x5')]},'mailTranscript':{'type':Sequelize[_0x7694('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x7694('0x7')]},'disposition':{'type':Sequelize[_0x7694('0x6')]},'secondDisposition':{'type':Sequelize[_0x7694('0x6')]},'thirdDisposition':{'type':Sequelize[_0x7694('0x6')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x7694('0x6')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x7694('0x6')]},'osVersion':{'type':Sequelize[_0x7694('0x6')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x7694('0x6')]},'deviceType':{'type':Sequelize[_0x7694('0x6')]},'referer':{'type':Sequelize[_0x7694('0x5')]},'customerIp':{'type':Sequelize[_0x7694('0x6')]},'formData':{'type':Sequelize[_0x7694('0x5')](_0x7694('0x8'))},'read1stAt':{'type':Sequelize[_0x7694('0x7')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x7694('0x2')]('in',_0x7694('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x7694('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x7694('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x7694('0xa')],'defaultValue':![]}}; \ No newline at end of file +var _0x97f5=['STRING','DATE','ENUM','out','sequelize','exports','BOOLEAN','star','thumb','TEXT'];(function(_0x515afd,_0x1a1e91){var _0x536d53=function(_0x1d3a89){while(--_0x1d3a89){_0x515afd['push'](_0x515afd['shift']());}};_0x536d53(++_0x1a1e91);}(_0x97f5,0x72));var _0x597f=function(_0x5a759d,_0xaf657){_0x5a759d=_0x5a759d-0x0;var _0x8c003=_0x97f5[_0x5a759d];return _0x8c003;};'use strict';var Sequelize=require(_0x597f('0x0'));module[_0x597f('0x1')]={'closed':{'type':Sequelize[_0x597f('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize['ENUM'](_0x597f('0x3'),_0x597f('0x4')),'defaultValue':_0x597f('0x3')},'ratingMessage':{'type':Sequelize[_0x597f('0x5')]},'pathTranscript':{'type':Sequelize[_0x597f('0x5')]},'mailTranscript':{'type':Sequelize[_0x597f('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x597f('0x7')]},'disposition':{'type':Sequelize[_0x597f('0x6')]},'secondDisposition':{'type':Sequelize[_0x597f('0x6')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x597f('0x6')]},'browserName':{'type':Sequelize[_0x597f('0x6')]},'browserVersion':{'type':Sequelize[_0x597f('0x6')]},'osName':{'type':Sequelize[_0x597f('0x6')]},'osVersion':{'type':Sequelize[_0x597f('0x6')]},'deviceModel':{'type':Sequelize[_0x597f('0x6')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x597f('0x6')]},'referer':{'type':Sequelize[_0x597f('0x5')]},'customerIp':{'type':Sequelize[_0x597f('0x6')]},'formData':{'type':Sequelize['TEXT']('long')},'read1stAt':{'type':Sequelize[_0x597f('0x7')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x597f('0x8')]('in',_0x597f('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x597f('0x6')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x597f('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x597f('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index d265e23..757ed4a 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 _0x461a=['filters','attributes','intersection','fields','length','includeAll','include','merge','options','create','find','destroy','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','fullname','email','account','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','parse','metadata','ValidationError','Sequelize','Error\x20in\x20Vidaoo\x20configuration','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','CmContact','Contact','abandon','entity\x20not\x20found','UserId','AbandonInteraction','attachmentUpload','originalname','basename','file','filename','mimetype','attachmentDownload','closed','json','Unauthorized','attachId','ChatOfflineMessageId','join','root','offline-chat/','download','server/files/chat/upload/','format','transcript-%s.txt','Messages','User','ContactId','%s%d','agentAlias','System','Visitor','agentIdentifier','website_alias','agent_alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','mailTranscript','addMessage','ChatMessage','ids','order','sort','pick','where','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','getMyMessages','hasOwnProperty','nolimit','includeAgent','push','findAll','addTags','omit','spread','Tag','chatInteractionTags:save','removeTags','unix','toString','server','tmp','files','attachments','transcript-%d-%s.zip','firstName','lastName','createdAt','Account','Owner','get','Chat','N.A.','closedAt','disposition','browserName','osName','referer','customerPort','Attachment','existsSync','createReadStream','pipe','out','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','request-promise','path','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','register','jayson/promise','client','http','request','then','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','ChatInteraction,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','update','stack','name','send','render','body','contact','agent','index','map','ChatInteraction','fieldName','type','getOptions','chat','query','user','show','params','model','rawAttributes','keys'];(function(_0x5d8133,_0x584a11){var _0x495ad6=function(_0x4c5f9b){while(--_0x4c5f9b){_0x5d8133['push'](_0x5d8133['shift']());}};_0x495ad6(++_0x584a11);}(_0x461a,0x15c));var _0xa461=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x461a[_0x3dd15e];return _0x231fd0;};'use strict';var rimraf=require(_0xa461('0x0'));var zipdir=require(_0xa461('0x1'));var rp=require(_0xa461('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xa461('0x3'));var ejs=require(_0xa461('0x4'));var fs=require('fs');var _=require(_0xa461('0x5'));var Redis=require('ioredis');var interaction=require(_0xa461('0x6'));var qs=require(_0xa461('0x7'));var pdf=require(_0xa461('0x8'));var logger=require(_0xa461('0x9'))(_0xa461('0xa'));var config=require(_0xa461('0xb'));var db=require(_0xa461('0xc'))['db'];config['redis']=_['defaults'](config[_0xa461('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xa461('0xe'))(new Redis(config['redis']));require('./chatInteraction.socket')[_0xa461('0xf')](socket);var jayson=require(_0xa461('0x10'));var client=jayson[_0xa461('0x11')]['http']({'port':0x232b});var client9004=jayson[_0xa461('0x11')][_0xa461('0x12')]({'port':0x232c});function respondWithRpcPromise(_0xd9d1ef,_0x406168,_0x13dc55,_0x415348){return new BPromise(function(_0x1ce701,_0x4b9c1f){var _0x24cbf3=_0x415348||client;return _0x24cbf3[_0xa461('0x13')](_0xd9d1ef,_0x13dc55)[_0xa461('0x14')](function(_0x2e1cb4){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x406168,_0xa461('0x15'));logger[_0xa461('0x16')](_0xa461('0x17'),_0x406168,_0xa461('0x15'),JSON['stringify'](_0x2e1cb4));if(_0x2e1cb4[_0xa461('0x18')]){if(_0x2e1cb4[_0xa461('0x18')][_0xa461('0x19')]===0x1f4){logger[_0xa461('0x18')](_0xa461('0x1a'),_0x406168,_0x2e1cb4[_0xa461('0x18')]['message']);return _0x4b9c1f(_0x2e1cb4['error'][_0xa461('0x1b')]);}logger[_0xa461('0x18')](_0xa461('0x1a'),_0x406168,_0x2e1cb4[_0xa461('0x18')][_0xa461('0x1b')]);return _0x1ce701(_0x2e1cb4[_0xa461('0x18')][_0xa461('0x1b')]);}else{logger[_0xa461('0x1c')]('ChatInteraction,\x20%s,\x20%s',_0x406168,_0xa461('0x15'));_0x1ce701(_0x2e1cb4[_0xa461('0x1d')][_0xa461('0x1b')]);}})[_0xa461('0x1e')](function(_0x2ed32f){logger[_0xa461('0x18')](_0xa461('0x1a'),_0x406168,_0x2ed32f);_0x4b9c1f(_0x2ed32f);});});}function respondWithStatusCode(_0x1f3331,_0x53552f){_0x53552f=_0x53552f||0xcc;return function(_0x2639aa){if(_0x2639aa){return _0x1f3331[_0xa461('0x1f')](_0x53552f);}return _0x1f3331[_0xa461('0x20')](_0x53552f)[_0xa461('0x21')]();};}function respondWithResult(_0x15e173,_0xfe6d8f){_0xfe6d8f=_0xfe6d8f||0xc8;return function(_0x38a646){if(_0x38a646){return _0x15e173[_0xa461('0x20')](_0xfe6d8f)['json'](_0x38a646);}};}function respondWithFilteredResult(_0x13d01f,_0x2f8d4a){return function(_0x49cab5){if(_0x49cab5){var _0x3efec0=typeof _0x2f8d4a[_0xa461('0x22')]===_0xa461('0x23')&&typeof _0x2f8d4a[_0xa461('0x24')]==='undefined';var _0x556589=_0x49cab5[_0xa461('0x25')];var _0x48877c=_0x3efec0?0x0:_0x2f8d4a[_0xa461('0x22')];var _0x5f267e=_0x3efec0?_0x49cab5['count']:_0x2f8d4a[_0xa461('0x22')]+_0x2f8d4a['limit'];var _0x2fd0f9;if(_0x5f267e>=_0x556589){_0x5f267e=_0x556589;_0x2fd0f9=0xc8;}else{_0x2fd0f9=0xce;}_0x13d01f[_0xa461('0x20')](_0x2fd0f9);return _0x13d01f[_0xa461('0x26')](_0xa461('0x27'),_0x48877c+'-'+_0x5f267e+'/'+_0x556589)['json'](_0x49cab5);}return null;};}function saveUpdates(_0x11a6fe){return function(_0x1c172d){if(_0x1c172d){return _0x1c172d[_0xa461('0x28')](_0x11a6fe)[_0xa461('0x14')](function(_0x18078b){return _0x18078b;});}return null;};}function removeEntity(_0x42d127){return function(_0x37f844){if(_0x37f844){return _0x37f844['destroy']()[_0xa461('0x14')](function(){_0x42d127['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x591f9b){return function(_0xe2631f){if(!_0xe2631f){_0x591f9b[_0xa461('0x1f')](0x194);}return _0xe2631f;};}function handleError(_0x1d46af,_0x3c6767){_0x3c6767=_0x3c6767||0x1f4;return function(_0x2a61c3){logger['error'](_0x2a61c3[_0xa461('0x29')]);if(_0x2a61c3['name']){delete _0x2a61c3[_0xa461('0x2a')];}_0x1d46af['status'](_0x3c6767)[_0xa461('0x2b')](_0x2a61c3);};}function getMustacheRender(_0x1b1854,_0x117521){return Mustache[_0xa461('0x2c')](_0x1b1854,_['merge'](_0x117521[_0xa461('0x2d')],{'contact':_0x117521[_0xa461('0x2e')],'message':_0x117521[_0xa461('0x1b')],'agent':_0x117521[_0xa461('0x2f')],'interaction':_0x117521['interaction'],'account':_0x117521['account']}))||'';}exports[_0xa461('0x30')]=function(_0x3461b8,_0xd42b6){var _0x2e490f={};var _0x5950d8=_[_0xa461('0x31')](db[_0xa461('0x32')]['rawAttributes'],function(_0x3dd64e){return{'name':_0x3dd64e[_0xa461('0x33')],'type':_0x3dd64e[_0xa461('0x34')]['key']};});_0x2e490f=qs[_0xa461('0x35')](_0x5950d8,_0x3461b8);return interaction['findAll'](_0xa461('0x36'),_0x3461b8[_0xa461('0x37')],_0x3461b8[_0xa461('0x38')],_0x2e490f,_0x5950d8)[_0xa461('0x14')](respondWithFilteredResult(_0xd42b6,_0x2e490f))[_0xa461('0x1e')](handleError(_0xd42b6,null));};exports[_0xa461('0x39')]=function(_0x1ba84b,_0x48593f){var _0x44646a={'raw':![],'where':{'id':_0x1ba84b[_0xa461('0x3a')]['id']}},_0x322c9d={};_0x322c9d[_0xa461('0x3b')]=_['keys'](db[_0xa461('0x32')][_0xa461('0x3c')]);_0x322c9d[_0xa461('0x37')]=_[_0xa461('0x3d')](_0x1ba84b[_0xa461('0x37')]);_0x322c9d[_0xa461('0x3e')]=_['intersection'](_0x322c9d['model'],_0x322c9d[_0xa461('0x37')]);_0x44646a[_0xa461('0x3f')]=_[_0xa461('0x40')](_0x322c9d[_0xa461('0x3b')],qs[_0xa461('0x41')](_0x1ba84b[_0xa461('0x37')][_0xa461('0x41')]));_0x44646a[_0xa461('0x3f')]=_0x44646a[_0xa461('0x3f')][_0xa461('0x42')]?_0x44646a[_0xa461('0x3f')]:_0x322c9d['model'];if(_0x1ba84b[_0xa461('0x37')][_0xa461('0x43')]){_0x44646a[_0xa461('0x44')]=[{'all':!![]}];}_0x44646a=_[_0xa461('0x45')]({},_0x44646a,_0x1ba84b[_0xa461('0x46')]);return db[_0xa461('0x32')]['find'](_0x44646a)[_0xa461('0x14')](handleEntityNotFound(_0x48593f,null))[_0xa461('0x14')](respondWithResult(_0x48593f,null))[_0xa461('0x1e')](handleError(_0x48593f,null));};exports[_0xa461('0x47')]=function(_0x42909d,_0x38023b){return db['ChatInteraction'][_0xa461('0x47')](_0x42909d[_0xa461('0x2d')],{})[_0xa461('0x14')](respondWithResult(_0x38023b,0xc9))[_0xa461('0x1e')](handleError(_0x38023b,null));};exports['update']=function(_0x3e48c3,_0x272d49){if(_0x3e48c3[_0xa461('0x2d')]['id']){delete _0x3e48c3[_0xa461('0x2d')]['id'];}return db[_0xa461('0x32')][_0xa461('0x48')]({'where':{'id':_0x3e48c3[_0xa461('0x3a')]['id']}})[_0xa461('0x14')](handleEntityNotFound(_0x272d49,null))[_0xa461('0x14')](saveUpdates(_0x3e48c3['body'],null))[_0xa461('0x14')](respondWithResult(_0x272d49,null))[_0xa461('0x1e')](handleError(_0x272d49,null));};exports[_0xa461('0x49')]=function(_0xbf7a,_0x249979){return db['ChatInteraction']['find']({'where':{'id':_0xbf7a[_0xa461('0x3a')]['id']}})[_0xa461('0x14')](handleEntityNotFound(_0x249979,null))[_0xa461('0x14')](removeEntity(_0x249979,null))['catch'](handleError(_0x249979,null));};exports[_0xa461('0x4a')]=function(_0x194a6a,_0x481203){return db[_0xa461('0x32')][_0xa461('0x4a')]()['then'](respondWithResult(_0x481203,null))['catch'](handleError(_0x481203,null));};exports[_0xa461('0x4b')]=function(_0x503d46,_0x475dc1){var _0x2116ac=_0x503d46[_0xa461('0x3a')]['id'];var _0x321742;var _0x3704e8;var _0x585d7f;return db[_0xa461('0x32')][_0xa461('0x4c')]({'where':{'id':_0x2116ac}})['then'](function(_0x30aed1){_0x321742=_0x30aed1;return db[_0xa461('0x4d')][_0xa461('0x4c')]({'where':{'id':_0x30aed1[_0xa461('0x4e')]},'attributes':['id',_0xa461('0x4f'),_0xa461('0x50'),_0xa461('0x51'),_0xa461('0x52'),_0xa461('0x53')],'raw':!![]});})[_0xa461('0x14')](function(_0x265931){if(_0x265931&&_0x265931[_0xa461('0x4f')]&&_0x265931[_0xa461('0x50')]){_0x3704e8=_0x265931;var _0x4f7fa4={'interaction':{'id':_0x2116ac},'agent':{'id':_0x503d46[_0xa461('0x38')]['id'],'name':_0x503d46[_0xa461('0x38')][_0xa461('0x2a')],'fullname':_0x503d46['user'][_0xa461('0x54')],'email':_0x503d46[_0xa461('0x38')][_0xa461('0x55')]},'contact':_0x503d46[_0xa461('0x2d')][_0xa461('0x2e')],'account':_0x503d46[_0xa461('0x2d')][_0xa461('0x56')]};var _0x976fa6={'rejectUnauthorized':![],'method':_0xa461('0x57'),'url':_0xa461('0x58'),'headers':{'X-APIKEY':_0x265931[_0xa461('0x4f')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x503d46[_0xa461('0x38')]['email']],'buttons':null,'topic':_0x3704e8[_0xa461('0x51')],'note':_[_0xa461('0x59')](_0x3704e8[_0xa461('0x52')])?null:getMustacheRender(_0x3704e8[_0xa461('0x52')],_0x4f7fa4),'metadata':null},'redirect':_0xa461('0x5a'),'json':!![]};try{if(!_[_0xa461('0x59')](_0x3704e8[_0xa461('0x53')])){var _0x2f045c=getMustacheRender(_0x3704e8[_0xa461('0x53')],_0x4f7fa4);var _0x52f389=JSON[_0xa461('0x5b')](_0x2f045c);_0x976fa6['body'][_0xa461('0x5c')]=_0x52f389;}}catch(_0x3b4e4b){throw new db['Sequelize'][(_0xa461('0x5d'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x976fa6);}else{throw new db[(_0xa461('0x5e'))][(_0xa461('0x5d'))](_0xa461('0x5f'));}})['then'](function(_0x4bf773){_0x585d7f=_0x4bf773;if(_0x585d7f['id']){var _0x456626={'body':_0x585d7f['join_url'],'ChatWebsiteId':_0x3704e8['id'],'ChatInteractionId':_0x321742['id'],'direction':'out','UserId':_0x503d46[_0xa461('0x38')]['id']};return db['ChatMessage'][_0xa461('0x47')](_0x456626,{});}else{throw new db[(_0xa461('0x5e'))]['ValidationError'](_0xa461('0x60'));}})[_0xa461('0x14')](function(){return _0x321742['updateAttributes']({'vidaooSessionId':_0x585d7f['id']});})[_0xa461('0x14')](respondWithResult(_0x475dc1,null))[_0xa461('0x1e')](handleError(_0x475dc1,null));};exports[_0xa461('0x61')]=function(_0x27c96b,_0x37c078){if(_0x27c96b[_0xa461('0x2d')]['id']){delete _0x27c96b[_0xa461('0x2d')]['id'];}return db[_0xa461('0x32')][_0xa461('0x48')]({'where':{'id':_0x27c96b[_0xa461('0x3a')]['id']},'include':[{'model':db[_0xa461('0x62')],'as':_0xa461('0x63')}]})[_0xa461('0x14')](handleEntityNotFound(_0x37c078,null))['then'](saveUpdates(_0x27c96b[_0xa461('0x2d')],null))[_0xa461('0x14')](respondWithResult(_0x37c078,null))[_0xa461('0x1e')](handleError(_0x37c078,null));};exports[_0xa461('0x64')]=function(_0x467219,_0x51ea9d){if(_0x467219[_0xa461('0x2d')]['id']){delete _0x467219['body']['id'];}return db['ChatInteraction'][_0xa461('0x48')]({'where':{'id':_0x467219[_0xa461('0x3a')]['id']}})['then'](function(_0x5ac78f){if(!_0x5ac78f){logger['error']('abandonInteraction,\x20%s,\x20%s,\x20%s',_0xa461('0x64'),0x194,_0xa461('0x65'));_0x51ea9d[_0xa461('0x1f')](0x194);}else{if(_0x5ac78f[_0xa461('0x66')]){throw new db['Sequelize'][(_0xa461('0x5d'))]('Interaction\x20already\x20assigned');}}return _0x5ac78f;})[_0xa461('0x14')](function(_0x532475){if(_0x532475){return _0x532475[_0xa461('0x28')]({'closed':_0x467219['body']['closed'],'disposition':_0x467219['body']['disposition']})[_0xa461('0x14')](function(_0x3d28f3){return _0x3d28f3;});}})[_0xa461('0x14')](function(){return respondWithRpcPromise(_0xa461('0x67'),_0xa461('0x64'),_0x467219[_0xa461('0x2d')],client9004);})[_0xa461('0x14')](respondWithResult(_0x51ea9d,null))['catch'](handleError(_0x51ea9d,null));};exports[_0xa461('0x68')]=function(_0x3ed16a,_0x9e7c60){_0x3ed16a[_0xa461('0x2d')][_0xa461('0x2a')]=_0x3ed16a['file'][_0xa461('0x69')];_0x3ed16a[_0xa461('0x2d')][_0xa461('0x6a')]=_0x3ed16a[_0xa461('0x6b')][_0xa461('0x6c')];_0x3ed16a[_0xa461('0x2d')][_0xa461('0x34')]=_0x3ed16a[_0xa461('0x6b')][_0xa461('0x6d')];return db['Attachment'][_0xa461('0x47')](_0x3ed16a[_0xa461('0x2d')])['then'](respondWithResult(_0x9e7c60,0xc9))[_0xa461('0x1e')](handleError(_0x9e7c60,null));};exports[_0xa461('0x6e')]=function(_0xa530c9,_0x1e4914){return db[_0xa461('0x32')]['findOne']({'where':{'id':_0xa530c9[_0xa461('0x3a')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x1e4914,null))[_0xa461('0x14')](function(_0x510a63){if(_0x510a63){if(_0x510a63[_0xa461('0x6f')]){return _0x1e4914[_0xa461('0x20')](0x193)[_0xa461('0x70')]({'status':0x193,'message':_0xa461('0x71')});}return db['Attachment'][_0xa461('0x4c')]({'where':{'id':_0xa530c9['query'][_0xa461('0x72')]},'raw':!![]})['then'](handleEntityNotFound(_0x1e4914,null));}})[_0xa461('0x14')](function(_0xfe02b8){if(_0xfe02b8){var _0x5b0c4b=_0xfe02b8[_0xa461('0x73')]!==null;var _0x26dea0=path[_0xa461('0x74')](config[_0xa461('0x75')],'server/files/attachments/');if(_0x5b0c4b){_0x26dea0=path[_0xa461('0x74')](_0x26dea0,_0xa461('0x76'));}var _0x32fefb=path[_0xa461('0x74')](_0x26dea0,_0xfe02b8[_0xa461('0x6a')]);return _0x1e4914[_0xa461('0x77')](_0x32fefb);}})['catch'](handleError(_0x1e4914,null));};exports['close']=function(_0x303a20,_0x1a9a95){var _0x560fee=null;var _0x4a7e89=null;var _0x3b643f=null;if(_0x303a20[_0xa461('0x2d')]['id']){delete _0x303a20[_0xa461('0x2d')]['id'];}if(_0x303a20['body']['mailTranscript']){_0x3b643f=path['join'](config[_0xa461('0x75')],_0xa461('0x78'),util[_0xa461('0x79')](_0xa461('0x7a'),Date['now']()));_0x303a20[_0xa461('0x2d')]['pathTranscript']=_0x3b643f;}return db['ChatInteraction'][_0xa461('0x48')]({'where':{'id':_0x303a20['params']['id']},'include':[{'model':db['ChatMessage'],'as':_0xa461('0x7b'),'include':[{'model':db[_0xa461('0x7c')],'as':'User'}]}]})['then'](handleEntityNotFound(_0x1a9a95,null))['then'](saveUpdates(_0x303a20['body'],null))[_0xa461('0x14')](function(_0x4dafc9){if(_0x4dafc9){_0x560fee=_0x4dafc9;return db[_0xa461('0x4d')][_0xa461('0x48')]({'where':{'id':_0x560fee['ChatWebsiteId']}});}})[_0xa461('0x14')](function(_0x172870){if(_0x172870){_0x4a7e89=_0x172870;return db[_0xa461('0x62')][_0xa461('0x48')]({'where':{'id':_0x560fee[_0xa461('0x7d')]}});}})[_0xa461('0x14')](function(_0x370542){if(_0x370542){if(_0x3b643f){var _0x511404=null;for(var _0xff84ff=0x1;_0xff84ff<_0x560fee['Messages'][_0xa461('0x42')];++_0xff84ff){_0x511404=_0x560fee[_0xa461('0x7b')][_0xff84ff];var _0x398da2=_0x511404['UserId']?util[_0xa461('0x79')](_0xa461('0x7e'),_0x4a7e89[_0xa461('0x7f')],_0x511404[_0xa461('0x66')]):_0xa461('0x80');var _0x219fe7=_0x303a20[_0xa461('0x2d')]['customer']||util['format']('%s%d',_0xa461('0x81'),_0x511404[_0xa461('0x7d')]);switch(_0x4a7e89[_0xa461('0x82')]){case _0xa461('0x83'):_0x398da2=_0x511404[_0xa461('0x66')]?util[_0xa461('0x79')](_0xa461('0x7e'),_0x4a7e89[_0xa461('0x7f')],_0x511404[_0xa461('0x66')]):'System';break;case _0xa461('0x84'):_0x398da2=_0x511404[_0xa461('0x66')]?_0x511404[_0xa461('0x7c')]['alias']||_0x511404[_0xa461('0x7c')][_0xa461('0x54')]:_0xa461('0x80');break;case _0xa461('0x85'):_0x398da2=_0x511404[_0xa461('0x66')]?_0x511404[_0xa461('0x7c')]['fullname']:_0xa461('0x80');break;default:_0x398da2=_0x511404[_0xa461('0x66')]?util[_0xa461('0x79')](_0xa461('0x7e'),_0x4a7e89['agentAlias'],_0x511404[_0xa461('0x66')]):'System';}var _0x2c927c=util[_0xa461('0x79')](_0xa461('0x86'),moment(_0x511404['createdAt'])[_0xa461('0x79')]('MM/DD/YYYY\x20HH:mm:ss'),_0x511404[_0xa461('0x87')]==='in'?_0x219fe7:_0x398da2,_0x511404['body']);if(!_0x511404[_0xa461('0x88')]){fs[_0xa461('0x89')](_0x3b643f,_0x2c927c);}}return db[_0xa461('0x8a')][_0xa461('0x4c')]({'where':{'service':!![]},'include':[{'model':db[_0xa461('0x8b')],'as':_0xa461('0x8c'),'raw':!![],'include':[{'model':db[_0xa461('0x8d')],'as':_0xa461('0x8d'),'raw':!![]}]}]});}}})['then'](function(_0x2d8016){if(!_0x2d8016||!_0x2d8016[_0xa461('0x8c')]||!_0x303a20[_0xa461('0x2d')])return _0x560fee;var _0x52fd9e=_0x2d8016[_0xa461('0x8e')]();return respondWithRpcPromise(_0xa461('0x8f'),'sendMail',{'account':_0x52fd9e,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x2d8016['name'],_0x2d8016[_0xa461('0x55')]||_0x2d8016['Smtp'][_0xa461('0x38')]),'to':_0x303a20[_0xa461('0x2d')]['mailTranscript'],'subject':_0xa461('0x90'),'text':util['format'](_0xa461('0x91'),_0x303a20[_0xa461('0x2d')][_0xa461('0x92')]),'attachments':[{'path':_0x3b643f}]}})['then'](function(){return _0x560fee;})[_0xa461('0x1e')](function(_0x53bf68){logger[_0xa461('0x18')](_0x53bf68);});})[_0xa461('0x14')](respondWithStatusCode(_0x1a9a95,0xc8))[_0xa461('0x1e')](handleError(_0x1a9a95,null));};exports[_0xa461('0x93')]=function(_0x5c45b9,_0x137d67){return db[_0xa461('0x94')][_0xa461('0x48')]({'where':{'id':_0x5c45b9['params']['id']}})['then'](handleEntityNotFound(_0x137d67,null))['then'](function(_0x2fe6f6){if(_0x2fe6f6){return _0x2fe6f6[_0xa461('0x93')](_0x5c45b9[_0xa461('0x2d')][_0xa461('0x95')],_['omit'](_0x5c45b9['body'],[_0xa461('0x95'),'id'])||{});}})['then'](respondWithResult(_0x137d67,null))['catch'](handleError(_0x137d67,null));};exports['getMessages']=function(_0x545bbf,_0x1e8a14){var _0x3ea0a3={'raw':![],'where':{}};var _0x3ab62d={};var _0x5687bc={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xa461('0x4c')]({'where':{'id':_0x545bbf[_0xa461('0x3a')]['id']}})['then'](handleEntityNotFound(_0x1e8a14,null))[_0xa461('0x14')](function(_0x3df986){if(_0x3df986){_0x3ab62d[_0xa461('0x3b')]=_['keys'](db[_0xa461('0x94')]['rawAttributes']);_0x3ab62d[_0xa461('0x37')]=_[_0xa461('0x3d')](_0x545bbf[_0xa461('0x37')]);_0x3ab62d['filters']=_[_0xa461('0x40')](_0x3ab62d[_0xa461('0x3b')],_0x3ab62d['query']);_0x3ea0a3[_0xa461('0x3f')]=_[_0xa461('0x40')](_0x3ab62d[_0xa461('0x3b')],qs[_0xa461('0x41')](_0x545bbf[_0xa461('0x37')][_0xa461('0x41')]));_0x3ea0a3['attributes']=_0x3ea0a3['attributes'][_0xa461('0x42')]?_0x3ea0a3['attributes']:_0x3ab62d['model'];if(!_0x545bbf['query']['hasOwnProperty']('nolimit')){_0x3ea0a3['limit']=qs[_0xa461('0x24')](_0x545bbf[_0xa461('0x37')][_0xa461('0x24')]);_0x3ea0a3['offset']=qs[_0xa461('0x22')](_0x545bbf['query']['offset']);}_0x3ea0a3[_0xa461('0x96')]=qs[_0xa461('0x97')](_0x545bbf[_0xa461('0x37')]['sort']);_0x3ea0a3['where']=qs[_0xa461('0x3e')](_[_0xa461('0x98')](_0x545bbf['query'],_0x3ab62d['filters']));_0x3ea0a3[_0xa461('0x99')][_0xa461('0x9a')]=_0x3df986['id'];if(_0x545bbf[_0xa461('0x37')][_0xa461('0x9b')]){_0x3ea0a3[_0xa461('0x99')]=_[_0xa461('0x45')](_0x3ea0a3[_0xa461('0x99')],{'$or':_[_0xa461('0x31')](_0x3ea0a3[_0xa461('0x3f')],function(_0x4c2402){var _0x5e5195={};_0x5e5195[_0x4c2402]={'$like':'%'+_0x545bbf[_0xa461('0x37')][_0xa461('0x9b')]+'%'};return _0x5e5195;})});}if(_0x545bbf[_0xa461('0x37')][_0xa461('0x9c')]){var _0x5466fa=_0x545bbf['query'][_0xa461('0x9c')][_0xa461('0x9d')](',');var _0x1cafad={};_0x1cafad[_0x5466fa[0x0]]={'$gte':moment(_0x5466fa[0x1])['format'](_0xa461('0x9e'))};_0x3ea0a3[_0xa461('0x99')]=_['merge'](_0x3ea0a3[_0xa461('0x99')],_0x1cafad);}_0x3ea0a3=_[_0xa461('0x45')]({},_0x3ea0a3,_0x545bbf[_0xa461('0x46')]);return db['ChatMessage'][_0xa461('0x25')]({'where':_0x3ea0a3[_0xa461('0x99')]})[_0xa461('0x14')](function(_0x4ae074){_0x5687bc[_0xa461('0x25')]=_0x4ae074;if(_0x545bbf['query'][_0xa461('0x43')]){_0x3ea0a3['include']=[{'all':!![]}];}return db[_0xa461('0x94')]['findAll'](_0x3ea0a3);})['then'](function(_0x47f7b4){_0x5687bc[_0xa461('0x9f')]=_0x47f7b4;return _0x5687bc;});}})[_0xa461('0x14')](respondWithFilteredResult(_0x1e8a14,_0x3ea0a3))[_0xa461('0x1e')](handleError(_0x1e8a14,null));};exports[_0xa461('0xa0')]=function(_0x4f5635,_0xe4ac20){var _0x22095f={'where':{}},_0x1d56b9={},_0x3012e7={'count':0x0,'rows':[]};return db[_0xa461('0x32')][_0xa461('0x4c')]({'where':{'id':_0x4f5635[_0xa461('0x3a')]['id']}})['then'](handleEntityNotFound(_0xe4ac20,null))['then'](function(_0x59d381){if(_0x59d381){_0x1d56b9[_0xa461('0x3b')]=_['keys'](db[_0xa461('0x94')][_0xa461('0x3c')]);_0x1d56b9[_0xa461('0x37')]=_[_0xa461('0x3d')](_0x4f5635[_0xa461('0x37')]);_0x1d56b9['filters']=_[_0xa461('0x40')](_0x1d56b9['model'],_0x1d56b9[_0xa461('0x37')]);_0x22095f[_0xa461('0x3f')]=_[_0xa461('0x40')](_0x1d56b9[_0xa461('0x3b')],qs['fields'](_0x4f5635[_0xa461('0x37')][_0xa461('0x41')]));_0x22095f['attributes']=_0x22095f[_0xa461('0x3f')][_0xa461('0x42')]?_0x22095f[_0xa461('0x3f')]:_0x1d56b9[_0xa461('0x3b')];if(!_0x4f5635[_0xa461('0x37')][_0xa461('0xa1')](_0xa461('0xa2'))){_0x22095f[_0xa461('0x24')]=qs[_0xa461('0x24')](_0x4f5635['query'][_0xa461('0x24')]);_0x22095f[_0xa461('0x22')]=qs[_0xa461('0x22')](_0x4f5635[_0xa461('0x37')][_0xa461('0x22')]);}_0x22095f[_0xa461('0x96')]=qs[_0xa461('0x97')](_0x4f5635[_0xa461('0x37')]['sort']);_0x22095f['where']=qs[_0xa461('0x3e')](_[_0xa461('0x98')](_0x4f5635['query'],_0x1d56b9['filters']));_0x22095f[_0xa461('0x99')][_0xa461('0x9a')]=_0x59d381['id'];if(_0x4f5635[_0xa461('0x37')]['filter']){_0x22095f[_0xa461('0x99')]=_[_0xa461('0x45')](_0x22095f[_0xa461('0x99')],{'$or':_['map'](_0x22095f['attributes'],function(_0x4e256f){var _0x575a7e={};_0x575a7e[_0x4e256f]={'$like':'%'+_0x4f5635[_0xa461('0x37')]['filter']+'%'};return _0x575a7e;})});}_0x22095f[_0xa461('0x99')][_0xa461('0x88')]=![];if(_0x4f5635[_0xa461('0x37')]['id']){_0x22095f[_0xa461('0x99')]['id']={'$gt':_0x4f5635[_0xa461('0x37')]['id']};}_0x22095f=_[_0xa461('0x45')]({},_0x22095f,_0x4f5635[_0xa461('0x46')]);return db['ChatMessage'][_0xa461('0x25')]({'where':_0x22095f[_0xa461('0x99')]})[_0xa461('0x14')](function(_0x354c78){_0x3012e7[_0xa461('0x25')]=_0x354c78;_0x22095f[_0xa461('0x44')]=[];if(_0x4f5635['query'][_0xa461('0xa3')]){_0x22095f[_0xa461('0x44')][_0xa461('0xa4')]({'model':db[_0xa461('0x7c')],'as':_0xa461('0x7c'),'attributes':['id',_0xa461('0x54'),'alias']});}if(_0x4f5635[_0xa461('0x37')][_0xa461('0x43')]){_0x22095f[_0xa461('0x44')]=[{'all':!![]}];}return db[_0xa461('0x94')][_0xa461('0xa5')](_0x22095f);})[_0xa461('0x14')](function(_0x5d2386){_0x3012e7[_0xa461('0x9f')]=_0x5d2386;return _0x3012e7;});}})[_0xa461('0x14')](respondWithFilteredResult(_0xe4ac20,_0x22095f))[_0xa461('0x1e')](handleError(_0xe4ac20,null));};exports[_0xa461('0xa6')]=function(_0x2acf74,_0x5d13e7){return db[_0xa461('0x32')][_0xa461('0x48')]({'where':{'id':_0x2acf74[_0xa461('0x3a')]['id']}})[_0xa461('0x14')](handleEntityNotFound(_0x5d13e7,null))[_0xa461('0x14')](function(_0x505c8a){if(_0x505c8a){return _0x505c8a['setTags'](_0x2acf74['body'][_0xa461('0x95')],_[_0xa461('0xa7')](_0x2acf74[_0xa461('0x2d')],[_0xa461('0x95'),'id'])||{})[_0xa461('0xa8')](function(){return db[_0xa461('0xa9')][_0xa461('0xa5')]({'attributes':['id',_0xa461('0x2a'),'color'],'where':{'id':_0x2acf74[_0xa461('0x2d')][_0xa461('0x95')]}});})[_0xa461('0x14')](function(_0xc05b98){socket['emit'](_0xa461('0xaa'),{'id':Number(_0x2acf74[_0xa461('0x3a')]['id']),'tags':_0xc05b98||[]});return{'id':Number(_0x2acf74[_0xa461('0x3a')]['id']),'tags':_0xc05b98||[]};});}})[_0xa461('0x14')](respondWithResult(_0x5d13e7,null))[_0xa461('0x1e')](handleError(_0x5d13e7,null));};exports['removeTags']=function(_0x4dbe98,_0x4c6797){return db[_0xa461('0x32')][_0xa461('0x48')]({'where':{'id':_0x4dbe98['params']['id']}})[_0xa461('0x14')](handleEntityNotFound(_0x4c6797,null))[_0xa461('0x14')](function(_0x147089){if(_0x147089){return _0x147089[_0xa461('0xab')](_0x4dbe98[_0xa461('0x37')][_0xa461('0x95')]);}})['then'](respondWithStatusCode(_0x4c6797,null))[_0xa461('0x1e')](handleError(_0x4c6797,null));};exports[_0xa461('0x77')]=function(_0x21eb16,_0x22134e){var _0x41288d=moment()[_0xa461('0xac')]()[_0xa461('0xad')]();var _0xe7ee4a=path[_0xa461('0x74')](config[_0xa461('0x75')],_0xa461('0xae'),'files',_0xa461('0xaf'));var _0x1d0abe=path['join'](config['root'],_0xa461('0xae'),_0xa461('0xb0'),_0xa461('0xb1'));var _0xab220c=path[_0xa461('0x74')](_0xe7ee4a,_0x41288d);var _0x390b9f=util[_0xa461('0x79')](_0xa461('0xb2'),_0x21eb16[_0xa461('0x3a')]['id'],_0x41288d);var _0x34285b=path[_0xa461('0x74')](_0xe7ee4a,_0x390b9f);var _0x50b21c=[];_0x50b21c[_0xa461('0xa4')]({'model':db[_0xa461('0x7c')],'as':_0xa461('0x7c'),'attributes':['id',_0xa461('0x54')],'raw':!![]});_0x50b21c[_0xa461('0xa4')]({'model':db[_0xa461('0x62')],'as':_0xa461('0x63'),'attributes':['id',_0xa461('0xb3'),_0xa461('0xb4')],'raw':!![]});if(_0x21eb16['query'][_0xa461('0xb1')]){_0x50b21c[_0xa461('0xa4')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x54611b=[{'model':db[_0xa461('0x94')],'as':_0xa461('0x7b'),'attributes':['id','body',_0xa461('0xb5'),'direction','secret','read'],'include':_0x50b21c}];_0x54611b['push']({'model':db[_0xa461('0x4d')],'as':_0xa461('0xb6'),'attributes':['id',_0xa461('0x2a')]});_0x54611b['push']({'model':db[_0xa461('0x7c')],'as':_0xa461('0xb7'),'attributes':['id',_0xa461('0x54')]});return db[_0xa461('0x32')][_0xa461('0x48')]({'where':{'id':_0x21eb16[_0xa461('0x3a')]['id']},'include':_0x54611b})[_0xa461('0x14')](handleEntityNotFound(_0x22134e,null))[_0xa461('0x14')](function(_0x3b98c6){if(_0x3b98c6){var _0x3abe5d=_0x3b98c6[_0xa461('0xb8')]({'plain':!![]});fs['mkdirSync'](_0xab220c);var _0x5e2774={'channel':_0xa461('0xb9'),'account':_0x3abe5d[_0xa461('0xb6')][_0xa461('0x2a')],'agent':_0x3abe5d[_0xa461('0xb7')]?_0x3abe5d[_0xa461('0xb7')][_0xa461('0x54')]:_0xa461('0xba'),'createdAt':moment(_0x3abe5d[_0xa461('0xb5')])['format'](_0xa461('0x9e'))[_0xa461('0xad')](),'closedAt':_0x3abe5d[_0xa461('0x6f')]?moment(_0x3abe5d[_0xa461('0xbb')])[_0xa461('0x79')](_0xa461('0x9e'))[_0xa461('0xad')]():'','disposition':_0x3abe5d[_0xa461('0xbc')],'chatInfo':{'browser':_0x3abe5d[_0xa461('0xbd')],'os':_0x3abe5d[_0xa461('0xbe')],'referer':_0x3abe5d[_0xa461('0xbf')],'customerIp':_0x3abe5d['customerIp'],'customerPort':_0x3abe5d['customerPort']?_0x3abe5d[_0xa461('0xc0')]:_0xa461('0xba')},'messages':_(_0x3abe5d[_0xa461('0x7b')])['tail']()['filter']({'secret':![]})['map'](function(_0x5ea11b){if(_0x5ea11b['Attachment']){var _0x4f0300=path[_0xa461('0x74')](_0x1d0abe,_0x5ea11b[_0xa461('0xc1')][_0xa461('0x6a')]);if(fs[_0xa461('0xc2')](_0x4f0300)){fs[_0xa461('0xc3')](_0x4f0300)[_0xa461('0xc4')](fs['createWriteStream'](path[_0xa461('0x74')](_0xab220c,_0x5ea11b['Attachment'][_0xa461('0x6a')])));}}return{'date':moment(_0x5ea11b['createdAt'])['format'](_0xa461('0x9e'))[_0xa461('0xad')](),'sender':_0x5ea11b[_0xa461('0x87')]===_0xa461('0xc5')?_0x5ea11b[_0xa461('0x7c')]?_0x5ea11b[_0xa461('0x7c')][_0xa461('0x54')]:_0xa461('0x80'):_0x5ea11b[_0xa461('0x63')][_0xa461('0xb3')]+(_0x5ea11b['Contact'][_0xa461('0xb4')]?'\x20'+_0x5ea11b['Contact'][_0xa461('0xb4')]:''),'body':_0x5ea11b[_0xa461('0xc1')]?_0x5ea11b[_0xa461('0xc1')][_0xa461('0x6a')]:_0x5ea11b[_0xa461('0x2d')],'direction':_0x5ea11b['direction']===_0xa461('0xc5')?'A':'C','secret':_0x5ea11b[_0xa461('0x88')],'read':_0x5ea11b['read'],'attachment':_0x5ea11b[_0xa461('0xc1')]};})['value']()};return ejs[_0xa461('0xc6')](path[_0xa461('0x74')](config[_0xa461('0x75')],'server','views',_0xa461('0xc7')),{'interaction':_0x5e2774})[_0xa461('0x14')](function(_0x14d4e6){var _0x2ce271=path[_0xa461('0x74')](_0xab220c,_0xa461('0xc8')+_0x3abe5d['id']+'-'+_0x41288d+_0xa461('0xc9'));var _0x44e43c={'path':_0x2ce271,'channel':_0xa461('0xb9'),'interactionId':_0x3abe5d['id']};return pdf[_0xa461('0xca')](_0x14d4e6,_0x44e43c);})[_0xa461('0x14')](function(){return new Promise(function(_0x4088f7,_0xfd88f3){zipdir(_0xab220c,{'saveTo':_0x34285b},function(_0x38dc7b,_0x5b0360){if(_0x38dc7b)return _0xfd88f3(_0x38dc7b);return _0x4088f7(_0x5b0360);});})[_0xa461('0x14')](function(){return new BPromise(function(_0x52cb13,_0x547869){rimraf(_0xab220c,function(_0x137949){if(_0x137949)_0x547869(_0x137949);return _0x52cb13();});});})[_0xa461('0x14')](function(){return _0x22134e[_0xa461('0x77')](_0x34285b,_0x390b9f,function(_0x505513){if(_0x505513){logger[_0xa461('0x18')](_0xa461('0xcb'),_0x505513);}else{fs[_0xa461('0xcc')](_0x34285b);}});});});}else{return _0x22134e[_0xa461('0x1f')](0xc8);}})['catch'](handleError(_0x22134e,null));}; \ No newline at end of file +var _0x1b4e=['../../config/environment','../../mysqldb','localhost','redis','./chatInteraction.socket','register','jayson/promise','http','client','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','update','destroy','end','stack','name','send','render','merge','contact','agent','interaction','index','map','ChatInteraction','rawAttributes','fieldName','type','key','findAll','chat','query','catch','show','model','keys','filters','intersection','attributes','fields','length','options','create','body','find','params','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','vidaooApiKey','user','fullname','email','account','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','parse','metadata','Error\x20in\x20conversion\x20vidaooMetadata','Sequelize','ValidationError','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','basename','filename','Attachment','join','server/files/attachments/','offline-chat/','download','mailTranscript','root','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','ContactId','Messages','UserId','%s%d','agentAlias','System','customer','agentIdentifier','website_alias','agent_alias','User','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','hasOwnProperty','nolimit','order','sort','pick','where','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','getMyMessages','ChatInteractionId','include','push','alias','addTags','setTags','spread','Tag','color','emit','chatInteractionTags:save','removeTags','unix','server','files','firstName','lastName','Owner','mkdirSync','Chat','Account','toString','closedAt','browserName','osName','customerIp','customerPort','N.A.','tail','createReadStream','pipe','read','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api'];(function(_0x4f0da3,_0x133007){var _0x1f92f1=function(_0x5f52db){while(--_0x5f52db){_0x4f0da3['push'](_0x4f0da3['shift']());}};_0x1f92f1(++_0x133007);}(_0x1b4e,0xc6));var _0xe1b4=function(_0x3287c0,_0x36471c){_0x3287c0=_0x3287c0-0x0;var _0x343575=_0x1b4e[_0x3287c0];return _0x343575;};'use strict';var rimraf=require(_0xe1b4('0x0'));var zipdir=require(_0xe1b4('0x1'));var rp=require(_0xe1b4('0x2'));var moment=require(_0xe1b4('0x3'));var BPromise=require(_0xe1b4('0x4'));var Mustache=require(_0xe1b4('0x5'));var util=require('util');var path=require(_0xe1b4('0x6'));var ejs=require(_0xe1b4('0x7'));var fs=require('fs');var _=require(_0xe1b4('0x8'));var Redis=require(_0xe1b4('0x9'));var interaction=require(_0xe1b4('0xa'));var qs=require(_0xe1b4('0xb'));var pdf=require(_0xe1b4('0xc'));var logger=require(_0xe1b4('0xd'))(_0xe1b4('0xe'));var config=require(_0xe1b4('0xf'));var db=require(_0xe1b4('0x10'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xe1b4('0x11'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe1b4('0x12')]));require(_0xe1b4('0x13'))[_0xe1b4('0x14')](socket);var jayson=require(_0xe1b4('0x15'));var client=jayson['client'][_0xe1b4('0x16')]({'port':0x232b});var client9004=jayson[_0xe1b4('0x17')][_0xe1b4('0x16')]({'port':0x232c});function respondWithRpcPromise(_0x28617b,_0x55edff,_0x2d4719,_0x310c44){return new BPromise(function(_0x64b892,_0x9c41b6){var _0x5ca195=_0x310c44||client;return _0x5ca195[_0xe1b4('0x18')](_0x28617b,_0x2d4719)[_0xe1b4('0x19')](function(_0x4854b4){logger['info'](_0xe1b4('0x1a'),_0x55edff,_0xe1b4('0x1b'));logger[_0xe1b4('0x1c')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x55edff,'request\x20sent',JSON['stringify'](_0x4854b4));if(_0x4854b4[_0xe1b4('0x1d')]){if(_0x4854b4['error'][_0xe1b4('0x1e')]===0x1f4){logger[_0xe1b4('0x1d')]('ChatInteraction,\x20%s,\x20%s',_0x55edff,_0x4854b4['error'][_0xe1b4('0x1f')]);return _0x9c41b6(_0x4854b4[_0xe1b4('0x1d')][_0xe1b4('0x1f')]);}logger['error'](_0xe1b4('0x1a'),_0x55edff,_0x4854b4[_0xe1b4('0x1d')][_0xe1b4('0x1f')]);return _0x64b892(_0x4854b4[_0xe1b4('0x1d')][_0xe1b4('0x1f')]);}else{logger[_0xe1b4('0x20')]('ChatInteraction,\x20%s,\x20%s',_0x55edff,_0xe1b4('0x1b'));_0x64b892(_0x4854b4[_0xe1b4('0x21')][_0xe1b4('0x1f')]);}})['catch'](function(_0x5a1c5e){logger[_0xe1b4('0x1d')]('ChatInteraction,\x20%s,\x20%s',_0x55edff,_0x5a1c5e);_0x9c41b6(_0x5a1c5e);});});}function respondWithStatusCode(_0x193854,_0x1446d6){_0x1446d6=_0x1446d6||0xcc;return function(_0x46edfb){if(_0x46edfb){return _0x193854[_0xe1b4('0x22')](_0x1446d6);}return _0x193854[_0xe1b4('0x23')](_0x1446d6)['end']();};}function respondWithResult(_0x19f216,_0x159ad6){_0x159ad6=_0x159ad6||0xc8;return function(_0x524aca){if(_0x524aca){return _0x19f216['status'](_0x159ad6)['json'](_0x524aca);}};}function respondWithFilteredResult(_0x4022a0,_0x141aa0){return function(_0x2ff756){if(_0x2ff756){var _0x5bf4f7=typeof _0x141aa0[_0xe1b4('0x24')]==='undefined'&&typeof _0x141aa0[_0xe1b4('0x25')]===_0xe1b4('0x26');var _0x46659c=_0x2ff756[_0xe1b4('0x27')];var _0x3f2e13=_0x5bf4f7?0x0:_0x141aa0['offset'];var _0x2038d1=_0x5bf4f7?_0x2ff756[_0xe1b4('0x27')]:_0x141aa0['offset']+_0x141aa0['limit'];var _0x41c18b;if(_0x2038d1>=_0x46659c){_0x2038d1=_0x46659c;_0x41c18b=0xc8;}else{_0x41c18b=0xce;}_0x4022a0['status'](_0x41c18b);return _0x4022a0[_0xe1b4('0x28')](_0xe1b4('0x29'),_0x3f2e13+'-'+_0x2038d1+'/'+_0x46659c)[_0xe1b4('0x2a')](_0x2ff756);}return null;};}function saveUpdates(_0x282af5){return function(_0x43c79f){if(_0x43c79f){return _0x43c79f[_0xe1b4('0x2b')](_0x282af5)[_0xe1b4('0x19')](function(_0x26e9dd){return _0x26e9dd;});}return null;};}function removeEntity(_0x4bb2ef){return function(_0x1939db){if(_0x1939db){return _0x1939db[_0xe1b4('0x2c')]()['then'](function(){_0x4bb2ef[_0xe1b4('0x23')](0xcc)[_0xe1b4('0x2d')]();});}};}function handleEntityNotFound(_0x4bc134){return function(_0x52ba04){if(!_0x52ba04){_0x4bc134[_0xe1b4('0x22')](0x194);}return _0x52ba04;};}function handleError(_0x30704b,_0x3f799d){_0x3f799d=_0x3f799d||0x1f4;return function(_0x3fad69){logger['error'](_0x3fad69[_0xe1b4('0x2e')]);if(_0x3fad69[_0xe1b4('0x2f')]){delete _0x3fad69[_0xe1b4('0x2f')];}_0x30704b['status'](_0x3f799d)[_0xe1b4('0x30')](_0x3fad69);};}function getMustacheRender(_0x1a1b56,_0x10dbc1){return Mustache[_0xe1b4('0x31')](_0x1a1b56,_[_0xe1b4('0x32')](_0x10dbc1['body'],{'contact':_0x10dbc1[_0xe1b4('0x33')],'message':_0x10dbc1['message'],'agent':_0x10dbc1[_0xe1b4('0x34')],'interaction':_0x10dbc1[_0xe1b4('0x35')],'account':_0x10dbc1['account']}))||'';}exports[_0xe1b4('0x36')]=function(_0x283723,_0x1df736){var _0xba3be7={};var _0x48dbdd=_[_0xe1b4('0x37')](db[_0xe1b4('0x38')][_0xe1b4('0x39')],function(_0x103614){return{'name':_0x103614[_0xe1b4('0x3a')],'type':_0x103614[_0xe1b4('0x3b')][_0xe1b4('0x3c')]};});_0xba3be7=qs['getOptions'](_0x48dbdd,_0x283723);return interaction[_0xe1b4('0x3d')](_0xe1b4('0x3e'),_0x283723[_0xe1b4('0x3f')],_0x283723['user'],_0xba3be7,_0x48dbdd)['then'](respondWithFilteredResult(_0x1df736,_0xba3be7))[_0xe1b4('0x40')](handleError(_0x1df736,null));};exports[_0xe1b4('0x41')]=function(_0x156050,_0x510ec6){var _0x9e3bc0={'raw':![],'where':{'id':_0x156050['params']['id']}},_0x211daa={};_0x211daa[_0xe1b4('0x42')]=_[_0xe1b4('0x43')](db[_0xe1b4('0x38')][_0xe1b4('0x39')]);_0x211daa[_0xe1b4('0x3f')]=_['keys'](_0x156050['query']);_0x211daa[_0xe1b4('0x44')]=_[_0xe1b4('0x45')](_0x211daa[_0xe1b4('0x42')],_0x211daa[_0xe1b4('0x3f')]);_0x9e3bc0[_0xe1b4('0x46')]=_[_0xe1b4('0x45')](_0x211daa[_0xe1b4('0x42')],qs[_0xe1b4('0x47')](_0x156050[_0xe1b4('0x3f')][_0xe1b4('0x47')]));_0x9e3bc0[_0xe1b4('0x46')]=_0x9e3bc0['attributes'][_0xe1b4('0x48')]?_0x9e3bc0[_0xe1b4('0x46')]:_0x211daa['model'];if(_0x156050[_0xe1b4('0x3f')]['includeAll']){_0x9e3bc0['include']=[{'all':!![]}];}_0x9e3bc0=_[_0xe1b4('0x32')]({},_0x9e3bc0,_0x156050[_0xe1b4('0x49')]);return db[_0xe1b4('0x38')]['find'](_0x9e3bc0)[_0xe1b4('0x19')](handleEntityNotFound(_0x510ec6,null))[_0xe1b4('0x19')](respondWithResult(_0x510ec6,null))[_0xe1b4('0x40')](handleError(_0x510ec6,null));};exports[_0xe1b4('0x4a')]=function(_0x2efbcb,_0xd53cbc){return db[_0xe1b4('0x38')][_0xe1b4('0x4a')](_0x2efbcb[_0xe1b4('0x4b')],{})[_0xe1b4('0x19')](respondWithResult(_0xd53cbc,0xc9))['catch'](handleError(_0xd53cbc,null));};exports['update']=function(_0x309de3,_0x2e8ff3){if(_0x309de3[_0xe1b4('0x4b')]['id']){delete _0x309de3[_0xe1b4('0x4b')]['id'];}return db[_0xe1b4('0x38')][_0xe1b4('0x4c')]({'where':{'id':_0x309de3[_0xe1b4('0x4d')]['id']}})[_0xe1b4('0x19')](handleEntityNotFound(_0x2e8ff3,null))[_0xe1b4('0x19')](saveUpdates(_0x309de3['body'],null))[_0xe1b4('0x19')](respondWithResult(_0x2e8ff3,null))[_0xe1b4('0x40')](handleError(_0x2e8ff3,null));};exports[_0xe1b4('0x2c')]=function(_0x46ac09,_0x43b2fe){return db[_0xe1b4('0x38')][_0xe1b4('0x4c')]({'where':{'id':_0x46ac09[_0xe1b4('0x4d')]['id']}})[_0xe1b4('0x19')](handleEntityNotFound(_0x43b2fe,null))[_0xe1b4('0x19')](removeEntity(_0x43b2fe,null))[_0xe1b4('0x40')](handleError(_0x43b2fe,null));};exports['describe']=function(_0x5e8cfa,_0x2cd966){return db[_0xe1b4('0x38')][_0xe1b4('0x4e')]()[_0xe1b4('0x19')](respondWithResult(_0x2cd966,null))[_0xe1b4('0x40')](handleError(_0x2cd966,null));};exports[_0xe1b4('0x4f')]=function(_0x57e833,_0x3fa28b){var _0x2cfaf2=_0x57e833[_0xe1b4('0x4d')]['id'];var _0x4a4088;var _0x14d581;var _0x359ee8;return db[_0xe1b4('0x38')][_0xe1b4('0x50')]({'where':{'id':_0x2cfaf2}})[_0xe1b4('0x19')](function(_0x58a6d8){_0x4a4088=_0x58a6d8;return db[_0xe1b4('0x51')][_0xe1b4('0x50')]({'where':{'id':_0x58a6d8[_0xe1b4('0x52')]},'attributes':['id','vidaooApiKey',_0xe1b4('0x53'),_0xe1b4('0x54'),_0xe1b4('0x55'),_0xe1b4('0x56')],'raw':!![]});})[_0xe1b4('0x19')](function(_0x4229e8){if(_0x4229e8&&_0x4229e8[_0xe1b4('0x57')]&&_0x4229e8[_0xe1b4('0x53')]){_0x14d581=_0x4229e8;var _0x238844={'interaction':{'id':_0x2cfaf2},'agent':{'id':_0x57e833['user']['id'],'name':_0x57e833[_0xe1b4('0x58')][_0xe1b4('0x2f')],'fullname':_0x57e833['user'][_0xe1b4('0x59')],'email':_0x57e833[_0xe1b4('0x58')][_0xe1b4('0x5a')]},'contact':_0x57e833[_0xe1b4('0x4b')]['contact'],'account':_0x57e833[_0xe1b4('0x4b')][_0xe1b4('0x5b')]};var _0x3a5d38={'rejectUnauthorized':![],'method':_0xe1b4('0x5c'),'url':_0xe1b4('0x5d'),'headers':{'X-APIKEY':_0x4229e8[_0xe1b4('0x57')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x57e833[_0xe1b4('0x58')][_0xe1b4('0x5a')]],'buttons':null,'topic':_0x14d581[_0xe1b4('0x54')],'note':_[_0xe1b4('0x5e')](_0x14d581[_0xe1b4('0x55')])?null:getMustacheRender(_0x14d581[_0xe1b4('0x55')],_0x238844),'metadata':null},'redirect':_0xe1b4('0x5f'),'json':!![]};try{if(!_[_0xe1b4('0x5e')](_0x14d581[_0xe1b4('0x56')])){var _0x1cdfe3=getMustacheRender(_0x14d581[_0xe1b4('0x56')],_0x238844);var _0x9c307c=JSON[_0xe1b4('0x60')](_0x1cdfe3);_0x3a5d38[_0xe1b4('0x4b')][_0xe1b4('0x61')]=_0x9c307c;}}catch(_0x26b4a6){throw new db['Sequelize']['ValidationError'](_0xe1b4('0x62'));}return rp(_0x3a5d38);}else{throw new db[(_0xe1b4('0x63'))][(_0xe1b4('0x64'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0xe1b4('0x19')](function(_0x15f286){_0x359ee8=_0x15f286;if(_0x359ee8['id']){var _0x28f7eb={'body':_0x359ee8[_0xe1b4('0x65')],'ChatWebsiteId':_0x14d581['id'],'ChatInteractionId':_0x4a4088['id'],'direction':_0xe1b4('0x66'),'UserId':_0x57e833[_0xe1b4('0x58')]['id']};return db[_0xe1b4('0x67')]['create'](_0x28f7eb,{});}else{throw new db[(_0xe1b4('0x63'))]['ValidationError'](_0xe1b4('0x68'));}})['then'](function(){return _0x4a4088[_0xe1b4('0x69')]({'vidaooSessionId':_0x359ee8['id']});})[_0xe1b4('0x19')](respondWithResult(_0x3fa28b,null))['catch'](handleError(_0x3fa28b,null));};exports[_0xe1b4('0x6a')]=function(_0x621a3c,_0x1d70b0){if(_0x621a3c[_0xe1b4('0x4b')]['id']){delete _0x621a3c['body']['id'];}return db[_0xe1b4('0x38')][_0xe1b4('0x4c')]({'where':{'id':_0x621a3c[_0xe1b4('0x4d')]['id']},'include':[{'model':db[_0xe1b4('0x6b')],'as':_0xe1b4('0x6c')}]})[_0xe1b4('0x19')](handleEntityNotFound(_0x1d70b0,null))[_0xe1b4('0x19')](saveUpdates(_0x621a3c[_0xe1b4('0x4b')],null))['then'](respondWithResult(_0x1d70b0,null))[_0xe1b4('0x40')](handleError(_0x1d70b0,null));};exports[_0xe1b4('0x6d')]=function(_0x38ef05,_0x5e6c6a){if(_0x38ef05[_0xe1b4('0x4b')]['id']){delete _0x38ef05[_0xe1b4('0x4b')]['id'];}return db[_0xe1b4('0x38')]['find']({'where':{'id':_0x38ef05['params']['id']}})['then'](function(_0x7138ef){if(!_0x7138ef){logger[_0xe1b4('0x1d')](_0xe1b4('0x6e'),_0xe1b4('0x6d'),0x194,'entity\x20not\x20found');_0x5e6c6a[_0xe1b4('0x22')](0x194);}else{if(_0x7138ef['UserId']){throw new db[(_0xe1b4('0x63'))][(_0xe1b4('0x64'))](_0xe1b4('0x6f'));}}return _0x7138ef;})['then'](function(_0x48bed9){if(_0x48bed9){return _0x48bed9[_0xe1b4('0x2b')]({'closed':_0x38ef05['body'][_0xe1b4('0x70')],'disposition':_0x38ef05['body'][_0xe1b4('0x71')]})[_0xe1b4('0x19')](function(_0x4064e3){return _0x4064e3;});}})['then'](function(){return respondWithRpcPromise(_0xe1b4('0x72'),_0xe1b4('0x6d'),_0x38ef05[_0xe1b4('0x4b')],client9004);})['then'](respondWithResult(_0x5e6c6a,null))['catch'](handleError(_0x5e6c6a,null));};exports[_0xe1b4('0x73')]=function(_0xed1fc0,_0x4637e7){_0xed1fc0[_0xe1b4('0x4b')][_0xe1b4('0x2f')]=_0xed1fc0[_0xe1b4('0x74')]['originalname'];_0xed1fc0[_0xe1b4('0x4b')][_0xe1b4('0x75')]=_0xed1fc0[_0xe1b4('0x74')][_0xe1b4('0x76')];_0xed1fc0['body'][_0xe1b4('0x3b')]=_0xed1fc0[_0xe1b4('0x74')]['mimetype'];return db[_0xe1b4('0x77')]['create'](_0xed1fc0[_0xe1b4('0x4b')])['then'](respondWithResult(_0x4637e7,0xc9))[_0xe1b4('0x40')](handleError(_0x4637e7,null));};exports['attachmentDownload']=function(_0x4ff322,_0x1e0d2c){return db[_0xe1b4('0x38')][_0xe1b4('0x50')]({'where':{'id':_0x4ff322[_0xe1b4('0x4d')]['id']},'raw':!![]})[_0xe1b4('0x19')](handleEntityNotFound(_0x1e0d2c,null))['then'](function(_0x416061){if(_0x416061){if(_0x416061[_0xe1b4('0x70')]){return _0x1e0d2c['status'](0x193)[_0xe1b4('0x2a')]({'status':0x193,'message':'Unauthorized'});}return db['Attachment'][_0xe1b4('0x50')]({'where':{'id':_0x4ff322[_0xe1b4('0x3f')]['attachId']},'raw':!![]})['then'](handleEntityNotFound(_0x1e0d2c,null));}})[_0xe1b4('0x19')](function(_0x1743c0){if(_0x1743c0){var _0x3d0e30=_0x1743c0['ChatOfflineMessageId']!==null;var _0x7f4d25=path[_0xe1b4('0x78')](config['root'],_0xe1b4('0x79'));if(_0x3d0e30){_0x7f4d25=path['join'](_0x7f4d25,_0xe1b4('0x7a'));}var _0x5b5063=path[_0xe1b4('0x78')](_0x7f4d25,_0x1743c0[_0xe1b4('0x75')]);return _0x1e0d2c[_0xe1b4('0x7b')](_0x5b5063);}})[_0xe1b4('0x40')](handleError(_0x1e0d2c,null));};exports['close']=function(_0x309b98,_0x2bc5f7){var _0x5a98f1=null;var _0x4e4d34=null;var _0x2b46bc=null;if(_0x309b98['body']['id']){delete _0x309b98[_0xe1b4('0x4b')]['id'];}if(_0x309b98[_0xe1b4('0x4b')][_0xe1b4('0x7c')]){_0x2b46bc=path[_0xe1b4('0x78')](config[_0xe1b4('0x7d')],_0xe1b4('0x7e'),util[_0xe1b4('0x7f')](_0xe1b4('0x80'),Date[_0xe1b4('0x81')]()));_0x309b98[_0xe1b4('0x4b')][_0xe1b4('0x82')]=_0x2b46bc;}return db['ChatInteraction']['find']({'where':{'id':_0x309b98[_0xe1b4('0x4d')]['id']},'include':[{'model':db[_0xe1b4('0x67')],'as':'Messages','include':[{'model':db['User'],'as':'User'}]}]})[_0xe1b4('0x19')](handleEntityNotFound(_0x2bc5f7,null))[_0xe1b4('0x19')](saveUpdates(_0x309b98[_0xe1b4('0x4b')],null))[_0xe1b4('0x19')](function(_0x525fd9){if(_0x525fd9){_0x5a98f1=_0x525fd9;return db[_0xe1b4('0x51')][_0xe1b4('0x4c')]({'where':{'id':_0x5a98f1[_0xe1b4('0x52')]}});}})[_0xe1b4('0x19')](function(_0x3787e0){if(_0x3787e0){_0x4e4d34=_0x3787e0;return db[_0xe1b4('0x6b')][_0xe1b4('0x4c')]({'where':{'id':_0x5a98f1[_0xe1b4('0x83')]}});}})[_0xe1b4('0x19')](function(_0x2877a0){if(_0x2877a0){if(_0x2b46bc){var _0x3439cf=null;for(var _0x1ffe97=0x1;_0x1ffe97<_0x5a98f1['Messages']['length'];++_0x1ffe97){_0x3439cf=_0x5a98f1[_0xe1b4('0x84')][_0x1ffe97];var _0x31572c=_0x3439cf[_0xe1b4('0x85')]?util[_0xe1b4('0x7f')](_0xe1b4('0x86'),_0x4e4d34[_0xe1b4('0x87')],_0x3439cf[_0xe1b4('0x85')]):_0xe1b4('0x88');var _0x389a04=_0x309b98[_0xe1b4('0x4b')][_0xe1b4('0x89')]||util[_0xe1b4('0x7f')]('%s%d','Visitor',_0x3439cf[_0xe1b4('0x83')]);switch(_0x4e4d34[_0xe1b4('0x8a')]){case _0xe1b4('0x8b'):_0x31572c=_0x3439cf[_0xe1b4('0x85')]?util['format'](_0xe1b4('0x86'),_0x4e4d34[_0xe1b4('0x87')],_0x3439cf['UserId']):'System';break;case _0xe1b4('0x8c'):_0x31572c=_0x3439cf[_0xe1b4('0x85')]?_0x3439cf[_0xe1b4('0x8d')]['alias']||_0x3439cf[_0xe1b4('0x8d')][_0xe1b4('0x59')]:_0xe1b4('0x88');break;case'agent_fullname':_0x31572c=_0x3439cf['UserId']?_0x3439cf['User'][_0xe1b4('0x59')]:_0xe1b4('0x88');break;default:_0x31572c=_0x3439cf[_0xe1b4('0x85')]?util[_0xe1b4('0x7f')]('%s%d',_0x4e4d34['agentAlias'],_0x3439cf[_0xe1b4('0x85')]):_0xe1b4('0x88');}var _0x1916ea=util[_0xe1b4('0x7f')](_0xe1b4('0x8e'),moment(_0x3439cf[_0xe1b4('0x8f')])[_0xe1b4('0x7f')](_0xe1b4('0x90')),_0x3439cf[_0xe1b4('0x91')]==='in'?_0x389a04:_0x31572c,_0x3439cf[_0xe1b4('0x4b')]);if(!_0x3439cf[_0xe1b4('0x92')]){fs[_0xe1b4('0x93')](_0x2b46bc,_0x1916ea);}}return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xe1b4('0x94')],'as':_0xe1b4('0x95'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xe1b4('0x96'),'raw':!![]}]}]});}}})[_0xe1b4('0x19')](function(_0x3538f6){if(!_0x3538f6||!_0x3538f6['Smtp']||!_0x309b98[_0xe1b4('0x4b')])return _0x5a98f1;var _0x13c787=_0x3538f6[_0xe1b4('0x97')]();return respondWithRpcPromise(_0xe1b4('0x98'),'sendMail',{'account':_0x13c787,'message':{'from':util[_0xe1b4('0x7f')](_0xe1b4('0x99'),_0x3538f6[_0xe1b4('0x2f')],_0x3538f6[_0xe1b4('0x5a')]||_0x3538f6[_0xe1b4('0x95')][_0xe1b4('0x58')]),'to':_0x309b98[_0xe1b4('0x4b')][_0xe1b4('0x7c')],'subject':_0xe1b4('0x9a'),'text':util[_0xe1b4('0x7f')](_0xe1b4('0x9b'),_0x309b98[_0xe1b4('0x4b')][_0xe1b4('0x7c')]),'attachments':[{'path':_0x2b46bc}]}})[_0xe1b4('0x19')](function(){return _0x5a98f1;})['catch'](function(_0x4bf704){logger[_0xe1b4('0x1d')](_0x4bf704);});})['then'](respondWithStatusCode(_0x2bc5f7,0xc8))[_0xe1b4('0x40')](handleError(_0x2bc5f7,null));};exports[_0xe1b4('0x9c')]=function(_0x3fed61,_0x427b25){return db[_0xe1b4('0x67')][_0xe1b4('0x4c')]({'where':{'id':_0x3fed61[_0xe1b4('0x4d')]['id']}})[_0xe1b4('0x19')](handleEntityNotFound(_0x427b25,null))['then'](function(_0x4f3c17){if(_0x4f3c17){return _0x4f3c17[_0xe1b4('0x9c')](_0x3fed61['body'][_0xe1b4('0x9d')],_[_0xe1b4('0x9e')](_0x3fed61[_0xe1b4('0x4b')],[_0xe1b4('0x9d'),'id'])||{});}})['then'](respondWithResult(_0x427b25,null))[_0xe1b4('0x40')](handleError(_0x427b25,null));};exports[_0xe1b4('0x9f')]=function(_0x1c5dde,_0x297982){var _0x450d5c={'raw':![],'where':{}};var _0xe829e2={};var _0x4d99e3={'count':0x0,'rows':[]};return db[_0xe1b4('0x38')][_0xe1b4('0x50')]({'where':{'id':_0x1c5dde[_0xe1b4('0x4d')]['id']}})[_0xe1b4('0x19')](handleEntityNotFound(_0x297982,null))[_0xe1b4('0x19')](function(_0x795bde){if(_0x795bde){_0xe829e2[_0xe1b4('0x42')]=_[_0xe1b4('0x43')](db[_0xe1b4('0x67')][_0xe1b4('0x39')]);_0xe829e2[_0xe1b4('0x3f')]=_[_0xe1b4('0x43')](_0x1c5dde[_0xe1b4('0x3f')]);_0xe829e2[_0xe1b4('0x44')]=_['intersection'](_0xe829e2[_0xe1b4('0x42')],_0xe829e2[_0xe1b4('0x3f')]);_0x450d5c['attributes']=_[_0xe1b4('0x45')](_0xe829e2[_0xe1b4('0x42')],qs[_0xe1b4('0x47')](_0x1c5dde['query'][_0xe1b4('0x47')]));_0x450d5c[_0xe1b4('0x46')]=_0x450d5c[_0xe1b4('0x46')][_0xe1b4('0x48')]?_0x450d5c[_0xe1b4('0x46')]:_0xe829e2[_0xe1b4('0x42')];if(!_0x1c5dde[_0xe1b4('0x3f')][_0xe1b4('0xa0')](_0xe1b4('0xa1'))){_0x450d5c['limit']=qs[_0xe1b4('0x25')](_0x1c5dde['query']['limit']);_0x450d5c[_0xe1b4('0x24')]=qs[_0xe1b4('0x24')](_0x1c5dde['query'][_0xe1b4('0x24')]);}_0x450d5c[_0xe1b4('0xa2')]=qs[_0xe1b4('0xa3')](_0x1c5dde[_0xe1b4('0x3f')][_0xe1b4('0xa3')]);_0x450d5c['where']=qs[_0xe1b4('0x44')](_[_0xe1b4('0xa4')](_0x1c5dde[_0xe1b4('0x3f')],_0xe829e2[_0xe1b4('0x44')]));_0x450d5c['where']['ChatInteractionId']=_0x795bde['id'];if(_0x1c5dde['query']['filter']){_0x450d5c[_0xe1b4('0xa5')]=_['merge'](_0x450d5c[_0xe1b4('0xa5')],{'$or':_['map'](_0x450d5c[_0xe1b4('0x46')],function(_0x207afb){var _0x30b888={};_0x30b888[_0x207afb]={'$like':'%'+_0x1c5dde[_0xe1b4('0x3f')][_0xe1b4('0xa6')]+'%'};return _0x30b888;})});}if(_0x1c5dde[_0xe1b4('0x3f')][_0xe1b4('0xa7')]){var _0x1442c1=_0x1c5dde[_0xe1b4('0x3f')]['$gte'][_0xe1b4('0xa8')](',');var _0xb63c0={};_0xb63c0[_0x1442c1[0x0]]={'$gte':moment(_0x1442c1[0x1])[_0xe1b4('0x7f')](_0xe1b4('0xa9'))};_0x450d5c[_0xe1b4('0xa5')]=_[_0xe1b4('0x32')](_0x450d5c[_0xe1b4('0xa5')],_0xb63c0);}_0x450d5c=_['merge']({},_0x450d5c,_0x1c5dde[_0xe1b4('0x49')]);return db[_0xe1b4('0x67')][_0xe1b4('0x27')]({'where':_0x450d5c[_0xe1b4('0xa5')]})[_0xe1b4('0x19')](function(_0x428ccb){_0x4d99e3['count']=_0x428ccb;if(_0x1c5dde['query'][_0xe1b4('0xaa')]){_0x450d5c['include']=[{'all':!![]}];}return db[_0xe1b4('0x67')][_0xe1b4('0x3d')](_0x450d5c);})[_0xe1b4('0x19')](function(_0xa13344){_0x4d99e3[_0xe1b4('0xab')]=_0xa13344;return _0x4d99e3;});}})[_0xe1b4('0x19')](respondWithFilteredResult(_0x297982,_0x450d5c))[_0xe1b4('0x40')](handleError(_0x297982,null));};exports[_0xe1b4('0xac')]=function(_0x39ac0f,_0x43eb88){var _0x50bc87={'where':{}},_0x57c791={},_0x59f7a5={'count':0x0,'rows':[]};return db[_0xe1b4('0x38')][_0xe1b4('0x50')]({'where':{'id':_0x39ac0f['params']['id']}})[_0xe1b4('0x19')](handleEntityNotFound(_0x43eb88,null))[_0xe1b4('0x19')](function(_0x3fad96){if(_0x3fad96){_0x57c791['model']=_[_0xe1b4('0x43')](db[_0xe1b4('0x67')][_0xe1b4('0x39')]);_0x57c791[_0xe1b4('0x3f')]=_[_0xe1b4('0x43')](_0x39ac0f[_0xe1b4('0x3f')]);_0x57c791[_0xe1b4('0x44')]=_[_0xe1b4('0x45')](_0x57c791['model'],_0x57c791[_0xe1b4('0x3f')]);_0x50bc87[_0xe1b4('0x46')]=_[_0xe1b4('0x45')](_0x57c791[_0xe1b4('0x42')],qs[_0xe1b4('0x47')](_0x39ac0f[_0xe1b4('0x3f')][_0xe1b4('0x47')]));_0x50bc87[_0xe1b4('0x46')]=_0x50bc87[_0xe1b4('0x46')]['length']?_0x50bc87[_0xe1b4('0x46')]:_0x57c791['model'];if(!_0x39ac0f[_0xe1b4('0x3f')]['hasOwnProperty'](_0xe1b4('0xa1'))){_0x50bc87[_0xe1b4('0x25')]=qs['limit'](_0x39ac0f[_0xe1b4('0x3f')][_0xe1b4('0x25')]);_0x50bc87['offset']=qs[_0xe1b4('0x24')](_0x39ac0f[_0xe1b4('0x3f')][_0xe1b4('0x24')]);}_0x50bc87[_0xe1b4('0xa2')]=qs[_0xe1b4('0xa3')](_0x39ac0f[_0xe1b4('0x3f')]['sort']);_0x50bc87[_0xe1b4('0xa5')]=qs[_0xe1b4('0x44')](_[_0xe1b4('0xa4')](_0x39ac0f[_0xe1b4('0x3f')],_0x57c791[_0xe1b4('0x44')]));_0x50bc87[_0xe1b4('0xa5')][_0xe1b4('0xad')]=_0x3fad96['id'];if(_0x39ac0f[_0xe1b4('0x3f')][_0xe1b4('0xa6')]){_0x50bc87[_0xe1b4('0xa5')]=_[_0xe1b4('0x32')](_0x50bc87[_0xe1b4('0xa5')],{'$or':_['map'](_0x50bc87[_0xe1b4('0x46')],function(_0x58d00b){var _0x416ea2={};_0x416ea2[_0x58d00b]={'$like':'%'+_0x39ac0f[_0xe1b4('0x3f')][_0xe1b4('0xa6')]+'%'};return _0x416ea2;})});}_0x50bc87[_0xe1b4('0xa5')][_0xe1b4('0x92')]=![];if(_0x39ac0f[_0xe1b4('0x3f')]['id']){_0x50bc87['where']['id']={'$gt':_0x39ac0f[_0xe1b4('0x3f')]['id']};}_0x50bc87=_[_0xe1b4('0x32')]({},_0x50bc87,_0x39ac0f[_0xe1b4('0x49')]);return db[_0xe1b4('0x67')][_0xe1b4('0x27')]({'where':_0x50bc87[_0xe1b4('0xa5')]})[_0xe1b4('0x19')](function(_0x2fee16){_0x59f7a5[_0xe1b4('0x27')]=_0x2fee16;_0x50bc87[_0xe1b4('0xae')]=[];if(_0x39ac0f[_0xe1b4('0x3f')]['includeAgent']){_0x50bc87[_0xe1b4('0xae')][_0xe1b4('0xaf')]({'model':db[_0xe1b4('0x8d')],'as':'User','attributes':['id',_0xe1b4('0x59'),_0xe1b4('0xb0')]});}if(_0x39ac0f[_0xe1b4('0x3f')][_0xe1b4('0xaa')]){_0x50bc87[_0xe1b4('0xae')]=[{'all':!![]}];}return db[_0xe1b4('0x67')]['findAll'](_0x50bc87);})['then'](function(_0x1d5a03){_0x59f7a5[_0xe1b4('0xab')]=_0x1d5a03;return _0x59f7a5;});}})['then'](respondWithFilteredResult(_0x43eb88,_0x50bc87))[_0xe1b4('0x40')](handleError(_0x43eb88,null));};exports[_0xe1b4('0xb1')]=function(_0x255078,_0x278297){return db[_0xe1b4('0x38')][_0xe1b4('0x4c')]({'where':{'id':_0x255078[_0xe1b4('0x4d')]['id']}})['then'](handleEntityNotFound(_0x278297,null))['then'](function(_0x45e832){if(_0x45e832){return _0x45e832[_0xe1b4('0xb2')](_0x255078[_0xe1b4('0x4b')][_0xe1b4('0x9d')],_[_0xe1b4('0x9e')](_0x255078[_0xe1b4('0x4b')],[_0xe1b4('0x9d'),'id'])||{})[_0xe1b4('0xb3')](function(){return db[_0xe1b4('0xb4')]['findAll']({'attributes':['id',_0xe1b4('0x2f'),_0xe1b4('0xb5')],'where':{'id':_0x255078[_0xe1b4('0x4b')][_0xe1b4('0x9d')]}});})[_0xe1b4('0x19')](function(_0x5225a9){socket[_0xe1b4('0xb6')](_0xe1b4('0xb7'),{'id':Number(_0x255078['params']['id']),'tags':_0x5225a9||[]});return{'id':Number(_0x255078[_0xe1b4('0x4d')]['id']),'tags':_0x5225a9||[]};});}})[_0xe1b4('0x19')](respondWithResult(_0x278297,null))[_0xe1b4('0x40')](handleError(_0x278297,null));};exports['removeTags']=function(_0x58dccf,_0x245a9f){return db['ChatInteraction'][_0xe1b4('0x4c')]({'where':{'id':_0x58dccf[_0xe1b4('0x4d')]['id']}})[_0xe1b4('0x19')](handleEntityNotFound(_0x245a9f,null))[_0xe1b4('0x19')](function(_0x30ab55){if(_0x30ab55){return _0x30ab55[_0xe1b4('0xb8')](_0x58dccf['query'][_0xe1b4('0x9d')]);}})[_0xe1b4('0x19')](respondWithStatusCode(_0x245a9f,null))[_0xe1b4('0x40')](handleError(_0x245a9f,null));};exports[_0xe1b4('0x7b')]=function(_0x30606c,_0x52d53e){var _0x7b6a3a=moment()[_0xe1b4('0xb9')]()['toString']();var _0xa3f2a7=path['join'](config[_0xe1b4('0x7d')],_0xe1b4('0xba'),_0xe1b4('0xbb'),'tmp');var _0xcd6951=path[_0xe1b4('0x78')](config[_0xe1b4('0x7d')],'server','files','attachments');var _0x43e574=path['join'](_0xa3f2a7,_0x7b6a3a);var _0x338697=util[_0xe1b4('0x7f')]('transcript-%d-%s.zip',_0x30606c[_0xe1b4('0x4d')]['id'],_0x7b6a3a);var _0x5568e9=path[_0xe1b4('0x78')](_0xa3f2a7,_0x338697);var _0x544c6a=[];_0x544c6a[_0xe1b4('0xaf')]({'model':db[_0xe1b4('0x8d')],'as':_0xe1b4('0x8d'),'attributes':['id','fullname'],'raw':!![]});_0x544c6a[_0xe1b4('0xaf')]({'model':db['CmContact'],'as':_0xe1b4('0x6c'),'attributes':['id',_0xe1b4('0xbc'),_0xe1b4('0xbd')],'raw':!![]});if(_0x30606c[_0xe1b4('0x3f')]['attachments']){_0x544c6a[_0xe1b4('0xaf')]({'model':db[_0xe1b4('0x77')],'as':_0xe1b4('0x77'),'raw':!![]});}var _0x1ae1ae=[{'model':db[_0xe1b4('0x67')],'as':_0xe1b4('0x84'),'attributes':['id',_0xe1b4('0x4b'),_0xe1b4('0x8f'),_0xe1b4('0x91'),_0xe1b4('0x92'),'read'],'include':_0x544c6a}];_0x1ae1ae[_0xe1b4('0xaf')]({'model':db[_0xe1b4('0x51')],'as':'Account','attributes':['id',_0xe1b4('0x2f')]});_0x1ae1ae['push']({'model':db[_0xe1b4('0x8d')],'as':_0xe1b4('0xbe'),'attributes':['id','fullname']});return db[_0xe1b4('0x38')][_0xe1b4('0x4c')]({'where':{'id':_0x30606c[_0xe1b4('0x4d')]['id']},'include':_0x1ae1ae})[_0xe1b4('0x19')](handleEntityNotFound(_0x52d53e,null))[_0xe1b4('0x19')](function(_0x5d1e8b){if(_0x5d1e8b){var _0x506167=_0x5d1e8b['get']({'plain':!![]});fs[_0xe1b4('0xbf')](_0x43e574);var _0x29b200={'channel':_0xe1b4('0xc0'),'account':_0x506167[_0xe1b4('0xc1')]['name'],'agent':_0x506167['Owner']?_0x506167[_0xe1b4('0xbe')][_0xe1b4('0x59')]:'N.A.','createdAt':moment(_0x506167[_0xe1b4('0x8f')])[_0xe1b4('0x7f')](_0xe1b4('0xa9'))[_0xe1b4('0xc2')](),'closedAt':_0x506167[_0xe1b4('0x70')]?moment(_0x506167[_0xe1b4('0xc3')])['format'](_0xe1b4('0xa9'))[_0xe1b4('0xc2')]():'','disposition':_0x506167['disposition'],'chatInfo':{'browser':_0x506167[_0xe1b4('0xc4')],'os':_0x506167[_0xe1b4('0xc5')],'referer':_0x506167['referer'],'customerIp':_0x506167[_0xe1b4('0xc6')],'customerPort':_0x506167[_0xe1b4('0xc7')]?_0x506167[_0xe1b4('0xc7')]:_0xe1b4('0xc8')},'messages':_(_0x506167[_0xe1b4('0x84')])[_0xe1b4('0xc9')]()[_0xe1b4('0xa6')]({'secret':![]})[_0xe1b4('0x37')](function(_0x4f8161){if(_0x4f8161[_0xe1b4('0x77')]){var _0x1ea161=path[_0xe1b4('0x78')](_0xcd6951,_0x4f8161[_0xe1b4('0x77')][_0xe1b4('0x75')]);if(fs['existsSync'](_0x1ea161)){fs[_0xe1b4('0xca')](_0x1ea161)[_0xe1b4('0xcb')](fs['createWriteStream'](path['join'](_0x43e574,_0x4f8161[_0xe1b4('0x77')][_0xe1b4('0x75')])));}}return{'date':moment(_0x4f8161['createdAt'])['format'](_0xe1b4('0xa9'))[_0xe1b4('0xc2')](),'sender':_0x4f8161['direction']===_0xe1b4('0x66')?_0x4f8161[_0xe1b4('0x8d')]?_0x4f8161['User'][_0xe1b4('0x59')]:_0xe1b4('0x88'):_0x4f8161[_0xe1b4('0x6c')]['firstName']+(_0x4f8161[_0xe1b4('0x6c')][_0xe1b4('0xbd')]?'\x20'+_0x4f8161[_0xe1b4('0x6c')]['lastName']:''),'body':_0x4f8161['Attachment']?_0x4f8161[_0xe1b4('0x77')]['basename']:_0x4f8161[_0xe1b4('0x4b')],'direction':_0x4f8161[_0xe1b4('0x91')]===_0xe1b4('0x66')?'A':'C','secret':_0x4f8161['secret'],'read':_0x4f8161[_0xe1b4('0xcc')],'attachment':_0x4f8161['Attachment']};})[_0xe1b4('0xcd')]()};return ejs[_0xe1b4('0xce')](path[_0xe1b4('0x78')](config[_0xe1b4('0x7d')],_0xe1b4('0xba'),_0xe1b4('0xcf'),_0xe1b4('0xd0')),{'interaction':_0x29b200})[_0xe1b4('0x19')](function(_0xd373a2){var _0x2f8fbd=path['join'](_0x43e574,_0xe1b4('0xd1')+_0x506167['id']+'-'+_0x7b6a3a+_0xe1b4('0xd2'));var _0x467c7e={'path':_0x2f8fbd,'channel':_0xe1b4('0xc0'),'interactionId':_0x506167['id']};return pdf[_0xe1b4('0xd3')](_0xd373a2,_0x467c7e);})[_0xe1b4('0x19')](function(){return new Promise(function(_0x23c517,_0x1ab3b3){zipdir(_0x43e574,{'saveTo':_0x5568e9},function(_0x16d6e1,_0x4e5077){if(_0x16d6e1)return _0x1ab3b3(_0x16d6e1);return _0x23c517(_0x4e5077);});})[_0xe1b4('0x19')](function(){return new BPromise(function(_0x37b709,_0x54626d){rimraf(_0x43e574,function(_0x4aeb7e){if(_0x4aeb7e)_0x54626d(_0x4aeb7e);return _0x37b709();});});})[_0xe1b4('0x19')](function(){return _0x52d53e[_0xe1b4('0x7b')](_0x5568e9,_0x338697,function(_0x569e7e){if(_0x569e7e){logger[_0xe1b4('0x1d')](_0xe1b4('0xd4'),_0x569e7e);}else{fs['unlinkSync'](_0x5568e9);}});});});}else{return _0x52d53e['sendStatus'](0xc8);}})[_0xe1b4('0x40')](handleError(_0x52d53e,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 83a48f7..453a0c2 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 _0x105f=['map','findAll','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users'];(function(_0x3b4eae,_0x5c57e7){var _0xe52993=function(_0x348aab){while(--_0x348aab){_0x3b4eae['push'](_0x3b4eae['shift']());}};_0xe52993(++_0x5c57e7);}(_0x105f,0xfe));var _0xf105=function(_0x274c52,_0x90ac0e){_0x274c52=_0x274c52-0x0;var _0x47c672=_0x105f[_0x274c52];return _0x47c672;};'use strict';var EventEmitter=require(_0xf105('0x0'));var ChatInteraction=require(_0xf105('0x1'))['db'][_0xf105('0x2')];var ChatMessage=require('../../mysqldb')['db'][_0xf105('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xf105('0x4')](0x0);var events={'afterCreate':_0xf105('0x5'),'afterUpdate':_0xf105('0x6'),'afterDestroy':_0xf105('0x7')};function emitEvent(_0x277e9c){return function(_0x270e17,_0x3e5fc4,_0x3f308d){_0x270e17[_0xf105('0x8')]({'attributes':['id'],'raw':!![]})[_0xf105('0x9')](function(_0x368445){_0x270e17[_0xf105('0xa')](_0xf105('0xb'),_0x368445[_0xf105('0xc')](function(_0x38ff66){return{'id':_0x38ff66['id']};}));return ChatMessage[_0xf105('0xd')]({'where':{'ChatInteractionId':_0x270e17['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf105('0x9')](function(_0x19cef6){_0x270e17['setDataValue']('unreadMessages',_0x19cef6[_0xf105('0xe')]);ChatInteractionEvents['emit'](_0x277e9c+':'+_0x270e17['id'],_0x270e17);ChatInteractionEvents[_0xf105('0xf')](_0x277e9c,_0x270e17);_0x3f308d(null);})[_0xf105('0x10')](_0x3f308d(null));};}for(var e in events){if(events[_0xf105('0x11')](e)){var event=events[e];ChatInteraction[_0xf105('0x12')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0x4cbb=['findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map'];(function(_0x2c8744,_0x3d30a2){var _0x529aab=function(_0x5402ad){while(--_0x5402ad){_0x2c8744['push'](_0x2c8744['shift']());}};_0x529aab(++_0x3d30a2);}(_0x4cbb,0x1d0));var _0xb4cb=function(_0x32ddd2,_0xe0f618){_0x32ddd2=_0x32ddd2-0x0;var _0x48de30=_0x4cbb[_0x32ddd2];return _0x48de30;};'use strict';var EventEmitter=require(_0xb4cb('0x0'));var ChatInteraction=require('../../mysqldb')['db']['ChatInteraction'];var ChatMessage=require(_0xb4cb('0x1'))['db'][_0xb4cb('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xb4cb('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb4cb('0x4'),'afterDestroy':_0xb4cb('0x5')};function emitEvent(_0x38d8e4){return function(_0x167a2f,_0x1b70cf,_0x4396dc){_0x167a2f[_0xb4cb('0x6')]({'attributes':['id'],'raw':!![]})[_0xb4cb('0x7')](function(_0x47c85c){_0x167a2f[_0xb4cb('0x8')](_0xb4cb('0x9'),_0x47c85c[_0xb4cb('0xa')](function(_0xfbfaf6){return{'id':_0xfbfaf6['id']};}));return ChatMessage[_0xb4cb('0xb')]({'where':{'ChatInteractionId':_0x167a2f['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb4cb('0x7')](function(_0x3cf4a7){_0x167a2f[_0xb4cb('0x8')](_0xb4cb('0xc'),_0x3cf4a7[_0xb4cb('0xd')]);ChatInteractionEvents['emit'](_0x38d8e4+':'+_0x167a2f['id'],_0x167a2f);ChatInteractionEvents[_0xb4cb('0xe')](_0x38d8e4,_0x167a2f);_0x4396dc(null);})[_0xb4cb('0xf')](_0x4396dc(null));};}for(var e in events){if(events[_0xb4cb('0x10')](e)){var event=events[e];ChatInteraction[_0xb4cb('0x11')](e,emitEvent(event));}}module[_0xb4cb('0x12')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index c965377..7e16fe9 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 _0x67ed=['path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','changed','closedAt','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x67ed,0x192));var _0xd67e=function(_0xdaf26a,_0x149dd0){_0xdaf26a=_0xdaf26a-0x0;var _0x9baf92=_0x67ed[_0xdaf26a];return _0x9baf92;};'use strict';var _=require(_0xd67e('0x0'));var util=require('util');var logger=require(_0xd67e('0x1'))(_0xd67e('0x2'));var moment=require(_0xd67e('0x3'));var BPromise=require(_0xd67e('0x4'));var rp=require(_0xd67e('0x5'));var fs=require('fs');var path=require(_0xd67e('0x6'));var rimraf=require(_0xd67e('0x7'));var config=require(_0xd67e('0x8'));var attributes=require(_0xd67e('0x9'));module[_0xd67e('0xa')]=function(_0x35289d,_0xd66c23){return _0x35289d[_0xd67e('0xb')](_0xd67e('0xc'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x42dcbc,_0x17c2af,_0x53e964){if(_0x42dcbc[_0xd67e('0xd')]('closed')){_0x42dcbc[_0xd67e('0xe')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x53e964(null,_0x42dcbc);}},'charset':_0xd67e('0xf'),'collate':_0xd67e('0x10')});}; \ No newline at end of file +var _0x3201=['define','chat_interactions','changed','format','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports'];(function(_0x590984,_0x235ed5){var _0x173db0=function(_0x26e8f5){while(--_0x26e8f5){_0x590984['push'](_0x590984['shift']());}};_0x173db0(++_0x235ed5);}(_0x3201,0xab));var _0x1320=function(_0x3b3cc6,_0x1a6e24){_0x3b3cc6=_0x3b3cc6-0x0;var _0x1161e4=_0x3201[_0x3b3cc6];return _0x1161e4;};'use strict';var _=require(_0x1320('0x0'));var util=require(_0x1320('0x1'));var logger=require(_0x1320('0x2'))(_0x1320('0x3'));var moment=require(_0x1320('0x4'));var BPromise=require(_0x1320('0x5'));var rp=require(_0x1320('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1320('0x7'));var attributes=require('./chatInteraction.attributes');module[_0x1320('0x8')]=function(_0x2b5489,_0x4eaa6d){return _0x2b5489[_0x1320('0x9')]('ChatInteraction',attributes,{'tableName':_0x1320('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x46569e,_0x590db8,_0x50e3a8){if(_0x46569e[_0x1320('0xb')]('closed')){_0x46569e['closedAt']=moment()[_0x1320('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x50e3a8(null,_0x46569e);}},'charset':_0x1320('0xd'),'collate':_0x1320('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 70d1414..e158a19 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 _0x864a=['redis','socket.io-emitter','register','request','then','info','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ChatInteraction,\x20%s,\x20%s','message','result','UpdateChatInteraction','ChatInteraction','update','body','options','raw','attributes','catch','AddTagsToChatInteraction','find','omit','ids','spread','debug','AddTags','stringify','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x864a,0xbd));var _0xa864=function(_0x109cad,_0x45a0c2){_0x109cad=_0x109cad-0x0;var _0x452543=_0x864a[_0x109cad];return _0x452543;};'use strict';var _=require(_0xa864('0x0'));var util=require(_0xa864('0x1'));var moment=require(_0xa864('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa864('0x3'));var db=require(_0xa864('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa864('0x5'))(_0xa864('0x6'));var config=require(_0xa864('0x7'));var jayson=require(_0xa864('0x8'));var client=jayson['client'][_0xa864('0x9')]({'port':0x232a});config['redis']=_[_0xa864('0xa')](config[_0xa864('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xa864('0xc'))(new Redis(config[_0xa864('0xb')]));require('./chatInteraction.socket')[_0xa864('0xd')](socket);function respondWithRpcPromise(_0x4deec9,_0x28ee21,_0x1b35c2){return new BPromise(function(_0xa668bb,_0x8d28df){return client[_0xa864('0xe')](_0x4deec9,_0x1b35c2)[_0xa864('0xf')](function(_0x57957f){logger[_0xa864('0x10')]('ChatInteraction,\x20%s,\x20%s',_0x28ee21,'request\x20sent');logger['debug'](_0xa864('0x11'),_0x28ee21,_0xa864('0x12'),JSON['stringify'](_0x57957f));if(_0x57957f['error']){if(_0x57957f[_0xa864('0x13')][_0xa864('0x14')]===0x1f4){logger[_0xa864('0x13')](_0xa864('0x15'),_0x28ee21,_0x57957f[_0xa864('0x13')][_0xa864('0x16')]);return _0x8d28df(_0x57957f[_0xa864('0x13')]['message']);}logger['error'](_0xa864('0x15'),_0x28ee21,_0x57957f[_0xa864('0x13')][_0xa864('0x16')]);return _0xa668bb(_0x57957f[_0xa864('0x13')][_0xa864('0x16')]);}else{logger[_0xa864('0x10')](_0xa864('0x15'),_0x28ee21,_0xa864('0x12'));_0xa668bb(_0x57957f[_0xa864('0x17')][_0xa864('0x16')]);}})['catch'](function(_0x2510dc){logger[_0xa864('0x13')](_0xa864('0x15'),_0x28ee21,_0x2510dc);_0x8d28df(_0x2510dc);});});}exports[_0xa864('0x18')]=function(_0xb23557){var _0x53457a=this;return new Promise(function(_0x470afd,_0x34f5bf){return db[_0xa864('0x19')][_0xa864('0x1a')](_0xb23557[_0xa864('0x1b')],{'raw':_0xb23557['options']?_0xb23557[_0xa864('0x1c')][_0xa864('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb23557[_0xa864('0x1c')]?_0xb23557['options']['where']||null:null,'attributes':_0xb23557['options']?_0xb23557[_0xa864('0x1c')][_0xa864('0x1e')]||null:null,'limit':_0xb23557[_0xa864('0x1c')]?_0xb23557[_0xa864('0x1c')]['limit']||null:null})[_0xa864('0xf')](function(_0x3d08b3){logger[_0xa864('0x10')]('UpdateChatInteraction',_0xb23557);logger['debug'](_0xa864('0x18'),_0xb23557,JSON['stringify'](_0x3d08b3));_0x470afd(_0x3d08b3);})[_0xa864('0x1f')](function(_0x53e252){logger[_0xa864('0x13')](_0xa864('0x18'),_0x53e252['message'],_0xb23557);_0x34f5bf(_0x53457a[_0xa864('0x13')](0x1f4,_0x53e252['message']));});});};exports[_0xa864('0x20')]=function(_0x14e180){return new Promise(function(_0x371643,_0x3f5624){return db[_0xa864('0x19')][_0xa864('0x21')]({'where':_0x14e180[_0xa864('0x1c')]?_0x14e180[_0xa864('0x1c')]['where']||null:null})[_0xa864('0xf')](function(_0x9eaf6b){if(_0x9eaf6b){return _0x9eaf6b['addTags'](_0x14e180[_0xa864('0x1b')]['ids'],_[_0xa864('0x22')](_0x14e180[_0xa864('0x1b')],[_0xa864('0x23'),'id'])||{});}})[_0xa864('0x24')](function(_0x147e53){logger['info']('AddTags',_0x14e180);logger[_0xa864('0x25')](_0xa864('0x26'),_0x14e180,JSON[_0xa864('0x27')](_0x147e53));_0x371643(_0x147e53);})[_0xa864('0x1f')](function(_0x339466){logger[_0xa864('0x13')](_0xa864('0x26'),_0x339466[_0xa864('0x16')],_0x14e180);_0x3f5624(_this[_0xa864('0x13')](0x1f4,_0x339466['message']));});});}; \ No newline at end of file +var _0xaaab=['request\x20sent','stringify','error','message','result','catch','UpdateChatInteraction','ChatInteraction','update','options','raw','where','find','addTags','body','ids','spread','AddTags','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','localhost','./chatInteraction.socket','register','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x29893f,_0x539454){var _0x421957=function(_0xade56b){while(--_0xade56b){_0x29893f['push'](_0x29893f['shift']());}};_0x421957(++_0x539454);}(_0xaaab,0x1f3));var _0xbaaa=function(_0x55eb0f,_0x4321fb){_0x55eb0f=_0x55eb0f-0x0;var _0x159100=_0xaaab[_0x55eb0f];return _0x159100;};'use strict';var _=require(_0xbaaa('0x0'));var util=require(_0xbaaa('0x1'));var moment=require(_0xbaaa('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbaaa('0x3'));var db=require(_0xbaaa('0x4'))['db'];var utils=require(_0xbaaa('0x5'));var logger=require(_0xbaaa('0x6'))(_0xbaaa('0x7'));var config=require('../../config/environment');var jayson=require(_0xbaaa('0x8'));var client=jayson['client'][_0xbaaa('0x9')]({'port':0x232a});config[_0xbaaa('0xa')]=_['defaults'](config[_0xbaaa('0xa')],{'host':_0xbaaa('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbaaa('0xa')]));require(_0xbaaa('0xc'))[_0xbaaa('0xd')](socket);function respondWithRpcPromise(_0x1e8d0b,_0x2abc59,_0x5f1691){return new BPromise(function(_0x538708,_0x10dc13){return client['request'](_0x1e8d0b,_0x5f1691)[_0xbaaa('0xe')](function(_0x41a959){logger[_0xbaaa('0xf')](_0xbaaa('0x10'),_0x2abc59,'request\x20sent');logger[_0xbaaa('0x11')](_0xbaaa('0x12'),_0x2abc59,_0xbaaa('0x13'),JSON[_0xbaaa('0x14')](_0x41a959));if(_0x41a959[_0xbaaa('0x15')]){if(_0x41a959['error']['code']===0x1f4){logger['error'](_0xbaaa('0x10'),_0x2abc59,_0x41a959[_0xbaaa('0x15')]['message']);return _0x10dc13(_0x41a959[_0xbaaa('0x15')][_0xbaaa('0x16')]);}logger[_0xbaaa('0x15')](_0xbaaa('0x10'),_0x2abc59,_0x41a959[_0xbaaa('0x15')]['message']);return _0x538708(_0x41a959['error']['message']);}else{logger[_0xbaaa('0xf')](_0xbaaa('0x10'),_0x2abc59,_0xbaaa('0x13'));_0x538708(_0x41a959[_0xbaaa('0x17')][_0xbaaa('0x16')]);}})[_0xbaaa('0x18')](function(_0x5ba9a5){logger['error'](_0xbaaa('0x10'),_0x2abc59,_0x5ba9a5);_0x10dc13(_0x5ba9a5);});});}exports[_0xbaaa('0x19')]=function(_0xb967b2){var _0x1e3205=this;return new Promise(function(_0x1dd03c,_0x36379a){return db[_0xbaaa('0x1a')][_0xbaaa('0x1b')](_0xb967b2['body'],{'raw':_0xb967b2['options']?_0xb967b2[_0xbaaa('0x1c')][_0xbaaa('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb967b2['options']?_0xb967b2[_0xbaaa('0x1c')][_0xbaaa('0x1e')]||null:null,'attributes':_0xb967b2[_0xbaaa('0x1c')]?_0xb967b2[_0xbaaa('0x1c')]['attributes']||null:null,'limit':_0xb967b2['options']?_0xb967b2[_0xbaaa('0x1c')]['limit']||null:null})[_0xbaaa('0xe')](function(_0x540131){logger['info'](_0xbaaa('0x19'),_0xb967b2);logger['debug'](_0xbaaa('0x19'),_0xb967b2,JSON[_0xbaaa('0x14')](_0x540131));_0x1dd03c(_0x540131);})[_0xbaaa('0x18')](function(_0xb35f6c){logger[_0xbaaa('0x15')](_0xbaaa('0x19'),_0xb35f6c[_0xbaaa('0x16')],_0xb967b2);_0x36379a(_0x1e3205[_0xbaaa('0x15')](0x1f4,_0xb35f6c[_0xbaaa('0x16')]));});});};exports['AddTagsToChatInteraction']=function(_0x3d5b4e){return new Promise(function(_0x2cd210,_0x448f51){return db[_0xbaaa('0x1a')][_0xbaaa('0x1f')]({'where':_0x3d5b4e[_0xbaaa('0x1c')]?_0x3d5b4e['options'][_0xbaaa('0x1e')]||null:null})[_0xbaaa('0xe')](function(_0x574743){if(_0x574743){return _0x574743[_0xbaaa('0x20')](_0x3d5b4e[_0xbaaa('0x21')]['ids'],_['omit'](_0x3d5b4e['body'],[_0xbaaa('0x22'),'id'])||{});}})[_0xbaaa('0x23')](function(_0x383487){logger[_0xbaaa('0xf')]('AddTags',_0x3d5b4e);logger[_0xbaaa('0x11')](_0xbaaa('0x24'),_0x3d5b4e,JSON['stringify'](_0x383487));_0x2cd210(_0x383487);})[_0xbaaa('0x18')](function(_0x490c1c){logger[_0xbaaa('0x15')]('AddTags',_0x490c1c[_0xbaaa('0x16')],_0x3d5b4e);_0x448f51(_this['error'](0x1f4,_0x490c1c[_0xbaaa('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index ff9016a..c3fecb0 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 _0xa41a=['emit','removeListener','./chatInteraction.events','save','update'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0xa41a,0x6b));var _0xaa41=function(_0xcb0779,_0x53b03c){_0xcb0779=_0xcb0779-0x0;var _0x4155e3=_0xa41a[_0xcb0779];return _0x4155e3;};'use strict';var ChatInteractionEvents=require(_0xaa41('0x0'));var events=[_0xaa41('0x1'),'remove',_0xaa41('0x2')];function createListener(_0x2a96ba,_0x43654a){return function(_0xc5ce74){_0x43654a[_0xaa41('0x3')](_0x2a96ba,_0xc5ce74);};}function removeListener(_0x3168be,_0x42896b){return function(){ChatInteractionEvents[_0xaa41('0x4')](_0x3168be,_0x42896b);};}exports['register']=function(_0x2122a0){for(var _0x1ec9d4=0x0,_0x54bc5a=events['length'];_0x1ec9d4<_0x54bc5a;_0x1ec9d4++){var _0x179545=events[_0x1ec9d4];var _0x202cce=createListener('chatInteraction:'+_0x179545,_0x2122a0);ChatInteractionEvents['on'](_0x179545,_0x202cce);}}; \ No newline at end of file +var _0xd4cc=['removeListener','register','chatInteraction:','./chatInteraction.events','save','remove','emit'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xd4cc,0x114));var _0xcd4c=function(_0x219a37,_0x228c2a){_0x219a37=_0x219a37-0x0;var _0x1e4a9b=_0xd4cc[_0x219a37];return _0x1e4a9b;};'use strict';var ChatInteractionEvents=require(_0xcd4c('0x0'));var events=[_0xcd4c('0x1'),_0xcd4c('0x2'),'update'];function createListener(_0x9125b,_0x542769){return function(_0xcce4f5){_0x542769[_0xcd4c('0x3')](_0x9125b,_0xcce4f5);};}function removeListener(_0x115f6c,_0x2c95e5){return function(){ChatInteractionEvents[_0xcd4c('0x4')](_0x115f6c,_0x2c95e5);};}exports[_0xcd4c('0x5')]=function(_0x2d7040){for(var _0x10dd24=0x0,_0x2a39b6=events['length'];_0x10dd24<_0x2a39b6;_0x10dd24++){var _0x20d0f3=events[_0x10dd24];var _0x18948b=createListener(_0xcd4c('0x6')+_0x20d0f3,_0x2d7040);ChatInteractionEvents['on'](_0x20d0f3,_0x18948b);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 1e3c946..aee25c3 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 _0x34c1=['/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','chatinteraction:destroy','destroy','removeTags','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','describe','/:id','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','replace','/:id/attachment_upload','single','attachmentUpload','addMessage','/:id/tags','tracked','chat','addTags','put','chatinteraction:update','update'];(function(_0x55bf40,_0x3a12f0){var _0x1b5930=function(_0x545e8e){while(--_0x545e8e){_0x55bf40['push'](_0x55bf40['shift']());}};_0x1b5930(++_0x3a12f0);}(_0x34c1,0x15a));var _0x134c=function(_0x4e8e68,_0x52a7b8){_0x4e8e68=_0x4e8e68-0x0;var _0x3c1398=_0x34c1[_0x4e8e68];return _0x3c1398;};'use strict';var multer=require(_0x134c('0x0'));var util=require(_0x134c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x134c('0x2'));var router=express[_0x134c('0x3')]();var fs_extra=require(_0x134c('0x4'));var auth=require(_0x134c('0x5'));var interaction=require(_0x134c('0x6'));var config=require(_0x134c('0x7'));var controller=require(_0x134c('0x8'));router[_0x134c('0x9')]('/',auth[_0x134c('0xa')](),controller[_0x134c('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x134c('0xc')]);router[_0x134c('0x9')](_0x134c('0xd'),auth[_0x134c('0xe')](),controller['show']);router['get'](_0x134c('0xf'),auth['isChatInteractionAuthorized'](),controller[_0x134c('0x10')]);router[_0x134c('0x9')](_0x134c('0x11'),auth[_0x134c('0xa')](),controller[_0x134c('0x12')]);router['get'](_0x134c('0x13'),auth[_0x134c('0xe')](),controller[_0x134c('0x14')]);router[_0x134c('0x9')](_0x134c('0x15'),auth[_0x134c('0xa')](),controller[_0x134c('0x16')]);router[_0x134c('0x17')]('/',auth[_0x134c('0xa')](),controller[_0x134c('0x18')]);router['post'](_0x134c('0x19'),auth[_0x134c('0xa')](),controller[_0x134c('0x1a')]);var upload=multer({'storage':multer[_0x134c('0x1b')]({'destination':function(_0x4bd467,_0xd33fd3,_0x207f8d){_0x207f8d(null,path[_0x134c('0x1c')](config[_0x134c('0x1d')],_0x134c('0x1e')));},'filename':function(_0x26f316,_0x40e503,_0x5c3d3e){_0x5c3d3e(null,util[_0x134c('0x1f')](_0x134c('0x20'),Date[_0x134c('0x21')](),_0x40e503['originalname'][_0x134c('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x134c('0x17')](_0x134c('0x23'),upload[_0x134c('0x24')]('file'),controller[_0x134c('0x25')]);router[_0x134c('0x17')]('/:id/messages',auth[_0x134c('0xe')](),controller[_0x134c('0x26')]);router[_0x134c('0x17')](_0x134c('0x27'),auth['isAuthenticated'](),interaction[_0x134c('0x28')](_0x134c('0x29'),'chatinteraction:addtags'),controller[_0x134c('0x2a')]);router[_0x134c('0x2b')](_0x134c('0xd'),auth['isAuthenticated'](),interaction[_0x134c('0x28')]('chat',_0x134c('0x2c')),controller[_0x134c('0x2d')]);router[_0x134c('0x2b')](_0x134c('0x2e'),controller[_0x134c('0x2f')]);router[_0x134c('0x2b')](_0x134c('0x30'),auth['isChatInteractionAuthorized'](),controller[_0x134c('0x31')]);router[_0x134c('0x2b')](_0x134c('0x32'),controller[_0x134c('0x33')]);router['delete']('/:id',auth['isAuthenticated'](),interaction[_0x134c('0x28')](_0x134c('0x29'),_0x134c('0x34')),controller[_0x134c('0x35')]);router['delete'](_0x134c('0x27'),auth[_0x134c('0xa')](),controller[_0x134c('0x36')]);module[_0x134c('0x37')]=router; \ No newline at end of file +var _0x4ec9=['server/files/attachments/','%s-%s','originalname','/:id/attachment_upload','single','file','/:id/tags','chat','chatinteraction:addtags','addTags','put','tracked','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','close','delete','chatinteraction:destroy','destroy','removeTags','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInteraction.controller','get','/describe','describe','/:id','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','/:id/my_messages','/:id/download','isAuthenticated','post','create','createVidaooSession','join','root'];(function(_0x4c1979,_0x240528){var _0x522dcd=function(_0xe8291b){while(--_0xe8291b){_0x4c1979['push'](_0x4c1979['shift']());}};_0x522dcd(++_0x240528);}(_0x4ec9,0xa4));var _0x94ec=function(_0x371d15,_0xd98587){_0x371d15=_0x371d15-0x0;var _0x32afdf=_0x4ec9[_0x371d15];return _0x32afdf;};'use strict';var multer=require(_0x94ec('0x0'));var util=require(_0x94ec('0x1'));var path=require('path');var timeout=require(_0x94ec('0x2'));var express=require(_0x94ec('0x3'));var router=express[_0x94ec('0x4')]();var fs_extra=require(_0x94ec('0x5'));var auth=require(_0x94ec('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x94ec('0x7'));var controller=require(_0x94ec('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x94ec('0x9')](_0x94ec('0xa'),auth['isAuthenticated'](),controller[_0x94ec('0xb')]);router[_0x94ec('0x9')](_0x94ec('0xc'),auth[_0x94ec('0xd')](),controller['show']);router[_0x94ec('0x9')](_0x94ec('0xe'),auth[_0x94ec('0xd')](),controller[_0x94ec('0xf')]);router[_0x94ec('0x9')]('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router['get'](_0x94ec('0x10'),auth[_0x94ec('0xd')](),controller['getMyMessages']);router['get'](_0x94ec('0x11'),auth[_0x94ec('0x12')](),controller['download']);router[_0x94ec('0x13')]('/',auth[_0x94ec('0x12')](),controller[_0x94ec('0x14')]);router['post']('/:id/vidaoo',auth[_0x94ec('0x12')](),controller[_0x94ec('0x15')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3d6156,_0x5630a0,_0x1eec71){_0x1eec71(null,path[_0x94ec('0x16')](config[_0x94ec('0x17')],_0x94ec('0x18')));},'filename':function(_0x3006e4,_0xa1256e,_0x44bbea){_0x44bbea(null,util['format'](_0x94ec('0x19'),Date['now'](),_0xa1256e[_0x94ec('0x1a')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x94ec('0x1b'),upload[_0x94ec('0x1c')](_0x94ec('0x1d')),controller['attachmentUpload']);router[_0x94ec('0x13')]('/:id/messages',auth['isChatInteractionAuthorized'](),controller['addMessage']);router[_0x94ec('0x13')](_0x94ec('0x1e'),auth['isAuthenticated'](),interaction['tracked'](_0x94ec('0x1f'),_0x94ec('0x20')),controller[_0x94ec('0x21')]);router[_0x94ec('0x22')]('/:id',auth[_0x94ec('0x12')](),interaction[_0x94ec('0x23')](_0x94ec('0x1f'),_0x94ec('0x24')),controller[_0x94ec('0x25')]);router['put'](_0x94ec('0x26'),controller[_0x94ec('0x27')]);router[_0x94ec('0x22')](_0x94ec('0x28'),auth[_0x94ec('0xd')](),controller[_0x94ec('0x29')]);router[_0x94ec('0x22')]('/:id/close',controller[_0x94ec('0x2a')]);router[_0x94ec('0x2b')](_0x94ec('0xc'),auth[_0x94ec('0x12')](),interaction[_0x94ec('0x23')](_0x94ec('0x1f'),_0x94ec('0x2c')),controller[_0x94ec('0x2d')]);router[_0x94ec('0x2b')]('/:id/tags',auth['isAuthenticated'](),controller[_0x94ec('0x2e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 86ee7e4..e0a077f 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 _0x7f53=['INTEGER','sequelize','exports','BOOLEAN'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x7f53,0x1b1));var _0x37f5=function(_0x4c7b20,_0x361515){_0x4c7b20=_0x4c7b20-0x0;var _0x4872bd=_0x7f53[_0x4c7b20];return _0x4872bd;};'use strict';var Sequelize=require(_0x37f5('0x0'));module[_0x37f5('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x37f5('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x37f5('0x3')]}}; \ No newline at end of file +var _0xbdbe=['exports','TEXT','medium','BOOLEAN','INTEGER','sequelize'];(function(_0x4d1ab8,_0x11f0a5){var _0x38bd2a=function(_0x54e64c){while(--_0x54e64c){_0x4d1ab8['push'](_0x4d1ab8['shift']());}};_0x38bd2a(++_0x11f0a5);}(_0xbdbe,0xbf));var _0xebdb=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xbdbe[_0x25e7cb];return _0x375d92;};'use strict';var Sequelize=require(_0xebdb('0x0'));module[_0xebdb('0x1')]={'body':{'type':Sequelize[_0xebdb('0x2')](_0xebdb('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xebdb('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xebdb('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 7488e85..e2c5585 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 _0xaca4=['push','createdAt','FromId','ToId','read','-createdAt','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','map','ChatInternalMessage','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','destroy','describe','messages','lastMessageAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','fullname','role','userpic','internal','online','lastLoginAt','showWebBar','VoiceQueue','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','autoAssociation','resourceId'];(function(_0x4dc53f,_0x2c7147){var _0x2751cf=function(_0x19a40b){while(--_0x19a40b){_0x4dc53f['push'](_0x4dc53f['shift']());}};_0x2751cf(++_0x2c7147);}(_0xaca4,0x74));var _0x4aca=function(_0x33918f,_0x50acbc){_0x33918f=_0x33918f-0x0;var _0x12ab51=_0xaca4[_0x33918f];return _0x12ab51;};'use strict';var emlformat=require(_0x4aca('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4aca('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4aca('0x2'));var moment=require(_0x4aca('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4aca('0x4'));var util=require(_0x4aca('0x5'));var path=require(_0x4aca('0x6'));var sox=require(_0x4aca('0x7'));var csv=require('to-csv');var ejs=require(_0x4aca('0x8'));var fs=require('fs');var fs_extra=require(_0x4aca('0x9'));var _=require(_0x4aca('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4aca('0xb'));var deskjs=require(_0x4aca('0xc'));var toCsv=require(_0x4aca('0xd'));var querystring=require(_0x4aca('0xe'));var Papa=require(_0x4aca('0xf'));var Redis=require(_0x4aca('0x10'));var authService=require(_0x4aca('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4aca('0x12'));var hardwareService=require(_0x4aca('0x13'));var logger=require(_0x4aca('0x14'))(_0x4aca('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4aca('0x16'));var db=require(_0x4aca('0x17'))['db'];config[_0x4aca('0x18')]=_[_0x4aca('0x19')](config[_0x4aca('0x18')],{'host':_0x4aca('0x1a'),'port':0x18eb});var socket=require(_0x4aca('0x1b'))(new Redis(config[_0x4aca('0x18')]));require('./chatInternalMessage.socket')[_0x4aca('0x1c')](socket);function respondWithStatusCode(_0x48054a,_0x433e9e){_0x433e9e=_0x433e9e||0xcc;return function(_0x51b189){if(_0x51b189){return _0x48054a[_0x4aca('0x1d')](_0x433e9e);}return _0x48054a[_0x4aca('0x1e')](_0x433e9e)[_0x4aca('0x1f')]();};}function respondWithResult(_0x3cfd18,_0x177fa1){_0x177fa1=_0x177fa1||0xc8;return function(_0x1f4f7f){if(_0x1f4f7f){return _0x3cfd18[_0x4aca('0x1e')](_0x177fa1)['json'](_0x1f4f7f);}};}function respondWithFilteredResult(_0x446542,_0x34a704){return function(_0x432fa7){if(_0x432fa7){var _0x29c053=typeof _0x34a704['offset']===_0x4aca('0x20')&&typeof _0x34a704[_0x4aca('0x21')]==='undefined';var _0x28e29d=_0x432fa7[_0x4aca('0x22')];var _0x29647c=_0x29c053?0x0:_0x34a704['offset'];var _0x2b214d=_0x29c053?_0x432fa7[_0x4aca('0x22')]:_0x34a704[_0x4aca('0x23')]+_0x34a704['limit'];var _0x2c7730;if(_0x2b214d>=_0x28e29d){_0x2b214d=_0x28e29d;_0x2c7730=0xc8;}else{_0x2c7730=0xce;}_0x446542[_0x4aca('0x1e')](_0x2c7730);return _0x446542[_0x4aca('0x24')](_0x4aca('0x25'),_0x29647c+'-'+_0x2b214d+'/'+_0x28e29d)[_0x4aca('0x26')](_0x432fa7);}return null;};}function patchUpdates(_0xd9a3af){return function(_0x4cd117){try{jsonpatch[_0x4aca('0x27')](_0x4cd117,_0xd9a3af,!![]);}catch(_0x92856c){return BPromise[_0x4aca('0x28')](_0x92856c);}return _0x4cd117[_0x4aca('0x29')]();};}function saveUpdates(_0x40b810,_0x1bc4e1){return function(_0x143f8e){if(_0x143f8e){return _0x143f8e[_0x4aca('0x2a')](_0x40b810)[_0x4aca('0x2b')](function(_0xdc9ff9){return _0xdc9ff9;});}return null;};}function removeEntity(_0x5589ea,_0x5c7a79){return function(_0x371e44){if(_0x371e44){return _0x371e44['destroy']()[_0x4aca('0x2b')](function(){_0x5589ea['status'](0xcc)[_0x4aca('0x1f')]();});}};}function handleEntityNotFound(_0x5eac7d,_0x46a442){return function(_0x25f81a){if(!_0x25f81a){_0x5eac7d[_0x4aca('0x1d')](0x194);}return _0x25f81a;};}function handleError(_0x16eed8,_0x276c56){_0x276c56=_0x276c56||0x1f4;return function(_0x2b56ed){logger[_0x4aca('0x2c')](_0x2b56ed[_0x4aca('0x2d')]);if(_0x2b56ed[_0x4aca('0x2e')]){delete _0x2b56ed[_0x4aca('0x2e')];}_0x16eed8[_0x4aca('0x1e')](_0x276c56)[_0x4aca('0x2f')](_0x2b56ed);};}exports['index']=function(_0x407f82,_0x56bbea){var _0x1f6146={},_0x398a53={},_0x4acef9={'count':0x0,'rows':[]};var _0x1e3718=_[_0x4aca('0x30')](db[_0x4aca('0x31')]['rawAttributes'],function(_0xa50997){return{'name':_0xa50997[_0x4aca('0x32')],'type':_0xa50997['type']['key']};});_0x398a53['model']=_[_0x4aca('0x30')](_0x1e3718,_0x4aca('0x2e'));_0x398a53[_0x4aca('0x33')]=_[_0x4aca('0x34')](_0x407f82[_0x4aca('0x33')]);_0x398a53[_0x4aca('0x35')]=_[_0x4aca('0x36')](_0x398a53[_0x4aca('0x37')],_0x398a53[_0x4aca('0x33')]);_0x1f6146[_0x4aca('0x38')]=_[_0x4aca('0x36')](_0x398a53[_0x4aca('0x37')],qs[_0x4aca('0x39')](_0x407f82['query'][_0x4aca('0x39')]));_0x1f6146[_0x4aca('0x38')]=_0x1f6146[_0x4aca('0x38')][_0x4aca('0x3a')]?_0x1f6146[_0x4aca('0x38')]:_0x398a53[_0x4aca('0x37')];if(!_0x407f82['query'][_0x4aca('0x3b')]('nolimit')){_0x1f6146[_0x4aca('0x21')]=qs['limit'](_0x407f82[_0x4aca('0x33')]['limit']);_0x1f6146[_0x4aca('0x23')]=qs[_0x4aca('0x23')](_0x407f82[_0x4aca('0x33')][_0x4aca('0x23')]);}_0x1f6146[_0x4aca('0x3c')]=qs[_0x4aca('0x3d')](_0x407f82[_0x4aca('0x33')][_0x4aca('0x3d')]);_0x1f6146[_0x4aca('0x3e')]=qs[_0x4aca('0x35')](_['pick'](_0x407f82[_0x4aca('0x33')],_0x398a53['filters']),_0x1e3718);if(_0x407f82['query'][_0x4aca('0x3f')]){_0x1f6146[_0x4aca('0x3e')]=_[_0x4aca('0x40')](_0x1f6146[_0x4aca('0x3e')],{'$or':_[_0x4aca('0x30')](_0x1e3718,function(_0x2e671c){if(_0x2e671c[_0x4aca('0x41')]!=='VIRTUAL'){var _0x770d35={};_0x770d35[_0x2e671c[_0x4aca('0x2e')]]={'$like':'%'+_0x407f82[_0x4aca('0x33')][_0x4aca('0x3f')]+'%'};return _0x770d35;}})});}_0x1f6146=_[_0x4aca('0x40')]({},_0x1f6146,_0x407f82[_0x4aca('0x42')]);var _0x1d21ff={'where':_0x1f6146[_0x4aca('0x3e')]};return db[_0x4aca('0x31')][_0x4aca('0x22')](_0x1d21ff)['then'](function(_0x527c2a){_0x4acef9[_0x4aca('0x22')]=_0x527c2a;if(_0x407f82[_0x4aca('0x33')][_0x4aca('0x43')]){_0x1f6146[_0x4aca('0x44')]=[{'all':!![]}];}return db[_0x4aca('0x31')][_0x4aca('0x45')](_0x1f6146);})[_0x4aca('0x2b')](function(_0x400f1c){_0x4acef9[_0x4aca('0x46')]=_0x400f1c;return _0x4acef9;})[_0x4aca('0x2b')](respondWithFilteredResult(_0x56bbea,_0x1f6146))[_0x4aca('0x47')](handleError(_0x56bbea,null));};exports[_0x4aca('0x48')]=function(_0x379af9,_0x3f729a){var _0x4d245b={'raw':!![],'where':{'id':_0x379af9['params']['id']}},_0x116bd3={};_0x116bd3[_0x4aca('0x37')]=_[_0x4aca('0x34')](db[_0x4aca('0x31')][_0x4aca('0x49')]);_0x116bd3['query']=_[_0x4aca('0x34')](_0x379af9[_0x4aca('0x33')]);_0x116bd3[_0x4aca('0x35')]=_[_0x4aca('0x36')](_0x116bd3[_0x4aca('0x37')],_0x116bd3[_0x4aca('0x33')]);_0x4d245b[_0x4aca('0x38')]=_[_0x4aca('0x36')](_0x116bd3[_0x4aca('0x37')],qs[_0x4aca('0x39')](_0x379af9['query'][_0x4aca('0x39')]));_0x4d245b[_0x4aca('0x38')]=_0x4d245b['attributes'][_0x4aca('0x3a')]?_0x4d245b['attributes']:_0x116bd3[_0x4aca('0x37')];if(_0x379af9[_0x4aca('0x33')]['includeAll']){_0x4d245b['include']=[{'all':!![]}];}_0x4d245b=_[_0x4aca('0x40')]({},_0x4d245b,_0x379af9[_0x4aca('0x42')]);return db['ChatInternalMessage'][_0x4aca('0x4a')](_0x4d245b)[_0x4aca('0x2b')](handleEntityNotFound(_0x3f729a,null))['then'](respondWithResult(_0x3f729a,null))[_0x4aca('0x47')](handleError(_0x3f729a,null));};exports[_0x4aca('0x4b')]=function(_0x5924e6,_0xf23ad9){return db[_0x4aca('0x31')][_0x4aca('0x4b')](_0x5924e6[_0x4aca('0x4c')],{})[_0x4aca('0x2b')](respondWithResult(_0xf23ad9,0xc9))[_0x4aca('0x47')](handleError(_0xf23ad9,null));};exports['update']=function(_0x4ea6c7,_0x5e0839){if(_0x4ea6c7[_0x4aca('0x4c')]['id']){delete _0x4ea6c7[_0x4aca('0x4c')]['id'];}return db[_0x4aca('0x31')][_0x4aca('0x4a')]({'where':{'id':_0x4ea6c7[_0x4aca('0x4d')]['id']}})[_0x4aca('0x2b')](handleEntityNotFound(_0x5e0839,null))['then'](saveUpdates(_0x4ea6c7[_0x4aca('0x4c')],null))['then'](respondWithResult(_0x5e0839,null))[_0x4aca('0x47')](handleError(_0x5e0839,null));};exports[_0x4aca('0x4e')]=function(_0x137d19,_0x477131){return db[_0x4aca('0x31')]['find']({'where':{'id':_0x137d19[_0x4aca('0x4d')]['id']}})[_0x4aca('0x2b')](handleEntityNotFound(_0x477131,null))['then'](removeEntity(_0x477131,null))[_0x4aca('0x47')](handleError(_0x477131,null));};exports[_0x4aca('0x4f')]=function(_0x3df672,_0x45659e){return db[_0x4aca('0x31')][_0x4aca('0x4f')]()['then'](respondWithResult(_0x45659e,null))[_0x4aca('0x47')](handleError(_0x45659e,null));};function wrapUser(_0x39108c){return function(_0xbdd59f){var _0x4d7b4b=_0x39108c['get']({'plain':!![]});_0x4d7b4b[_0x4aca('0x50')]=[];if(_0xbdd59f){_0x4d7b4b[_0x4aca('0x51')]=_0xbdd59f['createdAt'];_0x4d7b4b[_0x4aca('0x52')]=_0xbdd59f;}else{_0x4d7b4b[_0x4aca('0x51')]=moment(0x0)[_0x4aca('0x53')](_0x4aca('0x54'));_0x4d7b4b[_0x4aca('0x52')]={};}return _0x4d7b4b;};}exports[_0x4aca('0x55')]=function(_0x466ea2,_0x4d0258,_0x13680e){var _0x1271c7=[];return db[_0x4aca('0x56')][_0x4aca('0x45')]({'where':{'role':[_0x4aca('0x57'),_0x4aca('0x58'),_0x4aca('0x59')]},'attributes':['id',_0x4aca('0x5a'),'name',_0x4aca('0x5b'),_0x4aca('0x5c'),_0x4aca('0x5d'),_0x4aca('0x5e'),_0x4aca('0x5f'),'allowmessenger',_0x4aca('0x60')],'order':qs[_0x4aca('0x3d')]('-online'),'include':[{'model':db[_0x4aca('0x61')],'as':'VoiceQueues','attributes':['id',_0x4aca('0x2e'),_0x4aca('0x41')],'through':{'attributes':[]}}]})['then'](function(_0x542ac){if(_0x542ac){var _0x3b463a=_0x466ea2[_0x4aca('0x59')][_0x4aca('0x62')]({'plain':!![]});if(!_0x3b463a)throw new Error(_0x4aca('0x63'));if(_0x3b463a[_0x4aca('0x5b')]==='user'){return db[_0x4aca('0x64')][_0x4aca('0x4a')]({'where':{'name':_0x4aca('0x65'),'userProfileId':_0x3b463a['userProfileId']},'raw':!![]})[_0x4aca('0x2b')](function(_0x1c1675){if(_0x1c1675){if(_0x1c1675[_0x4aca('0x66')]===0x0){return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x1c1675['id']},'raw':!![]})[_0x4aca('0x2b')](function(_0x166a59){var _0x64fc6b=[];if(_['isEmpty'](_0x166a59)){_0x64fc6b=_[_0x4aca('0x3f')](_0x542ac,function(_0x2841d9){if(_0x2841d9[_0x4aca('0x5b')]!==_0x4aca('0x57')){return _0x2841d9;}});return _0x64fc6b;}else{for(var _0x5bc9a2=0x0;_0x5bc9a2<_0x542ac['length'];_0x5bc9a2++){var _0x5cb600=_0x542ac[_0x5bc9a2];if(_0x5cb600[_0x4aca('0x5b')]===_0x4aca('0x57')){var _0x357eaa=_[_0x4aca('0x4a')](_0x166a59,function(_0x1aedb4){return _0x1aedb4[_0x4aca('0x67')]===_0x5cb600['id'];});if(_0x357eaa)_0x64fc6b[_0x4aca('0x68')](_0x5cb600);}else{_0x64fc6b[_0x4aca('0x68')](_0x5cb600);}}return _0x64fc6b;}});}else{return _0x542ac;}}else{var _0x54a0ca=_[_0x4aca('0x3f')](_0x542ac,function(_0xbe5e3c){if(_0xbe5e3c[_0x4aca('0x5b')]!=='agent'){return _0xbe5e3c;}});return _0x54a0ca;}});}else{return _0x542ac;}}})['then'](function(_0x3a9f4a){var _0x3ea84f=[];if(_0x3a9f4a){_0x1271c7=_0x3a9f4a;for(var _0x44b2ad=0x0;_0x44b2ad<_0x3a9f4a[_0x4aca('0x3a')];_0x44b2ad+=0x1){_0x1271c7[_0x44b2ad]['messages']=[];_0x3ea84f[_0x4aca('0x68')](db[_0x4aca('0x31')]['find']({'where':{'FromId':[_0x466ea2[_0x4aca('0x59')]['id'],_0x3a9f4a[_0x44b2ad]['id']],'ToId':[_0x466ea2['user']['id'],_0x3a9f4a[_0x44b2ad]['id']],'ChatGroupId':null},'attributes':['id',_0x4aca('0x69'),_0x4aca('0x6a'),_0x4aca('0x6b'),_0x4aca('0x6c'),_0x4aca('0x4c')],'order':qs[_0x4aca('0x3d')](_0x4aca('0x6d')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x4aca('0x2b')](wrapUser(_0x3a9f4a[_0x44b2ad])));}return BPromise['all'](_0x3ea84f);}return[];})[_0x4aca('0x2b')](function(_0x10a14b){return{'rows':_0x10a14b,'count':_0x10a14b[_0x4aca('0x3a')]};})[_0x4aca('0x2b')](respondWithResult(_0x4d0258,null))[_0x4aca('0x47')](handleError(_0x4d0258,null));}; \ No newline at end of file +var _0x8d84=['type','model','map','keys','filters','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','describe','get','messages','lastMessageAt','createdAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','User','agent','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','isEmpty','push','FromId','ToId','all','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','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','reject','save','update','then','destroy','error','name','send','index','ChatInternalMessage','rawAttributes','fieldName'];(function(_0xffcd4e,_0x2dc043){var _0x4d0f3e=function(_0xa27f){while(--_0xa27f){_0xffcd4e['push'](_0xffcd4e['shift']());}};_0x4d0f3e(++_0x2dc043);}(_0x8d84,0x18b));var _0x48d8=function(_0x2c6032,_0x16d4db){_0x2c6032=_0x2c6032-0x0;var _0x1aa461=_0x8d84[_0x2c6032];return _0x1aa461;};'use strict';var emlformat=require(_0x48d8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x48d8('0x1'));var jsonpatch=require(_0x48d8('0x2'));var rp=require(_0x48d8('0x3'));var moment=require(_0x48d8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x48d8('0x5'));var util=require('util');var path=require('path');var sox=require(_0x48d8('0x6'));var csv=require(_0x48d8('0x7'));var ejs=require(_0x48d8('0x8'));var fs=require('fs');var fs_extra=require(_0x48d8('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x48d8('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x48d8('0x7'));var querystring=require(_0x48d8('0xb'));var Papa=require(_0x48d8('0xc'));var Redis=require(_0x48d8('0xd'));var authService=require(_0x48d8('0xe'));var qs=require(_0x48d8('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x48d8('0x10'));var logger=require(_0x48d8('0x11'))(_0x48d8('0x12'));var utils=require(_0x48d8('0x13'));var config=require(_0x48d8('0x14'));var licenseUtil=require(_0x48d8('0x15'));var db=require(_0x48d8('0x16'))['db'];config[_0x48d8('0x17')]=_[_0x48d8('0x18')](config[_0x48d8('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x48d8('0x19'))(new Redis(config[_0x48d8('0x17')]));require('./chatInternalMessage.socket')[_0x48d8('0x1a')](socket);function respondWithStatusCode(_0x26f5fc,_0x4201ac){_0x4201ac=_0x4201ac||0xcc;return function(_0x1b90e9){if(_0x1b90e9){return _0x26f5fc[_0x48d8('0x1b')](_0x4201ac);}return _0x26f5fc['status'](_0x4201ac)[_0x48d8('0x1c')]();};}function respondWithResult(_0x45ddf4,_0x43840a){_0x43840a=_0x43840a||0xc8;return function(_0x3fea00){if(_0x3fea00){return _0x45ddf4[_0x48d8('0x1d')](_0x43840a)[_0x48d8('0x1e')](_0x3fea00);}};}function respondWithFilteredResult(_0x55d62b,_0x503096){return function(_0x2192de){if(_0x2192de){var _0x1593df=typeof _0x503096[_0x48d8('0x1f')]===_0x48d8('0x20')&&typeof _0x503096['limit']===_0x48d8('0x20');var _0x22dbad=_0x2192de['count'];var _0x1c81ac=_0x1593df?0x0:_0x503096[_0x48d8('0x1f')];var _0x2c46eb=_0x1593df?_0x2192de[_0x48d8('0x21')]:_0x503096['offset']+_0x503096[_0x48d8('0x22')];var _0x21a258;if(_0x2c46eb>=_0x22dbad){_0x2c46eb=_0x22dbad;_0x21a258=0xc8;}else{_0x21a258=0xce;}_0x55d62b[_0x48d8('0x1d')](_0x21a258);return _0x55d62b[_0x48d8('0x23')]('Content-Range',_0x1c81ac+'-'+_0x2c46eb+'/'+_0x22dbad)[_0x48d8('0x1e')](_0x2192de);}return null;};}function patchUpdates(_0x5020b5){return function(_0x1a0c3b){try{jsonpatch[_0x48d8('0x24')](_0x1a0c3b,_0x5020b5,!![]);}catch(_0x5195c8){return BPromise[_0x48d8('0x25')](_0x5195c8);}return _0x1a0c3b[_0x48d8('0x26')]();};}function saveUpdates(_0x2abf27,_0x3d9935){return function(_0x159153){if(_0x159153){return _0x159153[_0x48d8('0x27')](_0x2abf27)[_0x48d8('0x28')](function(_0x2a4306){return _0x2a4306;});}return null;};}function removeEntity(_0x21285b,_0x36048a){return function(_0x374a86){if(_0x374a86){return _0x374a86[_0x48d8('0x29')]()['then'](function(){_0x21285b[_0x48d8('0x1d')](0xcc)[_0x48d8('0x1c')]();});}};}function handleEntityNotFound(_0x12cd4d,_0xd13967){return function(_0x4604e1){if(!_0x4604e1){_0x12cd4d[_0x48d8('0x1b')](0x194);}return _0x4604e1;};}function handleError(_0x1fe9c3,_0x57ce72){_0x57ce72=_0x57ce72||0x1f4;return function(_0x5623da){logger[_0x48d8('0x2a')](_0x5623da['stack']);if(_0x5623da[_0x48d8('0x2b')]){delete _0x5623da[_0x48d8('0x2b')];}_0x1fe9c3[_0x48d8('0x1d')](_0x57ce72)[_0x48d8('0x2c')](_0x5623da);};}exports[_0x48d8('0x2d')]=function(_0x11c4df,_0x187932){var _0x252625={},_0x1c4139={},_0x5d45be={'count':0x0,'rows':[]};var _0x59c27d=_['map'](db[_0x48d8('0x2e')][_0x48d8('0x2f')],function(_0x170e0c){return{'name':_0x170e0c[_0x48d8('0x30')],'type':_0x170e0c[_0x48d8('0x31')]['key']};});_0x1c4139[_0x48d8('0x32')]=_[_0x48d8('0x33')](_0x59c27d,_0x48d8('0x2b'));_0x1c4139['query']=_[_0x48d8('0x34')](_0x11c4df['query']);_0x1c4139[_0x48d8('0x35')]=_['intersection'](_0x1c4139[_0x48d8('0x32')],_0x1c4139[_0x48d8('0x36')]);_0x252625['attributes']=_[_0x48d8('0x37')](_0x1c4139['model'],qs['fields'](_0x11c4df[_0x48d8('0x36')][_0x48d8('0x38')]));_0x252625[_0x48d8('0x39')]=_0x252625['attributes'][_0x48d8('0x3a')]?_0x252625[_0x48d8('0x39')]:_0x1c4139[_0x48d8('0x32')];if(!_0x11c4df[_0x48d8('0x36')][_0x48d8('0x3b')](_0x48d8('0x3c'))){_0x252625[_0x48d8('0x22')]=qs[_0x48d8('0x22')](_0x11c4df[_0x48d8('0x36')]['limit']);_0x252625[_0x48d8('0x1f')]=qs[_0x48d8('0x1f')](_0x11c4df['query'][_0x48d8('0x1f')]);}_0x252625[_0x48d8('0x3d')]=qs['sort'](_0x11c4df['query'][_0x48d8('0x3e')]);_0x252625[_0x48d8('0x3f')]=qs['filters'](_[_0x48d8('0x40')](_0x11c4df[_0x48d8('0x36')],_0x1c4139['filters']),_0x59c27d);if(_0x11c4df[_0x48d8('0x36')][_0x48d8('0x41')]){_0x252625[_0x48d8('0x3f')]=_[_0x48d8('0x42')](_0x252625[_0x48d8('0x3f')],{'$or':_['map'](_0x59c27d,function(_0xde591b){if(_0xde591b[_0x48d8('0x31')]!==_0x48d8('0x43')){var _0x556ce9={};_0x556ce9[_0xde591b[_0x48d8('0x2b')]]={'$like':'%'+_0x11c4df[_0x48d8('0x36')][_0x48d8('0x41')]+'%'};return _0x556ce9;}})});}_0x252625=_[_0x48d8('0x42')]({},_0x252625,_0x11c4df[_0x48d8('0x44')]);var _0x14762e={'where':_0x252625[_0x48d8('0x3f')]};return db[_0x48d8('0x2e')][_0x48d8('0x21')](_0x14762e)[_0x48d8('0x28')](function(_0x33d5bf){_0x5d45be[_0x48d8('0x21')]=_0x33d5bf;if(_0x11c4df[_0x48d8('0x36')][_0x48d8('0x45')]){_0x252625['include']=[{'all':!![]}];}return db[_0x48d8('0x2e')][_0x48d8('0x46')](_0x252625);})[_0x48d8('0x28')](function(_0xd32ddc){_0x5d45be[_0x48d8('0x47')]=_0xd32ddc;return _0x5d45be;})[_0x48d8('0x28')](respondWithFilteredResult(_0x187932,_0x252625))['catch'](handleError(_0x187932,null));};exports[_0x48d8('0x48')]=function(_0x2fd7d8,_0x1b4e7f){var _0x298c44={'raw':!![],'where':{'id':_0x2fd7d8[_0x48d8('0x49')]['id']}},_0x58b42e={};_0x58b42e['model']=_[_0x48d8('0x34')](db[_0x48d8('0x2e')][_0x48d8('0x2f')]);_0x58b42e[_0x48d8('0x36')]=_[_0x48d8('0x34')](_0x2fd7d8['query']);_0x58b42e[_0x48d8('0x35')]=_[_0x48d8('0x37')](_0x58b42e[_0x48d8('0x32')],_0x58b42e['query']);_0x298c44[_0x48d8('0x39')]=_['intersection'](_0x58b42e[_0x48d8('0x32')],qs[_0x48d8('0x38')](_0x2fd7d8['query'][_0x48d8('0x38')]));_0x298c44['attributes']=_0x298c44['attributes'][_0x48d8('0x3a')]?_0x298c44['attributes']:_0x58b42e['model'];if(_0x2fd7d8[_0x48d8('0x36')][_0x48d8('0x45')]){_0x298c44[_0x48d8('0x4a')]=[{'all':!![]}];}_0x298c44=_[_0x48d8('0x42')]({},_0x298c44,_0x2fd7d8[_0x48d8('0x44')]);return db[_0x48d8('0x2e')][_0x48d8('0x4b')](_0x298c44)[_0x48d8('0x28')](handleEntityNotFound(_0x1b4e7f,null))['then'](respondWithResult(_0x1b4e7f,null))[_0x48d8('0x4c')](handleError(_0x1b4e7f,null));};exports[_0x48d8('0x4d')]=function(_0x3746d1,_0x590b8d){return db['ChatInternalMessage'][_0x48d8('0x4d')](_0x3746d1['body'],{})['then'](respondWithResult(_0x590b8d,0xc9))[_0x48d8('0x4c')](handleError(_0x590b8d,null));};exports[_0x48d8('0x27')]=function(_0x8d5674,_0x10c088){if(_0x8d5674[_0x48d8('0x4e')]['id']){delete _0x8d5674[_0x48d8('0x4e')]['id'];}return db[_0x48d8('0x2e')]['find']({'where':{'id':_0x8d5674[_0x48d8('0x49')]['id']}})[_0x48d8('0x28')](handleEntityNotFound(_0x10c088,null))[_0x48d8('0x28')](saveUpdates(_0x8d5674[_0x48d8('0x4e')],null))['then'](respondWithResult(_0x10c088,null))[_0x48d8('0x4c')](handleError(_0x10c088,null));};exports['destroy']=function(_0x500cd1,_0x241c95){return db[_0x48d8('0x2e')][_0x48d8('0x4b')]({'where':{'id':_0x500cd1[_0x48d8('0x49')]['id']}})['then'](handleEntityNotFound(_0x241c95,null))[_0x48d8('0x28')](removeEntity(_0x241c95,null))[_0x48d8('0x4c')](handleError(_0x241c95,null));};exports[_0x48d8('0x4f')]=function(_0x15ff8a,_0x4e1a7b){return db[_0x48d8('0x2e')]['describe']()[_0x48d8('0x28')](respondWithResult(_0x4e1a7b,null))[_0x48d8('0x4c')](handleError(_0x4e1a7b,null));};function wrapUser(_0x44cc57){return function(_0x4cc02a){var _0x5c7b23=_0x44cc57[_0x48d8('0x50')]({'plain':!![]});_0x5c7b23[_0x48d8('0x51')]=[];if(_0x4cc02a){_0x5c7b23[_0x48d8('0x52')]=_0x4cc02a[_0x48d8('0x53')];_0x5c7b23['lastMessage']=_0x4cc02a;}else{_0x5c7b23[_0x48d8('0x52')]=moment(0x0)[_0x48d8('0x54')](_0x48d8('0x55'));_0x5c7b23[_0x48d8('0x56')]={};}return _0x5c7b23;};}exports['getUsers']=function(_0x4febbb,_0x1d8c11,_0x539949){var _0x5cddd1=[];return db[_0x48d8('0x57')][_0x48d8('0x46')]({'where':{'role':[_0x48d8('0x58'),_0x48d8('0x59'),_0x48d8('0x5a')]},'attributes':['id',_0x48d8('0x5b'),'name',_0x48d8('0x5c'),_0x48d8('0x5d'),_0x48d8('0x5e'),_0x48d8('0x5f'),_0x48d8('0x60'),_0x48d8('0x61'),'showWebBar'],'order':qs['sort'](_0x48d8('0x62')),'include':[{'model':db[_0x48d8('0x63')],'as':_0x48d8('0x64'),'attributes':['id','name',_0x48d8('0x31')],'through':{'attributes':[]}}]})[_0x48d8('0x28')](function(_0x3fb397){if(_0x3fb397){var _0x5a29b9=_0x4febbb[_0x48d8('0x5a')][_0x48d8('0x50')]({'plain':!![]});if(!_0x5a29b9)throw new Error(_0x48d8('0x65'));if(_0x5a29b9[_0x48d8('0x5c')]===_0x48d8('0x5a')){return db[_0x48d8('0x66')]['find']({'where':{'name':_0x48d8('0x67'),'userProfileId':_0x5a29b9[_0x48d8('0x68')]},'raw':!![]})[_0x48d8('0x28')](function(_0x20719){if(_0x20719){if(_0x20719[_0x48d8('0x69')]===0x0){return db['UserProfileResource'][_0x48d8('0x46')]({'where':{'sectionId':_0x20719['id']},'raw':!![]})['then'](function(_0x3a5d79){var _0x32a9e4=[];if(_[_0x48d8('0x6a')](_0x3a5d79)){_0x32a9e4=_[_0x48d8('0x41')](_0x3fb397,function(_0x414102){if(_0x414102[_0x48d8('0x5c')]!==_0x48d8('0x58')){return _0x414102;}});return _0x32a9e4;}else{for(var _0x53c9a4=0x0;_0x53c9a4<_0x3fb397[_0x48d8('0x3a')];_0x53c9a4++){var _0x55f15f=_0x3fb397[_0x53c9a4];if(_0x55f15f[_0x48d8('0x5c')]===_0x48d8('0x58')){var _0x2ecfb4=_['find'](_0x3a5d79,function(_0x52bec2){return _0x52bec2['resourceId']===_0x55f15f['id'];});if(_0x2ecfb4)_0x32a9e4[_0x48d8('0x6b')](_0x55f15f);}else{_0x32a9e4[_0x48d8('0x6b')](_0x55f15f);}}return _0x32a9e4;}});}else{return _0x3fb397;}}else{var _0x374080=_[_0x48d8('0x41')](_0x3fb397,function(_0x43bcf8){if(_0x43bcf8[_0x48d8('0x5c')]!=='agent'){return _0x43bcf8;}});return _0x374080;}});}else{return _0x3fb397;}}})[_0x48d8('0x28')](function(_0x51d5ad){var _0x15495b=[];if(_0x51d5ad){_0x5cddd1=_0x51d5ad;for(var _0x132996=0x0;_0x132996<_0x51d5ad[_0x48d8('0x3a')];_0x132996+=0x1){_0x5cddd1[_0x132996][_0x48d8('0x51')]=[];_0x15495b[_0x48d8('0x6b')](db[_0x48d8('0x2e')]['find']({'where':{'FromId':[_0x4febbb[_0x48d8('0x5a')]['id'],_0x51d5ad[_0x132996]['id']],'ToId':[_0x4febbb[_0x48d8('0x5a')]['id'],_0x51d5ad[_0x132996]['id']],'ChatGroupId':null},'attributes':['id',_0x48d8('0x53'),_0x48d8('0x6c'),_0x48d8('0x6d'),'read',_0x48d8('0x4e')],'order':qs[_0x48d8('0x3e')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x48d8('0x28')](wrapUser(_0x51d5ad[_0x132996])));}return BPromise[_0x48d8('0x6e')](_0x15495b);}return[];})[_0x48d8('0x28')](function(_0x3904de){return{'rows':_0x3904de,'count':_0x3904de[_0x48d8('0x3a')]};})[_0x48d8('0x28')](respondWithResult(_0x1d8c11,null))[_0x48d8('0x4c')](handleError(_0x1d8c11,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index ab9e707..3e2b76a 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 _0x78ca=['ChatInternalMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x4b9b14,_0x4e226b){var _0x26ccdc=function(_0x14f5f6){while(--_0x14f5f6){_0x4b9b14['push'](_0x4b9b14['shift']());}};_0x26ccdc(++_0x4e226b);}(_0x78ca,0xee));var _0xa78c=function(_0x492832,_0x311a6d){_0x492832=_0x492832-0x0;var _0x5c41c8=_0x78ca[_0x492832];return _0x5c41c8;};'use strict';var EventEmitter=require(_0xa78c('0x0'));var ChatInternalMessage=require(_0xa78c('0x1'))['db'][_0xa78c('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xa78c('0x3')](0x0);var events={'afterCreate':_0xa78c('0x4'),'afterUpdate':_0xa78c('0x5'),'afterDestroy':_0xa78c('0x6')};function emitEvent(_0x228a95){return function(_0x4e51b6,_0x438ade,_0x572ae7){ChatInternalMessageEvents[_0xa78c('0x7')](_0x228a95+':'+_0x4e51b6['id'],_0x4e51b6);ChatInternalMessageEvents[_0xa78c('0x7')](_0x228a95,_0x4e51b6);_0x572ae7(null);};}for(var e in events){if(events[_0xa78c('0x8')](e)){var event=events[e];ChatInternalMessage[_0xa78c('0x9')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0xeb5e=['../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x327184,_0x1ed5b2){var _0x309f8c=function(_0x4ae254){while(--_0x4ae254){_0x327184['push'](_0x327184['shift']());}};_0x309f8c(++_0x1ed5b2);}(_0xeb5e,0x134));var _0xeeb5=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xeb5e[_0x12d033];return _0x3b4e80;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0xeeb5('0x0'))['db'][_0xeeb5('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xeeb5('0x2')](0x0);var events={'afterCreate':_0xeeb5('0x3'),'afterUpdate':_0xeeb5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x35fb67){return function(_0x2ed705,_0x565a2a,_0x286f77){ChatInternalMessageEvents[_0xeeb5('0x5')](_0x35fb67+':'+_0x2ed705['id'],_0x2ed705);ChatInternalMessageEvents[_0xeeb5('0x5')](_0x35fb67,_0x2ed705);_0x286f77(null);};}for(var e in events){if(events[_0xeeb5('0x6')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index f5a91d1..13ec684 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 _0x7c58=['../../config/environment','./chatInternalMessage.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x4a919f,_0x553927){var _0x2cd4ab=function(_0x568811){while(--_0x568811){_0x4a919f['push'](_0x4a919f['shift']());}};_0x2cd4ab(++_0x553927);}(_0x7c58,0xea));var _0x87c5=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x7c58[_0x2070da];return _0x4f9fe1;};'use strict';var _=require(_0x87c5('0x0'));var util=require(_0x87c5('0x1'));var logger=require(_0x87c5('0x2'))('api');var moment=require('moment');var BPromise=require(_0x87c5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x87c5('0x4'));var rimraf=require(_0x87c5('0x5'));var config=require(_0x87c5('0x6'));var attributes=require(_0x87c5('0x7'));module[_0x87c5('0x8')]=function(_0x35b89a,_0x2cac93){return _0x35b89a[_0x87c5('0x9')]('ChatInternalMessage',attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x87c5('0xa'),'collate':_0x87c5('0xb')});}; \ No newline at end of file +var _0xe2da=['request-promise','path','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment'];(function(_0x9c79b3,_0x5c5ac0){var _0x2b897a=function(_0x13cdc8){while(--_0x13cdc8){_0x9c79b3['push'](_0x9c79b3['shift']());}};_0x2b897a(++_0x5c5ac0);}(_0xe2da,0xf8));var _0xae2d=function(_0x414c40,_0x515d1d){_0x414c40=_0x414c40-0x0;var _0x3c0c6a=_0xe2da[_0x414c40];return _0x3c0c6a;};'use strict';var _=require(_0xae2d('0x0'));var util=require(_0xae2d('0x1'));var logger=require('../../config/logger')(_0xae2d('0x2'));var moment=require(_0xae2d('0x3'));var BPromise=require('bluebird');var rp=require(_0xae2d('0x4'));var fs=require('fs');var path=require(_0xae2d('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xae2d('0x6'));module[_0xae2d('0x7')]=function(_0x395326,_0x4aeb1a){return _0x395326[_0xae2d('0x8')](_0xae2d('0x9'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xae2d('0xa'),'collate':_0xae2d('0xb')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index ba91830..ea0bc91 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 _0x59f1=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x59f1,0x199));var _0x159f=function(_0x2cd48f,_0x5c8878){_0x2cd48f=_0x2cd48f-0x0;var _0x194fa6=_0x59f1[_0x2cd48f];return _0x194fa6;};'use strict';var _=require('lodash');var util=require(_0x159f('0x0'));var moment=require('moment');var BPromise=require(_0x159f('0x1'));var rs=require(_0x159f('0x2'));var fs=require('fs');var Redis=require(_0x159f('0x3'));var db=require(_0x159f('0x4'))['db'];var utils=require(_0x159f('0x5'));var logger=require(_0x159f('0x6'))(_0x159f('0x7'));var config=require(_0x159f('0x8'));var jayson=require(_0x159f('0x9'));var client=jayson[_0x159f('0xa')][_0x159f('0xb')]({'port':0x232a});config['redis']=_[_0x159f('0xc')](config[_0x159f('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x159f('0xd')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithRpcPromise(_0xa44380,_0x4a48a3,_0x2d2493){return new BPromise(function(_0x5b9471,_0xb62b49){return client[_0x159f('0xe')](_0xa44380,_0x2d2493)[_0x159f('0xf')](function(_0x1b1c4b){logger[_0x159f('0x10')](_0x159f('0x11'),_0x4a48a3,_0x159f('0x12'));logger[_0x159f('0x13')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x4a48a3,_0x159f('0x12'),JSON['stringify'](_0x1b1c4b));if(_0x1b1c4b[_0x159f('0x14')]){if(_0x1b1c4b[_0x159f('0x14')][_0x159f('0x15')]===0x1f4){logger[_0x159f('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x4a48a3,_0x1b1c4b['error']['message']);return _0xb62b49(_0x1b1c4b['error'][_0x159f('0x16')]);}logger[_0x159f('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x4a48a3,_0x1b1c4b[_0x159f('0x14')]['message']);return _0x5b9471(_0x1b1c4b[_0x159f('0x14')][_0x159f('0x16')]);}else{logger['info'](_0x159f('0x11'),_0x4a48a3,_0x159f('0x12'));_0x5b9471(_0x1b1c4b['result'][_0x159f('0x16')]);}})['catch'](function(_0xbd59fe){logger[_0x159f('0x14')](_0x159f('0x11'),_0x4a48a3,_0xbd59fe);_0xb62b49(_0xbd59fe);});});} \ No newline at end of file +var _0x37f5=['jayson/promise','client','http','defaults','redis','socket.io-emitter','./chatInternalMessage.socket','request','then','info','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatInternalMessage,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0x37f5,0x7b));var _0x537f=function(_0x1c1a54,_0xae9d1a){_0x1c1a54=_0x1c1a54-0x0;var _0x466397=_0x37f5[_0x1c1a54];return _0x466397;};'use strict';var _=require('lodash');var util=require(_0x537f('0x0'));var moment=require('moment');var BPromise=require(_0x537f('0x1'));var rs=require(_0x537f('0x2'));var fs=require('fs');var Redis=require(_0x537f('0x3'));var db=require(_0x537f('0x4'))['db'];var utils=require(_0x537f('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x537f('0x6'));var jayson=require(_0x537f('0x7'));var client=jayson[_0x537f('0x8')][_0x537f('0x9')]({'port':0x232a});config['redis']=_[_0x537f('0xa')](config[_0x537f('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x537f('0xc'))(new Redis(config[_0x537f('0xb')]));require(_0x537f('0xd'))['register'](socket);function respondWithRpcPromise(_0x17ca0e,_0x58c9f0,_0x4515c6){return new BPromise(function(_0xbfcb97,_0x2e7e57){return client[_0x537f('0xe')](_0x17ca0e,_0x4515c6)[_0x537f('0xf')](function(_0x1d0bc7){logger[_0x537f('0x10')]('ChatInternalMessage,\x20%s,\x20%s',_0x58c9f0,_0x537f('0x11'));logger[_0x537f('0x12')](_0x537f('0x13'),_0x58c9f0,_0x537f('0x11'),JSON[_0x537f('0x14')](_0x1d0bc7));if(_0x1d0bc7[_0x537f('0x15')]){if(_0x1d0bc7[_0x537f('0x15')]['code']===0x1f4){logger[_0x537f('0x15')](_0x537f('0x16'),_0x58c9f0,_0x1d0bc7[_0x537f('0x15')][_0x537f('0x17')]);return _0x2e7e57(_0x1d0bc7[_0x537f('0x15')][_0x537f('0x17')]);}logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x58c9f0,_0x1d0bc7['error']['message']);return _0xbfcb97(_0x1d0bc7[_0x537f('0x15')][_0x537f('0x17')]);}else{logger[_0x537f('0x10')]('ChatInternalMessage,\x20%s,\x20%s',_0x58c9f0,_0x537f('0x11'));_0xbfcb97(_0x1d0bc7[_0x537f('0x18')][_0x537f('0x17')]);}})[_0x537f('0x19')](function(_0x5e8179){logger[_0x537f('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x58c9f0,_0x5e8179);_0x2e7e57(_0x5e8179);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index f848768..d67179c 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 _0x4ce4=['register','chatInternalMessage:','./chatInternalMessage.events','remove','update','emit','removeListener'];(function(_0xdab12a,_0x4012b9){var _0x4fb77d=function(_0x48ab41){while(--_0x48ab41){_0xdab12a['push'](_0xdab12a['shift']());}};_0x4fb77d(++_0x4012b9);}(_0x4ce4,0xa3));var _0x44ce=function(_0x24c14e,_0x55fc09){_0x24c14e=_0x24c14e-0x0;var _0x589035=_0x4ce4[_0x24c14e];return _0x589035;};'use strict';var ChatInternalMessageEvents=require(_0x44ce('0x0'));var events=['save',_0x44ce('0x1'),_0x44ce('0x2')];function createListener(_0x69cb87,_0x53fcb3){return function(_0x2b7008){_0x53fcb3[_0x44ce('0x3')](_0x69cb87,_0x2b7008);};}function removeListener(_0x5e6fa3,_0x1e141a){return function(){ChatInternalMessageEvents[_0x44ce('0x4')](_0x5e6fa3,_0x1e141a);};}exports[_0x44ce('0x5')]=function(_0x3cb381){for(var _0x2bebb0=0x0,_0xba961a=events['length'];_0x2bebb0<_0xba961a;_0x2bebb0++){var _0x8ea18d=events[_0x2bebb0];var _0x40da3f=createListener(_0x44ce('0x6')+_0x8ea18d,_0x3cb381);ChatInternalMessageEvents['on'](_0x8ea18d,_0x40da3f);}}; \ No newline at end of file +var _0x2255=['save','remove','emit','chatInternalMessage:','./chatInternalMessage.events'];(function(_0xf1751e,_0x30f07c){var _0x28c90d=function(_0x2fed2b){while(--_0x2fed2b){_0xf1751e['push'](_0xf1751e['shift']());}};_0x28c90d(++_0x30f07c);}(_0x2255,0x153));var _0x5225=function(_0x4262d3,_0x2bd0ce){_0x4262d3=_0x4262d3-0x0;var _0x5042fa=_0x2255[_0x4262d3];return _0x5042fa;};'use strict';var ChatInternalMessageEvents=require(_0x5225('0x0'));var events=[_0x5225('0x1'),_0x5225('0x2'),'update'];function createListener(_0x2b7a79,_0x5da9b9){return function(_0x34ed07){_0x5da9b9[_0x5225('0x3')](_0x2b7a79,_0x34ed07);};}function removeListener(_0x365d45,_0x2159c6){return function(){ChatInternalMessageEvents['removeListener'](_0x365d45,_0x2159c6);};}exports['register']=function(_0x1811ec){for(var _0x59e6d0=0x0,_0x44d53e=events['length'];_0x59e6d0<_0x44d53e;_0x59e6d0++){var _0x594140=events[_0x59e6d0];var _0x2562a8=createListener(_0x5225('0x4')+_0x594140,_0x1811ec);ChatInternalMessageEvents['on'](_0x594140,_0x2562a8);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 529296f..c06a24f 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 _0x27f0=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','/:id','put','update','delete','exports','multer','util'];(function(_0x3cd2ee,_0x363ab7){var _0x4a7208=function(_0x26e9b9){while(--_0x26e9b9){_0x3cd2ee['push'](_0x3cd2ee['shift']());}};_0x4a7208(++_0x363ab7);}(_0x27f0,0x8a));var _0x027f=function(_0x54df31,_0x56de20){_0x54df31=_0x54df31-0x0;var _0x3636ed=_0x27f0[_0x54df31];return _0x3636ed;};'use strict';var multer=require(_0x027f('0x0'));var util=require(_0x027f('0x1'));var path=require(_0x027f('0x2'));var timeout=require('connect-timeout');var express=require(_0x027f('0x3'));var router=express[_0x027f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x027f('0x5'));var interaction=require(_0x027f('0x6'));var config=require(_0x027f('0x7'));var controller=require(_0x027f('0x8'));router[_0x027f('0x9')]('/',auth[_0x027f('0xa')](),controller[_0x027f('0xb')]);router['get'](_0x027f('0xc'),auth['isAuthenticated'](),controller[_0x027f('0xd')]);router[_0x027f('0x9')](_0x027f('0xe'),auth[_0x027f('0xa')](),controller['getUsers']);router['get'](_0x027f('0xf'),auth[_0x027f('0xa')](),controller['show']);router['post']('/',auth[_0x027f('0xa')](),controller['create']);router[_0x027f('0x10')](_0x027f('0xf'),controller[_0x027f('0x11')]);router[_0x027f('0x12')](_0x027f('0xf'),auth[_0x027f('0xa')](),controller['destroy']);module[_0x027f('0x13')]=router; \ No newline at end of file +var _0x6d53=['/:id','show','post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers'];(function(_0x351a91,_0x2b78e3){var _0x58c94d=function(_0x49839b){while(--_0x49839b){_0x351a91['push'](_0x351a91['shift']());}};_0x58c94d(++_0x2b78e3);}(_0x6d53,0x68));var _0x36d5=function(_0x402d17,_0x3ee054){_0x402d17=_0x402d17-0x0;var _0x5b791b=_0x6d53[_0x402d17];return _0x5b791b;};'use strict';var multer=require(_0x36d5('0x0'));var util=require(_0x36d5('0x1'));var path=require('path');var timeout=require(_0x36d5('0x2'));var express=require(_0x36d5('0x3'));var router=express[_0x36d5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x36d5('0x5'));var interaction=require(_0x36d5('0x6'));var config=require(_0x36d5('0x7'));var controller=require(_0x36d5('0x8'));router[_0x36d5('0x9')]('/',auth[_0x36d5('0xa')](),controller[_0x36d5('0xb')]);router[_0x36d5('0x9')](_0x36d5('0xc'),auth[_0x36d5('0xa')](),controller[_0x36d5('0xd')]);router['get'](_0x36d5('0xe'),auth['isAuthenticated'](),controller[_0x36d5('0xf')]);router[_0x36d5('0x9')](_0x36d5('0x10'),auth['isAuthenticated'](),controller[_0x36d5('0x11')]);router[_0x36d5('0x12')]('/',auth[_0x36d5('0xa')](),controller[_0x36d5('0x13')]);router[_0x36d5('0x14')](_0x36d5('0x10'),controller['update']);router[_0x36d5('0x15')](_0x36d5('0x10'),auth['isAuthenticated'](),controller[_0x36d5('0x16')]);module[_0x36d5('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index b0ef19c..e04f41c 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 _0x578c=['sequelize','exports','TEXT','BOOLEAN','ENUM','out','DATE','STRING'];(function(_0x332740,_0x267c85){var _0x2681ed=function(_0x31c35c){while(--_0x31c35c){_0x332740['push'](_0x332740['shift']());}};_0x2681ed(++_0x267c85);}(_0x578c,0x158));var _0xc578=function(_0x21cf68,_0x264c24){_0x21cf68=_0x21cf68-0x0;var _0x250910=_0x578c[_0x21cf68];return _0x250910;};'use strict';var Sequelize=require(_0xc578('0x0'));module[_0xc578('0x1')]={'body':{'type':Sequelize[_0xc578('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xc578('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xc578('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc578('0x4')]('in','out'),'defaultValue':_0xc578('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xc578('0x6')]},'providerName':{'type':Sequelize[_0xc578('0x7')]},'providerResponse':{'type':Sequelize[_0xc578('0x2')]}}; \ No newline at end of file +var _0xf894=['STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','DATE'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf894,0xfd));var _0x4f89=function(_0x2ec238,_0x5abc41){_0x2ec238=_0x2ec238-0x0;var _0x2c0424=_0xf894[_0x2ec238];return _0x2c0424;};'use strict';var Sequelize=require(_0x4f89('0x0'));module[_0x4f89('0x1')]={'body':{'type':Sequelize[_0x4f89('0x2')](_0x4f89('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x4f89('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x4f89('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4f89('0x5')]('in',_0x4f89('0x6')),'defaultValue':_0x4f89('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x4f89('0x7')]},'providerName':{'type':Sequelize[_0x4f89('0x8')]},'providerResponse':{'type':Sequelize[_0x4f89('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index bee64e9..46d8304 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 _0x433d=['../../mysqldb','redis','defaults','localhost','socket.io-emitter','client','http','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','destroy','stack','name','index','ChatMessage','rawAttributes','type','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','include','find','create','body','describe','../../config/logger','chat-interactions','accept','chat','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','params','get','ChatInteraction','ChatInteractionId','isNil','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','User','email','internal','manual','interface','SIP/%s','motionChannel','channel','event','EventManager','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','contact','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x1ad0c1,_0x35a3f1){var _0x5e6656=function(_0x866c27){while(--_0x866c27){_0x1ad0c1['push'](_0x1ad0c1['shift']());}};_0x5e6656(++_0x35a3f1);}(_0x433d,0xe9));var _0xd433=function(_0x5e9d35,_0x382c91){_0x5e9d35=_0x5e9d35-0x0;var _0x3beb2e=_0x433d[_0x5e9d35];return _0x3beb2e;};'use strict';var emlformat=require(_0xd433('0x0'));var rimraf=require(_0xd433('0x1'));var zipdir=require(_0xd433('0x2'));var jsonpatch=require(_0xd433('0x3'));var rp=require('request-promise');var moment=require(_0xd433('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd433('0x5'));var util=require(_0xd433('0x6'));var path=require(_0xd433('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd433('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd433('0x9'));var squel=require(_0xd433('0xa'));var crypto=require(_0xd433('0xb'));var jsforce=require(_0xd433('0xc'));var deskjs=require(_0xd433('0xd'));var toCsv=require(_0xd433('0xe'));var querystring=require(_0xd433('0xf'));var Papa=require(_0xd433('0x10'));var Redis=require(_0xd433('0x11'));var authService=require(_0xd433('0x12'));var qs=require(_0xd433('0x13'));var as=require(_0xd433('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd433('0x15'))['db'];config[_0xd433('0x16')]=_[_0xd433('0x17')](config[_0xd433('0x16')],{'host':_0xd433('0x18'),'port':0x18eb});var socket=require(_0xd433('0x19'))(new Redis(config[_0xd433('0x16')]));require('./chatMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xd433('0x1a')][_0xd433('0x1b')]({'port':0x232c});var client9002=jayson['client'][_0xd433('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x320f5f,_0x1fa0c9,_0x133b35,_0x38931a){return new BPromise(function(_0x56eb37,_0x570ed1){var _0x41a44c=_0x38931a||client;return _0x41a44c['request'](_0x320f5f,_0x133b35)[_0xd433('0x1c')](function(_0x1cafd0){logger[_0xd433('0x1d')](_0xd433('0x1e'),_0x1fa0c9,_0xd433('0x1f'));logger['debug'](_0xd433('0x20'),_0x1fa0c9,_0xd433('0x1f'),JSON[_0xd433('0x21')](_0x1cafd0));if(_0x1cafd0[_0xd433('0x22')]){if(_0x1cafd0['error'][_0xd433('0x23')]===0x1f4){logger[_0xd433('0x22')](_0xd433('0x1e'),_0x1fa0c9,_0x1cafd0['error']['message']);return _0x570ed1(_0x1cafd0[_0xd433('0x22')][_0xd433('0x24')]);}logger['error'](_0xd433('0x1e'),_0x1fa0c9,_0x1cafd0[_0xd433('0x22')][_0xd433('0x24')]);return _0x56eb37(_0x1cafd0[_0xd433('0x22')][_0xd433('0x24')]);}else{logger[_0xd433('0x1d')](_0xd433('0x1e'),_0x1fa0c9,'request\x20sent');_0x56eb37(_0x1cafd0['result'][_0xd433('0x24')]);}})[_0xd433('0x25')](function(_0x2aaf1a){logger['error'](_0xd433('0x1e'),_0x1fa0c9,_0x2aaf1a);_0x570ed1(_0x2aaf1a);});});}function respondWithStatusCode(_0x5df057,_0x4dde8c){_0x4dde8c=_0x4dde8c||0xcc;return function(_0x43d589){if(_0x43d589){return _0x5df057['sendStatus'](_0x4dde8c);}return _0x5df057[_0xd433('0x26')](_0x4dde8c)[_0xd433('0x27')]();};}function respondWithResult(_0x32091d,_0x52d047){_0x52d047=_0x52d047||0xc8;return function(_0x24717e){if(_0x24717e){return _0x32091d[_0xd433('0x26')](_0x52d047)[_0xd433('0x28')](_0x24717e);}};}function respondWithFilteredResult(_0x22cc1c,_0x389167){return function(_0x724d36){if(_0x724d36){var _0x44d51a=typeof _0x389167[_0xd433('0x29')]===_0xd433('0x2a')&&typeof _0x389167['limit']===_0xd433('0x2a');var _0x4bebcf=_0x724d36['count'];var _0x4d42b4=_0x44d51a?0x0:_0x389167['offset'];var _0x2bca1f=_0x44d51a?_0x724d36[_0xd433('0x2b')]:_0x389167[_0xd433('0x29')]+_0x389167[_0xd433('0x2c')];var _0x5ae7c2;if(_0x2bca1f>=_0x4bebcf){_0x2bca1f=_0x4bebcf;_0x5ae7c2=0xc8;}else{_0x5ae7c2=0xce;}_0x22cc1c[_0xd433('0x26')](_0x5ae7c2);return _0x22cc1c[_0xd433('0x2d')]('Content-Range',_0x4d42b4+'-'+_0x2bca1f+'/'+_0x4bebcf)[_0xd433('0x28')](_0x724d36);}return null;};}function patchUpdates(_0x383eb1){return function(_0x300bb5){try{jsonpatch[_0xd433('0x2e')](_0x300bb5,_0x383eb1,!![]);}catch(_0xb1d4ca){return BPromise[_0xd433('0x2f')](_0xb1d4ca);}return _0x300bb5[_0xd433('0x30')]();};}function saveUpdates(_0x197b2b,_0xb3e4aa){return function(_0x2979fb){if(_0x2979fb){return _0x2979fb[_0xd433('0x31')](_0x197b2b)[_0xd433('0x1c')](function(_0x132b05){return _0x132b05;});}return null;};}function removeEntity(_0x28b5f7,_0x480a6d){return function(_0x360ae2){if(_0x360ae2){return _0x360ae2[_0xd433('0x32')]()[_0xd433('0x1c')](function(){_0x28b5f7[_0xd433('0x26')](0xcc)[_0xd433('0x27')]();});}};}function handleEntityNotFound(_0x4b9515,_0x1a8f50){return function(_0x1ef634){if(!_0x1ef634){_0x4b9515['sendStatus'](0x194);}return _0x1ef634;};}function handleError(_0x35f27c,_0x44bba1){_0x44bba1=_0x44bba1||0x1f4;return function(_0x3874a2){logger['error'](_0x3874a2[_0xd433('0x33')]);if(_0x3874a2[_0xd433('0x34')]){delete _0x3874a2[_0xd433('0x34')];}_0x35f27c['status'](_0x44bba1)['send'](_0x3874a2);};}exports[_0xd433('0x35')]=function(_0x1d5e07,_0x1ca309){var _0x5d9e0d={},_0x53cbf2={},_0x2098f9={'count':0x0,'rows':[]};var _0x45a51f=_['map'](db[_0xd433('0x36')][_0xd433('0x37')],function(_0x9cad93){return{'name':_0x9cad93['fieldName'],'type':_0x9cad93[_0xd433('0x38')]['key']};});_0x53cbf2[_0xd433('0x39')]=_[_0xd433('0x3a')](_0x45a51f,'name');_0x53cbf2[_0xd433('0x3b')]=_[_0xd433('0x3c')](_0x1d5e07['query']);_0x53cbf2[_0xd433('0x3d')]=_['intersection'](_0x53cbf2['model'],_0x53cbf2['query']);_0x5d9e0d[_0xd433('0x3e')]=_[_0xd433('0x3f')](_0x53cbf2[_0xd433('0x39')],qs[_0xd433('0x40')](_0x1d5e07[_0xd433('0x3b')][_0xd433('0x40')]));_0x5d9e0d[_0xd433('0x3e')]=_0x5d9e0d[_0xd433('0x3e')][_0xd433('0x41')]?_0x5d9e0d['attributes']:_0x53cbf2[_0xd433('0x39')];if(!_0x1d5e07['query']['hasOwnProperty'](_0xd433('0x42'))){_0x5d9e0d[_0xd433('0x2c')]=qs[_0xd433('0x2c')](_0x1d5e07['query'][_0xd433('0x2c')]);_0x5d9e0d['offset']=qs[_0xd433('0x29')](_0x1d5e07[_0xd433('0x3b')][_0xd433('0x29')]);}_0x5d9e0d[_0xd433('0x43')]=qs[_0xd433('0x44')](_0x1d5e07[_0xd433('0x3b')][_0xd433('0x44')]);_0x5d9e0d[_0xd433('0x45')]=qs[_0xd433('0x3d')](_[_0xd433('0x46')](_0x1d5e07['query'],_0x53cbf2['filters']),_0x45a51f);if(_0x1d5e07[_0xd433('0x3b')][_0xd433('0x47')]){_0x5d9e0d['where']=_[_0xd433('0x48')](_0x5d9e0d[_0xd433('0x45')],{'$or':_[_0xd433('0x3a')](_0x45a51f,function(_0x4766df){if(_0x4766df['type']!==_0xd433('0x49')){var _0x1419a3={};_0x1419a3[_0x4766df[_0xd433('0x34')]]={'$like':'%'+_0x1d5e07[_0xd433('0x3b')][_0xd433('0x47')]+'%'};return _0x1419a3;}})});}_0x5d9e0d=_[_0xd433('0x48')]({},_0x5d9e0d,_0x1d5e07[_0xd433('0x4a')]);var _0x2b9544={'where':_0x5d9e0d[_0xd433('0x45')]};return db[_0xd433('0x36')][_0xd433('0x2b')](_0x2b9544)['then'](function(_0xdd3358){_0x2098f9[_0xd433('0x2b')]=_0xdd3358;if(_0x1d5e07['query'][_0xd433('0x4b')]){_0x5d9e0d['include']=[{'all':!![]}];}return db[_0xd433('0x36')][_0xd433('0x4c')](_0x5d9e0d);})['then'](function(_0x7d28e3){_0x2098f9[_0xd433('0x4d')]=_0x7d28e3;return _0x2098f9;})[_0xd433('0x1c')](respondWithFilteredResult(_0x1ca309,_0x5d9e0d))[_0xd433('0x25')](handleError(_0x1ca309,null));};exports[_0xd433('0x4e')]=function(_0x3c27ad,_0x192d0d){var _0x10934c={'raw':!![],'where':{'id':_0x3c27ad['params']['id']}},_0x2b5d19={};_0x2b5d19[_0xd433('0x39')]=_[_0xd433('0x3c')](db[_0xd433('0x36')][_0xd433('0x37')]);_0x2b5d19['query']=_[_0xd433('0x3c')](_0x3c27ad['query']);_0x2b5d19[_0xd433('0x3d')]=_[_0xd433('0x3f')](_0x2b5d19['model'],_0x2b5d19[_0xd433('0x3b')]);_0x10934c[_0xd433('0x3e')]=_[_0xd433('0x3f')](_0x2b5d19['model'],qs[_0xd433('0x40')](_0x3c27ad[_0xd433('0x3b')][_0xd433('0x40')]));_0x10934c[_0xd433('0x3e')]=_0x10934c[_0xd433('0x3e')][_0xd433('0x41')]?_0x10934c[_0xd433('0x3e')]:_0x2b5d19[_0xd433('0x39')];if(_0x3c27ad[_0xd433('0x3b')][_0xd433('0x4b')]){_0x10934c[_0xd433('0x4f')]=[{'all':!![]}];}_0x10934c=_[_0xd433('0x48')]({},_0x10934c,_0x3c27ad[_0xd433('0x4a')]);return db[_0xd433('0x36')][_0xd433('0x50')](_0x10934c)['then'](handleEntityNotFound(_0x192d0d,null))[_0xd433('0x1c')](respondWithResult(_0x192d0d,null))['catch'](handleError(_0x192d0d,null));};exports['create']=function(_0x318d22,_0xf6a2c9){return db['ChatMessage'][_0xd433('0x51')](_0x318d22[_0xd433('0x52')],{})[_0xd433('0x1c')](respondWithResult(_0xf6a2c9,0xc9))[_0xd433('0x25')](handleError(_0xf6a2c9,null));};exports[_0xd433('0x31')]=function(_0x5d7eed,_0x2c7bce){if(_0x5d7eed[_0xd433('0x52')]['id']){delete _0x5d7eed[_0xd433('0x52')]['id'];}return db[_0xd433('0x36')][_0xd433('0x50')]({'where':{'id':_0x5d7eed['params']['id']}})[_0xd433('0x1c')](handleEntityNotFound(_0x2c7bce,null))['then'](saveUpdates(_0x5d7eed[_0xd433('0x52')],null))['then'](respondWithResult(_0x2c7bce,null))[_0xd433('0x25')](handleError(_0x2c7bce,null));};exports[_0xd433('0x32')]=function(_0x4982df,_0x351196){return db[_0xd433('0x36')]['find']({'where':{'id':_0x4982df['params']['id']}})[_0xd433('0x1c')](handleEntityNotFound(_0x351196,null))[_0xd433('0x1c')](removeEntity(_0x351196,null))[_0xd433('0x25')](handleError(_0x351196,null));};exports[_0xd433('0x53')]=function(_0x44228d,_0x38fd52){return db[_0xd433('0x36')][_0xd433('0x53')]()[_0xd433('0x1c')](respondWithResult(_0x38fd52,null))[_0xd433('0x25')](handleError(_0x38fd52,null));};var interaction_log=require(_0xd433('0x54'))(_0xd433('0x55'));exports[_0xd433('0x56')]=function(_0x3c3f02,_0x28888c,_0x575d62){var _0x20897f={'agent':{},'channel':_0xd433('0x57')};if(_0x3c3f02[_0xd433('0x52')]['id']){delete _0x3c3f02[_0xd433('0x52')]['id'];}_0x3c3f02[_0xd433('0x52')][_0xd433('0x58')]=!![];_0x3c3f02[_0xd433('0x52')]['readAt']=moment()[_0xd433('0x59')](_0xd433('0x5a'));_0x3c3f02['body'][_0xd433('0x5b')]=_0x3c3f02['body'][_0xd433('0x5b')]||_0x3c3f02[_0xd433('0x5c')]['id'];_0x20897f[_0xd433('0x5d')]['id']=_0x3c3f02['body']['UserId'];return db[_0xd433('0x36')]['find']({'where':{'id':_0x3c3f02[_0xd433('0x5e')]['id'],'UserId':null}})[_0xd433('0x1c')](handleEntityNotFound(_0x28888c,null))[_0xd433('0x1c')](saveUpdates(_0x3c3f02[_0xd433('0x52')],null))[_0xd433('0x1c')](function(_0x585db5){if(_0x585db5){_0x20897f[_0xd433('0x24')]=_0x585db5[_0xd433('0x5f')]({'plain':!![]});return db[_0xd433('0x60')][_0xd433('0x50')]({'where':{'id':_0x585db5[_0xd433('0x61')]}});}return null;})[_0xd433('0x1c')](handleEntityNotFound(_0x28888c,null))[_0xd433('0x1c')](function(_0x37f38c){if(_0x37f38c){return _0x37f38c[_0xd433('0x31')]({'UserId':_0x3c3f02[_0xd433('0x52')][_0xd433('0x5b')],'read1stAt':_[_0xd433('0x62')](_0x37f38c['read1stAt'])?moment()[_0xd433('0x59')](_0xd433('0x5a')):undefined});}return null;})['then'](function(_0x498cec){if(_0x498cec){_0x20897f[_0xd433('0x63')]=_0x498cec['get']({'plain':!![]});interaction_log[_0xd433('0x1d')](_0xd433('0x64'),_0x3c3f02['user']['id'],_0x3c3f02[_0xd433('0x5c')][_0xd433('0x34')],_0x3c3f02[_0xd433('0x5c')][_0xd433('0x65')],_0x20897f[_0xd433('0x63')]['id'],_0x3c3f02[_0xd433('0x52')]?JSON[_0xd433('0x21')](_0x3c3f02[_0xd433('0x52')]):_0xd433('0x66'));return respondWithRpcPromise(_0xd433('0x67'),_0xd433('0x68'),_0x20897f);}return null;})['then'](function(_0x2c7bcb){var _0x9fc579=_0xd433('0x69')+_0x2c7bcb[_0xd433('0x24')]['ContactId'];return db[_0xd433('0x6a')][_0xd433('0x3b')](_0x9fc579,{'type':db[_0xd433('0x6b')][_0xd433('0x6c')][_0xd433('0x6d')],'raw':!![]})['then'](function(_0x38c1fc){return _0x38c1fc;});})[_0xd433('0x1c')](function(_0x14b991){if(_0x14b991){_0x20897f['message']['contact']=_0x14b991[0x0];if(!_0x3c3f02[_0xd433('0x52')][_0xd433('0x5b')])return;return db[_0xd433('0x6e')][_0xd433('0x50')]({'where':{'id':_0x3c3f02[_0xd433('0x52')][_0xd433('0x5b')],'role':_0xd433('0x5d')},'attributes':['id',_0xd433('0x34'),'fullname',_0xd433('0x6f'),_0xd433('0x70')],'raw':!![]});}return null;})[_0xd433('0x1c')](function(_0x56fa6f){if(!_0x56fa6f)return null;_0x20897f['message']['agent']=_0x56fa6f;return _0x20897f;})[_0xd433('0x1c')](function(_0x4b09ed){if(_0x4b09ed){if(_0x3c3f02[_0xd433('0x52')][_0xd433('0x71')]){_0x20897f[_0xd433('0x24')][_0xd433('0x72')]=util[_0xd433('0x59')](_0xd433('0x73'),_0x3c3f02[_0xd433('0x5c')][_0xd433('0x34')]);_0x20897f[_0xd433('0x24')]['channel']=_0x20897f['channel'];_0x20897f['message'][_0xd433('0x74')]=_0x20897f[_0xd433('0x75')];_0x20897f['message'][_0xd433('0x76')]='accept';return respondWithRpcPromise(_0xd433('0x77'),_0xd433('0x77'),{'event':'acceptmessage','message':_[_0xd433('0x48')](_0x20897f[_0xd433('0x24')],JSON['parse'](_0x20897f[_0xd433('0x63')][_0xd433('0x78')]))},client9002)[_0xd433('0x1c')](function(){return _0x20897f;});}return _0x20897f;}return null;})[_0xd433('0x1c')](respondWithResult(_0x28888c,null))[_0xd433('0x25')](handleError(_0x28888c,null));};var interaction_log=require(_0xd433('0x54'))(_0xd433('0x55'));exports[_0xd433('0x2f')]=function(_0x3655b5,_0x29c2a1,_0x4170f7){var _0x4bac72={'agent':{},'channel':_0xd433('0x57')};if(_0x3655b5[_0xd433('0x52')]['id']){delete _0x3655b5['body']['id'];}_0x3655b5['body'][_0xd433('0x5b')]=_0x3655b5[_0xd433('0x52')]['UserId']||_0x3655b5[_0xd433('0x5c')]['id'];_0x4bac72[_0xd433('0x5d')]['id']=_0x3655b5[_0xd433('0x52')][_0xd433('0x5b')];return db['ChatMessage']['find']({'where':{'id':_0x3655b5[_0xd433('0x5e')]['id'],'UserId':null}})[_0xd433('0x1c')](handleEntityNotFound(_0x29c2a1,null))[_0xd433('0x1c')](function(_0x42d058){if(_0x42d058){_0x4bac72[_0xd433('0x24')]=_0x42d058[_0xd433('0x5f')]({'plain':!![]});return db[_0xd433('0x60')][_0xd433('0x50')]({'where':{'id':_0x42d058['ChatInteractionId']}});}return null;})[_0xd433('0x1c')](handleEntityNotFound(_0x29c2a1,null))['then'](function(_0xf7df28){if(_0xf7df28){_0x4bac72['interaction']=_0xf7df28[_0xd433('0x5f')]({'plain':!![]});interaction_log[_0xd433('0x1d')](_0xd433('0x79'),_0x3655b5[_0xd433('0x5c')]['id'],_0x3655b5[_0xd433('0x5c')][_0xd433('0x34')],_0x3655b5[_0xd433('0x5c')][_0xd433('0x65')],_0x4bac72[_0xd433('0x63')]['id'],_0x3655b5[_0xd433('0x52')]?JSON[_0xd433('0x21')](_0x3655b5[_0xd433('0x52')]):_0xd433('0x66'));return respondWithRpcPromise(_0xd433('0x7a'),_0xd433('0x7b'),_0x4bac72);}return null;})[_0xd433('0x1c')](function(_0x437c92){var _0x36dabf=_0xd433('0x69')+_0x437c92[_0xd433('0x24')][_0xd433('0x7c')];return db[_0xd433('0x6a')][_0xd433('0x3b')](_0x36dabf,{'type':db[_0xd433('0x6b')][_0xd433('0x6c')]['SELECT'],'raw':!![]})[_0xd433('0x1c')](function(_0x5a7d33){return _0x5a7d33;});})[_0xd433('0x1c')](function(_0x345ea7){if(_0x345ea7){_0x4bac72[_0xd433('0x24')][_0xd433('0x7d')]=_0x345ea7[0x0];if(!_0x3655b5[_0xd433('0x52')][_0xd433('0x5b')])return;return db['User']['find']({'where':{'id':_0x3655b5['body'][_0xd433('0x5b')],'role':_0xd433('0x5d')},'attributes':['id','name','fullname',_0xd433('0x6f'),_0xd433('0x70')],'raw':!![]});}return null;})[_0xd433('0x1c')](function(_0x5512c0){if(!_0x5512c0)return null;_0x4bac72[_0xd433('0x24')][_0xd433('0x5d')]=_0x5512c0;return _0x4bac72;})['then'](function(_0x2b5752){if(_0x2b5752){_0x2b5752[_0xd433('0x24')][_0xd433('0x72')]=util[_0xd433('0x59')](_0xd433('0x73'),_0x3655b5['user']['name']);_0x2b5752[_0xd433('0x24')][_0xd433('0x75')]=_0x4bac72[_0xd433('0x75')];_0x2b5752[_0xd433('0x24')]['motionChannel']=_0x4bac72[_0xd433('0x75')];_0x2b5752[_0xd433('0x24')][_0xd433('0x76')]='reject';respondWithRpcPromise('EventManager',_0xd433('0x77'),{'event':_0xd433('0x7e'),'message':_[_0xd433('0x48')](_0x4bac72[_0xd433('0x24')],JSON['parse'](_0x4bac72[_0xd433('0x63')][_0xd433('0x78')]))},client9002);return _0x4bac72;}return null;})[_0xd433('0x1c')](respondWithResult(_0x29c2a1,null))[_0xd433('0x25')](handleError(_0x29c2a1,null));}; \ No newline at end of file +var _0x46db=['stack','name','send','index','rawAttributes','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','ChatMessage','includeAll','include','findAll','rows','params','keys','create','body','describe','chat-interactions','accept','chat','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','find','ChatInteractionId','isNil','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','contact','User','fullname','email','internal','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','reject','get','ChatInteraction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','SELECT','interface','rejectmessage','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','redis','defaults','localhost','./chatMessage.socket','register','jayson/promise','http','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','sendStatus'];(function(_0x56f771,_0x4a8b95){var _0x481cac=function(_0x43deeb){while(--_0x43deeb){_0x56f771['push'](_0x56f771['shift']());}};_0x481cac(++_0x4a8b95);}(_0x46db,0x1da));var _0xb46d=function(_0x5b1933,_0xef5822){_0x5b1933=_0x5b1933-0x0;var _0x48fe80=_0x46db[_0x5b1933];return _0x48fe80;};'use strict';var emlformat=require(_0xb46d('0x0'));var rimraf=require(_0xb46d('0x1'));var zipdir=require(_0xb46d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb46d('0x3'));var BPromise=require(_0xb46d('0x4'));var Mustache=require(_0xb46d('0x5'));var util=require(_0xb46d('0x6'));var path=require(_0xb46d('0x7'));var sox=require(_0xb46d('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb46d('0x9'));var _=require(_0xb46d('0xa'));var squel=require(_0xb46d('0xb'));var crypto=require(_0xb46d('0xc'));var jsforce=require(_0xb46d('0xd'));var deskjs=require(_0xb46d('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb46d('0xf'));var Papa=require(_0xb46d('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb46d('0x11'));var as=require(_0xb46d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb46d('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb46d('0x14'));var db=require('../../mysqldb')['db'];config[_0xb46d('0x15')]=_[_0xb46d('0x16')](config[_0xb46d('0x15')],{'host':_0xb46d('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb46d('0x15')]));require(_0xb46d('0x18'))[_0xb46d('0x19')](socket);var jayson=require(_0xb46d('0x1a'));var client=jayson['client'][_0xb46d('0x1b')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x479e61,_0x23a2bf,_0x5721de,_0x2847bc){return new BPromise(function(_0x2841de,_0xe5254){var _0x52e076=_0x2847bc||client;return _0x52e076[_0xb46d('0x1c')](_0x479e61,_0x5721de)[_0xb46d('0x1d')](function(_0x3fe125){logger[_0xb46d('0x1e')]('ChatMessage,\x20%s,\x20%s',_0x23a2bf,_0xb46d('0x1f'));logger[_0xb46d('0x20')](_0xb46d('0x21'),_0x23a2bf,'request\x20sent',JSON['stringify'](_0x3fe125));if(_0x3fe125[_0xb46d('0x22')]){if(_0x3fe125[_0xb46d('0x22')][_0xb46d('0x23')]===0x1f4){logger[_0xb46d('0x22')](_0xb46d('0x24'),_0x23a2bf,_0x3fe125[_0xb46d('0x22')]['message']);return _0xe5254(_0x3fe125[_0xb46d('0x22')][_0xb46d('0x25')]);}logger[_0xb46d('0x22')](_0xb46d('0x24'),_0x23a2bf,_0x3fe125[_0xb46d('0x22')][_0xb46d('0x25')]);return _0x2841de(_0x3fe125[_0xb46d('0x22')]['message']);}else{logger[_0xb46d('0x1e')](_0xb46d('0x24'),_0x23a2bf,'request\x20sent');_0x2841de(_0x3fe125[_0xb46d('0x26')][_0xb46d('0x25')]);}})[_0xb46d('0x27')](function(_0x433184){logger[_0xb46d('0x22')](_0xb46d('0x24'),_0x23a2bf,_0x433184);_0xe5254(_0x433184);});});}function respondWithStatusCode(_0x780d07,_0x1c106e){_0x1c106e=_0x1c106e||0xcc;return function(_0x3a437e){if(_0x3a437e){return _0x780d07['sendStatus'](_0x1c106e);}return _0x780d07[_0xb46d('0x28')](_0x1c106e)[_0xb46d('0x29')]();};}function respondWithResult(_0x7000c6,_0x57c6f7){_0x57c6f7=_0x57c6f7||0xc8;return function(_0x273037){if(_0x273037){return _0x7000c6[_0xb46d('0x28')](_0x57c6f7)[_0xb46d('0x2a')](_0x273037);}};}function respondWithFilteredResult(_0x514053,_0x3c683a){return function(_0x129004){if(_0x129004){var _0x3beb6c=typeof _0x3c683a[_0xb46d('0x2b')]===_0xb46d('0x2c')&&typeof _0x3c683a[_0xb46d('0x2d')]===_0xb46d('0x2c');var _0xedd0d5=_0x129004[_0xb46d('0x2e')];var _0x4a59c5=_0x3beb6c?0x0:_0x3c683a[_0xb46d('0x2b')];var _0x51ee9e=_0x3beb6c?_0x129004[_0xb46d('0x2e')]:_0x3c683a[_0xb46d('0x2b')]+_0x3c683a['limit'];var _0x3a13ae;if(_0x51ee9e>=_0xedd0d5){_0x51ee9e=_0xedd0d5;_0x3a13ae=0xc8;}else{_0x3a13ae=0xce;}_0x514053[_0xb46d('0x28')](_0x3a13ae);return _0x514053[_0xb46d('0x2f')](_0xb46d('0x30'),_0x4a59c5+'-'+_0x51ee9e+'/'+_0xedd0d5)[_0xb46d('0x2a')](_0x129004);}return null;};}function patchUpdates(_0x55b4db){return function(_0x303941){try{jsonpatch[_0xb46d('0x31')](_0x303941,_0x55b4db,!![]);}catch(_0x44bd15){return BPromise['reject'](_0x44bd15);}return _0x303941[_0xb46d('0x32')]();};}function saveUpdates(_0x12e0da,_0x597795){return function(_0x151d5a){if(_0x151d5a){return _0x151d5a[_0xb46d('0x33')](_0x12e0da)[_0xb46d('0x1d')](function(_0x1ba1ad){return _0x1ba1ad;});}return null;};}function removeEntity(_0x163474,_0x1d534f){return function(_0x4f03a5){if(_0x4f03a5){return _0x4f03a5[_0xb46d('0x34')]()[_0xb46d('0x1d')](function(){_0x163474[_0xb46d('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x282aa7,_0xf544b7){return function(_0x5504ce){if(!_0x5504ce){_0x282aa7[_0xb46d('0x35')](0x194);}return _0x5504ce;};}function handleError(_0x24ac70,_0x10d0a5){_0x10d0a5=_0x10d0a5||0x1f4;return function(_0x58e285){logger['error'](_0x58e285[_0xb46d('0x36')]);if(_0x58e285[_0xb46d('0x37')]){delete _0x58e285['name'];}_0x24ac70['status'](_0x10d0a5)[_0xb46d('0x38')](_0x58e285);};}exports[_0xb46d('0x39')]=function(_0x34a569,_0x378485){var _0x5ef88a={},_0x276f7c={},_0x3511d2={'count':0x0,'rows':[]};var _0xce5cf1=_['map'](db['ChatMessage'][_0xb46d('0x3a')],function(_0x8b6579){return{'name':_0x8b6579['fieldName'],'type':_0x8b6579['type'][_0xb46d('0x3b')]};});_0x276f7c[_0xb46d('0x3c')]=_[_0xb46d('0x3d')](_0xce5cf1,_0xb46d('0x37'));_0x276f7c[_0xb46d('0x3e')]=_['keys'](_0x34a569['query']);_0x276f7c[_0xb46d('0x3f')]=_[_0xb46d('0x40')](_0x276f7c['model'],_0x276f7c['query']);_0x5ef88a[_0xb46d('0x41')]=_[_0xb46d('0x40')](_0x276f7c[_0xb46d('0x3c')],qs[_0xb46d('0x42')](_0x34a569[_0xb46d('0x3e')][_0xb46d('0x42')]));_0x5ef88a[_0xb46d('0x41')]=_0x5ef88a[_0xb46d('0x41')][_0xb46d('0x43')]?_0x5ef88a[_0xb46d('0x41')]:_0x276f7c[_0xb46d('0x3c')];if(!_0x34a569[_0xb46d('0x3e')][_0xb46d('0x44')](_0xb46d('0x45'))){_0x5ef88a['limit']=qs[_0xb46d('0x2d')](_0x34a569[_0xb46d('0x3e')][_0xb46d('0x2d')]);_0x5ef88a['offset']=qs['offset'](_0x34a569[_0xb46d('0x3e')]['offset']);}_0x5ef88a[_0xb46d('0x46')]=qs[_0xb46d('0x47')](_0x34a569[_0xb46d('0x3e')][_0xb46d('0x47')]);_0x5ef88a[_0xb46d('0x48')]=qs[_0xb46d('0x3f')](_['pick'](_0x34a569[_0xb46d('0x3e')],_0x276f7c['filters']),_0xce5cf1);if(_0x34a569['query'][_0xb46d('0x49')]){_0x5ef88a['where']=_['merge'](_0x5ef88a[_0xb46d('0x48')],{'$or':_[_0xb46d('0x3d')](_0xce5cf1,function(_0x432d93){if(_0x432d93[_0xb46d('0x4a')]!==_0xb46d('0x4b')){var _0xb4ea86={};_0xb4ea86[_0x432d93[_0xb46d('0x37')]]={'$like':'%'+_0x34a569[_0xb46d('0x3e')][_0xb46d('0x49')]+'%'};return _0xb4ea86;}})});}_0x5ef88a=_[_0xb46d('0x4c')]({},_0x5ef88a,_0x34a569[_0xb46d('0x4d')]);var _0x5ce653={'where':_0x5ef88a[_0xb46d('0x48')]};return db[_0xb46d('0x4e')][_0xb46d('0x2e')](_0x5ce653)['then'](function(_0x404c6d){_0x3511d2[_0xb46d('0x2e')]=_0x404c6d;if(_0x34a569[_0xb46d('0x3e')][_0xb46d('0x4f')]){_0x5ef88a[_0xb46d('0x50')]=[{'all':!![]}];}return db[_0xb46d('0x4e')][_0xb46d('0x51')](_0x5ef88a);})[_0xb46d('0x1d')](function(_0x32f920){_0x3511d2[_0xb46d('0x52')]=_0x32f920;return _0x3511d2;})['then'](respondWithFilteredResult(_0x378485,_0x5ef88a))['catch'](handleError(_0x378485,null));};exports['show']=function(_0x2c1f8d,_0x418820){var _0x3136ad={'raw':!![],'where':{'id':_0x2c1f8d[_0xb46d('0x53')]['id']}},_0x53d808={};_0x53d808[_0xb46d('0x3c')]=_[_0xb46d('0x54')](db['ChatMessage'][_0xb46d('0x3a')]);_0x53d808['query']=_[_0xb46d('0x54')](_0x2c1f8d[_0xb46d('0x3e')]);_0x53d808[_0xb46d('0x3f')]=_['intersection'](_0x53d808[_0xb46d('0x3c')],_0x53d808['query']);_0x3136ad[_0xb46d('0x41')]=_[_0xb46d('0x40')](_0x53d808['model'],qs[_0xb46d('0x42')](_0x2c1f8d['query'][_0xb46d('0x42')]));_0x3136ad[_0xb46d('0x41')]=_0x3136ad['attributes'][_0xb46d('0x43')]?_0x3136ad[_0xb46d('0x41')]:_0x53d808[_0xb46d('0x3c')];if(_0x2c1f8d[_0xb46d('0x3e')][_0xb46d('0x4f')]){_0x3136ad[_0xb46d('0x50')]=[{'all':!![]}];}_0x3136ad=_[_0xb46d('0x4c')]({},_0x3136ad,_0x2c1f8d[_0xb46d('0x4d')]);return db[_0xb46d('0x4e')]['find'](_0x3136ad)[_0xb46d('0x1d')](handleEntityNotFound(_0x418820,null))[_0xb46d('0x1d')](respondWithResult(_0x418820,null))[_0xb46d('0x27')](handleError(_0x418820,null));};exports[_0xb46d('0x55')]=function(_0x538b02,_0x339cb6){return db[_0xb46d('0x4e')]['create'](_0x538b02['body'],{})[_0xb46d('0x1d')](respondWithResult(_0x339cb6,0xc9))[_0xb46d('0x27')](handleError(_0x339cb6,null));};exports['update']=function(_0x28098b,_0x2c266a){if(_0x28098b[_0xb46d('0x56')]['id']){delete _0x28098b[_0xb46d('0x56')]['id'];}return db[_0xb46d('0x4e')]['find']({'where':{'id':_0x28098b[_0xb46d('0x53')]['id']}})[_0xb46d('0x1d')](handleEntityNotFound(_0x2c266a,null))['then'](saveUpdates(_0x28098b[_0xb46d('0x56')],null))['then'](respondWithResult(_0x2c266a,null))['catch'](handleError(_0x2c266a,null));};exports[_0xb46d('0x34')]=function(_0x4beec3,_0x2151f3){return db[_0xb46d('0x4e')]['find']({'where':{'id':_0x4beec3[_0xb46d('0x53')]['id']}})[_0xb46d('0x1d')](handleEntityNotFound(_0x2151f3,null))[_0xb46d('0x1d')](removeEntity(_0x2151f3,null))['catch'](handleError(_0x2151f3,null));};exports['describe']=function(_0x1aa59c,_0x206aa2){return db[_0xb46d('0x4e')][_0xb46d('0x57')]()['then'](respondWithResult(_0x206aa2,null))[_0xb46d('0x27')](handleError(_0x206aa2,null));};var interaction_log=require(_0xb46d('0x13'))(_0xb46d('0x58'));exports[_0xb46d('0x59')]=function(_0x3b7b62,_0x18b006,_0x106448){var _0x4b82a8={'agent':{},'channel':_0xb46d('0x5a')};if(_0x3b7b62[_0xb46d('0x56')]['id']){delete _0x3b7b62[_0xb46d('0x56')]['id'];}_0x3b7b62['body'][_0xb46d('0x5b')]=!![];_0x3b7b62[_0xb46d('0x56')][_0xb46d('0x5c')]=moment()['format'](_0xb46d('0x5d'));_0x3b7b62[_0xb46d('0x56')][_0xb46d('0x5e')]=_0x3b7b62['body'][_0xb46d('0x5e')]||_0x3b7b62['user']['id'];_0x4b82a8[_0xb46d('0x5f')]['id']=_0x3b7b62[_0xb46d('0x56')][_0xb46d('0x5e')];return db[_0xb46d('0x4e')][_0xb46d('0x60')]({'where':{'id':_0x3b7b62[_0xb46d('0x53')]['id'],'UserId':null}})[_0xb46d('0x1d')](handleEntityNotFound(_0x18b006,null))[_0xb46d('0x1d')](saveUpdates(_0x3b7b62[_0xb46d('0x56')],null))[_0xb46d('0x1d')](function(_0x38fadc){if(_0x38fadc){_0x4b82a8[_0xb46d('0x25')]=_0x38fadc['get']({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x38fadc[_0xb46d('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x18b006,null))[_0xb46d('0x1d')](function(_0x28a5be){if(_0x28a5be){return _0x28a5be['update']({'UserId':_0x3b7b62[_0xb46d('0x56')][_0xb46d('0x5e')],'read1stAt':_[_0xb46d('0x62')](_0x28a5be['read1stAt'])?moment()['format'](_0xb46d('0x5d')):undefined});}return null;})[_0xb46d('0x1d')](function(_0x48de5a){if(_0x48de5a){_0x4b82a8[_0xb46d('0x63')]=_0x48de5a['get']({'plain':!![]});interaction_log[_0xb46d('0x1e')](_0xb46d('0x64'),_0x3b7b62[_0xb46d('0x65')]['id'],_0x3b7b62[_0xb46d('0x65')]['name'],_0x3b7b62[_0xb46d('0x65')][_0xb46d('0x66')],_0x4b82a8[_0xb46d('0x63')]['id'],_0x3b7b62[_0xb46d('0x56')]?JSON[_0xb46d('0x67')](_0x3b7b62[_0xb46d('0x56')]):_0xb46d('0x68'));return respondWithRpcPromise(_0xb46d('0x69'),_0xb46d('0x6a'),_0x4b82a8);}return null;})['then'](function(_0x2059e1){var _0x2a082a=_0xb46d('0x6b')+_0x2059e1['message']['ContactId'];return db[_0xb46d('0x6c')][_0xb46d('0x3e')](_0x2a082a,{'type':db['Sequelize'][_0xb46d('0x6d')]['SELECT'],'raw':!![]})['then'](function(_0x406473){return _0x406473;});})[_0xb46d('0x1d')](function(_0x4bb0a2){if(_0x4bb0a2){_0x4b82a8['message'][_0xb46d('0x6e')]=_0x4bb0a2[0x0];if(!_0x3b7b62[_0xb46d('0x56')][_0xb46d('0x5e')])return;return db[_0xb46d('0x6f')][_0xb46d('0x60')]({'where':{'id':_0x3b7b62[_0xb46d('0x56')][_0xb46d('0x5e')],'role':_0xb46d('0x5f')},'attributes':['id',_0xb46d('0x37'),_0xb46d('0x70'),_0xb46d('0x71'),_0xb46d('0x72')],'raw':!![]});}return null;})[_0xb46d('0x1d')](function(_0x988692){if(!_0x988692)return null;_0x4b82a8[_0xb46d('0x25')][_0xb46d('0x5f')]=_0x988692;return _0x4b82a8;})[_0xb46d('0x1d')](function(_0x529bae){if(_0x529bae){if(_0x3b7b62[_0xb46d('0x56')]['manual']){_0x4b82a8[_0xb46d('0x25')]['interface']=util['format'](_0xb46d('0x73'),_0x3b7b62[_0xb46d('0x65')][_0xb46d('0x37')]);_0x4b82a8[_0xb46d('0x25')][_0xb46d('0x74')]=_0x4b82a8[_0xb46d('0x74')];_0x4b82a8[_0xb46d('0x25')]['motionChannel']=_0x4b82a8[_0xb46d('0x74')];_0x4b82a8[_0xb46d('0x25')][_0xb46d('0x75')]=_0xb46d('0x59');return respondWithRpcPromise(_0xb46d('0x76'),_0xb46d('0x76'),{'event':_0xb46d('0x77'),'message':_['merge'](_0x4b82a8[_0xb46d('0x25')],JSON[_0xb46d('0x78')](_0x4b82a8[_0xb46d('0x63')][_0xb46d('0x79')]))},client9002)[_0xb46d('0x1d')](function(){return _0x4b82a8;});}return _0x4b82a8;}return null;})[_0xb46d('0x1d')](respondWithResult(_0x18b006,null))[_0xb46d('0x27')](handleError(_0x18b006,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports[_0xb46d('0x7a')]=function(_0x7d5a69,_0x592022,_0x8aa678){var _0x4d28d8={'agent':{},'channel':'chat'};if(_0x7d5a69[_0xb46d('0x56')]['id']){delete _0x7d5a69[_0xb46d('0x56')]['id'];}_0x7d5a69['body'][_0xb46d('0x5e')]=_0x7d5a69[_0xb46d('0x56')][_0xb46d('0x5e')]||_0x7d5a69[_0xb46d('0x65')]['id'];_0x4d28d8[_0xb46d('0x5f')]['id']=_0x7d5a69[_0xb46d('0x56')][_0xb46d('0x5e')];return db[_0xb46d('0x4e')][_0xb46d('0x60')]({'where':{'id':_0x7d5a69[_0xb46d('0x53')]['id'],'UserId':null}})[_0xb46d('0x1d')](handleEntityNotFound(_0x592022,null))[_0xb46d('0x1d')](function(_0x4a11de){if(_0x4a11de){_0x4d28d8[_0xb46d('0x25')]=_0x4a11de[_0xb46d('0x7b')]({'plain':!![]});return db[_0xb46d('0x7c')][_0xb46d('0x60')]({'where':{'id':_0x4a11de['ChatInteractionId']}});}return null;})[_0xb46d('0x1d')](handleEntityNotFound(_0x592022,null))[_0xb46d('0x1d')](function(_0x15f793){if(_0x15f793){_0x4d28d8['interaction']=_0x15f793['get']({'plain':!![]});interaction_log[_0xb46d('0x1e')](_0xb46d('0x7d'),_0x7d5a69[_0xb46d('0x65')]['id'],_0x7d5a69[_0xb46d('0x65')][_0xb46d('0x37')],_0x7d5a69[_0xb46d('0x65')][_0xb46d('0x66')],_0x4d28d8[_0xb46d('0x63')]['id'],_0x7d5a69['body']?JSON[_0xb46d('0x67')](_0x7d5a69['body']):_0xb46d('0x68'));return respondWithRpcPromise(_0xb46d('0x7e'),_0xb46d('0x7f'),_0x4d28d8);}return null;})[_0xb46d('0x1d')](function(_0x5b3898){var _0x41e077=_0xb46d('0x6b')+_0x5b3898[_0xb46d('0x25')][_0xb46d('0x80')];return db[_0xb46d('0x6c')][_0xb46d('0x3e')](_0x41e077,{'type':db['Sequelize'][_0xb46d('0x6d')][_0xb46d('0x81')],'raw':!![]})[_0xb46d('0x1d')](function(_0x839264){return _0x839264;});})[_0xb46d('0x1d')](function(_0x3038c7){if(_0x3038c7){_0x4d28d8[_0xb46d('0x25')][_0xb46d('0x6e')]=_0x3038c7[0x0];if(!_0x7d5a69[_0xb46d('0x56')][_0xb46d('0x5e')])return;return db[_0xb46d('0x6f')][_0xb46d('0x60')]({'where':{'id':_0x7d5a69[_0xb46d('0x56')][_0xb46d('0x5e')],'role':_0xb46d('0x5f')},'attributes':['id',_0xb46d('0x37'),_0xb46d('0x70'),_0xb46d('0x71'),_0xb46d('0x72')],'raw':!![]});}return null;})[_0xb46d('0x1d')](function(_0x534dd5){if(!_0x534dd5)return null;_0x4d28d8['message']['agent']=_0x534dd5;return _0x4d28d8;})[_0xb46d('0x1d')](function(_0x1be751){if(_0x1be751){_0x1be751['message'][_0xb46d('0x82')]=util['format'](_0xb46d('0x73'),_0x7d5a69[_0xb46d('0x65')]['name']);_0x1be751['message'][_0xb46d('0x74')]=_0x4d28d8[_0xb46d('0x74')];_0x1be751[_0xb46d('0x25')]['motionChannel']=_0x4d28d8[_0xb46d('0x74')];_0x1be751[_0xb46d('0x25')][_0xb46d('0x75')]=_0xb46d('0x7a');respondWithRpcPromise(_0xb46d('0x76'),'EventManager',{'event':_0xb46d('0x83'),'message':_[_0xb46d('0x4c')](_0x4d28d8[_0xb46d('0x25')],JSON['parse'](_0x4d28d8[_0xb46d('0x63')]['formData']))},client9002);return _0x4d28d8;}return null;})[_0xb46d('0x1d')](respondWithResult(_0x592022,null))[_0xb46d('0x27')](handleError(_0x592022,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 323dc34..068a1a3 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 _0x7c8a=['ChatMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x3a9ee1,_0x1c9619){var _0x3d9dcc=function(_0x47fa08){while(--_0x47fa08){_0x3a9ee1['push'](_0x3a9ee1['shift']());}};_0x3d9dcc(++_0x1c9619);}(_0x7c8a,0x8e));var _0xa7c8=function(_0x32989d,_0x2d8a0c){_0x32989d=_0x32989d-0x0;var _0x1c18a5=_0x7c8a[_0x32989d];return _0x1c18a5;};'use strict';var EventEmitter=require(_0xa7c8('0x0'));var ChatMessage=require(_0xa7c8('0x1'))['db'][_0xa7c8('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xa7c8('0x3')](0x0);var events={'afterCreate':_0xa7c8('0x4'),'afterUpdate':_0xa7c8('0x5'),'afterDestroy':_0xa7c8('0x6')};function emitEvent(_0x4e0ede){return function(_0x3317b1,_0x12c28e,_0x266eb1){ChatMessageEvents['emit'](_0x4e0ede+':'+_0x3317b1['id'],_0x3317b1);ChatMessageEvents[_0xa7c8('0x7')](_0x4e0ede,_0x3317b1);_0x266eb1(null);};}for(var e in events){if(events[_0xa7c8('0x8')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0x4c9e=['emit','hook','exports','events','ChatMessage','save','remove'];(function(_0x1f8daa,_0x2e7165){var _0x11132f=function(_0x1d043d){while(--_0x1d043d){_0x1f8daa['push'](_0x1f8daa['shift']());}};_0x11132f(++_0x2e7165);}(_0x4c9e,0x17d));var _0xe4c9=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x4c9e[_0x42245d];return _0x4b211a;};'use strict';var EventEmitter=require(_0xe4c9('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0xe4c9('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe4c9('0x2'),'afterUpdate':'update','afterDestroy':_0xe4c9('0x3')};function emitEvent(_0x16980b){return function(_0x3986e0,_0x4b9c13,_0x39ff6f){ChatMessageEvents[_0xe4c9('0x4')](_0x16980b+':'+_0x3986e0['id'],_0x3986e0);ChatMessageEvents['emit'](_0x16980b,_0x3986e0);_0x39ff6f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0xe4c9('0x5')](e,emitEvent(event));}}module[_0xe4c9('0x6')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index eee9e35..c6c1175 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 _0xceae=['fti_chat_messages','FULLTEXT','models','get','direction','toLowerCase','out','ChatInteraction','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','bluebird','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages'];(function(_0x149300,_0x11fa0d){var _0x1e27ac=function(_0x388e6a){while(--_0x388e6a){_0x149300['push'](_0x149300['shift']());}};_0x1e27ac(++_0x11fa0d);}(_0xceae,0x122));var _0xecea=function(_0x5eb4bb,_0xbd4598){_0x5eb4bb=_0x5eb4bb-0x0;var _0x12d25b=_0xceae[_0x5eb4bb];return _0x12d25b;};'use strict';var _=require(_0xecea('0x0'));var util=require(_0xecea('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xecea('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xecea('0x3'));var config=require(_0xecea('0x4'));var attributes=require(_0xecea('0x5'));module[_0xecea('0x6')]=function(_0x1588bf,_0x1b1b68){return _0x1588bf[_0xecea('0x7')](_0xecea('0x8'),attributes,{'tableName':_0xecea('0x9'),'paranoid':![],'indexes':[{'name':_0xecea('0xa'),'fields':['body'],'type':_0xecea('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4ecb8e,_0x379b2c,_0x2142af){var _0x38d7af=_0x1588bf[_0xecea('0xc')];var _0xd2fce0=_0x4ecb8e[_0xecea('0xd')]({'plain':!![]});if(_0xd2fce0[_0xecea('0xe')][_0xecea('0xf')]()==='in'||_0xd2fce0[_0xecea('0xe')][_0xecea('0xf')]()===_0xecea('0x10')&&!_0xd2fce0['secret']&&!_['isNil'](_0xd2fce0['UserId'])){_0x38d7af[_0xecea('0x11')]['findOne']({'where':{'id':_0xd2fce0[_0xecea('0x12')]}})[_0xecea('0x13')](function(_0x23d248){if(_0x23d248){_0x23d248[_0xecea('0x14')]({'lastMsgAt':_0xd2fce0[_0xecea('0x15')],'lastMsgDirection':_0xd2fce0[_0xecea('0xe')]['toLowerCase']()});}})[_0xecea('0x16')](function(_0x3245c2){console[_0xecea('0x17')](_0x3245c2);});}_0x2142af();}},'charset':'utf8mb4','collate':_0xecea('0x18')});}; \ No newline at end of file +var _0xc955=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','UserId','ChatInteraction','ChatInteractionId','then','update','createdAt','catch','utf8mb4_unicode_ci','lodash','util'];(function(_0x325d76,_0x478f38){var _0xfe2e13=function(_0x4706eb){while(--_0x4706eb){_0x325d76['push'](_0x325d76['shift']());}};_0xfe2e13(++_0x478f38);}(_0xc955,0x80));var _0x5c95=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xc955[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0x5c95('0x0'));var util=require(_0x5c95('0x1'));var logger=require(_0x5c95('0x2'))('api');var moment=require(_0x5c95('0x3'));var BPromise=require(_0x5c95('0x4'));var rp=require(_0x5c95('0x5'));var fs=require('fs');var path=require(_0x5c95('0x6'));var rimraf=require(_0x5c95('0x7'));var config=require(_0x5c95('0x8'));var attributes=require('./chatMessage.attributes');module['exports']=function(_0x143c44,_0x5ed00f){return _0x143c44['define']('ChatMessage',attributes,{'tableName':_0x5c95('0x9'),'paranoid':![],'indexes':[{'name':_0x5c95('0xa'),'fields':[_0x5c95('0xb')],'type':_0x5c95('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x26ea2e,_0x17afe5,_0x3f71d9){var _0x5e2320=_0x143c44[_0x5c95('0xd')];var _0x54c377=_0x26ea2e[_0x5c95('0xe')]({'plain':!![]});if(_0x54c377[_0x5c95('0xf')][_0x5c95('0x10')]()==='in'||_0x54c377[_0x5c95('0xf')][_0x5c95('0x10')]()===_0x5c95('0x11')&&!_0x54c377['secret']&&!_['isNil'](_0x54c377[_0x5c95('0x12')])){_0x5e2320[_0x5c95('0x13')]['findOne']({'where':{'id':_0x54c377[_0x5c95('0x14')]}})[_0x5c95('0x15')](function(_0x114282){if(_0x114282){_0x114282[_0x5c95('0x16')]({'lastMsgAt':_0x54c377[_0x5c95('0x17')],'lastMsgDirection':_0x54c377[_0x5c95('0xf')][_0x5c95('0x10')]()});}})[_0x5c95('0x18')](function(_0x1b20e9){console['error'](_0x1b20e9);});}_0x3f71d9();}},'charset':'utf8mb4','collate':_0x5c95('0x19')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 1f3682a..37ebadc 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 _0xe1cc=['request\x20sent','stringify','error','code','message','result','CreateChatMessage','ChatMessage','options','raw','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','request','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s'];(function(_0x28c402,_0x4515bb){var _0x5e5a79=function(_0x4f15b3){while(--_0x4f15b3){_0x28c402['push'](_0x28c402['shift']());}};_0x5e5a79(++_0x4515bb);}(_0xe1cc,0xf2));var _0xce1c=function(_0x23524a,_0x118ff4){_0x23524a=_0x23524a-0x0;var _0x2a7744=_0xe1cc[_0x23524a];return _0x2a7744;};'use strict';var _=require(_0xce1c('0x0'));var util=require('util');var moment=require(_0xce1c('0x1'));var BPromise=require('bluebird');var rs=require(_0xce1c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xce1c('0x3'))['db'];var utils=require(_0xce1c('0x4'));var logger=require(_0xce1c('0x5'))(_0xce1c('0x6'));var config=require(_0xce1c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xce1c('0x8')]['http']({'port':0x232a});config[_0xce1c('0x9')]=_[_0xce1c('0xa')](config['redis'],{'host':_0xce1c('0xb'),'port':0x18eb});var socket=require(_0xce1c('0xc'))(new Redis(config['redis']));require('./chatMessage.socket')['register'](socket);function respondWithRpcPromise(_0x1cbe6a,_0x144ed2,_0x39d045){return new BPromise(function(_0x3b1b28,_0x4beb9d){return client[_0xce1c('0xd')](_0x1cbe6a,_0x39d045)[_0xce1c('0xe')](function(_0x222ef7){logger[_0xce1c('0xf')](_0xce1c('0x10'),_0x144ed2,'request\x20sent');logger[_0xce1c('0x11')](_0xce1c('0x12'),_0x144ed2,_0xce1c('0x13'),JSON[_0xce1c('0x14')](_0x222ef7));if(_0x222ef7[_0xce1c('0x15')]){if(_0x222ef7[_0xce1c('0x15')][_0xce1c('0x16')]===0x1f4){logger[_0xce1c('0x15')](_0xce1c('0x10'),_0x144ed2,_0x222ef7[_0xce1c('0x15')]['message']);return _0x4beb9d(_0x222ef7['error'][_0xce1c('0x17')]);}logger[_0xce1c('0x15')]('ChatMessage,\x20%s,\x20%s',_0x144ed2,_0x222ef7[_0xce1c('0x15')]['message']);return _0x3b1b28(_0x222ef7[_0xce1c('0x15')][_0xce1c('0x17')]);}else{logger['info'](_0xce1c('0x10'),_0x144ed2,_0xce1c('0x13'));_0x3b1b28(_0x222ef7[_0xce1c('0x18')][_0xce1c('0x17')]);}})['catch'](function(_0x9d2955){logger[_0xce1c('0x15')](_0xce1c('0x10'),_0x144ed2,_0x9d2955);_0x4beb9d(_0x9d2955);});});}exports[_0xce1c('0x19')]=function(_0x3e1b0d){var _0x1b0054=this;return new Promise(function(_0x2d063f,_0x206074){return db[_0xce1c('0x1a')]['create'](_0x3e1b0d['body'],{'raw':_0x3e1b0d['options']?_0x3e1b0d[_0xce1c('0x1b')][_0xce1c('0x1c')]===undefined?!![]:![]:!![]})[_0xce1c('0xe')](function(_0x449019){logger[_0xce1c('0xf')](_0xce1c('0x19'),_0x3e1b0d);logger[_0xce1c('0x11')]('CreateChatMessage',_0x3e1b0d,JSON[_0xce1c('0x14')](_0x449019));_0x2d063f(_0x449019);})['catch'](function(_0x4e8e99){logger[_0xce1c('0x15')](_0xce1c('0x19'),_0x4e8e99[_0xce1c('0x17')],_0x3e1b0d);_0x206074(_0x1b0054[_0xce1c('0x15')](0x1f4,_0x4e8e99['message']));});});}; \ No newline at end of file +var _0x3f26=['ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatMessage','ChatMessage','body','options','raw','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','./chatMessage.socket','register','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x189e47,_0x4fa398){var _0x5c375b=function(_0x349e8c){while(--_0x349e8c){_0x189e47['push'](_0x189e47['shift']());}};_0x5c375b(++_0x4fa398);}(_0x3f26,0x8c));var _0x63f2=function(_0x19a681,_0x39d6a4){_0x19a681=_0x19a681-0x0;var _0x5189c9=_0x3f26[_0x19a681];return _0x5189c9;};'use strict';var _=require('lodash');var util=require(_0x63f2('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x63f2('0x1'));var fs=require('fs');var Redis=require(_0x63f2('0x2'));var db=require(_0x63f2('0x3'))['db'];var utils=require(_0x63f2('0x4'));var logger=require(_0x63f2('0x5'))(_0x63f2('0x6'));var config=require('../../config/environment');var jayson=require(_0x63f2('0x7'));var client=jayson[_0x63f2('0x8')][_0x63f2('0x9')]({'port':0x232a});config['redis']=_[_0x63f2('0xa')](config[_0x63f2('0xb')],{'host':_0x63f2('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x63f2('0xb')]));require(_0x63f2('0xd'))[_0x63f2('0xe')](socket);function respondWithRpcPromise(_0x1553ab,_0x5041dd,_0x1f4dcd){return new BPromise(function(_0x1333f4,_0x132682){return client['request'](_0x1553ab,_0x1f4dcd)[_0x63f2('0xf')](function(_0x13b0bf){logger[_0x63f2('0x10')](_0x63f2('0x11'),_0x5041dd,_0x63f2('0x12'));logger[_0x63f2('0x13')](_0x63f2('0x14'),_0x5041dd,_0x63f2('0x12'),JSON[_0x63f2('0x15')](_0x13b0bf));if(_0x13b0bf[_0x63f2('0x16')]){if(_0x13b0bf[_0x63f2('0x16')][_0x63f2('0x17')]===0x1f4){logger[_0x63f2('0x16')](_0x63f2('0x11'),_0x5041dd,_0x13b0bf[_0x63f2('0x16')][_0x63f2('0x18')]);return _0x132682(_0x13b0bf[_0x63f2('0x16')][_0x63f2('0x18')]);}logger[_0x63f2('0x16')](_0x63f2('0x11'),_0x5041dd,_0x13b0bf['error']['message']);return _0x1333f4(_0x13b0bf['error'][_0x63f2('0x18')]);}else{logger[_0x63f2('0x10')](_0x63f2('0x11'),_0x5041dd,_0x63f2('0x12'));_0x1333f4(_0x13b0bf[_0x63f2('0x19')][_0x63f2('0x18')]);}})[_0x63f2('0x1a')](function(_0xc675be){logger[_0x63f2('0x16')]('ChatMessage,\x20%s,\x20%s',_0x5041dd,_0xc675be);_0x132682(_0xc675be);});});}exports[_0x63f2('0x1b')]=function(_0x17f845){var _0x32e47d=this;return new Promise(function(_0x44fa30,_0x35b641){return db[_0x63f2('0x1c')]['create'](_0x17f845[_0x63f2('0x1d')],{'raw':_0x17f845['options']?_0x17f845[_0x63f2('0x1e')][_0x63f2('0x1f')]===undefined?!![]:![]:!![]})[_0x63f2('0xf')](function(_0x4a5318){logger[_0x63f2('0x10')](_0x63f2('0x1b'),_0x17f845);logger[_0x63f2('0x13')](_0x63f2('0x1b'),_0x17f845,JSON[_0x63f2('0x15')](_0x4a5318));_0x44fa30(_0x4a5318);})[_0x63f2('0x1a')](function(_0x38ce3f){logger[_0x63f2('0x16')]('CreateChatMessage',_0x38ce3f[_0x63f2('0x18')],_0x17f845);_0x35b641(_0x32e47d[_0x63f2('0x16')](0x1f4,_0x38ce3f[_0x63f2('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 16d633f..9965677 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 _0x7a2d=['length','chatMessage:','./chatMessage.events','save','remove','update','removeListener','register'];(function(_0xc79556,_0x27b148){var _0x19f18a=function(_0x434e45){while(--_0x434e45){_0xc79556['push'](_0xc79556['shift']());}};_0x19f18a(++_0x27b148);}(_0x7a2d,0x142));var _0xd7a2=function(_0x36e1d2,_0x5697a){_0x36e1d2=_0x36e1d2-0x0;var _0x3a7037=_0x7a2d[_0x36e1d2];return _0x3a7037;};'use strict';var ChatMessageEvents=require(_0xd7a2('0x0'));var events=[_0xd7a2('0x1'),_0xd7a2('0x2'),_0xd7a2('0x3')];function createListener(_0x81f2c5,_0x1edb4e){return function(_0x31dd61){_0x1edb4e['emit'](_0x81f2c5,_0x31dd61);};}function removeListener(_0x500472,_0x7370d9){return function(){ChatMessageEvents[_0xd7a2('0x4')](_0x500472,_0x7370d9);};}exports[_0xd7a2('0x5')]=function(_0x13b19d){for(var _0x4f0c6b=0x0,_0x210a06=events[_0xd7a2('0x6')];_0x4f0c6b<_0x210a06;_0x4f0c6b++){var _0x1e3fc8=events[_0x4f0c6b];var _0x69f732=createListener(_0xd7a2('0x7')+_0x1e3fc8,_0x13b19d);ChatMessageEvents['on'](_0x1e3fc8,_0x69f732);}}; \ No newline at end of file +var _0xa8eb=['length','./chatMessage.events','remove','register'];(function(_0x5678b5,_0x1c4aa8){var _0x4c09a5=function(_0x2aa89a){while(--_0x2aa89a){_0x5678b5['push'](_0x5678b5['shift']());}};_0x4c09a5(++_0x1c4aa8);}(_0xa8eb,0x179));var _0xba8e=function(_0x46a82c,_0x1cd5ba){_0x46a82c=_0x46a82c-0x0;var _0x15e3d6=_0xa8eb[_0x46a82c];return _0x15e3d6;};'use strict';var ChatMessageEvents=require(_0xba8e('0x0'));var events=['save',_0xba8e('0x1'),'update'];function createListener(_0xd7f19f,_0x35f485){return function(_0x3b8fee){_0x35f485['emit'](_0xd7f19f,_0x3b8fee);};}function removeListener(_0x353df2,_0x368ce6){return function(){ChatMessageEvents['removeListener'](_0x353df2,_0x368ce6);};}exports[_0xba8e('0x2')]=function(_0x57e345){for(var _0x14c3ac=0x0,_0x52a8ef=events[_0xba8e('0x3')];_0x14c3ac<_0x52a8ef;_0x14c3ac++){var _0x69ccbe=events[_0x14c3ac];var _0x4b1bd6=createListener('chatMessage:'+_0x69ccbe,_0x57e345);ChatMessageEvents['on'](_0x69ccbe,_0x4b1bd6);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index ca063fe..5b18a99 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 _0x50d7=['chat','chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','index','get','/describe','isAuthenticated','/:id','post','tracked'];(function(_0x2f16e5,_0x2e75e0){var _0x5d082a=function(_0x13873b){while(--_0x13873b){_0x2f16e5['push'](_0x2f16e5['shift']());}};_0x5d082a(++_0x2e75e0);}(_0x50d7,0xba));var _0x750d=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x50d7[_0x138adb];return _0x1b27f2;};'use strict';var multer=require(_0x750d('0x0'));var util=require(_0x750d('0x1'));var path=require(_0x750d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x750d('0x3'));var auth=require(_0x750d('0x4'));var interaction=require(_0x750d('0x5'));var config=require('../../config/environment');var controller=require(_0x750d('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x750d('0x7')]);router[_0x750d('0x8')](_0x750d('0x9'),auth[_0x750d('0xa')](),controller['describe']);router[_0x750d('0x8')](_0x750d('0xb'),auth[_0x750d('0xa')](),controller['show']);router[_0x750d('0xc')]('/',auth['isAuthenticated'](),interaction[_0x750d('0xd')](_0x750d('0xe'),_0x750d('0xf')),controller[_0x750d('0x10')]);router[_0x750d('0x11')](_0x750d('0xb'),controller[_0x750d('0x12')]);router[_0x750d('0x11')](_0x750d('0x13'),auth[_0x750d('0xa')](),controller[_0x750d('0x14')]);router[_0x750d('0x11')](_0x750d('0x15'),auth[_0x750d('0xa')](),controller[_0x750d('0x16')]);router[_0x750d('0x17')]('/:id',auth[_0x750d('0xa')](),controller[_0x750d('0x18')]);module['exports']=router; \ No newline at end of file +var _0x8874=['chat','chatmessage:create','create','put','/:id','update','accept','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','post','tracked'];(function(_0x11f598,_0x5a2990){var _0x2a37dc=function(_0x510577){while(--_0x510577){_0x11f598['push'](_0x11f598['shift']());}};_0x2a37dc(++_0x5a2990);}(_0x8874,0x98));var _0x4887=function(_0x14fdb6,_0x2f65d7){_0x14fdb6=_0x14fdb6-0x0;var _0x4de02d=_0x8874[_0x14fdb6];return _0x4de02d;};'use strict';var multer=require(_0x4887('0x0'));var util=require('util');var path=require(_0x4887('0x1'));var timeout=require(_0x4887('0x2'));var express=require('express');var router=express[_0x4887('0x3')]();var fs_extra=require(_0x4887('0x4'));var auth=require(_0x4887('0x5'));var interaction=require(_0x4887('0x6'));var config=require(_0x4887('0x7'));var controller=require(_0x4887('0x8'));router[_0x4887('0x9')]('/',auth[_0x4887('0xa')](),controller[_0x4887('0xb')]);router['get'](_0x4887('0xc'),auth[_0x4887('0xa')](),controller[_0x4887('0xd')]);router[_0x4887('0x9')]('/:id',auth[_0x4887('0xa')](),controller['show']);router[_0x4887('0xe')]('/',auth[_0x4887('0xa')](),interaction[_0x4887('0xf')](_0x4887('0x10'),_0x4887('0x11')),controller[_0x4887('0x12')]);router[_0x4887('0x13')](_0x4887('0x14'),controller[_0x4887('0x15')]);router[_0x4887('0x13')]('/:id/accept',auth[_0x4887('0xa')](),controller[_0x4887('0x16')]);router[_0x4887('0x13')](_0x4887('0x17'),auth[_0x4887('0xa')](),controller[_0x4887('0x18')]);router[_0x4887('0x19')](_0x4887('0x14'),auth['isAuthenticated'](),controller[_0x4887('0x1a')]);module[_0x4887('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 8e2cfb0..5e0a3af 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 _0x0b0e=['medium','sequelize','TEXT'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x0b0e,0x187));var _0xe0b0=function(_0x315b61,_0x4bb11e){_0x315b61=_0x315b61-0x0;var _0x3521e8=_0x0b0e[_0x315b61];return _0x3521e8;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'body':{'type':Sequelize[_0xe0b0('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xe0b0('0x1')](_0xe0b0('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0x0b0e=['medium','sequelize','TEXT'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x0b0e,0x187));var _0xe0b0=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0x0b0e[_0x51c819];return _0x15c5d2;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'body':{'type':Sequelize[_0xe0b0('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xe0b0('0x1')](_0xe0b0('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index e7dab60..e2c3885 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(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0x7a54,0x106));var _0x47a5=function(_0x2753f0,_0x29488e){_0x2753f0=_0x2753f0-0x0;var _0x4143ee=_0x7a54[_0x2753f0];return _0x4143ee;};'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(_0x59e5b4,_0x3ef306){var _0x41b912=function(_0x4abd57){while(--_0x4abd57){_0x59e5b4['push'](_0x59e5b4['shift']());}};_0x41b912(++_0x3ef306);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 2b41983..6032e54 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 _0x01d9=['ChatOfflineMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3eb926,_0x27e966){var _0x29460d=function(_0x143ba7){while(--_0x143ba7){_0x3eb926['push'](_0x3eb926['shift']());}};_0x29460d(++_0x27e966);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0x901d('0x0'));var ChatOfflineMessage=require(_0x901d('0x1'))['db'][_0x901d('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x901d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x901d('0x4'),'afterDestroy':_0x901d('0x5')};function emitEvent(_0x247cfc){return function(_0x8f7b4,_0x214f38,_0x456f31){ChatOfflineMessageEvents[_0x901d('0x6')](_0x247cfc+':'+_0x8f7b4['id'],_0x8f7b4);ChatOfflineMessageEvents['emit'](_0x247cfc,_0x8f7b4);_0x456f31(null);};}for(var e in events){if(events[_0x901d('0x7')](e)){var event=events[e];ChatOfflineMessage[_0x901d('0x8')](e,emitEvent(event));}}module[_0x901d('0x9')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0xf8af=['ChatOfflineMessage','setMaxListeners','save','update','hasOwnProperty','exports','events'];(function(_0x594a97,_0x1e5b33){var _0x115aad=function(_0x4ce5da){while(--_0x4ce5da){_0x594a97['push'](_0x594a97['shift']());}};_0x115aad(++_0x1e5b33);}(_0xf8af,0x8b));var _0xff8a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xf8af[_0x122ef9];return _0x42fba0;};'use strict';var EventEmitter=require(_0xff8a('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db'][_0xff8a('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xff8a('0x2')](0x0);var events={'afterCreate':_0xff8a('0x3'),'afterUpdate':_0xff8a('0x4'),'afterDestroy':'remove'};function emitEvent(_0x7b1bb0){return function(_0x460bf6,_0x11cfa2,_0x3bd9c2){ChatOfflineMessageEvents['emit'](_0x7b1bb0+':'+_0x460bf6['id'],_0x460bf6);ChatOfflineMessageEvents['emit'](_0x7b1bb0,_0x460bf6);_0x3bd9c2(null);};}for(var e in events){if(events[_0xff8a('0x5')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0xff8a('0x6')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 8cc4e99..e363b1d 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 _0x7a28=['exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes'];(function(_0x571339,_0x5bcafb){var _0x5af8a6=function(_0x389251){while(--_0x389251){_0x571339['push'](_0x571339['shift']());}};_0x5af8a6(++_0x5bcafb);}(_0x7a28,0x172));var _0x87a2=function(_0x1f4f68,_0x5c9022){_0x1f4f68=_0x1f4f68-0x0;var _0x3e2d3d=_0x7a28[_0x1f4f68];return _0x3e2d3d;};'use strict';var attributes=require(_0x87a2('0x0'));module[_0x87a2('0x1')]=function(_0x43eedd){return _0x43eedd[_0x87a2('0x2')](_0x87a2('0x3'),attributes,{'tableName':_0x87a2('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x87a2('0x5'),'collate':_0x87a2('0x6')});}; \ No newline at end of file +var _0x6ac6=['chat_offline_messages','utf8mb4','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage'];(function(_0xf8e486,_0x5d2f29){var _0x5dcc9a=function(_0x363dfe){while(--_0x363dfe){_0xf8e486['push'](_0xf8e486['shift']());}};_0x5dcc9a(++_0x5d2f29);}(_0x6ac6,0xe0));var _0x66ac=function(_0x57a3e2,_0xe4b2c5){_0x57a3e2=_0x57a3e2-0x0;var _0x1e6edc=_0x6ac6[_0x57a3e2];return _0x1e6edc;};'use strict';var attributes=require(_0x66ac('0x0'));module[_0x66ac('0x1')]=function(_0x5bd387){return _0x5bd387[_0x66ac('0x2')](_0x66ac('0x3'),attributes,{'tableName':_0x66ac('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x66ac('0x5'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 525cd44..6da8795 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 _0xdae3=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','request\x20sent','stringify','error','ChatOfflineMessage,\x20%s,\x20%s','message','info','result'];(function(_0x3861f7,_0x995b22){var _0x50879f=function(_0x3003f1){while(--_0x3003f1){_0x3861f7['push'](_0x3861f7['shift']());}};_0x50879f(++_0x995b22);}(_0xdae3,0x10e));var _0x3dae=function(_0x6d2cf2,_0x1386ca){_0x6d2cf2=_0x6d2cf2-0x0;var _0x2e646e=_0xdae3[_0x6d2cf2];return _0x2e646e;};'use strict';var _=require(_0x3dae('0x0'));var util=require(_0x3dae('0x1'));var moment=require(_0x3dae('0x2'));var BPromise=require(_0x3dae('0x3'));var rs=require(_0x3dae('0x4'));var fs=require('fs');var Redis=require(_0x3dae('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3dae('0x6'))(_0x3dae('0x7'));var config=require(_0x3dae('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3dae('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x353d24,_0x3f6ddd,_0x990c70){return new BPromise(function(_0x353eef,_0xbfc082){return client['request'](_0x353d24,_0x990c70)[_0x3dae('0xa')](function(_0x319278){logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x3f6ddd,'request\x20sent');logger['debug']('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x3f6ddd,_0x3dae('0xb'),JSON[_0x3dae('0xc')](_0x319278));if(_0x319278['error']){if(_0x319278[_0x3dae('0xd')]['code']===0x1f4){logger['error'](_0x3dae('0xe'),_0x3f6ddd,_0x319278[_0x3dae('0xd')][_0x3dae('0xf')]);return _0xbfc082(_0x319278['error']['message']);}logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x3f6ddd,_0x319278['error'][_0x3dae('0xf')]);return _0x353eef(_0x319278[_0x3dae('0xd')][_0x3dae('0xf')]);}else{logger[_0x3dae('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x3f6ddd,_0x3dae('0xb'));_0x353eef(_0x319278[_0x3dae('0x11')][_0x3dae('0xf')]);}})['catch'](function(_0x46c437){logger[_0x3dae('0xd')](_0x3dae('0xe'),_0x3f6ddd,_0x46c437);_0xbfc082(_0x46c437);});});} \ No newline at end of file +var _0x221b=['request\x20sent','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x221b,0xbf));var _0xb221=function(_0x2889e7,_0x3ba050){_0x2889e7=_0x2889e7-0x0;var _0x5d7d93=_0x221b[_0x2889e7];return _0x5d7d93;};'use strict';var _=require(_0xb221('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb221('0x1'));var rs=require(_0xb221('0x2'));var fs=require('fs');var Redis=require(_0xb221('0x3'));var db=require(_0xb221('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb221('0x5'))(_0xb221('0x6'));var config=require(_0xb221('0x7'));var jayson=require(_0xb221('0x8'));var client=jayson[_0xb221('0x9')][_0xb221('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52119d,_0x5a1ba8,_0x1fbd29){return new BPromise(function(_0x41f0e8,_0x5d8f47){return client[_0xb221('0xb')](_0x52119d,_0x1fbd29)['then'](function(_0x1a712b){logger[_0xb221('0xc')](_0xb221('0xd'),_0x5a1ba8,'request\x20sent');logger[_0xb221('0xe')](_0xb221('0xf'),_0x5a1ba8,_0xb221('0x10'),JSON[_0xb221('0x11')](_0x1a712b));if(_0x1a712b[_0xb221('0x12')]){if(_0x1a712b[_0xb221('0x12')][_0xb221('0x13')]===0x1f4){logger[_0xb221('0x12')](_0xb221('0xd'),_0x5a1ba8,_0x1a712b[_0xb221('0x12')][_0xb221('0x14')]);return _0x5d8f47(_0x1a712b[_0xb221('0x12')]['message']);}logger[_0xb221('0x12')](_0xb221('0xd'),_0x5a1ba8,_0x1a712b[_0xb221('0x12')]['message']);return _0x41f0e8(_0x1a712b[_0xb221('0x12')][_0xb221('0x14')]);}else{logger[_0xb221('0xc')](_0xb221('0xd'),_0x5a1ba8,_0xb221('0x10'));_0x41f0e8(_0x1a712b[_0xb221('0x15')][_0xb221('0x14')]);}})[_0xb221('0x16')](function(_0x2c2912){logger[_0xb221('0x12')](_0xb221('0xd'),_0x5a1ba8,_0x2c2912);_0x5d8f47(_0x2c2912);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index e2a0d60..f15a91d 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 _0x9e3c=['put','update','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','post'];(function(_0x153dba,_0x2fc9d9){var _0x4d3654=function(_0x4a0c50){while(--_0x4a0c50){_0x153dba['push'](_0x153dba['shift']());}};_0x4d3654(++_0x2fc9d9);}(_0x9e3c,0x17f));var _0xc9e3=function(_0x527a53,_0x3265d6){_0x527a53=_0x527a53-0x0;var _0x2332f5=_0x9e3c[_0x527a53];return _0x2332f5;};'use strict';var multer=require('multer');var util=require(_0xc9e3('0x0'));var path=require(_0xc9e3('0x1'));var timeout=require('connect-timeout');var express=require(_0xc9e3('0x2'));var router=express[_0xc9e3('0x3')]();var fs_extra=require(_0xc9e3('0x4'));var auth=require(_0xc9e3('0x5'));var interaction=require(_0xc9e3('0x6'));var config=require(_0xc9e3('0x7'));var controller=require('./chatOfflineMessage.controller');router['get']('/',auth[_0xc9e3('0x8')](),controller[_0xc9e3('0x9')]);router[_0xc9e3('0xa')](_0xc9e3('0xb'),auth[_0xc9e3('0x8')](),controller[_0xc9e3('0xc')]);router['get'](_0xc9e3('0xd'),auth[_0xc9e3('0x8')](),controller[_0xc9e3('0xe')]);router[_0xc9e3('0xf')]('/',auth[_0xc9e3('0x8')](),controller['create']);router[_0xc9e3('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xc9e3('0x11')]);router['delete'](_0xc9e3('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xc9e3('0x12')]=router; \ No newline at end of file +var _0xdace=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller','index','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete'];(function(_0x3ba9c0,_0x2db2d8){var _0x543daa=function(_0x51e436){while(--_0x51e436){_0x3ba9c0['push'](_0x3ba9c0['shift']());}};_0x543daa(++_0x2db2d8);}(_0xdace,0xba));var _0xedac=function(_0x4a5494,_0x3ad336){_0x4a5494=_0x4a5494-0x0;var _0x57cbb5=_0xdace[_0x4a5494];return _0x57cbb5;};'use strict';var multer=require(_0xedac('0x0'));var util=require(_0xedac('0x1'));var path=require(_0xedac('0x2'));var timeout=require(_0xedac('0x3'));var express=require('express');var router=express[_0xedac('0x4')]();var fs_extra=require(_0xedac('0x5'));var auth=require(_0xedac('0x6'));var interaction=require(_0xedac('0x7'));var config=require('../../config/environment');var controller=require(_0xedac('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xedac('0x9')]);router[_0xedac('0xa')](_0xedac('0xb'),auth[_0xedac('0xc')](),controller[_0xedac('0xd')]);router[_0xedac('0xa')](_0xedac('0xe'),auth['isAuthenticated'](),controller[_0xedac('0xf')]);router[_0xedac('0x10')]('/',auth['isAuthenticated'](),controller[_0xedac('0x11')]);router[_0xedac('0x12')](_0xedac('0xe'),auth['isAuthenticated'](),controller[_0xedac('0x13')]);router[_0xedac('0x14')]('/:id',auth[_0xedac('0xc')](),controller[_0xedac('0x15')]);module[_0xedac('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 770302a..62b50ea 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 _0x1e12=['exports','STRING','mouseOver','timeout','INTEGER','sequelize'];(function(_0x2df84d,_0x56d874){var _0x2634ce=function(_0x8e8e31){while(--_0x8e8e31){_0x2df84d['push'](_0x2df84d['shift']());}};_0x2634ce(++_0x56d874);}(_0x1e12,0xef));var _0x21e1=function(_0x335f37,_0x23569c){_0x335f37=_0x335f37-0x0;var _0x5ebe83=_0x1e12[_0x335f37];return _0x5ebe83;};'use strict';var Sequelize=require(_0x21e1('0x0'));module[_0x21e1('0x1')]={'name':{'type':Sequelize[_0x21e1('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x21e1('0x3'),_0x21e1('0x4')),'defaultValue':_0x21e1('0x3')},'selector':{'type':Sequelize[_0x21e1('0x2')]},'timeout':{'type':Sequelize[_0x21e1('0x5')]}}; \ No newline at end of file +var _0xa751=['INTEGER','sequelize','STRING','mouseOver','timeout'];(function(_0x1d844a,_0x7aaf1e){var _0x4b9c6f=function(_0x3d2b87){while(--_0x3d2b87){_0x1d844a['push'](_0x1d844a['shift']());}};_0x4b9c6f(++_0x7aaf1e);}(_0xa751,0x6f));var _0x1a75=function(_0x39dc2e,_0x3b9862){_0x39dc2e=_0x39dc2e-0x0;var _0x4eaf08=_0xa751[_0x39dc2e];return _0x4eaf08;};'use strict';var Sequelize=require(_0x1a75('0x0'));module['exports']={'name':{'type':Sequelize[_0x1a75('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x1a75('0x2'),_0x1a75('0x3')),'defaultValue':_0x1a75('0x2')},'selector':{'type':Sequelize[_0x1a75('0x1')]},'timeout':{'type':Sequelize[_0x1a75('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 743fc62..6db98c4 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 _0x96f1=['Content-Range','apply','reject','then','end','error','stack','name','send','show','model','ChatProactiveAction','query','keys','filters','attributes','intersection','fields','length','includeAll','merge','options','find','catch','update','params','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count'];(function(_0x5d9f6d,_0x38ff06){var _0x3c9b25=function(_0x5f1913){while(--_0x5f1913){_0x5d9f6d['push'](_0x5d9f6d['shift']());}};_0x3c9b25(++_0x38ff06);}(_0x96f1,0x19c));var _0x196f=function(_0x1dacca,_0x5d87cf){_0x1dacca=_0x1dacca-0x0;var _0x155f58=_0x96f1[_0x1dacca];return _0x155f58;};'use strict';var emlformat=require(_0x196f('0x0'));var rimraf=require(_0x196f('0x1'));var zipdir=require(_0x196f('0x2'));var jsonpatch=require(_0x196f('0x3'));var rp=require(_0x196f('0x4'));var moment=require(_0x196f('0x5'));var BPromise=require(_0x196f('0x6'));var Mustache=require(_0x196f('0x7'));var util=require('util');var path=require('path');var sox=require(_0x196f('0x8'));var csv=require(_0x196f('0x9'));var ejs=require(_0x196f('0xa'));var fs=require('fs');var fs_extra=require(_0x196f('0xb'));var _=require(_0x196f('0xc'));var squel=require('squel');var crypto=require(_0x196f('0xd'));var jsforce=require(_0x196f('0xe'));var deskjs=require(_0x196f('0xf'));var toCsv=require(_0x196f('0x9'));var querystring=require('querystring');var Papa=require(_0x196f('0x10'));var Redis=require('ioredis');var authService=require(_0x196f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x196f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x196f('0x13'));var licenseUtil=require(_0x196f('0x14'));var db=require(_0x196f('0x15'))['db'];function respondWithStatusCode(_0x36e631,_0x28a202){_0x28a202=_0x28a202||0xcc;return function(_0x219c21){if(_0x219c21){return _0x36e631['sendStatus'](_0x28a202);}return _0x36e631[_0x196f('0x16')](_0x28a202)['end']();};}function respondWithResult(_0x40828b,_0x568ef0){_0x568ef0=_0x568ef0||0xc8;return function(_0x16bd9d){if(_0x16bd9d){return _0x40828b['status'](_0x568ef0)[_0x196f('0x17')](_0x16bd9d);}};}function respondWithFilteredResult(_0x106562,_0x192367){return function(_0x330646){if(_0x330646){var _0xeeae5d=typeof _0x192367[_0x196f('0x18')]==='undefined'&&typeof _0x192367[_0x196f('0x19')]===_0x196f('0x1a');var _0x1e73f1=_0x330646[_0x196f('0x1b')];var _0x55b82f=_0xeeae5d?0x0:_0x192367[_0x196f('0x18')];var _0x2b2f56=_0xeeae5d?_0x330646[_0x196f('0x1b')]:_0x192367['offset']+_0x192367[_0x196f('0x19')];var _0x84571f;if(_0x2b2f56>=_0x1e73f1){_0x2b2f56=_0x1e73f1;_0x84571f=0xc8;}else{_0x84571f=0xce;}_0x106562['status'](_0x84571f);return _0x106562['set'](_0x196f('0x1c'),_0x55b82f+'-'+_0x2b2f56+'/'+_0x1e73f1)[_0x196f('0x17')](_0x330646);}return null;};}function patchUpdates(_0x464321){return function(_0x16bec1){try{jsonpatch[_0x196f('0x1d')](_0x16bec1,_0x464321,!![]);}catch(_0x17fbd2){return BPromise[_0x196f('0x1e')](_0x17fbd2);}return _0x16bec1['save']();};}function saveUpdates(_0x3e17f,_0x3d6e33){return function(_0x31bf42){if(_0x31bf42){return _0x31bf42['update'](_0x3e17f)['then'](function(_0x2f5d60){return _0x2f5d60;});}return null;};}function removeEntity(_0x28a6d3,_0x1c5786){return function(_0x18b220){if(_0x18b220){return _0x18b220['destroy']()[_0x196f('0x1f')](function(){_0x28a6d3[_0x196f('0x16')](0xcc)[_0x196f('0x20')]();});}};}function handleEntityNotFound(_0x330e36,_0x427ac6){return function(_0x406ab5){if(!_0x406ab5){_0x330e36['sendStatus'](0x194);}return _0x406ab5;};}function handleError(_0x4f6155,_0x37105f){_0x37105f=_0x37105f||0x1f4;return function(_0x3c4834){logger[_0x196f('0x21')](_0x3c4834[_0x196f('0x22')]);if(_0x3c4834[_0x196f('0x23')]){delete _0x3c4834[_0x196f('0x23')];}_0x4f6155[_0x196f('0x16')](_0x37105f)[_0x196f('0x24')](_0x3c4834);};}exports[_0x196f('0x25')]=function(_0x22e769,_0x5a285b){var _0x2ef0ea={'raw':!![],'where':{'id':_0x22e769['params']['id']}},_0x30b0c7={};_0x30b0c7[_0x196f('0x26')]=_['keys'](db[_0x196f('0x27')]['rawAttributes']);_0x30b0c7[_0x196f('0x28')]=_[_0x196f('0x29')](_0x22e769[_0x196f('0x28')]);_0x30b0c7[_0x196f('0x2a')]=_['intersection'](_0x30b0c7[_0x196f('0x26')],_0x30b0c7[_0x196f('0x28')]);_0x2ef0ea[_0x196f('0x2b')]=_[_0x196f('0x2c')](_0x30b0c7[_0x196f('0x26')],qs[_0x196f('0x2d')](_0x22e769['query'][_0x196f('0x2d')]));_0x2ef0ea['attributes']=_0x2ef0ea['attributes'][_0x196f('0x2e')]?_0x2ef0ea[_0x196f('0x2b')]:_0x30b0c7[_0x196f('0x26')];if(_0x22e769[_0x196f('0x28')][_0x196f('0x2f')]){_0x2ef0ea['include']=[{'all':!![]}];}_0x2ef0ea=_[_0x196f('0x30')]({},_0x2ef0ea,_0x22e769[_0x196f('0x31')]);return db[_0x196f('0x27')][_0x196f('0x32')](_0x2ef0ea)[_0x196f('0x1f')](handleEntityNotFound(_0x5a285b,null))[_0x196f('0x1f')](respondWithResult(_0x5a285b,null))[_0x196f('0x33')](handleError(_0x5a285b,null));};exports['create']=function(_0x2d9cc4,_0x56c95c){return db[_0x196f('0x27')]['create'](_0x2d9cc4['body'],{})[_0x196f('0x1f')](respondWithResult(_0x56c95c,0xc9))[_0x196f('0x33')](handleError(_0x56c95c,null));};exports[_0x196f('0x34')]=function(_0x2e9533,_0x1805d1){if(_0x2e9533['body']['id']){delete _0x2e9533['body']['id'];}return db[_0x196f('0x27')][_0x196f('0x32')]({'where':{'id':_0x2e9533[_0x196f('0x35')]['id']}})[_0x196f('0x1f')](handleEntityNotFound(_0x1805d1,null))['then'](saveUpdates(_0x2e9533[_0x196f('0x36')],null))[_0x196f('0x1f')](respondWithResult(_0x1805d1,null))[_0x196f('0x33')](handleError(_0x1805d1,null));};exports['destroy']=function(_0x4fe155,_0x46e662){return db[_0x196f('0x27')]['find']({'where':{'id':_0x4fe155[_0x196f('0x35')]['id']}})[_0x196f('0x1f')](handleEntityNotFound(_0x46e662,null))[_0x196f('0x1f')](removeEntity(_0x46e662,null))[_0x196f('0x33')](handleError(_0x46e662,null));}; \ No newline at end of file +var _0x47d6=['../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','include','merge','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x2e233e,_0x2a9bef){var _0x5b506b=function(_0x21fd45){while(--_0x21fd45){_0x2e233e['push'](_0x2e233e['shift']());}};_0x5b506b(++_0x2a9bef);}(_0x47d6,0x1de));var _0x647d=function(_0x4800a2,_0x14acb9){_0x4800a2=_0x4800a2-0x0;var _0x3b6436=_0x47d6[_0x4800a2];return _0x3b6436;};'use strict';var emlformat=require(_0x647d('0x0'));var rimraf=require(_0x647d('0x1'));var zipdir=require(_0x647d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x647d('0x3'));var BPromise=require(_0x647d('0x4'));var Mustache=require(_0x647d('0x5'));var util=require('util');var path=require(_0x647d('0x6'));var sox=require(_0x647d('0x7'));var csv=require(_0x647d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x647d('0x9'));var _=require(_0x647d('0xa'));var squel=require(_0x647d('0xb'));var crypto=require(_0x647d('0xc'));var jsforce=require(_0x647d('0xd'));var deskjs=require(_0x647d('0xe'));var toCsv=require(_0x647d('0x8'));var querystring=require(_0x647d('0xf'));var Papa=require(_0x647d('0x10'));var Redis=require(_0x647d('0x11'));var authService=require(_0x647d('0x12'));var qs=require(_0x647d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x647d('0x14'));var logger=require(_0x647d('0x15'))(_0x647d('0x16'));var utils=require(_0x647d('0x17'));var config=require(_0x647d('0x18'));var licenseUtil=require(_0x647d('0x19'));var db=require(_0x647d('0x1a'))['db'];function respondWithStatusCode(_0x26cb0b,_0x52570d){_0x52570d=_0x52570d||0xcc;return function(_0x412e63){if(_0x412e63){return _0x26cb0b[_0x647d('0x1b')](_0x52570d);}return _0x26cb0b[_0x647d('0x1c')](_0x52570d)[_0x647d('0x1d')]();};}function respondWithResult(_0x4b224d,_0x18ef9e){_0x18ef9e=_0x18ef9e||0xc8;return function(_0x368b52){if(_0x368b52){return _0x4b224d[_0x647d('0x1c')](_0x18ef9e)['json'](_0x368b52);}};}function respondWithFilteredResult(_0x25fa4a,_0x4c175c){return function(_0x264e53){if(_0x264e53){var _0x5740ff=typeof _0x4c175c[_0x647d('0x1e')]===_0x647d('0x1f')&&typeof _0x4c175c['limit']===_0x647d('0x1f');var _0x539fe4=_0x264e53[_0x647d('0x20')];var _0x30a107=_0x5740ff?0x0:_0x4c175c[_0x647d('0x1e')];var _0x407788=_0x5740ff?_0x264e53[_0x647d('0x20')]:_0x4c175c[_0x647d('0x1e')]+_0x4c175c[_0x647d('0x21')];var _0x29168d;if(_0x407788>=_0x539fe4){_0x407788=_0x539fe4;_0x29168d=0xc8;}else{_0x29168d=0xce;}_0x25fa4a[_0x647d('0x1c')](_0x29168d);return _0x25fa4a[_0x647d('0x22')](_0x647d('0x23'),_0x30a107+'-'+_0x407788+'/'+_0x539fe4)[_0x647d('0x24')](_0x264e53);}return null;};}function patchUpdates(_0x33145c){return function(_0x13dcb6){try{jsonpatch[_0x647d('0x25')](_0x13dcb6,_0x33145c,!![]);}catch(_0x40484c){return BPromise[_0x647d('0x26')](_0x40484c);}return _0x13dcb6[_0x647d('0x27')]();};}function saveUpdates(_0x266982,_0x5e354e){return function(_0x417a03){if(_0x417a03){return _0x417a03[_0x647d('0x28')](_0x266982)['then'](function(_0x25bd0e){return _0x25bd0e;});}return null;};}function removeEntity(_0x3d8e69,_0x1f4c09){return function(_0x1e508a){if(_0x1e508a){return _0x1e508a['destroy']()[_0x647d('0x29')](function(){_0x3d8e69[_0x647d('0x1c')](0xcc)[_0x647d('0x1d')]();});}};}function handleEntityNotFound(_0x2a974c,_0x141b25){return function(_0x5db555){if(!_0x5db555){_0x2a974c[_0x647d('0x1b')](0x194);}return _0x5db555;};}function handleError(_0x248ab7,_0x1c6888){_0x1c6888=_0x1c6888||0x1f4;return function(_0x4499b2){logger[_0x647d('0x2a')](_0x4499b2[_0x647d('0x2b')]);if(_0x4499b2[_0x647d('0x2c')]){delete _0x4499b2[_0x647d('0x2c')];}_0x248ab7['status'](_0x1c6888)['send'](_0x4499b2);};}exports[_0x647d('0x2d')]=function(_0x20d08d,_0x1a0360){var _0x427915={'raw':!![],'where':{'id':_0x20d08d[_0x647d('0x2e')]['id']}},_0xefdb81={};_0xefdb81[_0x647d('0x2f')]=_[_0x647d('0x30')](db[_0x647d('0x31')][_0x647d('0x32')]);_0xefdb81[_0x647d('0x33')]=_[_0x647d('0x30')](_0x20d08d[_0x647d('0x33')]);_0xefdb81[_0x647d('0x34')]=_[_0x647d('0x35')](_0xefdb81[_0x647d('0x2f')],_0xefdb81['query']);_0x427915[_0x647d('0x36')]=_[_0x647d('0x35')](_0xefdb81[_0x647d('0x2f')],qs[_0x647d('0x37')](_0x20d08d[_0x647d('0x33')][_0x647d('0x37')]));_0x427915[_0x647d('0x36')]=_0x427915[_0x647d('0x36')]['length']?_0x427915[_0x647d('0x36')]:_0xefdb81[_0x647d('0x2f')];if(_0x20d08d[_0x647d('0x33')]['includeAll']){_0x427915[_0x647d('0x38')]=[{'all':!![]}];}_0x427915=_[_0x647d('0x39')]({},_0x427915,_0x20d08d['options']);return db[_0x647d('0x31')][_0x647d('0x3a')](_0x427915)[_0x647d('0x29')](handleEntityNotFound(_0x1a0360,null))[_0x647d('0x29')](respondWithResult(_0x1a0360,null))[_0x647d('0x3b')](handleError(_0x1a0360,null));};exports[_0x647d('0x3c')]=function(_0x250c33,_0x156844){return db[_0x647d('0x31')][_0x647d('0x3c')](_0x250c33[_0x647d('0x3d')],{})[_0x647d('0x29')](respondWithResult(_0x156844,0xc9))[_0x647d('0x3b')](handleError(_0x156844,null));};exports['update']=function(_0x3c4cbc,_0x5da608){if(_0x3c4cbc[_0x647d('0x3d')]['id']){delete _0x3c4cbc[_0x647d('0x3d')]['id'];}return db[_0x647d('0x31')]['find']({'where':{'id':_0x3c4cbc[_0x647d('0x2e')]['id']}})[_0x647d('0x29')](handleEntityNotFound(_0x5da608,null))[_0x647d('0x29')](saveUpdates(_0x3c4cbc['body'],null))[_0x647d('0x29')](respondWithResult(_0x5da608,null))['catch'](handleError(_0x5da608,null));};exports[_0x647d('0x3e')]=function(_0x5a3fe8,_0x2d261b){return db[_0x647d('0x31')][_0x647d('0x3a')]({'where':{'id':_0x5a3fe8[_0x647d('0x2e')]['id']}})[_0x647d('0x29')](handleEntityNotFound(_0x2d261b,null))[_0x647d('0x29')](removeEntity(_0x2d261b,null))[_0x647d('0x3b')](handleError(_0x2d261b,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index b5cbbb9..063f08c 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 _0x46a2=['chat_proactive_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatProactiveAction.attributes','define','ChatProactiveAction'];(function(_0x140438,_0x17c9e2){var _0x3ff495=function(_0x3d2b18){while(--_0x3d2b18){_0x140438['push'](_0x140438['shift']());}};_0x3ff495(++_0x17c9e2);}(_0x46a2,0x12c));var _0x246a=function(_0x5a7f64,_0x347d57){_0x5a7f64=_0x5a7f64-0x0;var _0x3d30f1=_0x46a2[_0x5a7f64];return _0x3d30f1;};'use strict';var _=require(_0x246a('0x0'));var util=require(_0x246a('0x1'));var logger=require(_0x246a('0x2'))(_0x246a('0x3'));var moment=require(_0x246a('0x4'));var BPromise=require(_0x246a('0x5'));var rp=require(_0x246a('0x6'));var fs=require('fs');var path=require(_0x246a('0x7'));var rimraf=require(_0x246a('0x8'));var config=require('../../config/environment');var attributes=require(_0x246a('0x9'));module['exports']=function(_0x2eecff,_0x5cdef3){return _0x2eecff[_0x246a('0xa')](_0x246a('0xb'),attributes,{'tableName':_0x246a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70e7=['bluebird','../../config/environment','exports','ChatProactiveAction','lodash','util','../../config/logger','moment'];(function(_0x99ace4,_0x2cad84){var _0x1e5c4f=function(_0x41f255){while(--_0x41f255){_0x99ace4['push'](_0x99ace4['shift']());}};_0x1e5c4f(++_0x2cad84);}(_0x70e7,0x144));var _0x770e=function(_0x48b9c4,_0x461fee){_0x48b9c4=_0x48b9c4-0x0;var _0xa41721=_0x70e7[_0x48b9c4];return _0xa41721;};'use strict';var _=require(_0x770e('0x0'));var util=require(_0x770e('0x1'));var logger=require(_0x770e('0x2'))('api');var moment=require(_0x770e('0x3'));var BPromise=require(_0x770e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x770e('0x5'));var attributes=require('./chatProactiveAction.attributes');module[_0x770e('0x6')]=function(_0x423c74,_0x509fcf){return _0x423c74['define'](_0x770e('0x7'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index ceb416e..1898429 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 _0x1e63=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatProactiveAction,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring'];(function(_0x58c184,_0x128f43){var _0x25a09f=function(_0x5ef878){while(--_0x5ef878){_0x58c184['push'](_0x58c184['shift']());}};_0x25a09f(++_0x128f43);}(_0x1e63,0x11d));var _0x31e6=function(_0x48f0cb,_0x4e1f50){_0x48f0cb=_0x48f0cb-0x0;var _0x232533=_0x1e63[_0x48f0cb];return _0x232533;};'use strict';var _=require(_0x31e6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x31e6('0x1'));var rs=require(_0x31e6('0x2'));var fs=require('fs');var Redis=require(_0x31e6('0x3'));var db=require(_0x31e6('0x4'))['db'];var utils=require(_0x31e6('0x5'));var logger=require(_0x31e6('0x6'))('rpc');var config=require(_0x31e6('0x7'));var jayson=require(_0x31e6('0x8'));var client=jayson[_0x31e6('0x9')][_0x31e6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x510124,_0x577ad5,_0x43b1d1){return new BPromise(function(_0x2dd77c,_0x333ae6){return client[_0x31e6('0xb')](_0x510124,_0x43b1d1)[_0x31e6('0xc')](function(_0x4e280d){logger[_0x31e6('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x577ad5,'request\x20sent');logger[_0x31e6('0xe')](_0x31e6('0xf'),_0x577ad5,_0x31e6('0x10'),JSON[_0x31e6('0x11')](_0x4e280d));if(_0x4e280d['error']){if(_0x4e280d[_0x31e6('0x12')][_0x31e6('0x13')]===0x1f4){logger[_0x31e6('0x12')](_0x31e6('0x14'),_0x577ad5,_0x4e280d[_0x31e6('0x12')][_0x31e6('0x15')]);return _0x333ae6(_0x4e280d[_0x31e6('0x12')][_0x31e6('0x15')]);}logger[_0x31e6('0x12')](_0x31e6('0x14'),_0x577ad5,_0x4e280d[_0x31e6('0x12')][_0x31e6('0x15')]);return _0x2dd77c(_0x4e280d[_0x31e6('0x12')][_0x31e6('0x15')]);}else{logger[_0x31e6('0xd')](_0x31e6('0x14'),_0x577ad5,_0x31e6('0x10'));_0x2dd77c(_0x4e280d[_0x31e6('0x16')]['message']);}})[_0x31e6('0x17')](function(_0x11268e){logger[_0x31e6('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x577ad5,_0x11268e);_0x333ae6(_0x11268e);});});} \ No newline at end of file +var _0x271a=['then','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x4659fe,_0x1acd23){var _0x283836=function(_0xcad166){while(--_0xcad166){_0x4659fe['push'](_0x4659fe['shift']());}};_0x283836(++_0x1acd23);}(_0x271a,0xc4));var _0xa271=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x271a[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xa271('0x0'));var util=require('util');var moment=require(_0xa271('0x1'));var BPromise=require(_0xa271('0x2'));var rs=require(_0xa271('0x3'));var fs=require('fs');var Redis=require(_0xa271('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa271('0x5'));var logger=require(_0xa271('0x6'))(_0xa271('0x7'));var config=require('../../config/environment');var jayson=require(_0xa271('0x8'));var client=jayson[_0xa271('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40974a,_0x1a9801,_0x3789e6){return new BPromise(function(_0xf74fa,_0x2ee6b6){return client[_0xa271('0xa')](_0x40974a,_0x3789e6)[_0xa271('0xb')](function(_0x1846ef){logger['info'](_0xa271('0xc'),_0x1a9801,'request\x20sent');logger[_0xa271('0xd')](_0xa271('0xe'),_0x1a9801,_0xa271('0xf'),JSON[_0xa271('0x10')](_0x1846ef));if(_0x1846ef['error']){if(_0x1846ef[_0xa271('0x11')][_0xa271('0x12')]===0x1f4){logger[_0xa271('0x11')](_0xa271('0xc'),_0x1a9801,_0x1846ef['error'][_0xa271('0x13')]);return _0x2ee6b6(_0x1846ef['error'][_0xa271('0x13')]);}logger[_0xa271('0x11')](_0xa271('0xc'),_0x1a9801,_0x1846ef['error'][_0xa271('0x13')]);return _0xf74fa(_0x1846ef[_0xa271('0x11')]['message']);}else{logger[_0xa271('0x14')](_0xa271('0xc'),_0x1a9801,_0xa271('0xf'));_0xf74fa(_0x1846ef[_0xa271('0x15')][_0xa271('0x13')]);}})[_0xa271('0x16')](function(_0x3db0c6){logger[_0xa271('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0x1a9801,_0x3db0c6);_0x2ee6b6(_0x3db0c6);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 2e80e92..5c61c34 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 _0x5d17=['create','put','/:id','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','isAuthenticated','show','post'];(function(_0x29b7d0,_0x180edf){var _0xbeb0b=function(_0x375188){while(--_0x375188){_0x29b7d0['push'](_0x29b7d0['shift']());}};_0xbeb0b(++_0x180edf);}(_0x5d17,0x114));var _0x75d1=function(_0x8686c9,_0x305a8f){_0x8686c9=_0x8686c9-0x0;var _0x1dc90c=_0x5d17[_0x8686c9];return _0x1dc90c;};'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')]('/:id',auth[_0x75d1('0x9')](),controller[_0x75d1('0xa')]);router[_0x75d1('0xb')]('/',auth[_0x75d1('0x9')](),controller[_0x75d1('0xc')]);router[_0x75d1('0xd')](_0x75d1('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x75d1('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x75d1('0x10')]);module[_0x75d1('0x11')]=router; \ No newline at end of file +var _0x53ec=['create','put','isAuthenticated','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatProactiveAction.controller','/:id','show','post'];(function(_0x1525d1,_0x310935){var _0xdbee2c=function(_0xb55347){while(--_0xb55347){_0x1525d1['push'](_0x1525d1['shift']());}};_0xdbee2c(++_0x310935);}(_0x53ec,0x192));var _0xc53e=function(_0x4d337e,_0x2f7eed){_0x4d337e=_0x4d337e-0x0;var _0x247963=_0x53ec[_0x4d337e];return _0x247963;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get'](_0xc53e('0x9'),auth['isAuthenticated'](),controller[_0xc53e('0xa')]);router[_0xc53e('0xb')]('/',auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xd')](_0xc53e('0x9'),auth[_0xc53e('0xe')](),controller[_0xc53e('0xf')]);router[_0xc53e('0x10')](_0xc53e('0x9'),auth[_0xc53e('0xe')](),controller[_0xc53e('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index b99d918..5550ec8 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 _0xe5ac=['sequelize','exports','name','STRING','ENUM','beepall'];(function(_0x57c750,_0x3ca2c1){var _0x56dcba=function(_0x104134){while(--_0x104134){_0x57c750['push'](_0x57c750['shift']());}};_0x56dcba(++_0x3ca2c1);}(_0xe5ac,0x9c));var _0xce5a=function(_0x4b5740,_0x1689d2){_0x4b5740=_0x4b5740-0x0;var _0x49aa07=_0xe5ac[_0x4b5740];return _0x49aa07;};'use strict';var Sequelize=require(_0xce5a('0x0'));module[_0xce5a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xce5a('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xce5a('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xce5a('0x4')]('rrmemory',_0xce5a('0x5'),'roundrobin')}}; \ No newline at end of file +var _0x7ed0=['STRING','name','INTEGER','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x1c4397,_0x36a3e5){var _0x588673=function(_0x29e853){while(--_0x29e853){_0x1c4397['push'](_0x1c4397['shift']());}};_0x588673(++_0x36a3e5);}(_0x7ed0,0xce));var _0x07ed=function(_0xc4912a,_0x333022){_0xc4912a=_0xc4912a-0x0;var _0x288c7a=_0x7ed0[_0xc4912a];return _0x288c7a;};'use strict';var Sequelize=require(_0x07ed('0x0'));module[_0x07ed('0x1')]={'name':{'type':Sequelize[_0x07ed('0x2')],'unique':_0x07ed('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x07ed('0x2')]},'timeout':{'type':Sequelize[_0x07ed('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x07ed('0x5'),_0x07ed('0x6'),_0x07ed('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 678f582..11d8f43 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 _0x3d48=['message','ChatQueue,\x20%s,\x20%s','info','catch','sendStatus','status','end','offset','undefined','limit','count','Content-Range','reject','update','destroy','get','ChatQueues','stack','name','index','map','ChatQueue','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','include','findAll','rows','params','rawAttributes','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','UserProfileResource','describe','getMembers','UserChatQueue','ChatQueueId','UserId','agent','updatedAt','format','%s/%s','SIP','chatPause','createdAt','getTeams','findOne','Team','ids','User','online','voicePause','Agents','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','compact','removeAgents','userChatQueue:remove','addAgents','omit','userChatQueue:save','isArray','getAgents','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatQueue.socket','register','request','then','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5d5378,_0x3d083e){var _0x46fa19=function(_0x726a3d){while(--_0x726a3d){_0x5d5378['push'](_0x5d5378['shift']());}};_0x46fa19(++_0x3d083e);}(_0x3d48,0x1a0));var _0x83d4=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x3d48[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x83d4('0x0'));var zipdir=require(_0x83d4('0x1'));var jsonpatch=require(_0x83d4('0x2'));var rp=require('request-promise');var moment=require(_0x83d4('0x3'));var BPromise=require(_0x83d4('0x4'));var Mustache=require(_0x83d4('0x5'));var util=require(_0x83d4('0x6'));var path=require(_0x83d4('0x7'));var sox=require(_0x83d4('0x8'));var csv=require(_0x83d4('0x9'));var ejs=require(_0x83d4('0xa'));var fs=require('fs');var fs_extra=require(_0x83d4('0xb'));var _=require(_0x83d4('0xc'));var squel=require(_0x83d4('0xd'));var crypto=require('crypto');var jsforce=require(_0x83d4('0xe'));var deskjs=require(_0x83d4('0xf'));var toCsv=require(_0x83d4('0x9'));var querystring=require(_0x83d4('0x10'));var Papa=require(_0x83d4('0x11'));var Redis=require(_0x83d4('0x12'));var authService=require(_0x83d4('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x83d4('0x14'));var hardwareService=require(_0x83d4('0x15'));var logger=require(_0x83d4('0x16'))(_0x83d4('0x17'));var utils=require(_0x83d4('0x18'));var config=require(_0x83d4('0x19'));var licenseUtil=require(_0x83d4('0x1a'));var db=require(_0x83d4('0x1b'))['db'];config[_0x83d4('0x1c')]=_[_0x83d4('0x1d')](config['redis'],{'host':_0x83d4('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x83d4('0x1f'))[_0x83d4('0x20')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x575ce7,_0x48471a,_0x5b1955,_0x9adfbc){return new BPromise(function(_0x190de6,_0x10ba2e){var _0x345cc8=_0x9adfbc||client;return _0x345cc8[_0x83d4('0x21')](_0x575ce7,_0x5b1955)[_0x83d4('0x22')](function(_0x5afeec){logger['info']('ChatQueue,\x20%s,\x20%s',_0x48471a,_0x83d4('0x23'));logger[_0x83d4('0x24')](_0x83d4('0x25'),_0x48471a,'request\x20sent',JSON[_0x83d4('0x26')](_0x5afeec));if(_0x5afeec[_0x83d4('0x27')]){if(_0x5afeec['error']['code']===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x48471a,_0x5afeec['error'][_0x83d4('0x28')]);return _0x10ba2e(_0x5afeec[_0x83d4('0x27')][_0x83d4('0x28')]);}logger['error'](_0x83d4('0x29'),_0x48471a,_0x5afeec[_0x83d4('0x27')][_0x83d4('0x28')]);return _0x190de6(_0x5afeec[_0x83d4('0x27')][_0x83d4('0x28')]);}else{logger[_0x83d4('0x2a')](_0x83d4('0x29'),_0x48471a,_0x83d4('0x23'));_0x190de6(_0x5afeec['result'][_0x83d4('0x28')]);}})[_0x83d4('0x2b')](function(_0x1a6a39){logger[_0x83d4('0x27')](_0x83d4('0x29'),_0x48471a,_0x1a6a39);_0x10ba2e(_0x1a6a39);});});}function respondWithStatusCode(_0x4ddc4c,_0x9a0e77){_0x9a0e77=_0x9a0e77||0xcc;return function(_0x58d045){if(_0x58d045){return _0x4ddc4c[_0x83d4('0x2c')](_0x9a0e77);}return _0x4ddc4c[_0x83d4('0x2d')](_0x9a0e77)[_0x83d4('0x2e')]();};}function respondWithResult(_0x2ea4b3,_0x45f14e){_0x45f14e=_0x45f14e||0xc8;return function(_0x14e0c9){if(_0x14e0c9){return _0x2ea4b3[_0x83d4('0x2d')](_0x45f14e)['json'](_0x14e0c9);}};}function respondWithFilteredResult(_0x72451c,_0x140d31){return function(_0x126be9){if(_0x126be9){var _0x78e0c4=typeof _0x140d31[_0x83d4('0x2f')]===_0x83d4('0x30')&&typeof _0x140d31[_0x83d4('0x31')]===_0x83d4('0x30');var _0x3e447b=_0x126be9[_0x83d4('0x32')];var _0x3b9c72=_0x78e0c4?0x0:_0x140d31['offset'];var _0x32869a=_0x78e0c4?_0x126be9[_0x83d4('0x32')]:_0x140d31[_0x83d4('0x2f')]+_0x140d31['limit'];var _0x107241;if(_0x32869a>=_0x3e447b){_0x32869a=_0x3e447b;_0x107241=0xc8;}else{_0x107241=0xce;}_0x72451c[_0x83d4('0x2d')](_0x107241);return _0x72451c['set'](_0x83d4('0x33'),_0x3b9c72+'-'+_0x32869a+'/'+_0x3e447b)['json'](_0x126be9);}return null;};}function patchUpdates(_0x31f4b5){return function(_0x2d446a){try{jsonpatch['apply'](_0x2d446a,_0x31f4b5,!![]);}catch(_0x2e1f73){return BPromise[_0x83d4('0x34')](_0x2e1f73);}return _0x2d446a['save']();};}function saveUpdates(_0xebb1bd,_0x252919){return function(_0x72580a){if(_0x72580a){return _0x72580a[_0x83d4('0x35')](_0xebb1bd)[_0x83d4('0x22')](function(_0x10ca5b){return _0x10ca5b;});}return null;};}function removeEntity(_0x530687,_0x4898dc){return function(_0x2f3140){if(_0x2f3140){return _0x2f3140[_0x83d4('0x36')]()[_0x83d4('0x22')](function(){var _0x40b6b5=_0x2f3140[_0x83d4('0x37')]({'plain':!![]});var _0x3d4685=_0x83d4('0x38');return db['UserProfileResource'][_0x83d4('0x36')]({'where':{'type':_0x3d4685,'resourceId':_0x40b6b5['id']}})[_0x83d4('0x22')](function(){return _0x2f3140;});})[_0x83d4('0x22')](function(){_0x530687[_0x83d4('0x2d')](0xcc)[_0x83d4('0x2e')]();});}};}function handleEntityNotFound(_0x129375,_0x27d5fb){return function(_0x25dd7b){if(!_0x25dd7b){_0x129375[_0x83d4('0x2c')](0x194);}return _0x25dd7b;};}function handleError(_0x185647,_0x1854b5){_0x1854b5=_0x1854b5||0x1f4;return function(_0x358733){logger[_0x83d4('0x27')](_0x358733[_0x83d4('0x39')]);if(_0x358733[_0x83d4('0x3a')]){delete _0x358733['name'];}_0x185647['status'](_0x1854b5)['send'](_0x358733);};}exports[_0x83d4('0x3b')]=function(_0x50adb5,_0xe8899e){var _0xa4c237={},_0x18851b={},_0x1a6f67={'count':0x0,'rows':[]};var _0x4bd9ea=_[_0x83d4('0x3c')](db[_0x83d4('0x3d')]['rawAttributes'],function(_0x3a6e06){return{'name':_0x3a6e06['fieldName'],'type':_0x3a6e06['type'][_0x83d4('0x3e')]};});_0x18851b[_0x83d4('0x3f')]=_['map'](_0x4bd9ea,_0x83d4('0x3a'));_0x18851b[_0x83d4('0x40')]=_[_0x83d4('0x41')](_0x50adb5[_0x83d4('0x40')]);_0x18851b[_0x83d4('0x42')]=_[_0x83d4('0x43')](_0x18851b[_0x83d4('0x3f')],_0x18851b['query']);_0xa4c237[_0x83d4('0x44')]=_[_0x83d4('0x43')](_0x18851b['model'],qs[_0x83d4('0x45')](_0x50adb5['query']['fields']));_0xa4c237[_0x83d4('0x44')]=_0xa4c237[_0x83d4('0x44')][_0x83d4('0x46')]?_0xa4c237[_0x83d4('0x44')]:_0x18851b[_0x83d4('0x3f')];if(!_0x50adb5['query'][_0x83d4('0x47')](_0x83d4('0x48'))){_0xa4c237[_0x83d4('0x31')]=qs[_0x83d4('0x31')](_0x50adb5[_0x83d4('0x40')][_0x83d4('0x31')]);_0xa4c237['offset']=qs[_0x83d4('0x2f')](_0x50adb5[_0x83d4('0x40')][_0x83d4('0x2f')]);}_0xa4c237[_0x83d4('0x49')]=qs['sort'](_0x50adb5[_0x83d4('0x40')][_0x83d4('0x4a')]);_0xa4c237[_0x83d4('0x4b')]=qs[_0x83d4('0x42')](_[_0x83d4('0x4c')](_0x50adb5[_0x83d4('0x40')],_0x18851b['filters']),_0x4bd9ea);if(_0x50adb5[_0x83d4('0x40')]['filter']){_0xa4c237[_0x83d4('0x4b')]=_['merge'](_0xa4c237['where'],{'$or':_[_0x83d4('0x3c')](_0x4bd9ea,function(_0x2247bc){if(_0x2247bc[_0x83d4('0x4d')]!==_0x83d4('0x4e')){var _0x175ac1={};_0x175ac1[_0x2247bc[_0x83d4('0x3a')]]={'$like':'%'+_0x50adb5[_0x83d4('0x40')][_0x83d4('0x4f')]+'%'};return _0x175ac1;}})});}_0xa4c237=_[_0x83d4('0x50')]({},_0xa4c237,_0x50adb5['options']);var _0x34f450={'where':_0xa4c237[_0x83d4('0x4b')]};return db[_0x83d4('0x3d')][_0x83d4('0x32')](_0x34f450)['then'](function(_0x1cc9d2){_0x1a6f67[_0x83d4('0x32')]=_0x1cc9d2;if(_0x50adb5[_0x83d4('0x40')]['includeAll']){_0xa4c237[_0x83d4('0x51')]=[{'all':!![]}];}return db[_0x83d4('0x3d')][_0x83d4('0x52')](_0xa4c237);})[_0x83d4('0x22')](function(_0x1ec382){_0x1a6f67[_0x83d4('0x53')]=_0x1ec382;return _0x1a6f67;})[_0x83d4('0x22')](respondWithFilteredResult(_0xe8899e,_0xa4c237))[_0x83d4('0x2b')](handleError(_0xe8899e,null));};exports['show']=function(_0x2b6551,_0x500353){var _0x262984={'raw':!![],'where':{'id':_0x2b6551[_0x83d4('0x54')]['id']}},_0x49eaea={};_0x49eaea[_0x83d4('0x3f')]=_[_0x83d4('0x41')](db[_0x83d4('0x3d')][_0x83d4('0x55')]);_0x49eaea['query']=_[_0x83d4('0x41')](_0x2b6551[_0x83d4('0x40')]);_0x49eaea[_0x83d4('0x42')]=_[_0x83d4('0x43')](_0x49eaea[_0x83d4('0x3f')],_0x49eaea[_0x83d4('0x40')]);_0x262984['attributes']=_['intersection'](_0x49eaea[_0x83d4('0x3f')],qs['fields'](_0x2b6551[_0x83d4('0x40')][_0x83d4('0x45')]));_0x262984[_0x83d4('0x44')]=_0x262984[_0x83d4('0x44')]['length']?_0x262984[_0x83d4('0x44')]:_0x49eaea[_0x83d4('0x3f')];if(_0x2b6551['query'][_0x83d4('0x56')]){_0x262984[_0x83d4('0x51')]=[{'all':!![]}];}_0x262984=_[_0x83d4('0x50')]({},_0x262984,_0x2b6551[_0x83d4('0x57')]);return db[_0x83d4('0x3d')]['find'](_0x262984)[_0x83d4('0x22')](handleEntityNotFound(_0x500353,null))[_0x83d4('0x22')](respondWithResult(_0x500353,null))[_0x83d4('0x2b')](handleError(_0x500353,null));};exports['create']=function(_0x2fd9a6,_0xfc12c){return db[_0x83d4('0x3d')][_0x83d4('0x58')](_0x2fd9a6[_0x83d4('0x59')],{})[_0x83d4('0x22')](function(_0x402e2e){var _0x123fa2=_0x2fd9a6[_0x83d4('0x5a')][_0x83d4('0x37')]({'plain':!![]});if(!_0x123fa2)throw new Error(_0x83d4('0x5b'));if(_0x123fa2[_0x83d4('0x5c')]===_0x83d4('0x5a')){var _0x2871da=_0x402e2e[_0x83d4('0x37')]({'plain':!![]});var _0x253e28=_0x83d4('0x38');return db[_0x83d4('0x5d')][_0x83d4('0x5e')]({'where':{'name':_0x253e28,'userProfileId':_0x123fa2[_0x83d4('0x5f')]},'raw':!![]})[_0x83d4('0x22')](function(_0x5d991a){if(_0x5d991a&&_0x5d991a['autoAssociation']===0x0){return db[_0x83d4('0x60')][_0x83d4('0x58')]({'name':_0x2871da[_0x83d4('0x3a')],'resourceId':_0x2871da['id'],'type':_0x5d991a['name'],'sectionId':_0x5d991a['id']},{})[_0x83d4('0x22')](function(){return _0x402e2e;});}else{return _0x402e2e;}})[_0x83d4('0x2b')](function(_0x209129){logger[_0x83d4('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x209129);throw _0x209129;});}return _0x402e2e;})[_0x83d4('0x22')](respondWithResult(_0xfc12c,0xc9))[_0x83d4('0x2b')](handleError(_0xfc12c,null));};exports[_0x83d4('0x35')]=function(_0x2fa6d6,_0x2beea7){if(_0x2fa6d6[_0x83d4('0x59')]['id']){delete _0x2fa6d6['body']['id'];}return db['ChatQueue']['find']({'where':{'id':_0x2fa6d6[_0x83d4('0x54')]['id']}})[_0x83d4('0x22')](handleEntityNotFound(_0x2beea7,null))[_0x83d4('0x22')](saveUpdates(_0x2fa6d6[_0x83d4('0x59')],null))[_0x83d4('0x22')](respondWithResult(_0x2beea7,null))[_0x83d4('0x2b')](handleError(_0x2beea7,null));};exports[_0x83d4('0x36')]=function(_0x336546,_0x35c5e4){return db['ChatQueue'][_0x83d4('0x5e')]({'where':{'id':_0x336546[_0x83d4('0x54')]['id']}})[_0x83d4('0x22')](handleEntityNotFound(_0x35c5e4,null))[_0x83d4('0x22')](removeEntity(_0x35c5e4,null))[_0x83d4('0x2b')](handleError(_0x35c5e4,null));};exports[_0x83d4('0x61')]=function(_0xab3029,_0x2e9e89){return db[_0x83d4('0x3d')]['describe']()[_0x83d4('0x22')](respondWithResult(_0x2e9e89,null))[_0x83d4('0x2b')](handleError(_0x2e9e89,null));};exports[_0x83d4('0x62')]=function(_0x474fe,_0x3cd833,_0x220978){var _0x3b60c8={'raw':!![],'where':{}},_0x12e584={},_0x1ab963;return db['ChatQueue']['findOne']({'where':{'id':_0x474fe['params']['id']}})[_0x83d4('0x22')](handleEntityNotFound(_0x3cd833,null))[_0x83d4('0x22')](function(_0x3354a4){if(_0x3354a4){_0x1ab963=_0x3354a4[_0x83d4('0x37')]({'plain':!![]});_0x12e584[_0x83d4('0x3f')]=_[_0x83d4('0x41')](db[_0x83d4('0x63')][_0x83d4('0x55')]);_0x12e584['query']=_[_0x83d4('0x41')](_0x474fe[_0x83d4('0x40')]);_0x12e584[_0x83d4('0x42')]=_[_0x83d4('0x43')](_0x12e584[_0x83d4('0x3f')],_0x12e584[_0x83d4('0x40')]);_0x3b60c8['attributes']=_[_0x83d4('0x43')](_0x12e584[_0x83d4('0x3f')],qs[_0x83d4('0x45')](_0x474fe[_0x83d4('0x40')][_0x83d4('0x45')]));_0x3b60c8[_0x83d4('0x44')]=_0x3b60c8[_0x83d4('0x44')][_0x83d4('0x46')]?_0x3b60c8[_0x83d4('0x44')]:_0x12e584['model'];if(!_0x474fe[_0x83d4('0x40')]['hasOwnProperty'](_0x83d4('0x48'))){_0x3b60c8[_0x83d4('0x31')]=qs[_0x83d4('0x31')](_0x474fe[_0x83d4('0x40')]['limit']);_0x3b60c8[_0x83d4('0x2f')]=qs[_0x83d4('0x2f')](_0x474fe['query'][_0x83d4('0x2f')]);}_0x3b60c8[_0x83d4('0x49')]=qs[_0x83d4('0x4a')](_0x474fe[_0x83d4('0x40')][_0x83d4('0x4a')]);_0x3b60c8[_0x83d4('0x4b')]=qs[_0x83d4('0x42')](_[_0x83d4('0x4c')](_0x474fe[_0x83d4('0x40')],_0x12e584[_0x83d4('0x42')]));_0x3b60c8['where'][_0x83d4('0x64')]=_0x3354a4['id'];if(_0x474fe['query'][_0x83d4('0x4f')]){_0x3b60c8['where']=_['merge'](_0x3b60c8[_0x83d4('0x4b')],{'$or':_[_0x83d4('0x3c')](_0x3b60c8[_0x83d4('0x44')],function(_0x294acb){var _0x29e2ed={};_0x29e2ed[_0x294acb]={'$like':'%'+_0x474fe[_0x83d4('0x40')]['filter']+'%'};return _0x29e2ed;})});}_0x3b60c8=_[_0x83d4('0x50')]({},_0x3b60c8,_0x474fe['options']);return db['UserChatQueue'][_0x83d4('0x52')](_0x3b60c8);}})[_0x83d4('0x22')](function(_0x20c163){if(_0x20c163){return db['User']['findAndCountAll']({'where':{'id':_[_0x83d4('0x3c')](_0x20c163,_0x83d4('0x65')),'role':_0x83d4('0x66')},'attributes':['id',_0x83d4('0x3a'),'chatPause',_0x83d4('0x67'),'createdAt']});}})['then'](function(_0x4985b4){if(_0x4985b4){return{'count':_0x4985b4['count'],'rows':_['map'](_0x4985b4[_0x83d4('0x53')],function(_0x5700cc){return{'membername':_0x5700cc['name'],'UserId':_0x5700cc['id'],'queue_name':_0x1ab963[_0x83d4('0x3a')],'ChatQueueId':_0x1ab963['id'],'interface':util[_0x83d4('0x68')](_0x83d4('0x69'),_0x83d4('0x6a'),_0x5700cc[_0x83d4('0x3a')]),'penalty':0x0,'paused':_0x5700cc[_0x83d4('0x6b')],'createdAt':_0x5700cc[_0x83d4('0x6c')],'updatedAt':_0x5700cc[_0x83d4('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3cd833,_0x3b60c8))[_0x83d4('0x2b')](handleError(_0x3cd833,null));};exports[_0x83d4('0x6d')]=function(_0x1b54f4,_0xa828c7,_0xd32c7e){var _0x1e12c8={};var _0x5adb65={};var _0x165998;var _0x50f685;return db[_0x83d4('0x3d')][_0x83d4('0x6e')]({'where':{'id':_0x1b54f4[_0x83d4('0x54')]['id']}})['then'](handleEntityNotFound(_0xa828c7,null))[_0x83d4('0x22')](function(_0x2f56b2){if(_0x2f56b2){_0x165998=_0x2f56b2;_0x5adb65[_0x83d4('0x3f')]=_[_0x83d4('0x41')](db[_0x83d4('0x6f')][_0x83d4('0x55')]);_0x5adb65['query']=_[_0x83d4('0x41')](_0x1b54f4[_0x83d4('0x40')]);_0x5adb65['filters']=_[_0x83d4('0x43')](_0x5adb65[_0x83d4('0x3f')],_0x5adb65[_0x83d4('0x40')]);_0x1e12c8[_0x83d4('0x44')]=_[_0x83d4('0x43')](_0x5adb65[_0x83d4('0x3f')],qs[_0x83d4('0x45')](_0x1b54f4[_0x83d4('0x40')][_0x83d4('0x45')]));_0x1e12c8[_0x83d4('0x44')]=_0x1e12c8['attributes'][_0x83d4('0x46')]?_0x1e12c8[_0x83d4('0x44')]:_0x5adb65[_0x83d4('0x3f')];_0x1e12c8[_0x83d4('0x49')]=qs[_0x83d4('0x4a')](_0x1b54f4[_0x83d4('0x40')]['sort']);_0x1e12c8[_0x83d4('0x4b')]=qs['filters'](_['pick'](_0x1b54f4[_0x83d4('0x40')],_0x5adb65[_0x83d4('0x42')]));if(_0x1b54f4[_0x83d4('0x40')][_0x83d4('0x4f')]){_0x1e12c8['where']=_[_0x83d4('0x50')](_0x1e12c8['where'],{'$or':_[_0x83d4('0x3c')](_0x1e12c8[_0x83d4('0x44')],function(_0x43625d){var _0xb7d84={};_0xb7d84[_0x43625d]={'$like':'%'+_0x1b54f4[_0x83d4('0x40')][_0x83d4('0x4f')]+'%'};return _0xb7d84;})});}_0x1e12c8=_[_0x83d4('0x50')]({},_0x1e12c8,_0x1b54f4[_0x83d4('0x57')]);return _0x165998[_0x83d4('0x6d')](_0x1e12c8);}})[_0x83d4('0x22')](function(_0x588a66){if(_0x588a66){_0x50f685=_0x588a66['length'];if(!_0x1b54f4[_0x83d4('0x40')][_0x83d4('0x47')](_0x83d4('0x48'))){_0x1e12c8[_0x83d4('0x31')]=qs['limit'](_0x1b54f4[_0x83d4('0x40')]['limit']);_0x1e12c8[_0x83d4('0x2f')]=qs[_0x83d4('0x2f')](_0x1b54f4['query'][_0x83d4('0x2f')]);}return _0x165998['getTeams'](_0x1e12c8);}})[_0x83d4('0x22')](function(_0x41eca4){if(_0x41eca4){return _0x41eca4?{'count':_0x50f685,'rows':_0x41eca4}:null;}})[_0x83d4('0x22')](respondWithResult(_0xa828c7,null))[_0x83d4('0x2b')](handleError(_0xa828c7,null));};exports['addTeams']=function(_0x33000e,_0x32068a,_0x20a529){var _0x2355ab=_0x33000e[_0x83d4('0x59')][_0x83d4('0x70')];return db['Team'][_0x83d4('0x52')]({'where':{'id':_0x2355ab},'attributes':['id'],'include':[{'model':db[_0x83d4('0x71')],'as':'Agents','attributes':['id','name',_0x83d4('0x72'),_0x83d4('0x73'),'interface'],'raw':!![]}]})[_0x83d4('0x22')](function(_0x598b70){if(_0x598b70){var _0x4aa8ed=_['flatMap'](_0x598b70,function(_0x736606){var _0x309a9b=_0x736606[_0x83d4('0x37')]({'plain':!![]});return _0x309a9b[_0x83d4('0x74')];});return db[_0x83d4('0x3d')]['find']({'where':{'id':_0x33000e[_0x83d4('0x54')]['id']}})['then'](function(_0x15b88c){return db[_0x83d4('0x75')][_0x83d4('0x76')](function(_0x3e65ea){return _0x15b88c[_0x83d4('0x77')](_0x2355ab,{'transaction':_0x3e65ea})[_0x83d4('0x22')](function(){return BPromise[_0x83d4('0x78')](_0x4aa8ed,function(_0x5937f5){return db[_0x83d4('0x63')][_0x83d4('0x79')]({'where':{'UserId':_0x5937f5['id'],'ChatQueueId':_0x33000e[_0x83d4('0x54')]['id']},'transaction':_0x3e65ea});});})[_0x83d4('0x22')](function(){_0x4aa8ed[_0x83d4('0x7a')](function(_0x11eeb3){socket[_0x83d4('0x7b')]('userChatQueue:save',{'UserId':_0x11eeb3['id'],'ChatQueueId':_0x15b88c['id']});});});});});}})[_0x83d4('0x22')](respondWithStatusCode(_0x32068a,null))[_0x83d4('0x2b')](handleError(_0x32068a,null));};exports[_0x83d4('0x7c')]=function(_0x11a99c,_0x15ba00,_0xc09882){return db[_0x83d4('0x6f')][_0x83d4('0x52')]({'where':{'id':_0x11a99c['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x83d4('0x71')],'as':_0x83d4('0x74'),'attributes':['id'],'raw':!![]}]})[_0x83d4('0x22')](handleEntityNotFound(_0x15ba00,null))[_0x83d4('0x22')](function(_0x589e71){var _0x160dbe=_['map'](_0x589e71,'id');var _0x1cff7f=[];var _0x4a69ba=[];var _0xb78332=squel[_0x83d4('0x7d')]();_0xb78332[_0x83d4('0x7e')](_0x83d4('0x7f'))[_0x83d4('0x80')](_0x83d4('0x81'),'tq')[_0x83d4('0x82')](_0x83d4('0x83'),'ut',_0x83d4('0x84'))[_0x83d4('0x4b')](_0x83d4('0x85'),_0x11a99c[_0x83d4('0x54')]['id']);for(var _0x15726f=0x0;_0x15726f<_0x589e71[_0x83d4('0x46')];_0x15726f+=0x1){let _0x15f0d5=_0x589e71[_0x15726f];for(var _0x5c78de=0x0;_0x5c78de<_0x15f0d5['Agents'][_0x83d4('0x46')];_0x5c78de+=0x1){let _0x59d1f2=_0x15f0d5[_0x83d4('0x74')][_0x5c78de];var _0x4b8211=_0xb78332[_0x83d4('0x86')]();_0x4b8211[_0x83d4('0x4b')](_0x83d4('0x87'),_0x59d1f2['id']);_0x4a69ba[_0x83d4('0x88')](db[_0x83d4('0x75')][_0x83d4('0x40')](_0x4b8211[_0x83d4('0x89')](),{'type':db[_0x83d4('0x75')]['QueryTypes'][_0x83d4('0x8a')]})[_0x83d4('0x22')](function(_0x449cb4){if(_0x449cb4[_0x83d4('0x46')]===0x1){return _0x59d1f2['id'];}else{var _0x1a1145=_[_0x83d4('0x8b')](_[_0x83d4('0x3c')](_0x449cb4,_0x83d4('0x8c')),function(_0x38ae42){return _[_0x83d4('0x8d')](_0x160dbe,_0x38ae42);});if(_0x1a1145){return _0x59d1f2['id'];}}}));}}return BPromise[_0x83d4('0x8e')](_0x4a69ba)[_0x83d4('0x22')](function(_0x52ff9e){_0x1cff7f=_(_0x1cff7f)[_0x83d4('0x8f')](_0x52ff9e)[_0x83d4('0x90')]()['value']();return db[_0x83d4('0x3d')]['find']({'where':{'id':_0x11a99c['params']['id']}})[_0x83d4('0x22')](function(_0x182ba6){return db[_0x83d4('0x75')][_0x83d4('0x76')](function(_0x2d9a12){return _0x182ba6[_0x83d4('0x7c')](_0x11a99c[_0x83d4('0x40')]['ids'],{'transaction':_0x2d9a12})[_0x83d4('0x22')](function(){if(!_['isEmpty'](_0x1cff7f)){return _0x182ba6[_0x83d4('0x91')](_0x1cff7f,{'transaction':_0x2d9a12});}})['then'](function(){_0x1cff7f[_0x83d4('0x7a')](function(_0x5d1ca7){socket[_0x83d4('0x7b')](_0x83d4('0x92'),{'UserId':_0x5d1ca7,'ChatQueueId':_0x182ba6['id']});});});});});});})[_0x83d4('0x22')](respondWithStatusCode(_0x15ba00,null))[_0x83d4('0x2b')](handleError(_0x15ba00,null));};exports[_0x83d4('0x93')]=function(_0x31ae43,_0xeb6b2,_0x10d439){return db[_0x83d4('0x3d')][_0x83d4('0x5e')]({'where':{'id':_0x31ae43[_0x83d4('0x54')]['id']}})[_0x83d4('0x22')](handleEntityNotFound(_0xeb6b2,null))['then'](function(_0x550a34){if(_0x550a34){return _0x550a34[_0x83d4('0x93')](_0x31ae43[_0x83d4('0x59')][_0x83d4('0x70')],_[_0x83d4('0x94')](_0x31ae43[_0x83d4('0x59')],[_0x83d4('0x70'),'id'])||{})['spread'](function(_0x305d7c){for(var _0x22c625=0x0;_0x22c625<_0x31ae43[_0x83d4('0x59')][_0x83d4('0x70')]['length'];_0x22c625+=0x1){socket[_0x83d4('0x7b')](_0x83d4('0x95'),{'UserId':Number(_0x31ae43[_0x83d4('0x59')][_0x83d4('0x70')][_0x22c625]),'ChatQueueId':Number(_0x31ae43[_0x83d4('0x54')]['id'])});}return _0x305d7c;});}})[_0x83d4('0x22')](respondWithResult(_0xeb6b2,null))[_0x83d4('0x2b')](handleError(_0xeb6b2,null));};exports[_0x83d4('0x91')]=function(_0x3f8637,_0x2cb5f7,_0x420f4b){return db[_0x83d4('0x3d')][_0x83d4('0x5e')]({'where':{'id':_0x3f8637[_0x83d4('0x54')]['id']}})[_0x83d4('0x22')](handleEntityNotFound(_0x2cb5f7,null))[_0x83d4('0x22')](function(_0x58bf84){if(_0x58bf84){return _0x58bf84[_0x83d4('0x91')](_0x3f8637[_0x83d4('0x40')][_0x83d4('0x70')])[_0x83d4('0x22')](function(){if(_[_0x83d4('0x96')](_0x3f8637[_0x83d4('0x40')][_0x83d4('0x70')])){for(var _0x5a6a06=0x0;_0x5a6a06<_0x3f8637['query']['ids'][_0x83d4('0x46')];_0x5a6a06+=0x1){socket[_0x83d4('0x7b')](_0x83d4('0x92'),{'UserId':Number(_0x3f8637[_0x83d4('0x40')][_0x83d4('0x70')][_0x5a6a06]),'ChatQueueId':Number(_0x3f8637[_0x83d4('0x54')]['id'])});}}else{socket['emit'](_0x83d4('0x92'),{'UserId':Number(_0x3f8637[_0x83d4('0x40')][_0x83d4('0x70')]),'ChatQueueId':Number(_0x3f8637[_0x83d4('0x54')]['id'])});}});}})['then'](respondWithStatusCode(_0x2cb5f7,null))['catch'](handleError(_0x2cb5f7,null));};exports['getAgents']=function(_0x29e982,_0x31fc87,_0x576937){var _0x2dcbd3={};var _0x597e93={};var _0x3c1fef;var _0x9e9e70;return db[_0x83d4('0x3d')][_0x83d4('0x6e')]({'where':{'id':_0x29e982[_0x83d4('0x54')]['id']}})[_0x83d4('0x22')](handleEntityNotFound(_0x31fc87,null))[_0x83d4('0x22')](function(_0x5cf27a){if(_0x5cf27a){_0x3c1fef=_0x5cf27a;_0x597e93[_0x83d4('0x3f')]=_[_0x83d4('0x41')](db['User']['rawAttributes']);_0x597e93[_0x83d4('0x40')]=_[_0x83d4('0x41')](_0x29e982[_0x83d4('0x40')]);_0x597e93[_0x83d4('0x42')]=_[_0x83d4('0x43')](_0x597e93['model'],_0x597e93['query']);_0x2dcbd3[_0x83d4('0x44')]=_[_0x83d4('0x43')](_0x597e93[_0x83d4('0x3f')],qs[_0x83d4('0x45')](_0x29e982['query'][_0x83d4('0x45')]));_0x2dcbd3[_0x83d4('0x44')]=_0x2dcbd3['attributes']['length']?_0x2dcbd3[_0x83d4('0x44')]:_0x597e93[_0x83d4('0x3f')];_0x2dcbd3[_0x83d4('0x49')]=qs[_0x83d4('0x4a')](_0x29e982[_0x83d4('0x40')][_0x83d4('0x4a')]);_0x2dcbd3[_0x83d4('0x4b')]=qs[_0x83d4('0x42')](_[_0x83d4('0x4c')](_0x29e982[_0x83d4('0x40')],_0x597e93[_0x83d4('0x42')]));if(_0x29e982[_0x83d4('0x40')][_0x83d4('0x4f')]){_0x2dcbd3[_0x83d4('0x4b')]=_[_0x83d4('0x50')](_0x2dcbd3[_0x83d4('0x4b')],{'$or':_[_0x83d4('0x3c')](_0x2dcbd3[_0x83d4('0x44')],function(_0x20b07f){var _0x361e49={};_0x361e49[_0x20b07f]={'$like':'%'+_0x29e982[_0x83d4('0x40')][_0x83d4('0x4f')]+'%'};return _0x361e49;})});}_0x2dcbd3=_['merge']({},_0x2dcbd3,_0x29e982[_0x83d4('0x57')]);return _0x3c1fef[_0x83d4('0x97')](_0x2dcbd3);}})[_0x83d4('0x22')](function(_0x521eee){if(_0x521eee){_0x9e9e70=_0x521eee['length'];if(!_0x29e982[_0x83d4('0x40')][_0x83d4('0x47')](_0x83d4('0x48'))){_0x2dcbd3[_0x83d4('0x31')]=qs[_0x83d4('0x31')](_0x29e982[_0x83d4('0x40')][_0x83d4('0x31')]);_0x2dcbd3[_0x83d4('0x2f')]=qs[_0x83d4('0x2f')](_0x29e982[_0x83d4('0x40')][_0x83d4('0x2f')]);}return _0x3c1fef[_0x83d4('0x97')](_0x2dcbd3);}})[_0x83d4('0x22')](function(_0x3156c0){if(_0x3156c0){return _0x3156c0?{'count':_0x9e9e70,'rows':_0x3156c0}:null;}})[_0x83d4('0x22')](respondWithResult(_0x31fc87,null))[_0x83d4('0x2b')](handleError(_0x31fc87,null));}; \ No newline at end of file +var _0xfb05=['debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','get','ChatQueues','UserProfileResource','sendStatus','stack','name','send','map','fieldName','type','key','keys','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','filter','where','merge','VIRTUAL','ChatQueue','includeAll','include','findAll','rows','show','params','length','options','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','rawAttributes','order','sort','pick','UserChatQueue','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','ids','Team','Agents','voicePause','interface','sequelize','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','TeamId','union','compact','value','transaction','isEmpty','removeAgents','addAgents','spread','isArray','userChatQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x1bcc5e,_0x441b7a){var _0x312f3d=function(_0x3639a0){while(--_0x3639a0){_0x1bcc5e['push'](_0x1bcc5e['shift']());}};_0x312f3d(++_0x441b7a);}(_0xfb05,0x1b3));var _0x5fb0=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xfb05[_0x5f309e];return _0x487b5e;};'use strict';var emlformat=require(_0x5fb0('0x0'));var rimraf=require(_0x5fb0('0x1'));var zipdir=require(_0x5fb0('0x2'));var jsonpatch=require(_0x5fb0('0x3'));var rp=require(_0x5fb0('0x4'));var moment=require(_0x5fb0('0x5'));var BPromise=require(_0x5fb0('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x5fb0('0x7'));var csv=require('to-csv');var ejs=require(_0x5fb0('0x8'));var fs=require('fs');var fs_extra=require(_0x5fb0('0x9'));var _=require(_0x5fb0('0xa'));var squel=require(_0x5fb0('0xb'));var crypto=require('crypto');var jsforce=require(_0x5fb0('0xc'));var deskjs=require(_0x5fb0('0xd'));var toCsv=require(_0x5fb0('0xe'));var querystring=require(_0x5fb0('0xf'));var Papa=require(_0x5fb0('0x10'));var Redis=require(_0x5fb0('0x11'));var authService=require(_0x5fb0('0x12'));var qs=require(_0x5fb0('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5fb0('0x14'));var logger=require(_0x5fb0('0x15'))(_0x5fb0('0x16'));var utils=require('../../config/utils');var config=require(_0x5fb0('0x17'));var licenseUtil=require(_0x5fb0('0x18'));var db=require(_0x5fb0('0x19'))['db'];config['redis']=_[_0x5fb0('0x1a')](config[_0x5fb0('0x1b')],{'host':_0x5fb0('0x1c'),'port':0x18eb});var socket=require(_0x5fb0('0x1d'))(new Redis(config[_0x5fb0('0x1b')]));require(_0x5fb0('0x1e'))[_0x5fb0('0x1f')](socket);var jayson=require(_0x5fb0('0x20'));var client=jayson['client'][_0x5fb0('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x58cc92,_0x587cb4,_0x14cac5,_0x742c0c){return new BPromise(function(_0xd268cc,_0x378b4d){var _0x1223b6=_0x742c0c||client;return _0x1223b6[_0x5fb0('0x22')](_0x58cc92,_0x14cac5)[_0x5fb0('0x23')](function(_0x2d5d17){logger[_0x5fb0('0x24')](_0x5fb0('0x25'),_0x587cb4,_0x5fb0('0x26'));logger[_0x5fb0('0x27')](_0x5fb0('0x28'),_0x587cb4,_0x5fb0('0x26'),JSON[_0x5fb0('0x29')](_0x2d5d17));if(_0x2d5d17[_0x5fb0('0x2a')]){if(_0x2d5d17['error'][_0x5fb0('0x2b')]===0x1f4){logger['error'](_0x5fb0('0x25'),_0x587cb4,_0x2d5d17['error']['message']);return _0x378b4d(_0x2d5d17[_0x5fb0('0x2a')][_0x5fb0('0x2c')]);}logger[_0x5fb0('0x2a')](_0x5fb0('0x25'),_0x587cb4,_0x2d5d17[_0x5fb0('0x2a')][_0x5fb0('0x2c')]);return _0xd268cc(_0x2d5d17[_0x5fb0('0x2a')][_0x5fb0('0x2c')]);}else{logger[_0x5fb0('0x24')]('ChatQueue,\x20%s,\x20%s',_0x587cb4,_0x5fb0('0x26'));_0xd268cc(_0x2d5d17[_0x5fb0('0x2d')][_0x5fb0('0x2c')]);}})[_0x5fb0('0x2e')](function(_0xeb5902){logger[_0x5fb0('0x2a')](_0x5fb0('0x25'),_0x587cb4,_0xeb5902);_0x378b4d(_0xeb5902);});});}function respondWithStatusCode(_0x428a13,_0x357baa){_0x357baa=_0x357baa||0xcc;return function(_0x49c985){if(_0x49c985){return _0x428a13['sendStatus'](_0x357baa);}return _0x428a13['status'](_0x357baa)[_0x5fb0('0x2f')]();};}function respondWithResult(_0x5dae25,_0x1a5bd2){_0x1a5bd2=_0x1a5bd2||0xc8;return function(_0x228ae4){if(_0x228ae4){return _0x5dae25[_0x5fb0('0x30')](_0x1a5bd2)[_0x5fb0('0x31')](_0x228ae4);}};}function respondWithFilteredResult(_0x3797d3,_0x8c8e18){return function(_0x62d73e){if(_0x62d73e){var _0x2cb2da=typeof _0x8c8e18[_0x5fb0('0x32')]===_0x5fb0('0x33')&&typeof _0x8c8e18[_0x5fb0('0x34')]==='undefined';var _0x4aef8c=_0x62d73e[_0x5fb0('0x35')];var _0x4457ed=_0x2cb2da?0x0:_0x8c8e18['offset'];var _0x363578=_0x2cb2da?_0x62d73e[_0x5fb0('0x35')]:_0x8c8e18[_0x5fb0('0x32')]+_0x8c8e18['limit'];var _0x3f9128;if(_0x363578>=_0x4aef8c){_0x363578=_0x4aef8c;_0x3f9128=0xc8;}else{_0x3f9128=0xce;}_0x3797d3['status'](_0x3f9128);return _0x3797d3[_0x5fb0('0x36')](_0x5fb0('0x37'),_0x4457ed+'-'+_0x363578+'/'+_0x4aef8c)['json'](_0x62d73e);}return null;};}function patchUpdates(_0x328751){return function(_0x45ae4b){try{jsonpatch[_0x5fb0('0x38')](_0x45ae4b,_0x328751,!![]);}catch(_0x462d5c){return BPromise['reject'](_0x462d5c);}return _0x45ae4b[_0x5fb0('0x39')]();};}function saveUpdates(_0x96812e,_0x52e0f6){return function(_0x2dde6d){if(_0x2dde6d){return _0x2dde6d[_0x5fb0('0x3a')](_0x96812e)[_0x5fb0('0x23')](function(_0x1743be){return _0x1743be;});}return null;};}function removeEntity(_0x4a4259,_0x30951c){return function(_0x54bdc0){if(_0x54bdc0){return _0x54bdc0[_0x5fb0('0x3b')]()[_0x5fb0('0x23')](function(){var _0x5b905e=_0x54bdc0[_0x5fb0('0x3c')]({'plain':!![]});var _0x590cb7=_0x5fb0('0x3d');return db[_0x5fb0('0x3e')]['destroy']({'where':{'type':_0x590cb7,'resourceId':_0x5b905e['id']}})['then'](function(){return _0x54bdc0;});})[_0x5fb0('0x23')](function(){_0x4a4259[_0x5fb0('0x30')](0xcc)[_0x5fb0('0x2f')]();});}};}function handleEntityNotFound(_0x4e5de7,_0x488fc0){return function(_0x17ddb1){if(!_0x17ddb1){_0x4e5de7[_0x5fb0('0x3f')](0x194);}return _0x17ddb1;};}function handleError(_0x4cf690,_0x15e0c9){_0x15e0c9=_0x15e0c9||0x1f4;return function(_0x476a0c){logger['error'](_0x476a0c[_0x5fb0('0x40')]);if(_0x476a0c[_0x5fb0('0x41')]){delete _0x476a0c[_0x5fb0('0x41')];}_0x4cf690['status'](_0x15e0c9)[_0x5fb0('0x42')](_0x476a0c);};}exports['index']=function(_0x172e10,_0x3d560e){var _0x50ba42={},_0x5af90c={},_0x4e4179={'count':0x0,'rows':[]};var _0x39bd40=_[_0x5fb0('0x43')](db['ChatQueue']['rawAttributes'],function(_0x3c3acd){return{'name':_0x3c3acd[_0x5fb0('0x44')],'type':_0x3c3acd[_0x5fb0('0x45')][_0x5fb0('0x46')]};});_0x5af90c['model']=_['map'](_0x39bd40,'name');_0x5af90c['query']=_[_0x5fb0('0x47')](_0x172e10[_0x5fb0('0x48')]);_0x5af90c[_0x5fb0('0x49')]=_[_0x5fb0('0x4a')](_0x5af90c['model'],_0x5af90c['query']);_0x50ba42[_0x5fb0('0x4b')]=_['intersection'](_0x5af90c[_0x5fb0('0x4c')],qs['fields'](_0x172e10['query'][_0x5fb0('0x4d')]));_0x50ba42[_0x5fb0('0x4b')]=_0x50ba42[_0x5fb0('0x4b')]['length']?_0x50ba42[_0x5fb0('0x4b')]:_0x5af90c[_0x5fb0('0x4c')];if(!_0x172e10[_0x5fb0('0x48')][_0x5fb0('0x4e')](_0x5fb0('0x4f'))){_0x50ba42[_0x5fb0('0x34')]=qs['limit'](_0x172e10[_0x5fb0('0x48')][_0x5fb0('0x34')]);_0x50ba42['offset']=qs['offset'](_0x172e10[_0x5fb0('0x48')]['offset']);}_0x50ba42['order']=qs['sort'](_0x172e10[_0x5fb0('0x48')]['sort']);_0x50ba42['where']=qs[_0x5fb0('0x49')](_['pick'](_0x172e10[_0x5fb0('0x48')],_0x5af90c[_0x5fb0('0x49')]),_0x39bd40);if(_0x172e10[_0x5fb0('0x48')][_0x5fb0('0x50')]){_0x50ba42[_0x5fb0('0x51')]=_[_0x5fb0('0x52')](_0x50ba42[_0x5fb0('0x51')],{'$or':_[_0x5fb0('0x43')](_0x39bd40,function(_0x176b92){if(_0x176b92[_0x5fb0('0x45')]!==_0x5fb0('0x53')){var _0x2f2cf0={};_0x2f2cf0[_0x176b92[_0x5fb0('0x41')]]={'$like':'%'+_0x172e10['query'][_0x5fb0('0x50')]+'%'};return _0x2f2cf0;}})});}_0x50ba42=_['merge']({},_0x50ba42,_0x172e10['options']);var _0x19e724={'where':_0x50ba42[_0x5fb0('0x51')]};return db[_0x5fb0('0x54')][_0x5fb0('0x35')](_0x19e724)[_0x5fb0('0x23')](function(_0xbd9fa1){_0x4e4179['count']=_0xbd9fa1;if(_0x172e10[_0x5fb0('0x48')][_0x5fb0('0x55')]){_0x50ba42[_0x5fb0('0x56')]=[{'all':!![]}];}return db[_0x5fb0('0x54')][_0x5fb0('0x57')](_0x50ba42);})[_0x5fb0('0x23')](function(_0x4ce09a){_0x4e4179[_0x5fb0('0x58')]=_0x4ce09a;return _0x4e4179;})[_0x5fb0('0x23')](respondWithFilteredResult(_0x3d560e,_0x50ba42))[_0x5fb0('0x2e')](handleError(_0x3d560e,null));};exports[_0x5fb0('0x59')]=function(_0x2b66e3,_0x3e166f){var _0x2a9c56={'raw':!![],'where':{'id':_0x2b66e3[_0x5fb0('0x5a')]['id']}},_0x39d2ea={};_0x39d2ea[_0x5fb0('0x4c')]=_[_0x5fb0('0x47')](db[_0x5fb0('0x54')]['rawAttributes']);_0x39d2ea[_0x5fb0('0x48')]=_[_0x5fb0('0x47')](_0x2b66e3[_0x5fb0('0x48')]);_0x39d2ea['filters']=_[_0x5fb0('0x4a')](_0x39d2ea[_0x5fb0('0x4c')],_0x39d2ea[_0x5fb0('0x48')]);_0x2a9c56[_0x5fb0('0x4b')]=_['intersection'](_0x39d2ea['model'],qs[_0x5fb0('0x4d')](_0x2b66e3['query'][_0x5fb0('0x4d')]));_0x2a9c56[_0x5fb0('0x4b')]=_0x2a9c56[_0x5fb0('0x4b')][_0x5fb0('0x5b')]?_0x2a9c56['attributes']:_0x39d2ea[_0x5fb0('0x4c')];if(_0x2b66e3['query'][_0x5fb0('0x55')]){_0x2a9c56['include']=[{'all':!![]}];}_0x2a9c56=_[_0x5fb0('0x52')]({},_0x2a9c56,_0x2b66e3[_0x5fb0('0x5c')]);return db[_0x5fb0('0x54')][_0x5fb0('0x5d')](_0x2a9c56)['then'](handleEntityNotFound(_0x3e166f,null))[_0x5fb0('0x23')](respondWithResult(_0x3e166f,null))[_0x5fb0('0x2e')](handleError(_0x3e166f,null));};exports[_0x5fb0('0x5e')]=function(_0x4cf321,_0x5dfa2b){return db[_0x5fb0('0x54')][_0x5fb0('0x5e')](_0x4cf321[_0x5fb0('0x5f')],{})['then'](function(_0x65a6bb){var _0x2d3b73=_0x4cf321[_0x5fb0('0x60')][_0x5fb0('0x3c')]({'plain':!![]});if(!_0x2d3b73)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2d3b73['role']===_0x5fb0('0x60')){var _0xcfe4c9=_0x65a6bb[_0x5fb0('0x3c')]({'plain':!![]});var _0x493f18=_0x5fb0('0x3d');return db[_0x5fb0('0x61')][_0x5fb0('0x5d')]({'where':{'name':_0x493f18,'userProfileId':_0x2d3b73[_0x5fb0('0x62')]},'raw':!![]})[_0x5fb0('0x23')](function(_0x50cf96){if(_0x50cf96&&_0x50cf96[_0x5fb0('0x63')]===0x0){return db[_0x5fb0('0x3e')]['create']({'name':_0xcfe4c9[_0x5fb0('0x41')],'resourceId':_0xcfe4c9['id'],'type':_0x50cf96[_0x5fb0('0x41')],'sectionId':_0x50cf96['id']},{})[_0x5fb0('0x23')](function(){return _0x65a6bb;});}else{return _0x65a6bb;}})[_0x5fb0('0x2e')](function(_0x2751ac){logger['error'](_0x5fb0('0x64'),_0x2751ac);throw _0x2751ac;});}return _0x65a6bb;})[_0x5fb0('0x23')](respondWithResult(_0x5dfa2b,0xc9))[_0x5fb0('0x2e')](handleError(_0x5dfa2b,null));};exports['update']=function(_0x3f725e,_0x11ab29){if(_0x3f725e[_0x5fb0('0x5f')]['id']){delete _0x3f725e[_0x5fb0('0x5f')]['id'];}return db[_0x5fb0('0x54')][_0x5fb0('0x5d')]({'where':{'id':_0x3f725e['params']['id']}})[_0x5fb0('0x23')](handleEntityNotFound(_0x11ab29,null))[_0x5fb0('0x23')](saveUpdates(_0x3f725e['body'],null))[_0x5fb0('0x23')](respondWithResult(_0x11ab29,null))[_0x5fb0('0x2e')](handleError(_0x11ab29,null));};exports['destroy']=function(_0x2b424a,_0x39562a){return db['ChatQueue'][_0x5fb0('0x5d')]({'where':{'id':_0x2b424a[_0x5fb0('0x5a')]['id']}})[_0x5fb0('0x23')](handleEntityNotFound(_0x39562a,null))[_0x5fb0('0x23')](removeEntity(_0x39562a,null))['catch'](handleError(_0x39562a,null));};exports[_0x5fb0('0x65')]=function(_0x4c8ea2,_0x1b3d45){return db[_0x5fb0('0x54')][_0x5fb0('0x65')]()['then'](respondWithResult(_0x1b3d45,null))[_0x5fb0('0x2e')](handleError(_0x1b3d45,null));};exports[_0x5fb0('0x66')]=function(_0x13c236,_0x21daa9,_0x129a49){var _0x5b5ae2={'raw':!![],'where':{}},_0x2bf2a8={},_0x2efdc9;return db[_0x5fb0('0x54')][_0x5fb0('0x67')]({'where':{'id':_0x13c236[_0x5fb0('0x5a')]['id']}})['then'](handleEntityNotFound(_0x21daa9,null))['then'](function(_0x58a303){if(_0x58a303){_0x2efdc9=_0x58a303[_0x5fb0('0x3c')]({'plain':!![]});_0x2bf2a8[_0x5fb0('0x4c')]=_[_0x5fb0('0x47')](db['UserChatQueue'][_0x5fb0('0x68')]);_0x2bf2a8[_0x5fb0('0x48')]=_['keys'](_0x13c236[_0x5fb0('0x48')]);_0x2bf2a8['filters']=_[_0x5fb0('0x4a')](_0x2bf2a8['model'],_0x2bf2a8[_0x5fb0('0x48')]);_0x5b5ae2[_0x5fb0('0x4b')]=_[_0x5fb0('0x4a')](_0x2bf2a8[_0x5fb0('0x4c')],qs[_0x5fb0('0x4d')](_0x13c236[_0x5fb0('0x48')][_0x5fb0('0x4d')]));_0x5b5ae2['attributes']=_0x5b5ae2[_0x5fb0('0x4b')]['length']?_0x5b5ae2[_0x5fb0('0x4b')]:_0x2bf2a8[_0x5fb0('0x4c')];if(!_0x13c236['query'][_0x5fb0('0x4e')]('nolimit')){_0x5b5ae2[_0x5fb0('0x34')]=qs[_0x5fb0('0x34')](_0x13c236[_0x5fb0('0x48')]['limit']);_0x5b5ae2['offset']=qs['offset'](_0x13c236[_0x5fb0('0x48')][_0x5fb0('0x32')]);}_0x5b5ae2[_0x5fb0('0x69')]=qs[_0x5fb0('0x6a')](_0x13c236['query'][_0x5fb0('0x6a')]);_0x5b5ae2[_0x5fb0('0x51')]=qs['filters'](_[_0x5fb0('0x6b')](_0x13c236[_0x5fb0('0x48')],_0x2bf2a8[_0x5fb0('0x49')]));_0x5b5ae2[_0x5fb0('0x51')]['ChatQueueId']=_0x58a303['id'];if(_0x13c236['query']['filter']){_0x5b5ae2[_0x5fb0('0x51')]=_[_0x5fb0('0x52')](_0x5b5ae2[_0x5fb0('0x51')],{'$or':_[_0x5fb0('0x43')](_0x5b5ae2['attributes'],function(_0x4683e6){var _0x1819ef={};_0x1819ef[_0x4683e6]={'$like':'%'+_0x13c236['query'][_0x5fb0('0x50')]+'%'};return _0x1819ef;})});}_0x5b5ae2=_[_0x5fb0('0x52')]({},_0x5b5ae2,_0x13c236[_0x5fb0('0x5c')]);return db[_0x5fb0('0x6c')][_0x5fb0('0x57')](_0x5b5ae2);}})['then'](function(_0x2855ec){if(_0x2855ec){return db[_0x5fb0('0x6d')][_0x5fb0('0x6e')]({'where':{'id':_[_0x5fb0('0x43')](_0x2855ec,_0x5fb0('0x6f')),'role':_0x5fb0('0x70')},'attributes':['id','name',_0x5fb0('0x71'),_0x5fb0('0x72'),_0x5fb0('0x73')]});}})[_0x5fb0('0x23')](function(_0x368b06){if(_0x368b06){return{'count':_0x368b06['count'],'rows':_['map'](_0x368b06[_0x5fb0('0x58')],function(_0x568922){return{'membername':_0x568922['name'],'UserId':_0x568922['id'],'queue_name':_0x2efdc9[_0x5fb0('0x41')],'ChatQueueId':_0x2efdc9['id'],'interface':util[_0x5fb0('0x74')](_0x5fb0('0x75'),_0x5fb0('0x76'),_0x568922[_0x5fb0('0x41')]),'penalty':0x0,'paused':_0x568922[_0x5fb0('0x71')],'createdAt':_0x568922[_0x5fb0('0x73')],'updatedAt':_0x568922[_0x5fb0('0x72')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5fb0('0x23')](respondWithFilteredResult(_0x21daa9,_0x5b5ae2))[_0x5fb0('0x2e')](handleError(_0x21daa9,null));};exports[_0x5fb0('0x77')]=function(_0x442a1c,_0x2387a8,_0xfe8ed1){var _0x316490={};var _0x33c859={};var _0x302744;var _0x5e94fd;return db[_0x5fb0('0x54')][_0x5fb0('0x67')]({'where':{'id':_0x442a1c[_0x5fb0('0x5a')]['id']}})[_0x5fb0('0x23')](handleEntityNotFound(_0x2387a8,null))[_0x5fb0('0x23')](function(_0x54df3b){if(_0x54df3b){_0x302744=_0x54df3b;_0x33c859[_0x5fb0('0x4c')]=_[_0x5fb0('0x47')](db['Team']['rawAttributes']);_0x33c859[_0x5fb0('0x48')]=_[_0x5fb0('0x47')](_0x442a1c[_0x5fb0('0x48')]);_0x33c859['filters']=_[_0x5fb0('0x4a')](_0x33c859[_0x5fb0('0x4c')],_0x33c859[_0x5fb0('0x48')]);_0x316490[_0x5fb0('0x4b')]=_[_0x5fb0('0x4a')](_0x33c859[_0x5fb0('0x4c')],qs[_0x5fb0('0x4d')](_0x442a1c[_0x5fb0('0x48')][_0x5fb0('0x4d')]));_0x316490[_0x5fb0('0x4b')]=_0x316490[_0x5fb0('0x4b')][_0x5fb0('0x5b')]?_0x316490[_0x5fb0('0x4b')]:_0x33c859[_0x5fb0('0x4c')];_0x316490['order']=qs[_0x5fb0('0x6a')](_0x442a1c[_0x5fb0('0x48')][_0x5fb0('0x6a')]);_0x316490[_0x5fb0('0x51')]=qs['filters'](_[_0x5fb0('0x6b')](_0x442a1c[_0x5fb0('0x48')],_0x33c859[_0x5fb0('0x49')]));if(_0x442a1c[_0x5fb0('0x48')]['filter']){_0x316490[_0x5fb0('0x51')]=_[_0x5fb0('0x52')](_0x316490[_0x5fb0('0x51')],{'$or':_[_0x5fb0('0x43')](_0x316490['attributes'],function(_0x5b64f8){var _0x3b75ac={};_0x3b75ac[_0x5b64f8]={'$like':'%'+_0x442a1c[_0x5fb0('0x48')][_0x5fb0('0x50')]+'%'};return _0x3b75ac;})});}_0x316490=_['merge']({},_0x316490,_0x442a1c[_0x5fb0('0x5c')]);return _0x302744[_0x5fb0('0x77')](_0x316490);}})[_0x5fb0('0x23')](function(_0x3864b9){if(_0x3864b9){_0x5e94fd=_0x3864b9[_0x5fb0('0x5b')];if(!_0x442a1c['query'][_0x5fb0('0x4e')]('nolimit')){_0x316490['limit']=qs['limit'](_0x442a1c[_0x5fb0('0x48')][_0x5fb0('0x34')]);_0x316490[_0x5fb0('0x32')]=qs[_0x5fb0('0x32')](_0x442a1c['query'][_0x5fb0('0x32')]);}return _0x302744['getTeams'](_0x316490);}})['then'](function(_0x188060){if(_0x188060){return _0x188060?{'count':_0x5e94fd,'rows':_0x188060}:null;}})[_0x5fb0('0x23')](respondWithResult(_0x2387a8,null))['catch'](handleError(_0x2387a8,null));};exports[_0x5fb0('0x78')]=function(_0x5ef128,_0x5b1e79,_0x5ba705){var _0x9a0a44=_0x5ef128[_0x5fb0('0x5f')][_0x5fb0('0x79')];return db[_0x5fb0('0x7a')][_0x5fb0('0x57')]({'where':{'id':_0x9a0a44},'attributes':['id'],'include':[{'model':db[_0x5fb0('0x6d')],'as':_0x5fb0('0x7b'),'attributes':['id','name','online',_0x5fb0('0x7c'),_0x5fb0('0x7d')],'raw':!![]}]})['then'](function(_0x124206){if(_0x124206){var _0x4d6bd9=_['flatMap'](_0x124206,function(_0x116ab9){var _0x12dd90=_0x116ab9[_0x5fb0('0x3c')]({'plain':!![]});return _0x12dd90[_0x5fb0('0x7b')];});return db[_0x5fb0('0x54')][_0x5fb0('0x5d')]({'where':{'id':_0x5ef128[_0x5fb0('0x5a')]['id']}})[_0x5fb0('0x23')](function(_0x53e8d8){return db[_0x5fb0('0x7e')]['transaction'](function(_0x1ed0e8){return _0x53e8d8['addTeams'](_0x9a0a44,{'transaction':_0x1ed0e8})[_0x5fb0('0x23')](function(){return BPromise['each'](_0x4d6bd9,function(_0x304b12){return db[_0x5fb0('0x6c')][_0x5fb0('0x7f')]({'where':{'UserId':_0x304b12['id'],'ChatQueueId':_0x5ef128[_0x5fb0('0x5a')]['id']},'transaction':_0x1ed0e8});});})['then'](function(){_0x4d6bd9[_0x5fb0('0x80')](function(_0x3e736e){socket[_0x5fb0('0x81')](_0x5fb0('0x82'),{'UserId':_0x3e736e['id'],'ChatQueueId':_0x53e8d8['id']});});});});});}})[_0x5fb0('0x23')](respondWithStatusCode(_0x5b1e79,null))[_0x5fb0('0x2e')](handleError(_0x5b1e79,null));};exports[_0x5fb0('0x83')]=function(_0x18d03d,_0x383c70,_0x53658e){return db['Team'][_0x5fb0('0x57')]({'where':{'id':_0x18d03d[_0x5fb0('0x48')][_0x5fb0('0x79')]},'attributes':['id'],'include':[{'model':db[_0x5fb0('0x6d')],'as':_0x5fb0('0x7b'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x383c70,null))[_0x5fb0('0x23')](function(_0x154405){var _0x39474a=_[_0x5fb0('0x43')](_0x154405,'id');var _0x3c7d83=[];var _0x1b2c3b=[];var _0x541c87=squel['select']();_0x541c87[_0x5fb0('0x84')](_0x5fb0('0x85'))[_0x5fb0('0x86')](_0x5fb0('0x87'),'tq')[_0x5fb0('0x88')](_0x5fb0('0x89'),'ut',_0x5fb0('0x8a'))['where'](_0x5fb0('0x8b'),_0x18d03d[_0x5fb0('0x5a')]['id']);for(var _0x109c4c=0x0;_0x109c4c<_0x154405[_0x5fb0('0x5b')];_0x109c4c+=0x1){let _0x17eb76=_0x154405[_0x109c4c];for(var _0x23430d=0x0;_0x23430d<_0x17eb76[_0x5fb0('0x7b')]['length'];_0x23430d+=0x1){let _0x59da6c=_0x17eb76[_0x5fb0('0x7b')][_0x23430d];var _0xc2dd00=_0x541c87[_0x5fb0('0x8c')]();_0xc2dd00[_0x5fb0('0x51')]('ut.UserId\x20=\x20?',_0x59da6c['id']);_0x1b2c3b[_0x5fb0('0x8d')](db[_0x5fb0('0x7e')]['query'](_0xc2dd00[_0x5fb0('0x8e')](),{'type':db[_0x5fb0('0x7e')][_0x5fb0('0x8f')][_0x5fb0('0x90')]})['then'](function(_0x506314){if(_0x506314[_0x5fb0('0x5b')]===0x1){return _0x59da6c['id'];}else{var _0x42f07e=_[_0x5fb0('0x91')](_[_0x5fb0('0x43')](_0x506314,_0x5fb0('0x92')),function(_0x177b28){return _['includes'](_0x39474a,_0x177b28);});if(_0x42f07e){return _0x59da6c['id'];}}}));}}return BPromise['all'](_0x1b2c3b)[_0x5fb0('0x23')](function(_0x47152c){_0x3c7d83=_(_0x3c7d83)[_0x5fb0('0x93')](_0x47152c)[_0x5fb0('0x94')]()[_0x5fb0('0x95')]();return db['ChatQueue'][_0x5fb0('0x5d')]({'where':{'id':_0x18d03d['params']['id']}})[_0x5fb0('0x23')](function(_0x1efe8f){return db[_0x5fb0('0x7e')][_0x5fb0('0x96')](function(_0x2449a7){return _0x1efe8f['removeTeams'](_0x18d03d[_0x5fb0('0x48')][_0x5fb0('0x79')],{'transaction':_0x2449a7})['then'](function(){if(!_[_0x5fb0('0x97')](_0x3c7d83)){return _0x1efe8f[_0x5fb0('0x98')](_0x3c7d83,{'transaction':_0x2449a7});}})[_0x5fb0('0x23')](function(){_0x3c7d83[_0x5fb0('0x80')](function(_0x2d919a){socket[_0x5fb0('0x81')]('userChatQueue:remove',{'UserId':_0x2d919a,'ChatQueueId':_0x1efe8f['id']});});});});});});})['then'](respondWithStatusCode(_0x383c70,null))[_0x5fb0('0x2e')](handleError(_0x383c70,null));};exports[_0x5fb0('0x99')]=function(_0x406c7b,_0x14c57c,_0x37d66d){return db[_0x5fb0('0x54')][_0x5fb0('0x5d')]({'where':{'id':_0x406c7b[_0x5fb0('0x5a')]['id']}})[_0x5fb0('0x23')](handleEntityNotFound(_0x14c57c,null))[_0x5fb0('0x23')](function(_0x587ab2){if(_0x587ab2){return _0x587ab2[_0x5fb0('0x99')](_0x406c7b[_0x5fb0('0x5f')]['ids'],_['omit'](_0x406c7b[_0x5fb0('0x5f')],['ids','id'])||{})[_0x5fb0('0x9a')](function(_0x573e17){for(var _0x3edc18=0x0;_0x3edc18<_0x406c7b[_0x5fb0('0x5f')][_0x5fb0('0x79')][_0x5fb0('0x5b')];_0x3edc18+=0x1){socket[_0x5fb0('0x81')](_0x5fb0('0x82'),{'UserId':Number(_0x406c7b[_0x5fb0('0x5f')][_0x5fb0('0x79')][_0x3edc18]),'ChatQueueId':Number(_0x406c7b['params']['id'])});}return _0x573e17;});}})[_0x5fb0('0x23')](respondWithResult(_0x14c57c,null))[_0x5fb0('0x2e')](handleError(_0x14c57c,null));};exports[_0x5fb0('0x98')]=function(_0x78102b,_0x40d77e,_0x4437dc){return db[_0x5fb0('0x54')][_0x5fb0('0x5d')]({'where':{'id':_0x78102b['params']['id']}})[_0x5fb0('0x23')](handleEntityNotFound(_0x40d77e,null))[_0x5fb0('0x23')](function(_0x4b5a34){if(_0x4b5a34){return _0x4b5a34[_0x5fb0('0x98')](_0x78102b['query'][_0x5fb0('0x79')])[_0x5fb0('0x23')](function(){if(_[_0x5fb0('0x9b')](_0x78102b[_0x5fb0('0x48')][_0x5fb0('0x79')])){for(var _0x16abf4=0x0;_0x16abf4<_0x78102b[_0x5fb0('0x48')][_0x5fb0('0x79')][_0x5fb0('0x5b')];_0x16abf4+=0x1){socket['emit'](_0x5fb0('0x9c'),{'UserId':Number(_0x78102b[_0x5fb0('0x48')][_0x5fb0('0x79')][_0x16abf4]),'ChatQueueId':Number(_0x78102b['params']['id'])});}}else{socket['emit'](_0x5fb0('0x9c'),{'UserId':Number(_0x78102b['query'][_0x5fb0('0x79')]),'ChatQueueId':Number(_0x78102b[_0x5fb0('0x5a')]['id'])});}});}})[_0x5fb0('0x23')](respondWithStatusCode(_0x40d77e,null))[_0x5fb0('0x2e')](handleError(_0x40d77e,null));};exports[_0x5fb0('0x9d')]=function(_0x169d4c,_0x1dc4d8,_0x5a82a4){var _0x497538={};var _0x5a90fd={};var _0x1de1d9;var _0x2f26b3;return db['ChatQueue'][_0x5fb0('0x67')]({'where':{'id':_0x169d4c['params']['id']}})[_0x5fb0('0x23')](handleEntityNotFound(_0x1dc4d8,null))[_0x5fb0('0x23')](function(_0x5aa335){if(_0x5aa335){_0x1de1d9=_0x5aa335;_0x5a90fd[_0x5fb0('0x4c')]=_[_0x5fb0('0x47')](db['User'][_0x5fb0('0x68')]);_0x5a90fd[_0x5fb0('0x48')]=_[_0x5fb0('0x47')](_0x169d4c[_0x5fb0('0x48')]);_0x5a90fd[_0x5fb0('0x49')]=_['intersection'](_0x5a90fd[_0x5fb0('0x4c')],_0x5a90fd['query']);_0x497538[_0x5fb0('0x4b')]=_['intersection'](_0x5a90fd['model'],qs[_0x5fb0('0x4d')](_0x169d4c['query']['fields']));_0x497538[_0x5fb0('0x4b')]=_0x497538[_0x5fb0('0x4b')][_0x5fb0('0x5b')]?_0x497538[_0x5fb0('0x4b')]:_0x5a90fd[_0x5fb0('0x4c')];_0x497538[_0x5fb0('0x69')]=qs[_0x5fb0('0x6a')](_0x169d4c[_0x5fb0('0x48')]['sort']);_0x497538[_0x5fb0('0x51')]=qs['filters'](_[_0x5fb0('0x6b')](_0x169d4c[_0x5fb0('0x48')],_0x5a90fd[_0x5fb0('0x49')]));if(_0x169d4c[_0x5fb0('0x48')][_0x5fb0('0x50')]){_0x497538[_0x5fb0('0x51')]=_[_0x5fb0('0x52')](_0x497538[_0x5fb0('0x51')],{'$or':_[_0x5fb0('0x43')](_0x497538[_0x5fb0('0x4b')],function(_0x4606fc){var _0x29f5e3={};_0x29f5e3[_0x4606fc]={'$like':'%'+_0x169d4c[_0x5fb0('0x48')][_0x5fb0('0x50')]+'%'};return _0x29f5e3;})});}_0x497538=_[_0x5fb0('0x52')]({},_0x497538,_0x169d4c[_0x5fb0('0x5c')]);return _0x1de1d9[_0x5fb0('0x9d')](_0x497538);}})[_0x5fb0('0x23')](function(_0x2beab2){if(_0x2beab2){_0x2f26b3=_0x2beab2[_0x5fb0('0x5b')];if(!_0x169d4c[_0x5fb0('0x48')][_0x5fb0('0x4e')](_0x5fb0('0x4f'))){_0x497538[_0x5fb0('0x34')]=qs['limit'](_0x169d4c[_0x5fb0('0x48')][_0x5fb0('0x34')]);_0x497538['offset']=qs[_0x5fb0('0x32')](_0x169d4c[_0x5fb0('0x48')][_0x5fb0('0x32')]);}return _0x1de1d9[_0x5fb0('0x9d')](_0x497538);}})[_0x5fb0('0x23')](function(_0x49c7b2){if(_0x49c7b2){return _0x49c7b2?{'count':_0x2f26b3,'rows':_0x49c7b2}:null;}})[_0x5fb0('0x23')](respondWithResult(_0x1dc4d8,null))[_0x5fb0('0x2e')](handleError(_0x1dc4d8,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 81ce422..5927aa9 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 _0x474f=['exports','events','ChatQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x3acee8,_0x5f3924){var _0x5046cc=function(_0x338def){while(--_0x338def){_0x3acee8['push'](_0x3acee8['shift']());}};_0x5046cc(++_0x5f3924);}(_0x474f,0xac));var _0xf474=function(_0x5725a0,_0x180d50){_0x5725a0=_0x5725a0-0x0;var _0x2eade4=_0x474f[_0x5725a0];return _0x2eade4;};'use strict';var EventEmitter=require(_0xf474('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xf474('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xf474('0x2')](0x0);var events={'afterCreate':_0xf474('0x3'),'afterUpdate':_0xf474('0x4'),'afterDestroy':'remove'};function emitEvent(_0x509648){return function(_0x80bdac,_0x27fd05,_0x21e07f){ChatQueueEvents[_0xf474('0x5')](_0x509648+':'+_0x80bdac['id'],_0x80bdac);ChatQueueEvents[_0xf474('0x5')](_0x509648,_0x80bdac);_0x21e07f(null);};}for(var e in events){if(events[_0xf474('0x6')](e)){var event=events[e];ChatQueue[_0xf474('0x7')](e,emitEvent(event));}}module[_0xf474('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0x293a=['events','ChatQueue','setMaxListeners','save','update','emit','hook','exports'];(function(_0x2cd0d8,_0x4fc59f){var _0x3c2198=function(_0x381b47){while(--_0x381b47){_0x2cd0d8['push'](_0x2cd0d8['shift']());}};_0x3c2198(++_0x4fc59f);}(_0x293a,0xc0));var _0xa293=function(_0x28762c,_0x2625e7){_0x28762c=_0x28762c-0x0;var _0x441a0b=_0x293a[_0x28762c];return _0x441a0b;};'use strict';var EventEmitter=require(_0xa293('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xa293('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xa293('0x2')](0x0);var events={'afterCreate':_0xa293('0x3'),'afterUpdate':_0xa293('0x4'),'afterDestroy':'remove'};function emitEvent(_0x336c64){return function(_0x2a1474,_0x4271cd,_0x15eda9){ChatQueueEvents[_0xa293('0x5')](_0x336c64+':'+_0x2a1474['id'],_0x2a1474);ChatQueueEvents[_0xa293('0x5')](_0x336c64,_0x2a1474);_0x15eda9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0xa293('0x6')](e,emitEvent(event));}}module[_0xa293('0x7')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index e978a0a..84e250b 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 _0x15f5=['chat_queues','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./chatQueue.attributes','exports','ChatQueue'];(function(_0x4d1875,_0x5041fb){var _0x4f8f5c=function(_0x2ec54c){while(--_0x2ec54c){_0x4d1875['push'](_0x4d1875['shift']());}};_0x4f8f5c(++_0x5041fb);}(_0x15f5,0xbc));var _0x515f=function(_0x5b78e3,_0x3c5de6){_0x5b78e3=_0x5b78e3-0x0;var _0x55ff10=_0x15f5[_0x5b78e3];return _0x55ff10;};'use strict';var _=require(_0x515f('0x0'));var util=require(_0x515f('0x1'));var logger=require('../../config/logger')(_0x515f('0x2'));var moment=require('moment');var BPromise=require(_0x515f('0x3'));var rp=require(_0x515f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x515f('0x5'));var config=require(_0x515f('0x6'));var attributes=require(_0x515f('0x7'));module[_0x515f('0x8')]=function(_0x240f83,_0x27f22d){return _0x240f83['define'](_0x515f('0x9'),attributes,{'tableName':_0x515f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c53=['rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4c53,0x1c9));var _0x34c5=function(_0x3f7de7,_0x3d6dda){_0x3f7de7=_0x3f7de7-0x0;var _0x5c5652=_0x4c53[_0x3f7de7];return _0x5c5652;};'use strict';var _=require(_0x34c5('0x0'));var util=require(_0x34c5('0x1'));var logger=require(_0x34c5('0x2'))(_0x34c5('0x3'));var moment=require(_0x34c5('0x4'));var BPromise=require(_0x34c5('0x5'));var rp=require(_0x34c5('0x6'));var fs=require('fs');var path=require(_0x34c5('0x7'));var rimraf=require(_0x34c5('0x8'));var config=require(_0x34c5('0x9'));var attributes=require(_0x34c5('0xa'));module[_0x34c5('0xb')]=function(_0x233eb3,_0x35599c){return _0x233eb3[_0x34c5('0xc')](_0x34c5('0xd'),attributes,{'tableName':_0x34c5('0xe'),'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 dbc3675..644e14c 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 _0xc8ac=['./chatQueue.socket','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetChatQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowChatQueue','find','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults'];(function(_0xb2c134,_0x3eca93){var _0x120bac=function(_0x261e15){while(--_0x261e15){_0xb2c134['push'](_0xb2c134['shift']());}};_0x120bac(++_0x3eca93);}(_0xc8ac,0xe9));var _0xcc8a=function(_0x184759,_0x1cc38a){_0x184759=_0x184759-0x0;var _0xf26d5f=_0xc8ac[_0x184759];return _0xf26d5f;};'use strict';var _=require(_0xcc8a('0x0'));var util=require(_0xcc8a('0x1'));var moment=require(_0xcc8a('0x2'));var BPromise=require(_0xcc8a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcc8a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcc8a('0x5'));var logger=require(_0xcc8a('0x6'))(_0xcc8a('0x7'));var config=require(_0xcc8a('0x8'));var jayson=require(_0xcc8a('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xcc8a('0xa')]=_[_0xcc8a('0xb')](config[_0xcc8a('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcc8a('0xa')]));require(_0xcc8a('0xc'))['register'](socket);function respondWithRpcPromise(_0x3fa245,_0x34f02f,_0x510c1d){return new BPromise(function(_0x2c5025,_0x4e175e){return client['request'](_0x3fa245,_0x510c1d)[_0xcc8a('0xd')](function(_0x186896){logger[_0xcc8a('0xe')](_0xcc8a('0xf'),_0x34f02f,_0xcc8a('0x10'));logger[_0xcc8a('0x11')](_0xcc8a('0x12'),_0x34f02f,_0xcc8a('0x10'),JSON[_0xcc8a('0x13')](_0x186896));if(_0x186896[_0xcc8a('0x14')]){if(_0x186896[_0xcc8a('0x14')]['code']===0x1f4){logger[_0xcc8a('0x14')](_0xcc8a('0xf'),_0x34f02f,_0x186896[_0xcc8a('0x14')][_0xcc8a('0x15')]);return _0x4e175e(_0x186896[_0xcc8a('0x14')][_0xcc8a('0x15')]);}logger['error'](_0xcc8a('0xf'),_0x34f02f,_0x186896[_0xcc8a('0x14')][_0xcc8a('0x15')]);return _0x2c5025(_0x186896[_0xcc8a('0x14')][_0xcc8a('0x15')]);}else{logger[_0xcc8a('0xe')](_0xcc8a('0xf'),_0x34f02f,'request\x20sent');_0x2c5025(_0x186896['result'][_0xcc8a('0x15')]);}})[_0xcc8a('0x16')](function(_0x20c29f){logger[_0xcc8a('0x14')]('ChatQueue,\x20%s,\x20%s',_0x34f02f,_0x20c29f);_0x4e175e(_0x20c29f);});});}exports[_0xcc8a('0x17')]=function(_0x4dad7b){var _0x471f1d=this;return new Promise(function(_0x3a2e3d,_0xa76ad9){return db['ChatQueue'][_0xcc8a('0x18')]({'raw':_0x4dad7b[_0xcc8a('0x19')]?_0x4dad7b['options'][_0xcc8a('0x1a')]===undefined?!![]:![]:!![],'where':_0x4dad7b[_0xcc8a('0x19')]?_0x4dad7b[_0xcc8a('0x19')][_0xcc8a('0x1b')]||null:null,'attributes':_0x4dad7b[_0xcc8a('0x19')]?_0x4dad7b['options'][_0xcc8a('0x1c')]||null:null,'limit':_0x4dad7b[_0xcc8a('0x19')]?_0x4dad7b['options'][_0xcc8a('0x1d')]||null:null,'include':_0x4dad7b[_0xcc8a('0x19')]?_0x4dad7b['options'][_0xcc8a('0x1e')]?_[_0xcc8a('0x1f')](_0x4dad7b[_0xcc8a('0x19')][_0xcc8a('0x1e')],function(_0x221841){return{'model':db[_0x221841[_0xcc8a('0x20')]],'as':_0x221841['as'],'attributes':_0x221841[_0xcc8a('0x1c')],'include':_0x221841[_0xcc8a('0x1e')]?_[_0xcc8a('0x1f')](_0x221841[_0xcc8a('0x1e')],function(_0x338351){return{'model':db[_0x338351[_0xcc8a('0x20')]],'as':_0x338351['as'],'attributes':_0x338351['attributes'],'include':_0x338351[_0xcc8a('0x1e')]?_[_0xcc8a('0x1f')](_0x338351['include'],function(_0x41271f){return{'model':db[_0x41271f[_0xcc8a('0x20')]],'as':_0x41271f['as'],'attributes':_0x41271f[_0xcc8a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xcc8a('0xd')](function(_0x581ae8){logger[_0xcc8a('0xe')](_0xcc8a('0x17'),_0x4dad7b);logger[_0xcc8a('0x11')](_0xcc8a('0x17'),_0x4dad7b,JSON[_0xcc8a('0x13')](_0x581ae8));_0x3a2e3d(_0x581ae8);})[_0xcc8a('0x16')](function(_0x2a877f){logger[_0xcc8a('0x14')]('GetChatQueue',_0x2a877f['message'],_0x4dad7b);_0xa76ad9(_0x471f1d[_0xcc8a('0x14')](0x1f4,_0x2a877f['message']));});});};exports[_0xcc8a('0x21')]=function(_0x3629c1){var _0x59ff46=this;return new Promise(function(_0x14dbee,_0x5c19b0){return db['ChatQueue'][_0xcc8a('0x22')]({'raw':_0x3629c1[_0xcc8a('0x19')]?_0x3629c1[_0xcc8a('0x19')][_0xcc8a('0x1a')]===undefined?!![]:![]:!![],'where':_0x3629c1['options']?_0x3629c1['options'][_0xcc8a('0x1b')]||null:null,'attributes':_0x3629c1[_0xcc8a('0x19')]?_0x3629c1[_0xcc8a('0x19')][_0xcc8a('0x1c')]||null:null,'include':_0x3629c1[_0xcc8a('0x19')]?_0x3629c1[_0xcc8a('0x19')][_0xcc8a('0x1e')]?_[_0xcc8a('0x1f')](_0x3629c1[_0xcc8a('0x19')][_0xcc8a('0x1e')],function(_0x36125f){return{'model':db[_0x36125f[_0xcc8a('0x20')]],'as':_0x36125f['as'],'attributes':_0x36125f['attributes'],'include':_0x36125f[_0xcc8a('0x1e')]?_[_0xcc8a('0x1f')](_0x36125f[_0xcc8a('0x1e')],function(_0x5df806){return{'model':db[_0x5df806[_0xcc8a('0x20')]],'as':_0x5df806['as'],'attributes':_0x5df806['attributes'],'include':_0x5df806['include']?_[_0xcc8a('0x1f')](_0x5df806['include'],function(_0x46a22d){return{'model':db[_0x46a22d[_0xcc8a('0x20')]],'as':_0x46a22d['as'],'attributes':_0x46a22d[_0xcc8a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xcc8a('0xd')](function(_0x20390c){logger['info'](_0xcc8a('0x21'),_0x3629c1);logger[_0xcc8a('0x11')](_0xcc8a('0x21'),_0x3629c1,JSON[_0xcc8a('0x13')](_0x20390c));_0x14dbee(_0x20390c);})['catch'](function(_0x5e1174){logger[_0xcc8a('0x14')]('ShowChatQueue',_0x5e1174['message'],_0x3629c1);_0x5c19b0(_0x59ff46['error'](0x1f4,_0x5e1174['message']));});});}; \ No newline at end of file +var _0x48bc=['raw','attributes','limit','include','map','model','GetChatQueue','ShowChatQueue','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','./chatQueue.socket','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ChatQueue','findAll','options'];(function(_0x3203a1,_0x46c498){var _0x24215e=function(_0x4ffab0){while(--_0x4ffab0){_0x3203a1['push'](_0x3203a1['shift']());}};_0x24215e(++_0x46c498);}(_0x48bc,0x1b6));var _0xc48b=function(_0x38ddec,_0x2ed54a){_0x38ddec=_0x38ddec-0x0;var _0x4bbfe=_0x48bc[_0x38ddec];return _0x4bbfe;};'use strict';var _=require(_0xc48b('0x0'));var util=require(_0xc48b('0x1'));var moment=require(_0xc48b('0x2'));var BPromise=require('bluebird');var rs=require(_0xc48b('0x3'));var fs=require('fs');var Redis=require(_0xc48b('0x4'));var db=require(_0xc48b('0x5'))['db'];var utils=require(_0xc48b('0x6'));var logger=require(_0xc48b('0x7'))(_0xc48b('0x8'));var config=require(_0xc48b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc48b('0xa')]['http']({'port':0x232a});config[_0xc48b('0xb')]=_[_0xc48b('0xc')](config['redis'],{'host':_0xc48b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc48b('0xb')]));require(_0xc48b('0xe'))['register'](socket);function respondWithRpcPromise(_0x2c0429,_0x3fcb54,_0xdea695){return new BPromise(function(_0x441e2c,_0x111e61){return client[_0xc48b('0xf')](_0x2c0429,_0xdea695)[_0xc48b('0x10')](function(_0x2fd6c7){logger[_0xc48b('0x11')](_0xc48b('0x12'),_0x3fcb54,_0xc48b('0x13'));logger[_0xc48b('0x14')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x3fcb54,_0xc48b('0x13'),JSON[_0xc48b('0x15')](_0x2fd6c7));if(_0x2fd6c7[_0xc48b('0x16')]){if(_0x2fd6c7['error'][_0xc48b('0x17')]===0x1f4){logger[_0xc48b('0x16')](_0xc48b('0x12'),_0x3fcb54,_0x2fd6c7[_0xc48b('0x16')][_0xc48b('0x18')]);return _0x111e61(_0x2fd6c7[_0xc48b('0x16')][_0xc48b('0x18')]);}logger[_0xc48b('0x16')]('ChatQueue,\x20%s,\x20%s',_0x3fcb54,_0x2fd6c7[_0xc48b('0x16')]['message']);return _0x441e2c(_0x2fd6c7['error'][_0xc48b('0x18')]);}else{logger['info'](_0xc48b('0x12'),_0x3fcb54,'request\x20sent');_0x441e2c(_0x2fd6c7[_0xc48b('0x19')]['message']);}})[_0xc48b('0x1a')](function(_0x3bfd75){logger[_0xc48b('0x16')]('ChatQueue,\x20%s,\x20%s',_0x3fcb54,_0x3bfd75);_0x111e61(_0x3bfd75);});});}exports['GetChatQueue']=function(_0x12b34f){var _0x4a2997=this;return new Promise(function(_0x1c139c,_0x104a2f){return db[_0xc48b('0x1b')][_0xc48b('0x1c')]({'raw':_0x12b34f[_0xc48b('0x1d')]?_0x12b34f[_0xc48b('0x1d')][_0xc48b('0x1e')]===undefined?!![]:![]:!![],'where':_0x12b34f[_0xc48b('0x1d')]?_0x12b34f[_0xc48b('0x1d')]['where']||null:null,'attributes':_0x12b34f[_0xc48b('0x1d')]?_0x12b34f[_0xc48b('0x1d')][_0xc48b('0x1f')]||null:null,'limit':_0x12b34f[_0xc48b('0x1d')]?_0x12b34f[_0xc48b('0x1d')][_0xc48b('0x20')]||null:null,'include':_0x12b34f[_0xc48b('0x1d')]?_0x12b34f[_0xc48b('0x1d')][_0xc48b('0x21')]?_[_0xc48b('0x22')](_0x12b34f[_0xc48b('0x1d')][_0xc48b('0x21')],function(_0x4a6a22){return{'model':db[_0x4a6a22[_0xc48b('0x23')]],'as':_0x4a6a22['as'],'attributes':_0x4a6a22[_0xc48b('0x1f')],'include':_0x4a6a22[_0xc48b('0x21')]?_[_0xc48b('0x22')](_0x4a6a22[_0xc48b('0x21')],function(_0x2b53a3){return{'model':db[_0x2b53a3[_0xc48b('0x23')]],'as':_0x2b53a3['as'],'attributes':_0x2b53a3['attributes'],'include':_0x2b53a3[_0xc48b('0x21')]?_['map'](_0x2b53a3['include'],function(_0x49916e){return{'model':db[_0x49916e[_0xc48b('0x23')]],'as':_0x49916e['as'],'attributes':_0x49916e[_0xc48b('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc48b('0x10')](function(_0x3a65eb){logger[_0xc48b('0x11')]('GetChatQueue',_0x12b34f);logger['debug'](_0xc48b('0x24'),_0x12b34f,JSON[_0xc48b('0x15')](_0x3a65eb));_0x1c139c(_0x3a65eb);})['catch'](function(_0x31eaa0){logger[_0xc48b('0x16')](_0xc48b('0x24'),_0x31eaa0[_0xc48b('0x18')],_0x12b34f);_0x104a2f(_0x4a2997[_0xc48b('0x16')](0x1f4,_0x31eaa0[_0xc48b('0x18')]));});});};exports[_0xc48b('0x25')]=function(_0x72fe6e){var _0x2e82e5=this;return new Promise(function(_0x53735e,_0xc46482){return db[_0xc48b('0x1b')][_0xc48b('0x26')]({'raw':_0x72fe6e[_0xc48b('0x1d')]?_0x72fe6e[_0xc48b('0x1d')][_0xc48b('0x1e')]===undefined?!![]:![]:!![],'where':_0x72fe6e[_0xc48b('0x1d')]?_0x72fe6e[_0xc48b('0x1d')]['where']||null:null,'attributes':_0x72fe6e[_0xc48b('0x1d')]?_0x72fe6e[_0xc48b('0x1d')][_0xc48b('0x1f')]||null:null,'include':_0x72fe6e['options']?_0x72fe6e['options'][_0xc48b('0x21')]?_[_0xc48b('0x22')](_0x72fe6e[_0xc48b('0x1d')][_0xc48b('0x21')],function(_0x4ec91a){return{'model':db[_0x4ec91a[_0xc48b('0x23')]],'as':_0x4ec91a['as'],'attributes':_0x4ec91a[_0xc48b('0x1f')],'include':_0x4ec91a[_0xc48b('0x21')]?_[_0xc48b('0x22')](_0x4ec91a[_0xc48b('0x21')],function(_0x591b4f){return{'model':db[_0x591b4f[_0xc48b('0x23')]],'as':_0x591b4f['as'],'attributes':_0x591b4f['attributes'],'include':_0x591b4f[_0xc48b('0x21')]?_[_0xc48b('0x22')](_0x591b4f[_0xc48b('0x21')],function(_0x513b99){return{'model':db[_0x513b99[_0xc48b('0x23')]],'as':_0x513b99['as'],'attributes':_0x513b99[_0xc48b('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc48b('0x10')](function(_0x35d211){logger[_0xc48b('0x11')](_0xc48b('0x25'),_0x72fe6e);logger[_0xc48b('0x14')](_0xc48b('0x25'),_0x72fe6e,JSON['stringify'](_0x35d211));_0x53735e(_0x35d211);})[_0xc48b('0x1a')](function(_0x378b6f){logger[_0xc48b('0x16')](_0xc48b('0x25'),_0x378b6f[_0xc48b('0x18')],_0x72fe6e);_0xc46482(_0x2e82e5[_0xc48b('0x16')](0x1f4,_0x378b6f['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index c78c1e2..01ca4a4 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 _0x1cc7=['remove','emit','length','chatQueue:','./chatQueue.events','save'];(function(_0x44f773,_0xcb2147){var _0x517341=function(_0x3dbb3f){while(--_0x3dbb3f){_0x44f773['push'](_0x44f773['shift']());}};_0x517341(++_0xcb2147);}(_0x1cc7,0x15a));var _0x71cc=function(_0x25b189,_0x566220){_0x25b189=_0x25b189-0x0;var _0x4f0763=_0x1cc7[_0x25b189];return _0x4f0763;};'use strict';var ChatQueueEvents=require(_0x71cc('0x0'));var events=[_0x71cc('0x1'),_0x71cc('0x2'),'update'];function createListener(_0x4db9cd,_0x547fe6){return function(_0xe5d54e){_0x547fe6[_0x71cc('0x3')](_0x4db9cd,_0xe5d54e);};}function removeListener(_0x402191,_0x5431e1){return function(){ChatQueueEvents['removeListener'](_0x402191,_0x5431e1);};}exports['register']=function(_0x27a175){for(var _0x4ecf81=0x0,_0xc0444e=events[_0x71cc('0x4')];_0x4ecf81<_0xc0444e;_0x4ecf81++){var _0x4039ce=events[_0x4ecf81];var _0x2e70f0=createListener(_0x71cc('0x5')+_0x4039ce,_0x27a175);ChatQueueEvents['on'](_0x4039ce,_0x2e70f0);}}; \ No newline at end of file +var _0x0ba7=['emit','removeListener','register','length','chatQueue:','./chatQueue.events','remove','update'];(function(_0x287677,_0x1ec76e){var _0xb540eb=function(_0x243ea9){while(--_0x243ea9){_0x287677['push'](_0x287677['shift']());}};_0xb540eb(++_0x1ec76e);}(_0x0ba7,0x16d));var _0x70ba=function(_0x172dc2,_0x3eaa59){_0x172dc2=_0x172dc2-0x0;var _0x1dc2bc=_0x0ba7[_0x172dc2];return _0x1dc2bc;};'use strict';var ChatQueueEvents=require(_0x70ba('0x0'));var events=['save',_0x70ba('0x1'),_0x70ba('0x2')];function createListener(_0xadfc69,_0x42d93c){return function(_0x5e5368){_0x42d93c[_0x70ba('0x3')](_0xadfc69,_0x5e5368);};}function removeListener(_0x3e20ab,_0x3cb2e3){return function(){ChatQueueEvents[_0x70ba('0x4')](_0x3e20ab,_0x3cb2e3);};}exports[_0x70ba('0x5')]=function(_0x3f9877){for(var _0x17a00c=0x0,_0x2d5a16=events[_0x70ba('0x6')];_0x17a00c<_0x2d5a16;_0x17a00c++){var _0x1185cb=events[_0x17a00c];var _0x1a968b=createListener(_0x70ba('0x7')+_0x1185cb,_0x3f9877);ChatQueueEvents['on'](_0x1185cb,_0x1a968b);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 8741f69..814c9ac 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['/describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','express','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','index'];(function(_0x321d22,_0x350ec3){var _0x3d360c=function(_0x1b0b1b){while(--_0x1b0b1b){_0x321d22['push'](_0x321d22['shift']());}};_0x3d360c(++_0x350ec3);}(_0xe14b,0x93));var _0xbe14=function(_0x2a5ac2,_0x36db10){_0x2a5ac2=_0x2a5ac2-0x0;var _0x25c649=_0xe14b[_0x2a5ac2];return _0x25c649;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x10')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x10')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x12')]);router[_0xbe14('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x13')]);router[_0xbe14('0x14')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0x16')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x16')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeTeams']);router[_0xbe14('0x16')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);module[_0xbe14('0x19')]=router; \ No newline at end of file +var _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(_0x326cb7,_0x3d8ee7){var _0x27788f=function(_0x53d408){while(--_0x53d408){_0x326cb7['push'](_0x326cb7['shift']());}};_0x27788f(++_0x3d8ee7);}(_0x008c,0x188));var _0xc008=function(_0x21c8a9,_0x5687f4){_0x21c8a9=_0x21c8a9-0x0;var _0x1f8a72=_0x008c[_0x21c8a9];return _0x1f8a72;};'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 84f44e5..73896bf 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 _0xfcd2=['DATE','exports','STRING'];(function(_0x4cf23f,_0x99878d){var _0x1ee7cd=function(_0x44c804){while(--_0x44c804){_0x4cf23f['push'](_0x4cf23f['shift']());}};_0x1ee7cd(++_0x99878d);}(_0xfcd2,0x1d8));var _0x2fcd=function(_0x33db4b,_0x1d8a35){_0x33db4b=_0x33db4b-0x0;var _0x1ad559=_0xfcd2[_0x33db4b];return _0x1ad559;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x2fcd('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x2fcd('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x2fcd('0x2')]},'exitAt':{'type':Sequelize[_0x2fcd('0x2')]},'reason':{'type':Sequelize[_0x2fcd('0x1')]}}; \ No newline at end of file +var _0xcb36=['DATE','moment','sequelize','STRING'];(function(_0x2042b6,_0x511b0e){var _0x5519b7=function(_0x3792ea){while(--_0x3792ea){_0x2042b6['push'](_0x2042b6['shift']());}};_0x5519b7(++_0x511b0e);}(_0xcb36,0xe9));var _0x6cb3=function(_0x1ce89b,_0x41133a){_0x1ce89b=_0x1ce89b-0x0;var _0x355bc9=_0xcb36[_0x1ce89b];return _0x355bc9;};'use strict';var moment=require(_0x6cb3('0x0'));var Sequelize=require(_0x6cb3('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x6cb3('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x6cb3('0x3')]},'acceptAt':{'type':Sequelize[_0x6cb3('0x3')]},'exitAt':{'type':Sequelize[_0x6cb3('0x3')]},'reason':{'type':Sequelize[_0x6cb3('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 4ce16d5..d327b59 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 _0xbd0e=['VIRTUAL','options','ChatQueueReport','findAll','rows','catch','show','keys','rawAttributes','fields','include','find','create','body','params','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','then','end','stack','name','send','fieldName','type','key','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x43d16c,_0x2b5447){var _0x208cce=function(_0x371720){while(--_0x371720){_0x43d16c['push'](_0x43d16c['shift']());}};_0x208cce(++_0x2b5447);}(_0xbd0e,0x187));var _0xebd0=function(_0x149ca0,_0x2ac7f5){_0x149ca0=_0x149ca0-0x0;var _0x56b6b9=_0xbd0e[_0x149ca0];return _0x56b6b9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xebd0('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xebd0('0x1'));var rp=require(_0xebd0('0x2'));var moment=require(_0xebd0('0x3'));var BPromise=require(_0xebd0('0x4'));var Mustache=require(_0xebd0('0x5'));var util=require(_0xebd0('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xebd0('0x7'));var ejs=require(_0xebd0('0x8'));var fs=require('fs');var fs_extra=require(_0xebd0('0x9'));var _=require(_0xebd0('0xa'));var squel=require(_0xebd0('0xb'));var crypto=require(_0xebd0('0xc'));var jsforce=require(_0xebd0('0xd'));var deskjs=require(_0xebd0('0xe'));var toCsv=require(_0xebd0('0x7'));var querystring=require('querystring');var Papa=require(_0xebd0('0xf'));var Redis=require(_0xebd0('0x10'));var authService=require(_0xebd0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xebd0('0x12'));var hardwareService=require(_0xebd0('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xebd0('0x14'));var config=require(_0xebd0('0x15'));var licenseUtil=require(_0xebd0('0x16'));var db=require(_0xebd0('0x17'))['db'];function respondWithStatusCode(_0xfbd0b7,_0x562df3){_0x562df3=_0x562df3||0xcc;return function(_0x464387){if(_0x464387){return _0xfbd0b7[_0xebd0('0x18')](_0x562df3);}return _0xfbd0b7[_0xebd0('0x19')](_0x562df3)['end']();};}function respondWithResult(_0x298300,_0x22c014){_0x22c014=_0x22c014||0xc8;return function(_0x3ad9ac){if(_0x3ad9ac){return _0x298300[_0xebd0('0x19')](_0x22c014)[_0xebd0('0x1a')](_0x3ad9ac);}};}function respondWithFilteredResult(_0x406cff,_0x2bf066){return function(_0x44822c){if(_0x44822c){var _0x25097c=typeof _0x2bf066[_0xebd0('0x1b')]===_0xebd0('0x1c')&&typeof _0x2bf066[_0xebd0('0x1d')]===_0xebd0('0x1c');var _0x20244d=_0x44822c[_0xebd0('0x1e')];var _0x4791b2=_0x25097c?0x0:_0x2bf066[_0xebd0('0x1b')];var _0x40b14d=_0x25097c?_0x44822c[_0xebd0('0x1e')]:_0x2bf066[_0xebd0('0x1b')]+_0x2bf066['limit'];var _0x37eff9;if(_0x40b14d>=_0x20244d){_0x40b14d=_0x20244d;_0x37eff9=0xc8;}else{_0x37eff9=0xce;}_0x406cff[_0xebd0('0x19')](_0x37eff9);return _0x406cff['set'](_0xebd0('0x1f'),_0x4791b2+'-'+_0x40b14d+'/'+_0x20244d)['json'](_0x44822c);}return null;};}function patchUpdates(_0x4720d5){return function(_0x197b2f){try{jsonpatch[_0xebd0('0x20')](_0x197b2f,_0x4720d5,!![]);}catch(_0x1827ae){return BPromise['reject'](_0x1827ae);}return _0x197b2f[_0xebd0('0x21')]();};}function saveUpdates(_0x4ad73a,_0x2970e7){return function(_0x2d2639){if(_0x2d2639){return _0x2d2639[_0xebd0('0x22')](_0x4ad73a)['then'](function(_0x234548){return _0x234548;});}return null;};}function removeEntity(_0x47fe4,_0x254979){return function(_0x507343){if(_0x507343){return _0x507343[_0xebd0('0x23')]()[_0xebd0('0x24')](function(){_0x47fe4[_0xebd0('0x19')](0xcc)[_0xebd0('0x25')]();});}};}function handleEntityNotFound(_0x4a0deb,_0x4ee6dd){return function(_0x144f13){if(!_0x144f13){_0x4a0deb[_0xebd0('0x18')](0x194);}return _0x144f13;};}function handleError(_0x4210fb,_0x73fd66){_0x73fd66=_0x73fd66||0x1f4;return function(_0x30d96b){logger['error'](_0x30d96b[_0xebd0('0x26')]);if(_0x30d96b[_0xebd0('0x27')]){delete _0x30d96b[_0xebd0('0x27')];}_0x4210fb[_0xebd0('0x19')](_0x73fd66)[_0xebd0('0x28')](_0x30d96b);};}exports['index']=function(_0x53169b,_0x4edc71){var _0x540a70={},_0x206716={},_0x3b9033={'count':0x0,'rows':[]};var _0x16c821=_['map'](db['ChatQueueReport']['rawAttributes'],function(_0x140967){return{'name':_0x140967[_0xebd0('0x29')],'type':_0x140967[_0xebd0('0x2a')][_0xebd0('0x2b')]};});_0x206716[_0xebd0('0x2c')]=_[_0xebd0('0x2d')](_0x16c821,_0xebd0('0x27'));_0x206716[_0xebd0('0x2e')]=_['keys'](_0x53169b[_0xebd0('0x2e')]);_0x206716[_0xebd0('0x2f')]=_[_0xebd0('0x30')](_0x206716[_0xebd0('0x2c')],_0x206716[_0xebd0('0x2e')]);_0x540a70[_0xebd0('0x31')]=_['intersection'](_0x206716[_0xebd0('0x2c')],qs['fields'](_0x53169b['query']['fields']));_0x540a70[_0xebd0('0x31')]=_0x540a70[_0xebd0('0x31')][_0xebd0('0x32')]?_0x540a70[_0xebd0('0x31')]:_0x206716[_0xebd0('0x2c')];if(!_0x53169b['query'][_0xebd0('0x33')](_0xebd0('0x34'))){_0x540a70[_0xebd0('0x1d')]=qs[_0xebd0('0x1d')](_0x53169b[_0xebd0('0x2e')][_0xebd0('0x1d')]);_0x540a70[_0xebd0('0x1b')]=qs[_0xebd0('0x1b')](_0x53169b[_0xebd0('0x2e')]['offset']);}_0x540a70[_0xebd0('0x35')]=qs['sort'](_0x53169b[_0xebd0('0x2e')][_0xebd0('0x36')]);_0x540a70[_0xebd0('0x37')]=qs['filters'](_[_0xebd0('0x38')](_0x53169b['query'],_0x206716[_0xebd0('0x2f')]),_0x16c821);if(_0x53169b[_0xebd0('0x2e')][_0xebd0('0x39')]){_0x540a70['where']=_[_0xebd0('0x3a')](_0x540a70[_0xebd0('0x37')],{'$or':_['map'](_0x16c821,function(_0x58db9e){if(_0x58db9e[_0xebd0('0x2a')]!==_0xebd0('0x3b')){var _0x292c1e={};_0x292c1e[_0x58db9e['name']]={'$like':'%'+_0x53169b[_0xebd0('0x2e')][_0xebd0('0x39')]+'%'};return _0x292c1e;}})});}_0x540a70=_[_0xebd0('0x3a')]({},_0x540a70,_0x53169b[_0xebd0('0x3c')]);var _0x46c7b7={'where':_0x540a70[_0xebd0('0x37')]};return db[_0xebd0('0x3d')][_0xebd0('0x1e')](_0x46c7b7)['then'](function(_0x5d030d){_0x3b9033[_0xebd0('0x1e')]=_0x5d030d;if(_0x53169b['query']['includeAll']){_0x540a70['include']=[{'all':!![]}];}return db['ChatQueueReport'][_0xebd0('0x3e')](_0x540a70);})[_0xebd0('0x24')](function(_0x14d0bc){_0x3b9033[_0xebd0('0x3f')]=_0x14d0bc;return _0x3b9033;})[_0xebd0('0x24')](respondWithFilteredResult(_0x4edc71,_0x540a70))[_0xebd0('0x40')](handleError(_0x4edc71,null));};exports[_0xebd0('0x41')]=function(_0x50840c,_0x1dad44){var _0xd994f={'raw':!![],'where':{'id':_0x50840c['params']['id']}},_0x2c3bc3={};_0x2c3bc3['model']=_[_0xebd0('0x42')](db['ChatQueueReport'][_0xebd0('0x43')]);_0x2c3bc3[_0xebd0('0x2e')]=_[_0xebd0('0x42')](_0x50840c[_0xebd0('0x2e')]);_0x2c3bc3[_0xebd0('0x2f')]=_[_0xebd0('0x30')](_0x2c3bc3[_0xebd0('0x2c')],_0x2c3bc3['query']);_0xd994f[_0xebd0('0x31')]=_[_0xebd0('0x30')](_0x2c3bc3[_0xebd0('0x2c')],qs[_0xebd0('0x44')](_0x50840c[_0xebd0('0x2e')][_0xebd0('0x44')]));_0xd994f['attributes']=_0xd994f[_0xebd0('0x31')]['length']?_0xd994f['attributes']:_0x2c3bc3[_0xebd0('0x2c')];if(_0x50840c['query']['includeAll']){_0xd994f[_0xebd0('0x45')]=[{'all':!![]}];}_0xd994f=_[_0xebd0('0x3a')]({},_0xd994f,_0x50840c[_0xebd0('0x3c')]);return db[_0xebd0('0x3d')][_0xebd0('0x46')](_0xd994f)['then'](handleEntityNotFound(_0x1dad44,null))[_0xebd0('0x24')](respondWithResult(_0x1dad44,null))['catch'](handleError(_0x1dad44,null));};exports['create']=function(_0x2e44f1,_0x45ad49){return db['ChatQueueReport'][_0xebd0('0x47')](_0x2e44f1[_0xebd0('0x48')],{})[_0xebd0('0x24')](respondWithResult(_0x45ad49,0xc9))[_0xebd0('0x40')](handleError(_0x45ad49,null));};exports[_0xebd0('0x22')]=function(_0x18675a,_0x778fa1){if(_0x18675a[_0xebd0('0x48')]['id']){delete _0x18675a[_0xebd0('0x48')]['id'];}return db['ChatQueueReport'][_0xebd0('0x46')]({'where':{'id':_0x18675a[_0xebd0('0x49')]['id']}})[_0xebd0('0x24')](handleEntityNotFound(_0x778fa1,null))[_0xebd0('0x24')](saveUpdates(_0x18675a[_0xebd0('0x48')],null))[_0xebd0('0x24')](respondWithResult(_0x778fa1,null))['catch'](handleError(_0x778fa1,null));};exports[_0xebd0('0x23')]=function(_0x14ed2e,_0x526a93){return db[_0xebd0('0x3d')][_0xebd0('0x46')]({'where':{'id':_0x14ed2e['params']['id']}})[_0xebd0('0x24')](handleEntityNotFound(_0x526a93,null))[_0xebd0('0x24')](removeEntity(_0x526a93,null))[_0xebd0('0x40')](handleError(_0x526a93,null));};exports[_0xebd0('0x4a')]=function(_0x28a11b,_0x4ce8a5){return db['ChatQueueReport'][_0xebd0('0x4a')]()[_0xebd0('0x24')](respondWithResult(_0x4ce8a5,null))[_0xebd0('0x40')](handleError(_0x4ce8a5,null));}; \ No newline at end of file +var _0x126e=['../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','ChatQueueReport','rawAttributes','type','model','map','keys','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','include','show','params','intersection','find','catch','create','body','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/advancedSearch'];(function(_0x5c8490,_0x21e3b4){var _0x2c4f89=function(_0x5e67fc){while(--_0x5e67fc){_0x5c8490['push'](_0x5c8490['shift']());}};_0x2c4f89(++_0x21e3b4);}(_0x126e,0x108));var _0xe126=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x126e[_0x18ab2a];return _0x16dcee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe126('0x0'));var zipdir=require(_0xe126('0x1'));var jsonpatch=require(_0xe126('0x2'));var rp=require(_0xe126('0x3'));var moment=require(_0xe126('0x4'));var BPromise=require(_0xe126('0x5'));var Mustache=require('mustache');var util=require(_0xe126('0x6'));var path=require(_0xe126('0x7'));var sox=require(_0xe126('0x8'));var csv=require(_0xe126('0x9'));var ejs=require(_0xe126('0xa'));var fs=require('fs');var fs_extra=require(_0xe126('0xb'));var _=require(_0xe126('0xc'));var squel=require('squel');var crypto=require(_0xe126('0xd'));var jsforce=require(_0xe126('0xe'));var deskjs=require(_0xe126('0xf'));var toCsv=require(_0xe126('0x9'));var querystring=require(_0xe126('0x10'));var Papa=require('papaparse');var Redis=require(_0xe126('0x11'));var authService=require(_0xe126('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe126('0x13'));var hardwareService=require(_0xe126('0x14'));var logger=require('../../config/logger')(_0xe126('0x15'));var utils=require('../../config/utils');var config=require(_0xe126('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe126('0x17'))['db'];function respondWithStatusCode(_0x34ae06,_0x23ff02){_0x23ff02=_0x23ff02||0xcc;return function(_0x38b8c3){if(_0x38b8c3){return _0x34ae06[_0xe126('0x18')](_0x23ff02);}return _0x34ae06[_0xe126('0x19')](_0x23ff02)[_0xe126('0x1a')]();};}function respondWithResult(_0x55f10a,_0xd55baf){_0xd55baf=_0xd55baf||0xc8;return function(_0x1c02c9){if(_0x1c02c9){return _0x55f10a['status'](_0xd55baf)[_0xe126('0x1b')](_0x1c02c9);}};}function respondWithFilteredResult(_0x28d7dd,_0x10bc24){return function(_0x38b0c0){if(_0x38b0c0){var _0x5e52d1=typeof _0x10bc24[_0xe126('0x1c')]===_0xe126('0x1d')&&typeof _0x10bc24[_0xe126('0x1e')]==='undefined';var _0x2b0baa=_0x38b0c0['count'];var _0x46c98a=_0x5e52d1?0x0:_0x10bc24[_0xe126('0x1c')];var _0x19b0a3=_0x5e52d1?_0x38b0c0[_0xe126('0x1f')]:_0x10bc24[_0xe126('0x1c')]+_0x10bc24[_0xe126('0x1e')];var _0x20874b;if(_0x19b0a3>=_0x2b0baa){_0x19b0a3=_0x2b0baa;_0x20874b=0xc8;}else{_0x20874b=0xce;}_0x28d7dd[_0xe126('0x19')](_0x20874b);return _0x28d7dd['set'](_0xe126('0x20'),_0x46c98a+'-'+_0x19b0a3+'/'+_0x2b0baa)[_0xe126('0x1b')](_0x38b0c0);}return null;};}function patchUpdates(_0x35ab64){return function(_0x2e5617){try{jsonpatch[_0xe126('0x21')](_0x2e5617,_0x35ab64,!![]);}catch(_0x24076e){return BPromise[_0xe126('0x22')](_0x24076e);}return _0x2e5617[_0xe126('0x23')]();};}function saveUpdates(_0x5257bc,_0x4a1a97){return function(_0xdb6544){if(_0xdb6544){return _0xdb6544[_0xe126('0x24')](_0x5257bc)[_0xe126('0x25')](function(_0x5f1ce1){return _0x5f1ce1;});}return null;};}function removeEntity(_0x5381e1,_0x47f179){return function(_0x4807d3){if(_0x4807d3){return _0x4807d3[_0xe126('0x26')]()['then'](function(){_0x5381e1[_0xe126('0x19')](0xcc)[_0xe126('0x1a')]();});}};}function handleEntityNotFound(_0x4157ed,_0x1674c9){return function(_0x532409){if(!_0x532409){_0x4157ed['sendStatus'](0x194);}return _0x532409;};}function handleError(_0x26482f,_0x4facea){_0x4facea=_0x4facea||0x1f4;return function(_0x3f5de5){logger[_0xe126('0x27')](_0x3f5de5[_0xe126('0x28')]);if(_0x3f5de5['name']){delete _0x3f5de5[_0xe126('0x29')];}_0x26482f[_0xe126('0x19')](_0x4facea)['send'](_0x3f5de5);};}exports[_0xe126('0x2a')]=function(_0x259059,_0x5a8b2a){var _0x9d9e28={},_0x1fb354={},_0x29dec4={'count':0x0,'rows':[]};var _0x181ccc=_['map'](db[_0xe126('0x2b')][_0xe126('0x2c')],function(_0x5e7bab){return{'name':_0x5e7bab['fieldName'],'type':_0x5e7bab[_0xe126('0x2d')]['key']};});_0x1fb354[_0xe126('0x2e')]=_[_0xe126('0x2f')](_0x181ccc,_0xe126('0x29'));_0x1fb354['query']=_[_0xe126('0x30')](_0x259059[_0xe126('0x31')]);_0x1fb354[_0xe126('0x32')]=_['intersection'](_0x1fb354[_0xe126('0x2e')],_0x1fb354[_0xe126('0x31')]);_0x9d9e28['attributes']=_['intersection'](_0x1fb354[_0xe126('0x2e')],qs[_0xe126('0x33')](_0x259059[_0xe126('0x31')][_0xe126('0x33')]));_0x9d9e28[_0xe126('0x34')]=_0x9d9e28[_0xe126('0x34')][_0xe126('0x35')]?_0x9d9e28[_0xe126('0x34')]:_0x1fb354['model'];if(!_0x259059[_0xe126('0x31')][_0xe126('0x36')](_0xe126('0x37'))){_0x9d9e28[_0xe126('0x1e')]=qs[_0xe126('0x1e')](_0x259059[_0xe126('0x31')]['limit']);_0x9d9e28[_0xe126('0x1c')]=qs[_0xe126('0x1c')](_0x259059[_0xe126('0x31')][_0xe126('0x1c')]);}_0x9d9e28[_0xe126('0x38')]=qs['sort'](_0x259059[_0xe126('0x31')][_0xe126('0x39')]);_0x9d9e28[_0xe126('0x3a')]=qs[_0xe126('0x32')](_['pick'](_0x259059[_0xe126('0x31')],_0x1fb354[_0xe126('0x32')]),_0x181ccc);if(_0x259059[_0xe126('0x31')][_0xe126('0x3b')]){_0x9d9e28[_0xe126('0x3a')]=_[_0xe126('0x3c')](_0x9d9e28['where'],{'$or':_[_0xe126('0x2f')](_0x181ccc,function(_0x1a8edf){if(_0x1a8edf[_0xe126('0x2d')]!=='VIRTUAL'){var _0x5073bc={};_0x5073bc[_0x1a8edf[_0xe126('0x29')]]={'$like':'%'+_0x259059[_0xe126('0x31')][_0xe126('0x3b')]+'%'};return _0x5073bc;}})});}_0x9d9e28=_[_0xe126('0x3c')]({},_0x9d9e28,_0x259059[_0xe126('0x3d')]);var _0x1c128d={'where':_0x9d9e28['where']};return db[_0xe126('0x2b')][_0xe126('0x1f')](_0x1c128d)['then'](function(_0x4eb3d7){_0x29dec4[_0xe126('0x1f')]=_0x4eb3d7;if(_0x259059[_0xe126('0x31')]['includeAll']){_0x9d9e28[_0xe126('0x3e')]=[{'all':!![]}];}return db[_0xe126('0x2b')]['findAll'](_0x9d9e28);})[_0xe126('0x25')](function(_0x366754){_0x29dec4['rows']=_0x366754;return _0x29dec4;})[_0xe126('0x25')](respondWithFilteredResult(_0x5a8b2a,_0x9d9e28))['catch'](handleError(_0x5a8b2a,null));};exports[_0xe126('0x3f')]=function(_0x23d1d8,_0x5d5111){var _0x3613de={'raw':!![],'where':{'id':_0x23d1d8[_0xe126('0x40')]['id']}},_0x149b84={};_0x149b84['model']=_[_0xe126('0x30')](db['ChatQueueReport'][_0xe126('0x2c')]);_0x149b84[_0xe126('0x31')]=_[_0xe126('0x30')](_0x23d1d8[_0xe126('0x31')]);_0x149b84[_0xe126('0x32')]=_[_0xe126('0x41')](_0x149b84[_0xe126('0x2e')],_0x149b84[_0xe126('0x31')]);_0x3613de[_0xe126('0x34')]=_[_0xe126('0x41')](_0x149b84[_0xe126('0x2e')],qs['fields'](_0x23d1d8['query'][_0xe126('0x33')]));_0x3613de[_0xe126('0x34')]=_0x3613de['attributes'][_0xe126('0x35')]?_0x3613de[_0xe126('0x34')]:_0x149b84[_0xe126('0x2e')];if(_0x23d1d8[_0xe126('0x31')]['includeAll']){_0x3613de[_0xe126('0x3e')]=[{'all':!![]}];}_0x3613de=_[_0xe126('0x3c')]({},_0x3613de,_0x23d1d8[_0xe126('0x3d')]);return db[_0xe126('0x2b')][_0xe126('0x42')](_0x3613de)[_0xe126('0x25')](handleEntityNotFound(_0x5d5111,null))[_0xe126('0x25')](respondWithResult(_0x5d5111,null))[_0xe126('0x43')](handleError(_0x5d5111,null));};exports[_0xe126('0x44')]=function(_0xccc25d,_0x23007d){return db[_0xe126('0x2b')][_0xe126('0x44')](_0xccc25d['body'],{})['then'](respondWithResult(_0x23007d,0xc9))['catch'](handleError(_0x23007d,null));};exports['update']=function(_0xe642ae,_0x8d5abd){if(_0xe642ae[_0xe126('0x45')]['id']){delete _0xe642ae[_0xe126('0x45')]['id'];}return db[_0xe126('0x2b')][_0xe126('0x42')]({'where':{'id':_0xe642ae[_0xe126('0x40')]['id']}})['then'](handleEntityNotFound(_0x8d5abd,null))['then'](saveUpdates(_0xe642ae[_0xe126('0x45')],null))[_0xe126('0x25')](respondWithResult(_0x8d5abd,null))['catch'](handleError(_0x8d5abd,null));};exports[_0xe126('0x26')]=function(_0x209002,_0x518e43){return db[_0xe126('0x2b')][_0xe126('0x42')]({'where':{'id':_0x209002['params']['id']}})['then'](handleEntityNotFound(_0x518e43,null))[_0xe126('0x25')](removeEntity(_0x518e43,null))[_0xe126('0x43')](handleError(_0x518e43,null));};exports[_0xe126('0x46')]=function(_0x48fbed,_0x31e193){return db['ChatQueueReport'][_0xe126('0x46')]()[_0xe126('0x25')](respondWithResult(_0x31e193,null))['catch'](handleError(_0x31e193,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 74bb23f..245cbb3 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 _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util'];(function(_0x3878bd,_0x51e3e5){var _0x359e60=function(_0xe70276){while(--_0xe70276){_0x3878bd['push'](_0x3878bd['shift']());}};_0x359e60(++_0x51e3e5);}(_0xe706,0xa3));var _0x6e70=function(_0x788c48,_0x5c0e5e){_0x788c48=_0x788c48-0x0;var _0x299c14=_0xe706[_0x788c48];return _0x299c14;};'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 _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x5a3f9d,_0x4e2056){var _0x4b0cd=function(_0x1d7a31){while(--_0x1d7a31){_0x5a3f9d['push'](_0x5a3f9d['shift']());}};_0x4b0cd(++_0x4e2056);}(_0x757a,0xde));var _0xa757=function(_0x1e7dd1,_0x533388){_0x1e7dd1=_0x1e7dd1-0x0;var _0x988568=_0x757a[_0x1e7dd1];return _0x988568;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ChatQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 7674475..b956e5d 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 _0x6cb4=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','info','request\x20sent','debug','stringify','error','ChatQueueReport,\x20%s,\x20%s','message','result','catch','ChatQueueReport','create','body','options','raw','then','CreateChatQueueReport','UpdateChatQueueReport','update','attributes','limit','lodash'];(function(_0x37e4ad,_0x170ca0){var _0x128d7c=function(_0x137db8){while(--_0x137db8){_0x37e4ad['push'](_0x37e4ad['shift']());}};_0x128d7c(++_0x170ca0);}(_0x6cb4,0xff));var _0x46cb=function(_0x5cf074,_0x34f595){_0x5cf074=_0x5cf074-0x0;var _0x593789=_0x6cb4[_0x5cf074];return _0x593789;};'use strict';var _=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var moment=require(_0x46cb('0x2'));var BPromise=require(_0x46cb('0x3'));var rs=require(_0x46cb('0x4'));var fs=require('fs');var Redis=require(_0x46cb('0x5'));var db=require(_0x46cb('0x6'))['db'];var utils=require(_0x46cb('0x7'));var logger=require(_0x46cb('0x8'))('rpc');var config=require(_0x46cb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x46cb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11262d,_0x148d0f,_0x31b35b){return new BPromise(function(_0x2d6c29,_0x24b4f5){return client[_0x46cb('0xb')](_0x11262d,_0x31b35b)['then'](function(_0x3d7663){logger[_0x46cb('0xc')]('ChatQueueReport,\x20%s,\x20%s',_0x148d0f,_0x46cb('0xd'));logger[_0x46cb('0xe')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x148d0f,_0x46cb('0xd'),JSON[_0x46cb('0xf')](_0x3d7663));if(_0x3d7663['error']){if(_0x3d7663['error']['code']===0x1f4){logger[_0x46cb('0x10')](_0x46cb('0x11'),_0x148d0f,_0x3d7663[_0x46cb('0x10')][_0x46cb('0x12')]);return _0x24b4f5(_0x3d7663['error'][_0x46cb('0x12')]);}logger[_0x46cb('0x10')](_0x46cb('0x11'),_0x148d0f,_0x3d7663[_0x46cb('0x10')][_0x46cb('0x12')]);return _0x2d6c29(_0x3d7663[_0x46cb('0x10')][_0x46cb('0x12')]);}else{logger[_0x46cb('0xc')](_0x46cb('0x11'),_0x148d0f,_0x46cb('0xd'));_0x2d6c29(_0x3d7663[_0x46cb('0x13')]['message']);}})[_0x46cb('0x14')](function(_0x5796d2){logger[_0x46cb('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0x148d0f,_0x5796d2);_0x24b4f5(_0x5796d2);});});}exports['CreateChatQueueReport']=function(_0x4e3454){var _0x1b6646=this;return new Promise(function(_0x1f2891,_0x4df1f0){return db[_0x46cb('0x15')][_0x46cb('0x16')](_0x4e3454[_0x46cb('0x17')],{'raw':_0x4e3454[_0x46cb('0x18')]?_0x4e3454[_0x46cb('0x18')][_0x46cb('0x19')]===undefined?!![]:![]:!![]})[_0x46cb('0x1a')](function(_0x149483){logger[_0x46cb('0xc')](_0x46cb('0x1b'),_0x4e3454);logger[_0x46cb('0xe')](_0x46cb('0x1b'),_0x4e3454,JSON[_0x46cb('0xf')](_0x149483));_0x1f2891(_0x149483);})[_0x46cb('0x14')](function(_0x1fb467){logger[_0x46cb('0x10')](_0x46cb('0x1b'),_0x1fb467[_0x46cb('0x12')],_0x4e3454);_0x4df1f0(_0x1b6646[_0x46cb('0x10')](0x1f4,_0x1fb467[_0x46cb('0x12')]));});});};exports[_0x46cb('0x1c')]=function(_0x40e0e5){var _0x5a1338=this;return new Promise(function(_0x4d663e,_0x6588f3){return db[_0x46cb('0x15')][_0x46cb('0x1d')](_0x40e0e5[_0x46cb('0x17')],{'raw':_0x40e0e5[_0x46cb('0x18')]?_0x40e0e5['options'][_0x46cb('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40e0e5['options']?_0x40e0e5['options']['where']||null:null,'attributes':_0x40e0e5[_0x46cb('0x18')]?_0x40e0e5[_0x46cb('0x18')][_0x46cb('0x1e')]||null:null,'limit':_0x40e0e5[_0x46cb('0x18')]?_0x40e0e5[_0x46cb('0x18')][_0x46cb('0x1f')]||null:null})[_0x46cb('0x1a')](function(_0x8c65b2){logger[_0x46cb('0xc')](_0x46cb('0x1c'),_0x40e0e5);logger[_0x46cb('0xe')]('UpdateChatQueueReport',_0x40e0e5,JSON[_0x46cb('0xf')](_0x8c65b2));_0x4d663e(_0x8c65b2);})[_0x46cb('0x14')](function(_0x4c73bd){logger['error'](_0x46cb('0x1c'),_0x4c73bd['message'],_0x40e0e5);_0x6588f3(_0x5a1338[_0x46cb('0x10')](0x1f4,_0x4c73bd[_0x46cb('0x12')]));});});}; \ No newline at end of file +var _0x4b03=['error','message','result','catch','CreateChatQueueReport','create','body','options','raw','stringify','UpdateChatQueueReport','ChatQueueReport','update','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0xc0797d,_0x8f7795){var _0x14038d=function(_0x3af163){while(--_0x3af163){_0xc0797d['push'](_0xc0797d['shift']());}};_0x14038d(++_0x8f7795);}(_0x4b03,0x11f));var _0x34b0=function(_0x3e8384,_0x1a7869){_0x3e8384=_0x3e8384-0x0;var _0xddc3eb=_0x4b03[_0x3e8384];return _0xddc3eb;};'use strict';var _=require(_0x34b0('0x0'));var util=require(_0x34b0('0x1'));var moment=require(_0x34b0('0x2'));var BPromise=require(_0x34b0('0x3'));var rs=require(_0x34b0('0x4'));var fs=require('fs');var Redis=require(_0x34b0('0x5'));var db=require(_0x34b0('0x6'))['db'];var utils=require(_0x34b0('0x7'));var logger=require(_0x34b0('0x8'))(_0x34b0('0x9'));var config=require(_0x34b0('0xa'));var jayson=require(_0x34b0('0xb'));var client=jayson[_0x34b0('0xc')][_0x34b0('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1c5775,_0x287f05,_0x5082d5){return new BPromise(function(_0x52ed51,_0x312672){return client['request'](_0x1c5775,_0x5082d5)[_0x34b0('0xe')](function(_0xcf4585){logger[_0x34b0('0xf')](_0x34b0('0x10'),_0x287f05,'request\x20sent');logger[_0x34b0('0x11')](_0x34b0('0x12'),_0x287f05,'request\x20sent',JSON['stringify'](_0xcf4585));if(_0xcf4585[_0x34b0('0x13')]){if(_0xcf4585[_0x34b0('0x13')]['code']===0x1f4){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x287f05,_0xcf4585['error'][_0x34b0('0x14')]);return _0x312672(_0xcf4585['error'][_0x34b0('0x14')]);}logger['error'](_0x34b0('0x10'),_0x287f05,_0xcf4585['error'][_0x34b0('0x14')]);return _0x52ed51(_0xcf4585['error'][_0x34b0('0x14')]);}else{logger[_0x34b0('0xf')](_0x34b0('0x10'),_0x287f05,'request\x20sent');_0x52ed51(_0xcf4585[_0x34b0('0x15')][_0x34b0('0x14')]);}})[_0x34b0('0x16')](function(_0x3b645d){logger[_0x34b0('0x13')](_0x34b0('0x10'),_0x287f05,_0x3b645d);_0x312672(_0x3b645d);});});}exports[_0x34b0('0x17')]=function(_0x4adf65){var _0x5b2372=this;return new Promise(function(_0x1278d5,_0x46d534){return db['ChatQueueReport'][_0x34b0('0x18')](_0x4adf65[_0x34b0('0x19')],{'raw':_0x4adf65[_0x34b0('0x1a')]?_0x4adf65[_0x34b0('0x1a')][_0x34b0('0x1b')]===undefined?!![]:![]:!![]})[_0x34b0('0xe')](function(_0x185b79){logger[_0x34b0('0xf')](_0x34b0('0x17'),_0x4adf65);logger['debug'](_0x34b0('0x17'),_0x4adf65,JSON[_0x34b0('0x1c')](_0x185b79));_0x1278d5(_0x185b79);})[_0x34b0('0x16')](function(_0x17c0e3){logger[_0x34b0('0x13')](_0x34b0('0x17'),_0x17c0e3[_0x34b0('0x14')],_0x4adf65);_0x46d534(_0x5b2372[_0x34b0('0x13')](0x1f4,_0x17c0e3[_0x34b0('0x14')]));});});};exports[_0x34b0('0x1d')]=function(_0x4c1f35){var _0x2c6a45=this;return new Promise(function(_0x535d53,_0x18f90b){return db[_0x34b0('0x1e')][_0x34b0('0x1f')](_0x4c1f35[_0x34b0('0x19')],{'raw':_0x4c1f35[_0x34b0('0x1a')]?_0x4c1f35['options'][_0x34b0('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c1f35[_0x34b0('0x1a')]?_0x4c1f35[_0x34b0('0x1a')][_0x34b0('0x20')]||null:null,'attributes':_0x4c1f35[_0x34b0('0x1a')]?_0x4c1f35[_0x34b0('0x1a')]['attributes']||null:null,'limit':_0x4c1f35[_0x34b0('0x1a')]?_0x4c1f35[_0x34b0('0x1a')][_0x34b0('0x21')]||null:null})[_0x34b0('0xe')](function(_0x4f9ab2){logger[_0x34b0('0xf')]('UpdateChatQueueReport',_0x4c1f35);logger['debug'](_0x34b0('0x1d'),_0x4c1f35,JSON[_0x34b0('0x1c')](_0x4f9ab2));_0x535d53(_0x4f9ab2);})['catch'](function(_0x134924){logger['error']('UpdateChatQueueReport',_0x134924[_0x34b0('0x14')],_0x4c1f35);_0x18f90b(_0x2c6a45[_0x34b0('0x13')](0x1f4,_0x134924[_0x34b0('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 8b373e5..2ecaa74 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 _0xe501=['Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','exports','util','path','connect-timeout','express'];(function(_0x214057,_0x598967){var _0x565bc9=function(_0x95b3f3){while(--_0x95b3f3){_0x214057['push'](_0x214057['shift']());}};_0x565bc9(++_0x598967);}(_0xe501,0x1f0));var _0x1e50=function(_0x458829,_0x5dae88){_0x458829=_0x458829-0x0;var _0xc0a3c=_0xe501[_0x458829];return _0xc0a3c;};'use strict';var multer=require('multer');var util=require(_0x1e50('0x0'));var path=require(_0x1e50('0x1'));var timeout=require(_0x1e50('0x2'));var express=require(_0x1e50('0x3'));var router=express[_0x1e50('0x4')]();var fs_extra=require(_0x1e50('0x5'));var auth=require(_0x1e50('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1e50('0x7'));var controller=require(_0x1e50('0x8'));router[_0x1e50('0x9')]('/',auth[_0x1e50('0xa')](),controller[_0x1e50('0xb')]);router[_0x1e50('0x9')](_0x1e50('0xc'),auth[_0x1e50('0xa')](),controller[_0x1e50('0xd')]);router['get'](_0x1e50('0xe'),auth[_0x1e50('0xa')](),controller[_0x1e50('0xf')]);router['post']('/',auth[_0x1e50('0xa')](),controller[_0x1e50('0x10')]);router[_0x1e50('0x11')](_0x1e50('0xe'),auth['isAuthenticated'](),controller[_0x1e50('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x1e50('0x13')]=router; \ No newline at end of file +var _0xeb33=['put','/:id','update','delete','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','/describe','describe','show','post','create'];(function(_0x242ea3,_0xe7e9bb){var _0x44bdf9=function(_0x375d0b){while(--_0x375d0b){_0x242ea3['push'](_0x242ea3['shift']());}};_0x44bdf9(++_0xe7e9bb);}(_0xeb33,0x1a2));var _0x3eb3=function(_0x4d4ca7,_0x56a047){_0x4d4ca7=_0x4d4ca7-0x0;var _0x59aedb=_0xeb33[_0x4d4ca7];return _0x59aedb;};'use strict';var multer=require(_0x3eb3('0x0'));var util=require(_0x3eb3('0x1'));var path=require('path');var timeout=require(_0x3eb3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3eb3('0x3'));var auth=require(_0x3eb3('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3eb3('0x5'));var controller=require(_0x3eb3('0x6'));router[_0x3eb3('0x7')]('/',auth[_0x3eb3('0x8')](),controller['index']);router[_0x3eb3('0x7')](_0x3eb3('0x9'),auth[_0x3eb3('0x8')](),controller[_0x3eb3('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x3eb3('0xb')]);router[_0x3eb3('0xc')]('/',auth[_0x3eb3('0x8')](),controller[_0x3eb3('0xd')]);router[_0x3eb3('0xe')](_0x3eb3('0xf'),auth['isAuthenticated'](),controller[_0x3eb3('0x10')]);router[_0x3eb3('0x11')]('/:id',auth[_0x3eb3('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 4c764c2..8c3f4e6 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(_0x22d352,_0x4a576f){var _0x11228c=function(_0x4d8414){while(--_0x4d8414){_0x22d352['push'](_0x22d352['shift']());}};_0x11228c(++_0x4a576f);}(_0xaa88,0x137));var _0x8aa8=function(_0x2074db,_0x10b81b){_0x2074db=_0x2074db-0x0;var _0x27324c=_0xaa88[_0x2074db];return _0x27324c;};'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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x11dde4,_0x1d4852){var _0x6eea94=function(_0x182859){while(--_0x182859){_0x11dde4['push'](_0x11dde4['shift']());}};_0x6eea94(++_0x1d4852);}(_0x9c44,0x178));var _0x49c4=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x9c44[_0x3511d3];return _0x5d6321;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index c93cd72..6ed897d 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 _0x90c9=['body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','count','set','Content-Range','save','then','error','stack','name','send','index','map','ChatTransferReport','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','find','create'];(function(_0x202d24,_0x5e8641){var _0x2b3a8e=function(_0x4c7c4a){while(--_0x4c7c4a){_0x202d24['push'](_0x202d24['shift']());}};_0x2b3a8e(++_0x5e8641);}(_0x90c9,0x12b));var _0x990c=function(_0x4befae,_0x55b079){_0x4befae=_0x4befae-0x0;var _0x76c573=_0x90c9[_0x4befae];return _0x76c573;};'use strict';var emlformat=require(_0x990c('0x0'));var rimraf=require(_0x990c('0x1'));var zipdir=require(_0x990c('0x2'));var jsonpatch=require(_0x990c('0x3'));var rp=require(_0x990c('0x4'));var moment=require(_0x990c('0x5'));var BPromise=require(_0x990c('0x6'));var Mustache=require('mustache');var util=require(_0x990c('0x7'));var path=require('path');var sox=require(_0x990c('0x8'));var csv=require(_0x990c('0x9'));var ejs=require(_0x990c('0xa'));var fs=require('fs');var fs_extra=require(_0x990c('0xb'));var _=require(_0x990c('0xc'));var squel=require(_0x990c('0xd'));var crypto=require(_0x990c('0xe'));var jsforce=require(_0x990c('0xf'));var deskjs=require(_0x990c('0x10'));var toCsv=require(_0x990c('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x990c('0x11'));var authService=require(_0x990c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x990c('0x13'));var hardwareService=require(_0x990c('0x14'));var logger=require('../../config/logger')(_0x990c('0x15'));var utils=require('../../config/utils');var config=require(_0x990c('0x16'));var licenseUtil=require(_0x990c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x218659,_0xe9fa7b){_0xe9fa7b=_0xe9fa7b||0xcc;return function(_0x3f89c6){if(_0x3f89c6){return _0x218659['sendStatus'](_0xe9fa7b);}return _0x218659['status'](_0xe9fa7b)['end']();};}function respondWithResult(_0x29d69a,_0x2a8822){_0x2a8822=_0x2a8822||0xc8;return function(_0xa1b7b0){if(_0xa1b7b0){return _0x29d69a[_0x990c('0x18')](_0x2a8822)[_0x990c('0x19')](_0xa1b7b0);}};}function respondWithFilteredResult(_0x461213,_0x4744ec){return function(_0x4cce3a){if(_0x4cce3a){var _0x8bb2f2=typeof _0x4744ec[_0x990c('0x1a')]==='undefined'&&typeof _0x4744ec[_0x990c('0x1b')]===_0x990c('0x1c');var _0x12c407=_0x4cce3a[_0x990c('0x1d')];var _0x5679a7=_0x8bb2f2?0x0:_0x4744ec[_0x990c('0x1a')];var _0x4326e2=_0x8bb2f2?_0x4cce3a['count']:_0x4744ec['offset']+_0x4744ec['limit'];var _0x32b8e9;if(_0x4326e2>=_0x12c407){_0x4326e2=_0x12c407;_0x32b8e9=0xc8;}else{_0x32b8e9=0xce;}_0x461213['status'](_0x32b8e9);return _0x461213[_0x990c('0x1e')](_0x990c('0x1f'),_0x5679a7+'-'+_0x4326e2+'/'+_0x12c407)['json'](_0x4cce3a);}return null;};}function patchUpdates(_0x54633a){return function(_0x3d3690){try{jsonpatch['apply'](_0x3d3690,_0x54633a,!![]);}catch(_0x6a3551){return BPromise['reject'](_0x6a3551);}return _0x3d3690[_0x990c('0x20')]();};}function saveUpdates(_0x996ced,_0x5099d3){return function(_0x96202b){if(_0x96202b){return _0x96202b['update'](_0x996ced)[_0x990c('0x21')](function(_0x33fdc0){return _0x33fdc0;});}return null;};}function removeEntity(_0x18d9be,_0x1b1e0a){return function(_0x3f3093){if(_0x3f3093){return _0x3f3093['destroy']()[_0x990c('0x21')](function(){_0x18d9be[_0x990c('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34537b,_0x48134e){return function(_0x36f602){if(!_0x36f602){_0x34537b['sendStatus'](0x194);}return _0x36f602;};}function handleError(_0x1faec8,_0x1c842b){_0x1c842b=_0x1c842b||0x1f4;return function(_0x3704c4){logger[_0x990c('0x22')](_0x3704c4[_0x990c('0x23')]);if(_0x3704c4[_0x990c('0x24')]){delete _0x3704c4[_0x990c('0x24')];}_0x1faec8[_0x990c('0x18')](_0x1c842b)[_0x990c('0x25')](_0x3704c4);};}exports[_0x990c('0x26')]=function(_0x28909c,_0x5b952f){var _0x50c555={},_0x356a4a={},_0x53d9ae={'count':0x0,'rows':[]};var _0x43ca4e=_[_0x990c('0x27')](db[_0x990c('0x28')]['rawAttributes'],function(_0x56979b){return{'name':_0x56979b[_0x990c('0x29')],'type':_0x56979b[_0x990c('0x2a')][_0x990c('0x2b')]};});_0x356a4a[_0x990c('0x2c')]=_[_0x990c('0x27')](_0x43ca4e,_0x990c('0x24'));_0x356a4a[_0x990c('0x2d')]=_['keys'](_0x28909c[_0x990c('0x2d')]);_0x356a4a[_0x990c('0x2e')]=_['intersection'](_0x356a4a[_0x990c('0x2c')],_0x356a4a[_0x990c('0x2d')]);_0x50c555[_0x990c('0x2f')]=_[_0x990c('0x30')](_0x356a4a[_0x990c('0x2c')],qs[_0x990c('0x31')](_0x28909c[_0x990c('0x2d')]['fields']));_0x50c555[_0x990c('0x2f')]=_0x50c555[_0x990c('0x2f')][_0x990c('0x32')]?_0x50c555[_0x990c('0x2f')]:_0x356a4a[_0x990c('0x2c')];if(!_0x28909c[_0x990c('0x2d')][_0x990c('0x33')](_0x990c('0x34'))){_0x50c555[_0x990c('0x1b')]=qs['limit'](_0x28909c[_0x990c('0x2d')][_0x990c('0x1b')]);_0x50c555[_0x990c('0x1a')]=qs[_0x990c('0x1a')](_0x28909c['query']['offset']);}_0x50c555[_0x990c('0x35')]=qs[_0x990c('0x36')](_0x28909c['query']['sort']);_0x50c555[_0x990c('0x37')]=qs['filters'](_[_0x990c('0x38')](_0x28909c['query'],_0x356a4a[_0x990c('0x2e')]),_0x43ca4e);if(_0x28909c[_0x990c('0x2d')][_0x990c('0x39')]){_0x50c555[_0x990c('0x37')]=_[_0x990c('0x3a')](_0x50c555[_0x990c('0x37')],{'$or':_[_0x990c('0x27')](_0x43ca4e,function(_0x4979cf){if(_0x4979cf[_0x990c('0x2a')]!==_0x990c('0x3b')){var _0x148f62={};_0x148f62[_0x4979cf['name']]={'$like':'%'+_0x28909c['query'][_0x990c('0x39')]+'%'};return _0x148f62;}})});}_0x50c555=_['merge']({},_0x50c555,_0x28909c[_0x990c('0x3c')]);var _0x298406={'where':_0x50c555['where']};return db[_0x990c('0x28')]['count'](_0x298406)[_0x990c('0x21')](function(_0x37c0db){_0x53d9ae[_0x990c('0x1d')]=_0x37c0db;if(_0x28909c[_0x990c('0x2d')]['includeAll']){_0x50c555['include']=[{'all':!![]}];}return db[_0x990c('0x28')][_0x990c('0x3d')](_0x50c555);})['then'](function(_0x5a1fbf){_0x53d9ae[_0x990c('0x3e')]=_0x5a1fbf;return _0x53d9ae;})[_0x990c('0x21')](respondWithFilteredResult(_0x5b952f,_0x50c555))[_0x990c('0x3f')](handleError(_0x5b952f,null));};exports[_0x990c('0x40')]=function(_0x351668,_0x13b62c){var _0x3182b9={'raw':!![],'where':{'id':_0x351668[_0x990c('0x41')]['id']}},_0x56adf4={};_0x56adf4[_0x990c('0x2c')]=_[_0x990c('0x42')](db[_0x990c('0x28')][_0x990c('0x43')]);_0x56adf4['query']=_[_0x990c('0x42')](_0x351668[_0x990c('0x2d')]);_0x56adf4[_0x990c('0x2e')]=_[_0x990c('0x30')](_0x56adf4[_0x990c('0x2c')],_0x56adf4[_0x990c('0x2d')]);_0x3182b9[_0x990c('0x2f')]=_[_0x990c('0x30')](_0x56adf4[_0x990c('0x2c')],qs[_0x990c('0x31')](_0x351668[_0x990c('0x2d')][_0x990c('0x31')]));_0x3182b9['attributes']=_0x3182b9['attributes'][_0x990c('0x32')]?_0x3182b9[_0x990c('0x2f')]:_0x56adf4[_0x990c('0x2c')];if(_0x351668[_0x990c('0x2d')][_0x990c('0x44')]){_0x3182b9['include']=[{'all':!![]}];}_0x3182b9=_['merge']({},_0x3182b9,_0x351668[_0x990c('0x3c')]);return db[_0x990c('0x28')][_0x990c('0x45')](_0x3182b9)['then'](handleEntityNotFound(_0x13b62c,null))[_0x990c('0x21')](respondWithResult(_0x13b62c,null))[_0x990c('0x3f')](handleError(_0x13b62c,null));};exports[_0x990c('0x46')]=function(_0x1fce14,_0x361055){return db[_0x990c('0x28')][_0x990c('0x46')](_0x1fce14[_0x990c('0x47')],{})[_0x990c('0x21')](respondWithResult(_0x361055,0xc9))[_0x990c('0x3f')](handleError(_0x361055,null));};exports['update']=function(_0x24963c,_0x826832){if(_0x24963c[_0x990c('0x47')]['id']){delete _0x24963c['body']['id'];}return db[_0x990c('0x28')]['find']({'where':{'id':_0x24963c[_0x990c('0x41')]['id']}})['then'](handleEntityNotFound(_0x826832,null))[_0x990c('0x21')](saveUpdates(_0x24963c[_0x990c('0x47')],null))[_0x990c('0x21')](respondWithResult(_0x826832,null))[_0x990c('0x3f')](handleError(_0x826832,null));};exports[_0x990c('0x48')]=function(_0x3c125f,_0x53ba89){return db['ChatTransferReport'][_0x990c('0x45')]({'where':{'id':_0x3c125f[_0x990c('0x41')]['id']}})[_0x990c('0x21')](handleEntityNotFound(_0x53ba89,null))[_0x990c('0x21')](removeEntity(_0x53ba89,null))[_0x990c('0x3f')](handleError(_0x53ba89,null));};exports['describe']=function(_0x54f610,_0xfbd3ea){return db[_0x990c('0x28')][_0x990c('0x49')]()[_0x990c('0x21')](respondWithResult(_0xfbd3ea,null))[_0x990c('0x3f')](handleError(_0xfbd3ea,null));}; \ No newline at end of file +var _0x27bf=['length','hasOwnProperty','nolimit','order','where','pick','merge','filter','options','includeAll','include','rows','catch','keys','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','lodash','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','offset','undefined','count','limit','Content-Range','apply','save','update','destroy','then','end','sendStatus','error','name','send','map','ChatTransferReport','rawAttributes','type','query','filters','intersection','model','attributes','fields'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x27bf,0x113));var _0xf27b=function(_0x444098,_0x204481){_0x444098=_0x444098-0x0;var _0x12c28c=_0x27bf[_0x444098];return _0x12c28c;};'use strict';var emlformat=require(_0xf27b('0x0'));var rimraf=require(_0xf27b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf27b('0x2'));var rp=require(_0xf27b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf27b('0x4'));var util=require(_0xf27b('0x5'));var path=require('path');var sox=require(_0xf27b('0x6'));var csv=require(_0xf27b('0x7'));var ejs=require(_0xf27b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf27b('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf27b('0xa'));var Redis=require(_0xf27b('0xb'));var authService=require(_0xf27b('0xc'));var qs=require(_0xf27b('0xd'));var as=require(_0xf27b('0xe'));var hardwareService=require(_0xf27b('0xf'));var logger=require('../../config/logger')(_0xf27b('0x10'));var utils=require('../../config/utils');var config=require(_0xf27b('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xf27b('0x12'))['db'];function respondWithStatusCode(_0x2ec729,_0x516ac9){_0x516ac9=_0x516ac9||0xcc;return function(_0x1096eb){if(_0x1096eb){return _0x2ec729['sendStatus'](_0x516ac9);}return _0x2ec729[_0xf27b('0x13')](_0x516ac9)['end']();};}function respondWithResult(_0x527b5f,_0x488606){_0x488606=_0x488606||0xc8;return function(_0x15ad3f){if(_0x15ad3f){return _0x527b5f[_0xf27b('0x13')](_0x488606)['json'](_0x15ad3f);}};}function respondWithFilteredResult(_0x396d4c,_0x52f8a1){return function(_0x4778a2){if(_0x4778a2){var _0x3858dc=typeof _0x52f8a1[_0xf27b('0x14')]===_0xf27b('0x15')&&typeof _0x52f8a1['limit']===_0xf27b('0x15');var _0x218a8a=_0x4778a2[_0xf27b('0x16')];var _0x2d34ac=_0x3858dc?0x0:_0x52f8a1[_0xf27b('0x14')];var _0x49c0a6=_0x3858dc?_0x4778a2[_0xf27b('0x16')]:_0x52f8a1[_0xf27b('0x14')]+_0x52f8a1[_0xf27b('0x17')];var _0x2f3208;if(_0x49c0a6>=_0x218a8a){_0x49c0a6=_0x218a8a;_0x2f3208=0xc8;}else{_0x2f3208=0xce;}_0x396d4c['status'](_0x2f3208);return _0x396d4c['set'](_0xf27b('0x18'),_0x2d34ac+'-'+_0x49c0a6+'/'+_0x218a8a)['json'](_0x4778a2);}return null;};}function patchUpdates(_0x41a7a8){return function(_0x49318c){try{jsonpatch[_0xf27b('0x19')](_0x49318c,_0x41a7a8,!![]);}catch(_0x292f83){return BPromise['reject'](_0x292f83);}return _0x49318c[_0xf27b('0x1a')]();};}function saveUpdates(_0x5a209a,_0x17db84){return function(_0x24d774){if(_0x24d774){return _0x24d774[_0xf27b('0x1b')](_0x5a209a)['then'](function(_0x1c8083){return _0x1c8083;});}return null;};}function removeEntity(_0x43ce08,_0x5cd8e2){return function(_0x4b4ac7){if(_0x4b4ac7){return _0x4b4ac7[_0xf27b('0x1c')]()[_0xf27b('0x1d')](function(){_0x43ce08[_0xf27b('0x13')](0xcc)[_0xf27b('0x1e')]();});}};}function handleEntityNotFound(_0x84b100,_0x39638c){return function(_0x41b769){if(!_0x41b769){_0x84b100[_0xf27b('0x1f')](0x194);}return _0x41b769;};}function handleError(_0x3b69f9,_0x4f18bf){_0x4f18bf=_0x4f18bf||0x1f4;return function(_0xb03cc6){logger[_0xf27b('0x20')](_0xb03cc6['stack']);if(_0xb03cc6[_0xf27b('0x21')]){delete _0xb03cc6[_0xf27b('0x21')];}_0x3b69f9[_0xf27b('0x13')](_0x4f18bf)[_0xf27b('0x22')](_0xb03cc6);};}exports['index']=function(_0x4e9e39,_0x1cb43a){var _0x182ac7={},_0x24993b={},_0x51ccb3={'count':0x0,'rows':[]};var _0x4b8462=_[_0xf27b('0x23')](db[_0xf27b('0x24')][_0xf27b('0x25')],function(_0x51b1f7){return{'name':_0x51b1f7['fieldName'],'type':_0x51b1f7[_0xf27b('0x26')]['key']};});_0x24993b['model']=_['map'](_0x4b8462,'name');_0x24993b[_0xf27b('0x27')]=_['keys'](_0x4e9e39[_0xf27b('0x27')]);_0x24993b[_0xf27b('0x28')]=_[_0xf27b('0x29')](_0x24993b[_0xf27b('0x2a')],_0x24993b[_0xf27b('0x27')]);_0x182ac7[_0xf27b('0x2b')]=_[_0xf27b('0x29')](_0x24993b[_0xf27b('0x2a')],qs[_0xf27b('0x2c')](_0x4e9e39[_0xf27b('0x27')][_0xf27b('0x2c')]));_0x182ac7[_0xf27b('0x2b')]=_0x182ac7['attributes'][_0xf27b('0x2d')]?_0x182ac7[_0xf27b('0x2b')]:_0x24993b[_0xf27b('0x2a')];if(!_0x4e9e39[_0xf27b('0x27')][_0xf27b('0x2e')](_0xf27b('0x2f'))){_0x182ac7[_0xf27b('0x17')]=qs['limit'](_0x4e9e39[_0xf27b('0x27')]['limit']);_0x182ac7['offset']=qs['offset'](_0x4e9e39[_0xf27b('0x27')]['offset']);}_0x182ac7[_0xf27b('0x30')]=qs['sort'](_0x4e9e39[_0xf27b('0x27')]['sort']);_0x182ac7[_0xf27b('0x31')]=qs['filters'](_[_0xf27b('0x32')](_0x4e9e39[_0xf27b('0x27')],_0x24993b[_0xf27b('0x28')]),_0x4b8462);if(_0x4e9e39['query']['filter']){_0x182ac7[_0xf27b('0x31')]=_[_0xf27b('0x33')](_0x182ac7['where'],{'$or':_[_0xf27b('0x23')](_0x4b8462,function(_0x45f8ef){if(_0x45f8ef[_0xf27b('0x26')]!=='VIRTUAL'){var _0x24e22f={};_0x24e22f[_0x45f8ef[_0xf27b('0x21')]]={'$like':'%'+_0x4e9e39[_0xf27b('0x27')][_0xf27b('0x34')]+'%'};return _0x24e22f;}})});}_0x182ac7=_[_0xf27b('0x33')]({},_0x182ac7,_0x4e9e39[_0xf27b('0x35')]);var _0x33f629={'where':_0x182ac7[_0xf27b('0x31')]};return db[_0xf27b('0x24')]['count'](_0x33f629)[_0xf27b('0x1d')](function(_0x378b22){_0x51ccb3[_0xf27b('0x16')]=_0x378b22;if(_0x4e9e39[_0xf27b('0x27')][_0xf27b('0x36')]){_0x182ac7[_0xf27b('0x37')]=[{'all':!![]}];}return db[_0xf27b('0x24')]['findAll'](_0x182ac7);})[_0xf27b('0x1d')](function(_0x2dd3b9){_0x51ccb3[_0xf27b('0x38')]=_0x2dd3b9;return _0x51ccb3;})[_0xf27b('0x1d')](respondWithFilteredResult(_0x1cb43a,_0x182ac7))[_0xf27b('0x39')](handleError(_0x1cb43a,null));};exports['show']=function(_0x513732,_0x3023c6){var _0x5ac0bd={'raw':!![],'where':{'id':_0x513732['params']['id']}},_0x4621f1={};_0x4621f1['model']=_[_0xf27b('0x3a')](db['ChatTransferReport'][_0xf27b('0x25')]);_0x4621f1[_0xf27b('0x27')]=_['keys'](_0x513732['query']);_0x4621f1[_0xf27b('0x28')]=_['intersection'](_0x4621f1[_0xf27b('0x2a')],_0x4621f1[_0xf27b('0x27')]);_0x5ac0bd[_0xf27b('0x2b')]=_[_0xf27b('0x29')](_0x4621f1[_0xf27b('0x2a')],qs[_0xf27b('0x2c')](_0x513732[_0xf27b('0x27')]['fields']));_0x5ac0bd[_0xf27b('0x2b')]=_0x5ac0bd[_0xf27b('0x2b')][_0xf27b('0x2d')]?_0x5ac0bd['attributes']:_0x4621f1[_0xf27b('0x2a')];if(_0x513732[_0xf27b('0x27')]['includeAll']){_0x5ac0bd[_0xf27b('0x37')]=[{'all':!![]}];}_0x5ac0bd=_['merge']({},_0x5ac0bd,_0x513732[_0xf27b('0x35')]);return db['ChatTransferReport'][_0xf27b('0x3b')](_0x5ac0bd)[_0xf27b('0x1d')](handleEntityNotFound(_0x3023c6,null))[_0xf27b('0x1d')](respondWithResult(_0x3023c6,null))[_0xf27b('0x39')](handleError(_0x3023c6,null));};exports[_0xf27b('0x3c')]=function(_0x53a896,_0x40d767){return db[_0xf27b('0x24')][_0xf27b('0x3c')](_0x53a896[_0xf27b('0x3d')],{})[_0xf27b('0x1d')](respondWithResult(_0x40d767,0xc9))['catch'](handleError(_0x40d767,null));};exports[_0xf27b('0x1b')]=function(_0x5a148d,_0x3a3975){if(_0x5a148d['body']['id']){delete _0x5a148d[_0xf27b('0x3d')]['id'];}return db[_0xf27b('0x24')][_0xf27b('0x3b')]({'where':{'id':_0x5a148d['params']['id']}})['then'](handleEntityNotFound(_0x3a3975,null))['then'](saveUpdates(_0x5a148d[_0xf27b('0x3d')],null))[_0xf27b('0x1d')](respondWithResult(_0x3a3975,null))[_0xf27b('0x39')](handleError(_0x3a3975,null));};exports[_0xf27b('0x1c')]=function(_0xcd4b28,_0x3f1921){return db[_0xf27b('0x24')][_0xf27b('0x3b')]({'where':{'id':_0xcd4b28[_0xf27b('0x3e')]['id']}})[_0xf27b('0x1d')](handleEntityNotFound(_0x3f1921,null))[_0xf27b('0x1d')](removeEntity(_0x3f1921,null))[_0xf27b('0x39')](handleError(_0x3f1921,null));};exports[_0xf27b('0x3f')]=function(_0x13d2dd,_0x6942ef){return db['ChatTransferReport']['describe']()[_0xf27b('0x1d')](respondWithResult(_0x6942ef,null))[_0xf27b('0x39')](handleError(_0x6942ef,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 6a165a1..91d883a 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 _0xc4a2=['define','report_chat_transfer','lodash','util','api','moment','bluebird','path','../../config/environment','exports'];(function(_0x404991,_0x5a9865){var _0x429b45=function(_0x3ad6e5){while(--_0x3ad6e5){_0x404991['push'](_0x404991['shift']());}};_0x429b45(++_0x5a9865);}(_0xc4a2,0xfc));var _0x2c4a=function(_0x38a7ee,_0x69abc5){_0x38a7ee=_0x38a7ee-0x0;var _0xcc983=_0xc4a2[_0x38a7ee];return _0xcc983;};'use strict';var _=require(_0x2c4a('0x0'));var util=require(_0x2c4a('0x1'));var logger=require('../../config/logger')(_0x2c4a('0x2'));var moment=require(_0x2c4a('0x3'));var BPromise=require(_0x2c4a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2c4a('0x5'));var rimraf=require('rimraf');var config=require(_0x2c4a('0x6'));var attributes=require('./chatTransferReport.attributes');module[_0x2c4a('0x7')]=function(_0x553a4b,_0x115e11){return _0x553a4b[_0x2c4a('0x8')]('ChatTransferReport',attributes,{'tableName':_0x2c4a('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7c97=['request-promise','path','../../config/environment','exports','report_chat_transfer','uniqueid','lodash','util','api','moment','bluebird'];(function(_0x4f5fbc,_0x74cb4e){var _0x486e0e=function(_0x306829){while(--_0x306829){_0x4f5fbc['push'](_0x4f5fbc['shift']());}};_0x486e0e(++_0x74cb4e);}(_0x7c97,0x1b3));var _0x77c9=function(_0x184268,_0x469663){_0x184268=_0x184268-0x0;var _0x3ef971=_0x7c97[_0x184268];return _0x3ef971;};'use strict';var _=require(_0x77c9('0x0'));var util=require(_0x77c9('0x1'));var logger=require('../../config/logger')(_0x77c9('0x2'));var moment=require(_0x77c9('0x3'));var BPromise=require(_0x77c9('0x4'));var rp=require(_0x77c9('0x5'));var fs=require('fs');var path=require(_0x77c9('0x6'));var rimraf=require('rimraf');var config=require(_0x77c9('0x7'));var attributes=require('./chatTransferReport.attributes');module[_0x77c9('0x8')]=function(_0x2e4e94,_0x4d7039){return _0x2e4e94['define']('ChatTransferReport',attributes,{'tableName':_0x77c9('0x9'),'paranoid':![],'indexes':[{'name':_0x77c9('0xa'),'fields':[_0x77c9('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 29119ce..55dc76c 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 _0x66a1=['then','info','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatTransferReport,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request'];(function(_0x13551e,_0x3a8c79){var _0x55d46f=function(_0x312f35){while(--_0x312f35){_0x13551e['push'](_0x13551e['shift']());}};_0x55d46f(++_0x3a8c79);}(_0x66a1,0xe7));var _0x166a=function(_0x2d0ce6,_0x43a84f){_0x2d0ce6=_0x2d0ce6-0x0;var _0x2b0323=_0x66a1[_0x2d0ce6];return _0x2b0323;};'use strict';var _=require('lodash');var util=require(_0x166a('0x0'));var moment=require(_0x166a('0x1'));var BPromise=require(_0x166a('0x2'));var rs=require(_0x166a('0x3'));var fs=require('fs');var Redis=require(_0x166a('0x4'));var db=require(_0x166a('0x5'))['db'];var utils=require(_0x166a('0x6'));var logger=require('../../config/logger')(_0x166a('0x7'));var config=require('../../config/environment');var jayson=require(_0x166a('0x8'));var client=jayson['client'][_0x166a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x35ea3a,_0x242f55,_0x21f6c9){return new BPromise(function(_0x35d1a1,_0x51fcf0){return client[_0x166a('0xa')](_0x35ea3a,_0x21f6c9)[_0x166a('0xb')](function(_0xe0b6ba){logger[_0x166a('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x242f55,_0x166a('0xd'));logger[_0x166a('0xe')](_0x166a('0xf'),_0x242f55,_0x166a('0xd'),JSON[_0x166a('0x10')](_0xe0b6ba));if(_0xe0b6ba[_0x166a('0x11')]){if(_0xe0b6ba['error'][_0x166a('0x12')]===0x1f4){logger['error'](_0x166a('0x13'),_0x242f55,_0xe0b6ba[_0x166a('0x11')]['message']);return _0x51fcf0(_0xe0b6ba['error'][_0x166a('0x14')]);}logger[_0x166a('0x11')](_0x166a('0x13'),_0x242f55,_0xe0b6ba[_0x166a('0x11')][_0x166a('0x14')]);return _0x35d1a1(_0xe0b6ba[_0x166a('0x11')][_0x166a('0x14')]);}else{logger[_0x166a('0xc')](_0x166a('0x13'),_0x242f55,_0x166a('0xd'));_0x35d1a1(_0xe0b6ba['result']['message']);}})[_0x166a('0x15')](function(_0x5a9abc){logger[_0x166a('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x242f55,_0x5a9abc);_0x51fcf0(_0x5a9abc);});});} \ No newline at end of file +var _0x2277=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','error','code','ChatTransferReport,\x20%s,\x20%s','message','result'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x2277,0x118));var _0x7227=function(_0x6a2c85,_0x52536c){_0x6a2c85=_0x6a2c85-0x0;var _0x3c6723=_0x2277[_0x6a2c85];return _0x3c6723;};'use strict';var _=require(_0x7227('0x0'));var util=require(_0x7227('0x1'));var moment=require(_0x7227('0x2'));var BPromise=require(_0x7227('0x3'));var rs=require(_0x7227('0x4'));var fs=require('fs');var Redis=require(_0x7227('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7227('0x6'));var logger=require(_0x7227('0x7'))('rpc');var config=require(_0x7227('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7227('0x9')][_0x7227('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c7511,_0x17b986,_0x50ec33){return new BPromise(function(_0x424c1b,_0x489415){return client[_0x7227('0xb')](_0x3c7511,_0x50ec33)[_0x7227('0xc')](function(_0x48df56){logger[_0x7227('0xd')]('ChatTransferReport,\x20%s,\x20%s',_0x17b986,_0x7227('0xe'));logger['debug']('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x17b986,'request\x20sent',JSON['stringify'](_0x48df56));if(_0x48df56[_0x7227('0xf')]){if(_0x48df56['error'][_0x7227('0x10')]===0x1f4){logger[_0x7227('0xf')](_0x7227('0x11'),_0x17b986,_0x48df56[_0x7227('0xf')][_0x7227('0x12')]);return _0x489415(_0x48df56[_0x7227('0xf')][_0x7227('0x12')]);}logger[_0x7227('0xf')](_0x7227('0x11'),_0x17b986,_0x48df56[_0x7227('0xf')][_0x7227('0x12')]);return _0x424c1b(_0x48df56[_0x7227('0xf')][_0x7227('0x12')]);}else{logger[_0x7227('0xd')]('ChatTransferReport,\x20%s,\x20%s',_0x17b986,_0x7227('0xe'));_0x424c1b(_0x48df56[_0x7227('0x13')]['message']);}})['catch'](function(_0xb603be){logger[_0x7227('0xf')](_0x7227('0x11'),_0x17b986,_0xb603be);_0x489415(_0xb603be);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index b73282e..ce0ade7 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 _0x542c=['delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put'];(function(_0x3ebeb8,_0x1890da){var _0x1cfc32=function(_0x340e58){while(--_0x340e58){_0x3ebeb8['push'](_0x3ebeb8['shift']());}};_0x1cfc32(++_0x1890da);}(_0x542c,0x8f));var _0xc542=function(_0x9ce333,_0x162dac){_0x9ce333=_0x9ce333-0x0;var _0xde9dcc=_0x542c[_0x9ce333];return _0xde9dcc;};'use strict';var multer=require(_0xc542('0x0'));var util=require('util');var path=require(_0xc542('0x1'));var timeout=require(_0xc542('0x2'));var express=require('express');var router=express[_0xc542('0x3')]();var fs_extra=require(_0xc542('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc542('0x5'));var config=require(_0xc542('0x6'));var controller=require(_0xc542('0x7'));router[_0xc542('0x8')]('/',auth[_0xc542('0x9')](),controller[_0xc542('0xa')]);router[_0xc542('0x8')](_0xc542('0xb'),auth[_0xc542('0x9')](),controller[_0xc542('0xc')]);router[_0xc542('0x8')](_0xc542('0xd'),auth[_0xc542('0x9')](),controller[_0xc542('0xe')]);router[_0xc542('0xf')]('/',auth[_0xc542('0x9')](),controller['create']);router[_0xc542('0x10')]('/:id',auth[_0xc542('0x9')](),controller['update']);router[_0xc542('0x11')](_0xc542('0xd'),auth[_0xc542('0x9')](),controller[_0xc542('0x12')]);module[_0xc542('0x13')]=router; \ No newline at end of file +var _0x02aa=['multer','util','path','express','Router','../../components/auth/service','../../config/environment','get','/describe','describe','/:id','post','isAuthenticated','create','update','delete','destroy','exports'];(function(_0x478414,_0xcf142d){var _0x5eb6b9=function(_0x10e6fe){while(--_0x10e6fe){_0x478414['push'](_0x478414['shift']());}};_0x5eb6b9(++_0xcf142d);}(_0x02aa,0x7e));var _0xa02a=function(_0x4a6a4c,_0x5149d1){_0x4a6a4c=_0x4a6a4c-0x0;var _0xdb0e5b=_0x02aa[_0x4a6a4c];return _0xdb0e5b;};'use strict';var multer=require(_0xa02a('0x0'));var util=require(_0xa02a('0x1'));var path=require(_0xa02a('0x2'));var timeout=require('connect-timeout');var express=require(_0xa02a('0x3'));var router=express[_0xa02a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa02a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa02a('0x6'));var controller=require('./chatTransferReport.controller');router[_0xa02a('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xa02a('0x8'),auth['isAuthenticated'](),controller[_0xa02a('0x9')]);router[_0xa02a('0x7')](_0xa02a('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xa02a('0xb')]('/',auth[_0xa02a('0xc')](),controller[_0xa02a('0xd')]);router['put'](_0xa02a('0xa'),auth[_0xa02a('0xc')](),controller[_0xa02a('0xe')]);router[_0xa02a('0xf')](_0xa02a('0xa'),auth[_0xa02a('0xc')](),controller[_0xa02a('0x10')]);module[_0xa02a('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 986c55e..40d0316 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 _0x55e0=['CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','sequelize','randomstring','exports','STRING','email','#011F6A','#ffffff','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','Thanks\x20you\x20for\x20your\x20time!','Feedback','star','thumb','stringify','name','text','input','getDataValue','onlineForm','parse','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right'];(function(_0x241d8b,_0xbc727d){var _0xa8e555=function(_0x46d325){while(--_0x46d325){_0x241d8b['push'](_0x241d8b['shift']());}};_0xa8e555(++_0xbc727d);}(_0x55e0,0xdc));var _0x055e=function(_0x3d63f6,_0x8cd7e4){_0x3d63f6=_0x3d63f6-0x0;var _0x2ac67b=_0x55e0[_0x3d63f6];return _0x2ac67b;};'use strict';var Sequelize=require(_0x055e('0x0'));var rs=require(_0x055e('0x1'));module[_0x055e('0x2')]={'name':{'type':Sequelize[_0x055e('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x055e('0x3')]},'mapKey':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x4')},'mapKeyOffline':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x4')},'key':{'type':Sequelize[_0x055e('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x055e('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x055e('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x055e('0x3')],'allowNull':![],'defaultValue':_0x055e('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x055e('0x3')],'allowNull':![],'defaultValue':_0x055e('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x055e('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x055e('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x055e('0x3')]},'animation':{'type':Sequelize[_0x055e('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x055e('0x9')]('rounded','squared'),'defaultValue':_0x055e('0xa')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0xb')},'start_chat_button':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0xc')},'offline_chat_button':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0xd')},'header_offline':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0xe')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x055e('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0x055e('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x055e('0x10')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x12')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0x13')},'noteTitle':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x14')},'placeholderMessage':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x15')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0x16')},'closingMessageButton':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0xd')},'skipMessageButton':{'type':Sequelize[_0x055e('0x3')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x17')},'ratingType':{'type':Sequelize[_0x055e('0x9')](_0x055e('0x18'),_0x055e('0x19')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x055e('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x055e('0x10')],'defaultValue':function(){return JSON[_0x055e('0x1a')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x055e('0x1b'),'type':_0x055e('0x1c'),'required':!![]},'props':{'title':_0x055e('0x1b'),'helpText':''}},{'type':_0x055e('0x1d'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x055e('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x055e('0x1e')](_0x055e('0x1f'))?JSON[_0x055e('0x20')](this[_0x055e('0x1e')](_0x055e('0x1f'))):{};},'set':function(_0x4c653c){return this['setDataValue'](_0x055e('0x1f'),JSON[_0x055e('0x1a')](_0x4c653c));}},'offlineForm':{'type':Sequelize[_0x055e('0x10')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x055e('0x1d'),'props':{'title':_0x055e('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x055e('0x4'),'type':_0x055e('0x4')},'variable':null},{'type':'textarea','config':{'placeholder':_0x055e('0x21')},'props':{'title':'Comments','helpText':_0x055e('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0x055e('0x1e')](_0x055e('0x23'))?JSON[_0x055e('0x20')](this[_0x055e('0x1e')]('offlineForm')):{};},'set':function(_0x99a372){return this[_0x055e('0x24')](_0x055e('0x23'),JSON[_0x055e('0x1a')](_0x99a372));}},'token':{'type':Sequelize[_0x055e('0x3')],'defaultValue':function(){return rs[_0x055e('0x25')]();}},'autoclose':{'type':Sequelize[_0x055e('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x055e('0x3')]},'forwardOffline':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x26')},'waitingMessage':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x27')},'offlineMessageSubject':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x28')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x055e('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0x29')},'sendUnmanaged':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x055e('0x10')]},'showAgentAvatar':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x055e('0x3')]},'notificationTemplate':{'type':Sequelize[_0x055e('0x10')],'defaultValue':function(){return _0x055e('0x2a');}},'notificationSound':{'type':Sequelize[_0x055e('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0x055e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x2c')},'verticalAlignment':{'type':Sequelize[_0x055e('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x2d')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0x2e')},'defaultTitle':{'type':Sequelize[_0x055e('0x3')]},'customerAvatar':{'type':Sequelize[_0x055e('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x055e('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x055e('0x2f'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x055e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0x30')},'systemAvatar':{'type':Sequelize[_0x055e('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x055e('0x31')},'mandatoryDisposition':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1012a4){if(!_0x1012a4)this[_0x055e('0x24')](_0x055e('0x32'),null);this['setDataValue'](_0x055e('0x33'),_0x1012a4);}},'vidaooEscalation':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0x055e('0x3')],'allowNull':![],'defaultValue':_0x055e('0x34')},'vidaooNote':{'type':Sequelize[_0x055e('0x3')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0x055e('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x055e('0x10')]}}; \ No newline at end of file +var _0x153f=['Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','ENUM','star','thumb','stringify','input','name','text','getDataValue','onlineForm','parse','setDataValue','Comments','Leave\x20your\x20comments','offlineForm','generate','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us'];(function(_0x5a7908,_0x439d2c){var _0x4c7ea4=function(_0x2ce091){while(--_0x2ce091){_0x5a7908['push'](_0x5a7908['shift']());}};_0x4c7ea4(++_0x439d2c);}(_0x153f,0x15b));var _0xf153=function(_0x3af013,_0x1ac017){_0x3af013=_0x3af013-0x0;var _0x5d23f5=_0x153f[_0x3af013];return _0x5d23f5;};'use strict';var Sequelize=require(_0xf153('0x0'));var rs=require(_0xf153('0x1'));module[_0xf153('0x2')]={'name':{'type':Sequelize[_0xf153('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0xf153('0x3')],'allowNull':![],'unique':_0xf153('0x4')},'description':{'type':Sequelize[_0xf153('0x3')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xf153('0x5')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xf153('0x5')},'key':{'type':Sequelize[_0xf153('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0x6')},'customerAlias':{'type':Sequelize[_0xf153('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf153('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xf153('0x3')],'allowNull':![],'defaultValue':_0xf153('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xf153('0x3')],'allowNull':![],'defaultValue':_0xf153('0x8'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xf153('0x3')],'allowNull':![],'defaultValue':_0xf153('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xf153('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xf153('0x3')]},'animation':{'type':Sequelize[_0xf153('0xa')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0xf153('0xb'),_0xf153('0xc')),'defaultValue':_0xf153('0xb')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0xf153('0xd')},'start_chat_button':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0xe')},'offline_chat_button':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0xf')},'header_offline':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0x10')},'download_transcript':{'type':Sequelize[_0xf153('0xa')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xf153('0x9')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0xf153('0x11')},'defaultWhiteLabel':{'type':Sequelize[_0xf153('0xa')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xf153('0x12')]},'closingQuestion':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0x13')},'formSubmitSuccessMessage':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0x14')},'formSubmitFailureMessage':{'type':Sequelize[_0xf153('0x3')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0xf153('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0x15')},'closingMessage':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0x16')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xf153('0xf')},'skipMessageButton':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0x17')},'conditionAgreement':{'type':Sequelize[_0xf153('0xa')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xf153('0xa')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xf153('0xa')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xf153('0xa')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0x18')},'ratingType':{'type':Sequelize[_0xf153('0x19')](_0xf153('0x1a'),_0xf153('0x1b')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0xf153('0x9')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xf153('0x12')],'defaultValue':function(){return JSON[_0xf153('0x1c')]({'items':[{'type':_0xf153('0x1d'),'variable':null,'config':{'placeholder':_0xf153('0x1e'),'type':_0xf153('0x1f'),'required':!![]},'props':{'title':_0xf153('0x1e'),'helpText':''}},{'type':_0xf153('0x1d'),'props':{'title':_0xf153('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0xf153('0x5'),'type':_0xf153('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xf153('0x20')](_0xf153('0x21'))?JSON[_0xf153('0x22')](this[_0xf153('0x20')](_0xf153('0x21'))):{};},'set':function(_0x141ef4){return this[_0xf153('0x23')](_0xf153('0x21'),JSON[_0xf153('0x1c')](_0x141ef4));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xf153('0x1c')]({'items':[{'type':_0xf153('0x1d'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xf153('0x5'),'type':_0xf153('0x5')},'variable':null},{'type':'textarea','config':{'placeholder':_0xf153('0x24')},'props':{'title':_0xf153('0x24'),'helpText':_0xf153('0x25')}}],'fromKey':0x0});},'get':function(){return this[_0xf153('0x20')](_0xf153('0x26'))?JSON[_0xf153('0x22')](this[_0xf153('0x20')](_0xf153('0x26'))):{};},'set':function(_0x19a568){return this[_0xf153('0x23')](_0xf153('0x26'),JSON[_0xf153('0x1c')](_0x19a568));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xf153('0x27')]();}},'autoclose':{'type':Sequelize[_0xf153('0xa')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xf153('0xa')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xf153('0xa')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xf153('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0xf153('0x3')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0xf153('0x3')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0x28')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0x29')},'skipUnmanaged':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0x17')},'sendUnmanaged':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0xf')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xf153('0xa')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0xf153('0xa')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xf153('0x3')]},'notificationTemplate':{'type':Sequelize[_0xf153('0x12')],'defaultValue':function(){return _0xf153('0x2a');}},'notificationSound':{'type':Sequelize[_0xf153('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf153('0xa')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0xf153('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0xf153('0x2c')},'verticalAlignment':{'type':Sequelize[_0xf153('0x9')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0x2d')},'messagesAlignment':{'type':Sequelize[_0xf153('0x3')],'defaultValue':_0xf153('0x2e')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0xf153('0x12')]},'showCustomerAvatar':{'type':Sequelize[_0xf153('0xa')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xf153('0x3')],'allowNull':![],'defaultValue':_0xf153('0x2f'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xf153('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf153('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf153('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf153('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xf153('0x3')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0xf153('0x12')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf153('0x9')],'comment':_0xf153('0x30')},'mandatoryDisposition':{'type':Sequelize[_0xf153('0xa')],'defaultValue':![],'comment':_0xf153('0x31'),'set':function(_0x1ee606){if(!_0x1ee606)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xf153('0x23')]('mandatoryDisposition',_0x1ee606);}},'vidaooEscalation':{'type':Sequelize[_0xf153('0xa')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xf153('0x3')]},'vidaooTopic':{'type':Sequelize[_0xf153('0x3')],'allowNull':![],'defaultValue':_0xf153('0x32')},'vidaooNote':{'type':Sequelize[_0xf153('0x3')],'defaultValue':function(){return _0xf153('0x33');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xf153('0x12')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 6e7a58f..969ca17 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 _0x79c5=['server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','user-agent-parser','setUA','headers','user-agent','chat','CmContact','Sequelize','difference','createdAt','updatedAt','CompanyId','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','ChatApplication','Applications','account','applications','list','priority','asc','Contacts','ListId','customerIp','cf-connecting-ip','first','x-forwarded-for','split','firstName','x-real-port','referer','version','%s\x20%s','browser','unknown','format','device','vendor','%s\x20%s\x20%s','threadId','externalUrl','ChatInteraction','ContactId','interaction','spread','contact','messageId','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager','offline','files','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','fromString','originalname','mimetype','server','attachments','offline-chat','openNewInteraction','sequelize','transaction','Attachment','CloudProvider','Smtp','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','email','offlineMessageSubject','subjectOffline','toPairsIn','Chat','MailAccountId','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','ids','getInteractions','Contact','User','Owner','fullname','internal','Tag','color','tag','Command','getSnippet','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','ONLINE','OFFLINE','timezone','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','Interval','Intervals','getProactiveActions','virtual','custom','License','all','some','server/files/chat/iframe.ejs','utf8','URL','address','origin','x-real-ip','connection','remoteAddress','replace','alignment','verticalAlignment','textColor','hideWhenOffline','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','chatProactiveAction','addProactiveActions','omit','getFields','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','addAgents','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','util','path','ejs','fs-extra','lodash','querystring','../../components/parsers/qs','api','../../config/environment','url','../../mysqldb','redis','defaults','localhost','./chatWebsite.socket','register','html-to-text','jayson/promise','client','http','then','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatWebsite,\x20%s,\x20%s','info','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','get','ChatWebsites','UserProfileResource','destroy','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','type','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','removeDispositions','CannedAnswer','findOne','removeAnswers','addLogo','file','filename','agentAvatar','addCustomerAvatar','addSystemAvatar','join','root','sitepic','../../config/license/util','getLicense','isNil','existsSync'];(function(_0x4c5205,_0x14084a){var _0x114f3d=function(_0x2408f3){while(--_0x2408f3){_0x4c5205['push'](_0x4c5205['shift']());}};_0x114f3d(++_0x14084a);}(_0x79c5,0xb8));var _0x579c=function(_0x2f77d6,_0x815a1d){_0x2f77d6=_0x2f77d6-0x0;var _0x5bf9eb=_0x79c5[_0x2f77d6];return _0x5bf9eb;};'use strict';var BPromise=require(_0x579c('0x0'));var Mustache=require('mustache');var util=require(_0x579c('0x1'));var path=require(_0x579c('0x2'));var ejs=require(_0x579c('0x3'));var fs=require('fs');var fs_extra=require(_0x579c('0x4'));var _=require(_0x579c('0x5'));var querystring=require(_0x579c('0x6'));var Redis=require('ioredis');var qs=require(_0x579c('0x7'));var logger=require('../../config/logger')(_0x579c('0x8'));var config=require(_0x579c('0x9'));var url=require(_0x579c('0xa'));var db=require(_0x579c('0xb'))['db'];config[_0x579c('0xc')]=_[_0x579c('0xd')](config['redis'],{'host':_0x579c('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x579c('0xc')]));require(_0x579c('0xf'))[_0x579c('0x10')](socket);var htmlToText=require(_0x579c('0x11'));var jayson=require(_0x579c('0x12'));var client=jayson[_0x579c('0x13')][_0x579c('0x14')]({'port':0x232c});var client9002=jayson[_0x579c('0x13')][_0x579c('0x14')]({'port':0x232a});var client9003=jayson[_0x579c('0x13')][_0x579c('0x14')]({'port':0x232b});var client9001=jayson[_0x579c('0x13')][_0x579c('0x14')]({'port':0x2329});function respondWithRpcPromise(_0x57e32c,_0x3ed642,_0x71298,_0xea3ff4){return new BPromise(function(_0x293380,_0x5a47ea){var _0xcf9c1b=_0xea3ff4||client;return _0xcf9c1b['request'](_0x57e32c,_0x71298)[_0x579c('0x15')](function(_0x257ea5){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x3ed642,_0x579c('0x16'));logger['debug'](_0x579c('0x17'),_0x3ed642,'request\x20sent',JSON[_0x579c('0x18')](_0x257ea5));if(_0x257ea5['error']){if(_0x257ea5[_0x579c('0x19')][_0x579c('0x1a')]===0x1f4){logger[_0x579c('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x3ed642,_0x257ea5[_0x579c('0x19')][_0x579c('0x1b')]);return _0x5a47ea(_0x257ea5[_0x579c('0x19')][_0x579c('0x1b')]);}logger['error'](_0x579c('0x1c'),_0x3ed642,_0x257ea5[_0x579c('0x19')][_0x579c('0x1b')]);return _0x293380(_0x257ea5[_0x579c('0x19')][_0x579c('0x1b')]);}else{logger[_0x579c('0x1d')](_0x579c('0x1c'),_0x3ed642,_0x579c('0x16'));_0x293380(_0x257ea5[_0x579c('0x1e')][_0x579c('0x1b')]);}})[_0x579c('0x1f')](function(_0x50a4e6){logger[_0x579c('0x19')](_0x579c('0x1c'),_0x3ed642,_0x50a4e6);_0x5a47ea(_0x50a4e6);});});}function respondWithStatusCode(_0x5a68d9,_0x5a2b0a){_0x5a2b0a=_0x5a2b0a||0xcc;return function(_0x422bc0){if(_0x422bc0){return _0x5a68d9[_0x579c('0x20')](_0x5a2b0a);}return _0x5a68d9[_0x579c('0x21')](_0x5a2b0a)['end']();};}function respondWithResult(_0x4662a9,_0x425a6e){_0x425a6e=_0x425a6e||0xc8;return function(_0x32e2a9){if(_0x32e2a9){return _0x4662a9[_0x579c('0x21')](_0x425a6e)[_0x579c('0x22')](_0x32e2a9);}};}function respondWithFilteredResult(_0x5e7c02,_0x45dde4){return function(_0x2c7991){if(_0x2c7991){var _0x2bdca1=typeof _0x45dde4[_0x579c('0x23')]===_0x579c('0x24')&&typeof _0x45dde4[_0x579c('0x25')]===_0x579c('0x24');var _0x1419c2=_0x2c7991[_0x579c('0x26')];var _0x24441f=_0x2bdca1?0x0:_0x45dde4[_0x579c('0x23')];var _0x459147=_0x2bdca1?_0x2c7991[_0x579c('0x26')]:_0x45dde4[_0x579c('0x23')]+_0x45dde4['limit'];var _0x227518;if(_0x459147>=_0x1419c2){_0x459147=_0x1419c2;_0x227518=0xc8;}else{_0x227518=0xce;}_0x5e7c02[_0x579c('0x21')](_0x227518);return _0x5e7c02[_0x579c('0x27')](_0x579c('0x28'),_0x24441f+'-'+_0x459147+'/'+_0x1419c2)[_0x579c('0x22')](_0x2c7991);}return null;};}function saveUpdates(_0x2d52fd){return function(_0x1dc749){if(_0x1dc749){return _0x1dc749[_0x579c('0x29')](_0x2d52fd)[_0x579c('0x15')](function(_0x1636f5){return _0x1636f5;});}return null;};}function removeEntity(_0x5e7398){return function(_0x38bad8){if(_0x38bad8){return _0x38bad8['destroy']()['then'](function(){var _0x3808d2=_0x38bad8[_0x579c('0x2a')]({'plain':!![]});var _0xd2082a=_0x579c('0x2b');return db[_0x579c('0x2c')][_0x579c('0x2d')]({'where':{'type':_0xd2082a,'resourceId':_0x3808d2['id']}})[_0x579c('0x15')](function(){return _0x38bad8;});})[_0x579c('0x15')](function(){_0x5e7398[_0x579c('0x21')](0xcc)[_0x579c('0x2e')]();});}};}function handleEntityNotFound(_0x37f906){return function(_0x4da111){if(!_0x4da111){_0x37f906[_0x579c('0x20')](0x194);}return _0x4da111;};}function handleError(_0x22ebb8,_0x3e2d2a){_0x3e2d2a=_0x3e2d2a||0x1f4;return function(_0x37d435){logger['error'](_0x37d435[_0x579c('0x2f')]);if(_0x37d435[_0x579c('0x30')]){delete _0x37d435['name'];}_0x22ebb8[_0x579c('0x21')](_0x3e2d2a)[_0x579c('0x31')](_0x37d435);};}exports[_0x579c('0x32')]=function(_0x694e00,_0x4526e3){var _0x11fd07={'include':[{'model':db[_0x579c('0x33')],'as':_0x579c('0x34')}]},_0x5de068={},_0x3658c4={'count':0x0,'rows':[]};var _0xf2b444=_[_0x579c('0x35')](db[_0x579c('0x36')][_0x579c('0x37')],function(_0x5407e1){return{'name':_0x5407e1['fieldName'],'type':_0x5407e1[_0x579c('0x38')][_0x579c('0x39')]};});_0x5de068['model']=_[_0x579c('0x35')](_0xf2b444,'name');_0x5de068['query']=_[_0x579c('0x3a')](_0x694e00['query']);_0x5de068[_0x579c('0x3b')]=_[_0x579c('0x3c')](_0x5de068[_0x579c('0x3d')],_0x5de068[_0x579c('0x3e')]);_0x11fd07[_0x579c('0x3f')]=_[_0x579c('0x3c')](_0x5de068[_0x579c('0x3d')],qs[_0x579c('0x40')](_0x694e00[_0x579c('0x3e')][_0x579c('0x40')]));_0x11fd07[_0x579c('0x3f')]=_0x11fd07['attributes'][_0x579c('0x41')]?_0x11fd07[_0x579c('0x3f')]:_0x5de068['model'];if(!_0x694e00[_0x579c('0x3e')][_0x579c('0x42')](_0x579c('0x43'))){_0x11fd07[_0x579c('0x25')]=qs[_0x579c('0x25')](_0x694e00[_0x579c('0x3e')][_0x579c('0x25')]);_0x11fd07[_0x579c('0x23')]=qs[_0x579c('0x23')](_0x694e00['query'][_0x579c('0x23')]);}_0x11fd07[_0x579c('0x44')]=qs[_0x579c('0x45')](_0x694e00[_0x579c('0x3e')][_0x579c('0x45')]);_0x11fd07[_0x579c('0x46')]=qs['filters'](_[_0x579c('0x47')](_0x694e00[_0x579c('0x3e')],_0x5de068['filters']),_0xf2b444);if(_0x694e00[_0x579c('0x3e')][_0x579c('0x48')]){_0x11fd07[_0x579c('0x46')]=_[_0x579c('0x49')](_0x11fd07[_0x579c('0x46')],{'$or':_[_0x579c('0x35')](_0xf2b444,function(_0x3e0856){if(_0x3e0856[_0x579c('0x38')]!==_0x579c('0x4a')){var _0x3583bb={};_0x3583bb[_0x3e0856['name']]={'$like':'%'+_0x694e00[_0x579c('0x3e')]['filter']+'%'};return _0x3583bb;}})});}_0x11fd07=_[_0x579c('0x49')]({},_0x11fd07,_0x694e00['options']);var _0x112d42={'where':_0x11fd07[_0x579c('0x46')]};return db[_0x579c('0x36')][_0x579c('0x26')](_0x112d42)[_0x579c('0x15')](function(_0xe8baf3){_0x3658c4[_0x579c('0x26')]=_0xe8baf3;if(_0x694e00[_0x579c('0x3e')][_0x579c('0x4b')]){_0x11fd07[_0x579c('0x4c')]=[{'all':!![]}];}return db['ChatWebsite'][_0x579c('0x4d')](_0x11fd07);})['then'](function(_0x3a7e19){_0x3658c4[_0x579c('0x4e')]=_0x3a7e19;return _0x3658c4;})[_0x579c('0x15')](respondWithFilteredResult(_0x4526e3,_0x11fd07))['catch'](handleError(_0x4526e3,null));};exports[_0x579c('0x4f')]=function(_0x4b424f,_0x4a8ed1){var _0x28497b={'raw':![],'where':{'id':_0x4b424f[_0x579c('0x50')]['id']},'include':[{'model':db[_0x579c('0x33')],'as':_0x579c('0x34')}]},_0x4064df={};_0x4064df['model']=_[_0x579c('0x3a')](db[_0x579c('0x36')][_0x579c('0x37')]);_0x4064df[_0x579c('0x3e')]=_[_0x579c('0x3a')](_0x4b424f[_0x579c('0x3e')]);_0x4064df[_0x579c('0x3b')]=_[_0x579c('0x3c')](_0x4064df[_0x579c('0x3d')],_0x4064df['query']);_0x28497b[_0x579c('0x3f')]=_['intersection'](_0x4064df[_0x579c('0x3d')],qs[_0x579c('0x40')](_0x4b424f[_0x579c('0x3e')][_0x579c('0x40')]));_0x28497b['attributes']=_0x28497b[_0x579c('0x3f')][_0x579c('0x41')]?_0x28497b[_0x579c('0x3f')]:_0x4064df[_0x579c('0x3d')];if(_0x4b424f['query'][_0x579c('0x4b')]){_0x28497b['include']=[{'all':!![]}];}_0x28497b=_[_0x579c('0x49')]({},_0x28497b,_0x4b424f[_0x579c('0x51')]);return db[_0x579c('0x36')][_0x579c('0x52')](_0x28497b)[_0x579c('0x15')](handleEntityNotFound(_0x4a8ed1,null))[_0x579c('0x15')](respondWithResult(_0x4a8ed1,null))['catch'](handleError(_0x4a8ed1,null));};exports[_0x579c('0x53')]=function(_0x2ea34a,_0x3e8200){return db['ChatWebsite'][_0x579c('0x53')](_0x2ea34a[_0x579c('0x54')],{})[_0x579c('0x15')](function(_0x333d45){var _0x301880=_0x2ea34a[_0x579c('0x55')][_0x579c('0x2a')]({'plain':!![]});if(!_0x301880)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x301880[_0x579c('0x56')]===_0x579c('0x55')){var _0x5eeef7=_0x333d45[_0x579c('0x2a')]({'plain':!![]});var _0x39ff7d=_0x579c('0x2b');return db[_0x579c('0x57')][_0x579c('0x52')]({'where':{'name':_0x39ff7d,'userProfileId':_0x301880[_0x579c('0x58')]},'raw':!![]})['then'](function(_0x288e4f){if(_0x288e4f&&_0x288e4f[_0x579c('0x59')]===0x0){return db[_0x579c('0x2c')][_0x579c('0x53')]({'name':_0x5eeef7[_0x579c('0x30')],'resourceId':_0x5eeef7['id'],'type':_0x288e4f[_0x579c('0x30')],'sectionId':_0x288e4f['id']},{})['then'](function(){return _0x333d45;});}else{return _0x333d45;}})[_0x579c('0x1f')](function(_0x332724){logger[_0x579c('0x19')](_0x579c('0x5a'),_0x332724);throw _0x332724;});}return _0x333d45;})['then'](respondWithResult(_0x3e8200,0xc9))[_0x579c('0x1f')](handleError(_0x3e8200,null));};exports['update']=function(_0x1afed4,_0x103964){if(_0x1afed4['body']['id']){delete _0x1afed4[_0x579c('0x54')]['id'];}return db[_0x579c('0x36')][_0x579c('0x52')]({'where':{'id':_0x1afed4['params']['id']},'include':[{'model':db['Pause'],'as':_0x579c('0x34')}]})[_0x579c('0x15')](handleEntityNotFound(_0x103964,null))['then'](saveUpdates(_0x1afed4[_0x579c('0x54')],null))[_0x579c('0x15')](respondWithResult(_0x103964,null))['catch'](handleError(_0x103964,null));};exports[_0x579c('0x2d')]=function(_0x3da66e,_0x2359ad){return db[_0x579c('0x36')][_0x579c('0x52')]({'where':{'id':_0x3da66e['params']['id']}})[_0x579c('0x15')](handleEntityNotFound(_0x2359ad,null))[_0x579c('0x15')](removeEntity(_0x2359ad,null))[_0x579c('0x1f')](handleError(_0x2359ad,null));};exports[_0x579c('0x5b')]=function(_0x55ee02,_0x3b010d){return db[_0x579c('0x36')][_0x579c('0x5b')]()[_0x579c('0x15')](respondWithResult(_0x3b010d,null))[_0x579c('0x1f')](handleError(_0x3b010d,null));};exports[_0x579c('0x5c')]=function(_0x417f90,_0x50878f){if(_0x417f90['body']['id']){delete _0x417f90[_0x579c('0x54')]['id'];}return db['ChatWebsite'][_0x579c('0x52')]({'where':{'id':_0x417f90[_0x579c('0x50')]['id']}})['then'](handleEntityNotFound(_0x50878f,null))[_0x579c('0x15')](function(_0x3b37cd){if(_0x3b37cd){_0x417f90[_0x579c('0x54')][_0x579c('0x5d')]=_0x3b37cd['id'];return db[_0x579c('0x5e')]['create'](_0x417f90['body']);}})[_0x579c('0x15')](respondWithResult(_0x50878f,null))[_0x579c('0x1f')](handleError(_0x50878f,null));};exports[_0x579c('0x5f')]=function(_0x15c8db,_0x533ca5){var _0x446f4d={'raw':![],'where':{}};var _0xef0072={};var _0xa96ec4={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x15c8db[_0x579c('0x50')]['id']}})[_0x579c('0x15')](handleEntityNotFound(_0x533ca5,null))[_0x579c('0x15')](function(_0x33edfc){if(_0x33edfc){_0xef0072['model']=_[_0x579c('0x3a')](db[_0x579c('0x5e')][_0x579c('0x37')]);_0xef0072['query']=_[_0x579c('0x3a')](_0x15c8db[_0x579c('0x3e')]);_0xef0072[_0x579c('0x3b')]=_[_0x579c('0x3c')](_0xef0072['model'],_0xef0072[_0x579c('0x3e')]);_0x446f4d[_0x579c('0x3f')]=_[_0x579c('0x3c')](_0xef0072['model'],qs['fields'](_0x15c8db[_0x579c('0x3e')][_0x579c('0x40')]));_0x446f4d[_0x579c('0x3f')]=_0x446f4d[_0x579c('0x3f')][_0x579c('0x41')]?_0x446f4d[_0x579c('0x3f')]:_0xef0072[_0x579c('0x3d')];if(!_0x15c8db[_0x579c('0x3e')][_0x579c('0x42')]('nolimit')){_0x446f4d[_0x579c('0x25')]=qs[_0x579c('0x25')](_0x15c8db[_0x579c('0x3e')][_0x579c('0x25')]);_0x446f4d[_0x579c('0x23')]=qs[_0x579c('0x23')](_0x15c8db[_0x579c('0x3e')][_0x579c('0x23')]);}_0x446f4d[_0x579c('0x44')]=qs['sort'](_0x15c8db[_0x579c('0x3e')]['sort']);_0x446f4d[_0x579c('0x46')]=qs[_0x579c('0x3b')](_[_0x579c('0x47')](_0x15c8db['query'],_0xef0072[_0x579c('0x3b')]));_0x446f4d[_0x579c('0x46')][_0x579c('0x5d')]=_0x33edfc['id'];if(_0x15c8db[_0x579c('0x3e')]['filter']){_0x446f4d[_0x579c('0x46')]=_[_0x579c('0x49')](_0x446f4d[_0x579c('0x46')],{'$or':_['map'](_0x446f4d[_0x579c('0x3f')],function(_0x3fb859){var _0x1a63b5={};_0x1a63b5[_0x3fb859]={'$like':'%'+_0x15c8db[_0x579c('0x3e')][_0x579c('0x48')]+'%'};return _0x1a63b5;})});}_0x446f4d=_['merge']({},_0x446f4d,_0x15c8db[_0x579c('0x51')]);return db['Disposition'][_0x579c('0x26')]({'where':_0x446f4d['where']})[_0x579c('0x15')](function(_0x10cd13){_0xa96ec4[_0x579c('0x26')]=_0x10cd13;if(_0x15c8db[_0x579c('0x3e')][_0x579c('0x4b')]){_0x446f4d['include']=[{'all':!![]}];}return db[_0x579c('0x5e')][_0x579c('0x4d')](_0x446f4d);})[_0x579c('0x15')](function(_0xc8becf){_0xa96ec4[_0x579c('0x4e')]=_0xc8becf;return _0xa96ec4;});}})['then'](respondWithFilteredResult(_0x533ca5,_0x446f4d))['catch'](handleError(_0x533ca5,null));};exports[_0x579c('0x60')]=function(_0x17aa5d,_0x10aa11){return db[_0x579c('0x36')][_0x579c('0x52')]({'where':{'id':_0x17aa5d['params']['id']}})[_0x579c('0x15')](handleEntityNotFound(_0x10aa11,null))['then'](function(_0x50dad3){if(_0x50dad3){return _0x50dad3[_0x579c('0x60')](_0x17aa5d[_0x579c('0x3e')]['ids']);}})['then'](respondWithStatusCode(_0x10aa11,null))[_0x579c('0x1f')](handleError(_0x10aa11,null));};exports['addAnswer']=function(_0x3d733f,_0x4d745c){if(_0x3d733f['body']['id']){delete _0x3d733f[_0x579c('0x54')]['id'];}return db['ChatWebsite'][_0x579c('0x52')]({'where':{'id':_0x3d733f[_0x579c('0x50')]['id']}})[_0x579c('0x15')](handleEntityNotFound(_0x4d745c,null))[_0x579c('0x15')](function(_0x3377b8){if(_0x3377b8){_0x3d733f[_0x579c('0x54')][_0x579c('0x5d')]=_0x3377b8['id'];return db[_0x579c('0x61')][_0x579c('0x53')](_0x3d733f[_0x579c('0x54')]);}})[_0x579c('0x15')](respondWithResult(_0x4d745c,null))[_0x579c('0x1f')](handleError(_0x4d745c,null));};exports['getAnswers']=function(_0x2d2b26,_0x3d55e4){var _0x5ba109={'raw':![],'where':{}};var _0x354c7d={};var _0x36e10d={'count':0x0,'rows':[]};return db[_0x579c('0x36')][_0x579c('0x62')]({'where':{'id':_0x2d2b26[_0x579c('0x50')]['id']}})['then'](handleEntityNotFound(_0x3d55e4,null))[_0x579c('0x15')](function(_0xcf5a3d){if(_0xcf5a3d){_0x354c7d[_0x579c('0x3d')]=_[_0x579c('0x3a')](db[_0x579c('0x61')][_0x579c('0x37')]);_0x354c7d['query']=_['keys'](_0x2d2b26[_0x579c('0x3e')]);_0x354c7d[_0x579c('0x3b')]=_[_0x579c('0x3c')](_0x354c7d[_0x579c('0x3d')],_0x354c7d[_0x579c('0x3e')]);_0x5ba109[_0x579c('0x3f')]=_[_0x579c('0x3c')](_0x354c7d[_0x579c('0x3d')],qs['fields'](_0x2d2b26[_0x579c('0x3e')][_0x579c('0x40')]));_0x5ba109['attributes']=_0x5ba109[_0x579c('0x3f')][_0x579c('0x41')]?_0x5ba109[_0x579c('0x3f')]:_0x354c7d[_0x579c('0x3d')];if(!_0x2d2b26[_0x579c('0x3e')][_0x579c('0x42')](_0x579c('0x43'))){_0x5ba109[_0x579c('0x25')]=qs[_0x579c('0x25')](_0x2d2b26[_0x579c('0x3e')][_0x579c('0x25')]);_0x5ba109[_0x579c('0x23')]=qs[_0x579c('0x23')](_0x2d2b26[_0x579c('0x3e')][_0x579c('0x23')]);}_0x5ba109[_0x579c('0x44')]=qs[_0x579c('0x45')](_0x2d2b26[_0x579c('0x3e')][_0x579c('0x45')]);_0x5ba109['where']=qs[_0x579c('0x3b')](_[_0x579c('0x47')](_0x2d2b26[_0x579c('0x3e')],_0x354c7d[_0x579c('0x3b')]));_0x5ba109[_0x579c('0x46')][_0x579c('0x5d')]=_0xcf5a3d['id'];if(_0x2d2b26['query']['filter']){_0x5ba109[_0x579c('0x46')]=_['merge'](_0x5ba109[_0x579c('0x46')],{'$or':_[_0x579c('0x35')](_0x5ba109['attributes'],function(_0x19cbea){var _0x41aa5b={};_0x41aa5b[_0x19cbea]={'$like':'%'+_0x2d2b26[_0x579c('0x3e')][_0x579c('0x48')]+'%'};return _0x41aa5b;})});}_0x5ba109=_[_0x579c('0x49')]({},_0x5ba109,_0x2d2b26[_0x579c('0x51')]);return db[_0x579c('0x61')][_0x579c('0x26')]({'where':_0x5ba109[_0x579c('0x46')]})[_0x579c('0x15')](function(_0x39efcc){_0x36e10d[_0x579c('0x26')]=_0x39efcc;if(_0x2d2b26[_0x579c('0x3e')][_0x579c('0x4b')]){_0x5ba109['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x579c('0x4d')](_0x5ba109);})['then'](function(_0x1e4ad0){_0x36e10d[_0x579c('0x4e')]=_0x1e4ad0;return _0x36e10d;});}})[_0x579c('0x15')](respondWithFilteredResult(_0x3d55e4,_0x5ba109))[_0x579c('0x1f')](handleError(_0x3d55e4,null));};exports['removeAnswers']=function(_0x403298,_0x36060e){return db[_0x579c('0x36')][_0x579c('0x52')]({'where':{'id':_0x403298[_0x579c('0x50')]['id']}})[_0x579c('0x15')](handleEntityNotFound(_0x36060e,null))[_0x579c('0x15')](function(_0x3d291a){if(_0x3d291a){return _0x3d291a[_0x579c('0x63')](_0x403298['query']['ids']);}})[_0x579c('0x15')](respondWithStatusCode(_0x36060e,null))[_0x579c('0x1f')](handleError(_0x36060e,null));};exports[_0x579c('0x64')]=function(_0x30a43b,_0x54555f){_0x30a43b[_0x579c('0x54')]['sitepic']=_0x30a43b[_0x579c('0x65')][_0x579c('0x66')];return db[_0x579c('0x36')][_0x579c('0x52')]({'where':{'id':_0x30a43b[_0x579c('0x50')]['id']}})[_0x579c('0x15')](handleEntityNotFound(_0x54555f,null))[_0x579c('0x15')](saveUpdates(_0x30a43b['body'],null))[_0x579c('0x15')](respondWithResult(_0x54555f,null))[_0x579c('0x1f')](handleError(_0x54555f,null));};exports['addAvatar']=function(_0x7cb127,_0xfccc4a){_0x7cb127[_0x579c('0x54')][_0x579c('0x67')]=_0x7cb127[_0x579c('0x65')][_0x579c('0x66')];return db['ChatWebsite'][_0x579c('0x52')]({'where':{'id':_0x7cb127[_0x579c('0x50')]['id']}})[_0x579c('0x15')](handleEntityNotFound(_0xfccc4a,null))[_0x579c('0x15')](saveUpdates(_0x7cb127[_0x579c('0x54')],null))[_0x579c('0x15')](respondWithResult(_0xfccc4a,null))[_0x579c('0x1f')](handleError(_0xfccc4a,null));};exports[_0x579c('0x68')]=function(_0x147a06,_0x5c2ba5){_0x147a06['body']['customerAvatar']=_0x147a06[_0x579c('0x65')]['filename'];return db[_0x579c('0x36')][_0x579c('0x52')]({'where':{'id':_0x147a06['params']['id']}})['then'](handleEntityNotFound(_0x5c2ba5,null))[_0x579c('0x15')](saveUpdates(_0x147a06[_0x579c('0x54')],null))[_0x579c('0x15')](respondWithResult(_0x5c2ba5,null))[_0x579c('0x1f')](handleError(_0x5c2ba5,null));};exports[_0x579c('0x69')]=function(_0xa37af0,_0x8c97cb){_0xa37af0[_0x579c('0x54')]['systemAvatar']=_0xa37af0[_0x579c('0x65')][_0x579c('0x66')];return db[_0x579c('0x36')][_0x579c('0x52')]({'where':{'id':_0xa37af0[_0x579c('0x50')]['id']}})['then'](handleEntityNotFound(_0x8c97cb,null))[_0x579c('0x15')](saveUpdates(_0xa37af0['body'],null))[_0x579c('0x15')](respondWithResult(_0x8c97cb,null))['catch'](handleError(_0x8c97cb,null));};exports['getLogo']=function(_0x3c81a2,_0xd789d9){var _0x1da1cc=path[_0x579c('0x6a')](config[_0x579c('0x6b')],'server/files/images/logos/default_logo.svg');var _0x4719b2={'where':{'id':_0x3c81a2[_0x579c('0x50')]['id']},'attributes':['id',_0x579c('0x6c')],'raw':!![]};var _0x48da20=![];return require(_0x579c('0x6d'))[_0x579c('0x6e')]()[_0x579c('0x15')](function(_0x353ba8){if(_0x353ba8){_0x48da20=_0x353ba8['custom'];}})[_0x579c('0x15')](function(){return db[_0x579c('0x36')][_0x579c('0x52')](_0x4719b2);})['then'](handleEntityNotFound(_0xd789d9,null))[_0x579c('0x15')](function(_0x4a5097){if(_0x4a5097){if(!_[_0x579c('0x6f')](_0x4a5097[_0x579c('0x6c')])){if(fs[_0x579c('0x70')](path[_0x579c('0x6a')](config[_0x579c('0x6b')],_0x579c('0x71'),_0x4a5097[_0x579c('0x6c')]))&&_0x48da20){_0x1da1cc=path['join'](config[_0x579c('0x6b')],_0x579c('0x71'),_0x4a5097[_0x579c('0x6c')]);}}return _0xd789d9[_0x579c('0x72')](_0x1da1cc);}})['catch'](handleError(_0xd789d9,null));};exports[_0x579c('0x73')]=function(_0x40da02,_0x5be62f){var _0xe967ea=path[_0x579c('0x6a')](config['root'],_0x579c('0x74'));var _0x20ab1e={'where':{'id':_0x40da02[_0x579c('0x50')]['id']},'attributes':['id',_0x579c('0x67')],'raw':!![]};return db[_0x579c('0x36')][_0x579c('0x52')](_0x20ab1e)[_0x579c('0x15')](handleEntityNotFound(_0x5be62f,null))[_0x579c('0x15')](function(_0x1fc9c0){if(_0x1fc9c0){if(!_['isNil'](_0x1fc9c0[_0x579c('0x67')])){if(fs[_0x579c('0x70')](path[_0x579c('0x6a')](config[_0x579c('0x6b')],_0x579c('0x75'),_0x1fc9c0[_0x579c('0x67')]))){_0xe967ea=path[_0x579c('0x6a')](config[_0x579c('0x6b')],_0x579c('0x75'),_0x1fc9c0[_0x579c('0x67')]);}}return _0x5be62f[_0x579c('0x72')](_0xe967ea);}})[_0x579c('0x1f')](handleError(_0x5be62f,null));};exports[_0x579c('0x76')]=function(_0x470673,_0x303eda){var _0x57bb06=path[_0x579c('0x6a')](config['root'],_0x579c('0x77'));var _0x3574dd={'where':{'id':_0x470673[_0x579c('0x50')]['id']},'attributes':['id',_0x579c('0x78'),'showCustomerAvatar'],'raw':!![]};return db[_0x579c('0x36')]['find'](_0x3574dd)['then'](handleEntityNotFound(_0x303eda,null))[_0x579c('0x15')](function(_0x229a0a){if(_0x229a0a){if(!_[_0x579c('0x6f')](_0x229a0a[_0x579c('0x78')])){if(fs[_0x579c('0x70')](path[_0x579c('0x6a')](config['root'],_0x579c('0x75'),_0x229a0a['customerAvatar']))&&_0x229a0a[_0x579c('0x79')]){_0x57bb06=path['join'](config[_0x579c('0x6b')],'server/files/images/avatars/',_0x229a0a[_0x579c('0x78')]);}}return _0x303eda[_0x579c('0x72')](_0x57bb06);}})[_0x579c('0x1f')](handleError(_0x303eda,null));};exports[_0x579c('0x7a')]=function(_0x26e40c,_0x1b0fbb){var _0x226159=path[_0x579c('0x6a')](config[_0x579c('0x6b')],_0x579c('0x7b'));var _0x38c878={'where':{'id':_0x26e40c[_0x579c('0x50')]['id']},'attributes':['id',_0x579c('0x7c')],'raw':!![]};return db[_0x579c('0x36')][_0x579c('0x52')](_0x38c878)[_0x579c('0x15')](handleEntityNotFound(_0x1b0fbb,null))[_0x579c('0x15')](function(_0x1c8d57){if(_0x1c8d57){if(!_[_0x579c('0x6f')](_0x1c8d57['systemAvatar'])){if(fs[_0x579c('0x70')](path[_0x579c('0x6a')](config[_0x579c('0x6b')],_0x579c('0x75'),_0x1c8d57['systemAvatar']))){_0x226159=path[_0x579c('0x6a')](config['root'],_0x579c('0x75'),_0x1c8d57[_0x579c('0x7c')]);}}return _0x1b0fbb[_0x579c('0x72')](_0x226159);}})[_0x579c('0x1f')](handleError(_0x1b0fbb,null));};exports['notify']=function(_0x36136a,_0x5817f2){var _0x2fbc0c=require(_0x579c('0x7d'));var _0x342eda=new _0x2fbc0c();var _0x87264c=_0x342eda[_0x579c('0x7e')](_0x36136a[_0x579c('0x7f')][_0x579c('0x80')])['getResult']();var _0x1f34fe={'body':_0x36136a[_0x579c('0x54')],'channel':_0x579c('0x81')};var _0x3f016d=[];var _0x4da428=[];var _0x5cc70c={};var _0x2888c1=![];return db[_0x579c('0x82')][_0x579c('0x5b')]()[_0x579c('0x15')](function(_0x38e9a2){if(!_0x38e9a2){throw new db[(_0x579c('0x83'))]['ValidationError']('no\x20available\x20attributes');}_0x3f016d=_[_0x579c('0x84')](_[_0x579c('0x3a')](_0x38e9a2),[_0x579c('0x85'),'updatedAt']);_0x4da428=_['difference'](_['keys'](_0x38e9a2),[_0x579c('0x85'),_0x579c('0x86'),_0x579c('0x87'),'ListId']);if(_0x36136a['body']['id']){delete _0x36136a['body']['id'];}if(_[_0x579c('0x6f')](_0x36136a[_0x579c('0x54')][_0x579c('0x88')])){throw new db[(_0x579c('0x83'))][(_0x579c('0x89'))](_0x579c('0x8a'));}if(_[_0x579c('0x6f')](_0x36136a['body'][_0x579c('0x54')])||_0x36136a['body'][_0x579c('0x54')]===''){throw new db[(_0x579c('0x83'))][(_0x579c('0x89'))](_0x579c('0x8b'));}if(_['isNil'](_0x36136a[_0x579c('0x54')]['mapKey'])){throw new db['Sequelize'][(_0x579c('0x89'))](_0x579c('0x8c')+_0x4da428);}if(!_[_0x579c('0x8d')](_0x4da428,_0x36136a['body'][_0x579c('0x8e')])){throw new db[(_0x579c('0x83'))][(_0x579c('0x89'))](_0x579c('0x8f')+_0x4da428);}_0x5cc70c[_0x36136a['body'][_0x579c('0x8e')]]=_0x36136a[_0x579c('0x54')][_0x579c('0x88')];})['then'](function(){return db[_0x579c('0x36')][_0x579c('0x52')]({'where':{'id':_0x36136a[_0x579c('0x50')]['id']},'include':[{'model':db[_0x579c('0x90')],'as':_0x579c('0x91'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x5cc70c,'limit':0x1,'order':[[_0x579c('0x86'),'DESC']]}]},{'model':db[_0x579c('0x92')],'as':_0x579c('0x93')}]});})['then'](handleEntityNotFound(_0x5817f2,null))['then'](function(_0x13aa92){if(_0x13aa92&&_0x13aa92[_0x579c('0x91')]){_0x1f34fe[_0x579c('0x94')]=_0x13aa92;_0x1f34fe[_0x579c('0x95')]=_0x13aa92['Applications'];_0x1f34fe[_0x579c('0x96')]=_0x13aa92[_0x579c('0x91')];_0x1f34fe[_0x579c('0x95')]=_['orderBy'](_0x1f34fe[_0x579c('0x95')],[_0x579c('0x97')],[_0x579c('0x98')]);if(_0x1f34fe[_0x579c('0x94')][_0x579c('0x93')]){delete _0x1f34fe['account'][_0x579c('0x93')];}if(_0x1f34fe['account'][_0x579c('0x91')]&&_0x1f34fe['account'][_0x579c('0x91')]['Contacts'][_0x579c('0x41')]){return _0x1f34fe[_0x579c('0x94')][_0x579c('0x91')][_0x579c('0x99')][0x0];}var _0x23aa12=_[_0x579c('0xd')](_0x36136a[_0x579c('0x54')],{'firstName':_0x36136a[_0x579c('0x54')][_0x579c('0x88')],'ListId':_0x13aa92[_0x579c('0x9a')]});_0x23aa12[_0x36136a[_0x579c('0x54')][_0x579c('0x8e')]]=_0x36136a[_0x579c('0x54')][_0x579c('0x88')];return db['CmContact'][_0x579c('0x53')](_0x23aa12,{'fields':_0x3f016d,'raw':!![]});}})['then'](handleEntityNotFound(_0x5817f2,null))[_0x579c('0x15')](function(_0xe18e9e){_0x1f34fe['contact']=_0xe18e9e;var _0x126557=_0x36136a[_0x579c('0x54')][_0x579c('0x9b')];if(_0x36136a['headers'][_0x579c('0x9c')]){_0x126557=_0x36136a[_0x579c('0x7f')][_0x579c('0x9c')];}else if(_0x36136a[_0x579c('0x7f')]['x-forwarded-for']){_0x126557=_[_0x579c('0x9d')](_0x36136a['headers'][_0x579c('0x9e')][_0x579c('0x9f')](','));}if(_0xe18e9e){var _0x45dbfa={'ContactId':_0xe18e9e['id'],'ChatWebsiteId':_0x36136a[_0x579c('0x50')]['id'],'from':(_0xe18e9e[_0x579c('0xa0')]||'')+'\x20'+(_0xe18e9e['lastName']||''),'customerIp':_0x126557,'customerPort':_0x36136a[_0x579c('0x7f')][_0x579c('0xa1')]?_0x36136a[_0x579c('0x7f')][_0x579c('0xa1')]:null,'referer':_0x36136a[_0x579c('0x54')][_0x579c('0xa2')],'browserName':_0x87264c['browser']['name']&&_0x87264c['browser'][_0x579c('0xa3')]?util['format'](_0x579c('0xa4'),_0x87264c[_0x579c('0xa5')]['name'],_0x87264c[_0x579c('0xa5')][_0x579c('0xa3')]):_0x579c('0xa6'),'browserVersion':_0x87264c[_0x579c('0xa5')][_0x579c('0xa3')]||'unknown','osName':util[_0x579c('0xa7')](_0x579c('0xa4'),_0x87264c['os'][_0x579c('0x30')],_0x87264c['os']['version']),'osVersion':_0x87264c['os'][_0x579c('0xa3')],'deviceModel':_0x87264c['device'][_0x579c('0x3d')]&&_0x87264c[_0x579c('0xa8')][_0x579c('0xa9')]?util[_0x579c('0xa7')](_0x579c('0xaa'),_0x87264c['device'][_0x579c('0x3d')],_0x87264c[_0x579c('0xa8')][_0x579c('0xa9')],_0x87264c[_0x579c('0xa8')][_0x579c('0x38')]):null,'deviceVendor':_0x87264c['device'][_0x579c('0xa9')],'deviceType':_0x87264c[_0x579c('0xa8')][_0x579c('0x38')],'formData':JSON[_0x579c('0x18')](_0x36136a['body'])};var _0x7c0c7a={'ChatWebsiteId':_0x36136a[_0x579c('0x50')]['id'],'closed':![]};if(_0x36136a['body'][_0x579c('0xab')]){_0x7c0c7a[_0x579c('0xab')]=_0x36136a['body'][_0x579c('0xab')];return db['ChatInteraction'][_0x579c('0x52')]({'where':_0x7c0c7a})[_0x579c('0x15')](function(_0xe3b3c4){if(_0xe3b3c4){return[_0xe3b3c4,![]];}_0x45dbfa['threadId']=_0x36136a['body'][_0x579c('0xab')];_0x45dbfa[_0x579c('0xac')]=_0x36136a['body']['externalUrl'];return db[_0x579c('0xad')][_0x579c('0x53')](_0x45dbfa)['then'](function(_0x97d789){return[_0x97d789,!![]];});});}_0x7c0c7a[_0x579c('0xae')]=_0xe18e9e['id'];if(_0x36136a[_0x579c('0x54')][_0x579c('0xaf')]&&_0x36136a[_0x579c('0x54')]['interaction']['id']){_0x7c0c7a['id']=_0x36136a['body'][_0x579c('0xaf')]['id'];return db[_0x579c('0xad')][_0x579c('0x52')]({'where':_0x7c0c7a})[_0x579c('0x15')](function(_0x3ee520){if(_0x3ee520){return[_0x3ee520,![]];}return db[_0x579c('0xad')][_0x579c('0x53')](_0x45dbfa)[_0x579c('0x15')](function(_0x407d6b){return[_0x407d6b,!![]];});});}return db[_0x579c('0xad')][_0x579c('0x53')](_0x45dbfa)[_0x579c('0x15')](function(_0x2d76ce){return[_0x2d76ce,!![]];});}})[_0x579c('0xb0')](function(_0xd80713,_0x1f2111){if(_0xd80713){_0x2888c1=_0x1f2111;if(!_0x1f2111){var _0x522be3={'from':(_0x1f34fe[_0x579c('0xb1')][_0x579c('0xa0')]||'')+'\x20'+(_0x1f34fe[_0x579c('0xb1')]['lastName']||'')};if(_0x36136a[_0x579c('0x54')][_0x579c('0xab')]&&_0x36136a[_0x579c('0x54')][_0x579c('0xb2')]&&_0x36136a['body']['threadId']!=_0x36136a[_0x579c('0x54')][_0x579c('0xb2')]){_0x522be3[_0x579c('0xab')]=_0x36136a[_0x579c('0x54')][_0x579c('0xb2')];}return _0xd80713[_0x579c('0x29')](_0x522be3);}else{return _0xd80713;}}})[_0x579c('0x15')](function(_0x3b1909){_0x1f34fe[_0x579c('0xaf')]=_0x3b1909['get']({'plain':!![]});_0x1f34fe[_0x579c('0xaf')]['created']=_0x2888c1;if(_0x1f34fe[_0x579c('0xaf')]['created']){if(_0x1f34fe['account'][_0x579c('0xb3')]){_0x1f34fe['applications'][_0x579c('0xb4')]({'id':0x0,'priority':_0x1f34fe[_0x579c('0x95')][_0x579c('0x41')]+0x1,'app':_0x579c('0xb5'),'appdata':_0x579c('0xb6'),'interval':_0x579c('0xb7')});}}return db['ChatMessage'][_0x579c('0x53')]({'body':_0x36136a[_0x579c('0x54')]['body'],'ChatWebsiteId':_0x36136a[_0x579c('0x50')]['id'],'ChatInteractionId':_0x3b1909['id'],'direction':'in','ContactId':_0x1f34fe['contact']['id'],'AttachmentId':_0x36136a[_0x579c('0x54')][_0x579c('0xb8')]});})[_0x579c('0x15')](function(_0x26d4c0){_0x1f34fe['message']=_0x26d4c0;if(_0x1f34fe['interaction'][_0x579c('0xb9')]){return db['User'][_0x579c('0x52')]({'attributes':['id',_0x579c('0x30')],'where':{'id':_0x1f34fe[_0x579c('0xaf')]['UserId']}})[_0x579c('0x15')](function(_0x4408be){if(_0x4408be){_0x1f34fe[_0x579c('0x95')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4408be[_0x579c('0x30')]+','+(_0x1f34fe[_0x579c('0x94')][_0x579c('0xba')]||0xa),'interval':_0x579c('0xb7')});_0x1f34fe[_0x579c('0xbb')]=!![];}return respondWithRpcPromise('Start',_0x579c('0xbc'),_0x1f34fe);});}return respondWithRpcPromise(_0x579c('0xbd'),_0x579c('0xbc'),_0x1f34fe);})[_0x579c('0x15')](function(_0x24a080){respondWithRpcPromise(_0x579c('0xbe'),_0x579c('0xbe'),{'event':'notify','message':_0x24a080},client9002);return _0x24a080;})[_0x579c('0x15')](respondWithResult(_0x5817f2,null))[_0x579c('0x1f')](handleError(_0x5817f2,null));};exports[_0x579c('0xbf')]=function(_0x22f930,_0xb6e3d9){var _0xc5d770,_0xf64aac,_0x4e44d9;var _0x26ce63=[];var _0x52288a={};var _0x5abf65=_0x22f930[_0x579c('0xc0')]||[];var _0x29bb9d=[];var _0x125fb7;return db[_0x579c('0x82')][_0x579c('0x5b')]()[_0x579c('0x15')](function(_0x246c91){if(!_0x246c91){throw new db[(_0x579c('0x83'))]['ValidationError']('no\x20available\x20attributes');}_0x26ce63=_[_0x579c('0x84')](_['keys'](_0x246c91),[_0x579c('0x85'),_0x579c('0x86'),_0x579c('0x87'),_0x579c('0x9a')]);if(_0x22f930[_0x579c('0x54')]['id']){delete _0x22f930[_0x579c('0x54')]['id'];}if(_[_0x579c('0x6f')](_0x22f930[_0x579c('0x54')][_0x579c('0x88')])){throw _0xb6e3d9[_0x579c('0x21')](0x1f4)['send'](new db[(_0x579c('0x83'))][(_0x579c('0x89'))](_0x579c('0x8a')));}if(_[_0x579c('0x6f')](_0x22f930[_0x579c('0x54')]['body'])||_0x22f930[_0x579c('0x54')][_0x579c('0x54')]===''){throw _0xb6e3d9[_0x579c('0x21')](0x1f4)[_0x579c('0x31')](new db[(_0x579c('0x83'))]['ValidationError'](_0x579c('0x8b')));}if(_['isNil'](_0x22f930[_0x579c('0x54')][_0x579c('0xc1')])){throw _0xb6e3d9[_0x579c('0x21')](0x1f4)['send'](new db['Sequelize'][(_0x579c('0x89'))](_0x579c('0xc2')+_0x26ce63));}if(!_['includes'](_0x26ce63,_0x22f930[_0x579c('0x54')][_0x579c('0xc1')])){throw _0xb6e3d9[_0x579c('0x21')](0x1f4)['send'](new db['Sequelize'][(_0x579c('0x89'))](_0x579c('0xc3')+_0x26ce63));}_0x52288a[_0x22f930[_0x579c('0x54')]['mapKeyOffline']]=_0x22f930[_0x579c('0x54')]['from'];})['then'](function(){return db[_0x579c('0x36')][_0x579c('0x52')]({'where':{'id':_0x22f930[_0x579c('0x50')]['id']},'include':[{'model':db[_0x579c('0x90')],'as':_0x579c('0x91')},{'model':db['MailAccount'],'as':_0x579c('0xc4')}]});})['then'](handleEntityNotFound(_0xb6e3d9,null))['then'](function(_0x3ed301){if(_0x3ed301&&_0x3ed301[_0x579c('0x91')]){_0xf64aac=_0x3ed301;var _0x6e3600=_[_0x579c('0xd')](_0x22f930[_0x579c('0x54')],{'firstName':_0x22f930[_0x579c('0x54')][_0x579c('0x88')],'phone':_0x22f930[_0x579c('0x54')]['from'],'ListId':_0x3ed301[_0x579c('0x9a')]});_0x6e3600[_0x22f930[_0x579c('0x54')][_0x579c('0xc1')]]=_0x22f930[_0x579c('0x54')][_0x579c('0x88')];return db[_0x579c('0x82')][_0x579c('0xc5')]({'where':_0x52288a,'defaults':_0x6e3600});}})[_0x579c('0xb0')](function(_0x4f1e27){if(_0x4f1e27){_0x4e44d9=_0x4f1e27;var _0x8adb3d=fs[_0x579c('0xc6')](path[_0x579c('0x6a')](config[_0x579c('0x6b')],_0x579c('0xc7')),'utf8');var _0x10c3d2=ejs[_0x579c('0xc8')](_0x8adb3d,{'body':_[_0x579c('0xc9')](_0x22f930[_0x579c('0x54')][_0x579c('0x54')]),'bodyTitle':_0xf64aac[_0x579c('0xca')]});return db['ChatOfflineMessage'][_0x579c('0x53')]({'body':_0x10c3d2,'plainBody':htmlToText[_0x579c('0xcb')](_0x10c3d2),'ContactId':_0x4f1e27['id'],'ChatWebsiteId':_0xf64aac['id']});}})[_0x579c('0x15')](function(_0x7982a){_0x125fb7=_0x7982a;if(_0x5abf65[_0x579c('0x41')]){var _0x34fe88=_0x5abf65['map'](function(_0x1c4f25){return{'name':_0x1c4f25[_0x579c('0xcc')],'basename':_0x1c4f25[_0x579c('0x66')],'type':_0x1c4f25[_0x579c('0xcd')],'ChatOfflineMessageId':_0x7982a['id']};});_0x29bb9d=_0x34fe88['map'](_0x390002=>{var _0x45ce1b={'filename':_0x390002[_0x579c('0x30')],'path':path['join'](config['root'],_0x579c('0xce'),_0x579c('0xc0'),_0x579c('0xcf'),_0x579c('0xd0'),_0x390002['basename'])};return _0x45ce1b;});if(!_0xf64aac[_0x579c('0xd1')]){return db[_0x579c('0xd2')][_0x579c('0xd3')](function(_0x363be0){return db[_0x579c('0xd4')]['bulkCreate'](_0x34fe88,{'transaction':_0x363be0});});}}})[_0x579c('0x15')](function(){if(_0x125fb7){_0xc5d770=_0x125fb7;return db[_0x579c('0xc4')][_0x579c('0x62')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x579c('0xd5'),'raw':!![]}]}]});}})['then'](function(_0x478f50){if(_0x478f50&&_0x478f50[_0x579c('0xd6')]&&_0xf64aac[_0x579c('0xd7')]&&_0xf64aac[_0x579c('0xd8')]){var _0x568446=_0x478f50[_0x579c('0xd9')]();return respondWithRpcPromise(_0x579c('0xda'),_0x579c('0xdb'),{'account':_0x568446,'message':{'from':util[_0x579c('0xa7')]('\x22%s\x22\x20<%s>',_0x478f50[_0x579c('0x30')],_0x478f50[_0x579c('0xdc')]||_0x478f50[_0x579c('0xd6')][_0x579c('0x55')]),'to':_0xf64aac['forwardOfflineAddress'],'subject':_0xf64aac[_0x579c('0xdd')],'html':_0xc5d770[_0x579c('0x54')],'attachments':_0x29bb9d}},client9003)['then'](function(){return _0xc5d770;})['catch'](function(_0x440e27){logger[_0x579c('0x19')](_0x440e27);});}})[_0x579c('0x15')](function(){if(_0xf64aac&&_0xf64aac[_0x579c('0xd1')]&&_0xf64aac['MailAccountId']){var _0x551f6a=[];if(_0x5abf65[_0x579c('0x41')]){_0x551f6a=_0x5abf65['map'](function(_0x5d7d8f){return{'name':_0x5d7d8f[_0x579c('0xcc')],'basename':_0x5d7d8f[_0x579c('0x66')],'type':_0x5d7d8f[_0x579c('0xcd')],'ChatOfflineMessageId':_0x125fb7['id']};});}var _0x543c9a;if(!_[_0x579c('0x6f')](_0xf64aac[_0x579c('0xde')])){var _0x4b8c5a=_[_0x579c('0x35')](_0x22f930[_0x579c('0x54')],function(_0x2b0927){return _0x2b0927;});var _0x3ad619=_[_0x579c('0xdf')](_0x4b8c5a)[0x0];var _0x407317=_['mapValues'](_0x3ad619,function(_0x3fc490){return _0x3fc490;});_0x543c9a=_0x407317[0x1][_0xf64aac['subjectOffline']];}var _0x17d1c9={'from':_0x4e44d9['email'],'firstName':_0x4e44d9['firstName'],'lastName':_0x4e44d9['lastName'],'mapKey':_0x579c('0xdc'),'message':{'from':_0x4e44d9[_0x579c('0xdc')],'to':_0xf64aac[_0x579c('0xc4')][_0x579c('0xdc')],'cc':'','subject':_['isNil'](_0x543c9a)?_0xf64aac[_0x579c('0xdd')]:_0x543c9a,'messageId':'','sentAt':new Date(),'attach':_0x551f6a[_0x579c('0x41')],'attachments':_0x551f6a,'originChannel':_0x579c('0xe0'),'ChatWebsiteId':_0xf64aac['id'],'ChatOfflineMessageId':_0xc5d770['id'],'originTo':_0xf64aac['MailAccount'][_0x579c('0xdc')]},'body':_0xc5d770[_0x579c('0x54')]};var _0x68d5e1={'account':{'id':_0xf64aac[_0x579c('0xe1')]},'body':_0x17d1c9,'log':_0x579c('0xe2')};return respondWithRpcPromise(_0x579c('0xe2'),_0x579c('0xe3'),_0x68d5e1,client9001)['then'](function(){return _0xc5d770;})[_0x579c('0x1f')](function(_0x4b5e75){logger[_0x579c('0x19')](_0x4b5e75);});}return;})[_0x579c('0x15')](function(){if(_0xc5d770){return _0xc5d770;}})['then'](respondWithResult(_0xb6e3d9,null))['catch'](function(_0x340282){logger['error'](_0x579c('0x1f'),_0x340282);for(var _0xaefa4e of _0x5abf65){var _0x52bc5f=path['join'](config[_0x579c('0x6b')],'server',_0x579c('0xc0'),_0x579c('0xcf'),'offline-chat',_0xaefa4e[_0x579c('0x66')]);fs_extra[_0x579c('0xe4')](_0x52bc5f)[_0x579c('0x1f')](function(_0xfa690f){logger[_0x579c('0x19')](_0x579c('0xe5'),_0x52bc5f,_0xfa690f);});}});};exports['addInteraction']=function(_0x3bd55d,_0x488f20){return db[_0x579c('0xad')][_0x579c('0x52')]({'where':{'id':_0x3bd55d[_0x579c('0x50')]['id']}})[_0x579c('0x15')](handleEntityNotFound(_0x488f20,null))[_0x579c('0x15')](function(_0x46c62f){if(_0x46c62f){return _0x46c62f['addInteraction'](_0x3bd55d[_0x579c('0x54')][_0x579c('0xe6')],_['omit'](_0x3bd55d[_0x579c('0x54')],['ids','id'])||{});}})[_0x579c('0x15')](respondWithResult(_0x488f20,null))[_0x579c('0x1f')](handleError(_0x488f20,null));};exports[_0x579c('0xe7')]=function(_0x6e198c,_0x4635b6){var _0x1cfd5a={'raw':![],'where':{}};var _0xb58089={};var _0x22795b={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x579c('0x62')]({'where':{'id':_0x6e198c[_0x579c('0x50')]['id']}})[_0x579c('0x15')](handleEntityNotFound(_0x4635b6,null))[_0x579c('0x15')](function(_0x4b972f){if(_0x4b972f){_0xb58089[_0x579c('0x3d')]=_[_0x579c('0x3a')](db['ChatInteraction'][_0x579c('0x37')]);_0xb58089['query']=_[_0x579c('0x3a')](_0x6e198c[_0x579c('0x3e')]);_0xb58089[_0x579c('0x3b')]=_[_0x579c('0x3c')](_0xb58089[_0x579c('0x3d')],_0xb58089['query']);_0x1cfd5a[_0x579c('0x3f')]=_[_0x579c('0x3c')](_0xb58089[_0x579c('0x3d')],qs[_0x579c('0x40')](_0x6e198c[_0x579c('0x3e')][_0x579c('0x40')]));_0x1cfd5a['attributes']=_0x1cfd5a['attributes'][_0x579c('0x41')]?_0x1cfd5a['attributes']:_0xb58089[_0x579c('0x3d')];if(!_0x6e198c[_0x579c('0x3e')][_0x579c('0x42')](_0x579c('0x43'))){_0x1cfd5a[_0x579c('0x25')]=qs['limit'](_0x6e198c['query'][_0x579c('0x25')]);_0x1cfd5a['offset']=qs[_0x579c('0x23')](_0x6e198c[_0x579c('0x3e')][_0x579c('0x23')]);}_0x1cfd5a[_0x579c('0x44')]=qs[_0x579c('0x45')](_0x6e198c[_0x579c('0x3e')][_0x579c('0x45')]);_0x1cfd5a[_0x579c('0x46')]=qs[_0x579c('0x3b')](_['pick'](_0x6e198c[_0x579c('0x3e')],_0xb58089[_0x579c('0x3b')]));_0x1cfd5a[_0x579c('0x46')][_0x579c('0x5d')]=_0x4b972f['id'];if(_0x6e198c['query']['filter']){_0x1cfd5a[_0x579c('0x46')]=_['merge'](_0x1cfd5a[_0x579c('0x46')],{'$or':_[_0x579c('0x35')](_0x1cfd5a['attributes'],function(_0x4ca45e){var _0xc9f655={};_0xc9f655[_0x4ca45e]={'$like':'%'+_0x6e198c[_0x579c('0x3e')][_0x579c('0x48')]+'%'};return _0xc9f655;})});}_0x1cfd5a=_[_0x579c('0x49')]({},_0x1cfd5a,_0x6e198c[_0x579c('0x51')]);return db[_0x579c('0xad')][_0x579c('0x26')]({'where':_0x1cfd5a['where']})[_0x579c('0x15')](function(_0x3ba470){_0x22795b[_0x579c('0x26')]=_0x3ba470;if(_0x6e198c[_0x579c('0x3e')][_0x579c('0x4b')]){_0x1cfd5a[_0x579c('0x4c')]=[{'model':db[_0x579c('0x82')],'as':_0x579c('0xe8'),'required':![]},{'model':db[_0x579c('0xe9')],'as':_0x579c('0xea'),'attributes':[_0x579c('0x30'),_0x579c('0xeb'),_0x579c('0xec')],'required':![]},{'model':db[_0x579c('0xed')],'as':'Tags','attributes':['id',_0x579c('0x30'),_0x579c('0xee')],'where':_0x6e198c['query'][_0x579c('0xef')]?{'id':_0x6e198c[_0x579c('0x3e')][_0x579c('0xef')]}:undefined,'required':_0x6e198c[_0x579c('0x3e')][_0x579c('0xef')]?!![]:![]}];}return db[_0x579c('0xad')][_0x579c('0x4d')](_0x1cfd5a);})['then'](function(_0x45f94a){_0x22795b[_0x579c('0x4e')]=_0x45f94a;return _0x22795b;});}})[_0x579c('0x15')](respondWithFilteredResult(_0x4635b6,_0x1cfd5a))[_0x579c('0x1f')](handleError(_0x4635b6,null));};function iftimePromise(_0x282da9,_0x29efea){return respondWithRpcPromise(_0x579c('0xf0'),_0x579c('0xf1'),{'command':_0x29efea['timezone']?util[_0x579c('0xa7')](_0x579c('0xf2'),_0x282da9[_0x579c('0xf3')],_0x29efea['timezone']):util['format'](_0x579c('0xf4'),_0x282da9[_0x579c('0xf3')])},client9002)[_0x579c('0x15')](function(_0x3146fd){var _0x415778=_0x3146fd&&_0x3146fd[_0x579c('0xf5')](_0x579c('0xf6'))>=0x0?!![]:![];logger[_0x579c('0x1d')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x29efea['id'],_0x282da9['id'],_0x282da9[_0x579c('0xf3')],_0x415778?_0x579c('0xf7'):_0x579c('0xf8'),_0x29efea[_0x579c('0xf9')]?_0x29efea[_0x579c('0xf9')]:_0x579c('0xfa'));return _0x415778;})[_0x579c('0x1f')](function(_0x34f5fe){logger[_0x579c('0x19')](_0x579c('0xfb'),_0x29efea['id'],_0x282da9['id'],_0x282da9[_0x579c('0xf3')],util[_0x579c('0xfc')](_0x34f5fe,{'showHidden':![],'depth':null}),_0x29efea[_0x579c('0xf9')]?_0x29efea[_0x579c('0xf9')]:_0x579c('0xfa'));return![];});}exports[_0x579c('0xf1')]=function(_0x289669,_0x2332a4){var _0x568406=0x0;var _0x5e3e3b=0x0;var _0x29a239=![];var _0x124c2b;var _0x145580;return db[_0x579c('0x36')][_0x579c('0x52')]({'where':{'id':_0x289669[_0x579c('0x50')]['id']},'include':[{'model':db[_0x579c('0xfd')],'as':'Interval','include':[{'model':db[_0x579c('0xfd')],'as':_0x579c('0xfe'),'attributes':['id','interval'],'raw':!![]}]}]})[_0x579c('0x15')](handleEntityNotFound(_0x2332a4,null))[_0x579c('0x15')](function(_0x47e63e){if(_0x47e63e){_0x124c2b=_0x47e63e;return _0x47e63e[_0x579c('0xff')]({'raw':!![]});}})[_0x579c('0x15')](function(_0x2d19dc){if(_0x124c2b){if(_0x2d19dc){_0x145580=_0x2d19dc;}}return require(_0x579c('0x6d'))['getLicense']();})[_0x579c('0x15')](function(_0x3ca798){if(_0x3ca798){_0x5e3e3b=_0x3ca798[_0x579c('0x100')];_0x29a239=_0x3ca798[_0x579c('0x101')];}})[_0x579c('0x15')](function(){return db[_0x579c('0xad')][_0x579c('0x26')]({'where':{'closed':![]}});})['then'](function(_0x692fb){_0x568406=_0x692fb;if(_0x5e3e3b&&_0x692fb>_0x5e3e3b){return db[_0x579c('0x102')][_0x579c('0x62')]({'where':{'id':0x1}})[_0x579c('0x15')](function(_0xdcb9a5){if(_0xdcb9a5){_0xdcb9a5['increment']('chatLicenseExceeded');}});}})[_0x579c('0x15')](function(){if(_0x124c2b[_0x579c('0xfd')]&&_0x124c2b['Interval'][_0x579c('0xfe')]){var _0x18b041=[];for(var _0x5bbcc5=0x0;_0x5bbcc5<_0x124c2b['Interval'][_0x579c('0xfe')][_0x579c('0x41')];_0x5bbcc5++){var _0x2e6638=_0x124c2b[_0x579c('0xfd')][_0x579c('0xfe')][_0x5bbcc5][_0x579c('0x2a')]({'plain':!![]});_0x18b041[_0x579c('0xb4')](iftimePromise(_0x2e6638,_0x124c2b));}return BPromise[_0x579c('0x103')](_0x18b041)[_0x579c('0x15')](function(_0x286ae6){return _[_0x579c('0x104')](_0x286ae6);});}else{return!![];}})[_0x579c('0x15')](function(_0x251b3b){var _0x873e25=fs[_0x579c('0xc6')](path['join'](config[_0x579c('0x6b')],_0x579c('0x105')),_0x579c('0x106'));var _0x30b1a0=new url[(_0x579c('0x107'))](_0x124c2b[_0x579c('0x108')])[_0x579c('0x109')];var _0x484608='3.1.0';var _0x534574=![];var _0x3a988e={'chatVersion':_0x484608,'chatWebsiteAddressOrigin':_0x30b1a0,'remote':_0x124c2b['remote'],'query':querystring['stringify'](_[_0x579c('0x49')](_0x124c2b['get']({'plain':!![]}),{'customerIp':_0x289669[_0x579c('0x7f')]['x-forwarded-for']||_0x289669['headers'][_0x579c('0x10a')]||_0x289669[_0x579c('0x10b')][_0x579c('0x10c')]||_0x289669['ip'],'referer':_0x289669['headers'][_0x579c('0xa2')],'openedInteractions':_0x568406,'maxInteractions':_0x5e3e3b,'virtual':_0x29a239[_0x579c('0x100')],'online':_0x251b3b,'custom':_0x29a239}))[_0x579c('0x10d')](/'/g,'\x5c\x27')};_0x2332a4[_0x579c('0x31')](ejs['render'](Mustache[_0x579c('0xc8')](_0x873e25,_0x3a988e),{'proactiveActions':_0x145580,'alignment':_0x124c2b[_0x579c('0x10e')],'verticalAlignment':_0x124c2b[_0x579c('0x10f')],'div_color':_0x124c2b[_0x579c('0xee')],'labelText':_0x124c2b['labelText'],'text_color':_0x124c2b[_0x579c('0x110')],'text_button_color':_0x124c2b['textButtonColor'],'button_color':_0x124c2b['color_button'],'background_color':_0x124c2b['backgroundColor'],'hideWhenOffline':_0x124c2b[_0x579c('0x111')],'intervalId':_0x124c2b['IntervalId'],'isDevelopment':_0x534574,'chatVersion':_0x484608}));})[_0x579c('0x1f')](handleError(_0x2332a4,null));};exports['addApplications']=function(_0xaba7ad,_0x33990f){var _0x5e7106=_0xaba7ad[_0x579c('0x50')]['id'];var _0xb80433=_0xaba7ad[_0x579c('0x54')];var _0x4fa8d4=0xc8;var _0x534616=null;return db[_0x579c('0xd2')]['transaction']({'isolationLevel':db[_0x579c('0xd2')][_0x579c('0x112')][_0x579c('0x113')][_0x579c('0x114')]},function(_0x1fd3e3){return db['ChatWebsite']['findOne']({'where':{'id':_0x5e7106},'transaction':_0x1fd3e3})[_0x579c('0x15')](function(_0x1f1c56){if(_0x1f1c56){return db[_0x579c('0x92')][_0x579c('0x2d')]({'where':{'ChatWebsiteId':_0x5e7106},'transaction':_0x1fd3e3})[_0x579c('0x15')](function(){var _0x4e77fc=_[_0x579c('0x35')](_0xb80433,function(_0x5b1fbe){_0x5b1fbe[_0x579c('0x5d')]=_0x5e7106;return _0x5b1fbe;});return db[_0x579c('0x92')][_0x579c('0x115')](_0x4e77fc,{'transaction':_0x1fd3e3});});}else{_0x4fa8d4=0x194;_0x534616=[];}});})['then'](function(){if(_0x4fa8d4!==0x194){return db[_0x579c('0x92')][_0x579c('0x116')]({'where':{'ChatWebsiteId':_0x5e7106},'order':_0x579c('0x97')})[_0x579c('0x15')](function(_0x3f7306){_0x534616=_0x3f7306;});}})['catch'](function(_0x3b48dc){_0x4fa8d4=0x1f4;logger[_0x579c('0x19')](_0x3b48dc[_0x579c('0x2f')]);if(_0x3b48dc[_0x579c('0x30')]){delete _0x3b48dc['name'];}_0x534616=_0x3b48dc;})[_0x579c('0x117')](function(){if(_0x534616===null){_0x33990f['sendStatus'](_0x4fa8d4);}else{if(_0x4fa8d4===0x1f4){_0x33990f[_0x579c('0x21')](_0x4fa8d4)['send'](_0x534616);}else{_0x33990f[_0x579c('0x21')](_0x4fa8d4)[_0x579c('0x22')](_0x534616);}}});};exports[_0x579c('0x118')]=function(_0x2cec7e,_0x28e833){var _0x33cb2b={};var _0x477bc4={};var _0xe06bb6;var _0x4170aa;return db[_0x579c('0x36')]['findOne']({'where':{'id':_0x2cec7e[_0x579c('0x50')]['id']}})[_0x579c('0x15')](handleEntityNotFound(_0x28e833,null))['then'](function(_0x7305bf){if(_0x7305bf){_0xe06bb6=_0x7305bf;_0x477bc4['model']=_[_0x579c('0x3a')](db[_0x579c('0x92')][_0x579c('0x37')]);_0x477bc4[_0x579c('0x3e')]=_[_0x579c('0x3a')](_0x2cec7e[_0x579c('0x3e')]);_0x477bc4[_0x579c('0x3b')]=_[_0x579c('0x3c')](_0x477bc4[_0x579c('0x3d')],_0x477bc4[_0x579c('0x3e')]);_0x33cb2b['attributes']=_[_0x579c('0x3c')](_0x477bc4[_0x579c('0x3d')],qs[_0x579c('0x40')](_0x2cec7e[_0x579c('0x3e')][_0x579c('0x40')]));_0x33cb2b[_0x579c('0x3f')]=_0x33cb2b[_0x579c('0x3f')][_0x579c('0x41')]?_0x33cb2b[_0x579c('0x3f')]:_0x477bc4['model'];_0x33cb2b['order']=qs[_0x579c('0x45')](_0x2cec7e[_0x579c('0x3e')][_0x579c('0x45')]);_0x33cb2b[_0x579c('0x46')]=qs[_0x579c('0x3b')](_['pick'](_0x2cec7e[_0x579c('0x3e')],_0x477bc4[_0x579c('0x3b')]));if(_0x2cec7e[_0x579c('0x3e')][_0x579c('0x48')]){_0x33cb2b[_0x579c('0x46')]=_['merge'](_0x33cb2b[_0x579c('0x46')],{'$or':_[_0x579c('0x35')](_0x33cb2b[_0x579c('0x3f')],function(_0x345dcc){var _0x39451a={};_0x39451a[_0x345dcc]={'$like':'%'+_0x2cec7e[_0x579c('0x3e')]['filter']+'%'};return _0x39451a;})});}_0x33cb2b=_['merge']({},_0x33cb2b,_0x2cec7e[_0x579c('0x51')]);return _0xe06bb6[_0x579c('0x118')](_0x33cb2b);}})[_0x579c('0x15')](function(_0x34d256){if(_0x34d256){_0x4170aa=_0x34d256[_0x579c('0x41')];if(!_0x2cec7e[_0x579c('0x3e')][_0x579c('0x42')](_0x579c('0x43'))){_0x33cb2b[_0x579c('0x25')]=qs['limit'](_0x2cec7e['query']['limit']);_0x33cb2b[_0x579c('0x23')]=qs[_0x579c('0x23')](_0x2cec7e[_0x579c('0x3e')]['offset']);}return _0xe06bb6['getApplications'](_0x33cb2b);}})[_0x579c('0x15')](function(_0x51e0b3){if(_0x51e0b3){return _0x51e0b3?{'count':_0x4170aa,'rows':_0x51e0b3}:null;}})[_0x579c('0x15')](respondWithResult(_0x28e833,null))[_0x579c('0x1f')](handleError(_0x28e833,null));};exports['addProactiveActions']=function(_0x263db5,_0xf4e279){return db[_0x579c('0x119')]['find']({'where':{'id':_0x263db5[_0x579c('0x50')]['id']}})['then'](handleEntityNotFound(_0xf4e279,null))[_0x579c('0x15')](function(_0x17edd0){if(_0x17edd0){return _0x17edd0[_0x579c('0x11a')](_0x263db5[_0x579c('0x54')][_0x579c('0xe6')],_[_0x579c('0x11b')](_0x263db5['body'],['ids','id'])||{});}})[_0x579c('0x15')](respondWithResult(_0xf4e279,null))['catch'](handleError(_0xf4e279,null));};exports['getProactiveActions']=function(_0x18cedb,_0x5ef787){var _0x2bcb1e={};var _0x1745fa={};var _0x254358;var _0x376a24;return db['ChatWebsite']['findOne']({'where':{'id':_0x18cedb['params']['id']}})[_0x579c('0x15')](handleEntityNotFound(_0x5ef787,null))[_0x579c('0x15')](function(_0x1f1593){if(_0x1f1593){_0x254358=_0x1f1593;_0x1745fa[_0x579c('0x3d')]=_['keys'](db['ChatProactiveAction'][_0x579c('0x37')]);_0x1745fa[_0x579c('0x3e')]=_[_0x579c('0x3a')](_0x18cedb[_0x579c('0x3e')]);_0x1745fa['filters']=_[_0x579c('0x3c')](_0x1745fa[_0x579c('0x3d')],_0x1745fa[_0x579c('0x3e')]);_0x2bcb1e['attributes']=_[_0x579c('0x3c')](_0x1745fa[_0x579c('0x3d')],qs[_0x579c('0x40')](_0x18cedb[_0x579c('0x3e')][_0x579c('0x40')]));_0x2bcb1e[_0x579c('0x3f')]=_0x2bcb1e['attributes']['length']?_0x2bcb1e['attributes']:_0x1745fa[_0x579c('0x3d')];_0x2bcb1e[_0x579c('0x44')]=qs['sort'](_0x18cedb[_0x579c('0x3e')]['sort']);_0x2bcb1e['where']=qs[_0x579c('0x3b')](_[_0x579c('0x47')](_0x18cedb[_0x579c('0x3e')],_0x1745fa[_0x579c('0x3b')]));if(_0x18cedb[_0x579c('0x3e')]['filter']){_0x2bcb1e['where']=_['merge'](_0x2bcb1e[_0x579c('0x46')],{'$or':_[_0x579c('0x35')](_0x2bcb1e[_0x579c('0x3f')],function(_0x214f2e){var _0x583cf2={};_0x583cf2[_0x214f2e]={'$like':'%'+_0x18cedb[_0x579c('0x3e')][_0x579c('0x48')]+'%'};return _0x583cf2;})});}_0x2bcb1e=_[_0x579c('0x49')]({},_0x2bcb1e,_0x18cedb[_0x579c('0x51')]);return _0x254358['getProactiveActions'](_0x2bcb1e);}})[_0x579c('0x15')](function(_0x20363d){if(_0x20363d){_0x376a24=_0x20363d[_0x579c('0x41')];if(!_0x18cedb[_0x579c('0x3e')][_0x579c('0x42')](_0x579c('0x43'))){_0x2bcb1e[_0x579c('0x25')]=qs[_0x579c('0x25')](_0x18cedb[_0x579c('0x3e')][_0x579c('0x25')]);_0x2bcb1e[_0x579c('0x23')]=qs[_0x579c('0x23')](_0x18cedb[_0x579c('0x3e')][_0x579c('0x23')]);}return _0x254358[_0x579c('0xff')](_0x2bcb1e);}})[_0x579c('0x15')](function(_0x4d50d8){if(_0x4d50d8){return _0x4d50d8?{'count':_0x376a24,'rows':_0x4d50d8}:null;}})[_0x579c('0x15')](respondWithResult(_0x5ef787,null))[_0x579c('0x1f')](handleError(_0x5ef787,null));};exports[_0x579c('0x11c')]=function(_0x44070e,_0x3b7ffa){var _0x4a7281=_0x44070e[_0x579c('0x3e')]['online']==='false'?_0x579c('0x11d'):_0x579c('0x11e');return db[_0x579c('0x36')][_0x579c('0x52')]({'attributes':['id',_0x4a7281],'where':{'id':_0x44070e['params']['id']}})[_0x579c('0x15')](handleEntityNotFound(_0x3b7ffa,null))['then'](function(_0x460583){if(_0x460583){var _0x3d7a7e=_0x460583[_0x4a7281];var _0x16f299=_0x3d7a7e&&_0x3d7a7e[_0x579c('0x11f')]?_0x3d7a7e[_0x579c('0x11f')]:[];_0x3b7ffa[_0x579c('0x31')]({'fromKey':_['isNil'](_0x3d7a7e[_0x579c('0x120')])?undefined:_0x3d7a7e[_0x579c('0x120')],'count':_0x16f299[_0x579c('0x41')],'rows':_0x16f299});}})['catch'](handleError(_0x3b7ffa,null));};exports[_0x579c('0x121')]=function(_0x51af47,_0x4af1e1){var _0xe0f93c={'raw':![],'where':{}};var _0x393741={};var _0xf9f2a6={'count':0x0,'rows':[]};return db[_0x579c('0x36')][_0x579c('0x62')]({'where':{'id':_0x51af47[_0x579c('0x50')]['id']}})[_0x579c('0x15')](handleEntityNotFound(_0x4af1e1,null))[_0x579c('0x15')](function(_0x50ee6b){if(_0x50ee6b){_0x393741[_0x579c('0x3d')]=_[_0x579c('0x3a')](db[_0x579c('0x122')][_0x579c('0x37')]);_0x393741[_0x579c('0x3e')]=_['keys'](_0x51af47[_0x579c('0x3e')]);_0x393741[_0x579c('0x3b')]=_[_0x579c('0x3c')](_0x393741[_0x579c('0x3d')],_0x393741[_0x579c('0x3e')]);_0xe0f93c[_0x579c('0x3f')]=_[_0x579c('0x3c')](_0x393741[_0x579c('0x3d')],qs[_0x579c('0x40')](_0x51af47[_0x579c('0x3e')][_0x579c('0x40')]));_0xe0f93c[_0x579c('0x3f')]=_0xe0f93c[_0x579c('0x3f')][_0x579c('0x41')]?_0xe0f93c['attributes']:_0x393741[_0x579c('0x3d')];if(!_0x51af47[_0x579c('0x3e')][_0x579c('0x42')](_0x579c('0x43'))){_0xe0f93c[_0x579c('0x25')]=qs[_0x579c('0x25')](_0x51af47[_0x579c('0x3e')]['limit']);_0xe0f93c[_0x579c('0x23')]=qs[_0x579c('0x23')](_0x51af47[_0x579c('0x3e')][_0x579c('0x23')]);}_0xe0f93c[_0x579c('0x44')]=qs[_0x579c('0x45')](_0x51af47[_0x579c('0x3e')][_0x579c('0x45')]);_0xe0f93c['where']=qs[_0x579c('0x3b')](_['pick'](_0x51af47[_0x579c('0x3e')],_0x393741[_0x579c('0x3b')]));_0xe0f93c[_0x579c('0x46')][_0x579c('0x5d')]=_0x50ee6b['id'];if(_0x51af47[_0x579c('0x3e')][_0x579c('0x48')]){_0xe0f93c['where']=_['merge'](_0xe0f93c[_0x579c('0x46')],{'$or':_[_0x579c('0x35')](_0xe0f93c[_0x579c('0x3f')],function(_0x30f78d){var _0x509984={};_0x509984[_0x30f78d]={'$like':'%'+_0x51af47[_0x579c('0x3e')][_0x579c('0x48')]+'%'};return _0x509984;})});}_0xe0f93c=_[_0x579c('0x49')]({},_0xe0f93c,_0x51af47[_0x579c('0x51')]);return db[_0x579c('0x122')]['count']({'where':_0xe0f93c[_0x579c('0x46')]})[_0x579c('0x15')](function(_0x473c4f){_0xf9f2a6[_0x579c('0x26')]=_0x473c4f;if(_0x51af47[_0x579c('0x3e')][_0x579c('0x4b')]){_0xe0f93c[_0x579c('0x4c')]=[{'all':!![]}];}else{_0xe0f93c[_0x579c('0x4c')]=[{'model':db['CmContact'],'as':_0x579c('0xe8'),'required':![]},{'model':db[_0x579c('0xd4')],'as':'Attachments','required':![]}];}return db[_0x579c('0x122')][_0x579c('0x4d')](_0xe0f93c);})[_0x579c('0x15')](function(_0xd7d6c1){_0xf9f2a6[_0x579c('0x4e')]=_0xd7d6c1;return _0xf9f2a6;});}})[_0x579c('0x15')](respondWithFilteredResult(_0x4af1e1,_0xe0f93c))[_0x579c('0x1f')](handleError(_0x4af1e1,null));};exports[_0x579c('0x123')]=function(_0x2968df,_0x119794){return db[_0x579c('0x36')][_0x579c('0x52')]({'where':{'id':_0x2968df[_0x579c('0x50')]['id']}})[_0x579c('0x15')](handleEntityNotFound(_0x119794,null))['then'](function(_0x2f520d){if(_0x2f520d){return _0x2f520d[_0x579c('0x123')](_0x2968df['body'][_0x579c('0xe6')],_[_0x579c('0x11b')](_0x2968df[_0x579c('0x54')],[_0x579c('0xe6'),'id'])||{})['spread'](function(_0x354b84){for(var _0x6d64e=0x0;_0x6d64e<_0x2968df['body']['ids']['length'];_0x6d64e+=0x1){socket[_0x579c('0x124')]('userChatWebsite:save',{'UserId':Number(_0x2968df['body'][_0x579c('0xe6')][_0x6d64e]),'ChatWebsiteId':Number(_0x2968df['params']['id'])});}return _0x354b84;});}})[_0x579c('0x15')](respondWithResult(_0x119794,null))['catch'](handleError(_0x119794,null));};exports[_0x579c('0x125')]=function(_0x18d144,_0x45e569){return db['ChatWebsite']['find']({'where':{'id':_0x18d144[_0x579c('0x50')]['id']}})[_0x579c('0x15')](handleEntityNotFound(_0x45e569,null))[_0x579c('0x15')](function(_0xfc0fac){if(_0xfc0fac){return _0xfc0fac[_0x579c('0x125')](_0x18d144[_0x579c('0x3e')][_0x579c('0xe6')])['then'](function(){if(_[_0x579c('0x126')](_0x18d144[_0x579c('0x3e')][_0x579c('0xe6')])){for(var _0xdcd95c=0x0;_0xdcd95c<_0x18d144[_0x579c('0x3e')][_0x579c('0xe6')]['length'];_0xdcd95c+=0x1){socket[_0x579c('0x124')](_0x579c('0x127'),{'UserId':Number(_0x18d144[_0x579c('0x3e')][_0x579c('0xe6')][_0xdcd95c]),'ChatWebsiteId':Number(_0x18d144['params']['id'])});}}else{socket[_0x579c('0x124')](_0x579c('0x127'),{'UserId':Number(_0x18d144[_0x579c('0x3e')][_0x579c('0xe6')]),'ChatWebsiteId':Number(_0x18d144['params']['id'])});}});}})[_0x579c('0x15')](respondWithStatusCode(_0x45e569,null))[_0x579c('0x1f')](handleError(_0x45e569,null));};exports[_0x579c('0x128')]=function(_0x38d137,_0x1280dc){var _0x4ae796={};var _0x176441={};var _0x3bd037;var _0x52a1d4;return db['ChatWebsite']['findOne']({'where':{'id':_0x38d137[_0x579c('0x50')]['id']}})[_0x579c('0x15')](handleEntityNotFound(_0x1280dc,null))[_0x579c('0x15')](function(_0x22a3cb){if(_0x22a3cb){_0x3bd037=_0x22a3cb;_0x176441['model']=_[_0x579c('0x3a')](db['User'][_0x579c('0x37')]);_0x176441['query']=_[_0x579c('0x3a')](_0x38d137[_0x579c('0x3e')]);_0x176441[_0x579c('0x3b')]=_[_0x579c('0x3c')](_0x176441[_0x579c('0x3d')],_0x176441[_0x579c('0x3e')]);_0x4ae796[_0x579c('0x3f')]=_[_0x579c('0x3c')](_0x176441[_0x579c('0x3d')],qs[_0x579c('0x40')](_0x38d137['query'][_0x579c('0x40')]));_0x4ae796[_0x579c('0x3f')]=_0x4ae796[_0x579c('0x3f')]['length']?_0x4ae796['attributes']:_0x176441[_0x579c('0x3d')];_0x4ae796['order']=qs['sort'](_0x38d137[_0x579c('0x3e')][_0x579c('0x45')]);_0x4ae796['where']=qs[_0x579c('0x3b')](_[_0x579c('0x47')](_0x38d137[_0x579c('0x3e')],_0x176441['filters']));if(_0x38d137['query']['filter']){_0x4ae796[_0x579c('0x46')]=_['merge'](_0x4ae796[_0x579c('0x46')],{'$or':_['map'](_0x4ae796['attributes'],function(_0x2e6b62){var _0x365695={};_0x365695[_0x2e6b62]={'$like':'%'+_0x38d137[_0x579c('0x3e')][_0x579c('0x48')]+'%'};return _0x365695;})});}_0x4ae796=_[_0x579c('0x49')]({},_0x4ae796,_0x38d137[_0x579c('0x51')]);return _0x3bd037['getAgents'](_0x4ae796);}})[_0x579c('0x15')](function(_0x4eadc7){if(_0x4eadc7){_0x52a1d4=_0x4eadc7[_0x579c('0x41')];if(!_0x38d137[_0x579c('0x3e')][_0x579c('0x42')](_0x579c('0x43'))){_0x4ae796[_0x579c('0x25')]=qs[_0x579c('0x25')](_0x38d137[_0x579c('0x3e')]['limit']);_0x4ae796['offset']=qs['offset'](_0x38d137[_0x579c('0x3e')][_0x579c('0x23')]);}return _0x3bd037[_0x579c('0x128')](_0x4ae796);}})[_0x579c('0x15')](function(_0x561fa7){if(_0x561fa7){return _0x561fa7?{'count':_0x52a1d4,'rows':_0x561fa7}:null;}})[_0x579c('0x15')](respondWithResult(_0x1280dc,null))[_0x579c('0x1f')](handleError(_0x1280dc,null));}; \ No newline at end of file +var _0xa5af=['getSystemAvatar','server/files/images/avatars/system_avatar.png','getResult','chat','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','Applications','List','account','list','orderBy','applications','priority','asc','contact','customerIp','headers','x-forwarded-for','split','firstName','x-real-port','referer','browser','version','format','%s\x20%s','device','%s\x20%s\x20%s','stringify','threadId','externalUrl','ChatInteraction','ContactId','interaction','spread','lastName','messageId','update','created','autoclose','push','unmanaged','*,*,*,*','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','notify','offline','files','CompanyId','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','basename','transaction','Attachment','bulkCreate','MailServerOut','CloudProvider','Smtp','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','email','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','mapValues','Chat','notifyMail','attachments','offline-chat','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','Command','timezone','interval','indexOf','true','OFFLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','getSnippet','Interval','getProactiveActions','License','chatLicenseExceeded','Intervals','server/files/chat/iframe.ejs','URL','address','3.1.0','remote','x-real-ip','remoteAddress','replace','alignment','verticalAlignment','labelText','textColor','textButtonColor','backgroundColor','hideWhenOffline','IntervalId','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','getFields','online','onlineForm','items','fromKey','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','path','ejs','fs-extra','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','url','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','html-to-text','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','error','message','result','status','json','offset','undefined','limit','count','set','Content-Range','get','ChatWebsites','destroy','end','sendStatus','stack','name','send','index','Pause','map','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','ChatWebsite','includeAll','include','findAll','show','params','mandatoryDispositionPause','rawAttributes','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addDisposition','Disposition','findOne','hasOwnProperty','ChatWebsiteId','rows','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','nolimit','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','existsSync','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar'];(function(_0x9e3f17,_0x1a75f4){var _0x2c2f45=function(_0x1ff728){while(--_0x1ff728){_0x9e3f17['push'](_0x9e3f17['shift']());}};_0x2c2f45(++_0x1a75f4);}(_0xa5af,0x1d9));var _0xfa5a=function(_0x517078,_0x578fbf){_0x517078=_0x517078-0x0;var _0x1c8aeb=_0xa5af[_0x517078];return _0x1c8aeb;};'use strict';var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xfa5a('0x0'));var ejs=require(_0xfa5a('0x1'));var fs=require('fs');var fs_extra=require(_0xfa5a('0x2'));var _=require(_0xfa5a('0x3'));var querystring=require('querystring');var Redis=require(_0xfa5a('0x4'));var qs=require(_0xfa5a('0x5'));var logger=require(_0xfa5a('0x6'))(_0xfa5a('0x7'));var config=require(_0xfa5a('0x8'));var url=require(_0xfa5a('0x9'));var db=require('../../mysqldb')['db'];config[_0xfa5a('0xa')]=_[_0xfa5a('0xb')](config[_0xfa5a('0xa')],{'host':_0xfa5a('0xc'),'port':0x18eb});var socket=require(_0xfa5a('0xd'))(new Redis(config[_0xfa5a('0xa')]));require(_0xfa5a('0xe'))[_0xfa5a('0xf')](socket);var htmlToText=require(_0xfa5a('0x10'));var jayson=require(_0xfa5a('0x11'));var client=jayson[_0xfa5a('0x12')]['http']({'port':0x232c});var client9002=jayson[_0xfa5a('0x12')]['http']({'port':0x232a});var client9003=jayson[_0xfa5a('0x12')][_0xfa5a('0x13')]({'port':0x232b});var client9001=jayson[_0xfa5a('0x12')][_0xfa5a('0x13')]({'port':0x2329});function respondWithRpcPromise(_0x3cf365,_0x117499,_0x4bcf6e,_0x580c37){return new BPromise(function(_0x599bb3,_0x399c79){var _0xa62c02=_0x580c37||client;return _0xa62c02[_0xfa5a('0x14')](_0x3cf365,_0x4bcf6e)[_0xfa5a('0x15')](function(_0x30ad5e){logger[_0xfa5a('0x16')](_0xfa5a('0x17'),_0x117499,_0xfa5a('0x18'));logger['debug'](_0xfa5a('0x19'),_0x117499,_0xfa5a('0x18'),JSON['stringify'](_0x30ad5e));if(_0x30ad5e[_0xfa5a('0x1a')]){if(_0x30ad5e[_0xfa5a('0x1a')]['code']===0x1f4){logger[_0xfa5a('0x1a')](_0xfa5a('0x17'),_0x117499,_0x30ad5e[_0xfa5a('0x1a')][_0xfa5a('0x1b')]);return _0x399c79(_0x30ad5e[_0xfa5a('0x1a')][_0xfa5a('0x1b')]);}logger[_0xfa5a('0x1a')]('ChatWebsite,\x20%s,\x20%s',_0x117499,_0x30ad5e[_0xfa5a('0x1a')][_0xfa5a('0x1b')]);return _0x599bb3(_0x30ad5e[_0xfa5a('0x1a')][_0xfa5a('0x1b')]);}else{logger[_0xfa5a('0x16')](_0xfa5a('0x17'),_0x117499,_0xfa5a('0x18'));_0x599bb3(_0x30ad5e[_0xfa5a('0x1c')]['message']);}})['catch'](function(_0xf6e7f5){logger['error'](_0xfa5a('0x17'),_0x117499,_0xf6e7f5);_0x399c79(_0xf6e7f5);});});}function respondWithStatusCode(_0x20f38d,_0x1bbd8f){_0x1bbd8f=_0x1bbd8f||0xcc;return function(_0x595b0e){if(_0x595b0e){return _0x20f38d['sendStatus'](_0x1bbd8f);}return _0x20f38d[_0xfa5a('0x1d')](_0x1bbd8f)['end']();};}function respondWithResult(_0x53e2c1,_0x3b09ae){_0x3b09ae=_0x3b09ae||0xc8;return function(_0x5d2948){if(_0x5d2948){return _0x53e2c1['status'](_0x3b09ae)[_0xfa5a('0x1e')](_0x5d2948);}};}function respondWithFilteredResult(_0xc0f695,_0x347e28){return function(_0x30af70){if(_0x30af70){var _0x3f9d58=typeof _0x347e28[_0xfa5a('0x1f')]===_0xfa5a('0x20')&&typeof _0x347e28[_0xfa5a('0x21')]==='undefined';var _0x4746ee=_0x30af70[_0xfa5a('0x22')];var _0x18f6af=_0x3f9d58?0x0:_0x347e28['offset'];var _0x399acc=_0x3f9d58?_0x30af70[_0xfa5a('0x22')]:_0x347e28[_0xfa5a('0x1f')]+_0x347e28[_0xfa5a('0x21')];var _0x46fd07;if(_0x399acc>=_0x4746ee){_0x399acc=_0x4746ee;_0x46fd07=0xc8;}else{_0x46fd07=0xce;}_0xc0f695[_0xfa5a('0x1d')](_0x46fd07);return _0xc0f695[_0xfa5a('0x23')](_0xfa5a('0x24'),_0x18f6af+'-'+_0x399acc+'/'+_0x4746ee)[_0xfa5a('0x1e')](_0x30af70);}return null;};}function saveUpdates(_0x3f5f3e){return function(_0x1b653d){if(_0x1b653d){return _0x1b653d['update'](_0x3f5f3e)[_0xfa5a('0x15')](function(_0x2628c7){return _0x2628c7;});}return null;};}function removeEntity(_0x1b2cb9){return function(_0x258e00){if(_0x258e00){return _0x258e00['destroy']()[_0xfa5a('0x15')](function(){var _0x5d7cfd=_0x258e00[_0xfa5a('0x25')]({'plain':!![]});var _0x4cab7b=_0xfa5a('0x26');return db['UserProfileResource'][_0xfa5a('0x27')]({'where':{'type':_0x4cab7b,'resourceId':_0x5d7cfd['id']}})[_0xfa5a('0x15')](function(){return _0x258e00;});})['then'](function(){_0x1b2cb9['status'](0xcc)[_0xfa5a('0x28')]();});}};}function handleEntityNotFound(_0x51c8f2){return function(_0x525975){if(!_0x525975){_0x51c8f2[_0xfa5a('0x29')](0x194);}return _0x525975;};}function handleError(_0x4a38ef,_0x42abc4){_0x42abc4=_0x42abc4||0x1f4;return function(_0x5361c9){logger[_0xfa5a('0x1a')](_0x5361c9[_0xfa5a('0x2a')]);if(_0x5361c9[_0xfa5a('0x2b')]){delete _0x5361c9[_0xfa5a('0x2b')];}_0x4a38ef[_0xfa5a('0x1d')](_0x42abc4)[_0xfa5a('0x2c')](_0x5361c9);};}exports[_0xfa5a('0x2d')]=function(_0x3e4e14,_0x1ba7b5){var _0x15d3a8={'include':[{'model':db[_0xfa5a('0x2e')],'as':'mandatoryDispositionPause'}]},_0xf69ebe={},_0x24f705={'count':0x0,'rows':[]};var _0x141d50=_[_0xfa5a('0x2f')](db['ChatWebsite']['rawAttributes'],function(_0x5266f7){return{'name':_0x5266f7[_0xfa5a('0x30')],'type':_0x5266f7[_0xfa5a('0x31')][_0xfa5a('0x32')]};});_0xf69ebe[_0xfa5a('0x33')]=_[_0xfa5a('0x2f')](_0x141d50,_0xfa5a('0x2b'));_0xf69ebe['query']=_[_0xfa5a('0x34')](_0x3e4e14[_0xfa5a('0x35')]);_0xf69ebe[_0xfa5a('0x36')]=_[_0xfa5a('0x37')](_0xf69ebe['model'],_0xf69ebe['query']);_0x15d3a8['attributes']=_['intersection'](_0xf69ebe[_0xfa5a('0x33')],qs[_0xfa5a('0x38')](_0x3e4e14[_0xfa5a('0x35')][_0xfa5a('0x38')]));_0x15d3a8[_0xfa5a('0x39')]=_0x15d3a8[_0xfa5a('0x39')][_0xfa5a('0x3a')]?_0x15d3a8[_0xfa5a('0x39')]:_0xf69ebe[_0xfa5a('0x33')];if(!_0x3e4e14[_0xfa5a('0x35')]['hasOwnProperty']('nolimit')){_0x15d3a8[_0xfa5a('0x21')]=qs['limit'](_0x3e4e14[_0xfa5a('0x35')][_0xfa5a('0x21')]);_0x15d3a8[_0xfa5a('0x1f')]=qs[_0xfa5a('0x1f')](_0x3e4e14[_0xfa5a('0x35')]['offset']);}_0x15d3a8[_0xfa5a('0x3b')]=qs[_0xfa5a('0x3c')](_0x3e4e14[_0xfa5a('0x35')][_0xfa5a('0x3c')]);_0x15d3a8[_0xfa5a('0x3d')]=qs['filters'](_[_0xfa5a('0x3e')](_0x3e4e14['query'],_0xf69ebe['filters']),_0x141d50);if(_0x3e4e14[_0xfa5a('0x35')][_0xfa5a('0x3f')]){_0x15d3a8[_0xfa5a('0x3d')]=_[_0xfa5a('0x40')](_0x15d3a8[_0xfa5a('0x3d')],{'$or':_[_0xfa5a('0x2f')](_0x141d50,function(_0x2732df){if(_0x2732df[_0xfa5a('0x31')]!==_0xfa5a('0x41')){var _0x4e7184={};_0x4e7184[_0x2732df[_0xfa5a('0x2b')]]={'$like':'%'+_0x3e4e14[_0xfa5a('0x35')][_0xfa5a('0x3f')]+'%'};return _0x4e7184;}})});}_0x15d3a8=_[_0xfa5a('0x40')]({},_0x15d3a8,_0x3e4e14['options']);var _0x4636a1={'where':_0x15d3a8['where']};return db[_0xfa5a('0x42')]['count'](_0x4636a1)[_0xfa5a('0x15')](function(_0x59d683){_0x24f705['count']=_0x59d683;if(_0x3e4e14[_0xfa5a('0x35')][_0xfa5a('0x43')]){_0x15d3a8[_0xfa5a('0x44')]=[{'all':!![]}];}return db[_0xfa5a('0x42')][_0xfa5a('0x45')](_0x15d3a8);})[_0xfa5a('0x15')](function(_0x3042a0){_0x24f705['rows']=_0x3042a0;return _0x24f705;})[_0xfa5a('0x15')](respondWithFilteredResult(_0x1ba7b5,_0x15d3a8))['catch'](handleError(_0x1ba7b5,null));};exports[_0xfa5a('0x46')]=function(_0x503354,_0x3d013d){var _0x361206={'raw':![],'where':{'id':_0x503354[_0xfa5a('0x47')]['id']},'include':[{'model':db['Pause'],'as':_0xfa5a('0x48')}]},_0x1fd400={};_0x1fd400[_0xfa5a('0x33')]=_[_0xfa5a('0x34')](db[_0xfa5a('0x42')][_0xfa5a('0x49')]);_0x1fd400[_0xfa5a('0x35')]=_['keys'](_0x503354[_0xfa5a('0x35')]);_0x1fd400[_0xfa5a('0x36')]=_[_0xfa5a('0x37')](_0x1fd400['model'],_0x1fd400[_0xfa5a('0x35')]);_0x361206[_0xfa5a('0x39')]=_[_0xfa5a('0x37')](_0x1fd400[_0xfa5a('0x33')],qs['fields'](_0x503354[_0xfa5a('0x35')][_0xfa5a('0x38')]));_0x361206['attributes']=_0x361206[_0xfa5a('0x39')]['length']?_0x361206[_0xfa5a('0x39')]:_0x1fd400['model'];if(_0x503354[_0xfa5a('0x35')][_0xfa5a('0x43')]){_0x361206['include']=[{'all':!![]}];}_0x361206=_[_0xfa5a('0x40')]({},_0x361206,_0x503354[_0xfa5a('0x4a')]);return db[_0xfa5a('0x42')][_0xfa5a('0x4b')](_0x361206)[_0xfa5a('0x15')](handleEntityNotFound(_0x3d013d,null))[_0xfa5a('0x15')](respondWithResult(_0x3d013d,null))[_0xfa5a('0x4c')](handleError(_0x3d013d,null));};exports[_0xfa5a('0x4d')]=function(_0x4110e4,_0x50fed5){return db[_0xfa5a('0x42')]['create'](_0x4110e4[_0xfa5a('0x4e')],{})[_0xfa5a('0x15')](function(_0x47c878){var _0x3b6407=_0x4110e4[_0xfa5a('0x4f')]['get']({'plain':!![]});if(!_0x3b6407)throw new Error(_0xfa5a('0x50'));if(_0x3b6407['role']===_0xfa5a('0x4f')){var _0x5253f8=_0x47c878[_0xfa5a('0x25')]({'plain':!![]});var _0xa27dc4=_0xfa5a('0x26');return db[_0xfa5a('0x51')][_0xfa5a('0x4b')]({'where':{'name':_0xa27dc4,'userProfileId':_0x3b6407['userProfileId']},'raw':!![]})[_0xfa5a('0x15')](function(_0x38599e){if(_0x38599e&&_0x38599e[_0xfa5a('0x52')]===0x0){return db[_0xfa5a('0x53')][_0xfa5a('0x4d')]({'name':_0x5253f8[_0xfa5a('0x2b')],'resourceId':_0x5253f8['id'],'type':_0x38599e[_0xfa5a('0x2b')],'sectionId':_0x38599e['id']},{})['then'](function(){return _0x47c878;});}else{return _0x47c878;}})['catch'](function(_0x5878c3){logger[_0xfa5a('0x1a')](_0xfa5a('0x54'),_0x5878c3);throw _0x5878c3;});}return _0x47c878;})[_0xfa5a('0x15')](respondWithResult(_0x50fed5,0xc9))[_0xfa5a('0x4c')](handleError(_0x50fed5,null));};exports['update']=function(_0x50dd12,_0x5cc577){if(_0x50dd12[_0xfa5a('0x4e')]['id']){delete _0x50dd12['body']['id'];}return db['ChatWebsite'][_0xfa5a('0x4b')]({'where':{'id':_0x50dd12[_0xfa5a('0x47')]['id']},'include':[{'model':db[_0xfa5a('0x2e')],'as':_0xfa5a('0x48')}]})['then'](handleEntityNotFound(_0x5cc577,null))[_0xfa5a('0x15')](saveUpdates(_0x50dd12[_0xfa5a('0x4e')],null))[_0xfa5a('0x15')](respondWithResult(_0x5cc577,null))[_0xfa5a('0x4c')](handleError(_0x5cc577,null));};exports[_0xfa5a('0x27')]=function(_0x9f6b39,_0x3843be){return db[_0xfa5a('0x42')][_0xfa5a('0x4b')]({'where':{'id':_0x9f6b39[_0xfa5a('0x47')]['id']}})[_0xfa5a('0x15')](handleEntityNotFound(_0x3843be,null))[_0xfa5a('0x15')](removeEntity(_0x3843be,null))[_0xfa5a('0x4c')](handleError(_0x3843be,null));};exports['describe']=function(_0x28c7b9,_0x44c617){return db[_0xfa5a('0x42')]['describe']()[_0xfa5a('0x15')](respondWithResult(_0x44c617,null))[_0xfa5a('0x4c')](handleError(_0x44c617,null));};exports[_0xfa5a('0x55')]=function(_0xb5402d,_0x20fd17){if(_0xb5402d['body']['id']){delete _0xb5402d['body']['id'];}return db[_0xfa5a('0x42')][_0xfa5a('0x4b')]({'where':{'id':_0xb5402d[_0xfa5a('0x47')]['id']}})['then'](handleEntityNotFound(_0x20fd17,null))['then'](function(_0x405e9e){if(_0x405e9e){_0xb5402d[_0xfa5a('0x4e')]['ChatWebsiteId']=_0x405e9e['id'];return db[_0xfa5a('0x56')][_0xfa5a('0x4d')](_0xb5402d[_0xfa5a('0x4e')]);}})[_0xfa5a('0x15')](respondWithResult(_0x20fd17,null))[_0xfa5a('0x4c')](handleError(_0x20fd17,null));};exports['getDispositions']=function(_0x33985f,_0x2b7230){var _0x1e9490={'raw':![],'where':{}};var _0x3b8afb={};var _0x90a37f={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xfa5a('0x57')]({'where':{'id':_0x33985f['params']['id']}})[_0xfa5a('0x15')](handleEntityNotFound(_0x2b7230,null))[_0xfa5a('0x15')](function(_0x51d794){if(_0x51d794){_0x3b8afb[_0xfa5a('0x33')]=_[_0xfa5a('0x34')](db[_0xfa5a('0x56')][_0xfa5a('0x49')]);_0x3b8afb[_0xfa5a('0x35')]=_['keys'](_0x33985f[_0xfa5a('0x35')]);_0x3b8afb['filters']=_[_0xfa5a('0x37')](_0x3b8afb[_0xfa5a('0x33')],_0x3b8afb[_0xfa5a('0x35')]);_0x1e9490[_0xfa5a('0x39')]=_[_0xfa5a('0x37')](_0x3b8afb[_0xfa5a('0x33')],qs['fields'](_0x33985f[_0xfa5a('0x35')][_0xfa5a('0x38')]));_0x1e9490[_0xfa5a('0x39')]=_0x1e9490[_0xfa5a('0x39')]['length']?_0x1e9490['attributes']:_0x3b8afb[_0xfa5a('0x33')];if(!_0x33985f[_0xfa5a('0x35')][_0xfa5a('0x58')]('nolimit')){_0x1e9490['limit']=qs[_0xfa5a('0x21')](_0x33985f['query'][_0xfa5a('0x21')]);_0x1e9490[_0xfa5a('0x1f')]=qs[_0xfa5a('0x1f')](_0x33985f[_0xfa5a('0x35')][_0xfa5a('0x1f')]);}_0x1e9490[_0xfa5a('0x3b')]=qs[_0xfa5a('0x3c')](_0x33985f[_0xfa5a('0x35')][_0xfa5a('0x3c')]);_0x1e9490[_0xfa5a('0x3d')]=qs[_0xfa5a('0x36')](_[_0xfa5a('0x3e')](_0x33985f[_0xfa5a('0x35')],_0x3b8afb[_0xfa5a('0x36')]));_0x1e9490['where'][_0xfa5a('0x59')]=_0x51d794['id'];if(_0x33985f[_0xfa5a('0x35')][_0xfa5a('0x3f')]){_0x1e9490[_0xfa5a('0x3d')]=_[_0xfa5a('0x40')](_0x1e9490['where'],{'$or':_[_0xfa5a('0x2f')](_0x1e9490[_0xfa5a('0x39')],function(_0x562731){var _0x1fa581={};_0x1fa581[_0x562731]={'$like':'%'+_0x33985f[_0xfa5a('0x35')][_0xfa5a('0x3f')]+'%'};return _0x1fa581;})});}_0x1e9490=_[_0xfa5a('0x40')]({},_0x1e9490,_0x33985f[_0xfa5a('0x4a')]);return db[_0xfa5a('0x56')][_0xfa5a('0x22')]({'where':_0x1e9490['where']})[_0xfa5a('0x15')](function(_0x283073){_0x90a37f[_0xfa5a('0x22')]=_0x283073;if(_0x33985f[_0xfa5a('0x35')]['includeAll']){_0x1e9490[_0xfa5a('0x44')]=[{'all':!![]}];}return db['Disposition'][_0xfa5a('0x45')](_0x1e9490);})[_0xfa5a('0x15')](function(_0x2c2088){_0x90a37f[_0xfa5a('0x5a')]=_0x2c2088;return _0x90a37f;});}})['then'](respondWithFilteredResult(_0x2b7230,_0x1e9490))[_0xfa5a('0x4c')](handleError(_0x2b7230,null));};exports[_0xfa5a('0x5b')]=function(_0x2b5b13,_0x31afeb){return db[_0xfa5a('0x42')][_0xfa5a('0x4b')]({'where':{'id':_0x2b5b13[_0xfa5a('0x47')]['id']}})[_0xfa5a('0x15')](handleEntityNotFound(_0x31afeb,null))[_0xfa5a('0x15')](function(_0x210bc0){if(_0x210bc0){return _0x210bc0[_0xfa5a('0x5b')](_0x2b5b13['query'][_0xfa5a('0x5c')]);}})[_0xfa5a('0x15')](respondWithStatusCode(_0x31afeb,null))[_0xfa5a('0x4c')](handleError(_0x31afeb,null));};exports[_0xfa5a('0x5d')]=function(_0x1298ea,_0x3a0f1d){if(_0x1298ea[_0xfa5a('0x4e')]['id']){delete _0x1298ea[_0xfa5a('0x4e')]['id'];}return db[_0xfa5a('0x42')][_0xfa5a('0x4b')]({'where':{'id':_0x1298ea['params']['id']}})[_0xfa5a('0x15')](handleEntityNotFound(_0x3a0f1d,null))['then'](function(_0x354dd7){if(_0x354dd7){_0x1298ea[_0xfa5a('0x4e')][_0xfa5a('0x59')]=_0x354dd7['id'];return db['CannedAnswer'][_0xfa5a('0x4d')](_0x1298ea[_0xfa5a('0x4e')]);}})[_0xfa5a('0x15')](respondWithResult(_0x3a0f1d,null))['catch'](handleError(_0x3a0f1d,null));};exports[_0xfa5a('0x5e')]=function(_0x47f3e2,_0x2ab327){var _0x22b359={'raw':![],'where':{}};var _0x4cf1cc={};var _0x46dc63={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xfa5a('0x57')]({'where':{'id':_0x47f3e2[_0xfa5a('0x47')]['id']}})['then'](handleEntityNotFound(_0x2ab327,null))['then'](function(_0x1bc626){if(_0x1bc626){_0x4cf1cc[_0xfa5a('0x33')]=_[_0xfa5a('0x34')](db[_0xfa5a('0x5f')][_0xfa5a('0x49')]);_0x4cf1cc['query']=_[_0xfa5a('0x34')](_0x47f3e2[_0xfa5a('0x35')]);_0x4cf1cc['filters']=_['intersection'](_0x4cf1cc['model'],_0x4cf1cc[_0xfa5a('0x35')]);_0x22b359['attributes']=_['intersection'](_0x4cf1cc[_0xfa5a('0x33')],qs[_0xfa5a('0x38')](_0x47f3e2['query'][_0xfa5a('0x38')]));_0x22b359[_0xfa5a('0x39')]=_0x22b359['attributes'][_0xfa5a('0x3a')]?_0x22b359[_0xfa5a('0x39')]:_0x4cf1cc[_0xfa5a('0x33')];if(!_0x47f3e2['query'][_0xfa5a('0x58')](_0xfa5a('0x60'))){_0x22b359['limit']=qs[_0xfa5a('0x21')](_0x47f3e2[_0xfa5a('0x35')][_0xfa5a('0x21')]);_0x22b359[_0xfa5a('0x1f')]=qs['offset'](_0x47f3e2[_0xfa5a('0x35')]['offset']);}_0x22b359['order']=qs['sort'](_0x47f3e2['query'][_0xfa5a('0x3c')]);_0x22b359[_0xfa5a('0x3d')]=qs[_0xfa5a('0x36')](_[_0xfa5a('0x3e')](_0x47f3e2['query'],_0x4cf1cc[_0xfa5a('0x36')]));_0x22b359[_0xfa5a('0x3d')][_0xfa5a('0x59')]=_0x1bc626['id'];if(_0x47f3e2[_0xfa5a('0x35')][_0xfa5a('0x3f')]){_0x22b359[_0xfa5a('0x3d')]=_[_0xfa5a('0x40')](_0x22b359[_0xfa5a('0x3d')],{'$or':_[_0xfa5a('0x2f')](_0x22b359['attributes'],function(_0x2f09b6){var _0x21eda={};_0x21eda[_0x2f09b6]={'$like':'%'+_0x47f3e2[_0xfa5a('0x35')][_0xfa5a('0x3f')]+'%'};return _0x21eda;})});}_0x22b359=_[_0xfa5a('0x40')]({},_0x22b359,_0x47f3e2['options']);return db[_0xfa5a('0x5f')][_0xfa5a('0x22')]({'where':_0x22b359[_0xfa5a('0x3d')]})[_0xfa5a('0x15')](function(_0x3062c5){_0x46dc63[_0xfa5a('0x22')]=_0x3062c5;if(_0x47f3e2['query'][_0xfa5a('0x43')]){_0x22b359[_0xfa5a('0x44')]=[{'all':!![]}];}return db[_0xfa5a('0x5f')][_0xfa5a('0x45')](_0x22b359);})[_0xfa5a('0x15')](function(_0x4b4d7c){_0x46dc63[_0xfa5a('0x5a')]=_0x4b4d7c;return _0x46dc63;});}})['then'](respondWithFilteredResult(_0x2ab327,_0x22b359))[_0xfa5a('0x4c')](handleError(_0x2ab327,null));};exports['removeAnswers']=function(_0x34f75f,_0x380944){return db[_0xfa5a('0x42')][_0xfa5a('0x4b')]({'where':{'id':_0x34f75f[_0xfa5a('0x47')]['id']}})[_0xfa5a('0x15')](handleEntityNotFound(_0x380944,null))[_0xfa5a('0x15')](function(_0x51948f){if(_0x51948f){return _0x51948f[_0xfa5a('0x61')](_0x34f75f[_0xfa5a('0x35')]['ids']);}})[_0xfa5a('0x15')](respondWithStatusCode(_0x380944,null))[_0xfa5a('0x4c')](handleError(_0x380944,null));};exports[_0xfa5a('0x62')]=function(_0x3fab50,_0x12792c){_0x3fab50[_0xfa5a('0x4e')][_0xfa5a('0x63')]=_0x3fab50[_0xfa5a('0x64')][_0xfa5a('0x65')];return db[_0xfa5a('0x42')][_0xfa5a('0x4b')]({'where':{'id':_0x3fab50[_0xfa5a('0x47')]['id']}})[_0xfa5a('0x15')](handleEntityNotFound(_0x12792c,null))['then'](saveUpdates(_0x3fab50[_0xfa5a('0x4e')],null))[_0xfa5a('0x15')](respondWithResult(_0x12792c,null))[_0xfa5a('0x4c')](handleError(_0x12792c,null));};exports[_0xfa5a('0x66')]=function(_0x4640e8,_0x417d3e){_0x4640e8[_0xfa5a('0x4e')][_0xfa5a('0x67')]=_0x4640e8['file']['filename'];return db['ChatWebsite'][_0xfa5a('0x4b')]({'where':{'id':_0x4640e8['params']['id']}})['then'](handleEntityNotFound(_0x417d3e,null))[_0xfa5a('0x15')](saveUpdates(_0x4640e8['body'],null))['then'](respondWithResult(_0x417d3e,null))['catch'](handleError(_0x417d3e,null));};exports['addCustomerAvatar']=function(_0x18e6ac,_0x5ac669){_0x18e6ac['body']['customerAvatar']=_0x18e6ac['file']['filename'];return db[_0xfa5a('0x42')][_0xfa5a('0x4b')]({'where':{'id':_0x18e6ac[_0xfa5a('0x47')]['id']}})[_0xfa5a('0x15')](handleEntityNotFound(_0x5ac669,null))[_0xfa5a('0x15')](saveUpdates(_0x18e6ac[_0xfa5a('0x4e')],null))['then'](respondWithResult(_0x5ac669,null))[_0xfa5a('0x4c')](handleError(_0x5ac669,null));};exports['addSystemAvatar']=function(_0x5e819c,_0x367ff1){_0x5e819c[_0xfa5a('0x4e')][_0xfa5a('0x68')]=_0x5e819c[_0xfa5a('0x64')][_0xfa5a('0x65')];return db[_0xfa5a('0x42')][_0xfa5a('0x4b')]({'where':{'id':_0x5e819c[_0xfa5a('0x47')]['id']}})[_0xfa5a('0x15')](handleEntityNotFound(_0x367ff1,null))[_0xfa5a('0x15')](saveUpdates(_0x5e819c['body'],null))['then'](respondWithResult(_0x367ff1,null))['catch'](handleError(_0x367ff1,null));};exports[_0xfa5a('0x69')]=function(_0x2ba59b,_0x518ac5){var _0x14141c=path[_0xfa5a('0x6a')](config[_0xfa5a('0x6b')],_0xfa5a('0x6c'));var _0x4e08a6={'where':{'id':_0x2ba59b[_0xfa5a('0x47')]['id']},'attributes':['id',_0xfa5a('0x63')],'raw':!![]};var _0x3e501a=![];return require(_0xfa5a('0x6d'))[_0xfa5a('0x6e')]()[_0xfa5a('0x15')](function(_0x1799bd){if(_0x1799bd){_0x3e501a=_0x1799bd[_0xfa5a('0x6f')];}})[_0xfa5a('0x15')](function(){return db[_0xfa5a('0x42')][_0xfa5a('0x4b')](_0x4e08a6);})[_0xfa5a('0x15')](handleEntityNotFound(_0x518ac5,null))[_0xfa5a('0x15')](function(_0x2b5545){if(_0x2b5545){if(!_[_0xfa5a('0x70')](_0x2b5545[_0xfa5a('0x63')])){if(fs['existsSync'](path[_0xfa5a('0x6a')](config[_0xfa5a('0x6b')],_0xfa5a('0x71'),_0x2b5545[_0xfa5a('0x63')]))&&_0x3e501a){_0x14141c=path[_0xfa5a('0x6a')](config[_0xfa5a('0x6b')],_0xfa5a('0x71'),_0x2b5545[_0xfa5a('0x63')]);}}return _0x518ac5[_0xfa5a('0x72')](_0x14141c);}})[_0xfa5a('0x4c')](handleError(_0x518ac5,null));};exports[_0xfa5a('0x73')]=function(_0x19e33e,_0x252646){var _0x4b0c7d=path[_0xfa5a('0x6a')](config[_0xfa5a('0x6b')],_0xfa5a('0x74'));var _0x1f6b33={'where':{'id':_0x19e33e[_0xfa5a('0x47')]['id']},'attributes':['id',_0xfa5a('0x67')],'raw':!![]};return db[_0xfa5a('0x42')]['find'](_0x1f6b33)[_0xfa5a('0x15')](handleEntityNotFound(_0x252646,null))[_0xfa5a('0x15')](function(_0x28d4d2){if(_0x28d4d2){if(!_[_0xfa5a('0x70')](_0x28d4d2[_0xfa5a('0x67')])){if(fs[_0xfa5a('0x75')](path[_0xfa5a('0x6a')](config[_0xfa5a('0x6b')],_0xfa5a('0x76'),_0x28d4d2[_0xfa5a('0x67')]))){_0x4b0c7d=path[_0xfa5a('0x6a')](config[_0xfa5a('0x6b')],'server/files/images/avatars/',_0x28d4d2[_0xfa5a('0x67')]);}}return _0x252646[_0xfa5a('0x72')](_0x4b0c7d);}})[_0xfa5a('0x4c')](handleError(_0x252646,null));};exports[_0xfa5a('0x77')]=function(_0x5ee07b,_0x31cb9d){var _0x4fdf58=path[_0xfa5a('0x6a')](config[_0xfa5a('0x6b')],_0xfa5a('0x78'));var _0x9059f5={'where':{'id':_0x5ee07b[_0xfa5a('0x47')]['id']},'attributes':['id',_0xfa5a('0x79'),_0xfa5a('0x7a')],'raw':!![]};return db[_0xfa5a('0x42')][_0xfa5a('0x4b')](_0x9059f5)[_0xfa5a('0x15')](handleEntityNotFound(_0x31cb9d,null))[_0xfa5a('0x15')](function(_0x2b0a8a){if(_0x2b0a8a){if(!_[_0xfa5a('0x70')](_0x2b0a8a[_0xfa5a('0x79')])){if(fs['existsSync'](path[_0xfa5a('0x6a')](config['root'],_0xfa5a('0x76'),_0x2b0a8a[_0xfa5a('0x79')]))&&_0x2b0a8a['showCustomerAvatar']){_0x4fdf58=path[_0xfa5a('0x6a')](config[_0xfa5a('0x6b')],_0xfa5a('0x76'),_0x2b0a8a[_0xfa5a('0x79')]);}}return _0x31cb9d[_0xfa5a('0x72')](_0x4fdf58);}})['catch'](handleError(_0x31cb9d,null));};exports[_0xfa5a('0x7b')]=function(_0x45e783,_0x38838f){var _0x19df36=path[_0xfa5a('0x6a')](config['root'],_0xfa5a('0x7c'));var _0xdfc42={'where':{'id':_0x45e783[_0xfa5a('0x47')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xfa5a('0x42')]['find'](_0xdfc42)[_0xfa5a('0x15')](handleEntityNotFound(_0x38838f,null))[_0xfa5a('0x15')](function(_0x32ae79){if(_0x32ae79){if(!_[_0xfa5a('0x70')](_0x32ae79[_0xfa5a('0x68')])){if(fs[_0xfa5a('0x75')](path[_0xfa5a('0x6a')](config['root'],_0xfa5a('0x76'),_0x32ae79[_0xfa5a('0x68')]))){_0x19df36=path[_0xfa5a('0x6a')](config[_0xfa5a('0x6b')],'server/files/images/avatars/',_0x32ae79[_0xfa5a('0x68')]);}}return _0x38838f[_0xfa5a('0x72')](_0x19df36);}})['catch'](handleError(_0x38838f,null));};exports['notify']=function(_0x5ce947,_0x1730ba){var _0xeb6d85=require('user-agent-parser');var _0x3a50c3=new _0xeb6d85();var _0x1e8220=_0x3a50c3['setUA'](_0x5ce947['headers']['user-agent'])[_0xfa5a('0x7d')]();var _0x3f03fd={'body':_0x5ce947['body'],'channel':_0xfa5a('0x7e')};var _0x4a85e6=[];var _0x5e5c27=[];var _0x8ae49d={};var _0x631b84=![];return db[_0xfa5a('0x7f')][_0xfa5a('0x80')]()['then'](function(_0x1acc83){if(!_0x1acc83){throw new db[(_0xfa5a('0x81'))][(_0xfa5a('0x82'))](_0xfa5a('0x83'));}_0x4a85e6=_[_0xfa5a('0x84')](_[_0xfa5a('0x34')](_0x1acc83),['createdAt',_0xfa5a('0x85')]);_0x5e5c27=_[_0xfa5a('0x84')](_[_0xfa5a('0x34')](_0x1acc83),[_0xfa5a('0x86'),'updatedAt','CompanyId',_0xfa5a('0x87')]);if(_0x5ce947[_0xfa5a('0x4e')]['id']){delete _0x5ce947[_0xfa5a('0x4e')]['id'];}if(_[_0xfa5a('0x70')](_0x5ce947['body'][_0xfa5a('0x88')])){throw new db[(_0xfa5a('0x81'))][(_0xfa5a('0x82'))](_0xfa5a('0x89'));}if(_[_0xfa5a('0x70')](_0x5ce947[_0xfa5a('0x4e')][_0xfa5a('0x4e')])||_0x5ce947[_0xfa5a('0x4e')][_0xfa5a('0x4e')]===''){throw new db['Sequelize'][(_0xfa5a('0x82'))](_0xfa5a('0x8a'));}if(_[_0xfa5a('0x70')](_0x5ce947['body'][_0xfa5a('0x8b')])){throw new db[(_0xfa5a('0x81'))][(_0xfa5a('0x82'))](_0xfa5a('0x8c')+_0x5e5c27);}if(!_['includes'](_0x5e5c27,_0x5ce947[_0xfa5a('0x4e')]['mapKey'])){throw new db[(_0xfa5a('0x81'))][(_0xfa5a('0x82'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5e5c27);}_0x8ae49d[_0x5ce947['body'][_0xfa5a('0x8b')]]=_0x5ce947[_0xfa5a('0x4e')][_0xfa5a('0x88')];})[_0xfa5a('0x15')](function(){return db['ChatWebsite'][_0xfa5a('0x4b')]({'where':{'id':_0x5ce947['params']['id']},'include':[{'model':db[_0xfa5a('0x8d')],'as':'List','include':[{'model':db[_0xfa5a('0x7f')],'as':_0xfa5a('0x8e'),'where':_0x8ae49d,'limit':0x1,'order':[[_0xfa5a('0x85'),'DESC']]}]},{'model':db['ChatApplication'],'as':_0xfa5a('0x8f')}]});})[_0xfa5a('0x15')](handleEntityNotFound(_0x1730ba,null))[_0xfa5a('0x15')](function(_0x189172){if(_0x189172&&_0x189172[_0xfa5a('0x90')]){_0x3f03fd[_0xfa5a('0x91')]=_0x189172;_0x3f03fd['applications']=_0x189172[_0xfa5a('0x8f')];_0x3f03fd[_0xfa5a('0x92')]=_0x189172['List'];_0x3f03fd['applications']=_[_0xfa5a('0x93')](_0x3f03fd[_0xfa5a('0x94')],[_0xfa5a('0x95')],[_0xfa5a('0x96')]);if(_0x3f03fd[_0xfa5a('0x91')][_0xfa5a('0x8f')]){delete _0x3f03fd[_0xfa5a('0x91')]['Applications'];}if(_0x3f03fd[_0xfa5a('0x91')][_0xfa5a('0x90')]&&_0x3f03fd['account'][_0xfa5a('0x90')][_0xfa5a('0x8e')][_0xfa5a('0x3a')]){return _0x3f03fd['account'][_0xfa5a('0x90')][_0xfa5a('0x8e')][0x0];}var _0x1a23df=_[_0xfa5a('0xb')](_0x5ce947[_0xfa5a('0x4e')],{'firstName':_0x5ce947['body'][_0xfa5a('0x88')],'ListId':_0x189172['ListId']});_0x1a23df[_0x5ce947['body']['mapKey']]=_0x5ce947[_0xfa5a('0x4e')][_0xfa5a('0x88')];return db['CmContact']['create'](_0x1a23df,{'fields':_0x4a85e6,'raw':!![]});}})[_0xfa5a('0x15')](handleEntityNotFound(_0x1730ba,null))[_0xfa5a('0x15')](function(_0x250513){_0x3f03fd[_0xfa5a('0x97')]=_0x250513;var _0x318d1a=_0x5ce947[_0xfa5a('0x4e')][_0xfa5a('0x98')];if(_0x5ce947[_0xfa5a('0x99')]['cf-connecting-ip']){_0x318d1a=_0x5ce947['headers']['cf-connecting-ip'];}else if(_0x5ce947[_0xfa5a('0x99')][_0xfa5a('0x9a')]){_0x318d1a=_['first'](_0x5ce947[_0xfa5a('0x99')][_0xfa5a('0x9a')][_0xfa5a('0x9b')](','));}if(_0x250513){var _0x50c2de={'ContactId':_0x250513['id'],'ChatWebsiteId':_0x5ce947[_0xfa5a('0x47')]['id'],'from':(_0x250513[_0xfa5a('0x9c')]||'')+'\x20'+(_0x250513['lastName']||''),'customerIp':_0x318d1a,'customerPort':_0x5ce947[_0xfa5a('0x99')]['x-real-port']?_0x5ce947['headers'][_0xfa5a('0x9d')]:null,'referer':_0x5ce947['body'][_0xfa5a('0x9e')],'browserName':_0x1e8220[_0xfa5a('0x9f')][_0xfa5a('0x2b')]&&_0x1e8220['browser'][_0xfa5a('0xa0')]?util[_0xfa5a('0xa1')](_0xfa5a('0xa2'),_0x1e8220[_0xfa5a('0x9f')]['name'],_0x1e8220[_0xfa5a('0x9f')]['version']):'unknown','browserVersion':_0x1e8220[_0xfa5a('0x9f')][_0xfa5a('0xa0')]||'unknown','osName':util[_0xfa5a('0xa1')](_0xfa5a('0xa2'),_0x1e8220['os'][_0xfa5a('0x2b')],_0x1e8220['os'][_0xfa5a('0xa0')]),'osVersion':_0x1e8220['os']['version'],'deviceModel':_0x1e8220[_0xfa5a('0xa3')][_0xfa5a('0x33')]&&_0x1e8220['device']['vendor']?util[_0xfa5a('0xa1')](_0xfa5a('0xa4'),_0x1e8220[_0xfa5a('0xa3')][_0xfa5a('0x33')],_0x1e8220[_0xfa5a('0xa3')]['vendor'],_0x1e8220[_0xfa5a('0xa3')][_0xfa5a('0x31')]):null,'deviceVendor':_0x1e8220[_0xfa5a('0xa3')]['vendor'],'deviceType':_0x1e8220[_0xfa5a('0xa3')][_0xfa5a('0x31')],'formData':JSON[_0xfa5a('0xa5')](_0x5ce947[_0xfa5a('0x4e')])};var _0x32d4a7={'ChatWebsiteId':_0x5ce947['params']['id'],'closed':![]};if(_0x5ce947[_0xfa5a('0x4e')][_0xfa5a('0xa6')]){_0x32d4a7['threadId']=_0x5ce947[_0xfa5a('0x4e')][_0xfa5a('0xa6')];return db['ChatInteraction'][_0xfa5a('0x4b')]({'where':_0x32d4a7})['then'](function(_0x16e4dc){if(_0x16e4dc){return[_0x16e4dc,![]];}_0x50c2de[_0xfa5a('0xa6')]=_0x5ce947[_0xfa5a('0x4e')]['threadId'];_0x50c2de[_0xfa5a('0xa7')]=_0x5ce947[_0xfa5a('0x4e')][_0xfa5a('0xa7')];return db[_0xfa5a('0xa8')][_0xfa5a('0x4d')](_0x50c2de)[_0xfa5a('0x15')](function(_0x30b801){return[_0x30b801,!![]];});});}_0x32d4a7[_0xfa5a('0xa9')]=_0x250513['id'];if(_0x5ce947[_0xfa5a('0x4e')][_0xfa5a('0xaa')]&&_0x5ce947[_0xfa5a('0x4e')][_0xfa5a('0xaa')]['id']){_0x32d4a7['id']=_0x5ce947[_0xfa5a('0x4e')][_0xfa5a('0xaa')]['id'];return db['ChatInteraction'][_0xfa5a('0x4b')]({'where':_0x32d4a7})[_0xfa5a('0x15')](function(_0x5f1e4a){if(_0x5f1e4a){return[_0x5f1e4a,![]];}return db[_0xfa5a('0xa8')][_0xfa5a('0x4d')](_0x50c2de)[_0xfa5a('0x15')](function(_0x591cb7){return[_0x591cb7,!![]];});});}return db[_0xfa5a('0xa8')]['create'](_0x50c2de)[_0xfa5a('0x15')](function(_0x16974e){return[_0x16974e,!![]];});}})[_0xfa5a('0xab')](function(_0x242ece,_0x5a2e85){if(_0x242ece){_0x631b84=_0x5a2e85;if(!_0x5a2e85){var _0x2ccbcc={'from':(_0x3f03fd['contact'][_0xfa5a('0x9c')]||'')+'\x20'+(_0x3f03fd[_0xfa5a('0x97')][_0xfa5a('0xac')]||'')};if(_0x5ce947[_0xfa5a('0x4e')][_0xfa5a('0xa6')]&&_0x5ce947[_0xfa5a('0x4e')]['messageId']&&_0x5ce947[_0xfa5a('0x4e')][_0xfa5a('0xa6')]!=_0x5ce947['body'][_0xfa5a('0xad')]){_0x2ccbcc[_0xfa5a('0xa6')]=_0x5ce947['body'][_0xfa5a('0xad')];}return _0x242ece[_0xfa5a('0xae')](_0x2ccbcc);}else{return _0x242ece;}}})[_0xfa5a('0x15')](function(_0x16c329){_0x3f03fd[_0xfa5a('0xaa')]=_0x16c329[_0xfa5a('0x25')]({'plain':!![]});_0x3f03fd['interaction'][_0xfa5a('0xaf')]=_0x631b84;if(_0x3f03fd[_0xfa5a('0xaa')]['created']){if(_0x3f03fd[_0xfa5a('0x91')][_0xfa5a('0xb0')]){_0x3f03fd['applications'][_0xfa5a('0xb1')]({'id':0x0,'priority':_0x3f03fd['applications'][_0xfa5a('0x3a')]+0x1,'app':'close','appdata':_0xfa5a('0xb2'),'interval':_0xfa5a('0xb3')});}}return db['ChatMessage']['create']({'body':_0x5ce947[_0xfa5a('0x4e')][_0xfa5a('0x4e')],'ChatWebsiteId':_0x5ce947[_0xfa5a('0x47')]['id'],'ChatInteractionId':_0x16c329['id'],'direction':'in','ContactId':_0x3f03fd[_0xfa5a('0x97')]['id'],'AttachmentId':_0x5ce947['body'][_0xfa5a('0xb4')]});})['then'](function(_0x207992){_0x3f03fd[_0xfa5a('0x1b')]=_0x207992;if(_0x3f03fd[_0xfa5a('0xaa')][_0xfa5a('0xb5')]){return db[_0xfa5a('0xb6')]['find']({'attributes':['id',_0xfa5a('0x2b')],'where':{'id':_0x3f03fd[_0xfa5a('0xaa')][_0xfa5a('0xb5')]}})['then'](function(_0x5187e7){if(_0x5187e7){_0x3f03fd[_0xfa5a('0x94')][_0xfa5a('0xb7')]({'id':0x0,'priority':0x0,'app':_0xfa5a('0xb8'),'appdata':_0x5187e7['name']+','+(_0x3f03fd[_0xfa5a('0x91')][_0xfa5a('0xb9')]||0xa),'interval':_0xfa5a('0xb3')});_0x3f03fd[_0xfa5a('0xba')]=!![];}return respondWithRpcPromise(_0xfa5a('0xbb'),_0xfa5a('0xbc'),_0x3f03fd);});}return respondWithRpcPromise('Start',_0xfa5a('0xbc'),_0x3f03fd);})[_0xfa5a('0x15')](function(_0x2a5a83){respondWithRpcPromise(_0xfa5a('0xbd'),_0xfa5a('0xbd'),{'event':_0xfa5a('0xbe'),'message':_0x2a5a83},client9002);return _0x2a5a83;})['then'](respondWithResult(_0x1730ba,null))[_0xfa5a('0x4c')](handleError(_0x1730ba,null));};exports[_0xfa5a('0xbf')]=function(_0x4ae5af,_0x1608f0){var _0x56647c,_0x97e505,_0x440b3b;var _0x37dd6b=[];var _0x52d09d={};var _0x3dd58a=_0x4ae5af[_0xfa5a('0xc0')]||[];var _0x1aeb72=[];var _0x312ae7;return db[_0xfa5a('0x7f')][_0xfa5a('0x80')]()[_0xfa5a('0x15')](function(_0x1a1a68){if(!_0x1a1a68){throw new db[(_0xfa5a('0x81'))][(_0xfa5a('0x82'))](_0xfa5a('0x83'));}_0x37dd6b=_[_0xfa5a('0x84')](_[_0xfa5a('0x34')](_0x1a1a68),['createdAt',_0xfa5a('0x85'),_0xfa5a('0xc1'),_0xfa5a('0x87')]);if(_0x4ae5af[_0xfa5a('0x4e')]['id']){delete _0x4ae5af[_0xfa5a('0x4e')]['id'];}if(_['isNil'](_0x4ae5af[_0xfa5a('0x4e')][_0xfa5a('0x88')])){throw _0x1608f0[_0xfa5a('0x1d')](0x1f4)[_0xfa5a('0x2c')](new db[(_0xfa5a('0x81'))]['ValidationError'](_0xfa5a('0x89')));}if(_[_0xfa5a('0x70')](_0x4ae5af[_0xfa5a('0x4e')][_0xfa5a('0x4e')])||_0x4ae5af[_0xfa5a('0x4e')][_0xfa5a('0x4e')]===''){throw _0x1608f0[_0xfa5a('0x1d')](0x1f4)['send'](new db[(_0xfa5a('0x81'))][(_0xfa5a('0x82'))](_0xfa5a('0x8a')));}if(_['isNil'](_0x4ae5af[_0xfa5a('0x4e')][_0xfa5a('0xc2')])){throw _0x1608f0['status'](0x1f4)['send'](new db['Sequelize'][(_0xfa5a('0x82'))](_0xfa5a('0xc3')+_0x37dd6b));}if(!_[_0xfa5a('0xc4')](_0x37dd6b,_0x4ae5af[_0xfa5a('0x4e')][_0xfa5a('0xc2')])){throw _0x1608f0[_0xfa5a('0x1d')](0x1f4)['send'](new db['Sequelize'][(_0xfa5a('0x82'))](_0xfa5a('0xc5')+_0x37dd6b));}_0x52d09d[_0x4ae5af['body']['mapKeyOffline']]=_0x4ae5af[_0xfa5a('0x4e')][_0xfa5a('0x88')];})[_0xfa5a('0x15')](function(){return db['ChatWebsite'][_0xfa5a('0x4b')]({'where':{'id':_0x4ae5af[_0xfa5a('0x47')]['id']},'include':[{'model':db[_0xfa5a('0x8d')],'as':_0xfa5a('0x90')},{'model':db[_0xfa5a('0xc6')],'as':_0xfa5a('0xc6')}]});})[_0xfa5a('0x15')](handleEntityNotFound(_0x1608f0,null))[_0xfa5a('0x15')](function(_0x455a0e){if(_0x455a0e&&_0x455a0e[_0xfa5a('0x90')]){_0x97e505=_0x455a0e;var _0x240ccb=_['defaults'](_0x4ae5af[_0xfa5a('0x4e')],{'firstName':_0x4ae5af[_0xfa5a('0x4e')][_0xfa5a('0x88')],'phone':_0x4ae5af[_0xfa5a('0x4e')][_0xfa5a('0x88')],'ListId':_0x455a0e[_0xfa5a('0x87')]});_0x240ccb[_0x4ae5af['body'][_0xfa5a('0xc2')]]=_0x4ae5af['body'][_0xfa5a('0x88')];return db[_0xfa5a('0x7f')][_0xfa5a('0xc7')]({'where':_0x52d09d,'defaults':_0x240ccb});}})[_0xfa5a('0xab')](function(_0x502289){if(_0x502289){_0x440b3b=_0x502289;var _0x194dbb=fs[_0xfa5a('0xc8')](path[_0xfa5a('0x6a')](config[_0xfa5a('0x6b')],'server/files/templates/chatOfflineMessage.ejs'),_0xfa5a('0xc9'));var _0x4e0165=ejs[_0xfa5a('0xca')](_0x194dbb,{'body':_[_0xfa5a('0xcb')](_0x4ae5af['body'][_0xfa5a('0x4e')]),'bodyTitle':_0x97e505[_0xfa5a('0xcc')]});return db[_0xfa5a('0xcd')][_0xfa5a('0x4d')]({'body':_0x4e0165,'plainBody':htmlToText[_0xfa5a('0xce')](_0x4e0165),'ContactId':_0x502289['id'],'ChatWebsiteId':_0x97e505['id']});}})[_0xfa5a('0x15')](function(_0x4187b4){_0x312ae7=_0x4187b4;if(_0x3dd58a[_0xfa5a('0x3a')]){var _0x2b6ee1=_0x3dd58a[_0xfa5a('0x2f')](function(_0x29a14c){return{'name':_0x29a14c[_0xfa5a('0xcf')],'basename':_0x29a14c['filename'],'type':_0x29a14c[_0xfa5a('0xd0')],'ChatOfflineMessageId':_0x4187b4['id']};});_0x1aeb72=_0x2b6ee1[_0xfa5a('0x2f')](_0x1475d3=>{var _0x166846={'filename':_0x1475d3['name'],'path':path['join'](config[_0xfa5a('0x6b')],_0xfa5a('0xd1'),_0xfa5a('0xc0'),'attachments','offline-chat',_0x1475d3[_0xfa5a('0xd2')])};return _0x166846;});if(!_0x97e505['openNewInteraction']){return db['sequelize'][_0xfa5a('0xd3')](function(_0x126ab1){return db[_0xfa5a('0xd4')][_0xfa5a('0xd5')](_0x2b6ee1,{'transaction':_0x126ab1});});}}})[_0xfa5a('0x15')](function(){if(_0x312ae7){_0x56647c=_0x312ae7;return db[_0xfa5a('0xc6')][_0xfa5a('0x57')]({'where':{'service':!![]},'include':[{'model':db[_0xfa5a('0xd6')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xfa5a('0xd7')],'as':_0xfa5a('0xd7'),'raw':!![]}]}]});}})['then'](function(_0x253a1a){if(_0x253a1a&&_0x253a1a[_0xfa5a('0xd8')]&&_0x97e505['forwardOffline']&&_0x97e505[_0xfa5a('0xd9')]){var _0x572d42=_0x253a1a[_0xfa5a('0xda')]();return respondWithRpcPromise(_0xfa5a('0xdb'),_0xfa5a('0xdc'),{'account':_0x572d42,'message':{'from':util[_0xfa5a('0xa1')]('\x22%s\x22\x20<%s>',_0x253a1a[_0xfa5a('0x2b')],_0x253a1a[_0xfa5a('0xdd')]||_0x253a1a[_0xfa5a('0xd8')]['user']),'to':_0x97e505[_0xfa5a('0xd9')],'subject':_0x97e505[_0xfa5a('0xde')],'html':_0x56647c[_0xfa5a('0x4e')],'attachments':_0x1aeb72}},client9003)[_0xfa5a('0x15')](function(){return _0x56647c;})[_0xfa5a('0x4c')](function(_0x293872){logger[_0xfa5a('0x1a')](_0x293872);});}})['then'](function(){if(_0x97e505&&_0x97e505['openNewInteraction']&&_0x97e505[_0xfa5a('0xdf')]){var _0x108553=[];if(_0x3dd58a[_0xfa5a('0x3a')]){_0x108553=_0x3dd58a[_0xfa5a('0x2f')](function(_0x2a9ea0){return{'name':_0x2a9ea0['originalname'],'basename':_0x2a9ea0['filename'],'type':_0x2a9ea0[_0xfa5a('0xd0')],'ChatOfflineMessageId':_0x312ae7['id']};});}var _0x2fe27d;if(!_[_0xfa5a('0x70')](_0x97e505[_0xfa5a('0xe0')])){var _0x57fca1=_[_0xfa5a('0x2f')](_0x4ae5af[_0xfa5a('0x4e')],function(_0x3e5617){return _0x3e5617;});var _0x25c0e9=_[_0xfa5a('0xe1')](_0x57fca1)[0x0];var _0xe09ebf=_[_0xfa5a('0xe2')](_0x25c0e9,function(_0x28341f){return _0x28341f;});_0x2fe27d=_0xe09ebf[0x1][_0x97e505[_0xfa5a('0xe0')]];}var _0x36bb61={'from':_0x440b3b[_0xfa5a('0xdd')],'firstName':_0x440b3b[_0xfa5a('0x9c')],'lastName':_0x440b3b[_0xfa5a('0xac')],'mapKey':_0xfa5a('0xdd'),'message':{'from':_0x440b3b['email'],'to':_0x97e505[_0xfa5a('0xc6')]['email'],'cc':'','subject':_[_0xfa5a('0x70')](_0x2fe27d)?_0x97e505[_0xfa5a('0xde')]:_0x2fe27d,'messageId':'','sentAt':new Date(),'attach':_0x108553[_0xfa5a('0x3a')],'attachments':_0x108553,'originChannel':_0xfa5a('0xe3'),'ChatWebsiteId':_0x97e505['id'],'ChatOfflineMessageId':_0x56647c['id'],'originTo':_0x97e505[_0xfa5a('0xc6')]['email']},'body':_0x56647c[_0xfa5a('0x4e')]};var _0x282a3d={'account':{'id':_0x97e505[_0xfa5a('0xdf')]},'body':_0x36bb61,'log':'NotifyMailAccount'};return respondWithRpcPromise('NotifyMailAccount',_0xfa5a('0xe4'),_0x282a3d,client9001)['then'](function(){return _0x56647c;})[_0xfa5a('0x4c')](function(_0x4488b4){logger[_0xfa5a('0x1a')](_0x4488b4);});}return;})[_0xfa5a('0x15')](function(){if(_0x56647c){return _0x56647c;}})[_0xfa5a('0x15')](respondWithResult(_0x1608f0,null))[_0xfa5a('0x4c')](function(_0x51a771){logger['error']('catch',_0x51a771);for(var _0x48387b of _0x3dd58a){var _0x4d2b74=path[_0xfa5a('0x6a')](config['root'],'server','files',_0xfa5a('0xe5'),_0xfa5a('0xe6'),_0x48387b[_0xfa5a('0x65')]);fs_extra[_0xfa5a('0xe7')](_0x4d2b74)[_0xfa5a('0x4c')](function(_0x7a75f){logger[_0xfa5a('0x1a')](_0xfa5a('0xe8'),_0x4d2b74,_0x7a75f);});}});};exports[_0xfa5a('0xe9')]=function(_0x203095,_0x4113fd){return db[_0xfa5a('0xa8')][_0xfa5a('0x4b')]({'where':{'id':_0x203095['params']['id']}})[_0xfa5a('0x15')](handleEntityNotFound(_0x4113fd,null))[_0xfa5a('0x15')](function(_0x146e7f){if(_0x146e7f){return _0x146e7f['addInteraction'](_0x203095[_0xfa5a('0x4e')]['ids'],_[_0xfa5a('0xea')](_0x203095[_0xfa5a('0x4e')],[_0xfa5a('0x5c'),'id'])||{});}})[_0xfa5a('0x15')](respondWithResult(_0x4113fd,null))[_0xfa5a('0x4c')](handleError(_0x4113fd,null));};exports[_0xfa5a('0xeb')]=function(_0x15f3fb,_0xad4c86){var _0x3e7c7f={'raw':![],'where':{}};var _0x22674f={};var _0x3bc529={'count':0x0,'rows':[]};return db[_0xfa5a('0x42')]['findOne']({'where':{'id':_0x15f3fb['params']['id']}})[_0xfa5a('0x15')](handleEntityNotFound(_0xad4c86,null))[_0xfa5a('0x15')](function(_0x1fd58d){if(_0x1fd58d){_0x22674f[_0xfa5a('0x33')]=_['keys'](db[_0xfa5a('0xa8')][_0xfa5a('0x49')]);_0x22674f['query']=_[_0xfa5a('0x34')](_0x15f3fb[_0xfa5a('0x35')]);_0x22674f[_0xfa5a('0x36')]=_['intersection'](_0x22674f[_0xfa5a('0x33')],_0x22674f[_0xfa5a('0x35')]);_0x3e7c7f[_0xfa5a('0x39')]=_[_0xfa5a('0x37')](_0x22674f['model'],qs[_0xfa5a('0x38')](_0x15f3fb['query']['fields']));_0x3e7c7f['attributes']=_0x3e7c7f[_0xfa5a('0x39')]['length']?_0x3e7c7f[_0xfa5a('0x39')]:_0x22674f[_0xfa5a('0x33')];if(!_0x15f3fb[_0xfa5a('0x35')]['hasOwnProperty'](_0xfa5a('0x60'))){_0x3e7c7f[_0xfa5a('0x21')]=qs[_0xfa5a('0x21')](_0x15f3fb['query'][_0xfa5a('0x21')]);_0x3e7c7f[_0xfa5a('0x1f')]=qs[_0xfa5a('0x1f')](_0x15f3fb['query'][_0xfa5a('0x1f')]);}_0x3e7c7f[_0xfa5a('0x3b')]=qs[_0xfa5a('0x3c')](_0x15f3fb[_0xfa5a('0x35')][_0xfa5a('0x3c')]);_0x3e7c7f[_0xfa5a('0x3d')]=qs[_0xfa5a('0x36')](_['pick'](_0x15f3fb[_0xfa5a('0x35')],_0x22674f[_0xfa5a('0x36')]));_0x3e7c7f[_0xfa5a('0x3d')]['ChatWebsiteId']=_0x1fd58d['id'];if(_0x15f3fb[_0xfa5a('0x35')][_0xfa5a('0x3f')]){_0x3e7c7f[_0xfa5a('0x3d')]=_[_0xfa5a('0x40')](_0x3e7c7f[_0xfa5a('0x3d')],{'$or':_[_0xfa5a('0x2f')](_0x3e7c7f[_0xfa5a('0x39')],function(_0x104be5){var _0x3ea21c={};_0x3ea21c[_0x104be5]={'$like':'%'+_0x15f3fb[_0xfa5a('0x35')][_0xfa5a('0x3f')]+'%'};return _0x3ea21c;})});}_0x3e7c7f=_['merge']({},_0x3e7c7f,_0x15f3fb[_0xfa5a('0x4a')]);return db[_0xfa5a('0xa8')][_0xfa5a('0x22')]({'where':_0x3e7c7f['where']})['then'](function(_0x1f778b){_0x3bc529[_0xfa5a('0x22')]=_0x1f778b;if(_0x15f3fb[_0xfa5a('0x35')]['includeAll']){_0x3e7c7f[_0xfa5a('0x44')]=[{'model':db[_0xfa5a('0x7f')],'as':_0xfa5a('0xec'),'required':![]},{'model':db[_0xfa5a('0xb6')],'as':_0xfa5a('0xed'),'attributes':[_0xfa5a('0x2b'),_0xfa5a('0xee'),_0xfa5a('0xef')],'required':![]},{'model':db[_0xfa5a('0xf0')],'as':_0xfa5a('0xf1'),'attributes':['id',_0xfa5a('0x2b'),'color'],'where':_0x15f3fb[_0xfa5a('0x35')]['tag']?{'id':_0x15f3fb[_0xfa5a('0x35')][_0xfa5a('0xf2')]}:undefined,'required':_0x15f3fb[_0xfa5a('0x35')]['tag']?!![]:![]}];}return db[_0xfa5a('0xa8')][_0xfa5a('0x45')](_0x3e7c7f);})[_0xfa5a('0x15')](function(_0x374956){_0x3bc529[_0xfa5a('0x5a')]=_0x374956;return _0x3bc529;});}})['then'](respondWithFilteredResult(_0xad4c86,_0x3e7c7f))[_0xfa5a('0x4c')](handleError(_0xad4c86,null));};function iftimePromise(_0x48f3c5,_0x519c4b){return respondWithRpcPromise(_0xfa5a('0xf3'),'getSnippet',{'command':_0x519c4b[_0xfa5a('0xf4')]?util[_0xfa5a('0xa1')]('iftime\x20%s,%s',_0x48f3c5[_0xfa5a('0xf5')],_0x519c4b[_0xfa5a('0xf4')]):util['format']('iftime\x20%s',_0x48f3c5[_0xfa5a('0xf5')])},client9002)[_0xfa5a('0x15')](function(_0x4608ee){var _0x235bc3=_0x4608ee&&_0x4608ee[_0xfa5a('0xf6')](_0xfa5a('0xf7'))>=0x0?!![]:![];logger[_0xfa5a('0x16')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x519c4b['id'],_0x48f3c5['id'],_0x48f3c5[_0xfa5a('0xf5')],_0x235bc3?'ONLINE':_0xfa5a('0xf8'),_0x519c4b[_0xfa5a('0xf4')]?_0x519c4b[_0xfa5a('0xf4')]:_0xfa5a('0xf9'));return _0x235bc3;})[_0xfa5a('0x4c')](function(_0x274237){logger[_0xfa5a('0x1a')](_0xfa5a('0xfa'),_0x519c4b['id'],_0x48f3c5['id'],_0x48f3c5[_0xfa5a('0xf5')],util[_0xfa5a('0xfb')](_0x274237,{'showHidden':![],'depth':null}),_0x519c4b['timezone']?_0x519c4b[_0xfa5a('0xf4')]:_0xfa5a('0xf9'));return![];});}exports[_0xfa5a('0xfc')]=function(_0x59cc37,_0x25e8b9){var _0x1783aa=0x0;var _0x561e84=0x0;var _0x3499e6=![];var _0x3cd887;var _0x21ef85;return db['ChatWebsite']['find']({'where':{'id':_0x59cc37[_0xfa5a('0x47')]['id']},'include':[{'model':db[_0xfa5a('0xfd')],'as':_0xfa5a('0xfd'),'include':[{'model':db[_0xfa5a('0xfd')],'as':'Intervals','attributes':['id','interval'],'raw':!![]}]}]})[_0xfa5a('0x15')](handleEntityNotFound(_0x25e8b9,null))[_0xfa5a('0x15')](function(_0xb7d75){if(_0xb7d75){_0x3cd887=_0xb7d75;return _0xb7d75[_0xfa5a('0xfe')]({'raw':!![]});}})['then'](function(_0x10c0b8){if(_0x3cd887){if(_0x10c0b8){_0x21ef85=_0x10c0b8;}}return require(_0xfa5a('0x6d'))['getLicense']();})[_0xfa5a('0x15')](function(_0x2ae3fe){if(_0x2ae3fe){_0x561e84=_0x2ae3fe['virtual'];_0x3499e6=_0x2ae3fe[_0xfa5a('0x6f')];}})[_0xfa5a('0x15')](function(){return db['ChatInteraction'][_0xfa5a('0x22')]({'where':{'closed':![]}});})['then'](function(_0x527068){_0x1783aa=_0x527068;if(_0x561e84&&_0x527068>_0x561e84){return db[_0xfa5a('0xff')][_0xfa5a('0x57')]({'where':{'id':0x1}})[_0xfa5a('0x15')](function(_0x49fa3e){if(_0x49fa3e){_0x49fa3e['increment'](_0xfa5a('0x100'));}});}})[_0xfa5a('0x15')](function(){if(_0x3cd887[_0xfa5a('0xfd')]&&_0x3cd887[_0xfa5a('0xfd')][_0xfa5a('0x101')]){var _0x4e3339=[];for(var _0x16dffa=0x0;_0x16dffa<_0x3cd887[_0xfa5a('0xfd')]['Intervals']['length'];_0x16dffa++){var _0x2da701=_0x3cd887[_0xfa5a('0xfd')][_0xfa5a('0x101')][_0x16dffa][_0xfa5a('0x25')]({'plain':!![]});_0x4e3339[_0xfa5a('0xb1')](iftimePromise(_0x2da701,_0x3cd887));}return BPromise['all'](_0x4e3339)['then'](function(_0x2d4cab){return _['some'](_0x2d4cab);});}else{return!![];}})[_0xfa5a('0x15')](function(_0x321123){var _0x30671e=fs[_0xfa5a('0xc8')](path['join'](config[_0xfa5a('0x6b')],_0xfa5a('0x102')),_0xfa5a('0xc9'));var _0x28da0d=new url[(_0xfa5a('0x103'))](_0x3cd887[_0xfa5a('0x104')])['origin'];var _0x4e5989=_0xfa5a('0x105');var _0x566ebf=![];var _0x431c8d={'chatVersion':_0x4e5989,'chatWebsiteAddressOrigin':_0x28da0d,'remote':_0x3cd887[_0xfa5a('0x106')],'query':querystring['stringify'](_[_0xfa5a('0x40')](_0x3cd887[_0xfa5a('0x25')]({'plain':!![]}),{'customerIp':_0x59cc37[_0xfa5a('0x99')][_0xfa5a('0x9a')]||_0x59cc37[_0xfa5a('0x99')][_0xfa5a('0x107')]||_0x59cc37['connection'][_0xfa5a('0x108')]||_0x59cc37['ip'],'referer':_0x59cc37[_0xfa5a('0x99')]['referer'],'openedInteractions':_0x1783aa,'maxInteractions':_0x561e84,'virtual':_0x3499e6['virtual'],'online':_0x321123,'custom':_0x3499e6}))[_0xfa5a('0x109')](/'/g,'\x5c\x27')};_0x25e8b9[_0xfa5a('0x2c')](ejs[_0xfa5a('0xca')](Mustache[_0xfa5a('0xca')](_0x30671e,_0x431c8d),{'proactiveActions':_0x21ef85,'alignment':_0x3cd887[_0xfa5a('0x10a')],'verticalAlignment':_0x3cd887[_0xfa5a('0x10b')],'div_color':_0x3cd887['color'],'labelText':_0x3cd887[_0xfa5a('0x10c')],'text_color':_0x3cd887[_0xfa5a('0x10d')],'text_button_color':_0x3cd887[_0xfa5a('0x10e')],'button_color':_0x3cd887['color_button'],'background_color':_0x3cd887[_0xfa5a('0x10f')],'hideWhenOffline':_0x3cd887[_0xfa5a('0x110')],'intervalId':_0x3cd887[_0xfa5a('0x111')],'isDevelopment':_0x566ebf,'chatVersion':_0x4e5989}));})['catch'](handleError(_0x25e8b9,null));};exports[_0xfa5a('0x112')]=function(_0x28a626,_0x13cd80){var _0x15433f=_0x28a626[_0xfa5a('0x47')]['id'];var _0x3fe030=_0x28a626[_0xfa5a('0x4e')];var _0x42d283=0xc8;var _0x153c13=null;return db[_0xfa5a('0x113')][_0xfa5a('0xd3')]({'isolationLevel':db['sequelize'][_0xfa5a('0x114')][_0xfa5a('0x115')][_0xfa5a('0x116')]},function(_0x2443d1){return db[_0xfa5a('0x42')][_0xfa5a('0x57')]({'where':{'id':_0x15433f},'transaction':_0x2443d1})[_0xfa5a('0x15')](function(_0x88f953){if(_0x88f953){return db[_0xfa5a('0x117')][_0xfa5a('0x27')]({'where':{'ChatWebsiteId':_0x15433f},'transaction':_0x2443d1})[_0xfa5a('0x15')](function(){var _0x323292=_[_0xfa5a('0x2f')](_0x3fe030,function(_0x1f97c4){_0x1f97c4[_0xfa5a('0x59')]=_0x15433f;return _0x1f97c4;});return db[_0xfa5a('0x117')][_0xfa5a('0xd5')](_0x323292,{'transaction':_0x2443d1});});}else{_0x42d283=0x194;_0x153c13=[];}});})[_0xfa5a('0x15')](function(){if(_0x42d283!==0x194){return db['ChatApplication'][_0xfa5a('0x118')]({'where':{'ChatWebsiteId':_0x15433f},'order':_0xfa5a('0x95')})[_0xfa5a('0x15')](function(_0x218427){_0x153c13=_0x218427;});}})[_0xfa5a('0x4c')](function(_0x48cacf){_0x42d283=0x1f4;logger['error'](_0x48cacf[_0xfa5a('0x2a')]);if(_0x48cacf['name']){delete _0x48cacf[_0xfa5a('0x2b')];}_0x153c13=_0x48cacf;})[_0xfa5a('0x119')](function(){if(_0x153c13===null){_0x13cd80[_0xfa5a('0x29')](_0x42d283);}else{if(_0x42d283===0x1f4){_0x13cd80['status'](_0x42d283)[_0xfa5a('0x2c')](_0x153c13);}else{_0x13cd80[_0xfa5a('0x1d')](_0x42d283)[_0xfa5a('0x1e')](_0x153c13);}}});};exports[_0xfa5a('0x11a')]=function(_0xbf558f,_0x57cb3b){var _0x488f19={};var _0x2da14c={};var _0x532975;var _0x332a61;return db[_0xfa5a('0x42')][_0xfa5a('0x57')]({'where':{'id':_0xbf558f[_0xfa5a('0x47')]['id']}})[_0xfa5a('0x15')](handleEntityNotFound(_0x57cb3b,null))['then'](function(_0x5392aa){if(_0x5392aa){_0x532975=_0x5392aa;_0x2da14c[_0xfa5a('0x33')]=_['keys'](db[_0xfa5a('0x117')]['rawAttributes']);_0x2da14c[_0xfa5a('0x35')]=_[_0xfa5a('0x34')](_0xbf558f['query']);_0x2da14c[_0xfa5a('0x36')]=_[_0xfa5a('0x37')](_0x2da14c[_0xfa5a('0x33')],_0x2da14c[_0xfa5a('0x35')]);_0x488f19['attributes']=_[_0xfa5a('0x37')](_0x2da14c['model'],qs['fields'](_0xbf558f[_0xfa5a('0x35')][_0xfa5a('0x38')]));_0x488f19['attributes']=_0x488f19[_0xfa5a('0x39')][_0xfa5a('0x3a')]?_0x488f19[_0xfa5a('0x39')]:_0x2da14c['model'];_0x488f19['order']=qs['sort'](_0xbf558f[_0xfa5a('0x35')]['sort']);_0x488f19['where']=qs['filters'](_['pick'](_0xbf558f[_0xfa5a('0x35')],_0x2da14c[_0xfa5a('0x36')]));if(_0xbf558f[_0xfa5a('0x35')][_0xfa5a('0x3f')]){_0x488f19['where']=_[_0xfa5a('0x40')](_0x488f19['where'],{'$or':_[_0xfa5a('0x2f')](_0x488f19[_0xfa5a('0x39')],function(_0xeeeab4){var _0x27c46f={};_0x27c46f[_0xeeeab4]={'$like':'%'+_0xbf558f['query'][_0xfa5a('0x3f')]+'%'};return _0x27c46f;})});}_0x488f19=_[_0xfa5a('0x40')]({},_0x488f19,_0xbf558f['options']);return _0x532975[_0xfa5a('0x11a')](_0x488f19);}})[_0xfa5a('0x15')](function(_0x2abf76){if(_0x2abf76){_0x332a61=_0x2abf76[_0xfa5a('0x3a')];if(!_0xbf558f[_0xfa5a('0x35')][_0xfa5a('0x58')](_0xfa5a('0x60'))){_0x488f19[_0xfa5a('0x21')]=qs[_0xfa5a('0x21')](_0xbf558f[_0xfa5a('0x35')][_0xfa5a('0x21')]);_0x488f19[_0xfa5a('0x1f')]=qs[_0xfa5a('0x1f')](_0xbf558f[_0xfa5a('0x35')][_0xfa5a('0x1f')]);}return _0x532975[_0xfa5a('0x11a')](_0x488f19);}})[_0xfa5a('0x15')](function(_0x20fe3e){if(_0x20fe3e){return _0x20fe3e?{'count':_0x332a61,'rows':_0x20fe3e}:null;}})[_0xfa5a('0x15')](respondWithResult(_0x57cb3b,null))[_0xfa5a('0x4c')](handleError(_0x57cb3b,null));};exports[_0xfa5a('0x11b')]=function(_0x313eb1,_0x4d9bd9){return db[_0xfa5a('0x11c')]['find']({'where':{'id':_0x313eb1[_0xfa5a('0x47')]['id']}})[_0xfa5a('0x15')](handleEntityNotFound(_0x4d9bd9,null))[_0xfa5a('0x15')](function(_0x5583c4){if(_0x5583c4){return _0x5583c4[_0xfa5a('0x11b')](_0x313eb1[_0xfa5a('0x4e')][_0xfa5a('0x5c')],_[_0xfa5a('0xea')](_0x313eb1[_0xfa5a('0x4e')],['ids','id'])||{});}})[_0xfa5a('0x15')](respondWithResult(_0x4d9bd9,null))[_0xfa5a('0x4c')](handleError(_0x4d9bd9,null));};exports['getProactiveActions']=function(_0x586aa2,_0x44f456){var _0x38147a={};var _0x17c6b1={};var _0x5dcb0a;var _0x31302d;return db[_0xfa5a('0x42')][_0xfa5a('0x57')]({'where':{'id':_0x586aa2[_0xfa5a('0x47')]['id']}})['then'](handleEntityNotFound(_0x44f456,null))[_0xfa5a('0x15')](function(_0x2b85fd){if(_0x2b85fd){_0x5dcb0a=_0x2b85fd;_0x17c6b1[_0xfa5a('0x33')]=_[_0xfa5a('0x34')](db['ChatProactiveAction'][_0xfa5a('0x49')]);_0x17c6b1[_0xfa5a('0x35')]=_[_0xfa5a('0x34')](_0x586aa2[_0xfa5a('0x35')]);_0x17c6b1[_0xfa5a('0x36')]=_[_0xfa5a('0x37')](_0x17c6b1[_0xfa5a('0x33')],_0x17c6b1[_0xfa5a('0x35')]);_0x38147a['attributes']=_[_0xfa5a('0x37')](_0x17c6b1['model'],qs['fields'](_0x586aa2['query']['fields']));_0x38147a[_0xfa5a('0x39')]=_0x38147a[_0xfa5a('0x39')][_0xfa5a('0x3a')]?_0x38147a[_0xfa5a('0x39')]:_0x17c6b1[_0xfa5a('0x33')];_0x38147a[_0xfa5a('0x3b')]=qs[_0xfa5a('0x3c')](_0x586aa2[_0xfa5a('0x35')][_0xfa5a('0x3c')]);_0x38147a[_0xfa5a('0x3d')]=qs[_0xfa5a('0x36')](_[_0xfa5a('0x3e')](_0x586aa2['query'],_0x17c6b1[_0xfa5a('0x36')]));if(_0x586aa2[_0xfa5a('0x35')][_0xfa5a('0x3f')]){_0x38147a[_0xfa5a('0x3d')]=_[_0xfa5a('0x40')](_0x38147a[_0xfa5a('0x3d')],{'$or':_['map'](_0x38147a[_0xfa5a('0x39')],function(_0x593f82){var _0x4d5f03={};_0x4d5f03[_0x593f82]={'$like':'%'+_0x586aa2[_0xfa5a('0x35')][_0xfa5a('0x3f')]+'%'};return _0x4d5f03;})});}_0x38147a=_[_0xfa5a('0x40')]({},_0x38147a,_0x586aa2[_0xfa5a('0x4a')]);return _0x5dcb0a['getProactiveActions'](_0x38147a);}})[_0xfa5a('0x15')](function(_0x121b1f){if(_0x121b1f){_0x31302d=_0x121b1f['length'];if(!_0x586aa2[_0xfa5a('0x35')][_0xfa5a('0x58')](_0xfa5a('0x60'))){_0x38147a['limit']=qs[_0xfa5a('0x21')](_0x586aa2[_0xfa5a('0x35')][_0xfa5a('0x21')]);_0x38147a[_0xfa5a('0x1f')]=qs[_0xfa5a('0x1f')](_0x586aa2[_0xfa5a('0x35')][_0xfa5a('0x1f')]);}return _0x5dcb0a[_0xfa5a('0xfe')](_0x38147a);}})[_0xfa5a('0x15')](function(_0x56bd91){if(_0x56bd91){return _0x56bd91?{'count':_0x31302d,'rows':_0x56bd91}:null;}})[_0xfa5a('0x15')](respondWithResult(_0x44f456,null))[_0xfa5a('0x4c')](handleError(_0x44f456,null));};exports[_0xfa5a('0x11d')]=function(_0x577e24,_0x2a0589){var _0x16345f=_0x577e24[_0xfa5a('0x35')][_0xfa5a('0x11e')]==='false'?'offlineForm':_0xfa5a('0x11f');return db['ChatWebsite'][_0xfa5a('0x4b')]({'attributes':['id',_0x16345f],'where':{'id':_0x577e24[_0xfa5a('0x47')]['id']}})['then'](handleEntityNotFound(_0x2a0589,null))[_0xfa5a('0x15')](function(_0x5447c9){if(_0x5447c9){var _0x4cb61b=_0x5447c9[_0x16345f];var _0x340dd1=_0x4cb61b&&_0x4cb61b['items']?_0x4cb61b[_0xfa5a('0x120')]:[];_0x2a0589['send']({'fromKey':_[_0xfa5a('0x70')](_0x4cb61b[_0xfa5a('0x121')])?undefined:_0x4cb61b[_0xfa5a('0x121')],'count':_0x340dd1['length'],'rows':_0x340dd1});}})['catch'](handleError(_0x2a0589,null));};exports['getOfflineMessages']=function(_0x5cbdc6,_0xdfa641){var _0x296e9b={'raw':![],'where':{}};var _0x5d8173={};var _0x1648ff={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xfa5a('0x57')]({'where':{'id':_0x5cbdc6[_0xfa5a('0x47')]['id']}})['then'](handleEntityNotFound(_0xdfa641,null))[_0xfa5a('0x15')](function(_0x30ebfc){if(_0x30ebfc){_0x5d8173['model']=_[_0xfa5a('0x34')](db[_0xfa5a('0xcd')][_0xfa5a('0x49')]);_0x5d8173['query']=_[_0xfa5a('0x34')](_0x5cbdc6[_0xfa5a('0x35')]);_0x5d8173[_0xfa5a('0x36')]=_[_0xfa5a('0x37')](_0x5d8173['model'],_0x5d8173[_0xfa5a('0x35')]);_0x296e9b[_0xfa5a('0x39')]=_[_0xfa5a('0x37')](_0x5d8173[_0xfa5a('0x33')],qs['fields'](_0x5cbdc6['query']['fields']));_0x296e9b[_0xfa5a('0x39')]=_0x296e9b[_0xfa5a('0x39')][_0xfa5a('0x3a')]?_0x296e9b['attributes']:_0x5d8173[_0xfa5a('0x33')];if(!_0x5cbdc6[_0xfa5a('0x35')][_0xfa5a('0x58')](_0xfa5a('0x60'))){_0x296e9b[_0xfa5a('0x21')]=qs[_0xfa5a('0x21')](_0x5cbdc6['query']['limit']);_0x296e9b[_0xfa5a('0x1f')]=qs[_0xfa5a('0x1f')](_0x5cbdc6[_0xfa5a('0x35')][_0xfa5a('0x1f')]);}_0x296e9b[_0xfa5a('0x3b')]=qs[_0xfa5a('0x3c')](_0x5cbdc6['query'][_0xfa5a('0x3c')]);_0x296e9b[_0xfa5a('0x3d')]=qs['filters'](_[_0xfa5a('0x3e')](_0x5cbdc6[_0xfa5a('0x35')],_0x5d8173[_0xfa5a('0x36')]));_0x296e9b[_0xfa5a('0x3d')]['ChatWebsiteId']=_0x30ebfc['id'];if(_0x5cbdc6[_0xfa5a('0x35')][_0xfa5a('0x3f')]){_0x296e9b[_0xfa5a('0x3d')]=_[_0xfa5a('0x40')](_0x296e9b[_0xfa5a('0x3d')],{'$or':_['map'](_0x296e9b[_0xfa5a('0x39')],function(_0x4627ea){var _0x48f627={};_0x48f627[_0x4627ea]={'$like':'%'+_0x5cbdc6[_0xfa5a('0x35')]['filter']+'%'};return _0x48f627;})});}_0x296e9b=_[_0xfa5a('0x40')]({},_0x296e9b,_0x5cbdc6[_0xfa5a('0x4a')]);return db['ChatOfflineMessage']['count']({'where':_0x296e9b['where']})[_0xfa5a('0x15')](function(_0x67cebe){_0x1648ff[_0xfa5a('0x22')]=_0x67cebe;if(_0x5cbdc6[_0xfa5a('0x35')][_0xfa5a('0x43')]){_0x296e9b['include']=[{'all':!![]}];}else{_0x296e9b[_0xfa5a('0x44')]=[{'model':db[_0xfa5a('0x7f')],'as':_0xfa5a('0xec'),'required':![]},{'model':db[_0xfa5a('0xd4')],'as':_0xfa5a('0x122'),'required':![]}];}return db[_0xfa5a('0xcd')][_0xfa5a('0x45')](_0x296e9b);})[_0xfa5a('0x15')](function(_0x285cb2){_0x1648ff[_0xfa5a('0x5a')]=_0x285cb2;return _0x1648ff;});}})[_0xfa5a('0x15')](respondWithFilteredResult(_0xdfa641,_0x296e9b))[_0xfa5a('0x4c')](handleError(_0xdfa641,null));};exports[_0xfa5a('0x123')]=function(_0xdcbc76,_0xa425b4){return db[_0xfa5a('0x42')]['find']({'where':{'id':_0xdcbc76[_0xfa5a('0x47')]['id']}})[_0xfa5a('0x15')](handleEntityNotFound(_0xa425b4,null))[_0xfa5a('0x15')](function(_0x73cacc){if(_0x73cacc){return _0x73cacc['addAgents'](_0xdcbc76[_0xfa5a('0x4e')][_0xfa5a('0x5c')],_['omit'](_0xdcbc76[_0xfa5a('0x4e')],[_0xfa5a('0x5c'),'id'])||{})['spread'](function(_0x14eb57){for(var _0x4185d5=0x0;_0x4185d5<_0xdcbc76[_0xfa5a('0x4e')][_0xfa5a('0x5c')][_0xfa5a('0x3a')];_0x4185d5+=0x1){socket[_0xfa5a('0x124')](_0xfa5a('0x125'),{'UserId':Number(_0xdcbc76['body'][_0xfa5a('0x5c')][_0x4185d5]),'ChatWebsiteId':Number(_0xdcbc76['params']['id'])});}return _0x14eb57;});}})[_0xfa5a('0x15')](respondWithResult(_0xa425b4,null))[_0xfa5a('0x4c')](handleError(_0xa425b4,null));};exports[_0xfa5a('0x126')]=function(_0x31b84a,_0x5f4e7e){return db['ChatWebsite'][_0xfa5a('0x4b')]({'where':{'id':_0x31b84a[_0xfa5a('0x47')]['id']}})[_0xfa5a('0x15')](handleEntityNotFound(_0x5f4e7e,null))['then'](function(_0x599aa8){if(_0x599aa8){return _0x599aa8[_0xfa5a('0x126')](_0x31b84a['query'][_0xfa5a('0x5c')])[_0xfa5a('0x15')](function(){if(_[_0xfa5a('0x127')](_0x31b84a[_0xfa5a('0x35')][_0xfa5a('0x5c')])){for(var _0x1ec458=0x0;_0x1ec458<_0x31b84a[_0xfa5a('0x35')]['ids'][_0xfa5a('0x3a')];_0x1ec458+=0x1){socket['emit'](_0xfa5a('0x128'),{'UserId':Number(_0x31b84a[_0xfa5a('0x35')][_0xfa5a('0x5c')][_0x1ec458]),'ChatWebsiteId':Number(_0x31b84a[_0xfa5a('0x47')]['id'])});}}else{socket['emit'](_0xfa5a('0x128'),{'UserId':Number(_0x31b84a[_0xfa5a('0x35')][_0xfa5a('0x5c')]),'ChatWebsiteId':Number(_0x31b84a['params']['id'])});}});}})[_0xfa5a('0x15')](respondWithStatusCode(_0x5f4e7e,null))[_0xfa5a('0x4c')](handleError(_0x5f4e7e,null));};exports[_0xfa5a('0x129')]=function(_0x3b16d7,_0x1f36ea){var _0x10ff39={};var _0x14f127={};var _0x2b18b0;var _0x5e4786;return db[_0xfa5a('0x42')][_0xfa5a('0x57')]({'where':{'id':_0x3b16d7[_0xfa5a('0x47')]['id']}})[_0xfa5a('0x15')](handleEntityNotFound(_0x1f36ea,null))['then'](function(_0x1a3c83){if(_0x1a3c83){_0x2b18b0=_0x1a3c83;_0x14f127[_0xfa5a('0x33')]=_[_0xfa5a('0x34')](db['User'][_0xfa5a('0x49')]);_0x14f127['query']=_[_0xfa5a('0x34')](_0x3b16d7[_0xfa5a('0x35')]);_0x14f127[_0xfa5a('0x36')]=_[_0xfa5a('0x37')](_0x14f127['model'],_0x14f127[_0xfa5a('0x35')]);_0x10ff39[_0xfa5a('0x39')]=_[_0xfa5a('0x37')](_0x14f127[_0xfa5a('0x33')],qs[_0xfa5a('0x38')](_0x3b16d7[_0xfa5a('0x35')][_0xfa5a('0x38')]));_0x10ff39[_0xfa5a('0x39')]=_0x10ff39[_0xfa5a('0x39')][_0xfa5a('0x3a')]?_0x10ff39[_0xfa5a('0x39')]:_0x14f127[_0xfa5a('0x33')];_0x10ff39[_0xfa5a('0x3b')]=qs['sort'](_0x3b16d7['query'][_0xfa5a('0x3c')]);_0x10ff39[_0xfa5a('0x3d')]=qs[_0xfa5a('0x36')](_[_0xfa5a('0x3e')](_0x3b16d7[_0xfa5a('0x35')],_0x14f127[_0xfa5a('0x36')]));if(_0x3b16d7['query'][_0xfa5a('0x3f')]){_0x10ff39[_0xfa5a('0x3d')]=_[_0xfa5a('0x40')](_0x10ff39[_0xfa5a('0x3d')],{'$or':_[_0xfa5a('0x2f')](_0x10ff39['attributes'],function(_0xd18778){var _0x40250b={};_0x40250b[_0xd18778]={'$like':'%'+_0x3b16d7['query'][_0xfa5a('0x3f')]+'%'};return _0x40250b;})});}_0x10ff39=_[_0xfa5a('0x40')]({},_0x10ff39,_0x3b16d7[_0xfa5a('0x4a')]);return _0x2b18b0[_0xfa5a('0x129')](_0x10ff39);}})[_0xfa5a('0x15')](function(_0x419dde){if(_0x419dde){_0x5e4786=_0x419dde['length'];if(!_0x3b16d7[_0xfa5a('0x35')][_0xfa5a('0x58')]('nolimit')){_0x10ff39[_0xfa5a('0x21')]=qs[_0xfa5a('0x21')](_0x3b16d7[_0xfa5a('0x35')][_0xfa5a('0x21')]);_0x10ff39['offset']=qs[_0xfa5a('0x1f')](_0x3b16d7[_0xfa5a('0x35')][_0xfa5a('0x1f')]);}return _0x2b18b0[_0xfa5a('0x129')](_0x10ff39);}})[_0xfa5a('0x15')](function(_0x39d52a){if(_0x39d52a){return _0x39d52a?{'count':_0x5e4786,'rows':_0x39d52a}:null;}})[_0xfa5a('0x15')](respondWithResult(_0x1f36ea,null))['catch'](handleError(_0x1f36ea,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index a5190d6..dcb28a1 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 _0x6b4e=['emit','hasOwnProperty','hook','exports','../../mysqldb','remove'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x6b4e,0x1a8));var _0xe6b4=function(_0x4cba09,_0x169035){_0x4cba09=_0x4cba09-0x0;var _0x1d626e=_0x6b4e[_0x4cba09];return _0x1d626e;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0xe6b4('0x0'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xe6b4('0x1')};function emitEvent(_0x3be9b1){return function(_0x1aedc5,_0x344db1,_0x436fc0){ChatWebsiteEvents[_0xe6b4('0x2')](_0x3be9b1+':'+_0x1aedc5['id'],_0x1aedc5);ChatWebsiteEvents['emit'](_0x3be9b1,_0x1aedc5);_0x436fc0(null);};}for(var e in events){if(events[_0xe6b4('0x3')](e)){var event=events[e];ChatWebsite[_0xe6b4('0x4')](e,emitEvent(event));}}module[_0xe6b4('0x5')]=ChatWebsiteEvents; \ No newline at end of file +var _0x615a=['exports','events','ChatWebsite','save','update','remove','emit','hook'];(function(_0x6bb4fa,_0x4603e3){var _0x4cd4d0=function(_0x194f14){while(--_0x194f14){_0x6bb4fa['push'](_0x6bb4fa['shift']());}};_0x4cd4d0(++_0x4603e3);}(_0x615a,0x119));var _0xa615=function(_0x173b35,_0x5830a){_0x173b35=_0x173b35-0x0;var _0x5d68fb=_0x615a[_0x173b35];return _0x5d68fb;};'use strict';var EventEmitter=require(_0xa615('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0xa615('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa615('0x2'),'afterUpdate':_0xa615('0x3'),'afterDestroy':_0xa615('0x4')};function emitEvent(_0x11fd6e){return function(_0x52ae35,_0x1d9a38,_0x1463be){ChatWebsiteEvents['emit'](_0x11fd6e+':'+_0x52ae35['id'],_0x52ae35);ChatWebsiteEvents[_0xa615('0x5')](_0x11fd6e,_0x52ae35);_0x1463be(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0xa615('0x6')](e,emitEvent(event));}}module[_0xa615('0x7')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 458002c..51548d5 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 _0xea56=['moment','request-promise','rimraf','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','util','../../config/logger','api'];(function(_0x597db9,_0x5a8c52){var _0xc6120b=function(_0x33c6bc){while(--_0x33c6bc){_0x597db9['push'](_0x597db9['shift']());}};_0xc6120b(++_0x5a8c52);}(_0xea56,0x74));var _0x6ea5=function(_0x281353,_0x5d53a9){_0x281353=_0x281353-0x0;var _0x4f4e7b=_0xea56[_0x281353];return _0x4f4e7b;};'use strict';var _=require(_0x6ea5('0x0'));var util=require(_0x6ea5('0x1'));var logger=require(_0x6ea5('0x2'))(_0x6ea5('0x3'));var moment=require(_0x6ea5('0x4'));var BPromise=require('bluebird');var rp=require(_0x6ea5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6ea5('0x6'));var config=require('../../config/environment');var attributes=require(_0x6ea5('0x7'));module[_0x6ea5('0x8')]=function(_0x4e2953,_0x218b92){return _0x4e2953[_0x6ea5('0x9')](_0x6ea5('0xa'),attributes,{'tableName':_0x6ea5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x56e9=['path','rimraf','../../config/environment','exports','define','ChatWebsite','chat_websites','lodash','../../config/logger','moment','request-promise'];(function(_0x104e21,_0x2ea86f){var _0x605b37=function(_0x580fce){while(--_0x580fce){_0x104e21['push'](_0x104e21['shift']());}};_0x605b37(++_0x2ea86f);}(_0x56e9,0xf9));var _0x956e=function(_0x3f96f0,_0xa755cc){_0x3f96f0=_0x3f96f0-0x0;var _0x338019=_0x56e9[_0x3f96f0];return _0x338019;};'use strict';var _=require(_0x956e('0x0'));var util=require('util');var logger=require(_0x956e('0x1'))('api');var moment=require(_0x956e('0x2'));var BPromise=require('bluebird');var rp=require(_0x956e('0x3'));var fs=require('fs');var path=require(_0x956e('0x4'));var rimraf=require(_0x956e('0x5'));var config=require(_0x956e('0x6'));var attributes=require('./chatWebsite.attributes');module[_0x956e('0x7')]=function(_0x25562d,_0x1c940a){return _0x25562d[_0x956e('0x8')](_0x956e('0x9'),attributes,{'tableName':_0x956e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 14abb62..5dae62c 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 _0x16fb=['jayson/promise','client','http','redis','defaults','localhost','./chatWebsite.socket','request','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x211791,_0xb1b929){var _0x198234=function(_0x43ee1f){while(--_0x43ee1f){_0x211791['push'](_0x211791['shift']());}};_0x198234(++_0xb1b929);}(_0x16fb,0x189));var _0xb16f=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0x16fb[_0x3305de];return _0x3b5a84;};'use strict';var _=require(_0xb16f('0x0'));var util=require(_0xb16f('0x1'));var moment=require('moment');var BPromise=require(_0xb16f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb16f('0x3'));var db=require(_0xb16f('0x4'))['db'];var utils=require(_0xb16f('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xb16f('0x6'));var jayson=require(_0xb16f('0x7'));var client=jayson[_0xb16f('0x8')][_0xb16f('0x9')]({'port':0x232a});config[_0xb16f('0xa')]=_[_0xb16f('0xb')](config[_0xb16f('0xa')],{'host':_0xb16f('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb16f('0xa')]));require(_0xb16f('0xd'))['register'](socket);function respondWithRpcPromise(_0xeab76,_0x1d65d4,_0x2601fc){return new BPromise(function(_0x2ed95e,_0x31427c){return client[_0xb16f('0xe')](_0xeab76,_0x2601fc)['then'](function(_0x89c532){logger['info'](_0xb16f('0xf'),_0x1d65d4,_0xb16f('0x10'));logger[_0xb16f('0x11')](_0xb16f('0x12'),_0x1d65d4,'request\x20sent',JSON[_0xb16f('0x13')](_0x89c532));if(_0x89c532[_0xb16f('0x14')]){if(_0x89c532[_0xb16f('0x14')]['code']===0x1f4){logger['error'](_0xb16f('0xf'),_0x1d65d4,_0x89c532[_0xb16f('0x14')][_0xb16f('0x15')]);return _0x31427c(_0x89c532[_0xb16f('0x14')][_0xb16f('0x15')]);}logger['error'](_0xb16f('0xf'),_0x1d65d4,_0x89c532['error'][_0xb16f('0x15')]);return _0x2ed95e(_0x89c532[_0xb16f('0x14')][_0xb16f('0x15')]);}else{logger[_0xb16f('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x1d65d4,'request\x20sent');_0x2ed95e(_0x89c532[_0xb16f('0x17')][_0xb16f('0x15')]);}})[_0xb16f('0x18')](function(_0x40099b){logger[_0xb16f('0x14')](_0xb16f('0xf'),_0x1d65d4,_0x40099b);_0x31427c(_0x40099b);});});} \ No newline at end of file +var _0xa341=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4981b8,_0x2eac0f){var _0x4e149e=function(_0x11f256){while(--_0x11f256){_0x4981b8['push'](_0x4981b8['shift']());}};_0x4e149e(++_0x2eac0f);}(_0xa341,0x1bc));var _0x1a34=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa341[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x1a34('0x0'));var util=require(_0x1a34('0x1'));var moment=require('moment');var BPromise=require(_0x1a34('0x2'));var rs=require(_0x1a34('0x3'));var fs=require('fs');var Redis=require(_0x1a34('0x4'));var db=require(_0x1a34('0x5'))['db'];var utils=require(_0x1a34('0x6'));var logger=require('../../config/logger')(_0x1a34('0x7'));var config=require(_0x1a34('0x8'));var jayson=require(_0x1a34('0x9'));var client=jayson[_0x1a34('0xa')][_0x1a34('0xb')]({'port':0x232a});config[_0x1a34('0xc')]=_[_0x1a34('0xd')](config[_0x1a34('0xc')],{'host':_0x1a34('0xe'),'port':0x18eb});var socket=require(_0x1a34('0xf'))(new Redis(config[_0x1a34('0xc')]));require(_0x1a34('0x10'))[_0x1a34('0x11')](socket);function respondWithRpcPromise(_0x5b15e1,_0x4ccf51,_0x14b221){return new BPromise(function(_0x25bd19,_0x56642c){return client[_0x1a34('0x12')](_0x5b15e1,_0x14b221)[_0x1a34('0x13')](function(_0x47394c){logger[_0x1a34('0x14')](_0x1a34('0x15'),_0x4ccf51,_0x1a34('0x16'));logger[_0x1a34('0x17')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x4ccf51,_0x1a34('0x16'),JSON[_0x1a34('0x18')](_0x47394c));if(_0x47394c[_0x1a34('0x19')]){if(_0x47394c[_0x1a34('0x19')][_0x1a34('0x1a')]===0x1f4){logger['error'](_0x1a34('0x15'),_0x4ccf51,_0x47394c[_0x1a34('0x19')][_0x1a34('0x1b')]);return _0x56642c(_0x47394c['error'][_0x1a34('0x1b')]);}logger[_0x1a34('0x19')](_0x1a34('0x15'),_0x4ccf51,_0x47394c[_0x1a34('0x19')][_0x1a34('0x1b')]);return _0x25bd19(_0x47394c[_0x1a34('0x19')][_0x1a34('0x1b')]);}else{logger[_0x1a34('0x14')](_0x1a34('0x15'),_0x4ccf51,_0x1a34('0x16'));_0x25bd19(_0x47394c[_0x1a34('0x1c')][_0x1a34('0x1b')]);}})[_0x1a34('0x1d')](function(_0x6890c2){logger[_0x1a34('0x19')](_0x1a34('0x15'),_0x4ccf51,_0x6890c2);_0x56642c(_0x6890c2);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 31402cc..62bbdef 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 _0x3e7f=['remove','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x3e7f,0x66));var _0xf3e7=function(_0x2c9db3,_0x47f183){_0x2c9db3=_0x2c9db3-0x0;var _0x2d7879=_0x3e7f[_0x2c9db3];return _0x2d7879;};'use strict';var ChatWebsiteEvents=require(_0xf3e7('0x0'));var events=[_0xf3e7('0x1'),_0xf3e7('0x2'),'update'];function createListener(_0x3db708,_0x4382e2){return function(_0xdde034){_0x4382e2[_0xf3e7('0x3')](_0x3db708,_0xdde034);};}function removeListener(_0x27e628,_0x208207){return function(){ChatWebsiteEvents[_0xf3e7('0x4')](_0x27e628,_0x208207);};}exports[_0xf3e7('0x5')]=function(_0x429845){for(var _0x23c1be=0x0,_0x1c98ce=events[_0xf3e7('0x6')];_0x23c1be<_0x1c98ce;_0x23c1be++){var _0x33e6d4=events[_0x23c1be];var _0x5133ed=createListener(_0xf3e7('0x7')+_0x33e6d4,_0x429845);ChatWebsiteEvents['on'](_0x33e6d4,_0x5133ed);}}; \ No newline at end of file +var _0xac3c=['register','chatWebsite:','./chatWebsite.events','save','remove','update','emit','removeListener'];(function(_0x30573a,_0x1b94e3){var _0x309cc8=function(_0x63bc1c){while(--_0x63bc1c){_0x30573a['push'](_0x30573a['shift']());}};_0x309cc8(++_0x1b94e3);}(_0xac3c,0x17a));var _0xcac3=function(_0x1c6025,_0x151efe){_0x1c6025=_0x1c6025-0x0;var _0x11db0a=_0xac3c[_0x1c6025];return _0x11db0a;};'use strict';var ChatWebsiteEvents=require(_0xcac3('0x0'));var events=[_0xcac3('0x1'),_0xcac3('0x2'),_0xcac3('0x3')];function createListener(_0x108439,_0x245ae4){return function(_0xa3ee56){_0x245ae4[_0xcac3('0x4')](_0x108439,_0xa3ee56);};}function removeListener(_0x1894fa,_0x1e6529){return function(){ChatWebsiteEvents[_0xcac3('0x5')](_0x1894fa,_0x1e6529);};}exports[_0xcac3('0x6')]=function(_0x45657a){for(var _0xab02fa=0x0,_0x10757f=events['length'];_0xab02fa<_0x10757f;_0xab02fa++){var _0x3b02b4=events[_0xab02fa];var _0x40004b=createListener(_0xcac3('0x7')+_0x3b02b4,_0x45657a);ChatWebsiteEvents['on'](_0x3b02b4,_0x40004b);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 75626cd..ee92b3d 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 _0x60ba=['addDisposition','/:id/canned_answers','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','file','addLogo','single','addAvatar','server/files/images/avatars/','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','extname','replace','/:id/offline','any','offline','addInteraction','addApplications','/:id/proactive_actions','addProactiveActions','/:id/users','addAgents','put','update','delete','destroy','removeAnswers','removeAgents','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','getFields','/:id/offline_messages','getOfflineMessages','getAgents','post','create'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x60ba,0x75));var _0xa60b=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x60ba[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0xa60b('0x0'));var util=require('util');var path=require(_0xa60b('0x1'));var timeout=require(_0xa60b('0x2'));var express=require(_0xa60b('0x3'));var router=express['Router']();var fs_extra=require(_0xa60b('0x4'));var auth=require(_0xa60b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa60b('0x6'));var controller=require('./chatWebsite.controller');router[_0xa60b('0x7')]('/',auth[_0xa60b('0x8')](),controller[_0xa60b('0x9')]);router['get'](_0xa60b('0xa'),auth[_0xa60b('0x8')](),controller[_0xa60b('0xb')]);router[_0xa60b('0x7')](_0xa60b('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xa60b('0x7')](_0xa60b('0xd'),auth[_0xa60b('0x8')](),controller[_0xa60b('0xe')]);router['get']('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router[_0xa60b('0x7')](_0xa60b('0xf'),controller[_0xa60b('0x10')]);router['get'](_0xa60b('0x11'),controller[_0xa60b('0x12')]);router[_0xa60b('0x7')](_0xa60b('0x13'),controller[_0xa60b('0x14')]);router[_0xa60b('0x7')](_0xa60b('0x15'),controller[_0xa60b('0x16')]);router[_0xa60b('0x7')](_0xa60b('0x17'),auth['isAuthenticated'](),controller[_0xa60b('0x18')]);router[_0xa60b('0x7')](_0xa60b('0x19'),controller[_0xa60b('0x1a')]);router['get'](_0xa60b('0x1b'),auth[_0xa60b('0x8')](),controller[_0xa60b('0x1c')]);router[_0xa60b('0x7')]('/:id/proactive_actions',auth['isAuthenticated'](),controller['getProactiveActions']);router[_0xa60b('0x7')]('/:id/fields',controller[_0xa60b('0x1d')]);router[_0xa60b('0x7')](_0xa60b('0x1e'),auth[_0xa60b('0x8')](),controller[_0xa60b('0x1f')]);router[_0xa60b('0x7')]('/:id/users',auth['isAuthenticated'](),controller[_0xa60b('0x20')]);router[_0xa60b('0x21')]('/',auth['isAuthenticated'](),controller[_0xa60b('0x22')]);router[_0xa60b('0x21')](_0xa60b('0xd'),auth['isAuthenticated'](),controller[_0xa60b('0x23')]);router[_0xa60b('0x21')](_0xa60b('0x24'),auth[_0xa60b('0x8')](),controller[_0xa60b('0x25')]);var upload=multer({'storage':multer[_0xa60b('0x26')]({'destination':function(_0x689af6,_0x11b48d,_0xc01aee){_0xc01aee(null,path[_0xa60b('0x27')](config[_0xa60b('0x28')],_0xa60b('0x29')));},'filename':function(_0x13c32f,_0x72ea3c,_0x91b38e){_0x91b38e(null,util[_0xa60b('0x2a')](_0xa60b('0x2b'),Date[_0xa60b('0x2c')](),_0x72ea3c[_0xa60b('0x2d')]));}})});router[_0xa60b('0x21')](_0xa60b('0xf'),upload['single'](_0xa60b('0x2e')),controller[_0xa60b('0x2f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x506f42,_0x398809,_0x29b1ab){_0x29b1ab(null,path['join'](config['root'],'server/files/images/avatars/'));},'filename':function(_0x149b6b,_0x542cb0,_0xb99965){_0xb99965(null,util[_0xa60b('0x2a')](_0xa60b('0x2b'),Date[_0xa60b('0x2c')](),_0x542cb0[_0xa60b('0x2d')]));}})});router[_0xa60b('0x21')](_0xa60b('0x11'),upload[_0xa60b('0x30')]('file'),controller[_0xa60b('0x31')]);var upload=multer({'storage':multer[_0xa60b('0x26')]({'destination':function(_0x547883,_0x104050,_0x40b6de){_0x40b6de(null,path[_0xa60b('0x27')](config[_0xa60b('0x28')],_0xa60b('0x32')));},'filename':function(_0x1cf202,_0x584656,_0x5935c2){_0x5935c2(null,util[_0xa60b('0x2a')]('%s-%s',Date['now'](),_0x584656[_0xa60b('0x2d')]));}})});router['post']('/:id/customer_avatar',upload[_0xa60b('0x30')]('file'),controller[_0xa60b('0x33')]);var upload=multer({'storage':multer[_0xa60b('0x26')]({'destination':function(_0x52a201,_0x4f4af1,_0x5be19c){_0x5be19c(null,path[_0xa60b('0x27')](config[_0xa60b('0x28')],'server/files/images/avatars/'));},'filename':function(_0x1e7419,_0x381ed7,_0x567624){_0x567624(null,util['format'](_0xa60b('0x2b'),Date[_0xa60b('0x2c')](),_0x381ed7['originalname']));}})});router[_0xa60b('0x21')](_0xa60b('0x15'),upload[_0xa60b('0x30')]('file'),controller[_0xa60b('0x34')]);router[_0xa60b('0x21')](_0xa60b('0x35'),controller[_0xa60b('0x36')]);const offlineUploadMulter=multer({'storage':multer[_0xa60b('0x26')]({'destination':function(_0x89709c,_0x45ea85,_0x1e1b84){const _0x1d161b=path['join'](config['root'],_0xa60b('0x37'),_0xa60b('0x38'),_0xa60b('0x39'));fs_extra[_0xa60b('0x3a')](_0x1d161b,function(){_0x1e1b84(null,_0x1d161b);});},'filename':function(_0x146f5f,_0x105650,_0x3265c4){const _0x2cbd85=_0x105650[_0xa60b('0x2d')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x3d2e8e=path[_0xa60b('0x3b')](_0x2cbd85);const _0x5219f6=Date[_0xa60b('0x2c')]()+'-'+_0x2cbd85[_0xa60b('0x3c')](_0x3d2e8e,'')+_0x3d2e8e;_0x3265c4(null,_0x5219f6);}})});router['post'](_0xa60b('0x3d'),offlineUploadMulter[_0xa60b('0x3e')](),controller[_0xa60b('0x3f')]);router[_0xa60b('0x21')](_0xa60b('0x17'),auth[_0xa60b('0x8')](),controller[_0xa60b('0x40')]);router[_0xa60b('0x21')](_0xa60b('0x1b'),auth[_0xa60b('0x8')](),controller[_0xa60b('0x41')]);router[_0xa60b('0x21')](_0xa60b('0x42'),auth[_0xa60b('0x8')](),controller[_0xa60b('0x43')]);router[_0xa60b('0x21')](_0xa60b('0x44'),auth[_0xa60b('0x8')](),controller[_0xa60b('0x45')]);router[_0xa60b('0x46')](_0xa60b('0xc'),auth[_0xa60b('0x8')](),controller[_0xa60b('0x47')]);router[_0xa60b('0x48')]('/:id',auth[_0xa60b('0x8')](),controller[_0xa60b('0x49')]);router[_0xa60b('0x48')](_0xa60b('0xd'),auth[_0xa60b('0x8')](),controller['removeDispositions']);router[_0xa60b('0x48')]('/:id/canned_answers',auth[_0xa60b('0x8')](),controller[_0xa60b('0x4a')]);router[_0xa60b('0x48')](_0xa60b('0x44'),auth[_0xa60b('0x8')](),controller[_0xa60b('0x4b')]);module['exports']=router; \ No newline at end of file +var _0x048f=['multer','util','Router','fs-extra','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/logo','getLogo','/:id/avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','getInteractions','/:id/snippet','/:id/applications','getApplications','getProactiveActions','/:id/fields','getFields','getOfflineMessages','/:id/users','post','create','addAnswer','diskStorage','root','server/files/images/logos/','format','%s-%s','now','originalname','file','addLogo','join','server/files/images/avatars/','single','addAvatar','/:id/customer_avatar','addCustomerAvatar','/:id/notify','notify','attachments','offline-chat','ensureDir','replace','/:id/offline','any','offline','addInteraction','addApplications','/:id/proactive_actions','addProactiveActions','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAgents','exports'];(function(_0x3d00db,_0x3692b3){var _0x41f115=function(_0x3c94fd){while(--_0x3c94fd){_0x3d00db['push'](_0x3d00db['shift']());}};_0x41f115(++_0x3692b3);}(_0x048f,0x1e3));var _0xf048=function(_0x48d8b5,_0x35319d){_0x48d8b5=_0x48d8b5-0x0;var _0x4f2f87=_0x048f[_0x48d8b5];return _0x4f2f87;};'use strict';var multer=require(_0xf048('0x0'));var util=require(_0xf048('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf048('0x2')]();var fs_extra=require(_0xf048('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf048('0x4'));var controller=require(_0xf048('0x5'));router[_0xf048('0x6')]('/',auth[_0xf048('0x7')](),controller[_0xf048('0x8')]);router[_0xf048('0x6')](_0xf048('0x9'),auth[_0xf048('0x7')](),controller[_0xf048('0xa')]);router[_0xf048('0x6')]('/:id',auth[_0xf048('0x7')](),controller['show']);router[_0xf048('0x6')](_0xf048('0xb'),auth['isAuthenticated'](),controller[_0xf048('0xc')]);router[_0xf048('0x6')](_0xf048('0xd'),auth['isAuthenticated'](),controller['getAnswers']);router[_0xf048('0x6')](_0xf048('0xe'),controller[_0xf048('0xf')]);router[_0xf048('0x6')](_0xf048('0x10'),controller['getAvatar']);router[_0xf048('0x6')]('/:id/customer_avatar',controller[_0xf048('0x11')]);router[_0xf048('0x6')](_0xf048('0x12'),controller[_0xf048('0x13')]);router['get']('/:id/interactions',auth['isAuthenticated'](),controller[_0xf048('0x14')]);router[_0xf048('0x6')](_0xf048('0x15'),controller['getSnippet']);router[_0xf048('0x6')](_0xf048('0x16'),auth[_0xf048('0x7')](),controller[_0xf048('0x17')]);router[_0xf048('0x6')]('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0xf048('0x18')]);router[_0xf048('0x6')](_0xf048('0x19'),controller[_0xf048('0x1a')]);router['get']('/:id/offline_messages',auth[_0xf048('0x7')](),controller[_0xf048('0x1b')]);router['get'](_0xf048('0x1c'),auth['isAuthenticated'](),controller['getAgents']);router[_0xf048('0x1d')]('/',auth[_0xf048('0x7')](),controller[_0xf048('0x1e')]);router['post'](_0xf048('0xb'),auth['isAuthenticated'](),controller['addDisposition']);router['post'](_0xf048('0xd'),auth[_0xf048('0x7')](),controller[_0xf048('0x1f')]);var upload=multer({'storage':multer[_0xf048('0x20')]({'destination':function(_0x46863a,_0xb5bc99,_0x13ee2c){_0x13ee2c(null,path['join'](config[_0xf048('0x21')],_0xf048('0x22')));},'filename':function(_0x53bd00,_0x421e6c,_0x44e19d){_0x44e19d(null,util[_0xf048('0x23')](_0xf048('0x24'),Date[_0xf048('0x25')](),_0x421e6c[_0xf048('0x26')]));}})});router['post'](_0xf048('0xe'),upload['single'](_0xf048('0x27')),controller[_0xf048('0x28')]);var upload=multer({'storage':multer[_0xf048('0x20')]({'destination':function(_0x105229,_0x2fec04,_0x3d9668){_0x3d9668(null,path[_0xf048('0x29')](config[_0xf048('0x21')],_0xf048('0x2a')));},'filename':function(_0x8cf121,_0x4f5a2b,_0x50d159){_0x50d159(null,util[_0xf048('0x23')](_0xf048('0x24'),Date[_0xf048('0x25')](),_0x4f5a2b[_0xf048('0x26')]));}})});router[_0xf048('0x1d')]('/:id/avatar',upload[_0xf048('0x2b')](_0xf048('0x27')),controller[_0xf048('0x2c')]);var upload=multer({'storage':multer[_0xf048('0x20')]({'destination':function(_0x2a7898,_0x2ded85,_0x16483d){_0x16483d(null,path['join'](config[_0xf048('0x21')],_0xf048('0x2a')));},'filename':function(_0x32f3a1,_0x39adf7,_0x363597){_0x363597(null,util[_0xf048('0x23')]('%s-%s',Date['now'](),_0x39adf7[_0xf048('0x26')]));}})});router[_0xf048('0x1d')](_0xf048('0x2d'),upload[_0xf048('0x2b')](_0xf048('0x27')),controller[_0xf048('0x2e')]);var upload=multer({'storage':multer[_0xf048('0x20')]({'destination':function(_0x4a3b4c,_0x523ba4,_0x386756){_0x386756(null,path[_0xf048('0x29')](config['root'],_0xf048('0x2a')));},'filename':function(_0x134132,_0x4ff390,_0x5b6160){_0x5b6160(null,util['format'](_0xf048('0x24'),Date[_0xf048('0x25')](),_0x4ff390[_0xf048('0x26')]));}})});router[_0xf048('0x1d')](_0xf048('0x12'),upload['single'](_0xf048('0x27')),controller['addSystemAvatar']);router[_0xf048('0x1d')](_0xf048('0x2f'),controller[_0xf048('0x30')]);const offlineUploadMulter=multer({'storage':multer[_0xf048('0x20')]({'destination':function(_0x3888ba,_0x51faf9,_0x2e3547){const _0x1c594d=path[_0xf048('0x29')](config[_0xf048('0x21')],'server/files',_0xf048('0x31'),_0xf048('0x32'));fs_extra[_0xf048('0x33')](_0x1c594d,function(){_0x2e3547(null,_0x1c594d);});},'filename':function(_0x13e097,_0x5ac408,_0xfbb47b){const _0x5c3ea4=_0x5ac408[_0xf048('0x26')][_0xf048('0x34')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x23eee8=path['extname'](_0x5c3ea4);const _0x129173=Date[_0xf048('0x25')]()+'-'+_0x5c3ea4[_0xf048('0x34')](_0x23eee8,'')+_0x23eee8;_0xfbb47b(null,_0x129173);}})});router[_0xf048('0x1d')](_0xf048('0x35'),offlineUploadMulter[_0xf048('0x36')](),controller[_0xf048('0x37')]);router['post']('/:id/interactions',auth[_0xf048('0x7')](),controller[_0xf048('0x38')]);router[_0xf048('0x1d')]('/:id/applications',auth[_0xf048('0x7')](),controller[_0xf048('0x39')]);router[_0xf048('0x1d')](_0xf048('0x3a'),auth[_0xf048('0x7')](),controller[_0xf048('0x3b')]);router[_0xf048('0x1d')](_0xf048('0x1c'),auth['isAuthenticated'](),controller[_0xf048('0x3c')]);router[_0xf048('0x3d')](_0xf048('0x3e'),auth[_0xf048('0x7')](),controller[_0xf048('0x3f')]);router['delete'](_0xf048('0x3e'),auth[_0xf048('0x7')](),controller[_0xf048('0x40')]);router[_0xf048('0x41')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xf048('0x42')]);router[_0xf048('0x41')]('/:id/canned_answers',auth[_0xf048('0x7')](),controller['removeAnswers']);router[_0xf048('0x41')](_0xf048('0x1c'),auth[_0xf048('0x7')](),controller[_0xf048('0x43')]);module[_0xf048('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 d0d23b5..8285b03 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 _0x7db1=['Router','production','app','get','client-side-logger','expressEndpoint','/client-logs','use','isAuthenticated','exports','beaver-logger/server','express','../components/auth/service','../config/environment'];(function(_0x2ea174,_0xb3181){var _0x5987c7=function(_0x3f7c44){while(--_0x3f7c44){_0x2ea174['push'](_0x2ea174['shift']());}};_0x5987c7(++_0xb3181);}(_0x7db1,0x1ca));var _0x17db=function(_0x3a1972,_0x194511){_0x3a1972=_0x3a1972-0x0;var _0xc7e0b5=_0x7db1[_0x3a1972];return _0xc7e0b5;};var beaverLogger=require(_0x17db('0x0'));var express=require(_0x17db('0x1'));var auth=require(_0x17db('0x2'));var config=require(_0x17db('0x3'));var router=express[_0x17db('0x4')]();var isProduction=config['env']===_0x17db('0x5')||![];function clientSideLogs(_0x35e5ae,_0x47aa41,_0x3d8d6b){var _0x43e41d=_0x35e5ae[_0x17db('0x6')][_0x17db('0x7')](_0x17db('0x8'));if(!_0x43e41d){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger[_0x17db('0x9')]({'uri':_0x17db('0xa'),'logger':_0x43e41d,'enableCors':!isProduction})(_0x35e5ae,_0x47aa41,_0x3d8d6b);}router[_0x17db('0xb')](auth[_0x17db('0xc')](),clientSideLogs);module[_0x17db('0xd')]=router; \ No newline at end of file +var _0x7929=['../config/environment','Router','env','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','isAuthenticated','express','../components/auth/service'];(function(_0x56a67a,_0x9c0845){var _0x325989=function(_0x3511ed){while(--_0x3511ed){_0x56a67a['push'](_0x56a67a['shift']());}};_0x325989(++_0x9c0845);}(_0x7929,0x106));var _0x9792=function(_0x36bf88,_0x15c459){_0x36bf88=_0x36bf88-0x0;var _0x332914=_0x7929[_0x36bf88];return _0x332914;};var beaverLogger=require('beaver-logger/server');var express=require(_0x9792('0x0'));var auth=require(_0x9792('0x1'));var config=require(_0x9792('0x2'));var router=express[_0x9792('0x3')]();var isProduction=config[_0x9792('0x4')]==='production'||![];function clientSideLogs(_0x460d65,_0x944700,_0x3ed9bf){var _0x23e2f1=_0x460d65['app'][_0x9792('0x5')](_0x9792('0x6'));if(!_0x23e2f1){throw new Error(_0x9792('0x7'));}return beaverLogger[_0x9792('0x8')]({'uri':_0x9792('0x9'),'logger':_0x23e2f1,'enableCors':!isProduction})(_0x460d65,_0x944700,_0x3ed9bf);}router['use'](auth[_0x9792('0xa')](),clientSideLogs);module['exports']=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index b583944..3c433ba 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 _0x5c66=['MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','AmazonAWS','Google','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id'];(function(_0x5f4585,_0x287c9f){var _0x32b347=function(_0x301639){while(--_0x301639){_0x5f4585['push'](_0x5f4585['shift']());}};_0x32b347(++_0x287c9f);}(_0x5c66,0xd7));var _0x65c6=function(_0xf46740,_0x2d49e0){_0xf46740=_0xf46740-0x0;var _0x46361a=_0x5c66[_0xf46740];return _0x46361a;};'use strict';var Sequelize=require(_0x65c6('0x0'));module[_0x65c6('0x1')]={'name':{'type':Sequelize[_0x65c6('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x65c6('0x3')](_0x65c6('0x4'),_0x65c6('0x5'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x65c6('0x6'),_0x65c6('0x7'))},'data1':{'type':Sequelize['STRING'],'comment':_0x65c6('0x8')},'data2':{'type':Sequelize[_0x65c6('0x2')],'comment':_0x65c6('0x9')},'data3':{'type':Sequelize[_0x65c6('0x2')],'comment':_0x65c6('0xa')},'data4':{'type':Sequelize[_0x65c6('0x2')],'comment':_0x65c6('0xb')},'data5':{'type':Sequelize[_0x65c6('0xc')],'comment':_0x65c6('0xd')},'data6':{'type':Sequelize['TEXT'],'comment':_0x65c6('0xe')},'data7':{'type':Sequelize[_0x65c6('0xc')],'comment':_0x65c6('0xf')}}; \ No newline at end of file +var _0x9a9c=['Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20refresh_token','sequelize','STRING','ENUM','AmazonAWS'];(function(_0xd1b4df,_0x118a9a){var _0x24b551=function(_0x438cfc){while(--_0x438cfc){_0xd1b4df['push'](_0xd1b4df['shift']());}};_0x24b551(++_0x118a9a);}(_0x9a9c,0xbc));var _0xc9a9=function(_0x41a332,_0x67b939){_0x41a332=_0x41a332-0x0;var _0x15ae65=_0x9a9c[_0x41a332];return _0x15ae65;};'use strict';var Sequelize=require(_0xc9a9('0x0'));module['exports']={'name':{'type':Sequelize[_0xc9a9('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xc9a9('0x2')](_0xc9a9('0x3'),'Google','MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xc9a9('0x2')](_0xc9a9('0x4'),_0xc9a9('0x5'))},'data1':{'type':Sequelize[_0xc9a9('0x1')],'comment':_0xc9a9('0x6')},'data2':{'type':Sequelize[_0xc9a9('0x1')],'comment':_0xc9a9('0x7')},'data3':{'type':Sequelize[_0xc9a9('0x1')],'comment':_0xc9a9('0x8')},'data4':{'type':Sequelize[_0xc9a9('0x1')],'comment':_0xc9a9('0x9')},'data5':{'type':Sequelize[_0xc9a9('0xa')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0xc9a9('0xa')],'comment':_0xc9a9('0xb')},'data7':{'type':Sequelize[_0xc9a9('0xa')],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 2d7c4cc..c3229fd 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 _0x581c=['base64','toString','ascii','isValidIdToken','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','../../components/parsers/qs','../../components/encryptor','../../config/logger','api','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','end','error','stack','name','send','padEnd','slice','index','CloudProvider','fieldName','type','key','filters','intersection','model','query','attributes','fields','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','service','decryptString','data3','catch','show','params','keys','length','find','MicrosoftAzure','create','body','Name\x20parameter\x20not\x20specified','rawAttributes','values','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','oauth2MicrosoftAuthorize','user','oauth2MicrosoftCallback','get','Invalid\x20state\x20parameter','parse','from','state'];(function(_0x31a201,_0x1fc5c7){var _0x5c8148=function(_0x49c045){while(--_0x49c045){_0x31a201['push'](_0x31a201['shift']());}};_0x5c8148(++_0x1fc5c7);}(_0x581c,0x78));var _0xc581=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x581c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc581('0x0'));var Redis=require('ioredis');var qs=require(_0xc581('0x1'));var encryptor=require(_0xc581('0x2'));var config=require('../../config/environment');var logger=require(_0xc581('0x3'))(_0xc581('0x4'));var db=require('../../mysqldb')['db'];var oauth=require(_0xc581('0x5'));config[_0xc581('0x6')]=_[_0xc581('0x7')](config['redis'],{'host':_0xc581('0x8'),'port':0x18eb});var socket=require(_0xc581('0x9'))(new Redis(config['redis']));var redis=new Redis(config[_0xc581('0x6')]);function respondWithStatusCode(_0x523113,_0x4daa8e){_0x4daa8e=_0x4daa8e||0xcc;return function(_0x503b7a){if(_0x503b7a){return _0x523113[_0xc581('0xa')](_0x4daa8e);}return _0x523113[_0xc581('0xb')](_0x4daa8e)['end']();};}function respondWithResult(_0x570a86,_0x47557e){_0x47557e=_0x47557e||0xc8;return function(_0x5018e){if(_0x5018e){return _0x570a86[_0xc581('0xb')](_0x47557e)['json'](_0x5018e);}};}function respondWithFilteredResult(_0x325e5c,_0x5b4a7a){return function(_0x1b7af9){if(_0x1b7af9){var _0x5cec5a=typeof _0x5b4a7a[_0xc581('0xc')]===_0xc581('0xd')&&typeof _0x5b4a7a[_0xc581('0xe')]==='undefined';var _0xd7f203=_0x1b7af9['count'];var _0x5dae41=_0x5cec5a?0x0:_0x5b4a7a[_0xc581('0xc')];var _0x553a80=_0x5cec5a?_0x1b7af9[_0xc581('0xf')]:_0x5b4a7a[_0xc581('0xc')]+_0x5b4a7a[_0xc581('0xe')];var _0x2301a0;if(_0x553a80>=_0xd7f203){_0x553a80=_0xd7f203;_0x2301a0=0xc8;}else{_0x2301a0=0xce;}_0x325e5c[_0xc581('0xb')](_0x2301a0);return _0x325e5c[_0xc581('0x10')](_0xc581('0x11'),_0x5dae41+'-'+_0x553a80+'/'+_0xd7f203)[_0xc581('0x12')](_0x1b7af9);}return null;};}function saveUpdates(_0x3e2400){return function(_0x3d9f26){if(_0x3d9f26){return _0x3d9f26[_0xc581('0x13')](_0x3e2400)[_0xc581('0x14')](function(_0x514dc4){return _0x514dc4;});}return null;};}function removeEntity(_0x131a98){return function(_0x3de59f){if(_0x3de59f){return _0x3de59f[_0xc581('0x15')]()[_0xc581('0x14')](function(){_0x131a98[_0xc581('0xb')](0xcc)[_0xc581('0x16')]();});}};}function handleEntityNotFound(_0x53bb19){return function(_0x1936b5){if(!_0x1936b5){_0x53bb19[_0xc581('0xa')](0x194);}return _0x1936b5;};}function handleError(_0x47a548,_0x1b1f79){_0x1b1f79=_0x1b1f79||0x1f4;return function(_0x46ccc4){logger[_0xc581('0x17')](_0x46ccc4[_0xc581('0x18')]);if(_0x46ccc4[_0xc581('0x19')]){delete _0x46ccc4['name'];}_0x47a548['status'](_0x1b1f79)[_0xc581('0x1a')](_0x46ccc4);};}function maskClientSecret(_0xf9ada2){return _[_0xc581('0x1b')](_0xf9ada2[_0xc581('0x1c')](0x0,0x3),0x14,'*');}exports[_0xc581('0x1d')]=function(_0x41e726,_0x54139c){var _0x1b3348={},_0x1f0cf6={},_0x21be13={'count':0x0,'rows':[]};var _0x13e487=_['map'](db[_0xc581('0x1e')]['rawAttributes'],function(_0x1df3d1){return{'name':_0x1df3d1[_0xc581('0x1f')],'type':_0x1df3d1[_0xc581('0x20')][_0xc581('0x21')]};});_0x1f0cf6['model']=_['map'](_0x13e487,_0xc581('0x19'));_0x1f0cf6['query']=_['keys'](_0x41e726['query']);_0x1f0cf6[_0xc581('0x22')]=_[_0xc581('0x23')](_0x1f0cf6[_0xc581('0x24')],_0x1f0cf6[_0xc581('0x25')]);_0x1b3348[_0xc581('0x26')]=_['intersection'](_0x1f0cf6[_0xc581('0x24')],qs[_0xc581('0x27')](_0x41e726[_0xc581('0x25')]['fields']));_0x1b3348[_0xc581('0x26')]=_0x1b3348[_0xc581('0x26')]['length']?_0x1b3348[_0xc581('0x26')]:_0x1f0cf6[_0xc581('0x24')];if(!_0x41e726[_0xc581('0x25')]['hasOwnProperty'](_0xc581('0x28'))){_0x1b3348[_0xc581('0xe')]=qs[_0xc581('0xe')](_0x41e726[_0xc581('0x25')][_0xc581('0xe')]);_0x1b3348['offset']=qs['offset'](_0x41e726[_0xc581('0x25')][_0xc581('0xc')]);}_0x1b3348[_0xc581('0x29')]=qs['sort'](_0x41e726[_0xc581('0x25')][_0xc581('0x2a')]);_0x1b3348[_0xc581('0x2b')]=qs[_0xc581('0x22')](_[_0xc581('0x2c')](_0x41e726[_0xc581('0x25')],_0x1f0cf6[_0xc581('0x22')]),_0x13e487);if(_0x41e726['query'][_0xc581('0x2d')]){_0x1b3348['where']=_[_0xc581('0x2e')](_0x1b3348['where'],{'$or':_[_0xc581('0x2f')](_0x13e487,function(_0x994fb8){if(_0x994fb8[_0xc581('0x20')]!==_0xc581('0x30')){var _0xf33e45={};_0xf33e45[_0x994fb8[_0xc581('0x19')]]={'$like':'%'+_0x41e726[_0xc581('0x25')][_0xc581('0x2d')]+'%'};return _0xf33e45;}})});}_0x1b3348=_[_0xc581('0x2e')]({},_0x1b3348,_0x41e726[_0xc581('0x31')]);var _0x3874c7={'where':_0x1b3348['where']};return db[_0xc581('0x1e')]['count'](_0x3874c7)[_0xc581('0x14')](function(_0x3863c7){_0x21be13[_0xc581('0xf')]=_0x3863c7;if(_0x41e726[_0xc581('0x25')][_0xc581('0x32')]){_0x1b3348[_0xc581('0x33')]=[{'all':!![]}];}return db[_0xc581('0x1e')][_0xc581('0x34')](_0x1b3348);})[_0xc581('0x14')](function(_0x2f7310){_0x21be13[_0xc581('0x35')]=_[_0xc581('0x2f')](_0x2f7310,function(_0x57d21b){if(_0x57d21b[_0xc581('0x36')]==='MicrosoftAzure'){var _0x593bcf=encryptor[_0xc581('0x37')](_0x57d21b['data3']);_0x57d21b[_0xc581('0x38')]=maskClientSecret(_0x593bcf);}return _0x57d21b;});return _0x21be13;})[_0xc581('0x14')](respondWithFilteredResult(_0x54139c,_0x1b3348))[_0xc581('0x39')](handleError(_0x54139c,null));};exports[_0xc581('0x3a')]=function(_0x564501,_0x1dd92d){var _0x491a63={'raw':!![],'where':{'id':_0x564501[_0xc581('0x3b')]['id']}},_0x1d2e44={};_0x1d2e44[_0xc581('0x24')]=_[_0xc581('0x3c')](db[_0xc581('0x1e')]['rawAttributes']);_0x1d2e44[_0xc581('0x25')]=_[_0xc581('0x3c')](_0x564501[_0xc581('0x25')]);_0x1d2e44[_0xc581('0x22')]=_[_0xc581('0x23')](_0x1d2e44['model'],_0x1d2e44[_0xc581('0x25')]);_0x491a63['attributes']=_[_0xc581('0x23')](_0x1d2e44[_0xc581('0x24')],qs[_0xc581('0x27')](_0x564501['query']['fields']));_0x491a63[_0xc581('0x26')]=_0x491a63[_0xc581('0x26')][_0xc581('0x3d')]?_0x491a63['attributes']:_0x1d2e44[_0xc581('0x24')];if(_0x564501[_0xc581('0x25')][_0xc581('0x32')]){_0x491a63[_0xc581('0x33')]=[{'all':!![]}];}_0x491a63=_['merge']({},_0x491a63,_0x564501[_0xc581('0x31')]);return db[_0xc581('0x1e')][_0xc581('0x3e')](_0x491a63)[_0xc581('0x14')](handleEntityNotFound(_0x1dd92d,null))[_0xc581('0x14')](function(_0x42a483){if(_0x42a483['service']===_0xc581('0x3f')){var _0xa1857f=encryptor['decryptString'](_0x42a483[_0xc581('0x38')]);_0x42a483[_0xc581('0x38')]=maskClientSecret(_0xa1857f);}return _0x42a483;})[_0xc581('0x14')](respondWithResult(_0x1dd92d,null))[_0xc581('0x39')](handleError(_0x1dd92d,null));};exports[_0xc581('0x40')]=function(_0x5b34cc,_0x37d70a){if(!_0x5b34cc[_0xc581('0x41')][_0xc581('0x19')])throw new Error(_0xc581('0x42'));if(!_0x5b34cc[_0xc581('0x41')][_0xc581('0x36')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x4e5f88=db[_0xc581('0x1e')][_0xc581('0x43')][_0xc581('0x36')][_0xc581('0x44')];if(!_0x4e5f88['includes'](_0x5b34cc['body'][_0xc581('0x36')]))throw new Error(_0xc581('0x45')+_0x4e5f88[_0xc581('0x46')](',\x20'));if(_0x5b34cc[_0xc581('0x41')]['service']===_0xc581('0x3f')&&_0x5b34cc[_0xc581('0x41')][_0xc581('0x38')]){_0x5b34cc[_0xc581('0x41')]['data3']=encryptor[_0xc581('0x47')](_0x5b34cc[_0xc581('0x41')][_0xc581('0x38')]);}return db[_0xc581('0x1e')][_0xc581('0x40')](_0x5b34cc[_0xc581('0x41')],{})[_0xc581('0x14')](respondWithResult(_0x37d70a,0xc9))[_0xc581('0x39')](handleError(_0x37d70a,null));};exports[_0xc581('0x13')]=function(_0x40c2e4,_0x4862c0){if(_0x40c2e4[_0xc581('0x41')]['id']){delete _0x40c2e4[_0xc581('0x41')]['id'];}return db[_0xc581('0x1e')]['find']({'where':{'id':_0x40c2e4[_0xc581('0x3b')]['id']}})[_0xc581('0x14')](handleEntityNotFound(_0x4862c0,null))[_0xc581('0x14')](function(_0x490a9f){if(_0x490a9f[_0xc581('0x36')]===_0xc581('0x3f')&&_0x40c2e4[_0xc581('0x41')][_0xc581('0x38')]){_0x40c2e4[_0xc581('0x41')][_0xc581('0x38')]=encryptor[_0xc581('0x47')](_0x40c2e4['body'][_0xc581('0x38')]);}return _0x490a9f;})['then'](saveUpdates(_0x40c2e4[_0xc581('0x41')],null))[_0xc581('0x14')](respondWithResult(_0x4862c0,null))[_0xc581('0x39')](handleError(_0x4862c0,null));};exports['destroy']=function(_0x85f63b,_0x17b3f7){return db['CloudProvider'][_0xc581('0x3e')]({'where':{'id':_0x85f63b[_0xc581('0x3b')]['id']}})[_0xc581('0x14')](handleEntityNotFound(_0x17b3f7,null))[_0xc581('0x14')](removeEntity(_0x17b3f7,null))[_0xc581('0x39')](handleError(_0x17b3f7,null));};exports[_0xc581('0x48')]=function(_0x4ce9d1,_0x29e6fe){return db[_0xc581('0x1e')]['findOne']({'where':{'id':_0x4ce9d1[_0xc581('0x3b')]['id']},'raw':!![]})['then'](function(_0x41752d){if(!_0x41752d)return _0x29e6fe[_0xc581('0xa')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x41752d,_0x4ce9d1[_0xc581('0x49')]['id'])};})[_0xc581('0x14')](respondWithResult(_0x29e6fe,null))['catch'](handleError(_0x29e6fe,null));};exports[_0xc581('0x4a')]=function(_0x5ac4bf,_0x51a873){var _0x43a3ae=_0x5ac4bf[_0xc581('0x41')];var _0x1cc3cf;var _0x47a928;if(_0x43a3ae[_0xc581('0x17')])throw _0x43a3ae;redis[_0xc581('0x4b')](_0x43a3ae['state'])[_0xc581('0x14')](function(_0x17e3ea){if(!_0x17e3ea)throw new Error(_0xc581('0x4c'));_0x1cc3cf=JSON[_0xc581('0x4d')](_0x17e3ea);var _0x562009=Buffer[_0xc581('0x4e')](_0x43a3ae[_0xc581('0x4f')],_0xc581('0x50'))[_0xc581('0x51')](_0xc581('0x52'));_0x47a928=JSON['parse'](_0x562009);if(!oauth[_0xc581('0x53')](_0x43a3ae['id_token'],_0x1cc3cf[_0xc581('0x54')]))throw new Error(_0xc581('0x55'));redis[_0xc581('0x56')](_0x43a3ae[_0xc581('0x4f')]);return oauth[_0xc581('0x57')](_0x43a3ae[_0xc581('0x58')],_0x1cc3cf);})[_0xc581('0x14')](function(_0x560c20){_0x1cc3cf[_0xc581('0x59')]=_0x560c20['access_token'];_0x1cc3cf[_0xc581('0x5a')]=_0x560c20[_0xc581('0x5b')];return db[_0xc581('0x1e')][_0xc581('0x13')]({'data5':_0x1cc3cf[_0xc581('0x59')],'data6':_0x1cc3cf[_0xc581('0x5a')]},{'where':{'id':_0x1cc3cf['id']}});})[_0xc581('0x14')](function(){oauth[_0xc581('0x5c')](_0x1cc3cf);socket[_0xc581('0x5d')](_0xc581('0x5e'),{'id':_0x47a928['id']});return;})[_0xc581('0x14')](respondWithStatusCode(_0x51a873,null))[_0xc581('0x39')](function(_0xa8578){if(_0x47a928){socket['emit'](_0xc581('0x5f'),{'id':_0x47a928['id']});}if(!_0x1cc3cf){logger[_0xc581('0x17')](_0xc581('0x60'),_0xa8578);return _0x51a873[_0xc581('0xb')](0x1f4)[_0xc581('0x1a')](_0xa8578[_0xc581('0x61')]);}logger[_0xc581('0x17')](_0xc581('0x62'),_0x1cc3cf['id'],JSON[_0xc581('0x63')](_0xa8578));});}; \ No newline at end of file +var _0x7a7a=['redis','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','error','stack','name','send','padEnd','slice','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','CloudProvider','MicrosoftAzure','decryptString','data3','catch','show','params','options','find','service','create','body','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','get','state','Invalid\x20state\x20parameter','parse','from','toString','isValidIdToken','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','refresh_token','startRefreshInterval','microsoftAuthorization:success','emit','Invalid\x20authentication\x20state\x20parameter','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','../../components/encryptor','../../config/environment','../../config/logger','api','./cloudProvider.oauth','localhost','socket.io-emitter'];(function(_0x1b36f6,_0x4c9232){var _0x5a2d88=function(_0x2119ae){while(--_0x2119ae){_0x1b36f6['push'](_0x1b36f6['shift']());}};_0x5a2d88(++_0x4c9232);}(_0x7a7a,0xb2));var _0xa7a7=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0x7a7a[_0x599e60];return _0x468e19;};'use strict';var _=require(_0xa7a7('0x0'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var encryptor=require(_0xa7a7('0x1'));var config=require(_0xa7a7('0x2'));var logger=require(_0xa7a7('0x3'))(_0xa7a7('0x4'));var db=require('../../mysqldb')['db'];var oauth=require(_0xa7a7('0x5'));config['redis']=_['defaults'](config['redis'],{'host':_0xa7a7('0x6'),'port':0x18eb});var socket=require(_0xa7a7('0x7'))(new Redis(config[_0xa7a7('0x8')]));var redis=new Redis(config[_0xa7a7('0x8')]);function respondWithStatusCode(_0x5d01bb,_0x34d84a){_0x34d84a=_0x34d84a||0xcc;return function(_0x2665c5){if(_0x2665c5){return _0x5d01bb[_0xa7a7('0x9')](_0x34d84a);}return _0x5d01bb[_0xa7a7('0xa')](_0x34d84a)[_0xa7a7('0xb')]();};}function respondWithResult(_0xc76317,_0x3312aa){_0x3312aa=_0x3312aa||0xc8;return function(_0x517627){if(_0x517627){return _0xc76317['status'](_0x3312aa)[_0xa7a7('0xc')](_0x517627);}};}function respondWithFilteredResult(_0xc84dc5,_0x271a46){return function(_0x16f4d4){if(_0x16f4d4){var _0x26d045=typeof _0x271a46['offset']===_0xa7a7('0xd')&&typeof _0x271a46[_0xa7a7('0xe')]===_0xa7a7('0xd');var _0x48b954=_0x16f4d4[_0xa7a7('0xf')];var _0x309107=_0x26d045?0x0:_0x271a46['offset'];var _0x1fa626=_0x26d045?_0x16f4d4[_0xa7a7('0xf')]:_0x271a46[_0xa7a7('0x10')]+_0x271a46[_0xa7a7('0xe')];var _0x2989c4;if(_0x1fa626>=_0x48b954){_0x1fa626=_0x48b954;_0x2989c4=0xc8;}else{_0x2989c4=0xce;}_0xc84dc5[_0xa7a7('0xa')](_0x2989c4);return _0xc84dc5[_0xa7a7('0x11')](_0xa7a7('0x12'),_0x309107+'-'+_0x1fa626+'/'+_0x48b954)[_0xa7a7('0xc')](_0x16f4d4);}return null;};}function saveUpdates(_0x50784c){return function(_0xcdf078){if(_0xcdf078){return _0xcdf078[_0xa7a7('0x13')](_0x50784c)[_0xa7a7('0x14')](function(_0x3d59a1){return _0x3d59a1;});}return null;};}function removeEntity(_0x1330de){return function(_0x522d65){if(_0x522d65){return _0x522d65[_0xa7a7('0x15')]()[_0xa7a7('0x14')](function(){_0x1330de[_0xa7a7('0xa')](0xcc)[_0xa7a7('0xb')]();});}};}function handleEntityNotFound(_0x15704f){return function(_0x2a75a9){if(!_0x2a75a9){_0x15704f[_0xa7a7('0x9')](0x194);}return _0x2a75a9;};}function handleError(_0xaeef60,_0x48ca82){_0x48ca82=_0x48ca82||0x1f4;return function(_0x4f1339){logger[_0xa7a7('0x16')](_0x4f1339[_0xa7a7('0x17')]);if(_0x4f1339[_0xa7a7('0x18')]){delete _0x4f1339[_0xa7a7('0x18')];}_0xaeef60[_0xa7a7('0xa')](_0x48ca82)[_0xa7a7('0x19')](_0x4f1339);};}function maskClientSecret(_0x1c825a){return _[_0xa7a7('0x1a')](_0x1c825a[_0xa7a7('0x1b')](0x0,0x3),0x14,'*');}exports[_0xa7a7('0x1c')]=function(_0x1eb477,_0x1291fd){var _0x47e700={},_0x21e633={},_0x13a946={'count':0x0,'rows':[]};var _0x15e566=_[_0xa7a7('0x1d')](db['CloudProvider'][_0xa7a7('0x1e')],function(_0x15f3ce){return{'name':_0x15f3ce[_0xa7a7('0x1f')],'type':_0x15f3ce[_0xa7a7('0x20')]['key']};});_0x21e633[_0xa7a7('0x21')]=_['map'](_0x15e566,_0xa7a7('0x18'));_0x21e633[_0xa7a7('0x22')]=_[_0xa7a7('0x23')](_0x1eb477['query']);_0x21e633['filters']=_[_0xa7a7('0x24')](_0x21e633[_0xa7a7('0x21')],_0x21e633[_0xa7a7('0x22')]);_0x47e700['attributes']=_[_0xa7a7('0x24')](_0x21e633[_0xa7a7('0x21')],qs[_0xa7a7('0x25')](_0x1eb477[_0xa7a7('0x22')]['fields']));_0x47e700[_0xa7a7('0x26')]=_0x47e700[_0xa7a7('0x26')][_0xa7a7('0x27')]?_0x47e700[_0xa7a7('0x26')]:_0x21e633['model'];if(!_0x1eb477['query'][_0xa7a7('0x28')](_0xa7a7('0x29'))){_0x47e700[_0xa7a7('0xe')]=qs[_0xa7a7('0xe')](_0x1eb477[_0xa7a7('0x22')][_0xa7a7('0xe')]);_0x47e700[_0xa7a7('0x10')]=qs[_0xa7a7('0x10')](_0x1eb477[_0xa7a7('0x22')]['offset']);}_0x47e700['order']=qs[_0xa7a7('0x2a')](_0x1eb477['query']['sort']);_0x47e700[_0xa7a7('0x2b')]=qs[_0xa7a7('0x2c')](_[_0xa7a7('0x2d')](_0x1eb477[_0xa7a7('0x22')],_0x21e633[_0xa7a7('0x2c')]),_0x15e566);if(_0x1eb477[_0xa7a7('0x22')][_0xa7a7('0x2e')]){_0x47e700[_0xa7a7('0x2b')]=_[_0xa7a7('0x2f')](_0x47e700[_0xa7a7('0x2b')],{'$or':_[_0xa7a7('0x1d')](_0x15e566,function(_0x29b004){if(_0x29b004['type']!==_0xa7a7('0x30')){var _0x5bc08f={};_0x5bc08f[_0x29b004[_0xa7a7('0x18')]]={'$like':'%'+_0x1eb477[_0xa7a7('0x22')][_0xa7a7('0x2e')]+'%'};return _0x5bc08f;}})});}_0x47e700=_[_0xa7a7('0x2f')]({},_0x47e700,_0x1eb477['options']);var _0x3573e3={'where':_0x47e700[_0xa7a7('0x2b')]};return db['CloudProvider'][_0xa7a7('0xf')](_0x3573e3)[_0xa7a7('0x14')](function(_0x1c11c6){_0x13a946[_0xa7a7('0xf')]=_0x1c11c6;if(_0x1eb477[_0xa7a7('0x22')][_0xa7a7('0x31')]){_0x47e700[_0xa7a7('0x32')]=[{'all':!![]}];}return db[_0xa7a7('0x33')]['findAll'](_0x47e700);})[_0xa7a7('0x14')](function(_0x18c7f4){_0x13a946['rows']=_['map'](_0x18c7f4,function(_0x4069f3){if(_0x4069f3['service']===_0xa7a7('0x34')){var _0x447feb=encryptor[_0xa7a7('0x35')](_0x4069f3[_0xa7a7('0x36')]);_0x4069f3['data3']=maskClientSecret(_0x447feb);}return _0x4069f3;});return _0x13a946;})[_0xa7a7('0x14')](respondWithFilteredResult(_0x1291fd,_0x47e700))[_0xa7a7('0x37')](handleError(_0x1291fd,null));};exports[_0xa7a7('0x38')]=function(_0xb4bf50,_0x4f57a2){var _0x309231={'raw':!![],'where':{'id':_0xb4bf50[_0xa7a7('0x39')]['id']}},_0x403eed={};_0x403eed[_0xa7a7('0x21')]=_[_0xa7a7('0x23')](db[_0xa7a7('0x33')]['rawAttributes']);_0x403eed['query']=_[_0xa7a7('0x23')](_0xb4bf50[_0xa7a7('0x22')]);_0x403eed['filters']=_[_0xa7a7('0x24')](_0x403eed[_0xa7a7('0x21')],_0x403eed[_0xa7a7('0x22')]);_0x309231['attributes']=_['intersection'](_0x403eed[_0xa7a7('0x21')],qs[_0xa7a7('0x25')](_0xb4bf50[_0xa7a7('0x22')][_0xa7a7('0x25')]));_0x309231[_0xa7a7('0x26')]=_0x309231['attributes']['length']?_0x309231['attributes']:_0x403eed[_0xa7a7('0x21')];if(_0xb4bf50[_0xa7a7('0x22')][_0xa7a7('0x31')]){_0x309231[_0xa7a7('0x32')]=[{'all':!![]}];}_0x309231=_[_0xa7a7('0x2f')]({},_0x309231,_0xb4bf50[_0xa7a7('0x3a')]);return db[_0xa7a7('0x33')][_0xa7a7('0x3b')](_0x309231)[_0xa7a7('0x14')](handleEntityNotFound(_0x4f57a2,null))[_0xa7a7('0x14')](function(_0x4135fe){if(_0x4135fe[_0xa7a7('0x3c')]==='MicrosoftAzure'){var _0x408d9c=encryptor[_0xa7a7('0x35')](_0x4135fe['data3']);_0x4135fe[_0xa7a7('0x36')]=maskClientSecret(_0x408d9c);}return _0x4135fe;})[_0xa7a7('0x14')](respondWithResult(_0x4f57a2,null))[_0xa7a7('0x37')](handleError(_0x4f57a2,null));};exports[_0xa7a7('0x3d')]=function(_0x3edd66,_0x3aa7a0){if(!_0x3edd66[_0xa7a7('0x3e')][_0xa7a7('0x18')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x3edd66[_0xa7a7('0x3e')]['service'])throw new Error('Service\x20parameter\x20not\x20specified');var _0x336aec=db[_0xa7a7('0x33')][_0xa7a7('0x1e')][_0xa7a7('0x3c')][_0xa7a7('0x3f')];if(!_0x336aec[_0xa7a7('0x40')](_0x3edd66['body'][_0xa7a7('0x3c')]))throw new Error(_0xa7a7('0x41')+_0x336aec[_0xa7a7('0x42')](',\x20'));if(_0x3edd66[_0xa7a7('0x3e')]['service']===_0xa7a7('0x34')&&_0x3edd66['body'][_0xa7a7('0x36')]){_0x3edd66[_0xa7a7('0x3e')][_0xa7a7('0x36')]=encryptor[_0xa7a7('0x43')](_0x3edd66[_0xa7a7('0x3e')][_0xa7a7('0x36')]);}return db[_0xa7a7('0x33')]['create'](_0x3edd66[_0xa7a7('0x3e')],{})[_0xa7a7('0x14')](respondWithResult(_0x3aa7a0,0xc9))[_0xa7a7('0x37')](handleError(_0x3aa7a0,null));};exports[_0xa7a7('0x13')]=function(_0x3da1c4,_0x1777bd){if(_0x3da1c4[_0xa7a7('0x3e')]['id']){delete _0x3da1c4[_0xa7a7('0x3e')]['id'];}return db[_0xa7a7('0x33')]['find']({'where':{'id':_0x3da1c4[_0xa7a7('0x39')]['id']}})[_0xa7a7('0x14')](handleEntityNotFound(_0x1777bd,null))['then'](function(_0x5035a9){if(_0x5035a9[_0xa7a7('0x3c')]===_0xa7a7('0x34')&&_0x3da1c4[_0xa7a7('0x3e')][_0xa7a7('0x36')]){_0x3da1c4[_0xa7a7('0x3e')]['data3']=encryptor[_0xa7a7('0x43')](_0x3da1c4[_0xa7a7('0x3e')][_0xa7a7('0x36')]);}return _0x5035a9;})[_0xa7a7('0x14')](saveUpdates(_0x3da1c4[_0xa7a7('0x3e')],null))[_0xa7a7('0x14')](respondWithResult(_0x1777bd,null))[_0xa7a7('0x37')](handleError(_0x1777bd,null));};exports[_0xa7a7('0x15')]=function(_0x5b14fa,_0x5f0ec5){return db[_0xa7a7('0x33')][_0xa7a7('0x3b')]({'where':{'id':_0x5b14fa[_0xa7a7('0x39')]['id']}})[_0xa7a7('0x14')](handleEntityNotFound(_0x5f0ec5,null))['then'](removeEntity(_0x5f0ec5,null))[_0xa7a7('0x37')](handleError(_0x5f0ec5,null));};exports[_0xa7a7('0x44')]=function(_0x345c1c,_0x7c1ee8){return db[_0xa7a7('0x33')][_0xa7a7('0x45')]({'where':{'id':_0x345c1c['params']['id']},'raw':!![]})[_0xa7a7('0x14')](function(_0x547c9b){if(!_0x547c9b)return _0x7c1ee8[_0xa7a7('0x9')](0x194);return{'url':oauth[_0xa7a7('0x46')](_0x547c9b,_0x345c1c['user']['id'])};})['then'](respondWithResult(_0x7c1ee8,null))[_0xa7a7('0x37')](handleError(_0x7c1ee8,null));};exports['oauth2MicrosoftCallback']=function(_0x3d89e4,_0x24098a){var _0x250f31=_0x3d89e4[_0xa7a7('0x3e')];var _0x5ac41e;var _0x12baa0;if(_0x250f31['error'])throw _0x250f31;redis[_0xa7a7('0x47')](_0x250f31[_0xa7a7('0x48')])[_0xa7a7('0x14')](function(_0x111003){if(!_0x111003)throw new Error(_0xa7a7('0x49'));_0x5ac41e=JSON[_0xa7a7('0x4a')](_0x111003);var _0xe3cf39=Buffer[_0xa7a7('0x4b')](_0x250f31[_0xa7a7('0x48')],'base64')[_0xa7a7('0x4c')]('ascii');_0x12baa0=JSON['parse'](_0xe3cf39);if(!oauth[_0xa7a7('0x4d')](_0x250f31['id_token'],_0x5ac41e[_0xa7a7('0x4e')]))throw new Error(_0xa7a7('0x4f'));redis[_0xa7a7('0x50')](_0x250f31[_0xa7a7('0x48')]);return oauth[_0xa7a7('0x51')](_0x250f31[_0xa7a7('0x52')],_0x5ac41e);})[_0xa7a7('0x14')](function(_0x5c60d4){_0x5ac41e[_0xa7a7('0x53')]=_0x5c60d4[_0xa7a7('0x54')];_0x5ac41e[_0xa7a7('0x55')]=_0x5c60d4[_0xa7a7('0x56')];return db['CloudProvider'][_0xa7a7('0x13')]({'data5':_0x5ac41e[_0xa7a7('0x53')],'data6':_0x5ac41e[_0xa7a7('0x55')]},{'where':{'id':_0x5ac41e['id']}});})[_0xa7a7('0x14')](function(){oauth[_0xa7a7('0x57')](_0x5ac41e);socket['emit'](_0xa7a7('0x58'),{'id':_0x12baa0['id']});return;})[_0xa7a7('0x14')](respondWithStatusCode(_0x24098a,null))[_0xa7a7('0x37')](function(_0x311a48){if(_0x12baa0){socket[_0xa7a7('0x59')]('microsoftAuthorization:error',{'id':_0x12baa0['id']});}if(!_0x5ac41e){logger[_0xa7a7('0x16')](_0xa7a7('0x5a'),_0x311a48);return _0x24098a[_0xa7a7('0xa')](0x1f4)['send'](_0x311a48['message']);}logger[_0xa7a7('0x16')](_0xa7a7('0x5b'),_0x5ac41e['id'],JSON[_0xa7a7('0x5c')](_0x311a48));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 1ba3bd8..8eb5c09 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 _0x2893=['rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','util','../../config/logger','path'];(function(_0x4d5cc7,_0x10f85d){var _0x289350=function(_0x5af4c3){while(--_0x5af4c3){_0x4d5cc7['push'](_0x4d5cc7['shift']());}};_0x289350(++_0x10f85d);}(_0x2893,0x12f));var _0x3289=function(_0x48bee1,_0x29f43d){_0x48bee1=_0x48bee1-0x0;var _0x582372=_0x2893[_0x48bee1];return _0x582372;};'use strict';var _=require('lodash');var util=require(_0x3289('0x0'));var logger=require(_0x3289('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3289('0x2'));var rimraf=require(_0x3289('0x3'));var config=require(_0x3289('0x4'));var attributes=require(_0x3289('0x5'));module[_0x3289('0x6')]=function(_0x2e2d7e,_0x54f77f){return _0x2e2d7e[_0x3289('0x7')](_0x3289('0x8'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c8d=['define','CloudProvider','cloud_providers','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./cloudProvider.attributes','exports'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x3c8d,0xdb));var _0xd3c8=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x3c8d[_0x2a6809];return _0x11c371;};'use strict';var _=require(_0xd3c8('0x0'));var util=require('util');var logger=require(_0xd3c8('0x1'))(_0xd3c8('0x2'));var moment=require('moment');var BPromise=require(_0xd3c8('0x3'));var rp=require(_0xd3c8('0x4'));var fs=require('fs');var path=require(_0xd3c8('0x5'));var rimraf=require(_0xd3c8('0x6'));var config=require('../../config/environment');var attributes=require(_0xd3c8('0x7'));module[_0xd3c8('0x8')]=function(_0x27c153,_0x4e7b92){return _0x27c153[_0xd3c8('0x9')](_0xd3c8('0xa'),attributes,{'tableName':_0xd3c8('0xb'),'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 f44bb5b..6ef07e2 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 _0x3177=['update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','../../config/environment','api','../../config/schedule/cloud-provider','../../mysqldb','redis','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','type','Dynamics365','push','data7','/.default','Outlook365','replace','{TENANT_ID}','data2','code','stringify','base64','toString','hex','client_id','response_type','join','redirect_uri','form_post','scope','nonce','prompt','login','map','value','oauth2Claims','payload','iss','issuer','aud','audience','unix','exp','resolve','data3','findOne','then','refresh_token','data6','data4','data1','decryptString','POST','data5','CloudProvider'];(function(_0x5adfa9,_0x4b835d){var _0x458f41=function(_0x504e46){while(--_0x504e46){_0x5adfa9['push'](_0x5adfa9['shift']());}};_0x458f41(++_0x4b835d);}(_0x3177,0x185));var _0x7317=function(_0xfc5df5,_0x5935dc){_0xfc5df5=_0xfc5df5-0x0;var _0x3a9b2c=_0x3177[_0xfc5df5];return _0x3a9b2c;};'use strict';var _=require(_0x7317('0x0'));var crypto=require(_0x7317('0x1'));var jwt=require(_0x7317('0x2'));var moment=require(_0x7317('0x3'));var Redis=require(_0x7317('0x4'));var rp=require(_0x7317('0x5'));var util=require(_0x7317('0x6'));var encryptor=require(_0x7317('0x7'));var config=require(_0x7317('0x8'));var logger=require('../../config/logger')(_0x7317('0x9'));var schedule=require(_0x7317('0xa'));var db=require(_0x7317('0xb'))['db'];config[_0x7317('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0x7317('0xc')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0x7317('0xd'),_0x7317('0xe'),_0x7317('0xf'),_0x7317('0x10'),_0x7317('0x11'),_0x7317('0x12'),_0x7317('0x13')],'Dynamics365':[_0x7317('0xd'),_0x7317('0x10')]};var MICROSOFT_AUTH_ENDPOINT=_0x7317('0x14');var MICROSOFT_TOKEN_ENDPOINT=_0x7317('0x15');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x1f8b72){var _0x2c63d8=_['map'](AZURE_AUTH_SCOPES[_0x1f8b72[_0x7317('0x16')]]);if(_0x1f8b72[_0x7317('0x16')]===_0x7317('0x17'))_0x2c63d8[_0x7317('0x18')](_0x1f8b72[_0x7317('0x19')]+_0x7317('0x1a'));return _0x2c63d8['join']('\x20');}function getAccessTokenScope(_0x3272f5){if(_0x3272f5[_0x7317('0x16')]===_0x7317('0x1b'))return _0x7317('0x11');if(_0x3272f5[_0x7317('0x16')]===_0x7317('0x17'))return _0x3272f5[_0x7317('0x19')]+_0x7317('0x1a');}function generateMicrosoftAuthorizationUrl(_0x32f011,_0x48aeb5){var _0x3306c1=MICROSOFT_AUTH_URL[_0x7317('0x1c')](_0x7317('0x1d'),_0x32f011[_0x7317('0x1e')]);var _0xb93fa5=[_0x7317('0x1f'),'id_token'];var _0x4960d1=Buffer['from'](JSON[_0x7317('0x20')]({'id':_0x48aeb5}))['toString'](_0x7317('0x21'));var _0x94a0c0=crypto['randomBytes'](0x10)[_0x7317('0x22')](_0x7317('0x23'));var _0x169910=getAuthorizationScopes(_0x32f011);var _0xa41d59=[{'key':_0x7317('0x24'),'value':_0x32f011['data1']},{'key':_0x7317('0x25'),'value':encodeURIComponent(_0xb93fa5[_0x7317('0x26')]('\x20'))},{'key':_0x7317('0x27'),'value':_0x32f011['data4']},{'key':'response_mode','value':_0x7317('0x28')},{'key':_0x7317('0x29'),'value':encodeURIComponent(_0x169910)},{'key':'state','value':_0x4960d1},{'key':_0x7317('0x2a'),'value':_0x94a0c0},{'key':_0x7317('0x2b'),'value':_0x7317('0x2c')}];var _0x41ee35=_0x3306c1+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x7317('0x2d')](_0xa41d59,function(_0x2b4f18){return _0x2b4f18['key']+'='+_0x2b4f18[_0x7317('0x2e')];})['join']('&');_0x32f011[_0x7317('0x2f')]={'issuer':_0x3306c1['replace']('oauth2/',''),'audience':_0x32f011['data1'],'state':_0x4960d1,'nonce':_0x94a0c0};redis['set'](_0x4960d1,JSON[_0x7317('0x20')](_0x32f011));return _0x41ee35;}function isValidIdToken(_0x17bb24,_0x503de4){try{var _0x1641b4=jwt['decode'](_0x17bb24,{'complete':!![]});var _0x325e71=_0x1641b4[_0x7317('0x30')];if(_0x325e71[_0x7317('0x31')]!==_0x503de4[_0x7317('0x32')])return![];if(_0x325e71[_0x7317('0x33')]!==_0x503de4[_0x7317('0x34')])return![];if(_0x325e71[_0x7317('0x2a')]!==_0x503de4[_0x7317('0x2a')])return![];if(moment()['isAfter'](moment[_0x7317('0x35')](_0x325e71[_0x7317('0x36')])))return![];return!![];}catch(_0x28e3b3){throw _0x28e3b3;}}function refreshOauth2MicrosoftAccessToken(_0x5870b4){return Promise[_0x7317('0x37')]()['then'](function(){if(_0x5870b4[_0x7317('0x38')])return _0x5870b4;return db['CloudProvider'][_0x7317('0x39')]({'where':{'id':_0x5870b4['id']},'raw':!![]});})[_0x7317('0x3a')](function(_0x55bf07){var _0x4019e8={'grant_type':_0x7317('0x3b'),'refresh_token':_0x55bf07[_0x7317('0x3c')],'scope':getAccessTokenScope(_0x55bf07),'redirect_uri':_0x55bf07[_0x7317('0x3d')],'client_id':_0x55bf07[_0x7317('0x3e')],'client_secret':encryptor[_0x7317('0x3f')](_0x55bf07[_0x7317('0x38')])};var _0x558091={'method':_0x7317('0x40'),'uri':MICROSOFT_AUTH_URL['replace'](_0x7317('0x1d'),_0x55bf07[_0x7317('0x1e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x4019e8,'json':!![]};return rp(_0x558091);})[_0x7317('0x3a')](function(_0xe8fd0f){_0x5870b4[_0x7317('0x41')]=_0xe8fd0f['access_token'];_0x5870b4['data6']=_0xe8fd0f['refresh_token'];return db[_0x7317('0x42')][_0x7317('0x43')]({'data5':_0x5870b4[_0x7317('0x41')],'data6':_0x5870b4[_0x7317('0x3c')]},{'where':{'id':_0x5870b4['id']}});})['then'](function(){return _0x5870b4;})[_0x7317('0x44')](function(_0x2a5163){logger[_0x7317('0x45')](_0x7317('0x46'),_0x5870b4['id'],_0x2a5163);});}function getOauth2MicrosoftAccessToken(_0x2345dd,_0x28556d){var _0x54fa94={'grant_type':_0x7317('0x47'),'code':_0x2345dd,'scope':getAccessTokenScope(_0x28556d),'redirect_uri':_0x28556d[_0x7317('0x3d')],'client_id':_0x28556d[_0x7317('0x3e')],'client_secret':encryptor[_0x7317('0x3f')](_0x28556d['data3'])};var _0x4067d3={'method':'POST','uri':MICROSOFT_AUTH_URL['replace'](_0x7317('0x1d'),_0x28556d[_0x7317('0x1e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x54fa94,'json':!![]};return rp(_0x4067d3);}function startRefreshInterval(_0x27c2cc){var _0x13a996=schedule['intervals'];if(_0x13a996[_0x27c2cc['id']])clearInterval(_0x13a996[_0x27c2cc['id']]);_0x13a996[_0x27c2cc['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x27c2cc['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x7317('0x48')]=_0x13a996;}function startAllRefreshIntervals(){return db['CloudProvider']['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x7317('0x3a')](function(_0x33eacf){var _0x1f2da5=_0x33eacf[_0x7317('0x2d')](function(_0x568067){return refreshOauth2MicrosoftAccessToken(_0x568067)[_0x7317('0x3a')](function(_0xf063b5){startRefreshInterval(_0xf063b5);});});return Promise['all'](_0x1f2da5);})[_0x7317('0x44')](function(_0x3c2474){var _0x824c56=_0x3c2474?util[_0x7317('0x49')](_0x3c2474,{'showHidden':![],'depth':null}):'';logger['error'](_0x7317('0x4a'),_0x824c56);});}module[_0x7317('0x4b')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xa6a3=['all','catch','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','lodash','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','../../config/schedule/cloud-provider','../../mysqldb','defaults','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','email','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','openid','offline_access','/authorize','/token','type','Dynamics365','push','data7','join','Outlook365','/.default','replace','data2','code','id_token','from','stringify','toString','base64','client_id','data1','response_type','data4','response_mode','form_post','scope','state','nonce','key','value','set','decode','payload','iss','audience','isAfter','unix','exp','resolve','then','data3','findOne','refresh_token','data6','decryptString','POST','{TENANT_ID}','access_token','CloudProvider','data5','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','intervals','bind','findAll','map'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa6a3,0x1de));var _0x3a6a=function(_0x1bdc52,_0x4876a9){_0x1bdc52=_0x1bdc52-0x0;var _0xdf3fa3=_0xa6a3[_0x1bdc52];return _0xdf3fa3;};'use strict';var _=require(_0x3a6a('0x0'));var crypto=require('crypto');var jwt=require(_0x3a6a('0x1'));var moment=require(_0x3a6a('0x2'));var Redis=require(_0x3a6a('0x3'));var rp=require(_0x3a6a('0x4'));var util=require(_0x3a6a('0x5'));var encryptor=require(_0x3a6a('0x6'));var config=require(_0x3a6a('0x7'));var logger=require(_0x3a6a('0x8'))('api');var schedule=require(_0x3a6a('0x9'));var db=require(_0x3a6a('0xa'))['db'];config['redis']=_[_0x3a6a('0xb')](config[_0x3a6a('0xc')],{'host':_0x3a6a('0xd'),'port':0x18eb});var redis=new Redis(config[_0x3a6a('0xc')]);var MICROSOFT_AUTH_URL=_0x3a6a('0xe');var AZURE_AUTH_SCOPES={'Outlook365':['openid','profile',_0x3a6a('0xf'),'offline_access',_0x3a6a('0x10'),_0x3a6a('0x11'),_0x3a6a('0x12')],'Dynamics365':[_0x3a6a('0x13'),_0x3a6a('0x14')]};var MICROSOFT_AUTH_ENDPOINT=_0x3a6a('0x15');var MICROSOFT_TOKEN_ENDPOINT=_0x3a6a('0x16');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x48a8c9){var _0x567500=_['map'](AZURE_AUTH_SCOPES[_0x48a8c9[_0x3a6a('0x17')]]);if(_0x48a8c9[_0x3a6a('0x17')]===_0x3a6a('0x18'))_0x567500[_0x3a6a('0x19')](_0x48a8c9[_0x3a6a('0x1a')]+'/.default');return _0x567500[_0x3a6a('0x1b')]('\x20');}function getAccessTokenScope(_0x42300a){if(_0x42300a['type']===_0x3a6a('0x1c'))return _0x3a6a('0x10');if(_0x42300a[_0x3a6a('0x17')]===_0x3a6a('0x18'))return _0x42300a['data7']+_0x3a6a('0x1d');}function generateMicrosoftAuthorizationUrl(_0x325a0f,_0x4469d8){var _0x5839dc=MICROSOFT_AUTH_URL[_0x3a6a('0x1e')]('{TENANT_ID}',_0x325a0f[_0x3a6a('0x1f')]);var _0x25c292=[_0x3a6a('0x20'),_0x3a6a('0x21')];var _0x406990=Buffer[_0x3a6a('0x22')](JSON[_0x3a6a('0x23')]({'id':_0x4469d8}))[_0x3a6a('0x24')](_0x3a6a('0x25'));var _0x16d68b=crypto['randomBytes'](0x10)[_0x3a6a('0x24')]('hex');var _0x55be52=getAuthorizationScopes(_0x325a0f);var _0x1294bd=[{'key':_0x3a6a('0x26'),'value':_0x325a0f[_0x3a6a('0x27')]},{'key':_0x3a6a('0x28'),'value':encodeURIComponent(_0x25c292[_0x3a6a('0x1b')]('\x20'))},{'key':'redirect_uri','value':_0x325a0f[_0x3a6a('0x29')]},{'key':_0x3a6a('0x2a'),'value':_0x3a6a('0x2b')},{'key':_0x3a6a('0x2c'),'value':encodeURIComponent(_0x55be52)},{'key':_0x3a6a('0x2d'),'value':_0x406990},{'key':_0x3a6a('0x2e'),'value':_0x16d68b},{'key':'prompt','value':'login'}];var _0x4f6589=_0x5839dc+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x1294bd,function(_0x146b94){return _0x146b94[_0x3a6a('0x2f')]+'='+_0x146b94[_0x3a6a('0x30')];})[_0x3a6a('0x1b')]('&');_0x325a0f['oauth2Claims']={'issuer':_0x5839dc[_0x3a6a('0x1e')]('oauth2/',''),'audience':_0x325a0f['data1'],'state':_0x406990,'nonce':_0x16d68b};redis[_0x3a6a('0x31')](_0x406990,JSON[_0x3a6a('0x23')](_0x325a0f));return _0x4f6589;}function isValidIdToken(_0x1e54ef,_0x379808){try{var _0x1731b1=jwt[_0x3a6a('0x32')](_0x1e54ef,{'complete':!![]});var _0x51e3dc=_0x1731b1[_0x3a6a('0x33')];if(_0x51e3dc[_0x3a6a('0x34')]!==_0x379808['issuer'])return![];if(_0x51e3dc['aud']!==_0x379808[_0x3a6a('0x35')])return![];if(_0x51e3dc[_0x3a6a('0x2e')]!==_0x379808[_0x3a6a('0x2e')])return![];if(moment()[_0x3a6a('0x36')](moment[_0x3a6a('0x37')](_0x51e3dc[_0x3a6a('0x38')])))return![];return!![];}catch(_0x3cfbc9){throw _0x3cfbc9;}}function refreshOauth2MicrosoftAccessToken(_0x247196){return Promise[_0x3a6a('0x39')]()[_0x3a6a('0x3a')](function(){if(_0x247196[_0x3a6a('0x3b')])return _0x247196;return db['CloudProvider'][_0x3a6a('0x3c')]({'where':{'id':_0x247196['id']},'raw':!![]});})[_0x3a6a('0x3a')](function(_0x32a370){var _0x11efdc={'grant_type':_0x3a6a('0x3d'),'refresh_token':_0x32a370[_0x3a6a('0x3e')],'scope':getAccessTokenScope(_0x32a370),'redirect_uri':_0x32a370[_0x3a6a('0x29')],'client_id':_0x32a370[_0x3a6a('0x27')],'client_secret':encryptor[_0x3a6a('0x3f')](_0x32a370['data3'])};var _0x2187b7={'method':_0x3a6a('0x40'),'uri':MICROSOFT_AUTH_URL[_0x3a6a('0x1e')](_0x3a6a('0x41'),_0x32a370[_0x3a6a('0x1f')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x11efdc,'json':!![]};return rp(_0x2187b7);})[_0x3a6a('0x3a')](function(_0x499ab5){_0x247196['data5']=_0x499ab5[_0x3a6a('0x42')];_0x247196[_0x3a6a('0x3e')]=_0x499ab5[_0x3a6a('0x3d')];return db[_0x3a6a('0x43')]['update']({'data5':_0x247196[_0x3a6a('0x44')],'data6':_0x247196[_0x3a6a('0x3e')]},{'where':{'id':_0x247196['id']}});})[_0x3a6a('0x3a')](function(){return _0x247196;})['catch'](function(_0x15fe2c){logger[_0x3a6a('0x45')](_0x3a6a('0x46'),_0x247196['id'],_0x15fe2c);});}function getOauth2MicrosoftAccessToken(_0x1d50e8,_0x364151){var _0x102f2f={'grant_type':'authorization_code','code':_0x1d50e8,'scope':getAccessTokenScope(_0x364151),'redirect_uri':_0x364151[_0x3a6a('0x29')],'client_id':_0x364151[_0x3a6a('0x27')],'client_secret':encryptor[_0x3a6a('0x3f')](_0x364151[_0x3a6a('0x3b')])};var _0x169b51={'method':'POST','uri':MICROSOFT_AUTH_URL['replace']('{TENANT_ID}',_0x364151[_0x3a6a('0x1f')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x102f2f,'json':!![]};return rp(_0x169b51);}function startRefreshInterval(_0xb0716d){var _0x49868c=schedule[_0x3a6a('0x47')];if(_0x49868c[_0xb0716d['id']])clearInterval(_0x49868c[_0xb0716d['id']]);_0x49868c[_0xb0716d['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x3a6a('0x48')](this,{'id':_0xb0716d['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x3a6a('0x47')]=_0x49868c;}function startAllRefreshIntervals(){return db[_0x3a6a('0x43')][_0x3a6a('0x49')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x22261e){var _0x44cf58=_0x22261e[_0x3a6a('0x4a')](function(_0x3673b2){return refreshOauth2MicrosoftAccessToken(_0x3673b2)[_0x3a6a('0x3a')](function(_0x2c0706){startRefreshInterval(_0x2c0706);});});return Promise[_0x3a6a('0x4b')](_0x44cf58);})[_0x3a6a('0x4c')](function(_0xe20041){var _0x31b15e=_0xe20041?util[_0x3a6a('0x4d')](_0xe20041,{'showHidden':![],'depth':null}):'';logger[_0x3a6a('0x45')](_0x3a6a('0x4e'),_0x31b15e);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 3812e44..777aa18 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 _0x8ff9=['../../config/environment','client','http','request','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x8ff9,0x1a6));var _0x98ff=function(_0xc1da56,_0x5e7d96){_0xc1da56=_0xc1da56-0x0;var _0x5b1e17=_0x8ff9[_0xc1da56];return _0x5b1e17;};'use strict';var _=require(_0x98ff('0x0'));var util=require(_0x98ff('0x1'));var moment=require(_0x98ff('0x2'));var BPromise=require(_0x98ff('0x3'));var rs=require(_0x98ff('0x4'));var fs=require('fs');var Redis=require(_0x98ff('0x5'));var db=require(_0x98ff('0x6'))['db'];var utils=require(_0x98ff('0x7'));var logger=require(_0x98ff('0x8'))(_0x98ff('0x9'));var config=require(_0x98ff('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x98ff('0xb')][_0x98ff('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x13537e,_0x21d840,_0x12d3fe){return new BPromise(function(_0xbe13f3,_0x51fbd8){return client[_0x98ff('0xd')](_0x13537e,_0x12d3fe)['then'](function(_0x4bbf37){logger[_0x98ff('0xe')](_0x98ff('0xf'),_0x21d840,_0x98ff('0x10'));logger[_0x98ff('0x11')](_0x98ff('0x12'),_0x21d840,'request\x20sent',JSON[_0x98ff('0x13')](_0x4bbf37));if(_0x4bbf37['error']){if(_0x4bbf37[_0x98ff('0x14')]['code']===0x1f4){logger['error'](_0x98ff('0xf'),_0x21d840,_0x4bbf37[_0x98ff('0x14')][_0x98ff('0x15')]);return _0x51fbd8(_0x4bbf37['error'][_0x98ff('0x15')]);}logger['error'](_0x98ff('0xf'),_0x21d840,_0x4bbf37[_0x98ff('0x14')][_0x98ff('0x15')]);return _0xbe13f3(_0x4bbf37[_0x98ff('0x14')][_0x98ff('0x15')]);}else{logger[_0x98ff('0xe')]('CloudProvider,\x20%s,\x20%s',_0x21d840,_0x98ff('0x10'));_0xbe13f3(_0x4bbf37[_0x98ff('0x16')][_0x98ff('0x15')]);}})[_0x98ff('0x17')](function(_0x3751b9){logger[_0x98ff('0x14')](_0x98ff('0xf'),_0x21d840,_0x3751b9);_0x51fbd8(_0x3751b9);});});} \ No newline at end of file +var _0x85de=['CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x397ed9,_0x3a831a){var _0x1a5a4d=function(_0x974ae9){while(--_0x974ae9){_0x397ed9['push'](_0x397ed9['shift']());}};_0x1a5a4d(++_0x3a831a);}(_0x85de,0x65));var _0xe85d=function(_0x5efdbf,_0x4edf76){_0x5efdbf=_0x5efdbf-0x0;var _0x397580=_0x85de[_0x5efdbf];return _0x397580;};'use strict';var _=require(_0xe85d('0x0'));var util=require(_0xe85d('0x1'));var moment=require(_0xe85d('0x2'));var BPromise=require(_0xe85d('0x3'));var rs=require(_0xe85d('0x4'));var fs=require('fs');var Redis=require(_0xe85d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe85d('0x6'));var logger=require(_0xe85d('0x7'))(_0xe85d('0x8'));var config=require(_0xe85d('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe85d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27401c,_0x387bfc,_0x42c1ca){return new BPromise(function(_0x4c1cbb,_0x2c1197){return client[_0xe85d('0xb')](_0x27401c,_0x42c1ca)[_0xe85d('0xc')](function(_0x89b2b2){logger[_0xe85d('0xd')](_0xe85d('0xe'),_0x387bfc,_0xe85d('0xf'));logger[_0xe85d('0x10')](_0xe85d('0x11'),_0x387bfc,_0xe85d('0xf'),JSON[_0xe85d('0x12')](_0x89b2b2));if(_0x89b2b2[_0xe85d('0x13')]){if(_0x89b2b2[_0xe85d('0x13')][_0xe85d('0x14')]===0x1f4){logger[_0xe85d('0x13')](_0xe85d('0xe'),_0x387bfc,_0x89b2b2[_0xe85d('0x13')]['message']);return _0x2c1197(_0x89b2b2['error'][_0xe85d('0x15')]);}logger[_0xe85d('0x13')](_0xe85d('0xe'),_0x387bfc,_0x89b2b2[_0xe85d('0x13')][_0xe85d('0x15')]);return _0x4c1cbb(_0x89b2b2[_0xe85d('0x13')][_0xe85d('0x15')]);}else{logger['info']('CloudProvider,\x20%s,\x20%s',_0x387bfc,'request\x20sent');_0x4c1cbb(_0x89b2b2['result'][_0xe85d('0x15')]);}})[_0xe85d('0x16')](function(_0x5c431c){logger[_0xe85d('0x13')](_0xe85d('0xe'),_0x387bfc,_0x5c431c);_0x2c1197(_0x5c431c);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index f7928ca..24e1c6a 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 _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0x48999d,_0x1e02cb){var _0x1ad0d1=function(_0x3f974e){while(--_0x3f974e){_0x48999d['push'](_0x48999d['shift']());}};_0x1ad0d1(++_0x1e02cb);}(_0x1261,0x144));var _0x1126=function(_0x1193ea,_0xc04ef0){_0x1193ea=_0x1193ea-0x0;var _0x5e4000=_0x1261[_0x1193ea];return _0x5e4000;};'use strict';var express=require('express');var router=express[_0x1126('0x0')]();var auth=require(_0x1126('0x1'));var controller=require(_0x1126('0x2'));router[_0x1126('0x3')]('/',auth[_0x1126('0x4')](),controller[_0x1126('0x5')]);router[_0x1126('0x3')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller[_0x1126('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1126('0x8')]);router[_0x1126('0x9')]('/:id',auth[_0x1126('0x4')](),controller[_0x1126('0xa')]);router[_0x1126('0xb')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller['destroy']);router[_0x1126('0x3')](_0x1126('0xc'),auth[_0x1126('0x4')](),controller['oauth2MicrosoftAuthorize']);router[_0x1126('0xd')]('/oauth2/microsoft/callback',controller['oauth2MicrosoftCallback']);module[_0x1126('0xe')]=router; \ No newline at end of file +var _0x2ef3=['Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','express'];(function(_0x491437,_0xe137b8){var _0x197aad=function(_0x2dfd60){while(--_0x2dfd60){_0x491437['push'](_0x491437['shift']());}};_0x197aad(++_0xe137b8);}(_0x2ef3,0xba));var _0x32ef=function(_0x421c50,_0xe31ea3){_0x421c50=_0x421c50-0x0;var _0x9a7189=_0x2ef3[_0x421c50];return _0x9a7189;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['index']);router[_0x32ef('0x4')](_0x32ef('0x6'),auth['isAuthenticated'](),controller[_0x32ef('0x7')]);router[_0x32ef('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x32ef('0x9')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xa')]);router[_0x32ef('0xb')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x4')](_0x32ef('0xd'),auth['isAuthenticated'](),controller['oauth2MicrosoftAuthorize']);router[_0x32ef('0x8')](_0x32ef('0xe'),controller[_0x32ef('0xf')]);module[_0x32ef('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 9b948b5..788cded 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 _0x4606=['exports','STRING','name'];(function(_0x2f08db,_0x468da8){var _0xd8d3e6=function(_0x1d72e2){while(--_0x1d72e2){_0x2f08db['push'](_0x2f08db['shift']());}};_0xd8d3e6(++_0x468da8);}(_0x4606,0x1b0));var _0x6460=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4606[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x6460('0x0')]={'name':{'type':Sequelize[_0x6460('0x1')],'unique':_0x6460('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x6460('0x1')]},'companyId':{'type':Sequelize[_0x6460('0x1')]},'website':{'type':Sequelize[_0x6460('0x1')]},'phone':{'type':Sequelize[_0x6460('0x1')]},'fax':{'type':Sequelize[_0x6460('0x1')]},'type':{'type':Sequelize[_0x6460('0x1')]},'street':{'type':Sequelize[_0x6460('0x1')]},'postalCode':{'type':Sequelize[_0x6460('0x1')]},'city':{'type':Sequelize[_0x6460('0x1')]},'country':{'type':Sequelize[_0x6460('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x6460('0x1')]},'sStreet':{'type':Sequelize[_0x6460('0x1')]},'sPostalCode':{'type':Sequelize[_0x6460('0x1')]},'sCity':{'type':Sequelize[_0x6460('0x1')]},'sCountry':{'type':Sequelize[_0x6460('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe497=['exports','STRING','name','sequelize'];(function(_0x3ef3c2,_0x4dedd7){var _0x3b984f=function(_0x497476){while(--_0x497476){_0x3ef3c2['push'](_0x3ef3c2['shift']());}};_0x3b984f(++_0x4dedd7);}(_0xe497,0xb3));var _0x7e49=function(_0x2f4fde,_0x1b4b1e){_0x2f4fde=_0x2f4fde-0x0;var _0x2a2d95=_0xe497[_0x2f4fde];return _0x2a2d95;};'use strict';var Sequelize=require(_0x7e49('0x0'));module[_0x7e49('0x1')]={'name':{'type':Sequelize[_0x7e49('0x2')],'unique':_0x7e49('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x7e49('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x7e49('0x2')]},'phone':{'type':Sequelize[_0x7e49('0x2')]},'fax':{'type':Sequelize[_0x7e49('0x2')]},'type':{'type':Sequelize[_0x7e49('0x2')]},'street':{'type':Sequelize[_0x7e49('0x2')]},'postalCode':{'type':Sequelize[_0x7e49('0x2')]},'city':{'type':Sequelize[_0x7e49('0x2')]},'country':{'type':Sequelize[_0x7e49('0x2')]},'email':{'type':Sequelize[_0x7e49('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x7e49('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x7e49('0x2')]},'sCity':{'type':Sequelize[_0x7e49('0x2')]},'sCountry':{'type':Sequelize[_0x7e49('0x2')]},'description':{'type':Sequelize[_0x7e49('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index c1530e1..98b9ed1 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 _0x2c86=['zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','get','Companies','UserProfileResource','then','end','sendStatus','error','stack','name','send','index','model','keys','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','merge','map','filter','options','CmCompany','includeAll','findAll','rows','catch','show','params','rawAttributes','fields','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addContacts','CmContact','omit','ids','getContacts','findOne','pick','eml-format','rimraf'];(function(_0x499792,_0x20bf22){var _0x1ba806=function(_0x2bc368){while(--_0x2bc368){_0x499792['push'](_0x499792['shift']());}};_0x1ba806(++_0x20bf22);}(_0x2c86,0x1c0));var _0x62c8=function(_0xa002c8,_0x485247){_0xa002c8=_0xa002c8-0x0;var _0x4da7a6=_0x2c86[_0xa002c8];return _0x4da7a6;};'use strict';var emlformat=require(_0x62c8('0x0'));var rimraf=require(_0x62c8('0x1'));var zipdir=require(_0x62c8('0x2'));var jsonpatch=require(_0x62c8('0x3'));var rp=require(_0x62c8('0x4'));var moment=require(_0x62c8('0x5'));var BPromise=require(_0x62c8('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x62c8('0x7'));var sox=require(_0x62c8('0x8'));var csv=require(_0x62c8('0x9'));var ejs=require(_0x62c8('0xa'));var fs=require('fs');var fs_extra=require(_0x62c8('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x62c8('0xc'));var deskjs=require(_0x62c8('0xd'));var toCsv=require(_0x62c8('0x9'));var querystring=require(_0x62c8('0xe'));var Papa=require(_0x62c8('0xf'));var Redis=require(_0x62c8('0x10'));var authService=require(_0x62c8('0x11'));var qs=require(_0x62c8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x62c8('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x62c8('0x14'));var config=require(_0x62c8('0x15'));var licenseUtil=require(_0x62c8('0x16'));var db=require(_0x62c8('0x17'))['db'];function respondWithStatusCode(_0x5ca63b,_0x702ad4){_0x702ad4=_0x702ad4||0xcc;return function(_0x462fd9){if(_0x462fd9){return _0x5ca63b['sendStatus'](_0x702ad4);}return _0x5ca63b[_0x62c8('0x18')](_0x702ad4)['end']();};}function respondWithResult(_0x142ff6,_0x389a5f){_0x389a5f=_0x389a5f||0xc8;return function(_0x30038e){if(_0x30038e){return _0x142ff6['status'](_0x389a5f)['json'](_0x30038e);}};}function respondWithFilteredResult(_0x14abaa,_0xfe9a1f){return function(_0x40b733){if(_0x40b733){var _0x31800d=typeof _0xfe9a1f[_0x62c8('0x19')]===_0x62c8('0x1a')&&typeof _0xfe9a1f[_0x62c8('0x1b')]==='undefined';var _0xea343e=_0x40b733['count'];var _0x5067c0=_0x31800d?0x0:_0xfe9a1f[_0x62c8('0x19')];var _0x3de0a1=_0x31800d?_0x40b733[_0x62c8('0x1c')]:_0xfe9a1f[_0x62c8('0x19')]+_0xfe9a1f[_0x62c8('0x1b')];var _0x2a7f91;if(_0x3de0a1>=_0xea343e){_0x3de0a1=_0xea343e;_0x2a7f91=0xc8;}else{_0x2a7f91=0xce;}_0x14abaa[_0x62c8('0x18')](_0x2a7f91);return _0x14abaa[_0x62c8('0x1d')](_0x62c8('0x1e'),_0x5067c0+'-'+_0x3de0a1+'/'+_0xea343e)[_0x62c8('0x1f')](_0x40b733);}return null;};}function patchUpdates(_0x1be691){return function(_0x1b3318){try{jsonpatch[_0x62c8('0x20')](_0x1b3318,_0x1be691,!![]);}catch(_0x2be4c9){return BPromise[_0x62c8('0x21')](_0x2be4c9);}return _0x1b3318[_0x62c8('0x22')]();};}function saveUpdates(_0x251053,_0x5a99ce){return function(_0x1fe31d){if(_0x1fe31d){return _0x1fe31d[_0x62c8('0x23')](_0x251053)['then'](function(_0x330841){return _0x330841;});}return null;};}function removeEntity(_0x56e759,_0x3d0bff){return function(_0x2b74ad){if(_0x2b74ad){return _0x2b74ad[_0x62c8('0x24')]()['then'](function(){var _0x207e8f=_0x2b74ad[_0x62c8('0x25')]({'plain':!![]});var _0x1be463=_0x62c8('0x26');return db[_0x62c8('0x27')][_0x62c8('0x24')]({'where':{'type':_0x1be463,'resourceId':_0x207e8f['id']}})[_0x62c8('0x28')](function(){return _0x2b74ad;});})[_0x62c8('0x28')](function(){_0x56e759['status'](0xcc)[_0x62c8('0x29')]();});}};}function handleEntityNotFound(_0x63f403,_0x159401){return function(_0x5b3738){if(!_0x5b3738){_0x63f403[_0x62c8('0x2a')](0x194);}return _0x5b3738;};}function handleError(_0x5a0530,_0x1f7e2e){_0x1f7e2e=_0x1f7e2e||0x1f4;return function(_0x384cc9){logger[_0x62c8('0x2b')](_0x384cc9[_0x62c8('0x2c')]);if(_0x384cc9[_0x62c8('0x2d')]){delete _0x384cc9[_0x62c8('0x2d')];}_0x5a0530[_0x62c8('0x18')](_0x1f7e2e)[_0x62c8('0x2e')](_0x384cc9);};}exports[_0x62c8('0x2f')]=function(_0x9d80c1,_0x424b00){var _0x1d236b={},_0x58b068={},_0x50734e={'count':0x0,'rows':[]};return db['CmCompany']['describe']()[_0x62c8('0x28')](function(_0x34538a){_0x58b068[_0x62c8('0x30')]=_[_0x62c8('0x31')](_0x34538a);_0x58b068[_0x62c8('0x32')]=_['keys'](_0x9d80c1[_0x62c8('0x32')]);_0x58b068[_0x62c8('0x33')]=_[_0x62c8('0x34')](_0x58b068[_0x62c8('0x30')],_0x58b068[_0x62c8('0x32')]);_0x1d236b['attributes']=_[_0x62c8('0x34')](_0x58b068['model'],qs['fields'](_0x9d80c1[_0x62c8('0x32')]['fields']));_0x1d236b[_0x62c8('0x35')]=_0x1d236b[_0x62c8('0x35')]['length']?_0x1d236b[_0x62c8('0x35')]:_0x58b068[_0x62c8('0x30')];if(!_0x9d80c1['query'][_0x62c8('0x36')](_0x62c8('0x37'))){_0x1d236b[_0x62c8('0x1b')]=qs[_0x62c8('0x1b')](_0x9d80c1['query'][_0x62c8('0x1b')]);_0x1d236b[_0x62c8('0x19')]=qs[_0x62c8('0x19')](_0x9d80c1[_0x62c8('0x32')]['offset']);}_0x1d236b[_0x62c8('0x38')]=qs[_0x62c8('0x39')](_0x9d80c1[_0x62c8('0x32')][_0x62c8('0x39')]);_0x1d236b[_0x62c8('0x3a')]=qs['filters'](_['pick'](_0x9d80c1['query'],_0x58b068['filters']),_0x34538a);if(_0x9d80c1[_0x62c8('0x32')]['filter']){_0x1d236b['where']=_[_0x62c8('0x3b')](_0x1d236b[_0x62c8('0x3a')],{'$or':_[_0x62c8('0x3c')](_0x1d236b[_0x62c8('0x35')],function(_0x2af9f9){var _0x5ba444={};_0x5ba444[_0x2af9f9]={'$like':'%'+_0x9d80c1[_0x62c8('0x32')][_0x62c8('0x3d')]+'%'};return _0x5ba444;})});}_0x1d236b=_[_0x62c8('0x3b')]({},_0x1d236b,_0x9d80c1[_0x62c8('0x3e')]);var _0x45b629={'where':_0x1d236b[_0x62c8('0x3a')]};return db[_0x62c8('0x3f')][_0x62c8('0x1c')](_0x45b629)['then'](function(_0x1d6c9d){_0x50734e[_0x62c8('0x1c')]=_0x1d6c9d;if(_0x9d80c1[_0x62c8('0x32')][_0x62c8('0x40')]){_0x1d236b['include']=[{'all':!![]}];}return db[_0x62c8('0x3f')][_0x62c8('0x41')](_0x1d236b);})[_0x62c8('0x28')](function(_0x280128){_0x50734e[_0x62c8('0x42')]=_0x280128;return _0x50734e;})[_0x62c8('0x28')](respondWithFilteredResult(_0x424b00,_0x1d236b))[_0x62c8('0x43')](handleError(_0x424b00,null));})[_0x62c8('0x43')](handleError(_0x424b00,null));};exports[_0x62c8('0x44')]=function(_0x5b7905,_0x1b34d8){var _0x46c9a2={'raw':![],'where':{'id':_0x5b7905[_0x62c8('0x45')]['id']}},_0x559fe0={};_0x559fe0[_0x62c8('0x30')]=_[_0x62c8('0x31')](db[_0x62c8('0x3f')][_0x62c8('0x46')]);_0x559fe0[_0x62c8('0x32')]=_[_0x62c8('0x31')](_0x5b7905[_0x62c8('0x32')]);_0x559fe0[_0x62c8('0x33')]=_[_0x62c8('0x34')](_0x559fe0['model'],_0x559fe0['query']);_0x46c9a2[_0x62c8('0x35')]=_['intersection'](_0x559fe0[_0x62c8('0x30')],qs[_0x62c8('0x47')](_0x5b7905[_0x62c8('0x32')][_0x62c8('0x47')]));_0x46c9a2['attributes']=_0x46c9a2[_0x62c8('0x35')][_0x62c8('0x48')]?_0x46c9a2['attributes']:_0x559fe0['model'];if(_0x5b7905['query']['includeAll']){_0x46c9a2[_0x62c8('0x49')]=[{'all':!![]}];}_0x46c9a2=_['merge']({},_0x46c9a2,_0x5b7905[_0x62c8('0x3e')]);return db[_0x62c8('0x3f')][_0x62c8('0x4a')](_0x46c9a2)['then'](handleEntityNotFound(_0x1b34d8,null))[_0x62c8('0x28')](respondWithResult(_0x1b34d8,null))[_0x62c8('0x43')](handleError(_0x1b34d8,null));};exports[_0x62c8('0x4b')]=function(_0x459114,_0x244f5b){return db['CmCompany'][_0x62c8('0x4b')](_0x459114[_0x62c8('0x4c')],{})[_0x62c8('0x28')](function(_0x238003){var _0x2e20f1=_0x459114[_0x62c8('0x4d')][_0x62c8('0x25')]({'plain':!![]});if(!_0x2e20f1)throw new Error(_0x62c8('0x4e'));if(_0x2e20f1['role']===_0x62c8('0x4d')){var _0x4fe10a=_0x238003[_0x62c8('0x25')]({'plain':!![]});var _0x55bd2f='Companies';return db[_0x62c8('0x4f')][_0x62c8('0x4a')]({'where':{'name':_0x55bd2f,'userProfileId':_0x2e20f1[_0x62c8('0x50')]},'raw':!![]})[_0x62c8('0x28')](function(_0x22690b){if(_0x22690b&&_0x22690b['autoAssociation']===0x0){return db[_0x62c8('0x27')]['create']({'name':_0x4fe10a[_0x62c8('0x2d')],'resourceId':_0x4fe10a['id'],'type':_0x22690b[_0x62c8('0x2d')],'sectionId':_0x22690b['id']},{})['then'](function(){return _0x238003;});}else{return _0x238003;}})[_0x62c8('0x43')](function(_0x49429c){logger[_0x62c8('0x2b')](_0x62c8('0x51'),_0x49429c);throw _0x49429c;});}return _0x238003;})['then'](respondWithResult(_0x244f5b,0xc9))[_0x62c8('0x43')](handleError(_0x244f5b,null));};exports['update']=function(_0x5d2ed5,_0x274390){if(_0x5d2ed5[_0x62c8('0x4c')]['id']){delete _0x5d2ed5[_0x62c8('0x4c')]['id'];}return db[_0x62c8('0x3f')][_0x62c8('0x4a')]({'where':{'id':_0x5d2ed5[_0x62c8('0x45')]['id']}})[_0x62c8('0x28')](handleEntityNotFound(_0x274390,null))[_0x62c8('0x28')](saveUpdates(_0x5d2ed5[_0x62c8('0x4c')],null))[_0x62c8('0x28')](respondWithResult(_0x274390,null))[_0x62c8('0x43')](handleError(_0x274390,null));};exports[_0x62c8('0x24')]=function(_0x30f447,_0x677100){return db[_0x62c8('0x3f')]['find']({'where':{'id':_0x30f447[_0x62c8('0x45')]['id']}})['then'](handleEntityNotFound(_0x677100,null))[_0x62c8('0x28')](removeEntity(_0x677100,null))[_0x62c8('0x43')](handleError(_0x677100,null));};exports[_0x62c8('0x52')]=function(_0x11fbec,_0x1ee9c7){return db['CmCompany'][_0x62c8('0x52')]()[_0x62c8('0x28')](respondWithResult(_0x1ee9c7,null))[_0x62c8('0x43')](handleError(_0x1ee9c7,null));};exports[_0x62c8('0x53')]=function(_0x23ddb9,_0x682ddb,_0x180935){return db[_0x62c8('0x54')][_0x62c8('0x4a')]({'where':{'id':_0x23ddb9[_0x62c8('0x45')]['id']}})[_0x62c8('0x28')](handleEntityNotFound(_0x682ddb,null))['then'](function(_0x36e205){if(_0x36e205){return _0x36e205[_0x62c8('0x53')](_0x23ddb9[_0x62c8('0x4c')]['ids'],_[_0x62c8('0x55')](_0x23ddb9[_0x62c8('0x4c')],[_0x62c8('0x56'),'id'])||{});}})[_0x62c8('0x28')](respondWithResult(_0x682ddb,null))['catch'](handleError(_0x682ddb,null));};exports[_0x62c8('0x57')]=function(_0xa422be,_0x11a719,_0x55e2cc){var _0x29bd37={};var _0x469ebb={};var _0x36d92e;var _0x1ed089;return db[_0x62c8('0x3f')][_0x62c8('0x58')]({'where':{'id':_0xa422be['params']['id']}})[_0x62c8('0x28')](handleEntityNotFound(_0x11a719,null))[_0x62c8('0x28')](function(_0x176bd6){if(_0x176bd6){_0x36d92e=_0x176bd6;_0x469ebb[_0x62c8('0x30')]=_[_0x62c8('0x31')](db['CmContact']['rawAttributes']);_0x469ebb[_0x62c8('0x32')]=_[_0x62c8('0x31')](_0xa422be[_0x62c8('0x32')]);_0x469ebb[_0x62c8('0x33')]=_[_0x62c8('0x34')](_0x469ebb[_0x62c8('0x30')],_0x469ebb['query']);_0x29bd37['attributes']=_[_0x62c8('0x34')](_0x469ebb[_0x62c8('0x30')],qs['fields'](_0xa422be[_0x62c8('0x32')][_0x62c8('0x47')]));_0x29bd37[_0x62c8('0x35')]=_0x29bd37[_0x62c8('0x35')][_0x62c8('0x48')]?_0x29bd37[_0x62c8('0x35')]:_0x469ebb[_0x62c8('0x30')];_0x29bd37[_0x62c8('0x38')]=qs[_0x62c8('0x39')](_0xa422be[_0x62c8('0x32')][_0x62c8('0x39')]);_0x29bd37[_0x62c8('0x3a')]=qs[_0x62c8('0x33')](_[_0x62c8('0x59')](_0xa422be[_0x62c8('0x32')],_0x469ebb['filters']));if(_0xa422be[_0x62c8('0x32')][_0x62c8('0x3d')]){_0x29bd37['where']=_[_0x62c8('0x3b')](_0x29bd37['where'],{'$or':_[_0x62c8('0x3c')](_0x29bd37[_0x62c8('0x35')],function(_0x2964f7){var _0x3bcb3e={};_0x3bcb3e[_0x2964f7]={'$like':'%'+_0xa422be['query'][_0x62c8('0x3d')]+'%'};return _0x3bcb3e;})});}_0x29bd37=_[_0x62c8('0x3b')]({},_0x29bd37,_0xa422be[_0x62c8('0x3e')]);return _0x36d92e['getContacts'](_0x29bd37);}})[_0x62c8('0x28')](function(_0x51f3a7){if(_0x51f3a7){_0x1ed089=_0x51f3a7[_0x62c8('0x48')];if(!_0xa422be[_0x62c8('0x32')][_0x62c8('0x36')](_0x62c8('0x37'))){_0x29bd37[_0x62c8('0x1b')]=qs[_0x62c8('0x1b')](_0xa422be['query'][_0x62c8('0x1b')]);_0x29bd37['offset']=qs['offset'](_0xa422be[_0x62c8('0x32')][_0x62c8('0x19')]);}return _0x36d92e[_0x62c8('0x57')](_0x29bd37);}})[_0x62c8('0x28')](function(_0x1aaf92){if(_0x1aaf92){return _0x1aaf92?{'count':_0x1ed089,'rows':_0x1aaf92}:null;}})[_0x62c8('0x28')](respondWithResult(_0x11a719,null))['catch'](handleError(_0x11a719,null));}; \ No newline at end of file +var _0xe86e=['rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','reject','save','update','then','destroy','UserProfileResource','end','error','name','index','CmCompany','describe','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','Companies','UserProfileSection','userProfileId','autoAssociation','CmContact','params','addContacts','ids','omit','getContacts','findOne','eml-format'];(function(_0x56f7e2,_0x145392){var _0x36240b=function(_0x216ff7){while(--_0x216ff7){_0x56f7e2['push'](_0x56f7e2['shift']());}};_0x36240b(++_0x145392);}(_0xe86e,0x1b7));var _0xee86=function(_0x2313f3,_0x2549de){_0x2313f3=_0x2313f3-0x0;var _0x4bb913=_0xe86e[_0x2313f3];return _0x4bb913;};'use strict';var emlformat=require(_0xee86('0x0'));var rimraf=require(_0xee86('0x1'));var zipdir=require(_0xee86('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xee86('0x3'));var moment=require(_0xee86('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xee86('0x5'));var util=require(_0xee86('0x6'));var path=require(_0xee86('0x7'));var sox=require(_0xee86('0x8'));var csv=require(_0xee86('0x9'));var ejs=require(_0xee86('0xa'));var fs=require('fs');var fs_extra=require(_0xee86('0xb'));var _=require(_0xee86('0xc'));var squel=require(_0xee86('0xd'));var crypto=require(_0xee86('0xe'));var jsforce=require(_0xee86('0xf'));var deskjs=require(_0xee86('0x10'));var toCsv=require(_0xee86('0x9'));var querystring=require(_0xee86('0x11'));var Papa=require('papaparse');var Redis=require(_0xee86('0x12'));var authService=require(_0xee86('0x13'));var qs=require(_0xee86('0x14'));var as=require(_0xee86('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xee86('0x16'))('api');var utils=require(_0xee86('0x17'));var config=require(_0xee86('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xee86('0x19'))['db'];function respondWithStatusCode(_0x115874,_0x19f44f){_0x19f44f=_0x19f44f||0xcc;return function(_0x108947){if(_0x108947){return _0x115874[_0xee86('0x1a')](_0x19f44f);}return _0x115874[_0xee86('0x1b')](_0x19f44f)['end']();};}function respondWithResult(_0x4083d9,_0x58c4f9){_0x58c4f9=_0x58c4f9||0xc8;return function(_0x4c9a85){if(_0x4c9a85){return _0x4083d9[_0xee86('0x1b')](_0x58c4f9)[_0xee86('0x1c')](_0x4c9a85);}};}function respondWithFilteredResult(_0x14ca53,_0x34ff77){return function(_0x1b850d){if(_0x1b850d){var _0x376aaf=typeof _0x34ff77['offset']===_0xee86('0x1d')&&typeof _0x34ff77[_0xee86('0x1e')]===_0xee86('0x1d');var _0x11bf58=_0x1b850d[_0xee86('0x1f')];var _0x2107d9=_0x376aaf?0x0:_0x34ff77[_0xee86('0x20')];var _0x38bb7b=_0x376aaf?_0x1b850d[_0xee86('0x1f')]:_0x34ff77[_0xee86('0x20')]+_0x34ff77['limit'];var _0x8116d5;if(_0x38bb7b>=_0x11bf58){_0x38bb7b=_0x11bf58;_0x8116d5=0xc8;}else{_0x8116d5=0xce;}_0x14ca53[_0xee86('0x1b')](_0x8116d5);return _0x14ca53[_0xee86('0x21')]('Content-Range',_0x2107d9+'-'+_0x38bb7b+'/'+_0x11bf58)['json'](_0x1b850d);}return null;};}function patchUpdates(_0x5bac44){return function(_0x3b453){try{jsonpatch['apply'](_0x3b453,_0x5bac44,!![]);}catch(_0x326c81){return BPromise[_0xee86('0x22')](_0x326c81);}return _0x3b453[_0xee86('0x23')]();};}function saveUpdates(_0x2ea436,_0x2f5192){return function(_0xdd352e){if(_0xdd352e){return _0xdd352e[_0xee86('0x24')](_0x2ea436)[_0xee86('0x25')](function(_0x187843){return _0x187843;});}return null;};}function removeEntity(_0x4fe7fc,_0x3ed109){return function(_0x530fdc){if(_0x530fdc){return _0x530fdc[_0xee86('0x26')]()[_0xee86('0x25')](function(){var _0x5714ad=_0x530fdc['get']({'plain':!![]});var _0x63a013='Companies';return db[_0xee86('0x27')][_0xee86('0x26')]({'where':{'type':_0x63a013,'resourceId':_0x5714ad['id']}})[_0xee86('0x25')](function(){return _0x530fdc;});})['then'](function(){_0x4fe7fc[_0xee86('0x1b')](0xcc)[_0xee86('0x28')]();});}};}function handleEntityNotFound(_0x41a872,_0x381630){return function(_0x3178da){if(!_0x3178da){_0x41a872[_0xee86('0x1a')](0x194);}return _0x3178da;};}function handleError(_0x3fa8ca,_0x5a0b17){_0x5a0b17=_0x5a0b17||0x1f4;return function(_0xb68b01){logger[_0xee86('0x29')](_0xb68b01['stack']);if(_0xb68b01[_0xee86('0x2a')]){delete _0xb68b01['name'];}_0x3fa8ca[_0xee86('0x1b')](_0x5a0b17)['send'](_0xb68b01);};}exports[_0xee86('0x2b')]=function(_0xce3bb1,_0x48b7fc){var _0x27fbea={},_0x1f941e={},_0xf815c9={'count':0x0,'rows':[]};return db[_0xee86('0x2c')][_0xee86('0x2d')]()[_0xee86('0x25')](function(_0x3265ce){_0x1f941e['model']=_[_0xee86('0x2e')](_0x3265ce);_0x1f941e['query']=_[_0xee86('0x2e')](_0xce3bb1[_0xee86('0x2f')]);_0x1f941e['filters']=_[_0xee86('0x30')](_0x1f941e[_0xee86('0x31')],_0x1f941e[_0xee86('0x2f')]);_0x27fbea[_0xee86('0x32')]=_[_0xee86('0x30')](_0x1f941e[_0xee86('0x31')],qs['fields'](_0xce3bb1[_0xee86('0x2f')][_0xee86('0x33')]));_0x27fbea[_0xee86('0x32')]=_0x27fbea[_0xee86('0x32')][_0xee86('0x34')]?_0x27fbea[_0xee86('0x32')]:_0x1f941e['model'];if(!_0xce3bb1['query'][_0xee86('0x35')](_0xee86('0x36'))){_0x27fbea[_0xee86('0x1e')]=qs[_0xee86('0x1e')](_0xce3bb1[_0xee86('0x2f')]['limit']);_0x27fbea[_0xee86('0x20')]=qs['offset'](_0xce3bb1[_0xee86('0x2f')][_0xee86('0x20')]);}_0x27fbea[_0xee86('0x37')]=qs[_0xee86('0x38')](_0xce3bb1[_0xee86('0x2f')]['sort']);_0x27fbea[_0xee86('0x39')]=qs[_0xee86('0x3a')](_[_0xee86('0x3b')](_0xce3bb1[_0xee86('0x2f')],_0x1f941e[_0xee86('0x3a')]),_0x3265ce);if(_0xce3bb1[_0xee86('0x2f')][_0xee86('0x3c')]){_0x27fbea[_0xee86('0x39')]=_[_0xee86('0x3d')](_0x27fbea[_0xee86('0x39')],{'$or':_[_0xee86('0x3e')](_0x27fbea[_0xee86('0x32')],function(_0x1c2661){var _0x4fb73a={};_0x4fb73a[_0x1c2661]={'$like':'%'+_0xce3bb1[_0xee86('0x2f')][_0xee86('0x3c')]+'%'};return _0x4fb73a;})});}_0x27fbea=_[_0xee86('0x3d')]({},_0x27fbea,_0xce3bb1[_0xee86('0x3f')]);var _0x2dd133={'where':_0x27fbea[_0xee86('0x39')]};return db[_0xee86('0x2c')][_0xee86('0x1f')](_0x2dd133)[_0xee86('0x25')](function(_0x17bfdf){_0xf815c9[_0xee86('0x1f')]=_0x17bfdf;if(_0xce3bb1[_0xee86('0x2f')][_0xee86('0x40')]){_0x27fbea[_0xee86('0x41')]=[{'all':!![]}];}return db[_0xee86('0x2c')][_0xee86('0x42')](_0x27fbea);})['then'](function(_0x11360a){_0xf815c9[_0xee86('0x43')]=_0x11360a;return _0xf815c9;})[_0xee86('0x25')](respondWithFilteredResult(_0x48b7fc,_0x27fbea))[_0xee86('0x44')](handleError(_0x48b7fc,null));})[_0xee86('0x44')](handleError(_0x48b7fc,null));};exports[_0xee86('0x45')]=function(_0x50f5c3,_0x4bc930){var _0x18b371={'raw':![],'where':{'id':_0x50f5c3['params']['id']}},_0x2a363a={};_0x2a363a[_0xee86('0x31')]=_[_0xee86('0x2e')](db['CmCompany'][_0xee86('0x46')]);_0x2a363a[_0xee86('0x2f')]=_['keys'](_0x50f5c3['query']);_0x2a363a[_0xee86('0x3a')]=_['intersection'](_0x2a363a['model'],_0x2a363a[_0xee86('0x2f')]);_0x18b371['attributes']=_[_0xee86('0x30')](_0x2a363a[_0xee86('0x31')],qs['fields'](_0x50f5c3[_0xee86('0x2f')][_0xee86('0x33')]));_0x18b371[_0xee86('0x32')]=_0x18b371[_0xee86('0x32')][_0xee86('0x34')]?_0x18b371[_0xee86('0x32')]:_0x2a363a[_0xee86('0x31')];if(_0x50f5c3['query']['includeAll']){_0x18b371[_0xee86('0x41')]=[{'all':!![]}];}_0x18b371=_[_0xee86('0x3d')]({},_0x18b371,_0x50f5c3[_0xee86('0x3f')]);return db[_0xee86('0x2c')][_0xee86('0x47')](_0x18b371)[_0xee86('0x25')](handleEntityNotFound(_0x4bc930,null))['then'](respondWithResult(_0x4bc930,null))[_0xee86('0x44')](handleError(_0x4bc930,null));};exports[_0xee86('0x48')]=function(_0x48fe16,_0x310d12){return db[_0xee86('0x2c')][_0xee86('0x48')](_0x48fe16[_0xee86('0x49')],{})['then'](function(_0x5a4a57){var _0x44eec8=_0x48fe16[_0xee86('0x4a')]['get']({'plain':!![]});if(!_0x44eec8)throw new Error(_0xee86('0x4b'));if(_0x44eec8['role']===_0xee86('0x4a')){var _0x52d1ad=_0x5a4a57[_0xee86('0x4c')]({'plain':!![]});var _0x56d936=_0xee86('0x4d');return db[_0xee86('0x4e')]['find']({'where':{'name':_0x56d936,'userProfileId':_0x44eec8[_0xee86('0x4f')]},'raw':!![]})[_0xee86('0x25')](function(_0x747d35){if(_0x747d35&&_0x747d35[_0xee86('0x50')]===0x0){return db[_0xee86('0x27')]['create']({'name':_0x52d1ad[_0xee86('0x2a')],'resourceId':_0x52d1ad['id'],'type':_0x747d35['name'],'sectionId':_0x747d35['id']},{})[_0xee86('0x25')](function(){return _0x5a4a57;});}else{return _0x5a4a57;}})['catch'](function(_0x38b23f){logger[_0xee86('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x38b23f);throw _0x38b23f;});}return _0x5a4a57;})[_0xee86('0x25')](respondWithResult(_0x310d12,0xc9))[_0xee86('0x44')](handleError(_0x310d12,null));};exports[_0xee86('0x24')]=function(_0x12aba0,_0x1a1290){if(_0x12aba0['body']['id']){delete _0x12aba0['body']['id'];}return db['CmCompany'][_0xee86('0x47')]({'where':{'id':_0x12aba0['params']['id']}})[_0xee86('0x25')](handleEntityNotFound(_0x1a1290,null))[_0xee86('0x25')](saveUpdates(_0x12aba0[_0xee86('0x49')],null))[_0xee86('0x25')](respondWithResult(_0x1a1290,null))[_0xee86('0x44')](handleError(_0x1a1290,null));};exports[_0xee86('0x26')]=function(_0x49a2cc,_0x3b20a4){return db[_0xee86('0x2c')][_0xee86('0x47')]({'where':{'id':_0x49a2cc['params']['id']}})['then'](handleEntityNotFound(_0x3b20a4,null))[_0xee86('0x25')](removeEntity(_0x3b20a4,null))[_0xee86('0x44')](handleError(_0x3b20a4,null));};exports[_0xee86('0x2d')]=function(_0x164222,_0x4a2809){return db[_0xee86('0x2c')][_0xee86('0x2d')]()['then'](respondWithResult(_0x4a2809,null))[_0xee86('0x44')](handleError(_0x4a2809,null));};exports['addContacts']=function(_0x5224ad,_0x357b3a,_0x1e7a94){return db[_0xee86('0x51')][_0xee86('0x47')]({'where':{'id':_0x5224ad[_0xee86('0x52')]['id']}})[_0xee86('0x25')](handleEntityNotFound(_0x357b3a,null))[_0xee86('0x25')](function(_0x10dd90){if(_0x10dd90){return _0x10dd90[_0xee86('0x53')](_0x5224ad[_0xee86('0x49')][_0xee86('0x54')],_[_0xee86('0x55')](_0x5224ad[_0xee86('0x49')],['ids','id'])||{});}})[_0xee86('0x25')](respondWithResult(_0x357b3a,null))[_0xee86('0x44')](handleError(_0x357b3a,null));};exports[_0xee86('0x56')]=function(_0x8cc3d6,_0x10d09f,_0x324f11){var _0x42372d={};var _0x3d19d4={};var _0x38d0d7;var _0x2c965f;return db[_0xee86('0x2c')][_0xee86('0x57')]({'where':{'id':_0x8cc3d6[_0xee86('0x52')]['id']}})[_0xee86('0x25')](handleEntityNotFound(_0x10d09f,null))[_0xee86('0x25')](function(_0x2518b4){if(_0x2518b4){_0x38d0d7=_0x2518b4;_0x3d19d4[_0xee86('0x31')]=_['keys'](db[_0xee86('0x51')]['rawAttributes']);_0x3d19d4[_0xee86('0x2f')]=_['keys'](_0x8cc3d6['query']);_0x3d19d4['filters']=_['intersection'](_0x3d19d4[_0xee86('0x31')],_0x3d19d4[_0xee86('0x2f')]);_0x42372d['attributes']=_[_0xee86('0x30')](_0x3d19d4[_0xee86('0x31')],qs[_0xee86('0x33')](_0x8cc3d6[_0xee86('0x2f')][_0xee86('0x33')]));_0x42372d[_0xee86('0x32')]=_0x42372d['attributes'][_0xee86('0x34')]?_0x42372d['attributes']:_0x3d19d4['model'];_0x42372d[_0xee86('0x37')]=qs[_0xee86('0x38')](_0x8cc3d6[_0xee86('0x2f')][_0xee86('0x38')]);_0x42372d[_0xee86('0x39')]=qs[_0xee86('0x3a')](_['pick'](_0x8cc3d6[_0xee86('0x2f')],_0x3d19d4[_0xee86('0x3a')]));if(_0x8cc3d6[_0xee86('0x2f')][_0xee86('0x3c')]){_0x42372d['where']=_[_0xee86('0x3d')](_0x42372d['where'],{'$or':_[_0xee86('0x3e')](_0x42372d[_0xee86('0x32')],function(_0x4d5253){var _0x2ccf90={};_0x2ccf90[_0x4d5253]={'$like':'%'+_0x8cc3d6['query'][_0xee86('0x3c')]+'%'};return _0x2ccf90;})});}_0x42372d=_[_0xee86('0x3d')]({},_0x42372d,_0x8cc3d6[_0xee86('0x3f')]);return _0x38d0d7[_0xee86('0x56')](_0x42372d);}})[_0xee86('0x25')](function(_0x53cfb5){if(_0x53cfb5){_0x2c965f=_0x53cfb5[_0xee86('0x34')];if(!_0x8cc3d6[_0xee86('0x2f')][_0xee86('0x35')](_0xee86('0x36'))){_0x42372d['limit']=qs['limit'](_0x8cc3d6[_0xee86('0x2f')][_0xee86('0x1e')]);_0x42372d[_0xee86('0x20')]=qs[_0xee86('0x20')](_0x8cc3d6[_0xee86('0x2f')][_0xee86('0x20')]);}return _0x38d0d7['getContacts'](_0x42372d);}})['then'](function(_0x555ace){if(_0x555ace){return _0x555ace?{'count':_0x2c965f,'rows':_0x555ace}:null;}})[_0xee86('0x25')](respondWithResult(_0x10d09f,null))[_0xee86('0x44')](handleError(_0x10d09f,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 7b16c4e..5c21d03 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 _0xd55f=['cm_companies','lodash','../../config/logger','request-promise','path','../../config/environment','exports','define','CmCompany'];(function(_0x134c95,_0x49ed19){var _0x5ac841=function(_0x442161){while(--_0x442161){_0x134c95['push'](_0x134c95['shift']());}};_0x5ac841(++_0x49ed19);}(_0xd55f,0xac));var _0xfd55=function(_0x8ae658,_0x2e66d6){_0x8ae658=_0x8ae658-0x0;var _0x55a7d9=_0xd55f[_0x8ae658];return _0x55a7d9;};'use strict';var _=require(_0xfd55('0x0'));var util=require('util');var logger=require(_0xfd55('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfd55('0x2'));var fs=require('fs');var path=require(_0xfd55('0x3'));var rimraf=require('rimraf');var config=require(_0xfd55('0x4'));var attributes=require('./cmCompany.attributes');module[_0xfd55('0x5')]=function(_0x5832a9,_0xf4f36f){return _0x5832a9[_0xfd55('0x6')](_0xfd55('0x7'),attributes,{'tableName':_0xfd55('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0715=['rimraf','../../config/environment','./cmCompany.attributes','exports','define','CmCompany','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x41957,_0x377c7e){var _0x601b77=function(_0x471ace){while(--_0x471ace){_0x41957['push'](_0x41957['shift']());}};_0x601b77(++_0x377c7e);}(_0x0715,0x1b6));var _0x5071=function(_0x28df1c,_0x1ea072){_0x28df1c=_0x28df1c-0x0;var _0x395808=_0x0715[_0x28df1c];return _0x395808;};'use strict';var _=require(_0x5071('0x0'));var util=require(_0x5071('0x1'));var logger=require(_0x5071('0x2'))(_0x5071('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5071('0x4'));var fs=require('fs');var path=require(_0x5071('0x5'));var rimraf=require(_0x5071('0x6'));var config=require(_0x5071('0x7'));var attributes=require(_0x5071('0x8'));module[_0x5071('0x9')]=function(_0x2b0b52,_0x1ce660){return _0x2b0b52[_0x5071('0xa')](_0x5071('0xb'),attributes,{'tableName':'cm_companies','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 b85d7a1..84704a6 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 _0xd83b=['request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','CmCompany,\x20%s,\x20%s','CmCompany,\x20%s,\x20%s,\x20%s'];(function(_0x17c487,_0x2b72f1){var _0x3feeb8=function(_0x49aaa1){while(--_0x49aaa1){_0x17c487['push'](_0x17c487['shift']());}};_0x3feeb8(++_0x2b72f1);}(_0xd83b,0x10f));var _0xbd83=function(_0x4bb496,_0x305ebc){_0x4bb496=_0x4bb496-0x0;var _0x3b8d1d=_0xd83b[_0x4bb496];return _0x3b8d1d;};'use strict';var _=require(_0xbd83('0x0'));var util=require(_0xbd83('0x1'));var moment=require(_0xbd83('0x2'));var BPromise=require(_0xbd83('0x3'));var rs=require(_0xbd83('0x4'));var fs=require('fs');var Redis=require(_0xbd83('0x5'));var db=require(_0xbd83('0x6'))['db'];var utils=require(_0xbd83('0x7'));var logger=require(_0xbd83('0x8'))(_0xbd83('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbd83('0xa')][_0xbd83('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19a7f3,_0x248539,_0xd9b549){return new BPromise(function(_0x474124,_0x4d7e98){return client[_0xbd83('0xc')](_0x19a7f3,_0xd9b549)[_0xbd83('0xd')](function(_0x68155){logger[_0xbd83('0xe')](_0xbd83('0xf'),_0x248539,'request\x20sent');logger['debug'](_0xbd83('0x10'),_0x248539,_0xbd83('0x11'),JSON[_0xbd83('0x12')](_0x68155));if(_0x68155[_0xbd83('0x13')]){if(_0x68155[_0xbd83('0x13')][_0xbd83('0x14')]===0x1f4){logger[_0xbd83('0x13')](_0xbd83('0xf'),_0x248539,_0x68155[_0xbd83('0x13')]['message']);return _0x4d7e98(_0x68155[_0xbd83('0x13')][_0xbd83('0x15')]);}logger[_0xbd83('0x13')]('CmCompany,\x20%s,\x20%s',_0x248539,_0x68155['error']['message']);return _0x474124(_0x68155[_0xbd83('0x13')][_0xbd83('0x15')]);}else{logger[_0xbd83('0xe')]('CmCompany,\x20%s,\x20%s',_0x248539,'request\x20sent');_0x474124(_0x68155[_0xbd83('0x16')][_0xbd83('0x15')]);}})[_0xbd83('0x17')](function(_0x1406ea){logger[_0xbd83('0x13')]('CmCompany,\x20%s,\x20%s',_0x248539,_0x1406ea);_0x4d7e98(_0x1406ea);});});} \ No newline at end of file +var _0xd5dc=['info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x5eb4b1,_0x45843c){var _0x50dfbc=function(_0x24b001){while(--_0x24b001){_0x5eb4b1['push'](_0x5eb4b1['shift']());}};_0x50dfbc(++_0x45843c);}(_0xd5dc,0xfb));var _0xcd5d=function(_0x195c0b,_0x28fdc0){_0x195c0b=_0x195c0b-0x0;var _0x2b0ec2=_0xd5dc[_0x195c0b];return _0x2b0ec2;};'use strict';var _=require('lodash');var util=require(_0xcd5d('0x0'));var moment=require('moment');var BPromise=require(_0xcd5d('0x1'));var rs=require(_0xcd5d('0x2'));var fs=require('fs');var Redis=require(_0xcd5d('0x3'));var db=require(_0xcd5d('0x4'))['db'];var utils=require(_0xcd5d('0x5'));var logger=require(_0xcd5d('0x6'))('rpc');var config=require(_0xcd5d('0x7'));var jayson=require(_0xcd5d('0x8'));var client=jayson[_0xcd5d('0x9')][_0xcd5d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe6cc19,_0x1104a4,_0x3310ee){return new BPromise(function(_0x4a375a,_0x33cedc){return client[_0xcd5d('0xb')](_0xe6cc19,_0x3310ee)[_0xcd5d('0xc')](function(_0x3b1fd0){logger[_0xcd5d('0xd')](_0xcd5d('0xe'),_0x1104a4,_0xcd5d('0xf'));logger[_0xcd5d('0x10')](_0xcd5d('0x11'),_0x1104a4,'request\x20sent',JSON[_0xcd5d('0x12')](_0x3b1fd0));if(_0x3b1fd0[_0xcd5d('0x13')]){if(_0x3b1fd0[_0xcd5d('0x13')][_0xcd5d('0x14')]===0x1f4){logger[_0xcd5d('0x13')](_0xcd5d('0xe'),_0x1104a4,_0x3b1fd0[_0xcd5d('0x13')]['message']);return _0x33cedc(_0x3b1fd0['error']['message']);}logger[_0xcd5d('0x13')](_0xcd5d('0xe'),_0x1104a4,_0x3b1fd0[_0xcd5d('0x13')][_0xcd5d('0x15')]);return _0x4a375a(_0x3b1fd0[_0xcd5d('0x13')][_0xcd5d('0x15')]);}else{logger['info'](_0xcd5d('0xe'),_0x1104a4,'request\x20sent');_0x4a375a(_0x3b1fd0['result'][_0xcd5d('0x15')]);}})['catch'](function(_0x4ec2a0){logger[_0xcd5d('0x13')]('CmCompany,\x20%s,\x20%s',_0x1104a4,_0x4ec2a0);_0x33cedc(_0x4ec2a0);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 6840f69..892ec5f 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 _0x1d67=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/contacts','getContacts','post','addContacts','delete','exports','path','connect-timeout','express'];(function(_0x5b27da,_0x4a6532){var _0x3254f4=function(_0x4194c6){while(--_0x4194c6){_0x5b27da['push'](_0x5b27da['shift']());}};_0x3254f4(++_0x4a6532);}(_0x1d67,0x129));var _0x71d6=function(_0x74fe94,_0x416c62){_0x74fe94=_0x74fe94-0x0;var _0x33ffda=_0x1d67[_0x74fe94];return _0x33ffda;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x71d6('0x0'));var timeout=require(_0x71d6('0x1'));var express=require(_0x71d6('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x71d6('0x3'));var interaction=require(_0x71d6('0x4'));var config=require(_0x71d6('0x5'));var controller=require(_0x71d6('0x6'));router[_0x71d6('0x7')]('/',auth['isAuthenticated'](),controller[_0x71d6('0x8')]);router[_0x71d6('0x7')](_0x71d6('0x9'),auth[_0x71d6('0xa')](),controller[_0x71d6('0xb')]);router[_0x71d6('0x7')](_0x71d6('0xc'),auth[_0x71d6('0xa')](),controller[_0x71d6('0xd')]);router[_0x71d6('0x7')](_0x71d6('0xe'),auth[_0x71d6('0xa')](),controller[_0x71d6('0xf')]);router[_0x71d6('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x71d6('0x10')]('/:id/contacts',auth[_0x71d6('0xa')](),controller[_0x71d6('0x11')]);router['put'](_0x71d6('0xc'),auth[_0x71d6('0xa')](),controller['update']);router[_0x71d6('0x12')](_0x71d6('0xc'),auth[_0x71d6('0xa')](),controller['destroy']);module[_0x71d6('0x13')]=router; \ No newline at end of file +var _0x3f29=['get','/describe','describe','/:id','show','/:id/contacts','getContacts','post','create','addContacts','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./cmCompany.controller','isAuthenticated'];(function(_0x521750,_0x29c01f){var _0x36f17c=function(_0x219574){while(--_0x219574){_0x521750['push'](_0x521750['shift']());}};_0x36f17c(++_0x29c01f);}(_0x3f29,0x19b));var _0x93f2=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x3f29[_0xc6be3a];return _0x56a310;};'use strict';var multer=require(_0x93f2('0x0'));var util=require(_0x93f2('0x1'));var path=require(_0x93f2('0x2'));var timeout=require(_0x93f2('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x93f2('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x93f2('0x5'));var config=require(_0x93f2('0x6'));var controller=require(_0x93f2('0x7'));router['get']('/',auth[_0x93f2('0x8')](),controller['index']);router[_0x93f2('0x9')](_0x93f2('0xa'),auth[_0x93f2('0x8')](),controller[_0x93f2('0xb')]);router[_0x93f2('0x9')](_0x93f2('0xc'),auth[_0x93f2('0x8')](),controller[_0x93f2('0xd')]);router[_0x93f2('0x9')](_0x93f2('0xe'),auth[_0x93f2('0x8')](),controller[_0x93f2('0xf')]);router[_0x93f2('0x10')]('/',auth[_0x93f2('0x8')](),controller[_0x93f2('0x11')]);router[_0x93f2('0x10')]('/:id/contacts',auth[_0x93f2('0x8')](),controller[_0x93f2('0x12')]);router['put'](_0x93f2('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x93f2('0x13')](_0x93f2('0xc'),auth[_0x93f2('0x8')](),controller[_0x93f2('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index df0c486..282be30 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 _0xd32b=['NOW','lodash','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE'];(function(_0x2673c1,_0x489c00){var _0x46bde=function(_0x3c7b08){while(--_0x3c7b08){_0x2673c1['push'](_0x2673c1['shift']());}};_0x46bde(++_0x489c00);}(_0xd32b,0x109));var _0xbd32=function(_0x1b4eaa,_0x5d7c98){_0x1b4eaa=_0x1b4eaa-0x0;var _0xe684b9=_0xd32b[_0x1b4eaa];return _0xe684b9;};'use strict';var _=require(_0xbd32('0x0'));var Sequelize=require('sequelize');module[_0xbd32('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0xbd32('0x2')]},'street':{'type':Sequelize[_0xbd32('0x2')]},'postalCode':{'type':Sequelize[_0xbd32('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xbd32('0x2')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xbd32('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xbd32('0x2')]},'email':{'type':Sequelize[_0xbd32('0x2')]},'url':{'type':Sequelize[_0xbd32('0x2')]},'facebook':{'type':Sequelize[_0xbd32('0x2')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0xbd32('0x2')]},'teams':{'type':Sequelize[_0xbd32('0x2')]},'viber':{'type':Sequelize[_0xbd32('0x2')]},'line':{'type':Sequelize[_0xbd32('0x2')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xbd32('0x4')]},'AdditionalPhones':{'type':Sequelize[_0xbd32('0x2')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xbd32('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xbd32('0x6')],'defaultValue':Sequelize[_0xbd32('0x7')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0xbd32('0x4')]}}; \ No newline at end of file +var _0x95cc=['lodash','sequelize','exports','STRING','INTEGER','UNSIGNED','NOW'];(function(_0x101802,_0x11f913){var _0x5d61ce=function(_0x4acc0){while(--_0x4acc0){_0x101802['push'](_0x101802['shift']());}};_0x5d61ce(++_0x11f913);}(_0x95cc,0x12d));var _0xc95c=function(_0x52d637,_0x4f76ce){_0x52d637=_0x52d637-0x0;var _0x2de925=_0x95cc[_0x52d637];return _0x2de925;};'use strict';var _=require(_0xc95c('0x0'));var Sequelize=require(_0xc95c('0x1'));module[_0xc95c('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0xc95c('0x3')]},'street':{'type':Sequelize[_0xc95c('0x3')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xc95c('0x3')]},'country':{'type':Sequelize[_0xc95c('0x3')]},'dateOfBirth':{'type':Sequelize[_0xc95c('0x3')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0xc95c('0x3')]},'mobile':{'type':Sequelize[_0xc95c('0x3')]},'fax':{'type':Sequelize[_0xc95c('0x3')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xc95c('0x3')]},'fb_data':{'type':Sequelize[_0xc95c('0x3')]},'twitter':{'type':Sequelize[_0xc95c('0x3')]},'skype':{'type':Sequelize[_0xc95c('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0xc95c('0x3')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0xc95c('0x3')]},'UserId':{'type':Sequelize[_0xc95c('0x4')]},'AdditionalPhones':{'type':Sequelize[_0xc95c('0x3')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xc95c('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0xc95c('0x6')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0xc95c('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 08ae1cc..cdfc773 100644 --- a/server/api/cmContact/cmContact.controller.js +++ b/server/api/cmContact/cmContact.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file +var _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0x16629d,_0x492375){var _0x56ccee=function(_0xa982b7){while(--_0xa982b7){_0x16629d['push'](_0x16629d['shift']());}};_0x56ccee(++_0x492375);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index ed26e13..4b11545 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 _0xc028=['exports','../../mysqldb','CmContact','setMaxListeners','save','update','emit','hook'];(function(_0x166593,_0x54500d){var _0x4fa8f4=function(_0x44fc47){while(--_0x44fc47){_0x166593['push'](_0x166593['shift']());}};_0x4fa8f4(++_0x54500d);}(_0xc028,0x171));var _0x8c02=function(_0x4b7af1,_0x37b16e){_0x4b7af1=_0x4b7af1-0x0;var _0xfa80db=_0xc028[_0x4b7af1];return _0xfa80db;};'use strict';var EventEmitter=require('events');var CmContact=require(_0x8c02('0x0'))['db'][_0x8c02('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x8c02('0x2')](0x0);var events={'afterCreate':_0x8c02('0x3'),'afterUpdate':_0x8c02('0x4'),'afterDestroy':'remove'};function emitEvent(_0x174893){return function(_0xf0025,_0x25d566,_0x21c39f){CmContactEvents[_0x8c02('0x5')](_0x174893+':'+_0xf0025['id'],_0xf0025);CmContactEvents[_0x8c02('0x5')](_0x174893,_0xf0025);_0x21c39f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0x8c02('0x6')](e,emitEvent(event));}}module[_0x8c02('0x7')]=CmContactEvents; \ No newline at end of file +var _0x7089=['emit','hasOwnProperty','exports','events','CmContact','setMaxListeners','update','remove'];(function(_0x468239,_0x4eeb4a){var _0x414484=function(_0x52979f){while(--_0x52979f){_0x468239['push'](_0x468239['shift']());}};_0x414484(++_0x4eeb4a);}(_0x7089,0x8b));var _0x9708=function(_0x25cce6,_0x3625d8){_0x25cce6=_0x25cce6-0x0;var _0x12ec8d=_0x7089[_0x25cce6];return _0x12ec8d;};'use strict';var EventEmitter=require(_0x9708('0x0'));var CmContact=require('../../mysqldb')['db'][_0x9708('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x9708('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9708('0x3'),'afterDestroy':_0x9708('0x4')};function emitEvent(_0x1343c7){return function(_0x24ef5a,_0x698f5e,_0x4bb015){CmContactEvents[_0x9708('0x5')](_0x1343c7+':'+_0x24ef5a['id'],_0x24ef5a);CmContactEvents[_0x9708('0x5')](_0x1343c7,_0x24ef5a);_0x4bb015(null);};}for(var e in events){if(events[_0x9708('0x6')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0x9708('0x7')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 4b4ae5b..d593ec9 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 _0x21ef=['VoiceQueueId','CampaignId','all','info','[CmContact][afterDestroy][Succesfull]','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','firstName','lastName','mobile','fax','email','FULLTEXT','utf8mb4','get','error','cmContact','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','findOne','timezones','utcOffset','add','minutes','ret','CmHopper','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','callbackUniqueid','catch','then','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','Campaign','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','CmHopperFinal','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','Lists','length','always','CmList','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','message','List\x20not\x20found','models','destroy','ContactId'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x21ef,0x186));var _0xf21e=function(_0x2365b1,_0x82ad26){_0x2365b1=_0x2365b1-0x0;var _0x6885bc=_0x21ef[_0x2365b1];return _0x6885bc;};'use strict';var _=require(_0xf21e('0x0'));var util=require(_0xf21e('0x1'));var logger=require(_0xf21e('0x2'))(_0xf21e('0x3'));var moment=require(_0xf21e('0x4'));var BPromise=require('bluebird');var rp=require(_0xf21e('0x5'));var fs=require('fs');var path=require(_0xf21e('0x6'));var rimraf=require(_0xf21e('0x7'));var config=require(_0xf21e('0x8'));var shared=require(_0xf21e('0x9'));var attributes=require(_0xf21e('0xa'));module[_0xf21e('0xb')]=function(_0x365d31,_0x148419){return _0x365d31[_0xf21e('0xc')](_0xf21e('0xd'),attributes,{'tableName':_0xf21e('0xe'),'paranoid':!![],'indexes':[{'name':_0xf21e('0xf'),'fields':[_0xf21e('0xf')]},{'name':'fti_cm_contacts','fields':[_0xf21e('0x10'),_0xf21e('0x11'),_0xf21e('0xf'),_0xf21e('0x12'),_0xf21e('0x13'),_0xf21e('0x14')],'type':_0xf21e('0x15')}],'timestamps':!![],'charset':_0xf21e('0x16'),'collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0xf63d78,_0x2e354c,_0xdc348){var _0x536f3d=_0x365d31['models'];var _0x1065a2=_0xf63d78[_0xf21e('0x17')]({'plain':!![]});function _0x56d5bb(){return function(_0x2cf6d1){logger[_0xf21e('0x18')](_0xf21e('0x19'),_0xf21e('0x1a'),util[_0xf21e('0x1b')](_0x2cf6d1,{'showHidden':![],'depth':null}));};}function _0x120895(_0x2314f3,_0xcefe47){var _0x2e5d58=_0xcefe47[_0xf21e('0x1c')]?_0xcefe47[_0xf21e('0x1c')]:moment()[_0xf21e('0x1d')](_0xf21e('0x1e'));return new BPromise(function(_0x4660b6,_0x5bd81c){if(_[_0xf21e('0x1f')](_0xcefe47[_0xf21e('0x20')])){_0x4660b6({'ret':_0x2e5d58});}else{_0x536f3d[_0xf21e('0x21')][_0xf21e('0x22')]({'where':{'id':_0x2314f3['id']}})['then'](function(_0x1d0c4b){if(!_[_0xf21e('0x1f')](_0x1d0c4b)){var _0x181e56=_0x1d0c4b[_0xf21e('0x20')];if(!_[_0xf21e('0x1f')](_0x181e56)){var _0x173ad0=shared[_0xf21e('0x23')];var _0x28e78e=_0x173ad0[_0x181e56];var _0xc4a007=_0x173ad0[_0xcefe47[_0xf21e('0x20')]];if(!_[_0xf21e('0x1f')](_0x28e78e)&&!_[_0xf21e('0x1f')](_0xc4a007)){var _0x5a6ae8=_0x28e78e[_0xf21e('0x24')]-_0xc4a007[_0xf21e('0x24')];_0x2e5d58=_0xcefe47[_0xf21e('0x1c')]?_0xcefe47[_0xf21e('0x1c')]:moment();var _0x411055=moment(_0x2e5d58)[_0xf21e('0x25')](_0x5a6ae8,_0xf21e('0x26'));_0x4660b6({'ret':_0x411055[_0xf21e('0x1d')](_0xf21e('0x1e'))});}else _0x4660b6({'ret':_0x2e5d58});}else _0x4660b6({'ret':_0x2e5d58});}else{_0x4660b6({'ret':_0x2e5d58});}});}});return 0xa;}var _0x2abd6c=function(_0x2fb403){return new BPromise(function(_0x979f78,_0xce4efc){_0x120895(_0x2fb403,_0x1065a2)['then'](function(_0x387fab){_0x1065a2[_0xf21e('0x1c')]=_0x387fab[_0xf21e('0x27')];_0x536f3d[_0xf21e('0x28')][_0xf21e('0x22')]({'where':{'phone':_0x1065a2[_0xf21e('0xf')],'VoiceQueueId':_0x2fb403['id']}})['then'](function(_0x4d6859){if(!_['isNil'](_0x4d6859)){throw new Error('cmContact,\x20afterCreate\x20'+_0x1065a2[_0xf21e('0xf')]+_0xf21e('0x29')+_0x2fb403['id']);}return _0x536f3d[_0xf21e('0x28')][_0xf21e('0x2a')]({'phone':_0x1065a2[_0xf21e('0xf')],'ContactId':_0x1065a2['id'],'ListId':_0x1065a2[_0xf21e('0x2b')],'priority':_0x1065a2[_0xf21e('0x2c')]?_0x1065a2['priority']:0x2,'scheduledat':_0x1065a2[_0xf21e('0x1c')]?_0x1065a2[_0xf21e('0x1c')]:moment()[_0xf21e('0x1d')](_0xf21e('0x1e')),'callback':_0x1065a2[_0xf21e('0x2d')]?!![]:![],'callbackuniqueid':_0x1065a2['callbackUniqueid']?_0x1065a2[_0xf21e('0x2d')]:undefined,'callbackat':_0x1065a2[_0xf21e('0x2d')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x2fb403['id']});})[_0xf21e('0x2e')](function(_0x1abf57){_0xce4efc(_0x1abf57);});});});};var _0x4ba498=function(_0x2becc1){return new BPromise(function(_0x19b625,_0x21c688){_0x120895(_0x2becc1,_0x1065a2)[_0xf21e('0x2f')](function(_0x17e0ca){_0x1065a2[_0xf21e('0x1c')]=_0x17e0ca[_0xf21e('0x27')];_0x536f3d['CmHopper'][_0xf21e('0x22')]({'where':{'phone':_0x1065a2['phone'],'VoiceQueueId':_0x2becc1['id']}})['then'](function(_0x3e1cd6){if(!_['isNil'](_0x3e1cd6)){throw new Error(_0xf21e('0x30')+_0x1065a2[_0xf21e('0xf')]+_0xf21e('0x31')+_0x2becc1['id']);}return _0x536f3d['CmHopperFinal'][_0xf21e('0x22')]({'where':{'calleridnum':_0x1065a2['phone'],'VoiceQueueId':_0x2becc1['id']}});})[_0xf21e('0x2f')](function(_0xce2ade){if(!_[_0xf21e('0x1f')](_0xce2ade)){throw new Error(_0xf21e('0x32')+_0x1065a2[_0xf21e('0xf')]+_0xf21e('0x33')+_0x2becc1['id']);}return _0x536f3d[_0xf21e('0x28')][_0xf21e('0x2a')]({'phone':_0x1065a2[_0xf21e('0xf')],'ContactId':_0x1065a2['id'],'ListId':_0x1065a2[_0xf21e('0x2b')],'priority':_0x1065a2[_0xf21e('0x2c')]?_0x1065a2[_0xf21e('0x2c')]:0x2,'scheduledat':_0x1065a2[_0xf21e('0x1c')]?_0x1065a2[_0xf21e('0x1c')]:moment()[_0xf21e('0x1d')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x1065a2[_0xf21e('0x2d')]?!![]:![],'callbackuniqueid':_0x1065a2[_0xf21e('0x2d')]?_0x1065a2[_0xf21e('0x2d')]:undefined,'callbackat':_0x1065a2[_0xf21e('0x2d')]?moment()[_0xf21e('0x1d')](_0xf21e('0x1e')):undefined,'VoiceQueueId':_0x2becc1['id']});})[_0xf21e('0x2e')](function(_0x5e8e1b){_0x21c688(_0x5e8e1b);});});});};function _0x5e932e(){return function(_0x37aee4){logger['error'](_0xf21e('0x19'),'afterCreate',util[_0xf21e('0x1b')](_0x37aee4,{'showHidden':![],'depth':null}));};}function _0x2f91d4(_0xe9aded,_0x1b2453){var _0x42bdb6=_0x1b2453[_0xf21e('0x1c')]?_0x1b2453[_0xf21e('0x1c')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x40d62f,_0x2bd5b4){if(_['isNil'](_0x1b2453[_0xf21e('0x20')])){_0x40d62f({'ret':_0x42bdb6});}else{_0x536f3d[_0xf21e('0x34')][_0xf21e('0x22')]({'where':{'id':_0xe9aded['id']}})[_0xf21e('0x2f')](function(_0x53652c){if(!_[_0xf21e('0x1f')](_0x53652c)){var _0x19d44b=_0x53652c[_0xf21e('0x20')];if(!_[_0xf21e('0x1f')](_0x19d44b)){var _0xa2356f=shared[_0xf21e('0x23')];var _0x2355f6=_0xa2356f[_0x19d44b];var _0xf4a2b3=_0xa2356f[_0x1b2453[_0xf21e('0x20')]];if(!_[_0xf21e('0x1f')](_0x2355f6)&&!_[_0xf21e('0x1f')](_0xf4a2b3)){var _0xbea155=_0x2355f6[_0xf21e('0x24')]-_0xf4a2b3[_0xf21e('0x24')];_0x42bdb6=_0x1b2453[_0xf21e('0x1c')]?_0x1b2453[_0xf21e('0x1c')]:moment();var _0x2cf6d5=moment(_0x42bdb6)[_0xf21e('0x25')](_0xbea155,_0xf21e('0x26'));_0x40d62f({'ret':_0x2cf6d5['format'](_0xf21e('0x1e'))});}else _0x40d62f({'ret':_0x42bdb6});}else _0x40d62f({'ret':_0x42bdb6});}else{_0x40d62f({'ret':_0x42bdb6});}});}});return 0xa;}var _0x4868ff=function(_0x5b34ad){return new BPromise(function(_0x312f7a,_0x55f6cc){_0x2f91d4(_0x5b34ad,_0x1065a2)['then'](function(_0x13266d){_0x1065a2[_0xf21e('0x1c')]=_0x13266d['ret'];_0x536f3d['CmHopper'][_0xf21e('0x22')]({'where':{'phone':_0x1065a2['phone'],'CampaignId':_0x5b34ad['id']}})[_0xf21e('0x2f')](function(_0xba34a1){if(!_[_0xf21e('0x1f')](_0xba34a1)){throw new Error('cmContact,\x20afterCreate\x20'+_0x1065a2['phone']+_0xf21e('0x35')+_0x5b34ad['id']);}return _0x536f3d['CmHopper'][_0xf21e('0x2a')]({'phone':_0x1065a2[_0xf21e('0xf')],'ContactId':_0x1065a2['id'],'ListId':_0x1065a2[_0xf21e('0x2b')],'priority':_0x1065a2[_0xf21e('0x2c')]?_0x1065a2[_0xf21e('0x2c')]:0x2,'scheduledat':_0x1065a2[_0xf21e('0x1c')]?_0x1065a2['scheduledat']:moment()[_0xf21e('0x1d')](_0xf21e('0x1e')),'callback':_0x1065a2[_0xf21e('0x2d')]?!![]:![],'callbackuniqueid':_0x1065a2[_0xf21e('0x2d')]?_0x1065a2[_0xf21e('0x2d')]:undefined,'callbackat':_0x1065a2['callbackUniqueid']?moment()[_0xf21e('0x1d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x5b34ad['id']});})[_0xf21e('0x2e')](function(_0x4c609c){_0x55f6cc(_0x4c609c);});});});};var _0x2e4d18=function(_0x1edda1){return new BPromise(function(_0x251868,_0x55af72){_0x2f91d4(_0x1edda1,_0x1065a2)[_0xf21e('0x2f')](function(_0x583261){_0x1065a2['scheduledat']=_0x583261['ret'];_0x536f3d['CmHopper'][_0xf21e('0x22')]({'where':{'phone':_0x1065a2[_0xf21e('0xf')],'CampaignId':_0x1edda1['id']}})[_0xf21e('0x2f')](function(_0x532b73){if(!_[_0xf21e('0x1f')](_0x532b73)){throw new Error(_0xf21e('0x30')+_0x1065a2['phone']+_0xf21e('0x36')+_0x1edda1['id']);}return _0x536f3d[_0xf21e('0x37')]['findOne']({'where':{'calleridnum':_0x1065a2['phone'],'CampaignId':_0x1edda1['id']}});})[_0xf21e('0x2f')](function(_0x17cd10){if(!_['isNil'](_0x17cd10)){throw new Error(_0xf21e('0x32')+_0x1065a2['phone']+_0xf21e('0x38')+_0x1edda1['id']);}return _0x536f3d['CmHopper']['create']({'phone':_0x1065a2['phone'],'ContactId':_0x1065a2['id'],'ListId':_0x1065a2[_0xf21e('0x2b')],'priority':_0x1065a2[_0xf21e('0x2c')]?_0x1065a2[_0xf21e('0x2c')]:0x2,'scheduledat':_0x1065a2[_0xf21e('0x1c')]?_0x1065a2[_0xf21e('0x1c')]:moment()[_0xf21e('0x1d')](_0xf21e('0x1e')),'callback':_0x1065a2[_0xf21e('0x2d')]?!![]:![],'callbackuniqueid':_0x1065a2[_0xf21e('0x2d')]?_0x1065a2[_0xf21e('0x2d')]:undefined,'callbackat':_0x1065a2['callbackUniqueid']?moment()[_0xf21e('0x1d')](_0xf21e('0x1e')):undefined,'CampaignId':_0x1edda1['id']});})[_0xf21e('0x2e')](function(_0x574385){_0x55af72(_0x574385);});});});};if(_0x1065a2['ListId']){_0x536f3d[_0xf21e('0x21')][_0xf21e('0x39')]({'where':{'type':_0xf21e('0x3a')},'attributes':['id',_0xf21e('0x3b'),'dialTimezone'],'include':[{'model':_0x536f3d['CmList'],'as':_0xf21e('0x3c'),'where':{'id':_0x1065a2[_0xf21e('0x2b')]}}]})[_0xf21e('0x2f')](function(_0x26ece9){if(_0x26ece9){var _0x5e9496=[];for(var _0xe9ea66=0x0,_0x1fb5b8;_0xe9ea66<_0x26ece9[_0xf21e('0x3d')];_0xe9ea66+=0x1){_0x1fb5b8=_0x26ece9[_0xe9ea66][_0xf21e('0x17')]({'plain':!![]});switch(_0x1fb5b8[_0xf21e('0x3b')]){case _0xf21e('0x3e'):_0x4ba498(_0x1fb5b8)[_0xf21e('0x2e')](_0x56d5bb());break;case'onlyIfOpen':_0x2abd6c(_0x1fb5b8)['catch'](_0x56d5bb());break;default:_0x2f91d4(_0x1fb5b8,_0x1065a2)[_0xf21e('0x2f')](function(_0x403c67){_0x1065a2[_0xf21e('0x1c')]=_0x403c67[_0xf21e('0x27')];_0x536f3d[_0xf21e('0x28')][_0xf21e('0x2a')]({'phone':_0x1065a2[_0xf21e('0xf')],'ContactId':_0x1065a2['id'],'ListId':_0x1065a2[_0xf21e('0x2b')],'scheduledat':_0x1065a2[_0xf21e('0x1c')]?_0x1065a2[_0xf21e('0x1c')]:moment()[_0xf21e('0x1d')](_0xf21e('0x1e')),'priority':_0x1065a2[_0xf21e('0x2c')]?_0x1065a2[_0xf21e('0x2c')]:0x2,'callback':_0x1065a2[_0xf21e('0x2d')]?!![]:![],'callbackuniqueid':_0x1065a2[_0xf21e('0x2d')]?_0x1065a2[_0xf21e('0x2d')]:undefined,'callbackat':_0x1065a2[_0xf21e('0x2d')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x1fb5b8['id']})[_0xf21e('0x2e')](_0x56d5bb());});}}}})['then'](function(){return _0x536f3d[_0xf21e('0x21')][_0xf21e('0x39')]({'where':{'type':_0xf21e('0x3a')},'attributes':['id'],'include':[{'model':_0x536f3d[_0xf21e('0x3f')],'as':_0xf21e('0x40'),'where':{'id':_0x1065a2[_0xf21e('0x2b')]}}]})[_0xf21e('0x2f')](function(_0x2e778b){if(_0x2e778b){var _0x37a55d=[];for(var _0xf56adf=0x0,_0x55fca1;_0xf56adf<_0x2e778b[_0xf21e('0x3d')];_0xf56adf+=0x1){_0x55fca1=_0x2e778b[_0xf56adf][_0xf21e('0x17')]({'plain':!![]});_0x536f3d[_0xf21e('0x41')][_0xf21e('0x2a')]({'phone':_0x1065a2[_0xf21e('0xf')],'ContactId':_0x1065a2['id'],'ListId':_0x1065a2[_0xf21e('0x2b')],'VoiceQueueId':_0x55fca1['id']})[_0xf21e('0x2e')](function(_0x3d5aef){logger['error'](_0xf21e('0x42'),_0xf21e('0x1a'),_0x3d5aef[_0xf21e('0x43')]);});}}});})[_0xf21e('0x2f')](function(){return _0x536f3d[_0xf21e('0x34')][_0xf21e('0x39')]({'attributes':['id',_0xf21e('0x3b'),'dialTimezone'],'include':[{'model':_0x536f3d[_0xf21e('0x3f')],'as':_0xf21e('0x3c'),'where':{'id':_0x1065a2[_0xf21e('0x2b')]}}]})['then'](function(_0x3cd7c0){if(_0x3cd7c0){var _0x38f1d3=[];for(var _0x1d1933=0x0,_0x429c98;_0x1d1933<_0x3cd7c0[_0xf21e('0x3d')];_0x1d1933+=0x1){_0x429c98=_0x3cd7c0[_0x1d1933][_0xf21e('0x17')]({'plain':!![]});switch(_0x429c98[_0xf21e('0x3b')]){case'always':_0x2e4d18(_0x429c98)[_0xf21e('0x2e')](_0x5e932e());break;case'onlyIfOpen':_0x4868ff(_0x429c98)['catch'](_0x5e932e());break;default:_0x536f3d[_0xf21e('0x28')][_0xf21e('0x2a')]({'phone':_0x1065a2[_0xf21e('0xf')],'ContactId':_0x1065a2['id'],'ListId':_0x1065a2[_0xf21e('0x2b')],'scheduledat':_0x1065a2[_0xf21e('0x1c')]?_0x1065a2[_0xf21e('0x1c')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x1065a2[_0xf21e('0x2c')]?_0x1065a2[_0xf21e('0x2c')]:0x2,'callback':_0x1065a2['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x1065a2[_0xf21e('0x2d')]?_0x1065a2['callbackUniqueid']:undefined,'callbackat':_0x1065a2['callbackUniqueid']?moment()[_0xf21e('0x1d')](_0xf21e('0x1e')):undefined,'CampaignId':_0x429c98['id']})[_0xf21e('0x2e')](_0x5e932e());}}}});})[_0xf21e('0x2f')](function(){return _0x536f3d[_0xf21e('0x34')][_0xf21e('0x39')]({'attributes':['id'],'include':[{'model':_0x536f3d[_0xf21e('0x3f')],'as':_0xf21e('0x40'),'where':{'id':_0x1065a2[_0xf21e('0x2b')]}}]})[_0xf21e('0x2f')](function(_0x2181e2){if(_0x2181e2){var _0x234775=[];for(var _0xffb61a=0x0,_0x8f2d11;_0xffb61a<_0x2181e2['length'];_0xffb61a+=0x1){_0x8f2d11=_0x2181e2[_0xffb61a][_0xf21e('0x17')]({'plain':!![]});_0x536f3d[_0xf21e('0x41')][_0xf21e('0x2a')]({'phone':_0x1065a2[_0xf21e('0xf')],'ContactId':_0x1065a2['id'],'ListId':_0x1065a2['ListId'],'CampaignId':_0x8f2d11['id']})[_0xf21e('0x2e')](function(_0x3125ec){logger[_0xf21e('0x18')](_0xf21e('0x42'),'afterCreate',_0x3125ec['message']);});}}});})[_0xf21e('0x2f')](function(){_0xdc348();})[_0xf21e('0x2e')](function(_0x147af7){logger[_0xf21e('0x18')](_0xf21e('0x42'),_0xf21e('0x1a'),_0x147af7['message']);_0xdc348(_0x147af7);});}else{_0xdc348(new Error(_0xf21e('0x44')));}},'afterDestroy':function(_0x5cee21,_0x2df079,_0x173ba1){var _0x3d7ad5=_0x365d31[_0xf21e('0x45')];var _0x5a1f08=_0x5cee21[_0xf21e('0x17')]({'plain':!![]});return _0x3d7ad5[_0xf21e('0x28')]['findAll']({'raw':!![],'where':{'ListId':_0x5a1f08[_0xf21e('0x2b')],'ContactId':_0x5a1f08['id']}})['then'](function(_0x4d1ab9){if(!_['isEmpty'](_0x4d1ab9)){var _0x25ef0f=[];for(var _0x33b08b=0x0;_0x33b08b<_0x4d1ab9[_0xf21e('0x3d')];_0x33b08b+=0x1){var _0x28a4cb=_0x3d7ad5['CmHopper'][_0xf21e('0x46')]({'where':{'ListId':_0x4d1ab9[_0x33b08b]['ListId'],'ContactId':_0x4d1ab9[_0x33b08b][_0xf21e('0x47')],'VoiceQueueId':_0x4d1ab9[_0x33b08b][_0xf21e('0x48')],'CampaignId':_0x4d1ab9[_0x33b08b][_0xf21e('0x49')]}});_0x25ef0f['push'](_0x28a4cb);}return BPromise[_0xf21e('0x4a')](_0x25ef0f);}})[_0xf21e('0x2f')](function(_0x20f4a4){logger[_0xf21e('0x4b')](_0xf21e('0x4c'),util['inspect'](_0x20f4a4,{'showHidden':![],'depth':null}));_0x173ba1();})['catch'](function(_0x79caa0){logger['error']('[CmContact][afterDestroy][Error]',util[_0xf21e('0x1b')](_0x79caa0,{'showHidden':![],'depth':null}));_0x173ba1(_0x79caa0);});}}});}; \ No newline at end of file +var _0xcc85=['onlyIfOpen','findAll','BlackLists','cmContact,\x20%s,\x20%s','message','Campaign','error','List\x20not\x20found','isEmpty','destroy','ContactId','VoiceQueueId','CampaignId','info','[CmContact][afterDestroy][Succesfull]','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment/shared','CmContact','cm_contacts','fti_cm_contacts','firstName','lastName','phone','mobile','fax','email','FULLTEXT','models','cmContact','afterCreate','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','then','timezones','utcOffset','add','minutes','ret','findOne','CmHopper','create','priority','callbackUniqueid','catch','cmContact,\x20afterCreate\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','ListId','inspect','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','outbound','dialCheckDuplicateType','CmList','Lists','length','get','always'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xcc85,0xe1));var _0x5cc8=function(_0x594ece,_0x2a1f27){_0x594ece=_0x594ece-0x0;var _0x471bc4=_0xcc85[_0x594ece];return _0x471bc4;};'use strict';var _=require(_0x5cc8('0x0'));var util=require(_0x5cc8('0x1'));var logger=require(_0x5cc8('0x2'))(_0x5cc8('0x3'));var moment=require(_0x5cc8('0x4'));var BPromise=require(_0x5cc8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5cc8('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var shared=require(_0x5cc8('0x7'));var attributes=require('./cmContact.attributes');module['exports']=function(_0x33f3d3,_0x2e42aa){return _0x33f3d3['define'](_0x5cc8('0x8'),attributes,{'tableName':_0x5cc8('0x9'),'paranoid':!![],'indexes':[{'name':'phone','fields':['phone']},{'name':_0x5cc8('0xa'),'fields':[_0x5cc8('0xb'),_0x5cc8('0xc'),_0x5cc8('0xd'),_0x5cc8('0xe'),_0x5cc8('0xf'),_0x5cc8('0x10')],'type':_0x5cc8('0x11')}],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0x292bba,_0x481e43,_0x1bee1b){var _0x445b9a=_0x33f3d3[_0x5cc8('0x12')];var _0xf11d3f=_0x292bba['get']({'plain':!![]});function _0x6fd6d7(){return function(_0x2c3d50){logger['error'](_0x5cc8('0x13'),_0x5cc8('0x14'),util['inspect'](_0x2c3d50,{'showHidden':![],'depth':null}));};}function _0x4c8f4a(_0x527807,_0x174b5d){var _0x2e7973=_0x174b5d[_0x5cc8('0x15')]?_0x174b5d[_0x5cc8('0x15')]:moment()[_0x5cc8('0x16')](_0x5cc8('0x17'));return new BPromise(function(_0x5e8dfe,_0x2c91f8){if(_[_0x5cc8('0x18')](_0x174b5d[_0x5cc8('0x19')])){_0x5e8dfe({'ret':_0x2e7973});}else{_0x445b9a[_0x5cc8('0x1a')]['findOne']({'where':{'id':_0x527807['id']}})[_0x5cc8('0x1b')](function(_0x341d27){if(!_[_0x5cc8('0x18')](_0x341d27)){var _0x272674=_0x341d27[_0x5cc8('0x19')];if(!_[_0x5cc8('0x18')](_0x272674)){var _0x33362d=shared[_0x5cc8('0x1c')];var _0x159490=_0x33362d[_0x272674];var _0x4cc6e7=_0x33362d[_0x174b5d['dialTimezone']];if(!_[_0x5cc8('0x18')](_0x159490)&&!_[_0x5cc8('0x18')](_0x4cc6e7)){var _0x162e09=_0x159490[_0x5cc8('0x1d')]-_0x4cc6e7[_0x5cc8('0x1d')];_0x2e7973=_0x174b5d['scheduledat']?_0x174b5d[_0x5cc8('0x15')]:moment();var _0x1a3adf=moment(_0x2e7973)[_0x5cc8('0x1e')](_0x162e09,_0x5cc8('0x1f'));_0x5e8dfe({'ret':_0x1a3adf[_0x5cc8('0x16')](_0x5cc8('0x17'))});}else _0x5e8dfe({'ret':_0x2e7973});}else _0x5e8dfe({'ret':_0x2e7973});}else{_0x5e8dfe({'ret':_0x2e7973});}});}});return 0xa;}var _0x56acff=function(_0x416d45){return new BPromise(function(_0x5792ab,_0x17ff40){_0x4c8f4a(_0x416d45,_0xf11d3f)['then'](function(_0x1d755a){_0xf11d3f[_0x5cc8('0x15')]=_0x1d755a[_0x5cc8('0x20')];_0x445b9a['CmHopper'][_0x5cc8('0x21')]({'where':{'phone':_0xf11d3f[_0x5cc8('0xd')],'VoiceQueueId':_0x416d45['id']}})[_0x5cc8('0x1b')](function(_0xec69f4){if(!_['isNil'](_0xec69f4)){throw new Error('cmContact,\x20afterCreate\x20'+_0xf11d3f[_0x5cc8('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x416d45['id']);}return _0x445b9a[_0x5cc8('0x22')][_0x5cc8('0x23')]({'phone':_0xf11d3f[_0x5cc8('0xd')],'ContactId':_0xf11d3f['id'],'ListId':_0xf11d3f['ListId'],'priority':_0xf11d3f[_0x5cc8('0x24')]?_0xf11d3f[_0x5cc8('0x24')]:0x2,'scheduledat':_0xf11d3f[_0x5cc8('0x15')]?_0xf11d3f['scheduledat']:moment()[_0x5cc8('0x16')](_0x5cc8('0x17')),'callback':_0xf11d3f[_0x5cc8('0x25')]?!![]:![],'callbackuniqueid':_0xf11d3f[_0x5cc8('0x25')]?_0xf11d3f['callbackUniqueid']:undefined,'callbackat':_0xf11d3f[_0x5cc8('0x25')]?moment()[_0x5cc8('0x16')](_0x5cc8('0x17')):undefined,'VoiceQueueId':_0x416d45['id']});})[_0x5cc8('0x26')](function(_0x265319){_0x17ff40(_0x265319);});});});};var _0x18dd5c=function(_0x37beab){return new BPromise(function(_0x3c665b,_0x1f9efe){_0x4c8f4a(_0x37beab,_0xf11d3f)[_0x5cc8('0x1b')](function(_0xd958de){_0xf11d3f[_0x5cc8('0x15')]=_0xd958de[_0x5cc8('0x20')];_0x445b9a[_0x5cc8('0x22')][_0x5cc8('0x21')]({'where':{'phone':_0xf11d3f[_0x5cc8('0xd')],'VoiceQueueId':_0x37beab['id']}})[_0x5cc8('0x1b')](function(_0x815e13){if(!_[_0x5cc8('0x18')](_0x815e13)){throw new Error(_0x5cc8('0x27')+_0xf11d3f[_0x5cc8('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x37beab['id']);}return _0x445b9a[_0x5cc8('0x28')]['findOne']({'where':{'calleridnum':_0xf11d3f[_0x5cc8('0xd')],'VoiceQueueId':_0x37beab['id']}});})[_0x5cc8('0x1b')](function(_0x1a4792){if(!_[_0x5cc8('0x18')](_0x1a4792)){throw new Error(_0x5cc8('0x29')+_0xf11d3f[_0x5cc8('0xd')]+_0x5cc8('0x2a')+_0x37beab['id']);}return _0x445b9a[_0x5cc8('0x22')]['create']({'phone':_0xf11d3f[_0x5cc8('0xd')],'ContactId':_0xf11d3f['id'],'ListId':_0xf11d3f[_0x5cc8('0x2b')],'priority':_0xf11d3f[_0x5cc8('0x24')]?_0xf11d3f[_0x5cc8('0x24')]:0x2,'scheduledat':_0xf11d3f[_0x5cc8('0x15')]?_0xf11d3f[_0x5cc8('0x15')]:moment()[_0x5cc8('0x16')](_0x5cc8('0x17')),'callback':_0xf11d3f[_0x5cc8('0x25')]?!![]:![],'callbackuniqueid':_0xf11d3f[_0x5cc8('0x25')]?_0xf11d3f[_0x5cc8('0x25')]:undefined,'callbackat':_0xf11d3f[_0x5cc8('0x25')]?moment()[_0x5cc8('0x16')](_0x5cc8('0x17')):undefined,'VoiceQueueId':_0x37beab['id']});})[_0x5cc8('0x26')](function(_0x2c95b2){_0x1f9efe(_0x2c95b2);});});});};function _0x501bf9(){return function(_0x119df6){logger['error'](_0x5cc8('0x13'),_0x5cc8('0x14'),util[_0x5cc8('0x2c')](_0x119df6,{'showHidden':![],'depth':null}));};}function _0x3a0735(_0x21e05d,_0x26c3f1){var _0x2bfa71=_0x26c3f1[_0x5cc8('0x15')]?_0x26c3f1['scheduledat']:moment()[_0x5cc8('0x16')](_0x5cc8('0x17'));return new BPromise(function(_0x2f772d,_0x6b111a){if(_['isNil'](_0x26c3f1[_0x5cc8('0x19')])){_0x2f772d({'ret':_0x2bfa71});}else{_0x445b9a['Campaign']['findOne']({'where':{'id':_0x21e05d['id']}})['then'](function(_0x285ec7){if(!_[_0x5cc8('0x18')](_0x285ec7)){var _0x54c14f=_0x285ec7[_0x5cc8('0x19')];if(!_[_0x5cc8('0x18')](_0x54c14f)){var _0x30c997=shared[_0x5cc8('0x1c')];var _0x1d1a7b=_0x30c997[_0x54c14f];var _0x1867cd=_0x30c997[_0x26c3f1[_0x5cc8('0x19')]];if(!_[_0x5cc8('0x18')](_0x1d1a7b)&&!_[_0x5cc8('0x18')](_0x1867cd)){var _0x4f2941=_0x1d1a7b['utcOffset']-_0x1867cd[_0x5cc8('0x1d')];_0x2bfa71=_0x26c3f1[_0x5cc8('0x15')]?_0x26c3f1['scheduledat']:moment();var _0x23c33d=moment(_0x2bfa71)['add'](_0x4f2941,_0x5cc8('0x1f'));_0x2f772d({'ret':_0x23c33d[_0x5cc8('0x16')](_0x5cc8('0x17'))});}else _0x2f772d({'ret':_0x2bfa71});}else _0x2f772d({'ret':_0x2bfa71});}else{_0x2f772d({'ret':_0x2bfa71});}});}});return 0xa;}var _0x3b1ae7=function(_0x30488e){return new BPromise(function(_0x4fadbf,_0x37f415){_0x3a0735(_0x30488e,_0xf11d3f)['then'](function(_0xd5af50){_0xf11d3f[_0x5cc8('0x15')]=_0xd5af50['ret'];_0x445b9a['CmHopper'][_0x5cc8('0x21')]({'where':{'phone':_0xf11d3f[_0x5cc8('0xd')],'CampaignId':_0x30488e['id']}})['then'](function(_0x2b5529){if(!_[_0x5cc8('0x18')](_0x2b5529)){throw new Error(_0x5cc8('0x27')+_0xf11d3f[_0x5cc8('0xd')]+_0x5cc8('0x2d')+_0x30488e['id']);}return _0x445b9a[_0x5cc8('0x22')][_0x5cc8('0x23')]({'phone':_0xf11d3f[_0x5cc8('0xd')],'ContactId':_0xf11d3f['id'],'ListId':_0xf11d3f[_0x5cc8('0x2b')],'priority':_0xf11d3f[_0x5cc8('0x24')]?_0xf11d3f[_0x5cc8('0x24')]:0x2,'scheduledat':_0xf11d3f[_0x5cc8('0x15')]?_0xf11d3f['scheduledat']:moment()[_0x5cc8('0x16')](_0x5cc8('0x17')),'callback':_0xf11d3f[_0x5cc8('0x25')]?!![]:![],'callbackuniqueid':_0xf11d3f[_0x5cc8('0x25')]?_0xf11d3f['callbackUniqueid']:undefined,'callbackat':_0xf11d3f[_0x5cc8('0x25')]?moment()[_0x5cc8('0x16')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x30488e['id']});})['catch'](function(_0x3db466){_0x37f415(_0x3db466);});});});};var _0x3a1925=function(_0x512394){return new BPromise(function(_0x11537a,_0x4651d4){_0x3a0735(_0x512394,_0xf11d3f)[_0x5cc8('0x1b')](function(_0x296973){_0xf11d3f[_0x5cc8('0x15')]=_0x296973[_0x5cc8('0x20')];_0x445b9a['CmHopper']['findOne']({'where':{'phone':_0xf11d3f[_0x5cc8('0xd')],'CampaignId':_0x512394['id']}})['then'](function(_0x2c3fa8){if(!_['isNil'](_0x2c3fa8)){throw new Error(_0x5cc8('0x27')+_0xf11d3f[_0x5cc8('0xd')]+_0x5cc8('0x2e')+_0x512394['id']);}return _0x445b9a[_0x5cc8('0x28')][_0x5cc8('0x21')]({'where':{'calleridnum':_0xf11d3f[_0x5cc8('0xd')],'CampaignId':_0x512394['id']}});})[_0x5cc8('0x1b')](function(_0x1f33ae){if(!_[_0x5cc8('0x18')](_0x1f33ae)){throw new Error(_0x5cc8('0x29')+_0xf11d3f[_0x5cc8('0xd')]+_0x5cc8('0x2f')+_0x512394['id']);}return _0x445b9a[_0x5cc8('0x22')][_0x5cc8('0x23')]({'phone':_0xf11d3f['phone'],'ContactId':_0xf11d3f['id'],'ListId':_0xf11d3f['ListId'],'priority':_0xf11d3f[_0x5cc8('0x24')]?_0xf11d3f[_0x5cc8('0x24')]:0x2,'scheduledat':_0xf11d3f[_0x5cc8('0x15')]?_0xf11d3f[_0x5cc8('0x15')]:moment()['format'](_0x5cc8('0x17')),'callback':_0xf11d3f[_0x5cc8('0x25')]?!![]:![],'callbackuniqueid':_0xf11d3f[_0x5cc8('0x25')]?_0xf11d3f[_0x5cc8('0x25')]:undefined,'callbackat':_0xf11d3f[_0x5cc8('0x25')]?moment()['format'](_0x5cc8('0x17')):undefined,'CampaignId':_0x512394['id']});})[_0x5cc8('0x26')](function(_0x5b7219){_0x4651d4(_0x5b7219);});});});};if(_0xf11d3f[_0x5cc8('0x2b')]){_0x445b9a['VoiceQueue']['findAll']({'where':{'type':_0x5cc8('0x30')},'attributes':['id',_0x5cc8('0x31'),_0x5cc8('0x19')],'include':[{'model':_0x445b9a[_0x5cc8('0x32')],'as':_0x5cc8('0x33'),'where':{'id':_0xf11d3f[_0x5cc8('0x2b')]}}]})[_0x5cc8('0x1b')](function(_0x2503a2){if(_0x2503a2){var _0x2890b9=[];for(var _0x3f4a95=0x0,_0x413762;_0x3f4a95<_0x2503a2[_0x5cc8('0x34')];_0x3f4a95+=0x1){_0x413762=_0x2503a2[_0x3f4a95][_0x5cc8('0x35')]({'plain':!![]});switch(_0x413762[_0x5cc8('0x31')]){case _0x5cc8('0x36'):_0x18dd5c(_0x413762)[_0x5cc8('0x26')](_0x6fd6d7());break;case _0x5cc8('0x37'):_0x56acff(_0x413762)[_0x5cc8('0x26')](_0x6fd6d7());break;default:_0x3a0735(_0x413762,_0xf11d3f)['then'](function(_0x2e4a6c){_0xf11d3f[_0x5cc8('0x15')]=_0x2e4a6c[_0x5cc8('0x20')];_0x445b9a[_0x5cc8('0x22')][_0x5cc8('0x23')]({'phone':_0xf11d3f[_0x5cc8('0xd')],'ContactId':_0xf11d3f['id'],'ListId':_0xf11d3f[_0x5cc8('0x2b')],'scheduledat':_0xf11d3f['scheduledat']?_0xf11d3f[_0x5cc8('0x15')]:moment()[_0x5cc8('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0xf11d3f['priority']?_0xf11d3f[_0x5cc8('0x24')]:0x2,'callback':_0xf11d3f['callbackUniqueid']?!![]:![],'callbackuniqueid':_0xf11d3f['callbackUniqueid']?_0xf11d3f['callbackUniqueid']:undefined,'callbackat':_0xf11d3f[_0x5cc8('0x25')]?moment()[_0x5cc8('0x16')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x413762['id']})['catch'](_0x6fd6d7());});}}}})[_0x5cc8('0x1b')](function(){return _0x445b9a['VoiceQueue'][_0x5cc8('0x38')]({'where':{'type':_0x5cc8('0x30')},'attributes':['id'],'include':[{'model':_0x445b9a[_0x5cc8('0x32')],'as':_0x5cc8('0x39'),'where':{'id':_0xf11d3f[_0x5cc8('0x2b')]}}]})[_0x5cc8('0x1b')](function(_0x117bfd){if(_0x117bfd){var _0x3878f0=[];for(var _0x2532ba=0x0,_0xb691d5;_0x2532ba<_0x117bfd['length'];_0x2532ba+=0x1){_0xb691d5=_0x117bfd[_0x2532ba]['get']({'plain':!![]});_0x445b9a['CmHopperBlack'][_0x5cc8('0x23')]({'phone':_0xf11d3f[_0x5cc8('0xd')],'ContactId':_0xf11d3f['id'],'ListId':_0xf11d3f[_0x5cc8('0x2b')],'VoiceQueueId':_0xb691d5['id']})['catch'](function(_0x369d82){logger['error'](_0x5cc8('0x3a'),_0x5cc8('0x14'),_0x369d82[_0x5cc8('0x3b')]);});}}});})['then'](function(){return _0x445b9a[_0x5cc8('0x3c')]['findAll']({'attributes':['id',_0x5cc8('0x31'),'dialTimezone'],'include':[{'model':_0x445b9a['CmList'],'as':_0x5cc8('0x33'),'where':{'id':_0xf11d3f['ListId']}}]})['then'](function(_0x5bda10){if(_0x5bda10){var _0x2578b8=[];for(var _0x98920=0x0,_0x454f37;_0x98920<_0x5bda10[_0x5cc8('0x34')];_0x98920+=0x1){_0x454f37=_0x5bda10[_0x98920][_0x5cc8('0x35')]({'plain':!![]});switch(_0x454f37[_0x5cc8('0x31')]){case _0x5cc8('0x36'):_0x3a1925(_0x454f37)[_0x5cc8('0x26')](_0x501bf9());break;case _0x5cc8('0x37'):_0x3b1ae7(_0x454f37)[_0x5cc8('0x26')](_0x501bf9());break;default:_0x445b9a[_0x5cc8('0x22')]['create']({'phone':_0xf11d3f[_0x5cc8('0xd')],'ContactId':_0xf11d3f['id'],'ListId':_0xf11d3f[_0x5cc8('0x2b')],'scheduledat':_0xf11d3f['scheduledat']?_0xf11d3f[_0x5cc8('0x15')]:moment()[_0x5cc8('0x16')](_0x5cc8('0x17')),'priority':_0xf11d3f[_0x5cc8('0x24')]?_0xf11d3f[_0x5cc8('0x24')]:0x2,'callback':_0xf11d3f['callbackUniqueid']?!![]:![],'callbackuniqueid':_0xf11d3f[_0x5cc8('0x25')]?_0xf11d3f['callbackUniqueid']:undefined,'callbackat':_0xf11d3f[_0x5cc8('0x25')]?moment()[_0x5cc8('0x16')](_0x5cc8('0x17')):undefined,'CampaignId':_0x454f37['id']})[_0x5cc8('0x26')](_0x501bf9());}}}});})[_0x5cc8('0x1b')](function(){return _0x445b9a['Campaign'][_0x5cc8('0x38')]({'attributes':['id'],'include':[{'model':_0x445b9a[_0x5cc8('0x32')],'as':_0x5cc8('0x39'),'where':{'id':_0xf11d3f[_0x5cc8('0x2b')]}}]})[_0x5cc8('0x1b')](function(_0x1f9c45){if(_0x1f9c45){var _0x4f7459=[];for(var _0x5bf67e=0x0,_0x16a78d;_0x5bf67e<_0x1f9c45[_0x5cc8('0x34')];_0x5bf67e+=0x1){_0x16a78d=_0x1f9c45[_0x5bf67e][_0x5cc8('0x35')]({'plain':!![]});_0x445b9a['CmHopperBlack']['create']({'phone':_0xf11d3f['phone'],'ContactId':_0xf11d3f['id'],'ListId':_0xf11d3f['ListId'],'CampaignId':_0x16a78d['id']})[_0x5cc8('0x26')](function(_0x6ea8ae){logger[_0x5cc8('0x3d')](_0x5cc8('0x3a'),_0x5cc8('0x14'),_0x6ea8ae[_0x5cc8('0x3b')]);});}}});})[_0x5cc8('0x1b')](function(){_0x1bee1b();})[_0x5cc8('0x26')](function(_0x28b169){logger[_0x5cc8('0x3d')](_0x5cc8('0x3a'),_0x5cc8('0x14'),_0x28b169[_0x5cc8('0x3b')]);_0x1bee1b(_0x28b169);});}else{_0x1bee1b(new Error(_0x5cc8('0x3e')));}},'afterDestroy':function(_0xf1c409,_0x28b10a,_0x35612a){var _0x1a92ff=_0x33f3d3['models'];var _0x15b81b=_0xf1c409['get']({'plain':!![]});return _0x1a92ff['CmHopper'][_0x5cc8('0x38')]({'raw':!![],'where':{'ListId':_0x15b81b[_0x5cc8('0x2b')],'ContactId':_0x15b81b['id']}})[_0x5cc8('0x1b')](function(_0x1d2834){if(!_[_0x5cc8('0x3f')](_0x1d2834)){var _0x57ee11=[];for(var _0x317445=0x0;_0x317445<_0x1d2834[_0x5cc8('0x34')];_0x317445+=0x1){var _0x294eb4=_0x1a92ff[_0x5cc8('0x22')][_0x5cc8('0x40')]({'where':{'ListId':_0x1d2834[_0x317445][_0x5cc8('0x2b')],'ContactId':_0x1d2834[_0x317445][_0x5cc8('0x41')],'VoiceQueueId':_0x1d2834[_0x317445][_0x5cc8('0x42')],'CampaignId':_0x1d2834[_0x317445][_0x5cc8('0x43')]}});_0x57ee11['push'](_0x294eb4);}return BPromise['all'](_0x57ee11);}})['then'](function(_0x59234b){logger[_0x5cc8('0x44')](_0x5cc8('0x45'),util[_0x5cc8('0x2c')](_0x59234b,{'showHidden':![],'depth':null}));_0x35612a();})[_0x5cc8('0x26')](function(_0x7529da){logger[_0x5cc8('0x3d')]('[CmContact][afterDestroy][Error]',util[_0x5cc8('0x2c')](_0x7529da,{'showHidden':![],'depth':null}));_0x35612a(_0x7529da);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index e4b2d53..3750cc1 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(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var 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(_0x1bde34,_0x31693f){var _0x2b966b=function(_0x1809de){while(--_0x1809de){_0x1bde34['push'](_0x1bde34['shift']());}};_0x2b966b(++_0x31693f);}(_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 5a03776..ff6dafa 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 _0xcabc=['INTEGER','STRING','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xcabc,0x16a));var _0xccab=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xcabc[_0x46698a];return _0x356db0;};'use strict';var Sequelize=require('sequelize');module[_0xccab('0x0')]={'CmContactId':{'type':Sequelize[_0xccab('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0xccab('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xccab('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xccab('0x2')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0xccab('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0xccab('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0xde56=['sequelize','INTEGER','STRING','PHONE'];(function(_0x2bb1fe,_0x4ec16a){var _0x4e7e01=function(_0x27eb3a){while(--_0x27eb3a){_0x2bb1fe['push'](_0x2bb1fe['shift']());}};_0x4e7e01(++_0x4ec16a);}(_0xde56,0x144));var _0x6de5=function(_0x514260,_0x1891e1){_0x514260=_0x514260-0x0;var _0x4ac81b=_0xde56[_0x514260];return _0x4ac81b;};'use strict';var Sequelize=require(_0x6de5('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0x6de5('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x6de5('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x6de5('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x6de5('0x2')],'defaultValue':_0x6de5('0x3')},'OrderBy':{'type':Sequelize[_0x6de5('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0x6de5('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 5a10134..f3029b7 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 _0x58d1=['sox','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','get','UserProfileResource','end','error','name','send','index','CmContactHasItem','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0x58d1,0xa1));var _0x158d=function(_0x146ef3,_0x1c7bb0){_0x146ef3=_0x146ef3-0x0;var _0x5d9bae=_0x58d1[_0x146ef3];return _0x5d9bae;};'use strict';var emlformat=require(_0x158d('0x0'));var rimraf=require(_0x158d('0x1'));var zipdir=require(_0x158d('0x2'));var jsonpatch=require(_0x158d('0x3'));var rp=require(_0x158d('0x4'));var moment=require('moment');var BPromise=require(_0x158d('0x5'));var Mustache=require(_0x158d('0x6'));var util=require(_0x158d('0x7'));var path=require(_0x158d('0x8'));var sox=require(_0x158d('0x9'));var csv=require('to-csv');var ejs=require(_0x158d('0xa'));var fs=require('fs');var fs_extra=require(_0x158d('0xb'));var _=require(_0x158d('0xc'));var squel=require(_0x158d('0xd'));var crypto=require(_0x158d('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x158d('0xf'));var Papa=require(_0x158d('0x10'));var Redis=require(_0x158d('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x158d('0x12'));var hardwareService=require(_0x158d('0x13'));var logger=require(_0x158d('0x14'))(_0x158d('0x15'));var utils=require(_0x158d('0x16'));var config=require(_0x158d('0x17'));var licenseUtil=require(_0x158d('0x18'));var db=require(_0x158d('0x19'))['db'];function respondWithStatusCode(_0x18a873,_0x3e092e){_0x3e092e=_0x3e092e||0xcc;return function(_0x4f086f){if(_0x4f086f){return _0x18a873[_0x158d('0x1a')](_0x3e092e);}return _0x18a873[_0x158d('0x1b')](_0x3e092e)['end']();};}function respondWithResult(_0x259410,_0x2f0214){_0x2f0214=_0x2f0214||0xc8;return function(_0x3bebe0){if(_0x3bebe0){return _0x259410[_0x158d('0x1b')](_0x2f0214)[_0x158d('0x1c')](_0x3bebe0);}};}function respondWithFilteredResult(_0x2f83f7,_0x925b8c){return function(_0x5a3e63){if(_0x5a3e63){var _0x2cc0af=typeof _0x925b8c[_0x158d('0x1d')]===_0x158d('0x1e')&&typeof _0x925b8c[_0x158d('0x1f')]===_0x158d('0x1e');var _0x81ded=_0x5a3e63[_0x158d('0x20')];var _0x313017=_0x2cc0af?0x0:_0x925b8c[_0x158d('0x1d')];var _0x57dda9=_0x2cc0af?_0x5a3e63[_0x158d('0x20')]:_0x925b8c['offset']+_0x925b8c[_0x158d('0x1f')];var _0x3c2bb5;if(_0x57dda9>=_0x81ded){_0x57dda9=_0x81ded;_0x3c2bb5=0xc8;}else{_0x3c2bb5=0xce;}_0x2f83f7[_0x158d('0x1b')](_0x3c2bb5);return _0x2f83f7[_0x158d('0x21')]('Content-Range',_0x313017+'-'+_0x57dda9+'/'+_0x81ded)[_0x158d('0x1c')](_0x5a3e63);}return null;};}function patchUpdates(_0x1b4963){return function(_0x2dea55){try{jsonpatch[_0x158d('0x22')](_0x2dea55,_0x1b4963,!![]);}catch(_0x3e3fed){return BPromise[_0x158d('0x23')](_0x3e3fed);}return _0x2dea55[_0x158d('0x24')]();};}function saveUpdates(_0x45f819,_0x2a88e5){return function(_0x2ded7d){if(_0x2ded7d){return _0x2ded7d['update'](_0x45f819)['then'](function(_0x30ed44){return _0x30ed44;});}return null;};}function removeEntity(_0x1888bd,_0x1a6c83){return function(_0x4a24b6){if(_0x4a24b6){return _0x4a24b6[_0x158d('0x25')]()[_0x158d('0x26')](function(){var _0xa7b2b1=_0x4a24b6[_0x158d('0x27')]({'plain':!![]});var _0x46aa4b='CmContactHasItems';return db[_0x158d('0x28')][_0x158d('0x25')]({'where':{'type':_0x46aa4b,'resourceId':_0xa7b2b1['id']}})[_0x158d('0x26')](function(){return _0x4a24b6;});})[_0x158d('0x26')](function(){_0x1888bd[_0x158d('0x1b')](0xcc)[_0x158d('0x29')]();});}};}function handleEntityNotFound(_0x2e5894,_0x2c8329){return function(_0x169457){if(!_0x169457){_0x2e5894['sendStatus'](0x194);}return _0x169457;};}function handleError(_0x1e376a,_0x57efec){_0x57efec=_0x57efec||0x1f4;return function(_0x4ec76b){logger[_0x158d('0x2a')](_0x4ec76b['stack']);if(_0x4ec76b[_0x158d('0x2b')]){delete _0x4ec76b['name'];}_0x1e376a[_0x158d('0x1b')](_0x57efec)[_0x158d('0x2c')](_0x4ec76b);};}exports[_0x158d('0x2d')]=function(_0x1172ca,_0x1b2390){var _0x22bf00={},_0x5b325b={},_0x1bcef6={'count':0x0,'rows':[]};var _0x5b9126=_['map'](db[_0x158d('0x2e')][_0x158d('0x2f')],function(_0x254c14){return{'name':_0x254c14[_0x158d('0x30')],'type':_0x254c14[_0x158d('0x31')][_0x158d('0x32')]};});_0x5b325b['model']=_[_0x158d('0x33')](_0x5b9126,_0x158d('0x2b'));_0x5b325b[_0x158d('0x34')]=_[_0x158d('0x35')](_0x1172ca['query']);_0x5b325b['filters']=_[_0x158d('0x36')](_0x5b325b[_0x158d('0x37')],_0x5b325b['query']);_0x22bf00[_0x158d('0x38')]=_[_0x158d('0x36')](_0x5b325b[_0x158d('0x37')],qs[_0x158d('0x39')](_0x1172ca[_0x158d('0x34')]['fields']));_0x22bf00[_0x158d('0x38')]=_0x22bf00['attributes'][_0x158d('0x3a')]?_0x22bf00[_0x158d('0x38')]:_0x5b325b['model'];if(!_0x1172ca['query'][_0x158d('0x3b')](_0x158d('0x3c'))){_0x22bf00[_0x158d('0x1f')]=qs['limit'](_0x1172ca['query'][_0x158d('0x1f')]);_0x22bf00[_0x158d('0x1d')]=qs['offset'](_0x1172ca[_0x158d('0x34')][_0x158d('0x1d')]);}_0x22bf00[_0x158d('0x3d')]=qs[_0x158d('0x3e')](_0x1172ca['query'][_0x158d('0x3e')]);_0x22bf00[_0x158d('0x3f')]=qs[_0x158d('0x40')](_[_0x158d('0x41')](_0x1172ca[_0x158d('0x34')],_0x5b325b['filters']),_0x5b9126);if(_0x1172ca[_0x158d('0x34')][_0x158d('0x42')]){_0x22bf00['where']=_['merge'](_0x22bf00[_0x158d('0x3f')],{'$or':_['map'](_0x5b9126,function(_0x289843){if(_0x289843['type']!=='VIRTUAL'){var _0x4f253d={};_0x4f253d[_0x289843['name']]={'$like':'%'+_0x1172ca[_0x158d('0x34')][_0x158d('0x42')]+'%'};return _0x4f253d;}})});}_0x22bf00=_[_0x158d('0x43')]({},_0x22bf00,_0x1172ca[_0x158d('0x44')]);var _0x291047={'where':_0x22bf00['where']};return db['CmContactHasItem'][_0x158d('0x20')](_0x291047)[_0x158d('0x26')](function(_0x2cae09){_0x1bcef6[_0x158d('0x20')]=_0x2cae09;if(_0x1172ca[_0x158d('0x34')][_0x158d('0x45')]){_0x22bf00[_0x158d('0x46')]=[{'all':!![]}];}return db[_0x158d('0x2e')][_0x158d('0x47')](_0x22bf00);})[_0x158d('0x26')](function(_0x4bfca8){_0x1bcef6[_0x158d('0x48')]=_0x4bfca8;return _0x1bcef6;})[_0x158d('0x26')](respondWithFilteredResult(_0x1b2390,_0x22bf00))[_0x158d('0x49')](handleError(_0x1b2390,null));};exports[_0x158d('0x4a')]=function(_0x39303d,_0x40e9ea){var _0x5f15c4={'raw':!![],'where':{'id':_0x39303d[_0x158d('0x4b')]['id']}},_0x1af54f={};_0x1af54f[_0x158d('0x37')]=_['keys'](db[_0x158d('0x2e')]['rawAttributes']);_0x1af54f['query']=_['keys'](_0x39303d[_0x158d('0x34')]);_0x1af54f['filters']=_['intersection'](_0x1af54f[_0x158d('0x37')],_0x1af54f['query']);_0x5f15c4[_0x158d('0x38')]=_['intersection'](_0x1af54f[_0x158d('0x37')],qs[_0x158d('0x39')](_0x39303d[_0x158d('0x34')][_0x158d('0x39')]));_0x5f15c4['attributes']=_0x5f15c4[_0x158d('0x38')][_0x158d('0x3a')]?_0x5f15c4[_0x158d('0x38')]:_0x1af54f[_0x158d('0x37')];if(_0x39303d['query'][_0x158d('0x45')]){_0x5f15c4[_0x158d('0x46')]=[{'all':!![]}];}_0x5f15c4=_['merge']({},_0x5f15c4,_0x39303d[_0x158d('0x44')]);return db[_0x158d('0x2e')][_0x158d('0x4c')](_0x5f15c4)[_0x158d('0x26')](handleEntityNotFound(_0x40e9ea,null))[_0x158d('0x26')](respondWithResult(_0x40e9ea,null))[_0x158d('0x49')](handleError(_0x40e9ea,null));};exports[_0x158d('0x4d')]=function(_0x26c148,_0x252e7a){return db['CmContactHasItem'][_0x158d('0x4d')](_0x26c148['body'],{})[_0x158d('0x26')](function(_0x436739){var _0x43b5a3=_0x26c148[_0x158d('0x4e')][_0x158d('0x27')]({'plain':!![]});if(!_0x43b5a3)throw new Error(_0x158d('0x4f'));if(_0x43b5a3['role']===_0x158d('0x4e')){var _0x98b9fb=_0x436739['get']({'plain':!![]});var _0x116339='CmContactHasItems';return db['UserProfileSection'][_0x158d('0x4c')]({'where':{'name':_0x116339,'userProfileId':_0x43b5a3[_0x158d('0x50')]},'raw':!![]})[_0x158d('0x26')](function(_0x256bc8){if(_0x256bc8&&_0x256bc8[_0x158d('0x51')]===0x0){return db[_0x158d('0x28')][_0x158d('0x4d')]({'name':_0x98b9fb[_0x158d('0x2b')],'resourceId':_0x98b9fb['id'],'type':_0x256bc8[_0x158d('0x2b')],'sectionId':_0x256bc8['id']},{})[_0x158d('0x26')](function(){return _0x436739;});}else{return _0x436739;}})['catch'](function(_0x2a23aa){logger[_0x158d('0x2a')](_0x158d('0x52'),_0x2a23aa);throw _0x2a23aa;});}return _0x436739;})[_0x158d('0x26')](respondWithResult(_0x252e7a,0xc9))[_0x158d('0x49')](handleError(_0x252e7a,null));};exports[_0x158d('0x53')]=function(_0x4256cc,_0xd0d7){if(_0x4256cc['body']['id']){delete _0x4256cc[_0x158d('0x54')]['id'];}return db[_0x158d('0x2e')]['find']({'where':{'id':_0x4256cc[_0x158d('0x4b')]['id']}})['then'](handleEntityNotFound(_0xd0d7,null))['then'](saveUpdates(_0x4256cc['body'],null))[_0x158d('0x26')](respondWithResult(_0xd0d7,null))['catch'](handleError(_0xd0d7,null));};exports[_0x158d('0x25')]=function(_0x407c61,_0x2c2102){return db['CmContactHasItem']['find']({'where':{'id':_0x407c61[_0x158d('0x4b')]['id']}})[_0x158d('0x26')](handleEntityNotFound(_0x2c2102,null))[_0x158d('0x26')](removeEntity(_0x2c2102,null))[_0x158d('0x49')](handleError(_0x2c2102,null));}; \ No newline at end of file +var _0xe218=['pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','rawAttributes','length','find','create','body','role','user','UserProfileSection','params','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','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','offset','undefined','limit','count','set','Content-Range','json','save','update','then','get','CmContactHasItems','destroy','error','stack','name','index','map','CmContactHasItem','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x1a5090,_0x4d2494){var _0x103f0b=function(_0x4d2357){while(--_0x4d2357){_0x1a5090['push'](_0x1a5090['shift']());}};_0x103f0b(++_0x4d2494);}(_0xe218,0x100));var _0x8e21=function(_0x2cfb48,_0x24b83b){_0x2cfb48=_0x2cfb48-0x0;var _0xc4594f=_0xe218[_0x2cfb48];return _0xc4594f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8e21('0x0'));var zipdir=require(_0x8e21('0x1'));var jsonpatch=require(_0x8e21('0x2'));var rp=require('request-promise');var moment=require(_0x8e21('0x3'));var BPromise=require(_0x8e21('0x4'));var Mustache=require(_0x8e21('0x5'));var util=require(_0x8e21('0x6'));var path=require('path');var sox=require(_0x8e21('0x7'));var csv=require(_0x8e21('0x8'));var ejs=require(_0x8e21('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8e21('0xa'));var crypto=require(_0x8e21('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8e21('0x8'));var querystring=require('querystring');var Papa=require(_0x8e21('0xc'));var Redis=require(_0x8e21('0xd'));var authService=require(_0x8e21('0xe'));var qs=require(_0x8e21('0xf'));var as=require(_0x8e21('0x10'));var hardwareService=require(_0x8e21('0x11'));var logger=require(_0x8e21('0x12'))(_0x8e21('0x13'));var utils=require('../../config/utils');var config=require(_0x8e21('0x14'));var licenseUtil=require(_0x8e21('0x15'));var db=require(_0x8e21('0x16'))['db'];function respondWithStatusCode(_0x10b1b0,_0x1381e5){_0x1381e5=_0x1381e5||0xcc;return function(_0x34a434){if(_0x34a434){return _0x10b1b0[_0x8e21('0x17')](_0x1381e5);}return _0x10b1b0[_0x8e21('0x18')](_0x1381e5)[_0x8e21('0x19')]();};}function respondWithResult(_0x48a1ca,_0x1e2e14){_0x1e2e14=_0x1e2e14||0xc8;return function(_0x56657a){if(_0x56657a){return _0x48a1ca[_0x8e21('0x18')](_0x1e2e14)['json'](_0x56657a);}};}function respondWithFilteredResult(_0x342d68,_0x4ccdac){return function(_0xa620f5){if(_0xa620f5){var _0x3a5390=typeof _0x4ccdac[_0x8e21('0x1a')]===_0x8e21('0x1b')&&typeof _0x4ccdac[_0x8e21('0x1c')]===_0x8e21('0x1b');var _0x26b028=_0xa620f5['count'];var _0x963b18=_0x3a5390?0x0:_0x4ccdac[_0x8e21('0x1a')];var _0xced726=_0x3a5390?_0xa620f5[_0x8e21('0x1d')]:_0x4ccdac[_0x8e21('0x1a')]+_0x4ccdac[_0x8e21('0x1c')];var _0x2a8318;if(_0xced726>=_0x26b028){_0xced726=_0x26b028;_0x2a8318=0xc8;}else{_0x2a8318=0xce;}_0x342d68[_0x8e21('0x18')](_0x2a8318);return _0x342d68[_0x8e21('0x1e')](_0x8e21('0x1f'),_0x963b18+'-'+_0xced726+'/'+_0x26b028)[_0x8e21('0x20')](_0xa620f5);}return null;};}function patchUpdates(_0x1c15bb){return function(_0xdf5caf){try{jsonpatch['apply'](_0xdf5caf,_0x1c15bb,!![]);}catch(_0x4e5567){return BPromise['reject'](_0x4e5567);}return _0xdf5caf[_0x8e21('0x21')]();};}function saveUpdates(_0x2e4d00,_0x30aaef){return function(_0xd32378){if(_0xd32378){return _0xd32378[_0x8e21('0x22')](_0x2e4d00)['then'](function(_0x582b97){return _0x582b97;});}return null;};}function removeEntity(_0x54d4d8,_0x209b44){return function(_0x14ed32){if(_0x14ed32){return _0x14ed32['destroy']()[_0x8e21('0x23')](function(){var _0x3b32b8=_0x14ed32[_0x8e21('0x24')]({'plain':!![]});var _0xc6b550=_0x8e21('0x25');return db['UserProfileResource'][_0x8e21('0x26')]({'where':{'type':_0xc6b550,'resourceId':_0x3b32b8['id']}})[_0x8e21('0x23')](function(){return _0x14ed32;});})[_0x8e21('0x23')](function(){_0x54d4d8[_0x8e21('0x18')](0xcc)[_0x8e21('0x19')]();});}};}function handleEntityNotFound(_0x21b443,_0x4a044e){return function(_0x331bac){if(!_0x331bac){_0x21b443[_0x8e21('0x17')](0x194);}return _0x331bac;};}function handleError(_0x2d62ec,_0x465fbc){_0x465fbc=_0x465fbc||0x1f4;return function(_0xa50a56){logger[_0x8e21('0x27')](_0xa50a56[_0x8e21('0x28')]);if(_0xa50a56[_0x8e21('0x29')]){delete _0xa50a56[_0x8e21('0x29')];}_0x2d62ec[_0x8e21('0x18')](_0x465fbc)['send'](_0xa50a56);};}exports[_0x8e21('0x2a')]=function(_0x219c02,_0x4ec711){var _0x339bbe={},_0x97d806={},_0x3f00c1={'count':0x0,'rows':[]};var _0x72d22a=_[_0x8e21('0x2b')](db[_0x8e21('0x2c')]['rawAttributes'],function(_0x3abc84){return{'name':_0x3abc84[_0x8e21('0x2d')],'type':_0x3abc84[_0x8e21('0x2e')][_0x8e21('0x2f')]};});_0x97d806[_0x8e21('0x30')]=_[_0x8e21('0x2b')](_0x72d22a,_0x8e21('0x29'));_0x97d806[_0x8e21('0x31')]=_[_0x8e21('0x32')](_0x219c02[_0x8e21('0x31')]);_0x97d806[_0x8e21('0x33')]=_['intersection'](_0x97d806[_0x8e21('0x30')],_0x97d806['query']);_0x339bbe[_0x8e21('0x34')]=_[_0x8e21('0x35')](_0x97d806['model'],qs[_0x8e21('0x36')](_0x219c02['query']['fields']));_0x339bbe[_0x8e21('0x34')]=_0x339bbe[_0x8e21('0x34')]['length']?_0x339bbe[_0x8e21('0x34')]:_0x97d806[_0x8e21('0x30')];if(!_0x219c02[_0x8e21('0x31')][_0x8e21('0x37')](_0x8e21('0x38'))){_0x339bbe[_0x8e21('0x1c')]=qs['limit'](_0x219c02[_0x8e21('0x31')][_0x8e21('0x1c')]);_0x339bbe['offset']=qs['offset'](_0x219c02['query']['offset']);}_0x339bbe[_0x8e21('0x39')]=qs[_0x8e21('0x3a')](_0x219c02[_0x8e21('0x31')][_0x8e21('0x3a')]);_0x339bbe[_0x8e21('0x3b')]=qs['filters'](_[_0x8e21('0x3c')](_0x219c02['query'],_0x97d806['filters']),_0x72d22a);if(_0x219c02['query'][_0x8e21('0x3d')]){_0x339bbe['where']=_['merge'](_0x339bbe[_0x8e21('0x3b')],{'$or':_[_0x8e21('0x2b')](_0x72d22a,function(_0x3a0677){if(_0x3a0677[_0x8e21('0x2e')]!==_0x8e21('0x3e')){var _0x5d92e7={};_0x5d92e7[_0x3a0677['name']]={'$like':'%'+_0x219c02[_0x8e21('0x31')][_0x8e21('0x3d')]+'%'};return _0x5d92e7;}})});}_0x339bbe=_[_0x8e21('0x3f')]({},_0x339bbe,_0x219c02[_0x8e21('0x40')]);var _0x1112f8={'where':_0x339bbe['where']};return db[_0x8e21('0x2c')][_0x8e21('0x1d')](_0x1112f8)[_0x8e21('0x23')](function(_0x2c62ab){_0x3f00c1[_0x8e21('0x1d')]=_0x2c62ab;if(_0x219c02[_0x8e21('0x31')][_0x8e21('0x41')]){_0x339bbe[_0x8e21('0x42')]=[{'all':!![]}];}return db[_0x8e21('0x2c')]['findAll'](_0x339bbe);})[_0x8e21('0x23')](function(_0x5c46a4){_0x3f00c1[_0x8e21('0x43')]=_0x5c46a4;return _0x3f00c1;})['then'](respondWithFilteredResult(_0x4ec711,_0x339bbe))[_0x8e21('0x44')](handleError(_0x4ec711,null));};exports[_0x8e21('0x45')]=function(_0x56bab8,_0x275ed6){var _0x2fbd1c={'raw':!![],'where':{'id':_0x56bab8['params']['id']}},_0xa183ce={};_0xa183ce[_0x8e21('0x30')]=_[_0x8e21('0x32')](db['CmContactHasItem'][_0x8e21('0x46')]);_0xa183ce['query']=_['keys'](_0x56bab8['query']);_0xa183ce[_0x8e21('0x33')]=_['intersection'](_0xa183ce[_0x8e21('0x30')],_0xa183ce[_0x8e21('0x31')]);_0x2fbd1c[_0x8e21('0x34')]=_[_0x8e21('0x35')](_0xa183ce['model'],qs[_0x8e21('0x36')](_0x56bab8[_0x8e21('0x31')]['fields']));_0x2fbd1c['attributes']=_0x2fbd1c['attributes'][_0x8e21('0x47')]?_0x2fbd1c[_0x8e21('0x34')]:_0xa183ce[_0x8e21('0x30')];if(_0x56bab8[_0x8e21('0x31')]['includeAll']){_0x2fbd1c[_0x8e21('0x42')]=[{'all':!![]}];}_0x2fbd1c=_['merge']({},_0x2fbd1c,_0x56bab8[_0x8e21('0x40')]);return db[_0x8e21('0x2c')][_0x8e21('0x48')](_0x2fbd1c)[_0x8e21('0x23')](handleEntityNotFound(_0x275ed6,null))[_0x8e21('0x23')](respondWithResult(_0x275ed6,null))[_0x8e21('0x44')](handleError(_0x275ed6,null));};exports[_0x8e21('0x49')]=function(_0xf75945,_0x5fc29d){return db[_0x8e21('0x2c')][_0x8e21('0x49')](_0xf75945[_0x8e21('0x4a')],{})[_0x8e21('0x23')](function(_0x4d8377){var _0x57aae9=_0xf75945['user'][_0x8e21('0x24')]({'plain':!![]});if(!_0x57aae9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x57aae9[_0x8e21('0x4b')]===_0x8e21('0x4c')){var _0x5e0703=_0x4d8377[_0x8e21('0x24')]({'plain':!![]});var _0x43f0f2=_0x8e21('0x25');return db[_0x8e21('0x4d')]['find']({'where':{'name':_0x43f0f2,'userProfileId':_0x57aae9['userProfileId']},'raw':!![]})[_0x8e21('0x23')](function(_0x360679){if(_0x360679&&_0x360679['autoAssociation']===0x0){return db['UserProfileResource'][_0x8e21('0x49')]({'name':_0x5e0703[_0x8e21('0x29')],'resourceId':_0x5e0703['id'],'type':_0x360679[_0x8e21('0x29')],'sectionId':_0x360679['id']},{})[_0x8e21('0x23')](function(){return _0x4d8377;});}else{return _0x4d8377;}})[_0x8e21('0x44')](function(_0x5ec90e){logger[_0x8e21('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5ec90e);throw _0x5ec90e;});}return _0x4d8377;})[_0x8e21('0x23')](respondWithResult(_0x5fc29d,0xc9))[_0x8e21('0x44')](handleError(_0x5fc29d,null));};exports[_0x8e21('0x22')]=function(_0x4ec2f5,_0x24de62){if(_0x4ec2f5['body']['id']){delete _0x4ec2f5[_0x8e21('0x4a')]['id'];}return db['CmContactHasItem'][_0x8e21('0x48')]({'where':{'id':_0x4ec2f5[_0x8e21('0x4e')]['id']}})['then'](handleEntityNotFound(_0x24de62,null))[_0x8e21('0x23')](saveUpdates(_0x4ec2f5[_0x8e21('0x4a')],null))['then'](respondWithResult(_0x24de62,null))[_0x8e21('0x44')](handleError(_0x24de62,null));};exports['destroy']=function(_0x294273,_0x371aa3){return db[_0x8e21('0x2c')][_0x8e21('0x48')]({'where':{'id':_0x294273[_0x8e21('0x4e')]['id']}})[_0x8e21('0x23')](handleEntityNotFound(_0x371aa3,null))[_0x8e21('0x23')](removeEntity(_0x371aa3,null))[_0x8e21('0x44')](handleError(_0x371aa3,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 3e78ece..536ef2a 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 _0x86ee=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x86ee,0x1d9));var _0xe86e=function(_0x39772f,_0x5605cb){_0x39772f=_0x39772f-0x0;var _0xc9edbf=_0x86ee[_0x39772f];return _0xc9edbf;};'use strict';var _=require(_0xe86e('0x0'));var util=require(_0xe86e('0x1'));var logger=require(_0xe86e('0x2'))(_0xe86e('0x3'));var moment=require(_0xe86e('0x4'));var BPromise=require(_0xe86e('0x5'));var rp=require(_0xe86e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe86e('0x7'));var config=require(_0xe86e('0x8'));var attributes=require(_0xe86e('0x9'));module[_0xe86e('0xa')]=function(_0x528244,_0xe05020){return _0x528244[_0xe86e('0xb')](_0xe86e('0xc'),attributes,{'tableName':_0xe86e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe8a3=['bluebird','request-promise','./cmContactHasItem.attributes','define','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger','api','moment'];(function(_0x564d32,_0x559577){var _0x282aa9=function(_0x24858e){while(--_0x24858e){_0x564d32['push'](_0x564d32['shift']());}};_0x282aa9(++_0x559577);}(_0xe8a3,0x7f));var _0x3e8a=function(_0x3c3313,_0x1ea90d){_0x3c3313=_0x3c3313-0x0;var _0xb947aa=_0xe8a3[_0x3c3313];return _0xb947aa;};'use strict';var _=require(_0x3e8a('0x0'));var util=require(_0x3e8a('0x1'));var logger=require(_0x3e8a('0x2'))(_0x3e8a('0x3'));var moment=require(_0x3e8a('0x4'));var BPromise=require(_0x3e8a('0x5'));var rp=require(_0x3e8a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3e8a('0x7'));module['exports']=function(_0x132350,_0x1a2487){return _0x132350[_0x3e8a('0x8')](_0x3e8a('0x9'),attributes,{'tableName':_0x3e8a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index d21b070..3fc7a77 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 _0xf7a7=['info','request\x20sent','error','code','message','CmContactHasItem,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x20790f,_0x36e596){var _0x4df7ec=function(_0x49e951){while(--_0x49e951){_0x20790f['push'](_0x20790f['shift']());}};_0x4df7ec(++_0x36e596);}(_0xf7a7,0x7b));var _0x7f7a=function(_0x4cb29e,_0x4fcb34){_0x4cb29e=_0x4cb29e-0x0;var _0x508ea=_0xf7a7[_0x4cb29e];return _0x508ea;};'use strict';var _=require(_0x7f7a('0x0'));var util=require(_0x7f7a('0x1'));var moment=require(_0x7f7a('0x2'));var BPromise=require(_0x7f7a('0x3'));var rs=require(_0x7f7a('0x4'));var fs=require('fs');var Redis=require(_0x7f7a('0x5'));var db=require(_0x7f7a('0x6'))['db'];var utils=require(_0x7f7a('0x7'));var logger=require(_0x7f7a('0x8'))('rpc');var config=require(_0x7f7a('0x9'));var jayson=require(_0x7f7a('0xa'));var client=jayson[_0x7f7a('0xb')][_0x7f7a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x26c7a2,_0xb6e77,_0x27748a){return new BPromise(function(_0x3f2749,_0x1768e4){return client[_0x7f7a('0xd')](_0x26c7a2,_0x27748a)[_0x7f7a('0xe')](function(_0xff852f){logger[_0x7f7a('0xf')]('CmContactHasItem,\x20%s,\x20%s',_0xb6e77,_0x7f7a('0x10'));logger['debug']('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0xb6e77,'request\x20sent',JSON['stringify'](_0xff852f));if(_0xff852f[_0x7f7a('0x11')]){if(_0xff852f['error'][_0x7f7a('0x12')]===0x1f4){logger[_0x7f7a('0x11')]('CmContactHasItem,\x20%s,\x20%s',_0xb6e77,_0xff852f[_0x7f7a('0x11')]['message']);return _0x1768e4(_0xff852f[_0x7f7a('0x11')][_0x7f7a('0x13')]);}logger[_0x7f7a('0x11')](_0x7f7a('0x14'),_0xb6e77,_0xff852f['error']['message']);return _0x3f2749(_0xff852f['error'][_0x7f7a('0x13')]);}else{logger['info']('CmContactHasItem,\x20%s,\x20%s',_0xb6e77,_0x7f7a('0x10'));_0x3f2749(_0xff852f[_0x7f7a('0x15')][_0x7f7a('0x13')]);}})[_0x7f7a('0x16')](function(_0x2f3524){logger[_0x7f7a('0x11')](_0x7f7a('0x14'),_0xb6e77,_0x2f3524);_0x1768e4(_0x2f3524);});});} \ No newline at end of file +var _0x0df5=['request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','CmContactHasItem,\x20%s,\x20%s,\x20%s','error','message','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x386b03,_0x5d0000){var _0xd3d524=function(_0x474754){while(--_0x474754){_0x386b03['push'](_0x386b03['shift']());}};_0xd3d524(++_0x5d0000);}(_0x0df5,0x1e8));var _0x50df=function(_0x46b405,_0x1ce86b){_0x46b405=_0x46b405-0x0;var _0x31727f=_0x0df5[_0x46b405];return _0x31727f;};'use strict';var _=require(_0x50df('0x0'));var util=require(_0x50df('0x1'));var moment=require(_0x50df('0x2'));var BPromise=require(_0x50df('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x50df('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x50df('0x5'));var logger=require(_0x50df('0x6'))(_0x50df('0x7'));var config=require(_0x50df('0x8'));var jayson=require(_0x50df('0x9'));var client=jayson[_0x50df('0xa')][_0x50df('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a307b,_0x51e140,_0x524528){return new BPromise(function(_0x5ee949,_0xc7e649){return client[_0x50df('0xc')](_0x2a307b,_0x524528)[_0x50df('0xd')](function(_0x1f7d6a){logger[_0x50df('0xe')](_0x50df('0xf'),_0x51e140,_0x50df('0x10'));logger['debug'](_0x50df('0x11'),_0x51e140,_0x50df('0x10'),JSON['stringify'](_0x1f7d6a));if(_0x1f7d6a[_0x50df('0x12')]){if(_0x1f7d6a['error']['code']===0x1f4){logger['error'](_0x50df('0xf'),_0x51e140,_0x1f7d6a[_0x50df('0x12')]['message']);return _0xc7e649(_0x1f7d6a[_0x50df('0x12')][_0x50df('0x13')]);}logger[_0x50df('0x12')](_0x50df('0xf'),_0x51e140,_0x1f7d6a['error'][_0x50df('0x13')]);return _0x5ee949(_0x1f7d6a['error'][_0x50df('0x13')]);}else{logger[_0x50df('0xe')](_0x50df('0xf'),_0x51e140,_0x50df('0x10'));_0x5ee949(_0x1f7d6a['result'][_0x50df('0x13')]);}})['catch'](function(_0x1af340){logger['error'](_0x50df('0xf'),_0x51e140,_0x1af340);_0xc7e649(_0x1af340);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index e5874f4..a08494f 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 _0x1a80=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','put','update','destroy'];(function(_0x38bbbc,_0x521d0d){var _0xabf156=function(_0x27f5ca){while(--_0x27f5ca){_0x38bbbc['push'](_0x38bbbc['shift']());}};_0xabf156(++_0x521d0d);}(_0x1a80,0x111));var _0x01a8=function(_0x2da1ee,_0x4d11b2){_0x2da1ee=_0x2da1ee-0x0;var _0x597680=_0x1a80[_0x2da1ee];return _0x597680;};'use strict';var multer=require(_0x01a8('0x0'));var util=require(_0x01a8('0x1'));var path=require(_0x01a8('0x2'));var timeout=require(_0x01a8('0x3'));var express=require('express');var router=express[_0x01a8('0x4')]();var fs_extra=require(_0x01a8('0x5'));var auth=require(_0x01a8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x01a8('0x7'));var controller=require('./cmContactHasItem.controller');router[_0x01a8('0x8')]('/',auth[_0x01a8('0x9')](),controller['index']);router[_0x01a8('0x8')](_0x01a8('0xa'),auth[_0x01a8('0x9')](),controller[_0x01a8('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x01a8('0xc')](_0x01a8('0xa'),auth['isAuthenticated'](),controller[_0x01a8('0xd')]);router['delete'](_0x01a8('0xa'),auth['isAuthenticated'](),controller[_0x01a8('0xe')]);module[_0x01a8('0xf')]=router; \ No newline at end of file +var _0x9490=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','show'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x9490,0x148));var _0x0949=function(_0xe020dc,_0x47e9c9){_0xe020dc=_0xe020dc-0x0;var _0xc2f88e=_0x9490[_0xe020dc];return _0xc2f88e;};'use strict';var multer=require(_0x0949('0x0'));var util=require(_0x0949('0x1'));var path=require(_0x0949('0x2'));var timeout=require(_0x0949('0x3'));var express=require('express');var router=express[_0x0949('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0949('0x5'));var interaction=require(_0x0949('0x6'));var config=require(_0x0949('0x7'));var controller=require(_0x0949('0x8'));router[_0x0949('0x9')]('/',auth[_0x0949('0xa')](),controller[_0x0949('0xb')]);router[_0x0949('0x9')](_0x0949('0xc'),auth['isAuthenticated'](),controller[_0x0949('0xd')]);router['post']('/',auth[_0x0949('0xa')](),controller['create']);router[_0x0949('0xe')](_0x0949('0xc'),auth[_0x0949('0xa')](),controller[_0x0949('0xf')]);router[_0x0949('0x10')](_0x0949('0xc'),auth[_0x0949('0xa')](),controller[_0x0949('0x11')]);module[_0x0949('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index ca7faa9..fecfbb3 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 _0x3286=['TEXT','type','setDataValue','values','stringify','BOOLEAN','lodash','getDataValue','STRING','name'];(function(_0x5f472a,_0x58837b){var _0x52be8d=function(_0x20b760){while(--_0x20b760){_0x5f472a['push'](_0x5f472a['shift']());}};_0x52be8d(++_0x58837b);}(_0x3286,0x88));var _0x6328=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3286[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');var _=require(_0x6328('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x26c951){return this[_0x6328('0x1')]('alias');}},'alias':{'type':Sequelize[_0x6328('0x2')],'allowNull':![],'set':function(_0x2f5c61){this['setDataValue']('alias',_0x2f5c61?_0x2f5c61:this[_0x6328('0x1')](_0x6328('0x3')));}},'type':{'type':Sequelize[_0x6328('0x2')],'allowNull':![]},'values':{'type':Sequelize[_0x6328('0x4')]('long'),'get':function(){if(this[_0x6328('0x1')](_0x6328('0x5'))==='select'){return JSON['parse'](this['getDataValue']('values'));}else{return this[_0x6328('0x1')]('values');}},'set':function(_0x300a4b){if(Array['isArray'](_0x300a4b)){this[_0x6328('0x6')](_0x6328('0x7'),JSON[_0x6328('0x8')](_0x300a4b));}else{this['setDataValue'](_0x6328('0x7'),_0x300a4b);}}},'required':{'type':Sequelize[_0x6328('0x9')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x6328('0x9')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM']('voice')}}; \ No newline at end of file +var _0x3822=['TEXT','long','type','select','parse','values','isArray','setDataValue','stringify','BOOLEAN','ENUM','sequelize','VIRTUAL','getDataValue','alias','STRING','name'];(function(_0xdc2249,_0x5dbfc0){var _0x4ac546=function(_0x3720d5){while(--_0x3720d5){_0xdc2249['push'](_0xdc2249['shift']());}};_0x4ac546(++_0x5dbfc0);}(_0x3822,0x82));var _0x2382=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0x3822[_0x1b4b23];return _0x2a325b;};'use strict';var Sequelize=require(_0x2382('0x0'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x2382('0x1')],'get':function(_0xd9aa40){return this[_0x2382('0x2')](_0x2382('0x3'));}},'alias':{'type':Sequelize[_0x2382('0x4')],'allowNull':![],'set':function(_0x1bed9e){this['setDataValue'](_0x2382('0x3'),_0x1bed9e?_0x1bed9e:this['getDataValue'](_0x2382('0x5')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x2382('0x6')](_0x2382('0x7')),'get':function(){if(this[_0x2382('0x2')](_0x2382('0x8'))===_0x2382('0x9')){return JSON[_0x2382('0xa')](this[_0x2382('0x2')](_0x2382('0xb')));}else{return this[_0x2382('0x2')](_0x2382('0xb'));}},'set':function(_0x4a759e){if(Array[_0x2382('0xc')](_0x4a759e)){this[_0x2382('0xd')](_0x2382('0xb'),JSON[_0x2382('0xe')](_0x4a759e));}else{this['setDataValue'](_0x2382('0xb'),_0x4a759e);}}},'required':{'type':Sequelize[_0x2382('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x2382('0x10')]('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 2d9be36..3129e67 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 _0xc592=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','reject','save','update','then','error','stack','name','index','map','CmCustomField','fieldName','type','key','differenceBy','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','include','body','find','create','sequelize','transaction','Sequelize','TEXT','text','INTEGER','switch','defaultValue','queryInterface','cm_contacts','format','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','ejs','fs-extra','crypto','desk.js','to-csv','querystring','papaparse'];(function(_0x479efd,_0x227b65){var _0x51652f=function(_0x488b86){while(--_0x488b86){_0x479efd['push'](_0x479efd['shift']());}};_0x51652f(++_0x227b65);}(_0xc592,0x17d));var _0x2c59=function(_0x17007d,_0xd37c27){_0x17007d=_0x17007d-0x0;var _0x39b37a=_0xc592[_0x17007d];return _0x39b37a;};'use strict';var emlformat=require(_0x2c59('0x0'));var rimraf=require(_0x2c59('0x1'));var zipdir=require(_0x2c59('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2c59('0x3'));var moment=require(_0x2c59('0x4'));var BPromise=require(_0x2c59('0x5'));var Mustache=require(_0x2c59('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2c59('0x7'));var fs=require('fs');var fs_extra=require(_0x2c59('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2c59('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x2c59('0xa'));var toCsv=require(_0x2c59('0xb'));var querystring=require(_0x2c59('0xc'));var Papa=require(_0x2c59('0xd'));var Redis=require('ioredis');var authService=require(_0x2c59('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x2c59('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2c59('0x10'))(_0x2c59('0x11'));var utils=require('../../config/utils');var config=require(_0x2c59('0x12'));var licenseUtil=require(_0x2c59('0x13'));var db=require(_0x2c59('0x14'))['db'];function respondWithStatusCode(_0x212068,_0x6b6749){_0x6b6749=_0x6b6749||0xcc;return function(_0xe72460){if(_0xe72460){return _0x212068[_0x2c59('0x15')](_0x6b6749);}return _0x212068[_0x2c59('0x16')](_0x6b6749)[_0x2c59('0x17')]();};}function respondWithResult(_0x1466d8,_0x413f08){_0x413f08=_0x413f08||0xc8;return function(_0x340a81){if(_0x340a81){return _0x1466d8[_0x2c59('0x16')](_0x413f08)[_0x2c59('0x18')](_0x340a81);}};}function respondWithFilteredResult(_0x194aa6,_0x1f8992){return function(_0x2fcc1d){if(_0x2fcc1d){var _0x228b10=typeof _0x1f8992[_0x2c59('0x19')]===_0x2c59('0x1a')&&typeof _0x1f8992[_0x2c59('0x1b')]===_0x2c59('0x1a');var _0xba8181=_0x2fcc1d[_0x2c59('0x1c')];var _0x233cb1=_0x228b10?0x0:_0x1f8992[_0x2c59('0x19')];var _0xedd0ed=_0x228b10?_0x2fcc1d[_0x2c59('0x1c')]:_0x1f8992[_0x2c59('0x19')]+_0x1f8992[_0x2c59('0x1b')];var _0x152d60;if(_0xedd0ed>=_0xba8181){_0xedd0ed=_0xba8181;_0x152d60=0xc8;}else{_0x152d60=0xce;}_0x194aa6[_0x2c59('0x16')](_0x152d60);return _0x194aa6['set']('Content-Range',_0x233cb1+'-'+_0xedd0ed+'/'+_0xba8181)['json'](_0x2fcc1d);}return null;};}function patchUpdates(_0x472242){return function(_0x2b1041){try{jsonpatch['apply'](_0x2b1041,_0x472242,!![]);}catch(_0x606529){return BPromise[_0x2c59('0x1d')](_0x606529);}return _0x2b1041[_0x2c59('0x1e')]();};}function saveUpdates(_0x4ce07a,_0x469406){return function(_0x10c1ef){if(_0x10c1ef){return _0x10c1ef[_0x2c59('0x1f')](_0x4ce07a)[_0x2c59('0x20')](function(_0x249dce){return _0x249dce;});}return null;};}function removeEntity(_0x21882f,_0x3855ff){return function(_0x5cc15b){if(_0x5cc15b){return _0x5cc15b['destroy']()[_0x2c59('0x20')](function(){_0x21882f[_0x2c59('0x16')](0xcc)[_0x2c59('0x17')]();});}};}function handleEntityNotFound(_0x5a2cd3,_0xa8c60a){return function(_0x5d9bf6){if(!_0x5d9bf6){_0x5a2cd3[_0x2c59('0x15')](0x194);}return _0x5d9bf6;};}function handleError(_0x291e3a,_0x15c16c){_0x15c16c=_0x15c16c||0x1f4;return function(_0x579719){logger[_0x2c59('0x21')](_0x579719[_0x2c59('0x22')]);if(_0x579719[_0x2c59('0x23')]){delete _0x579719[_0x2c59('0x23')];}_0x291e3a[_0x2c59('0x16')](_0x15c16c)['send'](_0x579719);};}exports[_0x2c59('0x24')]=function(_0x43273a,_0x12a543){var _0x12f0c1={},_0x3abac5={},_0x2dfbfa={'count':0x0,'rows':[]};var _0x19667f=_[_0x2c59('0x25')](db[_0x2c59('0x26')]['rawAttributes'],function(_0xbe2eb6){return{'name':_0xbe2eb6[_0x2c59('0x27')],'type':_0xbe2eb6[_0x2c59('0x28')][_0x2c59('0x29')]};});_0x3abac5['model']=_[_0x2c59('0x2a')](_[_0x2c59('0x25')](_0x19667f,_0x2c59('0x23')),[_0x2c59('0x23')]);_0x3abac5[_0x2c59('0x2b')]=_['keys'](_0x43273a[_0x2c59('0x2b')]);_0x3abac5[_0x2c59('0x2c')]=_['intersection'](_0x3abac5[_0x2c59('0x2d')],_0x3abac5[_0x2c59('0x2b')]);_0x12f0c1[_0x2c59('0x2e')]=_[_0x2c59('0x2f')](_0x3abac5[_0x2c59('0x2d')],qs[_0x2c59('0x30')](_0x43273a[_0x2c59('0x2b')][_0x2c59('0x30')]));_0x12f0c1['attributes']=_0x12f0c1[_0x2c59('0x2e')][_0x2c59('0x31')]?_0x12f0c1[_0x2c59('0x2e')]:_0x3abac5[_0x2c59('0x2d')];if(!_0x43273a[_0x2c59('0x2b')][_0x2c59('0x32')]('nolimit')){_0x12f0c1[_0x2c59('0x1b')]=qs[_0x2c59('0x1b')](_0x43273a[_0x2c59('0x2b')][_0x2c59('0x1b')]);_0x12f0c1[_0x2c59('0x19')]=qs[_0x2c59('0x19')](_0x43273a[_0x2c59('0x2b')]['offset']);}_0x12f0c1['order']=qs['sort'](_0x43273a[_0x2c59('0x2b')]['sort']);_0x12f0c1[_0x2c59('0x33')]=qs[_0x2c59('0x2c')](_['pick'](_0x43273a[_0x2c59('0x2b')],_0x3abac5['filters']),_0x19667f);if(_0x43273a[_0x2c59('0x2b')][_0x2c59('0x34')]){_0x12f0c1['where']=_[_0x2c59('0x35')](_0x12f0c1[_0x2c59('0x33')],{'$or':_[_0x2c59('0x25')](_0x19667f,function(_0xe72045){if(_0xe72045[_0x2c59('0x28')]!==_0x2c59('0x36')){var _0x385df9={};_0x385df9[_0xe72045[_0x2c59('0x23')]]={'$like':'%'+_0x43273a[_0x2c59('0x2b')][_0x2c59('0x34')]+'%'};return _0x385df9;}})});}_0x12f0c1=_['merge']({},_0x12f0c1,_0x43273a[_0x2c59('0x37')]);var _0x23cdbf={'where':_0x12f0c1[_0x2c59('0x33')]};return db['CmCustomField'][_0x2c59('0x1c')](_0x23cdbf)[_0x2c59('0x20')](function(_0x5b7d35){_0x2dfbfa[_0x2c59('0x1c')]=_0x5b7d35;if(_0x43273a[_0x2c59('0x2b')][_0x2c59('0x38')]){_0x12f0c1['include']=[{'all':!![]}];}return db[_0x2c59('0x26')][_0x2c59('0x39')](_0x12f0c1);})['then'](function(_0x38e38a){_0x2dfbfa[_0x2c59('0x3a')]=_0x38e38a;return _0x2dfbfa;})['then'](respondWithFilteredResult(_0x12a543,_0x12f0c1))[_0x2c59('0x3b')](handleError(_0x12a543,null));};exports[_0x2c59('0x3c')]=function(_0x29849d,_0x16af81){var _0x1e2ec1={'raw':!![],'where':{'id':_0x29849d[_0x2c59('0x3d')]['id']}},_0x8f3137={};_0x8f3137[_0x2c59('0x2d')]=_[_0x2c59('0x3e')](db[_0x2c59('0x26')][_0x2c59('0x3f')]);_0x8f3137[_0x2c59('0x2b')]=_['keys'](_0x29849d[_0x2c59('0x2b')]);_0x8f3137[_0x2c59('0x2c')]=_[_0x2c59('0x2f')](_0x8f3137['model'],_0x8f3137[_0x2c59('0x2b')]);_0x1e2ec1['attributes']=_[_0x2c59('0x2f')](_0x8f3137[_0x2c59('0x2d')],qs[_0x2c59('0x30')](_0x29849d['query'][_0x2c59('0x30')]));_0x1e2ec1[_0x2c59('0x2e')]=_0x1e2ec1['attributes'][_0x2c59('0x31')]?_0x1e2ec1[_0x2c59('0x2e')]:_0x8f3137[_0x2c59('0x2d')];if(_0x29849d['query']['includeAll']){_0x1e2ec1[_0x2c59('0x40')]=[{'all':!![]}];}_0x1e2ec1=_[_0x2c59('0x35')]({},_0x1e2ec1,_0x29849d[_0x2c59('0x37')]);return db['CmCustomField']['find'](_0x1e2ec1)[_0x2c59('0x20')](handleEntityNotFound(_0x16af81,null))[_0x2c59('0x20')](respondWithResult(_0x16af81,null))[_0x2c59('0x3b')](handleError(_0x16af81,null));};exports[_0x2c59('0x1f')]=function(_0x2c5c5a,_0x45e3a3){if(_0x2c5c5a[_0x2c59('0x41')]['id']){delete _0x2c5c5a[_0x2c59('0x41')]['id'];}return db['CmCustomField'][_0x2c59('0x42')]({'where':{'id':_0x2c5c5a['params']['id']}})['then'](handleEntityNotFound(_0x45e3a3,null))[_0x2c59('0x20')](saveUpdates(_0x2c5c5a[_0x2c59('0x41')],null))[_0x2c59('0x20')](respondWithResult(_0x45e3a3,null))[_0x2c59('0x3b')](handleError(_0x45e3a3,null));};exports['destroy']=function(_0x35d65f,_0x5ee875){return db[_0x2c59('0x26')][_0x2c59('0x42')]({'where':{'id':_0x35d65f[_0x2c59('0x3d')]['id']}})['then'](handleEntityNotFound(_0x5ee875,null))['then'](removeEntity(_0x5ee875,null))[_0x2c59('0x3b')](handleError(_0x5ee875,null));};exports[_0x2c59('0x43')]=function(_0x331083,_0x3aaf07){var _0x1368f8;return db[_0x2c59('0x44')][_0x2c59('0x45')](function(_0x5a363b){return db['CmCustomField'][_0x2c59('0x43')](_0x331083[_0x2c59('0x41')],{'transaction':_0x5a363b})[_0x2c59('0x20')](function(_0x322b7e){_0x1368f8=_0x322b7e;var _0x48e16a={'type':db[_0x2c59('0x46')][_0x2c59('0x47')],'transaction':_0x5a363b};switch(_0x331083[_0x2c59('0x41')][_0x2c59('0x28')]){case _0x2c59('0x48'):_0x48e16a[_0x2c59('0x28')]=db[_0x2c59('0x46')][_0x2c59('0x47')];break;case'number':_0x48e16a[_0x2c59('0x28')]=db[_0x2c59('0x46')][_0x2c59('0x49')];break;case _0x2c59('0x4a'):_0x48e16a[_0x2c59('0x28')]=db[_0x2c59('0x46')]['BOOLEAN'];_0x48e16a[_0x2c59('0x4b')]=![];break;default:}return db[_0x2c59('0x44')][_0x2c59('0x4c')]['addColumn'](_0x2c59('0x4d'),util[_0x2c59('0x4e')]('cf_%d',_0x1368f8['id']),_0x48e16a);})['then'](function(){return _0x1368f8;});})['then'](respondWithResult(_0x3aaf07,0xc9))[_0x2c59('0x3b')](handleError(_0x3aaf07,null));}; \ No newline at end of file +var _0x4912=['rawAttributes','keys','find','body','params','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','queryInterface','cm_contacts','cf_%d','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','end','error','name','send','index','map','CmCustomField','fieldName','key','model','differenceBy','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show'];(function(_0xb5cbaf,_0x562a35){var _0x6bc061=function(_0x19e226){while(--_0x19e226){_0xb5cbaf['push'](_0xb5cbaf['shift']());}};_0x6bc061(++_0x562a35);}(_0x4912,0x1c0));var _0x2491=function(_0x3a0fdd,_0x4058b9){_0x3a0fdd=_0x3a0fdd-0x0;var _0x52d8d3=_0x4912[_0x3a0fdd];return _0x52d8d3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2491('0x0'));var zipdir=require(_0x2491('0x1'));var jsonpatch=require(_0x2491('0x2'));var rp=require(_0x2491('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2491('0x4'));var util=require(_0x2491('0x5'));var path=require(_0x2491('0x6'));var sox=require(_0x2491('0x7'));var csv=require(_0x2491('0x8'));var ejs=require(_0x2491('0x9'));var fs=require('fs');var fs_extra=require(_0x2491('0xa'));var _=require(_0x2491('0xb'));var squel=require('squel');var crypto=require(_0x2491('0xc'));var jsforce=require(_0x2491('0xd'));var deskjs=require(_0x2491('0xe'));var toCsv=require(_0x2491('0x8'));var querystring=require(_0x2491('0xf'));var Papa=require('papaparse');var Redis=require(_0x2491('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2491('0x11'));var as=require(_0x2491('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x2491('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2491('0x14'))['db'];function respondWithStatusCode(_0x250cb3,_0x27f5a3){_0x27f5a3=_0x27f5a3||0xcc;return function(_0x311ccb){if(_0x311ccb){return _0x250cb3[_0x2491('0x15')](_0x27f5a3);}return _0x250cb3['status'](_0x27f5a3)['end']();};}function respondWithResult(_0x1a43ab,_0x5d0ca3){_0x5d0ca3=_0x5d0ca3||0xc8;return function(_0x2281c7){if(_0x2281c7){return _0x1a43ab[_0x2491('0x16')](_0x5d0ca3)['json'](_0x2281c7);}};}function respondWithFilteredResult(_0x6585e1,_0x181c11){return function(_0x2ecdde){if(_0x2ecdde){var _0x4702e9=typeof _0x181c11[_0x2491('0x17')]===_0x2491('0x18')&&typeof _0x181c11[_0x2491('0x19')]==='undefined';var _0xcdf811=_0x2ecdde[_0x2491('0x1a')];var _0x95e6c5=_0x4702e9?0x0:_0x181c11[_0x2491('0x17')];var _0x46bb64=_0x4702e9?_0x2ecdde[_0x2491('0x1a')]:_0x181c11[_0x2491('0x17')]+_0x181c11[_0x2491('0x19')];var _0x3260a5;if(_0x46bb64>=_0xcdf811){_0x46bb64=_0xcdf811;_0x3260a5=0xc8;}else{_0x3260a5=0xce;}_0x6585e1[_0x2491('0x16')](_0x3260a5);return _0x6585e1[_0x2491('0x1b')](_0x2491('0x1c'),_0x95e6c5+'-'+_0x46bb64+'/'+_0xcdf811)[_0x2491('0x1d')](_0x2ecdde);}return null;};}function patchUpdates(_0x502cd1){return function(_0x194152){try{jsonpatch[_0x2491('0x1e')](_0x194152,_0x502cd1,!![]);}catch(_0x36511e){return BPromise[_0x2491('0x1f')](_0x36511e);}return _0x194152['save']();};}function saveUpdates(_0x21f97f,_0x168db2){return function(_0x34f6e6){if(_0x34f6e6){return _0x34f6e6[_0x2491('0x20')](_0x21f97f)[_0x2491('0x21')](function(_0x533962){return _0x533962;});}return null;};}function removeEntity(_0x2a4513,_0x5e4c38){return function(_0xe6d064){if(_0xe6d064){return _0xe6d064[_0x2491('0x22')]()[_0x2491('0x21')](function(){_0x2a4513[_0x2491('0x16')](0xcc)[_0x2491('0x23')]();});}};}function handleEntityNotFound(_0xe0fe4c,_0x2c5b2d){return function(_0x371545){if(!_0x371545){_0xe0fe4c[_0x2491('0x15')](0x194);}return _0x371545;};}function handleError(_0x5cad08,_0x3aa452){_0x3aa452=_0x3aa452||0x1f4;return function(_0x283276){logger[_0x2491('0x24')](_0x283276['stack']);if(_0x283276[_0x2491('0x25')]){delete _0x283276[_0x2491('0x25')];}_0x5cad08[_0x2491('0x16')](_0x3aa452)[_0x2491('0x26')](_0x283276);};}exports[_0x2491('0x27')]=function(_0x5a0bf0,_0x1192ae){var _0xe69986={},_0x4c8bb0={},_0x284be8={'count':0x0,'rows':[]};var _0x1050fa=_[_0x2491('0x28')](db[_0x2491('0x29')]['rawAttributes'],function(_0x42f470){return{'name':_0x42f470[_0x2491('0x2a')],'type':_0x42f470['type'][_0x2491('0x2b')]};});_0x4c8bb0[_0x2491('0x2c')]=_[_0x2491('0x2d')](_[_0x2491('0x28')](_0x1050fa,_0x2491('0x25')),[_0x2491('0x25')]);_0x4c8bb0[_0x2491('0x2e')]=_['keys'](_0x5a0bf0[_0x2491('0x2e')]);_0x4c8bb0[_0x2491('0x2f')]=_[_0x2491('0x30')](_0x4c8bb0[_0x2491('0x2c')],_0x4c8bb0['query']);_0xe69986['attributes']=_[_0x2491('0x30')](_0x4c8bb0['model'],qs[_0x2491('0x31')](_0x5a0bf0[_0x2491('0x2e')][_0x2491('0x31')]));_0xe69986[_0x2491('0x32')]=_0xe69986['attributes'][_0x2491('0x33')]?_0xe69986['attributes']:_0x4c8bb0['model'];if(!_0x5a0bf0[_0x2491('0x2e')][_0x2491('0x34')](_0x2491('0x35'))){_0xe69986[_0x2491('0x19')]=qs[_0x2491('0x19')](_0x5a0bf0[_0x2491('0x2e')][_0x2491('0x19')]);_0xe69986[_0x2491('0x17')]=qs['offset'](_0x5a0bf0[_0x2491('0x2e')][_0x2491('0x17')]);}_0xe69986[_0x2491('0x36')]=qs['sort'](_0x5a0bf0['query'][_0x2491('0x37')]);_0xe69986[_0x2491('0x38')]=qs[_0x2491('0x2f')](_[_0x2491('0x39')](_0x5a0bf0[_0x2491('0x2e')],_0x4c8bb0['filters']),_0x1050fa);if(_0x5a0bf0[_0x2491('0x2e')][_0x2491('0x3a')]){_0xe69986[_0x2491('0x38')]=_[_0x2491('0x3b')](_0xe69986[_0x2491('0x38')],{'$or':_[_0x2491('0x28')](_0x1050fa,function(_0x547fa7){if(_0x547fa7[_0x2491('0x3c')]!==_0x2491('0x3d')){var _0xe3cbb7={};_0xe3cbb7[_0x547fa7[_0x2491('0x25')]]={'$like':'%'+_0x5a0bf0[_0x2491('0x2e')][_0x2491('0x3a')]+'%'};return _0xe3cbb7;}})});}_0xe69986=_['merge']({},_0xe69986,_0x5a0bf0[_0x2491('0x3e')]);var _0x2a304d={'where':_0xe69986[_0x2491('0x38')]};return db[_0x2491('0x29')][_0x2491('0x1a')](_0x2a304d)[_0x2491('0x21')](function(_0x15d7af){_0x284be8[_0x2491('0x1a')]=_0x15d7af;if(_0x5a0bf0[_0x2491('0x2e')][_0x2491('0x3f')]){_0xe69986['include']=[{'all':!![]}];}return db['CmCustomField'][_0x2491('0x40')](_0xe69986);})[_0x2491('0x21')](function(_0x1b42e0){_0x284be8[_0x2491('0x41')]=_0x1b42e0;return _0x284be8;})[_0x2491('0x21')](respondWithFilteredResult(_0x1192ae,_0xe69986))[_0x2491('0x42')](handleError(_0x1192ae,null));};exports[_0x2491('0x43')]=function(_0x139d95,_0x478067){var _0x48a041={'raw':!![],'where':{'id':_0x139d95['params']['id']}},_0x4a46bf={};_0x4a46bf[_0x2491('0x2c')]=_['keys'](db[_0x2491('0x29')][_0x2491('0x44')]);_0x4a46bf[_0x2491('0x2e')]=_[_0x2491('0x45')](_0x139d95[_0x2491('0x2e')]);_0x4a46bf[_0x2491('0x2f')]=_['intersection'](_0x4a46bf[_0x2491('0x2c')],_0x4a46bf[_0x2491('0x2e')]);_0x48a041['attributes']=_[_0x2491('0x30')](_0x4a46bf[_0x2491('0x2c')],qs[_0x2491('0x31')](_0x139d95[_0x2491('0x2e')][_0x2491('0x31')]));_0x48a041[_0x2491('0x32')]=_0x48a041[_0x2491('0x32')][_0x2491('0x33')]?_0x48a041[_0x2491('0x32')]:_0x4a46bf[_0x2491('0x2c')];if(_0x139d95[_0x2491('0x2e')]['includeAll']){_0x48a041['include']=[{'all':!![]}];}_0x48a041=_['merge']({},_0x48a041,_0x139d95[_0x2491('0x3e')]);return db['CmCustomField'][_0x2491('0x46')](_0x48a041)[_0x2491('0x21')](handleEntityNotFound(_0x478067,null))[_0x2491('0x21')](respondWithResult(_0x478067,null))['catch'](handleError(_0x478067,null));};exports['update']=function(_0x4d93a9,_0x269e1b){if(_0x4d93a9[_0x2491('0x47')]['id']){delete _0x4d93a9['body']['id'];}return db[_0x2491('0x29')][_0x2491('0x46')]({'where':{'id':_0x4d93a9['params']['id']}})[_0x2491('0x21')](handleEntityNotFound(_0x269e1b,null))[_0x2491('0x21')](saveUpdates(_0x4d93a9['body'],null))[_0x2491('0x21')](respondWithResult(_0x269e1b,null))[_0x2491('0x42')](handleError(_0x269e1b,null));};exports[_0x2491('0x22')]=function(_0x407894,_0x20280b){return db[_0x2491('0x29')][_0x2491('0x46')]({'where':{'id':_0x407894[_0x2491('0x48')]['id']}})['then'](handleEntityNotFound(_0x20280b,null))['then'](removeEntity(_0x20280b,null))[_0x2491('0x42')](handleError(_0x20280b,null));};exports[_0x2491('0x49')]=function(_0x20703d,_0x403f55){var _0x248658;return db[_0x2491('0x4a')][_0x2491('0x4b')](function(_0x29d517){return db[_0x2491('0x29')]['create'](_0x20703d[_0x2491('0x47')],{'transaction':_0x29d517})[_0x2491('0x21')](function(_0x4f9137){_0x248658=_0x4f9137;var _0x63ec19={'type':db[_0x2491('0x4c')][_0x2491('0x4d')],'transaction':_0x29d517};switch(_0x20703d[_0x2491('0x47')][_0x2491('0x3c')]){case _0x2491('0x4e'):_0x63ec19['type']=db[_0x2491('0x4c')][_0x2491('0x4d')];break;case _0x2491('0x4f'):_0x63ec19['type']=db['Sequelize'][_0x2491('0x50')];break;case _0x2491('0x51'):_0x63ec19[_0x2491('0x3c')]=db[_0x2491('0x4c')][_0x2491('0x52')];_0x63ec19['defaultValue']=![];break;default:}return db[_0x2491('0x4a')][_0x2491('0x53')]['addColumn'](_0x2491('0x54'),util['format'](_0x2491('0x55'),_0x248658['id']),_0x63ec19);})[_0x2491('0x21')](function(){return _0x248658;});})[_0x2491('0x21')](respondWithResult(_0x403f55,0xc9))['catch'](handleError(_0x403f55,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 01b1366..6125fa3 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 _0x7173=['exports','define','cm_custom_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes'];(function(_0x48e2bf,_0x2866d2){var _0x4a869d=function(_0x1b41b1){while(--_0x1b41b1){_0x48e2bf['push'](_0x48e2bf['shift']());}};_0x4a869d(++_0x2866d2);}(_0x7173,0x73));var _0x3717=function(_0x119280,_0x439c3e){_0x119280=_0x119280-0x0;var _0x481797=_0x7173[_0x119280];return _0x481797;};'use strict';var _=require(_0x3717('0x0'));var util=require(_0x3717('0x1'));var logger=require(_0x3717('0x2'))(_0x3717('0x3'));var moment=require(_0x3717('0x4'));var BPromise=require(_0x3717('0x5'));var rp=require(_0x3717('0x6'));var fs=require('fs');var path=require(_0x3717('0x7'));var rimraf=require(_0x3717('0x8'));var config=require(_0x3717('0x9'));var attributes=require(_0x3717('0xa'));module[_0x3717('0xb')]=function(_0x1f7a46,_0x4f70b6){return _0x1f7a46[_0x3717('0xc')]('CmCustomField',attributes,{'tableName':_0x3717('0xd'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x607e=['path','rimraf','./cmCustomField.attributes','exports','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x102f97,_0x5bda2f){var _0xd22058=function(_0x2ccc1f){while(--_0x2ccc1f){_0x102f97['push'](_0x102f97['shift']());}};_0xd22058(++_0x5bda2f);}(_0x607e,0xd2));var _0xe607=function(_0x3f9d5d,_0x4ee8dd){_0x3f9d5d=_0x3f9d5d-0x0;var _0x1b2cd7=_0x607e[_0x3f9d5d];return _0x1b2cd7;};'use strict';var _=require(_0xe607('0x0'));var util=require(_0xe607('0x1'));var logger=require(_0xe607('0x2'))(_0xe607('0x3'));var moment=require(_0xe607('0x4'));var BPromise=require(_0xe607('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe607('0x6'));var rimraf=require(_0xe607('0x7'));var config=require('../../config/environment');var attributes=require(_0xe607('0x8'));module[_0xe607('0x9')]=function(_0x281ac1,_0xf91125){return _0x281ac1['define'](_0xe607('0xa'),attributes,{'tableName':_0xe607('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 1752b12..c006057 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 _0x9fff=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','CmCustomField,\x20%s,\x20%s','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x534157,_0x5e0173){var _0x2bb356=function(_0x36abf3){while(--_0x36abf3){_0x534157['push'](_0x534157['shift']());}};_0x2bb356(++_0x5e0173);}(_0x9fff,0xb0));var _0xf9ff=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9fff[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xf9ff('0x0'));var moment=require(_0xf9ff('0x1'));var BPromise=require(_0xf9ff('0x2'));var rs=require(_0xf9ff('0x3'));var fs=require('fs');var Redis=require(_0xf9ff('0x4'));var db=require(_0xf9ff('0x5'))['db'];var utils=require(_0xf9ff('0x6'));var logger=require(_0xf9ff('0x7'))(_0xf9ff('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf9ff('0x9')][_0xf9ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1bb2e3,_0x3e1268,_0xcaf2b9){return new BPromise(function(_0x7a270e,_0x43fc93){return client[_0xf9ff('0xb')](_0x1bb2e3,_0xcaf2b9)['then'](function(_0x432314){logger[_0xf9ff('0xc')](_0xf9ff('0xd'),_0x3e1268,_0xf9ff('0xe'));logger['debug'](_0xf9ff('0xf'),_0x3e1268,'request\x20sent',JSON[_0xf9ff('0x10')](_0x432314));if(_0x432314[_0xf9ff('0x11')]){if(_0x432314['error'][_0xf9ff('0x12')]===0x1f4){logger[_0xf9ff('0x11')](_0xf9ff('0xd'),_0x3e1268,_0x432314[_0xf9ff('0x11')][_0xf9ff('0x13')]);return _0x43fc93(_0x432314[_0xf9ff('0x11')][_0xf9ff('0x13')]);}logger[_0xf9ff('0x11')]('CmCustomField,\x20%s,\x20%s',_0x3e1268,_0x432314[_0xf9ff('0x11')]['message']);return _0x7a270e(_0x432314[_0xf9ff('0x11')][_0xf9ff('0x13')]);}else{logger['info'](_0xf9ff('0xd'),_0x3e1268,_0xf9ff('0xe'));_0x7a270e(_0x432314[_0xf9ff('0x14')][_0xf9ff('0x13')]);}})[_0xf9ff('0x15')](function(_0x1ba8f2){logger[_0xf9ff('0x11')](_0xf9ff('0xd'),_0x3e1268,_0x1ba8f2);_0x43fc93(_0x1ba8f2);});});} \ No newline at end of file +var _0xc4bf=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','error','code','CmCustomField,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring'];(function(_0x328691,_0x3a166b){var _0x1b85d3=function(_0x5ab3d8){while(--_0x5ab3d8){_0x328691['push'](_0x328691['shift']());}};_0x1b85d3(++_0x3a166b);}(_0xc4bf,0x65));var _0xfc4b=function(_0x5da9e3,_0x3d80cd){_0x5da9e3=_0x5da9e3-0x0;var _0x5a68cd=_0xc4bf[_0x5da9e3];return _0x5a68cd;};'use strict';var _=require(_0xfc4b('0x0'));var util=require('util');var moment=require(_0xfc4b('0x1'));var BPromise=require(_0xfc4b('0x2'));var rs=require(_0xfc4b('0x3'));var fs=require('fs');var Redis=require(_0xfc4b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfc4b('0x5'));var logger=require(_0xfc4b('0x6'))('rpc');var config=require(_0xfc4b('0x7'));var jayson=require(_0xfc4b('0x8'));var client=jayson[_0xfc4b('0x9')][_0xfc4b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e3008,_0x5cbdb7,_0x3a85bb){return new BPromise(function(_0x2c374c,_0x584bc9){return client['request'](_0x1e3008,_0x3a85bb)[_0xfc4b('0xb')](function(_0xd0d1c){logger[_0xfc4b('0xc')]('CmCustomField,\x20%s,\x20%s',_0x5cbdb7,_0xfc4b('0xd'));logger[_0xfc4b('0xe')](_0xfc4b('0xf'),_0x5cbdb7,'request\x20sent',JSON['stringify'](_0xd0d1c));if(_0xd0d1c[_0xfc4b('0x10')]){if(_0xd0d1c[_0xfc4b('0x10')][_0xfc4b('0x11')]===0x1f4){logger[_0xfc4b('0x10')](_0xfc4b('0x12'),_0x5cbdb7,_0xd0d1c['error'][_0xfc4b('0x13')]);return _0x584bc9(_0xd0d1c[_0xfc4b('0x10')][_0xfc4b('0x13')]);}logger[_0xfc4b('0x10')](_0xfc4b('0x12'),_0x5cbdb7,_0xd0d1c[_0xfc4b('0x10')][_0xfc4b('0x13')]);return _0x2c374c(_0xd0d1c[_0xfc4b('0x10')]['message']);}else{logger['info'](_0xfc4b('0x12'),_0x5cbdb7,'request\x20sent');_0x2c374c(_0xd0d1c[_0xfc4b('0x14')][_0xfc4b('0x13')]);}})['catch'](function(_0x36c30b){logger['error'](_0xfc4b('0x12'),_0x5cbdb7,_0x36c30b);_0x584bc9(_0x36c30b);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index a21998b..14e7b5e 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 _0x2383=['/:id','show','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2383,0xb2));var _0x3238=function(_0x1b0cd1,_0x23995c){_0x1b0cd1=_0x1b0cd1-0x0;var _0x145c91=_0x2383[_0x1b0cd1];return _0x145c91;};'use strict';var multer=require(_0x3238('0x0'));var util=require(_0x3238('0x1'));var path=require('path');var timeout=require(_0x3238('0x2'));var express=require(_0x3238('0x3'));var router=express[_0x3238('0x4')]();var fs_extra=require(_0x3238('0x5'));var auth=require(_0x3238('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmCustomField.controller');router[_0x3238('0x7')]('/',auth[_0x3238('0x8')](),controller['index']);router[_0x3238('0x7')](_0x3238('0x9'),auth[_0x3238('0x8')](),controller[_0x3238('0xa')]);router[_0x3238('0xb')]('/',auth['isAuthenticated'](),controller[_0x3238('0xc')]);router[_0x3238('0xd')](_0x3238('0x9'),auth[_0x3238('0x8')](),controller[_0x3238('0xe')]);router[_0x3238('0xf')]('/:id',auth[_0x3238('0x8')](),controller[_0x3238('0x10')]);module['exports']=router; \ No newline at end of file +var _0xe75a=['delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','show','put','update'];(function(_0x3ccc54,_0x2961b7){var _0x447996=function(_0x5073f9){while(--_0x5073f9){_0x3ccc54['push'](_0x3ccc54['shift']());}};_0x447996(++_0x2961b7);}(_0xe75a,0x1de));var _0xae75=function(_0x398d85,_0x2465d7){_0x398d85=_0x398d85-0x0;var _0x33c2bb=_0xe75a[_0x398d85];return _0x33c2bb;};'use strict';var multer=require(_0xae75('0x0'));var util=require(_0xae75('0x1'));var path=require('path');var timeout=require(_0xae75('0x2'));var express=require(_0xae75('0x3'));var router=express[_0xae75('0x4')]();var fs_extra=require(_0xae75('0x5'));var auth=require(_0xae75('0x6'));var interaction=require(_0xae75('0x7'));var config=require(_0xae75('0x8'));var controller=require(_0xae75('0x9'));router[_0xae75('0xa')]('/',auth[_0xae75('0xb')](),controller['index']);router[_0xae75('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xae75('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xae75('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xae75('0xe')]);router[_0xae75('0xf')]('/:id',auth[_0xae75('0xb')](),controller[_0xae75('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 411af6e..1338201 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 _0x43d8=['UNSIGNED','contactListQueue','moment','sequelize','exports','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING'];(function(_0x4204ec,_0x5b0df0){var _0x8488df=function(_0x56853a){while(--_0x56853a){_0x4204ec['push'](_0x4204ec['shift']());}};_0x8488df(++_0x5b0df0);}(_0x43d8,0x77));var _0x843d=function(_0x343d36,_0x5f248a){_0x343d36=_0x343d36-0x0;var _0x3bd305=_0x43d8[_0x343d36];return _0x3bd305;};'use strict';var moment=require(_0x843d('0x0'));var Sequelize=require(_0x843d('0x1'));module[_0x843d('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x843d('0x3')],'defaultValue':moment()['format'](_0x843d('0x4'))},'countbusyretry':{'type':Sequelize[_0x843d('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x843d('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x843d('0x6')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x843d('0x3')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x843d('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x843d('0x5')],'unique':_0x843d('0x8')},'ListId':{'type':Sequelize[_0x843d('0x5')],'unique':_0x843d('0x8')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x843d('0x5')],'unique':_0x843d('0x8')},'CampaignId':{'type':Sequelize[_0x843d('0x5')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x843d('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x843d('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xebd2=['sequelize','exports','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue'];(function(_0x720e20,_0x1a827){var _0xfef46e=function(_0x4b3c31){while(--_0x4b3c31){_0x720e20['push'](_0x720e20['shift']());}};_0xfef46e(++_0x1a827);}(_0xebd2,0xc8));var _0x2ebd=function(_0xd9036b,_0xeb41e3){_0xd9036b=_0xd9036b-0x0;var _0x142b24=_0xebd2[_0xd9036b];return _0x142b24;};'use strict';var moment=require('moment');var Sequelize=require(_0x2ebd('0x0'));module[_0x2ebd('0x1')]={'phone':{'type':Sequelize[_0x2ebd('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x2ebd('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x2ebd('0x4')],'defaultValue':moment()[_0x2ebd('0x5')](_0x2ebd('0x6'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x2ebd('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x2ebd('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x2ebd('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x2ebd('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x2ebd('0x4')]},'priority':{'type':Sequelize[_0x2ebd('0x7')](0x2)[_0x2ebd('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x2ebd('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x2ebd('0x7')],'unique':_0x2ebd('0x9')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x2ebd('0x9')},'UserId':{'type':Sequelize[_0x2ebd('0x7')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x2ebd('0x9')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x2ebd('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x2ebd('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x2ebd('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x2ebd('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x2ebd('0x7')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x2ebd('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 1c6b927..439ae14 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 _0x2d17=['$ne','$eq','$not','$between','$notIn','$notLike','$iLike','$notILike','$overlap','$contained','$any','attributes','fields','length','model','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','include','body','describe','destroy','find','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','deletedat','format','phone','campaigntype','queue','ivr','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','create','CmHopperAdditionalPhone','end','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','transaction','YYYY-MM-DD\x20HH:mm:ss','value','direction','hopperIds','priority','ASC','scheduledAt','DESC','sequelize','literal','isEmpty','findOne','scheduledat','recallme','LOCK','CmContact','Contact','CmCompany','Company','Queue','dialActive','getPreviewRecall','UPDATE','CmList','List','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','getTimezone','moment','lodash','../../config/logger','api','../../mysqldb','json','offset','undefined','limit','count','status','set','Content-Range','update','then','sendStatus','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','key','filters','intersection','query','concat','$and','$gte','$lt','$lte'];(function(_0x278607,_0x52f65f){var _0x162d37=function(_0x34e139){while(--_0x34e139){_0x278607['push'](_0x278607['shift']());}};_0x162d37(++_0x52f65f);}(_0x2d17,0x17e));var _0x72d1=function(_0x4a1c18,_0x3d51ef){_0x4a1c18=_0x4a1c18-0x0;var _0x2412ff=_0x2d17[_0x4a1c18];return _0x2412ff;};'use strict';var moment=require(_0x72d1('0x0'));var _=require(_0x72d1('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x72d1('0x2'))(_0x72d1('0x3'));var shared=require('../../config/environment');var db=require(_0x72d1('0x4'))['db'];function respondWithResult(_0x38fec7,_0x55b722){_0x55b722=_0x55b722||0xc8;return function(_0x1dd6d8){if(_0x1dd6d8){return _0x38fec7['status'](_0x55b722)[_0x72d1('0x5')](_0x1dd6d8);}};}function respondWithFilteredResult(_0x50f551,_0x139ba0){return function(_0x239d1f){if(_0x239d1f){var _0x5b40a9=typeof _0x139ba0[_0x72d1('0x6')]===_0x72d1('0x7')&&typeof _0x139ba0[_0x72d1('0x8')]==='undefined';var _0x215536=_0x239d1f[_0x72d1('0x9')];var _0x283775=_0x5b40a9?0x0:_0x139ba0['offset'];var _0x1d7520=_0x5b40a9?_0x239d1f[_0x72d1('0x9')]:_0x139ba0[_0x72d1('0x6')]+_0x139ba0[_0x72d1('0x8')];var _0x3cb9c2;if(_0x1d7520>=_0x215536){_0x1d7520=_0x215536;_0x3cb9c2=0xc8;}else{_0x3cb9c2=0xce;}_0x50f551[_0x72d1('0xa')](_0x3cb9c2);return _0x50f551[_0x72d1('0xb')](_0x72d1('0xc'),_0x283775+'-'+_0x1d7520+'/'+_0x215536)[_0x72d1('0x5')](_0x239d1f);}return null;};}function saveUpdates(_0x2f5a78,_0x5ad4df){return function(_0x3cd1ae){if(_0x3cd1ae){return _0x3cd1ae[_0x72d1('0xd')](_0x2f5a78)[_0x72d1('0xe')](function(_0x115cd7){return _0x115cd7;});}return null;};}function handleEntityNotFound(_0x22ac6f,_0x685a27){return function(_0x143718){if(!_0x143718){_0x22ac6f[_0x72d1('0xf')](0x194);}return _0x143718;};}function handleError(_0x172fae,_0x3f190f){_0x3f190f=_0x3f190f||0x1f4;return function(_0x21c85e){logger[_0x72d1('0x10')](_0x21c85e[_0x72d1('0x11')]);if(_0x21c85e['name']){delete _0x21c85e[_0x72d1('0x12')];}_0x172fae['status'](_0x3f190f)[_0x72d1('0x13')](_0x21c85e);};}exports[_0x72d1('0x14')]=function(_0x59d7b5,_0x1061b7){var _0x1cbb45={},_0x1ca18d={},_0x49caf4={'count':0x0,'rows':[]};var _0x4925f6=_[_0x72d1('0x15')](db[_0x72d1('0x16')][_0x72d1('0x17')],function(_0x1865c1){return{'name':_0x1865c1[_0x72d1('0x18')],'type':_0x1865c1[_0x72d1('0x19')][_0x72d1('0x1a')]};});_0x1ca18d['model']=_[_0x72d1('0x15')](_0x4925f6,'name');_0x1ca18d['query']=_['keys'](_0x59d7b5['query']);_0x1ca18d[_0x72d1('0x1b')]=_[_0x72d1('0x1c')](_0x1ca18d['model'],_0x1ca18d[_0x72d1('0x1d')]);_0x1ca18d[_0x72d1('0x1b')]=_[_0x72d1('0x1e')](_0x1ca18d[_0x72d1('0x1b')],[_0x72d1('0x1f'),'$or','$gt',_0x72d1('0x20'),_0x72d1('0x21'),_0x72d1('0x22'),_0x72d1('0x23'),_0x72d1('0x24'),_0x72d1('0x25'),_0x72d1('0x26'),'$notBetween','$in',_0x72d1('0x27'),'$like',_0x72d1('0x28'),_0x72d1('0x29'),_0x72d1('0x2a'),'$like',_0x72d1('0x2b'),'$contains',_0x72d1('0x2c'),_0x72d1('0x2d')]);_0x1cbb45[_0x72d1('0x2e')]=_[_0x72d1('0x1c')](_0x1ca18d['model'],qs[_0x72d1('0x2f')](_0x59d7b5['query'][_0x72d1('0x2f')]));_0x1cbb45[_0x72d1('0x2e')]=_0x1cbb45['attributes'][_0x72d1('0x30')]?_0x1cbb45[_0x72d1('0x2e')]:_0x1ca18d[_0x72d1('0x31')];if(!_0x59d7b5[_0x72d1('0x1d')][_0x72d1('0x32')]('nolimit')){_0x1cbb45[_0x72d1('0x8')]=qs[_0x72d1('0x8')](_0x59d7b5[_0x72d1('0x1d')]['limit']);_0x1cbb45[_0x72d1('0x6')]=qs[_0x72d1('0x6')](_0x59d7b5['query'][_0x72d1('0x6')]);}_0x1cbb45[_0x72d1('0x33')]=qs[_0x72d1('0x34')](_0x59d7b5['query'][_0x72d1('0x34')]);_0x1cbb45['where']=qs[_0x72d1('0x1b')](_[_0x72d1('0x35')](_0x59d7b5[_0x72d1('0x1d')],_0x1ca18d[_0x72d1('0x1b')]),_0x4925f6);if(_0x59d7b5[_0x72d1('0x1d')][_0x72d1('0x36')]){_0x1cbb45[_0x72d1('0x37')]=_[_0x72d1('0x38')](_0x1cbb45[_0x72d1('0x37')],{'$or':_[_0x72d1('0x15')](_0x4925f6,function(_0x2029b5){if(_0x2029b5['type']!==_0x72d1('0x39')){var _0x2a60c4={};_0x2a60c4[_0x2029b5[_0x72d1('0x12')]]={'$like':'%'+_0x59d7b5[_0x72d1('0x1d')]['filter']+'%'};return _0x2a60c4;}})});}_0x1cbb45=_[_0x72d1('0x38')]({},_0x1cbb45,_0x59d7b5[_0x72d1('0x3a')]);var _0x2783bb={'where':_0x1cbb45['where']};return db[_0x72d1('0x16')][_0x72d1('0x9')](_0x2783bb)[_0x72d1('0xe')](function(_0x5b897f){_0x49caf4[_0x72d1('0x9')]=_0x5b897f;if(_0x59d7b5[_0x72d1('0x1d')][_0x72d1('0x3b')]){_0x1cbb45['include']=[{'all':!![]}];}return db[_0x72d1('0x16')][_0x72d1('0x3c')](_0x1cbb45);})[_0x72d1('0xe')](function(_0x14cb3d){_0x49caf4[_0x72d1('0x3d')]=_0x14cb3d;return _0x49caf4;})[_0x72d1('0xe')](respondWithFilteredResult(_0x1061b7,_0x1cbb45))[_0x72d1('0x3e')](handleError(_0x1061b7,null));};exports['show']=function(_0x12646c,_0x3ae4b5){var _0x440ac5={'raw':!![],'where':{'id':_0x12646c[_0x72d1('0x3f')]['id']}},_0x16407a={};_0x16407a[_0x72d1('0x31')]=_[_0x72d1('0x40')](db[_0x72d1('0x16')]['rawAttributes']);_0x16407a[_0x72d1('0x1d')]=_[_0x72d1('0x40')](_0x12646c[_0x72d1('0x1d')]);_0x16407a[_0x72d1('0x1b')]=_[_0x72d1('0x1c')](_0x16407a[_0x72d1('0x31')],_0x16407a[_0x72d1('0x1d')]);_0x440ac5[_0x72d1('0x2e')]=_['intersection'](_0x16407a['model'],qs[_0x72d1('0x2f')](_0x12646c[_0x72d1('0x1d')][_0x72d1('0x2f')]));_0x440ac5[_0x72d1('0x2e')]=_0x440ac5['attributes'][_0x72d1('0x30')]?_0x440ac5[_0x72d1('0x2e')]:_0x16407a['model'];if(_0x12646c[_0x72d1('0x1d')]['includeAll']){_0x440ac5[_0x72d1('0x41')]=[{'all':!![]}];}_0x440ac5=_[_0x72d1('0x38')]({},_0x440ac5,_0x12646c['options']);return db[_0x72d1('0x16')]['find'](_0x440ac5)['then'](handleEntityNotFound(_0x3ae4b5,null))['then'](respondWithResult(_0x3ae4b5,null))[_0x72d1('0x3e')](handleError(_0x3ae4b5,null));};exports['create']=function(_0x42ac27,_0x1ece64){return db[_0x72d1('0x16')]['create'](_0x42ac27['body'],{})[_0x72d1('0xe')](respondWithResult(_0x1ece64,0xc9))['catch'](handleError(_0x1ece64,null));};exports['update']=function(_0x2cb03d,_0x397f31){if(_0x2cb03d[_0x72d1('0x42')]['id']){delete _0x2cb03d['body']['id'];}return db['CmHopper']['find']({'where':{'id':_0x2cb03d['params']['id']}})[_0x72d1('0xe')](handleEntityNotFound(_0x397f31,null))[_0x72d1('0xe')](saveUpdates(_0x2cb03d[_0x72d1('0x42')],null))[_0x72d1('0xe')](respondWithResult(_0x397f31,null))[_0x72d1('0x3e')](handleError(_0x397f31,null));};exports[_0x72d1('0x43')]=function(_0x1d1465,_0x5924c){return db[_0x72d1('0x16')]['describe']()[_0x72d1('0xe')](respondWithResult(_0x5924c,null))[_0x72d1('0x3e')](handleError(_0x5924c,null));};exports[_0x72d1('0x44')]=function(_0x51b1a9,_0x418e6f){var _0x29c88f;var _0x12ad75=_0x51b1a9['params']['id'];return db[_0x72d1('0x16')][_0x72d1('0x45')]({'where':{'id':_0x51b1a9[_0x72d1('0x3f')]['id']}})[_0x72d1('0xe')](handleEntityNotFound(_0x418e6f,null))['then'](function(_0x5de802){if(_0x5de802){return _0x5de802[_0x72d1('0x44')]()[_0x72d1('0xe')](function(_0x1a8dd2){return _0x1a8dd2;});}})['then'](function(_0x402a04){_0x29c88f=_0x402a04;if(_0x402a04){if(_0x402a04[_0x72d1('0x46')]||_0x402a04[_0x72d1('0x47')]){return db[_0x402a04[_0x72d1('0x46')]?_0x72d1('0x48'):_0x72d1('0x49')][_0x72d1('0x45')]({'where':{'id':_0x402a04[_0x72d1('0x46')]?_0x402a04[_0x72d1('0x46')]:_0x402a04[_0x72d1('0x47')]},'attributes':['id',_0x72d1('0x12')],'raw':!![]});}}})['then'](function(_0x46b2f5){var _0x50d4d4={};if(_0x46b2f5){_['merge'](_0x50d4d4,_[_0x72d1('0x4a')](_0x29c88f['dataValues'],[_0x72d1('0x4b'),_0x72d1('0x4c'),'id']));_0x50d4d4[_0x72d1('0x4d')]=0x15;_0x50d4d4[_0x72d1('0x4e')]=_0x72d1('0x4f');_0x50d4d4[_0x72d1('0x50')]=_0x46b2f5[_0x72d1('0x12')];_0x50d4d4[_0x72d1('0x51')]=_0x51b1a9[_0x72d1('0x52')][_0x72d1('0x12')];_0x50d4d4[_0x72d1('0x53')]=_0x51b1a9['user']['id'];_0x50d4d4[_0x72d1('0x4f')]=!![];_0x50d4d4[_0x72d1('0x54')]=moment()[_0x72d1('0x55')]('YYYY-MM-DD\x20HH:mm:ss');_0x50d4d4['calleridnum']=_0x29c88f[_0x72d1('0x56')];_0x50d4d4[_0x72d1('0x57')]=_0x29c88f[_0x72d1('0x46')]?_0x72d1('0x58'):_0x72d1('0x59');return db['CmContact'][_0x72d1('0x45')]({'where':{'id':_0x50d4d4['ContactId']},'attributes':[_0x72d1('0x5a'),_0x72d1('0x5b')]})[_0x72d1('0xe')](function(_0xe1faa9){if(!_[_0x72d1('0x5c')](_0x418e6f)&&!_[_0x72d1('0x5c')](_0xe1faa9[_0x72d1('0x5a')])){_0x50d4d4[_0x72d1('0x5d')]=_0xe1faa9[_0x72d1('0x5a')];if(!_[_0x72d1('0x5c')](_0xe1faa9[_0x72d1('0x5b')])){_0x50d4d4[_0x72d1('0x5d')]+='\x20'+_0xe1faa9[_0x72d1('0x5b')];}}})[_0x72d1('0x5e')](function(){return db[_0x72d1('0x5f')][_0x72d1('0x60')](_0x50d4d4);});}})[_0x72d1('0xe')](function(_0x5e63cc){return db[_0x72d1('0x61')][_0x72d1('0x44')]({'where':{'CmHopperId':_0x12ad75}});})[_0x72d1('0xe')](function(){return _0x418e6f[_0x72d1('0xa')](0xcc)[_0x72d1('0x62')]();})[_0x72d1('0x3e')](handleError(_0x418e6f,null));};exports['getPreview']=function(_0x1aec3d,_0x303508){var _0xb05cd9=[];return db['CmContact']['describe']()[_0x72d1('0xe')](function(_0x5f4614){_0xb05cd9=_[_0x72d1('0x40')](_0x5f4614);return _0x1aec3d[_0x72d1('0x52')][_0x72d1('0x63')]({'where':{'type':_0x72d1('0x64'),'dialActive':!![],'dialMethod':_0x72d1('0x65')},'attributes':['id',_0x72d1('0x66'),_0x72d1('0x67')],'raw':!![]});})[_0x72d1('0xe')](function(_0x28e42b){if(_0x28e42b&&_0x28e42b['length']){return db['sequelize'][_0x72d1('0x68')](function(_0x1d44f0){var _0x1bd80b={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x72d1('0x69'))},'VoiceQueueId':{'$in':_[_0x72d1('0x15')](_0x28e42b,'id')},'$or':[{'UserId':null},{'UserId':_0x1aec3d['user']['id']}]};var _0x39d7f9={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x28e42b)[_0x72d1('0x36')]([_0x72d1('0x67'),0x0])[_0x72d1('0x15')]('id')[_0x72d1('0x6a')]()},'$or':[{'UserId':null},{'UserId':_0x1aec3d[_0x72d1('0x52')]['id']}]};var _0x102574={'$or':[_0x1bd80b,_0x39d7f9]};var _0x7925ec=[];if(_0x1aec3d[_0x72d1('0x42')][_0x72d1('0x6b')]&&_0x1aec3d[_0x72d1('0x42')][_0x72d1('0x6b')]==='prev'){if(!_['isEmpty'](_0x1aec3d[_0x72d1('0x42')][_0x72d1('0x6c')])){_0x102574['id']={'$in':_0x1aec3d[_0x72d1('0x42')][_0x72d1('0x6c')]};}_0x7925ec=[[_0x72d1('0x6d'),_0x72d1('0x6e')],[_0x72d1('0x6f'),_0x28e42b[0x0][_0x72d1('0x66')]==='ASC'?_0x72d1('0x70'):'ASC'],db[_0x72d1('0x71')][_0x72d1('0x72')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id','DESC']];}else{if(!_[_0x72d1('0x73')](_0x1aec3d[_0x72d1('0x42')][_0x72d1('0x6c')])){_0x102574['id']={'$notIn':_0x1aec3d[_0x72d1('0x42')][_0x72d1('0x6c')]};}_0x7925ec=[[_0x72d1('0x6d'),_0x72d1('0x70')],['scheduledAt',_0x28e42b[0x0][_0x72d1('0x66')]],db[_0x72d1('0x71')][_0x72d1('0x72')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x72d1('0x6e')]];}return db['CmHopper'][_0x72d1('0x74')]({'attributes':['id',_0x72d1('0x75'),'phone',_0x72d1('0x76')],'where':_0x102574,'order':_0x7925ec,'transaction':_0x1d44f0,'lock':_0x1d44f0[_0x72d1('0x77')]['UPDATE'],'include':[{'model':db[_0x72d1('0x78')],'as':_0x72d1('0x79'),'attributes':_0xb05cd9,'include':[{'model':db[_0x72d1('0x7a')],'as':_0x72d1('0x7b'),'attributes':['id','name']}]},{'model':db['CmList'],'as':'List','attributes':['id',_0x72d1('0x12')]},{'model':db[_0x72d1('0x48')],'as':_0x72d1('0x7c'),'attributes':['id',_0x72d1('0x12'),_0x72d1('0x7d')]}]})[_0x72d1('0xe')](function(_0x577c9d){if(_0x577c9d){return _0x577c9d['update']({'UserId':_0x1aec3d[_0x72d1('0x52')]['id']},{'transaction':_0x1d44f0});}});});}})[_0x72d1('0xe')](handleEntityNotFound(_0x303508,null))[_0x72d1('0xe')](respondWithResult(_0x303508,null))[_0x72d1('0x3e')](handleError(_0x303508,null));};exports[_0x72d1('0x7e')]=function(_0x422391,_0x50d377,_0x23f0e3){var _0x4511a4=[];var _0x18cec8=_0x422391['params']['id'];var _0xa3e1ab=_0x422391[_0x72d1('0x52')]['id'];return db[_0x72d1('0x78')][_0x72d1('0x43')]()[_0x72d1('0xe')](function(_0x2c68c1){_0x4511a4=_[_0x72d1('0x40')](_0x2c68c1);return db[_0x72d1('0x71')]['transaction'](function(_0x317ad4){const _0x14530a={'id':_0x18cec8};return db[_0x72d1('0x16')][_0x72d1('0x74')]({'attributes':['id','scheduledat','recallme'],'where':_0x14530a,'transaction':_0x317ad4,'lock':_0x317ad4[_0x72d1('0x77')][_0x72d1('0x7f')],'include':[{'model':db['CmContact'],'as':_0x72d1('0x79'),'attributes':_0x4511a4,'include':[{'model':db[_0x72d1('0x7a')],'as':_0x72d1('0x7b'),'attributes':['id',_0x72d1('0x12')]}]},{'model':db[_0x72d1('0x80')],'as':_0x72d1('0x81'),'attributes':['id',_0x72d1('0x12')]},{'model':db[_0x72d1('0x48')],'as':'Queue','attributes':['id',_0x72d1('0x12'),_0x72d1('0x7d')]}]})[_0x72d1('0xe')](function(_0x3cbe00){if(_0x3cbe00){return _0x3cbe00[_0x72d1('0xd')]({'UserId':_0xa3e1ab},{'transaction':_0x317ad4});}});});})[_0x72d1('0xe')](handleEntityNotFound(_0x50d377,null))[_0x72d1('0xe')](respondWithResult(_0x50d377,null))[_0x72d1('0x3e')](handleError(_0x50d377,null));};exports['getOpenContacts']=function(_0x47585e,_0x466634){return _0x47585e[_0x72d1('0x52')][_0x72d1('0x63')]({'where':{'type':_0x72d1('0x64'),'dialActive':!![],'dialMethod':_0x72d1('0x65')},'attributes':['id'],'raw':!![]})['then'](function(_0x1c6547){if(_0x1c6547&&_0x1c6547[_0x72d1('0x30')]){return db['CmHopper'][_0x72d1('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x72d1('0x55')](_0x72d1('0x69'))},'VoiceQueueId':{'$in':_[_0x72d1('0x15')](_0x1c6547,'id')},'$or':[{'UserId':null},{'UserId':_0x47585e[_0x72d1('0x52')]['id']}]}});}return 0x0;})[_0x72d1('0xe')](function(_0x520a2f){if(!_[_0x72d1('0x5c')](_0x520a2f)&&_[_0x72d1('0x82')](_0x520a2f)){return _0x466634['status'](0xc8)['json']({'contacts':_0x520a2f});}else{logger[_0x72d1('0x10')](_0x72d1('0x83'),_0x72d1('0x84'),0x194,_0x72d1('0x85'));_0x466634['sendStatus'](0x194);}})[_0x72d1('0x3e')](handleError(_0x466634,null));};exports[_0x72d1('0x86')]=function(_0x1c4bc0,_0x353b96){var _0xe967e2=shared[_0x72d1('0x87')];var _0x2ab55a=[];_[_0x72d1('0x15')](_0xe967e2,function(_0x4fda8a){_0x2ab55a[_0x72d1('0x88')]({'id':_0x4fda8a[_0x72d1('0x12')],'name':_0x4fda8a[_0x72d1('0x12')],'utcOffset':_0x4fda8a[_0x72d1('0x89')]});});return _0x353b96['status'](0xc8)[_0x72d1('0x5')]({'tz':_0x2ab55a});};exports[_0x72d1('0x8a')]=function(_0x496442,_0xb8b082){var _0x5e3bd1=shared[_0x72d1('0x87')];var _0x57c1cd={};if(!_[_0x72d1('0x5c')](_0x5e3bd1[_0x496442[_0x72d1('0x42')]['id']]))_0x57c1cd=_0x5e3bd1[_0x496442[_0x72d1('0x42')]['id']];return _0xb8b082[_0x72d1('0xa')](0xc8)[_0x72d1('0x5')](_0x57c1cd);}; \ No newline at end of file +var _0x885a=['key','model','query','keys','filters','concat','$and','$gt','$gte','$lte','$eq','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$any','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','destroy','CampaignId','VoiceQueueId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','outbound','dialOrderByScheduledAt','sequelize','value','direction','prev','isEmpty','hopperIds','ASC','scheduledAt','DESC','priority','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','CmCompany','Company','CmList','dialActive','getPreviewRecall','transaction','recallme','Contact','Queue','getOpenContacts','preview','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','getTimezone','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','then','error','stack','name','index','CmHopper','rawAttributes','type'];(function(_0x568069,_0x6e813f){var _0x99f063=function(_0x1a8318){while(--_0x1a8318){_0x568069['push'](_0x568069['shift']());}};_0x99f063(++_0x6e813f);}(_0x885a,0x180));var _0xa885=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x885a[_0x27af45];return _0x18df21;};'use strict';var moment=require('moment');var _=require(_0xa885('0x0'));var qs=require(_0xa885('0x1'));var logger=require(_0xa885('0x2'))(_0xa885('0x3'));var shared=require('../../config/environment');var db=require(_0xa885('0x4'))['db'];function respondWithResult(_0x1c41b5,_0x2386ec){_0x2386ec=_0x2386ec||0xc8;return function(_0x106e16){if(_0x106e16){return _0x1c41b5[_0xa885('0x5')](_0x2386ec)[_0xa885('0x6')](_0x106e16);}};}function respondWithFilteredResult(_0x5dfd7e,_0x7ac6bd){return function(_0x1200c7){if(_0x1200c7){var _0x31fd77=typeof _0x7ac6bd['offset']===_0xa885('0x7')&&typeof _0x7ac6bd[_0xa885('0x8')]===_0xa885('0x7');var _0x5e49d0=_0x1200c7[_0xa885('0x9')];var _0x299f57=_0x31fd77?0x0:_0x7ac6bd[_0xa885('0xa')];var _0x745710=_0x31fd77?_0x1200c7[_0xa885('0x9')]:_0x7ac6bd[_0xa885('0xa')]+_0x7ac6bd[_0xa885('0x8')];var _0x571c0d;if(_0x745710>=_0x5e49d0){_0x745710=_0x5e49d0;_0x571c0d=0xc8;}else{_0x571c0d=0xce;}_0x5dfd7e[_0xa885('0x5')](_0x571c0d);return _0x5dfd7e[_0xa885('0xb')](_0xa885('0xc'),_0x299f57+'-'+_0x745710+'/'+_0x5e49d0)[_0xa885('0x6')](_0x1200c7);}return null;};}function saveUpdates(_0x412b2a,_0x3e9c7a){return function(_0x4585d9){if(_0x4585d9){return _0x4585d9['update'](_0x412b2a)[_0xa885('0xd')](function(_0x1d789f){return _0x1d789f;});}return null;};}function handleEntityNotFound(_0x27b24a,_0x12d81c){return function(_0x33ce2e){if(!_0x33ce2e){_0x27b24a['sendStatus'](0x194);}return _0x33ce2e;};}function handleError(_0x1c9687,_0x2ca5c5){_0x2ca5c5=_0x2ca5c5||0x1f4;return function(_0x5296e6){logger[_0xa885('0xe')](_0x5296e6[_0xa885('0xf')]);if(_0x5296e6['name']){delete _0x5296e6[_0xa885('0x10')];}_0x1c9687[_0xa885('0x5')](_0x2ca5c5)['send'](_0x5296e6);};}exports[_0xa885('0x11')]=function(_0x543e7a,_0x2e9290){var _0x3960ea={},_0x8c26c={},_0x4e4d51={'count':0x0,'rows':[]};var _0x289b76=_['map'](db[_0xa885('0x12')][_0xa885('0x13')],function(_0x113043){return{'name':_0x113043['fieldName'],'type':_0x113043[_0xa885('0x14')][_0xa885('0x15')]};});_0x8c26c[_0xa885('0x16')]=_['map'](_0x289b76,_0xa885('0x10'));_0x8c26c[_0xa885('0x17')]=_[_0xa885('0x18')](_0x543e7a['query']);_0x8c26c[_0xa885('0x19')]=_['intersection'](_0x8c26c[_0xa885('0x16')],_0x8c26c[_0xa885('0x17')]);_0x8c26c['filters']=_[_0xa885('0x1a')](_0x8c26c[_0xa885('0x19')],[_0xa885('0x1b'),'$or',_0xa885('0x1c'),_0xa885('0x1d'),'$lt',_0xa885('0x1e'),'$ne',_0xa885('0x1f'),'$not',_0xa885('0x20'),_0xa885('0x21'),_0xa885('0x22'),_0xa885('0x23'),_0xa885('0x24'),_0xa885('0x25'),_0xa885('0x26'),_0xa885('0x27'),'$like','$overlap','$contains','$contained',_0xa885('0x28')]);_0x3960ea[_0xa885('0x29')]=_[_0xa885('0x2a')](_0x8c26c[_0xa885('0x16')],qs[_0xa885('0x2b')](_0x543e7a[_0xa885('0x17')]['fields']));_0x3960ea[_0xa885('0x29')]=_0x3960ea['attributes'][_0xa885('0x2c')]?_0x3960ea['attributes']:_0x8c26c[_0xa885('0x16')];if(!_0x543e7a['query'][_0xa885('0x2d')](_0xa885('0x2e'))){_0x3960ea[_0xa885('0x8')]=qs['limit'](_0x543e7a[_0xa885('0x17')][_0xa885('0x8')]);_0x3960ea['offset']=qs[_0xa885('0xa')](_0x543e7a['query'][_0xa885('0xa')]);}_0x3960ea[_0xa885('0x2f')]=qs[_0xa885('0x30')](_0x543e7a['query'][_0xa885('0x30')]);_0x3960ea[_0xa885('0x31')]=qs[_0xa885('0x19')](_['pick'](_0x543e7a[_0xa885('0x17')],_0x8c26c[_0xa885('0x19')]),_0x289b76);if(_0x543e7a[_0xa885('0x17')][_0xa885('0x32')]){_0x3960ea[_0xa885('0x31')]=_[_0xa885('0x33')](_0x3960ea[_0xa885('0x31')],{'$or':_[_0xa885('0x34')](_0x289b76,function(_0x5235af){if(_0x5235af['type']!==_0xa885('0x35')){var _0x1d43b5={};_0x1d43b5[_0x5235af[_0xa885('0x10')]]={'$like':'%'+_0x543e7a[_0xa885('0x17')][_0xa885('0x32')]+'%'};return _0x1d43b5;}})});}_0x3960ea=_[_0xa885('0x33')]({},_0x3960ea,_0x543e7a[_0xa885('0x36')]);var _0x337e55={'where':_0x3960ea[_0xa885('0x31')]};return db['CmHopper']['count'](_0x337e55)[_0xa885('0xd')](function(_0x576c78){_0x4e4d51['count']=_0x576c78;if(_0x543e7a[_0xa885('0x17')]['includeAll']){_0x3960ea[_0xa885('0x37')]=[{'all':!![]}];}return db[_0xa885('0x12')][_0xa885('0x38')](_0x3960ea);})[_0xa885('0xd')](function(_0x2d433e){_0x4e4d51[_0xa885('0x39')]=_0x2d433e;return _0x4e4d51;})[_0xa885('0xd')](respondWithFilteredResult(_0x2e9290,_0x3960ea))[_0xa885('0x3a')](handleError(_0x2e9290,null));};exports[_0xa885('0x3b')]=function(_0x2f48a9,_0x531586){var _0x30759d={'raw':!![],'where':{'id':_0x2f48a9[_0xa885('0x3c')]['id']}},_0x4012b3={};_0x4012b3[_0xa885('0x16')]=_[_0xa885('0x18')](db['CmHopper']['rawAttributes']);_0x4012b3[_0xa885('0x17')]=_[_0xa885('0x18')](_0x2f48a9[_0xa885('0x17')]);_0x4012b3[_0xa885('0x19')]=_[_0xa885('0x2a')](_0x4012b3['model'],_0x4012b3[_0xa885('0x17')]);_0x30759d[_0xa885('0x29')]=_['intersection'](_0x4012b3['model'],qs[_0xa885('0x2b')](_0x2f48a9[_0xa885('0x17')]['fields']));_0x30759d['attributes']=_0x30759d[_0xa885('0x29')][_0xa885('0x2c')]?_0x30759d[_0xa885('0x29')]:_0x4012b3[_0xa885('0x16')];if(_0x2f48a9[_0xa885('0x17')][_0xa885('0x3d')]){_0x30759d[_0xa885('0x37')]=[{'all':!![]}];}_0x30759d=_[_0xa885('0x33')]({},_0x30759d,_0x2f48a9[_0xa885('0x36')]);return db[_0xa885('0x12')][_0xa885('0x3e')](_0x30759d)['then'](handleEntityNotFound(_0x531586,null))[_0xa885('0xd')](respondWithResult(_0x531586,null))[_0xa885('0x3a')](handleError(_0x531586,null));};exports[_0xa885('0x3f')]=function(_0x49c6a7,_0x47f3b4){return db[_0xa885('0x12')][_0xa885('0x3f')](_0x49c6a7[_0xa885('0x40')],{})['then'](respondWithResult(_0x47f3b4,0xc9))[_0xa885('0x3a')](handleError(_0x47f3b4,null));};exports['update']=function(_0x2d4bb5,_0x245fe9){if(_0x2d4bb5['body']['id']){delete _0x2d4bb5[_0xa885('0x40')]['id'];}return db[_0xa885('0x12')][_0xa885('0x3e')]({'where':{'id':_0x2d4bb5[_0xa885('0x3c')]['id']}})[_0xa885('0xd')](handleEntityNotFound(_0x245fe9,null))['then'](saveUpdates(_0x2d4bb5[_0xa885('0x40')],null))[_0xa885('0xd')](respondWithResult(_0x245fe9,null))[_0xa885('0x3a')](handleError(_0x245fe9,null));};exports['describe']=function(_0x4d146e,_0x52fbeb){return db[_0xa885('0x12')][_0xa885('0x41')]()[_0xa885('0xd')](respondWithResult(_0x52fbeb,null))[_0xa885('0x3a')](handleError(_0x52fbeb,null));};exports[_0xa885('0x42')]=function(_0x49aa9b,_0x43245c){var _0x476532;var _0x4397d6=_0x49aa9b[_0xa885('0x3c')]['id'];return db[_0xa885('0x12')]['find']({'where':{'id':_0x49aa9b['params']['id']}})['then'](handleEntityNotFound(_0x43245c,null))[_0xa885('0xd')](function(_0x289716){if(_0x289716){return _0x289716[_0xa885('0x42')]()[_0xa885('0xd')](function(_0x164d9d){return _0x164d9d;});}})[_0xa885('0xd')](function(_0x35e931){_0x476532=_0x35e931;if(_0x35e931){if(_0x35e931['VoiceQueueId']||_0x35e931[_0xa885('0x43')]){return db[_0x35e931[_0xa885('0x44')]?_0xa885('0x45'):_0xa885('0x46')][_0xa885('0x3e')]({'where':{'id':_0x35e931[_0xa885('0x44')]?_0x35e931[_0xa885('0x44')]:_0x35e931['CampaignId']},'attributes':['id',_0xa885('0x10')],'raw':!![]});}}})[_0xa885('0xd')](function(_0x1fde66){var _0x55ea83={};if(_0x1fde66){_[_0xa885('0x33')](_0x55ea83,_[_0xa885('0x47')](_0x476532[_0xa885('0x48')],[_0xa885('0x49'),_0xa885('0x4a'),'id']));_0x55ea83[_0xa885('0x4b')]=0x15;_0x55ea83[_0xa885('0x4c')]=_0xa885('0x4d');_0x55ea83['campaign']=_0x1fde66[_0xa885('0x10')];_0x55ea83[_0xa885('0x4e')]=_0x49aa9b[_0xa885('0x4f')]['name'];_0x55ea83[_0xa885('0x50')]=_0x49aa9b[_0xa885('0x4f')]['id'];_0x55ea83[_0xa885('0x4d')]=!![];_0x55ea83[_0xa885('0x51')]=moment()[_0xa885('0x52')](_0xa885('0x53'));_0x55ea83['calleridnum']=_0x476532[_0xa885('0x54')];_0x55ea83[_0xa885('0x55')]=_0x476532[_0xa885('0x44')]?'queue':_0xa885('0x56');return db[_0xa885('0x57')][_0xa885('0x3e')]({'where':{'id':_0x55ea83[_0xa885('0x58')]},'attributes':[_0xa885('0x59'),_0xa885('0x5a')]})[_0xa885('0xd')](function(_0x288bbc){if(!_[_0xa885('0x5b')](_0x43245c)&&!_['isNil'](_0x288bbc[_0xa885('0x59')])){_0x55ea83[_0xa885('0x5c')]=_0x288bbc['firstName'];if(!_['isNil'](_0x288bbc[_0xa885('0x5a')])){_0x55ea83[_0xa885('0x5c')]+='\x20'+_0x288bbc['lastName'];}}})[_0xa885('0x5d')](function(){return db[_0xa885('0x5e')][_0xa885('0x3f')](_0x55ea83);});}})[_0xa885('0xd')](function(_0x1e3576){return db[_0xa885('0x5f')][_0xa885('0x42')]({'where':{'CmHopperId':_0x4397d6}});})['then'](function(){return _0x43245c[_0xa885('0x5')](0xcc)[_0xa885('0x60')]();})['catch'](handleError(_0x43245c,null));};exports[_0xa885('0x61')]=function(_0x48ded4,_0x117cfe){var _0x5698d6=[];return db[_0xa885('0x57')][_0xa885('0x41')]()[_0xa885('0xd')](function(_0x22eb32){_0x5698d6=_['keys'](_0x22eb32);return _0x48ded4[_0xa885('0x4f')][_0xa885('0x62')]({'where':{'type':_0xa885('0x63'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xa885('0x64'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0xa885('0xd')](function(_0xb066be){if(_0xb066be&&_0xb066be['length']){return db[_0xa885('0x65')]['transaction'](function(_0x36c7ba){var _0x2f053a={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xa885('0x53'))},'VoiceQueueId':{'$in':_[_0xa885('0x34')](_0xb066be,'id')},'$or':[{'UserId':null},{'UserId':_0x48ded4[_0xa885('0x4f')]['id']}]};var _0x3bc750={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0xb066be)['filter'](['dialPreviewAutoRecallMe',0x0])[_0xa885('0x34')]('id')[_0xa885('0x66')]()},'$or':[{'UserId':null},{'UserId':_0x48ded4['user']['id']}]};var _0x55d5d0={'$or':[_0x2f053a,_0x3bc750]};var _0x3c9df4=[];if(_0x48ded4[_0xa885('0x40')][_0xa885('0x67')]&&_0x48ded4[_0xa885('0x40')][_0xa885('0x67')]===_0xa885('0x68')){if(!_[_0xa885('0x69')](_0x48ded4[_0xa885('0x40')][_0xa885('0x6a')])){_0x55d5d0['id']={'$in':_0x48ded4[_0xa885('0x40')][_0xa885('0x6a')]};}_0x3c9df4=[['priority',_0xa885('0x6b')],[_0xa885('0x6c'),_0xb066be[0x0][_0xa885('0x64')]===_0xa885('0x6b')?_0xa885('0x6d'):'ASC'],db[_0xa885('0x65')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0xa885('0x6d')]];}else{if(!_[_0xa885('0x69')](_0x48ded4['body']['hopperIds'])){_0x55d5d0['id']={'$notIn':_0x48ded4[_0xa885('0x40')][_0xa885('0x6a')]};}_0x3c9df4=[[_0xa885('0x6e'),'DESC'],['scheduledAt',_0xb066be[0x0][_0xa885('0x64')]],db[_0xa885('0x65')][_0xa885('0x6f')](_0xa885('0x70')),['id','ASC']];}return db[_0xa885('0x12')][_0xa885('0x71')]({'attributes':['id',_0xa885('0x72'),'phone','recallme'],'where':_0x55d5d0,'order':_0x3c9df4,'transaction':_0x36c7ba,'lock':_0x36c7ba[_0xa885('0x73')][_0xa885('0x74')],'include':[{'model':db[_0xa885('0x57')],'as':'Contact','attributes':_0x5698d6,'include':[{'model':db[_0xa885('0x75')],'as':_0xa885('0x76'),'attributes':['id',_0xa885('0x10')]}]},{'model':db[_0xa885('0x77')],'as':'List','attributes':['id',_0xa885('0x10')]},{'model':db[_0xa885('0x45')],'as':'Queue','attributes':['id',_0xa885('0x10'),_0xa885('0x78')]}]})['then'](function(_0x314d83){if(_0x314d83){return _0x314d83['update']({'UserId':_0x48ded4[_0xa885('0x4f')]['id']},{'transaction':_0x36c7ba});}});});}})[_0xa885('0xd')](handleEntityNotFound(_0x117cfe,null))[_0xa885('0xd')](respondWithResult(_0x117cfe,null))[_0xa885('0x3a')](handleError(_0x117cfe,null));};exports[_0xa885('0x79')]=function(_0x29ed6e,_0x1ca586,_0x3aa8bc){var _0x490d15=[];var _0x55413d=_0x29ed6e[_0xa885('0x3c')]['id'];var _0xb1eac6=_0x29ed6e['user']['id'];return db[_0xa885('0x57')][_0xa885('0x41')]()['then'](function(_0x425374){_0x490d15=_['keys'](_0x425374);return db[_0xa885('0x65')][_0xa885('0x7a')](function(_0x37ef1b){const _0x26950f={'id':_0x55413d};return db['CmHopper']['findOne']({'attributes':['id',_0xa885('0x72'),_0xa885('0x7b')],'where':_0x26950f,'transaction':_0x37ef1b,'lock':_0x37ef1b[_0xa885('0x73')][_0xa885('0x74')],'include':[{'model':db[_0xa885('0x57')],'as':_0xa885('0x7c'),'attributes':_0x490d15,'include':[{'model':db[_0xa885('0x75')],'as':_0xa885('0x76'),'attributes':['id','name']}]},{'model':db[_0xa885('0x77')],'as':'List','attributes':['id',_0xa885('0x10')]},{'model':db[_0xa885('0x45')],'as':_0xa885('0x7d'),'attributes':['id','name',_0xa885('0x78')]}]})[_0xa885('0xd')](function(_0x50a7ef){if(_0x50a7ef){return _0x50a7ef['update']({'UserId':_0xb1eac6},{'transaction':_0x37ef1b});}});});})[_0xa885('0xd')](handleEntityNotFound(_0x1ca586,null))[_0xa885('0xd')](respondWithResult(_0x1ca586,null))[_0xa885('0x3a')](handleError(_0x1ca586,null));};exports[_0xa885('0x7e')]=function(_0x243d5e,_0x4bd60c){return _0x243d5e['user'][_0xa885('0x62')]({'where':{'type':_0xa885('0x63'),'dialActive':!![],'dialMethod':_0xa885('0x7f')},'attributes':['id'],'raw':!![]})[_0xa885('0xd')](function(_0x56bd37){if(_0x56bd37&&_0x56bd37['length']){return db['CmHopper'][_0xa885('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xa885('0x52')](_0xa885('0x53'))},'VoiceQueueId':{'$in':_[_0xa885('0x34')](_0x56bd37,'id')},'$or':[{'UserId':null},{'UserId':_0x243d5e[_0xa885('0x4f')]['id']}]}});}return 0x0;})[_0xa885('0xd')](function(_0x220614){if(!_['isNil'](_0x220614)&&_['isNumber'](_0x220614)){return _0x4bd60c[_0xa885('0x5')](0xc8)['json']({'contacts':_0x220614});}else{logger[_0xa885('0xe')](_0xa885('0x80'),_0xa885('0x7e'),0x194,_0xa885('0x81'));_0x4bd60c['sendStatus'](0x194);}})[_0xa885('0x3a')](handleError(_0x4bd60c,null));};exports[_0xa885('0x82')]=function(_0x2ff728,_0x5a6f1f){var _0xe5881c=shared[_0xa885('0x83')];var _0x9cda91=[];_['map'](_0xe5881c,function(_0x1d51ac){_0x9cda91[_0xa885('0x84')]({'id':_0x1d51ac[_0xa885('0x10')],'name':_0x1d51ac[_0xa885('0x10')],'utcOffset':_0x1d51ac[_0xa885('0x85')]});});return _0x5a6f1f[_0xa885('0x5')](0xc8)['json']({'tz':_0x9cda91});};exports[_0xa885('0x86')]=function(_0x40a85d,_0x3be76a){var _0x1689c8=shared['timezones'];var _0x3c088d={};if(!_[_0xa885('0x5b')](_0x1689c8[_0x40a85d[_0xa885('0x40')]['id']]))_0x3c088d=_0x1689c8[_0x40a85d[_0xa885('0x40')]['id']];return _0x3be76a[_0xa885('0x5')](0xc8)[_0xa885('0x6')](_0x3c088d);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index f0a4b18..25ab55a 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 _0x5fab=['./cmHopper.attributes','exports','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x192a71,_0x2c7d12){var _0x5d6b6d=function(_0x3e7061){while(--_0x3e7061){_0x192a71['push'](_0x192a71['shift']());}};_0x5d6b6d(++_0x2c7d12);}(_0x5fab,0x177));var _0xb5fa=function(_0x290844,_0x366077){_0x290844=_0x290844-0x0;var _0x546847=_0x5fab[_0x290844];return _0x546847;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));module[_0xb5fa('0xa')]=function(_0x44df89,_0x4a0249){return _0x44df89['define'](_0xb5fa('0xb'),attributes,{'tableName':_0xb5fa('0xc'),'paranoid':![],'indexes':[{'name':_0xb5fa('0xd'),'fields':['scheduledat']},{'name':_0xb5fa('0xe'),'fields':[_0xb5fa('0xe')]},{'name':_0xb5fa('0xf'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0x31f0=['priority','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./cmHopper.attributes','define','cm_hopper','scheduledat','phone'];(function(_0x3e58b4,_0x3c3769){var _0x5d088d=function(_0x6c2f9a){while(--_0x6c2f9a){_0x3e58b4['push'](_0x3e58b4['shift']());}};_0x5d088d(++_0x3c3769);}(_0x31f0,0xb7));var _0x031f=function(_0x56adbe,_0x51b7ee){_0x56adbe=_0x56adbe-0x0;var _0x1006fa=_0x31f0[_0x56adbe];return _0x1006fa;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var logger=require(_0x031f('0x1'))('api');var moment=require(_0x031f('0x2'));var BPromise=require(_0x031f('0x3'));var rp=require(_0x031f('0x4'));var fs=require('fs');var path=require(_0x031f('0x5'));var rimraf=require('rimraf');var config=require(_0x031f('0x6'));var attributes=require(_0x031f('0x7'));module['exports']=function(_0x4c0f94,_0x56328c){return _0x4c0f94[_0x031f('0x8')]('CmHopper',attributes,{'tableName':_0x031f('0x9'),'paranoid':![],'indexes':[{'name':_0x031f('0xa'),'fields':[_0x031f('0xa')]},{'name':_0x031f('0xb'),'fields':['phone']},{'name':_0x031f('0xc'),'fields':[_0x031f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index cdfda22..22d2b80 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 _0x8a17=['info','GetCmHopper','debug','catch','error','message','raw','ShowCmHopper','CreateCmHopper','stringify','UpdateCmHopper','update','body','active','destroy','DestroyCmHopper','describe','sequelize','order','LOCK','CmContact','Contact','keys','User','Agent','length','UserId','push','includes','all','GetContactDialer','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','transaction','CmHopperFinal','create','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','GetContactRecallMe','UPDATE','GetCmHopperPreview','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','voicePause','CmList','List','CmHopperHandlePreviewRecallNotifications','lodash','bluebird','../../mysqldb','../../config/logger','rpc','CmHopper','findAll','options','where','attributes','limit','include','map','model','then'];(function(_0x5ce442,_0x5e5d0e){var _0x12c023=function(_0x3318f1){while(--_0x3318f1){_0x5ce442['push'](_0x5ce442['shift']());}};_0x12c023(++_0x5e5d0e);}(_0x8a17,0x135));var _0x78a1=function(_0x4884a7,_0x18e38a){_0x4884a7=_0x4884a7-0x0;var _0x56b60e=_0x8a17[_0x4884a7];return _0x56b60e;};'use strict';var _=require(_0x78a1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x78a1('0x1'));var db=require(_0x78a1('0x2'))['db'];var logger=require(_0x78a1('0x3'))(_0x78a1('0x4'));exports['GetCmHopper']=function(_0x2dee4d){var _0x168b2c=this;return new Promise(function(_0x30124e,_0x471d20){return db[_0x78a1('0x5')][_0x78a1('0x6')]({'raw':_0x2dee4d[_0x78a1('0x7')]?_0x2dee4d[_0x78a1('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0x2dee4d[_0x78a1('0x7')]?_0x2dee4d[_0x78a1('0x7')][_0x78a1('0x8')]||null:null,'attributes':_0x2dee4d[_0x78a1('0x7')]?_0x2dee4d['options'][_0x78a1('0x9')]||null:null,'limit':_0x2dee4d[_0x78a1('0x7')]?_0x2dee4d[_0x78a1('0x7')][_0x78a1('0xa')]||null:null,'include':_0x2dee4d[_0x78a1('0x7')]?_0x2dee4d[_0x78a1('0x7')][_0x78a1('0xb')]?_[_0x78a1('0xc')](_0x2dee4d['options'][_0x78a1('0xb')],function(_0x2820bd){return{'model':db[_0x2820bd['model']],'as':_0x2820bd['as'],'attributes':_0x2820bd[_0x78a1('0x9')],'include':_0x2820bd['include']?_[_0x78a1('0xc')](_0x2820bd[_0x78a1('0xb')],function(_0x53ba7a){return{'model':db[_0x53ba7a[_0x78a1('0xd')]],'as':_0x53ba7a['as'],'attributes':_0x53ba7a[_0x78a1('0x9')],'include':_0x53ba7a[_0x78a1('0xb')]?_[_0x78a1('0xc')](_0x53ba7a[_0x78a1('0xb')],function(_0x8bb937){return{'model':db[_0x8bb937[_0x78a1('0xd')]],'as':_0x8bb937['as'],'attributes':_0x8bb937[_0x78a1('0x9')]};}):[]};}):[]};}):[]:[]})[_0x78a1('0xe')](function(_0x36a3c4){logger[_0x78a1('0xf')](_0x78a1('0x10'),_0x2dee4d);logger[_0x78a1('0x11')](_0x78a1('0x10'),_0x2dee4d,JSON['stringify'](_0x36a3c4));_0x30124e(_0x36a3c4);})[_0x78a1('0x12')](function(_0x1bcd21){logger[_0x78a1('0x13')](_0x78a1('0x10'),_0x1bcd21[_0x78a1('0x14')],_0x2dee4d);_0x471d20(_0x168b2c[_0x78a1('0x13')](0x1f4,_0x1bcd21['message']));});});};exports['ShowCmHopper']=function(_0x132282){var _0x25ed2d=this;return new Promise(function(_0x17050c,_0x5ac50e){return db[_0x78a1('0x5')]['find']({'raw':_0x132282[_0x78a1('0x7')]?_0x132282['options'][_0x78a1('0x15')]===undefined?!![]:![]:!![],'where':_0x132282['options']?_0x132282[_0x78a1('0x7')]['where']||null:null,'attributes':_0x132282[_0x78a1('0x7')]?_0x132282[_0x78a1('0x7')][_0x78a1('0x9')]||null:null,'include':_0x132282[_0x78a1('0x7')]?_0x132282[_0x78a1('0x7')]['include']?_['map'](_0x132282['options'][_0x78a1('0xb')],function(_0x4ba920){return{'model':db[_0x4ba920['model']],'as':_0x4ba920['as'],'attributes':_0x4ba920[_0x78a1('0x9')],'include':_0x4ba920[_0x78a1('0xb')]?_[_0x78a1('0xc')](_0x4ba920[_0x78a1('0xb')],function(_0x5c8eb8){return{'model':db[_0x5c8eb8[_0x78a1('0xd')]],'as':_0x5c8eb8['as'],'attributes':_0x5c8eb8['attributes'],'include':_0x5c8eb8[_0x78a1('0xb')]?_[_0x78a1('0xc')](_0x5c8eb8[_0x78a1('0xb')],function(_0x143bc4){return{'model':db[_0x143bc4[_0x78a1('0xd')]],'as':_0x143bc4['as'],'attributes':_0x143bc4['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x44ac64){logger[_0x78a1('0xf')](_0x78a1('0x16'),_0x132282);logger[_0x78a1('0x11')](_0x78a1('0x16'),_0x132282,JSON['stringify'](_0x44ac64));_0x17050c(_0x44ac64);})[_0x78a1('0x12')](function(_0x3243da){logger[_0x78a1('0x13')](_0x78a1('0x16'),_0x3243da[_0x78a1('0x14')],_0x132282);_0x5ac50e(_0x25ed2d['error'](0x1f4,_0x3243da[_0x78a1('0x14')]));});});};exports[_0x78a1('0x17')]=function(_0x500211){var _0x59dbdf=this;return new Promise(function(_0x7f69fa,_0x4acaad){return db[_0x78a1('0x5')]['create'](_0x500211['body'],{'raw':_0x500211[_0x78a1('0x7')]?_0x500211['options'][_0x78a1('0x15')]===undefined?!![]:![]:!![]})[_0x78a1('0xe')](function(_0x37422d){logger[_0x78a1('0xf')](_0x78a1('0x17'),_0x500211);logger[_0x78a1('0x11')]('CreateCmHopper',_0x500211,JSON[_0x78a1('0x18')](_0x37422d));_0x7f69fa(_0x37422d);})[_0x78a1('0x12')](function(_0x23d3c4){logger[_0x78a1('0x13')]('CreateCmHopper',_0x23d3c4[_0x78a1('0x14')],_0x500211);_0x4acaad(_0x59dbdf[_0x78a1('0x13')](0x1f4,_0x23d3c4[_0x78a1('0x14')]));});});};exports[_0x78a1('0x19')]=function(_0x5107ee){var _0x264348=this;return new Promise(function(_0x5d2e7c,_0x359086){return db[_0x78a1('0x5')][_0x78a1('0x1a')](_0x5107ee[_0x78a1('0x1b')],{'raw':_0x5107ee[_0x78a1('0x7')]?_0x5107ee[_0x78a1('0x7')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5107ee[_0x78a1('0x7')]?_0x5107ee[_0x78a1('0x7')][_0x78a1('0x8')]||null:null,'attributes':_0x5107ee['options']?_0x5107ee[_0x78a1('0x7')][_0x78a1('0x9')]||null:null,'limit':_0x5107ee[_0x78a1('0x7')]?_0x5107ee['options']['limit']||null:null})[_0x78a1('0xe')](function(_0x3718da){logger[_0x78a1('0xf')](_0x78a1('0x19'),_0x5107ee);logger[_0x78a1('0xf')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x78a1('0x18')](_0x5107ee[_0x78a1('0x7')][_0x78a1('0x8')]),_0x5107ee[_0x78a1('0x1b')][_0x78a1('0x1c')]);logger[_0x78a1('0x11')](_0x78a1('0x19'),_0x5107ee,JSON[_0x78a1('0x18')](_0x3718da));_0x5d2e7c(_0x3718da);})[_0x78a1('0x12')](function(_0x5d38ff){logger[_0x78a1('0x13')](_0x78a1('0x19'),_0x5d38ff[_0x78a1('0x14')],_0x5107ee);_0x359086(_0x264348[_0x78a1('0x13')](0x1f4,_0x5d38ff[_0x78a1('0x14')]));});});};exports['DestroyCmHopper']=function(_0x509636){var _0x255743=this;return new Promise(function(_0x1714a0,_0x103350){return db[_0x78a1('0x5')][_0x78a1('0x1d')]({'where':_0x509636['options']?_0x509636[_0x78a1('0x7')]['where']||null:null})[_0x78a1('0xe')](function(_0x84be94){logger[_0x78a1('0xf')](_0x78a1('0x1e'),_0x509636);logger['debug'](_0x78a1('0x1e'),_0x509636,JSON[_0x78a1('0x18')](_0x84be94));_0x1714a0(_0x84be94);})[_0x78a1('0x12')](function(_0x351896){logger[_0x78a1('0x13')](_0x78a1('0x1e'),_0x351896[_0x78a1('0x14')],_0x509636);_0x103350(_0x255743[_0x78a1('0x13')](0x1f4,_0x351896[_0x78a1('0x14')]));});});};exports['GetContactDialer']=function(_0x578c04){var _0x39c41d=this;return new Promise(function(_0xc08c45,_0x5e038e){return db['CmContact'][_0x78a1('0x1f')]()[_0x78a1('0xe')](function(_0x2ff9c7){return db[_0x78a1('0x20')]['transaction'](function(_0x311c28){return db[_0x78a1('0x5')]['findAll']({'where':_0x578c04['options']?_0x578c04['options'][_0x78a1('0x8')]||null:null,'attributes':_0x578c04[_0x78a1('0x7')]?_0x578c04[_0x78a1('0x7')][_0x78a1('0x9')]||null:null,'limit':_0x578c04['options']?_0x578c04[_0x78a1('0x7')]['limit']||null:null,'order':_0x578c04[_0x78a1('0x7')]?_0x578c04[_0x78a1('0x7')][_0x78a1('0x21')]||null:null,'transaction':_0x311c28,'lock':_0x311c28[_0x78a1('0x22')]['UPDATE'],'include':[{'model':db[_0x78a1('0x23')],'as':_0x78a1('0x24'),'attributes':_[_0x78a1('0x25')](_0x2ff9c7)},{'model':db[_0x78a1('0x26')],'as':_0x78a1('0x27'),'attributes':['id','name','voicePause']}]})[_0x78a1('0xe')](function(_0x100b9c){var _0x175855=[];var _0x212f45=[];for(var _0x4acec3=0x0;_0x4acec3<_0x100b9c[_0x78a1('0x28')];_0x4acec3+=0x1){var _0x450141=_0x100b9c[_0x4acec3][_0x78a1('0x29')];if(_0x450141===null){_0x175855[_0x78a1('0x2a')](_0x100b9c[_0x4acec3][_0x78a1('0x1a')](_0x578c04[_0x78a1('0x1b')],{'transaction':_0x311c28}));}else if(!_0x212f45[_0x78a1('0x2b')](_0x450141)){_0x212f45[_0x78a1('0x2a')](_0x450141);_0x175855[_0x78a1('0x2a')](_0x100b9c[_0x4acec3][_0x78a1('0x1a')](_0x578c04[_0x78a1('0x1b')],{'transaction':_0x311c28}));}}return BPromise[_0x78a1('0x2c')](_0x175855);});})[_0x78a1('0xe')](function(_0x27197a){logger[_0x78a1('0xf')](_0x78a1('0x2d'),_0x578c04);if(_0x27197a['length']>0x0){logger[_0x78a1('0xf')](_0x78a1('0x2e'),_0x27197a[0x0][_0x78a1('0x2f')]['id'],_0x27197a[0x0][_0x78a1('0x2f')][_0x78a1('0x30')],_0x27197a[0x0][_0x78a1('0x2f')][_0x78a1('0x1c')]);}logger[_0x78a1('0x11')]('GetContactDialer',_0x578c04,JSON[_0x78a1('0x18')](_0x27197a));_0xc08c45(_0x27197a);})[_0x78a1('0x12')](function(_0x1921df){logger[_0x78a1('0x13')](_0x78a1('0x2d'),_0x1921df[_0x78a1('0x14')],_0x578c04);_0x5e038e(_0x39c41d[_0x78a1('0x13')](0x1f4,_0x1921df['message']));});});});};exports['MoveContactManagedDialer']=function(_0x18d5cb){var _0x5bc345=this;return new Promise(function(_0x4eece0,_0x214ec2){return db[_0x78a1('0x20')][_0x78a1('0x31')](function(_0x5a194e){return db[_0x78a1('0x32')][_0x78a1('0x33')](_0x18d5cb[_0x78a1('0x1b')],{'raw':_0x18d5cb['options']?_0x18d5cb[_0x78a1('0x7')]['raw']===undefined?!![]:![]:!![],'transaction':_0x5a194e})[_0x78a1('0xe')](function(){logger[_0x78a1('0xf')](_0x78a1('0x34'),JSON[_0x78a1('0x18')](_0x18d5cb[_0x78a1('0x7')][_0x78a1('0x8')]),_0x18d5cb[_0x78a1('0x7')][_0x78a1('0x8')]['active']);return db[_0x78a1('0x5')][_0x78a1('0x1d')]({'where':_0x18d5cb['options']?_0x18d5cb[_0x78a1('0x7')]['where']||null:null,'transaction':_0x5a194e});});})[_0x78a1('0xe')](function(_0x411f82){logger[_0x78a1('0xf')](_0x78a1('0x35'),_0x18d5cb);logger[_0x78a1('0x11')](_0x78a1('0x35'),_0x18d5cb,JSON[_0x78a1('0x18')](_0x411f82));_0x4eece0(_0x411f82);})[_0x78a1('0x12')](function(_0xcf5e2f){logger[_0x78a1('0x13')]('MoveContactManagedDialer',_0xcf5e2f[_0x78a1('0x14')],_0x18d5cb);_0x214ec2(_0x5bc345[_0x78a1('0x13')](0x1f4,_0xcf5e2f[_0x78a1('0x14')]));});});};exports[_0x78a1('0x36')]=function(_0x16e2de){var _0xd055ec=this;return new Promise(function(_0xde41c3,_0x3e2a72){return db[_0x78a1('0x5')]['findAll']({'raw':_0x16e2de[_0x78a1('0x7')]?_0x16e2de[_0x78a1('0x7')][_0x78a1('0x15')]===undefined?!![]:![]:!![],'where':_0x16e2de['options']?_0x16e2de['options'][_0x78a1('0x8')]||null:null,'attributes':[[db['sequelize']['fn'](_0x78a1('0x37'),db['sequelize']['fn']('IF',db[_0x78a1('0x20')][_0x78a1('0x38')](_0x78a1('0x39')+util[_0x78a1('0x3a')](_0x78a1('0x3b'),moment()[_0x78a1('0x3a')](_0x78a1('0x3c')))+_0x78a1('0x3d')))),'contactsRescheduled']]})['then'](function(_0x4fb871){logger[_0x78a1('0xf')](_0x78a1('0x36'),_0x16e2de);logger[_0x78a1('0x11')](_0x78a1('0x36'),_0x16e2de,JSON['stringify'](_0x4fb871));_0xde41c3(_0x4fb871);})[_0x78a1('0x12')](function(_0x5a5afb){logger['error'](_0x78a1('0x36'),_0x5a5afb[_0x78a1('0x14')],_0x16e2de);_0x3e2a72(_0xd055ec[_0x78a1('0x13')](0x1f4,_0x5a5afb[_0x78a1('0x14')]));});});};exports[_0x78a1('0x3e')]=function(_0x1e4316){var _0x375aea=this;return new Promise(function(_0x1ba76b,_0x1a92c3){return db[_0x78a1('0x23')]['describe']()[_0x78a1('0xe')](function(){return db[_0x78a1('0x20')][_0x78a1('0x31')](function(_0x183011){return db[_0x78a1('0x5')]['findAll']({'where':_0x1e4316[_0x78a1('0x7')]?_0x1e4316[_0x78a1('0x7')][_0x78a1('0x8')]||null:null,'attributes':_0x1e4316[_0x78a1('0x7')]?_0x1e4316[_0x78a1('0x7')][_0x78a1('0x9')]||null:null,'limit':0x1,'order':_0x1e4316['options']?_0x1e4316[_0x78a1('0x7')][_0x78a1('0x21')]||null:null,'group':db[_0x78a1('0x5')][_0x78a1('0x29')],'transaction':_0x183011,'lock':_0x183011[_0x78a1('0x22')][_0x78a1('0x3f')],'include':_0x1e4316[_0x78a1('0x7')]?_0x1e4316['options']['include']?_[_0x78a1('0xc')](_0x1e4316[_0x78a1('0x7')][_0x78a1('0xb')],function(_0x1bbda0){return{'model':db[_0x1bbda0[_0x78a1('0xd')]],'as':_0x1bbda0['as'],'attributes':_0x1bbda0[_0x78a1('0x9')],'include':_0x1bbda0[_0x78a1('0xb')]?_[_0x78a1('0xc')](_0x1bbda0[_0x78a1('0xb')],function(_0x1b2d94){return{'model':db[_0x1b2d94[_0x78a1('0xd')]],'as':_0x1b2d94['as'],'attributes':_0x1b2d94[_0x78a1('0x9')],'include':_0x1b2d94[_0x78a1('0xb')]?_['map'](_0x1b2d94[_0x78a1('0xb')],function(_0x84e0b0){return{'model':db[_0x84e0b0[_0x78a1('0xd')]],'as':_0x84e0b0['as'],'attributes':_0x84e0b0[_0x78a1('0x9')]};}):[]};}):[]};}):[]:[]})[_0x78a1('0xe')](function(_0x1b6723){var _0x3b81c6=[];for(var _0x275e91=0x0;_0x275e91<_0x1b6723[_0x78a1('0x28')];_0x275e91+=0x1){_0x3b81c6[_0x78a1('0x2a')](_0x1b6723[_0x275e91][_0x78a1('0x1a')](_0x1e4316[_0x78a1('0x1b')],{'transaction':_0x183011}));}return BPromise[_0x78a1('0x2c')](_0x3b81c6);});})[_0x78a1('0xe')](function(_0x215375){logger[_0x78a1('0xf')](_0x78a1('0x3e'),_0x1e4316);logger[_0x78a1('0x11')](_0x78a1('0x3e'),_0x1e4316,JSON['stringify'](_0x215375));_0x1ba76b(_0x215375);})['catch'](function(_0x48b810){logger[_0x78a1('0x13')](_0x78a1('0x3e'),_0x48b810[_0x78a1('0x14')],_0x1e4316);_0x1a92c3(_0x375aea[_0x78a1('0x13')](0x1f4,_0x48b810[_0x78a1('0x14')]));});});});};exports[_0x78a1('0x40')]=function(_0x3bde75){var _0x46221d=this;return new Promise(function(_0x4dc80c,_0x55b8c4){db[_0x78a1('0x23')][_0x78a1('0x1f')]()[_0x78a1('0xe')](function(_0x5ec35b){return db[_0x78a1('0x5')][_0x78a1('0x6')]({'raw':_0x3bde75[_0x78a1('0x7')]?_0x3bde75[_0x78a1('0x7')][_0x78a1('0x15')]===undefined?!![]:![]:!![],'where':_0x3bde75[_0x78a1('0x7')]?_0x3bde75[_0x78a1('0x7')][_0x78a1('0x8')]||null:null,'attributes':_0x3bde75['options']?_0x3bde75['options'][_0x78a1('0x9')]||null:null,'limit':_0x3bde75['options']?_0x3bde75[_0x78a1('0x7')][_0x78a1('0xa')]||null:null,'include':_0x3bde75['options']?_0x3bde75[_0x78a1('0x7')][_0x78a1('0xb')]?_[_0x78a1('0xc')](_0x3bde75[_0x78a1('0x7')][_0x78a1('0xb')],function(_0x5b496f){return{'model':db[_0x5b496f[_0x78a1('0xd')]],'as':_0x5b496f['as'],'attributes':_0x5b496f['as']===_0x78a1('0x24')?_[_0x78a1('0x25')](_0x5ec35b):_0x5b496f[_0x78a1('0x9')],'include':_0x5b496f[_0x78a1('0xb')]?_[_0x78a1('0xc')](_0x5b496f[_0x78a1('0xb')],function(_0x2307ba){return{'model':db[_0x2307ba[_0x78a1('0xd')]],'as':_0x2307ba['as'],'attributes':_0x2307ba[_0x78a1('0x9')],'include':_0x2307ba[_0x78a1('0xb')]?_['map'](_0x2307ba[_0x78a1('0xb')],function(_0x129aeb){return{'model':db[_0x129aeb['model']],'as':_0x129aeb['as'],'attributes':_0x129aeb['attributes']};}):[]};}):[]};}):[]:[]})[_0x78a1('0xe')](function(_0x537a69){logger['info'](_0x78a1('0x10'),_0x3bde75);logger['debug'](_0x78a1('0x10'),_0x3bde75,JSON[_0x78a1('0x18')](_0x537a69));_0x4dc80c(_0x537a69);})[_0x78a1('0x12')](function(_0x234662){logger[_0x78a1('0x13')](_0x78a1('0x10'),_0x234662[_0x78a1('0x14')],_0x3bde75);_0x55b8c4(_0x46221d[_0x78a1('0x13')](0x1f4,_0x234662[_0x78a1('0x14')]));});});});};exports[_0x78a1('0x41')]=function(_0x3f07f2){var _0x2c9864=this;return new Promise(function(_0x20f7ce,_0xc8f665){return db[_0x78a1('0x23')][_0x78a1('0x42')]({'raw':!![],'where':{'phone':_0x3f07f2[_0x78a1('0x7')]['where'][_0x78a1('0x43')]},'attributes':['id',_0x78a1('0x44')],'order':[['id',_0x78a1('0x45')]]})['then'](function(_0x17c689){logger['info'](_0x78a1('0x46'),_0x3f07f2);logger[_0x78a1('0x11')](_0x78a1('0x46'),_0x3f07f2,JSON['stringify'](_0x17c689));_0x20f7ce(_0x17c689);})[_0x78a1('0x12')](function(_0x1619de){logger[_0x78a1('0x13')](_0x78a1('0x46'),_0x1619de[_0x78a1('0x14')],_0x3f07f2);_0xc8f665(_0x2c9864[_0x78a1('0x13')](0x1f4,_0x1619de['message']));});});};exports['ResetActiveCalls']=function(_0x3ad1a9){var _0x29ef3e=this;return new Promise(function(_0x409270,_0x19cb0f){return db[_0x78a1('0x20')][_0x78a1('0x31')](function(_0x5cc3b5){var _0x2247b2=_0x3ad1a9['options']&&_0x3ad1a9['options'][_0x78a1('0x8')]?_0x3ad1a9['options'][_0x78a1('0x8')]:{};return db[_0x78a1('0x5')][_0x78a1('0x1a')](_0x3ad1a9[_0x78a1('0x1b')],{'where':_0x2247b2,'transaction':_0x5cc3b5})[_0x78a1('0xe')](function(_0x595555){logger[_0x78a1('0xf')](_0x78a1('0x47'),_0x3ad1a9);logger['debug'](_0x78a1('0x47'),_0x3ad1a9,JSON['stringify'](_0x595555));_0x409270(_0x595555);})[_0x78a1('0x12')](function(_0x4ec022){logger[_0x78a1('0x13')](_0x78a1('0x47'),_0x4ec022[_0x78a1('0x14')],_0x3ad1a9);_0x19cb0f(_0x29ef3e[_0x78a1('0x13')](0x1f4,_0x4ec022['message']));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x2f9e3e){var _0x192e4d=this;var _0x137935=_0x2f9e3e[_0x78a1('0x1b')][_0x78a1('0x8')]['voiceQueueIds'];var _0xa92d7a=_0x2f9e3e[_0x78a1('0x1b')]['where'][_0x78a1('0x48')];var _0x29de39=_0x2f9e3e[_0x78a1('0x1b')][_0x78a1('0x8')][_0x78a1('0x49')];return new Promise(function(_0x1ba5a8,_0x20b264){return db[_0x78a1('0x5')][_0x78a1('0x6')]({'where':{'voiceQueueId':{'$in':_0x137935},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x78a1('0x20')]['literal'](_0x78a1('0x4a')+_0xa92d7a+_0x78a1('0x4b')),'$gt':db[_0x78a1('0x20')][_0x78a1('0x38')](_0x78a1('0x4c'))}},'UserId':{'$in':_0x29de39}},'include':[{'model':db[_0x78a1('0x23')],'as':'Contact'},{'model':db[_0x78a1('0x26')],'as':_0x78a1('0x27'),'attributes':['id','name',_0x78a1('0x4d')]},{'model':db[_0x78a1('0x4e')],'as':_0x78a1('0x4f')}]})[_0x78a1('0xe')](function(_0x2eecf2){if(_0x2eecf2[_0x78a1('0x28')]>0x0){return db['sequelize'][_0x78a1('0x31')](function(_0x2be3a3){return db[_0x78a1('0x5')][_0x78a1('0x1a')]({'recallmeNotifiedDate':db[_0x78a1('0x20')]['literal'](_0x78a1('0x4c'))},{'where':{'id':{'$in':_['map'](_0x2eecf2,'id')}},'transaction':_0x2be3a3})[_0x78a1('0xe')](function(){_0x1ba5a8(_0x2eecf2);})[_0x78a1('0x12')](function(_0x114287){logger[_0x78a1('0x13')](_0x78a1('0x50'),_0x114287[_0x78a1('0x14')],_0x2f9e3e);_0x20b264(_0x192e4d[_0x78a1('0x13')](0x1f4,_0x114287['message']));});})[_0x78a1('0x12')](function(_0x94f87b){logger[_0x78a1('0x13')]('CmHopperHandlePreviewRecallNotifications',_0x94f87b[_0x78a1('0x14')],_0x2f9e3e);_0x20b264(_0x192e4d['error'](0x1f4,_0x94f87b[_0x78a1('0x14')]));});}else{_0x1ba5a8(_0x2eecf2);}});});}; \ No newline at end of file +var _0x465e=['find','stringify','catch','CreateCmHopper','create','body','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','destroy','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','UPDATE','Contact','User','Agent','name','voicePause','length','UserId','push','includes','all','dataValues','ContactId','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','MoveContactManagedDialer','CountReScheduled','COUNT','literal','format','YYYY-MM-DD\x20HH:mm:ss','GetContactRecallMe','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','interval','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','List','lodash','util','moment','bluebird','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','map','model','then','info','debug','error','message','ShowCmHopper'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x465e,0x1b1));var _0xe465=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0x465e[_0x1b6186];return _0x186121;};'use strict';var _=require(_0xe465('0x0'));var util=require(_0xe465('0x1'));var moment=require(_0xe465('0x2'));var BPromise=require(_0xe465('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0xe465('0x4'))(_0xe465('0x5'));exports[_0xe465('0x6')]=function(_0x498f8f){var _0x2eb2ea=this;return new Promise(function(_0x4bd9bf,_0x1f46a3){return db[_0xe465('0x7')][_0xe465('0x8')]({'raw':_0x498f8f[_0xe465('0x9')]?_0x498f8f[_0xe465('0x9')][_0xe465('0xa')]===undefined?!![]:![]:!![],'where':_0x498f8f[_0xe465('0x9')]?_0x498f8f[_0xe465('0x9')][_0xe465('0xb')]||null:null,'attributes':_0x498f8f[_0xe465('0x9')]?_0x498f8f['options'][_0xe465('0xc')]||null:null,'limit':_0x498f8f[_0xe465('0x9')]?_0x498f8f[_0xe465('0x9')][_0xe465('0xd')]||null:null,'include':_0x498f8f[_0xe465('0x9')]?_0x498f8f[_0xe465('0x9')]['include']?_['map'](_0x498f8f[_0xe465('0x9')][_0xe465('0xe')],function(_0xd0d2cb){return{'model':db[_0xd0d2cb['model']],'as':_0xd0d2cb['as'],'attributes':_0xd0d2cb[_0xe465('0xc')],'include':_0xd0d2cb[_0xe465('0xe')]?_[_0xe465('0xf')](_0xd0d2cb[_0xe465('0xe')],function(_0x2d80be){return{'model':db[_0x2d80be[_0xe465('0x10')]],'as':_0x2d80be['as'],'attributes':_0x2d80be['attributes'],'include':_0x2d80be[_0xe465('0xe')]?_[_0xe465('0xf')](_0x2d80be[_0xe465('0xe')],function(_0x513e66){return{'model':db[_0x513e66[_0xe465('0x10')]],'as':_0x513e66['as'],'attributes':_0x513e66[_0xe465('0xc')]};}):[]};}):[]};}):[]:[]})[_0xe465('0x11')](function(_0x51aad9){logger[_0xe465('0x12')](_0xe465('0x6'),_0x498f8f);logger[_0xe465('0x13')](_0xe465('0x6'),_0x498f8f,JSON['stringify'](_0x51aad9));_0x4bd9bf(_0x51aad9);})['catch'](function(_0x218523){logger[_0xe465('0x14')](_0xe465('0x6'),_0x218523[_0xe465('0x15')],_0x498f8f);_0x1f46a3(_0x2eb2ea[_0xe465('0x14')](0x1f4,_0x218523[_0xe465('0x15')]));});});};exports[_0xe465('0x16')]=function(_0x4ff490){var _0x1b718b=this;return new Promise(function(_0x8034fc,_0x437d24){return db[_0xe465('0x7')][_0xe465('0x17')]({'raw':_0x4ff490['options']?_0x4ff490['options'][_0xe465('0xa')]===undefined?!![]:![]:!![],'where':_0x4ff490[_0xe465('0x9')]?_0x4ff490[_0xe465('0x9')][_0xe465('0xb')]||null:null,'attributes':_0x4ff490[_0xe465('0x9')]?_0x4ff490['options'][_0xe465('0xc')]||null:null,'include':_0x4ff490[_0xe465('0x9')]?_0x4ff490[_0xe465('0x9')][_0xe465('0xe')]?_[_0xe465('0xf')](_0x4ff490[_0xe465('0x9')][_0xe465('0xe')],function(_0x12cb63){return{'model':db[_0x12cb63['model']],'as':_0x12cb63['as'],'attributes':_0x12cb63[_0xe465('0xc')],'include':_0x12cb63[_0xe465('0xe')]?_['map'](_0x12cb63[_0xe465('0xe')],function(_0x5bb123){return{'model':db[_0x5bb123[_0xe465('0x10')]],'as':_0x5bb123['as'],'attributes':_0x5bb123[_0xe465('0xc')],'include':_0x5bb123[_0xe465('0xe')]?_['map'](_0x5bb123[_0xe465('0xe')],function(_0x178943){return{'model':db[_0x178943['model']],'as':_0x178943['as'],'attributes':_0x178943['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4073e5){logger['info'](_0xe465('0x16'),_0x4ff490);logger[_0xe465('0x13')]('ShowCmHopper',_0x4ff490,JSON[_0xe465('0x18')](_0x4073e5));_0x8034fc(_0x4073e5);})[_0xe465('0x19')](function(_0x3cf97d){logger['error']('ShowCmHopper',_0x3cf97d[_0xe465('0x15')],_0x4ff490);_0x437d24(_0x1b718b[_0xe465('0x14')](0x1f4,_0x3cf97d[_0xe465('0x15')]));});});};exports[_0xe465('0x1a')]=function(_0x452697){var _0x445ed8=this;return new Promise(function(_0x1dba19,_0x27df97){return db[_0xe465('0x7')][_0xe465('0x1b')](_0x452697[_0xe465('0x1c')],{'raw':_0x452697['options']?_0x452697[_0xe465('0x9')][_0xe465('0xa')]===undefined?!![]:![]:!![]})[_0xe465('0x11')](function(_0x53023b){logger[_0xe465('0x12')](_0xe465('0x1a'),_0x452697);logger[_0xe465('0x13')](_0xe465('0x1a'),_0x452697,JSON[_0xe465('0x18')](_0x53023b));_0x1dba19(_0x53023b);})[_0xe465('0x19')](function(_0x380cef){logger['error'](_0xe465('0x1a'),_0x380cef[_0xe465('0x15')],_0x452697);_0x27df97(_0x445ed8[_0xe465('0x14')](0x1f4,_0x380cef[_0xe465('0x15')]));});});};exports[_0xe465('0x1d')]=function(_0x1e0a5b){var _0x889b01=this;return new Promise(function(_0x113aa7,_0x38a4ba){return db[_0xe465('0x7')][_0xe465('0x1e')](_0x1e0a5b['body'],{'raw':_0x1e0a5b[_0xe465('0x9')]?_0x1e0a5b[_0xe465('0x9')][_0xe465('0xa')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e0a5b[_0xe465('0x9')]?_0x1e0a5b[_0xe465('0x9')][_0xe465('0xb')]||null:null,'attributes':_0x1e0a5b[_0xe465('0x9')]?_0x1e0a5b[_0xe465('0x9')]['attributes']||null:null,'limit':_0x1e0a5b[_0xe465('0x9')]?_0x1e0a5b[_0xe465('0x9')][_0xe465('0xd')]||null:null})[_0xe465('0x11')](function(_0x5e3c00){logger['info'](_0xe465('0x1d'),_0x1e0a5b);logger[_0xe465('0x12')](_0xe465('0x1f'),JSON[_0xe465('0x18')](_0x1e0a5b[_0xe465('0x9')][_0xe465('0xb')]),_0x1e0a5b['body'][_0xe465('0x20')]);logger[_0xe465('0x13')]('UpdateCmHopper',_0x1e0a5b,JSON[_0xe465('0x18')](_0x5e3c00));_0x113aa7(_0x5e3c00);})[_0xe465('0x19')](function(_0x5eefb5){logger[_0xe465('0x14')](_0xe465('0x1d'),_0x5eefb5['message'],_0x1e0a5b);_0x38a4ba(_0x889b01[_0xe465('0x14')](0x1f4,_0x5eefb5[_0xe465('0x15')]));});});};exports['DestroyCmHopper']=function(_0x4aa2e8){var _0x8244bf=this;return new Promise(function(_0x4e1d81,_0x31aaae){return db[_0xe465('0x7')][_0xe465('0x21')]({'where':_0x4aa2e8[_0xe465('0x9')]?_0x4aa2e8[_0xe465('0x9')][_0xe465('0xb')]||null:null})['then'](function(_0x41bb92){logger[_0xe465('0x12')](_0xe465('0x22'),_0x4aa2e8);logger[_0xe465('0x13')](_0xe465('0x22'),_0x4aa2e8,JSON[_0xe465('0x18')](_0x41bb92));_0x4e1d81(_0x41bb92);})['catch'](function(_0x32bdba){logger[_0xe465('0x14')](_0xe465('0x22'),_0x32bdba[_0xe465('0x15')],_0x4aa2e8);_0x31aaae(_0x8244bf[_0xe465('0x14')](0x1f4,_0x32bdba[_0xe465('0x15')]));});});};exports[_0xe465('0x23')]=function(_0x4cce26){var _0x21394f=this;return new Promise(function(_0xf293b9,_0x4e352d){return db[_0xe465('0x24')][_0xe465('0x25')]()['then'](function(_0x1ce9b6){return db[_0xe465('0x26')][_0xe465('0x27')](function(_0x3cfde0){return db[_0xe465('0x7')][_0xe465('0x8')]({'where':_0x4cce26[_0xe465('0x9')]?_0x4cce26['options'][_0xe465('0xb')]||null:null,'attributes':_0x4cce26[_0xe465('0x9')]?_0x4cce26['options']['attributes']||null:null,'limit':_0x4cce26[_0xe465('0x9')]?_0x4cce26[_0xe465('0x9')][_0xe465('0xd')]||null:null,'order':_0x4cce26[_0xe465('0x9')]?_0x4cce26[_0xe465('0x9')][_0xe465('0x28')]||null:null,'transaction':_0x3cfde0,'lock':_0x3cfde0[_0xe465('0x29')][_0xe465('0x2a')],'include':[{'model':db[_0xe465('0x24')],'as':_0xe465('0x2b'),'attributes':_['keys'](_0x1ce9b6)},{'model':db[_0xe465('0x2c')],'as':_0xe465('0x2d'),'attributes':['id',_0xe465('0x2e'),_0xe465('0x2f')]}]})[_0xe465('0x11')](function(_0x53b2eb){var _0x55e6d9=[];var _0x593545=[];for(var _0x55d9ab=0x0;_0x55d9ab<_0x53b2eb[_0xe465('0x30')];_0x55d9ab+=0x1){var _0x3725b2=_0x53b2eb[_0x55d9ab][_0xe465('0x31')];if(_0x3725b2===null){_0x55e6d9[_0xe465('0x32')](_0x53b2eb[_0x55d9ab]['update'](_0x4cce26[_0xe465('0x1c')],{'transaction':_0x3cfde0}));}else if(!_0x593545[_0xe465('0x33')](_0x3725b2)){_0x593545[_0xe465('0x32')](_0x3725b2);_0x55e6d9[_0xe465('0x32')](_0x53b2eb[_0x55d9ab][_0xe465('0x1e')](_0x4cce26[_0xe465('0x1c')],{'transaction':_0x3cfde0}));}}return BPromise[_0xe465('0x34')](_0x55e6d9);});})[_0xe465('0x11')](function(_0x50473a){logger[_0xe465('0x12')](_0xe465('0x23'),_0x4cce26);if(_0x50473a['length']>0x0){logger[_0xe465('0x12')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x50473a[0x0][_0xe465('0x35')]['id'],_0x50473a[0x0]['dataValues'][_0xe465('0x36')],_0x50473a[0x0][_0xe465('0x35')][_0xe465('0x20')]);}logger[_0xe465('0x13')](_0xe465('0x23'),_0x4cce26,JSON['stringify'](_0x50473a));_0xf293b9(_0x50473a);})[_0xe465('0x19')](function(_0x1734a1){logger[_0xe465('0x14')]('GetContactDialer',_0x1734a1[_0xe465('0x15')],_0x4cce26);_0x4e352d(_0x21394f[_0xe465('0x14')](0x1f4,_0x1734a1[_0xe465('0x15')]));});});});};exports['MoveContactManagedDialer']=function(_0x20a25d){var _0x555f66=this;return new Promise(function(_0x216955,_0x6cee01){return db[_0xe465('0x26')][_0xe465('0x27')](function(_0x264fd0){return db[_0xe465('0x37')][_0xe465('0x1b')](_0x20a25d[_0xe465('0x1c')],{'raw':_0x20a25d[_0xe465('0x9')]?_0x20a25d[_0xe465('0x9')][_0xe465('0xa')]===undefined?!![]:![]:!![],'transaction':_0x264fd0})[_0xe465('0x11')](function(){logger[_0xe465('0x12')](_0xe465('0x38'),JSON[_0xe465('0x18')](_0x20a25d['options'][_0xe465('0xb')]),_0x20a25d['options'][_0xe465('0xb')][_0xe465('0x20')]);return db[_0xe465('0x7')]['destroy']({'where':_0x20a25d[_0xe465('0x9')]?_0x20a25d[_0xe465('0x9')]['where']||null:null,'transaction':_0x264fd0});});})[_0xe465('0x11')](function(_0x270317){logger[_0xe465('0x12')](_0xe465('0x39'),_0x20a25d);logger[_0xe465('0x13')](_0xe465('0x39'),_0x20a25d,JSON[_0xe465('0x18')](_0x270317));_0x216955(_0x270317);})[_0xe465('0x19')](function(_0x151b32){logger[_0xe465('0x14')]('MoveContactManagedDialer',_0x151b32['message'],_0x20a25d);_0x6cee01(_0x555f66[_0xe465('0x14')](0x1f4,_0x151b32[_0xe465('0x15')]));});});};exports[_0xe465('0x3a')]=function(_0x5e0bfc){var _0x521d08=this;return new Promise(function(_0x1f45f7,_0xa8ea86){return db[_0xe465('0x7')][_0xe465('0x8')]({'raw':_0x5e0bfc[_0xe465('0x9')]?_0x5e0bfc['options'][_0xe465('0xa')]===undefined?!![]:![]:!![],'where':_0x5e0bfc['options']?_0x5e0bfc[_0xe465('0x9')][_0xe465('0xb')]||null:null,'attributes':[[db[_0xe465('0x26')]['fn'](_0xe465('0x3b'),db['sequelize']['fn']('IF',db[_0xe465('0x26')][_0xe465('0x3c')]('`scheduledat`\x20>=\x20'+util[_0xe465('0x3d')]('\x22%s\x22',moment()['format'](_0xe465('0x3e')))+'\x20,\x201,\x20null'))),'contactsRescheduled']]})[_0xe465('0x11')](function(_0x4ee9ff){logger['info'](_0xe465('0x3a'),_0x5e0bfc);logger[_0xe465('0x13')](_0xe465('0x3a'),_0x5e0bfc,JSON[_0xe465('0x18')](_0x4ee9ff));_0x1f45f7(_0x4ee9ff);})['catch'](function(_0x1e63fd){logger[_0xe465('0x14')](_0xe465('0x3a'),_0x1e63fd[_0xe465('0x15')],_0x5e0bfc);_0xa8ea86(_0x521d08['error'](0x1f4,_0x1e63fd[_0xe465('0x15')]));});});};exports[_0xe465('0x3f')]=function(_0x5a531a){var _0x324c40=this;return new Promise(function(_0x161cb2,_0x2f6dca){return db['CmContact']['describe']()[_0xe465('0x11')](function(){return db[_0xe465('0x26')]['transaction'](function(_0x1f9de2){return db['CmHopper'][_0xe465('0x8')]({'where':_0x5a531a[_0xe465('0x9')]?_0x5a531a[_0xe465('0x9')][_0xe465('0xb')]||null:null,'attributes':_0x5a531a[_0xe465('0x9')]?_0x5a531a[_0xe465('0x9')][_0xe465('0xc')]||null:null,'limit':0x1,'order':_0x5a531a['options']?_0x5a531a['options'][_0xe465('0x28')]||null:null,'group':db[_0xe465('0x7')][_0xe465('0x31')],'transaction':_0x1f9de2,'lock':_0x1f9de2[_0xe465('0x29')][_0xe465('0x2a')],'include':_0x5a531a[_0xe465('0x9')]?_0x5a531a['options'][_0xe465('0xe')]?_[_0xe465('0xf')](_0x5a531a[_0xe465('0x9')]['include'],function(_0x27d647){return{'model':db[_0x27d647[_0xe465('0x10')]],'as':_0x27d647['as'],'attributes':_0x27d647[_0xe465('0xc')],'include':_0x27d647[_0xe465('0xe')]?_[_0xe465('0xf')](_0x27d647[_0xe465('0xe')],function(_0x14e66c){return{'model':db[_0x14e66c[_0xe465('0x10')]],'as':_0x14e66c['as'],'attributes':_0x14e66c['attributes'],'include':_0x14e66c['include']?_[_0xe465('0xf')](_0x14e66c[_0xe465('0xe')],function(_0x1a6aaa){return{'model':db[_0x1a6aaa[_0xe465('0x10')]],'as':_0x1a6aaa['as'],'attributes':_0x1a6aaa[_0xe465('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x77e6a5){var _0x4a14d8=[];for(var _0x6b4f4b=0x0;_0x6b4f4b<_0x77e6a5[_0xe465('0x30')];_0x6b4f4b+=0x1){_0x4a14d8[_0xe465('0x32')](_0x77e6a5[_0x6b4f4b][_0xe465('0x1e')](_0x5a531a[_0xe465('0x1c')],{'transaction':_0x1f9de2}));}return BPromise[_0xe465('0x34')](_0x4a14d8);});})[_0xe465('0x11')](function(_0x55e839){logger[_0xe465('0x12')](_0xe465('0x3f'),_0x5a531a);logger['debug'](_0xe465('0x3f'),_0x5a531a,JSON[_0xe465('0x18')](_0x55e839));_0x161cb2(_0x55e839);})[_0xe465('0x19')](function(_0x541208){logger['error'](_0xe465('0x3f'),_0x541208[_0xe465('0x15')],_0x5a531a);_0x2f6dca(_0x324c40[_0xe465('0x14')](0x1f4,_0x541208[_0xe465('0x15')]));});});});};exports['GetCmHopperPreview']=function(_0x8a4c30){var _0xeb5f70=this;return new Promise(function(_0x13f0e2,_0x2c7152){db['CmContact'][_0xe465('0x25')]()[_0xe465('0x11')](function(_0x430ccf){return db[_0xe465('0x7')][_0xe465('0x8')]({'raw':_0x8a4c30[_0xe465('0x9')]?_0x8a4c30[_0xe465('0x9')][_0xe465('0xa')]===undefined?!![]:![]:!![],'where':_0x8a4c30[_0xe465('0x9')]?_0x8a4c30[_0xe465('0x9')][_0xe465('0xb')]||null:null,'attributes':_0x8a4c30[_0xe465('0x9')]?_0x8a4c30[_0xe465('0x9')][_0xe465('0xc')]||null:null,'limit':_0x8a4c30[_0xe465('0x9')]?_0x8a4c30[_0xe465('0x9')][_0xe465('0xd')]||null:null,'include':_0x8a4c30[_0xe465('0x9')]?_0x8a4c30[_0xe465('0x9')][_0xe465('0xe')]?_['map'](_0x8a4c30[_0xe465('0x9')][_0xe465('0xe')],function(_0x4d1525){return{'model':db[_0x4d1525['model']],'as':_0x4d1525['as'],'attributes':_0x4d1525['as']===_0xe465('0x2b')?_['keys'](_0x430ccf):_0x4d1525['attributes'],'include':_0x4d1525[_0xe465('0xe')]?_['map'](_0x4d1525[_0xe465('0xe')],function(_0x154f3f){return{'model':db[_0x154f3f['model']],'as':_0x154f3f['as'],'attributes':_0x154f3f[_0xe465('0xc')],'include':_0x154f3f[_0xe465('0xe')]?_['map'](_0x154f3f[_0xe465('0xe')],function(_0x44f2fa){return{'model':db[_0x44f2fa[_0xe465('0x10')]],'as':_0x44f2fa['as'],'attributes':_0x44f2fa[_0xe465('0xc')]};}):[]};}):[]};}):[]:[]})[_0xe465('0x11')](function(_0x3e9617){logger[_0xe465('0x12')](_0xe465('0x6'),_0x8a4c30);logger['debug'](_0xe465('0x6'),_0x8a4c30,JSON[_0xe465('0x18')](_0x3e9617));_0x13f0e2(_0x3e9617);})['catch'](function(_0xc46dfb){logger['error'](_0xe465('0x6'),_0xc46dfb['message'],_0x8a4c30);_0x2c7152(_0xeb5f70[_0xe465('0x14')](0x1f4,_0xc46dfb[_0xe465('0x15')]));});});});};exports[_0xe465('0x40')]=function(_0x264e4c){var _0x231ce3=this;return new Promise(function(_0x19efbc,_0x35f676){return db[_0xe465('0x24')][_0xe465('0x41')]({'raw':!![],'where':{'phone':_0x264e4c[_0xe465('0x9')][_0xe465('0xb')][_0xe465('0x42')]},'attributes':['id',_0xe465('0x43')],'order':[['id',_0xe465('0x44')]]})[_0xe465('0x11')](function(_0x1d331d){logger['info'](_0xe465('0x45'),_0x264e4c);logger['debug'](_0xe465('0x45'),_0x264e4c,JSON[_0xe465('0x18')](_0x1d331d));_0x19efbc(_0x1d331d);})[_0xe465('0x19')](function(_0x5cf3c0){logger[_0xe465('0x14')](_0xe465('0x45'),_0x5cf3c0[_0xe465('0x15')],_0x264e4c);_0x35f676(_0x231ce3[_0xe465('0x14')](0x1f4,_0x5cf3c0[_0xe465('0x15')]));});});};exports['ResetActiveCalls']=function(_0x1c2c3c){var _0x28efe7=this;return new Promise(function(_0x11c0c0,_0x2514dc){return db[_0xe465('0x26')][_0xe465('0x27')](function(_0xa14b47){var _0x435116=_0x1c2c3c[_0xe465('0x9')]&&_0x1c2c3c['options']['where']?_0x1c2c3c[_0xe465('0x9')][_0xe465('0xb')]:{};return db[_0xe465('0x7')][_0xe465('0x1e')](_0x1c2c3c['body'],{'where':_0x435116,'transaction':_0xa14b47})[_0xe465('0x11')](function(_0x2b0a07){logger['info'](_0xe465('0x46'),_0x1c2c3c);logger[_0xe465('0x13')](_0xe465('0x46'),_0x1c2c3c,JSON[_0xe465('0x18')](_0x2b0a07));_0x11c0c0(_0x2b0a07);})[_0xe465('0x19')](function(_0x4d6734){logger[_0xe465('0x14')]('ResetActiveCalls',_0x4d6734[_0xe465('0x15')],_0x1c2c3c);_0x2514dc(_0x28efe7['error'](0x1f4,_0x4d6734['message']));});});});};exports[_0xe465('0x47')]=function(_0x4ad63e){var _0x24b5c0=this;var _0x46fe74=_0x4ad63e[_0xe465('0x1c')]['where']['voiceQueueIds'];var _0x4995de=_0x4ad63e[_0xe465('0x1c')][_0xe465('0xb')][_0xe465('0x48')];var _0x465014=_0x4ad63e['body'][_0xe465('0xb')]['availableAgentsIds'];return new Promise(function(_0x20fecb,_0x44117a){return db['CmHopper'][_0xe465('0x8')]({'where':{'voiceQueueId':{'$in':_0x46fe74},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xe465('0x26')][_0xe465('0x3c')](_0xe465('0x49')+_0x4995de+_0xe465('0x4a')),'$gt':db[_0xe465('0x26')][_0xe465('0x3c')]('NOW()')}},'UserId':{'$in':_0x465014}},'include':[{'model':db[_0xe465('0x24')],'as':_0xe465('0x2b')},{'model':db[_0xe465('0x2c')],'as':'Agent','attributes':['id','name',_0xe465('0x2f')]},{'model':db['CmList'],'as':_0xe465('0x4b')}]})['then'](function(_0x1084e5){if(_0x1084e5[_0xe465('0x30')]>0x0){return db['sequelize'][_0xe465('0x27')](function(_0x1cd785){return db[_0xe465('0x7')][_0xe465('0x1e')]({'recallmeNotifiedDate':db[_0xe465('0x26')][_0xe465('0x3c')]('NOW()')},{'where':{'id':{'$in':_[_0xe465('0xf')](_0x1084e5,'id')}},'transaction':_0x1cd785})[_0xe465('0x11')](function(){_0x20fecb(_0x1084e5);})[_0xe465('0x19')](function(_0x5b5b76){logger[_0xe465('0x14')](_0xe465('0x47'),_0x5b5b76[_0xe465('0x15')],_0x4ad63e);_0x44117a(_0x24b5c0[_0xe465('0x14')](0x1f4,_0x5b5b76[_0xe465('0x15')]));});})[_0xe465('0x19')](function(_0xc91ed7){logger[_0xe465('0x14')](_0xe465('0x47'),_0xc91ed7['message'],_0x4ad63e);_0x44117a(_0x24b5c0[_0xe465('0x14')](0x1f4,_0xc91ed7[_0xe465('0x15')]));});}else{_0x20fecb(_0x1084e5);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 528d3fc..40fcb8f 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 _0xc70e=['destroy','exports','express','Router','./cmHopper.controller','get','index','/describe','isAuthenticated','describe','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id','show','/:id/previewrecall','getPreviewRecall','post','create','/preview','getPreview','/timezone','put','delete'];(function(_0x21b093,_0x49a7cf){var _0x39d5a9=function(_0x54febf){while(--_0x54febf){_0x21b093['push'](_0x21b093['shift']());}};_0x39d5a9(++_0x49a7cf);}(_0xc70e,0x98));var _0xec70=function(_0x1324ec,_0x3c781b){_0x1324ec=_0x1324ec-0x0;var _0x2c76e1=_0xc70e[_0x1324ec];return _0x2c76e1;};'use strict';var express=require(_0xec70('0x0'));var router=express[_0xec70('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xec70('0x2'));router[_0xec70('0x3')]('/',auth['isAuthenticated'](),controller[_0xec70('0x4')]);router[_0xec70('0x3')](_0xec70('0x5'),auth[_0xec70('0x6')](),controller[_0xec70('0x7')]);router['get'](_0xec70('0x8'),auth['isAuthenticated'](),controller[_0xec70('0x9')]);router['get'](_0xec70('0xa'),auth['isAuthenticated'](),controller[_0xec70('0xb')]);router[_0xec70('0x3')](_0xec70('0xc'),auth['isAuthenticated'](),controller[_0xec70('0xd')]);router['get'](_0xec70('0xe'),auth[_0xec70('0x6')](),controller[_0xec70('0xf')]);router[_0xec70('0x10')]('/',auth[_0xec70('0x6')](),controller[_0xec70('0x11')]);router['post'](_0xec70('0x12'),auth[_0xec70('0x6')](),controller[_0xec70('0x13')]);router['post'](_0xec70('0x14'),auth[_0xec70('0x6')](),controller['getTimezone']);router[_0xec70('0x15')](_0xec70('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xec70('0x16')](_0xec70('0xc'),auth[_0xec70('0x6')](),controller[_0xec70('0x17')]);module[_0xec70('0x18')]=router; \ No newline at end of file +var _0x78d1=['/:id','show','getPreviewRecall','post','/preview','/timezone','getTimezone','put','destroy','exports','./cmHopper.controller','get','index','/describe','isAuthenticated','describe','/opencontacts','getOpenContacts','/timezones','getTimezones'];(function(_0x19997d,_0x2c92a4){var _0x49be7f=function(_0x2e5d31){while(--_0x2e5d31){_0x19997d['push'](_0x19997d['shift']());}};_0x49be7f(++_0x2c92a4);}(_0x78d1,0x122));var _0x178d=function(_0x33ef77,_0x181723){_0x33ef77=_0x33ef77-0x0;var _0x52e726=_0x78d1[_0x33ef77];return _0x52e726;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x178d('0x0'));router[_0x178d('0x1')]('/',auth['isAuthenticated'](),controller[_0x178d('0x2')]);router[_0x178d('0x1')](_0x178d('0x3'),auth[_0x178d('0x4')](),controller[_0x178d('0x5')]);router[_0x178d('0x1')](_0x178d('0x6'),auth['isAuthenticated'](),controller[_0x178d('0x7')]);router[_0x178d('0x1')](_0x178d('0x8'),auth[_0x178d('0x4')](),controller[_0x178d('0x9')]);router[_0x178d('0x1')](_0x178d('0xa'),auth[_0x178d('0x4')](),controller[_0x178d('0xb')]);router['get']('/:id/previewrecall',auth[_0x178d('0x4')](),controller[_0x178d('0xc')]);router[_0x178d('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x178d('0xe'),auth[_0x178d('0x4')](),controller['getPreview']);router[_0x178d('0xd')](_0x178d('0xf'),auth[_0x178d('0x4')](),controller[_0x178d('0x10')]);router[_0x178d('0x11')]('/:id',auth[_0x178d('0x4')](),controller['update']);router['delete'](_0x178d('0xa'),auth['isAuthenticated'](),controller[_0x178d('0x12')]);module[_0x178d('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 8990ecd..ef3e658 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 _0x3756=['format','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','INTEGER','STRING','DATE'];(function(_0x4b6800,_0x52dbd4){var _0x333f7c=function(_0x59e572){while(--_0x59e572){_0x4b6800['push'](_0x4b6800['shift']());}};_0x333f7c(++_0x52dbd4);}(_0x3756,0x144));var _0x6375=function(_0x394c3f,_0x73ea9d){_0x394c3f=_0x394c3f-0x0;var _0x3f3886=_0x3756[_0x394c3f];return _0x3f3886;};'use strict';var moment=require(_0x6375('0x0'));var Sequelize=require(_0x6375('0x1'));module['exports']={'CmHopperId':{'type':Sequelize[_0x6375('0x2')]},'phone':{'type':Sequelize[_0x6375('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x6375('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x6375('0x4')],'defaultValue':moment()[_0x6375('0x5')](_0x6375('0x6'))},'countbusyretry':{'type':Sequelize[_0x6375('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6375('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x6375('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6375('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6375('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6375('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1156=['moment','sequelize','exports','INTEGER','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x482382,_0xe4e0f7){var _0x51c3a2=function(_0x364468){while(--_0x364468){_0x482382['push'](_0x482382['shift']());}};_0x51c3a2(++_0xe4e0f7);}(_0x1156,0x98));var _0x6115=function(_0x2053ea,_0x1ab2d4){_0x2053ea=_0x2053ea-0x0;var _0x2232c4=_0x1156[_0x2053ea];return _0x2232c4;};'use strict';var moment=require(_0x6115('0x0'));var Sequelize=require(_0x6115('0x1'));module[_0x6115('0x2')]={'CmHopperId':{'type':Sequelize[_0x6115('0x3')]},'phone':{'type':Sequelize[_0x6115('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x6115('0x5')],'defaultValue':moment()[_0x6115('0x6')](_0x6115('0x7'))},'countbusyretry':{'type':Sequelize[_0x6115('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6115('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6115('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6115('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6115('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6115('0x3')],'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 d43b4b9..2eaa95b 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 _0xa3d5=['jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','destroy','then','get','UserProfileResource','end','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','CmHopperAdditionalPhone','includeAll','findAll','rows','catch','show','keys','include','find','create','body','role','user','CmHopperAdditionalPhones','UserProfileSection','userProfileId','autoAssociation','update','params','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto'];(function(_0xf2f6a,_0x28ce5a){var _0x49f7eb=function(_0x4e08b4){while(--_0x4e08b4){_0xf2f6a['push'](_0xf2f6a['shift']());}};_0x49f7eb(++_0x28ce5a);}(_0xa3d5,0x1e0));var _0x5a3d=function(_0x1ca890,_0x21d0d3){_0x1ca890=_0x1ca890-0x0;var _0x3f8e01=_0xa3d5[_0x1ca890];return _0x3f8e01;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5a3d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5a3d('0x1'));var rp=require(_0x5a3d('0x2'));var moment=require('moment');var BPromise=require(_0x5a3d('0x3'));var Mustache=require(_0x5a3d('0x4'));var util=require(_0x5a3d('0x5'));var path=require(_0x5a3d('0x6'));var sox=require('sox');var csv=require(_0x5a3d('0x7'));var ejs=require(_0x5a3d('0x8'));var fs=require('fs');var fs_extra=require(_0x5a3d('0x9'));var _=require('lodash');var squel=require(_0x5a3d('0xa'));var crypto=require(_0x5a3d('0xb'));var jsforce=require(_0x5a3d('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5a3d('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5a3d('0xe'));var qs=require(_0x5a3d('0xf'));var as=require(_0x5a3d('0x10'));var hardwareService=require(_0x5a3d('0x11'));var logger=require(_0x5a3d('0x12'))(_0x5a3d('0x13'));var utils=require(_0x5a3d('0x14'));var config=require(_0x5a3d('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x5a3d('0x16'))['db'];function respondWithStatusCode(_0x28c011,_0x1f794d){_0x1f794d=_0x1f794d||0xcc;return function(_0x20cee8){if(_0x20cee8){return _0x28c011[_0x5a3d('0x17')](_0x1f794d);}return _0x28c011[_0x5a3d('0x18')](_0x1f794d)['end']();};}function respondWithResult(_0xbc7143,_0x1e30bf){_0x1e30bf=_0x1e30bf||0xc8;return function(_0x329e64){if(_0x329e64){return _0xbc7143[_0x5a3d('0x18')](_0x1e30bf)[_0x5a3d('0x19')](_0x329e64);}};}function respondWithFilteredResult(_0x5d2231,_0x2f9d58){return function(_0x2024b6){if(_0x2024b6){var _0x1a0db2=typeof _0x2f9d58[_0x5a3d('0x1a')]===_0x5a3d('0x1b')&&typeof _0x2f9d58[_0x5a3d('0x1c')]===_0x5a3d('0x1b');var _0x5c98e5=_0x2024b6[_0x5a3d('0x1d')];var _0x37e97b=_0x1a0db2?0x0:_0x2f9d58[_0x5a3d('0x1a')];var _0x575ccd=_0x1a0db2?_0x2024b6['count']:_0x2f9d58[_0x5a3d('0x1a')]+_0x2f9d58['limit'];var _0x4038cb;if(_0x575ccd>=_0x5c98e5){_0x575ccd=_0x5c98e5;_0x4038cb=0xc8;}else{_0x4038cb=0xce;}_0x5d2231[_0x5a3d('0x18')](_0x4038cb);return _0x5d2231[_0x5a3d('0x1e')](_0x5a3d('0x1f'),_0x37e97b+'-'+_0x575ccd+'/'+_0x5c98e5)[_0x5a3d('0x19')](_0x2024b6);}return null;};}function patchUpdates(_0x417ae7){return function(_0x3be3ce){try{jsonpatch['apply'](_0x3be3ce,_0x417ae7,!![]);}catch(_0x544741){return BPromise[_0x5a3d('0x20')](_0x544741);}return _0x3be3ce['save']();};}function saveUpdates(_0x1c9f07,_0x1ab0a4){return function(_0x1e2c57){if(_0x1e2c57){return _0x1e2c57['update'](_0x1c9f07)['then'](function(_0x5c6dc2){return _0x5c6dc2;});}return null;};}function removeEntity(_0x3cc2ac,_0x2b4693){return function(_0x1c57be){if(_0x1c57be){return _0x1c57be[_0x5a3d('0x21')]()[_0x5a3d('0x22')](function(){var _0x244215=_0x1c57be[_0x5a3d('0x23')]({'plain':!![]});var _0x5ec400='CmHopperAdditionalPhones';return db[_0x5a3d('0x24')]['destroy']({'where':{'type':_0x5ec400,'resourceId':_0x244215['id']}})['then'](function(){return _0x1c57be;});})[_0x5a3d('0x22')](function(){_0x3cc2ac[_0x5a3d('0x18')](0xcc)[_0x5a3d('0x25')]();});}};}function handleEntityNotFound(_0x3d3631,_0x5bf18e){return function(_0x55a32c){if(!_0x55a32c){_0x3d3631[_0x5a3d('0x17')](0x194);}return _0x55a32c;};}function handleError(_0x4af200,_0x1546c9){_0x1546c9=_0x1546c9||0x1f4;return function(_0x2b5c32){logger[_0x5a3d('0x26')](_0x2b5c32[_0x5a3d('0x27')]);if(_0x2b5c32['name']){delete _0x2b5c32[_0x5a3d('0x28')];}_0x4af200['status'](_0x1546c9)[_0x5a3d('0x29')](_0x2b5c32);};}exports[_0x5a3d('0x2a')]=function(_0x59b22e,_0x1952e7){var _0x57a019={},_0x15381e={},_0x47c221={'count':0x0,'rows':[]};var _0x19e5d7=_['map'](db['CmHopperAdditionalPhone'][_0x5a3d('0x2b')],function(_0x400695){return{'name':_0x400695[_0x5a3d('0x2c')],'type':_0x400695[_0x5a3d('0x2d')]['key']};});_0x15381e[_0x5a3d('0x2e')]=_[_0x5a3d('0x2f')](_0x19e5d7,_0x5a3d('0x28'));_0x15381e['query']=_['keys'](_0x59b22e[_0x5a3d('0x30')]);_0x15381e['filters']=_['intersection'](_0x15381e['model'],_0x15381e['query']);_0x57a019[_0x5a3d('0x31')]=_[_0x5a3d('0x32')](_0x15381e[_0x5a3d('0x2e')],qs[_0x5a3d('0x33')](_0x59b22e['query']['fields']));_0x57a019[_0x5a3d('0x31')]=_0x57a019[_0x5a3d('0x31')][_0x5a3d('0x34')]?_0x57a019['attributes']:_0x15381e[_0x5a3d('0x2e')];if(!_0x59b22e[_0x5a3d('0x30')][_0x5a3d('0x35')](_0x5a3d('0x36'))){_0x57a019['limit']=qs['limit'](_0x59b22e[_0x5a3d('0x30')][_0x5a3d('0x1c')]);_0x57a019[_0x5a3d('0x1a')]=qs[_0x5a3d('0x1a')](_0x59b22e[_0x5a3d('0x30')]['offset']);}_0x57a019[_0x5a3d('0x37')]=qs[_0x5a3d('0x38')](_0x59b22e[_0x5a3d('0x30')][_0x5a3d('0x38')]);_0x57a019[_0x5a3d('0x39')]=qs[_0x5a3d('0x3a')](_[_0x5a3d('0x3b')](_0x59b22e[_0x5a3d('0x30')],_0x15381e[_0x5a3d('0x3a')]),_0x19e5d7);if(_0x59b22e[_0x5a3d('0x30')][_0x5a3d('0x3c')]){_0x57a019['where']=_[_0x5a3d('0x3d')](_0x57a019[_0x5a3d('0x39')],{'$or':_[_0x5a3d('0x2f')](_0x19e5d7,function(_0x1d38da){if(_0x1d38da['type']!=='VIRTUAL'){var _0x36f25c={};_0x36f25c[_0x1d38da[_0x5a3d('0x28')]]={'$like':'%'+_0x59b22e[_0x5a3d('0x30')][_0x5a3d('0x3c')]+'%'};return _0x36f25c;}})});}_0x57a019=_[_0x5a3d('0x3d')]({},_0x57a019,_0x59b22e[_0x5a3d('0x3e')]);var _0x574026={'where':_0x57a019[_0x5a3d('0x39')]};return db[_0x5a3d('0x3f')]['count'](_0x574026)[_0x5a3d('0x22')](function(_0x91d408){_0x47c221[_0x5a3d('0x1d')]=_0x91d408;if(_0x59b22e[_0x5a3d('0x30')][_0x5a3d('0x40')]){_0x57a019['include']=[{'all':!![]}];}return db[_0x5a3d('0x3f')][_0x5a3d('0x41')](_0x57a019);})[_0x5a3d('0x22')](function(_0x1eaa30){_0x47c221[_0x5a3d('0x42')]=_0x1eaa30;return _0x47c221;})[_0x5a3d('0x22')](respondWithFilteredResult(_0x1952e7,_0x57a019))[_0x5a3d('0x43')](handleError(_0x1952e7,null));};exports[_0x5a3d('0x44')]=function(_0x1e485d,_0x2dab12){var _0x11f959={'raw':!![],'where':{'id':_0x1e485d['params']['id']}},_0x184e1d={};_0x184e1d['model']=_[_0x5a3d('0x45')](db[_0x5a3d('0x3f')][_0x5a3d('0x2b')]);_0x184e1d[_0x5a3d('0x30')]=_[_0x5a3d('0x45')](_0x1e485d[_0x5a3d('0x30')]);_0x184e1d['filters']=_[_0x5a3d('0x32')](_0x184e1d[_0x5a3d('0x2e')],_0x184e1d[_0x5a3d('0x30')]);_0x11f959[_0x5a3d('0x31')]=_[_0x5a3d('0x32')](_0x184e1d['model'],qs[_0x5a3d('0x33')](_0x1e485d[_0x5a3d('0x30')][_0x5a3d('0x33')]));_0x11f959[_0x5a3d('0x31')]=_0x11f959[_0x5a3d('0x31')][_0x5a3d('0x34')]?_0x11f959['attributes']:_0x184e1d[_0x5a3d('0x2e')];if(_0x1e485d[_0x5a3d('0x30')][_0x5a3d('0x40')]){_0x11f959[_0x5a3d('0x46')]=[{'all':!![]}];}_0x11f959=_[_0x5a3d('0x3d')]({},_0x11f959,_0x1e485d[_0x5a3d('0x3e')]);return db[_0x5a3d('0x3f')][_0x5a3d('0x47')](_0x11f959)[_0x5a3d('0x22')](handleEntityNotFound(_0x2dab12,null))[_0x5a3d('0x22')](respondWithResult(_0x2dab12,null))[_0x5a3d('0x43')](handleError(_0x2dab12,null));};exports[_0x5a3d('0x48')]=function(_0xd09c3d,_0x1aabf5){return db[_0x5a3d('0x3f')][_0x5a3d('0x48')](_0xd09c3d[_0x5a3d('0x49')],{})[_0x5a3d('0x22')](function(_0x197439){var _0x28bbc5=_0xd09c3d['user'][_0x5a3d('0x23')]({'plain':!![]});if(!_0x28bbc5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x28bbc5[_0x5a3d('0x4a')]===_0x5a3d('0x4b')){var _0x4889ed=_0x197439[_0x5a3d('0x23')]({'plain':!![]});var _0x381977=_0x5a3d('0x4c');return db[_0x5a3d('0x4d')][_0x5a3d('0x47')]({'where':{'name':_0x381977,'userProfileId':_0x28bbc5[_0x5a3d('0x4e')]},'raw':!![]})[_0x5a3d('0x22')](function(_0x30c5ee){if(_0x30c5ee&&_0x30c5ee[_0x5a3d('0x4f')]===0x0){return db[_0x5a3d('0x24')][_0x5a3d('0x48')]({'name':_0x4889ed[_0x5a3d('0x28')],'resourceId':_0x4889ed['id'],'type':_0x30c5ee[_0x5a3d('0x28')],'sectionId':_0x30c5ee['id']},{})['then'](function(){return _0x197439;});}else{return _0x197439;}})['catch'](function(_0x583b8b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x583b8b);throw _0x583b8b;});}return _0x197439;})[_0x5a3d('0x22')](respondWithResult(_0x1aabf5,0xc9))[_0x5a3d('0x43')](handleError(_0x1aabf5,null));};exports[_0x5a3d('0x50')]=function(_0x4631b0,_0x1c8088){if(_0x4631b0[_0x5a3d('0x49')]['id']){delete _0x4631b0[_0x5a3d('0x49')]['id'];}return db['CmHopperAdditionalPhone']['find']({'where':{'id':_0x4631b0[_0x5a3d('0x51')]['id']}})[_0x5a3d('0x22')](handleEntityNotFound(_0x1c8088,null))[_0x5a3d('0x22')](saveUpdates(_0x4631b0[_0x5a3d('0x49')],null))[_0x5a3d('0x22')](respondWithResult(_0x1c8088,null))[_0x5a3d('0x43')](handleError(_0x1c8088,null));};exports[_0x5a3d('0x21')]=function(_0x146357,_0x2dc742){return db[_0x5a3d('0x3f')][_0x5a3d('0x47')]({'where':{'id':_0x146357[_0x5a3d('0x51')]['id']}})[_0x5a3d('0x22')](handleEntityNotFound(_0x2dc742,null))['then'](removeEntity(_0x2dc742,null))[_0x5a3d('0x43')](handleError(_0x2dc742,null));}; \ No newline at end of file +var _0x252d=['querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','get','UserProfileResource','destroy','then','error','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','model','query','filters','fields','attributes','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','intersection','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmHopperAdditionalPhones','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x252d,0x95));var _0xd252=function(_0x27bd2c,_0x24bd98){_0x27bd2c=_0x27bd2c-0x0;var _0x3784ea=_0x252d[_0x27bd2c];return _0x3784ea;};'use strict';var emlformat=require(_0xd252('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd252('0x1'));var jsonpatch=require(_0xd252('0x2'));var rp=require(_0xd252('0x3'));var moment=require(_0xd252('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd252('0x5'));var util=require(_0xd252('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xd252('0x7'));var ejs=require(_0xd252('0x8'));var fs=require('fs');var fs_extra=require(_0xd252('0x9'));var _=require(_0xd252('0xa'));var squel=require(_0xd252('0xb'));var crypto=require(_0xd252('0xc'));var jsforce=require(_0xd252('0xd'));var deskjs=require(_0xd252('0xe'));var toCsv=require(_0xd252('0x7'));var querystring=require(_0xd252('0xf'));var Papa=require(_0xd252('0x10'));var Redis=require(_0xd252('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd252('0x12'));var as=require(_0xd252('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd252('0x14'))(_0xd252('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd252('0x16'));var db=require(_0xd252('0x17'))['db'];function respondWithStatusCode(_0x57ed5f,_0x3fe720){_0x3fe720=_0x3fe720||0xcc;return function(_0x53c62c){if(_0x53c62c){return _0x57ed5f[_0xd252('0x18')](_0x3fe720);}return _0x57ed5f['status'](_0x3fe720)[_0xd252('0x19')]();};}function respondWithResult(_0x475c6b,_0x380837){_0x380837=_0x380837||0xc8;return function(_0x423bed){if(_0x423bed){return _0x475c6b[_0xd252('0x1a')](_0x380837)['json'](_0x423bed);}};}function respondWithFilteredResult(_0x549f05,_0x2ce772){return function(_0x3ded21){if(_0x3ded21){var _0xe9fd55=typeof _0x2ce772[_0xd252('0x1b')]===_0xd252('0x1c')&&typeof _0x2ce772['limit']==='undefined';var _0x2bb5d3=_0x3ded21[_0xd252('0x1d')];var _0x38af02=_0xe9fd55?0x0:_0x2ce772['offset'];var _0x1a42db=_0xe9fd55?_0x3ded21[_0xd252('0x1d')]:_0x2ce772['offset']+_0x2ce772[_0xd252('0x1e')];var _0x28686c;if(_0x1a42db>=_0x2bb5d3){_0x1a42db=_0x2bb5d3;_0x28686c=0xc8;}else{_0x28686c=0xce;}_0x549f05[_0xd252('0x1a')](_0x28686c);return _0x549f05[_0xd252('0x1f')](_0xd252('0x20'),_0x38af02+'-'+_0x1a42db+'/'+_0x2bb5d3)[_0xd252('0x21')](_0x3ded21);}return null;};}function patchUpdates(_0x4a14ef){return function(_0x45d2f3){try{jsonpatch[_0xd252('0x22')](_0x45d2f3,_0x4a14ef,!![]);}catch(_0x1bbab6){return BPromise[_0xd252('0x23')](_0x1bbab6);}return _0x45d2f3[_0xd252('0x24')]();};}function saveUpdates(_0x3adc8b,_0x9c203b){return function(_0x13cde0){if(_0x13cde0){return _0x13cde0[_0xd252('0x25')](_0x3adc8b)['then'](function(_0x3999ad){return _0x3999ad;});}return null;};}function removeEntity(_0x24c2ae,_0x952a36){return function(_0x49f9b0){if(_0x49f9b0){return _0x49f9b0['destroy']()['then'](function(){var _0x5202b5=_0x49f9b0[_0xd252('0x26')]({'plain':!![]});var _0x3703d1='CmHopperAdditionalPhones';return db[_0xd252('0x27')][_0xd252('0x28')]({'where':{'type':_0x3703d1,'resourceId':_0x5202b5['id']}})[_0xd252('0x29')](function(){return _0x49f9b0;});})['then'](function(){_0x24c2ae[_0xd252('0x1a')](0xcc)[_0xd252('0x19')]();});}};}function handleEntityNotFound(_0x10fa33,_0x5a40d6){return function(_0x50e929){if(!_0x50e929){_0x10fa33[_0xd252('0x18')](0x194);}return _0x50e929;};}function handleError(_0x3f8cb1,_0x3a0627){_0x3a0627=_0x3a0627||0x1f4;return function(_0x533091){logger[_0xd252('0x2a')](_0x533091['stack']);if(_0x533091[_0xd252('0x2b')]){delete _0x533091[_0xd252('0x2b')];}_0x3f8cb1['status'](_0x3a0627)[_0xd252('0x2c')](_0x533091);};}exports[_0xd252('0x2d')]=function(_0x766f9f,_0x4a1445){var _0x2cba32={},_0x109c3b={},_0x4252c2={'count':0x0,'rows':[]};var _0x4a96b8=_[_0xd252('0x2e')](db[_0xd252('0x2f')][_0xd252('0x30')],function(_0x236166){return{'name':_0x236166[_0xd252('0x31')],'type':_0x236166[_0xd252('0x32')]['key']};});_0x109c3b[_0xd252('0x33')]=_[_0xd252('0x2e')](_0x4a96b8,_0xd252('0x2b'));_0x109c3b[_0xd252('0x34')]=_['keys'](_0x766f9f[_0xd252('0x34')]);_0x109c3b[_0xd252('0x35')]=_['intersection'](_0x109c3b[_0xd252('0x33')],_0x109c3b[_0xd252('0x34')]);_0x2cba32['attributes']=_['intersection'](_0x109c3b[_0xd252('0x33')],qs[_0xd252('0x36')](_0x766f9f[_0xd252('0x34')]['fields']));_0x2cba32[_0xd252('0x37')]=_0x2cba32['attributes'][_0xd252('0x38')]?_0x2cba32[_0xd252('0x37')]:_0x109c3b[_0xd252('0x33')];if(!_0x766f9f[_0xd252('0x34')][_0xd252('0x39')]('nolimit')){_0x2cba32[_0xd252('0x1e')]=qs[_0xd252('0x1e')](_0x766f9f['query'][_0xd252('0x1e')]);_0x2cba32['offset']=qs[_0xd252('0x1b')](_0x766f9f['query'][_0xd252('0x1b')]);}_0x2cba32['order']=qs[_0xd252('0x3a')](_0x766f9f['query'][_0xd252('0x3a')]);_0x2cba32[_0xd252('0x3b')]=qs[_0xd252('0x35')](_['pick'](_0x766f9f['query'],_0x109c3b[_0xd252('0x35')]),_0x4a96b8);if(_0x766f9f['query'][_0xd252('0x3c')]){_0x2cba32[_0xd252('0x3b')]=_[_0xd252('0x3d')](_0x2cba32[_0xd252('0x3b')],{'$or':_['map'](_0x4a96b8,function(_0x51158e){if(_0x51158e['type']!==_0xd252('0x3e')){var _0x149842={};_0x149842[_0x51158e[_0xd252('0x2b')]]={'$like':'%'+_0x766f9f[_0xd252('0x34')][_0xd252('0x3c')]+'%'};return _0x149842;}})});}_0x2cba32=_[_0xd252('0x3d')]({},_0x2cba32,_0x766f9f[_0xd252('0x3f')]);var _0x3c058a={'where':_0x2cba32[_0xd252('0x3b')]};return db['CmHopperAdditionalPhone']['count'](_0x3c058a)['then'](function(_0x443a45){_0x4252c2[_0xd252('0x1d')]=_0x443a45;if(_0x766f9f[_0xd252('0x34')][_0xd252('0x40')]){_0x2cba32[_0xd252('0x41')]=[{'all':!![]}];}return db[_0xd252('0x2f')][_0xd252('0x42')](_0x2cba32);})[_0xd252('0x29')](function(_0xf62dfa){_0x4252c2[_0xd252('0x43')]=_0xf62dfa;return _0x4252c2;})[_0xd252('0x29')](respondWithFilteredResult(_0x4a1445,_0x2cba32))[_0xd252('0x44')](handleError(_0x4a1445,null));};exports[_0xd252('0x45')]=function(_0x28b476,_0x1156da){var _0x4e5a45={'raw':!![],'where':{'id':_0x28b476[_0xd252('0x46')]['id']}},_0x1a019b={};_0x1a019b[_0xd252('0x33')]=_['keys'](db[_0xd252('0x2f')][_0xd252('0x30')]);_0x1a019b['query']=_[_0xd252('0x47')](_0x28b476['query']);_0x1a019b[_0xd252('0x35')]=_[_0xd252('0x48')](_0x1a019b[_0xd252('0x33')],_0x1a019b[_0xd252('0x34')]);_0x4e5a45['attributes']=_[_0xd252('0x48')](_0x1a019b[_0xd252('0x33')],qs['fields'](_0x28b476[_0xd252('0x34')]['fields']));_0x4e5a45[_0xd252('0x37')]=_0x4e5a45[_0xd252('0x37')][_0xd252('0x38')]?_0x4e5a45['attributes']:_0x1a019b[_0xd252('0x33')];if(_0x28b476[_0xd252('0x34')]['includeAll']){_0x4e5a45[_0xd252('0x41')]=[{'all':!![]}];}_0x4e5a45=_[_0xd252('0x3d')]({},_0x4e5a45,_0x28b476[_0xd252('0x3f')]);return db['CmHopperAdditionalPhone']['find'](_0x4e5a45)[_0xd252('0x29')](handleEntityNotFound(_0x1156da,null))[_0xd252('0x29')](respondWithResult(_0x1156da,null))[_0xd252('0x44')](handleError(_0x1156da,null));};exports[_0xd252('0x49')]=function(_0x3391ad,_0x1ff783){return db[_0xd252('0x2f')]['create'](_0x3391ad[_0xd252('0x4a')],{})['then'](function(_0xcd85ae){var _0x2f4f87=_0x3391ad['user'][_0xd252('0x26')]({'plain':!![]});if(!_0x2f4f87)throw new Error(_0xd252('0x4b'));if(_0x2f4f87[_0xd252('0x4c')]==='user'){var _0x10a0ba=_0xcd85ae[_0xd252('0x26')]({'plain':!![]});var _0x1bce8d=_0xd252('0x4d');return db[_0xd252('0x4e')][_0xd252('0x4f')]({'where':{'name':_0x1bce8d,'userProfileId':_0x2f4f87['userProfileId']},'raw':!![]})['then'](function(_0x2d751a){if(_0x2d751a&&_0x2d751a[_0xd252('0x50')]===0x0){return db[_0xd252('0x27')][_0xd252('0x49')]({'name':_0x10a0ba['name'],'resourceId':_0x10a0ba['id'],'type':_0x2d751a[_0xd252('0x2b')],'sectionId':_0x2d751a['id']},{})[_0xd252('0x29')](function(){return _0xcd85ae;});}else{return _0xcd85ae;}})[_0xd252('0x44')](function(_0x3f816c){logger[_0xd252('0x2a')](_0xd252('0x51'),_0x3f816c);throw _0x3f816c;});}return _0xcd85ae;})[_0xd252('0x29')](respondWithResult(_0x1ff783,0xc9))[_0xd252('0x44')](handleError(_0x1ff783,null));};exports[_0xd252('0x25')]=function(_0x41b53f,_0x6abf83){if(_0x41b53f[_0xd252('0x4a')]['id']){delete _0x41b53f['body']['id'];}return db[_0xd252('0x2f')][_0xd252('0x4f')]({'where':{'id':_0x41b53f[_0xd252('0x46')]['id']}})['then'](handleEntityNotFound(_0x6abf83,null))[_0xd252('0x29')](saveUpdates(_0x41b53f['body'],null))[_0xd252('0x29')](respondWithResult(_0x6abf83,null))[_0xd252('0x44')](handleError(_0x6abf83,null));};exports[_0xd252('0x28')]=function(_0x1d35aa,_0x99b5ca){return db['CmHopperAdditionalPhone'][_0xd252('0x4f')]({'where':{'id':_0x1d35aa[_0xd252('0x46')]['id']}})[_0xd252('0x29')](handleEntityNotFound(_0x99b5ca,null))[_0xd252('0x29')](removeEntity(_0x99b5ca,null))[_0xd252('0x44')](handleError(_0x99b5ca,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index e770af8..6b96e51 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 _0x9dbf=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','define','CmHopperAdditionalPhone','lodash'];(function(_0x5e42a7,_0x3eba35){var _0x36d21b=function(_0x567f0a){while(--_0x567f0a){_0x5e42a7['push'](_0x5e42a7['shift']());}};_0x36d21b(++_0x3eba35);}(_0x9dbf,0x99));var _0xf9db=function(_0x3bdf48,_0x1fa313){_0x3bdf48=_0x3bdf48-0x0;var _0x7a63c6=_0x9dbf[_0x3bdf48];return _0x7a63c6;};'use strict';var _=require(_0xf9db('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf9db('0x1'));var moment=require(_0xf9db('0x2'));var BPromise=require(_0xf9db('0x3'));var rp=require(_0xf9db('0x4'));var fs=require('fs');var path=require(_0xf9db('0x5'));var rimraf=require(_0xf9db('0x6'));var config=require(_0xf9db('0x7'));var attributes=require(_0xf9db('0x8'));module['exports']=function(_0xc9f8a7,_0x127970){return _0xc9f8a7[_0xf9db('0x9')](_0xf9db('0xa'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f2d=['request-promise','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','api','moment','bluebird'];(function(_0x2e0163,_0x8d5cd0){var _0x801a4c=function(_0x1df815){while(--_0x1df815){_0x2e0163['push'](_0x2e0163['shift']());}};_0x801a4c(++_0x8d5cd0);}(_0x7f2d,0x1ea));var _0xd7f2=function(_0x1e753b,_0x209149){_0x1e753b=_0x1e753b-0x0;var _0x13d34e=_0x7f2d[_0x1e753b];return _0x13d34e;};'use strict';var _=require(_0xd7f2('0x0'));var util=require(_0xd7f2('0x1'));var logger=require('../../config/logger')(_0xd7f2('0x2'));var moment=require(_0xd7f2('0x3'));var BPromise=require(_0xd7f2('0x4'));var rp=require(_0xd7f2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd7f2('0x6'));module[_0xd7f2('0x7')]=function(_0x1366ff,_0x212421){return _0x1366ff[_0xd7f2('0x8')](_0xd7f2('0x9'),attributes,{'tableName':_0xd7f2('0xa'),'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 0cc4eca..43c9fda 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 _0xd376=['CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','findOne','countbusyretry','countnoanswerretry','entity','dialGlobalMaxRetry','SwapAdditionalPhones','ListId','VoiceQueueId','duration','waitTime','isNil','scheduledat','add','minutes','phone','countmachineretry','createdAt','updatedAt','transaction','update','IncrementPreviewCounters','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','VerifyAdditionalPhones','CmHopper','ContactId','body'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xd376,0x16e));var _0x6d37=function(_0xc6b104,_0x1d805a){_0xc6b104=_0xc6b104-0x0;var _0x1c6fce=_0xd376[_0xc6b104];return _0x1c6fce;};'use strict';var _=require(_0x6d37('0x0'));var util=require(_0x6d37('0x1'));var moment=require('moment');var BPromise=require(_0x6d37('0x2'));var rs=require(_0x6d37('0x3'));var fs=require('fs');var Redis=require(_0x6d37('0x4'));var db=require(_0x6d37('0x5'))['db'];var utils=require(_0x6d37('0x6'));var logger=require(_0x6d37('0x7'))(_0x6d37('0x8'));var config=require(_0x6d37('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6d37('0xa')][_0x6d37('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x218630,_0x1e0d15,_0xbb4db8){return new BPromise(function(_0x191371,_0x59f675){return client['request'](_0x218630,_0xbb4db8)[_0x6d37('0xc')](function(_0x16fe9f){logger[_0x6d37('0xd')](_0x6d37('0xe'),_0x1e0d15,_0x6d37('0xf'));logger['debug'](_0x6d37('0x10'),_0x1e0d15,_0x6d37('0xf'),JSON['stringify'](_0x16fe9f));if(_0x16fe9f[_0x6d37('0x11')]){if(_0x16fe9f['error'][_0x6d37('0x12')]===0x1f4){logger[_0x6d37('0x11')](_0x6d37('0xe'),_0x1e0d15,_0x16fe9f[_0x6d37('0x11')][_0x6d37('0x13')]);return _0x59f675(_0x16fe9f['error']['message']);}logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x1e0d15,_0x16fe9f['error']['message']);return _0x191371(_0x16fe9f[_0x6d37('0x11')][_0x6d37('0x13')]);}else{logger[_0x6d37('0xd')](_0x6d37('0xe'),_0x1e0d15,_0x6d37('0xf'));_0x191371(_0x16fe9f[_0x6d37('0x14')]['message']);}})[_0x6d37('0x15')](function(_0x394877){logger[_0x6d37('0x11')](_0x6d37('0xe'),_0x1e0d15,_0x394877);_0x59f675(_0x394877);});});}exports[_0x6d37('0x16')]=function(_0x5b6e85){var _0x34585e=this;return new Promise(function(_0x208e20,_0x715c0c){return db[_0x6d37('0x17')]['findOne']({'raw':!![],'where':{'ContactId':_0x5b6e85['body'][_0x6d37('0x18')],'ListId':_0x5b6e85[_0x6d37('0x19')]['ListId'],'VoiceQueueId':_0x5b6e85[_0x6d37('0x19')]['VoiceQueueId']===undefined?null:_0x5b6e85[_0x6d37('0x19')]['VoiceQueueId'],'CampaignId':_0x5b6e85[_0x6d37('0x19')][_0x6d37('0x1a')]===undefined?null:_0x5b6e85[_0x6d37('0x19')][_0x6d37('0x1a')]}})[_0x6d37('0xc')](function(_0x3b0802){if(_0x3b0802!=null){return db[_0x6d37('0x1b')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x3b0802['id'],'OrderBy':{'$gt':_0x3b0802['OrderBy']}},'order':[[_0x6d37('0x1c'),_0x6d37('0x1d')]]})['then'](function(_0x42548b){var _0x4435ce=0x0;if(_0x42548b){if(_0x42548b['countbusyretry']+_0x42548b[_0x6d37('0x1e')]+_0x42548b['countnoanswerretry']+_0x42548b[_0x6d37('0x1f')]+_0x42548b[_0x6d37('0x20')]+_0x42548b[_0x6d37('0x21')]+_0x42548b['countmachineretry']+_0x42548b[_0x6d37('0x22')]<_0x5b6e85['entity']['dialGlobalMaxRetry'])_0x4435ce=0x1;_0x208e20({'additional':_0x4435ce});}else{return db['CmHopperAdditionalPhone'][_0x6d37('0x23')]({'raw':!![],'where':{'CmHopperId':_0x3b0802['id']},'order':[[_0x6d37('0x1c'),_0x6d37('0x1d')]]})[_0x6d37('0xc')](function(_0x27b2d1){var _0x443925=0x0;if(_0x27b2d1){if(_0x27b2d1[_0x6d37('0x24')]+_0x27b2d1[_0x6d37('0x1e')]+_0x27b2d1[_0x6d37('0x25')]+_0x27b2d1[_0x6d37('0x1f')]+_0x27b2d1[_0x6d37('0x20')]+_0x27b2d1[_0x6d37('0x21')]+_0x27b2d1['countmachineretry']+_0x27b2d1[_0x6d37('0x22')]<_0x5b6e85[_0x6d37('0x26')][_0x6d37('0x27')])_0x443925=0x1;_0x208e20({'additional':_0x443925});}else{_0x208e20({'additional':0x0});}})[_0x6d37('0x15')](function(_0x5d73d9){logger[_0x6d37('0x11')](_0x6d37('0x16'),_0x5d73d9[_0x6d37('0x13')]);_0x715c0c(_0x34585e[_0x6d37('0x11')](0x1f4,_0x5d73d9['message']));});}})['catch'](function(_0x698efa){logger[_0x6d37('0x11')](_0x6d37('0x16'),_0x698efa[_0x6d37('0x13')]);_0x715c0c(_0x34585e[_0x6d37('0x11')](0x1f4,_0x698efa[_0x6d37('0x13')]));});}else _0x208e20({'additional':0x0});});});};exports[_0x6d37('0x28')]=function(_0x57d73b){var _0x4271fa=this;return new Promise(function(_0xa1affc,_0x542081){return db[_0x6d37('0x17')]['findOne']({'raw':!![],'where':{'ContactId':_0x57d73b[_0x6d37('0x19')][_0x6d37('0x18')],'ListId':_0x57d73b['body'][_0x6d37('0x29')],'VoiceQueueId':_0x57d73b['body']['VoiceQueueId']===undefined?null:_0x57d73b[_0x6d37('0x19')][_0x6d37('0x2a')],'CampaignId':_0x57d73b['body'][_0x6d37('0x1a')]===undefined?null:_0x57d73b[_0x6d37('0x19')][_0x6d37('0x1a')]}})[_0x6d37('0xc')](function(_0x68ae3b){if(_0x68ae3b!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x68ae3b['id'],'OrderBy':{'$gte':_0x68ae3b[_0x6d37('0x1c')]}},'order':[['OrderBy',_0x6d37('0x1d')]]})[_0x6d37('0xc')](function(_0x26ae7e){if(_0x26ae7e)return activateAdditionalPhone(_0x68ae3b,_0x57d73b[_0x6d37('0x19')],_0x26ae7e,_0x57d73b[_0x6d37('0x2b')],_0x57d73b[_0x6d37('0x2c')])[_0x6d37('0xc')](function(_0x663a44){_0xa1affc(_0x663a44);});else{return db[_0x6d37('0x1b')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x68ae3b['id']},'order':[[_0x6d37('0x1c'),_0x6d37('0x1d')]]})[_0x6d37('0xc')](function(_0x419d29){if(_0x419d29)return activateAdditionalPhone(_0x68ae3b,_0x57d73b[_0x6d37('0x19')],_0x419d29,_0x57d73b['duration'],_0x57d73b[_0x6d37('0x2c')])[_0x6d37('0xc')](function(_0x58a20f){_0xa1affc(_0x58a20f);});else{_0xa1affc({'id':_0x68ae3b['id'],'phone':''});}})[_0x6d37('0x15')](function(_0x4da62f){logger[_0x6d37('0x11')](_0x6d37('0x16'),_0x4da62f[_0x6d37('0x13')]);_0x542081(_0x4271fa[_0x6d37('0x11')](0x1f4,_0x4da62f[_0x6d37('0x13')]));});}})['catch'](function(_0xde63cb){logger[_0x6d37('0x11')]('VerifyAdditionalPhones',_0xde63cb['message']);_0x542081(_0x4271fa[_0x6d37('0x11')](0x1f4,_0xde63cb[_0x6d37('0x13')]));});}else _0xa1affc(0x1);});});};function activateAdditionalPhone(_0x239d8a,_0x3ae900,_0x47330f,_0x7037f0,_0x3406d5){return new Promise(function(_0x6676b4,_0x1283fa){var _0x82cac;if(_[_0x6d37('0x2d')](_0x47330f['scheduledat'])){_0x47330f[_0x6d37('0x2e')]=moment();}if(moment()>moment(_0x47330f[_0x6d37('0x2e')])){_0x82cac=moment()[_0x6d37('0x2f')](_0x3406d5||0x3,_0x6d37('0x30'));}else{if(_0x47330f['OrderBy']==0x0){_0x82cac=moment(_0x47330f[_0x6d37('0x2e')]);}else{_0x82cac=moment()['add'](_0x3406d5||0x3,_0x6d37('0x30'));}}if(_[_0x6d37('0x2d')](_0x82cac)){_0x82cac=moment()[_0x6d37('0x2f')](_0x3406d5||0x3,_0x6d37('0x30'));}var _0x857649={'phone':_0x239d8a[_0x6d37('0x31')],'active':0x0,'OrderBy':_[_0x6d37('0x2d')](_0x239d8a[_0x6d37('0x1c')])?0x0:_0x239d8a[_0x6d37('0x1c')],'scheduledat':moment()[_0x6d37('0x2f')](_0x7037f0||0x1,_0x6d37('0x30')),'countbusyretry':_0x3ae900[_0x6d37('0x24')],'countcongestionretry':_0x3ae900[_0x6d37('0x1e')],'countnoanswerretry':_0x3ae900['countnoanswerretry'],'countnosuchnumberretry':_0x3ae900['countnosuchnumberretry'],'countdropretry':_0x3ae900[_0x6d37('0x20')],'countabandonedretry':_0x3ae900[_0x6d37('0x21')],'countmachineretry':_0x3ae900[_0x6d37('0x32')],'countagentrejectretry':_0x3ae900[_0x6d37('0x22')],'createdAt':_0x3ae900[_0x6d37('0x33')],'updatedAt':_0x3ae900[_0x6d37('0x34')]};var _0x47017c={'CmHopperId':_0x239d8a['id'],'phone':_0x47330f['phone'],'active':0x0,'OrderBy':_['isNil'](_0x47330f[_0x6d37('0x1c')])?0x0:_0x47330f['OrderBy'],'scheduledat':_0x82cac,'countbusyretry':_0x47330f['countbusyretry'],'countcongestionretry':_0x47330f[_0x6d37('0x1e')],'countnoanswerretry':_0x47330f[_0x6d37('0x25')],'countnosuchnumberretry':_0x47330f['countnosuchnumberretry'],'countdropretry':_0x47330f[_0x6d37('0x20')],'countabandonedretry':_0x47330f['countabandonedretry'],'countmachineretry':_0x47330f[_0x6d37('0x32')],'countagentrejectretry':_0x47330f['countagentrejectretry'],'createdAt':_0x47330f[_0x6d37('0x33')],'updatedAt':_0x47330f['updatedAt']};return db['sequelize'][_0x6d37('0x35')](function(_0xdf69bd){return db['CmHopperAdditionalPhone'][_0x6d37('0x36')](_0x857649,{'where':{'id':_0x47330f['id']}},{'transaction':_0xdf69bd})['then'](function(){return db[_0x6d37('0x17')][_0x6d37('0x36')](_0x47017c,{'where':{'id':_0x239d8a['id']}},{'transaction':_0xdf69bd});});})[_0x6d37('0xc')](function(_0x322066){_0x6676b4({'id':_0x239d8a['id'],'phone':_0x47330f['phone']});})[_0x6d37('0x15')](function(_0x3c25fb){logger[_0x6d37('0x11')]('activateAdditionalPhone',_0x3c25fb[_0x6d37('0x13')]);_0x1283fa({'error':_0x3c25fb[_0x6d37('0x13')]});});});}exports['IncrementPreviewCounters']=function(_0x2d46e4){var _0x2eed39=this;return new Promise(function(_0x2bf3f6,_0x23f8f1){return db[_0x6d37('0x17')][_0x6d37('0x36')](_0x2d46e4[_0x6d37('0x19')]['field'],{'where':{'id':_0x2d46e4[_0x6d37('0x19')]['id']}})[_0x6d37('0xc')](function(_0xc02c0b){_0x2bf3f6(_0xc02c0b);})['catch'](function(_0x5a40a8){logger[_0x6d37('0x11')](_0x6d37('0x37'),_0x5a40a8[_0x6d37('0x13')]);_0x23f8f1(_0x2eed39[_0x6d37('0x11')](0x1f4,_0x5a40a8[_0x6d37('0x13')]));});});}; \ No newline at end of file +var _0x1cd4=['code','message','result','catch','VerifyAdditionalPhones','findOne','ContactId','ListId','VoiceQueueId','body','CampaignId','then','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','countnosuchnumberretry','countdropretry','countmachineretry','waitTime','duration','scheduledat','add','minutes','isNil','phone','createdAt','updatedAt','transaction','update','CmHopper','IncrementPreviewCounters','field','moment','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x62ddb5,_0x141a28){var _0x184aa6=function(_0x114015){while(--_0x114015){_0x62ddb5['push'](_0x62ddb5['shift']());}};_0x184aa6(++_0x141a28);}(_0x1cd4,0xc2));var _0x41cd=function(_0x391df2,_0x568cc0){_0x391df2=_0x391df2-0x0;var _0x4cecd5=_0x1cd4[_0x391df2];return _0x4cecd5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x41cd('0x0'));var BPromise=require(_0x41cd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x41cd('0x2'));var logger=require('../../config/logger')(_0x41cd('0x3'));var config=require(_0x41cd('0x4'));var jayson=require(_0x41cd('0x5'));var client=jayson[_0x41cd('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ac1c9,_0x59db5f,_0x4bd74a){return new BPromise(function(_0x2694f3,_0x30da6e){return client[_0x41cd('0x7')](_0x1ac1c9,_0x4bd74a)['then'](function(_0x9f51d9){logger[_0x41cd('0x8')](_0x41cd('0x9'),_0x59db5f,_0x41cd('0xa'));logger['debug'](_0x41cd('0xb'),_0x59db5f,_0x41cd('0xa'),JSON[_0x41cd('0xc')](_0x9f51d9));if(_0x9f51d9[_0x41cd('0xd')]){if(_0x9f51d9[_0x41cd('0xd')][_0x41cd('0xe')]===0x1f4){logger[_0x41cd('0xd')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x59db5f,_0x9f51d9[_0x41cd('0xd')]['message']);return _0x30da6e(_0x9f51d9[_0x41cd('0xd')][_0x41cd('0xf')]);}logger[_0x41cd('0xd')](_0x41cd('0x9'),_0x59db5f,_0x9f51d9[_0x41cd('0xd')][_0x41cd('0xf')]);return _0x2694f3(_0x9f51d9[_0x41cd('0xd')][_0x41cd('0xf')]);}else{logger['info'](_0x41cd('0x9'),_0x59db5f,'request\x20sent');_0x2694f3(_0x9f51d9[_0x41cd('0x10')][_0x41cd('0xf')]);}})[_0x41cd('0x11')](function(_0x47ea08){logger[_0x41cd('0xd')](_0x41cd('0x9'),_0x59db5f,_0x47ea08);_0x30da6e(_0x47ea08);});});}exports[_0x41cd('0x12')]=function(_0x12c588){var _0x13c8e9=this;return new Promise(function(_0xd3b71,_0x3e86e7){return db['CmHopper'][_0x41cd('0x13')]({'raw':!![],'where':{'ContactId':_0x12c588['body'][_0x41cd('0x14')],'ListId':_0x12c588['body'][_0x41cd('0x15')],'VoiceQueueId':_0x12c588['body'][_0x41cd('0x16')]===undefined?null:_0x12c588['body'][_0x41cd('0x16')],'CampaignId':_0x12c588[_0x41cd('0x17')][_0x41cd('0x18')]===undefined?null:_0x12c588[_0x41cd('0x17')]['CampaignId']}})[_0x41cd('0x19')](function(_0x1428d9){if(_0x1428d9!=null){return db[_0x41cd('0x1a')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x1428d9['id'],'OrderBy':{'$gt':_0x1428d9[_0x41cd('0x1b')]}},'order':[[_0x41cd('0x1b'),_0x41cd('0x1c')]]})[_0x41cd('0x19')](function(_0x28a1f8){var _0x43e4b5=0x0;if(_0x28a1f8){if(_0x28a1f8[_0x41cd('0x1d')]+_0x28a1f8[_0x41cd('0x1e')]+_0x28a1f8[_0x41cd('0x1f')]+_0x28a1f8['countnosuchnumberretry']+_0x28a1f8['countdropretry']+_0x28a1f8[_0x41cd('0x20')]+_0x28a1f8['countmachineretry']+_0x28a1f8[_0x41cd('0x21')]<_0x12c588['entity'][_0x41cd('0x22')])_0x43e4b5=0x1;_0xd3b71({'additional':_0x43e4b5});}else{return db['CmHopperAdditionalPhone'][_0x41cd('0x13')]({'raw':!![],'where':{'CmHopperId':_0x1428d9['id']},'order':[[_0x41cd('0x1b'),'ASC']]})['then'](function(_0x44fe9d){var _0x47cffa=0x0;if(_0x44fe9d){if(_0x44fe9d[_0x41cd('0x1d')]+_0x44fe9d['countcongestionretry']+_0x44fe9d[_0x41cd('0x1f')]+_0x44fe9d[_0x41cd('0x23')]+_0x44fe9d[_0x41cd('0x24')]+_0x44fe9d[_0x41cd('0x20')]+_0x44fe9d[_0x41cd('0x25')]+_0x44fe9d[_0x41cd('0x21')]<_0x12c588['entity'][_0x41cd('0x22')])_0x47cffa=0x1;_0xd3b71({'additional':_0x47cffa});}else{_0xd3b71({'additional':0x0});}})['catch'](function(_0x39bd31){logger['error'](_0x41cd('0x12'),_0x39bd31[_0x41cd('0xf')]);_0x3e86e7(_0x13c8e9['error'](0x1f4,_0x39bd31['message']));});}})[_0x41cd('0x11')](function(_0x475b8d){logger[_0x41cd('0xd')](_0x41cd('0x12'),_0x475b8d[_0x41cd('0xf')]);_0x3e86e7(_0x13c8e9[_0x41cd('0xd')](0x1f4,_0x475b8d['message']));});}else _0xd3b71({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x1f56e7){var _0x22b8af=this;return new Promise(function(_0x3ffda2,_0x2276fb){return db['CmHopper'][_0x41cd('0x13')]({'raw':!![],'where':{'ContactId':_0x1f56e7['body'][_0x41cd('0x14')],'ListId':_0x1f56e7['body'][_0x41cd('0x15')],'VoiceQueueId':_0x1f56e7['body'][_0x41cd('0x16')]===undefined?null:_0x1f56e7['body'][_0x41cd('0x16')],'CampaignId':_0x1f56e7[_0x41cd('0x17')][_0x41cd('0x18')]===undefined?null:_0x1f56e7[_0x41cd('0x17')]['CampaignId']}})[_0x41cd('0x19')](function(_0x56e61f){if(_0x56e61f!=null){return db[_0x41cd('0x1a')][_0x41cd('0x13')]({'raw':!![],'where':{'CmHopperId':_0x56e61f['id'],'OrderBy':{'$gte':_0x56e61f[_0x41cd('0x1b')]}},'order':[['OrderBy',_0x41cd('0x1c')]]})[_0x41cd('0x19')](function(_0x1d3211){if(_0x1d3211)return activateAdditionalPhone(_0x56e61f,_0x1f56e7[_0x41cd('0x17')],_0x1d3211,_0x1f56e7['duration'],_0x1f56e7[_0x41cd('0x26')])[_0x41cd('0x19')](function(_0x194e00){_0x3ffda2(_0x194e00);});else{return db[_0x41cd('0x1a')][_0x41cd('0x13')]({'raw':!![],'where':{'CmHopperId':_0x56e61f['id']},'order':[['OrderBy','ASC']]})[_0x41cd('0x19')](function(_0x48d0f8){if(_0x48d0f8)return activateAdditionalPhone(_0x56e61f,_0x1f56e7[_0x41cd('0x17')],_0x48d0f8,_0x1f56e7[_0x41cd('0x27')],_0x1f56e7[_0x41cd('0x26')])[_0x41cd('0x19')](function(_0x1a47e2){_0x3ffda2(_0x1a47e2);});else{_0x3ffda2({'id':_0x56e61f['id'],'phone':''});}})[_0x41cd('0x11')](function(_0x2a60ad){logger['error'](_0x41cd('0x12'),_0x2a60ad['message']);_0x2276fb(_0x22b8af['error'](0x1f4,_0x2a60ad['message']));});}})[_0x41cd('0x11')](function(_0x22b3ad){logger[_0x41cd('0xd')](_0x41cd('0x12'),_0x22b3ad[_0x41cd('0xf')]);_0x2276fb(_0x22b8af[_0x41cd('0xd')](0x1f4,_0x22b3ad['message']));});}else _0x3ffda2(0x1);});});};function activateAdditionalPhone(_0x1453a2,_0x4c944c,_0x45f3a7,_0xb60541,_0x5ba20f){return new Promise(function(_0x48f01d,_0x489937){var _0x5cbf77;if(_['isNil'](_0x45f3a7[_0x41cd('0x28')])){_0x45f3a7[_0x41cd('0x28')]=moment();}if(moment()>moment(_0x45f3a7[_0x41cd('0x28')])){_0x5cbf77=moment()[_0x41cd('0x29')](_0x5ba20f||0x3,_0x41cd('0x2a'));}else{if(_0x45f3a7[_0x41cd('0x1b')]==0x0){_0x5cbf77=moment(_0x45f3a7[_0x41cd('0x28')]);}else{_0x5cbf77=moment()[_0x41cd('0x29')](_0x5ba20f||0x3,_0x41cd('0x2a'));}}if(_[_0x41cd('0x2b')](_0x5cbf77)){_0x5cbf77=moment()[_0x41cd('0x29')](_0x5ba20f||0x3,_0x41cd('0x2a'));}var _0x16bed8={'phone':_0x1453a2[_0x41cd('0x2c')],'active':0x0,'OrderBy':_[_0x41cd('0x2b')](_0x1453a2[_0x41cd('0x1b')])?0x0:_0x1453a2[_0x41cd('0x1b')],'scheduledat':moment()[_0x41cd('0x29')](_0xb60541||0x1,_0x41cd('0x2a')),'countbusyretry':_0x4c944c[_0x41cd('0x1d')],'countcongestionretry':_0x4c944c[_0x41cd('0x1e')],'countnoanswerretry':_0x4c944c[_0x41cd('0x1f')],'countnosuchnumberretry':_0x4c944c[_0x41cd('0x23')],'countdropretry':_0x4c944c['countdropretry'],'countabandonedretry':_0x4c944c[_0x41cd('0x20')],'countmachineretry':_0x4c944c['countmachineretry'],'countagentrejectretry':_0x4c944c[_0x41cd('0x21')],'createdAt':_0x4c944c[_0x41cd('0x2d')],'updatedAt':_0x4c944c[_0x41cd('0x2e')]};var _0x451236={'CmHopperId':_0x1453a2['id'],'phone':_0x45f3a7[_0x41cd('0x2c')],'active':0x0,'OrderBy':_['isNil'](_0x45f3a7[_0x41cd('0x1b')])?0x0:_0x45f3a7['OrderBy'],'scheduledat':_0x5cbf77,'countbusyretry':_0x45f3a7['countbusyretry'],'countcongestionretry':_0x45f3a7[_0x41cd('0x1e')],'countnoanswerretry':_0x45f3a7[_0x41cd('0x1f')],'countnosuchnumberretry':_0x45f3a7[_0x41cd('0x23')],'countdropretry':_0x45f3a7['countdropretry'],'countabandonedretry':_0x45f3a7[_0x41cd('0x20')],'countmachineretry':_0x45f3a7[_0x41cd('0x25')],'countagentrejectretry':_0x45f3a7[_0x41cd('0x21')],'createdAt':_0x45f3a7[_0x41cd('0x2d')],'updatedAt':_0x45f3a7['updatedAt']};return db['sequelize'][_0x41cd('0x2f')](function(_0x333fde){return db[_0x41cd('0x1a')][_0x41cd('0x30')](_0x16bed8,{'where':{'id':_0x45f3a7['id']}},{'transaction':_0x333fde})['then'](function(){return db[_0x41cd('0x31')][_0x41cd('0x30')](_0x451236,{'where':{'id':_0x1453a2['id']}},{'transaction':_0x333fde});});})[_0x41cd('0x19')](function(_0x52b49d){_0x48f01d({'id':_0x1453a2['id'],'phone':_0x45f3a7[_0x41cd('0x2c')]});})[_0x41cd('0x11')](function(_0x34499d){logger[_0x41cd('0xd')]('activateAdditionalPhone',_0x34499d[_0x41cd('0xf')]);_0x489937({'error':_0x34499d['message']});});});}exports[_0x41cd('0x32')]=function(_0x47db3e){var _0x8b0487=this;return new Promise(function(_0x591913,_0xaa724e){return db[_0x41cd('0x31')][_0x41cd('0x30')](_0x47db3e[_0x41cd('0x17')][_0x41cd('0x33')],{'where':{'id':_0x47db3e[_0x41cd('0x17')]['id']}})[_0x41cd('0x19')](function(_0x46bb6f){_0x591913(_0x46bb6f);})['catch'](function(_0x2ca7fa){logger[_0x41cd('0xd')](_0x41cd('0x32'),_0x2ca7fa[_0x41cd('0xf')]);_0xaa724e(_0x8b0487[_0x41cd('0xd')](0x1f4,_0x2ca7fa[_0x41cd('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index c975456..abdf397 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 _0xa30e=['../../config/environment','./cmHopperAdditionalPhone.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x386c0b,_0x25a98b){var _0x1ebc25=function(_0xfbc73d){while(--_0xfbc73d){_0x386c0b['push'](_0x386c0b['shift']());}};_0x1ebc25(++_0x25a98b);}(_0xa30e,0x117));var _0xea30=function(_0x1b7ea6,_0x195a62){_0x1b7ea6=_0x1b7ea6-0x0;var _0x4fcea6=_0xa30e[_0x1b7ea6];return _0x4fcea6;};'use strict';var multer=require(_0xea30('0x0'));var util=require(_0xea30('0x1'));var path=require(_0xea30('0x2'));var timeout=require(_0xea30('0x3'));var express=require(_0xea30('0x4'));var router=express[_0xea30('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xea30('0x6'));var controller=require(_0xea30('0x7'));router[_0xea30('0x8')]('/',auth['isAuthenticated'](),controller[_0xea30('0x9')]);router[_0xea30('0x8')](_0xea30('0xa'),auth[_0xea30('0xb')](),controller[_0xea30('0xc')]);router[_0xea30('0xd')]('/',auth[_0xea30('0xb')](),controller[_0xea30('0xe')]);router[_0xea30('0xf')](_0xea30('0xa'),auth[_0xea30('0xb')](),controller[_0xea30('0x10')]);router['delete']('/:id',auth[_0xea30('0xb')](),controller[_0xea30('0x11')]);module[_0xea30('0x12')]=router; \ No newline at end of file +var _0xcd6a=['index','get','/:id','show','post','create','put','update','delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x51412e,_0x43c707){var _0x1e4815=function(_0x4cce2f){while(--_0x4cce2f){_0x51412e['push'](_0x51412e['shift']());}};_0x1e4815(++_0x43c707);}(_0xcd6a,0xbe));var _0xacd6=function(_0x442f9c,_0x58d092){_0x442f9c=_0x442f9c-0x0;var _0x4d884f=_0xcd6a[_0x442f9c];return _0x4d884f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xacd6('0x0'));var timeout=require(_0xacd6('0x1'));var express=require(_0xacd6('0x2'));var router=express[_0xacd6('0x3')]();var fs_extra=require(_0xacd6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xacd6('0x5'));var config=require(_0xacd6('0x6'));var controller=require('./cmHopperAdditionalPhone.controller');router['get']('/',auth[_0xacd6('0x7')](),controller[_0xacd6('0x8')]);router[_0xacd6('0x9')](_0xacd6('0xa'),auth[_0xacd6('0x7')](),controller[_0xacd6('0xb')]);router[_0xacd6('0xc')]('/',auth['isAuthenticated'](),controller[_0xacd6('0xd')]);router[_0xacd6('0xe')]('/:id',auth[_0xacd6('0x7')](),controller[_0xacd6('0xf')]);router[_0xacd6('0x10')](_0xacd6('0xa'),auth['isAuthenticated'](),controller[_0xacd6('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index b3ba011..bbfd9a5 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 _0x6e0e=['moment','sequelize','exports','STRING','INTEGER','contactListQueue'];(function(_0x4e4c49,_0x5ba587){var _0x2b1b26=function(_0x18a12a){while(--_0x18a12a){_0x4e4c49['push'](_0x4e4c49['shift']());}};_0x2b1b26(++_0x5ba587);}(_0x6e0e,0x90));var _0xe6e0=function(_0x4e2cab,_0x27eb77){_0x4e2cab=_0x4e2cab-0x0;var _0xc4a809=_0x6e0e[_0x4e2cab];return _0xc4a809;};'use strict';var moment=require(_0xe6e0('0x0'));var Sequelize=require(_0xe6e0('0x1'));module[_0xe6e0('0x2')]={'phone':{'type':Sequelize[_0xe6e0('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xe6e0('0x4')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xe6e0('0x4')],'unique':_0xe6e0('0x5')},'VoiceQueueId':{'type':Sequelize[_0xe6e0('0x4')],'unique':_0xe6e0('0x5')}}; \ No newline at end of file +var _0x3759=['sequelize','exports','STRING','INTEGER','contactListQueue','moment'];(function(_0x5e9f91,_0x5b37cc){var _0x5916b3=function(_0x30f714){while(--_0x30f714){_0x5e9f91['push'](_0x5e9f91['shift']());}};_0x5916b3(++_0x5b37cc);}(_0x3759,0x131));var _0x9375=function(_0x2b3dca,_0x32e2a1){_0x2b3dca=_0x2b3dca-0x0;var _0x2d56a1=_0x3759[_0x2b3dca];return _0x2d56a1;};'use strict';var moment=require(_0x9375('0x0'));var Sequelize=require(_0x9375('0x1'));module[_0x9375('0x2')]={'phone':{'type':Sequelize[_0x9375('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x9375('0x4')],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x9375('0x5')},'VoiceQueueId':{'type':Sequelize[_0x9375('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 0722a74..a77a1e2 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 _0xa693=['include','find','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','set','apply','reject','update','then','destroy','end','stack','name','send','CmHopperBlack','rawAttributes','fieldName','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xa693,0x97));var _0x3a69=function(_0x22431e,_0x5af0a3){_0x22431e=_0x22431e-0x0;var _0xd978e9=_0xa693[_0x22431e];return _0xd978e9;};'use strict';var emlformat=require(_0x3a69('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3a69('0x1'));var jsonpatch=require(_0x3a69('0x2'));var rp=require(_0x3a69('0x3'));var moment=require('moment');var BPromise=require(_0x3a69('0x4'));var Mustache=require(_0x3a69('0x5'));var util=require('util');var path=require(_0x3a69('0x6'));var sox=require(_0x3a69('0x7'));var csv=require(_0x3a69('0x8'));var ejs=require(_0x3a69('0x9'));var fs=require('fs');var fs_extra=require(_0x3a69('0xa'));var _=require(_0x3a69('0xb'));var squel=require(_0x3a69('0xc'));var crypto=require(_0x3a69('0xd'));var jsforce=require(_0x3a69('0xe'));var deskjs=require(_0x3a69('0xf'));var toCsv=require(_0x3a69('0x8'));var querystring=require(_0x3a69('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3a69('0x11'));var qs=require(_0x3a69('0x12'));var as=require(_0x3a69('0x13'));var hardwareService=require(_0x3a69('0x14'));var logger=require('../../config/logger')(_0x3a69('0x15'));var utils=require('../../config/utils');var config=require(_0x3a69('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x3a69('0x17'))['db'];function respondWithStatusCode(_0x114815,_0x360cfe){_0x360cfe=_0x360cfe||0xcc;return function(_0x45c722){if(_0x45c722){return _0x114815[_0x3a69('0x18')](_0x360cfe);}return _0x114815['status'](_0x360cfe)['end']();};}function respondWithResult(_0x51e42b,_0x56fff9){_0x56fff9=_0x56fff9||0xc8;return function(_0x52ebb2){if(_0x52ebb2){return _0x51e42b['status'](_0x56fff9)[_0x3a69('0x19')](_0x52ebb2);}};}function respondWithFilteredResult(_0x14128e,_0x1277db){return function(_0x11e2ea){if(_0x11e2ea){var _0x3cce21=typeof _0x1277db[_0x3a69('0x1a')]===_0x3a69('0x1b')&&typeof _0x1277db[_0x3a69('0x1c')]===_0x3a69('0x1b');var _0x212b93=_0x11e2ea[_0x3a69('0x1d')];var _0x17a2a5=_0x3cce21?0x0:_0x1277db[_0x3a69('0x1a')];var _0x28c9ee=_0x3cce21?_0x11e2ea[_0x3a69('0x1d')]:_0x1277db[_0x3a69('0x1a')]+_0x1277db['limit'];var _0x321898;if(_0x28c9ee>=_0x212b93){_0x28c9ee=_0x212b93;_0x321898=0xc8;}else{_0x321898=0xce;}_0x14128e[_0x3a69('0x1e')](_0x321898);return _0x14128e[_0x3a69('0x1f')]('Content-Range',_0x17a2a5+'-'+_0x28c9ee+'/'+_0x212b93)[_0x3a69('0x19')](_0x11e2ea);}return null;};}function patchUpdates(_0x16f7c0){return function(_0x114966){try{jsonpatch[_0x3a69('0x20')](_0x114966,_0x16f7c0,!![]);}catch(_0x4455a8){return BPromise[_0x3a69('0x21')](_0x4455a8);}return _0x114966['save']();};}function saveUpdates(_0x3f83b8,_0x161368){return function(_0x2cbd37){if(_0x2cbd37){return _0x2cbd37[_0x3a69('0x22')](_0x3f83b8)[_0x3a69('0x23')](function(_0x3490f8){return _0x3490f8;});}return null;};}function removeEntity(_0x4c65d6,_0x5f4ac9){return function(_0xe7c8b2){if(_0xe7c8b2){return _0xe7c8b2[_0x3a69('0x24')]()[_0x3a69('0x23')](function(){_0x4c65d6[_0x3a69('0x1e')](0xcc)[_0x3a69('0x25')]();});}};}function handleEntityNotFound(_0x2e5b50,_0x797fa1){return function(_0x294d7a){if(!_0x294d7a){_0x2e5b50[_0x3a69('0x18')](0x194);}return _0x294d7a;};}function handleError(_0x419d93,_0x3a0279){_0x3a0279=_0x3a0279||0x1f4;return function(_0x2d1a1a){logger['error'](_0x2d1a1a[_0x3a69('0x26')]);if(_0x2d1a1a[_0x3a69('0x27')]){delete _0x2d1a1a['name'];}_0x419d93[_0x3a69('0x1e')](_0x3a0279)[_0x3a69('0x28')](_0x2d1a1a);};}exports['index']=function(_0x428bff,_0x407301){var _0x26b86f={},_0x39927e={},_0x4e20c3={'count':0x0,'rows':[]};var _0x975ede=_['map'](db[_0x3a69('0x29')][_0x3a69('0x2a')],function(_0x487e3c){return{'name':_0x487e3c[_0x3a69('0x2b')],'type':_0x487e3c['type'][_0x3a69('0x2c')]};});_0x39927e[_0x3a69('0x2d')]=_[_0x3a69('0x2e')](_0x975ede,'name');_0x39927e[_0x3a69('0x2f')]=_['keys'](_0x428bff[_0x3a69('0x2f')]);_0x39927e['filters']=_[_0x3a69('0x30')](_0x39927e['model'],_0x39927e['query']);_0x26b86f[_0x3a69('0x31')]=_[_0x3a69('0x30')](_0x39927e['model'],qs[_0x3a69('0x32')](_0x428bff[_0x3a69('0x2f')]['fields']));_0x26b86f[_0x3a69('0x31')]=_0x26b86f[_0x3a69('0x31')][_0x3a69('0x33')]?_0x26b86f[_0x3a69('0x31')]:_0x39927e[_0x3a69('0x2d')];if(!_0x428bff[_0x3a69('0x2f')][_0x3a69('0x34')](_0x3a69('0x35'))){_0x26b86f[_0x3a69('0x1c')]=qs[_0x3a69('0x1c')](_0x428bff[_0x3a69('0x2f')][_0x3a69('0x1c')]);_0x26b86f[_0x3a69('0x1a')]=qs[_0x3a69('0x1a')](_0x428bff['query'][_0x3a69('0x1a')]);}_0x26b86f[_0x3a69('0x36')]=qs[_0x3a69('0x37')](_0x428bff['query']['sort']);_0x26b86f['where']=qs[_0x3a69('0x38')](_[_0x3a69('0x39')](_0x428bff['query'],_0x39927e[_0x3a69('0x38')]),_0x975ede);if(_0x428bff['query'][_0x3a69('0x3a')]){_0x26b86f['where']=_[_0x3a69('0x3b')](_0x26b86f[_0x3a69('0x3c')],{'$or':_[_0x3a69('0x2e')](_0x975ede,function(_0x211edd){if(_0x211edd[_0x3a69('0x3d')]!==_0x3a69('0x3e')){var _0x3e5062={};_0x3e5062[_0x211edd[_0x3a69('0x27')]]={'$like':'%'+_0x428bff[_0x3a69('0x2f')]['filter']+'%'};return _0x3e5062;}})});}_0x26b86f=_[_0x3a69('0x3b')]({},_0x26b86f,_0x428bff[_0x3a69('0x3f')]);var _0x1f81a2={'where':_0x26b86f[_0x3a69('0x3c')]};return db[_0x3a69('0x29')]['count'](_0x1f81a2)[_0x3a69('0x23')](function(_0x192225){_0x4e20c3['count']=_0x192225;if(_0x428bff[_0x3a69('0x2f')][_0x3a69('0x40')]){_0x26b86f['include']=[{'all':!![]}];}return db[_0x3a69('0x29')][_0x3a69('0x41')](_0x26b86f);})[_0x3a69('0x23')](function(_0x248ad5){_0x4e20c3[_0x3a69('0x42')]=_0x248ad5;return _0x4e20c3;})[_0x3a69('0x23')](respondWithFilteredResult(_0x407301,_0x26b86f))[_0x3a69('0x43')](handleError(_0x407301,null));};exports[_0x3a69('0x44')]=function(_0x5e8681,_0x5766f6){var _0x378977={'raw':!![],'where':{'id':_0x5e8681[_0x3a69('0x45')]['id']}},_0x2f2b49={};_0x2f2b49[_0x3a69('0x2d')]=_[_0x3a69('0x46')](db['CmHopperBlack'][_0x3a69('0x2a')]);_0x2f2b49[_0x3a69('0x2f')]=_[_0x3a69('0x46')](_0x5e8681['query']);_0x2f2b49[_0x3a69('0x38')]=_[_0x3a69('0x30')](_0x2f2b49['model'],_0x2f2b49[_0x3a69('0x2f')]);_0x378977['attributes']=_[_0x3a69('0x30')](_0x2f2b49[_0x3a69('0x2d')],qs[_0x3a69('0x32')](_0x5e8681[_0x3a69('0x2f')][_0x3a69('0x32')]));_0x378977[_0x3a69('0x31')]=_0x378977[_0x3a69('0x31')][_0x3a69('0x33')]?_0x378977['attributes']:_0x2f2b49[_0x3a69('0x2d')];if(_0x5e8681[_0x3a69('0x2f')][_0x3a69('0x40')]){_0x378977[_0x3a69('0x47')]=[{'all':!![]}];}_0x378977=_[_0x3a69('0x3b')]({},_0x378977,_0x5e8681['options']);return db['CmHopperBlack'][_0x3a69('0x48')](_0x378977)[_0x3a69('0x23')](handleEntityNotFound(_0x5766f6,null))[_0x3a69('0x23')](respondWithResult(_0x5766f6,null))['catch'](handleError(_0x5766f6,null));};exports[_0x3a69('0x22')]=function(_0x1c24e9,_0x5ec7de){if(_0x1c24e9[_0x3a69('0x49')]['id']){delete _0x1c24e9['body']['id'];}return db[_0x3a69('0x29')]['find']({'where':{'id':_0x1c24e9['params']['id']}})[_0x3a69('0x23')](handleEntityNotFound(_0x5ec7de,null))['then'](saveUpdates(_0x1c24e9[_0x3a69('0x49')],null))[_0x3a69('0x23')](respondWithResult(_0x5ec7de,null))[_0x3a69('0x43')](handleError(_0x5ec7de,null));};exports['destroy']=function(_0x178128,_0x202532){return db[_0x3a69('0x29')][_0x3a69('0x48')]({'where':{'id':_0x178128[_0x3a69('0x45')]['id']}})[_0x3a69('0x23')](handleEntityNotFound(_0x202532,null))[_0x3a69('0x23')](removeEntity(_0x202532,null))[_0x3a69('0x43')](handleError(_0x202532,null));};exports['describe']=function(_0x552420,_0x1eceab){return db[_0x3a69('0x29')]['describe']()[_0x3a69('0x23')](respondWithResult(_0x1eceab,null))['catch'](handleError(_0x1eceab,null));}; \ No newline at end of file +var _0x8bec=['bluebird','mustache','path','sox','to-csv','lodash','squel','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','count','offset','limit','set','Content-Range','json','reject','save','update','destroy','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','then','includeAll','include','rows','catch','show','options','find','body','params','describe','rimraf','fast-json-patch','request-promise','moment'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x8bec,0xdd));var _0xc8be=function(_0x187b98,_0xc49287){_0x187b98=_0x187b98-0x0;var _0x293b7a=_0x8bec[_0x187b98];return _0x293b7a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc8be('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc8be('0x1'));var rp=require(_0xc8be('0x2'));var moment=require(_0xc8be('0x3'));var BPromise=require(_0xc8be('0x4'));var Mustache=require(_0xc8be('0x5'));var util=require('util');var path=require(_0xc8be('0x6'));var sox=require(_0xc8be('0x7'));var csv=require(_0xc8be('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc8be('0x9'));var squel=require(_0xc8be('0xa'));var crypto=require('crypto');var jsforce=require(_0xc8be('0xb'));var deskjs=require(_0xc8be('0xc'));var toCsv=require(_0xc8be('0x8'));var querystring=require(_0xc8be('0xd'));var Papa=require(_0xc8be('0xe'));var Redis=require(_0xc8be('0xf'));var authService=require(_0xc8be('0x10'));var qs=require(_0xc8be('0x11'));var as=require(_0xc8be('0x12'));var hardwareService=require(_0xc8be('0x13'));var logger=require(_0xc8be('0x14'))(_0xc8be('0x15'));var utils=require('../../config/utils');var config=require(_0xc8be('0x16'));var licenseUtil=require(_0xc8be('0x17'));var db=require(_0xc8be('0x18'))['db'];function respondWithStatusCode(_0x55049e,_0x18dcd9){_0x18dcd9=_0x18dcd9||0xcc;return function(_0x51f0b0){if(_0x51f0b0){return _0x55049e[_0xc8be('0x19')](_0x18dcd9);}return _0x55049e[_0xc8be('0x1a')](_0x18dcd9)[_0xc8be('0x1b')]();};}function respondWithResult(_0x473b68,_0x56314e){_0x56314e=_0x56314e||0xc8;return function(_0x530ad4){if(_0x530ad4){return _0x473b68[_0xc8be('0x1a')](_0x56314e)['json'](_0x530ad4);}};}function respondWithFilteredResult(_0x7dab81,_0x64bad5){return function(_0x5bd966){if(_0x5bd966){var _0x18ec0b=typeof _0x64bad5['offset']==='undefined'&&typeof _0x64bad5['limit']==='undefined';var _0x3743d3=_0x5bd966[_0xc8be('0x1c')];var _0x349c08=_0x18ec0b?0x0:_0x64bad5[_0xc8be('0x1d')];var _0x5eaef5=_0x18ec0b?_0x5bd966['count']:_0x64bad5[_0xc8be('0x1d')]+_0x64bad5[_0xc8be('0x1e')];var _0x108ce3;if(_0x5eaef5>=_0x3743d3){_0x5eaef5=_0x3743d3;_0x108ce3=0xc8;}else{_0x108ce3=0xce;}_0x7dab81[_0xc8be('0x1a')](_0x108ce3);return _0x7dab81[_0xc8be('0x1f')](_0xc8be('0x20'),_0x349c08+'-'+_0x5eaef5+'/'+_0x3743d3)[_0xc8be('0x21')](_0x5bd966);}return null;};}function patchUpdates(_0x41e840){return function(_0x1dc056){try{jsonpatch['apply'](_0x1dc056,_0x41e840,!![]);}catch(_0x28e58b){return BPromise[_0xc8be('0x22')](_0x28e58b);}return _0x1dc056[_0xc8be('0x23')]();};}function saveUpdates(_0x5eaeee,_0x410674){return function(_0x275020){if(_0x275020){return _0x275020[_0xc8be('0x24')](_0x5eaeee)['then'](function(_0x2f5304){return _0x2f5304;});}return null;};}function removeEntity(_0x3992ab,_0x45d13f){return function(_0x3d529b){if(_0x3d529b){return _0x3d529b[_0xc8be('0x25')]()['then'](function(){_0x3992ab[_0xc8be('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17e0c8,_0x276ff8){return function(_0x4b3354){if(!_0x4b3354){_0x17e0c8[_0xc8be('0x19')](0x194);}return _0x4b3354;};}function handleError(_0xc73dee,_0x44dc3a){_0x44dc3a=_0x44dc3a||0x1f4;return function(_0x373f9c){logger[_0xc8be('0x26')](_0x373f9c[_0xc8be('0x27')]);if(_0x373f9c[_0xc8be('0x28')]){delete _0x373f9c[_0xc8be('0x28')];}_0xc73dee[_0xc8be('0x1a')](_0x44dc3a)[_0xc8be('0x29')](_0x373f9c);};}exports[_0xc8be('0x2a')]=function(_0xccb34a,_0x11f8e9){var _0x29ff47={},_0x2058f8={},_0x4a82b8={'count':0x0,'rows':[]};var _0x3e2766=_[_0xc8be('0x2b')](db[_0xc8be('0x2c')][_0xc8be('0x2d')],function(_0x49b512){return{'name':_0x49b512['fieldName'],'type':_0x49b512[_0xc8be('0x2e')][_0xc8be('0x2f')]};});_0x2058f8[_0xc8be('0x30')]=_[_0xc8be('0x2b')](_0x3e2766,_0xc8be('0x28'));_0x2058f8['query']=_[_0xc8be('0x31')](_0xccb34a[_0xc8be('0x32')]);_0x2058f8[_0xc8be('0x33')]=_[_0xc8be('0x34')](_0x2058f8[_0xc8be('0x30')],_0x2058f8[_0xc8be('0x32')]);_0x29ff47[_0xc8be('0x35')]=_['intersection'](_0x2058f8[_0xc8be('0x30')],qs[_0xc8be('0x36')](_0xccb34a[_0xc8be('0x32')][_0xc8be('0x36')]));_0x29ff47[_0xc8be('0x35')]=_0x29ff47[_0xc8be('0x35')][_0xc8be('0x37')]?_0x29ff47[_0xc8be('0x35')]:_0x2058f8[_0xc8be('0x30')];if(!_0xccb34a[_0xc8be('0x32')][_0xc8be('0x38')](_0xc8be('0x39'))){_0x29ff47['limit']=qs[_0xc8be('0x1e')](_0xccb34a[_0xc8be('0x32')][_0xc8be('0x1e')]);_0x29ff47[_0xc8be('0x1d')]=qs[_0xc8be('0x1d')](_0xccb34a['query'][_0xc8be('0x1d')]);}_0x29ff47[_0xc8be('0x3a')]=qs['sort'](_0xccb34a['query'][_0xc8be('0x3b')]);_0x29ff47['where']=qs['filters'](_[_0xc8be('0x3c')](_0xccb34a[_0xc8be('0x32')],_0x2058f8[_0xc8be('0x33')]),_0x3e2766);if(_0xccb34a['query'][_0xc8be('0x3d')]){_0x29ff47[_0xc8be('0x3e')]=_['merge'](_0x29ff47[_0xc8be('0x3e')],{'$or':_[_0xc8be('0x2b')](_0x3e2766,function(_0x4487fa){if(_0x4487fa[_0xc8be('0x2e')]!==_0xc8be('0x3f')){var _0x2ab604={};_0x2ab604[_0x4487fa[_0xc8be('0x28')]]={'$like':'%'+_0xccb34a[_0xc8be('0x32')][_0xc8be('0x3d')]+'%'};return _0x2ab604;}})});}_0x29ff47=_['merge']({},_0x29ff47,_0xccb34a['options']);var _0x43f9eb={'where':_0x29ff47[_0xc8be('0x3e')]};return db[_0xc8be('0x2c')][_0xc8be('0x1c')](_0x43f9eb)[_0xc8be('0x40')](function(_0x192b01){_0x4a82b8['count']=_0x192b01;if(_0xccb34a[_0xc8be('0x32')][_0xc8be('0x41')]){_0x29ff47[_0xc8be('0x42')]=[{'all':!![]}];}return db[_0xc8be('0x2c')]['findAll'](_0x29ff47);})[_0xc8be('0x40')](function(_0x5abd48){_0x4a82b8[_0xc8be('0x43')]=_0x5abd48;return _0x4a82b8;})[_0xc8be('0x40')](respondWithFilteredResult(_0x11f8e9,_0x29ff47))[_0xc8be('0x44')](handleError(_0x11f8e9,null));};exports[_0xc8be('0x45')]=function(_0x25ec23,_0x58b7b4){var _0x523130={'raw':!![],'where':{'id':_0x25ec23['params']['id']}},_0xf2573e={};_0xf2573e[_0xc8be('0x30')]=_[_0xc8be('0x31')](db[_0xc8be('0x2c')][_0xc8be('0x2d')]);_0xf2573e['query']=_[_0xc8be('0x31')](_0x25ec23['query']);_0xf2573e[_0xc8be('0x33')]=_['intersection'](_0xf2573e[_0xc8be('0x30')],_0xf2573e[_0xc8be('0x32')]);_0x523130[_0xc8be('0x35')]=_[_0xc8be('0x34')](_0xf2573e[_0xc8be('0x30')],qs[_0xc8be('0x36')](_0x25ec23[_0xc8be('0x32')]['fields']));_0x523130['attributes']=_0x523130[_0xc8be('0x35')][_0xc8be('0x37')]?_0x523130['attributes']:_0xf2573e[_0xc8be('0x30')];if(_0x25ec23['query']['includeAll']){_0x523130[_0xc8be('0x42')]=[{'all':!![]}];}_0x523130=_['merge']({},_0x523130,_0x25ec23[_0xc8be('0x46')]);return db[_0xc8be('0x2c')][_0xc8be('0x47')](_0x523130)[_0xc8be('0x40')](handleEntityNotFound(_0x58b7b4,null))[_0xc8be('0x40')](respondWithResult(_0x58b7b4,null))[_0xc8be('0x44')](handleError(_0x58b7b4,null));};exports[_0xc8be('0x24')]=function(_0xdb30e,_0x2390a6){if(_0xdb30e[_0xc8be('0x48')]['id']){delete _0xdb30e['body']['id'];}return db[_0xc8be('0x2c')]['find']({'where':{'id':_0xdb30e[_0xc8be('0x49')]['id']}})[_0xc8be('0x40')](handleEntityNotFound(_0x2390a6,null))[_0xc8be('0x40')](saveUpdates(_0xdb30e[_0xc8be('0x48')],null))[_0xc8be('0x40')](respondWithResult(_0x2390a6,null))['catch'](handleError(_0x2390a6,null));};exports['destroy']=function(_0x12c578,_0x1d0755){return db['CmHopperBlack'][_0xc8be('0x47')]({'where':{'id':_0x12c578[_0xc8be('0x49')]['id']}})['then'](handleEntityNotFound(_0x1d0755,null))[_0xc8be('0x40')](removeEntity(_0x1d0755,null))[_0xc8be('0x44')](handleError(_0x1d0755,null));};exports[_0xc8be('0x4a')]=function(_0x5cf0b0,_0x15ec9e){return db[_0xc8be('0x2c')][_0xc8be('0x4a')]()[_0xc8be('0x40')](respondWithResult(_0x15ec9e,null))[_0xc8be('0x44')](handleError(_0x15ec9e,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index bcec0c8..249c9f8 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 _0x2603=['moment','request-promise','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','CmHopperBlack','lodash','util','../../config/logger'];(function(_0x4eb84e,_0x16f906){var _0x10f727=function(_0x3b28d8){while(--_0x3b28d8){_0x4eb84e['push'](_0x4eb84e['shift']());}};_0x10f727(++_0x16f906);}(_0x2603,0x10b));var _0x3260=function(_0x19776e,_0x3690de){_0x19776e=_0x19776e-0x0;var _0xce4b5f=_0x2603[_0x19776e];return _0xce4b5f;};'use strict';var _=require(_0x3260('0x0'));var util=require(_0x3260('0x1'));var logger=require(_0x3260('0x2'))('api');var moment=require(_0x3260('0x3'));var BPromise=require('bluebird');var rp=require(_0x3260('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3260('0x5'));var config=require(_0x3260('0x6'));var attributes=require(_0x3260('0x7'));module[_0x3260('0x8')]=function(_0x110609,_0x9a33fe){return _0x110609['define'](_0x3260('0x9'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc702=['path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','cm_hopper_black','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x28c1c0,_0x2398aa){var _0x2ff1e3=function(_0x23dfb3){while(--_0x23dfb3){_0x28c1c0['push'](_0x28c1c0['shift']());}};_0x2ff1e3(++_0x2398aa);}(_0xc702,0xbd));var _0x2c70=function(_0x1ec28a,_0x35b30a){_0x1ec28a=_0x1ec28a-0x0;var _0xfdd25=_0xc702[_0x1ec28a];return _0xfdd25;};'use strict';var _=require(_0x2c70('0x0'));var util=require(_0x2c70('0x1'));var logger=require(_0x2c70('0x2'))(_0x2c70('0x3'));var moment=require(_0x2c70('0x4'));var BPromise=require(_0x2c70('0x5'));var rp=require(_0x2c70('0x6'));var fs=require('fs');var path=require(_0x2c70('0x7'));var rimraf=require(_0x2c70('0x8'));var config=require(_0x2c70('0x9'));var attributes=require(_0x2c70('0xa'));module[_0x2c70('0xb')]=function(_0x54a358,_0x394e32){return _0x54a358[_0x2c70('0xc')]('CmHopperBlack',attributes,{'tableName':_0x2c70('0xd'),'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 f280999..5301901 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 _0x0886=['util','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetCmHopperBlack','findAll','options','where','limit','include','map','model','attributes','then','UpdateCmHopperBlack','update','raw','DestroyCmHopperBlack','CmHopperBlack','destroy'];(function(_0x297e02,_0x1c203e){var _0x54a202=function(_0x382fae){while(--_0x382fae){_0x297e02['push'](_0x297e02['shift']());}};_0x54a202(++_0x1c203e);}(_0x0886,0x118));var _0x6088=function(_0x5a6706,_0x1c0e48){_0x5a6706=_0x5a6706-0x0;var _0x540658=_0x0886[_0x5a6706];return _0x540658;};'use strict';var _=require('lodash');var util=require(_0x6088('0x0'));var moment=require(_0x6088('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6088('0x2'));var db=require(_0x6088('0x3'))['db'];var utils=require(_0x6088('0x4'));var logger=require('../../config/logger')(_0x6088('0x5'));var config=require('../../config/environment');var jayson=require(_0x6088('0x6'));var client=jayson[_0x6088('0x7')][_0x6088('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x25ba94,_0x2386e6,_0x41d67d){return new BPromise(function(_0x13e883,_0x573a9e){return client['request'](_0x25ba94,_0x41d67d)['then'](function(_0x5f48b1){logger['info'](_0x6088('0x9'),_0x2386e6,_0x6088('0xa'));logger[_0x6088('0xb')](_0x6088('0xc'),_0x2386e6,_0x6088('0xa'),JSON[_0x6088('0xd')](_0x5f48b1));if(_0x5f48b1[_0x6088('0xe')]){if(_0x5f48b1[_0x6088('0xe')][_0x6088('0xf')]===0x1f4){logger[_0x6088('0xe')](_0x6088('0x9'),_0x2386e6,_0x5f48b1[_0x6088('0xe')][_0x6088('0x10')]);return _0x573a9e(_0x5f48b1[_0x6088('0xe')][_0x6088('0x10')]);}logger[_0x6088('0xe')](_0x6088('0x9'),_0x2386e6,_0x5f48b1['error'][_0x6088('0x10')]);return _0x13e883(_0x5f48b1[_0x6088('0xe')][_0x6088('0x10')]);}else{logger[_0x6088('0x11')](_0x6088('0x9'),_0x2386e6,'request\x20sent');_0x13e883(_0x5f48b1['result'][_0x6088('0x10')]);}})[_0x6088('0x12')](function(_0x1356b5){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x2386e6,_0x1356b5);_0x573a9e(_0x1356b5);});});}exports[_0x6088('0x13')]=function(_0x234c38){var _0x3c88a8=this;return new Promise(function(_0x4e1ec6,_0x1c1827){return db['CmHopperBlack'][_0x6088('0x14')]({'raw':_0x234c38[_0x6088('0x15')]?_0x234c38[_0x6088('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x234c38[_0x6088('0x15')]?_0x234c38[_0x6088('0x15')][_0x6088('0x16')]||null:null,'attributes':_0x234c38['options']?_0x234c38[_0x6088('0x15')]['attributes']||null:null,'limit':_0x234c38[_0x6088('0x15')]?_0x234c38['options'][_0x6088('0x17')]||null:null,'include':_0x234c38[_0x6088('0x15')]?_0x234c38[_0x6088('0x15')][_0x6088('0x18')]?_[_0x6088('0x19')](_0x234c38['options'][_0x6088('0x18')],function(_0x475e5d){return{'model':db[_0x475e5d[_0x6088('0x1a')]],'as':_0x475e5d['as'],'attributes':_0x475e5d[_0x6088('0x1b')],'include':_0x475e5d[_0x6088('0x18')]?_[_0x6088('0x19')](_0x475e5d[_0x6088('0x18')],function(_0x5d0f15){return{'model':db[_0x5d0f15['model']],'as':_0x5d0f15['as'],'attributes':_0x5d0f15[_0x6088('0x1b')],'include':_0x5d0f15[_0x6088('0x18')]?_[_0x6088('0x19')](_0x5d0f15['include'],function(_0x3871a1){return{'model':db[_0x3871a1['model']],'as':_0x3871a1['as'],'attributes':_0x3871a1[_0x6088('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6088('0x1c')](function(_0x51c679){logger[_0x6088('0x11')](_0x6088('0x13'),_0x234c38);logger[_0x6088('0xb')]('GetCmHopperBlack',_0x234c38,JSON['stringify'](_0x51c679));_0x4e1ec6(_0x51c679);})[_0x6088('0x12')](function(_0x48530c){logger[_0x6088('0xe')](_0x6088('0x13'),_0x48530c['message'],_0x234c38);_0x1c1827(_0x3c88a8[_0x6088('0xe')](0x1f4,_0x48530c[_0x6088('0x10')]));});});};exports[_0x6088('0x1d')]=function(_0x4a4113){var _0x26e06=this;return new Promise(function(_0x3e80fa,_0x4d624c){return db['CmHopperBlack'][_0x6088('0x1e')](_0x4a4113['body'],{'raw':_0x4a4113[_0x6088('0x15')]?_0x4a4113[_0x6088('0x15')][_0x6088('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a4113[_0x6088('0x15')]?_0x4a4113['options'][_0x6088('0x16')]||null:null,'attributes':_0x4a4113[_0x6088('0x15')]?_0x4a4113[_0x6088('0x15')][_0x6088('0x1b')]||null:null,'limit':_0x4a4113[_0x6088('0x15')]?_0x4a4113['options'][_0x6088('0x17')]||null:null})[_0x6088('0x1c')](function(_0x5087b7){logger['info'](_0x6088('0x1d'),_0x4a4113);logger[_0x6088('0xb')](_0x6088('0x1d'),_0x4a4113,JSON[_0x6088('0xd')](_0x5087b7));_0x3e80fa(_0x5087b7);})[_0x6088('0x12')](function(_0x2ea480){logger['error'](_0x6088('0x1d'),_0x2ea480['message'],_0x4a4113);_0x4d624c(_0x26e06[_0x6088('0xe')](0x1f4,_0x2ea480[_0x6088('0x10')]));});});};exports[_0x6088('0x20')]=function(_0xd0c3cd){var _0xdc3632=this;return new Promise(function(_0x13b169,_0x890a2d){return db[_0x6088('0x21')][_0x6088('0x22')]({'where':_0xd0c3cd[_0x6088('0x15')]?_0xd0c3cd['options'][_0x6088('0x16')]||null:null})[_0x6088('0x1c')](function(_0x1ff27d){logger[_0x6088('0x11')]('DestroyCmHopperBlack',_0xd0c3cd);logger['debug']('DestroyCmHopperBlack',_0xd0c3cd,JSON['stringify'](_0x1ff27d));_0x13b169(_0x1ff27d);})[_0x6088('0x12')](function(_0x4a631c){logger[_0x6088('0xe')](_0x6088('0x20'),_0x4a631c[_0x6088('0x10')],_0xd0c3cd);_0x890a2d(_0xdc3632[_0x6088('0xe')](0x1f4,_0x4a631c[_0x6088('0x10')]));});});}; \ No newline at end of file +var _0xea67=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','CmHopperBlack,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','CmHopperBlack','options','where','attributes','limit','include','map','model','GetCmHopperBlack','UpdateCmHopperBlack','update','body','raw','DestroyCmHopperBlack','util','moment'];(function(_0x203976,_0x255c09){var _0x22b9a0=function(_0x368539){while(--_0x368539){_0x203976['push'](_0x203976['shift']());}};_0x22b9a0(++_0x255c09);}(_0xea67,0x152));var _0x7ea6=function(_0x8c1005,_0x1f3f16){_0x8c1005=_0x8c1005-0x0;var _0x175354=_0xea67[_0x8c1005];return _0x175354;};'use strict';var _=require('lodash');var util=require(_0x7ea6('0x0'));var moment=require(_0x7ea6('0x1'));var BPromise=require(_0x7ea6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7ea6('0x3'));var db=require(_0x7ea6('0x4'))['db'];var utils=require(_0x7ea6('0x5'));var logger=require(_0x7ea6('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7ea6('0x7'));var client=jayson[_0x7ea6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x271f21,_0x2afc62,_0x22a31a){return new BPromise(function(_0x584ae3,_0x40c5b8){return client[_0x7ea6('0x9')](_0x271f21,_0x22a31a)[_0x7ea6('0xa')](function(_0x386b51){logger[_0x7ea6('0xb')](_0x7ea6('0xc'),_0x2afc62,'request\x20sent');logger[_0x7ea6('0xd')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x2afc62,_0x7ea6('0xe'),JSON[_0x7ea6('0xf')](_0x386b51));if(_0x386b51[_0x7ea6('0x10')]){if(_0x386b51['error'][_0x7ea6('0x11')]===0x1f4){logger[_0x7ea6('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x2afc62,_0x386b51[_0x7ea6('0x10')][_0x7ea6('0x12')]);return _0x40c5b8(_0x386b51[_0x7ea6('0x10')][_0x7ea6('0x12')]);}logger[_0x7ea6('0x10')](_0x7ea6('0xc'),_0x2afc62,_0x386b51['error'][_0x7ea6('0x12')]);return _0x584ae3(_0x386b51[_0x7ea6('0x10')]['message']);}else{logger[_0x7ea6('0xb')]('CmHopperBlack,\x20%s,\x20%s',_0x2afc62,'request\x20sent');_0x584ae3(_0x386b51['result'][_0x7ea6('0x12')]);}})[_0x7ea6('0x13')](function(_0x2f9966){logger[_0x7ea6('0x10')](_0x7ea6('0xc'),_0x2afc62,_0x2f9966);_0x40c5b8(_0x2f9966);});});}exports['GetCmHopperBlack']=function(_0x1ee92f){var _0x52dace=this;return new Promise(function(_0x1cf222,_0x2263fe){return db[_0x7ea6('0x14')]['findAll']({'raw':_0x1ee92f[_0x7ea6('0x15')]?_0x1ee92f[_0x7ea6('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x1ee92f[_0x7ea6('0x15')]?_0x1ee92f[_0x7ea6('0x15')][_0x7ea6('0x16')]||null:null,'attributes':_0x1ee92f['options']?_0x1ee92f[_0x7ea6('0x15')][_0x7ea6('0x17')]||null:null,'limit':_0x1ee92f[_0x7ea6('0x15')]?_0x1ee92f['options'][_0x7ea6('0x18')]||null:null,'include':_0x1ee92f[_0x7ea6('0x15')]?_0x1ee92f['options'][_0x7ea6('0x19')]?_[_0x7ea6('0x1a')](_0x1ee92f[_0x7ea6('0x15')][_0x7ea6('0x19')],function(_0x38e1c8){return{'model':db[_0x38e1c8['model']],'as':_0x38e1c8['as'],'attributes':_0x38e1c8['attributes'],'include':_0x38e1c8[_0x7ea6('0x19')]?_[_0x7ea6('0x1a')](_0x38e1c8[_0x7ea6('0x19')],function(_0x5dce81){return{'model':db[_0x5dce81[_0x7ea6('0x1b')]],'as':_0x5dce81['as'],'attributes':_0x5dce81['attributes'],'include':_0x5dce81[_0x7ea6('0x19')]?_[_0x7ea6('0x1a')](_0x5dce81['include'],function(_0x233a43){return{'model':db[_0x233a43[_0x7ea6('0x1b')]],'as':_0x233a43['as'],'attributes':_0x233a43[_0x7ea6('0x17')]};}):[]};}):[]};}):[]:[]})[_0x7ea6('0xa')](function(_0x132a44){logger[_0x7ea6('0xb')](_0x7ea6('0x1c'),_0x1ee92f);logger[_0x7ea6('0xd')]('GetCmHopperBlack',_0x1ee92f,JSON[_0x7ea6('0xf')](_0x132a44));_0x1cf222(_0x132a44);})[_0x7ea6('0x13')](function(_0x4d9028){logger['error'](_0x7ea6('0x1c'),_0x4d9028[_0x7ea6('0x12')],_0x1ee92f);_0x2263fe(_0x52dace[_0x7ea6('0x10')](0x1f4,_0x4d9028[_0x7ea6('0x12')]));});});};exports[_0x7ea6('0x1d')]=function(_0xb3203b){var _0x56b8c9=this;return new Promise(function(_0x498dbb,_0x33c85c){return db['CmHopperBlack'][_0x7ea6('0x1e')](_0xb3203b[_0x7ea6('0x1f')],{'raw':_0xb3203b['options']?_0xb3203b[_0x7ea6('0x15')][_0x7ea6('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb3203b[_0x7ea6('0x15')]?_0xb3203b[_0x7ea6('0x15')][_0x7ea6('0x16')]||null:null,'attributes':_0xb3203b[_0x7ea6('0x15')]?_0xb3203b['options'][_0x7ea6('0x17')]||null:null,'limit':_0xb3203b[_0x7ea6('0x15')]?_0xb3203b[_0x7ea6('0x15')][_0x7ea6('0x18')]||null:null})[_0x7ea6('0xa')](function(_0x3f86ea){logger[_0x7ea6('0xb')](_0x7ea6('0x1d'),_0xb3203b);logger[_0x7ea6('0xd')](_0x7ea6('0x1d'),_0xb3203b,JSON[_0x7ea6('0xf')](_0x3f86ea));_0x498dbb(_0x3f86ea);})[_0x7ea6('0x13')](function(_0x1a2539){logger[_0x7ea6('0x10')]('UpdateCmHopperBlack',_0x1a2539[_0x7ea6('0x12')],_0xb3203b);_0x33c85c(_0x56b8c9[_0x7ea6('0x10')](0x1f4,_0x1a2539['message']));});});};exports[_0x7ea6('0x21')]=function(_0x3efc4a){var _0x178736=this;return new Promise(function(_0x509aec,_0x375fae){return db['CmHopperBlack']['destroy']({'where':_0x3efc4a['options']?_0x3efc4a['options'][_0x7ea6('0x16')]||null:null})[_0x7ea6('0xa')](function(_0x33e3e6){logger[_0x7ea6('0xb')]('DestroyCmHopperBlack',_0x3efc4a);logger[_0x7ea6('0xd')]('DestroyCmHopperBlack',_0x3efc4a,JSON[_0x7ea6('0xf')](_0x33e3e6));_0x509aec(_0x33e3e6);})[_0x7ea6('0x13')](function(_0x121d3d){logger[_0x7ea6('0x10')](_0x7ea6('0x21'),_0x121d3d[_0x7ea6('0x12')],_0x3efc4a);_0x375fae(_0x178736[_0x7ea6('0x10')](0x1f4,_0x121d3d[_0x7ea6('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 69692e3..1528a31 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 _0xfdbd=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','isAuthenticated','index','describe','get','show','put','/:id','update','delete','destroy'];(function(_0x3ab5bd,_0x56fbcf){var _0xe4109d=function(_0x36418b){while(--_0x36418b){_0x3ab5bd['push'](_0x3ab5bd['shift']());}};_0xe4109d(++_0x56fbcf);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x21a2b2,_0x22ba1e){_0x21a2b2=_0x21a2b2-0x0;var _0x2060b4=_0xfdbd[_0x21a2b2];return _0x2060b4;};'use strict';var multer=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var path=require(_0xdfdb('0x2'));var timeout=require(_0xdfdb('0x3'));var express=require(_0xdfdb('0x4'));var router=express[_0xdfdb('0x5')]();var fs_extra=require(_0xdfdb('0x6'));var auth=require(_0xdfdb('0x7'));var interaction=require(_0xdfdb('0x8'));var config=require('../../config/environment');var controller=require(_0xdfdb('0x9'));router['get']('/',auth[_0xdfdb('0xa')](),controller[_0xdfdb('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xdfdb('0xc')]);router[_0xdfdb('0xd')]('/:id',auth[_0xdfdb('0xa')](),controller[_0xdfdb('0xe')]);router[_0xdfdb('0xf')](_0xdfdb('0x10'),auth[_0xdfdb('0xa')](),controller[_0xdfdb('0x11')]);router[_0xdfdb('0x12')]('/:id',auth[_0xdfdb('0xa')](),controller[_0xdfdb('0x13')]);module['exports']=router; \ No newline at end of file +var _0xc6ac=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','update','delete'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x178662,_0x1fcd8d){_0x178662=_0x178662-0x0;var _0x109803=_0xc6ac[_0x178662];return _0x109803;};'use strict';var multer=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var path=require(_0xcc6a('0x2'));var timeout=require(_0xcc6a('0x3'));var express=require(_0xcc6a('0x4'));var router=express[_0xcc6a('0x5')]();var fs_extra=require(_0xcc6a('0x6'));var auth=require(_0xcc6a('0x7'));var interaction=require(_0xcc6a('0x8'));var config=require(_0xcc6a('0x9'));var controller=require(_0xcc6a('0xa'));router[_0xcc6a('0xb')]('/',auth[_0xcc6a('0xc')](),controller[_0xcc6a('0xd')]);router['get'](_0xcc6a('0xe'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0xf')]);router['get'](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0x11')]);router[_0xcc6a('0x12')](_0xcc6a('0x10'),auth['isAuthenticated'](),controller[_0xcc6a('0x13')]);router[_0xcc6a('0x14')](_0xcc6a('0x10'),auth['isAuthenticated'](),controller[_0xcc6a('0x15')]);module[_0xcc6a('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 18cba59..ce1ccb2 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 _0xc146=['seconds','BOOLEAN','sequelize','moment','STRING','INTEGER','DATE','setDataValue','followuptime'];(function(_0x1cf180,_0x280c42){var _0xbf4c9a=function(_0x5c3e4a){while(--_0x5c3e4a){_0x1cf180['push'](_0x1cf180['shift']());}};_0xbf4c9a(++_0x280c42);}(_0xc146,0x1b2));var _0x6c14=function(_0x2c7c8f,_0x1b6a0d){_0x2c7c8f=_0x2c7c8f-0x0;var _0x1a36ce=_0xc146[_0x2c7c8f];return _0x1a36ce;};'use strict';var Sequelize=require(_0x6c14('0x0'));var moment=require(_0x6c14('0x1'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x6c14('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6c14('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x6c14('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x6c14('0x2')]},'originatecalleridname':{'type':Sequelize[_0x6c14('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x6c14('0x2')]},'starttime':{'type':Sequelize[_0x6c14('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x6c14('0x4')]},'droptime':{'type':Sequelize[_0x6c14('0x4')]},'endtime':{'type':Sequelize[_0x6c14('0x4')]},'ringtime':{'type':Sequelize[_0x6c14('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x6c14('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x6c14('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x6c14('0x2')]},'campaign':{'type':Sequelize[_0x6c14('0x2')]},'campaigntype':{'type':Sequelize[_0x6c14('0x2')]},'membername':{'type':Sequelize[_0x6c14('0x2')]},'reason':{'type':Sequelize[_0x6c14('0x2')]},'disposition':{'type':Sequelize[_0x6c14('0x2')]},'secondDisposition':{'type':Sequelize[_0x6c14('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x6c14('0x4')],'set':function(_0x21ec9b){var _0xdca0db=this['getDataValue']('endtime');if(_0xdca0db&&_0x21ec9b){this[_0x6c14('0x5')](_0x6c14('0x6'),moment(_0x21ec9b)['diff'](moment(_0xdca0db),_0x6c14('0x7')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x6c14('0x8')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x6c14('0x8')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x6c14('0x8')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x6c14('0x4')]},'callback':{'type':Sequelize[_0x6c14('0x8')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6c14('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6c14('0x4')]},'deleted':{'type':Sequelize[_0x6c14('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x6c14('0x4')]},'recallme':{'type':Sequelize[_0x6c14('0x8')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x6c14('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x6c14('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6c14('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6c14('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6c14('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6c14('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x82ab=['setDataValue','diff','seconds','BOOLEAN','sequelize','exports','INTEGER','STRING','DATE','getDataValue','endtime'];(function(_0x4d8219,_0x1e7d06){var _0x2f8779=function(_0x2dd025){while(--_0x2dd025){_0x4d8219['push'](_0x4d8219['shift']());}};_0x2f8779(++_0x1e7d06);}(_0x82ab,0x1f3));var _0xb82a=function(_0x1cac87,_0x369e25){_0x1cac87=_0x1cac87-0x0;var _0xf6ed36=_0x82ab[_0x1cac87];return _0xf6ed36;};'use strict';var Sequelize=require(_0xb82a('0x0'));var moment=require('moment');module[_0xb82a('0x1')]={'state':{'type':Sequelize[_0xb82a('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xb82a('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb82a('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xb82a('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xb82a('0x3')]},'originatecalleridname':{'type':Sequelize[_0xb82a('0x3')]},'calleridnum':{'type':Sequelize[_0xb82a('0x3')]},'calleridname':{'type':Sequelize[_0xb82a('0x3')]},'starttime':{'type':Sequelize[_0xb82a('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xb82a('0x4')]},'droptime':{'type':Sequelize[_0xb82a('0x4')]},'endtime':{'type':Sequelize[_0xb82a('0x4')]},'ringtime':{'type':Sequelize[_0xb82a('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xb82a('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xb82a('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xb82a('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xb82a('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xb82a('0x3')]},'membername':{'type':Sequelize[_0xb82a('0x3')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xb82a('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xb82a('0x3')]},'dispositionat':{'type':Sequelize[_0xb82a('0x4')],'set':function(_0x3bf2c5){var _0xb7f97=this[_0xb82a('0x5')](_0xb82a('0x6'));if(_0xb7f97&&_0x3bf2c5){this[_0xb82a('0x7')]('followuptime',moment(_0x3bf2c5)[_0xb82a('0x8')](moment(_0xb7f97),_0xb82a('0x9')));}}},'amd':{'type':Sequelize[_0xb82a('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0xb82a('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xb82a('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xb82a('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xb82a('0x4')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb82a('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0xb82a('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xb82a('0x4')]},'recallme':{'type':Sequelize[_0xb82a('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xb82a('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb82a('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb82a('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb82a('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index e8bac8a..395e7b4 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 _0x6d38=['calleridnum\x20IS\x20NOT\x20NULL','CmHopper','findOne','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','save','update','then','stack','name','send','index','map','CmHopperFinal','rawAttributes','type','key','model','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','keys','filters','intersection','describe','catch','body','uniqueid','find','params','countContactsQueueCampaignHopperFinal','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','busyContacts','`state`\x20=\x208,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','moveContactsQueueCampaignHopperFinal','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','from','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','group','Campaign','cm_hopper','CampaignId','ANY_VALUE(ListId)','CampaignId\x20=\x20?','state'];(function(_0x336de0,_0x50b920){var _0x4872f7=function(_0x3ae566){while(--_0x3ae566){_0x336de0['push'](_0x336de0['shift']());}};_0x4872f7(++_0x50b920);}(_0x6d38,0x1ef));var _0x86d3=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x6d38[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x86d3('0x0'));var zipdir=require(_0x86d3('0x1'));var jsonpatch=require(_0x86d3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x86d3('0x3'));var Mustache=require('mustache');var util=require(_0x86d3('0x4'));var path=require(_0x86d3('0x5'));var sox=require(_0x86d3('0x6'));var csv=require('to-csv');var ejs=require(_0x86d3('0x7'));var fs=require('fs');var fs_extra=require(_0x86d3('0x8'));var _=require(_0x86d3('0x9'));var squel=require(_0x86d3('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x86d3('0xb'));var toCsv=require(_0x86d3('0xc'));var querystring=require(_0x86d3('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x86d3('0xe'));var qs=require(_0x86d3('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x86d3('0x10'))(_0x86d3('0x11'));var utils=require('../../config/utils');var config=require(_0x86d3('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x86d3('0x13'))['db'];function respondWithStatusCode(_0x7d4d2e,_0x440a55){_0x440a55=_0x440a55||0xcc;return function(_0x26d64c){if(_0x26d64c){return _0x7d4d2e[_0x86d3('0x14')](_0x440a55);}return _0x7d4d2e[_0x86d3('0x15')](_0x440a55)[_0x86d3('0x16')]();};}function respondWithResult(_0x12ef4a,_0x5ce2ff){_0x5ce2ff=_0x5ce2ff||0xc8;return function(_0x1c1ba8){if(_0x1c1ba8){return _0x12ef4a[_0x86d3('0x15')](_0x5ce2ff)[_0x86d3('0x17')](_0x1c1ba8);}};}function respondWithFilteredResult(_0x207f6f,_0x1ea535){return function(_0x34fb3b){if(_0x34fb3b){var _0x1ff008=typeof _0x1ea535[_0x86d3('0x18')]==='undefined'&&typeof _0x1ea535[_0x86d3('0x19')]===_0x86d3('0x1a');var _0x431b3f=_0x34fb3b[_0x86d3('0x1b')];var _0x46feec=_0x1ff008?0x0:_0x1ea535[_0x86d3('0x18')];var _0x33e459=_0x1ff008?_0x34fb3b[_0x86d3('0x1b')]:_0x1ea535[_0x86d3('0x18')]+_0x1ea535['limit'];var _0x191ba5;if(_0x33e459>=_0x431b3f){_0x33e459=_0x431b3f;_0x191ba5=0xc8;}else{_0x191ba5=0xce;}_0x207f6f['status'](_0x191ba5);return _0x207f6f[_0x86d3('0x1c')]('Content-Range',_0x46feec+'-'+_0x33e459+'/'+_0x431b3f)['json'](_0x34fb3b);}return null;};}function patchUpdates(_0x41486a){return function(_0x1edb6d){try{jsonpatch[_0x86d3('0x1d')](_0x1edb6d,_0x41486a,!![]);}catch(_0x1720ae){return BPromise['reject'](_0x1720ae);}return _0x1edb6d[_0x86d3('0x1e')]();};}function saveUpdates(_0x55e1c3,_0x36e0fa){return function(_0x3fdf67){if(_0x3fdf67){return _0x3fdf67[_0x86d3('0x1f')](_0x55e1c3)['then'](function(_0x39d819){return _0x39d819;});}return null;};}function removeEntity(_0x72b3d4,_0x1fa4ac){return function(_0x4bf5b8){if(_0x4bf5b8){return _0x4bf5b8['destroy']()[_0x86d3('0x20')](function(){_0x72b3d4['status'](0xcc)[_0x86d3('0x16')]();});}};}function handleEntityNotFound(_0x1bea5e,_0x3dfecd){return function(_0x3c5fe4){if(!_0x3c5fe4){_0x1bea5e['sendStatus'](0x194);}return _0x3c5fe4;};}function handleError(_0x481077,_0x3359e4){_0x3359e4=_0x3359e4||0x1f4;return function(_0x611764){logger['error'](_0x611764[_0x86d3('0x21')]);if(_0x611764['name']){delete _0x611764[_0x86d3('0x22')];}_0x481077[_0x86d3('0x15')](_0x3359e4)[_0x86d3('0x23')](_0x611764);};}exports[_0x86d3('0x24')]=function(_0x11a6fd,_0x14c9ff){var _0x1f203e={},_0x35d708={},_0x303f13={'count':0x0,'rows':[]};var _0x44dacf=_[_0x86d3('0x25')](db[_0x86d3('0x26')][_0x86d3('0x27')],function(_0x28c25e){return{'name':_0x28c25e['fieldName'],'type':_0x28c25e[_0x86d3('0x28')][_0x86d3('0x29')]};});_0x35d708[_0x86d3('0x2a')]=_[_0x86d3('0x25')](_0x44dacf,_0x86d3('0x22'));_0x35d708[_0x86d3('0x2b')]=_['keys'](_0x11a6fd[_0x86d3('0x2b')]);_0x35d708['filters']=_['intersection'](_0x35d708[_0x86d3('0x2a')],_0x35d708[_0x86d3('0x2b')]);_0x1f203e[_0x86d3('0x2c')]=_['intersection'](_0x35d708[_0x86d3('0x2a')],qs[_0x86d3('0x2d')](_0x11a6fd['query'][_0x86d3('0x2d')]));_0x1f203e[_0x86d3('0x2c')]=_0x1f203e[_0x86d3('0x2c')][_0x86d3('0x2e')]?_0x1f203e[_0x86d3('0x2c')]:_0x35d708[_0x86d3('0x2a')];if(!_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x2f')]('nolimit')){_0x1f203e['limit']=qs['limit'](_0x11a6fd[_0x86d3('0x2b')]['limit']);_0x1f203e[_0x86d3('0x18')]=qs['offset'](_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x18')]);}_0x1f203e[_0x86d3('0x30')]=qs[_0x86d3('0x31')](_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x31')]);_0x1f203e[_0x86d3('0x32')]=qs['filters'](_[_0x86d3('0x33')](_0x11a6fd[_0x86d3('0x2b')],_0x35d708['filters']),_0x44dacf);if(_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x34')]){_0x1f203e[_0x86d3('0x32')]=_[_0x86d3('0x35')](_0x1f203e['where'],{'$or':_[_0x86d3('0x25')](_0x44dacf,function(_0x42ac0d){if(_0x42ac0d[_0x86d3('0x28')]!=='VIRTUAL'){var _0x5762ca={};_0x5762ca[_0x42ac0d[_0x86d3('0x22')]]={'$like':'%'+_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x34')]+'%'};return _0x5762ca;}})});}_0x1f203e=_[_0x86d3('0x35')]({},_0x1f203e,_0x11a6fd[_0x86d3('0x36')]);var _0x3666fc={'where':_0x1f203e[_0x86d3('0x32')]};return db['CmHopperFinal'][_0x86d3('0x1b')](_0x3666fc)[_0x86d3('0x20')](function(_0x2bdc67){_0x303f13[_0x86d3('0x1b')]=_0x2bdc67;if(_0x11a6fd['query'][_0x86d3('0x37')]){_0x1f203e[_0x86d3('0x38')]=[{'all':!![]}];}return db[_0x86d3('0x26')][_0x86d3('0x39')](_0x1f203e);})['then'](function(_0x587747){_0x303f13[_0x86d3('0x3a')]=_0x587747;return _0x303f13;})['then'](respondWithFilteredResult(_0x14c9ff,_0x1f203e))['catch'](handleError(_0x14c9ff,null));};exports[_0x86d3('0x3b')]=function(_0x1385fc,_0x43490a){var _0x35d6fe={'raw':!![],'where':{'id':_0x1385fc['params']['id']}},_0x23ef72={};_0x23ef72[_0x86d3('0x2a')]=_[_0x86d3('0x3c')](db[_0x86d3('0x26')]['rawAttributes']);_0x23ef72[_0x86d3('0x2b')]=_[_0x86d3('0x3c')](_0x1385fc['query']);_0x23ef72[_0x86d3('0x3d')]=_[_0x86d3('0x3e')](_0x23ef72['model'],_0x23ef72['query']);_0x35d6fe['attributes']=_[_0x86d3('0x3e')](_0x23ef72[_0x86d3('0x2a')],qs[_0x86d3('0x2d')](_0x1385fc[_0x86d3('0x2b')][_0x86d3('0x2d')]));_0x35d6fe[_0x86d3('0x2c')]=_0x35d6fe['attributes'][_0x86d3('0x2e')]?_0x35d6fe[_0x86d3('0x2c')]:_0x23ef72['model'];if(_0x1385fc[_0x86d3('0x2b')][_0x86d3('0x37')]){_0x35d6fe[_0x86d3('0x38')]=[{'all':!![]}];}_0x35d6fe=_[_0x86d3('0x35')]({},_0x35d6fe,_0x1385fc[_0x86d3('0x36')]);return db[_0x86d3('0x26')]['find'](_0x35d6fe)[_0x86d3('0x20')](handleEntityNotFound(_0x43490a,null))[_0x86d3('0x20')](respondWithResult(_0x43490a,null))['catch'](handleError(_0x43490a,null));};exports[_0x86d3('0x3f')]=function(_0x412d0e,_0xd20863){return db[_0x86d3('0x26')][_0x86d3('0x3f')]()['then'](respondWithResult(_0xd20863,null))[_0x86d3('0x40')](handleError(_0xd20863,null));};exports[_0x86d3('0x1f')]=function(_0x3226b5,_0x14fa58){if(_0x3226b5[_0x86d3('0x41')][_0x86d3('0x42')]){delete _0x3226b5[_0x86d3('0x41')][_0x86d3('0x42')];}return db[_0x86d3('0x26')][_0x86d3('0x43')]({'where':{'uniqueid':_0x3226b5[_0x86d3('0x44')]['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x14fa58,null))['then'](saveUpdates(_0x3226b5[_0x86d3('0x41')],null))[_0x86d3('0x20')](respondWithResult(_0x14fa58,null))['catch'](handleError(_0x14fa58,null));};exports[_0x86d3('0x45')]=function(_0x23a6ee,_0x197047,_0x2e9af5){return db[_0x86d3('0x26')][_0x86d3('0x39')]({'raw':![],'where':{'VoiceQueueId':_0x23a6ee['params']['id']},'attributes':[[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x48')))),_0x86d3('0x49')],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db['sequelize'][_0x86d3('0x47')](_0x86d3('0x4b')))),_0x86d3('0x4c')],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')]['literal'](_0x86d3('0x4d')))),'busyContacts'],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')]('`state`\x20=\x208,\x201,\x20null'))),_0x86d3('0x4e')],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x86d3('0x4f')))),'dropContacts'],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db['sequelize']['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x50')))),_0x86d3('0x51')],[db[_0x86d3('0x46')]['fn']('COUNT',db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x52')))),'answeringMachine']]})[_0x86d3('0x20')](handleEntityNotFound(_0x197047,null))[_0x86d3('0x20')](respondWithResult(_0x197047,null))['catch'](handleError(_0x197047,null));};exports[_0x86d3('0x53')]=function(_0x416428,_0x15cdd0,_0x29bdee){return db[_0x86d3('0x26')][_0x86d3('0x39')]({'raw':![],'where':{'CampaignId':_0x416428[_0x86d3('0x44')]['id']},'attributes':[[db['sequelize']['fn']('COUNT',db[_0x86d3('0x46')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x200,\x201,\x20null'))),_0x86d3('0x49')],[db['sequelize']['fn'](_0x86d3('0x4a'),db['sequelize']['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x4b')))),'noAnswerContacts'],[db['sequelize']['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x4d')))),_0x86d3('0x54')],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x55')))),_0x86d3('0x4e')],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x86d3('0x56')],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db['sequelize']['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x57')))),_0x86d3('0x58')],[db['sequelize']['fn'](_0x86d3('0x4a'),db['sequelize']['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x50')))),_0x86d3('0x51')],[db[_0x86d3('0x46')]['fn']('COUNT',db[_0x86d3('0x46')]['fn']('IF',db['sequelize'][_0x86d3('0x47')](_0x86d3('0x52')))),'answeringMachine']]})[_0x86d3('0x20')](handleEntityNotFound(_0x15cdd0,null))[_0x86d3('0x20')](respondWithResult(_0x15cdd0,null))[_0x86d3('0x40')](handleError(_0x15cdd0,null));};exports[_0x86d3('0x59')]=function(_0x308fed,_0x1c966a,_0x379799){return db['VoiceQueue'][_0x86d3('0x43')]({'where':{'id':_0x308fed[_0x86d3('0x44')]['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x1c966a,null))[_0x86d3('0x20')](function(_0x46e356){var _0x47f72e;if(_0x46e356){_0x47f72e=squel[_0x86d3('0x5a')]()[_0x86d3('0x5b')]('cm_hopper')[_0x86d3('0x5c')]([_0x86d3('0x5d'),_0x86d3('0x5e'),_0x86d3('0x5f'),_0x86d3('0x60'),_0x86d3('0x61'),_0x86d3('0x62'),_0x86d3('0x63')],squel[_0x86d3('0x64')]()[_0x86d3('0x65')](_0x86d3('0x66'),_0x86d3('0x5d'))[_0x86d3('0x65')](_0x86d3('0x67'),'scheduledAt')[_0x86d3('0x65')](_0x86d3('0x68'),_0x86d3('0x5f'))[_0x86d3('0x65')]('ANY_VALUE(ListId)',_0x86d3('0x60'))[_0x86d3('0x65')](_0x86d3('0x69'),_0x86d3('0x61'))['field']('NOW()',_0x86d3('0x62'))['field'](_0x86d3('0x67'),'updatedAt')['from'](_0x86d3('0x6a'))[_0x86d3('0x32')](_0x86d3('0x6b'),_0x308fed[_0x86d3('0x44')]['id'][_0x86d3('0x6c')]())['where'](_0x86d3('0x6d'),_0x308fed[_0x86d3('0x41')]['state'][_0x86d3('0x6c')]())[_0x86d3('0x32')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x86d3('0x32')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x86d3('0x64')]()['field']('phone')[_0x86d3('0x6e')]('cm_hopper')[_0x86d3('0x32')](_0x86d3('0x6b'),_0x308fed[_0x86d3('0x44')]['id'][_0x86d3('0x6c')]()))[_0x86d3('0x32')](_0x86d3('0x6f'),squel[_0x86d3('0x64')]()[_0x86d3('0x65')]('calleridnum')[_0x86d3('0x6e')](_0x86d3('0x6a'))[_0x86d3('0x32')](_0x86d3('0x6b'),_0x308fed[_0x86d3('0x44')]['id']['toString']())[_0x86d3('0x32')](_0x86d3('0x70')))[_0x86d3('0x71')](_0x86d3('0x5f')))[_0x86d3('0x6c')]();return db[_0x86d3('0x46')][_0x86d3('0x2b')](_0x47f72e);}return[];})['then'](respondWithResult(_0x1c966a,null))[_0x86d3('0x40')](handleError(_0x1c966a,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0xca2e0,_0x596b1d,_0x5a22ca){return db[_0x86d3('0x72')][_0x86d3('0x43')]({'where':{'id':_0xca2e0['params']['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x596b1d,null))[_0x86d3('0x20')](function(_0x879a8b){var _0x1c1384;if(_0x879a8b){_0x1c1384=squel[_0x86d3('0x5a')]()[_0x86d3('0x5b')](_0x86d3('0x73'))['fromQuery'](['phone',_0x86d3('0x5e'),_0x86d3('0x5f'),_0x86d3('0x60'),_0x86d3('0x74'),_0x86d3('0x62'),_0x86d3('0x63')],squel['select']()[_0x86d3('0x65')](_0x86d3('0x66'),_0x86d3('0x5d'))[_0x86d3('0x65')](_0x86d3('0x67'),_0x86d3('0x5e'))[_0x86d3('0x65')](_0x86d3('0x68'),_0x86d3('0x5f'))['field'](_0x86d3('0x75'),_0x86d3('0x60'))['field']('ANY_VALUE(CampaignId)',_0x86d3('0x74'))[_0x86d3('0x65')](_0x86d3('0x67'),'createdAt')[_0x86d3('0x65')](_0x86d3('0x67'),_0x86d3('0x63'))[_0x86d3('0x6e')](_0x86d3('0x6a'))['where'](_0x86d3('0x76'),_0xca2e0[_0x86d3('0x44')]['id']['toString']())[_0x86d3('0x32')](_0x86d3('0x6d'),_0xca2e0[_0x86d3('0x41')][_0x86d3('0x77')]['toString']())[_0x86d3('0x32')](_0x86d3('0x78'))[_0x86d3('0x32')](_0x86d3('0x6f'),squel[_0x86d3('0x64')]()['field'](_0x86d3('0x5d'))[_0x86d3('0x6e')](_0x86d3('0x73'))[_0x86d3('0x32')](_0x86d3('0x76'),_0xca2e0[_0x86d3('0x44')]['id'][_0x86d3('0x6c')]()))[_0x86d3('0x32')](_0x86d3('0x6f'),squel[_0x86d3('0x64')]()['field']('calleridnum')[_0x86d3('0x6e')](_0x86d3('0x6a'))['where'](_0x86d3('0x76'),_0xca2e0[_0x86d3('0x44')]['id'][_0x86d3('0x6c')]())[_0x86d3('0x32')](_0x86d3('0x70')))[_0x86d3('0x71')](_0x86d3('0x5f')))[_0x86d3('0x6c')]();return db[_0x86d3('0x46')]['query'](_0x1c1384);}return[];})['then'](respondWithResult(_0x596b1d,null))['catch'](handleError(_0x596b1d,null));};exports['checkContactHopper']=function(_0xad83bf,_0x2514c1,_0x28a509){return db[_0x86d3('0x79')][_0x86d3('0x7a')]({'where':{'VoiceQueueId':_0xad83bf[_0x86d3('0x41')][_0x86d3('0x61')],'CampaignId':_0xad83bf['body'][_0x86d3('0x74')],'ContactId':_0xad83bf[_0x86d3('0x41')][_0x86d3('0x5f')]}})[_0x86d3('0x20')](handleEntityNotFound(_0x2514c1,null))['then'](function(_0xe239b5){if(_0xe239b5){return _0xe239b5;}return null;})['then'](respondWithResult(_0x2514c1,null))[_0x86d3('0x40')](handleError(_0x2514c1,null));}; \ No newline at end of file +var _0x4c60=['include','findAll','rows','catch','show','includeAll','find','describe','update','uniqueid','body','params','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','answeringMachine','VoiceQueue','into','cm_hopper','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','insert','fromQuery','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','calleridnum','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','moment','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','end','error','stack','name','index','map','CmHopperFinal','rawAttributes','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options'];(function(_0x2952a0,_0x1adc0c){var _0x275f2c=function(_0x253ace){while(--_0x253ace){_0x2952a0['push'](_0x2952a0['shift']());}};_0x275f2c(++_0x1adc0c);}(_0x4c60,0xc1));var _0x04c6=function(_0x3ed580,_0x420721){_0x3ed580=_0x3ed580-0x0;var _0x5a4ad9=_0x4c60[_0x3ed580];return _0x5a4ad9;};'use strict';var emlformat=require(_0x04c6('0x0'));var rimraf=require(_0x04c6('0x1'));var zipdir=require(_0x04c6('0x2'));var jsonpatch=require(_0x04c6('0x3'));var rp=require('request-promise');var moment=require(_0x04c6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x04c6('0x5'));var csv=require(_0x04c6('0x6'));var ejs=require(_0x04c6('0x7'));var fs=require('fs');var fs_extra=require(_0x04c6('0x8'));var _=require(_0x04c6('0x9'));var squel=require(_0x04c6('0xa'));var crypto=require(_0x04c6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x04c6('0xc'));var toCsv=require(_0x04c6('0x6'));var querystring=require(_0x04c6('0xd'));var Papa=require(_0x04c6('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x04c6('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x04c6('0x10'))(_0x04c6('0x11'));var utils=require('../../config/utils');var config=require(_0x04c6('0x12'));var licenseUtil=require(_0x04c6('0x13'));var db=require(_0x04c6('0x14'))['db'];function respondWithStatusCode(_0x4e5e6,_0x52cdcf){_0x52cdcf=_0x52cdcf||0xcc;return function(_0x257a0a){if(_0x257a0a){return _0x4e5e6[_0x04c6('0x15')](_0x52cdcf);}return _0x4e5e6[_0x04c6('0x16')](_0x52cdcf)['end']();};}function respondWithResult(_0x12d1c5,_0x15cbe0){_0x15cbe0=_0x15cbe0||0xc8;return function(_0x28632e){if(_0x28632e){return _0x12d1c5[_0x04c6('0x16')](_0x15cbe0)[_0x04c6('0x17')](_0x28632e);}};}function respondWithFilteredResult(_0x19a26f,_0x1cd963){return function(_0x3d46a9){if(_0x3d46a9){var _0x5a5a66=typeof _0x1cd963[_0x04c6('0x18')]===_0x04c6('0x19')&&typeof _0x1cd963[_0x04c6('0x1a')]===_0x04c6('0x19');var _0x43596a=_0x3d46a9[_0x04c6('0x1b')];var _0x21674a=_0x5a5a66?0x0:_0x1cd963[_0x04c6('0x18')];var _0x47f400=_0x5a5a66?_0x3d46a9[_0x04c6('0x1b')]:_0x1cd963[_0x04c6('0x18')]+_0x1cd963[_0x04c6('0x1a')];var _0x558b43;if(_0x47f400>=_0x43596a){_0x47f400=_0x43596a;_0x558b43=0xc8;}else{_0x558b43=0xce;}_0x19a26f['status'](_0x558b43);return _0x19a26f['set'](_0x04c6('0x1c'),_0x21674a+'-'+_0x47f400+'/'+_0x43596a)[_0x04c6('0x17')](_0x3d46a9);}return null;};}function patchUpdates(_0x50dd61){return function(_0x5a5e9e){try{jsonpatch[_0x04c6('0x1d')](_0x5a5e9e,_0x50dd61,!![]);}catch(_0x2eed94){return BPromise[_0x04c6('0x1e')](_0x2eed94);}return _0x5a5e9e['save']();};}function saveUpdates(_0x33a0f7,_0x13f2dc){return function(_0x9d41f8){if(_0x9d41f8){return _0x9d41f8['update'](_0x33a0f7)[_0x04c6('0x1f')](function(_0x41e29f){return _0x41e29f;});}return null;};}function removeEntity(_0x562491,_0x54a8b0){return function(_0x4c8d72){if(_0x4c8d72){return _0x4c8d72[_0x04c6('0x20')]()[_0x04c6('0x1f')](function(){_0x562491[_0x04c6('0x16')](0xcc)[_0x04c6('0x21')]();});}};}function handleEntityNotFound(_0x3e1328,_0x52e5f5){return function(_0x562952){if(!_0x562952){_0x3e1328[_0x04c6('0x15')](0x194);}return _0x562952;};}function handleError(_0x2ab1d2,_0x9acfa){_0x9acfa=_0x9acfa||0x1f4;return function(_0x3233d7){logger[_0x04c6('0x22')](_0x3233d7[_0x04c6('0x23')]);if(_0x3233d7['name']){delete _0x3233d7[_0x04c6('0x24')];}_0x2ab1d2[_0x04c6('0x16')](_0x9acfa)['send'](_0x3233d7);};}exports[_0x04c6('0x25')]=function(_0x1cd16a,_0x5f1331){var _0x5c9003={},_0x115d84={},_0x3a6d92={'count':0x0,'rows':[]};var _0x2a191f=_[_0x04c6('0x26')](db[_0x04c6('0x27')][_0x04c6('0x28')],function(_0x49c4ed){return{'name':_0x49c4ed['fieldName'],'type':_0x49c4ed['type'][_0x04c6('0x29')]};});_0x115d84['model']=_[_0x04c6('0x26')](_0x2a191f,_0x04c6('0x24'));_0x115d84['query']=_[_0x04c6('0x2a')](_0x1cd16a[_0x04c6('0x2b')]);_0x115d84[_0x04c6('0x2c')]=_[_0x04c6('0x2d')](_0x115d84['model'],_0x115d84[_0x04c6('0x2b')]);_0x5c9003[_0x04c6('0x2e')]=_[_0x04c6('0x2d')](_0x115d84[_0x04c6('0x2f')],qs[_0x04c6('0x30')](_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x30')]));_0x5c9003[_0x04c6('0x2e')]=_0x5c9003[_0x04c6('0x2e')][_0x04c6('0x31')]?_0x5c9003[_0x04c6('0x2e')]:_0x115d84[_0x04c6('0x2f')];if(!_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x32')](_0x04c6('0x33'))){_0x5c9003['limit']=qs[_0x04c6('0x1a')](_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x1a')]);_0x5c9003[_0x04c6('0x18')]=qs['offset'](_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x18')]);}_0x5c9003['order']=qs['sort'](_0x1cd16a['query'][_0x04c6('0x34')]);_0x5c9003[_0x04c6('0x35')]=qs['filters'](_[_0x04c6('0x36')](_0x1cd16a['query'],_0x115d84[_0x04c6('0x2c')]),_0x2a191f);if(_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x37')]){_0x5c9003[_0x04c6('0x35')]=_['merge'](_0x5c9003['where'],{'$or':_[_0x04c6('0x26')](_0x2a191f,function(_0x3a9a3b){if(_0x3a9a3b['type']!==_0x04c6('0x38')){var _0x5ce4b0={};_0x5ce4b0[_0x3a9a3b['name']]={'$like':'%'+_0x1cd16a[_0x04c6('0x2b')]['filter']+'%'};return _0x5ce4b0;}})});}_0x5c9003=_[_0x04c6('0x39')]({},_0x5c9003,_0x1cd16a[_0x04c6('0x3a')]);var _0x59ca18={'where':_0x5c9003[_0x04c6('0x35')]};return db['CmHopperFinal'][_0x04c6('0x1b')](_0x59ca18)[_0x04c6('0x1f')](function(_0x2d83eb){_0x3a6d92[_0x04c6('0x1b')]=_0x2d83eb;if(_0x1cd16a[_0x04c6('0x2b')]['includeAll']){_0x5c9003[_0x04c6('0x3b')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x04c6('0x3c')](_0x5c9003);})['then'](function(_0x1f7ead){_0x3a6d92[_0x04c6('0x3d')]=_0x1f7ead;return _0x3a6d92;})[_0x04c6('0x1f')](respondWithFilteredResult(_0x5f1331,_0x5c9003))[_0x04c6('0x3e')](handleError(_0x5f1331,null));};exports[_0x04c6('0x3f')]=function(_0x2cdf34,_0x40477f){var _0x4a3c45={'raw':!![],'where':{'id':_0x2cdf34['params']['id']}},_0xdfdc34={};_0xdfdc34[_0x04c6('0x2f')]=_['keys'](db['CmHopperFinal'][_0x04c6('0x28')]);_0xdfdc34['query']=_[_0x04c6('0x2a')](_0x2cdf34[_0x04c6('0x2b')]);_0xdfdc34[_0x04c6('0x2c')]=_['intersection'](_0xdfdc34[_0x04c6('0x2f')],_0xdfdc34[_0x04c6('0x2b')]);_0x4a3c45[_0x04c6('0x2e')]=_[_0x04c6('0x2d')](_0xdfdc34[_0x04c6('0x2f')],qs[_0x04c6('0x30')](_0x2cdf34[_0x04c6('0x2b')]['fields']));_0x4a3c45['attributes']=_0x4a3c45[_0x04c6('0x2e')][_0x04c6('0x31')]?_0x4a3c45[_0x04c6('0x2e')]:_0xdfdc34['model'];if(_0x2cdf34[_0x04c6('0x2b')][_0x04c6('0x40')]){_0x4a3c45[_0x04c6('0x3b')]=[{'all':!![]}];}_0x4a3c45=_['merge']({},_0x4a3c45,_0x2cdf34['options']);return db['CmHopperFinal'][_0x04c6('0x41')](_0x4a3c45)[_0x04c6('0x1f')](handleEntityNotFound(_0x40477f,null))['then'](respondWithResult(_0x40477f,null))[_0x04c6('0x3e')](handleError(_0x40477f,null));};exports[_0x04c6('0x42')]=function(_0x2bd045,_0x4ef366){return db[_0x04c6('0x27')][_0x04c6('0x42')]()['then'](respondWithResult(_0x4ef366,null))[_0x04c6('0x3e')](handleError(_0x4ef366,null));};exports[_0x04c6('0x43')]=function(_0x2472ed,_0xee2822){if(_0x2472ed['body'][_0x04c6('0x44')]){delete _0x2472ed[_0x04c6('0x45')][_0x04c6('0x44')];}return db[_0x04c6('0x27')]['find']({'where':{'uniqueid':_0x2472ed[_0x04c6('0x46')]['id']}})[_0x04c6('0x1f')](handleEntityNotFound(_0xee2822,null))[_0x04c6('0x1f')](saveUpdates(_0x2472ed[_0x04c6('0x45')],null))['then'](respondWithResult(_0xee2822,null))[_0x04c6('0x3e')](handleError(_0xee2822,null));};exports[_0x04c6('0x47')]=function(_0x15ec61,_0x489361,_0x3119f0){return db[_0x04c6('0x27')][_0x04c6('0x3c')]({'raw':![],'where':{'VoiceQueueId':_0x15ec61[_0x04c6('0x46')]['id']},'attributes':[[db[_0x04c6('0x48')]['fn'](_0x04c6('0x49'),db[_0x04c6('0x48')]['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')](_0x04c6('0x4b')))),_0x04c6('0x4c')],[db[_0x04c6('0x48')]['fn'](_0x04c6('0x49'),db['sequelize']['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')](_0x04c6('0x4d')))),_0x04c6('0x4e')],[db[_0x04c6('0x48')]['fn']('COUNT',db[_0x04c6('0x48')]['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')](_0x04c6('0x4f')))),_0x04c6('0x50')],[db[_0x04c6('0x48')]['fn'](_0x04c6('0x49'),db[_0x04c6('0x48')]['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db['sequelize']['fn']('COUNT',db[_0x04c6('0x48')]['fn']('IF',db['sequelize'][_0x04c6('0x4a')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x04c6('0x51')],[db[_0x04c6('0x48')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')](_0x04c6('0x52')))),_0x04c6('0x53')],[db['sequelize']['fn'](_0x04c6('0x49'),db[_0x04c6('0x48')]['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')](_0x04c6('0x54')))),_0x04c6('0x55')],[db[_0x04c6('0x48')]['fn']('COUNT',db[_0x04c6('0x48')]['fn']('IF',db['sequelize'][_0x04c6('0x4a')](_0x04c6('0x56')))),'answeringMachine']]})[_0x04c6('0x1f')](handleEntityNotFound(_0x489361,null))[_0x04c6('0x1f')](respondWithResult(_0x489361,null))[_0x04c6('0x3e')](handleError(_0x489361,null));};exports[_0x04c6('0x57')]=function(_0x28299e,_0x5b536f,_0xf073a8){return db[_0x04c6('0x27')]['findAll']({'raw':![],'where':{'CampaignId':_0x28299e[_0x04c6('0x46')]['id']},'attributes':[[db['sequelize']['fn'](_0x04c6('0x49'),db[_0x04c6('0x48')]['fn']('IF',db['sequelize']['literal'](_0x04c6('0x4b')))),'noSuchContacts'],[db[_0x04c6('0x48')]['fn'](_0x04c6('0x49'),db['sequelize']['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')](_0x04c6('0x4d')))),_0x04c6('0x4e')],[db[_0x04c6('0x48')]['fn'](_0x04c6('0x49'),db[_0x04c6('0x48')]['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')](_0x04c6('0x4f')))),_0x04c6('0x50')],[db['sequelize']['fn'](_0x04c6('0x49'),db[_0x04c6('0x48')]['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')]('`state`\x20=\x208,\x201,\x20null'))),_0x04c6('0x58')],[db[_0x04c6('0x48')]['fn'](_0x04c6('0x49'),db['sequelize']['fn']('IF',db['sequelize'][_0x04c6('0x4a')](_0x04c6('0x59')))),_0x04c6('0x51')],[db[_0x04c6('0x48')]['fn'](_0x04c6('0x49'),db[_0x04c6('0x48')]['fn']('IF',db['sequelize'][_0x04c6('0x4a')](_0x04c6('0x52')))),_0x04c6('0x53')],[db['sequelize']['fn']('COUNT',db[_0x04c6('0x48')]['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')](_0x04c6('0x54')))),'reCallContacts'],[db[_0x04c6('0x48')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x04c6('0x48')][_0x04c6('0x4a')](_0x04c6('0x56')))),_0x04c6('0x5a')]]})[_0x04c6('0x1f')](handleEntityNotFound(_0x5b536f,null))[_0x04c6('0x1f')](respondWithResult(_0x5b536f,null))[_0x04c6('0x3e')](handleError(_0x5b536f,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x31cc93,_0x1b6242,_0x1f5b9a){return db[_0x04c6('0x5b')][_0x04c6('0x41')]({'where':{'id':_0x31cc93['params']['id']}})['then'](handleEntityNotFound(_0x1b6242,null))[_0x04c6('0x1f')](function(_0x598941){var _0x2df63b;if(_0x598941){_0x2df63b=squel['insert']()[_0x04c6('0x5c')](_0x04c6('0x5d'))['fromQuery']([_0x04c6('0x5e'),_0x04c6('0x5f'),_0x04c6('0x60'),_0x04c6('0x61'),_0x04c6('0x62'),_0x04c6('0x63'),_0x04c6('0x64')],squel[_0x04c6('0x65')]()[_0x04c6('0x66')](_0x04c6('0x67'),_0x04c6('0x5e'))[_0x04c6('0x66')](_0x04c6('0x68'),'scheduledAt')[_0x04c6('0x66')](_0x04c6('0x69'),'ContactId')[_0x04c6('0x66')](_0x04c6('0x6a'),_0x04c6('0x61'))[_0x04c6('0x66')](_0x04c6('0x6b'),'VoiceQueueId')[_0x04c6('0x66')]('NOW()',_0x04c6('0x63'))['field'](_0x04c6('0x68'),_0x04c6('0x64'))[_0x04c6('0x6c')](_0x04c6('0x6d'))[_0x04c6('0x35')](_0x04c6('0x6e'),_0x31cc93[_0x04c6('0x46')]['id'][_0x04c6('0x6f')]())[_0x04c6('0x35')]('state\x20=\x20?',_0x31cc93[_0x04c6('0x45')][_0x04c6('0x70')]['toString']())[_0x04c6('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x04c6('0x35')](_0x04c6('0x71'),squel['select']()[_0x04c6('0x66')](_0x04c6('0x5e'))['from'](_0x04c6('0x5d'))[_0x04c6('0x35')]('VoiceQueueId\x20=\x20?',_0x31cc93[_0x04c6('0x46')]['id'][_0x04c6('0x6f')]()))['where'](_0x04c6('0x71'),squel[_0x04c6('0x65')]()['field']('calleridnum')['from'](_0x04c6('0x6d'))[_0x04c6('0x35')](_0x04c6('0x6e'),_0x31cc93[_0x04c6('0x46')]['id'][_0x04c6('0x6f')]())['where'](_0x04c6('0x72')))[_0x04c6('0x73')](_0x04c6('0x60')))[_0x04c6('0x6f')]();return db[_0x04c6('0x48')][_0x04c6('0x2b')](_0x2df63b);}return[];})[_0x04c6('0x1f')](respondWithResult(_0x1b6242,null))['catch'](handleError(_0x1b6242,null));};exports[_0x04c6('0x74')]=function(_0x4f258c,_0x202761,_0x480c74){return db['Campaign'][_0x04c6('0x41')]({'where':{'id':_0x4f258c['params']['id']}})[_0x04c6('0x1f')](handleEntityNotFound(_0x202761,null))[_0x04c6('0x1f')](function(_0x174de6){var _0x425d01;if(_0x174de6){_0x425d01=squel[_0x04c6('0x75')]()['into']('cm_hopper')[_0x04c6('0x76')]([_0x04c6('0x5e'),_0x04c6('0x5f'),_0x04c6('0x60'),_0x04c6('0x61'),_0x04c6('0x77'),'createdAt',_0x04c6('0x64')],squel['select']()['field'](_0x04c6('0x67'),_0x04c6('0x5e'))[_0x04c6('0x66')](_0x04c6('0x68'),_0x04c6('0x5f'))[_0x04c6('0x66')](_0x04c6('0x69'),_0x04c6('0x60'))[_0x04c6('0x66')](_0x04c6('0x6a'),_0x04c6('0x61'))['field'](_0x04c6('0x78'),'CampaignId')['field'](_0x04c6('0x68'),_0x04c6('0x63'))[_0x04c6('0x66')](_0x04c6('0x68'),_0x04c6('0x64'))[_0x04c6('0x6c')](_0x04c6('0x6d'))[_0x04c6('0x35')](_0x04c6('0x79'),_0x4f258c[_0x04c6('0x46')]['id'][_0x04c6('0x6f')]())['where']('state\x20=\x20?',_0x4f258c[_0x04c6('0x45')][_0x04c6('0x70')]['toString']())[_0x04c6('0x35')](_0x04c6('0x7a'))['where'](_0x04c6('0x71'),squel[_0x04c6('0x65')]()[_0x04c6('0x66')](_0x04c6('0x5e'))[_0x04c6('0x6c')](_0x04c6('0x5d'))[_0x04c6('0x35')](_0x04c6('0x79'),_0x4f258c['params']['id'][_0x04c6('0x6f')]()))['where'](_0x04c6('0x71'),squel[_0x04c6('0x65')]()[_0x04c6('0x66')](_0x04c6('0x7b'))[_0x04c6('0x6c')](_0x04c6('0x6d'))['where'](_0x04c6('0x79'),_0x4f258c[_0x04c6('0x46')]['id'][_0x04c6('0x6f')]())['where']('state\x20=\x204'))['group'](_0x04c6('0x60')))[_0x04c6('0x6f')]();return db['sequelize'][_0x04c6('0x2b')](_0x425d01);}return[];})[_0x04c6('0x1f')](respondWithResult(_0x202761,null))[_0x04c6('0x3e')](handleError(_0x202761,null));};exports['checkContactHopper']=function(_0x343c1f,_0x485457,_0x1c0c74){return db[_0x04c6('0x7c')][_0x04c6('0x7d')]({'where':{'VoiceQueueId':_0x343c1f['body']['VoiceQueueId'],'CampaignId':_0x343c1f[_0x04c6('0x45')][_0x04c6('0x77')],'ContactId':_0x343c1f[_0x04c6('0x45')][_0x04c6('0x60')]}})['then'](handleEntityNotFound(_0x485457,null))['then'](function(_0x3e12a4){if(_0x3e12a4){return _0x3e12a4;}return null;})[_0x04c6('0x1f')](respondWithResult(_0x485457,null))[_0x04c6('0x3e')](handleError(_0x485457,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index cdea724..aa09759 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 _0x1291=['moment','rimraf','define','CmHopperFinal','calleridnum','uniqueid','util','api'];(function(_0x5e73da,_0x2641a8){var _0x5646cb=function(_0x46f9e5){while(--_0x46f9e5){_0x5e73da['push'](_0x5e73da['shift']());}};_0x5646cb(++_0x2641a8);}(_0x1291,0x166));var _0x1129=function(_0x37fdb5,_0x1314c4){_0x37fdb5=_0x37fdb5-0x0;var _0x2f3eef=_0x1291[_0x37fdb5];return _0x2f3eef;};'use strict';var _=require('lodash');var util=require(_0x1129('0x0'));var logger=require('../../config/logger')(_0x1129('0x1'));var moment=require(_0x1129('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1129('0x3'));var config=require('../../config/environment');var attributes=require('./cmHopperFinal.attributes');module['exports']=function(_0x131f76,_0x706171){return _0x131f76[_0x1129('0x4')](_0x1129('0x5'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x1129('0x6'),'fields':[_0x1129('0x6')]},{'name':_0x1129('0x7'),'fields':[_0x1129('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6fb8=['rimraf','./cmHopperFinal.attributes','cm_hopper_final','calleridnum','uniqueid','lodash','api','bluebird','request-promise','path'];(function(_0x599ada,_0x5bc9be){var _0x2ff5d8=function(_0x5c00fd){while(--_0x5c00fd){_0x599ada['push'](_0x599ada['shift']());}};_0x2ff5d8(++_0x5bc9be);}(_0x6fb8,0x1ef));var _0x86fb=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x6fb8[_0x1a36a5];return _0x746243;};'use strict';var _=require(_0x86fb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x86fb('0x1'));var moment=require('moment');var BPromise=require(_0x86fb('0x2'));var rp=require(_0x86fb('0x3'));var fs=require('fs');var path=require(_0x86fb('0x4'));var rimraf=require(_0x86fb('0x5'));var config=require('../../config/environment');var attributes=require(_0x86fb('0x6'));module['exports']=function(_0x507483,_0x34368e){return _0x507483['define']('CmHopperFinal',attributes,{'tableName':_0x86fb('0x7'),'paranoid':![],'indexes':[{'name':_0x86fb('0x8'),'fields':['calleridnum']},{'name':_0x86fb('0x9'),'fields':[_0x86fb('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 0592b1e..f7286b7 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(_0x3de0ed,_0x1fe64d){var _0x2f9eb8=function(_0x272c5b){while(--_0x272c5b){_0x3de0ed['push'](_0x3de0ed['shift']());}};_0x2f9eb8(++_0x1fe64d);}(_0x7a54,0x106));var _0x47a5=function(_0x3a5c41,_0x583b06){_0x3a5c41=_0x3a5c41-0x0;var _0x296301=_0x7a54[_0x3a5c41];return _0x296301;};'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(_0x1e847b,_0x4c3d63){var _0x54dcb9=function(_0x28d568){while(--_0x28d568){_0x1e847b['push'](_0x1e847b['shift']());}};_0x54dcb9(++_0x4c3d63);}(_0xb10b,0x12a));var _0xbb10=function(_0x2c396c,_0x4db177){_0x2c396c=_0x2c396c-0x0;var _0x26219b=_0xb10b[_0x2c396c];return _0x26219b;};'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 c5b0376..2fa4194 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 _0x4698=['/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./cmHopperFinal.controller','isAuthenticated','get','/describe','describe','/:id','show','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post'];(function(_0x23eb8c,_0x5618e8){var _0x4978ba=function(_0x1512ed){while(--_0x1512ed){_0x23eb8c['push'](_0x23eb8c['shift']());}};_0x4978ba(++_0x5618e8);}(_0x4698,0x8a));var _0x8469=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x4698[_0x134c2e];return _0x2825db;};'use strict';var multer=require(_0x8469('0x0'));var util=require(_0x8469('0x1'));var path=require('path');var timeout=require(_0x8469('0x2'));var express=require(_0x8469('0x3'));var router=express[_0x8469('0x4')]();var fs_extra=require(_0x8469('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8469('0x6'));var config=require('../../config/environment');var controller=require(_0x8469('0x7'));router['get']('/',auth[_0x8469('0x8')](),controller['index']);router[_0x8469('0x9')](_0x8469('0xa'),auth[_0x8469('0x8')](),controller[_0x8469('0xb')]);router[_0x8469('0x9')](_0x8469('0xc'),auth[_0x8469('0x8')](),controller[_0x8469('0xd')]);router[_0x8469('0x9')]('/voice/queue/countAttributes/:id',auth[_0x8469('0x8')](),controller[_0x8469('0xe')]);router[_0x8469('0x9')](_0x8469('0xf'),auth[_0x8469('0x8')](),controller[_0x8469('0x10')]);router[_0x8469('0x11')](_0x8469('0x12'),auth['isAuthenticated'](),controller[_0x8469('0x13')]);router[_0x8469('0x11')](_0x8469('0x14'),auth[_0x8469('0x8')](),controller[_0x8469('0x15')]);router[_0x8469('0x11')](_0x8469('0x16'),auth['isAuthenticated'](),controller[_0x8469('0x17')]);router[_0x8469('0x18')](_0x8469('0xc'),auth[_0x8469('0x8')](),controller['update']);module[_0x8469('0x19')]=router; \ No newline at end of file +var _0xf590=['put','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','index','/describe','describe','isAuthenticated','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/checkContactHopper'];(function(_0xee489f,_0x2a3e2c){var _0xf98c5e=function(_0x5b4bff){while(--_0x5b4bff){_0xee489f['push'](_0xee489f['shift']());}};_0xf98c5e(++_0x2a3e2c);}(_0xf590,0x1e2));var _0x0f59=function(_0x5c080c,_0x31a668){_0x5c080c=_0x5c080c-0x0;var _0x211fd5=_0xf590[_0x5c080c];return _0x211fd5;};'use strict';var multer=require(_0x0f59('0x0'));var util=require('util');var path=require(_0x0f59('0x1'));var timeout=require('connect-timeout');var express=require(_0x0f59('0x2'));var router=express[_0x0f59('0x3')]();var fs_extra=require(_0x0f59('0x4'));var auth=require(_0x0f59('0x5'));var interaction=require(_0x0f59('0x6'));var config=require(_0x0f59('0x7'));var controller=require(_0x0f59('0x8'));router[_0x0f59('0x9')]('/',auth['isAuthenticated'](),controller[_0x0f59('0xa')]);router[_0x0f59('0x9')](_0x0f59('0xb'),auth['isAuthenticated'](),controller[_0x0f59('0xc')]);router[_0x0f59('0x9')]('/:id',auth[_0x0f59('0xd')](),controller[_0x0f59('0xe')]);router[_0x0f59('0x9')](_0x0f59('0xf'),auth['isAuthenticated'](),controller[_0x0f59('0x10')]);router[_0x0f59('0x9')](_0x0f59('0x11'),auth['isAuthenticated'](),controller['countContactsIvrCampaignHopperFinal']);router[_0x0f59('0x12')](_0x0f59('0x13'),auth[_0x0f59('0xd')](),controller[_0x0f59('0x14')]);router[_0x0f59('0x12')]('/voice/campaign/moveContacts/:id',auth['isAuthenticated'](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x0f59('0x12')](_0x0f59('0x15'),auth[_0x0f59('0xd')](),controller['checkContactHopper']);router[_0x0f59('0x16')]('/:id',auth[_0x0f59('0xd')](),controller['update']);module[_0x0f59('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index b5b706a..bfc1c6a 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 _0x7989=['DATE','BOOLEAN','INTEGER','STRING'];(function(_0x206338,_0x2d800b){var _0x2b87f2=function(_0x436c1c){while(--_0x436c1c){_0x206338['push'](_0x206338['shift']());}};_0x2b87f2(++_0x2d800b);}(_0x7989,0x82));var _0x9798=function(_0x595e7b,_0x32000d){_0x595e7b=_0x595e7b-0x0;var _0x330302=_0x7989[_0x595e7b];return _0x330302;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0x9798('0x0')](0x2)},'statedesc':{'type':Sequelize[_0x9798('0x1')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x9798('0x0')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9798('0x0')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x9798('0x0')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x9798('0x1')]},'originatecalleridnum':{'type':Sequelize[_0x9798('0x1')]},'originatecalleridname':{'type':Sequelize[_0x9798('0x1')]},'calleridnum':{'type':Sequelize[_0x9798('0x1')]},'calleridname':{'type':Sequelize[_0x9798('0x1')]},'starttime':{'type':Sequelize[_0x9798('0x2')]},'responsetime':{'type':Sequelize[_0x9798('0x2')]},'answertime':{'type':Sequelize[_0x9798('0x2')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x9798('0x2')]},'ringtime':{'type':Sequelize[_0x9798('0x0')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x9798('0x0')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x9798('0x1')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x9798('0x1')]},'membername':{'type':Sequelize[_0x9798('0x1')]},'reason':{'type':Sequelize[_0x9798('0x1')]},'amd':{'type':Sequelize[_0x9798('0x3')],'defaultValue':![]},'fax':{'type':Sequelize[_0x9798('0x3')],'defaultValue':![]},'callback':{'type':Sequelize[_0x9798('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x9798('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x9798('0x2')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x9798('0x2')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9798('0x0')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x9798('0x0')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9798('0x0')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9798('0x0')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xeab3=['exports','INTEGER','STRING','DATE','BOOLEAN','sequelize'];(function(_0x521ea8,_0x3dbeec){var _0x563c1c=function(_0x2b10e8){while(--_0x2b10e8){_0x521ea8['push'](_0x521ea8['shift']());}};_0x563c1c(++_0x3dbeec);}(_0xeab3,0x143));var _0x3eab=function(_0x109c40,_0x3463fa){_0x109c40=_0x109c40-0x0;var _0x3d5aed=_0xeab3[_0x109c40];return _0x3d5aed;};'use strict';var Sequelize=require(_0x3eab('0x0'));module[_0x3eab('0x1')]={'state':{'type':Sequelize[_0x3eab('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x3eab('0x3')]},'scheduledat':{'type':Sequelize[_0x3eab('0x4')]},'countbusyretry':{'type':Sequelize[_0x3eab('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x3eab('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x3eab('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x3eab('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x3eab('0x4')]},'answertime':{'type':Sequelize[_0x3eab('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x3eab('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x3eab('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x3eab('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x3eab('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x3eab('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x3eab('0x3')]},'reason':{'type':Sequelize[_0x3eab('0x3')]},'amd':{'type':Sequelize[_0x3eab('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x3eab('0x5')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x3eab('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x3eab('0x4')]},'edited':{'type':Sequelize[_0x3eab('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x3eab('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3eab('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3eab('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3eab('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3eab('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index f902fcf..2f9ff79 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 _0x7d85=['pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','rows','catch','keys','CmHopperHistory','create','body','describe','uniqueid','find','params','eml-format','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort'];(function(_0x20d7b2,_0x1cd564){var _0x483991=function(_0x1405b4){while(--_0x1405b4){_0x20d7b2['push'](_0x20d7b2['shift']());}};_0x483991(++_0x1cd564);}(_0x7d85,0xf7));var _0x57d8=function(_0x1c6abe,_0x5bedb0){_0x1c6abe=_0x1c6abe-0x0;var _0x546015=_0x7d85[_0x1c6abe];return _0x546015;};'use strict';var emlformat=require(_0x57d8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x57d8('0x1'));var moment=require(_0x57d8('0x2'));var BPromise=require(_0x57d8('0x3'));var Mustache=require(_0x57d8('0x4'));var util=require(_0x57d8('0x5'));var path=require(_0x57d8('0x6'));var sox=require(_0x57d8('0x7'));var csv=require(_0x57d8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x57d8('0x9'));var _=require('lodash');var squel=require(_0x57d8('0xa'));var crypto=require(_0x57d8('0xb'));var jsforce=require(_0x57d8('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x57d8('0xd'));var Redis=require(_0x57d8('0xe'));var authService=require(_0x57d8('0xf'));var qs=require(_0x57d8('0x10'));var as=require(_0x57d8('0x11'));var hardwareService=require(_0x57d8('0x12'));var logger=require(_0x57d8('0x13'))(_0x57d8('0x14'));var utils=require(_0x57d8('0x15'));var config=require(_0x57d8('0x16'));var licenseUtil=require(_0x57d8('0x17'));var db=require(_0x57d8('0x18'))['db'];function respondWithStatusCode(_0x5e02fd,_0x9dfdc3){_0x9dfdc3=_0x9dfdc3||0xcc;return function(_0x56a9b6){if(_0x56a9b6){return _0x5e02fd[_0x57d8('0x19')](_0x9dfdc3);}return _0x5e02fd[_0x57d8('0x1a')](_0x9dfdc3)[_0x57d8('0x1b')]();};}function respondWithResult(_0x523822,_0x471fa5){_0x471fa5=_0x471fa5||0xc8;return function(_0x3abca6){if(_0x3abca6){return _0x523822[_0x57d8('0x1a')](_0x471fa5)[_0x57d8('0x1c')](_0x3abca6);}};}function respondWithFilteredResult(_0x16a518,_0x5409ed){return function(_0x932eee){if(_0x932eee){var _0x11bf08=typeof _0x5409ed[_0x57d8('0x1d')]===_0x57d8('0x1e')&&typeof _0x5409ed[_0x57d8('0x1f')]===_0x57d8('0x1e');var _0x3d8f53=_0x932eee[_0x57d8('0x20')];var _0x298fd0=_0x11bf08?0x0:_0x5409ed['offset'];var _0x52dda7=_0x11bf08?_0x932eee[_0x57d8('0x20')]:_0x5409ed[_0x57d8('0x1d')]+_0x5409ed[_0x57d8('0x1f')];var _0x1c4fef;if(_0x52dda7>=_0x3d8f53){_0x52dda7=_0x3d8f53;_0x1c4fef=0xc8;}else{_0x1c4fef=0xce;}_0x16a518[_0x57d8('0x1a')](_0x1c4fef);return _0x16a518['set'](_0x57d8('0x21'),_0x298fd0+'-'+_0x52dda7+'/'+_0x3d8f53)[_0x57d8('0x1c')](_0x932eee);}return null;};}function patchUpdates(_0x35cc77){return function(_0x5eae6e){try{jsonpatch[_0x57d8('0x22')](_0x5eae6e,_0x35cc77,!![]);}catch(_0x334e6a){return BPromise['reject'](_0x334e6a);}return _0x5eae6e[_0x57d8('0x23')]();};}function saveUpdates(_0x1a6a66,_0x457fae){return function(_0x54a413){if(_0x54a413){return _0x54a413[_0x57d8('0x24')](_0x1a6a66)['then'](function(_0x2a8881){return _0x2a8881;});}return null;};}function removeEntity(_0x54453f,_0x573403){return function(_0x5de0e1){if(_0x5de0e1){return _0x5de0e1[_0x57d8('0x25')]()['then'](function(){_0x54453f[_0x57d8('0x1a')](0xcc)[_0x57d8('0x1b')]();});}};}function handleEntityNotFound(_0x5a97df,_0x43c2eb){return function(_0x54b118){if(!_0x54b118){_0x5a97df[_0x57d8('0x19')](0x194);}return _0x54b118;};}function handleError(_0x13683b,_0x2876bb){_0x2876bb=_0x2876bb||0x1f4;return function(_0x38ba2b){logger[_0x57d8('0x26')](_0x38ba2b[_0x57d8('0x27')]);if(_0x38ba2b['name']){delete _0x38ba2b[_0x57d8('0x28')];}_0x13683b[_0x57d8('0x1a')](_0x2876bb)[_0x57d8('0x29')](_0x38ba2b);};}exports['index']=function(_0x4e3382,_0x529768){var _0x1039c3={},_0x310203={},_0x445182={'count':0x0,'rows':[]};var _0x1ccad4=_[_0x57d8('0x2a')](db['CmHopperHistory'][_0x57d8('0x2b')],function(_0xcac314){return{'name':_0xcac314[_0x57d8('0x2c')],'type':_0xcac314[_0x57d8('0x2d')][_0x57d8('0x2e')]};});_0x310203['model']=_[_0x57d8('0x2a')](_0x1ccad4,'name');_0x310203[_0x57d8('0x2f')]=_['keys'](_0x4e3382['query']);_0x310203[_0x57d8('0x30')]=_[_0x57d8('0x31')](_0x310203['model'],_0x310203['query']);_0x1039c3[_0x57d8('0x32')]=_[_0x57d8('0x31')](_0x310203[_0x57d8('0x33')],qs[_0x57d8('0x34')](_0x4e3382[_0x57d8('0x2f')]['fields']));_0x1039c3[_0x57d8('0x32')]=_0x1039c3[_0x57d8('0x32')][_0x57d8('0x35')]?_0x1039c3[_0x57d8('0x32')]:_0x310203[_0x57d8('0x33')];if(!_0x4e3382['query'][_0x57d8('0x36')](_0x57d8('0x37'))){_0x1039c3[_0x57d8('0x1f')]=qs[_0x57d8('0x1f')](_0x4e3382[_0x57d8('0x2f')]['limit']);_0x1039c3[_0x57d8('0x1d')]=qs[_0x57d8('0x1d')](_0x4e3382[_0x57d8('0x2f')]['offset']);}_0x1039c3['order']=qs[_0x57d8('0x38')](_0x4e3382['query']['sort']);_0x1039c3['where']=qs[_0x57d8('0x30')](_[_0x57d8('0x39')](_0x4e3382[_0x57d8('0x2f')],_0x310203[_0x57d8('0x30')]),_0x1ccad4);if(_0x4e3382['query'][_0x57d8('0x3a')]){_0x1039c3[_0x57d8('0x3b')]=_[_0x57d8('0x3c')](_0x1039c3['where'],{'$or':_[_0x57d8('0x2a')](_0x1ccad4,function(_0x242a82){if(_0x242a82[_0x57d8('0x2d')]!==_0x57d8('0x3d')){var _0x1eab3d={};_0x1eab3d[_0x242a82[_0x57d8('0x28')]]={'$like':'%'+_0x4e3382['query'][_0x57d8('0x3a')]+'%'};return _0x1eab3d;}})});}_0x1039c3=_['merge']({},_0x1039c3,_0x4e3382[_0x57d8('0x3e')]);var _0x11b30a={'where':_0x1039c3['where']};return db['CmHopperHistory'][_0x57d8('0x20')](_0x11b30a)[_0x57d8('0x3f')](function(_0x1bfd18){_0x445182[_0x57d8('0x20')]=_0x1bfd18;if(_0x4e3382[_0x57d8('0x2f')][_0x57d8('0x40')]){_0x1039c3[_0x57d8('0x41')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x1039c3);})['then'](function(_0x1e7a95){_0x445182[_0x57d8('0x42')]=_0x1e7a95;return _0x445182;})[_0x57d8('0x3f')](respondWithFilteredResult(_0x529768,_0x1039c3))[_0x57d8('0x43')](handleError(_0x529768,null));};exports['show']=function(_0x4f3fe0,_0x3fc5fb){var _0x53eff8={'raw':!![],'where':{'id':_0x4f3fe0['params']['id']}},_0xc386={};_0xc386[_0x57d8('0x33')]=_[_0x57d8('0x44')](db[_0x57d8('0x45')][_0x57d8('0x2b')]);_0xc386[_0x57d8('0x2f')]=_['keys'](_0x4f3fe0[_0x57d8('0x2f')]);_0xc386[_0x57d8('0x30')]=_[_0x57d8('0x31')](_0xc386['model'],_0xc386[_0x57d8('0x2f')]);_0x53eff8[_0x57d8('0x32')]=_['intersection'](_0xc386[_0x57d8('0x33')],qs['fields'](_0x4f3fe0[_0x57d8('0x2f')]['fields']));_0x53eff8[_0x57d8('0x32')]=_0x53eff8['attributes'][_0x57d8('0x35')]?_0x53eff8[_0x57d8('0x32')]:_0xc386[_0x57d8('0x33')];if(_0x4f3fe0[_0x57d8('0x2f')][_0x57d8('0x40')]){_0x53eff8['include']=[{'all':!![]}];}_0x53eff8=_[_0x57d8('0x3c')]({},_0x53eff8,_0x4f3fe0[_0x57d8('0x3e')]);return db['CmHopperHistory']['find'](_0x53eff8)['then'](handleEntityNotFound(_0x3fc5fb,null))[_0x57d8('0x3f')](respondWithResult(_0x3fc5fb,null))['catch'](handleError(_0x3fc5fb,null));};exports[_0x57d8('0x46')]=function(_0xb5efe,_0x39f5fb){return db[_0x57d8('0x45')][_0x57d8('0x46')](_0xb5efe[_0x57d8('0x47')],{})['then'](respondWithResult(_0x39f5fb,0xc9))[_0x57d8('0x43')](handleError(_0x39f5fb,null));};exports[_0x57d8('0x48')]=function(_0x1b7d54,_0xe4e79f){return db[_0x57d8('0x45')][_0x57d8('0x48')]()['then'](respondWithResult(_0xe4e79f,null))[_0x57d8('0x43')](handleError(_0xe4e79f,null));};exports['update']=function(_0x249055,_0x59cc19){if(_0x249055[_0x57d8('0x47')][_0x57d8('0x49')]){delete _0x249055[_0x57d8('0x47')][_0x57d8('0x49')];}return db[_0x57d8('0x45')][_0x57d8('0x4a')]({'where':{'uniqueid':_0x249055[_0x57d8('0x4b')]['id']}})[_0x57d8('0x3f')](handleEntityNotFound(_0x59cc19,null))[_0x57d8('0x3f')](saveUpdates(_0x249055['body'],null))[_0x57d8('0x3f')](respondWithResult(_0x59cc19,null))[_0x57d8('0x43')](handleError(_0x59cc19,null));}; \ No newline at end of file +var _0xede2=['merge','VIRTUAL','options','CmHopperHistory','includeAll','include','catch','show','params','rawAttributes','find','create','body','uniqueid','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter'];(function(_0x1bf301,_0xda5c4c){var _0x51c947=function(_0x5196d5){while(--_0x5196d5){_0x1bf301['push'](_0x1bf301['shift']());}};_0x51c947(++_0xda5c4c);}(_0xede2,0x18f));var _0x2ede=function(_0x2ca926,_0x391c54){_0x2ca926=_0x2ca926-0x0;var _0x4c8e9c=_0xede2[_0x2ca926];return _0x4c8e9c;};'use strict';var emlformat=require(_0x2ede('0x0'));var rimraf=require(_0x2ede('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2ede('0x2'));var moment=require(_0x2ede('0x3'));var BPromise=require(_0x2ede('0x4'));var Mustache=require(_0x2ede('0x5'));var util=require(_0x2ede('0x6'));var path=require(_0x2ede('0x7'));var sox=require(_0x2ede('0x8'));var csv=require(_0x2ede('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2ede('0xa'));var _=require(_0x2ede('0xb'));var squel=require(_0x2ede('0xc'));var crypto=require(_0x2ede('0xd'));var jsforce=require(_0x2ede('0xe'));var deskjs=require(_0x2ede('0xf'));var toCsv=require(_0x2ede('0x9'));var querystring=require(_0x2ede('0x10'));var Papa=require(_0x2ede('0x11'));var Redis=require(_0x2ede('0x12'));var authService=require(_0x2ede('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2ede('0x14'));var hardwareService=require(_0x2ede('0x15'));var logger=require(_0x2ede('0x16'))(_0x2ede('0x17'));var utils=require(_0x2ede('0x18'));var config=require(_0x2ede('0x19'));var licenseUtil=require(_0x2ede('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44f78c,_0x22a541){_0x22a541=_0x22a541||0xcc;return function(_0x411cc5){if(_0x411cc5){return _0x44f78c[_0x2ede('0x1b')](_0x22a541);}return _0x44f78c[_0x2ede('0x1c')](_0x22a541)[_0x2ede('0x1d')]();};}function respondWithResult(_0x33da16,_0x290ea4){_0x290ea4=_0x290ea4||0xc8;return function(_0xf03a9b){if(_0xf03a9b){return _0x33da16[_0x2ede('0x1c')](_0x290ea4)['json'](_0xf03a9b);}};}function respondWithFilteredResult(_0x1cd16c,_0x53af02){return function(_0x5404e8){if(_0x5404e8){var _0x18f04e=typeof _0x53af02['offset']===_0x2ede('0x1e')&&typeof _0x53af02['limit']===_0x2ede('0x1e');var _0x17f8c5=_0x5404e8[_0x2ede('0x1f')];var _0x350bfe=_0x18f04e?0x0:_0x53af02['offset'];var _0x99408c=_0x18f04e?_0x5404e8[_0x2ede('0x1f')]:_0x53af02[_0x2ede('0x20')]+_0x53af02[_0x2ede('0x21')];var _0x8db27e;if(_0x99408c>=_0x17f8c5){_0x99408c=_0x17f8c5;_0x8db27e=0xc8;}else{_0x8db27e=0xce;}_0x1cd16c[_0x2ede('0x1c')](_0x8db27e);return _0x1cd16c[_0x2ede('0x22')](_0x2ede('0x23'),_0x350bfe+'-'+_0x99408c+'/'+_0x17f8c5)['json'](_0x5404e8);}return null;};}function patchUpdates(_0x1c877b){return function(_0x328707){try{jsonpatch[_0x2ede('0x24')](_0x328707,_0x1c877b,!![]);}catch(_0x3a486e){return BPromise['reject'](_0x3a486e);}return _0x328707[_0x2ede('0x25')]();};}function saveUpdates(_0x28f3a0,_0x3554d2){return function(_0x35433a){if(_0x35433a){return _0x35433a[_0x2ede('0x26')](_0x28f3a0)[_0x2ede('0x27')](function(_0x1a9722){return _0x1a9722;});}return null;};}function removeEntity(_0xab2a5d,_0x3e875b){return function(_0x3a77fd){if(_0x3a77fd){return _0x3a77fd[_0x2ede('0x28')]()[_0x2ede('0x27')](function(){_0xab2a5d['status'](0xcc)[_0x2ede('0x1d')]();});}};}function handleEntityNotFound(_0x5760f8,_0xbf6a1){return function(_0x4d3cef){if(!_0x4d3cef){_0x5760f8[_0x2ede('0x1b')](0x194);}return _0x4d3cef;};}function handleError(_0x54e47a,_0x1e9bd5){_0x1e9bd5=_0x1e9bd5||0x1f4;return function(_0x38a361){logger[_0x2ede('0x29')](_0x38a361[_0x2ede('0x2a')]);if(_0x38a361[_0x2ede('0x2b')]){delete _0x38a361[_0x2ede('0x2b')];}_0x54e47a['status'](_0x1e9bd5)[_0x2ede('0x2c')](_0x38a361);};}exports[_0x2ede('0x2d')]=function(_0x5f5a80,_0x10fbd7){var _0x4208b2={},_0x3a9166={},_0xba4c97={'count':0x0,'rows':[]};var _0x22fba8=_[_0x2ede('0x2e')](db['CmHopperHistory']['rawAttributes'],function(_0x581d69){return{'name':_0x581d69[_0x2ede('0x2f')],'type':_0x581d69['type'][_0x2ede('0x30')]};});_0x3a9166[_0x2ede('0x31')]=_[_0x2ede('0x2e')](_0x22fba8,_0x2ede('0x2b'));_0x3a9166[_0x2ede('0x32')]=_[_0x2ede('0x33')](_0x5f5a80['query']);_0x3a9166[_0x2ede('0x34')]=_[_0x2ede('0x35')](_0x3a9166[_0x2ede('0x31')],_0x3a9166[_0x2ede('0x32')]);_0x4208b2['attributes']=_['intersection'](_0x3a9166[_0x2ede('0x31')],qs[_0x2ede('0x36')](_0x5f5a80[_0x2ede('0x32')][_0x2ede('0x36')]));_0x4208b2[_0x2ede('0x37')]=_0x4208b2['attributes'][_0x2ede('0x38')]?_0x4208b2['attributes']:_0x3a9166[_0x2ede('0x31')];if(!_0x5f5a80[_0x2ede('0x32')][_0x2ede('0x39')](_0x2ede('0x3a'))){_0x4208b2[_0x2ede('0x21')]=qs[_0x2ede('0x21')](_0x5f5a80[_0x2ede('0x32')][_0x2ede('0x21')]);_0x4208b2[_0x2ede('0x20')]=qs[_0x2ede('0x20')](_0x5f5a80[_0x2ede('0x32')]['offset']);}_0x4208b2['order']=qs['sort'](_0x5f5a80['query'][_0x2ede('0x3b')]);_0x4208b2[_0x2ede('0x3c')]=qs['filters'](_[_0x2ede('0x3d')](_0x5f5a80['query'],_0x3a9166['filters']),_0x22fba8);if(_0x5f5a80[_0x2ede('0x32')][_0x2ede('0x3e')]){_0x4208b2[_0x2ede('0x3c')]=_[_0x2ede('0x3f')](_0x4208b2[_0x2ede('0x3c')],{'$or':_[_0x2ede('0x2e')](_0x22fba8,function(_0xfbaf14){if(_0xfbaf14['type']!==_0x2ede('0x40')){var _0x1f613d={};_0x1f613d[_0xfbaf14[_0x2ede('0x2b')]]={'$like':'%'+_0x5f5a80[_0x2ede('0x32')]['filter']+'%'};return _0x1f613d;}})});}_0x4208b2=_[_0x2ede('0x3f')]({},_0x4208b2,_0x5f5a80[_0x2ede('0x41')]);var _0x3053de={'where':_0x4208b2[_0x2ede('0x3c')]};return db[_0x2ede('0x42')][_0x2ede('0x1f')](_0x3053de)['then'](function(_0x234da1){_0xba4c97[_0x2ede('0x1f')]=_0x234da1;if(_0x5f5a80['query'][_0x2ede('0x43')]){_0x4208b2[_0x2ede('0x44')]=[{'all':!![]}];}return db[_0x2ede('0x42')]['findAll'](_0x4208b2);})['then'](function(_0x4e0433){_0xba4c97['rows']=_0x4e0433;return _0xba4c97;})[_0x2ede('0x27')](respondWithFilteredResult(_0x10fbd7,_0x4208b2))[_0x2ede('0x45')](handleError(_0x10fbd7,null));};exports[_0x2ede('0x46')]=function(_0x5a82ef,_0x378693){var _0x335c71={'raw':!![],'where':{'id':_0x5a82ef[_0x2ede('0x47')]['id']}},_0x5780ee={};_0x5780ee[_0x2ede('0x31')]=_[_0x2ede('0x33')](db[_0x2ede('0x42')][_0x2ede('0x48')]);_0x5780ee[_0x2ede('0x32')]=_[_0x2ede('0x33')](_0x5a82ef[_0x2ede('0x32')]);_0x5780ee[_0x2ede('0x34')]=_[_0x2ede('0x35')](_0x5780ee['model'],_0x5780ee[_0x2ede('0x32')]);_0x335c71['attributes']=_[_0x2ede('0x35')](_0x5780ee[_0x2ede('0x31')],qs['fields'](_0x5a82ef[_0x2ede('0x32')][_0x2ede('0x36')]));_0x335c71[_0x2ede('0x37')]=_0x335c71['attributes'][_0x2ede('0x38')]?_0x335c71[_0x2ede('0x37')]:_0x5780ee[_0x2ede('0x31')];if(_0x5a82ef[_0x2ede('0x32')][_0x2ede('0x43')]){_0x335c71[_0x2ede('0x44')]=[{'all':!![]}];}_0x335c71=_[_0x2ede('0x3f')]({},_0x335c71,_0x5a82ef[_0x2ede('0x41')]);return db[_0x2ede('0x42')][_0x2ede('0x49')](_0x335c71)[_0x2ede('0x27')](handleEntityNotFound(_0x378693,null))[_0x2ede('0x27')](respondWithResult(_0x378693,null))[_0x2ede('0x45')](handleError(_0x378693,null));};exports[_0x2ede('0x4a')]=function(_0x2ae8b1,_0x24a249){return db[_0x2ede('0x42')][_0x2ede('0x4a')](_0x2ae8b1[_0x2ede('0x4b')],{})[_0x2ede('0x27')](respondWithResult(_0x24a249,0xc9))[_0x2ede('0x45')](handleError(_0x24a249,null));};exports['describe']=function(_0x2eed32,_0x3dd67a){return db[_0x2ede('0x42')]['describe']()[_0x2ede('0x27')](respondWithResult(_0x3dd67a,null))[_0x2ede('0x45')](handleError(_0x3dd67a,null));};exports[_0x2ede('0x26')]=function(_0x445ea8,_0x3f20ad){if(_0x445ea8[_0x2ede('0x4b')][_0x2ede('0x4c')]){delete _0x445ea8[_0x2ede('0x4b')][_0x2ede('0x4c')];}return db[_0x2ede('0x42')][_0x2ede('0x49')]({'where':{'uniqueid':_0x445ea8[_0x2ede('0x47')]['id']}})[_0x2ede('0x27')](handleEntityNotFound(_0x3f20ad,null))['then'](saveUpdates(_0x445ea8[_0x2ede('0x4b')],null))[_0x2ede('0x27')](respondWithResult(_0x3f20ad,null))['catch'](handleError(_0x3f20ad,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 5427f01..215e4c0 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 _0x7374=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','define','CmHopperHistory','endtime','uniqueid','lodash'];(function(_0x5c2e65,_0x20e630){var _0x445359=function(_0x2588d4){while(--_0x2588d4){_0x5c2e65['push'](_0x5c2e65['shift']());}};_0x445359(++_0x20e630);}(_0x7374,0x1b9));var _0x4737=function(_0x2af077,_0x1df2ce){_0x2af077=_0x2af077-0x0;var _0x128d43=_0x7374[_0x2af077];return _0x128d43;};'use strict';var _=require(_0x4737('0x0'));var util=require(_0x4737('0x1'));var logger=require(_0x4737('0x2'))(_0x4737('0x3'));var moment=require(_0x4737('0x4'));var BPromise=require('bluebird');var rp=require(_0x4737('0x5'));var fs=require('fs');var path=require(_0x4737('0x6'));var rimraf=require(_0x4737('0x7'));var config=require(_0x4737('0x8'));var attributes=require('./cmHopperHistory.attributes');module['exports']=function(_0x162bf0,_0xc35930){return _0x162bf0[_0x4737('0x9')](_0x4737('0xa'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x4737('0xb'),'fields':[_0x4737('0xb')]},{'name':_0x4737('0xc'),'fields':[_0x4737('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa848=['rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x3bd27b,_0x43b9b3){var _0x526f08=function(_0x5b543b){while(--_0x5b543b){_0x3bd27b['push'](_0x3bd27b['shift']());}};_0x526f08(++_0x43b9b3);}(_0xa848,0x99));var _0x8a84=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xa848[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x8a84('0x0'));var util=require(_0x8a84('0x1'));var logger=require(_0x8a84('0x2'))('api');var moment=require(_0x8a84('0x3'));var BPromise=require(_0x8a84('0x4'));var rp=require(_0x8a84('0x5'));var fs=require('fs');var path=require(_0x8a84('0x6'));var rimraf=require(_0x8a84('0x7'));var config=require(_0x8a84('0x8'));var attributes=require(_0x8a84('0x9'));module[_0x8a84('0xa')]=function(_0x13acad,_0x3ee596){return _0x13acad[_0x8a84('0xb')](_0x8a84('0xc'),attributes,{'tableName':_0x8a84('0xd'),'paranoid':![],'indexes':[{'name':_0x8a84('0xe'),'fields':['endtime']},{'name':_0x8a84('0xf'),'fields':[_0x8a84('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index e8b02cf..b7fea32 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 _0x3238=['info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateCmHopperHistory','CmHopperHistory','body','options','raw','catch','AvgHandleTime','findAll','where','sequelize','col','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','campaign','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then'];(function(_0x3af289,_0x47a430){var _0x51a5fe=function(_0x1edcd7){while(--_0x1edcd7){_0x3af289['push'](_0x3af289['shift']());}};_0x51a5fe(++_0x47a430);}(_0x3238,0x13e));var _0x8323=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3238[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x8323('0x0'));var util=require('util');var moment=require(_0x8323('0x1'));var BPromise=require(_0x8323('0x2'));var rs=require(_0x8323('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8323('0x4'))['db'];var utils=require(_0x8323('0x5'));var logger=require(_0x8323('0x6'))(_0x8323('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8323('0x8')][_0x8323('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40b1f0,_0x14b3b5,_0x4ddf1f){return new BPromise(function(_0x232f4b,_0x5950e2){return client[_0x8323('0xa')](_0x40b1f0,_0x4ddf1f)[_0x8323('0xb')](function(_0x1577a6){logger[_0x8323('0xc')](_0x8323('0xd'),_0x14b3b5,_0x8323('0xe'));logger[_0x8323('0xf')](_0x8323('0x10'),_0x14b3b5,'request\x20sent',JSON[_0x8323('0x11')](_0x1577a6));if(_0x1577a6[_0x8323('0x12')]){if(_0x1577a6[_0x8323('0x12')]['code']===0x1f4){logger[_0x8323('0x12')](_0x8323('0xd'),_0x14b3b5,_0x1577a6[_0x8323('0x12')][_0x8323('0x13')]);return _0x5950e2(_0x1577a6[_0x8323('0x12')][_0x8323('0x13')]);}logger[_0x8323('0x12')](_0x8323('0xd'),_0x14b3b5,_0x1577a6[_0x8323('0x12')][_0x8323('0x13')]);return _0x232f4b(_0x1577a6[_0x8323('0x12')][_0x8323('0x13')]);}else{logger[_0x8323('0xc')](_0x8323('0xd'),_0x14b3b5,'request\x20sent');_0x232f4b(_0x1577a6[_0x8323('0x14')][_0x8323('0x13')]);}})['catch'](function(_0x320e7f){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x14b3b5,_0x320e7f);_0x5950e2(_0x320e7f);});});}exports[_0x8323('0x15')]=function(_0x3bb436){var _0x2bb7c5=this;return new Promise(function(_0x46a42c,_0x3b3ba9){return db[_0x8323('0x16')]['create'](_0x3bb436[_0x8323('0x17')],{'raw':_0x3bb436['options']?_0x3bb436[_0x8323('0x18')][_0x8323('0x19')]===undefined?!![]:![]:!![]})[_0x8323('0xb')](function(_0x4d1ef3){logger[_0x8323('0xc')]('CreateCmHopperHistory',_0x3bb436);logger['debug'](_0x8323('0x15'),_0x3bb436,JSON[_0x8323('0x11')](_0x4d1ef3));_0x46a42c(_0x4d1ef3);})[_0x8323('0x1a')](function(_0x49fdb1){logger['error'](_0x8323('0x15'),_0x49fdb1[_0x8323('0x13')],_0x3bb436);_0x3b3ba9(_0x2bb7c5[_0x8323('0x12')](0x1f4,_0x49fdb1[_0x8323('0x13')]));});});};exports[_0x8323('0x1b')]=function(_0x372ce6){var _0x3185d3=this;return new Promise(function(_0xe839b3,_0x2ded41){return db['CmHopperHistory'][_0x8323('0x1c')]({'raw':_0x372ce6['options']?_0x372ce6['options']['raw']===undefined?!![]:![]:!![],'where':_0x372ce6[_0x8323('0x18')]?_0x372ce6[_0x8323('0x18')][_0x8323('0x1d')]||null:null,'attributes':[[db[_0x8323('0x1e')]['fn']('COUNT',db[_0x8323('0x1e')][_0x8323('0x1f')]('id')),'predictiveIntervalTotalCalls'],[db[_0x8323('0x1e')]['fn'](_0x8323('0x20'),db[_0x8323('0x1e')]['fn']('IF',db[_0x8323('0x1e')][_0x8323('0x21')](_0x8323('0x22')))),_0x8323('0x23')],[db['sequelize']['fn'](_0x8323('0x20'),db[_0x8323('0x1e')]['fn']('IF',db['sequelize'][_0x8323('0x21')](_0x8323('0x24')))),_0x8323('0x25')],[db[_0x8323('0x1e')]['fn'](_0x8323('0x20'),db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011,\x201,\x20null'))),_0x8323('0x26')],[db[_0x8323('0x1e')]['fn'](_0x8323('0x27'),db['sequelize']['fn']('IF',db['sequelize'][_0x8323('0x21')](_0x8323('0x28')))),_0x8323('0x29')],[db[_0x8323('0x1e')]['fn'](_0x8323('0x27'),db[_0x8323('0x1e')]['fn']('IF',db[_0x8323('0x1e')]['literal'](_0x8323('0x2a')))),_0x8323('0x2b')]]})['then'](function(_0x20a582){logger[_0x8323('0xc')](_0x8323('0x1b'),_0x372ce6);logger[_0x8323('0xf')](_0x8323('0x1b'),_0x372ce6,JSON[_0x8323('0x11')](_0x20a582));_0xe839b3(_0x20a582);})[_0x8323('0x1a')](function(_0x52b01b){logger[_0x8323('0x12')](_0x8323('0x1b'),_0x52b01b[_0x8323('0x13')],_0x372ce6);_0x2ded41(_0x3185d3[_0x8323('0x12')](0x1f4,_0x52b01b[_0x8323('0x13')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x580d06){var _0x41efea=this;return new Promise(function(_0x2d6c39,_0xada275){return db[_0x8323('0x16')][_0x8323('0x1c')]({'raw':_0x580d06[_0x8323('0x18')]?_0x580d06['options'][_0x8323('0x19')]===undefined?!![]:![]:!![],'where':_0x580d06[_0x8323('0x18')]?_0x580d06['options'][_0x8323('0x1d')]||null:null,'attributes':[[_0x8323('0x2c'),_0x8323('0x2d')],[db[_0x8323('0x1e')]['fn'](_0x8323('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0x8323('0x21')](_0x8323('0x2e')))),'outboundNoSuchCallsDay'],[db[_0x8323('0x1e')]['fn'](_0x8323('0x20'),db[_0x8323('0x1e')]['fn']('IF',db[_0x8323('0x1e')][_0x8323('0x21')](_0x8323('0x2f')))),_0x8323('0x30')],[db['sequelize']['fn'](_0x8323('0x20'),db[_0x8323('0x1e')]['fn']('IF',db[_0x8323('0x1e')][_0x8323('0x21')]('`state`\x20=\x204,\x201,\x20null'))),_0x8323('0x31')],[db[_0x8323('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x8323('0x1e')][_0x8323('0x21')](_0x8323('0x32')))),_0x8323('0x33')],[db[_0x8323('0x1e')]['fn']('COUNT',db[_0x8323('0x1e')]['fn']('IF',db[_0x8323('0x1e')][_0x8323('0x21')](_0x8323('0x34')))),'outboundCongestionCallsDay'],[db[_0x8323('0x1e')]['fn'](_0x8323('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0x8323('0x21')]('`state`\x20=\x2010\x20,\x201,\x20null'))),'outboundDropCallsDayTimeout'],[db[_0x8323('0x1e')]['fn']('COUNT',db[_0x8323('0x1e')]['fn']('IF',db['sequelize'][_0x8323('0x21')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'outboundDropCallsDayCallersExit'],[db[_0x8323('0x1e')]['fn'](_0x8323('0x20'),db[_0x8323('0x1e')]['fn']('IF',db[_0x8323('0x1e')][_0x8323('0x21')](_0x8323('0x35')))),_0x8323('0x36')],[db[_0x8323('0x1e')]['fn'](_0x8323('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0x8323('0x21')](_0x8323('0x37')))),_0x8323('0x38')],[db[_0x8323('0x1e')]['fn'](_0x8323('0x20'),db[_0x8323('0x1e')]['fn']('IF',db[_0x8323('0x1e')]['literal'](_0x8323('0x39')))),'outboundOriginateFailureCallsDay'],[db[_0x8323('0x1e')]['fn']('COUNT',db[_0x8323('0x1e')]['fn']('IF',db[_0x8323('0x1e')][_0x8323('0x21')](_0x8323('0x3a')))),_0x8323('0x3b')],[db[_0x8323('0x1e')]['fn'](_0x8323('0x20'),db[_0x8323('0x1e')]['fn']('IF',db['sequelize']['literal'](_0x8323('0x3c')))),'outboundAnswerAgiCallsDay'],[db[_0x8323('0x1e')]['fn']('COUNT',db[_0x8323('0x1e')]['fn']('IF',db[_0x8323('0x1e')][_0x8323('0x21')](_0x8323('0x3d')))),'outboundRejectCallsDay'],[db[_0x8323('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),'outboundReCallsDay']],'group':[_0x8323('0x2c')]})[_0x8323('0xb')](function(_0x16b073){logger[_0x8323('0xc')](_0x8323('0x3e'),_0x580d06);logger[_0x8323('0xf')](_0x8323('0x3e'),_0x580d06,JSON[_0x8323('0x11')](_0x16b073));_0x2d6c39(_0x16b073);})[_0x8323('0x1a')](function(_0x14d0b1){logger[_0x8323('0x12')](_0x8323('0x3e'),_0x14d0b1[_0x8323('0x13')],_0x580d06);_0xada275(_0x41efea['error'](0x1f4,_0x14d0b1[_0x8323('0x13')]));});});};exports[_0x8323('0x3f')]=function(_0x20637e){var _0xa10750=this;return new Promise(function(_0x3b37ca,_0xd6f24){return db['CmHopperHistory']['findAll']({'raw':_0x20637e['options']?_0x20637e['options']['raw']===undefined?!![]:![]:!![],'where':_0x20637e[_0x8323('0x18')]?_0x20637e[_0x8323('0x18')][_0x8323('0x1d')]||null:null,'attributes':[[_0x8323('0x2c'),'name'],[db[_0x8323('0x1e')]['fn']('COUNT',db[_0x8323('0x1e')][_0x8323('0x1f')]('id')),_0x8323('0x40')],[db[_0x8323('0x1e')]['fn'](_0x8323('0x20'),db[_0x8323('0x1e')]['fn']('IF',db[_0x8323('0x1e')][_0x8323('0x21')](_0x8323('0x22')))),_0x8323('0x41')]],'group':['campaign']})[_0x8323('0xb')](function(_0x46cf89){logger[_0x8323('0xc')](_0x8323('0x3f'),_0x20637e);logger[_0x8323('0xf')](_0x8323('0x3f'),_0x20637e,JSON[_0x8323('0x11')](_0x46cf89));_0x3b37ca(_0x46cf89);})[_0x8323('0x1a')](function(_0x1a8a0c){logger['error'](_0x8323('0x3f'),_0x1a8a0c['message'],_0x20637e);_0xd6f24(_0xa10750[_0x8323('0x12')](0x1f4,_0x1a8a0c['message']));});});}; \ No newline at end of file +var _0x42cb=['`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','catch','CmHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\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','ivrAnswerCallsDay','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateCmHopperHistory','body','options','raw','AvgHandleTime','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG'];(function(_0x5619c3,_0x1953c2){var _0x5ce87b=function(_0x3da113){while(--_0x3da113){_0x5619c3['push'](_0x5619c3['shift']());}};_0x5ce87b(++_0x1953c2);}(_0x42cb,0x178));var _0xb42c=function(_0x2dba09,_0x4ef795){_0x2dba09=_0x2dba09-0x0;var _0x4792cf=_0x42cb[_0x2dba09];return _0x4792cf;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb42c('0x0'));var BPromise=require('bluebird');var rs=require(_0xb42c('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb42c('0x2'))['db'];var utils=require(_0xb42c('0x3'));var logger=require(_0xb42c('0x4'))(_0xb42c('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb42c('0x6')][_0xb42c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x14745c,_0x2a3b82,_0x26aa7d){return new BPromise(function(_0x24ddae,_0x3c0806){return client[_0xb42c('0x8')](_0x14745c,_0x26aa7d)[_0xb42c('0x9')](function(_0x930733){logger[_0xb42c('0xa')](_0xb42c('0xb'),_0x2a3b82,_0xb42c('0xc'));logger[_0xb42c('0xd')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x2a3b82,_0xb42c('0xc'),JSON[_0xb42c('0xe')](_0x930733));if(_0x930733[_0xb42c('0xf')]){if(_0x930733[_0xb42c('0xf')][_0xb42c('0x10')]===0x1f4){logger[_0xb42c('0xf')](_0xb42c('0xb'),_0x2a3b82,_0x930733[_0xb42c('0xf')]['message']);return _0x3c0806(_0x930733[_0xb42c('0xf')][_0xb42c('0x11')]);}logger[_0xb42c('0xf')](_0xb42c('0xb'),_0x2a3b82,_0x930733[_0xb42c('0xf')][_0xb42c('0x11')]);return _0x24ddae(_0x930733['error'][_0xb42c('0x11')]);}else{logger[_0xb42c('0xa')](_0xb42c('0xb'),_0x2a3b82,'request\x20sent');_0x24ddae(_0x930733[_0xb42c('0x12')][_0xb42c('0x11')]);}})['catch'](function(_0x313fd1){logger['error'](_0xb42c('0xb'),_0x2a3b82,_0x313fd1);_0x3c0806(_0x313fd1);});});}exports[_0xb42c('0x13')]=function(_0x4f0d01){var _0x31c530=this;return new Promise(function(_0x526194,_0x12ff6e){return db['CmHopperHistory']['create'](_0x4f0d01[_0xb42c('0x14')],{'raw':_0x4f0d01[_0xb42c('0x15')]?_0x4f0d01[_0xb42c('0x15')][_0xb42c('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x123b94){logger[_0xb42c('0xa')](_0xb42c('0x13'),_0x4f0d01);logger[_0xb42c('0xd')](_0xb42c('0x13'),_0x4f0d01,JSON[_0xb42c('0xe')](_0x123b94));_0x526194(_0x123b94);})['catch'](function(_0x2c02e2){logger[_0xb42c('0xf')](_0xb42c('0x13'),_0x2c02e2[_0xb42c('0x11')],_0x4f0d01);_0x12ff6e(_0x31c530['error'](0x1f4,_0x2c02e2['message']));});});};exports[_0xb42c('0x17')]=function(_0x3f6d6a){var _0x38919b=this;return new Promise(function(_0x3a12b2,_0x5880b8){return db['CmHopperHistory'][_0xb42c('0x18')]({'raw':_0x3f6d6a[_0xb42c('0x15')]?_0x3f6d6a[_0xb42c('0x15')][_0xb42c('0x16')]===undefined?!![]:![]:!![],'where':_0x3f6d6a[_0xb42c('0x15')]?_0x3f6d6a[_0xb42c('0x15')][_0xb42c('0x19')]||null:null,'attributes':[[db[_0xb42c('0x1a')]['fn'](_0xb42c('0x1b'),db[_0xb42c('0x1a')][_0xb42c('0x1c')]('id')),_0xb42c('0x1d')],[db[_0xb42c('0x1a')]['fn']('COUNT',db[_0xb42c('0x1a')]['fn']('IF',db['sequelize'][_0xb42c('0x1e')](_0xb42c('0x1f')))),_0xb42c('0x20')],[db['sequelize']['fn'](_0xb42c('0x1b'),db[_0xb42c('0x1a')]['fn']('IF',db[_0xb42c('0x1a')]['literal'](_0xb42c('0x21')))),_0xb42c('0x22')],[db[_0xb42c('0x1a')]['fn'](_0xb42c('0x1b'),db[_0xb42c('0x1a')]['fn']('IF',db[_0xb42c('0x1a')][_0xb42c('0x1e')](_0xb42c('0x23')))),_0xb42c('0x24')],[db[_0xb42c('0x1a')]['fn'](_0xb42c('0x25'),db[_0xb42c('0x1a')]['fn']('IF',db[_0xb42c('0x1a')][_0xb42c('0x1e')](_0xb42c('0x26')))),_0xb42c('0x27')],[db[_0xb42c('0x1a')]['fn']('AVG',db['sequelize']['fn']('IF',db['sequelize'][_0xb42c('0x1e')](_0xb42c('0x28')))),'predictiveIntervalAvgTalktime']]})[_0xb42c('0x9')](function(_0x1722ac){logger[_0xb42c('0xa')](_0xb42c('0x17'),_0x3f6d6a);logger[_0xb42c('0xd')](_0xb42c('0x17'),_0x3f6d6a,JSON[_0xb42c('0xe')](_0x1722ac));_0x3a12b2(_0x1722ac);})[_0xb42c('0x29')](function(_0x29e9ee){logger[_0xb42c('0xf')]('AvgHandleTime',_0x29e9ee['message'],_0x3f6d6a);_0x5880b8(_0x38919b[_0xb42c('0xf')](0x1f4,_0x29e9ee[_0xb42c('0x11')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x58425e){var _0x59e722=this;return new Promise(function(_0x21e2b2,_0x365f6b){return db[_0xb42c('0x2a')][_0xb42c('0x18')]({'raw':_0x58425e[_0xb42c('0x15')]?_0x58425e[_0xb42c('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x58425e[_0xb42c('0x15')]?_0x58425e[_0xb42c('0x15')][_0xb42c('0x19')]||null:null,'attributes':[[_0xb42c('0x2b'),_0xb42c('0x2c')],[db[_0xb42c('0x1a')]['fn'](_0xb42c('0x1b'),db[_0xb42c('0x1a')]['fn']('IF',db[_0xb42c('0x1a')][_0xb42c('0x1e')](_0xb42c('0x2d')))),'outboundNoSuchCallsDay'],[db[_0xb42c('0x1a')]['fn'](_0xb42c('0x1b'),db[_0xb42c('0x1a')]['fn']('IF',db[_0xb42c('0x1a')][_0xb42c('0x1e')](_0xb42c('0x2e')))),_0xb42c('0x2f')],[db[_0xb42c('0x1a')]['fn'](_0xb42c('0x1b'),db[_0xb42c('0x1a')]['fn']('IF',db[_0xb42c('0x1a')][_0xb42c('0x1e')](_0xb42c('0x1f')))),'outboundAnswerCallsDay'],[db[_0xb42c('0x1a')]['fn'](_0xb42c('0x1b'),db[_0xb42c('0x1a')]['fn']('IF',db[_0xb42c('0x1a')][_0xb42c('0x1e')](_0xb42c('0x30')))),_0xb42c('0x31')],[db['sequelize']['fn'](_0xb42c('0x1b'),db[_0xb42c('0x1a')]['fn']('IF',db['sequelize'][_0xb42c('0x1e')]('`state`\x20=\x208,\x201,\x20null'))),_0xb42c('0x32')],[db[_0xb42c('0x1a')]['fn'](_0xb42c('0x1b'),db[_0xb42c('0x1a')]['fn']('IF',db[_0xb42c('0x1a')][_0xb42c('0x1e')](_0xb42c('0x33')))),_0xb42c('0x34')],[db[_0xb42c('0x1a')]['fn']('COUNT',db[_0xb42c('0x1a')]['fn']('IF',db[_0xb42c('0x1a')][_0xb42c('0x1e')](_0xb42c('0x35')))),_0xb42c('0x36')],[db[_0xb42c('0x1a')]['fn'](_0xb42c('0x1b'),db['sequelize']['fn']('IF',db[_0xb42c('0x1a')][_0xb42c('0x1e')](_0xb42c('0x37')))),_0xb42c('0x38')],[db[_0xb42c('0x1a')]['fn'](_0xb42c('0x1b'),db[_0xb42c('0x1a')]['fn']('IF',db[_0xb42c('0x1a')]['literal'](_0xb42c('0x39')))),_0xb42c('0x3a')],[db[_0xb42c('0x1a')]['fn'](_0xb42c('0x1b'),db[_0xb42c('0x1a')]['fn']('IF',db[_0xb42c('0x1a')][_0xb42c('0x1e')](_0xb42c('0x3b')))),_0xb42c('0x3c')],[db[_0xb42c('0x1a')]['fn'](_0xb42c('0x1b'),db[_0xb42c('0x1a')]['fn']('IF',db['sequelize'][_0xb42c('0x1e')](_0xb42c('0x3d')))),'outboundRejectCallsDay'],[db[_0xb42c('0x1a')]['fn']('COUNT',db[_0xb42c('0x1a')]['fn']('IF',db[_0xb42c('0x1a')][_0xb42c('0x1e')](_0xb42c('0x3e')))),'outboundAnswerAgiCallsDay'],[db[_0xb42c('0x1a')]['fn'](_0xb42c('0x1b'),db[_0xb42c('0x1a')]['fn']('IF',db[_0xb42c('0x1a')][_0xb42c('0x1e')](_0xb42c('0x3f')))),'outboundRejectCallsDay'],[db['sequelize']['fn'](_0xb42c('0x1b'),db['sequelize']['fn']('IF',db[_0xb42c('0x1a')][_0xb42c('0x1e')](_0xb42c('0x40')))),_0xb42c('0x41')]],'group':[_0xb42c('0x2b')]})['then'](function(_0x26671e){logger[_0xb42c('0xa')](_0xb42c('0x42'),_0x58425e);logger['debug'](_0xb42c('0x42'),_0x58425e,JSON['stringify'](_0x26671e));_0x21e2b2(_0x26671e);})[_0xb42c('0x29')](function(_0x153c48){logger['error']('GetVoiceQueueHopperHistory',_0x153c48[_0xb42c('0x11')],_0x58425e);_0x365f6b(_0x59e722['error'](0x1f4,_0x153c48[_0xb42c('0x11')]));});});};exports[_0xb42c('0x43')]=function(_0x1079ed){var _0x52193a=this;return new Promise(function(_0x2de97d,_0x417f01){return db[_0xb42c('0x2a')][_0xb42c('0x18')]({'raw':_0x1079ed[_0xb42c('0x15')]?_0x1079ed['options'][_0xb42c('0x16')]===undefined?!![]:![]:!![],'where':_0x1079ed[_0xb42c('0x15')]?_0x1079ed[_0xb42c('0x15')][_0xb42c('0x19')]||null:null,'attributes':[[_0xb42c('0x2b'),_0xb42c('0x2c')],[db[_0xb42c('0x1a')]['fn'](_0xb42c('0x1b'),db[_0xb42c('0x1a')][_0xb42c('0x1c')]('id')),'ivrTotalCallsDays'],[db['sequelize']['fn']('COUNT',db[_0xb42c('0x1a')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x204,\x201,\x20null'))),_0xb42c('0x44')]],'group':['campaign']})[_0xb42c('0x9')](function(_0x51a84a){logger[_0xb42c('0xa')](_0xb42c('0x43'),_0x1079ed);logger[_0xb42c('0xd')](_0xb42c('0x43'),_0x1079ed,JSON[_0xb42c('0xe')](_0x51a84a));_0x2de97d(_0x51a84a);})[_0xb42c('0x29')](function(_0x2e7fa2){logger['error'](_0xb42c('0x43'),_0x2e7fa2[_0xb42c('0x11')],_0x1079ed);_0x417f01(_0x52193a[_0xb42c('0xf')](0x1f4,_0x2e7fa2[_0xb42c('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index ec5ec6b..06424e6 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 _0x0f80=['../../components/interaction/service','./cmHopperHistory.controller','get','isAuthenticated','index','show','post','create','/:id','update','exports','connect-timeout','Router','fs-extra'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x0f80,0xc1));var _0x00f8=function(_0x7031a3,_0x256857){_0x7031a3=_0x7031a3-0x0;var _0x260eaa=_0x0f80[_0x7031a3];return _0x260eaa;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x00f8('0x0'));var express=require('express');var router=express[_0x00f8('0x1')]();var fs_extra=require(_0x00f8('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x00f8('0x3'));var config=require('../../config/environment');var controller=require(_0x00f8('0x4'));router[_0x00f8('0x5')]('/',auth[_0x00f8('0x6')](),controller[_0x00f8('0x7')]);router[_0x00f8('0x5')]('/describe',auth[_0x00f8('0x6')](),controller['describe']);router[_0x00f8('0x5')]('/:id',auth['isAuthenticated'](),controller[_0x00f8('0x8')]);router[_0x00f8('0x9')]('/',auth[_0x00f8('0x6')](),controller[_0x00f8('0xa')]);router['put'](_0x00f8('0xb'),auth['isAuthenticated'](),controller[_0x00f8('0xc')]);module[_0x00f8('0xd')]=router; \ No newline at end of file +var _0xb12e=['./cmHopperHistory.controller','isAuthenticated','index','get','/describe','describe','show','post','put','update','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x41e40f,_0x1ebd33){var _0x318358=function(_0x5e84de){while(--_0x5e84de){_0x41e40f['push'](_0x41e40f['shift']());}};_0x318358(++_0x1ebd33);}(_0xb12e,0xac));var _0xeb12=function(_0x519d55,_0x522bd3){_0x519d55=_0x519d55-0x0;var _0x49a5e2=_0xb12e[_0x519d55];return _0x49a5e2;};'use strict';var multer=require(_0xeb12('0x0'));var util=require('util');var path=require(_0xeb12('0x1'));var timeout=require(_0xeb12('0x2'));var express=require(_0xeb12('0x3'));var router=express[_0xeb12('0x4')]();var fs_extra=require(_0xeb12('0x5'));var auth=require(_0xeb12('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xeb12('0x7'));var controller=require(_0xeb12('0x8'));router['get']('/',auth[_0xeb12('0x9')](),controller[_0xeb12('0xa')]);router[_0xeb12('0xb')](_0xeb12('0xc'),auth[_0xeb12('0x9')](),controller[_0xeb12('0xd')]);router[_0xeb12('0xb')]('/:id',auth[_0xeb12('0x9')](),controller[_0xeb12('0xe')]);router[_0xeb12('0xf')]('/',auth[_0xeb12('0x9')](),controller['create']);router[_0xeb12('0x10')]('/:id',auth[_0xeb12('0x9')](),controller[_0xeb12('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 60ef92c..dc41536 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 _0x2fda=['sequelize','name','STRING'];(function(_0x933ec2,_0x5c29ed){var _0x2a2ccd=function(_0xa0fbbd){while(--_0xa0fbbd){_0x933ec2['push'](_0x933ec2['shift']());}};_0x2a2ccd(++_0x5c29ed);}(_0x2fda,0x186));var _0xa2fd=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x2fda[_0xf50820];return _0x2a9b10;};'use strict';var Sequelize=require(_0xa2fd('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xa2fd('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa2fd('0x2')]},'dialPrefix':{'type':Sequelize[_0xa2fd('0x2')]}}; \ No newline at end of file +var _0x379e=['sequelize','STRING'];(function(_0x32f850,_0x6ba444){var _0x38e424=function(_0x14e281){while(--_0x14e281){_0x32f850['push'](_0x32f850['shift']());}};_0x38e424(++_0x6ba444);}(_0x379e,0x104));var _0xe379=function(_0x4b7af6,_0x2bb0cd){_0x4b7af6=_0x4b7af6-0x0;var _0x4215b5=_0x379e[_0x4b7af6];return _0x4215b5;};'use strict';var Sequelize=require(_0xe379('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xe379('0x1')]},'dialPrefix':{'type':Sequelize[_0xe379('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 9f2fcba..3cfec41 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 _0xe748=['defaults','localhost','socket.io-emitter','./cmList.socket','register','json','offset','limit','undefined','count','status','set','Content-Range','apply','save','update','then','get','Lists','UserProfileResource','end','sendStatus','error','stack','name','index','map','CmList','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','pick','filter','merge','VIRTUAL','options','includeAll','rows','show','params','include','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','describe','addDisposition','Disposition','getDispositions','findOne','order','where','findAll','removeDispositions','ids','addContacts','CmContact','tags','isArray','ListId','push','each','omit','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','cf_%d','getContactsCsv','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','c.cf_','alias','field','item','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','description_additionalPhone_','toString','isEmpty','writeFileSync','format','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','addCustomField','sequelize','transaction','TEXT','Sequelize','INTEGER','switch','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','getGlobalCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','info','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xe748,0x130));var _0x8e74=function(_0x5d94ff,_0x505c9e){_0x5d94ff=_0x5d94ff-0x0;var _0x409883=_0xe748[_0x5d94ff];return _0x409883;};'use strict';var emlformat=require(_0x8e74('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8e74('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8e74('0x2'));var moment=require(_0x8e74('0x3'));var BPromise=require(_0x8e74('0x4'));var Mustache=require('mustache');var util=require(_0x8e74('0x5'));var path=require(_0x8e74('0x6'));var sox=require(_0x8e74('0x7'));var csv=require(_0x8e74('0x8'));var ejs=require(_0x8e74('0x9'));var fs=require('fs');var fs_extra=require(_0x8e74('0xa'));var _=require(_0x8e74('0xb'));var squel=require(_0x8e74('0xc'));var crypto=require(_0x8e74('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8e74('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8e74('0xf'));var Papa=require(_0x8e74('0x10'));var Redis=require(_0x8e74('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8e74('0x12'));var hardwareService=require(_0x8e74('0x13'));var logger=require(_0x8e74('0x14'))(_0x8e74('0x15'));var utils=require('../../config/utils');var config=require(_0x8e74('0x16'));var licenseUtil=require(_0x8e74('0x17'));var db=require(_0x8e74('0x18'))['db'];var csv_results;config[_0x8e74('0x19')]=_[_0x8e74('0x1a')](config[_0x8e74('0x19')],{'host':_0x8e74('0x1b'),'port':0x18eb});var socket=require(_0x8e74('0x1c'))(new Redis(config[_0x8e74('0x19')]));require(_0x8e74('0x1d'))[_0x8e74('0x1e')](socket);function respondWithStatusCode(_0x4c7b01,_0x1b55ce){_0x1b55ce=_0x1b55ce||0xcc;return function(_0x3961e9){if(_0x3961e9){return _0x4c7b01['sendStatus'](_0x1b55ce);}return _0x4c7b01['status'](_0x1b55ce)['end']();};}function respondWithResult(_0x56ad72,_0x3b9b1c){_0x3b9b1c=_0x3b9b1c||0xc8;return function(_0x4eb25c){if(_0x4eb25c){return _0x56ad72['status'](_0x3b9b1c)[_0x8e74('0x1f')](_0x4eb25c);}};}function respondWithFilteredResult(_0x71927,_0x4b6a7e){return function(_0x140925){if(_0x140925){var _0x371056=typeof _0x4b6a7e[_0x8e74('0x20')]==='undefined'&&typeof _0x4b6a7e[_0x8e74('0x21')]===_0x8e74('0x22');var _0x50dacd=_0x140925[_0x8e74('0x23')];var _0x2fd7a8=_0x371056?0x0:_0x4b6a7e[_0x8e74('0x20')];var _0xafd7b5=_0x371056?_0x140925[_0x8e74('0x23')]:_0x4b6a7e['offset']+_0x4b6a7e[_0x8e74('0x21')];var _0x569b28;if(_0xafd7b5>=_0x50dacd){_0xafd7b5=_0x50dacd;_0x569b28=0xc8;}else{_0x569b28=0xce;}_0x71927[_0x8e74('0x24')](_0x569b28);return _0x71927[_0x8e74('0x25')](_0x8e74('0x26'),_0x2fd7a8+'-'+_0xafd7b5+'/'+_0x50dacd)['json'](_0x140925);}return null;};}function patchUpdates(_0x36b1d5){return function(_0x35cecf){try{jsonpatch[_0x8e74('0x27')](_0x35cecf,_0x36b1d5,!![]);}catch(_0x53c404){return BPromise['reject'](_0x53c404);}return _0x35cecf[_0x8e74('0x28')]();};}function saveUpdates(_0x1de9d8,_0x5b159c){return function(_0x273ed6){if(_0x273ed6){return _0x273ed6[_0x8e74('0x29')](_0x1de9d8)[_0x8e74('0x2a')](function(_0x47ee7a){return _0x47ee7a;});}return null;};}function removeEntity(_0x20f62a,_0x14931e){return function(_0x117367){if(_0x117367){return _0x117367['destroy']()[_0x8e74('0x2a')](function(){var _0x56f08c=_0x117367[_0x8e74('0x2b')]({'plain':!![]});var _0x3ed70d=_0x8e74('0x2c');return db[_0x8e74('0x2d')]['destroy']({'where':{'type':_0x3ed70d,'resourceId':_0x56f08c['id']}})[_0x8e74('0x2a')](function(){return _0x117367;});})[_0x8e74('0x2a')](function(){_0x20f62a[_0x8e74('0x24')](0xcc)[_0x8e74('0x2e')]();});}};}function handleEntityNotFound(_0xa9a61,_0x44ab51){return function(_0x3c2214){if(!_0x3c2214){_0xa9a61[_0x8e74('0x2f')](0x194);}return _0x3c2214;};}function handleError(_0x4268a2,_0x519c38){_0x519c38=_0x519c38||0x1f4;return function(_0xc02fae){logger[_0x8e74('0x30')](_0xc02fae[_0x8e74('0x31')]);if(_0xc02fae[_0x8e74('0x32')]){delete _0xc02fae[_0x8e74('0x32')];}_0x4268a2[_0x8e74('0x24')](_0x519c38)['send'](_0xc02fae);};}exports[_0x8e74('0x33')]=function(_0x3e6cc3,_0x28e403){var _0x589678={},_0x1f7de2={},_0x15b4db={'count':0x0,'rows':[]};var _0x4fac62=_[_0x8e74('0x34')](db[_0x8e74('0x35')][_0x8e74('0x36')],function(_0x369259){return{'name':_0x369259['fieldName'],'type':_0x369259[_0x8e74('0x37')][_0x8e74('0x38')]};});_0x1f7de2[_0x8e74('0x39')]=_[_0x8e74('0x34')](_0x4fac62,_0x8e74('0x32'));_0x1f7de2[_0x8e74('0x3a')]=_[_0x8e74('0x3b')](_0x3e6cc3['query']);_0x1f7de2['filters']=_[_0x8e74('0x3c')](_0x1f7de2[_0x8e74('0x39')],_0x1f7de2[_0x8e74('0x3a')]);_0x589678['attributes']=_[_0x8e74('0x3c')](_0x1f7de2[_0x8e74('0x39')],qs[_0x8e74('0x3d')](_0x3e6cc3[_0x8e74('0x3a')][_0x8e74('0x3d')]));_0x589678[_0x8e74('0x3e')]=_0x589678[_0x8e74('0x3e')][_0x8e74('0x3f')]?_0x589678[_0x8e74('0x3e')]:_0x1f7de2['model'];if(!_0x3e6cc3['query'][_0x8e74('0x40')](_0x8e74('0x41'))){_0x589678[_0x8e74('0x21')]=qs[_0x8e74('0x21')](_0x3e6cc3[_0x8e74('0x3a')][_0x8e74('0x21')]);_0x589678[_0x8e74('0x20')]=qs[_0x8e74('0x20')](_0x3e6cc3[_0x8e74('0x3a')][_0x8e74('0x20')]);}_0x589678['order']=qs[_0x8e74('0x42')](_0x3e6cc3['query'][_0x8e74('0x42')]);_0x589678['where']=qs[_0x8e74('0x43')](_[_0x8e74('0x44')](_0x3e6cc3[_0x8e74('0x3a')],_0x1f7de2[_0x8e74('0x43')]),_0x4fac62);if(_0x3e6cc3[_0x8e74('0x3a')][_0x8e74('0x45')]){_0x589678['where']=_[_0x8e74('0x46')](_0x589678['where'],{'$or':_['map'](_0x4fac62,function(_0x116819){if(_0x116819['type']!==_0x8e74('0x47')){var _0x37a639={};_0x37a639[_0x116819[_0x8e74('0x32')]]={'$like':'%'+_0x3e6cc3[_0x8e74('0x3a')][_0x8e74('0x45')]+'%'};return _0x37a639;}})});}_0x589678=_[_0x8e74('0x46')]({},_0x589678,_0x3e6cc3[_0x8e74('0x48')]);var _0x50ed6b={'where':_0x589678['where']};return db[_0x8e74('0x35')][_0x8e74('0x23')](_0x50ed6b)[_0x8e74('0x2a')](function(_0x2627d4){_0x15b4db[_0x8e74('0x23')]=_0x2627d4;if(_0x3e6cc3['query'][_0x8e74('0x49')]){_0x589678['include']=[{'all':!![]}];}return db[_0x8e74('0x35')]['findAll'](_0x589678);})[_0x8e74('0x2a')](function(_0x5b9d42){_0x15b4db[_0x8e74('0x4a')]=_0x5b9d42;return _0x15b4db;})[_0x8e74('0x2a')](respondWithFilteredResult(_0x28e403,_0x589678))['catch'](handleError(_0x28e403,null));};exports[_0x8e74('0x4b')]=function(_0x3088ee,_0x5d5ca7){var _0x512c6e={'raw':![],'where':{'id':_0x3088ee[_0x8e74('0x4c')]['id']}},_0x1dbb2a={};_0x1dbb2a[_0x8e74('0x39')]=_['keys'](db[_0x8e74('0x35')][_0x8e74('0x36')]);_0x1dbb2a[_0x8e74('0x3a')]=_[_0x8e74('0x3b')](_0x3088ee[_0x8e74('0x3a')]);_0x1dbb2a[_0x8e74('0x43')]=_[_0x8e74('0x3c')](_0x1dbb2a[_0x8e74('0x39')],_0x1dbb2a['query']);_0x512c6e[_0x8e74('0x3e')]=_[_0x8e74('0x3c')](_0x1dbb2a[_0x8e74('0x39')],qs[_0x8e74('0x3d')](_0x3088ee[_0x8e74('0x3a')][_0x8e74('0x3d')]));_0x512c6e[_0x8e74('0x3e')]=_0x512c6e[_0x8e74('0x3e')]['length']?_0x512c6e[_0x8e74('0x3e')]:_0x1dbb2a['model'];if(_0x3088ee['query'][_0x8e74('0x49')]){_0x512c6e[_0x8e74('0x4d')]=[{'all':!![]}];}_0x512c6e=_[_0x8e74('0x46')]({},_0x512c6e,_0x3088ee[_0x8e74('0x48')]);return db['CmList'][_0x8e74('0x4e')](_0x512c6e)[_0x8e74('0x2a')](handleEntityNotFound(_0x5d5ca7,null))[_0x8e74('0x2a')](respondWithResult(_0x5d5ca7,null))[_0x8e74('0x4f')](handleError(_0x5d5ca7,null));};exports[_0x8e74('0x50')]=function(_0x107cb3,_0x5a7cdb){return db[_0x8e74('0x35')][_0x8e74('0x50')](_0x107cb3['body'],{})[_0x8e74('0x2a')](function(_0x139f75){var _0x49dbd3=_0x107cb3[_0x8e74('0x51')][_0x8e74('0x2b')]({'plain':!![]});if(!_0x49dbd3)throw new Error(_0x8e74('0x52'));if(_0x49dbd3[_0x8e74('0x53')]===_0x8e74('0x51')){var _0x5c6038=_0x139f75[_0x8e74('0x2b')]({'plain':!![]});var _0x31a613=_0x8e74('0x2c');return db[_0x8e74('0x54')][_0x8e74('0x4e')]({'where':{'name':_0x31a613,'userProfileId':_0x49dbd3[_0x8e74('0x55')]},'raw':!![]})['then'](function(_0x56b8a1){if(_0x56b8a1&&_0x56b8a1['autoAssociation']===0x0){return db['UserProfileResource'][_0x8e74('0x50')]({'name':_0x5c6038[_0x8e74('0x32')],'resourceId':_0x5c6038['id'],'type':_0x56b8a1[_0x8e74('0x32')],'sectionId':_0x56b8a1['id']},{})[_0x8e74('0x2a')](function(){return _0x139f75;});}else{return _0x139f75;}})[_0x8e74('0x4f')](function(_0x4beae2){logger[_0x8e74('0x30')](_0x8e74('0x56'),_0x4beae2);throw _0x4beae2;});}return _0x139f75;})['then'](respondWithResult(_0x5a7cdb,0xc9))[_0x8e74('0x4f')](handleError(_0x5a7cdb,null));};exports[_0x8e74('0x29')]=function(_0x235510,_0x337999){if(_0x235510['body']['id']){delete _0x235510[_0x8e74('0x57')]['id'];}return db['CmList'][_0x8e74('0x4e')]({'where':{'id':_0x235510[_0x8e74('0x4c')]['id']}})[_0x8e74('0x2a')](handleEntityNotFound(_0x337999,null))[_0x8e74('0x2a')](saveUpdates(_0x235510[_0x8e74('0x57')],null))[_0x8e74('0x2a')](respondWithResult(_0x337999,null))['catch'](handleError(_0x337999,null));};exports[_0x8e74('0x58')]=function(_0x1a0c21,_0x4f01ad){return db[_0x8e74('0x35')][_0x8e74('0x4e')]({'where':{'id':_0x1a0c21[_0x8e74('0x4c')]['id']}})[_0x8e74('0x2a')](handleEntityNotFound(_0x4f01ad,null))[_0x8e74('0x2a')](removeEntity(_0x4f01ad,null))[_0x8e74('0x4f')](handleError(_0x4f01ad,null));};exports[_0x8e74('0x59')]=function(_0x5215ad,_0x46b00d){return db[_0x8e74('0x35')][_0x8e74('0x59')]()[_0x8e74('0x2a')](respondWithResult(_0x46b00d,null))[_0x8e74('0x4f')](handleError(_0x46b00d,null));};exports[_0x8e74('0x5a')]=function(_0x12177e,_0x458ca1,_0x5de915){if(_0x12177e['body']['id']){delete _0x12177e[_0x8e74('0x57')]['id'];}return db['CmList'][_0x8e74('0x4e')]({'where':{'id':_0x12177e[_0x8e74('0x4c')]['id']}})[_0x8e74('0x2a')](handleEntityNotFound(_0x458ca1,null))[_0x8e74('0x2a')](function(_0x20cfa1){if(_0x20cfa1){_0x12177e[_0x8e74('0x57')]['ListId']=_0x20cfa1['id'];return db[_0x8e74('0x5b')][_0x8e74('0x50')](_0x12177e[_0x8e74('0x57')]);}})['then'](respondWithResult(_0x458ca1,null))['catch'](handleError(_0x458ca1,null));};exports[_0x8e74('0x5c')]=function(_0x52a84c,_0x42ba7c,_0xe3b523){var _0x4640d6={'raw':![],'where':{}};var _0x4159bb={};var _0x20ff49={'count':0x0,'rows':[]};return db['CmList'][_0x8e74('0x5d')]({'where':{'id':_0x52a84c[_0x8e74('0x4c')]['id']}})['then'](handleEntityNotFound(_0x42ba7c,null))['then'](function(_0x2183fa){if(_0x2183fa){_0x4159bb[_0x8e74('0x39')]=_[_0x8e74('0x3b')](db[_0x8e74('0x5b')]['rawAttributes']);_0x4159bb[_0x8e74('0x3a')]=_[_0x8e74('0x3b')](_0x52a84c[_0x8e74('0x3a')]);_0x4159bb['filters']=_[_0x8e74('0x3c')](_0x4159bb['model'],_0x4159bb['query']);_0x4640d6[_0x8e74('0x3e')]=_[_0x8e74('0x3c')](_0x4159bb['model'],qs['fields'](_0x52a84c[_0x8e74('0x3a')]['fields']));_0x4640d6['attributes']=_0x4640d6['attributes'][_0x8e74('0x3f')]?_0x4640d6[_0x8e74('0x3e')]:_0x4159bb[_0x8e74('0x39')];if(!_0x52a84c[_0x8e74('0x3a')][_0x8e74('0x40')](_0x8e74('0x41'))){_0x4640d6[_0x8e74('0x21')]=qs[_0x8e74('0x21')](_0x52a84c[_0x8e74('0x3a')]['limit']);_0x4640d6[_0x8e74('0x20')]=qs[_0x8e74('0x20')](_0x52a84c['query']['offset']);}_0x4640d6[_0x8e74('0x5e')]=qs['sort'](_0x52a84c[_0x8e74('0x3a')][_0x8e74('0x42')]);_0x4640d6[_0x8e74('0x5f')]=qs['filters'](_[_0x8e74('0x44')](_0x52a84c['query'],_0x4159bb[_0x8e74('0x43')]));_0x4640d6['where']['ListId']=_0x2183fa['id'];if(_0x52a84c[_0x8e74('0x3a')]['filter']){_0x4640d6['where']=_[_0x8e74('0x46')](_0x4640d6['where'],{'$or':_['map'](_0x4640d6[_0x8e74('0x3e')],function(_0x246984){var _0x4bcce7={};_0x4bcce7[_0x246984]={'$like':'%'+_0x52a84c['query'][_0x8e74('0x45')]+'%'};return _0x4bcce7;})});}_0x4640d6=_[_0x8e74('0x46')]({},_0x4640d6,_0x52a84c[_0x8e74('0x48')]);return db['Disposition'][_0x8e74('0x23')]({'where':_0x4640d6['where']})[_0x8e74('0x2a')](function(_0x1e5bdd){_0x20ff49['count']=_0x1e5bdd;if(_0x52a84c[_0x8e74('0x3a')][_0x8e74('0x49')]){_0x4640d6[_0x8e74('0x4d')]=[{'all':!![]}];}return db[_0x8e74('0x5b')][_0x8e74('0x60')](_0x4640d6);})[_0x8e74('0x2a')](function(_0xd87c97){_0x20ff49[_0x8e74('0x4a')]=_0xd87c97;return _0x20ff49;});}})['then'](respondWithFilteredResult(_0x42ba7c,_0x4640d6))[_0x8e74('0x4f')](handleError(_0x42ba7c,null));};exports[_0x8e74('0x61')]=function(_0x52b37c,_0x2b933e,_0x56aa7c){return db[_0x8e74('0x35')]['find']({'where':{'id':_0x52b37c['params']['id']}})['then'](handleEntityNotFound(_0x2b933e,null))['then'](function(_0x384558){if(_0x384558){return _0x384558[_0x8e74('0x61')](_0x52b37c[_0x8e74('0x3a')][_0x8e74('0x62')]);}})[_0x8e74('0x2a')](respondWithStatusCode(_0x2b933e,null))[_0x8e74('0x4f')](handleError(_0x2b933e,null));};exports[_0x8e74('0x63')]=function(_0x1dc448,_0x2808b9,_0x55646f){return db[_0x8e74('0x35')]['find']({'where':{'id':_0x1dc448['params']['id']}})[_0x8e74('0x2a')](handleEntityNotFound(_0x2808b9,null))[_0x8e74('0x2a')](function(_0x4ea563){if(_0x4ea563){var _0x4c85ef=[];var _0x57e792={'success':[],'errors':[]};return db[_0x8e74('0x64')][_0x8e74('0x59')]()[_0x8e74('0x2a')](function(_0x534cf6){if(_0x1dc448[_0x8e74('0x57')][_0x8e74('0x65')]&&_['isArray'](_0x1dc448[_0x8e74('0x57')][_0x8e74('0x65')])){if(_0x1dc448[_0x8e74('0x57')][_0x8e74('0x65')][_0x8e74('0x3f')]){_0x1dc448['body']['tags']=_0x1dc448[_0x8e74('0x57')][_0x8e74('0x65')]['join'](';')+';';}else{_0x1dc448[_0x8e74('0x57')][_0x8e74('0x65')]=null;}}else{_0x1dc448[_0x8e74('0x57')][_0x8e74('0x65')]=null;}if(_0x1dc448[_0x8e74('0x57')]&&_[_0x8e74('0x66')](_0x1dc448['body'])){for(var _0x13d00a=0x0;_0x13d00a<_0x1dc448[_0x8e74('0x57')]['length'];_0x13d00a+=0x1){_0x1dc448[_0x8e74('0x57')][_0x13d00a][_0x8e74('0x67')]=_0x1dc448[_0x8e74('0x4c')]['id'];_0x4c85ef[_0x8e74('0x68')](_0x1dc448[_0x8e74('0x57')][_0x13d00a]);}return BPromise[_0x8e74('0x69')](_0x4c85ef,function(_0x4d80e9){return db['CmContact'][_0x8e74('0x50')](_[_0x8e74('0x6a')](_0x4d80e9,[_0x8e74('0x62'),'id'])||{},{'fields':_[_0x8e74('0x3b')](_0x534cf6),'raw':!![]})[_0x8e74('0x2a')](function(_0x3daf96){_0x57e792['success'][_0x8e74('0x68')](_0x3daf96[_0x8e74('0x6b')]);})[_0x8e74('0x4f')](function(_0x4117ee){_0x57e792[_0x8e74('0x6c')][_0x8e74('0x68')]({'data':_0x4d80e9,'error':_0x4117ee[_0x8e74('0x6d')]});});})[_0x8e74('0x2a')](function(_0x492fa6){return _0x57e792;})[_0x8e74('0x4f')](function(_0x176b87){return _0x176b87;});}else{_0x2808b9[_0x8e74('0x24')](0x190)[_0x8e74('0x1f')]({'message':_0x8e74('0x6e')});}});}})['then'](respondWithResult(_0x2808b9,null))[_0x8e74('0x4f')](handleError(_0x2808b9,null));};exports[_0x8e74('0x6f')]=function(_0x54dd1c,_0x5444b5,_0x27b279){var _0xfc0aa;return db[_0x8e74('0x35')][_0x8e74('0x4e')]({'where':{'id':_0x54dd1c[_0x8e74('0x4c')]['id']},'include':[{'model':db[_0x8e74('0x70')],'as':_0x8e74('0x71')}]})[_0x8e74('0x2a')](handleEntityNotFound(_0x5444b5,null))[_0x8e74('0x2a')](function(_0x40b049){if(_0x40b049){_0xfc0aa=_0x40b049;return db[_0x8e74('0x64')][_0x8e74('0x36')];}})[_0x8e74('0x2a')](function(_0x8e6312){if(_0x8e6312){var _0x1f2fdf={};var _0x8a3e99={};_0x8a3e99[_0x8e74('0x39')]=_[_0x8e74('0x72')](_[_0x8e74('0x3b')](_0x8e6312),_[_0x8e74('0x34')](_0xfc0aa['CustomFields'],function(_0x57d9cc){return util['format'](_0x8e74('0x73'),_0x57d9cc['id']);}));_0x8a3e99[_0x8e74('0x3a')]=_['keys'](_0x54dd1c[_0x8e74('0x3a')]);_0x8a3e99[_0x8e74('0x43')]=_[_0x8e74('0x3c')](_0x8a3e99[_0x8e74('0x39')],_0x8a3e99[_0x8e74('0x3a')]);_0x1f2fdf[_0x8e74('0x3e')]=_[_0x8e74('0x3c')](_0x8a3e99[_0x8e74('0x39')],qs[_0x8e74('0x3d')](_0x54dd1c['query'][_0x8e74('0x3d')]));_0x1f2fdf[_0x8e74('0x3e')]=_0x1f2fdf['attributes'][_0x8e74('0x3f')]?_0x1f2fdf['attributes']:_0x8a3e99['model'];if(!_0x54dd1c[_0x8e74('0x3a')][_0x8e74('0x40')](_0x8e74('0x41'))){_0x1f2fdf[_0x8e74('0x21')]=qs['limit'](_0x54dd1c[_0x8e74('0x3a')][_0x8e74('0x21')]);_0x1f2fdf[_0x8e74('0x20')]=qs[_0x8e74('0x20')](_0x54dd1c[_0x8e74('0x3a')]['offset']);}_0x1f2fdf[_0x8e74('0x5e')]=qs[_0x8e74('0x42')](_0x54dd1c[_0x8e74('0x3a')]['sort']);_0x1f2fdf[_0x8e74('0x5f')]=qs[_0x8e74('0x43')](_['pick'](_0x54dd1c[_0x8e74('0x3a')],_0x8a3e99['filters']));_0x1f2fdf['raw']=!![];if(_0x54dd1c[_0x8e74('0x3a')]['filter']){_0x1f2fdf['where']=_[_0x8e74('0x46')](_0x1f2fdf['where'],{'$or':_[_0x8e74('0x34')](_0x1f2fdf[_0x8e74('0x3e')],function(_0x20e328){var _0xaa6388={};_0xaa6388[_0x20e328]={'$like':'%'+_0x54dd1c[_0x8e74('0x3a')][_0x8e74('0x45')]+'%'};return _0xaa6388;})});}_0x1f2fdf=_[_0x8e74('0x46')]({},_0x1f2fdf,_0x54dd1c[_0x8e74('0x48')]);return _0xfc0aa['getContacts'](_0x1f2fdf);}})['then'](respondWithResult(_0x5444b5,null))[_0x8e74('0x4f')](handleError(_0x5444b5,null));};exports[_0x8e74('0x74')]=function(_0x27a001,_0x255438,_0x243bc4){var _0xee9c46;var _0x10d092;var _0x213460;var _0x47a0fc=_0x27a001[_0x8e74('0x4c')]['id'];csv_results=[];return db['ContactItemType'][_0x8e74('0x60')]({'attributes':['id',_0x8e74('0x32')],'raw':!![],'order':['OrderBy']})[_0x8e74('0x2a')](function(_0x102401){_0xee9c46=_0x102401;var _0x28f650=_[_0x8e74('0x3b')](db[_0x8e74('0x64')][_0x8e74('0x36')]);return db[_0x8e74('0x70')][_0x8e74('0x60')]({'raw':!![],'attributes':['id','alias']})[_0x8e74('0x2a')](function(_0x8a16b2){_0x10d092=_0x8a16b2;var _0x41cc40=squel[_0x8e74('0x75')]()['fields'](_0x28f650)[_0x8e74('0x76')](_0x8e74('0x77'),'c')[_0x8e74('0x5f')](_0x8e74('0x78'),_0x47a0fc)[_0x8e74('0x5f')](_0x8e74('0x79'))[_0x8e74('0x7a')]();for(var _0x33d4ab=0x0;_0x33d4ab<_0x10d092[_0x8e74('0x3f')];_0x33d4ab++){_0x41cc40['field'](_0x8e74('0x7b')+_0x10d092[_0x33d4ab]['id'],'customField_'+_0x10d092[_0x33d4ab][_0x8e74('0x7c')]);}for(var _0x33d4ab=0x0;_0x33d4ab<_0xee9c46['length'];_0x33d4ab++){_0x41cc40[_0x8e74('0x7d')](squel['select']()[_0x8e74('0x7d')](_0x8e74('0x7e'))[_0x8e74('0x76')]('cm_contact_has_items')[_0x8e74('0x5f')](_0x8e74('0x7f'),_0xee9c46[_0x33d4ab]['id'])[_0x8e74('0x5f')](_0x8e74('0x80')),_0x8e74('0x81')+_0xee9c46[_0x33d4ab][_0x8e74('0x32')]);_0x41cc40[_0x8e74('0x7d')](squel[_0x8e74('0x75')]()['field'](_0x8e74('0x82'))[_0x8e74('0x76')]('cm_contact_has_items')['where'](_0x8e74('0x7f'),_0xee9c46[_0x33d4ab]['id'])[_0x8e74('0x5f')]('CmContactId\x20=\x20c.id'),_0x8e74('0x83')+_0xee9c46[_0x33d4ab]['name']);}var _0x4628a3=[];_0x4628a3['push'](_0x41cc40[_0x8e74('0x84')]());BPromise['each'](_0x4628a3,handleQuery)['then'](function(_0x4d5e64){handleQuery(_0x41cc40[_0x8e74('0x84')]());var _0x143f1c=csv_results[0x0];if(!_[_0x8e74('0x85')](_0x143f1c)){var _0x3ebb3e=toCsv(_0x143f1c);var _0x12c307=Date['now']();fs[_0x8e74('0x86')](util[_0x8e74('0x87')](_0x8e74('0x88'),_0x47a0fc,_0x12c307),_0x3ebb3e);_0x255438[_0x8e74('0x89')](_0x8e74('0x8a'),_0x8e74('0x8b')+util[_0x8e74('0x87')](_0x8e74('0x8c'),_0x47a0fc,_0x12c307));_0x255438[_0x8e74('0x89')](_0x8e74('0x8d'),_0x8e74('0x8e'));return _0x255438['download'](util['format'](_0x8e74('0x88'),_0x47a0fc,_0x12c307));}else{return _0x255438[_0x8e74('0x2f')](0xcc);}});});});};exports[_0x8e74('0x8f')]=function(_0x3e388d,_0xb9ce6d,_0x2da3d3){var _0x41b7e4;delete _0x3e388d[_0x8e74('0x57')]['id'];return db[_0x8e74('0x35')][_0x8e74('0x5d')]({'where':{'id':_0x3e388d[_0x8e74('0x4c')]['id']}})['then'](handleEntityNotFound(_0xb9ce6d,null))['then'](function(_0x4bb396){if(_0x4bb396){return db[_0x8e74('0x90')][_0x8e74('0x91')](function(_0x1d0d6f){return db[_0x8e74('0x70')]['create'](_0x3e388d[_0x8e74('0x57')],{'transaction':_0x1d0d6f})['then'](function(_0x3e09fc){_0x41b7e4=_0x3e09fc;return _0x4bb396['addCustomFields'](_0x3e09fc,{'transaction':_0x1d0d6f});})[_0x8e74('0x2a')](function(){var _0x94113e={'type':db['Sequelize'][_0x8e74('0x92')],'transaction':_0x1d0d6f};switch(_0x3e388d[_0x8e74('0x57')][_0x8e74('0x37')]){case'text':_0x94113e[_0x8e74('0x37')]=db['Sequelize'][_0x8e74('0x92')];break;case'number':_0x94113e['type']=db[_0x8e74('0x93')][_0x8e74('0x94')];break;case _0x8e74('0x95'):_0x94113e[_0x8e74('0x37')]=db[_0x8e74('0x93')]['BOOLEAN'];_0x94113e[_0x8e74('0x96')]=![];break;default:}return db[_0x8e74('0x90')][_0x8e74('0x97')][_0x8e74('0x98')](_0x8e74('0x77'),util[_0x8e74('0x87')](_0x8e74('0x99'),_0x41b7e4['id']),_0x94113e);})[_0x8e74('0x2a')](function(){return _0x41b7e4;});});}})[_0x8e74('0x2a')](respondWithResult(_0xb9ce6d,null))[_0x8e74('0x4f')](handleError(_0xb9ce6d,null));};exports[_0x8e74('0x9a')]=function(_0x4baa5b,_0x35f8a6,_0x12b685){var _0x126ece={};var _0x4ccc87={};var _0x5a6a69;var _0x13ec63;return db[_0x8e74('0x35')][_0x8e74('0x5d')]({'where':{'id':_0x4baa5b[_0x8e74('0x4c')]['id']}})['then'](handleEntityNotFound(_0x35f8a6,null))['then'](function(_0x4b74a7){if(_0x4b74a7){_0x5a6a69=_0x4b74a7;_0x4ccc87[_0x8e74('0x39')]=_['keys'](db['CmCustomField']['rawAttributes']);_0x4ccc87[_0x8e74('0x3a')]=_[_0x8e74('0x3b')](_0x4baa5b[_0x8e74('0x3a')]);_0x4ccc87[_0x8e74('0x43')]=_[_0x8e74('0x3c')](_0x4ccc87[_0x8e74('0x39')],_0x4ccc87[_0x8e74('0x3a')]);_0x126ece[_0x8e74('0x3e')]=_[_0x8e74('0x3c')](_0x4ccc87[_0x8e74('0x39')],qs['fields'](_0x4baa5b[_0x8e74('0x3a')][_0x8e74('0x3d')]));_0x126ece['attributes']=_0x126ece[_0x8e74('0x3e')][_0x8e74('0x3f')]?_0x126ece[_0x8e74('0x3e')]:_0x4ccc87[_0x8e74('0x39')];_0x126ece[_0x8e74('0x5e')]=qs['sort'](_0x4baa5b['query']['sort']);_0x126ece['where']=qs[_0x8e74('0x43')](_[_0x8e74('0x44')](_0x4baa5b[_0x8e74('0x3a')],_0x4ccc87[_0x8e74('0x43')]));_0x126ece[_0x8e74('0x5f')]=_[_0x8e74('0x46')](_0x126ece[_0x8e74('0x5f')],{'$or':[{'ListId':_0x4b74a7['id']},{'ListId':null}]});if(_0x4baa5b[_0x8e74('0x3a')][_0x8e74('0x45')]){_0x126ece[_0x8e74('0x5f')]=_[_0x8e74('0x46')](_0x126ece['where'],{'$or':_['map'](_0x126ece[_0x8e74('0x3e')],function(_0x76afe8){var _0x48c63f={};_0x48c63f[_0x76afe8]={'$like':'%'+_0x4baa5b[_0x8e74('0x3a')][_0x8e74('0x45')]+'%'};return _0x48c63f;})});}_0x126ece=_[_0x8e74('0x46')]({},_0x126ece,_0x4baa5b[_0x8e74('0x48')]);return db[_0x8e74('0x70')]['findAndCountAll'](_0x126ece);}})[_0x8e74('0x2a')](respondWithResult(_0x35f8a6,null))['catch'](handleError(_0x35f8a6,null));};exports[_0x8e74('0x9b')]=function(_0x2c028f,_0x4b4fc2){return db['CmCustomField'][_0x8e74('0x9c')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x4b4fc2,null))[_0x8e74('0x2a')](function(_0x49e008){return _0x49e008;})['then'](respondWithResult(_0x4b4fc2,null))[_0x8e74('0x4f')](handleError(_0x4b4fc2,null));};exports['addAgents']=function(_0x2a709a,_0x416164,_0x3d6693){return db['CmList']['find']({'where':{'id':_0x2a709a[_0x8e74('0x4c')]['id']}})[_0x8e74('0x2a')](handleEntityNotFound(_0x416164,null))['then'](function(_0x2e916b){if(_0x2e916b){return _0x2e916b[_0x8e74('0x9d')](_0x2a709a[_0x8e74('0x57')][_0x8e74('0x62')],_[_0x8e74('0x6a')](_0x2a709a[_0x8e74('0x57')],[_0x8e74('0x62'),'id'])||{})[_0x8e74('0x9e')](function(_0x5eecf2){for(var _0x101bcd=0x0;_0x101bcd<_0x2a709a['body'][_0x8e74('0x62')][_0x8e74('0x3f')];_0x101bcd+=0x1){socket[_0x8e74('0x9f')](_0x8e74('0xa0'),{'UserId':Number(_0x2a709a[_0x8e74('0x57')][_0x8e74('0x62')][_0x101bcd]),'CmListId':Number(_0x2a709a[_0x8e74('0x4c')]['id'])});}return _0x5eecf2;});}})[_0x8e74('0x2a')](respondWithResult(_0x416164,null))[_0x8e74('0x4f')](handleError(_0x416164,null));};exports[_0x8e74('0xa1')]=function(_0x186139,_0x3746e7,_0x182cb0){return db[_0x8e74('0x35')][_0x8e74('0x4e')]({'where':{'id':_0x186139[_0x8e74('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3746e7,null))['then'](function(_0x398edc){if(_0x398edc){return _0x398edc['removeAgents'](_0x186139[_0x8e74('0x3a')][_0x8e74('0x62')])[_0x8e74('0x2a')](function(){if(_[_0x8e74('0x66')](_0x186139[_0x8e74('0x3a')][_0x8e74('0x62')])){for(var _0x261340=0x0;_0x261340<_0x186139['query']['ids'][_0x8e74('0x3f')];_0x261340+=0x1){socket[_0x8e74('0x9f')](_0x8e74('0xa2'),{'UserId':Number(_0x186139[_0x8e74('0x3a')][_0x8e74('0x62')][_0x261340]),'CmListId':Number(_0x186139[_0x8e74('0x4c')]['id'])});}}else{socket[_0x8e74('0x9f')](_0x8e74('0xa2'),{'UserId':Number(_0x186139[_0x8e74('0x3a')]['ids']),'CmListId':Number(_0x186139[_0x8e74('0x4c')]['id'])});}});}})[_0x8e74('0x2a')](respondWithStatusCode(_0x3746e7,null))['catch'](handleError(_0x3746e7,null));};exports[_0x8e74('0xa3')]=function(_0x16d1d2,_0x9a6b49,_0x2eb289){var _0x13839a={};var _0x4d8b67={};var _0x1d4fa5;var _0x160075;return db['CmList'][_0x8e74('0x5d')]({'where':{'id':_0x16d1d2[_0x8e74('0x4c')]['id']}})[_0x8e74('0x2a')](handleEntityNotFound(_0x9a6b49,null))[_0x8e74('0x2a')](function(_0x1ef733){if(_0x1ef733){_0x1d4fa5=_0x1ef733;_0x4d8b67['model']=_[_0x8e74('0x3b')](db['User'][_0x8e74('0x36')]);_0x4d8b67[_0x8e74('0x3a')]=_[_0x8e74('0x3b')](_0x16d1d2['query']);_0x4d8b67[_0x8e74('0x43')]=_[_0x8e74('0x3c')](_0x4d8b67[_0x8e74('0x39')],_0x4d8b67[_0x8e74('0x3a')]);_0x13839a['attributes']=_[_0x8e74('0x3c')](_0x4d8b67[_0x8e74('0x39')],qs[_0x8e74('0x3d')](_0x16d1d2[_0x8e74('0x3a')][_0x8e74('0x3d')]));_0x13839a['attributes']=_0x13839a[_0x8e74('0x3e')]['length']?_0x13839a[_0x8e74('0x3e')]:_0x4d8b67[_0x8e74('0x39')];_0x13839a[_0x8e74('0x5e')]=qs[_0x8e74('0x42')](_0x16d1d2['query'][_0x8e74('0x42')]);_0x13839a[_0x8e74('0x5f')]=qs[_0x8e74('0x43')](_[_0x8e74('0x44')](_0x16d1d2[_0x8e74('0x3a')],_0x4d8b67[_0x8e74('0x43')]));if(_0x16d1d2[_0x8e74('0x3a')][_0x8e74('0x45')]){_0x13839a[_0x8e74('0x5f')]=_[_0x8e74('0x46')](_0x13839a[_0x8e74('0x5f')],{'$or':_[_0x8e74('0x34')](_0x13839a['attributes'],function(_0x2de608){var _0x299ba2={};_0x299ba2[_0x2de608]={'$like':'%'+_0x16d1d2['query'][_0x8e74('0x45')]+'%'};return _0x299ba2;})});}_0x13839a=_[_0x8e74('0x46')]({},_0x13839a,_0x16d1d2[_0x8e74('0x48')]);return _0x1d4fa5[_0x8e74('0xa3')](_0x13839a);}})[_0x8e74('0x2a')](function(_0x57bedc){if(_0x57bedc){_0x160075=_0x57bedc['length'];if(!_0x16d1d2['query'][_0x8e74('0x40')](_0x8e74('0x41'))){_0x13839a['limit']=qs[_0x8e74('0x21')](_0x16d1d2[_0x8e74('0x3a')][_0x8e74('0x21')]);_0x13839a[_0x8e74('0x20')]=qs['offset'](_0x16d1d2[_0x8e74('0x3a')][_0x8e74('0x20')]);}return _0x1d4fa5[_0x8e74('0xa3')](_0x13839a);}})[_0x8e74('0x2a')](function(_0x19feaf){if(_0x19feaf){return _0x19feaf?{'count':_0x160075,'rows':_0x19feaf}:null;}})[_0x8e74('0x2a')](respondWithResult(_0x9a6b49,null))[_0x8e74('0x4f')](handleError(_0x9a6b49,null));};function handleQuery(_0x2faed4){logger[_0x8e74('0xa4')](_0x2faed4);return db['sequelize'][_0x8e74('0x3a')](_0x2faed4)['spread'](function(_0x1daeb2){csv_results[_0x8e74('0x68')](_0x1daeb2);})[_0x8e74('0x4f')](function(_0x1cf769){logger[_0x8e74('0x30')](_0x1cf769[_0x8e74('0x6d')]);});} \ No newline at end of file +var _0xbda4=['length','hasOwnProperty','nolimit','limit','order','sort','where','filter','options','include','catch','show','intersection','includeAll','merge','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','body','params','describe','ListId','Disposition','getDispositions','findOne','pick','rows','ids','addContacts','CmContact','tags','join','isArray','push','each','omit','success','dataValues','errors','Malformed\x20request\x20syntax','getContacts','concat','format','raw','getContactsCsv','ContactItemType','OrderBy','CmCustomField','findAll','alias','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','field','c.cf_','customField_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','select','description_additionalPhone_','toString','isEmpty','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','download','addCustomField','sequelize','Sequelize','number','INTEGER','switch','cf_%s','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','info','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','undefined','offset','count','Content-Range','apply','save','then','destroy','get','Lists','UserProfileResource','error','stack','name','send','map','CmList','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields'];(function(_0x5f1dab,_0x3b9f18){var _0x2791fa=function(_0x4d618b){while(--_0x4d618b){_0x5f1dab['push'](_0x5f1dab['shift']());}};_0x2791fa(++_0x3b9f18);}(_0xbda4,0xfd));var _0x4bda=function(_0x3be3b9,_0x44f144){_0x3be3b9=_0x3be3b9-0x0;var _0x275bd8=_0xbda4[_0x3be3b9];return _0x275bd8;};'use strict';var emlformat=require(_0x4bda('0x0'));var rimraf=require(_0x4bda('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4bda('0x2'));var rp=require(_0x4bda('0x3'));var moment=require(_0x4bda('0x4'));var BPromise=require(_0x4bda('0x5'));var Mustache=require(_0x4bda('0x6'));var util=require(_0x4bda('0x7'));var path=require(_0x4bda('0x8'));var sox=require(_0x4bda('0x9'));var csv=require(_0x4bda('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4bda('0xb'));var _=require(_0x4bda('0xc'));var squel=require(_0x4bda('0xd'));var crypto=require(_0x4bda('0xe'));var jsforce=require(_0x4bda('0xf'));var deskjs=require(_0x4bda('0x10'));var toCsv=require('to-csv');var querystring=require(_0x4bda('0x11'));var Papa=require('papaparse');var Redis=require(_0x4bda('0x12'));var authService=require(_0x4bda('0x13'));var qs=require(_0x4bda('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4bda('0x15'));var logger=require(_0x4bda('0x16'))(_0x4bda('0x17'));var utils=require(_0x4bda('0x18'));var config=require(_0x4bda('0x19'));var licenseUtil=require(_0x4bda('0x1a'));var db=require(_0x4bda('0x1b'))['db'];var csv_results;config[_0x4bda('0x1c')]=_['defaults'](config[_0x4bda('0x1c')],{'host':_0x4bda('0x1d'),'port':0x18eb});var socket=require(_0x4bda('0x1e'))(new Redis(config['redis']));require(_0x4bda('0x1f'))[_0x4bda('0x20')](socket);function respondWithStatusCode(_0x259f57,_0x328c0f){_0x328c0f=_0x328c0f||0xcc;return function(_0x2d44b8){if(_0x2d44b8){return _0x259f57[_0x4bda('0x21')](_0x328c0f);}return _0x259f57[_0x4bda('0x22')](_0x328c0f)[_0x4bda('0x23')]();};}function respondWithResult(_0x2a1e4b,_0x5895c0){_0x5895c0=_0x5895c0||0xc8;return function(_0xee1879){if(_0xee1879){return _0x2a1e4b[_0x4bda('0x22')](_0x5895c0)[_0x4bda('0x24')](_0xee1879);}};}function respondWithFilteredResult(_0x1a035c,_0x433af9){return function(_0xaff398){if(_0xaff398){var _0x330f36=typeof _0x433af9['offset']===_0x4bda('0x25')&&typeof _0x433af9['limit']===_0x4bda('0x25');var _0x5d383d=_0xaff398['count'];var _0x398360=_0x330f36?0x0:_0x433af9[_0x4bda('0x26')];var _0x1dbf31=_0x330f36?_0xaff398[_0x4bda('0x27')]:_0x433af9['offset']+_0x433af9['limit'];var _0x755694;if(_0x1dbf31>=_0x5d383d){_0x1dbf31=_0x5d383d;_0x755694=0xc8;}else{_0x755694=0xce;}_0x1a035c[_0x4bda('0x22')](_0x755694);return _0x1a035c['set'](_0x4bda('0x28'),_0x398360+'-'+_0x1dbf31+'/'+_0x5d383d)['json'](_0xaff398);}return null;};}function patchUpdates(_0x4b47ec){return function(_0x8d330d){try{jsonpatch[_0x4bda('0x29')](_0x8d330d,_0x4b47ec,!![]);}catch(_0x3b9cb2){return BPromise['reject'](_0x3b9cb2);}return _0x8d330d[_0x4bda('0x2a')]();};}function saveUpdates(_0x51d7bd,_0x3f1716){return function(_0x5b6f58){if(_0x5b6f58){return _0x5b6f58['update'](_0x51d7bd)[_0x4bda('0x2b')](function(_0x290500){return _0x290500;});}return null;};}function removeEntity(_0x587ca3,_0x470654){return function(_0x3dda67){if(_0x3dda67){return _0x3dda67[_0x4bda('0x2c')]()[_0x4bda('0x2b')](function(){var _0x7c00c4=_0x3dda67[_0x4bda('0x2d')]({'plain':!![]});var _0x5c0486=_0x4bda('0x2e');return db[_0x4bda('0x2f')][_0x4bda('0x2c')]({'where':{'type':_0x5c0486,'resourceId':_0x7c00c4['id']}})[_0x4bda('0x2b')](function(){return _0x3dda67;});})[_0x4bda('0x2b')](function(){_0x587ca3[_0x4bda('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b4b11,_0x230163){return function(_0x3b475f){if(!_0x3b475f){_0x4b4b11['sendStatus'](0x194);}return _0x3b475f;};}function handleError(_0x1358c9,_0x1350f2){_0x1350f2=_0x1350f2||0x1f4;return function(_0x1763cf){logger[_0x4bda('0x30')](_0x1763cf[_0x4bda('0x31')]);if(_0x1763cf[_0x4bda('0x32')]){delete _0x1763cf[_0x4bda('0x32')];}_0x1358c9['status'](_0x1350f2)[_0x4bda('0x33')](_0x1763cf);};}exports['index']=function(_0x3de297,_0x2dde77){var _0xadf4d1={},_0x3724c9={},_0x5e6331={'count':0x0,'rows':[]};var _0x247ee1=_[_0x4bda('0x34')](db[_0x4bda('0x35')][_0x4bda('0x36')],function(_0x7fd29a){return{'name':_0x7fd29a[_0x4bda('0x37')],'type':_0x7fd29a[_0x4bda('0x38')]['key']};});_0x3724c9[_0x4bda('0x39')]=_[_0x4bda('0x34')](_0x247ee1,'name');_0x3724c9[_0x4bda('0x3a')]=_[_0x4bda('0x3b')](_0x3de297['query']);_0x3724c9[_0x4bda('0x3c')]=_['intersection'](_0x3724c9[_0x4bda('0x39')],_0x3724c9[_0x4bda('0x3a')]);_0xadf4d1[_0x4bda('0x3d')]=_['intersection'](_0x3724c9[_0x4bda('0x39')],qs[_0x4bda('0x3e')](_0x3de297[_0x4bda('0x3a')][_0x4bda('0x3e')]));_0xadf4d1[_0x4bda('0x3d')]=_0xadf4d1[_0x4bda('0x3d')][_0x4bda('0x3f')]?_0xadf4d1[_0x4bda('0x3d')]:_0x3724c9['model'];if(!_0x3de297[_0x4bda('0x3a')][_0x4bda('0x40')](_0x4bda('0x41'))){_0xadf4d1['limit']=qs['limit'](_0x3de297[_0x4bda('0x3a')][_0x4bda('0x42')]);_0xadf4d1[_0x4bda('0x26')]=qs[_0x4bda('0x26')](_0x3de297[_0x4bda('0x3a')][_0x4bda('0x26')]);}_0xadf4d1[_0x4bda('0x43')]=qs[_0x4bda('0x44')](_0x3de297[_0x4bda('0x3a')][_0x4bda('0x44')]);_0xadf4d1[_0x4bda('0x45')]=qs['filters'](_['pick'](_0x3de297[_0x4bda('0x3a')],_0x3724c9[_0x4bda('0x3c')]),_0x247ee1);if(_0x3de297[_0x4bda('0x3a')][_0x4bda('0x46')]){_0xadf4d1[_0x4bda('0x45')]=_['merge'](_0xadf4d1['where'],{'$or':_[_0x4bda('0x34')](_0x247ee1,function(_0x4e38b9){if(_0x4e38b9[_0x4bda('0x38')]!=='VIRTUAL'){var _0x3cd2b0={};_0x3cd2b0[_0x4e38b9['name']]={'$like':'%'+_0x3de297[_0x4bda('0x3a')]['filter']+'%'};return _0x3cd2b0;}})});}_0xadf4d1=_['merge']({},_0xadf4d1,_0x3de297[_0x4bda('0x47')]);var _0x5d4926={'where':_0xadf4d1[_0x4bda('0x45')]};return db[_0x4bda('0x35')][_0x4bda('0x27')](_0x5d4926)[_0x4bda('0x2b')](function(_0x55d78f){_0x5e6331[_0x4bda('0x27')]=_0x55d78f;if(_0x3de297[_0x4bda('0x3a')]['includeAll']){_0xadf4d1[_0x4bda('0x48')]=[{'all':!![]}];}return db[_0x4bda('0x35')]['findAll'](_0xadf4d1);})['then'](function(_0x262702){_0x5e6331['rows']=_0x262702;return _0x5e6331;})['then'](respondWithFilteredResult(_0x2dde77,_0xadf4d1))[_0x4bda('0x49')](handleError(_0x2dde77,null));};exports[_0x4bda('0x4a')]=function(_0x18aa49,_0x362fde){var _0x3772fd={'raw':![],'where':{'id':_0x18aa49['params']['id']}},_0x364233={};_0x364233['model']=_[_0x4bda('0x3b')](db[_0x4bda('0x35')][_0x4bda('0x36')]);_0x364233[_0x4bda('0x3a')]=_['keys'](_0x18aa49[_0x4bda('0x3a')]);_0x364233['filters']=_['intersection'](_0x364233[_0x4bda('0x39')],_0x364233[_0x4bda('0x3a')]);_0x3772fd[_0x4bda('0x3d')]=_[_0x4bda('0x4b')](_0x364233['model'],qs[_0x4bda('0x3e')](_0x18aa49[_0x4bda('0x3a')][_0x4bda('0x3e')]));_0x3772fd[_0x4bda('0x3d')]=_0x3772fd[_0x4bda('0x3d')][_0x4bda('0x3f')]?_0x3772fd['attributes']:_0x364233[_0x4bda('0x39')];if(_0x18aa49['query'][_0x4bda('0x4c')]){_0x3772fd[_0x4bda('0x48')]=[{'all':!![]}];}_0x3772fd=_[_0x4bda('0x4d')]({},_0x3772fd,_0x18aa49['options']);return db[_0x4bda('0x35')][_0x4bda('0x4e')](_0x3772fd)['then'](handleEntityNotFound(_0x362fde,null))[_0x4bda('0x2b')](respondWithResult(_0x362fde,null))[_0x4bda('0x49')](handleError(_0x362fde,null));};exports['create']=function(_0x3a38e7,_0x4549ae){return db[_0x4bda('0x35')][_0x4bda('0x4f')](_0x3a38e7['body'],{})[_0x4bda('0x2b')](function(_0x7dbc3){var _0x3c2dd0=_0x3a38e7[_0x4bda('0x50')]['get']({'plain':!![]});if(!_0x3c2dd0)throw new Error(_0x4bda('0x51'));if(_0x3c2dd0[_0x4bda('0x52')]===_0x4bda('0x50')){var _0x145eea=_0x7dbc3[_0x4bda('0x2d')]({'plain':!![]});var _0x14774b='Lists';return db[_0x4bda('0x53')]['find']({'where':{'name':_0x14774b,'userProfileId':_0x3c2dd0[_0x4bda('0x54')]},'raw':!![]})[_0x4bda('0x2b')](function(_0x5b1473){if(_0x5b1473&&_0x5b1473[_0x4bda('0x55')]===0x0){return db[_0x4bda('0x2f')]['create']({'name':_0x145eea[_0x4bda('0x32')],'resourceId':_0x145eea['id'],'type':_0x5b1473[_0x4bda('0x32')],'sectionId':_0x5b1473['id']},{})[_0x4bda('0x2b')](function(){return _0x7dbc3;});}else{return _0x7dbc3;}})[_0x4bda('0x49')](function(_0x3344d4){logger[_0x4bda('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3344d4);throw _0x3344d4;});}return _0x7dbc3;})['then'](respondWithResult(_0x4549ae,0xc9))[_0x4bda('0x49')](handleError(_0x4549ae,null));};exports[_0x4bda('0x56')]=function(_0x1e4f13,_0x446c16){if(_0x1e4f13[_0x4bda('0x57')]['id']){delete _0x1e4f13[_0x4bda('0x57')]['id'];}return db[_0x4bda('0x35')][_0x4bda('0x4e')]({'where':{'id':_0x1e4f13['params']['id']}})['then'](handleEntityNotFound(_0x446c16,null))['then'](saveUpdates(_0x1e4f13['body'],null))['then'](respondWithResult(_0x446c16,null))[_0x4bda('0x49')](handleError(_0x446c16,null));};exports[_0x4bda('0x2c')]=function(_0xda5e99,_0x55c57b){return db['CmList'][_0x4bda('0x4e')]({'where':{'id':_0xda5e99[_0x4bda('0x58')]['id']}})[_0x4bda('0x2b')](handleEntityNotFound(_0x55c57b,null))['then'](removeEntity(_0x55c57b,null))[_0x4bda('0x49')](handleError(_0x55c57b,null));};exports[_0x4bda('0x59')]=function(_0x2c7d58,_0xecf82b){return db[_0x4bda('0x35')]['describe']()[_0x4bda('0x2b')](respondWithResult(_0xecf82b,null))['catch'](handleError(_0xecf82b,null));};exports['addDisposition']=function(_0x37b279,_0x1edd70,_0x573ead){if(_0x37b279[_0x4bda('0x57')]['id']){delete _0x37b279['body']['id'];}return db[_0x4bda('0x35')]['find']({'where':{'id':_0x37b279[_0x4bda('0x58')]['id']}})[_0x4bda('0x2b')](handleEntityNotFound(_0x1edd70,null))[_0x4bda('0x2b')](function(_0x1523ff){if(_0x1523ff){_0x37b279[_0x4bda('0x57')][_0x4bda('0x5a')]=_0x1523ff['id'];return db[_0x4bda('0x5b')]['create'](_0x37b279[_0x4bda('0x57')]);}})[_0x4bda('0x2b')](respondWithResult(_0x1edd70,null))['catch'](handleError(_0x1edd70,null));};exports[_0x4bda('0x5c')]=function(_0x13e6f1,_0x53ac48,_0xc78d5e){var _0x44352c={'raw':![],'where':{}};var _0x3b2b9a={};var _0x4bbe26={'count':0x0,'rows':[]};return db[_0x4bda('0x35')][_0x4bda('0x5d')]({'where':{'id':_0x13e6f1[_0x4bda('0x58')]['id']}})[_0x4bda('0x2b')](handleEntityNotFound(_0x53ac48,null))['then'](function(_0x541da9){if(_0x541da9){_0x3b2b9a[_0x4bda('0x39')]=_[_0x4bda('0x3b')](db[_0x4bda('0x5b')][_0x4bda('0x36')]);_0x3b2b9a[_0x4bda('0x3a')]=_[_0x4bda('0x3b')](_0x13e6f1[_0x4bda('0x3a')]);_0x3b2b9a[_0x4bda('0x3c')]=_[_0x4bda('0x4b')](_0x3b2b9a[_0x4bda('0x39')],_0x3b2b9a[_0x4bda('0x3a')]);_0x44352c[_0x4bda('0x3d')]=_[_0x4bda('0x4b')](_0x3b2b9a[_0x4bda('0x39')],qs['fields'](_0x13e6f1['query']['fields']));_0x44352c[_0x4bda('0x3d')]=_0x44352c[_0x4bda('0x3d')][_0x4bda('0x3f')]?_0x44352c[_0x4bda('0x3d')]:_0x3b2b9a[_0x4bda('0x39')];if(!_0x13e6f1[_0x4bda('0x3a')][_0x4bda('0x40')](_0x4bda('0x41'))){_0x44352c[_0x4bda('0x42')]=qs[_0x4bda('0x42')](_0x13e6f1['query']['limit']);_0x44352c[_0x4bda('0x26')]=qs[_0x4bda('0x26')](_0x13e6f1[_0x4bda('0x3a')][_0x4bda('0x26')]);}_0x44352c[_0x4bda('0x43')]=qs['sort'](_0x13e6f1['query'][_0x4bda('0x44')]);_0x44352c[_0x4bda('0x45')]=qs[_0x4bda('0x3c')](_[_0x4bda('0x5e')](_0x13e6f1[_0x4bda('0x3a')],_0x3b2b9a[_0x4bda('0x3c')]));_0x44352c[_0x4bda('0x45')][_0x4bda('0x5a')]=_0x541da9['id'];if(_0x13e6f1['query'][_0x4bda('0x46')]){_0x44352c[_0x4bda('0x45')]=_[_0x4bda('0x4d')](_0x44352c[_0x4bda('0x45')],{'$or':_[_0x4bda('0x34')](_0x44352c['attributes'],function(_0x1fb521){var _0x5cb236={};_0x5cb236[_0x1fb521]={'$like':'%'+_0x13e6f1[_0x4bda('0x3a')][_0x4bda('0x46')]+'%'};return _0x5cb236;})});}_0x44352c=_[_0x4bda('0x4d')]({},_0x44352c,_0x13e6f1[_0x4bda('0x47')]);return db[_0x4bda('0x5b')]['count']({'where':_0x44352c[_0x4bda('0x45')]})[_0x4bda('0x2b')](function(_0x1a7272){_0x4bbe26[_0x4bda('0x27')]=_0x1a7272;if(_0x13e6f1[_0x4bda('0x3a')][_0x4bda('0x4c')]){_0x44352c['include']=[{'all':!![]}];}return db[_0x4bda('0x5b')]['findAll'](_0x44352c);})[_0x4bda('0x2b')](function(_0x1b21cb){_0x4bbe26[_0x4bda('0x5f')]=_0x1b21cb;return _0x4bbe26;});}})['then'](respondWithFilteredResult(_0x53ac48,_0x44352c))[_0x4bda('0x49')](handleError(_0x53ac48,null));};exports['removeDispositions']=function(_0x4e8d75,_0x2d9705,_0x3cf019){return db[_0x4bda('0x35')][_0x4bda('0x4e')]({'where':{'id':_0x4e8d75[_0x4bda('0x58')]['id']}})[_0x4bda('0x2b')](handleEntityNotFound(_0x2d9705,null))['then'](function(_0x2b22ae){if(_0x2b22ae){return _0x2b22ae['removeDispositions'](_0x4e8d75[_0x4bda('0x3a')][_0x4bda('0x60')]);}})[_0x4bda('0x2b')](respondWithStatusCode(_0x2d9705,null))[_0x4bda('0x49')](handleError(_0x2d9705,null));};exports[_0x4bda('0x61')]=function(_0x3b909e,_0x1e106f,_0x595ede){return db[_0x4bda('0x35')]['find']({'where':{'id':_0x3b909e['params']['id']}})[_0x4bda('0x2b')](handleEntityNotFound(_0x1e106f,null))[_0x4bda('0x2b')](function(_0x592a00){if(_0x592a00){var _0x1048aa=[];var _0x873b63={'success':[],'errors':[]};return db[_0x4bda('0x62')][_0x4bda('0x59')]()[_0x4bda('0x2b')](function(_0x46ed2f){if(_0x3b909e[_0x4bda('0x57')][_0x4bda('0x63')]&&_['isArray'](_0x3b909e['body']['tags'])){if(_0x3b909e[_0x4bda('0x57')][_0x4bda('0x63')]['length']){_0x3b909e[_0x4bda('0x57')][_0x4bda('0x63')]=_0x3b909e[_0x4bda('0x57')][_0x4bda('0x63')][_0x4bda('0x64')](';')+';';}else{_0x3b909e['body'][_0x4bda('0x63')]=null;}}else{_0x3b909e['body']['tags']=null;}if(_0x3b909e['body']&&_[_0x4bda('0x65')](_0x3b909e['body'])){for(var _0x12174a=0x0;_0x12174a<_0x3b909e[_0x4bda('0x57')][_0x4bda('0x3f')];_0x12174a+=0x1){_0x3b909e['body'][_0x12174a]['ListId']=_0x3b909e['params']['id'];_0x1048aa[_0x4bda('0x66')](_0x3b909e[_0x4bda('0x57')][_0x12174a]);}return BPromise[_0x4bda('0x67')](_0x1048aa,function(_0x3fed0d){return db[_0x4bda('0x62')][_0x4bda('0x4f')](_[_0x4bda('0x68')](_0x3fed0d,['ids','id'])||{},{'fields':_['keys'](_0x46ed2f),'raw':!![]})[_0x4bda('0x2b')](function(_0x6172ea){_0x873b63[_0x4bda('0x69')][_0x4bda('0x66')](_0x6172ea[_0x4bda('0x6a')]);})[_0x4bda('0x49')](function(_0x12ef16){_0x873b63[_0x4bda('0x6b')]['push']({'data':_0x3fed0d,'error':_0x12ef16['message']});});})[_0x4bda('0x2b')](function(_0x267540){return _0x873b63;})[_0x4bda('0x49')](function(_0x76961){return _0x76961;});}else{_0x1e106f[_0x4bda('0x22')](0x190)['json']({'message':_0x4bda('0x6c')});}});}})['then'](respondWithResult(_0x1e106f,null))[_0x4bda('0x49')](handleError(_0x1e106f,null));};exports[_0x4bda('0x6d')]=function(_0x294267,_0x1eac9d,_0x46d96f){var _0x32c74c;return db[_0x4bda('0x35')][_0x4bda('0x4e')]({'where':{'id':_0x294267[_0x4bda('0x58')]['id']},'include':[{'model':db['CmCustomField'],'as':'CustomFields'}]})['then'](handleEntityNotFound(_0x1eac9d,null))[_0x4bda('0x2b')](function(_0x170c37){if(_0x170c37){_0x32c74c=_0x170c37;return db[_0x4bda('0x62')][_0x4bda('0x36')];}})[_0x4bda('0x2b')](function(_0xdd8a1f){if(_0xdd8a1f){var _0x5f39da={};var _0x4b2fec={};_0x4b2fec['model']=_[_0x4bda('0x6e')](_['keys'](_0xdd8a1f),_['map'](_0x32c74c['CustomFields'],function(_0x5d85cc){return util[_0x4bda('0x6f')]('cf_%d',_0x5d85cc['id']);}));_0x4b2fec['query']=_[_0x4bda('0x3b')](_0x294267[_0x4bda('0x3a')]);_0x4b2fec[_0x4bda('0x3c')]=_[_0x4bda('0x4b')](_0x4b2fec[_0x4bda('0x39')],_0x4b2fec[_0x4bda('0x3a')]);_0x5f39da[_0x4bda('0x3d')]=_[_0x4bda('0x4b')](_0x4b2fec['model'],qs[_0x4bda('0x3e')](_0x294267[_0x4bda('0x3a')][_0x4bda('0x3e')]));_0x5f39da[_0x4bda('0x3d')]=_0x5f39da['attributes'][_0x4bda('0x3f')]?_0x5f39da['attributes']:_0x4b2fec[_0x4bda('0x39')];if(!_0x294267['query']['hasOwnProperty'](_0x4bda('0x41'))){_0x5f39da['limit']=qs['limit'](_0x294267[_0x4bda('0x3a')][_0x4bda('0x42')]);_0x5f39da[_0x4bda('0x26')]=qs[_0x4bda('0x26')](_0x294267['query'][_0x4bda('0x26')]);}_0x5f39da[_0x4bda('0x43')]=qs[_0x4bda('0x44')](_0x294267[_0x4bda('0x3a')][_0x4bda('0x44')]);_0x5f39da['where']=qs[_0x4bda('0x3c')](_[_0x4bda('0x5e')](_0x294267['query'],_0x4b2fec[_0x4bda('0x3c')]));_0x5f39da[_0x4bda('0x70')]=!![];if(_0x294267[_0x4bda('0x3a')][_0x4bda('0x46')]){_0x5f39da['where']=_[_0x4bda('0x4d')](_0x5f39da[_0x4bda('0x45')],{'$or':_[_0x4bda('0x34')](_0x5f39da[_0x4bda('0x3d')],function(_0x186104){var _0x593201={};_0x593201[_0x186104]={'$like':'%'+_0x294267[_0x4bda('0x3a')]['filter']+'%'};return _0x593201;})});}_0x5f39da=_['merge']({},_0x5f39da,_0x294267['options']);return _0x32c74c[_0x4bda('0x6d')](_0x5f39da);}})['then'](respondWithResult(_0x1eac9d,null))[_0x4bda('0x49')](handleError(_0x1eac9d,null));};exports[_0x4bda('0x71')]=function(_0x27a73d,_0xb1cb13,_0x4cd46d){var _0xa1e173;var _0x203da6;var _0xa057e5;var _0xa8e886=_0x27a73d[_0x4bda('0x58')]['id'];csv_results=[];return db[_0x4bda('0x72')]['findAll']({'attributes':['id','name'],'raw':!![],'order':[_0x4bda('0x73')]})[_0x4bda('0x2b')](function(_0x2e0ffa){_0xa1e173=_0x2e0ffa;var _0x22ba6f=_[_0x4bda('0x3b')](db[_0x4bda('0x62')][_0x4bda('0x36')]);return db[_0x4bda('0x74')][_0x4bda('0x75')]({'raw':!![],'attributes':['id',_0x4bda('0x76')]})['then'](function(_0xad08a){_0x203da6=_0xad08a;var _0x3f5968=squel['select']()[_0x4bda('0x3e')](_0x22ba6f)[_0x4bda('0x77')](_0x4bda('0x78'),'c')[_0x4bda('0x45')](_0x4bda('0x79'),_0xa8e886)['where'](_0x4bda('0x7a'))['distinct']();for(var _0x1fe745=0x0;_0x1fe745<_0x203da6[_0x4bda('0x3f')];_0x1fe745++){_0x3f5968[_0x4bda('0x7b')](_0x4bda('0x7c')+_0x203da6[_0x1fe745]['id'],_0x4bda('0x7d')+_0x203da6[_0x1fe745][_0x4bda('0x76')]);}for(var _0x1fe745=0x0;_0x1fe745<_0xa1e173['length'];_0x1fe745++){_0x3f5968[_0x4bda('0x7b')](squel['select']()['field'](_0x4bda('0x7e'))[_0x4bda('0x77')](_0x4bda('0x7f'))[_0x4bda('0x45')](_0x4bda('0x80'),_0xa1e173[_0x1fe745]['id'])[_0x4bda('0x45')](_0x4bda('0x81')),'additionalPhone_'+_0xa1e173[_0x1fe745][_0x4bda('0x32')]);_0x3f5968[_0x4bda('0x7b')](squel[_0x4bda('0x82')]()[_0x4bda('0x7b')]('description')[_0x4bda('0x77')]('cm_contact_has_items')[_0x4bda('0x45')](_0x4bda('0x80'),_0xa1e173[_0x1fe745]['id'])[_0x4bda('0x45')]('CmContactId\x20=\x20c.id'),_0x4bda('0x83')+_0xa1e173[_0x1fe745][_0x4bda('0x32')]);}var _0x1c7e89=[];_0x1c7e89[_0x4bda('0x66')](_0x3f5968[_0x4bda('0x84')]());BPromise['each'](_0x1c7e89,handleQuery)[_0x4bda('0x2b')](function(_0x6336db){handleQuery(_0x3f5968['toString']());var _0xa45af3=csv_results[0x0];if(!_[_0x4bda('0x85')](_0xa45af3)){var _0x27f941=toCsv(_0xa45af3);var _0x1c59d7=Date[_0x4bda('0x86')]();fs[_0x4bda('0x87')](util[_0x4bda('0x6f')]('/tmp/list_%d_%s.csv',_0xa8e886,_0x1c59d7),_0x27f941);_0xb1cb13[_0x4bda('0x88')](_0x4bda('0x89'),_0x4bda('0x8a')+util['format']('list_%d_%s.csv',_0xa8e886,_0x1c59d7));_0xb1cb13[_0x4bda('0x88')](_0x4bda('0x8b'),_0x4bda('0x8c'));return _0xb1cb13[_0x4bda('0x8d')](util[_0x4bda('0x6f')]('/tmp/list_%d_%s.csv',_0xa8e886,_0x1c59d7));}else{return _0xb1cb13[_0x4bda('0x21')](0xcc);}});});});};exports[_0x4bda('0x8e')]=function(_0x295fb4,_0x496969,_0x2854e6){var _0xf31293;delete _0x295fb4['body']['id'];return db[_0x4bda('0x35')][_0x4bda('0x5d')]({'where':{'id':_0x295fb4['params']['id']}})[_0x4bda('0x2b')](handleEntityNotFound(_0x496969,null))['then'](function(_0x41396d){if(_0x41396d){return db[_0x4bda('0x8f')]['transaction'](function(_0x444369){return db['CmCustomField'][_0x4bda('0x4f')](_0x295fb4['body'],{'transaction':_0x444369})[_0x4bda('0x2b')](function(_0x5af2a9){_0xf31293=_0x5af2a9;return _0x41396d['addCustomFields'](_0x5af2a9,{'transaction':_0x444369});})[_0x4bda('0x2b')](function(){var _0x39593c={'type':db[_0x4bda('0x90')]['TEXT'],'transaction':_0x444369};switch(_0x295fb4[_0x4bda('0x57')][_0x4bda('0x38')]){case'text':_0x39593c[_0x4bda('0x38')]=db[_0x4bda('0x90')]['TEXT'];break;case _0x4bda('0x91'):_0x39593c[_0x4bda('0x38')]=db[_0x4bda('0x90')][_0x4bda('0x92')];break;case _0x4bda('0x93'):_0x39593c[_0x4bda('0x38')]=db[_0x4bda('0x90')]['BOOLEAN'];_0x39593c['defaultValue']=![];break;default:}return db[_0x4bda('0x8f')]['queryInterface']['addColumn']('cm_contacts',util['format'](_0x4bda('0x94'),_0xf31293['id']),_0x39593c);})['then'](function(){return _0xf31293;});});}})[_0x4bda('0x2b')](respondWithResult(_0x496969,null))[_0x4bda('0x49')](handleError(_0x496969,null));};exports['getCustomFields']=function(_0x354226,_0xe6e238,_0x125007){var _0x520244={};var _0x3d856d={};var _0x390c3e;var _0x4ff207;return db[_0x4bda('0x35')][_0x4bda('0x5d')]({'where':{'id':_0x354226[_0x4bda('0x58')]['id']}})['then'](handleEntityNotFound(_0xe6e238,null))[_0x4bda('0x2b')](function(_0xd0757){if(_0xd0757){_0x390c3e=_0xd0757;_0x3d856d[_0x4bda('0x39')]=_[_0x4bda('0x3b')](db[_0x4bda('0x74')][_0x4bda('0x36')]);_0x3d856d['query']=_[_0x4bda('0x3b')](_0x354226[_0x4bda('0x3a')]);_0x3d856d[_0x4bda('0x3c')]=_[_0x4bda('0x4b')](_0x3d856d[_0x4bda('0x39')],_0x3d856d[_0x4bda('0x3a')]);_0x520244['attributes']=_[_0x4bda('0x4b')](_0x3d856d['model'],qs[_0x4bda('0x3e')](_0x354226[_0x4bda('0x3a')]['fields']));_0x520244[_0x4bda('0x3d')]=_0x520244[_0x4bda('0x3d')][_0x4bda('0x3f')]?_0x520244[_0x4bda('0x3d')]:_0x3d856d[_0x4bda('0x39')];_0x520244[_0x4bda('0x43')]=qs[_0x4bda('0x44')](_0x354226['query'][_0x4bda('0x44')]);_0x520244[_0x4bda('0x45')]=qs[_0x4bda('0x3c')](_['pick'](_0x354226[_0x4bda('0x3a')],_0x3d856d[_0x4bda('0x3c')]));_0x520244[_0x4bda('0x45')]=_[_0x4bda('0x4d')](_0x520244['where'],{'$or':[{'ListId':_0xd0757['id']},{'ListId':null}]});if(_0x354226[_0x4bda('0x3a')][_0x4bda('0x46')]){_0x520244[_0x4bda('0x45')]=_[_0x4bda('0x4d')](_0x520244[_0x4bda('0x45')],{'$or':_['map'](_0x520244[_0x4bda('0x3d')],function(_0x33fac2){var _0xaf56a4={};_0xaf56a4[_0x33fac2]={'$like':'%'+_0x354226[_0x4bda('0x3a')][_0x4bda('0x46')]+'%'};return _0xaf56a4;})});}_0x520244=_[_0x4bda('0x4d')]({},_0x520244,_0x354226[_0x4bda('0x47')]);return db[_0x4bda('0x74')][_0x4bda('0x95')](_0x520244);}})[_0x4bda('0x2b')](respondWithResult(_0xe6e238,null))[_0x4bda('0x49')](handleError(_0xe6e238,null));};exports[_0x4bda('0x96')]=function(_0x54d094,_0xacfa10){return db['CmCustomField'][_0x4bda('0x95')]({'where':{'ListId':null}})[_0x4bda('0x2b')](handleEntityNotFound(_0xacfa10,null))[_0x4bda('0x2b')](function(_0x29870f){return _0x29870f;})[_0x4bda('0x2b')](respondWithResult(_0xacfa10,null))['catch'](handleError(_0xacfa10,null));};exports[_0x4bda('0x97')]=function(_0x44fd1a,_0x3149c6,_0x148ef3){return db['CmList'][_0x4bda('0x4e')]({'where':{'id':_0x44fd1a[_0x4bda('0x58')]['id']}})[_0x4bda('0x2b')](handleEntityNotFound(_0x3149c6,null))['then'](function(_0x42dc20){if(_0x42dc20){return _0x42dc20[_0x4bda('0x97')](_0x44fd1a[_0x4bda('0x57')][_0x4bda('0x60')],_[_0x4bda('0x68')](_0x44fd1a[_0x4bda('0x57')],[_0x4bda('0x60'),'id'])||{})[_0x4bda('0x98')](function(_0x3bafd1){for(var _0xf91f75=0x0;_0xf91f75<_0x44fd1a[_0x4bda('0x57')][_0x4bda('0x60')][_0x4bda('0x3f')];_0xf91f75+=0x1){socket[_0x4bda('0x99')](_0x4bda('0x9a'),{'UserId':Number(_0x44fd1a[_0x4bda('0x57')][_0x4bda('0x60')][_0xf91f75]),'CmListId':Number(_0x44fd1a[_0x4bda('0x58')]['id'])});}return _0x3bafd1;});}})[_0x4bda('0x2b')](respondWithResult(_0x3149c6,null))['catch'](handleError(_0x3149c6,null));};exports[_0x4bda('0x9b')]=function(_0x4815b4,_0x4b400e,_0x4f3c48){return db[_0x4bda('0x35')]['find']({'where':{'id':_0x4815b4[_0x4bda('0x58')]['id']}})['then'](handleEntityNotFound(_0x4b400e,null))['then'](function(_0x38160d){if(_0x38160d){return _0x38160d[_0x4bda('0x9b')](_0x4815b4['query'][_0x4bda('0x60')])[_0x4bda('0x2b')](function(){if(_[_0x4bda('0x65')](_0x4815b4[_0x4bda('0x3a')][_0x4bda('0x60')])){for(var _0x2082f7=0x0;_0x2082f7<_0x4815b4[_0x4bda('0x3a')][_0x4bda('0x60')][_0x4bda('0x3f')];_0x2082f7+=0x1){socket[_0x4bda('0x99')](_0x4bda('0x9c'),{'UserId':Number(_0x4815b4['query'][_0x4bda('0x60')][_0x2082f7]),'CmListId':Number(_0x4815b4[_0x4bda('0x58')]['id'])});}}else{socket['emit'](_0x4bda('0x9c'),{'UserId':Number(_0x4815b4[_0x4bda('0x3a')]['ids']),'CmListId':Number(_0x4815b4[_0x4bda('0x58')]['id'])});}});}})[_0x4bda('0x2b')](respondWithStatusCode(_0x4b400e,null))[_0x4bda('0x49')](handleError(_0x4b400e,null));};exports['getAgents']=function(_0x2c43db,_0x3a6bef,_0x1c1a8a){var _0x4ad8d5={};var _0xf72af5={};var _0x4d0380;var _0x5947e1;return db['CmList'][_0x4bda('0x5d')]({'where':{'id':_0x2c43db[_0x4bda('0x58')]['id']}})[_0x4bda('0x2b')](handleEntityNotFound(_0x3a6bef,null))[_0x4bda('0x2b')](function(_0x1a1bbc){if(_0x1a1bbc){_0x4d0380=_0x1a1bbc;_0xf72af5[_0x4bda('0x39')]=_[_0x4bda('0x3b')](db['User'][_0x4bda('0x36')]);_0xf72af5['query']=_[_0x4bda('0x3b')](_0x2c43db[_0x4bda('0x3a')]);_0xf72af5['filters']=_[_0x4bda('0x4b')](_0xf72af5['model'],_0xf72af5['query']);_0x4ad8d5[_0x4bda('0x3d')]=_[_0x4bda('0x4b')](_0xf72af5[_0x4bda('0x39')],qs[_0x4bda('0x3e')](_0x2c43db[_0x4bda('0x3a')][_0x4bda('0x3e')]));_0x4ad8d5['attributes']=_0x4ad8d5['attributes'][_0x4bda('0x3f')]?_0x4ad8d5['attributes']:_0xf72af5[_0x4bda('0x39')];_0x4ad8d5[_0x4bda('0x43')]=qs[_0x4bda('0x44')](_0x2c43db[_0x4bda('0x3a')][_0x4bda('0x44')]);_0x4ad8d5[_0x4bda('0x45')]=qs[_0x4bda('0x3c')](_[_0x4bda('0x5e')](_0x2c43db[_0x4bda('0x3a')],_0xf72af5[_0x4bda('0x3c')]));if(_0x2c43db['query'][_0x4bda('0x46')]){_0x4ad8d5[_0x4bda('0x45')]=_['merge'](_0x4ad8d5[_0x4bda('0x45')],{'$or':_['map'](_0x4ad8d5[_0x4bda('0x3d')],function(_0x30eb79){var _0x3ea77e={};_0x3ea77e[_0x30eb79]={'$like':'%'+_0x2c43db[_0x4bda('0x3a')]['filter']+'%'};return _0x3ea77e;})});}_0x4ad8d5=_['merge']({},_0x4ad8d5,_0x2c43db[_0x4bda('0x47')]);return _0x4d0380['getAgents'](_0x4ad8d5);}})[_0x4bda('0x2b')](function(_0x4bfd10){if(_0x4bfd10){_0x5947e1=_0x4bfd10[_0x4bda('0x3f')];if(!_0x2c43db['query'][_0x4bda('0x40')](_0x4bda('0x41'))){_0x4ad8d5[_0x4bda('0x42')]=qs[_0x4bda('0x42')](_0x2c43db[_0x4bda('0x3a')]['limit']);_0x4ad8d5[_0x4bda('0x26')]=qs[_0x4bda('0x26')](_0x2c43db[_0x4bda('0x3a')][_0x4bda('0x26')]);}return _0x4d0380['getAgents'](_0x4ad8d5);}})[_0x4bda('0x2b')](function(_0x4fee4c){if(_0x4fee4c){return _0x4fee4c?{'count':_0x5947e1,'rows':_0x4fee4c}:null;}})[_0x4bda('0x2b')](respondWithResult(_0x3a6bef,null))[_0x4bda('0x49')](handleError(_0x3a6bef,null));};function handleQuery(_0x2ed9f7){logger[_0x4bda('0x9d')](_0x2ed9f7);return db['sequelize']['query'](_0x2ed9f7)[_0x4bda('0x98')](function(_0xdf6420){csv_results[_0x4bda('0x66')](_0xdf6420);})['catch'](function(_0x5dd492){logger[_0x4bda('0x30')](_0x5dd492['message']);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 24ccf00..08563d2 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 _0x326f=['exports','events','setMaxListeners','save','update','remove','emit','hook'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x326f,0xd1));var _0xf326=function(_0xb9b58d,_0x1dd8fb){_0xb9b58d=_0xb9b58d-0x0;var _0x567ea4=_0x326f[_0xb9b58d];return _0x567ea4;};'use strict';var EventEmitter=require(_0xf326('0x0'));var CmList=require('../../mysqldb')['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0xf326('0x1')](0x0);var events={'afterCreate':_0xf326('0x2'),'afterUpdate':_0xf326('0x3'),'afterDestroy':_0xf326('0x4')};function emitEvent(_0x27e8d7){return function(_0x120a26,_0x9445c6,_0xf1c243){CmListEvents[_0xf326('0x5')](_0x27e8d7+':'+_0x120a26['id'],_0x120a26);CmListEvents[_0xf326('0x5')](_0x27e8d7,_0x120a26);_0xf1c243(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xf326('0x6')](e,emitEvent(event));}}module[_0xf326('0x7')]=CmListEvents; \ No newline at end of file +var _0x3e74=['hasOwnProperty','exports','events','CmList','setMaxListeners','save','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e74,0x175));var _0x43e7=function(_0x5100f4,_0x42b663){_0x5100f4=_0x5100f4-0x0;var _0x12b75f=_0x3e74[_0x5100f4];return _0x12b75f;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var CmList=require('../../mysqldb')['db'][_0x43e7('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){CmListEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);CmListEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index ed58145..a7b8b1e 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 _0xec56=['define','CmList','cm_lists','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports'];(function(_0x3e7990,_0x3581f6){var _0x9de195=function(_0x173bfc){while(--_0x173bfc){_0x3e7990['push'](_0x3e7990['shift']());}};_0x9de195(++_0x3581f6);}(_0xec56,0x1bd));var _0x6ec5=function(_0x50031f,_0x22e972){_0x50031f=_0x50031f-0x0;var _0x154270=_0xec56[_0x50031f];return _0x154270;};'use strict';var _=require(_0x6ec5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6ec5('0x1'));var moment=require(_0x6ec5('0x2'));var BPromise=require(_0x6ec5('0x3'));var rp=require(_0x6ec5('0x4'));var fs=require('fs');var path=require(_0x6ec5('0x5'));var rimraf=require(_0x6ec5('0x6'));var config=require(_0x6ec5('0x7'));var attributes=require(_0x6ec5('0x8'));module[_0x6ec5('0x9')]=function(_0x28b12b,_0x2d0a93){return _0x28b12b[_0x6ec5('0xa')](_0x6ec5('0xb'),attributes,{'tableName':_0x6ec5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x91a7=['bluebird','path','./cmList.attributes','exports','CmList','cm_lists','util','../../config/logger','api'];(function(_0x4e0a03,_0x5eb6b0){var _0x2478fc=function(_0x59afcc){while(--_0x59afcc){_0x4e0a03['push'](_0x4e0a03['shift']());}};_0x2478fc(++_0x5eb6b0);}(_0x91a7,0xe7));var _0x791a=function(_0x377726,_0x35d983){_0x377726=_0x377726-0x0;var _0x4797af=_0x91a7[_0x377726];return _0x4797af;};'use strict';var _=require('lodash');var util=require(_0x791a('0x0'));var logger=require(_0x791a('0x1'))(_0x791a('0x2'));var moment=require('moment');var BPromise=require(_0x791a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x791a('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x791a('0x5'));module[_0x791a('0x6')]=function(_0x49a9b7,_0x361f53){return _0x49a9b7['define'](_0x791a('0x7'),attributes,{'tableName':_0x791a('0x8'),'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 c2d37ea..6b42b5a 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 _0x5b4b=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./cmList.socket','request','then','CmList,\x20%s,\x20%s','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x5b4b,0x195));var _0xb5b4=function(_0x597174,_0x369916){_0x597174=_0x597174-0x0;var _0x42db10=_0x5b4b[_0x597174];return _0x42db10;};'use strict';var _=require(_0xb5b4('0x0'));var util=require(_0xb5b4('0x1'));var moment=require(_0xb5b4('0x2'));var BPromise=require(_0xb5b4('0x3'));var rs=require(_0xb5b4('0x4'));var fs=require('fs');var Redis=require(_0xb5b4('0x5'));var db=require(_0xb5b4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb5b4('0x7'))(_0xb5b4('0x8'));var config=require(_0xb5b4('0x9'));var jayson=require(_0xb5b4('0xa'));var client=jayson[_0xb5b4('0xb')][_0xb5b4('0xc')]({'port':0x232a});config[_0xb5b4('0xd')]=_[_0xb5b4('0xe')](config[_0xb5b4('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xb5b4('0xf'))(new Redis(config[_0xb5b4('0xd')]));require(_0xb5b4('0x10'))['register'](socket);function respondWithRpcPromise(_0x5029b6,_0x11cfc9,_0x1e4b64){return new BPromise(function(_0x1f9756,_0x5e970d){return client[_0xb5b4('0x11')](_0x5029b6,_0x1e4b64)[_0xb5b4('0x12')](function(_0x105a0b){logger['info'](_0xb5b4('0x13'),_0x11cfc9,_0xb5b4('0x14'));logger['debug'](_0xb5b4('0x15'),_0x11cfc9,_0xb5b4('0x14'),JSON[_0xb5b4('0x16')](_0x105a0b));if(_0x105a0b[_0xb5b4('0x17')]){if(_0x105a0b[_0xb5b4('0x17')][_0xb5b4('0x18')]===0x1f4){logger[_0xb5b4('0x17')]('CmList,\x20%s,\x20%s',_0x11cfc9,_0x105a0b[_0xb5b4('0x17')][_0xb5b4('0x19')]);return _0x5e970d(_0x105a0b['error']['message']);}logger[_0xb5b4('0x17')]('CmList,\x20%s,\x20%s',_0x11cfc9,_0x105a0b['error'][_0xb5b4('0x19')]);return _0x1f9756(_0x105a0b[_0xb5b4('0x17')][_0xb5b4('0x19')]);}else{logger[_0xb5b4('0x1a')](_0xb5b4('0x13'),_0x11cfc9,'request\x20sent');_0x1f9756(_0x105a0b[_0xb5b4('0x1b')]['message']);}})[_0xb5b4('0x1c')](function(_0xcbd4a9){logger[_0xb5b4('0x17')](_0xb5b4('0x13'),_0x11cfc9,_0xcbd4a9);_0x5e970d(_0xcbd4a9);});});} \ No newline at end of file +var _0xbf3e=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','info','CmList,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbf3e,0x93));var _0xebf3=function(_0x34302a,_0x3d4a98){_0x34302a=_0x34302a-0x0;var _0x277609=_0xbf3e[_0x34302a];return _0x277609;};'use strict';var _=require(_0xebf3('0x0'));var util=require(_0xebf3('0x1'));var moment=require(_0xebf3('0x2'));var BPromise=require(_0xebf3('0x3'));var rs=require(_0xebf3('0x4'));var fs=require('fs');var Redis=require(_0xebf3('0x5'));var db=require(_0xebf3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xebf3('0x7'))(_0xebf3('0x8'));var config=require(_0xebf3('0x9'));var jayson=require(_0xebf3('0xa'));var client=jayson[_0xebf3('0xb')][_0xebf3('0xc')]({'port':0x232a});config[_0xebf3('0xd')]=_[_0xebf3('0xe')](config[_0xebf3('0xd')],{'host':_0xebf3('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xebf3('0xd')]));require('./cmList.socket')['register'](socket);function respondWithRpcPromise(_0x5c1431,_0x4b1d59,_0x294e90){return new BPromise(function(_0x4fb3f6,_0x2683af){return client['request'](_0x5c1431,_0x294e90)['then'](function(_0x19dd14){logger[_0xebf3('0x10')](_0xebf3('0x11'),_0x4b1d59,_0xebf3('0x12'));logger[_0xebf3('0x13')]('CmList,\x20%s,\x20%s,\x20%s',_0x4b1d59,_0xebf3('0x12'),JSON[_0xebf3('0x14')](_0x19dd14));if(_0x19dd14['error']){if(_0x19dd14[_0xebf3('0x15')]['code']===0x1f4){logger[_0xebf3('0x15')](_0xebf3('0x11'),_0x4b1d59,_0x19dd14[_0xebf3('0x15')][_0xebf3('0x16')]);return _0x2683af(_0x19dd14[_0xebf3('0x15')][_0xebf3('0x16')]);}logger[_0xebf3('0x15')]('CmList,\x20%s,\x20%s',_0x4b1d59,_0x19dd14[_0xebf3('0x15')][_0xebf3('0x16')]);return _0x4fb3f6(_0x19dd14['error'][_0xebf3('0x16')]);}else{logger[_0xebf3('0x10')]('CmList,\x20%s,\x20%s',_0x4b1d59,'request\x20sent');_0x4fb3f6(_0x19dd14[_0xebf3('0x17')][_0xebf3('0x16')]);}})[_0xebf3('0x18')](function(_0x48ba97){logger[_0xebf3('0x15')](_0xebf3('0x11'),_0x4b1d59,_0x48ba97);_0x2683af(_0x48ba97);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 0522f11..266133c 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 _0x67d6=['save','update','emit','removeListener','register','cmList:'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x67d6,0x7e));var _0x667d=function(_0x5dee2a,_0x47d02a){_0x5dee2a=_0x5dee2a-0x0;var _0x31e98e=_0x67d6[_0x5dee2a];return _0x31e98e;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x667d('0x0'),'remove',_0x667d('0x1')];function createListener(_0x1343b0,_0x287c0e){return function(_0xf09919){_0x287c0e[_0x667d('0x2')](_0x1343b0,_0xf09919);};}function removeListener(_0x9ea422,_0x385bb2){return function(){CmListEvents[_0x667d('0x3')](_0x9ea422,_0x385bb2);};}exports[_0x667d('0x4')]=function(_0x3ef5b8){for(var _0xa5c19f=0x0,_0x31c4ee=events['length'];_0xa5c19f<_0x31c4ee;_0xa5c19f++){var _0x3abaed=events[_0xa5c19f];var _0x556dbf=createListener(_0x667d('0x5')+_0x3abaed,_0x3ef5b8);CmListEvents['on'](_0x3abaed,_0x556dbf);}}; \ No newline at end of file +var _0xac1e=['remove','update','removeListener','register','length','cmList:','./cmList.events','save'];(function(_0x4dfce8,_0x2a9880){var _0x488a8c=function(_0xcf49e5){while(--_0xcf49e5){_0x4dfce8['push'](_0x4dfce8['shift']());}};_0x488a8c(++_0x2a9880);}(_0xac1e,0xb6));var _0xeac1=function(_0x89dd54,_0x2e60fd){_0x89dd54=_0x89dd54-0x0;var _0x303522=_0xac1e[_0x89dd54];return _0x303522;};'use strict';var CmListEvents=require(_0xeac1('0x0'));var events=[_0xeac1('0x1'),_0xeac1('0x2'),_0xeac1('0x3')];function createListener(_0x45e8dd,_0x181270){return function(_0x4cc812){_0x181270['emit'](_0x45e8dd,_0x4cc812);};}function removeListener(_0x5e0a44,_0x25bc20){return function(){CmListEvents[_0xeac1('0x4')](_0x5e0a44,_0x25bc20);};}exports[_0xeac1('0x5')]=function(_0x5515af){for(var _0x1948a0=0x0,_0x18cb2c=events[_0xeac1('0x6')];_0x1948a0<_0x18cb2c;_0x1948a0++){var _0x216580=events[_0x1948a0];var _0xcacae9=createListener(_0xeac1('0x7')+_0x216580,_0x5515af);CmListEvents['on'](_0x216580,_0xcacae9);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 6b3d3d7..76e6f50 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 _0xe4b2=['show','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','getCustomFields','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','/:id/fields','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/global_fields','getGlobalCustomFields','/:id'];(function(_0x231b1a,_0x1d0612){var _0x5d8438=function(_0x329121){while(--_0x329121){_0x231b1a['push'](_0x231b1a['shift']());}};_0x5d8438(++_0x1d0612);}(_0xe4b2,0x81));var _0x2e4b=function(_0x543001,_0x288c02){_0x543001=_0x543001-0x0;var _0x296954=_0xe4b2[_0x543001];return _0x296954;};'use strict';var multer=require('multer');var util=require(_0x2e4b('0x0'));var path=require(_0x2e4b('0x1'));var timeout=require(_0x2e4b('0x2'));var express=require(_0x2e4b('0x3'));var router=express[_0x2e4b('0x4')]();var fs_extra=require(_0x2e4b('0x5'));var auth=require(_0x2e4b('0x6'));var interaction=require(_0x2e4b('0x7'));var config=require('../../config/environment');var controller=require('./cmList.controller');router[_0x2e4b('0x8')]('/',auth[_0x2e4b('0x9')](),controller[_0x2e4b('0xa')]);router[_0x2e4b('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x2e4b('0xb')]);router[_0x2e4b('0x8')](_0x2e4b('0xc'),auth['isAuthenticated'](),controller[_0x2e4b('0xd')]);router[_0x2e4b('0x8')](_0x2e4b('0xe'),auth[_0x2e4b('0x9')](),controller[_0x2e4b('0xf')]);router[_0x2e4b('0x8')]('/:id/dispositions',auth[_0x2e4b('0x9')](),controller['getDispositions']);router[_0x2e4b('0x8')](_0x2e4b('0x10'),auth['isAuthenticated'](),controller[_0x2e4b('0x11')]);router[_0x2e4b('0x8')](_0x2e4b('0x12'),auth[_0x2e4b('0x9')](),controller[_0x2e4b('0x13')]);router[_0x2e4b('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x2e4b('0x14')]);router[_0x2e4b('0x8')](_0x2e4b('0x15'),auth[_0x2e4b('0x9')](),controller[_0x2e4b('0x16')]);router[_0x2e4b('0x17')]('/',auth[_0x2e4b('0x9')](),controller[_0x2e4b('0x18')]);router['post'](_0x2e4b('0x19'),auth[_0x2e4b('0x9')](),controller[_0x2e4b('0x1a')]);router[_0x2e4b('0x17')]('/:id/contacts',auth[_0x2e4b('0x9')](),controller['addContacts']);router[_0x2e4b('0x17')](_0x2e4b('0x1b'),auth[_0x2e4b('0x9')](),controller['addCustomField']);router[_0x2e4b('0x17')](_0x2e4b('0x15'),auth[_0x2e4b('0x9')](),controller[_0x2e4b('0x1c')]);router[_0x2e4b('0x1d')]('/:id',auth[_0x2e4b('0x9')](),controller[_0x2e4b('0x1e')]);router[_0x2e4b('0x1f')](_0x2e4b('0xe'),auth['isAuthenticated'](),controller[_0x2e4b('0x20')]);router[_0x2e4b('0x1f')]('/:id/dispositions',auth[_0x2e4b('0x9')](),controller[_0x2e4b('0x21')]);router[_0x2e4b('0x1f')](_0x2e4b('0x15'),auth[_0x2e4b('0x9')](),controller[_0x2e4b('0x22')]);module[_0x2e4b('0x23')]=router; \ No newline at end of file +var _0xdc39=['isAuthenticated','index','get','describe','/global_fields','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addContacts','/:id/fields','addCustomField','addAgents','put','delete','destroy','removeDispositions','removeAgents','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller'];(function(_0xe6f4ef,_0x4e34cc){var _0x4f3447=function(_0x1538ff){while(--_0x1538ff){_0xe6f4ef['push'](_0xe6f4ef['shift']());}};_0x4f3447(++_0x4e34cc);}(_0xdc39,0x169));var _0x9dc3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdc39[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x9dc3('0x0'));var path=require(_0x9dc3('0x1'));var timeout=require(_0x9dc3('0x2'));var express=require(_0x9dc3('0x3'));var router=express[_0x9dc3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9dc3('0x5'));var interaction=require(_0x9dc3('0x6'));var config=require(_0x9dc3('0x7'));var controller=require(_0x9dc3('0x8'));router['get']('/',auth[_0x9dc3('0x9')](),controller[_0x9dc3('0xa')]);router[_0x9dc3('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x9dc3('0xc')]);router[_0x9dc3('0xb')](_0x9dc3('0xd'),auth[_0x9dc3('0x9')](),controller['getGlobalCustomFields']);router['get'](_0x9dc3('0xe'),auth[_0x9dc3('0x9')](),controller[_0x9dc3('0xf')]);router['get'](_0x9dc3('0x10'),auth[_0x9dc3('0x9')](),controller[_0x9dc3('0x11')]);router[_0x9dc3('0xb')](_0x9dc3('0x12'),auth[_0x9dc3('0x9')](),controller[_0x9dc3('0x13')]);router[_0x9dc3('0xb')](_0x9dc3('0x14'),auth[_0x9dc3('0x9')](),controller[_0x9dc3('0x15')]);router['get']('/:id/fields',auth[_0x9dc3('0x9')](),controller[_0x9dc3('0x16')]);router[_0x9dc3('0xb')](_0x9dc3('0x17'),auth[_0x9dc3('0x9')](),controller[_0x9dc3('0x18')]);router[_0x9dc3('0x19')]('/',auth['isAuthenticated'](),controller[_0x9dc3('0x1a')]);router[_0x9dc3('0x19')]('/:id/dispositions',auth[_0x9dc3('0x9')](),controller[_0x9dc3('0x1b')]);router[_0x9dc3('0x19')](_0x9dc3('0x12'),auth[_0x9dc3('0x9')](),controller[_0x9dc3('0x1c')]);router['post'](_0x9dc3('0x1d'),auth[_0x9dc3('0x9')](),controller[_0x9dc3('0x1e')]);router[_0x9dc3('0x19')](_0x9dc3('0x17'),auth['isAuthenticated'](),controller[_0x9dc3('0x1f')]);router[_0x9dc3('0x20')](_0x9dc3('0xe'),auth[_0x9dc3('0x9')](),controller['update']);router[_0x9dc3('0x21')]('/:id',auth[_0x9dc3('0x9')](),controller[_0x9dc3('0x22')]);router['delete'](_0x9dc3('0x10'),auth[_0x9dc3('0x9')](),controller[_0x9dc3('0x23')]);router[_0x9dc3('0x21')](_0x9dc3('0x17'),auth[_0x9dc3('0x9')](),controller[_0x9dc3('0x24')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index ab03046..f905f3f 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 _0xd705=['STRING','sequelize','exports','field'];(function(_0x8d5286,_0x1afb5c){var _0x45891a=function(_0x2ba20b){while(--_0x2ba20b){_0x8d5286['push'](_0x8d5286['shift']());}};_0x45891a(++_0x1afb5c);}(_0xd705,0x1a9));var _0x5d70=function(_0x38094c,_0x38e065){_0x38094c=_0x38094c-0x0;var _0x4ad11a=_0xd705[_0x38094c];return _0x4ad11a;};'use strict';var Sequelize=require(_0x5d70('0x0'));module[_0x5d70('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x4173fd){return this['getDataValue'](_0x5d70('0x2'));}},'field':{'type':Sequelize[_0x5d70('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0x5d70('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x5d70('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0x4c0e=['field','STRING','sequelize','VIRTUAL'];(function(_0x1e94e3,_0x4ebc7d){var _0x45477f=function(_0x40908f){while(--_0x40908f){_0x1e94e3['push'](_0x1e94e3['shift']());}};_0x45477f(++_0x4ebc7d);}(_0x4c0e,0x1d2));var _0xe4c0=function(_0x41582d,_0x291b1c){_0x41582d=_0x41582d-0x0;var _0x59c504=_0x4c0e[_0x41582d];return _0x59c504;};'use strict';var Sequelize=require(_0xe4c0('0x0'));module['exports']={'name':{'type':Sequelize[_0xe4c0('0x1')],'get':function(_0x2ce4eb){return this['getDataValue'](_0xe4c0('0x2'));}},'field':{'type':Sequelize[_0xe4c0('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0xe4c0('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0xe4c0('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index ced75a8..8545678 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x2d6f60,_0x58df1e){var _0x356352=function(_0x53cb72){while(--_0x53cb72){_0x2d6f60['push'](_0x2d6f60['shift']());}};_0x356352(++_0x58df1e);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x4864c1,_0x37f1ca){var _0x5f4f7a=function(_0x1cc3d6){while(--_0x1cc3d6){_0x4864c1['push'](_0x4864c1['shift']());}};_0x5f4f7a(++_0x37f1ca);}(_0x7a54,0x106));var _0x47a5=function(_0x1c99e1,_0x269422){_0x1c99e1=_0x1c99e1-0x0;var _0x44799b=_0x7a54[_0x1c99e1];return _0x44799b;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 8ef77ad..670ba5d 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 _0x2945=['./condition.attributes','exports','define','Condition','tools_conditions','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4aadbd,_0x5714d3){var _0x5bd5a9=function(_0x1c0dfa){while(--_0x1c0dfa){_0x4aadbd['push'](_0x4aadbd['shift']());}};_0x5bd5a9(++_0x5714d3);}(_0x2945,0xef));var _0x5294=function(_0x2b23ab,_0x5ed076){_0x2b23ab=_0x2b23ab-0x0;var _0x36414c=_0x2945[_0x2b23ab];return _0x36414c;};'use strict';var _=require(_0x5294('0x0'));var util=require('util');var logger=require(_0x5294('0x1'))(_0x5294('0x2'));var moment=require('moment');var BPromise=require(_0x5294('0x3'));var rp=require(_0x5294('0x4'));var fs=require('fs');var path=require(_0x5294('0x5'));var rimraf=require(_0x5294('0x6'));var config=require(_0x5294('0x7'));var attributes=require(_0x5294('0x8'));module[_0x5294('0x9')]=function(_0x1e0e8a,_0x5667b0){return _0x1e0e8a[_0x5294('0xa')](_0x5294('0xb'),attributes,{'tableName':_0x5294('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7734=['exports','define','tools_conditions','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./condition.attributes'];(function(_0x393347,_0x30e5c3){var _0x21fea3=function(_0x37d35f){while(--_0x37d35f){_0x393347['push'](_0x393347['shift']());}};_0x21fea3(++_0x30e5c3);}(_0x7734,0xf3));var _0x4773=function(_0x2fc4d2,_0x363b07){_0x2fc4d2=_0x2fc4d2-0x0;var _0x573de8=_0x7734[_0x2fc4d2];return _0x573de8;};'use strict';var _=require(_0x4773('0x0'));var util=require('util');var logger=require(_0x4773('0x1'))(_0x4773('0x2'));var moment=require(_0x4773('0x3'));var BPromise=require(_0x4773('0x4'));var rp=require(_0x4773('0x5'));var fs=require('fs');var path=require(_0x4773('0x6'));var rimraf=require('rimraf');var config=require(_0x4773('0x7'));var attributes=require(_0x4773('0x8'));module[_0x4773('0x9')]=function(_0xb52d41,_0x31c932){return _0xb52d41[_0x4773('0xa')]('Condition',attributes,{'tableName':_0x4773('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 680e700..aa06462 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 _0x6031=['../../config/environment','http','request','info','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','Condition,\x20%s,\x20%s','result','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc'];(function(_0x323163,_0x2d6465){var _0x269520=function(_0x20994f){while(--_0x20994f){_0x323163['push'](_0x323163['shift']());}};_0x269520(++_0x2d6465);}(_0x6031,0x71));var _0x1603=function(_0x58e7d7,_0x3a9929){_0x58e7d7=_0x58e7d7-0x0;var _0x1bef4e=_0x6031[_0x58e7d7];return _0x1bef4e;};'use strict';var _=require(_0x1603('0x0'));var util=require('util');var moment=require(_0x1603('0x1'));var BPromise=require(_0x1603('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1603('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1603('0x4'))(_0x1603('0x5'));var config=require(_0x1603('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1603('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1f547b,_0x227771,_0x726d20){return new BPromise(function(_0x3a1530,_0x3e7294){return client[_0x1603('0x8')](_0x1f547b,_0x726d20)['then'](function(_0x4ad9f8){logger[_0x1603('0x9')]('Condition,\x20%s,\x20%s',_0x227771,'request\x20sent');logger[_0x1603('0xa')](_0x1603('0xb'),_0x227771,_0x1603('0xc'),JSON['stringify'](_0x4ad9f8));if(_0x4ad9f8[_0x1603('0xd')]){if(_0x4ad9f8[_0x1603('0xd')]['code']===0x1f4){logger['error']('Condition,\x20%s,\x20%s',_0x227771,_0x4ad9f8[_0x1603('0xd')][_0x1603('0xe')]);return _0x3e7294(_0x4ad9f8['error'][_0x1603('0xe')]);}logger[_0x1603('0xd')](_0x1603('0xf'),_0x227771,_0x4ad9f8[_0x1603('0xd')][_0x1603('0xe')]);return _0x3a1530(_0x4ad9f8['error']['message']);}else{logger[_0x1603('0x9')](_0x1603('0xf'),_0x227771,_0x1603('0xc'));_0x3a1530(_0x4ad9f8[_0x1603('0x10')]['message']);}})['catch'](function(_0x1904b5){logger[_0x1603('0xd')](_0x1603('0xf'),_0x227771,_0x1904b5);_0x3e7294(_0x1904b5);});});} \ No newline at end of file +var _0xf053=['error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x5c8006,_0xe604b8){var _0x46b473=function(_0x4453ee){while(--_0x4453ee){_0x5c8006['push'](_0x5c8006['shift']());}};_0x46b473(++_0xe604b8);}(_0xf053,0x139));var _0x3f05=function(_0x230432,_0x5a4db6){_0x230432=_0x230432-0x0;var _0x13bbfb=_0xf053[_0x230432];return _0x13bbfb;};'use strict';var _=require(_0x3f05('0x0'));var util=require('util');var moment=require(_0x3f05('0x1'));var BPromise=require(_0x3f05('0x2'));var rs=require(_0x3f05('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3f05('0x4'))['db'];var utils=require(_0x3f05('0x5'));var logger=require(_0x3f05('0x6'))(_0x3f05('0x7'));var config=require(_0x3f05('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3f05('0x9')][_0x3f05('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x596889,_0x466278,_0x184363){return new BPromise(function(_0x5d2b54,_0x3e5f8b){return client[_0x3f05('0xb')](_0x596889,_0x184363)[_0x3f05('0xc')](function(_0x26b5d5){logger[_0x3f05('0xd')](_0x3f05('0xe'),_0x466278,_0x3f05('0xf'));logger['debug']('Condition,\x20%s,\x20%s,\x20%s',_0x466278,_0x3f05('0xf'),JSON[_0x3f05('0x10')](_0x26b5d5));if(_0x26b5d5[_0x3f05('0x11')]){if(_0x26b5d5[_0x3f05('0x11')][_0x3f05('0x12')]===0x1f4){logger[_0x3f05('0x11')](_0x3f05('0xe'),_0x466278,_0x26b5d5[_0x3f05('0x11')][_0x3f05('0x13')]);return _0x3e5f8b(_0x26b5d5[_0x3f05('0x11')][_0x3f05('0x13')]);}logger[_0x3f05('0x11')](_0x3f05('0xe'),_0x466278,_0x26b5d5[_0x3f05('0x11')][_0x3f05('0x13')]);return _0x5d2b54(_0x26b5d5['error'][_0x3f05('0x13')]);}else{logger['info'](_0x3f05('0xe'),_0x466278,_0x3f05('0xf'));_0x5d2b54(_0x26b5d5[_0x3f05('0x14')]['message']);}})[_0x3f05('0x15')](function(_0x3bd7f0){logger['error'](_0x3f05('0xe'),_0x466278,_0x3bd7f0);_0x3e5f8b(_0x3bd7f0);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index e148cd1..01e8461 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 _0x59c2=['put','/:id','isAuthenticated','update','delete','destroy','exports','multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller'];(function(_0x1bfcca,_0x28b479){var _0x4dce81=function(_0x24f7ea){while(--_0x24f7ea){_0x1bfcca['push'](_0x1bfcca['shift']());}};_0x4dce81(++_0x28b479);}(_0x59c2,0x103));var _0x259c=function(_0x1e48d3,_0x5d8c43){_0x1e48d3=_0x1e48d3-0x0;var _0x2852b1=_0x59c2[_0x1e48d3];return _0x2852b1;};'use strict';var multer=require(_0x259c('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x259c('0x1')]();var fs_extra=require(_0x259c('0x2'));var auth=require(_0x259c('0x3'));var interaction=require(_0x259c('0x4'));var config=require(_0x259c('0x5'));var controller=require(_0x259c('0x6'));router[_0x259c('0x7')](_0x259c('0x8'),auth[_0x259c('0x9')](),controller[_0x259c('0xa')]);router[_0x259c('0xb')]('/:id',auth[_0x259c('0x9')](),controller[_0x259c('0xc')]);module[_0x259c('0xd')]=router; \ No newline at end of file +var _0xbd85=['update','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','put','isAuthenticated'];(function(_0x46f3f8,_0x12c74b){var _0xbc57cd=function(_0x34df37){while(--_0x34df37){_0x46f3f8['push'](_0x46f3f8['shift']());}};_0xbc57cd(++_0x12c74b);}(_0xbd85,0x1f0));var _0x5bd8=function(_0x718f1f,_0x2e2338){_0x718f1f=_0x718f1f-0x0;var _0x48b289=_0xbd85[_0x718f1f];return _0x48b289;};'use strict';var multer=require('multer');var util=require(_0x5bd8('0x0'));var path=require(_0x5bd8('0x1'));var timeout=require(_0x5bd8('0x2'));var express=require(_0x5bd8('0x3'));var router=express[_0x5bd8('0x4')]();var fs_extra=require(_0x5bd8('0x5'));var auth=require(_0x5bd8('0x6'));var interaction=require(_0x5bd8('0x7'));var config=require(_0x5bd8('0x8'));var controller=require('./condition.controller');router[_0x5bd8('0x9')]('/:id',auth[_0x5bd8('0xa')](),controller[_0x5bd8('0xb')]);router['delete']('/:id',auth[_0x5bd8('0xa')](),controller['destroy']);module[_0x5bd8('0xc')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index c45f967..9309612 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 _0xa374=['name','INTEGER','exports'];(function(_0x33b2bd,_0x1ef479){var _0xba7d57=function(_0x443b3f){while(--_0x443b3f){_0x33b2bd['push'](_0x33b2bd['shift']());}};_0xba7d57(++_0x1ef479);}(_0xa374,0xe0));var _0x4a37=function(_0x3b5efe,_0x2752ce){_0x3b5efe=_0x3b5efe-0x0;var _0x9a1dce=_0xa374[_0x3b5efe];return _0x9a1dce;};'use strict';var Sequelize=require('sequelize');module[_0x4a37('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4a37('0x1')},'OrderBy':{'type':Sequelize[_0x4a37('0x2')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xc626=['STRING','name','INTEGER'];(function(_0x343816,_0x1eb1b8){var _0x47af8f=function(_0x11db3c){while(--_0x11db3c){_0x343816['push'](_0x343816['shift']());}};_0x47af8f(++_0x1eb1b8);}(_0xc626,0x6d));var _0x6c62=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc626[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x6c62('0x0')},'OrderBy':{'type':Sequelize[_0x6c62('0x1')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x6c62('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 1707108..4ad66ac 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 _0x351d=['path','to-csv','ejs','fs-extra','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','end','status','json','limit','count','offset','apply','reject','save','update','destroy','then','get','ContactItemTypes','error','stack','name','send','map','ContactItemType','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','rows','catch','show','length','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util'];(function(_0x23fd4d,_0x49dd20){var _0x2d7f84=function(_0x58959c){while(--_0x58959c){_0x23fd4d['push'](_0x23fd4d['shift']());}};_0x2d7f84(++_0x49dd20);}(_0x351d,0x90));var _0xd351=function(_0x15e860,_0x2b0fa8){_0x15e860=_0x15e860-0x0;var _0x11e969=_0x351d[_0x15e860];return _0x11e969;};'use strict';var emlformat=require(_0xd351('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd351('0x1'));var jsonpatch=require(_0xd351('0x2'));var rp=require(_0xd351('0x3'));var moment=require('moment');var BPromise=require(_0xd351('0x4'));var Mustache=require('mustache');var util=require(_0xd351('0x5'));var path=require(_0xd351('0x6'));var sox=require('sox');var csv=require(_0xd351('0x7'));var ejs=require(_0xd351('0x8'));var fs=require('fs');var fs_extra=require(_0xd351('0x9'));var _=require('lodash');var squel=require(_0xd351('0xa'));var crypto=require(_0xd351('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd351('0xc'));var toCsv=require(_0xd351('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd351('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xd351('0xe'));var as=require(_0xd351('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd351('0x10'))(_0xd351('0x11'));var utils=require('../../config/utils');var config=require(_0xd351('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3eb40c,_0x15549a){_0x15549a=_0x15549a||0xcc;return function(_0x23445f){if(_0x23445f){return _0x3eb40c[_0xd351('0x13')](_0x15549a);}return _0x3eb40c['status'](_0x15549a)[_0xd351('0x14')]();};}function respondWithResult(_0x316cf6,_0x597d7c){_0x597d7c=_0x597d7c||0xc8;return function(_0xc5a145){if(_0xc5a145){return _0x316cf6[_0xd351('0x15')](_0x597d7c)[_0xd351('0x16')](_0xc5a145);}};}function respondWithFilteredResult(_0xf1c285,_0x3867fb){return function(_0x4d238c){if(_0x4d238c){var _0x9f790f=typeof _0x3867fb['offset']==='undefined'&&typeof _0x3867fb[_0xd351('0x17')]==='undefined';var _0x21e591=_0x4d238c[_0xd351('0x18')];var _0x4e0164=_0x9f790f?0x0:_0x3867fb['offset'];var _0x1e1a3c=_0x9f790f?_0x4d238c[_0xd351('0x18')]:_0x3867fb[_0xd351('0x19')]+_0x3867fb[_0xd351('0x17')];var _0x51f265;if(_0x1e1a3c>=_0x21e591){_0x1e1a3c=_0x21e591;_0x51f265=0xc8;}else{_0x51f265=0xce;}_0xf1c285[_0xd351('0x15')](_0x51f265);return _0xf1c285['set']('Content-Range',_0x4e0164+'-'+_0x1e1a3c+'/'+_0x21e591)[_0xd351('0x16')](_0x4d238c);}return null;};}function patchUpdates(_0x4a427b){return function(_0x33b1e5){try{jsonpatch[_0xd351('0x1a')](_0x33b1e5,_0x4a427b,!![]);}catch(_0x3634c9){return BPromise[_0xd351('0x1b')](_0x3634c9);}return _0x33b1e5[_0xd351('0x1c')]();};}function saveUpdates(_0x53e729,_0x18625b){return function(_0xbbc58){if(_0xbbc58){return _0xbbc58[_0xd351('0x1d')](_0x53e729)['then'](function(_0x1ce7f7){return _0x1ce7f7;});}return null;};}function removeEntity(_0x2d9aa0,_0x365bbc){return function(_0x59fb6d){if(_0x59fb6d){return _0x59fb6d[_0xd351('0x1e')]()[_0xd351('0x1f')](function(){var _0x4626c4=_0x59fb6d[_0xd351('0x20')]({'plain':!![]});var _0x489c9a=_0xd351('0x21');return db['UserProfileResource'][_0xd351('0x1e')]({'where':{'type':_0x489c9a,'resourceId':_0x4626c4['id']}})[_0xd351('0x1f')](function(){return _0x59fb6d;});})['then'](function(){_0x2d9aa0[_0xd351('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50d67e,_0x1d0cb1){return function(_0x560be9){if(!_0x560be9){_0x50d67e['sendStatus'](0x194);}return _0x560be9;};}function handleError(_0x134580,_0x555a50){_0x555a50=_0x555a50||0x1f4;return function(_0x38471c){logger[_0xd351('0x22')](_0x38471c[_0xd351('0x23')]);if(_0x38471c['name']){delete _0x38471c[_0xd351('0x24')];}_0x134580['status'](_0x555a50)[_0xd351('0x25')](_0x38471c);};}exports['index']=function(_0x5f07b1,_0xeb4da9){var _0x38c82f={},_0x3f9ef3={},_0x33b43d={'count':0x0,'rows':[]};var _0x48aa96=_[_0xd351('0x26')](db[_0xd351('0x27')][_0xd351('0x28')],function(_0x41da60){return{'name':_0x41da60[_0xd351('0x29')],'type':_0x41da60[_0xd351('0x2a')][_0xd351('0x2b')]};});_0x3f9ef3[_0xd351('0x2c')]=_[_0xd351('0x26')](_0x48aa96,'name');_0x3f9ef3[_0xd351('0x2d')]=_[_0xd351('0x2e')](_0x5f07b1[_0xd351('0x2d')]);_0x3f9ef3[_0xd351('0x2f')]=_['intersection'](_0x3f9ef3[_0xd351('0x2c')],_0x3f9ef3[_0xd351('0x2d')]);_0x38c82f[_0xd351('0x30')]=_[_0xd351('0x31')](_0x3f9ef3[_0xd351('0x2c')],qs[_0xd351('0x32')](_0x5f07b1[_0xd351('0x2d')][_0xd351('0x32')]));_0x38c82f[_0xd351('0x30')]=_0x38c82f['attributes']['length']?_0x38c82f[_0xd351('0x30')]:_0x3f9ef3[_0xd351('0x2c')];if(!_0x5f07b1[_0xd351('0x2d')][_0xd351('0x33')](_0xd351('0x34'))){_0x38c82f[_0xd351('0x17')]=qs['limit'](_0x5f07b1['query'][_0xd351('0x17')]);_0x38c82f['offset']=qs[_0xd351('0x19')](_0x5f07b1[_0xd351('0x2d')][_0xd351('0x19')]);}_0x38c82f[_0xd351('0x35')]=qs[_0xd351('0x36')](_0x5f07b1[_0xd351('0x2d')][_0xd351('0x36')]);_0x38c82f[_0xd351('0x37')]=qs[_0xd351('0x2f')](_[_0xd351('0x38')](_0x5f07b1[_0xd351('0x2d')],_0x3f9ef3['filters']),_0x48aa96);if(_0x5f07b1[_0xd351('0x2d')]['filter']){_0x38c82f[_0xd351('0x37')]=_[_0xd351('0x39')](_0x38c82f[_0xd351('0x37')],{'$or':_[_0xd351('0x26')](_0x48aa96,function(_0x3b42e7){if(_0x3b42e7[_0xd351('0x2a')]!=='VIRTUAL'){var _0x3ad98e={};_0x3ad98e[_0x3b42e7[_0xd351('0x24')]]={'$like':'%'+_0x5f07b1['query'][_0xd351('0x3a')]+'%'};return _0x3ad98e;}})});}_0x38c82f=_[_0xd351('0x39')]({},_0x38c82f,_0x5f07b1[_0xd351('0x3b')]);var _0x1fc216={'where':_0x38c82f[_0xd351('0x37')]};return db['ContactItemType']['count'](_0x1fc216)[_0xd351('0x1f')](function(_0x3935aa){_0x33b43d['count']=_0x3935aa;if(_0x5f07b1['query'][_0xd351('0x3c')]){_0x38c82f[_0xd351('0x3d')]=[{'all':!![]}];}return db['ContactItemType']['findAll'](_0x38c82f);})[_0xd351('0x1f')](function(_0x18f9d1){_0x33b43d[_0xd351('0x3e')]=_0x18f9d1;return _0x33b43d;})[_0xd351('0x1f')](respondWithFilteredResult(_0xeb4da9,_0x38c82f))[_0xd351('0x3f')](handleError(_0xeb4da9,null));};exports[_0xd351('0x40')]=function(_0x6192c3,_0x110458){var _0x129605={'raw':!![],'where':{'id':_0x6192c3['params']['id']}},_0x553360={};_0x553360[_0xd351('0x2c')]=_[_0xd351('0x2e')](db[_0xd351('0x27')][_0xd351('0x28')]);_0x553360[_0xd351('0x2d')]=_[_0xd351('0x2e')](_0x6192c3[_0xd351('0x2d')]);_0x553360[_0xd351('0x2f')]=_[_0xd351('0x31')](_0x553360[_0xd351('0x2c')],_0x553360[_0xd351('0x2d')]);_0x129605[_0xd351('0x30')]=_[_0xd351('0x31')](_0x553360[_0xd351('0x2c')],qs[_0xd351('0x32')](_0x6192c3[_0xd351('0x2d')]['fields']));_0x129605[_0xd351('0x30')]=_0x129605[_0xd351('0x30')][_0xd351('0x41')]?_0x129605['attributes']:_0x553360[_0xd351('0x2c')];if(_0x6192c3[_0xd351('0x2d')][_0xd351('0x3c')]){_0x129605[_0xd351('0x3d')]=[{'all':!![]}];}_0x129605=_[_0xd351('0x39')]({},_0x129605,_0x6192c3['options']);return db[_0xd351('0x27')]['find'](_0x129605)[_0xd351('0x1f')](handleEntityNotFound(_0x110458,null))[_0xd351('0x1f')](respondWithResult(_0x110458,null))['catch'](handleError(_0x110458,null));};exports['create']=function(_0x1bd727,_0x444206){return db[_0xd351('0x27')]['create'](_0x1bd727[_0xd351('0x42')],{})[_0xd351('0x1f')](function(_0x548d90){var _0xf3ce5=_0x1bd727['user'][_0xd351('0x20')]({'plain':!![]});if(!_0xf3ce5)throw new Error(_0xd351('0x43'));if(_0xf3ce5['role']==='user'){var _0x25ea1e=_0x548d90['get']({'plain':!![]});var _0xf9f375=_0xd351('0x21');return db[_0xd351('0x44')]['find']({'where':{'name':_0xf9f375,'userProfileId':_0xf3ce5[_0xd351('0x45')]},'raw':!![]})['then'](function(_0x5527da){if(_0x5527da&&_0x5527da['autoAssociation']===0x0){return db[_0xd351('0x46')][_0xd351('0x47')]({'name':_0x25ea1e[_0xd351('0x24')],'resourceId':_0x25ea1e['id'],'type':_0x5527da['name'],'sectionId':_0x5527da['id']},{})['then'](function(){return _0x548d90;});}else{return _0x548d90;}})[_0xd351('0x3f')](function(_0x42f248){logger['error'](_0xd351('0x48'),_0x42f248);throw _0x42f248;});}return _0x548d90;})[_0xd351('0x1f')](respondWithResult(_0x444206,0xc9))['catch'](handleError(_0x444206,null));};exports[_0xd351('0x1d')]=function(_0x59ab0f,_0x22394e){if(_0x59ab0f['body']['id']){delete _0x59ab0f[_0xd351('0x42')]['id'];}return db[_0xd351('0x27')][_0xd351('0x49')]({'where':{'id':_0x59ab0f[_0xd351('0x4a')]['id']}})[_0xd351('0x1f')](handleEntityNotFound(_0x22394e,null))[_0xd351('0x1f')](saveUpdates(_0x59ab0f[_0xd351('0x42')],null))['then'](respondWithResult(_0x22394e,null))['catch'](handleError(_0x22394e,null));};exports[_0xd351('0x1e')]=function(_0x624224,_0x53a9da){return db[_0xd351('0x27')][_0xd351('0x49')]({'where':{'id':_0x624224[_0xd351('0x4a')]['id']}})['then'](handleEntityNotFound(_0x53a9da,null))[_0xd351('0x1f')](db['CmContactHasItem']['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x624224[_0xd351('0x4a')]['id']}}))[_0xd351('0x1f')](removeEntity(_0x53a9da,null))['catch'](handleError(_0x53a9da,null));}; \ No newline at end of file +var _0x6343=['status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','get','ContactItemTypes','UserProfileResource','then','error','name','send','map','ContactItemType','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','CmContactHasItem','zip-dir','fast-json-patch','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x24adf7,_0x386eab){var _0x509de7=function(_0x2555c2){while(--_0x2555c2){_0x24adf7['push'](_0x24adf7['shift']());}};_0x509de7(++_0x386eab);}(_0x6343,0x168));var _0x3634=function(_0x5759ca,_0x2fb955){_0x5759ca=_0x5759ca-0x0;var _0x1aa750=_0x6343[_0x5759ca];return _0x1aa750;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3634('0x0'));var jsonpatch=require(_0x3634('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3634('0x2'));var path=require(_0x3634('0x3'));var sox=require('sox');var csv=require(_0x3634('0x4'));var ejs=require(_0x3634('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3634('0x6'));var squel=require(_0x3634('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3634('0x8'));var toCsv=require(_0x3634('0x4'));var querystring=require(_0x3634('0x9'));var Papa=require(_0x3634('0xa'));var Redis=require(_0x3634('0xb'));var authService=require(_0x3634('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3634('0xd'));var logger=require(_0x3634('0xe'))('api');var utils=require(_0x3634('0xf'));var config=require(_0x3634('0x10'));var licenseUtil=require(_0x3634('0x11'));var db=require(_0x3634('0x12'))['db'];function respondWithStatusCode(_0x1e6a04,_0x151c8c){_0x151c8c=_0x151c8c||0xcc;return function(_0x35ae07){if(_0x35ae07){return _0x1e6a04[_0x3634('0x13')](_0x151c8c);}return _0x1e6a04[_0x3634('0x14')](_0x151c8c)[_0x3634('0x15')]();};}function respondWithResult(_0x299e53,_0x71d09b){_0x71d09b=_0x71d09b||0xc8;return function(_0x7e4801){if(_0x7e4801){return _0x299e53[_0x3634('0x14')](_0x71d09b)['json'](_0x7e4801);}};}function respondWithFilteredResult(_0x167247,_0x48787f){return function(_0x69609d){if(_0x69609d){var _0x18285c=typeof _0x48787f[_0x3634('0x16')]===_0x3634('0x17')&&typeof _0x48787f[_0x3634('0x18')]==='undefined';var _0x3121a3=_0x69609d['count'];var _0x50350d=_0x18285c?0x0:_0x48787f[_0x3634('0x16')];var _0x4b2115=_0x18285c?_0x69609d[_0x3634('0x19')]:_0x48787f[_0x3634('0x16')]+_0x48787f[_0x3634('0x18')];var _0x5603d2;if(_0x4b2115>=_0x3121a3){_0x4b2115=_0x3121a3;_0x5603d2=0xc8;}else{_0x5603d2=0xce;}_0x167247[_0x3634('0x14')](_0x5603d2);return _0x167247[_0x3634('0x1a')]('Content-Range',_0x50350d+'-'+_0x4b2115+'/'+_0x3121a3)[_0x3634('0x1b')](_0x69609d);}return null;};}function patchUpdates(_0x506281){return function(_0x742e56){try{jsonpatch[_0x3634('0x1c')](_0x742e56,_0x506281,!![]);}catch(_0x5b77a7){return BPromise[_0x3634('0x1d')](_0x5b77a7);}return _0x742e56[_0x3634('0x1e')]();};}function saveUpdates(_0x206c8e,_0x505026){return function(_0x22b7ef){if(_0x22b7ef){return _0x22b7ef[_0x3634('0x1f')](_0x206c8e)['then'](function(_0x3936ee){return _0x3936ee;});}return null;};}function removeEntity(_0x596acb,_0x5e9188){return function(_0x3a8c41){if(_0x3a8c41){return _0x3a8c41[_0x3634('0x20')]()['then'](function(){var _0x1b25be=_0x3a8c41[_0x3634('0x21')]({'plain':!![]});var _0x17db44=_0x3634('0x22');return db[_0x3634('0x23')][_0x3634('0x20')]({'where':{'type':_0x17db44,'resourceId':_0x1b25be['id']}})[_0x3634('0x24')](function(){return _0x3a8c41;});})[_0x3634('0x24')](function(){_0x596acb[_0x3634('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b0a44,_0x552cc3){return function(_0x58841d){if(!_0x58841d){_0x1b0a44['sendStatus'](0x194);}return _0x58841d;};}function handleError(_0x7a35c4,_0x576977){_0x576977=_0x576977||0x1f4;return function(_0x3bf28b){logger[_0x3634('0x25')](_0x3bf28b['stack']);if(_0x3bf28b['name']){delete _0x3bf28b[_0x3634('0x26')];}_0x7a35c4['status'](_0x576977)[_0x3634('0x27')](_0x3bf28b);};}exports['index']=function(_0x1e04cc,_0x3d7322){var _0x1d88f7={},_0x17a0fd={},_0x1f46d9={'count':0x0,'rows':[]};var _0x20b062=_[_0x3634('0x28')](db[_0x3634('0x29')]['rawAttributes'],function(_0x535215){return{'name':_0x535215['fieldName'],'type':_0x535215[_0x3634('0x2a')]['key']};});_0x17a0fd[_0x3634('0x2b')]=_[_0x3634('0x28')](_0x20b062,_0x3634('0x26'));_0x17a0fd[_0x3634('0x2c')]=_[_0x3634('0x2d')](_0x1e04cc[_0x3634('0x2c')]);_0x17a0fd['filters']=_[_0x3634('0x2e')](_0x17a0fd[_0x3634('0x2b')],_0x17a0fd[_0x3634('0x2c')]);_0x1d88f7[_0x3634('0x2f')]=_[_0x3634('0x2e')](_0x17a0fd[_0x3634('0x2b')],qs[_0x3634('0x30')](_0x1e04cc[_0x3634('0x2c')][_0x3634('0x30')]));_0x1d88f7['attributes']=_0x1d88f7[_0x3634('0x2f')][_0x3634('0x31')]?_0x1d88f7[_0x3634('0x2f')]:_0x17a0fd[_0x3634('0x2b')];if(!_0x1e04cc['query'][_0x3634('0x32')](_0x3634('0x33'))){_0x1d88f7[_0x3634('0x18')]=qs['limit'](_0x1e04cc['query']['limit']);_0x1d88f7[_0x3634('0x16')]=qs[_0x3634('0x16')](_0x1e04cc['query'][_0x3634('0x16')]);}_0x1d88f7[_0x3634('0x34')]=qs[_0x3634('0x35')](_0x1e04cc[_0x3634('0x2c')][_0x3634('0x35')]);_0x1d88f7[_0x3634('0x36')]=qs[_0x3634('0x37')](_['pick'](_0x1e04cc[_0x3634('0x2c')],_0x17a0fd['filters']),_0x20b062);if(_0x1e04cc[_0x3634('0x2c')][_0x3634('0x38')]){_0x1d88f7[_0x3634('0x36')]=_[_0x3634('0x39')](_0x1d88f7[_0x3634('0x36')],{'$or':_['map'](_0x20b062,function(_0x10ff70){if(_0x10ff70[_0x3634('0x2a')]!==_0x3634('0x3a')){var _0x242a6c={};_0x242a6c[_0x10ff70[_0x3634('0x26')]]={'$like':'%'+_0x1e04cc[_0x3634('0x2c')][_0x3634('0x38')]+'%'};return _0x242a6c;}})});}_0x1d88f7=_[_0x3634('0x39')]({},_0x1d88f7,_0x1e04cc[_0x3634('0x3b')]);var _0x523555={'where':_0x1d88f7['where']};return db[_0x3634('0x29')]['count'](_0x523555)['then'](function(_0x5948db){_0x1f46d9[_0x3634('0x19')]=_0x5948db;if(_0x1e04cc['query'][_0x3634('0x3c')]){_0x1d88f7[_0x3634('0x3d')]=[{'all':!![]}];}return db['ContactItemType']['findAll'](_0x1d88f7);})['then'](function(_0x324970){_0x1f46d9[_0x3634('0x3e')]=_0x324970;return _0x1f46d9;})['then'](respondWithFilteredResult(_0x3d7322,_0x1d88f7))[_0x3634('0x3f')](handleError(_0x3d7322,null));};exports[_0x3634('0x40')]=function(_0x3ff2fb,_0x18ce5a){var _0x123a91={'raw':!![],'where':{'id':_0x3ff2fb['params']['id']}},_0x5f0711={};_0x5f0711[_0x3634('0x2b')]=_[_0x3634('0x2d')](db[_0x3634('0x29')][_0x3634('0x41')]);_0x5f0711[_0x3634('0x2c')]=_[_0x3634('0x2d')](_0x3ff2fb['query']);_0x5f0711[_0x3634('0x37')]=_[_0x3634('0x2e')](_0x5f0711[_0x3634('0x2b')],_0x5f0711['query']);_0x123a91['attributes']=_[_0x3634('0x2e')](_0x5f0711[_0x3634('0x2b')],qs[_0x3634('0x30')](_0x3ff2fb[_0x3634('0x2c')][_0x3634('0x30')]));_0x123a91[_0x3634('0x2f')]=_0x123a91[_0x3634('0x2f')][_0x3634('0x31')]?_0x123a91['attributes']:_0x5f0711[_0x3634('0x2b')];if(_0x3ff2fb[_0x3634('0x2c')][_0x3634('0x3c')]){_0x123a91[_0x3634('0x3d')]=[{'all':!![]}];}_0x123a91=_[_0x3634('0x39')]({},_0x123a91,_0x3ff2fb[_0x3634('0x3b')]);return db[_0x3634('0x29')][_0x3634('0x42')](_0x123a91)[_0x3634('0x24')](handleEntityNotFound(_0x18ce5a,null))['then'](respondWithResult(_0x18ce5a,null))[_0x3634('0x3f')](handleError(_0x18ce5a,null));};exports[_0x3634('0x43')]=function(_0x4a4a94,_0x3c356b){return db[_0x3634('0x29')][_0x3634('0x43')](_0x4a4a94[_0x3634('0x44')],{})[_0x3634('0x24')](function(_0x1ca58d){var _0x5cc8d1=_0x4a4a94[_0x3634('0x45')][_0x3634('0x21')]({'plain':!![]});if(!_0x5cc8d1)throw new Error(_0x3634('0x46'));if(_0x5cc8d1[_0x3634('0x47')]===_0x3634('0x45')){var _0x582475=_0x1ca58d[_0x3634('0x21')]({'plain':!![]});var _0x20f9f8='ContactItemTypes';return db['UserProfileSection'][_0x3634('0x42')]({'where':{'name':_0x20f9f8,'userProfileId':_0x5cc8d1['userProfileId']},'raw':!![]})[_0x3634('0x24')](function(_0x475b37){if(_0x475b37&&_0x475b37[_0x3634('0x48')]===0x0){return db[_0x3634('0x23')]['create']({'name':_0x582475[_0x3634('0x26')],'resourceId':_0x582475['id'],'type':_0x475b37[_0x3634('0x26')],'sectionId':_0x475b37['id']},{})[_0x3634('0x24')](function(){return _0x1ca58d;});}else{return _0x1ca58d;}})[_0x3634('0x3f')](function(_0x1ac9a9){logger[_0x3634('0x25')](_0x3634('0x49'),_0x1ac9a9);throw _0x1ac9a9;});}return _0x1ca58d;})[_0x3634('0x24')](respondWithResult(_0x3c356b,0xc9))[_0x3634('0x3f')](handleError(_0x3c356b,null));};exports[_0x3634('0x1f')]=function(_0xcedbb6,_0x4265eb){if(_0xcedbb6['body']['id']){delete _0xcedbb6[_0x3634('0x44')]['id'];}return db[_0x3634('0x29')][_0x3634('0x42')]({'where':{'id':_0xcedbb6[_0x3634('0x4a')]['id']}})[_0x3634('0x24')](handleEntityNotFound(_0x4265eb,null))[_0x3634('0x24')](saveUpdates(_0xcedbb6[_0x3634('0x44')],null))[_0x3634('0x24')](respondWithResult(_0x4265eb,null))[_0x3634('0x3f')](handleError(_0x4265eb,null));};exports['destroy']=function(_0x2bcb9e,_0x2ea4b0){return db['ContactItemType'][_0x3634('0x42')]({'where':{'id':_0x2bcb9e[_0x3634('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2ea4b0,null))[_0x3634('0x24')](db[_0x3634('0x4b')][_0x3634('0x1f')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x2bcb9e['params']['id']}}))[_0x3634('0x24')](removeEntity(_0x2ea4b0,null))['catch'](handleError(_0x2ea4b0,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 66b588e..bc515de 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 _0xdeea=['request-promise','path','../../config/environment','./contactItemType.attributes','exports','ContactItemType','lodash','util','moment','bluebird'];(function(_0x4abb57,_0xb659e3){var _0x5f0371=function(_0x503c2a){while(--_0x503c2a){_0x4abb57['push'](_0x4abb57['shift']());}};_0x5f0371(++_0xb659e3);}(_0xdeea,0xf6));var _0xadee=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0xdeea[_0x44bcb0];return _0xfaf881;};'use strict';var _=require(_0xadee('0x0'));var util=require(_0xadee('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xadee('0x2'));var BPromise=require(_0xadee('0x3'));var rp=require(_0xadee('0x4'));var fs=require('fs');var path=require(_0xadee('0x5'));var rimraf=require('rimraf');var config=require(_0xadee('0x6'));var attributes=require(_0xadee('0x7'));module[_0xadee('0x8')]=function(_0x5a72ae,_0x504b82){return _0x5a72ae['define'](_0xadee('0x9'),attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f5a=['bluebird','../../config/environment','./contactItemType.attributes','exports','ContactItemType','tools_contact_item_types','lodash','../../config/logger','api'];(function(_0x5bfaff,_0x51986a){var _0xb2c0ca=function(_0x17be31){while(--_0x17be31){_0x5bfaff['push'](_0x5bfaff['shift']());}};_0xb2c0ca(++_0x51986a);}(_0x2f5a,0x153));var _0xa2f5=function(_0x2646db,_0xb55473){_0x2646db=_0x2646db-0x0;var _0x3336f9=_0x2f5a[_0x2646db];return _0x3336f9;};'use strict';var _=require(_0xa2f5('0x0'));var util=require('util');var logger=require(_0xa2f5('0x1'))(_0xa2f5('0x2'));var moment=require('moment');var BPromise=require(_0xa2f5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa2f5('0x4'));var attributes=require(_0xa2f5('0x5'));module[_0xa2f5('0x6')]=function(_0x4b867a,_0x3055e5){return _0x4b867a['define'](_0xa2f5('0x7'),attributes,{'tableName':_0xa2f5('0x8'),'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 cdebd80..f1750e8 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 _0xa1aa=['request','info','ContactItemType,\x20%s,\x20%s','request\x20sent','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x38576d,_0x527dc7){var _0x32534a=function(_0x2fd590){while(--_0x2fd590){_0x38576d['push'](_0x38576d['shift']());}};_0x32534a(++_0x527dc7);}(_0xa1aa,0x81));var _0xaa1a=function(_0x19e570,_0x23be57){_0x19e570=_0x19e570-0x0;var _0x218c87=_0xa1aa[_0x19e570];return _0x218c87;};'use strict';var _=require(_0xaa1a('0x0'));var util=require(_0xaa1a('0x1'));var moment=require(_0xaa1a('0x2'));var BPromise=require('bluebird');var rs=require(_0xaa1a('0x3'));var fs=require('fs');var Redis=require(_0xaa1a('0x4'));var db=require(_0xaa1a('0x5'))['db'];var utils=require(_0xaa1a('0x6'));var logger=require(_0xaa1a('0x7'))('rpc');var config=require(_0xaa1a('0x8'));var jayson=require(_0xaa1a('0x9'));var client=jayson['client'][_0xaa1a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28d0a9,_0x4a20b6,_0x58d242){return new BPromise(function(_0x309dba,_0x12c5e8){return client[_0xaa1a('0xb')](_0x28d0a9,_0x58d242)['then'](function(_0x15b73b){logger[_0xaa1a('0xc')](_0xaa1a('0xd'),_0x4a20b6,_0xaa1a('0xe'));logger['debug'](_0xaa1a('0xf'),_0x4a20b6,_0xaa1a('0xe'),JSON[_0xaa1a('0x10')](_0x15b73b));if(_0x15b73b[_0xaa1a('0x11')]){if(_0x15b73b['error']['code']===0x1f4){logger[_0xaa1a('0x11')](_0xaa1a('0xd'),_0x4a20b6,_0x15b73b['error']['message']);return _0x12c5e8(_0x15b73b[_0xaa1a('0x11')]['message']);}logger['error'](_0xaa1a('0xd'),_0x4a20b6,_0x15b73b['error']['message']);return _0x309dba(_0x15b73b[_0xaa1a('0x11')][_0xaa1a('0x12')]);}else{logger['info']('ContactItemType,\x20%s,\x20%s',_0x4a20b6,_0xaa1a('0xe'));_0x309dba(_0x15b73b['result'][_0xaa1a('0x12')]);}})[_0xaa1a('0x13')](function(_0x318d02){logger[_0xaa1a('0x11')](_0xaa1a('0xd'),_0x4a20b6,_0x318d02);_0x12c5e8(_0x318d02);});});} \ No newline at end of file +var _0x23f2=['moment','randomstring','../../config/utils','rpc','../../config/environment','client','http','then','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x23f2,0x1a2));var _0x223f=function(_0x119da1,_0x111205){_0x119da1=_0x119da1-0x0;var _0x58efcf=_0x23f2[_0x119da1];return _0x58efcf;};'use strict';var _=require(_0x223f('0x0'));var util=require(_0x223f('0x1'));var moment=require(_0x223f('0x2'));var BPromise=require('bluebird');var rs=require(_0x223f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x223f('0x4'));var logger=require('../../config/logger')(_0x223f('0x5'));var config=require(_0x223f('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x223f('0x7')][_0x223f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4b4083,_0x2141c5,_0x44df6e){return new BPromise(function(_0x26a85a,_0x309ffc){return client['request'](_0x4b4083,_0x44df6e)[_0x223f('0x9')](function(_0x28bea4){logger['info'](_0x223f('0xa'),_0x2141c5,_0x223f('0xb'));logger[_0x223f('0xc')](_0x223f('0xd'),_0x2141c5,_0x223f('0xb'),JSON[_0x223f('0xe')](_0x28bea4));if(_0x28bea4[_0x223f('0xf')]){if(_0x28bea4[_0x223f('0xf')]['code']===0x1f4){logger[_0x223f('0xf')]('ContactItemType,\x20%s,\x20%s',_0x2141c5,_0x28bea4[_0x223f('0xf')][_0x223f('0x10')]);return _0x309ffc(_0x28bea4[_0x223f('0xf')]['message']);}logger[_0x223f('0xf')]('ContactItemType,\x20%s,\x20%s',_0x2141c5,_0x28bea4[_0x223f('0xf')][_0x223f('0x10')]);return _0x26a85a(_0x28bea4[_0x223f('0xf')][_0x223f('0x10')]);}else{logger[_0x223f('0x11')](_0x223f('0xa'),_0x2141c5,_0x223f('0xb'));_0x26a85a(_0x28bea4[_0x223f('0x12')][_0x223f('0x10')]);}})[_0x223f('0x13')](function(_0x33d573){logger[_0x223f('0xf')]('ContactItemType,\x20%s,\x20%s',_0x2141c5,_0x33d573);_0x309ffc(_0x33d573);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 914812b..5909cd5 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 _0x16ec=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./contactItemType.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','path'];(function(_0x2462d4,_0x243523){var _0x178eec=function(_0x524d05){while(--_0x524d05){_0x2462d4['push'](_0x2462d4['shift']());}};_0x178eec(++_0x243523);}(_0x16ec,0x1a1));var _0xc16e=function(_0x493c4c,_0x13c20e){_0x493c4c=_0x493c4c-0x0;var _0x52dab0=_0x16ec[_0x493c4c];return _0x52dab0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc16e('0x0'));var timeout=require(_0xc16e('0x1'));var express=require(_0xc16e('0x2'));var router=express[_0xc16e('0x3')]();var fs_extra=require(_0xc16e('0x4'));var auth=require(_0xc16e('0x5'));var interaction=require(_0xc16e('0x6'));var config=require('../../config/environment');var controller=require(_0xc16e('0x7'));router[_0xc16e('0x8')]('/',auth[_0xc16e('0x9')](),controller[_0xc16e('0xa')]);router['get'](_0xc16e('0xb'),auth[_0xc16e('0x9')](),controller[_0xc16e('0xc')]);router[_0xc16e('0xd')]('/',auth[_0xc16e('0x9')](),controller[_0xc16e('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc16e('0xf')]);router[_0xc16e('0x10')](_0xc16e('0xb'),auth[_0xc16e('0x9')](),controller[_0xc16e('0x11')]);module[_0xc16e('0x12')]=router; \ No newline at end of file +var _0x7a63=['isAuthenticated','create','put','update','delete','destroy','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id'];(function(_0x597992,_0x516580){var _0x2bea67=function(_0x40b79f){while(--_0x40b79f){_0x597992['push'](_0x597992['shift']());}};_0x2bea67(++_0x516580);}(_0x7a63,0x1a6));var _0x37a6=function(_0x47be19,_0x3eed1f){_0x47be19=_0x47be19-0x0;var _0x99a5ed=_0x7a63[_0x47be19];return _0x99a5ed;};'use strict';var multer=require(_0x37a6('0x0'));var util=require(_0x37a6('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x37a6('0x2'));var router=express[_0x37a6('0x3')]();var fs_extra=require(_0x37a6('0x4'));var auth=require(_0x37a6('0x5'));var interaction=require(_0x37a6('0x6'));var config=require('../../config/environment');var controller=require('./contactItemType.controller');router[_0x37a6('0x7')]('/',auth['isAuthenticated'](),controller[_0x37a6('0x8')]);router[_0x37a6('0x7')](_0x37a6('0x9'),auth[_0x37a6('0xa')](),controller['show']);router['post']('/',auth[_0x37a6('0xa')](),controller[_0x37a6('0xb')]);router[_0x37a6('0xc')](_0x37a6('0x9'),auth[_0x37a6('0xa')](),controller[_0x37a6('0xd')]);router[_0x37a6('0xe')](_0x37a6('0x9'),auth['isAuthenticated'](),controller[_0x37a6('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 492207d..030b7a8 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 _0xb7e7=['STRING','sequelize'];(function(_0x547456,_0x1de17e){var _0xc1fd7b=function(_0x12be35){while(--_0x12be35){_0x547456['push'](_0x547456['shift']());}};_0xc1fd7b(++_0x1de17e);}(_0xb7e7,0x121));var _0x7b7e=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xb7e7[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file +var _0x2032=['name','exports','STRING'];(function(_0x454c4f,_0x5c1feb){var _0x5af6f3=function(_0x1961fa){while(--_0x1961fa){_0x454c4f['push'](_0x454c4f['shift']());}};_0x5af6f3(++_0x5c1feb);}(_0x2032,0xd9));var _0x2203=function(_0x285dba,_0x384e54){_0x285dba=_0x285dba-0x0;var _0x26eb07=_0x2032[_0x285dba];return _0x26eb07;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 0576296..e02a8fb 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 _0x812a=['socket.io-emitter','./dashboard.socket','register','status','end','json','limit','undefined','count','offset','Content-Range','apply','save','then','get','CustomDashboards','UserProfileResource','destroy','error','stack','name','send','index','map','Dashboard','fieldName','type','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','rows','catch','show','params','model','rawAttributes','find','create','body','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','role','autoAssociation','update','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','voice','web-report','attrReport','attrRefresh','stringify','DashboardId','DashboardItem','getItems','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost'];(function(_0x2412c4,_0x1434e6){var _0x78f95b=function(_0x4c3de5){while(--_0x4c3de5){_0x2412c4['push'](_0x2412c4['shift']());}};_0x78f95b(++_0x1434e6);}(_0x812a,0x64));var _0xa812=function(_0x1bf5a9,_0xb20fae){_0x1bf5a9=_0x1bf5a9-0x0;var _0x1494b9=_0x812a[_0x1bf5a9];return _0x1494b9;};'use strict';var emlformat=require(_0xa812('0x0'));var rimraf=require(_0xa812('0x1'));var zipdir=require(_0xa812('0x2'));var jsonpatch=require(_0xa812('0x3'));var rp=require(_0xa812('0x4'));var moment=require(_0xa812('0x5'));var BPromise=require(_0xa812('0x6'));var Mustache=require('mustache');var util=require(_0xa812('0x7'));var path=require(_0xa812('0x8'));var sox=require(_0xa812('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa812('0xa'));var _=require(_0xa812('0xb'));var squel=require(_0xa812('0xc'));var crypto=require(_0xa812('0xd'));var jsforce=require(_0xa812('0xe'));var deskjs=require(_0xa812('0xf'));var toCsv=require(_0xa812('0x10'));var querystring=require(_0xa812('0x11'));var Papa=require('papaparse');var Redis=require(_0xa812('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa812('0x13'));var as=require(_0xa812('0x14'));var hardwareService=require(_0xa812('0x15'));var logger=require(_0xa812('0x16'))('api');var utils=require(_0xa812('0x17'));var config=require(_0xa812('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xa812('0x19'))['db'];config[_0xa812('0x1a')]=_[_0xa812('0x1b')](config['redis'],{'host':_0xa812('0x1c'),'port':0x18eb});var socket=require(_0xa812('0x1d'))(new Redis(config[_0xa812('0x1a')]));require(_0xa812('0x1e'))[_0xa812('0x1f')](socket);function respondWithStatusCode(_0x41c4f8,_0xd5005){_0xd5005=_0xd5005||0xcc;return function(_0x2f89ef){if(_0x2f89ef){return _0x41c4f8['sendStatus'](_0xd5005);}return _0x41c4f8[_0xa812('0x20')](_0xd5005)[_0xa812('0x21')]();};}function respondWithResult(_0x134cbb,_0x4fa496){_0x4fa496=_0x4fa496||0xc8;return function(_0x596a74){if(_0x596a74){return _0x134cbb[_0xa812('0x20')](_0x4fa496)[_0xa812('0x22')](_0x596a74);}};}function respondWithFilteredResult(_0x375b9e,_0x572116){return function(_0x2c157a){if(_0x2c157a){var _0xe9d23a=typeof _0x572116['offset']==='undefined'&&typeof _0x572116[_0xa812('0x23')]===_0xa812('0x24');var _0x1cd649=_0x2c157a[_0xa812('0x25')];var _0x3079d2=_0xe9d23a?0x0:_0x572116[_0xa812('0x26')];var _0x2a9725=_0xe9d23a?_0x2c157a[_0xa812('0x25')]:_0x572116[_0xa812('0x26')]+_0x572116[_0xa812('0x23')];var _0x3aeeba;if(_0x2a9725>=_0x1cd649){_0x2a9725=_0x1cd649;_0x3aeeba=0xc8;}else{_0x3aeeba=0xce;}_0x375b9e[_0xa812('0x20')](_0x3aeeba);return _0x375b9e['set'](_0xa812('0x27'),_0x3079d2+'-'+_0x2a9725+'/'+_0x1cd649)['json'](_0x2c157a);}return null;};}function patchUpdates(_0x2140a3){return function(_0x39dc3f){try{jsonpatch[_0xa812('0x28')](_0x39dc3f,_0x2140a3,!![]);}catch(_0x455bc5){return BPromise['reject'](_0x455bc5);}return _0x39dc3f[_0xa812('0x29')]();};}function saveUpdates(_0x14056c,_0x18d6c2){return function(_0x3b766f){if(_0x3b766f){return _0x3b766f['update'](_0x14056c)[_0xa812('0x2a')](function(_0x551788){return _0x551788;});}return null;};}function removeEntity(_0x23418a,_0x23d021){return function(_0x16d568){if(_0x16d568){return _0x16d568['destroy']()['then'](function(){var _0x2fef0c=_0x16d568[_0xa812('0x2b')]({'plain':!![]});var _0x2d38fc=_0xa812('0x2c');return db[_0xa812('0x2d')][_0xa812('0x2e')]({'where':{'type':_0x2d38fc,'resourceId':_0x2fef0c['id']}})[_0xa812('0x2a')](function(){return _0x16d568;});})['then'](function(){_0x23418a[_0xa812('0x20')](0xcc)[_0xa812('0x21')]();});}};}function handleEntityNotFound(_0x2c29e7,_0x15664d){return function(_0x467031){if(!_0x467031){_0x2c29e7['sendStatus'](0x194);}return _0x467031;};}function handleError(_0x22a924,_0x2ef94a){_0x2ef94a=_0x2ef94a||0x1f4;return function(_0x3a3ff5){logger[_0xa812('0x2f')](_0x3a3ff5[_0xa812('0x30')]);if(_0x3a3ff5[_0xa812('0x31')]){delete _0x3a3ff5[_0xa812('0x31')];}_0x22a924[_0xa812('0x20')](_0x2ef94a)[_0xa812('0x32')](_0x3a3ff5);};}exports[_0xa812('0x33')]=function(_0x3b97ee,_0x5160ae){var _0x196037={},_0x545012={},_0xa3b87e={'count':0x0,'rows':[]};var _0x35ab42=_[_0xa812('0x34')](db[_0xa812('0x35')]['rawAttributes'],function(_0x4f9b66){return{'name':_0x4f9b66[_0xa812('0x36')],'type':_0x4f9b66[_0xa812('0x37')]['key']};});_0x545012['model']=_['map'](_0x35ab42,_0xa812('0x31'));_0x545012[_0xa812('0x38')]=_[_0xa812('0x39')](_0x3b97ee[_0xa812('0x38')]);_0x545012[_0xa812('0x3a')]=_[_0xa812('0x3b')](_0x545012['model'],_0x545012[_0xa812('0x38')]);_0x196037[_0xa812('0x3c')]=_['intersection'](_0x545012['model'],qs[_0xa812('0x3d')](_0x3b97ee[_0xa812('0x38')][_0xa812('0x3d')]));_0x196037[_0xa812('0x3c')]=_0x196037[_0xa812('0x3c')][_0xa812('0x3e')]?_0x196037[_0xa812('0x3c')]:_0x545012['model'];if(!_0x3b97ee[_0xa812('0x38')][_0xa812('0x3f')](_0xa812('0x40'))){_0x196037[_0xa812('0x23')]=qs[_0xa812('0x23')](_0x3b97ee['query'][_0xa812('0x23')]);_0x196037[_0xa812('0x26')]=qs['offset'](_0x3b97ee[_0xa812('0x38')][_0xa812('0x26')]);}_0x196037[_0xa812('0x41')]=qs[_0xa812('0x42')](_0x3b97ee['query'][_0xa812('0x42')]);_0x196037['where']=qs[_0xa812('0x3a')](_[_0xa812('0x43')](_0x3b97ee[_0xa812('0x38')],_0x545012[_0xa812('0x3a')]),_0x35ab42);if(_0x3b97ee[_0xa812('0x38')][_0xa812('0x44')]){_0x196037[_0xa812('0x45')]=_[_0xa812('0x46')](_0x196037['where'],{'$or':_[_0xa812('0x34')](_0x35ab42,function(_0x3acebf){if(_0x3acebf[_0xa812('0x37')]!=='VIRTUAL'){var _0x194953={};_0x194953[_0x3acebf['name']]={'$like':'%'+_0x3b97ee[_0xa812('0x38')][_0xa812('0x44')]+'%'};return _0x194953;}})});}_0x196037=_[_0xa812('0x46')]({},_0x196037,_0x3b97ee[_0xa812('0x47')]);var _0x2653a7={'where':_0x196037['where']};return db[_0xa812('0x35')][_0xa812('0x25')](_0x2653a7)[_0xa812('0x2a')](function(_0x108ee5){_0xa3b87e['count']=_0x108ee5;if(_0x3b97ee['query'][_0xa812('0x48')]){_0x196037[_0xa812('0x49')]=[{'all':!![]}];}return db[_0xa812('0x35')]['findAll'](_0x196037);})[_0xa812('0x2a')](function(_0x41500c){_0xa3b87e[_0xa812('0x4a')]=_0x41500c;return _0xa3b87e;})[_0xa812('0x2a')](respondWithFilteredResult(_0x5160ae,_0x196037))[_0xa812('0x4b')](handleError(_0x5160ae,null));};exports[_0xa812('0x4c')]=function(_0x32614a,_0x128a75){var _0x1bed14={'raw':![],'where':{'id':_0x32614a[_0xa812('0x4d')]['id']}},_0xe09277={};_0xe09277[_0xa812('0x4e')]=_['keys'](db[_0xa812('0x35')][_0xa812('0x4f')]);_0xe09277[_0xa812('0x38')]=_[_0xa812('0x39')](_0x32614a[_0xa812('0x38')]);_0xe09277[_0xa812('0x3a')]=_[_0xa812('0x3b')](_0xe09277[_0xa812('0x4e')],_0xe09277['query']);_0x1bed14[_0xa812('0x3c')]=_[_0xa812('0x3b')](_0xe09277[_0xa812('0x4e')],qs[_0xa812('0x3d')](_0x32614a[_0xa812('0x38')][_0xa812('0x3d')]));_0x1bed14['attributes']=_0x1bed14[_0xa812('0x3c')][_0xa812('0x3e')]?_0x1bed14['attributes']:_0xe09277['model'];if(_0x32614a['query']['includeAll']){_0x1bed14[_0xa812('0x49')]=[{'all':!![]}];}_0x1bed14=_[_0xa812('0x46')]({},_0x1bed14,_0x32614a[_0xa812('0x47')]);return db[_0xa812('0x35')][_0xa812('0x50')](_0x1bed14)[_0xa812('0x2a')](handleEntityNotFound(_0x128a75,null))[_0xa812('0x2a')](respondWithResult(_0x128a75,null))['catch'](handleError(_0x128a75,null));};exports[_0xa812('0x51')]=function(_0x83f74b,_0xc44615){return db[_0xa812('0x35')][_0xa812('0x51')](_0x83f74b[_0xa812('0x52')],{})[_0xa812('0x2a')](function(_0x4dbbb4){var _0x29c4fc=_0x83f74b['user'][_0xa812('0x2b')]({'plain':!![]});if(!_0x29c4fc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29c4fc['role']===_0xa812('0x53')){var _0x3806ac=_0x4dbbb4[_0xa812('0x2b')]({'plain':!![]});var _0x3db03f=_0xa812('0x2c');return db[_0xa812('0x54')][_0xa812('0x50')]({'where':{'name':_0x3db03f,'userProfileId':_0x29c4fc[_0xa812('0x55')]},'raw':!![]})[_0xa812('0x2a')](function(_0x3cfaf9){if(_0x3cfaf9&&_0x3cfaf9['autoAssociation']===0x0){return db[_0xa812('0x2d')]['create']({'name':_0x3806ac[_0xa812('0x31')],'resourceId':_0x3806ac['id'],'type':_0x3cfaf9[_0xa812('0x31')],'sectionId':_0x3cfaf9['id']},{})['then'](function(){return _0x4dbbb4;});}else{return _0x4dbbb4;}})['catch'](function(_0x32cbc8){logger[_0xa812('0x2f')](_0xa812('0x56'),_0x32cbc8);throw _0x32cbc8;});}return _0x4dbbb4;})['then'](respondWithResult(_0xc44615,0xc9))[_0xa812('0x4b')](handleError(_0xc44615,null));};exports[_0xa812('0x57')]=function(_0x2d0140,_0x4f9f76){var _0x432b5e={'where':{'id':_0x2d0140[_0xa812('0x4d')]['id']}},_0x1f4be2={};_0x1f4be2['model']=_[_0xa812('0x39')](db['Dashboard'][_0xa812('0x4f')]);_0x432b5e[_0xa812('0x3c')]=_[_0xa812('0x3b')](_0x1f4be2[_0xa812('0x4e')],qs['fields'](_0x2d0140['query'][_0xa812('0x3d')]));_0x432b5e['attributes']=_0x432b5e[_0xa812('0x3c')]['length']?_0x432b5e[_0xa812('0x3c')]:_0x1f4be2['model'];if(_0x2d0140['query'][_0xa812('0x48')]){_0x432b5e['include']=[{'all':!![]}];}_0x432b5e=_[_0xa812('0x46')]({},_0x432b5e,_0x2d0140['options']);return db[_0xa812('0x35')][_0xa812('0x50')](_0x432b5e)['then'](handleEntityNotFound(_0x4f9f76,null))[_0xa812('0x2a')](function(_0x15204c){if(_0x15204c){var _0x381ba2=_0x15204c['get']({'plain':!![]});_0x381ba2=qs[_0xa812('0x58')](_0x381ba2,['id',_0xa812('0x59'),_0xa812('0x5a')]);_0x2d0140[_0xa812('0x52')]=_[_0xa812('0x58')](_0x2d0140[_0xa812('0x52')],['id',_0xa812('0x59'),_0xa812('0x5a')]);return db[_0xa812('0x35')][_0xa812('0x51')](_['merge'](_0x381ba2,_0x2d0140['body']),{'include':_0x2d0140[_0xa812('0x38')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x2695fe){var _0x821a8=_0x2d0140['user']['get']({'plain':!![]});if(!_0x821a8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x821a8[_0xa812('0x5b')]===_0xa812('0x53')){var _0x3c44ca=_0x2695fe['get']({'plain':!![]});var _0x5d68bb=_0xa812('0x2c');return db[_0xa812('0x54')][_0xa812('0x50')]({'where':{'name':_0x5d68bb,'userProfileId':_0x821a8['userProfileId']},'raw':!![]})[_0xa812('0x2a')](function(_0x252e71){if(_0x252e71&&_0x252e71[_0xa812('0x5c')]===0x0){return db['UserProfileResource'][_0xa812('0x51')]({'name':_0x3c44ca['name'],'resourceId':_0x3c44ca['id'],'type':_0x252e71['name'],'sectionId':_0x252e71['id']},{})[_0xa812('0x2a')](function(){return _0x2695fe;});}else{return _0x2695fe;}})[_0xa812('0x4b')](function(_0x4f4f2d){logger[_0xa812('0x2f')](_0xa812('0x56'),_0x4f4f2d);throw _0x4f4f2d;});}return _0x2695fe;});}})[_0xa812('0x2a')](respondWithResult(_0x4f9f76,0xc9))[_0xa812('0x4b')](handleError(_0x4f9f76,null));};exports[_0xa812('0x5d')]=function(_0xeaf2a9,_0x3e958c){if(_0xeaf2a9['body']['id']){delete _0xeaf2a9[_0xa812('0x52')]['id'];}return db[_0xa812('0x35')][_0xa812('0x50')]({'where':{'id':_0xeaf2a9['params']['id']}})[_0xa812('0x2a')](handleEntityNotFound(_0x3e958c,null))[_0xa812('0x2a')](saveUpdates(_0xeaf2a9[_0xa812('0x52')],null))['then'](respondWithResult(_0x3e958c,null))[_0xa812('0x4b')](handleError(_0x3e958c,null));};exports[_0xa812('0x2e')]=function(_0x305974,_0x2b998f){return db[_0xa812('0x35')]['find']({'where':{'id':_0x305974[_0xa812('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2b998f,null))[_0xa812('0x2a')](removeEntity(_0x2b998f,null))[_0xa812('0x4b')](handleError(_0x2b998f,null));};function widgetAttributes(_0x467cfd){try{switch(_0x467cfd['type']){case'iframe':return[{'name':_0xa812('0x5e'),'value':_0x467cfd['attrUrl']||(_0x467cfd[_0xa812('0x5f')]&&_0x467cfd[_0xa812('0x5f')][0x0]?_0x467cfd['attrs'][0x0][_0xa812('0x60')]:undefined)||_0xa812('0x61')}];case _0xa812('0x62'):return[{'name':_0xa812('0x63'),'value':_0x467cfd[_0xa812('0x63')]||(_0x467cfd['attrs']&&_0x467cfd[_0xa812('0x5f')][0x0]?_0x467cfd[_0xa812('0x5f')][0x0][_0xa812('0x60')]:undefined)||''}];case'clock':return[{'name':_0xa812('0x64'),'value':_0x467cfd[_0xa812('0x64')]||(_0x467cfd['attrs']&&_0x467cfd[_0xa812('0x5f')][0x0]?_0x467cfd['attrs'][0x0][_0xa812('0x60')]:undefined)||_0xa812('0x65')},{'name':_0xa812('0x66'),'value':_0x467cfd[_0xa812('0x66')]||(_0x467cfd[_0xa812('0x5f')]&&_0x467cfd[_0xa812('0x5f')][0x1]?_0x467cfd['attrs'][0x1][_0xa812('0x60')]:undefined)||_0xa812('0x67')},{'name':_0xa812('0x68'),'value':_0x467cfd[_0xa812('0x68')]||(_0x467cfd['attrs']&&_0x467cfd[_0xa812('0x5f')][0x2]?_0x467cfd['attrs'][0x2]['value']:undefined)||0xc}];case _0xa812('0x69'):return[{'name':'attrMetric','value':_0x467cfd['attrMetric']||(_0x467cfd['attrs']&&_0x467cfd[_0xa812('0x5f')][0x0]?_0x467cfd[_0xa812('0x5f')][0x0][_0xa812('0x60')]:undefined)||'total'},{'name':_0xa812('0x6a'),'value':_0x467cfd[_0xa812('0x6a')]||(_0x467cfd[_0xa812('0x5f')]&&_0x467cfd[_0xa812('0x5f')][0x1]?_0x467cfd[_0xa812('0x5f')][0x1]['value']:undefined)||[]},{'name':_0xa812('0x68'),'value':_0x467cfd[_0xa812('0x68')]||(_0x467cfd[_0xa812('0x5f')]&&_0x467cfd['attrs'][0x2]?_0x467cfd['attrs'][0x2][_0xa812('0x60')]:undefined)||0x14},{'name':_0xa812('0x6b'),'value':_0x467cfd[_0xa812('0x6b')]||(_0x467cfd[_0xa812('0x5f')]&&_0x467cfd[_0xa812('0x5f')][0x3]?_0x467cfd[_0xa812('0x5f')][0x3]['value']:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x467cfd[_0xa812('0x6c')]||(_0x467cfd['attrs']&&_0x467cfd[_0xa812('0x5f')][0x4]?_0x467cfd['attrs'][0x4][_0xa812('0x60')]:undefined)||''},{'name':_0xa812('0x6d'),'value':_0x467cfd['attrFaxAccounts']||(_0x467cfd['attrs']&&_0x467cfd[_0xa812('0x5f')][0x5]?_0x467cfd[_0xa812('0x5f')][0x5][_0xa812('0x60')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x467cfd[_0xa812('0x6e')]||(_0x467cfd[_0xa812('0x5f')]&&_0x467cfd[_0xa812('0x5f')][0x6]?_0x467cfd[_0xa812('0x5f')][0x6][_0xa812('0x60')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x467cfd[_0xa812('0x6f')]||(_0x467cfd[_0xa812('0x5f')]&&_0x467cfd[_0xa812('0x5f')][0x7]?_0x467cfd[_0xa812('0x5f')][0x7][_0xa812('0x60')]:undefined)||''},{'name':_0xa812('0x70'),'value':_0x467cfd[_0xa812('0x70')]||(_0x467cfd['attrs']&&_0x467cfd[_0xa812('0x5f')][0x8]?_0x467cfd['attrs'][0x8][_0xa812('0x60')]:undefined)||''},{'name':_0xa812('0x71'),'value':_0x467cfd[_0xa812('0x71')]||(_0x467cfd[_0xa812('0x5f')]&&_0x467cfd[_0xa812('0x5f')][0x9]?_0x467cfd[_0xa812('0x5f')][0x9][_0xa812('0x60')]:undefined)||''}];case _0xa812('0x72'):case _0xa812('0x73'):return[{'name':_0xa812('0x74'),'value':_0x467cfd['attrSerie1']||(_0x467cfd[_0xa812('0x5f')]&&_0x467cfd[_0xa812('0x5f')][0x0]?_0x467cfd[_0xa812('0x5f')][0x0]['value']:undefined)||_0xa812('0x75')},{'name':_0xa812('0x76'),'value':_0x467cfd[_0xa812('0x76')]||(_0x467cfd[_0xa812('0x5f')]&&_0x467cfd[_0xa812('0x5f')][0x1]?_0x467cfd[_0xa812('0x5f')][0x1]['value']:undefined)||null},{'name':_0xa812('0x77'),'value':_0x467cfd[_0xa812('0x77')]||(_0x467cfd[_0xa812('0x5f')]&&_0x467cfd[_0xa812('0x5f')][0x2]?_0x467cfd['attrs'][0x2][_0xa812('0x60')]:undefined)||null},{'name':_0xa812('0x6a'),'value':_0x467cfd[_0xa812('0x6a')]||(_0x467cfd[_0xa812('0x5f')]&&_0x467cfd['attrs'][0x3]?_0x467cfd[_0xa812('0x5f')][0x3][_0xa812('0x60')]:undefined)||[]},{'name':_0xa812('0x6b'),'value':_0x467cfd[_0xa812('0x6b')]||(_0x467cfd[_0xa812('0x5f')]&&_0x467cfd[_0xa812('0x5f')][0x4]?_0x467cfd[_0xa812('0x5f')][0x4]['value']:undefined)||_0xa812('0x78')},{'name':_0xa812('0x6c'),'value':_0x467cfd[_0xa812('0x6c')]||(_0x467cfd[_0xa812('0x5f')]&&_0x467cfd[_0xa812('0x5f')][0x5]?_0x467cfd[_0xa812('0x5f')][0x5]['value']:undefined)||''},{'name':_0xa812('0x6d'),'value':_0x467cfd[_0xa812('0x6d')]||(_0x467cfd[_0xa812('0x5f')]&&_0x467cfd[_0xa812('0x5f')][0x6]?_0x467cfd[_0xa812('0x5f')][0x6][_0xa812('0x60')]:undefined)||''},{'name':_0xa812('0x6e'),'value':_0x467cfd[_0xa812('0x6e')]||(_0x467cfd['attrs']&&_0x467cfd[_0xa812('0x5f')][0x7]?_0x467cfd['attrs'][0x7][_0xa812('0x60')]:undefined)||''},{'name':_0xa812('0x6f'),'value':_0x467cfd[_0xa812('0x6f')]||(_0x467cfd[_0xa812('0x5f')]&&_0x467cfd['attrs'][0x8]?_0x467cfd['attrs'][0x8][_0xa812('0x60')]:undefined)||''},{'name':_0xa812('0x70'),'value':_0x467cfd[_0xa812('0x70')]||(_0x467cfd[_0xa812('0x5f')]&&_0x467cfd[_0xa812('0x5f')][0x9]?_0x467cfd['attrs'][0x9][_0xa812('0x60')]:undefined)||''},{'name':'attrChatWebsites','value':_0x467cfd[_0xa812('0x71')]||(_0x467cfd[_0xa812('0x5f')]&&_0x467cfd[_0xa812('0x5f')][0xa]?_0x467cfd[_0xa812('0x5f')][0xa]['value']:undefined)||''}];case _0xa812('0x79'):return[{'name':'attrReport','type':_0x467cfd['reportType']||(_0x467cfd[_0xa812('0x5f')]&&_0x467cfd[_0xa812('0x5f')][0x0]?_0x467cfd[_0xa812('0x5f')][0x0]['type']:undefined)||null,'value':_0x467cfd[_0xa812('0x7a')]||(_0x467cfd['attrs']&&_0x467cfd['attrs'][0x0]?_0x467cfd[_0xa812('0x5f')][0x0][_0xa812('0x60')]:undefined)||null},{'name':_0xa812('0x7b'),'value':_0x467cfd[_0xa812('0x7b')]||(_0x467cfd[_0xa812('0x5f')]&&_0x467cfd[_0xa812('0x5f')][0x1]?_0x467cfd['attrs'][0x1][_0xa812('0x60')]:undefined)||0x0}];default:return[];}}catch(_0x400594){logger['error']('widgetAttributes:\x20%s',JSON[_0xa812('0x7c')](_0x400594));return[];}}exports['addItem']=function(_0x26bfb8,_0x38c415,_0x55fc14){if(_0x26bfb8[_0xa812('0x52')]['id']){delete _0x26bfb8[_0xa812('0x52')]['id'];}return db[_0xa812('0x35')][_0xa812('0x50')]({'where':{'id':_0x26bfb8[_0xa812('0x4d')]['id']}})[_0xa812('0x2a')](handleEntityNotFound(_0x38c415,null))[_0xa812('0x2a')](function(_0xbaaee1){if(_0xbaaee1){_0x26bfb8['body'][_0xa812('0x7d')]=_0xbaaee1['id'];_0x26bfb8[_0xa812('0x52')][_0xa812('0x5f')]=widgetAttributes(_0x26bfb8[_0xa812('0x52')]);return db[_0xa812('0x7e')][_0xa812('0x51')](_0x26bfb8['body']);}})[_0xa812('0x2a')](respondWithResult(_0x38c415,null))[_0xa812('0x4b')](handleError(_0x38c415,null));};exports[_0xa812('0x7f')]=function(_0x183b8c,_0x50fe7b,_0x39e6d3){var _0x52a19={};var _0x278e04={};var _0x4ae348;var _0x26f352;return db[_0xa812('0x35')][_0xa812('0x80')]({'where':{'id':_0x183b8c[_0xa812('0x4d')]['id']}})[_0xa812('0x2a')](handleEntityNotFound(_0x50fe7b,null))['then'](function(_0x34dc14){if(_0x34dc14){_0x4ae348=_0x34dc14;_0x278e04[_0xa812('0x4e')]=_[_0xa812('0x39')](db[_0xa812('0x7e')][_0xa812('0x4f')]);_0x278e04[_0xa812('0x38')]=_[_0xa812('0x39')](_0x183b8c[_0xa812('0x38')]);_0x278e04[_0xa812('0x3a')]=_['intersection'](_0x278e04[_0xa812('0x4e')],_0x278e04[_0xa812('0x38')]);_0x52a19[_0xa812('0x3c')]=_[_0xa812('0x3b')](_0x278e04[_0xa812('0x4e')],qs[_0xa812('0x3d')](_0x183b8c['query'][_0xa812('0x3d')]));_0x52a19[_0xa812('0x3c')]=_0x52a19[_0xa812('0x3c')][_0xa812('0x3e')]?_0x52a19['attributes']:_0x278e04[_0xa812('0x4e')];_0x52a19[_0xa812('0x41')]=qs['sort'](_0x183b8c[_0xa812('0x38')][_0xa812('0x42')]);_0x52a19[_0xa812('0x45')]=qs[_0xa812('0x3a')](_['pick'](_0x183b8c[_0xa812('0x38')],_0x278e04[_0xa812('0x3a')]));if(_0x183b8c[_0xa812('0x38')][_0xa812('0x44')]){_0x52a19[_0xa812('0x45')]=_[_0xa812('0x46')](_0x52a19[_0xa812('0x45')],{'$or':_[_0xa812('0x34')](_0x52a19[_0xa812('0x3c')],function(_0x39894a){var _0x418353={};_0x418353[_0x39894a]={'$like':'%'+_0x183b8c['query'][_0xa812('0x44')]+'%'};return _0x418353;})});}_0x52a19=_[_0xa812('0x46')]({},_0x52a19,_0x183b8c[_0xa812('0x47')]);return _0x4ae348[_0xa812('0x7f')](_0x52a19);}})[_0xa812('0x2a')](function(_0x2583fd){if(_0x2583fd){_0x26f352=_0x2583fd['length'];if(!_0x183b8c[_0xa812('0x38')][_0xa812('0x3f')]('nolimit')){_0x52a19[_0xa812('0x23')]=qs[_0xa812('0x23')](_0x183b8c['query'][_0xa812('0x23')]);_0x52a19[_0xa812('0x26')]=qs[_0xa812('0x26')](_0x183b8c[_0xa812('0x38')][_0xa812('0x26')]);}return _0x4ae348[_0xa812('0x7f')](_0x52a19);}})[_0xa812('0x2a')](function(_0x6ce702){if(_0x6ce702){return _0x6ce702?{'count':_0x26f352,'rows':_0x6ce702}:null;}})['then'](respondWithResult(_0x50fe7b,null))[_0xa812('0x4b')](handleError(_0x50fe7b,null));}; \ No newline at end of file +var _0x0b77=['voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','findOne','getItems','nolimit','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./dashboard.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','get','CustomDashboards','UserProfileResource','stack','name','send','index','map','Dashboard','fieldName','type','query','model','fields','attributes','length','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','includeAll','params','keys','rawAttributes','intersection','include','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','body','error','iframe','attrUrl','attrs','value','https://','custom','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','attrMetric','attrVoiceQueues','attrChannel'];(function(_0xdfdd78,_0x3c56fa){var _0x148c34=function(_0x8b443){while(--_0x8b443){_0xdfdd78['push'](_0xdfdd78['shift']());}};_0x148c34(++_0x3c56fa);}(_0x0b77,0x189));var _0x70b7=function(_0x5ca644,_0x3d2165){_0x5ca644=_0x5ca644-0x0;var _0x5c87a2=_0x0b77[_0x5ca644];return _0x5c87a2;};'use strict';var emlformat=require(_0x70b7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x70b7('0x1'));var jsonpatch=require(_0x70b7('0x2'));var rp=require(_0x70b7('0x3'));var moment=require(_0x70b7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x70b7('0x5'));var util=require(_0x70b7('0x6'));var path=require('path');var sox=require(_0x70b7('0x7'));var csv=require(_0x70b7('0x8'));var ejs=require(_0x70b7('0x9'));var fs=require('fs');var fs_extra=require(_0x70b7('0xa'));var _=require(_0x70b7('0xb'));var squel=require('squel');var crypto=require(_0x70b7('0xc'));var jsforce=require(_0x70b7('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x70b7('0x8'));var querystring=require('querystring');var Papa=require(_0x70b7('0xe'));var Redis=require(_0x70b7('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x70b7('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x70b7('0x11'));var config=require(_0x70b7('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x70b7('0x13'))['db'];config[_0x70b7('0x14')]=_[_0x70b7('0x15')](config[_0x70b7('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0x70b7('0x16'))(new Redis(config[_0x70b7('0x14')]));require(_0x70b7('0x17'))['register'](socket);function respondWithStatusCode(_0x55d645,_0x5abfc4){_0x5abfc4=_0x5abfc4||0xcc;return function(_0x334590){if(_0x334590){return _0x55d645[_0x70b7('0x18')](_0x5abfc4);}return _0x55d645[_0x70b7('0x19')](_0x5abfc4)[_0x70b7('0x1a')]();};}function respondWithResult(_0x4a6399,_0x491c2f){_0x491c2f=_0x491c2f||0xc8;return function(_0x1158f4){if(_0x1158f4){return _0x4a6399[_0x70b7('0x19')](_0x491c2f)[_0x70b7('0x1b')](_0x1158f4);}};}function respondWithFilteredResult(_0x4b787a,_0x51f243){return function(_0x36f273){if(_0x36f273){var _0x13b84a=typeof _0x51f243[_0x70b7('0x1c')]===_0x70b7('0x1d')&&typeof _0x51f243[_0x70b7('0x1e')]===_0x70b7('0x1d');var _0x25b883=_0x36f273[_0x70b7('0x1f')];var _0x4b6ccf=_0x13b84a?0x0:_0x51f243[_0x70b7('0x1c')];var _0x433456=_0x13b84a?_0x36f273[_0x70b7('0x1f')]:_0x51f243[_0x70b7('0x1c')]+_0x51f243[_0x70b7('0x1e')];var _0x4b0c69;if(_0x433456>=_0x25b883){_0x433456=_0x25b883;_0x4b0c69=0xc8;}else{_0x4b0c69=0xce;}_0x4b787a[_0x70b7('0x19')](_0x4b0c69);return _0x4b787a[_0x70b7('0x20')](_0x70b7('0x21'),_0x4b6ccf+'-'+_0x433456+'/'+_0x25b883)[_0x70b7('0x1b')](_0x36f273);}return null;};}function patchUpdates(_0x39bccc){return function(_0x380aa0){try{jsonpatch[_0x70b7('0x22')](_0x380aa0,_0x39bccc,!![]);}catch(_0x3cda55){return BPromise['reject'](_0x3cda55);}return _0x380aa0[_0x70b7('0x23')]();};}function saveUpdates(_0x3f2c0e,_0x477e95){return function(_0xc6785){if(_0xc6785){return _0xc6785['update'](_0x3f2c0e)[_0x70b7('0x24')](function(_0x5bb1f6){return _0x5bb1f6;});}return null;};}function removeEntity(_0x4b1416,_0x2f204b){return function(_0xb2173c){if(_0xb2173c){return _0xb2173c[_0x70b7('0x25')]()[_0x70b7('0x24')](function(){var _0x32bca1=_0xb2173c[_0x70b7('0x26')]({'plain':!![]});var _0x6861e=_0x70b7('0x27');return db[_0x70b7('0x28')]['destroy']({'where':{'type':_0x6861e,'resourceId':_0x32bca1['id']}})[_0x70b7('0x24')](function(){return _0xb2173c;});})[_0x70b7('0x24')](function(){_0x4b1416[_0x70b7('0x19')](0xcc)[_0x70b7('0x1a')]();});}};}function handleEntityNotFound(_0x5f39e4,_0x27e2c2){return function(_0x36f3d6){if(!_0x36f3d6){_0x5f39e4[_0x70b7('0x18')](0x194);}return _0x36f3d6;};}function handleError(_0x20b72b,_0x39d7aa){_0x39d7aa=_0x39d7aa||0x1f4;return function(_0x4006de){logger['error'](_0x4006de[_0x70b7('0x29')]);if(_0x4006de[_0x70b7('0x2a')]){delete _0x4006de['name'];}_0x20b72b[_0x70b7('0x19')](_0x39d7aa)[_0x70b7('0x2b')](_0x4006de);};}exports[_0x70b7('0x2c')]=function(_0x4f16dc,_0x4c63fc){var _0x471919={},_0x5d364b={},_0x1d1f9f={'count':0x0,'rows':[]};var _0x4584f6=_[_0x70b7('0x2d')](db[_0x70b7('0x2e')]['rawAttributes'],function(_0x557fd2){return{'name':_0x557fd2[_0x70b7('0x2f')],'type':_0x557fd2[_0x70b7('0x30')]['key']};});_0x5d364b['model']=_['map'](_0x4584f6,'name');_0x5d364b[_0x70b7('0x31')]=_['keys'](_0x4f16dc[_0x70b7('0x31')]);_0x5d364b['filters']=_['intersection'](_0x5d364b[_0x70b7('0x32')],_0x5d364b['query']);_0x471919['attributes']=_['intersection'](_0x5d364b['model'],qs[_0x70b7('0x33')](_0x4f16dc[_0x70b7('0x31')][_0x70b7('0x33')]));_0x471919[_0x70b7('0x34')]=_0x471919[_0x70b7('0x34')][_0x70b7('0x35')]?_0x471919['attributes']:_0x5d364b[_0x70b7('0x32')];if(!_0x4f16dc[_0x70b7('0x31')]['hasOwnProperty']('nolimit')){_0x471919[_0x70b7('0x1e')]=qs[_0x70b7('0x1e')](_0x4f16dc['query'][_0x70b7('0x1e')]);_0x471919[_0x70b7('0x1c')]=qs['offset'](_0x4f16dc[_0x70b7('0x31')][_0x70b7('0x1c')]);}_0x471919[_0x70b7('0x36')]=qs[_0x70b7('0x37')](_0x4f16dc['query'][_0x70b7('0x37')]);_0x471919['where']=qs['filters'](_[_0x70b7('0x38')](_0x4f16dc[_0x70b7('0x31')],_0x5d364b[_0x70b7('0x39')]),_0x4584f6);if(_0x4f16dc[_0x70b7('0x31')][_0x70b7('0x3a')]){_0x471919[_0x70b7('0x3b')]=_[_0x70b7('0x3c')](_0x471919[_0x70b7('0x3b')],{'$or':_[_0x70b7('0x2d')](_0x4584f6,function(_0x3d3fdc){if(_0x3d3fdc['type']!==_0x70b7('0x3d')){var _0x6d8bef={};_0x6d8bef[_0x3d3fdc[_0x70b7('0x2a')]]={'$like':'%'+_0x4f16dc['query']['filter']+'%'};return _0x6d8bef;}})});}_0x471919=_[_0x70b7('0x3c')]({},_0x471919,_0x4f16dc[_0x70b7('0x3e')]);var _0x5c0ff8={'where':_0x471919[_0x70b7('0x3b')]};return db[_0x70b7('0x2e')][_0x70b7('0x1f')](_0x5c0ff8)[_0x70b7('0x24')](function(_0x58b3e7){_0x1d1f9f['count']=_0x58b3e7;if(_0x4f16dc[_0x70b7('0x31')][_0x70b7('0x3f')]){_0x471919['include']=[{'all':!![]}];}return db['Dashboard']['findAll'](_0x471919);})[_0x70b7('0x24')](function(_0x34a423){_0x1d1f9f['rows']=_0x34a423;return _0x1d1f9f;})['then'](respondWithFilteredResult(_0x4c63fc,_0x471919))['catch'](handleError(_0x4c63fc,null));};exports['show']=function(_0xbddb25,_0x48f3ed){var _0x218bed={'raw':![],'where':{'id':_0xbddb25[_0x70b7('0x40')]['id']}},_0xba2485={};_0xba2485[_0x70b7('0x32')]=_[_0x70b7('0x41')](db[_0x70b7('0x2e')][_0x70b7('0x42')]);_0xba2485[_0x70b7('0x31')]=_[_0x70b7('0x41')](_0xbddb25[_0x70b7('0x31')]);_0xba2485[_0x70b7('0x39')]=_[_0x70b7('0x43')](_0xba2485[_0x70b7('0x32')],_0xba2485[_0x70b7('0x31')]);_0x218bed[_0x70b7('0x34')]=_['intersection'](_0xba2485[_0x70b7('0x32')],qs['fields'](_0xbddb25['query']['fields']));_0x218bed[_0x70b7('0x34')]=_0x218bed[_0x70b7('0x34')]['length']?_0x218bed['attributes']:_0xba2485[_0x70b7('0x32')];if(_0xbddb25[_0x70b7('0x31')][_0x70b7('0x3f')]){_0x218bed[_0x70b7('0x44')]=[{'all':!![]}];}_0x218bed=_[_0x70b7('0x3c')]({},_0x218bed,_0xbddb25[_0x70b7('0x3e')]);return db[_0x70b7('0x2e')]['find'](_0x218bed)['then'](handleEntityNotFound(_0x48f3ed,null))['then'](respondWithResult(_0x48f3ed,null))[_0x70b7('0x45')](handleError(_0x48f3ed,null));};exports[_0x70b7('0x46')]=function(_0x5d4578,_0x159a1c){return db[_0x70b7('0x2e')]['create'](_0x5d4578['body'],{})[_0x70b7('0x24')](function(_0x4c331d){var _0x586139=_0x5d4578[_0x70b7('0x47')][_0x70b7('0x26')]({'plain':!![]});if(!_0x586139)throw new Error(_0x70b7('0x48'));if(_0x586139[_0x70b7('0x49')]==='user'){var _0x56e3fc=_0x4c331d[_0x70b7('0x26')]({'plain':!![]});var _0x58078a=_0x70b7('0x27');return db[_0x70b7('0x4a')][_0x70b7('0x4b')]({'where':{'name':_0x58078a,'userProfileId':_0x586139[_0x70b7('0x4c')]},'raw':!![]})['then'](function(_0x9dd3c7){if(_0x9dd3c7&&_0x9dd3c7[_0x70b7('0x4d')]===0x0){return db[_0x70b7('0x28')]['create']({'name':_0x56e3fc[_0x70b7('0x2a')],'resourceId':_0x56e3fc['id'],'type':_0x9dd3c7[_0x70b7('0x2a')],'sectionId':_0x9dd3c7['id']},{})[_0x70b7('0x24')](function(){return _0x4c331d;});}else{return _0x4c331d;}})[_0x70b7('0x45')](function(_0x53e7f2){logger['error'](_0x70b7('0x4e'),_0x53e7f2);throw _0x53e7f2;});}return _0x4c331d;})['then'](respondWithResult(_0x159a1c,0xc9))[_0x70b7('0x45')](handleError(_0x159a1c,null));};exports[_0x70b7('0x4f')]=function(_0x3d063b,_0x288a19){var _0x40b04c={'where':{'id':_0x3d063b[_0x70b7('0x40')]['id']}},_0x28702c={};_0x28702c[_0x70b7('0x32')]=_[_0x70b7('0x41')](db[_0x70b7('0x2e')][_0x70b7('0x42')]);_0x40b04c[_0x70b7('0x34')]=_[_0x70b7('0x43')](_0x28702c[_0x70b7('0x32')],qs[_0x70b7('0x33')](_0x3d063b['query'][_0x70b7('0x33')]));_0x40b04c[_0x70b7('0x34')]=_0x40b04c[_0x70b7('0x34')][_0x70b7('0x35')]?_0x40b04c[_0x70b7('0x34')]:_0x28702c['model'];if(_0x3d063b[_0x70b7('0x31')][_0x70b7('0x3f')]){_0x40b04c[_0x70b7('0x44')]=[{'all':!![]}];}_0x40b04c=_['merge']({},_0x40b04c,_0x3d063b['options']);return db[_0x70b7('0x2e')]['find'](_0x40b04c)['then'](handleEntityNotFound(_0x288a19,null))[_0x70b7('0x24')](function(_0x21d24e){if(_0x21d24e){var _0x555de1=_0x21d24e[_0x70b7('0x26')]({'plain':!![]});_0x555de1=qs[_0x70b7('0x50')](_0x555de1,['id','createdAt',_0x70b7('0x51')]);_0x3d063b['body']=_['omit'](_0x3d063b['body'],['id',_0x70b7('0x52'),_0x70b7('0x51')]);return db[_0x70b7('0x2e')][_0x70b7('0x46')](_['merge'](_0x555de1,_0x3d063b[_0x70b7('0x53')]),{'include':_0x3d063b[_0x70b7('0x31')][_0x70b7('0x3f')]?[{'all':!![]}]:undefined})[_0x70b7('0x24')](function(_0x3b2895){var _0x1f8e04=_0x3d063b[_0x70b7('0x47')][_0x70b7('0x26')]({'plain':!![]});if(!_0x1f8e04)throw new Error(_0x70b7('0x48'));if(_0x1f8e04[_0x70b7('0x49')]==='user'){var _0x5772cc=_0x3b2895['get']({'plain':!![]});var _0x10211a=_0x70b7('0x27');return db['UserProfileSection'][_0x70b7('0x4b')]({'where':{'name':_0x10211a,'userProfileId':_0x1f8e04[_0x70b7('0x4c')]},'raw':!![]})['then'](function(_0x1b1841){if(_0x1b1841&&_0x1b1841[_0x70b7('0x4d')]===0x0){return db[_0x70b7('0x28')][_0x70b7('0x46')]({'name':_0x5772cc[_0x70b7('0x2a')],'resourceId':_0x5772cc['id'],'type':_0x1b1841[_0x70b7('0x2a')],'sectionId':_0x1b1841['id']},{})[_0x70b7('0x24')](function(){return _0x3b2895;});}else{return _0x3b2895;}})[_0x70b7('0x45')](function(_0x3bbaf3){logger[_0x70b7('0x54')](_0x70b7('0x4e'),_0x3bbaf3);throw _0x3bbaf3;});}return _0x3b2895;});}})['then'](respondWithResult(_0x288a19,0xc9))[_0x70b7('0x45')](handleError(_0x288a19,null));};exports['update']=function(_0x32e171,_0x154031){if(_0x32e171[_0x70b7('0x53')]['id']){delete _0x32e171[_0x70b7('0x53')]['id'];}return db[_0x70b7('0x2e')][_0x70b7('0x4b')]({'where':{'id':_0x32e171[_0x70b7('0x40')]['id']}})[_0x70b7('0x24')](handleEntityNotFound(_0x154031,null))['then'](saveUpdates(_0x32e171['body'],null))[_0x70b7('0x24')](respondWithResult(_0x154031,null))['catch'](handleError(_0x154031,null));};exports[_0x70b7('0x25')]=function(_0x486d92,_0x566d4f){return db[_0x70b7('0x2e')]['find']({'where':{'id':_0x486d92[_0x70b7('0x40')]['id']}})['then'](handleEntityNotFound(_0x566d4f,null))[_0x70b7('0x24')](removeEntity(_0x566d4f,null))[_0x70b7('0x45')](handleError(_0x566d4f,null));};function widgetAttributes(_0x33fccf){try{switch(_0x33fccf[_0x70b7('0x30')]){case _0x70b7('0x55'):return[{'name':_0x70b7('0x56'),'value':_0x33fccf[_0x70b7('0x56')]||(_0x33fccf[_0x70b7('0x57')]&&_0x33fccf[_0x70b7('0x57')][0x0]?_0x33fccf[_0x70b7('0x57')][0x0][_0x70b7('0x58')]:undefined)||_0x70b7('0x59')}];case _0x70b7('0x5a'):return[{'name':'attrPath','value':_0x33fccf['attrPath']||(_0x33fccf['attrs']&&_0x33fccf[_0x70b7('0x57')][0x0]?_0x33fccf[_0x70b7('0x57')][0x0][_0x70b7('0x58')]:undefined)||''}];case _0x70b7('0x5b'):return[{'name':'attrHourFormat','value':_0x33fccf[_0x70b7('0x5c')]||(_0x33fccf[_0x70b7('0x57')]&&_0x33fccf[_0x70b7('0x57')][0x0]?_0x33fccf['attrs'][0x0]['value']:undefined)||_0x70b7('0x5d')},{'name':_0x70b7('0x5e'),'value':_0x33fccf[_0x70b7('0x5e')]||(_0x33fccf['attrs']&&_0x33fccf['attrs'][0x1]?_0x33fccf[_0x70b7('0x57')][0x1][_0x70b7('0x58')]:undefined)||'0.00'},{'name':_0x70b7('0x5f'),'value':_0x33fccf[_0x70b7('0x5f')]||(_0x33fccf[_0x70b7('0x57')]&&_0x33fccf['attrs'][0x2]?_0x33fccf[_0x70b7('0x57')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x70b7('0x60'),'value':_0x33fccf[_0x70b7('0x60')]||(_0x33fccf[_0x70b7('0x57')]&&_0x33fccf[_0x70b7('0x57')][0x0]?_0x33fccf[_0x70b7('0x57')][0x0][_0x70b7('0x58')]:undefined)||'total'},{'name':_0x70b7('0x61'),'value':_0x33fccf['attrVoiceQueues']||(_0x33fccf[_0x70b7('0x57')]&&_0x33fccf[_0x70b7('0x57')][0x1]?_0x33fccf[_0x70b7('0x57')][0x1][_0x70b7('0x58')]:undefined)||[]},{'name':_0x70b7('0x5f'),'value':_0x33fccf[_0x70b7('0x5f')]||(_0x33fccf[_0x70b7('0x57')]&&_0x33fccf['attrs'][0x2]?_0x33fccf[_0x70b7('0x57')][0x2][_0x70b7('0x58')]:undefined)||0x14},{'name':_0x70b7('0x62'),'value':_0x33fccf['attrChannel']||(_0x33fccf[_0x70b7('0x57')]&&_0x33fccf['attrs'][0x3]?_0x33fccf[_0x70b7('0x57')][0x3][_0x70b7('0x58')]:undefined)||_0x70b7('0x63')},{'name':_0x70b7('0x64'),'value':_0x33fccf['attrEmailAccounts']||(_0x33fccf[_0x70b7('0x57')]&&_0x33fccf['attrs'][0x4]?_0x33fccf[_0x70b7('0x57')][0x4][_0x70b7('0x58')]:undefined)||''},{'name':_0x70b7('0x65'),'value':_0x33fccf['attrFaxAccounts']||(_0x33fccf[_0x70b7('0x57')]&&_0x33fccf[_0x70b7('0x57')][0x5]?_0x33fccf[_0x70b7('0x57')][0x5][_0x70b7('0x58')]:undefined)||''},{'name':_0x70b7('0x66'),'value':_0x33fccf[_0x70b7('0x66')]||(_0x33fccf[_0x70b7('0x57')]&&_0x33fccf[_0x70b7('0x57')][0x6]?_0x33fccf[_0x70b7('0x57')][0x6][_0x70b7('0x58')]:undefined)||''},{'name':_0x70b7('0x67'),'value':_0x33fccf[_0x70b7('0x67')]||(_0x33fccf[_0x70b7('0x57')]&&_0x33fccf[_0x70b7('0x57')][0x7]?_0x33fccf['attrs'][0x7][_0x70b7('0x58')]:undefined)||''},{'name':_0x70b7('0x68'),'value':_0x33fccf[_0x70b7('0x68')]||(_0x33fccf[_0x70b7('0x57')]&&_0x33fccf['attrs'][0x8]?_0x33fccf[_0x70b7('0x57')][0x8]['value']:undefined)||''},{'name':_0x70b7('0x69'),'value':_0x33fccf[_0x70b7('0x69')]||(_0x33fccf[_0x70b7('0x57')]&&_0x33fccf['attrs'][0x9]?_0x33fccf['attrs'][0x9][_0x70b7('0x58')]:undefined)||''}];case _0x70b7('0x6a'):case _0x70b7('0x6b'):return[{'name':_0x70b7('0x6c'),'value':_0x33fccf[_0x70b7('0x6c')]||(_0x33fccf[_0x70b7('0x57')]&&_0x33fccf[_0x70b7('0x57')][0x0]?_0x33fccf[_0x70b7('0x57')][0x0][_0x70b7('0x58')]:undefined)||_0x70b7('0x6d')},{'name':'attrSerie2','value':_0x33fccf[_0x70b7('0x6e')]||(_0x33fccf[_0x70b7('0x57')]&&_0x33fccf['attrs'][0x1]?_0x33fccf[_0x70b7('0x57')][0x1][_0x70b7('0x58')]:undefined)||null},{'name':_0x70b7('0x6f'),'value':_0x33fccf[_0x70b7('0x6f')]||(_0x33fccf[_0x70b7('0x57')]&&_0x33fccf[_0x70b7('0x57')][0x2]?_0x33fccf['attrs'][0x2][_0x70b7('0x58')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x33fccf['attrVoiceQueues']||(_0x33fccf['attrs']&&_0x33fccf['attrs'][0x3]?_0x33fccf['attrs'][0x3][_0x70b7('0x58')]:undefined)||[]},{'name':_0x70b7('0x62'),'value':_0x33fccf[_0x70b7('0x62')]||(_0x33fccf[_0x70b7('0x57')]&&_0x33fccf[_0x70b7('0x57')][0x4]?_0x33fccf[_0x70b7('0x57')][0x4][_0x70b7('0x58')]:undefined)||_0x70b7('0x63')},{'name':_0x70b7('0x64'),'value':_0x33fccf[_0x70b7('0x64')]||(_0x33fccf['attrs']&&_0x33fccf[_0x70b7('0x57')][0x5]?_0x33fccf[_0x70b7('0x57')][0x5][_0x70b7('0x58')]:undefined)||''},{'name':_0x70b7('0x65'),'value':_0x33fccf[_0x70b7('0x65')]||(_0x33fccf[_0x70b7('0x57')]&&_0x33fccf['attrs'][0x6]?_0x33fccf[_0x70b7('0x57')][0x6][_0x70b7('0x58')]:undefined)||''},{'name':_0x70b7('0x66'),'value':_0x33fccf['attrSmsAccounts']||(_0x33fccf['attrs']&&_0x33fccf[_0x70b7('0x57')][0x7]?_0x33fccf[_0x70b7('0x57')][0x7][_0x70b7('0x58')]:undefined)||''},{'name':_0x70b7('0x67'),'value':_0x33fccf[_0x70b7('0x67')]||(_0x33fccf[_0x70b7('0x57')]&&_0x33fccf[_0x70b7('0x57')][0x8]?_0x33fccf['attrs'][0x8][_0x70b7('0x58')]:undefined)||''},{'name':_0x70b7('0x68'),'value':_0x33fccf['attrWhatsappAccounts']||(_0x33fccf['attrs']&&_0x33fccf[_0x70b7('0x57')][0x9]?_0x33fccf[_0x70b7('0x57')][0x9][_0x70b7('0x58')]:undefined)||''},{'name':_0x70b7('0x69'),'value':_0x33fccf[_0x70b7('0x69')]||(_0x33fccf[_0x70b7('0x57')]&&_0x33fccf['attrs'][0xa]?_0x33fccf[_0x70b7('0x57')][0xa]['value']:undefined)||''}];case _0x70b7('0x70'):return[{'name':'attrReport','type':_0x33fccf[_0x70b7('0x71')]||(_0x33fccf[_0x70b7('0x57')]&&_0x33fccf['attrs'][0x0]?_0x33fccf[_0x70b7('0x57')][0x0][_0x70b7('0x30')]:undefined)||null,'value':_0x33fccf[_0x70b7('0x72')]||(_0x33fccf[_0x70b7('0x57')]&&_0x33fccf['attrs'][0x0]?_0x33fccf[_0x70b7('0x57')][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x33fccf[_0x70b7('0x73')]||(_0x33fccf['attrs']&&_0x33fccf[_0x70b7('0x57')][0x1]?_0x33fccf[_0x70b7('0x57')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x1c8d07){logger[_0x70b7('0x54')](_0x70b7('0x74'),JSON[_0x70b7('0x75')](_0x1c8d07));return[];}}exports[_0x70b7('0x76')]=function(_0x4fa2d4,_0x26bd69,_0x59da1d){if(_0x4fa2d4[_0x70b7('0x53')]['id']){delete _0x4fa2d4[_0x70b7('0x53')]['id'];}return db['Dashboard']['find']({'where':{'id':_0x4fa2d4[_0x70b7('0x40')]['id']}})['then'](handleEntityNotFound(_0x26bd69,null))[_0x70b7('0x24')](function(_0x3372c8){if(_0x3372c8){_0x4fa2d4[_0x70b7('0x53')][_0x70b7('0x77')]=_0x3372c8['id'];_0x4fa2d4['body'][_0x70b7('0x57')]=widgetAttributes(_0x4fa2d4[_0x70b7('0x53')]);return db['DashboardItem'][_0x70b7('0x46')](_0x4fa2d4['body']);}})[_0x70b7('0x24')](respondWithResult(_0x26bd69,null))[_0x70b7('0x45')](handleError(_0x26bd69,null));};exports['getItems']=function(_0x1c9ec8,_0x15d0c6,_0x5607fc){var _0x227808={};var _0x4cdcaf={};var _0x11867a;var _0x35accf;return db[_0x70b7('0x2e')][_0x70b7('0x78')]({'where':{'id':_0x1c9ec8[_0x70b7('0x40')]['id']}})[_0x70b7('0x24')](handleEntityNotFound(_0x15d0c6,null))[_0x70b7('0x24')](function(_0xda2e6){if(_0xda2e6){_0x11867a=_0xda2e6;_0x4cdcaf[_0x70b7('0x32')]=_[_0x70b7('0x41')](db['DashboardItem'][_0x70b7('0x42')]);_0x4cdcaf[_0x70b7('0x31')]=_[_0x70b7('0x41')](_0x1c9ec8[_0x70b7('0x31')]);_0x4cdcaf[_0x70b7('0x39')]=_['intersection'](_0x4cdcaf[_0x70b7('0x32')],_0x4cdcaf[_0x70b7('0x31')]);_0x227808[_0x70b7('0x34')]=_['intersection'](_0x4cdcaf['model'],qs[_0x70b7('0x33')](_0x1c9ec8['query'][_0x70b7('0x33')]));_0x227808[_0x70b7('0x34')]=_0x227808[_0x70b7('0x34')]['length']?_0x227808['attributes']:_0x4cdcaf[_0x70b7('0x32')];_0x227808['order']=qs[_0x70b7('0x37')](_0x1c9ec8[_0x70b7('0x31')][_0x70b7('0x37')]);_0x227808[_0x70b7('0x3b')]=qs['filters'](_[_0x70b7('0x38')](_0x1c9ec8[_0x70b7('0x31')],_0x4cdcaf[_0x70b7('0x39')]));if(_0x1c9ec8[_0x70b7('0x31')][_0x70b7('0x3a')]){_0x227808[_0x70b7('0x3b')]=_[_0x70b7('0x3c')](_0x227808[_0x70b7('0x3b')],{'$or':_['map'](_0x227808[_0x70b7('0x34')],function(_0x14a5a9){var _0x251bea={};_0x251bea[_0x14a5a9]={'$like':'%'+_0x1c9ec8[_0x70b7('0x31')][_0x70b7('0x3a')]+'%'};return _0x251bea;})});}_0x227808=_[_0x70b7('0x3c')]({},_0x227808,_0x1c9ec8[_0x70b7('0x3e')]);return _0x11867a[_0x70b7('0x79')](_0x227808);}})[_0x70b7('0x24')](function(_0x58306b){if(_0x58306b){_0x35accf=_0x58306b['length'];if(!_0x1c9ec8[_0x70b7('0x31')]['hasOwnProperty'](_0x70b7('0x7a'))){_0x227808[_0x70b7('0x1e')]=qs[_0x70b7('0x1e')](_0x1c9ec8[_0x70b7('0x31')][_0x70b7('0x1e')]);_0x227808[_0x70b7('0x1c')]=qs[_0x70b7('0x1c')](_0x1c9ec8['query'][_0x70b7('0x1c')]);}return _0x11867a[_0x70b7('0x79')](_0x227808);}})[_0x70b7('0x24')](function(_0x16010c){if(_0x16010c){return _0x16010c?{'count':_0x35accf,'rows':_0x16010c}:null;}})['then'](respondWithResult(_0x15d0c6,null))[_0x70b7('0x45')](handleError(_0x15d0c6,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index d6fc574..d2f9369 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 _0x1cc6=['hasOwnProperty','hook','exports','events','Dashboard','setMaxListeners','save','remove','emit'];(function(_0x1e05c1,_0x3cffa3){var _0x15f1ca=function(_0x3a9594){while(--_0x3a9594){_0x1e05c1['push'](_0x1e05c1['shift']());}};_0x15f1ca(++_0x3cffa3);}(_0x1cc6,0x174));var _0x61cc=function(_0x6e1239,_0x3562ac){_0x6e1239=_0x6e1239-0x0;var _0x418150=_0x1cc6[_0x6e1239];return _0x418150;};'use strict';var EventEmitter=require(_0x61cc('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x61cc('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x61cc('0x2')](0x0);var events={'afterCreate':_0x61cc('0x3'),'afterUpdate':'update','afterDestroy':_0x61cc('0x4')};function emitEvent(_0x29c52c){return function(_0x3443b9,_0x4adf76,_0x1d7e04){DashboardEvents[_0x61cc('0x5')](_0x29c52c+':'+_0x3443b9['id'],_0x3443b9);DashboardEvents[_0x61cc('0x5')](_0x29c52c,_0x3443b9);_0x1d7e04(null);};}for(var e in events){if(events[_0x61cc('0x6')](e)){var event=events[e];Dashboard[_0x61cc('0x7')](e,emitEvent(event));}}module[_0x61cc('0x8')]=DashboardEvents; \ No newline at end of file +var _0x175e=['Dashboard','setMaxListeners','save','update','remove','emit','hook','events','../../mysqldb'];(function(_0x4cba56,_0x5b2c44){var _0x3cc9f3=function(_0x5bb80a){while(--_0x5bb80a){_0x4cba56['push'](_0x4cba56['shift']());}};_0x3cc9f3(++_0x5b2c44);}(_0x175e,0x19c));var _0xe175=function(_0x10e7dc,_0x107f01){_0x10e7dc=_0x10e7dc-0x0;var _0x32d917=_0x175e[_0x10e7dc];return _0x32d917;};'use strict';var EventEmitter=require(_0xe175('0x0'));var Dashboard=require(_0xe175('0x1'))['db'][_0xe175('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xe175('0x3')](0x0);var events={'afterCreate':_0xe175('0x4'),'afterUpdate':_0xe175('0x5'),'afterDestroy':_0xe175('0x6')};function emitEvent(_0x146856){return function(_0x33aa2e,_0x482ee5,_0x5808c7){DashboardEvents[_0xe175('0x7')](_0x146856+':'+_0x33aa2e['id'],_0x33aa2e);DashboardEvents['emit'](_0x146856,_0x33aa2e);_0x5808c7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0xe175('0x8')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index d3adbbb..0b5864c 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 _0x48d3=['../../config/environment','exports','define','Dashboard','lodash','util','../../config/logger','api','path','rimraf'];(function(_0x434fba,_0x455b0c){var _0x326ad0=function(_0x5a6882){while(--_0x5a6882){_0x434fba['push'](_0x434fba['shift']());}};_0x326ad0(++_0x455b0c);}(_0x48d3,0x90));var _0x348d=function(_0x1ca2c3,_0x534ac1){_0x1ca2c3=_0x1ca2c3-0x0;var _0xda5b8a=_0x48d3[_0x1ca2c3];return _0xda5b8a;};'use strict';var _=require(_0x348d('0x0'));var util=require(_0x348d('0x1'));var logger=require(_0x348d('0x2'))(_0x348d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x348d('0x4'));var rimraf=require(_0x348d('0x5'));var config=require(_0x348d('0x6'));var attributes=require('./dashboard.attributes');module[_0x348d('0x7')]=function(_0x20ca97,_0x49a548){return _0x20ca97[_0x348d('0x8')](_0x348d('0x9'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb734=['Dashboard','lodash','../../config/logger','bluebird','request-promise','path','rimraf','./dashboard.attributes','exports'];(function(_0x5d88c0,_0x5d7d83){var _0x1b40f0=function(_0x3fde10){while(--_0x3fde10){_0x5d88c0['push'](_0x5d88c0['shift']());}};_0x1b40f0(++_0x5d7d83);}(_0xb734,0xe2));var _0x4b73=function(_0x298064,_0x1d2bfb){_0x298064=_0x298064-0x0;var _0x2512ea=_0xb734[_0x298064];return _0x2512ea;};'use strict';var _=require(_0x4b73('0x0'));var util=require('util');var logger=require(_0x4b73('0x1'))('api');var moment=require('moment');var BPromise=require(_0x4b73('0x2'));var rp=require(_0x4b73('0x3'));var fs=require('fs');var path=require(_0x4b73('0x4'));var rimraf=require(_0x4b73('0x5'));var config=require('../../config/environment');var attributes=require(_0x4b73('0x6'));module[_0x4b73('0x7')]=function(_0x1d84d1,_0x11914b){return _0x1d84d1['define'](_0x4b73('0x8'),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 af99499..5743b38 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 _0xd9fe=['Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3e25c1,_0x1d15f9){var _0x52e7f2=function(_0x597a5a){while(--_0x597a5a){_0x3e25c1['push'](_0x3e25c1['shift']());}};_0x52e7f2(++_0x1d15f9);}(_0xd9fe,0x1a6));var _0xed9f=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xd9fe[_0x5f1391];return _0x50ebe3;};'use strict';var _=require(_0xed9f('0x0'));var util=require(_0xed9f('0x1'));var moment=require(_0xed9f('0x2'));var BPromise=require(_0xed9f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xed9f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xed9f('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xed9f('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xed9f('0x7')]({'port':0x232a});config['redis']=_[_0xed9f('0x8')](config[_0xed9f('0x9')],{'host':_0xed9f('0xa'),'port':0x18eb});var socket=require(_0xed9f('0xb'))(new Redis(config[_0xed9f('0x9')]));require(_0xed9f('0xc'))[_0xed9f('0xd')](socket);function respondWithRpcPromise(_0x568232,_0x558526,_0x556811){return new BPromise(function(_0x1f356c,_0x240eca){return client[_0xed9f('0xe')](_0x568232,_0x556811)[_0xed9f('0xf')](function(_0xe1009c){logger[_0xed9f('0x10')](_0xed9f('0x11'),_0x558526,_0xed9f('0x12'));logger[_0xed9f('0x13')](_0xed9f('0x14'),_0x558526,_0xed9f('0x12'),JSON[_0xed9f('0x15')](_0xe1009c));if(_0xe1009c['error']){if(_0xe1009c[_0xed9f('0x16')][_0xed9f('0x17')]===0x1f4){logger[_0xed9f('0x16')](_0xed9f('0x11'),_0x558526,_0xe1009c['error']['message']);return _0x240eca(_0xe1009c[_0xed9f('0x16')]['message']);}logger[_0xed9f('0x16')](_0xed9f('0x11'),_0x558526,_0xe1009c['error'][_0xed9f('0x18')]);return _0x1f356c(_0xe1009c['error'][_0xed9f('0x18')]);}else{logger['info'](_0xed9f('0x11'),_0x558526,_0xed9f('0x12'));_0x1f356c(_0xe1009c['result'][_0xed9f('0x18')]);}})[_0xed9f('0x19')](function(_0xe036a){logger['error'](_0xed9f('0x11'),_0x558526,_0xe036a);_0x240eca(_0xe036a);});});} \ No newline at end of file +var _0x034d=['../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1e2080,_0x53283b){var _0x260111=function(_0x15da5e){while(--_0x15da5e){_0x1e2080['push'](_0x1e2080['shift']());}};_0x260111(++_0x53283b);}(_0x034d,0x1b9));var _0xd034=function(_0x2d418a,_0x1030b0){_0x2d418a=_0x2d418a-0x0;var _0x524548=_0x034d[_0x2d418a];return _0x524548;};'use strict';var _=require(_0xd034('0x0'));var util=require(_0xd034('0x1'));var moment=require(_0xd034('0x2'));var BPromise=require('bluebird');var rs=require(_0xd034('0x3'));var fs=require('fs');var Redis=require(_0xd034('0x4'));var db=require(_0xd034('0x5'))['db'];var utils=require(_0xd034('0x6'));var logger=require(_0xd034('0x7'))(_0xd034('0x8'));var config=require(_0xd034('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd034('0xa')][_0xd034('0xb')]({'port':0x232a});config[_0xd034('0xc')]=_[_0xd034('0xd')](config[_0xd034('0xc')],{'host':_0xd034('0xe'),'port':0x18eb});var socket=require(_0xd034('0xf'))(new Redis(config[_0xd034('0xc')]));require(_0xd034('0x10'))[_0xd034('0x11')](socket);function respondWithRpcPromise(_0x6ebbc2,_0x8beaf3,_0x247f36){return new BPromise(function(_0x4f7d1a,_0x592e48){return client['request'](_0x6ebbc2,_0x247f36)[_0xd034('0x12')](function(_0x5cbd0f){logger[_0xd034('0x13')](_0xd034('0x14'),_0x8beaf3,_0xd034('0x15'));logger[_0xd034('0x16')](_0xd034('0x17'),_0x8beaf3,_0xd034('0x15'),JSON['stringify'](_0x5cbd0f));if(_0x5cbd0f[_0xd034('0x18')]){if(_0x5cbd0f[_0xd034('0x18')]['code']===0x1f4){logger[_0xd034('0x18')]('Dashboard,\x20%s,\x20%s',_0x8beaf3,_0x5cbd0f[_0xd034('0x18')]['message']);return _0x592e48(_0x5cbd0f['error']['message']);}logger[_0xd034('0x18')](_0xd034('0x14'),_0x8beaf3,_0x5cbd0f[_0xd034('0x18')][_0xd034('0x19')]);return _0x4f7d1a(_0x5cbd0f['error']['message']);}else{logger[_0xd034('0x13')](_0xd034('0x14'),_0x8beaf3,_0xd034('0x15'));_0x4f7d1a(_0x5cbd0f[_0xd034('0x1a')][_0xd034('0x19')]);}})[_0xd034('0x1b')](function(_0x1f9dcd){logger[_0xd034('0x18')](_0xd034('0x14'),_0x8beaf3,_0x1f9dcd);_0x592e48(_0x1f9dcd);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index c376c8c..73e280f 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 _0x2407=['save','remove','update','emit','removeListener','register','length','dashboard:','./dashboard.events'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x2407,0xe0));var _0x7240=function(_0x2d991c,_0x1583d4){_0x2d991c=_0x2d991c-0x0;var _0x3d5af5=_0x2407[_0x2d991c];return _0x3d5af5;};'use strict';var DashboardEvents=require(_0x7240('0x0'));var events=[_0x7240('0x1'),_0x7240('0x2'),_0x7240('0x3')];function createListener(_0x168271,_0x577e7f){return function(_0x4f2ca1){_0x577e7f[_0x7240('0x4')](_0x168271,_0x4f2ca1);};}function removeListener(_0x4c81c1,_0x3d39f7){return function(){DashboardEvents[_0x7240('0x5')](_0x4c81c1,_0x3d39f7);};}exports[_0x7240('0x6')]=function(_0x46cdb9){for(var _0xb56a63=0x0,_0x3ea315=events[_0x7240('0x7')];_0xb56a63<_0x3ea315;_0xb56a63++){var _0x4b6df4=events[_0xb56a63];var _0xedaa9=createListener(_0x7240('0x8')+_0x4b6df4,_0x46cdb9);DashboardEvents['on'](_0x4b6df4,_0xedaa9);}}; \ No newline at end of file +var _0xceda=['dashboard:','./dashboard.events','save','remove','update','emit','removeListener','register','length'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xceda,0x118));var _0xaced=function(_0x460937,_0x44b41b){_0x460937=_0x460937-0x0;var _0x1d4299=_0xceda[_0x460937];return _0x1d4299;};'use strict';var DashboardEvents=require(_0xaced('0x0'));var events=[_0xaced('0x1'),_0xaced('0x2'),_0xaced('0x3')];function createListener(_0x2bd22e,_0x394d55){return function(_0x52ecee){_0x394d55[_0xaced('0x4')](_0x2bd22e,_0x52ecee);};}function removeListener(_0x5f0d81,_0x43a463){return function(){DashboardEvents[_0xaced('0x5')](_0x5f0d81,_0x43a463);};}exports[_0xaced('0x6')]=function(_0x219736){for(var _0x5cf660=0x0,_0x18b971=events[_0xaced('0x7')];_0x5cf660<_0x18b971;_0x5cf660++){var _0x2676a7=events[_0x5cf660];var _0x4e9928=createListener(_0xaced('0x8')+_0x2676a7,_0x219736);DashboardEvents['on'](_0x2676a7,_0x4e9928);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index bcc5517..6f40a40 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 _0x4b79=['exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./dashboard.controller','get','index','/:id','isAuthenticated','/:id/items','getItems','create','post','clone','addItem','put','delete','destroy'];(function(_0x3a1cab,_0x487dfe){var _0x5cd766=function(_0x3e7857){while(--_0x3e7857){_0x3a1cab['push'](_0x3a1cab['shift']());}};_0x5cd766(++_0x487dfe);}(_0x4b79,0x9b));var _0x94b7=function(_0x3d9871,_0x1026ec){_0x3d9871=_0x3d9871-0x0;var _0x2fd746=_0x4b79[_0x3d9871];return _0x2fd746;};'use strict';var multer=require(_0x94b7('0x0'));var util=require(_0x94b7('0x1'));var path=require(_0x94b7('0x2'));var timeout=require(_0x94b7('0x3'));var express=require(_0x94b7('0x4'));var router=express[_0x94b7('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x94b7('0x6'));var config=require('../../config/environment');var controller=require(_0x94b7('0x7'));router[_0x94b7('0x8')]('/',auth['isAuthenticated'](),controller[_0x94b7('0x9')]);router[_0x94b7('0x8')](_0x94b7('0xa'),auth[_0x94b7('0xb')](),controller['show']);router[_0x94b7('0x8')](_0x94b7('0xc'),auth[_0x94b7('0xb')](),controller[_0x94b7('0xd')]);router['post']('/',auth[_0x94b7('0xb')](),controller[_0x94b7('0xe')]);router[_0x94b7('0xf')]('/:id/clone',auth['isAuthenticated'](),controller[_0x94b7('0x10')]);router[_0x94b7('0xf')](_0x94b7('0xc'),auth[_0x94b7('0xb')](),controller[_0x94b7('0x11')]);router[_0x94b7('0x12')](_0x94b7('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x94b7('0x13')](_0x94b7('0xa'),auth['isAuthenticated'](),controller[_0x94b7('0x14')]);module[_0x94b7('0x15')]=router; \ No newline at end of file +var _0xc809=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboard.controller','get','isAuthenticated','index','show','/:id/items','getItems','post','/:id/clone','clone','addItem','put','/:id','delete','exports','multer'];(function(_0x319516,_0x270808){var _0x289583=function(_0x522522){while(--_0x522522){_0x319516['push'](_0x319516['shift']());}};_0x289583(++_0x270808);}(_0xc809,0x11d));var _0x9c80=function(_0x13c68d,_0x58a3f2){_0x13c68d=_0x13c68d-0x0;var _0x325607=_0xc809[_0x13c68d];return _0x325607;};'use strict';var multer=require(_0x9c80('0x0'));var util=require('util');var path=require(_0x9c80('0x1'));var timeout=require(_0x9c80('0x2'));var express=require(_0x9c80('0x3'));var router=express['Router']();var fs_extra=require(_0x9c80('0x4'));var auth=require(_0x9c80('0x5'));var interaction=require(_0x9c80('0x6'));var config=require('../../config/environment');var controller=require(_0x9c80('0x7'));router[_0x9c80('0x8')]('/',auth[_0x9c80('0x9')](),controller[_0x9c80('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x9c80('0xb')]);router['get'](_0x9c80('0xc'),auth[_0x9c80('0x9')](),controller[_0x9c80('0xd')]);router[_0x9c80('0xe')]('/',auth[_0x9c80('0x9')](),controller['create']);router[_0x9c80('0xe')](_0x9c80('0xf'),auth[_0x9c80('0x9')](),controller[_0x9c80('0x10')]);router[_0x9c80('0xe')](_0x9c80('0xc'),auth[_0x9c80('0x9')](),controller[_0x9c80('0x11')]);router[_0x9c80('0x12')](_0x9c80('0x13'),auth[_0x9c80('0x9')](),controller['update']);router[_0x9c80('0x14')](_0x9c80('0x13'),auth[_0x9c80('0x9')](),controller['destroy']);module[_0x9c80('0x15')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 094dc13..773c530 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 _0xeff8=['sequelize','squel','exports','STRING','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3'];(function(_0x1b80da,_0x156fef){var _0x59c408=function(_0x273559){while(--_0x273559){_0x1b80da['push'](_0x1b80da['shift']());}};_0x59c408(++_0x156fef);}(_0xeff8,0x186));var _0x8eff=function(_0xf0bc07,_0x510ebf){_0xf0bc07=_0xf0bc07-0x0;var _0x1c50c2=_0xeff8[_0xf0bc07];return _0x1c50c2;};'use strict';var Sequelize=require(_0x8eff('0x0'));var squel=require(_0x8eff('0x1'));var _=require('lodash');module[_0x8eff('0x2')]={'title':{'type':Sequelize[_0x8eff('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x8eff('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x8eff('0x4')),'get':function(){try{return JSON[_0x8eff('0x5')](this[_0x8eff('0x6')](_0x8eff('0x7')));}catch(_0x4ac51c){return[];}},'set':function(_0x469641){try{this[_0x8eff('0x8')](_0x8eff('0x7'),JSON[_0x8eff('0x9')](_0x469641));}catch(_0x491f01){this[_0x8eff('0x8')](_0x8eff('0x7'),JSON[_0x8eff('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0x8eff('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x8eff('0xa')]},'background':{'type':Sequelize[_0x8eff('0x3')],'allowNull':![],'defaultValue':_0x8eff('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8eff('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x8eff('0x3')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0xbd51=['setDataValue','INTEGER','#ffffff','#2196f3','sequelize','lodash','exports','STRING','attrs','stringify'];(function(_0x1f2e24,_0x5a3f7f){var _0x13387f=function(_0xb2b75e){while(--_0xb2b75e){_0x1f2e24['push'](_0x1f2e24['shift']());}};_0x13387f(++_0x5a3f7f);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x39db77,_0x4512b9){_0x39db77=_0x39db77-0x0;var _0x53d6ae=_0xbd51[_0x39db77];return _0x53d6ae;};'use strict';var Sequelize=require(_0x1bd5('0x0'));var squel=require('squel');var _=require(_0x1bd5('0x1'));module[_0x1bd5('0x2')]={'title':{'type':Sequelize[_0x1bd5('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x1bd5('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT']('long'),'get':function(){try{return JSON['parse'](this['getDataValue'](_0x1bd5('0x4')));}catch(_0x362b24){return[];}},'set':function(_0x43e6b6){try{this['setDataValue'](_0x1bd5('0x4'),JSON[_0x1bd5('0x5')](_0x43e6b6));}catch(_0x19077c){this[_0x1bd5('0x6')](_0x1bd5('0x4'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x1bd5('0x7')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x1bd5('0x7')]},'col':{'type':Sequelize[_0x1bd5('0x7')]},'background':{'type':Sequelize[_0x1bd5('0x3')],'allowNull':![],'defaultValue':_0x1bd5('0x8'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x1bd5('0x3')],'allowNull':![],'defaultValue':_0x1bd5('0x9'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0x1bd5('0x7')],'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 9386ac3..8ad2464 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 _0x323f=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','stack','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','merge','find','destroy','catch','type','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','attrEmailAccounts','web-report','attrReport','reportType','error','stringify','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x4eca44,_0x3482ee){var _0x1a8b00=function(_0x456685){while(--_0x456685){_0x4eca44['push'](_0x4eca44['shift']());}};_0x1a8b00(++_0x3482ee);}(_0x323f,0x1ee));var _0xf323=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x323f[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf323('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf323('0x1'));var rp=require(_0xf323('0x2'));var moment=require(_0xf323('0x3'));var BPromise=require(_0xf323('0x4'));var Mustache=require(_0xf323('0x5'));var util=require(_0xf323('0x6'));var path=require(_0xf323('0x7'));var sox=require(_0xf323('0x8'));var csv=require(_0xf323('0x9'));var ejs=require(_0xf323('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf323('0xb'));var squel=require(_0xf323('0xc'));var crypto=require(_0xf323('0xd'));var jsforce=require(_0xf323('0xe'));var deskjs=require(_0xf323('0xf'));var toCsv=require(_0xf323('0x9'));var querystring=require(_0xf323('0x10'));var Papa=require(_0xf323('0x11'));var Redis=require(_0xf323('0x12'));var authService=require(_0xf323('0x13'));var qs=require(_0xf323('0x14'));var as=require(_0xf323('0x15'));var hardwareService=require(_0xf323('0x16'));var logger=require(_0xf323('0x17'))(_0xf323('0x18'));var utils=require(_0xf323('0x19'));var config=require(_0xf323('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xf323('0x1b'))['db'];config[_0xf323('0x1c')]=_[_0xf323('0x1d')](config['redis'],{'host':_0xf323('0x1e'),'port':0x18eb});var socket=require(_0xf323('0x1f'))(new Redis(config[_0xf323('0x1c')]));require(_0xf323('0x20'))[_0xf323('0x21')](socket);function respondWithStatusCode(_0x144db9,_0x59ffbc){_0x59ffbc=_0x59ffbc||0xcc;return function(_0x4cc3ce){if(_0x4cc3ce){return _0x144db9[_0xf323('0x22')](_0x59ffbc);}return _0x144db9[_0xf323('0x23')](_0x59ffbc)[_0xf323('0x24')]();};}function respondWithResult(_0x3858ee,_0x3db58a){_0x3db58a=_0x3db58a||0xc8;return function(_0x55d87d){if(_0x55d87d){return _0x3858ee[_0xf323('0x23')](_0x3db58a)[_0xf323('0x25')](_0x55d87d);}};}function respondWithFilteredResult(_0xb9859f,_0x44671c){return function(_0x49b115){if(_0x49b115){var _0x2db977=typeof _0x44671c[_0xf323('0x26')]===_0xf323('0x27')&&typeof _0x44671c[_0xf323('0x28')]==='undefined';var _0x409b16=_0x49b115[_0xf323('0x29')];var _0x5baab2=_0x2db977?0x0:_0x44671c[_0xf323('0x26')];var _0x44378e=_0x2db977?_0x49b115[_0xf323('0x29')]:_0x44671c[_0xf323('0x26')]+_0x44671c['limit'];var _0xdc7891;if(_0x44378e>=_0x409b16){_0x44378e=_0x409b16;_0xdc7891=0xc8;}else{_0xdc7891=0xce;}_0xb9859f[_0xf323('0x23')](_0xdc7891);return _0xb9859f[_0xf323('0x2a')]('Content-Range',_0x5baab2+'-'+_0x44378e+'/'+_0x409b16)[_0xf323('0x25')](_0x49b115);}return null;};}function patchUpdates(_0x375473){return function(_0x3e1c49){try{jsonpatch[_0xf323('0x2b')](_0x3e1c49,_0x375473,!![]);}catch(_0x13ec1f){return BPromise[_0xf323('0x2c')](_0x13ec1f);}return _0x3e1c49[_0xf323('0x2d')]();};}function saveUpdates(_0x43bc05,_0x44d324){return function(_0x47fb15){if(_0x47fb15){return _0x47fb15[_0xf323('0x2e')](_0x43bc05)[_0xf323('0x2f')](function(_0x33dc52){return _0x33dc52;});}return null;};}function removeEntity(_0x292ce0,_0x87ec45){return function(_0x1027a7){if(_0x1027a7){return _0x1027a7['destroy']()[_0xf323('0x2f')](function(){_0x292ce0['status'](0xcc)[_0xf323('0x24')]();});}};}function handleEntityNotFound(_0x3902eb,_0x56be0c){return function(_0x46663b){if(!_0x46663b){_0x3902eb[_0xf323('0x22')](0x194);}return _0x46663b;};}function handleError(_0x2b6254,_0x3dcf65){_0x3dcf65=_0x3dcf65||0x1f4;return function(_0x46e3b1){logger['error'](_0x46e3b1[_0xf323('0x30')]);if(_0x46e3b1[_0xf323('0x31')]){delete _0x46e3b1[_0xf323('0x31')];}_0x2b6254[_0xf323('0x23')](_0x3dcf65)[_0xf323('0x32')](_0x46e3b1);};}exports[_0xf323('0x33')]=function(_0x17cb4d,_0x1723b7){var _0x139adc={'raw':![],'where':{'id':_0x17cb4d[_0xf323('0x34')]['id']}},_0x52300b={};_0x52300b[_0xf323('0x35')]=_[_0xf323('0x36')](db[_0xf323('0x37')][_0xf323('0x38')]);_0x52300b['query']=_[_0xf323('0x36')](_0x17cb4d[_0xf323('0x39')]);_0x52300b[_0xf323('0x3a')]=_[_0xf323('0x3b')](_0x52300b[_0xf323('0x35')],_0x52300b['query']);_0x139adc[_0xf323('0x3c')]=_[_0xf323('0x3b')](_0x52300b[_0xf323('0x35')],qs[_0xf323('0x3d')](_0x17cb4d['query'][_0xf323('0x3d')]));_0x139adc['attributes']=_0x139adc[_0xf323('0x3c')][_0xf323('0x3e')]?_0x139adc['attributes']:_0x52300b[_0xf323('0x35')];if(_0x17cb4d['query'][_0xf323('0x3f')]){_0x139adc['include']=[{'all':!![]}];}_0x139adc=_[_0xf323('0x40')]({},_0x139adc,_0x17cb4d['options']);return db[_0xf323('0x37')][_0xf323('0x41')](_0x139adc)['then'](handleEntityNotFound(_0x1723b7,null))['then'](respondWithResult(_0x1723b7,null))['catch'](handleError(_0x1723b7,null));};exports[_0xf323('0x42')]=function(_0x277a6c,_0x79e636){return db[_0xf323('0x37')][_0xf323('0x41')]({'where':{'id':_0x277a6c['params']['id']}})['then'](handleEntityNotFound(_0x79e636,null))['then'](removeEntity(_0x79e636,null))[_0xf323('0x43')](handleError(_0x79e636,null));};function widgetAttributes(_0x59fee2){try{switch(_0x59fee2[_0xf323('0x44')]){case'iframe':return[{'name':_0xf323('0x45'),'value':_0x59fee2[_0xf323('0x45')]||(_0x59fee2[_0xf323('0x46')]&&_0x59fee2[_0xf323('0x46')][0x0]?_0x59fee2[_0xf323('0x46')][0x0]['value']:undefined)||_0xf323('0x47')}];case _0xf323('0x48'):return[{'name':_0xf323('0x49'),'value':_0x59fee2[_0xf323('0x49')]||(_0x59fee2[_0xf323('0x46')]&&_0x59fee2[_0xf323('0x46')][0x0]?_0x59fee2[_0xf323('0x46')][0x0][_0xf323('0x4a')]:undefined)||''}];case _0xf323('0x4b'):return[{'name':_0xf323('0x4c'),'value':_0x59fee2[_0xf323('0x4c')]||(_0x59fee2[_0xf323('0x46')]&&_0x59fee2[_0xf323('0x46')][0x0]?_0x59fee2[_0xf323('0x46')][0x0][_0xf323('0x4a')]:undefined)||_0xf323('0x4d')},{'name':'attrTimezone','value':_0x59fee2['attrTimezone']||(_0x59fee2[_0xf323('0x46')]&&_0x59fee2[_0xf323('0x46')][0x1]?_0x59fee2[_0xf323('0x46')][0x1][_0xf323('0x4a')]:undefined)||_0xf323('0x4e')},{'name':_0xf323('0x4f'),'value':_0x59fee2[_0xf323('0x4f')]||(_0x59fee2[_0xf323('0x46')]&&_0x59fee2[_0xf323('0x46')][0x2]?_0x59fee2[_0xf323('0x46')][0x2][_0xf323('0x4a')]:undefined)||0xc}];case _0xf323('0x50'):return[{'name':_0xf323('0x51'),'value':_0x59fee2['attrMetric']||(_0x59fee2[_0xf323('0x46')]&&_0x59fee2['attrs'][0x0]?_0x59fee2['attrs'][0x0][_0xf323('0x4a')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x59fee2[_0xf323('0x52')]||(_0x59fee2[_0xf323('0x46')]&&_0x59fee2[_0xf323('0x46')][0x1]?_0x59fee2[_0xf323('0x46')][0x1][_0xf323('0x4a')]:undefined)||[]},{'name':_0xf323('0x4f'),'value':_0x59fee2[_0xf323('0x4f')]||(_0x59fee2[_0xf323('0x46')]&&_0x59fee2[_0xf323('0x46')][0x2]?_0x59fee2[_0xf323('0x46')][0x2][_0xf323('0x4a')]:undefined)||0x14},{'name':'attrChannel','value':_0x59fee2[_0xf323('0x53')]||(_0x59fee2['attrs']&&_0x59fee2[_0xf323('0x46')][0x3]?_0x59fee2[_0xf323('0x46')][0x3][_0xf323('0x4a')]:undefined)||_0xf323('0x54')},{'name':'attrEmailAccounts','value':_0x59fee2['attrEmailAccounts']||(_0x59fee2[_0xf323('0x46')]&&_0x59fee2['attrs'][0x4]?_0x59fee2[_0xf323('0x46')][0x4]['value']:undefined)||''},{'name':_0xf323('0x55'),'value':_0x59fee2[_0xf323('0x55')]||(_0x59fee2['attrs']&&_0x59fee2[_0xf323('0x46')][0x5]?_0x59fee2[_0xf323('0x46')][0x5][_0xf323('0x4a')]:undefined)||''},{'name':_0xf323('0x56'),'value':_0x59fee2[_0xf323('0x56')]||(_0x59fee2[_0xf323('0x46')]&&_0x59fee2[_0xf323('0x46')][0x6]?_0x59fee2[_0xf323('0x46')][0x6][_0xf323('0x4a')]:undefined)||''},{'name':_0xf323('0x57'),'value':_0x59fee2[_0xf323('0x57')]||(_0x59fee2[_0xf323('0x46')]&&_0x59fee2[_0xf323('0x46')][0x7]?_0x59fee2['attrs'][0x7][_0xf323('0x4a')]:undefined)||''},{'name':_0xf323('0x58'),'value':_0x59fee2[_0xf323('0x58')]||(_0x59fee2[_0xf323('0x46')]&&_0x59fee2[_0xf323('0x46')][0x8]?_0x59fee2[_0xf323('0x46')][0x8]['value']:undefined)||''},{'name':_0xf323('0x59'),'value':_0x59fee2[_0xf323('0x59')]||(_0x59fee2['attrs']&&_0x59fee2[_0xf323('0x46')][0x9]?_0x59fee2[_0xf323('0x46')][0x9]['value']:undefined)||''}];case'multibar-chart':case _0xf323('0x5a'):return[{'name':_0xf323('0x5b'),'value':_0x59fee2[_0xf323('0x5b')]||(_0x59fee2[_0xf323('0x46')]&&_0x59fee2[_0xf323('0x46')][0x0]?_0x59fee2[_0xf323('0x46')][0x0][_0xf323('0x4a')]:undefined)||_0xf323('0x5c')},{'name':'attrSerie2','value':_0x59fee2[_0xf323('0x5d')]||(_0x59fee2[_0xf323('0x46')]&&_0x59fee2[_0xf323('0x46')][0x1]?_0x59fee2[_0xf323('0x46')][0x1][_0xf323('0x4a')]:undefined)||null},{'name':_0xf323('0x5e'),'value':_0x59fee2[_0xf323('0x5e')]||(_0x59fee2['attrs']&&_0x59fee2[_0xf323('0x46')][0x2]?_0x59fee2[_0xf323('0x46')][0x2][_0xf323('0x4a')]:undefined)||null},{'name':_0xf323('0x52'),'value':_0x59fee2[_0xf323('0x52')]||(_0x59fee2[_0xf323('0x46')]&&_0x59fee2[_0xf323('0x46')][0x3]?_0x59fee2[_0xf323('0x46')][0x3][_0xf323('0x4a')]:undefined)||[]},{'name':'attrChannel','value':_0x59fee2[_0xf323('0x53')]||(_0x59fee2[_0xf323('0x46')]&&_0x59fee2[_0xf323('0x46')][0x4]?_0x59fee2['attrs'][0x4][_0xf323('0x4a')]:undefined)||_0xf323('0x54')},{'name':'attrEmailAccounts','value':_0x59fee2[_0xf323('0x5f')]||(_0x59fee2[_0xf323('0x46')]&&_0x59fee2['attrs'][0x5]?_0x59fee2[_0xf323('0x46')][0x5][_0xf323('0x4a')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x59fee2[_0xf323('0x55')]||(_0x59fee2[_0xf323('0x46')]&&_0x59fee2[_0xf323('0x46')][0x6]?_0x59fee2[_0xf323('0x46')][0x6][_0xf323('0x4a')]:undefined)||''},{'name':_0xf323('0x56'),'value':_0x59fee2[_0xf323('0x56')]||(_0x59fee2[_0xf323('0x46')]&&_0x59fee2[_0xf323('0x46')][0x7]?_0x59fee2['attrs'][0x7][_0xf323('0x4a')]:undefined)||''},{'name':_0xf323('0x57'),'value':_0x59fee2['attrOpenchannelAccounts']||(_0x59fee2[_0xf323('0x46')]&&_0x59fee2[_0xf323('0x46')][0x8]?_0x59fee2['attrs'][0x8][_0xf323('0x4a')]:undefined)||''},{'name':_0xf323('0x58'),'value':_0x59fee2[_0xf323('0x58')]||(_0x59fee2[_0xf323('0x46')]&&_0x59fee2['attrs'][0x9]?_0x59fee2[_0xf323('0x46')][0x9][_0xf323('0x4a')]:undefined)||''},{'name':_0xf323('0x59'),'value':_0x59fee2[_0xf323('0x59')]||(_0x59fee2['attrs']&&_0x59fee2[_0xf323('0x46')][0xa]?_0x59fee2[_0xf323('0x46')][0xa][_0xf323('0x4a')]:undefined)||''}];case _0xf323('0x60'):return[{'name':_0xf323('0x61'),'type':_0x59fee2[_0xf323('0x62')]||(_0x59fee2[_0xf323('0x46')]&&_0x59fee2[_0xf323('0x46')][0x0]?_0x59fee2[_0xf323('0x46')][0x0][_0xf323('0x44')]:undefined)||null,'value':_0x59fee2[_0xf323('0x61')]||(_0x59fee2[_0xf323('0x46')]&&_0x59fee2[_0xf323('0x46')][0x0]?_0x59fee2[_0xf323('0x46')][0x0][_0xf323('0x4a')]:undefined)||null},{'name':'attrRefresh','value':_0x59fee2['attrRefresh']||(_0x59fee2[_0xf323('0x46')]&&_0x59fee2[_0xf323('0x46')][0x1]?_0x59fee2[_0xf323('0x46')][0x1][_0xf323('0x4a')]:undefined)||0x0}];default:return[];}}catch(_0x16c9f4){logger[_0xf323('0x63')]('widgetAttributes:\x20%s',JSON[_0xf323('0x64')](_0x16c9f4));return[];}}exports[_0xf323('0x65')]=function(_0x3c103e,_0x3add7c){if(_0x3c103e['body']){_0x3c103e['body'][_0xf323('0x46')]=widgetAttributes(_0x3c103e[_0xf323('0x66')]);}return db[_0xf323('0x37')][_0xf323('0x65')](_0x3c103e[_0xf323('0x66')],{})[_0xf323('0x2f')](respondWithResult(_0x3add7c,0xc9))[_0xf323('0x43')](handleError(_0x3add7c,null));};exports['update']=function(_0x55ba28,_0x2f9d4a){if(_0x55ba28[_0xf323('0x66')]['id']){delete _0x55ba28[_0xf323('0x66')]['id'];}_0x55ba28[_0xf323('0x66')][_0xf323('0x46')]=widgetAttributes(_0x55ba28[_0xf323('0x66')]);return db['DashboardItem'][_0xf323('0x41')]({'where':{'id':_0x55ba28[_0xf323('0x34')]['id']}})['then'](handleEntityNotFound(_0x2f9d4a,null))['then'](saveUpdates(_0x55ba28[_0xf323('0x66')],null))[_0xf323('0x2f')](respondWithResult(_0x2f9d4a,null))['catch'](handleError(_0x2f9d4a,null));}; \ No newline at end of file +var _0x5d58=['type','iframe','attrUrl','attrs','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','value','counter','total','attrVoiceQueues','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrChannel','attrReport','reportType','attrRefresh','error','stringify','create','body','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./dashboardItem.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','sendStatus','stack','name','send','params','model','DashboardItem','rawAttributes','query','filters','attributes','intersection','fields','includeAll','include','merge','options','find','catch'];(function(_0x479d53,_0x30c236){var _0x502b2c=function(_0x557870){while(--_0x557870){_0x479d53['push'](_0x479d53['shift']());}};_0x502b2c(++_0x30c236);}(_0x5d58,0x187));var _0x85d5=function(_0xc50398,_0x24b4e3){_0xc50398=_0xc50398-0x0;var _0x50953b=_0x5d58[_0xc50398];return _0x50953b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x85d5('0x0'));var BPromise=require(_0x85d5('0x1'));var Mustache=require('mustache');var util=require(_0x85d5('0x2'));var path=require(_0x85d5('0x3'));var sox=require('sox');var csv=require(_0x85d5('0x4'));var ejs=require(_0x85d5('0x5'));var fs=require('fs');var fs_extra=require(_0x85d5('0x6'));var _=require(_0x85d5('0x7'));var squel=require('squel');var crypto=require(_0x85d5('0x8'));var jsforce=require(_0x85d5('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x85d5('0x4'));var querystring=require('querystring');var Papa=require(_0x85d5('0xa'));var Redis=require(_0x85d5('0xb'));var authService=require(_0x85d5('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x85d5('0xd'))(_0x85d5('0xe'));var utils=require(_0x85d5('0xf'));var config=require(_0x85d5('0x10'));var licenseUtil=require(_0x85d5('0x11'));var db=require(_0x85d5('0x12'))['db'];config[_0x85d5('0x13')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x85d5('0x14'))(new Redis(config[_0x85d5('0x13')]));require(_0x85d5('0x15'))[_0x85d5('0x16')](socket);function respondWithStatusCode(_0x18a20c,_0x44f702){_0x44f702=_0x44f702||0xcc;return function(_0x1545b4){if(_0x1545b4){return _0x18a20c['sendStatus'](_0x44f702);}return _0x18a20c[_0x85d5('0x17')](_0x44f702)[_0x85d5('0x18')]();};}function respondWithResult(_0x1621ed,_0x3da3f4){_0x3da3f4=_0x3da3f4||0xc8;return function(_0x19f7d5){if(_0x19f7d5){return _0x1621ed[_0x85d5('0x17')](_0x3da3f4)[_0x85d5('0x19')](_0x19f7d5);}};}function respondWithFilteredResult(_0x12bef9,_0x17652b){return function(_0x17acb0){if(_0x17acb0){var _0x3eab37=typeof _0x17652b[_0x85d5('0x1a')]===_0x85d5('0x1b')&&typeof _0x17652b[_0x85d5('0x1c')]===_0x85d5('0x1b');var _0x26981b=_0x17acb0[_0x85d5('0x1d')];var _0x1d6134=_0x3eab37?0x0:_0x17652b['offset'];var _0xc56ad1=_0x3eab37?_0x17acb0[_0x85d5('0x1d')]:_0x17652b['offset']+_0x17652b[_0x85d5('0x1c')];var _0x1264ca;if(_0xc56ad1>=_0x26981b){_0xc56ad1=_0x26981b;_0x1264ca=0xc8;}else{_0x1264ca=0xce;}_0x12bef9['status'](_0x1264ca);return _0x12bef9['set'](_0x85d5('0x1e'),_0x1d6134+'-'+_0xc56ad1+'/'+_0x26981b)['json'](_0x17acb0);}return null;};}function patchUpdates(_0x2f2bae){return function(_0x5ce96e){try{jsonpatch[_0x85d5('0x1f')](_0x5ce96e,_0x2f2bae,!![]);}catch(_0x1f8d27){return BPromise['reject'](_0x1f8d27);}return _0x5ce96e['save']();};}function saveUpdates(_0x4da71b,_0x5f0268){return function(_0xf03669){if(_0xf03669){return _0xf03669[_0x85d5('0x20')](_0x4da71b)[_0x85d5('0x21')](function(_0x466bbd){return _0x466bbd;});}return null;};}function removeEntity(_0x12fea3,_0xef2405){return function(_0x53f5b9){if(_0x53f5b9){return _0x53f5b9[_0x85d5('0x22')]()['then'](function(){_0x12fea3[_0x85d5('0x17')](0xcc)[_0x85d5('0x18')]();});}};}function handleEntityNotFound(_0x233ccd,_0x5cc2cf){return function(_0x2d0497){if(!_0x2d0497){_0x233ccd[_0x85d5('0x23')](0x194);}return _0x2d0497;};}function handleError(_0x815808,_0x370c97){_0x370c97=_0x370c97||0x1f4;return function(_0x4605c5){logger['error'](_0x4605c5[_0x85d5('0x24')]);if(_0x4605c5[_0x85d5('0x25')]){delete _0x4605c5[_0x85d5('0x25')];}_0x815808[_0x85d5('0x17')](_0x370c97)[_0x85d5('0x26')](_0x4605c5);};}exports['show']=function(_0x539dc9,_0x2ce7a9){var _0x24a0a3={'raw':![],'where':{'id':_0x539dc9[_0x85d5('0x27')]['id']}},_0x2d1157={};_0x2d1157[_0x85d5('0x28')]=_['keys'](db[_0x85d5('0x29')][_0x85d5('0x2a')]);_0x2d1157['query']=_['keys'](_0x539dc9[_0x85d5('0x2b')]);_0x2d1157[_0x85d5('0x2c')]=_['intersection'](_0x2d1157[_0x85d5('0x28')],_0x2d1157['query']);_0x24a0a3[_0x85d5('0x2d')]=_[_0x85d5('0x2e')](_0x2d1157['model'],qs[_0x85d5('0x2f')](_0x539dc9[_0x85d5('0x2b')][_0x85d5('0x2f')]));_0x24a0a3[_0x85d5('0x2d')]=_0x24a0a3['attributes']['length']?_0x24a0a3[_0x85d5('0x2d')]:_0x2d1157[_0x85d5('0x28')];if(_0x539dc9[_0x85d5('0x2b')][_0x85d5('0x30')]){_0x24a0a3[_0x85d5('0x31')]=[{'all':!![]}];}_0x24a0a3=_[_0x85d5('0x32')]({},_0x24a0a3,_0x539dc9[_0x85d5('0x33')]);return db[_0x85d5('0x29')][_0x85d5('0x34')](_0x24a0a3)['then'](handleEntityNotFound(_0x2ce7a9,null))['then'](respondWithResult(_0x2ce7a9,null))[_0x85d5('0x35')](handleError(_0x2ce7a9,null));};exports[_0x85d5('0x22')]=function(_0x11f507,_0x416766){return db[_0x85d5('0x29')][_0x85d5('0x34')]({'where':{'id':_0x11f507[_0x85d5('0x27')]['id']}})[_0x85d5('0x21')](handleEntityNotFound(_0x416766,null))['then'](removeEntity(_0x416766,null))[_0x85d5('0x35')](handleError(_0x416766,null));};function widgetAttributes(_0x42e8b4){try{switch(_0x42e8b4[_0x85d5('0x36')]){case _0x85d5('0x37'):return[{'name':'attrUrl','value':_0x42e8b4[_0x85d5('0x38')]||(_0x42e8b4[_0x85d5('0x39')]&&_0x42e8b4[_0x85d5('0x39')][0x0]?_0x42e8b4[_0x85d5('0x39')][0x0]['value']:undefined)||_0x85d5('0x3a')}];case'custom':return[{'name':'attrPath','value':_0x42e8b4[_0x85d5('0x3b')]||(_0x42e8b4['attrs']&&_0x42e8b4[_0x85d5('0x39')][0x0]?_0x42e8b4['attrs'][0x0]['value']:undefined)||''}];case _0x85d5('0x3c'):return[{'name':_0x85d5('0x3d'),'value':_0x42e8b4[_0x85d5('0x3d')]||(_0x42e8b4[_0x85d5('0x39')]&&_0x42e8b4[_0x85d5('0x39')][0x0]?_0x42e8b4['attrs'][0x0]['value']:undefined)||_0x85d5('0x3e')},{'name':_0x85d5('0x3f'),'value':_0x42e8b4[_0x85d5('0x3f')]||(_0x42e8b4[_0x85d5('0x39')]&&_0x42e8b4[_0x85d5('0x39')][0x1]?_0x42e8b4[_0x85d5('0x39')][0x1]['value']:undefined)||'0.00'},{'name':_0x85d5('0x40'),'value':_0x42e8b4['attrFontSize']||(_0x42e8b4[_0x85d5('0x39')]&&_0x42e8b4[_0x85d5('0x39')][0x2]?_0x42e8b4[_0x85d5('0x39')][0x2][_0x85d5('0x41')]:undefined)||0xc}];case _0x85d5('0x42'):return[{'name':'attrMetric','value':_0x42e8b4['attrMetric']||(_0x42e8b4[_0x85d5('0x39')]&&_0x42e8b4[_0x85d5('0x39')][0x0]?_0x42e8b4[_0x85d5('0x39')][0x0][_0x85d5('0x41')]:undefined)||_0x85d5('0x43')},{'name':_0x85d5('0x44'),'value':_0x42e8b4[_0x85d5('0x44')]||(_0x42e8b4[_0x85d5('0x39')]&&_0x42e8b4[_0x85d5('0x39')][0x1]?_0x42e8b4[_0x85d5('0x39')][0x1][_0x85d5('0x41')]:undefined)||[]},{'name':_0x85d5('0x40'),'value':_0x42e8b4[_0x85d5('0x40')]||(_0x42e8b4[_0x85d5('0x39')]&&_0x42e8b4[_0x85d5('0x39')][0x2]?_0x42e8b4[_0x85d5('0x39')][0x2][_0x85d5('0x41')]:undefined)||0x14},{'name':'attrChannel','value':_0x42e8b4['attrChannel']||(_0x42e8b4[_0x85d5('0x39')]&&_0x42e8b4[_0x85d5('0x39')][0x3]?_0x42e8b4[_0x85d5('0x39')][0x3][_0x85d5('0x41')]:undefined)||_0x85d5('0x45')},{'name':_0x85d5('0x46'),'value':_0x42e8b4['attrEmailAccounts']||(_0x42e8b4[_0x85d5('0x39')]&&_0x42e8b4['attrs'][0x4]?_0x42e8b4['attrs'][0x4][_0x85d5('0x41')]:undefined)||''},{'name':_0x85d5('0x47'),'value':_0x42e8b4[_0x85d5('0x47')]||(_0x42e8b4[_0x85d5('0x39')]&&_0x42e8b4[_0x85d5('0x39')][0x5]?_0x42e8b4['attrs'][0x5][_0x85d5('0x41')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x42e8b4[_0x85d5('0x48')]||(_0x42e8b4[_0x85d5('0x39')]&&_0x42e8b4[_0x85d5('0x39')][0x6]?_0x42e8b4['attrs'][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x42e8b4[_0x85d5('0x49')]||(_0x42e8b4[_0x85d5('0x39')]&&_0x42e8b4[_0x85d5('0x39')][0x7]?_0x42e8b4['attrs'][0x7]['value']:undefined)||''},{'name':_0x85d5('0x4a'),'value':_0x42e8b4[_0x85d5('0x4a')]||(_0x42e8b4[_0x85d5('0x39')]&&_0x42e8b4[_0x85d5('0x39')][0x8]?_0x42e8b4['attrs'][0x8][_0x85d5('0x41')]:undefined)||''},{'name':_0x85d5('0x4b'),'value':_0x42e8b4[_0x85d5('0x4b')]||(_0x42e8b4[_0x85d5('0x39')]&&_0x42e8b4[_0x85d5('0x39')][0x9]?_0x42e8b4[_0x85d5('0x39')][0x9][_0x85d5('0x41')]:undefined)||''}];case _0x85d5('0x4c'):case _0x85d5('0x4d'):return[{'name':_0x85d5('0x4e'),'value':_0x42e8b4[_0x85d5('0x4e')]||(_0x42e8b4[_0x85d5('0x39')]&&_0x42e8b4[_0x85d5('0x39')][0x0]?_0x42e8b4[_0x85d5('0x39')][0x0][_0x85d5('0x41')]:undefined)||'total'},{'name':_0x85d5('0x4f'),'value':_0x42e8b4[_0x85d5('0x4f')]||(_0x42e8b4[_0x85d5('0x39')]&&_0x42e8b4[_0x85d5('0x39')][0x1]?_0x42e8b4['attrs'][0x1][_0x85d5('0x41')]:undefined)||null},{'name':'attrSerie3','value':_0x42e8b4[_0x85d5('0x50')]||(_0x42e8b4[_0x85d5('0x39')]&&_0x42e8b4[_0x85d5('0x39')][0x2]?_0x42e8b4[_0x85d5('0x39')][0x2]['value']:undefined)||null},{'name':_0x85d5('0x44'),'value':_0x42e8b4['attrVoiceQueues']||(_0x42e8b4['attrs']&&_0x42e8b4['attrs'][0x3]?_0x42e8b4[_0x85d5('0x39')][0x3][_0x85d5('0x41')]:undefined)||[]},{'name':_0x85d5('0x51'),'value':_0x42e8b4[_0x85d5('0x51')]||(_0x42e8b4[_0x85d5('0x39')]&&_0x42e8b4['attrs'][0x4]?_0x42e8b4['attrs'][0x4][_0x85d5('0x41')]:undefined)||_0x85d5('0x45')},{'name':_0x85d5('0x46'),'value':_0x42e8b4[_0x85d5('0x46')]||(_0x42e8b4['attrs']&&_0x42e8b4[_0x85d5('0x39')][0x5]?_0x42e8b4[_0x85d5('0x39')][0x5][_0x85d5('0x41')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x42e8b4['attrFaxAccounts']||(_0x42e8b4[_0x85d5('0x39')]&&_0x42e8b4[_0x85d5('0x39')][0x6]?_0x42e8b4[_0x85d5('0x39')][0x6]['value']:undefined)||''},{'name':_0x85d5('0x48'),'value':_0x42e8b4[_0x85d5('0x48')]||(_0x42e8b4[_0x85d5('0x39')]&&_0x42e8b4[_0x85d5('0x39')][0x7]?_0x42e8b4['attrs'][0x7][_0x85d5('0x41')]:undefined)||''},{'name':_0x85d5('0x49'),'value':_0x42e8b4[_0x85d5('0x49')]||(_0x42e8b4['attrs']&&_0x42e8b4[_0x85d5('0x39')][0x8]?_0x42e8b4[_0x85d5('0x39')][0x8][_0x85d5('0x41')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x42e8b4[_0x85d5('0x4a')]||(_0x42e8b4[_0x85d5('0x39')]&&_0x42e8b4['attrs'][0x9]?_0x42e8b4[_0x85d5('0x39')][0x9]['value']:undefined)||''},{'name':_0x85d5('0x4b'),'value':_0x42e8b4['attrChatWebsites']||(_0x42e8b4[_0x85d5('0x39')]&&_0x42e8b4[_0x85d5('0x39')][0xa]?_0x42e8b4[_0x85d5('0x39')][0xa][_0x85d5('0x41')]:undefined)||''}];case'web-report':return[{'name':_0x85d5('0x52'),'type':_0x42e8b4[_0x85d5('0x53')]||(_0x42e8b4[_0x85d5('0x39')]&&_0x42e8b4[_0x85d5('0x39')][0x0]?_0x42e8b4[_0x85d5('0x39')][0x0][_0x85d5('0x36')]:undefined)||null,'value':_0x42e8b4[_0x85d5('0x52')]||(_0x42e8b4[_0x85d5('0x39')]&&_0x42e8b4['attrs'][0x0]?_0x42e8b4['attrs'][0x0][_0x85d5('0x41')]:undefined)||null},{'name':'attrRefresh','value':_0x42e8b4[_0x85d5('0x54')]||(_0x42e8b4[_0x85d5('0x39')]&&_0x42e8b4['attrs'][0x1]?_0x42e8b4['attrs'][0x1][_0x85d5('0x41')]:undefined)||0x0}];default:return[];}}catch(_0x1f5b00){logger[_0x85d5('0x55')]('widgetAttributes:\x20%s',JSON[_0x85d5('0x56')](_0x1f5b00));return[];}}exports[_0x85d5('0x57')]=function(_0x123422,_0x2aa68f){if(_0x123422['body']){_0x123422['body'][_0x85d5('0x39')]=widgetAttributes(_0x123422['body']);}return db['DashboardItem'][_0x85d5('0x57')](_0x123422[_0x85d5('0x58')],{})[_0x85d5('0x21')](respondWithResult(_0x2aa68f,0xc9))['catch'](handleError(_0x2aa68f,null));};exports['update']=function(_0x1a7ffc,_0x67ae8d){if(_0x1a7ffc[_0x85d5('0x58')]['id']){delete _0x1a7ffc['body']['id'];}_0x1a7ffc[_0x85d5('0x58')][_0x85d5('0x39')]=widgetAttributes(_0x1a7ffc[_0x85d5('0x58')]);return db[_0x85d5('0x29')][_0x85d5('0x34')]({'where':{'id':_0x1a7ffc[_0x85d5('0x27')]['id']}})[_0x85d5('0x21')](handleEntityNotFound(_0x67ae8d,null))[_0x85d5('0x21')](saveUpdates(_0x1a7ffc['body'],null))['then'](respondWithResult(_0x67ae8d,null))[_0x85d5('0x35')](handleError(_0x67ae8d,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index ad7d4a3..d69ed13 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 _0xe8b1=['hasOwnProperty','events','../../mysqldb','setMaxListeners','save','update','emit'];(function(_0x268358,_0x7b4bcd){var _0x43a4dd=function(_0x7b17aa){while(--_0x7b17aa){_0x268358['push'](_0x268358['shift']());}};_0x43a4dd(++_0x7b4bcd);}(_0xe8b1,0x104));var _0x1e8b=function(_0x574de7,_0x24ce60){_0x574de7=_0x574de7-0x0;var _0x568f46=_0xe8b1[_0x574de7];return _0x568f46;};'use strict';var EventEmitter=require(_0x1e8b('0x0'));var DashboardItem=require(_0x1e8b('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x1e8b('0x2')](0x0);var events={'afterCreate':_0x1e8b('0x3'),'afterUpdate':_0x1e8b('0x4'),'afterDestroy':'remove'};function emitEvent(_0x47f47e){return function(_0x1cd060,_0xfe3a85,_0x17d414){DashboardItemEvents[_0x1e8b('0x5')](_0x47f47e+':'+_0x1cd060['id'],_0x1cd060);DashboardItemEvents[_0x1e8b('0x5')](_0x47f47e,_0x1cd060);_0x17d414(null);};}for(var e in events){if(events[_0x1e8b('0x6')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x8ae2=['hook','events','../../mysqldb','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x2043b7,_0x1e5fc1){var _0x271fc1=function(_0x58f178){while(--_0x58f178){_0x2043b7['push'](_0x2043b7['shift']());}};_0x271fc1(++_0x1e5fc1);}(_0x8ae2,0x143));var _0x28ae=function(_0x4427e7,_0x2497f8){_0x4427e7=_0x4427e7-0x0;var _0x2f7561=_0x8ae2[_0x4427e7];return _0x2f7561;};'use strict';var EventEmitter=require(_0x28ae('0x0'));var DashboardItem=require(_0x28ae('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x28ae('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x28ae('0x3'),'afterDestroy':'remove'};function emitEvent(_0xeb0ff2){return function(_0x30ced7,_0x402180,_0x4db371){DashboardItemEvents['emit'](_0xeb0ff2+':'+_0x30ced7['id'],_0x30ced7);DashboardItemEvents[_0x28ae('0x4')](_0xeb0ff2,_0x30ced7);_0x4db371(null);};}for(var e in events){if(events[_0x28ae('0x5')](e)){var event=events[e];DashboardItem[_0x28ae('0x6')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 81cba85..9d99907 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 _0xf041=['path','../../config/environment','define','DashboardItem','dashboard_items','../../config/logger','api','moment','bluebird'];(function(_0x451361,_0x4ae155){var _0x273cc1=function(_0xa3c1b4){while(--_0xa3c1b4){_0x451361['push'](_0x451361['shift']());}};_0x273cc1(++_0x4ae155);}(_0xf041,0x15b));var _0x1f04=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf041[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1f04('0x0'))(_0x1f04('0x1'));var moment=require(_0x1f04('0x2'));var BPromise=require(_0x1f04('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1f04('0x4'));var rimraf=require('rimraf');var config=require(_0x1f04('0x5'));var attributes=require('./dashboardItem.attributes');module['exports']=function(_0x25d578,_0x504d71){return _0x25d578[_0x1f04('0x6')](_0x1f04('0x7'),attributes,{'tableName':_0x1f04('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e1a=['../../config/environment','./dashboardItem.attributes','define','DashboardItem','util','../../config/logger','moment','bluebird','rimraf'];(function(_0x4d45c1,_0x2beda1){var _0x244478=function(_0x11304c){while(--_0x11304c){_0x4d45c1['push'](_0x4d45c1['shift']());}};_0x244478(++_0x2beda1);}(_0x3e1a,0x187));var _0xa3e1=function(_0x437af9,_0x3c5aef){_0x437af9=_0x437af9-0x0;var _0x25f10d=_0x3e1a[_0x437af9];return _0x25f10d;};'use strict';var _=require('lodash');var util=require(_0xa3e1('0x0'));var logger=require(_0xa3e1('0x1'))('api');var moment=require(_0xa3e1('0x2'));var BPromise=require(_0xa3e1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa3e1('0x4'));var config=require(_0xa3e1('0x5'));var attributes=require(_0xa3e1('0x6'));module['exports']=function(_0x1f35fc,_0x524bd5){return _0x1f35fc[_0xa3e1('0x7')](_0xa3e1('0x8'),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 5b7993d..780665c 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 _0x507b=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','client','http','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x2f133c,_0x2d0ee7){var _0x17fe82=function(_0x42cd77){while(--_0x42cd77){_0x2f133c['push'](_0x2f133c['shift']());}};_0x17fe82(++_0x2d0ee7);}(_0x507b,0x6b));var _0xb507=function(_0x59578a,_0x122395){_0x59578a=_0x59578a-0x0;var _0x5f25dc=_0x507b[_0x59578a];return _0x5f25dc;};'use strict';var _=require(_0xb507('0x0'));var util=require(_0xb507('0x1'));var moment=require(_0xb507('0x2'));var BPromise=require(_0xb507('0x3'));var rs=require(_0xb507('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb507('0x5'))['db'];var utils=require(_0xb507('0x6'));var logger=require('../../config/logger')(_0xb507('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb507('0x8')][_0xb507('0x9')]({'port':0x232a});config[_0xb507('0xa')]=_[_0xb507('0xb')](config[_0xb507('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xb507('0xc'))(new Redis(config['redis']));require(_0xb507('0xd'))[_0xb507('0xe')](socket);function respondWithRpcPromise(_0x2d950a,_0x3626b6,_0x205e54){return new BPromise(function(_0x1384f0,_0x2e2b9a){return client[_0xb507('0xf')](_0x2d950a,_0x205e54)[_0xb507('0x10')](function(_0x5e7915){logger[_0xb507('0x11')]('DashboardItem,\x20%s,\x20%s',_0x3626b6,_0xb507('0x12'));logger[_0xb507('0x13')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x3626b6,'request\x20sent',JSON[_0xb507('0x14')](_0x5e7915));if(_0x5e7915['error']){if(_0x5e7915[_0xb507('0x15')][_0xb507('0x16')]===0x1f4){logger[_0xb507('0x15')](_0xb507('0x17'),_0x3626b6,_0x5e7915[_0xb507('0x15')][_0xb507('0x18')]);return _0x2e2b9a(_0x5e7915['error'][_0xb507('0x18')]);}logger[_0xb507('0x15')]('DashboardItem,\x20%s,\x20%s',_0x3626b6,_0x5e7915[_0xb507('0x15')]['message']);return _0x1384f0(_0x5e7915[_0xb507('0x15')][_0xb507('0x18')]);}else{logger[_0xb507('0x11')](_0xb507('0x17'),_0x3626b6,'request\x20sent');_0x1384f0(_0x5e7915[_0xb507('0x19')][_0xb507('0x18')]);}})[_0xb507('0x1a')](function(_0x56c1ba){logger[_0xb507('0x15')]('DashboardItem,\x20%s,\x20%s',_0x3626b6,_0x56c1ba);_0x2e2b9a(_0x56c1ba);});});} \ No newline at end of file +var _0x591a=['then','request\x20sent','debug','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','request'];(function(_0x1c53ce,_0x2ed327){var _0x4c4a19=function(_0x59bc98){while(--_0x59bc98){_0x1c53ce['push'](_0x1c53ce['shift']());}};_0x4c4a19(++_0x2ed327);}(_0x591a,0x132));var _0xa591=function(_0x405385,_0x56f573){_0x405385=_0x405385-0x0;var _0x43837b=_0x591a[_0x405385];return _0x43837b;};'use strict';var _=require(_0xa591('0x0'));var util=require(_0xa591('0x1'));var moment=require(_0xa591('0x2'));var BPromise=require(_0xa591('0x3'));var rs=require(_0xa591('0x4'));var fs=require('fs');var Redis=require(_0xa591('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa591('0x6'));var logger=require('../../config/logger')(_0xa591('0x7'));var config=require(_0xa591('0x8'));var jayson=require(_0xa591('0x9'));var client=jayson[_0xa591('0xa')][_0xa591('0xb')]({'port':0x232a});config[_0xa591('0xc')]=_[_0xa591('0xd')](config[_0xa591('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xa591('0xe'))(new Redis(config[_0xa591('0xc')]));require(_0xa591('0xf'))[_0xa591('0x10')](socket);function respondWithRpcPromise(_0x59f389,_0x537c0e,_0x2dee77){return new BPromise(function(_0x3bd146,_0x1d1a08){return client[_0xa591('0x11')](_0x59f389,_0x2dee77)[_0xa591('0x12')](function(_0x474a75){logger['info']('DashboardItem,\x20%s,\x20%s',_0x537c0e,_0xa591('0x13'));logger[_0xa591('0x14')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x537c0e,_0xa591('0x13'),JSON[_0xa591('0x15')](_0x474a75));if(_0x474a75[_0xa591('0x16')]){if(_0x474a75[_0xa591('0x16')][_0xa591('0x17')]===0x1f4){logger['error'](_0xa591('0x18'),_0x537c0e,_0x474a75[_0xa591('0x16')]['message']);return _0x1d1a08(_0x474a75['error']['message']);}logger[_0xa591('0x16')](_0xa591('0x18'),_0x537c0e,_0x474a75['error'][_0xa591('0x19')]);return _0x3bd146(_0x474a75[_0xa591('0x16')][_0xa591('0x19')]);}else{logger['info'](_0xa591('0x18'),_0x537c0e,_0xa591('0x13'));_0x3bd146(_0x474a75[_0xa591('0x1a')][_0xa591('0x19')]);}})['catch'](function(_0x43ca69){logger[_0xa591('0x16')]('DashboardItem,\x20%s,\x20%s',_0x537c0e,_0x43ca69);_0x1d1a08(_0x43ca69);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 0e554e3..fdd2ce2 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 _0x2263=['emit','removeListener','length','dashboardItem:','save','remove','update'];(function(_0x3c4dad,_0x25ffd5){var _0x1a4f49=function(_0x6fe6c){while(--_0x6fe6c){_0x3c4dad['push'](_0x3c4dad['shift']());}};_0x1a4f49(++_0x25ffd5);}(_0x2263,0x138));var _0x3226=function(_0x52e363,_0x48062a){_0x52e363=_0x52e363-0x0;var _0x3fc2b5=_0x2263[_0x52e363];return _0x3fc2b5;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x3226('0x0'),_0x3226('0x1'),_0x3226('0x2')];function createListener(_0x5df4f4,_0x2a2e06){return function(_0x56e107){_0x2a2e06[_0x3226('0x3')](_0x5df4f4,_0x56e107);};}function removeListener(_0x1230aa,_0x35c183){return function(){DashboardItemEvents[_0x3226('0x4')](_0x1230aa,_0x35c183);};}exports['register']=function(_0x37b4f5){for(var _0x4a0c52=0x0,_0x27fa82=events[_0x3226('0x5')];_0x4a0c52<_0x27fa82;_0x4a0c52++){var _0x1c0c3e=events[_0x4a0c52];var _0x1cd3c7=createListener(_0x3226('0x6')+_0x1c0c3e,_0x37b4f5);DashboardItemEvents['on'](_0x1c0c3e,_0x1cd3c7);}}; \ No newline at end of file +var _0x28d3=['remove','update','emit','register','dashboardItem:','./dashboardItem.events','save'];(function(_0x269b6c,_0x9f396){var _0x4694d0=function(_0x35215a){while(--_0x35215a){_0x269b6c['push'](_0x269b6c['shift']());}};_0x4694d0(++_0x9f396);}(_0x28d3,0x7c));var _0x328d=function(_0x4a19d6,_0xc46e42){_0x4a19d6=_0x4a19d6-0x0;var _0x240cf9=_0x28d3[_0x4a19d6];return _0x240cf9;};'use strict';var DashboardItemEvents=require(_0x328d('0x0'));var events=[_0x328d('0x1'),_0x328d('0x2'),_0x328d('0x3')];function createListener(_0x39bc24,_0x8a03e8){return function(_0x45da5e){_0x8a03e8[_0x328d('0x4')](_0x39bc24,_0x45da5e);};}function removeListener(_0xb8aef,_0xe21fb7){return function(){DashboardItemEvents['removeListener'](_0xb8aef,_0xe21fb7);};}exports[_0x328d('0x5')]=function(_0x85e065){for(var _0x21d1f7=0x0,_0x1818c3=events['length'];_0x21d1f7<_0x1818c3;_0x21d1f7++){var _0x24ff28=events[_0x21d1f7];var _0x585c5d=createListener(_0x328d('0x6')+_0x24ff28,_0x85e065);DashboardItemEvents['on'](_0x24ff28,_0x585c5d);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index ddc47cc..9b684fe 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 _0x580f=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','put','update','delete','destroy','multer','util','path'];(function(_0x3f6a22,_0x3aabbc){var _0x266a2e=function(_0x45d1ef){while(--_0x45d1ef){_0x3f6a22['push'](_0x3f6a22['shift']());}};_0x266a2e(++_0x3aabbc);}(_0x580f,0x107));var _0xf580=function(_0x2def0c,_0x2b9d5f){_0x2def0c=_0x2def0c-0x0;var _0x1c2a60=_0x580f[_0x2def0c];return _0x1c2a60;};'use strict';var multer=require(_0xf580('0x0'));var util=require(_0xf580('0x1'));var path=require(_0xf580('0x2'));var timeout=require(_0xf580('0x3'));var express=require(_0xf580('0x4'));var router=express[_0xf580('0x5')]();var fs_extra=require(_0xf580('0x6'));var auth=require(_0xf580('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xf580('0x8'));var controller=require(_0xf580('0x9'));router[_0xf580('0xa')](_0xf580('0xb'),auth[_0xf580('0xc')](),controller[_0xf580('0xd')]);router[_0xf580('0xe')]('/',auth[_0xf580('0xc')](),controller['create']);router[_0xf580('0xf')]('/:id',auth[_0xf580('0xc')](),controller[_0xf580('0x10')]);router[_0xf580('0x11')](_0xf580('0xb'),auth[_0xf580('0xc')](),controller[_0xf580('0x12')]);module['exports']=router; \ No newline at end of file +var _0xe5f4=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./dashboardItem.controller','get','/:id','isAuthenticated','show','create','put','update','destroy','exports','multer'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe5f4,0x1c1));var _0x4e5f=function(_0x1b0659,_0x586a89){_0x1b0659=_0x1b0659-0x0;var _0x1e3bf6=_0xe5f4[_0x1b0659];return _0x1e3bf6;};'use strict';var multer=require(_0x4e5f('0x0'));var util=require(_0x4e5f('0x1'));var path=require(_0x4e5f('0x2'));var timeout=require(_0x4e5f('0x3'));var express=require(_0x4e5f('0x4'));var router=express[_0x4e5f('0x5')]();var fs_extra=require(_0x4e5f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4e5f('0x7'));var config=require('../../config/environment');var controller=require(_0x4e5f('0x8'));router[_0x4e5f('0x9')](_0x4e5f('0xa'),auth[_0x4e5f('0xb')](),controller[_0x4e5f('0xc')]);router['post']('/',auth[_0x4e5f('0xb')](),controller[_0x4e5f('0xd')]);router[_0x4e5f('0xe')](_0x4e5f('0xa'),auth[_0x4e5f('0xb')](),controller[_0x4e5f('0xf')]);router['delete'](_0x4e5f('0xa'),auth['isAuthenticated'](),controller[_0x4e5f('0x10')]);module[_0x4e5f('0x11')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 24542b3..f853130 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 _0x07b6=['ENUM','second','third','first','STRING'];(function(_0x47a5cd,_0x15053b){var _0x353fce=function(_0x19612c){while(--_0x19612c){_0x47a5cd['push'](_0x47a5cd['shift']());}};_0x353fce(++_0x15053b);}(_0x07b6,0x149));var _0x607b=function(_0x23f642,_0x3c8f66){_0x23f642=_0x23f642-0x0;var _0x4ba0d0=_0x07b6[_0x23f642];return _0x4ba0d0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x607b('0x0')],'allowNull':![]},'level':{'type':Sequelize[_0x607b('0x1')]('first',_0x607b('0x2'),_0x607b('0x3')),'allowNull':![],'defaultValue':_0x607b('0x4')},'description':{'type':Sequelize[_0x607b('0x0')]}}; \ No newline at end of file +var _0xf558=['STRING','ENUM','first','second','third','sequelize','exports'];(function(_0x55dd4d,_0x240bee){var _0x5b4554=function(_0x315813){while(--_0x315813){_0x55dd4d['push'](_0x55dd4d['shift']());}};_0x5b4554(++_0x240bee);}(_0xf558,0x186));var _0x8f55=function(_0x4b095c,_0x266c55){_0x4b095c=_0x4b095c-0x0;var _0x4495e2=_0xf558[_0x4b095c];return _0x4495e2;};'use strict';var Sequelize=require(_0x8f55('0x0'));module[_0x8f55('0x1')]={'name':{'type':Sequelize[_0x8f55('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x8f55('0x3')](_0x8f55('0x4'),_0x8f55('0x5'),_0x8f55('0x6')),'allowNull':![],'defaultValue':_0x8f55('0x4')},'description':{'type':Sequelize[_0x8f55('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index cee823e..7cc537d 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 _0x61d7=['set','Content-Range','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','key','query','keys','intersection','model','fields','attributes','hasOwnProperty','order','sort','pick','filters','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x41ead9,_0x3d1582){var _0x43d26c=function(_0x1a1d03){while(--_0x1a1d03){_0x41ead9['push'](_0x41ead9['shift']());}};_0x43d26c(++_0x3d1582);}(_0x61d7,0x1dd));var _0x761d=function(_0x39c86d,_0x102701){_0x39c86d=_0x39c86d-0x0;var _0x490874=_0x61d7[_0x39c86d];return _0x490874;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x761d('0x0'));var zipdir=require(_0x761d('0x1'));var jsonpatch=require(_0x761d('0x2'));var rp=require(_0x761d('0x3'));var moment=require(_0x761d('0x4'));var BPromise=require(_0x761d('0x5'));var Mustache=require(_0x761d('0x6'));var util=require(_0x761d('0x7'));var path=require(_0x761d('0x8'));var sox=require(_0x761d('0x9'));var csv=require(_0x761d('0xa'));var ejs=require(_0x761d('0xb'));var fs=require('fs');var fs_extra=require(_0x761d('0xc'));var _=require('lodash');var squel=require(_0x761d('0xd'));var crypto=require(_0x761d('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x761d('0xf'));var toCsv=require(_0x761d('0xa'));var querystring=require(_0x761d('0x10'));var Papa=require(_0x761d('0x11'));var Redis=require(_0x761d('0x12'));var authService=require(_0x761d('0x13'));var qs=require(_0x761d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x761d('0x15'))(_0x761d('0x16'));var utils=require(_0x761d('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x761d('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1406c0,_0x7496c8){_0x7496c8=_0x7496c8||0xcc;return function(_0x1e3456){if(_0x1e3456){return _0x1406c0[_0x761d('0x19')](_0x7496c8);}return _0x1406c0[_0x761d('0x1a')](_0x7496c8)[_0x761d('0x1b')]();};}function respondWithResult(_0x196c4a,_0x400503){_0x400503=_0x400503||0xc8;return function(_0x2a5a4b){if(_0x2a5a4b){return _0x196c4a[_0x761d('0x1a')](_0x400503)[_0x761d('0x1c')](_0x2a5a4b);}};}function respondWithFilteredResult(_0x1854eb,_0x479000){return function(_0x538ff5){if(_0x538ff5){var _0x56a5ca=typeof _0x479000[_0x761d('0x1d')]===_0x761d('0x1e')&&typeof _0x479000[_0x761d('0x1f')]===_0x761d('0x1e');var _0x34e083=_0x538ff5[_0x761d('0x20')];var _0x49fab5=_0x56a5ca?0x0:_0x479000['offset'];var _0x14798f=_0x56a5ca?_0x538ff5[_0x761d('0x20')]:_0x479000[_0x761d('0x1d')]+_0x479000[_0x761d('0x1f')];var _0x11b411;if(_0x14798f>=_0x34e083){_0x14798f=_0x34e083;_0x11b411=0xc8;}else{_0x11b411=0xce;}_0x1854eb[_0x761d('0x1a')](_0x11b411);return _0x1854eb[_0x761d('0x21')](_0x761d('0x22'),_0x49fab5+'-'+_0x14798f+'/'+_0x34e083)[_0x761d('0x1c')](_0x538ff5);}return null;};}function patchUpdates(_0xe9ea52){return function(_0x45430f){try{jsonpatch['apply'](_0x45430f,_0xe9ea52,!![]);}catch(_0x4cab91){return BPromise[_0x761d('0x23')](_0x4cab91);}return _0x45430f[_0x761d('0x24')]();};}function saveUpdates(_0x540e32,_0x119be2){return function(_0x31bf2e){if(_0x31bf2e){return _0x31bf2e[_0x761d('0x25')](_0x540e32)[_0x761d('0x26')](function(_0x280f64){return _0x280f64;});}return null;};}function removeEntity(_0x3bd3db,_0x4b7f83){return function(_0x4d739f){if(_0x4d739f){return _0x4d739f[_0x761d('0x27')]()[_0x761d('0x26')](function(){var _0x1b33c6=_0x4d739f[_0x761d('0x28')]({'plain':!![]});var _0x4a54b7=_0x761d('0x29');return db[_0x761d('0x2a')]['destroy']({'where':{'type':_0x4a54b7,'resourceId':_0x1b33c6['id']}})[_0x761d('0x26')](function(){return _0x4d739f;});})[_0x761d('0x26')](function(){_0x3bd3db[_0x761d('0x1a')](0xcc)[_0x761d('0x1b')]();});}};}function handleEntityNotFound(_0x55478f,_0x5bf161){return function(_0x4c59a4){if(!_0x4c59a4){_0x55478f[_0x761d('0x19')](0x194);}return _0x4c59a4;};}function handleError(_0x32fe2a,_0x261234){_0x261234=_0x261234||0x1f4;return function(_0x505e8c){logger[_0x761d('0x2b')](_0x505e8c[_0x761d('0x2c')]);if(_0x505e8c[_0x761d('0x2d')]){delete _0x505e8c[_0x761d('0x2d')];}_0x32fe2a[_0x761d('0x1a')](_0x261234)[_0x761d('0x2e')](_0x505e8c);};}exports[_0x761d('0x2f')]=function(_0x10a049,_0x4b33aa){var _0x1d9cb7={},_0x2c5eaf={},_0x28c7aa={'count':0x0,'rows':[]};var _0x57ce5a=_[_0x761d('0x30')](db[_0x761d('0x31')][_0x761d('0x32')],function(_0x246f22){return{'name':_0x246f22[_0x761d('0x33')],'type':_0x246f22['type'][_0x761d('0x34')]};});_0x2c5eaf['model']=_[_0x761d('0x30')](_0x57ce5a,_0x761d('0x2d'));_0x2c5eaf[_0x761d('0x35')]=_[_0x761d('0x36')](_0x10a049[_0x761d('0x35')]);_0x2c5eaf['filters']=_[_0x761d('0x37')](_0x2c5eaf[_0x761d('0x38')],_0x2c5eaf[_0x761d('0x35')]);_0x1d9cb7['attributes']=_['intersection'](_0x2c5eaf[_0x761d('0x38')],qs[_0x761d('0x39')](_0x10a049[_0x761d('0x35')][_0x761d('0x39')]));_0x1d9cb7['attributes']=_0x1d9cb7[_0x761d('0x3a')]['length']?_0x1d9cb7['attributes']:_0x2c5eaf['model'];if(!_0x10a049[_0x761d('0x35')][_0x761d('0x3b')]('nolimit')){_0x1d9cb7[_0x761d('0x1f')]=qs[_0x761d('0x1f')](_0x10a049[_0x761d('0x35')][_0x761d('0x1f')]);_0x1d9cb7[_0x761d('0x1d')]=qs[_0x761d('0x1d')](_0x10a049[_0x761d('0x35')][_0x761d('0x1d')]);}_0x1d9cb7[_0x761d('0x3c')]=qs[_0x761d('0x3d')](_0x10a049[_0x761d('0x35')][_0x761d('0x3d')]);_0x1d9cb7['where']=qs['filters'](_[_0x761d('0x3e')](_0x10a049['query'],_0x2c5eaf[_0x761d('0x3f')]),_0x57ce5a);if(_0x10a049['query'][_0x761d('0x40')]){_0x1d9cb7['where']=_[_0x761d('0x41')](_0x1d9cb7[_0x761d('0x42')],{'$or':_[_0x761d('0x30')](_0x57ce5a,function(_0x113701){if(_0x113701['type']!==_0x761d('0x43')){var _0x802106={};_0x802106[_0x113701[_0x761d('0x2d')]]={'$like':'%'+_0x10a049[_0x761d('0x35')][_0x761d('0x40')]+'%'};return _0x802106;}})});}_0x1d9cb7=_[_0x761d('0x41')]({},_0x1d9cb7,_0x10a049[_0x761d('0x44')]);var _0x1d9ed2={'where':_0x1d9cb7[_0x761d('0x42')]};return db[_0x761d('0x31')][_0x761d('0x20')](_0x1d9ed2)[_0x761d('0x26')](function(_0x19a346){_0x28c7aa[_0x761d('0x20')]=_0x19a346;if(_0x10a049[_0x761d('0x35')][_0x761d('0x45')]){_0x1d9cb7[_0x761d('0x46')]=[{'all':!![]}];}return db[_0x761d('0x31')][_0x761d('0x47')](_0x1d9cb7);})[_0x761d('0x26')](function(_0x161773){_0x28c7aa[_0x761d('0x48')]=_0x161773;return _0x28c7aa;})[_0x761d('0x26')](respondWithFilteredResult(_0x4b33aa,_0x1d9cb7))[_0x761d('0x49')](handleError(_0x4b33aa,null));};exports[_0x761d('0x4a')]=function(_0x17e226,_0x59bdb0){var _0x3f6468={'raw':!![],'where':{'id':_0x17e226[_0x761d('0x4b')]['id']}},_0x43198e={};_0x43198e['model']=_[_0x761d('0x36')](db[_0x761d('0x31')][_0x761d('0x32')]);_0x43198e['query']=_[_0x761d('0x36')](_0x17e226[_0x761d('0x35')]);_0x43198e['filters']=_[_0x761d('0x37')](_0x43198e[_0x761d('0x38')],_0x43198e[_0x761d('0x35')]);_0x3f6468[_0x761d('0x3a')]=_[_0x761d('0x37')](_0x43198e[_0x761d('0x38')],qs[_0x761d('0x39')](_0x17e226[_0x761d('0x35')][_0x761d('0x39')]));_0x3f6468[_0x761d('0x3a')]=_0x3f6468[_0x761d('0x3a')][_0x761d('0x4c')]?_0x3f6468[_0x761d('0x3a')]:_0x43198e[_0x761d('0x38')];if(_0x17e226['query'][_0x761d('0x45')]){_0x3f6468['include']=[{'all':!![]}];}_0x3f6468=_[_0x761d('0x41')]({},_0x3f6468,_0x17e226[_0x761d('0x44')]);return db[_0x761d('0x31')]['find'](_0x3f6468)[_0x761d('0x26')](handleEntityNotFound(_0x59bdb0,null))[_0x761d('0x26')](respondWithResult(_0x59bdb0,null))[_0x761d('0x49')](handleError(_0x59bdb0,null));};exports[_0x761d('0x4d')]=function(_0x597c42,_0x15fe72){return db['Disposition'][_0x761d('0x4d')](_0x597c42[_0x761d('0x4e')],{})[_0x761d('0x26')](function(_0x1c664f){var _0x58d75b=_0x597c42[_0x761d('0x4f')]['get']({'plain':!![]});if(!_0x58d75b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x58d75b[_0x761d('0x50')]==='user'){var _0x29b2d2=_0x1c664f['get']({'plain':!![]});var _0x2c6804='Dispositions';return db[_0x761d('0x51')][_0x761d('0x52')]({'where':{'name':_0x2c6804,'userProfileId':_0x58d75b[_0x761d('0x53')]},'raw':!![]})[_0x761d('0x26')](function(_0x44aa07){if(_0x44aa07&&_0x44aa07['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x29b2d2[_0x761d('0x2d')],'resourceId':_0x29b2d2['id'],'type':_0x44aa07[_0x761d('0x2d')],'sectionId':_0x44aa07['id']},{})[_0x761d('0x26')](function(){return _0x1c664f;});}else{return _0x1c664f;}})[_0x761d('0x49')](function(_0x5ec463){logger['error'](_0x761d('0x54'),_0x5ec463);throw _0x5ec463;});}return _0x1c664f;})[_0x761d('0x26')](respondWithResult(_0x15fe72,0xc9))['catch'](handleError(_0x15fe72,null));};exports[_0x761d('0x25')]=function(_0x3a1aed,_0x32321b){if(_0x3a1aed[_0x761d('0x4e')]['id']){delete _0x3a1aed['body']['id'];}return db[_0x761d('0x31')]['find']({'where':{'id':_0x3a1aed[_0x761d('0x4b')]['id']}})[_0x761d('0x26')](handleEntityNotFound(_0x32321b,null))[_0x761d('0x26')](saveUpdates(_0x3a1aed[_0x761d('0x4e')],null))[_0x761d('0x26')](respondWithResult(_0x32321b,null))['catch'](handleError(_0x32321b,null));};exports[_0x761d('0x27')]=function(_0x2321f4,_0x306506){return db[_0x761d('0x31')]['find']({'where':{'id':_0x2321f4[_0x761d('0x4b')]['id']}})['then'](handleEntityNotFound(_0x306506,null))[_0x761d('0x26')](removeEntity(_0x306506,null))['catch'](handleError(_0x306506,null));}; \ No newline at end of file +var _0xcdd3=['apply','reject','then','get','Dispositions','UserProfileResource','destroy','error','stack','name','index','map','Disposition','rawAttributes','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','findAll','rows','catch','show','params','length','find','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range'];(function(_0x1b791e,_0x613cfa){var _0x34bfc2=function(_0x3bf8a4){while(--_0x3bf8a4){_0x1b791e['push'](_0x1b791e['shift']());}};_0x34bfc2(++_0x613cfa);}(_0xcdd3,0x115));var _0x3cdd=function(_0x1b0fe4,_0x468d55){_0x1b0fe4=_0x1b0fe4-0x0;var _0x1edffe=_0xcdd3[_0x1b0fe4];return _0x1edffe;};'use strict';var emlformat=require(_0x3cdd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3cdd('0x1'));var jsonpatch=require(_0x3cdd('0x2'));var rp=require(_0x3cdd('0x3'));var moment=require(_0x3cdd('0x4'));var BPromise=require(_0x3cdd('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3cdd('0x6'));var sox=require(_0x3cdd('0x7'));var csv=require(_0x3cdd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3cdd('0x9'));var _=require(_0x3cdd('0xa'));var squel=require(_0x3cdd('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3cdd('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3cdd('0xd'));var Redis=require(_0x3cdd('0xe'));var authService=require(_0x3cdd('0xf'));var qs=require(_0x3cdd('0x10'));var as=require(_0x3cdd('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3cdd('0x12'))('api');var utils=require(_0x3cdd('0x13'));var config=require(_0x3cdd('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x3cdd('0x15'))['db'];function respondWithStatusCode(_0x770407,_0x32ccf4){_0x32ccf4=_0x32ccf4||0xcc;return function(_0x1e0395){if(_0x1e0395){return _0x770407[_0x3cdd('0x16')](_0x32ccf4);}return _0x770407[_0x3cdd('0x17')](_0x32ccf4)['end']();};}function respondWithResult(_0x8df5f9,_0x57c1b9){_0x57c1b9=_0x57c1b9||0xc8;return function(_0x18f320){if(_0x18f320){return _0x8df5f9['status'](_0x57c1b9)[_0x3cdd('0x18')](_0x18f320);}};}function respondWithFilteredResult(_0x6ce0d,_0x4f90e4){return function(_0xe2141f){if(_0xe2141f){var _0x4bd2ba=typeof _0x4f90e4[_0x3cdd('0x19')]==='undefined'&&typeof _0x4f90e4[_0x3cdd('0x1a')]===_0x3cdd('0x1b');var _0x2d2976=_0xe2141f[_0x3cdd('0x1c')];var _0x57d1e3=_0x4bd2ba?0x0:_0x4f90e4[_0x3cdd('0x19')];var _0x27be27=_0x4bd2ba?_0xe2141f[_0x3cdd('0x1c')]:_0x4f90e4[_0x3cdd('0x19')]+_0x4f90e4[_0x3cdd('0x1a')];var _0x2f6d1f;if(_0x27be27>=_0x2d2976){_0x27be27=_0x2d2976;_0x2f6d1f=0xc8;}else{_0x2f6d1f=0xce;}_0x6ce0d[_0x3cdd('0x17')](_0x2f6d1f);return _0x6ce0d[_0x3cdd('0x1d')](_0x3cdd('0x1e'),_0x57d1e3+'-'+_0x27be27+'/'+_0x2d2976)['json'](_0xe2141f);}return null;};}function patchUpdates(_0x2c3244){return function(_0x44905e){try{jsonpatch[_0x3cdd('0x1f')](_0x44905e,_0x2c3244,!![]);}catch(_0x264aee){return BPromise[_0x3cdd('0x20')](_0x264aee);}return _0x44905e['save']();};}function saveUpdates(_0x367579,_0x26fb9c){return function(_0x1f8cdb){if(_0x1f8cdb){return _0x1f8cdb['update'](_0x367579)[_0x3cdd('0x21')](function(_0xbbf73e){return _0xbbf73e;});}return null;};}function removeEntity(_0x522682,_0x5e45ca){return function(_0x3d2b2f){if(_0x3d2b2f){return _0x3d2b2f['destroy']()[_0x3cdd('0x21')](function(){var _0x254a3b=_0x3d2b2f[_0x3cdd('0x22')]({'plain':!![]});var _0xc3734f=_0x3cdd('0x23');return db[_0x3cdd('0x24')][_0x3cdd('0x25')]({'where':{'type':_0xc3734f,'resourceId':_0x254a3b['id']}})[_0x3cdd('0x21')](function(){return _0x3d2b2f;});})['then'](function(){_0x522682['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x18fa0d,_0x4707a7){return function(_0x38fe2d){if(!_0x38fe2d){_0x18fa0d[_0x3cdd('0x16')](0x194);}return _0x38fe2d;};}function handleError(_0x32e66e,_0x8c52a2){_0x8c52a2=_0x8c52a2||0x1f4;return function(_0x2e9daf){logger[_0x3cdd('0x26')](_0x2e9daf[_0x3cdd('0x27')]);if(_0x2e9daf[_0x3cdd('0x28')]){delete _0x2e9daf[_0x3cdd('0x28')];}_0x32e66e[_0x3cdd('0x17')](_0x8c52a2)['send'](_0x2e9daf);};}exports[_0x3cdd('0x29')]=function(_0x5b9015,_0x4c9d1e){var _0x5e91c2={},_0x3c012a={},_0x279b01={'count':0x0,'rows':[]};var _0x2fe439=_[_0x3cdd('0x2a')](db[_0x3cdd('0x2b')][_0x3cdd('0x2c')],function(_0x31bb37){return{'name':_0x31bb37['fieldName'],'type':_0x31bb37['type'][_0x3cdd('0x2d')]};});_0x3c012a[_0x3cdd('0x2e')]=_[_0x3cdd('0x2a')](_0x2fe439,_0x3cdd('0x28'));_0x3c012a['query']=_[_0x3cdd('0x2f')](_0x5b9015[_0x3cdd('0x30')]);_0x3c012a[_0x3cdd('0x31')]=_[_0x3cdd('0x32')](_0x3c012a[_0x3cdd('0x2e')],_0x3c012a[_0x3cdd('0x30')]);_0x5e91c2['attributes']=_[_0x3cdd('0x32')](_0x3c012a['model'],qs['fields'](_0x5b9015[_0x3cdd('0x30')][_0x3cdd('0x33')]));_0x5e91c2['attributes']=_0x5e91c2['attributes']['length']?_0x5e91c2[_0x3cdd('0x34')]:_0x3c012a[_0x3cdd('0x2e')];if(!_0x5b9015[_0x3cdd('0x30')][_0x3cdd('0x35')](_0x3cdd('0x36'))){_0x5e91c2['limit']=qs[_0x3cdd('0x1a')](_0x5b9015[_0x3cdd('0x30')][_0x3cdd('0x1a')]);_0x5e91c2[_0x3cdd('0x19')]=qs['offset'](_0x5b9015['query'][_0x3cdd('0x19')]);}_0x5e91c2['order']=qs[_0x3cdd('0x37')](_0x5b9015[_0x3cdd('0x30')][_0x3cdd('0x37')]);_0x5e91c2['where']=qs[_0x3cdd('0x31')](_['pick'](_0x5b9015[_0x3cdd('0x30')],_0x3c012a['filters']),_0x2fe439);if(_0x5b9015[_0x3cdd('0x30')][_0x3cdd('0x38')]){_0x5e91c2['where']=_[_0x3cdd('0x39')](_0x5e91c2[_0x3cdd('0x3a')],{'$or':_[_0x3cdd('0x2a')](_0x2fe439,function(_0x4dc336){if(_0x4dc336['type']!=='VIRTUAL'){var _0x19d84e={};_0x19d84e[_0x4dc336[_0x3cdd('0x28')]]={'$like':'%'+_0x5b9015[_0x3cdd('0x30')][_0x3cdd('0x38')]+'%'};return _0x19d84e;}})});}_0x5e91c2=_[_0x3cdd('0x39')]({},_0x5e91c2,_0x5b9015[_0x3cdd('0x3b')]);var _0x28af2d={'where':_0x5e91c2['where']};return db['Disposition'][_0x3cdd('0x1c')](_0x28af2d)[_0x3cdd('0x21')](function(_0x134a3c){_0x279b01[_0x3cdd('0x1c')]=_0x134a3c;if(_0x5b9015[_0x3cdd('0x30')][_0x3cdd('0x3c')]){_0x5e91c2[_0x3cdd('0x3d')]=[{'all':!![]}];}return db[_0x3cdd('0x2b')][_0x3cdd('0x3e')](_0x5e91c2);})[_0x3cdd('0x21')](function(_0x4af399){_0x279b01[_0x3cdd('0x3f')]=_0x4af399;return _0x279b01;})[_0x3cdd('0x21')](respondWithFilteredResult(_0x4c9d1e,_0x5e91c2))[_0x3cdd('0x40')](handleError(_0x4c9d1e,null));};exports[_0x3cdd('0x41')]=function(_0x1fdd0a,_0x40a12b){var _0x223359={'raw':!![],'where':{'id':_0x1fdd0a[_0x3cdd('0x42')]['id']}},_0xcad7f9={};_0xcad7f9[_0x3cdd('0x2e')]=_[_0x3cdd('0x2f')](db['Disposition'][_0x3cdd('0x2c')]);_0xcad7f9[_0x3cdd('0x30')]=_['keys'](_0x1fdd0a[_0x3cdd('0x30')]);_0xcad7f9[_0x3cdd('0x31')]=_[_0x3cdd('0x32')](_0xcad7f9[_0x3cdd('0x2e')],_0xcad7f9[_0x3cdd('0x30')]);_0x223359['attributes']=_[_0x3cdd('0x32')](_0xcad7f9[_0x3cdd('0x2e')],qs[_0x3cdd('0x33')](_0x1fdd0a['query'][_0x3cdd('0x33')]));_0x223359[_0x3cdd('0x34')]=_0x223359['attributes'][_0x3cdd('0x43')]?_0x223359[_0x3cdd('0x34')]:_0xcad7f9['model'];if(_0x1fdd0a[_0x3cdd('0x30')][_0x3cdd('0x3c')]){_0x223359['include']=[{'all':!![]}];}_0x223359=_['merge']({},_0x223359,_0x1fdd0a[_0x3cdd('0x3b')]);return db[_0x3cdd('0x2b')][_0x3cdd('0x44')](_0x223359)[_0x3cdd('0x21')](handleEntityNotFound(_0x40a12b,null))[_0x3cdd('0x21')](respondWithResult(_0x40a12b,null))[_0x3cdd('0x40')](handleError(_0x40a12b,null));};exports['create']=function(_0x337e71,_0x180bf0){return db[_0x3cdd('0x2b')]['create'](_0x337e71[_0x3cdd('0x45')],{})[_0x3cdd('0x21')](function(_0xb0f14e){var _0x15e19f=_0x337e71[_0x3cdd('0x46')][_0x3cdd('0x22')]({'plain':!![]});if(!_0x15e19f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x15e19f[_0x3cdd('0x47')]===_0x3cdd('0x46')){var _0x4e0aed=_0xb0f14e['get']({'plain':!![]});var _0x1478da=_0x3cdd('0x23');return db[_0x3cdd('0x48')][_0x3cdd('0x44')]({'where':{'name':_0x1478da,'userProfileId':_0x15e19f[_0x3cdd('0x49')]},'raw':!![]})[_0x3cdd('0x21')](function(_0x2df36f){if(_0x2df36f&&_0x2df36f[_0x3cdd('0x4a')]===0x0){return db[_0x3cdd('0x24')]['create']({'name':_0x4e0aed['name'],'resourceId':_0x4e0aed['id'],'type':_0x2df36f[_0x3cdd('0x28')],'sectionId':_0x2df36f['id']},{})[_0x3cdd('0x21')](function(){return _0xb0f14e;});}else{return _0xb0f14e;}})[_0x3cdd('0x40')](function(_0x34c505){logger[_0x3cdd('0x26')](_0x3cdd('0x4b'),_0x34c505);throw _0x34c505;});}return _0xb0f14e;})[_0x3cdd('0x21')](respondWithResult(_0x180bf0,0xc9))['catch'](handleError(_0x180bf0,null));};exports[_0x3cdd('0x4c')]=function(_0x480fad,_0x4b3b83){if(_0x480fad[_0x3cdd('0x45')]['id']){delete _0x480fad[_0x3cdd('0x45')]['id'];}return db[_0x3cdd('0x2b')][_0x3cdd('0x44')]({'where':{'id':_0x480fad[_0x3cdd('0x42')]['id']}})[_0x3cdd('0x21')](handleEntityNotFound(_0x4b3b83,null))[_0x3cdd('0x21')](saveUpdates(_0x480fad[_0x3cdd('0x45')],null))[_0x3cdd('0x21')](respondWithResult(_0x4b3b83,null))[_0x3cdd('0x40')](handleError(_0x4b3b83,null));};exports[_0x3cdd('0x25')]=function(_0x5dc07e,_0x5b82d5){return db[_0x3cdd('0x2b')][_0x3cdd('0x44')]({'where':{'id':_0x5dc07e[_0x3cdd('0x42')]['id']}})[_0x3cdd('0x21')](handleEntityNotFound(_0x5b82d5,null))[_0x3cdd('0x21')](removeEntity(_0x5b82d5,null))[_0x3cdd('0x40')](handleError(_0x5b82d5,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 946736a..d00583e 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 _0x7b94=['name_whatsapp','WhatsappAccountId','util','../../config/logger','api','moment','bluebird','path','rimraf','./disposition.attributes','exports','define','Disposition','tools_dispositions','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','OpenchannelAccountId'];(function(_0x259ed8,_0x5218b8){var _0x2f7b27=function(_0x793071){while(--_0x793071){_0x259ed8['push'](_0x259ed8['shift']());}};_0x2f7b27(++_0x5218b8);}(_0x7b94,0x12e));var _0x47b9=function(_0xa35654,_0x43c6eb){_0xa35654=_0xa35654-0x0;var _0x5814e5=_0x7b94[_0xa35654];return _0x5814e5;};'use strict';var _=require('lodash');var util=require(_0x47b9('0x0'));var logger=require(_0x47b9('0x1'))(_0x47b9('0x2'));var moment=require(_0x47b9('0x3'));var BPromise=require(_0x47b9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47b9('0x5'));var rimraf=require(_0x47b9('0x6'));var config=require('../../config/environment');var attributes=require(_0x47b9('0x7'));module[_0x47b9('0x8')]=function(_0x575805,_0x26b78d){return _0x575805[_0x47b9('0x9')](_0x47b9('0xa'),attributes,{'tableName':_0x47b9('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x47b9('0xc'),_0x47b9('0xd')]},{'unique':!![],'name':_0x47b9('0xe'),'fields':[_0x47b9('0xc'),_0x47b9('0xf')]},{'unique':!![],'name':_0x47b9('0x10'),'fields':[_0x47b9('0xc'),_0x47b9('0x11')]},{'unique':!![],'name':_0x47b9('0x12'),'fields':[_0x47b9('0xc'),_0x47b9('0x13')]},{'unique':!![],'name':_0x47b9('0x14'),'fields':[_0x47b9('0xc'),_0x47b9('0x15')]},{'unique':!![],'name':'name_openchannel','fields':[_0x47b9('0xc'),_0x47b9('0x16')]},{'unique':!![],'name':_0x47b9('0x17'),'fields':[_0x47b9('0xc'),_0x47b9('0x18')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x070f=['name_voice','name','MailAccountId','name_sms','SmsAccountId','name_fax','name_whatsapp','WhatsappAccountId','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','Disposition'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x070f,0x13a));var _0xf070=function(_0x154751,_0xa03a01){_0x154751=_0x154751-0x0;var _0x3e5506=_0x070f[_0x154751];return _0x3e5506;};'use strict';var _=require(_0xf070('0x0'));var util=require('util');var logger=require(_0xf070('0x1'))('api');var moment=require(_0xf070('0x2'));var BPromise=require(_0xf070('0x3'));var rp=require(_0xf070('0x4'));var fs=require('fs');var path=require(_0xf070('0x5'));var rimraf=require(_0xf070('0x6'));var config=require(_0xf070('0x7'));var attributes=require('./disposition.attributes');module[_0xf070('0x8')]=function(_0x545db5,_0x5f10b3){return _0x545db5['define'](_0xf070('0x9'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0xf070('0xa'),'fields':[_0xf070('0xb'),'ListId']},{'unique':!![],'name':'name_chat','fields':[_0xf070('0xb'),'ChatWebsiteId']},{'unique':!![],'name':'name_mail','fields':['name',_0xf070('0xc')]},{'unique':!![],'name':_0xf070('0xd'),'fields':[_0xf070('0xb'),_0xf070('0xe')]},{'unique':!![],'name':_0xf070('0xf'),'fields':[_0xf070('0xb'),'FaxAccountId']},{'unique':!![],'name':'name_openchannel','fields':[_0xf070('0xb'),'OpenchannelAccountId']},{'unique':!![],'name':_0xf070('0x10'),'fields':['name',_0xf070('0x11')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 15fba70..7c325b9 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(_0x36c37d,_0x1df748){var _0x6c04bd=function(_0x2e4415){while(--_0x2e4415){_0x36c37d['push'](_0x36c37d['shift']());}};_0x6c04bd(++_0x1df748);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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(_0x43955b,_0x4245b6){var _0x3e4646=function(_0x38a207){while(--_0x38a207){_0x43955b['push'](_0x43955b['shift']());}};_0x3e4646(++_0x4245b6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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 14d2555..367b13e 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 _0xb419=['/:id','show','post','create','put','update','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./disposition.controller','get','isAuthenticated'];(function(_0x589f71,_0x212326){var _0x5763bd=function(_0x2cb8e1){while(--_0x2cb8e1){_0x589f71['push'](_0x589f71['shift']());}};_0x5763bd(++_0x212326);}(_0xb419,0x6e));var _0x9b41=function(_0xe71f99,_0x2a50d7){_0xe71f99=_0xe71f99-0x0;var _0x6da2f2=_0xb419[_0xe71f99];return _0x6da2f2;};'use strict';var multer=require('multer');var util=require(_0x9b41('0x0'));var path=require(_0x9b41('0x1'));var timeout=require('connect-timeout');var express=require(_0x9b41('0x2'));var router=express[_0x9b41('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9b41('0x4'));var interaction=require(_0x9b41('0x5'));var config=require('../../config/environment');var controller=require(_0x9b41('0x6'));router[_0x9b41('0x7')]('/',auth[_0x9b41('0x8')](),controller['index']);router[_0x9b41('0x7')](_0x9b41('0x9'),auth[_0x9b41('0x8')](),controller[_0x9b41('0xa')]);router[_0x9b41('0xb')]('/',auth['isAuthenticated'](),controller[_0x9b41('0xc')]);router[_0x9b41('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x9b41('0xe')]);router['delete'](_0x9b41('0x9'),auth[_0x9b41('0x8')](),controller[_0x9b41('0xf')]);module[_0x9b41('0x10')]=router; \ No newline at end of file +var _0xb5a6=['exports','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./disposition.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0xb5a6,0xbf));var _0x6b5a=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xb5a6[_0x46698a];return _0x356db0;};'use strict';var multer=require('multer');var util=require(_0x6b5a('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6b5a('0x1'));var router=express[_0x6b5a('0x2')]();var fs_extra=require(_0x6b5a('0x3'));var auth=require(_0x6b5a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6b5a('0x5'));var controller=require(_0x6b5a('0x6'));router['get']('/',auth[_0x6b5a('0x7')](),controller[_0x6b5a('0x8')]);router[_0x6b5a('0x9')](_0x6b5a('0xa'),auth[_0x6b5a('0x7')](),controller[_0x6b5a('0xb')]);router[_0x6b5a('0xc')]('/',auth[_0x6b5a('0x7')](),controller[_0x6b5a('0xd')]);router[_0x6b5a('0xe')](_0x6b5a('0xa'),auth[_0x6b5a('0x7')](),controller[_0x6b5a('0xf')]);router[_0x6b5a('0x10')](_0x6b5a('0xa'),auth[_0x6b5a('0x7')](),controller[_0x6b5a('0x11')]);module[_0x6b5a('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index b3cae92..b82109c 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 _0x663b=['sequelize','exports','STRING','ENUM','yes','localstationid','2400','7200','9600','12000','14400','4800','INTEGER','SIP','IAX','DADHI','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x5cd05a,_0x2ebac7){var _0x2c3d94=function(_0x41f5b2){while(--_0x41f5b2){_0x5cd05a['push'](_0x5cd05a['shift']());}};_0x2c3d94(++_0x2ebac7);}(_0x663b,0x120));var _0xb663=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0x663b[_0x342700];return _0x53406f;};'use strict';var Sequelize=require(_0xb663('0x0'));module[_0xb663('0x1')]={'name':{'type':Sequelize[_0xb663('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb663('0x2')]},'ecm':{'type':Sequelize[_0xb663('0x3')](_0xb663('0x4'),'no'),'defaultValue':_0xb663('0x4')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0xb663('0x2')],'unique':_0xb663('0x5')},'minrate':{'type':Sequelize['ENUM'](_0xb663('0x6'),'4800',_0xb663('0x7'),_0xb663('0x8'),_0xb663('0x9'),_0xb663('0xa')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0xb663('0x3')](_0xb663('0x6'),_0xb663('0xb'),_0xb663('0x7'),_0xb663('0x8'),_0xb663('0x9'),_0xb663('0xa')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0xb663('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0xb663('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xb663('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xb663('0x3')](_0xb663('0xd'),_0xb663('0xe'),_0xb663('0xf'),'KHOMP'),'defaultValue':_0xb663('0xd')},'key':{'type':Sequelize[_0xb663('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xb663('0x10')],'defaultValue':function(){return _0xb663('0x11');}},'notificationSound':{'type':Sequelize[_0xb663('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb663('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb663('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb663('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb663('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xb663('0x13')},'mandatoryDisposition':{'type':Sequelize[_0xb663('0x12')],'defaultValue':![],'comment':_0xb663('0x14'),'set':function(_0x3c9c81){if(!_0x3c9c81)this[_0xb663('0x15')](_0xb663('0x16'),null);this[_0xb663('0x15')](_0xb663('0x17'),_0x3c9c81);}}}; \ No newline at end of file +var _0xa1ab=['xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','12000','14400','v17,v27,v29','SIP','IAX','DADHI','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','ENUM','yes'];(function(_0x5ac84c,_0x287781){var _0x3c53d2=function(_0x40cde0){while(--_0x40cde0){_0x5ac84c['push'](_0x5ac84c['shift']());}};_0x3c53d2(++_0x287781);}(_0xa1ab,0x110));var _0xba1a=function(_0xdfbf26,_0x5ba6ca){_0xdfbf26=_0xdfbf26-0x0;var _0x1bfdb8=_0xa1ab[_0xdfbf26];return _0x1bfdb8;};'use strict';var Sequelize=require(_0xba1a('0x0'));module['exports']={'name':{'type':Sequelize[_0xba1a('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xba1a('0x1')]},'ecm':{'type':Sequelize[_0xba1a('0x2')](_0xba1a('0x3'),'no'),'defaultValue':_0xba1a('0x3')},'headerinfo':{'type':Sequelize[_0xba1a('0x1')],'defaultValue':_0xba1a('0x4')},'localstationid':{'type':Sequelize[_0xba1a('0x1')],'unique':_0xba1a('0x5')},'minrate':{'type':Sequelize[_0xba1a('0x2')](_0xba1a('0x6'),_0xba1a('0x7'),_0xba1a('0x8'),_0xba1a('0x9'),_0xba1a('0xa'),_0xba1a('0xb')),'defaultValue':_0xba1a('0x7')},'maxrate':{'type':Sequelize['ENUM'](_0xba1a('0x6'),_0xba1a('0x7'),_0xba1a('0x8'),'9600',_0xba1a('0xa'),_0xba1a('0xb')),'defaultValue':_0xba1a('0xb')},'modem':{'type':Sequelize[_0xba1a('0x1')],'defaultValue':_0xba1a('0xc')},'gateway':{'type':Sequelize[_0xba1a('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xba1a('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xba1a('0x2')](_0xba1a('0xd'),_0xba1a('0xe'),_0xba1a('0xf'),'KHOMP'),'defaultValue':_0xba1a('0xd')},'key':{'type':Sequelize[_0xba1a('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xba1a('0x10');}},'notificationSound':{'type':Sequelize[_0xba1a('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xba1a('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xba1a('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xba1a('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xba1a('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xba1a('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xba1a('0x12')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xba1a('0x13'),'set':function(_0x16c998){if(!_0x16c998)this[_0xba1a('0x14')](_0xba1a('0x15'),null);this['setDataValue'](_0xba1a('0x16'),_0x16c998);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 94ab9a3..2f73271 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 _0xc433=['Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','stack','finally','getApplications','context','from-voip-provider','exten','system','description','Fax\x20Extension','priority','appdata','push','Answer','CDR(type)=inbound-fax','Set','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','updateAccountApplications','VoiceExtension','tech','key','createdAt','updatedAt','TrunkId','ListId','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','DESC','attachments','join','root','server/files/attachments','isNil','from','format','List','Contacts','defaults','List\x20not\x20found','Send\x20Fax\x20failed','out','Messages','Contact\x20not\x20found','filename','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','squel','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','http','client','request','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','name','send','index','map','FaxAccount','rawAttributes','type','model','keys','query','intersection','attributes','fields','length','nolimit','offset','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','Pause','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','FaxAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','mandatoryDispositionPause','addDisposition','FaxAccountId','getDispositions','Disposition','hasOwnProperty','order','rows','removeDispositions','ids','CannedAnswer','getAnswers','findOne','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','CmContact','Contact','Owner','fullname','Tag'];(function(_0x51f569,_0x1b3701){var _0xf533c0=function(_0xe85a1a){while(--_0xe85a1a){_0x51f569['push'](_0x51f569['shift']());}};_0xf533c0(++_0x1b3701);}(_0xc433,0x1dc));var _0x3c43=function(_0x55e454,_0x453e39){_0x55e454=_0x55e454-0x0;var _0x21b676=_0xc433[_0x55e454];return _0x21b676;};'use strict';var emlformat=require(_0x3c43('0x0'));var rimraf=require(_0x3c43('0x1'));var zipdir=require(_0x3c43('0x2'));var jsonpatch=require(_0x3c43('0x3'));var rp=require(_0x3c43('0x4'));var moment=require(_0x3c43('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3c43('0x6'));var util=require('util');var path=require(_0x3c43('0x7'));var sox=require(_0x3c43('0x8'));var csv=require('to-csv');var ejs=require(_0x3c43('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3c43('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3c43('0xb'));var querystring=require(_0x3c43('0xc'));var Papa=require('papaparse');var Redis=require(_0x3c43('0xd'));var authService=require(_0x3c43('0xe'));var qs=require(_0x3c43('0xf'));var as=require(_0x3c43('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3c43('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x3c43('0x12'));var licenseUtil=require(_0x3c43('0x13'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x3c43('0x14')],{'host':_0x3c43('0x15'),'port':0x18eb});var socket=require(_0x3c43('0x16'))(new Redis(config[_0x3c43('0x14')]));require(_0x3c43('0x17'))[_0x3c43('0x18')](socket);var jayson=require(_0x3c43('0x19'));var client=jayson['client'][_0x3c43('0x1a')]({'port':0x232c});var client9002=jayson[_0x3c43('0x1b')][_0x3c43('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x10d17b,_0x444fcd,_0x1568d6,_0x286e92){return new BPromise(function(_0x49469a,_0x54fd2a){var _0x413660=_0x286e92||client;return _0x413660[_0x3c43('0x1c')](_0x10d17b,_0x1568d6)['then'](function(_0x14a4a1){logger['info'](_0x3c43('0x1d'),_0x444fcd,_0x3c43('0x1e'));logger[_0x3c43('0x1f')](_0x3c43('0x20'),_0x444fcd,'request\x20sent',JSON['stringify'](_0x14a4a1));if(_0x14a4a1['error']){if(_0x14a4a1[_0x3c43('0x21')][_0x3c43('0x22')]===0x1f4){logger[_0x3c43('0x21')](_0x3c43('0x1d'),_0x444fcd,_0x14a4a1[_0x3c43('0x21')]['message']);return _0x54fd2a(_0x14a4a1[_0x3c43('0x21')][_0x3c43('0x23')]);}logger[_0x3c43('0x21')](_0x3c43('0x1d'),_0x444fcd,_0x14a4a1[_0x3c43('0x21')][_0x3c43('0x23')]);return _0x49469a(_0x14a4a1[_0x3c43('0x21')][_0x3c43('0x23')]);}else{logger[_0x3c43('0x24')](_0x3c43('0x1d'),_0x444fcd,_0x3c43('0x1e'));_0x49469a(_0x14a4a1['result'][_0x3c43('0x23')]);}})['catch'](function(_0x3e45eb){logger[_0x3c43('0x21')](_0x3c43('0x1d'),_0x444fcd,_0x3e45eb);_0x54fd2a(_0x3e45eb);});});}function respondWithStatusCode(_0x2a35e5,_0x3c57d0){_0x3c57d0=_0x3c57d0||0xcc;return function(_0x4359c7){if(_0x4359c7){return _0x2a35e5[_0x3c43('0x25')](_0x3c57d0);}return _0x2a35e5[_0x3c43('0x26')](_0x3c57d0)[_0x3c43('0x27')]();};}function respondWithResult(_0x4de215,_0x415095){_0x415095=_0x415095||0xc8;return function(_0x4500d2){if(_0x4500d2){return _0x4de215[_0x3c43('0x26')](_0x415095)[_0x3c43('0x28')](_0x4500d2);}};}function respondWithFilteredResult(_0x421178,_0x56e754){return function(_0x25a0b5){if(_0x25a0b5){var _0x6e0d19=typeof _0x56e754['offset']===_0x3c43('0x29')&&typeof _0x56e754[_0x3c43('0x2a')]===_0x3c43('0x29');var _0x3ebb21=_0x25a0b5[_0x3c43('0x2b')];var _0x116c06=_0x6e0d19?0x0:_0x56e754['offset'];var _0x391eb0=_0x6e0d19?_0x25a0b5['count']:_0x56e754['offset']+_0x56e754['limit'];var _0x5004bc;if(_0x391eb0>=_0x3ebb21){_0x391eb0=_0x3ebb21;_0x5004bc=0xc8;}else{_0x5004bc=0xce;}_0x421178['status'](_0x5004bc);return _0x421178[_0x3c43('0x2c')](_0x3c43('0x2d'),_0x116c06+'-'+_0x391eb0+'/'+_0x3ebb21)[_0x3c43('0x28')](_0x25a0b5);}return null;};}function patchUpdates(_0x23543f){return function(_0x4a16f9){try{jsonpatch[_0x3c43('0x2e')](_0x4a16f9,_0x23543f,!![]);}catch(_0x357813){return BPromise[_0x3c43('0x2f')](_0x357813);}return _0x4a16f9[_0x3c43('0x30')]();};}function saveUpdates(_0x49bbb,_0x41089e){return function(_0x975b27){if(_0x975b27){return _0x975b27[_0x3c43('0x31')](_0x49bbb)[_0x3c43('0x32')](function(_0x49c244){return _0x49c244;});}return null;};}function removeEntity(_0x538bd7,_0x5ca080){return function(_0x5243f9){if(_0x5243f9){return _0x5243f9['destroy']()[_0x3c43('0x32')](function(){var _0x4140a5=_0x5243f9[_0x3c43('0x33')]({'plain':!![]});var _0x382229='FaxAccounts';return db[_0x3c43('0x34')][_0x3c43('0x35')]({'where':{'type':_0x382229,'resourceId':_0x4140a5['id']}})[_0x3c43('0x32')](function(){return _0x5243f9;});})[_0x3c43('0x32')](function(){_0x538bd7[_0x3c43('0x26')](0xcc)[_0x3c43('0x27')]();});}};}function handleEntityNotFound(_0x4658c8,_0x277f1b){return function(_0x2ca104){if(!_0x2ca104){_0x4658c8['sendStatus'](0x194);}return _0x2ca104;};}function handleError(_0x4fa0a7,_0x3e309c){_0x3e309c=_0x3e309c||0x1f4;return function(_0x475fa6){logger[_0x3c43('0x21')](_0x475fa6['stack']);if(_0x475fa6[_0x3c43('0x36')]){delete _0x475fa6[_0x3c43('0x36')];}_0x4fa0a7[_0x3c43('0x26')](_0x3e309c)[_0x3c43('0x37')](_0x475fa6);};}exports[_0x3c43('0x38')]=function(_0x377f5d,_0x8a2020){var _0x203824={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x317da2={},_0x367dbd={'count':0x0,'rows':[]};var _0x293ed1=_[_0x3c43('0x39')](db[_0x3c43('0x3a')][_0x3c43('0x3b')],function(_0x12edeb){return{'name':_0x12edeb['fieldName'],'type':_0x12edeb[_0x3c43('0x3c')]['key']};});_0x317da2[_0x3c43('0x3d')]=_[_0x3c43('0x39')](_0x293ed1,_0x3c43('0x36'));_0x317da2['query']=_[_0x3c43('0x3e')](_0x377f5d[_0x3c43('0x3f')]);_0x317da2['filters']=_[_0x3c43('0x40')](_0x317da2[_0x3c43('0x3d')],_0x317da2[_0x3c43('0x3f')]);_0x203824[_0x3c43('0x41')]=_[_0x3c43('0x40')](_0x317da2['model'],qs['fields'](_0x377f5d[_0x3c43('0x3f')][_0x3c43('0x42')]));_0x203824['attributes']=_0x203824[_0x3c43('0x41')][_0x3c43('0x43')]?_0x203824[_0x3c43('0x41')]:_0x317da2['model'];if(!_0x377f5d['query']['hasOwnProperty'](_0x3c43('0x44'))){_0x203824[_0x3c43('0x2a')]=qs['limit'](_0x377f5d['query'][_0x3c43('0x2a')]);_0x203824['offset']=qs[_0x3c43('0x45')](_0x377f5d[_0x3c43('0x3f')][_0x3c43('0x45')]);}_0x203824['order']=qs[_0x3c43('0x46')](_0x377f5d[_0x3c43('0x3f')]['sort']);_0x203824[_0x3c43('0x47')]=qs[_0x3c43('0x48')](_[_0x3c43('0x49')](_0x377f5d[_0x3c43('0x3f')],_0x317da2[_0x3c43('0x48')]),_0x293ed1);if(_0x377f5d[_0x3c43('0x3f')][_0x3c43('0x4a')]){_0x203824[_0x3c43('0x47')]=_[_0x3c43('0x4b')](_0x203824[_0x3c43('0x47')],{'$or':_[_0x3c43('0x39')](_0x293ed1,function(_0x39d142){if(_0x39d142['type']!==_0x3c43('0x4c')){var _0x582d48={};_0x582d48[_0x39d142[_0x3c43('0x36')]]={'$like':'%'+_0x377f5d[_0x3c43('0x3f')][_0x3c43('0x4a')]+'%'};return _0x582d48;}})});}_0x203824=_[_0x3c43('0x4b')]({},_0x203824,_0x377f5d[_0x3c43('0x4d')]);var _0x47d954={'where':_0x203824[_0x3c43('0x47')]};return db[_0x3c43('0x3a')][_0x3c43('0x2b')](_0x47d954)[_0x3c43('0x32')](function(_0x1243d0){_0x367dbd[_0x3c43('0x2b')]=_0x1243d0;if(_0x377f5d[_0x3c43('0x3f')][_0x3c43('0x4e')]){_0x203824[_0x3c43('0x4f')]=[{'all':!![]}];}return db[_0x3c43('0x3a')][_0x3c43('0x50')](_0x203824);})[_0x3c43('0x32')](function(_0x59c363){_0x367dbd['rows']=_0x59c363;return _0x367dbd;})['then'](respondWithFilteredResult(_0x8a2020,_0x203824))[_0x3c43('0x51')](handleError(_0x8a2020,null));};exports[_0x3c43('0x52')]=function(_0x15bdea,_0x1a6ddf){var _0x3c254f={'raw':![],'where':{'id':_0x15bdea[_0x3c43('0x53')]['id']},'include':[{'model':db[_0x3c43('0x54')],'as':'mandatoryDispositionPause'}]},_0x4eb069={};_0x4eb069['model']=_[_0x3c43('0x3e')](db['FaxAccount'][_0x3c43('0x3b')]);_0x4eb069[_0x3c43('0x3f')]=_[_0x3c43('0x3e')](_0x15bdea['query']);_0x4eb069[_0x3c43('0x48')]=_['intersection'](_0x4eb069['model'],_0x4eb069['query']);_0x3c254f[_0x3c43('0x41')]=_['intersection'](_0x4eb069[_0x3c43('0x3d')],qs[_0x3c43('0x42')](_0x15bdea['query'][_0x3c43('0x42')]));_0x3c254f[_0x3c43('0x41')]=_0x3c254f[_0x3c43('0x41')]['length']?_0x3c254f[_0x3c43('0x41')]:_0x4eb069[_0x3c43('0x3d')];if(_0x15bdea[_0x3c43('0x3f')][_0x3c43('0x4e')]){_0x3c254f[_0x3c43('0x4f')]=[{'all':!![]}];}_0x3c254f=_['merge']({},_0x3c254f,_0x15bdea[_0x3c43('0x4d')]);return db['FaxAccount'][_0x3c43('0x55')](_0x3c254f)[_0x3c43('0x32')](handleEntityNotFound(_0x1a6ddf,null))['then'](respondWithResult(_0x1a6ddf,null))[_0x3c43('0x51')](handleError(_0x1a6ddf,null));};exports['create']=function(_0x1e9920,_0x3a6230){return db[_0x3c43('0x3a')][_0x3c43('0x56')](_0x1e9920[_0x3c43('0x57')],{})[_0x3c43('0x32')](function(_0x35c245){var _0x41bc0c=_0x1e9920[_0x3c43('0x58')][_0x3c43('0x33')]({'plain':!![]});if(!_0x41bc0c)throw new Error(_0x3c43('0x59'));if(_0x41bc0c['role']===_0x3c43('0x58')){var _0x19382b=_0x35c245[_0x3c43('0x33')]({'plain':!![]});var _0x38769c=_0x3c43('0x5a');return db[_0x3c43('0x5b')][_0x3c43('0x55')]({'where':{'name':_0x38769c,'userProfileId':_0x41bc0c[_0x3c43('0x5c')]},'raw':!![]})['then'](function(_0x5f470e){if(_0x5f470e&&_0x5f470e[_0x3c43('0x5d')]===0x0){return db[_0x3c43('0x34')][_0x3c43('0x56')]({'name':_0x19382b[_0x3c43('0x36')],'resourceId':_0x19382b['id'],'type':_0x5f470e['name'],'sectionId':_0x5f470e['id']},{})[_0x3c43('0x32')](function(){return _0x35c245;});}else{return _0x35c245;}})['catch'](function(_0xb8b502){logger[_0x3c43('0x21')](_0x3c43('0x5e'),_0xb8b502);throw _0xb8b502;});}return _0x35c245;})[_0x3c43('0x32')](respondWithResult(_0x3a6230,0xc9))[_0x3c43('0x51')](handleError(_0x3a6230,null));};exports['update']=function(_0x56965a,_0x175b9b){if(_0x56965a['body']['id']){delete _0x56965a['body']['id'];}return db[_0x3c43('0x3a')][_0x3c43('0x55')]({'where':{'id':_0x56965a[_0x3c43('0x53')]['id']},'include':[{'model':db[_0x3c43('0x54')],'as':_0x3c43('0x5f')}]})['then'](handleEntityNotFound(_0x175b9b,null))[_0x3c43('0x32')](saveUpdates(_0x56965a[_0x3c43('0x57')],null))[_0x3c43('0x32')](respondWithResult(_0x175b9b,null))[_0x3c43('0x51')](handleError(_0x175b9b,null));};exports[_0x3c43('0x35')]=function(_0x109d13,_0x4ec84d){return db[_0x3c43('0x3a')]['find']({'where':{'id':_0x109d13[_0x3c43('0x53')]['id']}})[_0x3c43('0x32')](handleEntityNotFound(_0x4ec84d,null))['then'](removeEntity(_0x4ec84d,null))['catch'](handleError(_0x4ec84d,null));};exports['describe']=function(_0x30471e,_0x8c7675){return db[_0x3c43('0x3a')]['describe']()['then'](respondWithResult(_0x8c7675,null))['catch'](handleError(_0x8c7675,null));};exports[_0x3c43('0x60')]=function(_0x203fca,_0x229bef,_0x53e20e){if(_0x203fca[_0x3c43('0x57')]['id']){delete _0x203fca[_0x3c43('0x57')]['id'];}return db[_0x3c43('0x3a')]['find']({'where':{'id':_0x203fca[_0x3c43('0x53')]['id']}})[_0x3c43('0x32')](handleEntityNotFound(_0x229bef,null))[_0x3c43('0x32')](function(_0x3fc9c4){if(_0x3fc9c4){_0x203fca['body'][_0x3c43('0x61')]=_0x3fc9c4['id'];return db['Disposition']['create'](_0x203fca[_0x3c43('0x57')]);}})[_0x3c43('0x32')](respondWithResult(_0x229bef,null))[_0x3c43('0x51')](handleError(_0x229bef,null));};exports[_0x3c43('0x62')]=function(_0x5f5d69,_0x285ac6,_0x1bae1e){var _0x281c2f={'raw':![],'where':{}};var _0x1a6e72={};var _0x34233a={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x5f5d69['params']['id']}})[_0x3c43('0x32')](handleEntityNotFound(_0x285ac6,null))[_0x3c43('0x32')](function(_0x2fc383){if(_0x2fc383){_0x1a6e72[_0x3c43('0x3d')]=_[_0x3c43('0x3e')](db[_0x3c43('0x63')]['rawAttributes']);_0x1a6e72[_0x3c43('0x3f')]=_[_0x3c43('0x3e')](_0x5f5d69[_0x3c43('0x3f')]);_0x1a6e72['filters']=_['intersection'](_0x1a6e72['model'],_0x1a6e72[_0x3c43('0x3f')]);_0x281c2f[_0x3c43('0x41')]=_['intersection'](_0x1a6e72[_0x3c43('0x3d')],qs['fields'](_0x5f5d69[_0x3c43('0x3f')][_0x3c43('0x42')]));_0x281c2f[_0x3c43('0x41')]=_0x281c2f[_0x3c43('0x41')][_0x3c43('0x43')]?_0x281c2f[_0x3c43('0x41')]:_0x1a6e72['model'];if(!_0x5f5d69['query'][_0x3c43('0x64')](_0x3c43('0x44'))){_0x281c2f[_0x3c43('0x2a')]=qs['limit'](_0x5f5d69[_0x3c43('0x3f')][_0x3c43('0x2a')]);_0x281c2f[_0x3c43('0x45')]=qs['offset'](_0x5f5d69[_0x3c43('0x3f')][_0x3c43('0x45')]);}_0x281c2f[_0x3c43('0x65')]=qs[_0x3c43('0x46')](_0x5f5d69[_0x3c43('0x3f')][_0x3c43('0x46')]);_0x281c2f[_0x3c43('0x47')]=qs[_0x3c43('0x48')](_[_0x3c43('0x49')](_0x5f5d69[_0x3c43('0x3f')],_0x1a6e72[_0x3c43('0x48')]));_0x281c2f[_0x3c43('0x47')][_0x3c43('0x61')]=_0x2fc383['id'];if(_0x5f5d69[_0x3c43('0x3f')][_0x3c43('0x4a')]){_0x281c2f[_0x3c43('0x47')]=_[_0x3c43('0x4b')](_0x281c2f[_0x3c43('0x47')],{'$or':_['map'](_0x281c2f[_0x3c43('0x41')],function(_0x2a216a){var _0x2d3c99={};_0x2d3c99[_0x2a216a]={'$like':'%'+_0x5f5d69['query'][_0x3c43('0x4a')]+'%'};return _0x2d3c99;})});}_0x281c2f=_[_0x3c43('0x4b')]({},_0x281c2f,_0x5f5d69[_0x3c43('0x4d')]);return db[_0x3c43('0x63')][_0x3c43('0x2b')]({'where':_0x281c2f[_0x3c43('0x47')]})[_0x3c43('0x32')](function(_0x54f5ac){_0x34233a[_0x3c43('0x2b')]=_0x54f5ac;if(_0x5f5d69[_0x3c43('0x3f')][_0x3c43('0x4e')]){_0x281c2f[_0x3c43('0x4f')]=[{'all':!![]}];}return db[_0x3c43('0x63')]['findAll'](_0x281c2f);})[_0x3c43('0x32')](function(_0x1bac4e){_0x34233a[_0x3c43('0x66')]=_0x1bac4e;return _0x34233a;});}})[_0x3c43('0x32')](respondWithFilteredResult(_0x285ac6,_0x281c2f))[_0x3c43('0x51')](handleError(_0x285ac6,null));};exports[_0x3c43('0x67')]=function(_0x15307e,_0x3983c1,_0x4ad820){return db[_0x3c43('0x3a')][_0x3c43('0x55')]({'where':{'id':_0x15307e['params']['id']}})[_0x3c43('0x32')](handleEntityNotFound(_0x3983c1,null))[_0x3c43('0x32')](function(_0xb59b3c){if(_0xb59b3c){return _0xb59b3c[_0x3c43('0x67')](_0x15307e[_0x3c43('0x3f')][_0x3c43('0x68')]);}})[_0x3c43('0x32')](respondWithStatusCode(_0x3983c1,null))[_0x3c43('0x51')](handleError(_0x3983c1,null));};exports['addAnswer']=function(_0x161c2d,_0x1ae492,_0x490568){if(_0x161c2d[_0x3c43('0x57')]['id']){delete _0x161c2d[_0x3c43('0x57')]['id'];}return db[_0x3c43('0x3a')][_0x3c43('0x55')]({'where':{'id':_0x161c2d[_0x3c43('0x53')]['id']}})['then'](handleEntityNotFound(_0x1ae492,null))[_0x3c43('0x32')](function(_0x18b1b0){if(_0x18b1b0){_0x161c2d[_0x3c43('0x57')][_0x3c43('0x61')]=_0x18b1b0['id'];return db[_0x3c43('0x69')][_0x3c43('0x56')](_0x161c2d[_0x3c43('0x57')]);}})['then'](respondWithResult(_0x1ae492,null))[_0x3c43('0x51')](handleError(_0x1ae492,null));};exports[_0x3c43('0x6a')]=function(_0x3fb281,_0x278cb6,_0x2e4174){var _0x3dceb9={'raw':![],'where':{}};var _0x140917={};var _0x344c39={'count':0x0,'rows':[]};return db[_0x3c43('0x3a')][_0x3c43('0x6b')]({'where':{'id':_0x3fb281[_0x3c43('0x53')]['id']}})['then'](handleEntityNotFound(_0x278cb6,null))[_0x3c43('0x32')](function(_0x15b122){if(_0x15b122){_0x140917[_0x3c43('0x3d')]=_[_0x3c43('0x3e')](db[_0x3c43('0x69')][_0x3c43('0x3b')]);_0x140917[_0x3c43('0x3f')]=_[_0x3c43('0x3e')](_0x3fb281[_0x3c43('0x3f')]);_0x140917[_0x3c43('0x48')]=_[_0x3c43('0x40')](_0x140917[_0x3c43('0x3d')],_0x140917[_0x3c43('0x3f')]);_0x3dceb9[_0x3c43('0x41')]=_[_0x3c43('0x40')](_0x140917[_0x3c43('0x3d')],qs[_0x3c43('0x42')](_0x3fb281['query'][_0x3c43('0x42')]));_0x3dceb9[_0x3c43('0x41')]=_0x3dceb9['attributes']['length']?_0x3dceb9[_0x3c43('0x41')]:_0x140917[_0x3c43('0x3d')];if(!_0x3fb281[_0x3c43('0x3f')][_0x3c43('0x64')](_0x3c43('0x44'))){_0x3dceb9[_0x3c43('0x2a')]=qs[_0x3c43('0x2a')](_0x3fb281[_0x3c43('0x3f')]['limit']);_0x3dceb9[_0x3c43('0x45')]=qs[_0x3c43('0x45')](_0x3fb281[_0x3c43('0x3f')][_0x3c43('0x45')]);}_0x3dceb9['order']=qs[_0x3c43('0x46')](_0x3fb281[_0x3c43('0x3f')][_0x3c43('0x46')]);_0x3dceb9[_0x3c43('0x47')]=qs[_0x3c43('0x48')](_[_0x3c43('0x49')](_0x3fb281[_0x3c43('0x3f')],_0x140917['filters']));_0x3dceb9[_0x3c43('0x47')]['FaxAccountId']=_0x15b122['id'];if(_0x3fb281['query'][_0x3c43('0x4a')]){_0x3dceb9[_0x3c43('0x47')]=_[_0x3c43('0x4b')](_0x3dceb9['where'],{'$or':_[_0x3c43('0x39')](_0x3dceb9['attributes'],function(_0x33602e){var _0x11180e={};_0x11180e[_0x33602e]={'$like':'%'+_0x3fb281[_0x3c43('0x3f')][_0x3c43('0x4a')]+'%'};return _0x11180e;})});}_0x3dceb9=_['merge']({},_0x3dceb9,_0x3fb281[_0x3c43('0x4d')]);return db[_0x3c43('0x69')]['count']({'where':_0x3dceb9[_0x3c43('0x47')]})[_0x3c43('0x32')](function(_0x371016){_0x344c39[_0x3c43('0x2b')]=_0x371016;if(_0x3fb281[_0x3c43('0x3f')][_0x3c43('0x4e')]){_0x3dceb9[_0x3c43('0x4f')]=[{'all':!![]}];}return db['CannedAnswer'][_0x3c43('0x50')](_0x3dceb9);})[_0x3c43('0x32')](function(_0x2fc592){_0x344c39['rows']=_0x2fc592;return _0x344c39;});}})['then'](respondWithFilteredResult(_0x278cb6,_0x3dceb9))[_0x3c43('0x51')](handleError(_0x278cb6,null));};exports[_0x3c43('0x6c')]=function(_0xf35622,_0x37a2e5,_0x418124){return db[_0x3c43('0x3a')][_0x3c43('0x55')]({'where':{'id':_0xf35622[_0x3c43('0x53')]['id']}})[_0x3c43('0x32')](handleEntityNotFound(_0x37a2e5,null))[_0x3c43('0x32')](function(_0x69db14){if(_0x69db14){return _0x69db14[_0x3c43('0x6c')](_0xf35622['query'][_0x3c43('0x68')]);}})[_0x3c43('0x32')](respondWithStatusCode(_0x37a2e5,null))['catch'](handleError(_0x37a2e5,null));};exports[_0x3c43('0x6d')]=function(_0x51561e,_0x1f9418,_0x177721){return db['FaxInteraction']['find']({'where':{'id':_0x51561e[_0x3c43('0x53')]['id']}})['then'](handleEntityNotFound(_0x1f9418,null))[_0x3c43('0x32')](function(_0x3c05cc){if(_0x3c05cc){return _0x3c05cc[_0x3c43('0x6d')](_0x51561e[_0x3c43('0x57')][_0x3c43('0x68')],_[_0x3c43('0x6e')](_0x51561e['body'],[_0x3c43('0x68'),'id'])||{});}})[_0x3c43('0x32')](respondWithResult(_0x1f9418,null))[_0x3c43('0x51')](handleError(_0x1f9418,null));};exports[_0x3c43('0x6f')]=function(_0x3bbbc9,_0x2f0097,_0x20d7f5){var _0x542a20={'raw':![],'where':{}};var _0x101cfb={};var _0x40f15e={'count':0x0,'rows':[]};return db[_0x3c43('0x3a')][_0x3c43('0x6b')]({'where':{'id':_0x3bbbc9[_0x3c43('0x53')]['id']}})['then'](handleEntityNotFound(_0x2f0097,null))[_0x3c43('0x32')](function(_0x191071){if(_0x191071){_0x101cfb[_0x3c43('0x3d')]=_[_0x3c43('0x3e')](db[_0x3c43('0x70')][_0x3c43('0x3b')]);_0x101cfb[_0x3c43('0x3f')]=_[_0x3c43('0x3e')](_0x3bbbc9[_0x3c43('0x3f')]);_0x101cfb[_0x3c43('0x48')]=_[_0x3c43('0x40')](_0x101cfb[_0x3c43('0x3d')],_0x101cfb['query']);_0x542a20[_0x3c43('0x41')]=_[_0x3c43('0x40')](_0x101cfb[_0x3c43('0x3d')],qs['fields'](_0x3bbbc9[_0x3c43('0x3f')][_0x3c43('0x42')]));_0x542a20[_0x3c43('0x41')]=_0x542a20[_0x3c43('0x41')][_0x3c43('0x43')]?_0x542a20[_0x3c43('0x41')]:_0x101cfb[_0x3c43('0x3d')];if(!_0x3bbbc9[_0x3c43('0x3f')][_0x3c43('0x64')]('nolimit')){_0x542a20[_0x3c43('0x2a')]=qs[_0x3c43('0x2a')](_0x3bbbc9[_0x3c43('0x3f')][_0x3c43('0x2a')]);_0x542a20[_0x3c43('0x45')]=qs[_0x3c43('0x45')](_0x3bbbc9['query'][_0x3c43('0x45')]);}_0x542a20[_0x3c43('0x65')]=qs['sort'](_0x3bbbc9[_0x3c43('0x3f')][_0x3c43('0x46')]);_0x542a20['where']=qs[_0x3c43('0x48')](_['pick'](_0x3bbbc9[_0x3c43('0x3f')],_0x101cfb[_0x3c43('0x48')]));_0x542a20['where'][_0x3c43('0x61')]=_0x191071['id'];if(_0x3bbbc9[_0x3c43('0x3f')][_0x3c43('0x4a')]){_0x542a20[_0x3c43('0x47')]=_[_0x3c43('0x4b')](_0x542a20[_0x3c43('0x47')],{'$or':_[_0x3c43('0x39')](_0x542a20['attributes'],function(_0x4cd69a){var _0xdc64ad={};_0xdc64ad[_0x4cd69a]={'$like':'%'+_0x3bbbc9[_0x3c43('0x3f')][_0x3c43('0x4a')]+'%'};return _0xdc64ad;})});}_0x542a20=_[_0x3c43('0x4b')]({},_0x542a20,_0x3bbbc9[_0x3c43('0x4d')]);return db['FaxInteraction'][_0x3c43('0x2b')]({'where':_0x542a20[_0x3c43('0x47')]})['then'](function(_0x7c2fe){_0x40f15e['count']=_0x7c2fe;if(_0x3bbbc9[_0x3c43('0x3f')][_0x3c43('0x4e')]){_0x542a20[_0x3c43('0x4f')]=[{'model':db[_0x3c43('0x71')],'as':_0x3c43('0x72'),'required':![]},{'model':db['User'],'as':_0x3c43('0x73'),'attributes':['name',_0x3c43('0x74'),'internal'],'required':![]},{'model':db[_0x3c43('0x75')],'as':_0x3c43('0x76'),'attributes':['id',_0x3c43('0x36'),_0x3c43('0x77')],'where':_0x3bbbc9[_0x3c43('0x3f')]['tag']?{'id':_0x3bbbc9[_0x3c43('0x3f')][_0x3c43('0x78')]}:undefined,'required':_0x3bbbc9[_0x3c43('0x3f')][_0x3c43('0x78')]?!![]:![]}];}return db['FaxInteraction'][_0x3c43('0x50')](_0x542a20);})[_0x3c43('0x32')](function(_0x49484b){_0x40f15e[_0x3c43('0x66')]=_0x49484b;return _0x40f15e;});}})[_0x3c43('0x32')](respondWithFilteredResult(_0x2f0097,_0x542a20))[_0x3c43('0x51')](handleError(_0x2f0097,null));};exports[_0x3c43('0x79')]=function(_0x2e7c83,_0x34a008){var _0x182c39=_0x2e7c83[_0x3c43('0x53')]['id'];var _0x2720f0=_0x2e7c83[_0x3c43('0x57')];var _0x58e845=0xc8;var _0x5d365e=null;return db[_0x3c43('0x7a')][_0x3c43('0x7b')]({'isolationLevel':db['sequelize'][_0x3c43('0x7c')][_0x3c43('0x7d')][_0x3c43('0x7e')]},function(_0x294770){return db[_0x3c43('0x3a')][_0x3c43('0x6b')]({'where':{'id':_0x182c39},'transaction':_0x294770})[_0x3c43('0x32')](function(_0x362e6e){if(_0x362e6e){return db[_0x3c43('0x7f')]['destroy']({'where':{'FaxAccountId':_0x182c39},'transaction':_0x294770})[_0x3c43('0x32')](function(){var _0x37d1ff=_[_0x3c43('0x39')](_0x2720f0,function(_0x149fd3){_0x149fd3[_0x3c43('0x61')]=_0x182c39;return _0x149fd3;});return db[_0x3c43('0x7f')][_0x3c43('0x80')](_0x37d1ff,{'transaction':_0x294770});});}else{_0x58e845=0x194;_0x5d365e=[];}});})[_0x3c43('0x32')](function(){if(_0x58e845!==0x194){return db[_0x3c43('0x7f')][_0x3c43('0x81')]({'where':{'FaxAccountId':_0x182c39},'order':'priority'})[_0x3c43('0x32')](function(_0x4205ed){_0x5d365e=_0x4205ed;});}})[_0x3c43('0x51')](function(_0x42afa2){_0x58e845=0x1f4;logger[_0x3c43('0x21')](_0x42afa2[_0x3c43('0x82')]);if(_0x42afa2[_0x3c43('0x36')]){delete _0x42afa2[_0x3c43('0x36')];}_0x5d365e=_0x42afa2;})[_0x3c43('0x83')](function(){if(_0x5d365e===null){_0x34a008['sendStatus'](_0x58e845);}else{if(_0x58e845===0x1f4){_0x34a008[_0x3c43('0x26')](_0x58e845)[_0x3c43('0x37')](_0x5d365e);}else{_0x34a008[_0x3c43('0x26')](_0x58e845)[_0x3c43('0x28')](_0x5d365e);}}});};exports['getApplications']=function(_0x2ba661,_0x15314d,_0x4a6d8d){var _0x2ee6ea={};var _0x161a3b={};var _0x2445f3;var _0x1b775a;return db[_0x3c43('0x3a')]['findOne']({'where':{'id':_0x2ba661[_0x3c43('0x53')]['id']}})['then'](handleEntityNotFound(_0x15314d,null))[_0x3c43('0x32')](function(_0x472664){if(_0x472664){_0x2445f3=_0x472664;_0x161a3b[_0x3c43('0x3d')]=_[_0x3c43('0x3e')](db[_0x3c43('0x7f')][_0x3c43('0x3b')]);_0x161a3b[_0x3c43('0x3f')]=_[_0x3c43('0x3e')](_0x2ba661[_0x3c43('0x3f')]);_0x161a3b[_0x3c43('0x48')]=_['intersection'](_0x161a3b[_0x3c43('0x3d')],_0x161a3b['query']);_0x2ee6ea[_0x3c43('0x41')]=_['intersection'](_0x161a3b[_0x3c43('0x3d')],qs['fields'](_0x2ba661[_0x3c43('0x3f')]['fields']));_0x2ee6ea[_0x3c43('0x41')]=_0x2ee6ea[_0x3c43('0x41')]['length']?_0x2ee6ea[_0x3c43('0x41')]:_0x161a3b[_0x3c43('0x3d')];_0x2ee6ea[_0x3c43('0x65')]=qs[_0x3c43('0x46')](_0x2ba661['query'][_0x3c43('0x46')]);_0x2ee6ea[_0x3c43('0x47')]=qs[_0x3c43('0x48')](_['pick'](_0x2ba661['query'],_0x161a3b[_0x3c43('0x48')]));if(_0x2ba661['query']['filter']){_0x2ee6ea['where']=_[_0x3c43('0x4b')](_0x2ee6ea[_0x3c43('0x47')],{'$or':_['map'](_0x2ee6ea[_0x3c43('0x41')],function(_0xdeb8e8){var _0x3e46b2={};_0x3e46b2[_0xdeb8e8]={'$like':'%'+_0x2ba661[_0x3c43('0x3f')][_0x3c43('0x4a')]+'%'};return _0x3e46b2;})});}_0x2ee6ea=_[_0x3c43('0x4b')]({},_0x2ee6ea,_0x2ba661['options']);return _0x2445f3[_0x3c43('0x84')](_0x2ee6ea);}})[_0x3c43('0x32')](function(_0x314640){if(_0x314640){_0x1b775a=_0x314640[_0x3c43('0x43')];if(!_0x2ba661[_0x3c43('0x3f')]['hasOwnProperty'](_0x3c43('0x44'))){_0x2ee6ea[_0x3c43('0x2a')]=qs[_0x3c43('0x2a')](_0x2ba661['query'][_0x3c43('0x2a')]);_0x2ee6ea[_0x3c43('0x45')]=qs[_0x3c43('0x45')](_0x2ba661[_0x3c43('0x3f')][_0x3c43('0x45')]);}return _0x2445f3[_0x3c43('0x84')](_0x2ee6ea);}})[_0x3c43('0x32')](function(_0x4c9092){if(_0x4c9092){return _0x4c9092?{'count':_0x1b775a,'rows':_0x4c9092}:null;}})[_0x3c43('0x32')](respondWithResult(_0x15314d,null))['catch'](handleError(_0x15314d,null));};function Extension(_0x330f39,_0x221246,_0x55ca4f,_0x4ee983){this[_0x3c43('0x85')]=_0x3c43('0x86');this[_0x3c43('0x87')]=_0x330f39['localstationid'];this['app']=_0x4ee983;this['type']=_0x3c43('0x88');this[_0x3c43('0x89')]=_0x3c43('0x8a');this[_0x3c43('0x61')]=_0x330f39['id'];this[_0x3c43('0x8b')]=_0x221246;this[_0x3c43('0x8c')]=_0x55ca4f;}function createExtensionsReciveFax(_0x5b366f){var _0x1e251c=0x1;var _0x45f69e=[];_0x45f69e[_0x3c43('0x8d')](new Extension(_0x5b366f,_0x1e251c,'',_0x3c43('0x8e')));_0x1e251c+=0x1;_0x45f69e[_0x3c43('0x8d')](new Extension(_0x5b366f,_0x1e251c,_0x3c43('0x8f'),_0x3c43('0x90')));_0x1e251c+=0x1;for(var _0xf7e316 in _0x5b366f){if(_0x5b366f['hasOwnProperty'](_0xf7e316)&&(_0xf7e316==='ecm'||_0xf7e316==='localstationid'||_0xf7e316==='gateway'||_0xf7e316===_0x3c43('0x91')||_0xf7e316===_0x3c43('0x92')||_0xf7e316===_0x3c43('0x93')||_0xf7e316===_0x3c43('0x94')||_0xf7e316===_0x3c43('0x95')||_0xf7e316===_0x3c43('0x96'))){_0x45f69e[_0x3c43('0x8d')](new Extension(_0x5b366f,_0x1e251c,_0x3c43('0x97')+_0xf7e316+')='+_0x5b366f[_0xf7e316],_0x3c43('0x90')));_0x1e251c+=0x1;}}_0x45f69e[_0x3c43('0x8d')](new Extension(_0x5b366f,_0x1e251c,'6','Wait'));_0x1e251c+=0x1;_0x45f69e[_0x3c43('0x8d')](new Extension(_0x5b366f,_0x1e251c,_0x3c43('0x98'),_0x3c43('0x99')));_0x1e251c=0x0;return _0x45f69e;}exports[_0x3c43('0x9a')]=function(_0x60589c,_0x4694a8,_0x15b80d){var _0x3297d0;return db[_0x3c43('0x7a')][_0x3c43('0x7b')](function(_0x4d5f13){return db[_0x3c43('0x3a')]['create'](_0x60589c[_0x3c43('0x57')],{'transaction':_0x4d5f13})[_0x3c43('0x32')](function(_0x376e47){_0x3297d0=_0x376e47[_0x3c43('0x33')]({'plain':!![]});return db['VoiceExtension'][_0x3c43('0x80')](createExtensionsReciveFax(_0x3297d0),{'transaction':_0x4d5f13});});})[_0x3c43('0x32')](function(){return _0x3297d0;})[_0x3c43('0x32')](respondWithResult(_0x4694a8,null))['catch'](handleError(_0x4694a8,null));};exports[_0x3c43('0x9b')]=function(_0x1aa31e,_0x1a7e26,_0xbdf5ba){var _0x51c3df;return db[_0x3c43('0x7a')][_0x3c43('0x7b')](function(_0xfe005e){return db[_0x3c43('0x3a')][_0x3c43('0x31')](_0x1aa31e['body'],{'where':{'id':_0x1aa31e['body']['id']},'transaction':_0xfe005e})[_0x3c43('0x32')](function(_0x2d96ad){return db['VoiceExtension'][_0x3c43('0x35')]({'where':{'FaxAccountId':_0x1aa31e['body']['id']},'transaction':_0xfe005e})[_0x3c43('0x32')](function(_0x1693b1){return db[_0x3c43('0x9c')][_0x3c43('0x80')](createExtensionsReciveFax(_[_0x3c43('0x6e')](_0x1aa31e[_0x3c43('0x57')],[_0x3c43('0x9d'),_0x3c43('0x9e'),_0x3c43('0x9f'),_0x3c43('0xa0'),_0x3c43('0xa1'),_0x3c43('0xa2')])),{'transaction':_0xfe005e});});});})[_0x3c43('0x32')](function(){return db[_0x3c43('0x3a')]['findById'](_0x1aa31e[_0x3c43('0x57')]['id']);})[_0x3c43('0x32')](respondWithResult(_0x1a7e26,null))['catch'](handleError(_0x1a7e26,null));};exports[_0x3c43('0xa3')]=function(_0x22ccfc,_0x493424,_0x5c3c01){var _0x47675a={'raw':!![],'where':{}};var _0x27eb5c={};var _0x5d9929={'count':0x0,'rows':[]};return db[_0x3c43('0x3a')][_0x3c43('0x6b')]({'where':{'id':_0x22ccfc['params']['id']}})[_0x3c43('0x32')](handleEntityNotFound(_0x493424,null))[_0x3c43('0x32')](function(_0xae7b4b){if(_0xae7b4b){_0x27eb5c[_0x3c43('0x3d')]=_[_0x3c43('0x3e')](db['FaxMessage'][_0x3c43('0x3b')]);_0x27eb5c[_0x3c43('0x3f')]=_['keys'](_0x22ccfc[_0x3c43('0x3f')]);_0x27eb5c[_0x3c43('0x48')]=_[_0x3c43('0x40')](_0x27eb5c[_0x3c43('0x3d')],_0x27eb5c[_0x3c43('0x3f')]);_0x47675a[_0x3c43('0x41')]=_['intersection'](_0x27eb5c[_0x3c43('0x3d')],qs[_0x3c43('0x42')](_0x22ccfc[_0x3c43('0x3f')][_0x3c43('0x42')]));_0x47675a[_0x3c43('0x41')]=_0x47675a[_0x3c43('0x41')][_0x3c43('0x43')]?_0x47675a[_0x3c43('0x41')]:_0x27eb5c['model'];if(!_0x22ccfc[_0x3c43('0x3f')][_0x3c43('0x64')](_0x3c43('0x44'))){_0x47675a[_0x3c43('0x2a')]=qs[_0x3c43('0x2a')](_0x22ccfc['query'][_0x3c43('0x2a')]);_0x47675a[_0x3c43('0x45')]=qs[_0x3c43('0x45')](_0x22ccfc[_0x3c43('0x3f')][_0x3c43('0x45')]);}_0x47675a['order']=qs[_0x3c43('0x46')](_0x22ccfc[_0x3c43('0x3f')][_0x3c43('0x46')]);_0x47675a['where']=qs[_0x3c43('0x48')](_[_0x3c43('0x49')](_0x22ccfc[_0x3c43('0x3f')],_0x27eb5c[_0x3c43('0x48')]));_0x47675a[_0x3c43('0x47')]['FaxAccountId']=_0xae7b4b['id'];if(_0x22ccfc[_0x3c43('0x3f')][_0x3c43('0x4a')]){_0x47675a[_0x3c43('0x47')]=_[_0x3c43('0x4b')](_0x47675a[_0x3c43('0x47')],{'$or':_[_0x3c43('0x39')](_0x47675a[_0x3c43('0x41')],function(_0x45b4df){var _0xcf7426={};_0xcf7426[_0x45b4df]={'$like':'%'+_0x22ccfc['query']['filter']+'%'};return _0xcf7426;})});}if(_0x22ccfc[_0x3c43('0x3f')][_0x3c43('0xa4')]){var _0x3d30b8=_0x22ccfc[_0x3c43('0x3f')][_0x3c43('0xa4')][_0x3c43('0xa5')](',');var _0xbbd29b={};_0xbbd29b[_0x3d30b8[0x0]]={'$gte':moment(_0x3d30b8[0x1])['format'](_0x3c43('0xa6'))};_0x47675a['where']=_['merge'](_0x47675a[_0x3c43('0x47')],_0xbbd29b);}_0x47675a=_['merge']({},_0x47675a,_0x22ccfc[_0x3c43('0x4d')]);return db[_0x3c43('0xa7')][_0x3c43('0x2b')]({'where':_0x47675a[_0x3c43('0x47')]})['then'](function(_0x21f38e){_0x5d9929[_0x3c43('0x2b')]=_0x21f38e;if(_0x22ccfc[_0x3c43('0x3f')][_0x3c43('0x4e')]){_0x47675a[_0x3c43('0x4f')]=[{'all':!![]}];}return db[_0x3c43('0xa7')][_0x3c43('0x50')](_0x47675a);})[_0x3c43('0x32')](function(_0x520ea6){_0x5d9929[_0x3c43('0x66')]=_0x520ea6;return _0x5d9929;});}})[_0x3c43('0x32')](respondWithFilteredResult(_0x493424,_0x47675a))['catch'](handleError(_0x493424,null));};exports[_0x3c43('0x37')]=function(_0x548fc1,_0x5650f1,_0x26b5a1){var _0x5b3a9c,_0x49504d={},_0x1219ba;if(_0x548fc1[_0x3c43('0x57')]['to']){_0x1219ba=_0x548fc1[_0x3c43('0x57')]['to'][0x0];}return db[_0x3c43('0x3a')][_0x3c43('0x55')]({'where':{'id':_0x548fc1[_0x3c43('0x53')]['id']},'include':[{'model':db[_0x3c43('0xa8')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':{'fax':_0x1219ba},'limit':0x1,'order':[['updatedAt',_0x3c43('0xa9')]]}]}]})[_0x3c43('0x32')](handleEntityNotFound(_0x5650f1,null))[_0x3c43('0x32')](function(_0x5355c4){_0x5b3a9c=_0x5355c4;if(_0x548fc1['body'][_0x3c43('0xaa')]&&_0x548fc1[_0x3c43('0x57')][_0x3c43('0xaa')]['length']){for(var _0x1efdaf=0x0;_0x1efdaf<_0x548fc1['body']['attachments'][_0x3c43('0x43')];_0x1efdaf+=0x1){_0x548fc1['body'][_0x3c43('0xaa')][_0x1efdaf]={'filename':_0x548fc1[_0x3c43('0x57')][_0x3c43('0xaa')][_0x1efdaf][_0x3c43('0x36')],'id':_0x548fc1[_0x3c43('0x57')][_0x3c43('0xaa')][_0x1efdaf]['id'],'path':path[_0x3c43('0xab')](config[_0x3c43('0xac')],_0x3c43('0xad'),_0x548fc1['body'][_0x3c43('0xaa')][_0x1efdaf]['basename'])};}}return respondWithRpcPromise('CheckAfterSend','CheckAfterSend',{'FaxAccountId':_[_0x3c43('0xae')](_0x548fc1[_0x3c43('0x53')]['id'])?undefined:_0x548fc1[_0x3c43('0x53')]['id'],'path':_['isNil'](_0x548fc1[_0x3c43('0x57')][_0x3c43('0xaa')][0x0][_0x3c43('0x7')])?undefined:_0x548fc1[_0x3c43('0x57')][_0x3c43('0xaa')][0x0][_0x3c43('0x7')],'fax':_[_0x3c43('0xae')](_0x548fc1[_0x3c43('0x57')]['to'][0x0])?undefined:_0x548fc1[_0x3c43('0x57')]['to'][0x0]},client9002);})['then'](function(){if(_0x5b3a9c){if(_[_0x3c43('0xae')](_0x548fc1[_0x3c43('0x57')][_0x3c43('0xaf')])){_0x548fc1[_0x3c43('0x57')]['from']=util[_0x3c43('0xb0')]('\x22%s\x22\x20<%s>',_0x5b3a9c[_0x3c43('0x36')],_0x5b3a9c['fax']);}if(_0x5b3a9c['List']){if(_0x5b3a9c[_0x3c43('0xb1')][_0x3c43('0xb2')][_0x3c43('0x43')]){return _0x5b3a9c['List'][_0x3c43('0xb2')][0x0];}else{return db[_0x3c43('0x71')]['create'](_[_0x3c43('0xb3')](_0x548fc1[_0x3c43('0x57')],{'firstName':_0x548fc1['body']['to'][0x0],'phone':_0x548fc1['body']['to'][0x0],'fax':_0x548fc1[_0x3c43('0x57')]['to'][0x0],'ListId':_0x5b3a9c[_0x3c43('0xa2')]}));}}else{throw new Error(_0x3c43('0xb4'));}}else{throw new Error(_0x3c43('0xb5'));}})['then'](function(_0x4a7ca7){if(_0x4a7ca7){return db[_0x3c43('0x70')]['find']({'where':{'ContactId':_0x4a7ca7['id'],'closed':![],'FaxAccountId':_0x5b3a9c['id']}})[_0x3c43('0x32')](function(_0x2473d6){if(_0x2473d6){return[_0x2473d6,![]];}return db[_0x3c43('0x70')][_0x3c43('0x56')]({'UserId':_0x548fc1[_0x3c43('0x58')]['id'],'ContactId':_0x4a7ca7['id'],'FaxAccountId':_0x5b3a9c['id'],'fax':_0x548fc1[_0x3c43('0x57')]['to'][0x0],'firstMsgDirection':_0x3c43('0xb6'),'Messages':[_[_0x3c43('0x4b')](_0x548fc1['body'],{'read':![],'body':_0x548fc1[_0x3c43('0x57')][_0x3c43('0xaa')][0x0]['filename'],'FaxAccountId':_0x5b3a9c['id'],'UserId':_0x548fc1[_0x3c43('0x58')]['id'],'ContactId':_0x4a7ca7['id'],'AttachmentId':_0x548fc1[_0x3c43('0x57')]['attachments'][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x3c43('0xb7')}]})[_0x3c43('0x32')](function(_0x2d63d2){return[_0x2d63d2,!![]];});});}else{throw new Error(_0x3c43('0xb8'));}})['spread'](function(_0x3e56c7,_0x1ca34a){if(_0x1ca34a){return _0x3e56c7;}return db['FaxMessage'][_0x3c43('0x56')]({'direction':_0x3c43('0xb6'),'read':![],'body':_0x548fc1[_0x3c43('0x57')]['attachments'][0x0][_0x3c43('0xb9')],'FaxAccountId':_0x5b3a9c['id'],'FaxInteractionId':_0x3e56c7['id'],'UserId':_0x548fc1['user']['id'],'ContactId':_0x3e56c7['ContactId'],'AttachmentId':_0x548fc1[_0x3c43('0x57')][_0x3c43('0xaa')][0x0]['id']})[_0x3c43('0x32')](function(_0x3e77e2){_0x3e56c7[_0x3c43('0xba')][_0x3c43('0xb7')]=[];_0x3e56c7[_0x3c43('0xba')]['Messages']['push'](_0x3e77e2[_0x3c43('0xba')]);return _0x3e56c7;});})[_0x3c43('0x32')](function(_0x438e66){respondWithRpcPromise(_0x3c43('0xbb'),'SendFax',{'FaxAccountId':_[_0x3c43('0xae')](_0x548fc1[_0x3c43('0x53')]['id'])?undefined:_0x548fc1[_0x3c43('0x53')]['id'],'path':_[_0x3c43('0xae')](_0x548fc1[_0x3c43('0x57')][_0x3c43('0xaa')][0x0][_0x3c43('0x7')])?undefined:_0x548fc1['body'][_0x3c43('0xaa')][0x0][_0x3c43('0x7')],'fax':_[_0x3c43('0xae')](_0x548fc1[_0x3c43('0x57')]['to'][0x0])?undefined:_0x548fc1['body']['to'][0x0],'AttachmentId':_0x548fc1[_0x3c43('0x57')][_0x3c43('0xaa')][0x0]['id']},client9002)[_0x3c43('0x32')](function(_0x3ac15a){logger[_0x3c43('0x24')](_0x3c43('0xbc'),_0x3ac15a);})[_0x3c43('0x51')](function(_0x2d0681){logger[_0x3c43('0x24')](_0x3c43('0xbc'),_0x2d0681);});return _0x438e66;})[_0x3c43('0x32')](respondWithResult(_0x5650f1,null))[_0x3c43('0x51')](handleError(_0x5650f1,null));};exports[_0x3c43('0xbd')]=function(_0x1f7265,_0x439aa6,_0x55b0d0){return db['FaxAccount'][_0x3c43('0x55')]({'where':{'id':_0x1f7265[_0x3c43('0x53')]['id']}})[_0x3c43('0x32')](handleEntityNotFound(_0x439aa6,null))[_0x3c43('0x32')](function(_0x455f6c){if(_0x455f6c){return _0x455f6c[_0x3c43('0xbd')](_0x1f7265['body'][_0x3c43('0x68')],_['omit'](_0x1f7265[_0x3c43('0x57')],[_0x3c43('0x68'),'id'])||{})[_0x3c43('0xbe')](function(_0xd6c20e){for(var _0x28aa6f=0x0;_0x28aa6f<_0x1f7265[_0x3c43('0x57')][_0x3c43('0x68')][_0x3c43('0x43')];_0x28aa6f+=0x1){socket[_0x3c43('0xbf')](_0x3c43('0xc0'),{'UserId':Number(_0x1f7265['body'][_0x3c43('0x68')][_0x28aa6f]),'FaxAccountId':Number(_0x1f7265['params']['id'])});}return _0xd6c20e;});}})[_0x3c43('0x32')](respondWithResult(_0x439aa6,null))[_0x3c43('0x51')](handleError(_0x439aa6,null));};exports[_0x3c43('0xc1')]=function(_0x396e9b,_0x47746e,_0x142bb8){return db[_0x3c43('0x3a')]['find']({'where':{'id':_0x396e9b[_0x3c43('0x53')]['id']}})[_0x3c43('0x32')](handleEntityNotFound(_0x47746e,null))[_0x3c43('0x32')](function(_0x171c64){if(_0x171c64){return _0x171c64[_0x3c43('0xc1')](_0x396e9b[_0x3c43('0x3f')][_0x3c43('0x68')])[_0x3c43('0x32')](function(){if(_[_0x3c43('0xc2')](_0x396e9b[_0x3c43('0x3f')][_0x3c43('0x68')])){for(var _0x3c32d7=0x0;_0x3c32d7<_0x396e9b[_0x3c43('0x3f')][_0x3c43('0x68')][_0x3c43('0x43')];_0x3c32d7+=0x1){socket[_0x3c43('0xbf')](_0x3c43('0xc3'),{'UserId':Number(_0x396e9b['query'][_0x3c43('0x68')][_0x3c32d7]),'FaxAccountId':Number(_0x396e9b[_0x3c43('0x53')]['id'])});}}else{socket[_0x3c43('0xbf')]('userFaxAccount:remove',{'UserId':Number(_0x396e9b[_0x3c43('0x3f')][_0x3c43('0x68')]),'FaxAccountId':Number(_0x396e9b['params']['id'])});}});}})['then'](respondWithStatusCode(_0x47746e,null))[_0x3c43('0x51')](handleError(_0x47746e,null));};exports[_0x3c43('0xc4')]=function(_0x28abf2,_0x815a9b,_0x331ff3){var _0x97edf5={};var _0x5d2b84={};var _0x426936;var _0x5bc973;return db['FaxAccount'][_0x3c43('0x6b')]({'where':{'id':_0x28abf2['params']['id']}})['then'](handleEntityNotFound(_0x815a9b,null))[_0x3c43('0x32')](function(_0x953771){if(_0x953771){_0x426936=_0x953771;_0x5d2b84[_0x3c43('0x3d')]=_[_0x3c43('0x3e')](db[_0x3c43('0xc5')][_0x3c43('0x3b')]);_0x5d2b84[_0x3c43('0x3f')]=_[_0x3c43('0x3e')](_0x28abf2[_0x3c43('0x3f')]);_0x5d2b84[_0x3c43('0x48')]=_[_0x3c43('0x40')](_0x5d2b84['model'],_0x5d2b84[_0x3c43('0x3f')]);_0x97edf5[_0x3c43('0x41')]=_[_0x3c43('0x40')](_0x5d2b84[_0x3c43('0x3d')],qs[_0x3c43('0x42')](_0x28abf2[_0x3c43('0x3f')][_0x3c43('0x42')]));_0x97edf5[_0x3c43('0x41')]=_0x97edf5[_0x3c43('0x41')][_0x3c43('0x43')]?_0x97edf5[_0x3c43('0x41')]:_0x5d2b84[_0x3c43('0x3d')];_0x97edf5[_0x3c43('0x65')]=qs[_0x3c43('0x46')](_0x28abf2[_0x3c43('0x3f')][_0x3c43('0x46')]);_0x97edf5['where']=qs['filters'](_[_0x3c43('0x49')](_0x28abf2[_0x3c43('0x3f')],_0x5d2b84[_0x3c43('0x48')]));if(_0x28abf2[_0x3c43('0x3f')][_0x3c43('0x4a')]){_0x97edf5[_0x3c43('0x47')]=_[_0x3c43('0x4b')](_0x97edf5[_0x3c43('0x47')],{'$or':_['map'](_0x97edf5[_0x3c43('0x41')],function(_0x4aeca3){var _0x136e0={};_0x136e0[_0x4aeca3]={'$like':'%'+_0x28abf2[_0x3c43('0x3f')][_0x3c43('0x4a')]+'%'};return _0x136e0;})});}_0x97edf5=_['merge']({},_0x97edf5,_0x28abf2['options']);return _0x426936['getAgents'](_0x97edf5);}})[_0x3c43('0x32')](function(_0x54069e){if(_0x54069e){_0x5bc973=_0x54069e['length'];if(!_0x28abf2[_0x3c43('0x3f')][_0x3c43('0x64')](_0x3c43('0x44'))){_0x97edf5[_0x3c43('0x2a')]=qs[_0x3c43('0x2a')](_0x28abf2[_0x3c43('0x3f')][_0x3c43('0x2a')]);_0x97edf5['offset']=qs['offset'](_0x28abf2[_0x3c43('0x3f')]['offset']);}return _0x426936['getAgents'](_0x97edf5);}})['then'](function(_0x4b90ee){if(_0x4b90ee){return _0x4b90ee?{'count':_0x5bc973,'rows':_0x4b90ee}:null;}})[_0x3c43('0x32')](respondWithResult(_0x815a9b,null))[_0x3c43('0x51')](handleError(_0x815a9b,null));}; \ No newline at end of file +var _0xd557=['to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','http','client','request','info','FaxAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','catch','sendStatus','status','json','offset','undefined','limit','Content-Range','reject','save','update','destroy','then','get','FaxAccounts','UserProfileResource','end','send','index','Pause','map','FaxAccount','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','VIRTUAL','merge','options','where','count','includeAll','findAll','show','mandatoryDispositionPause','rawAttributes','include','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','create','params','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','order','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','rows','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','stack','finally','getApplications','context','from-voip-provider','localstationid','app','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','ecm','headerinfo','maxrate','minrate','t38timeout','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','join','server/files/attachments','basename','CheckAfterSend','isNil','path','from','format','\x22%s\x22\x20<%s>','fax','defaults','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x4a59a5,_0x17f24f){var _0x51d5de=function(_0x16ccbb){while(--_0x16ccbb){_0x4a59a5['push'](_0x4a59a5['shift']());}};_0x51d5de(++_0x17f24f);}(_0xd557,0x193));var _0x7d55=function(_0x186bf6,_0x25c7e2){_0x186bf6=_0x186bf6-0x0;var _0x4a9d28=_0xd557[_0x186bf6];return _0x4a9d28;};'use strict';var emlformat=require(_0x7d55('0x0'));var rimraf=require(_0x7d55('0x1'));var zipdir=require(_0x7d55('0x2'));var jsonpatch=require(_0x7d55('0x3'));var rp=require(_0x7d55('0x4'));var moment=require(_0x7d55('0x5'));var BPromise=require(_0x7d55('0x6'));var Mustache=require(_0x7d55('0x7'));var util=require(_0x7d55('0x8'));var path=require('path');var sox=require(_0x7d55('0x9'));var csv=require('to-csv');var ejs=require(_0x7d55('0xa'));var fs=require('fs');var fs_extra=require(_0x7d55('0xb'));var _=require(_0x7d55('0xc'));var squel=require(_0x7d55('0xd'));var crypto=require(_0x7d55('0xe'));var jsforce=require(_0x7d55('0xf'));var deskjs=require(_0x7d55('0x10'));var toCsv=require(_0x7d55('0x11'));var querystring=require(_0x7d55('0x12'));var Papa=require(_0x7d55('0x13'));var Redis=require(_0x7d55('0x14'));var authService=require(_0x7d55('0x15'));var qs=require(_0x7d55('0x16'));var as=require(_0x7d55('0x17'));var hardwareService=require(_0x7d55('0x18'));var logger=require(_0x7d55('0x19'))(_0x7d55('0x1a'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7d55('0x1b'))['db'];config['redis']=_['defaults'](config[_0x7d55('0x1c')],{'host':_0x7d55('0x1d'),'port':0x18eb});var socket=require(_0x7d55('0x1e'))(new Redis(config[_0x7d55('0x1c')]));require(_0x7d55('0x1f'))[_0x7d55('0x20')](socket);var jayson=require(_0x7d55('0x21'));var client=jayson['client'][_0x7d55('0x22')]({'port':0x232c});var client9002=jayson[_0x7d55('0x23')]['http']({'port':0x232a});function respondWithRpcPromise(_0x501229,_0x4331f7,_0x393a4c,_0x585e85){return new BPromise(function(_0x5143e5,_0x5922e7){var _0x238f72=_0x585e85||client;return _0x238f72[_0x7d55('0x24')](_0x501229,_0x393a4c)['then'](function(_0x303f35){logger[_0x7d55('0x25')](_0x7d55('0x26'),_0x4331f7,'request\x20sent');logger[_0x7d55('0x27')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x4331f7,_0x7d55('0x28'),JSON[_0x7d55('0x29')](_0x303f35));if(_0x303f35[_0x7d55('0x2a')]){if(_0x303f35[_0x7d55('0x2a')]['code']===0x1f4){logger[_0x7d55('0x2a')](_0x7d55('0x26'),_0x4331f7,_0x303f35[_0x7d55('0x2a')][_0x7d55('0x2b')]);return _0x5922e7(_0x303f35[_0x7d55('0x2a')]['message']);}logger[_0x7d55('0x2a')](_0x7d55('0x26'),_0x4331f7,_0x303f35[_0x7d55('0x2a')]['message']);return _0x5143e5(_0x303f35[_0x7d55('0x2a')]['message']);}else{logger[_0x7d55('0x25')]('FaxAccount,\x20%s,\x20%s',_0x4331f7,_0x7d55('0x28'));_0x5143e5(_0x303f35['result'][_0x7d55('0x2b')]);}})[_0x7d55('0x2c')](function(_0x131586){logger[_0x7d55('0x2a')](_0x7d55('0x26'),_0x4331f7,_0x131586);_0x5922e7(_0x131586);});});}function respondWithStatusCode(_0x281135,_0x5ec2e3){_0x5ec2e3=_0x5ec2e3||0xcc;return function(_0x34b874){if(_0x34b874){return _0x281135[_0x7d55('0x2d')](_0x5ec2e3);}return _0x281135[_0x7d55('0x2e')](_0x5ec2e3)['end']();};}function respondWithResult(_0x461d51,_0x9946e){_0x9946e=_0x9946e||0xc8;return function(_0x1fa1f5){if(_0x1fa1f5){return _0x461d51[_0x7d55('0x2e')](_0x9946e)[_0x7d55('0x2f')](_0x1fa1f5);}};}function respondWithFilteredResult(_0x272f82,_0x501f1d){return function(_0x2fa868){if(_0x2fa868){var _0x1248d5=typeof _0x501f1d[_0x7d55('0x30')]===_0x7d55('0x31')&&typeof _0x501f1d['limit']===_0x7d55('0x31');var _0x110b89=_0x2fa868['count'];var _0x43546f=_0x1248d5?0x0:_0x501f1d[_0x7d55('0x30')];var _0x2c9ab8=_0x1248d5?_0x2fa868['count']:_0x501f1d['offset']+_0x501f1d[_0x7d55('0x32')];var _0x52a693;if(_0x2c9ab8>=_0x110b89){_0x2c9ab8=_0x110b89;_0x52a693=0xc8;}else{_0x52a693=0xce;}_0x272f82[_0x7d55('0x2e')](_0x52a693);return _0x272f82['set'](_0x7d55('0x33'),_0x43546f+'-'+_0x2c9ab8+'/'+_0x110b89)[_0x7d55('0x2f')](_0x2fa868);}return null;};}function patchUpdates(_0x34274d){return function(_0x5d689e){try{jsonpatch['apply'](_0x5d689e,_0x34274d,!![]);}catch(_0x2624bc){return BPromise[_0x7d55('0x34')](_0x2624bc);}return _0x5d689e[_0x7d55('0x35')]();};}function saveUpdates(_0x51d062,_0x5aeb79){return function(_0x21588d){if(_0x21588d){return _0x21588d[_0x7d55('0x36')](_0x51d062)['then'](function(_0x2a9578){return _0x2a9578;});}return null;};}function removeEntity(_0x11df6f,_0x2c991f){return function(_0x1c26d8){if(_0x1c26d8){return _0x1c26d8[_0x7d55('0x37')]()[_0x7d55('0x38')](function(){var _0x220183=_0x1c26d8[_0x7d55('0x39')]({'plain':!![]});var _0x586aab=_0x7d55('0x3a');return db[_0x7d55('0x3b')]['destroy']({'where':{'type':_0x586aab,'resourceId':_0x220183['id']}})[_0x7d55('0x38')](function(){return _0x1c26d8;});})[_0x7d55('0x38')](function(){_0x11df6f[_0x7d55('0x2e')](0xcc)[_0x7d55('0x3c')]();});}};}function handleEntityNotFound(_0xefd70b,_0x42cfd2){return function(_0xf1d80f){if(!_0xf1d80f){_0xefd70b['sendStatus'](0x194);}return _0xf1d80f;};}function handleError(_0x146cd6,_0x430d55){_0x430d55=_0x430d55||0x1f4;return function(_0x5e76ea){logger[_0x7d55('0x2a')](_0x5e76ea['stack']);if(_0x5e76ea['name']){delete _0x5e76ea['name'];}_0x146cd6[_0x7d55('0x2e')](_0x430d55)[_0x7d55('0x3d')](_0x5e76ea);};}exports[_0x7d55('0x3e')]=function(_0x318296,_0x16669b){var _0x39b798={'include':[{'model':db[_0x7d55('0x3f')],'as':'mandatoryDispositionPause'}]},_0x24cefe={},_0x33985b={'count':0x0,'rows':[]};var _0x5a0cce=_[_0x7d55('0x40')](db[_0x7d55('0x41')]['rawAttributes'],function(_0x274b09){return{'name':_0x274b09[_0x7d55('0x42')],'type':_0x274b09[_0x7d55('0x43')][_0x7d55('0x44')]};});_0x24cefe[_0x7d55('0x45')]=_[_0x7d55('0x40')](_0x5a0cce,_0x7d55('0x46'));_0x24cefe[_0x7d55('0x47')]=_[_0x7d55('0x48')](_0x318296['query']);_0x24cefe[_0x7d55('0x49')]=_[_0x7d55('0x4a')](_0x24cefe[_0x7d55('0x45')],_0x24cefe['query']);_0x39b798[_0x7d55('0x4b')]=_['intersection'](_0x24cefe[_0x7d55('0x45')],qs['fields'](_0x318296[_0x7d55('0x47')][_0x7d55('0x4c')]));_0x39b798['attributes']=_0x39b798[_0x7d55('0x4b')][_0x7d55('0x4d')]?_0x39b798['attributes']:_0x24cefe['model'];if(!_0x318296[_0x7d55('0x47')][_0x7d55('0x4e')](_0x7d55('0x4f'))){_0x39b798[_0x7d55('0x32')]=qs[_0x7d55('0x32')](_0x318296[_0x7d55('0x47')][_0x7d55('0x32')]);_0x39b798[_0x7d55('0x30')]=qs[_0x7d55('0x30')](_0x318296[_0x7d55('0x47')]['offset']);}_0x39b798['order']=qs['sort'](_0x318296[_0x7d55('0x47')][_0x7d55('0x50')]);_0x39b798['where']=qs[_0x7d55('0x49')](_[_0x7d55('0x51')](_0x318296['query'],_0x24cefe['filters']),_0x5a0cce);if(_0x318296[_0x7d55('0x47')][_0x7d55('0x52')]){_0x39b798['where']=_['merge'](_0x39b798['where'],{'$or':_[_0x7d55('0x40')](_0x5a0cce,function(_0x29af20){if(_0x29af20[_0x7d55('0x43')]!==_0x7d55('0x53')){var _0x41bf7a={};_0x41bf7a[_0x29af20[_0x7d55('0x46')]]={'$like':'%'+_0x318296['query'][_0x7d55('0x52')]+'%'};return _0x41bf7a;}})});}_0x39b798=_[_0x7d55('0x54')]({},_0x39b798,_0x318296[_0x7d55('0x55')]);var _0x5965d4={'where':_0x39b798[_0x7d55('0x56')]};return db[_0x7d55('0x41')][_0x7d55('0x57')](_0x5965d4)[_0x7d55('0x38')](function(_0x354cee){_0x33985b[_0x7d55('0x57')]=_0x354cee;if(_0x318296[_0x7d55('0x47')][_0x7d55('0x58')]){_0x39b798['include']=[{'all':!![]}];}return db[_0x7d55('0x41')][_0x7d55('0x59')](_0x39b798);})[_0x7d55('0x38')](function(_0x5c7fea){_0x33985b['rows']=_0x5c7fea;return _0x33985b;})[_0x7d55('0x38')](respondWithFilteredResult(_0x16669b,_0x39b798))[_0x7d55('0x2c')](handleError(_0x16669b,null));};exports[_0x7d55('0x5a')]=function(_0x263d68,_0x5b80f7){var _0x2ca781={'raw':![],'where':{'id':_0x263d68['params']['id']},'include':[{'model':db[_0x7d55('0x3f')],'as':_0x7d55('0x5b')}]},_0x194256={};_0x194256[_0x7d55('0x45')]=_[_0x7d55('0x48')](db['FaxAccount'][_0x7d55('0x5c')]);_0x194256['query']=_[_0x7d55('0x48')](_0x263d68[_0x7d55('0x47')]);_0x194256[_0x7d55('0x49')]=_[_0x7d55('0x4a')](_0x194256[_0x7d55('0x45')],_0x194256['query']);_0x2ca781[_0x7d55('0x4b')]=_[_0x7d55('0x4a')](_0x194256[_0x7d55('0x45')],qs[_0x7d55('0x4c')](_0x263d68[_0x7d55('0x47')][_0x7d55('0x4c')]));_0x2ca781[_0x7d55('0x4b')]=_0x2ca781[_0x7d55('0x4b')]['length']?_0x2ca781[_0x7d55('0x4b')]:_0x194256[_0x7d55('0x45')];if(_0x263d68[_0x7d55('0x47')]['includeAll']){_0x2ca781[_0x7d55('0x5d')]=[{'all':!![]}];}_0x2ca781=_[_0x7d55('0x54')]({},_0x2ca781,_0x263d68[_0x7d55('0x55')]);return db[_0x7d55('0x41')][_0x7d55('0x5e')](_0x2ca781)['then'](handleEntityNotFound(_0x5b80f7,null))[_0x7d55('0x38')](respondWithResult(_0x5b80f7,null))[_0x7d55('0x2c')](handleError(_0x5b80f7,null));};exports['create']=function(_0x57604b,_0x2a5e52){return db[_0x7d55('0x41')]['create'](_0x57604b[_0x7d55('0x5f')],{})[_0x7d55('0x38')](function(_0x1cdb60){var _0x117def=_0x57604b['user']['get']({'plain':!![]});if(!_0x117def)throw new Error(_0x7d55('0x60'));if(_0x117def[_0x7d55('0x61')]===_0x7d55('0x62')){var _0x4e60b0=_0x1cdb60['get']({'plain':!![]});var _0x1b17f6=_0x7d55('0x3a');return db[_0x7d55('0x63')]['find']({'where':{'name':_0x1b17f6,'userProfileId':_0x117def[_0x7d55('0x64')]},'raw':!![]})['then'](function(_0x1ad40c){if(_0x1ad40c&&_0x1ad40c['autoAssociation']===0x0){return db[_0x7d55('0x3b')][_0x7d55('0x65')]({'name':_0x4e60b0[_0x7d55('0x46')],'resourceId':_0x4e60b0['id'],'type':_0x1ad40c[_0x7d55('0x46')],'sectionId':_0x1ad40c['id']},{})['then'](function(){return _0x1cdb60;});}else{return _0x1cdb60;}})[_0x7d55('0x2c')](function(_0x387908){logger[_0x7d55('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x387908);throw _0x387908;});}return _0x1cdb60;})[_0x7d55('0x38')](respondWithResult(_0x2a5e52,0xc9))[_0x7d55('0x2c')](handleError(_0x2a5e52,null));};exports[_0x7d55('0x36')]=function(_0x4ee6f0,_0x1ee9e4){if(_0x4ee6f0[_0x7d55('0x5f')]['id']){delete _0x4ee6f0['body']['id'];}return db[_0x7d55('0x41')]['find']({'where':{'id':_0x4ee6f0[_0x7d55('0x66')]['id']},'include':[{'model':db[_0x7d55('0x3f')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x1ee9e4,null))[_0x7d55('0x38')](saveUpdates(_0x4ee6f0[_0x7d55('0x5f')],null))[_0x7d55('0x38')](respondWithResult(_0x1ee9e4,null))[_0x7d55('0x2c')](handleError(_0x1ee9e4,null));};exports[_0x7d55('0x37')]=function(_0x5f5030,_0x734e33){return db[_0x7d55('0x41')]['find']({'where':{'id':_0x5f5030[_0x7d55('0x66')]['id']}})['then'](handleEntityNotFound(_0x734e33,null))[_0x7d55('0x38')](removeEntity(_0x734e33,null))['catch'](handleError(_0x734e33,null));};exports[_0x7d55('0x67')]=function(_0x425daa,_0x21042a){return db[_0x7d55('0x41')]['describe']()[_0x7d55('0x38')](respondWithResult(_0x21042a,null))[_0x7d55('0x2c')](handleError(_0x21042a,null));};exports[_0x7d55('0x68')]=function(_0x33c1d8,_0x37978b,_0x55aa49){if(_0x33c1d8[_0x7d55('0x5f')]['id']){delete _0x33c1d8[_0x7d55('0x5f')]['id'];}return db[_0x7d55('0x41')][_0x7d55('0x5e')]({'where':{'id':_0x33c1d8[_0x7d55('0x66')]['id']}})[_0x7d55('0x38')](handleEntityNotFound(_0x37978b,null))[_0x7d55('0x38')](function(_0x42dfdd){if(_0x42dfdd){_0x33c1d8[_0x7d55('0x5f')][_0x7d55('0x69')]=_0x42dfdd['id'];return db[_0x7d55('0x6a')][_0x7d55('0x65')](_0x33c1d8[_0x7d55('0x5f')]);}})[_0x7d55('0x38')](respondWithResult(_0x37978b,null))[_0x7d55('0x2c')](handleError(_0x37978b,null));};exports[_0x7d55('0x6b')]=function(_0x53a470,_0x280db0,_0x115f4a){var _0x9fde33={'raw':![],'where':{}};var _0x17b08={};var _0x337429={'count':0x0,'rows':[]};return db[_0x7d55('0x41')][_0x7d55('0x6c')]({'where':{'id':_0x53a470[_0x7d55('0x66')]['id']}})[_0x7d55('0x38')](handleEntityNotFound(_0x280db0,null))[_0x7d55('0x38')](function(_0xa6f38){if(_0xa6f38){_0x17b08['model']=_[_0x7d55('0x48')](db[_0x7d55('0x6a')][_0x7d55('0x5c')]);_0x17b08[_0x7d55('0x47')]=_[_0x7d55('0x48')](_0x53a470[_0x7d55('0x47')]);_0x17b08['filters']=_[_0x7d55('0x4a')](_0x17b08['model'],_0x17b08[_0x7d55('0x47')]);_0x9fde33['attributes']=_[_0x7d55('0x4a')](_0x17b08[_0x7d55('0x45')],qs[_0x7d55('0x4c')](_0x53a470[_0x7d55('0x47')][_0x7d55('0x4c')]));_0x9fde33[_0x7d55('0x4b')]=_0x9fde33['attributes'][_0x7d55('0x4d')]?_0x9fde33[_0x7d55('0x4b')]:_0x17b08['model'];if(!_0x53a470['query'][_0x7d55('0x4e')](_0x7d55('0x4f'))){_0x9fde33[_0x7d55('0x32')]=qs[_0x7d55('0x32')](_0x53a470[_0x7d55('0x47')]['limit']);_0x9fde33[_0x7d55('0x30')]=qs[_0x7d55('0x30')](_0x53a470[_0x7d55('0x47')][_0x7d55('0x30')]);}_0x9fde33[_0x7d55('0x6d')]=qs['sort'](_0x53a470[_0x7d55('0x47')][_0x7d55('0x50')]);_0x9fde33['where']=qs['filters'](_[_0x7d55('0x51')](_0x53a470['query'],_0x17b08['filters']));_0x9fde33[_0x7d55('0x56')][_0x7d55('0x69')]=_0xa6f38['id'];if(_0x53a470[_0x7d55('0x47')]['filter']){_0x9fde33[_0x7d55('0x56')]=_['merge'](_0x9fde33['where'],{'$or':_[_0x7d55('0x40')](_0x9fde33[_0x7d55('0x4b')],function(_0x370a6a){var _0x46d398={};_0x46d398[_0x370a6a]={'$like':'%'+_0x53a470[_0x7d55('0x47')][_0x7d55('0x52')]+'%'};return _0x46d398;})});}_0x9fde33=_[_0x7d55('0x54')]({},_0x9fde33,_0x53a470[_0x7d55('0x55')]);return db[_0x7d55('0x6a')]['count']({'where':_0x9fde33[_0x7d55('0x56')]})[_0x7d55('0x38')](function(_0x21c71c){_0x337429['count']=_0x21c71c;if(_0x53a470[_0x7d55('0x47')][_0x7d55('0x58')]){_0x9fde33[_0x7d55('0x5d')]=[{'all':!![]}];}return db[_0x7d55('0x6a')][_0x7d55('0x59')](_0x9fde33);})['then'](function(_0x3cc5e9){_0x337429['rows']=_0x3cc5e9;return _0x337429;});}})[_0x7d55('0x38')](respondWithFilteredResult(_0x280db0,_0x9fde33))[_0x7d55('0x2c')](handleError(_0x280db0,null));};exports[_0x7d55('0x6e')]=function(_0x11fdad,_0x47a15e,_0xbfa889){return db[_0x7d55('0x41')][_0x7d55('0x5e')]({'where':{'id':_0x11fdad['params']['id']}})[_0x7d55('0x38')](handleEntityNotFound(_0x47a15e,null))[_0x7d55('0x38')](function(_0x1c4a3d){if(_0x1c4a3d){return _0x1c4a3d[_0x7d55('0x6e')](_0x11fdad[_0x7d55('0x47')][_0x7d55('0x6f')]);}})[_0x7d55('0x38')](respondWithStatusCode(_0x47a15e,null))['catch'](handleError(_0x47a15e,null));};exports[_0x7d55('0x70')]=function(_0x2bbd91,_0x362da4,_0x17d235){if(_0x2bbd91[_0x7d55('0x5f')]['id']){delete _0x2bbd91[_0x7d55('0x5f')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x2bbd91[_0x7d55('0x66')]['id']}})[_0x7d55('0x38')](handleEntityNotFound(_0x362da4,null))[_0x7d55('0x38')](function(_0x3cad52){if(_0x3cad52){_0x2bbd91['body'][_0x7d55('0x69')]=_0x3cad52['id'];return db[_0x7d55('0x71')][_0x7d55('0x65')](_0x2bbd91[_0x7d55('0x5f')]);}})[_0x7d55('0x38')](respondWithResult(_0x362da4,null))[_0x7d55('0x2c')](handleError(_0x362da4,null));};exports[_0x7d55('0x72')]=function(_0x58ffc1,_0x4de6e4,_0x45a311){var _0x5f5124={'raw':![],'where':{}};var _0x14de4d={};var _0x114081={'count':0x0,'rows':[]};return db[_0x7d55('0x41')]['findOne']({'where':{'id':_0x58ffc1[_0x7d55('0x66')]['id']}})[_0x7d55('0x38')](handleEntityNotFound(_0x4de6e4,null))[_0x7d55('0x38')](function(_0x28affe){if(_0x28affe){_0x14de4d[_0x7d55('0x45')]=_[_0x7d55('0x48')](db[_0x7d55('0x71')][_0x7d55('0x5c')]);_0x14de4d[_0x7d55('0x47')]=_[_0x7d55('0x48')](_0x58ffc1[_0x7d55('0x47')]);_0x14de4d[_0x7d55('0x49')]=_[_0x7d55('0x4a')](_0x14de4d['model'],_0x14de4d['query']);_0x5f5124[_0x7d55('0x4b')]=_[_0x7d55('0x4a')](_0x14de4d[_0x7d55('0x45')],qs[_0x7d55('0x4c')](_0x58ffc1[_0x7d55('0x47')][_0x7d55('0x4c')]));_0x5f5124[_0x7d55('0x4b')]=_0x5f5124[_0x7d55('0x4b')]['length']?_0x5f5124[_0x7d55('0x4b')]:_0x14de4d[_0x7d55('0x45')];if(!_0x58ffc1[_0x7d55('0x47')]['hasOwnProperty']('nolimit')){_0x5f5124[_0x7d55('0x32')]=qs[_0x7d55('0x32')](_0x58ffc1[_0x7d55('0x47')]['limit']);_0x5f5124[_0x7d55('0x30')]=qs['offset'](_0x58ffc1[_0x7d55('0x47')]['offset']);}_0x5f5124[_0x7d55('0x6d')]=qs[_0x7d55('0x50')](_0x58ffc1[_0x7d55('0x47')][_0x7d55('0x50')]);_0x5f5124[_0x7d55('0x56')]=qs['filters'](_['pick'](_0x58ffc1['query'],_0x14de4d[_0x7d55('0x49')]));_0x5f5124['where']['FaxAccountId']=_0x28affe['id'];if(_0x58ffc1['query']['filter']){_0x5f5124['where']=_[_0x7d55('0x54')](_0x5f5124[_0x7d55('0x56')],{'$or':_[_0x7d55('0x40')](_0x5f5124[_0x7d55('0x4b')],function(_0x456bc4){var _0x522f32={};_0x522f32[_0x456bc4]={'$like':'%'+_0x58ffc1[_0x7d55('0x47')]['filter']+'%'};return _0x522f32;})});}_0x5f5124=_[_0x7d55('0x54')]({},_0x5f5124,_0x58ffc1[_0x7d55('0x55')]);return db['CannedAnswer'][_0x7d55('0x57')]({'where':_0x5f5124['where']})[_0x7d55('0x38')](function(_0x250de3){_0x114081[_0x7d55('0x57')]=_0x250de3;if(_0x58ffc1[_0x7d55('0x47')][_0x7d55('0x58')]){_0x5f5124['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x5f5124);})[_0x7d55('0x38')](function(_0x290569){_0x114081[_0x7d55('0x73')]=_0x290569;return _0x114081;});}})['then'](respondWithFilteredResult(_0x4de6e4,_0x5f5124))[_0x7d55('0x2c')](handleError(_0x4de6e4,null));};exports[_0x7d55('0x74')]=function(_0x2d39c2,_0x3403db,_0x1fec84){return db['FaxAccount'][_0x7d55('0x5e')]({'where':{'id':_0x2d39c2[_0x7d55('0x66')]['id']}})[_0x7d55('0x38')](handleEntityNotFound(_0x3403db,null))['then'](function(_0x50bcab){if(_0x50bcab){return _0x50bcab[_0x7d55('0x74')](_0x2d39c2[_0x7d55('0x47')][_0x7d55('0x6f')]);}})[_0x7d55('0x38')](respondWithStatusCode(_0x3403db,null))[_0x7d55('0x2c')](handleError(_0x3403db,null));};exports[_0x7d55('0x75')]=function(_0x523f59,_0x19158e,_0x559ff4){return db[_0x7d55('0x76')][_0x7d55('0x5e')]({'where':{'id':_0x523f59[_0x7d55('0x66')]['id']}})[_0x7d55('0x38')](handleEntityNotFound(_0x19158e,null))[_0x7d55('0x38')](function(_0x16b6c5){if(_0x16b6c5){return _0x16b6c5[_0x7d55('0x75')](_0x523f59[_0x7d55('0x5f')][_0x7d55('0x6f')],_[_0x7d55('0x77')](_0x523f59[_0x7d55('0x5f')],[_0x7d55('0x6f'),'id'])||{});}})['then'](respondWithResult(_0x19158e,null))[_0x7d55('0x2c')](handleError(_0x19158e,null));};exports[_0x7d55('0x78')]=function(_0x1277f8,_0x36a466,_0x55cec5){var _0x581f6e={'raw':![],'where':{}};var _0x1feb4c={};var _0x1d851c={'count':0x0,'rows':[]};return db[_0x7d55('0x41')]['findOne']({'where':{'id':_0x1277f8['params']['id']}})[_0x7d55('0x38')](handleEntityNotFound(_0x36a466,null))[_0x7d55('0x38')](function(_0x4ab6f4){if(_0x4ab6f4){_0x1feb4c['model']=_['keys'](db[_0x7d55('0x76')][_0x7d55('0x5c')]);_0x1feb4c['query']=_[_0x7d55('0x48')](_0x1277f8[_0x7d55('0x47')]);_0x1feb4c[_0x7d55('0x49')]=_[_0x7d55('0x4a')](_0x1feb4c[_0x7d55('0x45')],_0x1feb4c[_0x7d55('0x47')]);_0x581f6e[_0x7d55('0x4b')]=_[_0x7d55('0x4a')](_0x1feb4c['model'],qs[_0x7d55('0x4c')](_0x1277f8[_0x7d55('0x47')]['fields']));_0x581f6e[_0x7d55('0x4b')]=_0x581f6e['attributes'][_0x7d55('0x4d')]?_0x581f6e[_0x7d55('0x4b')]:_0x1feb4c[_0x7d55('0x45')];if(!_0x1277f8[_0x7d55('0x47')][_0x7d55('0x4e')](_0x7d55('0x4f'))){_0x581f6e[_0x7d55('0x32')]=qs['limit'](_0x1277f8[_0x7d55('0x47')][_0x7d55('0x32')]);_0x581f6e['offset']=qs['offset'](_0x1277f8['query']['offset']);}_0x581f6e[_0x7d55('0x6d')]=qs['sort'](_0x1277f8['query'][_0x7d55('0x50')]);_0x581f6e[_0x7d55('0x56')]=qs[_0x7d55('0x49')](_['pick'](_0x1277f8[_0x7d55('0x47')],_0x1feb4c[_0x7d55('0x49')]));_0x581f6e[_0x7d55('0x56')][_0x7d55('0x69')]=_0x4ab6f4['id'];if(_0x1277f8[_0x7d55('0x47')][_0x7d55('0x52')]){_0x581f6e['where']=_[_0x7d55('0x54')](_0x581f6e[_0x7d55('0x56')],{'$or':_[_0x7d55('0x40')](_0x581f6e['attributes'],function(_0x532741){var _0x5a480e={};_0x5a480e[_0x532741]={'$like':'%'+_0x1277f8[_0x7d55('0x47')]['filter']+'%'};return _0x5a480e;})});}_0x581f6e=_[_0x7d55('0x54')]({},_0x581f6e,_0x1277f8[_0x7d55('0x55')]);return db[_0x7d55('0x76')][_0x7d55('0x57')]({'where':_0x581f6e[_0x7d55('0x56')]})['then'](function(_0xfbdd27){_0x1d851c[_0x7d55('0x57')]=_0xfbdd27;if(_0x1277f8[_0x7d55('0x47')][_0x7d55('0x58')]){_0x581f6e['include']=[{'model':db[_0x7d55('0x79')],'as':_0x7d55('0x7a'),'required':![]},{'model':db[_0x7d55('0x7b')],'as':_0x7d55('0x7c'),'attributes':[_0x7d55('0x46'),_0x7d55('0x7d'),_0x7d55('0x7e')],'required':![]},{'model':db[_0x7d55('0x7f')],'as':_0x7d55('0x80'),'attributes':['id',_0x7d55('0x46'),_0x7d55('0x81')],'where':_0x1277f8[_0x7d55('0x47')]['tag']?{'id':_0x1277f8['query'][_0x7d55('0x82')]}:undefined,'required':_0x1277f8['query'][_0x7d55('0x82')]?!![]:![]}];}return db[_0x7d55('0x76')][_0x7d55('0x59')](_0x581f6e);})[_0x7d55('0x38')](function(_0x23ee52){_0x1d851c[_0x7d55('0x73')]=_0x23ee52;return _0x1d851c;});}})[_0x7d55('0x38')](respondWithFilteredResult(_0x36a466,_0x581f6e))['catch'](handleError(_0x36a466,null));};exports[_0x7d55('0x83')]=function(_0x4d34c2,_0x163960){var _0x4b12b2=_0x4d34c2[_0x7d55('0x66')]['id'];var _0x52b424=_0x4d34c2[_0x7d55('0x5f')];var _0x282558=0xc8;var _0x36cfc4=null;return db[_0x7d55('0x84')][_0x7d55('0x85')]({'isolationLevel':db[_0x7d55('0x84')]['Transaction'][_0x7d55('0x86')][_0x7d55('0x87')]},function(_0x30037f){return db[_0x7d55('0x41')][_0x7d55('0x6c')]({'where':{'id':_0x4b12b2},'transaction':_0x30037f})['then'](function(_0x440a5e){if(_0x440a5e){return db[_0x7d55('0x88')]['destroy']({'where':{'FaxAccountId':_0x4b12b2},'transaction':_0x30037f})[_0x7d55('0x38')](function(){var _0x1988b4=_[_0x7d55('0x40')](_0x52b424,function(_0x2677cb){_0x2677cb[_0x7d55('0x69')]=_0x4b12b2;return _0x2677cb;});return db['FaxApplication'][_0x7d55('0x89')](_0x1988b4,{'transaction':_0x30037f});});}else{_0x282558=0x194;_0x36cfc4=[];}});})[_0x7d55('0x38')](function(){if(_0x282558!==0x194){return db['FaxApplication'][_0x7d55('0x8a')]({'where':{'FaxAccountId':_0x4b12b2},'order':_0x7d55('0x8b')})[_0x7d55('0x38')](function(_0x4a881d){_0x36cfc4=_0x4a881d;});}})[_0x7d55('0x2c')](function(_0x79b397){_0x282558=0x1f4;logger[_0x7d55('0x2a')](_0x79b397[_0x7d55('0x8c')]);if(_0x79b397['name']){delete _0x79b397[_0x7d55('0x46')];}_0x36cfc4=_0x79b397;})[_0x7d55('0x8d')](function(){if(_0x36cfc4===null){_0x163960[_0x7d55('0x2d')](_0x282558);}else{if(_0x282558===0x1f4){_0x163960[_0x7d55('0x2e')](_0x282558)[_0x7d55('0x3d')](_0x36cfc4);}else{_0x163960['status'](_0x282558)[_0x7d55('0x2f')](_0x36cfc4);}}});};exports[_0x7d55('0x8e')]=function(_0x588aba,_0x144fce,_0x4eca69){var _0x38b6f4={};var _0x166fb0={};var _0x23b75;var _0x2749d1;return db[_0x7d55('0x41')][_0x7d55('0x6c')]({'where':{'id':_0x588aba[_0x7d55('0x66')]['id']}})[_0x7d55('0x38')](handleEntityNotFound(_0x144fce,null))['then'](function(_0x137165){if(_0x137165){_0x23b75=_0x137165;_0x166fb0['model']=_[_0x7d55('0x48')](db[_0x7d55('0x88')][_0x7d55('0x5c')]);_0x166fb0[_0x7d55('0x47')]=_[_0x7d55('0x48')](_0x588aba[_0x7d55('0x47')]);_0x166fb0[_0x7d55('0x49')]=_[_0x7d55('0x4a')](_0x166fb0[_0x7d55('0x45')],_0x166fb0[_0x7d55('0x47')]);_0x38b6f4[_0x7d55('0x4b')]=_[_0x7d55('0x4a')](_0x166fb0[_0x7d55('0x45')],qs[_0x7d55('0x4c')](_0x588aba[_0x7d55('0x47')]['fields']));_0x38b6f4[_0x7d55('0x4b')]=_0x38b6f4[_0x7d55('0x4b')][_0x7d55('0x4d')]?_0x38b6f4[_0x7d55('0x4b')]:_0x166fb0[_0x7d55('0x45')];_0x38b6f4[_0x7d55('0x6d')]=qs[_0x7d55('0x50')](_0x588aba[_0x7d55('0x47')][_0x7d55('0x50')]);_0x38b6f4[_0x7d55('0x56')]=qs['filters'](_['pick'](_0x588aba[_0x7d55('0x47')],_0x166fb0[_0x7d55('0x49')]));if(_0x588aba[_0x7d55('0x47')][_0x7d55('0x52')]){_0x38b6f4['where']=_[_0x7d55('0x54')](_0x38b6f4[_0x7d55('0x56')],{'$or':_[_0x7d55('0x40')](_0x38b6f4['attributes'],function(_0x533450){var _0x6181f7={};_0x6181f7[_0x533450]={'$like':'%'+_0x588aba[_0x7d55('0x47')]['filter']+'%'};return _0x6181f7;})});}_0x38b6f4=_[_0x7d55('0x54')]({},_0x38b6f4,_0x588aba[_0x7d55('0x55')]);return _0x23b75[_0x7d55('0x8e')](_0x38b6f4);}})[_0x7d55('0x38')](function(_0x51042b){if(_0x51042b){_0x2749d1=_0x51042b['length'];if(!_0x588aba['query'][_0x7d55('0x4e')]('nolimit')){_0x38b6f4[_0x7d55('0x32')]=qs[_0x7d55('0x32')](_0x588aba[_0x7d55('0x47')][_0x7d55('0x32')]);_0x38b6f4[_0x7d55('0x30')]=qs['offset'](_0x588aba[_0x7d55('0x47')][_0x7d55('0x30')]);}return _0x23b75[_0x7d55('0x8e')](_0x38b6f4);}})['then'](function(_0x3e5d8a){if(_0x3e5d8a){return _0x3e5d8a?{'count':_0x2749d1,'rows':_0x3e5d8a}:null;}})[_0x7d55('0x38')](respondWithResult(_0x144fce,null))[_0x7d55('0x2c')](handleError(_0x144fce,null));};function Extension(_0x50aa90,_0x42db55,_0x27e21c,_0x3333de){this[_0x7d55('0x8f')]=_0x7d55('0x90');this['exten']=_0x50aa90[_0x7d55('0x91')];this[_0x7d55('0x92')]=_0x3333de;this['type']=_0x7d55('0x93');this[_0x7d55('0x94')]=_0x7d55('0x95');this[_0x7d55('0x69')]=_0x50aa90['id'];this[_0x7d55('0x8b')]=_0x42db55;this[_0x7d55('0x96')]=_0x27e21c;}function createExtensionsReciveFax(_0x2d2957){var _0x1a4b72=0x1;var _0x15edd1=[];_0x15edd1[_0x7d55('0x97')](new Extension(_0x2d2957,_0x1a4b72,'',_0x7d55('0x98')));_0x1a4b72+=0x1;_0x15edd1[_0x7d55('0x97')](new Extension(_0x2d2957,_0x1a4b72,_0x7d55('0x99'),'Set'));_0x1a4b72+=0x1;for(var _0x27261b in _0x2d2957){if(_0x2d2957['hasOwnProperty'](_0x27261b)&&(_0x27261b===_0x7d55('0x9a')||_0x27261b===_0x7d55('0x91')||_0x27261b==='gateway'||_0x27261b==='faxdetect'||_0x27261b===_0x7d55('0x9b')||_0x27261b===_0x7d55('0x9c')||_0x27261b===_0x7d55('0x9d')||_0x27261b==='modem'||_0x27261b===_0x7d55('0x9e'))){_0x15edd1[_0x7d55('0x97')](new Extension(_0x2d2957,_0x1a4b72,'FAXOPT('+_0x27261b+')='+_0x2d2957[_0x27261b],_0x7d55('0x9f')));_0x1a4b72+=0x1;}}_0x15edd1['push'](new Extension(_0x2d2957,_0x1a4b72,'6',_0x7d55('0xa0')));_0x1a4b72+=0x1;_0x15edd1[_0x7d55('0x97')](new Extension(_0x2d2957,_0x1a4b72,_0x7d55('0xa1'),_0x7d55('0xa2')));_0x1a4b72=0x0;return _0x15edd1;}exports[_0x7d55('0xa3')]=function(_0x5342f8,_0x2941b9,_0x5e288f){var _0x1e829b;return db[_0x7d55('0x84')][_0x7d55('0x85')](function(_0x3612f0){return db['FaxAccount'][_0x7d55('0x65')](_0x5342f8[_0x7d55('0x5f')],{'transaction':_0x3612f0})[_0x7d55('0x38')](function(_0x3d13b9){_0x1e829b=_0x3d13b9[_0x7d55('0x39')]({'plain':!![]});return db[_0x7d55('0xa4')][_0x7d55('0x89')](createExtensionsReciveFax(_0x1e829b),{'transaction':_0x3612f0});});})[_0x7d55('0x38')](function(){return _0x1e829b;})[_0x7d55('0x38')](respondWithResult(_0x2941b9,null))[_0x7d55('0x2c')](handleError(_0x2941b9,null));};exports[_0x7d55('0xa5')]=function(_0x57e56c,_0x32e13f,_0x2cc70e){var _0x2b9a35;return db[_0x7d55('0x84')][_0x7d55('0x85')](function(_0x30bb94){return db[_0x7d55('0x41')][_0x7d55('0x36')](_0x57e56c[_0x7d55('0x5f')],{'where':{'id':_0x57e56c[_0x7d55('0x5f')]['id']},'transaction':_0x30bb94})[_0x7d55('0x38')](function(_0x39b661){return db['VoiceExtension'][_0x7d55('0x37')]({'where':{'FaxAccountId':_0x57e56c[_0x7d55('0x5f')]['id']},'transaction':_0x30bb94})[_0x7d55('0x38')](function(_0x1e4557){return db[_0x7d55('0xa4')][_0x7d55('0x89')](createExtensionsReciveFax(_['omit'](_0x57e56c[_0x7d55('0x5f')],[_0x7d55('0xa6'),_0x7d55('0x44'),_0x7d55('0xa7'),_0x7d55('0xa8'),_0x7d55('0xa9'),_0x7d55('0xaa')])),{'transaction':_0x30bb94});});});})[_0x7d55('0x38')](function(){return db[_0x7d55('0x41')][_0x7d55('0xab')](_0x57e56c[_0x7d55('0x5f')]['id']);})['then'](respondWithResult(_0x32e13f,null))[_0x7d55('0x2c')](handleError(_0x32e13f,null));};exports[_0x7d55('0xac')]=function(_0x22d0f0,_0x2c6e2a,_0xf1d80a){var _0x16a030={'raw':!![],'where':{}};var _0x569b30={};var _0x18b246={'count':0x0,'rows':[]};return db[_0x7d55('0x41')][_0x7d55('0x6c')]({'where':{'id':_0x22d0f0[_0x7d55('0x66')]['id']}})[_0x7d55('0x38')](handleEntityNotFound(_0x2c6e2a,null))[_0x7d55('0x38')](function(_0x3602eb){if(_0x3602eb){_0x569b30[_0x7d55('0x45')]=_['keys'](db[_0x7d55('0xad')][_0x7d55('0x5c')]);_0x569b30[_0x7d55('0x47')]=_[_0x7d55('0x48')](_0x22d0f0[_0x7d55('0x47')]);_0x569b30[_0x7d55('0x49')]=_[_0x7d55('0x4a')](_0x569b30[_0x7d55('0x45')],_0x569b30[_0x7d55('0x47')]);_0x16a030[_0x7d55('0x4b')]=_['intersection'](_0x569b30[_0x7d55('0x45')],qs[_0x7d55('0x4c')](_0x22d0f0[_0x7d55('0x47')][_0x7d55('0x4c')]));_0x16a030[_0x7d55('0x4b')]=_0x16a030[_0x7d55('0x4b')][_0x7d55('0x4d')]?_0x16a030[_0x7d55('0x4b')]:_0x569b30[_0x7d55('0x45')];if(!_0x22d0f0[_0x7d55('0x47')][_0x7d55('0x4e')]('nolimit')){_0x16a030[_0x7d55('0x32')]=qs[_0x7d55('0x32')](_0x22d0f0['query'][_0x7d55('0x32')]);_0x16a030[_0x7d55('0x30')]=qs['offset'](_0x22d0f0[_0x7d55('0x47')][_0x7d55('0x30')]);}_0x16a030[_0x7d55('0x6d')]=qs[_0x7d55('0x50')](_0x22d0f0[_0x7d55('0x47')][_0x7d55('0x50')]);_0x16a030[_0x7d55('0x56')]=qs[_0x7d55('0x49')](_['pick'](_0x22d0f0[_0x7d55('0x47')],_0x569b30[_0x7d55('0x49')]));_0x16a030[_0x7d55('0x56')]['FaxAccountId']=_0x3602eb['id'];if(_0x22d0f0['query'][_0x7d55('0x52')]){_0x16a030[_0x7d55('0x56')]=_[_0x7d55('0x54')](_0x16a030[_0x7d55('0x56')],{'$or':_[_0x7d55('0x40')](_0x16a030[_0x7d55('0x4b')],function(_0x29d2cf){var _0x395135={};_0x395135[_0x29d2cf]={'$like':'%'+_0x22d0f0['query'][_0x7d55('0x52')]+'%'};return _0x395135;})});}if(_0x22d0f0[_0x7d55('0x47')][_0x7d55('0xae')]){var _0x36d4f1=_0x22d0f0[_0x7d55('0x47')][_0x7d55('0xae')][_0x7d55('0xaf')](',');var _0x122140={};_0x122140[_0x36d4f1[0x0]]={'$gte':moment(_0x36d4f1[0x1])['format'](_0x7d55('0xb0'))};_0x16a030['where']=_['merge'](_0x16a030[_0x7d55('0x56')],_0x122140);}_0x16a030=_[_0x7d55('0x54')]({},_0x16a030,_0x22d0f0[_0x7d55('0x55')]);return db[_0x7d55('0xad')][_0x7d55('0x57')]({'where':_0x16a030['where']})[_0x7d55('0x38')](function(_0x569b42){_0x18b246['count']=_0x569b42;if(_0x22d0f0['query'][_0x7d55('0x58')]){_0x16a030['include']=[{'all':!![]}];}return db[_0x7d55('0xad')][_0x7d55('0x59')](_0x16a030);})[_0x7d55('0x38')](function(_0x3595fc){_0x18b246[_0x7d55('0x73')]=_0x3595fc;return _0x18b246;});}})[_0x7d55('0x38')](respondWithFilteredResult(_0x2c6e2a,_0x16a030))[_0x7d55('0x2c')](handleError(_0x2c6e2a,null));};exports[_0x7d55('0x3d')]=function(_0x5b088f,_0x3545b6,_0x49baa3){var _0x5d3978,_0x111f70={},_0x410349;if(_0x5b088f['body']['to']){_0x410349=_0x5b088f[_0x7d55('0x5f')]['to'][0x0];}return db['FaxAccount']['find']({'where':{'id':_0x5b088f[_0x7d55('0x66')]['id']},'include':[{'model':db[_0x7d55('0xb1')],'as':_0x7d55('0xb2'),'include':[{'model':db['CmContact'],'as':_0x7d55('0xb3'),'where':{'fax':_0x410349},'limit':0x1,'order':[[_0x7d55('0xa8'),_0x7d55('0xb4')]]}]}]})['then'](handleEntityNotFound(_0x3545b6,null))[_0x7d55('0x38')](function(_0x1313bf){_0x5d3978=_0x1313bf;if(_0x5b088f[_0x7d55('0x5f')]['attachments']&&_0x5b088f[_0x7d55('0x5f')][_0x7d55('0xb5')][_0x7d55('0x4d')]){for(var _0x126431=0x0;_0x126431<_0x5b088f[_0x7d55('0x5f')][_0x7d55('0xb5')][_0x7d55('0x4d')];_0x126431+=0x1){_0x5b088f['body']['attachments'][_0x126431]={'filename':_0x5b088f[_0x7d55('0x5f')]['attachments'][_0x126431]['name'],'id':_0x5b088f[_0x7d55('0x5f')][_0x7d55('0xb5')][_0x126431]['id'],'path':path[_0x7d55('0xb6')](config['root'],_0x7d55('0xb7'),_0x5b088f[_0x7d55('0x5f')][_0x7d55('0xb5')][_0x126431][_0x7d55('0xb8')])};}}return respondWithRpcPromise(_0x7d55('0xb9'),_0x7d55('0xb9'),{'FaxAccountId':_[_0x7d55('0xba')](_0x5b088f[_0x7d55('0x66')]['id'])?undefined:_0x5b088f[_0x7d55('0x66')]['id'],'path':_['isNil'](_0x5b088f[_0x7d55('0x5f')][_0x7d55('0xb5')][0x0][_0x7d55('0xbb')])?undefined:_0x5b088f[_0x7d55('0x5f')][_0x7d55('0xb5')][0x0][_0x7d55('0xbb')],'fax':_[_0x7d55('0xba')](_0x5b088f[_0x7d55('0x5f')]['to'][0x0])?undefined:_0x5b088f[_0x7d55('0x5f')]['to'][0x0]},client9002);})[_0x7d55('0x38')](function(){if(_0x5d3978){if(_[_0x7d55('0xba')](_0x5b088f[_0x7d55('0x5f')]['from'])){_0x5b088f[_0x7d55('0x5f')][_0x7d55('0xbc')]=util[_0x7d55('0xbd')](_0x7d55('0xbe'),_0x5d3978['name'],_0x5d3978[_0x7d55('0xbf')]);}if(_0x5d3978['List']){if(_0x5d3978[_0x7d55('0xb2')][_0x7d55('0xb3')]['length']){return _0x5d3978[_0x7d55('0xb2')]['Contacts'][0x0];}else{return db[_0x7d55('0x79')][_0x7d55('0x65')](_[_0x7d55('0xc0')](_0x5b088f['body'],{'firstName':_0x5b088f['body']['to'][0x0],'phone':_0x5b088f['body']['to'][0x0],'fax':_0x5b088f['body']['to'][0x0],'ListId':_0x5d3978[_0x7d55('0xaa')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x7d55('0xc1'));}})[_0x7d55('0x38')](function(_0x14ad6b){if(_0x14ad6b){return db[_0x7d55('0x76')]['find']({'where':{'ContactId':_0x14ad6b['id'],'closed':![],'FaxAccountId':_0x5d3978['id']}})[_0x7d55('0x38')](function(_0x1eb8f4){if(_0x1eb8f4){return[_0x1eb8f4,![]];}return db['FaxInteraction'][_0x7d55('0x65')]({'UserId':_0x5b088f[_0x7d55('0x62')]['id'],'ContactId':_0x14ad6b['id'],'FaxAccountId':_0x5d3978['id'],'fax':_0x5b088f[_0x7d55('0x5f')]['to'][0x0],'firstMsgDirection':_0x7d55('0xc2'),'Messages':[_['merge'](_0x5b088f[_0x7d55('0x5f')],{'read':![],'body':_0x5b088f[_0x7d55('0x5f')]['attachments'][0x0][_0x7d55('0xc3')],'FaxAccountId':_0x5d3978['id'],'UserId':_0x5b088f[_0x7d55('0x62')]['id'],'ContactId':_0x14ad6b['id'],'AttachmentId':_0x5b088f['body']['attachments'][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x7d55('0xc4')}]})[_0x7d55('0x38')](function(_0x4635ed){return[_0x4635ed,!![]];});});}else{throw new Error(_0x7d55('0xc5'));}})[_0x7d55('0xc6')](function(_0x1f0d6d,_0x5ba6fe){if(_0x5ba6fe){return _0x1f0d6d;}return db[_0x7d55('0xad')]['create']({'direction':_0x7d55('0xc2'),'read':![],'body':_0x5b088f[_0x7d55('0x5f')][_0x7d55('0xb5')][0x0][_0x7d55('0xc3')],'FaxAccountId':_0x5d3978['id'],'FaxInteractionId':_0x1f0d6d['id'],'UserId':_0x5b088f[_0x7d55('0x62')]['id'],'ContactId':_0x1f0d6d[_0x7d55('0xc7')],'AttachmentId':_0x5b088f[_0x7d55('0x5f')]['attachments'][0x0]['id']})[_0x7d55('0x38')](function(_0x408cf1){_0x1f0d6d[_0x7d55('0xc8')]['Messages']=[];_0x1f0d6d['dataValues'][_0x7d55('0xc4')][_0x7d55('0x97')](_0x408cf1[_0x7d55('0xc8')]);return _0x1f0d6d;});})[_0x7d55('0x38')](function(_0x1ee46b){respondWithRpcPromise('SendFax',_0x7d55('0xc9'),{'FaxAccountId':_['isNil'](_0x5b088f[_0x7d55('0x66')]['id'])?undefined:_0x5b088f[_0x7d55('0x66')]['id'],'path':_[_0x7d55('0xba')](_0x5b088f[_0x7d55('0x5f')]['attachments'][0x0][_0x7d55('0xbb')])?undefined:_0x5b088f[_0x7d55('0x5f')][_0x7d55('0xb5')][0x0][_0x7d55('0xbb')],'fax':_[_0x7d55('0xba')](_0x5b088f[_0x7d55('0x5f')]['to'][0x0])?undefined:_0x5b088f[_0x7d55('0x5f')]['to'][0x0],'AttachmentId':_0x5b088f[_0x7d55('0x5f')][_0x7d55('0xb5')][0x0]['id']},client9002)[_0x7d55('0x38')](function(_0x2f1125){logger['info'](_0x7d55('0xca'),_0x2f1125);})[_0x7d55('0x2c')](function(_0x3646a9){logger['info']('SendFaxRpc,\x20%s',_0x3646a9);});return _0x1ee46b;})[_0x7d55('0x38')](respondWithResult(_0x3545b6,null))[_0x7d55('0x2c')](handleError(_0x3545b6,null));};exports[_0x7d55('0xcb')]=function(_0x1079a3,_0x180a70,_0xb19dbc){return db[_0x7d55('0x41')][_0x7d55('0x5e')]({'where':{'id':_0x1079a3['params']['id']}})[_0x7d55('0x38')](handleEntityNotFound(_0x180a70,null))[_0x7d55('0x38')](function(_0x1896e3){if(_0x1896e3){return _0x1896e3[_0x7d55('0xcb')](_0x1079a3[_0x7d55('0x5f')][_0x7d55('0x6f')],_[_0x7d55('0x77')](_0x1079a3[_0x7d55('0x5f')],['ids','id'])||{})[_0x7d55('0xc6')](function(_0x432de1){for(var _0x1f2fe3=0x0;_0x1f2fe3<_0x1079a3[_0x7d55('0x5f')][_0x7d55('0x6f')][_0x7d55('0x4d')];_0x1f2fe3+=0x1){socket[_0x7d55('0xcc')](_0x7d55('0xcd'),{'UserId':Number(_0x1079a3[_0x7d55('0x5f')][_0x7d55('0x6f')][_0x1f2fe3]),'FaxAccountId':Number(_0x1079a3['params']['id'])});}return _0x432de1;});}})[_0x7d55('0x38')](respondWithResult(_0x180a70,null))[_0x7d55('0x2c')](handleError(_0x180a70,null));};exports['removeAgents']=function(_0x368296,_0x17a76f,_0x1ae9ae){return db[_0x7d55('0x41')][_0x7d55('0x5e')]({'where':{'id':_0x368296[_0x7d55('0x66')]['id']}})[_0x7d55('0x38')](handleEntityNotFound(_0x17a76f,null))[_0x7d55('0x38')](function(_0x499dee){if(_0x499dee){return _0x499dee[_0x7d55('0xce')](_0x368296[_0x7d55('0x47')][_0x7d55('0x6f')])[_0x7d55('0x38')](function(){if(_[_0x7d55('0xcf')](_0x368296[_0x7d55('0x47')][_0x7d55('0x6f')])){for(var _0x339122=0x0;_0x339122<_0x368296[_0x7d55('0x47')][_0x7d55('0x6f')][_0x7d55('0x4d')];_0x339122+=0x1){socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x368296[_0x7d55('0x47')][_0x7d55('0x6f')][_0x339122]),'FaxAccountId':Number(_0x368296[_0x7d55('0x66')]['id'])});}}else{socket[_0x7d55('0xcc')](_0x7d55('0xd0'),{'UserId':Number(_0x368296[_0x7d55('0x47')]['ids']),'FaxAccountId':Number(_0x368296[_0x7d55('0x66')]['id'])});}});}})['then'](respondWithStatusCode(_0x17a76f,null))['catch'](handleError(_0x17a76f,null));};exports[_0x7d55('0xd1')]=function(_0x7c0602,_0xa79976,_0x11111c){var _0x309dbe={};var _0x3c32c8={};var _0x51f480;var _0x2c744b;return db[_0x7d55('0x41')][_0x7d55('0x6c')]({'where':{'id':_0x7c0602['params']['id']}})['then'](handleEntityNotFound(_0xa79976,null))[_0x7d55('0x38')](function(_0x43823b){if(_0x43823b){_0x51f480=_0x43823b;_0x3c32c8[_0x7d55('0x45')]=_[_0x7d55('0x48')](db[_0x7d55('0x7b')][_0x7d55('0x5c')]);_0x3c32c8[_0x7d55('0x47')]=_[_0x7d55('0x48')](_0x7c0602[_0x7d55('0x47')]);_0x3c32c8['filters']=_[_0x7d55('0x4a')](_0x3c32c8[_0x7d55('0x45')],_0x3c32c8[_0x7d55('0x47')]);_0x309dbe[_0x7d55('0x4b')]=_[_0x7d55('0x4a')](_0x3c32c8['model'],qs['fields'](_0x7c0602['query']['fields']));_0x309dbe[_0x7d55('0x4b')]=_0x309dbe['attributes'][_0x7d55('0x4d')]?_0x309dbe['attributes']:_0x3c32c8[_0x7d55('0x45')];_0x309dbe[_0x7d55('0x6d')]=qs[_0x7d55('0x50')](_0x7c0602[_0x7d55('0x47')]['sort']);_0x309dbe['where']=qs[_0x7d55('0x49')](_[_0x7d55('0x51')](_0x7c0602['query'],_0x3c32c8[_0x7d55('0x49')]));if(_0x7c0602[_0x7d55('0x47')][_0x7d55('0x52')]){_0x309dbe['where']=_[_0x7d55('0x54')](_0x309dbe[_0x7d55('0x56')],{'$or':_[_0x7d55('0x40')](_0x309dbe[_0x7d55('0x4b')],function(_0x56e812){var _0x31f691={};_0x31f691[_0x56e812]={'$like':'%'+_0x7c0602[_0x7d55('0x47')]['filter']+'%'};return _0x31f691;})});}_0x309dbe=_[_0x7d55('0x54')]({},_0x309dbe,_0x7c0602['options']);return _0x51f480[_0x7d55('0xd1')](_0x309dbe);}})[_0x7d55('0x38')](function(_0x9a123c){if(_0x9a123c){_0x2c744b=_0x9a123c[_0x7d55('0x4d')];if(!_0x7c0602['query']['hasOwnProperty']('nolimit')){_0x309dbe[_0x7d55('0x32')]=qs[_0x7d55('0x32')](_0x7c0602[_0x7d55('0x47')][_0x7d55('0x32')]);_0x309dbe['offset']=qs[_0x7d55('0x30')](_0x7c0602[_0x7d55('0x47')]['offset']);}return _0x51f480[_0x7d55('0xd1')](_0x309dbe);}})[_0x7d55('0x38')](function(_0x532836){if(_0x532836){return _0x532836?{'count':_0x2c744b,'rows':_0x532836}:null;}})[_0x7d55('0x38')](respondWithResult(_0xa79976,null))[_0x7d55('0x2c')](handleError(_0xa79976,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index f8a3521..0f89f9b 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 _0x7dde=['../../mysqldb','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x42e0b1,_0xad3dac){var _0x3805cf=function(_0x42883a){while(--_0x42883a){_0x42e0b1['push'](_0x42e0b1['shift']());}};_0x3805cf(++_0xad3dac);}(_0x7dde,0x11f));var _0xe7dd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7dde[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0xe7dd('0x0'));var FaxAccount=require(_0xe7dd('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe7dd('0x2'),'afterUpdate':_0xe7dd('0x3'),'afterDestroy':_0xe7dd('0x4')};function emitEvent(_0x2a8c65){return function(_0x312039,_0x52aaf2,_0x556afb){FaxAccountEvents[_0xe7dd('0x5')](_0x2a8c65+':'+_0x312039['id'],_0x312039);FaxAccountEvents[_0xe7dd('0x5')](_0x2a8c65,_0x312039);_0x556afb(null);};}for(var e in events){if(events[_0xe7dd('0x6')](e)){var event=events[e];FaxAccount[_0xe7dd('0x7')](e,emitEvent(event));}}module[_0xe7dd('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0xdf69=['emit','hasOwnProperty','hook','FaxAccount','setMaxListeners','save','update','remove'];(function(_0x1c5101,_0x149b6c){var _0x168f24=function(_0x497787){while(--_0x497787){_0x1c5101['push'](_0x1c5101['shift']());}};_0x168f24(++_0x149b6c);}(_0xdf69,0x1bb));var _0x9df6=function(_0x4e62eb,_0x6877c6){_0x4e62eb=_0x4e62eb-0x0;var _0x4298ba=_0xdf69[_0x4e62eb];return _0x4298ba;};'use strict';var EventEmitter=require('events');var FaxAccount=require('../../mysqldb')['db'][_0x9df6('0x0')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x9df6('0x1')](0x0);var events={'afterCreate':_0x9df6('0x2'),'afterUpdate':_0x9df6('0x3'),'afterDestroy':_0x9df6('0x4')};function emitEvent(_0x49394b){return function(_0x3e000e,_0x4c4ac0,_0x3ee9b8){FaxAccountEvents[_0x9df6('0x5')](_0x49394b+':'+_0x3e000e['id'],_0x3e000e);FaxAccountEvents[_0x9df6('0x5')](_0x49394b,_0x3e000e);_0x3ee9b8(null);};}for(var e in events){if(events[_0x9df6('0x6')](e)){var event=events[e];FaxAccount[_0x9df6('0x7')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 8d8ff9e..b32a9e4 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 _0x8588=['FaxAccount','fax_accounts','util','../../config/logger','api','moment','bluebird','path','rimraf','./faxAccount.attributes','exports','define'];(function(_0x37afbc,_0x30e5a4){var _0x57556c=function(_0x2e9bfb){while(--_0x2e9bfb){_0x37afbc['push'](_0x37afbc['shift']());}};_0x57556c(++_0x30e5a4);}(_0x8588,0x12e));var _0x8858=function(_0x29baaf,_0x273412){_0x29baaf=_0x29baaf-0x0;var _0x184fe2=_0x8588[_0x29baaf];return _0x184fe2;};'use strict';var _=require('lodash');var util=require(_0x8858('0x0'));var logger=require(_0x8858('0x1'))(_0x8858('0x2'));var moment=require(_0x8858('0x3'));var BPromise=require(_0x8858('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8858('0x5'));var rimraf=require(_0x8858('0x6'));var config=require('../../config/environment');var attributes=require(_0x8858('0x7'));module[_0x8858('0x8')]=function(_0x156250,_0x5720a9){return _0x156250[_0x8858('0x9')](_0x8858('0xa'),attributes,{'tableName':_0x8858('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f35=['exports','define','fax_accounts','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3be0c4,_0x5b7eff){var _0x11af9f=function(_0x3f5113){while(--_0x3f5113){_0x3be0c4['push'](_0x3be0c4['shift']());}};_0x11af9f(++_0x5b7eff);}(_0x7f35,0x1e3));var _0x57f3=function(_0x452ac8,_0x382b4c){_0x452ac8=_0x452ac8-0x0;var _0x16b3df=_0x7f35[_0x452ac8];return _0x16b3df;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x57f3('0x0'));var BPromise=require(_0x57f3('0x1'));var rp=require(_0x57f3('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x57f3('0x3'));var config=require(_0x57f3('0x4'));var attributes=require('./faxAccount.attributes');module[_0x57f3('0x5')]=function(_0x2c8583,_0x247925){return _0x2c8583[_0x57f3('0x6')]('FaxAccount',attributes,{'tableName':_0x57f3('0x7'),'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 0cd7322..0d248ee 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 _0xd56b=['FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','FaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetFaxAccount','NotifyFaxAccount','body','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','keys','createdAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmContact','Contacts','DESC','FaxApplication','applications','list','priority','asc','Applications','List','defaults','create','contact','fax','find','FaxInteraction','autoclose','push','length','unmanaged','*,*,*,*','created','ContactId','AttachmentId','interaction','UserId','User','name','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info'];(function(_0x18df32,_0x482361){var _0x1de5f1=function(_0x20d742){while(--_0x20d742){_0x18df32['push'](_0x18df32['shift']());}};_0x1de5f1(++_0x482361);}(_0xd56b,0xa2));var _0xbd56=function(_0x5e435d,_0x12da69){_0x5e435d=_0x5e435d-0x0;var _0x6c15e2=_0xd56b[_0x5e435d];return _0x6c15e2;};'use strict';var _=require(_0xbd56('0x0'));var util=require(_0xbd56('0x1'));var moment=require(_0xbd56('0x2'));var BPromise=require(_0xbd56('0x3'));var rs=require(_0xbd56('0x4'));var fs=require('fs');var Redis=require(_0xbd56('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbd56('0x6'));var logger=require(_0xbd56('0x7'))(_0xbd56('0x8'));var config=require(_0xbd56('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xbd56('0xa')][_0xbd56('0xb')]({'port':0x232c});config['redis']=_['defaults'](config[_0xbd56('0xc')],{'host':_0xbd56('0xd'),'port':0x18eb});var socket=require(_0xbd56('0xe'))(new Redis(config[_0xbd56('0xc')]));require(_0xbd56('0xf'))[_0xbd56('0x10')](socket);function respondWithRpcPromise(_0x3fb0a2,_0x325c5d,_0xaeb331){return new BPromise(function(_0x1ef9d2,_0x194931){return client[_0xbd56('0x11')](_0x3fb0a2,_0xaeb331)[_0xbd56('0x12')](function(_0x37511f){logger[_0xbd56('0x13')](_0xbd56('0x14'),_0x325c5d,_0xbd56('0x15'));logger[_0xbd56('0x16')](_0xbd56('0x17'),_0x325c5d,_0xbd56('0x15'),JSON[_0xbd56('0x18')](_0x37511f));if(_0x37511f[_0xbd56('0x19')]){if(_0x37511f['error'][_0xbd56('0x1a')]===0x1f4){logger[_0xbd56('0x19')](_0xbd56('0x14'),_0x325c5d,_0x37511f['error'][_0xbd56('0x1b')]);return _0x194931(_0x37511f[_0xbd56('0x19')]['message']);}logger[_0xbd56('0x19')](_0xbd56('0x14'),_0x325c5d,_0x37511f[_0xbd56('0x19')][_0xbd56('0x1b')]);return _0x1ef9d2(_0x37511f[_0xbd56('0x19')]['message']);}else{logger[_0xbd56('0x13')](_0xbd56('0x14'),_0x325c5d,_0xbd56('0x15'));_0x1ef9d2(_0x37511f['result']['message']);}})[_0xbd56('0x1c')](function(_0x426a15){logger[_0xbd56('0x19')](_0xbd56('0x14'),_0x325c5d,_0x426a15);_0x194931(_0x426a15);});});}exports['GetFaxAccount']=function(_0x51f337){var _0x21dbb8=this;return new Promise(function(_0x3ad87d,_0x2af60d){return db[_0xbd56('0x1d')][_0xbd56('0x1e')]({'raw':_0x51f337[_0xbd56('0x1f')]?_0x51f337[_0xbd56('0x1f')][_0xbd56('0x20')]===undefined?!![]:![]:!![],'where':_0x51f337['options']?_0x51f337[_0xbd56('0x1f')][_0xbd56('0x21')]||null:null,'attributes':_0x51f337[_0xbd56('0x1f')]?_0x51f337[_0xbd56('0x1f')][_0xbd56('0x22')]||null:null,'limit':_0x51f337[_0xbd56('0x1f')]?_0x51f337[_0xbd56('0x1f')][_0xbd56('0x23')]||null:null,'include':_0x51f337[_0xbd56('0x1f')]?_0x51f337[_0xbd56('0x1f')][_0xbd56('0x24')]?_[_0xbd56('0x25')](_0x51f337['options'][_0xbd56('0x24')],function(_0x2186a9){return{'model':db[_0x2186a9['model']],'as':_0x2186a9['as'],'attributes':_0x2186a9[_0xbd56('0x22')],'include':_0x2186a9[_0xbd56('0x24')]?_[_0xbd56('0x25')](_0x2186a9[_0xbd56('0x24')],function(_0x974d69){return{'model':db[_0x974d69['model']],'as':_0x974d69['as'],'attributes':_0x974d69[_0xbd56('0x22')],'include':_0x974d69[_0xbd56('0x24')]?_[_0xbd56('0x25')](_0x974d69[_0xbd56('0x24')],function(_0x2d56c3){return{'model':db[_0x2d56c3[_0xbd56('0x26')]],'as':_0x2d56c3['as'],'attributes':_0x2d56c3['attributes']};}):[]};}):[]};}):[]:[]})[_0xbd56('0x12')](function(_0x3b4079){logger[_0xbd56('0x13')](_0xbd56('0x27'),_0x51f337);logger[_0xbd56('0x16')](_0xbd56('0x27'),_0x51f337,JSON[_0xbd56('0x18')](_0x3b4079));_0x3ad87d(_0x3b4079);})[_0xbd56('0x1c')](function(_0x1e66e0){logger[_0xbd56('0x19')](_0xbd56('0x27'),_0x1e66e0['message'],_0x51f337);_0x2af60d(_0x21dbb8[_0xbd56('0x19')](0x1f4,_0x1e66e0[_0xbd56('0x1b')]));});});};exports[_0xbd56('0x28')]=function(_0x1561ca,_0x1fadc3,_0x469e64){var _0x46752d=this;return new Promise(function(_0x1a117e,_0x1d5f5e){var _0x4c186e={'body':_0x1561ca[_0xbd56('0x29')],'channel':'fax'};var _0xeaf742=[];var _0x393164=[];var _0x3ab79d={};return db['CmContact'][_0xbd56('0x2a')]()[_0xbd56('0x12')](function(_0x4d0ada){if(!_0x4d0ada){throw new db[(_0xbd56('0x2b'))][(_0xbd56('0x2c'))](_0xbd56('0x2d'));}_0xeaf742=_[_0xbd56('0x2e')](_['keys'](_0x4d0ada),['createdAt',_0xbd56('0x2f')]);_0x393164=_[_0xbd56('0x2e')](_[_0xbd56('0x30')](_0x4d0ada),[_0xbd56('0x31'),'updatedAt',_0xbd56('0x32'),_0xbd56('0x33')]);if(_0x1561ca[_0xbd56('0x29')]['id']){delete _0x1561ca[_0xbd56('0x29')]['id'];}if(_[_0xbd56('0x34')](_0x1561ca[_0xbd56('0x29')][_0xbd56('0x35')])){throw new db['Sequelize']['ValidationError'](_0xbd56('0x36'));}if(_[_0xbd56('0x34')](_0x1561ca[_0xbd56('0x29')]['body'])||_0x1561ca[_0xbd56('0x29')][_0xbd56('0x29')]===''){throw new db['Sequelize'][(_0xbd56('0x2c'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xbd56('0x34')](_0x1561ca['body'][_0xbd56('0x37')])){throw new db['Sequelize'][(_0xbd56('0x2c'))](_0xbd56('0x38')+_0x393164);}if(!_['includes'](_0x393164,_0x1561ca[_0xbd56('0x29')][_0xbd56('0x37')])){throw new db[(_0xbd56('0x2b'))][(_0xbd56('0x2c'))](_0xbd56('0x39')+_0x393164);}_0x3ab79d[_0x1561ca[_0xbd56('0x29')][_0xbd56('0x37')]]=_0x1561ca['body'][_0xbd56('0x35')];})[_0xbd56('0x12')](function(){return db['FaxAccount']['find']({'where':{'id':_0x1561ca[_0xbd56('0x3a')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xbd56('0x3b')],'as':_0xbd56('0x3c'),'where':_0x3ab79d,'limit':0x1,'order':[['updatedAt',_0xbd56('0x3d')]]}]},{'model':db[_0xbd56('0x3e')],'as':'Applications'}]});})[_0xbd56('0x12')](function(_0x8736a6){if(_0x8736a6&&_0x8736a6['List']){var _0x588c22=_0x8736a6['get']({'plain':!![]});_0x4c186e[_0xbd56('0x3a')]=_0x588c22;_0x4c186e[_0xbd56('0x3f')]=_0x588c22['Applications'];_0x4c186e[_0xbd56('0x40')]=_0x588c22['List'];_0x4c186e[_0xbd56('0x3f')]=_['orderBy'](_0x4c186e[_0xbd56('0x3f')],[_0xbd56('0x41')],[_0xbd56('0x42')]);if(_0x4c186e[_0xbd56('0x3a')]['Applications']){delete _0x4c186e[_0xbd56('0x3a')][_0xbd56('0x43')];}if(_0x4c186e[_0xbd56('0x3a')]['List']&&_0x4c186e[_0xbd56('0x3a')][_0xbd56('0x44')][_0xbd56('0x3c')]['length']){return _0x4c186e['account'][_0xbd56('0x44')]['Contacts'][0x0];}var _0x526741=_[_0xbd56('0x45')](_0x1561ca[_0xbd56('0x29')],{'firstName':_0x1561ca[_0xbd56('0x29')][_0xbd56('0x35')],'ListId':_0x588c22[_0xbd56('0x33')]});_0x526741[_0x1561ca[_0xbd56('0x29')][_0xbd56('0x37')]]=_0x1561ca[_0xbd56('0x29')]['from'];return db[_0xbd56('0x3b')][_0xbd56('0x46')](_0x526741,{'fields':_0xeaf742,'raw':!![]});}})[_0xbd56('0x12')](function(_0x4c4bc4){_0x4c186e[_0xbd56('0x47')]=_0x4c4bc4;if(_0x4c4bc4){var _0x1c000a={'ContactId':_0x4c4bc4['id'],'FaxAccountId':_0x1561ca['account']['id'],'fax':_0x4c4bc4[_0xbd56('0x48')]};return db['FaxInteraction'][_0xbd56('0x49')]({'where':{'ContactId':_0x4c4bc4['id'],'closed':![],'FaxAccountId':_0x1561ca['account']['id']}})[_0xbd56('0x12')](function(_0x58c58c){if(_0x58c58c){return[_0x58c58c,![]];}return db[_0xbd56('0x4a')][_0xbd56('0x46')](_0x1c000a)[_0xbd56('0x12')](function(_0x50be16){return[_0x50be16,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x5b873e,_0x303abf){var _0x3aa42a=_0x5b873e['get']({'plain':!![]});if(_0x303abf){if(_0x4c186e['account'][_0xbd56('0x4b')]){_0x4c186e['applications'][_0xbd56('0x4c')]({'id':0x0,'priority':_0x4c186e[_0xbd56('0x3f')][_0xbd56('0x4d')]+0x1,'app':'close','appdata':_0xbd56('0x4e'),'interval':_0xbd56('0x4f')});}_0x3aa42a[_0xbd56('0x50')]=!![];}else{_0x3aa42a[_0xbd56('0x50')]=![];}_0x4c186e['interaction']=_0x3aa42a;return db['FaxMessage'][_0xbd56('0x46')]({'body':_0x1561ca['body'][_0xbd56('0x29')],'FaxAccountId':_0x1561ca[_0xbd56('0x3a')]['id'],'FaxInteractionId':_0x5b873e['id'],'direction':'in','ContactId':_0x5b873e[_0xbd56('0x51')],'AttachmentId':_0x1561ca['body'][_0xbd56('0x52')]});})[_0xbd56('0x12')](function(_0x513d5f){_0x4c186e[_0xbd56('0x1b')]=_0x513d5f;if(_0x4c186e[_0xbd56('0x53')][_0xbd56('0x54')]){return db[_0xbd56('0x55')][_0xbd56('0x49')]({'attributes':['id',_0xbd56('0x56')],'where':{'id':_0x4c186e[_0xbd56('0x53')]['UserId']}})[_0xbd56('0x12')](function(_0x1380b2){if(_0x1380b2){_0x4c186e[_0xbd56('0x3f')]['unshift']({'id':0x0,'priority':0x0,'app':_0xbd56('0x57'),'appdata':_0x1380b2[_0xbd56('0x56')]+','+(_0x4c186e['account'][_0xbd56('0x58')]||0xa),'interval':_0xbd56('0x4f')});}return respondWithRpcPromise(_0xbd56('0x59'),_0xbd56('0x5a'),_0x4c186e);});}return respondWithRpcPromise('Start',_0xbd56('0x5a'),_0x4c186e);})[_0xbd56('0x12')](function(_0x14c55c){_0x1a117e(_0x14c55c);})[_0xbd56('0x1c')](function(_0x430f30){_0x1d5f5e(_0x46752d[_0xbd56('0x19')](0x1f4,_0x430f30['message']));});});}; \ No newline at end of file +var _0xf3b7=['UserId','User','name','unshift','*,*,*,*','startRouting','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','socket.io-emitter','redis','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','code','error','message','result','GetFaxAccount','FaxAccount','findAll','options','where','attributes','limit','include','map','model','stringify','NotifyFaxAccount','body','fax','describe','Sequelize','ValidationError','difference','keys','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','CmContact','DESC','FaxApplication','get','applications','Applications','orderBy','priority','Contacts','create','FaxInteraction','Contact\x20not\x20found','spread','push','length','unmanaged','created','FaxMessage','ContactId','interaction'];(function(_0x12d42e,_0x531ae8){var _0x287713=function(_0x14c52e){while(--_0x14c52e){_0x12d42e['push'](_0x12d42e['shift']());}};_0x287713(++_0x531ae8);}(_0xf3b7,0xb9));var _0x7f3b=function(_0x1aeefe,_0xea1c97){_0x1aeefe=_0x1aeefe-0x0;var _0x8bdc8c=_0xf3b7[_0x1aeefe];return _0x8bdc8c;};'use strict';var _=require(_0x7f3b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7f3b('0x1'));var rs=require(_0x7f3b('0x2'));var fs=require('fs');var Redis=require(_0x7f3b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7f3b('0x4'));var logger=require(_0x7f3b('0x5'))(_0x7f3b('0x6'));var config=require(_0x7f3b('0x7'));var jayson=require(_0x7f3b('0x8'));var client=jayson[_0x7f3b('0x9')][_0x7f3b('0xa')]({'port':0x232c});config['redis']=_[_0x7f3b('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7f3b('0xc'))(new Redis(config[_0x7f3b('0xd')]));require(_0x7f3b('0xe'))[_0x7f3b('0xf')](socket);function respondWithRpcPromise(_0x4abb1b,_0x5f09b1,_0x33e46a){return new BPromise(function(_0x2ea244,_0x4e6833){return client[_0x7f3b('0x10')](_0x4abb1b,_0x33e46a)[_0x7f3b('0x11')](function(_0x6662c8){logger[_0x7f3b('0x12')](_0x7f3b('0x13'),_0x5f09b1,_0x7f3b('0x14'));logger[_0x7f3b('0x15')](_0x7f3b('0x16'),_0x5f09b1,_0x7f3b('0x14'),JSON['stringify'](_0x6662c8));if(_0x6662c8['error']){if(_0x6662c8['error'][_0x7f3b('0x17')]===0x1f4){logger[_0x7f3b('0x18')](_0x7f3b('0x13'),_0x5f09b1,_0x6662c8[_0x7f3b('0x18')][_0x7f3b('0x19')]);return _0x4e6833(_0x6662c8['error'][_0x7f3b('0x19')]);}logger[_0x7f3b('0x18')](_0x7f3b('0x13'),_0x5f09b1,_0x6662c8[_0x7f3b('0x18')][_0x7f3b('0x19')]);return _0x2ea244(_0x6662c8['error'][_0x7f3b('0x19')]);}else{logger['info'](_0x7f3b('0x13'),_0x5f09b1,'request\x20sent');_0x2ea244(_0x6662c8[_0x7f3b('0x1a')][_0x7f3b('0x19')]);}})['catch'](function(_0xa8ab3b){logger[_0x7f3b('0x18')](_0x7f3b('0x13'),_0x5f09b1,_0xa8ab3b);_0x4e6833(_0xa8ab3b);});});}exports[_0x7f3b('0x1b')]=function(_0x11cda9){var _0x287f9b=this;return new Promise(function(_0x140a08,_0x395fa1){return db[_0x7f3b('0x1c')][_0x7f3b('0x1d')]({'raw':_0x11cda9[_0x7f3b('0x1e')]?_0x11cda9[_0x7f3b('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x11cda9[_0x7f3b('0x1e')]?_0x11cda9['options'][_0x7f3b('0x1f')]||null:null,'attributes':_0x11cda9['options']?_0x11cda9[_0x7f3b('0x1e')][_0x7f3b('0x20')]||null:null,'limit':_0x11cda9[_0x7f3b('0x1e')]?_0x11cda9['options'][_0x7f3b('0x21')]||null:null,'include':_0x11cda9[_0x7f3b('0x1e')]?_0x11cda9[_0x7f3b('0x1e')][_0x7f3b('0x22')]?_[_0x7f3b('0x23')](_0x11cda9[_0x7f3b('0x1e')][_0x7f3b('0x22')],function(_0x30478d){return{'model':db[_0x30478d['model']],'as':_0x30478d['as'],'attributes':_0x30478d['attributes'],'include':_0x30478d[_0x7f3b('0x22')]?_[_0x7f3b('0x23')](_0x30478d['include'],function(_0x4185e3){return{'model':db[_0x4185e3[_0x7f3b('0x24')]],'as':_0x4185e3['as'],'attributes':_0x4185e3[_0x7f3b('0x20')],'include':_0x4185e3[_0x7f3b('0x22')]?_[_0x7f3b('0x23')](_0x4185e3[_0x7f3b('0x22')],function(_0x4e67a6){return{'model':db[_0x4e67a6[_0x7f3b('0x24')]],'as':_0x4e67a6['as'],'attributes':_0x4e67a6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d7fdd){logger[_0x7f3b('0x12')]('GetFaxAccount',_0x11cda9);logger[_0x7f3b('0x15')](_0x7f3b('0x1b'),_0x11cda9,JSON[_0x7f3b('0x25')](_0x1d7fdd));_0x140a08(_0x1d7fdd);})['catch'](function(_0x41dd80){logger[_0x7f3b('0x18')](_0x7f3b('0x1b'),_0x41dd80[_0x7f3b('0x19')],_0x11cda9);_0x395fa1(_0x287f9b['error'](0x1f4,_0x41dd80[_0x7f3b('0x19')]));});});};exports[_0x7f3b('0x26')]=function(_0x193787,_0x599eff,_0x3379c7){var _0x395a01=this;return new Promise(function(_0x246323,_0x9f5c2a){var _0x5dd3d6={'body':_0x193787[_0x7f3b('0x27')],'channel':_0x7f3b('0x28')};var _0x303820=[];var _0x491cc1=[];var _0x5edfb2={};return db['CmContact'][_0x7f3b('0x29')]()['then'](function(_0x17a2eb){if(!_0x17a2eb){throw new db[(_0x7f3b('0x2a'))][(_0x7f3b('0x2b'))]('no\x20available\x20attributes');}_0x303820=_[_0x7f3b('0x2c')](_[_0x7f3b('0x2d')](_0x17a2eb),[_0x7f3b('0x2e'),_0x7f3b('0x2f')]);_0x491cc1=_[_0x7f3b('0x2c')](_[_0x7f3b('0x2d')](_0x17a2eb),[_0x7f3b('0x2e'),_0x7f3b('0x2f'),_0x7f3b('0x30'),_0x7f3b('0x31')]);if(_0x193787[_0x7f3b('0x27')]['id']){delete _0x193787[_0x7f3b('0x27')]['id'];}if(_['isNil'](_0x193787[_0x7f3b('0x27')][_0x7f3b('0x32')])){throw new db[(_0x7f3b('0x2a'))]['ValidationError'](_0x7f3b('0x33'));}if(_[_0x7f3b('0x34')](_0x193787[_0x7f3b('0x27')]['body'])||_0x193787['body'][_0x7f3b('0x27')]===''){throw new db[(_0x7f3b('0x2a'))]['ValidationError'](_0x7f3b('0x35'));}if(_[_0x7f3b('0x34')](_0x193787['body']['mapKey'])){throw new db[(_0x7f3b('0x2a'))][(_0x7f3b('0x2b'))](_0x7f3b('0x36')+_0x491cc1);}if(!_[_0x7f3b('0x37')](_0x491cc1,_0x193787['body'][_0x7f3b('0x38')])){throw new db[(_0x7f3b('0x2a'))][(_0x7f3b('0x2b'))](_0x7f3b('0x39')+_0x491cc1);}_0x5edfb2[_0x193787[_0x7f3b('0x27')][_0x7f3b('0x38')]]=_0x193787[_0x7f3b('0x27')][_0x7f3b('0x32')];})['then'](function(){return db['FaxAccount'][_0x7f3b('0x3a')]({'where':{'id':_0x193787[_0x7f3b('0x3b')]['id']},'include':[{'model':db[_0x7f3b('0x3c')],'as':_0x7f3b('0x3d'),'include':[{'model':db[_0x7f3b('0x3e')],'as':'Contacts','where':_0x5edfb2,'limit':0x1,'order':[[_0x7f3b('0x2f'),_0x7f3b('0x3f')]]}]},{'model':db[_0x7f3b('0x40')],'as':'Applications'}]});})[_0x7f3b('0x11')](function(_0x3d0ff7){if(_0x3d0ff7&&_0x3d0ff7['List']){var _0x39226c=_0x3d0ff7[_0x7f3b('0x41')]({'plain':!![]});_0x5dd3d6[_0x7f3b('0x3b')]=_0x39226c;_0x5dd3d6[_0x7f3b('0x42')]=_0x39226c[_0x7f3b('0x43')];_0x5dd3d6['list']=_0x39226c[_0x7f3b('0x3d')];_0x5dd3d6[_0x7f3b('0x42')]=_[_0x7f3b('0x44')](_0x5dd3d6['applications'],[_0x7f3b('0x45')],['asc']);if(_0x5dd3d6[_0x7f3b('0x3b')][_0x7f3b('0x43')]){delete _0x5dd3d6[_0x7f3b('0x3b')]['Applications'];}if(_0x5dd3d6[_0x7f3b('0x3b')]['List']&&_0x5dd3d6[_0x7f3b('0x3b')][_0x7f3b('0x3d')][_0x7f3b('0x46')]['length']){return _0x5dd3d6[_0x7f3b('0x3b')][_0x7f3b('0x3d')][_0x7f3b('0x46')][0x0];}var _0x5e1fdf=_[_0x7f3b('0xb')](_0x193787['body'],{'firstName':_0x193787['body'][_0x7f3b('0x32')],'ListId':_0x39226c['ListId']});_0x5e1fdf[_0x193787[_0x7f3b('0x27')][_0x7f3b('0x38')]]=_0x193787[_0x7f3b('0x27')][_0x7f3b('0x32')];return db[_0x7f3b('0x3e')][_0x7f3b('0x47')](_0x5e1fdf,{'fields':_0x303820,'raw':!![]});}})[_0x7f3b('0x11')](function(_0x1eabd4){_0x5dd3d6['contact']=_0x1eabd4;if(_0x1eabd4){var _0x5ce318={'ContactId':_0x1eabd4['id'],'FaxAccountId':_0x193787['account']['id'],'fax':_0x1eabd4[_0x7f3b('0x28')]};return db['FaxInteraction'][_0x7f3b('0x3a')]({'where':{'ContactId':_0x1eabd4['id'],'closed':![],'FaxAccountId':_0x193787[_0x7f3b('0x3b')]['id']}})[_0x7f3b('0x11')](function(_0x16bdbe){if(_0x16bdbe){return[_0x16bdbe,![]];}return db[_0x7f3b('0x48')][_0x7f3b('0x47')](_0x5ce318)[_0x7f3b('0x11')](function(_0x1eb8e7){return[_0x1eb8e7,!![]];});});}else{throw new Error(_0x7f3b('0x49'));}})[_0x7f3b('0x4a')](function(_0x5d535c,_0x6ff9d0){var _0x46321b=_0x5d535c[_0x7f3b('0x41')]({'plain':!![]});if(_0x6ff9d0){if(_0x5dd3d6[_0x7f3b('0x3b')]['autoclose']){_0x5dd3d6[_0x7f3b('0x42')][_0x7f3b('0x4b')]({'id':0x0,'priority':_0x5dd3d6['applications'][_0x7f3b('0x4c')]+0x1,'app':'close','appdata':_0x7f3b('0x4d'),'interval':'*,*,*,*'});}_0x46321b[_0x7f3b('0x4e')]=!![];}else{_0x46321b['created']=![];}_0x5dd3d6['interaction']=_0x46321b;return db[_0x7f3b('0x4f')][_0x7f3b('0x47')]({'body':_0x193787[_0x7f3b('0x27')][_0x7f3b('0x27')],'FaxAccountId':_0x193787['account']['id'],'FaxInteractionId':_0x5d535c['id'],'direction':'in','ContactId':_0x5d535c[_0x7f3b('0x50')],'AttachmentId':_0x193787[_0x7f3b('0x27')]['AttachmentId']});})[_0x7f3b('0x11')](function(_0x51839c){_0x5dd3d6[_0x7f3b('0x19')]=_0x51839c;if(_0x5dd3d6[_0x7f3b('0x51')][_0x7f3b('0x52')]){return db[_0x7f3b('0x53')]['find']({'attributes':['id',_0x7f3b('0x54')],'where':{'id':_0x5dd3d6[_0x7f3b('0x51')][_0x7f3b('0x52')]}})[_0x7f3b('0x11')](function(_0x2200fa){if(_0x2200fa){_0x5dd3d6[_0x7f3b('0x42')][_0x7f3b('0x55')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2200fa[_0x7f3b('0x54')]+','+(_0x5dd3d6['account']['waitForTheAssignedAgent']||0xa),'interval':_0x7f3b('0x56')});}return respondWithRpcPromise('Start',_0x7f3b('0x57'),_0x5dd3d6);});}return respondWithRpcPromise('Start',_0x7f3b('0x57'),_0x5dd3d6);})['then'](function(_0x462d8a){_0x246323(_0x462d8a);})[_0x7f3b('0x58')](function(_0x4f9525){_0x9f5c2a(_0x395a01[_0x7f3b('0x18')](0x1f4,_0x4f9525['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 9edb790..e5f8ef3 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 _0xb4ed=['./faxAccount.events','remove','update','emit','removeListener','register','faxAccount:'];(function(_0x2f2579,_0xcf2d7){var _0x312dc2=function(_0x2970ab){while(--_0x2970ab){_0x2f2579['push'](_0x2f2579['shift']());}};_0x312dc2(++_0xcf2d7);}(_0xb4ed,0xbd));var _0xdb4e=function(_0x1ff575,_0xdba21f){_0x1ff575=_0x1ff575-0x0;var _0x48fc9e=_0xb4ed[_0x1ff575];return _0x48fc9e;};'use strict';var FaxAccountEvents=require(_0xdb4e('0x0'));var events=['save',_0xdb4e('0x1'),_0xdb4e('0x2')];function createListener(_0x2a7130,_0x5891c2){return function(_0x351de1){_0x5891c2[_0xdb4e('0x3')](_0x2a7130,_0x351de1);};}function removeListener(_0x2f6c92,_0x880590){return function(){FaxAccountEvents[_0xdb4e('0x4')](_0x2f6c92,_0x880590);};}exports[_0xdb4e('0x5')]=function(_0x52a6fb){for(var _0x3d2799=0x0,_0x4f5955=events['length'];_0x3d2799<_0x4f5955;_0x3d2799++){var _0x626e40=events[_0x3d2799];var _0x5efe34=createListener(_0xdb4e('0x6')+_0x626e40,_0x52a6fb);FaxAccountEvents['on'](_0x626e40,_0x5efe34);}}; \ No newline at end of file +var _0x4b1f=['register','length','faxAccount:','./faxAccount.events','save','remove','emit','removeListener'];(function(_0x57ede0,_0x2c5e8c){var _0x60056=function(_0x588cd2){while(--_0x588cd2){_0x57ede0['push'](_0x57ede0['shift']());}};_0x60056(++_0x2c5e8c);}(_0x4b1f,0x1bb));var _0xf4b1=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4b1f[_0x4565bf];return _0x5610ba;};'use strict';var FaxAccountEvents=require(_0xf4b1('0x0'));var events=[_0xf4b1('0x1'),_0xf4b1('0x2'),'update'];function createListener(_0x5c7b94,_0x57de7a){return function(_0x2ef52c){_0x57de7a[_0xf4b1('0x3')](_0x5c7b94,_0x2ef52c);};}function removeListener(_0x1b2849,_0x110192){return function(){FaxAccountEvents[_0xf4b1('0x4')](_0x1b2849,_0x110192);};}exports[_0xf4b1('0x5')]=function(_0x37455f){for(var _0x3b543b=0x0,_0x4b5d3c=events[_0xf4b1('0x6')];_0x3b543b<_0x4b5d3c;_0x3b543b++){var _0x57519f=events[_0x3b543b];var _0x11b451=createListener(_0xf4b1('0x7')+_0x57519f,_0x37455f);FaxAccountEvents['on'](_0x57519f,_0x11b451);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 1359f06..4b0fb33 100644 --- a/server/api/faxAccount/index.js +++ b/server/api/faxAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x15e051,_0x1b608d){var _0x3c1a38=function(_0x31db8b){while(--_0x31db8b){_0x15e051['push'](_0x15e051['shift']());}};_0x3c1a38(++_0x1b608d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x33385c,_0x13ac69){var _0x14e17e=function(_0x41dd24){while(--_0x41dd24){_0x33385c['push'](_0x33385c['shift']());}};_0x14e17e(++_0x13ac69);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index b13bec6..2eda4fb 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 _0x69ea=['STRING','noop','TEXT','*,*,*,*','exports','INTEGER'];(function(_0x26b047,_0x3988e0){var _0x2826b8=function(_0x4637a9){while(--_0x4637a9){_0x26b047['push'](_0x26b047['shift']());}};_0x2826b8(++_0x3988e0);}(_0x69ea,0x1d2));var _0xa69e=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x69ea[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require('sequelize');module[_0xa69e('0x0')]={'priority':{'type':Sequelize[_0xa69e('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xa69e('0x2')],'allowNull':![],'defaultValue':_0xa69e('0x3')},'appdata':{'type':Sequelize[_0xa69e('0x4')]()},'description':{'type':Sequelize[_0xa69e('0x2')]},'interval':{'type':Sequelize[_0xa69e('0x2')],'defaultValue':_0xa69e('0x5')}}; \ No newline at end of file +var _0x7dd0=['STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x3d27f8,_0x1e7078){var _0x5f51ec=function(_0x3ef431){while(--_0x3ef431){_0x3d27f8['push'](_0x3d27f8['shift']());}};_0x5f51ec(++_0x1e7078);}(_0x7dd0,0x8e));var _0x07dd=function(_0xa6b496,_0x2ab98f){_0xa6b496=_0xa6b496-0x0;var _0x3e0f9f=_0x7dd0[_0xa6b496];return _0x3e0f9f;};'use strict';var Sequelize=require(_0x07dd('0x0'));module[_0x07dd('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x07dd('0x2')],'allowNull':![],'defaultValue':_0x07dd('0x3')},'appdata':{'type':Sequelize[_0x07dd('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x07dd('0x2')],'defaultValue':_0x07dd('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index c0d91c9..ee6c04c 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 _0xf39a=['bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','then','findAll','catch','show','length','includeAll','include','options','find','create','body','params','destroy','eml-format','zip-dir','request-promise','moment'];(function(_0x3ce4d8,_0x235eb5){var _0x1c3704=function(_0x3e7a95){while(--_0x3e7a95){_0x3ce4d8['push'](_0x3ce4d8['shift']());}};_0x1c3704(++_0x235eb5);}(_0xf39a,0x1d0));var _0xaf39=function(_0x58f2a5,_0x272332){_0x58f2a5=_0x58f2a5-0x0;var _0x232b2e=_0xf39a[_0x58f2a5];return _0x232b2e;};'use strict';var emlformat=require(_0xaf39('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaf39('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf39('0x2'));var moment=require(_0xaf39('0x3'));var BPromise=require(_0xaf39('0x4'));var Mustache=require(_0xaf39('0x5'));var util=require(_0xaf39('0x6'));var path=require('path');var sox=require(_0xaf39('0x7'));var csv=require('to-csv');var ejs=require(_0xaf39('0x8'));var fs=require('fs');var fs_extra=require(_0xaf39('0x9'));var _=require('lodash');var squel=require(_0xaf39('0xa'));var crypto=require(_0xaf39('0xb'));var jsforce=require(_0xaf39('0xc'));var deskjs=require(_0xaf39('0xd'));var toCsv=require(_0xaf39('0xe'));var querystring=require('querystring');var Papa=require(_0xaf39('0xf'));var Redis=require(_0xaf39('0x10'));var authService=require(_0xaf39('0x11'));var qs=require(_0xaf39('0x12'));var as=require(_0xaf39('0x13'));var hardwareService=require(_0xaf39('0x14'));var logger=require(_0xaf39('0x15'))(_0xaf39('0x16'));var utils=require(_0xaf39('0x17'));var config=require(_0xaf39('0x18'));var licenseUtil=require(_0xaf39('0x19'));var db=require(_0xaf39('0x1a'))['db'];function respondWithStatusCode(_0x94a43a,_0x3f3707){_0x3f3707=_0x3f3707||0xcc;return function(_0x4512b9){if(_0x4512b9){return _0x94a43a[_0xaf39('0x1b')](_0x3f3707);}return _0x94a43a[_0xaf39('0x1c')](_0x3f3707)[_0xaf39('0x1d')]();};}function respondWithResult(_0x1c7c2f,_0x1a6466){_0x1a6466=_0x1a6466||0xc8;return function(_0x17df71){if(_0x17df71){return _0x1c7c2f[_0xaf39('0x1c')](_0x1a6466)[_0xaf39('0x1e')](_0x17df71);}};}function respondWithFilteredResult(_0x1aa256,_0x5ac956){return function(_0x1c6623){if(_0x1c6623){var _0x4ab937=typeof _0x5ac956[_0xaf39('0x1f')]===_0xaf39('0x20')&&typeof _0x5ac956[_0xaf39('0x21')]===_0xaf39('0x20');var _0x52dc88=_0x1c6623[_0xaf39('0x22')];var _0x308c8b=_0x4ab937?0x0:_0x5ac956[_0xaf39('0x1f')];var _0x4a1b68=_0x4ab937?_0x1c6623[_0xaf39('0x22')]:_0x5ac956[_0xaf39('0x1f')]+_0x5ac956[_0xaf39('0x21')];var _0x3c3923;if(_0x4a1b68>=_0x52dc88){_0x4a1b68=_0x52dc88;_0x3c3923=0xc8;}else{_0x3c3923=0xce;}_0x1aa256[_0xaf39('0x1c')](_0x3c3923);return _0x1aa256[_0xaf39('0x23')](_0xaf39('0x24'),_0x308c8b+'-'+_0x4a1b68+'/'+_0x52dc88)[_0xaf39('0x1e')](_0x1c6623);}return null;};}function patchUpdates(_0x5e5ea7){return function(_0x11a8bf){try{jsonpatch[_0xaf39('0x25')](_0x11a8bf,_0x5e5ea7,!![]);}catch(_0x257aa1){return BPromise[_0xaf39('0x26')](_0x257aa1);}return _0x11a8bf['save']();};}function saveUpdates(_0x2d3dff,_0x327089){return function(_0xf6976b){if(_0xf6976b){return _0xf6976b['update'](_0x2d3dff)['then'](function(_0x4b1d5e){return _0x4b1d5e;});}return null;};}function removeEntity(_0x177040,_0x203659){return function(_0x2e3db1){if(_0x2e3db1){return _0x2e3db1['destroy']()['then'](function(){_0x177040[_0xaf39('0x1c')](0xcc)[_0xaf39('0x1d')]();});}};}function handleEntityNotFound(_0x1888aa,_0x3b3d4a){return function(_0x2ce78a){if(!_0x2ce78a){_0x1888aa[_0xaf39('0x1b')](0x194);}return _0x2ce78a;};}function handleError(_0x3f4845,_0x5c58ef){_0x5c58ef=_0x5c58ef||0x1f4;return function(_0x47e0f3){logger['error'](_0x47e0f3[_0xaf39('0x27')]);if(_0x47e0f3[_0xaf39('0x28')]){delete _0x47e0f3['name'];}_0x3f4845[_0xaf39('0x1c')](_0x5c58ef)[_0xaf39('0x29')](_0x47e0f3);};}exports[_0xaf39('0x2a')]=function(_0x5f14da,_0xe5edc8){var _0x579e9b={},_0x1b30bd={},_0x27c17d={'count':0x0,'rows':[]};var _0x37d944=_[_0xaf39('0x2b')](db[_0xaf39('0x2c')][_0xaf39('0x2d')],function(_0x7f6f29){return{'name':_0x7f6f29[_0xaf39('0x2e')],'type':_0x7f6f29[_0xaf39('0x2f')][_0xaf39('0x30')]};});_0x1b30bd[_0xaf39('0x31')]=_[_0xaf39('0x2b')](_0x37d944,_0xaf39('0x28'));_0x1b30bd[_0xaf39('0x32')]=_[_0xaf39('0x33')](_0x5f14da[_0xaf39('0x32')]);_0x1b30bd[_0xaf39('0x34')]=_[_0xaf39('0x35')](_0x1b30bd[_0xaf39('0x31')],_0x1b30bd['query']);_0x579e9b['attributes']=_[_0xaf39('0x35')](_0x1b30bd[_0xaf39('0x31')],qs[_0xaf39('0x36')](_0x5f14da[_0xaf39('0x32')]['fields']));_0x579e9b[_0xaf39('0x37')]=_0x579e9b[_0xaf39('0x37')]['length']?_0x579e9b[_0xaf39('0x37')]:_0x1b30bd[_0xaf39('0x31')];if(!_0x5f14da[_0xaf39('0x32')][_0xaf39('0x38')](_0xaf39('0x39'))){_0x579e9b['limit']=qs[_0xaf39('0x21')](_0x5f14da[_0xaf39('0x32')][_0xaf39('0x21')]);_0x579e9b['offset']=qs[_0xaf39('0x1f')](_0x5f14da[_0xaf39('0x32')][_0xaf39('0x1f')]);}_0x579e9b[_0xaf39('0x3a')]=qs[_0xaf39('0x3b')](_0x5f14da[_0xaf39('0x32')]['sort']);_0x579e9b['where']=qs[_0xaf39('0x34')](_[_0xaf39('0x3c')](_0x5f14da[_0xaf39('0x32')],_0x1b30bd['filters']),_0x37d944);if(_0x5f14da[_0xaf39('0x32')][_0xaf39('0x3d')]){_0x579e9b[_0xaf39('0x3e')]=_[_0xaf39('0x3f')](_0x579e9b['where'],{'$or':_[_0xaf39('0x2b')](_0x37d944,function(_0x258aba){if(_0x258aba['type']!==_0xaf39('0x40')){var _0x2b4fd9={};_0x2b4fd9[_0x258aba[_0xaf39('0x28')]]={'$like':'%'+_0x5f14da['query']['filter']+'%'};return _0x2b4fd9;}})});}_0x579e9b=_['merge']({},_0x579e9b,_0x5f14da['options']);var _0x4d0b73={'where':_0x579e9b[_0xaf39('0x3e')]};return db[_0xaf39('0x2c')][_0xaf39('0x22')](_0x4d0b73)[_0xaf39('0x41')](function(_0x4ec60e){_0x27c17d[_0xaf39('0x22')]=_0x4ec60e;if(_0x5f14da[_0xaf39('0x32')]['includeAll']){_0x579e9b['include']=[{'all':!![]}];}return db[_0xaf39('0x2c')][_0xaf39('0x42')](_0x579e9b);})[_0xaf39('0x41')](function(_0x5af944){_0x27c17d['rows']=_0x5af944;return _0x27c17d;})[_0xaf39('0x41')](respondWithFilteredResult(_0xe5edc8,_0x579e9b))[_0xaf39('0x43')](handleError(_0xe5edc8,null));};exports[_0xaf39('0x44')]=function(_0x1895b9,_0x42c1ad){var _0x5ab68e={'raw':!![],'where':{'id':_0x1895b9['params']['id']}},_0x1fe26c={};_0x1fe26c['model']=_[_0xaf39('0x33')](db['FaxApplication']['rawAttributes']);_0x1fe26c[_0xaf39('0x32')]=_[_0xaf39('0x33')](_0x1895b9[_0xaf39('0x32')]);_0x1fe26c['filters']=_[_0xaf39('0x35')](_0x1fe26c[_0xaf39('0x31')],_0x1fe26c['query']);_0x5ab68e[_0xaf39('0x37')]=_[_0xaf39('0x35')](_0x1fe26c[_0xaf39('0x31')],qs[_0xaf39('0x36')](_0x1895b9[_0xaf39('0x32')][_0xaf39('0x36')]));_0x5ab68e[_0xaf39('0x37')]=_0x5ab68e['attributes'][_0xaf39('0x45')]?_0x5ab68e['attributes']:_0x1fe26c[_0xaf39('0x31')];if(_0x1895b9[_0xaf39('0x32')][_0xaf39('0x46')]){_0x5ab68e[_0xaf39('0x47')]=[{'all':!![]}];}_0x5ab68e=_[_0xaf39('0x3f')]({},_0x5ab68e,_0x1895b9[_0xaf39('0x48')]);return db[_0xaf39('0x2c')][_0xaf39('0x49')](_0x5ab68e)[_0xaf39('0x41')](handleEntityNotFound(_0x42c1ad,null))[_0xaf39('0x41')](respondWithResult(_0x42c1ad,null))[_0xaf39('0x43')](handleError(_0x42c1ad,null));};exports[_0xaf39('0x4a')]=function(_0x2cb292,_0x30f287){return db[_0xaf39('0x2c')][_0xaf39('0x4a')](_0x2cb292[_0xaf39('0x4b')],{})[_0xaf39('0x41')](respondWithResult(_0x30f287,0xc9))[_0xaf39('0x43')](handleError(_0x30f287,null));};exports['update']=function(_0x543504,_0x16bd1d){if(_0x543504['body']['id']){delete _0x543504[_0xaf39('0x4b')]['id'];}return db[_0xaf39('0x2c')][_0xaf39('0x49')]({'where':{'id':_0x543504[_0xaf39('0x4c')]['id']}})[_0xaf39('0x41')](handleEntityNotFound(_0x16bd1d,null))[_0xaf39('0x41')](saveUpdates(_0x543504[_0xaf39('0x4b')],null))[_0xaf39('0x41')](respondWithResult(_0x16bd1d,null))['catch'](handleError(_0x16bd1d,null));};exports[_0xaf39('0x4d')]=function(_0x2b970b,_0x2b3002){return db[_0xaf39('0x2c')][_0xaf39('0x49')]({'where':{'id':_0x2b970b[_0xaf39('0x4c')]['id']}})[_0xaf39('0x41')](handleEntityNotFound(_0x2b3002,null))[_0xaf39('0x41')](removeEntity(_0x2b3002,null))[_0xaf39('0x43')](handleError(_0x2b3002,null));}; \ No newline at end of file +var _0x92fd=['offset','undefined','count','limit','set','apply','save','then','sendStatus','stack','name','index','map','FaxApplication','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','includeAll','find','create','body','catch','update','destroy','eml-format','rimraf','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','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x92fd,0xbc));var _0xd92f=function(_0xf61c79,_0x43c6fa){_0xf61c79=_0xf61c79-0x0;var _0x127d26=_0x92fd[_0xf61c79];return _0x127d26;};'use strict';var emlformat=require(_0xd92f('0x0'));var rimraf=require(_0xd92f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd92f('0x2'));var rp=require(_0xd92f('0x3'));var moment=require(_0xd92f('0x4'));var BPromise=require(_0xd92f('0x5'));var Mustache=require(_0xd92f('0x6'));var util=require(_0xd92f('0x7'));var path=require(_0xd92f('0x8'));var sox=require(_0xd92f('0x9'));var csv=require(_0xd92f('0xa'));var ejs=require(_0xd92f('0xb'));var fs=require('fs');var fs_extra=require(_0xd92f('0xc'));var _=require(_0xd92f('0xd'));var squel=require(_0xd92f('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd92f('0xf'));var toCsv=require(_0xd92f('0xa'));var querystring=require(_0xd92f('0x10'));var Papa=require('papaparse');var Redis=require(_0xd92f('0x11'));var authService=require(_0xd92f('0x12'));var qs=require(_0xd92f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd92f('0x14'));var logger=require(_0xd92f('0x15'))('api');var utils=require(_0xd92f('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd92f('0x17'));var db=require(_0xd92f('0x18'))['db'];function respondWithStatusCode(_0x43e37e,_0x31b94f){_0x31b94f=_0x31b94f||0xcc;return function(_0x10cc5f){if(_0x10cc5f){return _0x43e37e['sendStatus'](_0x31b94f);}return _0x43e37e[_0xd92f('0x19')](_0x31b94f)[_0xd92f('0x1a')]();};}function respondWithResult(_0x198440,_0x154513){_0x154513=_0x154513||0xc8;return function(_0x5d7dd9){if(_0x5d7dd9){return _0x198440[_0xd92f('0x19')](_0x154513)[_0xd92f('0x1b')](_0x5d7dd9);}};}function respondWithFilteredResult(_0xfd382,_0x300a0d){return function(_0x394d85){if(_0x394d85){var _0x16d6bd=typeof _0x300a0d[_0xd92f('0x1c')]===_0xd92f('0x1d')&&typeof _0x300a0d['limit']===_0xd92f('0x1d');var _0x59154c=_0x394d85[_0xd92f('0x1e')];var _0x27171a=_0x16d6bd?0x0:_0x300a0d[_0xd92f('0x1c')];var _0x31cf88=_0x16d6bd?_0x394d85['count']:_0x300a0d[_0xd92f('0x1c')]+_0x300a0d[_0xd92f('0x1f')];var _0x35ba1e;if(_0x31cf88>=_0x59154c){_0x31cf88=_0x59154c;_0x35ba1e=0xc8;}else{_0x35ba1e=0xce;}_0xfd382[_0xd92f('0x19')](_0x35ba1e);return _0xfd382[_0xd92f('0x20')]('Content-Range',_0x27171a+'-'+_0x31cf88+'/'+_0x59154c)[_0xd92f('0x1b')](_0x394d85);}return null;};}function patchUpdates(_0xe82129){return function(_0x55a6e1){try{jsonpatch[_0xd92f('0x21')](_0x55a6e1,_0xe82129,!![]);}catch(_0x1260a8){return BPromise['reject'](_0x1260a8);}return _0x55a6e1[_0xd92f('0x22')]();};}function saveUpdates(_0x57afe2,_0xee5336){return function(_0x5906ab){if(_0x5906ab){return _0x5906ab['update'](_0x57afe2)[_0xd92f('0x23')](function(_0x3180ec){return _0x3180ec;});}return null;};}function removeEntity(_0x2eada2,_0xf136e5){return function(_0x3265c6){if(_0x3265c6){return _0x3265c6['destroy']()[_0xd92f('0x23')](function(){_0x2eada2[_0xd92f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d3505,_0x2661fa){return function(_0x25a70b){if(!_0x25a70b){_0x1d3505[_0xd92f('0x24')](0x194);}return _0x25a70b;};}function handleError(_0x441854,_0x48e940){_0x48e940=_0x48e940||0x1f4;return function(_0x56d853){logger['error'](_0x56d853[_0xd92f('0x25')]);if(_0x56d853[_0xd92f('0x26')]){delete _0x56d853[_0xd92f('0x26')];}_0x441854[_0xd92f('0x19')](_0x48e940)['send'](_0x56d853);};}exports[_0xd92f('0x27')]=function(_0xde9e2b,_0x9c31ac){var _0x504f26={},_0x282a58={},_0x35a25d={'count':0x0,'rows':[]};var _0x5e3fb5=_[_0xd92f('0x28')](db[_0xd92f('0x29')]['rawAttributes'],function(_0x3b5688){return{'name':_0x3b5688['fieldName'],'type':_0x3b5688[_0xd92f('0x2a')][_0xd92f('0x2b')]};});_0x282a58['model']=_['map'](_0x5e3fb5,_0xd92f('0x26'));_0x282a58[_0xd92f('0x2c')]=_[_0xd92f('0x2d')](_0xde9e2b[_0xd92f('0x2c')]);_0x282a58[_0xd92f('0x2e')]=_[_0xd92f('0x2f')](_0x282a58[_0xd92f('0x30')],_0x282a58[_0xd92f('0x2c')]);_0x504f26[_0xd92f('0x31')]=_[_0xd92f('0x2f')](_0x282a58[_0xd92f('0x30')],qs['fields'](_0xde9e2b[_0xd92f('0x2c')][_0xd92f('0x32')]));_0x504f26[_0xd92f('0x31')]=_0x504f26[_0xd92f('0x31')][_0xd92f('0x33')]?_0x504f26[_0xd92f('0x31')]:_0x282a58[_0xd92f('0x30')];if(!_0xde9e2b[_0xd92f('0x2c')][_0xd92f('0x34')](_0xd92f('0x35'))){_0x504f26[_0xd92f('0x1f')]=qs[_0xd92f('0x1f')](_0xde9e2b['query'][_0xd92f('0x1f')]);_0x504f26[_0xd92f('0x1c')]=qs[_0xd92f('0x1c')](_0xde9e2b[_0xd92f('0x2c')][_0xd92f('0x1c')]);}_0x504f26['order']=qs[_0xd92f('0x36')](_0xde9e2b['query']['sort']);_0x504f26[_0xd92f('0x37')]=qs['filters'](_[_0xd92f('0x38')](_0xde9e2b[_0xd92f('0x2c')],_0x282a58[_0xd92f('0x2e')]),_0x5e3fb5);if(_0xde9e2b[_0xd92f('0x2c')][_0xd92f('0x39')]){_0x504f26[_0xd92f('0x37')]=_[_0xd92f('0x3a')](_0x504f26[_0xd92f('0x37')],{'$or':_[_0xd92f('0x28')](_0x5e3fb5,function(_0x1dcd93){if(_0x1dcd93[_0xd92f('0x2a')]!==_0xd92f('0x3b')){var _0x344471={};_0x344471[_0x1dcd93['name']]={'$like':'%'+_0xde9e2b[_0xd92f('0x2c')][_0xd92f('0x39')]+'%'};return _0x344471;}})});}_0x504f26=_[_0xd92f('0x3a')]({},_0x504f26,_0xde9e2b[_0xd92f('0x3c')]);var _0x1dcce8={'where':_0x504f26[_0xd92f('0x37')]};return db[_0xd92f('0x29')][_0xd92f('0x1e')](_0x1dcce8)[_0xd92f('0x23')](function(_0x481139){_0x35a25d['count']=_0x481139;if(_0xde9e2b[_0xd92f('0x2c')]['includeAll']){_0x504f26[_0xd92f('0x3d')]=[{'all':!![]}];}return db[_0xd92f('0x29')][_0xd92f('0x3e')](_0x504f26);})[_0xd92f('0x23')](function(_0x5e2d47){_0x35a25d[_0xd92f('0x3f')]=_0x5e2d47;return _0x35a25d;})[_0xd92f('0x23')](respondWithFilteredResult(_0x9c31ac,_0x504f26))['catch'](handleError(_0x9c31ac,null));};exports['show']=function(_0x1fafa8,_0x52d62d){var _0x3c9eec={'raw':!![],'where':{'id':_0x1fafa8[_0xd92f('0x40')]['id']}},_0x5506ab={};_0x5506ab[_0xd92f('0x30')]=_[_0xd92f('0x2d')](db[_0xd92f('0x29')]['rawAttributes']);_0x5506ab[_0xd92f('0x2c')]=_[_0xd92f('0x2d')](_0x1fafa8[_0xd92f('0x2c')]);_0x5506ab[_0xd92f('0x2e')]=_[_0xd92f('0x2f')](_0x5506ab[_0xd92f('0x30')],_0x5506ab[_0xd92f('0x2c')]);_0x3c9eec[_0xd92f('0x31')]=_['intersection'](_0x5506ab[_0xd92f('0x30')],qs['fields'](_0x1fafa8[_0xd92f('0x2c')]['fields']));_0x3c9eec['attributes']=_0x3c9eec[_0xd92f('0x31')][_0xd92f('0x33')]?_0x3c9eec[_0xd92f('0x31')]:_0x5506ab[_0xd92f('0x30')];if(_0x1fafa8[_0xd92f('0x2c')][_0xd92f('0x41')]){_0x3c9eec[_0xd92f('0x3d')]=[{'all':!![]}];}_0x3c9eec=_[_0xd92f('0x3a')]({},_0x3c9eec,_0x1fafa8['options']);return db['FaxApplication'][_0xd92f('0x42')](_0x3c9eec)[_0xd92f('0x23')](handleEntityNotFound(_0x52d62d,null))['then'](respondWithResult(_0x52d62d,null))['catch'](handleError(_0x52d62d,null));};exports['create']=function(_0x4c5104,_0x302a74){return db[_0xd92f('0x29')][_0xd92f('0x43')](_0x4c5104[_0xd92f('0x44')],{})[_0xd92f('0x23')](respondWithResult(_0x302a74,0xc9))[_0xd92f('0x45')](handleError(_0x302a74,null));};exports[_0xd92f('0x46')]=function(_0x34c0f7,_0x279e5a){if(_0x34c0f7['body']['id']){delete _0x34c0f7[_0xd92f('0x44')]['id'];}return db[_0xd92f('0x29')]['find']({'where':{'id':_0x34c0f7[_0xd92f('0x40')]['id']}})[_0xd92f('0x23')](handleEntityNotFound(_0x279e5a,null))['then'](saveUpdates(_0x34c0f7['body'],null))[_0xd92f('0x23')](respondWithResult(_0x279e5a,null))['catch'](handleError(_0x279e5a,null));};exports[_0xd92f('0x47')]=function(_0x5f11c5,_0x4e06bc){return db['FaxApplication'][_0xd92f('0x42')]({'where':{'id':_0x5f11c5[_0xd92f('0x40')]['id']}})[_0xd92f('0x23')](handleEntityNotFound(_0x4e06bc,null))[_0xd92f('0x23')](removeEntity(_0x4e06bc,null))[_0xd92f('0x45')](handleError(_0x4e06bc,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 19d8536..23aba92 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 _0xff12=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','fax_applications','utf8mb4'];(function(_0x34237a,_0x478417){var _0x354c6a=function(_0x1d73ce){while(--_0x1d73ce){_0x34237a['push'](_0x34237a['shift']());}};_0x354c6a(++_0x478417);}(_0xff12,0x1bc));var _0x2ff1=function(_0x4f9047,_0x3e37e9){_0x4f9047=_0x4f9047-0x0;var _0x1ee721=_0xff12[_0x4f9047];return _0x1ee721;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2ff1('0x0'))(_0x2ff1('0x1'));var moment=require(_0x2ff1('0x2'));var BPromise=require(_0x2ff1('0x3'));var rp=require(_0x2ff1('0x4'));var fs=require('fs');var path=require(_0x2ff1('0x5'));var rimraf=require(_0x2ff1('0x6'));var config=require(_0x2ff1('0x7'));var attributes=require('./faxApplication.attributes');module[_0x2ff1('0x8')]=function(_0x561152,_0x1ff2eb){return _0x561152[_0x2ff1('0x9')]('FaxApplication',attributes,{'tableName':_0x2ff1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2ff1('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x10cb=['bluebird','request-promise','path','rimraf','./faxApplication.attributes','fax_applications','utf8mb4','lodash','../../config/logger','api','moment'];(function(_0x45e6bf,_0x4a1217){var _0x49e396=function(_0x2ebf9e){while(--_0x2ebf9e){_0x45e6bf['push'](_0x45e6bf['shift']());}};_0x49e396(++_0x4a1217);}(_0x10cb,0xb7));var _0xb10c=function(_0x2f2654,_0x1572bd){_0x2f2654=_0x2f2654-0x0;var _0x332b2a=_0x10cb[_0x2f2654];return _0x332b2a;};'use strict';var _=require(_0xb10c('0x0'));var util=require('util');var logger=require(_0xb10c('0x1'))(_0xb10c('0x2'));var moment=require(_0xb10c('0x3'));var BPromise=require(_0xb10c('0x4'));var rp=require(_0xb10c('0x5'));var fs=require('fs');var path=require(_0xb10c('0x6'));var rimraf=require(_0xb10c('0x7'));var config=require('../../config/environment');var attributes=require(_0xb10c('0x8'));module['exports']=function(_0x5354bd,_0x54d713){return _0x5354bd['define']('FaxApplication',attributes,{'tableName':_0xb10c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb10c('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index ef0fb66..bba76de 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 _0xd2ba=['FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','UpdateFaxApplication','FaxApplication','update','options','attributes','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x105fbb,_0x1f0ccc){var _0x36aa31=function(_0x10867a){while(--_0x10867a){_0x105fbb['push'](_0x105fbb['shift']());}};_0x36aa31(++_0x1f0ccc);}(_0xd2ba,0xf2));var _0xad2b=function(_0xf2b598,_0x57bdc9){_0xf2b598=_0xf2b598-0x0;var _0x48ada9=_0xd2ba[_0xf2b598];return _0x48ada9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xad2b('0x0'));var BPromise=require(_0xad2b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xad2b('0x2'))['db'];var utils=require(_0xad2b('0x3'));var logger=require(_0xad2b('0x4'))('rpc');var config=require(_0xad2b('0x5'));var jayson=require(_0xad2b('0x6'));var client=jayson[_0xad2b('0x7')][_0xad2b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2481c1,_0x37c7d9,_0x32bd8d){return new BPromise(function(_0x3a7bcf,_0x41fc5f){return client['request'](_0x2481c1,_0x32bd8d)[_0xad2b('0x9')](function(_0x42cf98){logger[_0xad2b('0xa')](_0xad2b('0xb'),_0x37c7d9,_0xad2b('0xc'));logger['debug'](_0xad2b('0xd'),_0x37c7d9,_0xad2b('0xc'),JSON[_0xad2b('0xe')](_0x42cf98));if(_0x42cf98[_0xad2b('0xf')]){if(_0x42cf98[_0xad2b('0xf')]['code']===0x1f4){logger['error']('FaxApplication,\x20%s,\x20%s',_0x37c7d9,_0x42cf98['error']['message']);return _0x41fc5f(_0x42cf98['error'][_0xad2b('0x10')]);}logger[_0xad2b('0xf')](_0xad2b('0xb'),_0x37c7d9,_0x42cf98['error'][_0xad2b('0x10')]);return _0x3a7bcf(_0x42cf98[_0xad2b('0xf')][_0xad2b('0x10')]);}else{logger[_0xad2b('0xa')](_0xad2b('0xb'),_0x37c7d9,_0xad2b('0xc'));_0x3a7bcf(_0x42cf98['result'][_0xad2b('0x10')]);}})[_0xad2b('0x11')](function(_0x2d6e59){logger['error'](_0xad2b('0xb'),_0x37c7d9,_0x2d6e59);_0x41fc5f(_0x2d6e59);});});}exports[_0xad2b('0x12')]=function(_0x3e7f4b){var _0x20b3b6=this;return new Promise(function(_0x410856,_0x41a27c){return db[_0xad2b('0x13')][_0xad2b('0x14')](_0x3e7f4b['body'],{'raw':_0x3e7f4b[_0xad2b('0x15')]?_0x3e7f4b['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e7f4b[_0xad2b('0x15')]?_0x3e7f4b['options']['where']||null:null,'attributes':_0x3e7f4b['options']?_0x3e7f4b['options'][_0xad2b('0x16')]||null:null,'limit':_0x3e7f4b[_0xad2b('0x15')]?_0x3e7f4b[_0xad2b('0x15')]['limit']||null:null})[_0xad2b('0x9')](function(_0x52be1e){logger['info'](_0xad2b('0x12'),_0x3e7f4b);logger['debug'](_0xad2b('0x12'),_0x3e7f4b,JSON['stringify'](_0x52be1e));_0x410856(_0x52be1e);})[_0xad2b('0x11')](function(_0x51c08f){logger[_0xad2b('0xf')](_0xad2b('0x12'),_0x51c08f[_0xad2b('0x10')],_0x3e7f4b);_0x41a27c(_0x20b3b6['error'](0x1f4,_0x51c08f['message']));});});}; \ No newline at end of file +var _0x14bb=['request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','where','then','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','FaxApplication,\x20%s,\x20%s'];(function(_0x59fda4,_0x264703){var _0x72aee2=function(_0x30259c){while(--_0x30259c){_0x59fda4['push'](_0x59fda4['shift']());}};_0x72aee2(++_0x264703);}(_0x14bb,0x15f));var _0xb14b=function(_0x13f446,_0x344ef6){_0x13f446=_0x13f446-0x0;var _0x4d315d=_0x14bb[_0x13f446];return _0x4d315d;};'use strict';var _=require('lodash');var util=require(_0xb14b('0x0'));var moment=require(_0xb14b('0x1'));var BPromise=require(_0xb14b('0x2'));var rs=require(_0xb14b('0x3'));var fs=require('fs');var Redis=require(_0xb14b('0x4'));var db=require(_0xb14b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb14b('0x6'))(_0xb14b('0x7'));var config=require(_0xb14b('0x8'));var jayson=require(_0xb14b('0x9'));var client=jayson[_0xb14b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9acec7,_0x326c6f,_0x4936b0){return new BPromise(function(_0x11174c,_0x381b0c){return client['request'](_0x9acec7,_0x4936b0)['then'](function(_0x25f0a4){logger[_0xb14b('0xb')](_0xb14b('0xc'),_0x326c6f,_0xb14b('0xd'));logger['debug'](_0xb14b('0xe'),_0x326c6f,'request\x20sent',JSON['stringify'](_0x25f0a4));if(_0x25f0a4['error']){if(_0x25f0a4[_0xb14b('0xf')][_0xb14b('0x10')]===0x1f4){logger[_0xb14b('0xf')]('FaxApplication,\x20%s,\x20%s',_0x326c6f,_0x25f0a4[_0xb14b('0xf')][_0xb14b('0x11')]);return _0x381b0c(_0x25f0a4[_0xb14b('0xf')][_0xb14b('0x11')]);}logger['error'](_0xb14b('0xc'),_0x326c6f,_0x25f0a4[_0xb14b('0xf')]['message']);return _0x11174c(_0x25f0a4['error'][_0xb14b('0x11')]);}else{logger[_0xb14b('0xb')](_0xb14b('0xc'),_0x326c6f,_0xb14b('0xd'));_0x11174c(_0x25f0a4[_0xb14b('0x12')][_0xb14b('0x11')]);}})[_0xb14b('0x13')](function(_0x1abb71){logger[_0xb14b('0xf')]('FaxApplication,\x20%s,\x20%s',_0x326c6f,_0x1abb71);_0x381b0c(_0x1abb71);});});}exports[_0xb14b('0x14')]=function(_0x3b5dd6){var _0x3a51a1=this;return new Promise(function(_0x23899a,_0x1eb09d){return db[_0xb14b('0x15')][_0xb14b('0x16')](_0x3b5dd6[_0xb14b('0x17')],{'raw':_0x3b5dd6[_0xb14b('0x18')]?_0x3b5dd6[_0xb14b('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b5dd6[_0xb14b('0x18')]?_0x3b5dd6[_0xb14b('0x18')][_0xb14b('0x19')]||null:null,'attributes':_0x3b5dd6[_0xb14b('0x18')]?_0x3b5dd6['options']['attributes']||null:null,'limit':_0x3b5dd6['options']?_0x3b5dd6[_0xb14b('0x18')]['limit']||null:null})[_0xb14b('0x1a')](function(_0x29ec2f){logger['info'](_0xb14b('0x14'),_0x3b5dd6);logger[_0xb14b('0x1b')](_0xb14b('0x14'),_0x3b5dd6,JSON['stringify'](_0x29ec2f));_0x23899a(_0x29ec2f);})[_0xb14b('0x13')](function(_0x2f1f5d){logger['error']('UpdateFaxApplication',_0x2f1f5d[_0xb14b('0x11')],_0x3b5dd6);_0x1eb09d(_0x3a51a1[_0xb14b('0xf')](0x1f4,_0x2f1f5d[_0xb14b('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 9c596c6..9fc0970 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 _0xb62e=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','isAuthenticated','index','get','show','post','/:id','update','delete','destroy','exports','multer','util'];(function(_0x3adcc1,_0x2b9ee4){var _0x6b9e1f=function(_0xf4fc3e){while(--_0xf4fc3e){_0x3adcc1['push'](_0x3adcc1['shift']());}};_0x6b9e1f(++_0x2b9ee4);}(_0xb62e,0x1de));var _0xeb62=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xb62e[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var path=require(_0xeb62('0x2'));var timeout=require(_0xeb62('0x3'));var express=require('express');var router=express[_0xeb62('0x4')]();var fs_extra=require(_0xeb62('0x5'));var auth=require(_0xeb62('0x6'));var interaction=require(_0xeb62('0x7'));var config=require(_0xeb62('0x8'));var controller=require(_0xeb62('0x9'));router['get']('/',auth[_0xeb62('0xa')](),controller[_0xeb62('0xb')]);router[_0xeb62('0xc')]('/:id',auth[_0xeb62('0xa')](),controller[_0xeb62('0xd')]);router[_0xeb62('0xe')]('/',auth[_0xeb62('0xa')](),controller['create']);router['put'](_0xeb62('0xf'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x10')]);router[_0xeb62('0x11')](_0xeb62('0xf'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x12')]);module[_0xeb62('0x13')]=router; \ No newline at end of file +var _0x8603=['../../components/interaction/service','./faxApplication.controller','isAuthenticated','index','get','/:id','create','put','update','exports','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x38622b,_0x3cfdf7){var _0x2c1a7a=function(_0x5de9cc){while(--_0x5de9cc){_0x38622b['push'](_0x38622b['shift']());}};_0x2c1a7a(++_0x3cfdf7);}(_0x8603,0x190));var _0x3860=function(_0x5358cd,_0x293fd6){_0x5358cd=_0x5358cd-0x0;var _0xc144e2=_0x8603[_0x5358cd];return _0xc144e2;};'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/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index ce74cca..cff6bb5 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 _0x8f83=['DATE','ENUM','out','sequelize','exports','STRING'];(function(_0xdfef52,_0x5d59f0){var _0x263589=function(_0x5f4e49){while(--_0x5f4e49){_0xdfef52['push'](_0xdfef52['shift']());}};_0x263589(++_0x5d59f0);}(_0x8f83,0x129));var _0x38f8=function(_0x1c532a,_0x791a93){_0x1c532a=_0x1c532a-0x0;var _0x16e144=_0x8f83[_0x1c532a];return _0x16e144;};'use strict';var Sequelize=require(_0x38f8('0x0'));module[_0x38f8('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x38f8('0x2')]},'secondDisposition':{'type':Sequelize[_0x38f8('0x2')]},'thirdDisposition':{'type':Sequelize[_0x38f8('0x2')]},'note':{'type':Sequelize[_0x38f8('0x2')]},'read1stAt':{'type':Sequelize[_0x38f8('0x3')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x38f8('0x4')]('in',_0x38f8('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x38f8('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x38f8('0x4')]('in',_0x38f8('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xf1af=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x9d14e3,_0x5a6072){var _0x19bf32=function(_0x19da07){while(--_0x19da07){_0x9d14e3['push'](_0x9d14e3['shift']());}};_0x19bf32(++_0x5a6072);}(_0xf1af,0x9c));var _0xff1a=function(_0x1cbcf1,_0x3f9fd9){_0x1cbcf1=_0x1cbcf1-0x0;var _0x3a06f0=_0xf1af[_0x1cbcf1];return _0x3a06f0;};'use strict';var Sequelize=require(_0xff1a('0x0'));module[_0xff1a('0x1')]={'closed':{'type':Sequelize[_0xff1a('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xff1a('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xff1a('0x4')]},'read1stAt':{'type':Sequelize[_0xff1a('0x3')]},'fax':{'type':Sequelize[_0xff1a('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xff1a('0x5')]('in',_0xff1a('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xff1a('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xff1a('0x5')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 007bba4..75a5052 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 _0xe80e=['include','merge','options','find','catch','create','body','update','destroy','describe','FaxMessage','addMessage','ids','getMessages','findOne','filters','hasOwnProperty','limit','order','sort','where','pick','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','addTags','setTags','omit','spread','Tag','name','color','emit','removeTags','toString','root','server','tmp','files','attachments','join','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','get','mkdirSync','existsSync','createReadStream','pipe','resolve','download','log','err','unlinkSync','rimraf','zip-dir','util','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','json','offset','undefined','count','set','Content-Range','then','end','error','stack','send','index','map','FaxInteraction','rawAttributes','fieldName','type','getOptions','findAll','user','show','params','keys','query','model','intersection','fields','attributes','length'];(function(_0xc9396b,_0x734ceb){var _0x56d6ee=function(_0x2456c0){while(--_0x2456c0){_0xc9396b['push'](_0xc9396b['shift']());}};_0x56d6ee(++_0x734ceb);}(_0xe80e,0x10e));var _0xee80=function(_0x55ff3e,_0x41077f){_0x55ff3e=_0x55ff3e-0x0;var _0x2709eb=_0xe80e[_0x55ff3e];return _0x2709eb;};'use strict';var rimraf=require(_0xee80('0x0'));var zipdir=require(_0xee80('0x1'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xee80('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var Redis=require(_0xee80('0x3'));var interaction=require(_0xee80('0x4'));var qs=require(_0xee80('0x5'));var logger=require(_0xee80('0x6'))('api');var config=require(_0xee80('0x7'));var db=require(_0xee80('0x8'))['db'];config[_0xee80('0x9')]=_['defaults'](config[_0xee80('0x9')],{'host':_0xee80('0xa'),'port':0x18eb});var socket=require(_0xee80('0xb'))(new Redis(config[_0xee80('0x9')]));require(_0xee80('0xc'))[_0xee80('0xd')](socket);function respondWithStatusCode(_0x158da8,_0x600ad2){_0x600ad2=_0x600ad2||0xcc;return function(_0x1b6b2d){if(_0x1b6b2d){return _0x158da8[_0xee80('0xe')](_0x600ad2);}return _0x158da8[_0xee80('0xf')](_0x600ad2)['end']();};}function respondWithResult(_0x15b530,_0x221c40){_0x221c40=_0x221c40||0xc8;return function(_0x2e0f1f){if(_0x2e0f1f){return _0x15b530[_0xee80('0xf')](_0x221c40)[_0xee80('0x10')](_0x2e0f1f);}};}function respondWithFilteredResult(_0x163845,_0x4807a3){return function(_0x32bbb6){if(_0x32bbb6){var _0x22d980=typeof _0x4807a3[_0xee80('0x11')]===_0xee80('0x12')&&typeof _0x4807a3['limit']===_0xee80('0x12');var _0x9e5c46=_0x32bbb6[_0xee80('0x13')];var _0x421a39=_0x22d980?0x0:_0x4807a3[_0xee80('0x11')];var _0x20290a=_0x22d980?_0x32bbb6[_0xee80('0x13')]:_0x4807a3[_0xee80('0x11')]+_0x4807a3['limit'];var _0x2bf6df;if(_0x20290a>=_0x9e5c46){_0x20290a=_0x9e5c46;_0x2bf6df=0xc8;}else{_0x2bf6df=0xce;}_0x163845['status'](_0x2bf6df);return _0x163845[_0xee80('0x14')](_0xee80('0x15'),_0x421a39+'-'+_0x20290a+'/'+_0x9e5c46)[_0xee80('0x10')](_0x32bbb6);}return null;};}function saveUpdates(_0x1673fc){return function(_0xd45cc9){if(_0xd45cc9){return _0xd45cc9['update'](_0x1673fc)[_0xee80('0x16')](function(_0x4dee73){return _0x4dee73;});}return null;};}function removeEntity(_0x5ed2b9){return function(_0x590f29){if(_0x590f29){return _0x590f29['destroy']()['then'](function(){_0x5ed2b9['status'](0xcc)[_0xee80('0x17')]();});}};}function handleEntityNotFound(_0x5a33f4){return function(_0x65ff23){if(!_0x65ff23){_0x5a33f4[_0xee80('0xe')](0x194);}return _0x65ff23;};}function handleError(_0x4d6e27,_0x3e033c){_0x3e033c=_0x3e033c||0x1f4;return function(_0xd57b6d){logger[_0xee80('0x18')](_0xd57b6d[_0xee80('0x19')]);if(_0xd57b6d['name']){delete _0xd57b6d['name'];}_0x4d6e27[_0xee80('0xf')](_0x3e033c)[_0xee80('0x1a')](_0xd57b6d);};}exports[_0xee80('0x1b')]=function(_0x1f7040,_0x41801f){var _0x409164={};var _0x20adf8=_[_0xee80('0x1c')](db[_0xee80('0x1d')][_0xee80('0x1e')],function(_0x591c89){return{'name':_0x591c89[_0xee80('0x1f')],'type':_0x591c89[_0xee80('0x20')]['key']};});_0x409164=qs[_0xee80('0x21')](_0x20adf8,_0x1f7040);return interaction[_0xee80('0x22')]('fax',_0x1f7040['query'],_0x1f7040[_0xee80('0x23')],_0x409164,_0x20adf8)[_0xee80('0x16')](respondWithFilteredResult(_0x41801f,_0x409164))['catch'](handleError(_0x41801f,null));};exports[_0xee80('0x24')]=function(_0x2a3169,_0x53ef7b){var _0x1f72ae={'raw':![],'where':{'id':_0x2a3169[_0xee80('0x25')]['id']}},_0x1e3de9={};_0x1e3de9['model']=_[_0xee80('0x26')](db[_0xee80('0x1d')]['rawAttributes']);_0x1e3de9['query']=_[_0xee80('0x26')](_0x2a3169[_0xee80('0x27')]);_0x1e3de9['filters']=_['intersection'](_0x1e3de9[_0xee80('0x28')],_0x1e3de9['query']);_0x1f72ae['attributes']=_[_0xee80('0x29')](_0x1e3de9[_0xee80('0x28')],qs[_0xee80('0x2a')](_0x2a3169[_0xee80('0x27')]['fields']));_0x1f72ae[_0xee80('0x2b')]=_0x1f72ae[_0xee80('0x2b')][_0xee80('0x2c')]?_0x1f72ae[_0xee80('0x2b')]:_0x1e3de9[_0xee80('0x28')];if(_0x2a3169['query']['includeAll']){_0x1f72ae[_0xee80('0x2d')]=[{'all':!![]}];}_0x1f72ae=_[_0xee80('0x2e')]({},_0x1f72ae,_0x2a3169[_0xee80('0x2f')]);return db['FaxInteraction'][_0xee80('0x30')](_0x1f72ae)[_0xee80('0x16')](handleEntityNotFound(_0x53ef7b,null))[_0xee80('0x16')](respondWithResult(_0x53ef7b,null))[_0xee80('0x31')](handleError(_0x53ef7b,null));};exports[_0xee80('0x32')]=function(_0x2095f5,_0x4b43fc){return db[_0xee80('0x1d')][_0xee80('0x32')](_0x2095f5[_0xee80('0x33')],{})[_0xee80('0x16')](respondWithResult(_0x4b43fc,0xc9))[_0xee80('0x31')](handleError(_0x4b43fc,null));};exports[_0xee80('0x34')]=function(_0x322bae,_0x58d4e7){if(_0x322bae['body']['id']){delete _0x322bae['body']['id'];}return db[_0xee80('0x1d')][_0xee80('0x30')]({'where':{'id':_0x322bae['params']['id']}})[_0xee80('0x16')](handleEntityNotFound(_0x58d4e7,null))[_0xee80('0x16')](saveUpdates(_0x322bae[_0xee80('0x33')],null))['then'](respondWithResult(_0x58d4e7,null))[_0xee80('0x31')](handleError(_0x58d4e7,null));};exports[_0xee80('0x35')]=function(_0x309aad,_0x19805a){return db[_0xee80('0x1d')]['find']({'where':{'id':_0x309aad[_0xee80('0x25')]['id']}})['then'](handleEntityNotFound(_0x19805a,null))[_0xee80('0x16')](removeEntity(_0x19805a,null))[_0xee80('0x31')](handleError(_0x19805a,null));};exports['describe']=function(_0x345b35,_0x3d7aba){return db[_0xee80('0x1d')][_0xee80('0x36')]()[_0xee80('0x16')](respondWithResult(_0x3d7aba,null))[_0xee80('0x31')](handleError(_0x3d7aba,null));};exports['addMessage']=function(_0x3ac859,_0x47eeb9){return db[_0xee80('0x37')]['find']({'where':{'id':_0x3ac859[_0xee80('0x25')]['id']}})[_0xee80('0x16')](handleEntityNotFound(_0x47eeb9,null))[_0xee80('0x16')](function(_0x15bed3){if(_0x15bed3){return _0x15bed3[_0xee80('0x38')](_0x3ac859['body'][_0xee80('0x39')],_['omit'](_0x3ac859[_0xee80('0x33')],[_0xee80('0x39'),'id'])||{});}})[_0xee80('0x16')](respondWithResult(_0x47eeb9,null))[_0xee80('0x31')](handleError(_0x47eeb9,null));};exports[_0xee80('0x3a')]=function(_0x2c6664,_0x37ae56){var _0x2a68c1={'raw':![],'where':{}};var _0x41b7b1={};var _0x36bb5b={'count':0x0,'rows':[]};return db[_0xee80('0x1d')][_0xee80('0x3b')]({'where':{'id':_0x2c6664[_0xee80('0x25')]['id']}})[_0xee80('0x16')](handleEntityNotFound(_0x37ae56,null))[_0xee80('0x16')](function(_0x20be27){if(_0x20be27){_0x41b7b1['model']=_[_0xee80('0x26')](db[_0xee80('0x37')]['rawAttributes']);_0x41b7b1[_0xee80('0x27')]=_[_0xee80('0x26')](_0x2c6664[_0xee80('0x27')]);_0x41b7b1[_0xee80('0x3c')]=_['intersection'](_0x41b7b1[_0xee80('0x28')],_0x41b7b1[_0xee80('0x27')]);_0x2a68c1[_0xee80('0x2b')]=_[_0xee80('0x29')](_0x41b7b1[_0xee80('0x28')],qs['fields'](_0x2c6664[_0xee80('0x27')]['fields']));_0x2a68c1['attributes']=_0x2a68c1[_0xee80('0x2b')]['length']?_0x2a68c1[_0xee80('0x2b')]:_0x41b7b1[_0xee80('0x28')];if(!_0x2c6664[_0xee80('0x27')][_0xee80('0x3d')]('nolimit')){_0x2a68c1['limit']=qs[_0xee80('0x3e')](_0x2c6664[_0xee80('0x27')][_0xee80('0x3e')]);_0x2a68c1['offset']=qs[_0xee80('0x11')](_0x2c6664[_0xee80('0x27')][_0xee80('0x11')]);}_0x2a68c1[_0xee80('0x3f')]=qs['sort'](_0x2c6664[_0xee80('0x27')][_0xee80('0x40')]);_0x2a68c1[_0xee80('0x41')]=qs[_0xee80('0x3c')](_[_0xee80('0x42')](_0x2c6664[_0xee80('0x27')],_0x41b7b1[_0xee80('0x3c')]));_0x2a68c1[_0xee80('0x41')]['FaxInteractionId']=_0x20be27['id'];if(_0x2c6664[_0xee80('0x27')][_0xee80('0x43')]){_0x2a68c1[_0xee80('0x41')]=_[_0xee80('0x2e')](_0x2a68c1[_0xee80('0x41')],{'$or':_[_0xee80('0x1c')](_0x2a68c1['attributes'],function(_0x45eb39){var _0x64efc2={};_0x64efc2[_0x45eb39]={'$like':'%'+_0x2c6664['query'][_0xee80('0x43')]+'%'};return _0x64efc2;})});}if(_0x2c6664[_0xee80('0x27')][_0xee80('0x44')]){var _0x230398=_0x2c6664['query'][_0xee80('0x44')][_0xee80('0x45')](',');var _0x1df238={};_0x1df238[_0x230398[0x0]]={'$gte':moment(_0x230398[0x1])[_0xee80('0x46')](_0xee80('0x47'))};_0x2a68c1['where']=_['merge'](_0x2a68c1['where'],_0x1df238);}_0x2a68c1=_[_0xee80('0x2e')]({},_0x2a68c1,_0x2c6664[_0xee80('0x2f')]);return db[_0xee80('0x37')][_0xee80('0x13')]({'where':_0x2a68c1['where']})['then'](function(_0x28ece0){_0x36bb5b[_0xee80('0x13')]=_0x28ece0;if(_0x2c6664['query'][_0xee80('0x48')]){_0x2a68c1['include']=[{'all':!![]}];}return db[_0xee80('0x37')][_0xee80('0x22')](_0x2a68c1);})[_0xee80('0x16')](function(_0x3f92ad){_0x36bb5b[_0xee80('0x49')]=_0x3f92ad;return _0x36bb5b;});}})[_0xee80('0x16')](respondWithFilteredResult(_0x37ae56,_0x2a68c1))[_0xee80('0x31')](handleError(_0x37ae56,null));};exports[_0xee80('0x4a')]=function(_0x1844d9,_0x1e9f44){return db['FaxInteraction'][_0xee80('0x30')]({'where':{'id':_0x1844d9[_0xee80('0x25')]['id']}})[_0xee80('0x16')](handleEntityNotFound(_0x1e9f44,null))['then'](function(_0x326252){if(_0x326252){return _0x326252[_0xee80('0x4b')](_0x1844d9[_0xee80('0x33')]['ids'],_[_0xee80('0x4c')](_0x1844d9[_0xee80('0x33')],['ids','id'])||{})[_0xee80('0x4d')](function(){return db[_0xee80('0x4e')][_0xee80('0x22')]({'attributes':['id',_0xee80('0x4f'),_0xee80('0x50')],'where':{'id':_0x1844d9['body']['ids']}});})[_0xee80('0x16')](function(_0x372fd1){socket[_0xee80('0x51')]('faxInteractionTags:save',{'id':Number(_0x1844d9['params']['id']),'tags':_0x372fd1||[]});return{'id':Number(_0x1844d9[_0xee80('0x25')]['id']),'tags':_0x372fd1||[]};});}})[_0xee80('0x16')](respondWithResult(_0x1e9f44,null))[_0xee80('0x31')](handleError(_0x1e9f44,null));};exports[_0xee80('0x52')]=function(_0x4da363,_0x3a13d6){return db[_0xee80('0x1d')][_0xee80('0x30')]({'where':{'id':_0x4da363['params']['id']}})[_0xee80('0x16')](handleEntityNotFound(_0x3a13d6,null))[_0xee80('0x16')](function(_0x218467){if(_0x218467){return _0x218467[_0xee80('0x52')](_0x4da363[_0xee80('0x27')]['ids']);}})[_0xee80('0x16')](respondWithStatusCode(_0x3a13d6,null))[_0xee80('0x31')](handleError(_0x3a13d6,null));};exports['download']=function(_0x1d583a,_0x5c053d){var _0x24d40a=moment()['unix']()[_0xee80('0x53')]();var _0x54e253=path['join'](config[_0xee80('0x54')],_0xee80('0x55'),'files',_0xee80('0x56'));var _0x2aae52=path['join'](config[_0xee80('0x54')],_0xee80('0x55'),_0xee80('0x57'),_0xee80('0x58'));var _0x442e4b=path[_0xee80('0x59')](_0x54e253,_0x24d40a);var _0x44273a=util[_0xee80('0x46')](_0xee80('0x5a'),_0x1d583a[_0xee80('0x25')]['id'],_0x24d40a);var _0x9b26e7=path[_0xee80('0x59')](_0x54e253,_0x44273a);var _0x2b9b4f=[];_0x2b9b4f[_0xee80('0x5b')]({'model':db[_0xee80('0x5c')],'as':'Attachment','raw':!![]});var _0x5888b5=[{'model':db['FaxMessage'],'as':_0xee80('0x5d'),'attributes':['id',_0xee80('0x33'),_0xee80('0x5e')],'include':_0x2b9b4f}];return db['FaxInteraction'][_0xee80('0x30')]({'where':{'id':_0x1d583a[_0xee80('0x25')]['id']},'include':_0x5888b5})[_0xee80('0x16')](handleEntityNotFound(_0x5c053d,null))['then'](function(_0x2ff2c4){if(_0x2ff2c4&&_0x2ff2c4[_0xee80('0x5d')]){var _0x691f80=_0x2ff2c4[_0xee80('0x5f')]({'plain':!![]});fs[_0xee80('0x60')](_0x442e4b);for(var _0x335fbf=0x0;_0x335fbf<_0x691f80[_0xee80('0x5d')][_0xee80('0x2c')];_0x335fbf++){var _0x331e46=_0x691f80[_0xee80('0x5d')][_0x335fbf][_0xee80('0x5c')];if(_0x331e46){var _0x16fa3e=path[_0xee80('0x59')](_0x2aae52,_0x331e46['basename']);if(fs[_0xee80('0x61')](_0x16fa3e)){fs[_0xee80('0x62')](_0x16fa3e)[_0xee80('0x63')](fs['createWriteStream'](path['join'](_0x442e4b,_0x331e46['basename'])));}}}return BPromise[_0xee80('0x64')]()['then'](function(){return new BPromise(function(_0x22a9f8,_0x398861){zipdir(_0x442e4b,{'saveTo':_0x9b26e7},function(_0x4f74e0,_0x40cca7){if(_0x4f74e0)return _0x398861(_0x4f74e0);return _0x22a9f8(_0x40cca7);});})[_0xee80('0x16')](function(){return new BPromise(function(_0x77041f,_0x223a32){rimraf(_0x442e4b,function(_0x4d9d3f){if(_0x4d9d3f)_0x223a32(_0x4d9d3f);return _0x77041f();});});})[_0xee80('0x16')](function(){return _0x5c053d[_0xee80('0x65')](_0x9b26e7,_0x44273a,function(_0x258faf){if(_0x258faf){console[_0xee80('0x66')](_0xee80('0x67'),_0x258faf);}else{fs[_0xee80('0x68')](_0x9b26e7);}});});});}else{return _0x5c053d['sendStatus'](0xc8);}})['catch'](handleError(_0x5c053d,null));}; \ No newline at end of file +var _0xa8b7=['FaxInteractionId','filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','omit','spread','faxInteractionTags:save','removeTags','download','join','root','server','files','transcript-%d-%s.zip','Attachment','Messages','createdAt','get','mkdirSync','basename','existsSync','pipe','createWriteStream','err','rimraf','bluebird','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','update','then','destroy','error','name','send','FaxInteraction','rawAttributes','fieldName','key','fax','query','user','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','body','describe','addMessage','FaxMessage','ids','findOne','hasOwnProperty','nolimit','order','where','pick'];(function(_0x505a81,_0x3cc0ae){var _0x5f0fc9=function(_0x5b9e88){while(--_0x5b9e88){_0x505a81['push'](_0x505a81['shift']());}};_0x5f0fc9(++_0x3cc0ae);}(_0xa8b7,0x138));var _0x7a8b=function(_0x20b1a7,_0x2f2ece){_0x20b1a7=_0x20b1a7-0x0;var _0x4d3a1a=_0xa8b7[_0x20b1a7];return _0x4d3a1a;};'use strict';var rimraf=require(_0x7a8b('0x0'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0x7a8b('0x1'));var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0x7a8b('0x2'));var Redis=require(_0x7a8b('0x3'));var interaction=require(_0x7a8b('0x4'));var qs=require(_0x7a8b('0x5'));var logger=require(_0x7a8b('0x6'))(_0x7a8b('0x7'));var config=require(_0x7a8b('0x8'));var db=require(_0x7a8b('0x9'))['db'];config[_0x7a8b('0xa')]=_[_0x7a8b('0xb')](config['redis'],{'host':_0x7a8b('0xc'),'port':0x18eb});var socket=require(_0x7a8b('0xd'))(new Redis(config[_0x7a8b('0xa')]));require('./faxInteraction.socket')[_0x7a8b('0xe')](socket);function respondWithStatusCode(_0x3d6d48,_0x1d25a9){_0x1d25a9=_0x1d25a9||0xcc;return function(_0x2d86f9){if(_0x2d86f9){return _0x3d6d48[_0x7a8b('0xf')](_0x1d25a9);}return _0x3d6d48[_0x7a8b('0x10')](_0x1d25a9)[_0x7a8b('0x11')]();};}function respondWithResult(_0x1c4028,_0x89d42a){_0x89d42a=_0x89d42a||0xc8;return function(_0x50e632){if(_0x50e632){return _0x1c4028[_0x7a8b('0x10')](_0x89d42a)[_0x7a8b('0x12')](_0x50e632);}};}function respondWithFilteredResult(_0x294a3c,_0x264825){return function(_0x17a2bb){if(_0x17a2bb){var _0x923325=typeof _0x264825['offset']===_0x7a8b('0x13')&&typeof _0x264825['limit']===_0x7a8b('0x13');var _0x2a12bf=_0x17a2bb[_0x7a8b('0x14')];var _0x5a742e=_0x923325?0x0:_0x264825[_0x7a8b('0x15')];var _0x5b731f=_0x923325?_0x17a2bb[_0x7a8b('0x14')]:_0x264825['offset']+_0x264825[_0x7a8b('0x16')];var _0x20b1ab;if(_0x5b731f>=_0x2a12bf){_0x5b731f=_0x2a12bf;_0x20b1ab=0xc8;}else{_0x20b1ab=0xce;}_0x294a3c[_0x7a8b('0x10')](_0x20b1ab);return _0x294a3c[_0x7a8b('0x17')](_0x7a8b('0x18'),_0x5a742e+'-'+_0x5b731f+'/'+_0x2a12bf)['json'](_0x17a2bb);}return null;};}function saveUpdates(_0x4840f3){return function(_0x106be5){if(_0x106be5){return _0x106be5[_0x7a8b('0x19')](_0x4840f3)[_0x7a8b('0x1a')](function(_0x938ca3){return _0x938ca3;});}return null;};}function removeEntity(_0x5c04e4){return function(_0x13c1e){if(_0x13c1e){return _0x13c1e[_0x7a8b('0x1b')]()[_0x7a8b('0x1a')](function(){_0x5c04e4[_0x7a8b('0x10')](0xcc)[_0x7a8b('0x11')]();});}};}function handleEntityNotFound(_0xbafe54){return function(_0x5c564a){if(!_0x5c564a){_0xbafe54[_0x7a8b('0xf')](0x194);}return _0x5c564a;};}function handleError(_0x2f4448,_0x4131e1){_0x4131e1=_0x4131e1||0x1f4;return function(_0x98dd81){logger[_0x7a8b('0x1c')](_0x98dd81['stack']);if(_0x98dd81['name']){delete _0x98dd81[_0x7a8b('0x1d')];}_0x2f4448['status'](_0x4131e1)[_0x7a8b('0x1e')](_0x98dd81);};}exports['index']=function(_0x3ec502,_0x408114){var _0x21c9c4={};var _0x347591=_['map'](db[_0x7a8b('0x1f')][_0x7a8b('0x20')],function(_0x328b7d){return{'name':_0x328b7d[_0x7a8b('0x21')],'type':_0x328b7d['type'][_0x7a8b('0x22')]};});_0x21c9c4=qs['getOptions'](_0x347591,_0x3ec502);return interaction['findAll'](_0x7a8b('0x23'),_0x3ec502[_0x7a8b('0x24')],_0x3ec502[_0x7a8b('0x25')],_0x21c9c4,_0x347591)[_0x7a8b('0x1a')](respondWithFilteredResult(_0x408114,_0x21c9c4))[_0x7a8b('0x26')](handleError(_0x408114,null));};exports[_0x7a8b('0x27')]=function(_0x3b78cd,_0x29c857){var _0x2cc7d1={'raw':![],'where':{'id':_0x3b78cd[_0x7a8b('0x28')]['id']}},_0x50b6c1={};_0x50b6c1[_0x7a8b('0x29')]=_[_0x7a8b('0x2a')](db[_0x7a8b('0x1f')]['rawAttributes']);_0x50b6c1[_0x7a8b('0x24')]=_[_0x7a8b('0x2a')](_0x3b78cd[_0x7a8b('0x24')]);_0x50b6c1[_0x7a8b('0x2b')]=_[_0x7a8b('0x2c')](_0x50b6c1[_0x7a8b('0x29')],_0x50b6c1['query']);_0x2cc7d1[_0x7a8b('0x2d')]=_['intersection'](_0x50b6c1['model'],qs['fields'](_0x3b78cd['query'][_0x7a8b('0x2e')]));_0x2cc7d1[_0x7a8b('0x2d')]=_0x2cc7d1[_0x7a8b('0x2d')][_0x7a8b('0x2f')]?_0x2cc7d1['attributes']:_0x50b6c1['model'];if(_0x3b78cd[_0x7a8b('0x24')][_0x7a8b('0x30')]){_0x2cc7d1[_0x7a8b('0x31')]=[{'all':!![]}];}_0x2cc7d1=_[_0x7a8b('0x32')]({},_0x2cc7d1,_0x3b78cd[_0x7a8b('0x33')]);return db['FaxInteraction'][_0x7a8b('0x34')](_0x2cc7d1)[_0x7a8b('0x1a')](handleEntityNotFound(_0x29c857,null))[_0x7a8b('0x1a')](respondWithResult(_0x29c857,null))['catch'](handleError(_0x29c857,null));};exports['create']=function(_0x35f374,_0x3022c0){return db[_0x7a8b('0x1f')]['create'](_0x35f374[_0x7a8b('0x35')],{})[_0x7a8b('0x1a')](respondWithResult(_0x3022c0,0xc9))[_0x7a8b('0x26')](handleError(_0x3022c0,null));};exports[_0x7a8b('0x19')]=function(_0xf3bccd,_0x2926e5){if(_0xf3bccd[_0x7a8b('0x35')]['id']){delete _0xf3bccd[_0x7a8b('0x35')]['id'];}return db[_0x7a8b('0x1f')][_0x7a8b('0x34')]({'where':{'id':_0xf3bccd[_0x7a8b('0x28')]['id']}})[_0x7a8b('0x1a')](handleEntityNotFound(_0x2926e5,null))['then'](saveUpdates(_0xf3bccd[_0x7a8b('0x35')],null))['then'](respondWithResult(_0x2926e5,null))[_0x7a8b('0x26')](handleError(_0x2926e5,null));};exports[_0x7a8b('0x1b')]=function(_0xcd716f,_0x5cdd9a){return db[_0x7a8b('0x1f')][_0x7a8b('0x34')]({'where':{'id':_0xcd716f[_0x7a8b('0x28')]['id']}})[_0x7a8b('0x1a')](handleEntityNotFound(_0x5cdd9a,null))[_0x7a8b('0x1a')](removeEntity(_0x5cdd9a,null))['catch'](handleError(_0x5cdd9a,null));};exports[_0x7a8b('0x36')]=function(_0x35d20f,_0x4a75a6){return db['FaxInteraction'][_0x7a8b('0x36')]()[_0x7a8b('0x1a')](respondWithResult(_0x4a75a6,null))[_0x7a8b('0x26')](handleError(_0x4a75a6,null));};exports[_0x7a8b('0x37')]=function(_0xa83229,_0x361396){return db[_0x7a8b('0x38')][_0x7a8b('0x34')]({'where':{'id':_0xa83229[_0x7a8b('0x28')]['id']}})['then'](handleEntityNotFound(_0x361396,null))['then'](function(_0x54fdc0){if(_0x54fdc0){return _0x54fdc0[_0x7a8b('0x37')](_0xa83229['body']['ids'],_['omit'](_0xa83229[_0x7a8b('0x35')],[_0x7a8b('0x39'),'id'])||{});}})[_0x7a8b('0x1a')](respondWithResult(_0x361396,null))[_0x7a8b('0x26')](handleError(_0x361396,null));};exports['getMessages']=function(_0x2f279d,_0x1d5fd8){var _0xb0c9c8={'raw':![],'where':{}};var _0x14c510={};var _0x41eac8={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x7a8b('0x3a')]({'where':{'id':_0x2f279d[_0x7a8b('0x28')]['id']}})[_0x7a8b('0x1a')](handleEntityNotFound(_0x1d5fd8,null))[_0x7a8b('0x1a')](function(_0x3bd992){if(_0x3bd992){_0x14c510[_0x7a8b('0x29')]=_['keys'](db[_0x7a8b('0x38')]['rawAttributes']);_0x14c510['query']=_[_0x7a8b('0x2a')](_0x2f279d[_0x7a8b('0x24')]);_0x14c510[_0x7a8b('0x2b')]=_[_0x7a8b('0x2c')](_0x14c510[_0x7a8b('0x29')],_0x14c510[_0x7a8b('0x24')]);_0xb0c9c8[_0x7a8b('0x2d')]=_[_0x7a8b('0x2c')](_0x14c510[_0x7a8b('0x29')],qs[_0x7a8b('0x2e')](_0x2f279d[_0x7a8b('0x24')]['fields']));_0xb0c9c8['attributes']=_0xb0c9c8['attributes']['length']?_0xb0c9c8['attributes']:_0x14c510[_0x7a8b('0x29')];if(!_0x2f279d[_0x7a8b('0x24')][_0x7a8b('0x3b')](_0x7a8b('0x3c'))){_0xb0c9c8[_0x7a8b('0x16')]=qs[_0x7a8b('0x16')](_0x2f279d[_0x7a8b('0x24')][_0x7a8b('0x16')]);_0xb0c9c8[_0x7a8b('0x15')]=qs['offset'](_0x2f279d[_0x7a8b('0x24')][_0x7a8b('0x15')]);}_0xb0c9c8[_0x7a8b('0x3d')]=qs['sort'](_0x2f279d['query']['sort']);_0xb0c9c8[_0x7a8b('0x3e')]=qs[_0x7a8b('0x2b')](_[_0x7a8b('0x3f')](_0x2f279d[_0x7a8b('0x24')],_0x14c510[_0x7a8b('0x2b')]));_0xb0c9c8[_0x7a8b('0x3e')][_0x7a8b('0x40')]=_0x3bd992['id'];if(_0x2f279d[_0x7a8b('0x24')][_0x7a8b('0x41')]){_0xb0c9c8[_0x7a8b('0x3e')]=_[_0x7a8b('0x32')](_0xb0c9c8[_0x7a8b('0x3e')],{'$or':_[_0x7a8b('0x42')](_0xb0c9c8['attributes'],function(_0x2e852a){var _0x12b771={};_0x12b771[_0x2e852a]={'$like':'%'+_0x2f279d['query']['filter']+'%'};return _0x12b771;})});}if(_0x2f279d[_0x7a8b('0x24')][_0x7a8b('0x43')]){var _0x2bec32=_0x2f279d['query'][_0x7a8b('0x43')][_0x7a8b('0x44')](',');var _0x490f93={};_0x490f93[_0x2bec32[0x0]]={'$gte':moment(_0x2bec32[0x1])[_0x7a8b('0x45')](_0x7a8b('0x46'))};_0xb0c9c8[_0x7a8b('0x3e')]=_[_0x7a8b('0x32')](_0xb0c9c8['where'],_0x490f93);}_0xb0c9c8=_['merge']({},_0xb0c9c8,_0x2f279d['options']);return db['FaxMessage'][_0x7a8b('0x14')]({'where':_0xb0c9c8[_0x7a8b('0x3e')]})[_0x7a8b('0x1a')](function(_0x506fd2){_0x41eac8[_0x7a8b('0x14')]=_0x506fd2;if(_0x2f279d[_0x7a8b('0x24')][_0x7a8b('0x30')]){_0xb0c9c8[_0x7a8b('0x31')]=[{'all':!![]}];}return db[_0x7a8b('0x38')][_0x7a8b('0x47')](_0xb0c9c8);})['then'](function(_0x55e28c){_0x41eac8['rows']=_0x55e28c;return _0x41eac8;});}})[_0x7a8b('0x1a')](respondWithFilteredResult(_0x1d5fd8,_0xb0c9c8))[_0x7a8b('0x26')](handleError(_0x1d5fd8,null));};exports[_0x7a8b('0x48')]=function(_0x506801,_0x1dda88){return db[_0x7a8b('0x1f')]['find']({'where':{'id':_0x506801[_0x7a8b('0x28')]['id']}})['then'](handleEntityNotFound(_0x1dda88,null))[_0x7a8b('0x1a')](function(_0x40d8f0){if(_0x40d8f0){return _0x40d8f0[_0x7a8b('0x49')](_0x506801[_0x7a8b('0x35')][_0x7a8b('0x39')],_[_0x7a8b('0x4a')](_0x506801[_0x7a8b('0x35')],['ids','id'])||{})[_0x7a8b('0x4b')](function(){return db['Tag']['findAll']({'attributes':['id',_0x7a8b('0x1d'),'color'],'where':{'id':_0x506801[_0x7a8b('0x35')][_0x7a8b('0x39')]}});})[_0x7a8b('0x1a')](function(_0x3c8d95){socket['emit'](_0x7a8b('0x4c'),{'id':Number(_0x506801[_0x7a8b('0x28')]['id']),'tags':_0x3c8d95||[]});return{'id':Number(_0x506801[_0x7a8b('0x28')]['id']),'tags':_0x3c8d95||[]};});}})[_0x7a8b('0x1a')](respondWithResult(_0x1dda88,null))[_0x7a8b('0x26')](handleError(_0x1dda88,null));};exports[_0x7a8b('0x4d')]=function(_0x37aa1b,_0x5d0747){return db[_0x7a8b('0x1f')][_0x7a8b('0x34')]({'where':{'id':_0x37aa1b[_0x7a8b('0x28')]['id']}})[_0x7a8b('0x1a')](handleEntityNotFound(_0x5d0747,null))[_0x7a8b('0x1a')](function(_0x209c4c){if(_0x209c4c){return _0x209c4c[_0x7a8b('0x4d')](_0x37aa1b[_0x7a8b('0x24')][_0x7a8b('0x39')]);}})[_0x7a8b('0x1a')](respondWithStatusCode(_0x5d0747,null))['catch'](handleError(_0x5d0747,null));};exports[_0x7a8b('0x4e')]=function(_0x5364a5,_0x2c7657){var _0x366182=moment()['unix']()['toString']();var _0x5d4d9a=path[_0x7a8b('0x4f')](config[_0x7a8b('0x50')],_0x7a8b('0x51'),_0x7a8b('0x52'),'tmp');var _0xe0583d=path[_0x7a8b('0x4f')](config[_0x7a8b('0x50')],_0x7a8b('0x51'),_0x7a8b('0x52'),'attachments');var _0x18df2b=path[_0x7a8b('0x4f')](_0x5d4d9a,_0x366182);var _0x20d41d=util[_0x7a8b('0x45')](_0x7a8b('0x53'),_0x5364a5[_0x7a8b('0x28')]['id'],_0x366182);var _0x223bc5=path['join'](_0x5d4d9a,_0x20d41d);var _0x34035a=[];_0x34035a['push']({'model':db[_0x7a8b('0x54')],'as':'Attachment','raw':!![]});var _0x5c9ced=[{'model':db['FaxMessage'],'as':_0x7a8b('0x55'),'attributes':['id','body',_0x7a8b('0x56')],'include':_0x34035a}];return db['FaxInteraction'][_0x7a8b('0x34')]({'where':{'id':_0x5364a5[_0x7a8b('0x28')]['id']},'include':_0x5c9ced})['then'](handleEntityNotFound(_0x2c7657,null))[_0x7a8b('0x1a')](function(_0x202a8e){if(_0x202a8e&&_0x202a8e[_0x7a8b('0x55')]){var _0x5f5df7=_0x202a8e[_0x7a8b('0x57')]({'plain':!![]});fs[_0x7a8b('0x58')](_0x18df2b);for(var _0x2bd4c0=0x0;_0x2bd4c0<_0x5f5df7['Messages'][_0x7a8b('0x2f')];_0x2bd4c0++){var _0x17373=_0x5f5df7[_0x7a8b('0x55')][_0x2bd4c0]['Attachment'];if(_0x17373){var _0x2140c4=path['join'](_0xe0583d,_0x17373[_0x7a8b('0x59')]);if(fs[_0x7a8b('0x5a')](_0x2140c4)){fs['createReadStream'](_0x2140c4)[_0x7a8b('0x5b')](fs[_0x7a8b('0x5c')](path[_0x7a8b('0x4f')](_0x18df2b,_0x17373[_0x7a8b('0x59')])));}}}return BPromise['resolve']()['then'](function(){return new BPromise(function(_0x3db1c7,_0x45bfe6){zipdir(_0x18df2b,{'saveTo':_0x223bc5},function(_0x2f6c0d,_0x176307){if(_0x2f6c0d)return _0x45bfe6(_0x2f6c0d);return _0x3db1c7(_0x176307);});})[_0x7a8b('0x1a')](function(){return new BPromise(function(_0x5f4f67,_0x310b04){rimraf(_0x18df2b,function(_0x5e864e){if(_0x5e864e)_0x310b04(_0x5e864e);return _0x5f4f67();});});})['then'](function(){return _0x2c7657[_0x7a8b('0x4e')](_0x223bc5,_0x20d41d,function(_0x427174){if(_0x427174){console['log'](_0x7a8b('0x5d'),_0x427174);}else{fs['unlinkSync'](_0x223bc5);}});});});}else{return _0x2c7657[_0x7a8b('0xf')](0xc8);}})[_0x7a8b('0x26')](handleError(_0x2c7657,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 6bc317e..601fb2d 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 _0xc22f=['hook','exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','remove','getUsers','setDataValue','Users','map','findAll','then','unreadMessages','length','emit','catch'];(function(_0x4c1cb3,_0x1e47c1){var _0x47c6da=function(_0x1ce81c){while(--_0x1ce81c){_0x4c1cb3['push'](_0x4c1cb3['shift']());}};_0x47c6da(++_0x1e47c1);}(_0xc22f,0x134));var _0xfc22=function(_0x7c543a,_0xb03f24){_0x7c543a=_0x7c543a-0x0;var _0x3b6680=_0xc22f[_0x7c543a];return _0x3b6680;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0xfc22('0x0'))['db'][_0xfc22('0x1')];var FaxMessage=require(_0xfc22('0x0'))['db'][_0xfc22('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xfc22('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfc22('0x4'),'afterDestroy':_0xfc22('0x5')};function emitEvent(_0x3f6ec7){return function(_0x495d6a,_0x3a8bd2,_0x308304){_0x495d6a[_0xfc22('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x171001){_0x495d6a[_0xfc22('0x7')](_0xfc22('0x8'),_0x171001[_0xfc22('0x9')](function(_0x891c40){return{'id':_0x891c40['id']};}));return FaxMessage[_0xfc22('0xa')]({'where':{'FaxInteractionId':_0x495d6a['id'],'direction':'in','read':![]},'raw':!![]});})[_0xfc22('0xb')](function(_0x5de7f6){_0x495d6a[_0xfc22('0x7')](_0xfc22('0xc'),_0x5de7f6[_0xfc22('0xd')]);FaxInteractionEvents[_0xfc22('0xe')](_0x3f6ec7+':'+_0x495d6a['id'],_0x495d6a);FaxInteractionEvents[_0xfc22('0xe')](_0x3f6ec7,_0x495d6a);_0x308304(null);})[_0xfc22('0xf')](_0x308304(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0xfc22('0x10')](e,emitEvent(event));}}module[_0xfc22('0x11')]=FaxInteractionEvents; \ No newline at end of file +var _0xaf42=['update','getUsers','then','setDataValue','map','findAll','unreadMessages','length','emit','hasOwnProperty','hook','exports','../../mysqldb','FaxInteraction','setMaxListeners','save'];(function(_0x6dd360,_0x4282c3){var _0x52ac70=function(_0x49a467){while(--_0x49a467){_0x6dd360['push'](_0x6dd360['shift']());}};_0x52ac70(++_0x4282c3);}(_0xaf42,0x1dc));var _0x2af4=function(_0xa5db05,_0x431d23){_0xa5db05=_0xa5db05-0x0;var _0x269a83=_0xaf42[_0xa5db05];return _0x269a83;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x2af4('0x0'))['db'][_0x2af4('0x1')];var FaxMessage=require(_0x2af4('0x0'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x2af4('0x2')](0x0);var events={'afterCreate':_0x2af4('0x3'),'afterUpdate':_0x2af4('0x4'),'afterDestroy':'remove'};function emitEvent(_0x160118){return function(_0x491ffe,_0xb7f70a,_0x4ec3cc){_0x491ffe[_0x2af4('0x5')]({'attributes':['id'],'raw':!![]})[_0x2af4('0x6')](function(_0x4dd4c5){_0x491ffe[_0x2af4('0x7')]('Users',_0x4dd4c5[_0x2af4('0x8')](function(_0x3f2b48){return{'id':_0x3f2b48['id']};}));return FaxMessage[_0x2af4('0x9')]({'where':{'FaxInteractionId':_0x491ffe['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2af4('0x6')](function(_0x13ef0d){_0x491ffe[_0x2af4('0x7')](_0x2af4('0xa'),_0x13ef0d[_0x2af4('0xb')]);FaxInteractionEvents[_0x2af4('0xc')](_0x160118+':'+_0x491ffe['id'],_0x491ffe);FaxInteractionEvents[_0x2af4('0xc')](_0x160118,_0x491ffe);_0x4ec3cc(null);})['catch'](_0x4ec3cc(null));};}for(var e in events){if(events[_0x2af4('0xd')](e)){var event=events[e];FaxInteraction[_0x2af4('0xe')](e,emitEvent(event));}}module[_0x2af4('0xf')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 381f8b1..97d4435 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 _0x336c=['api','moment','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger'];(function(_0x3d3e12,_0x57c459){var _0x1dcd36=function(_0x1bfab2){while(--_0x1bfab2){_0x3d3e12['push'](_0x3d3e12['shift']());}};_0x1dcd36(++_0x57c459);}(_0x336c,0xa8));var _0xc336=function(_0x4d553a,_0x12783a){_0x4d553a=_0x4d553a-0x0;var _0x4ec8a5=_0x336c[_0x4d553a];return _0x4ec8a5;};'use strict';var _=require('lodash');var util=require(_0xc336('0x0'));var logger=require(_0xc336('0x1'))(_0xc336('0x2'));var moment=require(_0xc336('0x3'));var BPromise=require('bluebird');var rp=require(_0xc336('0x4'));var fs=require('fs');var path=require(_0xc336('0x5'));var rimraf=require(_0xc336('0x6'));var config=require(_0xc336('0x7'));var attributes=require(_0xc336('0x8'));module[_0xc336('0x9')]=function(_0x1ffba,_0x5753c4){return _0x1ffba[_0xc336('0xa')](_0xc336('0xb'),attributes,{'tableName':_0xc336('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5e7ee6,_0x162913,_0x274c84){if(_0x5e7ee6[_0xc336('0xd')]('closed')){_0x5e7ee6[_0xc336('0xe')]=moment()[_0xc336('0xf')](_0xc336('0x10'));}_0x274c84(null,_0x5e7ee6);}}});}; \ No newline at end of file +var _0x4b3d=['fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction'];(function(_0x52dcb3,_0x701a4a){var _0x1bd4e8=function(_0x2208c0){while(--_0x2208c0){_0x52dcb3['push'](_0x52dcb3['shift']());}};_0x1bd4e8(++_0x701a4a);}(_0x4b3d,0x15c));var _0xd4b3=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x4b3d[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0xd4b3('0x0'));var util=require(_0xd4b3('0x1'));var logger=require(_0xd4b3('0x2'))('api');var moment=require(_0xd4b3('0x3'));var BPromise=require(_0xd4b3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd4b3('0x5'));var rimraf=require(_0xd4b3('0x6'));var config=require(_0xd4b3('0x7'));var attributes=require(_0xd4b3('0x8'));module[_0xd4b3('0x9')]=function(_0x4014ca,_0x1fd406){return _0x4014ca[_0xd4b3('0xa')](_0xd4b3('0xb'),attributes,{'tableName':_0xd4b3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1ffd0f,_0xfff683,_0x14a9cb){if(_0x1ffd0f[_0xd4b3('0xd')](_0xd4b3('0xe'))){_0x1ffd0f[_0xd4b3('0xf')]=moment()[_0xd4b3('0x10')](_0xd4b3('0x11'));}_0x14a9cb(null,_0x1ffd0f);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 168cda4..510eef7 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 _0x8a3a=['result','update','body','options','raw','where','limit','info','UpdateFaxInteraction','catch','AddTagsToFaxInteraction','find','addTags','ids','omit','spread','AddTags','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','FaxInteraction,\x20%s,\x20%s','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x4ac424,_0x554b5d){var _0xe1b890=function(_0x5e85c4){while(--_0x5e85c4){_0x4ac424['push'](_0x4ac424['shift']());}};_0xe1b890(++_0x554b5d);}(_0x8a3a,0x90));var _0xa8a3=function(_0xba95dd,_0x289889){_0xba95dd=_0xba95dd-0x0;var _0x308132=_0x8a3a[_0xba95dd];return _0x308132;};'use strict';var _=require(_0xa8a3('0x0'));var util=require(_0xa8a3('0x1'));var moment=require(_0xa8a3('0x2'));var BPromise=require(_0xa8a3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa8a3('0x4'));var db=require(_0xa8a3('0x5'))['db'];var utils=require(_0xa8a3('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xa8a3('0x7'));var jayson=require(_0xa8a3('0x8'));var client=jayson[_0xa8a3('0x9')][_0xa8a3('0xa')]({'port':0x232a});config[_0xa8a3('0xb')]=_[_0xa8a3('0xc')](config['redis'],{'host':_0xa8a3('0xd'),'port':0x18eb});var socket=require(_0xa8a3('0xe'))(new Redis(config[_0xa8a3('0xb')]));require('./faxInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x1bc940,_0x247ce4,_0x5da970){return new BPromise(function(_0x596964,_0x58db57){return client[_0xa8a3('0xf')](_0x1bc940,_0x5da970)[_0xa8a3('0x10')](function(_0x494877){logger['info'](_0xa8a3('0x11'),_0x247ce4,'request\x20sent');logger['debug'](_0xa8a3('0x12'),_0x247ce4,_0xa8a3('0x13'),JSON[_0xa8a3('0x14')](_0x494877));if(_0x494877[_0xa8a3('0x15')]){if(_0x494877[_0xa8a3('0x15')][_0xa8a3('0x16')]===0x1f4){logger[_0xa8a3('0x15')](_0xa8a3('0x11'),_0x247ce4,_0x494877['error']['message']);return _0x58db57(_0x494877['error'][_0xa8a3('0x17')]);}logger[_0xa8a3('0x15')](_0xa8a3('0x11'),_0x247ce4,_0x494877[_0xa8a3('0x15')][_0xa8a3('0x17')]);return _0x596964(_0x494877[_0xa8a3('0x15')][_0xa8a3('0x17')]);}else{logger['info']('FaxInteraction,\x20%s,\x20%s',_0x247ce4,_0xa8a3('0x13'));_0x596964(_0x494877[_0xa8a3('0x18')][_0xa8a3('0x17')]);}})['catch'](function(_0x3d9905){logger[_0xa8a3('0x15')](_0xa8a3('0x11'),_0x247ce4,_0x3d9905);_0x58db57(_0x3d9905);});});}exports['UpdateFaxInteraction']=function(_0x5ef2db){var _0x4eeda0=this;return new Promise(function(_0x529f54,_0x1c8c07){return db['FaxInteraction'][_0xa8a3('0x19')](_0x5ef2db[_0xa8a3('0x1a')],{'raw':_0x5ef2db[_0xa8a3('0x1b')]?_0x5ef2db[_0xa8a3('0x1b')][_0xa8a3('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ef2db[_0xa8a3('0x1b')]?_0x5ef2db[_0xa8a3('0x1b')][_0xa8a3('0x1d')]||null:null,'attributes':_0x5ef2db[_0xa8a3('0x1b')]?_0x5ef2db[_0xa8a3('0x1b')]['attributes']||null:null,'limit':_0x5ef2db[_0xa8a3('0x1b')]?_0x5ef2db[_0xa8a3('0x1b')][_0xa8a3('0x1e')]||null:null})[_0xa8a3('0x10')](function(_0x3ab994){logger[_0xa8a3('0x1f')]('UpdateFaxInteraction',_0x5ef2db);logger['debug'](_0xa8a3('0x20'),_0x5ef2db,JSON['stringify'](_0x3ab994));_0x529f54(_0x3ab994);})[_0xa8a3('0x21')](function(_0x533f2e){logger['error'](_0xa8a3('0x20'),_0x533f2e[_0xa8a3('0x17')],_0x5ef2db);_0x1c8c07(_0x4eeda0[_0xa8a3('0x15')](0x1f4,_0x533f2e['message']));});});};exports[_0xa8a3('0x22')]=function(_0x24dd12){return new Promise(function(_0x255545,_0x55af60){return db['FaxInteraction'][_0xa8a3('0x23')]({'where':_0x24dd12[_0xa8a3('0x1b')]?_0x24dd12[_0xa8a3('0x1b')]['where']||null:null})[_0xa8a3('0x10')](function(_0x412b81){if(_0x412b81){return _0x412b81[_0xa8a3('0x24')](_0x24dd12['body'][_0xa8a3('0x25')],_[_0xa8a3('0x26')](_0x24dd12[_0xa8a3('0x1a')],[_0xa8a3('0x25'),'id'])||{});}})[_0xa8a3('0x27')](function(_0x5b1ac3){logger[_0xa8a3('0x1f')](_0xa8a3('0x28'),_0x24dd12);logger[_0xa8a3('0x29')](_0xa8a3('0x28'),_0x24dd12,JSON[_0xa8a3('0x14')](_0x5b1ac3));_0x255545(_0x5b1ac3);})['catch'](function(_0x3f6b72){logger[_0xa8a3('0x15')](_0xa8a3('0x28'),_0x3f6b72['message'],_0x24dd12);_0x55af60(_this[_0xa8a3('0x15')](0x1f4,_0x3f6b72[_0xa8a3('0x17')]));});});}; \ No newline at end of file +var _0xbada=['catch','UpdateFaxInteraction','update','body','raw','options','where','limit','info','find','ids','omit','spread','AddTags','debug','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','socket.io-emitter','./faxInteraction.socket','register','request','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbada,0x1e3));var _0xabad=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xbada[_0x49b207];return _0x2dc8fa;};'use strict';var _=require(_0xabad('0x0'));var util=require('util');var moment=require(_0xabad('0x1'));var BPromise=require('bluebird');var rs=require(_0xabad('0x2'));var fs=require('fs');var Redis=require(_0xabad('0x3'));var db=require(_0xabad('0x4'))['db'];var utils=require(_0xabad('0x5'));var logger=require(_0xabad('0x6'))('rpc');var config=require(_0xabad('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xabad('0x8')][_0xabad('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xabad('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xabad('0xb'))(new Redis(config[_0xabad('0xa')]));require(_0xabad('0xc'))[_0xabad('0xd')](socket);function respondWithRpcPromise(_0x59603c,_0x3a5508,_0x4bbd7f){return new BPromise(function(_0x1d0ba3,_0x2d9040){return client[_0xabad('0xe')](_0x59603c,_0x4bbd7f)[_0xabad('0xf')](function(_0x34e844){logger['info'](_0xabad('0x10'),_0x3a5508,_0xabad('0x11'));logger['debug'](_0xabad('0x12'),_0x3a5508,_0xabad('0x11'),JSON[_0xabad('0x13')](_0x34e844));if(_0x34e844[_0xabad('0x14')]){if(_0x34e844[_0xabad('0x14')][_0xabad('0x15')]===0x1f4){logger[_0xabad('0x14')](_0xabad('0x10'),_0x3a5508,_0x34e844[_0xabad('0x14')]['message']);return _0x2d9040(_0x34e844[_0xabad('0x14')]['message']);}logger[_0xabad('0x14')](_0xabad('0x10'),_0x3a5508,_0x34e844[_0xabad('0x14')]['message']);return _0x1d0ba3(_0x34e844[_0xabad('0x14')][_0xabad('0x16')]);}else{logger['info'](_0xabad('0x10'),_0x3a5508,_0xabad('0x11'));_0x1d0ba3(_0x34e844[_0xabad('0x17')][_0xabad('0x16')]);}})[_0xabad('0x18')](function(_0x1888f6){logger['error'](_0xabad('0x10'),_0x3a5508,_0x1888f6);_0x2d9040(_0x1888f6);});});}exports[_0xabad('0x19')]=function(_0xb4466f){var _0x47f316=this;return new Promise(function(_0x444f63,_0x5b32d1){return db['FaxInteraction'][_0xabad('0x1a')](_0xb4466f[_0xabad('0x1b')],{'raw':_0xb4466f['options']?_0xb4466f['options'][_0xabad('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb4466f[_0xabad('0x1d')]?_0xb4466f[_0xabad('0x1d')][_0xabad('0x1e')]||null:null,'attributes':_0xb4466f[_0xabad('0x1d')]?_0xb4466f['options']['attributes']||null:null,'limit':_0xb4466f[_0xabad('0x1d')]?_0xb4466f[_0xabad('0x1d')][_0xabad('0x1f')]||null:null})[_0xabad('0xf')](function(_0x9a1a12){logger[_0xabad('0x20')](_0xabad('0x19'),_0xb4466f);logger['debug'](_0xabad('0x19'),_0xb4466f,JSON[_0xabad('0x13')](_0x9a1a12));_0x444f63(_0x9a1a12);})[_0xabad('0x18')](function(_0x67094e){logger['error'](_0xabad('0x19'),_0x67094e[_0xabad('0x16')],_0xb4466f);_0x5b32d1(_0x47f316[_0xabad('0x14')](0x1f4,_0x67094e[_0xabad('0x16')]));});});};exports['AddTagsToFaxInteraction']=function(_0x383de1){return new Promise(function(_0x31727a,_0x5adb8b){return db['FaxInteraction'][_0xabad('0x21')]({'where':_0x383de1[_0xabad('0x1d')]?_0x383de1[_0xabad('0x1d')][_0xabad('0x1e')]||null:null})[_0xabad('0xf')](function(_0x41fe03){if(_0x41fe03){return _0x41fe03['addTags'](_0x383de1[_0xabad('0x1b')][_0xabad('0x22')],_[_0xabad('0x23')](_0x383de1[_0xabad('0x1b')],['ids','id'])||{});}})[_0xabad('0x24')](function(_0x113089){logger[_0xabad('0x20')](_0xabad('0x25'),_0x383de1);logger[_0xabad('0x26')](_0xabad('0x25'),_0x383de1,JSON[_0xabad('0x13')](_0x113089));_0x31727a(_0x113089);})[_0xabad('0x18')](function(_0x231d75){logger[_0xabad('0x14')](_0xabad('0x25'),_0x231d75[_0xabad('0x16')],_0x383de1);_0x5adb8b(_this[_0xabad('0x14')](0x1f4,_0x231d75[_0xabad('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 387b388..316e8e9 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 _0xea01=['register','length','faxInteraction:','save','remove','update','emit','removeListener'];(function(_0xa54290,_0x50b0cf){var _0x37625f=function(_0x17d8b0){while(--_0x17d8b0){_0xa54290['push'](_0xa54290['shift']());}};_0x37625f(++_0x50b0cf);}(_0xea01,0x1a3));var _0x1ea0=function(_0x302c30,_0xd40a14){_0x302c30=_0x302c30-0x0;var _0x16e434=_0xea01[_0x302c30];return _0x16e434;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x1ea0('0x0'),_0x1ea0('0x1'),_0x1ea0('0x2')];function createListener(_0x554457,_0x37d3ce){return function(_0x2c713b){_0x37d3ce[_0x1ea0('0x3')](_0x554457,_0x2c713b);};}function removeListener(_0xa15b41,_0x10ee1b){return function(){FaxInteractionEvents[_0x1ea0('0x4')](_0xa15b41,_0x10ee1b);};}exports[_0x1ea0('0x5')]=function(_0x13af7d){for(var _0x43c2e5=0x0,_0x2c1226=events[_0x1ea0('0x6')];_0x43c2e5<_0x2c1226;_0x43c2e5++){var _0x517644=events[_0x43c2e5];var _0x4e5e4f=createListener(_0x1ea0('0x7')+_0x517644,_0x13af7d);FaxInteractionEvents['on'](_0x517644,_0x4e5e4f);}}; \ No newline at end of file +var _0x706f=['./faxInteraction.events','save','remove','update','emit','removeListener','register','length','faxInteraction:'];(function(_0x373281,_0x466f90){var _0x2642b0=function(_0xbe28c5){while(--_0xbe28c5){_0x373281['push'](_0x373281['shift']());}};_0x2642b0(++_0x466f90);}(_0x706f,0x132));var _0xf706=function(_0x4039d2,_0x1e800e){_0x4039d2=_0x4039d2-0x0;var _0x264d8f=_0x706f[_0x4039d2];return _0x264d8f;};'use strict';var FaxInteractionEvents=require(_0xf706('0x0'));var events=[_0xf706('0x1'),_0xf706('0x2'),_0xf706('0x3')];function createListener(_0x524600,_0x4d9740){return function(_0x2d01c4){_0x4d9740[_0xf706('0x4')](_0x524600,_0x2d01c4);};}function removeListener(_0x464e54,_0x422818){return function(){FaxInteractionEvents[_0xf706('0x5')](_0x464e54,_0x422818);};}exports[_0xf706('0x6')]=function(_0x1be55e){for(var _0x261901=0x0,_0x503b80=events[_0xf706('0x7')];_0x261901<_0x503b80;_0x261901++){var _0x4a4a04=events[_0x261901];var _0x3713ed=createListener(_0xf706('0x8')+_0x4a4a04,_0x1be55e);FaxInteractionEvents['on'](_0x4a4a04,_0x3713ed);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 0b951d8..493e101 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 _0x30a7=['faxinteraction:addtags','/:id','tracked','faxinteraction:update','delete','faxinteraction:destroy','removeTags','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./faxInteraction.controller','isAuthenticated','get','describe','show','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','fax'];(function(_0x5571d2,_0x352fbe){var _0x487159=function(_0x5a928d){while(--_0x5a928d){_0x5571d2['push'](_0x5571d2['shift']());}};_0x487159(++_0x352fbe);}(_0x30a7,0xf1));var _0x730a=function(_0xc69a06,_0x57827d){_0xc69a06=_0xc69a06-0x0;var _0x1d4b47=_0x30a7[_0xc69a06];return _0x1d4b47;};'use strict';var multer=require('multer');var util=require(_0x730a('0x0'));var path=require(_0x730a('0x1'));var timeout=require(_0x730a('0x2'));var express=require(_0x730a('0x3'));var router=express['Router']();var fs_extra=require(_0x730a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x730a('0x5'));var config=require('../../config/environment');var controller=require(_0x730a('0x6'));router['get']('/',auth[_0x730a('0x7')](),controller['index']);router[_0x730a('0x8')]('/describe',auth[_0x730a('0x7')](),controller[_0x730a('0x9')]);router[_0x730a('0x8')]('/:id',auth[_0x730a('0x7')](),controller[_0x730a('0xa')]);router[_0x730a('0x8')](_0x730a('0xb'),auth['isAuthenticated'](),controller['getMessages']);router[_0x730a('0x8')](_0x730a('0xc'),auth[_0x730a('0x7')](),controller[_0x730a('0xd')]);router[_0x730a('0xe')]('/',auth['isAuthenticated'](),controller[_0x730a('0xf')]);router[_0x730a('0xe')](_0x730a('0xb'),auth[_0x730a('0x7')](),controller[_0x730a('0x10')]);router['post'](_0x730a('0x11'),auth['isAuthenticated'](),interaction['tracked'](_0x730a('0x12'),_0x730a('0x13')),controller['addTags']);router['put'](_0x730a('0x14'),auth[_0x730a('0x7')](),interaction[_0x730a('0x15')](_0x730a('0x12'),_0x730a('0x16')),controller['update']);router[_0x730a('0x17')]('/:id',auth['isAuthenticated'](),interaction['tracked']('fax',_0x730a('0x18')),controller['destroy']);router[_0x730a('0x17')](_0x730a('0x11'),auth[_0x730a('0x7')](),controller[_0x730a('0x19')]);module['exports']=router; \ No newline at end of file +var _0x7da1=['path','express','Router','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','update','delete','exports','multer','util'];(function(_0x20c6f1,_0x21fa65){var _0x43c3bf=function(_0x40c2dd){while(--_0x40c2dd){_0x20c6f1['push'](_0x20c6f1['shift']());}};_0x43c3bf(++_0x21fa65);}(_0x7da1,0xee));var _0x17da=function(_0x5d36ff,_0x314354){_0x5d36ff=_0x5d36ff-0x0;var _0x203d76=_0x7da1[_0x5d36ff];return _0x203d76;};'use strict';var multer=require(_0x17da('0x0'));var util=require(_0x17da('0x1'));var path=require(_0x17da('0x2'));var timeout=require('connect-timeout');var express=require(_0x17da('0x3'));var router=express[_0x17da('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x17da('0x5'));var interaction=require(_0x17da('0x6'));var config=require('../../config/environment');var controller=require(_0x17da('0x7'));router[_0x17da('0x8')]('/',auth[_0x17da('0x9')](),controller[_0x17da('0xa')]);router[_0x17da('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x17da('0x8')](_0x17da('0xb'),auth[_0x17da('0x9')](),controller[_0x17da('0xc')]);router[_0x17da('0x8')](_0x17da('0xd'),auth[_0x17da('0x9')](),controller[_0x17da('0xe')]);router['get'](_0x17da('0xf'),auth[_0x17da('0x9')](),controller[_0x17da('0x10')]);router[_0x17da('0x11')]('/',auth[_0x17da('0x9')](),controller[_0x17da('0x12')]);router[_0x17da('0x11')]('/:id/messages',auth[_0x17da('0x9')](),controller[_0x17da('0x13')]);router[_0x17da('0x11')](_0x17da('0x14'),auth[_0x17da('0x9')](),interaction[_0x17da('0x15')](_0x17da('0x16'),_0x17da('0x17')),controller[_0x17da('0x18')]);router[_0x17da('0x19')](_0x17da('0xb'),auth[_0x17da('0x9')](),interaction['tracked']('fax',_0x17da('0x1a')),controller[_0x17da('0x1b')]);router['delete']('/:id',auth[_0x17da('0x9')](),interaction[_0x17da('0x15')](_0x17da('0x16'),'faxinteraction:destroy'),controller['destroy']);router[_0x17da('0x1c')](_0x17da('0x14'),auth[_0x17da('0x9')](),controller['removeTags']);module[_0x17da('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index dc21b39..f4a110c 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 _0xfd28=['exports','TEXT','BOOLEAN','out'];(function(_0x3f641f,_0x19961c){var _0x547c8c=function(_0x58400b){while(--_0x58400b){_0x3f641f['push'](_0x3f641f['shift']());}};_0x547c8c(++_0x19961c);}(_0xfd28,0x148));var _0x8fd2=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0xfd28[_0xc8a931];return _0x28bd27;};'use strict';var Sequelize=require('sequelize');module[_0x8fd2('0x0')]={'body':{'type':Sequelize[_0x8fd2('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x8fd2('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x8fd2('0x3')),'defaultValue':_0x8fd2('0x3'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x8fd2('0x1')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xbe31=['medium','BOOLEAN','ENUM','out','DATE','exports','TEXT'];(function(_0x45e351,_0x234f5d){var _0x32453b=function(_0x16c8a5){while(--_0x16c8a5){_0x45e351['push'](_0x45e351['shift']());}};_0x32453b(++_0x234f5d);}(_0xbe31,0x83));var _0x1be3=function(_0x2dfd68,_0x2fa790){_0x2dfd68=_0x2dfd68-0x0;var _0x4a2a63=_0xbe31[_0x2dfd68];return _0x4a2a63;};'use strict';var Sequelize=require('sequelize');module[_0x1be3('0x0')]={'body':{'type':Sequelize[_0x1be3('0x1')](_0x1be3('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x1be3('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1be3('0x4')]('in',_0x1be3('0x5')),'defaultValue':_0x1be3('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x1be3('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x1be3('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 210bc81..542d949 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 _0x0b72=['rawAttributes','fieldName','key','model','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','merge','type','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','keys','options','body','find','../../config/logger','fax-interactions','accept','read','format','UserId','user','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','SELECT','contact','User','fullname','email','internal','agent','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','fax','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','rejectmessage','create','CmContact','findOne','AttachmentId','SendFax','FaxAccountId','basename','download','join','root','server','Attachment','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','apply','save','update','then','destroy','stack','name','send','index','map','FaxMessage'];(function(_0x25e37d,_0x48304f){var _0x9db28d=function(_0x2df556){while(--_0x2df556){_0x25e37d['push'](_0x25e37d['shift']());}};_0x9db28d(++_0x48304f);}(_0x0b72,0x16b));var _0x20b7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0b72[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x20b7('0x0'));var rimraf=require(_0x20b7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x20b7('0x2'));var rp=require('request-promise');var moment=require(_0x20b7('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x20b7('0x4'));var util=require(_0x20b7('0x5'));var path=require(_0x20b7('0x6'));var sox=require(_0x20b7('0x7'));var csv=require(_0x20b7('0x8'));var ejs=require(_0x20b7('0x9'));var fs=require('fs');var fs_extra=require(_0x20b7('0xa'));var _=require(_0x20b7('0xb'));var squel=require(_0x20b7('0xc'));var crypto=require('crypto');var jsforce=require(_0x20b7('0xd'));var deskjs=require(_0x20b7('0xe'));var toCsv=require(_0x20b7('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x20b7('0xf'));var qs=require(_0x20b7('0x10'));var as=require(_0x20b7('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x20b7('0x12'));var utils=require(_0x20b7('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x20b7('0x14'));var db=require(_0x20b7('0x15'))['db'];config[_0x20b7('0x16')]=_['defaults'](config[_0x20b7('0x16')],{'host':_0x20b7('0x17'),'port':0x18eb});var socket=require(_0x20b7('0x18'))(new Redis(config[_0x20b7('0x16')]));require(_0x20b7('0x19'))[_0x20b7('0x1a')](socket);var jayson=require(_0x20b7('0x1b'));var client=jayson[_0x20b7('0x1c')][_0x20b7('0x1d')]({'port':0x232c});var client9002=jayson[_0x20b7('0x1c')][_0x20b7('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x160104,_0x2f22cc,_0xc38c01,_0x599cc2){return new BPromise(function(_0x535f67,_0x523565){var _0x6b210a=_0x599cc2||client;return _0x6b210a[_0x20b7('0x1e')](_0x160104,_0xc38c01)['then'](function(_0x4f0f55){logger[_0x20b7('0x1f')](_0x20b7('0x20'),_0x2f22cc,'request\x20sent');logger[_0x20b7('0x21')](_0x20b7('0x22'),_0x2f22cc,_0x20b7('0x23'),JSON[_0x20b7('0x24')](_0x4f0f55));if(_0x4f0f55[_0x20b7('0x25')]){if(_0x4f0f55['error'][_0x20b7('0x26')]===0x1f4){logger[_0x20b7('0x25')](_0x20b7('0x20'),_0x2f22cc,_0x4f0f55[_0x20b7('0x25')][_0x20b7('0x27')]);return _0x523565(_0x4f0f55['error']['message']);}logger[_0x20b7('0x25')](_0x20b7('0x20'),_0x2f22cc,_0x4f0f55[_0x20b7('0x25')][_0x20b7('0x27')]);return _0x535f67(_0x4f0f55['error'][_0x20b7('0x27')]);}else{logger[_0x20b7('0x1f')](_0x20b7('0x20'),_0x2f22cc,_0x20b7('0x23'));_0x535f67(_0x4f0f55['result'][_0x20b7('0x27')]);}})[_0x20b7('0x28')](function(_0x4b8a73){logger['error'](_0x20b7('0x20'),_0x2f22cc,_0x4b8a73);_0x523565(_0x4b8a73);});});}function respondWithStatusCode(_0x4e7110,_0x571153){_0x571153=_0x571153||0xcc;return function(_0x4e0101){if(_0x4e0101){return _0x4e7110[_0x20b7('0x29')](_0x571153);}return _0x4e7110[_0x20b7('0x2a')](_0x571153)[_0x20b7('0x2b')]();};}function respondWithResult(_0x6ef0d4,_0x3a7f7a){_0x3a7f7a=_0x3a7f7a||0xc8;return function(_0x2c07e7){if(_0x2c07e7){return _0x6ef0d4[_0x20b7('0x2a')](_0x3a7f7a)[_0x20b7('0x2c')](_0x2c07e7);}};}function respondWithFilteredResult(_0x5b01d3,_0x6f0c12){return function(_0x19c97c){if(_0x19c97c){var _0x1acb9a=typeof _0x6f0c12[_0x20b7('0x2d')]===_0x20b7('0x2e')&&typeof _0x6f0c12[_0x20b7('0x2f')]==='undefined';var _0x5ec4ee=_0x19c97c[_0x20b7('0x30')];var _0x25400d=_0x1acb9a?0x0:_0x6f0c12[_0x20b7('0x2d')];var _0x1bbfb4=_0x1acb9a?_0x19c97c['count']:_0x6f0c12['offset']+_0x6f0c12[_0x20b7('0x2f')];var _0x127db8;if(_0x1bbfb4>=_0x5ec4ee){_0x1bbfb4=_0x5ec4ee;_0x127db8=0xc8;}else{_0x127db8=0xce;}_0x5b01d3['status'](_0x127db8);return _0x5b01d3['set']('Content-Range',_0x25400d+'-'+_0x1bbfb4+'/'+_0x5ec4ee)[_0x20b7('0x2c')](_0x19c97c);}return null;};}function patchUpdates(_0x11758f){return function(_0xcb3e4f){try{jsonpatch[_0x20b7('0x31')](_0xcb3e4f,_0x11758f,!![]);}catch(_0x48a88b){return BPromise['reject'](_0x48a88b);}return _0xcb3e4f[_0x20b7('0x32')]();};}function saveUpdates(_0x14c3ba,_0x4e6d9d){return function(_0x565448){if(_0x565448){return _0x565448[_0x20b7('0x33')](_0x14c3ba)[_0x20b7('0x34')](function(_0x1722b3){return _0x1722b3;});}return null;};}function removeEntity(_0xc5de90,_0x4a854b){return function(_0x40ec64){if(_0x40ec64){return _0x40ec64[_0x20b7('0x35')]()[_0x20b7('0x34')](function(){_0xc5de90[_0x20b7('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11dc3d,_0x1b7334){return function(_0x3a7767){if(!_0x3a7767){_0x11dc3d[_0x20b7('0x29')](0x194);}return _0x3a7767;};}function handleError(_0x16b1f1,_0x36cbf8){_0x36cbf8=_0x36cbf8||0x1f4;return function(_0x2a2540){logger[_0x20b7('0x25')](_0x2a2540[_0x20b7('0x36')]);if(_0x2a2540[_0x20b7('0x37')]){delete _0x2a2540['name'];}_0x16b1f1[_0x20b7('0x2a')](_0x36cbf8)[_0x20b7('0x38')](_0x2a2540);};}exports[_0x20b7('0x39')]=function(_0x581a4e,_0x31a217){var _0x19cb53={},_0x4d5966={},_0x3df6fd={'count':0x0,'rows':[]};var _0x37ba9c=_[_0x20b7('0x3a')](db[_0x20b7('0x3b')][_0x20b7('0x3c')],function(_0x41c84c){return{'name':_0x41c84c[_0x20b7('0x3d')],'type':_0x41c84c['type'][_0x20b7('0x3e')]};});_0x4d5966[_0x20b7('0x3f')]=_[_0x20b7('0x3a')](_0x37ba9c,'name');_0x4d5966[_0x20b7('0x40')]=_['keys'](_0x581a4e[_0x20b7('0x40')]);_0x4d5966['filters']=_[_0x20b7('0x41')](_0x4d5966[_0x20b7('0x3f')],_0x4d5966[_0x20b7('0x40')]);_0x19cb53['attributes']=_['intersection'](_0x4d5966['model'],qs[_0x20b7('0x42')](_0x581a4e[_0x20b7('0x40')][_0x20b7('0x42')]));_0x19cb53['attributes']=_0x19cb53[_0x20b7('0x43')][_0x20b7('0x44')]?_0x19cb53['attributes']:_0x4d5966[_0x20b7('0x3f')];if(!_0x581a4e[_0x20b7('0x40')][_0x20b7('0x45')]('nolimit')){_0x19cb53[_0x20b7('0x2f')]=qs[_0x20b7('0x2f')](_0x581a4e['query']['limit']);_0x19cb53[_0x20b7('0x2d')]=qs['offset'](_0x581a4e[_0x20b7('0x40')][_0x20b7('0x2d')]);}_0x19cb53[_0x20b7('0x46')]=qs['sort'](_0x581a4e[_0x20b7('0x40')][_0x20b7('0x47')]);_0x19cb53[_0x20b7('0x48')]=qs[_0x20b7('0x49')](_['pick'](_0x581a4e[_0x20b7('0x40')],_0x4d5966[_0x20b7('0x49')]),_0x37ba9c);if(_0x581a4e[_0x20b7('0x40')]['filter']){_0x19cb53[_0x20b7('0x48')]=_[_0x20b7('0x4a')](_0x19cb53[_0x20b7('0x48')],{'$or':_[_0x20b7('0x3a')](_0x37ba9c,function(_0x40ee32){if(_0x40ee32[_0x20b7('0x4b')]!==_0x20b7('0x4c')){var _0x3666c7={};_0x3666c7[_0x40ee32[_0x20b7('0x37')]]={'$like':'%'+_0x581a4e['query'][_0x20b7('0x4d')]+'%'};return _0x3666c7;}})});}_0x19cb53=_[_0x20b7('0x4a')]({},_0x19cb53,_0x581a4e['options']);var _0x4b6703={'where':_0x19cb53[_0x20b7('0x48')]};return db[_0x20b7('0x3b')][_0x20b7('0x30')](_0x4b6703)[_0x20b7('0x34')](function(_0x40caef){_0x3df6fd['count']=_0x40caef;if(_0x581a4e['query'][_0x20b7('0x4e')]){_0x19cb53[_0x20b7('0x4f')]=[{'all':!![]}];}return db[_0x20b7('0x3b')][_0x20b7('0x50')](_0x19cb53);})[_0x20b7('0x34')](function(_0x473a2d){_0x3df6fd[_0x20b7('0x51')]=_0x473a2d;return _0x3df6fd;})[_0x20b7('0x34')](respondWithFilteredResult(_0x31a217,_0x19cb53))['catch'](handleError(_0x31a217,null));};exports[_0x20b7('0x52')]=function(_0x340d4a,_0xb907c3){var _0x2c6c63={'raw':!![],'where':{'id':_0x340d4a[_0x20b7('0x53')]['id']}},_0x27981b={};_0x27981b[_0x20b7('0x3f')]=_[_0x20b7('0x54')](db['FaxMessage'][_0x20b7('0x3c')]);_0x27981b['query']=_[_0x20b7('0x54')](_0x340d4a['query']);_0x27981b[_0x20b7('0x49')]=_[_0x20b7('0x41')](_0x27981b[_0x20b7('0x3f')],_0x27981b[_0x20b7('0x40')]);_0x2c6c63[_0x20b7('0x43')]=_[_0x20b7('0x41')](_0x27981b['model'],qs[_0x20b7('0x42')](_0x340d4a[_0x20b7('0x40')]['fields']));_0x2c6c63[_0x20b7('0x43')]=_0x2c6c63['attributes'][_0x20b7('0x44')]?_0x2c6c63[_0x20b7('0x43')]:_0x27981b[_0x20b7('0x3f')];if(_0x340d4a[_0x20b7('0x40')]['includeAll']){_0x2c6c63[_0x20b7('0x4f')]=[{'all':!![]}];}_0x2c6c63=_[_0x20b7('0x4a')]({},_0x2c6c63,_0x340d4a[_0x20b7('0x55')]);return db[_0x20b7('0x3b')]['find'](_0x2c6c63)['then'](handleEntityNotFound(_0xb907c3,null))['then'](respondWithResult(_0xb907c3,null))['catch'](handleError(_0xb907c3,null));};exports[_0x20b7('0x33')]=function(_0x4ef4b8,_0x1833f2){if(_0x4ef4b8[_0x20b7('0x56')]['id']){delete _0x4ef4b8[_0x20b7('0x56')]['id'];}return db[_0x20b7('0x3b')][_0x20b7('0x57')]({'where':{'id':_0x4ef4b8[_0x20b7('0x53')]['id']}})['then'](handleEntityNotFound(_0x1833f2,null))[_0x20b7('0x34')](saveUpdates(_0x4ef4b8[_0x20b7('0x56')],null))[_0x20b7('0x34')](respondWithResult(_0x1833f2,null))[_0x20b7('0x28')](handleError(_0x1833f2,null));};exports[_0x20b7('0x35')]=function(_0x3bdbb9,_0x426a3f){return db[_0x20b7('0x3b')]['find']({'where':{'id':_0x3bdbb9[_0x20b7('0x53')]['id']}})[_0x20b7('0x34')](handleEntityNotFound(_0x426a3f,null))[_0x20b7('0x34')](removeEntity(_0x426a3f,null))[_0x20b7('0x28')](handleError(_0x426a3f,null));};exports['describe']=function(_0x15e794,_0x5a6c1e){return db[_0x20b7('0x3b')]['describe']()[_0x20b7('0x34')](respondWithResult(_0x5a6c1e,null))[_0x20b7('0x28')](handleError(_0x5a6c1e,null));};var interaction_log=require(_0x20b7('0x58'))(_0x20b7('0x59'));exports[_0x20b7('0x5a')]=function(_0x4e1c72,_0x320e8f,_0x282335){var _0x4ed73d={'agent':{},'channel':'fax'};if(_0x4e1c72[_0x20b7('0x56')]['id']){delete _0x4e1c72[_0x20b7('0x56')]['id'];}_0x4e1c72[_0x20b7('0x56')][_0x20b7('0x5b')]=!![];_0x4e1c72[_0x20b7('0x56')]['readAt']=moment()[_0x20b7('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x4e1c72[_0x20b7('0x56')]['UserId']=_0x4e1c72[_0x20b7('0x56')][_0x20b7('0x5d')]||_0x4e1c72[_0x20b7('0x5e')]['id'];_0x4ed73d['agent']['id']=_0x4e1c72[_0x20b7('0x56')][_0x20b7('0x5d')];return db[_0x20b7('0x3b')][_0x20b7('0x57')]({'where':{'id':_0x4e1c72[_0x20b7('0x53')]['id'],'UserId':null}})[_0x20b7('0x34')](handleEntityNotFound(_0x320e8f,null))[_0x20b7('0x34')](saveUpdates(_0x4e1c72[_0x20b7('0x56')],null))['then'](function(_0x328631){if(_0x328631){_0x4ed73d[_0x20b7('0x27')]=_0x328631[_0x20b7('0x5f')]({'plain':!![]});return db[_0x20b7('0x60')]['find']({'where':{'id':_0x328631[_0x20b7('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x320e8f,null))['then'](function(_0x179b2f){if(_0x179b2f){return _0x179b2f['update']({'UserId':_0x4e1c72[_0x20b7('0x56')][_0x20b7('0x5d')],'read1stAt':_[_0x20b7('0x62')](_0x179b2f[_0x20b7('0x63')])?moment()[_0x20b7('0x5c')](_0x20b7('0x64')):undefined});}return null;})[_0x20b7('0x34')](function(_0x563b75){if(_0x563b75){_0x4ed73d['interaction']=_0x563b75[_0x20b7('0x5f')]({'plain':!![]});interaction_log[_0x20b7('0x1f')](_0x20b7('0x65'),_0x4e1c72[_0x20b7('0x5e')]['id'],_0x4e1c72[_0x20b7('0x5e')]['name'],_0x4e1c72['user']['role'],_0x4ed73d[_0x20b7('0x66')]['id'],_0x4e1c72['body']?JSON[_0x20b7('0x24')](_0x4e1c72[_0x20b7('0x56')]):_0x20b7('0x67'));return respondWithRpcPromise(_0x20b7('0x68'),'acceptMessage',_0x4ed73d);}return null;})[_0x20b7('0x34')](function(_0x17f07a){var _0x28b97b=_0x20b7('0x69')+_0x17f07a[_0x20b7('0x27')][_0x20b7('0x6a')];return db['sequelize'][_0x20b7('0x40')](_0x28b97b,{'type':db['Sequelize']['QueryTypes'][_0x20b7('0x6b')],'raw':!![]})['then'](function(_0x51e5fa){return _0x51e5fa;});})[_0x20b7('0x34')](function(_0x50f82f){if(_0x50f82f){_0x4ed73d[_0x20b7('0x27')][_0x20b7('0x6c')]=_0x50f82f[0x0];if(!_0x4e1c72[_0x20b7('0x56')][_0x20b7('0x5d')])return;return db[_0x20b7('0x6d')][_0x20b7('0x57')]({'where':{'id':_0x4e1c72['body'][_0x20b7('0x5d')],'role':'agent'},'attributes':['id',_0x20b7('0x37'),_0x20b7('0x6e'),_0x20b7('0x6f'),_0x20b7('0x70')],'raw':!![]});}return null;})[_0x20b7('0x34')](function(_0x5d6526){if(!_0x5d6526)return null;_0x4ed73d[_0x20b7('0x27')][_0x20b7('0x71')]=_0x5d6526;return _0x4ed73d;})[_0x20b7('0x34')](function(_0x56c0c3){if(_0x56c0c3){if(_0x4e1c72[_0x20b7('0x56')][_0x20b7('0x72')]){_0x4ed73d[_0x20b7('0x27')][_0x20b7('0x73')]=util[_0x20b7('0x5c')](_0x20b7('0x74'),_0x4e1c72[_0x20b7('0x5e')][_0x20b7('0x37')]);_0x4ed73d[_0x20b7('0x27')]['channel']=_0x4ed73d[_0x20b7('0x75')];_0x4ed73d[_0x20b7('0x27')][_0x20b7('0x76')]=_0x4ed73d[_0x20b7('0x75')];_0x4ed73d[_0x20b7('0x27')][_0x20b7('0x77')]=_0x20b7('0x5a');return respondWithRpcPromise(_0x20b7('0x78'),_0x20b7('0x78'),{'event':_0x20b7('0x79'),'message':_0x4ed73d['message']},client9002)[_0x20b7('0x34')](function(){return _0x4ed73d;});}return _0x4ed73d;}return null;})[_0x20b7('0x34')](respondWithResult(_0x320e8f,null))[_0x20b7('0x28')](handleError(_0x320e8f,null));};var interaction_log=require(_0x20b7('0x58'))(_0x20b7('0x59'));exports[_0x20b7('0x7a')]=function(_0x174181,_0x55a4e0,_0x34bd2c){var _0x559411={'agent':{},'channel':_0x20b7('0x7b')};if(_0x174181[_0x20b7('0x56')]['id']){delete _0x174181[_0x20b7('0x56')]['id'];}_0x174181[_0x20b7('0x56')][_0x20b7('0x5d')]=_0x174181[_0x20b7('0x56')][_0x20b7('0x5d')]||_0x174181[_0x20b7('0x5e')]['id'];_0x559411['agent']['id']=_0x174181[_0x20b7('0x56')]['UserId'];return db[_0x20b7('0x3b')][_0x20b7('0x57')]({'where':{'id':_0x174181[_0x20b7('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x55a4e0,null))[_0x20b7('0x34')](function(_0x3a5659){if(_0x3a5659){_0x559411[_0x20b7('0x27')]=_0x3a5659[_0x20b7('0x5f')]({'plain':!![]});return db[_0x20b7('0x60')][_0x20b7('0x57')]({'where':{'id':_0x3a5659[_0x20b7('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x55a4e0,null))[_0x20b7('0x34')](function(_0x507c4e){if(_0x507c4e){_0x559411[_0x20b7('0x66')]=_0x507c4e['get']({'plain':!![]});interaction_log['info'](_0x20b7('0x7c'),_0x174181['user']['id'],_0x174181[_0x20b7('0x5e')][_0x20b7('0x37')],_0x174181[_0x20b7('0x5e')][_0x20b7('0x7d')],_0x559411[_0x20b7('0x66')]['id'],_0x174181[_0x20b7('0x56')]?JSON[_0x20b7('0x24')](_0x174181[_0x20b7('0x56')]):_0x20b7('0x67'));return respondWithRpcPromise(_0x20b7('0x7e'),_0x20b7('0x7f'),_0x559411);}return null;})['then'](function(_0x14d44a){var _0x357d37=_0x20b7('0x69')+_0x14d44a[_0x20b7('0x27')][_0x20b7('0x6a')];return db['sequelize'][_0x20b7('0x40')](_0x357d37,{'type':db['Sequelize']['QueryTypes'][_0x20b7('0x6b')],'raw':!![]})[_0x20b7('0x34')](function(_0x36dd57){return _0x36dd57;});})[_0x20b7('0x34')](function(_0xecead6){if(_0xecead6){_0x559411[_0x20b7('0x27')]['contact']=_0xecead6[0x0];if(!_0x174181[_0x20b7('0x56')][_0x20b7('0x5d')])return;return db[_0x20b7('0x6d')][_0x20b7('0x57')]({'where':{'id':_0x174181['body']['UserId'],'role':_0x20b7('0x71')},'attributes':['id','name',_0x20b7('0x6e'),_0x20b7('0x6f'),_0x20b7('0x70')],'raw':!![]});}return null;})['then'](function(_0x11da0f){if(!_0x11da0f)return null;_0x559411[_0x20b7('0x27')]['agent']=_0x11da0f;return _0x559411;})[_0x20b7('0x34')](function(_0x42affc){if(_0x42affc){_0x42affc[_0x20b7('0x27')][_0x20b7('0x73')]=util['format'](_0x20b7('0x74'),_0x174181[_0x20b7('0x5e')][_0x20b7('0x37')]);_0x42affc[_0x20b7('0x27')][_0x20b7('0x75')]=_0x559411['channel'];_0x42affc[_0x20b7('0x27')][_0x20b7('0x76')]=_0x559411[_0x20b7('0x75')];_0x42affc[_0x20b7('0x27')]['event']=_0x20b7('0x7a');respondWithRpcPromise(_0x20b7('0x78'),'EventManager',{'event':_0x20b7('0x80'),'message':_0x42affc['message']},client9002);return _0x559411;}return null;})[_0x20b7('0x34')](respondWithResult(_0x55a4e0,null))[_0x20b7('0x28')](handleError(_0x55a4e0,null));};exports[_0x20b7('0x81')]=function(_0x11f25f,_0x1819fa){var _0x1e3df5;return db[_0x20b7('0x3b')][_0x20b7('0x81')](_0x11f25f[_0x20b7('0x56')],{})['then'](function(_0x3de8dc){_0x1e3df5=_0x3de8dc;return db[_0x20b7('0x82')][_0x20b7('0x83')]({'where':{'id':_0x1e3df5[_0x20b7('0x6a')]}});})['then'](function(_0x5be987){if(_[_0x20b7('0x62')](_0x5be987)){return;}else{_0x1e3df5['fax']=_0x5be987['fax'];return db['Attachment'][_0x20b7('0x83')]({'where':{'id':_0x1e3df5[_0x20b7('0x84')]}});}})['then'](function(_0x2e2555){return respondWithRpcPromise(_0x20b7('0x85'),_0x20b7('0x85'),{'FaxAccountId':_[_0x20b7('0x62')](_0x11f25f[_0x20b7('0x56')])?undefined:_0x11f25f['body'][_0x20b7('0x86')],'path':_[_0x20b7('0x62')](_0x2e2555)?undefined:util[_0x20b7('0x5c')]('/var/opt/motion2/server/files/attachments/%s',_0x2e2555[_0x20b7('0x87')]),'fax':_[_0x20b7('0x62')](_0x1e3df5[_0x20b7('0x7b')])?undefined:_0x1e3df5[_0x20b7('0x7b')],'AttachmentId':_0x1e3df5[_0x20b7('0x84')]},client9002);})['then'](respondWithResult(_0x1819fa,0xc9))['catch'](handleError(_0x1819fa,null));};exports[_0x20b7('0x88')]=function(_0x1d8ea1,_0x36a386){var _0x5d9824=path[_0x20b7('0x89')](config[_0x20b7('0x8a')],_0x20b7('0x8b'),'files','attachments');return db[_0x20b7('0x3b')]['find']({'where':{'id':_0x1d8ea1['params']['id']},'include':[{'model':db[_0x20b7('0x8c')],'as':_0x20b7('0x8c')}]})['then'](handleEntityNotFound(_0x36a386,null))[_0x20b7('0x34')](function(_0xcaaa2){if(_0xcaaa2){return _0x36a386[_0x20b7('0x88')](path[_0x20b7('0x89')](_0x5d9824,_0xcaaa2[_0x20b7('0x8c')]['basename']));}})[_0x20b7('0x28')](handleError(_0x36a386,null));}; \ No newline at end of file +var _0x829f=['email','internal','manual','interface','SIP/%s','channel','motionChannel','event','accept','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','sequelize','contact','User','fullname','EventManager','rejectmessage','create','findOne','isNil','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','download','join','attachments','Attachment','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','rows','show','params','find','body','describe','fax-interactions','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','FaxInteraction','FaxInteractionId','read1stAt','interaction','user','role','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT'];(function(_0x18cf03,_0x5c6719){var _0x456416=function(_0x247ca9){while(--_0x247ca9){_0x18cf03['push'](_0x18cf03['shift']());}};_0x456416(++_0x5c6719);}(_0x829f,0x141));var _0xf829=function(_0x9644aa,_0x45cfbf){_0x9644aa=_0x9644aa-0x0;var _0x2c0cf9=_0x829f[_0x9644aa];return _0x2c0cf9;};'use strict';var emlformat=require(_0xf829('0x0'));var rimraf=require(_0xf829('0x1'));var zipdir=require(_0xf829('0x2'));var jsonpatch=require(_0xf829('0x3'));var rp=require(_0xf829('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf829('0x5'));var util=require(_0xf829('0x6'));var path=require(_0xf829('0x7'));var sox=require('sox');var csv=require(_0xf829('0x8'));var ejs=require(_0xf829('0x9'));var fs=require('fs');var fs_extra=require(_0xf829('0xa'));var _=require(_0xf829('0xb'));var squel=require(_0xf829('0xc'));var crypto=require(_0xf829('0xd'));var jsforce=require(_0xf829('0xe'));var deskjs=require(_0xf829('0xf'));var toCsv=require(_0xf829('0x8'));var querystring=require(_0xf829('0x10'));var Papa=require(_0xf829('0x11'));var Redis=require('ioredis');var authService=require(_0xf829('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf829('0x13'));var hardwareService=require(_0xf829('0x14'));var logger=require(_0xf829('0x15'))(_0xf829('0x16'));var utils=require('../../config/utils');var config=require(_0xf829('0x17'));var licenseUtil=require(_0xf829('0x18'));var db=require('../../mysqldb')['db'];config[_0xf829('0x19')]=_['defaults'](config[_0xf829('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xf829('0x1a'))(new Redis(config[_0xf829('0x19')]));require(_0xf829('0x1b'))[_0xf829('0x1c')](socket);var jayson=require(_0xf829('0x1d'));var client=jayson[_0xf829('0x1e')][_0xf829('0x1f')]({'port':0x232c});var client9002=jayson[_0xf829('0x1e')][_0xf829('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x9014e9,_0x111e01,_0x437915,_0x11750c){return new BPromise(function(_0x243a3e,_0x28e8d5){var _0x4bc04f=_0x11750c||client;return _0x4bc04f[_0xf829('0x20')](_0x9014e9,_0x437915)[_0xf829('0x21')](function(_0x35ca9e){logger[_0xf829('0x22')](_0xf829('0x23'),_0x111e01,_0xf829('0x24'));logger[_0xf829('0x25')](_0xf829('0x26'),_0x111e01,_0xf829('0x24'),JSON[_0xf829('0x27')](_0x35ca9e));if(_0x35ca9e[_0xf829('0x28')]){if(_0x35ca9e[_0xf829('0x28')][_0xf829('0x29')]===0x1f4){logger[_0xf829('0x28')](_0xf829('0x23'),_0x111e01,_0x35ca9e[_0xf829('0x28')]['message']);return _0x28e8d5(_0x35ca9e[_0xf829('0x28')][_0xf829('0x2a')]);}logger['error'](_0xf829('0x23'),_0x111e01,_0x35ca9e[_0xf829('0x28')]['message']);return _0x243a3e(_0x35ca9e[_0xf829('0x28')]['message']);}else{logger['info'](_0xf829('0x23'),_0x111e01,'request\x20sent');_0x243a3e(_0x35ca9e[_0xf829('0x2b')]['message']);}})[_0xf829('0x2c')](function(_0x384e7a){logger['error'](_0xf829('0x23'),_0x111e01,_0x384e7a);_0x28e8d5(_0x384e7a);});});}function respondWithStatusCode(_0xf870b,_0x476535){_0x476535=_0x476535||0xcc;return function(_0x29a40f){if(_0x29a40f){return _0xf870b[_0xf829('0x2d')](_0x476535);}return _0xf870b['status'](_0x476535)[_0xf829('0x2e')]();};}function respondWithResult(_0x4ffff9,_0x31d9a5){_0x31d9a5=_0x31d9a5||0xc8;return function(_0x5ea1a4){if(_0x5ea1a4){return _0x4ffff9[_0xf829('0x2f')](_0x31d9a5)['json'](_0x5ea1a4);}};}function respondWithFilteredResult(_0x3ca701,_0x1d0876){return function(_0x2c9384){if(_0x2c9384){var _0x1ef1d6=typeof _0x1d0876[_0xf829('0x30')]===_0xf829('0x31')&&typeof _0x1d0876[_0xf829('0x32')]==='undefined';var _0x554789=_0x2c9384[_0xf829('0x33')];var _0x3b37ea=_0x1ef1d6?0x0:_0x1d0876[_0xf829('0x30')];var _0xb4d1ef=_0x1ef1d6?_0x2c9384[_0xf829('0x33')]:_0x1d0876[_0xf829('0x30')]+_0x1d0876[_0xf829('0x32')];var _0x23e8d6;if(_0xb4d1ef>=_0x554789){_0xb4d1ef=_0x554789;_0x23e8d6=0xc8;}else{_0x23e8d6=0xce;}_0x3ca701[_0xf829('0x2f')](_0x23e8d6);return _0x3ca701[_0xf829('0x34')]('Content-Range',_0x3b37ea+'-'+_0xb4d1ef+'/'+_0x554789)[_0xf829('0x35')](_0x2c9384);}return null;};}function patchUpdates(_0x4e010a){return function(_0x330ecc){try{jsonpatch[_0xf829('0x36')](_0x330ecc,_0x4e010a,!![]);}catch(_0x3a98fc){return BPromise[_0xf829('0x37')](_0x3a98fc);}return _0x330ecc[_0xf829('0x38')]();};}function saveUpdates(_0x5ca208,_0x54c04e){return function(_0x384bfb){if(_0x384bfb){return _0x384bfb[_0xf829('0x39')](_0x5ca208)[_0xf829('0x21')](function(_0x3a4f05){return _0x3a4f05;});}return null;};}function removeEntity(_0x188e6c,_0x2cf6ba){return function(_0x3724e4){if(_0x3724e4){return _0x3724e4[_0xf829('0x3a')]()[_0xf829('0x21')](function(){_0x188e6c[_0xf829('0x2f')](0xcc)[_0xf829('0x2e')]();});}};}function handleEntityNotFound(_0x3b1094,_0x34ae48){return function(_0x22118e){if(!_0x22118e){_0x3b1094['sendStatus'](0x194);}return _0x22118e;};}function handleError(_0x4d7437,_0x293316){_0x293316=_0x293316||0x1f4;return function(_0x42bcec){logger[_0xf829('0x28')](_0x42bcec[_0xf829('0x3b')]);if(_0x42bcec['name']){delete _0x42bcec[_0xf829('0x3c')];}_0x4d7437[_0xf829('0x2f')](_0x293316)[_0xf829('0x3d')](_0x42bcec);};}exports[_0xf829('0x3e')]=function(_0x2b500e,_0x237c9c){var _0x5dc05a={},_0x1402f2={},_0x15dfa6={'count':0x0,'rows':[]};var _0x4267c1=_[_0xf829('0x3f')](db[_0xf829('0x40')][_0xf829('0x41')],function(_0x3e23e5){return{'name':_0x3e23e5[_0xf829('0x42')],'type':_0x3e23e5[_0xf829('0x43')][_0xf829('0x44')]};});_0x1402f2[_0xf829('0x45')]=_[_0xf829('0x3f')](_0x4267c1,_0xf829('0x3c'));_0x1402f2[_0xf829('0x46')]=_[_0xf829('0x47')](_0x2b500e[_0xf829('0x46')]);_0x1402f2[_0xf829('0x48')]=_[_0xf829('0x49')](_0x1402f2[_0xf829('0x45')],_0x1402f2[_0xf829('0x46')]);_0x5dc05a[_0xf829('0x4a')]=_[_0xf829('0x49')](_0x1402f2[_0xf829('0x45')],qs[_0xf829('0x4b')](_0x2b500e[_0xf829('0x46')]['fields']));_0x5dc05a[_0xf829('0x4a')]=_0x5dc05a[_0xf829('0x4a')][_0xf829('0x4c')]?_0x5dc05a[_0xf829('0x4a')]:_0x1402f2[_0xf829('0x45')];if(!_0x2b500e[_0xf829('0x46')][_0xf829('0x4d')](_0xf829('0x4e'))){_0x5dc05a[_0xf829('0x32')]=qs['limit'](_0x2b500e[_0xf829('0x46')][_0xf829('0x32')]);_0x5dc05a[_0xf829('0x30')]=qs['offset'](_0x2b500e[_0xf829('0x46')][_0xf829('0x30')]);}_0x5dc05a[_0xf829('0x4f')]=qs[_0xf829('0x50')](_0x2b500e[_0xf829('0x46')]['sort']);_0x5dc05a[_0xf829('0x51')]=qs[_0xf829('0x48')](_['pick'](_0x2b500e[_0xf829('0x46')],_0x1402f2[_0xf829('0x48')]),_0x4267c1);if(_0x2b500e['query'][_0xf829('0x52')]){_0x5dc05a[_0xf829('0x51')]=_['merge'](_0x5dc05a[_0xf829('0x51')],{'$or':_[_0xf829('0x3f')](_0x4267c1,function(_0x291a19){if(_0x291a19[_0xf829('0x43')]!=='VIRTUAL'){var _0x1663e1={};_0x1663e1[_0x291a19['name']]={'$like':'%'+_0x2b500e[_0xf829('0x46')][_0xf829('0x52')]+'%'};return _0x1663e1;}})});}_0x5dc05a=_[_0xf829('0x53')]({},_0x5dc05a,_0x2b500e[_0xf829('0x54')]);var _0x140c97={'where':_0x5dc05a['where']};return db[_0xf829('0x40')][_0xf829('0x33')](_0x140c97)[_0xf829('0x21')](function(_0x7a36a3){_0x15dfa6[_0xf829('0x33')]=_0x7a36a3;if(_0x2b500e[_0xf829('0x46')][_0xf829('0x55')]){_0x5dc05a[_0xf829('0x56')]=[{'all':!![]}];}return db[_0xf829('0x40')]['findAll'](_0x5dc05a);})[_0xf829('0x21')](function(_0x3cd38c){_0x15dfa6[_0xf829('0x57')]=_0x3cd38c;return _0x15dfa6;})[_0xf829('0x21')](respondWithFilteredResult(_0x237c9c,_0x5dc05a))[_0xf829('0x2c')](handleError(_0x237c9c,null));};exports[_0xf829('0x58')]=function(_0x2e22af,_0x45206d){var _0x84c59c={'raw':!![],'where':{'id':_0x2e22af[_0xf829('0x59')]['id']}},_0xa793ed={};_0xa793ed['model']=_[_0xf829('0x47')](db[_0xf829('0x40')][_0xf829('0x41')]);_0xa793ed['query']=_[_0xf829('0x47')](_0x2e22af[_0xf829('0x46')]);_0xa793ed['filters']=_[_0xf829('0x49')](_0xa793ed['model'],_0xa793ed['query']);_0x84c59c[_0xf829('0x4a')]=_[_0xf829('0x49')](_0xa793ed[_0xf829('0x45')],qs['fields'](_0x2e22af[_0xf829('0x46')][_0xf829('0x4b')]));_0x84c59c[_0xf829('0x4a')]=_0x84c59c[_0xf829('0x4a')][_0xf829('0x4c')]?_0x84c59c[_0xf829('0x4a')]:_0xa793ed[_0xf829('0x45')];if(_0x2e22af[_0xf829('0x46')][_0xf829('0x55')]){_0x84c59c[_0xf829('0x56')]=[{'all':!![]}];}_0x84c59c=_[_0xf829('0x53')]({},_0x84c59c,_0x2e22af['options']);return db[_0xf829('0x40')][_0xf829('0x5a')](_0x84c59c)[_0xf829('0x21')](handleEntityNotFound(_0x45206d,null))[_0xf829('0x21')](respondWithResult(_0x45206d,null))[_0xf829('0x2c')](handleError(_0x45206d,null));};exports[_0xf829('0x39')]=function(_0x48c78b,_0x2cd2c1){if(_0x48c78b[_0xf829('0x5b')]['id']){delete _0x48c78b[_0xf829('0x5b')]['id'];}return db[_0xf829('0x40')][_0xf829('0x5a')]({'where':{'id':_0x48c78b[_0xf829('0x59')]['id']}})['then'](handleEntityNotFound(_0x2cd2c1,null))['then'](saveUpdates(_0x48c78b[_0xf829('0x5b')],null))['then'](respondWithResult(_0x2cd2c1,null))[_0xf829('0x2c')](handleError(_0x2cd2c1,null));};exports['destroy']=function(_0xc2351e,_0x58b133){return db[_0xf829('0x40')][_0xf829('0x5a')]({'where':{'id':_0xc2351e['params']['id']}})[_0xf829('0x21')](handleEntityNotFound(_0x58b133,null))[_0xf829('0x21')](removeEntity(_0x58b133,null))[_0xf829('0x2c')](handleError(_0x58b133,null));};exports[_0xf829('0x5c')]=function(_0x492339,_0xee0136){return db[_0xf829('0x40')][_0xf829('0x5c')]()['then'](respondWithResult(_0xee0136,null))[_0xf829('0x2c')](handleError(_0xee0136,null));};var interaction_log=require(_0xf829('0x15'))(_0xf829('0x5d'));exports['accept']=function(_0x54807a,_0x575e22,_0x342ac8){var _0xa1c846={'agent':{},'channel':_0xf829('0x5e')};if(_0x54807a[_0xf829('0x5b')]['id']){delete _0x54807a[_0xf829('0x5b')]['id'];}_0x54807a[_0xf829('0x5b')][_0xf829('0x5f')]=!![];_0x54807a[_0xf829('0x5b')][_0xf829('0x60')]=moment()[_0xf829('0x61')](_0xf829('0x62'));_0x54807a[_0xf829('0x5b')][_0xf829('0x63')]=_0x54807a[_0xf829('0x5b')][_0xf829('0x63')]||_0x54807a['user']['id'];_0xa1c846[_0xf829('0x64')]['id']=_0x54807a[_0xf829('0x5b')][_0xf829('0x63')];return db[_0xf829('0x40')][_0xf829('0x5a')]({'where':{'id':_0x54807a[_0xf829('0x59')]['id'],'UserId':null}})[_0xf829('0x21')](handleEntityNotFound(_0x575e22,null))['then'](saveUpdates(_0x54807a['body'],null))[_0xf829('0x21')](function(_0x418847){if(_0x418847){_0xa1c846[_0xf829('0x2a')]=_0x418847[_0xf829('0x65')]({'plain':!![]});return db[_0xf829('0x66')]['find']({'where':{'id':_0x418847[_0xf829('0x67')]}});}return null;})[_0xf829('0x21')](handleEntityNotFound(_0x575e22,null))[_0xf829('0x21')](function(_0x200a36){if(_0x200a36){return _0x200a36[_0xf829('0x39')]({'UserId':_0x54807a[_0xf829('0x5b')][_0xf829('0x63')],'read1stAt':_['isNil'](_0x200a36[_0xf829('0x68')])?moment()[_0xf829('0x61')](_0xf829('0x62')):undefined});}return null;})[_0xf829('0x21')](function(_0x4a7414){if(_0x4a7414){_0xa1c846[_0xf829('0x69')]=_0x4a7414[_0xf829('0x65')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x54807a[_0xf829('0x6a')]['id'],_0x54807a[_0xf829('0x6a')][_0xf829('0x3c')],_0x54807a[_0xf829('0x6a')][_0xf829('0x6b')],_0xa1c846[_0xf829('0x69')]['id'],_0x54807a[_0xf829('0x5b')]?JSON[_0xf829('0x27')](_0x54807a[_0xf829('0x5b')]):'null');return respondWithRpcPromise('AcceptMessage',_0xf829('0x6c'),_0xa1c846);}return null;})[_0xf829('0x21')](function(_0x5896fe){var _0x230ba8=_0xf829('0x6d')+_0x5896fe[_0xf829('0x2a')][_0xf829('0x6e')];return db['sequelize'][_0xf829('0x46')](_0x230ba8,{'type':db[_0xf829('0x6f')][_0xf829('0x70')][_0xf829('0x71')],'raw':!![]})[_0xf829('0x21')](function(_0x16e35d){return _0x16e35d;});})[_0xf829('0x21')](function(_0x47215c){if(_0x47215c){_0xa1c846[_0xf829('0x2a')]['contact']=_0x47215c[0x0];if(!_0x54807a[_0xf829('0x5b')][_0xf829('0x63')])return;return db['User'][_0xf829('0x5a')]({'where':{'id':_0x54807a['body'][_0xf829('0x63')],'role':'agent'},'attributes':['id','name','fullname',_0xf829('0x72'),_0xf829('0x73')],'raw':!![]});}return null;})['then'](function(_0x4f2c6e){if(!_0x4f2c6e)return null;_0xa1c846[_0xf829('0x2a')]['agent']=_0x4f2c6e;return _0xa1c846;})['then'](function(_0x480293){if(_0x480293){if(_0x54807a['body'][_0xf829('0x74')]){_0xa1c846[_0xf829('0x2a')][_0xf829('0x75')]=util['format'](_0xf829('0x76'),_0x54807a[_0xf829('0x6a')][_0xf829('0x3c')]);_0xa1c846[_0xf829('0x2a')]['channel']=_0xa1c846[_0xf829('0x77')];_0xa1c846[_0xf829('0x2a')][_0xf829('0x78')]=_0xa1c846['channel'];_0xa1c846['message'][_0xf829('0x79')]=_0xf829('0x7a');return respondWithRpcPromise('EventManager','EventManager',{'event':_0xf829('0x7b'),'message':_0xa1c846['message']},client9002)[_0xf829('0x21')](function(){return _0xa1c846;});}return _0xa1c846;}return null;})[_0xf829('0x21')](respondWithResult(_0x575e22,null))['catch'](handleError(_0x575e22,null));};var interaction_log=require('../../config/logger')(_0xf829('0x5d'));exports[_0xf829('0x37')]=function(_0x57b848,_0x5e8181,_0x4c6ab5){var _0x377e22={'agent':{},'channel':_0xf829('0x5e')};if(_0x57b848[_0xf829('0x5b')]['id']){delete _0x57b848['body']['id'];}_0x57b848[_0xf829('0x5b')][_0xf829('0x63')]=_0x57b848['body']['UserId']||_0x57b848[_0xf829('0x6a')]['id'];_0x377e22[_0xf829('0x64')]['id']=_0x57b848[_0xf829('0x5b')][_0xf829('0x63')];return db[_0xf829('0x40')][_0xf829('0x5a')]({'where':{'id':_0x57b848[_0xf829('0x59')]['id'],'UserId':null}})[_0xf829('0x21')](handleEntityNotFound(_0x5e8181,null))[_0xf829('0x21')](function(_0x5067b0){if(_0x5067b0){_0x377e22[_0xf829('0x2a')]=_0x5067b0['get']({'plain':!![]});return db['FaxInteraction'][_0xf829('0x5a')]({'where':{'id':_0x5067b0[_0xf829('0x67')]}});}return null;})[_0xf829('0x21')](handleEntityNotFound(_0x5e8181,null))[_0xf829('0x21')](function(_0x3f7c12){if(_0x3f7c12){_0x377e22[_0xf829('0x69')]=_0x3f7c12[_0xf829('0x65')]({'plain':!![]});interaction_log[_0xf829('0x22')](_0xf829('0x7c'),_0x57b848[_0xf829('0x6a')]['id'],_0x57b848[_0xf829('0x6a')][_0xf829('0x3c')],_0x57b848['user']['role'],_0x377e22[_0xf829('0x69')]['id'],_0x57b848['body']?JSON[_0xf829('0x27')](_0x57b848[_0xf829('0x5b')]):_0xf829('0x7d'));return respondWithRpcPromise(_0xf829('0x7e'),_0xf829('0x7f'),_0x377e22);}return null;})[_0xf829('0x21')](function(_0x3ca0f8){var _0x481dd8=_0xf829('0x6d')+_0x3ca0f8[_0xf829('0x2a')]['ContactId'];return db[_0xf829('0x80')][_0xf829('0x46')](_0x481dd8,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0xf829('0x21')](function(_0x3233b0){return _0x3233b0;});})['then'](function(_0xb902fb){if(_0xb902fb){_0x377e22[_0xf829('0x2a')][_0xf829('0x81')]=_0xb902fb[0x0];if(!_0x57b848[_0xf829('0x5b')]['UserId'])return;return db[_0xf829('0x82')][_0xf829('0x5a')]({'where':{'id':_0x57b848['body'][_0xf829('0x63')],'role':_0xf829('0x64')},'attributes':['id',_0xf829('0x3c'),_0xf829('0x83'),_0xf829('0x72'),_0xf829('0x73')],'raw':!![]});}return null;})['then'](function(_0x5311f0){if(!_0x5311f0)return null;_0x377e22[_0xf829('0x2a')]['agent']=_0x5311f0;return _0x377e22;})['then'](function(_0x517eab){if(_0x517eab){_0x517eab[_0xf829('0x2a')][_0xf829('0x75')]=util[_0xf829('0x61')](_0xf829('0x76'),_0x57b848[_0xf829('0x6a')][_0xf829('0x3c')]);_0x517eab[_0xf829('0x2a')][_0xf829('0x77')]=_0x377e22['channel'];_0x517eab[_0xf829('0x2a')][_0xf829('0x78')]=_0x377e22[_0xf829('0x77')];_0x517eab['message'][_0xf829('0x79')]=_0xf829('0x37');respondWithRpcPromise(_0xf829('0x84'),_0xf829('0x84'),{'event':_0xf829('0x85'),'message':_0x517eab[_0xf829('0x2a')]},client9002);return _0x377e22;}return null;})['then'](respondWithResult(_0x5e8181,null))[_0xf829('0x2c')](handleError(_0x5e8181,null));};exports[_0xf829('0x86')]=function(_0x15d41a,_0x10ac45){var _0x5ce3da;return db[_0xf829('0x40')][_0xf829('0x86')](_0x15d41a[_0xf829('0x5b')],{})[_0xf829('0x21')](function(_0x3ed622){_0x5ce3da=_0x3ed622;return db['CmContact'][_0xf829('0x87')]({'where':{'id':_0x5ce3da[_0xf829('0x6e')]}});})[_0xf829('0x21')](function(_0x4dcb32){if(_[_0xf829('0x88')](_0x4dcb32)){return;}else{_0x5ce3da[_0xf829('0x5e')]=_0x4dcb32[_0xf829('0x5e')];return db['Attachment']['findOne']({'where':{'id':_0x5ce3da[_0xf829('0x89')]}});}})[_0xf829('0x21')](function(_0x5a6749){return respondWithRpcPromise(_0xf829('0x8a'),_0xf829('0x8a'),{'FaxAccountId':_['isNil'](_0x15d41a[_0xf829('0x5b')])?undefined:_0x15d41a[_0xf829('0x5b')]['FaxAccountId'],'path':_[_0xf829('0x88')](_0x5a6749)?undefined:util[_0xf829('0x61')](_0xf829('0x8b'),_0x5a6749[_0xf829('0x8c')]),'fax':_[_0xf829('0x88')](_0x5ce3da[_0xf829('0x5e')])?undefined:_0x5ce3da['fax'],'AttachmentId':_0x5ce3da[_0xf829('0x89')]},client9002);})['then'](respondWithResult(_0x10ac45,0xc9))[_0xf829('0x2c')](handleError(_0x10ac45,null));};exports[_0xf829('0x8d')]=function(_0x80422d,_0x17268c){var _0x29ced0=path[_0xf829('0x8e')](config['root'],'server','files',_0xf829('0x8f'));return db[_0xf829('0x40')][_0xf829('0x5a')]({'where':{'id':_0x80422d[_0xf829('0x59')]['id']},'include':[{'model':db[_0xf829('0x90')],'as':'Attachment'}]})[_0xf829('0x21')](handleEntityNotFound(_0x17268c,null))['then'](function(_0x547493){if(_0x547493){return _0x17268c['download'](path[_0xf829('0x8e')](_0x29ced0,_0x547493[_0xf829('0x90')][_0xf829('0x8c')]));}})[_0xf829('0x2c')](handleError(_0x17268c,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 3d30127..9af2644 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 _0x4d68=['update','emit','hasOwnProperty','events','../../mysqldb','FaxMessage','setMaxListeners','save'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x4d68,0x1c3));var _0x84d6=function(_0x32bb6b,_0x1a5fbe){_0x32bb6b=_0x32bb6b-0x0;var _0x58dcb4=_0x4d68[_0x32bb6b];return _0x58dcb4;};'use strict';var EventEmitter=require(_0x84d6('0x0'));var FaxMessage=require(_0x84d6('0x1'))['db'][_0x84d6('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x84d6('0x3')](0x0);var events={'afterCreate':_0x84d6('0x4'),'afterUpdate':_0x84d6('0x5'),'afterDestroy':'remove'};function emitEvent(_0x319f1f){return function(_0x5ee114,_0x3a2f0b,_0x589711){FaxMessageEvents[_0x84d6('0x6')](_0x319f1f+':'+_0x5ee114['id'],_0x5ee114);FaxMessageEvents[_0x84d6('0x6')](_0x319f1f,_0x5ee114);_0x589711(null);};}for(var e in events){if(events[_0x84d6('0x7')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0x4888=['emit','hasOwnProperty','hook','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove'];(function(_0x42a7cd,_0x32f06c){var _0x1e482b=function(_0x21de87){while(--_0x21de87){_0x42a7cd['push'](_0x42a7cd['shift']());}};_0x1e482b(++_0x32f06c);}(_0x4888,0x198));var _0x8488=function(_0x82f586,_0x382c19){_0x82f586=_0x82f586-0x0;var _0x591ec8=_0x4888[_0x82f586];return _0x591ec8;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0x8488('0x0'))['db'][_0x8488('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x8488('0x2')](0x0);var events={'afterCreate':_0x8488('0x3'),'afterUpdate':_0x8488('0x4'),'afterDestroy':_0x8488('0x5')};function emitEvent(_0x19e51d){return function(_0x571e4b,_0x267093,_0xf45c3f){FaxMessageEvents[_0x8488('0x6')](_0x19e51d+':'+_0x571e4b['id'],_0x571e4b);FaxMessageEvents[_0x8488('0x6')](_0x19e51d,_0x571e4b);_0xf45c3f(null);};}for(var e in events){if(events[_0x8488('0x7')](e)){var event=events[e];FaxMessage[_0x8488('0x8')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index c77d5d9..e4c86a3 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 _0xffbe=['../../config/logger','moment','rimraf','../../config/environment','./faxMessage.attributes','exports','define','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','out','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','toLowerCase','error','utf8mb4','util'];(function(_0x5b0674,_0x2d3b91){var _0x1c34a9=function(_0xa9aa8){while(--_0xa9aa8){_0x5b0674['push'](_0x5b0674['shift']());}};_0x1c34a9(++_0x2d3b91);}(_0xffbe,0x19f));var _0xeffb=function(_0x3e0454,_0x39f216){_0x3e0454=_0x3e0454-0x0;var _0x4bb6ce=_0xffbe[_0x3e0454];return _0x4bb6ce;};'use strict';var _=require('lodash');var util=require(_0xeffb('0x0'));var logger=require(_0xeffb('0x1'))('api');var moment=require(_0xeffb('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xeffb('0x3'));var config=require(_0xeffb('0x4'));var attributes=require(_0xeffb('0x5'));module[_0xeffb('0x6')]=function(_0x3c6ad6,_0x296230){return _0x3c6ad6[_0xeffb('0x7')]('FaxMessage',attributes,{'tableName':_0xeffb('0x8'),'paranoid':![],'indexes':[{'name':_0xeffb('0x9'),'fields':[_0xeffb('0xa')],'type':_0xeffb('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3635b6,_0x31f95e,_0xdeba2b){var _0x3d3017=_0x3c6ad6[_0xeffb('0xc')];var _0x947819=_0x3635b6[_0xeffb('0xd')]({'plain':!![]});if(_0x947819[_0xeffb('0xe')]['toLowerCase']()==='in'||_0x947819[_0xeffb('0xe')]['toLowerCase']()===_0xeffb('0xf')&&!_0x947819[_0xeffb('0x10')]&&!_[_0xeffb('0x11')](_0x947819[_0xeffb('0x12')])){_0x3d3017[_0xeffb('0x13')][_0xeffb('0x14')]({'where':{'id':_0x947819[_0xeffb('0x15')]}})[_0xeffb('0x16')](function(_0x198161){if(_0x198161){_0x198161['update']({'lastMsgAt':_0x947819['createdAt'],'lastMsgDirection':_0x947819[_0xeffb('0xe')][_0xeffb('0x17')]()});}})['catch'](function(_0x56248f){console[_0xeffb('0x18')](_0x56248f);});}_0xdeba2b();}},'charset':_0xeffb('0x19'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x0d87=['fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','FaxInteraction','findOne','FaxInteractionId','then','update','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','define','FaxMessage'];(function(_0x3306b6,_0x42e90b){var _0x47340a=function(_0x53235b){while(--_0x53235b){_0x3306b6['push'](_0x3306b6['shift']());}};_0x47340a(++_0x42e90b);}(_0x0d87,0x1d1));var _0x70d8=function(_0x55e7e8,_0x331fcd){_0x55e7e8=_0x55e7e8-0x0;var _0x140fd3=_0x0d87[_0x55e7e8];return _0x140fd3;};'use strict';var _=require(_0x70d8('0x0'));var util=require(_0x70d8('0x1'));var logger=require(_0x70d8('0x2'))(_0x70d8('0x3'));var moment=require('moment');var BPromise=require(_0x70d8('0x4'));var rp=require(_0x70d8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x70d8('0x6'));var config=require(_0x70d8('0x7'));var attributes=require('./faxMessage.attributes');module[_0x70d8('0x8')]=function(_0x5608a3,_0x2d4dcf){return _0x5608a3[_0x70d8('0x9')](_0x70d8('0xa'),attributes,{'tableName':_0x70d8('0xb'),'paranoid':![],'indexes':[{'name':_0x70d8('0xc'),'fields':[_0x70d8('0xd')],'type':_0x70d8('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x581902,_0x2aa206,_0x89a9f2){var _0x32add2=_0x5608a3[_0x70d8('0xf')];var _0x2f5d7c=_0x581902[_0x70d8('0x10')]({'plain':!![]});if(_0x2f5d7c[_0x70d8('0x11')][_0x70d8('0x12')]()==='in'||_0x2f5d7c['direction'][_0x70d8('0x12')]()==='out'&&!_0x2f5d7c[_0x70d8('0x13')]&&!_['isNil'](_0x2f5d7c['UserId'])){_0x32add2[_0x70d8('0x14')][_0x70d8('0x15')]({'where':{'id':_0x2f5d7c[_0x70d8('0x16')]}})[_0x70d8('0x17')](function(_0x4560c0){if(_0x4560c0){_0x4560c0[_0x70d8('0x18')]({'lastMsgAt':_0x2f5d7c['createdAt'],'lastMsgDirection':_0x2f5d7c[_0x70d8('0x11')][_0x70d8('0x12')]()});}})[_0x70d8('0x19')](function(_0xa92b65){console['error'](_0xa92b65);});}_0x89a9f2();}},'charset':_0x70d8('0x1a'),'collate':_0x70d8('0x1b')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index cc373ae..ef1f0dc 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 _0x4b84=['CreateFaxMessage','FaxMessage','create','body','options','raw','stringify','UpdateFaxMessage','attributes','catch','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','http','defaults','localhost','./faxMessage.socket','register','request','then','info','request\x20sent','debug','error','message','FaxMessage,\x20%s,\x20%s','result'];(function(_0x128268,_0x5b219f){var _0x335903=function(_0x13eacf){while(--_0x13eacf){_0x128268['push'](_0x128268['shift']());}};_0x335903(++_0x5b219f);}(_0x4b84,0x1cc));var _0x44b8=function(_0x1196bd,_0xba4aea){_0x1196bd=_0x1196bd-0x0;var _0x26014f=_0x4b84[_0x1196bd];return _0x26014f;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});config['redis']=_[_0x44b8('0x7')](config['redis'],{'host':_0x44b8('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x44b8('0x9'))[_0x44b8('0xa')](socket);function respondWithRpcPromise(_0x30ebc3,_0x48a371,_0xc650ec){return new BPromise(function(_0x2cc74b,_0x4315f6){return client[_0x44b8('0xb')](_0x30ebc3,_0xc650ec)[_0x44b8('0xc')](function(_0x37e471){logger[_0x44b8('0xd')]('FaxMessage,\x20%s,\x20%s',_0x48a371,_0x44b8('0xe'));logger[_0x44b8('0xf')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x48a371,_0x44b8('0xe'),JSON['stringify'](_0x37e471));if(_0x37e471[_0x44b8('0x10')]){if(_0x37e471[_0x44b8('0x10')]['code']===0x1f4){logger[_0x44b8('0x10')]('FaxMessage,\x20%s,\x20%s',_0x48a371,_0x37e471['error'][_0x44b8('0x11')]);return _0x4315f6(_0x37e471[_0x44b8('0x10')][_0x44b8('0x11')]);}logger[_0x44b8('0x10')]('FaxMessage,\x20%s,\x20%s',_0x48a371,_0x37e471['error']['message']);return _0x2cc74b(_0x37e471[_0x44b8('0x10')]['message']);}else{logger[_0x44b8('0xd')](_0x44b8('0x12'),_0x48a371,'request\x20sent');_0x2cc74b(_0x37e471[_0x44b8('0x13')][_0x44b8('0x11')]);}})['catch'](function(_0x89bc30){logger[_0x44b8('0x10')]('FaxMessage,\x20%s,\x20%s',_0x48a371,_0x89bc30);_0x4315f6(_0x89bc30);});});}exports[_0x44b8('0x14')]=function(_0x8b4301){var _0xebfe79=this;return new Promise(function(_0x235bdc,_0x102ef9){return db[_0x44b8('0x15')][_0x44b8('0x16')](_0x8b4301[_0x44b8('0x17')],{'raw':_0x8b4301[_0x44b8('0x18')]?_0x8b4301[_0x44b8('0x18')][_0x44b8('0x19')]===undefined?!![]:![]:!![]})[_0x44b8('0xc')](function(_0x48327e){logger[_0x44b8('0xd')](_0x44b8('0x14'),_0x8b4301);logger[_0x44b8('0xf')](_0x44b8('0x14'),_0x8b4301,JSON[_0x44b8('0x1a')](_0x48327e));_0x235bdc(_0x48327e);})['catch'](function(_0x402497){logger['error'](_0x44b8('0x14'),_0x402497[_0x44b8('0x11')],_0x8b4301);_0x102ef9(_0xebfe79[_0x44b8('0x10')](0x1f4,_0x402497[_0x44b8('0x11')]));});});};exports[_0x44b8('0x1b')]=function(_0x59acbc){var _0x474f01=this;return new Promise(function(_0x502acf,_0x41d673){return db[_0x44b8('0x15')]['update'](_0x59acbc[_0x44b8('0x17')],{'raw':_0x59acbc[_0x44b8('0x18')]?_0x59acbc[_0x44b8('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59acbc[_0x44b8('0x18')]?_0x59acbc[_0x44b8('0x18')]['where']||null:null,'attributes':_0x59acbc[_0x44b8('0x18')]?_0x59acbc['options'][_0x44b8('0x1c')]||null:null,'limit':_0x59acbc['options']?_0x59acbc['options']['limit']||null:null})[_0x44b8('0xc')](function(_0x29b18d){logger[_0x44b8('0xd')](_0x44b8('0x1b'),_0x59acbc);logger[_0x44b8('0xf')](_0x44b8('0x1b'),_0x59acbc,JSON[_0x44b8('0x1a')](_0x29b18d));_0x502acf(_0x29b18d);})[_0x44b8('0x1d')](function(_0xd1d320){logger[_0x44b8('0x10')](_0x44b8('0x1b'),_0xd1d320[_0x44b8('0x11')],_0x59acbc);_0x41d673(_0x474f01[_0x44b8('0x10')](0x1f4,_0xd1d320['message']));});});}; \ No newline at end of file +var _0x5fd1=['debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateFaxMessage','FaxMessage','create','body','raw','catch','UpdateFaxMessage','options','where','attributes','limit','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5fd1,0x155));var _0x15fd=function(_0x3827fd,_0x2a5a28){_0x3827fd=_0x3827fd-0x0;var _0x3d5239=_0x5fd1[_0x3827fd];return _0x3d5239;};'use strict';var _=require(_0x15fd('0x0'));var util=require('util');var moment=require(_0x15fd('0x1'));var BPromise=require(_0x15fd('0x2'));var rs=require(_0x15fd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x15fd('0x4'));var logger=require(_0x15fd('0x5'))(_0x15fd('0x6'));var config=require('../../config/environment');var jayson=require(_0x15fd('0x7'));var client=jayson[_0x15fd('0x8')][_0x15fd('0x9')]({'port':0x232a});config[_0x15fd('0xa')]=_[_0x15fd('0xb')](config['redis'],{'host':_0x15fd('0xc'),'port':0x18eb});var socket=require(_0x15fd('0xd'))(new Redis(config[_0x15fd('0xa')]));require('./faxMessage.socket')[_0x15fd('0xe')](socket);function respondWithRpcPromise(_0x5c9c63,_0x3dfdbb,_0x250457){return new BPromise(function(_0x4c226a,_0x4883fd){return client['request'](_0x5c9c63,_0x250457)[_0x15fd('0xf')](function(_0x2a4d55){logger[_0x15fd('0x10')](_0x15fd('0x11'),_0x3dfdbb,_0x15fd('0x12'));logger[_0x15fd('0x13')](_0x15fd('0x14'),_0x3dfdbb,_0x15fd('0x12'),JSON[_0x15fd('0x15')](_0x2a4d55));if(_0x2a4d55['error']){if(_0x2a4d55['error']['code']===0x1f4){logger[_0x15fd('0x16')](_0x15fd('0x11'),_0x3dfdbb,_0x2a4d55[_0x15fd('0x16')][_0x15fd('0x17')]);return _0x4883fd(_0x2a4d55[_0x15fd('0x16')][_0x15fd('0x17')]);}logger[_0x15fd('0x16')](_0x15fd('0x11'),_0x3dfdbb,_0x2a4d55['error']['message']);return _0x4c226a(_0x2a4d55[_0x15fd('0x16')]['message']);}else{logger[_0x15fd('0x10')]('FaxMessage,\x20%s,\x20%s',_0x3dfdbb,_0x15fd('0x12'));_0x4c226a(_0x2a4d55[_0x15fd('0x18')][_0x15fd('0x17')]);}})['catch'](function(_0x367c36){logger[_0x15fd('0x16')](_0x15fd('0x11'),_0x3dfdbb,_0x367c36);_0x4883fd(_0x367c36);});});}exports[_0x15fd('0x19')]=function(_0x2fb919){var _0x36a90e=this;return new Promise(function(_0x3761db,_0x2f46f1){return db[_0x15fd('0x1a')][_0x15fd('0x1b')](_0x2fb919[_0x15fd('0x1c')],{'raw':_0x2fb919['options']?_0x2fb919['options'][_0x15fd('0x1d')]===undefined?!![]:![]:!![]})[_0x15fd('0xf')](function(_0x252a1c){logger[_0x15fd('0x10')](_0x15fd('0x19'),_0x2fb919);logger[_0x15fd('0x13')](_0x15fd('0x19'),_0x2fb919,JSON['stringify'](_0x252a1c));_0x3761db(_0x252a1c);})[_0x15fd('0x1e')](function(_0x2d19ac){logger[_0x15fd('0x16')]('CreateFaxMessage',_0x2d19ac[_0x15fd('0x17')],_0x2fb919);_0x2f46f1(_0x36a90e['error'](0x1f4,_0x2d19ac[_0x15fd('0x17')]));});});};exports[_0x15fd('0x1f')]=function(_0x21601d){var _0x4c9708=this;return new Promise(function(_0x16b87c,_0x1cbf2c){return db[_0x15fd('0x1a')]['update'](_0x21601d[_0x15fd('0x1c')],{'raw':_0x21601d['options']?_0x21601d[_0x15fd('0x20')][_0x15fd('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21601d[_0x15fd('0x20')]?_0x21601d[_0x15fd('0x20')][_0x15fd('0x21')]||null:null,'attributes':_0x21601d[_0x15fd('0x20')]?_0x21601d[_0x15fd('0x20')][_0x15fd('0x22')]||null:null,'limit':_0x21601d[_0x15fd('0x20')]?_0x21601d[_0x15fd('0x20')][_0x15fd('0x23')]||null:null})['then'](function(_0x47c22c){logger[_0x15fd('0x10')]('UpdateFaxMessage',_0x21601d);logger[_0x15fd('0x13')](_0x15fd('0x1f'),_0x21601d,JSON['stringify'](_0x47c22c));_0x16b87c(_0x47c22c);})[_0x15fd('0x1e')](function(_0x197d15){logger['error'](_0x15fd('0x1f'),_0x197d15[_0x15fd('0x17')],_0x21601d);_0x1cbf2c(_0x4c9708[_0x15fd('0x16')](0x1f4,_0x197d15[_0x15fd('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 2089729..4629bb7 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 _0x76ce=['emit','register','length','faxMessage:','save'];(function(_0x9b7a64,_0x38d4a8){var _0x33fd98=function(_0x15c82b){while(--_0x15c82b){_0x9b7a64['push'](_0x9b7a64['shift']());}};_0x33fd98(++_0x38d4a8);}(_0x76ce,0x153));var _0xe76c=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0x76ce[_0x4ea69d];return _0x5318e0;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0xe76c('0x0'),'remove','update'];function createListener(_0x5b42ea,_0x553f7c){return function(_0x1dced1){_0x553f7c[_0xe76c('0x1')](_0x5b42ea,_0x1dced1);};}function removeListener(_0x233adb,_0x5ca5cc){return function(){FaxMessageEvents['removeListener'](_0x233adb,_0x5ca5cc);};}exports[_0xe76c('0x2')]=function(_0x334c99){for(var _0x580161=0x0,_0x3c8a6b=events[_0xe76c('0x3')];_0x580161<_0x3c8a6b;_0x580161++){var _0x34436c=events[_0x580161];var _0x381c33=createListener(_0xe76c('0x4')+_0x34436c,_0x334c99);FaxMessageEvents['on'](_0x34436c,_0x381c33);}}; \ No newline at end of file +var _0x9b34=['save','update','emit','register','length','./faxMessage.events'];(function(_0x50c12f,_0x28e72b){var _0x544cb6=function(_0x288caf){while(--_0x288caf){_0x50c12f['push'](_0x50c12f['shift']());}};_0x544cb6(++_0x28e72b);}(_0x9b34,0x1a9));var _0x49b3=function(_0x3cb949,_0x1dae94){_0x3cb949=_0x3cb949-0x0;var _0x3d55be=_0x9b34[_0x3cb949];return _0x3d55be;};'use strict';var FaxMessageEvents=require(_0x49b3('0x0'));var events=[_0x49b3('0x1'),'remove',_0x49b3('0x2')];function createListener(_0x146933,_0x216fe2){return function(_0x4494e6){_0x216fe2[_0x49b3('0x3')](_0x146933,_0x4494e6);};}function removeListener(_0x5b9b10,_0x12823b){return function(){FaxMessageEvents['removeListener'](_0x5b9b10,_0x12823b);};}exports[_0x49b3('0x4')]=function(_0x44887f){for(var _0x11a410=0x0,_0x313d15=events[_0x49b3('0x5')];_0x11a410<_0x313d15;_0x11a410++){var _0x56a4fd=events[_0x11a410];var _0x1e88ed=createListener('faxMessage:'+_0x56a4fd,_0x44887f);FaxMessageEvents['on'](_0x56a4fd,_0x1e88ed);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index ea9d033..bd0646b 100644 --- a/server/api/faxMessage/index.js +++ b/server/api/faxMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc368=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','/describe','describe','/:id','download','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','delete','destroy','exports','util','connect-timeout'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xc368,0x7b));var _0x8c36=function(_0x288a6d,_0x1048f9){_0x288a6d=_0x288a6d-0x0;var _0x23261d=_0xc368[_0x288a6d];return _0x23261d;};'use strict';var multer=require('multer');var util=require(_0x8c36('0x0'));var path=require('path');var timeout=require(_0x8c36('0x1'));var express=require(_0x8c36('0x2'));var router=express[_0x8c36('0x3')]();var fs_extra=require(_0x8c36('0x4'));var auth=require(_0x8c36('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8c36('0x6'));var controller=require(_0x8c36('0x7'));router[_0x8c36('0x8')]('/',auth[_0x8c36('0x9')](),controller['index']);router['get'](_0x8c36('0xa'),auth[_0x8c36('0x9')](),controller[_0x8c36('0xb')]);router[_0x8c36('0x8')](_0x8c36('0xc'),auth[_0x8c36('0x9')](),controller['show']);router['get']('/:id/download',auth[_0x8c36('0x9')](),controller[_0x8c36('0xd')]);router['post']('/',auth[_0x8c36('0x9')](),interaction[_0x8c36('0xe')](_0x8c36('0xf'),_0x8c36('0x10')),controller[_0x8c36('0x11')]);router[_0x8c36('0x12')](_0x8c36('0xc'),auth[_0x8c36('0x9')](),controller[_0x8c36('0x13')]);router[_0x8c36('0x12')](_0x8c36('0x14'),auth[_0x8c36('0x9')](),controller[_0x8c36('0x15')]);router[_0x8c36('0x12')]('/:id/reject',auth[_0x8c36('0x9')](),controller['reject']);router[_0x8c36('0x16')](_0x8c36('0xc'),auth[_0x8c36('0x9')](),controller[_0x8c36('0x17')]);module[_0x8c36('0x18')]=router; \ No newline at end of file +var _0xb469=['reject','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','/:id/download','download','fax','faxmessage:create','put','update','/:id/accept','accept','/:id/reject'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb469,0x13b));var _0x9b46=function(_0x18e766,_0x56a402){_0x18e766=_0x18e766-0x0;var _0x1e8c73=_0xb469[_0x18e766];return _0x1e8c73;};'use strict';var multer=require(_0x9b46('0x0'));var util=require(_0x9b46('0x1'));var path=require(_0x9b46('0x2'));var timeout=require(_0x9b46('0x3'));var express=require(_0x9b46('0x4'));var router=express[_0x9b46('0x5')]();var fs_extra=require(_0x9b46('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9b46('0x7'));var config=require(_0x9b46('0x8'));var controller=require('./faxMessage.controller');router[_0x9b46('0x9')]('/',auth[_0x9b46('0xa')](),controller['index']);router[_0x9b46('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x9b46('0xb')]);router['get'](_0x9b46('0xc'),auth[_0x9b46('0xa')](),controller[_0x9b46('0xd')]);router['get'](_0x9b46('0xe'),auth['isAuthenticated'](),controller[_0x9b46('0xf')]);router['post']('/',auth[_0x9b46('0xa')](),interaction['tracked'](_0x9b46('0x10'),_0x9b46('0x11')),controller['create']);router[_0x9b46('0x12')](_0x9b46('0xc'),auth['isAuthenticated'](),controller[_0x9b46('0x13')]);router[_0x9b46('0x12')](_0x9b46('0x14'),auth[_0x9b46('0xa')](),controller[_0x9b46('0x15')]);router[_0x9b46('0x12')](_0x9b46('0x16'),auth[_0x9b46('0xa')](),controller[_0x9b46('0x17')]);router[_0x9b46('0x18')](_0x9b46('0xc'),auth[_0x9b46('0xa')](),controller[_0x9b46('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index f789c2c..6a02050 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 _0xd7cf=['name','INTEGER','ENUM','roundrobin','STRING'];(function(_0x4bfd25,_0x1583a7){var _0x4c9547=function(_0x12473c){while(--_0x12473c){_0x4bfd25['push'](_0x4bfd25['shift']());}};_0x4c9547(++_0x1583a7);}(_0xd7cf,0x12b));var _0xfd7c=function(_0x1e6db3,_0x5643ac){_0x1e6db3=_0x1e6db3-0x0;var _0x1de886=_0xd7cf[_0x1e6db3];return _0x1de886;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xfd7c('0x0')],'unique':_0xfd7c('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xfd7c('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xfd7c('0x3')]('rrmemory','beepall',_0xfd7c('0x4')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xfd7c('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7bb9=['roundrobin','INTEGER','sequelize','exports','STRING','name','ENUM','rrmemory','beepall'];(function(_0x394b52,_0x24da1f){var _0x3355ca=function(_0x5e03dd){while(--_0x5e03dd){_0x394b52['push'](_0x394b52['shift']());}};_0x3355ca(++_0x24da1f);}(_0x7bb9,0x89));var _0x97bb=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x7bb9[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require(_0x97bb('0x0'));module[_0x97bb('0x1')]={'name':{'type':Sequelize[_0x97bb('0x2')],'unique':_0x97bb('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x97bb('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x97bb('0x4')](_0x97bb('0x5'),_0x97bb('0x6'),_0x97bb('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x97bb('0x8')],'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 20453d5..b6a81af 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 _0x8318=['request-promise','moment','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./faxQueue.socket','register','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','get','FaxQueues','destroy','error','name','send','map','FaxQueue','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','body','describe','getMembers','UserFaxQueue','FaxQueueId','User','agent','faxPause','updatedAt','createdAt','%s/%s','SIP','getTeams','findOne','Team','addTeams','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userFaxQueue:save','Agents','select','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','removeTeams','ids','isEmpty','userFaxQueue:remove','addAgents','spread','removeAgents','isArray','getAgents','zip-dir','fast-json-patch'];(function(_0x59162a,_0x10e547){var _0x35e50d=function(_0x578425){while(--_0x578425){_0x59162a['push'](_0x59162a['shift']());}};_0x35e50d(++_0x10e547);}(_0x8318,0x1ae));var _0x8831=function(_0x22212d,_0x2b9a8b){_0x22212d=_0x22212d-0x0;var _0x2a63c4=_0x8318[_0x22212d];return _0x2a63c4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8831('0x0'));var jsonpatch=require(_0x8831('0x1'));var rp=require(_0x8831('0x2'));var moment=require(_0x8831('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8831('0x4'));var path=require(_0x8831('0x5'));var sox=require('sox');var csv=require(_0x8831('0x6'));var ejs=require(_0x8831('0x7'));var fs=require('fs');var fs_extra=require(_0x8831('0x8'));var _=require('lodash');var squel=require(_0x8831('0x9'));var crypto=require(_0x8831('0xa'));var jsforce=require(_0x8831('0xb'));var deskjs=require(_0x8831('0xc'));var toCsv=require(_0x8831('0x6'));var querystring=require(_0x8831('0xd'));var Papa=require('papaparse');var Redis=require(_0x8831('0xe'));var authService=require(_0x8831('0xf'));var qs=require(_0x8831('0x10'));var as=require(_0x8831('0x11'));var hardwareService=require(_0x8831('0x12'));var logger=require('../../config/logger')(_0x8831('0x13'));var utils=require(_0x8831('0x14'));var config=require(_0x8831('0x15'));var licenseUtil=require(_0x8831('0x16'));var db=require(_0x8831('0x17'))['db'];config['redis']=_[_0x8831('0x18')](config['redis'],{'host':_0x8831('0x19'),'port':0x18eb});var socket=require(_0x8831('0x1a'))(new Redis(config[_0x8831('0x1b')]));require(_0x8831('0x1c'))[_0x8831('0x1d')](socket);function respondWithStatusCode(_0x2a8f90,_0x4d021c){_0x4d021c=_0x4d021c||0xcc;return function(_0x2d0d8e){if(_0x2d0d8e){return _0x2a8f90[_0x8831('0x1e')](_0x4d021c);}return _0x2a8f90['status'](_0x4d021c)[_0x8831('0x1f')]();};}function respondWithResult(_0x4fcf19,_0x50154e){_0x50154e=_0x50154e||0xc8;return function(_0x4ab410){if(_0x4ab410){return _0x4fcf19[_0x8831('0x20')](_0x50154e)[_0x8831('0x21')](_0x4ab410);}};}function respondWithFilteredResult(_0x1bac27,_0x3a7983){return function(_0x39eff8){if(_0x39eff8){var _0x517aa1=typeof _0x3a7983[_0x8831('0x22')]==='undefined'&&typeof _0x3a7983[_0x8831('0x23')]===_0x8831('0x24');var _0x4197ef=_0x39eff8['count'];var _0x57085f=_0x517aa1?0x0:_0x3a7983[_0x8831('0x22')];var _0xaaf2a8=_0x517aa1?_0x39eff8[_0x8831('0x25')]:_0x3a7983[_0x8831('0x22')]+_0x3a7983[_0x8831('0x23')];var _0xea6283;if(_0xaaf2a8>=_0x4197ef){_0xaaf2a8=_0x4197ef;_0xea6283=0xc8;}else{_0xea6283=0xce;}_0x1bac27[_0x8831('0x20')](_0xea6283);return _0x1bac27[_0x8831('0x26')](_0x8831('0x27'),_0x57085f+'-'+_0xaaf2a8+'/'+_0x4197ef)[_0x8831('0x21')](_0x39eff8);}return null;};}function patchUpdates(_0x381fb3){return function(_0x320178){try{jsonpatch[_0x8831('0x28')](_0x320178,_0x381fb3,!![]);}catch(_0x22fd7f){return BPromise['reject'](_0x22fd7f);}return _0x320178[_0x8831('0x29')]();};}function saveUpdates(_0x46b5d0,_0x58a3a0){return function(_0x252598){if(_0x252598){return _0x252598[_0x8831('0x2a')](_0x46b5d0)[_0x8831('0x2b')](function(_0x5393a5){return _0x5393a5;});}return null;};}function removeEntity(_0x54d639,_0x1d3edd){return function(_0x5af92f){if(_0x5af92f){return _0x5af92f['destroy']()[_0x8831('0x2b')](function(){var _0xd24d4d=_0x5af92f[_0x8831('0x2c')]({'plain':!![]});var _0x2dbba9=_0x8831('0x2d');return db['UserProfileResource'][_0x8831('0x2e')]({'where':{'type':_0x2dbba9,'resourceId':_0xd24d4d['id']}})[_0x8831('0x2b')](function(){return _0x5af92f;});})[_0x8831('0x2b')](function(){_0x54d639[_0x8831('0x20')](0xcc)[_0x8831('0x1f')]();});}};}function handleEntityNotFound(_0x568b0b,_0x33dd8d){return function(_0x2ce9a6){if(!_0x2ce9a6){_0x568b0b['sendStatus'](0x194);}return _0x2ce9a6;};}function handleError(_0x91cdd1,_0x2bff56){_0x2bff56=_0x2bff56||0x1f4;return function(_0x4c9f72){logger[_0x8831('0x2f')](_0x4c9f72['stack']);if(_0x4c9f72[_0x8831('0x30')]){delete _0x4c9f72['name'];}_0x91cdd1[_0x8831('0x20')](_0x2bff56)[_0x8831('0x31')](_0x4c9f72);};}exports['index']=function(_0x39ff35,_0x541881){var _0x390384={},_0x27a36b={},_0x3f51a9={'count':0x0,'rows':[]};var _0x32bb9e=_[_0x8831('0x32')](db[_0x8831('0x33')][_0x8831('0x34')],function(_0x2eba00){return{'name':_0x2eba00['fieldName'],'type':_0x2eba00['type'][_0x8831('0x35')]};});_0x27a36b[_0x8831('0x36')]=_[_0x8831('0x32')](_0x32bb9e,_0x8831('0x30'));_0x27a36b['query']=_[_0x8831('0x37')](_0x39ff35[_0x8831('0x38')]);_0x27a36b[_0x8831('0x39')]=_[_0x8831('0x3a')](_0x27a36b[_0x8831('0x36')],_0x27a36b[_0x8831('0x38')]);_0x390384[_0x8831('0x3b')]=_[_0x8831('0x3a')](_0x27a36b[_0x8831('0x36')],qs[_0x8831('0x3c')](_0x39ff35[_0x8831('0x38')][_0x8831('0x3c')]));_0x390384[_0x8831('0x3b')]=_0x390384[_0x8831('0x3b')][_0x8831('0x3d')]?_0x390384[_0x8831('0x3b')]:_0x27a36b['model'];if(!_0x39ff35[_0x8831('0x38')][_0x8831('0x3e')](_0x8831('0x3f'))){_0x390384['limit']=qs[_0x8831('0x23')](_0x39ff35[_0x8831('0x38')][_0x8831('0x23')]);_0x390384[_0x8831('0x22')]=qs['offset'](_0x39ff35[_0x8831('0x38')][_0x8831('0x22')]);}_0x390384[_0x8831('0x40')]=qs[_0x8831('0x41')](_0x39ff35[_0x8831('0x38')][_0x8831('0x41')]);_0x390384[_0x8831('0x42')]=qs['filters'](_[_0x8831('0x43')](_0x39ff35[_0x8831('0x38')],_0x27a36b['filters']),_0x32bb9e);if(_0x39ff35['query'][_0x8831('0x44')]){_0x390384['where']=_[_0x8831('0x45')](_0x390384['where'],{'$or':_[_0x8831('0x32')](_0x32bb9e,function(_0x20b41f){if(_0x20b41f[_0x8831('0x46')]!==_0x8831('0x47')){var _0x1d4f25={};_0x1d4f25[_0x20b41f[_0x8831('0x30')]]={'$like':'%'+_0x39ff35[_0x8831('0x38')]['filter']+'%'};return _0x1d4f25;}})});}_0x390384=_[_0x8831('0x45')]({},_0x390384,_0x39ff35[_0x8831('0x48')]);var _0x2e11a4={'where':_0x390384[_0x8831('0x42')]};return db['FaxQueue'][_0x8831('0x25')](_0x2e11a4)[_0x8831('0x2b')](function(_0x1effcc){_0x3f51a9['count']=_0x1effcc;if(_0x39ff35['query'][_0x8831('0x49')]){_0x390384['include']=[{'all':!![]}];}return db[_0x8831('0x33')][_0x8831('0x4a')](_0x390384);})[_0x8831('0x2b')](function(_0x1a2f25){_0x3f51a9[_0x8831('0x4b')]=_0x1a2f25;return _0x3f51a9;})[_0x8831('0x2b')](respondWithFilteredResult(_0x541881,_0x390384))[_0x8831('0x4c')](handleError(_0x541881,null));};exports[_0x8831('0x4d')]=function(_0x57ee1a,_0x440b01){var _0xd1b4a0={'raw':!![],'where':{'id':_0x57ee1a[_0x8831('0x4e')]['id']}},_0xce69e6={};_0xce69e6[_0x8831('0x36')]=_[_0x8831('0x37')](db['FaxQueue'][_0x8831('0x34')]);_0xce69e6[_0x8831('0x38')]=_[_0x8831('0x37')](_0x57ee1a[_0x8831('0x38')]);_0xce69e6[_0x8831('0x39')]=_[_0x8831('0x3a')](_0xce69e6[_0x8831('0x36')],_0xce69e6['query']);_0xd1b4a0[_0x8831('0x3b')]=_['intersection'](_0xce69e6['model'],qs[_0x8831('0x3c')](_0x57ee1a['query'][_0x8831('0x3c')]));_0xd1b4a0['attributes']=_0xd1b4a0[_0x8831('0x3b')][_0x8831('0x3d')]?_0xd1b4a0[_0x8831('0x3b')]:_0xce69e6[_0x8831('0x36')];if(_0x57ee1a[_0x8831('0x38')][_0x8831('0x49')]){_0xd1b4a0[_0x8831('0x4f')]=[{'all':!![]}];}_0xd1b4a0=_['merge']({},_0xd1b4a0,_0x57ee1a[_0x8831('0x48')]);return db['FaxQueue']['find'](_0xd1b4a0)['then'](handleEntityNotFound(_0x440b01,null))[_0x8831('0x2b')](respondWithResult(_0x440b01,null))[_0x8831('0x4c')](handleError(_0x440b01,null));};exports['create']=function(_0x412fd5,_0x4ffa2f){return db['FaxQueue'][_0x8831('0x50')](_0x412fd5['body'],{})[_0x8831('0x2b')](function(_0x267d03){var _0x335984=_0x412fd5[_0x8831('0x51')]['get']({'plain':!![]});if(!_0x335984)throw new Error(_0x8831('0x52'));if(_0x335984[_0x8831('0x53')]===_0x8831('0x51')){var _0x46f0ca=_0x267d03[_0x8831('0x2c')]({'plain':!![]});var _0x14672f=_0x8831('0x2d');return db[_0x8831('0x54')][_0x8831('0x55')]({'where':{'name':_0x14672f,'userProfileId':_0x335984[_0x8831('0x56')]},'raw':!![]})['then'](function(_0x202c38){if(_0x202c38&&_0x202c38[_0x8831('0x57')]===0x0){return db[_0x8831('0x58')][_0x8831('0x50')]({'name':_0x46f0ca[_0x8831('0x30')],'resourceId':_0x46f0ca['id'],'type':_0x202c38['name'],'sectionId':_0x202c38['id']},{})['then'](function(){return _0x267d03;});}else{return _0x267d03;}})[_0x8831('0x4c')](function(_0x777305){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x777305);throw _0x777305;});}return _0x267d03;})[_0x8831('0x2b')](respondWithResult(_0x4ffa2f,0xc9))[_0x8831('0x4c')](handleError(_0x4ffa2f,null));};exports[_0x8831('0x2a')]=function(_0x83f583,_0xbe6ddf){if(_0x83f583['body']['id']){delete _0x83f583[_0x8831('0x59')]['id'];}return db['FaxQueue'][_0x8831('0x55')]({'where':{'id':_0x83f583[_0x8831('0x4e')]['id']}})[_0x8831('0x2b')](handleEntityNotFound(_0xbe6ddf,null))['then'](saveUpdates(_0x83f583['body'],null))[_0x8831('0x2b')](respondWithResult(_0xbe6ddf,null))[_0x8831('0x4c')](handleError(_0xbe6ddf,null));};exports[_0x8831('0x2e')]=function(_0x51c77b,_0x4f3dfd){return db['FaxQueue'][_0x8831('0x55')]({'where':{'id':_0x51c77b[_0x8831('0x4e')]['id']}})[_0x8831('0x2b')](handleEntityNotFound(_0x4f3dfd,null))[_0x8831('0x2b')](removeEntity(_0x4f3dfd,null))['catch'](handleError(_0x4f3dfd,null));};exports[_0x8831('0x5a')]=function(_0xab6bb7,_0x56060e){return db['FaxQueue'][_0x8831('0x5a')]()['then'](respondWithResult(_0x56060e,null))[_0x8831('0x4c')](handleError(_0x56060e,null));};exports[_0x8831('0x5b')]=function(_0xb4c020,_0x57e8ec,_0x182c9e){var _0xc3a4b4={'raw':!![],'where':{}},_0x366de0={},_0x2d6438;return db['FaxQueue']['findOne']({'where':{'id':_0xb4c020[_0x8831('0x4e')]['id']}})['then'](handleEntityNotFound(_0x57e8ec,null))[_0x8831('0x2b')](function(_0x441794){if(_0x441794){_0x2d6438=_0x441794[_0x8831('0x2c')]({'plain':!![]});_0x366de0['model']=_[_0x8831('0x37')](db[_0x8831('0x5c')][_0x8831('0x34')]);_0x366de0['query']=_[_0x8831('0x37')](_0xb4c020[_0x8831('0x38')]);_0x366de0[_0x8831('0x39')]=_['intersection'](_0x366de0[_0x8831('0x36')],_0x366de0[_0x8831('0x38')]);_0xc3a4b4[_0x8831('0x3b')]=_['intersection'](_0x366de0[_0x8831('0x36')],qs[_0x8831('0x3c')](_0xb4c020[_0x8831('0x38')][_0x8831('0x3c')]));_0xc3a4b4['attributes']=_0xc3a4b4[_0x8831('0x3b')]['length']?_0xc3a4b4['attributes']:_0x366de0['model'];if(!_0xb4c020['query']['hasOwnProperty'](_0x8831('0x3f'))){_0xc3a4b4[_0x8831('0x23')]=qs[_0x8831('0x23')](_0xb4c020['query'][_0x8831('0x23')]);_0xc3a4b4[_0x8831('0x22')]=qs[_0x8831('0x22')](_0xb4c020['query'][_0x8831('0x22')]);}_0xc3a4b4['order']=qs[_0x8831('0x41')](_0xb4c020['query'][_0x8831('0x41')]);_0xc3a4b4['where']=qs[_0x8831('0x39')](_[_0x8831('0x43')](_0xb4c020[_0x8831('0x38')],_0x366de0['filters']));_0xc3a4b4[_0x8831('0x42')][_0x8831('0x5d')]=_0x441794['id'];if(_0xb4c020[_0x8831('0x38')][_0x8831('0x44')]){_0xc3a4b4['where']=_[_0x8831('0x45')](_0xc3a4b4['where'],{'$or':_[_0x8831('0x32')](_0xc3a4b4[_0x8831('0x3b')],function(_0x12a50f){var _0x22b451={};_0x22b451[_0x12a50f]={'$like':'%'+_0xb4c020[_0x8831('0x38')][_0x8831('0x44')]+'%'};return _0x22b451;})});}_0xc3a4b4=_['merge']({},_0xc3a4b4,_0xb4c020[_0x8831('0x48')]);return db[_0x8831('0x5c')]['findAll'](_0xc3a4b4);}})[_0x8831('0x2b')](function(_0xca24af){if(_0xca24af){return db[_0x8831('0x5e')]['findAndCountAll']({'where':{'id':_[_0x8831('0x32')](_0xca24af,'UserId'),'role':_0x8831('0x5f')},'attributes':['id',_0x8831('0x30'),_0x8831('0x60'),_0x8831('0x61'),_0x8831('0x62')]});}})[_0x8831('0x2b')](function(_0x1d0958){if(_0x1d0958){return{'count':_0x1d0958[_0x8831('0x25')],'rows':_[_0x8831('0x32')](_0x1d0958[_0x8831('0x4b')],function(_0x577ba3){return{'membername':_0x577ba3[_0x8831('0x30')],'UserId':_0x577ba3['id'],'queue_name':_0x2d6438['name'],'FaxQueueId':_0x2d6438['id'],'interface':util['format'](_0x8831('0x63'),_0x8831('0x64'),_0x577ba3[_0x8831('0x30')]),'penalty':0x0,'paused':_0x577ba3[_0x8831('0x60')],'createdAt':_0x577ba3['createdAt'],'updatedAt':_0x577ba3[_0x8831('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x57e8ec,_0xc3a4b4))['catch'](handleError(_0x57e8ec,null));};exports[_0x8831('0x65')]=function(_0x4230ea,_0x28ea85,_0x3bb3ce){var _0x38eaa4={};var _0x20eb1d={};var _0x1e6a73;var _0x33146c;return db[_0x8831('0x33')][_0x8831('0x66')]({'where':{'id':_0x4230ea[_0x8831('0x4e')]['id']}})[_0x8831('0x2b')](handleEntityNotFound(_0x28ea85,null))[_0x8831('0x2b')](function(_0x39c815){if(_0x39c815){_0x1e6a73=_0x39c815;_0x20eb1d[_0x8831('0x36')]=_[_0x8831('0x37')](db[_0x8831('0x67')][_0x8831('0x34')]);_0x20eb1d[_0x8831('0x38')]=_[_0x8831('0x37')](_0x4230ea[_0x8831('0x38')]);_0x20eb1d[_0x8831('0x39')]=_[_0x8831('0x3a')](_0x20eb1d['model'],_0x20eb1d['query']);_0x38eaa4[_0x8831('0x3b')]=_[_0x8831('0x3a')](_0x20eb1d[_0x8831('0x36')],qs['fields'](_0x4230ea[_0x8831('0x38')][_0x8831('0x3c')]));_0x38eaa4[_0x8831('0x3b')]=_0x38eaa4[_0x8831('0x3b')][_0x8831('0x3d')]?_0x38eaa4['attributes']:_0x20eb1d[_0x8831('0x36')];_0x38eaa4['order']=qs['sort'](_0x4230ea[_0x8831('0x38')][_0x8831('0x41')]);_0x38eaa4['where']=qs[_0x8831('0x39')](_[_0x8831('0x43')](_0x4230ea['query'],_0x20eb1d[_0x8831('0x39')]));if(_0x4230ea[_0x8831('0x38')][_0x8831('0x44')]){_0x38eaa4['where']=_[_0x8831('0x45')](_0x38eaa4[_0x8831('0x42')],{'$or':_[_0x8831('0x32')](_0x38eaa4[_0x8831('0x3b')],function(_0x251bb1){var _0x4ff22a={};_0x4ff22a[_0x251bb1]={'$like':'%'+_0x4230ea['query'][_0x8831('0x44')]+'%'};return _0x4ff22a;})});}_0x38eaa4=_[_0x8831('0x45')]({},_0x38eaa4,_0x4230ea[_0x8831('0x48')]);return _0x1e6a73[_0x8831('0x65')](_0x38eaa4);}})[_0x8831('0x2b')](function(_0x2da382){if(_0x2da382){_0x33146c=_0x2da382[_0x8831('0x3d')];if(!_0x4230ea[_0x8831('0x38')]['hasOwnProperty'](_0x8831('0x3f'))){_0x38eaa4[_0x8831('0x23')]=qs[_0x8831('0x23')](_0x4230ea[_0x8831('0x38')]['limit']);_0x38eaa4['offset']=qs[_0x8831('0x22')](_0x4230ea[_0x8831('0x38')]['offset']);}return _0x1e6a73[_0x8831('0x65')](_0x38eaa4);}})[_0x8831('0x2b')](function(_0x212b5f){if(_0x212b5f){return _0x212b5f?{'count':_0x33146c,'rows':_0x212b5f}:null;}})[_0x8831('0x2b')](respondWithResult(_0x28ea85,null))[_0x8831('0x4c')](handleError(_0x28ea85,null));};exports[_0x8831('0x68')]=function(_0x33b2bc,_0xb95491,_0x3c6d5d){var _0x330ec4=_0x33b2bc[_0x8831('0x59')]['ids'];return db[_0x8831('0x67')][_0x8831('0x4a')]({'where':{'id':_0x330ec4},'attributes':['id'],'include':[{'model':db[_0x8831('0x5e')],'as':'Agents','attributes':['id','name',_0x8831('0x69'),_0x8831('0x6a'),_0x8831('0x6b')],'raw':!![]}]})['then'](function(_0x39d348){if(_0x39d348){var _0x332f54=_[_0x8831('0x6c')](_0x39d348,function(_0xd00311){var _0x121e33=_0xd00311[_0x8831('0x2c')]({'plain':!![]});return _0x121e33['Agents'];});return db[_0x8831('0x33')][_0x8831('0x55')]({'where':{'id':_0x33b2bc[_0x8831('0x4e')]['id']}})[_0x8831('0x2b')](function(_0x1b3c24){return db[_0x8831('0x6d')][_0x8831('0x6e')](function(_0x54e21d){return _0x1b3c24[_0x8831('0x68')](_0x330ec4,{'transaction':_0x54e21d})['then'](function(){return BPromise['each'](_0x332f54,function(_0x4ebed6){return db[_0x8831('0x5c')][_0x8831('0x6f')]({'where':{'UserId':_0x4ebed6['id'],'FaxQueueId':_0x33b2bc['params']['id']},'transaction':_0x54e21d});});})['then'](function(){_0x332f54[_0x8831('0x70')](function(_0x9f744d){socket[_0x8831('0x71')](_0x8831('0x72'),{'UserId':_0x9f744d['id'],'FaxQueueId':_0x1b3c24['id']});});});});});}})[_0x8831('0x2b')](respondWithStatusCode(_0xb95491,null))['catch'](handleError(_0xb95491,null));};exports['removeTeams']=function(_0x6559a1,_0x1fa00a,_0x23854d){return db[_0x8831('0x67')][_0x8831('0x4a')]({'where':{'id':_0x6559a1[_0x8831('0x38')]['ids']},'attributes':['id'],'include':[{'model':db[_0x8831('0x5e')],'as':_0x8831('0x73'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1fa00a,null))[_0x8831('0x2b')](function(_0x4228ec){var _0x4ffe78=_[_0x8831('0x32')](_0x4228ec,'id');var _0xc10608=[];var _0x3b4489=[];var _0x11d5a=squel[_0x8831('0x74')]();_0x11d5a['field'](_0x8831('0x75'))[_0x8831('0x76')](_0x8831('0x77'),'tq')[_0x8831('0x78')](_0x8831('0x79'),'ut',_0x8831('0x7a'))[_0x8831('0x42')]('FaxQueueId\x20=\x20?',_0x6559a1[_0x8831('0x4e')]['id']);for(var _0xf592fc=0x0;_0xf592fc<_0x4228ec['length'];_0xf592fc+=0x1){let _0x36a4f3=_0x4228ec[_0xf592fc];for(var _0x5aed22=0x0;_0x5aed22<_0x36a4f3['Agents']['length'];_0x5aed22+=0x1){let _0x1a867c=_0x36a4f3['Agents'][_0x5aed22];var _0x33dc02=_0x11d5a[_0x8831('0x7b')]();_0x33dc02[_0x8831('0x42')](_0x8831('0x7c'),_0x1a867c['id']);_0x3b4489[_0x8831('0x7d')](db[_0x8831('0x6d')][_0x8831('0x38')](_0x33dc02[_0x8831('0x7e')](),{'type':db[_0x8831('0x6d')][_0x8831('0x7f')][_0x8831('0x80')]})[_0x8831('0x2b')](function(_0x451058){if(_0x451058[_0x8831('0x3d')]===0x1){return _0x1a867c['id'];}else{var _0x52cd6e=_[_0x8831('0x81')](_[_0x8831('0x32')](_0x451058,'TeamId'),function(_0xbe588c){return _[_0x8831('0x82')](_0x4ffe78,_0xbe588c);});if(_0x52cd6e){return _0x1a867c['id'];}}}));}}return BPromise[_0x8831('0x83')](_0x3b4489)[_0x8831('0x2b')](function(_0x3e4d06){_0xc10608=_(_0xc10608)[_0x8831('0x84')](_0x3e4d06)[_0x8831('0x85')]()[_0x8831('0x86')]();return db['FaxQueue'][_0x8831('0x55')]({'where':{'id':_0x6559a1[_0x8831('0x4e')]['id']}})[_0x8831('0x2b')](function(_0x4ae8f8){return db['sequelize'][_0x8831('0x6e')](function(_0x2724a9){return _0x4ae8f8[_0x8831('0x87')](_0x6559a1[_0x8831('0x38')][_0x8831('0x88')],{'transaction':_0x2724a9})[_0x8831('0x2b')](function(){if(!_[_0x8831('0x89')](_0xc10608)){return _0x4ae8f8['removeAgents'](_0xc10608,{'transaction':_0x2724a9});}})[_0x8831('0x2b')](function(){_0xc10608[_0x8831('0x70')](function(_0x1cf737){socket[_0x8831('0x71')](_0x8831('0x8a'),{'UserId':_0x1cf737,'FaxQueueId':_0x4ae8f8['id']});});});});});});})[_0x8831('0x2b')](respondWithStatusCode(_0x1fa00a,null))[_0x8831('0x4c')](handleError(_0x1fa00a,null));};exports[_0x8831('0x8b')]=function(_0x9c36a7,_0x38f001,_0x1cec78){return db[_0x8831('0x33')]['find']({'where':{'id':_0x9c36a7[_0x8831('0x4e')]['id']}})[_0x8831('0x2b')](handleEntityNotFound(_0x38f001,null))[_0x8831('0x2b')](function(_0x5f4129){if(_0x5f4129){return _0x5f4129[_0x8831('0x8b')](_0x9c36a7[_0x8831('0x59')]['ids'],_['omit'](_0x9c36a7[_0x8831('0x59')],['ids','id'])||{})[_0x8831('0x8c')](function(_0x43f62c){for(var _0x436fd1=0x0;_0x436fd1<_0x9c36a7[_0x8831('0x59')]['ids'][_0x8831('0x3d')];_0x436fd1+=0x1){socket[_0x8831('0x71')]('userFaxQueue:save',{'UserId':Number(_0x9c36a7['body']['ids'][_0x436fd1]),'FaxQueueId':Number(_0x9c36a7[_0x8831('0x4e')]['id'])});}return _0x43f62c;});}})[_0x8831('0x2b')](respondWithResult(_0x38f001,null))[_0x8831('0x4c')](handleError(_0x38f001,null));};exports[_0x8831('0x8d')]=function(_0x5cd189,_0x3fd6d4,_0x1669a9){return db[_0x8831('0x33')]['find']({'where':{'id':_0x5cd189[_0x8831('0x4e')]['id']}})[_0x8831('0x2b')](handleEntityNotFound(_0x3fd6d4,null))['then'](function(_0x3b99db){if(_0x3b99db){return _0x3b99db[_0x8831('0x8d')](_0x5cd189[_0x8831('0x38')][_0x8831('0x88')])[_0x8831('0x2b')](function(){if(_[_0x8831('0x8e')](_0x5cd189[_0x8831('0x38')][_0x8831('0x88')])){for(var _0xd86f85=0x0;_0xd86f85<_0x5cd189['query']['ids'][_0x8831('0x3d')];_0xd86f85+=0x1){socket[_0x8831('0x71')](_0x8831('0x8a'),{'UserId':Number(_0x5cd189['query'][_0x8831('0x88')][_0xd86f85]),'FaxQueueId':Number(_0x5cd189[_0x8831('0x4e')]['id'])});}}else{socket[_0x8831('0x71')](_0x8831('0x8a'),{'UserId':Number(_0x5cd189['query']['ids']),'FaxQueueId':Number(_0x5cd189[_0x8831('0x4e')]['id'])});}});}})['then'](respondWithStatusCode(_0x3fd6d4,null))[_0x8831('0x4c')](handleError(_0x3fd6d4,null));};exports[_0x8831('0x8f')]=function(_0x18a262,_0x1222c3,_0x376efb){var _0x2e0e8a={};var _0x51d6b1={};var _0x6fe23b;var _0x167c73;return db[_0x8831('0x33')][_0x8831('0x66')]({'where':{'id':_0x18a262['params']['id']}})[_0x8831('0x2b')](handleEntityNotFound(_0x1222c3,null))[_0x8831('0x2b')](function(_0x3e0d85){if(_0x3e0d85){_0x6fe23b=_0x3e0d85;_0x51d6b1[_0x8831('0x36')]=_[_0x8831('0x37')](db['User']['rawAttributes']);_0x51d6b1[_0x8831('0x38')]=_[_0x8831('0x37')](_0x18a262[_0x8831('0x38')]);_0x51d6b1[_0x8831('0x39')]=_[_0x8831('0x3a')](_0x51d6b1[_0x8831('0x36')],_0x51d6b1['query']);_0x2e0e8a[_0x8831('0x3b')]=_[_0x8831('0x3a')](_0x51d6b1[_0x8831('0x36')],qs[_0x8831('0x3c')](_0x18a262[_0x8831('0x38')][_0x8831('0x3c')]));_0x2e0e8a[_0x8831('0x3b')]=_0x2e0e8a[_0x8831('0x3b')][_0x8831('0x3d')]?_0x2e0e8a[_0x8831('0x3b')]:_0x51d6b1[_0x8831('0x36')];_0x2e0e8a[_0x8831('0x40')]=qs[_0x8831('0x41')](_0x18a262[_0x8831('0x38')][_0x8831('0x41')]);_0x2e0e8a['where']=qs[_0x8831('0x39')](_[_0x8831('0x43')](_0x18a262[_0x8831('0x38')],_0x51d6b1[_0x8831('0x39')]));if(_0x18a262[_0x8831('0x38')][_0x8831('0x44')]){_0x2e0e8a['where']=_[_0x8831('0x45')](_0x2e0e8a[_0x8831('0x42')],{'$or':_[_0x8831('0x32')](_0x2e0e8a[_0x8831('0x3b')],function(_0x299254){var _0x38277e={};_0x38277e[_0x299254]={'$like':'%'+_0x18a262[_0x8831('0x38')][_0x8831('0x44')]+'%'};return _0x38277e;})});}_0x2e0e8a=_['merge']({},_0x2e0e8a,_0x18a262[_0x8831('0x48')]);return _0x6fe23b[_0x8831('0x8f')](_0x2e0e8a);}})[_0x8831('0x2b')](function(_0x34676e){if(_0x34676e){_0x167c73=_0x34676e[_0x8831('0x3d')];if(!_0x18a262[_0x8831('0x38')][_0x8831('0x3e')](_0x8831('0x3f'))){_0x2e0e8a[_0x8831('0x23')]=qs[_0x8831('0x23')](_0x18a262[_0x8831('0x38')][_0x8831('0x23')]);_0x2e0e8a['offset']=qs[_0x8831('0x22')](_0x18a262['query']['offset']);}return _0x6fe23b['getAgents'](_0x2e0e8a);}})[_0x8831('0x2b')](function(_0x22cfbc){if(_0x22cfbc){return _0x22cfbc?{'count':_0x167c73,'rows':_0x22cfbc}:null;}})[_0x8831('0x2b')](respondWithResult(_0x1222c3,null))['catch'](handleError(_0x1222c3,null));}; \ No newline at end of file +var _0x40fe=['../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','save','update','then','FaxQueues','destroy','stack','name','send','map','FaxQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','order','sort','where','filter','merge','VIRTUAL','rows','catch','show','params','fields','length','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','getMembers','findOne','UserFaxQueue','hasOwnProperty','nolimit','FaxQueueId','options','findAll','User','findAndCountAll','agent','faxPause','updatedAt','createdAt','%s/%s','SIP','Team','pick','getTeams','addTeams','voicePause','interface','flatMap','Agents','sequelize','each','findOrCreate','forEach','removeTeams','ids','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','includes','all','union','compact','value','transaction','removeAgents','emit','userFaxQueue:remove','addAgents','omit','spread','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x1fde60,_0xff7dd5){var _0x265ced=function(_0x56ee2a){while(--_0x56ee2a){_0x1fde60['push'](_0x1fde60['shift']());}};_0x265ced(++_0xff7dd5);}(_0x40fe,0x18f));var _0xe40f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x40fe[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require(_0xe40f('0x0'));var rimraf=require(_0xe40f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe40f('0x2'));var rp=require(_0xe40f('0x3'));var moment=require(_0xe40f('0x4'));var BPromise=require(_0xe40f('0x5'));var Mustache=require('mustache');var util=require(_0xe40f('0x6'));var path=require(_0xe40f('0x7'));var sox=require(_0xe40f('0x8'));var csv=require(_0xe40f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe40f('0xa'));var _=require(_0xe40f('0xb'));var squel=require('squel');var crypto=require(_0xe40f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe40f('0xd'));var toCsv=require(_0xe40f('0x9'));var querystring=require(_0xe40f('0xe'));var Papa=require(_0xe40f('0xf'));var Redis=require(_0xe40f('0x10'));var authService=require(_0xe40f('0x11'));var qs=require(_0xe40f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe40f('0x13'));var logger=require(_0xe40f('0x14'))(_0xe40f('0x15'));var utils=require(_0xe40f('0x16'));var config=require(_0xe40f('0x17'));var licenseUtil=require(_0xe40f('0x18'));var db=require(_0xe40f('0x19'))['db'];config[_0xe40f('0x1a')]=_[_0xe40f('0x1b')](config[_0xe40f('0x1a')],{'host':_0xe40f('0x1c'),'port':0x18eb});var socket=require(_0xe40f('0x1d'))(new Redis(config['redis']));require(_0xe40f('0x1e'))['register'](socket);function respondWithStatusCode(_0x13b17a,_0x595936){_0x595936=_0x595936||0xcc;return function(_0x1fa247){if(_0x1fa247){return _0x13b17a[_0xe40f('0x1f')](_0x595936);}return _0x13b17a[_0xe40f('0x20')](_0x595936)[_0xe40f('0x21')]();};}function respondWithResult(_0x42c24a,_0x422700){_0x422700=_0x422700||0xc8;return function(_0x48769a){if(_0x48769a){return _0x42c24a[_0xe40f('0x20')](_0x422700)[_0xe40f('0x22')](_0x48769a);}};}function respondWithFilteredResult(_0x230f07,_0x1edc68){return function(_0x5c4778){if(_0x5c4778){var _0x298309=typeof _0x1edc68[_0xe40f('0x23')]==='undefined'&&typeof _0x1edc68[_0xe40f('0x24')]===_0xe40f('0x25');var _0x5bb727=_0x5c4778[_0xe40f('0x26')];var _0x12280e=_0x298309?0x0:_0x1edc68[_0xe40f('0x23')];var _0x4bc740=_0x298309?_0x5c4778[_0xe40f('0x26')]:_0x1edc68['offset']+_0x1edc68[_0xe40f('0x24')];var _0x53d9a6;if(_0x4bc740>=_0x5bb727){_0x4bc740=_0x5bb727;_0x53d9a6=0xc8;}else{_0x53d9a6=0xce;}_0x230f07['status'](_0x53d9a6);return _0x230f07['set'](_0xe40f('0x27'),_0x12280e+'-'+_0x4bc740+'/'+_0x5bb727)[_0xe40f('0x22')](_0x5c4778);}return null;};}function patchUpdates(_0x17fb97){return function(_0x11a9d2){try{jsonpatch['apply'](_0x11a9d2,_0x17fb97,!![]);}catch(_0xcd9b5f){return BPromise[_0xe40f('0x28')](_0xcd9b5f);}return _0x11a9d2[_0xe40f('0x29')]();};}function saveUpdates(_0x310d1a,_0x230e60){return function(_0x4d2cd1){if(_0x4d2cd1){return _0x4d2cd1[_0xe40f('0x2a')](_0x310d1a)[_0xe40f('0x2b')](function(_0x264cb4){return _0x264cb4;});}return null;};}function removeEntity(_0x28a28a,_0x449668){return function(_0xa07e34){if(_0xa07e34){return _0xa07e34['destroy']()[_0xe40f('0x2b')](function(){var _0x3c2895=_0xa07e34['get']({'plain':!![]});var _0x2be4fd=_0xe40f('0x2c');return db['UserProfileResource'][_0xe40f('0x2d')]({'where':{'type':_0x2be4fd,'resourceId':_0x3c2895['id']}})[_0xe40f('0x2b')](function(){return _0xa07e34;});})[_0xe40f('0x2b')](function(){_0x28a28a[_0xe40f('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f85af,_0x4d1acc){return function(_0xd77a9f){if(!_0xd77a9f){_0x1f85af[_0xe40f('0x1f')](0x194);}return _0xd77a9f;};}function handleError(_0x42d061,_0x34a717){_0x34a717=_0x34a717||0x1f4;return function(_0x520b48){logger['error'](_0x520b48[_0xe40f('0x2e')]);if(_0x520b48['name']){delete _0x520b48[_0xe40f('0x2f')];}_0x42d061[_0xe40f('0x20')](_0x34a717)[_0xe40f('0x30')](_0x520b48);};}exports['index']=function(_0x2c0c4b,_0x1d03c1){var _0x46d174={},_0x22ff95={},_0x219af4={'count':0x0,'rows':[]};var _0x5a3447=_[_0xe40f('0x31')](db[_0xe40f('0x32')][_0xe40f('0x33')],function(_0x51f241){return{'name':_0x51f241[_0xe40f('0x34')],'type':_0x51f241[_0xe40f('0x35')][_0xe40f('0x36')]};});_0x22ff95[_0xe40f('0x37')]=_[_0xe40f('0x31')](_0x5a3447,_0xe40f('0x2f'));_0x22ff95[_0xe40f('0x38')]=_[_0xe40f('0x39')](_0x2c0c4b[_0xe40f('0x38')]);_0x22ff95[_0xe40f('0x3a')]=_[_0xe40f('0x3b')](_0x22ff95[_0xe40f('0x37')],_0x22ff95[_0xe40f('0x38')]);_0x46d174[_0xe40f('0x3c')]=_[_0xe40f('0x3b')](_0x22ff95[_0xe40f('0x37')],qs['fields'](_0x2c0c4b[_0xe40f('0x38')]['fields']));_0x46d174[_0xe40f('0x3c')]=_0x46d174[_0xe40f('0x3c')]['length']?_0x46d174[_0xe40f('0x3c')]:_0x22ff95[_0xe40f('0x37')];if(!_0x2c0c4b['query']['hasOwnProperty']('nolimit')){_0x46d174[_0xe40f('0x24')]=qs[_0xe40f('0x24')](_0x2c0c4b[_0xe40f('0x38')][_0xe40f('0x24')]);_0x46d174[_0xe40f('0x23')]=qs[_0xe40f('0x23')](_0x2c0c4b[_0xe40f('0x38')]['offset']);}_0x46d174[_0xe40f('0x3d')]=qs[_0xe40f('0x3e')](_0x2c0c4b[_0xe40f('0x38')][_0xe40f('0x3e')]);_0x46d174[_0xe40f('0x3f')]=qs['filters'](_['pick'](_0x2c0c4b[_0xe40f('0x38')],_0x22ff95[_0xe40f('0x3a')]),_0x5a3447);if(_0x2c0c4b[_0xe40f('0x38')][_0xe40f('0x40')]){_0x46d174[_0xe40f('0x3f')]=_[_0xe40f('0x41')](_0x46d174[_0xe40f('0x3f')],{'$or':_[_0xe40f('0x31')](_0x5a3447,function(_0xcb4182){if(_0xcb4182['type']!==_0xe40f('0x42')){var _0x2b0d06={};_0x2b0d06[_0xcb4182['name']]={'$like':'%'+_0x2c0c4b[_0xe40f('0x38')][_0xe40f('0x40')]+'%'};return _0x2b0d06;}})});}_0x46d174=_[_0xe40f('0x41')]({},_0x46d174,_0x2c0c4b['options']);var _0x2fb454={'where':_0x46d174[_0xe40f('0x3f')]};return db[_0xe40f('0x32')][_0xe40f('0x26')](_0x2fb454)['then'](function(_0x2914e2){_0x219af4['count']=_0x2914e2;if(_0x2c0c4b[_0xe40f('0x38')]['includeAll']){_0x46d174['include']=[{'all':!![]}];}return db[_0xe40f('0x32')]['findAll'](_0x46d174);})[_0xe40f('0x2b')](function(_0x2aebf6){_0x219af4[_0xe40f('0x43')]=_0x2aebf6;return _0x219af4;})[_0xe40f('0x2b')](respondWithFilteredResult(_0x1d03c1,_0x46d174))[_0xe40f('0x44')](handleError(_0x1d03c1,null));};exports[_0xe40f('0x45')]=function(_0x1b8265,_0x1a7e8c){var _0x1e5fa9={'raw':!![],'where':{'id':_0x1b8265[_0xe40f('0x46')]['id']}},_0x40789a={};_0x40789a[_0xe40f('0x37')]=_[_0xe40f('0x39')](db['FaxQueue'][_0xe40f('0x33')]);_0x40789a[_0xe40f('0x38')]=_[_0xe40f('0x39')](_0x1b8265['query']);_0x40789a['filters']=_['intersection'](_0x40789a[_0xe40f('0x37')],_0x40789a[_0xe40f('0x38')]);_0x1e5fa9[_0xe40f('0x3c')]=_[_0xe40f('0x3b')](_0x40789a[_0xe40f('0x37')],qs[_0xe40f('0x47')](_0x1b8265[_0xe40f('0x38')][_0xe40f('0x47')]));_0x1e5fa9['attributes']=_0x1e5fa9[_0xe40f('0x3c')][_0xe40f('0x48')]?_0x1e5fa9[_0xe40f('0x3c')]:_0x40789a[_0xe40f('0x37')];if(_0x1b8265[_0xe40f('0x38')][_0xe40f('0x49')]){_0x1e5fa9['include']=[{'all':!![]}];}_0x1e5fa9=_[_0xe40f('0x41')]({},_0x1e5fa9,_0x1b8265['options']);return db[_0xe40f('0x32')][_0xe40f('0x4a')](_0x1e5fa9)[_0xe40f('0x2b')](handleEntityNotFound(_0x1a7e8c,null))[_0xe40f('0x2b')](respondWithResult(_0x1a7e8c,null))[_0xe40f('0x44')](handleError(_0x1a7e8c,null));};exports[_0xe40f('0x4b')]=function(_0x40b9a0,_0x211638){return db[_0xe40f('0x32')][_0xe40f('0x4b')](_0x40b9a0[_0xe40f('0x4c')],{})[_0xe40f('0x2b')](function(_0x54abb1){var _0x5a6992=_0x40b9a0[_0xe40f('0x4d')][_0xe40f('0x4e')]({'plain':!![]});if(!_0x5a6992)throw new Error(_0xe40f('0x4f'));if(_0x5a6992[_0xe40f('0x50')]==='user'){var _0x5b2dac=_0x54abb1[_0xe40f('0x4e')]({'plain':!![]});var _0x2948ef=_0xe40f('0x2c');return db[_0xe40f('0x51')][_0xe40f('0x4a')]({'where':{'name':_0x2948ef,'userProfileId':_0x5a6992[_0xe40f('0x52')]},'raw':!![]})[_0xe40f('0x2b')](function(_0x580917){if(_0x580917&&_0x580917[_0xe40f('0x53')]===0x0){return db[_0xe40f('0x54')][_0xe40f('0x4b')]({'name':_0x5b2dac[_0xe40f('0x2f')],'resourceId':_0x5b2dac['id'],'type':_0x580917[_0xe40f('0x2f')],'sectionId':_0x580917['id']},{})[_0xe40f('0x2b')](function(){return _0x54abb1;});}else{return _0x54abb1;}})['catch'](function(_0x371602){logger[_0xe40f('0x55')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x371602);throw _0x371602;});}return _0x54abb1;})['then'](respondWithResult(_0x211638,0xc9))[_0xe40f('0x44')](handleError(_0x211638,null));};exports[_0xe40f('0x2a')]=function(_0x556d38,_0x43f5b8){if(_0x556d38[_0xe40f('0x4c')]['id']){delete _0x556d38[_0xe40f('0x4c')]['id'];}return db[_0xe40f('0x32')][_0xe40f('0x4a')]({'where':{'id':_0x556d38[_0xe40f('0x46')]['id']}})[_0xe40f('0x2b')](handleEntityNotFound(_0x43f5b8,null))[_0xe40f('0x2b')](saveUpdates(_0x556d38[_0xe40f('0x4c')],null))[_0xe40f('0x2b')](respondWithResult(_0x43f5b8,null))[_0xe40f('0x44')](handleError(_0x43f5b8,null));};exports['destroy']=function(_0x977676,_0x5e5a50){return db[_0xe40f('0x32')][_0xe40f('0x4a')]({'where':{'id':_0x977676[_0xe40f('0x46')]['id']}})[_0xe40f('0x2b')](handleEntityNotFound(_0x5e5a50,null))[_0xe40f('0x2b')](removeEntity(_0x5e5a50,null))['catch'](handleError(_0x5e5a50,null));};exports['describe']=function(_0x3debae,_0x373939){return db[_0xe40f('0x32')]['describe']()[_0xe40f('0x2b')](respondWithResult(_0x373939,null))[_0xe40f('0x44')](handleError(_0x373939,null));};exports[_0xe40f('0x56')]=function(_0x4963c4,_0x145a90,_0x5f4b3c){var _0x1c9b6d={'raw':!![],'where':{}},_0xa24f1e={},_0xf51406;return db[_0xe40f('0x32')][_0xe40f('0x57')]({'where':{'id':_0x4963c4[_0xe40f('0x46')]['id']}})['then'](handleEntityNotFound(_0x145a90,null))[_0xe40f('0x2b')](function(_0x3b33ac){if(_0x3b33ac){_0xf51406=_0x3b33ac[_0xe40f('0x4e')]({'plain':!![]});_0xa24f1e[_0xe40f('0x37')]=_[_0xe40f('0x39')](db[_0xe40f('0x58')][_0xe40f('0x33')]);_0xa24f1e[_0xe40f('0x38')]=_['keys'](_0x4963c4[_0xe40f('0x38')]);_0xa24f1e[_0xe40f('0x3a')]=_['intersection'](_0xa24f1e[_0xe40f('0x37')],_0xa24f1e[_0xe40f('0x38')]);_0x1c9b6d[_0xe40f('0x3c')]=_[_0xe40f('0x3b')](_0xa24f1e[_0xe40f('0x37')],qs[_0xe40f('0x47')](_0x4963c4[_0xe40f('0x38')]['fields']));_0x1c9b6d[_0xe40f('0x3c')]=_0x1c9b6d[_0xe40f('0x3c')]['length']?_0x1c9b6d[_0xe40f('0x3c')]:_0xa24f1e[_0xe40f('0x37')];if(!_0x4963c4[_0xe40f('0x38')][_0xe40f('0x59')](_0xe40f('0x5a'))){_0x1c9b6d[_0xe40f('0x24')]=qs[_0xe40f('0x24')](_0x4963c4[_0xe40f('0x38')]['limit']);_0x1c9b6d[_0xe40f('0x23')]=qs[_0xe40f('0x23')](_0x4963c4[_0xe40f('0x38')][_0xe40f('0x23')]);}_0x1c9b6d[_0xe40f('0x3d')]=qs['sort'](_0x4963c4[_0xe40f('0x38')][_0xe40f('0x3e')]);_0x1c9b6d['where']=qs['filters'](_['pick'](_0x4963c4['query'],_0xa24f1e[_0xe40f('0x3a')]));_0x1c9b6d[_0xe40f('0x3f')][_0xe40f('0x5b')]=_0x3b33ac['id'];if(_0x4963c4[_0xe40f('0x38')]['filter']){_0x1c9b6d[_0xe40f('0x3f')]=_['merge'](_0x1c9b6d[_0xe40f('0x3f')],{'$or':_['map'](_0x1c9b6d['attributes'],function(_0x5565ee){var _0x31125c={};_0x31125c[_0x5565ee]={'$like':'%'+_0x4963c4[_0xe40f('0x38')]['filter']+'%'};return _0x31125c;})});}_0x1c9b6d=_[_0xe40f('0x41')]({},_0x1c9b6d,_0x4963c4[_0xe40f('0x5c')]);return db[_0xe40f('0x58')][_0xe40f('0x5d')](_0x1c9b6d);}})[_0xe40f('0x2b')](function(_0x4c5309){if(_0x4c5309){return db[_0xe40f('0x5e')][_0xe40f('0x5f')]({'where':{'id':_[_0xe40f('0x31')](_0x4c5309,'UserId'),'role':_0xe40f('0x60')},'attributes':['id',_0xe40f('0x2f'),_0xe40f('0x61'),_0xe40f('0x62'),_0xe40f('0x63')]});}})[_0xe40f('0x2b')](function(_0x238be1){if(_0x238be1){return{'count':_0x238be1['count'],'rows':_[_0xe40f('0x31')](_0x238be1[_0xe40f('0x43')],function(_0x5dff29){return{'membername':_0x5dff29[_0xe40f('0x2f')],'UserId':_0x5dff29['id'],'queue_name':_0xf51406[_0xe40f('0x2f')],'FaxQueueId':_0xf51406['id'],'interface':util['format'](_0xe40f('0x64'),_0xe40f('0x65'),_0x5dff29[_0xe40f('0x2f')]),'penalty':0x0,'paused':_0x5dff29['faxPause'],'createdAt':_0x5dff29[_0xe40f('0x63')],'updatedAt':_0x5dff29[_0xe40f('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe40f('0x2b')](respondWithFilteredResult(_0x145a90,_0x1c9b6d))['catch'](handleError(_0x145a90,null));};exports['getTeams']=function(_0x1e85a0,_0x221ce1,_0x9afb1b){var _0x2e24a5={};var _0x4577b4={};var _0x597fa6;var _0x4e26f7;return db['FaxQueue']['findOne']({'where':{'id':_0x1e85a0[_0xe40f('0x46')]['id']}})['then'](handleEntityNotFound(_0x221ce1,null))[_0xe40f('0x2b')](function(_0x51f514){if(_0x51f514){_0x597fa6=_0x51f514;_0x4577b4[_0xe40f('0x37')]=_[_0xe40f('0x39')](db[_0xe40f('0x66')][_0xe40f('0x33')]);_0x4577b4[_0xe40f('0x38')]=_[_0xe40f('0x39')](_0x1e85a0[_0xe40f('0x38')]);_0x4577b4[_0xe40f('0x3a')]=_[_0xe40f('0x3b')](_0x4577b4[_0xe40f('0x37')],_0x4577b4[_0xe40f('0x38')]);_0x2e24a5[_0xe40f('0x3c')]=_['intersection'](_0x4577b4[_0xe40f('0x37')],qs[_0xe40f('0x47')](_0x1e85a0['query']['fields']));_0x2e24a5[_0xe40f('0x3c')]=_0x2e24a5[_0xe40f('0x3c')]['length']?_0x2e24a5[_0xe40f('0x3c')]:_0x4577b4[_0xe40f('0x37')];_0x2e24a5[_0xe40f('0x3d')]=qs[_0xe40f('0x3e')](_0x1e85a0[_0xe40f('0x38')][_0xe40f('0x3e')]);_0x2e24a5['where']=qs[_0xe40f('0x3a')](_[_0xe40f('0x67')](_0x1e85a0[_0xe40f('0x38')],_0x4577b4['filters']));if(_0x1e85a0[_0xe40f('0x38')][_0xe40f('0x40')]){_0x2e24a5[_0xe40f('0x3f')]=_[_0xe40f('0x41')](_0x2e24a5[_0xe40f('0x3f')],{'$or':_['map'](_0x2e24a5['attributes'],function(_0x4602d7){var _0x456926={};_0x456926[_0x4602d7]={'$like':'%'+_0x1e85a0[_0xe40f('0x38')][_0xe40f('0x40')]+'%'};return _0x456926;})});}_0x2e24a5=_[_0xe40f('0x41')]({},_0x2e24a5,_0x1e85a0[_0xe40f('0x5c')]);return _0x597fa6[_0xe40f('0x68')](_0x2e24a5);}})[_0xe40f('0x2b')](function(_0x412ed0){if(_0x412ed0){_0x4e26f7=_0x412ed0[_0xe40f('0x48')];if(!_0x1e85a0[_0xe40f('0x38')][_0xe40f('0x59')](_0xe40f('0x5a'))){_0x2e24a5[_0xe40f('0x24')]=qs[_0xe40f('0x24')](_0x1e85a0[_0xe40f('0x38')]['limit']);_0x2e24a5['offset']=qs[_0xe40f('0x23')](_0x1e85a0[_0xe40f('0x38')][_0xe40f('0x23')]);}return _0x597fa6[_0xe40f('0x68')](_0x2e24a5);}})['then'](function(_0x3d6f36){if(_0x3d6f36){return _0x3d6f36?{'count':_0x4e26f7,'rows':_0x3d6f36}:null;}})['then'](respondWithResult(_0x221ce1,null))['catch'](handleError(_0x221ce1,null));};exports[_0xe40f('0x69')]=function(_0x476b7f,_0x298227,_0x34d0ee){var _0x2a1e1c=_0x476b7f['body']['ids'];return db[_0xe40f('0x66')][_0xe40f('0x5d')]({'where':{'id':_0x2a1e1c},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xe40f('0x2f'),'online',_0xe40f('0x6a'),_0xe40f('0x6b')],'raw':!![]}]})['then'](function(_0x5c4e90){if(_0x5c4e90){var _0x56e67e=_[_0xe40f('0x6c')](_0x5c4e90,function(_0x365757){var _0x5eb2c5=_0x365757[_0xe40f('0x4e')]({'plain':!![]});return _0x5eb2c5[_0xe40f('0x6d')];});return db['FaxQueue']['find']({'where':{'id':_0x476b7f['params']['id']}})[_0xe40f('0x2b')](function(_0x22f17e){return db[_0xe40f('0x6e')]['transaction'](function(_0x18839a){return _0x22f17e[_0xe40f('0x69')](_0x2a1e1c,{'transaction':_0x18839a})[_0xe40f('0x2b')](function(){return BPromise[_0xe40f('0x6f')](_0x56e67e,function(_0x241202){return db[_0xe40f('0x58')][_0xe40f('0x70')]({'where':{'UserId':_0x241202['id'],'FaxQueueId':_0x476b7f[_0xe40f('0x46')]['id']},'transaction':_0x18839a});});})[_0xe40f('0x2b')](function(){_0x56e67e[_0xe40f('0x71')](function(_0xd48fe4){socket['emit']('userFaxQueue:save',{'UserId':_0xd48fe4['id'],'FaxQueueId':_0x22f17e['id']});});});});});}})[_0xe40f('0x2b')](respondWithStatusCode(_0x298227,null))[_0xe40f('0x44')](handleError(_0x298227,null));};exports[_0xe40f('0x72')]=function(_0x180817,_0x183bab,_0x23174a){return db['Team']['findAll']({'where':{'id':_0x180817['query'][_0xe40f('0x73')]},'attributes':['id'],'include':[{'model':db[_0xe40f('0x5e')],'as':_0xe40f('0x6d'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x183bab,null))[_0xe40f('0x2b')](function(_0x465ba7){var _0x49a534=_[_0xe40f('0x31')](_0x465ba7,'id');var _0x14f402=[];var _0x29d38a=[];var _0x24aed9=squel[_0xe40f('0x74')]();_0x24aed9[_0xe40f('0x75')](_0xe40f('0x76'))[_0xe40f('0x77')](_0xe40f('0x78'),'tq')[_0xe40f('0x79')](_0xe40f('0x7a'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xe40f('0x3f')]('FaxQueueId\x20=\x20?',_0x180817['params']['id']);for(var _0x5ab53e=0x0;_0x5ab53e<_0x465ba7[_0xe40f('0x48')];_0x5ab53e+=0x1){let _0x5c1b2b=_0x465ba7[_0x5ab53e];for(var _0x496c97=0x0;_0x496c97<_0x5c1b2b[_0xe40f('0x6d')][_0xe40f('0x48')];_0x496c97+=0x1){let _0x4abbb8=_0x5c1b2b[_0xe40f('0x6d')][_0x496c97];var _0x5ef0a7=_0x24aed9[_0xe40f('0x7b')]();_0x5ef0a7[_0xe40f('0x3f')](_0xe40f('0x7c'),_0x4abbb8['id']);_0x29d38a[_0xe40f('0x7d')](db[_0xe40f('0x6e')][_0xe40f('0x38')](_0x5ef0a7['toString'](),{'type':db[_0xe40f('0x6e')][_0xe40f('0x7e')]['SELECT']})[_0xe40f('0x2b')](function(_0x110e62){if(_0x110e62[_0xe40f('0x48')]===0x1){return _0x4abbb8['id'];}else{var _0x2c258b=_[_0xe40f('0x7f')](_['map'](_0x110e62,'TeamId'),function(_0x2e54f6){return _[_0xe40f('0x80')](_0x49a534,_0x2e54f6);});if(_0x2c258b){return _0x4abbb8['id'];}}}));}}return BPromise[_0xe40f('0x81')](_0x29d38a)[_0xe40f('0x2b')](function(_0x16687a){_0x14f402=_(_0x14f402)[_0xe40f('0x82')](_0x16687a)[_0xe40f('0x83')]()[_0xe40f('0x84')]();return db['FaxQueue'][_0xe40f('0x4a')]({'where':{'id':_0x180817[_0xe40f('0x46')]['id']}})[_0xe40f('0x2b')](function(_0x285752){return db[_0xe40f('0x6e')][_0xe40f('0x85')](function(_0x492d5b){return _0x285752[_0xe40f('0x72')](_0x180817[_0xe40f('0x38')][_0xe40f('0x73')],{'transaction':_0x492d5b})[_0xe40f('0x2b')](function(){if(!_['isEmpty'](_0x14f402)){return _0x285752[_0xe40f('0x86')](_0x14f402,{'transaction':_0x492d5b});}})['then'](function(){_0x14f402[_0xe40f('0x71')](function(_0x345375){socket[_0xe40f('0x87')](_0xe40f('0x88'),{'UserId':_0x345375,'FaxQueueId':_0x285752['id']});});});});});});})[_0xe40f('0x2b')](respondWithStatusCode(_0x183bab,null))[_0xe40f('0x44')](handleError(_0x183bab,null));};exports['addAgents']=function(_0x1cc86c,_0x17493d,_0x150be8){return db['FaxQueue'][_0xe40f('0x4a')]({'where':{'id':_0x1cc86c['params']['id']}})['then'](handleEntityNotFound(_0x17493d,null))[_0xe40f('0x2b')](function(_0x35609a){if(_0x35609a){return _0x35609a[_0xe40f('0x89')](_0x1cc86c[_0xe40f('0x4c')][_0xe40f('0x73')],_[_0xe40f('0x8a')](_0x1cc86c[_0xe40f('0x4c')],['ids','id'])||{})[_0xe40f('0x8b')](function(_0x8b2c1a){for(var _0x291c73=0x0;_0x291c73<_0x1cc86c[_0xe40f('0x4c')][_0xe40f('0x73')]['length'];_0x291c73+=0x1){socket['emit']('userFaxQueue:save',{'UserId':Number(_0x1cc86c[_0xe40f('0x4c')]['ids'][_0x291c73]),'FaxQueueId':Number(_0x1cc86c[_0xe40f('0x46')]['id'])});}return _0x8b2c1a;});}})[_0xe40f('0x2b')](respondWithResult(_0x17493d,null))[_0xe40f('0x44')](handleError(_0x17493d,null));};exports[_0xe40f('0x86')]=function(_0x29aef2,_0x242708,_0x143d27){return db[_0xe40f('0x32')][_0xe40f('0x4a')]({'where':{'id':_0x29aef2['params']['id']}})[_0xe40f('0x2b')](handleEntityNotFound(_0x242708,null))[_0xe40f('0x2b')](function(_0x321700){if(_0x321700){return _0x321700[_0xe40f('0x86')](_0x29aef2[_0xe40f('0x38')][_0xe40f('0x73')])[_0xe40f('0x2b')](function(){if(_['isArray'](_0x29aef2[_0xe40f('0x38')][_0xe40f('0x73')])){for(var _0x27490=0x0;_0x27490<_0x29aef2[_0xe40f('0x38')][_0xe40f('0x73')][_0xe40f('0x48')];_0x27490+=0x1){socket[_0xe40f('0x87')](_0xe40f('0x88'),{'UserId':Number(_0x29aef2['query']['ids'][_0x27490]),'FaxQueueId':Number(_0x29aef2['params']['id'])});}}else{socket['emit'](_0xe40f('0x88'),{'UserId':Number(_0x29aef2['query']['ids']),'FaxQueueId':Number(_0x29aef2[_0xe40f('0x46')]['id'])});}});}})[_0xe40f('0x2b')](respondWithStatusCode(_0x242708,null))[_0xe40f('0x44')](handleError(_0x242708,null));};exports[_0xe40f('0x8c')]=function(_0x367411,_0x5a12db,_0x1ed484){var _0x11f469={};var _0x180c55={};var _0x221ccd;var _0x4ffa43;return db[_0xe40f('0x32')][_0xe40f('0x57')]({'where':{'id':_0x367411[_0xe40f('0x46')]['id']}})[_0xe40f('0x2b')](handleEntityNotFound(_0x5a12db,null))[_0xe40f('0x2b')](function(_0xcd1abc){if(_0xcd1abc){_0x221ccd=_0xcd1abc;_0x180c55[_0xe40f('0x37')]=_[_0xe40f('0x39')](db[_0xe40f('0x5e')]['rawAttributes']);_0x180c55[_0xe40f('0x38')]=_[_0xe40f('0x39')](_0x367411['query']);_0x180c55[_0xe40f('0x3a')]=_['intersection'](_0x180c55[_0xe40f('0x37')],_0x180c55[_0xe40f('0x38')]);_0x11f469[_0xe40f('0x3c')]=_[_0xe40f('0x3b')](_0x180c55['model'],qs['fields'](_0x367411[_0xe40f('0x38')][_0xe40f('0x47')]));_0x11f469[_0xe40f('0x3c')]=_0x11f469[_0xe40f('0x3c')]['length']?_0x11f469['attributes']:_0x180c55['model'];_0x11f469[_0xe40f('0x3d')]=qs[_0xe40f('0x3e')](_0x367411['query']['sort']);_0x11f469[_0xe40f('0x3f')]=qs[_0xe40f('0x3a')](_[_0xe40f('0x67')](_0x367411['query'],_0x180c55[_0xe40f('0x3a')]));if(_0x367411[_0xe40f('0x38')][_0xe40f('0x40')]){_0x11f469[_0xe40f('0x3f')]=_[_0xe40f('0x41')](_0x11f469['where'],{'$or':_['map'](_0x11f469[_0xe40f('0x3c')],function(_0x299525){var _0x26ec75={};_0x26ec75[_0x299525]={'$like':'%'+_0x367411[_0xe40f('0x38')][_0xe40f('0x40')]+'%'};return _0x26ec75;})});}_0x11f469=_[_0xe40f('0x41')]({},_0x11f469,_0x367411[_0xe40f('0x5c')]);return _0x221ccd['getAgents'](_0x11f469);}})[_0xe40f('0x2b')](function(_0x2150bb){if(_0x2150bb){_0x4ffa43=_0x2150bb[_0xe40f('0x48')];if(!_0x367411['query'][_0xe40f('0x59')](_0xe40f('0x5a'))){_0x11f469['limit']=qs['limit'](_0x367411[_0xe40f('0x38')][_0xe40f('0x24')]);_0x11f469[_0xe40f('0x23')]=qs[_0xe40f('0x23')](_0x367411[_0xe40f('0x38')][_0xe40f('0x23')]);}return _0x221ccd['getAgents'](_0x11f469);}})['then'](function(_0x3c441e){if(_0x3c441e){return _0x3c441e?{'count':_0x4ffa43,'rows':_0x3c441e}:null;}})[_0xe40f('0x2b')](respondWithResult(_0x5a12db,null))[_0xe40f('0x44')](handleError(_0x5a12db,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 98010e9..3d04bc4 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 _0x2066=['../../mysqldb','FaxQueue','setMaxListeners','save','remove','hasOwnProperty','exports'];(function(_0x1ab180,_0x382b2c){var _0xfb2c2d=function(_0x1c5fd3){while(--_0x1c5fd3){_0x1ab180['push'](_0x1ab180['shift']());}};_0xfb2c2d(++_0x382b2c);}(_0x2066,0x142));var _0x6206=function(_0x2c58e9,_0x1ec24e){_0x2c58e9=_0x2c58e9-0x0;var _0x148b0e=_0x2066[_0x2c58e9];return _0x148b0e;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x6206('0x0'))['db'][_0x6206('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x6206('0x2')](0x0);var events={'afterCreate':_0x6206('0x3'),'afterUpdate':'update','afterDestroy':_0x6206('0x4')};function emitEvent(_0x2288cd){return function(_0x45195a,_0x13884c,_0x3c7455){FaxQueueEvents['emit'](_0x2288cd+':'+_0x45195a['id'],_0x45195a);FaxQueueEvents['emit'](_0x2288cd,_0x45195a);_0x3c7455(null);};}for(var e in events){if(events[_0x6206('0x5')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x6206('0x6')]=FaxQueueEvents; \ No newline at end of file +var _0x25f7=['setMaxListeners','update','remove','emit'];(function(_0x3eb19c,_0x20af38){var _0x4abc7a=function(_0x5638a3){while(--_0x5638a3){_0x3eb19c['push'](_0x3eb19c['shift']());}};_0x4abc7a(++_0x20af38);}(_0x25f7,0xd4));var _0x725f=function(_0x34b6f1,_0x308bea){_0x34b6f1=_0x34b6f1-0x0;var _0x4dfd13=_0x25f7[_0x34b6f1];return _0x4dfd13;};'use strict';var EventEmitter=require('events');var FaxQueue=require('../../mysqldb')['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x725f('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':_0x725f('0x1'),'afterDestroy':_0x725f('0x2')};function emitEvent(_0x53de9c){return function(_0x53b0f5,_0x3146a5,_0x196045){FaxQueueEvents['emit'](_0x53de9c+':'+_0x53b0f5['id'],_0x53b0f5);FaxQueueEvents[_0x725f('0x3')](_0x53de9c,_0x53b0f5);_0x196045(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 6816e6a..8b84109 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 _0x5074=['./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x1a3f30,_0x5e09e8){var _0x129b0c=function(_0x3ab042){while(--_0x3ab042){_0x1a3f30['push'](_0x1a3f30['shift']());}};_0x129b0c(++_0x5e09e8);}(_0x5074,0x1a5));var _0x4507=function(_0x291d3f,_0x3ef99f){_0x291d3f=_0x291d3f-0x0;var _0x242080=_0x5074[_0x291d3f];return _0x242080;};'use strict';var _=require(_0x4507('0x0'));var util=require(_0x4507('0x1'));var logger=require('../../config/logger')(_0x4507('0x2'));var moment=require(_0x4507('0x3'));var BPromise=require(_0x4507('0x4'));var rp=require(_0x4507('0x5'));var fs=require('fs');var path=require(_0x4507('0x6'));var rimraf=require('rimraf');var config=require(_0x4507('0x7'));var attributes=require(_0x4507('0x8'));module[_0x4507('0x9')]=function(_0x4b20e8,_0x4297b5){return _0x4b20e8[_0x4507('0xa')](_0x4507('0xb'),attributes,{'tableName':_0x4507('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1f7f=['../../config/logger','moment','bluebird','request-promise','path','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','util'];(function(_0x3f4dd9,_0xe0b819){var _0x31c54a=function(_0x25e6c6){while(--_0x25e6c6){_0x3f4dd9['push'](_0x3f4dd9['shift']());}};_0x31c54a(++_0xe0b819);}(_0x1f7f,0x166));var _0xf1f7=function(_0x151ecd,_0x18ecb1){_0x151ecd=_0x151ecd-0x0;var _0x4c2325=_0x1f7f[_0x151ecd];return _0x4c2325;};'use strict';var _=require(_0xf1f7('0x0'));var util=require(_0xf1f7('0x1'));var logger=require(_0xf1f7('0x2'))('api');var moment=require(_0xf1f7('0x3'));var BPromise=require(_0xf1f7('0x4'));var rp=require(_0xf1f7('0x5'));var fs=require('fs');var path=require(_0xf1f7('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf1f7('0x7'));module[_0xf1f7('0x8')]=function(_0xba90db,_0x1b7247){return _0xba90db[_0xf1f7('0x9')](_0xf1f7('0xa'),attributes,{'tableName':_0xf1f7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 4ef5c8a..5b05c76 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 _0x38da=['../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','info','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxQueue,\x20%s,\x20%s','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','find','ShowFaxQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x133296,_0xe8ff9a){var _0x193517=function(_0x161ffd){while(--_0x161ffd){_0x133296['push'](_0x133296['shift']());}};_0x193517(++_0xe8ff9a);}(_0x38da,0x1c6));var _0xa38d=function(_0x5958d2,_0x550300){_0x5958d2=_0x5958d2-0x0;var _0x2a4809=_0x38da[_0x5958d2];return _0x2a4809;};'use strict';var _=require(_0xa38d('0x0'));var util=require(_0xa38d('0x1'));var moment=require(_0xa38d('0x2'));var BPromise=require(_0xa38d('0x3'));var rs=require(_0xa38d('0x4'));var fs=require('fs');var Redis=require(_0xa38d('0x5'));var db=require(_0xa38d('0x6'))['db'];var utils=require(_0xa38d('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xa38d('0x8'));var jayson=require(_0xa38d('0x9'));var client=jayson['client'][_0xa38d('0xa')]({'port':0x232a});config[_0xa38d('0xb')]=_[_0xa38d('0xc')](config[_0xa38d('0xb')],{'host':_0xa38d('0xd'),'port':0x18eb});var socket=require(_0xa38d('0xe'))(new Redis(config['redis']));require(_0xa38d('0xf'))[_0xa38d('0x10')](socket);function respondWithRpcPromise(_0x3d9cd8,_0x529a64,_0x3c3e15){return new BPromise(function(_0x20d6ad,_0xda2666){return client[_0xa38d('0x11')](_0x3d9cd8,_0x3c3e15)['then'](function(_0x199f1e){logger[_0xa38d('0x12')]('FaxQueue,\x20%s,\x20%s',_0x529a64,'request\x20sent');logger[_0xa38d('0x13')](_0xa38d('0x14'),_0x529a64,'request\x20sent',JSON[_0xa38d('0x15')](_0x199f1e));if(_0x199f1e['error']){if(_0x199f1e[_0xa38d('0x16')][_0xa38d('0x17')]===0x1f4){logger['error']('FaxQueue,\x20%s,\x20%s',_0x529a64,_0x199f1e[_0xa38d('0x16')][_0xa38d('0x18')]);return _0xda2666(_0x199f1e['error']['message']);}logger[_0xa38d('0x16')](_0xa38d('0x19'),_0x529a64,_0x199f1e[_0xa38d('0x16')][_0xa38d('0x18')]);return _0x20d6ad(_0x199f1e[_0xa38d('0x16')]['message']);}else{logger[_0xa38d('0x12')](_0xa38d('0x19'),_0x529a64,'request\x20sent');_0x20d6ad(_0x199f1e[_0xa38d('0x1a')][_0xa38d('0x18')]);}})[_0xa38d('0x1b')](function(_0xeb147e){logger['error'](_0xa38d('0x19'),_0x529a64,_0xeb147e);_0xda2666(_0xeb147e);});});}exports[_0xa38d('0x1c')]=function(_0x158ab8){var _0x448f04=this;return new Promise(function(_0x32ab3b,_0x2e549a){return db[_0xa38d('0x1d')][_0xa38d('0x1e')]({'raw':_0x158ab8[_0xa38d('0x1f')]?_0x158ab8[_0xa38d('0x1f')][_0xa38d('0x20')]===undefined?!![]:![]:!![],'where':_0x158ab8[_0xa38d('0x1f')]?_0x158ab8[_0xa38d('0x1f')][_0xa38d('0x21')]||null:null,'attributes':_0x158ab8[_0xa38d('0x1f')]?_0x158ab8['options'][_0xa38d('0x22')]||null:null,'limit':_0x158ab8[_0xa38d('0x1f')]?_0x158ab8[_0xa38d('0x1f')][_0xa38d('0x23')]||null:null,'include':_0x158ab8[_0xa38d('0x1f')]?_0x158ab8[_0xa38d('0x1f')][_0xa38d('0x24')]?_[_0xa38d('0x25')](_0x158ab8['options'][_0xa38d('0x24')],function(_0x3661de){return{'model':db[_0x3661de[_0xa38d('0x26')]],'as':_0x3661de['as'],'attributes':_0x3661de[_0xa38d('0x22')],'include':_0x3661de['include']?_[_0xa38d('0x25')](_0x3661de[_0xa38d('0x24')],function(_0x506e9a){return{'model':db[_0x506e9a[_0xa38d('0x26')]],'as':_0x506e9a['as'],'attributes':_0x506e9a[_0xa38d('0x22')],'include':_0x506e9a[_0xa38d('0x24')]?_[_0xa38d('0x25')](_0x506e9a['include'],function(_0x242eaf){return{'model':db[_0x242eaf[_0xa38d('0x26')]],'as':_0x242eaf['as'],'attributes':_0x242eaf[_0xa38d('0x22')]};}):[]};}):[]};}):[]:[]})[_0xa38d('0x27')](function(_0x4aa883){logger['info'](_0xa38d('0x1c'),_0x158ab8);logger['debug'](_0xa38d('0x1c'),_0x158ab8,JSON[_0xa38d('0x15')](_0x4aa883));_0x32ab3b(_0x4aa883);})[_0xa38d('0x1b')](function(_0x428c25){logger['error'](_0xa38d('0x1c'),_0x428c25[_0xa38d('0x18')],_0x158ab8);_0x2e549a(_0x448f04[_0xa38d('0x16')](0x1f4,_0x428c25[_0xa38d('0x18')]));});});};exports['ShowFaxQueue']=function(_0x3d2d6a){var _0x3bbbaa=this;return new Promise(function(_0x22c34d,_0x7ea2ae){return db[_0xa38d('0x1d')][_0xa38d('0x28')]({'raw':_0x3d2d6a[_0xa38d('0x1f')]?_0x3d2d6a[_0xa38d('0x1f')][_0xa38d('0x20')]===undefined?!![]:![]:!![],'where':_0x3d2d6a[_0xa38d('0x1f')]?_0x3d2d6a[_0xa38d('0x1f')][_0xa38d('0x21')]||null:null,'attributes':_0x3d2d6a[_0xa38d('0x1f')]?_0x3d2d6a[_0xa38d('0x1f')]['attributes']||null:null,'include':_0x3d2d6a['options']?_0x3d2d6a[_0xa38d('0x1f')][_0xa38d('0x24')]?_[_0xa38d('0x25')](_0x3d2d6a[_0xa38d('0x1f')]['include'],function(_0x4237d0){return{'model':db[_0x4237d0['model']],'as':_0x4237d0['as'],'attributes':_0x4237d0[_0xa38d('0x22')],'include':_0x4237d0[_0xa38d('0x24')]?_[_0xa38d('0x25')](_0x4237d0[_0xa38d('0x24')],function(_0x3800b6){return{'model':db[_0x3800b6[_0xa38d('0x26')]],'as':_0x3800b6['as'],'attributes':_0x3800b6[_0xa38d('0x22')],'include':_0x3800b6[_0xa38d('0x24')]?_[_0xa38d('0x25')](_0x3800b6[_0xa38d('0x24')],function(_0x7078a5){return{'model':db[_0x7078a5[_0xa38d('0x26')]],'as':_0x7078a5['as'],'attributes':_0x7078a5['attributes']};}):[]};}):[]};}):[]:[]})[_0xa38d('0x27')](function(_0x1ab1cc){logger[_0xa38d('0x12')](_0xa38d('0x29'),_0x3d2d6a);logger[_0xa38d('0x13')](_0xa38d('0x29'),_0x3d2d6a,JSON['stringify'](_0x1ab1cc));_0x22c34d(_0x1ab1cc);})[_0xa38d('0x1b')](function(_0x5d61a2){logger[_0xa38d('0x16')](_0xa38d('0x29'),_0x5d61a2[_0xa38d('0x18')],_0x3d2d6a);_0x7ea2ae(_0x3bbbaa['error'](0x1f4,_0x5d61a2['message']));});});}; \ No newline at end of file +var _0x5974=['stringify','ShowFaxQueue','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','findAll','options','raw','attributes','include','map','model','GetFaxQueue'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x5974,0x16b));var _0x4597=function(_0x4fd812,_0x575915){_0x4fd812=_0x4fd812-0x0;var _0x6064b5=_0x5974[_0x4fd812];return _0x6064b5;};'use strict';var _=require(_0x4597('0x0'));var util=require('util');var moment=require(_0x4597('0x1'));var BPromise=require(_0x4597('0x2'));var rs=require(_0x4597('0x3'));var fs=require('fs');var Redis=require(_0x4597('0x4'));var db=require(_0x4597('0x5'))['db'];var utils=require(_0x4597('0x6'));var logger=require(_0x4597('0x7'))('rpc');var config=require(_0x4597('0x8'));var jayson=require(_0x4597('0x9'));var client=jayson[_0x4597('0xa')][_0x4597('0xb')]({'port':0x232a});config[_0x4597('0xc')]=_[_0x4597('0xd')](config[_0x4597('0xc')],{'host':_0x4597('0xe'),'port':0x18eb});var socket=require(_0x4597('0xf'))(new Redis(config[_0x4597('0xc')]));require(_0x4597('0x10'))[_0x4597('0x11')](socket);function respondWithRpcPromise(_0x2625bd,_0x17124e,_0x33e0c0){return new BPromise(function(_0x3a57,_0x725312){return client[_0x4597('0x12')](_0x2625bd,_0x33e0c0)[_0x4597('0x13')](function(_0x99817d){logger[_0x4597('0x14')](_0x4597('0x15'),_0x17124e,_0x4597('0x16'));logger[_0x4597('0x17')](_0x4597('0x18'),_0x17124e,_0x4597('0x16'),JSON['stringify'](_0x99817d));if(_0x99817d[_0x4597('0x19')]){if(_0x99817d['error'][_0x4597('0x1a')]===0x1f4){logger['error'](_0x4597('0x15'),_0x17124e,_0x99817d[_0x4597('0x19')][_0x4597('0x1b')]);return _0x725312(_0x99817d[_0x4597('0x19')][_0x4597('0x1b')]);}logger[_0x4597('0x19')]('FaxQueue,\x20%s,\x20%s',_0x17124e,_0x99817d[_0x4597('0x19')][_0x4597('0x1b')]);return _0x3a57(_0x99817d[_0x4597('0x19')][_0x4597('0x1b')]);}else{logger[_0x4597('0x14')](_0x4597('0x15'),_0x17124e,_0x4597('0x16'));_0x3a57(_0x99817d['result'][_0x4597('0x1b')]);}})[_0x4597('0x1c')](function(_0xb16425){logger[_0x4597('0x19')]('FaxQueue,\x20%s,\x20%s',_0x17124e,_0xb16425);_0x725312(_0xb16425);});});}exports['GetFaxQueue']=function(_0x22207d){var _0x28d906=this;return new Promise(function(_0x16b80a,_0x20a180){return db['FaxQueue'][_0x4597('0x1d')]({'raw':_0x22207d[_0x4597('0x1e')]?_0x22207d[_0x4597('0x1e')][_0x4597('0x1f')]===undefined?!![]:![]:!![],'where':_0x22207d['options']?_0x22207d[_0x4597('0x1e')]['where']||null:null,'attributes':_0x22207d[_0x4597('0x1e')]?_0x22207d['options'][_0x4597('0x20')]||null:null,'limit':_0x22207d[_0x4597('0x1e')]?_0x22207d['options']['limit']||null:null,'include':_0x22207d[_0x4597('0x1e')]?_0x22207d['options'][_0x4597('0x21')]?_['map'](_0x22207d[_0x4597('0x1e')][_0x4597('0x21')],function(_0x36d484){return{'model':db[_0x36d484['model']],'as':_0x36d484['as'],'attributes':_0x36d484['attributes'],'include':_0x36d484[_0x4597('0x21')]?_[_0x4597('0x22')](_0x36d484['include'],function(_0x2ec24d){return{'model':db[_0x2ec24d['model']],'as':_0x2ec24d['as'],'attributes':_0x2ec24d[_0x4597('0x20')],'include':_0x2ec24d[_0x4597('0x21')]?_['map'](_0x2ec24d[_0x4597('0x21')],function(_0x25723c){return{'model':db[_0x25723c[_0x4597('0x23')]],'as':_0x25723c['as'],'attributes':_0x25723c[_0x4597('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4597('0x13')](function(_0x4cf2a8){logger['info']('GetFaxQueue',_0x22207d);logger[_0x4597('0x17')](_0x4597('0x24'),_0x22207d,JSON[_0x4597('0x25')](_0x4cf2a8));_0x16b80a(_0x4cf2a8);})[_0x4597('0x1c')](function(_0x2c57f0){logger['error']('GetFaxQueue',_0x2c57f0[_0x4597('0x1b')],_0x22207d);_0x20a180(_0x28d906[_0x4597('0x19')](0x1f4,_0x2c57f0[_0x4597('0x1b')]));});});};exports[_0x4597('0x26')]=function(_0x3d2697){var _0x2cdc26=this;return new Promise(function(_0x5abd5a,_0x14bfa3){return db['FaxQueue']['find']({'raw':_0x3d2697[_0x4597('0x1e')]?_0x3d2697[_0x4597('0x1e')][_0x4597('0x1f')]===undefined?!![]:![]:!![],'where':_0x3d2697[_0x4597('0x1e')]?_0x3d2697['options'][_0x4597('0x27')]||null:null,'attributes':_0x3d2697[_0x4597('0x1e')]?_0x3d2697['options']['attributes']||null:null,'include':_0x3d2697[_0x4597('0x1e')]?_0x3d2697['options'][_0x4597('0x21')]?_['map'](_0x3d2697['options']['include'],function(_0x1c4332){return{'model':db[_0x1c4332[_0x4597('0x23')]],'as':_0x1c4332['as'],'attributes':_0x1c4332['attributes'],'include':_0x1c4332[_0x4597('0x21')]?_[_0x4597('0x22')](_0x1c4332[_0x4597('0x21')],function(_0x5000f5){return{'model':db[_0x5000f5['model']],'as':_0x5000f5['as'],'attributes':_0x5000f5[_0x4597('0x20')],'include':_0x5000f5['include']?_[_0x4597('0x22')](_0x5000f5[_0x4597('0x21')],function(_0x2a1930){return{'model':db[_0x2a1930[_0x4597('0x23')]],'as':_0x2a1930['as'],'attributes':_0x2a1930[_0x4597('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4597('0x13')](function(_0x4ebc09){logger[_0x4597('0x14')](_0x4597('0x26'),_0x3d2697);logger[_0x4597('0x17')]('ShowFaxQueue',_0x3d2697,JSON[_0x4597('0x25')](_0x4ebc09));_0x5abd5a(_0x4ebc09);})[_0x4597('0x1c')](function(_0x49b2c0){logger[_0x4597('0x19')](_0x4597('0x26'),_0x49b2c0[_0x4597('0x1b')],_0x3d2697);_0x14bfa3(_0x2cdc26[_0x4597('0x19')](0x1f4,_0x49b2c0[_0x4597('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 106282a..8ee7f32 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 _0xe107=['remove','update','removeListener','register','length','./faxQueue.events'];(function(_0xf2acd5,_0x1c4cc0){var _0x2ae8b9=function(_0x105a26){while(--_0x105a26){_0xf2acd5['push'](_0xf2acd5['shift']());}};_0x2ae8b9(++_0x1c4cc0);}(_0xe107,0xb3));var _0x7e10=function(_0x24fd0e,_0x4a3b07){_0x24fd0e=_0x24fd0e-0x0;var _0x4ddc9d=_0xe107[_0x24fd0e];return _0x4ddc9d;};'use strict';var FaxQueueEvents=require(_0x7e10('0x0'));var events=['save',_0x7e10('0x1'),_0x7e10('0x2')];function createListener(_0x2871b0,_0x570b2a){return function(_0x31212d){_0x570b2a['emit'](_0x2871b0,_0x31212d);};}function removeListener(_0x4db676,_0x2bdf3c){return function(){FaxQueueEvents[_0x7e10('0x3')](_0x4db676,_0x2bdf3c);};}exports[_0x7e10('0x4')]=function(_0x5be19f){for(var _0x5f1edf=0x0,_0x1dd3de=events[_0x7e10('0x5')];_0x5f1edf<_0x1dd3de;_0x5f1edf++){var _0x156c56=events[_0x5f1edf];var _0x3413f7=createListener('faxQueue:'+_0x156c56,_0x5be19f);FaxQueueEvents['on'](_0x156c56,_0x3413f7);}}; \ No newline at end of file +var _0x612a=['removeListener','length','save','remove','update','emit'];(function(_0x3539c0,_0x228e11){var _0x344ba8=function(_0xfd4e6c){while(--_0xfd4e6c){_0x3539c0['push'](_0x3539c0['shift']());}};_0x344ba8(++_0x228e11);}(_0x612a,0xa4));var _0xa612=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0x612a[_0x3c2a69];return _0x596bc8;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0xa612('0x0'),_0xa612('0x1'),_0xa612('0x2')];function createListener(_0x10c456,_0x57b0bf){return function(_0xd071c0){_0x57b0bf[_0xa612('0x3')](_0x10c456,_0xd071c0);};}function removeListener(_0x30aea1,_0x38d41f){return function(){FaxQueueEvents[_0xa612('0x4')](_0x30aea1,_0x38d41f);};}exports['register']=function(_0x220137){for(var _0x127f4a=0x0,_0x1549e4=events[_0xa612('0x5')];_0x127f4a<_0x1549e4;_0x127f4a++){var _0x45a0b6=events[_0x127f4a];var _0x17b168=createListener('faxQueue:'+_0x45a0b6,_0x220137);FaxQueueEvents['on'](_0x45a0b6,_0x17b168);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 3deb462..4305787 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 _0x8aad=['removeAgents','exports','multer','util','connect-timeout','Router','fs-extra','../../config/environment','isAuthenticated','index','get','describe','/:id','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','delete','destroy','/:id/teams','removeTeams'];(function(_0x27051e,_0x533102){var _0xb0765b=function(_0xed0d82){while(--_0xed0d82){_0x27051e['push'](_0x27051e['shift']());}};_0xb0765b(++_0x533102);}(_0x8aad,0x146));var _0xd8aa=function(_0x400efe,_0x33b028){_0x400efe=_0x400efe-0x0;var _0x60b7d1=_0x8aad[_0x400efe];return _0x60b7d1;};'use strict';var multer=require(_0xd8aa('0x0'));var util=require(_0xd8aa('0x1'));var path=require('path');var timeout=require(_0xd8aa('0x2'));var express=require('express');var router=express[_0xd8aa('0x3')]();var fs_extra=require(_0xd8aa('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd8aa('0x5'));var controller=require('./faxQueue.controller');router['get']('/',auth[_0xd8aa('0x6')](),controller[_0xd8aa('0x7')]);router[_0xd8aa('0x8')]('/describe',auth[_0xd8aa('0x6')](),controller[_0xd8aa('0x9')]);router[_0xd8aa('0x8')](_0xd8aa('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xd8aa('0x8')](_0xd8aa('0xb'),auth[_0xd8aa('0x6')](),controller[_0xd8aa('0xc')]);router[_0xd8aa('0x8')]('/:id/teams',auth[_0xd8aa('0x6')](),controller[_0xd8aa('0xd')]);router[_0xd8aa('0x8')](_0xd8aa('0xe'),auth[_0xd8aa('0x6')](),controller[_0xd8aa('0xf')]);router[_0xd8aa('0x10')]('/',auth[_0xd8aa('0x6')](),controller[_0xd8aa('0x11')]);router[_0xd8aa('0x10')]('/:id/teams',auth['isAuthenticated'](),controller[_0xd8aa('0x12')]);router[_0xd8aa('0x10')](_0xd8aa('0xe'),auth['isAuthenticated'](),controller[_0xd8aa('0x13')]);router[_0xd8aa('0x14')](_0xd8aa('0xa'),auth[_0xd8aa('0x6')](),controller['update']);router[_0xd8aa('0x15')](_0xd8aa('0xa'),auth['isAuthenticated'](),controller[_0xd8aa('0x16')]);router[_0xd8aa('0x15')](_0xd8aa('0x17'),auth[_0xd8aa('0x6')](),controller[_0xd8aa('0x18')]);router['delete'](_0xd8aa('0xe'),auth[_0xd8aa('0x6')](),controller[_0xd8aa('0x19')]);module[_0xd8aa('0x1a')]=router; \ No newline at end of file +var _0xadb5=['index','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','put','update','delete','destroy','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x20f3a7,_0x3c3b3e){var _0x50b8a8=function(_0x22cf95){while(--_0x22cf95){_0x20f3a7['push'](_0x20f3a7['shift']());}};_0x50b8a8(++_0x3c3b3e);}(_0xadb5,0xad));var _0x5adb=function(_0x14fdaf,_0x57cc25){_0x14fdaf=_0x14fdaf-0x0;var _0x22ea1e=_0xadb5[_0x14fdaf];return _0x22ea1e;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./faxQueue.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0x7')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller['getMembers']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['get'](_0x5adb('0x11'),auth['isAuthenticated'](),controller[_0x5adb('0x12')]);router['post']('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x13')]);router[_0x5adb('0x14')]('/:id/teams',auth[_0x5adb('0x8')](),controller[_0x5adb('0x15')]);router[_0x5adb('0x14')]('/:id/users',auth[_0x5adb('0x8')](),controller['addAgents']);router[_0x5adb('0x16')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);router[_0x5adb('0x18')]('/:id/teams',auth[_0x5adb('0x8')](),controller['removeTeams']);router[_0x5adb('0x18')]('/:id/users',auth[_0x5adb('0x8')](),controller['removeAgents']);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 a9042f3..5b7a996 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 _0xc418=['STRING','DATE','moment','sequelize','exports'];(function(_0x24edd4,_0x5e1a30){var _0x291119=function(_0x41065a){while(--_0x41065a){_0x24edd4['push'](_0x24edd4['shift']());}};_0x291119(++_0x5e1a30);}(_0xc418,0xd9));var _0x8c41=function(_0x4a513d,_0x4d7fd2){_0x4a513d=_0x4a513d-0x0;var _0xea3311=_0xc418[_0x4a513d];return _0xea3311;};'use strict';var moment=require(_0x8c41('0x0'));var Sequelize=require(_0x8c41('0x1'));module[_0x8c41('0x2')]={'uniqueid':{'type':Sequelize[_0x8c41('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x8c41('0x3')]},'joinAt':{'type':Sequelize[_0x8c41('0x4')]},'leaveAt':{'type':Sequelize[_0x8c41('0x4')]},'acceptAt':{'type':Sequelize[_0x8c41('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x8c41('0x3')]}}; \ No newline at end of file +var _0xd9fe=['DATE','moment','sequelize','exports','STRING'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xd9fe,0x1a0));var _0xed9f=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xd9fe[_0x5d2803];return _0xdcad2c;};'use strict';var moment=require(_0xed9f('0x0'));var Sequelize=require(_0xed9f('0x1'));module[_0xed9f('0x2')]={'uniqueid':{'type':Sequelize[_0xed9f('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xed9f('0x4')]},'leaveAt':{'type':Sequelize[_0xed9f('0x4')]},'acceptAt':{'type':Sequelize[_0xed9f('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xed9f('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 71c3ff7..b3accb5 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 _0xc73e=['error','stack','name','send','index','FaxQueueReport','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','find','catch','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc73e,0x1e9));var _0xec73=function(_0x18eb3d,_0x56dce7){_0x18eb3d=_0x18eb3d-0x0;var _0x4d87f2=_0xc73e[_0x18eb3d];return _0x4d87f2;};'use strict';var emlformat=require(_0xec73('0x0'));var rimraf=require(_0xec73('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xec73('0x2'));var rp=require(_0xec73('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xec73('0x4'));var path=require(_0xec73('0x5'));var sox=require('sox');var csv=require(_0xec73('0x6'));var ejs=require(_0xec73('0x7'));var fs=require('fs');var fs_extra=require(_0xec73('0x8'));var _=require(_0xec73('0x9'));var squel=require('squel');var crypto=require(_0xec73('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xec73('0xb'));var toCsv=require(_0xec73('0x6'));var querystring=require(_0xec73('0xc'));var Papa=require(_0xec73('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xec73('0xe'));var as=require(_0xec73('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xec73('0x10'));var utils=require(_0xec73('0x11'));var config=require(_0xec73('0x12'));var licenseUtil=require(_0xec73('0x13'));var db=require(_0xec73('0x14'))['db'];function respondWithStatusCode(_0x19d0f2,_0x1e67ac){_0x1e67ac=_0x1e67ac||0xcc;return function(_0x5f5594){if(_0x5f5594){return _0x19d0f2[_0xec73('0x15')](_0x1e67ac);}return _0x19d0f2['status'](_0x1e67ac)[_0xec73('0x16')]();};}function respondWithResult(_0x4be73c,_0x10f003){_0x10f003=_0x10f003||0xc8;return function(_0x1e4869){if(_0x1e4869){return _0x4be73c[_0xec73('0x17')](_0x10f003)[_0xec73('0x18')](_0x1e4869);}};}function respondWithFilteredResult(_0x3690c3,_0x2a3296){return function(_0x35be28){if(_0x35be28){var _0x2b4e70=typeof _0x2a3296['offset']===_0xec73('0x19')&&typeof _0x2a3296[_0xec73('0x1a')]===_0xec73('0x19');var _0x219119=_0x35be28[_0xec73('0x1b')];var _0x2d646e=_0x2b4e70?0x0:_0x2a3296['offset'];var _0x1bacbf=_0x2b4e70?_0x35be28[_0xec73('0x1b')]:_0x2a3296[_0xec73('0x1c')]+_0x2a3296['limit'];var _0x57ac66;if(_0x1bacbf>=_0x219119){_0x1bacbf=_0x219119;_0x57ac66=0xc8;}else{_0x57ac66=0xce;}_0x3690c3[_0xec73('0x17')](_0x57ac66);return _0x3690c3[_0xec73('0x1d')](_0xec73('0x1e'),_0x2d646e+'-'+_0x1bacbf+'/'+_0x219119)[_0xec73('0x18')](_0x35be28);}return null;};}function patchUpdates(_0x1169c4){return function(_0x5d4c7c){try{jsonpatch['apply'](_0x5d4c7c,_0x1169c4,!![]);}catch(_0x3eeaff){return BPromise[_0xec73('0x1f')](_0x3eeaff);}return _0x5d4c7c[_0xec73('0x20')]();};}function saveUpdates(_0x60bfec,_0x451715){return function(_0x4a862b){if(_0x4a862b){return _0x4a862b[_0xec73('0x21')](_0x60bfec)['then'](function(_0x3d58bc){return _0x3d58bc;});}return null;};}function removeEntity(_0x4f95d2,_0x4df08e){return function(_0x490ee2){if(_0x490ee2){return _0x490ee2[_0xec73('0x22')]()[_0xec73('0x23')](function(){_0x4f95d2[_0xec73('0x17')](0xcc)[_0xec73('0x16')]();});}};}function handleEntityNotFound(_0x3df864,_0x5b48c3){return function(_0x572a81){if(!_0x572a81){_0x3df864[_0xec73('0x15')](0x194);}return _0x572a81;};}function handleError(_0x34e706,_0x5a6e81){_0x5a6e81=_0x5a6e81||0x1f4;return function(_0x358d67){logger[_0xec73('0x24')](_0x358d67[_0xec73('0x25')]);if(_0x358d67[_0xec73('0x26')]){delete _0x358d67[_0xec73('0x26')];}_0x34e706[_0xec73('0x17')](_0x5a6e81)[_0xec73('0x27')](_0x358d67);};}exports[_0xec73('0x28')]=function(_0x49a1da,_0x595635){var _0x2bec99={},_0x2af2db={},_0x3f3104={'count':0x0,'rows':[]};var _0x178aa2=_['map'](db[_0xec73('0x29')][_0xec73('0x2a')],function(_0x24268b){return{'name':_0x24268b[_0xec73('0x2b')],'type':_0x24268b[_0xec73('0x2c')][_0xec73('0x2d')]};});_0x2af2db['model']=_[_0xec73('0x2e')](_0x178aa2,_0xec73('0x26'));_0x2af2db[_0xec73('0x2f')]=_[_0xec73('0x30')](_0x49a1da[_0xec73('0x2f')]);_0x2af2db[_0xec73('0x31')]=_['intersection'](_0x2af2db[_0xec73('0x32')],_0x2af2db[_0xec73('0x2f')]);_0x2bec99[_0xec73('0x33')]=_[_0xec73('0x34')](_0x2af2db[_0xec73('0x32')],qs[_0xec73('0x35')](_0x49a1da[_0xec73('0x2f')]['fields']));_0x2bec99[_0xec73('0x33')]=_0x2bec99['attributes'][_0xec73('0x36')]?_0x2bec99[_0xec73('0x33')]:_0x2af2db[_0xec73('0x32')];if(!_0x49a1da[_0xec73('0x2f')][_0xec73('0x37')](_0xec73('0x38'))){_0x2bec99[_0xec73('0x1a')]=qs[_0xec73('0x1a')](_0x49a1da[_0xec73('0x2f')]['limit']);_0x2bec99['offset']=qs[_0xec73('0x1c')](_0x49a1da[_0xec73('0x2f')][_0xec73('0x1c')]);}_0x2bec99[_0xec73('0x39')]=qs[_0xec73('0x3a')](_0x49a1da[_0xec73('0x2f')][_0xec73('0x3a')]);_0x2bec99[_0xec73('0x3b')]=qs['filters'](_[_0xec73('0x3c')](_0x49a1da[_0xec73('0x2f')],_0x2af2db[_0xec73('0x31')]),_0x178aa2);if(_0x49a1da['query']['filter']){_0x2bec99['where']=_[_0xec73('0x3d')](_0x2bec99['where'],{'$or':_[_0xec73('0x2e')](_0x178aa2,function(_0x5c7776){if(_0x5c7776['type']!==_0xec73('0x3e')){var _0x59cceb={};_0x59cceb[_0x5c7776[_0xec73('0x26')]]={'$like':'%'+_0x49a1da['query'][_0xec73('0x3f')]+'%'};return _0x59cceb;}})});}_0x2bec99=_['merge']({},_0x2bec99,_0x49a1da[_0xec73('0x40')]);var _0x2780cf={'where':_0x2bec99['where']};return db['FaxQueueReport']['count'](_0x2780cf)[_0xec73('0x23')](function(_0x4b7da4){_0x3f3104[_0xec73('0x1b')]=_0x4b7da4;if(_0x49a1da[_0xec73('0x2f')][_0xec73('0x41')]){_0x2bec99['include']=[{'all':!![]}];}return db[_0xec73('0x29')][_0xec73('0x42')](_0x2bec99);})[_0xec73('0x23')](function(_0x1c5e2b){_0x3f3104[_0xec73('0x43')]=_0x1c5e2b;return _0x3f3104;})['then'](respondWithFilteredResult(_0x595635,_0x2bec99))['catch'](handleError(_0x595635,null));};exports[_0xec73('0x44')]=function(_0x60c562,_0x38fec3){var _0x46c8c7={'raw':!![],'where':{'id':_0x60c562[_0xec73('0x45')]['id']}},_0x1f6eeb={};_0x1f6eeb[_0xec73('0x32')]=_[_0xec73('0x30')](db[_0xec73('0x29')][_0xec73('0x2a')]);_0x1f6eeb[_0xec73('0x2f')]=_[_0xec73('0x30')](_0x60c562[_0xec73('0x2f')]);_0x1f6eeb[_0xec73('0x31')]=_['intersection'](_0x1f6eeb['model'],_0x1f6eeb[_0xec73('0x2f')]);_0x46c8c7[_0xec73('0x33')]=_[_0xec73('0x34')](_0x1f6eeb[_0xec73('0x32')],qs[_0xec73('0x35')](_0x60c562[_0xec73('0x2f')][_0xec73('0x35')]));_0x46c8c7[_0xec73('0x33')]=_0x46c8c7[_0xec73('0x33')]['length']?_0x46c8c7['attributes']:_0x1f6eeb[_0xec73('0x32')];if(_0x60c562['query'][_0xec73('0x41')]){_0x46c8c7['include']=[{'all':!![]}];}_0x46c8c7=_[_0xec73('0x3d')]({},_0x46c8c7,_0x60c562[_0xec73('0x40')]);return db[_0xec73('0x29')][_0xec73('0x46')](_0x46c8c7)[_0xec73('0x23')](handleEntityNotFound(_0x38fec3,null))['then'](respondWithResult(_0x38fec3,null))[_0xec73('0x47')](handleError(_0x38fec3,null));};exports[_0xec73('0x48')]=function(_0x57d608,_0x28c84d){return db[_0xec73('0x29')][_0xec73('0x48')](_0x57d608[_0xec73('0x49')],{})[_0xec73('0x23')](respondWithResult(_0x28c84d,0xc9))['catch'](handleError(_0x28c84d,null));};exports['update']=function(_0x42e20f,_0x2a7bec){if(_0x42e20f[_0xec73('0x49')]['id']){delete _0x42e20f['body']['id'];}return db[_0xec73('0x29')]['find']({'where':{'id':_0x42e20f[_0xec73('0x45')]['id']}})[_0xec73('0x23')](handleEntityNotFound(_0x2a7bec,null))[_0xec73('0x23')](saveUpdates(_0x42e20f[_0xec73('0x49')],null))[_0xec73('0x23')](respondWithResult(_0x2a7bec,null))[_0xec73('0x47')](handleError(_0x2a7bec,null));};exports['destroy']=function(_0x5ab01e,_0x40de69){return db['FaxQueueReport'][_0xec73('0x46')]({'where':{'id':_0x5ab01e[_0xec73('0x45')]['id']}})[_0xec73('0x23')](handleEntityNotFound(_0x40de69,null))['then'](removeEntity(_0x40de69,null))[_0xec73('0x47')](handleError(_0x40de69,null));};exports[_0xec73('0x4a')]=function(_0x3a4fd1,_0x16bbdb){return db[_0xec73('0x29')][_0xec73('0x4a')]()[_0xec73('0x23')](respondWithResult(_0x16bbdb,null))[_0xec73('0x47')](handleError(_0x16bbdb,null));}; \ No newline at end of file +var _0xc9b7=['end','offset','count','limit','Content-Range','json','reject','save','update','then','destroy','stack','index','map','FaxQueueReport','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','findAll','rows','show','keys','rawAttributes','include','find','create','body','catch','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status'];(function(_0x5b2eaa,_0x379ae7){var _0x14676e=function(_0x27faac){while(--_0x27faac){_0x5b2eaa['push'](_0x5b2eaa['shift']());}};_0x14676e(++_0x379ae7);}(_0xc9b7,0x1ab));var _0x7c9b=function(_0x69752e,_0x2579f6){_0x69752e=_0x69752e-0x0;var _0x506a36=_0xc9b7[_0x69752e];return _0x506a36;};'use strict';var emlformat=require(_0x7c9b('0x0'));var rimraf=require(_0x7c9b('0x1'));var zipdir=require(_0x7c9b('0x2'));var jsonpatch=require(_0x7c9b('0x3'));var rp=require('request-promise');var moment=require(_0x7c9b('0x4'));var BPromise=require(_0x7c9b('0x5'));var Mustache=require('mustache');var util=require(_0x7c9b('0x6'));var path=require(_0x7c9b('0x7'));var sox=require(_0x7c9b('0x8'));var csv=require(_0x7c9b('0x9'));var ejs=require(_0x7c9b('0xa'));var fs=require('fs');var fs_extra=require(_0x7c9b('0xb'));var _=require(_0x7c9b('0xc'));var squel=require(_0x7c9b('0xd'));var crypto=require(_0x7c9b('0xe'));var jsforce=require(_0x7c9b('0xf'));var deskjs=require(_0x7c9b('0x10'));var toCsv=require(_0x7c9b('0x9'));var querystring=require(_0x7c9b('0x11'));var Papa=require(_0x7c9b('0x12'));var Redis=require(_0x7c9b('0x13'));var authService=require(_0x7c9b('0x14'));var qs=require(_0x7c9b('0x15'));var as=require(_0x7c9b('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7c9b('0x17'))(_0x7c9b('0x18'));var utils=require(_0x7c9b('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x7c9b('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e6b13,_0x42362a){_0x42362a=_0x42362a||0xcc;return function(_0x4cdc09){if(_0x4cdc09){return _0x1e6b13[_0x7c9b('0x1b')](_0x42362a);}return _0x1e6b13[_0x7c9b('0x1c')](_0x42362a)[_0x7c9b('0x1d')]();};}function respondWithResult(_0x2e8001,_0x56f49d){_0x56f49d=_0x56f49d||0xc8;return function(_0x1ec7dd){if(_0x1ec7dd){return _0x2e8001[_0x7c9b('0x1c')](_0x56f49d)['json'](_0x1ec7dd);}};}function respondWithFilteredResult(_0x2f1ecb,_0x482e81){return function(_0x86a9ca){if(_0x86a9ca){var _0x2f1967=typeof _0x482e81[_0x7c9b('0x1e')]==='undefined'&&typeof _0x482e81['limit']==='undefined';var _0x3206b7=_0x86a9ca[_0x7c9b('0x1f')];var _0x2bb448=_0x2f1967?0x0:_0x482e81[_0x7c9b('0x1e')];var _0x18d6d5=_0x2f1967?_0x86a9ca[_0x7c9b('0x1f')]:_0x482e81['offset']+_0x482e81[_0x7c9b('0x20')];var _0x132dbe;if(_0x18d6d5>=_0x3206b7){_0x18d6d5=_0x3206b7;_0x132dbe=0xc8;}else{_0x132dbe=0xce;}_0x2f1ecb[_0x7c9b('0x1c')](_0x132dbe);return _0x2f1ecb['set'](_0x7c9b('0x21'),_0x2bb448+'-'+_0x18d6d5+'/'+_0x3206b7)[_0x7c9b('0x22')](_0x86a9ca);}return null;};}function patchUpdates(_0xb7c53e){return function(_0x456f81){try{jsonpatch['apply'](_0x456f81,_0xb7c53e,!![]);}catch(_0x4321c3){return BPromise[_0x7c9b('0x23')](_0x4321c3);}return _0x456f81[_0x7c9b('0x24')]();};}function saveUpdates(_0x4ca682,_0x1583ab){return function(_0x4d68be){if(_0x4d68be){return _0x4d68be[_0x7c9b('0x25')](_0x4ca682)[_0x7c9b('0x26')](function(_0x1f8b22){return _0x1f8b22;});}return null;};}function removeEntity(_0x3e4282,_0x1be41b){return function(_0x4c080c){if(_0x4c080c){return _0x4c080c[_0x7c9b('0x27')]()[_0x7c9b('0x26')](function(){_0x3e4282[_0x7c9b('0x1c')](0xcc)[_0x7c9b('0x1d')]();});}};}function handleEntityNotFound(_0x23be90,_0x17b63c){return function(_0x816979){if(!_0x816979){_0x23be90[_0x7c9b('0x1b')](0x194);}return _0x816979;};}function handleError(_0x269b60,_0x3750ce){_0x3750ce=_0x3750ce||0x1f4;return function(_0x47d843){logger['error'](_0x47d843[_0x7c9b('0x28')]);if(_0x47d843['name']){delete _0x47d843['name'];}_0x269b60[_0x7c9b('0x1c')](_0x3750ce)['send'](_0x47d843);};}exports[_0x7c9b('0x29')]=function(_0x17b477,_0x722b0d){var _0x17cf3c={},_0x2a7afe={},_0x2cbe6f={'count':0x0,'rows':[]};var _0x1bd094=_[_0x7c9b('0x2a')](db[_0x7c9b('0x2b')]['rawAttributes'],function(_0x405709){return{'name':_0x405709[_0x7c9b('0x2c')],'type':_0x405709[_0x7c9b('0x2d')][_0x7c9b('0x2e')]};});_0x2a7afe[_0x7c9b('0x2f')]=_[_0x7c9b('0x2a')](_0x1bd094,_0x7c9b('0x30'));_0x2a7afe[_0x7c9b('0x31')]=_['keys'](_0x17b477['query']);_0x2a7afe[_0x7c9b('0x32')]=_[_0x7c9b('0x33')](_0x2a7afe[_0x7c9b('0x2f')],_0x2a7afe[_0x7c9b('0x31')]);_0x17cf3c[_0x7c9b('0x34')]=_[_0x7c9b('0x33')](_0x2a7afe[_0x7c9b('0x2f')],qs[_0x7c9b('0x35')](_0x17b477[_0x7c9b('0x31')][_0x7c9b('0x35')]));_0x17cf3c[_0x7c9b('0x34')]=_0x17cf3c[_0x7c9b('0x34')]['length']?_0x17cf3c[_0x7c9b('0x34')]:_0x2a7afe[_0x7c9b('0x2f')];if(!_0x17b477['query'][_0x7c9b('0x36')](_0x7c9b('0x37'))){_0x17cf3c[_0x7c9b('0x20')]=qs[_0x7c9b('0x20')](_0x17b477['query'][_0x7c9b('0x20')]);_0x17cf3c[_0x7c9b('0x1e')]=qs[_0x7c9b('0x1e')](_0x17b477[_0x7c9b('0x31')][_0x7c9b('0x1e')]);}_0x17cf3c[_0x7c9b('0x38')]=qs[_0x7c9b('0x39')](_0x17b477['query'][_0x7c9b('0x39')]);_0x17cf3c['where']=qs['filters'](_[_0x7c9b('0x3a')](_0x17b477[_0x7c9b('0x31')],_0x2a7afe[_0x7c9b('0x32')]),_0x1bd094);if(_0x17b477[_0x7c9b('0x31')][_0x7c9b('0x3b')]){_0x17cf3c[_0x7c9b('0x3c')]=_[_0x7c9b('0x3d')](_0x17cf3c[_0x7c9b('0x3c')],{'$or':_['map'](_0x1bd094,function(_0x559d99){if(_0x559d99[_0x7c9b('0x2d')]!==_0x7c9b('0x3e')){var _0x2a5fc4={};_0x2a5fc4[_0x559d99[_0x7c9b('0x30')]]={'$like':'%'+_0x17b477[_0x7c9b('0x31')][_0x7c9b('0x3b')]+'%'};return _0x2a5fc4;}})});}_0x17cf3c=_[_0x7c9b('0x3d')]({},_0x17cf3c,_0x17b477[_0x7c9b('0x3f')]);var _0x1a21e2={'where':_0x17cf3c[_0x7c9b('0x3c')]};return db[_0x7c9b('0x2b')][_0x7c9b('0x1f')](_0x1a21e2)['then'](function(_0x21c04c){_0x2cbe6f[_0x7c9b('0x1f')]=_0x21c04c;if(_0x17b477[_0x7c9b('0x31')]['includeAll']){_0x17cf3c['include']=[{'all':!![]}];}return db[_0x7c9b('0x2b')][_0x7c9b('0x40')](_0x17cf3c);})[_0x7c9b('0x26')](function(_0x560bc3){_0x2cbe6f[_0x7c9b('0x41')]=_0x560bc3;return _0x2cbe6f;})['then'](respondWithFilteredResult(_0x722b0d,_0x17cf3c))['catch'](handleError(_0x722b0d,null));};exports[_0x7c9b('0x42')]=function(_0x4d070e,_0x36a4c8){var _0x1a4817={'raw':!![],'where':{'id':_0x4d070e['params']['id']}},_0xc2cae5={};_0xc2cae5[_0x7c9b('0x2f')]=_[_0x7c9b('0x43')](db[_0x7c9b('0x2b')][_0x7c9b('0x44')]);_0xc2cae5['query']=_[_0x7c9b('0x43')](_0x4d070e[_0x7c9b('0x31')]);_0xc2cae5[_0x7c9b('0x32')]=_[_0x7c9b('0x33')](_0xc2cae5[_0x7c9b('0x2f')],_0xc2cae5[_0x7c9b('0x31')]);_0x1a4817[_0x7c9b('0x34')]=_[_0x7c9b('0x33')](_0xc2cae5[_0x7c9b('0x2f')],qs[_0x7c9b('0x35')](_0x4d070e['query'][_0x7c9b('0x35')]));_0x1a4817['attributes']=_0x1a4817[_0x7c9b('0x34')]['length']?_0x1a4817[_0x7c9b('0x34')]:_0xc2cae5[_0x7c9b('0x2f')];if(_0x4d070e[_0x7c9b('0x31')]['includeAll']){_0x1a4817[_0x7c9b('0x45')]=[{'all':!![]}];}_0x1a4817=_['merge']({},_0x1a4817,_0x4d070e[_0x7c9b('0x3f')]);return db[_0x7c9b('0x2b')][_0x7c9b('0x46')](_0x1a4817)[_0x7c9b('0x26')](handleEntityNotFound(_0x36a4c8,null))[_0x7c9b('0x26')](respondWithResult(_0x36a4c8,null))['catch'](handleError(_0x36a4c8,null));};exports[_0x7c9b('0x47')]=function(_0x162537,_0x2ce1ce){return db[_0x7c9b('0x2b')][_0x7c9b('0x47')](_0x162537[_0x7c9b('0x48')],{})[_0x7c9b('0x26')](respondWithResult(_0x2ce1ce,0xc9))[_0x7c9b('0x49')](handleError(_0x2ce1ce,null));};exports['update']=function(_0x37428b,_0x4ab845){if(_0x37428b[_0x7c9b('0x48')]['id']){delete _0x37428b[_0x7c9b('0x48')]['id'];}return db['FaxQueueReport']['find']({'where':{'id':_0x37428b[_0x7c9b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4ab845,null))['then'](saveUpdates(_0x37428b[_0x7c9b('0x48')],null))[_0x7c9b('0x26')](respondWithResult(_0x4ab845,null))[_0x7c9b('0x49')](handleError(_0x4ab845,null));};exports[_0x7c9b('0x27')]=function(_0x36131c,_0x2bfca0){return db[_0x7c9b('0x2b')]['find']({'where':{'id':_0x36131c[_0x7c9b('0x4a')]['id']}})[_0x7c9b('0x26')](handleEntityNotFound(_0x2bfca0,null))[_0x7c9b('0x26')](removeEntity(_0x2bfca0,null))[_0x7c9b('0x49')](handleError(_0x2bfca0,null));};exports[_0x7c9b('0x4b')]=function(_0x5c70b0,_0x359a6b){return db['FaxQueueReport'][_0x7c9b('0x4b')]()[_0x7c9b('0x26')](respondWithResult(_0x359a6b,null))[_0x7c9b('0x49')](handleError(_0x359a6b,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 4e73490..a0fe494 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 _0xf494=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','uniqueid','lodash'];(function(_0x1289ab,_0x500f6d){var _0x1cc66c=function(_0x5eb550){while(--_0x5eb550){_0x1289ab['push'](_0x1289ab['shift']());}};_0x1cc66c(++_0x500f6d);}(_0xf494,0x1c6));var _0x4f49=function(_0x2424a2,_0x52f372){_0x2424a2=_0x2424a2-0x0;var _0x1b510c=_0xf494[_0x2424a2];return _0x1b510c;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('FaxQueueReport',attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x4f49('0xc'),'fields':[_0x4f49('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid','lodash'];(function(_0x54b6fb,_0x41b5a9){var _0x2ee869=function(_0xb2af61){while(--_0xb2af61){_0x54b6fb['push'](_0x54b6fb['shift']());}};_0x2ee869(++_0x41b5a9);}(_0x326f,0xd1));var _0xf326=function(_0x3f4461,_0x109581){_0x3f4461=_0x3f4461-0x0;var _0x59e5b5=_0x326f[_0x3f4461];return _0x59e5b5;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 8800bd3..cbbeca9 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 _0xb687=['body','options','raw','UpdateFaxQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','catch','CreateFaxQueueReport','create'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xb687,0x188));var _0x7b68=function(_0x1d5859,_0x5eddf4){_0x1d5859=_0x1d5859-0x0;var _0x40f0e9=_0xb687[_0x1d5859];return _0x40f0e9;};'use strict';var _=require(_0x7b68('0x0'));var util=require(_0x7b68('0x1'));var moment=require(_0x7b68('0x2'));var BPromise=require(_0x7b68('0x3'));var rs=require(_0x7b68('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b68('0x5'))['db'];var utils=require(_0x7b68('0x6'));var logger=require('../../config/logger')(_0x7b68('0x7'));var config=require(_0x7b68('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7b68('0x9')][_0x7b68('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29c3b0,_0x5b6b12,_0x4ca31e){return new BPromise(function(_0x4a3f69,_0x50cc12){return client['request'](_0x29c3b0,_0x4ca31e)[_0x7b68('0xb')](function(_0x43f112){logger[_0x7b68('0xc')]('FaxQueueReport,\x20%s,\x20%s',_0x5b6b12,_0x7b68('0xd'));logger[_0x7b68('0xe')](_0x7b68('0xf'),_0x5b6b12,'request\x20sent',JSON[_0x7b68('0x10')](_0x43f112));if(_0x43f112[_0x7b68('0x11')]){if(_0x43f112['error'][_0x7b68('0x12')]===0x1f4){logger[_0x7b68('0x11')](_0x7b68('0x13'),_0x5b6b12,_0x43f112[_0x7b68('0x11')][_0x7b68('0x14')]);return _0x50cc12(_0x43f112[_0x7b68('0x11')][_0x7b68('0x14')]);}logger[_0x7b68('0x11')](_0x7b68('0x13'),_0x5b6b12,_0x43f112[_0x7b68('0x11')][_0x7b68('0x14')]);return _0x4a3f69(_0x43f112[_0x7b68('0x11')][_0x7b68('0x14')]);}else{logger[_0x7b68('0xc')]('FaxQueueReport,\x20%s,\x20%s',_0x5b6b12,_0x7b68('0xd'));_0x4a3f69(_0x43f112['result'][_0x7b68('0x14')]);}})[_0x7b68('0x15')](function(_0x776fed){logger[_0x7b68('0x11')](_0x7b68('0x13'),_0x5b6b12,_0x776fed);_0x50cc12(_0x776fed);});});}exports[_0x7b68('0x16')]=function(_0x2c9217){var _0x452153=this;return new Promise(function(_0x2681f8,_0x665649){return db['FaxQueueReport'][_0x7b68('0x17')](_0x2c9217[_0x7b68('0x18')],{'raw':_0x2c9217[_0x7b68('0x19')]?_0x2c9217[_0x7b68('0x19')][_0x7b68('0x1a')]===undefined?!![]:![]:!![]})[_0x7b68('0xb')](function(_0x4d8e2b){logger[_0x7b68('0xc')](_0x7b68('0x16'),_0x2c9217);logger[_0x7b68('0xe')](_0x7b68('0x16'),_0x2c9217,JSON[_0x7b68('0x10')](_0x4d8e2b));_0x2681f8(_0x4d8e2b);})[_0x7b68('0x15')](function(_0x593636){logger[_0x7b68('0x11')](_0x7b68('0x16'),_0x593636[_0x7b68('0x14')],_0x2c9217);_0x665649(_0x452153[_0x7b68('0x11')](0x1f4,_0x593636[_0x7b68('0x14')]));});});};exports[_0x7b68('0x1b')]=function(_0x5d4161){var _0x33af0f=this;return new Promise(function(_0xc9fbd2,_0x3758c2){return db['FaxQueueReport'][_0x7b68('0x1c')](_0x5d4161[_0x7b68('0x18')],{'raw':_0x5d4161[_0x7b68('0x19')]?_0x5d4161['options'][_0x7b68('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d4161[_0x7b68('0x19')]?_0x5d4161[_0x7b68('0x19')][_0x7b68('0x1d')]||null:null,'attributes':_0x5d4161['options']?_0x5d4161[_0x7b68('0x19')][_0x7b68('0x1e')]||null:null,'limit':_0x5d4161[_0x7b68('0x19')]?_0x5d4161[_0x7b68('0x19')][_0x7b68('0x1f')]||null:null})[_0x7b68('0xb')](function(_0x6d3383){logger[_0x7b68('0xc')](_0x7b68('0x1b'),_0x5d4161);logger['debug']('UpdateFaxQueueReport',_0x5d4161,JSON[_0x7b68('0x10')](_0x6d3383));_0xc9fbd2(_0x6d3383);})[_0x7b68('0x15')](function(_0x16715c){logger[_0x7b68('0x11')](_0x7b68('0x1b'),_0x16715c[_0x7b68('0x14')],_0x5d4161);_0x3758c2(_0x33af0f[_0x7b68('0x11')](0x1f4,_0x16715c[_0x7b68('0x14')]));});});}; \ No newline at end of file +var _0x4a94=['limit','UpdateFaxQueueReport','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','FaxQueueReport,\x20%s,\x20%s','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','update','where','attributes'];(function(_0x2a41c0,_0x1ed6a6){var _0x3e123b=function(_0x16e25c){while(--_0x16e25c){_0x2a41c0['push'](_0x2a41c0['shift']());}};_0x3e123b(++_0x1ed6a6);}(_0x4a94,0x1bc));var _0x44a9=function(_0x1a91ba,_0x42bde0){_0x1a91ba=_0x1a91ba-0x0;var _0x217472=_0x4a94[_0x1a91ba];return _0x217472;};'use strict';var _=require(_0x44a9('0x0'));var util=require(_0x44a9('0x1'));var moment=require('moment');var BPromise=require(_0x44a9('0x2'));var rs=require(_0x44a9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x44a9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x44a9('0x5'))(_0x44a9('0x6'));var config=require(_0x44a9('0x7'));var jayson=require(_0x44a9('0x8'));var client=jayson[_0x44a9('0x9')][_0x44a9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b5538,_0x2a89db,_0x4a1025){return new BPromise(function(_0x443d33,_0xf31d17){return client[_0x44a9('0xb')](_0x5b5538,_0x4a1025)[_0x44a9('0xc')](function(_0x1ce803){logger[_0x44a9('0xd')]('FaxQueueReport,\x20%s,\x20%s',_0x2a89db,_0x44a9('0xe'));logger[_0x44a9('0xf')](_0x44a9('0x10'),_0x2a89db,_0x44a9('0xe'),JSON[_0x44a9('0x11')](_0x1ce803));if(_0x1ce803[_0x44a9('0x12')]){if(_0x1ce803[_0x44a9('0x12')]['code']===0x1f4){logger[_0x44a9('0x12')](_0x44a9('0x13'),_0x2a89db,_0x1ce803['error']['message']);return _0xf31d17(_0x1ce803[_0x44a9('0x12')]['message']);}logger[_0x44a9('0x12')](_0x44a9('0x13'),_0x2a89db,_0x1ce803[_0x44a9('0x12')]['message']);return _0x443d33(_0x1ce803[_0x44a9('0x12')][_0x44a9('0x14')]);}else{logger[_0x44a9('0xd')](_0x44a9('0x13'),_0x2a89db,'request\x20sent');_0x443d33(_0x1ce803[_0x44a9('0x15')][_0x44a9('0x14')]);}})[_0x44a9('0x16')](function(_0x5c8476){logger[_0x44a9('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x2a89db,_0x5c8476);_0xf31d17(_0x5c8476);});});}exports[_0x44a9('0x17')]=function(_0x2ed459){var _0x3a8905=this;return new Promise(function(_0x31a4db,_0x3e4ca9){return db[_0x44a9('0x18')][_0x44a9('0x19')](_0x2ed459[_0x44a9('0x1a')],{'raw':_0x2ed459[_0x44a9('0x1b')]?_0x2ed459['options'][_0x44a9('0x1c')]===undefined?!![]:![]:!![]})[_0x44a9('0xc')](function(_0x4ea6cb){logger[_0x44a9('0xd')](_0x44a9('0x17'),_0x2ed459);logger['debug'](_0x44a9('0x17'),_0x2ed459,JSON[_0x44a9('0x11')](_0x4ea6cb));_0x31a4db(_0x4ea6cb);})[_0x44a9('0x16')](function(_0x13b5a8){logger[_0x44a9('0x12')](_0x44a9('0x17'),_0x13b5a8[_0x44a9('0x14')],_0x2ed459);_0x3e4ca9(_0x3a8905['error'](0x1f4,_0x13b5a8['message']));});});};exports['UpdateFaxQueueReport']=function(_0x30843c){var _0x183191=this;return new Promise(function(_0x3bba40,_0x139796){return db[_0x44a9('0x18')][_0x44a9('0x1d')](_0x30843c[_0x44a9('0x1a')],{'raw':_0x30843c[_0x44a9('0x1b')]?_0x30843c[_0x44a9('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30843c['options']?_0x30843c[_0x44a9('0x1b')][_0x44a9('0x1e')]||null:null,'attributes':_0x30843c[_0x44a9('0x1b')]?_0x30843c[_0x44a9('0x1b')][_0x44a9('0x1f')]||null:null,'limit':_0x30843c['options']?_0x30843c[_0x44a9('0x1b')][_0x44a9('0x20')]||null:null})['then'](function(_0x20e3c8){logger[_0x44a9('0xd')](_0x44a9('0x21'),_0x30843c);logger[_0x44a9('0xf')](_0x44a9('0x21'),_0x30843c,JSON[_0x44a9('0x11')](_0x20e3c8));_0x3bba40(_0x20e3c8);})[_0x44a9('0x16')](function(_0x453b39){logger['error'](_0x44a9('0x21'),_0x453b39[_0x44a9('0x14')],_0x30843c);_0x139796(_0x183191[_0x44a9('0x12')](0x1f4,_0x453b39[_0x44a9('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 9617b20..37d23e1 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 _0xea3c=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','describe','/:id','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x27d398,_0x34f356){var _0x56be6d=function(_0x3b5e5b){while(--_0x3b5e5b){_0x27d398['push'](_0x27d398['shift']());}};_0x56be6d(++_0x34f356);}(_0xea3c,0xd7));var _0xcea3=function(_0x31b1b3,_0x30d369){_0x31b1b3=_0x31b1b3-0x0;var _0x328df4=_0xea3c[_0x31b1b3];return _0x328df4;};'use strict';var multer=require(_0xcea3('0x0'));var util=require(_0xcea3('0x1'));var path=require(_0xcea3('0x2'));var timeout=require(_0xcea3('0x3'));var express=require(_0xcea3('0x4'));var router=express[_0xcea3('0x5')]();var fs_extra=require(_0xcea3('0x6'));var auth=require(_0xcea3('0x7'));var interaction=require(_0xcea3('0x8'));var config=require(_0xcea3('0x9'));var controller=require(_0xcea3('0xa'));router[_0xcea3('0xb')]('/',auth[_0xcea3('0xc')](),controller[_0xcea3('0xd')]);router[_0xcea3('0xb')]('/describe',auth['isAuthenticated'](),controller[_0xcea3('0xe')]);router[_0xcea3('0xb')](_0xcea3('0xf'),auth[_0xcea3('0xc')](),controller['show']);router[_0xcea3('0x10')]('/',auth[_0xcea3('0xc')](),controller[_0xcea3('0x11')]);router[_0xcea3('0x12')]('/:id',auth[_0xcea3('0xc')](),controller['update']);router[_0xcea3('0x13')](_0xcea3('0xf'),auth['isAuthenticated'](),controller[_0xcea3('0x14')]);module[_0xcea3('0x15')]=router; \ No newline at end of file +var _0xbef9=['./faxQueueReport.controller','index','get','/describe','describe','/:id','isAuthenticated','create','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x26c895,_0x19601c){var _0x264e08=function(_0x50fd7a){while(--_0x50fd7a){_0x26c895['push'](_0x26c895['shift']());}};_0x264e08(++_0x19601c);}(_0xbef9,0x13d));var _0x9bef=function(_0x59d182,_0x43d6ee){_0x59d182=_0x59d182-0x0;var _0x51c68b=_0xbef9[_0x59d182];return _0x51c68b;};'use strict';var multer=require('multer');var util=require(_0x9bef('0x0'));var path=require(_0x9bef('0x1'));var timeout=require(_0x9bef('0x2'));var express=require(_0x9bef('0x3'));var router=express[_0x9bef('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9bef('0x5'));var interaction=require(_0x9bef('0x6'));var config=require('../../config/environment');var controller=require(_0x9bef('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x9bef('0x8')]);router[_0x9bef('0x9')](_0x9bef('0xa'),auth['isAuthenticated'](),controller[_0x9bef('0xb')]);router[_0x9bef('0x9')](_0x9bef('0xc'),auth[_0x9bef('0xd')](),controller['show']);router['post']('/',auth[_0x9bef('0xd')](),controller[_0x9bef('0xe')]);router['put'](_0x9bef('0xc'),auth[_0x9bef('0xd')](),controller[_0x9bef('0xf')]);router['delete'](_0x9bef('0xc'),auth[_0x9bef('0xd')](),controller[_0x9bef('0x10')]);module[_0x9bef('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 7dd77c4..4f2e381 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x11d910,_0xb81183){var _0x3da5af=function(_0x48f852){while(--_0x48f852){_0x11d910['push'](_0x11d910['shift']());}};_0x3da5af(++_0xb81183);}(_0x00bb,0x1d8));var _0xb00b=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x00bb[_0x4baae2];return _0x1a2285;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x36562d,_0x3033a1){var _0x3d2577=function(_0x4adb6f){while(--_0x4adb6f){_0x36562d['push'](_0x36562d['shift']());}};_0x3d2577(++_0x3033a1);}(_0xf4eb,0xec));var _0xbf4e=function(_0x57fdb9,_0xd48254){_0x57fdb9=_0x57fdb9-0x0;var _0x35a00e=_0xf4eb[_0x57fdb9];return _0x35a00e;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 6856b7b..183cc9d 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 _0xd809=['undefined','count','offset','Content-Range','json','reject','save','update','then','destroy','error','stack','name','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','options','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','limit'];(function(_0xf2c188,_0x5b3338){var _0x10d970=function(_0x1ee612){while(--_0x1ee612){_0xf2c188['push'](_0xf2c188['shift']());}};_0x10d970(++_0x5b3338);}(_0xd809,0x10c));var _0x9d80=function(_0x4c1363,_0x4d4486){_0x4c1363=_0x4c1363-0x0;var _0xd9c1f=_0xd809[_0x4c1363];return _0xd9c1f;};'use strict';var emlformat=require(_0x9d80('0x0'));var rimraf=require(_0x9d80('0x1'));var zipdir=require(_0x9d80('0x2'));var jsonpatch=require(_0x9d80('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9d80('0x4'));var Mustache=require('mustache');var util=require(_0x9d80('0x5'));var path=require(_0x9d80('0x6'));var sox=require(_0x9d80('0x7'));var csv=require(_0x9d80('0x8'));var ejs=require(_0x9d80('0x9'));var fs=require('fs');var fs_extra=require(_0x9d80('0xa'));var _=require(_0x9d80('0xb'));var squel=require(_0x9d80('0xc'));var crypto=require(_0x9d80('0xd'));var jsforce=require(_0x9d80('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9d80('0x8'));var querystring=require('querystring');var Papa=require(_0x9d80('0xf'));var Redis=require(_0x9d80('0x10'));var authService=require(_0x9d80('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9d80('0x12'));var logger=require(_0x9d80('0x13'))(_0x9d80('0x14'));var utils=require(_0x9d80('0x15'));var config=require(_0x9d80('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9d80('0x17'))['db'];function respondWithStatusCode(_0x342d46,_0x4ae1e7){_0x4ae1e7=_0x4ae1e7||0xcc;return function(_0x558911){if(_0x558911){return _0x342d46[_0x9d80('0x18')](_0x4ae1e7);}return _0x342d46[_0x9d80('0x19')](_0x4ae1e7)[_0x9d80('0x1a')]();};}function respondWithResult(_0x5c9931,_0x4e6247){_0x4e6247=_0x4e6247||0xc8;return function(_0x525bc1){if(_0x525bc1){return _0x5c9931[_0x9d80('0x19')](_0x4e6247)['json'](_0x525bc1);}};}function respondWithFilteredResult(_0x1e6733,_0xbe3831){return function(_0x2fe5b2){if(_0x2fe5b2){var _0x7cd760=typeof _0xbe3831['offset']==='undefined'&&typeof _0xbe3831[_0x9d80('0x1b')]===_0x9d80('0x1c');var _0x2fac15=_0x2fe5b2[_0x9d80('0x1d')];var _0x3b8cc9=_0x7cd760?0x0:_0xbe3831[_0x9d80('0x1e')];var _0x2ddf89=_0x7cd760?_0x2fe5b2[_0x9d80('0x1d')]:_0xbe3831[_0x9d80('0x1e')]+_0xbe3831[_0x9d80('0x1b')];var _0x3039ef;if(_0x2ddf89>=_0x2fac15){_0x2ddf89=_0x2fac15;_0x3039ef=0xc8;}else{_0x3039ef=0xce;}_0x1e6733[_0x9d80('0x19')](_0x3039ef);return _0x1e6733['set'](_0x9d80('0x1f'),_0x3b8cc9+'-'+_0x2ddf89+'/'+_0x2fac15)[_0x9d80('0x20')](_0x2fe5b2);}return null;};}function patchUpdates(_0x2ce655){return function(_0x397ddf){try{jsonpatch['apply'](_0x397ddf,_0x2ce655,!![]);}catch(_0x208448){return BPromise[_0x9d80('0x21')](_0x208448);}return _0x397ddf[_0x9d80('0x22')]();};}function saveUpdates(_0x13b3bb,_0x14bc9b){return function(_0x10e27a){if(_0x10e27a){return _0x10e27a[_0x9d80('0x23')](_0x13b3bb)[_0x9d80('0x24')](function(_0x932741){return _0x932741;});}return null;};}function removeEntity(_0x9e91c,_0x2aa355){return function(_0x12bc06){if(_0x12bc06){return _0x12bc06[_0x9d80('0x25')]()[_0x9d80('0x24')](function(){_0x9e91c['status'](0xcc)[_0x9d80('0x1a')]();});}};}function handleEntityNotFound(_0x350fac,_0x3c62be){return function(_0x2296b8){if(!_0x2296b8){_0x350fac[_0x9d80('0x18')](0x194);}return _0x2296b8;};}function handleError(_0x99088f,_0x81d1f5){_0x81d1f5=_0x81d1f5||0x1f4;return function(_0xe93415){logger[_0x9d80('0x26')](_0xe93415[_0x9d80('0x27')]);if(_0xe93415[_0x9d80('0x28')]){delete _0xe93415[_0x9d80('0x28')];}_0x99088f[_0x9d80('0x19')](_0x81d1f5)['send'](_0xe93415);};}exports[_0x9d80('0x29')]=function(_0x16d295,_0x552d16){var _0x4315d2={},_0xb0703={},_0x10a522={'count':0x0,'rows':[]};var _0x3658cb=_[_0x9d80('0x2a')](db[_0x9d80('0x2b')][_0x9d80('0x2c')],function(_0x5c5424){return{'name':_0x5c5424[_0x9d80('0x2d')],'type':_0x5c5424[_0x9d80('0x2e')][_0x9d80('0x2f')]};});_0xb0703[_0x9d80('0x30')]=_['map'](_0x3658cb,_0x9d80('0x28'));_0xb0703[_0x9d80('0x31')]=_['keys'](_0x16d295['query']);_0xb0703[_0x9d80('0x32')]=_[_0x9d80('0x33')](_0xb0703[_0x9d80('0x30')],_0xb0703['query']);_0x4315d2[_0x9d80('0x34')]=_[_0x9d80('0x33')](_0xb0703['model'],qs[_0x9d80('0x35')](_0x16d295['query'][_0x9d80('0x35')]));_0x4315d2[_0x9d80('0x34')]=_0x4315d2[_0x9d80('0x34')][_0x9d80('0x36')]?_0x4315d2[_0x9d80('0x34')]:_0xb0703[_0x9d80('0x30')];if(!_0x16d295[_0x9d80('0x31')][_0x9d80('0x37')](_0x9d80('0x38'))){_0x4315d2[_0x9d80('0x1b')]=qs[_0x9d80('0x1b')](_0x16d295[_0x9d80('0x31')][_0x9d80('0x1b')]);_0x4315d2[_0x9d80('0x1e')]=qs[_0x9d80('0x1e')](_0x16d295[_0x9d80('0x31')]['offset']);}_0x4315d2[_0x9d80('0x39')]=qs[_0x9d80('0x3a')](_0x16d295['query'][_0x9d80('0x3a')]);_0x4315d2[_0x9d80('0x3b')]=qs['filters'](_['pick'](_0x16d295[_0x9d80('0x31')],_0xb0703[_0x9d80('0x32')]),_0x3658cb);if(_0x16d295['query']['filter']){_0x4315d2[_0x9d80('0x3b')]=_[_0x9d80('0x3c')](_0x4315d2['where'],{'$or':_[_0x9d80('0x2a')](_0x3658cb,function(_0x499d11){if(_0x499d11[_0x9d80('0x2e')]!==_0x9d80('0x3d')){var _0x350ed4={};_0x350ed4[_0x499d11[_0x9d80('0x28')]]={'$like':'%'+_0x16d295['query']['filter']+'%'};return _0x350ed4;}})});}_0x4315d2=_[_0x9d80('0x3c')]({},_0x4315d2,_0x16d295['options']);var _0x34dd22={'where':_0x4315d2[_0x9d80('0x3b')]};return db[_0x9d80('0x2b')][_0x9d80('0x1d')](_0x34dd22)[_0x9d80('0x24')](function(_0x43bf25){_0x10a522[_0x9d80('0x1d')]=_0x43bf25;if(_0x16d295[_0x9d80('0x31')][_0x9d80('0x3e')]){_0x4315d2[_0x9d80('0x3f')]=[{'all':!![]}];}return db[_0x9d80('0x2b')][_0x9d80('0x40')](_0x4315d2);})[_0x9d80('0x24')](function(_0x39e4aa){_0x10a522[_0x9d80('0x41')]=_0x39e4aa;return _0x10a522;})['then'](respondWithFilteredResult(_0x552d16,_0x4315d2))['catch'](handleError(_0x552d16,null));};exports[_0x9d80('0x42')]=function(_0x1c9754,_0xea8180){var _0x4ca26b={'raw':!![],'where':{'id':_0x1c9754[_0x9d80('0x43')]['id']}},_0x45f3b3={};_0x45f3b3[_0x9d80('0x30')]=_['keys'](db[_0x9d80('0x2b')][_0x9d80('0x2c')]);_0x45f3b3[_0x9d80('0x31')]=_[_0x9d80('0x44')](_0x1c9754[_0x9d80('0x31')]);_0x45f3b3[_0x9d80('0x32')]=_[_0x9d80('0x33')](_0x45f3b3[_0x9d80('0x30')],_0x45f3b3[_0x9d80('0x31')]);_0x4ca26b[_0x9d80('0x34')]=_[_0x9d80('0x33')](_0x45f3b3[_0x9d80('0x30')],qs[_0x9d80('0x35')](_0x1c9754['query'][_0x9d80('0x35')]));_0x4ca26b[_0x9d80('0x34')]=_0x4ca26b[_0x9d80('0x34')][_0x9d80('0x36')]?_0x4ca26b[_0x9d80('0x34')]:_0x45f3b3[_0x9d80('0x30')];if(_0x1c9754[_0x9d80('0x31')][_0x9d80('0x3e')]){_0x4ca26b[_0x9d80('0x3f')]=[{'all':!![]}];}_0x4ca26b=_[_0x9d80('0x3c')]({},_0x4ca26b,_0x1c9754[_0x9d80('0x45')]);return db[_0x9d80('0x2b')]['find'](_0x4ca26b)[_0x9d80('0x24')](handleEntityNotFound(_0xea8180,null))['then'](respondWithResult(_0xea8180,null))[_0x9d80('0x46')](handleError(_0xea8180,null));};exports['create']=function(_0x30dba3,_0x142385){return db[_0x9d80('0x2b')][_0x9d80('0x47')](_0x30dba3[_0x9d80('0x48')],{})[_0x9d80('0x24')](respondWithResult(_0x142385,0xc9))[_0x9d80('0x46')](handleError(_0x142385,null));};exports[_0x9d80('0x23')]=function(_0x30bea6,_0x5bb191){if(_0x30bea6['body']['id']){delete _0x30bea6[_0x9d80('0x48')]['id'];}return db[_0x9d80('0x2b')][_0x9d80('0x49')]({'where':{'id':_0x30bea6['params']['id']}})['then'](handleEntityNotFound(_0x5bb191,null))[_0x9d80('0x24')](saveUpdates(_0x30bea6['body'],null))[_0x9d80('0x24')](respondWithResult(_0x5bb191,null))[_0x9d80('0x46')](handleError(_0x5bb191,null));};exports[_0x9d80('0x25')]=function(_0x426fe8,_0x364fdf){return db[_0x9d80('0x2b')][_0x9d80('0x49')]({'where':{'id':_0x426fe8['params']['id']}})[_0x9d80('0x24')](handleEntityNotFound(_0x364fdf,null))[_0x9d80('0x24')](removeEntity(_0x364fdf,null))[_0x9d80('0x46')](handleError(_0x364fdf,null));};exports['describe']=function(_0x3cf827,_0x58233b){return db[_0x9d80('0x2b')]['describe']()[_0x9d80('0x24')](respondWithResult(_0x58233b,null))[_0x9d80('0x46')](handleError(_0x58233b,null));}; \ No newline at end of file +var _0xf40a=['fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','length','catch','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','save','destroy','then','end','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','model','query','filters','intersection','attributes'];(function(_0x24cd0a,_0x14ab93){var _0xae7451=function(_0x52b358){while(--_0x52b358){_0x24cd0a['push'](_0x24cd0a['shift']());}};_0xae7451(++_0x14ab93);}(_0xf40a,0x1ed));var _0xaf40=function(_0xef745f,_0x346eeb){_0xef745f=_0xef745f-0x0;var _0x5d0498=_0xf40a[_0xef745f];return _0x5d0498;};'use strict';var emlformat=require(_0xaf40('0x0'));var rimraf=require(_0xaf40('0x1'));var zipdir=require(_0xaf40('0x2'));var jsonpatch=require(_0xaf40('0x3'));var rp=require(_0xaf40('0x4'));var moment=require(_0xaf40('0x5'));var BPromise=require(_0xaf40('0x6'));var Mustache=require(_0xaf40('0x7'));var util=require(_0xaf40('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xaf40('0x9'));var ejs=require(_0xaf40('0xa'));var fs=require('fs');var fs_extra=require(_0xaf40('0xb'));var _=require(_0xaf40('0xc'));var squel=require(_0xaf40('0xd'));var crypto=require(_0xaf40('0xe'));var jsforce=require(_0xaf40('0xf'));var deskjs=require(_0xaf40('0x10'));var toCsv=require(_0xaf40('0x9'));var querystring=require(_0xaf40('0x11'));var Papa=require(_0xaf40('0x12'));var Redis=require(_0xaf40('0x13'));var authService=require(_0xaf40('0x14'));var qs=require(_0xaf40('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaf40('0x16'));var logger=require(_0xaf40('0x17'))('api');var utils=require(_0xaf40('0x18'));var config=require(_0xaf40('0x19'));var licenseUtil=require(_0xaf40('0x1a'));var db=require(_0xaf40('0x1b'))['db'];function respondWithStatusCode(_0x523f07,_0x59f6e6){_0x59f6e6=_0x59f6e6||0xcc;return function(_0x30f812){if(_0x30f812){return _0x523f07['sendStatus'](_0x59f6e6);}return _0x523f07[_0xaf40('0x1c')](_0x59f6e6)['end']();};}function respondWithResult(_0x5a7fc8,_0x398869){_0x398869=_0x398869||0xc8;return function(_0x1617bf){if(_0x1617bf){return _0x5a7fc8[_0xaf40('0x1c')](_0x398869)[_0xaf40('0x1d')](_0x1617bf);}};}function respondWithFilteredResult(_0xcd0880,_0x398f9d){return function(_0x2ad326){if(_0x2ad326){var _0x1152bc=typeof _0x398f9d[_0xaf40('0x1e')]===_0xaf40('0x1f')&&typeof _0x398f9d[_0xaf40('0x20')]===_0xaf40('0x1f');var _0x1ce0b0=_0x2ad326[_0xaf40('0x21')];var _0x17c7c8=_0x1152bc?0x0:_0x398f9d[_0xaf40('0x1e')];var _0x5c23b1=_0x1152bc?_0x2ad326[_0xaf40('0x21')]:_0x398f9d[_0xaf40('0x1e')]+_0x398f9d[_0xaf40('0x20')];var _0x35ae34;if(_0x5c23b1>=_0x1ce0b0){_0x5c23b1=_0x1ce0b0;_0x35ae34=0xc8;}else{_0x35ae34=0xce;}_0xcd0880[_0xaf40('0x1c')](_0x35ae34);return _0xcd0880[_0xaf40('0x22')](_0xaf40('0x23'),_0x17c7c8+'-'+_0x5c23b1+'/'+_0x1ce0b0)[_0xaf40('0x1d')](_0x2ad326);}return null;};}function patchUpdates(_0x535e4a){return function(_0x52ed58){try{jsonpatch['apply'](_0x52ed58,_0x535e4a,!![]);}catch(_0x101152){return BPromise['reject'](_0x101152);}return _0x52ed58[_0xaf40('0x24')]();};}function saveUpdates(_0x4a8fc9,_0x309ab1){return function(_0xe5d463){if(_0xe5d463){return _0xe5d463['update'](_0x4a8fc9)['then'](function(_0x3f8a6){return _0x3f8a6;});}return null;};}function removeEntity(_0x245d97,_0x5a4e77){return function(_0xf18139){if(_0xf18139){return _0xf18139[_0xaf40('0x25')]()[_0xaf40('0x26')](function(){_0x245d97[_0xaf40('0x1c')](0xcc)[_0xaf40('0x27')]();});}};}function handleEntityNotFound(_0x248d1d,_0x28384b){return function(_0x198a4f){if(!_0x198a4f){_0x248d1d['sendStatus'](0x194);}return _0x198a4f;};}function handleError(_0x3d5003,_0x20675b){_0x20675b=_0x20675b||0x1f4;return function(_0x2b6826){logger[_0xaf40('0x28')](_0x2b6826[_0xaf40('0x29')]);if(_0x2b6826[_0xaf40('0x2a')]){delete _0x2b6826[_0xaf40('0x2a')];}_0x3d5003[_0xaf40('0x1c')](_0x20675b)[_0xaf40('0x2b')](_0x2b6826);};}exports[_0xaf40('0x2c')]=function(_0x19abd9,_0x178151){var _0x11b3d8={},_0x18426b={},_0x17179a={'count':0x0,'rows':[]};var _0x382c91=_[_0xaf40('0x2d')](db[_0xaf40('0x2e')][_0xaf40('0x2f')],function(_0x29b76e){return{'name':_0x29b76e['fieldName'],'type':_0x29b76e['type']['key']};});_0x18426b[_0xaf40('0x30')]=_[_0xaf40('0x2d')](_0x382c91,_0xaf40('0x2a'));_0x18426b[_0xaf40('0x31')]=_['keys'](_0x19abd9[_0xaf40('0x31')]);_0x18426b[_0xaf40('0x32')]=_[_0xaf40('0x33')](_0x18426b['model'],_0x18426b['query']);_0x11b3d8[_0xaf40('0x34')]=_[_0xaf40('0x33')](_0x18426b[_0xaf40('0x30')],qs['fields'](_0x19abd9[_0xaf40('0x31')][_0xaf40('0x35')]));_0x11b3d8['attributes']=_0x11b3d8['attributes']['length']?_0x11b3d8['attributes']:_0x18426b[_0xaf40('0x30')];if(!_0x19abd9['query'][_0xaf40('0x36')](_0xaf40('0x37'))){_0x11b3d8[_0xaf40('0x20')]=qs[_0xaf40('0x20')](_0x19abd9[_0xaf40('0x31')][_0xaf40('0x20')]);_0x11b3d8[_0xaf40('0x1e')]=qs[_0xaf40('0x1e')](_0x19abd9['query']['offset']);}_0x11b3d8[_0xaf40('0x38')]=qs[_0xaf40('0x39')](_0x19abd9['query'][_0xaf40('0x39')]);_0x11b3d8['where']=qs['filters'](_[_0xaf40('0x3a')](_0x19abd9['query'],_0x18426b[_0xaf40('0x32')]),_0x382c91);if(_0x19abd9[_0xaf40('0x31')][_0xaf40('0x3b')]){_0x11b3d8[_0xaf40('0x3c')]=_[_0xaf40('0x3d')](_0x11b3d8['where'],{'$or':_['map'](_0x382c91,function(_0x528018){if(_0x528018[_0xaf40('0x3e')]!==_0xaf40('0x3f')){var _0x3004a5={};_0x3004a5[_0x528018[_0xaf40('0x2a')]]={'$like':'%'+_0x19abd9[_0xaf40('0x31')]['filter']+'%'};return _0x3004a5;}})});}_0x11b3d8=_['merge']({},_0x11b3d8,_0x19abd9[_0xaf40('0x40')]);var _0x419af7={'where':_0x11b3d8[_0xaf40('0x3c')]};return db[_0xaf40('0x2e')]['count'](_0x419af7)[_0xaf40('0x26')](function(_0x41f298){_0x17179a[_0xaf40('0x21')]=_0x41f298;if(_0x19abd9[_0xaf40('0x31')][_0xaf40('0x41')]){_0x11b3d8[_0xaf40('0x42')]=[{'all':!![]}];}return db[_0xaf40('0x2e')][_0xaf40('0x43')](_0x11b3d8);})[_0xaf40('0x26')](function(_0x1f965a){_0x17179a[_0xaf40('0x44')]=_0x1f965a;return _0x17179a;})[_0xaf40('0x26')](respondWithFilteredResult(_0x178151,_0x11b3d8))['catch'](handleError(_0x178151,null));};exports[_0xaf40('0x45')]=function(_0x61a18c,_0x4df156){var _0x12b574={'raw':!![],'where':{'id':_0x61a18c['params']['id']}},_0x493387={};_0x493387[_0xaf40('0x30')]=_[_0xaf40('0x46')](db[_0xaf40('0x2e')][_0xaf40('0x2f')]);_0x493387[_0xaf40('0x31')]=_[_0xaf40('0x46')](_0x61a18c[_0xaf40('0x31')]);_0x493387[_0xaf40('0x32')]=_[_0xaf40('0x33')](_0x493387['model'],_0x493387[_0xaf40('0x31')]);_0x12b574['attributes']=_[_0xaf40('0x33')](_0x493387[_0xaf40('0x30')],qs[_0xaf40('0x35')](_0x61a18c[_0xaf40('0x31')]['fields']));_0x12b574[_0xaf40('0x34')]=_0x12b574[_0xaf40('0x34')][_0xaf40('0x47')]?_0x12b574[_0xaf40('0x34')]:_0x493387['model'];if(_0x61a18c['query'][_0xaf40('0x41')]){_0x12b574[_0xaf40('0x42')]=[{'all':!![]}];}_0x12b574=_[_0xaf40('0x3d')]({},_0x12b574,_0x61a18c[_0xaf40('0x40')]);return db[_0xaf40('0x2e')]['find'](_0x12b574)[_0xaf40('0x26')](handleEntityNotFound(_0x4df156,null))['then'](respondWithResult(_0x4df156,null))[_0xaf40('0x48')](handleError(_0x4df156,null));};exports[_0xaf40('0x49')]=function(_0x4689f3,_0x44aedb){return db[_0xaf40('0x2e')][_0xaf40('0x49')](_0x4689f3[_0xaf40('0x4a')],{})['then'](respondWithResult(_0x44aedb,0xc9))[_0xaf40('0x48')](handleError(_0x44aedb,null));};exports['update']=function(_0xe8afe5,_0x4a0fca){if(_0xe8afe5['body']['id']){delete _0xe8afe5[_0xaf40('0x4a')]['id'];}return db[_0xaf40('0x2e')][_0xaf40('0x4b')]({'where':{'id':_0xe8afe5[_0xaf40('0x4c')]['id']}})[_0xaf40('0x26')](handleEntityNotFound(_0x4a0fca,null))[_0xaf40('0x26')](saveUpdates(_0xe8afe5[_0xaf40('0x4a')],null))[_0xaf40('0x26')](respondWithResult(_0x4a0fca,null))[_0xaf40('0x48')](handleError(_0x4a0fca,null));};exports[_0xaf40('0x25')]=function(_0x55fbf1,_0x35a4d6){return db[_0xaf40('0x2e')]['find']({'where':{'id':_0x55fbf1['params']['id']}})['then'](handleEntityNotFound(_0x35a4d6,null))[_0xaf40('0x26')](removeEntity(_0x35a4d6,null))['catch'](handleError(_0x35a4d6,null));};exports['describe']=function(_0x15f6c9,_0x3eb52d){return db[_0xaf40('0x2e')][_0xaf40('0x4d')]()['then'](respondWithResult(_0x3eb52d,null))[_0xaf40('0x48')](handleError(_0x3eb52d,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 5011fb4..d6210f2 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 _0xe7a3=['./faxTransferReport.attributes','define','FaxTransferReport','report_fax_transfer','uniqueid','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5ce848,_0x4c8981){var _0x14bde2=function(_0x1137f3){while(--_0x1137f3){_0x5ce848['push'](_0x5ce848['shift']());}};_0x14bde2(++_0x4c8981);}(_0xe7a3,0x1bf));var _0x3e7a=function(_0xb230d8,_0x24f0ad){_0xb230d8=_0xb230d8-0x0;var _0x42a754=_0xe7a3[_0xb230d8];return _0x42a754;};'use strict';var _=require('lodash');var util=require(_0x3e7a('0x0'));var logger=require('../../config/logger')(_0x3e7a('0x1'));var moment=require(_0x3e7a('0x2'));var BPromise=require(_0x3e7a('0x3'));var rp=require(_0x3e7a('0x4'));var fs=require('fs');var path=require(_0x3e7a('0x5'));var rimraf=require(_0x3e7a('0x6'));var config=require(_0x3e7a('0x7'));var attributes=require(_0x3e7a('0x8'));module['exports']=function(_0x381056,_0x3f798e){return _0x381056[_0x3e7a('0x9')](_0x3e7a('0xa'),attributes,{'tableName':_0x3e7a('0xb'),'paranoid':![],'indexes':[{'name':_0x3e7a('0xc'),'fields':[_0x3e7a('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb1f=['util','../../config/logger','api','bluebird','./faxTransferReport.attributes','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash'];(function(_0x335fbe,_0x360520){var _0x286143=function(_0x3455a8){while(--_0x3455a8){_0x335fbe['push'](_0x335fbe['shift']());}};_0x286143(++_0x360520);}(_0xcb1f,0x121));var _0xfcb1=function(_0x554597,_0x347e7e){_0x554597=_0x554597-0x0;var _0xabd777=_0xcb1f[_0x554597];return _0xabd777;};'use strict';var _=require(_0xfcb1('0x0'));var util=require(_0xfcb1('0x1'));var logger=require(_0xfcb1('0x2'))(_0xfcb1('0x3'));var moment=require('moment');var BPromise=require(_0xfcb1('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(_0xfcb1('0x5'));module['exports']=function(_0x15f5c5,_0x37e8fe){return _0x15f5c5[_0xfcb1('0x6')](_0xfcb1('0x7'),attributes,{'tableName':_0xfcb1('0x8'),'paranoid':![],'indexes':[{'name':_0xfcb1('0x9'),'fields':[_0xfcb1('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 0d8c8d9..c22b86f 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 _0x6807=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FaxTransferReport,\x20%s,\x20%s','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0x6807,0x106));var _0x7680=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x6807[_0x1a36a5];return _0x746243;};'use strict';var _=require('lodash');var util=require(_0x7680('0x0'));var moment=require(_0x7680('0x1'));var BPromise=require(_0x7680('0x2'));var rs=require(_0x7680('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7680('0x4'))['db'];var utils=require(_0x7680('0x5'));var logger=require(_0x7680('0x6'))(_0x7680('0x7'));var config=require(_0x7680('0x8'));var jayson=require(_0x7680('0x9'));var client=jayson[_0x7680('0xa')][_0x7680('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d0cc2,_0x5602b7,_0x658a63){return new BPromise(function(_0x3fe79a,_0x113e98){return client[_0x7680('0xc')](_0x4d0cc2,_0x658a63)['then'](function(_0x2d9982){logger[_0x7680('0xd')](_0x7680('0xe'),_0x5602b7,'request\x20sent');logger[_0x7680('0xf')](_0x7680('0x10'),_0x5602b7,_0x7680('0x11'),JSON[_0x7680('0x12')](_0x2d9982));if(_0x2d9982[_0x7680('0x13')]){if(_0x2d9982['error'][_0x7680('0x14')]===0x1f4){logger[_0x7680('0x13')](_0x7680('0xe'),_0x5602b7,_0x2d9982[_0x7680('0x13')]['message']);return _0x113e98(_0x2d9982['error'][_0x7680('0x15')]);}logger[_0x7680('0x13')](_0x7680('0xe'),_0x5602b7,_0x2d9982[_0x7680('0x13')]['message']);return _0x3fe79a(_0x2d9982[_0x7680('0x13')][_0x7680('0x15')]);}else{logger[_0x7680('0xd')](_0x7680('0xe'),_0x5602b7,_0x7680('0x11'));_0x3fe79a(_0x2d9982[_0x7680('0x16')][_0x7680('0x15')]);}})[_0x7680('0x17')](function(_0x464bd8){logger[_0x7680('0x13')]('FaxTransferReport,\x20%s,\x20%s',_0x5602b7,_0x464bd8);_0x113e98(_0x464bd8);});});} \ No newline at end of file +var _0x5877=['request','then','FaxTransferReport,\x20%s,\x20%s','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x4522cb,_0x2cbc29){var _0x293c04=function(_0x312b93){while(--_0x312b93){_0x4522cb['push'](_0x4522cb['shift']());}};_0x293c04(++_0x2cbc29);}(_0x5877,0x97));var _0x7587=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x5877[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7587('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7587('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7587('0x2'));var db=require(_0x7587('0x3'))['db'];var utils=require(_0x7587('0x4'));var logger=require(_0x7587('0x5'))(_0x7587('0x6'));var config=require(_0x7587('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7587('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x304e2,_0x576ec0,_0xf6329b){return new BPromise(function(_0x233122,_0x215659){return client[_0x7587('0x9')](_0x304e2,_0xf6329b)[_0x7587('0xa')](function(_0x1bd825){logger['info'](_0x7587('0xb'),_0x576ec0,'request\x20sent');logger[_0x7587('0xc')](_0x7587('0xd'),_0x576ec0,_0x7587('0xe'),JSON['stringify'](_0x1bd825));if(_0x1bd825[_0x7587('0xf')]){if(_0x1bd825['error']['code']===0x1f4){logger['error'](_0x7587('0xb'),_0x576ec0,_0x1bd825[_0x7587('0xf')]['message']);return _0x215659(_0x1bd825[_0x7587('0xf')][_0x7587('0x10')]);}logger[_0x7587('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x576ec0,_0x1bd825['error'][_0x7587('0x10')]);return _0x233122(_0x1bd825[_0x7587('0xf')]['message']);}else{logger[_0x7587('0x11')](_0x7587('0xb'),_0x576ec0,_0x7587('0xe'));_0x233122(_0x1bd825[_0x7587('0x12')][_0x7587('0x10')]);}})[_0x7587('0x13')](function(_0x580058){logger[_0x7587('0xf')](_0x7587('0xb'),_0x576ec0,_0x580058);_0x215659(_0x580058);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 2d047ce..379534f 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 _0x394c=['update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','isAuthenticated','get','/describe','/:id','show','post','create'];(function(_0x4185df,_0x3cbf64){var _0x4e900f=function(_0x2e211e){while(--_0x2e211e){_0x4185df['push'](_0x4185df['shift']());}};_0x4e900f(++_0x3cbf64);}(_0x394c,0x120));var _0xc394=function(_0x39551a,_0x116007){_0x39551a=_0x39551a-0x0;var _0x4b0b62=_0x394c[_0x39551a];return _0x4b0b62;};'use strict';var multer=require(_0xc394('0x0'));var util=require(_0xc394('0x1'));var path=require('path');var timeout=require(_0xc394('0x2'));var express=require(_0xc394('0x3'));var router=express[_0xc394('0x4')]();var fs_extra=require(_0xc394('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc394('0x6'));var config=require(_0xc394('0x7'));var controller=require(_0xc394('0x8'));router['get']('/',auth[_0xc394('0x9')](),controller['index']);router[_0xc394('0xa')](_0xc394('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xc394('0xa')](_0xc394('0xc'),auth[_0xc394('0x9')](),controller[_0xc394('0xd')]);router[_0xc394('0xe')]('/',auth[_0xc394('0x9')](),controller[_0xc394('0xf')]);router['put'](_0xc394('0xc'),auth[_0xc394('0x9')](),controller[_0xc394('0x10')]);router[_0xc394('0x11')](_0xc394('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xc394('0x12')]=router; \ No newline at end of file +var _0xe13e=['./faxTransferReport.controller','isAuthenticated','index','get','show','post','update','delete','/:id','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1e2bbe,_0x4df37d){var _0x435438=function(_0x26da9a){while(--_0x26da9a){_0x1e2bbe['push'](_0x1e2bbe['shift']());}};_0x435438(++_0x4df37d);}(_0xe13e,0x187));var _0xee13=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe13e[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xee13('0x0'));var util=require(_0xee13('0x1'));var path=require('path');var timeout=require(_0xee13('0x2'));var express=require(_0xee13('0x3'));var router=express[_0xee13('0x4')]();var fs_extra=require(_0xee13('0x5'));var auth=require(_0xee13('0x6'));var interaction=require(_0xee13('0x7'));var config=require('../../config/environment');var controller=require(_0xee13('0x8'));router['get']('/',auth[_0xee13('0x9')](),controller[_0xee13('0xa')]);router[_0xee13('0xb')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xee13('0xc')]);router[_0xee13('0xd')]('/',auth[_0xee13('0x9')](),controller['create']);router['put']('/:id',auth[_0xee13('0x9')](),controller[_0xee13('0xe')]);router[_0xee13('0xf')](_0xee13('0x10'),auth['isAuthenticated'](),controller[_0xee13('0x11')]);module[_0xee13('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 2248a2f..0ab3fd3 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 _0x030c=['getFields','post','create','/:id/configurations','put','/:id','update','delete','destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','getConfigurations','/:id/fields'];(function(_0xb8de81,_0x3a4c94){var _0x5d9004=function(_0xb683a1){while(--_0xb683a1){_0xb8de81['push'](_0xb8de81['shift']());}};_0x5d9004(++_0x3a4c94);}(_0x030c,0x1a7));var _0xc030=function(_0x1337be,_0x1e0176){_0x1337be=_0x1337be-0x0;var _0x5e4df9=_0x030c[_0x1337be];return _0x5e4df9;};'use strict';var multer=require(_0xc030('0x0'));var util=require(_0xc030('0x1'));var path=require(_0xc030('0x2'));var timeout=require('connect-timeout');var express=require(_0xc030('0x3'));var router=express['Router']();var fs_extra=require(_0xc030('0x4'));var auth=require(_0xc030('0x5'));var interaction=require(_0xc030('0x6'));var config=require(_0xc030('0x7'));var controller=require('./intDeskAccount.controller');router[_0xc030('0x8')]('/',auth[_0xc030('0x9')](),controller[_0xc030('0xa')]);router[_0xc030('0x8')]('/:id',auth[_0xc030('0x9')](),controller[_0xc030('0xb')]);router[_0xc030('0x8')]('/:id/configurations',auth[_0xc030('0x9')](),controller[_0xc030('0xc')]);router[_0xc030('0x8')](_0xc030('0xd'),auth[_0xc030('0x9')](),controller[_0xc030('0xe')]);router[_0xc030('0xf')]('/',auth[_0xc030('0x9')](),controller[_0xc030('0x10')]);router[_0xc030('0xf')](_0xc030('0x11'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xc030('0x12')](_0xc030('0x13'),auth[_0xc030('0x9')](),controller[_0xc030('0x14')]);router[_0xc030('0x15')]('/:id',auth[_0xc030('0x9')](),controller[_0xc030('0x16')]);module['exports']=router; \ No newline at end of file +var _0xb7b5=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','delete','destroy','exports'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0xb7b5,0x111));var _0x5b7b=function(_0x1dfc5c,_0xb363a5){_0x1dfc5c=_0x1dfc5c-0x0;var _0x5e95a7=_0xb7b5[_0x1dfc5c];return _0x5e95a7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5b7b('0x0'));var timeout=require('connect-timeout');var express=require(_0x5b7b('0x1'));var router=express[_0x5b7b('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x5b7b('0x3'));var interaction=require(_0x5b7b('0x4'));var config=require(_0x5b7b('0x5'));var controller=require('./intDeskAccount.controller');router[_0x5b7b('0x6')]('/',auth['isAuthenticated'](),controller[_0x5b7b('0x7')]);router[_0x5b7b('0x6')](_0x5b7b('0x8'),auth[_0x5b7b('0x9')](),controller['show']);router[_0x5b7b('0x6')](_0x5b7b('0xa'),auth['isAuthenticated'](),controller[_0x5b7b('0xb')]);router['get'](_0x5b7b('0xc'),auth[_0x5b7b('0x9')](),controller[_0x5b7b('0xd')]);router[_0x5b7b('0xe')]('/',auth['isAuthenticated'](),controller[_0x5b7b('0xf')]);router[_0x5b7b('0xe')](_0x5b7b('0xa'),auth[_0x5b7b('0x9')](),controller['addConfiguration']);router[_0x5b7b('0x10')](_0x5b7b('0x8'),auth[_0x5b7b('0x9')](),controller[_0x5b7b('0x11')]);router[_0x5b7b('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x5b7b('0x13')]);module[_0x5b7b('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index f149b2c..36fecb7 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 _0xb0e3=['STRING','ENUM','basic','newTab','integrationTab','sequelize','exports'];(function(_0x44379c,_0x63c052){var _0x2254a9=function(_0x5df134){while(--_0x5df134){_0x44379c['push'](_0x44379c['shift']());}};_0x2254a9(++_0x63c052);}(_0xb0e3,0x83));var _0x3b0e=function(_0x4a343e,_0x5df78d){_0x4a343e=_0x4a343e-0x0;var _0xff7501=_0xb0e3[_0x4a343e];return _0xff7501;};'use strict';var Sequelize=require(_0x3b0e('0x0'));module[_0x3b0e('0x1')]={'name':{'type':Sequelize[_0x3b0e('0x2')]},'description':{'type':Sequelize[_0x3b0e('0x2')]},'username':{'type':Sequelize[_0x3b0e('0x2')]},'remoteUri':{'type':Sequelize[_0x3b0e('0x2')]},'authType':{'type':Sequelize[_0x3b0e('0x3')](_0x3b0e('0x4')),'defaultValue':_0x3b0e('0x4')},'password':{'type':Sequelize[_0x3b0e('0x2')]},'consumerKey':{'type':Sequelize[_0x3b0e('0x2')]},'consumerSecret':{'type':Sequelize[_0x3b0e('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x3b0e('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x3b0e('0x3')]('integrationTab',_0x3b0e('0x5')),'defaultValue':_0x3b0e('0x6')}}; \ No newline at end of file +var _0x47c8=['STRING','basic','ENUM','integrationTab','newTab'];(function(_0x5cf3c0,_0x4363c1){var _0x39a680=function(_0x2a10f1){while(--_0x2a10f1){_0x5cf3c0['push'](_0x5cf3c0['shift']());}};_0x39a680(++_0x4363c1);}(_0x47c8,0x6e));var _0x847c=function(_0x41a2a9,_0x32109b){_0x41a2a9=_0x41a2a9-0x0;var _0x5c0797=_0x47c8[_0x41a2a9];return _0x5c0797;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x847c('0x0')]},'username':{'type':Sequelize[_0x847c('0x0')]},'remoteUri':{'type':Sequelize[_0x847c('0x0')]},'authType':{'type':Sequelize['ENUM'](_0x847c('0x1')),'defaultValue':_0x847c('0x1')},'password':{'type':Sequelize[_0x847c('0x0')]},'consumerKey':{'type':Sequelize[_0x847c('0x0')]},'consumerSecret':{'type':Sequelize[_0x847c('0x0')]},'token':{'type':Sequelize[_0x847c('0x0')]},'tokenSecret':{'type':Sequelize[_0x847c('0x0')]},'serverUrl':{'type':Sequelize[_0x847c('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0x847c('0x2')](_0x847c('0x3'),_0x847c('0x4')),'defaultValue':_0x847c('0x3')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 7c02319..c836e12 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 _0x5357=['Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','pick','where','merge','type','VIRTUAL','filter','options','DeskAccount','includeAll','include','rows','show','params','fields','find','catch','create','body','getConfigurations','findOne','addConfiguration','Subjects','channel','getDescriptions','DeskConfiguration','DeskField','Descriptions','getFields','priority','remoteUri','username','password','consumerKey','consumerSecret','token','tokenSecret','substring','GET','format','%s/custom_fields','application/json','basic','%s:%s','toString','concat','_embedded','entries','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send'];(function(_0x5c883f,_0x38f092){var _0x4210cc=function(_0x51be71){while(--_0x51be71){_0x5c883f['push'](_0x5c883f['shift']());}};_0x4210cc(++_0x38f092);}(_0x5357,0x1b5));var _0x7535=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0x5357[_0x5d80de];return _0x1c7556;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7535('0x0'));var zipdir=require(_0x7535('0x1'));var jsonpatch=require(_0x7535('0x2'));var rp=require('request-promise');var moment=require(_0x7535('0x3'));var BPromise=require(_0x7535('0x4'));var Mustache=require(_0x7535('0x5'));var util=require(_0x7535('0x6'));var path=require('path');var sox=require(_0x7535('0x7'));var csv=require(_0x7535('0x8'));var ejs=require(_0x7535('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7535('0xa'));var crypto=require(_0x7535('0xb'));var jsforce=require(_0x7535('0xc'));var deskjs=require(_0x7535('0xd'));var toCsv=require(_0x7535('0x8'));var querystring=require(_0x7535('0xe'));var Papa=require('papaparse');var Redis=require(_0x7535('0xf'));var authService=require(_0x7535('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7535('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7535('0x12'))(_0x7535('0x13'));var utils=require(_0x7535('0x14'));var config=require(_0x7535('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7535('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4a01e9,_0x247f9a){_0x247f9a=_0x247f9a||0xcc;return function(_0x2331de){if(_0x2331de){return _0x4a01e9[_0x7535('0x17')](_0x247f9a);}return _0x4a01e9[_0x7535('0x18')](_0x247f9a)['end']();};}function respondWithResult(_0x4b9fb2,_0x1f9ee8){_0x1f9ee8=_0x1f9ee8||0xc8;return function(_0x22fda0){if(_0x22fda0){return _0x4b9fb2[_0x7535('0x18')](_0x1f9ee8)[_0x7535('0x19')](_0x22fda0);}};}function respondWithFilteredResult(_0x5aef16,_0x22c541){return function(_0x55eb56){if(_0x55eb56){var _0x5043f0=typeof _0x22c541[_0x7535('0x1a')]===_0x7535('0x1b')&&typeof _0x22c541['limit']===_0x7535('0x1b');var _0xf33b42=_0x55eb56[_0x7535('0x1c')];var _0x54d0d3=_0x5043f0?0x0:_0x22c541[_0x7535('0x1a')];var _0x325083=_0x5043f0?_0x55eb56[_0x7535('0x1c')]:_0x22c541[_0x7535('0x1a')]+_0x22c541[_0x7535('0x1d')];var _0x2b9130;if(_0x325083>=_0xf33b42){_0x325083=_0xf33b42;_0x2b9130=0xc8;}else{_0x2b9130=0xce;}_0x5aef16[_0x7535('0x18')](_0x2b9130);return _0x5aef16[_0x7535('0x1e')](_0x7535('0x1f'),_0x54d0d3+'-'+_0x325083+'/'+_0xf33b42)[_0x7535('0x19')](_0x55eb56);}return null;};}function patchUpdates(_0x1246e1){return function(_0x14f943){try{jsonpatch[_0x7535('0x20')](_0x14f943,_0x1246e1,!![]);}catch(_0x35b9df){return BPromise[_0x7535('0x21')](_0x35b9df);}return _0x14f943[_0x7535('0x22')]();};}function saveUpdates(_0x2dc985,_0xecb3cd){return function(_0x1ea5bb){if(_0x1ea5bb){return _0x1ea5bb[_0x7535('0x23')](_0x2dc985)[_0x7535('0x24')](function(_0x5223ba){return _0x5223ba;});}return null;};}function removeEntity(_0xaaa8b7,_0x1ba9cd){return function(_0x56ae12){if(_0x56ae12){return _0x56ae12[_0x7535('0x25')]()[_0x7535('0x24')](function(){_0xaaa8b7[_0x7535('0x18')](0xcc)[_0x7535('0x26')]();});}};}function handleEntityNotFound(_0x5f413e,_0x2edc23){return function(_0x3704d8){if(!_0x3704d8){_0x5f413e['sendStatus'](0x194);}return _0x3704d8;};}function handleError(_0x16e030,_0x2fceff){_0x2fceff=_0x2fceff||0x1f4;return function(_0xe5c7bd){logger[_0x7535('0x27')](_0xe5c7bd[_0x7535('0x28')]);if(_0xe5c7bd['name']){delete _0xe5c7bd[_0x7535('0x29')];}_0x16e030[_0x7535('0x18')](_0x2fceff)['send'](_0xe5c7bd);};}exports[_0x7535('0x2a')]=function(_0x14cd30,_0x2747c5){var _0x4440b0={},_0x297f49={},_0x4bef15={'count':0x0,'rows':[]};var _0x3184ea=_[_0x7535('0x2b')](db['DeskAccount'][_0x7535('0x2c')],function(_0x2aa0f1){return{'name':_0x2aa0f1[_0x7535('0x2d')],'type':_0x2aa0f1['type']['key']};});_0x297f49[_0x7535('0x2e')]=_[_0x7535('0x2b')](_0x3184ea,_0x7535('0x29'));_0x297f49[_0x7535('0x2f')]=_[_0x7535('0x30')](_0x14cd30['query']);_0x297f49[_0x7535('0x31')]=_[_0x7535('0x32')](_0x297f49[_0x7535('0x2e')],_0x297f49[_0x7535('0x2f')]);_0x4440b0[_0x7535('0x33')]=_[_0x7535('0x32')](_0x297f49[_0x7535('0x2e')],qs['fields'](_0x14cd30[_0x7535('0x2f')]['fields']));_0x4440b0['attributes']=_0x4440b0['attributes'][_0x7535('0x34')]?_0x4440b0['attributes']:_0x297f49[_0x7535('0x2e')];if(!_0x14cd30[_0x7535('0x2f')][_0x7535('0x35')](_0x7535('0x36'))){_0x4440b0[_0x7535('0x1d')]=qs['limit'](_0x14cd30[_0x7535('0x2f')][_0x7535('0x1d')]);_0x4440b0['offset']=qs[_0x7535('0x1a')](_0x14cd30[_0x7535('0x2f')]['offset']);}_0x4440b0['order']=qs[_0x7535('0x37')](_0x14cd30[_0x7535('0x2f')][_0x7535('0x37')]);_0x4440b0['where']=qs['filters'](_[_0x7535('0x38')](_0x14cd30['query'],_0x297f49[_0x7535('0x31')]),_0x3184ea);if(_0x14cd30[_0x7535('0x2f')]['filter']){_0x4440b0[_0x7535('0x39')]=_[_0x7535('0x3a')](_0x4440b0[_0x7535('0x39')],{'$or':_['map'](_0x3184ea,function(_0x16234c){if(_0x16234c[_0x7535('0x3b')]!==_0x7535('0x3c')){var _0x1f4ea9={};_0x1f4ea9[_0x16234c[_0x7535('0x29')]]={'$like':'%'+_0x14cd30[_0x7535('0x2f')][_0x7535('0x3d')]+'%'};return _0x1f4ea9;}})});}_0x4440b0=_[_0x7535('0x3a')]({},_0x4440b0,_0x14cd30[_0x7535('0x3e')]);var _0xb45ad0={'where':_0x4440b0[_0x7535('0x39')]};return db[_0x7535('0x3f')][_0x7535('0x1c')](_0xb45ad0)[_0x7535('0x24')](function(_0x1971f5){_0x4bef15[_0x7535('0x1c')]=_0x1971f5;if(_0x14cd30[_0x7535('0x2f')][_0x7535('0x40')]){_0x4440b0[_0x7535('0x41')]=[{'all':!![]}];}return db[_0x7535('0x3f')]['findAll'](_0x4440b0);})[_0x7535('0x24')](function(_0x47689b){_0x4bef15[_0x7535('0x42')]=_0x47689b;return _0x4bef15;})[_0x7535('0x24')](respondWithFilteredResult(_0x2747c5,_0x4440b0))['catch'](handleError(_0x2747c5,null));};exports[_0x7535('0x43')]=function(_0x566394,_0x39f961){var _0x16ca16={'raw':![],'where':{'id':_0x566394[_0x7535('0x44')]['id']}},_0x5610a8={};_0x5610a8[_0x7535('0x2e')]=_['keys'](db['DeskAccount'][_0x7535('0x2c')]);_0x5610a8[_0x7535('0x2f')]=_[_0x7535('0x30')](_0x566394['query']);_0x5610a8[_0x7535('0x31')]=_[_0x7535('0x32')](_0x5610a8['model'],_0x5610a8[_0x7535('0x2f')]);_0x16ca16[_0x7535('0x33')]=_[_0x7535('0x32')](_0x5610a8['model'],qs[_0x7535('0x45')](_0x566394[_0x7535('0x2f')][_0x7535('0x45')]));_0x16ca16[_0x7535('0x33')]=_0x16ca16[_0x7535('0x33')][_0x7535('0x34')]?_0x16ca16[_0x7535('0x33')]:_0x5610a8['model'];if(_0x566394['query'][_0x7535('0x40')]){_0x16ca16['include']=[{'all':!![]}];}_0x16ca16=_[_0x7535('0x3a')]({},_0x16ca16,_0x566394['options']);return db[_0x7535('0x3f')][_0x7535('0x46')](_0x16ca16)['then'](handleEntityNotFound(_0x39f961,null))[_0x7535('0x24')](respondWithResult(_0x39f961,null))[_0x7535('0x47')](handleError(_0x39f961,null));};exports[_0x7535('0x48')]=function(_0x4aaf68,_0x2d910f){return db[_0x7535('0x3f')][_0x7535('0x48')](_0x4aaf68[_0x7535('0x49')],{})[_0x7535('0x24')](respondWithResult(_0x2d910f,0xc9))['catch'](handleError(_0x2d910f,null));};exports[_0x7535('0x23')]=function(_0x733ef5,_0x12b361){if(_0x733ef5[_0x7535('0x49')]['id']){delete _0x733ef5[_0x7535('0x49')]['id'];}return db['DeskAccount'][_0x7535('0x46')]({'where':{'id':_0x733ef5['params']['id']}})[_0x7535('0x24')](handleEntityNotFound(_0x12b361,null))[_0x7535('0x24')](saveUpdates(_0x733ef5[_0x7535('0x49')],null))['then'](respondWithResult(_0x12b361,null))[_0x7535('0x47')](handleError(_0x12b361,null));};exports[_0x7535('0x25')]=function(_0x3a6e95,_0x3dbec8){return db[_0x7535('0x3f')][_0x7535('0x46')]({'where':{'id':_0x3a6e95[_0x7535('0x44')]['id']}})[_0x7535('0x24')](handleEntityNotFound(_0x3dbec8,null))[_0x7535('0x24')](removeEntity(_0x3dbec8,null))[_0x7535('0x47')](handleError(_0x3dbec8,null));};exports[_0x7535('0x4a')]=function(_0x545b5b,_0x3ab1b3,_0x4f743e){var _0xcbb4d7={};var _0x1d6283={};var _0x8ee2e2;var _0x79db7e;return db[_0x7535('0x3f')][_0x7535('0x4b')]({'where':{'id':_0x545b5b['params']['id']}})[_0x7535('0x24')](handleEntityNotFound(_0x3ab1b3,null))[_0x7535('0x24')](function(_0x393ab8){if(_0x393ab8){_0x8ee2e2=_0x393ab8;_0x1d6283[_0x7535('0x2e')]=_[_0x7535('0x30')](db['DeskConfiguration']['rawAttributes']);_0x1d6283['query']=_[_0x7535('0x30')](_0x545b5b[_0x7535('0x2f')]);_0x1d6283[_0x7535('0x31')]=_['intersection'](_0x1d6283[_0x7535('0x2e')],_0x1d6283[_0x7535('0x2f')]);_0xcbb4d7[_0x7535('0x33')]=_[_0x7535('0x32')](_0x1d6283['model'],qs[_0x7535('0x45')](_0x545b5b['query']['fields']));_0xcbb4d7['attributes']=_0xcbb4d7[_0x7535('0x33')][_0x7535('0x34')]?_0xcbb4d7[_0x7535('0x33')]:_0x1d6283[_0x7535('0x2e')];_0xcbb4d7['order']=qs['sort'](_0x545b5b['query'][_0x7535('0x37')]);_0xcbb4d7[_0x7535('0x39')]=qs[_0x7535('0x31')](_[_0x7535('0x38')](_0x545b5b['query'],_0x1d6283[_0x7535('0x31')]));if(_0x545b5b[_0x7535('0x2f')][_0x7535('0x3d')]){_0xcbb4d7[_0x7535('0x39')]=_[_0x7535('0x3a')](_0xcbb4d7[_0x7535('0x39')],{'$or':_['map'](_0xcbb4d7[_0x7535('0x33')],function(_0x495bb0){var _0x4a54bd={};_0x4a54bd[_0x495bb0]={'$like':'%'+_0x545b5b[_0x7535('0x2f')][_0x7535('0x3d')]+'%'};return _0x4a54bd;})});}_0xcbb4d7=_[_0x7535('0x3a')]({},_0xcbb4d7,_0x545b5b[_0x7535('0x3e')]);return _0x8ee2e2[_0x7535('0x4a')](_0xcbb4d7);}})[_0x7535('0x24')](function(_0x14c54d){if(_0x14c54d){_0x79db7e=_0x14c54d[_0x7535('0x34')];if(!_0x545b5b[_0x7535('0x2f')][_0x7535('0x35')](_0x7535('0x36'))){_0xcbb4d7[_0x7535('0x1d')]=qs[_0x7535('0x1d')](_0x545b5b['query'][_0x7535('0x1d')]);_0xcbb4d7[_0x7535('0x1a')]=qs[_0x7535('0x1a')](_0x545b5b[_0x7535('0x2f')][_0x7535('0x1a')]);}return _0x8ee2e2['getConfigurations'](_0xcbb4d7);}})['then'](function(_0x1d8236){if(_0x1d8236){return _0x1d8236?{'count':_0x79db7e,'rows':_0x1d8236}:null;}})[_0x7535('0x24')](respondWithResult(_0x3ab1b3,null))[_0x7535('0x47')](handleError(_0x3ab1b3,null));};exports[_0x7535('0x4c')]=function(_0x149148,_0x58a30c,_0x161779){if(_0x149148['body']['id']){delete _0x149148[_0x7535('0x49')]['id'];}return db[_0x7535('0x3f')][_0x7535('0x4b')]({'where':{'id':_0x149148[_0x7535('0x44')]['id']}})[_0x7535('0x24')](handleEntityNotFound(_0x58a30c,null))[_0x7535('0x24')](function(_0x302175){if(_0x302175){_0x149148[_0x7535('0x49')]['AccountId']=_0x302175['id'];_0x149148[_0x7535('0x49')][_0x7535('0x4d')]=integrations['getSubjects'](_0x149148['body'][_0x7535('0x4e')],_0x149148[_0x7535('0x49')]['type']);_0x149148[_0x7535('0x49')]['Descriptions']=integrations[_0x7535('0x4f')](_0x149148[_0x7535('0x49')][_0x7535('0x4e')],_0x149148[_0x7535('0x49')]['type']);return db[_0x7535('0x50')][_0x7535('0x48')](_0x149148['body'],{'include':[{'model':db[_0x7535('0x51')],'as':_0x7535('0x4d')},{'model':db['DeskField'],'as':_0x7535('0x52')}]});}return null;})[_0x7535('0x24')](respondWithResult(_0x58a30c,null))['catch'](handleError(_0x58a30c,null));};exports[_0x7535('0x53')]=function(_0xfb00c4,_0x1009e5,_0x16416d){var _0x2f2de4=[{'name':_0x7535('0x54'),'label':_0x7535('0x54'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x3ee93f='';return db[_0x7535('0x3f')][_0x7535('0x4b')]({'where':{'id':_0xfb00c4['params']['id']},'attributes':['id',_0x7535('0x55'),'authType',_0x7535('0x56'),_0x7535('0x57'),_0x7535('0x58'),_0x7535('0x59'),_0x7535('0x5a'),_0x7535('0x5b')]})[_0x7535('0x24')](handleEntityNotFound(_0x1009e5,null))[_0x7535('0x24')](function(_0x5ce4af){if(_0x5ce4af){_0x3ee93f=_0x5ce4af[_0x7535('0x55')];var _0x5bbba0=_0x3ee93f['slice'](-0x1);if(_0x5bbba0==='/'){_0x3ee93f=_0x3ee93f[_0x7535('0x5c')](0x0,_0x3ee93f['lastIndexOf'](_0x5bbba0));}var _0x1ad4a7={'method':_0x7535('0x5d'),'uri':util[_0x7535('0x5e')](_0x7535('0x5f'),_0x3ee93f),'headers':{'Content-Type':'application/json','Accept':_0x7535('0x60')},'json':!![]};if(_0x5ce4af['authType']===_0x7535('0x61')){_0x1ad4a7['headers']['Authorization']=util['format']('Basic\x20%s',new Buffer(util[_0x7535('0x5e')](_0x7535('0x62'),_0x5ce4af[_0x7535('0x56')],_0x5ce4af[_0x7535('0x57')]))[_0x7535('0x63')]('base64'));}return rp(_0x1ad4a7)['then'](function(_0x6e0d87){return _0x2f2de4[_0x7535('0x64')](_[_0x7535('0x2b')](_0x6e0d87[_0x7535('0x65')][_0x7535('0x66')],function(_0x560957){return{'id':_0x560957[_0x7535('0x29')],'name':_0x560957['name'],'type':_0x560957[_0x7535('0x3b')],'active':_0x560957['active'],'label':_0x560957['label'],'custom':!![]};}));});}})[_0x7535('0x24')](function(_0x5b4f94){return{'count':_0x5b4f94[_0x7535('0x34')],'rows':_0x5b4f94};})[_0x7535('0x24')](respondWithResult(_0x1009e5,null))[_0x7535('0x47')](function(_0x5ba5e1){var _0xc2ecde=_0xfb00c4[_0x7535('0x2f')][_0x7535('0x67')]?0x1f4:_0x5ba5e1[_0x7535('0x68')]||0x1f4;logger['error'](_0x7535('0x69'),_0x7535('0x53'),_0xc2ecde,JSON[_0x7535('0x6a')](_0x5ba5e1));delete _0x5ba5e1[_0x7535('0x29')];if(_0xc2ecde===0x191){_0xc2ecde=0x190;}_0x1009e5[_0x7535('0x18')](_0xc2ecde)[_0x7535('0x6b')](_0xfb00c4['query'][_0x7535('0x67')]?{'message':_0x7535('0x6c'),'statusCode':_0x5ba5e1[_0x7535('0x68')]}:_0x5ba5e1);});}; \ No newline at end of file +var _0xa719=['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','crypto','jsforce','desk.js','ioredis','../../components/auth/service','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','DeskAccount','includeAll','include','rows','catch','show','params','create','body','find','getConfigurations','findOne','DeskConfiguration','addConfiguration','AccountId','Subjects','channel','Descriptions','DeskField','getFields','priority','remoteUri','authType','username','consumerKey','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','application/json','headers','Authorization','format','%s:%s','password','base64','concat','_embedded','label'];(function(_0x48326a,_0x8cfa0c){var _0x466709=function(_0x5ab1b7){while(--_0x5ab1b7){_0x48326a['push'](_0x48326a['shift']());}};_0x466709(++_0x8cfa0c);}(_0xa719,0x76));var _0x9a71=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xa719[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0x9a71('0x0'));var rimraf=require(_0x9a71('0x1'));var zipdir=require(_0x9a71('0x2'));var jsonpatch=require(_0x9a71('0x3'));var rp=require(_0x9a71('0x4'));var moment=require(_0x9a71('0x5'));var BPromise=require(_0x9a71('0x6'));var Mustache=require(_0x9a71('0x7'));var util=require(_0x9a71('0x8'));var path=require(_0x9a71('0x9'));var sox=require(_0x9a71('0xa'));var csv=require(_0x9a71('0xb'));var ejs=require(_0x9a71('0xc'));var fs=require('fs');var fs_extra=require(_0x9a71('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9a71('0xe'));var jsforce=require(_0x9a71('0xf'));var deskjs=require(_0x9a71('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9a71('0x11'));var authService=require(_0x9a71('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9a71('0x13'));var utils=require(_0x9a71('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9a71('0x15'))['db'];var integrations=require(_0x9a71('0x16'));function respondWithStatusCode(_0x5b8d4d,_0x4ef700){_0x4ef700=_0x4ef700||0xcc;return function(_0x4c6992){if(_0x4c6992){return _0x5b8d4d[_0x9a71('0x17')](_0x4ef700);}return _0x5b8d4d[_0x9a71('0x18')](_0x4ef700)[_0x9a71('0x19')]();};}function respondWithResult(_0x3739e4,_0x11f868){_0x11f868=_0x11f868||0xc8;return function(_0x2c2cc4){if(_0x2c2cc4){return _0x3739e4['status'](_0x11f868)[_0x9a71('0x1a')](_0x2c2cc4);}};}function respondWithFilteredResult(_0x506f07,_0x49d41d){return function(_0xd3b3bb){if(_0xd3b3bb){var _0x3481bc=typeof _0x49d41d['offset']===_0x9a71('0x1b')&&typeof _0x49d41d['limit']===_0x9a71('0x1b');var _0x2d5c48=_0xd3b3bb[_0x9a71('0x1c')];var _0x2b2292=_0x3481bc?0x0:_0x49d41d[_0x9a71('0x1d')];var _0x1fe583=_0x3481bc?_0xd3b3bb[_0x9a71('0x1c')]:_0x49d41d[_0x9a71('0x1d')]+_0x49d41d[_0x9a71('0x1e')];var _0x161674;if(_0x1fe583>=_0x2d5c48){_0x1fe583=_0x2d5c48;_0x161674=0xc8;}else{_0x161674=0xce;}_0x506f07[_0x9a71('0x18')](_0x161674);return _0x506f07['set'](_0x9a71('0x1f'),_0x2b2292+'-'+_0x1fe583+'/'+_0x2d5c48)[_0x9a71('0x1a')](_0xd3b3bb);}return null;};}function patchUpdates(_0x3ab508){return function(_0x843030){try{jsonpatch[_0x9a71('0x20')](_0x843030,_0x3ab508,!![]);}catch(_0x400c21){return BPromise[_0x9a71('0x21')](_0x400c21);}return _0x843030[_0x9a71('0x22')]();};}function saveUpdates(_0x3650f5,_0x53fec5){return function(_0x14a95d){if(_0x14a95d){return _0x14a95d[_0x9a71('0x23')](_0x3650f5)[_0x9a71('0x24')](function(_0x5a695d){return _0x5a695d;});}return null;};}function removeEntity(_0x4b0a63,_0x3e98a4){return function(_0x34cac4){if(_0x34cac4){return _0x34cac4[_0x9a71('0x25')]()['then'](function(){_0x4b0a63[_0x9a71('0x18')](0xcc)[_0x9a71('0x19')]();});}};}function handleEntityNotFound(_0x20e081,_0x11c26f){return function(_0x2435f2){if(!_0x2435f2){_0x20e081[_0x9a71('0x17')](0x194);}return _0x2435f2;};}function handleError(_0x485ce3,_0x28897f){_0x28897f=_0x28897f||0x1f4;return function(_0x3a8035){logger[_0x9a71('0x26')](_0x3a8035[_0x9a71('0x27')]);if(_0x3a8035['name']){delete _0x3a8035[_0x9a71('0x28')];}_0x485ce3['status'](_0x28897f)[_0x9a71('0x29')](_0x3a8035);};}exports[_0x9a71('0x2a')]=function(_0xa531c9,_0x378676){var _0x278ac8={},_0x84104f={},_0x459c87={'count':0x0,'rows':[]};var _0x3d304c=_[_0x9a71('0x2b')](db['DeskAccount'][_0x9a71('0x2c')],function(_0x1226b0){return{'name':_0x1226b0[_0x9a71('0x2d')],'type':_0x1226b0[_0x9a71('0x2e')][_0x9a71('0x2f')]};});_0x84104f[_0x9a71('0x30')]=_[_0x9a71('0x2b')](_0x3d304c,'name');_0x84104f['query']=_[_0x9a71('0x31')](_0xa531c9['query']);_0x84104f['filters']=_[_0x9a71('0x32')](_0x84104f[_0x9a71('0x30')],_0x84104f[_0x9a71('0x33')]);_0x278ac8[_0x9a71('0x34')]=_[_0x9a71('0x32')](_0x84104f['model'],qs['fields'](_0xa531c9[_0x9a71('0x33')][_0x9a71('0x35')]));_0x278ac8[_0x9a71('0x34')]=_0x278ac8[_0x9a71('0x34')][_0x9a71('0x36')]?_0x278ac8[_0x9a71('0x34')]:_0x84104f[_0x9a71('0x30')];if(!_0xa531c9[_0x9a71('0x33')][_0x9a71('0x37')](_0x9a71('0x38'))){_0x278ac8['limit']=qs[_0x9a71('0x1e')](_0xa531c9[_0x9a71('0x33')]['limit']);_0x278ac8[_0x9a71('0x1d')]=qs[_0x9a71('0x1d')](_0xa531c9[_0x9a71('0x33')][_0x9a71('0x1d')]);}_0x278ac8[_0x9a71('0x39')]=qs[_0x9a71('0x3a')](_0xa531c9[_0x9a71('0x33')][_0x9a71('0x3a')]);_0x278ac8['where']=qs[_0x9a71('0x3b')](_[_0x9a71('0x3c')](_0xa531c9[_0x9a71('0x33')],_0x84104f[_0x9a71('0x3b')]),_0x3d304c);if(_0xa531c9[_0x9a71('0x33')][_0x9a71('0x3d')]){_0x278ac8[_0x9a71('0x3e')]=_[_0x9a71('0x3f')](_0x278ac8[_0x9a71('0x3e')],{'$or':_[_0x9a71('0x2b')](_0x3d304c,function(_0x2ff8e8){if(_0x2ff8e8[_0x9a71('0x2e')]!==_0x9a71('0x40')){var _0x707e8e={};_0x707e8e[_0x2ff8e8['name']]={'$like':'%'+_0xa531c9[_0x9a71('0x33')]['filter']+'%'};return _0x707e8e;}})});}_0x278ac8=_[_0x9a71('0x3f')]({},_0x278ac8,_0xa531c9[_0x9a71('0x41')]);var _0x34e598={'where':_0x278ac8['where']};return db[_0x9a71('0x42')]['count'](_0x34e598)[_0x9a71('0x24')](function(_0x11fa46){_0x459c87[_0x9a71('0x1c')]=_0x11fa46;if(_0xa531c9[_0x9a71('0x33')][_0x9a71('0x43')]){_0x278ac8[_0x9a71('0x44')]=[{'all':!![]}];}return db[_0x9a71('0x42')]['findAll'](_0x278ac8);})[_0x9a71('0x24')](function(_0x51dd89){_0x459c87[_0x9a71('0x45')]=_0x51dd89;return _0x459c87;})[_0x9a71('0x24')](respondWithFilteredResult(_0x378676,_0x278ac8))[_0x9a71('0x46')](handleError(_0x378676,null));};exports[_0x9a71('0x47')]=function(_0x568d17,_0x33650e){var _0x119ecc={'raw':![],'where':{'id':_0x568d17[_0x9a71('0x48')]['id']}},_0x2cd9fe={};_0x2cd9fe['model']=_['keys'](db['DeskAccount'][_0x9a71('0x2c')]);_0x2cd9fe[_0x9a71('0x33')]=_['keys'](_0x568d17[_0x9a71('0x33')]);_0x2cd9fe[_0x9a71('0x3b')]=_[_0x9a71('0x32')](_0x2cd9fe[_0x9a71('0x30')],_0x2cd9fe[_0x9a71('0x33')]);_0x119ecc[_0x9a71('0x34')]=_['intersection'](_0x2cd9fe[_0x9a71('0x30')],qs[_0x9a71('0x35')](_0x568d17['query']['fields']));_0x119ecc[_0x9a71('0x34')]=_0x119ecc[_0x9a71('0x34')]['length']?_0x119ecc[_0x9a71('0x34')]:_0x2cd9fe['model'];if(_0x568d17[_0x9a71('0x33')]['includeAll']){_0x119ecc['include']=[{'all':!![]}];}_0x119ecc=_[_0x9a71('0x3f')]({},_0x119ecc,_0x568d17[_0x9a71('0x41')]);return db[_0x9a71('0x42')]['find'](_0x119ecc)[_0x9a71('0x24')](handleEntityNotFound(_0x33650e,null))[_0x9a71('0x24')](respondWithResult(_0x33650e,null))[_0x9a71('0x46')](handleError(_0x33650e,null));};exports[_0x9a71('0x49')]=function(_0x409357,_0xb34a96){return db[_0x9a71('0x42')][_0x9a71('0x49')](_0x409357[_0x9a71('0x4a')],{})[_0x9a71('0x24')](respondWithResult(_0xb34a96,0xc9))['catch'](handleError(_0xb34a96,null));};exports[_0x9a71('0x23')]=function(_0x41016c,_0xe53d5a){if(_0x41016c[_0x9a71('0x4a')]['id']){delete _0x41016c[_0x9a71('0x4a')]['id'];}return db[_0x9a71('0x42')][_0x9a71('0x4b')]({'where':{'id':_0x41016c[_0x9a71('0x48')]['id']}})['then'](handleEntityNotFound(_0xe53d5a,null))[_0x9a71('0x24')](saveUpdates(_0x41016c[_0x9a71('0x4a')],null))[_0x9a71('0x24')](respondWithResult(_0xe53d5a,null))[_0x9a71('0x46')](handleError(_0xe53d5a,null));};exports[_0x9a71('0x25')]=function(_0x5a8b04,_0x359e30){return db[_0x9a71('0x42')][_0x9a71('0x4b')]({'where':{'id':_0x5a8b04[_0x9a71('0x48')]['id']}})[_0x9a71('0x24')](handleEntityNotFound(_0x359e30,null))['then'](removeEntity(_0x359e30,null))[_0x9a71('0x46')](handleError(_0x359e30,null));};exports[_0x9a71('0x4c')]=function(_0x1413c3,_0x11f9e0,_0x7faa10){var _0x2f5b90={};var _0x259b2a={};var _0x47260d;var _0x2bea5f;return db[_0x9a71('0x42')][_0x9a71('0x4d')]({'where':{'id':_0x1413c3[_0x9a71('0x48')]['id']}})[_0x9a71('0x24')](handleEntityNotFound(_0x11f9e0,null))[_0x9a71('0x24')](function(_0x5cb81a){if(_0x5cb81a){_0x47260d=_0x5cb81a;_0x259b2a[_0x9a71('0x30')]=_[_0x9a71('0x31')](db[_0x9a71('0x4e')][_0x9a71('0x2c')]);_0x259b2a[_0x9a71('0x33')]=_['keys'](_0x1413c3[_0x9a71('0x33')]);_0x259b2a['filters']=_[_0x9a71('0x32')](_0x259b2a[_0x9a71('0x30')],_0x259b2a[_0x9a71('0x33')]);_0x2f5b90[_0x9a71('0x34')]=_[_0x9a71('0x32')](_0x259b2a[_0x9a71('0x30')],qs[_0x9a71('0x35')](_0x1413c3[_0x9a71('0x33')][_0x9a71('0x35')]));_0x2f5b90['attributes']=_0x2f5b90['attributes']['length']?_0x2f5b90[_0x9a71('0x34')]:_0x259b2a[_0x9a71('0x30')];_0x2f5b90[_0x9a71('0x39')]=qs[_0x9a71('0x3a')](_0x1413c3[_0x9a71('0x33')][_0x9a71('0x3a')]);_0x2f5b90[_0x9a71('0x3e')]=qs[_0x9a71('0x3b')](_[_0x9a71('0x3c')](_0x1413c3['query'],_0x259b2a['filters']));if(_0x1413c3[_0x9a71('0x33')][_0x9a71('0x3d')]){_0x2f5b90[_0x9a71('0x3e')]=_['merge'](_0x2f5b90['where'],{'$or':_[_0x9a71('0x2b')](_0x2f5b90[_0x9a71('0x34')],function(_0x53592b){var _0x2fe23d={};_0x2fe23d[_0x53592b]={'$like':'%'+_0x1413c3['query']['filter']+'%'};return _0x2fe23d;})});}_0x2f5b90=_[_0x9a71('0x3f')]({},_0x2f5b90,_0x1413c3['options']);return _0x47260d[_0x9a71('0x4c')](_0x2f5b90);}})[_0x9a71('0x24')](function(_0x17f554){if(_0x17f554){_0x2bea5f=_0x17f554['length'];if(!_0x1413c3['query'][_0x9a71('0x37')]('nolimit')){_0x2f5b90[_0x9a71('0x1e')]=qs[_0x9a71('0x1e')](_0x1413c3[_0x9a71('0x33')][_0x9a71('0x1e')]);_0x2f5b90['offset']=qs[_0x9a71('0x1d')](_0x1413c3[_0x9a71('0x33')]['offset']);}return _0x47260d[_0x9a71('0x4c')](_0x2f5b90);}})[_0x9a71('0x24')](function(_0x2b660f){if(_0x2b660f){return _0x2b660f?{'count':_0x2bea5f,'rows':_0x2b660f}:null;}})['then'](respondWithResult(_0x11f9e0,null))[_0x9a71('0x46')](handleError(_0x11f9e0,null));};exports[_0x9a71('0x4f')]=function(_0x18a016,_0x49283d,_0x1abad9){if(_0x18a016[_0x9a71('0x4a')]['id']){delete _0x18a016[_0x9a71('0x4a')]['id'];}return db['DeskAccount'][_0x9a71('0x4d')]({'where':{'id':_0x18a016[_0x9a71('0x48')]['id']}})['then'](handleEntityNotFound(_0x49283d,null))['then'](function(_0x30c785){if(_0x30c785){_0x18a016[_0x9a71('0x4a')][_0x9a71('0x50')]=_0x30c785['id'];_0x18a016[_0x9a71('0x4a')][_0x9a71('0x51')]=integrations['getSubjects'](_0x18a016[_0x9a71('0x4a')][_0x9a71('0x52')],_0x18a016['body'][_0x9a71('0x2e')]);_0x18a016['body'][_0x9a71('0x53')]=integrations['getDescriptions'](_0x18a016['body']['channel'],_0x18a016[_0x9a71('0x4a')][_0x9a71('0x2e')]);return db['DeskConfiguration'][_0x9a71('0x49')](_0x18a016[_0x9a71('0x4a')],{'include':[{'model':db['DeskField'],'as':_0x9a71('0x51')},{'model':db[_0x9a71('0x54')],'as':_0x9a71('0x53')}]});}return null;})[_0x9a71('0x24')](respondWithResult(_0x49283d,null))[_0x9a71('0x46')](handleError(_0x49283d,null));};exports[_0x9a71('0x55')]=function(_0x46634e,_0x1c4f3e,_0x501ee1){var _0x15960d=[{'name':'priority','label':_0x9a71('0x56'),'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 _0x2e7ade='';return db[_0x9a71('0x42')][_0x9a71('0x4d')]({'where':{'id':_0x46634e[_0x9a71('0x48')]['id']},'attributes':['id',_0x9a71('0x57'),_0x9a71('0x58'),_0x9a71('0x59'),'password',_0x9a71('0x5a'),_0x9a71('0x5b'),_0x9a71('0x5c'),_0x9a71('0x5d')]})['then'](handleEntityNotFound(_0x1c4f3e,null))[_0x9a71('0x24')](function(_0x96cf59){if(_0x96cf59){_0x2e7ade=_0x96cf59['remoteUri'];var _0x2a696a=_0x2e7ade[_0x9a71('0x5e')](-0x1);if(_0x2a696a==='/'){_0x2e7ade=_0x2e7ade[_0x9a71('0x5f')](0x0,_0x2e7ade[_0x9a71('0x60')](_0x2a696a));}var _0x983e8c={'method':_0x9a71('0x61'),'uri':util['format']('%s/custom_fields',_0x2e7ade),'headers':{'Content-Type':_0x9a71('0x62'),'Accept':_0x9a71('0x62')},'json':!![]};if(_0x96cf59[_0x9a71('0x58')]==='basic'){_0x983e8c[_0x9a71('0x63')][_0x9a71('0x64')]=util[_0x9a71('0x65')]('Basic\x20%s',new Buffer(util[_0x9a71('0x65')](_0x9a71('0x66'),_0x96cf59[_0x9a71('0x59')],_0x96cf59[_0x9a71('0x67')]))['toString'](_0x9a71('0x68')));}return rp(_0x983e8c)[_0x9a71('0x24')](function(_0x4c2a39){return _0x15960d[_0x9a71('0x69')](_['map'](_0x4c2a39[_0x9a71('0x6a')]['entries'],function(_0x45f8e9){return{'id':_0x45f8e9['name'],'name':_0x45f8e9['name'],'type':_0x45f8e9['type'],'active':_0x45f8e9['active'],'label':_0x45f8e9[_0x9a71('0x6b')],'custom':!![]};}));});}})[_0x9a71('0x24')](function(_0x13762e){return{'count':_0x13762e['length'],'rows':_0x13762e};})[_0x9a71('0x24')](respondWithResult(_0x1c4f3e,null))['catch'](function(_0x4bcf63){var _0x5858c7=_0x46634e[_0x9a71('0x33')][_0x9a71('0x6c')]?0x1f4:_0x4bcf63[_0x9a71('0x6d')]||0x1f4;logger[_0x9a71('0x26')](_0x9a71('0x6e'),_0x9a71('0x55'),_0x5858c7,JSON[_0x9a71('0x6f')](_0x4bcf63));delete _0x4bcf63[_0x9a71('0x28')];if(_0x5858c7===0x191){_0x5858c7=0x190;}_0x1c4f3e[_0x9a71('0x18')](_0x5858c7)[_0x9a71('0x29')](_0x46634e['query']['test']?{'message':_0x9a71('0x70'),'statusCode':_0x4bcf63[_0x9a71('0x6d')]}:_0x4bcf63);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 052e7de..df0be7a 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 _0xe6c5=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x2aa147,_0x2d9ec0){var _0x2cf6d5=function(_0x10be7b){while(--_0x10be7b){_0x2aa147['push'](_0x2aa147['shift']());}};_0x2cf6d5(++_0x2d9ec0);}(_0xe6c5,0x168));var _0x5e6c=function(_0x4d6fe9,_0x3d5e99){_0x4d6fe9=_0x4d6fe9-0x0;var _0x131b2a=_0xe6c5[_0x4d6fe9];return _0x131b2a;};'use strict';var _=require(_0x5e6c('0x0'));var util=require('util');var logger=require(_0x5e6c('0x1'))(_0x5e6c('0x2'));var moment=require('moment');var BPromise=require(_0x5e6c('0x3'));var rp=require(_0x5e6c('0x4'));var fs=require('fs');var path=require(_0x5e6c('0x5'));var rimraf=require(_0x5e6c('0x6'));var config=require(_0x5e6c('0x7'));var attributes=require(_0x5e6c('0x8'));var integrations=require(_0x5e6c('0x9'));module[_0x5e6c('0xa')]=function(_0xa07862,_0x1a6c63){return _0xa07862[_0x5e6c('0xb')]('DeskAccount',attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb2c7=['request-promise','path','rimraf','../../components/integrations/configuration','define','int_desk_accounts','lodash','util','../../config/logger','moment','bluebird'];(function(_0x50ac3d,_0x91329c){var _0x1a8799=function(_0x2ee953){while(--_0x2ee953){_0x50ac3d['push'](_0x50ac3d['shift']());}};_0x1a8799(++_0x91329c);}(_0xb2c7,0x103));var _0x7b2c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xb2c7[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x7b2c('0x0'));var util=require(_0x7b2c('0x1'));var logger=require(_0x7b2c('0x2'))('api');var moment=require(_0x7b2c('0x3'));var BPromise=require(_0x7b2c('0x4'));var rp=require(_0x7b2c('0x5'));var fs=require('fs');var path=require(_0x7b2c('0x6'));var rimraf=require(_0x7b2c('0x7'));var config=require('../../config/environment');var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x7b2c('0x8'));module['exports']=function(_0x3c98bf,_0x4943b7){return _0x3c98bf[_0x7b2c('0x9')]('DeskAccount',attributes,{'tableName':_0x7b2c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 384c53d..ab2d30e 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 _0xe644=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','request\x20sent','debug','stringify','code','error','message','DeskAccount,\x20%s,\x20%s','info','result','GetDeskAccount','DeskAccount','findAll','options','attributes','limit','include','map','model','then','catch','ShowDeskAccount','find','raw','where','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x4c19ca,_0xce72af){var _0x42b66a=function(_0x2d5909){while(--_0x2d5909){_0x4c19ca['push'](_0x4c19ca['shift']());}};_0x42b66a(++_0xce72af);}(_0xe644,0x104));var _0x4e64=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe644[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4e64('0x0'));var util=require(_0x4e64('0x1'));var moment=require(_0x4e64('0x2'));var BPromise=require(_0x4e64('0x3'));var rs=require(_0x4e64('0x4'));var fs=require('fs');var Redis=require(_0x4e64('0x5'));var db=require(_0x4e64('0x6'))['db'];var utils=require(_0x4e64('0x7'));var logger=require(_0x4e64('0x8'))(_0x4e64('0x9'));var config=require(_0x4e64('0xa'));var jayson=require(_0x4e64('0xb'));var client=jayson['client'][_0x4e64('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x11f91f,_0x5ab39f,_0x3e6475){return new BPromise(function(_0x22f4a6,_0x3335f1){return client[_0x4e64('0xd')](_0x11f91f,_0x3e6475)['then'](function(_0x33c10b){logger['info']('DeskAccount,\x20%s,\x20%s',_0x5ab39f,_0x4e64('0xe'));logger[_0x4e64('0xf')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x5ab39f,_0x4e64('0xe'),JSON[_0x4e64('0x10')](_0x33c10b));if(_0x33c10b['error']){if(_0x33c10b['error'][_0x4e64('0x11')]===0x1f4){logger[_0x4e64('0x12')]('DeskAccount,\x20%s,\x20%s',_0x5ab39f,_0x33c10b[_0x4e64('0x12')][_0x4e64('0x13')]);return _0x3335f1(_0x33c10b[_0x4e64('0x12')][_0x4e64('0x13')]);}logger['error'](_0x4e64('0x14'),_0x5ab39f,_0x33c10b[_0x4e64('0x12')][_0x4e64('0x13')]);return _0x22f4a6(_0x33c10b[_0x4e64('0x12')][_0x4e64('0x13')]);}else{logger[_0x4e64('0x15')](_0x4e64('0x14'),_0x5ab39f,_0x4e64('0xe'));_0x22f4a6(_0x33c10b[_0x4e64('0x16')][_0x4e64('0x13')]);}})['catch'](function(_0x4dd60d){logger[_0x4e64('0x12')]('DeskAccount,\x20%s,\x20%s',_0x5ab39f,_0x4dd60d);_0x3335f1(_0x4dd60d);});});}exports[_0x4e64('0x17')]=function(_0x442502){var _0x4ced50=this;return new Promise(function(_0x5ae549,_0x44840b){return db[_0x4e64('0x18')][_0x4e64('0x19')]({'raw':_0x442502[_0x4e64('0x1a')]?_0x442502['options']['raw']===undefined?!![]:![]:!![],'where':_0x442502[_0x4e64('0x1a')]?_0x442502[_0x4e64('0x1a')]['where']||null:null,'attributes':_0x442502[_0x4e64('0x1a')]?_0x442502[_0x4e64('0x1a')][_0x4e64('0x1b')]||null:null,'limit':_0x442502[_0x4e64('0x1a')]?_0x442502['options'][_0x4e64('0x1c')]||null:null,'include':_0x442502[_0x4e64('0x1a')]?_0x442502['options'][_0x4e64('0x1d')]?_[_0x4e64('0x1e')](_0x442502[_0x4e64('0x1a')][_0x4e64('0x1d')],function(_0x243a2a){return{'model':db[_0x243a2a[_0x4e64('0x1f')]],'as':_0x243a2a['as'],'attributes':_0x243a2a[_0x4e64('0x1b')],'include':_0x243a2a[_0x4e64('0x1d')]?_[_0x4e64('0x1e')](_0x243a2a['include'],function(_0x2dda65){return{'model':db[_0x2dda65[_0x4e64('0x1f')]],'as':_0x2dda65['as'],'attributes':_0x2dda65['attributes'],'include':_0x2dda65[_0x4e64('0x1d')]?_[_0x4e64('0x1e')](_0x2dda65[_0x4e64('0x1d')],function(_0x575c1b){return{'model':db[_0x575c1b[_0x4e64('0x1f')]],'as':_0x575c1b['as'],'attributes':_0x575c1b[_0x4e64('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4e64('0x20')](function(_0x3f7cd3){logger[_0x4e64('0x15')](_0x4e64('0x17'),_0x442502);logger[_0x4e64('0xf')](_0x4e64('0x17'),_0x442502,JSON[_0x4e64('0x10')](_0x3f7cd3));_0x5ae549(_0x3f7cd3);})[_0x4e64('0x21')](function(_0x171d21){logger['error'](_0x4e64('0x17'),_0x171d21[_0x4e64('0x13')],_0x442502);_0x44840b(_0x4ced50['error'](0x1f4,_0x171d21[_0x4e64('0x13')]));});});};exports[_0x4e64('0x22')]=function(_0x4ee410){var _0x3ecd17=this;return new Promise(function(_0x3cc51b,_0x220440){return db[_0x4e64('0x18')][_0x4e64('0x23')]({'raw':_0x4ee410[_0x4e64('0x1a')]?_0x4ee410['options'][_0x4e64('0x24')]===undefined?!![]:![]:!![],'where':_0x4ee410[_0x4e64('0x1a')]?_0x4ee410['options'][_0x4e64('0x25')]||null:null,'attributes':_0x4ee410[_0x4e64('0x1a')]?_0x4ee410[_0x4e64('0x1a')][_0x4e64('0x1b')]||null:null,'include':_0x4ee410[_0x4e64('0x1a')]?_0x4ee410[_0x4e64('0x1a')][_0x4e64('0x1d')]?_['map'](_0x4ee410[_0x4e64('0x1a')]['include'],function(_0x4a4bd5){return{'model':db[_0x4a4bd5[_0x4e64('0x1f')]],'as':_0x4a4bd5['as'],'attributes':_0x4a4bd5[_0x4e64('0x1b')],'include':_0x4a4bd5[_0x4e64('0x1d')]?_[_0x4e64('0x1e')](_0x4a4bd5[_0x4e64('0x1d')],function(_0x295732){return{'model':db[_0x295732[_0x4e64('0x1f')]],'as':_0x295732['as'],'attributes':_0x295732['attributes'],'include':_0x295732[_0x4e64('0x1d')]?_['map'](_0x295732[_0x4e64('0x1d')],function(_0x3c2f9e){return{'model':db[_0x3c2f9e[_0x4e64('0x1f')]],'as':_0x3c2f9e['as'],'attributes':_0x3c2f9e[_0x4e64('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4e64('0x20')](function(_0x2bcf61){logger[_0x4e64('0x15')]('ShowDeskAccount',_0x4ee410);logger[_0x4e64('0xf')](_0x4e64('0x22'),_0x4ee410,JSON[_0x4e64('0x10')](_0x2bcf61));_0x3cc51b(_0x2bcf61);})[_0x4e64('0x21')](function(_0x306d63){logger[_0x4e64('0x12')]('ShowDeskAccount',_0x306d63[_0x4e64('0x13')],_0x4ee410);_0x220440(_0x3ecd17[_0x4e64('0x12')](0x1f4,_0x306d63['message']));});});}; \ No newline at end of file +var _0xf967=['limit','include','map','attributes','model','catch','ShowDeskAccount','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','DeskAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','GetDeskAccount','DeskAccount','options','raw'];(function(_0x1ca888,_0x469f24){var _0x295902=function(_0x5da22b){while(--_0x5da22b){_0x1ca888['push'](_0x1ca888['shift']());}};_0x295902(++_0x469f24);}(_0xf967,0x153));var _0x7f96=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xf967[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x7f96('0x0'));var util=require(_0x7f96('0x1'));var moment=require(_0x7f96('0x2'));var BPromise=require(_0x7f96('0x3'));var rs=require(_0x7f96('0x4'));var fs=require('fs');var Redis=require(_0x7f96('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7f96('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x7f96('0x7'));var jayson=require(_0x7f96('0x8'));var client=jayson['client'][_0x7f96('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x517308,_0x5e7938,_0x2b6c2d){return new BPromise(function(_0x16341e,_0x3b97ad){return client[_0x7f96('0xa')](_0x517308,_0x2b6c2d)[_0x7f96('0xb')](function(_0x2cc546){logger[_0x7f96('0xc')](_0x7f96('0xd'),_0x5e7938,'request\x20sent');logger[_0x7f96('0xe')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x5e7938,_0x7f96('0xf'),JSON[_0x7f96('0x10')](_0x2cc546));if(_0x2cc546['error']){if(_0x2cc546[_0x7f96('0x11')][_0x7f96('0x12')]===0x1f4){logger['error'](_0x7f96('0xd'),_0x5e7938,_0x2cc546[_0x7f96('0x11')][_0x7f96('0x13')]);return _0x3b97ad(_0x2cc546['error'][_0x7f96('0x13')]);}logger[_0x7f96('0x11')](_0x7f96('0xd'),_0x5e7938,_0x2cc546[_0x7f96('0x11')][_0x7f96('0x13')]);return _0x16341e(_0x2cc546['error']['message']);}else{logger[_0x7f96('0xc')](_0x7f96('0xd'),_0x5e7938,_0x7f96('0xf'));_0x16341e(_0x2cc546['result'][_0x7f96('0x13')]);}})['catch'](function(_0x3f2f3f){logger[_0x7f96('0x11')]('DeskAccount,\x20%s,\x20%s',_0x5e7938,_0x3f2f3f);_0x3b97ad(_0x3f2f3f);});});}exports[_0x7f96('0x14')]=function(_0x270b56){var _0x2b6718=this;return new Promise(function(_0x1a6c3c,_0x2c862d){return db[_0x7f96('0x15')]['findAll']({'raw':_0x270b56['options']?_0x270b56[_0x7f96('0x16')][_0x7f96('0x17')]===undefined?!![]:![]:!![],'where':_0x270b56[_0x7f96('0x16')]?_0x270b56['options']['where']||null:null,'attributes':_0x270b56[_0x7f96('0x16')]?_0x270b56[_0x7f96('0x16')]['attributes']||null:null,'limit':_0x270b56[_0x7f96('0x16')]?_0x270b56[_0x7f96('0x16')][_0x7f96('0x18')]||null:null,'include':_0x270b56['options']?_0x270b56[_0x7f96('0x16')][_0x7f96('0x19')]?_[_0x7f96('0x1a')](_0x270b56[_0x7f96('0x16')]['include'],function(_0x14930d){return{'model':db[_0x14930d['model']],'as':_0x14930d['as'],'attributes':_0x14930d[_0x7f96('0x1b')],'include':_0x14930d['include']?_[_0x7f96('0x1a')](_0x14930d[_0x7f96('0x19')],function(_0x592185){return{'model':db[_0x592185[_0x7f96('0x1c')]],'as':_0x592185['as'],'attributes':_0x592185['attributes'],'include':_0x592185[_0x7f96('0x19')]?_['map'](_0x592185[_0x7f96('0x19')],function(_0x340109){return{'model':db[_0x340109[_0x7f96('0x1c')]],'as':_0x340109['as'],'attributes':_0x340109['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x37d31c){logger[_0x7f96('0xc')](_0x7f96('0x14'),_0x270b56);logger['debug'](_0x7f96('0x14'),_0x270b56,JSON['stringify'](_0x37d31c));_0x1a6c3c(_0x37d31c);})[_0x7f96('0x1d')](function(_0x1b7755){logger['error'](_0x7f96('0x14'),_0x1b7755[_0x7f96('0x13')],_0x270b56);_0x2c862d(_0x2b6718[_0x7f96('0x11')](0x1f4,_0x1b7755['message']));});});};exports[_0x7f96('0x1e')]=function(_0x9838e7){var _0x564786=this;return new Promise(function(_0x5ce74e,_0x1fec1c){return db['DeskAccount'][_0x7f96('0x1f')]({'raw':_0x9838e7[_0x7f96('0x16')]?_0x9838e7[_0x7f96('0x16')][_0x7f96('0x17')]===undefined?!![]:![]:!![],'where':_0x9838e7[_0x7f96('0x16')]?_0x9838e7[_0x7f96('0x16')][_0x7f96('0x20')]||null:null,'attributes':_0x9838e7[_0x7f96('0x16')]?_0x9838e7[_0x7f96('0x16')][_0x7f96('0x1b')]||null:null,'include':_0x9838e7['options']?_0x9838e7[_0x7f96('0x16')][_0x7f96('0x19')]?_[_0x7f96('0x1a')](_0x9838e7[_0x7f96('0x16')][_0x7f96('0x19')],function(_0x17d1a5){return{'model':db[_0x17d1a5['model']],'as':_0x17d1a5['as'],'attributes':_0x17d1a5[_0x7f96('0x1b')],'include':_0x17d1a5[_0x7f96('0x19')]?_[_0x7f96('0x1a')](_0x17d1a5[_0x7f96('0x19')],function(_0x5a7a3d){return{'model':db[_0x5a7a3d['model']],'as':_0x5a7a3d['as'],'attributes':_0x5a7a3d['attributes'],'include':_0x5a7a3d[_0x7f96('0x19')]?_[_0x7f96('0x1a')](_0x5a7a3d[_0x7f96('0x19')],function(_0x122018){return{'model':db[_0x122018[_0x7f96('0x1c')]],'as':_0x122018['as'],'attributes':_0x122018['attributes']};}):[]};}):[]};}):[]:[]})[_0x7f96('0xb')](function(_0x4c9ec3){logger[_0x7f96('0xc')](_0x7f96('0x1e'),_0x9838e7);logger['debug'](_0x7f96('0x1e'),_0x9838e7,JSON[_0x7f96('0x10')](_0x4c9ec3));_0x5ce74e(_0x4c9ec3);})[_0x7f96('0x1d')](function(_0x10d32e){logger[_0x7f96('0x11')](_0x7f96('0x1e'),_0x10d32e[_0x7f96('0x13')],_0x9838e7);_0x1fec1c(_0x564786[_0x7f96('0x11')](0x1f4,_0x10d32e[_0x7f96('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index a59c991..6e59a7c 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(_0xdbf4d0,_0xde309b){var _0x1d5450=function(_0x3a4577){while(--_0x3a4577){_0xdbf4d0['push'](_0xdbf4d0['shift']());}};_0x1d5450(++_0xde309b);}(_0x008c,0x188));var _0xc008=function(_0x455161,_0x520f10){_0x455161=_0x455161-0x0;var _0x3e7c03=_0x008c[_0x455161];return _0x3e7c03;};'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 _0x34e8=['../../config/environment','./intDeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x475683,_0x1c733b){var _0x30144d=function(_0x3eb70d){while(--_0x3eb70d){_0x475683['push'](_0x475683['shift']());}};_0x30144d(++_0x1c733b);}(_0x34e8,0x12c));var _0x834e=function(_0x3c2d03,_0x5f2a81){_0x3c2d03=_0x3c2d03-0x0;var _0x4af0cc=_0x34e8[_0x3c2d03];return _0x4af0cc;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xa')](_0x834e('0xf'),auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0xa')](_0x834e('0x11'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0xa')](_0x834e('0x13'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);router[_0x834e('0xa')](_0x834e('0x15'),auth['isAuthenticated'](),controller[_0x834e('0x16')]);router[_0x834e('0x17')]('/',auth['isAuthenticated'](),controller[_0x834e('0x18')]);router[_0x834e('0x17')](_0x834e('0x15'),auth[_0x834e('0xd')](),controller['setTags']);router[_0x834e('0x19')](_0x834e('0xc'),auth['isAuthenticated'](),controller[_0x834e('0x1a')]);router['delete'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller['destroy']);module[_0x834e('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index ddc210e..ef2e757 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 _0x59d2=['exports','STRING','sequelize'];(function(_0x468c03,_0x190103){var _0x5b12ba=function(_0xcc8da0){while(--_0xcc8da0){_0x468c03['push'](_0x468c03['shift']());}};_0x5b12ba(++_0x190103);}(_0x59d2,0x77));var _0x259d=function(_0x26b8b5,_0xf5c2c1){_0x26b8b5=_0x26b8b5-0x0;var _0x2150a9=_0x59d2[_0x26b8b5];return _0x2150a9;};'use strict';var Sequelize=require(_0x259d('0x0'));module[_0x259d('0x1')]={'name':{'type':Sequelize[_0x259d('0x2')]},'description':{'type':Sequelize[_0x259d('0x2')]}}; \ No newline at end of file +var _0x1799=['sequelize','exports','STRING'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x1799,0x7b));var _0x9179=function(_0x4869ab,_0x31c2bf){_0x4869ab=_0x4869ab-0x0;var _0x2c9f65=_0x1799[_0x4869ab];return _0x2c9f65;};'use strict';var Sequelize=require(_0x9179('0x0'));module[_0x9179('0x1')]={'name':{'type':Sequelize[_0x9179('0x2')]},'description':{'type':Sequelize[_0x9179('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index f06b927..633129e 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 _0xcac8=['intersection','attributes','fields','length','nolimit','sort','filters','where','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','getFields','findOne','DeskField','order','hasOwnProperty','getSubjects','getDescriptions','pick','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','DeskConfiguration','fieldName','type','key','model','query','keys'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0xcac8,0x1f0));var _0x8cac=function(_0x526cf2,_0x13387e){_0x526cf2=_0x526cf2-0x0;var _0x5afdf1=_0xcac8[_0x526cf2];return _0x5afdf1;};'use strict';var emlformat=require(_0x8cac('0x0'));var rimraf=require(_0x8cac('0x1'));var zipdir=require(_0x8cac('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8cac('0x3'));var BPromise=require(_0x8cac('0x4'));var Mustache=require(_0x8cac('0x5'));var util=require(_0x8cac('0x6'));var path=require(_0x8cac('0x7'));var sox=require(_0x8cac('0x8'));var csv=require(_0x8cac('0x9'));var ejs=require(_0x8cac('0xa'));var fs=require('fs');var fs_extra=require(_0x8cac('0xb'));var _=require(_0x8cac('0xc'));var squel=require(_0x8cac('0xd'));var crypto=require(_0x8cac('0xe'));var jsforce=require(_0x8cac('0xf'));var deskjs=require(_0x8cac('0x10'));var toCsv=require(_0x8cac('0x9'));var querystring=require(_0x8cac('0x11'));var Papa=require(_0x8cac('0x12'));var Redis=require(_0x8cac('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x8cac('0x14'));var as=require(_0x8cac('0x15'));var hardwareService=require(_0x8cac('0x16'));var logger=require(_0x8cac('0x17'))(_0x8cac('0x18'));var utils=require(_0x8cac('0x19'));var config=require(_0x8cac('0x1a'));var licenseUtil=require(_0x8cac('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x184dd7,_0x1338de){_0x1338de=_0x1338de||0xcc;return function(_0xa5ae3f){if(_0xa5ae3f){return _0x184dd7[_0x8cac('0x1c')](_0x1338de);}return _0x184dd7[_0x8cac('0x1d')](_0x1338de)[_0x8cac('0x1e')]();};}function respondWithResult(_0x48c233,_0x29a8ee){_0x29a8ee=_0x29a8ee||0xc8;return function(_0x5e15c7){if(_0x5e15c7){return _0x48c233[_0x8cac('0x1d')](_0x29a8ee)['json'](_0x5e15c7);}};}function respondWithFilteredResult(_0x87c446,_0x1eec14){return function(_0x1930f8){if(_0x1930f8){var _0x14c157=typeof _0x1eec14[_0x8cac('0x1f')]===_0x8cac('0x20')&&typeof _0x1eec14[_0x8cac('0x21')]===_0x8cac('0x20');var _0x428493=_0x1930f8['count'];var _0x3186fa=_0x14c157?0x0:_0x1eec14[_0x8cac('0x1f')];var _0x1f569c=_0x14c157?_0x1930f8['count']:_0x1eec14[_0x8cac('0x1f')]+_0x1eec14[_0x8cac('0x21')];var _0x18ff56;if(_0x1f569c>=_0x428493){_0x1f569c=_0x428493;_0x18ff56=0xc8;}else{_0x18ff56=0xce;}_0x87c446[_0x8cac('0x1d')](_0x18ff56);return _0x87c446[_0x8cac('0x22')](_0x8cac('0x23'),_0x3186fa+'-'+_0x1f569c+'/'+_0x428493)[_0x8cac('0x24')](_0x1930f8);}return null;};}function patchUpdates(_0x143812){return function(_0x39a924){try{jsonpatch[_0x8cac('0x25')](_0x39a924,_0x143812,!![]);}catch(_0x288781){return BPromise[_0x8cac('0x26')](_0x288781);}return _0x39a924[_0x8cac('0x27')]();};}function saveUpdates(_0x58dbd8,_0x13ae4c){return function(_0x160cb8){if(_0x160cb8){return _0x160cb8[_0x8cac('0x28')](_0x58dbd8)[_0x8cac('0x29')](function(_0x159244){return _0x159244;});}return null;};}function removeEntity(_0x46a4f0,_0x450329){return function(_0x1b2ad4){if(_0x1b2ad4){return _0x1b2ad4[_0x8cac('0x2a')]()['then'](function(){_0x46a4f0[_0x8cac('0x1d')](0xcc)[_0x8cac('0x1e')]();});}};}function handleEntityNotFound(_0x553899,_0x434e09){return function(_0x52e06b){if(!_0x52e06b){_0x553899[_0x8cac('0x1c')](0x194);}return _0x52e06b;};}function handleError(_0x364c61,_0x3bb9f7){_0x3bb9f7=_0x3bb9f7||0x1f4;return function(_0x4fc526){logger[_0x8cac('0x2b')](_0x4fc526[_0x8cac('0x2c')]);if(_0x4fc526[_0x8cac('0x2d')]){delete _0x4fc526[_0x8cac('0x2d')];}_0x364c61[_0x8cac('0x1d')](_0x3bb9f7)[_0x8cac('0x2e')](_0x4fc526);};}exports[_0x8cac('0x2f')]=function(_0x5125cb,_0x1766a0){var _0x219791={},_0x285c7f={},_0x4ea435={'count':0x0,'rows':[]};var _0x2b95dd=_[_0x8cac('0x30')](db[_0x8cac('0x31')]['rawAttributes'],function(_0x58442b){return{'name':_0x58442b[_0x8cac('0x32')],'type':_0x58442b[_0x8cac('0x33')][_0x8cac('0x34')]};});_0x285c7f[_0x8cac('0x35')]=_['map'](_0x2b95dd,'name');_0x285c7f[_0x8cac('0x36')]=_[_0x8cac('0x37')](_0x5125cb['query']);_0x285c7f['filters']=_[_0x8cac('0x38')](_0x285c7f['model'],_0x285c7f['query']);_0x219791[_0x8cac('0x39')]=_[_0x8cac('0x38')](_0x285c7f[_0x8cac('0x35')],qs[_0x8cac('0x3a')](_0x5125cb[_0x8cac('0x36')][_0x8cac('0x3a')]));_0x219791[_0x8cac('0x39')]=_0x219791[_0x8cac('0x39')][_0x8cac('0x3b')]?_0x219791['attributes']:_0x285c7f['model'];if(!_0x5125cb[_0x8cac('0x36')]['hasOwnProperty'](_0x8cac('0x3c'))){_0x219791[_0x8cac('0x21')]=qs[_0x8cac('0x21')](_0x5125cb[_0x8cac('0x36')][_0x8cac('0x21')]);_0x219791[_0x8cac('0x1f')]=qs[_0x8cac('0x1f')](_0x5125cb[_0x8cac('0x36')][_0x8cac('0x1f')]);}_0x219791['order']=qs[_0x8cac('0x3d')](_0x5125cb[_0x8cac('0x36')][_0x8cac('0x3d')]);_0x219791['where']=qs[_0x8cac('0x3e')](_['pick'](_0x5125cb['query'],_0x285c7f[_0x8cac('0x3e')]),_0x2b95dd);if(_0x5125cb[_0x8cac('0x36')]['filter']){_0x219791[_0x8cac('0x3f')]=_[_0x8cac('0x40')](_0x219791[_0x8cac('0x3f')],{'$or':_['map'](_0x2b95dd,function(_0x30c561){if(_0x30c561[_0x8cac('0x33')]!==_0x8cac('0x41')){var _0x5bd05c={};_0x5bd05c[_0x30c561[_0x8cac('0x2d')]]={'$like':'%'+_0x5125cb[_0x8cac('0x36')][_0x8cac('0x42')]+'%'};return _0x5bd05c;}})});}_0x219791=_[_0x8cac('0x40')]({},_0x219791,_0x5125cb[_0x8cac('0x43')]);var _0x50f414={'where':_0x219791[_0x8cac('0x3f')]};return db[_0x8cac('0x31')]['count'](_0x50f414)[_0x8cac('0x29')](function(_0x248969){_0x4ea435[_0x8cac('0x44')]=_0x248969;if(_0x5125cb['query'][_0x8cac('0x45')]){_0x219791[_0x8cac('0x46')]=[{'all':!![]}];}return db[_0x8cac('0x31')][_0x8cac('0x47')](_0x219791);})[_0x8cac('0x29')](function(_0x47d302){_0x4ea435[_0x8cac('0x48')]=_0x47d302;return _0x4ea435;})['then'](respondWithFilteredResult(_0x1766a0,_0x219791))[_0x8cac('0x49')](handleError(_0x1766a0,null));};exports[_0x8cac('0x4a')]=function(_0x376227,_0x3c62b8){var _0x1bb305={'raw':![],'where':{'id':_0x376227[_0x8cac('0x4b')]['id']}},_0x12ef5f={};_0x12ef5f[_0x8cac('0x35')]=_['keys'](db['DeskConfiguration'][_0x8cac('0x4c')]);_0x12ef5f[_0x8cac('0x36')]=_[_0x8cac('0x37')](_0x376227['query']);_0x12ef5f[_0x8cac('0x3e')]=_[_0x8cac('0x38')](_0x12ef5f[_0x8cac('0x35')],_0x12ef5f[_0x8cac('0x36')]);_0x1bb305[_0x8cac('0x39')]=_['intersection'](_0x12ef5f[_0x8cac('0x35')],qs['fields'](_0x376227[_0x8cac('0x36')][_0x8cac('0x3a')]));_0x1bb305['attributes']=_0x1bb305[_0x8cac('0x39')][_0x8cac('0x3b')]?_0x1bb305[_0x8cac('0x39')]:_0x12ef5f['model'];if(_0x376227[_0x8cac('0x36')][_0x8cac('0x45')]){_0x1bb305[_0x8cac('0x46')]=[{'all':!![]}];}_0x1bb305=_[_0x8cac('0x40')]({},_0x1bb305,_0x376227['options']);return db[_0x8cac('0x31')][_0x8cac('0x4d')](_0x1bb305)['then'](handleEntityNotFound(_0x3c62b8,null))[_0x8cac('0x29')](respondWithResult(_0x3c62b8,null))[_0x8cac('0x49')](handleError(_0x3c62b8,null));};exports[_0x8cac('0x4e')]=function(_0x380591,_0xe61517){return db[_0x8cac('0x31')][_0x8cac('0x4e')](_0x380591['body'],{})[_0x8cac('0x29')](respondWithResult(_0xe61517,0xc9))['catch'](handleError(_0xe61517,null));};exports[_0x8cac('0x28')]=function(_0x1b2473,_0x27cee8){if(_0x1b2473[_0x8cac('0x4f')]['id']){delete _0x1b2473[_0x8cac('0x4f')]['id'];}return db[_0x8cac('0x31')]['find']({'where':{'id':_0x1b2473['params']['id']}})[_0x8cac('0x29')](handleEntityNotFound(_0x27cee8,null))[_0x8cac('0x29')](saveUpdates(_0x1b2473[_0x8cac('0x4f')],null))[_0x8cac('0x29')](respondWithResult(_0x27cee8,null))[_0x8cac('0x49')](handleError(_0x27cee8,null));};exports['destroy']=function(_0x207b9f,_0x584cad){return db[_0x8cac('0x31')]['find']({'where':{'id':_0x207b9f[_0x8cac('0x4b')]['id']}})[_0x8cac('0x29')](handleEntityNotFound(_0x584cad,null))['then'](removeEntity(_0x584cad,null))[_0x8cac('0x49')](handleError(_0x584cad,null));};exports[_0x8cac('0x50')]=function(_0x4c7699,_0x1015b4,_0x3ec8d0){var _0x3c4fd4={};var _0x3ea7dd={};var _0x11a977;var _0x16d9a3;return db[_0x8cac('0x31')][_0x8cac('0x51')]({'where':{'id':_0x4c7699[_0x8cac('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1015b4,null))[_0x8cac('0x29')](function(_0xd073){if(_0xd073){_0x11a977=_0xd073;_0x3ea7dd[_0x8cac('0x35')]=_[_0x8cac('0x37')](db[_0x8cac('0x52')]['rawAttributes']);_0x3ea7dd[_0x8cac('0x36')]=_['keys'](_0x4c7699['query']);_0x3ea7dd[_0x8cac('0x3e')]=_[_0x8cac('0x38')](_0x3ea7dd[_0x8cac('0x35')],_0x3ea7dd[_0x8cac('0x36')]);_0x3c4fd4[_0x8cac('0x39')]=_[_0x8cac('0x38')](_0x3ea7dd['model'],qs[_0x8cac('0x3a')](_0x4c7699[_0x8cac('0x36')][_0x8cac('0x3a')]));_0x3c4fd4['attributes']=_0x3c4fd4[_0x8cac('0x39')]['length']?_0x3c4fd4[_0x8cac('0x39')]:_0x3ea7dd['model'];_0x3c4fd4[_0x8cac('0x53')]=qs[_0x8cac('0x3d')](_0x4c7699['query'][_0x8cac('0x3d')]);_0x3c4fd4[_0x8cac('0x3f')]=qs['filters'](_['pick'](_0x4c7699[_0x8cac('0x36')],_0x3ea7dd[_0x8cac('0x3e')]));if(_0x4c7699['query'][_0x8cac('0x42')]){_0x3c4fd4[_0x8cac('0x3f')]=_[_0x8cac('0x40')](_0x3c4fd4['where'],{'$or':_[_0x8cac('0x30')](_0x3c4fd4[_0x8cac('0x39')],function(_0x208858){var _0x20facf={};_0x20facf[_0x208858]={'$like':'%'+_0x4c7699[_0x8cac('0x36')][_0x8cac('0x42')]+'%'};return _0x20facf;})});}_0x3c4fd4=_['merge']({},_0x3c4fd4,_0x4c7699[_0x8cac('0x43')]);return _0x11a977[_0x8cac('0x50')](_0x3c4fd4);}})[_0x8cac('0x29')](function(_0xe20550){if(_0xe20550){_0x16d9a3=_0xe20550[_0x8cac('0x3b')];if(!_0x4c7699[_0x8cac('0x36')][_0x8cac('0x54')](_0x8cac('0x3c'))){_0x3c4fd4[_0x8cac('0x21')]=qs[_0x8cac('0x21')](_0x4c7699[_0x8cac('0x36')][_0x8cac('0x21')]);_0x3c4fd4['offset']=qs['offset'](_0x4c7699[_0x8cac('0x36')][_0x8cac('0x1f')]);}return _0x11a977[_0x8cac('0x50')](_0x3c4fd4);}})[_0x8cac('0x29')](function(_0x2b28e2){if(_0x2b28e2){return _0x2b28e2?{'count':_0x16d9a3,'rows':_0x2b28e2}:null;}})[_0x8cac('0x29')](respondWithResult(_0x1015b4,null))[_0x8cac('0x49')](handleError(_0x1015b4,null));};exports[_0x8cac('0x55')]=function(_0x50ce5c,_0x39af5b,_0x2cd0ad){var _0x4e651a={};var _0x3e2314={};var _0xee2761;var _0x5f1da4;return db['DeskConfiguration'][_0x8cac('0x51')]({'where':{'id':_0x50ce5c[_0x8cac('0x4b')]['id']}})['then'](handleEntityNotFound(_0x39af5b,null))['then'](function(_0x1404f8){if(_0x1404f8){_0xee2761=_0x1404f8;_0x3e2314[_0x8cac('0x35')]=_['keys'](db[_0x8cac('0x52')][_0x8cac('0x4c')]);_0x3e2314[_0x8cac('0x36')]=_['keys'](_0x50ce5c['query']);_0x3e2314[_0x8cac('0x3e')]=_['intersection'](_0x3e2314[_0x8cac('0x35')],_0x3e2314['query']);_0x4e651a['attributes']=_[_0x8cac('0x38')](_0x3e2314[_0x8cac('0x35')],qs[_0x8cac('0x3a')](_0x50ce5c[_0x8cac('0x36')][_0x8cac('0x3a')]));_0x4e651a[_0x8cac('0x39')]=_0x4e651a['attributes'][_0x8cac('0x3b')]?_0x4e651a[_0x8cac('0x39')]:_0x3e2314['model'];_0x4e651a[_0x8cac('0x53')]=qs['sort'](_0x50ce5c[_0x8cac('0x36')][_0x8cac('0x3d')]);_0x4e651a['where']=qs[_0x8cac('0x3e')](_['pick'](_0x50ce5c[_0x8cac('0x36')],_0x3e2314[_0x8cac('0x3e')]));if(_0x50ce5c[_0x8cac('0x36')]['filter']){_0x4e651a[_0x8cac('0x3f')]=_['merge'](_0x4e651a[_0x8cac('0x3f')],{'$or':_[_0x8cac('0x30')](_0x4e651a[_0x8cac('0x39')],function(_0x40057e){var _0x1f4b67={};_0x1f4b67[_0x40057e]={'$like':'%'+_0x50ce5c[_0x8cac('0x36')][_0x8cac('0x42')]+'%'};return _0x1f4b67;})});}_0x4e651a=_[_0x8cac('0x40')]({},_0x4e651a,_0x50ce5c[_0x8cac('0x43')]);return _0xee2761[_0x8cac('0x55')](_0x4e651a);}})[_0x8cac('0x29')](function(_0x4fb3cf){if(_0x4fb3cf){_0x5f1da4=_0x4fb3cf[_0x8cac('0x3b')];if(!_0x50ce5c[_0x8cac('0x36')][_0x8cac('0x54')](_0x8cac('0x3c'))){_0x4e651a[_0x8cac('0x21')]=qs[_0x8cac('0x21')](_0x50ce5c['query']['limit']);_0x4e651a[_0x8cac('0x1f')]=qs[_0x8cac('0x1f')](_0x50ce5c[_0x8cac('0x36')][_0x8cac('0x1f')]);}return _0xee2761[_0x8cac('0x55')](_0x4e651a);}})[_0x8cac('0x29')](function(_0xfb4287){if(_0xfb4287){return _0xfb4287?{'count':_0x5f1da4,'rows':_0xfb4287}:null;}})[_0x8cac('0x29')](respondWithResult(_0x39af5b,null))['catch'](handleError(_0x39af5b,null));};exports[_0x8cac('0x56')]=function(_0x4c251e,_0x15da57,_0x3f7275){var _0x519aba={};var _0x25bdcd={};var _0x2fe76a;var _0x35d91e;return db[_0x8cac('0x31')][_0x8cac('0x51')]({'where':{'id':_0x4c251e[_0x8cac('0x4b')]['id']}})[_0x8cac('0x29')](handleEntityNotFound(_0x15da57,null))[_0x8cac('0x29')](function(_0x1d2394){if(_0x1d2394){_0x2fe76a=_0x1d2394;_0x25bdcd[_0x8cac('0x35')]=_[_0x8cac('0x37')](db[_0x8cac('0x52')]['rawAttributes']);_0x25bdcd[_0x8cac('0x36')]=_[_0x8cac('0x37')](_0x4c251e[_0x8cac('0x36')]);_0x25bdcd[_0x8cac('0x3e')]=_[_0x8cac('0x38')](_0x25bdcd['model'],_0x25bdcd[_0x8cac('0x36')]);_0x519aba[_0x8cac('0x39')]=_[_0x8cac('0x38')](_0x25bdcd[_0x8cac('0x35')],qs['fields'](_0x4c251e['query']['fields']));_0x519aba[_0x8cac('0x39')]=_0x519aba['attributes']['length']?_0x519aba[_0x8cac('0x39')]:_0x25bdcd[_0x8cac('0x35')];_0x519aba[_0x8cac('0x53')]=qs['sort'](_0x4c251e[_0x8cac('0x36')][_0x8cac('0x3d')]);_0x519aba[_0x8cac('0x3f')]=qs[_0x8cac('0x3e')](_[_0x8cac('0x57')](_0x4c251e['query'],_0x25bdcd['filters']));if(_0x4c251e[_0x8cac('0x36')][_0x8cac('0x42')]){_0x519aba[_0x8cac('0x3f')]=_['merge'](_0x519aba[_0x8cac('0x3f')],{'$or':_[_0x8cac('0x30')](_0x519aba['attributes'],function(_0x249879){var _0xfc4133={};_0xfc4133[_0x249879]={'$like':'%'+_0x4c251e[_0x8cac('0x36')][_0x8cac('0x42')]+'%'};return _0xfc4133;})});}_0x519aba=_[_0x8cac('0x40')]({},_0x519aba,_0x4c251e[_0x8cac('0x43')]);return _0x2fe76a[_0x8cac('0x56')](_0x519aba);}})['then'](function(_0x45c1e4){if(_0x45c1e4){_0x35d91e=_0x45c1e4[_0x8cac('0x3b')];if(!_0x4c251e[_0x8cac('0x36')]['hasOwnProperty'](_0x8cac('0x3c'))){_0x519aba[_0x8cac('0x21')]=qs['limit'](_0x4c251e[_0x8cac('0x36')][_0x8cac('0x21')]);_0x519aba[_0x8cac('0x1f')]=qs[_0x8cac('0x1f')](_0x4c251e[_0x8cac('0x36')][_0x8cac('0x1f')]);}return _0x2fe76a[_0x8cac('0x56')](_0x519aba);}})['then'](function(_0x5790cd){if(_0x5790cd){return _0x5790cd?{'count':_0x35d91e,'rows':_0x5790cd}:null;}})[_0x8cac('0x29')](respondWithResult(_0x15da57,null))[_0x8cac('0x49')](handleError(_0x15da57,null));};exports['getTags']=function(_0xfdec28,_0x2eaa5a,_0xb8af62){var _0x37a752={};var _0x21494e={};var _0x3eb61e;var _0x510879;return db[_0x8cac('0x31')]['findOne']({'where':{'id':_0xfdec28['params']['id']}})['then'](handleEntityNotFound(_0x2eaa5a,null))[_0x8cac('0x29')](function(_0x4dca2b){if(_0x4dca2b){_0x3eb61e=_0x4dca2b;_0x21494e[_0x8cac('0x35')]=_['keys'](db[_0x8cac('0x58')][_0x8cac('0x4c')]);_0x21494e['query']=_['keys'](_0xfdec28[_0x8cac('0x36')]);_0x21494e[_0x8cac('0x3e')]=_['intersection'](_0x21494e[_0x8cac('0x35')],_0x21494e[_0x8cac('0x36')]);_0x37a752[_0x8cac('0x39')]=_['intersection'](_0x21494e[_0x8cac('0x35')],qs['fields'](_0xfdec28[_0x8cac('0x36')][_0x8cac('0x3a')]));_0x37a752[_0x8cac('0x39')]=_0x37a752[_0x8cac('0x39')][_0x8cac('0x3b')]?_0x37a752['attributes']:_0x21494e['model'];_0x37a752[_0x8cac('0x53')]=qs['sort'](_0xfdec28[_0x8cac('0x36')]['sort']);_0x37a752[_0x8cac('0x3f')]=qs['filters'](_[_0x8cac('0x57')](_0xfdec28[_0x8cac('0x36')],_0x21494e[_0x8cac('0x3e')]));if(_0xfdec28['query'][_0x8cac('0x42')]){_0x37a752[_0x8cac('0x3f')]=_[_0x8cac('0x40')](_0x37a752[_0x8cac('0x3f')],{'$or':_[_0x8cac('0x30')](_0x37a752[_0x8cac('0x39')],function(_0x117a9c){var _0x2df4b6={};_0x2df4b6[_0x117a9c]={'$like':'%'+_0xfdec28['query'][_0x8cac('0x42')]+'%'};return _0x2df4b6;})});}_0x37a752=_[_0x8cac('0x40')]({},_0x37a752,_0xfdec28[_0x8cac('0x43')]);return _0x3eb61e['getTags'](_0x37a752);}})['then'](function(_0x11cf0f){if(_0x11cf0f){_0x510879=_0x11cf0f[_0x8cac('0x3b')];if(!_0xfdec28[_0x8cac('0x36')][_0x8cac('0x54')]('nolimit')){_0x37a752['limit']=qs[_0x8cac('0x21')](_0xfdec28[_0x8cac('0x36')]['limit']);_0x37a752[_0x8cac('0x1f')]=qs['offset'](_0xfdec28[_0x8cac('0x36')][_0x8cac('0x1f')]);}return _0x3eb61e[_0x8cac('0x59')](_0x37a752);}})[_0x8cac('0x29')](function(_0x1021ca){if(_0x1021ca){return _0x1021ca?{'count':_0x510879,'rows':_0x1021ca}:null;}})['then'](respondWithResult(_0x2eaa5a,null))['catch'](handleError(_0x2eaa5a,null));};exports['setTags']=function(_0x1b6e28,_0x18f220,_0xa611f9){if(_0x1b6e28['body']['id']){delete _0x1b6e28[_0x8cac('0x4f')]['id'];}return db[_0x8cac('0x31')]['findOne']({'where':{'id':_0x1b6e28[_0x8cac('0x4b')]['id']}})[_0x8cac('0x29')](handleEntityNotFound(_0x18f220,null))[_0x8cac('0x29')](function(_0x5f3d3a){if(_0x5f3d3a){return _0x5f3d3a[_0x8cac('0x5a')](_0x1b6e28['body'][_0x8cac('0x5b')]||[]);}return null;})[_0x8cac('0x29')](respondWithResult(_0x18f220,null))['catch'](handleError(_0x18f220,null));}; \ No newline at end of file +var _0x7698=['end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','sendStatus','error','stack','name','send','index','map','DeskConfiguration','rawAttributes','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','filter','where','merge','type','VIRTUAL','options','then','include','rows','catch','show','keys','find','create','body','params','getFields','findOne','DeskField','getSubjects','pick','hasOwnProperty','getDescriptions','getTags','setTags','ids','rimraf','fast-json-patch','request-promise','util','path','to-csv','lodash','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x3ec1da,_0x1e36f5){var _0x472358=function(_0x1d41b1){while(--_0x1d41b1){_0x3ec1da['push'](_0x3ec1da['shift']());}};_0x472358(++_0x1e36f5);}(_0x7698,0x16e));var _0x8769=function(_0x447ba8,_0x941697){_0x447ba8=_0x447ba8-0x0;var _0x53a716=_0x7698[_0x447ba8];return _0x53a716;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8769('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8769('0x1'));var rp=require(_0x8769('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8769('0x3'));var path=require(_0x8769('0x4'));var sox=require('sox');var csv=require(_0x8769('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8769('0x6'));var squel=require('squel');var crypto=require(_0x8769('0x7'));var jsforce=require('jsforce');var deskjs=require(_0x8769('0x8'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8769('0x9'));var authService=require('../../components/auth/service');var qs=require(_0x8769('0xa'));var as=require(_0x8769('0xb'));var hardwareService=require(_0x8769('0xc'));var logger=require(_0x8769('0xd'))('api');var utils=require(_0x8769('0xe'));var config=require(_0x8769('0xf'));var licenseUtil=require(_0x8769('0x10'));var db=require(_0x8769('0x11'))['db'];function respondWithStatusCode(_0x193425,_0x4b0068){_0x4b0068=_0x4b0068||0xcc;return function(_0x1a0d1c){if(_0x1a0d1c){return _0x193425['sendStatus'](_0x4b0068);}return _0x193425[_0x8769('0x12')](_0x4b0068)[_0x8769('0x13')]();};}function respondWithResult(_0x19cb15,_0x314802){_0x314802=_0x314802||0xc8;return function(_0x55e94c){if(_0x55e94c){return _0x19cb15[_0x8769('0x12')](_0x314802)['json'](_0x55e94c);}};}function respondWithFilteredResult(_0x4b8235,_0x2249b9){return function(_0x2df638){if(_0x2df638){var _0x278a9d=typeof _0x2249b9['offset']==='undefined'&&typeof _0x2249b9['limit']==='undefined';var _0x5d404a=_0x2df638[_0x8769('0x14')];var _0x45bd61=_0x278a9d?0x0:_0x2249b9[_0x8769('0x15')];var _0x314ec7=_0x278a9d?_0x2df638[_0x8769('0x14')]:_0x2249b9[_0x8769('0x15')]+_0x2249b9[_0x8769('0x16')];var _0x39d615;if(_0x314ec7>=_0x5d404a){_0x314ec7=_0x5d404a;_0x39d615=0xc8;}else{_0x39d615=0xce;}_0x4b8235[_0x8769('0x12')](_0x39d615);return _0x4b8235[_0x8769('0x17')](_0x8769('0x18'),_0x45bd61+'-'+_0x314ec7+'/'+_0x5d404a)[_0x8769('0x19')](_0x2df638);}return null;};}function patchUpdates(_0x209603){return function(_0x1a769e){try{jsonpatch[_0x8769('0x1a')](_0x1a769e,_0x209603,!![]);}catch(_0x115de8){return BPromise[_0x8769('0x1b')](_0x115de8);}return _0x1a769e[_0x8769('0x1c')]();};}function saveUpdates(_0xf13cfd,_0x4f66e7){return function(_0x38ef74){if(_0x38ef74){return _0x38ef74[_0x8769('0x1d')](_0xf13cfd)['then'](function(_0x11f829){return _0x11f829;});}return null;};}function removeEntity(_0x341b90,_0x249bd9){return function(_0x283b86){if(_0x283b86){return _0x283b86[_0x8769('0x1e')]()['then'](function(){_0x341b90['status'](0xcc)[_0x8769('0x13')]();});}};}function handleEntityNotFound(_0x948ac8,_0x120e9d){return function(_0x4a83f6){if(!_0x4a83f6){_0x948ac8[_0x8769('0x1f')](0x194);}return _0x4a83f6;};}function handleError(_0x205388,_0x3d4e30){_0x3d4e30=_0x3d4e30||0x1f4;return function(_0x5c5505){logger[_0x8769('0x20')](_0x5c5505[_0x8769('0x21')]);if(_0x5c5505[_0x8769('0x22')]){delete _0x5c5505[_0x8769('0x22')];}_0x205388[_0x8769('0x12')](_0x3d4e30)[_0x8769('0x23')](_0x5c5505);};}exports[_0x8769('0x24')]=function(_0x591310,_0x5d7a8d){var _0x17fb21={},_0x20841a={},_0x53cfbb={'count':0x0,'rows':[]};var _0x5b4161=_[_0x8769('0x25')](db[_0x8769('0x26')][_0x8769('0x27')],function(_0x3bd5e8){return{'name':_0x3bd5e8['fieldName'],'type':_0x3bd5e8['type'][_0x8769('0x28')]};});_0x20841a['model']=_[_0x8769('0x25')](_0x5b4161,_0x8769('0x22'));_0x20841a[_0x8769('0x29')]=_['keys'](_0x591310[_0x8769('0x29')]);_0x20841a[_0x8769('0x2a')]=_[_0x8769('0x2b')](_0x20841a[_0x8769('0x2c')],_0x20841a[_0x8769('0x29')]);_0x17fb21[_0x8769('0x2d')]=_[_0x8769('0x2b')](_0x20841a[_0x8769('0x2c')],qs[_0x8769('0x2e')](_0x591310[_0x8769('0x29')][_0x8769('0x2e')]));_0x17fb21[_0x8769('0x2d')]=_0x17fb21[_0x8769('0x2d')][_0x8769('0x2f')]?_0x17fb21[_0x8769('0x2d')]:_0x20841a[_0x8769('0x2c')];if(!_0x591310[_0x8769('0x29')]['hasOwnProperty'](_0x8769('0x30'))){_0x17fb21['limit']=qs['limit'](_0x591310[_0x8769('0x29')]['limit']);_0x17fb21[_0x8769('0x15')]=qs[_0x8769('0x15')](_0x591310[_0x8769('0x29')][_0x8769('0x15')]);}_0x17fb21[_0x8769('0x31')]=qs[_0x8769('0x32')](_0x591310[_0x8769('0x29')][_0x8769('0x32')]);_0x17fb21['where']=qs[_0x8769('0x2a')](_['pick'](_0x591310['query'],_0x20841a[_0x8769('0x2a')]),_0x5b4161);if(_0x591310[_0x8769('0x29')][_0x8769('0x33')]){_0x17fb21[_0x8769('0x34')]=_[_0x8769('0x35')](_0x17fb21['where'],{'$or':_[_0x8769('0x25')](_0x5b4161,function(_0x4ffc30){if(_0x4ffc30[_0x8769('0x36')]!==_0x8769('0x37')){var _0x2342b8={};_0x2342b8[_0x4ffc30[_0x8769('0x22')]]={'$like':'%'+_0x591310[_0x8769('0x29')][_0x8769('0x33')]+'%'};return _0x2342b8;}})});}_0x17fb21=_[_0x8769('0x35')]({},_0x17fb21,_0x591310[_0x8769('0x38')]);var _0x1ec8cb={'where':_0x17fb21[_0x8769('0x34')]};return db[_0x8769('0x26')][_0x8769('0x14')](_0x1ec8cb)[_0x8769('0x39')](function(_0x5bd5e0){_0x53cfbb[_0x8769('0x14')]=_0x5bd5e0;if(_0x591310[_0x8769('0x29')]['includeAll']){_0x17fb21[_0x8769('0x3a')]=[{'all':!![]}];}return db['DeskConfiguration']['findAll'](_0x17fb21);})['then'](function(_0x5cce99){_0x53cfbb[_0x8769('0x3b')]=_0x5cce99;return _0x53cfbb;})[_0x8769('0x39')](respondWithFilteredResult(_0x5d7a8d,_0x17fb21))[_0x8769('0x3c')](handleError(_0x5d7a8d,null));};exports[_0x8769('0x3d')]=function(_0x3d7729,_0xfdc944){var _0x1a9866={'raw':![],'where':{'id':_0x3d7729['params']['id']}},_0x47a17f={};_0x47a17f['model']=_[_0x8769('0x3e')](db[_0x8769('0x26')]['rawAttributes']);_0x47a17f[_0x8769('0x29')]=_['keys'](_0x3d7729[_0x8769('0x29')]);_0x47a17f['filters']=_[_0x8769('0x2b')](_0x47a17f[_0x8769('0x2c')],_0x47a17f[_0x8769('0x29')]);_0x1a9866['attributes']=_[_0x8769('0x2b')](_0x47a17f[_0x8769('0x2c')],qs[_0x8769('0x2e')](_0x3d7729[_0x8769('0x29')]['fields']));_0x1a9866['attributes']=_0x1a9866[_0x8769('0x2d')][_0x8769('0x2f')]?_0x1a9866[_0x8769('0x2d')]:_0x47a17f[_0x8769('0x2c')];if(_0x3d7729[_0x8769('0x29')]['includeAll']){_0x1a9866['include']=[{'all':!![]}];}_0x1a9866=_['merge']({},_0x1a9866,_0x3d7729[_0x8769('0x38')]);return db[_0x8769('0x26')][_0x8769('0x3f')](_0x1a9866)[_0x8769('0x39')](handleEntityNotFound(_0xfdc944,null))[_0x8769('0x39')](respondWithResult(_0xfdc944,null))['catch'](handleError(_0xfdc944,null));};exports[_0x8769('0x40')]=function(_0x488334,_0x3154c6){return db[_0x8769('0x26')]['create'](_0x488334[_0x8769('0x41')],{})[_0x8769('0x39')](respondWithResult(_0x3154c6,0xc9))[_0x8769('0x3c')](handleError(_0x3154c6,null));};exports[_0x8769('0x1d')]=function(_0x2b4baa,_0x128a49){if(_0x2b4baa[_0x8769('0x41')]['id']){delete _0x2b4baa['body']['id'];}return db[_0x8769('0x26')][_0x8769('0x3f')]({'where':{'id':_0x2b4baa[_0x8769('0x42')]['id']}})[_0x8769('0x39')](handleEntityNotFound(_0x128a49,null))[_0x8769('0x39')](saveUpdates(_0x2b4baa[_0x8769('0x41')],null))['then'](respondWithResult(_0x128a49,null))[_0x8769('0x3c')](handleError(_0x128a49,null));};exports['destroy']=function(_0x311f93,_0x5155e2){return db[_0x8769('0x26')][_0x8769('0x3f')]({'where':{'id':_0x311f93[_0x8769('0x42')]['id']}})[_0x8769('0x39')](handleEntityNotFound(_0x5155e2,null))[_0x8769('0x39')](removeEntity(_0x5155e2,null))['catch'](handleError(_0x5155e2,null));};exports[_0x8769('0x43')]=function(_0x327a31,_0x5768e5,_0x45b76f){var _0x683a47={};var _0x2aa5f8={};var _0x270773;var _0x254c79;return db[_0x8769('0x26')][_0x8769('0x44')]({'where':{'id':_0x327a31[_0x8769('0x42')]['id']}})[_0x8769('0x39')](handleEntityNotFound(_0x5768e5,null))[_0x8769('0x39')](function(_0x139d14){if(_0x139d14){_0x270773=_0x139d14;_0x2aa5f8[_0x8769('0x2c')]=_[_0x8769('0x3e')](db[_0x8769('0x45')]['rawAttributes']);_0x2aa5f8[_0x8769('0x29')]=_[_0x8769('0x3e')](_0x327a31[_0x8769('0x29')]);_0x2aa5f8[_0x8769('0x2a')]=_['intersection'](_0x2aa5f8['model'],_0x2aa5f8[_0x8769('0x29')]);_0x683a47[_0x8769('0x2d')]=_[_0x8769('0x2b')](_0x2aa5f8[_0x8769('0x2c')],qs[_0x8769('0x2e')](_0x327a31[_0x8769('0x29')]['fields']));_0x683a47[_0x8769('0x2d')]=_0x683a47[_0x8769('0x2d')][_0x8769('0x2f')]?_0x683a47[_0x8769('0x2d')]:_0x2aa5f8[_0x8769('0x2c')];_0x683a47[_0x8769('0x31')]=qs['sort'](_0x327a31[_0x8769('0x29')]['sort']);_0x683a47['where']=qs[_0x8769('0x2a')](_['pick'](_0x327a31[_0x8769('0x29')],_0x2aa5f8[_0x8769('0x2a')]));if(_0x327a31[_0x8769('0x29')][_0x8769('0x33')]){_0x683a47[_0x8769('0x34')]=_[_0x8769('0x35')](_0x683a47[_0x8769('0x34')],{'$or':_[_0x8769('0x25')](_0x683a47[_0x8769('0x2d')],function(_0x3ebbe5){var _0x2bc1d8={};_0x2bc1d8[_0x3ebbe5]={'$like':'%'+_0x327a31['query'][_0x8769('0x33')]+'%'};return _0x2bc1d8;})});}_0x683a47=_[_0x8769('0x35')]({},_0x683a47,_0x327a31[_0x8769('0x38')]);return _0x270773[_0x8769('0x43')](_0x683a47);}})[_0x8769('0x39')](function(_0x3e0a77){if(_0x3e0a77){_0x254c79=_0x3e0a77[_0x8769('0x2f')];if(!_0x327a31[_0x8769('0x29')]['hasOwnProperty']('nolimit')){_0x683a47[_0x8769('0x16')]=qs[_0x8769('0x16')](_0x327a31['query'][_0x8769('0x16')]);_0x683a47[_0x8769('0x15')]=qs[_0x8769('0x15')](_0x327a31[_0x8769('0x29')][_0x8769('0x15')]);}return _0x270773[_0x8769('0x43')](_0x683a47);}})[_0x8769('0x39')](function(_0x460972){if(_0x460972){return _0x460972?{'count':_0x254c79,'rows':_0x460972}:null;}})[_0x8769('0x39')](respondWithResult(_0x5768e5,null))['catch'](handleError(_0x5768e5,null));};exports[_0x8769('0x46')]=function(_0xcd7510,_0x3fa936,_0x168dcb){var _0xa316f9={};var _0x228fae={};var _0x197033;var _0x56a0b5;return db[_0x8769('0x26')][_0x8769('0x44')]({'where':{'id':_0xcd7510[_0x8769('0x42')]['id']}})[_0x8769('0x39')](handleEntityNotFound(_0x3fa936,null))[_0x8769('0x39')](function(_0x44a642){if(_0x44a642){_0x197033=_0x44a642;_0x228fae['model']=_[_0x8769('0x3e')](db['DeskField'][_0x8769('0x27')]);_0x228fae[_0x8769('0x29')]=_['keys'](_0xcd7510[_0x8769('0x29')]);_0x228fae[_0x8769('0x2a')]=_[_0x8769('0x2b')](_0x228fae['model'],_0x228fae[_0x8769('0x29')]);_0xa316f9[_0x8769('0x2d')]=_[_0x8769('0x2b')](_0x228fae[_0x8769('0x2c')],qs[_0x8769('0x2e')](_0xcd7510['query'][_0x8769('0x2e')]));_0xa316f9[_0x8769('0x2d')]=_0xa316f9[_0x8769('0x2d')][_0x8769('0x2f')]?_0xa316f9[_0x8769('0x2d')]:_0x228fae['model'];_0xa316f9['order']=qs[_0x8769('0x32')](_0xcd7510[_0x8769('0x29')][_0x8769('0x32')]);_0xa316f9[_0x8769('0x34')]=qs[_0x8769('0x2a')](_[_0x8769('0x47')](_0xcd7510[_0x8769('0x29')],_0x228fae[_0x8769('0x2a')]));if(_0xcd7510[_0x8769('0x29')][_0x8769('0x33')]){_0xa316f9[_0x8769('0x34')]=_[_0x8769('0x35')](_0xa316f9[_0x8769('0x34')],{'$or':_[_0x8769('0x25')](_0xa316f9[_0x8769('0x2d')],function(_0x14b360){var _0x4506d4={};_0x4506d4[_0x14b360]={'$like':'%'+_0xcd7510['query'][_0x8769('0x33')]+'%'};return _0x4506d4;})});}_0xa316f9=_[_0x8769('0x35')]({},_0xa316f9,_0xcd7510['options']);return _0x197033[_0x8769('0x46')](_0xa316f9);}})[_0x8769('0x39')](function(_0x339e16){if(_0x339e16){_0x56a0b5=_0x339e16[_0x8769('0x2f')];if(!_0xcd7510[_0x8769('0x29')][_0x8769('0x48')](_0x8769('0x30'))){_0xa316f9[_0x8769('0x16')]=qs[_0x8769('0x16')](_0xcd7510[_0x8769('0x29')][_0x8769('0x16')]);_0xa316f9[_0x8769('0x15')]=qs[_0x8769('0x15')](_0xcd7510['query'][_0x8769('0x15')]);}return _0x197033[_0x8769('0x46')](_0xa316f9);}})[_0x8769('0x39')](function(_0x7bfb39){if(_0x7bfb39){return _0x7bfb39?{'count':_0x56a0b5,'rows':_0x7bfb39}:null;}})[_0x8769('0x39')](respondWithResult(_0x3fa936,null))[_0x8769('0x3c')](handleError(_0x3fa936,null));};exports['getDescriptions']=function(_0x2dadcb,_0x131c83,_0x50e05d){var _0x10cbe4={};var _0x44e82b={};var _0xb12477;var _0xcc448b;return db[_0x8769('0x26')]['findOne']({'where':{'id':_0x2dadcb[_0x8769('0x42')]['id']}})[_0x8769('0x39')](handleEntityNotFound(_0x131c83,null))[_0x8769('0x39')](function(_0x5768c9){if(_0x5768c9){_0xb12477=_0x5768c9;_0x44e82b[_0x8769('0x2c')]=_[_0x8769('0x3e')](db['DeskField']['rawAttributes']);_0x44e82b[_0x8769('0x29')]=_['keys'](_0x2dadcb['query']);_0x44e82b['filters']=_[_0x8769('0x2b')](_0x44e82b[_0x8769('0x2c')],_0x44e82b[_0x8769('0x29')]);_0x10cbe4[_0x8769('0x2d')]=_[_0x8769('0x2b')](_0x44e82b[_0x8769('0x2c')],qs['fields'](_0x2dadcb['query']['fields']));_0x10cbe4['attributes']=_0x10cbe4[_0x8769('0x2d')][_0x8769('0x2f')]?_0x10cbe4['attributes']:_0x44e82b[_0x8769('0x2c')];_0x10cbe4[_0x8769('0x31')]=qs[_0x8769('0x32')](_0x2dadcb['query'][_0x8769('0x32')]);_0x10cbe4[_0x8769('0x34')]=qs[_0x8769('0x2a')](_[_0x8769('0x47')](_0x2dadcb[_0x8769('0x29')],_0x44e82b[_0x8769('0x2a')]));if(_0x2dadcb['query'][_0x8769('0x33')]){_0x10cbe4[_0x8769('0x34')]=_['merge'](_0x10cbe4[_0x8769('0x34')],{'$or':_[_0x8769('0x25')](_0x10cbe4['attributes'],function(_0x3ebfc6){var _0x5da6e1={};_0x5da6e1[_0x3ebfc6]={'$like':'%'+_0x2dadcb[_0x8769('0x29')][_0x8769('0x33')]+'%'};return _0x5da6e1;})});}_0x10cbe4=_[_0x8769('0x35')]({},_0x10cbe4,_0x2dadcb[_0x8769('0x38')]);return _0xb12477[_0x8769('0x49')](_0x10cbe4);}})[_0x8769('0x39')](function(_0x455fcc){if(_0x455fcc){_0xcc448b=_0x455fcc[_0x8769('0x2f')];if(!_0x2dadcb[_0x8769('0x29')]['hasOwnProperty']('nolimit')){_0x10cbe4[_0x8769('0x16')]=qs[_0x8769('0x16')](_0x2dadcb[_0x8769('0x29')][_0x8769('0x16')]);_0x10cbe4['offset']=qs[_0x8769('0x15')](_0x2dadcb[_0x8769('0x29')][_0x8769('0x15')]);}return _0xb12477['getDescriptions'](_0x10cbe4);}})[_0x8769('0x39')](function(_0x55cc79){if(_0x55cc79){return _0x55cc79?{'count':_0xcc448b,'rows':_0x55cc79}:null;}})[_0x8769('0x39')](respondWithResult(_0x131c83,null))[_0x8769('0x3c')](handleError(_0x131c83,null));};exports['getTags']=function(_0x46522b,_0x13fca7,_0x3ffdb2){var _0x18b043={};var _0x4b6037={};var _0x47d7de;var _0x496ce4;return db['DeskConfiguration'][_0x8769('0x44')]({'where':{'id':_0x46522b[_0x8769('0x42')]['id']}})[_0x8769('0x39')](handleEntityNotFound(_0x13fca7,null))[_0x8769('0x39')](function(_0x2ecd46){if(_0x2ecd46){_0x47d7de=_0x2ecd46;_0x4b6037[_0x8769('0x2c')]=_[_0x8769('0x3e')](db['Tag'][_0x8769('0x27')]);_0x4b6037['query']=_[_0x8769('0x3e')](_0x46522b[_0x8769('0x29')]);_0x4b6037[_0x8769('0x2a')]=_[_0x8769('0x2b')](_0x4b6037[_0x8769('0x2c')],_0x4b6037[_0x8769('0x29')]);_0x18b043['attributes']=_[_0x8769('0x2b')](_0x4b6037['model'],qs['fields'](_0x46522b['query'][_0x8769('0x2e')]));_0x18b043[_0x8769('0x2d')]=_0x18b043[_0x8769('0x2d')][_0x8769('0x2f')]?_0x18b043[_0x8769('0x2d')]:_0x4b6037['model'];_0x18b043['order']=qs[_0x8769('0x32')](_0x46522b[_0x8769('0x29')][_0x8769('0x32')]);_0x18b043[_0x8769('0x34')]=qs[_0x8769('0x2a')](_['pick'](_0x46522b[_0x8769('0x29')],_0x4b6037[_0x8769('0x2a')]));if(_0x46522b[_0x8769('0x29')][_0x8769('0x33')]){_0x18b043['where']=_[_0x8769('0x35')](_0x18b043[_0x8769('0x34')],{'$or':_['map'](_0x18b043[_0x8769('0x2d')],function(_0x34a1b4){var _0x39e449={};_0x39e449[_0x34a1b4]={'$like':'%'+_0x46522b[_0x8769('0x29')]['filter']+'%'};return _0x39e449;})});}_0x18b043=_[_0x8769('0x35')]({},_0x18b043,_0x46522b[_0x8769('0x38')]);return _0x47d7de[_0x8769('0x4a')](_0x18b043);}})[_0x8769('0x39')](function(_0x59fb91){if(_0x59fb91){_0x496ce4=_0x59fb91[_0x8769('0x2f')];if(!_0x46522b['query'][_0x8769('0x48')](_0x8769('0x30'))){_0x18b043[_0x8769('0x16')]=qs['limit'](_0x46522b['query'][_0x8769('0x16')]);_0x18b043['offset']=qs['offset'](_0x46522b['query'][_0x8769('0x15')]);}return _0x47d7de[_0x8769('0x4a')](_0x18b043);}})[_0x8769('0x39')](function(_0x4e0a7a){if(_0x4e0a7a){return _0x4e0a7a?{'count':_0x496ce4,'rows':_0x4e0a7a}:null;}})[_0x8769('0x39')](respondWithResult(_0x13fca7,null))['catch'](handleError(_0x13fca7,null));};exports[_0x8769('0x4b')]=function(_0x4cd86f,_0x3dc119,_0x25e204){if(_0x4cd86f['body']['id']){delete _0x4cd86f[_0x8769('0x41')]['id'];}return db[_0x8769('0x26')]['findOne']({'where':{'id':_0x4cd86f[_0x8769('0x42')]['id']}})[_0x8769('0x39')](handleEntityNotFound(_0x3dc119,null))['then'](function(_0x2f0afc){if(_0x2f0afc){return _0x2f0afc[_0x8769('0x4b')](_0x4cd86f[_0x8769('0x41')][_0x8769('0x4c')]||[]);}return null;})[_0x8769('0x39')](respondWithResult(_0x3dc119,null))[_0x8769('0x3c')](handleError(_0x3dc119,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 5353e52..2a0e10e 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 _0xbbdd=['define','DeskConfiguration','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports'];(function(_0x28cd1c,_0x80d8fb){var _0x574b49=function(_0x1c8887){while(--_0x1c8887){_0x28cd1c['push'](_0x28cd1c['shift']());}};_0x574b49(++_0x80d8fb);}(_0xbbdd,0xa2));var _0xdbbd=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xbbdd[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xdbbd('0x0'))('api');var moment=require('moment');var BPromise=require(_0xdbbd('0x1'));var rp=require(_0xdbbd('0x2'));var fs=require('fs');var path=require(_0xdbbd('0x3'));var rimraf=require(_0xdbbd('0x4'));var config=require(_0xdbbd('0x5'));var attributes=require(_0xdbbd('0x6'));module[_0xdbbd('0x7')]=function(_0x58a7ed,_0x247dc9){return _0x58a7ed[_0xdbbd('0x8')](_0xdbbd('0x9'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b9d=['rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','int_desk_configurations','lodash','util','../../config/logger','bluebird'];(function(_0x218153,_0x173fa8){var _0x59de54=function(_0x5c3826){while(--_0x5c3826){_0x218153['push'](_0x218153['shift']());}};_0x59de54(++_0x173fa8);}(_0x8b9d,0x6a));var _0xd8b9=function(_0x5f07de,_0x5786ff){_0x5f07de=_0x5f07de-0x0;var _0x53656e=_0x8b9d[_0x5f07de];return _0x53656e;};'use strict';var _=require(_0xd8b9('0x0'));var util=require(_0xd8b9('0x1'));var logger=require(_0xd8b9('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd8b9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd8b9('0x4'));var config=require(_0xd8b9('0x5'));var attributes=require(_0xd8b9('0x6'));module[_0xd8b9('0x7')]=function(_0x355c1c,_0x25b557){return _0x355c1c[_0xd8b9('0x8')]('DeskConfiguration',attributes,{'tableName':_0xd8b9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 58af557..ec3dde3 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 _0xf6fa=['info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x594de8,_0x46d0d2){var _0x5fcbf=function(_0x48c215){while(--_0x48c215){_0x594de8['push'](_0x594de8['shift']());}};_0x5fcbf(++_0x46d0d2);}(_0xf6fa,0x87));var _0xaf6f=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xf6fa[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0xaf6f('0x0'));var moment=require('moment');var BPromise=require(_0xaf6f('0x1'));var rs=require(_0xaf6f('0x2'));var fs=require('fs');var Redis=require(_0xaf6f('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaf6f('0x4'))(_0xaf6f('0x5'));var config=require(_0xaf6f('0x6'));var jayson=require(_0xaf6f('0x7'));var client=jayson[_0xaf6f('0x8')][_0xaf6f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x878ae0,_0x2e1eb8,_0x290271){return new BPromise(function(_0x9c9b7b,_0x4efcfa){return client[_0xaf6f('0xa')](_0x878ae0,_0x290271)[_0xaf6f('0xb')](function(_0x2c89c1){logger[_0xaf6f('0xc')](_0xaf6f('0xd'),_0x2e1eb8,_0xaf6f('0xe'));logger['debug'](_0xaf6f('0xf'),_0x2e1eb8,_0xaf6f('0xe'),JSON[_0xaf6f('0x10')](_0x2c89c1));if(_0x2c89c1[_0xaf6f('0x11')]){if(_0x2c89c1['error']['code']===0x1f4){logger[_0xaf6f('0x11')](_0xaf6f('0xd'),_0x2e1eb8,_0x2c89c1[_0xaf6f('0x11')]['message']);return _0x4efcfa(_0x2c89c1['error']['message']);}logger['error'](_0xaf6f('0xd'),_0x2e1eb8,_0x2c89c1[_0xaf6f('0x11')]['message']);return _0x9c9b7b(_0x2c89c1[_0xaf6f('0x11')][_0xaf6f('0x12')]);}else{logger[_0xaf6f('0xc')](_0xaf6f('0xd'),_0x2e1eb8,'request\x20sent');_0x9c9b7b(_0x2c89c1[_0xaf6f('0x13')][_0xaf6f('0x12')]);}})[_0xaf6f('0x14')](function(_0x566adb){logger[_0xaf6f('0x11')](_0xaf6f('0xd'),_0x2e1eb8,_0x566adb);_0x4efcfa(_0x566adb);});});} \ No newline at end of file +var _0xa5c1=['../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../config/utils'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xa5c1,0x19f));var _0x1a5c=function(_0x24abb2,_0x391407){_0x24abb2=_0x24abb2-0x0;var _0x327b50=_0xa5c1[_0x24abb2];return _0x327b50;};'use strict';var _=require(_0x1a5c('0x0'));var util=require(_0x1a5c('0x1'));var moment=require(_0x1a5c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a5c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1a5c('0x4'));var logger=require(_0x1a5c('0x5'))(_0x1a5c('0x6'));var config=require(_0x1a5c('0x7'));var jayson=require(_0x1a5c('0x8'));var client=jayson[_0x1a5c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9853,_0x580a2e,_0x438f8f){return new BPromise(function(_0x43a2ed,_0x1702ce){return client['request'](_0x9853,_0x438f8f)[_0x1a5c('0xa')](function(_0x4c0bd2){logger[_0x1a5c('0xb')](_0x1a5c('0xc'),_0x580a2e,'request\x20sent');logger[_0x1a5c('0xd')](_0x1a5c('0xe'),_0x580a2e,'request\x20sent',JSON[_0x1a5c('0xf')](_0x4c0bd2));if(_0x4c0bd2[_0x1a5c('0x10')]){if(_0x4c0bd2[_0x1a5c('0x10')][_0x1a5c('0x11')]===0x1f4){logger[_0x1a5c('0x10')](_0x1a5c('0xc'),_0x580a2e,_0x4c0bd2[_0x1a5c('0x10')]['message']);return _0x1702ce(_0x4c0bd2[_0x1a5c('0x10')][_0x1a5c('0x12')]);}logger['error'](_0x1a5c('0xc'),_0x580a2e,_0x4c0bd2[_0x1a5c('0x10')]['message']);return _0x43a2ed(_0x4c0bd2[_0x1a5c('0x10')][_0x1a5c('0x12')]);}else{logger[_0x1a5c('0xb')](_0x1a5c('0xc'),_0x580a2e,'request\x20sent');_0x43a2ed(_0x4c0bd2[_0x1a5c('0x13')]['message']);}})[_0x1a5c('0x14')](function(_0x44648a){logger[_0x1a5c('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x580a2e,_0x44648a);_0x1702ce(_0x44648a);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index b6cdc72..00bfdba 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 _0x27d7=['destroy','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','isAuthenticated','get','/:id','show','post','create','put','update','delete'];(function(_0xbfa61c,_0x4d9a1d){var _0x45cd82=function(_0x4d87c1){while(--_0x4d87c1){_0xbfa61c['push'](_0xbfa61c['shift']());}};_0x45cd82(++_0x4d9a1d);}(_0x27d7,0xa4));var _0x727d=function(_0x46261b,_0xd68542){_0x46261b=_0x46261b-0x0;var _0x31e36f=_0x27d7[_0x46261b];return _0x31e36f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x727d('0x0'));var timeout=require(_0x727d('0x1'));var express=require('express');var router=express[_0x727d('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x727d('0x3'));var interaction=require(_0x727d('0x4'));var config=require(_0x727d('0x5'));var controller=require(_0x727d('0x6'));router['get']('/',auth[_0x727d('0x7')](),controller['index']);router[_0x727d('0x8')](_0x727d('0x9'),auth[_0x727d('0x7')](),controller[_0x727d('0xa')]);router[_0x727d('0xb')]('/',auth[_0x727d('0x7')](),controller[_0x727d('0xc')]);router[_0x727d('0xd')](_0x727d('0x9'),auth[_0x727d('0x7')](),controller[_0x727d('0xe')]);router[_0x727d('0xf')](_0x727d('0x9'),auth[_0x727d('0x7')](),controller[_0x727d('0x10')]);module[_0x727d('0x11')]=router; \ No newline at end of file +var _0xf438=['../../config/environment','./intDeskField.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4b370d,_0xfb1ff8){var _0x2da0bf=function(_0x23097c){while(--_0x23097c){_0x4b370d['push'](_0x4b370d['shift']());}};_0x2da0bf(++_0xfb1ff8);}(_0xf438,0xe0));var _0x8f43=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xf438[_0x1e4360];return _0x31e6b4;};'use strict';var multer=require('multer');var util=require(_0x8f43('0x0'));var path=require(_0x8f43('0x1'));var timeout=require(_0x8f43('0x2'));var express=require(_0x8f43('0x3'));var router=express['Router']();var fs_extra=require(_0x8f43('0x4'));var auth=require(_0x8f43('0x5'));var interaction=require(_0x8f43('0x6'));var config=require(_0x8f43('0x7'));var controller=require(_0x8f43('0x8'));router['get']('/',auth[_0x8f43('0x9')](),controller[_0x8f43('0xa')]);router[_0x8f43('0xb')](_0x8f43('0xc'),auth['isAuthenticated'](),controller[_0x8f43('0xd')]);router[_0x8f43('0xe')]('/',auth['isAuthenticated'](),controller[_0x8f43('0xf')]);router[_0x8f43('0x10')]('/:id',auth[_0x8f43('0x9')](),controller[_0x8f43('0x11')]);router[_0x8f43('0x12')](_0x8f43('0xc'),auth[_0x8f43('0x9')](),controller[_0x8f43('0x13')]);module[_0x8f43('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index d1bad1d..494dc1e 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 _0x55d7=['ENUM','variable','customVariable','keyValue','picklist','string','STRING','BOOLEAN','sequelize','exports'];(function(_0x31a655,_0x581842){var _0x361094=function(_0x2529bc){while(--_0x2529bc){_0x31a655['push'](_0x31a655['shift']());}};_0x361094(++_0x581842);}(_0x55d7,0x17a));var _0x755d=function(_0x179038,_0x5cdc63){_0x179038=_0x179038-0x0;var _0x437bbb=_0x55d7[_0x179038];return _0x437bbb;};'use strict';var Sequelize=require(_0x755d('0x0'));module[_0x755d('0x1')]={'type':{'type':Sequelize[_0x755d('0x2')]('string',_0x755d('0x3'),_0x755d('0x4'),_0x755d('0x5'),_0x755d('0x6')),'defaultValue':_0x755d('0x7')},'content':{'type':Sequelize[_0x755d('0x8')]},'key':{'type':Sequelize[_0x755d('0x8')]},'keyType':{'type':Sequelize[_0x755d('0x2')](_0x755d('0x7'),_0x755d('0x3'),_0x755d('0x4'))},'keyContent':{'type':Sequelize[_0x755d('0x8')]},'idField':{'type':Sequelize[_0x755d('0x8')]},'nameField':{'type':Sequelize[_0x755d('0x8')]},'customField':{'type':Sequelize[_0x755d('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x755d('0x8')]}}; \ No newline at end of file +var _0x4729=['BOOLEAN','sequelize','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x1935e1,_0xdaca61){var _0x132b50=function(_0x249251){while(--_0x249251){_0x1935e1['push'](_0x1935e1['shift']());}};_0x132b50(++_0xdaca61);}(_0x4729,0xd0));var _0x9472=function(_0x3a3133,_0x179dde){_0x3a3133=_0x3a3133-0x0;var _0x51b179=_0x4729[_0x3a3133];return _0x51b179;};'use strict';var Sequelize=require(_0x9472('0x0'));module['exports']={'type':{'type':Sequelize[_0x9472('0x1')](_0x9472('0x2'),_0x9472('0x3'),_0x9472('0x4'),_0x9472('0x5'),_0x9472('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x9472('0x7')]},'key':{'type':Sequelize[_0x9472('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x9472('0x2'),_0x9472('0x3'),_0x9472('0x4'))},'keyContent':{'type':Sequelize[_0x9472('0x7')]},'idField':{'type':Sequelize[_0x9472('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x9472('0x8')],'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 874d0b6..086c7fb 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 _0xbc48=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','DeskField','length','create','body','update','find','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x227ea7,_0x41c043){var _0x11705c=function(_0x29d01f){while(--_0x29d01f){_0x227ea7['push'](_0x227ea7['shift']());}};_0x11705c(++_0x41c043);}(_0xbc48,0x111));var _0x8bc4=function(_0x4bd8ec,_0x114640){_0x4bd8ec=_0x4bd8ec-0x0;var _0x50b294=_0xbc48[_0x4bd8ec];return _0x50b294;};'use strict';var emlformat=require(_0x8bc4('0x0'));var rimraf=require(_0x8bc4('0x1'));var zipdir=require(_0x8bc4('0x2'));var jsonpatch=require(_0x8bc4('0x3'));var rp=require('request-promise');var moment=require(_0x8bc4('0x4'));var BPromise=require(_0x8bc4('0x5'));var Mustache=require(_0x8bc4('0x6'));var util=require(_0x8bc4('0x7'));var path=require('path');var sox=require(_0x8bc4('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8bc4('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8bc4('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x8bc4('0xb'));var querystring=require(_0x8bc4('0xc'));var Papa=require(_0x8bc4('0xd'));var Redis=require(_0x8bc4('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x8bc4('0xf'));var as=require(_0x8bc4('0x10'));var hardwareService=require(_0x8bc4('0x11'));var logger=require(_0x8bc4('0x12'))(_0x8bc4('0x13'));var utils=require(_0x8bc4('0x14'));var config=require(_0x8bc4('0x15'));var licenseUtil=require(_0x8bc4('0x16'));var db=require(_0x8bc4('0x17'))['db'];function respondWithStatusCode(_0x1f842d,_0xf04517){_0xf04517=_0xf04517||0xcc;return function(_0x1ec0e2){if(_0x1ec0e2){return _0x1f842d[_0x8bc4('0x18')](_0xf04517);}return _0x1f842d[_0x8bc4('0x19')](_0xf04517)[_0x8bc4('0x1a')]();};}function respondWithResult(_0x55e23a,_0x2617dc){_0x2617dc=_0x2617dc||0xc8;return function(_0x198f18){if(_0x198f18){return _0x55e23a[_0x8bc4('0x19')](_0x2617dc)[_0x8bc4('0x1b')](_0x198f18);}};}function respondWithFilteredResult(_0x2e1213,_0x3e3690){return function(_0x5cd8f7){if(_0x5cd8f7){var _0x4d2530=typeof _0x3e3690['offset']===_0x8bc4('0x1c')&&typeof _0x3e3690['limit']===_0x8bc4('0x1c');var _0x45244b=_0x5cd8f7[_0x8bc4('0x1d')];var _0x5982e6=_0x4d2530?0x0:_0x3e3690[_0x8bc4('0x1e')];var _0x968929=_0x4d2530?_0x5cd8f7['count']:_0x3e3690[_0x8bc4('0x1e')]+_0x3e3690['limit'];var _0x659ae3;if(_0x968929>=_0x45244b){_0x968929=_0x45244b;_0x659ae3=0xc8;}else{_0x659ae3=0xce;}_0x2e1213['status'](_0x659ae3);return _0x2e1213['set'](_0x8bc4('0x1f'),_0x5982e6+'-'+_0x968929+'/'+_0x45244b)[_0x8bc4('0x1b')](_0x5cd8f7);}return null;};}function patchUpdates(_0x415598){return function(_0x3c5dba){try{jsonpatch[_0x8bc4('0x20')](_0x3c5dba,_0x415598,!![]);}catch(_0xf0a578){return BPromise[_0x8bc4('0x21')](_0xf0a578);}return _0x3c5dba[_0x8bc4('0x22')]();};}function saveUpdates(_0x26c5e9,_0x3b402f){return function(_0x148fda){if(_0x148fda){return _0x148fda['update'](_0x26c5e9)[_0x8bc4('0x23')](function(_0x33f5b1){return _0x33f5b1;});}return null;};}function removeEntity(_0x23329e,_0x546d83){return function(_0x327e90){if(_0x327e90){return _0x327e90[_0x8bc4('0x24')]()['then'](function(){_0x23329e[_0x8bc4('0x19')](0xcc)[_0x8bc4('0x1a')]();});}};}function handleEntityNotFound(_0x45118c,_0x4cb042){return function(_0x324e59){if(!_0x324e59){_0x45118c['sendStatus'](0x194);}return _0x324e59;};}function handleError(_0x57b437,_0xb44005){_0xb44005=_0xb44005||0x1f4;return function(_0x29aef5){logger[_0x8bc4('0x25')](_0x29aef5[_0x8bc4('0x26')]);if(_0x29aef5[_0x8bc4('0x27')]){delete _0x29aef5[_0x8bc4('0x27')];}_0x57b437[_0x8bc4('0x19')](_0xb44005)[_0x8bc4('0x28')](_0x29aef5);};}exports['index']=function(_0x56f462,_0x2f9cf4){var _0x39f657={},_0x3bada3={},_0x44fc89={'count':0x0,'rows':[]};var _0x134760=_[_0x8bc4('0x29')](db['DeskField'][_0x8bc4('0x2a')],function(_0x88f990){return{'name':_0x88f990[_0x8bc4('0x2b')],'type':_0x88f990[_0x8bc4('0x2c')]['key']};});_0x3bada3[_0x8bc4('0x2d')]=_[_0x8bc4('0x29')](_0x134760,_0x8bc4('0x27'));_0x3bada3[_0x8bc4('0x2e')]=_[_0x8bc4('0x2f')](_0x56f462['query']);_0x3bada3[_0x8bc4('0x30')]=_['intersection'](_0x3bada3[_0x8bc4('0x2d')],_0x3bada3[_0x8bc4('0x2e')]);_0x39f657[_0x8bc4('0x31')]=_[_0x8bc4('0x32')](_0x3bada3['model'],qs['fields'](_0x56f462[_0x8bc4('0x2e')][_0x8bc4('0x33')]));_0x39f657[_0x8bc4('0x31')]=_0x39f657[_0x8bc4('0x31')]['length']?_0x39f657['attributes']:_0x3bada3['model'];if(!_0x56f462[_0x8bc4('0x2e')][_0x8bc4('0x34')](_0x8bc4('0x35'))){_0x39f657['limit']=qs['limit'](_0x56f462['query']['limit']);_0x39f657['offset']=qs[_0x8bc4('0x1e')](_0x56f462[_0x8bc4('0x2e')][_0x8bc4('0x1e')]);}_0x39f657['order']=qs[_0x8bc4('0x36')](_0x56f462[_0x8bc4('0x2e')][_0x8bc4('0x36')]);_0x39f657['where']=qs[_0x8bc4('0x30')](_[_0x8bc4('0x37')](_0x56f462[_0x8bc4('0x2e')],_0x3bada3[_0x8bc4('0x30')]),_0x134760);if(_0x56f462[_0x8bc4('0x2e')]['filter']){_0x39f657[_0x8bc4('0x38')]=_[_0x8bc4('0x39')](_0x39f657[_0x8bc4('0x38')],{'$or':_['map'](_0x134760,function(_0xe9a913){if(_0xe9a913[_0x8bc4('0x2c')]!==_0x8bc4('0x3a')){var _0x14a511={};_0x14a511[_0xe9a913[_0x8bc4('0x27')]]={'$like':'%'+_0x56f462[_0x8bc4('0x2e')][_0x8bc4('0x3b')]+'%'};return _0x14a511;}})});}_0x39f657=_[_0x8bc4('0x39')]({},_0x39f657,_0x56f462[_0x8bc4('0x3c')]);var _0x2fb60d={'where':_0x39f657[_0x8bc4('0x38')]};return db['DeskField']['count'](_0x2fb60d)[_0x8bc4('0x23')](function(_0x1f89f2){_0x44fc89['count']=_0x1f89f2;if(_0x56f462[_0x8bc4('0x2e')][_0x8bc4('0x3d')]){_0x39f657[_0x8bc4('0x3e')]=[{'all':!![]}];}return db['DeskField']['findAll'](_0x39f657);})[_0x8bc4('0x23')](function(_0x31be57){_0x44fc89[_0x8bc4('0x3f')]=_0x31be57;return _0x44fc89;})[_0x8bc4('0x23')](respondWithFilteredResult(_0x2f9cf4,_0x39f657))[_0x8bc4('0x40')](handleError(_0x2f9cf4,null));};exports[_0x8bc4('0x41')]=function(_0x270a7c,_0x53d524){var _0x4cceab={'raw':!![],'where':{'id':_0x270a7c['params']['id']}},_0x23f7a5={};_0x23f7a5['model']=_[_0x8bc4('0x2f')](db[_0x8bc4('0x42')][_0x8bc4('0x2a')]);_0x23f7a5[_0x8bc4('0x2e')]=_[_0x8bc4('0x2f')](_0x270a7c[_0x8bc4('0x2e')]);_0x23f7a5['filters']=_[_0x8bc4('0x32')](_0x23f7a5[_0x8bc4('0x2d')],_0x23f7a5['query']);_0x4cceab[_0x8bc4('0x31')]=_['intersection'](_0x23f7a5[_0x8bc4('0x2d')],qs['fields'](_0x270a7c[_0x8bc4('0x2e')][_0x8bc4('0x33')]));_0x4cceab[_0x8bc4('0x31')]=_0x4cceab['attributes'][_0x8bc4('0x43')]?_0x4cceab[_0x8bc4('0x31')]:_0x23f7a5[_0x8bc4('0x2d')];if(_0x270a7c[_0x8bc4('0x2e')]['includeAll']){_0x4cceab['include']=[{'all':!![]}];}_0x4cceab=_[_0x8bc4('0x39')]({},_0x4cceab,_0x270a7c[_0x8bc4('0x3c')]);return db[_0x8bc4('0x42')]['find'](_0x4cceab)['then'](handleEntityNotFound(_0x53d524,null))[_0x8bc4('0x23')](respondWithResult(_0x53d524,null))['catch'](handleError(_0x53d524,null));};exports[_0x8bc4('0x44')]=function(_0x38da9c,_0x1c758c){return db[_0x8bc4('0x42')][_0x8bc4('0x44')](_0x38da9c[_0x8bc4('0x45')],{})[_0x8bc4('0x23')](respondWithResult(_0x1c758c,0xc9))[_0x8bc4('0x40')](handleError(_0x1c758c,null));};exports[_0x8bc4('0x46')]=function(_0x2b739f,_0x188bce){if(_0x2b739f[_0x8bc4('0x45')]['id']){delete _0x2b739f[_0x8bc4('0x45')]['id'];}return db[_0x8bc4('0x42')][_0x8bc4('0x47')]({'where':{'id':_0x2b739f[_0x8bc4('0x48')]['id']}})['then'](handleEntityNotFound(_0x188bce,null))[_0x8bc4('0x23')](saveUpdates(_0x2b739f[_0x8bc4('0x45')],null))[_0x8bc4('0x23')](respondWithResult(_0x188bce,null))[_0x8bc4('0x40')](handleError(_0x188bce,null));};exports[_0x8bc4('0x24')]=function(_0x1c7b27,_0x1e6641){return db[_0x8bc4('0x42')]['find']({'where':{'id':_0x1c7b27[_0x8bc4('0x48')]['id']}})[_0x8bc4('0x23')](handleEntityNotFound(_0x1e6641,null))[_0x8bc4('0x23')](removeEntity(_0x1e6641,null))[_0x8bc4('0x40')](handleError(_0x1e6641,null));}; \ No newline at end of file +var _0x2e79=['keys','options','catch','create','body','find','destroy','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','undefined','count','offset','status','Content-Range','apply','save','update','then','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','filter','where','merge','VIRTUAL','DeskField','includeAll','include','findAll','show','params'];(function(_0x4a7f48,_0x142979){var _0x1e1b80=function(_0xcfcfde){while(--_0xcfcfde){_0x4a7f48['push'](_0x4a7f48['shift']());}};_0x1e1b80(++_0x142979);}(_0x2e79,0xeb));var _0x92e7=function(_0x5913c3,_0x242e75){_0x5913c3=_0x5913c3-0x0;var _0x1357fb=_0x2e79[_0x5913c3];return _0x1357fb;};'use strict';var emlformat=require(_0x92e7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x92e7('0x1'));var rp=require(_0x92e7('0x2'));var moment=require(_0x92e7('0x3'));var BPromise=require(_0x92e7('0x4'));var Mustache=require(_0x92e7('0x5'));var util=require('util');var path=require(_0x92e7('0x6'));var sox=require(_0x92e7('0x7'));var csv=require(_0x92e7('0x8'));var ejs=require(_0x92e7('0x9'));var fs=require('fs');var fs_extra=require(_0x92e7('0xa'));var _=require(_0x92e7('0xb'));var squel=require(_0x92e7('0xc'));var crypto=require(_0x92e7('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x92e7('0xe'));var toCsv=require(_0x92e7('0x8'));var querystring=require(_0x92e7('0xf'));var Papa=require(_0x92e7('0x10'));var Redis=require('ioredis');var authService=require(_0x92e7('0x11'));var qs=require(_0x92e7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x92e7('0x13'));var logger=require(_0x92e7('0x14'))(_0x92e7('0x15'));var utils=require(_0x92e7('0x16'));var config=require(_0x92e7('0x17'));var licenseUtil=require(_0x92e7('0x18'));var db=require(_0x92e7('0x19'))['db'];function respondWithStatusCode(_0x25c811,_0x2ec452){_0x2ec452=_0x2ec452||0xcc;return function(_0x1239bc){if(_0x1239bc){return _0x25c811['sendStatus'](_0x2ec452);}return _0x25c811['status'](_0x2ec452)[_0x92e7('0x1a')]();};}function respondWithResult(_0x210f1a,_0x48171d){_0x48171d=_0x48171d||0xc8;return function(_0x3ced0e){if(_0x3ced0e){return _0x210f1a['status'](_0x48171d)[_0x92e7('0x1b')](_0x3ced0e);}};}function respondWithFilteredResult(_0x2fe215,_0x242a6e){return function(_0x484d55){if(_0x484d55){var _0x297ea2=typeof _0x242a6e['offset']===_0x92e7('0x1c')&&typeof _0x242a6e['limit']===_0x92e7('0x1c');var _0x19bc33=_0x484d55[_0x92e7('0x1d')];var _0x1361af=_0x297ea2?0x0:_0x242a6e[_0x92e7('0x1e')];var _0x25cfc6=_0x297ea2?_0x484d55[_0x92e7('0x1d')]:_0x242a6e[_0x92e7('0x1e')]+_0x242a6e['limit'];var _0x28209f;if(_0x25cfc6>=_0x19bc33){_0x25cfc6=_0x19bc33;_0x28209f=0xc8;}else{_0x28209f=0xce;}_0x2fe215[_0x92e7('0x1f')](_0x28209f);return _0x2fe215['set'](_0x92e7('0x20'),_0x1361af+'-'+_0x25cfc6+'/'+_0x19bc33)['json'](_0x484d55);}return null;};}function patchUpdates(_0x394660){return function(_0x2d03e6){try{jsonpatch[_0x92e7('0x21')](_0x2d03e6,_0x394660,!![]);}catch(_0x3497f3){return BPromise['reject'](_0x3497f3);}return _0x2d03e6[_0x92e7('0x22')]();};}function saveUpdates(_0xc4585c,_0x4c1956){return function(_0x5b4977){if(_0x5b4977){return _0x5b4977[_0x92e7('0x23')](_0xc4585c)[_0x92e7('0x24')](function(_0x4e3725){return _0x4e3725;});}return null;};}function removeEntity(_0x30b470,_0x5c1020){return function(_0x2e5ae6){if(_0x2e5ae6){return _0x2e5ae6['destroy']()['then'](function(){_0x30b470[_0x92e7('0x1f')](0xcc)[_0x92e7('0x1a')]();});}};}function handleEntityNotFound(_0x4baf25,_0xc02390){return function(_0x25a10c){if(!_0x25a10c){_0x4baf25[_0x92e7('0x25')](0x194);}return _0x25a10c;};}function handleError(_0x19517b,_0x4d7f77){_0x4d7f77=_0x4d7f77||0x1f4;return function(_0x2d9e7e){logger[_0x92e7('0x26')](_0x2d9e7e[_0x92e7('0x27')]);if(_0x2d9e7e[_0x92e7('0x28')]){delete _0x2d9e7e[_0x92e7('0x28')];}_0x19517b[_0x92e7('0x1f')](_0x4d7f77)[_0x92e7('0x29')](_0x2d9e7e);};}exports[_0x92e7('0x2a')]=function(_0x52fa71,_0xfe7155){var _0x1a5b26={},_0x18ff02={},_0x1498e2={'count':0x0,'rows':[]};var _0x214426=_[_0x92e7('0x2b')](db['DeskField'][_0x92e7('0x2c')],function(_0x5d8433){return{'name':_0x5d8433['fieldName'],'type':_0x5d8433[_0x92e7('0x2d')][_0x92e7('0x2e')]};});_0x18ff02[_0x92e7('0x2f')]=_[_0x92e7('0x2b')](_0x214426,_0x92e7('0x28'));_0x18ff02[_0x92e7('0x30')]=_['keys'](_0x52fa71[_0x92e7('0x30')]);_0x18ff02[_0x92e7('0x31')]=_[_0x92e7('0x32')](_0x18ff02[_0x92e7('0x2f')],_0x18ff02[_0x92e7('0x30')]);_0x1a5b26[_0x92e7('0x33')]=_[_0x92e7('0x32')](_0x18ff02[_0x92e7('0x2f')],qs[_0x92e7('0x34')](_0x52fa71[_0x92e7('0x30')][_0x92e7('0x34')]));_0x1a5b26['attributes']=_0x1a5b26['attributes'][_0x92e7('0x35')]?_0x1a5b26['attributes']:_0x18ff02[_0x92e7('0x2f')];if(!_0x52fa71[_0x92e7('0x30')][_0x92e7('0x36')]('nolimit')){_0x1a5b26['limit']=qs[_0x92e7('0x37')](_0x52fa71[_0x92e7('0x30')][_0x92e7('0x37')]);_0x1a5b26[_0x92e7('0x1e')]=qs['offset'](_0x52fa71[_0x92e7('0x30')][_0x92e7('0x1e')]);}_0x1a5b26[_0x92e7('0x38')]=qs['sort'](_0x52fa71[_0x92e7('0x30')][_0x92e7('0x39')]);_0x1a5b26['where']=qs[_0x92e7('0x31')](_[_0x92e7('0x3a')](_0x52fa71[_0x92e7('0x30')],_0x18ff02[_0x92e7('0x31')]),_0x214426);if(_0x52fa71['query'][_0x92e7('0x3b')]){_0x1a5b26[_0x92e7('0x3c')]=_[_0x92e7('0x3d')](_0x1a5b26[_0x92e7('0x3c')],{'$or':_['map'](_0x214426,function(_0x1e9a6d){if(_0x1e9a6d[_0x92e7('0x2d')]!==_0x92e7('0x3e')){var _0x3cdf5f={};_0x3cdf5f[_0x1e9a6d[_0x92e7('0x28')]]={'$like':'%'+_0x52fa71[_0x92e7('0x30')][_0x92e7('0x3b')]+'%'};return _0x3cdf5f;}})});}_0x1a5b26=_[_0x92e7('0x3d')]({},_0x1a5b26,_0x52fa71['options']);var _0x59bc4e={'where':_0x1a5b26['where']};return db[_0x92e7('0x3f')][_0x92e7('0x1d')](_0x59bc4e)['then'](function(_0x375806){_0x1498e2[_0x92e7('0x1d')]=_0x375806;if(_0x52fa71[_0x92e7('0x30')][_0x92e7('0x40')]){_0x1a5b26[_0x92e7('0x41')]=[{'all':!![]}];}return db[_0x92e7('0x3f')][_0x92e7('0x42')](_0x1a5b26);})[_0x92e7('0x24')](function(_0x274a9b){_0x1498e2['rows']=_0x274a9b;return _0x1498e2;})['then'](respondWithFilteredResult(_0xfe7155,_0x1a5b26))['catch'](handleError(_0xfe7155,null));};exports[_0x92e7('0x43')]=function(_0x2af661,_0x53a4fd){var _0x194d36={'raw':!![],'where':{'id':_0x2af661[_0x92e7('0x44')]['id']}},_0x498a89={};_0x498a89[_0x92e7('0x2f')]=_['keys'](db[_0x92e7('0x3f')]['rawAttributes']);_0x498a89[_0x92e7('0x30')]=_[_0x92e7('0x45')](_0x2af661[_0x92e7('0x30')]);_0x498a89[_0x92e7('0x31')]=_[_0x92e7('0x32')](_0x498a89['model'],_0x498a89[_0x92e7('0x30')]);_0x194d36[_0x92e7('0x33')]=_['intersection'](_0x498a89[_0x92e7('0x2f')],qs[_0x92e7('0x34')](_0x2af661['query'][_0x92e7('0x34')]));_0x194d36[_0x92e7('0x33')]=_0x194d36['attributes'][_0x92e7('0x35')]?_0x194d36['attributes']:_0x498a89['model'];if(_0x2af661[_0x92e7('0x30')][_0x92e7('0x40')]){_0x194d36[_0x92e7('0x41')]=[{'all':!![]}];}_0x194d36=_[_0x92e7('0x3d')]({},_0x194d36,_0x2af661[_0x92e7('0x46')]);return db['DeskField']['find'](_0x194d36)[_0x92e7('0x24')](handleEntityNotFound(_0x53a4fd,null))[_0x92e7('0x24')](respondWithResult(_0x53a4fd,null))[_0x92e7('0x47')](handleError(_0x53a4fd,null));};exports[_0x92e7('0x48')]=function(_0x3cfeef,_0x5a5cb3){return db['DeskField']['create'](_0x3cfeef[_0x92e7('0x49')],{})[_0x92e7('0x24')](respondWithResult(_0x5a5cb3,0xc9))[_0x92e7('0x47')](handleError(_0x5a5cb3,null));};exports[_0x92e7('0x23')]=function(_0x298012,_0xc220c9){if(_0x298012[_0x92e7('0x49')]['id']){delete _0x298012[_0x92e7('0x49')]['id'];}return db[_0x92e7('0x3f')][_0x92e7('0x4a')]({'where':{'id':_0x298012[_0x92e7('0x44')]['id']}})[_0x92e7('0x24')](handleEntityNotFound(_0xc220c9,null))[_0x92e7('0x24')](saveUpdates(_0x298012[_0x92e7('0x49')],null))[_0x92e7('0x24')](respondWithResult(_0xc220c9,null))['catch'](handleError(_0xc220c9,null));};exports[_0x92e7('0x4b')]=function(_0x5ae6ca,_0xbb125d){return db[_0x92e7('0x3f')][_0x92e7('0x4a')]({'where':{'id':_0x5ae6ca[_0x92e7('0x44')]['id']}})[_0x92e7('0x24')](handleEntityNotFound(_0xbb125d,null))[_0x92e7('0x24')](removeEntity(_0xbb125d,null))[_0x92e7('0x47')](handleError(_0xbb125d,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 50d8764..3e85056 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 _0x7def=['../../config/environment','exports','define','DeskField','int_desk_fields','idField','FieldId','lodash','util','../../config/logger','api','request-promise'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x7def,0xf7));var _0xf7de=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x7def[_0x21549c];return _0x426cbd;};'use strict';var _=require(_0xf7de('0x0'));var util=require(_0xf7de('0x1'));var logger=require(_0xf7de('0x2'))(_0xf7de('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf7de('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf7de('0x5'));var attributes=require('./intDeskField.attributes');module[_0xf7de('0x6')]=function(_0x5cdc7b,_0x5911ca){return _0x5cdc7b[_0xf7de('0x7')](_0xf7de('0x8'),attributes,{'tableName':_0xf7de('0x9'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0xf7de('0xa'),_0xf7de('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe6b7=['util','api','moment','bluebird','request-promise','path','rimraf','./intDeskField.attributes','define','DeskField','idField','FieldId','lodash'];(function(_0x12723c,_0x148a5a){var _0x3fc804=function(_0x810da6){while(--_0x810da6){_0x12723c['push'](_0x12723c['shift']());}};_0x3fc804(++_0x148a5a);}(_0xe6b7,0x110));var _0x7e6b=function(_0x1855c1,_0x5d3073){_0x1855c1=_0x1855c1-0x0;var _0x489971=_0xe6b7[_0x1855c1];return _0x489971;};'use strict';var _=require(_0x7e6b('0x0'));var util=require(_0x7e6b('0x1'));var logger=require('../../config/logger')(_0x7e6b('0x2'));var moment=require(_0x7e6b('0x3'));var BPromise=require(_0x7e6b('0x4'));var rp=require(_0x7e6b('0x5'));var fs=require('fs');var path=require(_0x7e6b('0x6'));var rimraf=require(_0x7e6b('0x7'));var config=require('../../config/environment');var attributes=require(_0x7e6b('0x8'));module['exports']=function(_0x2d2c1d,_0xa24be9){return _0x2d2c1d[_0x7e6b('0x9')](_0x7e6b('0xa'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x7e6b('0xb'),_0x7e6b('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 9278fac..e252acf 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 _0x9516=['result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x43776a,_0x4eb74c){var _0x18eb8f=function(_0x319afb){while(--_0x319afb){_0x43776a['push'](_0x43776a['shift']());}};_0x18eb8f(++_0x4eb74c);}(_0x9516,0xca));var _0x6951=function(_0x354404,_0x141542){_0x354404=_0x354404-0x0;var _0x1c10f8=_0x9516[_0x354404];return _0x1c10f8;};'use strict';var _=require('lodash');var util=require(_0x6951('0x0'));var moment=require(_0x6951('0x1'));var BPromise=require(_0x6951('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6951('0x3'))['db'];var utils=require(_0x6951('0x4'));var logger=require(_0x6951('0x5'))(_0x6951('0x6'));var config=require('../../config/environment');var jayson=require(_0x6951('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5e1689,_0xec55d7,_0x2736a8){return new BPromise(function(_0x2fa692,_0x389d62){return client[_0x6951('0x8')](_0x5e1689,_0x2736a8)['then'](function(_0x5d9daa){logger[_0x6951('0x9')](_0x6951('0xa'),_0xec55d7,_0x6951('0xb'));logger[_0x6951('0xc')](_0x6951('0xd'),_0xec55d7,_0x6951('0xb'),JSON[_0x6951('0xe')](_0x5d9daa));if(_0x5d9daa[_0x6951('0xf')]){if(_0x5d9daa[_0x6951('0xf')][_0x6951('0x10')]===0x1f4){logger[_0x6951('0xf')](_0x6951('0xa'),_0xec55d7,_0x5d9daa[_0x6951('0xf')]['message']);return _0x389d62(_0x5d9daa['error'][_0x6951('0x11')]);}logger[_0x6951('0xf')](_0x6951('0xa'),_0xec55d7,_0x5d9daa[_0x6951('0xf')][_0x6951('0x11')]);return _0x2fa692(_0x5d9daa['error'][_0x6951('0x11')]);}else{logger[_0x6951('0x9')](_0x6951('0xa'),_0xec55d7,_0x6951('0xb'));_0x2fa692(_0x5d9daa[_0x6951('0x12')][_0x6951('0x11')]);}})[_0x6951('0x13')](function(_0xdbcb38){logger['error']('DeskField,\x20%s,\x20%s',_0xec55d7,_0xdbcb38);_0x389d62(_0xdbcb38);});});} \ No newline at end of file +var _0xc739=['request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','DeskField,\x20%s,\x20%s'];(function(_0x5d0004,_0x4bcb9a){var _0x4be732=function(_0x30e2f4){while(--_0x30e2f4){_0x5d0004['push'](_0x5d0004['shift']());}};_0x4be732(++_0x4bcb9a);}(_0xc739,0xaf));var _0x9c73=function(_0x2a6d37,_0x1a393c){_0x2a6d37=_0x2a6d37-0x0;var _0x5c36db=_0xc739[_0x2a6d37];return _0x5c36db;};'use strict';var _=require(_0x9c73('0x0'));var util=require('util');var moment=require(_0x9c73('0x1'));var BPromise=require('bluebird');var rs=require(_0x9c73('0x2'));var fs=require('fs');var Redis=require(_0x9c73('0x3'));var db=require(_0x9c73('0x4'))['db'];var utils=require(_0x9c73('0x5'));var logger=require(_0x9c73('0x6'))(_0x9c73('0x7'));var config=require(_0x9c73('0x8'));var jayson=require(_0x9c73('0x9'));var client=jayson['client'][_0x9c73('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1418c0,_0x40f379,_0x16fe3d){return new BPromise(function(_0x459486,_0x39e5e5){return client[_0x9c73('0xb')](_0x1418c0,_0x16fe3d)[_0x9c73('0xc')](function(_0x336170){logger['info'](_0x9c73('0xd'),_0x40f379,_0x9c73('0xe'));logger[_0x9c73('0xf')](_0x9c73('0x10'),_0x40f379,_0x9c73('0xe'),JSON[_0x9c73('0x11')](_0x336170));if(_0x336170[_0x9c73('0x12')]){if(_0x336170[_0x9c73('0x12')]['code']===0x1f4){logger[_0x9c73('0x12')](_0x9c73('0xd'),_0x40f379,_0x336170[_0x9c73('0x12')]['message']);return _0x39e5e5(_0x336170[_0x9c73('0x12')][_0x9c73('0x13')]);}logger[_0x9c73('0x12')](_0x9c73('0xd'),_0x40f379,_0x336170[_0x9c73('0x12')][_0x9c73('0x13')]);return _0x459486(_0x336170['error']['message']);}else{logger['info'](_0x9c73('0xd'),_0x40f379,'request\x20sent');_0x459486(_0x336170[_0x9c73('0x14')][_0x9c73('0x13')]);}})['catch'](function(_0x57f82d){logger[_0x9c73('0x12')](_0x9c73('0xd'),_0x40f379,_0x57f82d);_0x39e5e5(_0x57f82d);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 36fe5af..7c0eab9 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 _0x56e8=['delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','post','create','addConfiguration','put','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x56e8,0x162));var _0x856e=function(_0x465c53,_0x313f50){_0x465c53=_0x465c53-0x0;var _0x4d0e3d=_0x56e8[_0x465c53];return _0x4d0e3d;};'use strict';var multer=require(_0x856e('0x0'));var util=require(_0x856e('0x1'));var path=require(_0x856e('0x2'));var timeout=require(_0x856e('0x3'));var express=require('express');var router=express[_0x856e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x856e('0x5'));var interaction=require(_0x856e('0x6'));var config=require(_0x856e('0x7'));var controller=require(_0x856e('0x8'));router[_0x856e('0x9')]('/',auth[_0x856e('0xa')](),controller['index']);router['get'](_0x856e('0xb'),auth[_0x856e('0xa')](),controller[_0x856e('0xc')]);router[_0x856e('0x9')](_0x856e('0xd'),auth[_0x856e('0xa')](),controller[_0x856e('0xe')]);router[_0x856e('0x9')]('/:id/fields',auth[_0x856e('0xa')](),controller['getFields']);router[_0x856e('0xf')]('/',auth[_0x856e('0xa')](),controller[_0x856e('0x10')]);router[_0x856e('0xf')](_0x856e('0xd'),auth['isAuthenticated'](),controller[_0x856e('0x11')]);router[_0x856e('0x12')]('/:id',auth[_0x856e('0xa')](),controller[_0x856e('0x13')]);router[_0x856e('0x14')](_0x856e('0xb'),auth[_0x856e('0xa')](),controller['destroy']);module[_0x856e('0x15')]=router; \ No newline at end of file +var _0x5cd4=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration','put','/:id','update','delete','destroy'];(function(_0x99facc,_0x548cd6){var _0xd39ed0=function(_0x207e47){while(--_0x207e47){_0x99facc['push'](_0x99facc['shift']());}};_0xd39ed0(++_0x548cd6);}(_0x5cd4,0x15f));var _0x45cd=function(_0x1d55e6,_0x5cd80e){_0x1d55e6=_0x1d55e6-0x0;var _0x121c4b=_0x5cd4[_0x1d55e6];return _0x121c4b;};'use strict';var multer=require(_0x45cd('0x0'));var util=require(_0x45cd('0x1'));var path=require(_0x45cd('0x2'));var timeout=require('connect-timeout');var express=require(_0x45cd('0x3'));var router=express[_0x45cd('0x4')]();var fs_extra=require(_0x45cd('0x5'));var auth=require(_0x45cd('0x6'));var interaction=require(_0x45cd('0x7'));var config=require(_0x45cd('0x8'));var controller=require(_0x45cd('0x9'));router[_0x45cd('0xa')]('/',auth[_0x45cd('0xb')](),controller[_0x45cd('0xc')]);router[_0x45cd('0xa')]('/:id',auth[_0x45cd('0xb')](),controller[_0x45cd('0xd')]);router[_0x45cd('0xa')](_0x45cd('0xe'),auth[_0x45cd('0xb')](),controller[_0x45cd('0xf')]);router[_0x45cd('0xa')](_0x45cd('0x10'),auth[_0x45cd('0xb')](),controller['getFields']);router[_0x45cd('0x11')]('/',auth[_0x45cd('0xb')](),controller['create']);router[_0x45cd('0x11')](_0x45cd('0xe'),auth['isAuthenticated'](),controller[_0x45cd('0x12')]);router[_0x45cd('0x13')](_0x45cd('0x14'),auth[_0x45cd('0xb')](),controller[_0x45cd('0x15')]);router[_0x45cd('0x16')]('/:id',auth[_0x45cd('0xb')](),controller[_0x45cd('0x17')]);module[_0x45cd('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 87dd9ec..4cfb93c 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 _0x0c42=['BOOLEAN','sequelize','exports','STRING'];(function(_0x4993ab,_0x5dce73){var _0x3d87f8=function(_0x2593c2){while(--_0x2593c2){_0x4993ab['push'](_0x4993ab['shift']());}};_0x3d87f8(++_0x5dce73);}(_0x0c42,0x191));var _0x20c4=function(_0xa5994f,_0x594f2d){_0xa5994f=_0xa5994f-0x0;var _0x4d578e=_0x0c42[_0xa5994f];return _0x4d578e;};'use strict';var Sequelize=require(_0x20c4('0x0'));module[_0x20c4('0x1')]={'name':{'type':Sequelize[_0x20c4('0x2')]},'username':{'type':Sequelize[_0x20c4('0x2')]},'password':{'type':Sequelize[_0x20c4('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x20c4('0x2')]},'clientSecret':{'type':Sequelize[_0x20c4('0x2')]},'serverUrl':{'type':Sequelize[_0x20c4('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x20c4('0x2')]},'modernAuthentication':{'type':Sequelize[_0x20c4('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x1247=['STRING','BOOLEAN','sequelize','exports'];(function(_0x185334,_0x4630ac){var _0xf2e59a=function(_0x3cc497){while(--_0x3cc497){_0x185334['push'](_0x185334['shift']());}};_0xf2e59a(++_0x4630ac);}(_0x1247,0xb6));var _0x7124=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x1247[_0x3511d3];return _0x5d6321;};'use strict';var Sequelize=require(_0x7124('0x0'));module[_0x7124('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x7124('0x2')]},'remoteUri':{'type':Sequelize[_0x7124('0x2')]},'tenantId':{'type':Sequelize[_0x7124('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x7124('0x2')]},'serverUrl':{'type':Sequelize[_0x7124('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7124('0x2')]},'modernAuthentication':{'type':Sequelize[_0x7124('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 7c908f6..ce73606 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 _0x1611=['util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','offset','undefined','limit','count','set','json','update','then','destroy','error','stack','name','send','index','Dynamics365Account','rawAttributes','type','model','map','keys','intersection','query','attributes','fields','length','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','show','find','catch','create','body','params','getConfigurations','findOne','Dynamics365Configuration','nolimit','AccountId','getSubjects','Descriptions','channel','Subjects','Dynamics365Field','slice','substring','lastIndexOf','%s/api/data/v9.0/','getFields','ticketType','incident','PhoneCall','title','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidyominame','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','emailaddress','entitlementidname','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','productserialnumber','resolveby','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','versionnumber','concat','username','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','access_token','data5','/oauth2/token','password','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','all','isNil','BooleanAttributeMetadata','push','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','DecimalAttributeMetadata','test','Wrong\x20credentials','statusCode','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','UserLocalizedLabel','Value','DisplayName','Label',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x1611,0xb9));var _0x1161=function(_0x367387,_0x152aec){_0x367387=_0x367387-0x0;var _0x146e53=_0x1611[_0x367387];return _0x146e53;};'use strict';var rp=require(_0x1161('0x0'));var util=require(_0x1161('0x1'));var _=require(_0x1161('0x2'));var qs=require(_0x1161('0x3'));var logger=require(_0x1161('0x4'))(_0x1161('0x5'));var db=require(_0x1161('0x6'))['db'];var integrations=require(_0x1161('0x7'));function respondWithResult(_0xc19c53,_0x126c04){_0x126c04=_0x126c04||0xc8;return function(_0x5d8228){if(_0x5d8228){return _0xc19c53[_0x1161('0x8')](_0x126c04)['json'](_0x5d8228);}};}function respondWithFilteredResult(_0x1ab40a,_0xf5f3ee){return function(_0x12fb93){if(_0x12fb93){var _0x532ca2=typeof _0xf5f3ee[_0x1161('0x9')]===_0x1161('0xa')&&typeof _0xf5f3ee[_0x1161('0xb')]===_0x1161('0xa');var _0x5a9fb9=_0x12fb93['count'];var _0x4a080a=_0x532ca2?0x0:_0xf5f3ee[_0x1161('0x9')];var _0xae99d8=_0x532ca2?_0x12fb93[_0x1161('0xc')]:_0xf5f3ee[_0x1161('0x9')]+_0xf5f3ee['limit'];var _0x15adc3;if(_0xae99d8>=_0x5a9fb9){_0xae99d8=_0x5a9fb9;_0x15adc3=0xc8;}else{_0x15adc3=0xce;}_0x1ab40a['status'](_0x15adc3);return _0x1ab40a[_0x1161('0xd')]('Content-Range',_0x4a080a+'-'+_0xae99d8+'/'+_0x5a9fb9)[_0x1161('0xe')](_0x12fb93);}return null;};}function saveUpdates(_0x28a6f8){return function(_0x5ccbb9){if(_0x5ccbb9){return _0x5ccbb9[_0x1161('0xf')](_0x28a6f8)[_0x1161('0x10')](function(_0x2cdb81){return _0x2cdb81;});}return null;};}function removeEntity(_0x53cdca){return function(_0x7d310e){if(_0x7d310e){return _0x7d310e[_0x1161('0x11')]()[_0x1161('0x10')](function(){_0x53cdca['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c2f46){return function(_0x4b535f){if(!_0x4b535f){_0x4c2f46['sendStatus'](0x194);}return _0x4b535f;};}function handleError(_0x193de0,_0x8786e8){_0x8786e8=_0x8786e8||0x1f4;return function(_0x3c9cff){logger[_0x1161('0x12')](_0x3c9cff[_0x1161('0x13')]);if(_0x3c9cff['name']){delete _0x3c9cff[_0x1161('0x14')];}_0x193de0[_0x1161('0x8')](_0x8786e8)[_0x1161('0x15')](_0x3c9cff);};}exports[_0x1161('0x16')]=function(_0x53d68a,_0x43dd10){var _0x464fb1={},_0x25a273={},_0x25467a={'count':0x0,'rows':[]};var _0x28642e=_['map'](db[_0x1161('0x17')][_0x1161('0x18')],function(_0x33beda){return{'name':_0x33beda['fieldName'],'type':_0x33beda[_0x1161('0x19')]['key']};});_0x25a273[_0x1161('0x1a')]=_[_0x1161('0x1b')](_0x28642e,'name');_0x25a273['query']=_[_0x1161('0x1c')](_0x53d68a['query']);_0x25a273['filters']=_[_0x1161('0x1d')](_0x25a273[_0x1161('0x1a')],_0x25a273[_0x1161('0x1e')]);_0x464fb1[_0x1161('0x1f')]=_[_0x1161('0x1d')](_0x25a273[_0x1161('0x1a')],qs['fields'](_0x53d68a['query'][_0x1161('0x20')]));_0x464fb1[_0x1161('0x1f')]=_0x464fb1[_0x1161('0x1f')][_0x1161('0x21')]?_0x464fb1[_0x1161('0x1f')]:_0x25a273[_0x1161('0x1a')];if(!_0x53d68a['query']['hasOwnProperty']('nolimit')){_0x464fb1[_0x1161('0xb')]=qs['limit'](_0x53d68a['query'][_0x1161('0xb')]);_0x464fb1[_0x1161('0x9')]=qs[_0x1161('0x9')](_0x53d68a[_0x1161('0x1e')][_0x1161('0x9')]);}_0x464fb1[_0x1161('0x22')]=qs[_0x1161('0x23')](_0x53d68a[_0x1161('0x1e')][_0x1161('0x23')]);_0x464fb1[_0x1161('0x24')]=qs[_0x1161('0x25')](_[_0x1161('0x26')](_0x53d68a['query'],_0x25a273[_0x1161('0x25')]),_0x28642e);if(_0x53d68a[_0x1161('0x1e')][_0x1161('0x27')]){_0x464fb1[_0x1161('0x24')]=_[_0x1161('0x28')](_0x464fb1[_0x1161('0x24')],{'$or':_[_0x1161('0x1b')](_0x28642e,function(_0x295f05){if(_0x295f05[_0x1161('0x19')]!=='VIRTUAL'){var _0x273552={};_0x273552[_0x295f05[_0x1161('0x14')]]={'$like':'%'+_0x53d68a[_0x1161('0x1e')][_0x1161('0x27')]+'%'};return _0x273552;}})});}_0x464fb1=_[_0x1161('0x28')]({},_0x464fb1,_0x53d68a[_0x1161('0x29')]);var _0x25f0c3={'where':_0x464fb1[_0x1161('0x24')]};return db[_0x1161('0x17')][_0x1161('0xc')](_0x25f0c3)['then'](function(_0x307bd6){_0x25467a[_0x1161('0xc')]=_0x307bd6;if(_0x53d68a['query'][_0x1161('0x2a')]){_0x464fb1[_0x1161('0x2b')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x1161('0x2c')](_0x464fb1);})[_0x1161('0x10')](function(_0x7fcf1a){_0x25467a[_0x1161('0x2d')]=_0x7fcf1a;return _0x25467a;})['then'](respondWithFilteredResult(_0x43dd10,_0x464fb1))['catch'](handleError(_0x43dd10,null));};exports[_0x1161('0x2e')]=function(_0x10c36b,_0x17d4f6){var _0x2a15d6={'raw':![],'where':{'id':_0x10c36b['params']['id']}},_0x581f8b={};_0x581f8b[_0x1161('0x1a')]=_[_0x1161('0x1c')](db['Dynamics365Account'][_0x1161('0x18')]);_0x581f8b[_0x1161('0x1e')]=_[_0x1161('0x1c')](_0x10c36b[_0x1161('0x1e')]);_0x581f8b[_0x1161('0x25')]=_['intersection'](_0x581f8b['model'],_0x581f8b['query']);_0x2a15d6['attributes']=_[_0x1161('0x1d')](_0x581f8b['model'],qs[_0x1161('0x20')](_0x10c36b['query'][_0x1161('0x20')]));_0x2a15d6[_0x1161('0x1f')]=_0x2a15d6[_0x1161('0x1f')]['length']?_0x2a15d6[_0x1161('0x1f')]:_0x581f8b[_0x1161('0x1a')];if(_0x10c36b[_0x1161('0x1e')][_0x1161('0x2a')]){_0x2a15d6[_0x1161('0x2b')]=[{'all':!![]}];}_0x2a15d6=_[_0x1161('0x28')]({},_0x2a15d6,_0x10c36b[_0x1161('0x29')]);return db[_0x1161('0x17')][_0x1161('0x2f')](_0x2a15d6)[_0x1161('0x10')](handleEntityNotFound(_0x17d4f6,null))[_0x1161('0x10')](respondWithResult(_0x17d4f6,null))[_0x1161('0x30')](handleError(_0x17d4f6,null));};exports['create']=function(_0x414914,_0x361af7){return db[_0x1161('0x17')][_0x1161('0x31')](_0x414914[_0x1161('0x32')],{})[_0x1161('0x10')](respondWithResult(_0x361af7,0xc9))[_0x1161('0x30')](handleError(_0x361af7,null));};exports['update']=function(_0x550056,_0x58d249){if(_0x550056[_0x1161('0x32')]['id']){delete _0x550056[_0x1161('0x32')]['id'];}return db[_0x1161('0x17')][_0x1161('0x2f')]({'where':{'id':_0x550056[_0x1161('0x33')]['id']}})[_0x1161('0x10')](handleEntityNotFound(_0x58d249,null))['then'](saveUpdates(_0x550056[_0x1161('0x32')],null))[_0x1161('0x10')](respondWithResult(_0x58d249,null))[_0x1161('0x30')](handleError(_0x58d249,null));};exports[_0x1161('0x11')]=function(_0xb27b24,_0xd775dd){return db[_0x1161('0x17')]['find']({'where':{'id':_0xb27b24['params']['id']}})[_0x1161('0x10')](handleEntityNotFound(_0xd775dd,null))[_0x1161('0x10')](removeEntity(_0xd775dd,null))[_0x1161('0x30')](handleError(_0xd775dd,null));};exports[_0x1161('0x34')]=function(_0x2878d2,_0x153948){var _0x90f21e={};var _0xa3ca63={};var _0x399c04;var _0x2e1460;return db[_0x1161('0x17')][_0x1161('0x35')]({'where':{'id':_0x2878d2['params']['id']}})[_0x1161('0x10')](handleEntityNotFound(_0x153948,null))[_0x1161('0x10')](function(_0x42dd94){if(_0x42dd94){_0x399c04=_0x42dd94;_0xa3ca63[_0x1161('0x1a')]=_[_0x1161('0x1c')](db[_0x1161('0x36')][_0x1161('0x18')]);_0xa3ca63[_0x1161('0x1e')]=_['keys'](_0x2878d2[_0x1161('0x1e')]);_0xa3ca63[_0x1161('0x25')]=_[_0x1161('0x1d')](_0xa3ca63['model'],_0xa3ca63[_0x1161('0x1e')]);_0x90f21e[_0x1161('0x1f')]=_[_0x1161('0x1d')](_0xa3ca63[_0x1161('0x1a')],qs[_0x1161('0x20')](_0x2878d2['query'][_0x1161('0x20')]));_0x90f21e[_0x1161('0x1f')]=_0x90f21e[_0x1161('0x1f')]['length']?_0x90f21e['attributes']:_0xa3ca63[_0x1161('0x1a')];_0x90f21e[_0x1161('0x22')]=qs[_0x1161('0x23')](_0x2878d2[_0x1161('0x1e')]['sort']);_0x90f21e[_0x1161('0x24')]=qs[_0x1161('0x25')](_[_0x1161('0x26')](_0x2878d2['query'],_0xa3ca63['filters']));if(_0x2878d2['query'][_0x1161('0x27')]){_0x90f21e[_0x1161('0x24')]=_[_0x1161('0x28')](_0x90f21e['where'],{'$or':_[_0x1161('0x1b')](_0x90f21e['attributes'],function(_0x560a9d){var _0x2cdd9d={};_0x2cdd9d[_0x560a9d]={'$like':'%'+_0x2878d2[_0x1161('0x1e')][_0x1161('0x27')]+'%'};return _0x2cdd9d;})});}_0x90f21e=_[_0x1161('0x28')]({},_0x90f21e,_0x2878d2['options']);return _0x399c04[_0x1161('0x34')](_0x90f21e);}})['then'](function(_0x35df8f){if(_0x35df8f){_0x2e1460=_0x35df8f[_0x1161('0x21')];if(!_0x2878d2[_0x1161('0x1e')]['hasOwnProperty'](_0x1161('0x37'))){_0x90f21e[_0x1161('0xb')]=qs[_0x1161('0xb')](_0x2878d2[_0x1161('0x1e')][_0x1161('0xb')]);_0x90f21e[_0x1161('0x9')]=qs[_0x1161('0x9')](_0x2878d2[_0x1161('0x1e')][_0x1161('0x9')]);}return _0x399c04[_0x1161('0x34')](_0x90f21e);}})[_0x1161('0x10')](function(_0x539e62){if(_0x539e62){return _0x539e62?{'count':_0x2e1460,'rows':_0x539e62}:null;}})[_0x1161('0x10')](respondWithResult(_0x153948,null))[_0x1161('0x30')](handleError(_0x153948,null));};exports['addConfiguration']=function(_0x51dcf9,_0x1069e6){if(_0x51dcf9['body']['id']){delete _0x51dcf9['body']['id'];}return db[_0x1161('0x17')][_0x1161('0x35')]({'where':{'id':_0x51dcf9[_0x1161('0x33')]['id']}})[_0x1161('0x10')](handleEntityNotFound(_0x1069e6,null))['then'](function(_0x17c398){if(_0x17c398){_0x51dcf9[_0x1161('0x32')][_0x1161('0x38')]=_0x17c398['id'];_0x51dcf9[_0x1161('0x32')]['Subjects']=integrations[_0x1161('0x39')](_0x51dcf9[_0x1161('0x32')]['channel'],_0x51dcf9[_0x1161('0x32')][_0x1161('0x19')]);_0x51dcf9[_0x1161('0x32')][_0x1161('0x3a')]=integrations['getDescriptions'](_0x51dcf9[_0x1161('0x32')][_0x1161('0x3b')],_0x51dcf9[_0x1161('0x32')]['type']);return db['Dynamics365Configuration'][_0x1161('0x31')](_0x51dcf9['body'],{'include':[{'model':db['Dynamics365Field'],'as':_0x1161('0x3c')},{'model':db[_0x1161('0x3d')],'as':'Descriptions'}]});}return null;})[_0x1161('0x10')](respondWithResult(_0x1069e6,null))['catch'](handleError(_0x1069e6,null));};function sanitizeRemoteUri(_0x36dbf7){var _0x58c850=_0x36dbf7[_0x1161('0x3e')](-0x1);if(_0x58c850==='/')return _0x36dbf7[_0x1161('0x3f')](0x0,_0x36dbf7[_0x1161('0x40')](_0x58c850));return _0x36dbf7;}function getWebApiUrl(_0x2b0ec3){return util['format'](_0x1161('0x41'),_0x2b0ec3);}exports[_0x1161('0x42')]=function(_0x5ab9ff,_0x48fd82){var _0x2ef9a4=_0x5ab9ff['query'][_0x1161('0x43')];var _0x1e4bf0=_0x2ef9a4===_0x1161('0x44')?'Incident':_0x1161('0x45');var _0x45b806='';var _0x14a1e7='';var _0x10865d='';var _0x2eec0='';var _0x54b60f='';var _0x499dab='';var _0x4636a7='';var _0x7b58e6='';var _0x3ef8db=[_0x1161('0x46'),'description',_0x1161('0x47'),_0x1161('0x48'),_0x1161('0x49'),_0x1161('0x4a'),_0x1161('0x4b'),_0x1161('0x4c'),'directioncode',_0x1161('0x4d')];var _0x4eebbf=[_0x1161('0x4e'),_0x1161('0x4f'),_0x1161('0x50'),_0x1161('0x51'),'contactidname',_0x1161('0x52'),'contractdetailidname',_0x1161('0x53'),_0x1161('0x54'),_0x1161('0x55'),_0x1161('0x56'),_0x1161('0x57'),'createdon',_0x1161('0x58'),_0x1161('0x59'),_0x1161('0x5a'),'customeridtype','customeridyominame',_0x1161('0x5b'),_0x1161('0x5c'),'entityimage_timestamp',_0x1161('0x5d'),'escalatedon',_0x1161('0x5e'),_0x1161('0x5f'),_0x1161('0x60'),_0x1161('0x61'),_0x1161('0x62'),_0x1161('0x63'),'lastonholdtime',_0x1161('0x64'),_0x1161('0x65'),_0x1161('0x66'),'modifiedbyname',_0x1161('0x67'),_0x1161('0x68'),_0x1161('0x69'),_0x1161('0x6a'),_0x1161('0x6b'),'msdyn_iotalertname',_0x1161('0x6c'),_0x1161('0x6d'),_0x1161('0x6e'),_0x1161('0x6f'),_0x1161('0x70'),_0x1161('0x71'),_0x1161('0x72'),_0x1161('0x73'),_0x1161('0x74'),'prioritycodename','productidname',_0x1161('0x75'),_0x1161('0x76'),'resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue',_0x1161('0x77'),_0x1161('0x78'),_0x1161('0x79'),_0x1161('0x7a'),_0x1161('0x7b'),_0x1161('0x7c'),_0x1161('0x7d'),_0x1161('0x7e'),_0x1161('0x7f'),'traversedpath',_0x1161('0x80'),_0x1161('0x81')];var _0x529317=_0x3ef8db[_0x1161('0x82')](_0x4eebbf);return db['Dynamics365Account'][_0x1161('0x35')]({'where':{'id':_0x5ab9ff[_0x1161('0x33')]['id']},'attributes':['id',_0x1161('0x83'),'password',_0x1161('0x84'),_0x1161('0x85'),_0x1161('0x86'),_0x1161('0x87'),_0x1161('0x88')],'include':[{'model':db[_0x1161('0x89')],'as':_0x1161('0x89'),'attributes':['id','data5','data7']}]})[_0x1161('0x10')](handleEntityNotFound(_0x48fd82,null))[_0x1161('0x10')](function(_0x5c4512){if(_0x5c4512){if(_0x5c4512[_0x1161('0x88')]){_0x5c4512[_0x1161('0x8a')]=_0x5c4512[_0x1161('0x89')][_0x1161('0x8b')];_0x7b58e6=sanitizeRemoteUri(_0x5c4512[_0x1161('0x89')]['data7']);_0x4636a7=getWebApiUrl(_0x7b58e6);return _0x5c4512;}_0x7b58e6=sanitizeRemoteUri(_0x5c4512[_0x1161('0x84')]);_0x4636a7=getWebApiUrl(_0x7b58e6);var _0x2e90aa={'method':'POST','uri':'https://login.microsoftonline.com/'+_0x5c4512[_0x1161('0x85')]+_0x1161('0x8c'),'form':{'client_id':_0x5c4512[_0x1161('0x86')],'resource':_0x7b58e6,'username':_0x5c4512[_0x1161('0x83')],'password':_0x5c4512[_0x1161('0x8d')],'grant_type':_0x1161('0x8d'),'client_secret':_0x5c4512[_0x1161('0x87')]},'json':!![]};return rp(_0x2e90aa);}})[_0x1161('0x10')](function(_0x24c927){_0x499dab=_0x24c927[_0x1161('0x8a')];var _0x489a56={'method':_0x1161('0x8e'),'uri':encodeURI(_0x4636a7+_0x1161('0x8f')+_0x1e4bf0+'\x27'),'headers':{'Authorization':_0x1161('0x90')+_0x499dab,'If-None-Match':null,'OData-Version':_0x1161('0x91')},'json':!![]};return rp(_0x489a56);})[_0x1161('0x10')](function(_0x5921bf){var _0x2531e1=_0x5921bf[_0x1161('0x92')][0x0];var _0x1174fa=_0x2531e1[_0x1161('0x93')];var _0x34c6ea={'method':_0x1161('0x8e'),'uri':_0x4636a7+'EntityDefinitions('+_0x1174fa+_0x1161('0x94'),'headers':{'Authorization':_0x1161('0x90')+_0x499dab,'If-None-Match':null,'OData-Version':_0x1161('0x91')},'json':!![]};return rp(_0x34c6ea);})[_0x1161('0x10')](function(_0x24c0b8){_0x45b806=_0x24c0b8;_0x14a1e7=_0x45b806['Attributes'];_0x14a1e7=_[_0x1161('0x95')](_0x14a1e7,function(_0x5d5661){return!_0x529317[_0x1161('0x96')](_0x5d5661[_0x1161('0x97')]);});var _0x5292ec=[];var _0x25b21c=[];_0x14a1e7[_0x1161('0x98')](function(_0x27c79d){if(_0x27c79d[_0x1161('0x99')]){var _0x5cefb7=_0x27c79d[_0x1161('0x99')][_0x1161('0x3f')](_0x27c79d['@odata.type'][_0x1161('0x40')]('.')+0x1);if(_0x5cefb7===_0x1161('0x9a')){_0x5292ec['push'](getSelectList(_0x4636a7,_0x2ef9a4,_0x25b21c,_0x45b806[_0x1161('0x93')],_0x27c79d['MetadataId'],_0x499dab));}}});return Promise[_0x1161('0x9b')](_0x5292ec);})[_0x1161('0x10')](function(_0x1317f0){_0x10865d=_0x1317f0[0x0];var _0x2a8776=[];var _0x250c65=[];_0x14a1e7[_0x1161('0x98')](function(_0x466955){if(!_[_0x1161('0x9c')](_0x466955[_0x1161('0x99')])){var _0x540c42=_0x466955[_0x1161('0x99')][_0x1161('0x3f')](_0x466955[_0x1161('0x99')][_0x1161('0x40')]('.')+0x1);if(_0x540c42===_0x1161('0x9d')){_0x2a8776[_0x1161('0x9e')](getBooleanList(_0x4636a7,_0x2ef9a4,_0x250c65,_0x45b806[_0x1161('0x93')],_0x466955[_0x1161('0x93')],_0x499dab));}}});return Promise[_0x1161('0x9b')](_0x2a8776);})['then'](function(_0x283c77){_0x2eec0=_0x283c77[0x0];var _0xc427ff=[];var _0x27c6e5=[];_0x14a1e7[_0x1161('0x98')](function(_0x324173){if(_0x324173['@odata.type']){var _0x3167d4=_0x324173[_0x1161('0x99')]['substring'](_0x324173['@odata.type'][_0x1161('0x40')]('.')+0x1);if(_0x3167d4===_0x1161('0x9f')||_0x3167d4===_0x1161('0xa0')||_0x3167d4===_0x1161('0xa1')||_0x3167d4===_0x1161('0xa2')||_0x3167d4===_0x1161('0xa3')||_0x3167d4===_0x1161('0xa4')||_0x3167d4==='StatusAttributeMetadata'||_0x3167d4==='EntityNameAttributeMetadata'||_0x3167d4==='StateAttributeMetadata'||_0x3167d4===_0x1161('0xa5')){_0xc427ff[_0x1161('0x9e')](getInputList(_0x4636a7,_0x2ef9a4,_0x3167d4,_0x27c6e5,_0x45b806[_0x1161('0x93')],_0x324173[_0x1161('0x93')],_0x499dab));}}});return Promise[_0x1161('0x9b')](_0xc427ff);})[_0x1161('0x10')](function(_0x3c53ed){_0x54b60f=_0x3c53ed[0x0];var _0x1d9889=_0x10865d[_0x1161('0x82')](_0x2eec0)[_0x1161('0x82')](_0x54b60f);var _0x4dfbd1={'count':_0x1d9889[_0x1161('0x21')],'rows':_0x1d9889};return _0x4dfbd1;})[_0x1161('0x10')](respondWithResult(_0x48fd82,null))[_0x1161('0x30')](function(_0x32a58f){var _0x1fe62c=_0x5ab9ff[_0x1161('0x1e')][_0x1161('0xa6')]?0x1f4:_0x32a58f['statusCode']||0x1f4;logger[_0x1161('0x12')](_0x32a58f['stack']);delete _0x32a58f[_0x1161('0x14')];if(_0x1fe62c===0x191){_0x1fe62c=0x190;}_0x48fd82[_0x1161('0x8')](_0x1fe62c)['send'](_0x5ab9ff[_0x1161('0x1e')][_0x1161('0xa6')]?{'message':_0x1161('0xa7'),'statusCode':_0x32a58f[_0x1161('0xa8')]}:_0x32a58f);});};function getSelectList(_0x1d47ec,_0x8c4e86,_0x381dc6,_0x2a1740,_0x485f2b,_0x3b4e7a){var _0x42102a={'method':_0x1161('0x8e'),'uri':_0x1d47ec+_0x1161('0xa9')+_0x2a1740+_0x1161('0xaa')+_0x485f2b+_0x1161('0xab')+_0x1161('0xac'),'headers':{'Authorization':_0x1161('0x90')+_0x3b4e7a,'If-None-Match':null,'OData-Version':_0x1161('0x91')},'json':!![]};return rp(_0x42102a)[_0x1161('0x10')](function(_0x14d1f8){var _0xd1e4c0=[];var _0x2023a5=_0x14d1f8[_0x1161('0xad')][_0x1161('0xae')];_0x2023a5[_0x1161('0x98')](function(_0x5ad680){_0xd1e4c0[_0x1161('0x9e')]({'name':_0x5ad680['Label'][_0x1161('0xaf')]['Label'],'value':String(_0x5ad680[_0x1161('0xb0')])});});var _0x54c2f6={'id':_0x8c4e86+'_'+_0x14d1f8[_0x1161('0x97')],'name':_0x14d1f8[_0x1161('0xb1')][_0x1161('0xaf')][_0x1161('0xb2')],'custom':![],'options':_0xd1e4c0};_0x381dc6['push'](_0x54c2f6);return _0x381dc6;});}function getBooleanList(_0x3af30e,_0x1c7316,_0x4993d2,_0x2ba5db,_0xc213ce,_0x3b5ab9){var _0x5641d2={'method':'GET','uri':_0x3af30e+_0x1161('0xa9')+_0x2ba5db+_0x1161('0xaa')+_0xc213ce+_0x1161('0xb3'),'headers':{'Authorization':_0x1161('0x90')+_0x3b5ab9,'If-None-Match':null,'OData-Version':_0x1161('0x91')},'json':!![]};return rp(_0x5641d2)[_0x1161('0x10')](function(_0x17fcdd){var _0x433fba=[];_0x433fba[_0x1161('0x9e')]({'name':_0x17fcdd[_0x1161('0xad')][_0x1161('0xb4')][_0x1161('0xb2')][_0x1161('0xaf')][_0x1161('0xb2')],'value':_0x1161('0xb5')},{'name':_0x17fcdd[_0x1161('0xad')][_0x1161('0xb6')][_0x1161('0xb2')][_0x1161('0xaf')][_0x1161('0xb2')],'value':_0x1161('0xb7')});var _0x175d03={'id':_0x1c7316+'_'+_0x17fcdd[_0x1161('0x97')],'name':_0x17fcdd[_0x1161('0xb1')][_0x1161('0xaf')][_0x1161('0xb2')],'custom':![],'options':_0x433fba};_0x4993d2[_0x1161('0x9e')](_0x175d03);return _0x4993d2;});}function getInputList(_0x4d4e81,_0x6c3d6d,_0x2d4d23,_0x469c82,_0x172f30,_0x3fb3f0,_0x1c1ecd){var _0x36f3d5={'method':_0x1161('0x8e'),'uri':_0x4d4e81+_0x1161('0xa9')+_0x172f30+_0x1161('0xaa')+_0x3fb3f0+_0x1161('0xb8')+_0x2d4d23+_0x1161('0xb9'),'headers':{'Authorization':_0x1161('0x90')+_0x1c1ecd,'If-None-Match':null,'OData-Version':_0x1161('0x91')},'json':!![]};return rp(_0x36f3d5)[_0x1161('0x10')](function(_0x2d55da){var _0x33d0a4={'id':_0x6c3d6d+'_'+_0x2d55da['LogicalName'],'name':_0x2d55da[_0x1161('0xb1')][_0x1161('0xaf')]?_0x2d55da[_0x1161('0xb1')][_0x1161('0xaf')][_0x1161('0xb2')]:_0x2d55da[_0x1161('0x97')],'custom':![],'options':[]};_0x469c82[_0x1161('0x9e')](_0x33d0a4);return _0x469c82;});} \ No newline at end of file +var _0xc02d=['Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','Label','UserLocalizedLabel','Value','DisplayName','OptionSet','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','../../components/parsers/qs','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','send','index','Dynamics365Account','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','include','findAll','rows','catch','params','fields','includeAll','options','find','create','body','getConfigurations','findOne','Dynamics365Configuration','addConfiguration','AccountId','Subjects','Descriptions','channel','Dynamics365Field','slice','lastIndexOf','format','incident','Incident','PhoneCall','title','customerid','caseorigincode','subject','phonenumber','directioncode','accountidyominame','actualserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','escalatedon','exchangerate','firstresponsebykpiidname','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','onholdtime','owneridtype','owneridyominame','primarycontactidname','prioritycodename','productidname','productserialnumber','resolveby','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','versionnumber','username','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','POST','/oauth2/token','password','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','substring','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','test','statusCode'];(function(_0x2f91a3,_0x395c3a){var _0x22064a=function(_0x3f1ca7){while(--_0x3f1ca7){_0x2f91a3['push'](_0x2f91a3['shift']());}};_0x22064a(++_0x395c3a);}(_0xc02d,0xc8));var _0xdc02=function(_0x2193ec,_0xe6cc42){_0x2193ec=_0x2193ec-0x0;var _0x162b79=_0xc02d[_0x2193ec];return _0x162b79;};'use strict';var rp=require(_0xdc02('0x0'));var util=require(_0xdc02('0x1'));var _=require('lodash');var qs=require(_0xdc02('0x2'));var logger=require('../../config/logger')('api');var db=require(_0xdc02('0x3'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x27e08d,_0x4bf37c){_0x4bf37c=_0x4bf37c||0xc8;return function(_0x518b33){if(_0x518b33){return _0x27e08d[_0xdc02('0x4')](_0x4bf37c)[_0xdc02('0x5')](_0x518b33);}};}function respondWithFilteredResult(_0x54da61,_0x2140a3){return function(_0x5f1c11){if(_0x5f1c11){var _0x173678=typeof _0x2140a3['offset']===_0xdc02('0x6')&&typeof _0x2140a3[_0xdc02('0x7')]==='undefined';var _0x4c3319=_0x5f1c11[_0xdc02('0x8')];var _0x3bffa7=_0x173678?0x0:_0x2140a3[_0xdc02('0x9')];var _0x148cb8=_0x173678?_0x5f1c11[_0xdc02('0x8')]:_0x2140a3[_0xdc02('0x9')]+_0x2140a3[_0xdc02('0x7')];var _0x216bc4;if(_0x148cb8>=_0x4c3319){_0x148cb8=_0x4c3319;_0x216bc4=0xc8;}else{_0x216bc4=0xce;}_0x54da61[_0xdc02('0x4')](_0x216bc4);return _0x54da61[_0xdc02('0xa')](_0xdc02('0xb'),_0x3bffa7+'-'+_0x148cb8+'/'+_0x4c3319)['json'](_0x5f1c11);}return null;};}function saveUpdates(_0x1d910b){return function(_0x4282e7){if(_0x4282e7){return _0x4282e7[_0xdc02('0xc')](_0x1d910b)[_0xdc02('0xd')](function(_0x5b4eb6){return _0x5b4eb6;});}return null;};}function removeEntity(_0x2b73e8){return function(_0x5cb622){if(_0x5cb622){return _0x5cb622[_0xdc02('0xe')]()[_0xdc02('0xd')](function(){_0x2b73e8['status'](0xcc)[_0xdc02('0xf')]();});}};}function handleEntityNotFound(_0x39d780){return function(_0x361ced){if(!_0x361ced){_0x39d780[_0xdc02('0x10')](0x194);}return _0x361ced;};}function handleError(_0x16b025,_0x527a6d){_0x527a6d=_0x527a6d||0x1f4;return function(_0x34e912){logger[_0xdc02('0x11')](_0x34e912[_0xdc02('0x12')]);if(_0x34e912['name']){delete _0x34e912[_0xdc02('0x13')];}_0x16b025['status'](_0x527a6d)[_0xdc02('0x14')](_0x34e912);};}exports[_0xdc02('0x15')]=function(_0x41c61d,_0x157333){var _0x30f7e4={},_0x165c95={},_0x499930={'count':0x0,'rows':[]};var _0xe72e88=_['map'](db[_0xdc02('0x16')][_0xdc02('0x17')],function(_0x389cc8){return{'name':_0x389cc8[_0xdc02('0x18')],'type':_0x389cc8[_0xdc02('0x19')][_0xdc02('0x1a')]};});_0x165c95['model']=_[_0xdc02('0x1b')](_0xe72e88,_0xdc02('0x13'));_0x165c95[_0xdc02('0x1c')]=_[_0xdc02('0x1d')](_0x41c61d['query']);_0x165c95[_0xdc02('0x1e')]=_['intersection'](_0x165c95[_0xdc02('0x1f')],_0x165c95[_0xdc02('0x1c')]);_0x30f7e4[_0xdc02('0x20')]=_[_0xdc02('0x21')](_0x165c95[_0xdc02('0x1f')],qs['fields'](_0x41c61d[_0xdc02('0x1c')]['fields']));_0x30f7e4[_0xdc02('0x20')]=_0x30f7e4[_0xdc02('0x20')][_0xdc02('0x22')]?_0x30f7e4['attributes']:_0x165c95[_0xdc02('0x1f')];if(!_0x41c61d[_0xdc02('0x1c')][_0xdc02('0x23')](_0xdc02('0x24'))){_0x30f7e4[_0xdc02('0x7')]=qs[_0xdc02('0x7')](_0x41c61d[_0xdc02('0x1c')][_0xdc02('0x7')]);_0x30f7e4['offset']=qs[_0xdc02('0x9')](_0x41c61d['query'][_0xdc02('0x9')]);}_0x30f7e4[_0xdc02('0x25')]=qs[_0xdc02('0x26')](_0x41c61d[_0xdc02('0x1c')][_0xdc02('0x26')]);_0x30f7e4[_0xdc02('0x27')]=qs[_0xdc02('0x1e')](_['pick'](_0x41c61d[_0xdc02('0x1c')],_0x165c95[_0xdc02('0x1e')]),_0xe72e88);if(_0x41c61d[_0xdc02('0x1c')][_0xdc02('0x28')]){_0x30f7e4[_0xdc02('0x27')]=_[_0xdc02('0x29')](_0x30f7e4['where'],{'$or':_[_0xdc02('0x1b')](_0xe72e88,function(_0x2dad50){if(_0x2dad50['type']!=='VIRTUAL'){var _0x543eeb={};_0x543eeb[_0x2dad50[_0xdc02('0x13')]]={'$like':'%'+_0x41c61d[_0xdc02('0x1c')][_0xdc02('0x28')]+'%'};return _0x543eeb;}})});}_0x30f7e4=_['merge']({},_0x30f7e4,_0x41c61d['options']);var _0x515640={'where':_0x30f7e4[_0xdc02('0x27')]};return db[_0xdc02('0x16')][_0xdc02('0x8')](_0x515640)[_0xdc02('0xd')](function(_0x466f76){_0x499930[_0xdc02('0x8')]=_0x466f76;if(_0x41c61d[_0xdc02('0x1c')]['includeAll']){_0x30f7e4[_0xdc02('0x2a')]=[{'all':!![]}];}return db[_0xdc02('0x16')][_0xdc02('0x2b')](_0x30f7e4);})[_0xdc02('0xd')](function(_0x1fab20){_0x499930[_0xdc02('0x2c')]=_0x1fab20;return _0x499930;})['then'](respondWithFilteredResult(_0x157333,_0x30f7e4))[_0xdc02('0x2d')](handleError(_0x157333,null));};exports['show']=function(_0x1a4aad,_0x4dbdbc){var _0x5117c7={'raw':![],'where':{'id':_0x1a4aad[_0xdc02('0x2e')]['id']}},_0x1e3314={};_0x1e3314[_0xdc02('0x1f')]=_[_0xdc02('0x1d')](db['Dynamics365Account'][_0xdc02('0x17')]);_0x1e3314[_0xdc02('0x1c')]=_[_0xdc02('0x1d')](_0x1a4aad[_0xdc02('0x1c')]);_0x1e3314[_0xdc02('0x1e')]=_[_0xdc02('0x21')](_0x1e3314[_0xdc02('0x1f')],_0x1e3314[_0xdc02('0x1c')]);_0x5117c7[_0xdc02('0x20')]=_[_0xdc02('0x21')](_0x1e3314[_0xdc02('0x1f')],qs[_0xdc02('0x2f')](_0x1a4aad[_0xdc02('0x1c')][_0xdc02('0x2f')]));_0x5117c7['attributes']=_0x5117c7[_0xdc02('0x20')][_0xdc02('0x22')]?_0x5117c7[_0xdc02('0x20')]:_0x1e3314[_0xdc02('0x1f')];if(_0x1a4aad[_0xdc02('0x1c')][_0xdc02('0x30')]){_0x5117c7['include']=[{'all':!![]}];}_0x5117c7=_[_0xdc02('0x29')]({},_0x5117c7,_0x1a4aad[_0xdc02('0x31')]);return db[_0xdc02('0x16')][_0xdc02('0x32')](_0x5117c7)[_0xdc02('0xd')](handleEntityNotFound(_0x4dbdbc,null))[_0xdc02('0xd')](respondWithResult(_0x4dbdbc,null))['catch'](handleError(_0x4dbdbc,null));};exports[_0xdc02('0x33')]=function(_0x109e22,_0xc05b54){return db['Dynamics365Account'][_0xdc02('0x33')](_0x109e22[_0xdc02('0x34')],{})[_0xdc02('0xd')](respondWithResult(_0xc05b54,0xc9))[_0xdc02('0x2d')](handleError(_0xc05b54,null));};exports[_0xdc02('0xc')]=function(_0x217246,_0x1e6f61){if(_0x217246[_0xdc02('0x34')]['id']){delete _0x217246[_0xdc02('0x34')]['id'];}return db[_0xdc02('0x16')]['find']({'where':{'id':_0x217246[_0xdc02('0x2e')]['id']}})['then'](handleEntityNotFound(_0x1e6f61,null))['then'](saveUpdates(_0x217246[_0xdc02('0x34')],null))[_0xdc02('0xd')](respondWithResult(_0x1e6f61,null))[_0xdc02('0x2d')](handleError(_0x1e6f61,null));};exports[_0xdc02('0xe')]=function(_0x5f49f7,_0x32efba){return db['Dynamics365Account'][_0xdc02('0x32')]({'where':{'id':_0x5f49f7['params']['id']}})[_0xdc02('0xd')](handleEntityNotFound(_0x32efba,null))['then'](removeEntity(_0x32efba,null))[_0xdc02('0x2d')](handleError(_0x32efba,null));};exports[_0xdc02('0x35')]=function(_0xc2d422,_0x57ac9e){var _0x1f0c84={};var _0x38cc56={};var _0x2e5bad;var _0x31853b;return db['Dynamics365Account'][_0xdc02('0x36')]({'where':{'id':_0xc2d422[_0xdc02('0x2e')]['id']}})['then'](handleEntityNotFound(_0x57ac9e,null))[_0xdc02('0xd')](function(_0x5969ff){if(_0x5969ff){_0x2e5bad=_0x5969ff;_0x38cc56['model']=_['keys'](db[_0xdc02('0x37')]['rawAttributes']);_0x38cc56[_0xdc02('0x1c')]=_[_0xdc02('0x1d')](_0xc2d422[_0xdc02('0x1c')]);_0x38cc56[_0xdc02('0x1e')]=_['intersection'](_0x38cc56['model'],_0x38cc56['query']);_0x1f0c84[_0xdc02('0x20')]=_[_0xdc02('0x21')](_0x38cc56[_0xdc02('0x1f')],qs[_0xdc02('0x2f')](_0xc2d422[_0xdc02('0x1c')][_0xdc02('0x2f')]));_0x1f0c84[_0xdc02('0x20')]=_0x1f0c84[_0xdc02('0x20')]['length']?_0x1f0c84['attributes']:_0x38cc56[_0xdc02('0x1f')];_0x1f0c84['order']=qs[_0xdc02('0x26')](_0xc2d422[_0xdc02('0x1c')][_0xdc02('0x26')]);_0x1f0c84[_0xdc02('0x27')]=qs[_0xdc02('0x1e')](_['pick'](_0xc2d422[_0xdc02('0x1c')],_0x38cc56[_0xdc02('0x1e')]));if(_0xc2d422[_0xdc02('0x1c')][_0xdc02('0x28')]){_0x1f0c84[_0xdc02('0x27')]=_['merge'](_0x1f0c84[_0xdc02('0x27')],{'$or':_[_0xdc02('0x1b')](_0x1f0c84[_0xdc02('0x20')],function(_0x4e8f4c){var _0x4aa634={};_0x4aa634[_0x4e8f4c]={'$like':'%'+_0xc2d422[_0xdc02('0x1c')][_0xdc02('0x28')]+'%'};return _0x4aa634;})});}_0x1f0c84=_[_0xdc02('0x29')]({},_0x1f0c84,_0xc2d422['options']);return _0x2e5bad[_0xdc02('0x35')](_0x1f0c84);}})[_0xdc02('0xd')](function(_0x4c1e76){if(_0x4c1e76){_0x31853b=_0x4c1e76[_0xdc02('0x22')];if(!_0xc2d422[_0xdc02('0x1c')][_0xdc02('0x23')]('nolimit')){_0x1f0c84['limit']=qs[_0xdc02('0x7')](_0xc2d422[_0xdc02('0x1c')][_0xdc02('0x7')]);_0x1f0c84['offset']=qs['offset'](_0xc2d422['query']['offset']);}return _0x2e5bad[_0xdc02('0x35')](_0x1f0c84);}})[_0xdc02('0xd')](function(_0x2e3967){if(_0x2e3967){return _0x2e3967?{'count':_0x31853b,'rows':_0x2e3967}:null;}})[_0xdc02('0xd')](respondWithResult(_0x57ac9e,null))[_0xdc02('0x2d')](handleError(_0x57ac9e,null));};exports[_0xdc02('0x38')]=function(_0x4bfefe,_0x182dea){if(_0x4bfefe['body']['id']){delete _0x4bfefe[_0xdc02('0x34')]['id'];}return db[_0xdc02('0x16')]['findOne']({'where':{'id':_0x4bfefe[_0xdc02('0x2e')]['id']}})['then'](handleEntityNotFound(_0x182dea,null))['then'](function(_0x1e1ff8){if(_0x1e1ff8){_0x4bfefe[_0xdc02('0x34')][_0xdc02('0x39')]=_0x1e1ff8['id'];_0x4bfefe[_0xdc02('0x34')][_0xdc02('0x3a')]=integrations['getSubjects'](_0x4bfefe[_0xdc02('0x34')]['channel'],_0x4bfefe[_0xdc02('0x34')][_0xdc02('0x19')]);_0x4bfefe[_0xdc02('0x34')][_0xdc02('0x3b')]=integrations['getDescriptions'](_0x4bfefe['body'][_0xdc02('0x3c')],_0x4bfefe[_0xdc02('0x34')]['type']);return db[_0xdc02('0x37')][_0xdc02('0x33')](_0x4bfefe[_0xdc02('0x34')],{'include':[{'model':db[_0xdc02('0x3d')],'as':_0xdc02('0x3a')},{'model':db['Dynamics365Field'],'as':'Descriptions'}]});}return null;})[_0xdc02('0xd')](respondWithResult(_0x182dea,null))['catch'](handleError(_0x182dea,null));};function sanitizeRemoteUri(_0x54cb6c){var _0x1c032d=_0x54cb6c[_0xdc02('0x3e')](-0x1);if(_0x1c032d==='/')return _0x54cb6c['substring'](0x0,_0x54cb6c[_0xdc02('0x3f')](_0x1c032d));return _0x54cb6c;}function getWebApiUrl(_0x2ece67){return util[_0xdc02('0x40')]('%s/api/data/v9.0/',_0x2ece67);}exports['getFields']=function(_0x525426,_0xf802f){var _0x35fe04=_0x525426['query']['ticketType'];var _0x16455b=_0x35fe04===_0xdc02('0x41')?_0xdc02('0x42'):_0xdc02('0x43');var _0x372c8d='';var _0x1e235f='';var _0x3c7294='';var _0x25ab60='';var _0x1108d1='';var _0x39958a='';var _0x422c9b='';var _0x243ef0='';var _0x1ba9fc=[_0xdc02('0x44'),'description',_0xdc02('0x45'),'ownerid',_0xdc02('0x46'),_0xdc02('0x47'),_0xdc02('0x48'),'regardingobjectid',_0xdc02('0x49'),'phonecall_activity_parties'];var _0x15b879=['accountidname',_0xdc02('0x4a'),_0xdc02('0x4b'),'billedserviceunits',_0xdc02('0x4c'),_0xdc02('0x4d'),_0xdc02('0x4e'),_0xdc02('0x4f'),'createdbyexternalpartyname',_0xdc02('0x50'),_0xdc02('0x51'),_0xdc02('0x52'),_0xdc02('0x53'),_0xdc02('0x54'),_0xdc02('0x55'),_0xdc02('0x56'),_0xdc02('0x57'),_0xdc02('0x58'),_0xdc02('0x59'),_0xdc02('0x5a'),_0xdc02('0x5b'),'entityimage_url',_0xdc02('0x5c'),_0xdc02('0x5d'),_0xdc02('0x5e'),'followupby',_0xdc02('0x5f'),_0xdc02('0x60'),_0xdc02('0x61'),_0xdc02('0x62'),_0xdc02('0x63'),_0xdc02('0x64'),_0xdc02('0x65'),_0xdc02('0x66'),_0xdc02('0x67'),'modifiedon',_0xdc02('0x68'),_0xdc02('0x69'),_0xdc02('0x6a'),'msdyn_iotalertname','numberofchildincidents',_0xdc02('0x6b'),'overriddencreatedon','owneridname',_0xdc02('0x6c'),_0xdc02('0x6d'),'parentcaseidname',_0xdc02('0x6e'),'primarycontactidyominame',_0xdc02('0x6f'),_0xdc02('0x70'),_0xdc02('0x71'),_0xdc02('0x72'),'resolvebykpiidname','responseby','responsiblecontactidname',_0xdc02('0x73'),_0xdc02('0x74'),_0xdc02('0x75'),_0xdc02('0x76'),_0xdc02('0x77'),_0xdc02('0x78'),_0xdc02('0x79'),_0xdc02('0x7a'),_0xdc02('0x7b'),_0xdc02('0x7c'),_0xdc02('0x7d'),'traversedpath','utcconversiontimezonecode',_0xdc02('0x7e')];var _0x10d0d6=_0x1ba9fc['concat'](_0x15b879);return db[_0xdc02('0x16')][_0xdc02('0x36')]({'where':{'id':_0x525426[_0xdc02('0x2e')]['id']},'attributes':['id',_0xdc02('0x7f'),'password',_0xdc02('0x80'),_0xdc02('0x81'),_0xdc02('0x82'),_0xdc02('0x83'),_0xdc02('0x84')],'include':[{'model':db[_0xdc02('0x85')],'as':'CloudProvider','attributes':['id',_0xdc02('0x86'),_0xdc02('0x87')]}]})[_0xdc02('0xd')](handleEntityNotFound(_0xf802f,null))[_0xdc02('0xd')](function(_0x69b845){if(_0x69b845){if(_0x69b845[_0xdc02('0x84')]){_0x69b845['access_token']=_0x69b845[_0xdc02('0x85')]['data5'];_0x243ef0=sanitizeRemoteUri(_0x69b845['CloudProvider'][_0xdc02('0x87')]);_0x422c9b=getWebApiUrl(_0x243ef0);return _0x69b845;}_0x243ef0=sanitizeRemoteUri(_0x69b845[_0xdc02('0x80')]);_0x422c9b=getWebApiUrl(_0x243ef0);var _0x6a4683={'method':_0xdc02('0x88'),'uri':'https://login.microsoftonline.com/'+_0x69b845[_0xdc02('0x81')]+_0xdc02('0x89'),'form':{'client_id':_0x69b845[_0xdc02('0x82')],'resource':_0x243ef0,'username':_0x69b845['username'],'password':_0x69b845[_0xdc02('0x8a')],'grant_type':_0xdc02('0x8a'),'client_secret':_0x69b845[_0xdc02('0x83')]},'json':!![]};return rp(_0x6a4683);}})[_0xdc02('0xd')](function(_0x4b0a91){_0x39958a=_0x4b0a91[_0xdc02('0x8b')];var _0x16e82f={'method':_0xdc02('0x8c'),'uri':encodeURI(_0x422c9b+_0xdc02('0x8d')+_0x16455b+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x39958a,'If-None-Match':null,'OData-Version':_0xdc02('0x8e')},'json':!![]};return rp(_0x16e82f);})[_0xdc02('0xd')](function(_0x35736f){var _0x532650=_0x35736f[_0xdc02('0x8f')][0x0];var _0x53d633=_0x532650[_0xdc02('0x90')];var _0x428475={'method':'GET','uri':_0x422c9b+_0xdc02('0x91')+_0x53d633+_0xdc02('0x92'),'headers':{'Authorization':_0xdc02('0x93')+_0x39958a,'If-None-Match':null,'OData-Version':_0xdc02('0x8e')},'json':!![]};return rp(_0x428475);})[_0xdc02('0xd')](function(_0x317427){_0x372c8d=_0x317427;_0x1e235f=_0x372c8d[_0xdc02('0x94')];_0x1e235f=_[_0xdc02('0x95')](_0x1e235f,function(_0x228420){return!_0x10d0d6[_0xdc02('0x96')](_0x228420[_0xdc02('0x97')]);});var _0x5529b7=[];var _0x12a91b=[];_0x1e235f[_0xdc02('0x98')](function(_0x2f01b5){if(_0x2f01b5[_0xdc02('0x99')]){var _0x38da56=_0x2f01b5[_0xdc02('0x99')]['substring'](_0x2f01b5[_0xdc02('0x99')][_0xdc02('0x3f')]('.')+0x1);if(_0x38da56===_0xdc02('0x9a')){_0x5529b7[_0xdc02('0x9b')](getSelectList(_0x422c9b,_0x35fe04,_0x12a91b,_0x372c8d[_0xdc02('0x90')],_0x2f01b5['MetadataId'],_0x39958a));}}});return Promise[_0xdc02('0x9c')](_0x5529b7);})['then'](function(_0x34203e){_0x3c7294=_0x34203e[0x0];var _0x5f3e0c=[];var _0x4319bb=[];_0x1e235f[_0xdc02('0x98')](function(_0x464364){if(!_['isNil'](_0x464364[_0xdc02('0x99')])){var _0x23398e=_0x464364[_0xdc02('0x99')][_0xdc02('0x9d')](_0x464364['@odata.type']['lastIndexOf']('.')+0x1);if(_0x23398e===_0xdc02('0x9e')){_0x5f3e0c[_0xdc02('0x9b')](getBooleanList(_0x422c9b,_0x35fe04,_0x4319bb,_0x372c8d[_0xdc02('0x90')],_0x464364[_0xdc02('0x90')],_0x39958a));}}});return Promise[_0xdc02('0x9c')](_0x5f3e0c);})['then'](function(_0x367f27){_0x25ab60=_0x367f27[0x0];var _0x2a48e6=[];var _0xec1af0=[];_0x1e235f['forEach'](function(_0x440f89){if(_0x440f89[_0xdc02('0x99')]){var _0x39ddb6=_0x440f89[_0xdc02('0x99')][_0xdc02('0x9d')](_0x440f89['@odata.type']['lastIndexOf']('.')+0x1);if(_0x39ddb6===_0xdc02('0x9f')||_0x39ddb6===_0xdc02('0xa0')||_0x39ddb6===_0xdc02('0xa1')||_0x39ddb6==='IntegerAttributeMetadata'||_0x39ddb6==='MemoAttributeMetadata'||_0x39ddb6===_0xdc02('0xa2')||_0x39ddb6===_0xdc02('0xa3')||_0x39ddb6===_0xdc02('0xa4')||_0x39ddb6===_0xdc02('0xa5')||_0x39ddb6===_0xdc02('0xa6')){_0x2a48e6[_0xdc02('0x9b')](getInputList(_0x422c9b,_0x35fe04,_0x39ddb6,_0xec1af0,_0x372c8d[_0xdc02('0x90')],_0x440f89['MetadataId'],_0x39958a));}}});return Promise[_0xdc02('0x9c')](_0x2a48e6);})[_0xdc02('0xd')](function(_0x2079db){_0x1108d1=_0x2079db[0x0];var _0x42f08c=_0x3c7294['concat'](_0x25ab60)[_0xdc02('0xa7')](_0x1108d1);var _0x1f6aa3={'count':_0x42f08c[_0xdc02('0x22')],'rows':_0x42f08c};return _0x1f6aa3;})[_0xdc02('0xd')](respondWithResult(_0xf802f,null))[_0xdc02('0x2d')](function(_0xefdb51){var _0x10baca=_0x525426['query'][_0xdc02('0xa8')]?0x1f4:_0xefdb51[_0xdc02('0xa9')]||0x1f4;logger[_0xdc02('0x11')](_0xefdb51[_0xdc02('0x12')]);delete _0xefdb51[_0xdc02('0x13')];if(_0x10baca===0x191){_0x10baca=0x190;}_0xf802f[_0xdc02('0x4')](_0x10baca)[_0xdc02('0x14')](_0x525426[_0xdc02('0x1c')][_0xdc02('0xa8')]?{'message':_0xdc02('0xaa'),'statusCode':_0xefdb51[_0xdc02('0xa9')]}:_0xefdb51);});};function getSelectList(_0x4ec2b8,_0xd647ba,_0x1758f1,_0x4df7a0,_0x226787,_0x1697f4){var _0x3a2b8e={'method':_0xdc02('0x8c'),'uri':_0x4ec2b8+_0xdc02('0x91')+_0x4df7a0+_0xdc02('0xab')+_0x226787+_0xdc02('0xac')+_0xdc02('0xad'),'headers':{'Authorization':_0xdc02('0x93')+_0x1697f4,'If-None-Match':null,'OData-Version':_0xdc02('0x8e')},'json':!![]};return rp(_0x3a2b8e)[_0xdc02('0xd')](function(_0xa889e){var _0x513623=[];var _0xfda7b6=_0xa889e['OptionSet'][_0xdc02('0xae')];_0xfda7b6[_0xdc02('0x98')](function(_0x225c48){_0x513623[_0xdc02('0x9b')]({'name':_0x225c48[_0xdc02('0xaf')][_0xdc02('0xb0')][_0xdc02('0xaf')],'value':String(_0x225c48[_0xdc02('0xb1')])});});var _0x3b9d24={'id':_0xd647ba+'_'+_0xa889e[_0xdc02('0x97')],'name':_0xa889e[_0xdc02('0xb2')]['UserLocalizedLabel'][_0xdc02('0xaf')],'custom':![],'options':_0x513623};_0x1758f1['push'](_0x3b9d24);return _0x1758f1;});}function getBooleanList(_0x3dd3b0,_0x392a39,_0x47b0ee,_0x38df53,_0x17b6fc,_0x5cbd74){var _0x105c66={'method':_0xdc02('0x8c'),'uri':_0x3dd3b0+_0xdc02('0x91')+_0x38df53+_0xdc02('0xab')+_0x17b6fc+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xdc02('0x93')+_0x5cbd74,'If-None-Match':null,'OData-Version':_0xdc02('0x8e')},'json':!![]};return rp(_0x105c66)[_0xdc02('0xd')](function(_0x22e77f){var _0x59fb0c=[];_0x59fb0c['push']({'name':_0x22e77f[_0xdc02('0xb3')]['TrueOption']['Label'][_0xdc02('0xb0')][_0xdc02('0xaf')],'value':_0xdc02('0xb4')},{'name':_0x22e77f['OptionSet'][_0xdc02('0xb5')]['Label']['UserLocalizedLabel']['Label'],'value':_0xdc02('0xb6')});var _0x461fab={'id':_0x392a39+'_'+_0x22e77f['LogicalName'],'name':_0x22e77f[_0xdc02('0xb2')][_0xdc02('0xb0')][_0xdc02('0xaf')],'custom':![],'options':_0x59fb0c};_0x47b0ee[_0xdc02('0x9b')](_0x461fab);return _0x47b0ee;});}function getInputList(_0x5bf5f1,_0x3ae704,_0x5ad890,_0x42a78e,_0xf1639c,_0x25ee9d,_0x4ab83d){var _0x36439f={'method':_0xdc02('0x8c'),'uri':_0x5bf5f1+'EntityDefinitions('+_0xf1639c+_0xdc02('0xab')+_0x25ee9d+_0xdc02('0xb7')+_0x5ad890+_0xdc02('0xb8'),'headers':{'Authorization':_0xdc02('0x93')+_0x4ab83d,'If-None-Match':null,'OData-Version':_0xdc02('0x8e')},'json':!![]};return rp(_0x36439f)['then'](function(_0x112e54){var _0x546274={'id':_0x3ae704+'_'+_0x112e54[_0xdc02('0x97')],'name':_0x112e54['DisplayName'][_0xdc02('0xb0')]?_0x112e54[_0xdc02('0xb2')][_0xdc02('0xb0')][_0xdc02('0xaf')]:_0x112e54[_0xdc02('0x97')],'custom':![],'options':[]};_0x42a78e[_0xdc02('0x9b')](_0x546274);return _0x42a78e;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index c3c384a..26724d0 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x58e1d5,_0x3ce57d){var _0x328329=function(_0x279c3f){while(--_0x279c3f){_0x58e1d5['push'](_0x58e1d5['shift']());}};_0x328329(++_0x3ce57d);}(_0x757a,0xde));var _0xa757=function(_0xd438c8,_0x55622c){_0xd438c8=_0xd438c8-0x0;var _0x5d6033=_0x757a[_0xd438c8];return _0x5d6033;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));var integrations=require(_0xa757('0x7'));module['exports']=function(_0xae0e7c,_0x4343b6){return _0xae0e7c['define'](_0xa757('0x8'),attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x327c5a,_0x2523bd){var _0x51b120=function(_0x5927bd){while(--_0x5927bd){_0x327c5a['push'](_0x327c5a['shift']());}};_0x51b120(++_0x2523bd);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index c9e8946..1816c8b 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 _0xdfa4=['error','code','message','catch','GetDynamics365Account','Dynamics365Account','options','raw','where','attributes','include','map','model','ShowDynamics365Account','find','stringify','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x41492e,_0x371c30){var _0x57ad15=function(_0x1a1fbc){while(--_0x1a1fbc){_0x41492e['push'](_0x41492e['shift']());}};_0x57ad15(++_0x371c30);}(_0xdfa4,0x139));var _0x4dfa=function(_0x294295,_0x406b15){_0x294295=_0x294295-0x0;var _0x4bb05b=_0xdfa4[_0x294295];return _0x4bb05b;};'use strict';var _=require(_0x4dfa('0x0'));var util=require(_0x4dfa('0x1'));var moment=require(_0x4dfa('0x2'));var BPromise=require('bluebird');var rs=require(_0x4dfa('0x3'));var fs=require('fs');var Redis=require(_0x4dfa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4dfa('0x5'));var logger=require('../../config/logger')(_0x4dfa('0x6'));var config=require(_0x4dfa('0x7'));var jayson=require(_0x4dfa('0x8'));var client=jayson[_0x4dfa('0x9')][_0x4dfa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x42019f,_0x210988,_0x4968d2){return new BPromise(function(_0x561f3b,_0x955f38){return client[_0x4dfa('0xb')](_0x42019f,_0x4968d2)[_0x4dfa('0xc')](function(_0x25bc2b){logger[_0x4dfa('0xd')](_0x4dfa('0xe'),_0x210988,_0x4dfa('0xf'));logger[_0x4dfa('0x10')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x210988,_0x4dfa('0xf'),JSON['stringify'](_0x25bc2b));if(_0x25bc2b[_0x4dfa('0x11')]){if(_0x25bc2b[_0x4dfa('0x11')][_0x4dfa('0x12')]===0x1f4){logger[_0x4dfa('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0x210988,_0x25bc2b[_0x4dfa('0x11')][_0x4dfa('0x13')]);return _0x955f38(_0x25bc2b['error'][_0x4dfa('0x13')]);}logger[_0x4dfa('0x11')](_0x4dfa('0xe'),_0x210988,_0x25bc2b[_0x4dfa('0x11')][_0x4dfa('0x13')]);return _0x561f3b(_0x25bc2b['error'][_0x4dfa('0x13')]);}else{logger[_0x4dfa('0xd')]('Dynamics365Account,\x20%s,\x20%s',_0x210988,_0x4dfa('0xf'));_0x561f3b(_0x25bc2b['result']['message']);}})[_0x4dfa('0x14')](function(_0x15394c){logger[_0x4dfa('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0x210988,_0x15394c);_0x955f38(_0x15394c);});});}exports[_0x4dfa('0x15')]=function(_0xae9ec9){var _0x46dff2=this;return new Promise(function(_0xdd0700,_0x2431a7){return db[_0x4dfa('0x16')]['findAll']({'raw':_0xae9ec9['options']?_0xae9ec9[_0x4dfa('0x17')][_0x4dfa('0x18')]===undefined?!![]:![]:!![],'where':_0xae9ec9[_0x4dfa('0x17')]?_0xae9ec9[_0x4dfa('0x17')][_0x4dfa('0x19')]||null:null,'attributes':_0xae9ec9[_0x4dfa('0x17')]?_0xae9ec9[_0x4dfa('0x17')][_0x4dfa('0x1a')]||null:null,'limit':_0xae9ec9[_0x4dfa('0x17')]?_0xae9ec9['options']['limit']||null:null,'include':_0xae9ec9[_0x4dfa('0x17')]?_0xae9ec9[_0x4dfa('0x17')][_0x4dfa('0x1b')]?_[_0x4dfa('0x1c')](_0xae9ec9[_0x4dfa('0x17')][_0x4dfa('0x1b')],function(_0xb652a6){return{'model':db[_0xb652a6[_0x4dfa('0x1d')]],'as':_0xb652a6['as'],'attributes':_0xb652a6[_0x4dfa('0x1a')],'include':_0xb652a6[_0x4dfa('0x1b')]?_[_0x4dfa('0x1c')](_0xb652a6[_0x4dfa('0x1b')],function(_0x2fa5fd){return{'model':db[_0x2fa5fd[_0x4dfa('0x1d')]],'as':_0x2fa5fd['as'],'attributes':_0x2fa5fd[_0x4dfa('0x1a')],'include':_0x2fa5fd[_0x4dfa('0x1b')]?_[_0x4dfa('0x1c')](_0x2fa5fd[_0x4dfa('0x1b')],function(_0x50847b){return{'model':db[_0x50847b[_0x4dfa('0x1d')]],'as':_0x50847b['as'],'attributes':_0x50847b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x371118){logger[_0x4dfa('0xd')](_0x4dfa('0x15'),_0xae9ec9);logger[_0x4dfa('0x10')](_0x4dfa('0x15'),_0xae9ec9,JSON['stringify'](_0x371118));_0xdd0700(_0x371118);})['catch'](function(_0x377fe2){logger[_0x4dfa('0x11')](_0x4dfa('0x15'),_0x377fe2[_0x4dfa('0x13')],_0xae9ec9);_0x2431a7(_0x46dff2['error'](0x1f4,_0x377fe2[_0x4dfa('0x13')]));});});};exports[_0x4dfa('0x1e')]=function(_0x2311ba){var _0xbd5f0a=this;return new Promise(function(_0x4a7f5f,_0x34924d){return db['Dynamics365Account'][_0x4dfa('0x1f')]({'raw':_0x2311ba[_0x4dfa('0x17')]?_0x2311ba[_0x4dfa('0x17')][_0x4dfa('0x18')]===undefined?!![]:![]:!![],'where':_0x2311ba[_0x4dfa('0x17')]?_0x2311ba[_0x4dfa('0x17')][_0x4dfa('0x19')]||null:null,'attributes':_0x2311ba[_0x4dfa('0x17')]?_0x2311ba[_0x4dfa('0x17')]['attributes']||null:null,'include':_0x2311ba[_0x4dfa('0x17')]?_0x2311ba[_0x4dfa('0x17')][_0x4dfa('0x1b')]?_[_0x4dfa('0x1c')](_0x2311ba['options'][_0x4dfa('0x1b')],function(_0x100965){return{'model':db[_0x100965['model']],'as':_0x100965['as'],'attributes':_0x100965[_0x4dfa('0x1a')],'include':_0x100965[_0x4dfa('0x1b')]?_['map'](_0x100965[_0x4dfa('0x1b')],function(_0x319184){return{'model':db[_0x319184[_0x4dfa('0x1d')]],'as':_0x319184['as'],'attributes':_0x319184[_0x4dfa('0x1a')],'include':_0x319184[_0x4dfa('0x1b')]?_['map'](_0x319184[_0x4dfa('0x1b')],function(_0x2ff660){return{'model':db[_0x2ff660[_0x4dfa('0x1d')]],'as':_0x2ff660['as'],'attributes':_0x2ff660[_0x4dfa('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4dfa('0xc')](function(_0x1a3b30){logger['info'](_0x4dfa('0x1e'),_0x2311ba);logger[_0x4dfa('0x10')](_0x4dfa('0x1e'),_0x2311ba,JSON[_0x4dfa('0x20')](_0x1a3b30));_0x4a7f5f(_0x1a3b30);})[_0x4dfa('0x14')](function(_0x5e252c){logger['error'](_0x4dfa('0x1e'),_0x5e252c['message'],_0x2311ba);_0x34924d(_0xbd5f0a[_0x4dfa('0x11')](0x1f4,_0x5e252c[_0x4dfa('0x13')]));});});}; \ No newline at end of file +var _0xd3d3=['message','result','catch','Dynamics365Account','findAll','options','raw','attributes','limit','include','map','model','GetDynamics365Account','ShowDynamics365Account','find','where','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Dynamics365Account,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code'];(function(_0x445f32,_0x5400e6){var _0x3882f0=function(_0x3969ab){while(--_0x3969ab){_0x445f32['push'](_0x445f32['shift']());}};_0x3882f0(++_0x5400e6);}(_0xd3d3,0x1a8));var _0x3d3d=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0xd3d3[_0x4fde08];return _0x12e725;};'use strict';var _=require('lodash');var util=require(_0x3d3d('0x0'));var moment=require(_0x3d3d('0x1'));var BPromise=require('bluebird');var rs=require(_0x3d3d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3d3d('0x3'))['db'];var utils=require(_0x3d3d('0x4'));var logger=require(_0x3d3d('0x5'))('rpc');var config=require(_0x3d3d('0x6'));var jayson=require(_0x3d3d('0x7'));var client=jayson[_0x3d3d('0x8')][_0x3d3d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d1567,_0xe4a9e3,_0x3e9ce4){return new BPromise(function(_0x346399,_0xb1b4f7){return client['request'](_0x3d1567,_0x3e9ce4)[_0x3d3d('0xa')](function(_0x209457){logger[_0x3d3d('0xb')](_0x3d3d('0xc'),_0xe4a9e3,'request\x20sent');logger[_0x3d3d('0xd')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0xe4a9e3,_0x3d3d('0xe'),JSON[_0x3d3d('0xf')](_0x209457));if(_0x209457[_0x3d3d('0x10')]){if(_0x209457['error'][_0x3d3d('0x11')]===0x1f4){logger['error'](_0x3d3d('0xc'),_0xe4a9e3,_0x209457[_0x3d3d('0x10')][_0x3d3d('0x12')]);return _0xb1b4f7(_0x209457['error']['message']);}logger[_0x3d3d('0x10')](_0x3d3d('0xc'),_0xe4a9e3,_0x209457[_0x3d3d('0x10')][_0x3d3d('0x12')]);return _0x346399(_0x209457[_0x3d3d('0x10')][_0x3d3d('0x12')]);}else{logger[_0x3d3d('0xb')](_0x3d3d('0xc'),_0xe4a9e3,_0x3d3d('0xe'));_0x346399(_0x209457[_0x3d3d('0x13')]['message']);}})[_0x3d3d('0x14')](function(_0x23217b){logger[_0x3d3d('0x10')](_0x3d3d('0xc'),_0xe4a9e3,_0x23217b);_0xb1b4f7(_0x23217b);});});}exports['GetDynamics365Account']=function(_0x17bdf0){var _0x195e45=this;return new Promise(function(_0x4483fa,_0x15e34c){return db[_0x3d3d('0x15')][_0x3d3d('0x16')]({'raw':_0x17bdf0[_0x3d3d('0x17')]?_0x17bdf0['options'][_0x3d3d('0x18')]===undefined?!![]:![]:!![],'where':_0x17bdf0[_0x3d3d('0x17')]?_0x17bdf0[_0x3d3d('0x17')]['where']||null:null,'attributes':_0x17bdf0[_0x3d3d('0x17')]?_0x17bdf0['options'][_0x3d3d('0x19')]||null:null,'limit':_0x17bdf0[_0x3d3d('0x17')]?_0x17bdf0[_0x3d3d('0x17')][_0x3d3d('0x1a')]||null:null,'include':_0x17bdf0[_0x3d3d('0x17')]?_0x17bdf0[_0x3d3d('0x17')][_0x3d3d('0x1b')]?_[_0x3d3d('0x1c')](_0x17bdf0[_0x3d3d('0x17')]['include'],function(_0x39ed19){return{'model':db[_0x39ed19[_0x3d3d('0x1d')]],'as':_0x39ed19['as'],'attributes':_0x39ed19[_0x3d3d('0x19')],'include':_0x39ed19[_0x3d3d('0x1b')]?_[_0x3d3d('0x1c')](_0x39ed19[_0x3d3d('0x1b')],function(_0x282f7f){return{'model':db[_0x282f7f[_0x3d3d('0x1d')]],'as':_0x282f7f['as'],'attributes':_0x282f7f[_0x3d3d('0x19')],'include':_0x282f7f[_0x3d3d('0x1b')]?_['map'](_0x282f7f[_0x3d3d('0x1b')],function(_0xd55826){return{'model':db[_0xd55826[_0x3d3d('0x1d')]],'as':_0xd55826['as'],'attributes':_0xd55826['attributes']};}):[]};}):[]};}):[]:[]})[_0x3d3d('0xa')](function(_0x2201bd){logger['info'](_0x3d3d('0x1e'),_0x17bdf0);logger[_0x3d3d('0xd')](_0x3d3d('0x1e'),_0x17bdf0,JSON['stringify'](_0x2201bd));_0x4483fa(_0x2201bd);})[_0x3d3d('0x14')](function(_0x288a09){logger[_0x3d3d('0x10')](_0x3d3d('0x1e'),_0x288a09[_0x3d3d('0x12')],_0x17bdf0);_0x15e34c(_0x195e45[_0x3d3d('0x10')](0x1f4,_0x288a09[_0x3d3d('0x12')]));});});};exports[_0x3d3d('0x1f')]=function(_0x49812b){var _0x5b15d5=this;return new Promise(function(_0x3d7805,_0x211b2d){return db[_0x3d3d('0x15')][_0x3d3d('0x20')]({'raw':_0x49812b[_0x3d3d('0x17')]?_0x49812b[_0x3d3d('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x49812b[_0x3d3d('0x17')]?_0x49812b[_0x3d3d('0x17')][_0x3d3d('0x21')]||null:null,'attributes':_0x49812b[_0x3d3d('0x17')]?_0x49812b[_0x3d3d('0x17')][_0x3d3d('0x19')]||null:null,'include':_0x49812b[_0x3d3d('0x17')]?_0x49812b[_0x3d3d('0x17')]['include']?_['map'](_0x49812b[_0x3d3d('0x17')][_0x3d3d('0x1b')],function(_0x1c25f8){return{'model':db[_0x1c25f8[_0x3d3d('0x1d')]],'as':_0x1c25f8['as'],'attributes':_0x1c25f8[_0x3d3d('0x19')],'include':_0x1c25f8[_0x3d3d('0x1b')]?_[_0x3d3d('0x1c')](_0x1c25f8[_0x3d3d('0x1b')],function(_0x18a33c){return{'model':db[_0x18a33c[_0x3d3d('0x1d')]],'as':_0x18a33c['as'],'attributes':_0x18a33c[_0x3d3d('0x19')],'include':_0x18a33c[_0x3d3d('0x1b')]?_['map'](_0x18a33c[_0x3d3d('0x1b')],function(_0x383c62){return{'model':db[_0x383c62[_0x3d3d('0x1d')]],'as':_0x383c62['as'],'attributes':_0x383c62[_0x3d3d('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5eebcd){logger['info'](_0x3d3d('0x1f'),_0x49812b);logger[_0x3d3d('0xd')](_0x3d3d('0x1f'),_0x49812b,JSON['stringify'](_0x5eebcd));_0x3d7805(_0x5eebcd);})['catch'](function(_0x13518c){logger[_0x3d3d('0x10')](_0x3d3d('0x1f'),_0x13518c['message'],_0x49812b);_0x211b2d(_0x5b15d5[_0x3d3d('0x10')](0x1f4,_0x13518c[_0x3d3d('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index bca04f6..9168d0c 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 _0x6dad=['getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','multer','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0x6dad,0x77));var _0xd6da=function(_0x5c8ecd,_0xc640e0){_0x5c8ecd=_0x5c8ecd-0x0;var _0x5b8cdd=_0x6dad[_0x5c8ecd];return _0x5b8cdd;};'use strict';var multer=require(_0xd6da('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd6da('0x1'));var router=express[_0xd6da('0x2')]();var fs_extra=require(_0xd6da('0x3'));var auth=require(_0xd6da('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd6da('0x5'));var controller=require(_0xd6da('0x6'));router[_0xd6da('0x7')]('/',auth[_0xd6da('0x8')](),controller[_0xd6da('0x9')]);router[_0xd6da('0x7')](_0xd6da('0xa'),auth[_0xd6da('0x8')](),controller[_0xd6da('0xb')]);router[_0xd6da('0x7')](_0xd6da('0xc'),auth[_0xd6da('0x8')](),controller[_0xd6da('0xd')]);router['get'](_0xd6da('0xe'),auth[_0xd6da('0x8')](),controller[_0xd6da('0xf')]);router[_0xd6da('0x7')](_0xd6da('0x10'),auth[_0xd6da('0x8')](),controller[_0xd6da('0x11')]);router[_0xd6da('0x12')]('/',auth['isAuthenticated'](),controller[_0xd6da('0x13')]);router['put'](_0xd6da('0xa'),auth[_0xd6da('0x8')](),controller[_0xd6da('0x14')]);router[_0xd6da('0x15')](_0xd6da('0xa'),auth[_0xd6da('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x127c=['/:id/fields','/:id/subjects','getSubjects','post','put','update','delete','destroy','exports','multer','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','/:id','isAuthenticated','show'];(function(_0x4093bb,_0x12d5d8){var _0x349327=function(_0x405b7a){while(--_0x405b7a){_0x4093bb['push'](_0x4093bb['shift']());}};_0x349327(++_0x12d5d8);}(_0x127c,0x121));var _0xc127=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x127c[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0xc127('0x0'));var util=require('util');var path=require(_0xc127('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xc127('0x2'));var auth=require(_0xc127('0x3'));var interaction=require(_0xc127('0x4'));var config=require(_0xc127('0x5'));var controller=require(_0xc127('0x6'));router[_0xc127('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc127('0x7')](_0xc127('0x8'),auth[_0xc127('0x9')](),controller[_0xc127('0xa')]);router[_0xc127('0x7')](_0xc127('0xb'),auth['isAuthenticated'](),controller['getFields']);router[_0xc127('0x7')](_0xc127('0xc'),auth['isAuthenticated'](),controller[_0xc127('0xd')]);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router[_0xc127('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc127('0xf')](_0xc127('0x8'),auth[_0xc127('0x9')](),controller[_0xc127('0x10')]);router[_0xc127('0x11')](_0xc127('0x8'),auth[_0xc127('0x9')](),controller[_0xc127('0x12')]);module[_0xc127('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index c6fe1ef..6072c6b 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 _0xf70f=['phonecall','nothing','BOOLEAN','sequelize','STRING','ENUM','incident'];(function(_0x4d4bfd,_0x304258){var _0x5e443b=function(_0x38ae0c){while(--_0x38ae0c){_0x4d4bfd['push'](_0x4d4bfd['shift']());}};_0x5e443b(++_0x304258);}(_0xf70f,0xb2));var _0xff70=function(_0xf48244,_0x115cad){_0xf48244=_0xf48244-0x0;var _0x37d890=_0xf70f[_0xf48244];return _0x37d890;};'use strict';var Sequelize=require(_0xff70('0x0'));module['exports']={'name':{'type':Sequelize[_0xff70('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xff70('0x2')](_0xff70('0x3'),_0xff70('0x4')),'defaultValue':_0xff70('0x3')},'moduleCreate':{'type':Sequelize[_0xff70('0x2')]('contact',_0xff70('0x5')),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xff70('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xff70('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0x372f=['BOOLEAN','sequelize','exports','STRING','ENUM','incident','phonecall','nothing','contact'];(function(_0x2eafb3,_0x67e54f){var _0x9ba505=function(_0x51ab11){while(--_0x51ab11){_0x2eafb3['push'](_0x2eafb3['shift']());}};_0x9ba505(++_0x67e54f);}(_0x372f,0x64));var _0xf372=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x372f[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0xf372('0x0'));module[_0xf372('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf372('0x2')]},'ticketType':{'type':Sequelize[_0xf372('0x3')](_0xf372('0x4'),_0xf372('0x5')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0xf372('0x3')]('contact',_0xf372('0x6')),'defaultValue':_0xf372('0x7'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xf372('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 2f77b47..3280d5e 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 _0x0af1=['squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','Dynamics365Configuration','includeAll','include','findAll','rows','params','keys','rawAttributes','find','catch','create','body','getFields','Dynamics365Field','order','getSubjects','getDescriptions','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash'];(function(_0x113c1e,_0x57f6d1){var _0x2439fb=function(_0x250068){while(--_0x250068){_0x113c1e['push'](_0x113c1e['shift']());}};_0x2439fb(++_0x57f6d1);}(_0x0af1,0x1de));var _0x10af=function(_0xb2ff69,_0x4ae631){_0xb2ff69=_0xb2ff69-0x0;var _0x3f1533=_0x0af1[_0xb2ff69];return _0x3f1533;};'use strict';var emlformat=require(_0x10af('0x0'));var rimraf=require(_0x10af('0x1'));var zipdir=require(_0x10af('0x2'));var jsonpatch=require(_0x10af('0x3'));var rp=require(_0x10af('0x4'));var moment=require(_0x10af('0x5'));var BPromise=require(_0x10af('0x6'));var Mustache=require(_0x10af('0x7'));var util=require(_0x10af('0x8'));var path=require(_0x10af('0x9'));var sox=require(_0x10af('0xa'));var csv=require(_0x10af('0xb'));var ejs=require(_0x10af('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x10af('0xd'));var squel=require(_0x10af('0xe'));var crypto=require(_0x10af('0xf'));var jsforce=require(_0x10af('0x10'));var deskjs=require(_0x10af('0x11'));var toCsv=require(_0x10af('0xb'));var querystring=require(_0x10af('0x12'));var Papa=require(_0x10af('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x10af('0x14'));var as=require(_0x10af('0x15'));var hardwareService=require(_0x10af('0x16'));var logger=require(_0x10af('0x17'))(_0x10af('0x18'));var utils=require(_0x10af('0x19'));var config=require(_0x10af('0x1a'));var licenseUtil=require(_0x10af('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9ce778,_0x4cc988){_0x4cc988=_0x4cc988||0xcc;return function(_0x1e6ebb){if(_0x1e6ebb){return _0x9ce778[_0x10af('0x1c')](_0x4cc988);}return _0x9ce778['status'](_0x4cc988)['end']();};}function respondWithResult(_0x3ae7ff,_0x889862){_0x889862=_0x889862||0xc8;return function(_0x54d176){if(_0x54d176){return _0x3ae7ff[_0x10af('0x1d')](_0x889862)[_0x10af('0x1e')](_0x54d176);}};}function respondWithFilteredResult(_0x3947c9,_0x16dd17){return function(_0x355443){if(_0x355443){var _0x235776=typeof _0x16dd17[_0x10af('0x1f')]===_0x10af('0x20')&&typeof _0x16dd17[_0x10af('0x21')]==='undefined';var _0x3b7e16=_0x355443[_0x10af('0x22')];var _0x2e7b4b=_0x235776?0x0:_0x16dd17[_0x10af('0x1f')];var _0xd0bd21=_0x235776?_0x355443[_0x10af('0x22')]:_0x16dd17['offset']+_0x16dd17['limit'];var _0xc85d14;if(_0xd0bd21>=_0x3b7e16){_0xd0bd21=_0x3b7e16;_0xc85d14=0xc8;}else{_0xc85d14=0xce;}_0x3947c9[_0x10af('0x1d')](_0xc85d14);return _0x3947c9[_0x10af('0x23')]('Content-Range',_0x2e7b4b+'-'+_0xd0bd21+'/'+_0x3b7e16)[_0x10af('0x1e')](_0x355443);}return null;};}function patchUpdates(_0x1931f2){return function(_0x4c26e7){try{jsonpatch[_0x10af('0x24')](_0x4c26e7,_0x1931f2,!![]);}catch(_0x5a8048){return BPromise['reject'](_0x5a8048);}return _0x4c26e7[_0x10af('0x25')]();};}function saveUpdates(_0x379082,_0x4c5129){return function(_0x1863be){if(_0x1863be){return _0x1863be['update'](_0x379082)[_0x10af('0x26')](function(_0x25f0fb){return _0x25f0fb;});}return null;};}function removeEntity(_0x281291,_0x34f472){return function(_0x5252a4){if(_0x5252a4){return _0x5252a4[_0x10af('0x27')]()[_0x10af('0x26')](function(){_0x281291[_0x10af('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cbf47,_0x533f32){return function(_0x5ee117){if(!_0x5ee117){_0x4cbf47[_0x10af('0x1c')](0x194);}return _0x5ee117;};}function handleError(_0x1063a3,_0x1b3c38){_0x1b3c38=_0x1b3c38||0x1f4;return function(_0x46dd3a){logger[_0x10af('0x28')](_0x46dd3a[_0x10af('0x29')]);if(_0x46dd3a[_0x10af('0x2a')]){delete _0x46dd3a[_0x10af('0x2a')];}_0x1063a3[_0x10af('0x1d')](_0x1b3c38)[_0x10af('0x2b')](_0x46dd3a);};}exports[_0x10af('0x2c')]=function(_0x20c9ad,_0x2a2b36){var _0x3124e8={},_0x3f1488={},_0x35dcb7={'count':0x0,'rows':[]};var _0x1604e2=_[_0x10af('0x2d')](db['Dynamics365Configuration']['rawAttributes'],function(_0x145db4){return{'name':_0x145db4[_0x10af('0x2e')],'type':_0x145db4[_0x10af('0x2f')][_0x10af('0x30')]};});_0x3f1488[_0x10af('0x31')]=_[_0x10af('0x2d')](_0x1604e2,'name');_0x3f1488['query']=_['keys'](_0x20c9ad[_0x10af('0x32')]);_0x3f1488['filters']=_[_0x10af('0x33')](_0x3f1488[_0x10af('0x31')],_0x3f1488[_0x10af('0x32')]);_0x3124e8[_0x10af('0x34')]=_[_0x10af('0x33')](_0x3f1488[_0x10af('0x31')],qs['fields'](_0x20c9ad['query'][_0x10af('0x35')]));_0x3124e8[_0x10af('0x34')]=_0x3124e8['attributes'][_0x10af('0x36')]?_0x3124e8[_0x10af('0x34')]:_0x3f1488[_0x10af('0x31')];if(!_0x20c9ad[_0x10af('0x32')]['hasOwnProperty'](_0x10af('0x37'))){_0x3124e8[_0x10af('0x21')]=qs[_0x10af('0x21')](_0x20c9ad[_0x10af('0x32')][_0x10af('0x21')]);_0x3124e8[_0x10af('0x1f')]=qs[_0x10af('0x1f')](_0x20c9ad[_0x10af('0x32')][_0x10af('0x1f')]);}_0x3124e8['order']=qs['sort'](_0x20c9ad[_0x10af('0x32')][_0x10af('0x38')]);_0x3124e8[_0x10af('0x39')]=qs[_0x10af('0x3a')](_[_0x10af('0x3b')](_0x20c9ad['query'],_0x3f1488[_0x10af('0x3a')]),_0x1604e2);if(_0x20c9ad[_0x10af('0x32')][_0x10af('0x3c')]){_0x3124e8[_0x10af('0x39')]=_['merge'](_0x3124e8['where'],{'$or':_[_0x10af('0x2d')](_0x1604e2,function(_0x5723d2){if(_0x5723d2[_0x10af('0x2f')]!==_0x10af('0x3d')){var _0x35bb27={};_0x35bb27[_0x5723d2[_0x10af('0x2a')]]={'$like':'%'+_0x20c9ad[_0x10af('0x32')][_0x10af('0x3c')]+'%'};return _0x35bb27;}})});}_0x3124e8=_[_0x10af('0x3e')]({},_0x3124e8,_0x20c9ad[_0x10af('0x3f')]);var _0x2fdc47={'where':_0x3124e8['where']};return db[_0x10af('0x40')][_0x10af('0x22')](_0x2fdc47)['then'](function(_0x1324ad){_0x35dcb7[_0x10af('0x22')]=_0x1324ad;if(_0x20c9ad['query'][_0x10af('0x41')]){_0x3124e8[_0x10af('0x42')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x10af('0x43')](_0x3124e8);})[_0x10af('0x26')](function(_0x10fd30){_0x35dcb7[_0x10af('0x44')]=_0x10fd30;return _0x35dcb7;})[_0x10af('0x26')](respondWithFilteredResult(_0x2a2b36,_0x3124e8))['catch'](handleError(_0x2a2b36,null));};exports['show']=function(_0xc7087a,_0x46d8c8){var _0x95bf06={'raw':![],'where':{'id':_0xc7087a[_0x10af('0x45')]['id']}},_0x65554f={};_0x65554f[_0x10af('0x31')]=_[_0x10af('0x46')](db[_0x10af('0x40')][_0x10af('0x47')]);_0x65554f[_0x10af('0x32')]=_[_0x10af('0x46')](_0xc7087a[_0x10af('0x32')]);_0x65554f[_0x10af('0x3a')]=_['intersection'](_0x65554f[_0x10af('0x31')],_0x65554f[_0x10af('0x32')]);_0x95bf06['attributes']=_['intersection'](_0x65554f['model'],qs[_0x10af('0x35')](_0xc7087a[_0x10af('0x32')][_0x10af('0x35')]));_0x95bf06[_0x10af('0x34')]=_0x95bf06[_0x10af('0x34')]['length']?_0x95bf06['attributes']:_0x65554f[_0x10af('0x31')];if(_0xc7087a[_0x10af('0x32')]['includeAll']){_0x95bf06['include']=[{'all':!![]}];}_0x95bf06=_[_0x10af('0x3e')]({},_0x95bf06,_0xc7087a[_0x10af('0x3f')]);return db['Dynamics365Configuration'][_0x10af('0x48')](_0x95bf06)[_0x10af('0x26')](handleEntityNotFound(_0x46d8c8,null))[_0x10af('0x26')](respondWithResult(_0x46d8c8,null))[_0x10af('0x49')](handleError(_0x46d8c8,null));};exports[_0x10af('0x4a')]=function(_0x3af8f8,_0x2f7f3d){return db['Dynamics365Configuration'][_0x10af('0x4a')](_0x3af8f8[_0x10af('0x4b')],{})[_0x10af('0x26')](respondWithResult(_0x2f7f3d,0xc9))['catch'](handleError(_0x2f7f3d,null));};exports['update']=function(_0x56a23b,_0x3656e0){if(_0x56a23b[_0x10af('0x4b')]['id']){delete _0x56a23b[_0x10af('0x4b')]['id'];}return db[_0x10af('0x40')][_0x10af('0x48')]({'where':{'id':_0x56a23b[_0x10af('0x45')]['id']}})[_0x10af('0x26')](handleEntityNotFound(_0x3656e0,null))[_0x10af('0x26')](saveUpdates(_0x56a23b['body'],null))[_0x10af('0x26')](respondWithResult(_0x3656e0,null))['catch'](handleError(_0x3656e0,null));};exports[_0x10af('0x27')]=function(_0x14e5b9,_0x49e489){return db[_0x10af('0x40')][_0x10af('0x48')]({'where':{'id':_0x14e5b9[_0x10af('0x45')]['id']}})[_0x10af('0x26')](handleEntityNotFound(_0x49e489,null))[_0x10af('0x26')](removeEntity(_0x49e489,null))['catch'](handleError(_0x49e489,null));};exports[_0x10af('0x4c')]=function(_0x3b22e0,_0xda1121,_0x271592){var _0x37dd14={};var _0x4b55e2={};var _0x315beb;var _0x112622;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x3b22e0[_0x10af('0x45')]['id']}})[_0x10af('0x26')](handleEntityNotFound(_0xda1121,null))[_0x10af('0x26')](function(_0x37c267){if(_0x37c267){_0x315beb=_0x37c267;_0x4b55e2[_0x10af('0x31')]=_[_0x10af('0x46')](db[_0x10af('0x4d')][_0x10af('0x47')]);_0x4b55e2[_0x10af('0x32')]=_['keys'](_0x3b22e0[_0x10af('0x32')]);_0x4b55e2[_0x10af('0x3a')]=_[_0x10af('0x33')](_0x4b55e2[_0x10af('0x31')],_0x4b55e2['query']);_0x37dd14[_0x10af('0x34')]=_['intersection'](_0x4b55e2[_0x10af('0x31')],qs['fields'](_0x3b22e0[_0x10af('0x32')][_0x10af('0x35')]));_0x37dd14[_0x10af('0x34')]=_0x37dd14['attributes'][_0x10af('0x36')]?_0x37dd14['attributes']:_0x4b55e2['model'];_0x37dd14[_0x10af('0x4e')]=qs[_0x10af('0x38')](_0x3b22e0[_0x10af('0x32')]['sort']);_0x37dd14[_0x10af('0x39')]=qs['filters'](_['pick'](_0x3b22e0[_0x10af('0x32')],_0x4b55e2[_0x10af('0x3a')]));if(_0x3b22e0[_0x10af('0x32')][_0x10af('0x3c')]){_0x37dd14[_0x10af('0x39')]=_['merge'](_0x37dd14['where'],{'$or':_[_0x10af('0x2d')](_0x37dd14[_0x10af('0x34')],function(_0x367470){var _0x498596={};_0x498596[_0x367470]={'$like':'%'+_0x3b22e0[_0x10af('0x32')][_0x10af('0x3c')]+'%'};return _0x498596;})});}_0x37dd14=_['merge']({},_0x37dd14,_0x3b22e0['options']);return _0x315beb[_0x10af('0x4c')](_0x37dd14);}})['then'](function(_0x159600){if(_0x159600){_0x112622=_0x159600[_0x10af('0x36')];if(!_0x3b22e0['query']['hasOwnProperty'](_0x10af('0x37'))){_0x37dd14[_0x10af('0x21')]=qs[_0x10af('0x21')](_0x3b22e0[_0x10af('0x32')][_0x10af('0x21')]);_0x37dd14['offset']=qs['offset'](_0x3b22e0[_0x10af('0x32')][_0x10af('0x1f')]);}return _0x315beb[_0x10af('0x4c')](_0x37dd14);}})['then'](function(_0xb58100){if(_0xb58100){return _0xb58100?{'count':_0x112622,'rows':_0xb58100}:null;}})[_0x10af('0x26')](respondWithResult(_0xda1121,null))[_0x10af('0x49')](handleError(_0xda1121,null));};exports['getSubjects']=function(_0x5480ed,_0x5864e5,_0x27e38f){var _0x39d860={};var _0x32e9d2={};var _0x467bf8;var _0x1d9bf6;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x5480ed[_0x10af('0x45')]['id']}})[_0x10af('0x26')](handleEntityNotFound(_0x5864e5,null))['then'](function(_0x521c1d){if(_0x521c1d){_0x467bf8=_0x521c1d;_0x32e9d2[_0x10af('0x31')]=_[_0x10af('0x46')](db[_0x10af('0x4d')][_0x10af('0x47')]);_0x32e9d2[_0x10af('0x32')]=_[_0x10af('0x46')](_0x5480ed['query']);_0x32e9d2[_0x10af('0x3a')]=_[_0x10af('0x33')](_0x32e9d2['model'],_0x32e9d2[_0x10af('0x32')]);_0x39d860['attributes']=_[_0x10af('0x33')](_0x32e9d2['model'],qs[_0x10af('0x35')](_0x5480ed[_0x10af('0x32')][_0x10af('0x35')]));_0x39d860[_0x10af('0x34')]=_0x39d860['attributes'][_0x10af('0x36')]?_0x39d860[_0x10af('0x34')]:_0x32e9d2[_0x10af('0x31')];_0x39d860[_0x10af('0x4e')]=qs['sort'](_0x5480ed['query'][_0x10af('0x38')]);_0x39d860[_0x10af('0x39')]=qs[_0x10af('0x3a')](_['pick'](_0x5480ed[_0x10af('0x32')],_0x32e9d2[_0x10af('0x3a')]));if(_0x5480ed[_0x10af('0x32')][_0x10af('0x3c')]){_0x39d860[_0x10af('0x39')]=_[_0x10af('0x3e')](_0x39d860[_0x10af('0x39')],{'$or':_[_0x10af('0x2d')](_0x39d860['attributes'],function(_0x2c40b2){var _0x59eed1={};_0x59eed1[_0x2c40b2]={'$like':'%'+_0x5480ed[_0x10af('0x32')][_0x10af('0x3c')]+'%'};return _0x59eed1;})});}_0x39d860=_['merge']({},_0x39d860,_0x5480ed[_0x10af('0x3f')]);return _0x467bf8[_0x10af('0x4f')](_0x39d860);}})[_0x10af('0x26')](function(_0x4667fc){if(_0x4667fc){_0x1d9bf6=_0x4667fc['length'];if(!_0x5480ed['query']['hasOwnProperty'](_0x10af('0x37'))){_0x39d860['limit']=qs['limit'](_0x5480ed['query'][_0x10af('0x21')]);_0x39d860[_0x10af('0x1f')]=qs[_0x10af('0x1f')](_0x5480ed[_0x10af('0x32')][_0x10af('0x1f')]);}return _0x467bf8[_0x10af('0x4f')](_0x39d860);}})[_0x10af('0x26')](function(_0x2f7320){if(_0x2f7320){return _0x2f7320?{'count':_0x1d9bf6,'rows':_0x2f7320}:null;}})['then'](respondWithResult(_0x5864e5,null))[_0x10af('0x49')](handleError(_0x5864e5,null));};exports[_0x10af('0x50')]=function(_0xacb09,_0x4b0227,_0x6d29c2){var _0x350fcc={};var _0xc1a825={};var _0x3d1281;var _0x2be78c;return db[_0x10af('0x40')][_0x10af('0x51')]({'where':{'id':_0xacb09[_0x10af('0x45')]['id']}})[_0x10af('0x26')](handleEntityNotFound(_0x4b0227,null))['then'](function(_0x447605){if(_0x447605){_0x3d1281=_0x447605;_0xc1a825[_0x10af('0x31')]=_[_0x10af('0x46')](db[_0x10af('0x4d')][_0x10af('0x47')]);_0xc1a825[_0x10af('0x32')]=_[_0x10af('0x46')](_0xacb09['query']);_0xc1a825[_0x10af('0x3a')]=_['intersection'](_0xc1a825[_0x10af('0x31')],_0xc1a825[_0x10af('0x32')]);_0x350fcc[_0x10af('0x34')]=_[_0x10af('0x33')](_0xc1a825[_0x10af('0x31')],qs[_0x10af('0x35')](_0xacb09['query'][_0x10af('0x35')]));_0x350fcc[_0x10af('0x34')]=_0x350fcc[_0x10af('0x34')][_0x10af('0x36')]?_0x350fcc[_0x10af('0x34')]:_0xc1a825[_0x10af('0x31')];_0x350fcc['order']=qs['sort'](_0xacb09[_0x10af('0x32')][_0x10af('0x38')]);_0x350fcc['where']=qs[_0x10af('0x3a')](_['pick'](_0xacb09[_0x10af('0x32')],_0xc1a825['filters']));if(_0xacb09[_0x10af('0x32')][_0x10af('0x3c')]){_0x350fcc[_0x10af('0x39')]=_['merge'](_0x350fcc[_0x10af('0x39')],{'$or':_[_0x10af('0x2d')](_0x350fcc[_0x10af('0x34')],function(_0x4b6cce){var _0x30d52f={};_0x30d52f[_0x4b6cce]={'$like':'%'+_0xacb09['query'][_0x10af('0x3c')]+'%'};return _0x30d52f;})});}_0x350fcc=_[_0x10af('0x3e')]({},_0x350fcc,_0xacb09[_0x10af('0x3f')]);return _0x3d1281[_0x10af('0x50')](_0x350fcc);}})[_0x10af('0x26')](function(_0x35c6ea){if(_0x35c6ea){_0x2be78c=_0x35c6ea[_0x10af('0x36')];if(!_0xacb09[_0x10af('0x32')]['hasOwnProperty']('nolimit')){_0x350fcc[_0x10af('0x21')]=qs[_0x10af('0x21')](_0xacb09[_0x10af('0x32')][_0x10af('0x21')]);_0x350fcc[_0x10af('0x1f')]=qs['offset'](_0xacb09[_0x10af('0x32')]['offset']);}return _0x3d1281[_0x10af('0x50')](_0x350fcc);}})[_0x10af('0x26')](function(_0x42ff85){if(_0x42ff85){return _0x42ff85?{'count':_0x2be78c,'rows':_0x42ff85}:null;}})['then'](respondWithResult(_0x4b0227,null))['catch'](handleError(_0x4b0227,null));}; \ No newline at end of file +var _0x664b=['includeAll','include','catch','show','params','fields','options','find','create','update','body','getFields','findOne','Dynamics365Field','order','pick','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','count','limit','set','Content-Range','reject','save','then','destroy','sendStatus','error','stack','name','send','index','Dynamics365Configuration','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL'];(function(_0x33b4db,_0xd35a4a){var _0x17701b=function(_0x10e52e){while(--_0x10e52e){_0x33b4db['push'](_0x33b4db['shift']());}};_0x17701b(++_0xd35a4a);}(_0x664b,0xff));var _0xb664=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x664b[_0xfae23b];return _0x200640;};'use strict';var emlformat=require(_0xb664('0x0'));var rimraf=require(_0xb664('0x1'));var zipdir=require(_0xb664('0x2'));var jsonpatch=require(_0xb664('0x3'));var rp=require(_0xb664('0x4'));var moment=require('moment');var BPromise=require(_0xb664('0x5'));var Mustache=require(_0xb664('0x6'));var util=require('util');var path=require(_0xb664('0x7'));var sox=require(_0xb664('0x8'));var csv=require(_0xb664('0x9'));var ejs=require(_0xb664('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb664('0xb'));var crypto=require(_0xb664('0xc'));var jsforce=require(_0xb664('0xd'));var deskjs=require(_0xb664('0xe'));var toCsv=require(_0xb664('0x9'));var querystring=require(_0xb664('0xf'));var Papa=require('papaparse');var Redis=require(_0xb664('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb664('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb664('0x12'));var logger=require(_0xb664('0x13'))(_0xb664('0x14'));var utils=require(_0xb664('0x15'));var config=require(_0xb664('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb664('0x17'))['db'];function respondWithStatusCode(_0x588abe,_0xdf3723){_0xdf3723=_0xdf3723||0xcc;return function(_0x726c69){if(_0x726c69){return _0x588abe['sendStatus'](_0xdf3723);}return _0x588abe[_0xb664('0x18')](_0xdf3723)[_0xb664('0x19')]();};}function respondWithResult(_0x1d6fdc,_0x318e2c){_0x318e2c=_0x318e2c||0xc8;return function(_0x4997e7){if(_0x4997e7){return _0x1d6fdc[_0xb664('0x18')](_0x318e2c)['json'](_0x4997e7);}};}function respondWithFilteredResult(_0x253246,_0x305cb8){return function(_0x2de94e){if(_0x2de94e){var _0xc5bb7f=typeof _0x305cb8[_0xb664('0x1a')]===_0xb664('0x1b')&&typeof _0x305cb8['limit']===_0xb664('0x1b');var _0x294a3b=_0x2de94e[_0xb664('0x1c')];var _0x2b3ae4=_0xc5bb7f?0x0:_0x305cb8[_0xb664('0x1a')];var _0x401a5c=_0xc5bb7f?_0x2de94e['count']:_0x305cb8['offset']+_0x305cb8[_0xb664('0x1d')];var _0x1bbfbe;if(_0x401a5c>=_0x294a3b){_0x401a5c=_0x294a3b;_0x1bbfbe=0xc8;}else{_0x1bbfbe=0xce;}_0x253246[_0xb664('0x18')](_0x1bbfbe);return _0x253246[_0xb664('0x1e')](_0xb664('0x1f'),_0x2b3ae4+'-'+_0x401a5c+'/'+_0x294a3b)['json'](_0x2de94e);}return null;};}function patchUpdates(_0x41c01a){return function(_0x3934d9){try{jsonpatch['apply'](_0x3934d9,_0x41c01a,!![]);}catch(_0x3609e5){return BPromise[_0xb664('0x20')](_0x3609e5);}return _0x3934d9[_0xb664('0x21')]();};}function saveUpdates(_0x30d7e3,_0x1f1a43){return function(_0x3fd742){if(_0x3fd742){return _0x3fd742['update'](_0x30d7e3)[_0xb664('0x22')](function(_0x36a752){return _0x36a752;});}return null;};}function removeEntity(_0xfd5da1,_0x49c0ff){return function(_0x179cf0){if(_0x179cf0){return _0x179cf0[_0xb664('0x23')]()[_0xb664('0x22')](function(){_0xfd5da1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xa035e7,_0x215ec6){return function(_0x99bda9){if(!_0x99bda9){_0xa035e7[_0xb664('0x24')](0x194);}return _0x99bda9;};}function handleError(_0x551c4d,_0x3b9e05){_0x3b9e05=_0x3b9e05||0x1f4;return function(_0x44432e){logger[_0xb664('0x25')](_0x44432e[_0xb664('0x26')]);if(_0x44432e['name']){delete _0x44432e[_0xb664('0x27')];}_0x551c4d[_0xb664('0x18')](_0x3b9e05)[_0xb664('0x28')](_0x44432e);};}exports[_0xb664('0x29')]=function(_0x347491,_0x4d923f){var _0x50a9a5={},_0x874e1e={},_0x20f3f7={'count':0x0,'rows':[]};var _0x426149=_['map'](db[_0xb664('0x2a')][_0xb664('0x2b')],function(_0x4a5be2){return{'name':_0x4a5be2[_0xb664('0x2c')],'type':_0x4a5be2['type'][_0xb664('0x2d')]};});_0x874e1e['model']=_[_0xb664('0x2e')](_0x426149,_0xb664('0x27'));_0x874e1e[_0xb664('0x2f')]=_[_0xb664('0x30')](_0x347491[_0xb664('0x2f')]);_0x874e1e[_0xb664('0x31')]=_[_0xb664('0x32')](_0x874e1e[_0xb664('0x33')],_0x874e1e[_0xb664('0x2f')]);_0x50a9a5[_0xb664('0x34')]=_[_0xb664('0x32')](_0x874e1e[_0xb664('0x33')],qs['fields'](_0x347491[_0xb664('0x2f')]['fields']));_0x50a9a5['attributes']=_0x50a9a5['attributes'][_0xb664('0x35')]?_0x50a9a5['attributes']:_0x874e1e['model'];if(!_0x347491[_0xb664('0x2f')][_0xb664('0x36')](_0xb664('0x37'))){_0x50a9a5[_0xb664('0x1d')]=qs[_0xb664('0x1d')](_0x347491[_0xb664('0x2f')][_0xb664('0x1d')]);_0x50a9a5[_0xb664('0x1a')]=qs[_0xb664('0x1a')](_0x347491['query'][_0xb664('0x1a')]);}_0x50a9a5['order']=qs[_0xb664('0x38')](_0x347491[_0xb664('0x2f')][_0xb664('0x38')]);_0x50a9a5[_0xb664('0x39')]=qs[_0xb664('0x31')](_['pick'](_0x347491['query'],_0x874e1e[_0xb664('0x31')]),_0x426149);if(_0x347491[_0xb664('0x2f')][_0xb664('0x3a')]){_0x50a9a5[_0xb664('0x39')]=_[_0xb664('0x3b')](_0x50a9a5[_0xb664('0x39')],{'$or':_['map'](_0x426149,function(_0x5f5935){if(_0x5f5935['type']!==_0xb664('0x3c')){var _0x251a4a={};_0x251a4a[_0x5f5935[_0xb664('0x27')]]={'$like':'%'+_0x347491['query']['filter']+'%'};return _0x251a4a;}})});}_0x50a9a5=_[_0xb664('0x3b')]({},_0x50a9a5,_0x347491['options']);var _0x34a9e4={'where':_0x50a9a5['where']};return db[_0xb664('0x2a')]['count'](_0x34a9e4)[_0xb664('0x22')](function(_0x3a6543){_0x20f3f7[_0xb664('0x1c')]=_0x3a6543;if(_0x347491[_0xb664('0x2f')][_0xb664('0x3d')]){_0x50a9a5[_0xb664('0x3e')]=[{'all':!![]}];}return db[_0xb664('0x2a')]['findAll'](_0x50a9a5);})[_0xb664('0x22')](function(_0x47d4c7){_0x20f3f7['rows']=_0x47d4c7;return _0x20f3f7;})[_0xb664('0x22')](respondWithFilteredResult(_0x4d923f,_0x50a9a5))[_0xb664('0x3f')](handleError(_0x4d923f,null));};exports[_0xb664('0x40')]=function(_0x55b9db,_0x4057c8){var _0x26a48a={'raw':![],'where':{'id':_0x55b9db[_0xb664('0x41')]['id']}},_0xb1b5be={};_0xb1b5be[_0xb664('0x33')]=_['keys'](db[_0xb664('0x2a')]['rawAttributes']);_0xb1b5be[_0xb664('0x2f')]=_[_0xb664('0x30')](_0x55b9db['query']);_0xb1b5be[_0xb664('0x31')]=_[_0xb664('0x32')](_0xb1b5be['model'],_0xb1b5be[_0xb664('0x2f')]);_0x26a48a[_0xb664('0x34')]=_[_0xb664('0x32')](_0xb1b5be[_0xb664('0x33')],qs[_0xb664('0x42')](_0x55b9db['query'][_0xb664('0x42')]));_0x26a48a['attributes']=_0x26a48a[_0xb664('0x34')]['length']?_0x26a48a['attributes']:_0xb1b5be[_0xb664('0x33')];if(_0x55b9db[_0xb664('0x2f')][_0xb664('0x3d')]){_0x26a48a[_0xb664('0x3e')]=[{'all':!![]}];}_0x26a48a=_[_0xb664('0x3b')]({},_0x26a48a,_0x55b9db[_0xb664('0x43')]);return db[_0xb664('0x2a')][_0xb664('0x44')](_0x26a48a)[_0xb664('0x22')](handleEntityNotFound(_0x4057c8,null))[_0xb664('0x22')](respondWithResult(_0x4057c8,null))[_0xb664('0x3f')](handleError(_0x4057c8,null));};exports[_0xb664('0x45')]=function(_0x17f8f5,_0x333d27){return db[_0xb664('0x2a')][_0xb664('0x45')](_0x17f8f5['body'],{})[_0xb664('0x22')](respondWithResult(_0x333d27,0xc9))['catch'](handleError(_0x333d27,null));};exports[_0xb664('0x46')]=function(_0x497aee,_0x70e100){if(_0x497aee[_0xb664('0x47')]['id']){delete _0x497aee[_0xb664('0x47')]['id'];}return db[_0xb664('0x2a')][_0xb664('0x44')]({'where':{'id':_0x497aee[_0xb664('0x41')]['id']}})[_0xb664('0x22')](handleEntityNotFound(_0x70e100,null))[_0xb664('0x22')](saveUpdates(_0x497aee[_0xb664('0x47')],null))[_0xb664('0x22')](respondWithResult(_0x70e100,null))[_0xb664('0x3f')](handleError(_0x70e100,null));};exports[_0xb664('0x23')]=function(_0x10f4ca,_0x36d8c0){return db['Dynamics365Configuration']['find']({'where':{'id':_0x10f4ca[_0xb664('0x41')]['id']}})[_0xb664('0x22')](handleEntityNotFound(_0x36d8c0,null))[_0xb664('0x22')](removeEntity(_0x36d8c0,null))[_0xb664('0x3f')](handleError(_0x36d8c0,null));};exports[_0xb664('0x48')]=function(_0x56b7da,_0x389976,_0x28a99a){var _0x26e481={};var _0x340200={};var _0x3a6307;var _0x42270b;return db['Dynamics365Configuration'][_0xb664('0x49')]({'where':{'id':_0x56b7da['params']['id']}})['then'](handleEntityNotFound(_0x389976,null))[_0xb664('0x22')](function(_0x475348){if(_0x475348){_0x3a6307=_0x475348;_0x340200[_0xb664('0x33')]=_[_0xb664('0x30')](db[_0xb664('0x4a')][_0xb664('0x2b')]);_0x340200[_0xb664('0x2f')]=_[_0xb664('0x30')](_0x56b7da[_0xb664('0x2f')]);_0x340200[_0xb664('0x31')]=_['intersection'](_0x340200[_0xb664('0x33')],_0x340200[_0xb664('0x2f')]);_0x26e481['attributes']=_[_0xb664('0x32')](_0x340200[_0xb664('0x33')],qs[_0xb664('0x42')](_0x56b7da['query']['fields']));_0x26e481[_0xb664('0x34')]=_0x26e481['attributes'][_0xb664('0x35')]?_0x26e481[_0xb664('0x34')]:_0x340200['model'];_0x26e481[_0xb664('0x4b')]=qs[_0xb664('0x38')](_0x56b7da[_0xb664('0x2f')]['sort']);_0x26e481['where']=qs[_0xb664('0x31')](_[_0xb664('0x4c')](_0x56b7da[_0xb664('0x2f')],_0x340200['filters']));if(_0x56b7da[_0xb664('0x2f')]['filter']){_0x26e481[_0xb664('0x39')]=_[_0xb664('0x3b')](_0x26e481[_0xb664('0x39')],{'$or':_[_0xb664('0x2e')](_0x26e481[_0xb664('0x34')],function(_0xde0229){var _0x537795={};_0x537795[_0xde0229]={'$like':'%'+_0x56b7da[_0xb664('0x2f')][_0xb664('0x3a')]+'%'};return _0x537795;})});}_0x26e481=_[_0xb664('0x3b')]({},_0x26e481,_0x56b7da['options']);return _0x3a6307['getFields'](_0x26e481);}})[_0xb664('0x22')](function(_0xc5783a){if(_0xc5783a){_0x42270b=_0xc5783a[_0xb664('0x35')];if(!_0x56b7da[_0xb664('0x2f')][_0xb664('0x36')](_0xb664('0x37'))){_0x26e481['limit']=qs[_0xb664('0x1d')](_0x56b7da[_0xb664('0x2f')][_0xb664('0x1d')]);_0x26e481[_0xb664('0x1a')]=qs['offset'](_0x56b7da[_0xb664('0x2f')][_0xb664('0x1a')]);}return _0x3a6307['getFields'](_0x26e481);}})['then'](function(_0x105882){if(_0x105882){return _0x105882?{'count':_0x42270b,'rows':_0x105882}:null;}})[_0xb664('0x22')](respondWithResult(_0x389976,null))[_0xb664('0x3f')](handleError(_0x389976,null));};exports[_0xb664('0x4d')]=function(_0x1ca100,_0x2b2cc4,_0x3ee47a){var _0x352723={};var _0x4e2d25={};var _0x70d123;var _0x2d7d4e;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x1ca100['params']['id']}})[_0xb664('0x22')](handleEntityNotFound(_0x2b2cc4,null))[_0xb664('0x22')](function(_0x473497){if(_0x473497){_0x70d123=_0x473497;_0x4e2d25[_0xb664('0x33')]=_['keys'](db['Dynamics365Field']['rawAttributes']);_0x4e2d25['query']=_[_0xb664('0x30')](_0x1ca100[_0xb664('0x2f')]);_0x4e2d25[_0xb664('0x31')]=_[_0xb664('0x32')](_0x4e2d25[_0xb664('0x33')],_0x4e2d25[_0xb664('0x2f')]);_0x352723['attributes']=_[_0xb664('0x32')](_0x4e2d25['model'],qs[_0xb664('0x42')](_0x1ca100['query'][_0xb664('0x42')]));_0x352723[_0xb664('0x34')]=_0x352723[_0xb664('0x34')][_0xb664('0x35')]?_0x352723['attributes']:_0x4e2d25[_0xb664('0x33')];_0x352723['order']=qs[_0xb664('0x38')](_0x1ca100['query'][_0xb664('0x38')]);_0x352723['where']=qs[_0xb664('0x31')](_[_0xb664('0x4c')](_0x1ca100[_0xb664('0x2f')],_0x4e2d25['filters']));if(_0x1ca100[_0xb664('0x2f')][_0xb664('0x3a')]){_0x352723[_0xb664('0x39')]=_[_0xb664('0x3b')](_0x352723[_0xb664('0x39')],{'$or':_[_0xb664('0x2e')](_0x352723[_0xb664('0x34')],function(_0x156ca2){var _0x3ba2c7={};_0x3ba2c7[_0x156ca2]={'$like':'%'+_0x1ca100['query'][_0xb664('0x3a')]+'%'};return _0x3ba2c7;})});}_0x352723=_[_0xb664('0x3b')]({},_0x352723,_0x1ca100[_0xb664('0x43')]);return _0x70d123[_0xb664('0x4d')](_0x352723);}})[_0xb664('0x22')](function(_0xbd45aa){if(_0xbd45aa){_0x2d7d4e=_0xbd45aa[_0xb664('0x35')];if(!_0x1ca100[_0xb664('0x2f')][_0xb664('0x36')](_0xb664('0x37'))){_0x352723[_0xb664('0x1d')]=qs[_0xb664('0x1d')](_0x1ca100[_0xb664('0x2f')][_0xb664('0x1d')]);_0x352723[_0xb664('0x1a')]=qs[_0xb664('0x1a')](_0x1ca100[_0xb664('0x2f')][_0xb664('0x1a')]);}return _0x70d123[_0xb664('0x4d')](_0x352723);}})[_0xb664('0x22')](function(_0x4cf502){if(_0x4cf502){return _0x4cf502?{'count':_0x2d7d4e,'rows':_0x4cf502}:null;}})[_0xb664('0x22')](respondWithResult(_0x2b2cc4,null))[_0xb664('0x3f')](handleError(_0x2b2cc4,null));};exports['getDescriptions']=function(_0x52e52e,_0x4c5235,_0x22bc75){var _0x1a63e6={};var _0x78ca4c={};var _0x213cc8;var _0x453926;return db['Dynamics365Configuration'][_0xb664('0x49')]({'where':{'id':_0x52e52e[_0xb664('0x41')]['id']}})['then'](handleEntityNotFound(_0x4c5235,null))[_0xb664('0x22')](function(_0x10f0cc){if(_0x10f0cc){_0x213cc8=_0x10f0cc;_0x78ca4c['model']=_[_0xb664('0x30')](db[_0xb664('0x4a')]['rawAttributes']);_0x78ca4c[_0xb664('0x2f')]=_[_0xb664('0x30')](_0x52e52e[_0xb664('0x2f')]);_0x78ca4c[_0xb664('0x31')]=_[_0xb664('0x32')](_0x78ca4c[_0xb664('0x33')],_0x78ca4c[_0xb664('0x2f')]);_0x1a63e6[_0xb664('0x34')]=_[_0xb664('0x32')](_0x78ca4c[_0xb664('0x33')],qs['fields'](_0x52e52e[_0xb664('0x2f')][_0xb664('0x42')]));_0x1a63e6[_0xb664('0x34')]=_0x1a63e6[_0xb664('0x34')][_0xb664('0x35')]?_0x1a63e6[_0xb664('0x34')]:_0x78ca4c[_0xb664('0x33')];_0x1a63e6[_0xb664('0x4b')]=qs[_0xb664('0x38')](_0x52e52e[_0xb664('0x2f')]['sort']);_0x1a63e6[_0xb664('0x39')]=qs[_0xb664('0x31')](_[_0xb664('0x4c')](_0x52e52e[_0xb664('0x2f')],_0x78ca4c['filters']));if(_0x52e52e['query'][_0xb664('0x3a')]){_0x1a63e6['where']=_[_0xb664('0x3b')](_0x1a63e6[_0xb664('0x39')],{'$or':_[_0xb664('0x2e')](_0x1a63e6[_0xb664('0x34')],function(_0x147d01){var _0xf53a3e={};_0xf53a3e[_0x147d01]={'$like':'%'+_0x52e52e[_0xb664('0x2f')][_0xb664('0x3a')]+'%'};return _0xf53a3e;})});}_0x1a63e6=_[_0xb664('0x3b')]({},_0x1a63e6,_0x52e52e['options']);return _0x213cc8[_0xb664('0x4e')](_0x1a63e6);}})[_0xb664('0x22')](function(_0x495e4e){if(_0x495e4e){_0x453926=_0x495e4e['length'];if(!_0x52e52e[_0xb664('0x2f')][_0xb664('0x36')](_0xb664('0x37'))){_0x1a63e6[_0xb664('0x1d')]=qs[_0xb664('0x1d')](_0x52e52e[_0xb664('0x2f')][_0xb664('0x1d')]);_0x1a63e6[_0xb664('0x1a')]=qs[_0xb664('0x1a')](_0x52e52e['query'][_0xb664('0x1a')]);}return _0x213cc8['getDescriptions'](_0x1a63e6);}})[_0xb664('0x22')](function(_0x309217){if(_0x309217){return _0x309217?{'count':_0x453926,'rows':_0x309217}:null;}})[_0xb664('0x22')](respondWithResult(_0x4c5235,null))[_0xb664('0x3f')](handleError(_0x4c5235,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 0ee0ed9..910b362 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 _0x84ab=['request-promise','path','../../config/environment','./intDynamics365Configuration.attributes','exports','Dynamics365Configuration','lodash','util','../../config/logger','api','moment'];(function(_0x442c60,_0x27c0fb){var _0x2242f3=function(_0x409aaa){while(--_0x409aaa){_0x442c60['push'](_0x442c60['shift']());}};_0x2242f3(++_0x27c0fb);}(_0x84ab,0x12f));var _0xb84a=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0x84ab[_0x1da04e];return _0xdd8c41;};'use strict';var _=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var logger=require(_0xb84a('0x2'))(_0xb84a('0x3'));var moment=require(_0xb84a('0x4'));var BPromise=require('bluebird');var rp=require(_0xb84a('0x5'));var fs=require('fs');var path=require(_0xb84a('0x6'));var rimraf=require('rimraf');var config=require(_0xb84a('0x7'));var attributes=require(_0xb84a('0x8'));module[_0xb84a('0x9')]=function(_0x5b9def,_0x521a64){return _0x5b9def['define'](_0xb84a('0xa'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f0d=['./intDynamics365Configuration.attributes','define','Dynamics365Configuration','int_dynamics365_configurations','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x3f5fd3,_0x319a75){_0x3f5fd3=_0x3f5fd3-0x0;var _0x1026ef=_0x6f0d[_0x3f5fd3];return _0x1026ef;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var logger=require(_0xd6f0('0x1'))(_0xd6f0('0x2'));var moment=require(_0xd6f0('0x3'));var BPromise=require('bluebird');var rp=require(_0xd6f0('0x4'));var fs=require('fs');var path=require(_0xd6f0('0x5'));var rimraf=require(_0xd6f0('0x6'));var config=require(_0xd6f0('0x7'));var attributes=require(_0xd6f0('0x8'));module['exports']=function(_0x2d2ce6,_0x4a8b0c){return _0x2d2ce6[_0xd6f0('0x9')](_0xd6f0('0xa'),attributes,{'tableName':_0xd6f0('0xb'),'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 5fb3af5..dbb9872 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 _0x1104=['jayson/promise','client','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x55d022,_0x215de7){var _0x382771=function(_0x400487){while(--_0x400487){_0x55d022['push'](_0x55d022['shift']());}};_0x382771(++_0x215de7);}(_0x1104,0xbd));var _0x4110=function(_0x241469,_0x48dc40){_0x241469=_0x241469-0x0;var _0x436491=_0x1104[_0x241469];return _0x436491;};'use strict';var _=require(_0x4110('0x0'));var util=require(_0x4110('0x1'));var moment=require(_0x4110('0x2'));var BPromise=require(_0x4110('0x3'));var rs=require(_0x4110('0x4'));var fs=require('fs');var Redis=require(_0x4110('0x5'));var db=require(_0x4110('0x6'))['db'];var utils=require(_0x4110('0x7'));var logger=require(_0x4110('0x8'))(_0x4110('0x9'));var config=require(_0x4110('0xa'));var jayson=require(_0x4110('0xb'));var client=jayson[_0x4110('0xc')][_0x4110('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5b4233,_0x425236,_0x183fd9){return new BPromise(function(_0x389357,_0xc8c2a0){return client[_0x4110('0xe')](_0x5b4233,_0x183fd9)['then'](function(_0x1d306b){logger[_0x4110('0xf')](_0x4110('0x10'),_0x425236,_0x4110('0x11'));logger[_0x4110('0x12')](_0x4110('0x13'),_0x425236,_0x4110('0x11'),JSON['stringify'](_0x1d306b));if(_0x1d306b[_0x4110('0x14')]){if(_0x1d306b[_0x4110('0x14')][_0x4110('0x15')]===0x1f4){logger[_0x4110('0x14')](_0x4110('0x10'),_0x425236,_0x1d306b[_0x4110('0x14')][_0x4110('0x16')]);return _0xc8c2a0(_0x1d306b[_0x4110('0x14')][_0x4110('0x16')]);}logger[_0x4110('0x14')](_0x4110('0x10'),_0x425236,_0x1d306b[_0x4110('0x14')][_0x4110('0x16')]);return _0x389357(_0x1d306b['error']['message']);}else{logger[_0x4110('0xf')](_0x4110('0x10'),_0x425236,_0x4110('0x11'));_0x389357(_0x1d306b[_0x4110('0x17')]['message']);}})[_0x4110('0x18')](function(_0x13002d){logger[_0x4110('0x14')](_0x4110('0x10'),_0x425236,_0x13002d);_0xc8c2a0(_0x13002d);});});} \ No newline at end of file +var _0x0257=['code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x4e8db9,_0x15ff81){var _0x1fc3be=function(_0x1cc230){while(--_0x1cc230){_0x4e8db9['push'](_0x4e8db9['shift']());}};_0x1fc3be(++_0x15ff81);}(_0x0257,0xb8));var _0x7025=function(_0x4c0b23,_0x474c1c){_0x4c0b23=_0x4c0b23-0x0;var _0x3a06f0=_0x0257[_0x4c0b23];return _0x3a06f0;};'use strict';var _=require(_0x7025('0x0'));var util=require(_0x7025('0x1'));var moment=require(_0x7025('0x2'));var BPromise=require('bluebird');var rs=require(_0x7025('0x3'));var fs=require('fs');var Redis=require(_0x7025('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7025('0x5'));var logger=require(_0x7025('0x6'))(_0x7025('0x7'));var config=require(_0x7025('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2cbce8,_0x2069c8,_0x374c0c){return new BPromise(function(_0x1aadb1,_0x5ec178){return client['request'](_0x2cbce8,_0x374c0c)[_0x7025('0x9')](function(_0xab24){logger[_0x7025('0xa')](_0x7025('0xb'),_0x2069c8,_0x7025('0xc'));logger[_0x7025('0xd')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x2069c8,'request\x20sent',JSON[_0x7025('0xe')](_0xab24));if(_0xab24[_0x7025('0xf')]){if(_0xab24[_0x7025('0xf')][_0x7025('0x10')]===0x1f4){logger[_0x7025('0xf')](_0x7025('0xb'),_0x2069c8,_0xab24[_0x7025('0xf')][_0x7025('0x11')]);return _0x5ec178(_0xab24[_0x7025('0xf')][_0x7025('0x11')]);}logger['error'](_0x7025('0xb'),_0x2069c8,_0xab24[_0x7025('0xf')][_0x7025('0x11')]);return _0x1aadb1(_0xab24[_0x7025('0xf')][_0x7025('0x11')]);}else{logger[_0x7025('0xa')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2069c8,_0x7025('0xc'));_0x1aadb1(_0xab24[_0x7025('0x12')][_0x7025('0x11')]);}})[_0x7025('0x13')](function(_0x5b08df){logger[_0x7025('0xf')](_0x7025('0xb'),_0x2069c8,_0x5b08df);_0x5ec178(_0x5b08df);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 648efdc..7d81371 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 _0x0b31=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','create','put','delete','exports','util','path','connect-timeout','express','Router'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x0b31,0x7b));var _0x10b3=function(_0x42802f,_0x34c93e){_0x42802f=_0x42802f-0x0;var _0x4c2dd4=_0x0b31[_0x42802f];return _0x4c2dd4;};'use strict';var multer=require('multer');var util=require(_0x10b3('0x0'));var path=require(_0x10b3('0x1'));var timeout=require(_0x10b3('0x2'));var express=require(_0x10b3('0x3'));var router=express[_0x10b3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x10b3('0x5'));var interaction=require(_0x10b3('0x6'));var config=require(_0x10b3('0x7'));var controller=require('./intDynamics365Field.controller');router[_0x10b3('0x8')]('/',auth[_0x10b3('0x9')](),controller[_0x10b3('0xa')]);router[_0x10b3('0x8')](_0x10b3('0xb'),auth[_0x10b3('0x9')](),controller['show']);router['post']('/',auth[_0x10b3('0x9')](),controller[_0x10b3('0xc')]);router[_0x10b3('0xd')]('/:id',auth[_0x10b3('0x9')](),controller['update']);router[_0x10b3('0xe')](_0x10b3('0xb'),auth[_0x10b3('0x9')](),controller['destroy']);module[_0x10b3('0xf')]=router; \ No newline at end of file +var _0x4439=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','post','create','put'];(function(_0x53a833,_0x51d0fc){var _0x37b33b=function(_0x938a0e){while(--_0x938a0e){_0x53a833['push'](_0x53a833['shift']());}};_0x37b33b(++_0x51d0fc);}(_0x4439,0x108));var _0x9443=function(_0x3bfdde,_0x306be4){_0x3bfdde=_0x3bfdde-0x0;var _0x3f752a=_0x4439[_0x3bfdde];return _0x3f752a;};'use strict';var multer=require(_0x9443('0x0'));var util=require(_0x9443('0x1'));var path=require(_0x9443('0x2'));var timeout=require(_0x9443('0x3'));var express=require('express');var router=express[_0x9443('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9443('0x5'));var interaction=require(_0x9443('0x6'));var config=require(_0x9443('0x7'));var controller=require(_0x9443('0x8'));router[_0x9443('0x9')]('/',auth[_0x9443('0xa')](),controller[_0x9443('0xb')]);router[_0x9443('0x9')](_0x9443('0xc'),auth[_0x9443('0xa')](),controller['show']);router[_0x9443('0xd')]('/',auth[_0x9443('0xa')](),controller[_0x9443('0xe')]);router[_0x9443('0xf')](_0x9443('0xc'),auth[_0x9443('0xa')](),controller[_0x9443('0x10')]);router[_0x9443('0x11')](_0x9443('0xc'),auth[_0x9443('0xa')](),controller[_0x9443('0x12')]);module[_0x9443('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 8ed17ad..2fd158c 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 _0x2789=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize'];(function(_0x5ddc87,_0x1e5cbf){var _0x1530a2=function(_0x281507){while(--_0x281507){_0x5ddc87['push'](_0x5ddc87['shift']());}};_0x1530a2(++_0x1e5cbf);}(_0x2789,0x8b));var _0x9278=function(_0x96123e,_0x3cbb04){_0x96123e=_0x96123e-0x0;var _0x5bf305=_0x2789[_0x96123e];return _0x5bf305;};'use strict';var Sequelize=require(_0x9278('0x0'));module[_0x9278('0x1')]={'type':{'type':Sequelize[_0x9278('0x2')](_0x9278('0x3'),_0x9278('0x4'),_0x9278('0x5'),_0x9278('0x6'),_0x9278('0x7')),'defaultValue':_0x9278('0x3')},'content':{'type':Sequelize[_0x9278('0x8')]},'key':{'type':Sequelize[_0x9278('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x9278('0x3'),'variable',_0x9278('0x5'))},'keyContent':{'type':Sequelize[_0x9278('0x8')]},'idField':{'type':Sequelize[_0x9278('0x8')]},'nameField':{'type':Sequelize[_0x9278('0x8')]},'customField':{'type':Sequelize[_0x9278('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9278('0x8')]}}; \ No newline at end of file +var _0x8ee3=['keyValue','picklist','STRING','BOOLEAN','exports','ENUM','string','variable','customVariable'];(function(_0x1e57da,_0x45ff1c){var _0xca2bce=function(_0x3d078e){while(--_0x3d078e){_0x1e57da['push'](_0x1e57da['shift']());}};_0xca2bce(++_0x45ff1c);}(_0x8ee3,0x1f3));var _0x38ee=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8ee3[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x38ee('0x0')]={'type':{'type':Sequelize[_0x38ee('0x1')](_0x38ee('0x2'),_0x38ee('0x3'),_0x38ee('0x4'),_0x38ee('0x5'),_0x38ee('0x6')),'defaultValue':_0x38ee('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x38ee('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x38ee('0x2'),_0x38ee('0x3'),_0x38ee('0x4'))},'keyContent':{'type':Sequelize[_0x38ee('0x7')]},'idField':{'type':Sequelize[_0x38ee('0x7')]},'nameField':{'type':Sequelize[_0x38ee('0x7')]},'customField':{'type':Sequelize[_0x38ee('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x38ee('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index da5dec6..8d0fbe4 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 _0x8d64=['merge','where','VIRTUAL','includeAll','include','catch','show','params','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','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','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','map','Dynamics365Field','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter'];(function(_0x72cd43,_0x8ccc2b){var _0x3976af=function(_0x5b6701){while(--_0x5b6701){_0x72cd43['push'](_0x72cd43['shift']());}};_0x3976af(++_0x8ccc2b);}(_0x8d64,0xea));var _0x48d6=function(_0xd7b0a4,_0x53c7d3){_0xd7b0a4=_0xd7b0a4-0x0;var _0x184e9e=_0x8d64[_0xd7b0a4];return _0x184e9e;};'use strict';var emlformat=require(_0x48d6('0x0'));var rimraf=require(_0x48d6('0x1'));var zipdir=require(_0x48d6('0x2'));var jsonpatch=require(_0x48d6('0x3'));var rp=require(_0x48d6('0x4'));var moment=require(_0x48d6('0x5'));var BPromise=require(_0x48d6('0x6'));var Mustache=require(_0x48d6('0x7'));var util=require('util');var path=require(_0x48d6('0x8'));var sox=require(_0x48d6('0x9'));var csv=require('to-csv');var ejs=require(_0x48d6('0xa'));var fs=require('fs');var fs_extra=require(_0x48d6('0xb'));var _=require(_0x48d6('0xc'));var squel=require(_0x48d6('0xd'));var crypto=require(_0x48d6('0xe'));var jsforce=require(_0x48d6('0xf'));var deskjs=require(_0x48d6('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x48d6('0x11'));var Redis=require(_0x48d6('0x12'));var authService=require(_0x48d6('0x13'));var qs=require(_0x48d6('0x14'));var as=require(_0x48d6('0x15'));var hardwareService=require(_0x48d6('0x16'));var logger=require(_0x48d6('0x17'))('api');var utils=require(_0x48d6('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x48d6('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14b84f,_0x4b2c7d){_0x4b2c7d=_0x4b2c7d||0xcc;return function(_0x474373){if(_0x474373){return _0x14b84f[_0x48d6('0x1a')](_0x4b2c7d);}return _0x14b84f[_0x48d6('0x1b')](_0x4b2c7d)[_0x48d6('0x1c')]();};}function respondWithResult(_0x44865f,_0x42e570){_0x42e570=_0x42e570||0xc8;return function(_0x16754d){if(_0x16754d){return _0x44865f[_0x48d6('0x1b')](_0x42e570)[_0x48d6('0x1d')](_0x16754d);}};}function respondWithFilteredResult(_0x4058fd,_0x276fa1){return function(_0x14660b){if(_0x14660b){var _0x436c23=typeof _0x276fa1[_0x48d6('0x1e')]==='undefined'&&typeof _0x276fa1['limit']==='undefined';var _0x13f009=_0x14660b[_0x48d6('0x1f')];var _0x218902=_0x436c23?0x0:_0x276fa1[_0x48d6('0x1e')];var _0x355737=_0x436c23?_0x14660b[_0x48d6('0x1f')]:_0x276fa1[_0x48d6('0x1e')]+_0x276fa1[_0x48d6('0x20')];var _0x421ee4;if(_0x355737>=_0x13f009){_0x355737=_0x13f009;_0x421ee4=0xc8;}else{_0x421ee4=0xce;}_0x4058fd[_0x48d6('0x1b')](_0x421ee4);return _0x4058fd[_0x48d6('0x21')](_0x48d6('0x22'),_0x218902+'-'+_0x355737+'/'+_0x13f009)[_0x48d6('0x1d')](_0x14660b);}return null;};}function patchUpdates(_0x25dae1){return function(_0x2e6bd4){try{jsonpatch[_0x48d6('0x23')](_0x2e6bd4,_0x25dae1,!![]);}catch(_0x158468){return BPromise[_0x48d6('0x24')](_0x158468);}return _0x2e6bd4[_0x48d6('0x25')]();};}function saveUpdates(_0x5766fa,_0x523bda){return function(_0x49170c){if(_0x49170c){return _0x49170c[_0x48d6('0x26')](_0x5766fa)['then'](function(_0x4063b8){return _0x4063b8;});}return null;};}function removeEntity(_0x51a71a,_0x69318c){return function(_0x3a2b93){if(_0x3a2b93){return _0x3a2b93[_0x48d6('0x27')]()[_0x48d6('0x28')](function(){_0x51a71a[_0x48d6('0x1b')](0xcc)[_0x48d6('0x1c')]();});}};}function handleEntityNotFound(_0x24cd3e,_0x2e32af){return function(_0x5f2fe7){if(!_0x5f2fe7){_0x24cd3e[_0x48d6('0x1a')](0x194);}return _0x5f2fe7;};}function handleError(_0x134c6d,_0x101f6c){_0x101f6c=_0x101f6c||0x1f4;return function(_0x5cbccf){logger[_0x48d6('0x29')](_0x5cbccf[_0x48d6('0x2a')]);if(_0x5cbccf[_0x48d6('0x2b')]){delete _0x5cbccf[_0x48d6('0x2b')];}_0x134c6d['status'](_0x101f6c)['send'](_0x5cbccf);};}exports['index']=function(_0x553a47,_0x4cd0f1){var _0x181ca5={},_0x3cf5e0={},_0x4de603={'count':0x0,'rows':[]};var _0x435913=_[_0x48d6('0x2c')](db[_0x48d6('0x2d')]['rawAttributes'],function(_0x2e00ae){return{'name':_0x2e00ae[_0x48d6('0x2e')],'type':_0x2e00ae['type'][_0x48d6('0x2f')]};});_0x3cf5e0[_0x48d6('0x30')]=_[_0x48d6('0x2c')](_0x435913,'name');_0x3cf5e0[_0x48d6('0x31')]=_[_0x48d6('0x32')](_0x553a47[_0x48d6('0x31')]);_0x3cf5e0[_0x48d6('0x33')]=_[_0x48d6('0x34')](_0x3cf5e0[_0x48d6('0x30')],_0x3cf5e0[_0x48d6('0x31')]);_0x181ca5[_0x48d6('0x35')]=_[_0x48d6('0x34')](_0x3cf5e0['model'],qs[_0x48d6('0x36')](_0x553a47[_0x48d6('0x31')][_0x48d6('0x36')]));_0x181ca5[_0x48d6('0x35')]=_0x181ca5[_0x48d6('0x35')][_0x48d6('0x37')]?_0x181ca5[_0x48d6('0x35')]:_0x3cf5e0['model'];if(!_0x553a47[_0x48d6('0x31')][_0x48d6('0x38')](_0x48d6('0x39'))){_0x181ca5[_0x48d6('0x20')]=qs[_0x48d6('0x20')](_0x553a47[_0x48d6('0x31')]['limit']);_0x181ca5[_0x48d6('0x1e')]=qs['offset'](_0x553a47[_0x48d6('0x31')][_0x48d6('0x1e')]);}_0x181ca5[_0x48d6('0x3a')]=qs[_0x48d6('0x3b')](_0x553a47[_0x48d6('0x31')][_0x48d6('0x3b')]);_0x181ca5['where']=qs[_0x48d6('0x33')](_[_0x48d6('0x3c')](_0x553a47[_0x48d6('0x31')],_0x3cf5e0[_0x48d6('0x33')]),_0x435913);if(_0x553a47['query'][_0x48d6('0x3d')]){_0x181ca5['where']=_[_0x48d6('0x3e')](_0x181ca5[_0x48d6('0x3f')],{'$or':_[_0x48d6('0x2c')](_0x435913,function(_0x50770d){if(_0x50770d['type']!==_0x48d6('0x40')){var _0x446f4b={};_0x446f4b[_0x50770d[_0x48d6('0x2b')]]={'$like':'%'+_0x553a47[_0x48d6('0x31')]['filter']+'%'};return _0x446f4b;}})});}_0x181ca5=_[_0x48d6('0x3e')]({},_0x181ca5,_0x553a47['options']);var _0x47390d={'where':_0x181ca5[_0x48d6('0x3f')]};return db['Dynamics365Field'][_0x48d6('0x1f')](_0x47390d)[_0x48d6('0x28')](function(_0xfe1564){_0x4de603[_0x48d6('0x1f')]=_0xfe1564;if(_0x553a47[_0x48d6('0x31')][_0x48d6('0x41')]){_0x181ca5[_0x48d6('0x42')]=[{'all':!![]}];}return db[_0x48d6('0x2d')]['findAll'](_0x181ca5);})[_0x48d6('0x28')](function(_0x30df5b){_0x4de603['rows']=_0x30df5b;return _0x4de603;})[_0x48d6('0x28')](respondWithFilteredResult(_0x4cd0f1,_0x181ca5))[_0x48d6('0x43')](handleError(_0x4cd0f1,null));};exports[_0x48d6('0x44')]=function(_0x2cd434,_0x4ef230){var _0x630375={'raw':!![],'where':{'id':_0x2cd434[_0x48d6('0x45')]['id']}},_0x250411={};_0x250411[_0x48d6('0x30')]=_[_0x48d6('0x32')](db[_0x48d6('0x2d')]['rawAttributes']);_0x250411[_0x48d6('0x31')]=_[_0x48d6('0x32')](_0x2cd434[_0x48d6('0x31')]);_0x250411[_0x48d6('0x33')]=_['intersection'](_0x250411['model'],_0x250411[_0x48d6('0x31')]);_0x630375[_0x48d6('0x35')]=_[_0x48d6('0x34')](_0x250411['model'],qs['fields'](_0x2cd434[_0x48d6('0x31')][_0x48d6('0x36')]));_0x630375['attributes']=_0x630375[_0x48d6('0x35')]['length']?_0x630375[_0x48d6('0x35')]:_0x250411[_0x48d6('0x30')];if(_0x2cd434[_0x48d6('0x31')]['includeAll']){_0x630375[_0x48d6('0x42')]=[{'all':!![]}];}_0x630375=_[_0x48d6('0x3e')]({},_0x630375,_0x2cd434[_0x48d6('0x46')]);return db[_0x48d6('0x2d')][_0x48d6('0x47')](_0x630375)[_0x48d6('0x28')](handleEntityNotFound(_0x4ef230,null))[_0x48d6('0x28')](respondWithResult(_0x4ef230,null))[_0x48d6('0x43')](handleError(_0x4ef230,null));};exports['create']=function(_0x3af0d0,_0x12a028){return db[_0x48d6('0x2d')][_0x48d6('0x48')](_0x3af0d0['body'],{})[_0x48d6('0x28')](respondWithResult(_0x12a028,0xc9))[_0x48d6('0x43')](handleError(_0x12a028,null));};exports[_0x48d6('0x26')]=function(_0x1474c8,_0x18c531){if(_0x1474c8[_0x48d6('0x49')]['id']){delete _0x1474c8[_0x48d6('0x49')]['id'];}return db[_0x48d6('0x2d')][_0x48d6('0x47')]({'where':{'id':_0x1474c8[_0x48d6('0x45')]['id']}})[_0x48d6('0x28')](handleEntityNotFound(_0x18c531,null))['then'](saveUpdates(_0x1474c8[_0x48d6('0x49')],null))[_0x48d6('0x28')](respondWithResult(_0x18c531,null))['catch'](handleError(_0x18c531,null));};exports['destroy']=function(_0x12e505,_0x550b3a){return db[_0x48d6('0x2d')][_0x48d6('0x47')]({'where':{'id':_0x12e505[_0x48d6('0x45')]['id']}})[_0x48d6('0x28')](handleEntityNotFound(_0x550b3a,null))[_0x48d6('0x28')](removeEntity(_0x550b3a,null))[_0x48d6('0x43')](handleError(_0x550b3a,null));}; \ No newline at end of file +var _0x81b6=['params','intersection','find','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','index','rawAttributes','fieldName','key','map','name','query','keys','attributes','model','fields','length','hasOwnProperty','order','sort','pick','filters','filter','where','merge','type','options','Dynamics365Field','includeAll','include','findAll','rows','catch'];(function(_0x41ee31,_0x237809){var _0x4ed943=function(_0x1d225c){while(--_0x1d225c){_0x41ee31['push'](_0x41ee31['shift']());}};_0x4ed943(++_0x237809);}(_0x81b6,0x135));var _0x681b=function(_0x198ae8,_0x581920){_0x198ae8=_0x198ae8-0x0;var _0x3cf26c=_0x81b6[_0x198ae8];return _0x3cf26c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x681b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x681b('0x1'));var rp=require(_0x681b('0x2'));var moment=require(_0x681b('0x3'));var BPromise=require(_0x681b('0x4'));var Mustache=require(_0x681b('0x5'));var util=require(_0x681b('0x6'));var path=require(_0x681b('0x7'));var sox=require(_0x681b('0x8'));var csv=require(_0x681b('0x9'));var ejs=require(_0x681b('0xa'));var fs=require('fs');var fs_extra=require(_0x681b('0xb'));var _=require(_0x681b('0xc'));var squel=require(_0x681b('0xd'));var crypto=require(_0x681b('0xe'));var jsforce=require(_0x681b('0xf'));var deskjs=require(_0x681b('0x10'));var toCsv=require('to-csv');var querystring=require(_0x681b('0x11'));var Papa=require('papaparse');var Redis=require(_0x681b('0x12'));var authService=require(_0x681b('0x13'));var qs=require(_0x681b('0x14'));var as=require(_0x681b('0x15'));var hardwareService=require(_0x681b('0x16'));var logger=require('../../config/logger')(_0x681b('0x17'));var utils=require(_0x681b('0x18'));var config=require(_0x681b('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8a37b3,_0x2108be){_0x2108be=_0x2108be||0xcc;return function(_0x5c3309){if(_0x5c3309){return _0x8a37b3[_0x681b('0x1a')](_0x2108be);}return _0x8a37b3[_0x681b('0x1b')](_0x2108be)[_0x681b('0x1c')]();};}function respondWithResult(_0x3ae0ff,_0x5146de){_0x5146de=_0x5146de||0xc8;return function(_0xe7c843){if(_0xe7c843){return _0x3ae0ff[_0x681b('0x1b')](_0x5146de)[_0x681b('0x1d')](_0xe7c843);}};}function respondWithFilteredResult(_0x81c48,_0x159335){return function(_0x11a4b1){if(_0x11a4b1){var _0x55cc72=typeof _0x159335[_0x681b('0x1e')]===_0x681b('0x1f')&&typeof _0x159335['limit']===_0x681b('0x1f');var _0x541a7f=_0x11a4b1['count'];var _0x442db7=_0x55cc72?0x0:_0x159335['offset'];var _0x5d562f=_0x55cc72?_0x11a4b1[_0x681b('0x20')]:_0x159335['offset']+_0x159335[_0x681b('0x21')];var _0x514eb3;if(_0x5d562f>=_0x541a7f){_0x5d562f=_0x541a7f;_0x514eb3=0xc8;}else{_0x514eb3=0xce;}_0x81c48[_0x681b('0x1b')](_0x514eb3);return _0x81c48[_0x681b('0x22')](_0x681b('0x23'),_0x442db7+'-'+_0x5d562f+'/'+_0x541a7f)[_0x681b('0x1d')](_0x11a4b1);}return null;};}function patchUpdates(_0x1fffcf){return function(_0x10aec0){try{jsonpatch[_0x681b('0x24')](_0x10aec0,_0x1fffcf,!![]);}catch(_0x23b990){return BPromise[_0x681b('0x25')](_0x23b990);}return _0x10aec0[_0x681b('0x26')]();};}function saveUpdates(_0xcf8b49,_0xa8a321){return function(_0x5cb061){if(_0x5cb061){return _0x5cb061[_0x681b('0x27')](_0xcf8b49)[_0x681b('0x28')](function(_0x4db7c2){return _0x4db7c2;});}return null;};}function removeEntity(_0x16b842,_0x504c26){return function(_0x3d8292){if(_0x3d8292){return _0x3d8292[_0x681b('0x29')]()[_0x681b('0x28')](function(){_0x16b842[_0x681b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xdad25f,_0x49508f){return function(_0x3ffa45){if(!_0x3ffa45){_0xdad25f['sendStatus'](0x194);}return _0x3ffa45;};}function handleError(_0x520e4c,_0xe4d7c4){_0xe4d7c4=_0xe4d7c4||0x1f4;return function(_0x250d87){logger[_0x681b('0x2a')](_0x250d87['stack']);if(_0x250d87['name']){delete _0x250d87['name'];}_0x520e4c[_0x681b('0x1b')](_0xe4d7c4)['send'](_0x250d87);};}exports[_0x681b('0x2b')]=function(_0x41e0ae,_0x34a8ef){var _0x12033a={},_0x21535c={},_0xb629b9={'count':0x0,'rows':[]};var _0x486f04=_['map'](db['Dynamics365Field'][_0x681b('0x2c')],function(_0x4fc38a){return{'name':_0x4fc38a[_0x681b('0x2d')],'type':_0x4fc38a['type'][_0x681b('0x2e')]};});_0x21535c['model']=_[_0x681b('0x2f')](_0x486f04,_0x681b('0x30'));_0x21535c[_0x681b('0x31')]=_[_0x681b('0x32')](_0x41e0ae[_0x681b('0x31')]);_0x21535c['filters']=_['intersection'](_0x21535c['model'],_0x21535c[_0x681b('0x31')]);_0x12033a[_0x681b('0x33')]=_['intersection'](_0x21535c[_0x681b('0x34')],qs['fields'](_0x41e0ae[_0x681b('0x31')][_0x681b('0x35')]));_0x12033a['attributes']=_0x12033a[_0x681b('0x33')][_0x681b('0x36')]?_0x12033a[_0x681b('0x33')]:_0x21535c[_0x681b('0x34')];if(!_0x41e0ae[_0x681b('0x31')][_0x681b('0x37')]('nolimit')){_0x12033a[_0x681b('0x21')]=qs['limit'](_0x41e0ae['query'][_0x681b('0x21')]);_0x12033a[_0x681b('0x1e')]=qs['offset'](_0x41e0ae[_0x681b('0x31')][_0x681b('0x1e')]);}_0x12033a[_0x681b('0x38')]=qs[_0x681b('0x39')](_0x41e0ae['query'][_0x681b('0x39')]);_0x12033a['where']=qs['filters'](_[_0x681b('0x3a')](_0x41e0ae['query'],_0x21535c[_0x681b('0x3b')]),_0x486f04);if(_0x41e0ae[_0x681b('0x31')][_0x681b('0x3c')]){_0x12033a[_0x681b('0x3d')]=_[_0x681b('0x3e')](_0x12033a[_0x681b('0x3d')],{'$or':_[_0x681b('0x2f')](_0x486f04,function(_0x2da84b){if(_0x2da84b[_0x681b('0x3f')]!=='VIRTUAL'){var _0x5fc117={};_0x5fc117[_0x2da84b[_0x681b('0x30')]]={'$like':'%'+_0x41e0ae[_0x681b('0x31')][_0x681b('0x3c')]+'%'};return _0x5fc117;}})});}_0x12033a=_[_0x681b('0x3e')]({},_0x12033a,_0x41e0ae[_0x681b('0x40')]);var _0x23ef36={'where':_0x12033a[_0x681b('0x3d')]};return db[_0x681b('0x41')]['count'](_0x23ef36)[_0x681b('0x28')](function(_0x40f56d){_0xb629b9[_0x681b('0x20')]=_0x40f56d;if(_0x41e0ae['query'][_0x681b('0x42')]){_0x12033a[_0x681b('0x43')]=[{'all':!![]}];}return db[_0x681b('0x41')][_0x681b('0x44')](_0x12033a);})[_0x681b('0x28')](function(_0x4724b6){_0xb629b9[_0x681b('0x45')]=_0x4724b6;return _0xb629b9;})['then'](respondWithFilteredResult(_0x34a8ef,_0x12033a))[_0x681b('0x46')](handleError(_0x34a8ef,null));};exports['show']=function(_0x49e509,_0x20bc59){var _0x8b2791={'raw':!![],'where':{'id':_0x49e509[_0x681b('0x47')]['id']}},_0x1d83fc={};_0x1d83fc[_0x681b('0x34')]=_['keys'](db[_0x681b('0x41')]['rawAttributes']);_0x1d83fc[_0x681b('0x31')]=_['keys'](_0x49e509[_0x681b('0x31')]);_0x1d83fc[_0x681b('0x3b')]=_[_0x681b('0x48')](_0x1d83fc['model'],_0x1d83fc[_0x681b('0x31')]);_0x8b2791[_0x681b('0x33')]=_[_0x681b('0x48')](_0x1d83fc['model'],qs[_0x681b('0x35')](_0x49e509[_0x681b('0x31')][_0x681b('0x35')]));_0x8b2791['attributes']=_0x8b2791[_0x681b('0x33')][_0x681b('0x36')]?_0x8b2791['attributes']:_0x1d83fc[_0x681b('0x34')];if(_0x49e509[_0x681b('0x31')][_0x681b('0x42')]){_0x8b2791[_0x681b('0x43')]=[{'all':!![]}];}_0x8b2791=_['merge']({},_0x8b2791,_0x49e509[_0x681b('0x40')]);return db[_0x681b('0x41')][_0x681b('0x49')](_0x8b2791)[_0x681b('0x28')](handleEntityNotFound(_0x20bc59,null))['then'](respondWithResult(_0x20bc59,null))['catch'](handleError(_0x20bc59,null));};exports[_0x681b('0x4a')]=function(_0x40c5d3,_0x5be9e7){return db[_0x681b('0x41')][_0x681b('0x4a')](_0x40c5d3[_0x681b('0x4b')],{})['then'](respondWithResult(_0x5be9e7,0xc9))[_0x681b('0x46')](handleError(_0x5be9e7,null));};exports[_0x681b('0x27')]=function(_0x4aa5a6,_0x1944b6){if(_0x4aa5a6[_0x681b('0x4b')]['id']){delete _0x4aa5a6[_0x681b('0x4b')]['id'];}return db[_0x681b('0x41')]['find']({'where':{'id':_0x4aa5a6[_0x681b('0x47')]['id']}})[_0x681b('0x28')](handleEntityNotFound(_0x1944b6,null))['then'](saveUpdates(_0x4aa5a6[_0x681b('0x4b')],null))[_0x681b('0x28')](respondWithResult(_0x1944b6,null))[_0x681b('0x46')](handleError(_0x1944b6,null));};exports[_0x681b('0x29')]=function(_0x22d078,_0x5ca579){return db['Dynamics365Field'][_0x681b('0x49')]({'where':{'id':_0x22d078[_0x681b('0x47')]['id']}})[_0x681b('0x28')](handleEntityNotFound(_0x5ca579,null))[_0x681b('0x28')](removeEntity(_0x5ca579,null))[_0x681b('0x46')](handleError(_0x5ca579,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index d9c6b02..3a53309 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 _0xee4b=['./intDynamics365Field.attributes','exports','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0xfd166a,_0x2b982b){var _0x37d4d1=function(_0x90c6ca){while(--_0x90c6ca){_0xfd166a['push'](_0xfd166a['shift']());}};_0x37d4d1(++_0x2b982b);}(_0xee4b,0xe8));var _0xbee4=function(_0x119280,_0x439c3e){_0x119280=_0x119280-0x0;var _0x481797=_0xee4b[_0x119280];return _0x481797;};'use strict';var _=require(_0xbee4('0x0'));var util=require('util');var logger=require(_0xbee4('0x1'))(_0xbee4('0x2'));var moment=require(_0xbee4('0x3'));var BPromise=require(_0xbee4('0x4'));var rp=require(_0xbee4('0x5'));var fs=require('fs');var path=require(_0xbee4('0x6'));var rimraf=require('rimraf');var config=require(_0xbee4('0x7'));var attributes=require(_0xbee4('0x8'));module[_0xbee4('0x9')]=function(_0x147d01,_0x5c508b){return _0x147d01['define'](_0xbee4('0xa'),attributes,{'tableName':_0xbee4('0xb'),'paranoid':![],'indexes':[{'name':_0xbee4('0xc'),'fields':[_0xbee4('0xd'),_0xbee4('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe7c9=['api','path','../../config/environment','define','Dynamics365Field','FieldId','lodash','util'];(function(_0x164136,_0x5cc0bd){var _0xf61475=function(_0x545838){while(--_0x545838){_0x164136['push'](_0x164136['shift']());}};_0xf61475(++_0x5cc0bd);}(_0xe7c9,0x1ee));var _0x9e7c=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xe7c9[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0x9e7c('0x0'));var util=require(_0x9e7c('0x1'));var logger=require('../../config/logger')(_0x9e7c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9e7c('0x3'));var rimraf=require('rimraf');var config=require(_0x9e7c('0x4'));var attributes=require('./intDynamics365Field.attributes');module['exports']=function(_0x4d5cdc,_0x656e42){return _0x4d5cdc[_0x9e7c('0x5')](_0x9e7c('0x6'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':['idField',_0x9e7c('0x7')],'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 f9fe6bb..2facf43 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 _0xc5bb=['debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Dynamics365Field,\x20%s,\x20%s'];(function(_0x22fcf2,_0x1f9240){var _0x4e6c42=function(_0x23a928){while(--_0x23a928){_0x22fcf2['push'](_0x22fcf2['shift']());}};_0x4e6c42(++_0x1f9240);}(_0xc5bb,0x68));var _0xbc5b=function(_0x44755c,_0x162ddd){_0x44755c=_0x44755c-0x0;var _0x3a4a88=_0xc5bb[_0x44755c];return _0x3a4a88;};'use strict';var _=require(_0xbc5b('0x0'));var util=require(_0xbc5b('0x1'));var moment=require('moment');var BPromise=require(_0xbc5b('0x2'));var rs=require(_0xbc5b('0x3'));var fs=require('fs');var Redis=require(_0xbc5b('0x4'));var db=require(_0xbc5b('0x5'))['db'];var utils=require(_0xbc5b('0x6'));var logger=require(_0xbc5b('0x7'))(_0xbc5b('0x8'));var config=require(_0xbc5b('0x9'));var jayson=require(_0xbc5b('0xa'));var client=jayson[_0xbc5b('0xb')][_0xbc5b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x6f9189,_0x2c5e37,_0x3acb7a){return new BPromise(function(_0x5b0762,_0x49accd){return client[_0xbc5b('0xd')](_0x6f9189,_0x3acb7a)['then'](function(_0xc38b8b){logger[_0xbc5b('0xe')](_0xbc5b('0xf'),_0x2c5e37,'request\x20sent');logger[_0xbc5b('0x10')](_0xbc5b('0x11'),_0x2c5e37,_0xbc5b('0x12'),JSON[_0xbc5b('0x13')](_0xc38b8b));if(_0xc38b8b[_0xbc5b('0x14')]){if(_0xc38b8b[_0xbc5b('0x14')][_0xbc5b('0x15')]===0x1f4){logger[_0xbc5b('0x14')](_0xbc5b('0xf'),_0x2c5e37,_0xc38b8b[_0xbc5b('0x14')]['message']);return _0x49accd(_0xc38b8b[_0xbc5b('0x14')]['message']);}logger[_0xbc5b('0x14')](_0xbc5b('0xf'),_0x2c5e37,_0xc38b8b[_0xbc5b('0x14')][_0xbc5b('0x16')]);return _0x5b0762(_0xc38b8b[_0xbc5b('0x14')][_0xbc5b('0x16')]);}else{logger[_0xbc5b('0xe')](_0xbc5b('0xf'),_0x2c5e37,'request\x20sent');_0x5b0762(_0xc38b8b['result'][_0xbc5b('0x16')]);}})[_0xbc5b('0x17')](function(_0x4cc7c5){logger['error'](_0xbc5b('0xf'),_0x2c5e37,_0x4cc7c5);_0x49accd(_0x4cc7c5);});});} \ No newline at end of file +var _0xdbc6=['then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','message','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x9793b1,_0xbc3a68){var _0x400148=function(_0x42e6ca){while(--_0x42e6ca){_0x9793b1['push'](_0x9793b1['shift']());}};_0x400148(++_0xbc3a68);}(_0xdbc6,0xd0));var _0x6dbc=function(_0x1256e3,_0x2c2d34){_0x1256e3=_0x1256e3-0x0;var _0x3c2aa2=_0xdbc6[_0x1256e3];return _0x3c2aa2;};'use strict';var _=require('lodash');var util=require(_0x6dbc('0x0'));var moment=require('moment');var BPromise=require(_0x6dbc('0x1'));var rs=require(_0x6dbc('0x2'));var fs=require('fs');var Redis=require(_0x6dbc('0x3'));var db=require(_0x6dbc('0x4'))['db'];var utils=require(_0x6dbc('0x5'));var logger=require(_0x6dbc('0x6'))(_0x6dbc('0x7'));var config=require('../../config/environment');var jayson=require(_0x6dbc('0x8'));var client=jayson[_0x6dbc('0x9')][_0x6dbc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x404686,_0x5cbf6a,_0x2837c2){return new BPromise(function(_0x51f023,_0x7a6f1c){return client[_0x6dbc('0xb')](_0x404686,_0x2837c2)[_0x6dbc('0xc')](function(_0x561d4b){logger[_0x6dbc('0xd')](_0x6dbc('0xe'),_0x5cbf6a,_0x6dbc('0xf'));logger['debug'](_0x6dbc('0x10'),_0x5cbf6a,'request\x20sent',JSON['stringify'](_0x561d4b));if(_0x561d4b[_0x6dbc('0x11')]){if(_0x561d4b['error']['code']===0x1f4){logger[_0x6dbc('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x5cbf6a,_0x561d4b[_0x6dbc('0x11')][_0x6dbc('0x12')]);return _0x7a6f1c(_0x561d4b[_0x6dbc('0x11')][_0x6dbc('0x12')]);}logger['error'](_0x6dbc('0xe'),_0x5cbf6a,_0x561d4b[_0x6dbc('0x11')][_0x6dbc('0x12')]);return _0x51f023(_0x561d4b['error'][_0x6dbc('0x12')]);}else{logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x5cbf6a,_0x6dbc('0xf'));_0x51f023(_0x561d4b['result']['message']);}})[_0x6dbc('0x13')](function(_0x3151e8){logger[_0x6dbc('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x5cbf6a,_0x3151e8);_0x7a6f1c(_0x3151e8);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 5cf7437..c55faa0 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 _0x8a35=['isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x531049,_0x369227){var _0x18151b=function(_0x17d4ef){while(--_0x17d4ef){_0x531049['push'](_0x531049['shift']());}};_0x18151b(++_0x369227);}(_0x8a35,0x10a));var _0x58a3=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8a35[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0x58a3('0x0'));var util=require('util');var path=require(_0x58a3('0x1'));var timeout=require(_0x58a3('0x2'));var express=require(_0x58a3('0x3'));var router=express[_0x58a3('0x4')]();var fs_extra=require(_0x58a3('0x5'));var auth=require(_0x58a3('0x6'));var interaction=require(_0x58a3('0x7'));var config=require(_0x58a3('0x8'));var controller=require('./intFreshdeskAccount.controller');router[_0x58a3('0x9')]('/',auth[_0x58a3('0xa')](),controller[_0x58a3('0xb')]);router[_0x58a3('0x9')](_0x58a3('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0x58a3('0xd'),auth[_0x58a3('0xa')](),controller[_0x58a3('0xe')]);router[_0x58a3('0x9')](_0x58a3('0xf'),auth[_0x58a3('0xa')](),controller[_0x58a3('0x10')]);router[_0x58a3('0x11')]('/',auth[_0x58a3('0xa')](),controller['create']);router[_0x58a3('0x11')](_0x58a3('0xd'),auth[_0x58a3('0xa')](),controller[_0x58a3('0x12')]);router[_0x58a3('0x13')](_0x58a3('0xc'),auth[_0x58a3('0xa')](),controller['update']);router[_0x58a3('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x58a3('0x15')]);module[_0x58a3('0x16')]=router; \ No newline at end of file +var _0x417c=['create','put','update','delete','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','./intFreshdeskAccount.controller','get','/:id','show','/:id/configurations','isAuthenticated','/:id/fields'];(function(_0x529b9a,_0x3ddafe){var _0x15b1f2=function(_0x584921){while(--_0x584921){_0x529b9a['push'](_0x529b9a['shift']());}};_0x15b1f2(++_0x3ddafe);}(_0x417c,0xaf));var _0xc417=function(_0x4fea97,_0x41b1ca){_0x4fea97=_0x4fea97-0x0;var _0x58456b=_0x417c[_0x4fea97];return _0x58456b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc417('0x0'));var timeout=require(_0xc417('0x1'));var express=require('express');var router=express[_0xc417('0x2')]();var fs_extra=require(_0xc417('0x3'));var auth=require(_0xc417('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc417('0x5'));router[_0xc417('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xc417('0x7'),auth['isAuthenticated'](),controller[_0xc417('0x8')]);router[_0xc417('0x6')](_0xc417('0x9'),auth[_0xc417('0xa')](),controller['getConfigurations']);router[_0xc417('0x6')](_0xc417('0xb'),auth[_0xc417('0xa')](),controller['getFields']);router['post']('/',auth[_0xc417('0xa')](),controller[_0xc417('0xc')]);router['post']('/:id/configurations',auth[_0xc417('0xa')](),controller['addConfiguration']);router[_0xc417('0xd')](_0xc417('0x7'),auth['isAuthenticated'](),controller[_0xc417('0xe')]);router[_0xc417('0xf')](_0xc417('0x7'),auth['isAuthenticated'](),controller['destroy']);module[_0xc417('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index ea02277..5979084 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 _0xe2cf=['remoteUri','exports','STRING','username'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x151f00,_0x4ca3a1){_0x151f00=_0x151f00-0x0;var _0x418d9b=_0xe2cf[_0x151f00];return _0x418d9b;};'use strict';var Sequelize=require('sequelize');module[_0xfe2c('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xfe2c('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0xfe2c('0x2')},'apiKey':{'type':Sequelize[_0xfe2c('0x1')]},'remoteUri':{'type':Sequelize[_0xfe2c('0x1')],'unique':_0xfe2c('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xb016=['remoteUri','sequelize','exports','STRING'];(function(_0x576d8a,_0x2d7bde){var _0x3dc3ef=function(_0xc76758){while(--_0xc76758){_0x576d8a['push'](_0x576d8a['shift']());}};_0x3dc3ef(++_0x2d7bde);}(_0xb016,0x159));var _0x6b01=function(_0x125428,_0x59ee95){_0x125428=_0x125428-0x0;var _0x53e970=_0xb016[_0x125428];return _0x53e970;};'use strict';var Sequelize=require(_0x6b01('0x0'));module[_0x6b01('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x6b01('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x6b01('0x2')]},'remoteUri':{'type':Sequelize[_0x6b01('0x2')],'unique':_0x6b01('0x3')},'serverUrl':{'type':Sequelize[_0x6b01('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 26d389d..381c9ad 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 _0x4e81=['eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','FreshdeskAccount','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','merge','options','where','includeAll','include','findAll','show','params','find','catch','create','body','findOne','FreshdeskConfiguration','getConfigurations','nolimit','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','FreshdeskField','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','apiKey','toString','base64','agent','description','group','ticket_type','company','remove','includes','default','label','choices','capitalize','test','statusCode','getFields','Wrong\x20credentials'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0x4e81,0x1bc));var _0x14e8=function(_0xf26d40,_0x2f4f46){_0xf26d40=_0xf26d40-0x0;var _0x50b68c=_0x4e81[_0xf26d40];return _0x50b68c;};'use strict';var emlformat=require(_0x14e8('0x0'));var rimraf=require(_0x14e8('0x1'));var zipdir=require(_0x14e8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x14e8('0x3'));var Mustache=require(_0x14e8('0x4'));var util=require(_0x14e8('0x5'));var path=require(_0x14e8('0x6'));var sox=require(_0x14e8('0x7'));var csv=require(_0x14e8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x14e8('0x9'));var squel=require(_0x14e8('0xa'));var crypto=require(_0x14e8('0xb'));var jsforce=require(_0x14e8('0xc'));var deskjs=require(_0x14e8('0xd'));var toCsv=require(_0x14e8('0x8'));var querystring=require(_0x14e8('0xe'));var Papa=require(_0x14e8('0xf'));var Redis=require(_0x14e8('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x14e8('0x11'));var as=require(_0x14e8('0x12'));var hardwareService=require(_0x14e8('0x13'));var logger=require(_0x14e8('0x14'))(_0x14e8('0x15'));var utils=require(_0x14e8('0x16'));var config=require(_0x14e8('0x17'));var licenseUtil=require(_0x14e8('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x14e8('0x19'));function respondWithStatusCode(_0x59c6c9,_0x2607ef){_0x2607ef=_0x2607ef||0xcc;return function(_0x341d40){if(_0x341d40){return _0x59c6c9[_0x14e8('0x1a')](_0x2607ef);}return _0x59c6c9['status'](_0x2607ef)[_0x14e8('0x1b')]();};}function respondWithResult(_0x4e1064,_0x458e4a){_0x458e4a=_0x458e4a||0xc8;return function(_0x58d26e){if(_0x58d26e){return _0x4e1064[_0x14e8('0x1c')](_0x458e4a)[_0x14e8('0x1d')](_0x58d26e);}};}function respondWithFilteredResult(_0xc6101f,_0x135996){return function(_0x52e64f){if(_0x52e64f){var _0x10c4a9=typeof _0x135996[_0x14e8('0x1e')]===_0x14e8('0x1f')&&typeof _0x135996[_0x14e8('0x20')]===_0x14e8('0x1f');var _0x1f1a0d=_0x52e64f[_0x14e8('0x21')];var _0x462259=_0x10c4a9?0x0:_0x135996['offset'];var _0x328c5a=_0x10c4a9?_0x52e64f[_0x14e8('0x21')]:_0x135996[_0x14e8('0x1e')]+_0x135996[_0x14e8('0x20')];var _0x246c5d;if(_0x328c5a>=_0x1f1a0d){_0x328c5a=_0x1f1a0d;_0x246c5d=0xc8;}else{_0x246c5d=0xce;}_0xc6101f['status'](_0x246c5d);return _0xc6101f[_0x14e8('0x22')](_0x14e8('0x23'),_0x462259+'-'+_0x328c5a+'/'+_0x1f1a0d)[_0x14e8('0x1d')](_0x52e64f);}return null;};}function patchUpdates(_0x48e30a){return function(_0x2c3f45){try{jsonpatch['apply'](_0x2c3f45,_0x48e30a,!![]);}catch(_0x4cca43){return BPromise[_0x14e8('0x24')](_0x4cca43);}return _0x2c3f45[_0x14e8('0x25')]();};}function saveUpdates(_0x117b00,_0xcf673){return function(_0x4ad25d){if(_0x4ad25d){return _0x4ad25d[_0x14e8('0x26')](_0x117b00)['then'](function(_0x31bdd3){return _0x31bdd3;});}return null;};}function removeEntity(_0x185a0e,_0x4ffc8b){return function(_0x58a3a1){if(_0x58a3a1){return _0x58a3a1['destroy']()[_0x14e8('0x27')](function(){_0x185a0e[_0x14e8('0x1c')](0xcc)[_0x14e8('0x1b')]();});}};}function handleEntityNotFound(_0x20bfe8,_0x333d44){return function(_0x57eb46){if(!_0x57eb46){_0x20bfe8[_0x14e8('0x1a')](0x194);}return _0x57eb46;};}function handleError(_0x3fd96d,_0x3c09cb){_0x3c09cb=_0x3c09cb||0x1f4;return function(_0x2f5818){logger[_0x14e8('0x28')](_0x2f5818[_0x14e8('0x29')]);if(_0x2f5818[_0x14e8('0x2a')]){delete _0x2f5818['name'];}_0x3fd96d[_0x14e8('0x1c')](_0x3c09cb)[_0x14e8('0x2b')](_0x2f5818);};}exports[_0x14e8('0x2c')]=function(_0x5f5abb,_0x48eed0){var _0x5cacd7={},_0x8fe0e2={},_0x2a408d={'count':0x0,'rows':[]};var _0x567385=_[_0x14e8('0x2d')](db[_0x14e8('0x2e')][_0x14e8('0x2f')],function(_0xa83433){return{'name':_0xa83433['fieldName'],'type':_0xa83433[_0x14e8('0x30')][_0x14e8('0x31')]};});_0x8fe0e2[_0x14e8('0x32')]=_[_0x14e8('0x2d')](_0x567385,_0x14e8('0x2a'));_0x8fe0e2['query']=_[_0x14e8('0x33')](_0x5f5abb[_0x14e8('0x34')]);_0x8fe0e2[_0x14e8('0x35')]=_[_0x14e8('0x36')](_0x8fe0e2['model'],_0x8fe0e2[_0x14e8('0x34')]);_0x5cacd7['attributes']=_[_0x14e8('0x36')](_0x8fe0e2[_0x14e8('0x32')],qs[_0x14e8('0x37')](_0x5f5abb[_0x14e8('0x34')][_0x14e8('0x37')]));_0x5cacd7[_0x14e8('0x38')]=_0x5cacd7[_0x14e8('0x38')][_0x14e8('0x39')]?_0x5cacd7[_0x14e8('0x38')]:_0x8fe0e2[_0x14e8('0x32')];if(!_0x5f5abb[_0x14e8('0x34')][_0x14e8('0x3a')]('nolimit')){_0x5cacd7['limit']=qs['limit'](_0x5f5abb[_0x14e8('0x34')]['limit']);_0x5cacd7[_0x14e8('0x1e')]=qs['offset'](_0x5f5abb[_0x14e8('0x34')][_0x14e8('0x1e')]);}_0x5cacd7[_0x14e8('0x3b')]=qs[_0x14e8('0x3c')](_0x5f5abb['query'][_0x14e8('0x3c')]);_0x5cacd7['where']=qs[_0x14e8('0x35')](_[_0x14e8('0x3d')](_0x5f5abb[_0x14e8('0x34')],_0x8fe0e2[_0x14e8('0x35')]),_0x567385);if(_0x5f5abb[_0x14e8('0x34')][_0x14e8('0x3e')]){_0x5cacd7['where']=_[_0x14e8('0x3f')](_0x5cacd7['where'],{'$or':_[_0x14e8('0x2d')](_0x567385,function(_0x20f69d){if(_0x20f69d[_0x14e8('0x30')]!=='VIRTUAL'){var _0x27d51b={};_0x27d51b[_0x20f69d[_0x14e8('0x2a')]]={'$like':'%'+_0x5f5abb['query'][_0x14e8('0x3e')]+'%'};return _0x27d51b;}})});}_0x5cacd7=_[_0x14e8('0x3f')]({},_0x5cacd7,_0x5f5abb[_0x14e8('0x40')]);var _0x3a7aa7={'where':_0x5cacd7[_0x14e8('0x41')]};return db[_0x14e8('0x2e')][_0x14e8('0x21')](_0x3a7aa7)[_0x14e8('0x27')](function(_0x33743a){_0x2a408d[_0x14e8('0x21')]=_0x33743a;if(_0x5f5abb[_0x14e8('0x34')][_0x14e8('0x42')]){_0x5cacd7[_0x14e8('0x43')]=[{'all':!![]}];}return db[_0x14e8('0x2e')][_0x14e8('0x44')](_0x5cacd7);})['then'](function(_0x24c9e6){_0x2a408d['rows']=_0x24c9e6;return _0x2a408d;})['then'](respondWithFilteredResult(_0x48eed0,_0x5cacd7))['catch'](handleError(_0x48eed0,null));};exports[_0x14e8('0x45')]=function(_0x5ed821,_0x46a3c4){var _0x45bff0={'raw':![],'where':{'id':_0x5ed821[_0x14e8('0x46')]['id']}},_0x7907e8={};_0x7907e8[_0x14e8('0x32')]=_[_0x14e8('0x33')](db[_0x14e8('0x2e')][_0x14e8('0x2f')]);_0x7907e8[_0x14e8('0x34')]=_[_0x14e8('0x33')](_0x5ed821[_0x14e8('0x34')]);_0x7907e8['filters']=_[_0x14e8('0x36')](_0x7907e8[_0x14e8('0x32')],_0x7907e8[_0x14e8('0x34')]);_0x45bff0[_0x14e8('0x38')]=_['intersection'](_0x7907e8[_0x14e8('0x32')],qs[_0x14e8('0x37')](_0x5ed821['query']['fields']));_0x45bff0[_0x14e8('0x38')]=_0x45bff0['attributes']['length']?_0x45bff0[_0x14e8('0x38')]:_0x7907e8[_0x14e8('0x32')];if(_0x5ed821['query'][_0x14e8('0x42')]){_0x45bff0[_0x14e8('0x43')]=[{'all':!![]}];}_0x45bff0=_['merge']({},_0x45bff0,_0x5ed821[_0x14e8('0x40')]);return db[_0x14e8('0x2e')][_0x14e8('0x47')](_0x45bff0)[_0x14e8('0x27')](handleEntityNotFound(_0x46a3c4,null))[_0x14e8('0x27')](respondWithResult(_0x46a3c4,null))[_0x14e8('0x48')](handleError(_0x46a3c4,null));};exports[_0x14e8('0x49')]=function(_0x2541ad,_0x146e2c){return db[_0x14e8('0x2e')][_0x14e8('0x49')](_0x2541ad[_0x14e8('0x4a')],{})[_0x14e8('0x27')](respondWithResult(_0x146e2c,0xc9))[_0x14e8('0x48')](handleError(_0x146e2c,null));};exports[_0x14e8('0x26')]=function(_0x1f50bc,_0x59820f){if(_0x1f50bc[_0x14e8('0x4a')]['id']){delete _0x1f50bc['body']['id'];}return db[_0x14e8('0x2e')][_0x14e8('0x47')]({'where':{'id':_0x1f50bc[_0x14e8('0x46')]['id']}})[_0x14e8('0x27')](handleEntityNotFound(_0x59820f,null))['then'](saveUpdates(_0x1f50bc['body'],null))['then'](respondWithResult(_0x59820f,null))[_0x14e8('0x48')](handleError(_0x59820f,null));};exports['destroy']=function(_0x55f9b0,_0xd2b281){return db[_0x14e8('0x2e')]['find']({'where':{'id':_0x55f9b0[_0x14e8('0x46')]['id']}})[_0x14e8('0x27')](handleEntityNotFound(_0xd2b281,null))[_0x14e8('0x27')](removeEntity(_0xd2b281,null))[_0x14e8('0x48')](handleError(_0xd2b281,null));};exports['getConfigurations']=function(_0x519c9c,_0x1cdcca,_0xc602b1){var _0x15464a={};var _0x3a09b7={};var _0x41b5ab;var _0x2fbac7;return db['FreshdeskAccount'][_0x14e8('0x4b')]({'where':{'id':_0x519c9c[_0x14e8('0x46')]['id']}})[_0x14e8('0x27')](handleEntityNotFound(_0x1cdcca,null))[_0x14e8('0x27')](function(_0x5e6083){if(_0x5e6083){_0x41b5ab=_0x5e6083;_0x3a09b7[_0x14e8('0x32')]=_[_0x14e8('0x33')](db[_0x14e8('0x4c')][_0x14e8('0x2f')]);_0x3a09b7['query']=_[_0x14e8('0x33')](_0x519c9c[_0x14e8('0x34')]);_0x3a09b7[_0x14e8('0x35')]=_[_0x14e8('0x36')](_0x3a09b7[_0x14e8('0x32')],_0x3a09b7[_0x14e8('0x34')]);_0x15464a[_0x14e8('0x38')]=_[_0x14e8('0x36')](_0x3a09b7['model'],qs['fields'](_0x519c9c[_0x14e8('0x34')][_0x14e8('0x37')]));_0x15464a[_0x14e8('0x38')]=_0x15464a[_0x14e8('0x38')][_0x14e8('0x39')]?_0x15464a['attributes']:_0x3a09b7['model'];_0x15464a['order']=qs[_0x14e8('0x3c')](_0x519c9c[_0x14e8('0x34')][_0x14e8('0x3c')]);_0x15464a['where']=qs[_0x14e8('0x35')](_[_0x14e8('0x3d')](_0x519c9c[_0x14e8('0x34')],_0x3a09b7['filters']));if(_0x519c9c[_0x14e8('0x34')][_0x14e8('0x3e')]){_0x15464a[_0x14e8('0x41')]=_[_0x14e8('0x3f')](_0x15464a[_0x14e8('0x41')],{'$or':_[_0x14e8('0x2d')](_0x15464a[_0x14e8('0x38')],function(_0x12a2b3){var _0x2da07b={};_0x2da07b[_0x12a2b3]={'$like':'%'+_0x519c9c[_0x14e8('0x34')][_0x14e8('0x3e')]+'%'};return _0x2da07b;})});}_0x15464a=_['merge']({},_0x15464a,_0x519c9c[_0x14e8('0x40')]);return _0x41b5ab[_0x14e8('0x4d')](_0x15464a);}})[_0x14e8('0x27')](function(_0x38e79a){if(_0x38e79a){_0x2fbac7=_0x38e79a[_0x14e8('0x39')];if(!_0x519c9c[_0x14e8('0x34')][_0x14e8('0x3a')](_0x14e8('0x4e'))){_0x15464a[_0x14e8('0x20')]=qs[_0x14e8('0x20')](_0x519c9c[_0x14e8('0x34')][_0x14e8('0x20')]);_0x15464a['offset']=qs[_0x14e8('0x1e')](_0x519c9c[_0x14e8('0x34')]['offset']);}return _0x41b5ab[_0x14e8('0x4d')](_0x15464a);}})[_0x14e8('0x27')](function(_0x31e785){if(_0x31e785){return _0x31e785?{'count':_0x2fbac7,'rows':_0x31e785}:null;}})[_0x14e8('0x27')](respondWithResult(_0x1cdcca,null))[_0x14e8('0x48')](handleError(_0x1cdcca,null));};exports[_0x14e8('0x4f')]=function(_0x139405,_0x5b6e28,_0x4c30dd){if(_0x139405['body']['id']){delete _0x139405[_0x14e8('0x4a')]['id'];}return db[_0x14e8('0x2e')][_0x14e8('0x4b')]({'where':{'id':_0x139405[_0x14e8('0x46')]['id']}})[_0x14e8('0x27')](handleEntityNotFound(_0x5b6e28,null))[_0x14e8('0x27')](function(_0x402956){if(_0x402956){_0x139405['body'][_0x14e8('0x50')]=_0x402956['id'];_0x139405[_0x14e8('0x4a')]['Subjects']=integrations[_0x14e8('0x51')](_0x139405[_0x14e8('0x4a')]['channel'],_0x139405['body']['type']);_0x139405[_0x14e8('0x4a')][_0x14e8('0x52')]=integrations[_0x14e8('0x53')](_0x139405[_0x14e8('0x4a')]['channel'],_0x139405[_0x14e8('0x4a')][_0x14e8('0x30')]);return db[_0x14e8('0x4c')][_0x14e8('0x49')](_0x139405[_0x14e8('0x4a')],{'include':[{'model':db[_0x14e8('0x54')],'as':'Subjects'},{'model':db[_0x14e8('0x54')],'as':_0x14e8('0x52')}]});}return null;})[_0x14e8('0x27')](respondWithResult(_0x5b6e28,null))['catch'](handleError(_0x5b6e28,null));};exports['getFields']=function(_0x20a598,_0x53d0c8,_0x25f63c){var _0x5cbce8='';return db[_0x14e8('0x2e')]['findOne']({'where':{'id':_0x20a598[_0x14e8('0x46')]['id']},'attributes':['id',_0x14e8('0x55'),'apiKey']})[_0x14e8('0x27')](handleEntityNotFound(_0x53d0c8,null))[_0x14e8('0x27')](function(_0x3c4679){if(_0x3c4679){_0x5cbce8=_0x3c4679[_0x14e8('0x55')];var _0x2fb11f=_0x5cbce8[_0x14e8('0x56')](-0x1);if(_0x2fb11f==='/'){_0x5cbce8=_0x5cbce8[_0x14e8('0x57')](0x0,_0x5cbce8[_0x14e8('0x58')](_0x2fb11f));}return rp({'method':_0x14e8('0x59'),'uri':util[_0x14e8('0x5a')](_0x14e8('0x5b'),_0x5cbce8,_0x14e8('0x5c')),'headers':{'Authorization':util[_0x14e8('0x5a')]('Basic\x20%s',new Buffer(util['format']('%s:X',_0x3c4679[_0x14e8('0x5d')]))[_0x14e8('0x5e')](_0x14e8('0x5f')))},'json':!![]});}})['then'](function(_0x19d6ae){if(_0x19d6ae){var _0x557a0f=['requester','subject',_0x14e8('0x60'),_0x14e8('0x61'),_0x14e8('0x1c'),'priority',_0x14e8('0x62'),'source',_0x14e8('0x63'),_0x14e8('0x62'),_0x14e8('0x64')];_[_0x14e8('0x65')](_0x19d6ae,function(_0x3ab99d){return _0x557a0f[_0x14e8('0x66')](_0x3ab99d[_0x14e8('0x2a')])||!_0x3ab99d[_0x14e8('0x67')]&&_0x3ab99d[_0x14e8('0x30')]!=='custom_text'&&_0x3ab99d[_0x14e8('0x30')]!=='custom_dropdown';});return{'count':_0x19d6ae[_0x14e8('0x39')],'rows':_[_0x14e8('0x2d')](_0x19d6ae,function(_0x53b143){return{'id':_0x53b143[_0x14e8('0x2a')],'name':_0x53b143[_0x14e8('0x68')],'custom':!_0x53b143[_0x14e8('0x67')],'options':_0x53b143[_0x14e8('0x69')]?_[_0x14e8('0x2d')](_0x53b143[_0x14e8('0x69')],function(_0x4f06e1){return{'name':_[_0x14e8('0x6a')](_0x4f06e1),'value':_0x4f06e1};}):[]};})};}})[_0x14e8('0x27')](respondWithResult(_0x53d0c8,null))[_0x14e8('0x48')](function(_0x15bd4a){var _0x492757=_0x20a598[_0x14e8('0x34')][_0x14e8('0x6b')]?0x1f4:_0x15bd4a[_0x14e8('0x6c')]||0x1f4;logger[_0x14e8('0x28')]('getFields,\x20%s,\x20%s,\x20%s',_0x14e8('0x6d'),_0x492757,JSON['stringify'](_0x15bd4a));delete _0x15bd4a[_0x14e8('0x2a')];if(_0x492757===0x191){_0x492757=0x190;}_0x53d0c8['status'](_0x492757)['send'](_0x20a598[_0x14e8('0x34')][_0x14e8('0x6b')]?{'message':_0x14e8('0x6e'),'statusCode':_0x15bd4a[_0x14e8('0x6c')]}:_0x15bd4a);});}; \ No newline at end of file +var _0x71f4=['getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','toString','base64','requester','subject','agent','description','priority','source','group','company','includes','default','label','choices','capitalize','test','statusCode','stringify','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','reject','save','update','destroy','error','stack','name','send','map','FreshdeskAccount','fieldName','type','key','model','intersection','attributes','fields','query','hasOwnProperty','nolimit','sort','filters','filter','where','merge','options','count','then','includeAll','include','rows','catch','params','keys','rawAttributes','length','create','body','find','findOne','FreshdeskConfiguration','order','pick','getConfigurations','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField'];(function(_0x5eb22e,_0x27cbac){var _0x27fed5=function(_0x565467){while(--_0x565467){_0x5eb22e['push'](_0x5eb22e['shift']());}};_0x27fed5(++_0x27cbac);}(_0x71f4,0xf9));var _0x471f=function(_0x3fd03c,_0x5688dd){_0x3fd03c=_0x3fd03c-0x0;var _0x321259=_0x71f4[_0x3fd03c];return _0x321259;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x471f('0x0'));var jsonpatch=require(_0x471f('0x1'));var rp=require(_0x471f('0x2'));var moment=require(_0x471f('0x3'));var BPromise=require(_0x471f('0x4'));var Mustache=require('mustache');var util=require(_0x471f('0x5'));var path=require('path');var sox=require(_0x471f('0x6'));var csv=require('to-csv');var ejs=require(_0x471f('0x7'));var fs=require('fs');var fs_extra=require(_0x471f('0x8'));var _=require(_0x471f('0x9'));var squel=require(_0x471f('0xa'));var crypto=require(_0x471f('0xb'));var jsforce=require(_0x471f('0xc'));var deskjs=require(_0x471f('0xd'));var toCsv=require(_0x471f('0xe'));var querystring=require(_0x471f('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x471f('0x10'));var as=require(_0x471f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x471f('0x12'))(_0x471f('0x13'));var utils=require(_0x471f('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x471f('0x15'));var db=require(_0x471f('0x16'))['db'];var integrations=require(_0x471f('0x17'));function respondWithStatusCode(_0x22651b,_0xafc5e8){_0xafc5e8=_0xafc5e8||0xcc;return function(_0x4151c1){if(_0x4151c1){return _0x22651b[_0x471f('0x18')](_0xafc5e8);}return _0x22651b[_0x471f('0x19')](_0xafc5e8)[_0x471f('0x1a')]();};}function respondWithResult(_0x530b18,_0x207afa){_0x207afa=_0x207afa||0xc8;return function(_0x4d7688){if(_0x4d7688){return _0x530b18[_0x471f('0x19')](_0x207afa)[_0x471f('0x1b')](_0x4d7688);}};}function respondWithFilteredResult(_0x29c4f2,_0x211780){return function(_0x117e7f){if(_0x117e7f){var _0x1c335f=typeof _0x211780[_0x471f('0x1c')]===_0x471f('0x1d')&&typeof _0x211780['limit']===_0x471f('0x1d');var _0x257f0e=_0x117e7f['count'];var _0x242f7d=_0x1c335f?0x0:_0x211780['offset'];var _0x2bf4cc=_0x1c335f?_0x117e7f['count']:_0x211780[_0x471f('0x1c')]+_0x211780[_0x471f('0x1e')];var _0x22859a;if(_0x2bf4cc>=_0x257f0e){_0x2bf4cc=_0x257f0e;_0x22859a=0xc8;}else{_0x22859a=0xce;}_0x29c4f2[_0x471f('0x19')](_0x22859a);return _0x29c4f2['set']('Content-Range',_0x242f7d+'-'+_0x2bf4cc+'/'+_0x257f0e)[_0x471f('0x1b')](_0x117e7f);}return null;};}function patchUpdates(_0x5e5e19){return function(_0x217a43){try{jsonpatch['apply'](_0x217a43,_0x5e5e19,!![]);}catch(_0x56897e){return BPromise[_0x471f('0x1f')](_0x56897e);}return _0x217a43[_0x471f('0x20')]();};}function saveUpdates(_0x5b3118,_0x22b331){return function(_0x1b9585){if(_0x1b9585){return _0x1b9585[_0x471f('0x21')](_0x5b3118)['then'](function(_0x1c1105){return _0x1c1105;});}return null;};}function removeEntity(_0x228500,_0x234f12){return function(_0x97f3cf){if(_0x97f3cf){return _0x97f3cf[_0x471f('0x22')]()['then'](function(){_0x228500[_0x471f('0x19')](0xcc)[_0x471f('0x1a')]();});}};}function handleEntityNotFound(_0x51ec99,_0x4bd57a){return function(_0x3d1ee1){if(!_0x3d1ee1){_0x51ec99[_0x471f('0x18')](0x194);}return _0x3d1ee1;};}function handleError(_0x413660,_0x3d1a1c){_0x3d1a1c=_0x3d1a1c||0x1f4;return function(_0x39f3b3){logger[_0x471f('0x23')](_0x39f3b3[_0x471f('0x24')]);if(_0x39f3b3[_0x471f('0x25')]){delete _0x39f3b3['name'];}_0x413660[_0x471f('0x19')](_0x3d1a1c)[_0x471f('0x26')](_0x39f3b3);};}exports['index']=function(_0x127a49,_0x171ae9){var _0x771551={},_0x2487f2={},_0x25a43c={'count':0x0,'rows':[]};var _0x527126=_[_0x471f('0x27')](db[_0x471f('0x28')]['rawAttributes'],function(_0x42230a){return{'name':_0x42230a[_0x471f('0x29')],'type':_0x42230a[_0x471f('0x2a')][_0x471f('0x2b')]};});_0x2487f2[_0x471f('0x2c')]=_[_0x471f('0x27')](_0x527126,_0x471f('0x25'));_0x2487f2['query']=_['keys'](_0x127a49['query']);_0x2487f2['filters']=_[_0x471f('0x2d')](_0x2487f2[_0x471f('0x2c')],_0x2487f2['query']);_0x771551[_0x471f('0x2e')]=_['intersection'](_0x2487f2[_0x471f('0x2c')],qs[_0x471f('0x2f')](_0x127a49[_0x471f('0x30')][_0x471f('0x2f')]));_0x771551[_0x471f('0x2e')]=_0x771551[_0x471f('0x2e')]['length']?_0x771551[_0x471f('0x2e')]:_0x2487f2['model'];if(!_0x127a49[_0x471f('0x30')][_0x471f('0x31')](_0x471f('0x32'))){_0x771551['limit']=qs['limit'](_0x127a49[_0x471f('0x30')][_0x471f('0x1e')]);_0x771551[_0x471f('0x1c')]=qs[_0x471f('0x1c')](_0x127a49[_0x471f('0x30')]['offset']);}_0x771551['order']=qs[_0x471f('0x33')](_0x127a49[_0x471f('0x30')][_0x471f('0x33')]);_0x771551['where']=qs[_0x471f('0x34')](_['pick'](_0x127a49['query'],_0x2487f2['filters']),_0x527126);if(_0x127a49[_0x471f('0x30')][_0x471f('0x35')]){_0x771551[_0x471f('0x36')]=_[_0x471f('0x37')](_0x771551[_0x471f('0x36')],{'$or':_['map'](_0x527126,function(_0x5027f3){if(_0x5027f3[_0x471f('0x2a')]!=='VIRTUAL'){var _0x38815e={};_0x38815e[_0x5027f3['name']]={'$like':'%'+_0x127a49[_0x471f('0x30')][_0x471f('0x35')]+'%'};return _0x38815e;}})});}_0x771551=_[_0x471f('0x37')]({},_0x771551,_0x127a49[_0x471f('0x38')]);var _0x13d762={'where':_0x771551[_0x471f('0x36')]};return db[_0x471f('0x28')][_0x471f('0x39')](_0x13d762)[_0x471f('0x3a')](function(_0x39c1a8){_0x25a43c['count']=_0x39c1a8;if(_0x127a49['query'][_0x471f('0x3b')]){_0x771551[_0x471f('0x3c')]=[{'all':!![]}];}return db['FreshdeskAccount']['findAll'](_0x771551);})[_0x471f('0x3a')](function(_0x37ff7e){_0x25a43c[_0x471f('0x3d')]=_0x37ff7e;return _0x25a43c;})['then'](respondWithFilteredResult(_0x171ae9,_0x771551))[_0x471f('0x3e')](handleError(_0x171ae9,null));};exports['show']=function(_0x3b3224,_0x1d6fa9){var _0x588678={'raw':![],'where':{'id':_0x3b3224[_0x471f('0x3f')]['id']}},_0x2558ff={};_0x2558ff[_0x471f('0x2c')]=_[_0x471f('0x40')](db[_0x471f('0x28')][_0x471f('0x41')]);_0x2558ff[_0x471f('0x30')]=_['keys'](_0x3b3224['query']);_0x2558ff[_0x471f('0x34')]=_[_0x471f('0x2d')](_0x2558ff[_0x471f('0x2c')],_0x2558ff[_0x471f('0x30')]);_0x588678['attributes']=_[_0x471f('0x2d')](_0x2558ff[_0x471f('0x2c')],qs[_0x471f('0x2f')](_0x3b3224[_0x471f('0x30')]['fields']));_0x588678[_0x471f('0x2e')]=_0x588678[_0x471f('0x2e')][_0x471f('0x42')]?_0x588678[_0x471f('0x2e')]:_0x2558ff['model'];if(_0x3b3224['query']['includeAll']){_0x588678[_0x471f('0x3c')]=[{'all':!![]}];}_0x588678=_[_0x471f('0x37')]({},_0x588678,_0x3b3224[_0x471f('0x38')]);return db[_0x471f('0x28')]['find'](_0x588678)[_0x471f('0x3a')](handleEntityNotFound(_0x1d6fa9,null))[_0x471f('0x3a')](respondWithResult(_0x1d6fa9,null))[_0x471f('0x3e')](handleError(_0x1d6fa9,null));};exports[_0x471f('0x43')]=function(_0x48833e,_0x51e6c4){return db['FreshdeskAccount'][_0x471f('0x43')](_0x48833e['body'],{})[_0x471f('0x3a')](respondWithResult(_0x51e6c4,0xc9))[_0x471f('0x3e')](handleError(_0x51e6c4,null));};exports[_0x471f('0x21')]=function(_0x30ff42,_0x31000e){if(_0x30ff42[_0x471f('0x44')]['id']){delete _0x30ff42[_0x471f('0x44')]['id'];}return db[_0x471f('0x28')][_0x471f('0x45')]({'where':{'id':_0x30ff42[_0x471f('0x3f')]['id']}})[_0x471f('0x3a')](handleEntityNotFound(_0x31000e,null))['then'](saveUpdates(_0x30ff42[_0x471f('0x44')],null))[_0x471f('0x3a')](respondWithResult(_0x31000e,null))[_0x471f('0x3e')](handleError(_0x31000e,null));};exports[_0x471f('0x22')]=function(_0x187235,_0x2d8f5f){return db[_0x471f('0x28')][_0x471f('0x45')]({'where':{'id':_0x187235[_0x471f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2d8f5f,null))['then'](removeEntity(_0x2d8f5f,null))[_0x471f('0x3e')](handleError(_0x2d8f5f,null));};exports['getConfigurations']=function(_0x1772ad,_0x26c5a5,_0x5bc5b1){var _0x593f03={};var _0x28347d={};var _0x2bfc69;var _0x1f4e5a;return db['FreshdeskAccount'][_0x471f('0x46')]({'where':{'id':_0x1772ad[_0x471f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x26c5a5,null))['then'](function(_0x593a70){if(_0x593a70){_0x2bfc69=_0x593a70;_0x28347d['model']=_[_0x471f('0x40')](db[_0x471f('0x47')][_0x471f('0x41')]);_0x28347d[_0x471f('0x30')]=_['keys'](_0x1772ad[_0x471f('0x30')]);_0x28347d[_0x471f('0x34')]=_[_0x471f('0x2d')](_0x28347d['model'],_0x28347d[_0x471f('0x30')]);_0x593f03[_0x471f('0x2e')]=_[_0x471f('0x2d')](_0x28347d[_0x471f('0x2c')],qs[_0x471f('0x2f')](_0x1772ad['query']['fields']));_0x593f03['attributes']=_0x593f03['attributes'][_0x471f('0x42')]?_0x593f03[_0x471f('0x2e')]:_0x28347d[_0x471f('0x2c')];_0x593f03[_0x471f('0x48')]=qs['sort'](_0x1772ad[_0x471f('0x30')][_0x471f('0x33')]);_0x593f03['where']=qs['filters'](_[_0x471f('0x49')](_0x1772ad[_0x471f('0x30')],_0x28347d[_0x471f('0x34')]));if(_0x1772ad[_0x471f('0x30')]['filter']){_0x593f03['where']=_['merge'](_0x593f03[_0x471f('0x36')],{'$or':_[_0x471f('0x27')](_0x593f03[_0x471f('0x2e')],function(_0xbca1ce){var _0x1c9de6={};_0x1c9de6[_0xbca1ce]={'$like':'%'+_0x1772ad[_0x471f('0x30')][_0x471f('0x35')]+'%'};return _0x1c9de6;})});}_0x593f03=_[_0x471f('0x37')]({},_0x593f03,_0x1772ad[_0x471f('0x38')]);return _0x2bfc69[_0x471f('0x4a')](_0x593f03);}})[_0x471f('0x3a')](function(_0x4b5325){if(_0x4b5325){_0x1f4e5a=_0x4b5325[_0x471f('0x42')];if(!_0x1772ad[_0x471f('0x30')][_0x471f('0x31')](_0x471f('0x32'))){_0x593f03['limit']=qs['limit'](_0x1772ad[_0x471f('0x30')][_0x471f('0x1e')]);_0x593f03['offset']=qs['offset'](_0x1772ad[_0x471f('0x30')][_0x471f('0x1c')]);}return _0x2bfc69['getConfigurations'](_0x593f03);}})[_0x471f('0x3a')](function(_0xceb33a){if(_0xceb33a){return _0xceb33a?{'count':_0x1f4e5a,'rows':_0xceb33a}:null;}})[_0x471f('0x3a')](respondWithResult(_0x26c5a5,null))[_0x471f('0x3e')](handleError(_0x26c5a5,null));};exports['addConfiguration']=function(_0x169d4a,_0x734493,_0x3358b5){if(_0x169d4a[_0x471f('0x44')]['id']){delete _0x169d4a[_0x471f('0x44')]['id'];}return db['FreshdeskAccount'][_0x471f('0x46')]({'where':{'id':_0x169d4a['params']['id']}})[_0x471f('0x3a')](handleEntityNotFound(_0x734493,null))[_0x471f('0x3a')](function(_0x25b1bf){if(_0x25b1bf){_0x169d4a[_0x471f('0x44')]['AccountId']=_0x25b1bf['id'];_0x169d4a[_0x471f('0x44')][_0x471f('0x4b')]=integrations[_0x471f('0x4c')](_0x169d4a[_0x471f('0x44')][_0x471f('0x4d')],_0x169d4a[_0x471f('0x44')][_0x471f('0x2a')]);_0x169d4a[_0x471f('0x44')][_0x471f('0x4e')]=integrations[_0x471f('0x4f')](_0x169d4a[_0x471f('0x44')][_0x471f('0x4d')],_0x169d4a['body'][_0x471f('0x2a')]);return db[_0x471f('0x47')][_0x471f('0x43')](_0x169d4a[_0x471f('0x44')],{'include':[{'model':db['FreshdeskField'],'as':_0x471f('0x4b')},{'model':db[_0x471f('0x50')],'as':_0x471f('0x4e')}]});}return null;})[_0x471f('0x3a')](respondWithResult(_0x734493,null))['catch'](handleError(_0x734493,null));};exports[_0x471f('0x51')]=function(_0x21835e,_0x5ab036,_0x1f941d){var _0x5ac2d9='';return db['FreshdeskAccount']['findOne']({'where':{'id':_0x21835e[_0x471f('0x3f')]['id']},'attributes':['id',_0x471f('0x52'),_0x471f('0x53')]})[_0x471f('0x3a')](handleEntityNotFound(_0x5ab036,null))[_0x471f('0x3a')](function(_0x29d1b3){if(_0x29d1b3){_0x5ac2d9=_0x29d1b3['remoteUri'];var _0x3dedd7=_0x5ac2d9[_0x471f('0x54')](-0x1);if(_0x3dedd7==='/'){_0x5ac2d9=_0x5ac2d9[_0x471f('0x55')](0x0,_0x5ac2d9[_0x471f('0x56')](_0x3dedd7));}return rp({'method':_0x471f('0x57'),'uri':util[_0x471f('0x58')](_0x471f('0x59'),_0x5ac2d9,_0x471f('0x5a')),'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(util['format']('%s:X',_0x29d1b3[_0x471f('0x53')]))[_0x471f('0x5b')](_0x471f('0x5c')))},'json':!![]});}})['then'](function(_0x5d3ca3){if(_0x5d3ca3){var _0x77a2c8=[_0x471f('0x5d'),_0x471f('0x5e'),_0x471f('0x5f'),_0x471f('0x60'),'status',_0x471f('0x61'),'group',_0x471f('0x62'),'ticket_type',_0x471f('0x63'),_0x471f('0x64')];_['remove'](_0x5d3ca3,function(_0x36be03){return _0x77a2c8[_0x471f('0x65')](_0x36be03[_0x471f('0x25')])||!_0x36be03[_0x471f('0x66')]&&_0x36be03[_0x471f('0x2a')]!=='custom_text'&&_0x36be03[_0x471f('0x2a')]!=='custom_dropdown';});return{'count':_0x5d3ca3['length'],'rows':_[_0x471f('0x27')](_0x5d3ca3,function(_0x10c8cb){return{'id':_0x10c8cb['name'],'name':_0x10c8cb[_0x471f('0x67')],'custom':!_0x10c8cb['default'],'options':_0x10c8cb[_0x471f('0x68')]?_[_0x471f('0x27')](_0x10c8cb['choices'],function(_0x385a44){return{'name':_[_0x471f('0x69')](_0x385a44),'value':_0x385a44};}):[]};})};}})['then'](respondWithResult(_0x5ab036,null))[_0x471f('0x3e')](function(_0x5bf577){var _0xf9163=_0x21835e[_0x471f('0x30')][_0x471f('0x6a')]?0x1f4:_0x5bf577[_0x471f('0x6b')]||0x1f4;logger[_0x471f('0x23')]('getFields,\x20%s,\x20%s,\x20%s',_0x471f('0x51'),_0xf9163,JSON[_0x471f('0x6c')](_0x5bf577));delete _0x5bf577[_0x471f('0x25')];if(_0xf9163===0x191){_0xf9163=0x190;}_0x5ab036[_0x471f('0x19')](_0xf9163)[_0x471f('0x26')](_0x21835e[_0x471f('0x30')][_0x471f('0x6a')]?{'message':_0x471f('0x6d'),'statusCode':_0x5bf577[_0x471f('0x6b')]}:_0x5bf577);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 4a67d0c..0ca21fd 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 _0xe953=['./intFreshdeskAccount.attributes','../../components/integrations/configuration','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x45781b,_0x16ca5a){var _0x1c1672=function(_0x1f9537){while(--_0x1f9537){_0x45781b['push'](_0x45781b['shift']());}};_0x1c1672(++_0x16ca5a);}(_0xe953,0x94));var _0x3e95=function(_0x2d89ce,_0x24d58d){_0x2d89ce=_0x2d89ce-0x0;var _0x3fad10=_0xe953[_0x2d89ce];return _0x3fad10;};'use strict';var _=require(_0x3e95('0x0'));var util=require(_0x3e95('0x1'));var logger=require(_0x3e95('0x2'))('api');var moment=require(_0x3e95('0x3'));var BPromise=require(_0x3e95('0x4'));var rp=require(_0x3e95('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3e95('0x6'));var integrations=require(_0x3e95('0x7'));module['exports']=function(_0x429945,_0x513501){return _0x429945[_0x3e95('0x8')](_0x3e95('0x9'),attributes,{'tableName':_0x3e95('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc667=['bluebird','request-promise','path','rimraf','./intFreshdeskAccount.attributes','exports','FreshdeskAccount','lodash','util','../../config/logger','api'];(function(_0x3893dd,_0x1cff1c){var _0x35aadc=function(_0x41e08d){while(--_0x41e08d){_0x3893dd['push'](_0x3893dd['shift']());}};_0x35aadc(++_0x1cff1c);}(_0xc667,0x1d5));var _0x7c66=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xc667[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x7c66('0x0'));var util=require(_0x7c66('0x1'));var logger=require(_0x7c66('0x2'))(_0x7c66('0x3'));var moment=require('moment');var BPromise=require(_0x7c66('0x4'));var rp=require(_0x7c66('0x5'));var fs=require('fs');var path=require(_0x7c66('0x6'));var rimraf=require(_0x7c66('0x7'));var config=require('../../config/environment');var attributes=require(_0x7c66('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x7c66('0x9')]=function(_0x3d549c,_0xf42b81){return _0x3d549c['define'](_0x7c66('0xa'),attributes,{'tableName':'int_freshdesk_accounts','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 f7d7bc9..f5e41aa 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 _0xe84a=['debug','request\x20sent','stringify','code','error','message','catch','options','raw','attributes','limit','include','model','map','then','GetFreshdeskAccount','ShowFreshdeskAccount','find','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','FreshdeskAccount,\x20%s,\x20%s'];(function(_0x3005b9,_0x5f009f){var _0xef310c=function(_0x8b599a){while(--_0x8b599a){_0x3005b9['push'](_0x3005b9['shift']());}};_0xef310c(++_0x5f009f);}(_0xe84a,0x97));var _0xae84=function(_0xcf7764,_0x4dc7c8){_0xcf7764=_0xcf7764-0x0;var _0x454db4=_0xe84a[_0xcf7764];return _0x454db4;};'use strict';var _=require(_0xae84('0x0'));var util=require(_0xae84('0x1'));var moment=require(_0xae84('0x2'));var BPromise=require(_0xae84('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xae84('0x4'));var db=require(_0xae84('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xae84('0x6'))(_0xae84('0x7'));var config=require(_0xae84('0x8'));var jayson=require(_0xae84('0x9'));var client=jayson['client'][_0xae84('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21ebf2,_0x1d3028,_0x402701){return new BPromise(function(_0x36bd5f,_0xf6d2c2){return client[_0xae84('0xb')](_0x21ebf2,_0x402701)['then'](function(_0x5261b8){logger[_0xae84('0xc')](_0xae84('0xd'),_0x1d3028,'request\x20sent');logger[_0xae84('0xe')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x1d3028,_0xae84('0xf'),JSON[_0xae84('0x10')](_0x5261b8));if(_0x5261b8['error']){if(_0x5261b8['error'][_0xae84('0x11')]===0x1f4){logger[_0xae84('0x12')](_0xae84('0xd'),_0x1d3028,_0x5261b8[_0xae84('0x12')][_0xae84('0x13')]);return _0xf6d2c2(_0x5261b8[_0xae84('0x12')][_0xae84('0x13')]);}logger[_0xae84('0x12')](_0xae84('0xd'),_0x1d3028,_0x5261b8[_0xae84('0x12')]['message']);return _0x36bd5f(_0x5261b8['error'][_0xae84('0x13')]);}else{logger[_0xae84('0xc')](_0xae84('0xd'),_0x1d3028,_0xae84('0xf'));_0x36bd5f(_0x5261b8['result']['message']);}})[_0xae84('0x14')](function(_0x11329b){logger[_0xae84('0x12')](_0xae84('0xd'),_0x1d3028,_0x11329b);_0xf6d2c2(_0x11329b);});});}exports['GetFreshdeskAccount']=function(_0x32eb37){var _0x52ec2b=this;return new Promise(function(_0x52803a,_0x1050e5){return db['FreshdeskAccount']['findAll']({'raw':_0x32eb37[_0xae84('0x15')]?_0x32eb37[_0xae84('0x15')][_0xae84('0x16')]===undefined?!![]:![]:!![],'where':_0x32eb37[_0xae84('0x15')]?_0x32eb37[_0xae84('0x15')]['where']||null:null,'attributes':_0x32eb37[_0xae84('0x15')]?_0x32eb37[_0xae84('0x15')][_0xae84('0x17')]||null:null,'limit':_0x32eb37['options']?_0x32eb37[_0xae84('0x15')][_0xae84('0x18')]||null:null,'include':_0x32eb37[_0xae84('0x15')]?_0x32eb37[_0xae84('0x15')]['include']?_['map'](_0x32eb37[_0xae84('0x15')][_0xae84('0x19')],function(_0x1133ef){return{'model':db[_0x1133ef[_0xae84('0x1a')]],'as':_0x1133ef['as'],'attributes':_0x1133ef[_0xae84('0x17')],'include':_0x1133ef[_0xae84('0x19')]?_[_0xae84('0x1b')](_0x1133ef['include'],function(_0x4a86ff){return{'model':db[_0x4a86ff[_0xae84('0x1a')]],'as':_0x4a86ff['as'],'attributes':_0x4a86ff['attributes'],'include':_0x4a86ff[_0xae84('0x19')]?_[_0xae84('0x1b')](_0x4a86ff[_0xae84('0x19')],function(_0x38ca10){return{'model':db[_0x38ca10['model']],'as':_0x38ca10['as'],'attributes':_0x38ca10[_0xae84('0x17')]};}):[]};}):[]};}):[]:[]})[_0xae84('0x1c')](function(_0x145d42){logger[_0xae84('0xc')](_0xae84('0x1d'),_0x32eb37);logger['debug']('GetFreshdeskAccount',_0x32eb37,JSON[_0xae84('0x10')](_0x145d42));_0x52803a(_0x145d42);})[_0xae84('0x14')](function(_0x764df4){logger[_0xae84('0x12')]('GetFreshdeskAccount',_0x764df4[_0xae84('0x13')],_0x32eb37);_0x1050e5(_0x52ec2b['error'](0x1f4,_0x764df4['message']));});});};exports[_0xae84('0x1e')]=function(_0x501e17){var _0x1f99b0=this;return new Promise(function(_0x119456,_0x4db975){return db['FreshdeskAccount'][_0xae84('0x1f')]({'raw':_0x501e17[_0xae84('0x15')]?_0x501e17[_0xae84('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x501e17[_0xae84('0x15')]?_0x501e17[_0xae84('0x15')][_0xae84('0x20')]||null:null,'attributes':_0x501e17[_0xae84('0x15')]?_0x501e17[_0xae84('0x15')]['attributes']||null:null,'include':_0x501e17[_0xae84('0x15')]?_0x501e17[_0xae84('0x15')][_0xae84('0x19')]?_[_0xae84('0x1b')](_0x501e17[_0xae84('0x15')][_0xae84('0x19')],function(_0x56cbac){return{'model':db[_0x56cbac[_0xae84('0x1a')]],'as':_0x56cbac['as'],'attributes':_0x56cbac[_0xae84('0x17')],'include':_0x56cbac[_0xae84('0x19')]?_[_0xae84('0x1b')](_0x56cbac[_0xae84('0x19')],function(_0x56d25d){return{'model':db[_0x56d25d[_0xae84('0x1a')]],'as':_0x56d25d['as'],'attributes':_0x56d25d[_0xae84('0x17')],'include':_0x56d25d[_0xae84('0x19')]?_[_0xae84('0x1b')](_0x56d25d[_0xae84('0x19')],function(_0x2d7355){return{'model':db[_0x2d7355[_0xae84('0x1a')]],'as':_0x2d7355['as'],'attributes':_0x2d7355[_0xae84('0x17')]};}):[]};}):[]};}):[]:[]})[_0xae84('0x1c')](function(_0x50ca6e){logger['info'](_0xae84('0x1e'),_0x501e17);logger[_0xae84('0xe')]('ShowFreshdeskAccount',_0x501e17,JSON[_0xae84('0x10')](_0x50ca6e));_0x119456(_0x50ca6e);})[_0xae84('0x14')](function(_0x58f362){logger[_0xae84('0x12')](_0xae84('0x1e'),_0x58f362[_0xae84('0x13')],_0x501e17);_0x4db975(_0x1f99b0[_0xae84('0x12')](0x1f4,_0x58f362['message']));});});}; \ No newline at end of file +var _0x6386=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetFreshdeskAccount','findAll','raw','options','where','attributes','limit','include','map','model','stringify','ShowFreshdeskAccount','FreshdeskAccount','find','lodash','util','moment','bluebird','randomstring'];(function(_0x55c217,_0x3f96bc){var _0x37dbce=function(_0x2fb00e){while(--_0x2fb00e){_0x55c217['push'](_0x55c217['shift']());}};_0x37dbce(++_0x3f96bc);}(_0x6386,0x1cf));var _0x6638=function(_0x5c873e,_0x3dda2e){_0x5c873e=_0x5c873e-0x0;var _0x5dddbc=_0x6386[_0x5c873e];return _0x5dddbc;};'use strict';var _=require(_0x6638('0x0'));var util=require(_0x6638('0x1'));var moment=require(_0x6638('0x2'));var BPromise=require(_0x6638('0x3'));var rs=require(_0x6638('0x4'));var fs=require('fs');var Redis=require(_0x6638('0x5'));var db=require(_0x6638('0x6'))['db'];var utils=require(_0x6638('0x7'));var logger=require(_0x6638('0x8'))(_0x6638('0x9'));var config=require(_0x6638('0xa'));var jayson=require(_0x6638('0xb'));var client=jayson[_0x6638('0xc')][_0x6638('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x7668db,_0xe5f904,_0xfb8f3f){return new BPromise(function(_0x41a09f,_0x2868e9){return client[_0x6638('0xe')](_0x7668db,_0xfb8f3f)[_0x6638('0xf')](function(_0x36a706){logger[_0x6638('0x10')](_0x6638('0x11'),_0xe5f904,_0x6638('0x12'));logger[_0x6638('0x13')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0xe5f904,_0x6638('0x12'),JSON['stringify'](_0x36a706));if(_0x36a706[_0x6638('0x14')]){if(_0x36a706[_0x6638('0x14')][_0x6638('0x15')]===0x1f4){logger['error'](_0x6638('0x11'),_0xe5f904,_0x36a706[_0x6638('0x14')][_0x6638('0x16')]);return _0x2868e9(_0x36a706[_0x6638('0x14')][_0x6638('0x16')]);}logger[_0x6638('0x14')](_0x6638('0x11'),_0xe5f904,_0x36a706[_0x6638('0x14')][_0x6638('0x16')]);return _0x41a09f(_0x36a706[_0x6638('0x14')]['message']);}else{logger[_0x6638('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0xe5f904,_0x6638('0x12'));_0x41a09f(_0x36a706[_0x6638('0x17')]['message']);}})[_0x6638('0x18')](function(_0xfcbb12){logger[_0x6638('0x14')]('FreshdeskAccount,\x20%s,\x20%s',_0xe5f904,_0xfcbb12);_0x2868e9(_0xfcbb12);});});}exports[_0x6638('0x19')]=function(_0x4cce42){var _0x1d5b28=this;return new Promise(function(_0x58fb4d,_0x2e6bd5){return db['FreshdeskAccount'][_0x6638('0x1a')]({'raw':_0x4cce42['options']?_0x4cce42['options'][_0x6638('0x1b')]===undefined?!![]:![]:!![],'where':_0x4cce42['options']?_0x4cce42[_0x6638('0x1c')][_0x6638('0x1d')]||null:null,'attributes':_0x4cce42[_0x6638('0x1c')]?_0x4cce42[_0x6638('0x1c')][_0x6638('0x1e')]||null:null,'limit':_0x4cce42[_0x6638('0x1c')]?_0x4cce42[_0x6638('0x1c')][_0x6638('0x1f')]||null:null,'include':_0x4cce42['options']?_0x4cce42['options'][_0x6638('0x20')]?_[_0x6638('0x21')](_0x4cce42[_0x6638('0x1c')][_0x6638('0x20')],function(_0x52dc5f){return{'model':db[_0x52dc5f['model']],'as':_0x52dc5f['as'],'attributes':_0x52dc5f['attributes'],'include':_0x52dc5f[_0x6638('0x20')]?_['map'](_0x52dc5f[_0x6638('0x20')],function(_0x4a3430){return{'model':db[_0x4a3430[_0x6638('0x22')]],'as':_0x4a3430['as'],'attributes':_0x4a3430['attributes'],'include':_0x4a3430[_0x6638('0x20')]?_['map'](_0x4a3430['include'],function(_0xd9c621){return{'model':db[_0xd9c621['model']],'as':_0xd9c621['as'],'attributes':_0xd9c621[_0x6638('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29e40d){logger[_0x6638('0x10')](_0x6638('0x19'),_0x4cce42);logger['debug'](_0x6638('0x19'),_0x4cce42,JSON[_0x6638('0x23')](_0x29e40d));_0x58fb4d(_0x29e40d);})['catch'](function(_0x31c31c){logger['error'](_0x6638('0x19'),_0x31c31c[_0x6638('0x16')],_0x4cce42);_0x2e6bd5(_0x1d5b28['error'](0x1f4,_0x31c31c[_0x6638('0x16')]));});});};exports[_0x6638('0x24')]=function(_0xc78f31){var _0x45a2bb=this;return new Promise(function(_0x2f66cc,_0x316e5d){return db[_0x6638('0x25')][_0x6638('0x26')]({'raw':_0xc78f31[_0x6638('0x1c')]?_0xc78f31[_0x6638('0x1c')][_0x6638('0x1b')]===undefined?!![]:![]:!![],'where':_0xc78f31['options']?_0xc78f31[_0x6638('0x1c')][_0x6638('0x1d')]||null:null,'attributes':_0xc78f31['options']?_0xc78f31['options'][_0x6638('0x1e')]||null:null,'include':_0xc78f31[_0x6638('0x1c')]?_0xc78f31['options'][_0x6638('0x20')]?_[_0x6638('0x21')](_0xc78f31[_0x6638('0x1c')][_0x6638('0x20')],function(_0x4287d5){return{'model':db[_0x4287d5[_0x6638('0x22')]],'as':_0x4287d5['as'],'attributes':_0x4287d5[_0x6638('0x1e')],'include':_0x4287d5[_0x6638('0x20')]?_[_0x6638('0x21')](_0x4287d5[_0x6638('0x20')],function(_0x285643){return{'model':db[_0x285643[_0x6638('0x22')]],'as':_0x285643['as'],'attributes':_0x285643[_0x6638('0x1e')],'include':_0x285643[_0x6638('0x20')]?_[_0x6638('0x21')](_0x285643[_0x6638('0x20')],function(_0x4ef7dd){return{'model':db[_0x4ef7dd[_0x6638('0x22')]],'as':_0x4ef7dd['as'],'attributes':_0x4ef7dd[_0x6638('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xa52602){logger[_0x6638('0x10')](_0x6638('0x24'),_0xc78f31);logger[_0x6638('0x13')](_0x6638('0x24'),_0xc78f31,JSON['stringify'](_0xa52602));_0x2f66cc(_0xa52602);})[_0x6638('0x18')](function(_0x1e894e){logger[_0x6638('0x14')](_0x6638('0x24'),_0x1e894e['message'],_0xc78f31);_0x316e5d(_0x45a2bb[_0x6638('0x14')](0x1f4,_0x1e894e[_0x6638('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 1a8714c..f3310e4 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 _0x9cf1=['delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','put','update'];(function(_0x3b592d,_0x2f52b3){var _0x2ca83f=function(_0x442fd9){while(--_0x442fd9){_0x3b592d['push'](_0x3b592d['shift']());}};_0x2ca83f(++_0x2f52b3);}(_0x9cf1,0x1d6));var _0x19cf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9cf1[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x19cf('0x0'));var util=require(_0x19cf('0x1'));var path=require(_0x19cf('0x2'));var timeout=require(_0x19cf('0x3'));var express=require(_0x19cf('0x4'));var router=express[_0x19cf('0x5')]();var fs_extra=require(_0x19cf('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x19cf('0x7'));var config=require(_0x19cf('0x8'));var controller=require('./intFreshdeskConfiguration.controller');router['get']('/',auth[_0x19cf('0x9')](),controller[_0x19cf('0xa')]);router[_0x19cf('0xb')](_0x19cf('0xc'),auth[_0x19cf('0x9')](),controller['show']);router[_0x19cf('0xb')](_0x19cf('0xd'),auth[_0x19cf('0x9')](),controller[_0x19cf('0xe')]);router[_0x19cf('0xb')](_0x19cf('0xf'),auth[_0x19cf('0x9')](),controller[_0x19cf('0x10')]);router['get']('/:id/descriptions',auth[_0x19cf('0x9')](),controller[_0x19cf('0x11')]);router[_0x19cf('0xb')](_0x19cf('0x12'),auth[_0x19cf('0x9')](),controller[_0x19cf('0x13')]);router[_0x19cf('0x14')]('/',auth['isAuthenticated'](),controller[_0x19cf('0x15')]);router[_0x19cf('0x14')](_0x19cf('0x12'),auth[_0x19cf('0x9')](),controller['setTags']);router[_0x19cf('0x16')]('/:id',auth[_0x19cf('0x9')](),controller[_0x19cf('0x17')]);router[_0x19cf('0x18')]('/:id',auth[_0x19cf('0x9')](),controller['destroy']);module[_0x19cf('0x19')]=router; \ No newline at end of file +var _0x95a6=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','/:id/fields','getFields','getSubjects','getDescriptions','post','/:id/tags','setTags','put','update','delete','destroy'];(function(_0x54d8dd,_0x1159ce){var _0x5e8572=function(_0x31ef05){while(--_0x31ef05){_0x54d8dd['push'](_0x54d8dd['shift']());}};_0x5e8572(++_0x1159ce);}(_0x95a6,0xa2));var _0x695a=function(_0xe47464,_0x1880ca){_0xe47464=_0xe47464-0x0;var _0x540d6d=_0x95a6[_0xe47464];return _0x540d6d;};'use strict';var multer=require(_0x695a('0x0'));var util=require(_0x695a('0x1'));var path=require(_0x695a('0x2'));var timeout=require(_0x695a('0x3'));var express=require(_0x695a('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x695a('0x5'));var interaction=require(_0x695a('0x6'));var config=require(_0x695a('0x7'));var controller=require('./intFreshdeskConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x695a('0x8')](_0x695a('0x9'),auth[_0x695a('0xa')](),controller['show']);router['get'](_0x695a('0xb'),auth[_0x695a('0xa')](),controller[_0x695a('0xc')]);router[_0x695a('0x8')]('/:id/subjects',auth[_0x695a('0xa')](),controller[_0x695a('0xd')]);router[_0x695a('0x8')]('/:id/descriptions',auth[_0x695a('0xa')](),controller[_0x695a('0xe')]);router[_0x695a('0x8')]('/:id/tags',auth[_0x695a('0xa')](),controller['getTags']);router['post']('/',auth[_0x695a('0xa')](),controller['create']);router[_0x695a('0xf')](_0x695a('0x10'),auth['isAuthenticated'](),controller[_0x695a('0x11')]);router[_0x695a('0x12')](_0x695a('0x9'),auth[_0x695a('0xa')](),controller[_0x695a('0x13')]);router[_0x695a('0x14')](_0x695a('0x9'),auth[_0x695a('0xa')](),controller[_0x695a('0x15')]);module[_0x695a('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 724c25f..964cff9 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 _0x461d=['STRING'];(function(_0x5b6ca9,_0x40ce48){var _0x11ca9a=function(_0x18e5ab){while(--_0x18e5ab){_0x5b6ca9['push'](_0x5b6ca9['shift']());}};_0x11ca9a(++_0x40ce48);}(_0x461d,0x195));var _0xd461=function(_0x40797c,_0x26aff6){_0x40797c=_0x40797c-0x0;var _0x55c603=_0x461d[_0x40797c];return _0x55c603;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xd461('0x0')]},'description':{'type':Sequelize[_0xd461('0x0')]}}; \ No newline at end of file +var _0x932c=['sequelize','STRING'];(function(_0x464d54,_0x39cfd2){var _0x14f9ca=function(_0xec8eb6){while(--_0xec8eb6){_0x464d54['push'](_0x464d54['shift']());}};_0x14f9ca(++_0x39cfd2);}(_0x932c,0x1a0));var _0xc932=function(_0x4a563b,_0x36f42d){_0x4a563b=_0x4a563b-0x0;var _0x2935ef=_0x932c[_0x4a563b];return _0x2935ef;};'use strict';var Sequelize=require(_0xc932('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc932('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 8d279e8..7f29deb 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 _0xf874=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','map','FreshdeskConfiguration','fieldName','key','query','keys','filters','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','intersection','fields','include','find','create','body','findOne','getFields','getSubjects','FreshdeskField','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util'];(function(_0x1fc5f6,_0x3734ea){var _0x34f1ee=function(_0x56af71){while(--_0x56af71){_0x1fc5f6['push'](_0x1fc5f6['shift']());}};_0x34f1ee(++_0x3734ea);}(_0xf874,0x1a7));var _0x4f87=function(_0x59e779,_0x35fb6b){_0x59e779=_0x59e779-0x0;var _0x13177b=_0xf874[_0x59e779];return _0x13177b;};'use strict';var emlformat=require(_0x4f87('0x0'));var rimraf=require(_0x4f87('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4f87('0x2'));var rp=require(_0x4f87('0x3'));var moment=require(_0x4f87('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4f87('0x5'));var util=require(_0x4f87('0x6'));var path=require('path');var sox=require(_0x4f87('0x7'));var csv=require(_0x4f87('0x8'));var ejs=require(_0x4f87('0x9'));var fs=require('fs');var fs_extra=require(_0x4f87('0xa'));var _=require(_0x4f87('0xb'));var squel=require(_0x4f87('0xc'));var crypto=require(_0x4f87('0xd'));var jsforce=require(_0x4f87('0xe'));var deskjs=require(_0x4f87('0xf'));var toCsv=require(_0x4f87('0x8'));var querystring=require(_0x4f87('0x10'));var Papa=require('papaparse');var Redis=require(_0x4f87('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4f87('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f87('0x13'));var logger=require(_0x4f87('0x14'))(_0x4f87('0x15'));var utils=require(_0x4f87('0x16'));var config=require(_0x4f87('0x17'));var licenseUtil=require(_0x4f87('0x18'));var db=require(_0x4f87('0x19'))['db'];function respondWithStatusCode(_0x18edab,_0x2af3aa){_0x2af3aa=_0x2af3aa||0xcc;return function(_0xa5e54a){if(_0xa5e54a){return _0x18edab[_0x4f87('0x1a')](_0x2af3aa);}return _0x18edab[_0x4f87('0x1b')](_0x2af3aa)['end']();};}function respondWithResult(_0x5e9d6c,_0x567ed9){_0x567ed9=_0x567ed9||0xc8;return function(_0x2d9f5f){if(_0x2d9f5f){return _0x5e9d6c[_0x4f87('0x1b')](_0x567ed9)[_0x4f87('0x1c')](_0x2d9f5f);}};}function respondWithFilteredResult(_0x5db757,_0x2be974){return function(_0x472f59){if(_0x472f59){var _0x422f1b=typeof _0x2be974['offset']===_0x4f87('0x1d')&&typeof _0x2be974[_0x4f87('0x1e')]==='undefined';var _0x5d77e8=_0x472f59[_0x4f87('0x1f')];var _0xdfc1ab=_0x422f1b?0x0:_0x2be974[_0x4f87('0x20')];var _0x86dc66=_0x422f1b?_0x472f59[_0x4f87('0x1f')]:_0x2be974['offset']+_0x2be974['limit'];var _0x19b934;if(_0x86dc66>=_0x5d77e8){_0x86dc66=_0x5d77e8;_0x19b934=0xc8;}else{_0x19b934=0xce;}_0x5db757['status'](_0x19b934);return _0x5db757[_0x4f87('0x21')](_0x4f87('0x22'),_0xdfc1ab+'-'+_0x86dc66+'/'+_0x5d77e8)['json'](_0x472f59);}return null;};}function patchUpdates(_0x2ec6){return function(_0x3f8b75){try{jsonpatch[_0x4f87('0x23')](_0x3f8b75,_0x2ec6,!![]);}catch(_0x4939f3){return BPromise[_0x4f87('0x24')](_0x4939f3);}return _0x3f8b75['save']();};}function saveUpdates(_0x2c619b,_0x583789){return function(_0x546f70){if(_0x546f70){return _0x546f70[_0x4f87('0x25')](_0x2c619b)[_0x4f87('0x26')](function(_0x3531d8){return _0x3531d8;});}return null;};}function removeEntity(_0x1ff104,_0x4c1b0c){return function(_0x56b9ec){if(_0x56b9ec){return _0x56b9ec[_0x4f87('0x27')]()[_0x4f87('0x26')](function(){_0x1ff104[_0x4f87('0x1b')](0xcc)[_0x4f87('0x28')]();});}};}function handleEntityNotFound(_0x361847,_0x17601b){return function(_0x14bfef){if(!_0x14bfef){_0x361847[_0x4f87('0x1a')](0x194);}return _0x14bfef;};}function handleError(_0x52b302,_0x4fd082){_0x4fd082=_0x4fd082||0x1f4;return function(_0x10c6a0){logger[_0x4f87('0x29')](_0x10c6a0[_0x4f87('0x2a')]);if(_0x10c6a0[_0x4f87('0x2b')]){delete _0x10c6a0['name'];}_0x52b302[_0x4f87('0x1b')](_0x4fd082)[_0x4f87('0x2c')](_0x10c6a0);};}exports['index']=function(_0x164f17,_0x2a8c89){var _0x4c9e81={},_0x22be74={},_0x58f9cd={'count':0x0,'rows':[]};var _0x3dc2e0=_[_0x4f87('0x2d')](db[_0x4f87('0x2e')]['rawAttributes'],function(_0x41ddf6){return{'name':_0x41ddf6[_0x4f87('0x2f')],'type':_0x41ddf6['type'][_0x4f87('0x30')]};});_0x22be74['model']=_['map'](_0x3dc2e0,_0x4f87('0x2b'));_0x22be74[_0x4f87('0x31')]=_[_0x4f87('0x32')](_0x164f17['query']);_0x22be74[_0x4f87('0x33')]=_['intersection'](_0x22be74[_0x4f87('0x34')],_0x22be74[_0x4f87('0x31')]);_0x4c9e81[_0x4f87('0x35')]=_['intersection'](_0x22be74[_0x4f87('0x34')],qs['fields'](_0x164f17[_0x4f87('0x31')]['fields']));_0x4c9e81[_0x4f87('0x35')]=_0x4c9e81[_0x4f87('0x35')][_0x4f87('0x36')]?_0x4c9e81[_0x4f87('0x35')]:_0x22be74[_0x4f87('0x34')];if(!_0x164f17[_0x4f87('0x31')][_0x4f87('0x37')](_0x4f87('0x38'))){_0x4c9e81['limit']=qs[_0x4f87('0x1e')](_0x164f17[_0x4f87('0x31')][_0x4f87('0x1e')]);_0x4c9e81['offset']=qs[_0x4f87('0x20')](_0x164f17[_0x4f87('0x31')]['offset']);}_0x4c9e81[_0x4f87('0x39')]=qs[_0x4f87('0x3a')](_0x164f17['query'][_0x4f87('0x3a')]);_0x4c9e81[_0x4f87('0x3b')]=qs[_0x4f87('0x33')](_[_0x4f87('0x3c')](_0x164f17[_0x4f87('0x31')],_0x22be74[_0x4f87('0x33')]),_0x3dc2e0);if(_0x164f17['query'][_0x4f87('0x3d')]){_0x4c9e81[_0x4f87('0x3b')]=_[_0x4f87('0x3e')](_0x4c9e81['where'],{'$or':_['map'](_0x3dc2e0,function(_0xa65325){if(_0xa65325['type']!==_0x4f87('0x3f')){var _0x3e5d9={};_0x3e5d9[_0xa65325[_0x4f87('0x2b')]]={'$like':'%'+_0x164f17[_0x4f87('0x31')][_0x4f87('0x3d')]+'%'};return _0x3e5d9;}})});}_0x4c9e81=_[_0x4f87('0x3e')]({},_0x4c9e81,_0x164f17[_0x4f87('0x40')]);var _0x432877={'where':_0x4c9e81['where']};return db[_0x4f87('0x2e')]['count'](_0x432877)[_0x4f87('0x26')](function(_0x584251){_0x58f9cd[_0x4f87('0x1f')]=_0x584251;if(_0x164f17[_0x4f87('0x31')][_0x4f87('0x41')]){_0x4c9e81['include']=[{'all':!![]}];}return db[_0x4f87('0x2e')][_0x4f87('0x42')](_0x4c9e81);})[_0x4f87('0x26')](function(_0x69099a){_0x58f9cd[_0x4f87('0x43')]=_0x69099a;return _0x58f9cd;})[_0x4f87('0x26')](respondWithFilteredResult(_0x2a8c89,_0x4c9e81))[_0x4f87('0x44')](handleError(_0x2a8c89,null));};exports[_0x4f87('0x45')]=function(_0x3acba6,_0x2bb6e9){var _0x1df4ac={'raw':![],'where':{'id':_0x3acba6[_0x4f87('0x46')]['id']}},_0x156995={};_0x156995['model']=_['keys'](db[_0x4f87('0x2e')][_0x4f87('0x47')]);_0x156995[_0x4f87('0x31')]=_[_0x4f87('0x32')](_0x3acba6[_0x4f87('0x31')]);_0x156995[_0x4f87('0x33')]=_[_0x4f87('0x48')](_0x156995['model'],_0x156995[_0x4f87('0x31')]);_0x1df4ac['attributes']=_[_0x4f87('0x48')](_0x156995[_0x4f87('0x34')],qs[_0x4f87('0x49')](_0x3acba6['query'][_0x4f87('0x49')]));_0x1df4ac[_0x4f87('0x35')]=_0x1df4ac[_0x4f87('0x35')][_0x4f87('0x36')]?_0x1df4ac[_0x4f87('0x35')]:_0x156995['model'];if(_0x3acba6[_0x4f87('0x31')][_0x4f87('0x41')]){_0x1df4ac[_0x4f87('0x4a')]=[{'all':!![]}];}_0x1df4ac=_[_0x4f87('0x3e')]({},_0x1df4ac,_0x3acba6[_0x4f87('0x40')]);return db[_0x4f87('0x2e')][_0x4f87('0x4b')](_0x1df4ac)[_0x4f87('0x26')](handleEntityNotFound(_0x2bb6e9,null))[_0x4f87('0x26')](respondWithResult(_0x2bb6e9,null))[_0x4f87('0x44')](handleError(_0x2bb6e9,null));};exports['create']=function(_0x3ed6f8,_0x1b1873){return db['FreshdeskConfiguration'][_0x4f87('0x4c')](_0x3ed6f8[_0x4f87('0x4d')],{})['then'](respondWithResult(_0x1b1873,0xc9))[_0x4f87('0x44')](handleError(_0x1b1873,null));};exports[_0x4f87('0x25')]=function(_0x244bca,_0x298fbc){if(_0x244bca['body']['id']){delete _0x244bca[_0x4f87('0x4d')]['id'];}return db[_0x4f87('0x2e')]['find']({'where':{'id':_0x244bca[_0x4f87('0x46')]['id']}})['then'](handleEntityNotFound(_0x298fbc,null))[_0x4f87('0x26')](saveUpdates(_0x244bca[_0x4f87('0x4d')],null))[_0x4f87('0x26')](respondWithResult(_0x298fbc,null))[_0x4f87('0x44')](handleError(_0x298fbc,null));};exports[_0x4f87('0x27')]=function(_0x56bb4c,_0x2a3042){return db[_0x4f87('0x2e')][_0x4f87('0x4b')]({'where':{'id':_0x56bb4c[_0x4f87('0x46')]['id']}})[_0x4f87('0x26')](handleEntityNotFound(_0x2a3042,null))[_0x4f87('0x26')](removeEntity(_0x2a3042,null))[_0x4f87('0x44')](handleError(_0x2a3042,null));};exports['getFields']=function(_0x5db4fd,_0x33c466,_0x131e4b){var _0x22ca30={};var _0x29acba={};var _0x10ea5f;var _0x592c64;return db[_0x4f87('0x2e')][_0x4f87('0x4e')]({'where':{'id':_0x5db4fd[_0x4f87('0x46')]['id']}})['then'](handleEntityNotFound(_0x33c466,null))[_0x4f87('0x26')](function(_0x2a058c){if(_0x2a058c){_0x10ea5f=_0x2a058c;_0x29acba[_0x4f87('0x34')]=_['keys'](db['FreshdeskField'][_0x4f87('0x47')]);_0x29acba[_0x4f87('0x31')]=_[_0x4f87('0x32')](_0x5db4fd['query']);_0x29acba[_0x4f87('0x33')]=_[_0x4f87('0x48')](_0x29acba[_0x4f87('0x34')],_0x29acba[_0x4f87('0x31')]);_0x22ca30[_0x4f87('0x35')]=_[_0x4f87('0x48')](_0x29acba[_0x4f87('0x34')],qs[_0x4f87('0x49')](_0x5db4fd[_0x4f87('0x31')]['fields']));_0x22ca30['attributes']=_0x22ca30[_0x4f87('0x35')][_0x4f87('0x36')]?_0x22ca30[_0x4f87('0x35')]:_0x29acba['model'];_0x22ca30['order']=qs[_0x4f87('0x3a')](_0x5db4fd[_0x4f87('0x31')][_0x4f87('0x3a')]);_0x22ca30[_0x4f87('0x3b')]=qs['filters'](_[_0x4f87('0x3c')](_0x5db4fd[_0x4f87('0x31')],_0x29acba[_0x4f87('0x33')]));if(_0x5db4fd['query'][_0x4f87('0x3d')]){_0x22ca30[_0x4f87('0x3b')]=_['merge'](_0x22ca30[_0x4f87('0x3b')],{'$or':_[_0x4f87('0x2d')](_0x22ca30['attributes'],function(_0x2e1c74){var _0x3d4273={};_0x3d4273[_0x2e1c74]={'$like':'%'+_0x5db4fd[_0x4f87('0x31')][_0x4f87('0x3d')]+'%'};return _0x3d4273;})});}_0x22ca30=_[_0x4f87('0x3e')]({},_0x22ca30,_0x5db4fd[_0x4f87('0x40')]);return _0x10ea5f[_0x4f87('0x4f')](_0x22ca30);}})[_0x4f87('0x26')](function(_0x9d9b52){if(_0x9d9b52){_0x592c64=_0x9d9b52[_0x4f87('0x36')];if(!_0x5db4fd[_0x4f87('0x31')]['hasOwnProperty'](_0x4f87('0x38'))){_0x22ca30[_0x4f87('0x1e')]=qs['limit'](_0x5db4fd['query'][_0x4f87('0x1e')]);_0x22ca30[_0x4f87('0x20')]=qs[_0x4f87('0x20')](_0x5db4fd[_0x4f87('0x31')][_0x4f87('0x20')]);}return _0x10ea5f[_0x4f87('0x4f')](_0x22ca30);}})[_0x4f87('0x26')](function(_0x1a0cb6){if(_0x1a0cb6){return _0x1a0cb6?{'count':_0x592c64,'rows':_0x1a0cb6}:null;}})[_0x4f87('0x26')](respondWithResult(_0x33c466,null))[_0x4f87('0x44')](handleError(_0x33c466,null));};exports[_0x4f87('0x50')]=function(_0x58899a,_0x3b3839,_0x32a0e9){var _0x18c109={};var _0x14a019={};var _0x19c270;var _0x4a8ffd;return db[_0x4f87('0x2e')][_0x4f87('0x4e')]({'where':{'id':_0x58899a[_0x4f87('0x46')]['id']}})[_0x4f87('0x26')](handleEntityNotFound(_0x3b3839,null))[_0x4f87('0x26')](function(_0x4f1a9d){if(_0x4f1a9d){_0x19c270=_0x4f1a9d;_0x14a019[_0x4f87('0x34')]=_[_0x4f87('0x32')](db[_0x4f87('0x51')][_0x4f87('0x47')]);_0x14a019['query']=_[_0x4f87('0x32')](_0x58899a['query']);_0x14a019[_0x4f87('0x33')]=_[_0x4f87('0x48')](_0x14a019[_0x4f87('0x34')],_0x14a019[_0x4f87('0x31')]);_0x18c109[_0x4f87('0x35')]=_[_0x4f87('0x48')](_0x14a019[_0x4f87('0x34')],qs[_0x4f87('0x49')](_0x58899a[_0x4f87('0x31')][_0x4f87('0x49')]));_0x18c109[_0x4f87('0x35')]=_0x18c109[_0x4f87('0x35')]['length']?_0x18c109[_0x4f87('0x35')]:_0x14a019['model'];_0x18c109['order']=qs[_0x4f87('0x3a')](_0x58899a[_0x4f87('0x31')][_0x4f87('0x3a')]);_0x18c109[_0x4f87('0x3b')]=qs[_0x4f87('0x33')](_[_0x4f87('0x3c')](_0x58899a[_0x4f87('0x31')],_0x14a019[_0x4f87('0x33')]));if(_0x58899a[_0x4f87('0x31')][_0x4f87('0x3d')]){_0x18c109[_0x4f87('0x3b')]=_[_0x4f87('0x3e')](_0x18c109[_0x4f87('0x3b')],{'$or':_[_0x4f87('0x2d')](_0x18c109[_0x4f87('0x35')],function(_0x18e50b){var _0x14a3f7={};_0x14a3f7[_0x18e50b]={'$like':'%'+_0x58899a[_0x4f87('0x31')][_0x4f87('0x3d')]+'%'};return _0x14a3f7;})});}_0x18c109=_[_0x4f87('0x3e')]({},_0x18c109,_0x58899a[_0x4f87('0x40')]);return _0x19c270[_0x4f87('0x50')](_0x18c109);}})[_0x4f87('0x26')](function(_0x4fc50b){if(_0x4fc50b){_0x4a8ffd=_0x4fc50b['length'];if(!_0x58899a['query'][_0x4f87('0x37')]('nolimit')){_0x18c109[_0x4f87('0x1e')]=qs['limit'](_0x58899a[_0x4f87('0x31')][_0x4f87('0x1e')]);_0x18c109[_0x4f87('0x20')]=qs[_0x4f87('0x20')](_0x58899a[_0x4f87('0x31')][_0x4f87('0x20')]);}return _0x19c270[_0x4f87('0x50')](_0x18c109);}})[_0x4f87('0x26')](function(_0x2872e6){if(_0x2872e6){return _0x2872e6?{'count':_0x4a8ffd,'rows':_0x2872e6}:null;}})[_0x4f87('0x26')](respondWithResult(_0x3b3839,null))[_0x4f87('0x44')](handleError(_0x3b3839,null));};exports[_0x4f87('0x52')]=function(_0x4dd125,_0x142b11,_0x539012){var _0x266077={};var _0x2d54e8={};var _0x553d48;var _0x24c1a6;return db[_0x4f87('0x2e')][_0x4f87('0x4e')]({'where':{'id':_0x4dd125[_0x4f87('0x46')]['id']}})[_0x4f87('0x26')](handleEntityNotFound(_0x142b11,null))['then'](function(_0x250b1b){if(_0x250b1b){_0x553d48=_0x250b1b;_0x2d54e8[_0x4f87('0x34')]=_['keys'](db[_0x4f87('0x51')]['rawAttributes']);_0x2d54e8['query']=_[_0x4f87('0x32')](_0x4dd125['query']);_0x2d54e8[_0x4f87('0x33')]=_['intersection'](_0x2d54e8[_0x4f87('0x34')],_0x2d54e8[_0x4f87('0x31')]);_0x266077['attributes']=_[_0x4f87('0x48')](_0x2d54e8['model'],qs[_0x4f87('0x49')](_0x4dd125[_0x4f87('0x31')][_0x4f87('0x49')]));_0x266077[_0x4f87('0x35')]=_0x266077[_0x4f87('0x35')]['length']?_0x266077[_0x4f87('0x35')]:_0x2d54e8[_0x4f87('0x34')];_0x266077[_0x4f87('0x39')]=qs['sort'](_0x4dd125['query'][_0x4f87('0x3a')]);_0x266077[_0x4f87('0x3b')]=qs[_0x4f87('0x33')](_[_0x4f87('0x3c')](_0x4dd125['query'],_0x2d54e8[_0x4f87('0x33')]));if(_0x4dd125[_0x4f87('0x31')][_0x4f87('0x3d')]){_0x266077['where']=_[_0x4f87('0x3e')](_0x266077['where'],{'$or':_[_0x4f87('0x2d')](_0x266077[_0x4f87('0x35')],function(_0x4936e3){var _0x18c2e4={};_0x18c2e4[_0x4936e3]={'$like':'%'+_0x4dd125[_0x4f87('0x31')][_0x4f87('0x3d')]+'%'};return _0x18c2e4;})});}_0x266077=_[_0x4f87('0x3e')]({},_0x266077,_0x4dd125[_0x4f87('0x40')]);return _0x553d48[_0x4f87('0x52')](_0x266077);}})[_0x4f87('0x26')](function(_0x56fb03){if(_0x56fb03){_0x24c1a6=_0x56fb03[_0x4f87('0x36')];if(!_0x4dd125['query'][_0x4f87('0x37')](_0x4f87('0x38'))){_0x266077[_0x4f87('0x1e')]=qs[_0x4f87('0x1e')](_0x4dd125[_0x4f87('0x31')]['limit']);_0x266077[_0x4f87('0x20')]=qs[_0x4f87('0x20')](_0x4dd125[_0x4f87('0x31')][_0x4f87('0x20')]);}return _0x553d48[_0x4f87('0x52')](_0x266077);}})[_0x4f87('0x26')](function(_0x16ad19){if(_0x16ad19){return _0x16ad19?{'count':_0x24c1a6,'rows':_0x16ad19}:null;}})[_0x4f87('0x26')](respondWithResult(_0x142b11,null))[_0x4f87('0x44')](handleError(_0x142b11,null));};exports[_0x4f87('0x53')]=function(_0x336e56,_0x11b211,_0x38d13e){var _0x52478e={};var _0x584073={};var _0x3684c5;var _0x32187c;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x336e56[_0x4f87('0x46')]['id']}})[_0x4f87('0x26')](handleEntityNotFound(_0x11b211,null))[_0x4f87('0x26')](function(_0x2bbf17){if(_0x2bbf17){_0x3684c5=_0x2bbf17;_0x584073['model']=_['keys'](db[_0x4f87('0x54')]['rawAttributes']);_0x584073['query']=_['keys'](_0x336e56['query']);_0x584073[_0x4f87('0x33')]=_['intersection'](_0x584073['model'],_0x584073[_0x4f87('0x31')]);_0x52478e[_0x4f87('0x35')]=_[_0x4f87('0x48')](_0x584073['model'],qs[_0x4f87('0x49')](_0x336e56[_0x4f87('0x31')]['fields']));_0x52478e[_0x4f87('0x35')]=_0x52478e[_0x4f87('0x35')][_0x4f87('0x36')]?_0x52478e['attributes']:_0x584073[_0x4f87('0x34')];_0x52478e['order']=qs[_0x4f87('0x3a')](_0x336e56['query']['sort']);_0x52478e['where']=qs['filters'](_[_0x4f87('0x3c')](_0x336e56[_0x4f87('0x31')],_0x584073[_0x4f87('0x33')]));if(_0x336e56[_0x4f87('0x31')]['filter']){_0x52478e[_0x4f87('0x3b')]=_['merge'](_0x52478e[_0x4f87('0x3b')],{'$or':_[_0x4f87('0x2d')](_0x52478e['attributes'],function(_0x315dc7){var _0x2027c2={};_0x2027c2[_0x315dc7]={'$like':'%'+_0x336e56[_0x4f87('0x31')][_0x4f87('0x3d')]+'%'};return _0x2027c2;})});}_0x52478e=_[_0x4f87('0x3e')]({},_0x52478e,_0x336e56[_0x4f87('0x40')]);return _0x3684c5[_0x4f87('0x53')](_0x52478e);}})['then'](function(_0x53e7ed){if(_0x53e7ed){_0x32187c=_0x53e7ed[_0x4f87('0x36')];if(!_0x336e56[_0x4f87('0x31')][_0x4f87('0x37')](_0x4f87('0x38'))){_0x52478e[_0x4f87('0x1e')]=qs['limit'](_0x336e56[_0x4f87('0x31')][_0x4f87('0x1e')]);_0x52478e[_0x4f87('0x20')]=qs[_0x4f87('0x20')](_0x336e56['query'][_0x4f87('0x20')]);}return _0x3684c5[_0x4f87('0x53')](_0x52478e);}})[_0x4f87('0x26')](function(_0x3a1e20){if(_0x3a1e20){return _0x3a1e20?{'count':_0x32187c,'rows':_0x3a1e20}:null;}})[_0x4f87('0x26')](respondWithResult(_0x11b211,null))['catch'](handleError(_0x11b211,null));};exports[_0x4f87('0x55')]=function(_0x332977,_0x335f2b,_0x11cdb4){if(_0x332977[_0x4f87('0x4d')]['id']){delete _0x332977['body']['id'];}return db['FreshdeskConfiguration'][_0x4f87('0x4e')]({'where':{'id':_0x332977[_0x4f87('0x46')]['id']}})[_0x4f87('0x26')](handleEntityNotFound(_0x335f2b,null))['then'](function(_0x2c4087){if(_0x2c4087){return _0x2c4087[_0x4f87('0x55')](_0x332977['body']['ids']||[]);}return null;})[_0x4f87('0x26')](respondWithResult(_0x335f2b,null))[_0x4f87('0x44')](handleError(_0x335f2b,null));}; \ No newline at end of file +var _0xddd5=['end','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','destroy','sendStatus','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','options','then','includeAll','include','findAll','rows','catch','keys','find','create','body','params','getFields','findOne','FreshdeskField','sort','pick','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0xa3217d,_0x2a621f){var _0x10f6cc=function(_0x2d4b58){while(--_0x2d4b58){_0xa3217d['push'](_0xa3217d['shift']());}};_0x10f6cc(++_0x2a621f);}(_0xddd5,0x179));var _0x5ddd=function(_0x520a2d,_0x1a46d1){_0x520a2d=_0x520a2d-0x0;var _0x24f255=_0xddd5[_0x520a2d];return _0x24f255;};'use strict';var emlformat=require(_0x5ddd('0x0'));var rimraf=require(_0x5ddd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5ddd('0x2'));var moment=require(_0x5ddd('0x3'));var BPromise=require(_0x5ddd('0x4'));var Mustache=require(_0x5ddd('0x5'));var util=require('util');var path=require(_0x5ddd('0x6'));var sox=require(_0x5ddd('0x7'));var csv=require(_0x5ddd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5ddd('0x9'));var _=require(_0x5ddd('0xa'));var squel=require(_0x5ddd('0xb'));var crypto=require(_0x5ddd('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5ddd('0xd'));var authService=require(_0x5ddd('0xe'));var qs=require(_0x5ddd('0xf'));var as=require(_0x5ddd('0x10'));var hardwareService=require(_0x5ddd('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x5ddd('0x12'));var config=require(_0x5ddd('0x13'));var licenseUtil=require(_0x5ddd('0x14'));var db=require(_0x5ddd('0x15'))['db'];function respondWithStatusCode(_0xf573b,_0x512242){_0x512242=_0x512242||0xcc;return function(_0x2591ec){if(_0x2591ec){return _0xf573b['sendStatus'](_0x512242);}return _0xf573b[_0x5ddd('0x16')](_0x512242)[_0x5ddd('0x17')]();};}function respondWithResult(_0x216eea,_0x4465dc){_0x4465dc=_0x4465dc||0xc8;return function(_0x5a1baf){if(_0x5a1baf){return _0x216eea[_0x5ddd('0x16')](_0x4465dc)[_0x5ddd('0x18')](_0x5a1baf);}};}function respondWithFilteredResult(_0x42afdb,_0x11719b){return function(_0x2c24bb){if(_0x2c24bb){var _0x7dc89d=typeof _0x11719b['offset']===_0x5ddd('0x19')&&typeof _0x11719b['limit']===_0x5ddd('0x19');var _0x26d238=_0x2c24bb['count'];var _0xf54f80=_0x7dc89d?0x0:_0x11719b['offset'];var _0x20f818=_0x7dc89d?_0x2c24bb[_0x5ddd('0x1a')]:_0x11719b[_0x5ddd('0x1b')]+_0x11719b[_0x5ddd('0x1c')];var _0x3b464b;if(_0x20f818>=_0x26d238){_0x20f818=_0x26d238;_0x3b464b=0xc8;}else{_0x3b464b=0xce;}_0x42afdb['status'](_0x3b464b);return _0x42afdb[_0x5ddd('0x1d')](_0x5ddd('0x1e'),_0xf54f80+'-'+_0x20f818+'/'+_0x26d238)[_0x5ddd('0x18')](_0x2c24bb);}return null;};}function patchUpdates(_0xf35426){return function(_0x16dbd8){try{jsonpatch['apply'](_0x16dbd8,_0xf35426,!![]);}catch(_0x249ddd){return BPromise[_0x5ddd('0x1f')](_0x249ddd);}return _0x16dbd8[_0x5ddd('0x20')]();};}function saveUpdates(_0x3a432f,_0x81d94f){return function(_0x2010b5){if(_0x2010b5){return _0x2010b5[_0x5ddd('0x21')](_0x3a432f)['then'](function(_0x21dc4f){return _0x21dc4f;});}return null;};}function removeEntity(_0x2cbf70,_0x4d7836){return function(_0x270e06){if(_0x270e06){return _0x270e06[_0x5ddd('0x22')]()['then'](function(){_0x2cbf70[_0x5ddd('0x16')](0xcc)[_0x5ddd('0x17')]();});}};}function handleEntityNotFound(_0x5ae417,_0x5dd8e4){return function(_0x51fc7e){if(!_0x51fc7e){_0x5ae417[_0x5ddd('0x23')](0x194);}return _0x51fc7e;};}function handleError(_0x429026,_0x4826d9){_0x4826d9=_0x4826d9||0x1f4;return function(_0x37418f){logger['error'](_0x37418f[_0x5ddd('0x24')]);if(_0x37418f[_0x5ddd('0x25')]){delete _0x37418f[_0x5ddd('0x25')];}_0x429026[_0x5ddd('0x16')](_0x4826d9)[_0x5ddd('0x26')](_0x37418f);};}exports[_0x5ddd('0x27')]=function(_0x2c9ed6,_0x3d1121){var _0x2072b8={},_0x4f3155={},_0x408aac={'count':0x0,'rows':[]};var _0x72a8bc=_[_0x5ddd('0x28')](db[_0x5ddd('0x29')][_0x5ddd('0x2a')],function(_0x196919){return{'name':_0x196919['fieldName'],'type':_0x196919[_0x5ddd('0x2b')][_0x5ddd('0x2c')]};});_0x4f3155[_0x5ddd('0x2d')]=_[_0x5ddd('0x28')](_0x72a8bc,_0x5ddd('0x25'));_0x4f3155[_0x5ddd('0x2e')]=_['keys'](_0x2c9ed6[_0x5ddd('0x2e')]);_0x4f3155[_0x5ddd('0x2f')]=_[_0x5ddd('0x30')](_0x4f3155[_0x5ddd('0x2d')],_0x4f3155[_0x5ddd('0x2e')]);_0x2072b8[_0x5ddd('0x31')]=_[_0x5ddd('0x30')](_0x4f3155['model'],qs[_0x5ddd('0x32')](_0x2c9ed6['query']['fields']));_0x2072b8['attributes']=_0x2072b8[_0x5ddd('0x31')][_0x5ddd('0x33')]?_0x2072b8[_0x5ddd('0x31')]:_0x4f3155['model'];if(!_0x2c9ed6[_0x5ddd('0x2e')][_0x5ddd('0x34')](_0x5ddd('0x35'))){_0x2072b8[_0x5ddd('0x1c')]=qs[_0x5ddd('0x1c')](_0x2c9ed6[_0x5ddd('0x2e')][_0x5ddd('0x1c')]);_0x2072b8[_0x5ddd('0x1b')]=qs[_0x5ddd('0x1b')](_0x2c9ed6['query']['offset']);}_0x2072b8[_0x5ddd('0x36')]=qs['sort'](_0x2c9ed6[_0x5ddd('0x2e')]['sort']);_0x2072b8[_0x5ddd('0x37')]=qs[_0x5ddd('0x2f')](_['pick'](_0x2c9ed6[_0x5ddd('0x2e')],_0x4f3155[_0x5ddd('0x2f')]),_0x72a8bc);if(_0x2c9ed6[_0x5ddd('0x2e')][_0x5ddd('0x38')]){_0x2072b8[_0x5ddd('0x37')]=_['merge'](_0x2072b8[_0x5ddd('0x37')],{'$or':_[_0x5ddd('0x28')](_0x72a8bc,function(_0x5d614d){if(_0x5d614d[_0x5ddd('0x2b')]!=='VIRTUAL'){var _0x36cc44={};_0x36cc44[_0x5d614d[_0x5ddd('0x25')]]={'$like':'%'+_0x2c9ed6[_0x5ddd('0x2e')][_0x5ddd('0x38')]+'%'};return _0x36cc44;}})});}_0x2072b8=_[_0x5ddd('0x39')]({},_0x2072b8,_0x2c9ed6[_0x5ddd('0x3a')]);var _0x4d7466={'where':_0x2072b8['where']};return db[_0x5ddd('0x29')]['count'](_0x4d7466)[_0x5ddd('0x3b')](function(_0xf2de98){_0x408aac['count']=_0xf2de98;if(_0x2c9ed6[_0x5ddd('0x2e')][_0x5ddd('0x3c')]){_0x2072b8[_0x5ddd('0x3d')]=[{'all':!![]}];}return db[_0x5ddd('0x29')][_0x5ddd('0x3e')](_0x2072b8);})[_0x5ddd('0x3b')](function(_0x419868){_0x408aac[_0x5ddd('0x3f')]=_0x419868;return _0x408aac;})[_0x5ddd('0x3b')](respondWithFilteredResult(_0x3d1121,_0x2072b8))[_0x5ddd('0x40')](handleError(_0x3d1121,null));};exports['show']=function(_0x2483f9,_0x39636d){var _0x593cca={'raw':![],'where':{'id':_0x2483f9['params']['id']}},_0x1b60c3={};_0x1b60c3['model']=_['keys'](db[_0x5ddd('0x29')][_0x5ddd('0x2a')]);_0x1b60c3[_0x5ddd('0x2e')]=_[_0x5ddd('0x41')](_0x2483f9[_0x5ddd('0x2e')]);_0x1b60c3[_0x5ddd('0x2f')]=_['intersection'](_0x1b60c3[_0x5ddd('0x2d')],_0x1b60c3[_0x5ddd('0x2e')]);_0x593cca[_0x5ddd('0x31')]=_[_0x5ddd('0x30')](_0x1b60c3[_0x5ddd('0x2d')],qs[_0x5ddd('0x32')](_0x2483f9[_0x5ddd('0x2e')][_0x5ddd('0x32')]));_0x593cca[_0x5ddd('0x31')]=_0x593cca[_0x5ddd('0x31')]['length']?_0x593cca[_0x5ddd('0x31')]:_0x1b60c3['model'];if(_0x2483f9[_0x5ddd('0x2e')][_0x5ddd('0x3c')]){_0x593cca[_0x5ddd('0x3d')]=[{'all':!![]}];}_0x593cca=_[_0x5ddd('0x39')]({},_0x593cca,_0x2483f9[_0x5ddd('0x3a')]);return db[_0x5ddd('0x29')][_0x5ddd('0x42')](_0x593cca)[_0x5ddd('0x3b')](handleEntityNotFound(_0x39636d,null))[_0x5ddd('0x3b')](respondWithResult(_0x39636d,null))[_0x5ddd('0x40')](handleError(_0x39636d,null));};exports[_0x5ddd('0x43')]=function(_0x5eccaf,_0x1cd033){return db[_0x5ddd('0x29')][_0x5ddd('0x43')](_0x5eccaf['body'],{})['then'](respondWithResult(_0x1cd033,0xc9))['catch'](handleError(_0x1cd033,null));};exports[_0x5ddd('0x21')]=function(_0x383150,_0x3fd8ca){if(_0x383150[_0x5ddd('0x44')]['id']){delete _0x383150[_0x5ddd('0x44')]['id'];}return db[_0x5ddd('0x29')][_0x5ddd('0x42')]({'where':{'id':_0x383150[_0x5ddd('0x45')]['id']}})[_0x5ddd('0x3b')](handleEntityNotFound(_0x3fd8ca,null))[_0x5ddd('0x3b')](saveUpdates(_0x383150[_0x5ddd('0x44')],null))[_0x5ddd('0x3b')](respondWithResult(_0x3fd8ca,null))[_0x5ddd('0x40')](handleError(_0x3fd8ca,null));};exports[_0x5ddd('0x22')]=function(_0x4ee771,_0x5ea7dc){return db[_0x5ddd('0x29')][_0x5ddd('0x42')]({'where':{'id':_0x4ee771['params']['id']}})[_0x5ddd('0x3b')](handleEntityNotFound(_0x5ea7dc,null))[_0x5ddd('0x3b')](removeEntity(_0x5ea7dc,null))['catch'](handleError(_0x5ea7dc,null));};exports[_0x5ddd('0x46')]=function(_0x32f45c,_0x420308,_0x3ff0a2){var _0x42c08e={};var _0x26aaa7={};var _0x3bfea0;var _0x47220e;return db['FreshdeskConfiguration'][_0x5ddd('0x47')]({'where':{'id':_0x32f45c[_0x5ddd('0x45')]['id']}})[_0x5ddd('0x3b')](handleEntityNotFound(_0x420308,null))[_0x5ddd('0x3b')](function(_0x8ccda1){if(_0x8ccda1){_0x3bfea0=_0x8ccda1;_0x26aaa7['model']=_[_0x5ddd('0x41')](db[_0x5ddd('0x48')]['rawAttributes']);_0x26aaa7[_0x5ddd('0x2e')]=_[_0x5ddd('0x41')](_0x32f45c[_0x5ddd('0x2e')]);_0x26aaa7[_0x5ddd('0x2f')]=_[_0x5ddd('0x30')](_0x26aaa7[_0x5ddd('0x2d')],_0x26aaa7[_0x5ddd('0x2e')]);_0x42c08e[_0x5ddd('0x31')]=_[_0x5ddd('0x30')](_0x26aaa7[_0x5ddd('0x2d')],qs[_0x5ddd('0x32')](_0x32f45c[_0x5ddd('0x2e')][_0x5ddd('0x32')]));_0x42c08e[_0x5ddd('0x31')]=_0x42c08e[_0x5ddd('0x31')][_0x5ddd('0x33')]?_0x42c08e['attributes']:_0x26aaa7[_0x5ddd('0x2d')];_0x42c08e['order']=qs[_0x5ddd('0x49')](_0x32f45c[_0x5ddd('0x2e')][_0x5ddd('0x49')]);_0x42c08e[_0x5ddd('0x37')]=qs[_0x5ddd('0x2f')](_[_0x5ddd('0x4a')](_0x32f45c['query'],_0x26aaa7[_0x5ddd('0x2f')]));if(_0x32f45c[_0x5ddd('0x2e')][_0x5ddd('0x38')]){_0x42c08e[_0x5ddd('0x37')]=_['merge'](_0x42c08e[_0x5ddd('0x37')],{'$or':_['map'](_0x42c08e[_0x5ddd('0x31')],function(_0x197796){var _0x2537d5={};_0x2537d5[_0x197796]={'$like':'%'+_0x32f45c[_0x5ddd('0x2e')][_0x5ddd('0x38')]+'%'};return _0x2537d5;})});}_0x42c08e=_[_0x5ddd('0x39')]({},_0x42c08e,_0x32f45c[_0x5ddd('0x3a')]);return _0x3bfea0['getFields'](_0x42c08e);}})[_0x5ddd('0x3b')](function(_0x43976c){if(_0x43976c){_0x47220e=_0x43976c[_0x5ddd('0x33')];if(!_0x32f45c[_0x5ddd('0x2e')]['hasOwnProperty'](_0x5ddd('0x35'))){_0x42c08e[_0x5ddd('0x1c')]=qs['limit'](_0x32f45c[_0x5ddd('0x2e')][_0x5ddd('0x1c')]);_0x42c08e['offset']=qs['offset'](_0x32f45c[_0x5ddd('0x2e')][_0x5ddd('0x1b')]);}return _0x3bfea0[_0x5ddd('0x46')](_0x42c08e);}})[_0x5ddd('0x3b')](function(_0x28a63d){if(_0x28a63d){return _0x28a63d?{'count':_0x47220e,'rows':_0x28a63d}:null;}})[_0x5ddd('0x3b')](respondWithResult(_0x420308,null))[_0x5ddd('0x40')](handleError(_0x420308,null));};exports[_0x5ddd('0x4b')]=function(_0xac3daf,_0x119e05,_0x4ac868){var _0x4f4572={};var _0x224149={};var _0x5159b9;var _0x1e9928;return db['FreshdeskConfiguration'][_0x5ddd('0x47')]({'where':{'id':_0xac3daf[_0x5ddd('0x45')]['id']}})[_0x5ddd('0x3b')](handleEntityNotFound(_0x119e05,null))['then'](function(_0x5a8518){if(_0x5a8518){_0x5159b9=_0x5a8518;_0x224149[_0x5ddd('0x2d')]=_[_0x5ddd('0x41')](db['FreshdeskField'][_0x5ddd('0x2a')]);_0x224149[_0x5ddd('0x2e')]=_[_0x5ddd('0x41')](_0xac3daf[_0x5ddd('0x2e')]);_0x224149[_0x5ddd('0x2f')]=_[_0x5ddd('0x30')](_0x224149[_0x5ddd('0x2d')],_0x224149['query']);_0x4f4572[_0x5ddd('0x31')]=_[_0x5ddd('0x30')](_0x224149[_0x5ddd('0x2d')],qs[_0x5ddd('0x32')](_0xac3daf[_0x5ddd('0x2e')][_0x5ddd('0x32')]));_0x4f4572[_0x5ddd('0x31')]=_0x4f4572[_0x5ddd('0x31')][_0x5ddd('0x33')]?_0x4f4572[_0x5ddd('0x31')]:_0x224149[_0x5ddd('0x2d')];_0x4f4572[_0x5ddd('0x36')]=qs[_0x5ddd('0x49')](_0xac3daf[_0x5ddd('0x2e')][_0x5ddd('0x49')]);_0x4f4572[_0x5ddd('0x37')]=qs['filters'](_[_0x5ddd('0x4a')](_0xac3daf[_0x5ddd('0x2e')],_0x224149[_0x5ddd('0x2f')]));if(_0xac3daf[_0x5ddd('0x2e')]['filter']){_0x4f4572[_0x5ddd('0x37')]=_['merge'](_0x4f4572['where'],{'$or':_[_0x5ddd('0x28')](_0x4f4572['attributes'],function(_0x40ef8f){var _0x51c96a={};_0x51c96a[_0x40ef8f]={'$like':'%'+_0xac3daf[_0x5ddd('0x2e')][_0x5ddd('0x38')]+'%'};return _0x51c96a;})});}_0x4f4572=_[_0x5ddd('0x39')]({},_0x4f4572,_0xac3daf[_0x5ddd('0x3a')]);return _0x5159b9['getSubjects'](_0x4f4572);}})['then'](function(_0x382b8a){if(_0x382b8a){_0x1e9928=_0x382b8a[_0x5ddd('0x33')];if(!_0xac3daf[_0x5ddd('0x2e')][_0x5ddd('0x34')](_0x5ddd('0x35'))){_0x4f4572['limit']=qs[_0x5ddd('0x1c')](_0xac3daf[_0x5ddd('0x2e')][_0x5ddd('0x1c')]);_0x4f4572[_0x5ddd('0x1b')]=qs[_0x5ddd('0x1b')](_0xac3daf[_0x5ddd('0x2e')][_0x5ddd('0x1b')]);}return _0x5159b9['getSubjects'](_0x4f4572);}})[_0x5ddd('0x3b')](function(_0x41b19b){if(_0x41b19b){return _0x41b19b?{'count':_0x1e9928,'rows':_0x41b19b}:null;}})[_0x5ddd('0x3b')](respondWithResult(_0x119e05,null))['catch'](handleError(_0x119e05,null));};exports[_0x5ddd('0x4c')]=function(_0x330b6e,_0xeea34d,_0x1d3070){var _0x101cd3={};var _0xfc9676={};var _0x4c6fed;var _0x35fcfc;return db[_0x5ddd('0x29')][_0x5ddd('0x47')]({'where':{'id':_0x330b6e[_0x5ddd('0x45')]['id']}})[_0x5ddd('0x3b')](handleEntityNotFound(_0xeea34d,null))['then'](function(_0x176189){if(_0x176189){_0x4c6fed=_0x176189;_0xfc9676[_0x5ddd('0x2d')]=_['keys'](db['FreshdeskField']['rawAttributes']);_0xfc9676['query']=_['keys'](_0x330b6e[_0x5ddd('0x2e')]);_0xfc9676[_0x5ddd('0x2f')]=_[_0x5ddd('0x30')](_0xfc9676[_0x5ddd('0x2d')],_0xfc9676[_0x5ddd('0x2e')]);_0x101cd3['attributes']=_[_0x5ddd('0x30')](_0xfc9676['model'],qs['fields'](_0x330b6e[_0x5ddd('0x2e')][_0x5ddd('0x32')]));_0x101cd3[_0x5ddd('0x31')]=_0x101cd3[_0x5ddd('0x31')][_0x5ddd('0x33')]?_0x101cd3[_0x5ddd('0x31')]:_0xfc9676[_0x5ddd('0x2d')];_0x101cd3[_0x5ddd('0x36')]=qs[_0x5ddd('0x49')](_0x330b6e[_0x5ddd('0x2e')][_0x5ddd('0x49')]);_0x101cd3['where']=qs[_0x5ddd('0x2f')](_[_0x5ddd('0x4a')](_0x330b6e[_0x5ddd('0x2e')],_0xfc9676['filters']));if(_0x330b6e[_0x5ddd('0x2e')][_0x5ddd('0x38')]){_0x101cd3[_0x5ddd('0x37')]=_['merge'](_0x101cd3[_0x5ddd('0x37')],{'$or':_['map'](_0x101cd3[_0x5ddd('0x31')],function(_0x1ec9a8){var _0x10db39={};_0x10db39[_0x1ec9a8]={'$like':'%'+_0x330b6e[_0x5ddd('0x2e')]['filter']+'%'};return _0x10db39;})});}_0x101cd3=_[_0x5ddd('0x39')]({},_0x101cd3,_0x330b6e['options']);return _0x4c6fed[_0x5ddd('0x4c')](_0x101cd3);}})[_0x5ddd('0x3b')](function(_0x2742a1){if(_0x2742a1){_0x35fcfc=_0x2742a1[_0x5ddd('0x33')];if(!_0x330b6e['query'][_0x5ddd('0x34')](_0x5ddd('0x35'))){_0x101cd3[_0x5ddd('0x1c')]=qs['limit'](_0x330b6e['query'][_0x5ddd('0x1c')]);_0x101cd3[_0x5ddd('0x1b')]=qs[_0x5ddd('0x1b')](_0x330b6e[_0x5ddd('0x2e')][_0x5ddd('0x1b')]);}return _0x4c6fed[_0x5ddd('0x4c')](_0x101cd3);}})[_0x5ddd('0x3b')](function(_0x19fc20){if(_0x19fc20){return _0x19fc20?{'count':_0x35fcfc,'rows':_0x19fc20}:null;}})[_0x5ddd('0x3b')](respondWithResult(_0xeea34d,null))['catch'](handleError(_0xeea34d,null));};exports['getTags']=function(_0x4edea5,_0x2827fd,_0x14bd06){var _0x3aab51={};var _0x37ed1d={};var _0x286fc6;var _0x87ff8;return db[_0x5ddd('0x29')]['findOne']({'where':{'id':_0x4edea5[_0x5ddd('0x45')]['id']}})[_0x5ddd('0x3b')](handleEntityNotFound(_0x2827fd,null))[_0x5ddd('0x3b')](function(_0x5da029){if(_0x5da029){_0x286fc6=_0x5da029;_0x37ed1d['model']=_[_0x5ddd('0x41')](db['Tag'][_0x5ddd('0x2a')]);_0x37ed1d['query']=_['keys'](_0x4edea5[_0x5ddd('0x2e')]);_0x37ed1d['filters']=_[_0x5ddd('0x30')](_0x37ed1d[_0x5ddd('0x2d')],_0x37ed1d[_0x5ddd('0x2e')]);_0x3aab51['attributes']=_[_0x5ddd('0x30')](_0x37ed1d[_0x5ddd('0x2d')],qs[_0x5ddd('0x32')](_0x4edea5['query'][_0x5ddd('0x32')]));_0x3aab51[_0x5ddd('0x31')]=_0x3aab51[_0x5ddd('0x31')][_0x5ddd('0x33')]?_0x3aab51[_0x5ddd('0x31')]:_0x37ed1d[_0x5ddd('0x2d')];_0x3aab51[_0x5ddd('0x36')]=qs['sort'](_0x4edea5[_0x5ddd('0x2e')][_0x5ddd('0x49')]);_0x3aab51['where']=qs[_0x5ddd('0x2f')](_[_0x5ddd('0x4a')](_0x4edea5[_0x5ddd('0x2e')],_0x37ed1d['filters']));if(_0x4edea5[_0x5ddd('0x2e')]['filter']){_0x3aab51[_0x5ddd('0x37')]=_[_0x5ddd('0x39')](_0x3aab51[_0x5ddd('0x37')],{'$or':_[_0x5ddd('0x28')](_0x3aab51[_0x5ddd('0x31')],function(_0x5dd4da){var _0x27adbf={};_0x27adbf[_0x5dd4da]={'$like':'%'+_0x4edea5[_0x5ddd('0x2e')][_0x5ddd('0x38')]+'%'};return _0x27adbf;})});}_0x3aab51=_[_0x5ddd('0x39')]({},_0x3aab51,_0x4edea5[_0x5ddd('0x3a')]);return _0x286fc6[_0x5ddd('0x4d')](_0x3aab51);}})[_0x5ddd('0x3b')](function(_0x51497d){if(_0x51497d){_0x87ff8=_0x51497d[_0x5ddd('0x33')];if(!_0x4edea5[_0x5ddd('0x2e')][_0x5ddd('0x34')](_0x5ddd('0x35'))){_0x3aab51[_0x5ddd('0x1c')]=qs[_0x5ddd('0x1c')](_0x4edea5[_0x5ddd('0x2e')][_0x5ddd('0x1c')]);_0x3aab51[_0x5ddd('0x1b')]=qs[_0x5ddd('0x1b')](_0x4edea5[_0x5ddd('0x2e')][_0x5ddd('0x1b')]);}return _0x286fc6['getTags'](_0x3aab51);}})[_0x5ddd('0x3b')](function(_0x5ebfd6){if(_0x5ebfd6){return _0x5ebfd6?{'count':_0x87ff8,'rows':_0x5ebfd6}:null;}})[_0x5ddd('0x3b')](respondWithResult(_0x2827fd,null))[_0x5ddd('0x40')](handleError(_0x2827fd,null));};exports[_0x5ddd('0x4e')]=function(_0x316dcc,_0x4465a8,_0x2d1f70){if(_0x316dcc[_0x5ddd('0x44')]['id']){delete _0x316dcc['body']['id'];}return db[_0x5ddd('0x29')]['findOne']({'where':{'id':_0x316dcc['params']['id']}})[_0x5ddd('0x3b')](handleEntityNotFound(_0x4465a8,null))['then'](function(_0x1aa703){if(_0x1aa703){return _0x1aa703['setTags'](_0x316dcc[_0x5ddd('0x44')][_0x5ddd('0x4f')]||[]);}return null;})['then'](respondWithResult(_0x4465a8,null))[_0x5ddd('0x40')](handleError(_0x4465a8,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 6f04ae8..310fce3 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 _0xac5d=['FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define'];(function(_0x42c6f1,_0x338d7b){var _0x3c7398=function(_0x151494){while(--_0x151494){_0x42c6f1['push'](_0x42c6f1['shift']());}};_0x3c7398(++_0x338d7b);}(_0xac5d,0xd2));var _0xdac5=function(_0x8d3262,_0x439e73){_0x8d3262=_0x8d3262-0x0;var _0x45561c=_0xac5d[_0x8d3262];return _0x45561c;};'use strict';var _=require(_0xdac5('0x0'));var util=require(_0xdac5('0x1'));var logger=require(_0xdac5('0x2'))(_0xdac5('0x3'));var moment=require(_0xdac5('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdac5('0x5'));var rimraf=require(_0xdac5('0x6'));var config=require(_0xdac5('0x7'));var attributes=require(_0xdac5('0x8'));module[_0xdac5('0x9')]=function(_0x2ebb77,_0x4e127b){return _0x2ebb77[_0xdac5('0xa')](_0xdac5('0xb'),attributes,{'tableName':_0xdac5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf125=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','int_freshdesk_configurations'];(function(_0x3ff07a,_0x1c4e69){var _0x2e5ce4=function(_0x2bbbab){while(--_0x2bbbab){_0x3ff07a['push'](_0x3ff07a['shift']());}};_0x2e5ce4(++_0x1c4e69);}(_0xf125,0x1d4));var _0x5f12=function(_0x5d0a07,_0x208503){_0x5d0a07=_0x5d0a07-0x0;var _0x1ba0cf=_0xf125[_0x5d0a07];return _0x1ba0cf;};'use strict';var _=require(_0x5f12('0x0'));var util=require(_0x5f12('0x1'));var logger=require(_0x5f12('0x2'))(_0x5f12('0x3'));var moment=require('moment');var BPromise=require(_0x5f12('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5f12('0x5'));var rimraf=require(_0x5f12('0x6'));var config=require(_0x5f12('0x7'));var attributes=require(_0x5f12('0x8'));module['exports']=function(_0x224a0c,_0x1eb63c){return _0x224a0c[_0x5f12('0x9')](_0x5f12('0xa'),attributes,{'tableName':_0x5f12('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 6178124..a3a2a6c 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 _0xebd3=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','moment','bluebird'];(function(_0x3c2fb2,_0x3907fc){var _0x384eba=function(_0x459da4){while(--_0x459da4){_0x3c2fb2['push'](_0x3c2fb2['shift']());}};_0x384eba(++_0x3907fc);}(_0xebd3,0xc4));var _0x3ebd=function(_0x4fc80b,_0xfe1b3d){_0x4fc80b=_0x4fc80b-0x0;var _0x119dba=_0xebd3[_0x4fc80b];return _0x119dba;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3ebd('0x0'));var BPromise=require(_0x3ebd('0x1'));var rs=require(_0x3ebd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3ebd('0x3'))['db'];var utils=require(_0x3ebd('0x4'));var logger=require(_0x3ebd('0x5'))(_0x3ebd('0x6'));var config=require(_0x3ebd('0x7'));var jayson=require(_0x3ebd('0x8'));var client=jayson[_0x3ebd('0x9')][_0x3ebd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe26fb0,_0x5ab284,_0xd7844b){return new BPromise(function(_0x47d70e,_0x54e00c){return client['request'](_0xe26fb0,_0xd7844b)[_0x3ebd('0xb')](function(_0x152a3e){logger[_0x3ebd('0xc')](_0x3ebd('0xd'),_0x5ab284,_0x3ebd('0xe'));logger[_0x3ebd('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x5ab284,_0x3ebd('0xe'),JSON[_0x3ebd('0x10')](_0x152a3e));if(_0x152a3e[_0x3ebd('0x11')]){if(_0x152a3e[_0x3ebd('0x11')][_0x3ebd('0x12')]===0x1f4){logger[_0x3ebd('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x5ab284,_0x152a3e[_0x3ebd('0x11')][_0x3ebd('0x13')]);return _0x54e00c(_0x152a3e[_0x3ebd('0x11')][_0x3ebd('0x13')]);}logger[_0x3ebd('0x11')](_0x3ebd('0xd'),_0x5ab284,_0x152a3e['error'][_0x3ebd('0x13')]);return _0x47d70e(_0x152a3e[_0x3ebd('0x11')][_0x3ebd('0x13')]);}else{logger[_0x3ebd('0xc')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x5ab284,'request\x20sent');_0x47d70e(_0x152a3e[_0x3ebd('0x14')][_0x3ebd('0x13')]);}})[_0x3ebd('0x15')](function(_0x2235d7){logger['error'](_0x3ebd('0xd'),_0x5ab284,_0x2235d7);_0x54e00c(_0x2235d7);});});} \ No newline at end of file +var _0xca2f=['../../config/environment','jayson/promise','client','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xca2f,0x19d));var _0xfca2=function(_0x3100c9,_0xb6d7ed){_0x3100c9=_0x3100c9-0x0;var _0x39b483=_0xca2f[_0x3100c9];return _0x39b483;};'use strict';var _=require(_0xfca2('0x0'));var util=require(_0xfca2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfca2('0x2'));var fs=require('fs');var Redis=require(_0xfca2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfca2('0x4'));var logger=require(_0xfca2('0x5'))(_0xfca2('0x6'));var config=require(_0xfca2('0x7'));var jayson=require(_0xfca2('0x8'));var client=jayson[_0xfca2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6a2f0f,_0xb16461,_0x180b81){return new BPromise(function(_0xd829de,_0x292218){return client[_0xfca2('0xa')](_0x6a2f0f,_0x180b81)[_0xfca2('0xb')](function(_0x266f23){logger[_0xfca2('0xc')](_0xfca2('0xd'),_0xb16461,_0xfca2('0xe'));logger[_0xfca2('0xf')](_0xfca2('0x10'),_0xb16461,_0xfca2('0xe'),JSON['stringify'](_0x266f23));if(_0x266f23[_0xfca2('0x11')]){if(_0x266f23[_0xfca2('0x11')][_0xfca2('0x12')]===0x1f4){logger['error'](_0xfca2('0xd'),_0xb16461,_0x266f23[_0xfca2('0x11')][_0xfca2('0x13')]);return _0x292218(_0x266f23[_0xfca2('0x11')][_0xfca2('0x13')]);}logger[_0xfca2('0x11')](_0xfca2('0xd'),_0xb16461,_0x266f23[_0xfca2('0x11')][_0xfca2('0x13')]);return _0xd829de(_0x266f23[_0xfca2('0x11')][_0xfca2('0x13')]);}else{logger[_0xfca2('0xc')](_0xfca2('0xd'),_0xb16461,_0xfca2('0xe'));_0xd829de(_0x266f23[_0xfca2('0x14')]['message']);}})['catch'](function(_0x5804d5){logger['error'](_0xfca2('0xd'),_0xb16461,_0x5804d5);_0x292218(_0x5804d5);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 8ef1f87..bd88770 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 _0xaf69=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x2c90cb,_0x3a0747){var _0x23e1b4=function(_0x5e8e4b){while(--_0x5e8e4b){_0x2c90cb['push'](_0x2c90cb['shift']());}};_0x23e1b4(++_0x3a0747);}(_0xaf69,0x17f));var _0x9af6=function(_0x45a7cf,_0x18fb0b){_0x45a7cf=_0x45a7cf-0x0;var _0x5a7bc6=_0xaf69[_0x45a7cf];return _0x5a7bc6;};'use strict';var multer=require(_0x9af6('0x0'));var util=require(_0x9af6('0x1'));var path=require(_0x9af6('0x2'));var timeout=require(_0x9af6('0x3'));var express=require(_0x9af6('0x4'));var router=express[_0x9af6('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9af6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9af6('0x7'));var controller=require(_0x9af6('0x8'));router[_0x9af6('0x9')]('/',auth[_0x9af6('0xa')](),controller[_0x9af6('0xb')]);router[_0x9af6('0x9')](_0x9af6('0xc'),auth['isAuthenticated'](),controller[_0x9af6('0xd')]);router[_0x9af6('0xe')]('/',auth[_0x9af6('0xa')](),controller[_0x9af6('0xf')]);router[_0x9af6('0x10')](_0x9af6('0xc'),auth[_0x9af6('0xa')](),controller[_0x9af6('0x11')]);router[_0x9af6('0x12')]('/:id',auth[_0x9af6('0xa')](),controller[_0x9af6('0x13')]);module[_0x9af6('0x14')]=router; \ No newline at end of file +var _0x1878=['../../components/interaction/service','./intFreshdeskField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','fs-extra','../../components/auth/service'];(function(_0x532a2c,_0xba730e){var _0x125d20=function(_0x5cfe6e){while(--_0x5cfe6e){_0x532a2c['push'](_0x532a2c['shift']());}};_0x125d20(++_0xba730e);}(_0x1878,0xea));var _0x8187=function(_0x678bd0,_0x4faa71){_0x678bd0=_0x678bd0-0x0;var _0xdf99e1=_0x1878[_0x678bd0];return _0xdf99e1;};'use strict';var multer=require(_0x8187('0x0'));var util=require(_0x8187('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x8187('0x2'));var auth=require(_0x8187('0x3'));var interaction=require(_0x8187('0x4'));var config=require('../../config/environment');var controller=require(_0x8187('0x5'));router[_0x8187('0x6')]('/',auth[_0x8187('0x7')](),controller['index']);router[_0x8187('0x6')](_0x8187('0x8'),auth[_0x8187('0x7')](),controller[_0x8187('0x9')]);router[_0x8187('0xa')]('/',auth[_0x8187('0x7')](),controller[_0x8187('0xb')]);router[_0x8187('0xc')]('/:id',auth[_0x8187('0x7')](),controller[_0x8187('0xd')]);router[_0x8187('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x8187('0xf')]);module[_0x8187('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index d19b219..425f5d7 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 _0xbe23=['variable','picklist','STRING','ENUM','customVariable','BOOLEAN','sequelize','exports','string'];(function(_0x1502fb,_0x5f29e6){var _0xc155c5=function(_0x4c8a1d){while(--_0x4c8a1d){_0x1502fb['push'](_0x1502fb['shift']());}};_0xc155c5(++_0x5f29e6);}(_0xbe23,0x9f));var _0x3be2=function(_0x3ba200,_0x1c4d38){_0x3ba200=_0x3ba200-0x0;var _0x5dd4b8=_0xbe23[_0x3ba200];return _0x5dd4b8;};'use strict';var Sequelize=require(_0x3be2('0x0'));module[_0x3be2('0x1')]={'type':{'type':Sequelize['ENUM'](_0x3be2('0x2'),_0x3be2('0x3'),'customVariable','keyValue',_0x3be2('0x4')),'defaultValue':_0x3be2('0x2')},'content':{'type':Sequelize[_0x3be2('0x5')]},'key':{'type':Sequelize[_0x3be2('0x5')]},'keyType':{'type':Sequelize[_0x3be2('0x6')]('string',_0x3be2('0x3'),_0x3be2('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x3be2('0x5')]},'nameField':{'type':Sequelize[_0x3be2('0x5')]},'customField':{'type':Sequelize[_0x3be2('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3be2('0x5')]}}; \ No newline at end of file +var _0x5ffc=['ENUM','string','variable','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5ffc,0x96));var _0xc5ff=function(_0x99250c,_0x4603c0){_0x99250c=_0x99250c-0x0;var _0x3927d5=_0x5ffc[_0x99250c];return _0x3927d5;};'use strict';var Sequelize=require(_0xc5ff('0x0'));module[_0xc5ff('0x1')]={'type':{'type':Sequelize[_0xc5ff('0x2')](_0xc5ff('0x3'),_0xc5ff('0x4'),'customVariable','keyValue',_0xc5ff('0x5')),'defaultValue':_0xc5ff('0x3')},'content':{'type':Sequelize[_0xc5ff('0x6')]},'key':{'type':Sequelize[_0xc5ff('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xc5ff('0x3'),_0xc5ff('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xc5ff('0x6')]},'idField':{'type':Sequelize[_0xc5ff('0x6')]},'nameField':{'type':Sequelize[_0xc5ff('0x6')]},'customField':{'type':Sequelize[_0xc5ff('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc5ff('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index f0cb1d9..80bfc9d 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 _0x6ae2=['lodash','squel','crypto','jsforce','desk.js','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','Content-Range','apply','then','destroy','error','name','index','map','FreshdeskField','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','show','params','find','catch','create','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv'];(function(_0x1b25c2,_0x41458e){var _0x4bb2be=function(_0x42fda6){while(--_0x42fda6){_0x1b25c2['push'](_0x1b25c2['shift']());}};_0x4bb2be(++_0x41458e);}(_0x6ae2,0x1ed));var _0x26ae=function(_0x1b246e,_0x664f50){_0x1b246e=_0x1b246e-0x0;var _0x9801dc=_0x6ae2[_0x1b246e];return _0x9801dc;};'use strict';var emlformat=require(_0x26ae('0x0'));var rimraf=require(_0x26ae('0x1'));var zipdir=require(_0x26ae('0x2'));var jsonpatch=require(_0x26ae('0x3'));var rp=require(_0x26ae('0x4'));var moment=require(_0x26ae('0x5'));var BPromise=require(_0x26ae('0x6'));var Mustache=require(_0x26ae('0x7'));var util=require(_0x26ae('0x8'));var path=require('path');var sox=require(_0x26ae('0x9'));var csv=require(_0x26ae('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x26ae('0xb'));var squel=require(_0x26ae('0xc'));var crypto=require(_0x26ae('0xd'));var jsforce=require(_0x26ae('0xe'));var deskjs=require(_0x26ae('0xf'));var toCsv=require(_0x26ae('0xa'));var querystring=require(_0x26ae('0x10'));var Papa=require(_0x26ae('0x11'));var Redis=require(_0x26ae('0x12'));var authService=require(_0x26ae('0x13'));var qs=require(_0x26ae('0x14'));var as=require(_0x26ae('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x26ae('0x16'))('api');var utils=require(_0x26ae('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x26ae('0x18'))['db'];function respondWithStatusCode(_0x46bc2,_0x21811d){_0x21811d=_0x21811d||0xcc;return function(_0x17f9a6){if(_0x17f9a6){return _0x46bc2[_0x26ae('0x19')](_0x21811d);}return _0x46bc2[_0x26ae('0x1a')](_0x21811d)[_0x26ae('0x1b')]();};}function respondWithResult(_0x1c66b8,_0x2390a7){_0x2390a7=_0x2390a7||0xc8;return function(_0x52d611){if(_0x52d611){return _0x1c66b8[_0x26ae('0x1a')](_0x2390a7)[_0x26ae('0x1c')](_0x52d611);}};}function respondWithFilteredResult(_0x4e5c4e,_0x15d055){return function(_0x32cd9e){if(_0x32cd9e){var _0x497974=typeof _0x15d055[_0x26ae('0x1d')]===_0x26ae('0x1e')&&typeof _0x15d055[_0x26ae('0x1f')]===_0x26ae('0x1e');var _0x13ad43=_0x32cd9e[_0x26ae('0x20')];var _0x250dc0=_0x497974?0x0:_0x15d055[_0x26ae('0x1d')];var _0x28584c=_0x497974?_0x32cd9e[_0x26ae('0x20')]:_0x15d055[_0x26ae('0x1d')]+_0x15d055[_0x26ae('0x1f')];var _0x38102c;if(_0x28584c>=_0x13ad43){_0x28584c=_0x13ad43;_0x38102c=0xc8;}else{_0x38102c=0xce;}_0x4e5c4e[_0x26ae('0x1a')](_0x38102c);return _0x4e5c4e[_0x26ae('0x21')](_0x26ae('0x22'),_0x250dc0+'-'+_0x28584c+'/'+_0x13ad43)[_0x26ae('0x1c')](_0x32cd9e);}return null;};}function patchUpdates(_0xdfcd69){return function(_0x22d535){try{jsonpatch[_0x26ae('0x23')](_0x22d535,_0xdfcd69,!![]);}catch(_0x334153){return BPromise['reject'](_0x334153);}return _0x22d535['save']();};}function saveUpdates(_0x2a2ba5,_0x5d72dc){return function(_0x22c47b){if(_0x22c47b){return _0x22c47b['update'](_0x2a2ba5)[_0x26ae('0x24')](function(_0x2e34d1){return _0x2e34d1;});}return null;};}function removeEntity(_0x19f641,_0x57062e){return function(_0x4ab3f1){if(_0x4ab3f1){return _0x4ab3f1[_0x26ae('0x25')]()[_0x26ae('0x24')](function(){_0x19f641[_0x26ae('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2caf20,_0x295cc2){return function(_0x53e0da){if(!_0x53e0da){_0x2caf20[_0x26ae('0x19')](0x194);}return _0x53e0da;};}function handleError(_0x2658ed,_0x19eacc){_0x19eacc=_0x19eacc||0x1f4;return function(_0x4a0045){logger[_0x26ae('0x26')](_0x4a0045['stack']);if(_0x4a0045[_0x26ae('0x27')]){delete _0x4a0045[_0x26ae('0x27')];}_0x2658ed[_0x26ae('0x1a')](_0x19eacc)['send'](_0x4a0045);};}exports[_0x26ae('0x28')]=function(_0x5a8301,_0x4cddc4){var _0x2f2e9d={},_0x2fcc89={},_0x5979ec={'count':0x0,'rows':[]};var _0x5308c=_[_0x26ae('0x29')](db[_0x26ae('0x2a')][_0x26ae('0x2b')],function(_0x2d8cac){return{'name':_0x2d8cac['fieldName'],'type':_0x2d8cac[_0x26ae('0x2c')][_0x26ae('0x2d')]};});_0x2fcc89[_0x26ae('0x2e')]=_[_0x26ae('0x29')](_0x5308c,_0x26ae('0x27'));_0x2fcc89['query']=_[_0x26ae('0x2f')](_0x5a8301[_0x26ae('0x30')]);_0x2fcc89[_0x26ae('0x31')]=_[_0x26ae('0x32')](_0x2fcc89[_0x26ae('0x2e')],_0x2fcc89[_0x26ae('0x30')]);_0x2f2e9d[_0x26ae('0x33')]=_[_0x26ae('0x32')](_0x2fcc89['model'],qs[_0x26ae('0x34')](_0x5a8301['query']['fields']));_0x2f2e9d[_0x26ae('0x33')]=_0x2f2e9d[_0x26ae('0x33')][_0x26ae('0x35')]?_0x2f2e9d['attributes']:_0x2fcc89[_0x26ae('0x2e')];if(!_0x5a8301[_0x26ae('0x30')][_0x26ae('0x36')](_0x26ae('0x37'))){_0x2f2e9d[_0x26ae('0x1f')]=qs[_0x26ae('0x1f')](_0x5a8301[_0x26ae('0x30')][_0x26ae('0x1f')]);_0x2f2e9d[_0x26ae('0x1d')]=qs[_0x26ae('0x1d')](_0x5a8301[_0x26ae('0x30')][_0x26ae('0x1d')]);}_0x2f2e9d[_0x26ae('0x38')]=qs[_0x26ae('0x39')](_0x5a8301['query'][_0x26ae('0x39')]);_0x2f2e9d[_0x26ae('0x3a')]=qs[_0x26ae('0x31')](_['pick'](_0x5a8301[_0x26ae('0x30')],_0x2fcc89[_0x26ae('0x31')]),_0x5308c);if(_0x5a8301[_0x26ae('0x30')][_0x26ae('0x3b')]){_0x2f2e9d[_0x26ae('0x3a')]=_['merge'](_0x2f2e9d[_0x26ae('0x3a')],{'$or':_[_0x26ae('0x29')](_0x5308c,function(_0x49eb68){if(_0x49eb68[_0x26ae('0x2c')]!==_0x26ae('0x3c')){var _0x11586b={};_0x11586b[_0x49eb68['name']]={'$like':'%'+_0x5a8301['query']['filter']+'%'};return _0x11586b;}})});}_0x2f2e9d=_[_0x26ae('0x3d')]({},_0x2f2e9d,_0x5a8301[_0x26ae('0x3e')]);var _0x607968={'where':_0x2f2e9d[_0x26ae('0x3a')]};return db[_0x26ae('0x2a')]['count'](_0x607968)[_0x26ae('0x24')](function(_0x3fd0ef){_0x5979ec[_0x26ae('0x20')]=_0x3fd0ef;if(_0x5a8301[_0x26ae('0x30')][_0x26ae('0x3f')]){_0x2f2e9d[_0x26ae('0x40')]=[{'all':!![]}];}return db[_0x26ae('0x2a')]['findAll'](_0x2f2e9d);})[_0x26ae('0x24')](function(_0x7d041f){_0x5979ec['rows']=_0x7d041f;return _0x5979ec;})[_0x26ae('0x24')](respondWithFilteredResult(_0x4cddc4,_0x2f2e9d))['catch'](handleError(_0x4cddc4,null));};exports[_0x26ae('0x41')]=function(_0x150bf1,_0x92a7d8){var _0x5e0369={'raw':!![],'where':{'id':_0x150bf1[_0x26ae('0x42')]['id']}},_0x2a0797={};_0x2a0797[_0x26ae('0x2e')]=_[_0x26ae('0x2f')](db[_0x26ae('0x2a')][_0x26ae('0x2b')]);_0x2a0797['query']=_['keys'](_0x150bf1['query']);_0x2a0797[_0x26ae('0x31')]=_[_0x26ae('0x32')](_0x2a0797[_0x26ae('0x2e')],_0x2a0797[_0x26ae('0x30')]);_0x5e0369[_0x26ae('0x33')]=_['intersection'](_0x2a0797['model'],qs[_0x26ae('0x34')](_0x150bf1[_0x26ae('0x30')][_0x26ae('0x34')]));_0x5e0369['attributes']=_0x5e0369[_0x26ae('0x33')]['length']?_0x5e0369[_0x26ae('0x33')]:_0x2a0797[_0x26ae('0x2e')];if(_0x150bf1['query']['includeAll']){_0x5e0369[_0x26ae('0x40')]=[{'all':!![]}];}_0x5e0369=_['merge']({},_0x5e0369,_0x150bf1[_0x26ae('0x3e')]);return db[_0x26ae('0x2a')][_0x26ae('0x43')](_0x5e0369)[_0x26ae('0x24')](handleEntityNotFound(_0x92a7d8,null))[_0x26ae('0x24')](respondWithResult(_0x92a7d8,null))[_0x26ae('0x44')](handleError(_0x92a7d8,null));};exports[_0x26ae('0x45')]=function(_0x3484cb,_0x21a623){return db[_0x26ae('0x2a')][_0x26ae('0x45')](_0x3484cb['body'],{})[_0x26ae('0x24')](respondWithResult(_0x21a623,0xc9))[_0x26ae('0x44')](handleError(_0x21a623,null));};exports[_0x26ae('0x46')]=function(_0x1fe641,_0x3e56bb){if(_0x1fe641[_0x26ae('0x47')]['id']){delete _0x1fe641[_0x26ae('0x47')]['id'];}return db[_0x26ae('0x2a')][_0x26ae('0x43')]({'where':{'id':_0x1fe641[_0x26ae('0x42')]['id']}})[_0x26ae('0x24')](handleEntityNotFound(_0x3e56bb,null))[_0x26ae('0x24')](saveUpdates(_0x1fe641[_0x26ae('0x47')],null))['then'](respondWithResult(_0x3e56bb,null))[_0x26ae('0x44')](handleError(_0x3e56bb,null));};exports['destroy']=function(_0x3dd581,_0x23e6be){return db[_0x26ae('0x2a')][_0x26ae('0x43')]({'where':{'id':_0x3dd581[_0x26ae('0x42')]['id']}})[_0x26ae('0x24')](handleEntityNotFound(_0x23e6be,null))['then'](removeEntity(_0x23e6be,null))[_0x26ae('0x44')](handleError(_0x23e6be,null));}; \ No newline at end of file +var _0x823c=['reject','save','update','destroy','then','end','error','name','send','index','map','FreshdeskField','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','keys','filters','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','undefined','limit','count','offset','Content-Range','json','apply'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x823c,0x143));var _0xc823=function(_0x476020,_0x1f7ed0){_0x476020=_0x476020-0x0;var _0x7e9424=_0x823c[_0x476020];return _0x7e9424;};'use strict';var emlformat=require(_0xc823('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc823('0x1'));var jsonpatch=require(_0xc823('0x2'));var rp=require(_0xc823('0x3'));var moment=require(_0xc823('0x4'));var BPromise=require(_0xc823('0x5'));var Mustache=require(_0xc823('0x6'));var util=require('util');var path=require(_0xc823('0x7'));var sox=require(_0xc823('0x8'));var csv=require(_0xc823('0x9'));var ejs=require(_0xc823('0xa'));var fs=require('fs');var fs_extra=require(_0xc823('0xb'));var _=require('lodash');var squel=require(_0xc823('0xc'));var crypto=require(_0xc823('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc823('0x9'));var querystring=require(_0xc823('0xe'));var Papa=require('papaparse');var Redis=require(_0xc823('0xf'));var authService=require(_0xc823('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc823('0x11'));var logger=require(_0xc823('0x12'))(_0xc823('0x13'));var utils=require(_0xc823('0x14'));var config=require(_0xc823('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc823('0x16'))['db'];function respondWithStatusCode(_0x80372,_0x11c0fd){_0x11c0fd=_0x11c0fd||0xcc;return function(_0x1546b9){if(_0x1546b9){return _0x80372[_0xc823('0x17')](_0x11c0fd);}return _0x80372[_0xc823('0x18')](_0x11c0fd)['end']();};}function respondWithResult(_0x1e4425,_0xff0ec2){_0xff0ec2=_0xff0ec2||0xc8;return function(_0x4daac9){if(_0x4daac9){return _0x1e4425[_0xc823('0x18')](_0xff0ec2)['json'](_0x4daac9);}};}function respondWithFilteredResult(_0x4bc9c9,_0x59749d){return function(_0x5bdfc9){if(_0x5bdfc9){var _0x565aeb=typeof _0x59749d['offset']===_0xc823('0x19')&&typeof _0x59749d[_0xc823('0x1a')]===_0xc823('0x19');var _0x2ff583=_0x5bdfc9[_0xc823('0x1b')];var _0x1aca6d=_0x565aeb?0x0:_0x59749d[_0xc823('0x1c')];var _0x58b7c7=_0x565aeb?_0x5bdfc9[_0xc823('0x1b')]:_0x59749d['offset']+_0x59749d[_0xc823('0x1a')];var _0x3aa68f;if(_0x58b7c7>=_0x2ff583){_0x58b7c7=_0x2ff583;_0x3aa68f=0xc8;}else{_0x3aa68f=0xce;}_0x4bc9c9[_0xc823('0x18')](_0x3aa68f);return _0x4bc9c9['set'](_0xc823('0x1d'),_0x1aca6d+'-'+_0x58b7c7+'/'+_0x2ff583)[_0xc823('0x1e')](_0x5bdfc9);}return null;};}function patchUpdates(_0x3a3fcd){return function(_0x599e59){try{jsonpatch[_0xc823('0x1f')](_0x599e59,_0x3a3fcd,!![]);}catch(_0x325c8a){return BPromise[_0xc823('0x20')](_0x325c8a);}return _0x599e59[_0xc823('0x21')]();};}function saveUpdates(_0x574c76,_0x414c86){return function(_0x5dcb4e){if(_0x5dcb4e){return _0x5dcb4e[_0xc823('0x22')](_0x574c76)['then'](function(_0x510460){return _0x510460;});}return null;};}function removeEntity(_0x3af14f,_0x3cead8){return function(_0x52c941){if(_0x52c941){return _0x52c941[_0xc823('0x23')]()[_0xc823('0x24')](function(){_0x3af14f[_0xc823('0x18')](0xcc)[_0xc823('0x25')]();});}};}function handleEntityNotFound(_0x263865,_0x8d6161){return function(_0x19594e){if(!_0x19594e){_0x263865[_0xc823('0x17')](0x194);}return _0x19594e;};}function handleError(_0x14bd7d,_0x26bb81){_0x26bb81=_0x26bb81||0x1f4;return function(_0x4e4bd4){logger[_0xc823('0x26')](_0x4e4bd4['stack']);if(_0x4e4bd4['name']){delete _0x4e4bd4[_0xc823('0x27')];}_0x14bd7d[_0xc823('0x18')](_0x26bb81)[_0xc823('0x28')](_0x4e4bd4);};}exports[_0xc823('0x29')]=function(_0x20d2b1,_0x182fcf){var _0x1d20c6={},_0xa5a380={},_0x12f061={'count':0x0,'rows':[]};var _0xba0f46=_[_0xc823('0x2a')](db[_0xc823('0x2b')][_0xc823('0x2c')],function(_0xda39a3){return{'name':_0xda39a3[_0xc823('0x2d')],'type':_0xda39a3['type'][_0xc823('0x2e')]};});_0xa5a380[_0xc823('0x2f')]=_[_0xc823('0x2a')](_0xba0f46,_0xc823('0x27'));_0xa5a380[_0xc823('0x30')]=_['keys'](_0x20d2b1['query']);_0xa5a380['filters']=_[_0xc823('0x31')](_0xa5a380[_0xc823('0x2f')],_0xa5a380[_0xc823('0x30')]);_0x1d20c6[_0xc823('0x32')]=_['intersection'](_0xa5a380[_0xc823('0x2f')],qs[_0xc823('0x33')](_0x20d2b1[_0xc823('0x30')][_0xc823('0x33')]));_0x1d20c6[_0xc823('0x32')]=_0x1d20c6[_0xc823('0x32')][_0xc823('0x34')]?_0x1d20c6[_0xc823('0x32')]:_0xa5a380[_0xc823('0x2f')];if(!_0x20d2b1[_0xc823('0x30')][_0xc823('0x35')](_0xc823('0x36'))){_0x1d20c6[_0xc823('0x1a')]=qs['limit'](_0x20d2b1[_0xc823('0x30')][_0xc823('0x1a')]);_0x1d20c6[_0xc823('0x1c')]=qs[_0xc823('0x1c')](_0x20d2b1[_0xc823('0x30')][_0xc823('0x1c')]);}_0x1d20c6['order']=qs[_0xc823('0x37')](_0x20d2b1[_0xc823('0x30')]['sort']);_0x1d20c6[_0xc823('0x38')]=qs['filters'](_[_0xc823('0x39')](_0x20d2b1[_0xc823('0x30')],_0xa5a380['filters']),_0xba0f46);if(_0x20d2b1[_0xc823('0x30')][_0xc823('0x3a')]){_0x1d20c6[_0xc823('0x38')]=_[_0xc823('0x3b')](_0x1d20c6[_0xc823('0x38')],{'$or':_[_0xc823('0x2a')](_0xba0f46,function(_0x1fb5a4){if(_0x1fb5a4['type']!=='VIRTUAL'){var _0x48decd={};_0x48decd[_0x1fb5a4[_0xc823('0x27')]]={'$like':'%'+_0x20d2b1[_0xc823('0x30')][_0xc823('0x3a')]+'%'};return _0x48decd;}})});}_0x1d20c6=_[_0xc823('0x3b')]({},_0x1d20c6,_0x20d2b1[_0xc823('0x3c')]);var _0x5d547f={'where':_0x1d20c6[_0xc823('0x38')]};return db[_0xc823('0x2b')][_0xc823('0x1b')](_0x5d547f)[_0xc823('0x24')](function(_0x5d6e9b){_0x12f061['count']=_0x5d6e9b;if(_0x20d2b1['query'][_0xc823('0x3d')]){_0x1d20c6[_0xc823('0x3e')]=[{'all':!![]}];}return db[_0xc823('0x2b')]['findAll'](_0x1d20c6);})[_0xc823('0x24')](function(_0x4aa160){_0x12f061[_0xc823('0x3f')]=_0x4aa160;return _0x12f061;})[_0xc823('0x24')](respondWithFilteredResult(_0x182fcf,_0x1d20c6))[_0xc823('0x40')](handleError(_0x182fcf,null));};exports[_0xc823('0x41')]=function(_0x337541,_0x26a2f2){var _0x46daca={'raw':!![],'where':{'id':_0x337541[_0xc823('0x42')]['id']}},_0x521e47={};_0x521e47['model']=_[_0xc823('0x43')](db[_0xc823('0x2b')][_0xc823('0x2c')]);_0x521e47[_0xc823('0x30')]=_[_0xc823('0x43')](_0x337541[_0xc823('0x30')]);_0x521e47[_0xc823('0x44')]=_[_0xc823('0x31')](_0x521e47['model'],_0x521e47[_0xc823('0x30')]);_0x46daca[_0xc823('0x32')]=_['intersection'](_0x521e47[_0xc823('0x2f')],qs[_0xc823('0x33')](_0x337541[_0xc823('0x30')][_0xc823('0x33')]));_0x46daca[_0xc823('0x32')]=_0x46daca[_0xc823('0x32')][_0xc823('0x34')]?_0x46daca[_0xc823('0x32')]:_0x521e47[_0xc823('0x2f')];if(_0x337541['query'][_0xc823('0x3d')]){_0x46daca[_0xc823('0x3e')]=[{'all':!![]}];}_0x46daca=_['merge']({},_0x46daca,_0x337541[_0xc823('0x3c')]);return db[_0xc823('0x2b')]['find'](_0x46daca)[_0xc823('0x24')](handleEntityNotFound(_0x26a2f2,null))['then'](respondWithResult(_0x26a2f2,null))[_0xc823('0x40')](handleError(_0x26a2f2,null));};exports[_0xc823('0x45')]=function(_0x57f4c0,_0x5e999d){return db[_0xc823('0x2b')][_0xc823('0x45')](_0x57f4c0[_0xc823('0x46')],{})[_0xc823('0x24')](respondWithResult(_0x5e999d,0xc9))[_0xc823('0x40')](handleError(_0x5e999d,null));};exports[_0xc823('0x22')]=function(_0x190a72,_0x1ae82d){if(_0x190a72['body']['id']){delete _0x190a72[_0xc823('0x46')]['id'];}return db[_0xc823('0x2b')]['find']({'where':{'id':_0x190a72['params']['id']}})[_0xc823('0x24')](handleEntityNotFound(_0x1ae82d,null))['then'](saveUpdates(_0x190a72['body'],null))['then'](respondWithResult(_0x1ae82d,null))['catch'](handleError(_0x1ae82d,null));};exports['destroy']=function(_0x511d71,_0x8f742d){return db['FreshdeskField']['find']({'where':{'id':_0x511d71[_0xc823('0x42')]['id']}})['then'](handleEntityNotFound(_0x8f742d,null))[_0xc823('0x24')](removeEntity(_0x8f742d,null))[_0xc823('0x40')](handleError(_0x8f742d,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index bd343bc..9f83866 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 _0xc47c=['../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','freshdesk_unique_index','idField','FieldId','moment','request-promise','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc47c,0xe0));var _0xcc47=function(_0x2b778d,_0x5dd9e4){_0x2b778d=_0x2b778d-0x0;var _0x46a581=_0xc47c[_0x2b778d];return _0x46a581;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xcc47('0x0'));var BPromise=require('bluebird');var rp=require(_0xcc47('0x1'));var fs=require('fs');var path=require(_0xcc47('0x2'));var rimraf=require(_0xcc47('0x3'));var config=require(_0xcc47('0x4'));var attributes=require(_0xcc47('0x5'));module[_0xcc47('0x6')]=function(_0x462acf,_0x5e52b0){return _0x462acf[_0xcc47('0x7')](_0xcc47('0x8'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0xcc47('0x9'),'fields':[_0xcc47('0xa'),_0xcc47('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc932=['FieldId','lodash','api','request-promise','path','exports','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index'];(function(_0x59ee58,_0x478012){var _0x9c675c=function(_0x4cf3cd){while(--_0x4cf3cd){_0x59ee58['push'](_0x59ee58['shift']());}};_0x9c675c(++_0x478012);}(_0xc932,0x18d));var _0x2c93=function(_0x340380,_0x4bd2a8){_0x340380=_0x340380-0x0;var _0x49ce1c=_0xc932[_0x340380];return _0x49ce1c;};'use strict';var _=require(_0x2c93('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2c93('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2c93('0x2'));var fs=require('fs');var path=require(_0x2c93('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intFreshdeskField.attributes');module[_0x2c93('0x4')]=function(_0x4258e9,_0x3fd3fa){return _0x4258e9['define'](_0x2c93('0x5'),attributes,{'tableName':_0x2c93('0x6'),'paranoid':![],'indexes':[{'name':_0x2c93('0x7'),'fields':['idField',_0x2c93('0x8')],'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 6b37514..ab13f06 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 _0x66ac=['debug','stringify','error','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent'];(function(_0x3c9f6a,_0x2f62d6){var _0x461a80=function(_0x4f0005){while(--_0x4f0005){_0x3c9f6a['push'](_0x3c9f6a['shift']());}};_0x461a80(++_0x2f62d6);}(_0x66ac,0xd8));var _0xc66a=function(_0xd29520,_0x3e7c02){_0xd29520=_0xd29520-0x0;var _0x2b15b5=_0x66ac[_0xd29520];return _0x2b15b5;};'use strict';var _=require(_0xc66a('0x0'));var util=require(_0xc66a('0x1'));var moment=require(_0xc66a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc66a('0x3'));var db=require(_0xc66a('0x4'))['db'];var utils=require(_0xc66a('0x5'));var logger=require(_0xc66a('0x6'))(_0xc66a('0x7'));var config=require(_0xc66a('0x8'));var jayson=require(_0xc66a('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1d9392,_0x3c267f,_0x4421fc){return new BPromise(function(_0x41270a,_0x5948a7){return client[_0xc66a('0xa')](_0x1d9392,_0x4421fc)[_0xc66a('0xb')](function(_0x50e343){logger[_0xc66a('0xc')](_0xc66a('0xd'),_0x3c267f,_0xc66a('0xe'));logger[_0xc66a('0xf')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x3c267f,_0xc66a('0xe'),JSON[_0xc66a('0x10')](_0x50e343));if(_0x50e343['error']){if(_0x50e343[_0xc66a('0x11')]['code']===0x1f4){logger[_0xc66a('0x11')](_0xc66a('0xd'),_0x3c267f,_0x50e343['error'][_0xc66a('0x12')]);return _0x5948a7(_0x50e343[_0xc66a('0x11')][_0xc66a('0x12')]);}logger[_0xc66a('0x11')](_0xc66a('0xd'),_0x3c267f,_0x50e343[_0xc66a('0x11')][_0xc66a('0x12')]);return _0x41270a(_0x50e343[_0xc66a('0x11')][_0xc66a('0x12')]);}else{logger[_0xc66a('0xc')]('FreshdeskField,\x20%s,\x20%s',_0x3c267f,_0xc66a('0xe'));_0x41270a(_0x50e343[_0xc66a('0x13')][_0xc66a('0x12')]);}})[_0xc66a('0x14')](function(_0x6fa1cc){logger[_0xc66a('0x11')](_0xc66a('0xd'),_0x3c267f,_0x6fa1cc);_0x5948a7(_0x6fa1cc);});});} \ No newline at end of file +var _0xfb72=['../../config/environment','jayson/promise','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3f25b2,_0x412bd4){var _0xd8caeb=function(_0x52d252){while(--_0x52d252){_0x3f25b2['push'](_0x3f25b2['shift']());}};_0xd8caeb(++_0x412bd4);}(_0xfb72,0xb6));var _0x2fb7=function(_0x5e551d,_0x221082){_0x5e551d=_0x5e551d-0x0;var _0x552c34=_0xfb72[_0x5e551d];return _0x552c34;};'use strict';var _=require(_0x2fb7('0x0'));var util=require(_0x2fb7('0x1'));var moment=require('moment');var BPromise=require(_0x2fb7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2fb7('0x3'))['db'];var utils=require(_0x2fb7('0x4'));var logger=require(_0x2fb7('0x5'))(_0x2fb7('0x6'));var config=require(_0x2fb7('0x7'));var jayson=require(_0x2fb7('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x44c767,_0x2fd5a3,_0xcdcdd6){return new BPromise(function(_0x36360b,_0x27087e){return client[_0x2fb7('0x9')](_0x44c767,_0xcdcdd6)[_0x2fb7('0xa')](function(_0x1e5995){logger[_0x2fb7('0xb')](_0x2fb7('0xc'),_0x2fd5a3,_0x2fb7('0xd'));logger[_0x2fb7('0xe')](_0x2fb7('0xf'),_0x2fd5a3,_0x2fb7('0xd'),JSON['stringify'](_0x1e5995));if(_0x1e5995[_0x2fb7('0x10')]){if(_0x1e5995[_0x2fb7('0x10')][_0x2fb7('0x11')]===0x1f4){logger[_0x2fb7('0x10')]('FreshdeskField,\x20%s,\x20%s',_0x2fd5a3,_0x1e5995[_0x2fb7('0x10')][_0x2fb7('0x12')]);return _0x27087e(_0x1e5995['error'][_0x2fb7('0x12')]);}logger['error'](_0x2fb7('0xc'),_0x2fd5a3,_0x1e5995['error'][_0x2fb7('0x12')]);return _0x36360b(_0x1e5995[_0x2fb7('0x10')][_0x2fb7('0x12')]);}else{logger[_0x2fb7('0xb')](_0x2fb7('0xc'),_0x2fd5a3,_0x2fb7('0xd'));_0x36360b(_0x1e5995[_0x2fb7('0x13')]['message']);}})[_0x2fb7('0x14')](function(_0x518be7){logger[_0x2fb7('0x10')](_0x2fb7('0xc'),_0x2fd5a3,_0x518be7);_0x27087e(_0x518be7);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 84ee482..cd588f9 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 _0xf290=['destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update'];(function(_0x502b81,_0x62df38){var _0x2dbe5b=function(_0x1b1f11){while(--_0x1b1f11){_0x502b81['push'](_0x502b81['shift']());}};_0x2dbe5b(++_0x62df38);}(_0xf290,0xde));var _0x0f29=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xf290[_0xfae23b];return _0x200640;};'use strict';var multer=require('multer');var util=require(_0x0f29('0x0'));var path=require('path');var timeout=require(_0x0f29('0x1'));var express=require('express');var router=express[_0x0f29('0x2')]();var fs_extra=require(_0x0f29('0x3'));var auth=require(_0x0f29('0x4'));var interaction=require(_0x0f29('0x5'));var config=require(_0x0f29('0x6'));var controller=require('./intFreshsalesAccount.controller');router[_0x0f29('0x7')]('/',auth['isAuthenticated'](),controller[_0x0f29('0x8')]);router[_0x0f29('0x7')](_0x0f29('0x9'),auth[_0x0f29('0xa')](),controller[_0x0f29('0xb')]);router[_0x0f29('0x7')](_0x0f29('0xc'),auth[_0x0f29('0xa')](),controller[_0x0f29('0xd')]);router[_0x0f29('0x7')](_0x0f29('0xe'),auth[_0x0f29('0xa')](),controller[_0x0f29('0xf')]);router[_0x0f29('0x10')]('/',auth[_0x0f29('0xa')](),controller['create']);router[_0x0f29('0x10')]('/:id/configurations',auth[_0x0f29('0xa')](),controller[_0x0f29('0x11')]);router[_0x0f29('0x12')](_0x0f29('0x9'),auth[_0x0f29('0xa')](),controller[_0x0f29('0x13')]);router['delete'](_0x0f29('0x9'),auth[_0x0f29('0xa')](),controller[_0x0f29('0x14')]);module[_0x0f29('0x15')]=router; \ No newline at end of file +var _0xb7e7=['put','update','exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','index','get','/:id','show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields','post','create','addConfiguration'];(function(_0x47761d,_0x3f8494){var _0x3d1c05=function(_0x3571da){while(--_0x3571da){_0x47761d['push'](_0x47761d['shift']());}};_0x3d1c05(++_0x3f8494);}(_0xb7e7,0x121));var _0x7b7e=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0xb7e7[_0x50aa2e];return _0x5e07f0;};'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')](),controller[_0x7b7e('0x11')]);router[_0x7b7e('0x10')](_0x7b7e('0xb'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x12')]);router[_0x7b7e('0x13')]('/:id',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x14')]);router['delete'](_0x7b7e('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x7b7e('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 8b08bac..9a2f521 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 _0x0424=['username','STRING'];(function(_0x190417,_0x54dc0d){var _0x110e9c=function(_0x517b86){while(--_0x517b86){_0x190417['push'](_0x190417['shift']());}};_0x110e9c(++_0x54dc0d);}(_0x0424,0x159));var _0x4042=function(_0x1304c6,_0x6bb485){_0x1304c6=_0x1304c6-0x0;var _0x2e6654=_0x0424[_0x1304c6];return _0x2e6654;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4042('0x0')]},'description':{'type':Sequelize[_0x4042('0x0')]},'username':{'type':Sequelize[_0x4042('0x0')],'unique':_0x4042('0x1')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x4042('0x0')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xc2c7=['exports','STRING','username','remoteUri'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0xc2c7,0x134));var _0x7c2c=function(_0x18e517,_0x409538){_0x18e517=_0x18e517-0x0;var _0xf263a1=_0xc2c7[_0x18e517];return _0xf263a1;};'use strict';var Sequelize=require('sequelize');module[_0x7c2c('0x0')]={'name':{'type':Sequelize[_0x7c2c('0x1')]},'description':{'type':Sequelize[_0x7c2c('0x1')]},'username':{'type':Sequelize[_0x7c2c('0x1')],'unique':_0x7c2c('0x2')},'apiKey':{'type':Sequelize[_0x7c2c('0x1')]},'remoteUri':{'type':Sequelize[_0x7c2c('0x1')],'unique':_0x7c2c('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 2af7a93..14cd9fa 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 _0x83ae=['nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','length','includeAll','find','create','update','body','params','findOne','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshsalesConfiguration','FreshsalesField','getFields','username','remoteUri','apiKey','slice','lastIndexOf','format','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','reject','then','destroy','error','stack','name','send','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x11ba83,_0xd5611a){var _0x3f3925=function(_0x3d7cb0){while(--_0x3d7cb0){_0x11ba83['push'](_0x11ba83['shift']());}};_0x3f3925(++_0xd5611a);}(_0x83ae,0x15b));var _0xe83a=function(_0x99ec6b,_0x2b4abd){_0x99ec6b=_0x99ec6b-0x0;var _0x196cfd=_0x83ae[_0x99ec6b];return _0x196cfd;};'use strict';var emlformat=require(_0xe83a('0x0'));var rimraf=require(_0xe83a('0x1'));var zipdir=require(_0xe83a('0x2'));var jsonpatch=require(_0xe83a('0x3'));var rp=require(_0xe83a('0x4'));var moment=require(_0xe83a('0x5'));var BPromise=require(_0xe83a('0x6'));var Mustache=require('mustache');var util=require(_0xe83a('0x7'));var path=require(_0xe83a('0x8'));var sox=require(_0xe83a('0x9'));var csv=require(_0xe83a('0xa'));var ejs=require(_0xe83a('0xb'));var fs=require('fs');var fs_extra=require(_0xe83a('0xc'));var _=require('lodash');var squel=require(_0xe83a('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe83a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe83a('0xf'));var Papa=require(_0xe83a('0x10'));var Redis=require(_0xe83a('0x11'));var authService=require(_0xe83a('0x12'));var qs=require(_0xe83a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe83a('0x14'))(_0xe83a('0x15'));var utils=require('../../config/utils');var config=require(_0xe83a('0x16'));var licenseUtil=require(_0xe83a('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xe83a('0x18'));function respondWithStatusCode(_0x3c6fad,_0x18cc2d){_0x18cc2d=_0x18cc2d||0xcc;return function(_0x396dbd){if(_0x396dbd){return _0x3c6fad[_0xe83a('0x19')](_0x18cc2d);}return _0x3c6fad['status'](_0x18cc2d)[_0xe83a('0x1a')]();};}function respondWithResult(_0x491029,_0x4f0c60){_0x4f0c60=_0x4f0c60||0xc8;return function(_0x4caf37){if(_0x4caf37){return _0x491029[_0xe83a('0x1b')](_0x4f0c60)[_0xe83a('0x1c')](_0x4caf37);}};}function respondWithFilteredResult(_0x22d6be,_0x401827){return function(_0x30bca6){if(_0x30bca6){var _0x3e2d2e=typeof _0x401827[_0xe83a('0x1d')]===_0xe83a('0x1e')&&typeof _0x401827[_0xe83a('0x1f')]==='undefined';var _0x48164f=_0x30bca6[_0xe83a('0x20')];var _0x4754a6=_0x3e2d2e?0x0:_0x401827['offset'];var _0x50a199=_0x3e2d2e?_0x30bca6[_0xe83a('0x20')]:_0x401827[_0xe83a('0x1d')]+_0x401827[_0xe83a('0x1f')];var _0x40a3ce;if(_0x50a199>=_0x48164f){_0x50a199=_0x48164f;_0x40a3ce=0xc8;}else{_0x40a3ce=0xce;}_0x22d6be['status'](_0x40a3ce);return _0x22d6be['set']('Content-Range',_0x4754a6+'-'+_0x50a199+'/'+_0x48164f)[_0xe83a('0x1c')](_0x30bca6);}return null;};}function patchUpdates(_0x131c4d){return function(_0x4ed73e){try{jsonpatch['apply'](_0x4ed73e,_0x131c4d,!![]);}catch(_0x557d2c){return BPromise[_0xe83a('0x21')](_0x557d2c);}return _0x4ed73e['save']();};}function saveUpdates(_0x2a10b4,_0x4363a3){return function(_0x1f8b19){if(_0x1f8b19){return _0x1f8b19['update'](_0x2a10b4)[_0xe83a('0x22')](function(_0x31d828){return _0x31d828;});}return null;};}function removeEntity(_0x16e7fd,_0x5233c3){return function(_0x356780){if(_0x356780){return _0x356780[_0xe83a('0x23')]()[_0xe83a('0x22')](function(){_0x16e7fd[_0xe83a('0x1b')](0xcc)[_0xe83a('0x1a')]();});}};}function handleEntityNotFound(_0x2a1748,_0x3bf50b){return function(_0x46e96d){if(!_0x46e96d){_0x2a1748['sendStatus'](0x194);}return _0x46e96d;};}function handleError(_0x1423c0,_0x21f246){_0x21f246=_0x21f246||0x1f4;return function(_0x101b92){logger[_0xe83a('0x24')](_0x101b92[_0xe83a('0x25')]);if(_0x101b92[_0xe83a('0x26')]){delete _0x101b92[_0xe83a('0x26')];}_0x1423c0[_0xe83a('0x1b')](_0x21f246)[_0xe83a('0x27')](_0x101b92);};}exports['index']=function(_0x21dace,_0x458c5e){var _0x393d72={},_0x11b5ba={},_0x5cc749={'count':0x0,'rows':[]};var _0x22c3fe=_[_0xe83a('0x28')](db[_0xe83a('0x29')][_0xe83a('0x2a')],function(_0x3d864e){return{'name':_0x3d864e[_0xe83a('0x2b')],'type':_0x3d864e[_0xe83a('0x2c')][_0xe83a('0x2d')]};});_0x11b5ba[_0xe83a('0x2e')]=_[_0xe83a('0x28')](_0x22c3fe,_0xe83a('0x26'));_0x11b5ba[_0xe83a('0x2f')]=_[_0xe83a('0x30')](_0x21dace[_0xe83a('0x2f')]);_0x11b5ba[_0xe83a('0x31')]=_[_0xe83a('0x32')](_0x11b5ba[_0xe83a('0x2e')],_0x11b5ba['query']);_0x393d72[_0xe83a('0x33')]=_['intersection'](_0x11b5ba[_0xe83a('0x2e')],qs[_0xe83a('0x34')](_0x21dace[_0xe83a('0x2f')][_0xe83a('0x34')]));_0x393d72['attributes']=_0x393d72[_0xe83a('0x33')]['length']?_0x393d72[_0xe83a('0x33')]:_0x11b5ba[_0xe83a('0x2e')];if(!_0x21dace[_0xe83a('0x2f')]['hasOwnProperty'](_0xe83a('0x35'))){_0x393d72[_0xe83a('0x1f')]=qs[_0xe83a('0x1f')](_0x21dace['query'][_0xe83a('0x1f')]);_0x393d72[_0xe83a('0x1d')]=qs['offset'](_0x21dace[_0xe83a('0x2f')][_0xe83a('0x1d')]);}_0x393d72[_0xe83a('0x36')]=qs[_0xe83a('0x37')](_0x21dace[_0xe83a('0x2f')]['sort']);_0x393d72[_0xe83a('0x38')]=qs[_0xe83a('0x31')](_[_0xe83a('0x39')](_0x21dace[_0xe83a('0x2f')],_0x11b5ba['filters']),_0x22c3fe);if(_0x21dace[_0xe83a('0x2f')][_0xe83a('0x3a')]){_0x393d72[_0xe83a('0x38')]=_[_0xe83a('0x3b')](_0x393d72[_0xe83a('0x38')],{'$or':_[_0xe83a('0x28')](_0x22c3fe,function(_0x3ac6ee){if(_0x3ac6ee['type']!==_0xe83a('0x3c')){var _0x39b44f={};_0x39b44f[_0x3ac6ee[_0xe83a('0x26')]]={'$like':'%'+_0x21dace[_0xe83a('0x2f')][_0xe83a('0x3a')]+'%'};return _0x39b44f;}})});}_0x393d72=_[_0xe83a('0x3b')]({},_0x393d72,_0x21dace[_0xe83a('0x3d')]);var _0xdf1e88={'where':_0x393d72[_0xe83a('0x38')]};return db[_0xe83a('0x29')]['count'](_0xdf1e88)[_0xe83a('0x22')](function(_0x39cfd1){_0x5cc749[_0xe83a('0x20')]=_0x39cfd1;if(_0x21dace[_0xe83a('0x2f')]['includeAll']){_0x393d72[_0xe83a('0x3e')]=[{'all':!![]}];}return db[_0xe83a('0x29')][_0xe83a('0x3f')](_0x393d72);})['then'](function(_0xd53328){_0x5cc749[_0xe83a('0x40')]=_0xd53328;return _0x5cc749;})[_0xe83a('0x22')](respondWithFilteredResult(_0x458c5e,_0x393d72))[_0xe83a('0x41')](handleError(_0x458c5e,null));};exports['show']=function(_0x145369,_0x25d17e){var _0x397582={'raw':![],'where':{'id':_0x145369['params']['id']}},_0x34825f={};_0x34825f[_0xe83a('0x2e')]=_[_0xe83a('0x30')](db[_0xe83a('0x29')][_0xe83a('0x2a')]);_0x34825f[_0xe83a('0x2f')]=_['keys'](_0x145369['query']);_0x34825f[_0xe83a('0x31')]=_[_0xe83a('0x32')](_0x34825f[_0xe83a('0x2e')],_0x34825f['query']);_0x397582['attributes']=_[_0xe83a('0x32')](_0x34825f[_0xe83a('0x2e')],qs[_0xe83a('0x34')](_0x145369[_0xe83a('0x2f')]['fields']));_0x397582[_0xe83a('0x33')]=_0x397582[_0xe83a('0x33')][_0xe83a('0x42')]?_0x397582[_0xe83a('0x33')]:_0x34825f[_0xe83a('0x2e')];if(_0x145369[_0xe83a('0x2f')][_0xe83a('0x43')]){_0x397582[_0xe83a('0x3e')]=[{'all':!![]}];}_0x397582=_[_0xe83a('0x3b')]({},_0x397582,_0x145369[_0xe83a('0x3d')]);return db[_0xe83a('0x29')][_0xe83a('0x44')](_0x397582)['then'](handleEntityNotFound(_0x25d17e,null))[_0xe83a('0x22')](respondWithResult(_0x25d17e,null))[_0xe83a('0x41')](handleError(_0x25d17e,null));};exports[_0xe83a('0x45')]=function(_0x5d16ca,_0x538970){return db[_0xe83a('0x29')][_0xe83a('0x45')](_0x5d16ca['body'],{})[_0xe83a('0x22')](respondWithResult(_0x538970,0xc9))[_0xe83a('0x41')](handleError(_0x538970,null));};exports[_0xe83a('0x46')]=function(_0x1468f7,_0x583ef3){if(_0x1468f7['body']['id']){delete _0x1468f7[_0xe83a('0x47')]['id'];}return db[_0xe83a('0x29')][_0xe83a('0x44')]({'where':{'id':_0x1468f7[_0xe83a('0x48')]['id']}})[_0xe83a('0x22')](handleEntityNotFound(_0x583ef3,null))[_0xe83a('0x22')](saveUpdates(_0x1468f7[_0xe83a('0x47')],null))['then'](respondWithResult(_0x583ef3,null))[_0xe83a('0x41')](handleError(_0x583ef3,null));};exports['destroy']=function(_0x589f0d,_0x260f9e){return db['FreshsalesAccount'][_0xe83a('0x44')]({'where':{'id':_0x589f0d[_0xe83a('0x48')]['id']}})[_0xe83a('0x22')](handleEntityNotFound(_0x260f9e,null))[_0xe83a('0x22')](removeEntity(_0x260f9e,null))[_0xe83a('0x41')](handleError(_0x260f9e,null));};exports['getConfigurations']=function(_0x904a90,_0x56c917,_0x54e4b3){var _0x4b5d0b={};var _0xae5694={};var _0x293952;var _0x19d5d3;return db[_0xe83a('0x29')][_0xe83a('0x49')]({'where':{'id':_0x904a90[_0xe83a('0x48')]['id']}})['then'](handleEntityNotFound(_0x56c917,null))[_0xe83a('0x22')](function(_0x29dfd0){if(_0x29dfd0){_0x293952=_0x29dfd0;_0xae5694['model']=_['keys'](db['FreshsalesConfiguration']['rawAttributes']);_0xae5694[_0xe83a('0x2f')]=_['keys'](_0x904a90['query']);_0xae5694[_0xe83a('0x31')]=_[_0xe83a('0x32')](_0xae5694['model'],_0xae5694[_0xe83a('0x2f')]);_0x4b5d0b[_0xe83a('0x33')]=_['intersection'](_0xae5694[_0xe83a('0x2e')],qs[_0xe83a('0x34')](_0x904a90[_0xe83a('0x2f')][_0xe83a('0x34')]));_0x4b5d0b['attributes']=_0x4b5d0b[_0xe83a('0x33')][_0xe83a('0x42')]?_0x4b5d0b[_0xe83a('0x33')]:_0xae5694[_0xe83a('0x2e')];_0x4b5d0b['order']=qs[_0xe83a('0x37')](_0x904a90['query'][_0xe83a('0x37')]);_0x4b5d0b['where']=qs[_0xe83a('0x31')](_['pick'](_0x904a90[_0xe83a('0x2f')],_0xae5694['filters']));if(_0x904a90['query']['filter']){_0x4b5d0b[_0xe83a('0x38')]=_[_0xe83a('0x3b')](_0x4b5d0b[_0xe83a('0x38')],{'$or':_['map'](_0x4b5d0b[_0xe83a('0x33')],function(_0x1b95d1){var _0x162753={};_0x162753[_0x1b95d1]={'$like':'%'+_0x904a90[_0xe83a('0x2f')]['filter']+'%'};return _0x162753;})});}_0x4b5d0b=_[_0xe83a('0x3b')]({},_0x4b5d0b,_0x904a90[_0xe83a('0x3d')]);return _0x293952[_0xe83a('0x4a')](_0x4b5d0b);}})[_0xe83a('0x22')](function(_0x451526){if(_0x451526){_0x19d5d3=_0x451526[_0xe83a('0x42')];if(!_0x904a90[_0xe83a('0x2f')][_0xe83a('0x4b')](_0xe83a('0x35'))){_0x4b5d0b[_0xe83a('0x1f')]=qs['limit'](_0x904a90[_0xe83a('0x2f')]['limit']);_0x4b5d0b[_0xe83a('0x1d')]=qs['offset'](_0x904a90['query']['offset']);}return _0x293952['getConfigurations'](_0x4b5d0b);}})[_0xe83a('0x22')](function(_0x2d59d4){if(_0x2d59d4){return _0x2d59d4?{'count':_0x19d5d3,'rows':_0x2d59d4}:null;}})[_0xe83a('0x22')](respondWithResult(_0x56c917,null))[_0xe83a('0x41')](handleError(_0x56c917,null));};exports[_0xe83a('0x4c')]=function(_0xa7998a,_0x4fc225,_0x1802e4){if(_0xa7998a[_0xe83a('0x47')]['id']){delete _0xa7998a['body']['id'];}return db[_0xe83a('0x29')][_0xe83a('0x49')]({'where':{'id':_0xa7998a[_0xe83a('0x48')]['id']}})[_0xe83a('0x22')](handleEntityNotFound(_0x4fc225,null))['then'](function(_0x3d64fc){if(_0x3d64fc){_0xa7998a[_0xe83a('0x47')][_0xe83a('0x4d')]=_0x3d64fc['id'];_0xa7998a[_0xe83a('0x47')][_0xe83a('0x4e')]=integrations[_0xe83a('0x4f')](_0xa7998a[_0xe83a('0x47')]['channel'],_0xa7998a[_0xe83a('0x47')][_0xe83a('0x2c')]);_0xa7998a[_0xe83a('0x47')][_0xe83a('0x50')]=integrations[_0xe83a('0x51')](_0xa7998a[_0xe83a('0x47')][_0xe83a('0x52')],_0xa7998a[_0xe83a('0x47')][_0xe83a('0x2c')]);return db[_0xe83a('0x53')]['create'](_0xa7998a[_0xe83a('0x47')],{'include':[{'model':db[_0xe83a('0x54')],'as':_0xe83a('0x4e')},{'model':db[_0xe83a('0x54')],'as':_0xe83a('0x50')}]});}return null;})[_0xe83a('0x22')](respondWithResult(_0x4fc225,null))[_0xe83a('0x41')](handleError(_0x4fc225,null));};exports[_0xe83a('0x55')]=function(_0x9d5bf,_0x55da9f,_0x265f4f){var _0x3b7fd6='';var _0xb1decd='';return db[_0xe83a('0x29')][_0xe83a('0x49')]({'where':{'id':_0x9d5bf[_0xe83a('0x48')]['id']},'attributes':['id',_0xe83a('0x56'),_0xe83a('0x57'),_0xe83a('0x58')]})['then'](handleEntityNotFound(_0x55da9f,null))[_0xe83a('0x22')](function(_0x31c127){if(_0x31c127){_0xb1decd=_0x31c127[_0xe83a('0x56')];_0x3b7fd6=_0x31c127[_0xe83a('0x57')];var _0x5c9abe=_0x31c127[_0xe83a('0x57')][_0xe83a('0x59')](-0x1);if(_0x5c9abe==='/'){_0x3b7fd6=_0x3b7fd6['substring'](0x0,_0x3b7fd6[_0xe83a('0x5a')](_0x5c9abe));}return rp({'method':'GET','uri':util[_0xe83a('0x5b')]('%s%s',_0x3b7fd6,_0xe83a('0x5c')),'headers':{'Authorization':_0xe83a('0x5d')+_0x31c127['apiKey']},'json':!![]});}})[_0xe83a('0x22')](function(_0x50ccb4){if(_0x50ccb4){var _0x33ff3d=_0x50ccb4[_0xe83a('0x5e')];var _0x3fd689=![];var _0x1e92d4=null;for(_0x1e92d4=0x0;_0x1e92d4<_0x33ff3d[_0xe83a('0x42')];_0x1e92d4++){if(_0x33ff3d[_0x1e92d4][_0xe83a('0x5f')]===_0xb1decd){_0x3fd689=!![];}}if(_0x3fd689){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xe83a('0x60')});}}})['then'](respondWithResult(_0x55da9f,null))[_0xe83a('0x41')](function(_0x51f8cf){var _0x59d8ce=_0x9d5bf[_0xe83a('0x2f')][_0xe83a('0x61')]?0x1f4:_0x51f8cf['statusCode']||0x1f4;logger[_0xe83a('0x24')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x59d8ce,JSON['stringify'](_0x51f8cf));delete _0x51f8cf[_0xe83a('0x26')];if(_0x59d8ce===0x191){_0x59d8ce=0x190;}_0x55da9f[_0xe83a('0x1b')](_0x59d8ce)[_0xe83a('0x27')](_0x9d5bf[_0xe83a('0x2f')]['test']?{'message':_0xe83a('0x62'),'statusCode':_0x51f8cf[_0xe83a('0x63')]}:_0x51f8cf);});}; \ No newline at end of file +var _0xa7de=['destroy','sendStatus','error','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','rows','catch','params','includeAll','find','create','body','getConfigurations','FreshsalesConfiguration','nolimit','addConfiguration','findOne','AccountId','getDescriptions','Subjects','Descriptions','getFields','username','remoteUri','apiKey','substring','lastIndexOf','format','%s%s','/api/selector/owners','users','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then'];(function(_0x11a8d8,_0x293a57){var _0x211a52=function(_0xc9740d){while(--_0xc9740d){_0x11a8d8['push'](_0x11a8d8['shift']());}};_0x211a52(++_0x293a57);}(_0xa7de,0x103));var _0xea7d=function(_0x23c038,_0x1685ba){_0x23c038=_0x23c038-0x0;var _0x2d5beb=_0xa7de[_0x23c038];return _0x2d5beb;};'use strict';var emlformat=require(_0xea7d('0x0'));var rimraf=require(_0xea7d('0x1'));var zipdir=require(_0xea7d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xea7d('0x3'));var moment=require('moment');var BPromise=require(_0xea7d('0x4'));var Mustache=require(_0xea7d('0x5'));var util=require(_0xea7d('0x6'));var path=require(_0xea7d('0x7'));var sox=require('sox');var csv=require(_0xea7d('0x8'));var ejs=require(_0xea7d('0x9'));var fs=require('fs');var fs_extra=require(_0xea7d('0xa'));var _=require(_0xea7d('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xea7d('0xc'));var toCsv=require('to-csv');var querystring=require(_0xea7d('0xd'));var Papa=require(_0xea7d('0xe'));var Redis=require(_0xea7d('0xf'));var authService=require(_0xea7d('0x10'));var qs=require(_0xea7d('0x11'));var as=require(_0xea7d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xea7d('0x13'))(_0xea7d('0x14'));var utils=require(_0xea7d('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xea7d('0x16'));var db=require(_0xea7d('0x17'))['db'];var integrations=require(_0xea7d('0x18'));function respondWithStatusCode(_0x2a75f9,_0x475903){_0x475903=_0x475903||0xcc;return function(_0x155640){if(_0x155640){return _0x2a75f9['sendStatus'](_0x475903);}return _0x2a75f9[_0xea7d('0x19')](_0x475903)[_0xea7d('0x1a')]();};}function respondWithResult(_0x1945a8,_0x3f385d){_0x3f385d=_0x3f385d||0xc8;return function(_0x569e7a){if(_0x569e7a){return _0x1945a8['status'](_0x3f385d)[_0xea7d('0x1b')](_0x569e7a);}};}function respondWithFilteredResult(_0x47fa42,_0x4b0fcd){return function(_0x4c9110){if(_0x4c9110){var _0x14c9a3=typeof _0x4b0fcd[_0xea7d('0x1c')]===_0xea7d('0x1d')&&typeof _0x4b0fcd[_0xea7d('0x1e')]==='undefined';var _0x8c2e36=_0x4c9110['count'];var _0x40cf1c=_0x14c9a3?0x0:_0x4b0fcd[_0xea7d('0x1c')];var _0x3278bc=_0x14c9a3?_0x4c9110[_0xea7d('0x1f')]:_0x4b0fcd[_0xea7d('0x1c')]+_0x4b0fcd['limit'];var _0x28f5f2;if(_0x3278bc>=_0x8c2e36){_0x3278bc=_0x8c2e36;_0x28f5f2=0xc8;}else{_0x28f5f2=0xce;}_0x47fa42[_0xea7d('0x19')](_0x28f5f2);return _0x47fa42[_0xea7d('0x20')](_0xea7d('0x21'),_0x40cf1c+'-'+_0x3278bc+'/'+_0x8c2e36)[_0xea7d('0x1b')](_0x4c9110);}return null;};}function patchUpdates(_0x2e5101){return function(_0x5f25f0){try{jsonpatch[_0xea7d('0x22')](_0x5f25f0,_0x2e5101,!![]);}catch(_0xf7e11e){return BPromise['reject'](_0xf7e11e);}return _0x5f25f0[_0xea7d('0x23')]();};}function saveUpdates(_0x286664,_0x2b44d8){return function(_0x411398){if(_0x411398){return _0x411398[_0xea7d('0x24')](_0x286664)[_0xea7d('0x25')](function(_0x27547e){return _0x27547e;});}return null;};}function removeEntity(_0xfd6b98,_0x449455){return function(_0x1a4838){if(_0x1a4838){return _0x1a4838[_0xea7d('0x26')]()['then'](function(){_0xfd6b98[_0xea7d('0x19')](0xcc)[_0xea7d('0x1a')]();});}};}function handleEntityNotFound(_0x564aee,_0x1eb288){return function(_0x29df5f){if(!_0x29df5f){_0x564aee[_0xea7d('0x27')](0x194);}return _0x29df5f;};}function handleError(_0x46b875,_0x377f3a){_0x377f3a=_0x377f3a||0x1f4;return function(_0x5bb913){logger[_0xea7d('0x28')](_0x5bb913[_0xea7d('0x29')]);if(_0x5bb913[_0xea7d('0x2a')]){delete _0x5bb913['name'];}_0x46b875[_0xea7d('0x19')](_0x377f3a)[_0xea7d('0x2b')](_0x5bb913);};}exports[_0xea7d('0x2c')]=function(_0x41c7bf,_0x566d8b){var _0x5b1e4d={},_0x59e6a9={},_0x2ebd6a={'count':0x0,'rows':[]};var _0x34a854=_[_0xea7d('0x2d')](db[_0xea7d('0x2e')][_0xea7d('0x2f')],function(_0x235a75){return{'name':_0x235a75[_0xea7d('0x30')],'type':_0x235a75[_0xea7d('0x31')][_0xea7d('0x32')]};});_0x59e6a9[_0xea7d('0x33')]=_['map'](_0x34a854,_0xea7d('0x2a'));_0x59e6a9[_0xea7d('0x34')]=_[_0xea7d('0x35')](_0x41c7bf[_0xea7d('0x34')]);_0x59e6a9[_0xea7d('0x36')]=_[_0xea7d('0x37')](_0x59e6a9[_0xea7d('0x33')],_0x59e6a9[_0xea7d('0x34')]);_0x5b1e4d['attributes']=_[_0xea7d('0x37')](_0x59e6a9[_0xea7d('0x33')],qs['fields'](_0x41c7bf[_0xea7d('0x34')][_0xea7d('0x38')]));_0x5b1e4d[_0xea7d('0x39')]=_0x5b1e4d[_0xea7d('0x39')][_0xea7d('0x3a')]?_0x5b1e4d['attributes']:_0x59e6a9[_0xea7d('0x33')];if(!_0x41c7bf[_0xea7d('0x34')][_0xea7d('0x3b')]('nolimit')){_0x5b1e4d[_0xea7d('0x1e')]=qs[_0xea7d('0x1e')](_0x41c7bf[_0xea7d('0x34')][_0xea7d('0x1e')]);_0x5b1e4d['offset']=qs[_0xea7d('0x1c')](_0x41c7bf['query'][_0xea7d('0x1c')]);}_0x5b1e4d[_0xea7d('0x3c')]=qs[_0xea7d('0x3d')](_0x41c7bf[_0xea7d('0x34')][_0xea7d('0x3d')]);_0x5b1e4d[_0xea7d('0x3e')]=qs[_0xea7d('0x36')](_[_0xea7d('0x3f')](_0x41c7bf[_0xea7d('0x34')],_0x59e6a9[_0xea7d('0x36')]),_0x34a854);if(_0x41c7bf['query']['filter']){_0x5b1e4d['where']=_[_0xea7d('0x40')](_0x5b1e4d['where'],{'$or':_[_0xea7d('0x2d')](_0x34a854,function(_0x6f0668){if(_0x6f0668[_0xea7d('0x31')]!==_0xea7d('0x41')){var _0x48e5ea={};_0x48e5ea[_0x6f0668['name']]={'$like':'%'+_0x41c7bf[_0xea7d('0x34')][_0xea7d('0x42')]+'%'};return _0x48e5ea;}})});}_0x5b1e4d=_[_0xea7d('0x40')]({},_0x5b1e4d,_0x41c7bf[_0xea7d('0x43')]);var _0x1dbb16={'where':_0x5b1e4d[_0xea7d('0x3e')]};return db[_0xea7d('0x2e')][_0xea7d('0x1f')](_0x1dbb16)[_0xea7d('0x25')](function(_0x47e384){_0x2ebd6a[_0xea7d('0x1f')]=_0x47e384;if(_0x41c7bf[_0xea7d('0x34')]['includeAll']){_0x5b1e4d['include']=[{'all':!![]}];}return db[_0xea7d('0x2e')]['findAll'](_0x5b1e4d);})[_0xea7d('0x25')](function(_0x185c3d){_0x2ebd6a[_0xea7d('0x44')]=_0x185c3d;return _0x2ebd6a;})[_0xea7d('0x25')](respondWithFilteredResult(_0x566d8b,_0x5b1e4d))[_0xea7d('0x45')](handleError(_0x566d8b,null));};exports['show']=function(_0x55a765,_0x6fa8ed){var _0x1d0de9={'raw':![],'where':{'id':_0x55a765[_0xea7d('0x46')]['id']}},_0x5af58a={};_0x5af58a[_0xea7d('0x33')]=_[_0xea7d('0x35')](db[_0xea7d('0x2e')][_0xea7d('0x2f')]);_0x5af58a[_0xea7d('0x34')]=_['keys'](_0x55a765[_0xea7d('0x34')]);_0x5af58a[_0xea7d('0x36')]=_[_0xea7d('0x37')](_0x5af58a[_0xea7d('0x33')],_0x5af58a[_0xea7d('0x34')]);_0x1d0de9[_0xea7d('0x39')]=_['intersection'](_0x5af58a['model'],qs[_0xea7d('0x38')](_0x55a765[_0xea7d('0x34')]['fields']));_0x1d0de9[_0xea7d('0x39')]=_0x1d0de9[_0xea7d('0x39')][_0xea7d('0x3a')]?_0x1d0de9[_0xea7d('0x39')]:_0x5af58a[_0xea7d('0x33')];if(_0x55a765[_0xea7d('0x34')][_0xea7d('0x47')]){_0x1d0de9['include']=[{'all':!![]}];}_0x1d0de9=_[_0xea7d('0x40')]({},_0x1d0de9,_0x55a765[_0xea7d('0x43')]);return db['FreshsalesAccount'][_0xea7d('0x48')](_0x1d0de9)[_0xea7d('0x25')](handleEntityNotFound(_0x6fa8ed,null))[_0xea7d('0x25')](respondWithResult(_0x6fa8ed,null))['catch'](handleError(_0x6fa8ed,null));};exports['create']=function(_0x1ce62b,_0x421fee){return db[_0xea7d('0x2e')][_0xea7d('0x49')](_0x1ce62b[_0xea7d('0x4a')],{})['then'](respondWithResult(_0x421fee,0xc9))[_0xea7d('0x45')](handleError(_0x421fee,null));};exports[_0xea7d('0x24')]=function(_0x3e9880,_0x35bfaa){if(_0x3e9880[_0xea7d('0x4a')]['id']){delete _0x3e9880[_0xea7d('0x4a')]['id'];}return db[_0xea7d('0x2e')][_0xea7d('0x48')]({'where':{'id':_0x3e9880['params']['id']}})[_0xea7d('0x25')](handleEntityNotFound(_0x35bfaa,null))[_0xea7d('0x25')](saveUpdates(_0x3e9880[_0xea7d('0x4a')],null))[_0xea7d('0x25')](respondWithResult(_0x35bfaa,null))[_0xea7d('0x45')](handleError(_0x35bfaa,null));};exports[_0xea7d('0x26')]=function(_0x183444,_0x49797d){return db['FreshsalesAccount'][_0xea7d('0x48')]({'where':{'id':_0x183444[_0xea7d('0x46')]['id']}})['then'](handleEntityNotFound(_0x49797d,null))['then'](removeEntity(_0x49797d,null))[_0xea7d('0x45')](handleError(_0x49797d,null));};exports[_0xea7d('0x4b')]=function(_0x196f64,_0x28e764,_0x20e36b){var _0x2f23df={};var _0x572324={};var _0x39cd2b;var _0x1a7c4c;return db['FreshsalesAccount']['findOne']({'where':{'id':_0x196f64['params']['id']}})[_0xea7d('0x25')](handleEntityNotFound(_0x28e764,null))[_0xea7d('0x25')](function(_0x58aa5c){if(_0x58aa5c){_0x39cd2b=_0x58aa5c;_0x572324[_0xea7d('0x33')]=_[_0xea7d('0x35')](db[_0xea7d('0x4c')]['rawAttributes']);_0x572324['query']=_[_0xea7d('0x35')](_0x196f64[_0xea7d('0x34')]);_0x572324[_0xea7d('0x36')]=_['intersection'](_0x572324['model'],_0x572324[_0xea7d('0x34')]);_0x2f23df['attributes']=_[_0xea7d('0x37')](_0x572324[_0xea7d('0x33')],qs['fields'](_0x196f64['query'][_0xea7d('0x38')]));_0x2f23df[_0xea7d('0x39')]=_0x2f23df[_0xea7d('0x39')][_0xea7d('0x3a')]?_0x2f23df[_0xea7d('0x39')]:_0x572324[_0xea7d('0x33')];_0x2f23df[_0xea7d('0x3c')]=qs[_0xea7d('0x3d')](_0x196f64[_0xea7d('0x34')][_0xea7d('0x3d')]);_0x2f23df['where']=qs[_0xea7d('0x36')](_['pick'](_0x196f64[_0xea7d('0x34')],_0x572324['filters']));if(_0x196f64[_0xea7d('0x34')][_0xea7d('0x42')]){_0x2f23df[_0xea7d('0x3e')]=_['merge'](_0x2f23df['where'],{'$or':_[_0xea7d('0x2d')](_0x2f23df[_0xea7d('0x39')],function(_0x8a1271){var _0xf2e348={};_0xf2e348[_0x8a1271]={'$like':'%'+_0x196f64[_0xea7d('0x34')][_0xea7d('0x42')]+'%'};return _0xf2e348;})});}_0x2f23df=_[_0xea7d('0x40')]({},_0x2f23df,_0x196f64['options']);return _0x39cd2b[_0xea7d('0x4b')](_0x2f23df);}})[_0xea7d('0x25')](function(_0x4f78da){if(_0x4f78da){_0x1a7c4c=_0x4f78da[_0xea7d('0x3a')];if(!_0x196f64[_0xea7d('0x34')][_0xea7d('0x3b')](_0xea7d('0x4d'))){_0x2f23df[_0xea7d('0x1e')]=qs[_0xea7d('0x1e')](_0x196f64[_0xea7d('0x34')][_0xea7d('0x1e')]);_0x2f23df[_0xea7d('0x1c')]=qs[_0xea7d('0x1c')](_0x196f64[_0xea7d('0x34')][_0xea7d('0x1c')]);}return _0x39cd2b[_0xea7d('0x4b')](_0x2f23df);}})[_0xea7d('0x25')](function(_0x48ff04){if(_0x48ff04){return _0x48ff04?{'count':_0x1a7c4c,'rows':_0x48ff04}:null;}})[_0xea7d('0x25')](respondWithResult(_0x28e764,null))[_0xea7d('0x45')](handleError(_0x28e764,null));};exports[_0xea7d('0x4e')]=function(_0x2a8877,_0x2eecbd,_0x40ce96){if(_0x2a8877[_0xea7d('0x4a')]['id']){delete _0x2a8877[_0xea7d('0x4a')]['id'];}return db[_0xea7d('0x2e')][_0xea7d('0x4f')]({'where':{'id':_0x2a8877[_0xea7d('0x46')]['id']}})[_0xea7d('0x25')](handleEntityNotFound(_0x2eecbd,null))['then'](function(_0x8b4b44){if(_0x8b4b44){_0x2a8877['body'][_0xea7d('0x50')]=_0x8b4b44['id'];_0x2a8877[_0xea7d('0x4a')]['Subjects']=integrations['getSubjects'](_0x2a8877[_0xea7d('0x4a')]['channel'],_0x2a8877['body'][_0xea7d('0x31')]);_0x2a8877[_0xea7d('0x4a')]['Descriptions']=integrations[_0xea7d('0x51')](_0x2a8877[_0xea7d('0x4a')]['channel'],_0x2a8877[_0xea7d('0x4a')][_0xea7d('0x31')]);return db[_0xea7d('0x4c')][_0xea7d('0x49')](_0x2a8877['body'],{'include':[{'model':db['FreshsalesField'],'as':_0xea7d('0x52')},{'model':db['FreshsalesField'],'as':_0xea7d('0x53')}]});}return null;})[_0xea7d('0x25')](respondWithResult(_0x2eecbd,null))['catch'](handleError(_0x2eecbd,null));};exports[_0xea7d('0x54')]=function(_0x3e29a9,_0x594946,_0x5786bc){var _0x1eaa6c='';var _0xb7ce70='';return db['FreshsalesAccount'][_0xea7d('0x4f')]({'where':{'id':_0x3e29a9[_0xea7d('0x46')]['id']},'attributes':['id',_0xea7d('0x55'),_0xea7d('0x56'),_0xea7d('0x57')]})['then'](handleEntityNotFound(_0x594946,null))[_0xea7d('0x25')](function(_0x1dc582){if(_0x1dc582){_0xb7ce70=_0x1dc582[_0xea7d('0x55')];_0x1eaa6c=_0x1dc582[_0xea7d('0x56')];var _0x360865=_0x1dc582[_0xea7d('0x56')]['slice'](-0x1);if(_0x360865==='/'){_0x1eaa6c=_0x1eaa6c[_0xea7d('0x58')](0x0,_0x1eaa6c[_0xea7d('0x59')](_0x360865));}return rp({'method':'GET','uri':util[_0xea7d('0x5a')](_0xea7d('0x5b'),_0x1eaa6c,_0xea7d('0x5c')),'headers':{'Authorization':'Token\x20token='+_0x1dc582[_0xea7d('0x57')]},'json':!![]});}})[_0xea7d('0x25')](function(_0x298d10){if(_0x298d10){var _0x3e83f5=_0x298d10[_0xea7d('0x5d')];var _0x3e16a0=![];var _0x22f2c9=null;for(_0x22f2c9=0x0;_0x22f2c9<_0x3e83f5['length'];_0x22f2c9++){if(_0x3e83f5[_0x22f2c9]['email']===_0xb7ce70){_0x3e16a0=!![];}}if(_0x3e16a0){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0xea7d('0x25')](respondWithResult(_0x594946,null))[_0xea7d('0x45')](function(_0x55ad4f){var _0x1a85a3=_0x3e29a9[_0xea7d('0x34')][_0xea7d('0x5e')]?0x1f4:_0x55ad4f[_0xea7d('0x5f')]||0x1f4;logger[_0xea7d('0x28')](_0xea7d('0x60'),_0xea7d('0x54'),_0x1a85a3,JSON[_0xea7d('0x61')](_0x55ad4f));delete _0x55ad4f[_0xea7d('0x2a')];if(_0x1a85a3===0x191){_0x1a85a3=0x190;}_0x594946[_0xea7d('0x19')](_0x1a85a3)[_0xea7d('0x2b')](_0x3e29a9[_0xea7d('0x34')][_0xea7d('0x5e')]?{'message':_0xea7d('0x62'),'statusCode':_0x55ad4f[_0xea7d('0x5f')]}:_0x55ad4f);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index c227dcd..40dc0e6 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 _0x687b=['./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','int_freshsales_accounts','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x118e76,_0x46115b){var _0x421169=function(_0x3c0976){while(--_0x3c0976){_0x118e76['push'](_0x118e76['shift']());}};_0x421169(++_0x46115b);}(_0x687b,0x14a));var _0xb687=function(_0x4a18f0,_0x903c50){_0x4a18f0=_0x4a18f0-0x0;var _0x158316=_0x687b[_0x4a18f0];return _0x158316;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var logger=require(_0xb687('0x2'))(_0xb687('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb687('0x4'));var fs=require('fs');var path=require(_0xb687('0x5'));var rimraf=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var attributes=require(_0xb687('0x8'));var integrations=require(_0xb687('0x9'));module[_0xb687('0xa')]=function(_0xf43a1f,_0x47ffea){return _0xf43a1f[_0xb687('0xb')]('FreshsalesAccount',attributes,{'tableName':_0xb687('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe5af=['FreshsalesAccount','int_freshsales_accounts','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../components/integrations/configuration','exports','define'];(function(_0x3ae89c,_0x4bc1d3){var _0x54df34=function(_0x196622){while(--_0x196622){_0x3ae89c['push'](_0x3ae89c['shift']());}};_0x54df34(++_0x4bc1d3);}(_0xe5af,0x9c));var _0xfe5a=function(_0x325fb0,_0x9c223d){_0x325fb0=_0x325fb0-0x0;var _0x92b926=_0xe5af[_0x325fb0];return _0x92b926;};'use strict';var _=require('lodash');var util=require(_0xfe5a('0x0'));var logger=require(_0xfe5a('0x1'))('api');var moment=require(_0xfe5a('0x2'));var BPromise=require(_0xfe5a('0x3'));var rp=require(_0xfe5a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfe5a('0x5'));var config=require('../../config/environment');var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0xfe5a('0x6'));module[_0xfe5a('0x7')]=function(_0x4e418f,_0x5eea2e){return _0x4e418f[_0xfe5a('0x8')](_0xfe5a('0x9'),attributes,{'tableName':_0xfe5a('0xa'),'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 6485e4e..dad8876 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 _0x1261=['FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetFreshsalesAccount','options','raw','limit','include','map','model','attributes','stringify','ShowFreshsalesAccount','FreshsalesAccount','find','where','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x5e4740,_0x2e4ed7){var _0x314894=function(_0x35d383){while(--_0x35d383){_0x5e4740['push'](_0x5e4740['shift']());}};_0x314894(++_0x2e4ed7);}(_0x1261,0x144));var _0x1126=function(_0xabbd2f,_0x44d05a){_0xabbd2f=_0xabbd2f-0x0;var _0x34a040=_0x1261[_0xabbd2f];return _0x34a040;};'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')]('FreshsalesAccount,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});}exports[_0x1126('0x15')]=function(_0x4a7b49){var _0x4d2b38=this;return new Promise(function(_0x22ae0b,_0x2b2487){return db['FreshsalesAccount']['findAll']({'raw':_0x4a7b49[_0x1126('0x16')]?_0x4a7b49['options'][_0x1126('0x17')]===undefined?!![]:![]:!![],'where':_0x4a7b49[_0x1126('0x16')]?_0x4a7b49[_0x1126('0x16')]['where']||null:null,'attributes':_0x4a7b49[_0x1126('0x16')]?_0x4a7b49['options']['attributes']||null:null,'limit':_0x4a7b49[_0x1126('0x16')]?_0x4a7b49[_0x1126('0x16')][_0x1126('0x18')]||null:null,'include':_0x4a7b49[_0x1126('0x16')]?_0x4a7b49['options'][_0x1126('0x19')]?_[_0x1126('0x1a')](_0x4a7b49['options'][_0x1126('0x19')],function(_0x59cd8e){return{'model':db[_0x59cd8e['model']],'as':_0x59cd8e['as'],'attributes':_0x59cd8e['attributes'],'include':_0x59cd8e[_0x1126('0x19')]?_[_0x1126('0x1a')](_0x59cd8e[_0x1126('0x19')],function(_0x34bcf1){return{'model':db[_0x34bcf1[_0x1126('0x1b')]],'as':_0x34bcf1['as'],'attributes':_0x34bcf1[_0x1126('0x1c')],'include':_0x34bcf1[_0x1126('0x19')]?_[_0x1126('0x1a')](_0x34bcf1['include'],function(_0x35eec3){return{'model':db[_0x35eec3[_0x1126('0x1b')]],'as':_0x35eec3['as'],'attributes':_0x35eec3[_0x1126('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x541bc9){logger[_0x1126('0xd')](_0x1126('0x15'),_0x4a7b49);logger['debug'](_0x1126('0x15'),_0x4a7b49,JSON[_0x1126('0x1d')](_0x541bc9));_0x22ae0b(_0x541bc9);})['catch'](function(_0x3fa694){logger['error'](_0x1126('0x15'),_0x3fa694['message'],_0x4a7b49);_0x2b2487(_0x4d2b38[_0x1126('0x11')](0x1f4,_0x3fa694['message']));});});};exports[_0x1126('0x1e')]=function(_0x5f2611){var _0x5252e0=this;return new Promise(function(_0x4a53ab,_0x17646e){return db[_0x1126('0x1f')][_0x1126('0x20')]({'raw':_0x5f2611['options']?_0x5f2611[_0x1126('0x16')][_0x1126('0x17')]===undefined?!![]:![]:!![],'where':_0x5f2611['options']?_0x5f2611[_0x1126('0x16')][_0x1126('0x21')]||null:null,'attributes':_0x5f2611[_0x1126('0x16')]?_0x5f2611[_0x1126('0x16')]['attributes']||null:null,'include':_0x5f2611['options']?_0x5f2611[_0x1126('0x16')][_0x1126('0x19')]?_[_0x1126('0x1a')](_0x5f2611[_0x1126('0x16')]['include'],function(_0x145314){return{'model':db[_0x145314[_0x1126('0x1b')]],'as':_0x145314['as'],'attributes':_0x145314[_0x1126('0x1c')],'include':_0x145314[_0x1126('0x19')]?_[_0x1126('0x1a')](_0x145314['include'],function(_0x2a0dfe){return{'model':db[_0x2a0dfe[_0x1126('0x1b')]],'as':_0x2a0dfe['as'],'attributes':_0x2a0dfe[_0x1126('0x1c')],'include':_0x2a0dfe[_0x1126('0x19')]?_['map'](_0x2a0dfe['include'],function(_0x22827a){return{'model':db[_0x22827a[_0x1126('0x1b')]],'as':_0x22827a['as'],'attributes':_0x22827a['attributes']};}):[]};}):[]};}):[]:[]})[_0x1126('0xc')](function(_0xf3c21b){logger[_0x1126('0xd')]('ShowFreshsalesAccount',_0x5f2611);logger['debug'](_0x1126('0x1e'),_0x5f2611,JSON[_0x1126('0x1d')](_0xf3c21b));_0x4a53ab(_0xf3c21b);})[_0x1126('0x14')](function(_0x156554){logger['error'](_0x1126('0x1e'),_0x156554['message'],_0x5f2611);_0x17646e(_0x5252e0[_0x1126('0x11')](0x1f4,_0x156554[_0x1126('0x13')]));});});}; \ No newline at end of file +var _0xd943=['limit','include','map','model','attributes','debug','ShowFreshsalesAccount','find','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then','info','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','options','raw','where'];(function(_0x27929e,_0x75968b){var _0x3125c0=function(_0x3ccad5){while(--_0x3ccad5){_0x27929e['push'](_0x27929e['shift']());}};_0x3125c0(++_0x75968b);}(_0xd943,0x15d));var _0x3d94=function(_0x85884e,_0x51ce24){_0x85884e=_0x85884e-0x0;var _0x5b086c=_0xd943[_0x85884e];return _0x5b086c;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));var BPromise=require(_0x3d94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d94('0x4'));var db=require(_0x3d94('0x5'))['db'];var utils=require(_0x3d94('0x6'));var logger=require(_0x3d94('0x7'))(_0x3d94('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d94('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54e81f,_0x4d29e7,_0x20f4d1){return new BPromise(function(_0x35d36a,_0x5244c3){return client['request'](_0x54e81f,_0x20f4d1)[_0x3d94('0xa')](function(_0x27e381){logger[_0x3d94('0xb')]('FreshsalesAccount,\x20%s,\x20%s',_0x4d29e7,_0x3d94('0xc'));logger['debug'](_0x3d94('0xd'),_0x4d29e7,_0x3d94('0xc'),JSON['stringify'](_0x27e381));if(_0x27e381[_0x3d94('0xe')]){if(_0x27e381[_0x3d94('0xe')][_0x3d94('0xf')]===0x1f4){logger[_0x3d94('0xe')](_0x3d94('0x10'),_0x4d29e7,_0x27e381['error'][_0x3d94('0x11')]);return _0x5244c3(_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);}logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);return _0x35d36a(_0x27e381['error'][_0x3d94('0x11')]);}else{logger[_0x3d94('0xb')](_0x3d94('0x10'),_0x4d29e7,_0x3d94('0xc'));_0x35d36a(_0x27e381[_0x3d94('0x12')][_0x3d94('0x11')]);}})[_0x3d94('0x13')](function(_0x9893cb){logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x9893cb);_0x5244c3(_0x9893cb);});});}exports[_0x3d94('0x14')]=function(_0x2acee3){var _0x1c35a8=this;return new Promise(function(_0x4afc92,_0x3ca0e3){return db[_0x3d94('0x15')]['findAll']({'raw':_0x2acee3[_0x3d94('0x16')]?_0x2acee3['options'][_0x3d94('0x17')]===undefined?!![]:![]:!![],'where':_0x2acee3[_0x3d94('0x16')]?_0x2acee3[_0x3d94('0x16')][_0x3d94('0x18')]||null:null,'attributes':_0x2acee3[_0x3d94('0x16')]?_0x2acee3['options']['attributes']||null:null,'limit':_0x2acee3[_0x3d94('0x16')]?_0x2acee3[_0x3d94('0x16')][_0x3d94('0x19')]||null:null,'include':_0x2acee3['options']?_0x2acee3[_0x3d94('0x16')][_0x3d94('0x1a')]?_[_0x3d94('0x1b')](_0x2acee3[_0x3d94('0x16')][_0x3d94('0x1a')],function(_0x4093a4){return{'model':db[_0x4093a4[_0x3d94('0x1c')]],'as':_0x4093a4['as'],'attributes':_0x4093a4[_0x3d94('0x1d')],'include':_0x4093a4[_0x3d94('0x1a')]?_[_0x3d94('0x1b')](_0x4093a4[_0x3d94('0x1a')],function(_0x192839){return{'model':db[_0x192839[_0x3d94('0x1c')]],'as':_0x192839['as'],'attributes':_0x192839[_0x3d94('0x1d')],'include':_0x192839[_0x3d94('0x1a')]?_['map'](_0x192839[_0x3d94('0x1a')],function(_0x558fd2){return{'model':db[_0x558fd2[_0x3d94('0x1c')]],'as':_0x558fd2['as'],'attributes':_0x558fd2[_0x3d94('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3d94('0xa')](function(_0x439173){logger[_0x3d94('0xb')](_0x3d94('0x14'),_0x2acee3);logger[_0x3d94('0x1e')]('GetFreshsalesAccount',_0x2acee3,JSON['stringify'](_0x439173));_0x4afc92(_0x439173);})[_0x3d94('0x13')](function(_0x4813e1){logger['error'](_0x3d94('0x14'),_0x4813e1['message'],_0x2acee3);_0x3ca0e3(_0x1c35a8[_0x3d94('0xe')](0x1f4,_0x4813e1[_0x3d94('0x11')]));});});};exports[_0x3d94('0x1f')]=function(_0x4cef9c){var _0x2a07b4=this;return new Promise(function(_0x4c1237,_0x3d4994){return db['FreshsalesAccount'][_0x3d94('0x20')]({'raw':_0x4cef9c[_0x3d94('0x16')]?_0x4cef9c[_0x3d94('0x16')][_0x3d94('0x17')]===undefined?!![]:![]:!![],'where':_0x4cef9c['options']?_0x4cef9c[_0x3d94('0x16')]['where']||null:null,'attributes':_0x4cef9c[_0x3d94('0x16')]?_0x4cef9c[_0x3d94('0x16')]['attributes']||null:null,'include':_0x4cef9c['options']?_0x4cef9c[_0x3d94('0x16')][_0x3d94('0x1a')]?_[_0x3d94('0x1b')](_0x4cef9c['options'][_0x3d94('0x1a')],function(_0x3d29fd){return{'model':db[_0x3d29fd['model']],'as':_0x3d29fd['as'],'attributes':_0x3d29fd[_0x3d94('0x1d')],'include':_0x3d29fd[_0x3d94('0x1a')]?_[_0x3d94('0x1b')](_0x3d29fd[_0x3d94('0x1a')],function(_0x782c1){return{'model':db[_0x782c1['model']],'as':_0x782c1['as'],'attributes':_0x782c1[_0x3d94('0x1d')],'include':_0x782c1[_0x3d94('0x1a')]?_[_0x3d94('0x1b')](_0x782c1[_0x3d94('0x1a')],function(_0xb493f1){return{'model':db[_0xb493f1[_0x3d94('0x1c')]],'as':_0xb493f1['as'],'attributes':_0xb493f1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xfe58eb){logger[_0x3d94('0xb')](_0x3d94('0x1f'),_0x4cef9c);logger[_0x3d94('0x1e')](_0x3d94('0x1f'),_0x4cef9c,JSON[_0x3d94('0x21')](_0xfe58eb));_0x4c1237(_0xfe58eb);})[_0x3d94('0x13')](function(_0x12c01a){logger[_0x3d94('0xe')](_0x3d94('0x1f'),_0x12c01a['message'],_0x4cef9c);_0x3d4994(_0x2a07b4[_0x3d94('0xe')](0x1f4,_0x12c01a[_0x3d94('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 9eff362..d2c3b32 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 _0x9103=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','/:id/subjects','getSubjects','/:id/fields','post','create','put','delete','multer'];(function(_0x4d27a9,_0x590387){var _0x7930b7=function(_0x324676){while(--_0x324676){_0x4d27a9['push'](_0x4d27a9['shift']());}};_0x7930b7(++_0x590387);}(_0x9103,0x17b));var _0x3910=function(_0x1aa3fe,_0x27c5fa){_0x1aa3fe=_0x1aa3fe-0x0;var _0x163cee=_0x9103[_0x1aa3fe];return _0x163cee;};'use strict';var multer=require(_0x3910('0x0'));var util=require(_0x3910('0x1'));var path=require(_0x3910('0x2'));var timeout=require(_0x3910('0x3'));var express=require('express');var router=express[_0x3910('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3910('0x5'));var interaction=require(_0x3910('0x6'));var config=require(_0x3910('0x7'));var controller=require(_0x3910('0x8'));router[_0x3910('0x9')]('/',auth[_0x3910('0xa')](),controller[_0x3910('0xb')]);router[_0x3910('0x9')](_0x3910('0xc'),auth[_0x3910('0xa')](),controller['show']);router[_0x3910('0x9')](_0x3910('0xd'),auth[_0x3910('0xa')](),controller[_0x3910('0xe')]);router[_0x3910('0x9')]('/:id/descriptions',auth[_0x3910('0xa')](),controller['getDescriptions']);router[_0x3910('0x9')](_0x3910('0xf'),auth[_0x3910('0xa')](),controller['getFields']);router[_0x3910('0x10')]('/',auth[_0x3910('0xa')](),controller[_0x3910('0x11')]);router[_0x3910('0x12')](_0x3910('0xc'),auth[_0x3910('0xa')](),controller['update']);router[_0x3910('0x13')](_0x3910('0xc'),auth[_0x3910('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd3cc=['post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields'];(function(_0x4e039d,_0x3a06de){var _0x4cfc6f=function(_0x58293){while(--_0x58293){_0x4e039d['push'](_0x4e039d['shift']());}};_0x4cfc6f(++_0x3a06de);}(_0xd3cc,0xcd));var _0xcd3c=function(_0x3e7a5e,_0x35e418){_0x3e7a5e=_0x3e7a5e-0x0;var _0x3fd5ad=_0xd3cc[_0x3e7a5e];return _0x3fd5ad;};'use strict';var multer=require(_0xcd3c('0x0'));var util=require(_0xcd3c('0x1'));var path=require(_0xcd3c('0x2'));var timeout=require(_0xcd3c('0x3'));var express=require(_0xcd3c('0x4'));var router=express[_0xcd3c('0x5')]();var fs_extra=require(_0xcd3c('0x6'));var auth=require(_0xcd3c('0x7'));var interaction=require(_0xcd3c('0x8'));var config=require(_0xcd3c('0x9'));var controller=require('./intFreshsalesConfiguration.controller');router[_0xcd3c('0xa')]('/',auth['isAuthenticated'](),controller[_0xcd3c('0xb')]);router[_0xcd3c('0xa')](_0xcd3c('0xc'),auth[_0xcd3c('0xd')](),controller[_0xcd3c('0xe')]);router[_0xcd3c('0xa')]('/:id/subjects',auth[_0xcd3c('0xd')](),controller[_0xcd3c('0xf')]);router[_0xcd3c('0xa')](_0xcd3c('0x10'),auth['isAuthenticated'](),controller[_0xcd3c('0x11')]);router[_0xcd3c('0xa')](_0xcd3c('0x12'),auth[_0xcd3c('0xd')](),controller[_0xcd3c('0x13')]);router[_0xcd3c('0x14')]('/',auth[_0xcd3c('0xd')](),controller[_0xcd3c('0x15')]);router[_0xcd3c('0x16')](_0xcd3c('0xc'),auth['isAuthenticated'](),controller[_0xcd3c('0x17')]);router['delete']('/:id',auth[_0xcd3c('0xd')](),controller['destroy']);module[_0xcd3c('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 03f4f5c..a819c2b 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 _0xa782=['sequelize','STRING'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xa782,0x72));var _0x2a78=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xa782[_0x32f7d7];return _0x133d09;};'use strict';var Sequelize=require(_0x2a78('0x0'));module['exports']={'name':{'type':Sequelize[_0x2a78('0x1')]},'description':{'type':Sequelize[_0x2a78('0x1')]}}; \ No newline at end of file +var _0xf293=['STRING','sequelize','exports'];(function(_0x2a22eb,_0x3da482){var _0x427fec=function(_0x30fe08){while(--_0x30fe08){_0x2a22eb['push'](_0x2a22eb['shift']());}};_0x427fec(++_0x3da482);}(_0xf293,0x1a8));var _0x3f29=function(_0x53a776,_0x558119){_0x53a776=_0x53a776-0x0;var _0xe68a34=_0xf293[_0x53a776];return _0xe68a34;};'use strict';var Sequelize=require(_0x3f29('0x0'));module[_0x3f29('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3f29('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 0041c3c..99df80b 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 _0x6a9a=['VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','create','body','destroy','find','getSubjects','findOne','FreshsalesField','length','pick','getDescriptions','getFields','order','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','error','name','send','map','FreshsalesConfiguration','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','type'];(function(_0x27d10a,_0x35ff44){var _0x63302e=function(_0x302156){while(--_0x302156){_0x27d10a['push'](_0x27d10a['shift']());}};_0x63302e(++_0x35ff44);}(_0x6a9a,0x1de));var _0xa6a9=function(_0x5400b,_0x55943a){_0x5400b=_0x5400b-0x0;var _0x36a39b=_0x6a9a[_0x5400b];return _0x36a39b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa6a9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa6a9('0x1'));var rp=require(_0xa6a9('0x2'));var moment=require(_0xa6a9('0x3'));var BPromise=require(_0xa6a9('0x4'));var Mustache=require('mustache');var util=require(_0xa6a9('0x5'));var path=require(_0xa6a9('0x6'));var sox=require(_0xa6a9('0x7'));var csv=require(_0xa6a9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa6a9('0x9'));var squel=require('squel');var crypto=require(_0xa6a9('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xa6a9('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa6a9('0xc'));var Redis=require(_0xa6a9('0xd'));var authService=require(_0xa6a9('0xe'));var qs=require(_0xa6a9('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa6a9('0x10'));var logger=require(_0xa6a9('0x11'))('api');var utils=require(_0xa6a9('0x12'));var config=require(_0xa6a9('0x13'));var licenseUtil=require(_0xa6a9('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5323ca,_0x1ba81c){_0x1ba81c=_0x1ba81c||0xcc;return function(_0xf7ff7a){if(_0xf7ff7a){return _0x5323ca[_0xa6a9('0x15')](_0x1ba81c);}return _0x5323ca[_0xa6a9('0x16')](_0x1ba81c)[_0xa6a9('0x17')]();};}function respondWithResult(_0x303c08,_0xf64b0a){_0xf64b0a=_0xf64b0a||0xc8;return function(_0x173dfe){if(_0x173dfe){return _0x303c08['status'](_0xf64b0a)[_0xa6a9('0x18')](_0x173dfe);}};}function respondWithFilteredResult(_0x5a772e,_0x15d70c){return function(_0x15ae7b){if(_0x15ae7b){var _0xb8fef5=typeof _0x15d70c['offset']===_0xa6a9('0x19')&&typeof _0x15d70c[_0xa6a9('0x1a')]===_0xa6a9('0x19');var _0x4d9585=_0x15ae7b[_0xa6a9('0x1b')];var _0x4732b5=_0xb8fef5?0x0:_0x15d70c['offset'];var _0x308f9a=_0xb8fef5?_0x15ae7b[_0xa6a9('0x1b')]:_0x15d70c[_0xa6a9('0x1c')]+_0x15d70c[_0xa6a9('0x1a')];var _0x196e8e;if(_0x308f9a>=_0x4d9585){_0x308f9a=_0x4d9585;_0x196e8e=0xc8;}else{_0x196e8e=0xce;}_0x5a772e[_0xa6a9('0x16')](_0x196e8e);return _0x5a772e['set'](_0xa6a9('0x1d'),_0x4732b5+'-'+_0x308f9a+'/'+_0x4d9585)[_0xa6a9('0x18')](_0x15ae7b);}return null;};}function patchUpdates(_0x2a93cd){return function(_0x27de99){try{jsonpatch[_0xa6a9('0x1e')](_0x27de99,_0x2a93cd,!![]);}catch(_0x34a0b1){return BPromise['reject'](_0x34a0b1);}return _0x27de99[_0xa6a9('0x1f')]();};}function saveUpdates(_0x393c23,_0x537f64){return function(_0x54158d){if(_0x54158d){return _0x54158d[_0xa6a9('0x20')](_0x393c23)['then'](function(_0x5d7e82){return _0x5d7e82;});}return null;};}function removeEntity(_0x317056,_0x5c9940){return function(_0x12dbee){if(_0x12dbee){return _0x12dbee['destroy']()[_0xa6a9('0x21')](function(){_0x317056[_0xa6a9('0x16')](0xcc)[_0xa6a9('0x17')]();});}};}function handleEntityNotFound(_0xf319ad,_0x4d0871){return function(_0x277d00){if(!_0x277d00){_0xf319ad[_0xa6a9('0x15')](0x194);}return _0x277d00;};}function handleError(_0x208156,_0x54400d){_0x54400d=_0x54400d||0x1f4;return function(_0xa0a94){logger[_0xa6a9('0x22')](_0xa0a94['stack']);if(_0xa0a94['name']){delete _0xa0a94[_0xa6a9('0x23')];}_0x208156[_0xa6a9('0x16')](_0x54400d)[_0xa6a9('0x24')](_0xa0a94);};}exports['index']=function(_0xb19947,_0x3685c3){var _0x5247ba={},_0xc9f7a1={},_0x41381e={'count':0x0,'rows':[]};var _0x2ee69a=_[_0xa6a9('0x25')](db[_0xa6a9('0x26')][_0xa6a9('0x27')],function(_0x367db6){return{'name':_0x367db6[_0xa6a9('0x28')],'type':_0x367db6['type']['key']};});_0xc9f7a1[_0xa6a9('0x29')]=_[_0xa6a9('0x25')](_0x2ee69a,_0xa6a9('0x23'));_0xc9f7a1[_0xa6a9('0x2a')]=_[_0xa6a9('0x2b')](_0xb19947[_0xa6a9('0x2a')]);_0xc9f7a1[_0xa6a9('0x2c')]=_[_0xa6a9('0x2d')](_0xc9f7a1[_0xa6a9('0x29')],_0xc9f7a1[_0xa6a9('0x2a')]);_0x5247ba[_0xa6a9('0x2e')]=_[_0xa6a9('0x2d')](_0xc9f7a1[_0xa6a9('0x29')],qs[_0xa6a9('0x2f')](_0xb19947[_0xa6a9('0x2a')]['fields']));_0x5247ba[_0xa6a9('0x2e')]=_0x5247ba[_0xa6a9('0x2e')]['length']?_0x5247ba[_0xa6a9('0x2e')]:_0xc9f7a1['model'];if(!_0xb19947[_0xa6a9('0x2a')][_0xa6a9('0x30')](_0xa6a9('0x31'))){_0x5247ba[_0xa6a9('0x1a')]=qs[_0xa6a9('0x1a')](_0xb19947[_0xa6a9('0x2a')][_0xa6a9('0x1a')]);_0x5247ba[_0xa6a9('0x1c')]=qs['offset'](_0xb19947[_0xa6a9('0x2a')]['offset']);}_0x5247ba['order']=qs[_0xa6a9('0x32')](_0xb19947['query']['sort']);_0x5247ba[_0xa6a9('0x33')]=qs[_0xa6a9('0x2c')](_['pick'](_0xb19947['query'],_0xc9f7a1[_0xa6a9('0x2c')]),_0x2ee69a);if(_0xb19947[_0xa6a9('0x2a')][_0xa6a9('0x34')]){_0x5247ba[_0xa6a9('0x33')]=_['merge'](_0x5247ba['where'],{'$or':_[_0xa6a9('0x25')](_0x2ee69a,function(_0xd8d9ab){if(_0xd8d9ab[_0xa6a9('0x35')]!==_0xa6a9('0x36')){var _0x440212={};_0x440212[_0xd8d9ab[_0xa6a9('0x23')]]={'$like':'%'+_0xb19947[_0xa6a9('0x2a')][_0xa6a9('0x34')]+'%'};return _0x440212;}})});}_0x5247ba=_[_0xa6a9('0x37')]({},_0x5247ba,_0xb19947[_0xa6a9('0x38')]);var _0x26b2e5={'where':_0x5247ba[_0xa6a9('0x33')]};return db[_0xa6a9('0x26')]['count'](_0x26b2e5)[_0xa6a9('0x21')](function(_0x36d2a3){_0x41381e[_0xa6a9('0x1b')]=_0x36d2a3;if(_0xb19947[_0xa6a9('0x2a')][_0xa6a9('0x39')]){_0x5247ba['include']=[{'all':!![]}];}return db[_0xa6a9('0x26')][_0xa6a9('0x3a')](_0x5247ba);})['then'](function(_0x78352e){_0x41381e[_0xa6a9('0x3b')]=_0x78352e;return _0x41381e;})[_0xa6a9('0x21')](respondWithFilteredResult(_0x3685c3,_0x5247ba))[_0xa6a9('0x3c')](handleError(_0x3685c3,null));};exports[_0xa6a9('0x3d')]=function(_0x19af84,_0x3c0a51){var _0x2e5282={'raw':![],'where':{'id':_0x19af84[_0xa6a9('0x3e')]['id']}},_0x5b3996={};_0x5b3996[_0xa6a9('0x29')]=_['keys'](db[_0xa6a9('0x26')][_0xa6a9('0x27')]);_0x5b3996[_0xa6a9('0x2a')]=_[_0xa6a9('0x2b')](_0x19af84[_0xa6a9('0x2a')]);_0x5b3996[_0xa6a9('0x2c')]=_[_0xa6a9('0x2d')](_0x5b3996[_0xa6a9('0x29')],_0x5b3996[_0xa6a9('0x2a')]);_0x2e5282[_0xa6a9('0x2e')]=_[_0xa6a9('0x2d')](_0x5b3996[_0xa6a9('0x29')],qs[_0xa6a9('0x2f')](_0x19af84[_0xa6a9('0x2a')][_0xa6a9('0x2f')]));_0x2e5282['attributes']=_0x2e5282['attributes']['length']?_0x2e5282[_0xa6a9('0x2e')]:_0x5b3996[_0xa6a9('0x29')];if(_0x19af84[_0xa6a9('0x2a')][_0xa6a9('0x39')]){_0x2e5282[_0xa6a9('0x3f')]=[{'all':!![]}];}_0x2e5282=_[_0xa6a9('0x37')]({},_0x2e5282,_0x19af84['options']);return db['FreshsalesConfiguration']['find'](_0x2e5282)['then'](handleEntityNotFound(_0x3c0a51,null))[_0xa6a9('0x21')](respondWithResult(_0x3c0a51,null))[_0xa6a9('0x3c')](handleError(_0x3c0a51,null));};exports[_0xa6a9('0x40')]=function(_0x352fc1,_0x542c28){return db[_0xa6a9('0x26')][_0xa6a9('0x40')](_0x352fc1[_0xa6a9('0x41')],{})[_0xa6a9('0x21')](respondWithResult(_0x542c28,0xc9))[_0xa6a9('0x3c')](handleError(_0x542c28,null));};exports[_0xa6a9('0x20')]=function(_0x525092,_0x382c3a){if(_0x525092[_0xa6a9('0x41')]['id']){delete _0x525092[_0xa6a9('0x41')]['id'];}return db[_0xa6a9('0x26')]['find']({'where':{'id':_0x525092['params']['id']}})['then'](handleEntityNotFound(_0x382c3a,null))[_0xa6a9('0x21')](saveUpdates(_0x525092[_0xa6a9('0x41')],null))['then'](respondWithResult(_0x382c3a,null))[_0xa6a9('0x3c')](handleError(_0x382c3a,null));};exports[_0xa6a9('0x42')]=function(_0x51260b,_0x36def6){return db['FreshsalesConfiguration'][_0xa6a9('0x43')]({'where':{'id':_0x51260b[_0xa6a9('0x3e')]['id']}})['then'](handleEntityNotFound(_0x36def6,null))['then'](removeEntity(_0x36def6,null))[_0xa6a9('0x3c')](handleError(_0x36def6,null));};exports[_0xa6a9('0x44')]=function(_0x33028f,_0x52e94b,_0x5ce848){var _0x4b2b2e={};var _0x404db9={};var _0x448fa7;var _0xbc0d06;return db[_0xa6a9('0x26')][_0xa6a9('0x45')]({'where':{'id':_0x33028f[_0xa6a9('0x3e')]['id']}})['then'](handleEntityNotFound(_0x52e94b,null))[_0xa6a9('0x21')](function(_0x3aa637){if(_0x3aa637){_0x448fa7=_0x3aa637;_0x404db9['model']=_[_0xa6a9('0x2b')](db[_0xa6a9('0x46')][_0xa6a9('0x27')]);_0x404db9[_0xa6a9('0x2a')]=_[_0xa6a9('0x2b')](_0x33028f[_0xa6a9('0x2a')]);_0x404db9[_0xa6a9('0x2c')]=_[_0xa6a9('0x2d')](_0x404db9[_0xa6a9('0x29')],_0x404db9[_0xa6a9('0x2a')]);_0x4b2b2e[_0xa6a9('0x2e')]=_[_0xa6a9('0x2d')](_0x404db9[_0xa6a9('0x29')],qs['fields'](_0x33028f['query'][_0xa6a9('0x2f')]));_0x4b2b2e['attributes']=_0x4b2b2e[_0xa6a9('0x2e')][_0xa6a9('0x47')]?_0x4b2b2e[_0xa6a9('0x2e')]:_0x404db9[_0xa6a9('0x29')];_0x4b2b2e['order']=qs[_0xa6a9('0x32')](_0x33028f['query'][_0xa6a9('0x32')]);_0x4b2b2e[_0xa6a9('0x33')]=qs['filters'](_[_0xa6a9('0x48')](_0x33028f[_0xa6a9('0x2a')],_0x404db9[_0xa6a9('0x2c')]));if(_0x33028f[_0xa6a9('0x2a')][_0xa6a9('0x34')]){_0x4b2b2e[_0xa6a9('0x33')]=_[_0xa6a9('0x37')](_0x4b2b2e[_0xa6a9('0x33')],{'$or':_['map'](_0x4b2b2e[_0xa6a9('0x2e')],function(_0x19e27e){var _0x494ca7={};_0x494ca7[_0x19e27e]={'$like':'%'+_0x33028f[_0xa6a9('0x2a')][_0xa6a9('0x34')]+'%'};return _0x494ca7;})});}_0x4b2b2e=_[_0xa6a9('0x37')]({},_0x4b2b2e,_0x33028f[_0xa6a9('0x38')]);return _0x448fa7[_0xa6a9('0x44')](_0x4b2b2e);}})[_0xa6a9('0x21')](function(_0x9cb88){if(_0x9cb88){_0xbc0d06=_0x9cb88[_0xa6a9('0x47')];if(!_0x33028f[_0xa6a9('0x2a')][_0xa6a9('0x30')]('nolimit')){_0x4b2b2e[_0xa6a9('0x1a')]=qs[_0xa6a9('0x1a')](_0x33028f[_0xa6a9('0x2a')][_0xa6a9('0x1a')]);_0x4b2b2e[_0xa6a9('0x1c')]=qs[_0xa6a9('0x1c')](_0x33028f[_0xa6a9('0x2a')][_0xa6a9('0x1c')]);}return _0x448fa7['getSubjects'](_0x4b2b2e);}})[_0xa6a9('0x21')](function(_0x45861d){if(_0x45861d){return _0x45861d?{'count':_0xbc0d06,'rows':_0x45861d}:null;}})[_0xa6a9('0x21')](respondWithResult(_0x52e94b,null))[_0xa6a9('0x3c')](handleError(_0x52e94b,null));};exports[_0xa6a9('0x49')]=function(_0x9f373c,_0x51c8b2,_0x515246){var _0x49e005={};var _0x538fff={};var _0x4875c6;var _0x30a9b4;return db[_0xa6a9('0x26')][_0xa6a9('0x45')]({'where':{'id':_0x9f373c[_0xa6a9('0x3e')]['id']}})[_0xa6a9('0x21')](handleEntityNotFound(_0x51c8b2,null))['then'](function(_0x433fef){if(_0x433fef){_0x4875c6=_0x433fef;_0x538fff[_0xa6a9('0x29')]=_[_0xa6a9('0x2b')](db[_0xa6a9('0x46')][_0xa6a9('0x27')]);_0x538fff[_0xa6a9('0x2a')]=_[_0xa6a9('0x2b')](_0x9f373c[_0xa6a9('0x2a')]);_0x538fff[_0xa6a9('0x2c')]=_[_0xa6a9('0x2d')](_0x538fff[_0xa6a9('0x29')],_0x538fff[_0xa6a9('0x2a')]);_0x49e005[_0xa6a9('0x2e')]=_['intersection'](_0x538fff[_0xa6a9('0x29')],qs[_0xa6a9('0x2f')](_0x9f373c[_0xa6a9('0x2a')][_0xa6a9('0x2f')]));_0x49e005[_0xa6a9('0x2e')]=_0x49e005[_0xa6a9('0x2e')]['length']?_0x49e005[_0xa6a9('0x2e')]:_0x538fff[_0xa6a9('0x29')];_0x49e005['order']=qs['sort'](_0x9f373c[_0xa6a9('0x2a')][_0xa6a9('0x32')]);_0x49e005['where']=qs[_0xa6a9('0x2c')](_[_0xa6a9('0x48')](_0x9f373c[_0xa6a9('0x2a')],_0x538fff[_0xa6a9('0x2c')]));if(_0x9f373c['query'][_0xa6a9('0x34')]){_0x49e005[_0xa6a9('0x33')]=_[_0xa6a9('0x37')](_0x49e005['where'],{'$or':_[_0xa6a9('0x25')](_0x49e005['attributes'],function(_0x562eda){var _0x4233cf={};_0x4233cf[_0x562eda]={'$like':'%'+_0x9f373c[_0xa6a9('0x2a')][_0xa6a9('0x34')]+'%'};return _0x4233cf;})});}_0x49e005=_['merge']({},_0x49e005,_0x9f373c[_0xa6a9('0x38')]);return _0x4875c6[_0xa6a9('0x49')](_0x49e005);}})[_0xa6a9('0x21')](function(_0x4bb273){if(_0x4bb273){_0x30a9b4=_0x4bb273['length'];if(!_0x9f373c[_0xa6a9('0x2a')][_0xa6a9('0x30')]('nolimit')){_0x49e005[_0xa6a9('0x1a')]=qs[_0xa6a9('0x1a')](_0x9f373c[_0xa6a9('0x2a')][_0xa6a9('0x1a')]);_0x49e005[_0xa6a9('0x1c')]=qs['offset'](_0x9f373c[_0xa6a9('0x2a')]['offset']);}return _0x4875c6[_0xa6a9('0x49')](_0x49e005);}})['then'](function(_0x1a5635){if(_0x1a5635){return _0x1a5635?{'count':_0x30a9b4,'rows':_0x1a5635}:null;}})['then'](respondWithResult(_0x51c8b2,null))[_0xa6a9('0x3c')](handleError(_0x51c8b2,null));};exports[_0xa6a9('0x4a')]=function(_0xb65e7d,_0x7d0ecd,_0x3f6cee){var _0x5e135f={};var _0x5a248d={};var _0x19df26;var _0xd4a390;return db[_0xa6a9('0x26')]['findOne']({'where':{'id':_0xb65e7d[_0xa6a9('0x3e')]['id']}})[_0xa6a9('0x21')](handleEntityNotFound(_0x7d0ecd,null))[_0xa6a9('0x21')](function(_0x4405d4){if(_0x4405d4){_0x19df26=_0x4405d4;_0x5a248d['model']=_[_0xa6a9('0x2b')](db['FreshsalesField'][_0xa6a9('0x27')]);_0x5a248d['query']=_[_0xa6a9('0x2b')](_0xb65e7d[_0xa6a9('0x2a')]);_0x5a248d[_0xa6a9('0x2c')]=_['intersection'](_0x5a248d[_0xa6a9('0x29')],_0x5a248d[_0xa6a9('0x2a')]);_0x5e135f['attributes']=_[_0xa6a9('0x2d')](_0x5a248d['model'],qs[_0xa6a9('0x2f')](_0xb65e7d[_0xa6a9('0x2a')][_0xa6a9('0x2f')]));_0x5e135f['attributes']=_0x5e135f[_0xa6a9('0x2e')]['length']?_0x5e135f[_0xa6a9('0x2e')]:_0x5a248d['model'];_0x5e135f[_0xa6a9('0x4b')]=qs[_0xa6a9('0x32')](_0xb65e7d[_0xa6a9('0x2a')]['sort']);_0x5e135f[_0xa6a9('0x33')]=qs[_0xa6a9('0x2c')](_[_0xa6a9('0x48')](_0xb65e7d[_0xa6a9('0x2a')],_0x5a248d['filters']));if(_0xb65e7d[_0xa6a9('0x2a')][_0xa6a9('0x34')]){_0x5e135f[_0xa6a9('0x33')]=_[_0xa6a9('0x37')](_0x5e135f[_0xa6a9('0x33')],{'$or':_['map'](_0x5e135f['attributes'],function(_0x258db3){var _0x3bb862={};_0x3bb862[_0x258db3]={'$like':'%'+_0xb65e7d[_0xa6a9('0x2a')][_0xa6a9('0x34')]+'%'};return _0x3bb862;})});}_0x5e135f=_['merge']({},_0x5e135f,_0xb65e7d[_0xa6a9('0x38')]);return _0x19df26['getFields'](_0x5e135f);}})[_0xa6a9('0x21')](function(_0x2ae6ef){if(_0x2ae6ef){_0xd4a390=_0x2ae6ef[_0xa6a9('0x47')];if(!_0xb65e7d[_0xa6a9('0x2a')][_0xa6a9('0x30')](_0xa6a9('0x31'))){_0x5e135f['limit']=qs[_0xa6a9('0x1a')](_0xb65e7d[_0xa6a9('0x2a')]['limit']);_0x5e135f[_0xa6a9('0x1c')]=qs[_0xa6a9('0x1c')](_0xb65e7d[_0xa6a9('0x2a')]['offset']);}return _0x19df26[_0xa6a9('0x4a')](_0x5e135f);}})[_0xa6a9('0x21')](function(_0x564791){if(_0x564791){return _0x564791?{'count':_0xd4a390,'rows':_0x564791}:null;}})[_0xa6a9('0x21')](respondWithResult(_0x7d0ecd,null))[_0xa6a9('0x3c')](handleError(_0x7d0ecd,null));}; \ No newline at end of file +var _0x902f=['fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','FreshsalesConfiguration','findAll','rows','show','params','keys','includeAll','find','catch','create','body','update','getSubjects','findOne','getDescriptions','FreshsalesField','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save','then','destroy','stack','name','send','index','map','rawAttributes'];(function(_0x439ed7,_0x2e7626){var _0x51fc19=function(_0x1d0e70){while(--_0x1d0e70){_0x439ed7['push'](_0x439ed7['shift']());}};_0x51fc19(++_0x2e7626);}(_0x902f,0xc4));var _0xf902=function(_0x166ecf,_0x22e158){_0x166ecf=_0x166ecf-0x0;var _0x1de290=_0x902f[_0x166ecf];return _0x1de290;};'use strict';var emlformat=require(_0xf902('0x0'));var rimraf=require(_0xf902('0x1'));var zipdir=require(_0xf902('0x2'));var jsonpatch=require(_0xf902('0x3'));var rp=require(_0xf902('0x4'));var moment=require(_0xf902('0x5'));var BPromise=require(_0xf902('0x6'));var Mustache=require(_0xf902('0x7'));var util=require(_0xf902('0x8'));var path=require('path');var sox=require(_0xf902('0x9'));var csv=require(_0xf902('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf902('0xb'));var crypto=require(_0xf902('0xc'));var jsforce=require(_0xf902('0xd'));var deskjs=require(_0xf902('0xe'));var toCsv=require(_0xf902('0xa'));var querystring=require(_0xf902('0xf'));var Papa=require(_0xf902('0x10'));var Redis=require(_0xf902('0x11'));var authService=require(_0xf902('0x12'));var qs=require(_0xf902('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf902('0x14'));var logger=require(_0xf902('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5427cc,_0x3160){_0x3160=_0x3160||0xcc;return function(_0x2e3314){if(_0x2e3314){return _0x5427cc['sendStatus'](_0x3160);}return _0x5427cc[_0xf902('0x16')](_0x3160)[_0xf902('0x17')]();};}function respondWithResult(_0x4ee947,_0x3537c2){_0x3537c2=_0x3537c2||0xc8;return function(_0x5b6614){if(_0x5b6614){return _0x4ee947[_0xf902('0x16')](_0x3537c2)['json'](_0x5b6614);}};}function respondWithFilteredResult(_0x167a36,_0x3babda){return function(_0x3ba207){if(_0x3ba207){var _0x31ee4c=typeof _0x3babda[_0xf902('0x18')]==='undefined'&&typeof _0x3babda['limit']===_0xf902('0x19');var _0x50f04d=_0x3ba207['count'];var _0x2e4b8e=_0x31ee4c?0x0:_0x3babda['offset'];var _0x4494a5=_0x31ee4c?_0x3ba207[_0xf902('0x1a')]:_0x3babda[_0xf902('0x18')]+_0x3babda[_0xf902('0x1b')];var _0x565396;if(_0x4494a5>=_0x50f04d){_0x4494a5=_0x50f04d;_0x565396=0xc8;}else{_0x565396=0xce;}_0x167a36[_0xf902('0x16')](_0x565396);return _0x167a36[_0xf902('0x1c')](_0xf902('0x1d'),_0x2e4b8e+'-'+_0x4494a5+'/'+_0x50f04d)[_0xf902('0x1e')](_0x3ba207);}return null;};}function patchUpdates(_0x569235){return function(_0x36130f){try{jsonpatch['apply'](_0x36130f,_0x569235,!![]);}catch(_0xc499e2){return BPromise[_0xf902('0x1f')](_0xc499e2);}return _0x36130f[_0xf902('0x20')]();};}function saveUpdates(_0x53af3b,_0x786e09){return function(_0x214b02){if(_0x214b02){return _0x214b02['update'](_0x53af3b)[_0xf902('0x21')](function(_0x532197){return _0x532197;});}return null;};}function removeEntity(_0x2f5939,_0x51db56){return function(_0x5d5cc4){if(_0x5d5cc4){return _0x5d5cc4[_0xf902('0x22')]()[_0xf902('0x21')](function(){_0x2f5939[_0xf902('0x16')](0xcc)[_0xf902('0x17')]();});}};}function handleEntityNotFound(_0x258bb4,_0xd96901){return function(_0x48593c){if(!_0x48593c){_0x258bb4['sendStatus'](0x194);}return _0x48593c;};}function handleError(_0x367870,_0x4585a0){_0x4585a0=_0x4585a0||0x1f4;return function(_0x3858c8){logger['error'](_0x3858c8[_0xf902('0x23')]);if(_0x3858c8['name']){delete _0x3858c8[_0xf902('0x24')];}_0x367870[_0xf902('0x16')](_0x4585a0)[_0xf902('0x25')](_0x3858c8);};}exports[_0xf902('0x26')]=function(_0x1d4ee4,_0x27d8cf){var _0x1a1f2f={},_0x40bae2={},_0x5a05c1={'count':0x0,'rows':[]};var _0x486e2e=_[_0xf902('0x27')](db['FreshsalesConfiguration'][_0xf902('0x28')],function(_0x36a9fe){return{'name':_0x36a9fe[_0xf902('0x29')],'type':_0x36a9fe[_0xf902('0x2a')][_0xf902('0x2b')]};});_0x40bae2['model']=_[_0xf902('0x27')](_0x486e2e,_0xf902('0x24'));_0x40bae2[_0xf902('0x2c')]=_['keys'](_0x1d4ee4[_0xf902('0x2c')]);_0x40bae2[_0xf902('0x2d')]=_[_0xf902('0x2e')](_0x40bae2[_0xf902('0x2f')],_0x40bae2[_0xf902('0x2c')]);_0x1a1f2f[_0xf902('0x30')]=_[_0xf902('0x2e')](_0x40bae2['model'],qs[_0xf902('0x31')](_0x1d4ee4['query'][_0xf902('0x31')]));_0x1a1f2f[_0xf902('0x30')]=_0x1a1f2f[_0xf902('0x30')][_0xf902('0x32')]?_0x1a1f2f[_0xf902('0x30')]:_0x40bae2[_0xf902('0x2f')];if(!_0x1d4ee4['query'][_0xf902('0x33')](_0xf902('0x34'))){_0x1a1f2f[_0xf902('0x1b')]=qs['limit'](_0x1d4ee4[_0xf902('0x2c')][_0xf902('0x1b')]);_0x1a1f2f['offset']=qs['offset'](_0x1d4ee4[_0xf902('0x2c')][_0xf902('0x18')]);}_0x1a1f2f[_0xf902('0x35')]=qs[_0xf902('0x36')](_0x1d4ee4[_0xf902('0x2c')][_0xf902('0x36')]);_0x1a1f2f[_0xf902('0x37')]=qs['filters'](_[_0xf902('0x38')](_0x1d4ee4[_0xf902('0x2c')],_0x40bae2[_0xf902('0x2d')]),_0x486e2e);if(_0x1d4ee4['query'][_0xf902('0x39')]){_0x1a1f2f[_0xf902('0x37')]=_[_0xf902('0x3a')](_0x1a1f2f['where'],{'$or':_[_0xf902('0x27')](_0x486e2e,function(_0x3e9304){if(_0x3e9304['type']!==_0xf902('0x3b')){var _0x4f75fc={};_0x4f75fc[_0x3e9304[_0xf902('0x24')]]={'$like':'%'+_0x1d4ee4[_0xf902('0x2c')]['filter']+'%'};return _0x4f75fc;}})});}_0x1a1f2f=_[_0xf902('0x3a')]({},_0x1a1f2f,_0x1d4ee4[_0xf902('0x3c')]);var _0x3a775d={'where':_0x1a1f2f[_0xf902('0x37')]};return db['FreshsalesConfiguration']['count'](_0x3a775d)[_0xf902('0x21')](function(_0x45e5ef){_0x5a05c1[_0xf902('0x1a')]=_0x45e5ef;if(_0x1d4ee4[_0xf902('0x2c')]['includeAll']){_0x1a1f2f[_0xf902('0x3d')]=[{'all':!![]}];}return db[_0xf902('0x3e')][_0xf902('0x3f')](_0x1a1f2f);})['then'](function(_0x1f87d4){_0x5a05c1[_0xf902('0x40')]=_0x1f87d4;return _0x5a05c1;})[_0xf902('0x21')](respondWithFilteredResult(_0x27d8cf,_0x1a1f2f))['catch'](handleError(_0x27d8cf,null));};exports[_0xf902('0x41')]=function(_0x5d96f8,_0x500092){var _0x124517={'raw':![],'where':{'id':_0x5d96f8[_0xf902('0x42')]['id']}},_0x8c709f={};_0x8c709f[_0xf902('0x2f')]=_['keys'](db[_0xf902('0x3e')][_0xf902('0x28')]);_0x8c709f[_0xf902('0x2c')]=_[_0xf902('0x43')](_0x5d96f8['query']);_0x8c709f[_0xf902('0x2d')]=_[_0xf902('0x2e')](_0x8c709f[_0xf902('0x2f')],_0x8c709f[_0xf902('0x2c')]);_0x124517[_0xf902('0x30')]=_[_0xf902('0x2e')](_0x8c709f['model'],qs[_0xf902('0x31')](_0x5d96f8[_0xf902('0x2c')][_0xf902('0x31')]));_0x124517[_0xf902('0x30')]=_0x124517[_0xf902('0x30')][_0xf902('0x32')]?_0x124517['attributes']:_0x8c709f[_0xf902('0x2f')];if(_0x5d96f8[_0xf902('0x2c')][_0xf902('0x44')]){_0x124517[_0xf902('0x3d')]=[{'all':!![]}];}_0x124517=_[_0xf902('0x3a')]({},_0x124517,_0x5d96f8[_0xf902('0x3c')]);return db[_0xf902('0x3e')][_0xf902('0x45')](_0x124517)[_0xf902('0x21')](handleEntityNotFound(_0x500092,null))['then'](respondWithResult(_0x500092,null))[_0xf902('0x46')](handleError(_0x500092,null));};exports[_0xf902('0x47')]=function(_0xe3aa14,_0x345777){return db[_0xf902('0x3e')]['create'](_0xe3aa14[_0xf902('0x48')],{})[_0xf902('0x21')](respondWithResult(_0x345777,0xc9))[_0xf902('0x46')](handleError(_0x345777,null));};exports[_0xf902('0x49')]=function(_0x2d0b99,_0x26d206){if(_0x2d0b99[_0xf902('0x48')]['id']){delete _0x2d0b99[_0xf902('0x48')]['id'];}return db[_0xf902('0x3e')][_0xf902('0x45')]({'where':{'id':_0x2d0b99['params']['id']}})[_0xf902('0x21')](handleEntityNotFound(_0x26d206,null))[_0xf902('0x21')](saveUpdates(_0x2d0b99[_0xf902('0x48')],null))[_0xf902('0x21')](respondWithResult(_0x26d206,null))[_0xf902('0x46')](handleError(_0x26d206,null));};exports['destroy']=function(_0x2c27c3,_0x3c48dd){return db[_0xf902('0x3e')]['find']({'where':{'id':_0x2c27c3[_0xf902('0x42')]['id']}})['then'](handleEntityNotFound(_0x3c48dd,null))[_0xf902('0x21')](removeEntity(_0x3c48dd,null))[_0xf902('0x46')](handleError(_0x3c48dd,null));};exports[_0xf902('0x4a')]=function(_0xd05e97,_0x54d792,_0x230bb5){var _0x233b8d={};var _0xd5a0b0={};var _0x56cdcf;var _0x34cb13;return db['FreshsalesConfiguration'][_0xf902('0x4b')]({'where':{'id':_0xd05e97[_0xf902('0x42')]['id']}})[_0xf902('0x21')](handleEntityNotFound(_0x54d792,null))[_0xf902('0x21')](function(_0x4b0590){if(_0x4b0590){_0x56cdcf=_0x4b0590;_0xd5a0b0[_0xf902('0x2f')]=_[_0xf902('0x43')](db['FreshsalesField']['rawAttributes']);_0xd5a0b0[_0xf902('0x2c')]=_[_0xf902('0x43')](_0xd05e97[_0xf902('0x2c')]);_0xd5a0b0['filters']=_[_0xf902('0x2e')](_0xd5a0b0[_0xf902('0x2f')],_0xd5a0b0['query']);_0x233b8d[_0xf902('0x30')]=_['intersection'](_0xd5a0b0['model'],qs[_0xf902('0x31')](_0xd05e97['query'][_0xf902('0x31')]));_0x233b8d['attributes']=_0x233b8d['attributes'][_0xf902('0x32')]?_0x233b8d[_0xf902('0x30')]:_0xd5a0b0[_0xf902('0x2f')];_0x233b8d['order']=qs[_0xf902('0x36')](_0xd05e97['query'][_0xf902('0x36')]);_0x233b8d[_0xf902('0x37')]=qs[_0xf902('0x2d')](_['pick'](_0xd05e97[_0xf902('0x2c')],_0xd5a0b0[_0xf902('0x2d')]));if(_0xd05e97['query'][_0xf902('0x39')]){_0x233b8d[_0xf902('0x37')]=_['merge'](_0x233b8d[_0xf902('0x37')],{'$or':_[_0xf902('0x27')](_0x233b8d[_0xf902('0x30')],function(_0x581c6c){var _0x59e9a8={};_0x59e9a8[_0x581c6c]={'$like':'%'+_0xd05e97['query'][_0xf902('0x39')]+'%'};return _0x59e9a8;})});}_0x233b8d=_['merge']({},_0x233b8d,_0xd05e97[_0xf902('0x3c')]);return _0x56cdcf[_0xf902('0x4a')](_0x233b8d);}})['then'](function(_0x688bf4){if(_0x688bf4){_0x34cb13=_0x688bf4[_0xf902('0x32')];if(!_0xd05e97[_0xf902('0x2c')][_0xf902('0x33')](_0xf902('0x34'))){_0x233b8d[_0xf902('0x1b')]=qs[_0xf902('0x1b')](_0xd05e97[_0xf902('0x2c')][_0xf902('0x1b')]);_0x233b8d['offset']=qs[_0xf902('0x18')](_0xd05e97[_0xf902('0x2c')][_0xf902('0x18')]);}return _0x56cdcf[_0xf902('0x4a')](_0x233b8d);}})[_0xf902('0x21')](function(_0x652197){if(_0x652197){return _0x652197?{'count':_0x34cb13,'rows':_0x652197}:null;}})[_0xf902('0x21')](respondWithResult(_0x54d792,null))['catch'](handleError(_0x54d792,null));};exports[_0xf902('0x4c')]=function(_0x35cb57,_0x15913c,_0xa4981a){var _0xcadae6={};var _0x534560={};var _0xc37b09;var _0x3ebea5;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x35cb57[_0xf902('0x42')]['id']}})[_0xf902('0x21')](handleEntityNotFound(_0x15913c,null))['then'](function(_0x94c8af){if(_0x94c8af){_0xc37b09=_0x94c8af;_0x534560[_0xf902('0x2f')]=_[_0xf902('0x43')](db[_0xf902('0x4d')][_0xf902('0x28')]);_0x534560[_0xf902('0x2c')]=_['keys'](_0x35cb57['query']);_0x534560['filters']=_[_0xf902('0x2e')](_0x534560[_0xf902('0x2f')],_0x534560[_0xf902('0x2c')]);_0xcadae6[_0xf902('0x30')]=_['intersection'](_0x534560['model'],qs[_0xf902('0x31')](_0x35cb57[_0xf902('0x2c')][_0xf902('0x31')]));_0xcadae6[_0xf902('0x30')]=_0xcadae6['attributes'][_0xf902('0x32')]?_0xcadae6[_0xf902('0x30')]:_0x534560[_0xf902('0x2f')];_0xcadae6[_0xf902('0x35')]=qs['sort'](_0x35cb57[_0xf902('0x2c')][_0xf902('0x36')]);_0xcadae6['where']=qs[_0xf902('0x2d')](_[_0xf902('0x38')](_0x35cb57[_0xf902('0x2c')],_0x534560[_0xf902('0x2d')]));if(_0x35cb57[_0xf902('0x2c')][_0xf902('0x39')]){_0xcadae6[_0xf902('0x37')]=_['merge'](_0xcadae6[_0xf902('0x37')],{'$or':_[_0xf902('0x27')](_0xcadae6[_0xf902('0x30')],function(_0x10caea){var _0x18bb2a={};_0x18bb2a[_0x10caea]={'$like':'%'+_0x35cb57[_0xf902('0x2c')][_0xf902('0x39')]+'%'};return _0x18bb2a;})});}_0xcadae6=_[_0xf902('0x3a')]({},_0xcadae6,_0x35cb57['options']);return _0xc37b09[_0xf902('0x4c')](_0xcadae6);}})[_0xf902('0x21')](function(_0x715c5e){if(_0x715c5e){_0x3ebea5=_0x715c5e[_0xf902('0x32')];if(!_0x35cb57['query'][_0xf902('0x33')](_0xf902('0x34'))){_0xcadae6[_0xf902('0x1b')]=qs[_0xf902('0x1b')](_0x35cb57[_0xf902('0x2c')]['limit']);_0xcadae6[_0xf902('0x18')]=qs[_0xf902('0x18')](_0x35cb57[_0xf902('0x2c')][_0xf902('0x18')]);}return _0xc37b09['getDescriptions'](_0xcadae6);}})[_0xf902('0x21')](function(_0x428a06){if(_0x428a06){return _0x428a06?{'count':_0x3ebea5,'rows':_0x428a06}:null;}})[_0xf902('0x21')](respondWithResult(_0x15913c,null))['catch'](handleError(_0x15913c,null));};exports['getFields']=function(_0x53424e,_0x122cb7,_0x48de9c){var _0x5bfbeb={};var _0x5d245d={};var _0x17e450;var _0x595da6;return db[_0xf902('0x3e')][_0xf902('0x4b')]({'where':{'id':_0x53424e[_0xf902('0x42')]['id']}})[_0xf902('0x21')](handleEntityNotFound(_0x122cb7,null))[_0xf902('0x21')](function(_0x3dd27f){if(_0x3dd27f){_0x17e450=_0x3dd27f;_0x5d245d[_0xf902('0x2f')]=_[_0xf902('0x43')](db[_0xf902('0x4d')][_0xf902('0x28')]);_0x5d245d[_0xf902('0x2c')]=_['keys'](_0x53424e[_0xf902('0x2c')]);_0x5d245d[_0xf902('0x2d')]=_[_0xf902('0x2e')](_0x5d245d[_0xf902('0x2f')],_0x5d245d[_0xf902('0x2c')]);_0x5bfbeb[_0xf902('0x30')]=_[_0xf902('0x2e')](_0x5d245d[_0xf902('0x2f')],qs['fields'](_0x53424e[_0xf902('0x2c')]['fields']));_0x5bfbeb[_0xf902('0x30')]=_0x5bfbeb['attributes'][_0xf902('0x32')]?_0x5bfbeb[_0xf902('0x30')]:_0x5d245d[_0xf902('0x2f')];_0x5bfbeb[_0xf902('0x35')]=qs[_0xf902('0x36')](_0x53424e[_0xf902('0x2c')][_0xf902('0x36')]);_0x5bfbeb[_0xf902('0x37')]=qs['filters'](_[_0xf902('0x38')](_0x53424e[_0xf902('0x2c')],_0x5d245d['filters']));if(_0x53424e[_0xf902('0x2c')][_0xf902('0x39')]){_0x5bfbeb['where']=_['merge'](_0x5bfbeb[_0xf902('0x37')],{'$or':_[_0xf902('0x27')](_0x5bfbeb[_0xf902('0x30')],function(_0x203692){var _0x4bdf91={};_0x4bdf91[_0x203692]={'$like':'%'+_0x53424e[_0xf902('0x2c')]['filter']+'%'};return _0x4bdf91;})});}_0x5bfbeb=_['merge']({},_0x5bfbeb,_0x53424e[_0xf902('0x3c')]);return _0x17e450[_0xf902('0x4e')](_0x5bfbeb);}})[_0xf902('0x21')](function(_0x507cae){if(_0x507cae){_0x595da6=_0x507cae[_0xf902('0x32')];if(!_0x53424e[_0xf902('0x2c')][_0xf902('0x33')](_0xf902('0x34'))){_0x5bfbeb[_0xf902('0x1b')]=qs[_0xf902('0x1b')](_0x53424e['query'][_0xf902('0x1b')]);_0x5bfbeb[_0xf902('0x18')]=qs[_0xf902('0x18')](_0x53424e[_0xf902('0x2c')]['offset']);}return _0x17e450['getFields'](_0x5bfbeb);}})['then'](function(_0x1515f2){if(_0x1515f2){return _0x1515f2?{'count':_0x595da6,'rows':_0x1515f2}:null;}})[_0xf902('0x21')](respondWithResult(_0x122cb7,null))['catch'](handleError(_0x122cb7,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index c9bb21e..782dc0f 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 _0x5151=['request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','int_freshsales_configurations','lodash','../../config/logger','moment','bluebird'];(function(_0x15f19f,_0xd9027a){var _0x2ed294=function(_0x2e0b6c){while(--_0x2e0b6c){_0x15f19f['push'](_0x15f19f['shift']());}};_0x2ed294(++_0xd9027a);}(_0x5151,0x1b8));var _0x1515=function(_0x3f86e1,_0x54058b){_0x3f86e1=_0x3f86e1-0x0;var _0x374229=_0x5151[_0x3f86e1];return _0x374229;};'use strict';var _=require(_0x1515('0x0'));var util=require('util');var logger=require(_0x1515('0x1'))('api');var moment=require(_0x1515('0x2'));var BPromise=require(_0x1515('0x3'));var rp=require(_0x1515('0x4'));var fs=require('fs');var path=require(_0x1515('0x5'));var rimraf=require(_0x1515('0x6'));var config=require(_0x1515('0x7'));var attributes=require(_0x1515('0x8'));module[_0x1515('0x9')]=function(_0x45e1a7,_0x4e09ea){return _0x45e1a7[_0x1515('0xa')]('FreshsalesConfiguration',attributes,{'tableName':_0x1515('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf4af=['FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf4af,0x7a));var _0xff4a=function(_0x24507a,_0x58e59b){_0x24507a=_0x24507a-0x0;var _0x20ed6a=_0xf4af[_0x24507a];return _0x20ed6a;};'use strict';var _=require(_0xff4a('0x0'));var util=require(_0xff4a('0x1'));var logger=require(_0xff4a('0x2'))(_0xff4a('0x3'));var moment=require(_0xff4a('0x4'));var BPromise=require(_0xff4a('0x5'));var rp=require(_0xff4a('0x6'));var fs=require('fs');var path=require(_0xff4a('0x7'));var rimraf=require(_0xff4a('0x8'));var config=require(_0xff4a('0x9'));var attributes=require(_0xff4a('0xa'));module[_0xff4a('0xb')]=function(_0x4b84ac,_0x188127){return _0x4b84ac[_0xff4a('0xc')](_0xff4a('0xd'),attributes,{'tableName':_0xff4a('0xe'),'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 172d25b..0b050e7 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 _0x10d6=['request','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x190725,_0x4c879f){var _0x4fe2de=function(_0x1d7d72){while(--_0x1d7d72){_0x190725['push'](_0x190725['shift']());}};_0x4fe2de(++_0x4c879f);}(_0x10d6,0x109));var _0x610d=function(_0x276215,_0x38e321){_0x276215=_0x276215-0x0;var _0x51b13b=_0x10d6[_0x276215];return _0x51b13b;};'use strict';var _=require(_0x610d('0x0'));var util=require(_0x610d('0x1'));var moment=require('moment');var BPromise=require(_0x610d('0x2'));var rs=require(_0x610d('0x3'));var fs=require('fs');var Redis=require(_0x610d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x610d('0x5'));var logger=require(_0x610d('0x6'))(_0x610d('0x7'));var config=require(_0x610d('0x8'));var jayson=require(_0x610d('0x9'));var client=jayson[_0x610d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3da5c3,_0x4397af,_0x3a3f28){return new BPromise(function(_0x17fd1c,_0x15bc3c){return client[_0x610d('0xb')](_0x3da5c3,_0x3a3f28)[_0x610d('0xc')](function(_0xa37f02){logger['info'](_0x610d('0xd'),_0x4397af,_0x610d('0xe'));logger[_0x610d('0xf')](_0x610d('0x10'),_0x4397af,_0x610d('0xe'),JSON[_0x610d('0x11')](_0xa37f02));if(_0xa37f02['error']){if(_0xa37f02['error'][_0x610d('0x12')]===0x1f4){logger[_0x610d('0x13')](_0x610d('0xd'),_0x4397af,_0xa37f02[_0x610d('0x13')][_0x610d('0x14')]);return _0x15bc3c(_0xa37f02['error'][_0x610d('0x14')]);}logger[_0x610d('0x13')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4397af,_0xa37f02[_0x610d('0x13')][_0x610d('0x14')]);return _0x17fd1c(_0xa37f02[_0x610d('0x13')][_0x610d('0x14')]);}else{logger['info'](_0x610d('0xd'),_0x4397af,_0x610d('0xe'));_0x17fd1c(_0xa37f02[_0x610d('0x15')]['message']);}})[_0x610d('0x16')](function(_0x5c5c86){logger[_0x610d('0x13')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4397af,_0x5c5c86);_0x15bc3c(_0x5c5c86);});});} \ No newline at end of file +var _0xf2aa=['jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','FreshsalesConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x31c853,_0x132dc9){var _0x1cd0af=function(_0x566446){while(--_0x566446){_0x31c853['push'](_0x31c853['shift']());}};_0x1cd0af(++_0x132dc9);}(_0xf2aa,0x6e));var _0xaf2a=function(_0x495961,_0x288bb8){_0x495961=_0x495961-0x0;var _0x50f161=_0xf2aa[_0x495961];return _0x50f161;};'use strict';var _=require(_0xaf2a('0x0'));var util=require(_0xaf2a('0x1'));var moment=require(_0xaf2a('0x2'));var BPromise=require('bluebird');var rs=require(_0xaf2a('0x3'));var fs=require('fs');var Redis=require(_0xaf2a('0x4'));var db=require(_0xaf2a('0x5'))['db'];var utils=require(_0xaf2a('0x6'));var logger=require(_0xaf2a('0x7'))(_0xaf2a('0x8'));var config=require(_0xaf2a('0x9'));var jayson=require(_0xaf2a('0xa'));var client=jayson[_0xaf2a('0xb')][_0xaf2a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x58d9bf,_0x41bbd3,_0x1c8f4c){return new BPromise(function(_0x4614c1,_0xcd43f5){return client[_0xaf2a('0xd')](_0x58d9bf,_0x1c8f4c)[_0xaf2a('0xe')](function(_0x3080cc){logger[_0xaf2a('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x41bbd3,_0xaf2a('0x10'));logger[_0xaf2a('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x41bbd3,_0xaf2a('0x10'),JSON[_0xaf2a('0x12')](_0x3080cc));if(_0x3080cc[_0xaf2a('0x13')]){if(_0x3080cc[_0xaf2a('0x13')]['code']===0x1f4){logger['error'](_0xaf2a('0x14'),_0x41bbd3,_0x3080cc['error'][_0xaf2a('0x15')]);return _0xcd43f5(_0x3080cc[_0xaf2a('0x13')][_0xaf2a('0x15')]);}logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x41bbd3,_0x3080cc[_0xaf2a('0x13')][_0xaf2a('0x15')]);return _0x4614c1(_0x3080cc['error'][_0xaf2a('0x15')]);}else{logger[_0xaf2a('0xf')](_0xaf2a('0x14'),_0x41bbd3,'request\x20sent');_0x4614c1(_0x3080cc[_0xaf2a('0x16')][_0xaf2a('0x15')]);}})[_0xaf2a('0x17')](function(_0x16daeb){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x41bbd3,_0x16daeb);_0xcd43f5(_0x16daeb);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 3436fce..1a1bb6c 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 _0x867f=['delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','post','create','put','update'];(function(_0x62726d,_0x287c60){var _0x16513d=function(_0x5b56fb){while(--_0x5b56fb){_0x62726d['push'](_0x62726d['shift']());}};_0x16513d(++_0x287c60);}(_0x867f,0xe6));var _0xf867=function(_0x4fcbbe,_0x55a068){_0x4fcbbe=_0x4fcbbe-0x0;var _0x2ac729=_0x867f[_0x4fcbbe];return _0x2ac729;};'use strict';var multer=require(_0xf867('0x0'));var util=require(_0xf867('0x1'));var path=require(_0xf867('0x2'));var timeout=require(_0xf867('0x3'));var express=require(_0xf867('0x4'));var router=express[_0xf867('0x5')]();var fs_extra=require(_0xf867('0x6'));var auth=require(_0xf867('0x7'));var interaction=require(_0xf867('0x8'));var config=require('../../config/environment');var controller=require('./intFreshsalesField.controller');router[_0xf867('0x9')]('/',auth[_0xf867('0xa')](),controller[_0xf867('0xb')]);router[_0xf867('0x9')](_0xf867('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xf867('0xd')]('/',auth['isAuthenticated'](),controller[_0xf867('0xe')]);router[_0xf867('0xf')](_0xf867('0xc'),auth[_0xf867('0xa')](),controller[_0xf867('0x10')]);router[_0xf867('0x11')](_0xf867('0xc'),auth[_0xf867('0xa')](),controller['destroy']);module[_0xf867('0x12')]=router; \ No newline at end of file +var _0xcb18=['/:id','update','delete','destroy','exports','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','index','isAuthenticated','post','put'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xcb18,0x159));var _0x8cb1=function(_0x5ae938,_0x3b121a){_0x5ae938=_0x5ae938-0x0;var _0x7a3a5f=_0xcb18[_0x5ae938];return _0x7a3a5f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8cb1('0x0'));var timeout=require('connect-timeout');var express=require(_0x8cb1('0x1'));var router=express['Router']();var fs_extra=require(_0x8cb1('0x2'));var auth=require(_0x8cb1('0x3'));var interaction=require(_0x8cb1('0x4'));var config=require(_0x8cb1('0x5'));var controller=require(_0x8cb1('0x6'));router[_0x8cb1('0x7')]('/',auth['isAuthenticated'](),controller[_0x8cb1('0x8')]);router[_0x8cb1('0x7')]('/:id',auth[_0x8cb1('0x9')](),controller['show']);router[_0x8cb1('0xa')]('/',auth[_0x8cb1('0x9')](),controller['create']);router[_0x8cb1('0xb')](_0x8cb1('0xc'),auth[_0x8cb1('0x9')](),controller[_0x8cb1('0xd')]);router[_0x8cb1('0xe')]('/:id',auth[_0x8cb1('0x9')](),controller[_0x8cb1('0xf')]);module[_0x8cb1('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index f2823d4..426a38c 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 _0x0e5c=['string','variable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x229ec7,_0x545b80){var _0x2dc48e=function(_0x4b4c16){while(--_0x4b4c16){_0x229ec7['push'](_0x229ec7['shift']());}};_0x2dc48e(++_0x545b80);}(_0x0e5c,0xde));var _0xc0e5=function(_0x164760,_0x5874b0){_0x164760=_0x164760-0x0;var _0x8b91b2=_0x0e5c[_0x164760];return _0x8b91b2;};'use strict';var Sequelize=require(_0xc0e5('0x0'));module[_0xc0e5('0x1')]={'type':{'type':Sequelize[_0xc0e5('0x2')](_0xc0e5('0x3'),_0xc0e5('0x4'),'customVariable',_0xc0e5('0x5'),_0xc0e5('0x6')),'defaultValue':_0xc0e5('0x3')},'content':{'type':Sequelize[_0xc0e5('0x7')]},'key':{'type':Sequelize[_0xc0e5('0x7')]},'keyType':{'type':Sequelize[_0xc0e5('0x2')](_0xc0e5('0x3'),_0xc0e5('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xc0e5('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xc0e5('0x7')]},'customField':{'type':Sequelize[_0xc0e5('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc0e5('0x7')]}}; \ No newline at end of file +var _0xd63d=['string','variable','keyValue','STRING','customVariable','BOOLEAN','ENUM'];(function(_0x4b1cd6,_0x3a55dc){var _0x56866a=function(_0x12b2eb){while(--_0x12b2eb){_0x4b1cd6['push'](_0x4b1cd6['shift']());}};_0x56866a(++_0x3a55dc);}(_0xd63d,0x16b));var _0xdd63=function(_0x3747ae,_0x408e61){_0x3747ae=_0x3747ae-0x0;var _0x339035=_0xd63d[_0x3747ae];return _0x339035;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xdd63('0x0')](_0xdd63('0x1'),_0xdd63('0x2'),'customVariable',_0xdd63('0x3'),'picklist'),'defaultValue':_0xdd63('0x1')},'content':{'type':Sequelize[_0xdd63('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xdd63('0x0')](_0xdd63('0x1'),_0xdd63('0x2'),_0xdd63('0x5'))},'keyContent':{'type':Sequelize[_0xdd63('0x4')]},'idField':{'type':Sequelize[_0xdd63('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xdd63('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdd63('0x4')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 3ec8df3..7c0da1f 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 _0x850d=['../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','sendStatus','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','includeAll','include','FreshsalesField','findAll','rows','catch','show','params','options','create','body','find','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x699d95,_0xcb4fa0){var _0x29ab27=function(_0x36497e){while(--_0x36497e){_0x699d95['push'](_0x699d95['shift']());}};_0x29ab27(++_0xcb4fa0);}(_0x850d,0x1e3));var _0xd850=function(_0xd307d9,_0x50e8e0){_0xd307d9=_0xd307d9-0x0;var _0x209bf8=_0x850d[_0xd307d9];return _0x209bf8;};'use strict';var emlformat=require(_0xd850('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd850('0x1'));var rp=require(_0xd850('0x2'));var moment=require(_0xd850('0x3'));var BPromise=require(_0xd850('0x4'));var Mustache=require(_0xd850('0x5'));var util=require(_0xd850('0x6'));var path=require(_0xd850('0x7'));var sox=require(_0xd850('0x8'));var csv=require(_0xd850('0x9'));var ejs=require(_0xd850('0xa'));var fs=require('fs');var fs_extra=require(_0xd850('0xb'));var _=require('lodash');var squel=require(_0xd850('0xc'));var crypto=require(_0xd850('0xd'));var jsforce=require(_0xd850('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd850('0x9'));var querystring=require(_0xd850('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd850('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd850('0x11'))(_0xd850('0x12'));var utils=require(_0xd850('0x13'));var config=require(_0xd850('0x14'));var licenseUtil=require(_0xd850('0x15'));var db=require(_0xd850('0x16'))['db'];function respondWithStatusCode(_0x25e099,_0x34c6e4){_0x34c6e4=_0x34c6e4||0xcc;return function(_0xb19ddf){if(_0xb19ddf){return _0x25e099['sendStatus'](_0x34c6e4);}return _0x25e099[_0xd850('0x17')](_0x34c6e4)[_0xd850('0x18')]();};}function respondWithResult(_0x5de252,_0x59eca5){_0x59eca5=_0x59eca5||0xc8;return function(_0xc5d4d7){if(_0xc5d4d7){return _0x5de252[_0xd850('0x17')](_0x59eca5)[_0xd850('0x19')](_0xc5d4d7);}};}function respondWithFilteredResult(_0x29ec1f,_0x4dde44){return function(_0x14bcad){if(_0x14bcad){var _0x1f5f85=typeof _0x4dde44[_0xd850('0x1a')]===_0xd850('0x1b')&&typeof _0x4dde44[_0xd850('0x1c')]===_0xd850('0x1b');var _0x24cf31=_0x14bcad['count'];var _0x1cb83d=_0x1f5f85?0x0:_0x4dde44[_0xd850('0x1a')];var _0x145399=_0x1f5f85?_0x14bcad[_0xd850('0x1d')]:_0x4dde44[_0xd850('0x1a')]+_0x4dde44[_0xd850('0x1c')];var _0x3c8902;if(_0x145399>=_0x24cf31){_0x145399=_0x24cf31;_0x3c8902=0xc8;}else{_0x3c8902=0xce;}_0x29ec1f[_0xd850('0x17')](_0x3c8902);return _0x29ec1f[_0xd850('0x1e')](_0xd850('0x1f'),_0x1cb83d+'-'+_0x145399+'/'+_0x24cf31)[_0xd850('0x19')](_0x14bcad);}return null;};}function patchUpdates(_0x18c402){return function(_0x34f751){try{jsonpatch[_0xd850('0x20')](_0x34f751,_0x18c402,!![]);}catch(_0x516830){return BPromise[_0xd850('0x21')](_0x516830);}return _0x34f751['save']();};}function saveUpdates(_0x3af5db,_0x4efcf5){return function(_0x69de17){if(_0x69de17){return _0x69de17['update'](_0x3af5db)[_0xd850('0x22')](function(_0x5f2393){return _0x5f2393;});}return null;};}function removeEntity(_0x521143,_0x38ee45){return function(_0x58e1a9){if(_0x58e1a9){return _0x58e1a9[_0xd850('0x23')]()[_0xd850('0x22')](function(){_0x521143[_0xd850('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x768e54,_0x35a857){return function(_0x132187){if(!_0x132187){_0x768e54[_0xd850('0x24')](0x194);}return _0x132187;};}function handleError(_0xa0048f,_0x599f00){_0x599f00=_0x599f00||0x1f4;return function(_0x251d98){logger['error'](_0x251d98[_0xd850('0x25')]);if(_0x251d98[_0xd850('0x26')]){delete _0x251d98[_0xd850('0x26')];}_0xa0048f['status'](_0x599f00)[_0xd850('0x27')](_0x251d98);};}exports['index']=function(_0x57f685,_0x2eddd1){var _0x25bd68={},_0xee3914={},_0x4e0e9f={'count':0x0,'rows':[]};var _0x4d31bc=_[_0xd850('0x28')](db['FreshsalesField'][_0xd850('0x29')],function(_0x1ff843){return{'name':_0x1ff843[_0xd850('0x2a')],'type':_0x1ff843[_0xd850('0x2b')]['key']};});_0xee3914[_0xd850('0x2c')]=_[_0xd850('0x28')](_0x4d31bc,_0xd850('0x26'));_0xee3914[_0xd850('0x2d')]=_[_0xd850('0x2e')](_0x57f685[_0xd850('0x2d')]);_0xee3914[_0xd850('0x2f')]=_[_0xd850('0x30')](_0xee3914[_0xd850('0x2c')],_0xee3914[_0xd850('0x2d')]);_0x25bd68[_0xd850('0x31')]=_[_0xd850('0x30')](_0xee3914[_0xd850('0x2c')],qs[_0xd850('0x32')](_0x57f685[_0xd850('0x2d')][_0xd850('0x32')]));_0x25bd68[_0xd850('0x31')]=_0x25bd68['attributes'][_0xd850('0x33')]?_0x25bd68['attributes']:_0xee3914[_0xd850('0x2c')];if(!_0x57f685['query'][_0xd850('0x34')](_0xd850('0x35'))){_0x25bd68['limit']=qs['limit'](_0x57f685[_0xd850('0x2d')][_0xd850('0x1c')]);_0x25bd68[_0xd850('0x1a')]=qs[_0xd850('0x1a')](_0x57f685['query']['offset']);}_0x25bd68[_0xd850('0x36')]=qs[_0xd850('0x37')](_0x57f685[_0xd850('0x2d')][_0xd850('0x37')]);_0x25bd68['where']=qs[_0xd850('0x2f')](_[_0xd850('0x38')](_0x57f685[_0xd850('0x2d')],_0xee3914['filters']),_0x4d31bc);if(_0x57f685[_0xd850('0x2d')][_0xd850('0x39')]){_0x25bd68[_0xd850('0x3a')]=_[_0xd850('0x3b')](_0x25bd68[_0xd850('0x3a')],{'$or':_[_0xd850('0x28')](_0x4d31bc,function(_0x38f538){if(_0x38f538[_0xd850('0x2b')]!=='VIRTUAL'){var _0x42e4b9={};_0x42e4b9[_0x38f538['name']]={'$like':'%'+_0x57f685[_0xd850('0x2d')][_0xd850('0x39')]+'%'};return _0x42e4b9;}})});}_0x25bd68=_[_0xd850('0x3b')]({},_0x25bd68,_0x57f685['options']);var _0x3503ea={'where':_0x25bd68[_0xd850('0x3a')]};return db['FreshsalesField'][_0xd850('0x1d')](_0x3503ea)[_0xd850('0x22')](function(_0x512346){_0x4e0e9f[_0xd850('0x1d')]=_0x512346;if(_0x57f685[_0xd850('0x2d')][_0xd850('0x3c')]){_0x25bd68[_0xd850('0x3d')]=[{'all':!![]}];}return db[_0xd850('0x3e')][_0xd850('0x3f')](_0x25bd68);})[_0xd850('0x22')](function(_0x485ae4){_0x4e0e9f[_0xd850('0x40')]=_0x485ae4;return _0x4e0e9f;})[_0xd850('0x22')](respondWithFilteredResult(_0x2eddd1,_0x25bd68))[_0xd850('0x41')](handleError(_0x2eddd1,null));};exports[_0xd850('0x42')]=function(_0x36b4f7,_0x2c6dd0){var _0x347aa5={'raw':!![],'where':{'id':_0x36b4f7[_0xd850('0x43')]['id']}},_0x5f1522={};_0x5f1522[_0xd850('0x2c')]=_[_0xd850('0x2e')](db[_0xd850('0x3e')][_0xd850('0x29')]);_0x5f1522[_0xd850('0x2d')]=_['keys'](_0x36b4f7[_0xd850('0x2d')]);_0x5f1522[_0xd850('0x2f')]=_[_0xd850('0x30')](_0x5f1522[_0xd850('0x2c')],_0x5f1522[_0xd850('0x2d')]);_0x347aa5[_0xd850('0x31')]=_[_0xd850('0x30')](_0x5f1522[_0xd850('0x2c')],qs[_0xd850('0x32')](_0x36b4f7[_0xd850('0x2d')][_0xd850('0x32')]));_0x347aa5[_0xd850('0x31')]=_0x347aa5[_0xd850('0x31')][_0xd850('0x33')]?_0x347aa5[_0xd850('0x31')]:_0x5f1522['model'];if(_0x36b4f7['query'][_0xd850('0x3c')]){_0x347aa5['include']=[{'all':!![]}];}_0x347aa5=_[_0xd850('0x3b')]({},_0x347aa5,_0x36b4f7[_0xd850('0x44')]);return db[_0xd850('0x3e')]['find'](_0x347aa5)[_0xd850('0x22')](handleEntityNotFound(_0x2c6dd0,null))['then'](respondWithResult(_0x2c6dd0,null))['catch'](handleError(_0x2c6dd0,null));};exports[_0xd850('0x45')]=function(_0x15c707,_0x18e2d9){return db['FreshsalesField'][_0xd850('0x45')](_0x15c707[_0xd850('0x46')],{})[_0xd850('0x22')](respondWithResult(_0x18e2d9,0xc9))[_0xd850('0x41')](handleError(_0x18e2d9,null));};exports['update']=function(_0x4a3253,_0x1efa46){if(_0x4a3253[_0xd850('0x46')]['id']){delete _0x4a3253['body']['id'];}return db[_0xd850('0x3e')][_0xd850('0x47')]({'where':{'id':_0x4a3253[_0xd850('0x43')]['id']}})[_0xd850('0x22')](handleEntityNotFound(_0x1efa46,null))['then'](saveUpdates(_0x4a3253[_0xd850('0x46')],null))['then'](respondWithResult(_0x1efa46,null))['catch'](handleError(_0x1efa46,null));};exports[_0xd850('0x23')]=function(_0xfdd782,_0x1ad803){return db['FreshsalesField']['find']({'where':{'id':_0xfdd782['params']['id']}})[_0xd850('0x22')](handleEntityNotFound(_0x1ad803,null))[_0xd850('0x22')](removeEntity(_0x1ad803,null))[_0xd850('0x41')](handleError(_0x1ad803,null));}; \ No newline at end of file +var _0xb0d1=['../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','sendStatus','error','stack','name','map','FreshsalesField','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','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','../../config/environment','../../config/license/util'];(function(_0x1e89c6,_0x46209d){var _0x54f85b=function(_0x2a0893){while(--_0x2a0893){_0x1e89c6['push'](_0x1e89c6['shift']());}};_0x54f85b(++_0x46209d);}(_0xb0d1,0x166));var _0x1b0d=function(_0xe6576d,_0x366b0a){_0xe6576d=_0xe6576d-0x0;var _0x127ba6=_0xb0d1[_0xe6576d];return _0x127ba6;};'use strict';var emlformat=require(_0x1b0d('0x0'));var rimraf=require(_0x1b0d('0x1'));var zipdir=require(_0x1b0d('0x2'));var jsonpatch=require(_0x1b0d('0x3'));var rp=require(_0x1b0d('0x4'));var moment=require(_0x1b0d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1b0d('0x6'));var util=require('util');var path=require(_0x1b0d('0x7'));var sox=require(_0x1b0d('0x8'));var csv=require(_0x1b0d('0x9'));var ejs=require(_0x1b0d('0xa'));var fs=require('fs');var fs_extra=require(_0x1b0d('0xb'));var _=require(_0x1b0d('0xc'));var squel=require(_0x1b0d('0xd'));var crypto=require(_0x1b0d('0xe'));var jsforce=require(_0x1b0d('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x1b0d('0x9'));var querystring=require('querystring');var Papa=require(_0x1b0d('0x10'));var Redis=require(_0x1b0d('0x11'));var authService=require(_0x1b0d('0x12'));var qs=require(_0x1b0d('0x13'));var as=require(_0x1b0d('0x14'));var hardwareService=require(_0x1b0d('0x15'));var logger=require(_0x1b0d('0x16'))(_0x1b0d('0x17'));var utils=require(_0x1b0d('0x18'));var config=require(_0x1b0d('0x19'));var licenseUtil=require(_0x1b0d('0x1a'));var db=require(_0x1b0d('0x1b'))['db'];function respondWithStatusCode(_0x36368a,_0x395ade){_0x395ade=_0x395ade||0xcc;return function(_0xe00c5c){if(_0xe00c5c){return _0x36368a['sendStatus'](_0x395ade);}return _0x36368a[_0x1b0d('0x1c')](_0x395ade)[_0x1b0d('0x1d')]();};}function respondWithResult(_0x3d7554,_0x4b25c7){_0x4b25c7=_0x4b25c7||0xc8;return function(_0x3205af){if(_0x3205af){return _0x3d7554[_0x1b0d('0x1c')](_0x4b25c7)[_0x1b0d('0x1e')](_0x3205af);}};}function respondWithFilteredResult(_0x43e6ad,_0x275267){return function(_0x4dd092){if(_0x4dd092){var _0x47bfdf=typeof _0x275267[_0x1b0d('0x1f')]===_0x1b0d('0x20')&&typeof _0x275267[_0x1b0d('0x21')]===_0x1b0d('0x20');var _0x511be3=_0x4dd092[_0x1b0d('0x22')];var _0x5a8bf5=_0x47bfdf?0x0:_0x275267[_0x1b0d('0x1f')];var _0x4abb24=_0x47bfdf?_0x4dd092[_0x1b0d('0x22')]:_0x275267['offset']+_0x275267[_0x1b0d('0x21')];var _0x5e8e03;if(_0x4abb24>=_0x511be3){_0x4abb24=_0x511be3;_0x5e8e03=0xc8;}else{_0x5e8e03=0xce;}_0x43e6ad[_0x1b0d('0x1c')](_0x5e8e03);return _0x43e6ad[_0x1b0d('0x23')](_0x1b0d('0x24'),_0x5a8bf5+'-'+_0x4abb24+'/'+_0x511be3)['json'](_0x4dd092);}return null;};}function patchUpdates(_0x44b41b){return function(_0x3c2bdd){try{jsonpatch[_0x1b0d('0x25')](_0x3c2bdd,_0x44b41b,!![]);}catch(_0x2fb543){return BPromise[_0x1b0d('0x26')](_0x2fb543);}return _0x3c2bdd['save']();};}function saveUpdates(_0x465019,_0x1cf99e){return function(_0x52a05a){if(_0x52a05a){return _0x52a05a['update'](_0x465019)['then'](function(_0x2031ac){return _0x2031ac;});}return null;};}function removeEntity(_0x993276,_0x87cf23){return function(_0x34b909){if(_0x34b909){return _0x34b909['destroy']()[_0x1b0d('0x27')](function(){_0x993276[_0x1b0d('0x1c')](0xcc)[_0x1b0d('0x1d')]();});}};}function handleEntityNotFound(_0x4e86a2,_0x12aa43){return function(_0x2e74de){if(!_0x2e74de){_0x4e86a2[_0x1b0d('0x28')](0x194);}return _0x2e74de;};}function handleError(_0x5ad544,_0x4ae5d5){_0x4ae5d5=_0x4ae5d5||0x1f4;return function(_0x25f3d0){logger[_0x1b0d('0x29')](_0x25f3d0[_0x1b0d('0x2a')]);if(_0x25f3d0[_0x1b0d('0x2b')]){delete _0x25f3d0[_0x1b0d('0x2b')];}_0x5ad544[_0x1b0d('0x1c')](_0x4ae5d5)['send'](_0x25f3d0);};}exports['index']=function(_0x1cdd96,_0x3d3703){var _0x1cb776={},_0x3a4e8b={},_0x4065d6={'count':0x0,'rows':[]};var _0x3ca87f=_[_0x1b0d('0x2c')](db[_0x1b0d('0x2d')][_0x1b0d('0x2e')],function(_0xce1f8f){return{'name':_0xce1f8f[_0x1b0d('0x2f')],'type':_0xce1f8f[_0x1b0d('0x30')][_0x1b0d('0x31')]};});_0x3a4e8b[_0x1b0d('0x32')]=_[_0x1b0d('0x2c')](_0x3ca87f,_0x1b0d('0x2b'));_0x3a4e8b[_0x1b0d('0x33')]=_[_0x1b0d('0x34')](_0x1cdd96['query']);_0x3a4e8b['filters']=_[_0x1b0d('0x35')](_0x3a4e8b[_0x1b0d('0x32')],_0x3a4e8b['query']);_0x1cb776['attributes']=_['intersection'](_0x3a4e8b['model'],qs[_0x1b0d('0x36')](_0x1cdd96['query'][_0x1b0d('0x36')]));_0x1cb776[_0x1b0d('0x37')]=_0x1cb776[_0x1b0d('0x37')][_0x1b0d('0x38')]?_0x1cb776[_0x1b0d('0x37')]:_0x3a4e8b['model'];if(!_0x1cdd96['query'][_0x1b0d('0x39')]('nolimit')){_0x1cb776[_0x1b0d('0x21')]=qs[_0x1b0d('0x21')](_0x1cdd96[_0x1b0d('0x33')][_0x1b0d('0x21')]);_0x1cb776[_0x1b0d('0x1f')]=qs[_0x1b0d('0x1f')](_0x1cdd96[_0x1b0d('0x33')][_0x1b0d('0x1f')]);}_0x1cb776[_0x1b0d('0x3a')]=qs[_0x1b0d('0x3b')](_0x1cdd96[_0x1b0d('0x33')]['sort']);_0x1cb776[_0x1b0d('0x3c')]=qs[_0x1b0d('0x3d')](_[_0x1b0d('0x3e')](_0x1cdd96[_0x1b0d('0x33')],_0x3a4e8b[_0x1b0d('0x3d')]),_0x3ca87f);if(_0x1cdd96[_0x1b0d('0x33')][_0x1b0d('0x3f')]){_0x1cb776[_0x1b0d('0x3c')]=_[_0x1b0d('0x40')](_0x1cb776['where'],{'$or':_['map'](_0x3ca87f,function(_0x40dafa){if(_0x40dafa[_0x1b0d('0x30')]!==_0x1b0d('0x41')){var _0x3f0eb2={};_0x3f0eb2[_0x40dafa[_0x1b0d('0x2b')]]={'$like':'%'+_0x1cdd96[_0x1b0d('0x33')][_0x1b0d('0x3f')]+'%'};return _0x3f0eb2;}})});}_0x1cb776=_[_0x1b0d('0x40')]({},_0x1cb776,_0x1cdd96[_0x1b0d('0x42')]);var _0x409e4f={'where':_0x1cb776['where']};return db[_0x1b0d('0x2d')][_0x1b0d('0x22')](_0x409e4f)[_0x1b0d('0x27')](function(_0x5ab77c){_0x4065d6['count']=_0x5ab77c;if(_0x1cdd96['query']['includeAll']){_0x1cb776[_0x1b0d('0x43')]=[{'all':!![]}];}return db[_0x1b0d('0x2d')][_0x1b0d('0x44')](_0x1cb776);})[_0x1b0d('0x27')](function(_0x5aae04){_0x4065d6[_0x1b0d('0x45')]=_0x5aae04;return _0x4065d6;})[_0x1b0d('0x27')](respondWithFilteredResult(_0x3d3703,_0x1cb776))[_0x1b0d('0x46')](handleError(_0x3d3703,null));};exports[_0x1b0d('0x47')]=function(_0x1cf184,_0x352f54){var _0x1446b8={'raw':!![],'where':{'id':_0x1cf184[_0x1b0d('0x48')]['id']}},_0x40f772={};_0x40f772['model']=_['keys'](db[_0x1b0d('0x2d')][_0x1b0d('0x2e')]);_0x40f772[_0x1b0d('0x33')]=_[_0x1b0d('0x34')](_0x1cf184[_0x1b0d('0x33')]);_0x40f772[_0x1b0d('0x3d')]=_[_0x1b0d('0x35')](_0x40f772[_0x1b0d('0x32')],_0x40f772[_0x1b0d('0x33')]);_0x1446b8[_0x1b0d('0x37')]=_[_0x1b0d('0x35')](_0x40f772[_0x1b0d('0x32')],qs[_0x1b0d('0x36')](_0x1cf184['query'][_0x1b0d('0x36')]));_0x1446b8[_0x1b0d('0x37')]=_0x1446b8[_0x1b0d('0x37')][_0x1b0d('0x38')]?_0x1446b8[_0x1b0d('0x37')]:_0x40f772[_0x1b0d('0x32')];if(_0x1cf184[_0x1b0d('0x33')]['includeAll']){_0x1446b8[_0x1b0d('0x43')]=[{'all':!![]}];}_0x1446b8=_[_0x1b0d('0x40')]({},_0x1446b8,_0x1cf184[_0x1b0d('0x42')]);return db[_0x1b0d('0x2d')][_0x1b0d('0x49')](_0x1446b8)[_0x1b0d('0x27')](handleEntityNotFound(_0x352f54,null))['then'](respondWithResult(_0x352f54,null))[_0x1b0d('0x46')](handleError(_0x352f54,null));};exports[_0x1b0d('0x4a')]=function(_0x38ece6,_0x19efb8){return db[_0x1b0d('0x2d')]['create'](_0x38ece6[_0x1b0d('0x4b')],{})[_0x1b0d('0x27')](respondWithResult(_0x19efb8,0xc9))[_0x1b0d('0x46')](handleError(_0x19efb8,null));};exports[_0x1b0d('0x4c')]=function(_0x250261,_0x24fa4e){if(_0x250261[_0x1b0d('0x4b')]['id']){delete _0x250261['body']['id'];}return db['FreshsalesField'][_0x1b0d('0x49')]({'where':{'id':_0x250261['params']['id']}})['then'](handleEntityNotFound(_0x24fa4e,null))[_0x1b0d('0x27')](saveUpdates(_0x250261[_0x1b0d('0x4b')],null))[_0x1b0d('0x27')](respondWithResult(_0x24fa4e,null))[_0x1b0d('0x46')](handleError(_0x24fa4e,null));};exports['destroy']=function(_0x108bf1,_0x307ec3){return db[_0x1b0d('0x2d')][_0x1b0d('0x49')]({'where':{'id':_0x108bf1[_0x1b0d('0x48')]['id']}})[_0x1b0d('0x27')](handleEntityNotFound(_0x307ec3,null))[_0x1b0d('0x27')](removeEntity(_0x307ec3,null))[_0x1b0d('0x46')](handleError(_0x307ec3,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 1849d83..16ef26b 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 _0x7d25=['request-promise','path','define','FreshsalesField','int_freshsales_fields','FieldId','util','../../config/logger','api','moment','bluebird'];(function(_0x1012ab,_0xfb2018){var _0x4ebbe3=function(_0x32cb49){while(--_0x32cb49){_0x1012ab['push'](_0x1012ab['shift']());}};_0x4ebbe3(++_0xfb2018);}(_0x7d25,0x8a));var _0x57d2=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x7d25[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require(_0x57d2('0x0'));var logger=require(_0x57d2('0x1'))(_0x57d2('0x2'));var moment=require(_0x57d2('0x3'));var BPromise=require(_0x57d2('0x4'));var rp=require(_0x57d2('0x5'));var fs=require('fs');var path=require(_0x57d2('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intFreshsalesField.attributes');module['exports']=function(_0x3c5511,_0x49cc5f){return _0x3c5511[_0x57d2('0x7')](_0x57d2('0x8'),attributes,{'tableName':_0x57d2('0x9'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':['idField',_0x57d2('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0b63=['FreshsalesField','freshsales_unique_index','FieldId','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesField.attributes','exports'];(function(_0x55cfd9,_0x42c805){var _0x39d7f0=function(_0x244612){while(--_0x244612){_0x55cfd9['push'](_0x55cfd9['shift']());}};_0x39d7f0(++_0x42c805);}(_0x0b63,0xe7));var _0x30b6=function(_0x4b7337,_0x2f33d2){_0x4b7337=_0x4b7337-0x0;var _0x508294=_0x0b63[_0x4b7337];return _0x508294;};'use strict';var _=require(_0x30b6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x30b6('0x1'));var moment=require(_0x30b6('0x2'));var BPromise=require(_0x30b6('0x3'));var rp=require(_0x30b6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x30b6('0x5'));var config=require(_0x30b6('0x6'));var attributes=require(_0x30b6('0x7'));module[_0x30b6('0x8')]=function(_0x2670c6,_0x2fddeb){return _0x2670c6['define'](_0x30b6('0x9'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x30b6('0xa'),'fields':['idField',_0x30b6('0xb')],'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 e5c4ab9..295efe0 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 _0xc1c6=['lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch'];(function(_0x302496,_0x32e579){var _0x53059d=function(_0x263ab9){while(--_0x263ab9){_0x302496['push'](_0x302496['shift']());}};_0x53059d(++_0x32e579);}(_0xc1c6,0xf7));var _0x6c1c=function(_0xebff8b,_0x3192fd){_0xebff8b=_0xebff8b-0x0;var _0x29f43a=_0xc1c6[_0xebff8b];return _0x29f43a;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var moment=require(_0x6c1c('0x2'));var BPromise=require('bluebird');var rs=require(_0x6c1c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c1c('0x4'))['db'];var utils=require(_0x6c1c('0x5'));var logger=require(_0x6c1c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6c1c('0x7'));var client=jayson['client'][_0x6c1c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x582bec,_0xe510ca,_0x2eb1ba){return new BPromise(function(_0x38369d,_0x2cec58){return client['request'](_0x582bec,_0x2eb1ba)[_0x6c1c('0x9')](function(_0x3ca985){logger['info'](_0x6c1c('0xa'),_0xe510ca,_0x6c1c('0xb'));logger[_0x6c1c('0xc')](_0x6c1c('0xd'),_0xe510ca,'request\x20sent',JSON[_0x6c1c('0xe')](_0x3ca985));if(_0x3ca985[_0x6c1c('0xf')]){if(_0x3ca985[_0x6c1c('0xf')]['code']===0x1f4){logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x3ca985[_0x6c1c('0xf')]['message']);return _0x2cec58(_0x3ca985[_0x6c1c('0xf')]['message']);}logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x3ca985[_0x6c1c('0xf')][_0x6c1c('0x10')]);return _0x38369d(_0x3ca985[_0x6c1c('0xf')][_0x6c1c('0x10')]);}else{logger[_0x6c1c('0x11')](_0x6c1c('0xa'),_0xe510ca,_0x6c1c('0xb'));_0x38369d(_0x3ca985['result'][_0x6c1c('0x10')]);}})[_0x6c1c('0x12')](function(_0x5214ee){logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x5214ee);_0x2cec58(_0x5214ee);});});} \ No newline at end of file +var _0x90b1=['message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','request','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x13a2d8,_0x515ebe){var _0x10a234=function(_0x515b46){while(--_0x515b46){_0x13a2d8['push'](_0x13a2d8['shift']());}};_0x10a234(++_0x515ebe);}(_0x90b1,0x1bb));var _0x190b=function(_0x466503,_0x251570){_0x466503=_0x466503-0x0;var _0x2ee6cf=_0x90b1[_0x466503];return _0x2ee6cf;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var moment=require(_0x190b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x190b('0x3'));var db=require(_0x190b('0x4'))['db'];var utils=require(_0x190b('0x5'));var logger=require(_0x190b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x190b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x34a689,_0x3b57f7,_0x626aa1){return new BPromise(function(_0x311161,_0x802924){return client[_0x190b('0x8')](_0x34a689,_0x626aa1)['then'](function(_0x14b93d){logger[_0x190b('0x9')](_0x190b('0xa'),_0x3b57f7,_0x190b('0xb'));logger[_0x190b('0xc')](_0x190b('0xd'),_0x3b57f7,_0x190b('0xb'),JSON[_0x190b('0xe')](_0x14b93d));if(_0x14b93d['error']){if(_0x14b93d[_0x190b('0xf')][_0x190b('0x10')]===0x1f4){logger['error'](_0x190b('0xa'),_0x3b57f7,_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);return _0x802924(_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);}logger[_0x190b('0xf')](_0x190b('0xa'),_0x3b57f7,_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);return _0x311161(_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);}else{logger[_0x190b('0x9')](_0x190b('0xa'),_0x3b57f7,_0x190b('0xb'));_0x311161(_0x14b93d[_0x190b('0x12')][_0x190b('0x11')]);}})[_0x190b('0x13')](function(_0x5c63d9){logger[_0x190b('0xf')]('FreshsalesField,\x20%s,\x20%s',_0x3b57f7,_0x5c63d9);_0x802924(_0x5c63d9);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 66ed720..7c60dab 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(_0x15d2c2,_0x14b62d){var _0x108303=function(_0xbc7458){while(--_0xbc7458){_0x15d2c2['push'](_0x15d2c2['shift']());}};_0x108303(++_0x14b62d);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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(_0x4279ac,_0x181825){var _0x1e81eb=function(_0x5a6779){while(--_0x5a6779){_0x4279ac['push'](_0x4279ac['shift']());}};_0x1e81eb(++_0x181825);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',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 5c3fc6b..7eb746b 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 _0x77e6=['ENUM','newTab','sequelize','exports','STRING','username'];(function(_0x315aa3,_0x245fce){var _0xa902ac=function(_0x23cac9){while(--_0x23cac9){_0x315aa3['push'](_0x315aa3['shift']());}};_0xa902ac(++_0x245fce);}(_0x77e6,0x1a6));var _0x677e=function(_0x413c6d,_0x2386c4){_0x413c6d=_0x413c6d-0x0;var _0x30ff52=_0x77e6[_0x413c6d];return _0x30ff52;};'use strict';var Sequelize=require(_0x677e('0x0'));module[_0x677e('0x1')]={'name':{'type':Sequelize[_0x677e('0x2')]},'description':{'type':Sequelize[_0x677e('0x2')]},'username':{'type':Sequelize[_0x677e('0x2')],'unique':_0x677e('0x3')},'remoteUri':{'type':Sequelize[_0x677e('0x2')]},'password':{'type':Sequelize[_0x677e('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x677e('0x2')]},'securityToken':{'type':Sequelize[_0x677e('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x677e('0x4')]('integrationTab',_0x677e('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x534b=['username','ENUM','integrationTab','sequelize','exports','STRING'];(function(_0xe55e82,_0x466ab3){var _0x40560b=function(_0x1be0f2){while(--_0x1be0f2){_0xe55e82['push'](_0xe55e82['shift']());}};_0x40560b(++_0x466ab3);}(_0x534b,0xbd));var _0xb534=function(_0x471eec,_0x26f9f9){_0x471eec=_0x471eec-0x0;var _0x2baf42=_0x534b[_0x471eec];return _0x2baf42;};'use strict';var Sequelize=require(_0xb534('0x0'));module[_0xb534('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb534('0x2')]},'username':{'type':Sequelize[_0xb534('0x2')],'unique':_0xb534('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xb534('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xb534('0x2')]},'securityToken':{'type':Sequelize[_0xb534('0x2')]},'serverUrl':{'type':Sequelize[_0xb534('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xb534('0x4')](_0xb534('0x5'),'newTab'),'defaultValue':_0xb534('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index fa47ddd..46527f2 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 _0xf3a5=['sort','AccountId','Subjects','channel','getDescriptions','SalesforceField','Descriptions','Task','remoteUri','clientSecret','securityToken','slice','Connection','clientId','login','password','concat','isNil','ticketType','sobject','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','picklist','textarea','phone','remove','includes','custom','picklistValues','label','value','boolean','True','False','false','test','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','then','end','error','send','index','SalesforceAccount','fieldName','type','key','model','map','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','create','body','catch','getConfigurations','findOne','SalesforceConfiguration','order'];(function(_0x1fae19,_0x222b47){var _0x5086ab=function(_0x5a2d67){while(--_0x5a2d67){_0x1fae19['push'](_0x1fae19['shift']());}};_0x5086ab(++_0x222b47);}(_0xf3a5,0xac));var _0x5f3a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf3a5[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x5f3a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5f3a('0x1'));var jsonpatch=require(_0x5f3a('0x2'));var rp=require(_0x5f3a('0x3'));var moment=require(_0x5f3a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5f3a('0x5'));var util=require(_0x5f3a('0x6'));var path=require(_0x5f3a('0x7'));var sox=require(_0x5f3a('0x8'));var csv=require(_0x5f3a('0x9'));var ejs=require(_0x5f3a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5f3a('0xb'));var squel=require(_0x5f3a('0xc'));var crypto=require(_0x5f3a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5f3a('0xe'));var toCsv=require(_0x5f3a('0x9'));var querystring=require(_0x5f3a('0xf'));var Papa=require(_0x5f3a('0x10'));var Redis=require(_0x5f3a('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5f3a('0x12'));var as=require(_0x5f3a('0x13'));var hardwareService=require(_0x5f3a('0x14'));var logger=require(_0x5f3a('0x15'))(_0x5f3a('0x16'));var utils=require(_0x5f3a('0x17'));var config=require(_0x5f3a('0x18'));var licenseUtil=require(_0x5f3a('0x19'));var db=require(_0x5f3a('0x1a'))['db'];var integrations=require(_0x5f3a('0x1b'));function respondWithStatusCode(_0xfa9eab,_0x57eefa){_0x57eefa=_0x57eefa||0xcc;return function(_0x3f00c7){if(_0x3f00c7){return _0xfa9eab[_0x5f3a('0x1c')](_0x57eefa);}return _0xfa9eab[_0x5f3a('0x1d')](_0x57eefa)['end']();};}function respondWithResult(_0x1bc422,_0x51cd16){_0x51cd16=_0x51cd16||0xc8;return function(_0x3b81b7){if(_0x3b81b7){return _0x1bc422['status'](_0x51cd16)[_0x5f3a('0x1e')](_0x3b81b7);}};}function respondWithFilteredResult(_0x41ae6c,_0x2cc2b8){return function(_0x1ecb66){if(_0x1ecb66){var _0x42d021=typeof _0x2cc2b8[_0x5f3a('0x1f')]===_0x5f3a('0x20')&&typeof _0x2cc2b8[_0x5f3a('0x21')]===_0x5f3a('0x20');var _0x5007f4=_0x1ecb66[_0x5f3a('0x22')];var _0x30083e=_0x42d021?0x0:_0x2cc2b8[_0x5f3a('0x1f')];var _0x2cf8ef=_0x42d021?_0x1ecb66[_0x5f3a('0x22')]:_0x2cc2b8[_0x5f3a('0x1f')]+_0x2cc2b8[_0x5f3a('0x21')];var _0x3ff6f6;if(_0x2cf8ef>=_0x5007f4){_0x2cf8ef=_0x5007f4;_0x3ff6f6=0xc8;}else{_0x3ff6f6=0xce;}_0x41ae6c[_0x5f3a('0x1d')](_0x3ff6f6);return _0x41ae6c[_0x5f3a('0x23')](_0x5f3a('0x24'),_0x30083e+'-'+_0x2cf8ef+'/'+_0x5007f4)['json'](_0x1ecb66);}return null;};}function patchUpdates(_0x2ad5a6){return function(_0x25213f){try{jsonpatch[_0x5f3a('0x25')](_0x25213f,_0x2ad5a6,!![]);}catch(_0x1478cc){return BPromise['reject'](_0x1478cc);}return _0x25213f['save']();};}function saveUpdates(_0x5e7cb6,_0x30b89a){return function(_0x4eb37b){if(_0x4eb37b){return _0x4eb37b[_0x5f3a('0x26')](_0x5e7cb6)['then'](function(_0x428b44){return _0x428b44;});}return null;};}function removeEntity(_0x525bfa,_0x598f1a){return function(_0x47911d){if(_0x47911d){return _0x47911d[_0x5f3a('0x27')]()[_0x5f3a('0x28')](function(){_0x525bfa[_0x5f3a('0x1d')](0xcc)[_0x5f3a('0x29')]();});}};}function handleEntityNotFound(_0x4842cf,_0x516f10){return function(_0x49e430){if(!_0x49e430){_0x4842cf[_0x5f3a('0x1c')](0x194);}return _0x49e430;};}function handleError(_0xf35b1a,_0x1c18ab){_0x1c18ab=_0x1c18ab||0x1f4;return function(_0x28902d){logger[_0x5f3a('0x2a')](_0x28902d['stack']);if(_0x28902d['name']){delete _0x28902d['name'];}_0xf35b1a[_0x5f3a('0x1d')](_0x1c18ab)[_0x5f3a('0x2b')](_0x28902d);};}exports[_0x5f3a('0x2c')]=function(_0x328659,_0x38e636){var _0x42e358={},_0x263fa9={},_0x8404b1={'count':0x0,'rows':[]};var _0x12fe76=_['map'](db[_0x5f3a('0x2d')]['rawAttributes'],function(_0x44fe43){return{'name':_0x44fe43[_0x5f3a('0x2e')],'type':_0x44fe43[_0x5f3a('0x2f')][_0x5f3a('0x30')]};});_0x263fa9[_0x5f3a('0x31')]=_[_0x5f3a('0x32')](_0x12fe76,_0x5f3a('0x33'));_0x263fa9['query']=_['keys'](_0x328659[_0x5f3a('0x34')]);_0x263fa9[_0x5f3a('0x35')]=_[_0x5f3a('0x36')](_0x263fa9[_0x5f3a('0x31')],_0x263fa9['query']);_0x42e358[_0x5f3a('0x37')]=_['intersection'](_0x263fa9[_0x5f3a('0x31')],qs[_0x5f3a('0x38')](_0x328659[_0x5f3a('0x34')][_0x5f3a('0x38')]));_0x42e358[_0x5f3a('0x37')]=_0x42e358[_0x5f3a('0x37')][_0x5f3a('0x39')]?_0x42e358[_0x5f3a('0x37')]:_0x263fa9[_0x5f3a('0x31')];if(!_0x328659[_0x5f3a('0x34')][_0x5f3a('0x3a')](_0x5f3a('0x3b'))){_0x42e358[_0x5f3a('0x21')]=qs[_0x5f3a('0x21')](_0x328659[_0x5f3a('0x34')]['limit']);_0x42e358[_0x5f3a('0x1f')]=qs['offset'](_0x328659[_0x5f3a('0x34')][_0x5f3a('0x1f')]);}_0x42e358['order']=qs['sort'](_0x328659[_0x5f3a('0x34')]['sort']);_0x42e358[_0x5f3a('0x3c')]=qs['filters'](_[_0x5f3a('0x3d')](_0x328659[_0x5f3a('0x34')],_0x263fa9['filters']),_0x12fe76);if(_0x328659[_0x5f3a('0x34')][_0x5f3a('0x3e')]){_0x42e358[_0x5f3a('0x3c')]=_[_0x5f3a('0x3f')](_0x42e358['where'],{'$or':_['map'](_0x12fe76,function(_0x1302bc){if(_0x1302bc[_0x5f3a('0x2f')]!==_0x5f3a('0x40')){var _0x50219b={};_0x50219b[_0x1302bc['name']]={'$like':'%'+_0x328659[_0x5f3a('0x34')][_0x5f3a('0x3e')]+'%'};return _0x50219b;}})});}_0x42e358=_[_0x5f3a('0x3f')]({},_0x42e358,_0x328659[_0x5f3a('0x41')]);var _0x487592={'where':_0x42e358['where']};return db['SalesforceAccount'][_0x5f3a('0x22')](_0x487592)[_0x5f3a('0x28')](function(_0x5ce5ab){_0x8404b1['count']=_0x5ce5ab;if(_0x328659[_0x5f3a('0x34')][_0x5f3a('0x42')]){_0x42e358[_0x5f3a('0x43')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x5f3a('0x44')](_0x42e358);})[_0x5f3a('0x28')](function(_0x27f6a7){_0x8404b1[_0x5f3a('0x45')]=_0x27f6a7;return _0x8404b1;})[_0x5f3a('0x28')](respondWithFilteredResult(_0x38e636,_0x42e358))['catch'](handleError(_0x38e636,null));};exports[_0x5f3a('0x46')]=function(_0x60bb16,_0x313c6c){var _0x9f13bc={'raw':![],'where':{'id':_0x60bb16[_0x5f3a('0x47')]['id']}},_0xcfca0a={};_0xcfca0a[_0x5f3a('0x31')]=_[_0x5f3a('0x48')](db[_0x5f3a('0x2d')][_0x5f3a('0x49')]);_0xcfca0a[_0x5f3a('0x34')]=_[_0x5f3a('0x48')](_0x60bb16[_0x5f3a('0x34')]);_0xcfca0a['filters']=_['intersection'](_0xcfca0a[_0x5f3a('0x31')],_0xcfca0a[_0x5f3a('0x34')]);_0x9f13bc['attributes']=_[_0x5f3a('0x36')](_0xcfca0a[_0x5f3a('0x31')],qs[_0x5f3a('0x38')](_0x60bb16['query'][_0x5f3a('0x38')]));_0x9f13bc[_0x5f3a('0x37')]=_0x9f13bc[_0x5f3a('0x37')][_0x5f3a('0x39')]?_0x9f13bc['attributes']:_0xcfca0a[_0x5f3a('0x31')];if(_0x60bb16[_0x5f3a('0x34')][_0x5f3a('0x42')]){_0x9f13bc[_0x5f3a('0x43')]=[{'all':!![]}];}_0x9f13bc=_[_0x5f3a('0x3f')]({},_0x9f13bc,_0x60bb16[_0x5f3a('0x41')]);return db['SalesforceAccount'][_0x5f3a('0x4a')](_0x9f13bc)['then'](handleEntityNotFound(_0x313c6c,null))[_0x5f3a('0x28')](respondWithResult(_0x313c6c,null))['catch'](handleError(_0x313c6c,null));};exports[_0x5f3a('0x4b')]=function(_0x3aa3c0,_0x4d9ad5){return db['SalesforceAccount']['create'](_0x3aa3c0[_0x5f3a('0x4c')],{})[_0x5f3a('0x28')](respondWithResult(_0x4d9ad5,0xc9))[_0x5f3a('0x4d')](handleError(_0x4d9ad5,null));};exports['update']=function(_0x2ff45c,_0x1d0c74){if(_0x2ff45c[_0x5f3a('0x4c')]['id']){delete _0x2ff45c[_0x5f3a('0x4c')]['id'];}return db[_0x5f3a('0x2d')]['find']({'where':{'id':_0x2ff45c[_0x5f3a('0x47')]['id']}})[_0x5f3a('0x28')](handleEntityNotFound(_0x1d0c74,null))[_0x5f3a('0x28')](saveUpdates(_0x2ff45c[_0x5f3a('0x4c')],null))[_0x5f3a('0x28')](respondWithResult(_0x1d0c74,null))[_0x5f3a('0x4d')](handleError(_0x1d0c74,null));};exports['destroy']=function(_0x251f0f,_0x451d3e){return db[_0x5f3a('0x2d')][_0x5f3a('0x4a')]({'where':{'id':_0x251f0f[_0x5f3a('0x47')]['id']}})[_0x5f3a('0x28')](handleEntityNotFound(_0x451d3e,null))[_0x5f3a('0x28')](removeEntity(_0x451d3e,null))[_0x5f3a('0x4d')](handleError(_0x451d3e,null));};exports[_0x5f3a('0x4e')]=function(_0x4421cc,_0xb7e289,_0x515ae6){var _0x4c50f7={};var _0x21df42={};var _0x35ca61;var _0x5f321c;return db[_0x5f3a('0x2d')][_0x5f3a('0x4f')]({'where':{'id':_0x4421cc[_0x5f3a('0x47')]['id']}})['then'](handleEntityNotFound(_0xb7e289,null))[_0x5f3a('0x28')](function(_0x2ed88d){if(_0x2ed88d){_0x35ca61=_0x2ed88d;_0x21df42[_0x5f3a('0x31')]=_[_0x5f3a('0x48')](db[_0x5f3a('0x50')][_0x5f3a('0x49')]);_0x21df42[_0x5f3a('0x34')]=_[_0x5f3a('0x48')](_0x4421cc['query']);_0x21df42[_0x5f3a('0x35')]=_[_0x5f3a('0x36')](_0x21df42[_0x5f3a('0x31')],_0x21df42['query']);_0x4c50f7[_0x5f3a('0x37')]=_[_0x5f3a('0x36')](_0x21df42['model'],qs[_0x5f3a('0x38')](_0x4421cc['query'][_0x5f3a('0x38')]));_0x4c50f7[_0x5f3a('0x37')]=_0x4c50f7[_0x5f3a('0x37')][_0x5f3a('0x39')]?_0x4c50f7[_0x5f3a('0x37')]:_0x21df42[_0x5f3a('0x31')];_0x4c50f7[_0x5f3a('0x51')]=qs[_0x5f3a('0x52')](_0x4421cc[_0x5f3a('0x34')]['sort']);_0x4c50f7[_0x5f3a('0x3c')]=qs[_0x5f3a('0x35')](_[_0x5f3a('0x3d')](_0x4421cc[_0x5f3a('0x34')],_0x21df42[_0x5f3a('0x35')]));if(_0x4421cc[_0x5f3a('0x34')][_0x5f3a('0x3e')]){_0x4c50f7[_0x5f3a('0x3c')]=_[_0x5f3a('0x3f')](_0x4c50f7['where'],{'$or':_[_0x5f3a('0x32')](_0x4c50f7[_0x5f3a('0x37')],function(_0x1e717b){var _0x442f20={};_0x442f20[_0x1e717b]={'$like':'%'+_0x4421cc[_0x5f3a('0x34')][_0x5f3a('0x3e')]+'%'};return _0x442f20;})});}_0x4c50f7=_['merge']({},_0x4c50f7,_0x4421cc[_0x5f3a('0x41')]);return _0x35ca61['getConfigurations'](_0x4c50f7);}})['then'](function(_0x1ebca3){if(_0x1ebca3){_0x5f321c=_0x1ebca3[_0x5f3a('0x39')];if(!_0x4421cc[_0x5f3a('0x34')][_0x5f3a('0x3a')](_0x5f3a('0x3b'))){_0x4c50f7[_0x5f3a('0x21')]=qs['limit'](_0x4421cc[_0x5f3a('0x34')]['limit']);_0x4c50f7[_0x5f3a('0x1f')]=qs['offset'](_0x4421cc[_0x5f3a('0x34')][_0x5f3a('0x1f')]);}return _0x35ca61[_0x5f3a('0x4e')](_0x4c50f7);}})[_0x5f3a('0x28')](function(_0x5c2950){if(_0x5c2950){return _0x5c2950?{'count':_0x5f321c,'rows':_0x5c2950}:null;}})[_0x5f3a('0x28')](respondWithResult(_0xb7e289,null))['catch'](handleError(_0xb7e289,null));};exports['addConfiguration']=function(_0x58a65c,_0x2d0b41,_0x6c7ddd){if(_0x58a65c[_0x5f3a('0x4c')]['id']){delete _0x58a65c[_0x5f3a('0x4c')]['id'];}return db[_0x5f3a('0x2d')][_0x5f3a('0x4f')]({'where':{'id':_0x58a65c['params']['id']}})['then'](handleEntityNotFound(_0x2d0b41,null))[_0x5f3a('0x28')](function(_0xe7e3cf){if(_0xe7e3cf){_0x58a65c[_0x5f3a('0x4c')][_0x5f3a('0x53')]=_0xe7e3cf['id'];_0x58a65c['body'][_0x5f3a('0x54')]=integrations['getSubjects'](_0x58a65c['body'][_0x5f3a('0x55')],_0x58a65c[_0x5f3a('0x4c')][_0x5f3a('0x2f')]);_0x58a65c[_0x5f3a('0x4c')]['Descriptions']=integrations[_0x5f3a('0x56')](_0x58a65c[_0x5f3a('0x4c')]['channel'],_0x58a65c[_0x5f3a('0x4c')][_0x5f3a('0x2f')]);return db['SalesforceConfiguration']['create'](_0x58a65c[_0x5f3a('0x4c')],{'include':[{'model':db[_0x5f3a('0x57')],'as':_0x5f3a('0x54')},{'model':db[_0x5f3a('0x57')],'as':_0x5f3a('0x58')}]});}return null;})['then'](respondWithResult(_0x2d0b41,null))[_0x5f3a('0x4d')](handleError(_0x2d0b41,null));};exports['getFields']=function(_0x581099,_0x30c1dc,_0xcab938){var _0x2e8385;var _0x45447d='';var _0x1cb9e9=_0x5f3a('0x59');return db[_0x5f3a('0x2d')][_0x5f3a('0x4f')]({'where':{'id':_0x581099[_0x5f3a('0x47')]['id']},'attributes':['id',_0x5f3a('0x5a'),'clientId',_0x5f3a('0x5b'),'username','password',_0x5f3a('0x5c')]})[_0x5f3a('0x28')](handleEntityNotFound(_0x30c1dc,null))[_0x5f3a('0x28')](function(_0x2bc496){if(_0x2bc496){_0x45447d=_0x2bc496[_0x5f3a('0x5a')];var _0x1772da=_0x45447d[_0x5f3a('0x5d')](-0x1);if(_0x1772da==='/'){_0x45447d=_0x45447d['substring'](0x0,_0x45447d['lastIndexOf'](_0x1772da));}_0x2e8385=new jsforce[(_0x5f3a('0x5e'))]({'oauth2':{'loginUrl':_0x45447d,'clientId':_0x2bc496[_0x5f3a('0x5f')],'clientSecret':_0x2bc496[_0x5f3a('0x5b')]}});return _0x2e8385[_0x5f3a('0x60')](_0x2bc496['username'],_0x2bc496[_0x5f3a('0x61')][_0x5f3a('0x62')](_0x2bc496[_0x5f3a('0x5c')]));}})['then'](function(_0x5271f5){if(_0x5271f5){if(!_[_0x5f3a('0x63')](_0x581099['query'][_0x5f3a('0x64')])){_0x1cb9e9=_0x581099['query'][_0x5f3a('0x64')];}return _0x2e8385[_0x5f3a('0x65')](_0x1cb9e9)['describe']();}})['then'](function(_0x5974c2){var _0x4d340c=['OwnerId',_0x5f3a('0x66'),_0x5f3a('0x67'),_0x5f3a('0x68'),_0x5f3a('0x69'),_0x5f3a('0x6a')];var _0x59f164=[_0x5f3a('0x6b'),'int',_0x5f3a('0x6c'),'boolean','email',_0x5f3a('0x6d'),_0x5f3a('0x6e')];if(_0x5974c2){_[_0x5f3a('0x6f')](_0x5974c2[_0x5f3a('0x38')],function(_0x10583d){return _0x4d340c[_0x5f3a('0x70')](_0x10583d[_0x5f3a('0x33')])||!_0x59f164[_0x5f3a('0x70')](_0x10583d[_0x5f3a('0x2f')]);});return{'count':_0x5974c2[_0x5f3a('0x38')][_0x5f3a('0x39')],'rows':_[_0x5f3a('0x32')](_0x5974c2['fields'],function(_0x2d139d){return{'id':_0x2d139d['name'],'name':_0x2d139d['label'],'custom':_0x2d139d[_0x5f3a('0x71')],'options':_0x2d139d['picklistValues'][_0x5f3a('0x39')]>0x0?_['map'](_0x2d139d[_0x5f3a('0x72')],function(_0x58f6c2){return{'name':_0x58f6c2[_0x5f3a('0x73')],'value':_0x58f6c2[_0x5f3a('0x74')]};}):_0x2d139d[_0x5f3a('0x2f')]==_0x5f3a('0x75')?[{'name':_0x5f3a('0x76'),'value':'true'},{'name':_0x5f3a('0x77'),'value':_0x5f3a('0x78')}]:[]};})};}})[_0x5f3a('0x28')](respondWithResult(_0x30c1dc,null))[_0x5f3a('0x4d')](function(_0x2c392b){var _0x197def=_0x581099[_0x5f3a('0x34')][_0x5f3a('0x79')]?0x1f4:_0x2c392b['statusCode']||0x1f4;logger[_0x5f3a('0x2a')](_0x5f3a('0x7a'),_0x5f3a('0x7b'),_0x197def,JSON[_0x5f3a('0x7c')](_0x2c392b));delete _0x2c392b[_0x5f3a('0x33')];if(_0x197def===0x191){_0x197def=0x190;}_0x30c1dc['status'](_0x197def)['send'](_0x581099['query'][_0x5f3a('0x79')]?{'message':_0x5f3a('0x7d'),'statusCode':_0x2c392b[_0x5f3a('0x7e')]}:_0x2c392b);});}; \ No newline at end of file +var _0x626a=['fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','count','limit','set','apply','reject','save','update','then','destroy','sendStatus','stack','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','name','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','SalesforceConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','SalesforceField','Descriptions','getFields','remoteUri','clientSecret','username','password','slice','substring','lastIndexOf','Connection','clientId','login','securityToken','isNil','ticketType','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','picklist','boolean','textarea','phone','remove','includes','label','custom','picklistValues','value','True','False','false','test','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x626a,0x1ed));var _0xa626=function(_0x5d8995,_0x173c3d){_0x5d8995=_0x5d8995-0x0;var _0x47e036=_0x626a[_0x5d8995];return _0x47e036;};'use strict';var emlformat=require(_0xa626('0x0'));var rimraf=require(_0xa626('0x1'));var zipdir=require(_0xa626('0x2'));var jsonpatch=require(_0xa626('0x3'));var rp=require(_0xa626('0x4'));var moment=require(_0xa626('0x5'));var BPromise=require(_0xa626('0x6'));var Mustache=require('mustache');var util=require(_0xa626('0x7'));var path=require('path');var sox=require(_0xa626('0x8'));var csv=require(_0xa626('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa626('0xa'));var squel=require('squel');var crypto=require(_0xa626('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xa626('0xc'));var toCsv=require(_0xa626('0x9'));var querystring=require(_0xa626('0xd'));var Papa=require(_0xa626('0xe'));var Redis=require(_0xa626('0xf'));var authService=require(_0xa626('0x10'));var qs=require(_0xa626('0x11'));var as=require(_0xa626('0x12'));var hardwareService=require(_0xa626('0x13'));var logger=require(_0xa626('0x14'))(_0xa626('0x15'));var utils=require(_0xa626('0x16'));var config=require(_0xa626('0x17'));var licenseUtil=require(_0xa626('0x18'));var db=require(_0xa626('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5c1a80,_0x1d3d83){_0x1d3d83=_0x1d3d83||0xcc;return function(_0x1508e8){if(_0x1508e8){return _0x5c1a80['sendStatus'](_0x1d3d83);}return _0x5c1a80[_0xa626('0x1a')](_0x1d3d83)[_0xa626('0x1b')]();};}function respondWithResult(_0x6b93f8,_0x176606){_0x176606=_0x176606||0xc8;return function(_0x52f5a5){if(_0x52f5a5){return _0x6b93f8['status'](_0x176606)[_0xa626('0x1c')](_0x52f5a5);}};}function respondWithFilteredResult(_0x4725a9,_0x2b31f9){return function(_0x8dd146){if(_0x8dd146){var _0xcbbbcc=typeof _0x2b31f9['offset']==='undefined'&&typeof _0x2b31f9['limit']==='undefined';var _0x3bcc18=_0x8dd146['count'];var _0x3ba57b=_0xcbbbcc?0x0:_0x2b31f9[_0xa626('0x1d')];var _0x2bf3d9=_0xcbbbcc?_0x8dd146[_0xa626('0x1e')]:_0x2b31f9[_0xa626('0x1d')]+_0x2b31f9[_0xa626('0x1f')];var _0x5ce906;if(_0x2bf3d9>=_0x3bcc18){_0x2bf3d9=_0x3bcc18;_0x5ce906=0xc8;}else{_0x5ce906=0xce;}_0x4725a9[_0xa626('0x1a')](_0x5ce906);return _0x4725a9[_0xa626('0x20')]('Content-Range',_0x3ba57b+'-'+_0x2bf3d9+'/'+_0x3bcc18)[_0xa626('0x1c')](_0x8dd146);}return null;};}function patchUpdates(_0x282a20){return function(_0x2b9d60){try{jsonpatch[_0xa626('0x21')](_0x2b9d60,_0x282a20,!![]);}catch(_0x905ec3){return BPromise[_0xa626('0x22')](_0x905ec3);}return _0x2b9d60[_0xa626('0x23')]();};}function saveUpdates(_0x43534f,_0x7bca6){return function(_0x4e52d1){if(_0x4e52d1){return _0x4e52d1[_0xa626('0x24')](_0x43534f)[_0xa626('0x25')](function(_0x300662){return _0x300662;});}return null;};}function removeEntity(_0x2de1ab,_0x485cc5){return function(_0x5c18a0){if(_0x5c18a0){return _0x5c18a0[_0xa626('0x26')]()['then'](function(){_0x2de1ab[_0xa626('0x1a')](0xcc)[_0xa626('0x1b')]();});}};}function handleEntityNotFound(_0x4aecc8,_0x5f4cbc){return function(_0x3dc642){if(!_0x3dc642){_0x4aecc8[_0xa626('0x27')](0x194);}return _0x3dc642;};}function handleError(_0x59f626,_0x27667b){_0x27667b=_0x27667b||0x1f4;return function(_0x3a1a9c){logger['error'](_0x3a1a9c[_0xa626('0x28')]);if(_0x3a1a9c['name']){delete _0x3a1a9c['name'];}_0x59f626['status'](_0x27667b)[_0xa626('0x29')](_0x3a1a9c);};}exports[_0xa626('0x2a')]=function(_0x303842,_0x42cfda){var _0x2145c2={},_0x56274a={},_0x6d8a8c={'count':0x0,'rows':[]};var _0x4dcb0c=_[_0xa626('0x2b')](db[_0xa626('0x2c')][_0xa626('0x2d')],function(_0x3cd53f){return{'name':_0x3cd53f[_0xa626('0x2e')],'type':_0x3cd53f[_0xa626('0x2f')][_0xa626('0x30')]};});_0x56274a[_0xa626('0x31')]=_[_0xa626('0x2b')](_0x4dcb0c,_0xa626('0x32'));_0x56274a['query']=_[_0xa626('0x33')](_0x303842[_0xa626('0x34')]);_0x56274a[_0xa626('0x35')]=_[_0xa626('0x36')](_0x56274a['model'],_0x56274a[_0xa626('0x34')]);_0x2145c2[_0xa626('0x37')]=_[_0xa626('0x36')](_0x56274a[_0xa626('0x31')],qs[_0xa626('0x38')](_0x303842[_0xa626('0x34')][_0xa626('0x38')]));_0x2145c2[_0xa626('0x37')]=_0x2145c2[_0xa626('0x37')]['length']?_0x2145c2['attributes']:_0x56274a[_0xa626('0x31')];if(!_0x303842['query'][_0xa626('0x39')](_0xa626('0x3a'))){_0x2145c2['limit']=qs['limit'](_0x303842[_0xa626('0x34')][_0xa626('0x1f')]);_0x2145c2[_0xa626('0x1d')]=qs[_0xa626('0x1d')](_0x303842[_0xa626('0x34')][_0xa626('0x1d')]);}_0x2145c2[_0xa626('0x3b')]=qs[_0xa626('0x3c')](_0x303842[_0xa626('0x34')][_0xa626('0x3c')]);_0x2145c2[_0xa626('0x3d')]=qs['filters'](_[_0xa626('0x3e')](_0x303842[_0xa626('0x34')],_0x56274a[_0xa626('0x35')]),_0x4dcb0c);if(_0x303842[_0xa626('0x34')][_0xa626('0x3f')]){_0x2145c2['where']=_[_0xa626('0x40')](_0x2145c2[_0xa626('0x3d')],{'$or':_[_0xa626('0x2b')](_0x4dcb0c,function(_0x282804){if(_0x282804[_0xa626('0x2f')]!==_0xa626('0x41')){var _0xeaeb8f={};_0xeaeb8f[_0x282804[_0xa626('0x32')]]={'$like':'%'+_0x303842['query'][_0xa626('0x3f')]+'%'};return _0xeaeb8f;}})});}_0x2145c2=_[_0xa626('0x40')]({},_0x2145c2,_0x303842[_0xa626('0x42')]);var _0x1f461e={'where':_0x2145c2[_0xa626('0x3d')]};return db[_0xa626('0x2c')][_0xa626('0x1e')](_0x1f461e)[_0xa626('0x25')](function(_0x2dfe84){_0x6d8a8c[_0xa626('0x1e')]=_0x2dfe84;if(_0x303842[_0xa626('0x34')][_0xa626('0x43')]){_0x2145c2[_0xa626('0x44')]=[{'all':!![]}];}return db[_0xa626('0x2c')][_0xa626('0x45')](_0x2145c2);})[_0xa626('0x25')](function(_0x1a76df){_0x6d8a8c[_0xa626('0x46')]=_0x1a76df;return _0x6d8a8c;})[_0xa626('0x25')](respondWithFilteredResult(_0x42cfda,_0x2145c2))['catch'](handleError(_0x42cfda,null));};exports[_0xa626('0x47')]=function(_0x11f61b,_0x46e198){var _0x4fc99f={'raw':![],'where':{'id':_0x11f61b[_0xa626('0x48')]['id']}},_0x10f304={};_0x10f304[_0xa626('0x31')]=_['keys'](db[_0xa626('0x2c')][_0xa626('0x2d')]);_0x10f304[_0xa626('0x34')]=_[_0xa626('0x33')](_0x11f61b[_0xa626('0x34')]);_0x10f304[_0xa626('0x35')]=_['intersection'](_0x10f304['model'],_0x10f304[_0xa626('0x34')]);_0x4fc99f[_0xa626('0x37')]=_[_0xa626('0x36')](_0x10f304[_0xa626('0x31')],qs[_0xa626('0x38')](_0x11f61b[_0xa626('0x34')][_0xa626('0x38')]));_0x4fc99f[_0xa626('0x37')]=_0x4fc99f['attributes'][_0xa626('0x49')]?_0x4fc99f['attributes']:_0x10f304[_0xa626('0x31')];if(_0x11f61b[_0xa626('0x34')][_0xa626('0x43')]){_0x4fc99f[_0xa626('0x44')]=[{'all':!![]}];}_0x4fc99f=_['merge']({},_0x4fc99f,_0x11f61b[_0xa626('0x42')]);return db['SalesforceAccount'][_0xa626('0x4a')](_0x4fc99f)['then'](handleEntityNotFound(_0x46e198,null))[_0xa626('0x25')](respondWithResult(_0x46e198,null))[_0xa626('0x4b')](handleError(_0x46e198,null));};exports[_0xa626('0x4c')]=function(_0x4b8e0f,_0x7a41d9){return db[_0xa626('0x2c')][_0xa626('0x4c')](_0x4b8e0f[_0xa626('0x4d')],{})['then'](respondWithResult(_0x7a41d9,0xc9))[_0xa626('0x4b')](handleError(_0x7a41d9,null));};exports[_0xa626('0x24')]=function(_0x43d069,_0x19474e){if(_0x43d069[_0xa626('0x4d')]['id']){delete _0x43d069[_0xa626('0x4d')]['id'];}return db[_0xa626('0x2c')]['find']({'where':{'id':_0x43d069['params']['id']}})[_0xa626('0x25')](handleEntityNotFound(_0x19474e,null))[_0xa626('0x25')](saveUpdates(_0x43d069['body'],null))['then'](respondWithResult(_0x19474e,null))[_0xa626('0x4b')](handleError(_0x19474e,null));};exports[_0xa626('0x26')]=function(_0x1765bc,_0x52b06d){return db['SalesforceAccount'][_0xa626('0x4a')]({'where':{'id':_0x1765bc[_0xa626('0x48')]['id']}})['then'](handleEntityNotFound(_0x52b06d,null))[_0xa626('0x25')](removeEntity(_0x52b06d,null))[_0xa626('0x4b')](handleError(_0x52b06d,null));};exports['getConfigurations']=function(_0x4ceb38,_0x5058ff,_0x25bcbb){var _0xb2f8e2={};var _0x2801a1={};var _0x13aad1;var _0x400c66;return db[_0xa626('0x2c')]['findOne']({'where':{'id':_0x4ceb38[_0xa626('0x48')]['id']}})[_0xa626('0x25')](handleEntityNotFound(_0x5058ff,null))[_0xa626('0x25')](function(_0x246af4){if(_0x246af4){_0x13aad1=_0x246af4;_0x2801a1[_0xa626('0x31')]=_[_0xa626('0x33')](db[_0xa626('0x4e')]['rawAttributes']);_0x2801a1[_0xa626('0x34')]=_['keys'](_0x4ceb38['query']);_0x2801a1[_0xa626('0x35')]=_['intersection'](_0x2801a1['model'],_0x2801a1[_0xa626('0x34')]);_0xb2f8e2[_0xa626('0x37')]=_['intersection'](_0x2801a1['model'],qs[_0xa626('0x38')](_0x4ceb38['query']['fields']));_0xb2f8e2['attributes']=_0xb2f8e2[_0xa626('0x37')][_0xa626('0x49')]?_0xb2f8e2[_0xa626('0x37')]:_0x2801a1['model'];_0xb2f8e2['order']=qs[_0xa626('0x3c')](_0x4ceb38[_0xa626('0x34')][_0xa626('0x3c')]);_0xb2f8e2[_0xa626('0x3d')]=qs['filters'](_['pick'](_0x4ceb38[_0xa626('0x34')],_0x2801a1[_0xa626('0x35')]));if(_0x4ceb38[_0xa626('0x34')]['filter']){_0xb2f8e2[_0xa626('0x3d')]=_['merge'](_0xb2f8e2[_0xa626('0x3d')],{'$or':_['map'](_0xb2f8e2['attributes'],function(_0x2c1a69){var _0xa09834={};_0xa09834[_0x2c1a69]={'$like':'%'+_0x4ceb38[_0xa626('0x34')][_0xa626('0x3f')]+'%'};return _0xa09834;})});}_0xb2f8e2=_[_0xa626('0x40')]({},_0xb2f8e2,_0x4ceb38[_0xa626('0x42')]);return _0x13aad1['getConfigurations'](_0xb2f8e2);}})[_0xa626('0x25')](function(_0x51d721){if(_0x51d721){_0x400c66=_0x51d721[_0xa626('0x49')];if(!_0x4ceb38[_0xa626('0x34')][_0xa626('0x39')](_0xa626('0x3a'))){_0xb2f8e2['limit']=qs[_0xa626('0x1f')](_0x4ceb38[_0xa626('0x34')][_0xa626('0x1f')]);_0xb2f8e2['offset']=qs[_0xa626('0x1d')](_0x4ceb38[_0xa626('0x34')]['offset']);}return _0x13aad1['getConfigurations'](_0xb2f8e2);}})[_0xa626('0x25')](function(_0x1de517){if(_0x1de517){return _0x1de517?{'count':_0x400c66,'rows':_0x1de517}:null;}})[_0xa626('0x25')](respondWithResult(_0x5058ff,null))[_0xa626('0x4b')](handleError(_0x5058ff,null));};exports['addConfiguration']=function(_0x84a0e3,_0x3a9a79,_0x157f72){if(_0x84a0e3['body']['id']){delete _0x84a0e3['body']['id'];}return db[_0xa626('0x2c')][_0xa626('0x4f')]({'where':{'id':_0x84a0e3[_0xa626('0x48')]['id']}})[_0xa626('0x25')](handleEntityNotFound(_0x3a9a79,null))[_0xa626('0x25')](function(_0x42acb2){if(_0x42acb2){_0x84a0e3[_0xa626('0x4d')][_0xa626('0x50')]=_0x42acb2['id'];_0x84a0e3[_0xa626('0x4d')][_0xa626('0x51')]=integrations[_0xa626('0x52')](_0x84a0e3[_0xa626('0x4d')][_0xa626('0x53')],_0x84a0e3[_0xa626('0x4d')][_0xa626('0x2f')]);_0x84a0e3[_0xa626('0x4d')]['Descriptions']=integrations[_0xa626('0x54')](_0x84a0e3[_0xa626('0x4d')][_0xa626('0x53')],_0x84a0e3[_0xa626('0x4d')][_0xa626('0x2f')]);return db[_0xa626('0x4e')][_0xa626('0x4c')](_0x84a0e3[_0xa626('0x4d')],{'include':[{'model':db['SalesforceField'],'as':_0xa626('0x51')},{'model':db[_0xa626('0x55')],'as':_0xa626('0x56')}]});}return null;})['then'](respondWithResult(_0x3a9a79,null))['catch'](handleError(_0x3a9a79,null));};exports[_0xa626('0x57')]=function(_0x50ff98,_0x14efd,_0x18b915){var _0x517a98;var _0x1ea087='';var _0x10e406='Task';return db[_0xa626('0x2c')]['findOne']({'where':{'id':_0x50ff98[_0xa626('0x48')]['id']},'attributes':['id',_0xa626('0x58'),'clientId',_0xa626('0x59'),_0xa626('0x5a'),_0xa626('0x5b'),'securityToken']})[_0xa626('0x25')](handleEntityNotFound(_0x14efd,null))['then'](function(_0x3cb45e){if(_0x3cb45e){_0x1ea087=_0x3cb45e[_0xa626('0x58')];var _0x320727=_0x1ea087[_0xa626('0x5c')](-0x1);if(_0x320727==='/'){_0x1ea087=_0x1ea087[_0xa626('0x5d')](0x0,_0x1ea087[_0xa626('0x5e')](_0x320727));}_0x517a98=new jsforce[(_0xa626('0x5f'))]({'oauth2':{'loginUrl':_0x1ea087,'clientId':_0x3cb45e[_0xa626('0x60')],'clientSecret':_0x3cb45e[_0xa626('0x59')]}});return _0x517a98[_0xa626('0x61')](_0x3cb45e[_0xa626('0x5a')],_0x3cb45e[_0xa626('0x5b')]['concat'](_0x3cb45e[_0xa626('0x62')]));}})[_0xa626('0x25')](function(_0x3ac7ce){if(_0x3ac7ce){if(!_[_0xa626('0x63')](_0x50ff98[_0xa626('0x34')][_0xa626('0x64')])){_0x10e406=_0x50ff98[_0xa626('0x34')]['ticketType'];}return _0x517a98['sobject'](_0x10e406)['describe']();}})[_0xa626('0x25')](function(_0x5149d1){var _0x53afa5=[_0xa626('0x65'),_0xa626('0x66'),_0xa626('0x67'),_0xa626('0x68'),_0xa626('0x69'),'Description'];var _0x53db77=['string','int',_0xa626('0x6a'),_0xa626('0x6b'),'email',_0xa626('0x6c'),_0xa626('0x6d')];if(_0x5149d1){_[_0xa626('0x6e')](_0x5149d1['fields'],function(_0x3db642){return _0x53afa5[_0xa626('0x6f')](_0x3db642[_0xa626('0x32')])||!_0x53db77[_0xa626('0x6f')](_0x3db642[_0xa626('0x2f')]);});return{'count':_0x5149d1['fields'][_0xa626('0x49')],'rows':_[_0xa626('0x2b')](_0x5149d1[_0xa626('0x38')],function(_0x50f403){return{'id':_0x50f403[_0xa626('0x32')],'name':_0x50f403[_0xa626('0x70')],'custom':_0x50f403[_0xa626('0x71')],'options':_0x50f403[_0xa626('0x72')][_0xa626('0x49')]>0x0?_[_0xa626('0x2b')](_0x50f403['picklistValues'],function(_0x23dab3){return{'name':_0x23dab3[_0xa626('0x70')],'value':_0x23dab3[_0xa626('0x73')]};}):_0x50f403[_0xa626('0x2f')]==_0xa626('0x6b')?[{'name':_0xa626('0x74'),'value':'true'},{'name':_0xa626('0x75'),'value':_0xa626('0x76')}]:[]};})};}})['then'](respondWithResult(_0x14efd,null))[_0xa626('0x4b')](function(_0x41870e){var _0x3f7e6d=_0x50ff98[_0xa626('0x34')][_0xa626('0x77')]?0x1f4:_0x41870e['statusCode']||0x1f4;logger[_0xa626('0x78')](_0xa626('0x79'),_0xa626('0x57'),_0x3f7e6d,JSON['stringify'](_0x41870e));delete _0x41870e['name'];if(_0x3f7e6d===0x191){_0x3f7e6d=0x190;}_0x14efd[_0xa626('0x1a')](_0x3f7e6d)[_0xa626('0x29')](_0x50ff98[_0xa626('0x34')][_0xa626('0x77')]?{'message':_0xa626('0x7a'),'statusCode':_0x41870e[_0xa626('0x7b')]}:_0x41870e);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index d0e6b19..e3d2337 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 _0x1cc7=['path','rimraf','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','request-promise'];(function(_0x503d8e,_0x2b6af2){var _0x576ef5=function(_0x52b004){while(--_0x52b004){_0x503d8e['push'](_0x503d8e['shift']());}};_0x576ef5(++_0x2b6af2);}(_0x1cc7,0x15a));var _0x71cc=function(_0x3a2213,_0x301b1c){_0x3a2213=_0x3a2213-0x0;var _0xd30e19=_0x1cc7[_0x3a2213];return _0xd30e19;};'use strict';var _=require(_0x71cc('0x0'));var util=require(_0x71cc('0x1'));var logger=require(_0x71cc('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x71cc('0x3'));var fs=require('fs');var path=require(_0x71cc('0x4'));var rimraf=require(_0x71cc('0x5'));var config=require('../../config/environment');var attributes=require('./intSalesforceAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x71cc('0x6')]=function(_0x4ecf81,_0xc0444e){return _0x4ecf81[_0x71cc('0x7')](_0x71cc('0x8'),attributes,{'tableName':_0x71cc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x88ea=['define','SalesforceAccount','util','moment','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x43c774,_0x2d3bd0){var _0x26e588=function(_0x32168a){while(--_0x32168a){_0x43c774['push'](_0x43c774['shift']());}};_0x26e588(++_0x2d3bd0);}(_0x88ea,0x110));var _0xa88e=function(_0x4fca3e,_0x3e2725){_0x4fca3e=_0x4fca3e-0x0;var _0x2ef3fb=_0x88ea[_0x4fca3e];return _0x2ef3fb;};'use strict';var _=require('lodash');var util=require(_0xa88e('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xa88e('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa88e('0x2'));var config=require(_0xa88e('0x3'));var attributes=require(_0xa88e('0x4'));var integrations=require(_0xa88e('0x5'));module[_0xa88e('0x6')]=function(_0x572bfd,_0x2e4c68){return _0x572bfd[_0xa88e('0x7')](_0xa88e('0x8'),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 5d02aea..0cea2d6 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 _0x733f=['lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','SalesforceAccount,\x20%s,\x20%s','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','attributes','limit','include','map','model','ShowSalesforceAccount','where'];(function(_0x49fd58,_0xc0f75f){var _0xe6a45d=function(_0x44fc23){while(--_0x44fc23){_0x49fd58['push'](_0x49fd58['shift']());}};_0xe6a45d(++_0xc0f75f);}(_0x733f,0x120));var _0xf733=function(_0x47a371,_0x892e6a){_0x47a371=_0x47a371-0x0;var _0x50f139=_0x733f[_0x47a371];return _0x50f139;};'use strict';var _=require(_0xf733('0x0'));var util=require('util');var moment=require(_0xf733('0x1'));var BPromise=require(_0xf733('0x2'));var rs=require(_0xf733('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf733('0x4'))['db'];var utils=require(_0xf733('0x5'));var logger=require(_0xf733('0x6'))(_0xf733('0x7'));var config=require(_0xf733('0x8'));var jayson=require(_0xf733('0x9'));var client=jayson[_0xf733('0xa')][_0xf733('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2390fc,_0x5b10a7,_0xba5aba){return new BPromise(function(_0x10abc6,_0x48fb67){return client[_0xf733('0xc')](_0x2390fc,_0xba5aba)[_0xf733('0xd')](function(_0x269e83){logger[_0xf733('0xe')]('SalesforceAccount,\x20%s,\x20%s',_0x5b10a7,_0xf733('0xf'));logger[_0xf733('0x10')](_0xf733('0x11'),_0x5b10a7,_0xf733('0xf'),JSON[_0xf733('0x12')](_0x269e83));if(_0x269e83[_0xf733('0x13')]){if(_0x269e83[_0xf733('0x13')]['code']===0x1f4){logger[_0xf733('0x13')](_0xf733('0x14'),_0x5b10a7,_0x269e83[_0xf733('0x13')][_0xf733('0x15')]);return _0x48fb67(_0x269e83['error'][_0xf733('0x15')]);}logger[_0xf733('0x13')]('SalesforceAccount,\x20%s,\x20%s',_0x5b10a7,_0x269e83[_0xf733('0x13')]['message']);return _0x10abc6(_0x269e83['error'][_0xf733('0x15')]);}else{logger['info'](_0xf733('0x14'),_0x5b10a7,'request\x20sent');_0x10abc6(_0x269e83[_0xf733('0x16')][_0xf733('0x15')]);}})[_0xf733('0x17')](function(_0x156f87){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x5b10a7,_0x156f87);_0x48fb67(_0x156f87);});});}exports[_0xf733('0x18')]=function(_0x52476f){var _0x55a6ee=this;return new Promise(function(_0xdb04bb,_0x22b8cd){return db[_0xf733('0x19')][_0xf733('0x1a')]({'raw':_0x52476f[_0xf733('0x1b')]?_0x52476f[_0xf733('0x1b')][_0xf733('0x1c')]===undefined?!![]:![]:!![],'where':_0x52476f[_0xf733('0x1b')]?_0x52476f[_0xf733('0x1b')]['where']||null:null,'attributes':_0x52476f[_0xf733('0x1b')]?_0x52476f[_0xf733('0x1b')][_0xf733('0x1d')]||null:null,'limit':_0x52476f[_0xf733('0x1b')]?_0x52476f[_0xf733('0x1b')][_0xf733('0x1e')]||null:null,'include':_0x52476f[_0xf733('0x1b')]?_0x52476f[_0xf733('0x1b')][_0xf733('0x1f')]?_[_0xf733('0x20')](_0x52476f[_0xf733('0x1b')][_0xf733('0x1f')],function(_0x343737){return{'model':db[_0x343737[_0xf733('0x21')]],'as':_0x343737['as'],'attributes':_0x343737[_0xf733('0x1d')],'include':_0x343737['include']?_[_0xf733('0x20')](_0x343737['include'],function(_0x50adef){return{'model':db[_0x50adef['model']],'as':_0x50adef['as'],'attributes':_0x50adef[_0xf733('0x1d')],'include':_0x50adef['include']?_[_0xf733('0x20')](_0x50adef[_0xf733('0x1f')],function(_0x2980f2){return{'model':db[_0x2980f2[_0xf733('0x21')]],'as':_0x2980f2['as'],'attributes':_0x2980f2['attributes']};}):[]};}):[]};}):[]:[]})[_0xf733('0xd')](function(_0x3e0722){logger[_0xf733('0xe')](_0xf733('0x18'),_0x52476f);logger[_0xf733('0x10')](_0xf733('0x18'),_0x52476f,JSON[_0xf733('0x12')](_0x3e0722));_0xdb04bb(_0x3e0722);})[_0xf733('0x17')](function(_0x9d3e0c){logger[_0xf733('0x13')](_0xf733('0x18'),_0x9d3e0c[_0xf733('0x15')],_0x52476f);_0x22b8cd(_0x55a6ee[_0xf733('0x13')](0x1f4,_0x9d3e0c[_0xf733('0x15')]));});});};exports[_0xf733('0x22')]=function(_0x128166){var _0x3e3916=this;return new Promise(function(_0x42af28,_0x52b91f){return db[_0xf733('0x19')]['find']({'raw':_0x128166[_0xf733('0x1b')]?_0x128166[_0xf733('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x128166[_0xf733('0x1b')]?_0x128166[_0xf733('0x1b')][_0xf733('0x23')]||null:null,'attributes':_0x128166[_0xf733('0x1b')]?_0x128166[_0xf733('0x1b')]['attributes']||null:null,'include':_0x128166[_0xf733('0x1b')]?_0x128166[_0xf733('0x1b')][_0xf733('0x1f')]?_[_0xf733('0x20')](_0x128166[_0xf733('0x1b')][_0xf733('0x1f')],function(_0x88be5f){return{'model':db[_0x88be5f[_0xf733('0x21')]],'as':_0x88be5f['as'],'attributes':_0x88be5f['attributes'],'include':_0x88be5f['include']?_[_0xf733('0x20')](_0x88be5f[_0xf733('0x1f')],function(_0x27324b){return{'model':db[_0x27324b[_0xf733('0x21')]],'as':_0x27324b['as'],'attributes':_0x27324b[_0xf733('0x1d')],'include':_0x27324b[_0xf733('0x1f')]?_['map'](_0x27324b[_0xf733('0x1f')],function(_0x1dab46){return{'model':db[_0x1dab46[_0xf733('0x21')]],'as':_0x1dab46['as'],'attributes':_0x1dab46[_0xf733('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf733('0xd')](function(_0x5bfa13){logger[_0xf733('0xe')](_0xf733('0x22'),_0x128166);logger[_0xf733('0x10')](_0xf733('0x22'),_0x128166,JSON[_0xf733('0x12')](_0x5bfa13));_0x42af28(_0x5bfa13);})['catch'](function(_0x49325f){logger[_0xf733('0x13')](_0xf733('0x22'),_0x49325f[_0xf733('0x15')],_0x128166);_0x52b91f(_0x3e3916[_0xf733('0x13')](0x1f4,_0x49325f['message']));});});}; \ No newline at end of file +var _0x8daf=['attributes','limit','include','map','model','then','GetSalesforceAccount','ShowSalesforceAccount','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SalesforceAccount','findAll','options','raw','where'];(function(_0x137bcf,_0x5d9120){var _0x3ffe78=function(_0x420140){while(--_0x420140){_0x137bcf['push'](_0x137bcf['shift']());}};_0x3ffe78(++_0x5d9120);}(_0x8daf,0x15c));var _0xf8da=function(_0x4d65d8,_0x56cd64){_0x4d65d8=_0x4d65d8-0x0;var _0x37ca6f=_0x8daf[_0x4d65d8];return _0x37ca6f;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf8da('0x0'));var fs=require('fs');var Redis=require(_0xf8da('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xf8da('0x2'));var logger=require(_0xf8da('0x3'))(_0xf8da('0x4'));var config=require(_0xf8da('0x5'));var jayson=require(_0xf8da('0x6'));var client=jayson[_0xf8da('0x7')][_0xf8da('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4565a9,_0xef5c26,_0x585e0c){return new BPromise(function(_0x30bc1d,_0x4bc1e3){return client[_0xf8da('0x9')](_0x4565a9,_0x585e0c)['then'](function(_0x5059a1){logger[_0xf8da('0xa')](_0xf8da('0xb'),_0xef5c26,_0xf8da('0xc'));logger[_0xf8da('0xd')](_0xf8da('0xe'),_0xef5c26,_0xf8da('0xc'),JSON[_0xf8da('0xf')](_0x5059a1));if(_0x5059a1[_0xf8da('0x10')]){if(_0x5059a1['error'][_0xf8da('0x11')]===0x1f4){logger[_0xf8da('0x10')](_0xf8da('0xb'),_0xef5c26,_0x5059a1[_0xf8da('0x10')]['message']);return _0x4bc1e3(_0x5059a1[_0xf8da('0x10')]['message']);}logger[_0xf8da('0x10')](_0xf8da('0xb'),_0xef5c26,_0x5059a1[_0xf8da('0x10')][_0xf8da('0x12')]);return _0x30bc1d(_0x5059a1[_0xf8da('0x10')]['message']);}else{logger[_0xf8da('0xa')](_0xf8da('0xb'),_0xef5c26,_0xf8da('0xc'));_0x30bc1d(_0x5059a1[_0xf8da('0x13')][_0xf8da('0x12')]);}})[_0xf8da('0x14')](function(_0x17eb8d){logger['error'](_0xf8da('0xb'),_0xef5c26,_0x17eb8d);_0x4bc1e3(_0x17eb8d);});});}exports['GetSalesforceAccount']=function(_0x5dc9db){var _0x365fb7=this;return new Promise(function(_0x2611c2,_0x59b28e){return db[_0xf8da('0x15')][_0xf8da('0x16')]({'raw':_0x5dc9db[_0xf8da('0x17')]?_0x5dc9db[_0xf8da('0x17')][_0xf8da('0x18')]===undefined?!![]:![]:!![],'where':_0x5dc9db[_0xf8da('0x17')]?_0x5dc9db[_0xf8da('0x17')][_0xf8da('0x19')]||null:null,'attributes':_0x5dc9db['options']?_0x5dc9db[_0xf8da('0x17')][_0xf8da('0x1a')]||null:null,'limit':_0x5dc9db['options']?_0x5dc9db[_0xf8da('0x17')][_0xf8da('0x1b')]||null:null,'include':_0x5dc9db['options']?_0x5dc9db['options'][_0xf8da('0x1c')]?_[_0xf8da('0x1d')](_0x5dc9db[_0xf8da('0x17')][_0xf8da('0x1c')],function(_0x493d6c){return{'model':db[_0x493d6c['model']],'as':_0x493d6c['as'],'attributes':_0x493d6c['attributes'],'include':_0x493d6c['include']?_[_0xf8da('0x1d')](_0x493d6c[_0xf8da('0x1c')],function(_0x43934c){return{'model':db[_0x43934c[_0xf8da('0x1e')]],'as':_0x43934c['as'],'attributes':_0x43934c['attributes'],'include':_0x43934c[_0xf8da('0x1c')]?_[_0xf8da('0x1d')](_0x43934c[_0xf8da('0x1c')],function(_0x550590){return{'model':db[_0x550590[_0xf8da('0x1e')]],'as':_0x550590['as'],'attributes':_0x550590['attributes']};}):[]};}):[]};}):[]:[]})[_0xf8da('0x1f')](function(_0xfe65c0){logger[_0xf8da('0xa')](_0xf8da('0x20'),_0x5dc9db);logger[_0xf8da('0xd')](_0xf8da('0x20'),_0x5dc9db,JSON[_0xf8da('0xf')](_0xfe65c0));_0x2611c2(_0xfe65c0);})[_0xf8da('0x14')](function(_0x51014c){logger[_0xf8da('0x10')]('GetSalesforceAccount',_0x51014c['message'],_0x5dc9db);_0x59b28e(_0x365fb7[_0xf8da('0x10')](0x1f4,_0x51014c[_0xf8da('0x12')]));});});};exports[_0xf8da('0x21')]=function(_0x96c804){var _0x41cee6=this;return new Promise(function(_0x587a04,_0x2778fa){return db['SalesforceAccount']['find']({'raw':_0x96c804['options']?_0x96c804['options']['raw']===undefined?!![]:![]:!![],'where':_0x96c804[_0xf8da('0x17')]?_0x96c804['options'][_0xf8da('0x19')]||null:null,'attributes':_0x96c804[_0xf8da('0x17')]?_0x96c804[_0xf8da('0x17')]['attributes']||null:null,'include':_0x96c804['options']?_0x96c804[_0xf8da('0x17')][_0xf8da('0x1c')]?_[_0xf8da('0x1d')](_0x96c804[_0xf8da('0x17')][_0xf8da('0x1c')],function(_0x3d8fce){return{'model':db[_0x3d8fce['model']],'as':_0x3d8fce['as'],'attributes':_0x3d8fce[_0xf8da('0x1a')],'include':_0x3d8fce[_0xf8da('0x1c')]?_[_0xf8da('0x1d')](_0x3d8fce[_0xf8da('0x1c')],function(_0x8036b3){return{'model':db[_0x8036b3[_0xf8da('0x1e')]],'as':_0x8036b3['as'],'attributes':_0x8036b3['attributes'],'include':_0x8036b3[_0xf8da('0x1c')]?_[_0xf8da('0x1d')](_0x8036b3[_0xf8da('0x1c')],function(_0xb6d25a){return{'model':db[_0xb6d25a['model']],'as':_0xb6d25a['as'],'attributes':_0xb6d25a[_0xf8da('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x7b1dfa){logger['info'](_0xf8da('0x21'),_0x96c804);logger['debug'](_0xf8da('0x21'),_0x96c804,JSON[_0xf8da('0xf')](_0x7b1dfa));_0x587a04(_0x7b1dfa);})[_0xf8da('0x14')](function(_0x2197bd){logger[_0xf8da('0x10')](_0xf8da('0x21'),_0x2197bd['message'],_0x96c804);_0x2778fa(_0x41cee6[_0xf8da('0x10')](0x1f4,_0x2197bd[_0xf8da('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 44efb5d..620e626 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 _0x2032=['Router','fs-extra','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','exports','util','path','connect-timeout'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2032,0xd9));var _0x2203=function(_0x6edc84,_0x2588a2){_0x6edc84=_0x6edc84-0x0;var _0x43be78=_0x2032[_0x6edc84];return _0x43be78;};'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/fields',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['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x2203('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x2203('0x13')]=router; \ No newline at end of file +var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xdb28,0x106));var _0x8db2=function(_0xa21de0,_0x224fac){_0xa21de0=_0xa21de0-0x0;var _0x3c32c3=_0xdb28[_0xa21de0];return _0x3c32c3;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./intSalesforceConfiguration.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 317baa0..bac2771 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 _0x55c6=['Case','contact','lead','account_contact_lead','contact_lead','nothing','sequelize','STRING','ENUM','Task'];(function(_0x41bba7,_0x1e04b2){var _0x21236f=function(_0x40132a){while(--_0x40132a){_0x41bba7['push'](_0x41bba7['shift']());}};_0x21236f(++_0x1e04b2);}(_0x55c6,0x7e));var _0x655c=function(_0x3e798f,_0x483cfe){_0x3e798f=_0x3e798f-0x0;var _0x5be707=_0x55c6[_0x3e798f];return _0x5be707;};'use strict';var Sequelize=require(_0x655c('0x0'));module['exports']={'name':{'type':Sequelize[_0x655c('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x655c('0x2')](_0x655c('0x3'),_0x655c('0x4')),'defaultValue':_0x655c('0x3')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0x655c('0x5'),_0x655c('0x6'),_0x655c('0x7'),'account'),'defaultValue':_0x655c('0x8')},'moduleCreate':{'type':Sequelize['ENUM'](_0x655c('0x9'),_0x655c('0x5'),'lead','account'),'defaultValue':_0x655c('0x6')},'leadId':{'type':Sequelize[_0x655c('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x655c('0x1')]},'additionalSearchContact':{'type':Sequelize[_0x655c('0x1')]},'additionalSearchLead':{'type':Sequelize[_0x655c('0x1')]}}; \ No newline at end of file +var _0xc045=['Case','contact','account','contact_lead','lead','exports','STRING','ENUM','Task'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xc045,0x19a));var _0x5c04=function(_0x4fbb15,_0x21be0c){_0x4fbb15=_0x4fbb15-0x0;var _0x436338=_0xc045[_0x4fbb15];return _0x436338;};'use strict';var Sequelize=require('sequelize');module[_0x5c04('0x0')]={'name':{'type':Sequelize[_0x5c04('0x1')]},'description':{'type':Sequelize[_0x5c04('0x1')]},'ticketType':{'type':Sequelize[_0x5c04('0x2')](_0x5c04('0x3'),_0x5c04('0x4')),'defaultValue':_0x5c04('0x3')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0x5c04('0x5'),'lead','account_contact_lead',_0x5c04('0x6')),'defaultValue':_0x5c04('0x7')},'moduleCreate':{'type':Sequelize['ENUM']('nothing','contact',_0x5c04('0x8'),_0x5c04('0x6')),'defaultValue':_0x5c04('0x8')},'leadId':{'type':Sequelize[_0x5c04('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x5c04('0x1')]},'additionalSearchContact':{'type':Sequelize[_0x5c04('0x1')]},'additionalSearchLead':{'type':Sequelize[_0x5c04('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 0e99bb6..de2499d 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 _0xdd12=['eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','then','error','stack','name','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','query','keys','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','intersection','find','create','catch','update','body','destroy','getFields','findOne','options','getSubjects','order','getDescriptions','SalesforceField'];(function(_0x49dd90,_0x47e0ef){var _0x28dab4=function(_0x326e42){while(--_0x326e42){_0x49dd90['push'](_0x49dd90['shift']());}};_0x28dab4(++_0x47e0ef);}(_0xdd12,0xf6));var _0x2dd1=function(_0x4ab553,_0x2de53c){_0x4ab553=_0x4ab553-0x0;var _0x14467e=_0xdd12[_0x4ab553];return _0x14467e;};'use strict';var emlformat=require(_0x2dd1('0x0'));var rimraf=require(_0x2dd1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2dd1('0x2'));var rp=require(_0x2dd1('0x3'));var moment=require('moment');var BPromise=require(_0x2dd1('0x4'));var Mustache=require(_0x2dd1('0x5'));var util=require('util');var path=require(_0x2dd1('0x6'));var sox=require(_0x2dd1('0x7'));var csv=require(_0x2dd1('0x8'));var ejs=require(_0x2dd1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2dd1('0xa'));var squel=require(_0x2dd1('0xb'));var crypto=require(_0x2dd1('0xc'));var jsforce=require(_0x2dd1('0xd'));var deskjs=require(_0x2dd1('0xe'));var toCsv=require(_0x2dd1('0x8'));var querystring=require(_0x2dd1('0xf'));var Papa=require(_0x2dd1('0x10'));var Redis=require(_0x2dd1('0x11'));var authService=require(_0x2dd1('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2dd1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2dd1('0x14'))('api');var utils=require(_0x2dd1('0x15'));var config=require(_0x2dd1('0x16'));var licenseUtil=require(_0x2dd1('0x17'));var db=require(_0x2dd1('0x18'))['db'];function respondWithStatusCode(_0x346daa,_0x4b7b1d){_0x4b7b1d=_0x4b7b1d||0xcc;return function(_0x1e16fe){if(_0x1e16fe){return _0x346daa[_0x2dd1('0x19')](_0x4b7b1d);}return _0x346daa[_0x2dd1('0x1a')](_0x4b7b1d)[_0x2dd1('0x1b')]();};}function respondWithResult(_0x52edc8,_0x54106f){_0x54106f=_0x54106f||0xc8;return function(_0x5981a5){if(_0x5981a5){return _0x52edc8[_0x2dd1('0x1a')](_0x54106f)[_0x2dd1('0x1c')](_0x5981a5);}};}function respondWithFilteredResult(_0x31fbf4,_0xb3cd58){return function(_0x1c5b7e){if(_0x1c5b7e){var _0x122ec6=typeof _0xb3cd58[_0x2dd1('0x1d')]===_0x2dd1('0x1e')&&typeof _0xb3cd58['limit']===_0x2dd1('0x1e');var _0x350f15=_0x1c5b7e['count'];var _0x3d70df=_0x122ec6?0x0:_0xb3cd58[_0x2dd1('0x1d')];var _0x4c3a8a=_0x122ec6?_0x1c5b7e[_0x2dd1('0x1f')]:_0xb3cd58['offset']+_0xb3cd58[_0x2dd1('0x20')];var _0x5bfd92;if(_0x4c3a8a>=_0x350f15){_0x4c3a8a=_0x350f15;_0x5bfd92=0xc8;}else{_0x5bfd92=0xce;}_0x31fbf4['status'](_0x5bfd92);return _0x31fbf4[_0x2dd1('0x21')]('Content-Range',_0x3d70df+'-'+_0x4c3a8a+'/'+_0x350f15)[_0x2dd1('0x1c')](_0x1c5b7e);}return null;};}function patchUpdates(_0x4f8fd7){return function(_0x1d5122){try{jsonpatch['apply'](_0x1d5122,_0x4f8fd7,!![]);}catch(_0x1a8e61){return BPromise[_0x2dd1('0x22')](_0x1a8e61);}return _0x1d5122[_0x2dd1('0x23')]();};}function saveUpdates(_0x4db5e7,_0x3dd4b1){return function(_0x13bd2d){if(_0x13bd2d){return _0x13bd2d['update'](_0x4db5e7)[_0x2dd1('0x24')](function(_0x839952){return _0x839952;});}return null;};}function removeEntity(_0x4935c1,_0x21f12d){return function(_0x1f0c29){if(_0x1f0c29){return _0x1f0c29['destroy']()[_0x2dd1('0x24')](function(){_0x4935c1[_0x2dd1('0x1a')](0xcc)[_0x2dd1('0x1b')]();});}};}function handleEntityNotFound(_0x3cf45c,_0xd3ce9b){return function(_0x5d11a1){if(!_0x5d11a1){_0x3cf45c[_0x2dd1('0x19')](0x194);}return _0x5d11a1;};}function handleError(_0x24a122,_0x3cbf86){_0x3cbf86=_0x3cbf86||0x1f4;return function(_0x263b81){logger[_0x2dd1('0x25')](_0x263b81[_0x2dd1('0x26')]);if(_0x263b81['name']){delete _0x263b81[_0x2dd1('0x27')];}_0x24a122[_0x2dd1('0x1a')](_0x3cbf86)['send'](_0x263b81);};}exports[_0x2dd1('0x28')]=function(_0x478813,_0x2fa618){var _0x434461={},_0x2f6c21={},_0x2a984a={'count':0x0,'rows':[]};var _0x49d1f1=_[_0x2dd1('0x29')](db[_0x2dd1('0x2a')][_0x2dd1('0x2b')],function(_0x5a3f3a){return{'name':_0x5a3f3a[_0x2dd1('0x2c')],'type':_0x5a3f3a[_0x2dd1('0x2d')][_0x2dd1('0x2e')]};});_0x2f6c21['model']=_['map'](_0x49d1f1,_0x2dd1('0x27'));_0x2f6c21[_0x2dd1('0x2f')]=_[_0x2dd1('0x30')](_0x478813[_0x2dd1('0x2f')]);_0x2f6c21['filters']=_['intersection'](_0x2f6c21[_0x2dd1('0x31')],_0x2f6c21[_0x2dd1('0x2f')]);_0x434461[_0x2dd1('0x32')]=_['intersection'](_0x2f6c21[_0x2dd1('0x31')],qs['fields'](_0x478813[_0x2dd1('0x2f')][_0x2dd1('0x33')]));_0x434461[_0x2dd1('0x32')]=_0x434461[_0x2dd1('0x32')][_0x2dd1('0x34')]?_0x434461[_0x2dd1('0x32')]:_0x2f6c21[_0x2dd1('0x31')];if(!_0x478813[_0x2dd1('0x2f')][_0x2dd1('0x35')](_0x2dd1('0x36'))){_0x434461[_0x2dd1('0x20')]=qs[_0x2dd1('0x20')](_0x478813[_0x2dd1('0x2f')][_0x2dd1('0x20')]);_0x434461[_0x2dd1('0x1d')]=qs[_0x2dd1('0x1d')](_0x478813[_0x2dd1('0x2f')]['offset']);}_0x434461['order']=qs[_0x2dd1('0x37')](_0x478813['query'][_0x2dd1('0x37')]);_0x434461[_0x2dd1('0x38')]=qs[_0x2dd1('0x39')](_[_0x2dd1('0x3a')](_0x478813['query'],_0x2f6c21[_0x2dd1('0x39')]),_0x49d1f1);if(_0x478813[_0x2dd1('0x2f')]['filter']){_0x434461[_0x2dd1('0x38')]=_[_0x2dd1('0x3b')](_0x434461[_0x2dd1('0x38')],{'$or':_[_0x2dd1('0x29')](_0x49d1f1,function(_0x337636){if(_0x337636[_0x2dd1('0x2d')]!==_0x2dd1('0x3c')){var _0x25247b={};_0x25247b[_0x337636[_0x2dd1('0x27')]]={'$like':'%'+_0x478813['query'][_0x2dd1('0x3d')]+'%'};return _0x25247b;}})});}_0x434461=_['merge']({},_0x434461,_0x478813['options']);var _0xd68037={'where':_0x434461[_0x2dd1('0x38')]};return db['SalesforceConfiguration'][_0x2dd1('0x1f')](_0xd68037)[_0x2dd1('0x24')](function(_0x794903){_0x2a984a[_0x2dd1('0x1f')]=_0x794903;if(_0x478813[_0x2dd1('0x2f')][_0x2dd1('0x3e')]){_0x434461[_0x2dd1('0x3f')]=[{'all':!![]}];}return db[_0x2dd1('0x2a')][_0x2dd1('0x40')](_0x434461);})['then'](function(_0xf35b51){_0x2a984a[_0x2dd1('0x41')]=_0xf35b51;return _0x2a984a;})[_0x2dd1('0x24')](respondWithFilteredResult(_0x2fa618,_0x434461))['catch'](handleError(_0x2fa618,null));};exports[_0x2dd1('0x42')]=function(_0x2f0112,_0x598c74){var _0x3cddb4={'raw':![],'where':{'id':_0x2f0112[_0x2dd1('0x43')]['id']}},_0x55ff8f={};_0x55ff8f['model']=_[_0x2dd1('0x30')](db[_0x2dd1('0x2a')][_0x2dd1('0x2b')]);_0x55ff8f['query']=_['keys'](_0x2f0112['query']);_0x55ff8f[_0x2dd1('0x39')]=_[_0x2dd1('0x44')](_0x55ff8f[_0x2dd1('0x31')],_0x55ff8f[_0x2dd1('0x2f')]);_0x3cddb4[_0x2dd1('0x32')]=_[_0x2dd1('0x44')](_0x55ff8f['model'],qs[_0x2dd1('0x33')](_0x2f0112['query'][_0x2dd1('0x33')]));_0x3cddb4[_0x2dd1('0x32')]=_0x3cddb4[_0x2dd1('0x32')][_0x2dd1('0x34')]?_0x3cddb4['attributes']:_0x55ff8f[_0x2dd1('0x31')];if(_0x2f0112[_0x2dd1('0x2f')][_0x2dd1('0x3e')]){_0x3cddb4[_0x2dd1('0x3f')]=[{'all':!![]}];}_0x3cddb4=_[_0x2dd1('0x3b')]({},_0x3cddb4,_0x2f0112['options']);return db[_0x2dd1('0x2a')][_0x2dd1('0x45')](_0x3cddb4)[_0x2dd1('0x24')](handleEntityNotFound(_0x598c74,null))[_0x2dd1('0x24')](respondWithResult(_0x598c74,null))['catch'](handleError(_0x598c74,null));};exports[_0x2dd1('0x46')]=function(_0x5e57fc,_0x513c26){return db['SalesforceConfiguration'][_0x2dd1('0x46')](_0x5e57fc['body'],{})['then'](respondWithResult(_0x513c26,0xc9))[_0x2dd1('0x47')](handleError(_0x513c26,null));};exports[_0x2dd1('0x48')]=function(_0xfda23c,_0x226fc1){if(_0xfda23c[_0x2dd1('0x49')]['id']){delete _0xfda23c['body']['id'];}return db['SalesforceConfiguration'][_0x2dd1('0x45')]({'where':{'id':_0xfda23c['params']['id']}})[_0x2dd1('0x24')](handleEntityNotFound(_0x226fc1,null))[_0x2dd1('0x24')](saveUpdates(_0xfda23c['body'],null))[_0x2dd1('0x24')](respondWithResult(_0x226fc1,null))['catch'](handleError(_0x226fc1,null));};exports[_0x2dd1('0x4a')]=function(_0xbce5bb,_0x114f05){return db[_0x2dd1('0x2a')][_0x2dd1('0x45')]({'where':{'id':_0xbce5bb[_0x2dd1('0x43')]['id']}})[_0x2dd1('0x24')](handleEntityNotFound(_0x114f05,null))[_0x2dd1('0x24')](removeEntity(_0x114f05,null))[_0x2dd1('0x47')](handleError(_0x114f05,null));};exports[_0x2dd1('0x4b')]=function(_0x8f20b0,_0x599e5c,_0x1a34af){var _0x1a4b3a={};var _0x2f869e={};var _0x1801c6;var _0xe3a8f2;return db['SalesforceConfiguration'][_0x2dd1('0x4c')]({'where':{'id':_0x8f20b0[_0x2dd1('0x43')]['id']}})[_0x2dd1('0x24')](handleEntityNotFound(_0x599e5c,null))['then'](function(_0x3f3847){if(_0x3f3847){_0x1801c6=_0x3f3847;_0x2f869e[_0x2dd1('0x31')]=_['keys'](db['SalesforceField'][_0x2dd1('0x2b')]);_0x2f869e[_0x2dd1('0x2f')]=_[_0x2dd1('0x30')](_0x8f20b0[_0x2dd1('0x2f')]);_0x2f869e['filters']=_[_0x2dd1('0x44')](_0x2f869e[_0x2dd1('0x31')],_0x2f869e['query']);_0x1a4b3a[_0x2dd1('0x32')]=_['intersection'](_0x2f869e[_0x2dd1('0x31')],qs[_0x2dd1('0x33')](_0x8f20b0[_0x2dd1('0x2f')][_0x2dd1('0x33')]));_0x1a4b3a[_0x2dd1('0x32')]=_0x1a4b3a['attributes'][_0x2dd1('0x34')]?_0x1a4b3a['attributes']:_0x2f869e[_0x2dd1('0x31')];_0x1a4b3a['order']=qs[_0x2dd1('0x37')](_0x8f20b0[_0x2dd1('0x2f')]['sort']);_0x1a4b3a['where']=qs['filters'](_[_0x2dd1('0x3a')](_0x8f20b0[_0x2dd1('0x2f')],_0x2f869e[_0x2dd1('0x39')]));if(_0x8f20b0['query']['filter']){_0x1a4b3a['where']=_['merge'](_0x1a4b3a[_0x2dd1('0x38')],{'$or':_[_0x2dd1('0x29')](_0x1a4b3a['attributes'],function(_0xe8e9a3){var _0x4dad56={};_0x4dad56[_0xe8e9a3]={'$like':'%'+_0x8f20b0['query'][_0x2dd1('0x3d')]+'%'};return _0x4dad56;})});}_0x1a4b3a=_[_0x2dd1('0x3b')]({},_0x1a4b3a,_0x8f20b0[_0x2dd1('0x4d')]);return _0x1801c6['getFields'](_0x1a4b3a);}})[_0x2dd1('0x24')](function(_0x4a1368){if(_0x4a1368){_0xe3a8f2=_0x4a1368[_0x2dd1('0x34')];if(!_0x8f20b0[_0x2dd1('0x2f')][_0x2dd1('0x35')](_0x2dd1('0x36'))){_0x1a4b3a[_0x2dd1('0x20')]=qs['limit'](_0x8f20b0[_0x2dd1('0x2f')]['limit']);_0x1a4b3a['offset']=qs[_0x2dd1('0x1d')](_0x8f20b0[_0x2dd1('0x2f')][_0x2dd1('0x1d')]);}return _0x1801c6[_0x2dd1('0x4b')](_0x1a4b3a);}})[_0x2dd1('0x24')](function(_0x2aecdc){if(_0x2aecdc){return _0x2aecdc?{'count':_0xe3a8f2,'rows':_0x2aecdc}:null;}})[_0x2dd1('0x24')](respondWithResult(_0x599e5c,null))['catch'](handleError(_0x599e5c,null));};exports[_0x2dd1('0x4e')]=function(_0xe69f7d,_0x3249a5,_0x39e299){var _0x3f6076={};var _0x5415c9={};var _0x56f2a7;var _0x3c2088;return db['SalesforceConfiguration'][_0x2dd1('0x4c')]({'where':{'id':_0xe69f7d['params']['id']}})[_0x2dd1('0x24')](handleEntityNotFound(_0x3249a5,null))[_0x2dd1('0x24')](function(_0x3a4c76){if(_0x3a4c76){_0x56f2a7=_0x3a4c76;_0x5415c9[_0x2dd1('0x31')]=_[_0x2dd1('0x30')](db['SalesforceField'][_0x2dd1('0x2b')]);_0x5415c9[_0x2dd1('0x2f')]=_[_0x2dd1('0x30')](_0xe69f7d[_0x2dd1('0x2f')]);_0x5415c9[_0x2dd1('0x39')]=_[_0x2dd1('0x44')](_0x5415c9[_0x2dd1('0x31')],_0x5415c9['query']);_0x3f6076[_0x2dd1('0x32')]=_[_0x2dd1('0x44')](_0x5415c9[_0x2dd1('0x31')],qs[_0x2dd1('0x33')](_0xe69f7d[_0x2dd1('0x2f')]['fields']));_0x3f6076[_0x2dd1('0x32')]=_0x3f6076[_0x2dd1('0x32')][_0x2dd1('0x34')]?_0x3f6076['attributes']:_0x5415c9['model'];_0x3f6076[_0x2dd1('0x4f')]=qs[_0x2dd1('0x37')](_0xe69f7d[_0x2dd1('0x2f')][_0x2dd1('0x37')]);_0x3f6076[_0x2dd1('0x38')]=qs['filters'](_[_0x2dd1('0x3a')](_0xe69f7d['query'],_0x5415c9['filters']));if(_0xe69f7d['query'][_0x2dd1('0x3d')]){_0x3f6076[_0x2dd1('0x38')]=_[_0x2dd1('0x3b')](_0x3f6076[_0x2dd1('0x38')],{'$or':_['map'](_0x3f6076['attributes'],function(_0x1e57fd){var _0x305a12={};_0x305a12[_0x1e57fd]={'$like':'%'+_0xe69f7d[_0x2dd1('0x2f')][_0x2dd1('0x3d')]+'%'};return _0x305a12;})});}_0x3f6076=_[_0x2dd1('0x3b')]({},_0x3f6076,_0xe69f7d[_0x2dd1('0x4d')]);return _0x56f2a7[_0x2dd1('0x4e')](_0x3f6076);}})[_0x2dd1('0x24')](function(_0x5c0b33){if(_0x5c0b33){_0x3c2088=_0x5c0b33[_0x2dd1('0x34')];if(!_0xe69f7d[_0x2dd1('0x2f')][_0x2dd1('0x35')](_0x2dd1('0x36'))){_0x3f6076['limit']=qs[_0x2dd1('0x20')](_0xe69f7d[_0x2dd1('0x2f')][_0x2dd1('0x20')]);_0x3f6076[_0x2dd1('0x1d')]=qs[_0x2dd1('0x1d')](_0xe69f7d['query'][_0x2dd1('0x1d')]);}return _0x56f2a7['getSubjects'](_0x3f6076);}})[_0x2dd1('0x24')](function(_0x2f5876){if(_0x2f5876){return _0x2f5876?{'count':_0x3c2088,'rows':_0x2f5876}:null;}})[_0x2dd1('0x24')](respondWithResult(_0x3249a5,null))[_0x2dd1('0x47')](handleError(_0x3249a5,null));};exports[_0x2dd1('0x50')]=function(_0xc3ae5b,_0x5b1046,_0x4c3877){var _0x58c76a={};var _0x13685d={};var _0x2b2512;var _0x5c93ca;return db[_0x2dd1('0x2a')][_0x2dd1('0x4c')]({'where':{'id':_0xc3ae5b[_0x2dd1('0x43')]['id']}})[_0x2dd1('0x24')](handleEntityNotFound(_0x5b1046,null))[_0x2dd1('0x24')](function(_0xc49470){if(_0xc49470){_0x2b2512=_0xc49470;_0x13685d[_0x2dd1('0x31')]=_[_0x2dd1('0x30')](db[_0x2dd1('0x51')]['rawAttributes']);_0x13685d['query']=_[_0x2dd1('0x30')](_0xc3ae5b[_0x2dd1('0x2f')]);_0x13685d[_0x2dd1('0x39')]=_[_0x2dd1('0x44')](_0x13685d['model'],_0x13685d[_0x2dd1('0x2f')]);_0x58c76a['attributes']=_[_0x2dd1('0x44')](_0x13685d[_0x2dd1('0x31')],qs[_0x2dd1('0x33')](_0xc3ae5b[_0x2dd1('0x2f')][_0x2dd1('0x33')]));_0x58c76a[_0x2dd1('0x32')]=_0x58c76a[_0x2dd1('0x32')][_0x2dd1('0x34')]?_0x58c76a[_0x2dd1('0x32')]:_0x13685d[_0x2dd1('0x31')];_0x58c76a['order']=qs[_0x2dd1('0x37')](_0xc3ae5b[_0x2dd1('0x2f')][_0x2dd1('0x37')]);_0x58c76a[_0x2dd1('0x38')]=qs[_0x2dd1('0x39')](_['pick'](_0xc3ae5b[_0x2dd1('0x2f')],_0x13685d['filters']));if(_0xc3ae5b['query'][_0x2dd1('0x3d')]){_0x58c76a[_0x2dd1('0x38')]=_[_0x2dd1('0x3b')](_0x58c76a[_0x2dd1('0x38')],{'$or':_['map'](_0x58c76a[_0x2dd1('0x32')],function(_0x3f9a40){var _0x541230={};_0x541230[_0x3f9a40]={'$like':'%'+_0xc3ae5b['query'][_0x2dd1('0x3d')]+'%'};return _0x541230;})});}_0x58c76a=_[_0x2dd1('0x3b')]({},_0x58c76a,_0xc3ae5b[_0x2dd1('0x4d')]);return _0x2b2512[_0x2dd1('0x50')](_0x58c76a);}})[_0x2dd1('0x24')](function(_0xb4e2fd){if(_0xb4e2fd){_0x5c93ca=_0xb4e2fd[_0x2dd1('0x34')];if(!_0xc3ae5b[_0x2dd1('0x2f')][_0x2dd1('0x35')]('nolimit')){_0x58c76a['limit']=qs[_0x2dd1('0x20')](_0xc3ae5b[_0x2dd1('0x2f')]['limit']);_0x58c76a[_0x2dd1('0x1d')]=qs[_0x2dd1('0x1d')](_0xc3ae5b[_0x2dd1('0x2f')][_0x2dd1('0x1d')]);}return _0x2b2512[_0x2dd1('0x50')](_0x58c76a);}})[_0x2dd1('0x24')](function(_0x46bc0e){if(_0x46bc0e){return _0x46bc0e?{'count':_0x5c93ca,'rows':_0x46bc0e}:null;}})[_0x2dd1('0x24')](respondWithResult(_0x5b1046,null))['catch'](handleError(_0x5b1046,null));}; \ No newline at end of file +var _0xe096=['find','create','body','update','catch','params','getFields','findOne','length','getSubjects','SalesforceField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','crypto','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','sendStatus','end','status','undefined','limit','offset','count','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','SalesforceConfiguration','findAll'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe096,0x13c));var _0x6e09=function(_0x1b0307,_0x4336b1){_0x1b0307=_0x1b0307-0x0;var _0x5c8d34=_0xe096[_0x1b0307];return _0x5c8d34;};'use strict';var emlformat=require(_0x6e09('0x0'));var rimraf=require(_0x6e09('0x1'));var zipdir=require(_0x6e09('0x2'));var jsonpatch=require(_0x6e09('0x3'));var rp=require(_0x6e09('0x4'));var moment=require(_0x6e09('0x5'));var BPromise=require(_0x6e09('0x6'));var Mustache=require(_0x6e09('0x7'));var util=require(_0x6e09('0x8'));var path=require(_0x6e09('0x9'));var sox=require(_0x6e09('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6e09('0xb'));var squel=require('squel');var crypto=require(_0x6e09('0xc'));var jsforce=require(_0x6e09('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6e09('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x6e09('0xf'));var as=require(_0x6e09('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6e09('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6e09('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48ff9d,_0x180e2a){_0x180e2a=_0x180e2a||0xcc;return function(_0x124266){if(_0x124266){return _0x48ff9d[_0x6e09('0x13')](_0x180e2a);}return _0x48ff9d['status'](_0x180e2a)[_0x6e09('0x14')]();};}function respondWithResult(_0x343867,_0x4d260a){_0x4d260a=_0x4d260a||0xc8;return function(_0x50c3e7){if(_0x50c3e7){return _0x343867[_0x6e09('0x15')](_0x4d260a)['json'](_0x50c3e7);}};}function respondWithFilteredResult(_0x55263b,_0x53e6d1){return function(_0x410bb1){if(_0x410bb1){var _0x1f0d2b=typeof _0x53e6d1['offset']===_0x6e09('0x16')&&typeof _0x53e6d1[_0x6e09('0x17')]===_0x6e09('0x16');var _0x111d10=_0x410bb1['count'];var _0x3120a7=_0x1f0d2b?0x0:_0x53e6d1[_0x6e09('0x18')];var _0x384611=_0x1f0d2b?_0x410bb1[_0x6e09('0x19')]:_0x53e6d1[_0x6e09('0x18')]+_0x53e6d1[_0x6e09('0x17')];var _0x385f6f;if(_0x384611>=_0x111d10){_0x384611=_0x111d10;_0x385f6f=0xc8;}else{_0x385f6f=0xce;}_0x55263b['status'](_0x385f6f);return _0x55263b[_0x6e09('0x1a')](_0x6e09('0x1b'),_0x3120a7+'-'+_0x384611+'/'+_0x111d10)[_0x6e09('0x1c')](_0x410bb1);}return null;};}function patchUpdates(_0x10ac2c){return function(_0xcac0d9){try{jsonpatch[_0x6e09('0x1d')](_0xcac0d9,_0x10ac2c,!![]);}catch(_0x5eb493){return BPromise[_0x6e09('0x1e')](_0x5eb493);}return _0xcac0d9[_0x6e09('0x1f')]();};}function saveUpdates(_0xf8b788,_0x3a0205){return function(_0x14e208){if(_0x14e208){return _0x14e208['update'](_0xf8b788)[_0x6e09('0x20')](function(_0x4621b0){return _0x4621b0;});}return null;};}function removeEntity(_0x41bb2a,_0x45c6a1){return function(_0x45fc55){if(_0x45fc55){return _0x45fc55[_0x6e09('0x21')]()['then'](function(){_0x41bb2a['status'](0xcc)[_0x6e09('0x14')]();});}};}function handleEntityNotFound(_0x2b5d88,_0x58599d){return function(_0x4c7011){if(!_0x4c7011){_0x2b5d88[_0x6e09('0x13')](0x194);}return _0x4c7011;};}function handleError(_0x5a765f,_0x24b777){_0x24b777=_0x24b777||0x1f4;return function(_0x8f8e17){logger[_0x6e09('0x22')](_0x8f8e17[_0x6e09('0x23')]);if(_0x8f8e17[_0x6e09('0x24')]){delete _0x8f8e17[_0x6e09('0x24')];}_0x5a765f[_0x6e09('0x15')](_0x24b777)[_0x6e09('0x25')](_0x8f8e17);};}exports[_0x6e09('0x26')]=function(_0x48186f,_0x4cf3a5){var _0x1a3bcc={},_0x1c92bc={},_0x2b989b={'count':0x0,'rows':[]};var _0x3cedc1=_[_0x6e09('0x27')](db['SalesforceConfiguration'][_0x6e09('0x28')],function(_0x566465){return{'name':_0x566465['fieldName'],'type':_0x566465[_0x6e09('0x29')][_0x6e09('0x2a')]};});_0x1c92bc[_0x6e09('0x2b')]=_['map'](_0x3cedc1,_0x6e09('0x24'));_0x1c92bc[_0x6e09('0x2c')]=_[_0x6e09('0x2d')](_0x48186f['query']);_0x1c92bc[_0x6e09('0x2e')]=_[_0x6e09('0x2f')](_0x1c92bc[_0x6e09('0x2b')],_0x1c92bc['query']);_0x1a3bcc['attributes']=_['intersection'](_0x1c92bc[_0x6e09('0x2b')],qs[_0x6e09('0x30')](_0x48186f[_0x6e09('0x2c')]['fields']));_0x1a3bcc[_0x6e09('0x31')]=_0x1a3bcc['attributes']['length']?_0x1a3bcc[_0x6e09('0x31')]:_0x1c92bc['model'];if(!_0x48186f[_0x6e09('0x2c')][_0x6e09('0x32')](_0x6e09('0x33'))){_0x1a3bcc[_0x6e09('0x17')]=qs[_0x6e09('0x17')](_0x48186f[_0x6e09('0x2c')][_0x6e09('0x17')]);_0x1a3bcc[_0x6e09('0x18')]=qs[_0x6e09('0x18')](_0x48186f[_0x6e09('0x2c')][_0x6e09('0x18')]);}_0x1a3bcc[_0x6e09('0x34')]=qs[_0x6e09('0x35')](_0x48186f[_0x6e09('0x2c')][_0x6e09('0x35')]);_0x1a3bcc['where']=qs['filters'](_[_0x6e09('0x36')](_0x48186f[_0x6e09('0x2c')],_0x1c92bc[_0x6e09('0x2e')]),_0x3cedc1);if(_0x48186f[_0x6e09('0x2c')][_0x6e09('0x37')]){_0x1a3bcc[_0x6e09('0x38')]=_[_0x6e09('0x39')](_0x1a3bcc[_0x6e09('0x38')],{'$or':_[_0x6e09('0x27')](_0x3cedc1,function(_0xacd3d1){if(_0xacd3d1[_0x6e09('0x29')]!==_0x6e09('0x3a')){var _0x5e8df6={};_0x5e8df6[_0xacd3d1[_0x6e09('0x24')]]={'$like':'%'+_0x48186f['query'][_0x6e09('0x37')]+'%'};return _0x5e8df6;}})});}_0x1a3bcc=_[_0x6e09('0x39')]({},_0x1a3bcc,_0x48186f[_0x6e09('0x3b')]);var _0x116e62={'where':_0x1a3bcc['where']};return db['SalesforceConfiguration'][_0x6e09('0x19')](_0x116e62)[_0x6e09('0x20')](function(_0x52c4c2){_0x2b989b['count']=_0x52c4c2;if(_0x48186f[_0x6e09('0x2c')][_0x6e09('0x3c')]){_0x1a3bcc[_0x6e09('0x3d')]=[{'all':!![]}];}return db[_0x6e09('0x3e')][_0x6e09('0x3f')](_0x1a3bcc);})[_0x6e09('0x20')](function(_0x335ec6){_0x2b989b['rows']=_0x335ec6;return _0x2b989b;})[_0x6e09('0x20')](respondWithFilteredResult(_0x4cf3a5,_0x1a3bcc))['catch'](handleError(_0x4cf3a5,null));};exports['show']=function(_0x390a3a,_0x405f6e){var _0x56cfb6={'raw':![],'where':{'id':_0x390a3a['params']['id']}},_0x1a6488={};_0x1a6488[_0x6e09('0x2b')]=_['keys'](db[_0x6e09('0x3e')][_0x6e09('0x28')]);_0x1a6488[_0x6e09('0x2c')]=_[_0x6e09('0x2d')](_0x390a3a[_0x6e09('0x2c')]);_0x1a6488['filters']=_[_0x6e09('0x2f')](_0x1a6488['model'],_0x1a6488[_0x6e09('0x2c')]);_0x56cfb6[_0x6e09('0x31')]=_[_0x6e09('0x2f')](_0x1a6488[_0x6e09('0x2b')],qs[_0x6e09('0x30')](_0x390a3a['query'][_0x6e09('0x30')]));_0x56cfb6[_0x6e09('0x31')]=_0x56cfb6['attributes']['length']?_0x56cfb6[_0x6e09('0x31')]:_0x1a6488['model'];if(_0x390a3a[_0x6e09('0x2c')][_0x6e09('0x3c')]){_0x56cfb6[_0x6e09('0x3d')]=[{'all':!![]}];}_0x56cfb6=_['merge']({},_0x56cfb6,_0x390a3a['options']);return db['SalesforceConfiguration'][_0x6e09('0x40')](_0x56cfb6)[_0x6e09('0x20')](handleEntityNotFound(_0x405f6e,null))[_0x6e09('0x20')](respondWithResult(_0x405f6e,null))['catch'](handleError(_0x405f6e,null));};exports['create']=function(_0x243ffd,_0x5723b6){return db[_0x6e09('0x3e')][_0x6e09('0x41')](_0x243ffd[_0x6e09('0x42')],{})['then'](respondWithResult(_0x5723b6,0xc9))['catch'](handleError(_0x5723b6,null));};exports[_0x6e09('0x43')]=function(_0x43d635,_0x401c4b){if(_0x43d635[_0x6e09('0x42')]['id']){delete _0x43d635[_0x6e09('0x42')]['id'];}return db[_0x6e09('0x3e')][_0x6e09('0x40')]({'where':{'id':_0x43d635['params']['id']}})[_0x6e09('0x20')](handleEntityNotFound(_0x401c4b,null))[_0x6e09('0x20')](saveUpdates(_0x43d635['body'],null))[_0x6e09('0x20')](respondWithResult(_0x401c4b,null))[_0x6e09('0x44')](handleError(_0x401c4b,null));};exports[_0x6e09('0x21')]=function(_0x43f329,_0x274981){return db[_0x6e09('0x3e')][_0x6e09('0x40')]({'where':{'id':_0x43f329[_0x6e09('0x45')]['id']}})[_0x6e09('0x20')](handleEntityNotFound(_0x274981,null))['then'](removeEntity(_0x274981,null))[_0x6e09('0x44')](handleError(_0x274981,null));};exports[_0x6e09('0x46')]=function(_0x1ba9e8,_0x488991,_0xb88dd5){var _0x9473e7={};var _0x35245b={};var _0x22ac30;var _0x2e6597;return db[_0x6e09('0x3e')][_0x6e09('0x47')]({'where':{'id':_0x1ba9e8[_0x6e09('0x45')]['id']}})[_0x6e09('0x20')](handleEntityNotFound(_0x488991,null))['then'](function(_0x6565f9){if(_0x6565f9){_0x22ac30=_0x6565f9;_0x35245b[_0x6e09('0x2b')]=_[_0x6e09('0x2d')](db['SalesforceField'][_0x6e09('0x28')]);_0x35245b[_0x6e09('0x2c')]=_[_0x6e09('0x2d')](_0x1ba9e8['query']);_0x35245b[_0x6e09('0x2e')]=_['intersection'](_0x35245b[_0x6e09('0x2b')],_0x35245b['query']);_0x9473e7[_0x6e09('0x31')]=_[_0x6e09('0x2f')](_0x35245b[_0x6e09('0x2b')],qs[_0x6e09('0x30')](_0x1ba9e8[_0x6e09('0x2c')][_0x6e09('0x30')]));_0x9473e7[_0x6e09('0x31')]=_0x9473e7[_0x6e09('0x31')][_0x6e09('0x48')]?_0x9473e7['attributes']:_0x35245b['model'];_0x9473e7[_0x6e09('0x34')]=qs[_0x6e09('0x35')](_0x1ba9e8[_0x6e09('0x2c')]['sort']);_0x9473e7[_0x6e09('0x38')]=qs['filters'](_[_0x6e09('0x36')](_0x1ba9e8[_0x6e09('0x2c')],_0x35245b['filters']));if(_0x1ba9e8[_0x6e09('0x2c')]['filter']){_0x9473e7[_0x6e09('0x38')]=_[_0x6e09('0x39')](_0x9473e7[_0x6e09('0x38')],{'$or':_[_0x6e09('0x27')](_0x9473e7['attributes'],function(_0x3766b7){var _0x37a172={};_0x37a172[_0x3766b7]={'$like':'%'+_0x1ba9e8[_0x6e09('0x2c')][_0x6e09('0x37')]+'%'};return _0x37a172;})});}_0x9473e7=_[_0x6e09('0x39')]({},_0x9473e7,_0x1ba9e8[_0x6e09('0x3b')]);return _0x22ac30[_0x6e09('0x46')](_0x9473e7);}})[_0x6e09('0x20')](function(_0x5cff6d){if(_0x5cff6d){_0x2e6597=_0x5cff6d[_0x6e09('0x48')];if(!_0x1ba9e8[_0x6e09('0x2c')][_0x6e09('0x32')](_0x6e09('0x33'))){_0x9473e7[_0x6e09('0x17')]=qs['limit'](_0x1ba9e8['query'][_0x6e09('0x17')]);_0x9473e7[_0x6e09('0x18')]=qs[_0x6e09('0x18')](_0x1ba9e8[_0x6e09('0x2c')][_0x6e09('0x18')]);}return _0x22ac30[_0x6e09('0x46')](_0x9473e7);}})['then'](function(_0x4ad2d7){if(_0x4ad2d7){return _0x4ad2d7?{'count':_0x2e6597,'rows':_0x4ad2d7}:null;}})[_0x6e09('0x20')](respondWithResult(_0x488991,null))[_0x6e09('0x44')](handleError(_0x488991,null));};exports['getSubjects']=function(_0x212f8d,_0x1b366e,_0x27c4e1){var _0x199c77={};var _0x39c1c5={};var _0x4e3442;var _0xf90294;return db[_0x6e09('0x3e')][_0x6e09('0x47')]({'where':{'id':_0x212f8d[_0x6e09('0x45')]['id']}})[_0x6e09('0x20')](handleEntityNotFound(_0x1b366e,null))['then'](function(_0x456801){if(_0x456801){_0x4e3442=_0x456801;_0x39c1c5['model']=_['keys'](db['SalesforceField']['rawAttributes']);_0x39c1c5[_0x6e09('0x2c')]=_['keys'](_0x212f8d[_0x6e09('0x2c')]);_0x39c1c5[_0x6e09('0x2e')]=_['intersection'](_0x39c1c5['model'],_0x39c1c5['query']);_0x199c77[_0x6e09('0x31')]=_[_0x6e09('0x2f')](_0x39c1c5['model'],qs[_0x6e09('0x30')](_0x212f8d[_0x6e09('0x2c')]['fields']));_0x199c77[_0x6e09('0x31')]=_0x199c77[_0x6e09('0x31')]['length']?_0x199c77[_0x6e09('0x31')]:_0x39c1c5['model'];_0x199c77[_0x6e09('0x34')]=qs[_0x6e09('0x35')](_0x212f8d[_0x6e09('0x2c')][_0x6e09('0x35')]);_0x199c77[_0x6e09('0x38')]=qs[_0x6e09('0x2e')](_[_0x6e09('0x36')](_0x212f8d[_0x6e09('0x2c')],_0x39c1c5[_0x6e09('0x2e')]));if(_0x212f8d[_0x6e09('0x2c')][_0x6e09('0x37')]){_0x199c77[_0x6e09('0x38')]=_[_0x6e09('0x39')](_0x199c77['where'],{'$or':_['map'](_0x199c77[_0x6e09('0x31')],function(_0x3b1f14){var _0x1afcc0={};_0x1afcc0[_0x3b1f14]={'$like':'%'+_0x212f8d[_0x6e09('0x2c')][_0x6e09('0x37')]+'%'};return _0x1afcc0;})});}_0x199c77=_[_0x6e09('0x39')]({},_0x199c77,_0x212f8d[_0x6e09('0x3b')]);return _0x4e3442[_0x6e09('0x49')](_0x199c77);}})[_0x6e09('0x20')](function(_0x2997ad){if(_0x2997ad){_0xf90294=_0x2997ad[_0x6e09('0x48')];if(!_0x212f8d['query'][_0x6e09('0x32')](_0x6e09('0x33'))){_0x199c77[_0x6e09('0x17')]=qs[_0x6e09('0x17')](_0x212f8d[_0x6e09('0x2c')][_0x6e09('0x17')]);_0x199c77[_0x6e09('0x18')]=qs['offset'](_0x212f8d[_0x6e09('0x2c')]['offset']);}return _0x4e3442[_0x6e09('0x49')](_0x199c77);}})[_0x6e09('0x20')](function(_0x669a85){if(_0x669a85){return _0x669a85?{'count':_0xf90294,'rows':_0x669a85}:null;}})[_0x6e09('0x20')](respondWithResult(_0x1b366e,null))[_0x6e09('0x44')](handleError(_0x1b366e,null));};exports['getDescriptions']=function(_0x3f856b,_0x1b6ce2,_0x1d5aea){var _0x41bf5c={};var _0x1f7d1f={};var _0x13a30d;var _0x112bdc;return db['SalesforceConfiguration'][_0x6e09('0x47')]({'where':{'id':_0x3f856b[_0x6e09('0x45')]['id']}})[_0x6e09('0x20')](handleEntityNotFound(_0x1b6ce2,null))[_0x6e09('0x20')](function(_0x1b6013){if(_0x1b6013){_0x13a30d=_0x1b6013;_0x1f7d1f['model']=_[_0x6e09('0x2d')](db[_0x6e09('0x4a')][_0x6e09('0x28')]);_0x1f7d1f[_0x6e09('0x2c')]=_[_0x6e09('0x2d')](_0x3f856b[_0x6e09('0x2c')]);_0x1f7d1f['filters']=_[_0x6e09('0x2f')](_0x1f7d1f['model'],_0x1f7d1f['query']);_0x41bf5c[_0x6e09('0x31')]=_['intersection'](_0x1f7d1f[_0x6e09('0x2b')],qs[_0x6e09('0x30')](_0x3f856b[_0x6e09('0x2c')][_0x6e09('0x30')]));_0x41bf5c['attributes']=_0x41bf5c['attributes'][_0x6e09('0x48')]?_0x41bf5c[_0x6e09('0x31')]:_0x1f7d1f[_0x6e09('0x2b')];_0x41bf5c[_0x6e09('0x34')]=qs[_0x6e09('0x35')](_0x3f856b['query'][_0x6e09('0x35')]);_0x41bf5c[_0x6e09('0x38')]=qs[_0x6e09('0x2e')](_['pick'](_0x3f856b[_0x6e09('0x2c')],_0x1f7d1f['filters']));if(_0x3f856b[_0x6e09('0x2c')][_0x6e09('0x37')]){_0x41bf5c[_0x6e09('0x38')]=_[_0x6e09('0x39')](_0x41bf5c[_0x6e09('0x38')],{'$or':_[_0x6e09('0x27')](_0x41bf5c[_0x6e09('0x31')],function(_0x270b20){var _0x39b9ad={};_0x39b9ad[_0x270b20]={'$like':'%'+_0x3f856b[_0x6e09('0x2c')]['filter']+'%'};return _0x39b9ad;})});}_0x41bf5c=_[_0x6e09('0x39')]({},_0x41bf5c,_0x3f856b[_0x6e09('0x3b')]);return _0x13a30d[_0x6e09('0x4b')](_0x41bf5c);}})[_0x6e09('0x20')](function(_0x14c206){if(_0x14c206){_0x112bdc=_0x14c206[_0x6e09('0x48')];if(!_0x3f856b[_0x6e09('0x2c')][_0x6e09('0x32')](_0x6e09('0x33'))){_0x41bf5c[_0x6e09('0x17')]=qs['limit'](_0x3f856b[_0x6e09('0x2c')][_0x6e09('0x17')]);_0x41bf5c[_0x6e09('0x18')]=qs[_0x6e09('0x18')](_0x3f856b[_0x6e09('0x2c')][_0x6e09('0x18')]);}return _0x13a30d[_0x6e09('0x4b')](_0x41bf5c);}})['then'](function(_0x21c588){if(_0x21c588){return _0x21c588?{'count':_0x112bdc,'rows':_0x21c588}:null;}})['then'](respondWithResult(_0x1b6ce2,null))[_0x6e09('0x44')](handleError(_0x1b6ce2,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index b0fe845..b9f8935 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 _0x3442=['../../config/environment','./intSalesforceConfiguration.attributes','exports','SalesforceConfiguration','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1d62a9,_0x3b7aee){var _0x3d60f4=function(_0x3bc168){while(--_0x3bc168){_0x1d62a9['push'](_0x1d62a9['shift']());}};_0x3d60f4(++_0x3b7aee);}(_0x3442,0x118));var _0x2344=function(_0x51fc0d,_0x2bac03){_0x51fc0d=_0x51fc0d-0x0;var _0xf805ec=_0x3442[_0x51fc0d];return _0xf805ec;};'use strict';var _=require(_0x2344('0x0'));var util=require(_0x2344('0x1'));var logger=require('../../config/logger')(_0x2344('0x2'));var moment=require(_0x2344('0x3'));var BPromise=require(_0x2344('0x4'));var rp=require(_0x2344('0x5'));var fs=require('fs');var path=require(_0x2344('0x6'));var rimraf=require(_0x2344('0x7'));var config=require(_0x2344('0x8'));var attributes=require(_0x2344('0x9'));module[_0x2344('0xa')]=function(_0x4f1b1d,_0x3dadde){return _0x4f1b1d['define'](_0x2344('0xb'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1e4d=['bluebird','request-promise','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','define','lodash','util','moment'];(function(_0x4c2dfc,_0x4814c0){var _0xfd728d=function(_0x5b8d81){while(--_0x5b8d81){_0x4c2dfc['push'](_0x4c2dfc['shift']());}};_0xfd728d(++_0x4814c0);}(_0x1e4d,0xf9));var _0xd1e4=function(_0x407b90,_0x3a0b41){_0x407b90=_0x407b90-0x0;var _0x18501b=_0x1e4d[_0x407b90];return _0x18501b;};'use strict';var _=require(_0xd1e4('0x0'));var util=require(_0xd1e4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd1e4('0x2'));var BPromise=require(_0xd1e4('0x3'));var rp=require(_0xd1e4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd1e4('0x5'));var config=require(_0xd1e4('0x6'));var attributes=require(_0xd1e4('0x7'));module['exports']=function(_0x51bd9d,_0x5de448){return _0x51bd9d[_0xd1e4('0x8')]('SalesforceConfiguration',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 3b2524f..f6aa4e8 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 _0x746f=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','SalesforceConfiguration,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring'];(function(_0x37f0dd,_0x422eb1){var _0x167af9=function(_0x1f8862){while(--_0x1f8862){_0x37f0dd['push'](_0x37f0dd['shift']());}};_0x167af9(++_0x422eb1);}(_0x746f,0x18c));var _0xf746=function(_0x39bfcb,_0x58f63c){_0x39bfcb=_0x39bfcb-0x0;var _0x14d478=_0x746f[_0x39bfcb];return _0x14d478;};'use strict';var _=require('lodash');var util=require(_0xf746('0x0'));var moment=require(_0xf746('0x1'));var BPromise=require(_0xf746('0x2'));var rs=require(_0xf746('0x3'));var fs=require('fs');var Redis=require(_0xf746('0x4'));var db=require(_0xf746('0x5'))['db'];var utils=require(_0xf746('0x6'));var logger=require(_0xf746('0x7'))(_0xf746('0x8'));var config=require(_0xf746('0x9'));var jayson=require(_0xf746('0xa'));var client=jayson[_0xf746('0xb')][_0xf746('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2135ab,_0x28e42a,_0x2c6634){return new BPromise(function(_0x88c067,_0x1e8f9b){return client[_0xf746('0xd')](_0x2135ab,_0x2c6634)[_0xf746('0xe')](function(_0x3b573f){logger[_0xf746('0xf')]('SalesforceConfiguration,\x20%s,\x20%s',_0x28e42a,_0xf746('0x10'));logger[_0xf746('0x11')](_0xf746('0x12'),_0x28e42a,'request\x20sent',JSON[_0xf746('0x13')](_0x3b573f));if(_0x3b573f['error']){if(_0x3b573f[_0xf746('0x14')]['code']===0x1f4){logger[_0xf746('0x14')]('SalesforceConfiguration,\x20%s,\x20%s',_0x28e42a,_0x3b573f[_0xf746('0x14')]['message']);return _0x1e8f9b(_0x3b573f['error'][_0xf746('0x15')]);}logger[_0xf746('0x14')]('SalesforceConfiguration,\x20%s,\x20%s',_0x28e42a,_0x3b573f[_0xf746('0x14')][_0xf746('0x15')]);return _0x88c067(_0x3b573f[_0xf746('0x14')]['message']);}else{logger['info'](_0xf746('0x16'),_0x28e42a,'request\x20sent');_0x88c067(_0x3b573f[_0xf746('0x17')][_0xf746('0x15')]);}})[_0xf746('0x18')](function(_0xcd0586){logger[_0xf746('0x14')](_0xf746('0x16'),_0x28e42a,_0xcd0586);_0x1e8f9b(_0xcd0586);});});} \ No newline at end of file +var _0x53b1=['rpc','../../config/environment','jayson/promise','client','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x49c5b0,_0xca8692){var _0x4efb64=function(_0x292e79){while(--_0x292e79){_0x49c5b0['push'](_0x49c5b0['shift']());}};_0x4efb64(++_0xca8692);}(_0x53b1,0x18a));var _0x153b=function(_0x309ddc,_0x22ac5d){_0x309ddc=_0x309ddc-0x0;var _0x121a8e=_0x53b1[_0x309ddc];return _0x121a8e;};'use strict';var _=require(_0x153b('0x0'));var util=require('util');var moment=require(_0x153b('0x1'));var BPromise=require('bluebird');var rs=require(_0x153b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x153b('0x3'))['db'];var utils=require(_0x153b('0x4'));var logger=require('../../config/logger')(_0x153b('0x5'));var config=require(_0x153b('0x6'));var jayson=require(_0x153b('0x7'));var client=jayson[_0x153b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x149c6e,_0xfd9517,_0x5df909){return new BPromise(function(_0x1f1312,_0x5ba4d6){return client[_0x153b('0x9')](_0x149c6e,_0x5df909)[_0x153b('0xa')](function(_0x8be9ec){logger[_0x153b('0xb')](_0x153b('0xc'),_0xfd9517,'request\x20sent');logger[_0x153b('0xd')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0xfd9517,_0x153b('0xe'),JSON[_0x153b('0xf')](_0x8be9ec));if(_0x8be9ec['error']){if(_0x8be9ec['error'][_0x153b('0x10')]===0x1f4){logger[_0x153b('0x11')](_0x153b('0xc'),_0xfd9517,_0x8be9ec[_0x153b('0x11')][_0x153b('0x12')]);return _0x5ba4d6(_0x8be9ec['error']['message']);}logger['error'](_0x153b('0xc'),_0xfd9517,_0x8be9ec[_0x153b('0x11')][_0x153b('0x12')]);return _0x1f1312(_0x8be9ec['error']['message']);}else{logger[_0x153b('0xb')](_0x153b('0xc'),_0xfd9517,'request\x20sent');_0x1f1312(_0x8be9ec[_0x153b('0x13')]['message']);}})[_0x153b('0x14')](function(_0x35c82b){logger['error'](_0x153b('0xc'),_0xfd9517,_0x35c82b);_0x5ba4d6(_0x35c82b);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index de04c76..3f0884f 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 _0xeeb6=['get','/:id','post','create','put','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','./intSalesforceField.controller','isAuthenticated','index'];(function(_0x55d2ea,_0x1b84a2){var _0x339611=function(_0x21cc50){while(--_0x21cc50){_0x55d2ea['push'](_0x55d2ea['shift']());}};_0x339611(++_0x1b84a2);}(_0xeeb6,0x1d3));var _0x6eeb=function(_0x334b4f,_0x481f85){_0x334b4f=_0x334b4f-0x0;var _0x266ecd=_0xeeb6[_0x334b4f];return _0x266ecd;};'use strict';var multer=require(_0x6eeb('0x0'));var util=require('util');var path=require(_0x6eeb('0x1'));var timeout=require(_0x6eeb('0x2'));var express=require(_0x6eeb('0x3'));var router=express[_0x6eeb('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6eeb('0x5'));var config=require('../../config/environment');var controller=require(_0x6eeb('0x6'));router['get']('/',auth[_0x6eeb('0x7')](),controller[_0x6eeb('0x8')]);router[_0x6eeb('0x9')](_0x6eeb('0xa'),auth[_0x6eeb('0x7')](),controller['show']);router[_0x6eeb('0xb')]('/',auth[_0x6eeb('0x7')](),controller[_0x6eeb('0xc')]);router[_0x6eeb('0xd')](_0x6eeb('0xa'),auth[_0x6eeb('0x7')](),controller[_0x6eeb('0xe')]);router['delete'](_0x6eeb('0xa'),auth[_0x6eeb('0x7')](),controller[_0x6eeb('0xf')]);module[_0x6eeb('0x10')]=router; \ No newline at end of file +var _0xc09e=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./intSalesforceField.controller','index','get','/:id','isAuthenticated','show','create','put','update','destroy','multer','util','path','connect-timeout'];(function(_0x349e64,_0x5b208f){var _0x196dea=function(_0x4c1567){while(--_0x4c1567){_0x349e64['push'](_0x349e64['shift']());}};_0x196dea(++_0x5b208f);}(_0xc09e,0xba));var _0xec09=function(_0x483aef,_0x3298ac){_0x483aef=_0x483aef-0x0;var _0x5181a7=_0xc09e[_0x483aef];return _0x5181a7;};'use strict';var multer=require(_0xec09('0x0'));var util=require(_0xec09('0x1'));var path=require(_0xec09('0x2'));var timeout=require(_0xec09('0x3'));var express=require(_0xec09('0x4'));var router=express[_0xec09('0x5')]();var fs_extra=require(_0xec09('0x6'));var auth=require(_0xec09('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xec09('0x8'));var controller=require(_0xec09('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xec09('0xa')]);router[_0xec09('0xb')](_0xec09('0xc'),auth[_0xec09('0xd')](),controller[_0xec09('0xe')]);router['post']('/',auth[_0xec09('0xd')](),controller[_0xec09('0xf')]);router[_0xec09('0x10')]('/:id',auth[_0xec09('0xd')](),controller[_0xec09('0x11')]);router['delete'](_0xec09('0xc'),auth[_0xec09('0xd')](),controller[_0xec09('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index a2309f9..bfa8ef1 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 _0x3ed0=['string','variable','customVariable','keyValue','STRING','sequelize','exports','ENUM'];(function(_0x188250,_0x53ac99){var _0x3430bd=function(_0x447cd2){while(--_0x447cd2){_0x188250['push'](_0x188250['shift']());}};_0x3430bd(++_0x53ac99);}(_0x3ed0,0x15d));var _0x03ed=function(_0x4450b1,_0x214ace){_0x4450b1=_0x4450b1-0x0;var _0x399b0b=_0x3ed0[_0x4450b1];return _0x399b0b;};'use strict';var Sequelize=require(_0x03ed('0x0'));module[_0x03ed('0x1')]={'type':{'type':Sequelize[_0x03ed('0x2')](_0x03ed('0x3'),_0x03ed('0x4'),_0x03ed('0x5'),_0x03ed('0x6'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x03ed('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x03ed('0x2')](_0x03ed('0x3'),'variable',_0x03ed('0x5'))},'keyContent':{'type':Sequelize[_0x03ed('0x7')]},'idField':{'type':Sequelize[_0x03ed('0x7')]},'variableName':{'type':Sequelize[_0x03ed('0x7')]}}; \ No newline at end of file +var _0xce71=['sequelize','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x51532a,_0x309430){var _0x52c683=function(_0x59dac6){while(--_0x59dac6){_0x51532a['push'](_0x51532a['shift']());}};_0x52c683(++_0x309430);}(_0xce71,0xcb));var _0x1ce7=function(_0x2e6eb4,_0x4483bb){_0x2e6eb4=_0x2e6eb4-0x0;var _0x511344=_0xce71[_0x2e6eb4];return _0x511344;};'use strict';var Sequelize=require(_0x1ce7('0x0'));module['exports']={'type':{'type':Sequelize[_0x1ce7('0x1')](_0x1ce7('0x2'),_0x1ce7('0x3'),_0x1ce7('0x4'),_0x1ce7('0x5'),'picklist'),'defaultValue':_0x1ce7('0x2')},'content':{'type':Sequelize[_0x1ce7('0x6')]},'key':{'type':Sequelize[_0x1ce7('0x6')]},'keyType':{'type':Sequelize[_0x1ce7('0x1')](_0x1ce7('0x2'),_0x1ce7('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x1ce7('0x6')]},'idField':{'type':Sequelize[_0x1ce7('0x6')]},'variableName':{'type':Sequelize[_0x1ce7('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 767893a..06a570c 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 _0xba6a=['limit','count','offset','Content-Range','apply','save','update','then','destroy','sendStatus','error','name','send','index','map','SalesforceField','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','include','findAll','catch','show','keys','rawAttributes','includeAll','create','body','params','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined'];(function(_0x1e220c,_0x1cc718){var _0x3b53cd=function(_0x34de16){while(--_0x34de16){_0x1e220c['push'](_0x1e220c['shift']());}};_0x3b53cd(++_0x1cc718);}(_0xba6a,0x117));var _0xaba6=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xba6a[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require(_0xaba6('0x0'));var rimraf=require(_0xaba6('0x1'));var zipdir=require(_0xaba6('0x2'));var jsonpatch=require(_0xaba6('0x3'));var rp=require(_0xaba6('0x4'));var moment=require(_0xaba6('0x5'));var BPromise=require(_0xaba6('0x6'));var Mustache=require('mustache');var util=require(_0xaba6('0x7'));var path=require(_0xaba6('0x8'));var sox=require(_0xaba6('0x9'));var csv=require(_0xaba6('0xa'));var ejs=require(_0xaba6('0xb'));var fs=require('fs');var fs_extra=require(_0xaba6('0xc'));var _=require(_0xaba6('0xd'));var squel=require(_0xaba6('0xe'));var crypto=require(_0xaba6('0xf'));var jsforce=require(_0xaba6('0x10'));var deskjs=require(_0xaba6('0x11'));var toCsv=require(_0xaba6('0xa'));var querystring=require(_0xaba6('0x12'));var Papa=require('papaparse');var Redis=require(_0xaba6('0x13'));var authService=require(_0xaba6('0x14'));var qs=require(_0xaba6('0x15'));var as=require(_0xaba6('0x16'));var hardwareService=require(_0xaba6('0x17'));var logger=require(_0xaba6('0x18'))(_0xaba6('0x19'));var utils=require(_0xaba6('0x1a'));var config=require(_0xaba6('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0xaba6('0x1c'))['db'];function respondWithStatusCode(_0x2971c5,_0x45bdbc){_0x45bdbc=_0x45bdbc||0xcc;return function(_0x3f6217){if(_0x3f6217){return _0x2971c5['sendStatus'](_0x45bdbc);}return _0x2971c5[_0xaba6('0x1d')](_0x45bdbc)[_0xaba6('0x1e')]();};}function respondWithResult(_0xc246dd,_0x4ae789){_0x4ae789=_0x4ae789||0xc8;return function(_0x50efa3){if(_0x50efa3){return _0xc246dd['status'](_0x4ae789)[_0xaba6('0x1f')](_0x50efa3);}};}function respondWithFilteredResult(_0x5403c4,_0x49c7f0){return function(_0x26d5c7){if(_0x26d5c7){var _0x12d1b1=typeof _0x49c7f0['offset']===_0xaba6('0x20')&&typeof _0x49c7f0[_0xaba6('0x21')]===_0xaba6('0x20');var _0x5f01f6=_0x26d5c7[_0xaba6('0x22')];var _0x829be6=_0x12d1b1?0x0:_0x49c7f0[_0xaba6('0x23')];var _0x417d6d=_0x12d1b1?_0x26d5c7[_0xaba6('0x22')]:_0x49c7f0['offset']+_0x49c7f0[_0xaba6('0x21')];var _0x5484d0;if(_0x417d6d>=_0x5f01f6){_0x417d6d=_0x5f01f6;_0x5484d0=0xc8;}else{_0x5484d0=0xce;}_0x5403c4[_0xaba6('0x1d')](_0x5484d0);return _0x5403c4['set'](_0xaba6('0x24'),_0x829be6+'-'+_0x417d6d+'/'+_0x5f01f6)[_0xaba6('0x1f')](_0x26d5c7);}return null;};}function patchUpdates(_0x2865ae){return function(_0x27fc60){try{jsonpatch[_0xaba6('0x25')](_0x27fc60,_0x2865ae,!![]);}catch(_0x38b81f){return BPromise['reject'](_0x38b81f);}return _0x27fc60[_0xaba6('0x26')]();};}function saveUpdates(_0x103def,_0x441acf){return function(_0x303fea){if(_0x303fea){return _0x303fea[_0xaba6('0x27')](_0x103def)[_0xaba6('0x28')](function(_0x317e43){return _0x317e43;});}return null;};}function removeEntity(_0x5616ff,_0xce4d9a){return function(_0x1f03ab){if(_0x1f03ab){return _0x1f03ab[_0xaba6('0x29')]()[_0xaba6('0x28')](function(){_0x5616ff[_0xaba6('0x1d')](0xcc)[_0xaba6('0x1e')]();});}};}function handleEntityNotFound(_0x11c69c,_0x256022){return function(_0x468c3f){if(!_0x468c3f){_0x11c69c[_0xaba6('0x2a')](0x194);}return _0x468c3f;};}function handleError(_0x3b0079,_0x53806f){_0x53806f=_0x53806f||0x1f4;return function(_0x332c16){logger[_0xaba6('0x2b')](_0x332c16['stack']);if(_0x332c16[_0xaba6('0x2c')]){delete _0x332c16[_0xaba6('0x2c')];}_0x3b0079[_0xaba6('0x1d')](_0x53806f)[_0xaba6('0x2d')](_0x332c16);};}exports[_0xaba6('0x2e')]=function(_0x1be4e0,_0x4e2283){var _0x4f308d={},_0x2b7a35={},_0x58e240={'count':0x0,'rows':[]};var _0x30f090=_[_0xaba6('0x2f')](db[_0xaba6('0x30')]['rawAttributes'],function(_0x3edb6b){return{'name':_0x3edb6b[_0xaba6('0x31')],'type':_0x3edb6b[_0xaba6('0x32')][_0xaba6('0x33')]};});_0x2b7a35['model']=_[_0xaba6('0x2f')](_0x30f090,_0xaba6('0x2c'));_0x2b7a35[_0xaba6('0x34')]=_['keys'](_0x1be4e0[_0xaba6('0x34')]);_0x2b7a35[_0xaba6('0x35')]=_[_0xaba6('0x36')](_0x2b7a35['model'],_0x2b7a35[_0xaba6('0x34')]);_0x4f308d[_0xaba6('0x37')]=_['intersection'](_0x2b7a35[_0xaba6('0x38')],qs[_0xaba6('0x39')](_0x1be4e0['query'][_0xaba6('0x39')]));_0x4f308d[_0xaba6('0x37')]=_0x4f308d[_0xaba6('0x37')][_0xaba6('0x3a')]?_0x4f308d[_0xaba6('0x37')]:_0x2b7a35[_0xaba6('0x38')];if(!_0x1be4e0[_0xaba6('0x34')][_0xaba6('0x3b')](_0xaba6('0x3c'))){_0x4f308d['limit']=qs[_0xaba6('0x21')](_0x1be4e0[_0xaba6('0x34')][_0xaba6('0x21')]);_0x4f308d[_0xaba6('0x23')]=qs[_0xaba6('0x23')](_0x1be4e0['query'][_0xaba6('0x23')]);}_0x4f308d['order']=qs['sort'](_0x1be4e0[_0xaba6('0x34')][_0xaba6('0x3d')]);_0x4f308d[_0xaba6('0x3e')]=qs['filters'](_['pick'](_0x1be4e0[_0xaba6('0x34')],_0x2b7a35[_0xaba6('0x35')]),_0x30f090);if(_0x1be4e0['query'][_0xaba6('0x3f')]){_0x4f308d['where']=_[_0xaba6('0x40')](_0x4f308d[_0xaba6('0x3e')],{'$or':_[_0xaba6('0x2f')](_0x30f090,function(_0x244539){if(_0x244539[_0xaba6('0x32')]!==_0xaba6('0x41')){var _0x10d335={};_0x10d335[_0x244539[_0xaba6('0x2c')]]={'$like':'%'+_0x1be4e0['query'][_0xaba6('0x3f')]+'%'};return _0x10d335;}})});}_0x4f308d=_[_0xaba6('0x40')]({},_0x4f308d,_0x1be4e0[_0xaba6('0x42')]);var _0x7ae90b={'where':_0x4f308d['where']};return db[_0xaba6('0x30')][_0xaba6('0x22')](_0x7ae90b)[_0xaba6('0x28')](function(_0xd6b992){_0x58e240[_0xaba6('0x22')]=_0xd6b992;if(_0x1be4e0[_0xaba6('0x34')]['includeAll']){_0x4f308d[_0xaba6('0x43')]=[{'all':!![]}];}return db[_0xaba6('0x30')][_0xaba6('0x44')](_0x4f308d);})[_0xaba6('0x28')](function(_0x3b777c){_0x58e240['rows']=_0x3b777c;return _0x58e240;})['then'](respondWithFilteredResult(_0x4e2283,_0x4f308d))[_0xaba6('0x45')](handleError(_0x4e2283,null));};exports[_0xaba6('0x46')]=function(_0x21dcf5,_0x4053c1){var _0x2a1f1a={'raw':!![],'where':{'id':_0x21dcf5['params']['id']}},_0x40a29d={};_0x40a29d['model']=_[_0xaba6('0x47')](db[_0xaba6('0x30')][_0xaba6('0x48')]);_0x40a29d[_0xaba6('0x34')]=_[_0xaba6('0x47')](_0x21dcf5[_0xaba6('0x34')]);_0x40a29d[_0xaba6('0x35')]=_[_0xaba6('0x36')](_0x40a29d['model'],_0x40a29d[_0xaba6('0x34')]);_0x2a1f1a['attributes']=_[_0xaba6('0x36')](_0x40a29d['model'],qs[_0xaba6('0x39')](_0x21dcf5['query'][_0xaba6('0x39')]));_0x2a1f1a[_0xaba6('0x37')]=_0x2a1f1a[_0xaba6('0x37')][_0xaba6('0x3a')]?_0x2a1f1a['attributes']:_0x40a29d['model'];if(_0x21dcf5[_0xaba6('0x34')][_0xaba6('0x49')]){_0x2a1f1a[_0xaba6('0x43')]=[{'all':!![]}];}_0x2a1f1a=_['merge']({},_0x2a1f1a,_0x21dcf5['options']);return db[_0xaba6('0x30')]['find'](_0x2a1f1a)[_0xaba6('0x28')](handleEntityNotFound(_0x4053c1,null))['then'](respondWithResult(_0x4053c1,null))['catch'](handleError(_0x4053c1,null));};exports[_0xaba6('0x4a')]=function(_0x1f054f,_0x5064df){return db[_0xaba6('0x30')][_0xaba6('0x4a')](_0x1f054f[_0xaba6('0x4b')],{})[_0xaba6('0x28')](respondWithResult(_0x5064df,0xc9))['catch'](handleError(_0x5064df,null));};exports['update']=function(_0x15fe02,_0x3c9b6c){if(_0x15fe02[_0xaba6('0x4b')]['id']){delete _0x15fe02[_0xaba6('0x4b')]['id'];}return db[_0xaba6('0x30')]['find']({'where':{'id':_0x15fe02[_0xaba6('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3c9b6c,null))[_0xaba6('0x28')](saveUpdates(_0x15fe02['body'],null))['then'](respondWithResult(_0x3c9b6c,null))[_0xaba6('0x45')](handleError(_0x3c9b6c,null));};exports[_0xaba6('0x29')]=function(_0x1fcc70,_0x2ba13e){return db[_0xaba6('0x30')][_0xaba6('0x4d')]({'where':{'id':_0x1fcc70['params']['id']}})[_0xaba6('0x28')](handleEntityNotFound(_0x2ba13e,null))[_0xaba6('0x28')](removeEntity(_0x2ba13e,null))[_0xaba6('0x45')](handleError(_0x2ba13e,null));}; \ No newline at end of file +var _0x470f=['send','index','map','SalesforceField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','catch','show','params','includeAll','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','lodash','crypto','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','update','then','sendStatus','error','stack','name'];(function(_0x28ba71,_0x4c8dd7){var _0x37acb8=function(_0xbf74dc){while(--_0xbf74dc){_0x28ba71['push'](_0x28ba71['shift']());}};_0x37acb8(++_0x4c8dd7);}(_0x470f,0xad));var _0xf470=function(_0x5ead39,_0x5278df){_0x5ead39=_0x5ead39-0x0;var _0x10d9f8=_0x470f[_0x5ead39];return _0x10d9f8;};'use strict';var emlformat=require(_0xf470('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf470('0x1'));var jsonpatch=require(_0xf470('0x2'));var rp=require(_0xf470('0x3'));var moment=require(_0xf470('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf470('0x5'));var util=require(_0xf470('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xf470('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf470('0x8'));var squel=require('squel');var crypto=require(_0xf470('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xf470('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf470('0xb'));var Redis=require('ioredis');var authService=require(_0xf470('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf470('0xd'));var logger=require(_0xf470('0xe'))(_0xf470('0xf'));var utils=require(_0xf470('0x10'));var config=require(_0xf470('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf17a16,_0x5f0e0e){_0x5f0e0e=_0x5f0e0e||0xcc;return function(_0x3e6b29){if(_0x3e6b29){return _0xf17a16['sendStatus'](_0x5f0e0e);}return _0xf17a16[_0xf470('0x12')](_0x5f0e0e)[_0xf470('0x13')]();};}function respondWithResult(_0x1084b9,_0x45d8ba){_0x45d8ba=_0x45d8ba||0xc8;return function(_0x1afac3){if(_0x1afac3){return _0x1084b9['status'](_0x45d8ba)[_0xf470('0x14')](_0x1afac3);}};}function respondWithFilteredResult(_0x3aa781,_0x1f2693){return function(_0x2abc6b){if(_0x2abc6b){var _0x43ced2=typeof _0x1f2693['offset']==='undefined'&&typeof _0x1f2693['limit']===_0xf470('0x15');var _0x40fa10=_0x2abc6b[_0xf470('0x16')];var _0x322349=_0x43ced2?0x0:_0x1f2693[_0xf470('0x17')];var _0x48ff1f=_0x43ced2?_0x2abc6b[_0xf470('0x16')]:_0x1f2693[_0xf470('0x17')]+_0x1f2693['limit'];var _0x253e5e;if(_0x48ff1f>=_0x40fa10){_0x48ff1f=_0x40fa10;_0x253e5e=0xc8;}else{_0x253e5e=0xce;}_0x3aa781[_0xf470('0x12')](_0x253e5e);return _0x3aa781[_0xf470('0x18')](_0xf470('0x19'),_0x322349+'-'+_0x48ff1f+'/'+_0x40fa10)['json'](_0x2abc6b);}return null;};}function patchUpdates(_0x3fceb6){return function(_0x49def4){try{jsonpatch[_0xf470('0x1a')](_0x49def4,_0x3fceb6,!![]);}catch(_0x399ef5){return BPromise[_0xf470('0x1b')](_0x399ef5);}return _0x49def4['save']();};}function saveUpdates(_0x9699b6,_0x3ac3e8){return function(_0x3d95d0){if(_0x3d95d0){return _0x3d95d0[_0xf470('0x1c')](_0x9699b6)[_0xf470('0x1d')](function(_0x1a5295){return _0x1a5295;});}return null;};}function removeEntity(_0xd920ba,_0x3deff8){return function(_0x9a6594){if(_0x9a6594){return _0x9a6594['destroy']()[_0xf470('0x1d')](function(){_0xd920ba[_0xf470('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fa94d,_0x23ffca){return function(_0x3a05a3){if(!_0x3a05a3){_0x2fa94d[_0xf470('0x1e')](0x194);}return _0x3a05a3;};}function handleError(_0x51c504,_0x5a7ace){_0x5a7ace=_0x5a7ace||0x1f4;return function(_0x29ad37){logger[_0xf470('0x1f')](_0x29ad37[_0xf470('0x20')]);if(_0x29ad37[_0xf470('0x21')]){delete _0x29ad37[_0xf470('0x21')];}_0x51c504[_0xf470('0x12')](_0x5a7ace)[_0xf470('0x22')](_0x29ad37);};}exports[_0xf470('0x23')]=function(_0x400c49,_0x3e5434){var _0xfc3a8e={},_0x443cd6={},_0x5269ce={'count':0x0,'rows':[]};var _0x5f353b=_[_0xf470('0x24')](db[_0xf470('0x25')][_0xf470('0x26')],function(_0x306b3b){return{'name':_0x306b3b[_0xf470('0x27')],'type':_0x306b3b[_0xf470('0x28')][_0xf470('0x29')]};});_0x443cd6['model']=_[_0xf470('0x24')](_0x5f353b,'name');_0x443cd6[_0xf470('0x2a')]=_[_0xf470('0x2b')](_0x400c49[_0xf470('0x2a')]);_0x443cd6[_0xf470('0x2c')]=_[_0xf470('0x2d')](_0x443cd6[_0xf470('0x2e')],_0x443cd6[_0xf470('0x2a')]);_0xfc3a8e[_0xf470('0x2f')]=_[_0xf470('0x2d')](_0x443cd6[_0xf470('0x2e')],qs[_0xf470('0x30')](_0x400c49[_0xf470('0x2a')][_0xf470('0x30')]));_0xfc3a8e[_0xf470('0x2f')]=_0xfc3a8e['attributes'][_0xf470('0x31')]?_0xfc3a8e['attributes']:_0x443cd6[_0xf470('0x2e')];if(!_0x400c49[_0xf470('0x2a')][_0xf470('0x32')](_0xf470('0x33'))){_0xfc3a8e[_0xf470('0x34')]=qs['limit'](_0x400c49[_0xf470('0x2a')][_0xf470('0x34')]);_0xfc3a8e['offset']=qs[_0xf470('0x17')](_0x400c49[_0xf470('0x2a')]['offset']);}_0xfc3a8e[_0xf470('0x35')]=qs[_0xf470('0x36')](_0x400c49[_0xf470('0x2a')]['sort']);_0xfc3a8e[_0xf470('0x37')]=qs[_0xf470('0x2c')](_[_0xf470('0x38')](_0x400c49['query'],_0x443cd6[_0xf470('0x2c')]),_0x5f353b);if(_0x400c49[_0xf470('0x2a')][_0xf470('0x39')]){_0xfc3a8e[_0xf470('0x37')]=_[_0xf470('0x3a')](_0xfc3a8e[_0xf470('0x37')],{'$or':_['map'](_0x5f353b,function(_0x40f523){if(_0x40f523[_0xf470('0x28')]!==_0xf470('0x3b')){var _0x5a5db2={};_0x5a5db2[_0x40f523[_0xf470('0x21')]]={'$like':'%'+_0x400c49[_0xf470('0x2a')]['filter']+'%'};return _0x5a5db2;}})});}_0xfc3a8e=_[_0xf470('0x3a')]({},_0xfc3a8e,_0x400c49[_0xf470('0x3c')]);var _0x507798={'where':_0xfc3a8e[_0xf470('0x37')]};return db[_0xf470('0x25')][_0xf470('0x16')](_0x507798)[_0xf470('0x1d')](function(_0x4933b9){_0x5269ce[_0xf470('0x16')]=_0x4933b9;if(_0x400c49[_0xf470('0x2a')]['includeAll']){_0xfc3a8e[_0xf470('0x3d')]=[{'all':!![]}];}return db[_0xf470('0x25')]['findAll'](_0xfc3a8e);})[_0xf470('0x1d')](function(_0x3e783c){_0x5269ce['rows']=_0x3e783c;return _0x5269ce;})[_0xf470('0x1d')](respondWithFilteredResult(_0x3e5434,_0xfc3a8e))[_0xf470('0x3e')](handleError(_0x3e5434,null));};exports[_0xf470('0x3f')]=function(_0x3a1576,_0x220c18){var _0x4dd9a7={'raw':!![],'where':{'id':_0x3a1576[_0xf470('0x40')]['id']}},_0x284600={};_0x284600['model']=_['keys'](db[_0xf470('0x25')][_0xf470('0x26')]);_0x284600['query']=_[_0xf470('0x2b')](_0x3a1576['query']);_0x284600[_0xf470('0x2c')]=_['intersection'](_0x284600[_0xf470('0x2e')],_0x284600[_0xf470('0x2a')]);_0x4dd9a7[_0xf470('0x2f')]=_['intersection'](_0x284600['model'],qs[_0xf470('0x30')](_0x3a1576[_0xf470('0x2a')]['fields']));_0x4dd9a7[_0xf470('0x2f')]=_0x4dd9a7[_0xf470('0x2f')]['length']?_0x4dd9a7[_0xf470('0x2f')]:_0x284600['model'];if(_0x3a1576[_0xf470('0x2a')][_0xf470('0x41')]){_0x4dd9a7[_0xf470('0x3d')]=[{'all':!![]}];}_0x4dd9a7=_[_0xf470('0x3a')]({},_0x4dd9a7,_0x3a1576[_0xf470('0x3c')]);return db[_0xf470('0x25')][_0xf470('0x42')](_0x4dd9a7)[_0xf470('0x1d')](handleEntityNotFound(_0x220c18,null))['then'](respondWithResult(_0x220c18,null))['catch'](handleError(_0x220c18,null));};exports['create']=function(_0x19b4a5,_0x1003fa){return db[_0xf470('0x25')][_0xf470('0x43')](_0x19b4a5[_0xf470('0x44')],{})[_0xf470('0x1d')](respondWithResult(_0x1003fa,0xc9))[_0xf470('0x3e')](handleError(_0x1003fa,null));};exports[_0xf470('0x1c')]=function(_0x513c05,_0x46093b){if(_0x513c05[_0xf470('0x44')]['id']){delete _0x513c05[_0xf470('0x44')]['id'];}return db[_0xf470('0x25')][_0xf470('0x42')]({'where':{'id':_0x513c05['params']['id']}})[_0xf470('0x1d')](handleEntityNotFound(_0x46093b,null))[_0xf470('0x1d')](saveUpdates(_0x513c05['body'],null))[_0xf470('0x1d')](respondWithResult(_0x46093b,null))[_0xf470('0x3e')](handleError(_0x46093b,null));};exports['destroy']=function(_0x5ea6c0,_0x12371c){return db[_0xf470('0x25')][_0xf470('0x42')]({'where':{'id':_0x5ea6c0[_0xf470('0x40')]['id']}})[_0xf470('0x1d')](handleEntityNotFound(_0x12371c,null))['then'](removeEntity(_0x12371c,null))['catch'](handleError(_0x12371c,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 3367771..0fdbcab 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 _0xd09e=['rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','util','moment','bluebird','request-promise'];(function(_0x4c86fa,_0x2ad8ad){var _0x3b13bd=function(_0x23fb7c){while(--_0x23fb7c){_0x4c86fa['push'](_0x4c86fa['shift']());}};_0x3b13bd(++_0x2ad8ad);}(_0xd09e,0x122));var _0xed09=function(_0x241927,_0x3209ad){_0x241927=_0x241927-0x0;var _0x3ffc4e=_0xd09e[_0x241927];return _0x3ffc4e;};'use strict';var _=require('lodash');var util=require(_0xed09('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xed09('0x1'));var BPromise=require(_0xed09('0x2'));var rp=require(_0xed09('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xed09('0x4'));var config=require(_0xed09('0x5'));var attributes=require(_0xed09('0x6'));module[_0xed09('0x7')]=function(_0x4766b1,_0x5a3bb9){return _0x4766b1[_0xed09('0x8')](_0xed09('0x9'),attributes,{'tableName':_0xed09('0xa'),'paranoid':![],'indexes':[{'name':_0xed09('0xb'),'fields':[_0xed09('0xc'),_0xed09('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa16c=['int_salesforce_fields','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intSalesforceField.attributes','exports','define','SalesforceField'];(function(_0x4d899f,_0x1aa2cb){var _0x3e6008=function(_0x5ae456){while(--_0x5ae456){_0x4d899f['push'](_0x4d899f['shift']());}};_0x3e6008(++_0x1aa2cb);}(_0xa16c,0x106));var _0xca16=function(_0x27f6c2,_0x1dc1d6){_0x27f6c2=_0x27f6c2-0x0;var _0x182c94=_0xa16c[_0x27f6c2];return _0x182c94;};'use strict';var _=require('lodash');var util=require(_0xca16('0x0'));var logger=require(_0xca16('0x1'))(_0xca16('0x2'));var moment=require(_0xca16('0x3'));var BPromise=require(_0xca16('0x4'));var rp=require(_0xca16('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xca16('0x6'));var config=require('../../config/environment');var attributes=require(_0xca16('0x7'));module[_0xca16('0x8')]=function(_0x4895ec,_0x528c5b){return _0x4895ec[_0xca16('0x9')](_0xca16('0xa'),attributes,{'tableName':_0xca16('0xb'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':['idField',_0xca16('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 5c93835..365bcff 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 _0x280a=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x2b196c,_0x269864){var _0x32e7e6=function(_0x4197ff){while(--_0x4197ff){_0x2b196c['push'](_0x2b196c['shift']());}};_0x32e7e6(++_0x269864);}(_0x280a,0x1c0));var _0xa280=function(_0x48b00c,_0x16690b){_0x48b00c=_0x48b00c-0x0;var _0x55d181=_0x280a[_0x48b00c];return _0x55d181;};'use strict';var _=require(_0xa280('0x0'));var util=require(_0xa280('0x1'));var moment=require(_0xa280('0x2'));var BPromise=require(_0xa280('0x3'));var rs=require(_0xa280('0x4'));var fs=require('fs');var Redis=require(_0xa280('0x5'));var db=require(_0xa280('0x6'))['db'];var utils=require(_0xa280('0x7'));var logger=require(_0xa280('0x8'))('rpc');var config=require(_0xa280('0x9'));var jayson=require(_0xa280('0xa'));var client=jayson[_0xa280('0xb')][_0xa280('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x14314c,_0x52ebf8,_0x3bee52){return new BPromise(function(_0x4d3530,_0x171891){return client[_0xa280('0xd')](_0x14314c,_0x3bee52)['then'](function(_0x1ad6b9){logger[_0xa280('0xe')](_0xa280('0xf'),_0x52ebf8,_0xa280('0x10'));logger[_0xa280('0x11')](_0xa280('0x12'),_0x52ebf8,_0xa280('0x10'),JSON[_0xa280('0x13')](_0x1ad6b9));if(_0x1ad6b9[_0xa280('0x14')]){if(_0x1ad6b9[_0xa280('0x14')][_0xa280('0x15')]===0x1f4){logger[_0xa280('0x14')](_0xa280('0xf'),_0x52ebf8,_0x1ad6b9[_0xa280('0x14')][_0xa280('0x16')]);return _0x171891(_0x1ad6b9[_0xa280('0x14')]['message']);}logger[_0xa280('0x14')](_0xa280('0xf'),_0x52ebf8,_0x1ad6b9[_0xa280('0x14')][_0xa280('0x16')]);return _0x4d3530(_0x1ad6b9[_0xa280('0x14')]['message']);}else{logger[_0xa280('0xe')](_0xa280('0xf'),_0x52ebf8,_0xa280('0x10'));_0x4d3530(_0x1ad6b9[_0xa280('0x17')][_0xa280('0x16')]);}})[_0xa280('0x18')](function(_0x529153){logger[_0xa280('0x14')](_0xa280('0xf'),_0x52ebf8,_0x529153);_0x171891(_0x529153);});});} \ No newline at end of file +var _0x252d=['stringify','error','code','SalesforceField,\x20%s,\x20%s','message','result','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','request','then','info','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s'];(function(_0xf0c44f,_0x5b9618){var _0x2b3a94=function(_0x2bad74){while(--_0x2bad74){_0xf0c44f['push'](_0xf0c44f['shift']());}};_0x2b3a94(++_0x5b9618);}(_0x252d,0xf0));var _0xd252=function(_0x2e7f96,_0x2ffe43){_0x2e7f96=_0x2e7f96-0x0;var _0x315277=_0x252d[_0x2e7f96];return _0x315277;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd252('0x0'));var BPromise=require('bluebird');var rs=require(_0xd252('0x1'));var fs=require('fs');var Redis=require(_0xd252('0x2'));var db=require(_0xd252('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd252('0x4'));var config=require(_0xd252('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd252('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5598ed,_0x368114,_0x47231b){return new BPromise(function(_0x171f37,_0x3be574){return client[_0xd252('0x7')](_0x5598ed,_0x47231b)[_0xd252('0x8')](function(_0x4e13b7){logger[_0xd252('0x9')]('SalesforceField,\x20%s,\x20%s',_0x368114,_0xd252('0xa'));logger['debug'](_0xd252('0xb'),_0x368114,_0xd252('0xa'),JSON[_0xd252('0xc')](_0x4e13b7));if(_0x4e13b7[_0xd252('0xd')]){if(_0x4e13b7[_0xd252('0xd')][_0xd252('0xe')]===0x1f4){logger['error'](_0xd252('0xf'),_0x368114,_0x4e13b7['error'][_0xd252('0x10')]);return _0x3be574(_0x4e13b7[_0xd252('0xd')]['message']);}logger[_0xd252('0xd')](_0xd252('0xf'),_0x368114,_0x4e13b7[_0xd252('0xd')][_0xd252('0x10')]);return _0x171f37(_0x4e13b7[_0xd252('0xd')][_0xd252('0x10')]);}else{logger[_0xd252('0x9')](_0xd252('0xf'),_0x368114,_0xd252('0xa'));_0x171f37(_0x4e13b7[_0xd252('0x11')]['message']);}})['catch'](function(_0x19c9f0){logger[_0xd252('0xd')](_0xd252('0xf'),_0x368114,_0x19c9f0);_0x3be574(_0x19c9f0);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index cdb6d0b..aace019 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 _0xaad1=['/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','exports','multer','path','Router','../../components/interaction/service','./intServicenowAccount.controller','get','isAuthenticated','show'];(function(_0x45aa1c,_0x4a54e9){var _0x5086dc=function(_0x4f0172){while(--_0x4f0172){_0x45aa1c['push'](_0x45aa1c['shift']());}};_0x5086dc(++_0x4a54e9);}(_0xaad1,0x148));var _0x1aad=function(_0x2d3840,_0x5c0c20){_0x2d3840=_0x2d3840-0x0;var _0x36614e=_0xaad1[_0x2d3840];return _0x36614e;};'use strict';var multer=require(_0x1aad('0x0'));var util=require('util');var path=require(_0x1aad('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1aad('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1aad('0x3'));var config=require('../../config/environment');var controller=require(_0x1aad('0x4'));router[_0x1aad('0x5')]('/',auth[_0x1aad('0x6')](),controller['index']);router[_0x1aad('0x5')]('/:id',auth['isAuthenticated'](),controller[_0x1aad('0x7')]);router['get'](_0x1aad('0x8'),auth[_0x1aad('0x6')](),controller[_0x1aad('0x9')]);router[_0x1aad('0x5')](_0x1aad('0xa'),auth[_0x1aad('0x6')](),controller[_0x1aad('0xb')]);router[_0x1aad('0xc')]('/',auth['isAuthenticated'](),controller[_0x1aad('0xd')]);router[_0x1aad('0xc')]('/:id/configurations',auth[_0x1aad('0x6')](),controller[_0x1aad('0xe')]);router[_0x1aad('0xf')](_0x1aad('0x10'),auth['isAuthenticated'](),controller[_0x1aad('0x11')]);router[_0x1aad('0x12')](_0x1aad('0x10'),auth['isAuthenticated'](),controller[_0x1aad('0x13')]);module[_0x1aad('0x14')]=router; \ No newline at end of file +var _0xb7fc=['multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports'];(function(_0x3396a7,_0x35f072){var _0xb3bc24=function(_0x54dd83){while(--_0x54dd83){_0x3396a7['push'](_0x3396a7['shift']());}};_0xb3bc24(++_0x35f072);}(_0xb7fc,0x1e3));var _0xcb7f=function(_0x272d90,_0x5e70ff){_0x272d90=_0x272d90-0x0;var _0x2bf4a2=_0xb7fc[_0x272d90];return _0x2bf4a2;};'use strict';var multer=require(_0xcb7f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xcb7f('0x1'));var express=require(_0xcb7f('0x2'));var router=express[_0xcb7f('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xcb7f('0x4'));var config=require(_0xcb7f('0x5'));var controller=require(_0xcb7f('0x6'));router[_0xcb7f('0x7')]('/',auth[_0xcb7f('0x8')](),controller[_0xcb7f('0x9')]);router['get'](_0xcb7f('0xa'),auth[_0xcb7f('0x8')](),controller[_0xcb7f('0xb')]);router['get'](_0xcb7f('0xc'),auth[_0xcb7f('0x8')](),controller['getConfigurations']);router[_0xcb7f('0x7')](_0xcb7f('0xd'),auth['isAuthenticated'](),controller[_0xcb7f('0xe')]);router[_0xcb7f('0xf')]('/',auth[_0xcb7f('0x8')](),controller[_0xcb7f('0x10')]);router[_0xcb7f('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xcb7f('0x11')]);router[_0xcb7f('0x12')](_0xcb7f('0xa'),auth[_0xcb7f('0x8')](),controller[_0xcb7f('0x13')]);router[_0xcb7f('0x14')](_0xcb7f('0xa'),auth[_0xcb7f('0x8')](),controller[_0xcb7f('0x15')]);module[_0xcb7f('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 8273f89..dff7065 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 _0x0897=['sequelize','exports','STRING'];(function(_0x103bde,_0x40f335){var _0x4b8306=function(_0x193cca){while(--_0x193cca){_0x103bde['push'](_0x103bde['shift']());}};_0x4b8306(++_0x40f335);}(_0x0897,0xa8));var _0x7089=function(_0x39a0fd,_0x5699a5){_0x39a0fd=_0x39a0fd-0x0;var _0x9ca525=_0x0897[_0x39a0fd];return _0x9ca525;};'use strict';var Sequelize=require(_0x7089('0x0'));module[_0x7089('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7089('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize[_0x7089('0x2')]},'email':{'type':Sequelize[_0x7089('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x7089('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xf055=['username','remoteUri','sequelize','exports','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf055,0x160));var _0x5f05=function(_0x1aec28,_0x556b6f){_0x1aec28=_0x1aec28-0x0;var _0x2398c7=_0xf055[_0x1aec28];return _0x2398c7;};'use strict';var Sequelize=require(_0x5f05('0x0'));module[_0x5f05('0x1')]={'name':{'type':Sequelize[_0x5f05('0x2')]},'description':{'type':Sequelize[_0x5f05('0x2')]},'username':{'type':Sequelize[_0x5f05('0x2')],'unique':_0x5f05('0x3')},'password':{'type':Sequelize[_0x5f05('0x2')]},'email':{'type':Sequelize[_0x5f05('0x2')]},'remoteUri':{'type':Sequelize[_0x5f05('0x2')],'unique':_0x5f05('0x4')},'serverUrl':{'type':Sequelize[_0x5f05('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 f719785..66efb06 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 _0xa5e4=['approval_set','work_notes','short_description','correlation_display','work_start','assignment_group','description','calendar_duration','sys_class_name','follow_up','parent_incident','contact_type','urgency','company','activity_due','assigned_to','comments','sla_due','approval','due_date','sys_mod_count','sys_tags','escalation','upon_approval','correlation_id','location','username','password','remoteUri','serverUrl','slice','substring','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','label','push','all','TCL:\x20_object','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','True','true','false','sys_choice?sysparm_query=name=incident^element=','eml-format','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','count','Content-Range','apply','save','update','then','sendStatus','error','name','send','index','map','ServicenowAccount','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','options','includeAll','findAll','params','rawAttributes','find','catch','create','body','destroy','getConfigurations','findOne','ServicenowConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','caused_by','sys_updated_on','child_incidents','hold_reason','number','opened_by','user_input','sys_created_on','sys_domain','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','work_notes_list','business_service','sys_domain_path','rfc','time_worked','expected_start','business_duration','group_list','work_end','reopened_time','caller_id'];(function(_0x46bb96,_0x334e05){var _0x198885=function(_0x5052fc){while(--_0x5052fc){_0x46bb96['push'](_0x46bb96['shift']());}};_0x198885(++_0x334e05);}(_0xa5e4,0xe5));var _0x4a5e=function(_0x286343,_0x482b7e){_0x286343=_0x286343-0x0;var _0x6a5e20=_0xa5e4[_0x286343];return _0x6a5e20;};'use strict';var emlformat=require(_0x4a5e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4a5e('0x1'));var rp=require(_0x4a5e('0x2'));var moment=require('moment');var BPromise=require(_0x4a5e('0x3'));var Mustache=require(_0x4a5e('0x4'));var util=require('util');var path=require(_0x4a5e('0x5'));var sox=require(_0x4a5e('0x6'));var csv=require(_0x4a5e('0x7'));var ejs=require(_0x4a5e('0x8'));var fs=require('fs');var fs_extra=require(_0x4a5e('0x9'));var _=require(_0x4a5e('0xa'));var squel=require(_0x4a5e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4a5e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4a5e('0xd'));var authService=require(_0x4a5e('0xe'));var qs=require(_0x4a5e('0xf'));var as=require(_0x4a5e('0x10'));var hardwareService=require(_0x4a5e('0x11'));var logger=require(_0x4a5e('0x12'))(_0x4a5e('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4a5e('0x14'));var db=require(_0x4a5e('0x15'))['db'];var integrations=require(_0x4a5e('0x16'));function respondWithStatusCode(_0x20b839,_0x42cb21){_0x42cb21=_0x42cb21||0xcc;return function(_0x1722ea){if(_0x1722ea){return _0x20b839['sendStatus'](_0x42cb21);}return _0x20b839[_0x4a5e('0x17')](_0x42cb21)[_0x4a5e('0x18')]();};}function respondWithResult(_0x395016,_0x2bb04f){_0x2bb04f=_0x2bb04f||0xc8;return function(_0x21d4ef){if(_0x21d4ef){return _0x395016[_0x4a5e('0x17')](_0x2bb04f)[_0x4a5e('0x19')](_0x21d4ef);}};}function respondWithFilteredResult(_0x27b129,_0x1a37d6){return function(_0x2a0c38){if(_0x2a0c38){var _0x1f840f=typeof _0x1a37d6[_0x4a5e('0x1a')]===_0x4a5e('0x1b')&&typeof _0x1a37d6['limit']===_0x4a5e('0x1b');var _0x356b6a=_0x2a0c38[_0x4a5e('0x1c')];var _0x46c54e=_0x1f840f?0x0:_0x1a37d6[_0x4a5e('0x1a')];var _0x13e2f3=_0x1f840f?_0x2a0c38[_0x4a5e('0x1c')]:_0x1a37d6['offset']+_0x1a37d6['limit'];var _0x1f27c3;if(_0x13e2f3>=_0x356b6a){_0x13e2f3=_0x356b6a;_0x1f27c3=0xc8;}else{_0x1f27c3=0xce;}_0x27b129[_0x4a5e('0x17')](_0x1f27c3);return _0x27b129['set'](_0x4a5e('0x1d'),_0x46c54e+'-'+_0x13e2f3+'/'+_0x356b6a)[_0x4a5e('0x19')](_0x2a0c38);}return null;};}function patchUpdates(_0x19e0b4){return function(_0x17f8e9){try{jsonpatch[_0x4a5e('0x1e')](_0x17f8e9,_0x19e0b4,!![]);}catch(_0x87d632){return BPromise['reject'](_0x87d632);}return _0x17f8e9[_0x4a5e('0x1f')]();};}function saveUpdates(_0x45146c,_0x2d4147){return function(_0xf70154){if(_0xf70154){return _0xf70154[_0x4a5e('0x20')](_0x45146c)['then'](function(_0x76175b){return _0x76175b;});}return null;};}function removeEntity(_0x57a219,_0x1a4cd3){return function(_0x30c115){if(_0x30c115){return _0x30c115['destroy']()[_0x4a5e('0x21')](function(){_0x57a219[_0x4a5e('0x17')](0xcc)[_0x4a5e('0x18')]();});}};}function handleEntityNotFound(_0x372742,_0x39eda8){return function(_0x2392a9){if(!_0x2392a9){_0x372742[_0x4a5e('0x22')](0x194);}return _0x2392a9;};}function handleError(_0x673d4,_0x4eef0e){_0x4eef0e=_0x4eef0e||0x1f4;return function(_0xc9bafd){logger[_0x4a5e('0x23')](_0xc9bafd['stack']);if(_0xc9bafd[_0x4a5e('0x24')]){delete _0xc9bafd[_0x4a5e('0x24')];}_0x673d4[_0x4a5e('0x17')](_0x4eef0e)[_0x4a5e('0x25')](_0xc9bafd);};}exports[_0x4a5e('0x26')]=function(_0x3de611,_0x5ae356){var _0x2f64f2={},_0x384586={},_0x44783c={'count':0x0,'rows':[]};var _0x27170a=_[_0x4a5e('0x27')](db[_0x4a5e('0x28')]['rawAttributes'],function(_0x2a81e9){return{'name':_0x2a81e9[_0x4a5e('0x29')],'type':_0x2a81e9[_0x4a5e('0x2a')][_0x4a5e('0x2b')]};});_0x384586[_0x4a5e('0x2c')]=_['map'](_0x27170a,_0x4a5e('0x24'));_0x384586['query']=_[_0x4a5e('0x2d')](_0x3de611[_0x4a5e('0x2e')]);_0x384586['filters']=_[_0x4a5e('0x2f')](_0x384586[_0x4a5e('0x2c')],_0x384586[_0x4a5e('0x2e')]);_0x2f64f2[_0x4a5e('0x30')]=_[_0x4a5e('0x2f')](_0x384586[_0x4a5e('0x2c')],qs[_0x4a5e('0x31')](_0x3de611[_0x4a5e('0x2e')][_0x4a5e('0x31')]));_0x2f64f2[_0x4a5e('0x30')]=_0x2f64f2[_0x4a5e('0x30')][_0x4a5e('0x32')]?_0x2f64f2['attributes']:_0x384586[_0x4a5e('0x2c')];if(!_0x3de611['query'][_0x4a5e('0x33')](_0x4a5e('0x34'))){_0x2f64f2[_0x4a5e('0x35')]=qs[_0x4a5e('0x35')](_0x3de611['query'][_0x4a5e('0x35')]);_0x2f64f2[_0x4a5e('0x1a')]=qs[_0x4a5e('0x1a')](_0x3de611['query'][_0x4a5e('0x1a')]);}_0x2f64f2[_0x4a5e('0x36')]=qs[_0x4a5e('0x37')](_0x3de611[_0x4a5e('0x2e')][_0x4a5e('0x37')]);_0x2f64f2[_0x4a5e('0x38')]=qs[_0x4a5e('0x39')](_[_0x4a5e('0x3a')](_0x3de611[_0x4a5e('0x2e')],_0x384586[_0x4a5e('0x39')]),_0x27170a);if(_0x3de611[_0x4a5e('0x2e')][_0x4a5e('0x3b')]){_0x2f64f2[_0x4a5e('0x38')]=_[_0x4a5e('0x3c')](_0x2f64f2[_0x4a5e('0x38')],{'$or':_['map'](_0x27170a,function(_0x4e95ff){if(_0x4e95ff['type']!=='VIRTUAL'){var _0x54c5ba={};_0x54c5ba[_0x4e95ff[_0x4a5e('0x24')]]={'$like':'%'+_0x3de611[_0x4a5e('0x2e')][_0x4a5e('0x3b')]+'%'};return _0x54c5ba;}})});}_0x2f64f2=_['merge']({},_0x2f64f2,_0x3de611[_0x4a5e('0x3d')]);var _0x10ac58={'where':_0x2f64f2[_0x4a5e('0x38')]};return db[_0x4a5e('0x28')]['count'](_0x10ac58)[_0x4a5e('0x21')](function(_0x40d9fb){_0x44783c[_0x4a5e('0x1c')]=_0x40d9fb;if(_0x3de611[_0x4a5e('0x2e')][_0x4a5e('0x3e')]){_0x2f64f2['include']=[{'all':!![]}];}return db[_0x4a5e('0x28')][_0x4a5e('0x3f')](_0x2f64f2);})[_0x4a5e('0x21')](function(_0x2a97d6){_0x44783c['rows']=_0x2a97d6;return _0x44783c;})[_0x4a5e('0x21')](respondWithFilteredResult(_0x5ae356,_0x2f64f2))['catch'](handleError(_0x5ae356,null));};exports['show']=function(_0x7daeb3,_0x3b4901){var _0x8158bf={'raw':![],'where':{'id':_0x7daeb3[_0x4a5e('0x40')]['id']}},_0x145c32={};_0x145c32[_0x4a5e('0x2c')]=_[_0x4a5e('0x2d')](db[_0x4a5e('0x28')][_0x4a5e('0x41')]);_0x145c32[_0x4a5e('0x2e')]=_[_0x4a5e('0x2d')](_0x7daeb3[_0x4a5e('0x2e')]);_0x145c32[_0x4a5e('0x39')]=_['intersection'](_0x145c32[_0x4a5e('0x2c')],_0x145c32[_0x4a5e('0x2e')]);_0x8158bf[_0x4a5e('0x30')]=_['intersection'](_0x145c32[_0x4a5e('0x2c')],qs[_0x4a5e('0x31')](_0x7daeb3[_0x4a5e('0x2e')][_0x4a5e('0x31')]));_0x8158bf[_0x4a5e('0x30')]=_0x8158bf[_0x4a5e('0x30')][_0x4a5e('0x32')]?_0x8158bf[_0x4a5e('0x30')]:_0x145c32[_0x4a5e('0x2c')];if(_0x7daeb3[_0x4a5e('0x2e')]['includeAll']){_0x8158bf['include']=[{'all':!![]}];}_0x8158bf=_[_0x4a5e('0x3c')]({},_0x8158bf,_0x7daeb3['options']);return db[_0x4a5e('0x28')][_0x4a5e('0x42')](_0x8158bf)[_0x4a5e('0x21')](handleEntityNotFound(_0x3b4901,null))[_0x4a5e('0x21')](respondWithResult(_0x3b4901,null))[_0x4a5e('0x43')](handleError(_0x3b4901,null));};exports[_0x4a5e('0x44')]=function(_0x3f1b28,_0x44c119){return db[_0x4a5e('0x28')]['create'](_0x3f1b28['body'],{})['then'](respondWithResult(_0x44c119,0xc9))[_0x4a5e('0x43')](handleError(_0x44c119,null));};exports['update']=function(_0x1df6d5,_0x2fe03){if(_0x1df6d5[_0x4a5e('0x45')]['id']){delete _0x1df6d5[_0x4a5e('0x45')]['id'];}return db['ServicenowAccount'][_0x4a5e('0x42')]({'where':{'id':_0x1df6d5[_0x4a5e('0x40')]['id']}})['then'](handleEntityNotFound(_0x2fe03,null))[_0x4a5e('0x21')](saveUpdates(_0x1df6d5['body'],null))[_0x4a5e('0x21')](respondWithResult(_0x2fe03,null))[_0x4a5e('0x43')](handleError(_0x2fe03,null));};exports[_0x4a5e('0x46')]=function(_0x318019,_0x388550){return db[_0x4a5e('0x28')][_0x4a5e('0x42')]({'where':{'id':_0x318019[_0x4a5e('0x40')]['id']}})[_0x4a5e('0x21')](handleEntityNotFound(_0x388550,null))['then'](removeEntity(_0x388550,null))['catch'](handleError(_0x388550,null));};exports[_0x4a5e('0x47')]=function(_0x2842b5,_0x25bc2c,_0x309443){var _0x3eebf2={};var _0x100347={};var _0x2c7691;var _0x7c1449;return db[_0x4a5e('0x28')][_0x4a5e('0x48')]({'where':{'id':_0x2842b5[_0x4a5e('0x40')]['id']}})[_0x4a5e('0x21')](handleEntityNotFound(_0x25bc2c,null))[_0x4a5e('0x21')](function(_0x26d8d0){if(_0x26d8d0){_0x2c7691=_0x26d8d0;_0x100347[_0x4a5e('0x2c')]=_[_0x4a5e('0x2d')](db[_0x4a5e('0x49')]['rawAttributes']);_0x100347[_0x4a5e('0x2e')]=_['keys'](_0x2842b5['query']);_0x100347[_0x4a5e('0x39')]=_['intersection'](_0x100347[_0x4a5e('0x2c')],_0x100347['query']);_0x3eebf2['attributes']=_[_0x4a5e('0x2f')](_0x100347['model'],qs[_0x4a5e('0x31')](_0x2842b5[_0x4a5e('0x2e')]['fields']));_0x3eebf2[_0x4a5e('0x30')]=_0x3eebf2['attributes']['length']?_0x3eebf2[_0x4a5e('0x30')]:_0x100347[_0x4a5e('0x2c')];_0x3eebf2[_0x4a5e('0x36')]=qs['sort'](_0x2842b5['query'][_0x4a5e('0x37')]);_0x3eebf2[_0x4a5e('0x38')]=qs[_0x4a5e('0x39')](_[_0x4a5e('0x3a')](_0x2842b5['query'],_0x100347[_0x4a5e('0x39')]));if(_0x2842b5['query']['filter']){_0x3eebf2['where']=_[_0x4a5e('0x3c')](_0x3eebf2[_0x4a5e('0x38')],{'$or':_[_0x4a5e('0x27')](_0x3eebf2[_0x4a5e('0x30')],function(_0x3a267b){var _0x4f9885={};_0x4f9885[_0x3a267b]={'$like':'%'+_0x2842b5[_0x4a5e('0x2e')][_0x4a5e('0x3b')]+'%'};return _0x4f9885;})});}_0x3eebf2=_[_0x4a5e('0x3c')]({},_0x3eebf2,_0x2842b5[_0x4a5e('0x3d')]);return _0x2c7691[_0x4a5e('0x47')](_0x3eebf2);}})['then'](function(_0x24c70d){if(_0x24c70d){_0x7c1449=_0x24c70d[_0x4a5e('0x32')];if(!_0x2842b5[_0x4a5e('0x2e')][_0x4a5e('0x33')](_0x4a5e('0x34'))){_0x3eebf2[_0x4a5e('0x35')]=qs[_0x4a5e('0x35')](_0x2842b5[_0x4a5e('0x2e')][_0x4a5e('0x35')]);_0x3eebf2[_0x4a5e('0x1a')]=qs[_0x4a5e('0x1a')](_0x2842b5['query'][_0x4a5e('0x1a')]);}return _0x2c7691[_0x4a5e('0x47')](_0x3eebf2);}})[_0x4a5e('0x21')](function(_0x14ba68){if(_0x14ba68){return _0x14ba68?{'count':_0x7c1449,'rows':_0x14ba68}:null;}})[_0x4a5e('0x21')](respondWithResult(_0x25bc2c,null))[_0x4a5e('0x43')](handleError(_0x25bc2c,null));};exports['addConfiguration']=function(_0x108af6,_0x1df50d,_0x1ce768){if(_0x108af6[_0x4a5e('0x45')]['id']){delete _0x108af6[_0x4a5e('0x45')]['id'];}return db[_0x4a5e('0x28')]['findOne']({'where':{'id':_0x108af6['params']['id']}})[_0x4a5e('0x21')](handleEntityNotFound(_0x1df50d,null))['then'](function(_0x1e9c22){if(_0x1e9c22){_0x108af6[_0x4a5e('0x45')]['AccountId']=_0x1e9c22['id'];_0x108af6[_0x4a5e('0x45')][_0x4a5e('0x4a')]=integrations[_0x4a5e('0x4b')](_0x108af6[_0x4a5e('0x45')][_0x4a5e('0x4c')],_0x108af6['body']['type']);_0x108af6['body'][_0x4a5e('0x4d')]=integrations[_0x4a5e('0x4e')](_0x108af6[_0x4a5e('0x45')][_0x4a5e('0x4c')],_0x108af6[_0x4a5e('0x45')][_0x4a5e('0x2a')]);return db['ServicenowConfiguration']['create'](_0x108af6['body'],{'include':[{'model':db[_0x4a5e('0x4f')],'as':'Subjects'},{'model':db[_0x4a5e('0x4f')],'as':_0x4a5e('0x4d')}]});}return null;})[_0x4a5e('0x21')](respondWithResult(_0x1df50d,null))[_0x4a5e('0x43')](handleError(_0x1df50d,null));};exports['getFields']=function(_0x4dcd14,_0x280a7a,_0xbfdac7){var _0x3c8831=['made_sla','hold_reason',_0x4a5e('0x50'),_0x4a5e('0x51'),_0x4a5e('0x52'),_0x4a5e('0x53'),_0x4a5e('0x54'),_0x4a5e('0x55'),_0x4a5e('0x56')];var _0x126986=[_0x4a5e('0x57'),'made_sla',_0x4a5e('0x58'),'watch_list','upon_reject',_0x4a5e('0x59'),_0x4a5e('0x5a'),_0x4a5e('0x5b'),'approval_history',_0x4a5e('0x5c'),'resolved_by','sys_updated_by',_0x4a5e('0x5d'),_0x4a5e('0x5e'),_0x4a5e('0x5f'),_0x4a5e('0x60'),'state','sys_created_by',_0x4a5e('0x50'),'order',_0x4a5e('0x61'),_0x4a5e('0x62'),_0x4a5e('0x63'),_0x4a5e('0x64'),_0x4a5e('0x65'),'active',_0x4a5e('0x66'),_0x4a5e('0x67'),'priority',_0x4a5e('0x68'),_0x4a5e('0x69'),_0x4a5e('0x6a'),_0x4a5e('0x6b'),'opened_at',_0x4a5e('0x6c'),_0x4a5e('0x6d'),_0x4a5e('0x6e'),_0x4a5e('0x6f'),'resolved_at',_0x4a5e('0x70'),_0x4a5e('0x71'),_0x4a5e('0x51'),_0x4a5e('0x72'),_0x4a5e('0x73'),'close_code',_0x4a5e('0x74'),'delivery_task',_0x4a5e('0x75'),_0x4a5e('0x76'),'business_stc','additional_assignee_list',_0x4a5e('0x77'),_0x4a5e('0x78'),_0x4a5e('0x53'),_0x4a5e('0x79'),'close_notes','closed_by',_0x4a5e('0x7a'),_0x4a5e('0x7b'),'sys_id',_0x4a5e('0x7c'),'reopened_by',_0x4a5e('0x54'),_0x4a5e('0x7d'),'problem_id',_0x4a5e('0x7e'),'reassignment_count',_0x4a5e('0x7f'),_0x4a5e('0x80'),_0x4a5e('0x55'),_0x4a5e('0x81'),_0x4a5e('0x82'),_0x4a5e('0x83'),'comments_and_work_notes',_0x4a5e('0x84'),_0x4a5e('0x85'),'reopen_count',_0x4a5e('0x86'),_0x4a5e('0x87'),_0x4a5e('0x88'),_0x4a5e('0x89'),_0x4a5e('0x8a'),'category'];var _0x26a09c='';var _0x441b8d='';var _0x18648b=[];var _0x4aa25d='';var _0x3f368a='';var _0x217027=[];var _0x556fef='';var _0xec571='';var _0x277eea={};var _0xe0287c='';return db[_0x4a5e('0x28')][_0x4a5e('0x48')]({'where':{'id':_0x4dcd14['params']['id']},'attributes':['id',_0x4a5e('0x8b'),_0x4a5e('0x8c'),'email',_0x4a5e('0x8d'),_0x4a5e('0x8e')]})[_0x4a5e('0x21')](handleEntityNotFound(_0x280a7a,null))[_0x4a5e('0x21')](function(_0x4ad17c){if(_0x4ad17c){_0xe0287c=_0x4ad17c[_0x4a5e('0x8d')];var _0x320929=_0xe0287c[_0x4a5e('0x8f')](-0x1);if(_0x320929==='/'){_0xe0287c=_0xe0287c[_0x4a5e('0x90')](0x0,_0xe0287c['lastIndexOf'](_0x320929));}_0xec571=util[_0x4a5e('0x91')](_0x4a5e('0x92'),_0xe0287c);_0x556fef=util['format'](_0x4a5e('0x93'),_0xe0287c);_0x277eea={'user':_0x4ad17c[_0x4a5e('0x8b')],'pass':_0x4ad17c[_0x4a5e('0x8c')]};var _0x5e8287={'method':_0x4a5e('0x94'),'uri':_0xec571+_0x4a5e('0x95'),'auth':_0x277eea,'json':!![]};return rp(_0x5e8287);}})[_0x4a5e('0x21')](function(_0x5e3e0e){if(_0x5e3e0e[_0x4a5e('0x96')][_0x4a5e('0x32')]>0x0){_0x26a09c=_0x5e3e0e[_0x4a5e('0x96')];}console[_0x4a5e('0x97')](_0x4a5e('0x98'),_0x26a09c);_0x217027=[];_0x441b8d=Object[_0x4a5e('0x99')]([],_0x26a09c);_[_0x4a5e('0x9a')](_0x441b8d,function(_0x589e96){return!_0x3c8831['includes'](_0x589e96[_0x4a5e('0x24')]);});_0x441b8d['forEach'](function(_0x136888){var _0x52e472=createFieldObject(_0x556fef,_0x277eea,_0x136888['internalType'],_0x136888[_0x4a5e('0x24')],_0x136888[_0x4a5e('0x9b')],![]);_0x217027[_0x4a5e('0x9c')](_0x52e472);});return Promise[_0x4a5e('0x9d')](_0x217027);})['then'](function(_0x3bc0b7){_0x18648b=_0x3bc0b7;_0x4aa25d=Object[_0x4a5e('0x99')]([],_0x26a09c);console[_0x4a5e('0x97')](_0x4a5e('0x9e'),_0x26a09c);_[_0x4a5e('0x9a')](_0x4aa25d,function(_0xdfa89f){return _0x126986[_0x4a5e('0x9f')](_0xdfa89f[_0x4a5e('0x24')]);});console[_0x4a5e('0x97')](_0x4a5e('0xa0'),_0x4aa25d);_0x217027=[];_0x4aa25d[_0x4a5e('0xa1')](function(_0x5e74de){var _0x267725=createFieldObject(_0x556fef,_0x277eea,_0x5e74de['internalType'],_0x5e74de['name'],_0x5e74de[_0x4a5e('0x9b')],!![]);_0x217027[_0x4a5e('0x9c')](_0x267725);});return Promise['all'](_0x217027);})['then'](function(_0x580c60){_0x3f368a=_0x580c60;var _0x45ad1a=_0x18648b[_0x4a5e('0xa2')](_0x3f368a);return{'count':_0x45ad1a[_0x4a5e('0x32')],'rows':_0x45ad1a};})[_0x4a5e('0x21')](respondWithResult(_0x280a7a,null))[_0x4a5e('0x43')](function(_0x42c0ce){console[_0x4a5e('0x97')](_0x4a5e('0xa3')+_0x42c0ce);var _0x2e9c98=_0x4dcd14[_0x4a5e('0x2e')][_0x4a5e('0xa4')]?0x1f4:_0x42c0ce[_0x4a5e('0xa5')]||0x1f4;logger[_0x4a5e('0x23')](_0x42c0ce['stack']);delete _0x42c0ce[_0x4a5e('0x24')];if(_0x2e9c98===0x191){_0x2e9c98=0x190;}_0x280a7a[_0x4a5e('0x17')](_0x2e9c98)[_0x4a5e('0x25')](_0x4dcd14[_0x4a5e('0x2e')]['test']?{'message':_0x4a5e('0xa6'),'statusCode':_0x42c0ce[_0x4a5e('0xa5')]}:_0x42c0ce);});};function createFieldObject(_0x56e949,_0x1de9d4,_0x4b4858,_0x243c42,_0x10a3bc,_0x550122){return new Promise(function(_0xd6478f,_0x132c1){var _0x5b89ea={'id':_0x243c42,'name':_0x10a3bc,'custom':_0x550122};if(_0x4b4858==='boolean'){_0x5b89ea[_0x4a5e('0x3d')]=[{'name':_0x4a5e('0xa7'),'value':_0x4a5e('0xa8')},{'name':'False','value':_0x4a5e('0xa9')}];_0xd6478f(_0x5b89ea);}else{var _0x2b2176={'method':'GET','uri':_0x56e949+_0x4a5e('0xaa')+_0x243c42,'auth':_0x1de9d4,'json':!![]};return rp(_0x2b2176)[_0x4a5e('0x21')](function(_0x277f2d){var _0x4cd8e=[];if(_0x277f2d[_0x4a5e('0x96')][_0x4a5e('0x32')]>0x0){_0x277f2d['result']['forEach'](function(_0x601523){if(_0x601523['inactive']===_0x4a5e('0xa9')){var _0x114b2a={'name':_0x601523['label'],'value':_0x601523['value']};_0x4cd8e[_0x4a5e('0x9c')](_0x114b2a);}});}_0x5b89ea[_0x4a5e('0x3d')]=_0x4cd8e;if(_0x5b89ea[_0x4a5e('0x3d')][_0x4a5e('0x32')]>0x0){_0xd6478f(_0x5b89ea);}else{if(_0x550122==![]){_0xd6478f();}else{_0xd6478f(_0x5b89ea);}}});}});} \ No newline at end of file +var _0xa1f7=['Subjects','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','parent','watch_list','upon_reject','approval_history','number','resolved_by','sys_updated_by','user_input','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','priority','sys_domain_path','opened_at','group_list','work_end','reopened_time','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','closed_by','follow_up','sys_id','contact_type','reopened_by','urgency','problem_id','reassignment_count','activity_due','assigned_to','comments','sla_due','comments_and_work_notes','sys_mod_count','reopen_count','sys_tags','escalation','correlation_id','category','username','password','email','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','includes','forEach','push','all','TCL:\x20_object','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','label','concat','ServiceNow\x20error:\x20','test','stack','statusCode','True','False','false','sys_choice?sysparm_query=name=incident^element=','value','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','ServicenowAccount','fieldName','key','model','query','keys','attributes','fields','length','nolimit','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','intersection','find','create','body','update','params','findOne','ServicenowConfiguration','order','getConfigurations','hasOwnProperty','addConfiguration','getSubjects','Descriptions','getDescriptions','ServicenowField'];(function(_0x9fdb2e,_0x31290c){var _0x266309=function(_0x48ec6a){while(--_0x48ec6a){_0x9fdb2e['push'](_0x9fdb2e['shift']());}};_0x266309(++_0x31290c);}(_0xa1f7,0x1d2));var _0x7a1f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa1f7[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x7a1f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7a1f('0x1'));var jsonpatch=require(_0x7a1f('0x2'));var rp=require(_0x7a1f('0x3'));var moment=require(_0x7a1f('0x4'));var BPromise=require(_0x7a1f('0x5'));var Mustache=require(_0x7a1f('0x6'));var util=require('util');var path=require(_0x7a1f('0x7'));var sox=require(_0x7a1f('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7a1f('0x9'));var squel=require(_0x7a1f('0xa'));var crypto=require(_0x7a1f('0xb'));var jsforce=require(_0x7a1f('0xc'));var deskjs=require(_0x7a1f('0xd'));var toCsv=require(_0x7a1f('0xe'));var querystring=require(_0x7a1f('0xf'));var Papa=require(_0x7a1f('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7a1f('0x11'));var hardwareService=require(_0x7a1f('0x12'));var logger=require(_0x7a1f('0x13'))(_0x7a1f('0x14'));var utils=require(_0x7a1f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7a1f('0x16'));var db=require(_0x7a1f('0x17'))['db'];var integrations=require(_0x7a1f('0x18'));function respondWithStatusCode(_0x1b4fad,_0x3d77c2){_0x3d77c2=_0x3d77c2||0xcc;return function(_0x14e253){if(_0x14e253){return _0x1b4fad['sendStatus'](_0x3d77c2);}return _0x1b4fad[_0x7a1f('0x19')](_0x3d77c2)[_0x7a1f('0x1a')]();};}function respondWithResult(_0x306bf5,_0x592466){_0x592466=_0x592466||0xc8;return function(_0x1c014f){if(_0x1c014f){return _0x306bf5[_0x7a1f('0x19')](_0x592466)[_0x7a1f('0x1b')](_0x1c014f);}};}function respondWithFilteredResult(_0x3e63af,_0x287c01){return function(_0x5ce5b3){if(_0x5ce5b3){var _0x5f0147=typeof _0x287c01['offset']===_0x7a1f('0x1c')&&typeof _0x287c01['limit']===_0x7a1f('0x1c');var _0x5acbd7=_0x5ce5b3[_0x7a1f('0x1d')];var _0x45a1db=_0x5f0147?0x0:_0x287c01[_0x7a1f('0x1e')];var _0x4ba7ab=_0x5f0147?_0x5ce5b3['count']:_0x287c01[_0x7a1f('0x1e')]+_0x287c01[_0x7a1f('0x1f')];var _0x5f02c4;if(_0x4ba7ab>=_0x5acbd7){_0x4ba7ab=_0x5acbd7;_0x5f02c4=0xc8;}else{_0x5f02c4=0xce;}_0x3e63af['status'](_0x5f02c4);return _0x3e63af[_0x7a1f('0x20')](_0x7a1f('0x21'),_0x45a1db+'-'+_0x4ba7ab+'/'+_0x5acbd7)['json'](_0x5ce5b3);}return null;};}function patchUpdates(_0x1ca6d6){return function(_0x5abcd5){try{jsonpatch[_0x7a1f('0x22')](_0x5abcd5,_0x1ca6d6,!![]);}catch(_0x2a6cc5){return BPromise[_0x7a1f('0x23')](_0x2a6cc5);}return _0x5abcd5[_0x7a1f('0x24')]();};}function saveUpdates(_0x2b3766,_0x58df9e){return function(_0x5c64a7){if(_0x5c64a7){return _0x5c64a7['update'](_0x2b3766)[_0x7a1f('0x25')](function(_0x4254c1){return _0x4254c1;});}return null;};}function removeEntity(_0x41c1bf,_0x130117){return function(_0x2f4a8e){if(_0x2f4a8e){return _0x2f4a8e[_0x7a1f('0x26')]()[_0x7a1f('0x25')](function(){_0x41c1bf[_0x7a1f('0x19')](0xcc)[_0x7a1f('0x1a')]();});}};}function handleEntityNotFound(_0x4d9b95,_0x2d9efc){return function(_0x5e84eb){if(!_0x5e84eb){_0x4d9b95['sendStatus'](0x194);}return _0x5e84eb;};}function handleError(_0x28e1d6,_0x32aa5a){_0x32aa5a=_0x32aa5a||0x1f4;return function(_0x3c4c5b){logger[_0x7a1f('0x27')](_0x3c4c5b['stack']);if(_0x3c4c5b[_0x7a1f('0x28')]){delete _0x3c4c5b['name'];}_0x28e1d6[_0x7a1f('0x19')](_0x32aa5a)[_0x7a1f('0x29')](_0x3c4c5b);};}exports[_0x7a1f('0x2a')]=function(_0x439c60,_0xd6d084){var _0x1b8c83={},_0x2176f6={},_0x5c88b7={'count':0x0,'rows':[]};var _0x334daf=_[_0x7a1f('0x2b')](db[_0x7a1f('0x2c')]['rawAttributes'],function(_0x23cd89){return{'name':_0x23cd89[_0x7a1f('0x2d')],'type':_0x23cd89['type'][_0x7a1f('0x2e')]};});_0x2176f6[_0x7a1f('0x2f')]=_[_0x7a1f('0x2b')](_0x334daf,_0x7a1f('0x28'));_0x2176f6[_0x7a1f('0x30')]=_[_0x7a1f('0x31')](_0x439c60[_0x7a1f('0x30')]);_0x2176f6['filters']=_['intersection'](_0x2176f6[_0x7a1f('0x2f')],_0x2176f6[_0x7a1f('0x30')]);_0x1b8c83[_0x7a1f('0x32')]=_['intersection'](_0x2176f6[_0x7a1f('0x2f')],qs[_0x7a1f('0x33')](_0x439c60[_0x7a1f('0x30')][_0x7a1f('0x33')]));_0x1b8c83[_0x7a1f('0x32')]=_0x1b8c83['attributes'][_0x7a1f('0x34')]?_0x1b8c83[_0x7a1f('0x32')]:_0x2176f6['model'];if(!_0x439c60[_0x7a1f('0x30')]['hasOwnProperty'](_0x7a1f('0x35'))){_0x1b8c83[_0x7a1f('0x1f')]=qs['limit'](_0x439c60[_0x7a1f('0x30')][_0x7a1f('0x1f')]);_0x1b8c83[_0x7a1f('0x1e')]=qs['offset'](_0x439c60['query'][_0x7a1f('0x1e')]);}_0x1b8c83['order']=qs[_0x7a1f('0x36')](_0x439c60[_0x7a1f('0x30')][_0x7a1f('0x36')]);_0x1b8c83['where']=qs[_0x7a1f('0x37')](_[_0x7a1f('0x38')](_0x439c60[_0x7a1f('0x30')],_0x2176f6[_0x7a1f('0x37')]),_0x334daf);if(_0x439c60['query'][_0x7a1f('0x39')]){_0x1b8c83[_0x7a1f('0x3a')]=_[_0x7a1f('0x3b')](_0x1b8c83[_0x7a1f('0x3a')],{'$or':_[_0x7a1f('0x2b')](_0x334daf,function(_0x552db0){if(_0x552db0[_0x7a1f('0x3c')]!==_0x7a1f('0x3d')){var _0x251c69={};_0x251c69[_0x552db0[_0x7a1f('0x28')]]={'$like':'%'+_0x439c60['query'][_0x7a1f('0x39')]+'%'};return _0x251c69;}})});}_0x1b8c83=_[_0x7a1f('0x3b')]({},_0x1b8c83,_0x439c60[_0x7a1f('0x3e')]);var _0x112218={'where':_0x1b8c83[_0x7a1f('0x3a')]};return db[_0x7a1f('0x2c')][_0x7a1f('0x1d')](_0x112218)[_0x7a1f('0x25')](function(_0x6d3823){_0x5c88b7['count']=_0x6d3823;if(_0x439c60[_0x7a1f('0x30')][_0x7a1f('0x3f')]){_0x1b8c83[_0x7a1f('0x40')]=[{'all':!![]}];}return db[_0x7a1f('0x2c')][_0x7a1f('0x41')](_0x1b8c83);})[_0x7a1f('0x25')](function(_0x2cf377){_0x5c88b7[_0x7a1f('0x42')]=_0x2cf377;return _0x5c88b7;})['then'](respondWithFilteredResult(_0xd6d084,_0x1b8c83))[_0x7a1f('0x43')](handleError(_0xd6d084,null));};exports[_0x7a1f('0x44')]=function(_0x31e23f,_0x1b8cb6){var _0x5f4b90={'raw':![],'where':{'id':_0x31e23f['params']['id']}},_0x38f619={};_0x38f619[_0x7a1f('0x2f')]=_[_0x7a1f('0x31')](db['ServicenowAccount'][_0x7a1f('0x45')]);_0x38f619[_0x7a1f('0x30')]=_['keys'](_0x31e23f[_0x7a1f('0x30')]);_0x38f619[_0x7a1f('0x37')]=_[_0x7a1f('0x46')](_0x38f619[_0x7a1f('0x2f')],_0x38f619['query']);_0x5f4b90[_0x7a1f('0x32')]=_['intersection'](_0x38f619[_0x7a1f('0x2f')],qs['fields'](_0x31e23f[_0x7a1f('0x30')][_0x7a1f('0x33')]));_0x5f4b90[_0x7a1f('0x32')]=_0x5f4b90[_0x7a1f('0x32')][_0x7a1f('0x34')]?_0x5f4b90[_0x7a1f('0x32')]:_0x38f619[_0x7a1f('0x2f')];if(_0x31e23f[_0x7a1f('0x30')][_0x7a1f('0x3f')]){_0x5f4b90[_0x7a1f('0x40')]=[{'all':!![]}];}_0x5f4b90=_[_0x7a1f('0x3b')]({},_0x5f4b90,_0x31e23f[_0x7a1f('0x3e')]);return db[_0x7a1f('0x2c')][_0x7a1f('0x47')](_0x5f4b90)[_0x7a1f('0x25')](handleEntityNotFound(_0x1b8cb6,null))[_0x7a1f('0x25')](respondWithResult(_0x1b8cb6,null))[_0x7a1f('0x43')](handleError(_0x1b8cb6,null));};exports['create']=function(_0x17e620,_0x36c23b){return db[_0x7a1f('0x2c')][_0x7a1f('0x48')](_0x17e620[_0x7a1f('0x49')],{})[_0x7a1f('0x25')](respondWithResult(_0x36c23b,0xc9))['catch'](handleError(_0x36c23b,null));};exports[_0x7a1f('0x4a')]=function(_0x26532c,_0x17f634){if(_0x26532c[_0x7a1f('0x49')]['id']){delete _0x26532c['body']['id'];}return db['ServicenowAccount']['find']({'where':{'id':_0x26532c['params']['id']}})['then'](handleEntityNotFound(_0x17f634,null))[_0x7a1f('0x25')](saveUpdates(_0x26532c[_0x7a1f('0x49')],null))[_0x7a1f('0x25')](respondWithResult(_0x17f634,null))[_0x7a1f('0x43')](handleError(_0x17f634,null));};exports[_0x7a1f('0x26')]=function(_0x57de8a,_0x287330){return db['ServicenowAccount'][_0x7a1f('0x47')]({'where':{'id':_0x57de8a[_0x7a1f('0x4b')]['id']}})[_0x7a1f('0x25')](handleEntityNotFound(_0x287330,null))[_0x7a1f('0x25')](removeEntity(_0x287330,null))[_0x7a1f('0x43')](handleError(_0x287330,null));};exports['getConfigurations']=function(_0x54811a,_0x50deb1,_0x3bb8ba){var _0x5d798c={};var _0x3ae6a9={};var _0xc26f51;var _0x2a0b48;return db['ServicenowAccount'][_0x7a1f('0x4c')]({'where':{'id':_0x54811a[_0x7a1f('0x4b')]['id']}})[_0x7a1f('0x25')](handleEntityNotFound(_0x50deb1,null))['then'](function(_0x3f3e91){if(_0x3f3e91){_0xc26f51=_0x3f3e91;_0x3ae6a9['model']=_['keys'](db[_0x7a1f('0x4d')]['rawAttributes']);_0x3ae6a9[_0x7a1f('0x30')]=_[_0x7a1f('0x31')](_0x54811a[_0x7a1f('0x30')]);_0x3ae6a9[_0x7a1f('0x37')]=_['intersection'](_0x3ae6a9['model'],_0x3ae6a9[_0x7a1f('0x30')]);_0x5d798c[_0x7a1f('0x32')]=_[_0x7a1f('0x46')](_0x3ae6a9[_0x7a1f('0x2f')],qs['fields'](_0x54811a['query'][_0x7a1f('0x33')]));_0x5d798c[_0x7a1f('0x32')]=_0x5d798c[_0x7a1f('0x32')][_0x7a1f('0x34')]?_0x5d798c[_0x7a1f('0x32')]:_0x3ae6a9[_0x7a1f('0x2f')];_0x5d798c[_0x7a1f('0x4e')]=qs[_0x7a1f('0x36')](_0x54811a[_0x7a1f('0x30')]['sort']);_0x5d798c[_0x7a1f('0x3a')]=qs['filters'](_[_0x7a1f('0x38')](_0x54811a['query'],_0x3ae6a9[_0x7a1f('0x37')]));if(_0x54811a['query'][_0x7a1f('0x39')]){_0x5d798c['where']=_[_0x7a1f('0x3b')](_0x5d798c[_0x7a1f('0x3a')],{'$or':_['map'](_0x5d798c[_0x7a1f('0x32')],function(_0x4823b6){var _0x344adb={};_0x344adb[_0x4823b6]={'$like':'%'+_0x54811a[_0x7a1f('0x30')][_0x7a1f('0x39')]+'%'};return _0x344adb;})});}_0x5d798c=_['merge']({},_0x5d798c,_0x54811a[_0x7a1f('0x3e')]);return _0xc26f51[_0x7a1f('0x4f')](_0x5d798c);}})[_0x7a1f('0x25')](function(_0x9b0d81){if(_0x9b0d81){_0x2a0b48=_0x9b0d81['length'];if(!_0x54811a[_0x7a1f('0x30')][_0x7a1f('0x50')](_0x7a1f('0x35'))){_0x5d798c[_0x7a1f('0x1f')]=qs[_0x7a1f('0x1f')](_0x54811a[_0x7a1f('0x30')][_0x7a1f('0x1f')]);_0x5d798c[_0x7a1f('0x1e')]=qs[_0x7a1f('0x1e')](_0x54811a['query'][_0x7a1f('0x1e')]);}return _0xc26f51[_0x7a1f('0x4f')](_0x5d798c);}})[_0x7a1f('0x25')](function(_0x3ceef6){if(_0x3ceef6){return _0x3ceef6?{'count':_0x2a0b48,'rows':_0x3ceef6}:null;}})[_0x7a1f('0x25')](respondWithResult(_0x50deb1,null))['catch'](handleError(_0x50deb1,null));};exports[_0x7a1f('0x51')]=function(_0xe7d3c,_0x1eb764,_0x4d9420){if(_0xe7d3c[_0x7a1f('0x49')]['id']){delete _0xe7d3c[_0x7a1f('0x49')]['id'];}return db[_0x7a1f('0x2c')][_0x7a1f('0x4c')]({'where':{'id':_0xe7d3c['params']['id']}})[_0x7a1f('0x25')](handleEntityNotFound(_0x1eb764,null))[_0x7a1f('0x25')](function(_0x319257){if(_0x319257){_0xe7d3c[_0x7a1f('0x49')]['AccountId']=_0x319257['id'];_0xe7d3c['body']['Subjects']=integrations[_0x7a1f('0x52')](_0xe7d3c[_0x7a1f('0x49')]['channel'],_0xe7d3c['body']['type']);_0xe7d3c['body'][_0x7a1f('0x53')]=integrations[_0x7a1f('0x54')](_0xe7d3c['body']['channel'],_0xe7d3c[_0x7a1f('0x49')][_0x7a1f('0x3c')]);return db[_0x7a1f('0x4d')][_0x7a1f('0x48')](_0xe7d3c[_0x7a1f('0x49')],{'include':[{'model':db[_0x7a1f('0x55')],'as':_0x7a1f('0x56')},{'model':db[_0x7a1f('0x55')],'as':_0x7a1f('0x53')}]});}return null;})['then'](respondWithResult(_0x1eb764,null))[_0x7a1f('0x43')](handleError(_0x1eb764,null));};exports[_0x7a1f('0x57')]=function(_0x5efeb2,_0x560a10,_0xa19399){var _0x2602aa=[_0x7a1f('0x58'),_0x7a1f('0x59'),_0x7a1f('0x5a'),_0x7a1f('0x5b'),_0x7a1f('0x5c'),_0x7a1f('0x5d'),_0x7a1f('0x5e'),_0x7a1f('0x5f'),'category'];var _0x1468a5=[_0x7a1f('0x60'),_0x7a1f('0x58'),'caused_by',_0x7a1f('0x61'),_0x7a1f('0x62'),'sys_updated_on','child_incidents',_0x7a1f('0x59'),_0x7a1f('0x63'),_0x7a1f('0x64'),_0x7a1f('0x65'),_0x7a1f('0x66'),'opened_by',_0x7a1f('0x67'),'sys_created_on',_0x7a1f('0x68'),_0x7a1f('0x69'),_0x7a1f('0x6a'),_0x7a1f('0x5a'),_0x7a1f('0x4e'),_0x7a1f('0x6b'),_0x7a1f('0x6c'),_0x7a1f('0x6d'),_0x7a1f('0x6e'),_0x7a1f('0x6f'),_0x7a1f('0x70'),_0x7a1f('0x71'),'business_service',_0x7a1f('0x72'),_0x7a1f('0x73'),'rfc','time_worked','expected_start',_0x7a1f('0x74'),'business_duration',_0x7a1f('0x75'),_0x7a1f('0x76'),_0x7a1f('0x77'),'resolved_at','caller_id',_0x7a1f('0x78'),_0x7a1f('0x5b'),_0x7a1f('0x79'),_0x7a1f('0x7a'),_0x7a1f('0x5c'),_0x7a1f('0x7b'),_0x7a1f('0x7c'),_0x7a1f('0x7d'),'assignment_group',_0x7a1f('0x7e'),_0x7a1f('0x7f'),_0x7a1f('0x80'),_0x7a1f('0x81'),'notify',_0x7a1f('0x82'),'close_notes',_0x7a1f('0x83'),_0x7a1f('0x84'),'parent_incident',_0x7a1f('0x85'),_0x7a1f('0x86'),_0x7a1f('0x87'),'incident_state',_0x7a1f('0x88'),_0x7a1f('0x89'),'company',_0x7a1f('0x8a'),_0x7a1f('0x8b'),_0x7a1f('0x8c'),'severity',_0x7a1f('0x8d'),_0x7a1f('0x8e'),'approval',_0x7a1f('0x8f'),'due_date',_0x7a1f('0x90'),_0x7a1f('0x91'),_0x7a1f('0x92'),_0x7a1f('0x93'),'upon_approval',_0x7a1f('0x94'),'location',_0x7a1f('0x95')];var _0x502be1='';var _0x88a6c3='';var _0x33ff79=[];var _0x436e4b='';var _0x1dfe27='';var _0x55b28f=[];var _0x335bd7='';var _0x1bf7b6='';var _0x15fd13={};var _0x6fc1f2='';return db[_0x7a1f('0x2c')][_0x7a1f('0x4c')]({'where':{'id':_0x5efeb2[_0x7a1f('0x4b')]['id']},'attributes':['id',_0x7a1f('0x96'),_0x7a1f('0x97'),_0x7a1f('0x98'),'remoteUri','serverUrl']})['then'](handleEntityNotFound(_0x560a10,null))[_0x7a1f('0x25')](function(_0x2573ae){if(_0x2573ae){_0x6fc1f2=_0x2573ae[_0x7a1f('0x99')];var _0x1216bf=_0x6fc1f2[_0x7a1f('0x9a')](-0x1);if(_0x1216bf==='/'){_0x6fc1f2=_0x6fc1f2[_0x7a1f('0x9b')](0x0,_0x6fc1f2[_0x7a1f('0x9c')](_0x1216bf));}_0x1bf7b6=util[_0x7a1f('0x9d')](_0x7a1f('0x9e'),_0x6fc1f2);_0x335bd7=util['format'](_0x7a1f('0x9f'),_0x6fc1f2);_0x15fd13={'user':_0x2573ae['username'],'pass':_0x2573ae[_0x7a1f('0x97')]};var _0x346309={'method':_0x7a1f('0xa0'),'uri':_0x1bf7b6+_0x7a1f('0xa1'),'auth':_0x15fd13,'json':!![]};return rp(_0x346309);}})[_0x7a1f('0x25')](function(_0x508002){if(_0x508002['result']['length']>0x0){_0x502be1=_0x508002['result'];}console[_0x7a1f('0xa2')](_0x7a1f('0xa3'),_0x502be1);_0x55b28f=[];_0x88a6c3=Object[_0x7a1f('0xa4')]([],_0x502be1);_['remove'](_0x88a6c3,function(_0x2caf08){return!_0x2602aa[_0x7a1f('0xa5')](_0x2caf08[_0x7a1f('0x28')]);});_0x88a6c3[_0x7a1f('0xa6')](function(_0x3ba83b){var _0x459fc5=createFieldObject(_0x335bd7,_0x15fd13,_0x3ba83b['internalType'],_0x3ba83b[_0x7a1f('0x28')],_0x3ba83b['label'],![]);_0x55b28f[_0x7a1f('0xa7')](_0x459fc5);});return Promise[_0x7a1f('0xa8')](_0x55b28f);})[_0x7a1f('0x25')](function(_0x253275){_0x33ff79=_0x253275;_0x436e4b=Object[_0x7a1f('0xa4')]([],_0x502be1);console[_0x7a1f('0xa2')](_0x7a1f('0xa9'),_0x502be1);_[_0x7a1f('0xaa')](_0x436e4b,function(_0x1d2338){return _0x1468a5[_0x7a1f('0xa5')](_0x1d2338['name']);});console[_0x7a1f('0xa2')](_0x7a1f('0xab'),_0x436e4b);_0x55b28f=[];_0x436e4b[_0x7a1f('0xa6')](function(_0x4ec85e){var _0x41ad33=createFieldObject(_0x335bd7,_0x15fd13,_0x4ec85e[_0x7a1f('0xac')],_0x4ec85e['name'],_0x4ec85e[_0x7a1f('0xad')],!![]);_0x55b28f[_0x7a1f('0xa7')](_0x41ad33);});return Promise[_0x7a1f('0xa8')](_0x55b28f);})[_0x7a1f('0x25')](function(_0x41c1ff){_0x1dfe27=_0x41c1ff;var _0xe4db73=_0x33ff79[_0x7a1f('0xae')](_0x1dfe27);return{'count':_0xe4db73[_0x7a1f('0x34')],'rows':_0xe4db73};})[_0x7a1f('0x25')](respondWithResult(_0x560a10,null))[_0x7a1f('0x43')](function(_0x167419){console[_0x7a1f('0xa2')](_0x7a1f('0xaf')+_0x167419);var _0x18e7c5=_0x5efeb2['query'][_0x7a1f('0xb0')]?0x1f4:_0x167419['statusCode']||0x1f4;logger[_0x7a1f('0x27')](_0x167419[_0x7a1f('0xb1')]);delete _0x167419['name'];if(_0x18e7c5===0x191){_0x18e7c5=0x190;}_0x560a10[_0x7a1f('0x19')](_0x18e7c5)[_0x7a1f('0x29')](_0x5efeb2[_0x7a1f('0x30')][_0x7a1f('0xb0')]?{'message':'Wrong\x20credentials','statusCode':_0x167419[_0x7a1f('0xb2')]}:_0x167419);});};function createFieldObject(_0x387a60,_0x3d5b74,_0x592b6f,_0x26982f,_0x864bdf,_0x4487a7){return new Promise(function(_0x170836,_0x3400e5){var _0x45d079={'id':_0x26982f,'name':_0x864bdf,'custom':_0x4487a7};if(_0x592b6f==='boolean'){_0x45d079[_0x7a1f('0x3e')]=[{'name':_0x7a1f('0xb3'),'value':'true'},{'name':_0x7a1f('0xb4'),'value':_0x7a1f('0xb5')}];_0x170836(_0x45d079);}else{var _0x183dae={'method':_0x7a1f('0xa0'),'uri':_0x387a60+_0x7a1f('0xb6')+_0x26982f,'auth':_0x3d5b74,'json':!![]};return rp(_0x183dae)[_0x7a1f('0x25')](function(_0x1be295){var _0x17ed2a=[];if(_0x1be295['result'][_0x7a1f('0x34')]>0x0){_0x1be295['result'][_0x7a1f('0xa6')](function(_0x547ad6){if(_0x547ad6['inactive']===_0x7a1f('0xb5')){var _0x245383={'name':_0x547ad6[_0x7a1f('0xad')],'value':_0x547ad6[_0x7a1f('0xb7')]};_0x17ed2a[_0x7a1f('0xa7')](_0x245383);}});}_0x45d079[_0x7a1f('0x3e')]=_0x17ed2a;if(_0x45d079[_0x7a1f('0x3e')][_0x7a1f('0x34')]>0x0){_0x170836(_0x45d079);}else{if(_0x4487a7==![]){_0x170836();}else{_0x170836(_0x45d079);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 88eae3b..520ffe4 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 _0xb138=['int_servicenow_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes','exports','define','ServicenowAccount'];(function(_0x2c6eb8,_0x58ea05){var _0xec20c1=function(_0x56546f){while(--_0x56546f){_0x2c6eb8['push'](_0x2c6eb8['shift']());}};_0xec20c1(++_0x58ea05);}(_0xb138,0x1dd));var _0x8b13=function(_0x512aa7,_0x2be0d9){_0x512aa7=_0x512aa7-0x0;var _0x952539=_0xb138[_0x512aa7];return _0x952539;};'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 +var _0xeff8=['rimraf','../../config/environment','./intServicenowAccount.attributes','exports','define','int_servicenow_accounts','lodash','util','api','moment','bluebird','path'];(function(_0x587783,_0x6296e6){var _0x1cca44=function(_0x2c5082){while(--_0x2c5082){_0x587783['push'](_0x587783['shift']());}};_0x1cca44(++_0x6296e6);}(_0xeff8,0x186));var _0x8eff=function(_0x4e93a9,_0x413f30){_0x4e93a9=_0x4e93a9-0x0;var _0x43013c=_0xeff8[_0x4e93a9];return _0x43013c;};'use strict';var _=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var logger=require('../../config/logger')(_0x8eff('0x2'));var moment=require(_0x8eff('0x3'));var BPromise=require(_0x8eff('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8eff('0x5'));var rimraf=require(_0x8eff('0x6'));var config=require(_0x8eff('0x7'));var attributes=require(_0x8eff('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x8eff('0x9')]=function(_0xb54063,_0x3409bc){return _0xb54063[_0x8eff('0xa')]('ServicenowAccount',attributes,{'tableName':_0x8eff('0xb'),'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 deae783..fb89b73 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 _0x6395=['error','code','message','result','catch','GetServicenowAccount','findAll','options','raw','where','attributes','limit','include','model','map','debug','stringify','ShowServicenowAccount','find','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','ServicenowAccount,\x20%s,\x20%s','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x33cd72,_0x17f036){var _0x58fe05=function(_0x4396f8){while(--_0x4396f8){_0x33cd72['push'](_0x33cd72['shift']());}};_0x58fe05(++_0x17f036);}(_0x6395,0x1cd));var _0x5639=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x6395[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x5639('0x0'));var util=require(_0x5639('0x1'));var moment=require('moment');var BPromise=require(_0x5639('0x2'));var rs=require(_0x5639('0x3'));var fs=require('fs');var Redis=require(_0x5639('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5639('0x5'));var logger=require(_0x5639('0x6'))('rpc');var config=require(_0x5639('0x7'));var jayson=require(_0x5639('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x86710c,_0x44de42,_0x17e548){return new BPromise(function(_0x452f1c,_0x250323){return client[_0x5639('0x9')](_0x86710c,_0x17e548)[_0x5639('0xa')](function(_0x35549f){logger[_0x5639('0xb')](_0x5639('0xc'),_0x44de42,'request\x20sent');logger['debug'](_0x5639('0xd'),_0x44de42,_0x5639('0xe'),JSON['stringify'](_0x35549f));if(_0x35549f['error']){if(_0x35549f[_0x5639('0xf')][_0x5639('0x10')]===0x1f4){logger[_0x5639('0xf')]('ServicenowAccount,\x20%s,\x20%s',_0x44de42,_0x35549f['error'][_0x5639('0x11')]);return _0x250323(_0x35549f['error'][_0x5639('0x11')]);}logger[_0x5639('0xf')](_0x5639('0xc'),_0x44de42,_0x35549f[_0x5639('0xf')][_0x5639('0x11')]);return _0x452f1c(_0x35549f[_0x5639('0xf')]['message']);}else{logger[_0x5639('0xb')](_0x5639('0xc'),_0x44de42,_0x5639('0xe'));_0x452f1c(_0x35549f[_0x5639('0x12')][_0x5639('0x11')]);}})[_0x5639('0x13')](function(_0x5822d0){logger[_0x5639('0xf')](_0x5639('0xc'),_0x44de42,_0x5822d0);_0x250323(_0x5822d0);});});}exports[_0x5639('0x14')]=function(_0x15a0cd){var _0x23af72=this;return new Promise(function(_0x557e1e,_0x42a211){return db['ServicenowAccount'][_0x5639('0x15')]({'raw':_0x15a0cd['options']?_0x15a0cd[_0x5639('0x16')][_0x5639('0x17')]===undefined?!![]:![]:!![],'where':_0x15a0cd[_0x5639('0x16')]?_0x15a0cd['options'][_0x5639('0x18')]||null:null,'attributes':_0x15a0cd[_0x5639('0x16')]?_0x15a0cd[_0x5639('0x16')][_0x5639('0x19')]||null:null,'limit':_0x15a0cd[_0x5639('0x16')]?_0x15a0cd['options'][_0x5639('0x1a')]||null:null,'include':_0x15a0cd[_0x5639('0x16')]?_0x15a0cd[_0x5639('0x16')][_0x5639('0x1b')]?_['map'](_0x15a0cd['options']['include'],function(_0x230552){return{'model':db[_0x230552[_0x5639('0x1c')]],'as':_0x230552['as'],'attributes':_0x230552[_0x5639('0x19')],'include':_0x230552[_0x5639('0x1b')]?_[_0x5639('0x1d')](_0x230552[_0x5639('0x1b')],function(_0x2964cc){return{'model':db[_0x2964cc[_0x5639('0x1c')]],'as':_0x2964cc['as'],'attributes':_0x2964cc[_0x5639('0x19')],'include':_0x2964cc[_0x5639('0x1b')]?_[_0x5639('0x1d')](_0x2964cc[_0x5639('0x1b')],function(_0x14dd32){return{'model':db[_0x14dd32[_0x5639('0x1c')]],'as':_0x14dd32['as'],'attributes':_0x14dd32['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x504ec1){logger[_0x5639('0xb')]('GetServicenowAccount',_0x15a0cd);logger[_0x5639('0x1e')](_0x5639('0x14'),_0x15a0cd,JSON[_0x5639('0x1f')](_0x504ec1));_0x557e1e(_0x504ec1);})[_0x5639('0x13')](function(_0x523394){logger[_0x5639('0xf')]('GetServicenowAccount',_0x523394[_0x5639('0x11')],_0x15a0cd);_0x42a211(_0x23af72[_0x5639('0xf')](0x1f4,_0x523394[_0x5639('0x11')]));});});};exports[_0x5639('0x20')]=function(_0x2f395d){var _0x3a0fde=this;return new Promise(function(_0x436851,_0x3d0923){return db['ServicenowAccount'][_0x5639('0x21')]({'raw':_0x2f395d[_0x5639('0x16')]?_0x2f395d['options']['raw']===undefined?!![]:![]:!![],'where':_0x2f395d[_0x5639('0x16')]?_0x2f395d[_0x5639('0x16')][_0x5639('0x18')]||null:null,'attributes':_0x2f395d['options']?_0x2f395d[_0x5639('0x16')][_0x5639('0x19')]||null:null,'include':_0x2f395d[_0x5639('0x16')]?_0x2f395d[_0x5639('0x16')][_0x5639('0x1b')]?_[_0x5639('0x1d')](_0x2f395d[_0x5639('0x16')][_0x5639('0x1b')],function(_0x311109){return{'model':db[_0x311109[_0x5639('0x1c')]],'as':_0x311109['as'],'attributes':_0x311109[_0x5639('0x19')],'include':_0x311109[_0x5639('0x1b')]?_[_0x5639('0x1d')](_0x311109['include'],function(_0x333145){return{'model':db[_0x333145[_0x5639('0x1c')]],'as':_0x333145['as'],'attributes':_0x333145['attributes'],'include':_0x333145[_0x5639('0x1b')]?_[_0x5639('0x1d')](_0x333145[_0x5639('0x1b')],function(_0x177eaa){return{'model':db[_0x177eaa[_0x5639('0x1c')]],'as':_0x177eaa['as'],'attributes':_0x177eaa[_0x5639('0x19')]};}):[]};}):[]};}):[]:[]})[_0x5639('0xa')](function(_0x1a831d){logger[_0x5639('0xb')]('ShowServicenowAccount',_0x2f395d);logger[_0x5639('0x1e')](_0x5639('0x20'),_0x2f395d,JSON[_0x5639('0x1f')](_0x1a831d));_0x436851(_0x1a831d);})[_0x5639('0x13')](function(_0x11f97a){logger['error'](_0x5639('0x20'),_0x11f97a[_0x5639('0x11')],_0x2f395d);_0x3d0923(_0x3a0fde[_0x5639('0xf')](0x1f4,_0x11f97a[_0x5639('0x11')]));});});}; \ No newline at end of file +var _0xea9e=['where','attributes','include','map','model','then','GetServicenowAccount','ShowServicenowAccount','raw','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','http','request','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ServicenowAccount','findAll','options'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xea9e,0x111));var _0xeea9=function(_0x12c664,_0x4918eb){_0x12c664=_0x12c664-0x0;var _0x4130ac=_0xea9e[_0x12c664];return _0x4130ac;};'use strict';var _=require(_0xeea9('0x0'));var util=require('util');var moment=require(_0xeea9('0x1'));var BPromise=require(_0xeea9('0x2'));var rs=require(_0xeea9('0x3'));var fs=require('fs');var Redis=require(_0xeea9('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xeea9('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xeea9('0x6'));var client=jayson[_0xeea9('0x7')][_0xeea9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x16a8c,_0x22c598,_0x14a067){return new BPromise(function(_0x330081,_0x38598c){return client[_0xeea9('0x9')](_0x16a8c,_0x14a067)['then'](function(_0x38e412){logger[_0xeea9('0xa')](_0xeea9('0xb'),_0x22c598,_0xeea9('0xc'));logger[_0xeea9('0xd')](_0xeea9('0xe'),_0x22c598,_0xeea9('0xc'),JSON[_0xeea9('0xf')](_0x38e412));if(_0x38e412['error']){if(_0x38e412[_0xeea9('0x10')][_0xeea9('0x11')]===0x1f4){logger[_0xeea9('0x10')](_0xeea9('0xb'),_0x22c598,_0x38e412['error']['message']);return _0x38598c(_0x38e412[_0xeea9('0x10')][_0xeea9('0x12')]);}logger[_0xeea9('0x10')](_0xeea9('0xb'),_0x22c598,_0x38e412[_0xeea9('0x10')][_0xeea9('0x12')]);return _0x330081(_0x38e412[_0xeea9('0x10')][_0xeea9('0x12')]);}else{logger['info'](_0xeea9('0xb'),_0x22c598,_0xeea9('0xc'));_0x330081(_0x38e412[_0xeea9('0x13')][_0xeea9('0x12')]);}})[_0xeea9('0x14')](function(_0x39ed66){logger[_0xeea9('0x10')](_0xeea9('0xb'),_0x22c598,_0x39ed66);_0x38598c(_0x39ed66);});});}exports['GetServicenowAccount']=function(_0xba1743){var _0x130d12=this;return new Promise(function(_0x198f81,_0x153bbc){return db[_0xeea9('0x15')][_0xeea9('0x16')]({'raw':_0xba1743[_0xeea9('0x17')]?_0xba1743[_0xeea9('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0xba1743['options']?_0xba1743[_0xeea9('0x17')][_0xeea9('0x18')]||null:null,'attributes':_0xba1743[_0xeea9('0x17')]?_0xba1743[_0xeea9('0x17')][_0xeea9('0x19')]||null:null,'limit':_0xba1743[_0xeea9('0x17')]?_0xba1743[_0xeea9('0x17')]['limit']||null:null,'include':_0xba1743['options']?_0xba1743[_0xeea9('0x17')][_0xeea9('0x1a')]?_[_0xeea9('0x1b')](_0xba1743[_0xeea9('0x17')][_0xeea9('0x1a')],function(_0x48ad44){return{'model':db[_0x48ad44[_0xeea9('0x1c')]],'as':_0x48ad44['as'],'attributes':_0x48ad44[_0xeea9('0x19')],'include':_0x48ad44[_0xeea9('0x1a')]?_[_0xeea9('0x1b')](_0x48ad44[_0xeea9('0x1a')],function(_0x3bed57){return{'model':db[_0x3bed57['model']],'as':_0x3bed57['as'],'attributes':_0x3bed57['attributes'],'include':_0x3bed57[_0xeea9('0x1a')]?_[_0xeea9('0x1b')](_0x3bed57[_0xeea9('0x1a')],function(_0x2f0806){return{'model':db[_0x2f0806[_0xeea9('0x1c')]],'as':_0x2f0806['as'],'attributes':_0x2f0806['attributes']};}):[]};}):[]};}):[]:[]})[_0xeea9('0x1d')](function(_0x737a81){logger[_0xeea9('0xa')](_0xeea9('0x1e'),_0xba1743);logger[_0xeea9('0xd')](_0xeea9('0x1e'),_0xba1743,JSON['stringify'](_0x737a81));_0x198f81(_0x737a81);})[_0xeea9('0x14')](function(_0x53707d){logger[_0xeea9('0x10')](_0xeea9('0x1e'),_0x53707d[_0xeea9('0x12')],_0xba1743);_0x153bbc(_0x130d12[_0xeea9('0x10')](0x1f4,_0x53707d[_0xeea9('0x12')]));});});};exports[_0xeea9('0x1f')]=function(_0x249873){var _0xab9389=this;return new Promise(function(_0x157d22,_0x114207){return db[_0xeea9('0x15')]['find']({'raw':_0x249873['options']?_0x249873['options'][_0xeea9('0x20')]===undefined?!![]:![]:!![],'where':_0x249873['options']?_0x249873['options']['where']||null:null,'attributes':_0x249873[_0xeea9('0x17')]?_0x249873['options'][_0xeea9('0x19')]||null:null,'include':_0x249873['options']?_0x249873[_0xeea9('0x17')]['include']?_[_0xeea9('0x1b')](_0x249873[_0xeea9('0x17')][_0xeea9('0x1a')],function(_0xa82fb8){return{'model':db[_0xa82fb8['model']],'as':_0xa82fb8['as'],'attributes':_0xa82fb8['attributes'],'include':_0xa82fb8[_0xeea9('0x1a')]?_[_0xeea9('0x1b')](_0xa82fb8[_0xeea9('0x1a')],function(_0x29f328){return{'model':db[_0x29f328[_0xeea9('0x1c')]],'as':_0x29f328['as'],'attributes':_0x29f328[_0xeea9('0x19')],'include':_0x29f328['include']?_['map'](_0x29f328[_0xeea9('0x1a')],function(_0x3975e2){return{'model':db[_0x3975e2['model']],'as':_0x3975e2['as'],'attributes':_0x3975e2[_0xeea9('0x19')]};}):[]};}):[]};}):[]:[]})[_0xeea9('0x1d')](function(_0x7bdf7){logger[_0xeea9('0xa')]('ShowServicenowAccount',_0x249873);logger[_0xeea9('0xd')](_0xeea9('0x1f'),_0x249873,JSON[_0xeea9('0xf')](_0x7bdf7));_0x157d22(_0x7bdf7);})[_0xeea9('0x14')](function(_0x3e72e0){logger[_0xeea9('0x10')](_0xeea9('0x1f'),_0x3e72e0[_0xeea9('0x12')],_0x249873);_0x114207(_0xab9389['error'](0x1f4,_0x3e72e0[_0xeea9('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 7468918..f0d8fab 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 _0xd396=['update','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','isAuthenticated','get','show','/:id/subjects','/:id/descriptions','post','create'];(function(_0x497b1e,_0x586379){var _0x3f72e1=function(_0x4c227d){while(--_0x4c227d){_0x497b1e['push'](_0x497b1e['shift']());}};_0x3f72e1(++_0x586379);}(_0xd396,0x81));var _0x6d39=function(_0x53b93b,_0x1bfab1){_0x53b93b=_0x53b93b-0x0;var _0x485761=_0xd396[_0x53b93b];return _0x485761;};'use strict';var multer=require(_0x6d39('0x0'));var util=require(_0x6d39('0x1'));var path=require('path');var timeout=require(_0x6d39('0x2'));var express=require(_0x6d39('0x3'));var router=express[_0x6d39('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6d39('0x5'));var interaction=require(_0x6d39('0x6'));var config=require('../../config/environment');var controller=require(_0x6d39('0x7'));router['get']('/',auth[_0x6d39('0x8')](),controller['index']);router[_0x6d39('0x9')]('/:id',auth[_0x6d39('0x8')](),controller[_0x6d39('0xa')]);router[_0x6d39('0x9')]('/:id/fields',auth[_0x6d39('0x8')](),controller['getFields']);router[_0x6d39('0x9')](_0x6d39('0xb'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x6d39('0x9')](_0x6d39('0xc'),auth[_0x6d39('0x8')](),controller['getDescriptions']);router[_0x6d39('0xd')]('/',auth[_0x6d39('0x8')](),controller[_0x6d39('0xe')]);router['put']('/:id',auth[_0x6d39('0x8')](),controller[_0x6d39('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x94df=['isAuthenticated','/:id','show','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intServicenowConfiguration.controller','get'];(function(_0x25150c,_0x5c2dac){var _0x50145e=function(_0x2b5214){while(--_0x2b5214){_0x25150c['push'](_0x25150c['shift']());}};_0x50145e(++_0x5c2dac);}(_0x94df,0x1d7));var _0xf94d=function(_0x46c050,_0x3f73d1){_0x46c050=_0x46c050-0x0;var _0x27a912=_0x94df[_0x46c050];return _0x27a912;};'use strict';var multer=require(_0xf94d('0x0'));var util=require(_0xf94d('0x1'));var path=require('path');var timeout=require(_0xf94d('0x2'));var express=require(_0xf94d('0x3'));var router=express[_0xf94d('0x4')]();var fs_extra=require(_0xf94d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf94d('0x6'));var config=require('../../config/environment');var controller=require(_0xf94d('0x7'));router[_0xf94d('0x8')]('/',auth[_0xf94d('0x9')](),controller['index']);router[_0xf94d('0x8')](_0xf94d('0xa'),auth['isAuthenticated'](),controller[_0xf94d('0xb')]);router['get']('/:id/fields',auth[_0xf94d('0x9')](),controller[_0xf94d('0xc')]);router[_0xf94d('0x8')](_0xf94d('0xd'),auth[_0xf94d('0x9')](),controller['getSubjects']);router['get'](_0xf94d('0xe'),auth[_0xf94d('0x9')](),controller[_0xf94d('0xf')]);router['post']('/',auth[_0xf94d('0x9')](),controller['create']);router[_0xf94d('0x10')]('/:id',auth[_0xf94d('0x9')](),controller[_0xf94d('0x11')]);router['delete'](_0xf94d('0xa'),auth[_0xf94d('0x9')](),controller[_0xf94d('0x12')]);module[_0xf94d('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index be6f5aa..40dde6c 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 _0x5c2a=['exports','STRING'];(function(_0x5d98f1,_0x5e6890){var _0x7dd486=function(_0x477052){while(--_0x477052){_0x5d98f1['push'](_0x5d98f1['shift']());}};_0x7dd486(++_0x5e6890);}(_0x5c2a,0xec));var _0xa5c2=function(_0x326e79,_0x33dc91){_0x326e79=_0x326e79-0x0;var _0x37eb89=_0x5c2a[_0x326e79];return _0x37eb89;};'use strict';var Sequelize=require('sequelize');module[_0xa5c2('0x0')]={'name':{'type':Sequelize[_0xa5c2('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd35e=['exports','STRING','sequelize'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0xd35e,0x83));var _0xed35=function(_0x2b6124,_0x4d25f2){_0x2b6124=_0x2b6124-0x0;var _0x44c3f4=_0xd35e[_0x2b6124];return _0x44c3f4;};'use strict';var Sequelize=require(_0xed35('0x0'));module[_0xed35('0x1')]={'name':{'type':Sequelize[_0xed35('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 6a97929..890e204 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 _0x8263=['type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','include','findAll','rows','catch','params','keys','rawAttributes','includeAll','create','body','find','getFields','ServicenowField','filter','nolimit','getSubjects','findOne','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','then','destroy','error','name','send','index','map','ServicenowConfiguration','fieldName'];(function(_0x20ae51,_0x13848b){var _0x350b3c=function(_0x4688cc){while(--_0x4688cc){_0x20ae51['push'](_0x20ae51['shift']());}};_0x350b3c(++_0x13848b);}(_0x8263,0x16f));var _0x3826=function(_0x5c3de9,_0x41a145){_0x5c3de9=_0x5c3de9-0x0;var _0x2d79a3=_0x8263[_0x5c3de9];return _0x2d79a3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3826('0x0'));var zipdir=require(_0x3826('0x1'));var jsonpatch=require(_0x3826('0x2'));var rp=require(_0x3826('0x3'));var moment=require(_0x3826('0x4'));var BPromise=require(_0x3826('0x5'));var Mustache=require(_0x3826('0x6'));var util=require(_0x3826('0x7'));var path=require(_0x3826('0x8'));var sox=require(_0x3826('0x9'));var csv=require(_0x3826('0xa'));var ejs=require(_0x3826('0xb'));var fs=require('fs');var fs_extra=require(_0x3826('0xc'));var _=require(_0x3826('0xd'));var squel=require(_0x3826('0xe'));var crypto=require(_0x3826('0xf'));var jsforce=require(_0x3826('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x3826('0xa'));var querystring=require(_0x3826('0x11'));var Papa=require(_0x3826('0x12'));var Redis=require('ioredis');var authService=require(_0x3826('0x13'));var qs=require(_0x3826('0x14'));var as=require(_0x3826('0x15'));var hardwareService=require(_0x3826('0x16'));var logger=require(_0x3826('0x17'))(_0x3826('0x18'));var utils=require(_0x3826('0x19'));var config=require(_0x3826('0x1a'));var licenseUtil=require(_0x3826('0x1b'));var db=require(_0x3826('0x1c'))['db'];function respondWithStatusCode(_0x4bf7c6,_0x814d82){_0x814d82=_0x814d82||0xcc;return function(_0x2b36dc){if(_0x2b36dc){return _0x4bf7c6[_0x3826('0x1d')](_0x814d82);}return _0x4bf7c6[_0x3826('0x1e')](_0x814d82)['end']();};}function respondWithResult(_0x2a7297,_0x56e7bd){_0x56e7bd=_0x56e7bd||0xc8;return function(_0x3a02c5){if(_0x3a02c5){return _0x2a7297[_0x3826('0x1e')](_0x56e7bd)[_0x3826('0x1f')](_0x3a02c5);}};}function respondWithFilteredResult(_0x5d1b1,_0x2bd2eb){return function(_0x5a66ec){if(_0x5a66ec){var _0x55b249=typeof _0x2bd2eb[_0x3826('0x20')]===_0x3826('0x21')&&typeof _0x2bd2eb[_0x3826('0x22')]==='undefined';var _0x58f402=_0x5a66ec[_0x3826('0x23')];var _0x5b7443=_0x55b249?0x0:_0x2bd2eb[_0x3826('0x20')];var _0x25502e=_0x55b249?_0x5a66ec[_0x3826('0x23')]:_0x2bd2eb[_0x3826('0x20')]+_0x2bd2eb[_0x3826('0x22')];var _0x3866d8;if(_0x25502e>=_0x58f402){_0x25502e=_0x58f402;_0x3866d8=0xc8;}else{_0x3866d8=0xce;}_0x5d1b1[_0x3826('0x1e')](_0x3866d8);return _0x5d1b1[_0x3826('0x24')]('Content-Range',_0x5b7443+'-'+_0x25502e+'/'+_0x58f402)[_0x3826('0x1f')](_0x5a66ec);}return null;};}function patchUpdates(_0xaf84aa){return function(_0x767225){try{jsonpatch['apply'](_0x767225,_0xaf84aa,!![]);}catch(_0x91c282){return BPromise[_0x3826('0x25')](_0x91c282);}return _0x767225[_0x3826('0x26')]();};}function saveUpdates(_0x34c5ca,_0x146243){return function(_0x2221d6){if(_0x2221d6){return _0x2221d6['update'](_0x34c5ca)[_0x3826('0x27')](function(_0x23ff19){return _0x23ff19;});}return null;};}function removeEntity(_0x4c6d3f,_0x5ad974){return function(_0x5594aa){if(_0x5594aa){return _0x5594aa[_0x3826('0x28')]()[_0x3826('0x27')](function(){_0x4c6d3f[_0x3826('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a4489,_0x46a123){return function(_0x2e53e7){if(!_0x2e53e7){_0x1a4489[_0x3826('0x1d')](0x194);}return _0x2e53e7;};}function handleError(_0x27457f,_0x527ae5){_0x527ae5=_0x527ae5||0x1f4;return function(_0x3e017e){logger[_0x3826('0x29')](_0x3e017e['stack']);if(_0x3e017e[_0x3826('0x2a')]){delete _0x3e017e[_0x3826('0x2a')];}_0x27457f[_0x3826('0x1e')](_0x527ae5)[_0x3826('0x2b')](_0x3e017e);};}exports[_0x3826('0x2c')]=function(_0x16638c,_0x471e80){var _0x392826={},_0x230332={},_0x2ed3fd={'count':0x0,'rows':[]};var _0x3d42ea=_[_0x3826('0x2d')](db[_0x3826('0x2e')]['rawAttributes'],function(_0x70df63){return{'name':_0x70df63[_0x3826('0x2f')],'type':_0x70df63[_0x3826('0x30')][_0x3826('0x31')]};});_0x230332[_0x3826('0x32')]=_[_0x3826('0x2d')](_0x3d42ea,'name');_0x230332[_0x3826('0x33')]=_['keys'](_0x16638c[_0x3826('0x33')]);_0x230332[_0x3826('0x34')]=_[_0x3826('0x35')](_0x230332[_0x3826('0x32')],_0x230332['query']);_0x392826[_0x3826('0x36')]=_[_0x3826('0x35')](_0x230332['model'],qs[_0x3826('0x37')](_0x16638c[_0x3826('0x33')][_0x3826('0x37')]));_0x392826[_0x3826('0x36')]=_0x392826[_0x3826('0x36')][_0x3826('0x38')]?_0x392826['attributes']:_0x230332[_0x3826('0x32')];if(!_0x16638c['query'][_0x3826('0x39')]('nolimit')){_0x392826[_0x3826('0x22')]=qs[_0x3826('0x22')](_0x16638c[_0x3826('0x33')]['limit']);_0x392826[_0x3826('0x20')]=qs[_0x3826('0x20')](_0x16638c['query']['offset']);}_0x392826[_0x3826('0x3a')]=qs[_0x3826('0x3b')](_0x16638c[_0x3826('0x33')][_0x3826('0x3b')]);_0x392826[_0x3826('0x3c')]=qs[_0x3826('0x34')](_[_0x3826('0x3d')](_0x16638c[_0x3826('0x33')],_0x230332['filters']),_0x3d42ea);if(_0x16638c[_0x3826('0x33')]['filter']){_0x392826['where']=_[_0x3826('0x3e')](_0x392826[_0x3826('0x3c')],{'$or':_[_0x3826('0x2d')](_0x3d42ea,function(_0xe8d77e){if(_0xe8d77e['type']!==_0x3826('0x3f')){var _0x338595={};_0x338595[_0xe8d77e[_0x3826('0x2a')]]={'$like':'%'+_0x16638c['query']['filter']+'%'};return _0x338595;}})});}_0x392826=_['merge']({},_0x392826,_0x16638c[_0x3826('0x40')]);var _0x16d10d={'where':_0x392826['where']};return db[_0x3826('0x2e')][_0x3826('0x23')](_0x16d10d)[_0x3826('0x27')](function(_0x43fb4a){_0x2ed3fd[_0x3826('0x23')]=_0x43fb4a;if(_0x16638c[_0x3826('0x33')]['includeAll']){_0x392826[_0x3826('0x41')]=[{'all':!![]}];}return db[_0x3826('0x2e')][_0x3826('0x42')](_0x392826);})['then'](function(_0x37398f){_0x2ed3fd[_0x3826('0x43')]=_0x37398f;return _0x2ed3fd;})[_0x3826('0x27')](respondWithFilteredResult(_0x471e80,_0x392826))[_0x3826('0x44')](handleError(_0x471e80,null));};exports['show']=function(_0x407057,_0xc5da4){var _0x102590={'raw':![],'where':{'id':_0x407057[_0x3826('0x45')]['id']}},_0x1455f1={};_0x1455f1[_0x3826('0x32')]=_[_0x3826('0x46')](db['ServicenowConfiguration'][_0x3826('0x47')]);_0x1455f1[_0x3826('0x33')]=_[_0x3826('0x46')](_0x407057[_0x3826('0x33')]);_0x1455f1[_0x3826('0x34')]=_['intersection'](_0x1455f1[_0x3826('0x32')],_0x1455f1[_0x3826('0x33')]);_0x102590[_0x3826('0x36')]=_['intersection'](_0x1455f1[_0x3826('0x32')],qs[_0x3826('0x37')](_0x407057['query'][_0x3826('0x37')]));_0x102590[_0x3826('0x36')]=_0x102590[_0x3826('0x36')]['length']?_0x102590[_0x3826('0x36')]:_0x1455f1['model'];if(_0x407057[_0x3826('0x33')][_0x3826('0x48')]){_0x102590[_0x3826('0x41')]=[{'all':!![]}];}_0x102590=_[_0x3826('0x3e')]({},_0x102590,_0x407057[_0x3826('0x40')]);return db[_0x3826('0x2e')]['find'](_0x102590)[_0x3826('0x27')](handleEntityNotFound(_0xc5da4,null))[_0x3826('0x27')](respondWithResult(_0xc5da4,null))[_0x3826('0x44')](handleError(_0xc5da4,null));};exports[_0x3826('0x49')]=function(_0x19e09b,_0x17e88b){return db[_0x3826('0x2e')][_0x3826('0x49')](_0x19e09b[_0x3826('0x4a')],{})[_0x3826('0x27')](respondWithResult(_0x17e88b,0xc9))[_0x3826('0x44')](handleError(_0x17e88b,null));};exports['update']=function(_0x3c79c1,_0x67a9a7){if(_0x3c79c1[_0x3826('0x4a')]['id']){delete _0x3c79c1[_0x3826('0x4a')]['id'];}return db[_0x3826('0x2e')][_0x3826('0x4b')]({'where':{'id':_0x3c79c1[_0x3826('0x45')]['id']}})[_0x3826('0x27')](handleEntityNotFound(_0x67a9a7,null))[_0x3826('0x27')](saveUpdates(_0x3c79c1[_0x3826('0x4a')],null))['then'](respondWithResult(_0x67a9a7,null))['catch'](handleError(_0x67a9a7,null));};exports[_0x3826('0x28')]=function(_0x59934d,_0x599c3d){return db['ServicenowConfiguration'][_0x3826('0x4b')]({'where':{'id':_0x59934d['params']['id']}})['then'](handleEntityNotFound(_0x599c3d,null))['then'](removeEntity(_0x599c3d,null))[_0x3826('0x44')](handleError(_0x599c3d,null));};exports[_0x3826('0x4c')]=function(_0x2da309,_0x3ceba9,_0x1635ea){var _0x21aded={};var _0x4d5538={};var _0x20a6f1;var _0x95973c;return db[_0x3826('0x2e')]['findOne']({'where':{'id':_0x2da309[_0x3826('0x45')]['id']}})[_0x3826('0x27')](handleEntityNotFound(_0x3ceba9,null))[_0x3826('0x27')](function(_0x211435){if(_0x211435){_0x20a6f1=_0x211435;_0x4d5538['model']=_[_0x3826('0x46')](db[_0x3826('0x4d')][_0x3826('0x47')]);_0x4d5538['query']=_[_0x3826('0x46')](_0x2da309[_0x3826('0x33')]);_0x4d5538[_0x3826('0x34')]=_['intersection'](_0x4d5538[_0x3826('0x32')],_0x4d5538['query']);_0x21aded[_0x3826('0x36')]=_[_0x3826('0x35')](_0x4d5538[_0x3826('0x32')],qs[_0x3826('0x37')](_0x2da309[_0x3826('0x33')][_0x3826('0x37')]));_0x21aded[_0x3826('0x36')]=_0x21aded[_0x3826('0x36')][_0x3826('0x38')]?_0x21aded['attributes']:_0x4d5538[_0x3826('0x32')];_0x21aded['order']=qs[_0x3826('0x3b')](_0x2da309[_0x3826('0x33')]['sort']);_0x21aded[_0x3826('0x3c')]=qs[_0x3826('0x34')](_[_0x3826('0x3d')](_0x2da309[_0x3826('0x33')],_0x4d5538['filters']));if(_0x2da309[_0x3826('0x33')]['filter']){_0x21aded['where']=_[_0x3826('0x3e')](_0x21aded['where'],{'$or':_[_0x3826('0x2d')](_0x21aded[_0x3826('0x36')],function(_0x51dca8){var _0x3158eb={};_0x3158eb[_0x51dca8]={'$like':'%'+_0x2da309[_0x3826('0x33')][_0x3826('0x4e')]+'%'};return _0x3158eb;})});}_0x21aded=_['merge']({},_0x21aded,_0x2da309[_0x3826('0x40')]);return _0x20a6f1[_0x3826('0x4c')](_0x21aded);}})[_0x3826('0x27')](function(_0x1118a5){if(_0x1118a5){_0x95973c=_0x1118a5['length'];if(!_0x2da309[_0x3826('0x33')][_0x3826('0x39')](_0x3826('0x4f'))){_0x21aded['limit']=qs['limit'](_0x2da309[_0x3826('0x33')][_0x3826('0x22')]);_0x21aded[_0x3826('0x20')]=qs['offset'](_0x2da309[_0x3826('0x33')][_0x3826('0x20')]);}return _0x20a6f1[_0x3826('0x4c')](_0x21aded);}})[_0x3826('0x27')](function(_0x308564){if(_0x308564){return _0x308564?{'count':_0x95973c,'rows':_0x308564}:null;}})['then'](respondWithResult(_0x3ceba9,null))[_0x3826('0x44')](handleError(_0x3ceba9,null));};exports[_0x3826('0x50')]=function(_0x3b0ac1,_0x3bdab5,_0x2df24f){var _0x1965af={};var _0x1ecfc3={};var _0x52c06d;var _0x4d21d7;return db[_0x3826('0x2e')][_0x3826('0x51')]({'where':{'id':_0x3b0ac1[_0x3826('0x45')]['id']}})[_0x3826('0x27')](handleEntityNotFound(_0x3bdab5,null))[_0x3826('0x27')](function(_0x4197a8){if(_0x4197a8){_0x52c06d=_0x4197a8;_0x1ecfc3[_0x3826('0x32')]=_[_0x3826('0x46')](db[_0x3826('0x4d')][_0x3826('0x47')]);_0x1ecfc3[_0x3826('0x33')]=_[_0x3826('0x46')](_0x3b0ac1['query']);_0x1ecfc3[_0x3826('0x34')]=_[_0x3826('0x35')](_0x1ecfc3[_0x3826('0x32')],_0x1ecfc3['query']);_0x1965af[_0x3826('0x36')]=_[_0x3826('0x35')](_0x1ecfc3[_0x3826('0x32')],qs[_0x3826('0x37')](_0x3b0ac1['query']['fields']));_0x1965af[_0x3826('0x36')]=_0x1965af[_0x3826('0x36')][_0x3826('0x38')]?_0x1965af[_0x3826('0x36')]:_0x1ecfc3['model'];_0x1965af[_0x3826('0x3a')]=qs['sort'](_0x3b0ac1[_0x3826('0x33')][_0x3826('0x3b')]);_0x1965af[_0x3826('0x3c')]=qs['filters'](_['pick'](_0x3b0ac1[_0x3826('0x33')],_0x1ecfc3[_0x3826('0x34')]));if(_0x3b0ac1['query'][_0x3826('0x4e')]){_0x1965af[_0x3826('0x3c')]=_[_0x3826('0x3e')](_0x1965af['where'],{'$or':_['map'](_0x1965af[_0x3826('0x36')],function(_0x1b1f71){var _0x74c7f9={};_0x74c7f9[_0x1b1f71]={'$like':'%'+_0x3b0ac1[_0x3826('0x33')]['filter']+'%'};return _0x74c7f9;})});}_0x1965af=_[_0x3826('0x3e')]({},_0x1965af,_0x3b0ac1[_0x3826('0x40')]);return _0x52c06d[_0x3826('0x50')](_0x1965af);}})[_0x3826('0x27')](function(_0x5abb11){if(_0x5abb11){_0x4d21d7=_0x5abb11[_0x3826('0x38')];if(!_0x3b0ac1[_0x3826('0x33')]['hasOwnProperty'](_0x3826('0x4f'))){_0x1965af[_0x3826('0x22')]=qs[_0x3826('0x22')](_0x3b0ac1[_0x3826('0x33')]['limit']);_0x1965af['offset']=qs['offset'](_0x3b0ac1[_0x3826('0x33')][_0x3826('0x20')]);}return _0x52c06d[_0x3826('0x50')](_0x1965af);}})[_0x3826('0x27')](function(_0x18638a){if(_0x18638a){return _0x18638a?{'count':_0x4d21d7,'rows':_0x18638a}:null;}})['then'](respondWithResult(_0x3bdab5,null))['catch'](handleError(_0x3bdab5,null));};exports['getDescriptions']=function(_0x3e37fd,_0x20971f,_0x2f70da){var _0x10c1a8={};var _0x21f801={};var _0xed1d8e;var _0x2d48a8;return db['ServicenowConfiguration'][_0x3826('0x51')]({'where':{'id':_0x3e37fd[_0x3826('0x45')]['id']}})[_0x3826('0x27')](handleEntityNotFound(_0x20971f,null))['then'](function(_0x44d8a6){if(_0x44d8a6){_0xed1d8e=_0x44d8a6;_0x21f801['model']=_[_0x3826('0x46')](db[_0x3826('0x4d')]['rawAttributes']);_0x21f801[_0x3826('0x33')]=_[_0x3826('0x46')](_0x3e37fd['query']);_0x21f801[_0x3826('0x34')]=_[_0x3826('0x35')](_0x21f801[_0x3826('0x32')],_0x21f801[_0x3826('0x33')]);_0x10c1a8[_0x3826('0x36')]=_[_0x3826('0x35')](_0x21f801[_0x3826('0x32')],qs[_0x3826('0x37')](_0x3e37fd[_0x3826('0x33')]['fields']));_0x10c1a8[_0x3826('0x36')]=_0x10c1a8[_0x3826('0x36')][_0x3826('0x38')]?_0x10c1a8[_0x3826('0x36')]:_0x21f801[_0x3826('0x32')];_0x10c1a8[_0x3826('0x3a')]=qs[_0x3826('0x3b')](_0x3e37fd[_0x3826('0x33')][_0x3826('0x3b')]);_0x10c1a8[_0x3826('0x3c')]=qs[_0x3826('0x34')](_['pick'](_0x3e37fd['query'],_0x21f801[_0x3826('0x34')]));if(_0x3e37fd[_0x3826('0x33')]['filter']){_0x10c1a8[_0x3826('0x3c')]=_[_0x3826('0x3e')](_0x10c1a8[_0x3826('0x3c')],{'$or':_['map'](_0x10c1a8[_0x3826('0x36')],function(_0xcb9665){var _0x42173e={};_0x42173e[_0xcb9665]={'$like':'%'+_0x3e37fd[_0x3826('0x33')][_0x3826('0x4e')]+'%'};return _0x42173e;})});}_0x10c1a8=_[_0x3826('0x3e')]({},_0x10c1a8,_0x3e37fd[_0x3826('0x40')]);return _0xed1d8e[_0x3826('0x52')](_0x10c1a8);}})[_0x3826('0x27')](function(_0x689ec3){if(_0x689ec3){_0x2d48a8=_0x689ec3[_0x3826('0x38')];if(!_0x3e37fd[_0x3826('0x33')][_0x3826('0x39')](_0x3826('0x4f'))){_0x10c1a8[_0x3826('0x22')]=qs[_0x3826('0x22')](_0x3e37fd['query'][_0x3826('0x22')]);_0x10c1a8[_0x3826('0x20')]=qs[_0x3826('0x20')](_0x3e37fd[_0x3826('0x33')][_0x3826('0x20')]);}return _0xed1d8e[_0x3826('0x52')](_0x10c1a8);}})[_0x3826('0x27')](function(_0xab111f){if(_0xab111f){return _0xab111f?{'count':_0x2d48a8,'rows':_0xab111f}:null;}})[_0x3826('0x27')](respondWithResult(_0x20971f,null))[_0x3826('0x44')](handleError(_0x20971f,null));}; \ No newline at end of file +var _0x3b44=['json','undefined','offset','set','Content-Range','save','update','destroy','then','end','error','stack','name','send','index','ServicenowConfiguration','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','limit','order','sort','where','filter','VIRTUAL','options','count','includeAll','include','findAll','catch','params','length','create','body','find','getFields','ServicenowField','merge','nolimit','getSubjects','pick','getDescriptions','findOne','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x1895b7,_0x21fbc7){var _0x1aecdc=function(_0x44682a){while(--_0x44682a){_0x1895b7['push'](_0x1895b7['shift']());}};_0x1aecdc(++_0x21fbc7);}(_0x3b44,0x88));var _0x43b4=function(_0x4d1520,_0x46ba70){_0x4d1520=_0x4d1520-0x0;var _0x584bec=_0x3b44[_0x4d1520];return _0x584bec;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x43b4('0x0'));var zipdir=require(_0x43b4('0x1'));var jsonpatch=require(_0x43b4('0x2'));var rp=require(_0x43b4('0x3'));var moment=require(_0x43b4('0x4'));var BPromise=require(_0x43b4('0x5'));var Mustache=require(_0x43b4('0x6'));var util=require(_0x43b4('0x7'));var path=require('path');var sox=require(_0x43b4('0x8'));var csv=require(_0x43b4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x43b4('0xa'));var _=require('lodash');var squel=require(_0x43b4('0xb'));var crypto=require(_0x43b4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x43b4('0xd'));var toCsv=require(_0x43b4('0x9'));var querystring=require(_0x43b4('0xe'));var Papa=require(_0x43b4('0xf'));var Redis=require('ioredis');var authService=require(_0x43b4('0x10'));var qs=require(_0x43b4('0x11'));var as=require(_0x43b4('0x12'));var hardwareService=require(_0x43b4('0x13'));var logger=require(_0x43b4('0x14'))(_0x43b4('0x15'));var utils=require(_0x43b4('0x16'));var config=require(_0x43b4('0x17'));var licenseUtil=require(_0x43b4('0x18'));var db=require(_0x43b4('0x19'))['db'];function respondWithStatusCode(_0x1af625,_0x305a54){_0x305a54=_0x305a54||0xcc;return function(_0x1460a2){if(_0x1460a2){return _0x1af625[_0x43b4('0x1a')](_0x305a54);}return _0x1af625[_0x43b4('0x1b')](_0x305a54)['end']();};}function respondWithResult(_0x11a428,_0xc97f0){_0xc97f0=_0xc97f0||0xc8;return function(_0x19f3c8){if(_0x19f3c8){return _0x11a428['status'](_0xc97f0)[_0x43b4('0x1c')](_0x19f3c8);}};}function respondWithFilteredResult(_0x56973a,_0x14842d){return function(_0xdbbb27){if(_0xdbbb27){var _0x33d79f=typeof _0x14842d['offset']===_0x43b4('0x1d')&&typeof _0x14842d['limit']===_0x43b4('0x1d');var _0x163de2=_0xdbbb27['count'];var _0x2f85df=_0x33d79f?0x0:_0x14842d[_0x43b4('0x1e')];var _0x312d62=_0x33d79f?_0xdbbb27['count']:_0x14842d[_0x43b4('0x1e')]+_0x14842d['limit'];var _0x39d141;if(_0x312d62>=_0x163de2){_0x312d62=_0x163de2;_0x39d141=0xc8;}else{_0x39d141=0xce;}_0x56973a[_0x43b4('0x1b')](_0x39d141);return _0x56973a[_0x43b4('0x1f')](_0x43b4('0x20'),_0x2f85df+'-'+_0x312d62+'/'+_0x163de2)[_0x43b4('0x1c')](_0xdbbb27);}return null;};}function patchUpdates(_0x225736){return function(_0x37312e){try{jsonpatch['apply'](_0x37312e,_0x225736,!![]);}catch(_0x5b1a05){return BPromise['reject'](_0x5b1a05);}return _0x37312e[_0x43b4('0x21')]();};}function saveUpdates(_0x1a601f,_0x87b87d){return function(_0x2cabed){if(_0x2cabed){return _0x2cabed[_0x43b4('0x22')](_0x1a601f)['then'](function(_0x1fa507){return _0x1fa507;});}return null;};}function removeEntity(_0x37e200,_0x24bf4c){return function(_0x14fdd3){if(_0x14fdd3){return _0x14fdd3[_0x43b4('0x23')]()[_0x43b4('0x24')](function(){_0x37e200[_0x43b4('0x1b')](0xcc)[_0x43b4('0x25')]();});}};}function handleEntityNotFound(_0x3d3f2e,_0x2cde7a){return function(_0xee0c0c){if(!_0xee0c0c){_0x3d3f2e['sendStatus'](0x194);}return _0xee0c0c;};}function handleError(_0x54a293,_0x376620){_0x376620=_0x376620||0x1f4;return function(_0x7fb065){logger[_0x43b4('0x26')](_0x7fb065[_0x43b4('0x27')]);if(_0x7fb065['name']){delete _0x7fb065[_0x43b4('0x28')];}_0x54a293['status'](_0x376620)[_0x43b4('0x29')](_0x7fb065);};}exports[_0x43b4('0x2a')]=function(_0x532c18,_0x131418){var _0x1ea485={},_0x5d6ee3={},_0x52f1db={'count':0x0,'rows':[]};var _0xc35e4=_['map'](db[_0x43b4('0x2b')][_0x43b4('0x2c')],function(_0x15f022){return{'name':_0x15f022[_0x43b4('0x2d')],'type':_0x15f022[_0x43b4('0x2e')][_0x43b4('0x2f')]};});_0x5d6ee3['model']=_[_0x43b4('0x30')](_0xc35e4,_0x43b4('0x28'));_0x5d6ee3[_0x43b4('0x31')]=_[_0x43b4('0x32')](_0x532c18[_0x43b4('0x31')]);_0x5d6ee3[_0x43b4('0x33')]=_[_0x43b4('0x34')](_0x5d6ee3[_0x43b4('0x35')],_0x5d6ee3[_0x43b4('0x31')]);_0x1ea485['attributes']=_[_0x43b4('0x34')](_0x5d6ee3['model'],qs[_0x43b4('0x36')](_0x532c18[_0x43b4('0x31')][_0x43b4('0x36')]));_0x1ea485[_0x43b4('0x37')]=_0x1ea485[_0x43b4('0x37')]['length']?_0x1ea485[_0x43b4('0x37')]:_0x5d6ee3['model'];if(!_0x532c18[_0x43b4('0x31')][_0x43b4('0x38')]('nolimit')){_0x1ea485[_0x43b4('0x39')]=qs[_0x43b4('0x39')](_0x532c18['query'][_0x43b4('0x39')]);_0x1ea485[_0x43b4('0x1e')]=qs[_0x43b4('0x1e')](_0x532c18[_0x43b4('0x31')][_0x43b4('0x1e')]);}_0x1ea485[_0x43b4('0x3a')]=qs[_0x43b4('0x3b')](_0x532c18[_0x43b4('0x31')][_0x43b4('0x3b')]);_0x1ea485[_0x43b4('0x3c')]=qs[_0x43b4('0x33')](_['pick'](_0x532c18['query'],_0x5d6ee3[_0x43b4('0x33')]),_0xc35e4);if(_0x532c18[_0x43b4('0x31')][_0x43b4('0x3d')]){_0x1ea485[_0x43b4('0x3c')]=_['merge'](_0x1ea485[_0x43b4('0x3c')],{'$or':_[_0x43b4('0x30')](_0xc35e4,function(_0x6c90bd){if(_0x6c90bd[_0x43b4('0x2e')]!==_0x43b4('0x3e')){var _0x2ad9ca={};_0x2ad9ca[_0x6c90bd['name']]={'$like':'%'+_0x532c18[_0x43b4('0x31')][_0x43b4('0x3d')]+'%'};return _0x2ad9ca;}})});}_0x1ea485=_['merge']({},_0x1ea485,_0x532c18[_0x43b4('0x3f')]);var _0x481bbc={'where':_0x1ea485['where']};return db[_0x43b4('0x2b')][_0x43b4('0x40')](_0x481bbc)['then'](function(_0x51a121){_0x52f1db[_0x43b4('0x40')]=_0x51a121;if(_0x532c18[_0x43b4('0x31')][_0x43b4('0x41')]){_0x1ea485[_0x43b4('0x42')]=[{'all':!![]}];}return db[_0x43b4('0x2b')][_0x43b4('0x43')](_0x1ea485);})['then'](function(_0x3b1790){_0x52f1db['rows']=_0x3b1790;return _0x52f1db;})[_0x43b4('0x24')](respondWithFilteredResult(_0x131418,_0x1ea485))[_0x43b4('0x44')](handleError(_0x131418,null));};exports['show']=function(_0x1277ac,_0x149328){var _0xf39172={'raw':![],'where':{'id':_0x1277ac[_0x43b4('0x45')]['id']}},_0x4f5600={};_0x4f5600['model']=_[_0x43b4('0x32')](db['ServicenowConfiguration'][_0x43b4('0x2c')]);_0x4f5600[_0x43b4('0x31')]=_[_0x43b4('0x32')](_0x1277ac[_0x43b4('0x31')]);_0x4f5600[_0x43b4('0x33')]=_[_0x43b4('0x34')](_0x4f5600[_0x43b4('0x35')],_0x4f5600[_0x43b4('0x31')]);_0xf39172[_0x43b4('0x37')]=_[_0x43b4('0x34')](_0x4f5600[_0x43b4('0x35')],qs[_0x43b4('0x36')](_0x1277ac[_0x43b4('0x31')][_0x43b4('0x36')]));_0xf39172[_0x43b4('0x37')]=_0xf39172['attributes'][_0x43b4('0x46')]?_0xf39172[_0x43b4('0x37')]:_0x4f5600[_0x43b4('0x35')];if(_0x1277ac[_0x43b4('0x31')][_0x43b4('0x41')]){_0xf39172['include']=[{'all':!![]}];}_0xf39172=_['merge']({},_0xf39172,_0x1277ac[_0x43b4('0x3f')]);return db['ServicenowConfiguration']['find'](_0xf39172)[_0x43b4('0x24')](handleEntityNotFound(_0x149328,null))[_0x43b4('0x24')](respondWithResult(_0x149328,null))[_0x43b4('0x44')](handleError(_0x149328,null));};exports[_0x43b4('0x47')]=function(_0x19fb9a,_0x1cc644){return db[_0x43b4('0x2b')]['create'](_0x19fb9a[_0x43b4('0x48')],{})[_0x43b4('0x24')](respondWithResult(_0x1cc644,0xc9))[_0x43b4('0x44')](handleError(_0x1cc644,null));};exports[_0x43b4('0x22')]=function(_0x415e66,_0x493f2a){if(_0x415e66[_0x43b4('0x48')]['id']){delete _0x415e66[_0x43b4('0x48')]['id'];}return db[_0x43b4('0x2b')][_0x43b4('0x49')]({'where':{'id':_0x415e66[_0x43b4('0x45')]['id']}})[_0x43b4('0x24')](handleEntityNotFound(_0x493f2a,null))['then'](saveUpdates(_0x415e66[_0x43b4('0x48')],null))['then'](respondWithResult(_0x493f2a,null))[_0x43b4('0x44')](handleError(_0x493f2a,null));};exports['destroy']=function(_0x47dbd4,_0x489f07){return db[_0x43b4('0x2b')][_0x43b4('0x49')]({'where':{'id':_0x47dbd4['params']['id']}})[_0x43b4('0x24')](handleEntityNotFound(_0x489f07,null))['then'](removeEntity(_0x489f07,null))[_0x43b4('0x44')](handleError(_0x489f07,null));};exports[_0x43b4('0x4a')]=function(_0xab9d00,_0x310169,_0x30d248){var _0x220af6={};var _0x579193={};var _0x28fa86;var _0x3c1b5a;return db[_0x43b4('0x2b')]['findOne']({'where':{'id':_0xab9d00[_0x43b4('0x45')]['id']}})[_0x43b4('0x24')](handleEntityNotFound(_0x310169,null))[_0x43b4('0x24')](function(_0x2a71fb){if(_0x2a71fb){_0x28fa86=_0x2a71fb;_0x579193[_0x43b4('0x35')]=_[_0x43b4('0x32')](db[_0x43b4('0x4b')]['rawAttributes']);_0x579193['query']=_[_0x43b4('0x32')](_0xab9d00['query']);_0x579193[_0x43b4('0x33')]=_[_0x43b4('0x34')](_0x579193[_0x43b4('0x35')],_0x579193['query']);_0x220af6[_0x43b4('0x37')]=_[_0x43b4('0x34')](_0x579193[_0x43b4('0x35')],qs[_0x43b4('0x36')](_0xab9d00[_0x43b4('0x31')][_0x43b4('0x36')]));_0x220af6['attributes']=_0x220af6['attributes']['length']?_0x220af6[_0x43b4('0x37')]:_0x579193[_0x43b4('0x35')];_0x220af6[_0x43b4('0x3a')]=qs[_0x43b4('0x3b')](_0xab9d00[_0x43b4('0x31')][_0x43b4('0x3b')]);_0x220af6[_0x43b4('0x3c')]=qs[_0x43b4('0x33')](_['pick'](_0xab9d00['query'],_0x579193[_0x43b4('0x33')]));if(_0xab9d00['query'][_0x43b4('0x3d')]){_0x220af6[_0x43b4('0x3c')]=_[_0x43b4('0x4c')](_0x220af6[_0x43b4('0x3c')],{'$or':_['map'](_0x220af6['attributes'],function(_0x23e089){var _0x3b46c9={};_0x3b46c9[_0x23e089]={'$like':'%'+_0xab9d00[_0x43b4('0x31')]['filter']+'%'};return _0x3b46c9;})});}_0x220af6=_['merge']({},_0x220af6,_0xab9d00['options']);return _0x28fa86['getFields'](_0x220af6);}})['then'](function(_0x7ef960){if(_0x7ef960){_0x3c1b5a=_0x7ef960['length'];if(!_0xab9d00[_0x43b4('0x31')]['hasOwnProperty'](_0x43b4('0x4d'))){_0x220af6['limit']=qs[_0x43b4('0x39')](_0xab9d00[_0x43b4('0x31')]['limit']);_0x220af6['offset']=qs[_0x43b4('0x1e')](_0xab9d00['query']['offset']);}return _0x28fa86[_0x43b4('0x4a')](_0x220af6);}})['then'](function(_0xca74f7){if(_0xca74f7){return _0xca74f7?{'count':_0x3c1b5a,'rows':_0xca74f7}:null;}})['then'](respondWithResult(_0x310169,null))[_0x43b4('0x44')](handleError(_0x310169,null));};exports[_0x43b4('0x4e')]=function(_0x3c52e1,_0x22fad1,_0x8b8977){var _0x2011fb={};var _0x426571={};var _0x412d45;var _0x4f63b6;return db[_0x43b4('0x2b')]['findOne']({'where':{'id':_0x3c52e1['params']['id']}})[_0x43b4('0x24')](handleEntityNotFound(_0x22fad1,null))['then'](function(_0x48eeca){if(_0x48eeca){_0x412d45=_0x48eeca;_0x426571[_0x43b4('0x35')]=_[_0x43b4('0x32')](db[_0x43b4('0x4b')][_0x43b4('0x2c')]);_0x426571[_0x43b4('0x31')]=_[_0x43b4('0x32')](_0x3c52e1[_0x43b4('0x31')]);_0x426571[_0x43b4('0x33')]=_['intersection'](_0x426571[_0x43b4('0x35')],_0x426571['query']);_0x2011fb[_0x43b4('0x37')]=_[_0x43b4('0x34')](_0x426571[_0x43b4('0x35')],qs[_0x43b4('0x36')](_0x3c52e1[_0x43b4('0x31')][_0x43b4('0x36')]));_0x2011fb['attributes']=_0x2011fb[_0x43b4('0x37')][_0x43b4('0x46')]?_0x2011fb[_0x43b4('0x37')]:_0x426571[_0x43b4('0x35')];_0x2011fb['order']=qs['sort'](_0x3c52e1[_0x43b4('0x31')][_0x43b4('0x3b')]);_0x2011fb[_0x43b4('0x3c')]=qs[_0x43b4('0x33')](_[_0x43b4('0x4f')](_0x3c52e1[_0x43b4('0x31')],_0x426571[_0x43b4('0x33')]));if(_0x3c52e1[_0x43b4('0x31')][_0x43b4('0x3d')]){_0x2011fb[_0x43b4('0x3c')]=_[_0x43b4('0x4c')](_0x2011fb[_0x43b4('0x3c')],{'$or':_['map'](_0x2011fb[_0x43b4('0x37')],function(_0x16a90b){var _0x190eaf={};_0x190eaf[_0x16a90b]={'$like':'%'+_0x3c52e1[_0x43b4('0x31')][_0x43b4('0x3d')]+'%'};return _0x190eaf;})});}_0x2011fb=_[_0x43b4('0x4c')]({},_0x2011fb,_0x3c52e1[_0x43b4('0x3f')]);return _0x412d45[_0x43b4('0x4e')](_0x2011fb);}})[_0x43b4('0x24')](function(_0x1b2544){if(_0x1b2544){_0x4f63b6=_0x1b2544[_0x43b4('0x46')];if(!_0x3c52e1[_0x43b4('0x31')][_0x43b4('0x38')]('nolimit')){_0x2011fb['limit']=qs[_0x43b4('0x39')](_0x3c52e1[_0x43b4('0x31')][_0x43b4('0x39')]);_0x2011fb[_0x43b4('0x1e')]=qs[_0x43b4('0x1e')](_0x3c52e1[_0x43b4('0x31')][_0x43b4('0x1e')]);}return _0x412d45['getSubjects'](_0x2011fb);}})[_0x43b4('0x24')](function(_0x22858f){if(_0x22858f){return _0x22858f?{'count':_0x4f63b6,'rows':_0x22858f}:null;}})[_0x43b4('0x24')](respondWithResult(_0x22fad1,null))['catch'](handleError(_0x22fad1,null));};exports[_0x43b4('0x50')]=function(_0x228d18,_0x22712e,_0x9fc092){var _0x39e62c={};var _0x19ecb9={};var _0x418d28;var _0x56ba91;return db[_0x43b4('0x2b')][_0x43b4('0x51')]({'where':{'id':_0x228d18['params']['id']}})[_0x43b4('0x24')](handleEntityNotFound(_0x22712e,null))[_0x43b4('0x24')](function(_0x3e14b1){if(_0x3e14b1){_0x418d28=_0x3e14b1;_0x19ecb9[_0x43b4('0x35')]=_['keys'](db[_0x43b4('0x4b')][_0x43b4('0x2c')]);_0x19ecb9[_0x43b4('0x31')]=_[_0x43b4('0x32')](_0x228d18[_0x43b4('0x31')]);_0x19ecb9['filters']=_['intersection'](_0x19ecb9[_0x43b4('0x35')],_0x19ecb9[_0x43b4('0x31')]);_0x39e62c[_0x43b4('0x37')]=_[_0x43b4('0x34')](_0x19ecb9['model'],qs['fields'](_0x228d18[_0x43b4('0x31')]['fields']));_0x39e62c[_0x43b4('0x37')]=_0x39e62c[_0x43b4('0x37')]['length']?_0x39e62c['attributes']:_0x19ecb9['model'];_0x39e62c[_0x43b4('0x3a')]=qs[_0x43b4('0x3b')](_0x228d18['query'][_0x43b4('0x3b')]);_0x39e62c[_0x43b4('0x3c')]=qs[_0x43b4('0x33')](_[_0x43b4('0x4f')](_0x228d18[_0x43b4('0x31')],_0x19ecb9['filters']));if(_0x228d18[_0x43b4('0x31')][_0x43b4('0x3d')]){_0x39e62c['where']=_[_0x43b4('0x4c')](_0x39e62c[_0x43b4('0x3c')],{'$or':_[_0x43b4('0x30')](_0x39e62c[_0x43b4('0x37')],function(_0x3880b7){var _0x101d6c={};_0x101d6c[_0x3880b7]={'$like':'%'+_0x228d18[_0x43b4('0x31')][_0x43b4('0x3d')]+'%'};return _0x101d6c;})});}_0x39e62c=_[_0x43b4('0x4c')]({},_0x39e62c,_0x228d18[_0x43b4('0x3f')]);return _0x418d28['getDescriptions'](_0x39e62c);}})['then'](function(_0x375758){if(_0x375758){_0x56ba91=_0x375758[_0x43b4('0x46')];if(!_0x228d18[_0x43b4('0x31')][_0x43b4('0x38')]('nolimit')){_0x39e62c[_0x43b4('0x39')]=qs[_0x43b4('0x39')](_0x228d18[_0x43b4('0x31')][_0x43b4('0x39')]);_0x39e62c[_0x43b4('0x1e')]=qs[_0x43b4('0x1e')](_0x228d18['query'][_0x43b4('0x1e')]);}return _0x418d28[_0x43b4('0x50')](_0x39e62c);}})['then'](function(_0x15bbf1){if(_0x15bbf1){return _0x15bbf1?{'count':_0x56ba91,'rows':_0x15bbf1}:null;}})[_0x43b4('0x24')](respondWithResult(_0x22712e,null))[_0x43b4('0x44')](handleError(_0x22712e,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index b9c2745..bf73864 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 _0x7229=['api','moment','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','ServicenowConfiguration','lodash','util','../../config/logger'];(function(_0xf83b3b,_0x529690){var _0x24377b=function(_0x486951){while(--_0x486951){_0xf83b3b['push'](_0xf83b3b['shift']());}};_0x24377b(++_0x529690);}(_0x7229,0x76));var _0x9722=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x7229[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0x9722('0x0'));var util=require(_0x9722('0x1'));var logger=require(_0x9722('0x2'))(_0x9722('0x3'));var moment=require(_0x9722('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9722('0x5'));var rimraf=require(_0x9722('0x6'));var config=require(_0x9722('0x7'));var attributes=require(_0x9722('0x8'));module[_0x9722('0x9')]=function(_0x43e0ed,_0x2689b3){return _0x43e0ed['define'](_0x9722('0xa'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc113=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','lodash','util'];(function(_0x1d5929,_0x13f422){var _0x15cbf7=function(_0x30f152){while(--_0x30f152){_0x1d5929['push'](_0x1d5929['shift']());}};_0x15cbf7(++_0x13f422);}(_0xc113,0x1ab));var _0x3c11=function(_0x4d9574,_0x151383){_0x4d9574=_0x4d9574-0x0;var _0x52d79b=_0xc113[_0x4d9574];return _0x52d79b;};'use strict';var _=require(_0x3c11('0x0'));var util=require(_0x3c11('0x1'));var logger=require(_0x3c11('0x2'))(_0x3c11('0x3'));var moment=require(_0x3c11('0x4'));var BPromise=require(_0x3c11('0x5'));var rp=require(_0x3c11('0x6'));var fs=require('fs');var path=require(_0x3c11('0x7'));var rimraf=require(_0x3c11('0x8'));var config=require('../../config/environment');var attributes=require(_0x3c11('0x9'));module[_0x3c11('0xa')]=function(_0x595e66,_0x3dd753){return _0x595e66[_0x3c11('0xb')](_0x3c11('0xc'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index f5533d3..86cc68f 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 _0xd68c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','ServicenowConfiguration,\x20%s,\x20%s','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1e500e,_0x2c9d74){var _0x10dc5e=function(_0x354423){while(--_0x354423){_0x1e500e['push'](_0x1e500e['shift']());}};_0x10dc5e(++_0x2c9d74);}(_0xd68c,0x113));var _0xcd68=function(_0x310dc2,_0x2299c4){_0x310dc2=_0x310dc2-0x0;var _0x24980f=_0xd68c[_0x310dc2];return _0x24980f;};'use strict';var _=require(_0xcd68('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcd68('0x1'));var rs=require(_0xcd68('0x2'));var fs=require('fs');var Redis=require(_0xcd68('0x3'));var db=require(_0xcd68('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcd68('0x5'))(_0xcd68('0x6'));var config=require(_0xcd68('0x7'));var jayson=require(_0xcd68('0x8'));var client=jayson[_0xcd68('0x9')][_0xcd68('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x42ca81,_0x15a7d1,_0x276e73){return new BPromise(function(_0x5e9ed5,_0x8a592e){return client[_0xcd68('0xb')](_0x42ca81,_0x276e73)[_0xcd68('0xc')](function(_0x8402e7){logger[_0xcd68('0xd')]('ServicenowConfiguration,\x20%s,\x20%s',_0x15a7d1,_0xcd68('0xe'));logger[_0xcd68('0xf')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x15a7d1,_0xcd68('0xe'),JSON['stringify'](_0x8402e7));if(_0x8402e7[_0xcd68('0x10')]){if(_0x8402e7[_0xcd68('0x10')]['code']===0x1f4){logger[_0xcd68('0x10')](_0xcd68('0x11'),_0x15a7d1,_0x8402e7['error']['message']);return _0x8a592e(_0x8402e7[_0xcd68('0x10')][_0xcd68('0x12')]);}logger[_0xcd68('0x10')](_0xcd68('0x11'),_0x15a7d1,_0x8402e7['error'][_0xcd68('0x12')]);return _0x5e9ed5(_0x8402e7['error'][_0xcd68('0x12')]);}else{logger[_0xcd68('0xd')](_0xcd68('0x11'),_0x15a7d1,_0xcd68('0xe'));_0x5e9ed5(_0x8402e7[_0xcd68('0x13')][_0xcd68('0x12')]);}})['catch'](function(_0x23bac4){logger[_0xcd68('0x10')](_0xcd68('0x11'),_0x15a7d1,_0x23bac4);_0x8a592e(_0x23bac4);});});} \ No newline at end of file +var _0xf440=['debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent'];(function(_0x2a9a68,_0x2137bd){var _0x334c78=function(_0x4065c6){while(--_0x4065c6){_0x2a9a68['push'](_0x2a9a68['shift']());}};_0x334c78(++_0x2137bd);}(_0xf440,0x1ea));var _0x0f44=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xf440[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0x0f44('0x0'));var util=require(_0x0f44('0x1'));var moment=require('moment');var BPromise=require(_0x0f44('0x2'));var rs=require(_0x0f44('0x3'));var fs=require('fs');var Redis=require(_0x0f44('0x4'));var db=require(_0x0f44('0x5'))['db'];var utils=require(_0x0f44('0x6'));var logger=require('../../config/logger')(_0x0f44('0x7'));var config=require(_0x0f44('0x8'));var jayson=require(_0x0f44('0x9'));var client=jayson[_0x0f44('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23036f,_0x25f828,_0x4b43eb){return new BPromise(function(_0x597b26,_0x3da012){return client['request'](_0x23036f,_0x4b43eb)[_0x0f44('0xb')](function(_0x5640ac){logger[_0x0f44('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0x25f828,_0x0f44('0xd'));logger[_0x0f44('0xe')](_0x0f44('0xf'),_0x25f828,_0x0f44('0xd'),JSON['stringify'](_0x5640ac));if(_0x5640ac[_0x0f44('0x10')]){if(_0x5640ac[_0x0f44('0x10')][_0x0f44('0x11')]===0x1f4){logger[_0x0f44('0x10')](_0x0f44('0x12'),_0x25f828,_0x5640ac['error'][_0x0f44('0x13')]);return _0x3da012(_0x5640ac[_0x0f44('0x10')][_0x0f44('0x13')]);}logger[_0x0f44('0x10')](_0x0f44('0x12'),_0x25f828,_0x5640ac[_0x0f44('0x10')][_0x0f44('0x13')]);return _0x597b26(_0x5640ac['error'][_0x0f44('0x13')]);}else{logger['info'](_0x0f44('0x12'),_0x25f828,_0x0f44('0xd'));_0x597b26(_0x5640ac['result'][_0x0f44('0x13')]);}})[_0x0f44('0x14')](function(_0x5bb2f2){logger[_0x0f44('0x10')](_0x0f44('0x12'),_0x25f828,_0x5bb2f2);_0x3da012(_0x5bb2f2);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 9664b9d..14c71d9 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 _0xc4af=['delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowField.controller','get','isAuthenticated','index','/:id','post','create'];(function(_0x4422d4,_0x33c198){var _0x2e63aa=function(_0x3adee7){while(--_0x3adee7){_0x4422d4['push'](_0x4422d4['shift']());}};_0x2e63aa(++_0x33c198);}(_0xc4af,0x178));var _0xfc4a=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xc4af[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0xfc4a('0x0'));var util=require(_0xfc4a('0x1'));var path=require(_0xfc4a('0x2'));var timeout=require('connect-timeout');var express=require(_0xfc4a('0x3'));var router=express[_0xfc4a('0x4')]();var fs_extra=require(_0xfc4a('0x5'));var auth=require(_0xfc4a('0x6'));var interaction=require(_0xfc4a('0x7'));var config=require('../../config/environment');var controller=require(_0xfc4a('0x8'));router[_0xfc4a('0x9')]('/',auth[_0xfc4a('0xa')](),controller[_0xfc4a('0xb')]);router[_0xfc4a('0x9')](_0xfc4a('0xc'),auth[_0xfc4a('0xa')](),controller['show']);router[_0xfc4a('0xd')]('/',auth[_0xfc4a('0xa')](),controller[_0xfc4a('0xe')]);router['put'](_0xfc4a('0xc'),auth[_0xfc4a('0xa')](),controller['update']);router[_0xfc4a('0xf')](_0xfc4a('0xc'),auth[_0xfc4a('0xa')](),controller[_0xfc4a('0x10')]);module['exports']=router; \ No newline at end of file +var _0xddc6=['get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowField.controller'];(function(_0x247d8c,_0x9e80e4){var _0x5b056f=function(_0x103159){while(--_0x103159){_0x247d8c['push'](_0x247d8c['shift']());}};_0x5b056f(++_0x9e80e4);}(_0xddc6,0x14b));var _0x6ddc=function(_0x128495,_0x25a304){_0x128495=_0x128495-0x0;var _0xcb1a0e=_0xddc6[_0x128495];return _0xcb1a0e;};'use strict';var multer=require(_0x6ddc('0x0'));var util=require(_0x6ddc('0x1'));var path=require(_0x6ddc('0x2'));var timeout=require(_0x6ddc('0x3'));var express=require('express');var router=express[_0x6ddc('0x4')]();var fs_extra=require(_0x6ddc('0x5'));var auth=require(_0x6ddc('0x6'));var interaction=require(_0x6ddc('0x7'));var config=require('../../config/environment');var controller=require(_0x6ddc('0x8'));router[_0x6ddc('0x9')]('/',auth[_0x6ddc('0xa')](),controller[_0x6ddc('0xb')]);router[_0x6ddc('0x9')](_0x6ddc('0xc'),auth[_0x6ddc('0xa')](),controller[_0x6ddc('0xd')]);router[_0x6ddc('0xe')]('/',auth[_0x6ddc('0xa')](),controller[_0x6ddc('0xf')]);router[_0x6ddc('0x10')]('/:id',auth[_0x6ddc('0xa')](),controller['update']);router[_0x6ddc('0x11')](_0x6ddc('0xc'),auth[_0x6ddc('0xa')](),controller[_0x6ddc('0x12')]);module[_0x6ddc('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 51175cc..00a3810 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 _0x651b=['customVariable','BOOLEAN','sequelize','exports','ENUM','variable','picklist','string','STRING'];(function(_0x3a7fe7,_0x21158e){var _0x5c9724=function(_0x24a9b6){while(--_0x24a9b6){_0x3a7fe7['push'](_0x3a7fe7['shift']());}};_0x5c9724(++_0x21158e);}(_0x651b,0x65));var _0xb651=function(_0x30771c,_0x5142c8){_0x30771c=_0x30771c-0x0;var _0x22530a=_0x651b[_0x30771c];return _0x22530a;};'use strict';var Sequelize=require(_0xb651('0x0'));module[_0xb651('0x1')]={'type':{'type':Sequelize[_0xb651('0x2')]('string',_0xb651('0x3'),'customVariable','keyValue',_0xb651('0x4')),'defaultValue':_0xb651('0x5')},'content':{'type':Sequelize[_0xb651('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xb651('0x2')](_0xb651('0x5'),_0xb651('0x3'),_0xb651('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xb651('0x6')]},'nameField':{'type':Sequelize[_0xb651('0x6')]},'customField':{'type':Sequelize[_0xb651('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb651('0x6')]}}; \ No newline at end of file +var _0xf86b=['string','variable','customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM'];(function(_0x45e1bb,_0x1ad811){var _0x241b64=function(_0x2d32c3){while(--_0x2d32c3){_0x45e1bb['push'](_0x45e1bb['shift']());}};_0x241b64(++_0x1ad811);}(_0xf86b,0x16e));var _0xbf86=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf86b[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xbf86('0x0'));module[_0xbf86('0x1')]={'type':{'type':Sequelize[_0xbf86('0x2')](_0xbf86('0x3'),_0xbf86('0x4'),_0xbf86('0x5'),_0xbf86('0x6'),_0xbf86('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0xbf86('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xbf86('0x2')](_0xbf86('0x3'),'variable',_0xbf86('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xbf86('0x8')]},'nameField':{'type':Sequelize[_0xbf86('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbf86('0x8')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 7e9a43e..bfa4ae4 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 _0x8632=['../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','then','destroy','sendStatus','error','stack','name','send','index','ServicenowField','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','includeAll','include','catch','show','params','rawAttributes','keys','options','find','body','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x1479fa,_0x315d83){var _0x2c13d5=function(_0x17b2d6){while(--_0x17b2d6){_0x1479fa['push'](_0x1479fa['shift']());}};_0x2c13d5(++_0x315d83);}(_0x8632,0x110));var _0x2863=function(_0x413aac,_0x5e2430){_0x413aac=_0x413aac-0x0;var _0x569b11=_0x8632[_0x413aac];return _0x569b11;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2863('0x0'));var zipdir=require(_0x2863('0x1'));var jsonpatch=require(_0x2863('0x2'));var rp=require(_0x2863('0x3'));var moment=require(_0x2863('0x4'));var BPromise=require(_0x2863('0x5'));var Mustache=require(_0x2863('0x6'));var util=require(_0x2863('0x7'));var path=require(_0x2863('0x8'));var sox=require(_0x2863('0x9'));var csv=require(_0x2863('0xa'));var ejs=require(_0x2863('0xb'));var fs=require('fs');var fs_extra=require(_0x2863('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2863('0xd'));var jsforce=require(_0x2863('0xe'));var deskjs=require(_0x2863('0xf'));var toCsv=require(_0x2863('0xa'));var querystring=require(_0x2863('0x10'));var Papa=require(_0x2863('0x11'));var Redis=require(_0x2863('0x12'));var authService=require(_0x2863('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2863('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x2863('0x15'));var config=require(_0x2863('0x16'));var licenseUtil=require(_0x2863('0x17'));var db=require(_0x2863('0x18'))['db'];function respondWithStatusCode(_0x4e75d8,_0x4847e9){_0x4847e9=_0x4847e9||0xcc;return function(_0x598625){if(_0x598625){return _0x4e75d8['sendStatus'](_0x4847e9);}return _0x4e75d8[_0x2863('0x19')](_0x4847e9)[_0x2863('0x1a')]();};}function respondWithResult(_0x3bd0c0,_0x1cfae1){_0x1cfae1=_0x1cfae1||0xc8;return function(_0x39c66f){if(_0x39c66f){return _0x3bd0c0[_0x2863('0x19')](_0x1cfae1)[_0x2863('0x1b')](_0x39c66f);}};}function respondWithFilteredResult(_0x2ad073,_0x3cab30){return function(_0x7ad770){if(_0x7ad770){var _0x3451d4=typeof _0x3cab30[_0x2863('0x1c')]===_0x2863('0x1d')&&typeof _0x3cab30[_0x2863('0x1e')]===_0x2863('0x1d');var _0x916369=_0x7ad770[_0x2863('0x1f')];var _0x1f9c41=_0x3451d4?0x0:_0x3cab30['offset'];var _0x2740f5=_0x3451d4?_0x7ad770[_0x2863('0x1f')]:_0x3cab30['offset']+_0x3cab30[_0x2863('0x1e')];var _0x16d50c;if(_0x2740f5>=_0x916369){_0x2740f5=_0x916369;_0x16d50c=0xc8;}else{_0x16d50c=0xce;}_0x2ad073[_0x2863('0x19')](_0x16d50c);return _0x2ad073[_0x2863('0x20')]('Content-Range',_0x1f9c41+'-'+_0x2740f5+'/'+_0x916369)[_0x2863('0x1b')](_0x7ad770);}return null;};}function patchUpdates(_0x1dd9d3){return function(_0x20a26f){try{jsonpatch[_0x2863('0x21')](_0x20a26f,_0x1dd9d3,!![]);}catch(_0x388f18){return BPromise[_0x2863('0x22')](_0x388f18);}return _0x20a26f['save']();};}function saveUpdates(_0x50a3fe,_0x437048){return function(_0x4f6a37){if(_0x4f6a37){return _0x4f6a37['update'](_0x50a3fe)[_0x2863('0x23')](function(_0x37e4a5){return _0x37e4a5;});}return null;};}function removeEntity(_0x36931a,_0x305ebd){return function(_0x334ccf){if(_0x334ccf){return _0x334ccf[_0x2863('0x24')]()['then'](function(){_0x36931a[_0x2863('0x19')](0xcc)[_0x2863('0x1a')]();});}};}function handleEntityNotFound(_0x1f2c56,_0x593fc2){return function(_0x3f0829){if(!_0x3f0829){_0x1f2c56[_0x2863('0x25')](0x194);}return _0x3f0829;};}function handleError(_0x17ba06,_0x16cd08){_0x16cd08=_0x16cd08||0x1f4;return function(_0x583f80){logger[_0x2863('0x26')](_0x583f80[_0x2863('0x27')]);if(_0x583f80[_0x2863('0x28')]){delete _0x583f80[_0x2863('0x28')];}_0x17ba06[_0x2863('0x19')](_0x16cd08)[_0x2863('0x29')](_0x583f80);};}exports[_0x2863('0x2a')]=function(_0x1300e0,_0x271082){var _0x13690d={},_0x1e82cf={},_0x25e1ab={'count':0x0,'rows':[]};var _0x25484d=_['map'](db[_0x2863('0x2b')]['rawAttributes'],function(_0x294842){return{'name':_0x294842[_0x2863('0x2c')],'type':_0x294842[_0x2863('0x2d')][_0x2863('0x2e')]};});_0x1e82cf[_0x2863('0x2f')]=_[_0x2863('0x30')](_0x25484d,_0x2863('0x28'));_0x1e82cf[_0x2863('0x31')]=_['keys'](_0x1300e0[_0x2863('0x31')]);_0x1e82cf[_0x2863('0x32')]=_[_0x2863('0x33')](_0x1e82cf[_0x2863('0x2f')],_0x1e82cf[_0x2863('0x31')]);_0x13690d[_0x2863('0x34')]=_[_0x2863('0x33')](_0x1e82cf[_0x2863('0x2f')],qs[_0x2863('0x35')](_0x1300e0[_0x2863('0x31')][_0x2863('0x35')]));_0x13690d['attributes']=_0x13690d['attributes'][_0x2863('0x36')]?_0x13690d['attributes']:_0x1e82cf[_0x2863('0x2f')];if(!_0x1300e0[_0x2863('0x31')][_0x2863('0x37')](_0x2863('0x38'))){_0x13690d['limit']=qs[_0x2863('0x1e')](_0x1300e0['query'][_0x2863('0x1e')]);_0x13690d[_0x2863('0x1c')]=qs[_0x2863('0x1c')](_0x1300e0[_0x2863('0x31')][_0x2863('0x1c')]);}_0x13690d['order']=qs['sort'](_0x1300e0[_0x2863('0x31')][_0x2863('0x39')]);_0x13690d[_0x2863('0x3a')]=qs[_0x2863('0x32')](_[_0x2863('0x3b')](_0x1300e0[_0x2863('0x31')],_0x1e82cf[_0x2863('0x32')]),_0x25484d);if(_0x1300e0[_0x2863('0x31')]['filter']){_0x13690d[_0x2863('0x3a')]=_[_0x2863('0x3c')](_0x13690d['where'],{'$or':_[_0x2863('0x30')](_0x25484d,function(_0x3bd04d){if(_0x3bd04d[_0x2863('0x2d')]!==_0x2863('0x3d')){var _0x425b53={};_0x425b53[_0x3bd04d[_0x2863('0x28')]]={'$like':'%'+_0x1300e0[_0x2863('0x31')]['filter']+'%'};return _0x425b53;}})});}_0x13690d=_[_0x2863('0x3c')]({},_0x13690d,_0x1300e0['options']);var _0x227b98={'where':_0x13690d[_0x2863('0x3a')]};return db[_0x2863('0x2b')][_0x2863('0x1f')](_0x227b98)[_0x2863('0x23')](function(_0x599445){_0x25e1ab[_0x2863('0x1f')]=_0x599445;if(_0x1300e0['query'][_0x2863('0x3e')]){_0x13690d[_0x2863('0x3f')]=[{'all':!![]}];}return db[_0x2863('0x2b')]['findAll'](_0x13690d);})[_0x2863('0x23')](function(_0x47809e){_0x25e1ab['rows']=_0x47809e;return _0x25e1ab;})[_0x2863('0x23')](respondWithFilteredResult(_0x271082,_0x13690d))[_0x2863('0x40')](handleError(_0x271082,null));};exports[_0x2863('0x41')]=function(_0xf37649,_0x405405){var _0x1ad62b={'raw':!![],'where':{'id':_0xf37649[_0x2863('0x42')]['id']}},_0x543e78={};_0x543e78[_0x2863('0x2f')]=_['keys'](db['ServicenowField'][_0x2863('0x43')]);_0x543e78[_0x2863('0x31')]=_[_0x2863('0x44')](_0xf37649[_0x2863('0x31')]);_0x543e78['filters']=_[_0x2863('0x33')](_0x543e78[_0x2863('0x2f')],_0x543e78[_0x2863('0x31')]);_0x1ad62b[_0x2863('0x34')]=_['intersection'](_0x543e78['model'],qs[_0x2863('0x35')](_0xf37649[_0x2863('0x31')][_0x2863('0x35')]));_0x1ad62b[_0x2863('0x34')]=_0x1ad62b[_0x2863('0x34')]['length']?_0x1ad62b['attributes']:_0x543e78[_0x2863('0x2f')];if(_0xf37649[_0x2863('0x31')][_0x2863('0x3e')]){_0x1ad62b['include']=[{'all':!![]}];}_0x1ad62b=_[_0x2863('0x3c')]({},_0x1ad62b,_0xf37649[_0x2863('0x45')]);return db[_0x2863('0x2b')][_0x2863('0x46')](_0x1ad62b)[_0x2863('0x23')](handleEntityNotFound(_0x405405,null))['then'](respondWithResult(_0x405405,null))[_0x2863('0x40')](handleError(_0x405405,null));};exports['create']=function(_0x2976d3,_0x507a3b){return db[_0x2863('0x2b')]['create'](_0x2976d3[_0x2863('0x47')],{})[_0x2863('0x23')](respondWithResult(_0x507a3b,0xc9))[_0x2863('0x40')](handleError(_0x507a3b,null));};exports[_0x2863('0x48')]=function(_0x15903a,_0x2353e2){if(_0x15903a[_0x2863('0x47')]['id']){delete _0x15903a['body']['id'];}return db['ServicenowField'][_0x2863('0x46')]({'where':{'id':_0x15903a['params']['id']}})[_0x2863('0x23')](handleEntityNotFound(_0x2353e2,null))[_0x2863('0x23')](saveUpdates(_0x15903a[_0x2863('0x47')],null))[_0x2863('0x23')](respondWithResult(_0x2353e2,null))[_0x2863('0x40')](handleError(_0x2353e2,null));};exports[_0x2863('0x24')]=function(_0x25ac2d,_0x16d113){return db[_0x2863('0x2b')]['find']({'where':{'id':_0x25ac2d[_0x2863('0x42')]['id']}})['then'](handleEntityNotFound(_0x16d113,null))[_0x2863('0x23')](removeEntity(_0x16d113,null))[_0x2863('0x40')](handleError(_0x16d113,null));}; \ No newline at end of file +var _0x2e8a=['name','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','include','rows','catch','params','options','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','set','reject','save','update','then','end','stack','send','index','map','ServicenowField','rawAttributes','fieldName','type','key'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0x2e8a,0x199));var _0xa2e8=function(_0x2ceedb,_0x3d4af3){_0x2ceedb=_0x2ceedb-0x0;var _0x1eef5c=_0x2e8a[_0x2ceedb];return _0x1eef5c;};'use strict';var emlformat=require(_0xa2e8('0x0'));var rimraf=require(_0xa2e8('0x1'));var zipdir=require(_0xa2e8('0x2'));var jsonpatch=require(_0xa2e8('0x3'));var rp=require('request-promise');var moment=require(_0xa2e8('0x4'));var BPromise=require(_0xa2e8('0x5'));var Mustache=require(_0xa2e8('0x6'));var util=require(_0xa2e8('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xa2e8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa2e8('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa2e8('0x9'));var authService=require(_0xa2e8('0xa'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa2e8('0xb'));var logger=require(_0xa2e8('0xc'))(_0xa2e8('0xd'));var utils=require(_0xa2e8('0xe'));var config=require('../../config/environment');var licenseUtil=require(_0xa2e8('0xf'));var db=require(_0xa2e8('0x10'))['db'];function respondWithStatusCode(_0x5bf09d,_0x271a8a){_0x271a8a=_0x271a8a||0xcc;return function(_0x5c757d){if(_0x5c757d){return _0x5bf09d[_0xa2e8('0x11')](_0x271a8a);}return _0x5bf09d[_0xa2e8('0x12')](_0x271a8a)['end']();};}function respondWithResult(_0x200633,_0x407aa0){_0x407aa0=_0x407aa0||0xc8;return function(_0x40ac91){if(_0x40ac91){return _0x200633['status'](_0x407aa0)[_0xa2e8('0x13')](_0x40ac91);}};}function respondWithFilteredResult(_0x1df3f1,_0x120401){return function(_0x30aaad){if(_0x30aaad){var _0x51fec5=typeof _0x120401['offset']===_0xa2e8('0x14')&&typeof _0x120401[_0xa2e8('0x15')]===_0xa2e8('0x14');var _0x3439b2=_0x30aaad['count'];var _0x355687=_0x51fec5?0x0:_0x120401[_0xa2e8('0x16')];var _0x16f320=_0x51fec5?_0x30aaad[_0xa2e8('0x17')]:_0x120401['offset']+_0x120401[_0xa2e8('0x15')];var _0xfbc5f6;if(_0x16f320>=_0x3439b2){_0x16f320=_0x3439b2;_0xfbc5f6=0xc8;}else{_0xfbc5f6=0xce;}_0x1df3f1[_0xa2e8('0x12')](_0xfbc5f6);return _0x1df3f1[_0xa2e8('0x18')]('Content-Range',_0x355687+'-'+_0x16f320+'/'+_0x3439b2)[_0xa2e8('0x13')](_0x30aaad);}return null;};}function patchUpdates(_0x37c146){return function(_0x26fd01){try{jsonpatch['apply'](_0x26fd01,_0x37c146,!![]);}catch(_0x171704){return BPromise[_0xa2e8('0x19')](_0x171704);}return _0x26fd01[_0xa2e8('0x1a')]();};}function saveUpdates(_0xbe4393,_0x48b731){return function(_0x113933){if(_0x113933){return _0x113933[_0xa2e8('0x1b')](_0xbe4393)['then'](function(_0x4eb542){return _0x4eb542;});}return null;};}function removeEntity(_0xfee5ce,_0xc668b5){return function(_0x231de1){if(_0x231de1){return _0x231de1['destroy']()[_0xa2e8('0x1c')](function(){_0xfee5ce[_0xa2e8('0x12')](0xcc)[_0xa2e8('0x1d')]();});}};}function handleEntityNotFound(_0x1f2b45,_0x5548f2){return function(_0x1816ec){if(!_0x1816ec){_0x1f2b45[_0xa2e8('0x11')](0x194);}return _0x1816ec;};}function handleError(_0x2bed05,_0x2fd597){_0x2fd597=_0x2fd597||0x1f4;return function(_0x18dd2b){logger['error'](_0x18dd2b[_0xa2e8('0x1e')]);if(_0x18dd2b['name']){delete _0x18dd2b['name'];}_0x2bed05[_0xa2e8('0x12')](_0x2fd597)[_0xa2e8('0x1f')](_0x18dd2b);};}exports[_0xa2e8('0x20')]=function(_0x1a6630,_0x6923){var _0x4d3309={},_0x5d685d={},_0xa36123={'count':0x0,'rows':[]};var _0xabb9ff=_[_0xa2e8('0x21')](db[_0xa2e8('0x22')][_0xa2e8('0x23')],function(_0x5ce010){return{'name':_0x5ce010[_0xa2e8('0x24')],'type':_0x5ce010[_0xa2e8('0x25')][_0xa2e8('0x26')]};});_0x5d685d['model']=_[_0xa2e8('0x21')](_0xabb9ff,_0xa2e8('0x27'));_0x5d685d[_0xa2e8('0x28')]=_[_0xa2e8('0x29')](_0x1a6630[_0xa2e8('0x28')]);_0x5d685d[_0xa2e8('0x2a')]=_[_0xa2e8('0x2b')](_0x5d685d['model'],_0x5d685d[_0xa2e8('0x28')]);_0x4d3309[_0xa2e8('0x2c')]=_[_0xa2e8('0x2b')](_0x5d685d[_0xa2e8('0x2d')],qs[_0xa2e8('0x2e')](_0x1a6630[_0xa2e8('0x28')][_0xa2e8('0x2e')]));_0x4d3309[_0xa2e8('0x2c')]=_0x4d3309[_0xa2e8('0x2c')][_0xa2e8('0x2f')]?_0x4d3309['attributes']:_0x5d685d[_0xa2e8('0x2d')];if(!_0x1a6630[_0xa2e8('0x28')][_0xa2e8('0x30')]('nolimit')){_0x4d3309[_0xa2e8('0x15')]=qs[_0xa2e8('0x15')](_0x1a6630[_0xa2e8('0x28')][_0xa2e8('0x15')]);_0x4d3309[_0xa2e8('0x16')]=qs[_0xa2e8('0x16')](_0x1a6630[_0xa2e8('0x28')][_0xa2e8('0x16')]);}_0x4d3309[_0xa2e8('0x31')]=qs['sort'](_0x1a6630[_0xa2e8('0x28')][_0xa2e8('0x32')]);_0x4d3309[_0xa2e8('0x33')]=qs[_0xa2e8('0x2a')](_[_0xa2e8('0x34')](_0x1a6630[_0xa2e8('0x28')],_0x5d685d[_0xa2e8('0x2a')]),_0xabb9ff);if(_0x1a6630[_0xa2e8('0x28')][_0xa2e8('0x35')]){_0x4d3309['where']=_['merge'](_0x4d3309[_0xa2e8('0x33')],{'$or':_[_0xa2e8('0x21')](_0xabb9ff,function(_0x2fa77c){if(_0x2fa77c[_0xa2e8('0x25')]!==_0xa2e8('0x36')){var _0x532f6f={};_0x532f6f[_0x2fa77c[_0xa2e8('0x27')]]={'$like':'%'+_0x1a6630['query'][_0xa2e8('0x35')]+'%'};return _0x532f6f;}})});}_0x4d3309=_[_0xa2e8('0x37')]({},_0x4d3309,_0x1a6630['options']);var _0x2a57bb={'where':_0x4d3309[_0xa2e8('0x33')]};return db[_0xa2e8('0x22')][_0xa2e8('0x17')](_0x2a57bb)[_0xa2e8('0x1c')](function(_0x25dc52){_0xa36123[_0xa2e8('0x17')]=_0x25dc52;if(_0x1a6630[_0xa2e8('0x28')]['includeAll']){_0x4d3309[_0xa2e8('0x38')]=[{'all':!![]}];}return db[_0xa2e8('0x22')]['findAll'](_0x4d3309);})['then'](function(_0x84434c){_0xa36123[_0xa2e8('0x39')]=_0x84434c;return _0xa36123;})[_0xa2e8('0x1c')](respondWithFilteredResult(_0x6923,_0x4d3309))[_0xa2e8('0x3a')](handleError(_0x6923,null));};exports['show']=function(_0x3686f0,_0x175fac){var _0x54fc9d={'raw':!![],'where':{'id':_0x3686f0[_0xa2e8('0x3b')]['id']}},_0x4b0546={};_0x4b0546[_0xa2e8('0x2d')]=_['keys'](db[_0xa2e8('0x22')]['rawAttributes']);_0x4b0546['query']=_[_0xa2e8('0x29')](_0x3686f0['query']);_0x4b0546[_0xa2e8('0x2a')]=_[_0xa2e8('0x2b')](_0x4b0546[_0xa2e8('0x2d')],_0x4b0546[_0xa2e8('0x28')]);_0x54fc9d[_0xa2e8('0x2c')]=_[_0xa2e8('0x2b')](_0x4b0546[_0xa2e8('0x2d')],qs[_0xa2e8('0x2e')](_0x3686f0[_0xa2e8('0x28')][_0xa2e8('0x2e')]));_0x54fc9d[_0xa2e8('0x2c')]=_0x54fc9d[_0xa2e8('0x2c')][_0xa2e8('0x2f')]?_0x54fc9d['attributes']:_0x4b0546['model'];if(_0x3686f0[_0xa2e8('0x28')]['includeAll']){_0x54fc9d[_0xa2e8('0x38')]=[{'all':!![]}];}_0x54fc9d=_[_0xa2e8('0x37')]({},_0x54fc9d,_0x3686f0[_0xa2e8('0x3c')]);return db[_0xa2e8('0x22')]['find'](_0x54fc9d)['then'](handleEntityNotFound(_0x175fac,null))[_0xa2e8('0x1c')](respondWithResult(_0x175fac,null))[_0xa2e8('0x3a')](handleError(_0x175fac,null));};exports['create']=function(_0x5d4ae1,_0x19bb8c){return db[_0xa2e8('0x22')][_0xa2e8('0x3d')](_0x5d4ae1['body'],{})[_0xa2e8('0x1c')](respondWithResult(_0x19bb8c,0xc9))[_0xa2e8('0x3a')](handleError(_0x19bb8c,null));};exports['update']=function(_0x5643ff,_0x37e56a){if(_0x5643ff[_0xa2e8('0x3e')]['id']){delete _0x5643ff[_0xa2e8('0x3e')]['id'];}return db[_0xa2e8('0x22')][_0xa2e8('0x3f')]({'where':{'id':_0x5643ff[_0xa2e8('0x3b')]['id']}})[_0xa2e8('0x1c')](handleEntityNotFound(_0x37e56a,null))[_0xa2e8('0x1c')](saveUpdates(_0x5643ff[_0xa2e8('0x3e')],null))[_0xa2e8('0x1c')](respondWithResult(_0x37e56a,null))[_0xa2e8('0x3a')](handleError(_0x37e56a,null));};exports['destroy']=function(_0x235c21,_0x22bdad){return db[_0xa2e8('0x22')][_0xa2e8('0x3f')]({'where':{'id':_0x235c21[_0xa2e8('0x3b')]['id']}})['then'](handleEntityNotFound(_0x22bdad,null))['then'](removeEntity(_0x22bdad,null))[_0xa2e8('0x3a')](handleError(_0x22bdad,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 843149c..4a36ff2 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 _0x1c46=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','ServicenowField','servicenow_unique_index','FieldId','lodash','util'];(function(_0x29dfba,_0xec8431){var _0x33d425=function(_0x5da0af){while(--_0x5da0af){_0x29dfba['push'](_0x29dfba['shift']());}};_0x33d425(++_0xec8431);}(_0x1c46,0x132));var _0x61c4=function(_0x394681,_0x366928){_0x394681=_0x394681-0x0;var _0x24e3e1=_0x1c46[_0x394681];return _0x24e3e1;};'use strict';var _=require(_0x61c4('0x0'));var util=require(_0x61c4('0x1'));var logger=require(_0x61c4('0x2'))(_0x61c4('0x3'));var moment=require(_0x61c4('0x4'));var BPromise=require(_0x61c4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x61c4('0x6'));var rimraf=require(_0x61c4('0x7'));var config=require(_0x61c4('0x8'));var attributes=require(_0x61c4('0x9'));module[_0x61c4('0xa')]=function(_0x2ee98d,_0x2776a4){return _0x2ee98d['define'](_0x61c4('0xb'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x61c4('0xc'),'fields':['idField',_0x61c4('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd477=['FieldId','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','ServicenowField','servicenow_unique_index'];(function(_0x173060,_0xf5ad1){var _0x122cad=function(_0x10a570){while(--_0x10a570){_0x173060['push'](_0x173060['shift']());}};_0x122cad(++_0xf5ad1);}(_0xd477,0x1bb));var _0x7d47=function(_0x28294a,_0x542642){_0x28294a=_0x28294a-0x0;var _0x3bef7d=_0xd477[_0x28294a];return _0x3bef7d;};'use strict';var _=require(_0x7d47('0x0'));var util=require('util');var logger=require(_0x7d47('0x1'))('api');var moment=require(_0x7d47('0x2'));var BPromise=require(_0x7d47('0x3'));var rp=require(_0x7d47('0x4'));var fs=require('fs');var path=require(_0x7d47('0x5'));var rimraf=require(_0x7d47('0x6'));var config=require(_0x7d47('0x7'));var attributes=require(_0x7d47('0x8'));module[_0x7d47('0x9')]=function(_0x21b13a,_0x5548f4){return _0x21b13a['define'](_0x7d47('0xa'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x7d47('0xb'),'fields':['idField',_0x7d47('0xc')],'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 ddd0d3f..d8d6de3 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 _0xf4eb=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x2afc4c,_0x9e22c7){var _0x28ab34=function(_0x360995){while(--_0x360995){_0x2afc4c['push'](_0x2afc4c['shift']());}};_0x28ab34(++_0x9e22c7);}(_0xf4eb,0xec));var _0xbf4e=function(_0x37b3c7,_0x473e1d){_0x37b3c7=_0x37b3c7-0x0;var _0x58ab6c=_0xf4eb[_0x37b3c7];return _0x58ab6c;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('ServicenowField,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file +var _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x5c7939,_0x22f61e){var _0x5bcfbc=function(_0x80c86){while(--_0x80c86){_0x5c7939['push'](_0x5c7939['shift']());}};_0x5bcfbc(++_0x22f61e);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index c093c88..76d2b50 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(_0x150033,_0x54b089){var _0x122b82=function(_0x4142cb){while(--_0x4142cb){_0x150033['push'](_0x150033['shift']());}};_0x122b82(++_0x54b089);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x118f43,_0x3db25a){var _0x3109ea=function(_0x457bfc){while(--_0x457bfc){_0x118f43['push'](_0x118f43['shift']());}};_0x3109ea(++_0x3db25a);}(_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/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index e68699f..aa9fc71 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(_0x3496b9,_0x57b95f){var _0x2887dc=function(_0x2f83c5){while(--_0x2f83c5){_0x3496b9['push'](_0x3496b9['shift']());}};_0x2887dc(++_0x57b95f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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(_0x542d8d,_0x293852){var _0x353ee9=function(_0x29769b){while(--_0x29769b){_0x542d8d['push'](_0x542d8d['shift']());}};_0x353ee9(++_0x293852);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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 f0ed511..15a7276 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 _0xcc2e=['../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','filter','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','getConfigurations','findOne','SugarcrmConfiguration','order','options','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_type','parent_name','direction','username','password','remoteUri','slice','lastIndexOf','POST','%s%s','/service/v4_1/rest.php','JSON','stringify','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','format','get_module_fields','values','includes','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x25bdc0,_0x32ffc4){var _0x4cec2d=function(_0x485929){while(--_0x485929){_0x25bdc0['push'](_0x25bdc0['shift']());}};_0x4cec2d(++_0x32ffc4);}(_0xcc2e,0xdd));var _0xecc2=function(_0x3c2352,_0x2205d3){_0x3c2352=_0x3c2352-0x0;var _0x15bb7d=_0xcc2e[_0x3c2352];return _0x15bb7d;};'use strict';var emlformat=require(_0xecc2('0x0'));var rimraf=require(_0xecc2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xecc2('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xecc2('0x3'));var Mustache=require(_0xecc2('0x4'));var util=require(_0xecc2('0x5'));var path=require(_0xecc2('0x6'));var sox=require(_0xecc2('0x7'));var csv=require(_0xecc2('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xecc2('0x9'));var squel=require(_0xecc2('0xa'));var crypto=require(_0xecc2('0xb'));var jsforce=require(_0xecc2('0xc'));var deskjs=require(_0xecc2('0xd'));var toCsv=require('to-csv');var querystring=require(_0xecc2('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xecc2('0xf'));var as=require(_0xecc2('0x10'));var hardwareService=require(_0xecc2('0x11'));var logger=require(_0xecc2('0x12'))(_0xecc2('0x13'));var utils=require(_0xecc2('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xecc2('0x15'));var db=require(_0xecc2('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x347ead,_0x35c90e){_0x35c90e=_0x35c90e||0xcc;return function(_0xb29a50){if(_0xb29a50){return _0x347ead['sendStatus'](_0x35c90e);}return _0x347ead[_0xecc2('0x17')](_0x35c90e)[_0xecc2('0x18')]();};}function respondWithResult(_0xc3e430,_0x16867c){_0x16867c=_0x16867c||0xc8;return function(_0x4657b5){if(_0x4657b5){return _0xc3e430['status'](_0x16867c)[_0xecc2('0x19')](_0x4657b5);}};}function respondWithFilteredResult(_0x3e96ec,_0x286869){return function(_0x117a94){if(_0x117a94){var _0x28ff74=typeof _0x286869[_0xecc2('0x1a')]==='undefined'&&typeof _0x286869[_0xecc2('0x1b')]===_0xecc2('0x1c');var _0x5c5bb0=_0x117a94['count'];var _0x5bc598=_0x28ff74?0x0:_0x286869[_0xecc2('0x1a')];var _0x36ac06=_0x28ff74?_0x117a94[_0xecc2('0x1d')]:_0x286869[_0xecc2('0x1a')]+_0x286869[_0xecc2('0x1b')];var _0x2a569c;if(_0x36ac06>=_0x5c5bb0){_0x36ac06=_0x5c5bb0;_0x2a569c=0xc8;}else{_0x2a569c=0xce;}_0x3e96ec['status'](_0x2a569c);return _0x3e96ec[_0xecc2('0x1e')](_0xecc2('0x1f'),_0x5bc598+'-'+_0x36ac06+'/'+_0x5c5bb0)[_0xecc2('0x19')](_0x117a94);}return null;};}function patchUpdates(_0x9d0068){return function(_0xc61661){try{jsonpatch[_0xecc2('0x20')](_0xc61661,_0x9d0068,!![]);}catch(_0x49f19c){return BPromise[_0xecc2('0x21')](_0x49f19c);}return _0xc61661[_0xecc2('0x22')]();};}function saveUpdates(_0x563a7b,_0x4f01d0){return function(_0x333a60){if(_0x333a60){return _0x333a60[_0xecc2('0x23')](_0x563a7b)[_0xecc2('0x24')](function(_0x3a23c3){return _0x3a23c3;});}return null;};}function removeEntity(_0x285d4f,_0x1d18fe){return function(_0x2a60aa){if(_0x2a60aa){return _0x2a60aa[_0xecc2('0x25')]()[_0xecc2('0x24')](function(){_0x285d4f[_0xecc2('0x17')](0xcc)[_0xecc2('0x18')]();});}};}function handleEntityNotFound(_0x5054f4,_0x277413){return function(_0x5e0501){if(!_0x5e0501){_0x5054f4[_0xecc2('0x26')](0x194);}return _0x5e0501;};}function handleError(_0x5e422a,_0x33eb11){_0x33eb11=_0x33eb11||0x1f4;return function(_0x1870e2){logger[_0xecc2('0x27')](_0x1870e2[_0xecc2('0x28')]);if(_0x1870e2[_0xecc2('0x29')]){delete _0x1870e2['name'];}_0x5e422a[_0xecc2('0x17')](_0x33eb11)[_0xecc2('0x2a')](_0x1870e2);};}exports[_0xecc2('0x2b')]=function(_0x2873ed,_0x29b6a3){var _0x2b8d71={},_0x2a9b46={},_0xa831da={'count':0x0,'rows':[]};var _0x5ba4ee=_[_0xecc2('0x2c')](db[_0xecc2('0x2d')][_0xecc2('0x2e')],function(_0x285824){return{'name':_0x285824[_0xecc2('0x2f')],'type':_0x285824[_0xecc2('0x30')][_0xecc2('0x31')]};});_0x2a9b46[_0xecc2('0x32')]=_['map'](_0x5ba4ee,'name');_0x2a9b46[_0xecc2('0x33')]=_['keys'](_0x2873ed[_0xecc2('0x33')]);_0x2a9b46['filters']=_[_0xecc2('0x34')](_0x2a9b46[_0xecc2('0x32')],_0x2a9b46[_0xecc2('0x33')]);_0x2b8d71[_0xecc2('0x35')]=_['intersection'](_0x2a9b46['model'],qs[_0xecc2('0x36')](_0x2873ed[_0xecc2('0x33')][_0xecc2('0x36')]));_0x2b8d71['attributes']=_0x2b8d71[_0xecc2('0x35')][_0xecc2('0x37')]?_0x2b8d71['attributes']:_0x2a9b46['model'];if(!_0x2873ed['query'][_0xecc2('0x38')](_0xecc2('0x39'))){_0x2b8d71[_0xecc2('0x1b')]=qs[_0xecc2('0x1b')](_0x2873ed['query']['limit']);_0x2b8d71['offset']=qs[_0xecc2('0x1a')](_0x2873ed[_0xecc2('0x33')]['offset']);}_0x2b8d71['order']=qs['sort'](_0x2873ed[_0xecc2('0x33')][_0xecc2('0x3a')]);_0x2b8d71[_0xecc2('0x3b')]=qs[_0xecc2('0x3c')](_[_0xecc2('0x3d')](_0x2873ed['query'],_0x2a9b46[_0xecc2('0x3c')]),_0x5ba4ee);if(_0x2873ed[_0xecc2('0x33')]['filter']){_0x2b8d71[_0xecc2('0x3b')]=_[_0xecc2('0x3e')](_0x2b8d71['where'],{'$or':_[_0xecc2('0x2c')](_0x5ba4ee,function(_0x408569){if(_0x408569[_0xecc2('0x30')]!=='VIRTUAL'){var _0x42f858={};_0x42f858[_0x408569[_0xecc2('0x29')]]={'$like':'%'+_0x2873ed[_0xecc2('0x33')][_0xecc2('0x3f')]+'%'};return _0x42f858;}})});}_0x2b8d71=_['merge']({},_0x2b8d71,_0x2873ed['options']);var _0x87f1dd={'where':_0x2b8d71['where']};return db[_0xecc2('0x2d')][_0xecc2('0x1d')](_0x87f1dd)['then'](function(_0x5e7870){_0xa831da['count']=_0x5e7870;if(_0x2873ed[_0xecc2('0x33')][_0xecc2('0x40')]){_0x2b8d71[_0xecc2('0x41')]=[{'all':!![]}];}return db[_0xecc2('0x2d')][_0xecc2('0x42')](_0x2b8d71);})[_0xecc2('0x24')](function(_0x2d87bb){_0xa831da[_0xecc2('0x43')]=_0x2d87bb;return _0xa831da;})['then'](respondWithFilteredResult(_0x29b6a3,_0x2b8d71))['catch'](handleError(_0x29b6a3,null));};exports[_0xecc2('0x44')]=function(_0x5dd17b,_0x563204){var _0x5ba489={'raw':![],'where':{'id':_0x5dd17b[_0xecc2('0x45')]['id']}},_0x37c704={};_0x37c704['model']=_['keys'](db[_0xecc2('0x2d')][_0xecc2('0x2e')]);_0x37c704[_0xecc2('0x33')]=_[_0xecc2('0x46')](_0x5dd17b[_0xecc2('0x33')]);_0x37c704[_0xecc2('0x3c')]=_['intersection'](_0x37c704[_0xecc2('0x32')],_0x37c704['query']);_0x5ba489['attributes']=_['intersection'](_0x37c704[_0xecc2('0x32')],qs['fields'](_0x5dd17b[_0xecc2('0x33')]['fields']));_0x5ba489[_0xecc2('0x35')]=_0x5ba489[_0xecc2('0x35')][_0xecc2('0x37')]?_0x5ba489['attributes']:_0x37c704[_0xecc2('0x32')];if(_0x5dd17b[_0xecc2('0x33')][_0xecc2('0x40')]){_0x5ba489['include']=[{'all':!![]}];}_0x5ba489=_[_0xecc2('0x3e')]({},_0x5ba489,_0x5dd17b['options']);return db[_0xecc2('0x2d')][_0xecc2('0x47')](_0x5ba489)[_0xecc2('0x24')](handleEntityNotFound(_0x563204,null))['then'](respondWithResult(_0x563204,null))[_0xecc2('0x48')](handleError(_0x563204,null));};exports[_0xecc2('0x49')]=function(_0xe54fff,_0x173f2a){return db[_0xecc2('0x2d')][_0xecc2('0x49')](_0xe54fff[_0xecc2('0x4a')],{})['then'](respondWithResult(_0x173f2a,0xc9))[_0xecc2('0x48')](handleError(_0x173f2a,null));};exports['update']=function(_0x3251e3,_0xfa6d8f){if(_0x3251e3[_0xecc2('0x4a')]['id']){delete _0x3251e3[_0xecc2('0x4a')]['id'];}return db[_0xecc2('0x2d')][_0xecc2('0x47')]({'where':{'id':_0x3251e3[_0xecc2('0x45')]['id']}})['then'](handleEntityNotFound(_0xfa6d8f,null))[_0xecc2('0x24')](saveUpdates(_0x3251e3[_0xecc2('0x4a')],null))['then'](respondWithResult(_0xfa6d8f,null))[_0xecc2('0x48')](handleError(_0xfa6d8f,null));};exports[_0xecc2('0x25')]=function(_0x41141d,_0x29c09b){return db[_0xecc2('0x2d')]['find']({'where':{'id':_0x41141d[_0xecc2('0x45')]['id']}})[_0xecc2('0x24')](handleEntityNotFound(_0x29c09b,null))[_0xecc2('0x24')](removeEntity(_0x29c09b,null))[_0xecc2('0x48')](handleError(_0x29c09b,null));};exports[_0xecc2('0x4b')]=function(_0x53d709,_0x2052ab,_0x55711f){var _0xead6e3={};var _0x42a1c4={};var _0x2bf746;var _0x4a9cf4;return db[_0xecc2('0x2d')][_0xecc2('0x4c')]({'where':{'id':_0x53d709[_0xecc2('0x45')]['id']}})[_0xecc2('0x24')](handleEntityNotFound(_0x2052ab,null))[_0xecc2('0x24')](function(_0x36ce15){if(_0x36ce15){_0x2bf746=_0x36ce15;_0x42a1c4[_0xecc2('0x32')]=_[_0xecc2('0x46')](db[_0xecc2('0x4d')][_0xecc2('0x2e')]);_0x42a1c4['query']=_[_0xecc2('0x46')](_0x53d709[_0xecc2('0x33')]);_0x42a1c4[_0xecc2('0x3c')]=_[_0xecc2('0x34')](_0x42a1c4[_0xecc2('0x32')],_0x42a1c4[_0xecc2('0x33')]);_0xead6e3[_0xecc2('0x35')]=_['intersection'](_0x42a1c4['model'],qs[_0xecc2('0x36')](_0x53d709[_0xecc2('0x33')][_0xecc2('0x36')]));_0xead6e3[_0xecc2('0x35')]=_0xead6e3[_0xecc2('0x35')][_0xecc2('0x37')]?_0xead6e3['attributes']:_0x42a1c4[_0xecc2('0x32')];_0xead6e3[_0xecc2('0x4e')]=qs['sort'](_0x53d709[_0xecc2('0x33')][_0xecc2('0x3a')]);_0xead6e3['where']=qs[_0xecc2('0x3c')](_['pick'](_0x53d709[_0xecc2('0x33')],_0x42a1c4[_0xecc2('0x3c')]));if(_0x53d709[_0xecc2('0x33')]['filter']){_0xead6e3[_0xecc2('0x3b')]=_[_0xecc2('0x3e')](_0xead6e3[_0xecc2('0x3b')],{'$or':_[_0xecc2('0x2c')](_0xead6e3[_0xecc2('0x35')],function(_0x4fc3c0){var _0x48eaad={};_0x48eaad[_0x4fc3c0]={'$like':'%'+_0x53d709[_0xecc2('0x33')][_0xecc2('0x3f')]+'%'};return _0x48eaad;})});}_0xead6e3=_[_0xecc2('0x3e')]({},_0xead6e3,_0x53d709[_0xecc2('0x4f')]);return _0x2bf746[_0xecc2('0x4b')](_0xead6e3);}})[_0xecc2('0x24')](function(_0x4d01ce){if(_0x4d01ce){_0x4a9cf4=_0x4d01ce[_0xecc2('0x37')];if(!_0x53d709[_0xecc2('0x33')]['hasOwnProperty'](_0xecc2('0x39'))){_0xead6e3[_0xecc2('0x1b')]=qs['limit'](_0x53d709[_0xecc2('0x33')][_0xecc2('0x1b')]);_0xead6e3[_0xecc2('0x1a')]=qs['offset'](_0x53d709[_0xecc2('0x33')][_0xecc2('0x1a')]);}return _0x2bf746[_0xecc2('0x4b')](_0xead6e3);}})[_0xecc2('0x24')](function(_0x419e61){if(_0x419e61){return _0x419e61?{'count':_0x4a9cf4,'rows':_0x419e61}:null;}})['then'](respondWithResult(_0x2052ab,null))[_0xecc2('0x48')](handleError(_0x2052ab,null));};exports[_0xecc2('0x50')]=function(_0x184f6a,_0x54cd20,_0x2fb341){if(_0x184f6a[_0xecc2('0x4a')]['id']){delete _0x184f6a[_0xecc2('0x4a')]['id'];}return db[_0xecc2('0x2d')][_0xecc2('0x4c')]({'where':{'id':_0x184f6a[_0xecc2('0x45')]['id']}})['then'](handleEntityNotFound(_0x54cd20,null))['then'](function(_0x4db416){if(_0x4db416){_0x184f6a['body'][_0xecc2('0x51')]=_0x4db416['id'];_0x184f6a[_0xecc2('0x4a')]['Subjects']=integrations[_0xecc2('0x52')](_0x184f6a[_0xecc2('0x4a')][_0xecc2('0x53')],_0x184f6a[_0xecc2('0x4a')][_0xecc2('0x30')]);_0x184f6a[_0xecc2('0x4a')][_0xecc2('0x54')]=integrations[_0xecc2('0x55')](_0x184f6a['body']['channel'],_0x184f6a['body']['type']);return db[_0xecc2('0x4d')][_0xecc2('0x49')](_0x184f6a[_0xecc2('0x4a')],{'include':[{'model':db[_0xecc2('0x56')],'as':'Subjects'},{'model':db[_0xecc2('0x56')],'as':_0xecc2('0x54')}]});}return null;})[_0xecc2('0x24')](respondWithResult(_0x54cd20,null))[_0xecc2('0x48')](handleError(_0x54cd20,null));};exports[_0xecc2('0x57')]=function(_0x2f5339,_0x4abde4,_0x545970){var _0x5a843d='';var _0x297124=['id',_0xecc2('0x29'),_0xecc2('0x58'),_0xecc2('0x59'),_0xecc2('0x5a'),_0xecc2('0x5b'),_0xecc2('0x5c'),_0xecc2('0x5d'),'parent_id',_0xecc2('0x5e'),_0xecc2('0x5f'),_0xecc2('0x60')];return db['SugarcrmAccount']['findOne']({'where':{'id':_0x2f5339[_0xecc2('0x45')]['id']},'attributes':['id',_0xecc2('0x61'),_0xecc2('0x62'),_0xecc2('0x63')]})[_0xecc2('0x24')](handleEntityNotFound(_0x4abde4,null))['then'](function(_0x3a00eb){if(_0x3a00eb){_0x5a843d=_0x3a00eb[_0xecc2('0x63')];var _0x5e52bf=_0x5a843d[_0xecc2('0x64')](-0x1);if(_0x5e52bf==='/'){_0x5a843d=_0x5a843d['substring'](0x0,_0x5a843d[_0xecc2('0x65')](_0x5e52bf));}return rp({'method':_0xecc2('0x66'),'uri':util['format'](_0xecc2('0x67'),_0x5a843d,_0xecc2('0x68')),'json':!![],'form':{'method':'login','input_type':'JSON','response_type':_0xecc2('0x69'),'rest_data':JSON[_0xecc2('0x6a')]({'user_auth':{'user_name':_0x3a00eb[_0xecc2('0x61')],'password':_0x3a00eb[_0xecc2('0x62')],'encryption':'PLAIN'},'application':_0xecc2('0x6b')})}});}})[_0xecc2('0x24')](function(_0x34d7e4){if(_0x34d7e4&&_0x34d7e4[_0xecc2('0x29')]!==_0xecc2('0x6c')&&_0x34d7e4[_0xecc2('0x29')]!==_0xecc2('0x6d')){return rp({'method':'POST','uri':util[_0xecc2('0x6e')](_0xecc2('0x67'),_0x5a843d,_0xecc2('0x68')),'json':!![],'form':{'method':_0xecc2('0x6f'),'input_type':_0xecc2('0x69'),'response_type':_0xecc2('0x69'),'rest_data':JSON[_0xecc2('0x6a')]({'session':_0x34d7e4['id'],'module_name':'Calls'})}})['then'](function(_0x556ebf){if(_0x556ebf){var _0x2a82bf=_[_0xecc2('0x70')](_0x556ebf['module_fields']);_['remove'](_0x2a82bf,function(_0x21220a){return _0x297124[_0xecc2('0x71')](_0x21220a[_0xecc2('0x29')]);});return{'count':_0x2a82bf[_0xecc2('0x37')],'rows':_[_0xecc2('0x2c')](_0x2a82bf,function(_0x2f3ef5){return{'id':_0x2f3ef5[_0xecc2('0x29')],'name':_0x2f3ef5[_0xecc2('0x72')],'custom':_[_0xecc2('0x73')](_0x2f3ef5[_0xecc2('0x29')],'_c')?!![]:![],'options':_0x2f3ef5[_0xecc2('0x4f')]?_[_0xecc2('0x2c')](_[_0xecc2('0x70')](_0x2f3ef5[_0xecc2('0x4f')]),function(_0xdaf00c){return{'name':_0xdaf00c[_0xecc2('0x74')],'value':_0xdaf00c['name']};}):[]};})};}})['then'](respondWithResult(_0x4abde4,null))[_0xecc2('0x48')](function(_0x45ae36){var _0x4c9519=_0x2f5339['query'][_0xecc2('0x75')]?0x1f4:_0x45ae36[_0xecc2('0x76')]||0x1f4;logger[_0xecc2('0x27')](_0xecc2('0x77'),_0xecc2('0x57'),_0x4c9519,JSON[_0xecc2('0x6a')](_0x45ae36));delete _0x45ae36[_0xecc2('0x29')];if(_0x4c9519===0x191){_0x4c9519=0x190;}_0x4abde4[_0xecc2('0x17')](_0x4c9519)[_0xecc2('0x2a')](_0x2f5339[_0xecc2('0x33')]['test']?{'message':_0xecc2('0x78'),'statusCode':_0x45ae36['statusCode']}:_0x45ae36);});}else{var _0x1c548e=0x1f4;_0x4abde4['status'](_0x1c548e)[_0xecc2('0x2a')]({'message':_0xecc2('0x78'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x0235=['get_module_fields','Calls','values','module_fields','remove','includes','label','value','test','statusCode','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','params','keys','find','create','body','findOne','SugarcrmConfiguration','getConfigurations','addConfiguration','AccountId','getSubjects','channel','type','Descriptions','getDescriptions','Subjects','SugarcrmField','getFields','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','password','remoteUri','substring','lastIndexOf','format','/service/v4_1/rest.php','JSON','stringify','username','PLAIN','Invalid\x20Login','Password\x20Expired','POST','%s%s'];(function(_0x2ef8c1,_0x2f72f4){var _0x288305=function(_0x56244b){while(--_0x56244b){_0x2ef8c1['push'](_0x2ef8c1['shift']());}};_0x288305(++_0x2f72f4);}(_0x0235,0x176));var _0x5023=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x0235[_0x122096];return _0x3d1966;};'use strict';var emlformat=require(_0x5023('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5023('0x1'));var jsonpatch=require(_0x5023('0x2'));var rp=require(_0x5023('0x3'));var moment=require(_0x5023('0x4'));var BPromise=require(_0x5023('0x5'));var Mustache=require(_0x5023('0x6'));var util=require(_0x5023('0x7'));var path=require(_0x5023('0x8'));var sox=require(_0x5023('0x9'));var csv=require(_0x5023('0xa'));var ejs=require(_0x5023('0xb'));var fs=require('fs');var fs_extra=require(_0x5023('0xc'));var _=require(_0x5023('0xd'));var squel=require('squel');var crypto=require(_0x5023('0xe'));var jsforce=require(_0x5023('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x5023('0xa'));var querystring=require(_0x5023('0x10'));var Papa=require('papaparse');var Redis=require(_0x5023('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5023('0x12'));var as=require(_0x5023('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5023('0x14'))('api');var utils=require(_0x5023('0x15'));var config=require(_0x5023('0x16'));var licenseUtil=require(_0x5023('0x17'));var db=require(_0x5023('0x18'))['db'];var integrations=require(_0x5023('0x19'));function respondWithStatusCode(_0x4146a1,_0x119261){_0x119261=_0x119261||0xcc;return function(_0x496b8a){if(_0x496b8a){return _0x4146a1[_0x5023('0x1a')](_0x119261);}return _0x4146a1[_0x5023('0x1b')](_0x119261)[_0x5023('0x1c')]();};}function respondWithResult(_0x2a3b0d,_0x274e9a){_0x274e9a=_0x274e9a||0xc8;return function(_0x192f33){if(_0x192f33){return _0x2a3b0d[_0x5023('0x1b')](_0x274e9a)[_0x5023('0x1d')](_0x192f33);}};}function respondWithFilteredResult(_0x2136ab,_0x4f3f51){return function(_0x105eda){if(_0x105eda){var _0x34a6bc=typeof _0x4f3f51[_0x5023('0x1e')]===_0x5023('0x1f')&&typeof _0x4f3f51[_0x5023('0x20')]===_0x5023('0x1f');var _0x3be4a5=_0x105eda[_0x5023('0x21')];var _0x5b1513=_0x34a6bc?0x0:_0x4f3f51[_0x5023('0x1e')];var _0x4221ff=_0x34a6bc?_0x105eda[_0x5023('0x21')]:_0x4f3f51['offset']+_0x4f3f51[_0x5023('0x20')];var _0x44a151;if(_0x4221ff>=_0x3be4a5){_0x4221ff=_0x3be4a5;_0x44a151=0xc8;}else{_0x44a151=0xce;}_0x2136ab[_0x5023('0x1b')](_0x44a151);return _0x2136ab[_0x5023('0x22')](_0x5023('0x23'),_0x5b1513+'-'+_0x4221ff+'/'+_0x3be4a5)[_0x5023('0x1d')](_0x105eda);}return null;};}function patchUpdates(_0x49f65c){return function(_0x179b89){try{jsonpatch[_0x5023('0x24')](_0x179b89,_0x49f65c,!![]);}catch(_0xcc8269){return BPromise[_0x5023('0x25')](_0xcc8269);}return _0x179b89[_0x5023('0x26')]();};}function saveUpdates(_0x52ad9,_0x148c77){return function(_0x44acf3){if(_0x44acf3){return _0x44acf3[_0x5023('0x27')](_0x52ad9)['then'](function(_0x97a118){return _0x97a118;});}return null;};}function removeEntity(_0x2126da,_0x31b46d){return function(_0x4b37a9){if(_0x4b37a9){return _0x4b37a9[_0x5023('0x28')]()['then'](function(){_0x2126da[_0x5023('0x1b')](0xcc)[_0x5023('0x1c')]();});}};}function handleEntityNotFound(_0x2f95b3,_0x592f98){return function(_0x4e397f){if(!_0x4e397f){_0x2f95b3[_0x5023('0x1a')](0x194);}return _0x4e397f;};}function handleError(_0x6a707,_0x1c742b){_0x1c742b=_0x1c742b||0x1f4;return function(_0x1ef889){logger['error'](_0x1ef889['stack']);if(_0x1ef889[_0x5023('0x29')]){delete _0x1ef889[_0x5023('0x29')];}_0x6a707[_0x5023('0x1b')](_0x1c742b)[_0x5023('0x2a')](_0x1ef889);};}exports[_0x5023('0x2b')]=function(_0x216720,_0x577723){var _0x2fee4c={},_0x4cc323={},_0x497336={'count':0x0,'rows':[]};var _0x378322=_[_0x5023('0x2c')](db[_0x5023('0x2d')][_0x5023('0x2e')],function(_0x3aaf27){return{'name':_0x3aaf27[_0x5023('0x2f')],'type':_0x3aaf27['type'][_0x5023('0x30')]};});_0x4cc323[_0x5023('0x31')]=_[_0x5023('0x2c')](_0x378322,'name');_0x4cc323['query']=_['keys'](_0x216720[_0x5023('0x32')]);_0x4cc323[_0x5023('0x33')]=_['intersection'](_0x4cc323[_0x5023('0x31')],_0x4cc323[_0x5023('0x32')]);_0x2fee4c[_0x5023('0x34')]=_[_0x5023('0x35')](_0x4cc323['model'],qs[_0x5023('0x36')](_0x216720[_0x5023('0x32')][_0x5023('0x36')]));_0x2fee4c[_0x5023('0x34')]=_0x2fee4c[_0x5023('0x34')][_0x5023('0x37')]?_0x2fee4c[_0x5023('0x34')]:_0x4cc323['model'];if(!_0x216720['query'][_0x5023('0x38')](_0x5023('0x39'))){_0x2fee4c[_0x5023('0x20')]=qs[_0x5023('0x20')](_0x216720[_0x5023('0x32')][_0x5023('0x20')]);_0x2fee4c[_0x5023('0x1e')]=qs['offset'](_0x216720[_0x5023('0x32')][_0x5023('0x1e')]);}_0x2fee4c[_0x5023('0x3a')]=qs[_0x5023('0x3b')](_0x216720[_0x5023('0x32')][_0x5023('0x3b')]);_0x2fee4c['where']=qs[_0x5023('0x33')](_[_0x5023('0x3c')](_0x216720[_0x5023('0x32')],_0x4cc323[_0x5023('0x33')]),_0x378322);if(_0x216720['query'][_0x5023('0x3d')]){_0x2fee4c[_0x5023('0x3e')]=_[_0x5023('0x3f')](_0x2fee4c[_0x5023('0x3e')],{'$or':_[_0x5023('0x2c')](_0x378322,function(_0x224163){if(_0x224163['type']!==_0x5023('0x40')){var _0x5140fe={};_0x5140fe[_0x224163['name']]={'$like':'%'+_0x216720['query'][_0x5023('0x3d')]+'%'};return _0x5140fe;}})});}_0x2fee4c=_[_0x5023('0x3f')]({},_0x2fee4c,_0x216720[_0x5023('0x41')]);var _0x4490d7={'where':_0x2fee4c[_0x5023('0x3e')]};return db[_0x5023('0x2d')][_0x5023('0x21')](_0x4490d7)[_0x5023('0x42')](function(_0x5baca7){_0x497336[_0x5023('0x21')]=_0x5baca7;if(_0x216720[_0x5023('0x32')][_0x5023('0x43')]){_0x2fee4c[_0x5023('0x44')]=[{'all':!![]}];}return db[_0x5023('0x2d')][_0x5023('0x45')](_0x2fee4c);})[_0x5023('0x42')](function(_0x3ad62e){_0x497336[_0x5023('0x46')]=_0x3ad62e;return _0x497336;})[_0x5023('0x42')](respondWithFilteredResult(_0x577723,_0x2fee4c))[_0x5023('0x47')](handleError(_0x577723,null));};exports['show']=function(_0xc4273a,_0x455bee){var _0x35d77b={'raw':![],'where':{'id':_0xc4273a[_0x5023('0x48')]['id']}},_0x56aefe={};_0x56aefe[_0x5023('0x31')]=_[_0x5023('0x49')](db['SugarcrmAccount'][_0x5023('0x2e')]);_0x56aefe[_0x5023('0x32')]=_[_0x5023('0x49')](_0xc4273a['query']);_0x56aefe['filters']=_['intersection'](_0x56aefe[_0x5023('0x31')],_0x56aefe['query']);_0x35d77b[_0x5023('0x34')]=_['intersection'](_0x56aefe[_0x5023('0x31')],qs['fields'](_0xc4273a[_0x5023('0x32')][_0x5023('0x36')]));_0x35d77b[_0x5023('0x34')]=_0x35d77b['attributes'][_0x5023('0x37')]?_0x35d77b[_0x5023('0x34')]:_0x56aefe[_0x5023('0x31')];if(_0xc4273a[_0x5023('0x32')][_0x5023('0x43')]){_0x35d77b[_0x5023('0x44')]=[{'all':!![]}];}_0x35d77b=_['merge']({},_0x35d77b,_0xc4273a[_0x5023('0x41')]);return db['SugarcrmAccount'][_0x5023('0x4a')](_0x35d77b)['then'](handleEntityNotFound(_0x455bee,null))[_0x5023('0x42')](respondWithResult(_0x455bee,null))['catch'](handleError(_0x455bee,null));};exports[_0x5023('0x4b')]=function(_0x28f75d,_0x4bfe01){return db[_0x5023('0x2d')][_0x5023('0x4b')](_0x28f75d[_0x5023('0x4c')],{})[_0x5023('0x42')](respondWithResult(_0x4bfe01,0xc9))['catch'](handleError(_0x4bfe01,null));};exports['update']=function(_0x25d94d,_0xd8b232){if(_0x25d94d[_0x5023('0x4c')]['id']){delete _0x25d94d[_0x5023('0x4c')]['id'];}return db['SugarcrmAccount'][_0x5023('0x4a')]({'where':{'id':_0x25d94d['params']['id']}})[_0x5023('0x42')](handleEntityNotFound(_0xd8b232,null))['then'](saveUpdates(_0x25d94d['body'],null))[_0x5023('0x42')](respondWithResult(_0xd8b232,null))[_0x5023('0x47')](handleError(_0xd8b232,null));};exports[_0x5023('0x28')]=function(_0x6e1ec0,_0x2b4318){return db[_0x5023('0x2d')][_0x5023('0x4a')]({'where':{'id':_0x6e1ec0[_0x5023('0x48')]['id']}})[_0x5023('0x42')](handleEntityNotFound(_0x2b4318,null))['then'](removeEntity(_0x2b4318,null))[_0x5023('0x47')](handleError(_0x2b4318,null));};exports['getConfigurations']=function(_0x22de64,_0x5e29ed,_0x34f8dc){var _0x4f0ed6={};var _0x152fbd={};var _0x1c8281;var _0x17da89;return db['SugarcrmAccount'][_0x5023('0x4d')]({'where':{'id':_0x22de64['params']['id']}})[_0x5023('0x42')](handleEntityNotFound(_0x5e29ed,null))[_0x5023('0x42')](function(_0x113bd2){if(_0x113bd2){_0x1c8281=_0x113bd2;_0x152fbd[_0x5023('0x31')]=_[_0x5023('0x49')](db[_0x5023('0x4e')]['rawAttributes']);_0x152fbd[_0x5023('0x32')]=_['keys'](_0x22de64[_0x5023('0x32')]);_0x152fbd['filters']=_[_0x5023('0x35')](_0x152fbd['model'],_0x152fbd['query']);_0x4f0ed6['attributes']=_['intersection'](_0x152fbd[_0x5023('0x31')],qs[_0x5023('0x36')](_0x22de64['query'][_0x5023('0x36')]));_0x4f0ed6['attributes']=_0x4f0ed6[_0x5023('0x34')][_0x5023('0x37')]?_0x4f0ed6[_0x5023('0x34')]:_0x152fbd[_0x5023('0x31')];_0x4f0ed6[_0x5023('0x3a')]=qs[_0x5023('0x3b')](_0x22de64[_0x5023('0x32')][_0x5023('0x3b')]);_0x4f0ed6[_0x5023('0x3e')]=qs['filters'](_['pick'](_0x22de64['query'],_0x152fbd['filters']));if(_0x22de64[_0x5023('0x32')]['filter']){_0x4f0ed6['where']=_[_0x5023('0x3f')](_0x4f0ed6[_0x5023('0x3e')],{'$or':_[_0x5023('0x2c')](_0x4f0ed6[_0x5023('0x34')],function(_0x135715){var _0x3f2064={};_0x3f2064[_0x135715]={'$like':'%'+_0x22de64[_0x5023('0x32')][_0x5023('0x3d')]+'%'};return _0x3f2064;})});}_0x4f0ed6=_['merge']({},_0x4f0ed6,_0x22de64[_0x5023('0x41')]);return _0x1c8281[_0x5023('0x4f')](_0x4f0ed6);}})[_0x5023('0x42')](function(_0x16f704){if(_0x16f704){_0x17da89=_0x16f704[_0x5023('0x37')];if(!_0x22de64[_0x5023('0x32')][_0x5023('0x38')](_0x5023('0x39'))){_0x4f0ed6['limit']=qs[_0x5023('0x20')](_0x22de64[_0x5023('0x32')][_0x5023('0x20')]);_0x4f0ed6['offset']=qs['offset'](_0x22de64[_0x5023('0x32')][_0x5023('0x1e')]);}return _0x1c8281[_0x5023('0x4f')](_0x4f0ed6);}})['then'](function(_0x563cdb){if(_0x563cdb){return _0x563cdb?{'count':_0x17da89,'rows':_0x563cdb}:null;}})[_0x5023('0x42')](respondWithResult(_0x5e29ed,null))[_0x5023('0x47')](handleError(_0x5e29ed,null));};exports[_0x5023('0x50')]=function(_0x5b1e7f,_0x4f2400,_0x42e6f4){if(_0x5b1e7f[_0x5023('0x4c')]['id']){delete _0x5b1e7f[_0x5023('0x4c')]['id'];}return db['SugarcrmAccount'][_0x5023('0x4d')]({'where':{'id':_0x5b1e7f['params']['id']}})[_0x5023('0x42')](handleEntityNotFound(_0x4f2400,null))[_0x5023('0x42')](function(_0x471c6f){if(_0x471c6f){_0x5b1e7f['body'][_0x5023('0x51')]=_0x471c6f['id'];_0x5b1e7f['body']['Subjects']=integrations[_0x5023('0x52')](_0x5b1e7f['body'][_0x5023('0x53')],_0x5b1e7f[_0x5023('0x4c')][_0x5023('0x54')]);_0x5b1e7f[_0x5023('0x4c')][_0x5023('0x55')]=integrations[_0x5023('0x56')](_0x5b1e7f[_0x5023('0x4c')]['channel'],_0x5b1e7f[_0x5023('0x4c')][_0x5023('0x54')]);return db[_0x5023('0x4e')]['create'](_0x5b1e7f['body'],{'include':[{'model':db['SugarcrmField'],'as':_0x5023('0x57')},{'model':db[_0x5023('0x58')],'as':_0x5023('0x55')}]});}return null;})[_0x5023('0x42')](respondWithResult(_0x4f2400,null))[_0x5023('0x47')](handleError(_0x4f2400,null));};exports[_0x5023('0x59')]=function(_0x3cdc,_0x32e9d1,_0x4b2e40){var _0x33046c='';var _0xb426b5=['id',_0x5023('0x29'),'assigned_user_id','created_by','description',_0x5023('0x5a'),_0x5023('0x5b'),_0x5023('0x5c'),_0x5023('0x5d'),_0x5023('0x5e'),_0x5023('0x5f'),'direction'];return db['SugarcrmAccount'][_0x5023('0x4d')]({'where':{'id':_0x3cdc['params']['id']},'attributes':['id','username',_0x5023('0x60'),'remoteUri']})['then'](handleEntityNotFound(_0x32e9d1,null))[_0x5023('0x42')](function(_0x46f426){if(_0x46f426){_0x33046c=_0x46f426[_0x5023('0x61')];var _0x2d1a34=_0x33046c['slice'](-0x1);if(_0x2d1a34==='/'){_0x33046c=_0x33046c[_0x5023('0x62')](0x0,_0x33046c[_0x5023('0x63')](_0x2d1a34));}return rp({'method':'POST','uri':util[_0x5023('0x64')]('%s%s',_0x33046c,_0x5023('0x65')),'json':!![],'form':{'method':'login','input_type':_0x5023('0x66'),'response_type':_0x5023('0x66'),'rest_data':JSON[_0x5023('0x67')]({'user_auth':{'user_name':_0x46f426[_0x5023('0x68')],'password':_0x46f426[_0x5023('0x60')],'encryption':_0x5023('0x69')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x5023('0x42')](function(_0x5b62f7){if(_0x5b62f7&&_0x5b62f7[_0x5023('0x29')]!==_0x5023('0x6a')&&_0x5b62f7[_0x5023('0x29')]!==_0x5023('0x6b')){return rp({'method':_0x5023('0x6c'),'uri':util[_0x5023('0x64')](_0x5023('0x6d'),_0x33046c,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x5023('0x6e'),'input_type':'JSON','response_type':_0x5023('0x66'),'rest_data':JSON[_0x5023('0x67')]({'session':_0x5b62f7['id'],'module_name':_0x5023('0x6f')})}})[_0x5023('0x42')](function(_0xe6ab5c){if(_0xe6ab5c){var _0x12a22d=_[_0x5023('0x70')](_0xe6ab5c[_0x5023('0x71')]);_[_0x5023('0x72')](_0x12a22d,function(_0x3e1261){return _0xb426b5[_0x5023('0x73')](_0x3e1261[_0x5023('0x29')]);});return{'count':_0x12a22d[_0x5023('0x37')],'rows':_[_0x5023('0x2c')](_0x12a22d,function(_0x526db2){return{'id':_0x526db2[_0x5023('0x29')],'name':_0x526db2[_0x5023('0x74')],'custom':_['endsWith'](_0x526db2[_0x5023('0x29')],'_c')?!![]:![],'options':_0x526db2['options']?_[_0x5023('0x2c')](_[_0x5023('0x70')](_0x526db2[_0x5023('0x41')]),function(_0x2bac67){return{'name':_0x2bac67[_0x5023('0x75')],'value':_0x2bac67[_0x5023('0x29')]};}):[]};})};}})['then'](respondWithResult(_0x32e9d1,null))[_0x5023('0x47')](function(_0x1c8f4b){var _0x4d2bb6=_0x3cdc['query'][_0x5023('0x76')]?0x1f4:_0x1c8f4b[_0x5023('0x77')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x5023('0x59'),_0x4d2bb6,JSON['stringify'](_0x1c8f4b));delete _0x1c8f4b[_0x5023('0x29')];if(_0x4d2bb6===0x191){_0x4d2bb6=0x190;}_0x32e9d1[_0x5023('0x1b')](_0x4d2bb6)[_0x5023('0x2a')](_0x3cdc['query'][_0x5023('0x76')]?{'message':_0x5023('0x78'),'statusCode':_0x1c8f4b['statusCode']}:_0x1c8f4b);});}else{var _0x59a9c5=0x1f4;_0x32e9d1['status'](_0x59a9c5)[_0x5023('0x2a')]({'message':_0x5023('0x78'),'statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index d0f0d2b..80e9e5f 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 _0xa923=['../../components/integrations/configuration','exports','SugarcrmAccount','lodash','util','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x55490b,_0x25997d){var _0x4010ef=function(_0x387420){while(--_0x387420){_0x55490b['push'](_0x55490b['shift']());}};_0x4010ef(++_0x25997d);}(_0xa923,0xcb));var _0x3a92=function(_0x5355df,_0x438346){_0x5355df=_0x5355df-0x0;var _0x563a5c=_0xa923[_0x5355df];return _0x563a5c;};'use strict';var _=require(_0x3a92('0x0'));var util=require(_0x3a92('0x1'));var logger=require('../../config/logger')(_0x3a92('0x2'));var moment=require(_0x3a92('0x3'));var BPromise=require('bluebird');var rp=require(_0x3a92('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3a92('0x5'));var config=require(_0x3a92('0x6'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x3a92('0x7'));module[_0x3a92('0x8')]=function(_0xc76af2,_0x439138){return _0xc76af2['define'](_0x3a92('0x9'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf811=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash'];(function(_0x36fbef,_0x4ffc84){var _0x45e270=function(_0x32dd95){while(--_0x32dd95){_0x36fbef['push'](_0x36fbef['shift']());}};_0x45e270(++_0x4ffc84);}(_0xf811,0x6f));var _0x1f81=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0xf811[_0x59c301];return _0x3866b9;};'use strict';var _=require(_0x1f81('0x0'));var util=require(_0x1f81('0x1'));var logger=require(_0x1f81('0x2'))(_0x1f81('0x3'));var moment=require(_0x1f81('0x4'));var BPromise=require(_0x1f81('0x5'));var rp=require(_0x1f81('0x6'));var fs=require('fs');var path=require(_0x1f81('0x7'));var rimraf=require(_0x1f81('0x8'));var config=require(_0x1f81('0x9'));var attributes=require(_0x1f81('0xa'));var integrations=require(_0x1f81('0xb'));module[_0x1f81('0xc')]=function(_0xcf30e8,_0x57c512){return _0xcf30e8[_0x1f81('0xd')](_0x1f81('0xe'),attributes,{'tableName':_0x1f81('0xf'),'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 a4099c6..82eb8ef 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 _0xd2e2=['request\x20sent','debug','error','SugarcrmAccount,\x20%s,\x20%s','message','info','result','GetSugarcrmAccount','findAll','options','raw','attributes','limit','include','map','model','stringify','catch','ShowSugarcrmAccount','SugarcrmAccount','find','where','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd2e2,0x76));var _0x2d2e=function(_0x4d218f,_0x280bf7){_0x4d218f=_0x4d218f-0x0;var _0x291fee=_0xd2e2[_0x4d218f];return _0x291fee;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2d2e('0x0'));var BPromise=require(_0x2d2e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2d2e('0x2'))['db'];var utils=require(_0x2d2e('0x3'));var logger=require('../../config/logger')(_0x2d2e('0x4'));var config=require(_0x2d2e('0x5'));var jayson=require(_0x2d2e('0x6'));var client=jayson['client'][_0x2d2e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2631c8,_0x4718be,_0x34f490){return new BPromise(function(_0x1e91f7,_0x2dbb3b){return client[_0x2d2e('0x8')](_0x2631c8,_0x34f490)[_0x2d2e('0x9')](function(_0x1a16e6){logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x4718be,_0x2d2e('0xa'));logger[_0x2d2e('0xb')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x4718be,'request\x20sent',JSON['stringify'](_0x1a16e6));if(_0x1a16e6['error']){if(_0x1a16e6[_0x2d2e('0xc')]['code']===0x1f4){logger['error'](_0x2d2e('0xd'),_0x4718be,_0x1a16e6[_0x2d2e('0xc')][_0x2d2e('0xe')]);return _0x2dbb3b(_0x1a16e6['error'][_0x2d2e('0xe')]);}logger['error'](_0x2d2e('0xd'),_0x4718be,_0x1a16e6[_0x2d2e('0xc')][_0x2d2e('0xe')]);return _0x1e91f7(_0x1a16e6[_0x2d2e('0xc')][_0x2d2e('0xe')]);}else{logger[_0x2d2e('0xf')](_0x2d2e('0xd'),_0x4718be,_0x2d2e('0xa'));_0x1e91f7(_0x1a16e6[_0x2d2e('0x10')][_0x2d2e('0xe')]);}})['catch'](function(_0x263150){logger[_0x2d2e('0xc')]('SugarcrmAccount,\x20%s,\x20%s',_0x4718be,_0x263150);_0x2dbb3b(_0x263150);});});}exports[_0x2d2e('0x11')]=function(_0x303347){var _0x3b52c6=this;return new Promise(function(_0x351f43,_0xe9e250){return db['SugarcrmAccount'][_0x2d2e('0x12')]({'raw':_0x303347[_0x2d2e('0x13')]?_0x303347['options'][_0x2d2e('0x14')]===undefined?!![]:![]:!![],'where':_0x303347[_0x2d2e('0x13')]?_0x303347[_0x2d2e('0x13')]['where']||null:null,'attributes':_0x303347['options']?_0x303347[_0x2d2e('0x13')][_0x2d2e('0x15')]||null:null,'limit':_0x303347[_0x2d2e('0x13')]?_0x303347[_0x2d2e('0x13')][_0x2d2e('0x16')]||null:null,'include':_0x303347[_0x2d2e('0x13')]?_0x303347[_0x2d2e('0x13')][_0x2d2e('0x17')]?_[_0x2d2e('0x18')](_0x303347[_0x2d2e('0x13')][_0x2d2e('0x17')],function(_0x2efbfd){return{'model':db[_0x2efbfd[_0x2d2e('0x19')]],'as':_0x2efbfd['as'],'attributes':_0x2efbfd[_0x2d2e('0x15')],'include':_0x2efbfd['include']?_[_0x2d2e('0x18')](_0x2efbfd['include'],function(_0x5c8d87){return{'model':db[_0x5c8d87[_0x2d2e('0x19')]],'as':_0x5c8d87['as'],'attributes':_0x5c8d87[_0x2d2e('0x15')],'include':_0x5c8d87[_0x2d2e('0x17')]?_[_0x2d2e('0x18')](_0x5c8d87[_0x2d2e('0x17')],function(_0x1ffe52){return{'model':db[_0x1ffe52[_0x2d2e('0x19')]],'as':_0x1ffe52['as'],'attributes':_0x1ffe52[_0x2d2e('0x15')]};}):[]};}):[]};}):[]:[]})[_0x2d2e('0x9')](function(_0x203cdc){logger[_0x2d2e('0xf')](_0x2d2e('0x11'),_0x303347);logger['debug'](_0x2d2e('0x11'),_0x303347,JSON[_0x2d2e('0x1a')](_0x203cdc));_0x351f43(_0x203cdc);})[_0x2d2e('0x1b')](function(_0x3dc133){logger['error'](_0x2d2e('0x11'),_0x3dc133['message'],_0x303347);_0xe9e250(_0x3b52c6[_0x2d2e('0xc')](0x1f4,_0x3dc133['message']));});});};exports[_0x2d2e('0x1c')]=function(_0x5e69ba){var _0x7a821e=this;return new Promise(function(_0x1dbb73,_0x2f64c2){return db[_0x2d2e('0x1d')][_0x2d2e('0x1e')]({'raw':_0x5e69ba[_0x2d2e('0x13')]?_0x5e69ba[_0x2d2e('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x5e69ba[_0x2d2e('0x13')]?_0x5e69ba[_0x2d2e('0x13')][_0x2d2e('0x1f')]||null:null,'attributes':_0x5e69ba[_0x2d2e('0x13')]?_0x5e69ba[_0x2d2e('0x13')][_0x2d2e('0x15')]||null:null,'include':_0x5e69ba[_0x2d2e('0x13')]?_0x5e69ba[_0x2d2e('0x13')][_0x2d2e('0x17')]?_['map'](_0x5e69ba['options'][_0x2d2e('0x17')],function(_0x591861){return{'model':db[_0x591861[_0x2d2e('0x19')]],'as':_0x591861['as'],'attributes':_0x591861['attributes'],'include':_0x591861['include']?_[_0x2d2e('0x18')](_0x591861[_0x2d2e('0x17')],function(_0x23e46a){return{'model':db[_0x23e46a[_0x2d2e('0x19')]],'as':_0x23e46a['as'],'attributes':_0x23e46a['attributes'],'include':_0x23e46a[_0x2d2e('0x17')]?_[_0x2d2e('0x18')](_0x23e46a['include'],function(_0x28a8ac){return{'model':db[_0x28a8ac[_0x2d2e('0x19')]],'as':_0x28a8ac['as'],'attributes':_0x28a8ac[_0x2d2e('0x15')]};}):[]};}):[]};}):[]:[]})[_0x2d2e('0x9')](function(_0x238486){logger[_0x2d2e('0xf')](_0x2d2e('0x1c'),_0x5e69ba);logger[_0x2d2e('0xb')](_0x2d2e('0x1c'),_0x5e69ba,JSON['stringify'](_0x238486));_0x1dbb73(_0x238486);})[_0x2d2e('0x1b')](function(_0x5ea026){logger[_0x2d2e('0xc')](_0x2d2e('0x1c'),_0x5ea026[_0x2d2e('0xe')],_0x5e69ba);_0x2f64c2(_0x7a821e['error'](0x1f4,_0x5ea026[_0x2d2e('0xe')]));});});}; \ No newline at end of file +var _0xe350=['where','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','GetSugarcrmAccount','SugarcrmAccount','options','raw','limit','include','attributes','map','model','debug','ShowSugarcrmAccount','find'];(function(_0x351b46,_0x26b265){var _0x1515df=function(_0x22896a){while(--_0x22896a){_0x351b46['push'](_0x351b46['shift']());}};_0x1515df(++_0x26b265);}(_0xe350,0x1eb));var _0x0e35=function(_0x26c071,_0x16518a){_0x26c071=_0x26c071-0x0;var _0x33cf39=_0xe350[_0x26c071];return _0x33cf39;};'use strict';var _=require(_0x0e35('0x0'));var util=require(_0x0e35('0x1'));var moment=require(_0x0e35('0x2'));var BPromise=require(_0x0e35('0x3'));var rs=require(_0x0e35('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0e35('0x5'))['db'];var utils=require(_0x0e35('0x6'));var logger=require(_0x0e35('0x7'))(_0x0e35('0x8'));var config=require('../../config/environment');var jayson=require(_0x0e35('0x9'));var client=jayson[_0x0e35('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b8b22,_0x1497cf,_0x34d96d){return new BPromise(function(_0x32657e,_0x445a9f){return client[_0x0e35('0xb')](_0x1b8b22,_0x34d96d)[_0x0e35('0xc')](function(_0x20515c){logger[_0x0e35('0xd')](_0x0e35('0xe'),_0x1497cf,_0x0e35('0xf'));logger['debug'](_0x0e35('0x10'),_0x1497cf,_0x0e35('0xf'),JSON[_0x0e35('0x11')](_0x20515c));if(_0x20515c['error']){if(_0x20515c['error'][_0x0e35('0x12')]===0x1f4){logger[_0x0e35('0x13')](_0x0e35('0xe'),_0x1497cf,_0x20515c[_0x0e35('0x13')][_0x0e35('0x14')]);return _0x445a9f(_0x20515c['error'][_0x0e35('0x14')]);}logger[_0x0e35('0x13')](_0x0e35('0xe'),_0x1497cf,_0x20515c[_0x0e35('0x13')]['message']);return _0x32657e(_0x20515c['error'][_0x0e35('0x14')]);}else{logger[_0x0e35('0xd')](_0x0e35('0xe'),_0x1497cf,_0x0e35('0xf'));_0x32657e(_0x20515c['result'][_0x0e35('0x14')]);}})[_0x0e35('0x15')](function(_0xf043b6){logger['error'](_0x0e35('0xe'),_0x1497cf,_0xf043b6);_0x445a9f(_0xf043b6);});});}exports[_0x0e35('0x16')]=function(_0x2d9d5b){var _0x17d26e=this;return new Promise(function(_0x2776cd,_0x148cd7){return db[_0x0e35('0x17')]['findAll']({'raw':_0x2d9d5b[_0x0e35('0x18')]?_0x2d9d5b[_0x0e35('0x18')][_0x0e35('0x19')]===undefined?!![]:![]:!![],'where':_0x2d9d5b[_0x0e35('0x18')]?_0x2d9d5b[_0x0e35('0x18')]['where']||null:null,'attributes':_0x2d9d5b[_0x0e35('0x18')]?_0x2d9d5b['options']['attributes']||null:null,'limit':_0x2d9d5b['options']?_0x2d9d5b[_0x0e35('0x18')][_0x0e35('0x1a')]||null:null,'include':_0x2d9d5b[_0x0e35('0x18')]?_0x2d9d5b['options'][_0x0e35('0x1b')]?_['map'](_0x2d9d5b[_0x0e35('0x18')][_0x0e35('0x1b')],function(_0x194b95){return{'model':db[_0x194b95['model']],'as':_0x194b95['as'],'attributes':_0x194b95[_0x0e35('0x1c')],'include':_0x194b95[_0x0e35('0x1b')]?_[_0x0e35('0x1d')](_0x194b95[_0x0e35('0x1b')],function(_0x577910){return{'model':db[_0x577910[_0x0e35('0x1e')]],'as':_0x577910['as'],'attributes':_0x577910[_0x0e35('0x1c')],'include':_0x577910[_0x0e35('0x1b')]?_[_0x0e35('0x1d')](_0x577910[_0x0e35('0x1b')],function(_0x215dd9){return{'model':db[_0x215dd9[_0x0e35('0x1e')]],'as':_0x215dd9['as'],'attributes':_0x215dd9['attributes']};}):[]};}):[]};}):[]:[]})[_0x0e35('0xc')](function(_0x3ed27b){logger['info'](_0x0e35('0x16'),_0x2d9d5b);logger[_0x0e35('0x1f')](_0x0e35('0x16'),_0x2d9d5b,JSON[_0x0e35('0x11')](_0x3ed27b));_0x2776cd(_0x3ed27b);})[_0x0e35('0x15')](function(_0x2d0909){logger[_0x0e35('0x13')](_0x0e35('0x16'),_0x2d0909[_0x0e35('0x14')],_0x2d9d5b);_0x148cd7(_0x17d26e[_0x0e35('0x13')](0x1f4,_0x2d0909[_0x0e35('0x14')]));});});};exports[_0x0e35('0x20')]=function(_0x1ed01d){var _0x2f68d7=this;return new Promise(function(_0xb6d34c,_0x4c898f){return db['SugarcrmAccount'][_0x0e35('0x21')]({'raw':_0x1ed01d['options']?_0x1ed01d[_0x0e35('0x18')][_0x0e35('0x19')]===undefined?!![]:![]:!![],'where':_0x1ed01d[_0x0e35('0x18')]?_0x1ed01d['options'][_0x0e35('0x22')]||null:null,'attributes':_0x1ed01d[_0x0e35('0x18')]?_0x1ed01d[_0x0e35('0x18')]['attributes']||null:null,'include':_0x1ed01d['options']?_0x1ed01d[_0x0e35('0x18')]['include']?_['map'](_0x1ed01d[_0x0e35('0x18')][_0x0e35('0x1b')],function(_0x32d7d4){return{'model':db[_0x32d7d4['model']],'as':_0x32d7d4['as'],'attributes':_0x32d7d4[_0x0e35('0x1c')],'include':_0x32d7d4[_0x0e35('0x1b')]?_[_0x0e35('0x1d')](_0x32d7d4[_0x0e35('0x1b')],function(_0x50d291){return{'model':db[_0x50d291['model']],'as':_0x50d291['as'],'attributes':_0x50d291[_0x0e35('0x1c')],'include':_0x50d291[_0x0e35('0x1b')]?_['map'](_0x50d291[_0x0e35('0x1b')],function(_0x1f2110){return{'model':db[_0x1f2110['model']],'as':_0x1f2110['as'],'attributes':_0x1f2110[_0x0e35('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0e35('0xc')](function(_0xb79a19){logger['info']('ShowSugarcrmAccount',_0x1ed01d);logger['debug'](_0x0e35('0x20'),_0x1ed01d,JSON['stringify'](_0xb79a19));_0xb6d34c(_0xb79a19);})[_0x0e35('0x15')](function(_0x330fcc){logger[_0x0e35('0x13')](_0x0e35('0x20'),_0x330fcc[_0x0e35('0x14')],_0x1ed01d);_0x4c898f(_0x2f68d7[_0x0e35('0x13')](0x1f4,_0x330fcc['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index fa5aa9a..11695f6 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 _0x0e66=['update','delete','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','isAuthenticated','index','get','/:id','show','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0e66,0x10b));var _0x60e6=function(_0x34aec4,_0x3801da){_0x34aec4=_0x34aec4-0x0;var _0x51e1a7=_0x0e66[_0x34aec4];return _0x51e1a7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x60e6('0x0'));var timeout=require(_0x60e6('0x1'));var express=require('express');var router=express[_0x60e6('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x60e6('0x3'));var interaction=require(_0x60e6('0x4'));var config=require(_0x60e6('0x5'));var controller=require(_0x60e6('0x6'));router['get']('/',auth[_0x60e6('0x7')](),controller[_0x60e6('0x8')]);router[_0x60e6('0x9')](_0x60e6('0xa'),auth['isAuthenticated'](),controller[_0x60e6('0xb')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x60e6('0xc')]);router['get']('/:id/subjects',auth[_0x60e6('0x7')](),controller[_0x60e6('0xd')]);router['get'](_0x60e6('0xe'),auth[_0x60e6('0x7')](),controller[_0x60e6('0xf')]);router[_0x60e6('0x10')]('/',auth[_0x60e6('0x7')](),controller[_0x60e6('0x11')]);router[_0x60e6('0x12')](_0x60e6('0xa'),auth[_0x60e6('0x7')](),controller[_0x60e6('0x13')]);router[_0x60e6('0x14')](_0x60e6('0xa'),auth[_0x60e6('0x7')](),controller['destroy']);module[_0x60e6('0x15')]=router; \ No newline at end of file +var _0x9be4=['/:id','isAuthenticated','/:id/fields','getFields','/:id/subjects','getDescriptions','post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intSugarcrmConfiguration.controller','get','index'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x9be4,0x156));var _0x49be=function(_0x232454,_0x43d4ff){_0x232454=_0x232454-0x0;var _0x1de166=_0x9be4[_0x232454];return _0x1de166;};'use strict';var multer=require('multer');var util=require(_0x49be('0x0'));var path=require(_0x49be('0x1'));var timeout=require(_0x49be('0x2'));var express=require(_0x49be('0x3'));var router=express[_0x49be('0x4')]();var fs_extra=require(_0x49be('0x5'));var auth=require(_0x49be('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49be('0x7'));router[_0x49be('0x8')]('/',auth['isAuthenticated'](),controller[_0x49be('0x9')]);router[_0x49be('0x8')](_0x49be('0xa'),auth[_0x49be('0xb')](),controller['show']);router[_0x49be('0x8')](_0x49be('0xc'),auth[_0x49be('0xb')](),controller[_0x49be('0xd')]);router[_0x49be('0x8')](_0x49be('0xe'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x49be('0x8')]('/:id/descriptions',auth[_0x49be('0xb')](),controller[_0x49be('0xf')]);router[_0x49be('0x10')]('/',auth['isAuthenticated'](),controller[_0x49be('0x11')]);router[_0x49be('0x12')](_0x49be('0xa'),auth[_0x49be('0xb')](),controller[_0x49be('0x13')]);router[_0x49be('0x14')](_0x49be('0xa'),auth['isAuthenticated'](),controller[_0x49be('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 332c1ea..d16121e 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 _0x2046=['STRING','sequelize','exports'];(function(_0x1f8c57,_0x52d1ab){var _0x11cf18=function(_0x47b4ff){while(--_0x47b4ff){_0x1f8c57['push'](_0x1f8c57['shift']());}};_0x11cf18(++_0x52d1ab);}(_0x2046,0x6a));var _0x6204=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2046[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x6204('0x0'));module[_0x6204('0x1')]={'name':{'type':Sequelize[_0x6204('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x747e=['STRING','exports'];(function(_0x2ae84e,_0x39fc44){var _0x51c81d=function(_0x37d485){while(--_0x37d485){_0x2ae84e['push'](_0x2ae84e['shift']());}};_0x51c81d(++_0x39fc44);}(_0x747e,0x163));var _0xe747=function(_0x1b6c6d,_0x2983b0){_0x1b6c6d=_0x1b6c6d-0x0;var _0x290d9d=_0x747e[_0x1b6c6d];return _0x290d9d;};'use strict';var Sequelize=require('sequelize');module[_0xe747('0x0')]={'name':{'type':Sequelize[_0xe747('0x1')]},'description':{'type':Sequelize[_0xe747('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index f398dfa..0adf6df 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 _0x49f7=['../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','status','end','offset','limit','undefined','count','set','json','apply','save','update','then','destroy','sendStatus','error','map','SugarcrmConfiguration','key','model','name','keys','intersection','attributes','fields','query','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','rows','show','params','rawAttributes','catch','create','body','find','findOne','SugarcrmField','options','hasOwnProperty','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','ioredis'];(function(_0x3fd2f3,_0x417377){var _0x83f492=function(_0xb6b0b5){while(--_0xb6b0b5){_0x3fd2f3['push'](_0x3fd2f3['shift']());}};_0x83f492(++_0x417377);}(_0x49f7,0xcd));var _0x749f=function(_0x7b7e1,_0x482844){_0x7b7e1=_0x7b7e1-0x0;var _0x55075c=_0x49f7[_0x7b7e1];return _0x55075c;};'use strict';var emlformat=require(_0x749f('0x0'));var rimraf=require(_0x749f('0x1'));var zipdir=require(_0x749f('0x2'));var jsonpatch=require(_0x749f('0x3'));var rp=require(_0x749f('0x4'));var moment=require(_0x749f('0x5'));var BPromise=require(_0x749f('0x6'));var Mustache=require(_0x749f('0x7'));var util=require('util');var path=require(_0x749f('0x8'));var sox=require(_0x749f('0x9'));var csv=require(_0x749f('0xa'));var ejs=require(_0x749f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x749f('0xc'));var squel=require(_0x749f('0xd'));var crypto=require(_0x749f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x749f('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x749f('0x10'));var authService=require(_0x749f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x749f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x749f('0x13'));var utils=require(_0x749f('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x749f('0x15'))['db'];function respondWithStatusCode(_0x7f74db,_0xac4c8d){_0xac4c8d=_0xac4c8d||0xcc;return function(_0x34b5c5){if(_0x34b5c5){return _0x7f74db['sendStatus'](_0xac4c8d);}return _0x7f74db[_0x749f('0x16')](_0xac4c8d)[_0x749f('0x17')]();};}function respondWithResult(_0x15a963,_0x67d608){_0x67d608=_0x67d608||0xc8;return function(_0x58c063){if(_0x58c063){return _0x15a963['status'](_0x67d608)['json'](_0x58c063);}};}function respondWithFilteredResult(_0x5e9aab,_0x16076e){return function(_0xabb872){if(_0xabb872){var _0xc57aa8=typeof _0x16076e[_0x749f('0x18')]==='undefined'&&typeof _0x16076e[_0x749f('0x19')]===_0x749f('0x1a');var _0x2d792f=_0xabb872['count'];var _0xe6bff5=_0xc57aa8?0x0:_0x16076e[_0x749f('0x18')];var _0x19ec1e=_0xc57aa8?_0xabb872[_0x749f('0x1b')]:_0x16076e['offset']+_0x16076e[_0x749f('0x19')];var _0x1b9ff9;if(_0x19ec1e>=_0x2d792f){_0x19ec1e=_0x2d792f;_0x1b9ff9=0xc8;}else{_0x1b9ff9=0xce;}_0x5e9aab['status'](_0x1b9ff9);return _0x5e9aab[_0x749f('0x1c')]('Content-Range',_0xe6bff5+'-'+_0x19ec1e+'/'+_0x2d792f)[_0x749f('0x1d')](_0xabb872);}return null;};}function patchUpdates(_0x8b023){return function(_0x112afd){try{jsonpatch[_0x749f('0x1e')](_0x112afd,_0x8b023,!![]);}catch(_0x185756){return BPromise['reject'](_0x185756);}return _0x112afd[_0x749f('0x1f')]();};}function saveUpdates(_0x3d6db8,_0x5c44b1){return function(_0x28586b){if(_0x28586b){return _0x28586b[_0x749f('0x20')](_0x3d6db8)[_0x749f('0x21')](function(_0x227a3e){return _0x227a3e;});}return null;};}function removeEntity(_0x36fbcc,_0x43f3ad){return function(_0x4c413f){if(_0x4c413f){return _0x4c413f[_0x749f('0x22')]()['then'](function(){_0x36fbcc[_0x749f('0x16')](0xcc)[_0x749f('0x17')]();});}};}function handleEntityNotFound(_0x26674f,_0x2f4896){return function(_0x3a4e27){if(!_0x3a4e27){_0x26674f[_0x749f('0x23')](0x194);}return _0x3a4e27;};}function handleError(_0x520f7b,_0xac38b1){_0xac38b1=_0xac38b1||0x1f4;return function(_0x59fba6){logger[_0x749f('0x24')](_0x59fba6['stack']);if(_0x59fba6['name']){delete _0x59fba6['name'];}_0x520f7b[_0x749f('0x16')](_0xac38b1)['send'](_0x59fba6);};}exports['index']=function(_0x5259ed,_0x612479){var _0x46d894={},_0x5e1c08={},_0x6bacf4={'count':0x0,'rows':[]};var _0x467061=_[_0x749f('0x25')](db[_0x749f('0x26')]['rawAttributes'],function(_0x1a3eef){return{'name':_0x1a3eef['fieldName'],'type':_0x1a3eef['type'][_0x749f('0x27')]};});_0x5e1c08[_0x749f('0x28')]=_[_0x749f('0x25')](_0x467061,_0x749f('0x29'));_0x5e1c08['query']=_[_0x749f('0x2a')](_0x5259ed['query']);_0x5e1c08['filters']=_[_0x749f('0x2b')](_0x5e1c08[_0x749f('0x28')],_0x5e1c08['query']);_0x46d894[_0x749f('0x2c')]=_[_0x749f('0x2b')](_0x5e1c08[_0x749f('0x28')],qs[_0x749f('0x2d')](_0x5259ed[_0x749f('0x2e')]['fields']));_0x46d894['attributes']=_0x46d894[_0x749f('0x2c')][_0x749f('0x2f')]?_0x46d894['attributes']:_0x5e1c08[_0x749f('0x28')];if(!_0x5259ed[_0x749f('0x2e')]['hasOwnProperty'](_0x749f('0x30'))){_0x46d894['limit']=qs[_0x749f('0x19')](_0x5259ed[_0x749f('0x2e')]['limit']);_0x46d894[_0x749f('0x18')]=qs[_0x749f('0x18')](_0x5259ed[_0x749f('0x2e')][_0x749f('0x18')]);}_0x46d894[_0x749f('0x31')]=qs[_0x749f('0x32')](_0x5259ed['query']['sort']);_0x46d894[_0x749f('0x33')]=qs[_0x749f('0x34')](_[_0x749f('0x35')](_0x5259ed[_0x749f('0x2e')],_0x5e1c08[_0x749f('0x34')]),_0x467061);if(_0x5259ed['query'][_0x749f('0x36')]){_0x46d894[_0x749f('0x33')]=_[_0x749f('0x37')](_0x46d894['where'],{'$or':_[_0x749f('0x25')](_0x467061,function(_0x496080){if(_0x496080['type']!==_0x749f('0x38')){var _0x7173eb={};_0x7173eb[_0x496080[_0x749f('0x29')]]={'$like':'%'+_0x5259ed[_0x749f('0x2e')][_0x749f('0x36')]+'%'};return _0x7173eb;}})});}_0x46d894=_[_0x749f('0x37')]({},_0x46d894,_0x5259ed['options']);var _0x39d009={'where':_0x46d894[_0x749f('0x33')]};return db[_0x749f('0x26')]['count'](_0x39d009)[_0x749f('0x21')](function(_0x3155c2){_0x6bacf4['count']=_0x3155c2;if(_0x5259ed['query'][_0x749f('0x39')]){_0x46d894[_0x749f('0x3a')]=[{'all':!![]}];}return db[_0x749f('0x26')]['findAll'](_0x46d894);})[_0x749f('0x21')](function(_0x2ae5db){_0x6bacf4[_0x749f('0x3b')]=_0x2ae5db;return _0x6bacf4;})[_0x749f('0x21')](respondWithFilteredResult(_0x612479,_0x46d894))['catch'](handleError(_0x612479,null));};exports[_0x749f('0x3c')]=function(_0x2d1d1a,_0x4493e2){var _0x29a676={'raw':![],'where':{'id':_0x2d1d1a[_0x749f('0x3d')]['id']}},_0xd99a08={};_0xd99a08[_0x749f('0x28')]=_[_0x749f('0x2a')](db[_0x749f('0x26')][_0x749f('0x3e')]);_0xd99a08[_0x749f('0x2e')]=_[_0x749f('0x2a')](_0x2d1d1a[_0x749f('0x2e')]);_0xd99a08[_0x749f('0x34')]=_[_0x749f('0x2b')](_0xd99a08[_0x749f('0x28')],_0xd99a08[_0x749f('0x2e')]);_0x29a676[_0x749f('0x2c')]=_['intersection'](_0xd99a08['model'],qs[_0x749f('0x2d')](_0x2d1d1a[_0x749f('0x2e')][_0x749f('0x2d')]));_0x29a676['attributes']=_0x29a676[_0x749f('0x2c')][_0x749f('0x2f')]?_0x29a676[_0x749f('0x2c')]:_0xd99a08[_0x749f('0x28')];if(_0x2d1d1a[_0x749f('0x2e')][_0x749f('0x39')]){_0x29a676['include']=[{'all':!![]}];}_0x29a676=_[_0x749f('0x37')]({},_0x29a676,_0x2d1d1a['options']);return db[_0x749f('0x26')]['find'](_0x29a676)[_0x749f('0x21')](handleEntityNotFound(_0x4493e2,null))[_0x749f('0x21')](respondWithResult(_0x4493e2,null))[_0x749f('0x3f')](handleError(_0x4493e2,null));};exports['create']=function(_0xc50d12,_0x160c38){return db[_0x749f('0x26')][_0x749f('0x40')](_0xc50d12[_0x749f('0x41')],{})[_0x749f('0x21')](respondWithResult(_0x160c38,0xc9))[_0x749f('0x3f')](handleError(_0x160c38,null));};exports[_0x749f('0x20')]=function(_0x2b86c7,_0x5b504b){if(_0x2b86c7['body']['id']){delete _0x2b86c7[_0x749f('0x41')]['id'];}return db['SugarcrmConfiguration']['find']({'where':{'id':_0x2b86c7['params']['id']}})[_0x749f('0x21')](handleEntityNotFound(_0x5b504b,null))[_0x749f('0x21')](saveUpdates(_0x2b86c7['body'],null))[_0x749f('0x21')](respondWithResult(_0x5b504b,null))[_0x749f('0x3f')](handleError(_0x5b504b,null));};exports[_0x749f('0x22')]=function(_0x532728,_0x3c2a23){return db[_0x749f('0x26')][_0x749f('0x42')]({'where':{'id':_0x532728[_0x749f('0x3d')]['id']}})[_0x749f('0x21')](handleEntityNotFound(_0x3c2a23,null))[_0x749f('0x21')](removeEntity(_0x3c2a23,null))[_0x749f('0x3f')](handleError(_0x3c2a23,null));};exports['getFields']=function(_0x20776a,_0x3ec8c1,_0x595478){var _0x406fc8={};var _0x5c0b2b={};var _0x1c8bcc;var _0x39d5f1;return db[_0x749f('0x26')][_0x749f('0x43')]({'where':{'id':_0x20776a[_0x749f('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3ec8c1,null))[_0x749f('0x21')](function(_0x17441f){if(_0x17441f){_0x1c8bcc=_0x17441f;_0x5c0b2b[_0x749f('0x28')]=_[_0x749f('0x2a')](db[_0x749f('0x44')][_0x749f('0x3e')]);_0x5c0b2b[_0x749f('0x2e')]=_[_0x749f('0x2a')](_0x20776a[_0x749f('0x2e')]);_0x5c0b2b['filters']=_['intersection'](_0x5c0b2b[_0x749f('0x28')],_0x5c0b2b[_0x749f('0x2e')]);_0x406fc8[_0x749f('0x2c')]=_['intersection'](_0x5c0b2b[_0x749f('0x28')],qs[_0x749f('0x2d')](_0x20776a['query']['fields']));_0x406fc8[_0x749f('0x2c')]=_0x406fc8[_0x749f('0x2c')][_0x749f('0x2f')]?_0x406fc8[_0x749f('0x2c')]:_0x5c0b2b[_0x749f('0x28')];_0x406fc8[_0x749f('0x31')]=qs['sort'](_0x20776a[_0x749f('0x2e')]['sort']);_0x406fc8[_0x749f('0x33')]=qs[_0x749f('0x34')](_[_0x749f('0x35')](_0x20776a[_0x749f('0x2e')],_0x5c0b2b[_0x749f('0x34')]));if(_0x20776a[_0x749f('0x2e')]['filter']){_0x406fc8[_0x749f('0x33')]=_[_0x749f('0x37')](_0x406fc8[_0x749f('0x33')],{'$or':_[_0x749f('0x25')](_0x406fc8[_0x749f('0x2c')],function(_0x182da0){var _0x3504b9={};_0x3504b9[_0x182da0]={'$like':'%'+_0x20776a[_0x749f('0x2e')]['filter']+'%'};return _0x3504b9;})});}_0x406fc8=_[_0x749f('0x37')]({},_0x406fc8,_0x20776a[_0x749f('0x45')]);return _0x1c8bcc['getFields'](_0x406fc8);}})['then'](function(_0x35954b){if(_0x35954b){_0x39d5f1=_0x35954b[_0x749f('0x2f')];if(!_0x20776a[_0x749f('0x2e')][_0x749f('0x46')]('nolimit')){_0x406fc8['limit']=qs[_0x749f('0x19')](_0x20776a[_0x749f('0x2e')][_0x749f('0x19')]);_0x406fc8[_0x749f('0x18')]=qs[_0x749f('0x18')](_0x20776a['query'][_0x749f('0x18')]);}return _0x1c8bcc[_0x749f('0x47')](_0x406fc8);}})['then'](function(_0x929be6){if(_0x929be6){return _0x929be6?{'count':_0x39d5f1,'rows':_0x929be6}:null;}})[_0x749f('0x21')](respondWithResult(_0x3ec8c1,null))[_0x749f('0x3f')](handleError(_0x3ec8c1,null));};exports['getSubjects']=function(_0x7527d5,_0x15780b,_0x5c6e4b){var _0x36487b={};var _0x5f47d1={};var _0x2c88e0;var _0x1142f2;return db[_0x749f('0x26')][_0x749f('0x43')]({'where':{'id':_0x7527d5[_0x749f('0x3d')]['id']}})[_0x749f('0x21')](handleEntityNotFound(_0x15780b,null))['then'](function(_0x35701a){if(_0x35701a){_0x2c88e0=_0x35701a;_0x5f47d1[_0x749f('0x28')]=_[_0x749f('0x2a')](db[_0x749f('0x44')][_0x749f('0x3e')]);_0x5f47d1['query']=_['keys'](_0x7527d5[_0x749f('0x2e')]);_0x5f47d1[_0x749f('0x34')]=_['intersection'](_0x5f47d1[_0x749f('0x28')],_0x5f47d1[_0x749f('0x2e')]);_0x36487b['attributes']=_['intersection'](_0x5f47d1[_0x749f('0x28')],qs[_0x749f('0x2d')](_0x7527d5[_0x749f('0x2e')][_0x749f('0x2d')]));_0x36487b[_0x749f('0x2c')]=_0x36487b[_0x749f('0x2c')][_0x749f('0x2f')]?_0x36487b[_0x749f('0x2c')]:_0x5f47d1[_0x749f('0x28')];_0x36487b[_0x749f('0x31')]=qs[_0x749f('0x32')](_0x7527d5[_0x749f('0x2e')][_0x749f('0x32')]);_0x36487b[_0x749f('0x33')]=qs['filters'](_[_0x749f('0x35')](_0x7527d5[_0x749f('0x2e')],_0x5f47d1[_0x749f('0x34')]));if(_0x7527d5[_0x749f('0x2e')]['filter']){_0x36487b[_0x749f('0x33')]=_['merge'](_0x36487b[_0x749f('0x33')],{'$or':_[_0x749f('0x25')](_0x36487b['attributes'],function(_0x47e473){var _0x42a67e={};_0x42a67e[_0x47e473]={'$like':'%'+_0x7527d5[_0x749f('0x2e')][_0x749f('0x36')]+'%'};return _0x42a67e;})});}_0x36487b=_[_0x749f('0x37')]({},_0x36487b,_0x7527d5[_0x749f('0x45')]);return _0x2c88e0[_0x749f('0x48')](_0x36487b);}})[_0x749f('0x21')](function(_0x43bfb2){if(_0x43bfb2){_0x1142f2=_0x43bfb2[_0x749f('0x2f')];if(!_0x7527d5[_0x749f('0x2e')][_0x749f('0x46')](_0x749f('0x30'))){_0x36487b[_0x749f('0x19')]=qs[_0x749f('0x19')](_0x7527d5['query']['limit']);_0x36487b[_0x749f('0x18')]=qs[_0x749f('0x18')](_0x7527d5[_0x749f('0x2e')][_0x749f('0x18')]);}return _0x2c88e0[_0x749f('0x48')](_0x36487b);}})['then'](function(_0x5375aa){if(_0x5375aa){return _0x5375aa?{'count':_0x1142f2,'rows':_0x5375aa}:null;}})[_0x749f('0x21')](respondWithResult(_0x15780b,null))[_0x749f('0x3f')](handleError(_0x15780b,null));};exports[_0x749f('0x49')]=function(_0x1a3491,_0x408df4,_0x807b77){var _0x1c9aa7={};var _0x1d7bc4={};var _0x8f329a;var _0x47eb85;return db[_0x749f('0x26')][_0x749f('0x43')]({'where':{'id':_0x1a3491[_0x749f('0x3d')]['id']}})['then'](handleEntityNotFound(_0x408df4,null))[_0x749f('0x21')](function(_0x39c9e7){if(_0x39c9e7){_0x8f329a=_0x39c9e7;_0x1d7bc4['model']=_[_0x749f('0x2a')](db[_0x749f('0x44')][_0x749f('0x3e')]);_0x1d7bc4[_0x749f('0x2e')]=_['keys'](_0x1a3491['query']);_0x1d7bc4[_0x749f('0x34')]=_['intersection'](_0x1d7bc4[_0x749f('0x28')],_0x1d7bc4[_0x749f('0x2e')]);_0x1c9aa7['attributes']=_[_0x749f('0x2b')](_0x1d7bc4[_0x749f('0x28')],qs[_0x749f('0x2d')](_0x1a3491['query'][_0x749f('0x2d')]));_0x1c9aa7[_0x749f('0x2c')]=_0x1c9aa7['attributes'][_0x749f('0x2f')]?_0x1c9aa7['attributes']:_0x1d7bc4[_0x749f('0x28')];_0x1c9aa7[_0x749f('0x31')]=qs[_0x749f('0x32')](_0x1a3491[_0x749f('0x2e')][_0x749f('0x32')]);_0x1c9aa7[_0x749f('0x33')]=qs['filters'](_[_0x749f('0x35')](_0x1a3491['query'],_0x1d7bc4['filters']));if(_0x1a3491[_0x749f('0x2e')][_0x749f('0x36')]){_0x1c9aa7[_0x749f('0x33')]=_['merge'](_0x1c9aa7[_0x749f('0x33')],{'$or':_[_0x749f('0x25')](_0x1c9aa7[_0x749f('0x2c')],function(_0x4a398b){var _0x4c455a={};_0x4c455a[_0x4a398b]={'$like':'%'+_0x1a3491[_0x749f('0x2e')]['filter']+'%'};return _0x4c455a;})});}_0x1c9aa7=_['merge']({},_0x1c9aa7,_0x1a3491[_0x749f('0x45')]);return _0x8f329a['getDescriptions'](_0x1c9aa7);}})['then'](function(_0x2b8d61){if(_0x2b8d61){_0x47eb85=_0x2b8d61[_0x749f('0x2f')];if(!_0x1a3491['query'][_0x749f('0x46')](_0x749f('0x30'))){_0x1c9aa7['limit']=qs['limit'](_0x1a3491[_0x749f('0x2e')]['limit']);_0x1c9aa7[_0x749f('0x18')]=qs[_0x749f('0x18')](_0x1a3491[_0x749f('0x2e')][_0x749f('0x18')]);}return _0x8f329a[_0x749f('0x49')](_0x1c9aa7);}})[_0x749f('0x21')](function(_0x40ac9f){if(_0x40ac9f){return _0x40ac9f?{'count':_0x47eb85,'rows':_0x40ac9f}:null;}})[_0x749f('0x21')](respondWithResult(_0x408df4,null))[_0x749f('0x3f')](handleError(_0x408df4,null));}; \ No newline at end of file +var _0x9cb0=['end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','error','name','index','map','SugarcrmConfiguration','fieldName','type','key','keys','query','filters','attributes','intersection','model','fields','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','length','find','create','body','getFields','findOne','SugarcrmField','hasOwnProperty','getSubjects','getDescriptions','eml-format','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status'];(function(_0x319877,_0x53a027){var _0x24056d=function(_0x370cb5){while(--_0x370cb5){_0x319877['push'](_0x319877['shift']());}};_0x24056d(++_0x53a027);}(_0x9cb0,0x1ab));var _0x09cb=function(_0x239a37,_0x1675c8){_0x239a37=_0x239a37-0x0;var _0x46db3c=_0x9cb0[_0x239a37];return _0x46db3c;};'use strict';var emlformat=require(_0x09cb('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x09cb('0x1'));var moment=require(_0x09cb('0x2'));var BPromise=require(_0x09cb('0x3'));var Mustache=require('mustache');var util=require(_0x09cb('0x4'));var path=require('path');var sox=require(_0x09cb('0x5'));var csv=require(_0x09cb('0x6'));var ejs=require(_0x09cb('0x7'));var fs=require('fs');var fs_extra=require(_0x09cb('0x8'));var _=require('lodash');var squel=require(_0x09cb('0x9'));var crypto=require(_0x09cb('0xa'));var jsforce=require(_0x09cb('0xb'));var deskjs=require(_0x09cb('0xc'));var toCsv=require(_0x09cb('0x6'));var querystring=require(_0x09cb('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x09cb('0xe'));var qs=require(_0x09cb('0xf'));var as=require(_0x09cb('0x10'));var hardwareService=require(_0x09cb('0x11'));var logger=require(_0x09cb('0x12'))(_0x09cb('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x09cb('0x14'))['db'];function respondWithStatusCode(_0x17dab6,_0x3fcfb5){_0x3fcfb5=_0x3fcfb5||0xcc;return function(_0x28e80f){if(_0x28e80f){return _0x17dab6[_0x09cb('0x15')](_0x3fcfb5);}return _0x17dab6[_0x09cb('0x16')](_0x3fcfb5)[_0x09cb('0x17')]();};}function respondWithResult(_0xe0c8f3,_0x4f376f){_0x4f376f=_0x4f376f||0xc8;return function(_0x5bf0a4){if(_0x5bf0a4){return _0xe0c8f3[_0x09cb('0x16')](_0x4f376f)[_0x09cb('0x18')](_0x5bf0a4);}};}function respondWithFilteredResult(_0x110bd2,_0x40ee34){return function(_0x5834f){if(_0x5834f){var _0x9437c9=typeof _0x40ee34[_0x09cb('0x19')]===_0x09cb('0x1a')&&typeof _0x40ee34[_0x09cb('0x1b')]===_0x09cb('0x1a');var _0x5cfda3=_0x5834f[_0x09cb('0x1c')];var _0xcc9910=_0x9437c9?0x0:_0x40ee34[_0x09cb('0x19')];var _0x3470db=_0x9437c9?_0x5834f[_0x09cb('0x1c')]:_0x40ee34['offset']+_0x40ee34[_0x09cb('0x1b')];var _0x44860e;if(_0x3470db>=_0x5cfda3){_0x3470db=_0x5cfda3;_0x44860e=0xc8;}else{_0x44860e=0xce;}_0x110bd2[_0x09cb('0x16')](_0x44860e);return _0x110bd2['set'](_0x09cb('0x1d'),_0xcc9910+'-'+_0x3470db+'/'+_0x5cfda3)[_0x09cb('0x18')](_0x5834f);}return null;};}function patchUpdates(_0x1bc154){return function(_0x4b8a1e){try{jsonpatch['apply'](_0x4b8a1e,_0x1bc154,!![]);}catch(_0x2d74e2){return BPromise[_0x09cb('0x1e')](_0x2d74e2);}return _0x4b8a1e[_0x09cb('0x1f')]();};}function saveUpdates(_0x982fbf,_0x128cf7){return function(_0x304f41){if(_0x304f41){return _0x304f41[_0x09cb('0x20')](_0x982fbf)[_0x09cb('0x21')](function(_0x43c55e){return _0x43c55e;});}return null;};}function removeEntity(_0xb47bdf,_0x32bdf4){return function(_0x5921e6){if(_0x5921e6){return _0x5921e6[_0x09cb('0x22')]()['then'](function(){_0xb47bdf[_0x09cb('0x16')](0xcc)[_0x09cb('0x17')]();});}};}function handleEntityNotFound(_0x60c053,_0x5d2ee9){return function(_0x2918ea){if(!_0x2918ea){_0x60c053['sendStatus'](0x194);}return _0x2918ea;};}function handleError(_0x4b9033,_0x1407f1){_0x1407f1=_0x1407f1||0x1f4;return function(_0xafe5f0){logger[_0x09cb('0x23')](_0xafe5f0['stack']);if(_0xafe5f0[_0x09cb('0x24')]){delete _0xafe5f0['name'];}_0x4b9033[_0x09cb('0x16')](_0x1407f1)['send'](_0xafe5f0);};}exports[_0x09cb('0x25')]=function(_0x2649ae,_0x382ea2){var _0x583418={},_0x4d5aad={},_0x1a42fc={'count':0x0,'rows':[]};var _0x34e238=_[_0x09cb('0x26')](db[_0x09cb('0x27')]['rawAttributes'],function(_0x461df9){return{'name':_0x461df9[_0x09cb('0x28')],'type':_0x461df9[_0x09cb('0x29')][_0x09cb('0x2a')]};});_0x4d5aad['model']=_[_0x09cb('0x26')](_0x34e238,_0x09cb('0x24'));_0x4d5aad['query']=_[_0x09cb('0x2b')](_0x2649ae[_0x09cb('0x2c')]);_0x4d5aad[_0x09cb('0x2d')]=_['intersection'](_0x4d5aad['model'],_0x4d5aad[_0x09cb('0x2c')]);_0x583418[_0x09cb('0x2e')]=_[_0x09cb('0x2f')](_0x4d5aad[_0x09cb('0x30')],qs[_0x09cb('0x31')](_0x2649ae['query'][_0x09cb('0x31')]));_0x583418['attributes']=_0x583418[_0x09cb('0x2e')]['length']?_0x583418[_0x09cb('0x2e')]:_0x4d5aad[_0x09cb('0x30')];if(!_0x2649ae['query']['hasOwnProperty'](_0x09cb('0x32'))){_0x583418[_0x09cb('0x1b')]=qs['limit'](_0x2649ae[_0x09cb('0x2c')][_0x09cb('0x1b')]);_0x583418[_0x09cb('0x19')]=qs[_0x09cb('0x19')](_0x2649ae[_0x09cb('0x2c')][_0x09cb('0x19')]);}_0x583418[_0x09cb('0x33')]=qs[_0x09cb('0x34')](_0x2649ae[_0x09cb('0x2c')][_0x09cb('0x34')]);_0x583418[_0x09cb('0x35')]=qs['filters'](_[_0x09cb('0x36')](_0x2649ae[_0x09cb('0x2c')],_0x4d5aad[_0x09cb('0x2d')]),_0x34e238);if(_0x2649ae['query'][_0x09cb('0x37')]){_0x583418[_0x09cb('0x35')]=_[_0x09cb('0x38')](_0x583418['where'],{'$or':_[_0x09cb('0x26')](_0x34e238,function(_0xfd717){if(_0xfd717[_0x09cb('0x29')]!=='VIRTUAL'){var _0x40e335={};_0x40e335[_0xfd717['name']]={'$like':'%'+_0x2649ae[_0x09cb('0x2c')]['filter']+'%'};return _0x40e335;}})});}_0x583418=_['merge']({},_0x583418,_0x2649ae[_0x09cb('0x39')]);var _0x117860={'where':_0x583418[_0x09cb('0x35')]};return db[_0x09cb('0x27')][_0x09cb('0x1c')](_0x117860)[_0x09cb('0x21')](function(_0x5a66b0){_0x1a42fc[_0x09cb('0x1c')]=_0x5a66b0;if(_0x2649ae[_0x09cb('0x2c')][_0x09cb('0x3a')]){_0x583418[_0x09cb('0x3b')]=[{'all':!![]}];}return db[_0x09cb('0x27')][_0x09cb('0x3c')](_0x583418);})[_0x09cb('0x21')](function(_0x58faeb){_0x1a42fc['rows']=_0x58faeb;return _0x1a42fc;})[_0x09cb('0x21')](respondWithFilteredResult(_0x382ea2,_0x583418))[_0x09cb('0x3d')](handleError(_0x382ea2,null));};exports[_0x09cb('0x3e')]=function(_0xe33045,_0x43cbd5){var _0x4ba255={'raw':![],'where':{'id':_0xe33045[_0x09cb('0x3f')]['id']}},_0x573899={};_0x573899[_0x09cb('0x30')]=_['keys'](db[_0x09cb('0x27')][_0x09cb('0x40')]);_0x573899['query']=_['keys'](_0xe33045[_0x09cb('0x2c')]);_0x573899[_0x09cb('0x2d')]=_[_0x09cb('0x2f')](_0x573899[_0x09cb('0x30')],_0x573899[_0x09cb('0x2c')]);_0x4ba255[_0x09cb('0x2e')]=_[_0x09cb('0x2f')](_0x573899['model'],qs[_0x09cb('0x31')](_0xe33045[_0x09cb('0x2c')]['fields']));_0x4ba255[_0x09cb('0x2e')]=_0x4ba255[_0x09cb('0x2e')][_0x09cb('0x41')]?_0x4ba255[_0x09cb('0x2e')]:_0x573899[_0x09cb('0x30')];if(_0xe33045[_0x09cb('0x2c')][_0x09cb('0x3a')]){_0x4ba255[_0x09cb('0x3b')]=[{'all':!![]}];}_0x4ba255=_[_0x09cb('0x38')]({},_0x4ba255,_0xe33045[_0x09cb('0x39')]);return db['SugarcrmConfiguration'][_0x09cb('0x42')](_0x4ba255)[_0x09cb('0x21')](handleEntityNotFound(_0x43cbd5,null))[_0x09cb('0x21')](respondWithResult(_0x43cbd5,null))['catch'](handleError(_0x43cbd5,null));};exports[_0x09cb('0x43')]=function(_0x54a22e,_0x2494f4){return db[_0x09cb('0x27')][_0x09cb('0x43')](_0x54a22e[_0x09cb('0x44')],{})[_0x09cb('0x21')](respondWithResult(_0x2494f4,0xc9))[_0x09cb('0x3d')](handleError(_0x2494f4,null));};exports[_0x09cb('0x20')]=function(_0x15c09,_0x4e477c){if(_0x15c09[_0x09cb('0x44')]['id']){delete _0x15c09[_0x09cb('0x44')]['id'];}return db[_0x09cb('0x27')][_0x09cb('0x42')]({'where':{'id':_0x15c09[_0x09cb('0x3f')]['id']}})[_0x09cb('0x21')](handleEntityNotFound(_0x4e477c,null))['then'](saveUpdates(_0x15c09[_0x09cb('0x44')],null))['then'](respondWithResult(_0x4e477c,null))['catch'](handleError(_0x4e477c,null));};exports['destroy']=function(_0x2b1891,_0x28827f){return db[_0x09cb('0x27')][_0x09cb('0x42')]({'where':{'id':_0x2b1891[_0x09cb('0x3f')]['id']}})[_0x09cb('0x21')](handleEntityNotFound(_0x28827f,null))[_0x09cb('0x21')](removeEntity(_0x28827f,null))['catch'](handleError(_0x28827f,null));};exports[_0x09cb('0x45')]=function(_0xceb667,_0x443fe4,_0x106b6a){var _0x1246ee={};var _0x50ad51={};var _0x24ebab;var _0x59872f;return db[_0x09cb('0x27')][_0x09cb('0x46')]({'where':{'id':_0xceb667[_0x09cb('0x3f')]['id']}})['then'](handleEntityNotFound(_0x443fe4,null))['then'](function(_0x401654){if(_0x401654){_0x24ebab=_0x401654;_0x50ad51[_0x09cb('0x30')]=_[_0x09cb('0x2b')](db[_0x09cb('0x47')][_0x09cb('0x40')]);_0x50ad51[_0x09cb('0x2c')]=_[_0x09cb('0x2b')](_0xceb667['query']);_0x50ad51['filters']=_[_0x09cb('0x2f')](_0x50ad51['model'],_0x50ad51[_0x09cb('0x2c')]);_0x1246ee['attributes']=_[_0x09cb('0x2f')](_0x50ad51[_0x09cb('0x30')],qs[_0x09cb('0x31')](_0xceb667[_0x09cb('0x2c')][_0x09cb('0x31')]));_0x1246ee['attributes']=_0x1246ee[_0x09cb('0x2e')][_0x09cb('0x41')]?_0x1246ee[_0x09cb('0x2e')]:_0x50ad51[_0x09cb('0x30')];_0x1246ee['order']=qs[_0x09cb('0x34')](_0xceb667['query'][_0x09cb('0x34')]);_0x1246ee[_0x09cb('0x35')]=qs[_0x09cb('0x2d')](_[_0x09cb('0x36')](_0xceb667['query'],_0x50ad51[_0x09cb('0x2d')]));if(_0xceb667['query'][_0x09cb('0x37')]){_0x1246ee[_0x09cb('0x35')]=_[_0x09cb('0x38')](_0x1246ee[_0x09cb('0x35')],{'$or':_[_0x09cb('0x26')](_0x1246ee[_0x09cb('0x2e')],function(_0x165a89){var _0xd47db0={};_0xd47db0[_0x165a89]={'$like':'%'+_0xceb667[_0x09cb('0x2c')][_0x09cb('0x37')]+'%'};return _0xd47db0;})});}_0x1246ee=_['merge']({},_0x1246ee,_0xceb667[_0x09cb('0x39')]);return _0x24ebab[_0x09cb('0x45')](_0x1246ee);}})[_0x09cb('0x21')](function(_0x2ac383){if(_0x2ac383){_0x59872f=_0x2ac383[_0x09cb('0x41')];if(!_0xceb667[_0x09cb('0x2c')][_0x09cb('0x48')]('nolimit')){_0x1246ee['limit']=qs['limit'](_0xceb667['query'][_0x09cb('0x1b')]);_0x1246ee['offset']=qs[_0x09cb('0x19')](_0xceb667[_0x09cb('0x2c')][_0x09cb('0x19')]);}return _0x24ebab[_0x09cb('0x45')](_0x1246ee);}})['then'](function(_0x2c4b33){if(_0x2c4b33){return _0x2c4b33?{'count':_0x59872f,'rows':_0x2c4b33}:null;}})[_0x09cb('0x21')](respondWithResult(_0x443fe4,null))[_0x09cb('0x3d')](handleError(_0x443fe4,null));};exports['getSubjects']=function(_0x5b3033,_0x4b4e1a,_0x4ff9bd){var _0x4860b4={};var _0x1cfd3d={};var _0x2bec28;var _0x52bf65;return db[_0x09cb('0x27')]['findOne']({'where':{'id':_0x5b3033[_0x09cb('0x3f')]['id']}})[_0x09cb('0x21')](handleEntityNotFound(_0x4b4e1a,null))[_0x09cb('0x21')](function(_0x4d0dcf){if(_0x4d0dcf){_0x2bec28=_0x4d0dcf;_0x1cfd3d[_0x09cb('0x30')]=_[_0x09cb('0x2b')](db['SugarcrmField'][_0x09cb('0x40')]);_0x1cfd3d['query']=_[_0x09cb('0x2b')](_0x5b3033[_0x09cb('0x2c')]);_0x1cfd3d[_0x09cb('0x2d')]=_[_0x09cb('0x2f')](_0x1cfd3d[_0x09cb('0x30')],_0x1cfd3d[_0x09cb('0x2c')]);_0x4860b4[_0x09cb('0x2e')]=_[_0x09cb('0x2f')](_0x1cfd3d['model'],qs[_0x09cb('0x31')](_0x5b3033[_0x09cb('0x2c')][_0x09cb('0x31')]));_0x4860b4[_0x09cb('0x2e')]=_0x4860b4['attributes']['length']?_0x4860b4[_0x09cb('0x2e')]:_0x1cfd3d[_0x09cb('0x30')];_0x4860b4[_0x09cb('0x33')]=qs[_0x09cb('0x34')](_0x5b3033[_0x09cb('0x2c')][_0x09cb('0x34')]);_0x4860b4[_0x09cb('0x35')]=qs[_0x09cb('0x2d')](_['pick'](_0x5b3033['query'],_0x1cfd3d[_0x09cb('0x2d')]));if(_0x5b3033[_0x09cb('0x2c')]['filter']){_0x4860b4[_0x09cb('0x35')]=_['merge'](_0x4860b4[_0x09cb('0x35')],{'$or':_[_0x09cb('0x26')](_0x4860b4[_0x09cb('0x2e')],function(_0x5430d1){var _0x1f66c1={};_0x1f66c1[_0x5430d1]={'$like':'%'+_0x5b3033[_0x09cb('0x2c')][_0x09cb('0x37')]+'%'};return _0x1f66c1;})});}_0x4860b4=_[_0x09cb('0x38')]({},_0x4860b4,_0x5b3033[_0x09cb('0x39')]);return _0x2bec28[_0x09cb('0x49')](_0x4860b4);}})[_0x09cb('0x21')](function(_0x5e782e){if(_0x5e782e){_0x52bf65=_0x5e782e['length'];if(!_0x5b3033[_0x09cb('0x2c')]['hasOwnProperty']('nolimit')){_0x4860b4[_0x09cb('0x1b')]=qs['limit'](_0x5b3033[_0x09cb('0x2c')][_0x09cb('0x1b')]);_0x4860b4[_0x09cb('0x19')]=qs[_0x09cb('0x19')](_0x5b3033[_0x09cb('0x2c')][_0x09cb('0x19')]);}return _0x2bec28['getSubjects'](_0x4860b4);}})[_0x09cb('0x21')](function(_0x3805ed){if(_0x3805ed){return _0x3805ed?{'count':_0x52bf65,'rows':_0x3805ed}:null;}})[_0x09cb('0x21')](respondWithResult(_0x4b4e1a,null))['catch'](handleError(_0x4b4e1a,null));};exports[_0x09cb('0x4a')]=function(_0x25178e,_0x1f0a28,_0x2a2f06){var _0x44a919={};var _0x269d24={};var _0x36cec9;var _0x1b8813;return db[_0x09cb('0x27')]['findOne']({'where':{'id':_0x25178e['params']['id']}})[_0x09cb('0x21')](handleEntityNotFound(_0x1f0a28,null))[_0x09cb('0x21')](function(_0x25d6e0){if(_0x25d6e0){_0x36cec9=_0x25d6e0;_0x269d24[_0x09cb('0x30')]=_['keys'](db[_0x09cb('0x47')][_0x09cb('0x40')]);_0x269d24[_0x09cb('0x2c')]=_['keys'](_0x25178e[_0x09cb('0x2c')]);_0x269d24[_0x09cb('0x2d')]=_[_0x09cb('0x2f')](_0x269d24[_0x09cb('0x30')],_0x269d24[_0x09cb('0x2c')]);_0x44a919[_0x09cb('0x2e')]=_[_0x09cb('0x2f')](_0x269d24[_0x09cb('0x30')],qs[_0x09cb('0x31')](_0x25178e[_0x09cb('0x2c')][_0x09cb('0x31')]));_0x44a919[_0x09cb('0x2e')]=_0x44a919[_0x09cb('0x2e')][_0x09cb('0x41')]?_0x44a919[_0x09cb('0x2e')]:_0x269d24[_0x09cb('0x30')];_0x44a919[_0x09cb('0x33')]=qs[_0x09cb('0x34')](_0x25178e[_0x09cb('0x2c')][_0x09cb('0x34')]);_0x44a919[_0x09cb('0x35')]=qs['filters'](_[_0x09cb('0x36')](_0x25178e[_0x09cb('0x2c')],_0x269d24['filters']));if(_0x25178e[_0x09cb('0x2c')][_0x09cb('0x37')]){_0x44a919[_0x09cb('0x35')]=_[_0x09cb('0x38')](_0x44a919[_0x09cb('0x35')],{'$or':_[_0x09cb('0x26')](_0x44a919[_0x09cb('0x2e')],function(_0x46d4c4){var _0x199f7b={};_0x199f7b[_0x46d4c4]={'$like':'%'+_0x25178e[_0x09cb('0x2c')][_0x09cb('0x37')]+'%'};return _0x199f7b;})});}_0x44a919=_[_0x09cb('0x38')]({},_0x44a919,_0x25178e[_0x09cb('0x39')]);return _0x36cec9['getDescriptions'](_0x44a919);}})[_0x09cb('0x21')](function(_0x49136a){if(_0x49136a){_0x1b8813=_0x49136a['length'];if(!_0x25178e[_0x09cb('0x2c')]['hasOwnProperty']('nolimit')){_0x44a919[_0x09cb('0x1b')]=qs[_0x09cb('0x1b')](_0x25178e['query'][_0x09cb('0x1b')]);_0x44a919[_0x09cb('0x19')]=qs[_0x09cb('0x19')](_0x25178e['query']['offset']);}return _0x36cec9[_0x09cb('0x4a')](_0x44a919);}})[_0x09cb('0x21')](function(_0x4c5330){if(_0x4c5330){return _0x4c5330?{'count':_0x1b8813,'rows':_0x4c5330}:null;}})[_0x09cb('0x21')](respondWithResult(_0x1f0a28,null))[_0x09cb('0x3d')](handleError(_0x1f0a28,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 3929144..792cdc4 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 _0x5de0=['int_sugarcrm_configurations','lodash','request-promise','path','rimraf','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration'];(function(_0x1f7fb2,_0x116309){var _0x61fc27=function(_0x4b981c){while(--_0x4b981c){_0x1f7fb2['push'](_0x1f7fb2['shift']());}};_0x61fc27(++_0x116309);}(_0x5de0,0x131));var _0x05de=function(_0x3ab42f,_0x3a6be1){_0x3ab42f=_0x3ab42f-0x0;var _0x1f9d6=_0x5de0[_0x3ab42f];return _0x1f9d6;};'use strict';var _=require(_0x05de('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x05de('0x1'));var fs=require('fs');var path=require(_0x05de('0x2'));var rimraf=require(_0x05de('0x3'));var config=require('../../config/environment');var attributes=require(_0x05de('0x4'));module[_0x05de('0x5')]=function(_0x1817c7,_0x41da5d){return _0x1817c7['define'](_0x05de('0x6'),attributes,{'tableName':_0x05de('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5707=['bluebird','request-promise','path','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x5707,0x1cf));var _0x7570=function(_0x1c3e42,_0x1a4fe9){_0x1c3e42=_0x1c3e42-0x0;var _0x348fdc=_0x5707[_0x1c3e42];return _0x348fdc;};'use strict';var _=require(_0x7570('0x0'));var util=require(_0x7570('0x1'));var logger=require(_0x7570('0x2'))(_0x7570('0x3'));var moment=require(_0x7570('0x4'));var BPromise=require(_0x7570('0x5'));var rp=require(_0x7570('0x6'));var fs=require('fs');var path=require(_0x7570('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7570('0x8'));module[_0x7570('0x9')]=function(_0x311d10,_0x26ada1){return _0x311d10[_0x7570('0xa')](_0x7570('0xb'),attributes,{'tableName':_0x7570('0xc'),'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 40467d8..8a82c71 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 _0x952d=['catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x58e025,_0xbeb690){var _0x1b9541=function(_0x130dca){while(--_0x130dca){_0x58e025['push'](_0x58e025['shift']());}};_0x1b9541(++_0xbeb690);}(_0x952d,0x1cf));var _0xd952=function(_0xabefa7,_0x13adf7){_0xabefa7=_0xabefa7-0x0;var _0x2df7b8=_0x952d[_0xabefa7];return _0x2df7b8;};'use strict';var _=require(_0xd952('0x0'));var util=require(_0xd952('0x1'));var moment=require('moment');var BPromise=require(_0xd952('0x2'));var rs=require(_0xd952('0x3'));var fs=require('fs');var Redis=require(_0xd952('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd952('0x5'));var logger=require(_0xd952('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd952('0x7'));var client=jayson[_0xd952('0x8')][_0xd952('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d15f8,_0x1b560e,_0x5ad7cc){return new BPromise(function(_0x503660,_0x53fbe8){return client[_0xd952('0xa')](_0x5d15f8,_0x5ad7cc)[_0xd952('0xb')](function(_0x1e9ad5){logger[_0xd952('0xc')](_0xd952('0xd'),_0x1b560e,_0xd952('0xe'));logger[_0xd952('0xf')](_0xd952('0x10'),_0x1b560e,_0xd952('0xe'),JSON['stringify'](_0x1e9ad5));if(_0x1e9ad5[_0xd952('0x11')]){if(_0x1e9ad5['error']['code']===0x1f4){logger['error'](_0xd952('0xd'),_0x1b560e,_0x1e9ad5['error'][_0xd952('0x12')]);return _0x53fbe8(_0x1e9ad5[_0xd952('0x11')]['message']);}logger[_0xd952('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1b560e,_0x1e9ad5['error'][_0xd952('0x12')]);return _0x503660(_0x1e9ad5[_0xd952('0x11')]['message']);}else{logger[_0xd952('0xc')](_0xd952('0xd'),_0x1b560e,_0xd952('0xe'));_0x503660(_0x1e9ad5[_0xd952('0x13')]['message']);}})[_0xd952('0x14')](function(_0x5792eb){logger[_0xd952('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1b560e,_0x5792eb);_0x53fbe8(_0x5792eb);});});} \ No newline at end of file +var _0x2c93=['ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','bluebird'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x2c93,0x120));var _0x32c9=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x2c93[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x32c9('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x32c9('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x32c9('0x2'));var logger=require('../../config/logger')(_0x32c9('0x3'));var config=require(_0x32c9('0x4'));var jayson=require(_0x32c9('0x5'));var client=jayson[_0x32c9('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44d1ec,_0x1648eb,_0x2c3c2c){return new BPromise(function(_0x3ca509,_0x52ea40){return client['request'](_0x44d1ec,_0x2c3c2c)[_0x32c9('0x7')](function(_0x3d5ae4){logger[_0x32c9('0x8')](_0x32c9('0x9'),_0x1648eb,'request\x20sent');logger[_0x32c9('0xa')](_0x32c9('0xb'),_0x1648eb,_0x32c9('0xc'),JSON['stringify'](_0x3d5ae4));if(_0x3d5ae4[_0x32c9('0xd')]){if(_0x3d5ae4[_0x32c9('0xd')]['code']===0x1f4){logger[_0x32c9('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1648eb,_0x3d5ae4[_0x32c9('0xd')]['message']);return _0x52ea40(_0x3d5ae4[_0x32c9('0xd')][_0x32c9('0xe')]);}logger['error'](_0x32c9('0x9'),_0x1648eb,_0x3d5ae4[_0x32c9('0xd')]['message']);return _0x3ca509(_0x3d5ae4[_0x32c9('0xd')][_0x32c9('0xe')]);}else{logger[_0x32c9('0x8')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1648eb,_0x32c9('0xc'));_0x3ca509(_0x3d5ae4[_0x32c9('0xf')][_0x32c9('0xe')]);}})[_0x32c9('0x10')](function(_0x5953c6){logger['error'](_0x32c9('0x9'),_0x1648eb,_0x5953c6);_0x52ea40(_0x5953c6);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 2269123..a6cbfa4 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 _0xacd8=['destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/:id','post','isAuthenticated','create','update','delete'];(function(_0x5799d6,_0x332e3b){var _0x3e901e=function(_0x4ac24e){while(--_0x4ac24e){_0x5799d6['push'](_0x5799d6['shift']());}};_0x3e901e(++_0x332e3b);}(_0xacd8,0xd2));var _0x8acd=function(_0xd80bee,_0x6c993b){_0xd80bee=_0xd80bee-0x0;var _0x276a88=_0xacd8[_0xd80bee];return _0x276a88;};'use strict';var multer=require(_0x8acd('0x0'));var util=require(_0x8acd('0x1'));var path=require(_0x8acd('0x2'));var timeout=require('connect-timeout');var express=require(_0x8acd('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8acd('0x4'));var interaction=require(_0x8acd('0x5'));var config=require(_0x8acd('0x6'));var controller=require('./intSugarcrmField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x8acd('0x7')]);router['get'](_0x8acd('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x8acd('0x9')]('/',auth[_0x8acd('0xa')](),controller[_0x8acd('0xb')]);router['put'](_0x8acd('0x8'),auth[_0x8acd('0xa')](),controller[_0x8acd('0xc')]);router[_0x8acd('0xd')](_0x8acd('0x8'),auth[_0x8acd('0xa')](),controller[_0x8acd('0xe')]);module[_0x8acd('0xf')]=router; \ No newline at end of file +var _0x9e77=['show','post','isAuthenticated','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','index','/:id'];(function(_0x163742,_0x467e36){var _0x1152ac=function(_0x40a83d){while(--_0x40a83d){_0x163742['push'](_0x163742['shift']());}};_0x1152ac(++_0x467e36);}(_0x9e77,0x1ad));var _0x79e7=function(_0x5e7f5f,_0x5de77f){_0x5e7f5f=_0x5e7f5f-0x0;var _0x468fb1=_0x9e77[_0x5e7f5f];return _0x468fb1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x79e7('0x0'));var timeout=require(_0x79e7('0x1'));var express=require(_0x79e7('0x2'));var router=express[_0x79e7('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x79e7('0x4'));var interaction=require(_0x79e7('0x5'));var config=require(_0x79e7('0x6'));var controller=require(_0x79e7('0x7'));router[_0x79e7('0x8')]('/',auth['isAuthenticated'](),controller[_0x79e7('0x9')]);router[_0x79e7('0x8')](_0x79e7('0xa'),auth['isAuthenticated'](),controller[_0x79e7('0xb')]);router[_0x79e7('0xc')]('/',auth[_0x79e7('0xd')](),controller[_0x79e7('0xe')]);router[_0x79e7('0xf')]('/:id',auth[_0x79e7('0xd')](),controller[_0x79e7('0x10')]);router[_0x79e7('0x11')](_0x79e7('0xa'),auth[_0x79e7('0xd')](),controller[_0x79e7('0x12')]);module[_0x79e7('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index ce231ec..152eb0b 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 _0x13a5=['STRING','exports','ENUM','string','customVariable','keyValue','picklist'];(function(_0x5a8aae,_0x97e1e){var _0x2c3368=function(_0x10bc2f){while(--_0x10bc2f){_0x5a8aae['push'](_0x5a8aae['shift']());}};_0x2c3368(++_0x97e1e);}(_0x13a5,0x9b));var _0x513a=function(_0x30fa9e,_0x4da10e){_0x30fa9e=_0x30fa9e-0x0;var _0x1aecd3=_0x13a5[_0x30fa9e];return _0x1aecd3;};'use strict';var Sequelize=require('sequelize');module[_0x513a('0x0')]={'type':{'type':Sequelize[_0x513a('0x1')](_0x513a('0x2'),'variable',_0x513a('0x3'),_0x513a('0x4'),_0x513a('0x5')),'defaultValue':_0x513a('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x513a('0x1')]('string','variable',_0x513a('0x3'))},'keyContent':{'type':Sequelize[_0x513a('0x6')]},'idField':{'type':Sequelize[_0x513a('0x6')]},'nameField':{'type':Sequelize[_0x513a('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x513a('0x6')]}}; \ No newline at end of file +var _0xb4cf=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x52aec5,_0x3b1faf){var _0x3f5583=function(_0x3c4077){while(--_0x3c4077){_0x52aec5['push'](_0x52aec5['shift']());}};_0x3f5583(++_0x3b1faf);}(_0xb4cf,0x169));var _0xfb4c=function(_0x53412d,_0x3897bd){_0x53412d=_0x53412d-0x0;var _0x5129de=_0xb4cf[_0x53412d];return _0x5129de;};'use strict';var Sequelize=require(_0xfb4c('0x0'));module[_0xfb4c('0x1')]={'type':{'type':Sequelize[_0xfb4c('0x2')](_0xfb4c('0x3'),_0xfb4c('0x4'),_0xfb4c('0x5'),_0xfb4c('0x6'),_0xfb4c('0x7')),'defaultValue':_0xfb4c('0x3')},'content':{'type':Sequelize[_0xfb4c('0x8')]},'key':{'type':Sequelize[_0xfb4c('0x8')]},'keyType':{'type':Sequelize[_0xfb4c('0x2')]('string',_0xfb4c('0x4'),_0xfb4c('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xfb4c('0x8')]},'customField':{'type':Sequelize[_0xfb4c('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfb4c('0x8')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index cad4ef2..4e7e801 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 _0xa99b=['to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','stack','name','send','map','SugarcrmField','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','options','include','rows','catch','params','rawAttributes','includeAll','create','find','body','rimraf','fast-json-patch','moment','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa99b,0x7e));var _0xba99=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xa99b[_0x3e5086];return _0xfeb102;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xba99('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xba99('0x1'));var rp=require('request-promise');var moment=require(_0xba99('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xba99('0x3'));var util=require(_0xba99('0x4'));var path=require('path');var sox=require(_0xba99('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xba99('0x6'));var _=require(_0xba99('0x7'));var squel=require(_0xba99('0x8'));var crypto=require(_0xba99('0x9'));var jsforce=require(_0xba99('0xa'));var deskjs=require(_0xba99('0xb'));var toCsv=require(_0xba99('0xc'));var querystring=require('querystring');var Papa=require(_0xba99('0xd'));var Redis=require(_0xba99('0xe'));var authService=require(_0xba99('0xf'));var qs=require(_0xba99('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xba99('0x11'));var logger=require(_0xba99('0x12'))(_0xba99('0x13'));var utils=require(_0xba99('0x14'));var config=require(_0xba99('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xba99('0x16'))['db'];function respondWithStatusCode(_0x3070b7,_0x221551){_0x221551=_0x221551||0xcc;return function(_0x43edaf){if(_0x43edaf){return _0x3070b7[_0xba99('0x17')](_0x221551);}return _0x3070b7[_0xba99('0x18')](_0x221551)[_0xba99('0x19')]();};}function respondWithResult(_0x2e05db,_0x2001ff){_0x2001ff=_0x2001ff||0xc8;return function(_0x314bbe){if(_0x314bbe){return _0x2e05db[_0xba99('0x18')](_0x2001ff)[_0xba99('0x1a')](_0x314bbe);}};}function respondWithFilteredResult(_0x3eaf10,_0x23f6e4){return function(_0x5c1985){if(_0x5c1985){var _0x2aac9b=typeof _0x23f6e4[_0xba99('0x1b')]===_0xba99('0x1c')&&typeof _0x23f6e4[_0xba99('0x1d')]===_0xba99('0x1c');var _0x1fcbe8=_0x5c1985[_0xba99('0x1e')];var _0x20c313=_0x2aac9b?0x0:_0x23f6e4[_0xba99('0x1b')];var _0x50a617=_0x2aac9b?_0x5c1985[_0xba99('0x1e')]:_0x23f6e4[_0xba99('0x1b')]+_0x23f6e4[_0xba99('0x1d')];var _0x2c7d45;if(_0x50a617>=_0x1fcbe8){_0x50a617=_0x1fcbe8;_0x2c7d45=0xc8;}else{_0x2c7d45=0xce;}_0x3eaf10[_0xba99('0x18')](_0x2c7d45);return _0x3eaf10['set'](_0xba99('0x1f'),_0x20c313+'-'+_0x50a617+'/'+_0x1fcbe8)['json'](_0x5c1985);}return null;};}function patchUpdates(_0x5939a0){return function(_0x5b23f7){try{jsonpatch[_0xba99('0x20')](_0x5b23f7,_0x5939a0,!![]);}catch(_0x3fd09e){return BPromise[_0xba99('0x21')](_0x3fd09e);}return _0x5b23f7[_0xba99('0x22')]();};}function saveUpdates(_0x2cc26e,_0x164633){return function(_0xf6f308){if(_0xf6f308){return _0xf6f308[_0xba99('0x23')](_0x2cc26e)[_0xba99('0x24')](function(_0x42639c){return _0x42639c;});}return null;};}function removeEntity(_0x30dc59,_0x1fc9a2){return function(_0x435e4b){if(_0x435e4b){return _0x435e4b['destroy']()[_0xba99('0x24')](function(){_0x30dc59[_0xba99('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b4a9b,_0xb6e329){return function(_0x178f1a){if(!_0x178f1a){_0x1b4a9b[_0xba99('0x17')](0x194);}return _0x178f1a;};}function handleError(_0x1ff829,_0x196b5a){_0x196b5a=_0x196b5a||0x1f4;return function(_0x3963a7){logger['error'](_0x3963a7[_0xba99('0x25')]);if(_0x3963a7[_0xba99('0x26')]){delete _0x3963a7[_0xba99('0x26')];}_0x1ff829[_0xba99('0x18')](_0x196b5a)[_0xba99('0x27')](_0x3963a7);};}exports['index']=function(_0x570124,_0x4e6484){var _0x3c5692={},_0x27241a={},_0x314676={'count':0x0,'rows':[]};var _0x5cde41=_[_0xba99('0x28')](db[_0xba99('0x29')]['rawAttributes'],function(_0x18ff1f){return{'name':_0x18ff1f[_0xba99('0x2a')],'type':_0x18ff1f[_0xba99('0x2b')][_0xba99('0x2c')]};});_0x27241a['model']=_[_0xba99('0x28')](_0x5cde41,_0xba99('0x26'));_0x27241a[_0xba99('0x2d')]=_[_0xba99('0x2e')](_0x570124[_0xba99('0x2d')]);_0x27241a[_0xba99('0x2f')]=_[_0xba99('0x30')](_0x27241a[_0xba99('0x31')],_0x27241a['query']);_0x3c5692['attributes']=_[_0xba99('0x30')](_0x27241a['model'],qs[_0xba99('0x32')](_0x570124[_0xba99('0x2d')]['fields']));_0x3c5692[_0xba99('0x33')]=_0x3c5692[_0xba99('0x33')][_0xba99('0x34')]?_0x3c5692['attributes']:_0x27241a[_0xba99('0x31')];if(!_0x570124[_0xba99('0x2d')][_0xba99('0x35')]('nolimit')){_0x3c5692[_0xba99('0x1d')]=qs[_0xba99('0x1d')](_0x570124[_0xba99('0x2d')][_0xba99('0x1d')]);_0x3c5692[_0xba99('0x1b')]=qs['offset'](_0x570124[_0xba99('0x2d')][_0xba99('0x1b')]);}_0x3c5692[_0xba99('0x36')]=qs['sort'](_0x570124['query'][_0xba99('0x37')]);_0x3c5692[_0xba99('0x38')]=qs[_0xba99('0x2f')](_['pick'](_0x570124[_0xba99('0x2d')],_0x27241a[_0xba99('0x2f')]),_0x5cde41);if(_0x570124['query']['filter']){_0x3c5692[_0xba99('0x38')]=_[_0xba99('0x39')](_0x3c5692[_0xba99('0x38')],{'$or':_[_0xba99('0x28')](_0x5cde41,function(_0x589604){if(_0x589604['type']!==_0xba99('0x3a')){var _0x17fa2c={};_0x17fa2c[_0x589604[_0xba99('0x26')]]={'$like':'%'+_0x570124[_0xba99('0x2d')]['filter']+'%'};return _0x17fa2c;}})});}_0x3c5692=_[_0xba99('0x39')]({},_0x3c5692,_0x570124[_0xba99('0x3b')]);var _0x49ab5c={'where':_0x3c5692['where']};return db[_0xba99('0x29')]['count'](_0x49ab5c)[_0xba99('0x24')](function(_0x3b8ab4){_0x314676[_0xba99('0x1e')]=_0x3b8ab4;if(_0x570124[_0xba99('0x2d')]['includeAll']){_0x3c5692[_0xba99('0x3c')]=[{'all':!![]}];}return db[_0xba99('0x29')]['findAll'](_0x3c5692);})['then'](function(_0x50b610){_0x314676[_0xba99('0x3d')]=_0x50b610;return _0x314676;})[_0xba99('0x24')](respondWithFilteredResult(_0x4e6484,_0x3c5692))[_0xba99('0x3e')](handleError(_0x4e6484,null));};exports['show']=function(_0x3d4464,_0x53b504){var _0x3daf4a={'raw':!![],'where':{'id':_0x3d4464[_0xba99('0x3f')]['id']}},_0x2d5607={};_0x2d5607[_0xba99('0x31')]=_[_0xba99('0x2e')](db['SugarcrmField'][_0xba99('0x40')]);_0x2d5607[_0xba99('0x2d')]=_[_0xba99('0x2e')](_0x3d4464[_0xba99('0x2d')]);_0x2d5607[_0xba99('0x2f')]=_['intersection'](_0x2d5607[_0xba99('0x31')],_0x2d5607[_0xba99('0x2d')]);_0x3daf4a[_0xba99('0x33')]=_[_0xba99('0x30')](_0x2d5607[_0xba99('0x31')],qs['fields'](_0x3d4464[_0xba99('0x2d')][_0xba99('0x32')]));_0x3daf4a[_0xba99('0x33')]=_0x3daf4a[_0xba99('0x33')][_0xba99('0x34')]?_0x3daf4a['attributes']:_0x2d5607[_0xba99('0x31')];if(_0x3d4464[_0xba99('0x2d')][_0xba99('0x41')]){_0x3daf4a[_0xba99('0x3c')]=[{'all':!![]}];}_0x3daf4a=_[_0xba99('0x39')]({},_0x3daf4a,_0x3d4464['options']);return db['SugarcrmField']['find'](_0x3daf4a)[_0xba99('0x24')](handleEntityNotFound(_0x53b504,null))['then'](respondWithResult(_0x53b504,null))['catch'](handleError(_0x53b504,null));};exports['create']=function(_0x3c640f,_0x502f7b){return db[_0xba99('0x29')][_0xba99('0x42')](_0x3c640f['body'],{})['then'](respondWithResult(_0x502f7b,0xc9))['catch'](handleError(_0x502f7b,null));};exports['update']=function(_0x512e30,_0x49e639){if(_0x512e30['body']['id']){delete _0x512e30['body']['id'];}return db[_0xba99('0x29')][_0xba99('0x43')]({'where':{'id':_0x512e30[_0xba99('0x3f')]['id']}})['then'](handleEntityNotFound(_0x49e639,null))[_0xba99('0x24')](saveUpdates(_0x512e30[_0xba99('0x44')],null))[_0xba99('0x24')](respondWithResult(_0x49e639,null))[_0xba99('0x3e')](handleError(_0x49e639,null));};exports['destroy']=function(_0x1820e6,_0x4e46f8){return db[_0xba99('0x29')][_0xba99('0x43')]({'where':{'id':_0x1820e6['params']['id']}})[_0xba99('0x24')](handleEntityNotFound(_0x4e46f8,null))[_0xba99('0x24')](removeEntity(_0x4e46f8,null))['catch'](handleError(_0x4e46f8,null));}; \ No newline at end of file +var _0x4dcf=['path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','undefined','count','set','apply','save','update','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','options','SugarcrmField','includeAll','include','findAll','rows','show','params','find','catch','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4dcf,0xd8));var _0xf4dc=function(_0x39d38e,_0x3da1f7){_0x39d38e=_0x39d38e-0x0;var _0x18e737=_0x4dcf[_0x39d38e];return _0x18e737;};'use strict';var emlformat=require(_0xf4dc('0x0'));var rimraf=require(_0xf4dc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf4dc('0x2'));var rp=require(_0xf4dc('0x3'));var moment=require(_0xf4dc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf4dc('0x5'));var util=require('util');var path=require(_0xf4dc('0x6'));var sox=require(_0xf4dc('0x7'));var csv=require(_0xf4dc('0x8'));var ejs=require(_0xf4dc('0x9'));var fs=require('fs');var fs_extra=require(_0xf4dc('0xa'));var _=require(_0xf4dc('0xb'));var squel=require(_0xf4dc('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf4dc('0xd'));var toCsv=require(_0xf4dc('0x8'));var querystring=require('querystring');var Papa=require(_0xf4dc('0xe'));var Redis=require(_0xf4dc('0xf'));var authService=require(_0xf4dc('0x10'));var qs=require(_0xf4dc('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf4dc('0x12'));var logger=require(_0xf4dc('0x13'))('api');var utils=require(_0xf4dc('0x14'));var config=require(_0xf4dc('0x15'));var licenseUtil=require(_0xf4dc('0x16'));var db=require(_0xf4dc('0x17'))['db'];function respondWithStatusCode(_0x1367d6,_0x5dcb58){_0x5dcb58=_0x5dcb58||0xcc;return function(_0x1ddbd9){if(_0x1ddbd9){return _0x1367d6['sendStatus'](_0x5dcb58);}return _0x1367d6['status'](_0x5dcb58)[_0xf4dc('0x18')]();};}function respondWithResult(_0x73c058,_0x4ffb21){_0x4ffb21=_0x4ffb21||0xc8;return function(_0x5d7cf5){if(_0x5d7cf5){return _0x73c058[_0xf4dc('0x19')](_0x4ffb21)[_0xf4dc('0x1a')](_0x5d7cf5);}};}function respondWithFilteredResult(_0x1e7076,_0x1efa71){return function(_0x452466){if(_0x452466){var _0x50dbcb=typeof _0x1efa71[_0xf4dc('0x1b')]==='undefined'&&typeof _0x1efa71[_0xf4dc('0x1c')]===_0xf4dc('0x1d');var _0x539df2=_0x452466['count'];var _0x440c01=_0x50dbcb?0x0:_0x1efa71[_0xf4dc('0x1b')];var _0xe298d0=_0x50dbcb?_0x452466[_0xf4dc('0x1e')]:_0x1efa71[_0xf4dc('0x1b')]+_0x1efa71[_0xf4dc('0x1c')];var _0x157807;if(_0xe298d0>=_0x539df2){_0xe298d0=_0x539df2;_0x157807=0xc8;}else{_0x157807=0xce;}_0x1e7076[_0xf4dc('0x19')](_0x157807);return _0x1e7076[_0xf4dc('0x1f')]('Content-Range',_0x440c01+'-'+_0xe298d0+'/'+_0x539df2)[_0xf4dc('0x1a')](_0x452466);}return null;};}function patchUpdates(_0x514ada){return function(_0x5578ad){try{jsonpatch[_0xf4dc('0x20')](_0x5578ad,_0x514ada,!![]);}catch(_0x592c03){return BPromise['reject'](_0x592c03);}return _0x5578ad[_0xf4dc('0x21')]();};}function saveUpdates(_0x1867f0,_0x4f9e06){return function(_0x25cbb1){if(_0x25cbb1){return _0x25cbb1[_0xf4dc('0x22')](_0x1867f0)[_0xf4dc('0x23')](function(_0x4d92a0){return _0x4d92a0;});}return null;};}function removeEntity(_0x33e418,_0x2892c6){return function(_0x403c0a){if(_0x403c0a){return _0x403c0a['destroy']()['then'](function(){_0x33e418['status'](0xcc)[_0xf4dc('0x18')]();});}};}function handleEntityNotFound(_0x2a56dd,_0x18639b){return function(_0x361063){if(!_0x361063){_0x2a56dd[_0xf4dc('0x24')](0x194);}return _0x361063;};}function handleError(_0x51fc17,_0x56f33){_0x56f33=_0x56f33||0x1f4;return function(_0x51bcc5){logger[_0xf4dc('0x25')](_0x51bcc5[_0xf4dc('0x26')]);if(_0x51bcc5[_0xf4dc('0x27')]){delete _0x51bcc5['name'];}_0x51fc17['status'](_0x56f33)[_0xf4dc('0x28')](_0x51bcc5);};}exports[_0xf4dc('0x29')]=function(_0x2f099e,_0x38dcb7){var _0x4fa20b={},_0x485018={},_0x572d13={'count':0x0,'rows':[]};var _0x36fb57=_[_0xf4dc('0x2a')](db['SugarcrmField'][_0xf4dc('0x2b')],function(_0x4d974a){return{'name':_0x4d974a[_0xf4dc('0x2c')],'type':_0x4d974a['type'][_0xf4dc('0x2d')]};});_0x485018[_0xf4dc('0x2e')]=_['map'](_0x36fb57,_0xf4dc('0x27'));_0x485018['query']=_[_0xf4dc('0x2f')](_0x2f099e[_0xf4dc('0x30')]);_0x485018[_0xf4dc('0x31')]=_[_0xf4dc('0x32')](_0x485018[_0xf4dc('0x2e')],_0x485018[_0xf4dc('0x30')]);_0x4fa20b[_0xf4dc('0x33')]=_[_0xf4dc('0x32')](_0x485018['model'],qs[_0xf4dc('0x34')](_0x2f099e[_0xf4dc('0x30')][_0xf4dc('0x34')]));_0x4fa20b[_0xf4dc('0x33')]=_0x4fa20b[_0xf4dc('0x33')][_0xf4dc('0x35')]?_0x4fa20b[_0xf4dc('0x33')]:_0x485018[_0xf4dc('0x2e')];if(!_0x2f099e[_0xf4dc('0x30')]['hasOwnProperty'](_0xf4dc('0x36'))){_0x4fa20b['limit']=qs['limit'](_0x2f099e[_0xf4dc('0x30')][_0xf4dc('0x1c')]);_0x4fa20b['offset']=qs[_0xf4dc('0x1b')](_0x2f099e[_0xf4dc('0x30')][_0xf4dc('0x1b')]);}_0x4fa20b[_0xf4dc('0x37')]=qs['sort'](_0x2f099e[_0xf4dc('0x30')][_0xf4dc('0x38')]);_0x4fa20b[_0xf4dc('0x39')]=qs[_0xf4dc('0x31')](_['pick'](_0x2f099e[_0xf4dc('0x30')],_0x485018[_0xf4dc('0x31')]),_0x36fb57);if(_0x2f099e['query'][_0xf4dc('0x3a')]){_0x4fa20b[_0xf4dc('0x39')]=_['merge'](_0x4fa20b[_0xf4dc('0x39')],{'$or':_['map'](_0x36fb57,function(_0x438331){if(_0x438331['type']!==_0xf4dc('0x3b')){var _0x187d1f={};_0x187d1f[_0x438331[_0xf4dc('0x27')]]={'$like':'%'+_0x2f099e[_0xf4dc('0x30')][_0xf4dc('0x3a')]+'%'};return _0x187d1f;}})});}_0x4fa20b=_[_0xf4dc('0x3c')]({},_0x4fa20b,_0x2f099e[_0xf4dc('0x3d')]);var _0x448ce8={'where':_0x4fa20b[_0xf4dc('0x39')]};return db[_0xf4dc('0x3e')][_0xf4dc('0x1e')](_0x448ce8)[_0xf4dc('0x23')](function(_0x28b16c){_0x572d13[_0xf4dc('0x1e')]=_0x28b16c;if(_0x2f099e[_0xf4dc('0x30')][_0xf4dc('0x3f')]){_0x4fa20b[_0xf4dc('0x40')]=[{'all':!![]}];}return db[_0xf4dc('0x3e')][_0xf4dc('0x41')](_0x4fa20b);})[_0xf4dc('0x23')](function(_0x439b2f){_0x572d13[_0xf4dc('0x42')]=_0x439b2f;return _0x572d13;})[_0xf4dc('0x23')](respondWithFilteredResult(_0x38dcb7,_0x4fa20b))['catch'](handleError(_0x38dcb7,null));};exports[_0xf4dc('0x43')]=function(_0x2fd378,_0x1f3cdd){var _0x1b52b0={'raw':!![],'where':{'id':_0x2fd378[_0xf4dc('0x44')]['id']}},_0x45b611={};_0x45b611['model']=_[_0xf4dc('0x2f')](db[_0xf4dc('0x3e')][_0xf4dc('0x2b')]);_0x45b611[_0xf4dc('0x30')]=_[_0xf4dc('0x2f')](_0x2fd378[_0xf4dc('0x30')]);_0x45b611['filters']=_[_0xf4dc('0x32')](_0x45b611['model'],_0x45b611[_0xf4dc('0x30')]);_0x1b52b0[_0xf4dc('0x33')]=_['intersection'](_0x45b611['model'],qs[_0xf4dc('0x34')](_0x2fd378['query'][_0xf4dc('0x34')]));_0x1b52b0['attributes']=_0x1b52b0['attributes'][_0xf4dc('0x35')]?_0x1b52b0[_0xf4dc('0x33')]:_0x45b611['model'];if(_0x2fd378[_0xf4dc('0x30')][_0xf4dc('0x3f')]){_0x1b52b0[_0xf4dc('0x40')]=[{'all':!![]}];}_0x1b52b0=_[_0xf4dc('0x3c')]({},_0x1b52b0,_0x2fd378[_0xf4dc('0x3d')]);return db[_0xf4dc('0x3e')][_0xf4dc('0x45')](_0x1b52b0)['then'](handleEntityNotFound(_0x1f3cdd,null))[_0xf4dc('0x23')](respondWithResult(_0x1f3cdd,null))[_0xf4dc('0x46')](handleError(_0x1f3cdd,null));};exports[_0xf4dc('0x47')]=function(_0xb80ea8,_0x563156){return db[_0xf4dc('0x3e')][_0xf4dc('0x47')](_0xb80ea8[_0xf4dc('0x48')],{})['then'](respondWithResult(_0x563156,0xc9))['catch'](handleError(_0x563156,null));};exports[_0xf4dc('0x22')]=function(_0x45be1d,_0x29102b){if(_0x45be1d['body']['id']){delete _0x45be1d[_0xf4dc('0x48')]['id'];}return db[_0xf4dc('0x3e')]['find']({'where':{'id':_0x45be1d[_0xf4dc('0x44')]['id']}})['then'](handleEntityNotFound(_0x29102b,null))[_0xf4dc('0x23')](saveUpdates(_0x45be1d['body'],null))[_0xf4dc('0x23')](respondWithResult(_0x29102b,null))[_0xf4dc('0x46')](handleError(_0x29102b,null));};exports[_0xf4dc('0x49')]=function(_0x2e4c99,_0x3511bb){return db[_0xf4dc('0x3e')]['find']({'where':{'id':_0x2e4c99[_0xf4dc('0x44')]['id']}})[_0xf4dc('0x23')](handleEntityNotFound(_0x3511bb,null))[_0xf4dc('0x23')](removeEntity(_0x3511bb,null))[_0xf4dc('0x46')](handleError(_0x3511bb,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 868d1b6..c2800f1 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 _0x6f7e=['define','SugarcrmField','int_sugarcrm_fields','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intSugarcrmField.attributes','exports'];(function(_0x40fb56,_0x44c1eb){var _0x143149=function(_0x549c1f){while(--_0x549c1f){_0x40fb56['push'](_0x40fb56['shift']());}};_0x143149(++_0x44c1eb);}(_0x6f7e,0xc7));var _0xe6f7=function(_0x51ea2e,_0x445b96){_0x51ea2e=_0x51ea2e-0x0;var _0x4f106d=_0x6f7e[_0x51ea2e];return _0x4f106d;};'use strict';var _=require(_0xe6f7('0x0'));var util=require(_0xe6f7('0x1'));var logger=require(_0xe6f7('0x2'))(_0xe6f7('0x3'));var moment=require(_0xe6f7('0x4'));var BPromise=require(_0xe6f7('0x5'));var rp=require(_0xe6f7('0x6'));var fs=require('fs');var path=require(_0xe6f7('0x7'));var rimraf=require('rimraf');var config=require(_0xe6f7('0x8'));var attributes=require(_0xe6f7('0x9'));module[_0xe6f7('0xa')]=function(_0x1edfe3,_0x25be7f){return _0x1edfe3[_0xe6f7('0xb')](_0xe6f7('0xc'),attributes,{'tableName':_0xe6f7('0xd'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':['idField',_0xe6f7('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbdd2=['SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','path','rimraf','./intSugarcrmField.attributes','exports'];(function(_0x5df77c,_0x3404c1){var _0x490a13=function(_0x476250){while(--_0x476250){_0x5df77c['push'](_0x5df77c['shift']());}};_0x490a13(++_0x3404c1);}(_0xbdd2,0x163));var _0x2bdd=function(_0x12311d,_0x28816c){_0x12311d=_0x12311d-0x0;var _0x51b2df=_0xbdd2[_0x12311d];return _0x51b2df;};'use strict';var _=require(_0x2bdd('0x0'));var util=require('util');var logger=require(_0x2bdd('0x1'))(_0x2bdd('0x2'));var moment=require(_0x2bdd('0x3'));var BPromise=require(_0x2bdd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2bdd('0x5'));var rimraf=require(_0x2bdd('0x6'));var config=require('../../config/environment');var attributes=require(_0x2bdd('0x7'));module[_0x2bdd('0x8')]=function(_0x301cbb,_0x557a5b){return _0x301cbb['define'](_0x2bdd('0x9'),attributes,{'tableName':_0x2bdd('0xa'),'paranoid':![],'indexes':[{'name':_0x2bdd('0xb'),'fields':[_0x2bdd('0xc'),_0x2bdd('0xd')],'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 ab29860..ec846be 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 _0xaede=['message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x35c584,_0x5c3a8d){var _0x234b3b=function(_0x5961dd){while(--_0x5961dd){_0x35c584['push'](_0x35c584['shift']());}};_0x234b3b(++_0x5c3a8d);}(_0xaede,0x1dc));var _0xeaed=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xaede[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xeaed('0x0'));var util=require(_0xeaed('0x1'));var moment=require(_0xeaed('0x2'));var BPromise=require(_0xeaed('0x3'));var rs=require(_0xeaed('0x4'));var fs=require('fs');var Redis=require(_0xeaed('0x5'));var db=require(_0xeaed('0x6'))['db'];var utils=require(_0xeaed('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xeaed('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xeaed('0x9')][_0xeaed('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xeefc0a,_0xf7ff6e,_0x2a2a09){return new BPromise(function(_0x148161,_0x23ffc6){return client[_0xeaed('0xb')](_0xeefc0a,_0x2a2a09)['then'](function(_0x4a5ae7){logger[_0xeaed('0xc')](_0xeaed('0xd'),_0xf7ff6e,_0xeaed('0xe'));logger[_0xeaed('0xf')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0xf7ff6e,_0xeaed('0xe'),JSON[_0xeaed('0x10')](_0x4a5ae7));if(_0x4a5ae7[_0xeaed('0x11')]){if(_0x4a5ae7[_0xeaed('0x11')]['code']===0x1f4){logger[_0xeaed('0x11')](_0xeaed('0xd'),_0xf7ff6e,_0x4a5ae7[_0xeaed('0x11')][_0xeaed('0x12')]);return _0x23ffc6(_0x4a5ae7['error'][_0xeaed('0x12')]);}logger['error'](_0xeaed('0xd'),_0xf7ff6e,_0x4a5ae7[_0xeaed('0x11')]['message']);return _0x148161(_0x4a5ae7['error']['message']);}else{logger[_0xeaed('0xc')]('SugarcrmField,\x20%s,\x20%s',_0xf7ff6e,_0xeaed('0xe'));_0x148161(_0x4a5ae7['result']['message']);}})['catch'](function(_0x353c48){logger[_0xeaed('0x11')](_0xeaed('0xd'),_0xf7ff6e,_0x353c48);_0x23ffc6(_0x353c48);});});} \ No newline at end of file +var _0xba1e=['http','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x477df7,_0x47eb5e){var _0x2b026d=function(_0x27d296){while(--_0x27d296){_0x477df7['push'](_0x477df7['shift']());}};_0x2b026d(++_0x47eb5e);}(_0xba1e,0x140));var _0xeba1=function(_0x475e85,_0x44bda5){_0x475e85=_0x475e85-0x0;var _0x2feb62=_0xba1e[_0x475e85];return _0x2feb62;};'use strict';var _=require('lodash');var util=require(_0xeba1('0x0'));var moment=require(_0xeba1('0x1'));var BPromise=require(_0xeba1('0x2'));var rs=require(_0xeba1('0x3'));var fs=require('fs');var Redis=require(_0xeba1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xeba1('0x5'));var logger=require(_0xeba1('0x6'))(_0xeba1('0x7'));var config=require('../../config/environment');var jayson=require(_0xeba1('0x8'));var client=jayson[_0xeba1('0x9')][_0xeba1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbec45b,_0x50395b,_0x1e8f4b){return new BPromise(function(_0x4e41f3,_0x32036a){return client['request'](_0xbec45b,_0x1e8f4b)[_0xeba1('0xb')](function(_0x2d14b5){logger[_0xeba1('0xc')](_0xeba1('0xd'),_0x50395b,_0xeba1('0xe'));logger['debug'](_0xeba1('0xf'),_0x50395b,'request\x20sent',JSON[_0xeba1('0x10')](_0x2d14b5));if(_0x2d14b5[_0xeba1('0x11')]){if(_0x2d14b5[_0xeba1('0x11')][_0xeba1('0x12')]===0x1f4){logger[_0xeba1('0x11')](_0xeba1('0xd'),_0x50395b,_0x2d14b5['error'][_0xeba1('0x13')]);return _0x32036a(_0x2d14b5[_0xeba1('0x11')]['message']);}logger['error'](_0xeba1('0xd'),_0x50395b,_0x2d14b5[_0xeba1('0x11')][_0xeba1('0x13')]);return _0x4e41f3(_0x2d14b5[_0xeba1('0x11')]['message']);}else{logger[_0xeba1('0xc')](_0xeba1('0xd'),_0x50395b,_0xeba1('0xe'));_0x4e41f3(_0x2d14b5[_0xeba1('0x14')]['message']);}})[_0xeba1('0x15')](function(_0x5387bb){logger[_0xeba1('0x11')](_0xeba1('0xd'),_0x50395b,_0x5387bb);_0x32036a(_0x5387bb);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index bc3cf1b..6646449 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 _0x579c=['delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id'];(function(_0x5535ae,_0x195d28){var _0x5f478c=function(_0x43e7b9){while(--_0x43e7b9){_0x5535ae['push'](_0x5535ae['shift']());}};_0x5f478c(++_0x195d28);}(_0x579c,0xda));var _0xc579=function(_0x22d694,_0x33bb96){_0x22d694=_0x22d694-0x0;var _0x58dc27=_0x579c[_0x22d694];return _0x58dc27;};'use strict';var multer=require(_0xc579('0x0'));var util=require(_0xc579('0x1'));var path=require(_0xc579('0x2'));var timeout=require(_0xc579('0x3'));var express=require(_0xc579('0x4'));var router=express['Router']();var fs_extra=require(_0xc579('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc579('0x6'));var config=require(_0xc579('0x7'));var controller=require(_0xc579('0x8'));router[_0xc579('0x9')]('/',auth[_0xc579('0xa')](),controller[_0xc579('0xb')]);router[_0xc579('0x9')]('/:id',auth[_0xc579('0xa')](),controller[_0xc579('0xc')]);router[_0xc579('0x9')](_0xc579('0xd'),auth[_0xc579('0xa')](),controller[_0xc579('0xe')]);router[_0xc579('0x9')](_0xc579('0xf'),auth['isAuthenticated'](),controller[_0xc579('0x10')]);router[_0xc579('0x11')]('/',auth[_0xc579('0xa')](),controller[_0xc579('0x12')]);router[_0xc579('0x11')](_0xc579('0xd'),auth[_0xc579('0xa')](),controller[_0xc579('0x13')]);router[_0xc579('0x14')](_0xc579('0x15'),auth[_0xc579('0xa')](),controller['update']);router[_0xc579('0x16')]('/:id',auth[_0xc579('0xa')](),controller['destroy']);module[_0xc579('0x17')]=router; \ No newline at end of file +var _0xbacb=['/:id','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration'];(function(_0x1763e7,_0x3b2c72){var _0x27c652=function(_0x2bc0a4){while(--_0x2bc0a4){_0x1763e7['push'](_0x1763e7['shift']());}};_0x27c652(++_0x3b2c72);}(_0xbacb,0x1a6));var _0xbbac=function(_0x47ad99,_0x44b6a3){_0x47ad99=_0x47ad99-0x0;var _0xebd3e9=_0xbacb[_0x47ad99];return _0xebd3e9;};'use strict';var multer=require(_0xbbac('0x0'));var util=require(_0xbbac('0x1'));var path=require('path');var timeout=require(_0xbbac('0x2'));var express=require(_0xbbac('0x3'));var router=express[_0xbbac('0x4')]();var fs_extra=require(_0xbbac('0x5'));var auth=require(_0xbbac('0x6'));var interaction=require(_0xbbac('0x7'));var config=require('../../config/environment');var controller=require('./intVtigerAccount.controller');router[_0xbbac('0x8')]('/',auth[_0xbbac('0x9')](),controller[_0xbbac('0xa')]);router[_0xbbac('0x8')]('/:id',auth[_0xbbac('0x9')](),controller[_0xbbac('0xb')]);router[_0xbbac('0x8')](_0xbbac('0xc'),auth[_0xbbac('0x9')](),controller[_0xbbac('0xd')]);router['get'](_0xbbac('0xe'),auth[_0xbbac('0x9')](),controller[_0xbbac('0xf')]);router[_0xbbac('0x10')]('/',auth[_0xbbac('0x9')](),controller['create']);router['post'](_0xbbac('0xc'),auth[_0xbbac('0x9')](),controller[_0xbbac('0x11')]);router['put'](_0xbbac('0x12'),auth['isAuthenticated'](),controller[_0xbbac('0x13')]);router[_0xbbac('0x14')]('/:id',auth[_0xbbac('0x9')](),controller[_0xbbac('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index e8bc452..d7c4545 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 _0xcdc0=['STRING','HelpDesk','exports'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xcdc0,0xaa));var _0x0cdc=function(_0x472833,_0x1c092f){_0x472833=_0x472833-0x0;var _0x342b1a=_0xcdc0[_0x472833];return _0x342b1a;};'use strict';var Sequelize=require('sequelize');module[_0x0cdc('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x0cdc('0x1')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0cdc('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x0cdc('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xb003=['STRING','HelpDesk','sequelize'];(function(_0x2440a0,_0x356299){var _0x3ca70c=function(_0x4fd15f){while(--_0x4fd15f){_0x2440a0['push'](_0x2440a0['shift']());}};_0x3ca70c(++_0x356299);}(_0xb003,0x1a3));var _0x3b00=function(_0x21b0ef,_0x2bec64){_0x21b0ef=_0x21b0ef-0x0;var _0x135500=_0xb003[_0x21b0ef];return _0x135500;};'use strict';var Sequelize=require(_0x3b00('0x0'));module['exports']={'name':{'type':Sequelize[_0x3b00('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x3b00('0x1')]},'username':{'type':Sequelize[_0x3b00('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x3b00('0x1')],'allowNull':![],'defaultValue':_0x3b00('0x2')},'remoteUri':{'type':Sequelize[_0x3b00('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x3b00('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index a8581db..c6532f7 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 _0xf796=['destroy','end','error','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','length','find','create','body','getConfigurations','findOne','nolimit','limit','addConfiguration','AccountId','Subjects','channel','type','Descriptions','getDescriptions','VtigerConfiguration','VtigerField','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','format','%s/webservice.php','getchallenge','success','login','describe','result','sessionName','autogenerated','owner','remove','includes','editable','false','label','startsWith','cf_','picklistValues','value','log','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','save','then'];(function(_0x5a1a26,_0x2060ca){var _0x13ec41=function(_0x33b1e4){while(--_0x33b1e4){_0x5a1a26['push'](_0x5a1a26['shift']());}};_0x13ec41(++_0x2060ca);}(_0xf796,0x13e));var _0x6f79=function(_0x5ed237,_0x11f79b){_0x5ed237=_0x5ed237-0x0;var _0x6d29c=_0xf796[_0x5ed237];return _0x6d29c;};'use strict';var emlformat=require(_0x6f79('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6f79('0x1'));var jsonpatch=require(_0x6f79('0x2'));var rp=require(_0x6f79('0x3'));var moment=require(_0x6f79('0x4'));var BPromise=require(_0x6f79('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6f79('0x6'));var sox=require(_0x6f79('0x7'));var csv=require(_0x6f79('0x8'));var ejs=require(_0x6f79('0x9'));var fs=require('fs');var fs_extra=require(_0x6f79('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6f79('0xb'));var jsforce=require(_0x6f79('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6f79('0x8'));var querystring=require(_0x6f79('0xd'));var Papa=require(_0x6f79('0xe'));var Redis=require(_0x6f79('0xf'));var authService=require(_0x6f79('0x10'));var qs=require(_0x6f79('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6f79('0x12'))(_0x6f79('0x13'));var utils=require(_0x6f79('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x6f79('0x15'));function respondWithStatusCode(_0x8f8259,_0x53be9f){_0x53be9f=_0x53be9f||0xcc;return function(_0x4d3dcf){if(_0x4d3dcf){return _0x8f8259[_0x6f79('0x16')](_0x53be9f);}return _0x8f8259[_0x6f79('0x17')](_0x53be9f)['end']();};}function respondWithResult(_0x580e80,_0x80bec6){_0x80bec6=_0x80bec6||0xc8;return function(_0x5f1f1a){if(_0x5f1f1a){return _0x580e80['status'](_0x80bec6)[_0x6f79('0x18')](_0x5f1f1a);}};}function respondWithFilteredResult(_0x1456a6,_0x1b2c14){return function(_0x509521){if(_0x509521){var _0x4f9188=typeof _0x1b2c14[_0x6f79('0x19')]===_0x6f79('0x1a')&&typeof _0x1b2c14['limit']===_0x6f79('0x1a');var _0x19746e=_0x509521['count'];var _0x5c7fe6=_0x4f9188?0x0:_0x1b2c14[_0x6f79('0x19')];var _0x470e5c=_0x4f9188?_0x509521[_0x6f79('0x1b')]:_0x1b2c14[_0x6f79('0x19')]+_0x1b2c14['limit'];var _0x2f7422;if(_0x470e5c>=_0x19746e){_0x470e5c=_0x19746e;_0x2f7422=0xc8;}else{_0x2f7422=0xce;}_0x1456a6[_0x6f79('0x17')](_0x2f7422);return _0x1456a6[_0x6f79('0x1c')](_0x6f79('0x1d'),_0x5c7fe6+'-'+_0x470e5c+'/'+_0x19746e)['json'](_0x509521);}return null;};}function patchUpdates(_0x3cafcf){return function(_0x5a69be){try{jsonpatch[_0x6f79('0x1e')](_0x5a69be,_0x3cafcf,!![]);}catch(_0x386e7e){return BPromise['reject'](_0x386e7e);}return _0x5a69be[_0x6f79('0x1f')]();};}function saveUpdates(_0x1ed345,_0x583e53){return function(_0x3df68a){if(_0x3df68a){return _0x3df68a['update'](_0x1ed345)[_0x6f79('0x20')](function(_0x329a40){return _0x329a40;});}return null;};}function removeEntity(_0x50c56f,_0x22cc7d){return function(_0x5ee898){if(_0x5ee898){return _0x5ee898[_0x6f79('0x21')]()[_0x6f79('0x20')](function(){_0x50c56f[_0x6f79('0x17')](0xcc)[_0x6f79('0x22')]();});}};}function handleEntityNotFound(_0x143cb8,_0x1354fa){return function(_0x2a3ac9){if(!_0x2a3ac9){_0x143cb8[_0x6f79('0x16')](0x194);}return _0x2a3ac9;};}function handleError(_0x345342,_0x443a95){_0x443a95=_0x443a95||0x1f4;return function(_0x2033ba){logger[_0x6f79('0x23')](_0x2033ba[_0x6f79('0x24')]);if(_0x2033ba[_0x6f79('0x25')]){delete _0x2033ba[_0x6f79('0x25')];}_0x345342['status'](_0x443a95)[_0x6f79('0x26')](_0x2033ba);};}exports[_0x6f79('0x27')]=function(_0x4e03f3,_0x5c2aef){var _0xa724d8={},_0x3301b5={},_0x1526d7={'count':0x0,'rows':[]};var _0xfdc41a=_[_0x6f79('0x28')](db[_0x6f79('0x29')][_0x6f79('0x2a')],function(_0x2132a4){return{'name':_0x2132a4[_0x6f79('0x2b')],'type':_0x2132a4['type']['key']};});_0x3301b5['model']=_[_0x6f79('0x28')](_0xfdc41a,_0x6f79('0x25'));_0x3301b5[_0x6f79('0x2c')]=_[_0x6f79('0x2d')](_0x4e03f3[_0x6f79('0x2c')]);_0x3301b5[_0x6f79('0x2e')]=_['intersection'](_0x3301b5[_0x6f79('0x2f')],_0x3301b5['query']);_0xa724d8[_0x6f79('0x30')]=_[_0x6f79('0x31')](_0x3301b5[_0x6f79('0x2f')],qs[_0x6f79('0x32')](_0x4e03f3['query'][_0x6f79('0x32')]));_0xa724d8[_0x6f79('0x30')]=_0xa724d8[_0x6f79('0x30')]['length']?_0xa724d8[_0x6f79('0x30')]:_0x3301b5[_0x6f79('0x2f')];if(!_0x4e03f3[_0x6f79('0x2c')][_0x6f79('0x33')]('nolimit')){_0xa724d8['limit']=qs['limit'](_0x4e03f3[_0x6f79('0x2c')]['limit']);_0xa724d8[_0x6f79('0x19')]=qs[_0x6f79('0x19')](_0x4e03f3[_0x6f79('0x2c')][_0x6f79('0x19')]);}_0xa724d8[_0x6f79('0x34')]=qs[_0x6f79('0x35')](_0x4e03f3[_0x6f79('0x2c')]['sort']);_0xa724d8[_0x6f79('0x36')]=qs['filters'](_[_0x6f79('0x37')](_0x4e03f3[_0x6f79('0x2c')],_0x3301b5[_0x6f79('0x2e')]),_0xfdc41a);if(_0x4e03f3[_0x6f79('0x2c')]['filter']){_0xa724d8[_0x6f79('0x36')]=_[_0x6f79('0x38')](_0xa724d8['where'],{'$or':_[_0x6f79('0x28')](_0xfdc41a,function(_0x1225bb){if(_0x1225bb['type']!==_0x6f79('0x39')){var _0xd64e7c={};_0xd64e7c[_0x1225bb[_0x6f79('0x25')]]={'$like':'%'+_0x4e03f3[_0x6f79('0x2c')][_0x6f79('0x3a')]+'%'};return _0xd64e7c;}})});}_0xa724d8=_[_0x6f79('0x38')]({},_0xa724d8,_0x4e03f3[_0x6f79('0x3b')]);var _0x37b22a={'where':_0xa724d8[_0x6f79('0x36')]};return db['VtigerAccount'][_0x6f79('0x1b')](_0x37b22a)['then'](function(_0x5d4b17){_0x1526d7[_0x6f79('0x1b')]=_0x5d4b17;if(_0x4e03f3[_0x6f79('0x2c')][_0x6f79('0x3c')]){_0xa724d8[_0x6f79('0x3d')]=[{'all':!![]}];}return db[_0x6f79('0x29')]['findAll'](_0xa724d8);})['then'](function(_0x2c720d){_0x1526d7[_0x6f79('0x3e')]=_0x2c720d;return _0x1526d7;})[_0x6f79('0x20')](respondWithFilteredResult(_0x5c2aef,_0xa724d8))[_0x6f79('0x3f')](handleError(_0x5c2aef,null));};exports[_0x6f79('0x40')]=function(_0x2d1d00,_0x564653){var _0x43211a={'raw':![],'where':{'id':_0x2d1d00[_0x6f79('0x41')]['id']}},_0x5f5275={};_0x5f5275[_0x6f79('0x2f')]=_[_0x6f79('0x2d')](db['VtigerAccount'][_0x6f79('0x2a')]);_0x5f5275[_0x6f79('0x2c')]=_[_0x6f79('0x2d')](_0x2d1d00[_0x6f79('0x2c')]);_0x5f5275[_0x6f79('0x2e')]=_['intersection'](_0x5f5275[_0x6f79('0x2f')],_0x5f5275[_0x6f79('0x2c')]);_0x43211a[_0x6f79('0x30')]=_[_0x6f79('0x31')](_0x5f5275[_0x6f79('0x2f')],qs[_0x6f79('0x32')](_0x2d1d00['query'][_0x6f79('0x32')]));_0x43211a[_0x6f79('0x30')]=_0x43211a[_0x6f79('0x30')][_0x6f79('0x42')]?_0x43211a[_0x6f79('0x30')]:_0x5f5275[_0x6f79('0x2f')];if(_0x2d1d00[_0x6f79('0x2c')]['includeAll']){_0x43211a[_0x6f79('0x3d')]=[{'all':!![]}];}_0x43211a=_[_0x6f79('0x38')]({},_0x43211a,_0x2d1d00[_0x6f79('0x3b')]);return db[_0x6f79('0x29')][_0x6f79('0x43')](_0x43211a)['then'](handleEntityNotFound(_0x564653,null))[_0x6f79('0x20')](respondWithResult(_0x564653,null))[_0x6f79('0x3f')](handleError(_0x564653,null));};exports['create']=function(_0x280fda,_0x1d1409){return db[_0x6f79('0x29')][_0x6f79('0x44')](_0x280fda[_0x6f79('0x45')],{})[_0x6f79('0x20')](respondWithResult(_0x1d1409,0xc9))[_0x6f79('0x3f')](handleError(_0x1d1409,null));};exports['update']=function(_0x1dd83f,_0x3c6f5b){if(_0x1dd83f['body']['id']){delete _0x1dd83f[_0x6f79('0x45')]['id'];}return db[_0x6f79('0x29')][_0x6f79('0x43')]({'where':{'id':_0x1dd83f['params']['id']}})['then'](handleEntityNotFound(_0x3c6f5b,null))[_0x6f79('0x20')](saveUpdates(_0x1dd83f['body'],null))['then'](respondWithResult(_0x3c6f5b,null))[_0x6f79('0x3f')](handleError(_0x3c6f5b,null));};exports[_0x6f79('0x21')]=function(_0x1f9f54,_0x573b2d){return db[_0x6f79('0x29')][_0x6f79('0x43')]({'where':{'id':_0x1f9f54[_0x6f79('0x41')]['id']}})['then'](handleEntityNotFound(_0x573b2d,null))[_0x6f79('0x20')](removeEntity(_0x573b2d,null))[_0x6f79('0x3f')](handleError(_0x573b2d,null));};exports[_0x6f79('0x46')]=function(_0xdbb1f,_0x14bd73,_0x567202){var _0x1c05bc={};var _0x498952={};var _0x128f87;var _0x232d2d;return db[_0x6f79('0x29')][_0x6f79('0x47')]({'where':{'id':_0xdbb1f[_0x6f79('0x41')]['id']}})[_0x6f79('0x20')](handleEntityNotFound(_0x14bd73,null))[_0x6f79('0x20')](function(_0x27da21){if(_0x27da21){_0x128f87=_0x27da21;_0x498952[_0x6f79('0x2f')]=_[_0x6f79('0x2d')](db['VtigerConfiguration'][_0x6f79('0x2a')]);_0x498952['query']=_[_0x6f79('0x2d')](_0xdbb1f['query']);_0x498952[_0x6f79('0x2e')]=_[_0x6f79('0x31')](_0x498952[_0x6f79('0x2f')],_0x498952[_0x6f79('0x2c')]);_0x1c05bc[_0x6f79('0x30')]=_[_0x6f79('0x31')](_0x498952[_0x6f79('0x2f')],qs['fields'](_0xdbb1f[_0x6f79('0x2c')][_0x6f79('0x32')]));_0x1c05bc[_0x6f79('0x30')]=_0x1c05bc[_0x6f79('0x30')][_0x6f79('0x42')]?_0x1c05bc[_0x6f79('0x30')]:_0x498952[_0x6f79('0x2f')];_0x1c05bc[_0x6f79('0x34')]=qs[_0x6f79('0x35')](_0xdbb1f['query'][_0x6f79('0x35')]);_0x1c05bc['where']=qs[_0x6f79('0x2e')](_[_0x6f79('0x37')](_0xdbb1f[_0x6f79('0x2c')],_0x498952[_0x6f79('0x2e')]));if(_0xdbb1f[_0x6f79('0x2c')][_0x6f79('0x3a')]){_0x1c05bc[_0x6f79('0x36')]=_[_0x6f79('0x38')](_0x1c05bc['where'],{'$or':_['map'](_0x1c05bc[_0x6f79('0x30')],function(_0x4b3d09){var _0xb385b9={};_0xb385b9[_0x4b3d09]={'$like':'%'+_0xdbb1f[_0x6f79('0x2c')][_0x6f79('0x3a')]+'%'};return _0xb385b9;})});}_0x1c05bc=_['merge']({},_0x1c05bc,_0xdbb1f[_0x6f79('0x3b')]);return _0x128f87[_0x6f79('0x46')](_0x1c05bc);}})[_0x6f79('0x20')](function(_0xb339c2){if(_0xb339c2){_0x232d2d=_0xb339c2[_0x6f79('0x42')];if(!_0xdbb1f[_0x6f79('0x2c')]['hasOwnProperty'](_0x6f79('0x48'))){_0x1c05bc[_0x6f79('0x49')]=qs[_0x6f79('0x49')](_0xdbb1f['query'][_0x6f79('0x49')]);_0x1c05bc[_0x6f79('0x19')]=qs[_0x6f79('0x19')](_0xdbb1f[_0x6f79('0x2c')]['offset']);}return _0x128f87[_0x6f79('0x46')](_0x1c05bc);}})[_0x6f79('0x20')](function(_0xd876f7){if(_0xd876f7){return _0xd876f7?{'count':_0x232d2d,'rows':_0xd876f7}:null;}})[_0x6f79('0x20')](respondWithResult(_0x14bd73,null))[_0x6f79('0x3f')](handleError(_0x14bd73,null));};exports[_0x6f79('0x4a')]=function(_0x1797bb,_0x4c355a,_0x5405e6){if(_0x1797bb[_0x6f79('0x45')]['id']){delete _0x1797bb[_0x6f79('0x45')]['id'];}return db['VtigerAccount'][_0x6f79('0x47')]({'where':{'id':_0x1797bb[_0x6f79('0x41')]['id']}})[_0x6f79('0x20')](handleEntityNotFound(_0x4c355a,null))['then'](function(_0x5c369c){if(_0x5c369c){_0x1797bb['body'][_0x6f79('0x4b')]=_0x5c369c['id'];_0x1797bb[_0x6f79('0x45')][_0x6f79('0x4c')]=integrations['getSubjects'](_0x1797bb['body'][_0x6f79('0x4d')],_0x1797bb['body'][_0x6f79('0x4e')]);_0x1797bb[_0x6f79('0x45')][_0x6f79('0x4f')]=integrations[_0x6f79('0x50')](_0x1797bb['body'][_0x6f79('0x4d')],_0x1797bb[_0x6f79('0x45')]['type']);return db[_0x6f79('0x51')]['create'](_0x1797bb[_0x6f79('0x45')],{'include':[{'model':db['VtigerField'],'as':_0x6f79('0x4c')},{'model':db[_0x6f79('0x52')],'as':'Descriptions'}]});}return null;})[_0x6f79('0x20')](respondWithResult(_0x4c355a,null))[_0x6f79('0x3f')](handleError(_0x4c355a,null));};var md5=require(_0x6f79('0x53'));exports[_0x6f79('0x54')]=function(_0x4a25ba,_0xe43b9b,_0x53cc03){var _0x1b39e5=null;var _0x33050b=null;var _0x5f24bc=null;var _0x4aeb7a=null;var _0x3c2a36='';return db[_0x6f79('0x29')]['findOne']({'where':{'id':_0x4a25ba[_0x6f79('0x41')]['id']},'attributes':['id',_0x6f79('0x25'),_0x6f79('0x55'),_0x6f79('0x56'),_0x6f79('0x57'),_0x6f79('0x58'),_0x6f79('0x59'),_0x6f79('0x5a')]})[_0x6f79('0x20')](handleEntityNotFound(_0xe43b9b,null))[_0x6f79('0x20')](function(_0x5edc0a){if(_0x5edc0a){_0x1b39e5=_0x5edc0a[_0x6f79('0x55')];_0x33050b=_0x5edc0a[_0x6f79('0x5a')];_0x5f24bc=_0x5edc0a[_0x6f79('0x57')];_0x3c2a36=_0x5edc0a[_0x6f79('0x58')];var _0xdd6ce=_0x3c2a36[_0x6f79('0x5b')](-0x1);if(_0xdd6ce==='/'){_0x3c2a36=_0x3c2a36['substring'](0x0,_0x3c2a36['lastIndexOf'](_0xdd6ce));}_0x4aeb7a=util[_0x6f79('0x5c')](_0x6f79('0x5d'),_0x3c2a36);var _0x6624f8={'method':'GET','uri':_0x4aeb7a,'qs':{'operation':_0x6f79('0x5e'),'username':_0x5edc0a[_0x6f79('0x55')]},'json':!![]};return rp(_0x6624f8);}})[_0x6f79('0x20')](function(_0x5d730b){if(_0x5d730b[_0x6f79('0x5f')]){var _0x47f50d={'method':'POST','uri':_0x4aeb7a,'form':{'operation':_0x6f79('0x60'),'username':_0x1b39e5,'accessKey':md5(_0x5d730b['result']['token']+_0x33050b)},'json':!![]};return rp(_0x47f50d);}})[_0x6f79('0x20')](function(_0x3d39f3){if(_0x3d39f3['success']){var _0x5f1c2e={'method':'GET','uri':_0x4aeb7a,'qs':{'operation':_0x6f79('0x61'),'username':_0x1b39e5,'sessionName':_0x3d39f3[_0x6f79('0x62')][_0x6f79('0x63')],'elementType':_0x5f24bc},'json':!![]};return rp(_0x5f1c2e);}})[_0x6f79('0x20')](function(_0x1bf3f){if(_0x1bf3f['success']){var _0x179a03=[_0x6f79('0x64'),'reference',_0x6f79('0x65')];_[_0x6f79('0x66')](_0x1bf3f[_0x6f79('0x62')][_0x6f79('0x32')],function(_0x2e6da3){return _0x179a03[_0x6f79('0x67')](_0x2e6da3[_0x6f79('0x4e')][_0x6f79('0x25')]);});_[_0x6f79('0x66')](_0x1bf3f[_0x6f79('0x62')][_0x6f79('0x32')],function(_0x39e165){return _0x39e165[_0x6f79('0x68')]===_0x6f79('0x69');});return{'count':_0x1bf3f[_0x6f79('0x62')]['fields'][_0x6f79('0x42')],'rows':_[_0x6f79('0x28')](_0x1bf3f[_0x6f79('0x62')][_0x6f79('0x32')],function(_0x52b420){return{'id':_0x52b420[_0x6f79('0x25')],'name':_0x52b420[_0x6f79('0x6a')],'custom':_[_0x6f79('0x6b')](_0x52b420[_0x6f79('0x25')],_0x6f79('0x6c'))?!![]:![],'options':_0x52b420['type'][_0x6f79('0x25')]==='picklist'&&_0x52b420[_0x6f79('0x4e')][_0x6f79('0x6d')][_0x6f79('0x42')]>0x0?_[_0x6f79('0x28')](_0x52b420['type'][_0x6f79('0x6d')],function(_0x4d5ee6){return{'name':_0x4d5ee6[_0x6f79('0x6a')],'value':_0x4d5ee6[_0x6f79('0x6e')]};}):[]};})};}})['then'](respondWithResult(_0xe43b9b,null))[_0x6f79('0x3f')](function(_0x2a50e8){console[_0x6f79('0x6f')]('vTiger\x20error:\x20'+_0x2a50e8);var _0x245930=_0x4a25ba['query']['test']?0x1f4:_0x2a50e8[_0x6f79('0x70')]||0x1f4;logger[_0x6f79('0x23')](_0x6f79('0x71'),_0x6f79('0x54'),_0x245930,JSON[_0x6f79('0x72')](_0x2a50e8));delete _0x2a50e8[_0x6f79('0x25')];if(_0x245930===0x191){_0x245930=0x190;}_0xe43b9b[_0x6f79('0x17')](_0x245930)[_0x6f79('0x26')](_0x4a25ba[_0x6f79('0x2c')][_0x6f79('0x73')]?{'message':_0x6f79('0x74'),'statusCode':_0x2a50e8['statusCode']}:_0x2a50e8);});}; \ No newline at end of file +var _0x9254=['getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','lastIndexOf','format','GET','getchallenge','POST','login','token','describe','sessionName','success','autogenerated','reference','owner','result','includes','remove','editable','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','json','offset','limit','undefined','count','status','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','key','model','keys','attributes','query','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','intersection','create','body','find','getConfigurations','VtigerConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','VtigerField','Descriptions','md5'];(function(_0xb25c71,_0x184611){var _0x4ad3a4=function(_0x1bf446){while(--_0x1bf446){_0xb25c71['push'](_0xb25c71['shift']());}};_0x4ad3a4(++_0x184611);}(_0x9254,0x120));var _0x4925=function(_0x41c3df,_0x4e9d9a){_0x41c3df=_0x41c3df-0x0;var _0x56d537=_0x9254[_0x41c3df];return _0x56d537;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4925('0x0'));var zipdir=require(_0x4925('0x1'));var jsonpatch=require(_0x4925('0x2'));var rp=require(_0x4925('0x3'));var moment=require(_0x4925('0x4'));var BPromise=require(_0x4925('0x5'));var Mustache=require(_0x4925('0x6'));var util=require(_0x4925('0x7'));var path=require('path');var sox=require(_0x4925('0x8'));var csv=require(_0x4925('0x9'));var ejs=require(_0x4925('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4925('0xb'));var crypto=require('crypto');var jsforce=require(_0x4925('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4925('0xd'));var Papa=require(_0x4925('0xe'));var Redis=require('ioredis');var authService=require(_0x4925('0xf'));var qs=require(_0x4925('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4925('0x11'));var logger=require(_0x4925('0x12'))(_0x4925('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4925('0x14'));var db=require(_0x4925('0x15'))['db'];var integrations=require(_0x4925('0x16'));function respondWithStatusCode(_0x13ff86,_0x1e78fe){_0x1e78fe=_0x1e78fe||0xcc;return function(_0x30a756){if(_0x30a756){return _0x13ff86[_0x4925('0x17')](_0x1e78fe);}return _0x13ff86['status'](_0x1e78fe)[_0x4925('0x18')]();};}function respondWithResult(_0x13d770,_0x5a46fc){_0x5a46fc=_0x5a46fc||0xc8;return function(_0x561885){if(_0x561885){return _0x13d770['status'](_0x5a46fc)[_0x4925('0x19')](_0x561885);}};}function respondWithFilteredResult(_0x57f794,_0x50e136){return function(_0x11fdd9){if(_0x11fdd9){var _0x3e243a=typeof _0x50e136[_0x4925('0x1a')]==='undefined'&&typeof _0x50e136[_0x4925('0x1b')]===_0x4925('0x1c');var _0x575850=_0x11fdd9['count'];var _0xf6e088=_0x3e243a?0x0:_0x50e136[_0x4925('0x1a')];var _0x4d7763=_0x3e243a?_0x11fdd9[_0x4925('0x1d')]:_0x50e136[_0x4925('0x1a')]+_0x50e136[_0x4925('0x1b')];var _0x1e682a;if(_0x4d7763>=_0x575850){_0x4d7763=_0x575850;_0x1e682a=0xc8;}else{_0x1e682a=0xce;}_0x57f794[_0x4925('0x1e')](_0x1e682a);return _0x57f794['set'](_0x4925('0x1f'),_0xf6e088+'-'+_0x4d7763+'/'+_0x575850)[_0x4925('0x19')](_0x11fdd9);}return null;};}function patchUpdates(_0x2990a8){return function(_0x4de9ea){try{jsonpatch[_0x4925('0x20')](_0x4de9ea,_0x2990a8,!![]);}catch(_0x4261da){return BPromise['reject'](_0x4261da);}return _0x4de9ea[_0x4925('0x21')]();};}function saveUpdates(_0xaaaad3,_0x1b9a60){return function(_0x2a3673){if(_0x2a3673){return _0x2a3673[_0x4925('0x22')](_0xaaaad3)[_0x4925('0x23')](function(_0x45f3a9){return _0x45f3a9;});}return null;};}function removeEntity(_0x3b085a,_0x166eab){return function(_0x4f9341){if(_0x4f9341){return _0x4f9341[_0x4925('0x24')]()[_0x4925('0x23')](function(){_0x3b085a['status'](0xcc)[_0x4925('0x18')]();});}};}function handleEntityNotFound(_0x5f4875,_0x50060f){return function(_0x52533e){if(!_0x52533e){_0x5f4875[_0x4925('0x17')](0x194);}return _0x52533e;};}function handleError(_0xc656c9,_0x1615cf){_0x1615cf=_0x1615cf||0x1f4;return function(_0x3e7d09){logger[_0x4925('0x25')](_0x3e7d09[_0x4925('0x26')]);if(_0x3e7d09[_0x4925('0x27')]){delete _0x3e7d09['name'];}_0xc656c9['status'](_0x1615cf)[_0x4925('0x28')](_0x3e7d09);};}exports[_0x4925('0x29')]=function(_0x2abc02,_0x5b492b){var _0xeeff29={},_0x2ff9e2={},_0x4176a4={'count':0x0,'rows':[]};var _0x295d96=_[_0x4925('0x2a')](db[_0x4925('0x2b')][_0x4925('0x2c')],function(_0x41c575){return{'name':_0x41c575[_0x4925('0x2d')],'type':_0x41c575[_0x4925('0x2e')][_0x4925('0x2f')]};});_0x2ff9e2[_0x4925('0x30')]=_[_0x4925('0x2a')](_0x295d96,_0x4925('0x27'));_0x2ff9e2['query']=_[_0x4925('0x31')](_0x2abc02['query']);_0x2ff9e2['filters']=_['intersection'](_0x2ff9e2[_0x4925('0x30')],_0x2ff9e2['query']);_0xeeff29[_0x4925('0x32')]=_['intersection'](_0x2ff9e2[_0x4925('0x30')],qs['fields'](_0x2abc02[_0x4925('0x33')][_0x4925('0x34')]));_0xeeff29[_0x4925('0x32')]=_0xeeff29[_0x4925('0x32')][_0x4925('0x35')]?_0xeeff29[_0x4925('0x32')]:_0x2ff9e2[_0x4925('0x30')];if(!_0x2abc02[_0x4925('0x33')][_0x4925('0x36')](_0x4925('0x37'))){_0xeeff29[_0x4925('0x1b')]=qs[_0x4925('0x1b')](_0x2abc02[_0x4925('0x33')][_0x4925('0x1b')]);_0xeeff29['offset']=qs[_0x4925('0x1a')](_0x2abc02[_0x4925('0x33')][_0x4925('0x1a')]);}_0xeeff29[_0x4925('0x38')]=qs[_0x4925('0x39')](_0x2abc02['query'][_0x4925('0x39')]);_0xeeff29[_0x4925('0x3a')]=qs[_0x4925('0x3b')](_[_0x4925('0x3c')](_0x2abc02[_0x4925('0x33')],_0x2ff9e2[_0x4925('0x3b')]),_0x295d96);if(_0x2abc02['query'][_0x4925('0x3d')]){_0xeeff29[_0x4925('0x3a')]=_[_0x4925('0x3e')](_0xeeff29['where'],{'$or':_[_0x4925('0x2a')](_0x295d96,function(_0x43c01a){if(_0x43c01a[_0x4925('0x2e')]!==_0x4925('0x3f')){var _0x27f3bc={};_0x27f3bc[_0x43c01a['name']]={'$like':'%'+_0x2abc02[_0x4925('0x33')][_0x4925('0x3d')]+'%'};return _0x27f3bc;}})});}_0xeeff29=_['merge']({},_0xeeff29,_0x2abc02[_0x4925('0x40')]);var _0x2f3811={'where':_0xeeff29[_0x4925('0x3a')]};return db[_0x4925('0x2b')][_0x4925('0x1d')](_0x2f3811)[_0x4925('0x23')](function(_0x2e7cce){_0x4176a4[_0x4925('0x1d')]=_0x2e7cce;if(_0x2abc02[_0x4925('0x33')][_0x4925('0x41')]){_0xeeff29[_0x4925('0x42')]=[{'all':!![]}];}return db[_0x4925('0x2b')]['findAll'](_0xeeff29);})[_0x4925('0x23')](function(_0x538337){_0x4176a4[_0x4925('0x43')]=_0x538337;return _0x4176a4;})[_0x4925('0x23')](respondWithFilteredResult(_0x5b492b,_0xeeff29))[_0x4925('0x44')](handleError(_0x5b492b,null));};exports[_0x4925('0x45')]=function(_0x549aaf,_0x5e8ba3){var _0x4132ca={'raw':![],'where':{'id':_0x549aaf[_0x4925('0x46')]['id']}},_0x53d392={};_0x53d392[_0x4925('0x30')]=_[_0x4925('0x31')](db[_0x4925('0x2b')][_0x4925('0x2c')]);_0x53d392[_0x4925('0x33')]=_[_0x4925('0x31')](_0x549aaf[_0x4925('0x33')]);_0x53d392[_0x4925('0x3b')]=_['intersection'](_0x53d392[_0x4925('0x30')],_0x53d392[_0x4925('0x33')]);_0x4132ca['attributes']=_[_0x4925('0x47')](_0x53d392['model'],qs[_0x4925('0x34')](_0x549aaf['query'][_0x4925('0x34')]));_0x4132ca['attributes']=_0x4132ca[_0x4925('0x32')]['length']?_0x4132ca['attributes']:_0x53d392['model'];if(_0x549aaf[_0x4925('0x33')][_0x4925('0x41')]){_0x4132ca[_0x4925('0x42')]=[{'all':!![]}];}_0x4132ca=_[_0x4925('0x3e')]({},_0x4132ca,_0x549aaf['options']);return db['VtigerAccount']['find'](_0x4132ca)[_0x4925('0x23')](handleEntityNotFound(_0x5e8ba3,null))[_0x4925('0x23')](respondWithResult(_0x5e8ba3,null))[_0x4925('0x44')](handleError(_0x5e8ba3,null));};exports[_0x4925('0x48')]=function(_0x5ac823,_0x5d6dfd){return db[_0x4925('0x2b')][_0x4925('0x48')](_0x5ac823['body'],{})[_0x4925('0x23')](respondWithResult(_0x5d6dfd,0xc9))[_0x4925('0x44')](handleError(_0x5d6dfd,null));};exports['update']=function(_0x1f45b6,_0xaad71a){if(_0x1f45b6[_0x4925('0x49')]['id']){delete _0x1f45b6[_0x4925('0x49')]['id'];}return db[_0x4925('0x2b')]['find']({'where':{'id':_0x1f45b6[_0x4925('0x46')]['id']}})['then'](handleEntityNotFound(_0xaad71a,null))[_0x4925('0x23')](saveUpdates(_0x1f45b6['body'],null))[_0x4925('0x23')](respondWithResult(_0xaad71a,null))[_0x4925('0x44')](handleError(_0xaad71a,null));};exports[_0x4925('0x24')]=function(_0x40e47c,_0x3af5b9){return db[_0x4925('0x2b')][_0x4925('0x4a')]({'where':{'id':_0x40e47c[_0x4925('0x46')]['id']}})[_0x4925('0x23')](handleEntityNotFound(_0x3af5b9,null))[_0x4925('0x23')](removeEntity(_0x3af5b9,null))[_0x4925('0x44')](handleError(_0x3af5b9,null));};exports[_0x4925('0x4b')]=function(_0x38a218,_0x4f05e0,_0x5b194d){var _0x5e5d83={};var _0x2664a1={};var _0x4f5823;var _0x4c7953;return db[_0x4925('0x2b')]['findOne']({'where':{'id':_0x38a218['params']['id']}})['then'](handleEntityNotFound(_0x4f05e0,null))[_0x4925('0x23')](function(_0x34d640){if(_0x34d640){_0x4f5823=_0x34d640;_0x2664a1[_0x4925('0x30')]=_['keys'](db[_0x4925('0x4c')][_0x4925('0x2c')]);_0x2664a1[_0x4925('0x33')]=_[_0x4925('0x31')](_0x38a218[_0x4925('0x33')]);_0x2664a1[_0x4925('0x3b')]=_[_0x4925('0x47')](_0x2664a1['model'],_0x2664a1[_0x4925('0x33')]);_0x5e5d83[_0x4925('0x32')]=_[_0x4925('0x47')](_0x2664a1['model'],qs[_0x4925('0x34')](_0x38a218['query'][_0x4925('0x34')]));_0x5e5d83[_0x4925('0x32')]=_0x5e5d83[_0x4925('0x32')][_0x4925('0x35')]?_0x5e5d83[_0x4925('0x32')]:_0x2664a1[_0x4925('0x30')];_0x5e5d83[_0x4925('0x38')]=qs[_0x4925('0x39')](_0x38a218[_0x4925('0x33')][_0x4925('0x39')]);_0x5e5d83[_0x4925('0x3a')]=qs[_0x4925('0x3b')](_[_0x4925('0x3c')](_0x38a218[_0x4925('0x33')],_0x2664a1[_0x4925('0x3b')]));if(_0x38a218[_0x4925('0x33')][_0x4925('0x3d')]){_0x5e5d83[_0x4925('0x3a')]=_[_0x4925('0x3e')](_0x5e5d83[_0x4925('0x3a')],{'$or':_[_0x4925('0x2a')](_0x5e5d83[_0x4925('0x32')],function(_0x425dfc){var _0x4c07ac={};_0x4c07ac[_0x425dfc]={'$like':'%'+_0x38a218[_0x4925('0x33')][_0x4925('0x3d')]+'%'};return _0x4c07ac;})});}_0x5e5d83=_[_0x4925('0x3e')]({},_0x5e5d83,_0x38a218[_0x4925('0x40')]);return _0x4f5823[_0x4925('0x4b')](_0x5e5d83);}})[_0x4925('0x23')](function(_0xfe2c32){if(_0xfe2c32){_0x4c7953=_0xfe2c32[_0x4925('0x35')];if(!_0x38a218[_0x4925('0x33')][_0x4925('0x36')]('nolimit')){_0x5e5d83[_0x4925('0x1b')]=qs[_0x4925('0x1b')](_0x38a218[_0x4925('0x33')][_0x4925('0x1b')]);_0x5e5d83[_0x4925('0x1a')]=qs['offset'](_0x38a218['query']['offset']);}return _0x4f5823[_0x4925('0x4b')](_0x5e5d83);}})['then'](function(_0x5ca762){if(_0x5ca762){return _0x5ca762?{'count':_0x4c7953,'rows':_0x5ca762}:null;}})[_0x4925('0x23')](respondWithResult(_0x4f05e0,null))['catch'](handleError(_0x4f05e0,null));};exports[_0x4925('0x4d')]=function(_0xd1ffb1,_0x509de4,_0xdfa2d5){if(_0xd1ffb1[_0x4925('0x49')]['id']){delete _0xd1ffb1[_0x4925('0x49')]['id'];}return db[_0x4925('0x2b')][_0x4925('0x4e')]({'where':{'id':_0xd1ffb1['params']['id']}})['then'](handleEntityNotFound(_0x509de4,null))['then'](function(_0x417825){if(_0x417825){_0xd1ffb1[_0x4925('0x49')][_0x4925('0x4f')]=_0x417825['id'];_0xd1ffb1[_0x4925('0x49')][_0x4925('0x50')]=integrations[_0x4925('0x51')](_0xd1ffb1['body'][_0x4925('0x52')],_0xd1ffb1['body'][_0x4925('0x2e')]);_0xd1ffb1[_0x4925('0x49')]['Descriptions']=integrations[_0x4925('0x53')](_0xd1ffb1[_0x4925('0x49')][_0x4925('0x52')],_0xd1ffb1[_0x4925('0x49')]['type']);return db[_0x4925('0x4c')][_0x4925('0x48')](_0xd1ffb1['body'],{'include':[{'model':db[_0x4925('0x54')],'as':_0x4925('0x50')},{'model':db['VtigerField'],'as':_0x4925('0x55')}]});}return null;})['then'](respondWithResult(_0x509de4,null))[_0x4925('0x44')](handleError(_0x509de4,null));};var md5=require(_0x4925('0x56'));exports[_0x4925('0x57')]=function(_0x3215da,_0x72691e,_0x2c00e9){var _0x1df549=null;var _0x56d857=null;var _0x38c930=null;var _0x3bea9c=null;var _0x2f6b56='';return db[_0x4925('0x2b')][_0x4925('0x4e')]({'where':{'id':_0x3215da[_0x4925('0x46')]['id']},'attributes':['id','name',_0x4925('0x58'),_0x4925('0x59'),_0x4925('0x5a'),_0x4925('0x5b'),_0x4925('0x5c'),_0x4925('0x5d')]})[_0x4925('0x23')](handleEntityNotFound(_0x72691e,null))[_0x4925('0x23')](function(_0x20f815){if(_0x20f815){_0x1df549=_0x20f815[_0x4925('0x58')];_0x56d857=_0x20f815[_0x4925('0x5d')];_0x38c930=_0x20f815[_0x4925('0x5a')];_0x2f6b56=_0x20f815[_0x4925('0x5b')];var _0x2581c9=_0x2f6b56[_0x4925('0x5e')](-0x1);if(_0x2581c9==='/'){_0x2f6b56=_0x2f6b56['substring'](0x0,_0x2f6b56[_0x4925('0x5f')](_0x2581c9));}_0x3bea9c=util[_0x4925('0x60')]('%s/webservice.php',_0x2f6b56);var _0x145ba2={'method':_0x4925('0x61'),'uri':_0x3bea9c,'qs':{'operation':_0x4925('0x62'),'username':_0x20f815['username']},'json':!![]};return rp(_0x145ba2);}})['then'](function(_0x2a60ea){if(_0x2a60ea['success']){var _0x1d4551={'method':_0x4925('0x63'),'uri':_0x3bea9c,'form':{'operation':_0x4925('0x64'),'username':_0x1df549,'accessKey':md5(_0x2a60ea['result'][_0x4925('0x65')]+_0x56d857)},'json':!![]};return rp(_0x1d4551);}})['then'](function(_0x20e375){if(_0x20e375['success']){var _0x432e30={'method':_0x4925('0x61'),'uri':_0x3bea9c,'qs':{'operation':_0x4925('0x66'),'username':_0x1df549,'sessionName':_0x20e375['result'][_0x4925('0x67')],'elementType':_0x38c930},'json':!![]};return rp(_0x432e30);}})['then'](function(_0x1e01ad){if(_0x1e01ad[_0x4925('0x68')]){var _0x529f9e=[_0x4925('0x69'),_0x4925('0x6a'),_0x4925('0x6b')];_['remove'](_0x1e01ad[_0x4925('0x6c')][_0x4925('0x34')],function(_0x34336e){return _0x529f9e[_0x4925('0x6d')](_0x34336e['type']['name']);});_[_0x4925('0x6e')](_0x1e01ad[_0x4925('0x6c')][_0x4925('0x34')],function(_0x29841d){return _0x29841d[_0x4925('0x6f')]==='false';});return{'count':_0x1e01ad['result']['fields'][_0x4925('0x35')],'rows':_[_0x4925('0x2a')](_0x1e01ad['result']['fields'],function(_0x5ee59b){return{'id':_0x5ee59b[_0x4925('0x27')],'name':_0x5ee59b[_0x4925('0x70')],'custom':_[_0x4925('0x71')](_0x5ee59b[_0x4925('0x27')],_0x4925('0x72'))?!![]:![],'options':_0x5ee59b[_0x4925('0x2e')][_0x4925('0x27')]===_0x4925('0x73')&&_0x5ee59b[_0x4925('0x2e')][_0x4925('0x74')][_0x4925('0x35')]>0x0?_[_0x4925('0x2a')](_0x5ee59b[_0x4925('0x2e')][_0x4925('0x74')],function(_0x453270){return{'name':_0x453270[_0x4925('0x70')],'value':_0x453270[_0x4925('0x75')]};}):[]};})};}})[_0x4925('0x23')](respondWithResult(_0x72691e,null))[_0x4925('0x44')](function(_0x4e9303){console[_0x4925('0x76')](_0x4925('0x77')+_0x4e9303);var _0x46472b=_0x3215da['query'][_0x4925('0x78')]?0x1f4:_0x4e9303[_0x4925('0x79')]||0x1f4;logger[_0x4925('0x25')](_0x4925('0x7a'),'getFields',_0x46472b,JSON[_0x4925('0x7b')](_0x4e9303));delete _0x4e9303['name'];if(_0x46472b===0x191){_0x46472b=0x190;}_0x72691e[_0x4925('0x1e')](_0x46472b)['send'](_0x3215da[_0x4925('0x33')]['test']?{'message':_0x4925('0x7c'),'statusCode':_0x4e9303[_0x4925('0x79')]}:_0x4e9303);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index c5e58f6..7269dce 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 _0x22ec=['../../components/integrations/configuration','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x12b004,_0x5e4c58){var _0x2ec7f8=function(_0x80f9ed){while(--_0x80f9ed){_0x12b004['push'](_0x12b004['shift']());}};_0x2ec7f8(++_0x5e4c58);}(_0x22ec,0x13c));var _0xc22e=function(_0x21d43a,_0x5a3b74){_0x21d43a=_0x21d43a-0x0;var _0x503474=_0x22ec[_0x21d43a];return _0x503474;};'use strict';var _=require(_0xc22e('0x0'));var util=require(_0xc22e('0x1'));var logger=require(_0xc22e('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc22e('0x3'));var rp=require(_0xc22e('0x4'));var fs=require('fs');var path=require(_0xc22e('0x5'));var rimraf=require(_0xc22e('0x6'));var config=require(_0xc22e('0x7'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0xc22e('0x8'));module['exports']=function(_0x167b38,_0x45329e){return _0x167b38[_0xc22e('0x9')](_0xc22e('0xa'),attributes,{'tableName':_0xc22e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d72=['path','rimraf','../../config/environment','./intVtigerAccount.attributes','int_vtiger_accounts','../../config/logger','api','bluebird'];(function(_0x15b02d,_0x99a3cd){var _0x1baa38=function(_0xc252dd){while(--_0xc252dd){_0x15b02d['push'](_0x15b02d['shift']());}};_0x1baa38(++_0x99a3cd);}(_0x0d72,0x1e5));var _0x20d7=function(_0x51e02b,_0x5dc4ef){_0x51e02b=_0x51e02b-0x0;var _0x2c41c2=_0x0d72[_0x51e02b];return _0x2c41c2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x20d7('0x0'))(_0x20d7('0x1'));var moment=require('moment');var BPromise=require(_0x20d7('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x20d7('0x3'));var rimraf=require(_0x20d7('0x4'));var config=require(_0x20d7('0x5'));var attributes=require(_0x20d7('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x5252c9,_0x463b2e){return _0x5252c9['define']('VtigerAccount',attributes,{'tableName':_0x20d7('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index e144fbf..d448570 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 _0xa571=['http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetVtigerAccount','VtigerAccount','findAll','options','where','limit','include','map','model','attributes','ShowVtigerAccount','find','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client'];(function(_0x573add,_0x5afb8d){var _0x5eee17=function(_0x3f6ce6){while(--_0x3f6ce6){_0x573add['push'](_0x573add['shift']());}};_0x5eee17(++_0x5afb8d);}(_0xa571,0x107));var _0x1a57=function(_0x5abd75,_0x240b60){_0x5abd75=_0x5abd75-0x0;var _0x3aabb2=_0xa571[_0x5abd75];return _0x3aabb2;};'use strict';var _=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var moment=require(_0x1a57('0x2'));var BPromise=require(_0x1a57('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a57('0x4'));var db=require(_0x1a57('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1a57('0x6'));var config=require('../../config/environment');var jayson=require(_0x1a57('0x7'));var client=jayson[_0x1a57('0x8')][_0x1a57('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c5352,_0x2492f5,_0x924873){return new BPromise(function(_0x5d9f45,_0x3edb40){return client[_0x1a57('0xa')](_0x3c5352,_0x924873)[_0x1a57('0xb')](function(_0x58e266){logger[_0x1a57('0xc')](_0x1a57('0xd'),_0x2492f5,_0x1a57('0xe'));logger[_0x1a57('0xf')](_0x1a57('0x10'),_0x2492f5,_0x1a57('0xe'),JSON[_0x1a57('0x11')](_0x58e266));if(_0x58e266[_0x1a57('0x12')]){if(_0x58e266['error']['code']===0x1f4){logger[_0x1a57('0x12')](_0x1a57('0xd'),_0x2492f5,_0x58e266[_0x1a57('0x12')]['message']);return _0x3edb40(_0x58e266[_0x1a57('0x12')][_0x1a57('0x13')]);}logger['error'](_0x1a57('0xd'),_0x2492f5,_0x58e266['error'][_0x1a57('0x13')]);return _0x5d9f45(_0x58e266[_0x1a57('0x12')][_0x1a57('0x13')]);}else{logger[_0x1a57('0xc')]('VtigerAccount,\x20%s,\x20%s',_0x2492f5,_0x1a57('0xe'));_0x5d9f45(_0x58e266['result']['message']);}})[_0x1a57('0x14')](function(_0x1c537f){logger[_0x1a57('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x2492f5,_0x1c537f);_0x3edb40(_0x1c537f);});});}exports[_0x1a57('0x15')]=function(_0x1662a3){var _0x80f8c1=this;return new Promise(function(_0x53bb20,_0x3daa66){return db[_0x1a57('0x16')][_0x1a57('0x17')]({'raw':_0x1662a3[_0x1a57('0x18')]?_0x1662a3[_0x1a57('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1662a3['options']?_0x1662a3[_0x1a57('0x18')][_0x1a57('0x19')]||null:null,'attributes':_0x1662a3[_0x1a57('0x18')]?_0x1662a3['options']['attributes']||null:null,'limit':_0x1662a3['options']?_0x1662a3[_0x1a57('0x18')][_0x1a57('0x1a')]||null:null,'include':_0x1662a3[_0x1a57('0x18')]?_0x1662a3[_0x1a57('0x18')][_0x1a57('0x1b')]?_[_0x1a57('0x1c')](_0x1662a3[_0x1a57('0x18')][_0x1a57('0x1b')],function(_0x183ca3){return{'model':db[_0x183ca3[_0x1a57('0x1d')]],'as':_0x183ca3['as'],'attributes':_0x183ca3[_0x1a57('0x1e')],'include':_0x183ca3[_0x1a57('0x1b')]?_[_0x1a57('0x1c')](_0x183ca3[_0x1a57('0x1b')],function(_0x2f9454){return{'model':db[_0x2f9454[_0x1a57('0x1d')]],'as':_0x2f9454['as'],'attributes':_0x2f9454[_0x1a57('0x1e')],'include':_0x2f9454[_0x1a57('0x1b')]?_[_0x1a57('0x1c')](_0x2f9454[_0x1a57('0x1b')],function(_0x26584b){return{'model':db[_0x26584b[_0x1a57('0x1d')]],'as':_0x26584b['as'],'attributes':_0x26584b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x139d8c){logger[_0x1a57('0xc')]('GetVtigerAccount',_0x1662a3);logger[_0x1a57('0xf')]('GetVtigerAccount',_0x1662a3,JSON[_0x1a57('0x11')](_0x139d8c));_0x53bb20(_0x139d8c);})[_0x1a57('0x14')](function(_0x53bf6e){logger[_0x1a57('0x12')](_0x1a57('0x15'),_0x53bf6e[_0x1a57('0x13')],_0x1662a3);_0x3daa66(_0x80f8c1[_0x1a57('0x12')](0x1f4,_0x53bf6e['message']));});});};exports[_0x1a57('0x1f')]=function(_0x396832){var _0x4374f0=this;return new Promise(function(_0x160536,_0x5763ba){return db[_0x1a57('0x16')][_0x1a57('0x20')]({'raw':_0x396832[_0x1a57('0x18')]?_0x396832[_0x1a57('0x18')][_0x1a57('0x21')]===undefined?!![]:![]:!![],'where':_0x396832[_0x1a57('0x18')]?_0x396832[_0x1a57('0x18')][_0x1a57('0x19')]||null:null,'attributes':_0x396832[_0x1a57('0x18')]?_0x396832['options'][_0x1a57('0x1e')]||null:null,'include':_0x396832[_0x1a57('0x18')]?_0x396832['options']['include']?_[_0x1a57('0x1c')](_0x396832[_0x1a57('0x18')][_0x1a57('0x1b')],function(_0x170bf7){return{'model':db[_0x170bf7[_0x1a57('0x1d')]],'as':_0x170bf7['as'],'attributes':_0x170bf7[_0x1a57('0x1e')],'include':_0x170bf7[_0x1a57('0x1b')]?_[_0x1a57('0x1c')](_0x170bf7[_0x1a57('0x1b')],function(_0x2a6feb){return{'model':db[_0x2a6feb[_0x1a57('0x1d')]],'as':_0x2a6feb['as'],'attributes':_0x2a6feb[_0x1a57('0x1e')],'include':_0x2a6feb[_0x1a57('0x1b')]?_[_0x1a57('0x1c')](_0x2a6feb[_0x1a57('0x1b')],function(_0x12102f){return{'model':db[_0x12102f[_0x1a57('0x1d')]],'as':_0x12102f['as'],'attributes':_0x12102f[_0x1a57('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3cd160){logger[_0x1a57('0xc')](_0x1a57('0x1f'),_0x396832);logger[_0x1a57('0xf')](_0x1a57('0x1f'),_0x396832,JSON[_0x1a57('0x11')](_0x3cd160));_0x160536(_0x3cd160);})[_0x1a57('0x14')](function(_0x23d087){logger[_0x1a57('0x12')]('ShowVtigerAccount',_0x23d087['message'],_0x396832);_0x5763ba(_0x4374f0['error'](0x1f4,_0x23d087['message']));});});}; \ No newline at end of file +var _0x0abf=['VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','limit','include','map','model','attributes','debug','ShowVtigerAccount','then','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VtigerAccount,\x20%s,\x20%s'];(function(_0x5d2fce,_0x21b8df){var _0x6f73a1=function(_0x423757){while(--_0x423757){_0x5d2fce['push'](_0x5d2fce['shift']());}};_0x6f73a1(++_0x21b8df);}(_0x0abf,0xe8));var _0xf0ab=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0abf[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xf0ab('0x0'));var util=require('util');var moment=require(_0xf0ab('0x1'));var BPromise=require(_0xf0ab('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf0ab('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf0ab('0x4'))(_0xf0ab('0x5'));var config=require(_0xf0ab('0x6'));var jayson=require(_0xf0ab('0x7'));var client=jayson[_0xf0ab('0x8')][_0xf0ab('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x233afe,_0x57ff3b,_0x2c4628){return new BPromise(function(_0x3f7e2b,_0x3ca099){return client[_0xf0ab('0xa')](_0x233afe,_0x2c4628)['then'](function(_0x472508){logger[_0xf0ab('0xb')](_0xf0ab('0xc'),_0x57ff3b,'request\x20sent');logger['debug'](_0xf0ab('0xd'),_0x57ff3b,'request\x20sent',JSON[_0xf0ab('0xe')](_0x472508));if(_0x472508[_0xf0ab('0xf')]){if(_0x472508[_0xf0ab('0xf')][_0xf0ab('0x10')]===0x1f4){logger[_0xf0ab('0xf')](_0xf0ab('0xc'),_0x57ff3b,_0x472508[_0xf0ab('0xf')]['message']);return _0x3ca099(_0x472508[_0xf0ab('0xf')][_0xf0ab('0x11')]);}logger[_0xf0ab('0xf')](_0xf0ab('0xc'),_0x57ff3b,_0x472508[_0xf0ab('0xf')][_0xf0ab('0x11')]);return _0x3f7e2b(_0x472508[_0xf0ab('0xf')][_0xf0ab('0x11')]);}else{logger[_0xf0ab('0xb')](_0xf0ab('0xc'),_0x57ff3b,_0xf0ab('0x12'));_0x3f7e2b(_0x472508[_0xf0ab('0x13')][_0xf0ab('0x11')]);}})[_0xf0ab('0x14')](function(_0x230f40){logger['error'](_0xf0ab('0xc'),_0x57ff3b,_0x230f40);_0x3ca099(_0x230f40);});});}exports[_0xf0ab('0x15')]=function(_0x1803f0){var _0x1ffeb5=this;return new Promise(function(_0x776619,_0xb9a33){return db[_0xf0ab('0x16')][_0xf0ab('0x17')]({'raw':_0x1803f0[_0xf0ab('0x18')]?_0x1803f0[_0xf0ab('0x18')][_0xf0ab('0x19')]===undefined?!![]:![]:!![],'where':_0x1803f0[_0xf0ab('0x18')]?_0x1803f0[_0xf0ab('0x18')][_0xf0ab('0x1a')]||null:null,'attributes':_0x1803f0[_0xf0ab('0x18')]?_0x1803f0[_0xf0ab('0x18')]['attributes']||null:null,'limit':_0x1803f0[_0xf0ab('0x18')]?_0x1803f0[_0xf0ab('0x18')][_0xf0ab('0x1b')]||null:null,'include':_0x1803f0[_0xf0ab('0x18')]?_0x1803f0[_0xf0ab('0x18')][_0xf0ab('0x1c')]?_[_0xf0ab('0x1d')](_0x1803f0[_0xf0ab('0x18')][_0xf0ab('0x1c')],function(_0x18bb37){return{'model':db[_0x18bb37[_0xf0ab('0x1e')]],'as':_0x18bb37['as'],'attributes':_0x18bb37['attributes'],'include':_0x18bb37['include']?_['map'](_0x18bb37[_0xf0ab('0x1c')],function(_0x4f0caf){return{'model':db[_0x4f0caf[_0xf0ab('0x1e')]],'as':_0x4f0caf['as'],'attributes':_0x4f0caf[_0xf0ab('0x1f')],'include':_0x4f0caf['include']?_[_0xf0ab('0x1d')](_0x4f0caf[_0xf0ab('0x1c')],function(_0x10bf5f){return{'model':db[_0x10bf5f[_0xf0ab('0x1e')]],'as':_0x10bf5f['as'],'attributes':_0x10bf5f[_0xf0ab('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d0da7){logger['info']('GetVtigerAccount',_0x1803f0);logger[_0xf0ab('0x20')](_0xf0ab('0x15'),_0x1803f0,JSON[_0xf0ab('0xe')](_0x2d0da7));_0x776619(_0x2d0da7);})[_0xf0ab('0x14')](function(_0x43476c){logger[_0xf0ab('0xf')](_0xf0ab('0x15'),_0x43476c[_0xf0ab('0x11')],_0x1803f0);_0xb9a33(_0x1ffeb5[_0xf0ab('0xf')](0x1f4,_0x43476c[_0xf0ab('0x11')]));});});};exports[_0xf0ab('0x21')]=function(_0x199753){var _0x58cbe1=this;return new Promise(function(_0x1e1ffb,_0x35973a){return db['VtigerAccount']['find']({'raw':_0x199753[_0xf0ab('0x18')]?_0x199753[_0xf0ab('0x18')][_0xf0ab('0x19')]===undefined?!![]:![]:!![],'where':_0x199753['options']?_0x199753['options'][_0xf0ab('0x1a')]||null:null,'attributes':_0x199753['options']?_0x199753[_0xf0ab('0x18')]['attributes']||null:null,'include':_0x199753[_0xf0ab('0x18')]?_0x199753[_0xf0ab('0x18')]['include']?_['map'](_0x199753[_0xf0ab('0x18')][_0xf0ab('0x1c')],function(_0x2a3fac){return{'model':db[_0x2a3fac[_0xf0ab('0x1e')]],'as':_0x2a3fac['as'],'attributes':_0x2a3fac[_0xf0ab('0x1f')],'include':_0x2a3fac[_0xf0ab('0x1c')]?_[_0xf0ab('0x1d')](_0x2a3fac[_0xf0ab('0x1c')],function(_0x2a2f5d){return{'model':db[_0x2a2f5d[_0xf0ab('0x1e')]],'as':_0x2a2f5d['as'],'attributes':_0x2a2f5d[_0xf0ab('0x1f')],'include':_0x2a2f5d[_0xf0ab('0x1c')]?_[_0xf0ab('0x1d')](_0x2a2f5d[_0xf0ab('0x1c')],function(_0x5d8443){return{'model':db[_0x5d8443[_0xf0ab('0x1e')]],'as':_0x5d8443['as'],'attributes':_0x5d8443[_0xf0ab('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf0ab('0x22')](function(_0x5c9192){logger[_0xf0ab('0xb')](_0xf0ab('0x21'),_0x199753);logger[_0xf0ab('0x20')]('ShowVtigerAccount',_0x199753,JSON[_0xf0ab('0xe')](_0x5c9192));_0x1e1ffb(_0x5c9192);})['catch'](function(_0xda3971){logger['error'](_0xf0ab('0x21'),_0xda3971[_0xf0ab('0x11')],_0x199753);_0x35973a(_0x58cbe1[_0xf0ab('0xf')](0x1f4,_0xda3971[_0xf0ab('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 6867d24..5939f66 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 _0x8dff=['path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions','post','put','update','delete','destroy','exports','multer','util'];(function(_0x318256,_0xa773f3){var _0xb1e352=function(_0x4bb14e){while(--_0x4bb14e){_0x318256['push'](_0x318256['shift']());}};_0xb1e352(++_0xa773f3);}(_0x8dff,0x196));var _0xf8df=function(_0x4d740e,_0x4582e7){_0x4d740e=_0x4d740e-0x0;var _0x16f508=_0x8dff[_0x4d740e];return _0x16f508;};'use strict';var multer=require(_0xf8df('0x0'));var util=require(_0xf8df('0x1'));var path=require(_0xf8df('0x2'));var timeout=require(_0xf8df('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf8df('0x4'));var auth=require(_0xf8df('0x5'));var interaction=require(_0xf8df('0x6'));var config=require(_0xf8df('0x7'));var controller=require(_0xf8df('0x8'));router[_0xf8df('0x9')]('/',auth[_0xf8df('0xa')](),controller[_0xf8df('0xb')]);router[_0xf8df('0x9')](_0xf8df('0xc'),auth['isAuthenticated'](),controller[_0xf8df('0xd')]);router[_0xf8df('0x9')](_0xf8df('0xe'),auth[_0xf8df('0xa')](),controller['getFields']);router[_0xf8df('0x9')](_0xf8df('0xf'),auth['isAuthenticated'](),controller[_0xf8df('0x10')]);router[_0xf8df('0x9')]('/:id/descriptions',auth[_0xf8df('0xa')](),controller[_0xf8df('0x11')]);router[_0xf8df('0x12')]('/',auth[_0xf8df('0xa')](),controller['create']);router[_0xf8df('0x13')](_0xf8df('0xc'),auth[_0xf8df('0xa')](),controller[_0xf8df('0x14')]);router[_0xf8df('0x15')](_0xf8df('0xc'),auth[_0xf8df('0xa')](),controller[_0xf8df('0x16')]);module[_0xf8df('0x17')]=router; \ No newline at end of file +var _0xf03a=['show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','create','put','/:id','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerConfiguration.controller','get','isAuthenticated','index'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf03a,0x1bf));var _0xaf03=function(_0x128d82,_0x4166f6){_0x128d82=_0x128d82-0x0;var _0x5ed5ec=_0xf03a[_0x128d82];return _0x5ed5ec;};'use strict';var multer=require(_0xaf03('0x0'));var util=require(_0xaf03('0x1'));var path=require(_0xaf03('0x2'));var timeout=require(_0xaf03('0x3'));var express=require(_0xaf03('0x4'));var router=express[_0xaf03('0x5')]();var fs_extra=require(_0xaf03('0x6'));var auth=require(_0xaf03('0x7'));var interaction=require(_0xaf03('0x8'));var config=require('../../config/environment');var controller=require(_0xaf03('0x9'));router[_0xaf03('0xa')]('/',auth[_0xaf03('0xb')](),controller[_0xaf03('0xc')]);router['get']('/:id',auth[_0xaf03('0xb')](),controller[_0xaf03('0xd')]);router[_0xaf03('0xa')](_0xaf03('0xe'),auth[_0xaf03('0xb')](),controller[_0xaf03('0xf')]);router[_0xaf03('0xa')](_0xaf03('0x10'),auth[_0xaf03('0xb')](),controller['getSubjects']);router['get'](_0xaf03('0x11'),auth[_0xaf03('0xb')](),controller['getDescriptions']);router['post']('/',auth[_0xaf03('0xb')](),controller[_0xaf03('0x12')]);router[_0xaf03('0x13')](_0xaf03('0x14'),auth[_0xaf03('0xb')](),controller[_0xaf03('0x15')]);router[_0xaf03('0x16')](_0xaf03('0x14'),auth[_0xaf03('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 897793f..4e83cd2 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 _0x986d=['STRING'];(function(_0x56681c,_0x5d77c7){var _0x5c0c44=function(_0xe38ca0){while(--_0xe38ca0){_0x56681c['push'](_0x56681c['shift']());}};_0x5c0c44(++_0x5d77c7);}(_0x986d,0x77));var _0xd986=function(_0x53356a,_0x51fe4a){_0x53356a=_0x53356a-0x0;var _0x36fcef=_0x986d[_0x53356a];return _0x36fcef;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xd986('0x0')]},'description':{'type':Sequelize[_0xd986('0x0')]}}; \ No newline at end of file +var _0xcda2=['sequelize','exports'];(function(_0x2ab5f9,_0x5d9665){var _0x9f0907=function(_0x356986){while(--_0x356986){_0x2ab5f9['push'](_0x2ab5f9['shift']());}};_0x9f0907(++_0x5d9665);}(_0xcda2,0x9c));var _0x2cda=function(_0x435e2f,_0x43f39d){_0x435e2f=_0x435e2f-0x0;var _0x4f128e=_0xcda2[_0x435e2f];return _0x4f128e;};'use strict';var Sequelize=require(_0x2cda('0x0'));module[_0x2cda('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index e17137f..7f01270 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 _0xda79=['sort','pick','filter','where','VIRTUAL','name','merge','includeAll','findAll','rows','show','include','options','find','catch','create','body','params','getFields','findOne','keys','VtigerField','length','order','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','error','send','index','map','VtigerConfiguration','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','nolimit'];(function(_0x50a9f3,_0x55d56e){var _0x451d74=function(_0x4b4c34){while(--_0x4b4c34){_0x50a9f3['push'](_0x50a9f3['shift']());}};_0x451d74(++_0x55d56e);}(_0xda79,0x6f));var _0x9da7=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xda79[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require(_0x9da7('0x0'));var rimraf=require(_0x9da7('0x1'));var zipdir=require(_0x9da7('0x2'));var jsonpatch=require(_0x9da7('0x3'));var rp=require(_0x9da7('0x4'));var moment=require(_0x9da7('0x5'));var BPromise=require(_0x9da7('0x6'));var Mustache=require('mustache');var util=require(_0x9da7('0x7'));var path=require(_0x9da7('0x8'));var sox=require(_0x9da7('0x9'));var csv=require(_0x9da7('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9da7('0xb'));var _=require(_0x9da7('0xc'));var squel=require(_0x9da7('0xd'));var crypto=require(_0x9da7('0xe'));var jsforce=require(_0x9da7('0xf'));var deskjs=require(_0x9da7('0x10'));var toCsv=require('to-csv');var querystring=require(_0x9da7('0x11'));var Papa=require(_0x9da7('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9da7('0x13'));var as=require(_0x9da7('0x14'));var hardwareService=require(_0x9da7('0x15'));var logger=require(_0x9da7('0x16'))('api');var utils=require(_0x9da7('0x17'));var config=require(_0x9da7('0x18'));var licenseUtil=require(_0x9da7('0x19'));var db=require(_0x9da7('0x1a'))['db'];function respondWithStatusCode(_0x200bba,_0x1b3017){_0x1b3017=_0x1b3017||0xcc;return function(_0x5caa8c){if(_0x5caa8c){return _0x200bba[_0x9da7('0x1b')](_0x1b3017);}return _0x200bba[_0x9da7('0x1c')](_0x1b3017)[_0x9da7('0x1d')]();};}function respondWithResult(_0x4d2809,_0x30789e){_0x30789e=_0x30789e||0xc8;return function(_0x1654b6){if(_0x1654b6){return _0x4d2809['status'](_0x30789e)['json'](_0x1654b6);}};}function respondWithFilteredResult(_0x29bb70,_0x1616e5){return function(_0x3d58ef){if(_0x3d58ef){var _0x337e64=typeof _0x1616e5['offset']===_0x9da7('0x1e')&&typeof _0x1616e5[_0x9da7('0x1f')]===_0x9da7('0x1e');var _0x5db62f=_0x3d58ef[_0x9da7('0x20')];var _0x20dc20=_0x337e64?0x0:_0x1616e5[_0x9da7('0x21')];var _0x389a22=_0x337e64?_0x3d58ef[_0x9da7('0x20')]:_0x1616e5['offset']+_0x1616e5['limit'];var _0x2705c8;if(_0x389a22>=_0x5db62f){_0x389a22=_0x5db62f;_0x2705c8=0xc8;}else{_0x2705c8=0xce;}_0x29bb70['status'](_0x2705c8);return _0x29bb70[_0x9da7('0x22')](_0x9da7('0x23'),_0x20dc20+'-'+_0x389a22+'/'+_0x5db62f)[_0x9da7('0x24')](_0x3d58ef);}return null;};}function patchUpdates(_0x168d4d){return function(_0x1bb4c6){try{jsonpatch[_0x9da7('0x25')](_0x1bb4c6,_0x168d4d,!![]);}catch(_0x57a88b){return BPromise[_0x9da7('0x26')](_0x57a88b);}return _0x1bb4c6[_0x9da7('0x27')]();};}function saveUpdates(_0x5d2bbc,_0x532840){return function(_0x3989a7){if(_0x3989a7){return _0x3989a7[_0x9da7('0x28')](_0x5d2bbc)[_0x9da7('0x29')](function(_0x3770cc){return _0x3770cc;});}return null;};}function removeEntity(_0x5818dc,_0xf4188d){return function(_0x40a1c9){if(_0x40a1c9){return _0x40a1c9['destroy']()[_0x9da7('0x29')](function(){_0x5818dc['status'](0xcc)[_0x9da7('0x1d')]();});}};}function handleEntityNotFound(_0x1fc619,_0x199891){return function(_0x4eacef){if(!_0x4eacef){_0x1fc619[_0x9da7('0x1b')](0x194);}return _0x4eacef;};}function handleError(_0x86e38a,_0x408b64){_0x408b64=_0x408b64||0x1f4;return function(_0x1d37ee){logger[_0x9da7('0x2a')](_0x1d37ee['stack']);if(_0x1d37ee['name']){delete _0x1d37ee['name'];}_0x86e38a[_0x9da7('0x1c')](_0x408b64)[_0x9da7('0x2b')](_0x1d37ee);};}exports[_0x9da7('0x2c')]=function(_0x78f36,_0x6f67b1){var _0x311d71={},_0x150d18={},_0x4b39de={'count':0x0,'rows':[]};var _0x533dcb=_[_0x9da7('0x2d')](db[_0x9da7('0x2e')][_0x9da7('0x2f')],function(_0xe57c4c){return{'name':_0xe57c4c['fieldName'],'type':_0xe57c4c[_0x9da7('0x30')][_0x9da7('0x31')]};});_0x150d18[_0x9da7('0x32')]=_[_0x9da7('0x2d')](_0x533dcb,'name');_0x150d18[_0x9da7('0x33')]=_['keys'](_0x78f36[_0x9da7('0x33')]);_0x150d18[_0x9da7('0x34')]=_[_0x9da7('0x35')](_0x150d18[_0x9da7('0x32')],_0x150d18[_0x9da7('0x33')]);_0x311d71[_0x9da7('0x36')]=_[_0x9da7('0x35')](_0x150d18[_0x9da7('0x32')],qs[_0x9da7('0x37')](_0x78f36['query'][_0x9da7('0x37')]));_0x311d71[_0x9da7('0x36')]=_0x311d71['attributes']['length']?_0x311d71[_0x9da7('0x36')]:_0x150d18['model'];if(!_0x78f36[_0x9da7('0x33')]['hasOwnProperty'](_0x9da7('0x38'))){_0x311d71['limit']=qs['limit'](_0x78f36[_0x9da7('0x33')][_0x9da7('0x1f')]);_0x311d71[_0x9da7('0x21')]=qs[_0x9da7('0x21')](_0x78f36['query']['offset']);}_0x311d71['order']=qs[_0x9da7('0x39')](_0x78f36[_0x9da7('0x33')][_0x9da7('0x39')]);_0x311d71['where']=qs['filters'](_[_0x9da7('0x3a')](_0x78f36[_0x9da7('0x33')],_0x150d18[_0x9da7('0x34')]),_0x533dcb);if(_0x78f36[_0x9da7('0x33')][_0x9da7('0x3b')]){_0x311d71[_0x9da7('0x3c')]=_['merge'](_0x311d71[_0x9da7('0x3c')],{'$or':_[_0x9da7('0x2d')](_0x533dcb,function(_0xa44814){if(_0xa44814['type']!==_0x9da7('0x3d')){var _0x5b1c6a={};_0x5b1c6a[_0xa44814[_0x9da7('0x3e')]]={'$like':'%'+_0x78f36[_0x9da7('0x33')]['filter']+'%'};return _0x5b1c6a;}})});}_0x311d71=_[_0x9da7('0x3f')]({},_0x311d71,_0x78f36['options']);var _0x3f1620={'where':_0x311d71[_0x9da7('0x3c')]};return db['VtigerConfiguration'][_0x9da7('0x20')](_0x3f1620)[_0x9da7('0x29')](function(_0x2fefb6){_0x4b39de['count']=_0x2fefb6;if(_0x78f36[_0x9da7('0x33')][_0x9da7('0x40')]){_0x311d71['include']=[{'all':!![]}];}return db[_0x9da7('0x2e')][_0x9da7('0x41')](_0x311d71);})[_0x9da7('0x29')](function(_0x156857){_0x4b39de[_0x9da7('0x42')]=_0x156857;return _0x4b39de;})['then'](respondWithFilteredResult(_0x6f67b1,_0x311d71))['catch'](handleError(_0x6f67b1,null));};exports[_0x9da7('0x43')]=function(_0xf12aa6,_0x5e3a87){var _0x527a12={'raw':![],'where':{'id':_0xf12aa6['params']['id']}},_0x1289a3={};_0x1289a3[_0x9da7('0x32')]=_['keys'](db[_0x9da7('0x2e')][_0x9da7('0x2f')]);_0x1289a3['query']=_['keys'](_0xf12aa6[_0x9da7('0x33')]);_0x1289a3['filters']=_[_0x9da7('0x35')](_0x1289a3[_0x9da7('0x32')],_0x1289a3[_0x9da7('0x33')]);_0x527a12[_0x9da7('0x36')]=_[_0x9da7('0x35')](_0x1289a3[_0x9da7('0x32')],qs[_0x9da7('0x37')](_0xf12aa6[_0x9da7('0x33')]['fields']));_0x527a12[_0x9da7('0x36')]=_0x527a12['attributes']['length']?_0x527a12[_0x9da7('0x36')]:_0x1289a3[_0x9da7('0x32')];if(_0xf12aa6[_0x9da7('0x33')][_0x9da7('0x40')]){_0x527a12[_0x9da7('0x44')]=[{'all':!![]}];}_0x527a12=_[_0x9da7('0x3f')]({},_0x527a12,_0xf12aa6[_0x9da7('0x45')]);return db['VtigerConfiguration'][_0x9da7('0x46')](_0x527a12)[_0x9da7('0x29')](handleEntityNotFound(_0x5e3a87,null))[_0x9da7('0x29')](respondWithResult(_0x5e3a87,null))[_0x9da7('0x47')](handleError(_0x5e3a87,null));};exports[_0x9da7('0x48')]=function(_0x91e4ae,_0x413286){return db[_0x9da7('0x2e')]['create'](_0x91e4ae['body'],{})[_0x9da7('0x29')](respondWithResult(_0x413286,0xc9))[_0x9da7('0x47')](handleError(_0x413286,null));};exports[_0x9da7('0x28')]=function(_0x19f8e8,_0x1a5745){if(_0x19f8e8[_0x9da7('0x49')]['id']){delete _0x19f8e8['body']['id'];}return db[_0x9da7('0x2e')][_0x9da7('0x46')]({'where':{'id':_0x19f8e8[_0x9da7('0x4a')]['id']}})[_0x9da7('0x29')](handleEntityNotFound(_0x1a5745,null))[_0x9da7('0x29')](saveUpdates(_0x19f8e8[_0x9da7('0x49')],null))[_0x9da7('0x29')](respondWithResult(_0x1a5745,null))[_0x9da7('0x47')](handleError(_0x1a5745,null));};exports['destroy']=function(_0x5ca6f5,_0x1e089d){return db[_0x9da7('0x2e')][_0x9da7('0x46')]({'where':{'id':_0x5ca6f5[_0x9da7('0x4a')]['id']}})[_0x9da7('0x29')](handleEntityNotFound(_0x1e089d,null))[_0x9da7('0x29')](removeEntity(_0x1e089d,null))[_0x9da7('0x47')](handleError(_0x1e089d,null));};exports[_0x9da7('0x4b')]=function(_0x2cbf7b,_0xbe71ce,_0x1b06db){var _0x262003={};var _0x1c9f9c={};var _0x3b6ee8;var _0x4ec47a;return db[_0x9da7('0x2e')][_0x9da7('0x4c')]({'where':{'id':_0x2cbf7b[_0x9da7('0x4a')]['id']}})[_0x9da7('0x29')](handleEntityNotFound(_0xbe71ce,null))['then'](function(_0x35205c){if(_0x35205c){_0x3b6ee8=_0x35205c;_0x1c9f9c[_0x9da7('0x32')]=_[_0x9da7('0x4d')](db[_0x9da7('0x4e')]['rawAttributes']);_0x1c9f9c[_0x9da7('0x33')]=_[_0x9da7('0x4d')](_0x2cbf7b['query']);_0x1c9f9c['filters']=_[_0x9da7('0x35')](_0x1c9f9c['model'],_0x1c9f9c[_0x9da7('0x33')]);_0x262003[_0x9da7('0x36')]=_[_0x9da7('0x35')](_0x1c9f9c['model'],qs[_0x9da7('0x37')](_0x2cbf7b[_0x9da7('0x33')]['fields']));_0x262003[_0x9da7('0x36')]=_0x262003[_0x9da7('0x36')][_0x9da7('0x4f')]?_0x262003['attributes']:_0x1c9f9c['model'];_0x262003[_0x9da7('0x50')]=qs[_0x9da7('0x39')](_0x2cbf7b['query'][_0x9da7('0x39')]);_0x262003['where']=qs['filters'](_[_0x9da7('0x3a')](_0x2cbf7b['query'],_0x1c9f9c[_0x9da7('0x34')]));if(_0x2cbf7b[_0x9da7('0x33')][_0x9da7('0x3b')]){_0x262003[_0x9da7('0x3c')]=_[_0x9da7('0x3f')](_0x262003[_0x9da7('0x3c')],{'$or':_[_0x9da7('0x2d')](_0x262003[_0x9da7('0x36')],function(_0x33387d){var _0x16a5df={};_0x16a5df[_0x33387d]={'$like':'%'+_0x2cbf7b['query'][_0x9da7('0x3b')]+'%'};return _0x16a5df;})});}_0x262003=_[_0x9da7('0x3f')]({},_0x262003,_0x2cbf7b[_0x9da7('0x45')]);return _0x3b6ee8[_0x9da7('0x4b')](_0x262003);}})['then'](function(_0x61fd87){if(_0x61fd87){_0x4ec47a=_0x61fd87[_0x9da7('0x4f')];if(!_0x2cbf7b[_0x9da7('0x33')][_0x9da7('0x51')](_0x9da7('0x38'))){_0x262003[_0x9da7('0x1f')]=qs['limit'](_0x2cbf7b[_0x9da7('0x33')]['limit']);_0x262003[_0x9da7('0x21')]=qs[_0x9da7('0x21')](_0x2cbf7b[_0x9da7('0x33')][_0x9da7('0x21')]);}return _0x3b6ee8[_0x9da7('0x4b')](_0x262003);}})['then'](function(_0x3eda91){if(_0x3eda91){return _0x3eda91?{'count':_0x4ec47a,'rows':_0x3eda91}:null;}})[_0x9da7('0x29')](respondWithResult(_0xbe71ce,null))[_0x9da7('0x47')](handleError(_0xbe71ce,null));};exports[_0x9da7('0x52')]=function(_0x46ad81,_0x4c0399,_0x308504){var _0x12885a={};var _0xe01e0e={};var _0x419c76;var _0x322670;return db[_0x9da7('0x2e')][_0x9da7('0x4c')]({'where':{'id':_0x46ad81['params']['id']}})[_0x9da7('0x29')](handleEntityNotFound(_0x4c0399,null))[_0x9da7('0x29')](function(_0x246a7a){if(_0x246a7a){_0x419c76=_0x246a7a;_0xe01e0e['model']=_[_0x9da7('0x4d')](db['VtigerField'][_0x9da7('0x2f')]);_0xe01e0e[_0x9da7('0x33')]=_[_0x9da7('0x4d')](_0x46ad81[_0x9da7('0x33')]);_0xe01e0e['filters']=_[_0x9da7('0x35')](_0xe01e0e['model'],_0xe01e0e[_0x9da7('0x33')]);_0x12885a['attributes']=_['intersection'](_0xe01e0e[_0x9da7('0x32')],qs[_0x9da7('0x37')](_0x46ad81[_0x9da7('0x33')]['fields']));_0x12885a[_0x9da7('0x36')]=_0x12885a['attributes'][_0x9da7('0x4f')]?_0x12885a[_0x9da7('0x36')]:_0xe01e0e[_0x9da7('0x32')];_0x12885a[_0x9da7('0x50')]=qs[_0x9da7('0x39')](_0x46ad81[_0x9da7('0x33')][_0x9da7('0x39')]);_0x12885a[_0x9da7('0x3c')]=qs[_0x9da7('0x34')](_['pick'](_0x46ad81[_0x9da7('0x33')],_0xe01e0e['filters']));if(_0x46ad81[_0x9da7('0x33')][_0x9da7('0x3b')]){_0x12885a[_0x9da7('0x3c')]=_[_0x9da7('0x3f')](_0x12885a['where'],{'$or':_['map'](_0x12885a[_0x9da7('0x36')],function(_0x33b26f){var _0x4f625a={};_0x4f625a[_0x33b26f]={'$like':'%'+_0x46ad81['query'][_0x9da7('0x3b')]+'%'};return _0x4f625a;})});}_0x12885a=_[_0x9da7('0x3f')]({},_0x12885a,_0x46ad81[_0x9da7('0x45')]);return _0x419c76[_0x9da7('0x52')](_0x12885a);}})[_0x9da7('0x29')](function(_0x319af3){if(_0x319af3){_0x322670=_0x319af3[_0x9da7('0x4f')];if(!_0x46ad81['query'][_0x9da7('0x51')](_0x9da7('0x38'))){_0x12885a[_0x9da7('0x1f')]=qs[_0x9da7('0x1f')](_0x46ad81[_0x9da7('0x33')][_0x9da7('0x1f')]);_0x12885a[_0x9da7('0x21')]=qs[_0x9da7('0x21')](_0x46ad81['query']['offset']);}return _0x419c76[_0x9da7('0x52')](_0x12885a);}})['then'](function(_0x7da341){if(_0x7da341){return _0x7da341?{'count':_0x322670,'rows':_0x7da341}:null;}})[_0x9da7('0x29')](respondWithResult(_0x4c0399,null))[_0x9da7('0x47')](handleError(_0x4c0399,null));};exports[_0x9da7('0x53')]=function(_0x5ed47c,_0x1059e5,_0x58e71b){var _0x5173cf={};var _0x22355b={};var _0x3d17e3;var _0x5e173b;return db[_0x9da7('0x2e')]['findOne']({'where':{'id':_0x5ed47c[_0x9da7('0x4a')]['id']}})[_0x9da7('0x29')](handleEntityNotFound(_0x1059e5,null))[_0x9da7('0x29')](function(_0x739e85){if(_0x739e85){_0x3d17e3=_0x739e85;_0x22355b['model']=_[_0x9da7('0x4d')](db[_0x9da7('0x4e')][_0x9da7('0x2f')]);_0x22355b[_0x9da7('0x33')]=_[_0x9da7('0x4d')](_0x5ed47c[_0x9da7('0x33')]);_0x22355b[_0x9da7('0x34')]=_['intersection'](_0x22355b['model'],_0x22355b[_0x9da7('0x33')]);_0x5173cf[_0x9da7('0x36')]=_[_0x9da7('0x35')](_0x22355b[_0x9da7('0x32')],qs['fields'](_0x5ed47c[_0x9da7('0x33')][_0x9da7('0x37')]));_0x5173cf[_0x9da7('0x36')]=_0x5173cf[_0x9da7('0x36')]['length']?_0x5173cf['attributes']:_0x22355b['model'];_0x5173cf[_0x9da7('0x50')]=qs[_0x9da7('0x39')](_0x5ed47c[_0x9da7('0x33')][_0x9da7('0x39')]);_0x5173cf[_0x9da7('0x3c')]=qs[_0x9da7('0x34')](_[_0x9da7('0x3a')](_0x5ed47c[_0x9da7('0x33')],_0x22355b[_0x9da7('0x34')]));if(_0x5ed47c['query'][_0x9da7('0x3b')]){_0x5173cf['where']=_[_0x9da7('0x3f')](_0x5173cf[_0x9da7('0x3c')],{'$or':_['map'](_0x5173cf[_0x9da7('0x36')],function(_0x38d4df){var _0x52d77a={};_0x52d77a[_0x38d4df]={'$like':'%'+_0x5ed47c[_0x9da7('0x33')][_0x9da7('0x3b')]+'%'};return _0x52d77a;})});}_0x5173cf=_[_0x9da7('0x3f')]({},_0x5173cf,_0x5ed47c[_0x9da7('0x45')]);return _0x3d17e3[_0x9da7('0x53')](_0x5173cf);}})[_0x9da7('0x29')](function(_0x18454d){if(_0x18454d){_0x5e173b=_0x18454d[_0x9da7('0x4f')];if(!_0x5ed47c[_0x9da7('0x33')][_0x9da7('0x51')]('nolimit')){_0x5173cf[_0x9da7('0x1f')]=qs[_0x9da7('0x1f')](_0x5ed47c[_0x9da7('0x33')][_0x9da7('0x1f')]);_0x5173cf[_0x9da7('0x21')]=qs[_0x9da7('0x21')](_0x5ed47c[_0x9da7('0x33')][_0x9da7('0x21')]);}return _0x3d17e3[_0x9da7('0x53')](_0x5173cf);}})['then'](function(_0x46f63e){if(_0x46f63e){return _0x46f63e?{'count':_0x5e173b,'rows':_0x46f63e}:null;}})['then'](respondWithResult(_0x1059e5,null))[_0x9da7('0x47')](handleError(_0x1059e5,null));}; \ No newline at end of file +var _0x28b5=['zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','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','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','then','sendStatus','error','stack','name','send','index','VtigerConfiguration','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','type','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','destroy','getFields','findOne','VtigerField','rawAttributes','getSubjects','getDescriptions','eml-format'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x28b5,0x13f));var _0x528b=function(_0x3d886c,_0x35fcbe){_0x3d886c=_0x3d886c-0x0;var _0x3819a7=_0x28b5[_0x3d886c];return _0x3819a7;};'use strict';var emlformat=require(_0x528b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x528b('0x1'));var jsonpatch=require(_0x528b('0x2'));var rp=require(_0x528b('0x3'));var moment=require('moment');var BPromise=require(_0x528b('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x528b('0x5'));var sox=require(_0x528b('0x6'));var csv=require(_0x528b('0x7'));var ejs=require(_0x528b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x528b('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x528b('0xa'));var deskjs=require(_0x528b('0xb'));var toCsv=require(_0x528b('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x528b('0xc'));var authService=require(_0x528b('0xd'));var qs=require(_0x528b('0xe'));var as=require(_0x528b('0xf'));var hardwareService=require(_0x528b('0x10'));var logger=require('../../config/logger')(_0x528b('0x11'));var utils=require(_0x528b('0x12'));var config=require(_0x528b('0x13'));var licenseUtil=require(_0x528b('0x14'));var db=require(_0x528b('0x15'))['db'];function respondWithStatusCode(_0x48afc8,_0x55226f){_0x55226f=_0x55226f||0xcc;return function(_0x37ae6d){if(_0x37ae6d){return _0x48afc8['sendStatus'](_0x55226f);}return _0x48afc8[_0x528b('0x16')](_0x55226f)[_0x528b('0x17')]();};}function respondWithResult(_0x912e3a,_0x117a6f){_0x117a6f=_0x117a6f||0xc8;return function(_0x26b88f){if(_0x26b88f){return _0x912e3a['status'](_0x117a6f)[_0x528b('0x18')](_0x26b88f);}};}function respondWithFilteredResult(_0x2c646f,_0x51819e){return function(_0x243013){if(_0x243013){var _0x1a31cd=typeof _0x51819e['offset']===_0x528b('0x19')&&typeof _0x51819e[_0x528b('0x1a')]===_0x528b('0x19');var _0x3d6fb3=_0x243013['count'];var _0x4b95f9=_0x1a31cd?0x0:_0x51819e[_0x528b('0x1b')];var _0x311235=_0x1a31cd?_0x243013[_0x528b('0x1c')]:_0x51819e['offset']+_0x51819e[_0x528b('0x1a')];var _0x2862ea;if(_0x311235>=_0x3d6fb3){_0x311235=_0x3d6fb3;_0x2862ea=0xc8;}else{_0x2862ea=0xce;}_0x2c646f[_0x528b('0x16')](_0x2862ea);return _0x2c646f[_0x528b('0x1d')](_0x528b('0x1e'),_0x4b95f9+'-'+_0x311235+'/'+_0x3d6fb3)[_0x528b('0x18')](_0x243013);}return null;};}function patchUpdates(_0x1fa3d6){return function(_0x428a82){try{jsonpatch['apply'](_0x428a82,_0x1fa3d6,!![]);}catch(_0xb5ba11){return BPromise[_0x528b('0x1f')](_0xb5ba11);}return _0x428a82[_0x528b('0x20')]();};}function saveUpdates(_0xa61412,_0xba8e96){return function(_0x206d43){if(_0x206d43){return _0x206d43[_0x528b('0x21')](_0xa61412)[_0x528b('0x22')](function(_0x50f7b7){return _0x50f7b7;});}return null;};}function removeEntity(_0x627143,_0x568116){return function(_0x406b2a){if(_0x406b2a){return _0x406b2a['destroy']()[_0x528b('0x22')](function(){_0x627143[_0x528b('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5282d5,_0x2ff15e){return function(_0x51efb0){if(!_0x51efb0){_0x5282d5[_0x528b('0x23')](0x194);}return _0x51efb0;};}function handleError(_0x4c7768,_0x4eb41f){_0x4eb41f=_0x4eb41f||0x1f4;return function(_0x52d1df){logger[_0x528b('0x24')](_0x52d1df[_0x528b('0x25')]);if(_0x52d1df[_0x528b('0x26')]){delete _0x52d1df[_0x528b('0x26')];}_0x4c7768[_0x528b('0x16')](_0x4eb41f)[_0x528b('0x27')](_0x52d1df);};}exports[_0x528b('0x28')]=function(_0xf96211,_0x276b06){var _0x1c5d43={},_0x2cb914={},_0x558cb5={'count':0x0,'rows':[]};var _0x514feb=_['map'](db[_0x528b('0x29')]['rawAttributes'],function(_0x439ee4){return{'name':_0x439ee4[_0x528b('0x2a')],'type':_0x439ee4['type'][_0x528b('0x2b')]};});_0x2cb914['model']=_['map'](_0x514feb,_0x528b('0x26'));_0x2cb914[_0x528b('0x2c')]=_[_0x528b('0x2d')](_0xf96211['query']);_0x2cb914[_0x528b('0x2e')]=_[_0x528b('0x2f')](_0x2cb914['model'],_0x2cb914[_0x528b('0x2c')]);_0x1c5d43['attributes']=_[_0x528b('0x2f')](_0x2cb914[_0x528b('0x30')],qs[_0x528b('0x31')](_0xf96211[_0x528b('0x2c')][_0x528b('0x31')]));_0x1c5d43[_0x528b('0x32')]=_0x1c5d43['attributes'][_0x528b('0x33')]?_0x1c5d43[_0x528b('0x32')]:_0x2cb914[_0x528b('0x30')];if(!_0xf96211[_0x528b('0x2c')][_0x528b('0x34')](_0x528b('0x35'))){_0x1c5d43[_0x528b('0x1a')]=qs['limit'](_0xf96211[_0x528b('0x2c')][_0x528b('0x1a')]);_0x1c5d43[_0x528b('0x1b')]=qs[_0x528b('0x1b')](_0xf96211['query'][_0x528b('0x1b')]);}_0x1c5d43[_0x528b('0x36')]=qs[_0x528b('0x37')](_0xf96211[_0x528b('0x2c')][_0x528b('0x37')]);_0x1c5d43[_0x528b('0x38')]=qs[_0x528b('0x2e')](_[_0x528b('0x39')](_0xf96211[_0x528b('0x2c')],_0x2cb914['filters']),_0x514feb);if(_0xf96211['query'][_0x528b('0x3a')]){_0x1c5d43[_0x528b('0x38')]=_['merge'](_0x1c5d43['where'],{'$or':_[_0x528b('0x3b')](_0x514feb,function(_0x5c8fbf){if(_0x5c8fbf[_0x528b('0x3c')]!=='VIRTUAL'){var _0x5b92ad={};_0x5b92ad[_0x5c8fbf[_0x528b('0x26')]]={'$like':'%'+_0xf96211[_0x528b('0x2c')]['filter']+'%'};return _0x5b92ad;}})});}_0x1c5d43=_[_0x528b('0x3d')]({},_0x1c5d43,_0xf96211['options']);var _0x257484={'where':_0x1c5d43[_0x528b('0x38')]};return db[_0x528b('0x29')]['count'](_0x257484)[_0x528b('0x22')](function(_0x5608f3){_0x558cb5[_0x528b('0x1c')]=_0x5608f3;if(_0xf96211['query'][_0x528b('0x3e')]){_0x1c5d43[_0x528b('0x3f')]=[{'all':!![]}];}return db[_0x528b('0x29')][_0x528b('0x40')](_0x1c5d43);})[_0x528b('0x22')](function(_0x2aa4e9){_0x558cb5[_0x528b('0x41')]=_0x2aa4e9;return _0x558cb5;})['then'](respondWithFilteredResult(_0x276b06,_0x1c5d43))[_0x528b('0x42')](handleError(_0x276b06,null));};exports[_0x528b('0x43')]=function(_0x470ce5,_0xe1c4f3){var _0x4245a3={'raw':![],'where':{'id':_0x470ce5[_0x528b('0x44')]['id']}},_0x59bc3e={};_0x59bc3e['model']=_['keys'](db[_0x528b('0x29')]['rawAttributes']);_0x59bc3e[_0x528b('0x2c')]=_[_0x528b('0x2d')](_0x470ce5['query']);_0x59bc3e[_0x528b('0x2e')]=_[_0x528b('0x2f')](_0x59bc3e[_0x528b('0x30')],_0x59bc3e[_0x528b('0x2c')]);_0x4245a3[_0x528b('0x32')]=_[_0x528b('0x2f')](_0x59bc3e['model'],qs['fields'](_0x470ce5[_0x528b('0x2c')]['fields']));_0x4245a3[_0x528b('0x32')]=_0x4245a3[_0x528b('0x32')][_0x528b('0x33')]?_0x4245a3['attributes']:_0x59bc3e['model'];if(_0x470ce5[_0x528b('0x2c')][_0x528b('0x3e')]){_0x4245a3[_0x528b('0x3f')]=[{'all':!![]}];}_0x4245a3=_['merge']({},_0x4245a3,_0x470ce5[_0x528b('0x45')]);return db[_0x528b('0x29')][_0x528b('0x46')](_0x4245a3)['then'](handleEntityNotFound(_0xe1c4f3,null))[_0x528b('0x22')](respondWithResult(_0xe1c4f3,null))['catch'](handleError(_0xe1c4f3,null));};exports[_0x528b('0x47')]=function(_0x6bc3d1,_0x5dcb1b){return db[_0x528b('0x29')][_0x528b('0x47')](_0x6bc3d1['body'],{})['then'](respondWithResult(_0x5dcb1b,0xc9))[_0x528b('0x42')](handleError(_0x5dcb1b,null));};exports[_0x528b('0x21')]=function(_0x59ca99,_0x2f4337){if(_0x59ca99[_0x528b('0x48')]['id']){delete _0x59ca99['body']['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0x59ca99[_0x528b('0x44')]['id']}})[_0x528b('0x22')](handleEntityNotFound(_0x2f4337,null))[_0x528b('0x22')](saveUpdates(_0x59ca99['body'],null))['then'](respondWithResult(_0x2f4337,null))[_0x528b('0x42')](handleError(_0x2f4337,null));};exports[_0x528b('0x49')]=function(_0x597e9a,_0x4f5afb){return db[_0x528b('0x29')][_0x528b('0x46')]({'where':{'id':_0x597e9a[_0x528b('0x44')]['id']}})[_0x528b('0x22')](handleEntityNotFound(_0x4f5afb,null))[_0x528b('0x22')](removeEntity(_0x4f5afb,null))[_0x528b('0x42')](handleError(_0x4f5afb,null));};exports[_0x528b('0x4a')]=function(_0x3f4e06,_0x2b0575,_0xd84639){var _0x2ed0d9={};var _0x408f42={};var _0x46fbed;var _0x4175ef;return db['VtigerConfiguration'][_0x528b('0x4b')]({'where':{'id':_0x3f4e06[_0x528b('0x44')]['id']}})['then'](handleEntityNotFound(_0x2b0575,null))['then'](function(_0x5d11ec){if(_0x5d11ec){_0x46fbed=_0x5d11ec;_0x408f42[_0x528b('0x30')]=_[_0x528b('0x2d')](db[_0x528b('0x4c')][_0x528b('0x4d')]);_0x408f42['query']=_[_0x528b('0x2d')](_0x3f4e06['query']);_0x408f42['filters']=_[_0x528b('0x2f')](_0x408f42['model'],_0x408f42[_0x528b('0x2c')]);_0x2ed0d9[_0x528b('0x32')]=_[_0x528b('0x2f')](_0x408f42[_0x528b('0x30')],qs[_0x528b('0x31')](_0x3f4e06[_0x528b('0x2c')][_0x528b('0x31')]));_0x2ed0d9[_0x528b('0x32')]=_0x2ed0d9[_0x528b('0x32')][_0x528b('0x33')]?_0x2ed0d9[_0x528b('0x32')]:_0x408f42[_0x528b('0x30')];_0x2ed0d9[_0x528b('0x36')]=qs[_0x528b('0x37')](_0x3f4e06[_0x528b('0x2c')][_0x528b('0x37')]);_0x2ed0d9[_0x528b('0x38')]=qs[_0x528b('0x2e')](_[_0x528b('0x39')](_0x3f4e06[_0x528b('0x2c')],_0x408f42[_0x528b('0x2e')]));if(_0x3f4e06[_0x528b('0x2c')]['filter']){_0x2ed0d9[_0x528b('0x38')]=_[_0x528b('0x3d')](_0x2ed0d9[_0x528b('0x38')],{'$or':_[_0x528b('0x3b')](_0x2ed0d9[_0x528b('0x32')],function(_0x4cec08){var _0x49866e={};_0x49866e[_0x4cec08]={'$like':'%'+_0x3f4e06[_0x528b('0x2c')][_0x528b('0x3a')]+'%'};return _0x49866e;})});}_0x2ed0d9=_[_0x528b('0x3d')]({},_0x2ed0d9,_0x3f4e06['options']);return _0x46fbed['getFields'](_0x2ed0d9);}})[_0x528b('0x22')](function(_0x54ec85){if(_0x54ec85){_0x4175ef=_0x54ec85['length'];if(!_0x3f4e06[_0x528b('0x2c')][_0x528b('0x34')](_0x528b('0x35'))){_0x2ed0d9[_0x528b('0x1a')]=qs[_0x528b('0x1a')](_0x3f4e06[_0x528b('0x2c')][_0x528b('0x1a')]);_0x2ed0d9[_0x528b('0x1b')]=qs[_0x528b('0x1b')](_0x3f4e06['query'][_0x528b('0x1b')]);}return _0x46fbed[_0x528b('0x4a')](_0x2ed0d9);}})[_0x528b('0x22')](function(_0x1a7e35){if(_0x1a7e35){return _0x1a7e35?{'count':_0x4175ef,'rows':_0x1a7e35}:null;}})[_0x528b('0x22')](respondWithResult(_0x2b0575,null))[_0x528b('0x42')](handleError(_0x2b0575,null));};exports[_0x528b('0x4e')]=function(_0x47b2d4,_0x5a903e,_0x4a88b4){var _0x41dedc={};var _0x5314bc={};var _0x328345;var _0x2ec649;return db['VtigerConfiguration'][_0x528b('0x4b')]({'where':{'id':_0x47b2d4[_0x528b('0x44')]['id']}})['then'](handleEntityNotFound(_0x5a903e,null))[_0x528b('0x22')](function(_0x290309){if(_0x290309){_0x328345=_0x290309;_0x5314bc[_0x528b('0x30')]=_[_0x528b('0x2d')](db[_0x528b('0x4c')][_0x528b('0x4d')]);_0x5314bc[_0x528b('0x2c')]=_['keys'](_0x47b2d4['query']);_0x5314bc[_0x528b('0x2e')]=_[_0x528b('0x2f')](_0x5314bc[_0x528b('0x30')],_0x5314bc[_0x528b('0x2c')]);_0x41dedc[_0x528b('0x32')]=_[_0x528b('0x2f')](_0x5314bc[_0x528b('0x30')],qs[_0x528b('0x31')](_0x47b2d4[_0x528b('0x2c')][_0x528b('0x31')]));_0x41dedc['attributes']=_0x41dedc['attributes'][_0x528b('0x33')]?_0x41dedc[_0x528b('0x32')]:_0x5314bc['model'];_0x41dedc['order']=qs['sort'](_0x47b2d4[_0x528b('0x2c')][_0x528b('0x37')]);_0x41dedc[_0x528b('0x38')]=qs[_0x528b('0x2e')](_[_0x528b('0x39')](_0x47b2d4[_0x528b('0x2c')],_0x5314bc[_0x528b('0x2e')]));if(_0x47b2d4['query'][_0x528b('0x3a')]){_0x41dedc[_0x528b('0x38')]=_[_0x528b('0x3d')](_0x41dedc[_0x528b('0x38')],{'$or':_['map'](_0x41dedc[_0x528b('0x32')],function(_0x1ae8af){var _0x455922={};_0x455922[_0x1ae8af]={'$like':'%'+_0x47b2d4['query'][_0x528b('0x3a')]+'%'};return _0x455922;})});}_0x41dedc=_[_0x528b('0x3d')]({},_0x41dedc,_0x47b2d4[_0x528b('0x45')]);return _0x328345[_0x528b('0x4e')](_0x41dedc);}})['then'](function(_0x3e462e){if(_0x3e462e){_0x2ec649=_0x3e462e['length'];if(!_0x47b2d4[_0x528b('0x2c')][_0x528b('0x34')](_0x528b('0x35'))){_0x41dedc['limit']=qs[_0x528b('0x1a')](_0x47b2d4[_0x528b('0x2c')][_0x528b('0x1a')]);_0x41dedc['offset']=qs[_0x528b('0x1b')](_0x47b2d4[_0x528b('0x2c')][_0x528b('0x1b')]);}return _0x328345['getSubjects'](_0x41dedc);}})[_0x528b('0x22')](function(_0x591dd8){if(_0x591dd8){return _0x591dd8?{'count':_0x2ec649,'rows':_0x591dd8}:null;}})['then'](respondWithResult(_0x5a903e,null))['catch'](handleError(_0x5a903e,null));};exports[_0x528b('0x4f')]=function(_0x572294,_0x234084,_0x3f9ba6){var _0x384b35={};var _0x219457={};var _0x18c08c;var _0x1eaed2;return db['VtigerConfiguration'][_0x528b('0x4b')]({'where':{'id':_0x572294[_0x528b('0x44')]['id']}})['then'](handleEntityNotFound(_0x234084,null))[_0x528b('0x22')](function(_0x1570e7){if(_0x1570e7){_0x18c08c=_0x1570e7;_0x219457['model']=_[_0x528b('0x2d')](db[_0x528b('0x4c')][_0x528b('0x4d')]);_0x219457[_0x528b('0x2c')]=_[_0x528b('0x2d')](_0x572294['query']);_0x219457[_0x528b('0x2e')]=_[_0x528b('0x2f')](_0x219457[_0x528b('0x30')],_0x219457[_0x528b('0x2c')]);_0x384b35[_0x528b('0x32')]=_[_0x528b('0x2f')](_0x219457[_0x528b('0x30')],qs[_0x528b('0x31')](_0x572294['query']['fields']));_0x384b35['attributes']=_0x384b35[_0x528b('0x32')]['length']?_0x384b35[_0x528b('0x32')]:_0x219457[_0x528b('0x30')];_0x384b35[_0x528b('0x36')]=qs[_0x528b('0x37')](_0x572294['query'][_0x528b('0x37')]);_0x384b35[_0x528b('0x38')]=qs[_0x528b('0x2e')](_[_0x528b('0x39')](_0x572294[_0x528b('0x2c')],_0x219457[_0x528b('0x2e')]));if(_0x572294[_0x528b('0x2c')][_0x528b('0x3a')]){_0x384b35[_0x528b('0x38')]=_[_0x528b('0x3d')](_0x384b35['where'],{'$or':_[_0x528b('0x3b')](_0x384b35[_0x528b('0x32')],function(_0x1d62aa){var _0x11ab6e={};_0x11ab6e[_0x1d62aa]={'$like':'%'+_0x572294['query'][_0x528b('0x3a')]+'%'};return _0x11ab6e;})});}_0x384b35=_[_0x528b('0x3d')]({},_0x384b35,_0x572294['options']);return _0x18c08c[_0x528b('0x4f')](_0x384b35);}})[_0x528b('0x22')](function(_0x1f4ec0){if(_0x1f4ec0){_0x1eaed2=_0x1f4ec0['length'];if(!_0x572294[_0x528b('0x2c')][_0x528b('0x34')](_0x528b('0x35'))){_0x384b35[_0x528b('0x1a')]=qs[_0x528b('0x1a')](_0x572294['query'][_0x528b('0x1a')]);_0x384b35[_0x528b('0x1b')]=qs[_0x528b('0x1b')](_0x572294['query'][_0x528b('0x1b')]);}return _0x18c08c[_0x528b('0x4f')](_0x384b35);}})[_0x528b('0x22')](function(_0x244d8a){if(_0x244d8a){return _0x244d8a?{'count':_0x1eaed2,'rows':_0x244d8a}:null;}})[_0x528b('0x22')](respondWithResult(_0x234084,null))[_0x528b('0x42')](handleError(_0x234084,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index d07906b..698fa48 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 _0xee92=['moment','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','define','VtigerConfiguration','int_vtiger_configurations','../../config/logger','api'];(function(_0x4fa227,_0x1a93d4){var _0x30a825=function(_0x13f2e0){while(--_0x13f2e0){_0x4fa227['push'](_0x4fa227['shift']());}};_0x30a825(++_0x1a93d4);}(_0xee92,0xfb));var _0x2ee9=function(_0x426541,_0x4648d6){_0x426541=_0x426541-0x0;var _0x3631e4=_0xee92[_0x426541];return _0x3631e4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2ee9('0x0'))(_0x2ee9('0x1'));var moment=require(_0x2ee9('0x2'));var BPromise=require('bluebird');var rp=require(_0x2ee9('0x3'));var fs=require('fs');var path=require(_0x2ee9('0x4'));var rimraf=require(_0x2ee9('0x5'));var config=require(_0x2ee9('0x6'));var attributes=require(_0x2ee9('0x7'));module['exports']=function(_0x198968,_0x34e67c){return _0x198968[_0x2ee9('0x8')](_0x2ee9('0x9'),attributes,{'tableName':_0x2ee9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe153=['api','moment','request-promise','path','rimraf','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger'];(function(_0x691c4e,_0x387544){var _0x54071e=function(_0x1825b8){while(--_0x1825b8){_0x691c4e['push'](_0x691c4e['shift']());}};_0x54071e(++_0x387544);}(_0xe153,0xcd));var _0x3e15=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe153[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x3e15('0x0'));var util=require(_0x3e15('0x1'));var logger=require(_0x3e15('0x2'))(_0x3e15('0x3'));var moment=require(_0x3e15('0x4'));var BPromise=require('bluebird');var rp=require(_0x3e15('0x5'));var fs=require('fs');var path=require(_0x3e15('0x6'));var rimraf=require(_0x3e15('0x7'));var config=require('../../config/environment');var attributes=require(_0x3e15('0x8'));module[_0x3e15('0x9')]=function(_0x4ae03a,_0x5b1b41){return _0x4ae03a[_0x3e15('0xa')](_0x3e15('0xb'),attributes,{'tableName':_0x3e15('0xc'),'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 6ab30f5..e2c979c 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 _0x63be=['error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2c5757,_0x4ce6a5){var _0x318984=function(_0xb75413){while(--_0xb75413){_0x2c5757['push'](_0x2c5757['shift']());}};_0x318984(++_0x4ce6a5);}(_0x63be,0x180));var _0xe63b=function(_0x108fbf,_0x2a46d0){_0x108fbf=_0x108fbf-0x0;var _0x5c249f=_0x63be[_0x108fbf];return _0x5c249f;};'use strict';var _=require(_0xe63b('0x0'));var util=require(_0xe63b('0x1'));var moment=require(_0xe63b('0x2'));var BPromise=require('bluebird');var rs=require(_0xe63b('0x3'));var fs=require('fs');var Redis=require(_0xe63b('0x4'));var db=require(_0xe63b('0x5'))['db'];var utils=require(_0xe63b('0x6'));var logger=require('../../config/logger')(_0xe63b('0x7'));var config=require(_0xe63b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe63b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40c594,_0x11db13,_0x1c87de){return new BPromise(function(_0x67fc94,_0x5188e2){return client['request'](_0x40c594,_0x1c87de)[_0xe63b('0xa')](function(_0x436d68){logger[_0xe63b('0xb')](_0xe63b('0xc'),_0x11db13,_0xe63b('0xd'));logger['debug'](_0xe63b('0xe'),_0x11db13,_0xe63b('0xd'),JSON[_0xe63b('0xf')](_0x436d68));if(_0x436d68[_0xe63b('0x10')]){if(_0x436d68[_0xe63b('0x10')][_0xe63b('0x11')]===0x1f4){logger['error'](_0xe63b('0xc'),_0x11db13,_0x436d68[_0xe63b('0x10')]['message']);return _0x5188e2(_0x436d68['error'][_0xe63b('0x12')]);}logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x11db13,_0x436d68[_0xe63b('0x10')][_0xe63b('0x12')]);return _0x67fc94(_0x436d68['error'][_0xe63b('0x12')]);}else{logger[_0xe63b('0xb')](_0xe63b('0xc'),_0x11db13,'request\x20sent');_0x67fc94(_0x436d68[_0xe63b('0x13')][_0xe63b('0x12')]);}})['catch'](function(_0x226cf3){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x11db13,_0x226cf3);_0x5188e2(_0x226cf3);});});} \ No newline at end of file +var _0x3c75=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','bluebird'];(function(_0x22eb9b,_0xd92144){var _0x181148=function(_0x5b3c9){while(--_0x5b3c9){_0x22eb9b['push'](_0x22eb9b['shift']());}};_0x181148(++_0xd92144);}(_0x3c75,0x163));var _0x53c7=function(_0x17fa3a,_0x4e673d){_0x17fa3a=_0x17fa3a-0x0;var _0x47e93c=_0x3c75[_0x17fa3a];return _0x47e93c;};'use strict';var _=require(_0x53c7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x53c7('0x1'));var rs=require(_0x53c7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x53c7('0x3'))['db'];var utils=require(_0x53c7('0x4'));var logger=require(_0x53c7('0x5'))(_0x53c7('0x6'));var config=require(_0x53c7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x53c7('0x8')][_0x53c7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x435f4c,_0x222af4,_0x6832b7){return new BPromise(function(_0xf79158,_0x46aa63){return client[_0x53c7('0xa')](_0x435f4c,_0x6832b7)['then'](function(_0x484c3f){logger['info'](_0x53c7('0xb'),_0x222af4,_0x53c7('0xc'));logger[_0x53c7('0xd')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x222af4,_0x53c7('0xc'),JSON[_0x53c7('0xe')](_0x484c3f));if(_0x484c3f[_0x53c7('0xf')]){if(_0x484c3f[_0x53c7('0xf')][_0x53c7('0x10')]===0x1f4){logger[_0x53c7('0xf')](_0x53c7('0xb'),_0x222af4,_0x484c3f[_0x53c7('0xf')]['message']);return _0x46aa63(_0x484c3f['error'][_0x53c7('0x11')]);}logger[_0x53c7('0xf')]('VtigerConfiguration,\x20%s,\x20%s',_0x222af4,_0x484c3f[_0x53c7('0xf')][_0x53c7('0x11')]);return _0xf79158(_0x484c3f[_0x53c7('0xf')]['message']);}else{logger[_0x53c7('0x12')](_0x53c7('0xb'),_0x222af4,_0x53c7('0xc'));_0xf79158(_0x484c3f[_0x53c7('0x13')][_0x53c7('0x11')]);}})[_0x53c7('0x14')](function(_0x25dc4d){logger['error'](_0x53c7('0xb'),_0x222af4,_0x25dc4d);_0x46aa63(_0x25dc4d);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 577b480..2e5d034 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 _0xc9af=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get'];(function(_0x2ea7e8,_0x14f447){var _0x283810=function(_0x584224){while(--_0x584224){_0x2ea7e8['push'](_0x2ea7e8['shift']());}};_0x283810(++_0x14f447);}(_0xc9af,0x129));var _0xfc9a=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xc9af[_0x46698a];return _0x356db0;};'use strict';var multer=require(_0xfc9a('0x0'));var util=require(_0xfc9a('0x1'));var path=require(_0xfc9a('0x2'));var timeout=require(_0xfc9a('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfc9a('0x4'));var interaction=require(_0xfc9a('0x5'));var config=require(_0xfc9a('0x6'));var controller=require('./intVtigerField.controller');router['get']('/',auth[_0xfc9a('0x7')](),controller['index']);router[_0xfc9a('0x8')](_0xfc9a('0x9'),auth[_0xfc9a('0x7')](),controller[_0xfc9a('0xa')]);router[_0xfc9a('0xb')]('/',auth['isAuthenticated'](),controller[_0xfc9a('0xc')]);router[_0xfc9a('0xd')](_0xfc9a('0x9'),auth['isAuthenticated'](),controller[_0xfc9a('0xe')]);router[_0xfc9a('0xf')]('/:id',auth[_0xfc9a('0x7')](),controller[_0xfc9a('0x10')]);module[_0xfc9a('0x11')]=router; \ No newline at end of file +var _0xbad1=['get','/:id','isAuthenticated','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intVtigerField.controller','index'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbad1,0x1a6));var _0x1bad=function(_0x10ed54,_0x2f5328){_0x10ed54=_0x10ed54-0x0;var _0x5ca84e=_0xbad1[_0x10ed54];return _0x5ca84e;};'use strict';var multer=require(_0x1bad('0x0'));var util=require(_0x1bad('0x1'));var path=require(_0x1bad('0x2'));var timeout=require(_0x1bad('0x3'));var express=require(_0x1bad('0x4'));var router=express[_0x1bad('0x5')]();var fs_extra=require(_0x1bad('0x6'));var auth=require(_0x1bad('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1bad('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x1bad('0x9')]);router[_0x1bad('0xa')](_0x1bad('0xb'),auth[_0x1bad('0xc')](),controller['show']);router[_0x1bad('0xd')]('/',auth[_0x1bad('0xc')](),controller[_0x1bad('0xe')]);router['put'](_0x1bad('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x1bad('0xf')](_0x1bad('0xb'),auth[_0x1bad('0xc')](),controller[_0x1bad('0x10')]);module[_0x1bad('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 10b3c3f..8a09119 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 _0x4b6d=['BOOLEAN','exports','variable','customVariable','keyValue','string','STRING','ENUM'];(function(_0x25cc54,_0x201fe1){var _0x24f2e7=function(_0x21292e){while(--_0x21292e){_0x25cc54['push'](_0x25cc54['shift']());}};_0x24f2e7(++_0x201fe1);}(_0x4b6d,0x1b1));var _0xd4b6=function(_0x1a56bf,_0x2664cd){_0x1a56bf=_0x1a56bf-0x0;var _0x14ca08=_0x4b6d[_0x1a56bf];return _0x14ca08;};'use strict';var Sequelize=require('sequelize');module[_0xd4b6('0x0')]={'type':{'type':Sequelize['ENUM']('string',_0xd4b6('0x1'),_0xd4b6('0x2'),_0xd4b6('0x3'),'picklist'),'defaultValue':_0xd4b6('0x4')},'content':{'type':Sequelize[_0xd4b6('0x5')]},'key':{'type':Sequelize[_0xd4b6('0x5')]},'keyType':{'type':Sequelize[_0xd4b6('0x6')](_0xd4b6('0x4'),_0xd4b6('0x1'),_0xd4b6('0x2'))},'keyContent':{'type':Sequelize[_0xd4b6('0x5')]},'idField':{'type':Sequelize[_0xd4b6('0x5')]},'nameField':{'type':Sequelize[_0xd4b6('0x5')]},'customField':{'type':Sequelize[_0xd4b6('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd4b6('0x5')]}}; \ No newline at end of file +var _0x46c4=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x231b07,_0x4b6a81){var _0x3b928c=function(_0x14a2d3){while(--_0x14a2d3){_0x231b07['push'](_0x231b07['shift']());}};_0x3b928c(++_0x4b6a81);}(_0x46c4,0x1df));var _0x446c=function(_0x33ca98,_0x4ead59){_0x33ca98=_0x33ca98-0x0;var _0x2ea445=_0x46c4[_0x33ca98];return _0x2ea445;};'use strict';var Sequelize=require(_0x446c('0x0'));module[_0x446c('0x1')]={'type':{'type':Sequelize[_0x446c('0x2')](_0x446c('0x3'),_0x446c('0x4'),_0x446c('0x5'),_0x446c('0x6'),'picklist'),'defaultValue':_0x446c('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x446c('0x7')]},'keyType':{'type':Sequelize[_0x446c('0x2')](_0x446c('0x3'),'variable',_0x446c('0x5'))},'keyContent':{'type':Sequelize[_0x446c('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x446c('0x7')]},'customField':{'type':Sequelize[_0x446c('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x446c('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 4fd8ced..6558d53 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 _0x6efb=['destroy','error','stack','name','send','VtigerField','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','include','findAll','then','show','keys','includeAll','options','find','catch','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../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','count','set','Content-Range','apply','update'];(function(_0x5885e4,_0x23d7b7){var _0x154bab=function(_0x41ffcf){while(--_0x41ffcf){_0x5885e4['push'](_0x5885e4['shift']());}};_0x154bab(++_0x23d7b7);}(_0x6efb,0x15a));var _0xb6ef=function(_0x426fea,_0x2b7e59){_0x426fea=_0x426fea-0x0;var _0x30d21a=_0x6efb[_0x426fea];return _0x30d21a;};'use strict';var emlformat=require(_0xb6ef('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb6ef('0x1'));var jsonpatch=require(_0xb6ef('0x2'));var rp=require(_0xb6ef('0x3'));var moment=require(_0xb6ef('0x4'));var BPromise=require(_0xb6ef('0x5'));var Mustache=require(_0xb6ef('0x6'));var util=require(_0xb6ef('0x7'));var path=require(_0xb6ef('0x8'));var sox=require(_0xb6ef('0x9'));var csv=require(_0xb6ef('0xa'));var ejs=require(_0xb6ef('0xb'));var fs=require('fs');var fs_extra=require(_0xb6ef('0xc'));var _=require(_0xb6ef('0xd'));var squel=require(_0xb6ef('0xe'));var crypto=require('crypto');var jsforce=require(_0xb6ef('0xf'));var deskjs=require(_0xb6ef('0x10'));var toCsv=require(_0xb6ef('0xa'));var querystring=require(_0xb6ef('0x11'));var Papa=require(_0xb6ef('0x12'));var Redis=require('ioredis');var authService=require(_0xb6ef('0x13'));var qs=require(_0xb6ef('0x14'));var as=require(_0xb6ef('0x15'));var hardwareService=require(_0xb6ef('0x16'));var logger=require(_0xb6ef('0x17'))(_0xb6ef('0x18'));var utils=require('../../config/utils');var config=require(_0xb6ef('0x19'));var licenseUtil=require(_0xb6ef('0x1a'));var db=require(_0xb6ef('0x1b'))['db'];function respondWithStatusCode(_0x1c378f,_0x9ab0bc){_0x9ab0bc=_0x9ab0bc||0xcc;return function(_0x100695){if(_0x100695){return _0x1c378f[_0xb6ef('0x1c')](_0x9ab0bc);}return _0x1c378f[_0xb6ef('0x1d')](_0x9ab0bc)[_0xb6ef('0x1e')]();};}function respondWithResult(_0x59f24d,_0x42e64c){_0x42e64c=_0x42e64c||0xc8;return function(_0x596163){if(_0x596163){return _0x59f24d[_0xb6ef('0x1d')](_0x42e64c)[_0xb6ef('0x1f')](_0x596163);}};}function respondWithFilteredResult(_0x2e5d46,_0x59c667){return function(_0x34190c){if(_0x34190c){var _0x1eea5c=typeof _0x59c667[_0xb6ef('0x20')]===_0xb6ef('0x21')&&typeof _0x59c667['limit']===_0xb6ef('0x21');var _0x25b58d=_0x34190c[_0xb6ef('0x22')];var _0x2b37d8=_0x1eea5c?0x0:_0x59c667[_0xb6ef('0x20')];var _0x39c85d=_0x1eea5c?_0x34190c[_0xb6ef('0x22')]:_0x59c667[_0xb6ef('0x20')]+_0x59c667['limit'];var _0x24605b;if(_0x39c85d>=_0x25b58d){_0x39c85d=_0x25b58d;_0x24605b=0xc8;}else{_0x24605b=0xce;}_0x2e5d46[_0xb6ef('0x1d')](_0x24605b);return _0x2e5d46[_0xb6ef('0x23')](_0xb6ef('0x24'),_0x2b37d8+'-'+_0x39c85d+'/'+_0x25b58d)[_0xb6ef('0x1f')](_0x34190c);}return null;};}function patchUpdates(_0x5741d0){return function(_0x17fcbd){try{jsonpatch[_0xb6ef('0x25')](_0x17fcbd,_0x5741d0,!![]);}catch(_0x170cc9){return BPromise['reject'](_0x170cc9);}return _0x17fcbd['save']();};}function saveUpdates(_0x2be4f1,_0x4203cc){return function(_0x4d0396){if(_0x4d0396){return _0x4d0396[_0xb6ef('0x26')](_0x2be4f1)['then'](function(_0x18dddb){return _0x18dddb;});}return null;};}function removeEntity(_0x39b564,_0xf01c1a){return function(_0x35332e){if(_0x35332e){return _0x35332e[_0xb6ef('0x27')]()['then'](function(){_0x39b564['status'](0xcc)[_0xb6ef('0x1e')]();});}};}function handleEntityNotFound(_0x35a98,_0x30271a){return function(_0x5e5261){if(!_0x5e5261){_0x35a98[_0xb6ef('0x1c')](0x194);}return _0x5e5261;};}function handleError(_0x3c5c44,_0x39d9d7){_0x39d9d7=_0x39d9d7||0x1f4;return function(_0xaf8fe3){logger[_0xb6ef('0x28')](_0xaf8fe3[_0xb6ef('0x29')]);if(_0xaf8fe3[_0xb6ef('0x2a')]){delete _0xaf8fe3[_0xb6ef('0x2a')];}_0x3c5c44[_0xb6ef('0x1d')](_0x39d9d7)[_0xb6ef('0x2b')](_0xaf8fe3);};}exports['index']=function(_0x4fa632,_0x175b10){var _0x1c1bd5={},_0x3b4be9={},_0x155348={'count':0x0,'rows':[]};var _0x4e2c3f=_['map'](db[_0xb6ef('0x2c')][_0xb6ef('0x2d')],function(_0x52ec3a){return{'name':_0x52ec3a[_0xb6ef('0x2e')],'type':_0x52ec3a[_0xb6ef('0x2f')][_0xb6ef('0x30')]};});_0x3b4be9[_0xb6ef('0x31')]=_[_0xb6ef('0x32')](_0x4e2c3f,_0xb6ef('0x2a'));_0x3b4be9[_0xb6ef('0x33')]=_['keys'](_0x4fa632[_0xb6ef('0x33')]);_0x3b4be9['filters']=_[_0xb6ef('0x34')](_0x3b4be9[_0xb6ef('0x31')],_0x3b4be9[_0xb6ef('0x33')]);_0x1c1bd5[_0xb6ef('0x35')]=_[_0xb6ef('0x34')](_0x3b4be9[_0xb6ef('0x31')],qs[_0xb6ef('0x36')](_0x4fa632['query']['fields']));_0x1c1bd5[_0xb6ef('0x35')]=_0x1c1bd5[_0xb6ef('0x35')][_0xb6ef('0x37')]?_0x1c1bd5['attributes']:_0x3b4be9['model'];if(!_0x4fa632[_0xb6ef('0x33')][_0xb6ef('0x38')](_0xb6ef('0x39'))){_0x1c1bd5[_0xb6ef('0x3a')]=qs[_0xb6ef('0x3a')](_0x4fa632[_0xb6ef('0x33')]['limit']);_0x1c1bd5[_0xb6ef('0x20')]=qs[_0xb6ef('0x20')](_0x4fa632[_0xb6ef('0x33')][_0xb6ef('0x20')]);}_0x1c1bd5['order']=qs[_0xb6ef('0x3b')](_0x4fa632['query'][_0xb6ef('0x3b')]);_0x1c1bd5[_0xb6ef('0x3c')]=qs['filters'](_[_0xb6ef('0x3d')](_0x4fa632['query'],_0x3b4be9['filters']),_0x4e2c3f);if(_0x4fa632[_0xb6ef('0x33')][_0xb6ef('0x3e')]){_0x1c1bd5[_0xb6ef('0x3c')]=_[_0xb6ef('0x3f')](_0x1c1bd5[_0xb6ef('0x3c')],{'$or':_[_0xb6ef('0x32')](_0x4e2c3f,function(_0x162d22){if(_0x162d22['type']!==_0xb6ef('0x40')){var _0x1319b9={};_0x1319b9[_0x162d22[_0xb6ef('0x2a')]]={'$like':'%'+_0x4fa632[_0xb6ef('0x33')][_0xb6ef('0x3e')]+'%'};return _0x1319b9;}})});}_0x1c1bd5=_[_0xb6ef('0x3f')]({},_0x1c1bd5,_0x4fa632['options']);var _0x50b61f={'where':_0x1c1bd5[_0xb6ef('0x3c')]};return db[_0xb6ef('0x2c')][_0xb6ef('0x22')](_0x50b61f)['then'](function(_0xbb485f){_0x155348[_0xb6ef('0x22')]=_0xbb485f;if(_0x4fa632[_0xb6ef('0x33')]['includeAll']){_0x1c1bd5[_0xb6ef('0x41')]=[{'all':!![]}];}return db[_0xb6ef('0x2c')][_0xb6ef('0x42')](_0x1c1bd5);})['then'](function(_0x20c60e){_0x155348['rows']=_0x20c60e;return _0x155348;})[_0xb6ef('0x43')](respondWithFilteredResult(_0x175b10,_0x1c1bd5))['catch'](handleError(_0x175b10,null));};exports[_0xb6ef('0x44')]=function(_0xcd8f57,_0x393f7b){var _0x4302aa={'raw':!![],'where':{'id':_0xcd8f57['params']['id']}},_0x30e0d8={};_0x30e0d8[_0xb6ef('0x31')]=_[_0xb6ef('0x45')](db[_0xb6ef('0x2c')][_0xb6ef('0x2d')]);_0x30e0d8[_0xb6ef('0x33')]=_[_0xb6ef('0x45')](_0xcd8f57['query']);_0x30e0d8['filters']=_[_0xb6ef('0x34')](_0x30e0d8[_0xb6ef('0x31')],_0x30e0d8[_0xb6ef('0x33')]);_0x4302aa['attributes']=_[_0xb6ef('0x34')](_0x30e0d8[_0xb6ef('0x31')],qs[_0xb6ef('0x36')](_0xcd8f57[_0xb6ef('0x33')][_0xb6ef('0x36')]));_0x4302aa[_0xb6ef('0x35')]=_0x4302aa[_0xb6ef('0x35')]['length']?_0x4302aa['attributes']:_0x30e0d8[_0xb6ef('0x31')];if(_0xcd8f57[_0xb6ef('0x33')][_0xb6ef('0x46')]){_0x4302aa[_0xb6ef('0x41')]=[{'all':!![]}];}_0x4302aa=_[_0xb6ef('0x3f')]({},_0x4302aa,_0xcd8f57[_0xb6ef('0x47')]);return db[_0xb6ef('0x2c')][_0xb6ef('0x48')](_0x4302aa)[_0xb6ef('0x43')](handleEntityNotFound(_0x393f7b,null))[_0xb6ef('0x43')](respondWithResult(_0x393f7b,null))[_0xb6ef('0x49')](handleError(_0x393f7b,null));};exports['create']=function(_0x2ca1e6,_0x3b0350){return db[_0xb6ef('0x2c')][_0xb6ef('0x4a')](_0x2ca1e6[_0xb6ef('0x4b')],{})[_0xb6ef('0x43')](respondWithResult(_0x3b0350,0xc9))[_0xb6ef('0x49')](handleError(_0x3b0350,null));};exports[_0xb6ef('0x26')]=function(_0x4fc2d1,_0xeead34){if(_0x4fc2d1['body']['id']){delete _0x4fc2d1[_0xb6ef('0x4b')]['id'];}return db[_0xb6ef('0x2c')]['find']({'where':{'id':_0x4fc2d1[_0xb6ef('0x4c')]['id']}})[_0xb6ef('0x43')](handleEntityNotFound(_0xeead34,null))[_0xb6ef('0x43')](saveUpdates(_0x4fc2d1[_0xb6ef('0x4b')],null))[_0xb6ef('0x43')](respondWithResult(_0xeead34,null))[_0xb6ef('0x49')](handleError(_0xeead34,null));};exports['destroy']=function(_0x3888b6,_0x1883f6){return db[_0xb6ef('0x2c')][_0xb6ef('0x48')]({'where':{'id':_0x3888b6[_0xb6ef('0x4c')]['id']}})[_0xb6ef('0x43')](handleEntityNotFound(_0x1883f6,null))['then'](removeEntity(_0x1883f6,null))['catch'](handleError(_0x1883f6,null));}; \ No newline at end of file +var _0x6aaa=['fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','apply','save','update','destroy','then','error','name','send','index','map','VtigerField','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs'];(function(_0x3ceee3,_0x564f46){var _0x66232a=function(_0x29e05e){while(--_0x29e05e){_0x3ceee3['push'](_0x3ceee3['shift']());}};_0x66232a(++_0x564f46);}(_0x6aaa,0x80));var _0xa6aa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6aaa[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa6aa('0x0'));var zipdir=require(_0xa6aa('0x1'));var jsonpatch=require(_0xa6aa('0x2'));var rp=require('request-promise');var moment=require(_0xa6aa('0x3'));var BPromise=require(_0xa6aa('0x4'));var Mustache=require(_0xa6aa('0x5'));var util=require(_0xa6aa('0x6'));var path=require(_0xa6aa('0x7'));var sox=require('sox');var csv=require(_0xa6aa('0x8'));var ejs=require(_0xa6aa('0x9'));var fs=require('fs');var fs_extra=require(_0xa6aa('0xa'));var _=require(_0xa6aa('0xb'));var squel=require(_0xa6aa('0xc'));var crypto=require(_0xa6aa('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa6aa('0xe'));var toCsv=require(_0xa6aa('0x8'));var querystring=require(_0xa6aa('0xf'));var Papa=require(_0xa6aa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa6aa('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa6aa('0x12'))('api');var utils=require(_0xa6aa('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17d35f,_0x50c451){_0x50c451=_0x50c451||0xcc;return function(_0x4f57ec){if(_0x4f57ec){return _0x17d35f[_0xa6aa('0x14')](_0x50c451);}return _0x17d35f[_0xa6aa('0x15')](_0x50c451)[_0xa6aa('0x16')]();};}function respondWithResult(_0x58d310,_0xbadba2){_0xbadba2=_0xbadba2||0xc8;return function(_0x2f93a6){if(_0x2f93a6){return _0x58d310['status'](_0xbadba2)['json'](_0x2f93a6);}};}function respondWithFilteredResult(_0x53f30b,_0x21265f){return function(_0x43c4f3){if(_0x43c4f3){var _0x19dad8=typeof _0x21265f['offset']===_0xa6aa('0x17')&&typeof _0x21265f[_0xa6aa('0x18')]===_0xa6aa('0x17');var _0x2a632b=_0x43c4f3[_0xa6aa('0x19')];var _0x1b214b=_0x19dad8?0x0:_0x21265f[_0xa6aa('0x1a')];var _0x52bdaf=_0x19dad8?_0x43c4f3['count']:_0x21265f[_0xa6aa('0x1a')]+_0x21265f[_0xa6aa('0x18')];var _0x2ab29d;if(_0x52bdaf>=_0x2a632b){_0x52bdaf=_0x2a632b;_0x2ab29d=0xc8;}else{_0x2ab29d=0xce;}_0x53f30b[_0xa6aa('0x15')](_0x2ab29d);return _0x53f30b[_0xa6aa('0x1b')](_0xa6aa('0x1c'),_0x1b214b+'-'+_0x52bdaf+'/'+_0x2a632b)['json'](_0x43c4f3);}return null;};}function patchUpdates(_0x486667){return function(_0x1cf6c8){try{jsonpatch[_0xa6aa('0x1d')](_0x1cf6c8,_0x486667,!![]);}catch(_0x3c459f){return BPromise['reject'](_0x3c459f);}return _0x1cf6c8[_0xa6aa('0x1e')]();};}function saveUpdates(_0x19fc8c,_0x2c9f38){return function(_0x136a72){if(_0x136a72){return _0x136a72[_0xa6aa('0x1f')](_0x19fc8c)['then'](function(_0x1f769b){return _0x1f769b;});}return null;};}function removeEntity(_0x334893,_0x40a407){return function(_0xae4e57){if(_0xae4e57){return _0xae4e57[_0xa6aa('0x20')]()[_0xa6aa('0x21')](function(){_0x334893[_0xa6aa('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1614fd,_0x5131d2){return function(_0x33286c){if(!_0x33286c){_0x1614fd[_0xa6aa('0x14')](0x194);}return _0x33286c;};}function handleError(_0x58cdb0,_0xb9b031){_0xb9b031=_0xb9b031||0x1f4;return function(_0x4845bc){logger[_0xa6aa('0x22')](_0x4845bc['stack']);if(_0x4845bc[_0xa6aa('0x23')]){delete _0x4845bc['name'];}_0x58cdb0[_0xa6aa('0x15')](_0xb9b031)[_0xa6aa('0x24')](_0x4845bc);};}exports[_0xa6aa('0x25')]=function(_0x6b2917,_0x5e3d47){var _0x50cf61={},_0x38b43b={},_0x7cdaf2={'count':0x0,'rows':[]};var _0x1291ab=_[_0xa6aa('0x26')](db[_0xa6aa('0x27')][_0xa6aa('0x28')],function(_0x1942b1){return{'name':_0x1942b1[_0xa6aa('0x29')],'type':_0x1942b1['type']['key']};});_0x38b43b[_0xa6aa('0x2a')]=_[_0xa6aa('0x26')](_0x1291ab,_0xa6aa('0x23'));_0x38b43b[_0xa6aa('0x2b')]=_[_0xa6aa('0x2c')](_0x6b2917[_0xa6aa('0x2b')]);_0x38b43b[_0xa6aa('0x2d')]=_[_0xa6aa('0x2e')](_0x38b43b['model'],_0x38b43b[_0xa6aa('0x2b')]);_0x50cf61[_0xa6aa('0x2f')]=_[_0xa6aa('0x2e')](_0x38b43b[_0xa6aa('0x2a')],qs[_0xa6aa('0x30')](_0x6b2917[_0xa6aa('0x2b')]['fields']));_0x50cf61['attributes']=_0x50cf61[_0xa6aa('0x2f')][_0xa6aa('0x31')]?_0x50cf61[_0xa6aa('0x2f')]:_0x38b43b[_0xa6aa('0x2a')];if(!_0x6b2917[_0xa6aa('0x2b')][_0xa6aa('0x32')](_0xa6aa('0x33'))){_0x50cf61[_0xa6aa('0x18')]=qs[_0xa6aa('0x18')](_0x6b2917[_0xa6aa('0x2b')][_0xa6aa('0x18')]);_0x50cf61[_0xa6aa('0x1a')]=qs[_0xa6aa('0x1a')](_0x6b2917[_0xa6aa('0x2b')][_0xa6aa('0x1a')]);}_0x50cf61['order']=qs[_0xa6aa('0x34')](_0x6b2917[_0xa6aa('0x2b')][_0xa6aa('0x34')]);_0x50cf61[_0xa6aa('0x35')]=qs[_0xa6aa('0x2d')](_[_0xa6aa('0x36')](_0x6b2917[_0xa6aa('0x2b')],_0x38b43b['filters']),_0x1291ab);if(_0x6b2917[_0xa6aa('0x2b')][_0xa6aa('0x37')]){_0x50cf61[_0xa6aa('0x35')]=_['merge'](_0x50cf61['where'],{'$or':_[_0xa6aa('0x26')](_0x1291ab,function(_0x11eaca){if(_0x11eaca[_0xa6aa('0x38')]!=='VIRTUAL'){var _0x57c07e={};_0x57c07e[_0x11eaca[_0xa6aa('0x23')]]={'$like':'%'+_0x6b2917['query'][_0xa6aa('0x37')]+'%'};return _0x57c07e;}})});}_0x50cf61=_[_0xa6aa('0x39')]({},_0x50cf61,_0x6b2917[_0xa6aa('0x3a')]);var _0x1115df={'where':_0x50cf61['where']};return db[_0xa6aa('0x27')]['count'](_0x1115df)['then'](function(_0x354a5f){_0x7cdaf2[_0xa6aa('0x19')]=_0x354a5f;if(_0x6b2917[_0xa6aa('0x2b')][_0xa6aa('0x3b')]){_0x50cf61[_0xa6aa('0x3c')]=[{'all':!![]}];}return db[_0xa6aa('0x27')][_0xa6aa('0x3d')](_0x50cf61);})['then'](function(_0x304c61){_0x7cdaf2[_0xa6aa('0x3e')]=_0x304c61;return _0x7cdaf2;})[_0xa6aa('0x21')](respondWithFilteredResult(_0x5e3d47,_0x50cf61))[_0xa6aa('0x3f')](handleError(_0x5e3d47,null));};exports[_0xa6aa('0x40')]=function(_0x95b7e5,_0x2d6b5f){var _0x16a896={'raw':!![],'where':{'id':_0x95b7e5[_0xa6aa('0x41')]['id']}},_0x265ad2={};_0x265ad2[_0xa6aa('0x2a')]=_['keys'](db[_0xa6aa('0x27')][_0xa6aa('0x28')]);_0x265ad2[_0xa6aa('0x2b')]=_[_0xa6aa('0x2c')](_0x95b7e5[_0xa6aa('0x2b')]);_0x265ad2[_0xa6aa('0x2d')]=_[_0xa6aa('0x2e')](_0x265ad2['model'],_0x265ad2[_0xa6aa('0x2b')]);_0x16a896[_0xa6aa('0x2f')]=_[_0xa6aa('0x2e')](_0x265ad2['model'],qs[_0xa6aa('0x30')](_0x95b7e5[_0xa6aa('0x2b')][_0xa6aa('0x30')]));_0x16a896[_0xa6aa('0x2f')]=_0x16a896[_0xa6aa('0x2f')][_0xa6aa('0x31')]?_0x16a896['attributes']:_0x265ad2[_0xa6aa('0x2a')];if(_0x95b7e5[_0xa6aa('0x2b')][_0xa6aa('0x3b')]){_0x16a896[_0xa6aa('0x3c')]=[{'all':!![]}];}_0x16a896=_[_0xa6aa('0x39')]({},_0x16a896,_0x95b7e5[_0xa6aa('0x3a')]);return db[_0xa6aa('0x27')][_0xa6aa('0x42')](_0x16a896)[_0xa6aa('0x21')](handleEntityNotFound(_0x2d6b5f,null))['then'](respondWithResult(_0x2d6b5f,null))[_0xa6aa('0x3f')](handleError(_0x2d6b5f,null));};exports[_0xa6aa('0x43')]=function(_0x28704c,_0x476e96){return db[_0xa6aa('0x27')][_0xa6aa('0x43')](_0x28704c['body'],{})[_0xa6aa('0x21')](respondWithResult(_0x476e96,0xc9))['catch'](handleError(_0x476e96,null));};exports[_0xa6aa('0x1f')]=function(_0x103e3a,_0x402a3e){if(_0x103e3a[_0xa6aa('0x44')]['id']){delete _0x103e3a[_0xa6aa('0x44')]['id'];}return db[_0xa6aa('0x27')][_0xa6aa('0x42')]({'where':{'id':_0x103e3a['params']['id']}})[_0xa6aa('0x21')](handleEntityNotFound(_0x402a3e,null))[_0xa6aa('0x21')](saveUpdates(_0x103e3a[_0xa6aa('0x44')],null))[_0xa6aa('0x21')](respondWithResult(_0x402a3e,null))[_0xa6aa('0x3f')](handleError(_0x402a3e,null));};exports['destroy']=function(_0x2fc85a,_0xfe6859){return db[_0xa6aa('0x27')][_0xa6aa('0x42')]({'where':{'id':_0x2fc85a[_0xa6aa('0x41')]['id']}})[_0xa6aa('0x21')](handleEntityNotFound(_0xfe6859,null))[_0xa6aa('0x21')](removeEntity(_0xfe6859,null))[_0xa6aa('0x3f')](handleError(_0xfe6859,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 26c8d23..ea3a789 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 _0x2056=['bluebird','request-promise','path','rimraf','./intVtigerField.attributes','exports','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','lodash','util','../../config/logger','api','moment'];(function(_0x259183,_0x2a5a01){var _0x31deed=function(_0x85a192){while(--_0x85a192){_0x259183['push'](_0x259183['shift']());}};_0x31deed(++_0x2a5a01);}(_0x2056,0x64));var _0x6205=function(_0x1817b0,_0x3aaaa1){_0x1817b0=_0x1817b0-0x0;var _0x5c10e6=_0x2056[_0x1817b0];return _0x5c10e6;};'use strict';var _=require(_0x6205('0x0'));var util=require(_0x6205('0x1'));var logger=require(_0x6205('0x2'))(_0x6205('0x3'));var moment=require(_0x6205('0x4'));var BPromise=require(_0x6205('0x5'));var rp=require(_0x6205('0x6'));var fs=require('fs');var path=require(_0x6205('0x7'));var rimraf=require(_0x6205('0x8'));var config=require('../../config/environment');var attributes=require(_0x6205('0x9'));module[_0x6205('0xa')]=function(_0x3aad37,_0xe983fb){return _0x3aad37['define'](_0x6205('0xb'),attributes,{'tableName':_0x6205('0xc'),'paranoid':![],'indexes':[{'name':_0x6205('0xd'),'fields':[_0x6205('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1ec5=['rimraf','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x157524,_0x127ccd){var _0x4b61e1=function(_0x209b36){while(--_0x209b36){_0x157524['push'](_0x157524['shift']());}};_0x4b61e1(++_0x127ccd);}(_0x1ec5,0x81));var _0x51ec=function(_0x1feb4f,_0x76567a){_0x1feb4f=_0x1feb4f-0x0;var _0x223014=_0x1ec5[_0x1feb4f];return _0x223014;};'use strict';var _=require(_0x51ec('0x0'));var util=require('util');var logger=require(_0x51ec('0x1'))(_0x51ec('0x2'));var moment=require(_0x51ec('0x3'));var BPromise=require(_0x51ec('0x4'));var rp=require(_0x51ec('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x51ec('0x6'));var config=require(_0x51ec('0x7'));var attributes=require(_0x51ec('0x8'));module[_0x51ec('0x9')]=function(_0x5bd8b9,_0x176e18){return _0x5bd8b9[_0x51ec('0xa')](_0x51ec('0xb'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x51ec('0xc'),'fields':[_0x51ec('0xd'),_0x51ec('0xe')],'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 053f21f..09fae15 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 _0xea19=['util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerField,\x20%s,\x20%s','message','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xea19,0x14f));var _0x9ea1=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0xea19[_0x164eca];return _0x2ce562;};'use strict';var _=require(_0x9ea1('0x0'));var util=require(_0x9ea1('0x1'));var moment=require('moment');var BPromise=require(_0x9ea1('0x2'));var rs=require(_0x9ea1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9ea1('0x4'))['db'];var utils=require(_0x9ea1('0x5'));var logger=require('../../config/logger')(_0x9ea1('0x6'));var config=require(_0x9ea1('0x7'));var jayson=require(_0x9ea1('0x8'));var client=jayson[_0x9ea1('0x9')][_0x9ea1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa438dd,_0x23e336,_0x4b31ed){return new BPromise(function(_0x3a573d,_0x18364d){return client[_0x9ea1('0xb')](_0xa438dd,_0x4b31ed)[_0x9ea1('0xc')](function(_0x1f1266){logger[_0x9ea1('0xd')]('VtigerField,\x20%s,\x20%s',_0x23e336,_0x9ea1('0xe'));logger['debug'](_0x9ea1('0xf'),_0x23e336,'request\x20sent',JSON[_0x9ea1('0x10')](_0x1f1266));if(_0x1f1266['error']){if(_0x1f1266[_0x9ea1('0x11')][_0x9ea1('0x12')]===0x1f4){logger[_0x9ea1('0x11')](_0x9ea1('0x13'),_0x23e336,_0x1f1266[_0x9ea1('0x11')][_0x9ea1('0x14')]);return _0x18364d(_0x1f1266[_0x9ea1('0x11')][_0x9ea1('0x14')]);}logger['error'](_0x9ea1('0x13'),_0x23e336,_0x1f1266['error'][_0x9ea1('0x14')]);return _0x3a573d(_0x1f1266[_0x9ea1('0x11')][_0x9ea1('0x14')]);}else{logger[_0x9ea1('0xd')](_0x9ea1('0x13'),_0x23e336,'request\x20sent');_0x3a573d(_0x1f1266['result'][_0x9ea1('0x14')]);}})['catch'](function(_0x5eb7f4){logger[_0x9ea1('0x11')](_0x9ea1('0x13'),_0x23e336,_0x5eb7f4);_0x18364d(_0x5eb7f4);});});} \ No newline at end of file +var _0x83db=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerField,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird'];(function(_0xdc3ab2,_0x2cba00){var _0x34c67c=function(_0xf347b9){while(--_0xf347b9){_0xdc3ab2['push'](_0xdc3ab2['shift']());}};_0x34c67c(++_0x2cba00);}(_0x83db,0x13f));var _0xb83d=function(_0x66aeeb,_0x2fc18f){_0x66aeeb=_0x66aeeb-0x0;var _0x340272=_0x83db[_0x66aeeb];return _0x340272;};'use strict';var _=require(_0xb83d('0x0'));var util=require(_0xb83d('0x1'));var moment=require('moment');var BPromise=require(_0xb83d('0x2'));var rs=require(_0xb83d('0x3'));var fs=require('fs');var Redis=require(_0xb83d('0x4'));var db=require(_0xb83d('0x5'))['db'];var utils=require(_0xb83d('0x6'));var logger=require(_0xb83d('0x7'))(_0xb83d('0x8'));var config=require(_0xb83d('0x9'));var jayson=require(_0xb83d('0xa'));var client=jayson[_0xb83d('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe27ea5,_0x14afe9,_0x29e97c){return new BPromise(function(_0x2ce862,_0x529b30){return client['request'](_0xe27ea5,_0x29e97c)['then'](function(_0xff9848){logger[_0xb83d('0xc')]('VtigerField,\x20%s,\x20%s',_0x14afe9,_0xb83d('0xd'));logger[_0xb83d('0xe')](_0xb83d('0xf'),_0x14afe9,_0xb83d('0xd'),JSON[_0xb83d('0x10')](_0xff9848));if(_0xff9848[_0xb83d('0x11')]){if(_0xff9848[_0xb83d('0x11')][_0xb83d('0x12')]===0x1f4){logger[_0xb83d('0x11')](_0xb83d('0x13'),_0x14afe9,_0xff9848[_0xb83d('0x11')][_0xb83d('0x14')]);return _0x529b30(_0xff9848[_0xb83d('0x11')][_0xb83d('0x14')]);}logger[_0xb83d('0x11')](_0xb83d('0x13'),_0x14afe9,_0xff9848[_0xb83d('0x11')]['message']);return _0x2ce862(_0xff9848[_0xb83d('0x11')][_0xb83d('0x14')]);}else{logger['info'](_0xb83d('0x13'),_0x14afe9,'request\x20sent');_0x2ce862(_0xff9848[_0xb83d('0x15')][_0xb83d('0x14')]);}})[_0xb83d('0x16')](function(_0x5ab846){logger[_0xb83d('0x11')](_0xb83d('0x13'),_0x14afe9,_0x5ab846);_0x529b30(_0x5ab846);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index f2d4a2c..d3c770e 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 _0x95e3=['./intZendeskAccount.controller','isAuthenticated','get','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x475232,_0x55ca03){var _0x8eb306=function(_0x35e9d5){while(--_0x35e9d5){_0x475232['push'](_0x475232['shift']());}};_0x8eb306(++_0x55ca03);}(_0x95e3,0x15f));var _0x395e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x95e3[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x395e('0x0'));var util=require(_0x395e('0x1'));var path=require('path');var timeout=require(_0x395e('0x2'));var express=require(_0x395e('0x3'));var router=express[_0x395e('0x4')]();var fs_extra=require(_0x395e('0x5'));var auth=require(_0x395e('0x6'));var interaction=require(_0x395e('0x7'));var config=require(_0x395e('0x8'));var controller=require(_0x395e('0x9'));router['get']('/',auth[_0x395e('0xa')](),controller['index']);router[_0x395e('0xb')](_0x395e('0xc'),auth[_0x395e('0xa')](),controller[_0x395e('0xd')]);router[_0x395e('0xb')]('/:id/configurations',auth[_0x395e('0xa')](),controller[_0x395e('0xe')]);router[_0x395e('0xb')](_0x395e('0xf'),auth['isAuthenticated'](),controller[_0x395e('0x10')]);router[_0x395e('0x11')]('/',auth['isAuthenticated'](),controller[_0x395e('0x12')]);router[_0x395e('0x11')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x395e('0x13')]);router['put'](_0x395e('0xc'),auth[_0x395e('0xa')](),controller[_0x395e('0x14')]);router[_0x395e('0x15')](_0x395e('0xc'),auth[_0x395e('0xa')](),controller[_0x395e('0x16')]);module[_0x395e('0x17')]=router; \ No newline at end of file +var _0xacfb=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','/:id','show','getConfigurations','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','util','connect-timeout','express','Router','fs-extra'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xacfb,0x95));var _0xbacf=function(_0x14c251,_0xd4984c){_0x14c251=_0x14c251-0x0;var _0x4e82f8=_0xacfb[_0x14c251];return _0x4e82f8;};'use strict';var multer=require('multer');var util=require(_0xbacf('0x0'));var path=require('path');var timeout=require(_0xbacf('0x1'));var express=require(_0xbacf('0x2'));var router=express[_0xbacf('0x3')]();var fs_extra=require(_0xbacf('0x4'));var auth=require(_0xbacf('0x5'));var interaction=require(_0xbacf('0x6'));var config=require(_0xbacf('0x7'));var controller=require(_0xbacf('0x8'));router[_0xbacf('0x9')]('/',auth[_0xbacf('0xa')](),controller['index']);router[_0xbacf('0x9')](_0xbacf('0xb'),auth['isAuthenticated'](),controller[_0xbacf('0xc')]);router[_0xbacf('0x9')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xbacf('0xd')]);router['get']('/:id/fields',auth[_0xbacf('0xa')](),controller[_0xbacf('0xe')]);router[_0xbacf('0xf')]('/',auth[_0xbacf('0xa')](),controller[_0xbacf('0x10')]);router['post'](_0xbacf('0x11'),auth['isAuthenticated'](),controller[_0xbacf('0x12')]);router[_0xbacf('0x13')](_0xbacf('0xb'),auth[_0xbacf('0xa')](),controller[_0xbacf('0x14')]);router[_0xbacf('0x15')](_0xbacf('0xb'),auth[_0xbacf('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 9bc05e5..34f68e6 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 _0xa6ce=['STRING','username','remoteUri','ENUM','password','token','integrationTab','newTab','sequelize'];(function(_0x1d2f30,_0x4d6f31){var _0x2f0202=function(_0x529271){while(--_0x529271){_0x1d2f30['push'](_0x1d2f30['shift']());}};_0x2f0202(++_0x4d6f31);}(_0xa6ce,0x15e));var _0xea6c=function(_0x2e0443,_0x7e5974){_0x2e0443=_0x2e0443-0x0;var _0x52d450=_0xa6ce[_0x2e0443];return _0x52d450;};'use strict';var Sequelize=require(_0xea6c('0x0'));module['exports']={'name':{'type':Sequelize[_0xea6c('0x1')]},'description':{'type':Sequelize[_0xea6c('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0xea6c('0x2')},'password':{'type':Sequelize[_0xea6c('0x1')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xea6c('0x3')},'authType':{'type':Sequelize[_0xea6c('0x4')](_0xea6c('0x5'),_0xea6c('0x6')),'defaultValue':_0xea6c('0x5')},'serverUrl':{'type':Sequelize[_0xea6c('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xea6c('0x7'),_0xea6c('0x8')),'defaultValue':_0xea6c('0x7')}}; \ No newline at end of file +var _0x1d11=['STRING','username','remoteUri','ENUM','token','integrationTab','sequelize','exports'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x1d11,0xb6));var _0x11d1=function(_0x255686,_0x3160f1){_0x255686=_0x255686-0x0;var _0x4c4470=_0x1d11[_0x255686];return _0x4c4470;};'use strict';var Sequelize=require(_0x11d1('0x0'));module[_0x11d1('0x1')]={'name':{'type':Sequelize[_0x11d1('0x2')]},'description':{'type':Sequelize[_0x11d1('0x2')]},'username':{'type':Sequelize[_0x11d1('0x2')],'unique':_0x11d1('0x3')},'password':{'type':Sequelize[_0x11d1('0x2')]},'token':{'type':Sequelize[_0x11d1('0x2')]},'remoteUri':{'type':Sequelize[_0x11d1('0x2')],'unique':_0x11d1('0x4')},'authType':{'type':Sequelize[_0x11d1('0x5')]('password',_0x11d1('0x6')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x11d1('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x11d1('0x5')]('integrationTab','newTab'),'defaultValue':_0x11d1('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 532b71e..02315f3 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 _0xd64b=['undefined','count','Content-Range','apply','update','then','stack','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','name','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','rows','catch','show','params','keys','includeAll','include','merge','options','find','create','body','destroy','getConfigurations','findOne','ZendeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','ZendeskField','Descriptions','getFields','username','password','token','remoteUri','substring','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','toString','base64','Sequelize','ValidationError','subject','description','assignee','remove','position','title','system_field_options','custom_field_options','test','statusCode','error','stringify','Wrong\x20credentials','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit'];(function(_0x1a07ef,_0x57325f){var _0x5b4edb=function(_0x1eee30){while(--_0x1eee30){_0x1a07ef['push'](_0x1a07ef['shift']());}};_0x5b4edb(++_0x57325f);}(_0xd64b,0xc1));var _0xbd64=function(_0x4c3ffe,_0x457374){_0x4c3ffe=_0x4c3ffe-0x0;var _0x28d3eb=_0xd64b[_0x4c3ffe];return _0x28d3eb;};'use strict';var emlformat=require(_0xbd64('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbd64('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbd64('0x2'));var moment=require(_0xbd64('0x3'));var BPromise=require(_0xbd64('0x4'));var Mustache=require(_0xbd64('0x5'));var util=require(_0xbd64('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbd64('0x7'));var _=require(_0xbd64('0x8'));var squel=require(_0xbd64('0x9'));var crypto=require(_0xbd64('0xa'));var jsforce=require(_0xbd64('0xb'));var deskjs=require(_0xbd64('0xc'));var toCsv=require(_0xbd64('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbd64('0xe'));var authService=require(_0xbd64('0xf'));var qs=require(_0xbd64('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbd64('0x11'));var logger=require(_0xbd64('0x12'))(_0xbd64('0x13'));var utils=require(_0xbd64('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xbd64('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0xbd64('0x16'));function respondWithStatusCode(_0x2729d8,_0x3a941c){_0x3a941c=_0x3a941c||0xcc;return function(_0x2183e2){if(_0x2183e2){return _0x2729d8[_0xbd64('0x17')](_0x3a941c);}return _0x2729d8[_0xbd64('0x18')](_0x3a941c)[_0xbd64('0x19')]();};}function respondWithResult(_0x269e2f,_0x2b5808){_0x2b5808=_0x2b5808||0xc8;return function(_0x4ae471){if(_0x4ae471){return _0x269e2f[_0xbd64('0x18')](_0x2b5808)[_0xbd64('0x1a')](_0x4ae471);}};}function respondWithFilteredResult(_0x3ff550,_0x32fd34){return function(_0x29fc16){if(_0x29fc16){var _0x49a914=typeof _0x32fd34[_0xbd64('0x1b')]==='undefined'&&typeof _0x32fd34[_0xbd64('0x1c')]===_0xbd64('0x1d');var _0x3aef70=_0x29fc16[_0xbd64('0x1e')];var _0x17d015=_0x49a914?0x0:_0x32fd34[_0xbd64('0x1b')];var _0xa5491d=_0x49a914?_0x29fc16[_0xbd64('0x1e')]:_0x32fd34['offset']+_0x32fd34[_0xbd64('0x1c')];var _0x1f618b;if(_0xa5491d>=_0x3aef70){_0xa5491d=_0x3aef70;_0x1f618b=0xc8;}else{_0x1f618b=0xce;}_0x3ff550['status'](_0x1f618b);return _0x3ff550['set'](_0xbd64('0x1f'),_0x17d015+'-'+_0xa5491d+'/'+_0x3aef70)[_0xbd64('0x1a')](_0x29fc16);}return null;};}function patchUpdates(_0x196d21){return function(_0x39e2eb){try{jsonpatch[_0xbd64('0x20')](_0x39e2eb,_0x196d21,!![]);}catch(_0x816e00){return BPromise['reject'](_0x816e00);}return _0x39e2eb['save']();};}function saveUpdates(_0x6038f,_0x41f2f){return function(_0x12f67b){if(_0x12f67b){return _0x12f67b[_0xbd64('0x21')](_0x6038f)['then'](function(_0x51d118){return _0x51d118;});}return null;};}function removeEntity(_0x28497c,_0x4afaff){return function(_0x46ab38){if(_0x46ab38){return _0x46ab38['destroy']()[_0xbd64('0x22')](function(){_0x28497c[_0xbd64('0x18')](0xcc)[_0xbd64('0x19')]();});}};}function handleEntityNotFound(_0x2d0993,_0x5ae417){return function(_0x9d0fb8){if(!_0x9d0fb8){_0x2d0993[_0xbd64('0x17')](0x194);}return _0x9d0fb8;};}function handleError(_0x13f527,_0x2a44d0){_0x2a44d0=_0x2a44d0||0x1f4;return function(_0x4d1563){logger['error'](_0x4d1563[_0xbd64('0x23')]);if(_0x4d1563['name']){delete _0x4d1563['name'];}_0x13f527[_0xbd64('0x18')](_0x2a44d0)['send'](_0x4d1563);};}exports[_0xbd64('0x24')]=function(_0x5300e8,_0x28199c){var _0x5d8c35={},_0x1db9f3={},_0x3c0eaf={'count':0x0,'rows':[]};var _0x3be63a=_[_0xbd64('0x25')](db[_0xbd64('0x26')][_0xbd64('0x27')],function(_0x4ed44a){return{'name':_0x4ed44a[_0xbd64('0x28')],'type':_0x4ed44a[_0xbd64('0x29')][_0xbd64('0x2a')]};});_0x1db9f3[_0xbd64('0x2b')]=_[_0xbd64('0x25')](_0x3be63a,_0xbd64('0x2c'));_0x1db9f3['query']=_['keys'](_0x5300e8[_0xbd64('0x2d')]);_0x1db9f3['filters']=_[_0xbd64('0x2e')](_0x1db9f3[_0xbd64('0x2b')],_0x1db9f3['query']);_0x5d8c35['attributes']=_[_0xbd64('0x2e')](_0x1db9f3['model'],qs['fields'](_0x5300e8[_0xbd64('0x2d')][_0xbd64('0x2f')]));_0x5d8c35[_0xbd64('0x30')]=_0x5d8c35['attributes'][_0xbd64('0x31')]?_0x5d8c35['attributes']:_0x1db9f3[_0xbd64('0x2b')];if(!_0x5300e8[_0xbd64('0x2d')][_0xbd64('0x32')](_0xbd64('0x33'))){_0x5d8c35[_0xbd64('0x1c')]=qs[_0xbd64('0x1c')](_0x5300e8['query']['limit']);_0x5d8c35[_0xbd64('0x1b')]=qs[_0xbd64('0x1b')](_0x5300e8[_0xbd64('0x2d')][_0xbd64('0x1b')]);}_0x5d8c35[_0xbd64('0x34')]=qs[_0xbd64('0x35')](_0x5300e8['query']['sort']);_0x5d8c35[_0xbd64('0x36')]=qs[_0xbd64('0x37')](_[_0xbd64('0x38')](_0x5300e8['query'],_0x1db9f3['filters']),_0x3be63a);if(_0x5300e8[_0xbd64('0x2d')]['filter']){_0x5d8c35[_0xbd64('0x36')]=_['merge'](_0x5d8c35[_0xbd64('0x36')],{'$or':_[_0xbd64('0x25')](_0x3be63a,function(_0x550221){if(_0x550221[_0xbd64('0x29')]!=='VIRTUAL'){var _0x534091={};_0x534091[_0x550221[_0xbd64('0x2c')]]={'$like':'%'+_0x5300e8[_0xbd64('0x2d')][_0xbd64('0x39')]+'%'};return _0x534091;}})});}_0x5d8c35=_['merge']({},_0x5d8c35,_0x5300e8['options']);var _0x5d6bcf={'where':_0x5d8c35[_0xbd64('0x36')]};return db[_0xbd64('0x26')]['count'](_0x5d6bcf)[_0xbd64('0x22')](function(_0x34b19a){_0x3c0eaf[_0xbd64('0x1e')]=_0x34b19a;if(_0x5300e8[_0xbd64('0x2d')]['includeAll']){_0x5d8c35['include']=[{'all':!![]}];}return db[_0xbd64('0x26')]['findAll'](_0x5d8c35);})['then'](function(_0x231fa6){_0x3c0eaf[_0xbd64('0x3a')]=_0x231fa6;return _0x3c0eaf;})[_0xbd64('0x22')](respondWithFilteredResult(_0x28199c,_0x5d8c35))[_0xbd64('0x3b')](handleError(_0x28199c,null));};exports[_0xbd64('0x3c')]=function(_0x3155b3,_0x247775){var _0x762380={'raw':![],'where':{'id':_0x3155b3[_0xbd64('0x3d')]['id']}},_0x4870fd={};_0x4870fd[_0xbd64('0x2b')]=_['keys'](db[_0xbd64('0x26')][_0xbd64('0x27')]);_0x4870fd[_0xbd64('0x2d')]=_[_0xbd64('0x3e')](_0x3155b3[_0xbd64('0x2d')]);_0x4870fd[_0xbd64('0x37')]=_[_0xbd64('0x2e')](_0x4870fd['model'],_0x4870fd[_0xbd64('0x2d')]);_0x762380['attributes']=_[_0xbd64('0x2e')](_0x4870fd['model'],qs[_0xbd64('0x2f')](_0x3155b3[_0xbd64('0x2d')][_0xbd64('0x2f')]));_0x762380['attributes']=_0x762380[_0xbd64('0x30')]['length']?_0x762380['attributes']:_0x4870fd['model'];if(_0x3155b3[_0xbd64('0x2d')][_0xbd64('0x3f')]){_0x762380[_0xbd64('0x40')]=[{'all':!![]}];}_0x762380=_[_0xbd64('0x41')]({},_0x762380,_0x3155b3[_0xbd64('0x42')]);return db[_0xbd64('0x26')][_0xbd64('0x43')](_0x762380)['then'](handleEntityNotFound(_0x247775,null))[_0xbd64('0x22')](respondWithResult(_0x247775,null))[_0xbd64('0x3b')](handleError(_0x247775,null));};exports[_0xbd64('0x44')]=function(_0x4e5efe,_0x105bee){return db[_0xbd64('0x26')][_0xbd64('0x44')](_0x4e5efe[_0xbd64('0x45')],{})[_0xbd64('0x22')](respondWithResult(_0x105bee,0xc9))['catch'](handleError(_0x105bee,null));};exports[_0xbd64('0x21')]=function(_0x1a9ec8,_0x2a8011){if(_0x1a9ec8[_0xbd64('0x45')]['id']){delete _0x1a9ec8['body']['id'];}return db['ZendeskAccount'][_0xbd64('0x43')]({'where':{'id':_0x1a9ec8[_0xbd64('0x3d')]['id']}})[_0xbd64('0x22')](handleEntityNotFound(_0x2a8011,null))[_0xbd64('0x22')](saveUpdates(_0x1a9ec8[_0xbd64('0x45')],null))[_0xbd64('0x22')](respondWithResult(_0x2a8011,null))[_0xbd64('0x3b')](handleError(_0x2a8011,null));};exports[_0xbd64('0x46')]=function(_0x460158,_0x2709b2){return db[_0xbd64('0x26')][_0xbd64('0x43')]({'where':{'id':_0x460158[_0xbd64('0x3d')]['id']}})[_0xbd64('0x22')](handleEntityNotFound(_0x2709b2,null))[_0xbd64('0x22')](removeEntity(_0x2709b2,null))['catch'](handleError(_0x2709b2,null));};exports[_0xbd64('0x47')]=function(_0x4952db,_0x5ede67,_0x552c95){var _0x4aa662={};var _0xced0ca={};var _0x2f56df;var _0x5480f5;return db[_0xbd64('0x26')][_0xbd64('0x48')]({'where':{'id':_0x4952db[_0xbd64('0x3d')]['id']}})['then'](handleEntityNotFound(_0x5ede67,null))[_0xbd64('0x22')](function(_0x371bad){if(_0x371bad){_0x2f56df=_0x371bad;_0xced0ca[_0xbd64('0x2b')]=_[_0xbd64('0x3e')](db[_0xbd64('0x49')][_0xbd64('0x27')]);_0xced0ca['query']=_['keys'](_0x4952db['query']);_0xced0ca[_0xbd64('0x37')]=_[_0xbd64('0x2e')](_0xced0ca[_0xbd64('0x2b')],_0xced0ca[_0xbd64('0x2d')]);_0x4aa662['attributes']=_[_0xbd64('0x2e')](_0xced0ca[_0xbd64('0x2b')],qs[_0xbd64('0x2f')](_0x4952db[_0xbd64('0x2d')][_0xbd64('0x2f')]));_0x4aa662[_0xbd64('0x30')]=_0x4aa662['attributes'][_0xbd64('0x31')]?_0x4aa662[_0xbd64('0x30')]:_0xced0ca[_0xbd64('0x2b')];_0x4aa662[_0xbd64('0x34')]=qs[_0xbd64('0x35')](_0x4952db[_0xbd64('0x2d')][_0xbd64('0x35')]);_0x4aa662[_0xbd64('0x36')]=qs[_0xbd64('0x37')](_[_0xbd64('0x38')](_0x4952db[_0xbd64('0x2d')],_0xced0ca[_0xbd64('0x37')]));if(_0x4952db['query']['filter']){_0x4aa662[_0xbd64('0x36')]=_[_0xbd64('0x41')](_0x4aa662['where'],{'$or':_['map'](_0x4aa662[_0xbd64('0x30')],function(_0x12bc56){var _0x49051a={};_0x49051a[_0x12bc56]={'$like':'%'+_0x4952db[_0xbd64('0x2d')][_0xbd64('0x39')]+'%'};return _0x49051a;})});}_0x4aa662=_[_0xbd64('0x41')]({},_0x4aa662,_0x4952db[_0xbd64('0x42')]);return _0x2f56df[_0xbd64('0x47')](_0x4aa662);}})[_0xbd64('0x22')](function(_0x2d788){if(_0x2d788){_0x5480f5=_0x2d788[_0xbd64('0x31')];if(!_0x4952db[_0xbd64('0x2d')]['hasOwnProperty'](_0xbd64('0x33'))){_0x4aa662[_0xbd64('0x1c')]=qs[_0xbd64('0x1c')](_0x4952db['query'][_0xbd64('0x1c')]);_0x4aa662[_0xbd64('0x1b')]=qs['offset'](_0x4952db[_0xbd64('0x2d')][_0xbd64('0x1b')]);}return _0x2f56df[_0xbd64('0x47')](_0x4aa662);}})[_0xbd64('0x22')](function(_0x3615bc){if(_0x3615bc){return _0x3615bc?{'count':_0x5480f5,'rows':_0x3615bc}:null;}})[_0xbd64('0x22')](respondWithResult(_0x5ede67,null))['catch'](handleError(_0x5ede67,null));};exports[_0xbd64('0x4a')]=function(_0x1f3bd0,_0xc57eb1,_0x28d899){if(_0x1f3bd0['body']['id']){delete _0x1f3bd0[_0xbd64('0x45')]['id'];}return db[_0xbd64('0x26')]['findOne']({'where':{'id':_0x1f3bd0[_0xbd64('0x3d')]['id']}})['then'](handleEntityNotFound(_0xc57eb1,null))[_0xbd64('0x22')](function(_0x10e269){if(_0x10e269){_0x1f3bd0[_0xbd64('0x45')][_0xbd64('0x4b')]=_0x10e269['id'];_0x1f3bd0['body'][_0xbd64('0x4c')]=integrations[_0xbd64('0x4d')](_0x1f3bd0[_0xbd64('0x45')][_0xbd64('0x4e')],_0x1f3bd0[_0xbd64('0x45')][_0xbd64('0x29')]);_0x1f3bd0['body']['Descriptions']=integrations['getDescriptions'](_0x1f3bd0[_0xbd64('0x45')][_0xbd64('0x4e')],_0x1f3bd0[_0xbd64('0x45')][_0xbd64('0x29')]);return db[_0xbd64('0x49')][_0xbd64('0x44')](_0x1f3bd0['body'],{'include':[{'model':db[_0xbd64('0x4f')],'as':_0xbd64('0x4c')},{'model':db[_0xbd64('0x4f')],'as':_0xbd64('0x50')}]});}return null;})[_0xbd64('0x22')](respondWithResult(_0xc57eb1,null))[_0xbd64('0x3b')](handleError(_0xc57eb1,null));};exports[_0xbd64('0x51')]=function(_0x3d7e47,_0x301f42,_0x18e724){var _0x32e611='';return db[_0xbd64('0x26')]['findOne']({'where':{'id':_0x3d7e47['params']['id']},'attributes':['id',_0xbd64('0x52'),_0xbd64('0x53'),_0xbd64('0x54'),'authType',_0xbd64('0x55')]})['then'](handleEntityNotFound(_0x301f42,null))[_0xbd64('0x22')](function(_0x36ebb5){if(_0x36ebb5){_0x32e611=_0x36ebb5[_0xbd64('0x55')];var _0x819774=_0x32e611['slice'](-0x1);if(_0x819774==='/'){_0x32e611=_0x32e611[_0xbd64('0x56')](0x0,_0x32e611['lastIndexOf'](_0x819774));}var _0x14f79e={'method':_0xbd64('0x57'),'uri':util[_0xbd64('0x58')](_0xbd64('0x59'),_0x32e611,_0xbd64('0x5a')),'json':!![]};switch(_0x36ebb5['authType']){case _0xbd64('0x53'):_0x14f79e[_0xbd64('0x5b')]={'Authorization':util['format'](_0xbd64('0x5c'),new Buffer(util[_0xbd64('0x58')](_0xbd64('0x5d'),_0x36ebb5[_0xbd64('0x52')],_0x36ebb5['password']))[_0xbd64('0x5e')]('base64'))};break;case _0xbd64('0x54'):_0x14f79e[_0xbd64('0x5b')]={'Authorization':util[_0xbd64('0x58')]('Basic\x20%s',new Buffer(util['format']('%s/token:%s',_0x36ebb5['username'],_0x36ebb5[_0xbd64('0x54')]))[_0xbd64('0x5e')](_0xbd64('0x5f')))};break;default:throw new db[(_0xbd64('0x60'))][(_0xbd64('0x61'))]('Unknown\x20authentication\x20type');}return rp(_0x14f79e);}})[_0xbd64('0x22')](function(_0x23de71){if(_0x23de71){var _0xac13e6=[_0xbd64('0x62'),_0xbd64('0x63'),'group',_0xbd64('0x64')];_[_0xbd64('0x65')](_0x23de71[_0xbd64('0x5a')],function(_0x808467){return _0xac13e6['includes'](_0x808467['type']);});return{'count':_0x23de71[_0xbd64('0x5a')][_0xbd64('0x31')],'rows':_[_0xbd64('0x25')](_0x23de71[_0xbd64('0x5a')],function(_0x18b0f0){return{'id':_0x18b0f0['id'],'name':_0x18b0f0[_0xbd64('0x66')]>0x7?_0x18b0f0[_0xbd64('0x67')]:_0x18b0f0[_0xbd64('0x29')],'custom':_0x18b0f0['position']>0x7?!![]:![],'options':_0x18b0f0[_0xbd64('0x68')]?_0x18b0f0['system_field_options']:_0x18b0f0[_0xbd64('0x69')]?_0x18b0f0[_0xbd64('0x69')]:[]};})};}})[_0xbd64('0x22')](respondWithResult(_0x301f42,null))['catch'](function(_0x15b625){var _0x5c30f9=_0x3d7e47['query'][_0xbd64('0x6a')]?0x1f4:_0x15b625[_0xbd64('0x6b')]||0x1f4;logger[_0xbd64('0x6c')]('getFields,\x20%s,\x20%s,\x20%s',_0xbd64('0x51'),_0x5c30f9,JSON[_0xbd64('0x6d')](_0x15b625));delete _0x15b625[_0xbd64('0x2c')];if(_0x5c30f9===0x191){_0x5c30f9=0x190;}_0x301f42[_0xbd64('0x18')](_0x5c30f9)['send'](_0x3d7e47[_0xbd64('0x2d')][_0xbd64('0x6a')]?{'message':_0xbd64('0x6e'),'statusCode':_0x15b625[_0xbd64('0x6b')]}:_0x15b625);});}; \ No newline at end of file +var _0xf7b4=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../components/integrations/configuration','status','end','json','offset','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','ZendeskAccount','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','type','merge','include','findAll','catch','show','params','rawAttributes','options','find','create','body','getConfigurations','findOne','ZendeskConfiguration','pick','nolimit','addConfiguration','AccountId','channel','Descriptions','ZendeskField','Subjects','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','toString','base64','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','group','assignee','includes','title','position','system_field_options','custom_field_options','test','Wrong\x20credentials','statusCode','eml-format','fast-json-patch','request-promise','mustache','util','path','sox'];(function(_0x5e6adf,_0x577e50){var _0x52968f=function(_0x9ae440){while(--_0x9ae440){_0x5e6adf['push'](_0x5e6adf['shift']());}};_0x52968f(++_0x577e50);}(_0xf7b4,0x152));var _0x4f7b=function(_0x4b69c3,_0x265e74){_0x4b69c3=_0x4b69c3-0x0;var _0x5f23b4=_0xf7b4[_0x4b69c3];return _0x5f23b4;};'use strict';var emlformat=require(_0x4f7b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4f7b('0x1'));var rp=require(_0x4f7b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4f7b('0x3'));var util=require(_0x4f7b('0x4'));var path=require(_0x4f7b('0x5'));var sox=require(_0x4f7b('0x6'));var csv=require(_0x4f7b('0x7'));var ejs=require(_0x4f7b('0x8'));var fs=require('fs');var fs_extra=require(_0x4f7b('0x9'));var _=require(_0x4f7b('0xa'));var squel=require(_0x4f7b('0xb'));var crypto=require(_0x4f7b('0xc'));var jsforce=require(_0x4f7b('0xd'));var deskjs=require(_0x4f7b('0xe'));var toCsv=require(_0x4f7b('0x7'));var querystring=require('querystring');var Papa=require(_0x4f7b('0xf'));var Redis=require(_0x4f7b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4f7b('0x11'));var as=require(_0x4f7b('0x12'));var hardwareService=require(_0x4f7b('0x13'));var logger=require(_0x4f7b('0x14'))(_0x4f7b('0x15'));var utils=require('../../config/utils');var config=require(_0x4f7b('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x4f7b('0x17'));function respondWithStatusCode(_0x2e8dd9,_0x3c55e1){_0x3c55e1=_0x3c55e1||0xcc;return function(_0x41a050){if(_0x41a050){return _0x2e8dd9['sendStatus'](_0x3c55e1);}return _0x2e8dd9[_0x4f7b('0x18')](_0x3c55e1)[_0x4f7b('0x19')]();};}function respondWithResult(_0x407cee,_0x43a51a){_0x43a51a=_0x43a51a||0xc8;return function(_0x339486){if(_0x339486){return _0x407cee[_0x4f7b('0x18')](_0x43a51a)[_0x4f7b('0x1a')](_0x339486);}};}function respondWithFilteredResult(_0x2437cc,_0x260667){return function(_0x29fdd5){if(_0x29fdd5){var _0x1a28b8=typeof _0x260667[_0x4f7b('0x1b')]==='undefined'&&typeof _0x260667[_0x4f7b('0x1c')]==='undefined';var _0x5b5ee3=_0x29fdd5[_0x4f7b('0x1d')];var _0x3813da=_0x1a28b8?0x0:_0x260667['offset'];var _0x2b34c9=_0x1a28b8?_0x29fdd5[_0x4f7b('0x1d')]:_0x260667[_0x4f7b('0x1b')]+_0x260667[_0x4f7b('0x1c')];var _0x5a5187;if(_0x2b34c9>=_0x5b5ee3){_0x2b34c9=_0x5b5ee3;_0x5a5187=0xc8;}else{_0x5a5187=0xce;}_0x2437cc[_0x4f7b('0x18')](_0x5a5187);return _0x2437cc['set'](_0x4f7b('0x1e'),_0x3813da+'-'+_0x2b34c9+'/'+_0x5b5ee3)[_0x4f7b('0x1a')](_0x29fdd5);}return null;};}function patchUpdates(_0xa2f54e){return function(_0xdb2df2){try{jsonpatch[_0x4f7b('0x1f')](_0xdb2df2,_0xa2f54e,!![]);}catch(_0x203a92){return BPromise[_0x4f7b('0x20')](_0x203a92);}return _0xdb2df2[_0x4f7b('0x21')]();};}function saveUpdates(_0x2a8b50,_0x5508bd){return function(_0x410176){if(_0x410176){return _0x410176[_0x4f7b('0x22')](_0x2a8b50)[_0x4f7b('0x23')](function(_0x5bd43f){return _0x5bd43f;});}return null;};}function removeEntity(_0x150f57,_0x4610a4){return function(_0x5d22f4){if(_0x5d22f4){return _0x5d22f4[_0x4f7b('0x24')]()['then'](function(){_0x150f57[_0x4f7b('0x18')](0xcc)[_0x4f7b('0x19')]();});}};}function handleEntityNotFound(_0x23c820,_0x278c41){return function(_0x17aa9d){if(!_0x17aa9d){_0x23c820[_0x4f7b('0x25')](0x194);}return _0x17aa9d;};}function handleError(_0x181e13,_0x3ad769){_0x3ad769=_0x3ad769||0x1f4;return function(_0x4ec9a3){logger[_0x4f7b('0x26')](_0x4ec9a3[_0x4f7b('0x27')]);if(_0x4ec9a3[_0x4f7b('0x28')]){delete _0x4ec9a3['name'];}_0x181e13[_0x4f7b('0x18')](_0x3ad769)[_0x4f7b('0x29')](_0x4ec9a3);};}exports[_0x4f7b('0x2a')]=function(_0x3a56ff,_0x1ccce0){var _0x4ebffa={},_0xac1f93={},_0x3331b2={'count':0x0,'rows':[]};var _0x9a675c=_['map'](db[_0x4f7b('0x2b')]['rawAttributes'],function(_0x4e4828){return{'name':_0x4e4828[_0x4f7b('0x2c')],'type':_0x4e4828['type'][_0x4f7b('0x2d')]};});_0xac1f93[_0x4f7b('0x2e')]=_[_0x4f7b('0x2f')](_0x9a675c,_0x4f7b('0x28'));_0xac1f93[_0x4f7b('0x30')]=_[_0x4f7b('0x31')](_0x3a56ff[_0x4f7b('0x30')]);_0xac1f93[_0x4f7b('0x32')]=_[_0x4f7b('0x33')](_0xac1f93[_0x4f7b('0x2e')],_0xac1f93[_0x4f7b('0x30')]);_0x4ebffa[_0x4f7b('0x34')]=_[_0x4f7b('0x33')](_0xac1f93[_0x4f7b('0x2e')],qs[_0x4f7b('0x35')](_0x3a56ff[_0x4f7b('0x30')][_0x4f7b('0x35')]));_0x4ebffa[_0x4f7b('0x34')]=_0x4ebffa[_0x4f7b('0x34')][_0x4f7b('0x36')]?_0x4ebffa[_0x4f7b('0x34')]:_0xac1f93[_0x4f7b('0x2e')];if(!_0x3a56ff['query'][_0x4f7b('0x37')]('nolimit')){_0x4ebffa[_0x4f7b('0x1c')]=qs[_0x4f7b('0x1c')](_0x3a56ff['query'][_0x4f7b('0x1c')]);_0x4ebffa[_0x4f7b('0x1b')]=qs[_0x4f7b('0x1b')](_0x3a56ff['query'][_0x4f7b('0x1b')]);}_0x4ebffa[_0x4f7b('0x38')]=qs[_0x4f7b('0x39')](_0x3a56ff[_0x4f7b('0x30')][_0x4f7b('0x39')]);_0x4ebffa[_0x4f7b('0x3a')]=qs[_0x4f7b('0x32')](_['pick'](_0x3a56ff[_0x4f7b('0x30')],_0xac1f93['filters']),_0x9a675c);if(_0x3a56ff[_0x4f7b('0x30')][_0x4f7b('0x3b')]){_0x4ebffa[_0x4f7b('0x3a')]=_['merge'](_0x4ebffa[_0x4f7b('0x3a')],{'$or':_['map'](_0x9a675c,function(_0x2471dc){if(_0x2471dc[_0x4f7b('0x3c')]!=='VIRTUAL'){var _0x48aecc={};_0x48aecc[_0x2471dc[_0x4f7b('0x28')]]={'$like':'%'+_0x3a56ff['query'][_0x4f7b('0x3b')]+'%'};return _0x48aecc;}})});}_0x4ebffa=_[_0x4f7b('0x3d')]({},_0x4ebffa,_0x3a56ff['options']);var _0x1d0746={'where':_0x4ebffa['where']};return db['ZendeskAccount']['count'](_0x1d0746)[_0x4f7b('0x23')](function(_0x2e861d){_0x3331b2[_0x4f7b('0x1d')]=_0x2e861d;if(_0x3a56ff[_0x4f7b('0x30')]['includeAll']){_0x4ebffa[_0x4f7b('0x3e')]=[{'all':!![]}];}return db['ZendeskAccount'][_0x4f7b('0x3f')](_0x4ebffa);})['then'](function(_0x3c411f){_0x3331b2['rows']=_0x3c411f;return _0x3331b2;})[_0x4f7b('0x23')](respondWithFilteredResult(_0x1ccce0,_0x4ebffa))[_0x4f7b('0x40')](handleError(_0x1ccce0,null));};exports[_0x4f7b('0x41')]=function(_0x3ab08f,_0x2986cd){var _0x325cd6={'raw':![],'where':{'id':_0x3ab08f[_0x4f7b('0x42')]['id']}},_0x3fdde2={};_0x3fdde2[_0x4f7b('0x2e')]=_[_0x4f7b('0x31')](db[_0x4f7b('0x2b')][_0x4f7b('0x43')]);_0x3fdde2[_0x4f7b('0x30')]=_[_0x4f7b('0x31')](_0x3ab08f[_0x4f7b('0x30')]);_0x3fdde2[_0x4f7b('0x32')]=_[_0x4f7b('0x33')](_0x3fdde2[_0x4f7b('0x2e')],_0x3fdde2['query']);_0x325cd6['attributes']=_[_0x4f7b('0x33')](_0x3fdde2[_0x4f7b('0x2e')],qs[_0x4f7b('0x35')](_0x3ab08f[_0x4f7b('0x30')]['fields']));_0x325cd6['attributes']=_0x325cd6[_0x4f7b('0x34')][_0x4f7b('0x36')]?_0x325cd6[_0x4f7b('0x34')]:_0x3fdde2[_0x4f7b('0x2e')];if(_0x3ab08f['query']['includeAll']){_0x325cd6[_0x4f7b('0x3e')]=[{'all':!![]}];}_0x325cd6=_[_0x4f7b('0x3d')]({},_0x325cd6,_0x3ab08f[_0x4f7b('0x44')]);return db[_0x4f7b('0x2b')][_0x4f7b('0x45')](_0x325cd6)['then'](handleEntityNotFound(_0x2986cd,null))[_0x4f7b('0x23')](respondWithResult(_0x2986cd,null))[_0x4f7b('0x40')](handleError(_0x2986cd,null));};exports[_0x4f7b('0x46')]=function(_0x5df68e,_0x6c659c){return db[_0x4f7b('0x2b')][_0x4f7b('0x46')](_0x5df68e[_0x4f7b('0x47')],{})[_0x4f7b('0x23')](respondWithResult(_0x6c659c,0xc9))[_0x4f7b('0x40')](handleError(_0x6c659c,null));};exports[_0x4f7b('0x22')]=function(_0x2e563f,_0x2630ec){if(_0x2e563f[_0x4f7b('0x47')]['id']){delete _0x2e563f['body']['id'];}return db[_0x4f7b('0x2b')][_0x4f7b('0x45')]({'where':{'id':_0x2e563f[_0x4f7b('0x42')]['id']}})['then'](handleEntityNotFound(_0x2630ec,null))[_0x4f7b('0x23')](saveUpdates(_0x2e563f[_0x4f7b('0x47')],null))[_0x4f7b('0x23')](respondWithResult(_0x2630ec,null))[_0x4f7b('0x40')](handleError(_0x2630ec,null));};exports[_0x4f7b('0x24')]=function(_0x7e624,_0x144ba1){return db[_0x4f7b('0x2b')][_0x4f7b('0x45')]({'where':{'id':_0x7e624[_0x4f7b('0x42')]['id']}})['then'](handleEntityNotFound(_0x144ba1,null))[_0x4f7b('0x23')](removeEntity(_0x144ba1,null))[_0x4f7b('0x40')](handleError(_0x144ba1,null));};exports[_0x4f7b('0x48')]=function(_0x4d1ac9,_0x2c9cee,_0x40c183){var _0xeeb227={};var _0xb92819={};var _0x3437a8;var _0x819fb3;return db['ZendeskAccount'][_0x4f7b('0x49')]({'where':{'id':_0x4d1ac9[_0x4f7b('0x42')]['id']}})[_0x4f7b('0x23')](handleEntityNotFound(_0x2c9cee,null))['then'](function(_0x4017b5){if(_0x4017b5){_0x3437a8=_0x4017b5;_0xb92819[_0x4f7b('0x2e')]=_[_0x4f7b('0x31')](db[_0x4f7b('0x4a')][_0x4f7b('0x43')]);_0xb92819[_0x4f7b('0x30')]=_['keys'](_0x4d1ac9[_0x4f7b('0x30')]);_0xb92819['filters']=_['intersection'](_0xb92819['model'],_0xb92819[_0x4f7b('0x30')]);_0xeeb227[_0x4f7b('0x34')]=_[_0x4f7b('0x33')](_0xb92819['model'],qs['fields'](_0x4d1ac9[_0x4f7b('0x30')][_0x4f7b('0x35')]));_0xeeb227['attributes']=_0xeeb227[_0x4f7b('0x34')][_0x4f7b('0x36')]?_0xeeb227[_0x4f7b('0x34')]:_0xb92819[_0x4f7b('0x2e')];_0xeeb227['order']=qs[_0x4f7b('0x39')](_0x4d1ac9[_0x4f7b('0x30')][_0x4f7b('0x39')]);_0xeeb227[_0x4f7b('0x3a')]=qs[_0x4f7b('0x32')](_[_0x4f7b('0x4b')](_0x4d1ac9[_0x4f7b('0x30')],_0xb92819['filters']));if(_0x4d1ac9['query']['filter']){_0xeeb227[_0x4f7b('0x3a')]=_['merge'](_0xeeb227['where'],{'$or':_['map'](_0xeeb227['attributes'],function(_0x4a35d1){var _0x2715b5={};_0x2715b5[_0x4a35d1]={'$like':'%'+_0x4d1ac9[_0x4f7b('0x30')][_0x4f7b('0x3b')]+'%'};return _0x2715b5;})});}_0xeeb227=_[_0x4f7b('0x3d')]({},_0xeeb227,_0x4d1ac9[_0x4f7b('0x44')]);return _0x3437a8[_0x4f7b('0x48')](_0xeeb227);}})[_0x4f7b('0x23')](function(_0x1d500c){if(_0x1d500c){_0x819fb3=_0x1d500c[_0x4f7b('0x36')];if(!_0x4d1ac9[_0x4f7b('0x30')][_0x4f7b('0x37')](_0x4f7b('0x4c'))){_0xeeb227[_0x4f7b('0x1c')]=qs[_0x4f7b('0x1c')](_0x4d1ac9[_0x4f7b('0x30')][_0x4f7b('0x1c')]);_0xeeb227[_0x4f7b('0x1b')]=qs['offset'](_0x4d1ac9[_0x4f7b('0x30')][_0x4f7b('0x1b')]);}return _0x3437a8[_0x4f7b('0x48')](_0xeeb227);}})[_0x4f7b('0x23')](function(_0x321f36){if(_0x321f36){return _0x321f36?{'count':_0x819fb3,'rows':_0x321f36}:null;}})['then'](respondWithResult(_0x2c9cee,null))['catch'](handleError(_0x2c9cee,null));};exports[_0x4f7b('0x4d')]=function(_0x5a2b3d,_0x457ac5,_0x384a08){if(_0x5a2b3d[_0x4f7b('0x47')]['id']){delete _0x5a2b3d[_0x4f7b('0x47')]['id'];}return db['ZendeskAccount'][_0x4f7b('0x49')]({'where':{'id':_0x5a2b3d[_0x4f7b('0x42')]['id']}})[_0x4f7b('0x23')](handleEntityNotFound(_0x457ac5,null))['then'](function(_0x4b2089){if(_0x4b2089){_0x5a2b3d['body'][_0x4f7b('0x4e')]=_0x4b2089['id'];_0x5a2b3d['body']['Subjects']=integrations['getSubjects'](_0x5a2b3d[_0x4f7b('0x47')][_0x4f7b('0x4f')],_0x5a2b3d[_0x4f7b('0x47')]['type']);_0x5a2b3d[_0x4f7b('0x47')][_0x4f7b('0x50')]=integrations['getDescriptions'](_0x5a2b3d['body'][_0x4f7b('0x4f')],_0x5a2b3d[_0x4f7b('0x47')][_0x4f7b('0x3c')]);return db[_0x4f7b('0x4a')]['create'](_0x5a2b3d[_0x4f7b('0x47')],{'include':[{'model':db[_0x4f7b('0x51')],'as':_0x4f7b('0x52')},{'model':db[_0x4f7b('0x51')],'as':_0x4f7b('0x50')}]});}return null;})[_0x4f7b('0x23')](respondWithResult(_0x457ac5,null))['catch'](handleError(_0x457ac5,null));};exports[_0x4f7b('0x53')]=function(_0x79deaa,_0xa10c21,_0x220f21){var _0x1ca442='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x79deaa['params']['id']},'attributes':['id',_0x4f7b('0x54'),_0x4f7b('0x55'),_0x4f7b('0x56'),_0x4f7b('0x57'),_0x4f7b('0x58')]})['then'](handleEntityNotFound(_0xa10c21,null))[_0x4f7b('0x23')](function(_0x16dbe3){if(_0x16dbe3){_0x1ca442=_0x16dbe3[_0x4f7b('0x58')];var _0x2a09b6=_0x1ca442[_0x4f7b('0x59')](-0x1);if(_0x2a09b6==='/'){_0x1ca442=_0x1ca442[_0x4f7b('0x5a')](0x0,_0x1ca442[_0x4f7b('0x5b')](_0x2a09b6));}var _0x477077={'method':_0x4f7b('0x5c'),'uri':util[_0x4f7b('0x5d')](_0x4f7b('0x5e'),_0x1ca442,_0x4f7b('0x5f')),'json':!![]};switch(_0x16dbe3[_0x4f7b('0x57')]){case _0x4f7b('0x55'):_0x477077[_0x4f7b('0x60')]={'Authorization':util[_0x4f7b('0x5d')](_0x4f7b('0x61'),new Buffer(util[_0x4f7b('0x5d')]('%s:%s',_0x16dbe3['username'],_0x16dbe3[_0x4f7b('0x55')]))[_0x4f7b('0x62')](_0x4f7b('0x63')))};break;case _0x4f7b('0x56'):_0x477077['headers']={'Authorization':util[_0x4f7b('0x5d')](_0x4f7b('0x61'),new Buffer(util[_0x4f7b('0x5d')](_0x4f7b('0x64'),_0x16dbe3[_0x4f7b('0x54')],_0x16dbe3[_0x4f7b('0x56')]))[_0x4f7b('0x62')](_0x4f7b('0x63')))};break;default:throw new db[(_0x4f7b('0x65'))][(_0x4f7b('0x66'))](_0x4f7b('0x67'));}return rp(_0x477077);}})[_0x4f7b('0x23')](function(_0x26b5cb){if(_0x26b5cb){var _0x278d72=[_0x4f7b('0x68'),'description',_0x4f7b('0x69'),_0x4f7b('0x6a')];_['remove'](_0x26b5cb['ticket_fields'],function(_0x45aced){return _0x278d72[_0x4f7b('0x6b')](_0x45aced[_0x4f7b('0x3c')]);});return{'count':_0x26b5cb[_0x4f7b('0x5f')][_0x4f7b('0x36')],'rows':_[_0x4f7b('0x2f')](_0x26b5cb[_0x4f7b('0x5f')],function(_0x48d9c6){return{'id':_0x48d9c6['id'],'name':_0x48d9c6['position']>0x7?_0x48d9c6[_0x4f7b('0x6c')]:_0x48d9c6[_0x4f7b('0x3c')],'custom':_0x48d9c6[_0x4f7b('0x6d')]>0x7?!![]:![],'options':_0x48d9c6[_0x4f7b('0x6e')]?_0x48d9c6['system_field_options']:_0x48d9c6[_0x4f7b('0x6f')]?_0x48d9c6[_0x4f7b('0x6f')]:[]};})};}})['then'](respondWithResult(_0xa10c21,null))[_0x4f7b('0x40')](function(_0x247541){var _0x50aabe=_0x79deaa['query'][_0x4f7b('0x70')]?0x1f4:_0x247541['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x4f7b('0x53'),_0x50aabe,JSON['stringify'](_0x247541));delete _0x247541[_0x4f7b('0x28')];if(_0x50aabe===0x191){_0x50aabe=0x190;}_0xa10c21[_0x4f7b('0x18')](_0x50aabe)[_0x4f7b('0x29')](_0x79deaa[_0x4f7b('0x30')][_0x4f7b('0x70')]?{'message':_0x4f7b('0x71'),'statusCode':_0x247541[_0x4f7b('0x72')]}:_0x247541);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 7f84ef9..533ec27 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 _0x030f=['bluebird','request-promise','rimraf','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x148ee4,_0x505eb3){var _0x3c20b6=function(_0x5265c6){while(--_0x5265c6){_0x148ee4['push'](_0x148ee4['shift']());}};_0x3c20b6(++_0x505eb3);}(_0x030f,0xa3));var _0xf030=function(_0x36e041,_0x72b33a){_0x36e041=_0x36e041-0x0;var _0x1255e4=_0x030f[_0x36e041];return _0x1255e4;};'use strict';var _=require(_0xf030('0x0'));var util=require(_0xf030('0x1'));var logger=require(_0xf030('0x2'))(_0xf030('0x3'));var moment=require(_0xf030('0x4'));var BPromise=require(_0xf030('0x5'));var rp=require(_0xf030('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf030('0x7'));var config=require('../../config/environment');var attributes=require(_0xf030('0x8'));var integrations=require(_0xf030('0x9'));module[_0xf030('0xa')]=function(_0x236832,_0xbe9081){return _0x236832[_0xf030('0xb')](_0xf030('0xc'),attributes,{'tableName':_0xf030('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x40b4=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x40b4,0x1ce));var _0x440b=function(_0x231562,_0xab9705){_0x231562=_0x231562-0x0;var _0x3df715=_0x40b4[_0x231562];return _0x3df715;};'use strict';var _=require(_0x440b('0x0'));var util=require(_0x440b('0x1'));var logger=require(_0x440b('0x2'))(_0x440b('0x3'));var moment=require('moment');var BPromise=require(_0x440b('0x4'));var rp=require(_0x440b('0x5'));var fs=require('fs');var path=require(_0x440b('0x6'));var rimraf=require('rimraf');var config=require(_0x440b('0x7'));var attributes=require(_0x440b('0x8'));var integrations=require(_0x440b('0x9'));module[_0x440b('0xa')]=function(_0x1f8b86,_0x1b4967){return _0x1f8b86[_0x440b('0xb')](_0x440b('0xc'),attributes,{'tableName':_0x440b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index af105a3..d564477 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 _0xd68e=['findAll','options','raw','attributes','model','include','map','find','where','ShowZendeskAccount','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount'];(function(_0x3b60a3,_0x323374){var _0xc625e7=function(_0x2f03ea){while(--_0x2f03ea){_0x3b60a3['push'](_0x3b60a3['shift']());}};_0xc625e7(++_0x323374);}(_0xd68e,0x1d3));var _0xed68=function(_0xbaeba7,_0x578dfa){_0xbaeba7=_0xbaeba7-0x0;var _0x4b42e7=_0xd68e[_0xbaeba7];return _0x4b42e7;};'use strict';var _=require(_0xed68('0x0'));var util=require(_0xed68('0x1'));var moment=require(_0xed68('0x2'));var BPromise=require(_0xed68('0x3'));var rs=require(_0xed68('0x4'));var fs=require('fs');var Redis=require(_0xed68('0x5'));var db=require(_0xed68('0x6'))['db'];var utils=require(_0xed68('0x7'));var logger=require(_0xed68('0x8'))(_0xed68('0x9'));var config=require(_0xed68('0xa'));var jayson=require(_0xed68('0xb'));var client=jayson[_0xed68('0xc')][_0xed68('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x59ba46,_0x3a0d4c,_0x5c0c68){return new BPromise(function(_0x370631,_0x2fc69e){return client[_0xed68('0xe')](_0x59ba46,_0x5c0c68)[_0xed68('0xf')](function(_0xb024e0){logger[_0xed68('0x10')](_0xed68('0x11'),_0x3a0d4c,_0xed68('0x12'));logger['debug']('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x3a0d4c,_0xed68('0x12'),JSON[_0xed68('0x13')](_0xb024e0));if(_0xb024e0[_0xed68('0x14')]){if(_0xb024e0[_0xed68('0x14')][_0xed68('0x15')]===0x1f4){logger[_0xed68('0x14')](_0xed68('0x11'),_0x3a0d4c,_0xb024e0[_0xed68('0x14')][_0xed68('0x16')]);return _0x2fc69e(_0xb024e0['error']['message']);}logger[_0xed68('0x14')](_0xed68('0x11'),_0x3a0d4c,_0xb024e0[_0xed68('0x14')][_0xed68('0x16')]);return _0x370631(_0xb024e0[_0xed68('0x14')][_0xed68('0x16')]);}else{logger[_0xed68('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x3a0d4c,_0xed68('0x12'));_0x370631(_0xb024e0[_0xed68('0x17')][_0xed68('0x16')]);}})[_0xed68('0x18')](function(_0xfe7727){logger[_0xed68('0x14')]('ZendeskAccount,\x20%s,\x20%s',_0x3a0d4c,_0xfe7727);_0x2fc69e(_0xfe7727);});});}exports[_0xed68('0x19')]=function(_0x2fed48){var _0xdde938=this;return new Promise(function(_0x1b4f66,_0x30f266){return db[_0xed68('0x1a')][_0xed68('0x1b')]({'raw':_0x2fed48[_0xed68('0x1c')]?_0x2fed48[_0xed68('0x1c')][_0xed68('0x1d')]===undefined?!![]:![]:!![],'where':_0x2fed48[_0xed68('0x1c')]?_0x2fed48['options']['where']||null:null,'attributes':_0x2fed48[_0xed68('0x1c')]?_0x2fed48[_0xed68('0x1c')][_0xed68('0x1e')]||null:null,'limit':_0x2fed48['options']?_0x2fed48[_0xed68('0x1c')]['limit']||null:null,'include':_0x2fed48[_0xed68('0x1c')]?_0x2fed48[_0xed68('0x1c')]['include']?_['map'](_0x2fed48[_0xed68('0x1c')]['include'],function(_0x5e9c0f){return{'model':db[_0x5e9c0f[_0xed68('0x1f')]],'as':_0x5e9c0f['as'],'attributes':_0x5e9c0f[_0xed68('0x1e')],'include':_0x5e9c0f[_0xed68('0x20')]?_[_0xed68('0x21')](_0x5e9c0f['include'],function(_0x71fb9d){return{'model':db[_0x71fb9d['model']],'as':_0x71fb9d['as'],'attributes':_0x71fb9d[_0xed68('0x1e')],'include':_0x71fb9d[_0xed68('0x20')]?_[_0xed68('0x21')](_0x71fb9d[_0xed68('0x20')],function(_0x49941a){return{'model':db[_0x49941a[_0xed68('0x1f')]],'as':_0x49941a['as'],'attributes':_0x49941a[_0xed68('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xed68('0xf')](function(_0x198d9e){logger[_0xed68('0x10')](_0xed68('0x19'),_0x2fed48);logger['debug'](_0xed68('0x19'),_0x2fed48,JSON[_0xed68('0x13')](_0x198d9e));_0x1b4f66(_0x198d9e);})[_0xed68('0x18')](function(_0x4b0730){logger[_0xed68('0x14')]('GetZendeskAccount',_0x4b0730['message'],_0x2fed48);_0x30f266(_0xdde938[_0xed68('0x14')](0x1f4,_0x4b0730['message']));});});};exports['ShowZendeskAccount']=function(_0xd66dc1){var _0x961be2=this;return new Promise(function(_0x273edc,_0x54e1cf){return db[_0xed68('0x1a')][_0xed68('0x22')]({'raw':_0xd66dc1['options']?_0xd66dc1[_0xed68('0x1c')][_0xed68('0x1d')]===undefined?!![]:![]:!![],'where':_0xd66dc1[_0xed68('0x1c')]?_0xd66dc1['options'][_0xed68('0x23')]||null:null,'attributes':_0xd66dc1['options']?_0xd66dc1[_0xed68('0x1c')][_0xed68('0x1e')]||null:null,'include':_0xd66dc1[_0xed68('0x1c')]?_0xd66dc1[_0xed68('0x1c')][_0xed68('0x20')]?_[_0xed68('0x21')](_0xd66dc1['options'][_0xed68('0x20')],function(_0x42c72b){return{'model':db[_0x42c72b[_0xed68('0x1f')]],'as':_0x42c72b['as'],'attributes':_0x42c72b[_0xed68('0x1e')],'include':_0x42c72b['include']?_[_0xed68('0x21')](_0x42c72b[_0xed68('0x20')],function(_0x5e55dc){return{'model':db[_0x5e55dc[_0xed68('0x1f')]],'as':_0x5e55dc['as'],'attributes':_0x5e55dc[_0xed68('0x1e')],'include':_0x5e55dc[_0xed68('0x20')]?_[_0xed68('0x21')](_0x5e55dc[_0xed68('0x20')],function(_0x365665){return{'model':db[_0x365665[_0xed68('0x1f')]],'as':_0x365665['as'],'attributes':_0x365665[_0xed68('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xed68('0xf')](function(_0x5821dd){logger[_0xed68('0x10')](_0xed68('0x24'),_0xd66dc1);logger[_0xed68('0x25')]('ShowZendeskAccount',_0xd66dc1,JSON[_0xed68('0x13')](_0x5821dd));_0x273edc(_0x5821dd);})['catch'](function(_0x2b3224){logger['error'](_0xed68('0x24'),_0x2b3224[_0xed68('0x16')],_0xd66dc1);_0x54e1cf(_0x961be2['error'](0x1f4,_0x2b3224[_0xed68('0x16')]));});});}; \ No newline at end of file +var _0xe811=['GetZendeskAccount','debug','catch','ShowZendeskAccount','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ZendeskAccount,\x20%s,\x20%s','info','result','ZendeskAccount','findAll','options','raw','where','attributes','include','map','model'];(function(_0x25039c,_0x27359a){var _0x1bbd12=function(_0xd7269a){while(--_0xd7269a){_0x25039c['push'](_0x25039c['shift']());}};_0x1bbd12(++_0x27359a);}(_0xe811,0x1a8));var _0x1e81=function(_0x4e4af8,_0x1a204c){_0x4e4af8=_0x4e4af8-0x0;var _0x2f5132=_0xe811[_0x4e4af8];return _0x2f5132;};'use strict';var _=require(_0x1e81('0x0'));var util=require(_0x1e81('0x1'));var moment=require('moment');var BPromise=require(_0x1e81('0x2'));var rs=require(_0x1e81('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1e81('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1e81('0x5'))(_0x1e81('0x6'));var config=require(_0x1e81('0x7'));var jayson=require(_0x1e81('0x8'));var client=jayson[_0x1e81('0x9')][_0x1e81('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2cd6ad,_0x1fd11a,_0x3be533){return new BPromise(function(_0x1d8276,_0x310bc1){return client[_0x1e81('0xb')](_0x2cd6ad,_0x3be533)[_0x1e81('0xc')](function(_0x941da){logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x1fd11a,_0x1e81('0xd'));logger['debug'](_0x1e81('0xe'),_0x1fd11a,_0x1e81('0xd'),JSON[_0x1e81('0xf')](_0x941da));if(_0x941da[_0x1e81('0x10')]){if(_0x941da[_0x1e81('0x10')][_0x1e81('0x11')]===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x1fd11a,_0x941da[_0x1e81('0x10')][_0x1e81('0x12')]);return _0x310bc1(_0x941da[_0x1e81('0x10')][_0x1e81('0x12')]);}logger[_0x1e81('0x10')](_0x1e81('0x13'),_0x1fd11a,_0x941da['error'][_0x1e81('0x12')]);return _0x1d8276(_0x941da['error'][_0x1e81('0x12')]);}else{logger[_0x1e81('0x14')](_0x1e81('0x13'),_0x1fd11a,_0x1e81('0xd'));_0x1d8276(_0x941da[_0x1e81('0x15')]['message']);}})['catch'](function(_0x1220ff){logger[_0x1e81('0x10')](_0x1e81('0x13'),_0x1fd11a,_0x1220ff);_0x310bc1(_0x1220ff);});});}exports['GetZendeskAccount']=function(_0x519006){var _0x46fcd5=this;return new Promise(function(_0x356c55,_0x58876f){return db[_0x1e81('0x16')][_0x1e81('0x17')]({'raw':_0x519006[_0x1e81('0x18')]?_0x519006[_0x1e81('0x18')][_0x1e81('0x19')]===undefined?!![]:![]:!![],'where':_0x519006[_0x1e81('0x18')]?_0x519006[_0x1e81('0x18')][_0x1e81('0x1a')]||null:null,'attributes':_0x519006[_0x1e81('0x18')]?_0x519006[_0x1e81('0x18')][_0x1e81('0x1b')]||null:null,'limit':_0x519006[_0x1e81('0x18')]?_0x519006[_0x1e81('0x18')]['limit']||null:null,'include':_0x519006[_0x1e81('0x18')]?_0x519006['options'][_0x1e81('0x1c')]?_[_0x1e81('0x1d')](_0x519006['options'][_0x1e81('0x1c')],function(_0x2fb07f){return{'model':db[_0x2fb07f[_0x1e81('0x1e')]],'as':_0x2fb07f['as'],'attributes':_0x2fb07f[_0x1e81('0x1b')],'include':_0x2fb07f[_0x1e81('0x1c')]?_[_0x1e81('0x1d')](_0x2fb07f[_0x1e81('0x1c')],function(_0x8dc95a){return{'model':db[_0x8dc95a[_0x1e81('0x1e')]],'as':_0x8dc95a['as'],'attributes':_0x8dc95a[_0x1e81('0x1b')],'include':_0x8dc95a[_0x1e81('0x1c')]?_[_0x1e81('0x1d')](_0x8dc95a['include'],function(_0x50fb29){return{'model':db[_0x50fb29[_0x1e81('0x1e')]],'as':_0x50fb29['as'],'attributes':_0x50fb29[_0x1e81('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1e81('0xc')](function(_0x3d7b15){logger[_0x1e81('0x14')](_0x1e81('0x1f'),_0x519006);logger[_0x1e81('0x20')](_0x1e81('0x1f'),_0x519006,JSON[_0x1e81('0xf')](_0x3d7b15));_0x356c55(_0x3d7b15);})[_0x1e81('0x21')](function(_0x1cf43f){logger[_0x1e81('0x10')]('GetZendeskAccount',_0x1cf43f['message'],_0x519006);_0x58876f(_0x46fcd5[_0x1e81('0x10')](0x1f4,_0x1cf43f[_0x1e81('0x12')]));});});};exports[_0x1e81('0x22')]=function(_0x18265b){var _0xb83505=this;return new Promise(function(_0x18cec7,_0x523d26){return db['ZendeskAccount']['find']({'raw':_0x18265b[_0x1e81('0x18')]?_0x18265b['options'][_0x1e81('0x19')]===undefined?!![]:![]:!![],'where':_0x18265b['options']?_0x18265b['options'][_0x1e81('0x1a')]||null:null,'attributes':_0x18265b['options']?_0x18265b['options']['attributes']||null:null,'include':_0x18265b['options']?_0x18265b[_0x1e81('0x18')][_0x1e81('0x1c')]?_['map'](_0x18265b[_0x1e81('0x18')][_0x1e81('0x1c')],function(_0x456f72){return{'model':db[_0x456f72[_0x1e81('0x1e')]],'as':_0x456f72['as'],'attributes':_0x456f72[_0x1e81('0x1b')],'include':_0x456f72[_0x1e81('0x1c')]?_[_0x1e81('0x1d')](_0x456f72[_0x1e81('0x1c')],function(_0x3b0b92){return{'model':db[_0x3b0b92[_0x1e81('0x1e')]],'as':_0x3b0b92['as'],'attributes':_0x3b0b92[_0x1e81('0x1b')],'include':_0x3b0b92[_0x1e81('0x1c')]?_['map'](_0x3b0b92[_0x1e81('0x1c')],function(_0x16f754){return{'model':db[_0x16f754[_0x1e81('0x1e')]],'as':_0x16f754['as'],'attributes':_0x16f754['attributes']};}):[]};}):[]};}):[]:[]})[_0x1e81('0xc')](function(_0x130020){logger['info'](_0x1e81('0x22'),_0x18265b);logger[_0x1e81('0x20')](_0x1e81('0x22'),_0x18265b,JSON[_0x1e81('0xf')](_0x130020));_0x18cec7(_0x130020);})[_0x1e81('0x21')](function(_0x2c41d8){logger[_0x1e81('0x10')](_0x1e81('0x22'),_0x2c41d8['message'],_0x18265b);_0x523d26(_0xb83505[_0x1e81('0x10')](0x1f4,_0x2c41d8[_0x1e81('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 463257c..c428ee5 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 _0xe706=['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','/:id/tags','getTags','post','create','put','update','delete','exports','multer','util','path','express','Router'];(function(_0x35c6ba,_0x3b14c2){var _0x536ae7=function(_0xa042f0){while(--_0xa042f0){_0x35c6ba['push'](_0x35c6ba['shift']());}};_0x536ae7(++_0x3b14c2);}(_0xe706,0xa3));var _0x6e70=function(_0x3a41a8,_0x1e25b9){_0x3a41a8=_0x3a41a8-0x0;var _0x19dfeb=_0xe706[_0x3a41a8];return _0x19dfeb;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0xa')](_0x6e70('0x11'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0xa')](_0x6e70('0x13'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x6e70('0xa')](_0x6e70('0x14'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x15')]);router[_0x6e70('0x16')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x17')]);router[_0x6e70('0x16')]('/:id/tags',auth['isAuthenticated'](),controller['setTags']);router[_0x6e70('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x6e70('0x19')]);router[_0x6e70('0x1a')]('/:id',auth[_0x6e70('0xb')](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file +var _0xb7e7=['delete','destroy','exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','index','get','/:id','show','/:id/fields','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','put','update'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xb7e7[_0x4b2863];return _0x567d67;};'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('0x8')](_0x7b7e('0x10'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x11')]);router[_0x7b7e('0x8')](_0x7b7e('0x12'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x13')]);router['post']('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x14')]);router['post'](_0x7b7e('0x12'),auth['isAuthenticated'](),controller['setTags']);router[_0x7b7e('0x15')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x16')]);router[_0x7b7e('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x7b7e('0x18')]);module[_0x7b7e('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index a4ee20c..c83aa5f 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 _0x3ba6=['exports','STRING','sequelize'];(function(_0x301efe,_0x338d14){var _0x5d44c3=function(_0x10a315){while(--_0x10a315){_0x301efe['push'](_0x301efe['shift']());}};_0x5d44c3(++_0x338d14);}(_0x3ba6,0x149));var _0x63ba=function(_0x5cc8,_0x1faa02){_0x5cc8=_0x5cc8-0x0;var _0x450661=_0x3ba6[_0x5cc8];return _0x450661;};'use strict';var Sequelize=require(_0x63ba('0x0'));module[_0x63ba('0x1')]={'name':{'type':Sequelize[_0x63ba('0x2')]},'description':{'type':Sequelize[_0x63ba('0x2')]}}; \ No newline at end of file +var _0x834e=['STRING','sequelize','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x834e,0x8e));var _0xe834=function(_0x819e7d,_0x1dd39f){_0x819e7d=_0x819e7d-0x0;var _0x269791=_0x834e[_0x819e7d];return _0x269791;};'use strict';var Sequelize=require(_0xe834('0x0'));module[_0xe834('0x1')]={'name':{'type':Sequelize[_0xe834('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 3e90a0f..f8af930 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 _0xc935=['then','destroy','error','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','catch','create','body','find','params','getFields','findOne','pick','ZendeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update'];(function(_0xc6063,_0x19a7a4){var _0x7e8d5c=function(_0x1d0d77){while(--_0x1d0d77){_0xc6063['push'](_0xc6063['shift']());}};_0x7e8d5c(++_0x19a7a4);}(_0xc935,0x86));var _0x5c93=function(_0x38642c,_0x45a9b6){_0x38642c=_0x38642c-0x0;var _0x1d7856=_0xc935[_0x38642c];return _0x1d7856;};'use strict';var emlformat=require(_0x5c93('0x0'));var rimraf=require(_0x5c93('0x1'));var zipdir=require(_0x5c93('0x2'));var jsonpatch=require(_0x5c93('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5c93('0x4'));var Mustache=require(_0x5c93('0x5'));var util=require(_0x5c93('0x6'));var path=require(_0x5c93('0x7'));var sox=require(_0x5c93('0x8'));var csv=require('to-csv');var ejs=require(_0x5c93('0x9'));var fs=require('fs');var fs_extra=require(_0x5c93('0xa'));var _=require(_0x5c93('0xb'));var squel=require(_0x5c93('0xc'));var crypto=require(_0x5c93('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5c93('0xe'));var toCsv=require(_0x5c93('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5c93('0x10'));var authService=require(_0x5c93('0x11'));var qs=require(_0x5c93('0x12'));var as=require(_0x5c93('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x5c93('0x14'));var config=require(_0x5c93('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x5c93('0x16'))['db'];function respondWithStatusCode(_0x23cd74,_0x5a5cea){_0x5a5cea=_0x5a5cea||0xcc;return function(_0x1cad2e){if(_0x1cad2e){return _0x23cd74[_0x5c93('0x17')](_0x5a5cea);}return _0x23cd74[_0x5c93('0x18')](_0x5a5cea)[_0x5c93('0x19')]();};}function respondWithResult(_0x347e63,_0x8e6005){_0x8e6005=_0x8e6005||0xc8;return function(_0x1b8eb3){if(_0x1b8eb3){return _0x347e63[_0x5c93('0x18')](_0x8e6005)['json'](_0x1b8eb3);}};}function respondWithFilteredResult(_0x1c9a2a,_0x2e4317){return function(_0x2ed860){if(_0x2ed860){var _0x366934=typeof _0x2e4317[_0x5c93('0x1a')]===_0x5c93('0x1b')&&typeof _0x2e4317[_0x5c93('0x1c')]===_0x5c93('0x1b');var _0x201101=_0x2ed860[_0x5c93('0x1d')];var _0x1868c1=_0x366934?0x0:_0x2e4317[_0x5c93('0x1a')];var _0x5aaef1=_0x366934?_0x2ed860['count']:_0x2e4317[_0x5c93('0x1a')]+_0x2e4317[_0x5c93('0x1c')];var _0x4c7ba8;if(_0x5aaef1>=_0x201101){_0x5aaef1=_0x201101;_0x4c7ba8=0xc8;}else{_0x4c7ba8=0xce;}_0x1c9a2a[_0x5c93('0x18')](_0x4c7ba8);return _0x1c9a2a[_0x5c93('0x1e')]('Content-Range',_0x1868c1+'-'+_0x5aaef1+'/'+_0x201101)[_0x5c93('0x1f')](_0x2ed860);}return null;};}function patchUpdates(_0xd121b1){return function(_0x2bcd83){try{jsonpatch[_0x5c93('0x20')](_0x2bcd83,_0xd121b1,!![]);}catch(_0x3fe630){return BPromise[_0x5c93('0x21')](_0x3fe630);}return _0x2bcd83[_0x5c93('0x22')]();};}function saveUpdates(_0x1e2891,_0xbe60c6){return function(_0x4fcff9){if(_0x4fcff9){return _0x4fcff9[_0x5c93('0x23')](_0x1e2891)[_0x5c93('0x24')](function(_0x4f6323){return _0x4f6323;});}return null;};}function removeEntity(_0x34e460,_0x3a971c){return function(_0x4b5a8f){if(_0x4b5a8f){return _0x4b5a8f[_0x5c93('0x25')]()['then'](function(){_0x34e460[_0x5c93('0x18')](0xcc)[_0x5c93('0x19')]();});}};}function handleEntityNotFound(_0x4d53c1,_0x1e2b97){return function(_0x1b57c9){if(!_0x1b57c9){_0x4d53c1[_0x5c93('0x17')](0x194);}return _0x1b57c9;};}function handleError(_0x3d3dda,_0x1cfeef){_0x1cfeef=_0x1cfeef||0x1f4;return function(_0xf76523){logger[_0x5c93('0x26')](_0xf76523['stack']);if(_0xf76523[_0x5c93('0x27')]){delete _0xf76523[_0x5c93('0x27')];}_0x3d3dda[_0x5c93('0x18')](_0x1cfeef)[_0x5c93('0x28')](_0xf76523);};}exports[_0x5c93('0x29')]=function(_0x2a4cef,_0x1df726){var _0x4b6aef={},_0x25ee90={},_0xe11de9={'count':0x0,'rows':[]};var _0xbc966f=_[_0x5c93('0x2a')](db[_0x5c93('0x2b')][_0x5c93('0x2c')],function(_0x5ba338){return{'name':_0x5ba338[_0x5c93('0x2d')],'type':_0x5ba338[_0x5c93('0x2e')][_0x5c93('0x2f')]};});_0x25ee90[_0x5c93('0x30')]=_[_0x5c93('0x2a')](_0xbc966f,_0x5c93('0x27'));_0x25ee90[_0x5c93('0x31')]=_[_0x5c93('0x32')](_0x2a4cef['query']);_0x25ee90['filters']=_[_0x5c93('0x33')](_0x25ee90[_0x5c93('0x30')],_0x25ee90[_0x5c93('0x31')]);_0x4b6aef[_0x5c93('0x34')]=_[_0x5c93('0x33')](_0x25ee90[_0x5c93('0x30')],qs[_0x5c93('0x35')](_0x2a4cef['query']['fields']));_0x4b6aef[_0x5c93('0x34')]=_0x4b6aef[_0x5c93('0x34')][_0x5c93('0x36')]?_0x4b6aef[_0x5c93('0x34')]:_0x25ee90[_0x5c93('0x30')];if(!_0x2a4cef[_0x5c93('0x31')][_0x5c93('0x37')](_0x5c93('0x38'))){_0x4b6aef[_0x5c93('0x1c')]=qs[_0x5c93('0x1c')](_0x2a4cef['query'][_0x5c93('0x1c')]);_0x4b6aef['offset']=qs[_0x5c93('0x1a')](_0x2a4cef[_0x5c93('0x31')]['offset']);}_0x4b6aef[_0x5c93('0x39')]=qs['sort'](_0x2a4cef[_0x5c93('0x31')][_0x5c93('0x3a')]);_0x4b6aef['where']=qs[_0x5c93('0x3b')](_['pick'](_0x2a4cef[_0x5c93('0x31')],_0x25ee90[_0x5c93('0x3b')]),_0xbc966f);if(_0x2a4cef['query'][_0x5c93('0x3c')]){_0x4b6aef[_0x5c93('0x3d')]=_['merge'](_0x4b6aef[_0x5c93('0x3d')],{'$or':_[_0x5c93('0x2a')](_0xbc966f,function(_0x4b0df4){if(_0x4b0df4['type']!==_0x5c93('0x3e')){var _0x266ce4={};_0x266ce4[_0x4b0df4[_0x5c93('0x27')]]={'$like':'%'+_0x2a4cef[_0x5c93('0x31')][_0x5c93('0x3c')]+'%'};return _0x266ce4;}})});}_0x4b6aef=_[_0x5c93('0x3f')]({},_0x4b6aef,_0x2a4cef[_0x5c93('0x40')]);var _0x17423b={'where':_0x4b6aef[_0x5c93('0x3d')]};return db[_0x5c93('0x2b')][_0x5c93('0x1d')](_0x17423b)[_0x5c93('0x24')](function(_0x53603e){_0xe11de9[_0x5c93('0x1d')]=_0x53603e;if(_0x2a4cef['query'][_0x5c93('0x41')]){_0x4b6aef[_0x5c93('0x42')]=[{'all':!![]}];}return db[_0x5c93('0x2b')][_0x5c93('0x43')](_0x4b6aef);})['then'](function(_0x3ff3b1){_0xe11de9[_0x5c93('0x44')]=_0x3ff3b1;return _0xe11de9;})[_0x5c93('0x24')](respondWithFilteredResult(_0x1df726,_0x4b6aef))['catch'](handleError(_0x1df726,null));};exports[_0x5c93('0x45')]=function(_0x7ac9e0,_0x3c61c6){var _0x456103={'raw':![],'where':{'id':_0x7ac9e0['params']['id']}},_0x391f9a={};_0x391f9a[_0x5c93('0x30')]=_['keys'](db['ZendeskConfiguration'][_0x5c93('0x2c')]);_0x391f9a[_0x5c93('0x31')]=_[_0x5c93('0x32')](_0x7ac9e0[_0x5c93('0x31')]);_0x391f9a[_0x5c93('0x3b')]=_[_0x5c93('0x33')](_0x391f9a[_0x5c93('0x30')],_0x391f9a[_0x5c93('0x31')]);_0x456103['attributes']=_[_0x5c93('0x33')](_0x391f9a['model'],qs[_0x5c93('0x35')](_0x7ac9e0[_0x5c93('0x31')]['fields']));_0x456103[_0x5c93('0x34')]=_0x456103['attributes'][_0x5c93('0x36')]?_0x456103[_0x5c93('0x34')]:_0x391f9a['model'];if(_0x7ac9e0[_0x5c93('0x31')]['includeAll']){_0x456103[_0x5c93('0x42')]=[{'all':!![]}];}_0x456103=_['merge']({},_0x456103,_0x7ac9e0['options']);return db[_0x5c93('0x2b')]['find'](_0x456103)[_0x5c93('0x24')](handleEntityNotFound(_0x3c61c6,null))[_0x5c93('0x24')](respondWithResult(_0x3c61c6,null))[_0x5c93('0x46')](handleError(_0x3c61c6,null));};exports['create']=function(_0x50a196,_0x2b82d8){return db[_0x5c93('0x2b')][_0x5c93('0x47')](_0x50a196['body'],{})[_0x5c93('0x24')](respondWithResult(_0x2b82d8,0xc9))[_0x5c93('0x46')](handleError(_0x2b82d8,null));};exports[_0x5c93('0x23')]=function(_0x2f466c,_0x1de6fa){if(_0x2f466c[_0x5c93('0x48')]['id']){delete _0x2f466c['body']['id'];}return db[_0x5c93('0x2b')][_0x5c93('0x49')]({'where':{'id':_0x2f466c[_0x5c93('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1de6fa,null))['then'](saveUpdates(_0x2f466c[_0x5c93('0x48')],null))[_0x5c93('0x24')](respondWithResult(_0x1de6fa,null))[_0x5c93('0x46')](handleError(_0x1de6fa,null));};exports[_0x5c93('0x25')]=function(_0x5dee4e,_0x100c95){return db[_0x5c93('0x2b')]['find']({'where':{'id':_0x5dee4e['params']['id']}})[_0x5c93('0x24')](handleEntityNotFound(_0x100c95,null))[_0x5c93('0x24')](removeEntity(_0x100c95,null))[_0x5c93('0x46')](handleError(_0x100c95,null));};exports[_0x5c93('0x4b')]=function(_0x4c08a0,_0x2b67de,_0x50e9a2){var _0x306b1c={};var _0x8199a1={};var _0xeb880d;var _0x15478f;return db[_0x5c93('0x2b')][_0x5c93('0x4c')]({'where':{'id':_0x4c08a0[_0x5c93('0x4a')]['id']}})[_0x5c93('0x24')](handleEntityNotFound(_0x2b67de,null))[_0x5c93('0x24')](function(_0x3fc3d0){if(_0x3fc3d0){_0xeb880d=_0x3fc3d0;_0x8199a1[_0x5c93('0x30')]=_[_0x5c93('0x32')](db['ZendeskField'][_0x5c93('0x2c')]);_0x8199a1[_0x5c93('0x31')]=_[_0x5c93('0x32')](_0x4c08a0[_0x5c93('0x31')]);_0x8199a1[_0x5c93('0x3b')]=_[_0x5c93('0x33')](_0x8199a1['model'],_0x8199a1['query']);_0x306b1c['attributes']=_[_0x5c93('0x33')](_0x8199a1[_0x5c93('0x30')],qs[_0x5c93('0x35')](_0x4c08a0[_0x5c93('0x31')][_0x5c93('0x35')]));_0x306b1c[_0x5c93('0x34')]=_0x306b1c['attributes'][_0x5c93('0x36')]?_0x306b1c[_0x5c93('0x34')]:_0x8199a1[_0x5c93('0x30')];_0x306b1c['order']=qs[_0x5c93('0x3a')](_0x4c08a0['query'][_0x5c93('0x3a')]);_0x306b1c[_0x5c93('0x3d')]=qs[_0x5c93('0x3b')](_[_0x5c93('0x4d')](_0x4c08a0[_0x5c93('0x31')],_0x8199a1[_0x5c93('0x3b')]));if(_0x4c08a0[_0x5c93('0x31')][_0x5c93('0x3c')]){_0x306b1c[_0x5c93('0x3d')]=_[_0x5c93('0x3f')](_0x306b1c[_0x5c93('0x3d')],{'$or':_[_0x5c93('0x2a')](_0x306b1c['attributes'],function(_0x5ae3b2){var _0x340a99={};_0x340a99[_0x5ae3b2]={'$like':'%'+_0x4c08a0[_0x5c93('0x31')][_0x5c93('0x3c')]+'%'};return _0x340a99;})});}_0x306b1c=_[_0x5c93('0x3f')]({},_0x306b1c,_0x4c08a0[_0x5c93('0x40')]);return _0xeb880d[_0x5c93('0x4b')](_0x306b1c);}})[_0x5c93('0x24')](function(_0x555cf0){if(_0x555cf0){_0x15478f=_0x555cf0['length'];if(!_0x4c08a0[_0x5c93('0x31')][_0x5c93('0x37')](_0x5c93('0x38'))){_0x306b1c[_0x5c93('0x1c')]=qs['limit'](_0x4c08a0['query']['limit']);_0x306b1c[_0x5c93('0x1a')]=qs[_0x5c93('0x1a')](_0x4c08a0[_0x5c93('0x31')][_0x5c93('0x1a')]);}return _0xeb880d[_0x5c93('0x4b')](_0x306b1c);}})['then'](function(_0x26a081){if(_0x26a081){return _0x26a081?{'count':_0x15478f,'rows':_0x26a081}:null;}})[_0x5c93('0x24')](respondWithResult(_0x2b67de,null))['catch'](handleError(_0x2b67de,null));};exports['getSubjects']=function(_0x45e47f,_0x5e6b05,_0x5ec80c){var _0xe16aab={};var _0x191c59={};var _0x21c85a;var _0x50eda0;return db[_0x5c93('0x2b')][_0x5c93('0x4c')]({'where':{'id':_0x45e47f[_0x5c93('0x4a')]['id']}})[_0x5c93('0x24')](handleEntityNotFound(_0x5e6b05,null))[_0x5c93('0x24')](function(_0x58a54e){if(_0x58a54e){_0x21c85a=_0x58a54e;_0x191c59['model']=_['keys'](db[_0x5c93('0x4e')][_0x5c93('0x2c')]);_0x191c59[_0x5c93('0x31')]=_[_0x5c93('0x32')](_0x45e47f[_0x5c93('0x31')]);_0x191c59[_0x5c93('0x3b')]=_[_0x5c93('0x33')](_0x191c59['model'],_0x191c59[_0x5c93('0x31')]);_0xe16aab[_0x5c93('0x34')]=_[_0x5c93('0x33')](_0x191c59[_0x5c93('0x30')],qs[_0x5c93('0x35')](_0x45e47f[_0x5c93('0x31')]['fields']));_0xe16aab[_0x5c93('0x34')]=_0xe16aab[_0x5c93('0x34')]['length']?_0xe16aab[_0x5c93('0x34')]:_0x191c59['model'];_0xe16aab['order']=qs['sort'](_0x45e47f[_0x5c93('0x31')]['sort']);_0xe16aab[_0x5c93('0x3d')]=qs[_0x5c93('0x3b')](_[_0x5c93('0x4d')](_0x45e47f['query'],_0x191c59[_0x5c93('0x3b')]));if(_0x45e47f['query']['filter']){_0xe16aab[_0x5c93('0x3d')]=_[_0x5c93('0x3f')](_0xe16aab[_0x5c93('0x3d')],{'$or':_[_0x5c93('0x2a')](_0xe16aab['attributes'],function(_0x25b102){var _0x50cb8c={};_0x50cb8c[_0x25b102]={'$like':'%'+_0x45e47f[_0x5c93('0x31')][_0x5c93('0x3c')]+'%'};return _0x50cb8c;})});}_0xe16aab=_['merge']({},_0xe16aab,_0x45e47f[_0x5c93('0x40')]);return _0x21c85a[_0x5c93('0x4f')](_0xe16aab);}})[_0x5c93('0x24')](function(_0x5673d9){if(_0x5673d9){_0x50eda0=_0x5673d9['length'];if(!_0x45e47f['query'][_0x5c93('0x37')](_0x5c93('0x38'))){_0xe16aab['limit']=qs['limit'](_0x45e47f['query'][_0x5c93('0x1c')]);_0xe16aab[_0x5c93('0x1a')]=qs['offset'](_0x45e47f['query'][_0x5c93('0x1a')]);}return _0x21c85a[_0x5c93('0x4f')](_0xe16aab);}})['then'](function(_0x6ecc36){if(_0x6ecc36){return _0x6ecc36?{'count':_0x50eda0,'rows':_0x6ecc36}:null;}})[_0x5c93('0x24')](respondWithResult(_0x5e6b05,null))['catch'](handleError(_0x5e6b05,null));};exports['getDescriptions']=function(_0x2115c4,_0x16cc18,_0x726207){var _0x224181={};var _0x181b2b={};var _0x3db44c;var _0x1c5f42;return db[_0x5c93('0x2b')][_0x5c93('0x4c')]({'where':{'id':_0x2115c4[_0x5c93('0x4a')]['id']}})['then'](handleEntityNotFound(_0x16cc18,null))[_0x5c93('0x24')](function(_0x3376a1){if(_0x3376a1){_0x3db44c=_0x3376a1;_0x181b2b[_0x5c93('0x30')]=_['keys'](db[_0x5c93('0x4e')][_0x5c93('0x2c')]);_0x181b2b['query']=_[_0x5c93('0x32')](_0x2115c4['query']);_0x181b2b['filters']=_[_0x5c93('0x33')](_0x181b2b[_0x5c93('0x30')],_0x181b2b[_0x5c93('0x31')]);_0x224181[_0x5c93('0x34')]=_['intersection'](_0x181b2b['model'],qs[_0x5c93('0x35')](_0x2115c4['query'][_0x5c93('0x35')]));_0x224181['attributes']=_0x224181[_0x5c93('0x34')][_0x5c93('0x36')]?_0x224181[_0x5c93('0x34')]:_0x181b2b[_0x5c93('0x30')];_0x224181[_0x5c93('0x39')]=qs['sort'](_0x2115c4[_0x5c93('0x31')][_0x5c93('0x3a')]);_0x224181['where']=qs[_0x5c93('0x3b')](_[_0x5c93('0x4d')](_0x2115c4['query'],_0x181b2b[_0x5c93('0x3b')]));if(_0x2115c4[_0x5c93('0x31')][_0x5c93('0x3c')]){_0x224181['where']=_[_0x5c93('0x3f')](_0x224181[_0x5c93('0x3d')],{'$or':_[_0x5c93('0x2a')](_0x224181[_0x5c93('0x34')],function(_0x5f45cc){var _0x3b5423={};_0x3b5423[_0x5f45cc]={'$like':'%'+_0x2115c4['query']['filter']+'%'};return _0x3b5423;})});}_0x224181=_['merge']({},_0x224181,_0x2115c4[_0x5c93('0x40')]);return _0x3db44c['getDescriptions'](_0x224181);}})[_0x5c93('0x24')](function(_0x2b4590){if(_0x2b4590){_0x1c5f42=_0x2b4590['length'];if(!_0x2115c4[_0x5c93('0x31')]['hasOwnProperty'](_0x5c93('0x38'))){_0x224181['limit']=qs[_0x5c93('0x1c')](_0x2115c4[_0x5c93('0x31')][_0x5c93('0x1c')]);_0x224181[_0x5c93('0x1a')]=qs[_0x5c93('0x1a')](_0x2115c4[_0x5c93('0x31')][_0x5c93('0x1a')]);}return _0x3db44c[_0x5c93('0x50')](_0x224181);}})[_0x5c93('0x24')](function(_0xa898aa){if(_0xa898aa){return _0xa898aa?{'count':_0x1c5f42,'rows':_0xa898aa}:null;}})[_0x5c93('0x24')](respondWithResult(_0x16cc18,null))[_0x5c93('0x46')](handleError(_0x16cc18,null));};exports[_0x5c93('0x51')]=function(_0xed4445,_0x50f6b7,_0x575dea){var _0x15c0d2={};var _0x575844={};var _0x3e9c36;var _0x325ad2;return db[_0x5c93('0x2b')][_0x5c93('0x4c')]({'where':{'id':_0xed4445[_0x5c93('0x4a')]['id']}})[_0x5c93('0x24')](handleEntityNotFound(_0x50f6b7,null))[_0x5c93('0x24')](function(_0x14e2e9){if(_0x14e2e9){_0x3e9c36=_0x14e2e9;_0x575844[_0x5c93('0x30')]=_['keys'](db[_0x5c93('0x52')][_0x5c93('0x2c')]);_0x575844[_0x5c93('0x31')]=_[_0x5c93('0x32')](_0xed4445['query']);_0x575844[_0x5c93('0x3b')]=_['intersection'](_0x575844[_0x5c93('0x30')],_0x575844[_0x5c93('0x31')]);_0x15c0d2[_0x5c93('0x34')]=_['intersection'](_0x575844[_0x5c93('0x30')],qs[_0x5c93('0x35')](_0xed4445[_0x5c93('0x31')][_0x5c93('0x35')]));_0x15c0d2[_0x5c93('0x34')]=_0x15c0d2[_0x5c93('0x34')]['length']?_0x15c0d2[_0x5c93('0x34')]:_0x575844[_0x5c93('0x30')];_0x15c0d2[_0x5c93('0x39')]=qs[_0x5c93('0x3a')](_0xed4445[_0x5c93('0x31')][_0x5c93('0x3a')]);_0x15c0d2[_0x5c93('0x3d')]=qs[_0x5c93('0x3b')](_[_0x5c93('0x4d')](_0xed4445['query'],_0x575844[_0x5c93('0x3b')]));if(_0xed4445[_0x5c93('0x31')]['filter']){_0x15c0d2[_0x5c93('0x3d')]=_['merge'](_0x15c0d2[_0x5c93('0x3d')],{'$or':_[_0x5c93('0x2a')](_0x15c0d2[_0x5c93('0x34')],function(_0x283073){var _0x17cf72={};_0x17cf72[_0x283073]={'$like':'%'+_0xed4445[_0x5c93('0x31')][_0x5c93('0x3c')]+'%'};return _0x17cf72;})});}_0x15c0d2=_['merge']({},_0x15c0d2,_0xed4445[_0x5c93('0x40')]);return _0x3e9c36[_0x5c93('0x51')](_0x15c0d2);}})[_0x5c93('0x24')](function(_0x399c4d){if(_0x399c4d){_0x325ad2=_0x399c4d[_0x5c93('0x36')];if(!_0xed4445['query']['hasOwnProperty'](_0x5c93('0x38'))){_0x15c0d2[_0x5c93('0x1c')]=qs[_0x5c93('0x1c')](_0xed4445[_0x5c93('0x31')][_0x5c93('0x1c')]);_0x15c0d2[_0x5c93('0x1a')]=qs['offset'](_0xed4445[_0x5c93('0x31')]['offset']);}return _0x3e9c36[_0x5c93('0x51')](_0x15c0d2);}})[_0x5c93('0x24')](function(_0x6f35a6){if(_0x6f35a6){return _0x6f35a6?{'count':_0x325ad2,'rows':_0x6f35a6}:null;}})[_0x5c93('0x24')](respondWithResult(_0x50f6b7,null))['catch'](handleError(_0x50f6b7,null));};exports['setTags']=function(_0x2ad357,_0x5ba459,_0x5e1728){if(_0x2ad357[_0x5c93('0x48')]['id']){delete _0x2ad357[_0x5c93('0x48')]['id'];}return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x2ad357['params']['id']}})[_0x5c93('0x24')](handleEntityNotFound(_0x5ba459,null))[_0x5c93('0x24')](function(_0x4ee3d2){if(_0x4ee3d2){return _0x4ee3d2[_0x5c93('0x53')](_0x2ad357[_0x5c93('0x48')][_0x5c93('0x54')]||[]);}return null;})['then'](respondWithResult(_0x5ba459,null))[_0x5c93('0x46')](handleError(_0x5ba459,null));}; \ No newline at end of file +var _0xce97=['rawAttributes','fieldName','type','key','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','options','ZendeskConfiguration','include','findAll','rows','catch','show','create','body','find','params','destroy','getFields','findOne','ZendeskField','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','crypto','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','json','limit','undefined','count','offset','Content-Range','reject','save','update','then','end','error','send','map'];(function(_0x5a2978,_0x393b69){var _0x46c12a=function(_0xf302af){while(--_0xf302af){_0x5a2978['push'](_0x5a2978['shift']());}};_0x46c12a(++_0x393b69);}(_0xce97,0x77));var _0x7ce9=function(_0x181fe0,_0x4eb93a){_0x181fe0=_0x181fe0-0x0;var _0x12e9c1=_0xce97[_0x181fe0];return _0x12e9c1;};'use strict';var emlformat=require(_0x7ce9('0x0'));var rimraf=require(_0x7ce9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7ce9('0x2'));var rp=require('request-promise');var moment=require(_0x7ce9('0x3'));var BPromise=require(_0x7ce9('0x4'));var Mustache=require(_0x7ce9('0x5'));var util=require('util');var path=require(_0x7ce9('0x6'));var sox=require(_0x7ce9('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x7ce9('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x7ce9('0x9'));var toCsv=require('to-csv');var querystring=require(_0x7ce9('0xa'));var Papa=require(_0x7ce9('0xb'));var Redis=require(_0x7ce9('0xc'));var authService=require(_0x7ce9('0xd'));var qs=require(_0x7ce9('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7ce9('0xf'));var logger=require(_0x7ce9('0x10'))('api');var utils=require(_0x7ce9('0x11'));var config=require(_0x7ce9('0x12'));var licenseUtil=require(_0x7ce9('0x13'));var db=require(_0x7ce9('0x14'))['db'];function respondWithStatusCode(_0x49d425,_0x4b3e4e){_0x4b3e4e=_0x4b3e4e||0xcc;return function(_0x45e1d2){if(_0x45e1d2){return _0x49d425[_0x7ce9('0x15')](_0x4b3e4e);}return _0x49d425[_0x7ce9('0x16')](_0x4b3e4e)['end']();};}function respondWithResult(_0x1d9fdd,_0x3da12a){_0x3da12a=_0x3da12a||0xc8;return function(_0x4b375a){if(_0x4b375a){return _0x1d9fdd[_0x7ce9('0x16')](_0x3da12a)[_0x7ce9('0x17')](_0x4b375a);}};}function respondWithFilteredResult(_0x2ad7be,_0x292e9e){return function(_0x541ac2){if(_0x541ac2){var _0x22dfec=typeof _0x292e9e['offset']==='undefined'&&typeof _0x292e9e[_0x7ce9('0x18')]===_0x7ce9('0x19');var _0x4bc01c=_0x541ac2['count'];var _0x7609a5=_0x22dfec?0x0:_0x292e9e['offset'];var _0x193179=_0x22dfec?_0x541ac2[_0x7ce9('0x1a')]:_0x292e9e[_0x7ce9('0x1b')]+_0x292e9e['limit'];var _0x44dfa8;if(_0x193179>=_0x4bc01c){_0x193179=_0x4bc01c;_0x44dfa8=0xc8;}else{_0x44dfa8=0xce;}_0x2ad7be['status'](_0x44dfa8);return _0x2ad7be['set'](_0x7ce9('0x1c'),_0x7609a5+'-'+_0x193179+'/'+_0x4bc01c)[_0x7ce9('0x17')](_0x541ac2);}return null;};}function patchUpdates(_0x551f05){return function(_0x135855){try{jsonpatch['apply'](_0x135855,_0x551f05,!![]);}catch(_0xf7c38f){return BPromise[_0x7ce9('0x1d')](_0xf7c38f);}return _0x135855[_0x7ce9('0x1e')]();};}function saveUpdates(_0x54a862,_0x2fabcc){return function(_0x302986){if(_0x302986){return _0x302986[_0x7ce9('0x1f')](_0x54a862)['then'](function(_0x41bdf7){return _0x41bdf7;});}return null;};}function removeEntity(_0x2d471d,_0x36746f){return function(_0x52b6a6){if(_0x52b6a6){return _0x52b6a6['destroy']()[_0x7ce9('0x20')](function(){_0x2d471d['status'](0xcc)[_0x7ce9('0x21')]();});}};}function handleEntityNotFound(_0x34389f,_0x529406){return function(_0x4104f5){if(!_0x4104f5){_0x34389f['sendStatus'](0x194);}return _0x4104f5;};}function handleError(_0x37d4e0,_0x8024d0){_0x8024d0=_0x8024d0||0x1f4;return function(_0x21f210){logger[_0x7ce9('0x22')](_0x21f210['stack']);if(_0x21f210['name']){delete _0x21f210['name'];}_0x37d4e0[_0x7ce9('0x16')](_0x8024d0)[_0x7ce9('0x23')](_0x21f210);};}exports['index']=function(_0x16bf95,_0x42df0e){var _0x2e6d78={},_0x23dad6={},_0x3f37d0={'count':0x0,'rows':[]};var _0x25d9c2=_[_0x7ce9('0x24')](db['ZendeskConfiguration'][_0x7ce9('0x25')],function(_0x5a0560){return{'name':_0x5a0560[_0x7ce9('0x26')],'type':_0x5a0560[_0x7ce9('0x27')][_0x7ce9('0x28')]};});_0x23dad6['model']=_[_0x7ce9('0x24')](_0x25d9c2,_0x7ce9('0x29'));_0x23dad6[_0x7ce9('0x2a')]=_[_0x7ce9('0x2b')](_0x16bf95['query']);_0x23dad6[_0x7ce9('0x2c')]=_[_0x7ce9('0x2d')](_0x23dad6[_0x7ce9('0x2e')],_0x23dad6[_0x7ce9('0x2a')]);_0x2e6d78[_0x7ce9('0x2f')]=_[_0x7ce9('0x2d')](_0x23dad6[_0x7ce9('0x2e')],qs[_0x7ce9('0x30')](_0x16bf95['query'][_0x7ce9('0x30')]));_0x2e6d78[_0x7ce9('0x2f')]=_0x2e6d78[_0x7ce9('0x2f')][_0x7ce9('0x31')]?_0x2e6d78[_0x7ce9('0x2f')]:_0x23dad6['model'];if(!_0x16bf95[_0x7ce9('0x2a')][_0x7ce9('0x32')](_0x7ce9('0x33'))){_0x2e6d78['limit']=qs[_0x7ce9('0x18')](_0x16bf95[_0x7ce9('0x2a')][_0x7ce9('0x18')]);_0x2e6d78[_0x7ce9('0x1b')]=qs[_0x7ce9('0x1b')](_0x16bf95[_0x7ce9('0x2a')][_0x7ce9('0x1b')]);}_0x2e6d78[_0x7ce9('0x34')]=qs[_0x7ce9('0x35')](_0x16bf95[_0x7ce9('0x2a')][_0x7ce9('0x35')]);_0x2e6d78['where']=qs[_0x7ce9('0x2c')](_[_0x7ce9('0x36')](_0x16bf95['query'],_0x23dad6[_0x7ce9('0x2c')]),_0x25d9c2);if(_0x16bf95['query'][_0x7ce9('0x37')]){_0x2e6d78['where']=_[_0x7ce9('0x38')](_0x2e6d78[_0x7ce9('0x39')],{'$or':_[_0x7ce9('0x24')](_0x25d9c2,function(_0x53631d){if(_0x53631d[_0x7ce9('0x27')]!=='VIRTUAL'){var _0x3bba34={};_0x3bba34[_0x53631d[_0x7ce9('0x29')]]={'$like':'%'+_0x16bf95[_0x7ce9('0x2a')][_0x7ce9('0x37')]+'%'};return _0x3bba34;}})});}_0x2e6d78=_[_0x7ce9('0x38')]({},_0x2e6d78,_0x16bf95[_0x7ce9('0x3a')]);var _0x4510d5={'where':_0x2e6d78[_0x7ce9('0x39')]};return db[_0x7ce9('0x3b')][_0x7ce9('0x1a')](_0x4510d5)[_0x7ce9('0x20')](function(_0x14cf41){_0x3f37d0['count']=_0x14cf41;if(_0x16bf95[_0x7ce9('0x2a')]['includeAll']){_0x2e6d78[_0x7ce9('0x3c')]=[{'all':!![]}];}return db[_0x7ce9('0x3b')][_0x7ce9('0x3d')](_0x2e6d78);})[_0x7ce9('0x20')](function(_0x2a9b79){_0x3f37d0[_0x7ce9('0x3e')]=_0x2a9b79;return _0x3f37d0;})[_0x7ce9('0x20')](respondWithFilteredResult(_0x42df0e,_0x2e6d78))[_0x7ce9('0x3f')](handleError(_0x42df0e,null));};exports[_0x7ce9('0x40')]=function(_0x531e5e,_0x232554){var _0x151176={'raw':![],'where':{'id':_0x531e5e['params']['id']}},_0x5dabf0={};_0x5dabf0[_0x7ce9('0x2e')]=_[_0x7ce9('0x2b')](db['ZendeskConfiguration'][_0x7ce9('0x25')]);_0x5dabf0[_0x7ce9('0x2a')]=_['keys'](_0x531e5e[_0x7ce9('0x2a')]);_0x5dabf0[_0x7ce9('0x2c')]=_[_0x7ce9('0x2d')](_0x5dabf0[_0x7ce9('0x2e')],_0x5dabf0[_0x7ce9('0x2a')]);_0x151176[_0x7ce9('0x2f')]=_[_0x7ce9('0x2d')](_0x5dabf0[_0x7ce9('0x2e')],qs[_0x7ce9('0x30')](_0x531e5e[_0x7ce9('0x2a')][_0x7ce9('0x30')]));_0x151176[_0x7ce9('0x2f')]=_0x151176[_0x7ce9('0x2f')][_0x7ce9('0x31')]?_0x151176[_0x7ce9('0x2f')]:_0x5dabf0['model'];if(_0x531e5e[_0x7ce9('0x2a')]['includeAll']){_0x151176[_0x7ce9('0x3c')]=[{'all':!![]}];}_0x151176=_[_0x7ce9('0x38')]({},_0x151176,_0x531e5e[_0x7ce9('0x3a')]);return db['ZendeskConfiguration']['find'](_0x151176)[_0x7ce9('0x20')](handleEntityNotFound(_0x232554,null))[_0x7ce9('0x20')](respondWithResult(_0x232554,null))['catch'](handleError(_0x232554,null));};exports[_0x7ce9('0x41')]=function(_0x1eb6ef,_0xbe6355){return db['ZendeskConfiguration'][_0x7ce9('0x41')](_0x1eb6ef[_0x7ce9('0x42')],{})[_0x7ce9('0x20')](respondWithResult(_0xbe6355,0xc9))[_0x7ce9('0x3f')](handleError(_0xbe6355,null));};exports['update']=function(_0x2249a4,_0x2f929f){if(_0x2249a4[_0x7ce9('0x42')]['id']){delete _0x2249a4[_0x7ce9('0x42')]['id'];}return db[_0x7ce9('0x3b')][_0x7ce9('0x43')]({'where':{'id':_0x2249a4[_0x7ce9('0x44')]['id']}})[_0x7ce9('0x20')](handleEntityNotFound(_0x2f929f,null))['then'](saveUpdates(_0x2249a4[_0x7ce9('0x42')],null))[_0x7ce9('0x20')](respondWithResult(_0x2f929f,null))['catch'](handleError(_0x2f929f,null));};exports[_0x7ce9('0x45')]=function(_0x1d5900,_0x48884e){return db[_0x7ce9('0x3b')][_0x7ce9('0x43')]({'where':{'id':_0x1d5900[_0x7ce9('0x44')]['id']}})[_0x7ce9('0x20')](handleEntityNotFound(_0x48884e,null))[_0x7ce9('0x20')](removeEntity(_0x48884e,null))['catch'](handleError(_0x48884e,null));};exports[_0x7ce9('0x46')]=function(_0x222e15,_0x165db4,_0x534f0e){var _0x54dd14={};var _0xe3d211={};var _0x34b078;var _0x26895e;return db[_0x7ce9('0x3b')][_0x7ce9('0x47')]({'where':{'id':_0x222e15['params']['id']}})['then'](handleEntityNotFound(_0x165db4,null))['then'](function(_0x84808c){if(_0x84808c){_0x34b078=_0x84808c;_0xe3d211[_0x7ce9('0x2e')]=_[_0x7ce9('0x2b')](db[_0x7ce9('0x48')][_0x7ce9('0x25')]);_0xe3d211['query']=_[_0x7ce9('0x2b')](_0x222e15[_0x7ce9('0x2a')]);_0xe3d211[_0x7ce9('0x2c')]=_[_0x7ce9('0x2d')](_0xe3d211['model'],_0xe3d211[_0x7ce9('0x2a')]);_0x54dd14[_0x7ce9('0x2f')]=_[_0x7ce9('0x2d')](_0xe3d211[_0x7ce9('0x2e')],qs[_0x7ce9('0x30')](_0x222e15[_0x7ce9('0x2a')]['fields']));_0x54dd14['attributes']=_0x54dd14['attributes'][_0x7ce9('0x31')]?_0x54dd14[_0x7ce9('0x2f')]:_0xe3d211[_0x7ce9('0x2e')];_0x54dd14[_0x7ce9('0x34')]=qs['sort'](_0x222e15[_0x7ce9('0x2a')][_0x7ce9('0x35')]);_0x54dd14[_0x7ce9('0x39')]=qs[_0x7ce9('0x2c')](_[_0x7ce9('0x36')](_0x222e15[_0x7ce9('0x2a')],_0xe3d211[_0x7ce9('0x2c')]));if(_0x222e15[_0x7ce9('0x2a')][_0x7ce9('0x37')]){_0x54dd14['where']=_[_0x7ce9('0x38')](_0x54dd14['where'],{'$or':_[_0x7ce9('0x24')](_0x54dd14[_0x7ce9('0x2f')],function(_0x348ecc){var _0x5bbf09={};_0x5bbf09[_0x348ecc]={'$like':'%'+_0x222e15[_0x7ce9('0x2a')][_0x7ce9('0x37')]+'%'};return _0x5bbf09;})});}_0x54dd14=_[_0x7ce9('0x38')]({},_0x54dd14,_0x222e15['options']);return _0x34b078['getFields'](_0x54dd14);}})[_0x7ce9('0x20')](function(_0x366d52){if(_0x366d52){_0x26895e=_0x366d52[_0x7ce9('0x31')];if(!_0x222e15['query']['hasOwnProperty'](_0x7ce9('0x33'))){_0x54dd14[_0x7ce9('0x18')]=qs[_0x7ce9('0x18')](_0x222e15[_0x7ce9('0x2a')][_0x7ce9('0x18')]);_0x54dd14['offset']=qs['offset'](_0x222e15[_0x7ce9('0x2a')]['offset']);}return _0x34b078[_0x7ce9('0x46')](_0x54dd14);}})[_0x7ce9('0x20')](function(_0x533d3f){if(_0x533d3f){return _0x533d3f?{'count':_0x26895e,'rows':_0x533d3f}:null;}})[_0x7ce9('0x20')](respondWithResult(_0x165db4,null))[_0x7ce9('0x3f')](handleError(_0x165db4,null));};exports['getSubjects']=function(_0x161db8,_0x832db7,_0x17469e){var _0xc0e891={};var _0x467f5b={};var _0x56f664;var _0x507f28;return db[_0x7ce9('0x3b')][_0x7ce9('0x47')]({'where':{'id':_0x161db8[_0x7ce9('0x44')]['id']}})[_0x7ce9('0x20')](handleEntityNotFound(_0x832db7,null))[_0x7ce9('0x20')](function(_0x5badf6){if(_0x5badf6){_0x56f664=_0x5badf6;_0x467f5b[_0x7ce9('0x2e')]=_[_0x7ce9('0x2b')](db[_0x7ce9('0x48')]['rawAttributes']);_0x467f5b[_0x7ce9('0x2a')]=_[_0x7ce9('0x2b')](_0x161db8[_0x7ce9('0x2a')]);_0x467f5b[_0x7ce9('0x2c')]=_[_0x7ce9('0x2d')](_0x467f5b['model'],_0x467f5b[_0x7ce9('0x2a')]);_0xc0e891[_0x7ce9('0x2f')]=_[_0x7ce9('0x2d')](_0x467f5b[_0x7ce9('0x2e')],qs[_0x7ce9('0x30')](_0x161db8[_0x7ce9('0x2a')][_0x7ce9('0x30')]));_0xc0e891[_0x7ce9('0x2f')]=_0xc0e891[_0x7ce9('0x2f')][_0x7ce9('0x31')]?_0xc0e891['attributes']:_0x467f5b[_0x7ce9('0x2e')];_0xc0e891[_0x7ce9('0x34')]=qs[_0x7ce9('0x35')](_0x161db8[_0x7ce9('0x2a')][_0x7ce9('0x35')]);_0xc0e891['where']=qs[_0x7ce9('0x2c')](_[_0x7ce9('0x36')](_0x161db8[_0x7ce9('0x2a')],_0x467f5b[_0x7ce9('0x2c')]));if(_0x161db8[_0x7ce9('0x2a')][_0x7ce9('0x37')]){_0xc0e891[_0x7ce9('0x39')]=_[_0x7ce9('0x38')](_0xc0e891[_0x7ce9('0x39')],{'$or':_[_0x7ce9('0x24')](_0xc0e891[_0x7ce9('0x2f')],function(_0x12b000){var _0x55046f={};_0x55046f[_0x12b000]={'$like':'%'+_0x161db8[_0x7ce9('0x2a')][_0x7ce9('0x37')]+'%'};return _0x55046f;})});}_0xc0e891=_['merge']({},_0xc0e891,_0x161db8['options']);return _0x56f664[_0x7ce9('0x49')](_0xc0e891);}})[_0x7ce9('0x20')](function(_0xbd7f28){if(_0xbd7f28){_0x507f28=_0xbd7f28[_0x7ce9('0x31')];if(!_0x161db8['query']['hasOwnProperty'](_0x7ce9('0x33'))){_0xc0e891[_0x7ce9('0x18')]=qs[_0x7ce9('0x18')](_0x161db8[_0x7ce9('0x2a')][_0x7ce9('0x18')]);_0xc0e891[_0x7ce9('0x1b')]=qs[_0x7ce9('0x1b')](_0x161db8['query']['offset']);}return _0x56f664[_0x7ce9('0x49')](_0xc0e891);}})[_0x7ce9('0x20')](function(_0x2d93db){if(_0x2d93db){return _0x2d93db?{'count':_0x507f28,'rows':_0x2d93db}:null;}})[_0x7ce9('0x20')](respondWithResult(_0x832db7,null))[_0x7ce9('0x3f')](handleError(_0x832db7,null));};exports[_0x7ce9('0x4a')]=function(_0x298713,_0x596597,_0x2677ae){var _0x58483f={};var _0x5c4584={};var _0x140b61;var _0x23e7a3;return db[_0x7ce9('0x3b')]['findOne']({'where':{'id':_0x298713[_0x7ce9('0x44')]['id']}})[_0x7ce9('0x20')](handleEntityNotFound(_0x596597,null))[_0x7ce9('0x20')](function(_0x45db0b){if(_0x45db0b){_0x140b61=_0x45db0b;_0x5c4584['model']=_[_0x7ce9('0x2b')](db[_0x7ce9('0x48')][_0x7ce9('0x25')]);_0x5c4584['query']=_[_0x7ce9('0x2b')](_0x298713['query']);_0x5c4584[_0x7ce9('0x2c')]=_[_0x7ce9('0x2d')](_0x5c4584[_0x7ce9('0x2e')],_0x5c4584[_0x7ce9('0x2a')]);_0x58483f[_0x7ce9('0x2f')]=_[_0x7ce9('0x2d')](_0x5c4584['model'],qs[_0x7ce9('0x30')](_0x298713[_0x7ce9('0x2a')][_0x7ce9('0x30')]));_0x58483f['attributes']=_0x58483f[_0x7ce9('0x2f')][_0x7ce9('0x31')]?_0x58483f['attributes']:_0x5c4584[_0x7ce9('0x2e')];_0x58483f['order']=qs[_0x7ce9('0x35')](_0x298713[_0x7ce9('0x2a')][_0x7ce9('0x35')]);_0x58483f['where']=qs[_0x7ce9('0x2c')](_['pick'](_0x298713[_0x7ce9('0x2a')],_0x5c4584[_0x7ce9('0x2c')]));if(_0x298713[_0x7ce9('0x2a')]['filter']){_0x58483f['where']=_[_0x7ce9('0x38')](_0x58483f['where'],{'$or':_[_0x7ce9('0x24')](_0x58483f[_0x7ce9('0x2f')],function(_0x2bd346){var _0xb9744b={};_0xb9744b[_0x2bd346]={'$like':'%'+_0x298713[_0x7ce9('0x2a')][_0x7ce9('0x37')]+'%'};return _0xb9744b;})});}_0x58483f=_['merge']({},_0x58483f,_0x298713['options']);return _0x140b61[_0x7ce9('0x4a')](_0x58483f);}})[_0x7ce9('0x20')](function(_0x305c0a){if(_0x305c0a){_0x23e7a3=_0x305c0a['length'];if(!_0x298713['query']['hasOwnProperty'](_0x7ce9('0x33'))){_0x58483f[_0x7ce9('0x18')]=qs[_0x7ce9('0x18')](_0x298713[_0x7ce9('0x2a')][_0x7ce9('0x18')]);_0x58483f[_0x7ce9('0x1b')]=qs[_0x7ce9('0x1b')](_0x298713[_0x7ce9('0x2a')][_0x7ce9('0x1b')]);}return _0x140b61[_0x7ce9('0x4a')](_0x58483f);}})['then'](function(_0xcdec95){if(_0xcdec95){return _0xcdec95?{'count':_0x23e7a3,'rows':_0xcdec95}:null;}})[_0x7ce9('0x20')](respondWithResult(_0x596597,null))[_0x7ce9('0x3f')](handleError(_0x596597,null));};exports[_0x7ce9('0x4b')]=function(_0x3a092a,_0x4f9663,_0x4f128e){var _0x343bdd={};var _0x18774b={};var _0x4c45a9;var _0x9ddf26;return db['ZendeskConfiguration'][_0x7ce9('0x47')]({'where':{'id':_0x3a092a[_0x7ce9('0x44')]['id']}})['then'](handleEntityNotFound(_0x4f9663,null))[_0x7ce9('0x20')](function(_0x2a8662){if(_0x2a8662){_0x4c45a9=_0x2a8662;_0x18774b[_0x7ce9('0x2e')]=_[_0x7ce9('0x2b')](db[_0x7ce9('0x4c')]['rawAttributes']);_0x18774b['query']=_[_0x7ce9('0x2b')](_0x3a092a[_0x7ce9('0x2a')]);_0x18774b[_0x7ce9('0x2c')]=_['intersection'](_0x18774b['model'],_0x18774b[_0x7ce9('0x2a')]);_0x343bdd[_0x7ce9('0x2f')]=_[_0x7ce9('0x2d')](_0x18774b[_0x7ce9('0x2e')],qs[_0x7ce9('0x30')](_0x3a092a['query'][_0x7ce9('0x30')]));_0x343bdd[_0x7ce9('0x2f')]=_0x343bdd[_0x7ce9('0x2f')][_0x7ce9('0x31')]?_0x343bdd[_0x7ce9('0x2f')]:_0x18774b[_0x7ce9('0x2e')];_0x343bdd[_0x7ce9('0x34')]=qs[_0x7ce9('0x35')](_0x3a092a[_0x7ce9('0x2a')][_0x7ce9('0x35')]);_0x343bdd[_0x7ce9('0x39')]=qs[_0x7ce9('0x2c')](_['pick'](_0x3a092a[_0x7ce9('0x2a')],_0x18774b[_0x7ce9('0x2c')]));if(_0x3a092a[_0x7ce9('0x2a')][_0x7ce9('0x37')]){_0x343bdd[_0x7ce9('0x39')]=_[_0x7ce9('0x38')](_0x343bdd[_0x7ce9('0x39')],{'$or':_[_0x7ce9('0x24')](_0x343bdd[_0x7ce9('0x2f')],function(_0x207d32){var _0xaf933b={};_0xaf933b[_0x207d32]={'$like':'%'+_0x3a092a[_0x7ce9('0x2a')]['filter']+'%'};return _0xaf933b;})});}_0x343bdd=_[_0x7ce9('0x38')]({},_0x343bdd,_0x3a092a[_0x7ce9('0x3a')]);return _0x4c45a9[_0x7ce9('0x4b')](_0x343bdd);}})[_0x7ce9('0x20')](function(_0x442b7c){if(_0x442b7c){_0x9ddf26=_0x442b7c['length'];if(!_0x3a092a[_0x7ce9('0x2a')][_0x7ce9('0x32')](_0x7ce9('0x33'))){_0x343bdd['limit']=qs[_0x7ce9('0x18')](_0x3a092a['query'][_0x7ce9('0x18')]);_0x343bdd[_0x7ce9('0x1b')]=qs[_0x7ce9('0x1b')](_0x3a092a[_0x7ce9('0x2a')]['offset']);}return _0x4c45a9[_0x7ce9('0x4b')](_0x343bdd);}})[_0x7ce9('0x20')](function(_0x15421e){if(_0x15421e){return _0x15421e?{'count':_0x9ddf26,'rows':_0x15421e}:null;}})['then'](respondWithResult(_0x4f9663,null))['catch'](handleError(_0x4f9663,null));};exports[_0x7ce9('0x4d')]=function(_0x247ae2,_0x3974ad,_0xf17ac){if(_0x247ae2[_0x7ce9('0x42')]['id']){delete _0x247ae2[_0x7ce9('0x42')]['id'];}return db[_0x7ce9('0x3b')][_0x7ce9('0x47')]({'where':{'id':_0x247ae2[_0x7ce9('0x44')]['id']}})[_0x7ce9('0x20')](handleEntityNotFound(_0x3974ad,null))[_0x7ce9('0x20')](function(_0x5ec36c){if(_0x5ec36c){return _0x5ec36c['setTags'](_0x247ae2['body']['ids']||[]);}return null;})[_0x7ce9('0x20')](respondWithResult(_0x3974ad,null))[_0x7ce9('0x3f')](handleError(_0x3974ad,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 1c982b7..528f0dc 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 _0xcf66=['exports','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment'];(function(_0x41b84d,_0x27eae4){var _0x11a430=function(_0x530db9){while(--_0x530db9){_0x41b84d['push'](_0x41b84d['shift']());}};_0x11a430(++_0x27eae4);}(_0xcf66,0x71));var _0x6cf6=function(_0x33c4e0,_0x1a2316){_0x33c4e0=_0x33c4e0-0x0;var _0x538f7f=_0xcf66[_0x33c4e0];return _0x538f7f;};'use strict';var _=require(_0x6cf6('0x0'));var util=require(_0x6cf6('0x1'));var logger=require(_0x6cf6('0x2'))('api');var moment=require(_0x6cf6('0x3'));var BPromise=require(_0x6cf6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6cf6('0x5'));var config=require(_0x6cf6('0x6'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x6cf6('0x7')]=function(_0x1fbedd,_0x2a573e){return _0x1fbedd['define'](_0x6cf6('0x8'),attributes,{'tableName':_0x6cf6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfcbb=['rimraf','../../config/environment','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x2601a5,_0x13d4bd){var _0x10e22a=function(_0x1e09c3){while(--_0x1e09c3){_0x2601a5['push'](_0x2601a5['shift']());}};_0x10e22a(++_0x13d4bd);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x3d2673,_0x780770){_0x3d2673=_0x3d2673-0x0;var _0x2a17b9=_0xfcbb[_0x3d2673];return _0x2a17b9;};'use strict';var _=require(_0xbfcb('0x0'));var util=require(_0xbfcb('0x1'));var logger=require(_0xbfcb('0x2'))('api');var moment=require('moment');var BPromise=require(_0xbfcb('0x3'));var rp=require(_0xbfcb('0x4'));var fs=require('fs');var path=require(_0xbfcb('0x5'));var rimraf=require(_0xbfcb('0x6'));var config=require(_0xbfcb('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module['exports']=function(_0x32c2aa,_0x4990c){return _0x32c2aa[_0xbfcb('0x8')](_0xbfcb('0x9'),attributes,{'tableName':_0xbfcb('0xa'),'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 cd7eb00..3134230 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 _0x3e1c=['request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x3d54fa,_0x2233ab){var _0x558c68=function(_0x3f8298){while(--_0x3f8298){_0x3d54fa['push'](_0x3d54fa['shift']());}};_0x558c68(++_0x2233ab);}(_0x3e1c,0x109));var _0xc3e1=function(_0x277837,_0x507214){_0x277837=_0x277837-0x0;var _0x1839aa=_0x3e1c[_0x277837];return _0x1839aa;};'use strict';var _=require(_0xc3e1('0x0'));var util=require('util');var moment=require(_0xc3e1('0x1'));var BPromise=require(_0xc3e1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc3e1('0x3'));var db=require(_0xc3e1('0x4'))['db'];var utils=require(_0xc3e1('0x5'));var logger=require(_0xc3e1('0x6'))(_0xc3e1('0x7'));var config=require('../../config/environment');var jayson=require(_0xc3e1('0x8'));var client=jayson[_0xc3e1('0x9')][_0xc3e1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32517f,_0x2a4e9a,_0x275bf6){return new BPromise(function(_0x392152,_0x3870c6){return client[_0xc3e1('0xb')](_0x32517f,_0x275bf6)[_0xc3e1('0xc')](function(_0x35bccb){logger[_0xc3e1('0xd')](_0xc3e1('0xe'),_0x2a4e9a,_0xc3e1('0xf'));logger['debug'](_0xc3e1('0x10'),_0x2a4e9a,_0xc3e1('0xf'),JSON[_0xc3e1('0x11')](_0x35bccb));if(_0x35bccb[_0xc3e1('0x12')]){if(_0x35bccb[_0xc3e1('0x12')][_0xc3e1('0x13')]===0x1f4){logger[_0xc3e1('0x12')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2a4e9a,_0x35bccb[_0xc3e1('0x12')][_0xc3e1('0x14')]);return _0x3870c6(_0x35bccb['error']['message']);}logger[_0xc3e1('0x12')](_0xc3e1('0xe'),_0x2a4e9a,_0x35bccb[_0xc3e1('0x12')][_0xc3e1('0x14')]);return _0x392152(_0x35bccb[_0xc3e1('0x12')][_0xc3e1('0x14')]);}else{logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x2a4e9a,_0xc3e1('0xf'));_0x392152(_0x35bccb[_0xc3e1('0x15')][_0xc3e1('0x14')]);}})[_0xc3e1('0x16')](function(_0x5f52f9){logger[_0xc3e1('0x12')](_0xc3e1('0xe'),_0x2a4e9a,_0x5f52f9);_0x3870c6(_0x5f52f9);});});} \ No newline at end of file +var _0x2d6f=['ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then'];(function(_0x565952,_0x18d8cf){var _0xecc11e=function(_0x6599e3){while(--_0x6599e3){_0x565952['push'](_0x565952['shift']());}};_0xecc11e(++_0x18d8cf);}(_0x2d6f,0xe5));var _0xf2d6=function(_0x1897c0,_0x3b341d){_0x1897c0=_0x1897c0-0x0;var _0x249336=_0x2d6f[_0x1897c0];return _0x249336;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xf2d6('0x0'));var rs=require(_0xf2d6('0x1'));var fs=require('fs');var Redis=require(_0xf2d6('0x2'));var db=require(_0xf2d6('0x3'))['db'];var utils=require(_0xf2d6('0x4'));var logger=require(_0xf2d6('0x5'))(_0xf2d6('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf2d6('0x7')][_0xf2d6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x582da0,_0x12a610,_0x2d564e){return new BPromise(function(_0x35b760,_0x3bdb32){return client[_0xf2d6('0x9')](_0x582da0,_0x2d564e)[_0xf2d6('0xa')](function(_0x349683){logger['info'](_0xf2d6('0xb'),_0x12a610,'request\x20sent');logger['debug']('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x12a610,_0xf2d6('0xc'),JSON[_0xf2d6('0xd')](_0x349683));if(_0x349683[_0xf2d6('0xe')]){if(_0x349683[_0xf2d6('0xe')][_0xf2d6('0xf')]===0x1f4){logger['error'](_0xf2d6('0xb'),_0x12a610,_0x349683[_0xf2d6('0xe')]['message']);return _0x3bdb32(_0x349683[_0xf2d6('0xe')]['message']);}logger['error'](_0xf2d6('0xb'),_0x12a610,_0x349683['error'][_0xf2d6('0x10')]);return _0x35b760(_0x349683[_0xf2d6('0xe')]['message']);}else{logger[_0xf2d6('0x11')](_0xf2d6('0xb'),_0x12a610,'request\x20sent');_0x35b760(_0x349683[_0xf2d6('0x12')][_0xf2d6('0x10')]);}})[_0xf2d6('0x13')](function(_0x51b8d9){logger[_0xf2d6('0xe')](_0xf2d6('0xb'),_0x12a610,_0x51b8d9);_0x3bdb32(_0x51b8d9);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 0deffff..2de48e1 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 _0x297f=['./intZendeskField.controller','get','isAuthenticated','/:id','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x9fc5a2,_0x46c38f){var _0x10a4a8=function(_0x2aeef2){while(--_0x2aeef2){_0x9fc5a2['push'](_0x9fc5a2['shift']());}};_0x10a4a8(++_0x46c38f);}(_0x297f,0x109));var _0xf297=function(_0x3bab99,_0x1f9d50){_0x3bab99=_0x3bab99-0x0;var _0x4ed763=_0x297f[_0x3bab99];return _0x4ed763;};'use strict';var multer=require(_0xf297('0x0'));var util=require(_0xf297('0x1'));var path=require(_0xf297('0x2'));var timeout=require(_0xf297('0x3'));var express=require('express');var router=express[_0xf297('0x4')]();var fs_extra=require(_0xf297('0x5'));var auth=require(_0xf297('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf297('0x7'));router[_0xf297('0x8')]('/',auth[_0xf297('0x9')](),controller['index']);router['get'](_0xf297('0xa'),auth[_0xf297('0x9')](),controller['show']);router[_0xf297('0xb')]('/',auth['isAuthenticated'](),controller[_0xf297('0xc')]);router[_0xf297('0xd')](_0xf297('0xa'),auth[_0xf297('0x9')](),controller['update']);router[_0xf297('0xe')](_0xf297('0xa'),auth[_0xf297('0x9')](),controller[_0xf297('0xf')]);module[_0xf297('0x10')]=router; \ No newline at end of file +var _0xa1a0=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskField.controller','isAuthenticated','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x2fae68,_0x20f52b){var _0x6497f1=function(_0x30e773){while(--_0x30e773){_0x2fae68['push'](_0x2fae68['shift']());}};_0x6497f1(++_0x20f52b);}(_0xa1a0,0x7b));var _0x0a1a=function(_0x9fc5a2,_0x46c38f){_0x9fc5a2=_0x9fc5a2-0x0;var _0x10a4a8=_0xa1a0[_0x9fc5a2];return _0x10a4a8;};'use strict';var multer=require(_0x0a1a('0x0'));var util=require(_0x0a1a('0x1'));var path=require(_0x0a1a('0x2'));var timeout=require(_0x0a1a('0x3'));var express=require(_0x0a1a('0x4'));var router=express[_0x0a1a('0x5')]();var fs_extra=require(_0x0a1a('0x6'));var auth=require(_0x0a1a('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x0a1a('0x8'));var controller=require(_0x0a1a('0x9'));router['get']('/',auth[_0x0a1a('0xa')](),controller['index']);router[_0x0a1a('0xb')](_0x0a1a('0xc'),auth['isAuthenticated'](),controller[_0x0a1a('0xd')]);router[_0x0a1a('0xe')]('/',auth[_0x0a1a('0xa')](),controller[_0x0a1a('0xf')]);router[_0x0a1a('0x10')](_0x0a1a('0xc'),auth[_0x0a1a('0xa')](),controller[_0x0a1a('0x11')]);router[_0x0a1a('0x12')](_0x0a1a('0xc'),auth[_0x0a1a('0xa')](),controller[_0x0a1a('0x13')]);module[_0x0a1a('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index fd5ab72..24683d4 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 _0x08cb=['STRING','ENUM','customVariable','sequelize','string','variable','keyValue','picklist'];(function(_0x3d5faf,_0x3ea010){var _0x267cb2=function(_0x424e31){while(--_0x424e31){_0x3d5faf['push'](_0x3d5faf['shift']());}};_0x267cb2(++_0x3ea010);}(_0x08cb,0xb3));var _0xb08c=function(_0x3725cd,_0x362c4c){_0x3725cd=_0x3725cd-0x0;var _0x1bd753=_0x08cb[_0x3725cd];return _0x1bd753;};'use strict';var Sequelize=require(_0xb08c('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xb08c('0x1'),_0xb08c('0x2'),'customVariable',_0xb08c('0x3'),_0xb08c('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xb08c('0x5')]},'key':{'type':Sequelize[_0xb08c('0x5')]},'keyType':{'type':Sequelize[_0xb08c('0x6')]('string',_0xb08c('0x2'),_0xb08c('0x7'))},'keyContent':{'type':Sequelize[_0xb08c('0x5')]},'idField':{'type':Sequelize[_0xb08c('0x5')]},'nameField':{'type':Sequelize[_0xb08c('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x62c1=['customVariable','BOOLEAN','sequelize','ENUM','string','variable','keyValue','picklist','STRING'];(function(_0x5de532,_0x2941c4){var _0x4e9192=function(_0x548a81){while(--_0x548a81){_0x5de532['push'](_0x5de532['shift']());}};_0x4e9192(++_0x2941c4);}(_0x62c1,0x92));var _0x162c=function(_0x4d45c1,_0x2beda1){_0x4d45c1=_0x4d45c1-0x0;var _0x244478=_0x62c1[_0x4d45c1];return _0x244478;};'use strict';var Sequelize=require(_0x162c('0x0'));module['exports']={'type':{'type':Sequelize[_0x162c('0x1')](_0x162c('0x2'),_0x162c('0x3'),'customVariable',_0x162c('0x4'),_0x162c('0x5')),'defaultValue':_0x162c('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x162c('0x6')]},'keyType':{'type':Sequelize[_0x162c('0x1')](_0x162c('0x2'),'variable',_0x162c('0x7'))},'keyContent':{'type':Sequelize[_0x162c('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x162c('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 066f83e..2d2abca 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 _0x5293=['apply','reject','save','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','ZendeskField','rows','catch','show','params','length','find','create','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit'];(function(_0x2bb9b3,_0x1d2c25){var _0x601b6=function(_0x4f8d09){while(--_0x4f8d09){_0x2bb9b3['push'](_0x2bb9b3['shift']());}};_0x601b6(++_0x1d2c25);}(_0x5293,0xb7));var _0x3529=function(_0xa2b098,_0x461a08){_0xa2b098=_0xa2b098-0x0;var _0x29502e=_0x5293[_0xa2b098];return _0x29502e;};'use strict';var emlformat=require(_0x3529('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3529('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3529('0x2'));var moment=require(_0x3529('0x3'));var BPromise=require(_0x3529('0x4'));var Mustache=require(_0x3529('0x5'));var util=require(_0x3529('0x6'));var path=require(_0x3529('0x7'));var sox=require('sox');var csv=require(_0x3529('0x8'));var ejs=require(_0x3529('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3529('0xa'));var squel=require(_0x3529('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3529('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3529('0xd'));var Papa=require('papaparse');var Redis=require(_0x3529('0xe'));var authService=require(_0x3529('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x3529('0x10'));var hardwareService=require(_0x3529('0x11'));var logger=require('../../config/logger')(_0x3529('0x12'));var utils=require(_0x3529('0x13'));var config=require(_0x3529('0x14'));var licenseUtil=require(_0x3529('0x15'));var db=require(_0x3529('0x16'))['db'];function respondWithStatusCode(_0x2b8fc4,_0x11b1f0){_0x11b1f0=_0x11b1f0||0xcc;return function(_0x3c01cd){if(_0x3c01cd){return _0x2b8fc4[_0x3529('0x17')](_0x11b1f0);}return _0x2b8fc4[_0x3529('0x18')](_0x11b1f0)[_0x3529('0x19')]();};}function respondWithResult(_0x4d58e1,_0x22b7e3){_0x22b7e3=_0x22b7e3||0xc8;return function(_0x2c4fb7){if(_0x2c4fb7){return _0x4d58e1[_0x3529('0x18')](_0x22b7e3)[_0x3529('0x1a')](_0x2c4fb7);}};}function respondWithFilteredResult(_0x2af29d,_0x5d2ea4){return function(_0x5c55ef){if(_0x5c55ef){var _0x35caed=typeof _0x5d2ea4[_0x3529('0x1b')]==='undefined'&&typeof _0x5d2ea4['limit']==='undefined';var _0x30be7f=_0x5c55ef['count'];var _0x449e64=_0x35caed?0x0:_0x5d2ea4[_0x3529('0x1b')];var _0x2d4c44=_0x35caed?_0x5c55ef[_0x3529('0x1c')]:_0x5d2ea4[_0x3529('0x1b')]+_0x5d2ea4[_0x3529('0x1d')];var _0x147977;if(_0x2d4c44>=_0x30be7f){_0x2d4c44=_0x30be7f;_0x147977=0xc8;}else{_0x147977=0xce;}_0x2af29d[_0x3529('0x18')](_0x147977);return _0x2af29d['set']('Content-Range',_0x449e64+'-'+_0x2d4c44+'/'+_0x30be7f)['json'](_0x5c55ef);}return null;};}function patchUpdates(_0x1c42d9){return function(_0x3e1ecb){try{jsonpatch[_0x3529('0x1e')](_0x3e1ecb,_0x1c42d9,!![]);}catch(_0x3f72f8){return BPromise[_0x3529('0x1f')](_0x3f72f8);}return _0x3e1ecb[_0x3529('0x20')]();};}function saveUpdates(_0x3ac68a,_0x2514fa){return function(_0x327782){if(_0x327782){return _0x327782['update'](_0x3ac68a)[_0x3529('0x21')](function(_0x473ead){return _0x473ead;});}return null;};}function removeEntity(_0x536880,_0x165eea){return function(_0x5ba979){if(_0x5ba979){return _0x5ba979[_0x3529('0x22')]()['then'](function(){_0x536880[_0x3529('0x18')](0xcc)[_0x3529('0x19')]();});}};}function handleEntityNotFound(_0x5b35b1,_0x35db44){return function(_0x554db8){if(!_0x554db8){_0x5b35b1[_0x3529('0x17')](0x194);}return _0x554db8;};}function handleError(_0x1069bf,_0x28436d){_0x28436d=_0x28436d||0x1f4;return function(_0x3764c5){logger[_0x3529('0x23')](_0x3764c5[_0x3529('0x24')]);if(_0x3764c5[_0x3529('0x25')]){delete _0x3764c5['name'];}_0x1069bf[_0x3529('0x18')](_0x28436d)['send'](_0x3764c5);};}exports[_0x3529('0x26')]=function(_0x8311c0,_0x163ed6){var _0xb15c91={},_0x1d2422={},_0x2ce13e={'count':0x0,'rows':[]};var _0x2f972f=_[_0x3529('0x27')](db['ZendeskField'][_0x3529('0x28')],function(_0x336be0){return{'name':_0x336be0[_0x3529('0x29')],'type':_0x336be0[_0x3529('0x2a')][_0x3529('0x2b')]};});_0x1d2422[_0x3529('0x2c')]=_[_0x3529('0x27')](_0x2f972f,_0x3529('0x25'));_0x1d2422['query']=_[_0x3529('0x2d')](_0x8311c0[_0x3529('0x2e')]);_0x1d2422[_0x3529('0x2f')]=_['intersection'](_0x1d2422[_0x3529('0x2c')],_0x1d2422[_0x3529('0x2e')]);_0xb15c91[_0x3529('0x30')]=_[_0x3529('0x31')](_0x1d2422[_0x3529('0x2c')],qs['fields'](_0x8311c0[_0x3529('0x2e')][_0x3529('0x32')]));_0xb15c91['attributes']=_0xb15c91[_0x3529('0x30')]['length']?_0xb15c91[_0x3529('0x30')]:_0x1d2422[_0x3529('0x2c')];if(!_0x8311c0[_0x3529('0x2e')][_0x3529('0x33')]('nolimit')){_0xb15c91['limit']=qs[_0x3529('0x1d')](_0x8311c0['query'][_0x3529('0x1d')]);_0xb15c91[_0x3529('0x1b')]=qs['offset'](_0x8311c0[_0x3529('0x2e')][_0x3529('0x1b')]);}_0xb15c91[_0x3529('0x34')]=qs[_0x3529('0x35')](_0x8311c0[_0x3529('0x2e')][_0x3529('0x35')]);_0xb15c91[_0x3529('0x36')]=qs[_0x3529('0x2f')](_[_0x3529('0x37')](_0x8311c0[_0x3529('0x2e')],_0x1d2422[_0x3529('0x2f')]),_0x2f972f);if(_0x8311c0[_0x3529('0x2e')][_0x3529('0x38')]){_0xb15c91[_0x3529('0x36')]=_[_0x3529('0x39')](_0xb15c91['where'],{'$or':_[_0x3529('0x27')](_0x2f972f,function(_0x7c929b){if(_0x7c929b[_0x3529('0x2a')]!==_0x3529('0x3a')){var _0x3c59e3={};_0x3c59e3[_0x7c929b[_0x3529('0x25')]]={'$like':'%'+_0x8311c0[_0x3529('0x2e')][_0x3529('0x38')]+'%'};return _0x3c59e3;}})});}_0xb15c91=_['merge']({},_0xb15c91,_0x8311c0[_0x3529('0x3b')]);var _0x116c1e={'where':_0xb15c91[_0x3529('0x36')]};return db['ZendeskField'][_0x3529('0x1c')](_0x116c1e)[_0x3529('0x21')](function(_0x4794d8){_0x2ce13e[_0x3529('0x1c')]=_0x4794d8;if(_0x8311c0['query'][_0x3529('0x3c')]){_0xb15c91[_0x3529('0x3d')]=[{'all':!![]}];}return db[_0x3529('0x3e')]['findAll'](_0xb15c91);})['then'](function(_0x363e5c){_0x2ce13e[_0x3529('0x3f')]=_0x363e5c;return _0x2ce13e;})[_0x3529('0x21')](respondWithFilteredResult(_0x163ed6,_0xb15c91))[_0x3529('0x40')](handleError(_0x163ed6,null));};exports[_0x3529('0x41')]=function(_0x274423,_0x4af4ff){var _0x274c05={'raw':!![],'where':{'id':_0x274423[_0x3529('0x42')]['id']}},_0x58550b={};_0x58550b[_0x3529('0x2c')]=_[_0x3529('0x2d')](db[_0x3529('0x3e')][_0x3529('0x28')]);_0x58550b['query']=_['keys'](_0x274423[_0x3529('0x2e')]);_0x58550b[_0x3529('0x2f')]=_['intersection'](_0x58550b[_0x3529('0x2c')],_0x58550b[_0x3529('0x2e')]);_0x274c05[_0x3529('0x30')]=_[_0x3529('0x31')](_0x58550b[_0x3529('0x2c')],qs['fields'](_0x274423[_0x3529('0x2e')][_0x3529('0x32')]));_0x274c05['attributes']=_0x274c05[_0x3529('0x30')][_0x3529('0x43')]?_0x274c05['attributes']:_0x58550b[_0x3529('0x2c')];if(_0x274423['query'][_0x3529('0x3c')]){_0x274c05[_0x3529('0x3d')]=[{'all':!![]}];}_0x274c05=_[_0x3529('0x39')]({},_0x274c05,_0x274423[_0x3529('0x3b')]);return db[_0x3529('0x3e')][_0x3529('0x44')](_0x274c05)[_0x3529('0x21')](handleEntityNotFound(_0x4af4ff,null))[_0x3529('0x21')](respondWithResult(_0x4af4ff,null))['catch'](handleError(_0x4af4ff,null));};exports[_0x3529('0x45')]=function(_0x5c64ff,_0x522ba9){return db[_0x3529('0x3e')]['create'](_0x5c64ff[_0x3529('0x46')],{})['then'](respondWithResult(_0x522ba9,0xc9))[_0x3529('0x40')](handleError(_0x522ba9,null));};exports['update']=function(_0x2fe509,_0x567409){if(_0x2fe509[_0x3529('0x46')]['id']){delete _0x2fe509['body']['id'];}return db['ZendeskField'][_0x3529('0x44')]({'where':{'id':_0x2fe509['params']['id']}})[_0x3529('0x21')](handleEntityNotFound(_0x567409,null))['then'](saveUpdates(_0x2fe509['body'],null))[_0x3529('0x21')](respondWithResult(_0x567409,null))[_0x3529('0x40')](handleError(_0x567409,null));};exports[_0x3529('0x22')]=function(_0x5c1523,_0x389977){return db[_0x3529('0x3e')][_0x3529('0x44')]({'where':{'id':_0x5c1523[_0x3529('0x42')]['id']}})[_0x3529('0x21')](handleEntityNotFound(_0x389977,null))[_0x3529('0x21')](removeEntity(_0x389977,null))[_0x3529('0x40')](handleError(_0x389977,null));}; \ No newline at end of file +var _0xa2ab=['options','include','findAll','rows','catch','show','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','count','status','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0xa2ab,0xa7));var _0xba2a=function(_0x582592,_0x19204e){_0x582592=_0x582592-0x0;var _0x365ce1=_0xa2ab[_0x582592];return _0x365ce1;};'use strict';var emlformat=require(_0xba2a('0x0'));var rimraf=require(_0xba2a('0x1'));var zipdir=require(_0xba2a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xba2a('0x3'));var moment=require(_0xba2a('0x4'));var BPromise=require(_0xba2a('0x5'));var Mustache=require(_0xba2a('0x6'));var util=require(_0xba2a('0x7'));var path=require(_0xba2a('0x8'));var sox=require(_0xba2a('0x9'));var csv=require('to-csv');var ejs=require(_0xba2a('0xa'));var fs=require('fs');var fs_extra=require(_0xba2a('0xb'));var _=require(_0xba2a('0xc'));var squel=require('squel');var crypto=require(_0xba2a('0xd'));var jsforce=require(_0xba2a('0xe'));var deskjs=require(_0xba2a('0xf'));var toCsv=require(_0xba2a('0x10'));var querystring=require('querystring');var Papa=require(_0xba2a('0x11'));var Redis=require(_0xba2a('0x12'));var authService=require(_0xba2a('0x13'));var qs=require(_0xba2a('0x14'));var as=require(_0xba2a('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xba2a('0x16'))(_0xba2a('0x17'));var utils=require(_0xba2a('0x18'));var config=require(_0xba2a('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xba2a('0x1a'))['db'];function respondWithStatusCode(_0x10bf76,_0x94b897){_0x94b897=_0x94b897||0xcc;return function(_0x2c850e){if(_0x2c850e){return _0x10bf76[_0xba2a('0x1b')](_0x94b897);}return _0x10bf76['status'](_0x94b897)[_0xba2a('0x1c')]();};}function respondWithResult(_0x44759c,_0xe2bbdb){_0xe2bbdb=_0xe2bbdb||0xc8;return function(_0x127c42){if(_0x127c42){return _0x44759c['status'](_0xe2bbdb)[_0xba2a('0x1d')](_0x127c42);}};}function respondWithFilteredResult(_0x1b3272,_0x261f90){return function(_0x4147a6){if(_0x4147a6){var _0x4b9f63=typeof _0x261f90[_0xba2a('0x1e')]===_0xba2a('0x1f')&&typeof _0x261f90['limit']===_0xba2a('0x1f');var _0x49c57e=_0x4147a6['count'];var _0x559c6e=_0x4b9f63?0x0:_0x261f90[_0xba2a('0x1e')];var _0xa56be8=_0x4b9f63?_0x4147a6[_0xba2a('0x20')]:_0x261f90[_0xba2a('0x1e')]+_0x261f90['limit'];var _0x437e4c;if(_0xa56be8>=_0x49c57e){_0xa56be8=_0x49c57e;_0x437e4c=0xc8;}else{_0x437e4c=0xce;}_0x1b3272[_0xba2a('0x21')](_0x437e4c);return _0x1b3272['set'](_0xba2a('0x22'),_0x559c6e+'-'+_0xa56be8+'/'+_0x49c57e)['json'](_0x4147a6);}return null;};}function patchUpdates(_0x3b3924){return function(_0x2ad68){try{jsonpatch[_0xba2a('0x23')](_0x2ad68,_0x3b3924,!![]);}catch(_0x1d4ba9){return BPromise[_0xba2a('0x24')](_0x1d4ba9);}return _0x2ad68[_0xba2a('0x25')]();};}function saveUpdates(_0x55565d,_0x2e0712){return function(_0x2cc3db){if(_0x2cc3db){return _0x2cc3db[_0xba2a('0x26')](_0x55565d)[_0xba2a('0x27')](function(_0x3bc8e1){return _0x3bc8e1;});}return null;};}function removeEntity(_0x56fa5e,_0xdfbf5c){return function(_0x4458cb){if(_0x4458cb){return _0x4458cb[_0xba2a('0x28')]()[_0xba2a('0x27')](function(){_0x56fa5e[_0xba2a('0x21')](0xcc)[_0xba2a('0x1c')]();});}};}function handleEntityNotFound(_0x24ee7d,_0x415dd7){return function(_0x4bba7a){if(!_0x4bba7a){_0x24ee7d[_0xba2a('0x1b')](0x194);}return _0x4bba7a;};}function handleError(_0x3d1a75,_0x1a0f21){_0x1a0f21=_0x1a0f21||0x1f4;return function(_0x2a001c){logger['error'](_0x2a001c[_0xba2a('0x29')]);if(_0x2a001c[_0xba2a('0x2a')]){delete _0x2a001c[_0xba2a('0x2a')];}_0x3d1a75['status'](_0x1a0f21)['send'](_0x2a001c);};}exports[_0xba2a('0x2b')]=function(_0x2f292b,_0x19c776){var _0x3bb5c3={},_0x3aa95a={},_0x403372={'count':0x0,'rows':[]};var _0x85d5a4=_[_0xba2a('0x2c')](db[_0xba2a('0x2d')][_0xba2a('0x2e')],function(_0x53f32d){return{'name':_0x53f32d[_0xba2a('0x2f')],'type':_0x53f32d[_0xba2a('0x30')][_0xba2a('0x31')]};});_0x3aa95a[_0xba2a('0x32')]=_['map'](_0x85d5a4,_0xba2a('0x2a'));_0x3aa95a[_0xba2a('0x33')]=_[_0xba2a('0x34')](_0x2f292b['query']);_0x3aa95a[_0xba2a('0x35')]=_[_0xba2a('0x36')](_0x3aa95a[_0xba2a('0x32')],_0x3aa95a[_0xba2a('0x33')]);_0x3bb5c3[_0xba2a('0x37')]=_[_0xba2a('0x36')](_0x3aa95a[_0xba2a('0x32')],qs[_0xba2a('0x38')](_0x2f292b['query'][_0xba2a('0x38')]));_0x3bb5c3[_0xba2a('0x37')]=_0x3bb5c3[_0xba2a('0x37')][_0xba2a('0x39')]?_0x3bb5c3[_0xba2a('0x37')]:_0x3aa95a['model'];if(!_0x2f292b[_0xba2a('0x33')][_0xba2a('0x3a')](_0xba2a('0x3b'))){_0x3bb5c3[_0xba2a('0x3c')]=qs['limit'](_0x2f292b[_0xba2a('0x33')][_0xba2a('0x3c')]);_0x3bb5c3[_0xba2a('0x1e')]=qs['offset'](_0x2f292b[_0xba2a('0x33')][_0xba2a('0x1e')]);}_0x3bb5c3[_0xba2a('0x3d')]=qs['sort'](_0x2f292b[_0xba2a('0x33')][_0xba2a('0x3e')]);_0x3bb5c3[_0xba2a('0x3f')]=qs[_0xba2a('0x35')](_[_0xba2a('0x40')](_0x2f292b[_0xba2a('0x33')],_0x3aa95a[_0xba2a('0x35')]),_0x85d5a4);if(_0x2f292b['query'][_0xba2a('0x41')]){_0x3bb5c3['where']=_[_0xba2a('0x42')](_0x3bb5c3[_0xba2a('0x3f')],{'$or':_['map'](_0x85d5a4,function(_0x5e4aa6){if(_0x5e4aa6['type']!=='VIRTUAL'){var _0x2402ff={};_0x2402ff[_0x5e4aa6['name']]={'$like':'%'+_0x2f292b[_0xba2a('0x33')][_0xba2a('0x41')]+'%'};return _0x2402ff;}})});}_0x3bb5c3=_['merge']({},_0x3bb5c3,_0x2f292b[_0xba2a('0x43')]);var _0x35a9c1={'where':_0x3bb5c3[_0xba2a('0x3f')]};return db['ZendeskField'][_0xba2a('0x20')](_0x35a9c1)['then'](function(_0x34fbfb){_0x403372[_0xba2a('0x20')]=_0x34fbfb;if(_0x2f292b[_0xba2a('0x33')]['includeAll']){_0x3bb5c3[_0xba2a('0x44')]=[{'all':!![]}];}return db[_0xba2a('0x2d')][_0xba2a('0x45')](_0x3bb5c3);})['then'](function(_0xc184a6){_0x403372[_0xba2a('0x46')]=_0xc184a6;return _0x403372;})['then'](respondWithFilteredResult(_0x19c776,_0x3bb5c3))[_0xba2a('0x47')](handleError(_0x19c776,null));};exports[_0xba2a('0x48')]=function(_0x22a674,_0xc180a6){var _0x38d98c={'raw':!![],'where':{'id':_0x22a674[_0xba2a('0x49')]['id']}},_0x3905d7={};_0x3905d7[_0xba2a('0x32')]=_[_0xba2a('0x34')](db['ZendeskField'][_0xba2a('0x2e')]);_0x3905d7[_0xba2a('0x33')]=_['keys'](_0x22a674[_0xba2a('0x33')]);_0x3905d7[_0xba2a('0x35')]=_[_0xba2a('0x36')](_0x3905d7[_0xba2a('0x32')],_0x3905d7['query']);_0x38d98c['attributes']=_['intersection'](_0x3905d7['model'],qs[_0xba2a('0x38')](_0x22a674[_0xba2a('0x33')]['fields']));_0x38d98c['attributes']=_0x38d98c['attributes'][_0xba2a('0x39')]?_0x38d98c[_0xba2a('0x37')]:_0x3905d7['model'];if(_0x22a674['query'][_0xba2a('0x4a')]){_0x38d98c[_0xba2a('0x44')]=[{'all':!![]}];}_0x38d98c=_['merge']({},_0x38d98c,_0x22a674[_0xba2a('0x43')]);return db[_0xba2a('0x2d')][_0xba2a('0x4b')](_0x38d98c)['then'](handleEntityNotFound(_0xc180a6,null))[_0xba2a('0x27')](respondWithResult(_0xc180a6,null))['catch'](handleError(_0xc180a6,null));};exports[_0xba2a('0x4c')]=function(_0x574075,_0x317bd8){return db[_0xba2a('0x2d')][_0xba2a('0x4c')](_0x574075[_0xba2a('0x4d')],{})[_0xba2a('0x27')](respondWithResult(_0x317bd8,0xc9))[_0xba2a('0x47')](handleError(_0x317bd8,null));};exports['update']=function(_0x46d4f8,_0x5e7dbc){if(_0x46d4f8[_0xba2a('0x4d')]['id']){delete _0x46d4f8['body']['id'];}return db[_0xba2a('0x2d')][_0xba2a('0x4b')]({'where':{'id':_0x46d4f8[_0xba2a('0x49')]['id']}})['then'](handleEntityNotFound(_0x5e7dbc,null))[_0xba2a('0x27')](saveUpdates(_0x46d4f8['body'],null))['then'](respondWithResult(_0x5e7dbc,null))[_0xba2a('0x47')](handleError(_0x5e7dbc,null));};exports['destroy']=function(_0x4f16c2,_0x236a31){return db[_0xba2a('0x2d')]['find']({'where':{'id':_0x4f16c2[_0xba2a('0x49')]['id']}})[_0xba2a('0x27')](handleEntityNotFound(_0x236a31,null))[_0xba2a('0x27')](removeEntity(_0x236a31,null))['catch'](handleError(_0x236a31,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index fd78497..0ff211d 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 _0x4743=['api','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash'];(function(_0x188fcc,_0x47c0e5){var _0x21fdd5=function(_0x4f0630){while(--_0x4f0630){_0x188fcc['push'](_0x188fcc['shift']());}};_0x21fdd5(++_0x47c0e5);}(_0x4743,0x9b));var _0x3474=function(_0x5d0b60,_0x40a2fa){_0x5d0b60=_0x5d0b60-0x0;var _0x2263dc=_0x4743[_0x5d0b60];return _0x2263dc;};'use strict';var _=require(_0x3474('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3474('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3474('0x2'));var fs=require('fs');var path=require(_0x3474('0x3'));var rimraf=require(_0x3474('0x4'));var config=require(_0x3474('0x5'));var attributes=require(_0x3474('0x6'));module['exports']=function(_0x2eac4b,_0x455d86){return _0x2eac4b[_0x3474('0x7')](_0x3474('0x8'),attributes,{'tableName':_0x3474('0x9'),'paranoid':![],'indexes':[{'name':_0x3474('0xa'),'fields':[_0x3474('0xb'),_0x3474('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x266a=['path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','api','bluebird','request-promise'];(function(_0x3cf4ab,_0x2361f4){var _0x39a723=function(_0xc415ee){while(--_0xc415ee){_0x3cf4ab['push'](_0x3cf4ab['shift']());}};_0x39a723(++_0x2361f4);}(_0x266a,0x10b));var _0xa266=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x266a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa266('0x0'));var util=require(_0xa266('0x1'));var logger=require('../../config/logger')(_0xa266('0x2'));var moment=require('moment');var BPromise=require(_0xa266('0x3'));var rp=require(_0xa266('0x4'));var fs=require('fs');var path=require(_0xa266('0x5'));var rimraf=require(_0xa266('0x6'));var config=require(_0xa266('0x7'));var attributes=require(_0xa266('0x8'));module[_0xa266('0x9')]=function(_0xa139e2,_0x2d7b5b){return _0xa139e2[_0xa266('0xa')](_0xa266('0xb'),attributes,{'tableName':_0xa266('0xc'),'paranoid':![],'indexes':[{'name':_0xa266('0xd'),'fields':[_0xa266('0xe'),_0xa266('0xf')],'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 9966330..b4f8cfb 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 _0x35b9=['ioredis','../../config/logger','jayson/promise','http','request','info','request\x20sent','stringify','error','code','ZendeskField,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0xcfe8cc,_0xb83aeb){var _0x55ac53=function(_0x4067d4){while(--_0x4067d4){_0xcfe8cc['push'](_0xcfe8cc['shift']());}};_0x55ac53(++_0xb83aeb);}(_0x35b9,0xe6));var _0x935b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x35b9[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x935b('0x0'));var util=require(_0x935b('0x1'));var moment=require('moment');var BPromise=require(_0x935b('0x2'));var rs=require(_0x935b('0x3'));var fs=require('fs');var Redis=require(_0x935b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x935b('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x935b('0x6'));var client=jayson['client'][_0x935b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x313d35,_0x4b8f45,_0x54e95e){return new BPromise(function(_0x46fcc4,_0x1dfda3){return client[_0x935b('0x8')](_0x313d35,_0x54e95e)['then'](function(_0x48db0f){logger[_0x935b('0x9')]('ZendeskField,\x20%s,\x20%s',_0x4b8f45,'request\x20sent');logger['debug']('ZendeskField,\x20%s,\x20%s,\x20%s',_0x4b8f45,_0x935b('0xa'),JSON[_0x935b('0xb')](_0x48db0f));if(_0x48db0f[_0x935b('0xc')]){if(_0x48db0f['error'][_0x935b('0xd')]===0x1f4){logger[_0x935b('0xc')](_0x935b('0xe'),_0x4b8f45,_0x48db0f[_0x935b('0xc')][_0x935b('0xf')]);return _0x1dfda3(_0x48db0f[_0x935b('0xc')][_0x935b('0xf')]);}logger[_0x935b('0xc')](_0x935b('0xe'),_0x4b8f45,_0x48db0f[_0x935b('0xc')]['message']);return _0x46fcc4(_0x48db0f[_0x935b('0xc')]['message']);}else{logger[_0x935b('0x9')](_0x935b('0xe'),_0x4b8f45,_0x935b('0xa'));_0x46fcc4(_0x48db0f[_0x935b('0x10')][_0x935b('0xf')]);}})[_0x935b('0x11')](function(_0x1a26ae){logger[_0x935b('0xc')]('ZendeskField,\x20%s,\x20%s',_0x4b8f45,_0x1a26ae);_0x1dfda3(_0x1a26ae);});});} \ No newline at end of file +var _0x5f64=['util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash'];(function(_0x5d2f5b,_0x107b92){var _0x1e2a1e=function(_0x21a2dc){while(--_0x21a2dc){_0x5d2f5b['push'](_0x5d2f5b['shift']());}};_0x1e2a1e(++_0x107b92);}(_0x5f64,0x1af));var _0x45f6=function(_0x53e3fa,_0x50c5f2){_0x53e3fa=_0x53e3fa-0x0;var _0xe8584a=_0x5f64[_0x53e3fa];return _0xe8584a;};'use strict';var _=require(_0x45f6('0x0'));var util=require(_0x45f6('0x1'));var moment=require(_0x45f6('0x2'));var BPromise=require('bluebird');var rs=require(_0x45f6('0x3'));var fs=require('fs');var Redis=require(_0x45f6('0x4'));var db=require(_0x45f6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x45f6('0x6'))(_0x45f6('0x7'));var config=require(_0x45f6('0x8'));var jayson=require(_0x45f6('0x9'));var client=jayson[_0x45f6('0xa')][_0x45f6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x207478,_0x2abdd3,_0x47673d){return new BPromise(function(_0x1cc011,_0x3b6dab){return client[_0x45f6('0xc')](_0x207478,_0x47673d)[_0x45f6('0xd')](function(_0x25f7c3){logger[_0x45f6('0xe')](_0x45f6('0xf'),_0x2abdd3,_0x45f6('0x10'));logger[_0x45f6('0x11')](_0x45f6('0x12'),_0x2abdd3,_0x45f6('0x10'),JSON[_0x45f6('0x13')](_0x25f7c3));if(_0x25f7c3[_0x45f6('0x14')]){if(_0x25f7c3[_0x45f6('0x14')][_0x45f6('0x15')]===0x1f4){logger['error'](_0x45f6('0xf'),_0x2abdd3,_0x25f7c3[_0x45f6('0x14')][_0x45f6('0x16')]);return _0x3b6dab(_0x25f7c3[_0x45f6('0x14')][_0x45f6('0x16')]);}logger[_0x45f6('0x14')](_0x45f6('0xf'),_0x2abdd3,_0x25f7c3['error'][_0x45f6('0x16')]);return _0x1cc011(_0x25f7c3[_0x45f6('0x14')][_0x45f6('0x16')]);}else{logger['info'](_0x45f6('0xf'),_0x2abdd3,_0x45f6('0x10'));_0x1cc011(_0x25f7c3['result']['message']);}})[_0x45f6('0x17')](function(_0x5af7ed){logger[_0x45f6('0x14')](_0x45f6('0xf'),_0x2abdd3,_0x5af7ed);_0x3b6dab(_0x5af7ed);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 841e35f..a1cc665 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 _0xf333=['put','/:id','update','delete','destroy','multer','path','express','Router','../../components/auth/service','./intZohoAccount.controller','get','isAuthenticated','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xf333,0x1cd));var _0x3f33=function(_0x30d72c,_0x22cf93){_0x30d72c=_0x30d72c-0x0;var _0x18ecc2=_0xf333[_0x30d72c];return _0x18ecc2;};'use strict';var multer=require(_0x3f33('0x0'));var util=require('util');var path=require(_0x3f33('0x1'));var timeout=require('connect-timeout');var express=require(_0x3f33('0x2'));var router=express[_0x3f33('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3f33('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3f33('0x5'));router[_0x3f33('0x6')]('/',auth[_0x3f33('0x7')](),controller['index']);router[_0x3f33('0x6')]('/:id',auth[_0x3f33('0x7')](),controller['show']);router['get']('/:id/configurations',auth[_0x3f33('0x7')](),controller['getConfigurations']);router['get'](_0x3f33('0x8'),auth['isAuthenticated'](),controller[_0x3f33('0x9')]);router[_0x3f33('0xa')]('/',auth['isAuthenticated'](),controller[_0x3f33('0xb')]);router[_0x3f33('0xa')](_0x3f33('0xc'),auth['isAuthenticated'](),controller[_0x3f33('0xd')]);router[_0x3f33('0xe')](_0x3f33('0xf'),auth['isAuthenticated'](),controller[_0x3f33('0x10')]);router[_0x3f33('0x11')](_0x3f33('0xf'),auth[_0x3f33('0x7')](),controller[_0x3f33('0x12')]);module['exports']=router; \ No newline at end of file +var _0x5df5=['put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','show','getFields','post','/:id/configurations','addConfiguration'];(function(_0x2c9da5,_0x2a88d9){var _0x25f2ab=function(_0x49123c){while(--_0x49123c){_0x2c9da5['push'](_0x2c9da5['shift']());}};_0x25f2ab(++_0x2a88d9);}(_0x5df5,0x72));var _0x55df=function(_0x2c1d0e,_0x307727){_0x2c1d0e=_0x2c1d0e-0x0;var _0x5a7dd4=_0x5df5[_0x2c1d0e];return _0x5a7dd4;};'use strict';var multer=require(_0x55df('0x0'));var util=require('util');var path=require(_0x55df('0x1'));var timeout=require(_0x55df('0x2'));var express=require(_0x55df('0x3'));var router=express[_0x55df('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x55df('0x5'));var interaction=require(_0x55df('0x6'));var config=require(_0x55df('0x7'));var controller=require(_0x55df('0x8'));router[_0x55df('0x9')]('/',auth[_0x55df('0xa')](),controller[_0x55df('0xb')]);router['get'](_0x55df('0xc'),auth['isAuthenticated'](),controller[_0x55df('0xd')]);router[_0x55df('0x9')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router['get']('/:id/fields',auth[_0x55df('0xa')](),controller[_0x55df('0xe')]);router['post']('/',auth[_0x55df('0xa')](),controller['create']);router[_0x55df('0xf')](_0x55df('0x10'),auth[_0x55df('0xa')](),controller[_0x55df('0x11')]);router[_0x55df('0x12')](_0x55df('0xc'),auth[_0x55df('0xa')](),controller['update']);router[_0x55df('0x13')](_0x55df('0xc'),auth[_0x55df('0xa')](),controller[_0x55df('0x14')]);module[_0x55df('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index d9a6303..3dceeaf 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 _0x153f=['exports','STRING','sequelize'];(function(_0x2e3107,_0x25f970){var _0x833d69=function(_0x420e78){while(--_0x420e78){_0x2e3107['push'](_0x2e3107['shift']());}};_0x833d69(++_0x25f970);}(_0x153f,0x15b));var _0xf153=function(_0x3174b1,_0x3d1013){_0x3174b1=_0x3174b1-0x0;var _0x3b5f8a=_0x153f[_0x3174b1];return _0x3b5f8a;};'use strict';var Sequelize=require(_0xf153('0x0'));module[_0xf153('0x1')]={'name':{'type':Sequelize[_0xf153('0x2')]},'description':{'type':Sequelize[_0xf153('0x2')]},'host':{'type':Sequelize[_0xf153('0x2')]},'zone':{'type':Sequelize[_0xf153('0x2')]},'clientId':{'type':Sequelize[_0xf153('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xf153('0x2')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0xf153('0x2')]}}; \ No newline at end of file +var _0x702d=['sequelize','exports','STRING'];(function(_0x3de217,_0x5235c2){var _0xfc36b8=function(_0x6ad818){while(--_0x6ad818){_0x3de217['push'](_0x3de217['shift']());}};_0xfc36b8(++_0x5235c2);}(_0x702d,0x147));var _0xd702=function(_0x34cd72,_0x5eda87){_0x34cd72=_0x34cd72-0x0;var _0x506630=_0x702d[_0x34cd72];return _0x506630;};'use strict';var Sequelize=require(_0xd702('0x0'));module[_0xd702('0x1')]={'name':{'type':Sequelize[_0xd702('0x2')]},'description':{'type':Sequelize[_0xd702('0x2')]},'host':{'type':Sequelize[_0xd702('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xd702('0x2')]},'clientSecret':{'type':Sequelize[_0xd702('0x2')]},'serverUrl':{'type':Sequelize[_0xd702('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xd702('0x2')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 5ae63ba..a0bdced 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 _0x82a0=['test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','path','sox','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','../../components/integrations/configuration','sendStatus','status','json','undefined','limit','count','offset','apply','reject','save','then','destroy','error','name','index','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','ZohoAccount','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','getConfigurations','ZohoConfiguration','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions','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','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','code','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','WhoId','Call_Duration','Call_Result','Call_Start_Time','includes','api_name','push','display_label','data_type','picklist','pick_list_values'];(function(_0x4e72ed,_0x570dcd){var _0x313825=function(_0x13ce42){while(--_0x13ce42){_0x4e72ed['push'](_0x4e72ed['shift']());}};_0x313825(++_0x570dcd);}(_0x82a0,0x10a));var _0x082a=function(_0x1fa759,_0x4ecdce){_0x1fa759=_0x1fa759-0x0;var _0x2da9f4=_0x82a0[_0x1fa759];return _0x2da9f4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x082a('0x0'));var zipdir=require(_0x082a('0x1'));var jsonpatch=require(_0x082a('0x2'));var rp=require(_0x082a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x082a('0x4'));var sox=require(_0x082a('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x082a('0x6'));var _=require(_0x082a('0x7'));var squel=require(_0x082a('0x8'));var crypto=require(_0x082a('0x9'));var jsforce=require(_0x082a('0xa'));var deskjs=require(_0x082a('0xb'));var toCsv=require(_0x082a('0xc'));var querystring=require(_0x082a('0xd'));var Papa=require(_0x082a('0xe'));var Redis=require(_0x082a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x082a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x082a('0x11'));var logger=require(_0x082a('0x12'))(_0x082a('0x13'));var utils=require(_0x082a('0x14'));var config=require(_0x082a('0x15'));var licenseUtil=require(_0x082a('0x16'));var db=require(_0x082a('0x17'))['db'];var integrations=require(_0x082a('0x18'));function respondWithStatusCode(_0x1ecbee,_0x1c1aa2){_0x1c1aa2=_0x1c1aa2||0xcc;return function(_0x3fdce7){if(_0x3fdce7){return _0x1ecbee[_0x082a('0x19')](_0x1c1aa2);}return _0x1ecbee['status'](_0x1c1aa2)['end']();};}function respondWithResult(_0x513680,_0xf69435){_0xf69435=_0xf69435||0xc8;return function(_0x12ff96){if(_0x12ff96){return _0x513680[_0x082a('0x1a')](_0xf69435)[_0x082a('0x1b')](_0x12ff96);}};}function respondWithFilteredResult(_0x38c14d,_0x428272){return function(_0x221f0c){if(_0x221f0c){var _0x39fec8=typeof _0x428272['offset']===_0x082a('0x1c')&&typeof _0x428272[_0x082a('0x1d')]===_0x082a('0x1c');var _0x586b41=_0x221f0c[_0x082a('0x1e')];var _0xf20b71=_0x39fec8?0x0:_0x428272[_0x082a('0x1f')];var _0x62e26b=_0x39fec8?_0x221f0c[_0x082a('0x1e')]:_0x428272[_0x082a('0x1f')]+_0x428272[_0x082a('0x1d')];var _0x2d465d;if(_0x62e26b>=_0x586b41){_0x62e26b=_0x586b41;_0x2d465d=0xc8;}else{_0x2d465d=0xce;}_0x38c14d[_0x082a('0x1a')](_0x2d465d);return _0x38c14d['set']('Content-Range',_0xf20b71+'-'+_0x62e26b+'/'+_0x586b41)[_0x082a('0x1b')](_0x221f0c);}return null;};}function patchUpdates(_0x505a1c){return function(_0x4838d5){try{jsonpatch[_0x082a('0x20')](_0x4838d5,_0x505a1c,!![]);}catch(_0x4070f6){return BPromise[_0x082a('0x21')](_0x4070f6);}return _0x4838d5[_0x082a('0x22')]();};}function saveUpdates(_0x35ec76,_0x5e57d5){return function(_0x4e3902){if(_0x4e3902){return _0x4e3902['update'](_0x35ec76)[_0x082a('0x23')](function(_0x387261){return _0x387261;});}return null;};}function removeEntity(_0xf09c89,_0x1560ed){return function(_0x3a8b3d){if(_0x3a8b3d){return _0x3a8b3d[_0x082a('0x24')]()[_0x082a('0x23')](function(){_0xf09c89[_0x082a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12181e,_0x24027c){return function(_0x476665){if(!_0x476665){_0x12181e[_0x082a('0x19')](0x194);}return _0x476665;};}function handleError(_0x3307d0,_0x5c5ea1){_0x5c5ea1=_0x5c5ea1||0x1f4;return function(_0x5a9974){logger[_0x082a('0x25')](_0x5a9974['stack']);if(_0x5a9974[_0x082a('0x26')]){delete _0x5a9974[_0x082a('0x26')];}_0x3307d0['status'](_0x5c5ea1)['send'](_0x5a9974);};}exports[_0x082a('0x27')]=function(_0x11257d,_0x4b50ff){var _0x441eac={},_0x4875fe={},_0x50e2df={'count':0x0,'rows':[]};var _0x566342=_['map'](db['ZohoAccount'][_0x082a('0x28')],function(_0x555fb8){return{'name':_0x555fb8[_0x082a('0x29')],'type':_0x555fb8[_0x082a('0x2a')]['key']};});_0x4875fe[_0x082a('0x2b')]=_[_0x082a('0x2c')](_0x566342,_0x082a('0x26'));_0x4875fe[_0x082a('0x2d')]=_[_0x082a('0x2e')](_0x11257d[_0x082a('0x2d')]);_0x4875fe[_0x082a('0x2f')]=_['intersection'](_0x4875fe[_0x082a('0x2b')],_0x4875fe[_0x082a('0x2d')]);_0x441eac[_0x082a('0x30')]=_['intersection'](_0x4875fe[_0x082a('0x2b')],qs[_0x082a('0x31')](_0x11257d[_0x082a('0x2d')][_0x082a('0x31')]));_0x441eac['attributes']=_0x441eac['attributes'][_0x082a('0x32')]?_0x441eac[_0x082a('0x30')]:_0x4875fe[_0x082a('0x2b')];if(!_0x11257d[_0x082a('0x2d')][_0x082a('0x33')](_0x082a('0x34'))){_0x441eac[_0x082a('0x1d')]=qs[_0x082a('0x1d')](_0x11257d['query'][_0x082a('0x1d')]);_0x441eac['offset']=qs[_0x082a('0x1f')](_0x11257d[_0x082a('0x2d')][_0x082a('0x1f')]);}_0x441eac[_0x082a('0x35')]=qs[_0x082a('0x36')](_0x11257d[_0x082a('0x2d')][_0x082a('0x36')]);_0x441eac['where']=qs[_0x082a('0x2f')](_[_0x082a('0x37')](_0x11257d[_0x082a('0x2d')],_0x4875fe['filters']),_0x566342);if(_0x11257d[_0x082a('0x2d')]['filter']){_0x441eac[_0x082a('0x38')]=_[_0x082a('0x39')](_0x441eac[_0x082a('0x38')],{'$or':_['map'](_0x566342,function(_0x3e0a2f){if(_0x3e0a2f[_0x082a('0x2a')]!==_0x082a('0x3a')){var _0x2bb9ec={};_0x2bb9ec[_0x3e0a2f[_0x082a('0x26')]]={'$like':'%'+_0x11257d[_0x082a('0x2d')][_0x082a('0x3b')]+'%'};return _0x2bb9ec;}})});}_0x441eac=_[_0x082a('0x39')]({},_0x441eac,_0x11257d[_0x082a('0x3c')]);var _0x46e5ed={'where':_0x441eac[_0x082a('0x38')]};return db[_0x082a('0x3d')]['count'](_0x46e5ed)[_0x082a('0x23')](function(_0x215a5f){_0x50e2df[_0x082a('0x1e')]=_0x215a5f;if(_0x11257d[_0x082a('0x2d')][_0x082a('0x3e')]){_0x441eac[_0x082a('0x3f')]=[{'all':!![]}];}return db[_0x082a('0x3d')][_0x082a('0x40')](_0x441eac);})[_0x082a('0x23')](function(_0x25a4ad){_0x50e2df[_0x082a('0x41')]=_0x25a4ad;return _0x50e2df;})[_0x082a('0x23')](respondWithFilteredResult(_0x4b50ff,_0x441eac))[_0x082a('0x42')](handleError(_0x4b50ff,null));};exports[_0x082a('0x43')]=function(_0x2de743,_0x544867){var _0x1a8fc1={'raw':![],'where':{'id':_0x2de743[_0x082a('0x44')]['id']}},_0xd27510={};_0xd27510[_0x082a('0x2b')]=_[_0x082a('0x2e')](db[_0x082a('0x3d')]['rawAttributes']);_0xd27510[_0x082a('0x2d')]=_['keys'](_0x2de743[_0x082a('0x2d')]);_0xd27510[_0x082a('0x2f')]=_['intersection'](_0xd27510[_0x082a('0x2b')],_0xd27510[_0x082a('0x2d')]);_0x1a8fc1[_0x082a('0x30')]=_['intersection'](_0xd27510['model'],qs['fields'](_0x2de743[_0x082a('0x2d')][_0x082a('0x31')]));_0x1a8fc1['attributes']=_0x1a8fc1[_0x082a('0x30')]['length']?_0x1a8fc1[_0x082a('0x30')]:_0xd27510[_0x082a('0x2b')];if(_0x2de743[_0x082a('0x2d')][_0x082a('0x3e')]){_0x1a8fc1[_0x082a('0x3f')]=[{'all':!![]}];}_0x1a8fc1=_[_0x082a('0x39')]({},_0x1a8fc1,_0x2de743[_0x082a('0x3c')]);return db['ZohoAccount'][_0x082a('0x45')](_0x1a8fc1)[_0x082a('0x23')](handleEntityNotFound(_0x544867,null))['then'](respondWithResult(_0x544867,null))['catch'](handleError(_0x544867,null));};exports[_0x082a('0x46')]=function(_0x56ae61,_0xf959f){return db[_0x082a('0x3d')][_0x082a('0x46')](_0x56ae61[_0x082a('0x47')],{})['then'](respondWithResult(_0xf959f,0xc9))['catch'](handleError(_0xf959f,null));};exports[_0x082a('0x48')]=function(_0x5ae4db,_0x549a18){if(_0x5ae4db[_0x082a('0x47')]['id']){delete _0x5ae4db['body']['id'];}return db[_0x082a('0x3d')]['find']({'where':{'id':_0x5ae4db['params']['id']}})[_0x082a('0x23')](handleEntityNotFound(_0x549a18,null))['then'](saveUpdates(_0x5ae4db[_0x082a('0x47')],null))[_0x082a('0x23')](respondWithResult(_0x549a18,null))[_0x082a('0x42')](handleError(_0x549a18,null));};exports['destroy']=function(_0x4233f8,_0x441bf5){return db[_0x082a('0x3d')][_0x082a('0x45')]({'where':{'id':_0x4233f8[_0x082a('0x44')]['id']}})[_0x082a('0x23')](handleEntityNotFound(_0x441bf5,null))[_0x082a('0x23')](removeEntity(_0x441bf5,null))[_0x082a('0x42')](handleError(_0x441bf5,null));};exports[_0x082a('0x49')]=function(_0x381ff4,_0xff64cf,_0x85482c){var _0x5210b4={};var _0x18ca96={};var _0x269b41;var _0x35b51f;return db[_0x082a('0x3d')]['findOne']({'where':{'id':_0x381ff4['params']['id']}})[_0x082a('0x23')](handleEntityNotFound(_0xff64cf,null))[_0x082a('0x23')](function(_0x1ab537){if(_0x1ab537){_0x269b41=_0x1ab537;_0x18ca96['model']=_[_0x082a('0x2e')](db[_0x082a('0x4a')][_0x082a('0x28')]);_0x18ca96[_0x082a('0x2d')]=_[_0x082a('0x2e')](_0x381ff4['query']);_0x18ca96[_0x082a('0x2f')]=_['intersection'](_0x18ca96['model'],_0x18ca96[_0x082a('0x2d')]);_0x5210b4[_0x082a('0x30')]=_['intersection'](_0x18ca96[_0x082a('0x2b')],qs[_0x082a('0x31')](_0x381ff4['query']['fields']));_0x5210b4[_0x082a('0x30')]=_0x5210b4[_0x082a('0x30')]['length']?_0x5210b4['attributes']:_0x18ca96['model'];_0x5210b4['order']=qs[_0x082a('0x36')](_0x381ff4[_0x082a('0x2d')][_0x082a('0x36')]);_0x5210b4[_0x082a('0x38')]=qs[_0x082a('0x2f')](_[_0x082a('0x37')](_0x381ff4[_0x082a('0x2d')],_0x18ca96[_0x082a('0x2f')]));if(_0x381ff4[_0x082a('0x2d')][_0x082a('0x3b')]){_0x5210b4[_0x082a('0x38')]=_['merge'](_0x5210b4[_0x082a('0x38')],{'$or':_[_0x082a('0x2c')](_0x5210b4[_0x082a('0x30')],function(_0x1504d){var _0x1bde0c={};_0x1bde0c[_0x1504d]={'$like':'%'+_0x381ff4['query'][_0x082a('0x3b')]+'%'};return _0x1bde0c;})});}_0x5210b4=_[_0x082a('0x39')]({},_0x5210b4,_0x381ff4[_0x082a('0x3c')]);return _0x269b41['getConfigurations'](_0x5210b4);}})[_0x082a('0x23')](function(_0x1591f7){if(_0x1591f7){_0x35b51f=_0x1591f7['length'];if(!_0x381ff4[_0x082a('0x2d')][_0x082a('0x33')](_0x082a('0x34'))){_0x5210b4['limit']=qs['limit'](_0x381ff4[_0x082a('0x2d')][_0x082a('0x1d')]);_0x5210b4[_0x082a('0x1f')]=qs['offset'](_0x381ff4[_0x082a('0x2d')][_0x082a('0x1f')]);}return _0x269b41['getConfigurations'](_0x5210b4);}})['then'](function(_0x1da331){if(_0x1da331){return _0x1da331?{'count':_0x35b51f,'rows':_0x1da331}:null;}})['then'](respondWithResult(_0xff64cf,null))[_0x082a('0x42')](handleError(_0xff64cf,null));};exports[_0x082a('0x4b')]=function(_0x2efcd,_0x33c893,_0x32c332){if(_0x2efcd[_0x082a('0x47')]['id']){delete _0x2efcd[_0x082a('0x47')]['id'];}return db[_0x082a('0x3d')][_0x082a('0x4c')]({'where':{'id':_0x2efcd['params']['id']}})['then'](handleEntityNotFound(_0x33c893,null))['then'](function(_0x566d36){if(_0x566d36){_0x2efcd[_0x082a('0x47')]['AccountId']=_0x566d36['id'];_0x2efcd['body'][_0x082a('0x4d')]=integrations[_0x082a('0x4e')](_0x2efcd[_0x082a('0x47')][_0x082a('0x4f')],_0x2efcd['body'][_0x082a('0x2a')]);_0x2efcd[_0x082a('0x47')][_0x082a('0x50')]=integrations[_0x082a('0x51')](_0x2efcd[_0x082a('0x47')][_0x082a('0x4f')],_0x2efcd[_0x082a('0x47')][_0x082a('0x2a')]);return db[_0x082a('0x4a')]['create'](_0x2efcd[_0x082a('0x47')],{'include':[{'model':db[_0x082a('0x52')],'as':_0x082a('0x4d')},{'model':db[_0x082a('0x52')],'as':_0x082a('0x50')}]});}return null;})[_0x082a('0x23')](respondWithResult(_0x33c893,null))['catch'](handleError(_0x33c893,null));};function getAccessToken(_0x978b63){return new Promise(function(_0x546e5c,_0x11706a){var _0x547e86;switch(_0x978b63[_0x082a('0x53')]){case'US':_0x547e86=_0x082a('0x54');break;case'AU':_0x547e86=_0x082a('0x55');break;case'EU':_0x547e86=_0x082a('0x56');break;case'IN':_0x547e86=_0x082a('0x57');break;case'CN':_0x547e86=_0x082a('0x58');break;default:_0x547e86=_0x082a('0x56');break;}var _0x4c5e6c={'method':_0x082a('0x59'),'uri':_0x547e86+_0x082a('0x5a'),'qs':{'refresh_token':_0x978b63[_0x082a('0x5b')],'client_id':_0x978b63[_0x082a('0x5c')],'client_secret':_0x978b63[_0x082a('0x5d')],'grant_type':_0x082a('0x5e')},'json':!![]};return rp(_0x4c5e6c)[_0x082a('0x23')](function(_0x427336){if(_0x427336[_0x082a('0x5f')]){_0x546e5c(_0x427336[_0x082a('0x5f')]);}else{_0x11706a(_0x082a('0x60'));}})[_0x082a('0x42')](function(_0x335fb2){_0x11706a(_0x335fb2);});});}exports[_0x082a('0x61')]=function(_0x15a0ae,_0xa04029,_0x3a520f){var _0x50edd6,_0x1ca7f7,_0x8c014c,_0x241eb9,_0x44ee8c;return db[_0x082a('0x3d')]['findOne']({'where':{'id':_0x15a0ae['params']['id']},'attributes':['id',_0x082a('0x62'),_0x082a('0x53'),_0x082a('0x5c'),'clientSecret',_0x082a('0x63'),_0x082a('0x64'),_0x082a('0x5b')]})['then'](handleEntityNotFound(_0xa04029,null))['then'](function(_0x41ef92){_0x44ee8c=_0x41ef92;_0x50edd6=_0x44ee8c[_0x082a('0x62')];_0x1ca7f7=_0x50edd6==='zoho.eu'?'eu':'com';_0x8c014c=_0x44ee8c[_0x082a('0x63')];var _0x1e887a=_0x8c014c['slice'](-0x1);if(_0x1e887a==='/'||_0x1e887a==='\x5c'||_0x1e887a===':'){_0x8c014c=_0x8c014c[_0x082a('0x65')](0x0,_0x8c014c[_0x082a('0x66')](_0x1e887a));}if(!_0x44ee8c[_0x082a('0x5b')]){throw new Error(_0x082a('0x67'));}return getAccessToken(_0x44ee8c);})[_0x082a('0x23')](function(_0x3c2cbf){if(_0x3c2cbf){return rp({'method':_0x082a('0x68'),'uri':util[_0x082a('0x69')](_0x082a('0x6a'),_0x1ca7f7),'qs':{'module':_0x082a('0x6b')},'headers':{'Authorization':_0x082a('0x6c')+_0x3c2cbf},'json':!![]});}})[_0x082a('0x23')](function(_0x1f2738){if(_0x1f2738){if(_0x1f2738[_0x082a('0x6d')]&&_0x1f2738[_0x082a('0x6d')][_0x082a('0x25')]){throw new Error(_0x1f2738[_0x082a('0x6d')][_0x082a('0x25')][_0x082a('0x6e')]);}var _0x3fe07e=[];var _0x2e2db5=[];var _0x2ab256=[_0x082a('0x6f'),_0x082a('0x70'),'Description',_0x082a('0x71'),_0x082a('0x72'),_0x082a('0x73'),_0x082a('0x74'),'Call_Type'];_0x2e2db5=_['remove'](_0x1f2738[_0x082a('0x31')],function(_0xb07577){return _0x2ab256[_0x082a('0x75')](_0xb07577[_0x082a('0x76')]);});for(var _0x2902c2=0x0;_0x2902c2<_0x2e2db5[_0x082a('0x32')];_0x2902c2++){if(_0x2e2db5[_0x2902c2]['system_mandatory']===![]){_0x3fe07e[_0x082a('0x77')]({'id':_0x2e2db5[_0x2902c2]['id'],'name':_0x2e2db5[_0x2902c2][_0x082a('0x78')],'custom':_0x2e2db5[_0x2902c2]['custom_field'],'options':_0x2e2db5[_0x2902c2][_0x082a('0x79')]===_0x082a('0x7a')&&_0x2e2db5[_0x2902c2][_0x082a('0x7b')]['length']>-0x1?_['map'](_0x2e2db5[_0x2902c2]['pick_list_values'],function(_0x2eda15){return{'name':_0x2eda15,'value':_0x2eda15};}):[]});}}return{'count':_0x3fe07e['length'],'rows':_0x3fe07e};}else{return{'count':0x0,'rows':[]};}})[_0x082a('0x23')](respondWithResult(_0xa04029,null))['catch'](function(_0x28afc8){var _0x5bf35b=_0x15a0ae[_0x082a('0x2d')][_0x082a('0x7c')]?0x1f4:_0x28afc8[_0x082a('0x7d')]||0x1f4;logger[_0x082a('0x25')](_0x082a('0x7e'),_0x082a('0x61'),_0x5bf35b,JSON[_0x082a('0x7f')](_0x28afc8));delete _0x28afc8[_0x082a('0x26')];if(_0x5bf35b===0x191){_0x5bf35b=0x190;}_0xa04029['status'](_0x5bf35b)[_0x082a('0x80')](_0x15a0ae['query'][_0x082a('0x7c')]?{'message':_0x082a('0x81'),'statusCode':_0x28afc8['statusCode']}:_0x28afc8);});}; \ No newline at end of file +var _0x773f=['Description','WhoId','Call_Duration','Call_Result','Call_Type','remove','push','display_label','custom_field','picklist','pick_list_values','statusCode','stringify','send','test','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','end','json','offset','undefined','limit','status','apply','reject','save','update','then','sendStatus','stack','name','index','map','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','ZohoAccount','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','options','find','create','body','getConfigurations','findOne','ZohoConfiguration','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZohoField','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','getFields','serverUrl','host','com','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','response','error','message','Subject'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x773f,0x8c));var _0xf773=function(_0x1e8b1e,_0x407bbd){_0x1e8b1e=_0x1e8b1e-0x0;var _0x4a0fde=_0x773f[_0x1e8b1e];return _0x4a0fde;};'use strict';var emlformat=require(_0xf773('0x0'));var rimraf=require(_0xf773('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf773('0x2'));var rp=require(_0xf773('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf773('0x4'));var util=require(_0xf773('0x5'));var path=require('path');var sox=require(_0xf773('0x6'));var csv=require(_0xf773('0x7'));var ejs=require(_0xf773('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf773('0x9'));var squel=require(_0xf773('0xa'));var crypto=require(_0xf773('0xb'));var jsforce=require(_0xf773('0xc'));var deskjs=require(_0xf773('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf773('0xe'));var Redis=require(_0xf773('0xf'));var authService=require(_0xf773('0x10'));var qs=require(_0xf773('0x11'));var as=require(_0xf773('0x12'));var hardwareService=require(_0xf773('0x13'));var logger=require('../../config/logger')(_0xf773('0x14'));var utils=require('../../config/utils');var config=require(_0xf773('0x15'));var licenseUtil=require(_0xf773('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0xf773('0x17'));function respondWithStatusCode(_0x42b29a,_0xb78661){_0xb78661=_0xb78661||0xcc;return function(_0x399810){if(_0x399810){return _0x42b29a['sendStatus'](_0xb78661);}return _0x42b29a['status'](_0xb78661)[_0xf773('0x18')]();};}function respondWithResult(_0x8fe220,_0x216278){_0x216278=_0x216278||0xc8;return function(_0x58cd90){if(_0x58cd90){return _0x8fe220['status'](_0x216278)[_0xf773('0x19')](_0x58cd90);}};}function respondWithFilteredResult(_0x31eafa,_0xb7a59d){return function(_0x20096c){if(_0x20096c){var _0x2d614f=typeof _0xb7a59d[_0xf773('0x1a')]===_0xf773('0x1b')&&typeof _0xb7a59d[_0xf773('0x1c')]===_0xf773('0x1b');var _0xbce9d8=_0x20096c['count'];var _0x50ceb4=_0x2d614f?0x0:_0xb7a59d[_0xf773('0x1a')];var _0x56c818=_0x2d614f?_0x20096c['count']:_0xb7a59d['offset']+_0xb7a59d[_0xf773('0x1c')];var _0x53eb03;if(_0x56c818>=_0xbce9d8){_0x56c818=_0xbce9d8;_0x53eb03=0xc8;}else{_0x53eb03=0xce;}_0x31eafa[_0xf773('0x1d')](_0x53eb03);return _0x31eafa['set']('Content-Range',_0x50ceb4+'-'+_0x56c818+'/'+_0xbce9d8)[_0xf773('0x19')](_0x20096c);}return null;};}function patchUpdates(_0x546fb1){return function(_0xbc1fee){try{jsonpatch[_0xf773('0x1e')](_0xbc1fee,_0x546fb1,!![]);}catch(_0x11e5ce){return BPromise[_0xf773('0x1f')](_0x11e5ce);}return _0xbc1fee[_0xf773('0x20')]();};}function saveUpdates(_0x27a552,_0x4ea912){return function(_0x6c19b8){if(_0x6c19b8){return _0x6c19b8[_0xf773('0x21')](_0x27a552)[_0xf773('0x22')](function(_0x125068){return _0x125068;});}return null;};}function removeEntity(_0x3926c0,_0x232310){return function(_0x9cad71){if(_0x9cad71){return _0x9cad71['destroy']()[_0xf773('0x22')](function(){_0x3926c0[_0xf773('0x1d')](0xcc)[_0xf773('0x18')]();});}};}function handleEntityNotFound(_0x742a7c,_0x3e5656){return function(_0x5b55b7){if(!_0x5b55b7){_0x742a7c[_0xf773('0x23')](0x194);}return _0x5b55b7;};}function handleError(_0xa47532,_0x18f469){_0x18f469=_0x18f469||0x1f4;return function(_0x483291){logger['error'](_0x483291[_0xf773('0x24')]);if(_0x483291[_0xf773('0x25')]){delete _0x483291['name'];}_0xa47532['status'](_0x18f469)['send'](_0x483291);};}exports[_0xf773('0x26')]=function(_0x3a8ae6,_0x17d43a){var _0x50eeb0={},_0x26ce90={},_0x46dcdb={'count':0x0,'rows':[]};var _0x3b5665=_[_0xf773('0x27')](db['ZohoAccount']['rawAttributes'],function(_0x4af81e){return{'name':_0x4af81e[_0xf773('0x28')],'type':_0x4af81e[_0xf773('0x29')]['key']};});_0x26ce90[_0xf773('0x2a')]=_[_0xf773('0x27')](_0x3b5665,_0xf773('0x25'));_0x26ce90['query']=_['keys'](_0x3a8ae6[_0xf773('0x2b')]);_0x26ce90[_0xf773('0x2c')]=_[_0xf773('0x2d')](_0x26ce90[_0xf773('0x2a')],_0x26ce90['query']);_0x50eeb0[_0xf773('0x2e')]=_['intersection'](_0x26ce90[_0xf773('0x2a')],qs['fields'](_0x3a8ae6['query'][_0xf773('0x2f')]));_0x50eeb0[_0xf773('0x2e')]=_0x50eeb0[_0xf773('0x2e')][_0xf773('0x30')]?_0x50eeb0['attributes']:_0x26ce90[_0xf773('0x2a')];if(!_0x3a8ae6[_0xf773('0x2b')][_0xf773('0x31')](_0xf773('0x32'))){_0x50eeb0['limit']=qs[_0xf773('0x1c')](_0x3a8ae6[_0xf773('0x2b')][_0xf773('0x1c')]);_0x50eeb0['offset']=qs['offset'](_0x3a8ae6[_0xf773('0x2b')]['offset']);}_0x50eeb0[_0xf773('0x33')]=qs['sort'](_0x3a8ae6[_0xf773('0x2b')][_0xf773('0x34')]);_0x50eeb0[_0xf773('0x35')]=qs[_0xf773('0x2c')](_[_0xf773('0x36')](_0x3a8ae6['query'],_0x26ce90[_0xf773('0x2c')]),_0x3b5665);if(_0x3a8ae6[_0xf773('0x2b')][_0xf773('0x37')]){_0x50eeb0[_0xf773('0x35')]=_[_0xf773('0x38')](_0x50eeb0[_0xf773('0x35')],{'$or':_['map'](_0x3b5665,function(_0xf66474){if(_0xf66474[_0xf773('0x29')]!==_0xf773('0x39')){var _0x14ad6c={};_0x14ad6c[_0xf66474[_0xf773('0x25')]]={'$like':'%'+_0x3a8ae6[_0xf773('0x2b')][_0xf773('0x37')]+'%'};return _0x14ad6c;}})});}_0x50eeb0=_['merge']({},_0x50eeb0,_0x3a8ae6['options']);var _0x1be4d5={'where':_0x50eeb0['where']};return db[_0xf773('0x3a')][_0xf773('0x3b')](_0x1be4d5)[_0xf773('0x22')](function(_0x5bd2cc){_0x46dcdb[_0xf773('0x3b')]=_0x5bd2cc;if(_0x3a8ae6[_0xf773('0x2b')][_0xf773('0x3c')]){_0x50eeb0[_0xf773('0x3d')]=[{'all':!![]}];}return db[_0xf773('0x3a')][_0xf773('0x3e')](_0x50eeb0);})[_0xf773('0x22')](function(_0x3a4505){_0x46dcdb[_0xf773('0x3f')]=_0x3a4505;return _0x46dcdb;})[_0xf773('0x22')](respondWithFilteredResult(_0x17d43a,_0x50eeb0))[_0xf773('0x40')](handleError(_0x17d43a,null));};exports[_0xf773('0x41')]=function(_0x353e9b,_0x468eb9){var _0x3d599f={'raw':![],'where':{'id':_0x353e9b[_0xf773('0x42')]['id']}},_0x1b1fba={};_0x1b1fba[_0xf773('0x2a')]=_['keys'](db[_0xf773('0x3a')][_0xf773('0x43')]);_0x1b1fba[_0xf773('0x2b')]=_[_0xf773('0x44')](_0x353e9b[_0xf773('0x2b')]);_0x1b1fba[_0xf773('0x2c')]=_['intersection'](_0x1b1fba['model'],_0x1b1fba[_0xf773('0x2b')]);_0x3d599f[_0xf773('0x2e')]=_['intersection'](_0x1b1fba['model'],qs[_0xf773('0x2f')](_0x353e9b[_0xf773('0x2b')][_0xf773('0x2f')]));_0x3d599f[_0xf773('0x2e')]=_0x3d599f['attributes'][_0xf773('0x30')]?_0x3d599f[_0xf773('0x2e')]:_0x1b1fba[_0xf773('0x2a')];if(_0x353e9b[_0xf773('0x2b')][_0xf773('0x3c')]){_0x3d599f['include']=[{'all':!![]}];}_0x3d599f=_['merge']({},_0x3d599f,_0x353e9b[_0xf773('0x45')]);return db[_0xf773('0x3a')][_0xf773('0x46')](_0x3d599f)['then'](handleEntityNotFound(_0x468eb9,null))[_0xf773('0x22')](respondWithResult(_0x468eb9,null))[_0xf773('0x40')](handleError(_0x468eb9,null));};exports[_0xf773('0x47')]=function(_0x5d6782,_0x50450e){return db[_0xf773('0x3a')]['create'](_0x5d6782['body'],{})[_0xf773('0x22')](respondWithResult(_0x50450e,0xc9))[_0xf773('0x40')](handleError(_0x50450e,null));};exports[_0xf773('0x21')]=function(_0x1aa0d1,_0x24946c){if(_0x1aa0d1[_0xf773('0x48')]['id']){delete _0x1aa0d1['body']['id'];}return db[_0xf773('0x3a')][_0xf773('0x46')]({'where':{'id':_0x1aa0d1[_0xf773('0x42')]['id']}})['then'](handleEntityNotFound(_0x24946c,null))[_0xf773('0x22')](saveUpdates(_0x1aa0d1[_0xf773('0x48')],null))[_0xf773('0x22')](respondWithResult(_0x24946c,null))['catch'](handleError(_0x24946c,null));};exports['destroy']=function(_0x561b7b,_0x51aa77){return db[_0xf773('0x3a')][_0xf773('0x46')]({'where':{'id':_0x561b7b['params']['id']}})[_0xf773('0x22')](handleEntityNotFound(_0x51aa77,null))[_0xf773('0x22')](removeEntity(_0x51aa77,null))[_0xf773('0x40')](handleError(_0x51aa77,null));};exports[_0xf773('0x49')]=function(_0x9473eb,_0x179a41,_0x4464b3){var _0x4e1b60={};var _0x4d86ad={};var _0x4bdda8;var _0x563878;return db[_0xf773('0x3a')][_0xf773('0x4a')]({'where':{'id':_0x9473eb[_0xf773('0x42')]['id']}})['then'](handleEntityNotFound(_0x179a41,null))[_0xf773('0x22')](function(_0x4b2cc2){if(_0x4b2cc2){_0x4bdda8=_0x4b2cc2;_0x4d86ad[_0xf773('0x2a')]=_[_0xf773('0x44')](db[_0xf773('0x4b')][_0xf773('0x43')]);_0x4d86ad[_0xf773('0x2b')]=_[_0xf773('0x44')](_0x9473eb[_0xf773('0x2b')]);_0x4d86ad[_0xf773('0x2c')]=_['intersection'](_0x4d86ad['model'],_0x4d86ad[_0xf773('0x2b')]);_0x4e1b60[_0xf773('0x2e')]=_['intersection'](_0x4d86ad[_0xf773('0x2a')],qs[_0xf773('0x2f')](_0x9473eb[_0xf773('0x2b')][_0xf773('0x2f')]));_0x4e1b60[_0xf773('0x2e')]=_0x4e1b60[_0xf773('0x2e')][_0xf773('0x30')]?_0x4e1b60[_0xf773('0x2e')]:_0x4d86ad[_0xf773('0x2a')];_0x4e1b60['order']=qs[_0xf773('0x34')](_0x9473eb['query'][_0xf773('0x34')]);_0x4e1b60[_0xf773('0x35')]=qs['filters'](_[_0xf773('0x36')](_0x9473eb[_0xf773('0x2b')],_0x4d86ad['filters']));if(_0x9473eb['query']['filter']){_0x4e1b60[_0xf773('0x35')]=_[_0xf773('0x38')](_0x4e1b60[_0xf773('0x35')],{'$or':_[_0xf773('0x27')](_0x4e1b60[_0xf773('0x2e')],function(_0x2c7112){var _0x19bf95={};_0x19bf95[_0x2c7112]={'$like':'%'+_0x9473eb[_0xf773('0x2b')][_0xf773('0x37')]+'%'};return _0x19bf95;})});}_0x4e1b60=_[_0xf773('0x38')]({},_0x4e1b60,_0x9473eb['options']);return _0x4bdda8[_0xf773('0x49')](_0x4e1b60);}})[_0xf773('0x22')](function(_0x1ca0c0){if(_0x1ca0c0){_0x563878=_0x1ca0c0['length'];if(!_0x9473eb[_0xf773('0x2b')][_0xf773('0x31')](_0xf773('0x32'))){_0x4e1b60[_0xf773('0x1c')]=qs[_0xf773('0x1c')](_0x9473eb['query'][_0xf773('0x1c')]);_0x4e1b60[_0xf773('0x1a')]=qs['offset'](_0x9473eb[_0xf773('0x2b')]['offset']);}return _0x4bdda8[_0xf773('0x49')](_0x4e1b60);}})[_0xf773('0x22')](function(_0x27b111){if(_0x27b111){return _0x27b111?{'count':_0x563878,'rows':_0x27b111}:null;}})[_0xf773('0x22')](respondWithResult(_0x179a41,null))['catch'](handleError(_0x179a41,null));};exports[_0xf773('0x4c')]=function(_0x246b9b,_0x2ca6c3,_0x50f956){if(_0x246b9b[_0xf773('0x48')]['id']){delete _0x246b9b[_0xf773('0x48')]['id'];}return db[_0xf773('0x3a')][_0xf773('0x4a')]({'where':{'id':_0x246b9b[_0xf773('0x42')]['id']}})[_0xf773('0x22')](handleEntityNotFound(_0x2ca6c3,null))[_0xf773('0x22')](function(_0x401cad){if(_0x401cad){_0x246b9b[_0xf773('0x48')]['AccountId']=_0x401cad['id'];_0x246b9b['body'][_0xf773('0x4d')]=integrations[_0xf773('0x4e')](_0x246b9b['body']['channel'],_0x246b9b[_0xf773('0x48')][_0xf773('0x29')]);_0x246b9b[_0xf773('0x48')][_0xf773('0x4f')]=integrations[_0xf773('0x50')](_0x246b9b[_0xf773('0x48')][_0xf773('0x51')],_0x246b9b[_0xf773('0x48')][_0xf773('0x29')]);return db[_0xf773('0x4b')]['create'](_0x246b9b[_0xf773('0x48')],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db[_0xf773('0x52')],'as':_0xf773('0x4f')}]});}return null;})['then'](respondWithResult(_0x2ca6c3,null))[_0xf773('0x40')](handleError(_0x2ca6c3,null));};function getAccessToken(_0x2ca73c){return new Promise(function(_0x4e7a59,_0x1d2286){var _0x425f18;switch(_0x2ca73c['zone']){case'US':_0x425f18=_0xf773('0x53');break;case'AU':_0x425f18=_0xf773('0x54');break;case'EU':_0x425f18=_0xf773('0x55');break;case'IN':_0x425f18=_0xf773('0x56');break;case'CN':_0x425f18=_0xf773('0x57');break;default:_0x425f18=_0xf773('0x55');break;}var _0x13c01e={'method':_0xf773('0x58'),'uri':_0x425f18+_0xf773('0x59'),'qs':{'refresh_token':_0x2ca73c[_0xf773('0x5a')],'client_id':_0x2ca73c[_0xf773('0x5b')],'client_secret':_0x2ca73c[_0xf773('0x5c')],'grant_type':_0xf773('0x5d')},'json':!![]};return rp(_0x13c01e)[_0xf773('0x22')](function(_0x208f28){if(_0x208f28['access_token']){_0x4e7a59(_0x208f28[_0xf773('0x5e')]);}else{_0x1d2286('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xf773('0x40')](function(_0x1d3760){_0x1d2286(_0x1d3760);});});}exports[_0xf773('0x5f')]=function(_0x56fa9b,_0x3ca4c2,_0x723cdc){var _0x5f3b1a,_0x2197d7,_0xdd7163,_0x22e09c,_0x54a74a;return db[_0xf773('0x3a')]['findOne']({'where':{'id':_0x56fa9b['params']['id']},'attributes':['id','host','zone',_0xf773('0x5b'),_0xf773('0x5c'),_0xf773('0x60'),'code',_0xf773('0x5a')]})[_0xf773('0x22')](handleEntityNotFound(_0x3ca4c2,null))[_0xf773('0x22')](function(_0x45e190){_0x54a74a=_0x45e190;_0x5f3b1a=_0x54a74a[_0xf773('0x61')];_0x2197d7=_0x5f3b1a==='zoho.eu'?'eu':_0xf773('0x62');_0xdd7163=_0x54a74a[_0xf773('0x60')];var _0x2c7b58=_0xdd7163['slice'](-0x1);if(_0x2c7b58==='/'||_0x2c7b58==='\x5c'||_0x2c7b58===':'){_0xdd7163=_0xdd7163[_0xf773('0x63')](0x0,_0xdd7163[_0xf773('0x64')](_0x2c7b58));}if(!_0x54a74a['refreshToken']){throw new Error(_0xf773('0x65'));}return getAccessToken(_0x54a74a);})[_0xf773('0x22')](function(_0x57dce7){if(_0x57dce7){return rp({'method':'GET','uri':util[_0xf773('0x66')](_0xf773('0x67'),_0x2197d7),'qs':{'module':'Calls'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x57dce7},'json':!![]});}})[_0xf773('0x22')](function(_0x4a3bc0){if(_0x4a3bc0){if(_0x4a3bc0[_0xf773('0x68')]&&_0x4a3bc0['response']['error']){throw new Error(_0x4a3bc0[_0xf773('0x68')][_0xf773('0x69')][_0xf773('0x6a')]);}var _0x4f31a2=[];var _0x714a41=[];var _0x3bbb64=['Owner',_0xf773('0x6b'),_0xf773('0x6c'),_0xf773('0x6d'),_0xf773('0x6e'),_0xf773('0x6f'),'Call_Start_Time',_0xf773('0x70')];_0x714a41=_[_0xf773('0x71')](_0x4a3bc0[_0xf773('0x2f')],function(_0x28ac71){return _0x3bbb64['includes'](_0x28ac71['api_name']);});for(var _0x52fefb=0x0;_0x52fefb<_0x714a41[_0xf773('0x30')];_0x52fefb++){if(_0x714a41[_0x52fefb]['system_mandatory']===![]){_0x4f31a2[_0xf773('0x72')]({'id':_0x714a41[_0x52fefb]['id'],'name':_0x714a41[_0x52fefb][_0xf773('0x73')],'custom':_0x714a41[_0x52fefb][_0xf773('0x74')],'options':_0x714a41[_0x52fefb]['data_type']===_0xf773('0x75')&&_0x714a41[_0x52fefb][_0xf773('0x76')]['length']>-0x1?_[_0xf773('0x27')](_0x714a41[_0x52fefb][_0xf773('0x76')],function(_0x2aa9a4){return{'name':_0x2aa9a4,'value':_0x2aa9a4};}):[]});}}return{'count':_0x4f31a2['length'],'rows':_0x4f31a2};}else{return{'count':0x0,'rows':[]};}})[_0xf773('0x22')](respondWithResult(_0x3ca4c2,null))[_0xf773('0x40')](function(_0x11c7da){var _0x520faa=_0x56fa9b[_0xf773('0x2b')]['test']?0x1f4:_0x11c7da[_0xf773('0x77')]||0x1f4;logger[_0xf773('0x69')]('getFields,\x20%s,\x20%s,\x20%s',_0xf773('0x5f'),_0x520faa,JSON[_0xf773('0x78')](_0x11c7da));delete _0x11c7da[_0xf773('0x25')];if(_0x520faa===0x191){_0x520faa=0x190;}_0x3ca4c2[_0xf773('0x1d')](_0x520faa)[_0xf773('0x79')](_0x56fa9b[_0xf773('0x2b')][_0xf773('0x7a')]?{'message':_0xf773('0x7b'),'statusCode':_0x11c7da[_0xf773('0x77')]}:_0x11c7da);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index aaac8de..688eedd 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 _0xc24a=['substring','https://accounts.zoho.com','https://accounts.zoho.com.au','clientId','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientSecret','code','host','slice','lastIndexOf','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','parse','refreshToken','refresh_token','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch'];(function(_0x5f0f68,_0x355e67){var _0x76d09e=function(_0x21395b){while(--_0x21395b){_0x5f0f68['push'](_0x5f0f68['shift']());}};_0x76d09e(++_0x355e67);}(_0xc24a,0xac));var _0xac24=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xc24a[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0xac24('0x0'));var util=require(_0xac24('0x1'));var logger=require(_0xac24('0x2'))('api');var moment=require('moment');var BPromise=require(_0xac24('0x3'));var rp=require(_0xac24('0x4'));var fs=require('fs');var path=require(_0xac24('0x5'));var rimraf=require(_0xac24('0x6'));var config=require(_0xac24('0x7'));var attributes=require('./intZohoAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xac24('0x8')]=function(_0x4fafb7,_0x5a6c7d){return _0x4fafb7[_0xac24('0x9')](_0xac24('0xa'),attributes,{'tableName':_0xac24('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x116178,_0x42896b,_0x2143fd){if(_0x116178[_0xac24('0xc')](_0xac24('0xd'))||_0x116178['changed'](_0xac24('0xe'))||_0x116178[_0xac24('0xc')]('clientId')||_0x116178[_0xac24('0xc')](_0xac24('0xf'))||_0x116178['changed'](_0xac24('0x10'))||_0x116178[_0xac24('0xc')](_0xac24('0x11'))){var _0x23ffc9,_0x12b684;_0x23ffc9=_0x116178['serverUrl'];var _0x19611e=_0x23ffc9[_0xac24('0x12')](-0x1);if(_0x19611e==='/'||_0x19611e==='\x5c'||_0x19611e===':'){_0x23ffc9=_0x23ffc9['substring'](0x0,_0x23ffc9[_0xac24('0x13')](_0x19611e));}switch(_0x116178[_0xac24('0xd')]){case'US':_0x12b684='https://accounts.zoho.com';break;case'AU':_0x12b684='https://accounts.zoho.com.au';break;case'IN':_0x12b684=_0xac24('0x14');break;case'CN':_0x12b684=_0xac24('0x15');break;default:_0x12b684='https://accounts.zoho.eu';break;}var _0x46612d={'method':_0xac24('0x16'),'uri':_0x12b684+_0xac24('0x17'),'form':{'grant_type':_0xac24('0x18'),'client_id':_0x116178['clientId'],'client_secret':_0x116178[_0xac24('0xf')],'redirect_uri':_0x116178['serverUrl'],'code':_0x116178[_0xac24('0x10')]},'headers':{'Content-Type':_0xac24('0x19')}};return rp(_0x46612d)[_0xac24('0x1a')](function(_0x1b123c){var _0x5e564e=JSON[_0xac24('0x1b')](_0x1b123c);if(_0x5e564e['refresh_token']){_0x116178[_0xac24('0x1c')]=_0x5e564e[_0xac24('0x1d')];logger[_0xac24('0x1e')](util['format'](_0xac24('0x1f'),_0x116178[_0xac24('0x20')],_0x116178['id']));}else{logger[_0xac24('0x21')](util[_0xac24('0x22')](_0xac24('0x23'),_0x116178[_0xac24('0x20')],_0x116178['id']),util[_0xac24('0x24')](_0x5e564e,{'showHidden':![],'depth':null}));}return _0x2143fd(null,_0x42896b);})[_0xac24('0x25')](function(_0x24e66b){logger['error'](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x116178[_0xac24('0x20')],_0x116178['id']),util[_0xac24('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x2143fd(_0x24e66b);});}else{return _0x2143fd(null,_0x42896b);}},'beforeUpdate':function(_0x31fdab,_0x2700ea,_0x43936e){if(_0x31fdab['changed'](_0xac24('0xd'))||_0x31fdab[_0xac24('0xc')](_0xac24('0xe'))||_0x31fdab[_0xac24('0xc')]('clientId')||_0x31fdab[_0xac24('0xc')]('clientSecret')||_0x31fdab[_0xac24('0xc')](_0xac24('0x10'))||_0x31fdab[_0xac24('0xc')]('host')){var _0x42bf5f,_0x51d79f;_0x42bf5f=_0x31fdab[_0xac24('0xe')];var _0x4566d3=_0x42bf5f[_0xac24('0x12')](-0x1);if(_0x4566d3==='/'||_0x4566d3==='\x5c'||_0x4566d3===':'){_0x42bf5f=_0x42bf5f[_0xac24('0x26')](0x0,_0x42bf5f[_0xac24('0x13')](_0x4566d3));}switch(_0x31fdab[_0xac24('0xd')]){case'US':_0x51d79f=_0xac24('0x27');break;case'AU':_0x51d79f=_0xac24('0x28');break;case'IN':_0x51d79f=_0xac24('0x14');break;case'CN':_0x51d79f=_0xac24('0x15');break;default:_0x51d79f='https://accounts.zoho.eu';break;}var _0x3f412e={'method':'POST','uri':_0x51d79f+_0xac24('0x17'),'form':{'grant_type':_0xac24('0x18'),'client_id':_0x31fdab[_0xac24('0x29')],'client_secret':_0x31fdab[_0xac24('0xf')],'redirect_uri':_0x31fdab['serverUrl'],'code':_0x31fdab[_0xac24('0x10')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x3f412e)[_0xac24('0x1a')](function(_0x4498bc){var _0x35d419=JSON[_0xac24('0x1b')](_0x4498bc);if(_0x35d419[_0xac24('0x1d')]){_0x31fdab[_0xac24('0x1c')]=_0x35d419['refresh_token'];logger['info'](util[_0xac24('0x22')](_0xac24('0x1f'),_0x31fdab[_0xac24('0x20')],_0x31fdab['id']));}else{logger[_0xac24('0x21')](util[_0xac24('0x22')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x31fdab[_0xac24('0x20')],_0x31fdab['id']),util[_0xac24('0x24')](_0x35d419,{'showHidden':![],'depth':null}));}return _0x43936e(null,_0x2700ea);})[_0xac24('0x25')](function(_0xda19de){logger[_0xac24('0x21')](util[_0xac24('0x22')](_0xac24('0x23'),_0x31fdab['name'],_0x31fdab['id']),util[_0xac24('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x43936e(_0xda19de);});}else{return _0x43936e(null,_0x2700ea);}}}});}; \ No newline at end of file +var _0x14c5=['code','host','slice','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','application/x-www-form-urlencoded','then','parse','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','name','inspect','catch','substring','POST','authorization_code','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','define','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x14c5,0x93));var _0x514c=function(_0x4265f8,_0x65586){_0x4265f8=_0x4265f8-0x0;var _0x14b4df=_0x14c5[_0x4265f8];return _0x14b4df;};'use strict';var _=require(_0x514c('0x0'));var util=require('util');var logger=require(_0x514c('0x1'))(_0x514c('0x2'));var moment=require(_0x514c('0x3'));var BPromise=require(_0x514c('0x4'));var rp=require(_0x514c('0x5'));var fs=require('fs');var path=require(_0x514c('0x6'));var rimraf=require('rimraf');var config=require(_0x514c('0x7'));var attributes=require(_0x514c('0x8'));var integrations=require(_0x514c('0x9'));module['exports']=function(_0x4c3689,_0x2a1faf){return _0x4c3689[_0x514c('0xa')]('ZohoAccount',attributes,{'tableName':_0x514c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5e7ff1,_0x2effb3,_0x9c4212){if(_0x5e7ff1[_0x514c('0xc')](_0x514c('0xd'))||_0x5e7ff1[_0x514c('0xc')](_0x514c('0xe'))||_0x5e7ff1[_0x514c('0xc')](_0x514c('0xf'))||_0x5e7ff1[_0x514c('0xc')](_0x514c('0x10'))||_0x5e7ff1[_0x514c('0xc')](_0x514c('0x11'))||_0x5e7ff1[_0x514c('0xc')](_0x514c('0x12'))){var _0x30b7fb,_0x3bf83c;_0x30b7fb=_0x5e7ff1['serverUrl'];var _0x3b12d6=_0x30b7fb[_0x514c('0x13')](-0x1);if(_0x3b12d6==='/'||_0x3b12d6==='\x5c'||_0x3b12d6===':'){_0x30b7fb=_0x30b7fb['substring'](0x0,_0x30b7fb[_0x514c('0x14')](_0x3b12d6));}switch(_0x5e7ff1[_0x514c('0xd')]){case'US':_0x3bf83c=_0x514c('0x15');break;case'AU':_0x3bf83c='https://accounts.zoho.com.au';break;case'IN':_0x3bf83c=_0x514c('0x16');break;case'CN':_0x3bf83c=_0x514c('0x17');break;default:_0x3bf83c=_0x514c('0x18');break;}var _0x27af85={'method':'POST','uri':_0x3bf83c+_0x514c('0x19'),'form':{'grant_type':'authorization_code','client_id':_0x5e7ff1[_0x514c('0xf')],'client_secret':_0x5e7ff1[_0x514c('0x10')],'redirect_uri':_0x5e7ff1[_0x514c('0xe')],'code':_0x5e7ff1[_0x514c('0x11')]},'headers':{'Content-Type':_0x514c('0x1a')}};return rp(_0x27af85)[_0x514c('0x1b')](function(_0x45de3a){var _0x17a02b=JSON[_0x514c('0x1c')](_0x45de3a);if(_0x17a02b[_0x514c('0x1d')]){_0x5e7ff1['refreshToken']=_0x17a02b['refresh_token'];logger[_0x514c('0x1e')](util[_0x514c('0x1f')](_0x514c('0x20'),_0x5e7ff1['name'],_0x5e7ff1['id']));}else{logger[_0x514c('0x21')](util[_0x514c('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5e7ff1[_0x514c('0x22')],_0x5e7ff1['id']),util[_0x514c('0x23')](_0x17a02b,{'showHidden':![],'depth':null}));}return _0x9c4212(null,_0x2effb3);})[_0x514c('0x24')](function(_0x1c06ac){logger[_0x514c('0x21')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5e7ff1[_0x514c('0x22')],_0x5e7ff1['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x9c4212(_0x1c06ac);});}else{return _0x9c4212(null,_0x2effb3);}},'beforeUpdate':function(_0x58e5c6,_0x5ac8d0,_0xa27d10){if(_0x58e5c6['changed']('zone')||_0x58e5c6['changed']('serverUrl')||_0x58e5c6[_0x514c('0xc')]('clientId')||_0x58e5c6[_0x514c('0xc')](_0x514c('0x10'))||_0x58e5c6[_0x514c('0xc')](_0x514c('0x11'))||_0x58e5c6[_0x514c('0xc')]('host')){var _0x154329,_0x4267fa;_0x154329=_0x58e5c6[_0x514c('0xe')];var _0x5d6861=_0x154329[_0x514c('0x13')](-0x1);if(_0x5d6861==='/'||_0x5d6861==='\x5c'||_0x5d6861===':'){_0x154329=_0x154329[_0x514c('0x25')](0x0,_0x154329[_0x514c('0x14')](_0x5d6861));}switch(_0x58e5c6['zone']){case'US':_0x4267fa=_0x514c('0x15');break;case'AU':_0x4267fa='https://accounts.zoho.com.au';break;case'IN':_0x4267fa=_0x514c('0x16');break;case'CN':_0x4267fa=_0x514c('0x17');break;default:_0x4267fa=_0x514c('0x18');break;}var _0x4a0756={'method':_0x514c('0x26'),'uri':_0x4267fa+'/oauth/v2/token','form':{'grant_type':_0x514c('0x27'),'client_id':_0x58e5c6[_0x514c('0xf')],'client_secret':_0x58e5c6['clientSecret'],'redirect_uri':_0x58e5c6['serverUrl'],'code':_0x58e5c6[_0x514c('0x11')]},'headers':{'Content-Type':_0x514c('0x1a')}};return rp(_0x4a0756)[_0x514c('0x1b')](function(_0x38570a){var _0x22e98b=JSON['parse'](_0x38570a);if(_0x22e98b[_0x514c('0x1d')]){_0x58e5c6['refreshToken']=_0x22e98b[_0x514c('0x1d')];logger[_0x514c('0x1e')](util['format'](_0x514c('0x20'),_0x58e5c6[_0x514c('0x22')],_0x58e5c6['id']));}else{logger['error'](util[_0x514c('0x1f')](_0x514c('0x28'),_0x58e5c6[_0x514c('0x22')],_0x58e5c6['id']),util['inspect'](_0x22e98b,{'showHidden':![],'depth':null}));}return _0xa27d10(null,_0x5ac8d0);})[_0x514c('0x24')](function(_0x479319){logger[_0x514c('0x21')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x58e5c6[_0x514c('0x22')],_0x58e5c6['id']),util[_0x514c('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0xa27d10(_0x479319);});}else{return _0xa27d10(null,_0x5ac8d0);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index b0f23b0..747c5d4 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 _0xac35=['raw','where','attributes','limit','include','model','debug','ShowZohoAccount','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ZohoAccount,\x20%s,\x20%s','result','catch','GetZohoAccount','ZohoAccount','findAll','options'];(function(_0x446dc8,_0x652260){var _0x4642bd=function(_0x37b88c){while(--_0x37b88c){_0x446dc8['push'](_0x446dc8['shift']());}};_0x4642bd(++_0x652260);}(_0xac35,0x141));var _0x5ac3=function(_0x2f1d2f,_0x527d85){_0x2f1d2f=_0x2f1d2f-0x0;var _0x2874cf=_0xac35[_0x2f1d2f];return _0x2874cf;};'use strict';var _=require(_0x5ac3('0x0'));var util=require(_0x5ac3('0x1'));var moment=require(_0x5ac3('0x2'));var BPromise=require(_0x5ac3('0x3'));var rs=require(_0x5ac3('0x4'));var fs=require('fs');var Redis=require(_0x5ac3('0x5'));var db=require(_0x5ac3('0x6'))['db'];var utils=require(_0x5ac3('0x7'));var logger=require(_0x5ac3('0x8'))(_0x5ac3('0x9'));var config=require(_0x5ac3('0xa'));var jayson=require(_0x5ac3('0xb'));var client=jayson[_0x5ac3('0xc')][_0x5ac3('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4c9a16,_0x77dc9f,_0x5e96cb){return new BPromise(function(_0x2a19b9,_0x1754d2){return client[_0x5ac3('0xe')](_0x4c9a16,_0x5e96cb)[_0x5ac3('0xf')](function(_0x378900){logger[_0x5ac3('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x77dc9f,_0x5ac3('0x11'));logger['debug'](_0x5ac3('0x12'),_0x77dc9f,_0x5ac3('0x11'),JSON[_0x5ac3('0x13')](_0x378900));if(_0x378900[_0x5ac3('0x14')]){if(_0x378900[_0x5ac3('0x14')][_0x5ac3('0x15')]===0x1f4){logger[_0x5ac3('0x14')]('ZohoAccount,\x20%s,\x20%s',_0x77dc9f,_0x378900[_0x5ac3('0x14')][_0x5ac3('0x16')]);return _0x1754d2(_0x378900[_0x5ac3('0x14')][_0x5ac3('0x16')]);}logger[_0x5ac3('0x14')](_0x5ac3('0x17'),_0x77dc9f,_0x378900[_0x5ac3('0x14')][_0x5ac3('0x16')]);return _0x2a19b9(_0x378900['error']['message']);}else{logger[_0x5ac3('0x10')](_0x5ac3('0x17'),_0x77dc9f,'request\x20sent');_0x2a19b9(_0x378900[_0x5ac3('0x18')]['message']);}})[_0x5ac3('0x19')](function(_0x18cad4){logger[_0x5ac3('0x14')]('ZohoAccount,\x20%s,\x20%s',_0x77dc9f,_0x18cad4);_0x1754d2(_0x18cad4);});});}exports[_0x5ac3('0x1a')]=function(_0x1c2566){var _0x200eca=this;return new Promise(function(_0x141128,_0x5aab00){return db[_0x5ac3('0x1b')][_0x5ac3('0x1c')]({'raw':_0x1c2566[_0x5ac3('0x1d')]?_0x1c2566[_0x5ac3('0x1d')][_0x5ac3('0x1e')]===undefined?!![]:![]:!![],'where':_0x1c2566[_0x5ac3('0x1d')]?_0x1c2566[_0x5ac3('0x1d')][_0x5ac3('0x1f')]||null:null,'attributes':_0x1c2566[_0x5ac3('0x1d')]?_0x1c2566[_0x5ac3('0x1d')][_0x5ac3('0x20')]||null:null,'limit':_0x1c2566[_0x5ac3('0x1d')]?_0x1c2566['options'][_0x5ac3('0x21')]||null:null,'include':_0x1c2566[_0x5ac3('0x1d')]?_0x1c2566[_0x5ac3('0x1d')][_0x5ac3('0x22')]?_['map'](_0x1c2566[_0x5ac3('0x1d')][_0x5ac3('0x22')],function(_0x2aa7c9){return{'model':db[_0x2aa7c9[_0x5ac3('0x23')]],'as':_0x2aa7c9['as'],'attributes':_0x2aa7c9['attributes'],'include':_0x2aa7c9[_0x5ac3('0x22')]?_['map'](_0x2aa7c9[_0x5ac3('0x22')],function(_0x481a72){return{'model':db[_0x481a72['model']],'as':_0x481a72['as'],'attributes':_0x481a72[_0x5ac3('0x20')],'include':_0x481a72[_0x5ac3('0x22')]?_['map'](_0x481a72[_0x5ac3('0x22')],function(_0x3912f6){return{'model':db[_0x3912f6[_0x5ac3('0x23')]],'as':_0x3912f6['as'],'attributes':_0x3912f6[_0x5ac3('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x452519){logger[_0x5ac3('0x10')](_0x5ac3('0x1a'),_0x1c2566);logger[_0x5ac3('0x24')](_0x5ac3('0x1a'),_0x1c2566,JSON[_0x5ac3('0x13')](_0x452519));_0x141128(_0x452519);})[_0x5ac3('0x19')](function(_0x5a1486){logger[_0x5ac3('0x14')](_0x5ac3('0x1a'),_0x5a1486[_0x5ac3('0x16')],_0x1c2566);_0x5aab00(_0x200eca['error'](0x1f4,_0x5a1486[_0x5ac3('0x16')]));});});};exports[_0x5ac3('0x25')]=function(_0x28c96e){var _0x5df562=this;return new Promise(function(_0x194c52,_0x484012){return db[_0x5ac3('0x1b')]['find']({'raw':_0x28c96e[_0x5ac3('0x1d')]?_0x28c96e[_0x5ac3('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x28c96e['options']?_0x28c96e['options'][_0x5ac3('0x1f')]||null:null,'attributes':_0x28c96e[_0x5ac3('0x1d')]?_0x28c96e['options'][_0x5ac3('0x20')]||null:null,'include':_0x28c96e[_0x5ac3('0x1d')]?_0x28c96e[_0x5ac3('0x1d')][_0x5ac3('0x22')]?_[_0x5ac3('0x26')](_0x28c96e[_0x5ac3('0x1d')]['include'],function(_0x4552ab){return{'model':db[_0x4552ab[_0x5ac3('0x23')]],'as':_0x4552ab['as'],'attributes':_0x4552ab[_0x5ac3('0x20')],'include':_0x4552ab[_0x5ac3('0x22')]?_['map'](_0x4552ab['include'],function(_0x3466ef){return{'model':db[_0x3466ef['model']],'as':_0x3466ef['as'],'attributes':_0x3466ef[_0x5ac3('0x20')],'include':_0x3466ef[_0x5ac3('0x22')]?_['map'](_0x3466ef[_0x5ac3('0x22')],function(_0x4e68ea){return{'model':db[_0x4e68ea[_0x5ac3('0x23')]],'as':_0x4e68ea['as'],'attributes':_0x4e68ea['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x21271a){logger[_0x5ac3('0x10')](_0x5ac3('0x25'),_0x28c96e);logger[_0x5ac3('0x24')]('ShowZohoAccount',_0x28c96e,JSON[_0x5ac3('0x13')](_0x21271a));_0x194c52(_0x21271a);})['catch'](function(_0xbefb42){logger[_0x5ac3('0x14')](_0x5ac3('0x25'),_0xbefb42[_0x5ac3('0x16')],_0x28c96e);_0x484012(_0x5df562[_0x5ac3('0x14')](0x1f4,_0xbefb42['message']));});});}; \ No newline at end of file +var _0xd26f=['GetZohoAccount','ZohoAccount','raw','options','limit','map','model','include','attributes','then','ShowZohoAccount','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x1ebef7,_0x1f9584){var _0x4b47e5=function(_0x3a25d0){while(--_0x3a25d0){_0x1ebef7['push'](_0x1ebef7['shift']());}};_0x4b47e5(++_0x1f9584);}(_0xd26f,0x113));var _0xfd26=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0xd26f[_0x1e7b16];return _0x37fadc;};'use strict';var _=require(_0xfd26('0x0'));var util=require(_0xfd26('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfd26('0x2'));var fs=require('fs');var Redis=require(_0xfd26('0x3'));var db=require(_0xfd26('0x4'))['db'];var utils=require(_0xfd26('0x5'));var logger=require(_0xfd26('0x6'))(_0xfd26('0x7'));var config=require(_0xfd26('0x8'));var jayson=require(_0xfd26('0x9'));var client=jayson[_0xfd26('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22b353,_0x3c148d,_0x1905a2){return new BPromise(function(_0x3d405f,_0x3c9154){return client[_0xfd26('0xb')](_0x22b353,_0x1905a2)['then'](function(_0xcf2fdb){logger[_0xfd26('0xc')](_0xfd26('0xd'),_0x3c148d,_0xfd26('0xe'));logger[_0xfd26('0xf')](_0xfd26('0x10'),_0x3c148d,'request\x20sent',JSON[_0xfd26('0x11')](_0xcf2fdb));if(_0xcf2fdb['error']){if(_0xcf2fdb[_0xfd26('0x12')]['code']===0x1f4){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x3c148d,_0xcf2fdb['error']['message']);return _0x3c9154(_0xcf2fdb[_0xfd26('0x12')][_0xfd26('0x13')]);}logger[_0xfd26('0x12')](_0xfd26('0xd'),_0x3c148d,_0xcf2fdb[_0xfd26('0x12')][_0xfd26('0x13')]);return _0x3d405f(_0xcf2fdb[_0xfd26('0x12')][_0xfd26('0x13')]);}else{logger[_0xfd26('0xc')](_0xfd26('0xd'),_0x3c148d,_0xfd26('0xe'));_0x3d405f(_0xcf2fdb[_0xfd26('0x14')][_0xfd26('0x13')]);}})[_0xfd26('0x15')](function(_0x2f9b37){logger['error'](_0xfd26('0xd'),_0x3c148d,_0x2f9b37);_0x3c9154(_0x2f9b37);});});}exports[_0xfd26('0x16')]=function(_0xeb7aeb){var _0x210dd4=this;return new Promise(function(_0x36a275,_0x5b3e8b){return db[_0xfd26('0x17')]['findAll']({'raw':_0xeb7aeb['options']?_0xeb7aeb['options'][_0xfd26('0x18')]===undefined?!![]:![]:!![],'where':_0xeb7aeb[_0xfd26('0x19')]?_0xeb7aeb['options']['where']||null:null,'attributes':_0xeb7aeb[_0xfd26('0x19')]?_0xeb7aeb[_0xfd26('0x19')]['attributes']||null:null,'limit':_0xeb7aeb[_0xfd26('0x19')]?_0xeb7aeb['options'][_0xfd26('0x1a')]||null:null,'include':_0xeb7aeb['options']?_0xeb7aeb[_0xfd26('0x19')]['include']?_[_0xfd26('0x1b')](_0xeb7aeb[_0xfd26('0x19')]['include'],function(_0x5f5d51){return{'model':db[_0x5f5d51[_0xfd26('0x1c')]],'as':_0x5f5d51['as'],'attributes':_0x5f5d51['attributes'],'include':_0x5f5d51[_0xfd26('0x1d')]?_[_0xfd26('0x1b')](_0x5f5d51[_0xfd26('0x1d')],function(_0x20be94){return{'model':db[_0x20be94[_0xfd26('0x1c')]],'as':_0x20be94['as'],'attributes':_0x20be94['attributes'],'include':_0x20be94[_0xfd26('0x1d')]?_['map'](_0x20be94[_0xfd26('0x1d')],function(_0x217a38){return{'model':db[_0x217a38['model']],'as':_0x217a38['as'],'attributes':_0x217a38[_0xfd26('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xfd26('0x1f')](function(_0x375c98){logger[_0xfd26('0xc')](_0xfd26('0x16'),_0xeb7aeb);logger[_0xfd26('0xf')](_0xfd26('0x16'),_0xeb7aeb,JSON[_0xfd26('0x11')](_0x375c98));_0x36a275(_0x375c98);})[_0xfd26('0x15')](function(_0x5b3be9){logger['error']('GetZohoAccount',_0x5b3be9['message'],_0xeb7aeb);_0x5b3e8b(_0x210dd4[_0xfd26('0x12')](0x1f4,_0x5b3be9['message']));});});};exports[_0xfd26('0x20')]=function(_0x944d20){var _0x481b18=this;return new Promise(function(_0x5d8dab,_0x2b166c){return db['ZohoAccount']['find']({'raw':_0x944d20[_0xfd26('0x19')]?_0x944d20[_0xfd26('0x19')][_0xfd26('0x18')]===undefined?!![]:![]:!![],'where':_0x944d20[_0xfd26('0x19')]?_0x944d20[_0xfd26('0x19')]['where']||null:null,'attributes':_0x944d20[_0xfd26('0x19')]?_0x944d20[_0xfd26('0x19')][_0xfd26('0x1e')]||null:null,'include':_0x944d20[_0xfd26('0x19')]?_0x944d20[_0xfd26('0x19')]['include']?_[_0xfd26('0x1b')](_0x944d20['options'][_0xfd26('0x1d')],function(_0x1f1e63){return{'model':db[_0x1f1e63[_0xfd26('0x1c')]],'as':_0x1f1e63['as'],'attributes':_0x1f1e63['attributes'],'include':_0x1f1e63[_0xfd26('0x1d')]?_[_0xfd26('0x1b')](_0x1f1e63[_0xfd26('0x1d')],function(_0xd76274){return{'model':db[_0xd76274['model']],'as':_0xd76274['as'],'attributes':_0xd76274['attributes'],'include':_0xd76274[_0xfd26('0x1d')]?_['map'](_0xd76274[_0xfd26('0x1d')],function(_0x57a5a4){return{'model':db[_0x57a5a4[_0xfd26('0x1c')]],'as':_0x57a5a4['as'],'attributes':_0x57a5a4[_0xfd26('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xfd26('0x1f')](function(_0x5ed9de){logger[_0xfd26('0xc')](_0xfd26('0x20'),_0x944d20);logger[_0xfd26('0xf')](_0xfd26('0x20'),_0x944d20,JSON['stringify'](_0x5ed9de));_0x5d8dab(_0x5ed9de);})[_0xfd26('0x15')](function(_0x50cca5){logger[_0xfd26('0x12')]('ShowZohoAccount',_0x50cca5[_0xfd26('0x13')],_0x944d20);_0x2b166c(_0x481b18[_0xfd26('0x12')](0x1f4,_0x50cca5[_0xfd26('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 48ae651..8abe5a2 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 _0x6746=['isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','create','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','./intZohoConfiguration.controller','get','index','/:id'];(function(_0x4e94e6,_0x374ae6){var _0x23c5ca=function(_0x3e7a2a){while(--_0x3e7a2a){_0x4e94e6['push'](_0x4e94e6['shift']());}};_0x23c5ca(++_0x374ae6);}(_0x6746,0x1c3));var _0x6674=function(_0x3ee55a,_0x19aeea){_0x3ee55a=_0x3ee55a-0x0;var _0x581800=_0x6746[_0x3ee55a];return _0x581800;};'use strict';var multer=require(_0x6674('0x0'));var util=require(_0x6674('0x1'));var path=require(_0x6674('0x2'));var timeout=require(_0x6674('0x3'));var express=require(_0x6674('0x4'));var router=express[_0x6674('0x5')]();var fs_extra=require(_0x6674('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6674('0x7'));router[_0x6674('0x8')]('/',auth['isAuthenticated'](),controller[_0x6674('0x9')]);router[_0x6674('0x8')](_0x6674('0xa'),auth[_0x6674('0xb')](),controller[_0x6674('0xc')]);router[_0x6674('0x8')](_0x6674('0xd'),auth[_0x6674('0xb')](),controller[_0x6674('0xe')]);router[_0x6674('0x8')](_0x6674('0xf'),auth['isAuthenticated'](),controller[_0x6674('0x10')]);router[_0x6674('0x8')](_0x6674('0x11'),auth['isAuthenticated'](),controller['getDescriptions']);router['post']('/',auth['isAuthenticated'](),controller[_0x6674('0x12')]);router[_0x6674('0x13')](_0x6674('0xa'),auth[_0x6674('0xb')](),controller[_0x6674('0x14')]);router['delete'](_0x6674('0xa'),auth[_0x6674('0xb')](),controller['destroy']);module[_0x6674('0x15')]=router; \ No newline at end of file +var _0xb5af=['update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put'];(function(_0x3a19ff,_0x12f13e){var _0x1bc675=function(_0x397b0b){while(--_0x397b0b){_0x3a19ff['push'](_0x3a19ff['shift']());}};_0x1bc675(++_0x12f13e);}(_0xb5af,0x142));var _0xfb5a=function(_0x19085d,_0x5d8bc0){_0x19085d=_0x19085d-0x0;var _0xdb3f69=_0xb5af[_0x19085d];return _0xdb3f69;};'use strict';var multer=require(_0xfb5a('0x0'));var util=require(_0xfb5a('0x1'));var path=require(_0xfb5a('0x2'));var timeout=require(_0xfb5a('0x3'));var express=require(_0xfb5a('0x4'));var router=express[_0xfb5a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xfb5a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xfb5a('0x7'));var controller=require('./intZohoConfiguration.controller');router[_0xfb5a('0x8')]('/',auth[_0xfb5a('0x9')](),controller['index']);router['get'](_0xfb5a('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xfb5a('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0xfb5a('0xb')]);router['get'](_0xfb5a('0xc'),auth[_0xfb5a('0x9')](),controller['getSubjects']);router[_0xfb5a('0x8')](_0xfb5a('0xd'),auth[_0xfb5a('0x9')](),controller[_0xfb5a('0xe')]);router[_0xfb5a('0xf')]('/',auth[_0xfb5a('0x9')](),controller[_0xfb5a('0x10')]);router[_0xfb5a('0x11')](_0xfb5a('0xa'),auth[_0xfb5a('0x9')](),controller[_0xfb5a('0x12')]);router['delete'](_0xfb5a('0xa'),auth[_0xfb5a('0x9')](),controller[_0xfb5a('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 8e6aada..0d4a664 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 _0x1f11=['ENUM','lead','contact','sequelize','STRING'];(function(_0xbe44e1,_0x5812fc){var _0x5e6e5f=function(_0x12745f){while(--_0x12745f){_0xbe44e1['push'](_0xbe44e1['shift']());}};_0x5e6e5f(++_0x5812fc);}(_0x1f11,0x76));var _0x11f1=function(_0x26cdb8,_0x19bada){_0x26cdb8=_0x26cdb8-0x0;var _0x34e540=_0x1f11[_0x26cdb8];return _0x34e540;};'use strict';var Sequelize=require(_0x11f1('0x0'));module['exports']={'name':{'type':Sequelize[_0x11f1('0x1')]},'moduleCreate':{'type':Sequelize[_0x11f1('0x2')](_0x11f1('0x3'),_0x11f1('0x4'),'nothing'),'defaultValue':_0x11f1('0x3')},'moduleSearch':{'type':Sequelize[_0x11f1('0x2')]('contact_lead',_0x11f1('0x4'),_0x11f1('0x3')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x11f1('0x1')]}}; \ No newline at end of file +var _0x24f5=['STRING','contact','nothing','lead','ENUM','contact_lead','sequelize','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x24f5,0x1ee));var _0x524f=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x24f5[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x524f('0x0'));module[_0x524f('0x1')]={'name':{'type':Sequelize[_0x524f('0x2')]},'moduleCreate':{'type':Sequelize['ENUM']('lead',_0x524f('0x3'),_0x524f('0x4')),'defaultValue':_0x524f('0x5')},'moduleSearch':{'type':Sequelize[_0x524f('0x6')](_0x524f('0x7'),_0x524f('0x3'),_0x524f('0x5')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x524f('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 8e9e6a3..fb65db9 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 _0x3a9d=['findOne','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','save','update','then','destroy','end','error','name','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','body','find','ZohoField','getFields'];(function(_0x2115e4,_0x412e30){var _0x37a713=function(_0x32985f){while(--_0x32985f){_0x2115e4['push'](_0x2115e4['shift']());}};_0x37a713(++_0x412e30);}(_0x3a9d,0x1ef));var _0xd3a9=function(_0x443468,_0x5c8c24){_0x443468=_0x443468-0x0;var _0xb723f=_0x3a9d[_0x443468];return _0xb723f;};'use strict';var emlformat=require(_0xd3a9('0x0'));var rimraf=require(_0xd3a9('0x1'));var zipdir=require(_0xd3a9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd3a9('0x3'));var moment=require(_0xd3a9('0x4'));var BPromise=require(_0xd3a9('0x5'));var Mustache=require(_0xd3a9('0x6'));var util=require('util');var path=require(_0xd3a9('0x7'));var sox=require(_0xd3a9('0x8'));var csv=require(_0xd3a9('0x9'));var ejs=require(_0xd3a9('0xa'));var fs=require('fs');var fs_extra=require(_0xd3a9('0xb'));var _=require(_0xd3a9('0xc'));var squel=require(_0xd3a9('0xd'));var crypto=require(_0xd3a9('0xe'));var jsforce=require(_0xd3a9('0xf'));var deskjs=require(_0xd3a9('0x10'));var toCsv=require(_0xd3a9('0x9'));var querystring=require(_0xd3a9('0x11'));var Papa=require(_0xd3a9('0x12'));var Redis=require(_0xd3a9('0x13'));var authService=require(_0xd3a9('0x14'));var qs=require(_0xd3a9('0x15'));var as=require(_0xd3a9('0x16'));var hardwareService=require(_0xd3a9('0x17'));var logger=require(_0xd3a9('0x18'))(_0xd3a9('0x19'));var utils=require(_0xd3a9('0x1a'));var config=require(_0xd3a9('0x1b'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5158fe,_0x3724a0){_0x3724a0=_0x3724a0||0xcc;return function(_0x3dadd7){if(_0x3dadd7){return _0x5158fe[_0xd3a9('0x1c')](_0x3724a0);}return _0x5158fe[_0xd3a9('0x1d')](_0x3724a0)['end']();};}function respondWithResult(_0x28597d,_0x2152b4){_0x2152b4=_0x2152b4||0xc8;return function(_0x147da9){if(_0x147da9){return _0x28597d[_0xd3a9('0x1d')](_0x2152b4)[_0xd3a9('0x1e')](_0x147da9);}};}function respondWithFilteredResult(_0x520214,_0x376293){return function(_0x2893ae){if(_0x2893ae){var _0x4c0032=typeof _0x376293[_0xd3a9('0x1f')]===_0xd3a9('0x20')&&typeof _0x376293['limit']==='undefined';var _0x1eec14=_0x2893ae[_0xd3a9('0x21')];var _0xa417be=_0x4c0032?0x0:_0x376293[_0xd3a9('0x1f')];var _0x3eb844=_0x4c0032?_0x2893ae['count']:_0x376293[_0xd3a9('0x1f')]+_0x376293[_0xd3a9('0x22')];var _0x9aa4da;if(_0x3eb844>=_0x1eec14){_0x3eb844=_0x1eec14;_0x9aa4da=0xc8;}else{_0x9aa4da=0xce;}_0x520214['status'](_0x9aa4da);return _0x520214['set'](_0xd3a9('0x23'),_0xa417be+'-'+_0x3eb844+'/'+_0x1eec14)[_0xd3a9('0x1e')](_0x2893ae);}return null;};}function patchUpdates(_0x18f5ef){return function(_0x1bfcd0){try{jsonpatch[_0xd3a9('0x24')](_0x1bfcd0,_0x18f5ef,!![]);}catch(_0x2b5b5e){return BPromise['reject'](_0x2b5b5e);}return _0x1bfcd0[_0xd3a9('0x25')]();};}function saveUpdates(_0x380aeb,_0xf059c5){return function(_0x5abf45){if(_0x5abf45){return _0x5abf45[_0xd3a9('0x26')](_0x380aeb)[_0xd3a9('0x27')](function(_0x1cfe0e){return _0x1cfe0e;});}return null;};}function removeEntity(_0x23df9d,_0x27c61f){return function(_0x4bb6bb){if(_0x4bb6bb){return _0x4bb6bb[_0xd3a9('0x28')]()[_0xd3a9('0x27')](function(){_0x23df9d[_0xd3a9('0x1d')](0xcc)[_0xd3a9('0x29')]();});}};}function handleEntityNotFound(_0x3163fa,_0x1f7645){return function(_0x349c3a){if(!_0x349c3a){_0x3163fa[_0xd3a9('0x1c')](0x194);}return _0x349c3a;};}function handleError(_0x26fee5,_0x2ed111){_0x2ed111=_0x2ed111||0x1f4;return function(_0x490b8d){logger[_0xd3a9('0x2a')](_0x490b8d['stack']);if(_0x490b8d[_0xd3a9('0x2b')]){delete _0x490b8d[_0xd3a9('0x2b')];}_0x26fee5[_0xd3a9('0x1d')](_0x2ed111)['send'](_0x490b8d);};}exports['index']=function(_0x4c7fdf,_0x27a6d5){var _0x10b24e={},_0x58dec2={},_0x4915d5={'count':0x0,'rows':[]};var _0x5a030b=_[_0xd3a9('0x2c')](db[_0xd3a9('0x2d')][_0xd3a9('0x2e')],function(_0x40fb47){return{'name':_0x40fb47[_0xd3a9('0x2f')],'type':_0x40fb47[_0xd3a9('0x30')][_0xd3a9('0x31')]};});_0x58dec2[_0xd3a9('0x32')]=_['map'](_0x5a030b,_0xd3a9('0x2b'));_0x58dec2[_0xd3a9('0x33')]=_['keys'](_0x4c7fdf['query']);_0x58dec2[_0xd3a9('0x34')]=_[_0xd3a9('0x35')](_0x58dec2[_0xd3a9('0x32')],_0x58dec2[_0xd3a9('0x33')]);_0x10b24e['attributes']=_[_0xd3a9('0x35')](_0x58dec2[_0xd3a9('0x32')],qs[_0xd3a9('0x36')](_0x4c7fdf[_0xd3a9('0x33')][_0xd3a9('0x36')]));_0x10b24e[_0xd3a9('0x37')]=_0x10b24e[_0xd3a9('0x37')][_0xd3a9('0x38')]?_0x10b24e[_0xd3a9('0x37')]:_0x58dec2[_0xd3a9('0x32')];if(!_0x4c7fdf[_0xd3a9('0x33')][_0xd3a9('0x39')](_0xd3a9('0x3a'))){_0x10b24e[_0xd3a9('0x22')]=qs[_0xd3a9('0x22')](_0x4c7fdf[_0xd3a9('0x33')][_0xd3a9('0x22')]);_0x10b24e[_0xd3a9('0x1f')]=qs[_0xd3a9('0x1f')](_0x4c7fdf[_0xd3a9('0x33')][_0xd3a9('0x1f')]);}_0x10b24e[_0xd3a9('0x3b')]=qs[_0xd3a9('0x3c')](_0x4c7fdf[_0xd3a9('0x33')][_0xd3a9('0x3c')]);_0x10b24e[_0xd3a9('0x3d')]=qs[_0xd3a9('0x34')](_[_0xd3a9('0x3e')](_0x4c7fdf['query'],_0x58dec2[_0xd3a9('0x34')]),_0x5a030b);if(_0x4c7fdf[_0xd3a9('0x33')][_0xd3a9('0x3f')]){_0x10b24e[_0xd3a9('0x3d')]=_[_0xd3a9('0x40')](_0x10b24e['where'],{'$or':_[_0xd3a9('0x2c')](_0x5a030b,function(_0x179634){if(_0x179634['type']!==_0xd3a9('0x41')){var _0x30eedf={};_0x30eedf[_0x179634[_0xd3a9('0x2b')]]={'$like':'%'+_0x4c7fdf[_0xd3a9('0x33')][_0xd3a9('0x3f')]+'%'};return _0x30eedf;}})});}_0x10b24e=_['merge']({},_0x10b24e,_0x4c7fdf[_0xd3a9('0x42')]);var _0x31a603={'where':_0x10b24e[_0xd3a9('0x3d')]};return db[_0xd3a9('0x2d')][_0xd3a9('0x21')](_0x31a603)['then'](function(_0x18ffa1){_0x4915d5['count']=_0x18ffa1;if(_0x4c7fdf[_0xd3a9('0x33')][_0xd3a9('0x43')]){_0x10b24e[_0xd3a9('0x44')]=[{'all':!![]}];}return db[_0xd3a9('0x2d')][_0xd3a9('0x45')](_0x10b24e);})[_0xd3a9('0x27')](function(_0x563de0){_0x4915d5[_0xd3a9('0x46')]=_0x563de0;return _0x4915d5;})[_0xd3a9('0x27')](respondWithFilteredResult(_0x27a6d5,_0x10b24e))[_0xd3a9('0x47')](handleError(_0x27a6d5,null));};exports[_0xd3a9('0x48')]=function(_0xc91591,_0x3ba7c5){var _0x120762={'raw':![],'where':{'id':_0xc91591[_0xd3a9('0x49')]['id']}},_0x3a6fd2={};_0x3a6fd2['model']=_[_0xd3a9('0x4a')](db[_0xd3a9('0x2d')][_0xd3a9('0x2e')]);_0x3a6fd2[_0xd3a9('0x33')]=_[_0xd3a9('0x4a')](_0xc91591[_0xd3a9('0x33')]);_0x3a6fd2[_0xd3a9('0x34')]=_[_0xd3a9('0x35')](_0x3a6fd2['model'],_0x3a6fd2[_0xd3a9('0x33')]);_0x120762['attributes']=_['intersection'](_0x3a6fd2[_0xd3a9('0x32')],qs[_0xd3a9('0x36')](_0xc91591[_0xd3a9('0x33')][_0xd3a9('0x36')]));_0x120762[_0xd3a9('0x37')]=_0x120762[_0xd3a9('0x37')]['length']?_0x120762[_0xd3a9('0x37')]:_0x3a6fd2['model'];if(_0xc91591[_0xd3a9('0x33')][_0xd3a9('0x43')]){_0x120762[_0xd3a9('0x44')]=[{'all':!![]}];}_0x120762=_[_0xd3a9('0x40')]({},_0x120762,_0xc91591[_0xd3a9('0x42')]);return db['ZohoConfiguration']['find'](_0x120762)[_0xd3a9('0x27')](handleEntityNotFound(_0x3ba7c5,null))[_0xd3a9('0x27')](respondWithResult(_0x3ba7c5,null))[_0xd3a9('0x47')](handleError(_0x3ba7c5,null));};exports['create']=function(_0x32e3c1,_0x3a877a){return db[_0xd3a9('0x2d')]['create'](_0x32e3c1[_0xd3a9('0x4b')],{})['then'](respondWithResult(_0x3a877a,0xc9))[_0xd3a9('0x47')](handleError(_0x3a877a,null));};exports[_0xd3a9('0x26')]=function(_0x5e5225,_0xefef7c){if(_0x5e5225['body']['id']){delete _0x5e5225[_0xd3a9('0x4b')]['id'];}return db[_0xd3a9('0x2d')]['find']({'where':{'id':_0x5e5225[_0xd3a9('0x49')]['id']}})[_0xd3a9('0x27')](handleEntityNotFound(_0xefef7c,null))[_0xd3a9('0x27')](saveUpdates(_0x5e5225[_0xd3a9('0x4b')],null))[_0xd3a9('0x27')](respondWithResult(_0xefef7c,null))['catch'](handleError(_0xefef7c,null));};exports[_0xd3a9('0x28')]=function(_0x4c2d97,_0x57a8c4){return db[_0xd3a9('0x2d')][_0xd3a9('0x4c')]({'where':{'id':_0x4c2d97[_0xd3a9('0x49')]['id']}})[_0xd3a9('0x27')](handleEntityNotFound(_0x57a8c4,null))['then'](removeEntity(_0x57a8c4,null))['catch'](handleError(_0x57a8c4,null));};exports['getFields']=function(_0x51f06d,_0x4307c1,_0x439054){var _0x1cb186={};var _0x328885={};var _0x1cef12;var _0x4e49a0;return db[_0xd3a9('0x2d')]['findOne']({'where':{'id':_0x51f06d[_0xd3a9('0x49')]['id']}})['then'](handleEntityNotFound(_0x4307c1,null))[_0xd3a9('0x27')](function(_0x4b6dbd){if(_0x4b6dbd){_0x1cef12=_0x4b6dbd;_0x328885[_0xd3a9('0x32')]=_[_0xd3a9('0x4a')](db[_0xd3a9('0x4d')][_0xd3a9('0x2e')]);_0x328885[_0xd3a9('0x33')]=_[_0xd3a9('0x4a')](_0x51f06d[_0xd3a9('0x33')]);_0x328885[_0xd3a9('0x34')]=_['intersection'](_0x328885['model'],_0x328885[_0xd3a9('0x33')]);_0x1cb186['attributes']=_[_0xd3a9('0x35')](_0x328885[_0xd3a9('0x32')],qs[_0xd3a9('0x36')](_0x51f06d[_0xd3a9('0x33')][_0xd3a9('0x36')]));_0x1cb186[_0xd3a9('0x37')]=_0x1cb186[_0xd3a9('0x37')]['length']?_0x1cb186[_0xd3a9('0x37')]:_0x328885[_0xd3a9('0x32')];_0x1cb186[_0xd3a9('0x3b')]=qs['sort'](_0x51f06d[_0xd3a9('0x33')][_0xd3a9('0x3c')]);_0x1cb186[_0xd3a9('0x3d')]=qs[_0xd3a9('0x34')](_['pick'](_0x51f06d[_0xd3a9('0x33')],_0x328885[_0xd3a9('0x34')]));if(_0x51f06d[_0xd3a9('0x33')]['filter']){_0x1cb186[_0xd3a9('0x3d')]=_[_0xd3a9('0x40')](_0x1cb186['where'],{'$or':_[_0xd3a9('0x2c')](_0x1cb186['attributes'],function(_0x528446){var _0x5e792a={};_0x5e792a[_0x528446]={'$like':'%'+_0x51f06d[_0xd3a9('0x33')][_0xd3a9('0x3f')]+'%'};return _0x5e792a;})});}_0x1cb186=_['merge']({},_0x1cb186,_0x51f06d[_0xd3a9('0x42')]);return _0x1cef12['getFields'](_0x1cb186);}})[_0xd3a9('0x27')](function(_0x3e7024){if(_0x3e7024){_0x4e49a0=_0x3e7024['length'];if(!_0x51f06d['query'][_0xd3a9('0x39')]('nolimit')){_0x1cb186[_0xd3a9('0x22')]=qs[_0xd3a9('0x22')](_0x51f06d['query'][_0xd3a9('0x22')]);_0x1cb186[_0xd3a9('0x1f')]=qs[_0xd3a9('0x1f')](_0x51f06d[_0xd3a9('0x33')][_0xd3a9('0x1f')]);}return _0x1cef12[_0xd3a9('0x4e')](_0x1cb186);}})[_0xd3a9('0x27')](function(_0xc02392){if(_0xc02392){return _0xc02392?{'count':_0x4e49a0,'rows':_0xc02392}:null;}})[_0xd3a9('0x27')](respondWithResult(_0x4307c1,null))[_0xd3a9('0x47')](handleError(_0x4307c1,null));};exports['getSubjects']=function(_0x419326,_0x4fc408,_0x176745){var _0x47d155={};var _0x5ed665={};var _0x19e78e;var _0x2a5e24;return db[_0xd3a9('0x2d')][_0xd3a9('0x4f')]({'where':{'id':_0x419326[_0xd3a9('0x49')]['id']}})[_0xd3a9('0x27')](handleEntityNotFound(_0x4fc408,null))[_0xd3a9('0x27')](function(_0x4f2fa8){if(_0x4f2fa8){_0x19e78e=_0x4f2fa8;_0x5ed665[_0xd3a9('0x32')]=_[_0xd3a9('0x4a')](db[_0xd3a9('0x4d')][_0xd3a9('0x2e')]);_0x5ed665[_0xd3a9('0x33')]=_[_0xd3a9('0x4a')](_0x419326[_0xd3a9('0x33')]);_0x5ed665[_0xd3a9('0x34')]=_[_0xd3a9('0x35')](_0x5ed665[_0xd3a9('0x32')],_0x5ed665[_0xd3a9('0x33')]);_0x47d155[_0xd3a9('0x37')]=_[_0xd3a9('0x35')](_0x5ed665['model'],qs[_0xd3a9('0x36')](_0x419326['query']['fields']));_0x47d155[_0xd3a9('0x37')]=_0x47d155[_0xd3a9('0x37')]['length']?_0x47d155[_0xd3a9('0x37')]:_0x5ed665['model'];_0x47d155[_0xd3a9('0x3b')]=qs[_0xd3a9('0x3c')](_0x419326[_0xd3a9('0x33')][_0xd3a9('0x3c')]);_0x47d155[_0xd3a9('0x3d')]=qs[_0xd3a9('0x34')](_['pick'](_0x419326[_0xd3a9('0x33')],_0x5ed665[_0xd3a9('0x34')]));if(_0x419326[_0xd3a9('0x33')][_0xd3a9('0x3f')]){_0x47d155[_0xd3a9('0x3d')]=_['merge'](_0x47d155[_0xd3a9('0x3d')],{'$or':_['map'](_0x47d155[_0xd3a9('0x37')],function(_0x1d3b01){var _0x248168={};_0x248168[_0x1d3b01]={'$like':'%'+_0x419326[_0xd3a9('0x33')][_0xd3a9('0x3f')]+'%'};return _0x248168;})});}_0x47d155=_[_0xd3a9('0x40')]({},_0x47d155,_0x419326[_0xd3a9('0x42')]);return _0x19e78e[_0xd3a9('0x50')](_0x47d155);}})[_0xd3a9('0x27')](function(_0x32e8b4){if(_0x32e8b4){_0x2a5e24=_0x32e8b4[_0xd3a9('0x38')];if(!_0x419326[_0xd3a9('0x33')][_0xd3a9('0x39')]('nolimit')){_0x47d155[_0xd3a9('0x22')]=qs[_0xd3a9('0x22')](_0x419326[_0xd3a9('0x33')][_0xd3a9('0x22')]);_0x47d155[_0xd3a9('0x1f')]=qs['offset'](_0x419326[_0xd3a9('0x33')][_0xd3a9('0x1f')]);}return _0x19e78e[_0xd3a9('0x50')](_0x47d155);}})[_0xd3a9('0x27')](function(_0x5a2456){if(_0x5a2456){return _0x5a2456?{'count':_0x2a5e24,'rows':_0x5a2456}:null;}})[_0xd3a9('0x27')](respondWithResult(_0x4fc408,null))[_0xd3a9('0x47')](handleError(_0x4fc408,null));};exports[_0xd3a9('0x51')]=function(_0x348a3a,_0x310ae2,_0x521771){var _0x89cb6e={};var _0x16382a={};var _0x42b8da;var _0x5a03d4;return db[_0xd3a9('0x2d')][_0xd3a9('0x4f')]({'where':{'id':_0x348a3a['params']['id']}})[_0xd3a9('0x27')](handleEntityNotFound(_0x310ae2,null))[_0xd3a9('0x27')](function(_0x3da81d){if(_0x3da81d){_0x42b8da=_0x3da81d;_0x16382a['model']=_['keys'](db[_0xd3a9('0x4d')]['rawAttributes']);_0x16382a[_0xd3a9('0x33')]=_[_0xd3a9('0x4a')](_0x348a3a[_0xd3a9('0x33')]);_0x16382a[_0xd3a9('0x34')]=_['intersection'](_0x16382a['model'],_0x16382a['query']);_0x89cb6e[_0xd3a9('0x37')]=_[_0xd3a9('0x35')](_0x16382a[_0xd3a9('0x32')],qs[_0xd3a9('0x36')](_0x348a3a[_0xd3a9('0x33')][_0xd3a9('0x36')]));_0x89cb6e[_0xd3a9('0x37')]=_0x89cb6e[_0xd3a9('0x37')]['length']?_0x89cb6e['attributes']:_0x16382a[_0xd3a9('0x32')];_0x89cb6e['order']=qs[_0xd3a9('0x3c')](_0x348a3a[_0xd3a9('0x33')]['sort']);_0x89cb6e[_0xd3a9('0x3d')]=qs[_0xd3a9('0x34')](_[_0xd3a9('0x3e')](_0x348a3a[_0xd3a9('0x33')],_0x16382a[_0xd3a9('0x34')]));if(_0x348a3a[_0xd3a9('0x33')][_0xd3a9('0x3f')]){_0x89cb6e['where']=_[_0xd3a9('0x40')](_0x89cb6e[_0xd3a9('0x3d')],{'$or':_['map'](_0x89cb6e[_0xd3a9('0x37')],function(_0x7230b1){var _0x1e7143={};_0x1e7143[_0x7230b1]={'$like':'%'+_0x348a3a[_0xd3a9('0x33')][_0xd3a9('0x3f')]+'%'};return _0x1e7143;})});}_0x89cb6e=_[_0xd3a9('0x40')]({},_0x89cb6e,_0x348a3a[_0xd3a9('0x42')]);return _0x42b8da[_0xd3a9('0x51')](_0x89cb6e);}})[_0xd3a9('0x27')](function(_0xda3407){if(_0xda3407){_0x5a03d4=_0xda3407[_0xd3a9('0x38')];if(!_0x348a3a[_0xd3a9('0x33')][_0xd3a9('0x39')](_0xd3a9('0x3a'))){_0x89cb6e[_0xd3a9('0x22')]=qs[_0xd3a9('0x22')](_0x348a3a[_0xd3a9('0x33')][_0xd3a9('0x22')]);_0x89cb6e[_0xd3a9('0x1f')]=qs[_0xd3a9('0x1f')](_0x348a3a[_0xd3a9('0x33')][_0xd3a9('0x1f')]);}return _0x42b8da[_0xd3a9('0x51')](_0x89cb6e);}})[_0xd3a9('0x27')](function(_0x153b87){if(_0x153b87){return _0x153b87?{'count':_0x5a03d4,'rows':_0x153b87}:null;}})[_0xd3a9('0x27')](respondWithResult(_0x310ae2,null))[_0xd3a9('0x47')](handleError(_0x310ae2,null));}; \ No newline at end of file +var _0x440a=['type','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','find','create','body','getFields','findOne','ZohoField','order','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','ZohoConfiguration','rawAttributes','fieldName'];(function(_0x5caff2,_0x43ce89){var _0x1eae63=function(_0x5d301c){while(--_0x5d301c){_0x5caff2['push'](_0x5caff2['shift']());}};_0x1eae63(++_0x43ce89);}(_0x440a,0xc8));var _0xa440=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x440a[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require(_0xa440('0x0'));var rimraf=require(_0xa440('0x1'));var zipdir=require(_0xa440('0x2'));var jsonpatch=require(_0xa440('0x3'));var rp=require(_0xa440('0x4'));var moment=require('moment');var BPromise=require(_0xa440('0x5'));var Mustache=require('mustache');var util=require(_0xa440('0x6'));var path=require(_0xa440('0x7'));var sox=require('sox');var csv=require(_0xa440('0x8'));var ejs=require(_0xa440('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa440('0xa'));var squel=require(_0xa440('0xb'));var crypto=require(_0xa440('0xc'));var jsforce=require(_0xa440('0xd'));var deskjs=require(_0xa440('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa440('0xf'));var Papa=require(_0xa440('0x10'));var Redis=require(_0xa440('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa440('0x12'));var as=require(_0xa440('0x13'));var hardwareService=require(_0xa440('0x14'));var logger=require('../../config/logger')(_0xa440('0x15'));var utils=require(_0xa440('0x16'));var config=require(_0xa440('0x17'));var licenseUtil=require(_0xa440('0x18'));var db=require(_0xa440('0x19'))['db'];function respondWithStatusCode(_0xe93581,_0x22dee3){_0x22dee3=_0x22dee3||0xcc;return function(_0x1cc2c6){if(_0x1cc2c6){return _0xe93581[_0xa440('0x1a')](_0x22dee3);}return _0xe93581[_0xa440('0x1b')](_0x22dee3)[_0xa440('0x1c')]();};}function respondWithResult(_0xf95da0,_0x2e0ca9){_0x2e0ca9=_0x2e0ca9||0xc8;return function(_0x18ce21){if(_0x18ce21){return _0xf95da0[_0xa440('0x1b')](_0x2e0ca9)[_0xa440('0x1d')](_0x18ce21);}};}function respondWithFilteredResult(_0x4f85ae,_0x3238dd){return function(_0x4d87b5){if(_0x4d87b5){var _0x3874af=typeof _0x3238dd[_0xa440('0x1e')]===_0xa440('0x1f')&&typeof _0x3238dd[_0xa440('0x20')]===_0xa440('0x1f');var _0x4b2310=_0x4d87b5[_0xa440('0x21')];var _0x317dce=_0x3874af?0x0:_0x3238dd[_0xa440('0x1e')];var _0x5f48a3=_0x3874af?_0x4d87b5[_0xa440('0x21')]:_0x3238dd[_0xa440('0x1e')]+_0x3238dd[_0xa440('0x20')];var _0x2c586e;if(_0x5f48a3>=_0x4b2310){_0x5f48a3=_0x4b2310;_0x2c586e=0xc8;}else{_0x2c586e=0xce;}_0x4f85ae['status'](_0x2c586e);return _0x4f85ae[_0xa440('0x22')](_0xa440('0x23'),_0x317dce+'-'+_0x5f48a3+'/'+_0x4b2310)[_0xa440('0x1d')](_0x4d87b5);}return null;};}function patchUpdates(_0x594785){return function(_0x175e8b){try{jsonpatch[_0xa440('0x24')](_0x175e8b,_0x594785,!![]);}catch(_0x6cfc2c){return BPromise['reject'](_0x6cfc2c);}return _0x175e8b[_0xa440('0x25')]();};}function saveUpdates(_0x2fc002,_0x5496d3){return function(_0x45fa71){if(_0x45fa71){return _0x45fa71[_0xa440('0x26')](_0x2fc002)[_0xa440('0x27')](function(_0x1513f3){return _0x1513f3;});}return null;};}function removeEntity(_0x2f075d,_0x417903){return function(_0x1b465e){if(_0x1b465e){return _0x1b465e[_0xa440('0x28')]()[_0xa440('0x27')](function(){_0x2f075d[_0xa440('0x1b')](0xcc)[_0xa440('0x1c')]();});}};}function handleEntityNotFound(_0xbab68b,_0x2a8ac2){return function(_0x15844e){if(!_0x15844e){_0xbab68b[_0xa440('0x1a')](0x194);}return _0x15844e;};}function handleError(_0x57a3f1,_0x4605d1){_0x4605d1=_0x4605d1||0x1f4;return function(_0x582298){logger[_0xa440('0x29')](_0x582298[_0xa440('0x2a')]);if(_0x582298[_0xa440('0x2b')]){delete _0x582298[_0xa440('0x2b')];}_0x57a3f1[_0xa440('0x1b')](_0x4605d1)[_0xa440('0x2c')](_0x582298);};}exports[_0xa440('0x2d')]=function(_0x3be1b0,_0x16c94a){var _0x21b280={},_0x285330={},_0x5c60dc={'count':0x0,'rows':[]};var _0x8cece3=_['map'](db[_0xa440('0x2e')][_0xa440('0x2f')],function(_0x437a84){return{'name':_0x437a84[_0xa440('0x30')],'type':_0x437a84[_0xa440('0x31')]['key']};});_0x285330[_0xa440('0x32')]=_[_0xa440('0x33')](_0x8cece3,_0xa440('0x2b'));_0x285330['query']=_[_0xa440('0x34')](_0x3be1b0[_0xa440('0x35')]);_0x285330[_0xa440('0x36')]=_[_0xa440('0x37')](_0x285330[_0xa440('0x32')],_0x285330[_0xa440('0x35')]);_0x21b280['attributes']=_['intersection'](_0x285330[_0xa440('0x32')],qs[_0xa440('0x38')](_0x3be1b0[_0xa440('0x35')][_0xa440('0x38')]));_0x21b280[_0xa440('0x39')]=_0x21b280[_0xa440('0x39')][_0xa440('0x3a')]?_0x21b280[_0xa440('0x39')]:_0x285330['model'];if(!_0x3be1b0[_0xa440('0x35')][_0xa440('0x3b')](_0xa440('0x3c'))){_0x21b280['limit']=qs[_0xa440('0x20')](_0x3be1b0[_0xa440('0x35')][_0xa440('0x20')]);_0x21b280[_0xa440('0x1e')]=qs[_0xa440('0x1e')](_0x3be1b0[_0xa440('0x35')][_0xa440('0x1e')]);}_0x21b280['order']=qs[_0xa440('0x3d')](_0x3be1b0[_0xa440('0x35')][_0xa440('0x3d')]);_0x21b280[_0xa440('0x3e')]=qs[_0xa440('0x36')](_[_0xa440('0x3f')](_0x3be1b0['query'],_0x285330[_0xa440('0x36')]),_0x8cece3);if(_0x3be1b0[_0xa440('0x35')]['filter']){_0x21b280[_0xa440('0x3e')]=_[_0xa440('0x40')](_0x21b280['where'],{'$or':_[_0xa440('0x33')](_0x8cece3,function(_0x4e817d){if(_0x4e817d[_0xa440('0x31')]!==_0xa440('0x41')){var _0x5b373a={};_0x5b373a[_0x4e817d[_0xa440('0x2b')]]={'$like':'%'+_0x3be1b0[_0xa440('0x35')][_0xa440('0x42')]+'%'};return _0x5b373a;}})});}_0x21b280=_[_0xa440('0x40')]({},_0x21b280,_0x3be1b0[_0xa440('0x43')]);var _0x482ad3={'where':_0x21b280[_0xa440('0x3e')]};return db[_0xa440('0x2e')][_0xa440('0x21')](_0x482ad3)[_0xa440('0x27')](function(_0x541c2f){_0x5c60dc[_0xa440('0x21')]=_0x541c2f;if(_0x3be1b0[_0xa440('0x35')][_0xa440('0x44')]){_0x21b280[_0xa440('0x45')]=[{'all':!![]}];}return db[_0xa440('0x2e')][_0xa440('0x46')](_0x21b280);})[_0xa440('0x27')](function(_0x4fa510){_0x5c60dc[_0xa440('0x47')]=_0x4fa510;return _0x5c60dc;})[_0xa440('0x27')](respondWithFilteredResult(_0x16c94a,_0x21b280))[_0xa440('0x48')](handleError(_0x16c94a,null));};exports['show']=function(_0x3de800,_0x2df25d){var _0xa106a1={'raw':![],'where':{'id':_0x3de800[_0xa440('0x49')]['id']}},_0x4ad915={};_0x4ad915[_0xa440('0x32')]=_[_0xa440('0x34')](db['ZohoConfiguration'][_0xa440('0x2f')]);_0x4ad915[_0xa440('0x35')]=_[_0xa440('0x34')](_0x3de800['query']);_0x4ad915['filters']=_['intersection'](_0x4ad915[_0xa440('0x32')],_0x4ad915[_0xa440('0x35')]);_0xa106a1['attributes']=_['intersection'](_0x4ad915[_0xa440('0x32')],qs[_0xa440('0x38')](_0x3de800[_0xa440('0x35')][_0xa440('0x38')]));_0xa106a1[_0xa440('0x39')]=_0xa106a1['attributes']['length']?_0xa106a1[_0xa440('0x39')]:_0x4ad915[_0xa440('0x32')];if(_0x3de800[_0xa440('0x35')][_0xa440('0x44')]){_0xa106a1['include']=[{'all':!![]}];}_0xa106a1=_['merge']({},_0xa106a1,_0x3de800[_0xa440('0x43')]);return db[_0xa440('0x2e')][_0xa440('0x4a')](_0xa106a1)['then'](handleEntityNotFound(_0x2df25d,null))[_0xa440('0x27')](respondWithResult(_0x2df25d,null))[_0xa440('0x48')](handleError(_0x2df25d,null));};exports[_0xa440('0x4b')]=function(_0x22916b,_0x2a488a){return db[_0xa440('0x2e')][_0xa440('0x4b')](_0x22916b[_0xa440('0x4c')],{})['then'](respondWithResult(_0x2a488a,0xc9))[_0xa440('0x48')](handleError(_0x2a488a,null));};exports[_0xa440('0x26')]=function(_0x52e20c,_0x259a8f){if(_0x52e20c[_0xa440('0x4c')]['id']){delete _0x52e20c[_0xa440('0x4c')]['id'];}return db['ZohoConfiguration'][_0xa440('0x4a')]({'where':{'id':_0x52e20c[_0xa440('0x49')]['id']}})[_0xa440('0x27')](handleEntityNotFound(_0x259a8f,null))[_0xa440('0x27')](saveUpdates(_0x52e20c['body'],null))[_0xa440('0x27')](respondWithResult(_0x259a8f,null))[_0xa440('0x48')](handleError(_0x259a8f,null));};exports['destroy']=function(_0x2fca25,_0x58f5fc){return db['ZohoConfiguration'][_0xa440('0x4a')]({'where':{'id':_0x2fca25[_0xa440('0x49')]['id']}})[_0xa440('0x27')](handleEntityNotFound(_0x58f5fc,null))[_0xa440('0x27')](removeEntity(_0x58f5fc,null))[_0xa440('0x48')](handleError(_0x58f5fc,null));};exports[_0xa440('0x4d')]=function(_0x33d77a,_0x4cd87f,_0x16809f){var _0x2e320e={};var _0x198a34={};var _0x33e4f5;var _0x32d9f1;return db[_0xa440('0x2e')][_0xa440('0x4e')]({'where':{'id':_0x33d77a[_0xa440('0x49')]['id']}})[_0xa440('0x27')](handleEntityNotFound(_0x4cd87f,null))['then'](function(_0x5409a2){if(_0x5409a2){_0x33e4f5=_0x5409a2;_0x198a34[_0xa440('0x32')]=_['keys'](db[_0xa440('0x4f')][_0xa440('0x2f')]);_0x198a34['query']=_[_0xa440('0x34')](_0x33d77a[_0xa440('0x35')]);_0x198a34['filters']=_[_0xa440('0x37')](_0x198a34[_0xa440('0x32')],_0x198a34[_0xa440('0x35')]);_0x2e320e[_0xa440('0x39')]=_[_0xa440('0x37')](_0x198a34['model'],qs[_0xa440('0x38')](_0x33d77a[_0xa440('0x35')][_0xa440('0x38')]));_0x2e320e[_0xa440('0x39')]=_0x2e320e[_0xa440('0x39')][_0xa440('0x3a')]?_0x2e320e[_0xa440('0x39')]:_0x198a34[_0xa440('0x32')];_0x2e320e[_0xa440('0x50')]=qs[_0xa440('0x3d')](_0x33d77a[_0xa440('0x35')][_0xa440('0x3d')]);_0x2e320e[_0xa440('0x3e')]=qs[_0xa440('0x36')](_[_0xa440('0x3f')](_0x33d77a[_0xa440('0x35')],_0x198a34[_0xa440('0x36')]));if(_0x33d77a[_0xa440('0x35')][_0xa440('0x42')]){_0x2e320e['where']=_['merge'](_0x2e320e[_0xa440('0x3e')],{'$or':_[_0xa440('0x33')](_0x2e320e[_0xa440('0x39')],function(_0x4506e1){var _0x36f852={};_0x36f852[_0x4506e1]={'$like':'%'+_0x33d77a['query'][_0xa440('0x42')]+'%'};return _0x36f852;})});}_0x2e320e=_[_0xa440('0x40')]({},_0x2e320e,_0x33d77a['options']);return _0x33e4f5[_0xa440('0x4d')](_0x2e320e);}})['then'](function(_0x3c05d8){if(_0x3c05d8){_0x32d9f1=_0x3c05d8[_0xa440('0x3a')];if(!_0x33d77a[_0xa440('0x35')]['hasOwnProperty'](_0xa440('0x3c'))){_0x2e320e[_0xa440('0x20')]=qs[_0xa440('0x20')](_0x33d77a[_0xa440('0x35')]['limit']);_0x2e320e[_0xa440('0x1e')]=qs['offset'](_0x33d77a[_0xa440('0x35')]['offset']);}return _0x33e4f5[_0xa440('0x4d')](_0x2e320e);}})['then'](function(_0x79fc81){if(_0x79fc81){return _0x79fc81?{'count':_0x32d9f1,'rows':_0x79fc81}:null;}})[_0xa440('0x27')](respondWithResult(_0x4cd87f,null))[_0xa440('0x48')](handleError(_0x4cd87f,null));};exports[_0xa440('0x51')]=function(_0x792a07,_0x51141b,_0x1701c8){var _0x580dd5={};var _0x203922={};var _0x288ff5;var _0x32cc5a;return db[_0xa440('0x2e')][_0xa440('0x4e')]({'where':{'id':_0x792a07['params']['id']}})['then'](handleEntityNotFound(_0x51141b,null))['then'](function(_0x359653){if(_0x359653){_0x288ff5=_0x359653;_0x203922[_0xa440('0x32')]=_[_0xa440('0x34')](db[_0xa440('0x4f')]['rawAttributes']);_0x203922['query']=_[_0xa440('0x34')](_0x792a07['query']);_0x203922['filters']=_[_0xa440('0x37')](_0x203922[_0xa440('0x32')],_0x203922[_0xa440('0x35')]);_0x580dd5[_0xa440('0x39')]=_['intersection'](_0x203922[_0xa440('0x32')],qs['fields'](_0x792a07[_0xa440('0x35')][_0xa440('0x38')]));_0x580dd5[_0xa440('0x39')]=_0x580dd5[_0xa440('0x39')][_0xa440('0x3a')]?_0x580dd5[_0xa440('0x39')]:_0x203922['model'];_0x580dd5[_0xa440('0x50')]=qs['sort'](_0x792a07[_0xa440('0x35')]['sort']);_0x580dd5[_0xa440('0x3e')]=qs[_0xa440('0x36')](_[_0xa440('0x3f')](_0x792a07['query'],_0x203922[_0xa440('0x36')]));if(_0x792a07[_0xa440('0x35')][_0xa440('0x42')]){_0x580dd5[_0xa440('0x3e')]=_[_0xa440('0x40')](_0x580dd5[_0xa440('0x3e')],{'$or':_[_0xa440('0x33')](_0x580dd5['attributes'],function(_0x55c09f){var _0x3ab60e={};_0x3ab60e[_0x55c09f]={'$like':'%'+_0x792a07[_0xa440('0x35')][_0xa440('0x42')]+'%'};return _0x3ab60e;})});}_0x580dd5=_['merge']({},_0x580dd5,_0x792a07['options']);return _0x288ff5[_0xa440('0x51')](_0x580dd5);}})[_0xa440('0x27')](function(_0x280ab5){if(_0x280ab5){_0x32cc5a=_0x280ab5[_0xa440('0x3a')];if(!_0x792a07[_0xa440('0x35')]['hasOwnProperty'](_0xa440('0x3c'))){_0x580dd5[_0xa440('0x20')]=qs[_0xa440('0x20')](_0x792a07['query'][_0xa440('0x20')]);_0x580dd5['offset']=qs[_0xa440('0x1e')](_0x792a07['query'][_0xa440('0x1e')]);}return _0x288ff5[_0xa440('0x51')](_0x580dd5);}})[_0xa440('0x27')](function(_0x57567e){if(_0x57567e){return _0x57567e?{'count':_0x32cc5a,'rows':_0x57567e}:null;}})[_0xa440('0x27')](respondWithResult(_0x51141b,null))[_0xa440('0x48')](handleError(_0x51141b,null));};exports['getDescriptions']=function(_0x1152b7,_0x3ef7a7,_0x19444c){var _0xa363f0={};var _0x2f4aaa={};var _0x409170;var _0x457ff1;return db[_0xa440('0x2e')]['findOne']({'where':{'id':_0x1152b7[_0xa440('0x49')]['id']}})[_0xa440('0x27')](handleEntityNotFound(_0x3ef7a7,null))[_0xa440('0x27')](function(_0x2b51b1){if(_0x2b51b1){_0x409170=_0x2b51b1;_0x2f4aaa[_0xa440('0x32')]=_[_0xa440('0x34')](db[_0xa440('0x4f')][_0xa440('0x2f')]);_0x2f4aaa[_0xa440('0x35')]=_[_0xa440('0x34')](_0x1152b7[_0xa440('0x35')]);_0x2f4aaa['filters']=_[_0xa440('0x37')](_0x2f4aaa[_0xa440('0x32')],_0x2f4aaa['query']);_0xa363f0[_0xa440('0x39')]=_[_0xa440('0x37')](_0x2f4aaa[_0xa440('0x32')],qs[_0xa440('0x38')](_0x1152b7[_0xa440('0x35')][_0xa440('0x38')]));_0xa363f0['attributes']=_0xa363f0['attributes']['length']?_0xa363f0[_0xa440('0x39')]:_0x2f4aaa[_0xa440('0x32')];_0xa363f0['order']=qs['sort'](_0x1152b7['query'][_0xa440('0x3d')]);_0xa363f0[_0xa440('0x3e')]=qs[_0xa440('0x36')](_[_0xa440('0x3f')](_0x1152b7[_0xa440('0x35')],_0x2f4aaa[_0xa440('0x36')]));if(_0x1152b7['query'][_0xa440('0x42')]){_0xa363f0[_0xa440('0x3e')]=_['merge'](_0xa363f0[_0xa440('0x3e')],{'$or':_[_0xa440('0x33')](_0xa363f0[_0xa440('0x39')],function(_0x271ee5){var _0x50d8ff={};_0x50d8ff[_0x271ee5]={'$like':'%'+_0x1152b7['query']['filter']+'%'};return _0x50d8ff;})});}_0xa363f0=_[_0xa440('0x40')]({},_0xa363f0,_0x1152b7[_0xa440('0x43')]);return _0x409170[_0xa440('0x52')](_0xa363f0);}})[_0xa440('0x27')](function(_0x45215a){if(_0x45215a){_0x457ff1=_0x45215a[_0xa440('0x3a')];if(!_0x1152b7[_0xa440('0x35')]['hasOwnProperty']('nolimit')){_0xa363f0[_0xa440('0x20')]=qs[_0xa440('0x20')](_0x1152b7['query']['limit']);_0xa363f0['offset']=qs['offset'](_0x1152b7[_0xa440('0x35')][_0xa440('0x1e')]);}return _0x409170[_0xa440('0x52')](_0xa363f0);}})['then'](function(_0x10f5d3){if(_0x10f5d3){return _0x10f5d3?{'count':_0x457ff1,'rows':_0x10f5d3}:null;}})[_0xa440('0x27')](respondWithResult(_0x3ef7a7,null))[_0xa440('0x48')](handleError(_0x3ef7a7,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index e9702e1..8bff872 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 _0x2860=['./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x18c860,_0x2455a3){var _0x4bf5ee=function(_0x5525f8){while(--_0x5525f8){_0x18c860['push'](_0x18c860['shift']());}};_0x4bf5ee(++_0x2455a3);}(_0x2860,0x163));var _0x0286=function(_0x53f275,_0x17c29e){_0x53f275=_0x53f275-0x0;var _0x1b6c12=_0x2860[_0x53f275];return _0x1b6c12;};'use strict';var _=require(_0x0286('0x0'));var util=require(_0x0286('0x1'));var logger=require(_0x0286('0x2'))(_0x0286('0x3'));var moment=require(_0x0286('0x4'));var BPromise=require(_0x0286('0x5'));var rp=require(_0x0286('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0286('0x7'));var config=require(_0x0286('0x8'));var attributes=require(_0x0286('0x9'));module[_0x0286('0xa')]=function(_0x3d7207,_0x16b85c){return _0x3d7207[_0x0286('0xb')](_0x0286('0xc'),attributes,{'tableName':_0x0286('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd5d2=['define','ZohoConfiguration','int_zoho_configurations','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports'];(function(_0x500c0,_0xdb6a03){var _0xdd146f=function(_0x2e8090){while(--_0x2e8090){_0x500c0['push'](_0x500c0['shift']());}};_0xdd146f(++_0xdb6a03);}(_0xd5d2,0x153));var _0x2d5d=function(_0x3edb33,_0xa4302d){_0x3edb33=_0x3edb33-0x0;var _0x238608=_0xd5d2[_0x3edb33];return _0x238608;};'use strict';var _=require('lodash');var util=require(_0x2d5d('0x0'));var logger=require(_0x2d5d('0x1'))('api');var moment=require('moment');var BPromise=require(_0x2d5d('0x2'));var rp=require(_0x2d5d('0x3'));var fs=require('fs');var path=require(_0x2d5d('0x4'));var rimraf=require(_0x2d5d('0x5'));var config=require(_0x2d5d('0x6'));var attributes=require(_0x2d5d('0x7'));module[_0x2d5d('0x8')]=function(_0x426af3,_0x31b723){return _0x426af3[_0x2d5d('0x9')](_0x2d5d('0xa'),attributes,{'tableName':_0x2d5d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index e1aacfc..bde1c5d 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 _0xcb6d=['then','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ZohoConfiguration,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','jayson/promise','http','request'];(function(_0x13a440,_0x5b72ff){var _0x3ec420=function(_0x4d4c59){while(--_0x4d4c59){_0x13a440['push'](_0x13a440['shift']());}};_0x3ec420(++_0x5b72ff);}(_0xcb6d,0xd2));var _0xdcb6=function(_0x4939b9,_0x4e40ff){_0x4939b9=_0x4939b9-0x0;var _0x29f822=_0xcb6d[_0x4939b9];return _0x29f822;};'use strict';var _=require(_0xdcb6('0x0'));var util=require(_0xdcb6('0x1'));var moment=require(_0xdcb6('0x2'));var BPromise=require(_0xdcb6('0x3'));var rs=require(_0xdcb6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdcb6('0x5'))(_0xdcb6('0x6'));var config=require('../../config/environment');var jayson=require(_0xdcb6('0x7'));var client=jayson['client'][_0xdcb6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4646d4,_0x394aae,_0x32f05f){return new BPromise(function(_0x37099e,_0x3ac6a5){return client[_0xdcb6('0x9')](_0x4646d4,_0x32f05f)[_0xdcb6('0xa')](function(_0x308698){logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x394aae,_0xdcb6('0xb'));logger[_0xdcb6('0xc')](_0xdcb6('0xd'),_0x394aae,_0xdcb6('0xb'),JSON[_0xdcb6('0xe')](_0x308698));if(_0x308698[_0xdcb6('0xf')]){if(_0x308698[_0xdcb6('0xf')][_0xdcb6('0x10')]===0x1f4){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x394aae,_0x308698['error'][_0xdcb6('0x11')]);return _0x3ac6a5(_0x308698[_0xdcb6('0xf')]['message']);}logger['error'](_0xdcb6('0x12'),_0x394aae,_0x308698[_0xdcb6('0xf')][_0xdcb6('0x11')]);return _0x37099e(_0x308698[_0xdcb6('0xf')][_0xdcb6('0x11')]);}else{logger[_0xdcb6('0x13')](_0xdcb6('0x12'),_0x394aae,_0xdcb6('0xb'));_0x37099e(_0x308698[_0xdcb6('0x14')][_0xdcb6('0x11')]);}})[_0xdcb6('0x15')](function(_0x4cb179){logger['error'](_0xdcb6('0x12'),_0x394aae,_0x4cb179);_0x3ac6a5(_0x4cb179);});});} \ No newline at end of file +var _0xf335=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xf335,0x19e));var _0x5f33=function(_0x5d4fd0,_0x5d604d){_0x5d4fd0=_0x5d4fd0-0x0;var _0x13cfa8=_0xf335[_0x5d4fd0];return _0x13cfa8;};'use strict';var _=require(_0x5f33('0x0'));var util=require(_0x5f33('0x1'));var moment=require(_0x5f33('0x2'));var BPromise=require(_0x5f33('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5f33('0x4'));var db=require(_0x5f33('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5f33('0x6'))(_0x5f33('0x7'));var config=require(_0x5f33('0x8'));var jayson=require(_0x5f33('0x9'));var client=jayson[_0x5f33('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x463614,_0x33eea7,_0x22ddb0){return new BPromise(function(_0x2c31cd,_0x44a1fe){return client[_0x5f33('0xb')](_0x463614,_0x22ddb0)['then'](function(_0xb0193e){logger['info'](_0x5f33('0xc'),_0x33eea7,_0x5f33('0xd'));logger['debug'](_0x5f33('0xe'),_0x33eea7,'request\x20sent',JSON[_0x5f33('0xf')](_0xb0193e));if(_0xb0193e[_0x5f33('0x10')]){if(_0xb0193e[_0x5f33('0x10')]['code']===0x1f4){logger[_0x5f33('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x33eea7,_0xb0193e[_0x5f33('0x10')][_0x5f33('0x11')]);return _0x44a1fe(_0xb0193e['error'][_0x5f33('0x11')]);}logger[_0x5f33('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x33eea7,_0xb0193e['error'][_0x5f33('0x11')]);return _0x2c31cd(_0xb0193e[_0x5f33('0x10')][_0x5f33('0x11')]);}else{logger[_0x5f33('0x12')](_0x5f33('0xc'),_0x33eea7,'request\x20sent');_0x2c31cd(_0xb0193e['result']['message']);}})[_0x5f33('0x13')](function(_0x2dd75e){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x33eea7,_0x2dd75e);_0x44a1fe(_0x2dd75e);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index ba833c4..f0a00c1 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 _0x9626=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x59cebf,_0x43d67f){var _0xf6eb26=function(_0x7ecad){while(--_0x7ecad){_0x59cebf['push'](_0x59cebf['shift']());}};_0xf6eb26(++_0x43d67f);}(_0x9626,0x11a));var _0x6962=function(_0x2f77ee,_0x2bff02){_0x2f77ee=_0x2f77ee-0x0;var _0x38d29a=_0x9626[_0x2f77ee];return _0x38d29a;};'use strict';var multer=require(_0x6962('0x0'));var util=require(_0x6962('0x1'));var path=require(_0x6962('0x2'));var timeout=require(_0x6962('0x3'));var express=require(_0x6962('0x4'));var router=express[_0x6962('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x6962('0x6'));var interaction=require(_0x6962('0x7'));var config=require('../../config/environment');var controller=require('./intZohoField.controller');router[_0x6962('0x8')]('/',auth[_0x6962('0x9')](),controller[_0x6962('0xa')]);router[_0x6962('0x8')](_0x6962('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x6962('0xc')]('/',auth[_0x6962('0x9')](),controller[_0x6962('0xd')]);router[_0x6962('0xe')]('/:id',auth[_0x6962('0x9')](),controller['update']);router[_0x6962('0xf')](_0x6962('0xb'),auth[_0x6962('0x9')](),controller[_0x6962('0x10')]);module[_0x6962('0x11')]=router; \ No newline at end of file +var _0x28c7=['create','put','update','delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','post'];(function(_0x131a8e,_0x2bb91b){var _0x1a0913=function(_0x18b3a7){while(--_0x18b3a7){_0x131a8e['push'](_0x131a8e['shift']());}};_0x1a0913(++_0x2bb91b);}(_0x28c7,0x125));var _0x728c=function(_0x2164f0,_0xcefe8f){_0x2164f0=_0x2164f0-0x0;var _0x3eb91a=_0x28c7[_0x2164f0];return _0x3eb91a;};'use strict';var multer=require('multer');var util=require(_0x728c('0x0'));var path=require(_0x728c('0x1'));var timeout=require(_0x728c('0x2'));var express=require('express');var router=express[_0x728c('0x3')]();var fs_extra=require(_0x728c('0x4'));var auth=require(_0x728c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x728c('0x6'));var controller=require('./intZohoField.controller');router['get']('/',auth[_0x728c('0x7')](),controller[_0x728c('0x8')]);router[_0x728c('0x9')](_0x728c('0xa'),auth['isAuthenticated'](),controller[_0x728c('0xb')]);router[_0x728c('0xc')]('/',auth[_0x728c('0x7')](),controller[_0x728c('0xd')]);router[_0x728c('0xe')](_0x728c('0xa'),auth[_0x728c('0x7')](),controller[_0x728c('0xf')]);router[_0x728c('0x10')](_0x728c('0xa'),auth[_0x728c('0x7')](),controller['destroy']);module[_0x728c('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 82d4bb9..ffd6ba5 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 _0x5ea7=['customVariable','keyValue','picklist','STRING','exports','ENUM','string'];(function(_0x12a7cf,_0xe94490){var _0x25ede6=function(_0x3936cf){while(--_0x3936cf){_0x12a7cf['push'](_0x12a7cf['shift']());}};_0x25ede6(++_0xe94490);}(_0x5ea7,0x9e));var _0x75ea=function(_0x1bd323,_0x1c16ab){_0x1bd323=_0x1bd323-0x0;var _0x13097b=_0x5ea7[_0x1bd323];return _0x13097b;};'use strict';var Sequelize=require('sequelize');module[_0x75ea('0x0')]={'type':{'type':Sequelize[_0x75ea('0x1')](_0x75ea('0x2'),'variable',_0x75ea('0x3'),_0x75ea('0x4'),_0x75ea('0x5')),'defaultValue':_0x75ea('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x75ea('0x1')](_0x75ea('0x2'),'variable',_0x75ea('0x3'))},'keyContent':{'type':Sequelize[_0x75ea('0x6')]},'idField':{'type':Sequelize[_0x75ea('0x6')]},'nameField':{'type':Sequelize[_0x75ea('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x75ea('0x6')]}}; \ No newline at end of file +var _0xac20=['BOOLEAN','sequelize','exports','ENUM','variable','customVariable','string','STRING'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xac20,0x89));var _0x0ac2=function(_0xc85cdd,_0x3b47c0){_0xc85cdd=_0xc85cdd-0x0;var _0x39407c=_0xac20[_0xc85cdd];return _0x39407c;};'use strict';var Sequelize=require(_0x0ac2('0x0'));module[_0x0ac2('0x1')]={'type':{'type':Sequelize[_0x0ac2('0x2')]('string',_0x0ac2('0x3'),_0x0ac2('0x4'),'keyValue','picklist'),'defaultValue':_0x0ac2('0x5')},'content':{'type':Sequelize[_0x0ac2('0x6')]},'key':{'type':Sequelize[_0x0ac2('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x0ac2('0x5'),_0x0ac2('0x3'),_0x0ac2('0x4'))},'keyContent':{'type':Sequelize[_0x0ac2('0x6')]},'idField':{'type':Sequelize[_0x0ac2('0x6')]},'nameField':{'type':Sequelize[_0x0ac2('0x6')]},'customField':{'type':Sequelize[_0x0ac2('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0ac2('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 03771df..69ebaa4 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 _0x568a=['desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','then','destroy','sendStatus','error','name','send','index','map','ZohoField','rawAttributes','fieldName','type','model','query','attributes','intersection','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','ejs','fs-extra','lodash','squel','jsforce'];(function(_0x4074d5,_0xa57194){var _0x502cfe=function(_0x345efa){while(--_0x345efa){_0x4074d5['push'](_0x4074d5['shift']());}};_0x502cfe(++_0xa57194);}(_0x568a,0xcd));var _0xa568=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0x568a[_0x50aa2e];return _0x5e07f0;};'use strict';var emlformat=require(_0xa568('0x0'));var rimraf=require(_0xa568('0x1'));var zipdir=require(_0xa568('0x2'));var jsonpatch=require(_0xa568('0x3'));var rp=require(_0xa568('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa568('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa568('0x6'));var fs=require('fs');var fs_extra=require(_0xa568('0x7'));var _=require(_0xa568('0x8'));var squel=require(_0xa568('0x9'));var crypto=require('crypto');var jsforce=require(_0xa568('0xa'));var deskjs=require(_0xa568('0xb'));var toCsv=require(_0xa568('0xc'));var querystring=require(_0xa568('0xd'));var Papa=require(_0xa568('0xe'));var Redis=require('ioredis');var authService=require(_0xa568('0xf'));var qs=require(_0xa568('0x10'));var as=require(_0xa568('0x11'));var hardwareService=require(_0xa568('0x12'));var logger=require('../../config/logger')(_0xa568('0x13'));var utils=require(_0xa568('0x14'));var config=require(_0xa568('0x15'));var licenseUtil=require(_0xa568('0x16'));var db=require(_0xa568('0x17'))['db'];function respondWithStatusCode(_0x1126a1,_0x214324){_0x214324=_0x214324||0xcc;return function(_0x5aa83b){if(_0x5aa83b){return _0x1126a1['sendStatus'](_0x214324);}return _0x1126a1[_0xa568('0x18')](_0x214324)[_0xa568('0x19')]();};}function respondWithResult(_0x21b122,_0x1f87a0){_0x1f87a0=_0x1f87a0||0xc8;return function(_0x38b111){if(_0x38b111){return _0x21b122[_0xa568('0x18')](_0x1f87a0)[_0xa568('0x1a')](_0x38b111);}};}function respondWithFilteredResult(_0x4a22bd,_0x4cc09e){return function(_0x2b1cff){if(_0x2b1cff){var _0x375730=typeof _0x4cc09e[_0xa568('0x1b')]===_0xa568('0x1c')&&typeof _0x4cc09e[_0xa568('0x1d')]==='undefined';var _0xdf0a0d=_0x2b1cff[_0xa568('0x1e')];var _0x4e661e=_0x375730?0x0:_0x4cc09e[_0xa568('0x1b')];var _0x1c9ce0=_0x375730?_0x2b1cff[_0xa568('0x1e')]:_0x4cc09e['offset']+_0x4cc09e[_0xa568('0x1d')];var _0x45b41f;if(_0x1c9ce0>=_0xdf0a0d){_0x1c9ce0=_0xdf0a0d;_0x45b41f=0xc8;}else{_0x45b41f=0xce;}_0x4a22bd[_0xa568('0x18')](_0x45b41f);return _0x4a22bd[_0xa568('0x1f')]('Content-Range',_0x4e661e+'-'+_0x1c9ce0+'/'+_0xdf0a0d)[_0xa568('0x1a')](_0x2b1cff);}return null;};}function patchUpdates(_0x56cc80){return function(_0x119c91){try{jsonpatch[_0xa568('0x20')](_0x119c91,_0x56cc80,!![]);}catch(_0x5e8476){return BPromise[_0xa568('0x21')](_0x5e8476);}return _0x119c91['save']();};}function saveUpdates(_0x22952b,_0x28f191){return function(_0x356d93){if(_0x356d93){return _0x356d93['update'](_0x22952b)[_0xa568('0x22')](function(_0x61cea4){return _0x61cea4;});}return null;};}function removeEntity(_0x4f082f,_0x5204f8){return function(_0x1cfc73){if(_0x1cfc73){return _0x1cfc73[_0xa568('0x23')]()[_0xa568('0x22')](function(){_0x4f082f[_0xa568('0x18')](0xcc)[_0xa568('0x19')]();});}};}function handleEntityNotFound(_0x5b30ee,_0x483844){return function(_0x4ba64e){if(!_0x4ba64e){_0x5b30ee[_0xa568('0x24')](0x194);}return _0x4ba64e;};}function handleError(_0x3ccbae,_0x3cd1ec){_0x3cd1ec=_0x3cd1ec||0x1f4;return function(_0x1c443d){logger[_0xa568('0x25')](_0x1c443d['stack']);if(_0x1c443d['name']){delete _0x1c443d[_0xa568('0x26')];}_0x3ccbae[_0xa568('0x18')](_0x3cd1ec)[_0xa568('0x27')](_0x1c443d);};}exports[_0xa568('0x28')]=function(_0x3fa7c3,_0x2838f7){var _0x1548d7={},_0x148211={},_0x37a3c5={'count':0x0,'rows':[]};var _0x52065a=_[_0xa568('0x29')](db[_0xa568('0x2a')][_0xa568('0x2b')],function(_0x38c92d){return{'name':_0x38c92d[_0xa568('0x2c')],'type':_0x38c92d[_0xa568('0x2d')]['key']};});_0x148211[_0xa568('0x2e')]=_[_0xa568('0x29')](_0x52065a,'name');_0x148211[_0xa568('0x2f')]=_['keys'](_0x3fa7c3[_0xa568('0x2f')]);_0x148211['filters']=_['intersection'](_0x148211[_0xa568('0x2e')],_0x148211[_0xa568('0x2f')]);_0x1548d7[_0xa568('0x30')]=_[_0xa568('0x31')](_0x148211[_0xa568('0x2e')],qs[_0xa568('0x32')](_0x3fa7c3[_0xa568('0x2f')]['fields']));_0x1548d7['attributes']=_0x1548d7[_0xa568('0x30')]['length']?_0x1548d7[_0xa568('0x30')]:_0x148211[_0xa568('0x2e')];if(!_0x3fa7c3[_0xa568('0x2f')][_0xa568('0x33')]('nolimit')){_0x1548d7['limit']=qs[_0xa568('0x1d')](_0x3fa7c3['query'][_0xa568('0x1d')]);_0x1548d7['offset']=qs[_0xa568('0x1b')](_0x3fa7c3['query']['offset']);}_0x1548d7[_0xa568('0x34')]=qs['sort'](_0x3fa7c3[_0xa568('0x2f')][_0xa568('0x35')]);_0x1548d7[_0xa568('0x36')]=qs[_0xa568('0x37')](_[_0xa568('0x38')](_0x3fa7c3[_0xa568('0x2f')],_0x148211[_0xa568('0x37')]),_0x52065a);if(_0x3fa7c3[_0xa568('0x2f')][_0xa568('0x39')]){_0x1548d7['where']=_[_0xa568('0x3a')](_0x1548d7[_0xa568('0x36')],{'$or':_[_0xa568('0x29')](_0x52065a,function(_0x517412){if(_0x517412[_0xa568('0x2d')]!=='VIRTUAL'){var _0x5297cc={};_0x5297cc[_0x517412[_0xa568('0x26')]]={'$like':'%'+_0x3fa7c3['query'][_0xa568('0x39')]+'%'};return _0x5297cc;}})});}_0x1548d7=_[_0xa568('0x3a')]({},_0x1548d7,_0x3fa7c3[_0xa568('0x3b')]);var _0x49ffea={'where':_0x1548d7['where']};return db[_0xa568('0x2a')][_0xa568('0x1e')](_0x49ffea)[_0xa568('0x22')](function(_0x5cade9){_0x37a3c5[_0xa568('0x1e')]=_0x5cade9;if(_0x3fa7c3['query'][_0xa568('0x3c')]){_0x1548d7[_0xa568('0x3d')]=[{'all':!![]}];}return db[_0xa568('0x2a')][_0xa568('0x3e')](_0x1548d7);})[_0xa568('0x22')](function(_0x42c5a3){_0x37a3c5[_0xa568('0x3f')]=_0x42c5a3;return _0x37a3c5;})[_0xa568('0x22')](respondWithFilteredResult(_0x2838f7,_0x1548d7))[_0xa568('0x40')](handleError(_0x2838f7,null));};exports[_0xa568('0x41')]=function(_0x2288e2,_0x1beb1f){var _0x5166cb={'raw':!![],'where':{'id':_0x2288e2[_0xa568('0x42')]['id']}},_0x254ac3={};_0x254ac3['model']=_[_0xa568('0x43')](db[_0xa568('0x2a')][_0xa568('0x2b')]);_0x254ac3['query']=_[_0xa568('0x43')](_0x2288e2[_0xa568('0x2f')]);_0x254ac3[_0xa568('0x37')]=_['intersection'](_0x254ac3[_0xa568('0x2e')],_0x254ac3['query']);_0x5166cb[_0xa568('0x30')]=_['intersection'](_0x254ac3[_0xa568('0x2e')],qs[_0xa568('0x32')](_0x2288e2[_0xa568('0x2f')][_0xa568('0x32')]));_0x5166cb[_0xa568('0x30')]=_0x5166cb['attributes']['length']?_0x5166cb[_0xa568('0x30')]:_0x254ac3[_0xa568('0x2e')];if(_0x2288e2['query'][_0xa568('0x3c')]){_0x5166cb[_0xa568('0x3d')]=[{'all':!![]}];}_0x5166cb=_['merge']({},_0x5166cb,_0x2288e2['options']);return db['ZohoField'][_0xa568('0x44')](_0x5166cb)[_0xa568('0x22')](handleEntityNotFound(_0x1beb1f,null))[_0xa568('0x22')](respondWithResult(_0x1beb1f,null))[_0xa568('0x40')](handleError(_0x1beb1f,null));};exports[_0xa568('0x45')]=function(_0x4c7c92,_0x49c32f){return db[_0xa568('0x2a')]['create'](_0x4c7c92[_0xa568('0x46')],{})['then'](respondWithResult(_0x49c32f,0xc9))[_0xa568('0x40')](handleError(_0x49c32f,null));};exports[_0xa568('0x47')]=function(_0x370cb2,_0x11ebf8){if(_0x370cb2['body']['id']){delete _0x370cb2[_0xa568('0x46')]['id'];}return db[_0xa568('0x2a')]['find']({'where':{'id':_0x370cb2[_0xa568('0x42')]['id']}})['then'](handleEntityNotFound(_0x11ebf8,null))['then'](saveUpdates(_0x370cb2[_0xa568('0x46')],null))[_0xa568('0x22')](respondWithResult(_0x11ebf8,null))['catch'](handleError(_0x11ebf8,null));};exports[_0xa568('0x23')]=function(_0x23ebac,_0x39884f){return db[_0xa568('0x2a')][_0xa568('0x44')]({'where':{'id':_0x23ebac[_0xa568('0x42')]['id']}})[_0xa568('0x22')](handleEntityNotFound(_0x39884f,null))[_0xa568('0x22')](removeEntity(_0x39884f,null))[_0xa568('0x40')](handleError(_0x39884f,null));}; \ No newline at end of file +var _0xdc09=['../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','error','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils'];(function(_0x12aa66,_0x2d35c1){var _0x53dfe9=function(_0x2ab011){while(--_0x2ab011){_0x12aa66['push'](_0x12aa66['shift']());}};_0x53dfe9(++_0x2d35c1);}(_0xdc09,0xc2));var _0x9dc0=function(_0x4e4f0e,_0x1c3892){_0x4e4f0e=_0x4e4f0e-0x0;var _0x1a7219=_0xdc09[_0x4e4f0e];return _0x1a7219;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9dc0('0x0'));var zipdir=require(_0x9dc0('0x1'));var jsonpatch=require(_0x9dc0('0x2'));var rp=require(_0x9dc0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9dc0('0x4'));var util=require(_0x9dc0('0x5'));var path=require('path');var sox=require(_0x9dc0('0x6'));var csv=require(_0x9dc0('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9dc0('0x8'));var squel=require(_0x9dc0('0x9'));var crypto=require(_0x9dc0('0xa'));var jsforce=require(_0x9dc0('0xb'));var deskjs=require(_0x9dc0('0xc'));var toCsv=require(_0x9dc0('0x7'));var querystring=require(_0x9dc0('0xd'));var Papa=require(_0x9dc0('0xe'));var Redis=require(_0x9dc0('0xf'));var authService=require(_0x9dc0('0x10'));var qs=require(_0x9dc0('0x11'));var as=require(_0x9dc0('0x12'));var hardwareService=require(_0x9dc0('0x13'));var logger=require('../../config/logger')(_0x9dc0('0x14'));var utils=require(_0x9dc0('0x15'));var config=require(_0x9dc0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9dc0('0x17'))['db'];function respondWithStatusCode(_0x21263a,_0x286d29){_0x286d29=_0x286d29||0xcc;return function(_0x1edfc1){if(_0x1edfc1){return _0x21263a[_0x9dc0('0x18')](_0x286d29);}return _0x21263a[_0x9dc0('0x19')](_0x286d29)[_0x9dc0('0x1a')]();};}function respondWithResult(_0x162edf,_0x3ebac7){_0x3ebac7=_0x3ebac7||0xc8;return function(_0x4fbd83){if(_0x4fbd83){return _0x162edf[_0x9dc0('0x19')](_0x3ebac7)['json'](_0x4fbd83);}};}function respondWithFilteredResult(_0x1e4233,_0x38c315){return function(_0x1df4d0){if(_0x1df4d0){var _0xd6d1a5=typeof _0x38c315[_0x9dc0('0x1b')]===_0x9dc0('0x1c')&&typeof _0x38c315[_0x9dc0('0x1d')]==='undefined';var _0x36fb7d=_0x1df4d0[_0x9dc0('0x1e')];var _0x4dda7c=_0xd6d1a5?0x0:_0x38c315[_0x9dc0('0x1b')];var _0x375b33=_0xd6d1a5?_0x1df4d0[_0x9dc0('0x1e')]:_0x38c315[_0x9dc0('0x1b')]+_0x38c315[_0x9dc0('0x1d')];var _0x57a35c;if(_0x375b33>=_0x36fb7d){_0x375b33=_0x36fb7d;_0x57a35c=0xc8;}else{_0x57a35c=0xce;}_0x1e4233[_0x9dc0('0x19')](_0x57a35c);return _0x1e4233[_0x9dc0('0x1f')](_0x9dc0('0x20'),_0x4dda7c+'-'+_0x375b33+'/'+_0x36fb7d)[_0x9dc0('0x21')](_0x1df4d0);}return null;};}function patchUpdates(_0x39e389){return function(_0x5afd8c){try{jsonpatch[_0x9dc0('0x22')](_0x5afd8c,_0x39e389,!![]);}catch(_0x356c23){return BPromise['reject'](_0x356c23);}return _0x5afd8c[_0x9dc0('0x23')]();};}function saveUpdates(_0x11903a,_0x544add){return function(_0x44b8a5){if(_0x44b8a5){return _0x44b8a5[_0x9dc0('0x24')](_0x11903a)[_0x9dc0('0x25')](function(_0x20ec6c){return _0x20ec6c;});}return null;};}function removeEntity(_0x2764b5,_0x350075){return function(_0x5e0e6c){if(_0x5e0e6c){return _0x5e0e6c[_0x9dc0('0x26')]()['then'](function(){_0x2764b5['status'](0xcc)[_0x9dc0('0x1a')]();});}};}function handleEntityNotFound(_0x1ba196,_0x45f3e8){return function(_0x217c36){if(!_0x217c36){_0x1ba196['sendStatus'](0x194);}return _0x217c36;};}function handleError(_0x4a94f9,_0x16f4f4){_0x16f4f4=_0x16f4f4||0x1f4;return function(_0x50c92c){logger[_0x9dc0('0x27')](_0x50c92c['stack']);if(_0x50c92c[_0x9dc0('0x28')]){delete _0x50c92c[_0x9dc0('0x28')];}_0x4a94f9[_0x9dc0('0x19')](_0x16f4f4)[_0x9dc0('0x29')](_0x50c92c);};}exports[_0x9dc0('0x2a')]=function(_0x318dbd,_0x49550c){var _0x3e2200={},_0x4804c8={},_0x3106ed={'count':0x0,'rows':[]};var _0x2dd19c=_[_0x9dc0('0x2b')](db[_0x9dc0('0x2c')][_0x9dc0('0x2d')],function(_0x3830fa){return{'name':_0x3830fa[_0x9dc0('0x2e')],'type':_0x3830fa[_0x9dc0('0x2f')][_0x9dc0('0x30')]};});_0x4804c8[_0x9dc0('0x31')]=_[_0x9dc0('0x2b')](_0x2dd19c,'name');_0x4804c8[_0x9dc0('0x32')]=_[_0x9dc0('0x33')](_0x318dbd[_0x9dc0('0x32')]);_0x4804c8[_0x9dc0('0x34')]=_[_0x9dc0('0x35')](_0x4804c8[_0x9dc0('0x31')],_0x4804c8['query']);_0x3e2200[_0x9dc0('0x36')]=_[_0x9dc0('0x35')](_0x4804c8[_0x9dc0('0x31')],qs[_0x9dc0('0x37')](_0x318dbd[_0x9dc0('0x32')][_0x9dc0('0x37')]));_0x3e2200[_0x9dc0('0x36')]=_0x3e2200[_0x9dc0('0x36')][_0x9dc0('0x38')]?_0x3e2200[_0x9dc0('0x36')]:_0x4804c8[_0x9dc0('0x31')];if(!_0x318dbd[_0x9dc0('0x32')][_0x9dc0('0x39')]('nolimit')){_0x3e2200[_0x9dc0('0x1d')]=qs[_0x9dc0('0x1d')](_0x318dbd[_0x9dc0('0x32')][_0x9dc0('0x1d')]);_0x3e2200[_0x9dc0('0x1b')]=qs[_0x9dc0('0x1b')](_0x318dbd[_0x9dc0('0x32')]['offset']);}_0x3e2200['order']=qs[_0x9dc0('0x3a')](_0x318dbd[_0x9dc0('0x32')][_0x9dc0('0x3a')]);_0x3e2200[_0x9dc0('0x3b')]=qs[_0x9dc0('0x34')](_['pick'](_0x318dbd[_0x9dc0('0x32')],_0x4804c8[_0x9dc0('0x34')]),_0x2dd19c);if(_0x318dbd[_0x9dc0('0x32')]['filter']){_0x3e2200[_0x9dc0('0x3b')]=_['merge'](_0x3e2200[_0x9dc0('0x3b')],{'$or':_[_0x9dc0('0x2b')](_0x2dd19c,function(_0x4873e8){if(_0x4873e8[_0x9dc0('0x2f')]!=='VIRTUAL'){var _0x51c40d={};_0x51c40d[_0x4873e8[_0x9dc0('0x28')]]={'$like':'%'+_0x318dbd[_0x9dc0('0x32')]['filter']+'%'};return _0x51c40d;}})});}_0x3e2200=_[_0x9dc0('0x3c')]({},_0x3e2200,_0x318dbd[_0x9dc0('0x3d')]);var _0x4ae9e8={'where':_0x3e2200['where']};return db['ZohoField'][_0x9dc0('0x1e')](_0x4ae9e8)[_0x9dc0('0x25')](function(_0x286060){_0x3106ed[_0x9dc0('0x1e')]=_0x286060;if(_0x318dbd[_0x9dc0('0x32')][_0x9dc0('0x3e')]){_0x3e2200[_0x9dc0('0x3f')]=[{'all':!![]}];}return db[_0x9dc0('0x2c')][_0x9dc0('0x40')](_0x3e2200);})[_0x9dc0('0x25')](function(_0x1b6a78){_0x3106ed[_0x9dc0('0x41')]=_0x1b6a78;return _0x3106ed;})[_0x9dc0('0x25')](respondWithFilteredResult(_0x49550c,_0x3e2200))['catch'](handleError(_0x49550c,null));};exports[_0x9dc0('0x42')]=function(_0x4b511c,_0x30ba18){var _0x27f520={'raw':!![],'where':{'id':_0x4b511c[_0x9dc0('0x43')]['id']}},_0x3dc758={};_0x3dc758[_0x9dc0('0x31')]=_['keys'](db['ZohoField'][_0x9dc0('0x2d')]);_0x3dc758['query']=_[_0x9dc0('0x33')](_0x4b511c['query']);_0x3dc758[_0x9dc0('0x34')]=_[_0x9dc0('0x35')](_0x3dc758[_0x9dc0('0x31')],_0x3dc758[_0x9dc0('0x32')]);_0x27f520[_0x9dc0('0x36')]=_['intersection'](_0x3dc758[_0x9dc0('0x31')],qs['fields'](_0x4b511c[_0x9dc0('0x32')][_0x9dc0('0x37')]));_0x27f520[_0x9dc0('0x36')]=_0x27f520[_0x9dc0('0x36')][_0x9dc0('0x38')]?_0x27f520[_0x9dc0('0x36')]:_0x3dc758['model'];if(_0x4b511c[_0x9dc0('0x32')][_0x9dc0('0x3e')]){_0x27f520['include']=[{'all':!![]}];}_0x27f520=_['merge']({},_0x27f520,_0x4b511c['options']);return db[_0x9dc0('0x2c')][_0x9dc0('0x44')](_0x27f520)[_0x9dc0('0x25')](handleEntityNotFound(_0x30ba18,null))[_0x9dc0('0x25')](respondWithResult(_0x30ba18,null))[_0x9dc0('0x45')](handleError(_0x30ba18,null));};exports['create']=function(_0x429a23,_0x5b7fee){return db[_0x9dc0('0x2c')][_0x9dc0('0x46')](_0x429a23[_0x9dc0('0x47')],{})[_0x9dc0('0x25')](respondWithResult(_0x5b7fee,0xc9))['catch'](handleError(_0x5b7fee,null));};exports['update']=function(_0x508b23,_0x457ac5){if(_0x508b23[_0x9dc0('0x47')]['id']){delete _0x508b23[_0x9dc0('0x47')]['id'];}return db[_0x9dc0('0x2c')][_0x9dc0('0x44')]({'where':{'id':_0x508b23[_0x9dc0('0x43')]['id']}})['then'](handleEntityNotFound(_0x457ac5,null))[_0x9dc0('0x25')](saveUpdates(_0x508b23['body'],null))[_0x9dc0('0x25')](respondWithResult(_0x457ac5,null))[_0x9dc0('0x45')](handleError(_0x457ac5,null));};exports[_0x9dc0('0x26')]=function(_0x5a95d6,_0x2c6636){return db[_0x9dc0('0x2c')][_0x9dc0('0x44')]({'where':{'id':_0x5a95d6[_0x9dc0('0x43')]['id']}})[_0x9dc0('0x25')](handleEntityNotFound(_0x2c6636,null))[_0x9dc0('0x25')](removeEntity(_0x2c6636,null))[_0x9dc0('0x45')](handleError(_0x2c6636,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index be9feb3..d10752a 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 _0x82c4=['moment','bluebird','request-promise','rimraf','./intZohoField.attributes','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','lodash','util','../../config/logger','api'];(function(_0xf97218,_0x4f4304){var _0x27f87a=function(_0x46202d){while(--_0x46202d){_0xf97218['push'](_0xf97218['shift']());}};_0x27f87a(++_0x4f4304);}(_0x82c4,0x1ca));var _0x482c=function(_0x5178fb,_0x121e19){_0x5178fb=_0x5178fb-0x0;var _0x348183=_0x82c4[_0x5178fb];return _0x348183;};'use strict';var _=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var logger=require(_0x482c('0x2'))(_0x482c('0x3'));var moment=require(_0x482c('0x4'));var BPromise=require(_0x482c('0x5'));var rp=require(_0x482c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x482c('0x7'));var config=require('../../config/environment');var attributes=require(_0x482c('0x8'));module['exports']=function(_0x477cf4,_0x5d7c76){return _0x477cf4[_0x482c('0x9')](_0x482c('0xa'),attributes,{'tableName':_0x482c('0xb'),'paranoid':![],'indexes':[{'name':_0x482c('0xc'),'fields':[_0x482c('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe3da=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','zoho_unique_index','idField','lodash','util','../../config/logger'];(function(_0x5e80a6,_0xc4c0d){var _0x239f6f=function(_0x5a7b7e){while(--_0x5a7b7e){_0x5e80a6['push'](_0x5e80a6['shift']());}};_0x239f6f(++_0xc4c0d);}(_0xe3da,0x1cd));var _0xae3d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe3da[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var logger=require(_0xae3d('0x2'))(_0xae3d('0x3'));var moment=require(_0xae3d('0x4'));var BPromise=require(_0xae3d('0x5'));var rp=require(_0xae3d('0x6'));var fs=require('fs');var path=require(_0xae3d('0x7'));var rimraf=require(_0xae3d('0x8'));var config=require(_0xae3d('0x9'));var attributes=require(_0xae3d('0xa'));module[_0xae3d('0xb')]=function(_0xa9a1a,_0xa54808){return _0xa9a1a[_0xae3d('0xc')](_0xae3d('0xd'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0xae3d('0xe'),'fields':[_0xae3d('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index e3e0d0b..4df4452 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 _0x96ac=['info','request\x20sent','stringify','error','code','ZohoField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then'];(function(_0x90a39a,_0x32020d){var _0x2b62f7=function(_0x6841cc){while(--_0x6841cc){_0x90a39a['push'](_0x90a39a['shift']());}};_0x2b62f7(++_0x32020d);}(_0x96ac,0x1ec));var _0xc96a=function(_0x5d3ff0,_0x4561a8){_0x5d3ff0=_0x5d3ff0-0x0;var _0x2aa4d1=_0x96ac[_0x5d3ff0];return _0x2aa4d1;};'use strict';var _=require(_0xc96a('0x0'));var util=require(_0xc96a('0x1'));var moment=require(_0xc96a('0x2'));var BPromise=require(_0xc96a('0x3'));var rs=require(_0xc96a('0x4'));var fs=require('fs');var Redis=require(_0xc96a('0x5'));var db=require(_0xc96a('0x6'))['db'];var utils=require(_0xc96a('0x7'));var logger=require(_0xc96a('0x8'))(_0xc96a('0x9'));var config=require('../../config/environment');var jayson=require(_0xc96a('0xa'));var client=jayson[_0xc96a('0xb')][_0xc96a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5ba698,_0x5b26f8,_0x53f219){return new BPromise(function(_0x434089,_0x9923e3){return client['request'](_0x5ba698,_0x53f219)[_0xc96a('0xd')](function(_0x47fe4d){logger[_0xc96a('0xe')]('ZohoField,\x20%s,\x20%s',_0x5b26f8,_0xc96a('0xf'));logger['debug']('ZohoField,\x20%s,\x20%s,\x20%s',_0x5b26f8,_0xc96a('0xf'),JSON[_0xc96a('0x10')](_0x47fe4d));if(_0x47fe4d[_0xc96a('0x11')]){if(_0x47fe4d[_0xc96a('0x11')][_0xc96a('0x12')]===0x1f4){logger[_0xc96a('0x11')](_0xc96a('0x13'),_0x5b26f8,_0x47fe4d[_0xc96a('0x11')][_0xc96a('0x14')]);return _0x9923e3(_0x47fe4d[_0xc96a('0x11')][_0xc96a('0x14')]);}logger[_0xc96a('0x11')](_0xc96a('0x13'),_0x5b26f8,_0x47fe4d[_0xc96a('0x11')][_0xc96a('0x14')]);return _0x434089(_0x47fe4d[_0xc96a('0x11')][_0xc96a('0x14')]);}else{logger[_0xc96a('0xe')]('ZohoField,\x20%s,\x20%s',_0x5b26f8,'request\x20sent');_0x434089(_0x47fe4d[_0xc96a('0x15')][_0xc96a('0x14')]);}})[_0xc96a('0x16')](function(_0x2e3079){logger['error']('ZohoField,\x20%s,\x20%s',_0x5b26f8,_0x2e3079);_0x9923e3(_0x2e3079);});});} \ No newline at end of file +var _0xeb9a=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','moment','randomstring','ioredis'];(function(_0x1f0895,_0x320671){var _0x586aaa=function(_0x35fe32){while(--_0x35fe32){_0x1f0895['push'](_0x1f0895['shift']());}};_0x586aaa(++_0x320671);}(_0xeb9a,0x18c));var _0xaeb9=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0xeb9a[_0x5cb1af];return _0x8d7940;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xaeb9('0x0'));var BPromise=require('bluebird');var rs=require(_0xaeb9('0x1'));var fs=require('fs');var Redis=require(_0xaeb9('0x2'));var db=require(_0xaeb9('0x3'))['db'];var utils=require(_0xaeb9('0x4'));var logger=require(_0xaeb9('0x5'))(_0xaeb9('0x6'));var config=require(_0xaeb9('0x7'));var jayson=require(_0xaeb9('0x8'));var client=jayson['client'][_0xaeb9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23336c,_0x33dee2,_0x498742){return new BPromise(function(_0x59ab61,_0x5459f8){return client[_0xaeb9('0xa')](_0x23336c,_0x498742)['then'](function(_0x5d2849){logger['info'](_0xaeb9('0xb'),_0x33dee2,_0xaeb9('0xc'));logger[_0xaeb9('0xd')](_0xaeb9('0xe'),_0x33dee2,_0xaeb9('0xc'),JSON[_0xaeb9('0xf')](_0x5d2849));if(_0x5d2849[_0xaeb9('0x10')]){if(_0x5d2849[_0xaeb9('0x10')][_0xaeb9('0x11')]===0x1f4){logger[_0xaeb9('0x10')](_0xaeb9('0xb'),_0x33dee2,_0x5d2849[_0xaeb9('0x10')][_0xaeb9('0x12')]);return _0x5459f8(_0x5d2849['error'][_0xaeb9('0x12')]);}logger[_0xaeb9('0x10')]('ZohoField,\x20%s,\x20%s',_0x33dee2,_0x5d2849[_0xaeb9('0x10')][_0xaeb9('0x12')]);return _0x59ab61(_0x5d2849[_0xaeb9('0x10')]['message']);}else{logger[_0xaeb9('0x13')](_0xaeb9('0xb'),_0x33dee2,_0xaeb9('0xc'));_0x59ab61(_0x5d2849[_0xaeb9('0x14')][_0xaeb9('0x12')]);}})['catch'](function(_0xde3bbc){logger[_0xaeb9('0x10')](_0xaeb9('0xb'),_0x33dee2,_0xde3bbc);_0x5459f8(_0xde3bbc);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 0ddd024..224aa97 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4ee5d3,_0x432589){var _0x3a0562=function(_0x442e4a){while(--_0x442e4a){_0x4ee5d3['push'](_0x4ee5d3['shift']());}};_0x3a0562(++_0x432589);}(_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 +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2ff56b,_0x5df44a){var _0x44a7d7=function(_0x242e4a){while(--_0x242e4a){_0x2ff56b['push'](_0x2ff56b['shift']());}};_0x44a7d7(++_0x5df44a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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 2683a70..4da120b 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 _0x98dc=['INTEGER','state','sequelize','exports','STRING','unique_name_and_version','app.js'];(function(_0x4181af,_0x77f684){var _0x271137=function(_0x157ec3){while(--_0x157ec3){_0x4181af['push'](_0x4181af['shift']());}};_0x271137(++_0x77f684);}(_0x98dc,0x18a));var _0xc98d=function(_0x52e3f7,_0x3a0095){_0x52e3f7=_0x52e3f7-0x0;var _0x40d62a=_0x98dc[_0x52e3f7];return _0x40d62a;};'use strict';var Sequelize=require(_0xc98d('0x0'));module[_0xc98d('0x1')]={'name':{'type':Sequelize[_0xc98d('0x2')],'allowNull':![],'unique':_0xc98d('0x3')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0xc98d('0x2')],'defaultValue':_0xc98d('0x4')},'filename':{'type':Sequelize[_0xc98d('0x2')]},'path':{'type':Sequelize[_0xc98d('0x2')]},'type':{'type':Sequelize[_0xc98d('0x2')]},'size':{'type':Sequelize[_0xc98d('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0xc98d('0x2')]},'logo':{'type':Sequelize[_0xc98d('0x2')]},'state':{'type':Sequelize['STRING'],'unique':_0xc98d('0x6')},'description':{'type':Sequelize[_0xc98d('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0x2b3c=['STRING','app.js','INTEGER','BOOLEAN','state','sequelize','unique_name_and_version'];(function(_0xeca3dc,_0xb72d12){var _0x123d5f=function(_0x133c05){while(--_0x133c05){_0xeca3dc['push'](_0xeca3dc['shift']());}};_0x123d5f(++_0xb72d12);}(_0x2b3c,0x1be));var _0xc2b3=function(_0x14fc49,_0x5356ef){_0x14fc49=_0x14fc49-0x0;var _0x7f3d93=_0x2b3c[_0x14fc49];return _0x7f3d93;};'use strict';var Sequelize=require(_0xc2b3('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc2b3('0x1')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc2b3('0x1')},'main':{'type':Sequelize[_0xc2b3('0x2')],'defaultValue':_0xc2b3('0x3')},'filename':{'type':Sequelize[_0xc2b3('0x2')]},'path':{'type':Sequelize[_0xc2b3('0x2')]},'type':{'type':Sequelize[_0xc2b3('0x2')]},'size':{'type':Sequelize[_0xc2b3('0x4')]},'active':{'type':Sequelize[_0xc2b3('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0xc2b3('0x2')]},'logo':{'type':Sequelize[_0xc2b3('0x2')]},'state':{'type':Sequelize[_0xc2b3('0x2')],'unique':_0xc2b3('0x6')},'description':{'type':Sequelize[_0xc2b3('0x2')]},'title':{'type':Sequelize[_0xc2b3('0x2')]},'remoteUri':{'type':Sequelize[_0xc2b3('0x2')]},'link':{'type':Sequelize[_0xc2b3('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index ce3d8a7..c9c1a24 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 _0xf61e=['intersection','fields','attributes','length','hasOwnProperty','order','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','find','create','update','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','set','Content-Range','apply','destroy','then','status','error','stack','name','send','index','map','Integration','rawAttributes','key','model','query','keys','filters'];(function(_0x55c1f0,_0x4f574f){var _0x1530fa=function(_0x631542){while(--_0x631542){_0x55c1f0['push'](_0x55c1f0['shift']());}};_0x1530fa(++_0x4f574f);}(_0xf61e,0x191));var _0xef61=function(_0x3e3c5f,_0x12461a){_0x3e3c5f=_0x3e3c5f-0x0;var _0x6e4f3=_0xf61e[_0x3e3c5f];return _0x6e4f3;};'use strict';var emlformat=require(_0xef61('0x0'));var rimraf=require(_0xef61('0x1'));var zipdir=require(_0xef61('0x2'));var jsonpatch=require(_0xef61('0x3'));var rp=require(_0xef61('0x4'));var moment=require(_0xef61('0x5'));var BPromise=require(_0xef61('0x6'));var Mustache=require(_0xef61('0x7'));var util=require(_0xef61('0x8'));var path=require(_0xef61('0x9'));var sox=require(_0xef61('0xa'));var csv=require(_0xef61('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xef61('0xc'));var _=require(_0xef61('0xd'));var squel=require('squel');var crypto=require(_0xef61('0xe'));var jsforce=require(_0xef61('0xf'));var deskjs=require(_0xef61('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xef61('0x11'));var Redis=require(_0xef61('0x12'));var authService=require(_0xef61('0x13'));var qs=require(_0xef61('0x14'));var as=require(_0xef61('0x15'));var hardwareService=require(_0xef61('0x16'));var logger=require(_0xef61('0x17'))(_0xef61('0x18'));var utils=require(_0xef61('0x19'));var config=require(_0xef61('0x1a'));var licenseUtil=require(_0xef61('0x1b'));var db=require(_0xef61('0x1c'))['db'];function respondWithStatusCode(_0x114e1f,_0x318f1c){_0x318f1c=_0x318f1c||0xcc;return function(_0x5de159){if(_0x5de159){return _0x114e1f[_0xef61('0x1d')](_0x318f1c);}return _0x114e1f['status'](_0x318f1c)[_0xef61('0x1e')]();};}function respondWithResult(_0x1db2a9,_0x370ee0){_0x370ee0=_0x370ee0||0xc8;return function(_0x76ef9b){if(_0x76ef9b){return _0x1db2a9['status'](_0x370ee0)[_0xef61('0x1f')](_0x76ef9b);}};}function respondWithFilteredResult(_0x435beb,_0x1224c2){return function(_0x78ff22){if(_0x78ff22){var _0x588a61=typeof _0x1224c2[_0xef61('0x20')]===_0xef61('0x21')&&typeof _0x1224c2['limit']===_0xef61('0x21');var _0x408541=_0x78ff22[_0xef61('0x22')];var _0x22dc1b=_0x588a61?0x0:_0x1224c2[_0xef61('0x20')];var _0x28315a=_0x588a61?_0x78ff22[_0xef61('0x22')]:_0x1224c2['offset']+_0x1224c2[_0xef61('0x23')];var _0x2c8dad;if(_0x28315a>=_0x408541){_0x28315a=_0x408541;_0x2c8dad=0xc8;}else{_0x2c8dad=0xce;}_0x435beb['status'](_0x2c8dad);return _0x435beb[_0xef61('0x24')](_0xef61('0x25'),_0x22dc1b+'-'+_0x28315a+'/'+_0x408541)[_0xef61('0x1f')](_0x78ff22);}return null;};}function patchUpdates(_0x26cf42){return function(_0xb0d7a4){try{jsonpatch[_0xef61('0x26')](_0xb0d7a4,_0x26cf42,!![]);}catch(_0x92ea33){return BPromise['reject'](_0x92ea33);}return _0xb0d7a4['save']();};}function saveUpdates(_0x3d31c1,_0x58bd7d){return function(_0x389d6d){if(_0x389d6d){return _0x389d6d['update'](_0x3d31c1)['then'](function(_0x2f0569){return _0x2f0569;});}return null;};}function removeEntity(_0x5ce99d,_0x53181b){return function(_0xfbee94){if(_0xfbee94){return _0xfbee94[_0xef61('0x27')]()[_0xef61('0x28')](function(){_0x5ce99d[_0xef61('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16b144,_0x4e738f){return function(_0x2a6832){if(!_0x2a6832){_0x16b144[_0xef61('0x1d')](0x194);}return _0x2a6832;};}function handleError(_0x2419a9,_0xf4c7c9){_0xf4c7c9=_0xf4c7c9||0x1f4;return function(_0x2155f1){logger[_0xef61('0x2a')](_0x2155f1[_0xef61('0x2b')]);if(_0x2155f1[_0xef61('0x2c')]){delete _0x2155f1[_0xef61('0x2c')];}_0x2419a9[_0xef61('0x29')](_0xf4c7c9)[_0xef61('0x2d')](_0x2155f1);};}exports[_0xef61('0x2e')]=function(_0xeb9a62,_0x63edd4){var _0x1f3572={},_0x85978={},_0x39c15e={'count':0x0,'rows':[]};var _0x393ea9=_[_0xef61('0x2f')](db[_0xef61('0x30')][_0xef61('0x31')],function(_0x53fa3b){return{'name':_0x53fa3b['fieldName'],'type':_0x53fa3b['type'][_0xef61('0x32')]};});_0x85978[_0xef61('0x33')]=_[_0xef61('0x2f')](_0x393ea9,'name');_0x85978[_0xef61('0x34')]=_[_0xef61('0x35')](_0xeb9a62['query']);_0x85978[_0xef61('0x36')]=_['intersection'](_0x85978['model'],_0x85978[_0xef61('0x34')]);_0x1f3572['attributes']=_[_0xef61('0x37')](_0x85978['model'],qs[_0xef61('0x38')](_0xeb9a62[_0xef61('0x34')][_0xef61('0x38')]));_0x1f3572[_0xef61('0x39')]=_0x1f3572[_0xef61('0x39')][_0xef61('0x3a')]?_0x1f3572[_0xef61('0x39')]:_0x85978[_0xef61('0x33')];if(!_0xeb9a62[_0xef61('0x34')][_0xef61('0x3b')]('nolimit')){_0x1f3572[_0xef61('0x23')]=qs[_0xef61('0x23')](_0xeb9a62[_0xef61('0x34')][_0xef61('0x23')]);_0x1f3572[_0xef61('0x20')]=qs['offset'](_0xeb9a62[_0xef61('0x34')][_0xef61('0x20')]);}_0x1f3572[_0xef61('0x3c')]=qs['sort'](_0xeb9a62['query']['sort']);_0x1f3572[_0xef61('0x3d')]=qs['filters'](_['pick'](_0xeb9a62['query'],_0x85978[_0xef61('0x36')]),_0x393ea9);if(_0xeb9a62[_0xef61('0x34')][_0xef61('0x3e')]){_0x1f3572['where']=_['merge'](_0x1f3572['where'],{'$or':_[_0xef61('0x2f')](_0x393ea9,function(_0x32ad44){if(_0x32ad44['type']!==_0xef61('0x3f')){var _0x12f442={};_0x12f442[_0x32ad44[_0xef61('0x2c')]]={'$like':'%'+_0xeb9a62[_0xef61('0x34')]['filter']+'%'};return _0x12f442;}})});}_0x1f3572=_[_0xef61('0x40')]({},_0x1f3572,_0xeb9a62[_0xef61('0x41')]);var _0x3103d4={'where':_0x1f3572[_0xef61('0x3d')]};return db['Integration']['count'](_0x3103d4)[_0xef61('0x28')](function(_0x462972){_0x39c15e[_0xef61('0x22')]=_0x462972;if(_0xeb9a62['query'][_0xef61('0x42')]){_0x1f3572[_0xef61('0x43')]=[{'all':!![]}];}return db[_0xef61('0x30')][_0xef61('0x44')](_0x1f3572);})['then'](function(_0x545597){_0x39c15e['rows']=_0x545597;return _0x39c15e;})[_0xef61('0x28')](respondWithFilteredResult(_0x63edd4,_0x1f3572))[_0xef61('0x45')](handleError(_0x63edd4,null));};exports[_0xef61('0x46')]=function(_0xe40d,_0x3f81a1){var _0x272143={'raw':![],'where':{'id':_0xe40d['params']['id']}},_0xc9b467={};_0xc9b467[_0xef61('0x33')]=_[_0xef61('0x35')](db[_0xef61('0x30')][_0xef61('0x31')]);_0xc9b467['query']=_[_0xef61('0x35')](_0xe40d[_0xef61('0x34')]);_0xc9b467[_0xef61('0x36')]=_[_0xef61('0x37')](_0xc9b467[_0xef61('0x33')],_0xc9b467[_0xef61('0x34')]);_0x272143['attributes']=_[_0xef61('0x37')](_0xc9b467[_0xef61('0x33')],qs[_0xef61('0x38')](_0xe40d['query'][_0xef61('0x38')]));_0x272143[_0xef61('0x39')]=_0x272143[_0xef61('0x39')][_0xef61('0x3a')]?_0x272143[_0xef61('0x39')]:_0xc9b467[_0xef61('0x33')];if(_0xe40d['query'][_0xef61('0x42')]){_0x272143[_0xef61('0x43')]=[{'all':!![]}];}_0x272143=_['merge']({},_0x272143,_0xe40d[_0xef61('0x41')]);return db[_0xef61('0x30')][_0xef61('0x47')](_0x272143)[_0xef61('0x28')](handleEntityNotFound(_0x3f81a1,null))['then'](respondWithResult(_0x3f81a1,null))[_0xef61('0x45')](handleError(_0x3f81a1,null));};exports[_0xef61('0x48')]=function(_0x5e614b,_0x47b09d){return db[_0xef61('0x30')][_0xef61('0x48')](_0x5e614b['body'],{})[_0xef61('0x28')](respondWithResult(_0x47b09d,0xc9))[_0xef61('0x45')](handleError(_0x47b09d,null));};exports[_0xef61('0x49')]=function(_0x2904e0,_0x13bb20){if(_0x2904e0[_0xef61('0x4a')]['id']){delete _0x2904e0[_0xef61('0x4a')]['id'];}return db['Integration'][_0xef61('0x47')]({'where':{'id':_0x2904e0['params']['id']}})[_0xef61('0x28')](handleEntityNotFound(_0x13bb20,null))[_0xef61('0x28')](saveUpdates(_0x2904e0[_0xef61('0x4a')],null))[_0xef61('0x28')](respondWithResult(_0x13bb20,null))[_0xef61('0x45')](handleError(_0x13bb20,null));};exports[_0xef61('0x27')]=function(_0x3e23eb,_0x1565c7){return db[_0xef61('0x30')]['find']({'where':{'id':_0x3e23eb[_0xef61('0x4b')]['id']}})[_0xef61('0x28')](handleEntityNotFound(_0x1565c7,null))['then'](removeEntity(_0x1565c7,null))['catch'](handleError(_0x1565c7,null));}; \ No newline at end of file +var _0x5fab=['querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','end','sendStatus','name','send','index','map','Integration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','includeAll','include','findAll','then','rows','show','params','intersection','fields','options','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce'];(function(_0x2af3e1,_0xb5207f){var _0xfa27d=function(_0x22f828){while(--_0x22f828){_0x2af3e1['push'](_0x2af3e1['shift']());}};_0xfa27d(++_0xb5207f);}(_0x5fab,0x177));var _0xb5fa=function(_0x246cbe,_0x19305c){_0x246cbe=_0x246cbe-0x0;var _0x855b0=_0x5fab[_0x246cbe];return _0x855b0;};'use strict';var emlformat=require(_0xb5fa('0x0'));var rimraf=require(_0xb5fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb5fa('0x2'));var rp=require(_0xb5fa('0x3'));var moment=require(_0xb5fa('0x4'));var BPromise=require(_0xb5fa('0x5'));var Mustache=require(_0xb5fa('0x6'));var util=require(_0xb5fa('0x7'));var path=require(_0xb5fa('0x8'));var sox=require(_0xb5fa('0x9'));var csv=require(_0xb5fa('0xa'));var ejs=require(_0xb5fa('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb5fa('0xc'));var crypto=require(_0xb5fa('0xd'));var jsforce=require(_0xb5fa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5fa('0xa'));var querystring=require(_0xb5fa('0xf'));var Papa=require(_0xb5fa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb5fa('0x11'));var as=require(_0xb5fa('0x12'));var hardwareService=require(_0xb5fa('0x13'));var logger=require(_0xb5fa('0x14'))(_0xb5fa('0x15'));var utils=require(_0xb5fa('0x16'));var config=require(_0xb5fa('0x17'));var licenseUtil=require(_0xb5fa('0x18'));var db=require(_0xb5fa('0x19'))['db'];function respondWithStatusCode(_0x4d3576,_0x2ad830){_0x2ad830=_0x2ad830||0xcc;return function(_0x3dad4d){if(_0x3dad4d){return _0x4d3576['sendStatus'](_0x2ad830);}return _0x4d3576[_0xb5fa('0x1a')](_0x2ad830)['end']();};}function respondWithResult(_0x265992,_0x3fc372){_0x3fc372=_0x3fc372||0xc8;return function(_0x40c914){if(_0x40c914){return _0x265992[_0xb5fa('0x1a')](_0x3fc372)[_0xb5fa('0x1b')](_0x40c914);}};}function respondWithFilteredResult(_0x5371cf,_0x567f31){return function(_0x38e964){if(_0x38e964){var _0x587043=typeof _0x567f31[_0xb5fa('0x1c')]===_0xb5fa('0x1d')&&typeof _0x567f31['limit']==='undefined';var _0x451a55=_0x38e964[_0xb5fa('0x1e')];var _0x32e9e5=_0x587043?0x0:_0x567f31[_0xb5fa('0x1c')];var _0x324ba5=_0x587043?_0x38e964[_0xb5fa('0x1e')]:_0x567f31[_0xb5fa('0x1c')]+_0x567f31[_0xb5fa('0x1f')];var _0xc14dc4;if(_0x324ba5>=_0x451a55){_0x324ba5=_0x451a55;_0xc14dc4=0xc8;}else{_0xc14dc4=0xce;}_0x5371cf[_0xb5fa('0x1a')](_0xc14dc4);return _0x5371cf[_0xb5fa('0x20')](_0xb5fa('0x21'),_0x32e9e5+'-'+_0x324ba5+'/'+_0x451a55)['json'](_0x38e964);}return null;};}function patchUpdates(_0x432bfa){return function(_0x519e20){try{jsonpatch[_0xb5fa('0x22')](_0x519e20,_0x432bfa,!![]);}catch(_0x4a6c04){return BPromise[_0xb5fa('0x23')](_0x4a6c04);}return _0x519e20[_0xb5fa('0x24')]();};}function saveUpdates(_0x4e05c0,_0x40dfdf){return function(_0x3a2ab9){if(_0x3a2ab9){return _0x3a2ab9[_0xb5fa('0x25')](_0x4e05c0)['then'](function(_0x32a85c){return _0x32a85c;});}return null;};}function removeEntity(_0xec108f,_0x444237){return function(_0x542348){if(_0x542348){return _0x542348[_0xb5fa('0x26')]()['then'](function(){_0xec108f[_0xb5fa('0x1a')](0xcc)[_0xb5fa('0x27')]();});}};}function handleEntityNotFound(_0x11053a,_0x543edf){return function(_0x2dbd22){if(!_0x2dbd22){_0x11053a[_0xb5fa('0x28')](0x194);}return _0x2dbd22;};}function handleError(_0x6a455c,_0x20d649){_0x20d649=_0x20d649||0x1f4;return function(_0x568870){logger['error'](_0x568870['stack']);if(_0x568870['name']){delete _0x568870[_0xb5fa('0x29')];}_0x6a455c[_0xb5fa('0x1a')](_0x20d649)[_0xb5fa('0x2a')](_0x568870);};}exports[_0xb5fa('0x2b')]=function(_0x534884,_0x3506a4){var _0x358549={},_0x353314={},_0x409af9={'count':0x0,'rows':[]};var _0x2a5690=_[_0xb5fa('0x2c')](db[_0xb5fa('0x2d')][_0xb5fa('0x2e')],function(_0x1f4380){return{'name':_0x1f4380[_0xb5fa('0x2f')],'type':_0x1f4380[_0xb5fa('0x30')][_0xb5fa('0x31')]};});_0x353314[_0xb5fa('0x32')]=_[_0xb5fa('0x2c')](_0x2a5690,_0xb5fa('0x29'));_0x353314[_0xb5fa('0x33')]=_[_0xb5fa('0x34')](_0x534884[_0xb5fa('0x33')]);_0x353314[_0xb5fa('0x35')]=_['intersection'](_0x353314[_0xb5fa('0x32')],_0x353314['query']);_0x358549['attributes']=_['intersection'](_0x353314[_0xb5fa('0x32')],qs['fields'](_0x534884[_0xb5fa('0x33')]['fields']));_0x358549['attributes']=_0x358549[_0xb5fa('0x36')][_0xb5fa('0x37')]?_0x358549['attributes']:_0x353314['model'];if(!_0x534884[_0xb5fa('0x33')][_0xb5fa('0x38')](_0xb5fa('0x39'))){_0x358549['limit']=qs[_0xb5fa('0x1f')](_0x534884[_0xb5fa('0x33')]['limit']);_0x358549[_0xb5fa('0x1c')]=qs[_0xb5fa('0x1c')](_0x534884[_0xb5fa('0x33')]['offset']);}_0x358549[_0xb5fa('0x3a')]=qs[_0xb5fa('0x3b')](_0x534884[_0xb5fa('0x33')]['sort']);_0x358549[_0xb5fa('0x3c')]=qs[_0xb5fa('0x35')](_[_0xb5fa('0x3d')](_0x534884[_0xb5fa('0x33')],_0x353314['filters']),_0x2a5690);if(_0x534884['query']['filter']){_0x358549['where']=_['merge'](_0x358549['where'],{'$or':_[_0xb5fa('0x2c')](_0x2a5690,function(_0x4c0a4d){if(_0x4c0a4d[_0xb5fa('0x30')]!==_0xb5fa('0x3e')){var _0x36db1a={};_0x36db1a[_0x4c0a4d[_0xb5fa('0x29')]]={'$like':'%'+_0x534884[_0xb5fa('0x33')][_0xb5fa('0x3f')]+'%'};return _0x36db1a;}})});}_0x358549=_['merge']({},_0x358549,_0x534884['options']);var _0x4c4bf0={'where':_0x358549[_0xb5fa('0x3c')]};return db['Integration'][_0xb5fa('0x1e')](_0x4c4bf0)['then'](function(_0x58aa97){_0x409af9[_0xb5fa('0x1e')]=_0x58aa97;if(_0x534884[_0xb5fa('0x33')][_0xb5fa('0x40')]){_0x358549[_0xb5fa('0x41')]=[{'all':!![]}];}return db[_0xb5fa('0x2d')][_0xb5fa('0x42')](_0x358549);})[_0xb5fa('0x43')](function(_0x83df0b){_0x409af9[_0xb5fa('0x44')]=_0x83df0b;return _0x409af9;})[_0xb5fa('0x43')](respondWithFilteredResult(_0x3506a4,_0x358549))['catch'](handleError(_0x3506a4,null));};exports[_0xb5fa('0x45')]=function(_0x4bc9df,_0x233f90){var _0x39aac3={'raw':![],'where':{'id':_0x4bc9df[_0xb5fa('0x46')]['id']}},_0x2c7c5f={};_0x2c7c5f[_0xb5fa('0x32')]=_[_0xb5fa('0x34')](db[_0xb5fa('0x2d')][_0xb5fa('0x2e')]);_0x2c7c5f['query']=_[_0xb5fa('0x34')](_0x4bc9df[_0xb5fa('0x33')]);_0x2c7c5f['filters']=_[_0xb5fa('0x47')](_0x2c7c5f['model'],_0x2c7c5f[_0xb5fa('0x33')]);_0x39aac3[_0xb5fa('0x36')]=_['intersection'](_0x2c7c5f['model'],qs[_0xb5fa('0x48')](_0x4bc9df[_0xb5fa('0x33')][_0xb5fa('0x48')]));_0x39aac3[_0xb5fa('0x36')]=_0x39aac3[_0xb5fa('0x36')][_0xb5fa('0x37')]?_0x39aac3[_0xb5fa('0x36')]:_0x2c7c5f[_0xb5fa('0x32')];if(_0x4bc9df['query'][_0xb5fa('0x40')]){_0x39aac3[_0xb5fa('0x41')]=[{'all':!![]}];}_0x39aac3=_['merge']({},_0x39aac3,_0x4bc9df[_0xb5fa('0x49')]);return db[_0xb5fa('0x2d')][_0xb5fa('0x4a')](_0x39aac3)[_0xb5fa('0x43')](handleEntityNotFound(_0x233f90,null))[_0xb5fa('0x43')](respondWithResult(_0x233f90,null))[_0xb5fa('0x4b')](handleError(_0x233f90,null));};exports[_0xb5fa('0x4c')]=function(_0x33eb2c,_0x20f5f5){return db[_0xb5fa('0x2d')][_0xb5fa('0x4c')](_0x33eb2c[_0xb5fa('0x4d')],{})[_0xb5fa('0x43')](respondWithResult(_0x20f5f5,0xc9))[_0xb5fa('0x4b')](handleError(_0x20f5f5,null));};exports[_0xb5fa('0x25')]=function(_0x3a39f2,_0x52f5d8){if(_0x3a39f2['body']['id']){delete _0x3a39f2[_0xb5fa('0x4d')]['id'];}return db['Integration'][_0xb5fa('0x4a')]({'where':{'id':_0x3a39f2[_0xb5fa('0x46')]['id']}})['then'](handleEntityNotFound(_0x52f5d8,null))[_0xb5fa('0x43')](saveUpdates(_0x3a39f2[_0xb5fa('0x4d')],null))[_0xb5fa('0x43')](respondWithResult(_0x52f5d8,null))[_0xb5fa('0x4b')](handleError(_0x52f5d8,null));};exports[_0xb5fa('0x26')]=function(_0x3ffee0,_0x51d5f7){return db[_0xb5fa('0x2d')]['find']({'where':{'id':_0x3ffee0[_0xb5fa('0x46')]['id']}})[_0xb5fa('0x43')](handleEntityNotFound(_0x51d5f7,null))[_0xb5fa('0x43')](removeEntity(_0x51d5f7,null))['catch'](handleError(_0x51d5f7,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index e2da82b..a9ac4a8 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 _0xc34e=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./integration.attributes','define','Integration','integrations','lodash','util','../../config/logger'];(function(_0x2a4b81,_0x10ac81){var _0x4d4c18=function(_0x263a0c){while(--_0x263a0c){_0x2a4b81['push'](_0x2a4b81['shift']());}};_0x4d4c18(++_0x10ac81);}(_0xc34e,0x176));var _0xec34=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc34e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xec34('0x0'));var util=require(_0xec34('0x1'));var logger=require(_0xec34('0x2'))(_0xec34('0x3'));var moment=require(_0xec34('0x4'));var BPromise=require(_0xec34('0x5'));var rp=require(_0xec34('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xec34('0x7'));var config=require(_0xec34('0x8'));var attributes=require(_0xec34('0x9'));module['exports']=function(_0x457855,_0x4cc089){return _0x457855[_0xec34('0xa')](_0xec34('0xb'),attributes,{'tableName':_0xec34('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd9e4=['./integration.attributes','exports','define','Integration','integrations','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x41edd1,_0x19d48e){var _0x3b352e=function(_0x381166){while(--_0x381166){_0x41edd1['push'](_0x41edd1['shift']());}};_0x3b352e(++_0x19d48e);}(_0xd9e4,0x131));var _0x4d9e=function(_0x417baa,_0x3923d0){_0x417baa=_0x417baa-0x0;var _0x42724f=_0xd9e4[_0x417baa];return _0x42724f;};'use strict';var _=require(_0x4d9e('0x0'));var util=require(_0x4d9e('0x1'));var logger=require(_0x4d9e('0x2'))(_0x4d9e('0x3'));var moment=require(_0x4d9e('0x4'));var BPromise=require(_0x4d9e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4d9e('0x6'));var config=require('../../config/environment');var attributes=require(_0x4d9e('0x7'));module[_0x4d9e('0x8')]=function(_0x5bced8,_0x5cf32b){return _0x5bced8[_0x4d9e('0x9')](_0x4d9e('0xa'),attributes,{'tableName':_0x4d9e('0xb'),'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 44a398e..ba03871 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 _0xe2fe=['then','info','Integration,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x1d76ce,_0x1808fc){var _0x38413d=function(_0x2f9bcc){while(--_0x2f9bcc){_0x1d76ce['push'](_0x1d76ce['shift']());}};_0x38413d(++_0x1808fc);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xee2f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee2f('0x2'));var db=require(_0xee2f('0x3'))['db'];var utils=require(_0xee2f('0x4'));var logger=require(_0xee2f('0x5'))(_0xee2f('0x6'));var config=require('../../config/environment');var jayson=require(_0xee2f('0x7'));var client=jayson[_0xee2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1533a0,_0x2e1c8c,_0x5a7975){return new BPromise(function(_0x3c4095,_0x5ea796){return client[_0xee2f('0x9')](_0x1533a0,_0x5a7975)[_0xee2f('0xa')](function(_0x53f7dd){logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,'request\x20sent');logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0x2e1c8c,'request\x20sent',JSON[_0xee2f('0xd')](_0x53f7dd));if(_0x53f7dd['error']){if(_0x53f7dd['error']['code']===0x1f4){logger[_0xee2f('0xe')](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);return _0x5ea796(_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);}logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd['error'][_0xee2f('0xf')]);return _0x3c4095(_0x53f7dd[_0xee2f('0xe')]['message']);}else{logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,_0xee2f('0x10'));_0x3c4095(_0x53f7dd[_0xee2f('0x11')][_0xee2f('0xf')]);}})['catch'](function(_0x3f6372){logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x3f6372);_0x5ea796(_0x3f6372);});});} \ No newline at end of file +var _0x0b0e=['Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','debug'];(function(_0x673722,_0x275d7e){var _0x21249c=function(_0x25b4e7){while(--_0x25b4e7){_0x673722['push'](_0x673722['shift']());}};_0x21249c(++_0x275d7e);}(_0x0b0e,0x187));var _0xe0b0=function(_0x371d15,_0xd98587){_0x371d15=_0x371d15-0x0;var _0x32afdf=_0x0b0e[_0x371d15];return _0x32afdf;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x219b1c,_0x5cf9cc,_0x50be7f){return new BPromise(function(_0x11effc,_0x435060){return client[_0xe0b0('0xc')](_0x219b1c,_0x50be7f)[_0xe0b0('0xd')](function(_0x4c24f9){logger[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x5cf9cc,'request\x20sent');logger[_0xe0b0('0x10')](_0xe0b0('0x11'),_0x5cf9cc,'request\x20sent',JSON[_0xe0b0('0x12')](_0x4c24f9));if(_0x4c24f9[_0xe0b0('0x13')]){if(_0x4c24f9[_0xe0b0('0x13')]['code']===0x1f4){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x435060(_0x4c24f9[_0xe0b0('0x13')]['message']);}logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x11effc(_0x4c24f9[_0xe0b0('0x13')]['message']);}else{logger[_0xe0b0('0xe')]('Integration,\x20%s,\x20%s',_0x5cf9cc,_0xe0b0('0x15'));_0x11effc(_0x4c24f9[_0xe0b0('0x16')]['message']);}})[_0xe0b0('0x17')](function(_0x4a4cc0){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4a4cc0);_0x435060(_0x4a4cc0);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 7424006..046781e 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 _0x5f66=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','create','put','update','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f66,0x1a0));var _0x65f6=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x5f66[_0x126558];return _0x1f6d14;};'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('./integrationReport.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['show']);router['post']('/',auth[_0x65f6('0x8')](),controller[_0x65f6('0xc')]);router[_0x65f6('0xd')](_0x65f6('0xb'),auth['isAuthenticated'](),controller[_0x65f6('0xe')]);router['delete']('/:id',auth[_0x65f6('0x8')](),controller['destroy']);module[_0x65f6('0xf')]=router; \ No newline at end of file +var _0x57ca=['create','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x3d9118,_0x590442){var _0x1ce72f=function(_0xd58afe){while(--_0xd58afe){_0x3d9118['push'](_0x3d9118['shift']());}};_0x1ce72f(++_0x590442);}(_0x57ca,0x108));var _0xa57c=function(_0x5aa1cb,_0x2f17b3){_0x5aa1cb=_0x5aa1cb-0x0;var _0x1d9109=_0x57ca[_0x5aa1cb];return _0x1d9109;};'use strict';var multer=require('multer');var util=require(_0xa57c('0x0'));var path=require(_0xa57c('0x1'));var timeout=require('connect-timeout');var express=require(_0xa57c('0x2'));var router=express[_0xa57c('0x3')]();var fs_extra=require(_0xa57c('0x4'));var auth=require(_0xa57c('0x5'));var interaction=require(_0xa57c('0x6'));var config=require('../../config/environment');var controller=require(_0xa57c('0x7'));router[_0xa57c('0x8')]('/',auth[_0xa57c('0x9')](),controller[_0xa57c('0xa')]);router[_0xa57c('0x8')](_0xa57c('0xb'),auth[_0xa57c('0x9')](),controller[_0xa57c('0xc')]);router['get'](_0xa57c('0xd'),auth['isAuthenticated'](),controller[_0xa57c('0xe')]);router[_0xa57c('0xf')]('/',auth['isAuthenticated'](),controller[_0xa57c('0x10')]);router['put'](_0xa57c('0xd'),auth[_0xa57c('0x9')](),controller['update']);router[_0xa57c('0x11')]('/:id',auth[_0xa57c('0x9')](),controller[_0xa57c('0x12')]);module[_0xa57c('0x13')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 54140f8..789b59f 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 _0x3401=['INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','RECEIVED','sequelize','STRING'];(function(_0x52e94f,_0x5285be){var _0x1bcad0=function(_0x2236ac){while(--_0x2236ac){_0x52e94f['push'](_0x52e94f['shift']());}};_0x1bcad0(++_0x5285be);}(_0x3401,0x154));var _0x1340=function(_0x281ca3,_0x1d4c2b){_0x281ca3=_0x281ca3-0x0;var _0x3c3125=_0x3401[_0x281ca3];return _0x3c3125;};'use strict';var Sequelize=require(_0x1340('0x0'));module['exports']={'integration':{'type':Sequelize[_0x1340('0x1')]},'eventChannel':{'type':Sequelize[_0x1340('0x1')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x1340('0x1')]},'integrationId':{'type':Sequelize[_0x1340('0x2')]},'contacts':{'type':Sequelize[_0x1340('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x1340('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x1340('0x1')]},'interface':{'type':Sequelize[_0x1340('0x1')]},'membername':{'type':Sequelize[_0x1340('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x1340('0x3')]},'holdtime':{'type':Sequelize[_0x1340('0x2')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x1340('0x3')]},'talktime':{'type':Sequelize[_0x1340('0x2')]},'agentacw':{'type':Sequelize[_0x1340('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x1340('0x2')]},'reason':{'type':Sequelize[_0x1340('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x1340('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x1340('0x3')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x1340('0x3')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x1340('0x1')]},'channelstate':{'type':Sequelize[_0x1340('0x2')]},'channelstatedesc':{'type':Sequelize[_0x1340('0x1')]},'connectedlinenum':{'type':Sequelize[_0x1340('0x1')]},'connectedlinename':{'type':Sequelize[_0x1340('0x1')]},'language':{'type':Sequelize[_0x1340('0x1')]},'accountcode':{'type':Sequelize[_0x1340('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x1340('0x1')]},'priority':{'type':Sequelize[_0x1340('0x1')]},'destchannel':{'type':Sequelize[_0x1340('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x1340('0x1')]},'destcalleridnum':{'type':Sequelize[_0x1340('0x1')]},'destcalleridname':{'type':Sequelize[_0x1340('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x1340('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x1340('0x1')]},'destaccountcode':{'type':Sequelize[_0x1340('0x1')]},'destcontext':{'type':Sequelize[_0x1340('0x1')]},'destexten':{'type':Sequelize[_0x1340('0x1')]},'destpriority':{'type':Sequelize[_0x1340('0x1')]},'destuniqueid':{'type':Sequelize[_0x1340('0x1')]},'messageId':{'type':Sequelize[_0x1340('0x1')]},'inReplyTo':{'type':Sequelize[_0x1340('0x1')]},'subject':{'type':Sequelize[_0x1340('0x1')]},'from':{'type':Sequelize[_0x1340('0x1')]},'to':{'type':Sequelize[_0x1340('0x1')]},'cc':{'type':Sequelize[_0x1340('0x1')]},'attachment':{'type':Sequelize[_0x1340('0x5')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x1340('0x5')]},'status':{'type':Sequelize[_0x1340('0x6')](_0x1340('0x7'),'SENDING',_0x1340('0x8'),'FAILED')},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x1340('0x1')]},'projectId':{'type':Sequelize[_0x1340('0x2')]}}; \ No newline at end of file +var _0x1462=['ENUM','SENDING','RECEIVED','FAILED','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT'];(function(_0x13117b,_0x3449eb){var _0x418124=function(_0x412bf5){while(--_0x412bf5){_0x13117b['push'](_0x13117b['shift']());}};_0x418124(++_0x3449eb);}(_0x1462,0x112));var _0x2146=function(_0x2aae61,_0x396864){_0x2aae61=_0x2aae61-0x0;var _0x5b5a5a=_0x1462[_0x2aae61];return _0x5b5a5a;};'use strict';var Sequelize=require('sequelize');module[_0x2146('0x0')]={'integration':{'type':Sequelize[_0x2146('0x1')]},'eventChannel':{'type':Sequelize[_0x2146('0x1')]},'exitStatus':{'type':Sequelize[_0x2146('0x1')]},'ticketId':{'type':Sequelize[_0x2146('0x1')]},'integrationId':{'type':Sequelize[_0x2146('0x2')]},'contacts':{'type':Sequelize[_0x2146('0x1')]},'uniqueid':{'type':Sequelize[_0x2146('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2146('0x1')]},'queue':{'type':Sequelize[_0x2146('0x1')]},'interface':{'type':Sequelize[_0x2146('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x2146('0x3')]},'agentconnectAt':{'type':Sequelize[_0x2146('0x3')]},'holdtime':{'type':Sequelize[_0x2146('0x2')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x2146('0x3')]},'talktime':{'type':Sequelize[_0x2146('0x2')]},'agentacw':{'type':Sequelize[_0x2146('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x2146('0x2')]},'reason':{'type':Sequelize[_0x2146('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x2146('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x2146('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x2146('0x3')]},'lastevent':{'type':Sequelize[_0x2146('0x1')]},'channel':{'type':Sequelize[_0x2146('0x1')]},'channelstate':{'type':Sequelize[_0x2146('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x2146('0x1')]},'connectedlinename':{'type':Sequelize[_0x2146('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x2146('0x1')]},'context':{'type':Sequelize[_0x2146('0x1')]},'exten':{'type':Sequelize[_0x2146('0x1')]},'priority':{'type':Sequelize[_0x2146('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x2146('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x2146('0x1')]},'destcalleridnum':{'type':Sequelize[_0x2146('0x1')]},'destcalleridname':{'type':Sequelize[_0x2146('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x2146('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x2146('0x1')]},'destlanguage':{'type':Sequelize[_0x2146('0x1')]},'destaccountcode':{'type':Sequelize[_0x2146('0x1')]},'destcontext':{'type':Sequelize[_0x2146('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x2146('0x1')]},'destuniqueid':{'type':Sequelize[_0x2146('0x1')]},'messageId':{'type':Sequelize[_0x2146('0x1')]},'inReplyTo':{'type':Sequelize[_0x2146('0x1')]},'subject':{'type':Sequelize[_0x2146('0x1')]},'from':{'type':Sequelize[_0x2146('0x1')]},'to':{'type':Sequelize[_0x2146('0x1')]},'cc':{'type':Sequelize[_0x2146('0x1')]},'attachment':{'type':Sequelize[_0x2146('0x5')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x2146('0x5')]},'status':{'type':Sequelize[_0x2146('0x6')]('SENT',_0x2146('0x7'),_0x2146('0x8'),_0x2146('0x9'))},'url':{'type':Sequelize[_0x2146('0x1')]},'app':{'type':Sequelize[_0x2146('0x1')]},'appdata':{'type':Sequelize[_0x2146('0x1')]},'projectId':{'type':Sequelize[_0x2146('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 40859fc..3e18db7 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 _0x65d6=['describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','to-csv','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','save','update','destroy','error','name','send','index','map','IntegrationReport','fieldName','key','model','query','keys','filters','attributes','fields','length','nolimit','sort','where','merge','VIRTUAL','filter','options','then','includeAll','include','rows','catch','show','rawAttributes','intersection','create','body','find','params'];(function(_0x2a0e59,_0x586fcb){var _0x562b26=function(_0x2e7ade){while(--_0x2e7ade){_0x2a0e59['push'](_0x2a0e59['shift']());}};_0x562b26(++_0x586fcb);}(_0x65d6,0x1eb));var _0x665d=function(_0x204b00,_0x1c5ac5){_0x204b00=_0x204b00-0x0;var _0x26e4d1=_0x65d6[_0x204b00];return _0x26e4d1;};'use strict';var emlformat=require(_0x665d('0x0'));var rimraf=require(_0x665d('0x1'));var zipdir=require(_0x665d('0x2'));var jsonpatch=require(_0x665d('0x3'));var rp=require(_0x665d('0x4'));var moment=require(_0x665d('0x5'));var BPromise=require(_0x665d('0x6'));var Mustache=require(_0x665d('0x7'));var util=require(_0x665d('0x8'));var path=require(_0x665d('0x9'));var sox=require(_0x665d('0xa'));var csv=require('to-csv');var ejs=require(_0x665d('0xb'));var fs=require('fs');var fs_extra=require(_0x665d('0xc'));var _=require('lodash');var squel=require(_0x665d('0xd'));var crypto=require(_0x665d('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x665d('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x665d('0x10'));var qs=require(_0x665d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x665d('0x12'));var logger=require('../../config/logger')(_0x665d('0x13'));var utils=require('../../config/utils');var config=require(_0x665d('0x14'));var licenseUtil=require(_0x665d('0x15'));var db=require(_0x665d('0x16'))['db'];function respondWithStatusCode(_0x4308a0,_0x298043){_0x298043=_0x298043||0xcc;return function(_0x5805ad){if(_0x5805ad){return _0x4308a0[_0x665d('0x17')](_0x298043);}return _0x4308a0[_0x665d('0x18')](_0x298043)['end']();};}function respondWithResult(_0xa6762c,_0x26fb3f){_0x26fb3f=_0x26fb3f||0xc8;return function(_0x53bc8d){if(_0x53bc8d){return _0xa6762c['status'](_0x26fb3f)['json'](_0x53bc8d);}};}function respondWithFilteredResult(_0x46aa1e,_0xd63714){return function(_0x42b0ec){if(_0x42b0ec){var _0x1acf1b=typeof _0xd63714['offset']===_0x665d('0x19')&&typeof _0xd63714[_0x665d('0x1a')]===_0x665d('0x19');var _0x87f16f=_0x42b0ec[_0x665d('0x1b')];var _0x118532=_0x1acf1b?0x0:_0xd63714[_0x665d('0x1c')];var _0x39b38f=_0x1acf1b?_0x42b0ec[_0x665d('0x1b')]:_0xd63714[_0x665d('0x1c')]+_0xd63714['limit'];var _0x1246bd;if(_0x39b38f>=_0x87f16f){_0x39b38f=_0x87f16f;_0x1246bd=0xc8;}else{_0x1246bd=0xce;}_0x46aa1e[_0x665d('0x18')](_0x1246bd);return _0x46aa1e[_0x665d('0x1d')](_0x665d('0x1e'),_0x118532+'-'+_0x39b38f+'/'+_0x87f16f)[_0x665d('0x1f')](_0x42b0ec);}return null;};}function patchUpdates(_0x4669e5){return function(_0x539238){try{jsonpatch['apply'](_0x539238,_0x4669e5,!![]);}catch(_0x206138){return BPromise['reject'](_0x206138);}return _0x539238[_0x665d('0x20')]();};}function saveUpdates(_0x2108c9,_0x5d437a){return function(_0x6dc3e6){if(_0x6dc3e6){return _0x6dc3e6[_0x665d('0x21')](_0x2108c9)['then'](function(_0x5df824){return _0x5df824;});}return null;};}function removeEntity(_0x196316,_0x1a2090){return function(_0x4c774f){if(_0x4c774f){return _0x4c774f[_0x665d('0x22')]()['then'](function(){_0x196316[_0x665d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x446cdc,_0x2eab66){return function(_0x4e2cb4){if(!_0x4e2cb4){_0x446cdc[_0x665d('0x17')](0x194);}return _0x4e2cb4;};}function handleError(_0x50c1af,_0x30f449){_0x30f449=_0x30f449||0x1f4;return function(_0x115c86){logger[_0x665d('0x23')](_0x115c86['stack']);if(_0x115c86[_0x665d('0x24')]){delete _0x115c86[_0x665d('0x24')];}_0x50c1af['status'](_0x30f449)[_0x665d('0x25')](_0x115c86);};}exports[_0x665d('0x26')]=function(_0x2bd186,_0x595fb0){var _0x2c6cce={},_0x27767c={},_0x76104a={'count':0x0,'rows':[]};var _0x4024d1=_[_0x665d('0x27')](db[_0x665d('0x28')]['rawAttributes'],function(_0x36e3bb){return{'name':_0x36e3bb[_0x665d('0x29')],'type':_0x36e3bb['type'][_0x665d('0x2a')]};});_0x27767c[_0x665d('0x2b')]=_[_0x665d('0x27')](_0x4024d1,_0x665d('0x24'));_0x27767c[_0x665d('0x2c')]=_[_0x665d('0x2d')](_0x2bd186[_0x665d('0x2c')]);_0x27767c[_0x665d('0x2e')]=_['intersection'](_0x27767c[_0x665d('0x2b')],_0x27767c['query']);_0x2c6cce[_0x665d('0x2f')]=_['intersection'](_0x27767c['model'],qs[_0x665d('0x30')](_0x2bd186[_0x665d('0x2c')]['fields']));_0x2c6cce['attributes']=_0x2c6cce['attributes'][_0x665d('0x31')]?_0x2c6cce[_0x665d('0x2f')]:_0x27767c[_0x665d('0x2b')];if(!_0x2bd186[_0x665d('0x2c')]['hasOwnProperty'](_0x665d('0x32'))){_0x2c6cce[_0x665d('0x1a')]=qs[_0x665d('0x1a')](_0x2bd186[_0x665d('0x2c')][_0x665d('0x1a')]);_0x2c6cce[_0x665d('0x1c')]=qs[_0x665d('0x1c')](_0x2bd186[_0x665d('0x2c')]['offset']);}_0x2c6cce['order']=qs[_0x665d('0x33')](_0x2bd186['query'][_0x665d('0x33')]);_0x2c6cce[_0x665d('0x34')]=qs[_0x665d('0x2e')](_['pick'](_0x2bd186['query'],_0x27767c[_0x665d('0x2e')]),_0x4024d1);if(_0x2bd186[_0x665d('0x2c')]['filter']){_0x2c6cce[_0x665d('0x34')]=_[_0x665d('0x35')](_0x2c6cce[_0x665d('0x34')],{'$or':_[_0x665d('0x27')](_0x4024d1,function(_0x3e0c6e){if(_0x3e0c6e['type']!==_0x665d('0x36')){var _0xf6b4dd={};_0xf6b4dd[_0x3e0c6e[_0x665d('0x24')]]={'$like':'%'+_0x2bd186['query'][_0x665d('0x37')]+'%'};return _0xf6b4dd;}})});}_0x2c6cce=_[_0x665d('0x35')]({},_0x2c6cce,_0x2bd186[_0x665d('0x38')]);var _0x4c0035={'where':_0x2c6cce[_0x665d('0x34')]};return db[_0x665d('0x28')]['count'](_0x4c0035)[_0x665d('0x39')](function(_0xa74cb4){_0x76104a[_0x665d('0x1b')]=_0xa74cb4;if(_0x2bd186[_0x665d('0x2c')][_0x665d('0x3a')]){_0x2c6cce[_0x665d('0x3b')]=[{'all':!![]}];}return db[_0x665d('0x28')]['findAll'](_0x2c6cce);})['then'](function(_0x2f28d8){_0x76104a[_0x665d('0x3c')]=_0x2f28d8;return _0x76104a;})['then'](respondWithFilteredResult(_0x595fb0,_0x2c6cce))[_0x665d('0x3d')](handleError(_0x595fb0,null));};exports[_0x665d('0x3e')]=function(_0x376b2c,_0x25e016){var _0x1f9af4={'raw':![],'where':{'id':_0x376b2c['params']['id']}},_0x5742d2={};_0x5742d2[_0x665d('0x2b')]=_[_0x665d('0x2d')](db[_0x665d('0x28')][_0x665d('0x3f')]);_0x5742d2[_0x665d('0x2c')]=_[_0x665d('0x2d')](_0x376b2c[_0x665d('0x2c')]);_0x5742d2[_0x665d('0x2e')]=_[_0x665d('0x40')](_0x5742d2[_0x665d('0x2b')],_0x5742d2[_0x665d('0x2c')]);_0x1f9af4[_0x665d('0x2f')]=_[_0x665d('0x40')](_0x5742d2[_0x665d('0x2b')],qs[_0x665d('0x30')](_0x376b2c[_0x665d('0x2c')][_0x665d('0x30')]));_0x1f9af4['attributes']=_0x1f9af4[_0x665d('0x2f')][_0x665d('0x31')]?_0x1f9af4[_0x665d('0x2f')]:_0x5742d2['model'];if(_0x376b2c[_0x665d('0x2c')]['includeAll']){_0x1f9af4[_0x665d('0x3b')]=[{'all':!![]}];}_0x1f9af4=_['merge']({},_0x1f9af4,_0x376b2c[_0x665d('0x38')]);return db[_0x665d('0x28')]['find'](_0x1f9af4)[_0x665d('0x39')](handleEntityNotFound(_0x25e016,null))[_0x665d('0x39')](respondWithResult(_0x25e016,null))[_0x665d('0x3d')](handleError(_0x25e016,null));};exports[_0x665d('0x41')]=function(_0x30da9b,_0x4314e7){return db[_0x665d('0x28')]['create'](_0x30da9b[_0x665d('0x42')],{})[_0x665d('0x39')](respondWithResult(_0x4314e7,0xc9))[_0x665d('0x3d')](handleError(_0x4314e7,null));};exports['update']=function(_0x502f61,_0x3161c9){if(_0x502f61['body']['id']){delete _0x502f61['body']['id'];}return db['IntegrationReport'][_0x665d('0x43')]({'where':{'id':_0x502f61[_0x665d('0x44')]['id']}})[_0x665d('0x39')](handleEntityNotFound(_0x3161c9,null))[_0x665d('0x39')](saveUpdates(_0x502f61[_0x665d('0x42')],null))[_0x665d('0x39')](respondWithResult(_0x3161c9,null))[_0x665d('0x3d')](handleError(_0x3161c9,null));};exports['destroy']=function(_0x524fe9,_0x3b34b5){return db[_0x665d('0x28')][_0x665d('0x43')]({'where':{'id':_0x524fe9['params']['id']}})[_0x665d('0x39')](handleEntityNotFound(_0x3b34b5,null))['then'](removeEntity(_0x3b34b5,null))['catch'](handleError(_0x3b34b5,null));};exports[_0x665d('0x45')]=function(_0x30016d,_0x891f3d){return db[_0x665d('0x28')][_0x665d('0x45')]()[_0x665d('0x39')](respondWithResult(_0x891f3d,null))[_0x665d('0x3d')](handleError(_0x891f3d,null));}; \ No newline at end of file +var _0xe556=['filters','pick','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','describe','eml-format','zip-dir','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','IntegrationReport','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort'];(function(_0xb21831,_0x5b6d43){var _0x2faea0=function(_0x405e6b){while(--_0x405e6b){_0xb21831['push'](_0xb21831['shift']());}};_0x2faea0(++_0x5b6d43);}(_0xe556,0x1db));var _0x6e55=function(_0x4c46a1,_0x368f9c){_0x4c46a1=_0x4c46a1-0x0;var _0x1e9331=_0xe556[_0x4c46a1];return _0x1e9331;};'use strict';var emlformat=require(_0x6e55('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6e55('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6e55('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6e55('0x3'));var util=require(_0x6e55('0x4'));var path=require(_0x6e55('0x5'));var sox=require('sox');var csv=require(_0x6e55('0x6'));var ejs=require(_0x6e55('0x7'));var fs=require('fs');var fs_extra=require(_0x6e55('0x8'));var _=require(_0x6e55('0x9'));var squel=require('squel');var crypto=require(_0x6e55('0xa'));var jsforce=require(_0x6e55('0xb'));var deskjs=require(_0x6e55('0xc'));var toCsv=require(_0x6e55('0x6'));var querystring=require(_0x6e55('0xd'));var Papa=require(_0x6e55('0xe'));var Redis=require(_0x6e55('0xf'));var authService=require(_0x6e55('0x10'));var qs=require(_0x6e55('0x11'));var as=require(_0x6e55('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6e55('0x13'))(_0x6e55('0x14'));var utils=require(_0x6e55('0x15'));var config=require(_0x6e55('0x16'));var licenseUtil=require(_0x6e55('0x17'));var db=require(_0x6e55('0x18'))['db'];function respondWithStatusCode(_0x2410d7,_0x20b299){_0x20b299=_0x20b299||0xcc;return function(_0x3021af){if(_0x3021af){return _0x2410d7[_0x6e55('0x19')](_0x20b299);}return _0x2410d7[_0x6e55('0x1a')](_0x20b299)[_0x6e55('0x1b')]();};}function respondWithResult(_0x4df39d,_0x270558){_0x270558=_0x270558||0xc8;return function(_0x409bc7){if(_0x409bc7){return _0x4df39d[_0x6e55('0x1a')](_0x270558)[_0x6e55('0x1c')](_0x409bc7);}};}function respondWithFilteredResult(_0x2091e0,_0x41fde5){return function(_0x280fe7){if(_0x280fe7){var _0x359cd4=typeof _0x41fde5[_0x6e55('0x1d')]===_0x6e55('0x1e')&&typeof _0x41fde5[_0x6e55('0x1f')]===_0x6e55('0x1e');var _0x4dde9e=_0x280fe7['count'];var _0x38d9f1=_0x359cd4?0x0:_0x41fde5['offset'];var _0x2a0197=_0x359cd4?_0x280fe7[_0x6e55('0x20')]:_0x41fde5[_0x6e55('0x1d')]+_0x41fde5[_0x6e55('0x1f')];var _0x4c910a;if(_0x2a0197>=_0x4dde9e){_0x2a0197=_0x4dde9e;_0x4c910a=0xc8;}else{_0x4c910a=0xce;}_0x2091e0[_0x6e55('0x1a')](_0x4c910a);return _0x2091e0['set'](_0x6e55('0x21'),_0x38d9f1+'-'+_0x2a0197+'/'+_0x4dde9e)[_0x6e55('0x1c')](_0x280fe7);}return null;};}function patchUpdates(_0x217484){return function(_0x2a71e6){try{jsonpatch[_0x6e55('0x22')](_0x2a71e6,_0x217484,!![]);}catch(_0x3be786){return BPromise[_0x6e55('0x23')](_0x3be786);}return _0x2a71e6['save']();};}function saveUpdates(_0x279d41,_0x37865e){return function(_0x35a2a9){if(_0x35a2a9){return _0x35a2a9[_0x6e55('0x24')](_0x279d41)[_0x6e55('0x25')](function(_0x2f1208){return _0x2f1208;});}return null;};}function removeEntity(_0x5dd9a1,_0x57d82d){return function(_0xdcb2bc){if(_0xdcb2bc){return _0xdcb2bc[_0x6e55('0x26')]()[_0x6e55('0x25')](function(){_0x5dd9a1[_0x6e55('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c3d7d,_0x15f3db){return function(_0x92a891){if(!_0x92a891){_0x2c3d7d[_0x6e55('0x19')](0x194);}return _0x92a891;};}function handleError(_0x31acd8,_0x596f50){_0x596f50=_0x596f50||0x1f4;return function(_0xdb92b7){logger['error'](_0xdb92b7[_0x6e55('0x27')]);if(_0xdb92b7[_0x6e55('0x28')]){delete _0xdb92b7[_0x6e55('0x28')];}_0x31acd8['status'](_0x596f50)[_0x6e55('0x29')](_0xdb92b7);};}exports[_0x6e55('0x2a')]=function(_0x45506f,_0x10b018){var _0x31c179={},_0xf05a8={},_0x284f4c={'count':0x0,'rows':[]};var _0x6a4419=_[_0x6e55('0x2b')](db[_0x6e55('0x2c')]['rawAttributes'],function(_0x588e78){return{'name':_0x588e78['fieldName'],'type':_0x588e78[_0x6e55('0x2d')][_0x6e55('0x2e')]};});_0xf05a8['model']=_[_0x6e55('0x2b')](_0x6a4419,_0x6e55('0x28'));_0xf05a8[_0x6e55('0x2f')]=_[_0x6e55('0x30')](_0x45506f['query']);_0xf05a8['filters']=_[_0x6e55('0x31')](_0xf05a8[_0x6e55('0x32')],_0xf05a8[_0x6e55('0x2f')]);_0x31c179[_0x6e55('0x33')]=_[_0x6e55('0x31')](_0xf05a8[_0x6e55('0x32')],qs[_0x6e55('0x34')](_0x45506f['query'][_0x6e55('0x34')]));_0x31c179['attributes']=_0x31c179[_0x6e55('0x33')]['length']?_0x31c179[_0x6e55('0x33')]:_0xf05a8['model'];if(!_0x45506f[_0x6e55('0x2f')][_0x6e55('0x35')](_0x6e55('0x36'))){_0x31c179[_0x6e55('0x1f')]=qs[_0x6e55('0x1f')](_0x45506f[_0x6e55('0x2f')]['limit']);_0x31c179[_0x6e55('0x1d')]=qs[_0x6e55('0x1d')](_0x45506f['query'][_0x6e55('0x1d')]);}_0x31c179[_0x6e55('0x37')]=qs[_0x6e55('0x38')](_0x45506f['query'][_0x6e55('0x38')]);_0x31c179['where']=qs[_0x6e55('0x39')](_[_0x6e55('0x3a')](_0x45506f[_0x6e55('0x2f')],_0xf05a8[_0x6e55('0x39')]),_0x6a4419);if(_0x45506f[_0x6e55('0x2f')]['filter']){_0x31c179[_0x6e55('0x3b')]=_['merge'](_0x31c179[_0x6e55('0x3b')],{'$or':_['map'](_0x6a4419,function(_0x2f4f50){if(_0x2f4f50['type']!==_0x6e55('0x3c')){var _0x30405f={};_0x30405f[_0x2f4f50[_0x6e55('0x28')]]={'$like':'%'+_0x45506f[_0x6e55('0x2f')][_0x6e55('0x3d')]+'%'};return _0x30405f;}})});}_0x31c179=_[_0x6e55('0x3e')]({},_0x31c179,_0x45506f[_0x6e55('0x3f')]);var _0x478f7e={'where':_0x31c179[_0x6e55('0x3b')]};return db['IntegrationReport']['count'](_0x478f7e)[_0x6e55('0x25')](function(_0x429049){_0x284f4c[_0x6e55('0x20')]=_0x429049;if(_0x45506f[_0x6e55('0x2f')][_0x6e55('0x40')]){_0x31c179[_0x6e55('0x41')]=[{'all':!![]}];}return db['IntegrationReport'][_0x6e55('0x42')](_0x31c179);})['then'](function(_0x3ab4b6){_0x284f4c[_0x6e55('0x43')]=_0x3ab4b6;return _0x284f4c;})[_0x6e55('0x25')](respondWithFilteredResult(_0x10b018,_0x31c179))[_0x6e55('0x44')](handleError(_0x10b018,null));};exports[_0x6e55('0x45')]=function(_0x4a3044,_0x387945){var _0x4db12c={'raw':![],'where':{'id':_0x4a3044['params']['id']}},_0x5ea114={};_0x5ea114[_0x6e55('0x32')]=_[_0x6e55('0x30')](db[_0x6e55('0x2c')]['rawAttributes']);_0x5ea114['query']=_[_0x6e55('0x30')](_0x4a3044[_0x6e55('0x2f')]);_0x5ea114[_0x6e55('0x39')]=_[_0x6e55('0x31')](_0x5ea114[_0x6e55('0x32')],_0x5ea114['query']);_0x4db12c[_0x6e55('0x33')]=_['intersection'](_0x5ea114[_0x6e55('0x32')],qs[_0x6e55('0x34')](_0x4a3044[_0x6e55('0x2f')][_0x6e55('0x34')]));_0x4db12c[_0x6e55('0x33')]=_0x4db12c['attributes'][_0x6e55('0x46')]?_0x4db12c[_0x6e55('0x33')]:_0x5ea114[_0x6e55('0x32')];if(_0x4a3044[_0x6e55('0x2f')]['includeAll']){_0x4db12c[_0x6e55('0x41')]=[{'all':!![]}];}_0x4db12c=_['merge']({},_0x4db12c,_0x4a3044['options']);return db[_0x6e55('0x2c')][_0x6e55('0x47')](_0x4db12c)[_0x6e55('0x25')](handleEntityNotFound(_0x387945,null))[_0x6e55('0x25')](respondWithResult(_0x387945,null))['catch'](handleError(_0x387945,null));};exports['create']=function(_0x481922,_0x45d438){return db['IntegrationReport'][_0x6e55('0x48')](_0x481922['body'],{})[_0x6e55('0x25')](respondWithResult(_0x45d438,0xc9))[_0x6e55('0x44')](handleError(_0x45d438,null));};exports[_0x6e55('0x24')]=function(_0x4dcb6f,_0x27dc43){if(_0x4dcb6f[_0x6e55('0x49')]['id']){delete _0x4dcb6f[_0x6e55('0x49')]['id'];}return db[_0x6e55('0x2c')][_0x6e55('0x47')]({'where':{'id':_0x4dcb6f['params']['id']}})['then'](handleEntityNotFound(_0x27dc43,null))[_0x6e55('0x25')](saveUpdates(_0x4dcb6f['body'],null))[_0x6e55('0x25')](respondWithResult(_0x27dc43,null))[_0x6e55('0x44')](handleError(_0x27dc43,null));};exports[_0x6e55('0x26')]=function(_0xca94f3,_0x558ba9){return db[_0x6e55('0x2c')][_0x6e55('0x47')]({'where':{'id':_0xca94f3[_0x6e55('0x4a')]['id']}})[_0x6e55('0x25')](handleEntityNotFound(_0x558ba9,null))['then'](removeEntity(_0x558ba9,null))[_0x6e55('0x44')](handleError(_0x558ba9,null));};exports[_0x6e55('0x4b')]=function(_0x6c543e,_0x19b938){return db['IntegrationReport']['describe']()['then'](respondWithResult(_0x19b938,null))[_0x6e55('0x44')](handleError(_0x19b938,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 31e664e..5229526 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 _0x88e0=['bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','IntegrationReport','report_integration','lodash','../../config/logger','api','moment'];(function(_0x5df311,_0x148e1a){var _0x278b94=function(_0x5ea803){while(--_0x5ea803){_0x5df311['push'](_0x5df311['shift']());}};_0x278b94(++_0x148e1a);}(_0x88e0,0x98));var _0x088e=function(_0x547c98,_0x273584){_0x547c98=_0x547c98-0x0;var _0x3cd14c=_0x88e0[_0x547c98];return _0x3cd14c;};'use strict';var _=require(_0x088e('0x0'));var util=require('util');var logger=require(_0x088e('0x1'))(_0x088e('0x2'));var moment=require(_0x088e('0x3'));var BPromise=require(_0x088e('0x4'));var rp=require(_0x088e('0x5'));var fs=require('fs');var path=require(_0x088e('0x6'));var rimraf=require(_0x088e('0x7'));var config=require(_0x088e('0x8'));var attributes=require(_0x088e('0x9'));module['exports']=function(_0x1c3de0,_0x26d628){return _0x1c3de0['define'](_0x088e('0xa'),attributes,{'tableName':_0x088e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c5c=['api','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','util','../../config/logger'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x0c5c,0xf5));var _0xc0c5=function(_0x299ef2,_0x393045){_0x299ef2=_0x299ef2-0x0;var _0x4f9281=_0x0c5c[_0x299ef2];return _0x4f9281;};'use strict';var _=require('lodash');var util=require(_0xc0c5('0x0'));var logger=require(_0xc0c5('0x1'))(_0xc0c5('0x2'));var moment=require('moment');var BPromise=require(_0xc0c5('0x3'));var rp=require(_0xc0c5('0x4'));var fs=require('fs');var path=require(_0xc0c5('0x5'));var rimraf=require(_0xc0c5('0x6'));var config=require(_0xc0c5('0x7'));var attributes=require(_0xc0c5('0x8'));module[_0xc0c5('0x9')]=function(_0x40a681,_0x33b4d0){return _0x40a681[_0xc0c5('0xa')](_0xc0c5('0xb'),attributes,{'tableName':_0xc0c5('0xc'),'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 368ce87..9a9e3a4 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 _0x2542=['info','IntegrationReport,\x20%s,\x20%s','debug','IntegrationReport,\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(_0x4fe2c5,_0x764f2c){var _0x43db45=function(_0xd172f7){while(--_0xd172f7){_0x4fe2c5['push'](_0x4fe2c5['shift']());}};_0x43db45(++_0x764f2c);}(_0x2542,0x169));var _0x2254=function(_0x5077aa,_0x522b9f){_0x5077aa=_0x5077aa-0x0;var _0x45fdff=_0x2542[_0x5077aa];return _0x45fdff;};'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 _0xe2fe=['then','info','IntegrationReport,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x44bbce,_0x23d9b6){var _0xe30275=function(_0x29042a){while(--_0x29042a){_0x44bbce['push'](_0x44bbce['shift']());}};_0xe30275(++_0x23d9b6);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xee2f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee2f('0x2'));var db=require(_0xee2f('0x3'))['db'];var utils=require(_0xee2f('0x4'));var logger=require(_0xee2f('0x5'))(_0xee2f('0x6'));var config=require('../../config/environment');var jayson=require(_0xee2f('0x7'));var client=jayson[_0xee2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1533a0,_0x2e1c8c,_0x5a7975){return new BPromise(function(_0x3c4095,_0x5ea796){return client[_0xee2f('0x9')](_0x1533a0,_0x5a7975)[_0xee2f('0xa')](function(_0x53f7dd){logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,'request\x20sent');logger['debug']('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x2e1c8c,'request\x20sent',JSON[_0xee2f('0xd')](_0x53f7dd));if(_0x53f7dd['error']){if(_0x53f7dd['error']['code']===0x1f4){logger[_0xee2f('0xe')](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);return _0x5ea796(_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);}logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd['error'][_0xee2f('0xf')]);return _0x3c4095(_0x53f7dd[_0xee2f('0xe')]['message']);}else{logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,_0xee2f('0x10'));_0x3c4095(_0x53f7dd[_0xee2f('0x11')][_0xee2f('0xf')]);}})['catch'](function(_0x3f6372){logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x3f6372);_0x5ea796(_0x3f6372);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 7e349cd..929ed24 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 _0x2899=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','getIntervals','post','isAuthenticated','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','/:id','update','delete'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x2899,0xfe));var _0x9289=function(_0xaa16d5,_0x2520a7){_0xaa16d5=_0xaa16d5-0x0;var _0x5e61b8=_0x2899[_0xaa16d5];return _0x5e61b8;};'use strict';var multer=require(_0x9289('0x0'));var util=require(_0x9289('0x1'));var path=require(_0x9289('0x2'));var timeout=require(_0x9289('0x3'));var express=require(_0x9289('0x4'));var router=express[_0x9289('0x5')]();var fs_extra=require(_0x9289('0x6'));var auth=require(_0x9289('0x7'));var interaction=require(_0x9289('0x8'));var config=require('../../config/environment');var controller=require('./interval.controller');router[_0x9289('0x9')]('/',auth['isAuthenticated'](),controller[_0x9289('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['get']('/:id/sub_intervals',auth['isAuthenticated'](),controller[_0x9289('0xb')]);router[_0x9289('0xc')]('/',auth[_0x9289('0xd')](),controller[_0x9289('0xe')]);router[_0x9289('0xc')]('/:id/sub_intervals',auth[_0x9289('0xd')](),controller[_0x9289('0xf')]);router[_0x9289('0xc')](_0x9289('0x10'),auth[_0x9289('0xd')](),controller[_0x9289('0x11')]);router[_0x9289('0x12')](_0x9289('0x13'),auth[_0x9289('0xd')](),controller[_0x9289('0x14')]);router[_0x9289('0x15')]('/:id',auth[_0x9289('0xd')](),controller['destroy']);module[_0x9289('0x16')]=router; \ No newline at end of file +var _0x2bd8=['addIntervals','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./interval.controller','get','isAuthenticated','/:id','show','/:id/sub_intervals','post','/:id/sub_intervals/create_many'];(function(_0x14915a,_0x222f6b){var _0x2f683c=function(_0x28e694){while(--_0x28e694){_0x14915a['push'](_0x14915a['shift']());}};_0x2f683c(++_0x222f6b);}(_0x2bd8,0x130));var _0x82bd=function(_0x4f27f2,_0x472008){_0x4f27f2=_0x4f27f2-0x0;var _0x1f079b=_0x2bd8[_0x4f27f2];return _0x1f079b;};'use strict';var multer=require(_0x82bd('0x0'));var util=require('util');var path=require(_0x82bd('0x1'));var timeout=require(_0x82bd('0x2'));var express=require(_0x82bd('0x3'));var router=express[_0x82bd('0x4')]();var fs_extra=require(_0x82bd('0x5'));var auth=require(_0x82bd('0x6'));var interaction=require(_0x82bd('0x7'));var config=require('../../config/environment');var controller=require(_0x82bd('0x8'));router[_0x82bd('0x9')]('/',auth[_0x82bd('0xa')](),controller['index']);router[_0x82bd('0x9')](_0x82bd('0xb'),auth[_0x82bd('0xa')](),controller[_0x82bd('0xc')]);router['get'](_0x82bd('0xd'),auth['isAuthenticated'](),controller['getIntervals']);router['post']('/',auth[_0x82bd('0xa')](),controller['create']);router['post'](_0x82bd('0xd'),auth['isAuthenticated'](),controller['addInterval']);router[_0x82bd('0xe')](_0x82bd('0xf'),auth['isAuthenticated'](),controller[_0x82bd('0x10')]);router['put'](_0x82bd('0xb'),auth['isAuthenticated'](),controller[_0x82bd('0x11')]);router[_0x82bd('0x12')](_0x82bd('0xb'),auth[_0x82bd('0xa')](),controller['destroy']);module[_0x82bd('0x13')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 0af16bb..e19bf64 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 _0xd09e=['STRING','sequelize'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0xd09e,0x85));var _0xed09=function(_0x20dd8d,_0x464aca){_0x20dd8d=_0x20dd8d-0x0;var _0xda17db=_0xd09e[_0x20dd8d];return _0xda17db;};'use strict';var Sequelize=require(_0xed09('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xed09('0x1')]},'interval':{'type':Sequelize[_0xed09('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x3a82=['STRING','exports'];(function(_0x11309c,_0xe18a74){var _0x3fea9c=function(_0xeb11c3){while(--_0xeb11c3){_0x11309c['push'](_0x11309c['shift']());}};_0x3fea9c(++_0xe18a74);}(_0x3a82,0xd5));var _0x23a8=function(_0x3e2a10,_0x3df9ce){_0x3e2a10=_0x3e2a10-0x0;var _0x37c489=_0x3a82[_0x3e2a10];return _0x37c489;};'use strict';var Sequelize=require('sequelize');module[_0x23a8('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x23a8('0x1')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 0e7f431..887184f 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 _0x2a4d=['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','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','get','Intervals','UserProfileResource','destroy','error','name','send','index','Interval','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','update','params','getIntervals','findOne','sort','merge','addIntervals','sequelize','transaction','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x51f8a0,_0x4f425e){var _0x4591d0=function(_0x4e3721){while(--_0x4e3721){_0x51f8a0['push'](_0x51f8a0['shift']());}};_0x4591d0(++_0x4f425e);}(_0x2a4d,0xaf));var _0xd2a4=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x2a4d[_0x422905];return _0x33dc6c;};'use strict';var emlformat=require(_0xd2a4('0x0'));var rimraf=require(_0xd2a4('0x1'));var zipdir=require(_0xd2a4('0x2'));var jsonpatch=require(_0xd2a4('0x3'));var rp=require('request-promise');var moment=require(_0xd2a4('0x4'));var BPromise=require(_0xd2a4('0x5'));var Mustache=require(_0xd2a4('0x6'));var util=require(_0xd2a4('0x7'));var path=require(_0xd2a4('0x8'));var sox=require(_0xd2a4('0x9'));var csv=require('to-csv');var ejs=require(_0xd2a4('0xa'));var fs=require('fs');var fs_extra=require(_0xd2a4('0xb'));var _=require(_0xd2a4('0xc'));var squel=require(_0xd2a4('0xd'));var crypto=require(_0xd2a4('0xe'));var jsforce=require(_0xd2a4('0xf'));var deskjs=require(_0xd2a4('0x10'));var toCsv=require(_0xd2a4('0x11'));var querystring=require(_0xd2a4('0x12'));var Papa=require('papaparse');var Redis=require(_0xd2a4('0x13'));var authService=require(_0xd2a4('0x14'));var qs=require(_0xd2a4('0x15'));var as=require(_0xd2a4('0x16'));var hardwareService=require(_0xd2a4('0x17'));var logger=require('../../config/logger')(_0xd2a4('0x18'));var utils=require(_0xd2a4('0x19'));var config=require(_0xd2a4('0x1a'));var licenseUtil=require(_0xd2a4('0x1b'));var db=require(_0xd2a4('0x1c'))['db'];var extensions=require(_0xd2a4('0x1d'));function respondWithStatusCode(_0x52caa7,_0xa45c37){_0xa45c37=_0xa45c37||0xcc;return function(_0xb0d216){if(_0xb0d216){return _0x52caa7[_0xd2a4('0x1e')](_0xa45c37);}return _0x52caa7[_0xd2a4('0x1f')](_0xa45c37)[_0xd2a4('0x20')]();};}function respondWithResult(_0x1bcccd,_0x347ae7){_0x347ae7=_0x347ae7||0xc8;return function(_0x1e47bd){if(_0x1e47bd){return _0x1bcccd[_0xd2a4('0x1f')](_0x347ae7)[_0xd2a4('0x21')](_0x1e47bd);}};}function respondWithFilteredResult(_0x20f80c,_0xbf2168){return function(_0xbdd848){if(_0xbdd848){var _0x5128cf=typeof _0xbf2168[_0xd2a4('0x22')]==='undefined'&&typeof _0xbf2168['limit']===_0xd2a4('0x23');var _0x5d83da=_0xbdd848[_0xd2a4('0x24')];var _0x50579a=_0x5128cf?0x0:_0xbf2168[_0xd2a4('0x22')];var _0x432f01=_0x5128cf?_0xbdd848[_0xd2a4('0x24')]:_0xbf2168[_0xd2a4('0x22')]+_0xbf2168[_0xd2a4('0x25')];var _0x224212;if(_0x432f01>=_0x5d83da){_0x432f01=_0x5d83da;_0x224212=0xc8;}else{_0x224212=0xce;}_0x20f80c[_0xd2a4('0x1f')](_0x224212);return _0x20f80c['set'](_0xd2a4('0x26'),_0x50579a+'-'+_0x432f01+'/'+_0x5d83da)[_0xd2a4('0x21')](_0xbdd848);}return null;};}function patchUpdates(_0x3a0db6){return function(_0x1266c1){try{jsonpatch[_0xd2a4('0x27')](_0x1266c1,_0x3a0db6,!![]);}catch(_0x132f50){return BPromise[_0xd2a4('0x28')](_0x132f50);}return _0x1266c1[_0xd2a4('0x29')]();};}function saveUpdates(_0x336082,_0xb4bfec){return function(_0x3620de){if(_0x3620de){return _0x3620de['update'](_0x336082)[_0xd2a4('0x2a')](function(_0x2ab492){return _0x2ab492;});}return null;};}function removeEntity(_0x1660e1,_0x14702d){return function(_0x228900){if(_0x228900){return _0x228900['destroy']()[_0xd2a4('0x2a')](function(){var _0x332374=_0x228900[_0xd2a4('0x2b')]({'plain':!![]});var _0x1f6b2e=_0xd2a4('0x2c');return db[_0xd2a4('0x2d')][_0xd2a4('0x2e')]({'where':{'type':_0x1f6b2e,'resourceId':_0x332374['id']}})[_0xd2a4('0x2a')](function(){return _0x228900;});})[_0xd2a4('0x2a')](function(){_0x1660e1[_0xd2a4('0x1f')](0xcc)[_0xd2a4('0x20')]();});}};}function handleEntityNotFound(_0x5d5d89,_0x391bb2){return function(_0x37465f){if(!_0x37465f){_0x5d5d89['sendStatus'](0x194);}return _0x37465f;};}function handleError(_0x2ede38,_0x18817c){_0x18817c=_0x18817c||0x1f4;return function(_0x32966a){logger[_0xd2a4('0x2f')](_0x32966a['stack']);if(_0x32966a[_0xd2a4('0x30')]){delete _0x32966a[_0xd2a4('0x30')];}_0x2ede38[_0xd2a4('0x1f')](_0x18817c)[_0xd2a4('0x31')](_0x32966a);};}exports[_0xd2a4('0x32')]=function(_0x3790d0,_0x2c5052){var _0x3eb866={},_0x1505e7={},_0x5898aa={'count':0x0,'rows':[]};var _0x4bad41=_['map'](db[_0xd2a4('0x33')][_0xd2a4('0x34')],function(_0x4b127b){return{'name':_0x4b127b[_0xd2a4('0x35')],'type':_0x4b127b['type'][_0xd2a4('0x36')]};});_0x1505e7[_0xd2a4('0x37')]=_[_0xd2a4('0x38')](_0x4bad41,_0xd2a4('0x30'));_0x1505e7[_0xd2a4('0x39')]=_[_0xd2a4('0x3a')](_0x3790d0[_0xd2a4('0x39')]);_0x1505e7[_0xd2a4('0x3b')]=_[_0xd2a4('0x3c')](_0x1505e7[_0xd2a4('0x37')],_0x1505e7[_0xd2a4('0x39')]);_0x3eb866[_0xd2a4('0x3d')]=_[_0xd2a4('0x3c')](_0x1505e7[_0xd2a4('0x37')],qs['fields'](_0x3790d0[_0xd2a4('0x39')][_0xd2a4('0x3e')]));_0x3eb866[_0xd2a4('0x3d')]=_0x3eb866[_0xd2a4('0x3d')][_0xd2a4('0x3f')]?_0x3eb866[_0xd2a4('0x3d')]:_0x1505e7['model'];if(!_0x3790d0[_0xd2a4('0x39')][_0xd2a4('0x40')](_0xd2a4('0x41'))){_0x3eb866[_0xd2a4('0x25')]=qs[_0xd2a4('0x25')](_0x3790d0[_0xd2a4('0x39')][_0xd2a4('0x25')]);_0x3eb866[_0xd2a4('0x22')]=qs[_0xd2a4('0x22')](_0x3790d0[_0xd2a4('0x39')][_0xd2a4('0x22')]);}_0x3eb866[_0xd2a4('0x42')]=qs['sort'](_0x3790d0[_0xd2a4('0x39')]['sort']);_0x3eb866[_0xd2a4('0x43')]=qs[_0xd2a4('0x3b')](_[_0xd2a4('0x44')](_0x3790d0[_0xd2a4('0x39')],_0x1505e7[_0xd2a4('0x3b')]),_0x4bad41);if(_0x3790d0[_0xd2a4('0x39')][_0xd2a4('0x45')]){_0x3eb866['where']=_['merge'](_0x3eb866[_0xd2a4('0x43')],{'$or':_[_0xd2a4('0x38')](_0x4bad41,function(_0x4a5251){if(_0x4a5251[_0xd2a4('0x46')]!==_0xd2a4('0x47')){var _0x50864d={};_0x50864d[_0x4a5251[_0xd2a4('0x30')]]={'$like':'%'+_0x3790d0[_0xd2a4('0x39')]['filter']+'%'};return _0x50864d;}})});}_0x3eb866=_['merge']({},_0x3eb866,_0x3790d0[_0xd2a4('0x48')]);var _0x471e31={'where':_0x3eb866['where']};return db[_0xd2a4('0x33')][_0xd2a4('0x24')](_0x471e31)[_0xd2a4('0x2a')](function(_0xc766a3){_0x5898aa[_0xd2a4('0x24')]=_0xc766a3;if(_0x3790d0[_0xd2a4('0x39')][_0xd2a4('0x49')]){_0x3eb866[_0xd2a4('0x4a')]=[{'all':!![]}];}return db[_0xd2a4('0x33')][_0xd2a4('0x4b')](_0x3eb866);})[_0xd2a4('0x2a')](function(_0x4cb531){_0x5898aa[_0xd2a4('0x4c')]=_0x4cb531;return _0x5898aa;})['then'](respondWithFilteredResult(_0x2c5052,_0x3eb866))[_0xd2a4('0x4d')](handleError(_0x2c5052,null));};exports['show']=function(_0x4b4c0c,_0x2639fc){var _0x8ef6fe={'raw':!![],'where':{'id':_0x4b4c0c['params']['id']}},_0x224774={};_0x224774[_0xd2a4('0x37')]=_[_0xd2a4('0x3a')](db['Interval'][_0xd2a4('0x34')]);_0x224774[_0xd2a4('0x39')]=_['keys'](_0x4b4c0c[_0xd2a4('0x39')]);_0x224774['filters']=_['intersection'](_0x224774[_0xd2a4('0x37')],_0x224774[_0xd2a4('0x39')]);_0x8ef6fe['attributes']=_[_0xd2a4('0x3c')](_0x224774[_0xd2a4('0x37')],qs['fields'](_0x4b4c0c[_0xd2a4('0x39')][_0xd2a4('0x3e')]));_0x8ef6fe[_0xd2a4('0x3d')]=_0x8ef6fe[_0xd2a4('0x3d')][_0xd2a4('0x3f')]?_0x8ef6fe[_0xd2a4('0x3d')]:_0x224774[_0xd2a4('0x37')];if(_0x4b4c0c[_0xd2a4('0x39')][_0xd2a4('0x49')]){_0x8ef6fe[_0xd2a4('0x4a')]=[{'all':!![]}];}_0x8ef6fe=_['merge']({},_0x8ef6fe,_0x4b4c0c[_0xd2a4('0x48')]);return db[_0xd2a4('0x33')]['find'](_0x8ef6fe)[_0xd2a4('0x2a')](handleEntityNotFound(_0x2639fc,null))[_0xd2a4('0x2a')](respondWithResult(_0x2639fc,null))[_0xd2a4('0x4d')](handleError(_0x2639fc,null));};exports[_0xd2a4('0x4e')]=function(_0x4662b8,_0x17bf11){return db['Interval']['create'](_0x4662b8[_0xd2a4('0x4f')],{})[_0xd2a4('0x2a')](function(_0x16ff2c){var _0x5ede40=_0x4662b8[_0xd2a4('0x50')][_0xd2a4('0x2b')]({'plain':!![]});if(!_0x5ede40)throw new Error(_0xd2a4('0x51'));if(_0x5ede40[_0xd2a4('0x52')]===_0xd2a4('0x50')){var _0x3fb91f=_0x16ff2c[_0xd2a4('0x2b')]({'plain':!![]});var _0x42f4bf=_0xd2a4('0x2c');return db[_0xd2a4('0x53')][_0xd2a4('0x54')]({'where':{'name':_0x42f4bf,'userProfileId':_0x5ede40[_0xd2a4('0x55')]},'raw':!![]})[_0xd2a4('0x2a')](function(_0x147624){if(_0x147624&&_0x147624['autoAssociation']===0x0){return db['UserProfileResource'][_0xd2a4('0x4e')]({'name':_0x3fb91f[_0xd2a4('0x30')],'resourceId':_0x3fb91f['id'],'type':_0x147624['name'],'sectionId':_0x147624['id']},{})['then'](function(){return _0x16ff2c;});}else{return _0x16ff2c;}})['catch'](function(_0x52fdce){logger[_0xd2a4('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x52fdce);throw _0x52fdce;});}return _0x16ff2c;})[_0xd2a4('0x2a')](respondWithResult(_0x17bf11,0xc9))[_0xd2a4('0x4d')](handleError(_0x17bf11,null));};exports[_0xd2a4('0x56')]=function(_0x5d309a,_0x29f2fd){if(_0x5d309a['body']['id']){delete _0x5d309a['body']['id'];}return db[_0xd2a4('0x33')]['find']({'where':{'id':_0x5d309a[_0xd2a4('0x57')]['id']}})['then'](handleEntityNotFound(_0x29f2fd,null))[_0xd2a4('0x2a')](saveUpdates(_0x5d309a[_0xd2a4('0x4f')],null))[_0xd2a4('0x2a')](respondWithResult(_0x29f2fd,null))[_0xd2a4('0x4d')](handleError(_0x29f2fd,null));};exports[_0xd2a4('0x2e')]=function(_0xc911ec,_0x245bbc){return db[_0xd2a4('0x33')][_0xd2a4('0x54')]({'where':{'id':_0xc911ec[_0xd2a4('0x57')]['id']}})[_0xd2a4('0x2a')](handleEntityNotFound(_0x245bbc,null))[_0xd2a4('0x2a')](removeEntity(_0x245bbc,null))[_0xd2a4('0x4d')](handleError(_0x245bbc,null));};exports['addInterval']=function(_0x2a2d90,_0x418bd9,_0x1d9b21){if(_0x2a2d90[_0xd2a4('0x4f')]['id']){delete _0x2a2d90[_0xd2a4('0x4f')]['id'];}return db[_0xd2a4('0x33')][_0xd2a4('0x54')]({'where':{'id':_0x2a2d90[_0xd2a4('0x57')]['id']}})[_0xd2a4('0x2a')](handleEntityNotFound(_0x418bd9,null))[_0xd2a4('0x2a')](function(_0x1d27ea){if(_0x1d27ea){_0x2a2d90[_0xd2a4('0x4f')]['IntervalId']=_0x1d27ea['id'];return db[_0xd2a4('0x33')]['create'](_0x2a2d90[_0xd2a4('0x4f')]);}})[_0xd2a4('0x2a')](respondWithResult(_0x418bd9,null))[_0xd2a4('0x4d')](handleError(_0x418bd9,null));};exports[_0xd2a4('0x58')]=function(_0x5dbdf8,_0x45d18a,_0x3d1bc7){var _0x597ade={};var _0x661df={};var _0x4656b4;var _0x74158;return db[_0xd2a4('0x33')][_0xd2a4('0x59')]({'where':{'id':_0x5dbdf8[_0xd2a4('0x57')]['id']}})[_0xd2a4('0x2a')](handleEntityNotFound(_0x45d18a,null))['then'](function(_0x3399e3){if(_0x3399e3){_0x4656b4=_0x3399e3;_0x661df[_0xd2a4('0x37')]=_[_0xd2a4('0x3a')](db['Interval']['rawAttributes']);_0x661df[_0xd2a4('0x39')]=_[_0xd2a4('0x3a')](_0x5dbdf8[_0xd2a4('0x39')]);_0x661df['filters']=_[_0xd2a4('0x3c')](_0x661df[_0xd2a4('0x37')],_0x661df[_0xd2a4('0x39')]);_0x597ade['attributes']=_[_0xd2a4('0x3c')](_0x661df[_0xd2a4('0x37')],qs[_0xd2a4('0x3e')](_0x5dbdf8[_0xd2a4('0x39')][_0xd2a4('0x3e')]));_0x597ade[_0xd2a4('0x3d')]=_0x597ade[_0xd2a4('0x3d')]['length']?_0x597ade[_0xd2a4('0x3d')]:_0x661df[_0xd2a4('0x37')];_0x597ade[_0xd2a4('0x42')]=qs[_0xd2a4('0x5a')](_0x5dbdf8[_0xd2a4('0x39')]['sort']);_0x597ade[_0xd2a4('0x43')]=qs[_0xd2a4('0x3b')](_[_0xd2a4('0x44')](_0x5dbdf8[_0xd2a4('0x39')],_0x661df[_0xd2a4('0x3b')]));if(_0x5dbdf8[_0xd2a4('0x39')][_0xd2a4('0x45')]){_0x597ade[_0xd2a4('0x43')]=_[_0xd2a4('0x5b')](_0x597ade[_0xd2a4('0x43')],{'$or':_[_0xd2a4('0x38')](_0x597ade[_0xd2a4('0x3d')],function(_0x1e636a){var _0x42a9fb={};_0x42a9fb[_0x1e636a]={'$like':'%'+_0x5dbdf8['query'][_0xd2a4('0x45')]+'%'};return _0x42a9fb;})});}_0x597ade=_[_0xd2a4('0x5b')]({},_0x597ade,_0x5dbdf8['options']);return _0x4656b4['getIntervals'](_0x597ade);}})[_0xd2a4('0x2a')](function(_0x178a57){if(_0x178a57){_0x74158=_0x178a57[_0xd2a4('0x3f')];if(!_0x5dbdf8[_0xd2a4('0x39')]['hasOwnProperty'](_0xd2a4('0x41'))){_0x597ade[_0xd2a4('0x25')]=qs[_0xd2a4('0x25')](_0x5dbdf8[_0xd2a4('0x39')][_0xd2a4('0x25')]);_0x597ade[_0xd2a4('0x22')]=qs[_0xd2a4('0x22')](_0x5dbdf8[_0xd2a4('0x39')]['offset']);}return _0x4656b4[_0xd2a4('0x58')](_0x597ade);}})[_0xd2a4('0x2a')](function(_0x212ff7){if(_0x212ff7){return _0x212ff7?{'count':_0x74158,'rows':_0x212ff7}:null;}})['then'](respondWithResult(_0x45d18a,null))['catch'](handleError(_0x45d18a,null));};exports[_0xd2a4('0x5c')]=function(_0xca6d4e,_0x3ed106,_0x2afdee){return db[_0xd2a4('0x33')]['findOne']({'where':{'id':_0xca6d4e[_0xd2a4('0x57')]['id']}})['then'](handleEntityNotFound(_0x3ed106,null))[_0xd2a4('0x2a')](function(_0x1f7972){if(_0x1f7972){return db[_0xd2a4('0x5d')][_0xd2a4('0x5e')](function(_0x1e46fa){return db[_0xd2a4('0x33')][_0xd2a4('0x2e')]({'where':{'IntervalId':_0xca6d4e[_0xd2a4('0x57')]['id']},'transaction':_0x1e46fa})[_0xd2a4('0x2a')](function(_0x154118){var _0x2ea819=_[_0xd2a4('0x38')](_0xca6d4e['body'],function(_0x404fab){delete _0x404fab['id'];_0x404fab['IntervalId']=_0xca6d4e['params']['id'];return _0x404fab;});return db[_0xd2a4('0x33')][_0xd2a4('0x5f')](_0x2ea819,{'transaction':_0x1e46fa});});})[_0xd2a4('0x2a')](function(){return db[_0xd2a4('0x33')][_0xd2a4('0x4b')]({'where':{'IntervalId':_0xca6d4e['params']['id']}});});}})[_0xd2a4('0x2a')](respondWithResult(_0x3ed106,null))[_0xd2a4('0x4d')](handleError(_0x3ed106,null));}; \ No newline at end of file +var _0x2663=['sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','length','order','addIntervals','findOne','transaction','bulkCreate','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0x1d7d1a,_0x3f6096){var _0x3e9d89=function(_0x44a8a7){while(--_0x44a8a7){_0x1d7d1a['push'](_0x1d7d1a['shift']());}};_0x3e9d89(++_0x3f6096);}(_0x2663,0x7a));var _0x3266=function(_0x4433b,_0x1eded1){_0x4433b=_0x4433b-0x0;var _0xffc1da=_0x2663[_0x4433b];return _0xffc1da;};'use strict';var emlformat=require(_0x3266('0x0'));var rimraf=require(_0x3266('0x1'));var zipdir=require(_0x3266('0x2'));var jsonpatch=require(_0x3266('0x3'));var rp=require(_0x3266('0x4'));var moment=require(_0x3266('0x5'));var BPromise=require(_0x3266('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x3266('0x7'));var csv=require(_0x3266('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3266('0x9'));var _=require(_0x3266('0xa'));var squel=require(_0x3266('0xb'));var crypto=require(_0x3266('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3266('0xd'));var toCsv=require(_0x3266('0x8'));var querystring=require(_0x3266('0xe'));var Papa=require(_0x3266('0xf'));var Redis=require(_0x3266('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3266('0x11'));var hardwareService=require(_0x3266('0x12'));var logger=require(_0x3266('0x13'))(_0x3266('0x14'));var utils=require(_0x3266('0x15'));var config=require(_0x3266('0x16'));var licenseUtil=require(_0x3266('0x17'));var db=require(_0x3266('0x18'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x537d76,_0x1d3841){_0x1d3841=_0x1d3841||0xcc;return function(_0x68c00e){if(_0x68c00e){return _0x537d76[_0x3266('0x19')](_0x1d3841);}return _0x537d76['status'](_0x1d3841)[_0x3266('0x1a')]();};}function respondWithResult(_0x5d0225,_0x3d3250){_0x3d3250=_0x3d3250||0xc8;return function(_0x128167){if(_0x128167){return _0x5d0225[_0x3266('0x1b')](_0x3d3250)[_0x3266('0x1c')](_0x128167);}};}function respondWithFilteredResult(_0x2bd95a,_0x191d36){return function(_0x53a34e){if(_0x53a34e){var _0x222c36=typeof _0x191d36[_0x3266('0x1d')]===_0x3266('0x1e')&&typeof _0x191d36[_0x3266('0x1f')]===_0x3266('0x1e');var _0x2e6ea0=_0x53a34e['count'];var _0x2650f9=_0x222c36?0x0:_0x191d36['offset'];var _0x366eec=_0x222c36?_0x53a34e[_0x3266('0x20')]:_0x191d36[_0x3266('0x1d')]+_0x191d36['limit'];var _0xed5bf7;if(_0x366eec>=_0x2e6ea0){_0x366eec=_0x2e6ea0;_0xed5bf7=0xc8;}else{_0xed5bf7=0xce;}_0x2bd95a['status'](_0xed5bf7);return _0x2bd95a[_0x3266('0x21')](_0x3266('0x22'),_0x2650f9+'-'+_0x366eec+'/'+_0x2e6ea0)[_0x3266('0x1c')](_0x53a34e);}return null;};}function patchUpdates(_0x354c23){return function(_0xe6a68){try{jsonpatch[_0x3266('0x23')](_0xe6a68,_0x354c23,!![]);}catch(_0x4c6be0){return BPromise['reject'](_0x4c6be0);}return _0xe6a68[_0x3266('0x24')]();};}function saveUpdates(_0x22902d,_0x3c88f8){return function(_0x110c58){if(_0x110c58){return _0x110c58[_0x3266('0x25')](_0x22902d)[_0x3266('0x26')](function(_0x44c120){return _0x44c120;});}return null;};}function removeEntity(_0x3f0027,_0x309e53){return function(_0x18bdfd){if(_0x18bdfd){return _0x18bdfd['destroy']()[_0x3266('0x26')](function(){var _0x1c6b4d=_0x18bdfd[_0x3266('0x27')]({'plain':!![]});var _0x104e9c='Intervals';return db[_0x3266('0x28')][_0x3266('0x29')]({'where':{'type':_0x104e9c,'resourceId':_0x1c6b4d['id']}})[_0x3266('0x26')](function(){return _0x18bdfd;});})['then'](function(){_0x3f0027[_0x3266('0x1b')](0xcc)[_0x3266('0x1a')]();});}};}function handleEntityNotFound(_0x1c2f2d,_0x1255d5){return function(_0x5d0217){if(!_0x5d0217){_0x1c2f2d[_0x3266('0x19')](0x194);}return _0x5d0217;};}function handleError(_0x371f20,_0x7bd775){_0x7bd775=_0x7bd775||0x1f4;return function(_0xfa9734){logger[_0x3266('0x2a')](_0xfa9734[_0x3266('0x2b')]);if(_0xfa9734[_0x3266('0x2c')]){delete _0xfa9734[_0x3266('0x2c')];}_0x371f20[_0x3266('0x1b')](_0x7bd775)[_0x3266('0x2d')](_0xfa9734);};}exports[_0x3266('0x2e')]=function(_0x1ac37e,_0x451387){var _0x53956f={},_0x40f894={},_0x3a1f7f={'count':0x0,'rows':[]};var _0x5caefd=_[_0x3266('0x2f')](db[_0x3266('0x30')][_0x3266('0x31')],function(_0x40168e){return{'name':_0x40168e[_0x3266('0x32')],'type':_0x40168e[_0x3266('0x33')]['key']};});_0x40f894[_0x3266('0x34')]=_[_0x3266('0x2f')](_0x5caefd,_0x3266('0x2c'));_0x40f894[_0x3266('0x35')]=_[_0x3266('0x36')](_0x1ac37e['query']);_0x40f894['filters']=_[_0x3266('0x37')](_0x40f894[_0x3266('0x34')],_0x40f894['query']);_0x53956f[_0x3266('0x38')]=_[_0x3266('0x37')](_0x40f894['model'],qs[_0x3266('0x39')](_0x1ac37e[_0x3266('0x35')][_0x3266('0x39')]));_0x53956f[_0x3266('0x38')]=_0x53956f[_0x3266('0x38')]['length']?_0x53956f['attributes']:_0x40f894[_0x3266('0x34')];if(!_0x1ac37e[_0x3266('0x35')][_0x3266('0x3a')](_0x3266('0x3b'))){_0x53956f['limit']=qs[_0x3266('0x1f')](_0x1ac37e[_0x3266('0x35')][_0x3266('0x1f')]);_0x53956f[_0x3266('0x1d')]=qs['offset'](_0x1ac37e[_0x3266('0x35')][_0x3266('0x1d')]);}_0x53956f['order']=qs[_0x3266('0x3c')](_0x1ac37e['query'][_0x3266('0x3c')]);_0x53956f['where']=qs['filters'](_['pick'](_0x1ac37e['query'],_0x40f894[_0x3266('0x3d')]),_0x5caefd);if(_0x1ac37e['query'][_0x3266('0x3e')]){_0x53956f[_0x3266('0x3f')]=_[_0x3266('0x40')](_0x53956f[_0x3266('0x3f')],{'$or':_['map'](_0x5caefd,function(_0x55a3c3){if(_0x55a3c3['type']!==_0x3266('0x41')){var _0x1a92d5={};_0x1a92d5[_0x55a3c3[_0x3266('0x2c')]]={'$like':'%'+_0x1ac37e[_0x3266('0x35')][_0x3266('0x3e')]+'%'};return _0x1a92d5;}})});}_0x53956f=_[_0x3266('0x40')]({},_0x53956f,_0x1ac37e[_0x3266('0x42')]);var _0x47bf10={'where':_0x53956f['where']};return db['Interval']['count'](_0x47bf10)[_0x3266('0x26')](function(_0x472d13){_0x3a1f7f[_0x3266('0x20')]=_0x472d13;if(_0x1ac37e['query'][_0x3266('0x43')]){_0x53956f[_0x3266('0x44')]=[{'all':!![]}];}return db[_0x3266('0x30')]['findAll'](_0x53956f);})[_0x3266('0x26')](function(_0x5b2102){_0x3a1f7f[_0x3266('0x45')]=_0x5b2102;return _0x3a1f7f;})['then'](respondWithFilteredResult(_0x451387,_0x53956f))[_0x3266('0x46')](handleError(_0x451387,null));};exports[_0x3266('0x47')]=function(_0x3515c4,_0x2f0e7b){var _0x375201={'raw':!![],'where':{'id':_0x3515c4[_0x3266('0x48')]['id']}},_0x1fd315={};_0x1fd315[_0x3266('0x34')]=_[_0x3266('0x36')](db[_0x3266('0x30')][_0x3266('0x31')]);_0x1fd315[_0x3266('0x35')]=_[_0x3266('0x36')](_0x3515c4[_0x3266('0x35')]);_0x1fd315[_0x3266('0x3d')]=_[_0x3266('0x37')](_0x1fd315['model'],_0x1fd315[_0x3266('0x35')]);_0x375201[_0x3266('0x38')]=_[_0x3266('0x37')](_0x1fd315['model'],qs[_0x3266('0x39')](_0x3515c4['query'][_0x3266('0x39')]));_0x375201[_0x3266('0x38')]=_0x375201[_0x3266('0x38')]['length']?_0x375201['attributes']:_0x1fd315['model'];if(_0x3515c4['query']['includeAll']){_0x375201[_0x3266('0x44')]=[{'all':!![]}];}_0x375201=_[_0x3266('0x40')]({},_0x375201,_0x3515c4[_0x3266('0x42')]);return db[_0x3266('0x30')]['find'](_0x375201)[_0x3266('0x26')](handleEntityNotFound(_0x2f0e7b,null))[_0x3266('0x26')](respondWithResult(_0x2f0e7b,null))[_0x3266('0x46')](handleError(_0x2f0e7b,null));};exports[_0x3266('0x49')]=function(_0x14a924,_0x1c52b8){return db[_0x3266('0x30')][_0x3266('0x49')](_0x14a924[_0x3266('0x4a')],{})['then'](function(_0x3897f9){var _0x3c91b6=_0x14a924[_0x3266('0x4b')][_0x3266('0x27')]({'plain':!![]});if(!_0x3c91b6)throw new Error(_0x3266('0x4c'));if(_0x3c91b6[_0x3266('0x4d')]===_0x3266('0x4b')){var _0x5c2bd7=_0x3897f9[_0x3266('0x27')]({'plain':!![]});var _0x8e3e11='Intervals';return db[_0x3266('0x4e')][_0x3266('0x4f')]({'where':{'name':_0x8e3e11,'userProfileId':_0x3c91b6['userProfileId']},'raw':!![]})[_0x3266('0x26')](function(_0x42d914){if(_0x42d914&&_0x42d914['autoAssociation']===0x0){return db['UserProfileResource'][_0x3266('0x49')]({'name':_0x5c2bd7['name'],'resourceId':_0x5c2bd7['id'],'type':_0x42d914[_0x3266('0x2c')],'sectionId':_0x42d914['id']},{})['then'](function(){return _0x3897f9;});}else{return _0x3897f9;}})['catch'](function(_0x1767c9){logger['error'](_0x3266('0x50'),_0x1767c9);throw _0x1767c9;});}return _0x3897f9;})[_0x3266('0x26')](respondWithResult(_0x1c52b8,0xc9))[_0x3266('0x46')](handleError(_0x1c52b8,null));};exports[_0x3266('0x25')]=function(_0x1b060f,_0xc242d){if(_0x1b060f[_0x3266('0x4a')]['id']){delete _0x1b060f[_0x3266('0x4a')]['id'];}return db[_0x3266('0x30')]['find']({'where':{'id':_0x1b060f[_0x3266('0x48')]['id']}})[_0x3266('0x26')](handleEntityNotFound(_0xc242d,null))[_0x3266('0x26')](saveUpdates(_0x1b060f[_0x3266('0x4a')],null))[_0x3266('0x26')](respondWithResult(_0xc242d,null))[_0x3266('0x46')](handleError(_0xc242d,null));};exports['destroy']=function(_0xe608c9,_0x4d77d7){return db[_0x3266('0x30')][_0x3266('0x4f')]({'where':{'id':_0xe608c9[_0x3266('0x48')]['id']}})['then'](handleEntityNotFound(_0x4d77d7,null))['then'](removeEntity(_0x4d77d7,null))['catch'](handleError(_0x4d77d7,null));};exports[_0x3266('0x51')]=function(_0x5b2f26,_0x33f14a,_0x1e930f){if(_0x5b2f26[_0x3266('0x4a')]['id']){delete _0x5b2f26[_0x3266('0x4a')]['id'];}return db[_0x3266('0x30')][_0x3266('0x4f')]({'where':{'id':_0x5b2f26[_0x3266('0x48')]['id']}})['then'](handleEntityNotFound(_0x33f14a,null))[_0x3266('0x26')](function(_0x3d2516){if(_0x3d2516){_0x5b2f26[_0x3266('0x4a')][_0x3266('0x52')]=_0x3d2516['id'];return db[_0x3266('0x30')][_0x3266('0x49')](_0x5b2f26[_0x3266('0x4a')]);}})['then'](respondWithResult(_0x33f14a,null))[_0x3266('0x46')](handleError(_0x33f14a,null));};exports[_0x3266('0x53')]=function(_0x520a06,_0xd32995,_0x39e245){var _0x232e26={};var _0x5d864a={};var _0x27dafe;var _0xb892bb;return db[_0x3266('0x30')]['findOne']({'where':{'id':_0x520a06['params']['id']}})[_0x3266('0x26')](handleEntityNotFound(_0xd32995,null))[_0x3266('0x26')](function(_0x59263b){if(_0x59263b){_0x27dafe=_0x59263b;_0x5d864a[_0x3266('0x34')]=_[_0x3266('0x36')](db[_0x3266('0x30')][_0x3266('0x31')]);_0x5d864a[_0x3266('0x35')]=_[_0x3266('0x36')](_0x520a06[_0x3266('0x35')]);_0x5d864a[_0x3266('0x3d')]=_[_0x3266('0x37')](_0x5d864a[_0x3266('0x34')],_0x5d864a[_0x3266('0x35')]);_0x232e26[_0x3266('0x38')]=_['intersection'](_0x5d864a[_0x3266('0x34')],qs[_0x3266('0x39')](_0x520a06[_0x3266('0x35')]['fields']));_0x232e26[_0x3266('0x38')]=_0x232e26[_0x3266('0x38')][_0x3266('0x54')]?_0x232e26['attributes']:_0x5d864a[_0x3266('0x34')];_0x232e26[_0x3266('0x55')]=qs[_0x3266('0x3c')](_0x520a06[_0x3266('0x35')][_0x3266('0x3c')]);_0x232e26[_0x3266('0x3f')]=qs[_0x3266('0x3d')](_['pick'](_0x520a06['query'],_0x5d864a[_0x3266('0x3d')]));if(_0x520a06[_0x3266('0x35')][_0x3266('0x3e')]){_0x232e26[_0x3266('0x3f')]=_['merge'](_0x232e26['where'],{'$or':_['map'](_0x232e26['attributes'],function(_0x142477){var _0x581018={};_0x581018[_0x142477]={'$like':'%'+_0x520a06[_0x3266('0x35')]['filter']+'%'};return _0x581018;})});}_0x232e26=_[_0x3266('0x40')]({},_0x232e26,_0x520a06[_0x3266('0x42')]);return _0x27dafe[_0x3266('0x53')](_0x232e26);}})[_0x3266('0x26')](function(_0x11b3bf){if(_0x11b3bf){_0xb892bb=_0x11b3bf['length'];if(!_0x520a06[_0x3266('0x35')]['hasOwnProperty'](_0x3266('0x3b'))){_0x232e26['limit']=qs[_0x3266('0x1f')](_0x520a06[_0x3266('0x35')][_0x3266('0x1f')]);_0x232e26[_0x3266('0x1d')]=qs['offset'](_0x520a06[_0x3266('0x35')]['offset']);}return _0x27dafe['getIntervals'](_0x232e26);}})['then'](function(_0x5e990f){if(_0x5e990f){return _0x5e990f?{'count':_0xb892bb,'rows':_0x5e990f}:null;}})[_0x3266('0x26')](respondWithResult(_0xd32995,null))['catch'](handleError(_0xd32995,null));};exports[_0x3266('0x56')]=function(_0x5674e7,_0x486c38,_0x4d33c8){return db['Interval'][_0x3266('0x57')]({'where':{'id':_0x5674e7[_0x3266('0x48')]['id']}})[_0x3266('0x26')](handleEntityNotFound(_0x486c38,null))[_0x3266('0x26')](function(_0x38ed49){if(_0x38ed49){return db['sequelize'][_0x3266('0x58')](function(_0x4f97da){return db[_0x3266('0x30')][_0x3266('0x29')]({'where':{'IntervalId':_0x5674e7['params']['id']},'transaction':_0x4f97da})['then'](function(_0x41ca90){var _0x40fccd=_['map'](_0x5674e7[_0x3266('0x4a')],function(_0x442c05){delete _0x442c05['id'];_0x442c05[_0x3266('0x52')]=_0x5674e7[_0x3266('0x48')]['id'];return _0x442c05;});return db[_0x3266('0x30')][_0x3266('0x59')](_0x40fccd,{'transaction':_0x4f97da});});})[_0x3266('0x26')](function(){return db[_0x3266('0x30')][_0x3266('0x5a')]({'where':{'IntervalId':_0x5674e7['params']['id']}});});}})[_0x3266('0x26')](respondWithResult(_0x486c38,null))['catch'](handleError(_0x486c38,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 572f341..0f06f1f 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 _0x2535=['map','ifTime','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','iftime','exports','define','rewrite','interval','string','getIntervals','then','all'];(function(_0x17e3e7,_0xeb44ba){var _0x235adc=function(_0xba389f){while(--_0xba389f){_0x17e3e7['push'](_0x17e3e7['shift']());}};_0x235adc(++_0xeb44ba);}(_0x2535,0x10c));var _0x5253=function(_0x26ff90,_0x5e77bf){_0x26ff90=_0x26ff90-0x0;var _0x582360=_0x2535[_0x26ff90];return _0x582360;};'use strict';var attributes=require(_0x5253('0x0'));var extensions=require(_0x5253('0x1'));var iftime=require(_0x5253('0x2'))[_0x5253('0x3')];module[_0x5253('0x4')]=function(_0x1aacaa){return _0x1aacaa[_0x5253('0x5')]('Interval',attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x473de0){extensions[_0x5253('0x6')](_0x1aacaa,_0x473de0);},'afterBulkCreate':function(_0x1340c9,_0x4e14fa,_0x335c29){_0x335c29();extensions[_0x5253('0x6')](_0x1aacaa,_0x1340c9[0x0]);},'afterUpdate':function(_0x3871fa){extensions[_0x5253('0x6')](_0x1aacaa,_0x3871fa);},'afterDestroy':function(_0x282147){extensions[_0x5253('0x6')](_0x1aacaa,_0x282147);}},'instanceMethods':{'ifTime':function(_0x5ac340=undefined,_0x27049f=new Date()){if(typeof this[_0x5253('0x7')]===_0x5253('0x8')){return iftime(this[_0x5253('0x7')],_0x5ac340,_0x27049f);}else{return this[_0x5253('0x9')]()[_0x5253('0xa')](function(_0x5c30b8){return Promise[_0x5253('0xb')](_0x5c30b8[_0x5253('0xc')](function(_0x3cb646){return _0x3cb646[_0x5253('0xd')](_0x5ac340,_0x27049f);}));})['then'](function(_0x36783f){return _0x36783f['reduce'](function(_0x554715,_0x175ad7){return _0x554715||_0x175ad7;},![]);});}}}});}; \ No newline at end of file +var _0x110c=['all','map','reduce','../../components/extensions/rewrite','../../utils/iftime','iftime','Interval','rewrite','string','interval','getIntervals','then'];(function(_0x334201,_0x39f06f){var _0x134700=function(_0x28d73f){while(--_0x28d73f){_0x334201['push'](_0x334201['shift']());}};_0x134700(++_0x39f06f);}(_0x110c,0xab));var _0xc110=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x110c[_0x19950b];return _0x3c6b41;};'use strict';var attributes=require('./interval.attributes');var extensions=require(_0xc110('0x0'));var iftime=require(_0xc110('0x1'))[_0xc110('0x2')];module['exports']=function(_0x57d5a6){return _0x57d5a6['define'](_0xc110('0x3'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xa4a5e6){extensions[_0xc110('0x4')](_0x57d5a6,_0xa4a5e6);},'afterBulkCreate':function(_0x2d707f,_0x465409,_0x1cfc6f){_0x1cfc6f();extensions['rewrite'](_0x57d5a6,_0x2d707f[0x0]);},'afterUpdate':function(_0x3c3505){extensions[_0xc110('0x4')](_0x57d5a6,_0x3c3505);},'afterDestroy':function(_0x41f4be){extensions[_0xc110('0x4')](_0x57d5a6,_0x41f4be);}},'instanceMethods':{'ifTime':function(_0x343b37=undefined,_0x264485=new Date()){if(typeof this['interval']===_0xc110('0x5')){return iftime(this[_0xc110('0x6')],_0x343b37,_0x264485);}else{return this[_0xc110('0x7')]()[_0xc110('0x8')](function(_0x5c272f){return Promise[_0xc110('0x9')](_0x5c272f[_0xc110('0xa')](function(_0x15179d){return _0x15179d['ifTime'](_0x343b37,_0x264485);}));})[_0xc110('0x8')](function(_0x4e72c3){return _0x4e72c3[_0xc110('0xb')](function(_0x3301d6,_0x46c572){return _0x3301d6||_0x46c572;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 8d797bf..9fb2a03 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 _0xbe25=['Interval','options','raw','where','attributes','limit','include','map','model','then','info','catch','error','message','ShowInterval','debug','stringify','findAll','all','ifTime','reduce','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','name','IntervalIftime','isArray','intervals','timezone','length','format','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','silly','resolve','lodash','util','iftime','rpc','GetInterval'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbe25,0x11a));var _0x5be2=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0xbe25[_0x26462c];return _0x509a42;};'use strict';var _=require(_0x5be2('0x0'));var util=require(_0x5be2('0x1'));var db=require('../../mysqldb')['db'];var iftime=require('../../utils/iftime')[_0x5be2('0x2')];var logger=require('../../config/logger')(_0x5be2('0x3'));exports[_0x5be2('0x4')]=function(_0x4efee9){var _0x55d101=this;return new Promise(function(_0x17aae3,_0x35dd43){return db[_0x5be2('0x5')]['findAll']({'raw':_0x4efee9[_0x5be2('0x6')]?_0x4efee9[_0x5be2('0x6')][_0x5be2('0x7')]===undefined?!![]:![]:!![],'where':_0x4efee9['options']?_0x4efee9['options'][_0x5be2('0x8')]||null:null,'attributes':_0x4efee9[_0x5be2('0x6')]?_0x4efee9[_0x5be2('0x6')][_0x5be2('0x9')]||null:null,'limit':_0x4efee9['options']?_0x4efee9[_0x5be2('0x6')][_0x5be2('0xa')]||null:null,'include':_0x4efee9[_0x5be2('0x6')]?_0x4efee9[_0x5be2('0x6')][_0x5be2('0xb')]?_[_0x5be2('0xc')](_0x4efee9[_0x5be2('0x6')][_0x5be2('0xb')],function(_0x544db7){return{'model':db[_0x544db7[_0x5be2('0xd')]],'as':_0x544db7['as'],'attributes':_0x544db7[_0x5be2('0x9')],'include':_0x544db7[_0x5be2('0xb')]?_['map'](_0x544db7[_0x5be2('0xb')],function(_0x189d0f){return{'model':db[_0x189d0f[_0x5be2('0xd')]],'as':_0x189d0f['as'],'attributes':_0x189d0f['attributes'],'include':_0x189d0f['include']?_[_0x5be2('0xc')](_0x189d0f[_0x5be2('0xb')],function(_0x5bab07){return{'model':db[_0x5bab07[_0x5be2('0xd')]],'as':_0x5bab07['as'],'attributes':_0x5bab07['attributes']};}):[]};}):[]};}):[]:[]})[_0x5be2('0xe')](function(_0x271e69){logger[_0x5be2('0xf')](_0x5be2('0x4'),_0x4efee9);logger['debug']('GetInterval',_0x4efee9,JSON['stringify'](_0x271e69));_0x17aae3(_0x271e69);})[_0x5be2('0x10')](function(_0x2f4710){logger[_0x5be2('0x11')](_0x5be2('0x4'),_0x2f4710[_0x5be2('0x12')],_0x4efee9);_0x35dd43(_0x55d101[_0x5be2('0x11')](0x1f4,_0x2f4710[_0x5be2('0x12')]));});});};exports[_0x5be2('0x13')]=function(_0x1b1878){var _0x12b029=this;return new Promise(function(_0x1efa40,_0xf78fa4){return db['Interval']['find']({'raw':_0x1b1878['options']?_0x1b1878['options'][_0x5be2('0x7')]===undefined?!![]:![]:!![],'where':_0x1b1878[_0x5be2('0x6')]?_0x1b1878['options'][_0x5be2('0x8')]||null:null,'attributes':_0x1b1878[_0x5be2('0x6')]?_0x1b1878[_0x5be2('0x6')]['attributes']||null:null,'include':_0x1b1878[_0x5be2('0x6')]?_0x1b1878['options'][_0x5be2('0xb')]?_[_0x5be2('0xc')](_0x1b1878['options'][_0x5be2('0xb')],function(_0x42b73c){return{'model':db[_0x42b73c[_0x5be2('0xd')]],'as':_0x42b73c['as'],'attributes':_0x42b73c[_0x5be2('0x9')],'include':_0x42b73c[_0x5be2('0xb')]?_[_0x5be2('0xc')](_0x42b73c['include'],function(_0xad040f){return{'model':db[_0xad040f[_0x5be2('0xd')]],'as':_0xad040f['as'],'attributes':_0xad040f[_0x5be2('0x9')],'include':_0xad040f[_0x5be2('0xb')]?_[_0x5be2('0xc')](_0xad040f[_0x5be2('0xb')],function(_0x334c03){return{'model':db[_0x334c03[_0x5be2('0xd')]],'as':_0x334c03['as'],'attributes':_0x334c03[_0x5be2('0x9')]};}):[]};}):[]};}):[]:[]})[_0x5be2('0xe')](function(_0x4b0e47){logger[_0x5be2('0xf')](_0x5be2('0x13'),_0x1b1878);logger[_0x5be2('0x14')](_0x5be2('0x13'),_0x1b1878,JSON[_0x5be2('0x15')](_0x4b0e47));_0x1efa40(_0x4b0e47);})[_0x5be2('0x10')](function(_0x4cdfec){logger[_0x5be2('0x11')](_0x5be2('0x13'),_0x4cdfec[_0x5be2('0x12')],_0x1b1878);_0xf78fa4(_0x12b029[_0x5be2('0x11')](0x1f4,_0x4cdfec[_0x5be2('0x12')]));});});};function checkArrayOfIntervals(_0x579799,_0x5c5e66){var _0xe8f963=[];return db[_0x5be2('0x5')][_0x5be2('0x16')]({'where':{'id':_0x579799}})['then'](function(_0x4fbdf8){_0xe8f963=_0x4fbdf8;return Promise[_0x5be2('0x17')](_0xe8f963['map'](function(_0x2daf8a){return _0x2daf8a[_0x5be2('0x18')](_0x5c5e66);}));})[_0x5be2('0xe')](function(_0x3a1757){var _0x5103b4=_0x3a1757[_0x5be2('0x19')](function(_0x2e73fd,_0x4f51ae){return _0x2e73fd||_0x4f51ae;},![]);logger[_0x5be2('0xf')](util['format'](_0x5be2('0x1a'),_0xe8f963[_0x5be2('0xc')](function(_0x19f54c){return _0x19f54c['name'];})[_0x5be2('0x1b')](',\x20'),_0xe8f963[_0x5be2('0xc')](function(_0x25bc80){return _0x25bc80['id'];})[_0x5be2('0x1b')](',\x20')));return _0x5103b4;});}function checkSingleInterval(_0x5d652f,_0x608b59){return db['Interval'][_0x5be2('0x1c')](_0x5d652f)[_0x5be2('0xe')](function(_0x343231){if(_0x343231){logger[_0x5be2('0xf')](util['format'](_0x5be2('0x1d'),_0x343231[_0x5be2('0x1e')],_0x343231['id']));return _0x343231[_0x5be2('0x18')](_0x608b59);}});}exports[_0x5be2('0x1f')]=function(_0x489899){var _0x2e05fb=_0x489899['intervalIds'];var _0x14f28a=Array[_0x5be2('0x20')](_0x489899[_0x5be2('0x21')])?_0x489899[_0x5be2('0x21')]:typeof _0x489899[_0x5be2('0x21')]==='string'?[_0x489899[_0x5be2('0x21')]]:[];var _0x3005aa=_0x489899[_0x5be2('0x22')]||undefined;var _0x58bfc8=![];if(_0x14f28a[_0x5be2('0x23')]){logger[_0x5be2('0xf')](util[_0x5be2('0x24')](_0x5be2('0x25'),_0x14f28a['join'](';\x20')));}if(_0x3005aa){logger[_0x5be2('0xf')](util['format'](_0x5be2('0x26'),_0x3005aa));}logger[_0x5be2('0x14')]('Iftime',_0x58bfc8);logger[_0x5be2('0x27')]('IntervalIftime',_0x489899);return Promise[_0x5be2('0x28')]()[_0x5be2('0xe')](function(){if(Array[_0x5be2('0x20')](_0x2e05fb)){return checkArrayOfIntervals(_0x2e05fb,_0x3005aa);}else if(_0x2e05fb){return checkSingleInterval(_0x2e05fb,_0x3005aa);}})['then'](function(_0x5cd530){var _0x1fd77c=_0x14f28a[_0x5be2('0x19')](function(_0x4e4837,_0x56c8c7){return _0x4e4837||iftime(_0x56c8c7,_0x3005aa);},![]);_0x58bfc8=_0x5cd530||_0x1fd77c;return _0x58bfc8;})[_0x5be2('0x10')](function(_0x58fd6e){logger['error']('IntervalIftime',_0x489899,_0x58fd6e);throw this[_0x5be2('0x11')](0x1f4,_0x58fd6e['message']);});}; \ No newline at end of file +var _0x111b=['message','ShowInterval','info','catch','all','ifTime','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','intervalIds','isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','IntervalIftime','resolve','lodash','util','../../mysqldb','../../utils/iftime','../../config/logger','GetInterval','Interval','findAll','options','raw','where','attributes','include','map','model','then','debug','stringify','error'];(function(_0x501fe6,_0xb74e75){var _0x2262da=function(_0x5e8584){while(--_0x5e8584){_0x501fe6['push'](_0x501fe6['shift']());}};_0x2262da(++_0xb74e75);}(_0x111b,0x11a));var _0xb111=function(_0x2a1768,_0x4aa3df){_0x2a1768=_0x2a1768-0x0;var _0x39793b=_0x111b[_0x2a1768];return _0x39793b;};'use strict';var _=require(_0xb111('0x0'));var util=require(_0xb111('0x1'));var db=require(_0xb111('0x2'))['db'];var iftime=require(_0xb111('0x3'))['iftime'];var logger=require(_0xb111('0x4'))('rpc');exports[_0xb111('0x5')]=function(_0x45c8e6){var _0x845c58=this;return new Promise(function(_0x4de1d9,_0x571cad){return db[_0xb111('0x6')][_0xb111('0x7')]({'raw':_0x45c8e6['options']?_0x45c8e6[_0xb111('0x8')][_0xb111('0x9')]===undefined?!![]:![]:!![],'where':_0x45c8e6[_0xb111('0x8')]?_0x45c8e6['options'][_0xb111('0xa')]||null:null,'attributes':_0x45c8e6['options']?_0x45c8e6[_0xb111('0x8')][_0xb111('0xb')]||null:null,'limit':_0x45c8e6[_0xb111('0x8')]?_0x45c8e6[_0xb111('0x8')]['limit']||null:null,'include':_0x45c8e6[_0xb111('0x8')]?_0x45c8e6[_0xb111('0x8')][_0xb111('0xc')]?_[_0xb111('0xd')](_0x45c8e6[_0xb111('0x8')][_0xb111('0xc')],function(_0x1d211a){return{'model':db[_0x1d211a[_0xb111('0xe')]],'as':_0x1d211a['as'],'attributes':_0x1d211a[_0xb111('0xb')],'include':_0x1d211a[_0xb111('0xc')]?_['map'](_0x1d211a[_0xb111('0xc')],function(_0x219b64){return{'model':db[_0x219b64['model']],'as':_0x219b64['as'],'attributes':_0x219b64[_0xb111('0xb')],'include':_0x219b64[_0xb111('0xc')]?_[_0xb111('0xd')](_0x219b64[_0xb111('0xc')],function(_0x1b1825){return{'model':db[_0x1b1825[_0xb111('0xe')]],'as':_0x1b1825['as'],'attributes':_0x1b1825[_0xb111('0xb')]};}):[]};}):[]};}):[]:[]})[_0xb111('0xf')](function(_0x2db3bb){logger['info'](_0xb111('0x5'),_0x45c8e6);logger[_0xb111('0x10')]('GetInterval',_0x45c8e6,JSON[_0xb111('0x11')](_0x2db3bb));_0x4de1d9(_0x2db3bb);})['catch'](function(_0x225bae){logger[_0xb111('0x12')](_0xb111('0x5'),_0x225bae[_0xb111('0x13')],_0x45c8e6);_0x571cad(_0x845c58[_0xb111('0x12')](0x1f4,_0x225bae[_0xb111('0x13')]));});});};exports[_0xb111('0x14')]=function(_0x2e9d34){var _0x3a6f83=this;return new Promise(function(_0x1d6e96,_0x1da3a6){return db[_0xb111('0x6')]['find']({'raw':_0x2e9d34[_0xb111('0x8')]?_0x2e9d34[_0xb111('0x8')][_0xb111('0x9')]===undefined?!![]:![]:!![],'where':_0x2e9d34[_0xb111('0x8')]?_0x2e9d34['options'][_0xb111('0xa')]||null:null,'attributes':_0x2e9d34[_0xb111('0x8')]?_0x2e9d34[_0xb111('0x8')]['attributes']||null:null,'include':_0x2e9d34['options']?_0x2e9d34['options'][_0xb111('0xc')]?_['map'](_0x2e9d34[_0xb111('0x8')]['include'],function(_0x5dc712){return{'model':db[_0x5dc712[_0xb111('0xe')]],'as':_0x5dc712['as'],'attributes':_0x5dc712[_0xb111('0xb')],'include':_0x5dc712[_0xb111('0xc')]?_['map'](_0x5dc712[_0xb111('0xc')],function(_0x1f7f47){return{'model':db[_0x1f7f47[_0xb111('0xe')]],'as':_0x1f7f47['as'],'attributes':_0x1f7f47[_0xb111('0xb')],'include':_0x1f7f47[_0xb111('0xc')]?_[_0xb111('0xd')](_0x1f7f47['include'],function(_0x371791){return{'model':db[_0x371791[_0xb111('0xe')]],'as':_0x371791['as'],'attributes':_0x371791['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x155c4a){logger[_0xb111('0x15')](_0xb111('0x14'),_0x2e9d34);logger['debug']('ShowInterval',_0x2e9d34,JSON[_0xb111('0x11')](_0x155c4a));_0x1d6e96(_0x155c4a);})[_0xb111('0x16')](function(_0x532924){logger[_0xb111('0x12')]('ShowInterval',_0x532924[_0xb111('0x13')],_0x2e9d34);_0x1da3a6(_0x3a6f83[_0xb111('0x12')](0x1f4,_0x532924[_0xb111('0x13')]));});});};function checkArrayOfIntervals(_0x510975,_0xae6a6d){var _0x5d6aa1=[];return db[_0xb111('0x6')][_0xb111('0x7')]({'where':{'id':_0x510975}})[_0xb111('0xf')](function(_0x1dc935){_0x5d6aa1=_0x1dc935;return Promise[_0xb111('0x17')](_0x5d6aa1[_0xb111('0xd')](function(_0x184f63){return _0x184f63[_0xb111('0x18')](_0xae6a6d);}));})[_0xb111('0xf')](function(_0x137a2d){var _0x22f05b=_0x137a2d[_0xb111('0x19')](function(_0x37ba36,_0x39e35c){return _0x37ba36||_0x39e35c;},![]);logger['info'](util[_0xb111('0x1a')](_0xb111('0x1b'),_0x5d6aa1[_0xb111('0xd')](function(_0x1076fd){return _0x1076fd[_0xb111('0x1c')];})['join'](',\x20'),_0x5d6aa1[_0xb111('0xd')](function(_0x116b65){return _0x116b65['id'];})[_0xb111('0x1d')](',\x20')));return _0x22f05b;});}function checkSingleInterval(_0xe38cf1,_0x2dae76){return db[_0xb111('0x6')][_0xb111('0x1e')](_0xe38cf1)['then'](function(_0xcd90fc){if(_0xcd90fc){logger[_0xb111('0x15')](util['format']('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0xcd90fc[_0xb111('0x1c')],_0xcd90fc['id']));return _0xcd90fc[_0xb111('0x18')](_0x2dae76);}});}exports['IntervalIftime']=function(_0x4eb484){var _0x13a7b2=_0x4eb484[_0xb111('0x1f')];var _0x2040d6=Array[_0xb111('0x20')](_0x4eb484['intervals'])?_0x4eb484[_0xb111('0x21')]:typeof _0x4eb484[_0xb111('0x21')]===_0xb111('0x22')?[_0x4eb484[_0xb111('0x21')]]:[];var _0x37aa19=_0x4eb484[_0xb111('0x23')]||undefined;var _0x431223=![];if(_0x2040d6[_0xb111('0x24')]){logger['info'](util['format'](_0xb111('0x25'),_0x2040d6[_0xb111('0x1d')](';\x20')));}if(_0x37aa19){logger[_0xb111('0x15')](util[_0xb111('0x1a')](_0xb111('0x26'),_0x37aa19));}logger[_0xb111('0x10')](_0xb111('0x27'),_0x431223);logger[_0xb111('0x28')](_0xb111('0x29'),_0x4eb484);return Promise[_0xb111('0x2a')]()[_0xb111('0xf')](function(){if(Array[_0xb111('0x20')](_0x13a7b2)){return checkArrayOfIntervals(_0x13a7b2,_0x37aa19);}else if(_0x13a7b2){return checkSingleInterval(_0x13a7b2,_0x37aa19);}})[_0xb111('0xf')](function(_0x2d921d){var _0x48f8bd=_0x2040d6[_0xb111('0x19')](function(_0x3b05ee,_0x394b1b){return _0x3b05ee||iftime(_0x394b1b,_0x37aa19);},![]);_0x431223=_0x2d921d||_0x48f8bd;return _0x431223;})[_0xb111('0x16')](function(_0x10e0f0){logger[_0xb111('0x12')](_0xb111('0x29'),_0x4eb484,_0x10e0f0);throw this['error'](0x1f4,_0x10e0f0[_0xb111('0x13')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 6c333db..3aebd91 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 _0xdb28=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller'];(function(_0x3b15f5,_0x588262){var _0x57726d=function(_0x29c3d4){while(--_0x29c3d4){_0x3b15f5['push'](_0x3b15f5['shift']());}};_0x57726d(++_0x588262);}(_0xdb28,0x106));var _0x8db2=function(_0x4169f5,_0x42e1de){_0x4169f5=_0x4169f5-0x0;var _0x46dc7c=_0xdb28[_0x4169f5];return _0x46dc7c;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['post']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);module[_0x8db2('0x6')]=router; \ No newline at end of file +var _0x5f66=['send','exports','Router','./jira.controller','post','isAuthenticated'];(function(_0x46428c,_0x20ab75){var _0x16a677=function(_0x2b0817){while(--_0x2b0817){_0x46428c['push'](_0x46428c['shift']());}};_0x16a677(++_0x20ab75);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x5f66[_0x3e5086];return _0xfeb102;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);module[_0x65f6('0x5')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index b5967ed..9b9e2b9 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 _0xca07=['parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','end','openIssue','send','headers','x-forwarded-for','socket','remoteAddress','connection','body','bluebird','../../config/logger','MOTGUI','Report','description','Bug','fields','customfield_11500','email','newToken','customfield_11504','reason','customfield_10102','track.xcallymotion.com','POST','Basic\x20','toString','stringify','setEncoding','utf8','data','status','statusCode','json'];(function(_0xa7fcdd,_0x2316e2){var _0x44f3c2=function(_0xcd8e5b){while(--_0xcd8e5b){_0xa7fcdd['push'](_0xa7fcdd['shift']());}};_0x44f3c2(++_0x2316e2);}(_0xca07,0xf2));var _0x7ca0=function(_0x18bfdb,_0x241d43){_0x18bfdb=_0x18bfdb-0x0;var _0x44334c=_0xca07[_0x18bfdb];return _0x44334c;};'use strict';var BPromise=require(_0x7ca0('0x0'));var https=require('https');var logger=require(_0x7ca0('0x1'))('api');var USERNAME='support';var PASSWORD='3eAmWpBVP0';function openIssue(_0x38e868,_0x113982){var _0x444aec={'fields':{'project':{'key':_0x38e868['key']||_0x7ca0('0x2')},'summary':(_0x38e868['summary']||_0x7ca0('0x3'))+'\x20from\x20'+_0x38e868['ip'],'description':_0x38e868[_0x7ca0('0x4')]||JSON['stringify'](_0x38e868),'issuetype':{'name':_0x38e868['issuetype']||_0x7ca0('0x5')}}};_0x444aec[_0x7ca0('0x6')][_0x7ca0('0x7')]=_0x38e868[_0x7ca0('0x8')];_0x444aec['fields']['customfield_11501']=_0x38e868['oldToken'];_0x444aec[_0x7ca0('0x6')]['customfield_11502']=_0x38e868[_0x7ca0('0x9')];_0x444aec['fields']['customfield_11503']=_0x38e868['name'];_0x444aec['fields'][_0x7ca0('0xa')]=_0x38e868[_0x7ca0('0xb')];_0x444aec[_0x7ca0('0x6')][_0x7ca0('0xc')]=_0x38e868['ip'];var _0x1f939e={'host':_0x7ca0('0xd'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x7ca0('0xe'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x7ca0('0xf')+new Buffer(USERNAME+':'+PASSWORD)[_0x7ca0('0x10')]('base64')}};var _0x32252d=JSON[_0x7ca0('0x11')](_0x444aec);var _0x48eecc=https['request'](_0x1f939e,function(_0x204ae4){_0x204ae4[_0x7ca0('0x12')](_0x7ca0('0x13'));var _0x3d7dc8='';_0x204ae4['on'](_0x7ca0('0x14'),function(_0x4c998b){_0x3d7dc8+=_0x4c998b;});_0x204ae4['on']('end',function(){if(_0x113982){return _0x113982[_0x7ca0('0x15')](_0x204ae4[_0x7ca0('0x16')])[_0x7ca0('0x17')](JSON[_0x7ca0('0x18')](_0x3d7dc8));}});});_0x48eecc['on'](_0x7ca0('0x19'),function(_0x48011a){if(_0x113982){return _0x113982[_0x7ca0('0x15')](0x1f4)[_0x7ca0('0x17')]({'errors':[{'message':_0x7ca0('0x1a'),'type':_0x7ca0('0x1b')}]});}});_0x48eecc[_0x7ca0('0x1c')](_0x32252d);_0x48eecc[_0x7ca0('0x1d')]();}exports[_0x7ca0('0x1e')]=openIssue;exports[_0x7ca0('0x1f')]=function(_0x512deb,_0x1943d8){_0x512deb['body']['ip']=_0x512deb[_0x7ca0('0x20')][_0x7ca0('0x21')]||_0x512deb['connection']['remoteAddress']||_0x512deb[_0x7ca0('0x22')][_0x7ca0('0x23')]||_0x512deb[_0x7ca0('0x24')][_0x7ca0('0x22')][_0x7ca0('0x23')];return openIssue(_0x512deb[_0x7ca0('0x25')],_0x1943d8);}; \ No newline at end of file +var _0xdf9c=['application/json','Basic\x20','toString','base64','request','setEncoding','data','status','statusCode','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','end','openIssue','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','MOTGUI','summary','Report','\x20from\x20','description','stringify','Bug','fields','email','customfield_11501','oldToken','newToken','customfield_11504','customfield_10102','/rest/api/2/issue','POST'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0xdf9c,0x6e));var _0xcdf9=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xdf9c[_0x2641f9];return _0x585741;};'use strict';var BPromise=require(_0xcdf9('0x0'));var https=require(_0xcdf9('0x1'));var logger=require(_0xcdf9('0x2'))(_0xcdf9('0x3'));var USERNAME=_0xcdf9('0x4');var PASSWORD=_0xcdf9('0x5');function openIssue(_0x33aa75,_0x56893d){var _0x11d935={'fields':{'project':{'key':_0x33aa75['key']||_0xcdf9('0x6')},'summary':(_0x33aa75[_0xcdf9('0x7')]||_0xcdf9('0x8'))+_0xcdf9('0x9')+_0x33aa75['ip'],'description':_0x33aa75[_0xcdf9('0xa')]||JSON[_0xcdf9('0xb')](_0x33aa75),'issuetype':{'name':_0x33aa75['issuetype']||_0xcdf9('0xc')}}};_0x11d935[_0xcdf9('0xd')]['customfield_11500']=_0x33aa75[_0xcdf9('0xe')];_0x11d935[_0xcdf9('0xd')][_0xcdf9('0xf')]=_0x33aa75[_0xcdf9('0x10')];_0x11d935['fields']['customfield_11502']=_0x33aa75[_0xcdf9('0x11')];_0x11d935['fields']['customfield_11503']=_0x33aa75['name'];_0x11d935['fields'][_0xcdf9('0x12')]=_0x33aa75['reason'];_0x11d935[_0xcdf9('0xd')][_0xcdf9('0x13')]=_0x33aa75['ip'];var _0x1aa3d2={'host':'track.xcallymotion.com','port':0x1bb,'path':_0xcdf9('0x14'),'method':_0xcdf9('0x15'),'timeout':0x4e20,'headers':{'Content-Type':_0xcdf9('0x16'),'Authorization':_0xcdf9('0x17')+new Buffer(USERNAME+':'+PASSWORD)[_0xcdf9('0x18')](_0xcdf9('0x19'))}};var _0x326b64=JSON[_0xcdf9('0xb')](_0x11d935);var _0x970c0c=https[_0xcdf9('0x1a')](_0x1aa3d2,function(_0xe910d4){_0xe910d4[_0xcdf9('0x1b')]('utf8');var _0x5ee3ee='';_0xe910d4['on'](_0xcdf9('0x1c'),function(_0xd1e8d7){_0x5ee3ee+=_0xd1e8d7;});_0xe910d4['on']('end',function(){if(_0x56893d){return _0x56893d[_0xcdf9('0x1d')](_0xe910d4[_0xcdf9('0x1e')])[_0xcdf9('0x1f')](JSON[_0xcdf9('0x20')](_0x5ee3ee));}});});_0x970c0c['on']('error',function(_0x360ec9){if(_0x56893d){return _0x56893d['status'](0x1f4)['json']({'errors':[{'message':_0xcdf9('0x21'),'type':_0xcdf9('0x22')}]});}});_0x970c0c[_0xcdf9('0x23')](_0x326b64);_0x970c0c[_0xcdf9('0x24')]();}exports[_0xcdf9('0x25')]=openIssue;exports['send']=function(_0x15a607,_0x5c0fb1){_0x15a607[_0xcdf9('0x26')]['ip']=_0x15a607[_0xcdf9('0x27')][_0xcdf9('0x28')]||_0x15a607[_0xcdf9('0x29')][_0xcdf9('0x2a')]||_0x15a607['socket'][_0xcdf9('0x2a')]||_0x15a607['connection'][_0xcdf9('0x2b')][_0xcdf9('0x2a')];return openIssue(_0x15a607[_0xcdf9('0x26')],_0x5c0fb1);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 2474137..ba117fd 100644 --- a/server/api/jscriptyAnswerReport/index.js +++ b/server/api/jscriptyAnswerReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x17ba=['/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x17ba,0xab));var _0xa17b=function(_0x265172,_0x2252c3){_0x265172=_0x265172-0x0;var _0x5442f1=_0x17ba[_0x265172];return _0x5442f1;};'use strict';var multer=require(_0xa17b('0x0'));var util=require(_0xa17b('0x1'));var path=require('path');var timeout=require(_0xa17b('0x2'));var express=require(_0xa17b('0x3'));var router=express[_0xa17b('0x4')]();var fs_extra=require(_0xa17b('0x5'));var auth=require(_0xa17b('0x6'));var interaction=require(_0xa17b('0x7'));var config=require(_0xa17b('0x8'));var controller=require(_0xa17b('0x9'));router[_0xa17b('0xa')]('/',auth[_0xa17b('0xb')](),controller[_0xa17b('0xc')]);router[_0xa17b('0xa')](_0xa17b('0xd'),auth[_0xa17b('0xb')](),controller[_0xa17b('0xe')]);router[_0xa17b('0xa')](_0xa17b('0xf'),auth[_0xa17b('0xb')](),controller[_0xa17b('0x10')]);router['post']('/',auth[_0xa17b('0xb')](),controller[_0xa17b('0x11')]);router[_0xa17b('0x12')](_0xa17b('0xf'),auth[_0xa17b('0xb')](),controller[_0xa17b('0x13')]);router[_0xa17b('0x14')]('/:id',auth[_0xa17b('0xb')](),controller[_0xa17b('0x15')]);module[_0xa17b('0x16')]=router; \ No newline at end of file +var _0xbec5=['describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','isAuthenticated'];(function(_0x594931,_0x3058b6){var _0x2deabf=function(_0x54ad4e){while(--_0x54ad4e){_0x594931['push'](_0x594931['shift']());}};_0x2deabf(++_0x3058b6);}(_0xbec5,0xe5));var _0x5bec=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xbec5[_0x68c979];return _0x4f0001;};'use strict';var multer=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var path=require('path');var timeout=require(_0x5bec('0x2'));var express=require(_0x5bec('0x3'));var router=express[_0x5bec('0x4')]();var fs_extra=require(_0x5bec('0x5'));var auth=require(_0x5bec('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5bec('0x7'));var controller=require(_0x5bec('0x8'));router[_0x5bec('0x9')]('/',auth['isAuthenticated'](),controller[_0x5bec('0xa')]);router[_0x5bec('0x9')](_0x5bec('0xb'),auth[_0x5bec('0xc')](),controller[_0x5bec('0xd')]);router[_0x5bec('0x9')](_0x5bec('0xe'),auth[_0x5bec('0xc')](),controller['show']);router[_0x5bec('0xf')]('/',auth['isAuthenticated'](),controller[_0x5bec('0x10')]);router[_0x5bec('0x11')](_0x5bec('0xe'),auth['isAuthenticated'](),controller[_0x5bec('0x12')]);router[_0x5bec('0x13')](_0x5bec('0xe'),auth['isAuthenticated'](),controller[_0x5bec('0x14')]);module[_0x5bec('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 9c13bce..932b0e2 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(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x7a54,0x106));var _0x47a5=function(_0x269e6c,_0x402e12){_0x269e6c=_0x269e6c-0x0;var _0x6ff286=_0x7a54[_0x269e6c];return _0x6ff286;};'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(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x7a54,0x106));var _0x47a5=function(_0x1c94bf,_0x5dff0a){_0x1c94bf=_0x1c94bf-0x0;var _0x399ef5=_0x7a54[_0x1c94bf];return _0x399ef5;};'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 6344b89..f4c9e85 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 _0x0a52=['show','params','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','nolimit','sort','filters','pick','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows'];(function(_0x158081,_0x4cef4d){var _0x50bd1f=function(_0x5a2169){while(--_0x5a2169){_0x158081['push'](_0x158081['shift']());}};_0x50bd1f(++_0x4cef4d);}(_0x0a52,0xe4));var _0x20a5=function(_0x2851c5,_0x3da017){_0x2851c5=_0x2851c5-0x0;var _0x463a6e=_0x0a52[_0x2851c5];return _0x463a6e;};'use strict';var emlformat=require(_0x20a5('0x0'));var rimraf=require(_0x20a5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x20a5('0x2'));var rp=require(_0x20a5('0x3'));var moment=require(_0x20a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x20a5('0x5'));var util=require(_0x20a5('0x6'));var path=require(_0x20a5('0x7'));var sox=require(_0x20a5('0x8'));var csv=require(_0x20a5('0x9'));var ejs=require(_0x20a5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x20a5('0xb'));var crypto=require(_0x20a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x20a5('0xd'));var toCsv=require(_0x20a5('0x9'));var querystring=require(_0x20a5('0xe'));var Papa=require(_0x20a5('0xf'));var Redis=require('ioredis');var authService=require(_0x20a5('0x10'));var qs=require(_0x20a5('0x11'));var as=require(_0x20a5('0x12'));var hardwareService=require(_0x20a5('0x13'));var logger=require(_0x20a5('0x14'))(_0x20a5('0x15'));var utils=require(_0x20a5('0x16'));var config=require(_0x20a5('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x20a5('0x18'))['db'];function respondWithStatusCode(_0x5e6c3b,_0xd07281){_0xd07281=_0xd07281||0xcc;return function(_0x429c69){if(_0x429c69){return _0x5e6c3b['sendStatus'](_0xd07281);}return _0x5e6c3b[_0x20a5('0x19')](_0xd07281)[_0x20a5('0x1a')]();};}function respondWithResult(_0x46acee,_0x43528b){_0x43528b=_0x43528b||0xc8;return function(_0x42bc38){if(_0x42bc38){return _0x46acee[_0x20a5('0x19')](_0x43528b)[_0x20a5('0x1b')](_0x42bc38);}};}function respondWithFilteredResult(_0x254546,_0x39b063){return function(_0x446a4f){if(_0x446a4f){var _0x24e1b0=typeof _0x39b063[_0x20a5('0x1c')]==='undefined'&&typeof _0x39b063[_0x20a5('0x1d')]==='undefined';var _0x312978=_0x446a4f[_0x20a5('0x1e')];var _0x11a4e3=_0x24e1b0?0x0:_0x39b063[_0x20a5('0x1c')];var _0x2cb0e8=_0x24e1b0?_0x446a4f[_0x20a5('0x1e')]:_0x39b063[_0x20a5('0x1c')]+_0x39b063['limit'];var _0x43cd40;if(_0x2cb0e8>=_0x312978){_0x2cb0e8=_0x312978;_0x43cd40=0xc8;}else{_0x43cd40=0xce;}_0x254546['status'](_0x43cd40);return _0x254546[_0x20a5('0x1f')](_0x20a5('0x20'),_0x11a4e3+'-'+_0x2cb0e8+'/'+_0x312978)[_0x20a5('0x1b')](_0x446a4f);}return null;};}function patchUpdates(_0x3bf093){return function(_0x40e28e){try{jsonpatch[_0x20a5('0x21')](_0x40e28e,_0x3bf093,!![]);}catch(_0xf577cd){return BPromise[_0x20a5('0x22')](_0xf577cd);}return _0x40e28e[_0x20a5('0x23')]();};}function saveUpdates(_0x1e43e4,_0x42c159){return function(_0x580d39){if(_0x580d39){return _0x580d39[_0x20a5('0x24')](_0x1e43e4)[_0x20a5('0x25')](function(_0x39ac06){return _0x39ac06;});}return null;};}function removeEntity(_0x4d4052,_0x370efa){return function(_0x1b2850){if(_0x1b2850){return _0x1b2850[_0x20a5('0x26')]()[_0x20a5('0x25')](function(){_0x4d4052['status'](0xcc)[_0x20a5('0x1a')]();});}};}function handleEntityNotFound(_0x3103bd,_0x16022f){return function(_0x21978f){if(!_0x21978f){_0x3103bd[_0x20a5('0x27')](0x194);}return _0x21978f;};}function handleError(_0x23239d,_0x171cd5){_0x171cd5=_0x171cd5||0x1f4;return function(_0x3987c5){logger['error'](_0x3987c5['stack']);if(_0x3987c5[_0x20a5('0x28')]){delete _0x3987c5[_0x20a5('0x28')];}_0x23239d['status'](_0x171cd5)[_0x20a5('0x29')](_0x3987c5);};}exports[_0x20a5('0x2a')]=function(_0x2b891c,_0x38bae9){var _0x5a84be={},_0x33f000={},_0x571e92={'count':0x0,'rows':[]};var _0x96280e=_[_0x20a5('0x2b')](db[_0x20a5('0x2c')][_0x20a5('0x2d')],function(_0xf23890){return{'name':_0xf23890[_0x20a5('0x2e')],'type':_0xf23890['type'][_0x20a5('0x2f')]};});_0x33f000[_0x20a5('0x30')]=_[_0x20a5('0x2b')](_0x96280e,_0x20a5('0x28'));_0x33f000['query']=_[_0x20a5('0x31')](_0x2b891c[_0x20a5('0x32')]);_0x33f000['filters']=_[_0x20a5('0x33')](_0x33f000[_0x20a5('0x30')],_0x33f000[_0x20a5('0x32')]);_0x5a84be[_0x20a5('0x34')]=_[_0x20a5('0x33')](_0x33f000[_0x20a5('0x30')],qs[_0x20a5('0x35')](_0x2b891c['query'][_0x20a5('0x35')]));_0x5a84be[_0x20a5('0x34')]=_0x5a84be[_0x20a5('0x34')][_0x20a5('0x36')]?_0x5a84be[_0x20a5('0x34')]:_0x33f000[_0x20a5('0x30')];if(!_0x2b891c[_0x20a5('0x32')]['hasOwnProperty'](_0x20a5('0x37'))){_0x5a84be[_0x20a5('0x1d')]=qs[_0x20a5('0x1d')](_0x2b891c[_0x20a5('0x32')]['limit']);_0x5a84be[_0x20a5('0x1c')]=qs[_0x20a5('0x1c')](_0x2b891c[_0x20a5('0x32')][_0x20a5('0x1c')]);}_0x5a84be['order']=qs[_0x20a5('0x38')](_0x2b891c['query'][_0x20a5('0x38')]);_0x5a84be['where']=qs[_0x20a5('0x39')](_[_0x20a5('0x3a')](_0x2b891c[_0x20a5('0x32')],_0x33f000[_0x20a5('0x39')]),_0x96280e);if(_0x2b891c[_0x20a5('0x32')]['filter']){_0x5a84be[_0x20a5('0x3b')]=_[_0x20a5('0x3c')](_0x5a84be[_0x20a5('0x3b')],{'$or':_[_0x20a5('0x2b')](_0x96280e,function(_0x2bdc15){if(_0x2bdc15[_0x20a5('0x3d')]!==_0x20a5('0x3e')){var _0x110550={};_0x110550[_0x2bdc15['name']]={'$like':'%'+_0x2b891c[_0x20a5('0x32')]['filter']+'%'};return _0x110550;}})});}_0x5a84be=_[_0x20a5('0x3c')]({},_0x5a84be,_0x2b891c[_0x20a5('0x3f')]);var _0x16c726={'where':_0x5a84be[_0x20a5('0x3b')]};return db['JscriptyAnswerReport'][_0x20a5('0x1e')](_0x16c726)[_0x20a5('0x25')](function(_0x26fdee){_0x571e92['count']=_0x26fdee;if(_0x2b891c['query'][_0x20a5('0x40')]){_0x5a84be[_0x20a5('0x41')]=[{'all':!![]}];}return db[_0x20a5('0x2c')][_0x20a5('0x42')](_0x5a84be);})[_0x20a5('0x25')](function(_0x96baad){_0x571e92[_0x20a5('0x43')]=_0x96baad;return _0x571e92;})[_0x20a5('0x25')](respondWithFilteredResult(_0x38bae9,_0x5a84be))['catch'](handleError(_0x38bae9,null));};exports[_0x20a5('0x44')]=function(_0xc8c498,_0x3c3b4a){var _0x9b618e={'raw':!![],'where':{'id':_0xc8c498[_0x20a5('0x45')]['id']}},_0x4d6a1e={};_0x4d6a1e[_0x20a5('0x30')]=_['keys'](db['JscriptyAnswerReport'][_0x20a5('0x2d')]);_0x4d6a1e['query']=_[_0x20a5('0x31')](_0xc8c498['query']);_0x4d6a1e[_0x20a5('0x39')]=_[_0x20a5('0x33')](_0x4d6a1e['model'],_0x4d6a1e[_0x20a5('0x32')]);_0x9b618e['attributes']=_[_0x20a5('0x33')](_0x4d6a1e[_0x20a5('0x30')],qs[_0x20a5('0x35')](_0xc8c498[_0x20a5('0x32')][_0x20a5('0x35')]));_0x9b618e['attributes']=_0x9b618e[_0x20a5('0x34')][_0x20a5('0x36')]?_0x9b618e['attributes']:_0x4d6a1e['model'];if(_0xc8c498[_0x20a5('0x32')][_0x20a5('0x40')]){_0x9b618e[_0x20a5('0x41')]=[{'all':!![]}];}_0x9b618e=_[_0x20a5('0x3c')]({},_0x9b618e,_0xc8c498[_0x20a5('0x3f')]);return db['JscriptyAnswerReport'][_0x20a5('0x46')](_0x9b618e)[_0x20a5('0x25')](handleEntityNotFound(_0x3c3b4a,null))[_0x20a5('0x25')](respondWithResult(_0x3c3b4a,null))[_0x20a5('0x47')](handleError(_0x3c3b4a,null));};exports[_0x20a5('0x48')]=function(_0x23c27f,_0x42aa14){return db[_0x20a5('0x2c')][_0x20a5('0x48')](_0x23c27f['body'],{})[_0x20a5('0x25')](respondWithResult(_0x42aa14,0xc9))[_0x20a5('0x47')](handleError(_0x42aa14,null));};exports[_0x20a5('0x24')]=function(_0x1e6981,_0x78729f){if(_0x1e6981['body']['id']){delete _0x1e6981[_0x20a5('0x49')]['id'];}return db[_0x20a5('0x2c')]['find']({'where':{'id':_0x1e6981[_0x20a5('0x45')]['id']}})[_0x20a5('0x25')](handleEntityNotFound(_0x78729f,null))[_0x20a5('0x25')](saveUpdates(_0x1e6981['body'],null))[_0x20a5('0x25')](respondWithResult(_0x78729f,null))[_0x20a5('0x47')](handleError(_0x78729f,null));};exports[_0x20a5('0x26')]=function(_0x45ef54,_0x58fa88){return db[_0x20a5('0x2c')][_0x20a5('0x46')]({'where':{'id':_0x45ef54[_0x20a5('0x45')]['id']}})[_0x20a5('0x25')](handleEntityNotFound(_0x58fa88,null))[_0x20a5('0x25')](removeEntity(_0x58fa88,null))[_0x20a5('0x47')](handleError(_0x58fa88,null));};exports['describe']=function(_0x4ad70d,_0x40ad8b){return db[_0x20a5('0x2c')]['describe']()[_0x20a5('0x25')](respondWithResult(_0x40ad8b,null))['catch'](handleError(_0x40ad8b,null));}; \ No newline at end of file +var _0x07d7=['undefined','limit','status','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','JscriptyAnswerReport','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','end','offset'];(function(_0x44a7ca,_0x1c6cff){var _0x4bf083=function(_0x5a5fb1){while(--_0x5a5fb1){_0x44a7ca['push'](_0x44a7ca['shift']());}};_0x4bf083(++_0x1c6cff);}(_0x07d7,0x85));var _0x707d=function(_0x47568e,_0x5ccdaf){_0x47568e=_0x47568e-0x0;var _0x33815b=_0x07d7[_0x47568e];return _0x33815b;};'use strict';var emlformat=require(_0x707d('0x0'));var rimraf=require(_0x707d('0x1'));var zipdir=require(_0x707d('0x2'));var jsonpatch=require(_0x707d('0x3'));var rp=require(_0x707d('0x4'));var moment=require(_0x707d('0x5'));var BPromise=require(_0x707d('0x6'));var Mustache=require(_0x707d('0x7'));var util=require(_0x707d('0x8'));var path=require(_0x707d('0x9'));var sox=require(_0x707d('0xa'));var csv=require(_0x707d('0xb'));var ejs=require(_0x707d('0xc'));var fs=require('fs');var fs_extra=require(_0x707d('0xd'));var _=require(_0x707d('0xe'));var squel=require(_0x707d('0xf'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x707d('0x10'));var toCsv=require(_0x707d('0xb'));var querystring=require(_0x707d('0x11'));var Papa=require(_0x707d('0x12'));var Redis=require(_0x707d('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x707d('0x14'));var as=require(_0x707d('0x15'));var hardwareService=require(_0x707d('0x16'));var logger=require('../../config/logger')(_0x707d('0x17'));var utils=require(_0x707d('0x18'));var config=require(_0x707d('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5aabfe,_0x252e8c){_0x252e8c=_0x252e8c||0xcc;return function(_0x7cd32b){if(_0x7cd32b){return _0x5aabfe[_0x707d('0x1a')](_0x252e8c);}return _0x5aabfe['status'](_0x252e8c)[_0x707d('0x1b')]();};}function respondWithResult(_0x52c447,_0x1c18a6){_0x1c18a6=_0x1c18a6||0xc8;return function(_0x42e27f){if(_0x42e27f){return _0x52c447['status'](_0x1c18a6)['json'](_0x42e27f);}};}function respondWithFilteredResult(_0x30d583,_0x5b4700){return function(_0x2f993c){if(_0x2f993c){var _0x2c63c9=typeof _0x5b4700[_0x707d('0x1c')]===_0x707d('0x1d')&&typeof _0x5b4700[_0x707d('0x1e')]===_0x707d('0x1d');var _0x318251=_0x2f993c['count'];var _0x1d3fe6=_0x2c63c9?0x0:_0x5b4700[_0x707d('0x1c')];var _0x3617c3=_0x2c63c9?_0x2f993c['count']:_0x5b4700[_0x707d('0x1c')]+_0x5b4700[_0x707d('0x1e')];var _0xf5375f;if(_0x3617c3>=_0x318251){_0x3617c3=_0x318251;_0xf5375f=0xc8;}else{_0xf5375f=0xce;}_0x30d583[_0x707d('0x1f')](_0xf5375f);return _0x30d583[_0x707d('0x20')](_0x707d('0x21'),_0x1d3fe6+'-'+_0x3617c3+'/'+_0x318251)[_0x707d('0x22')](_0x2f993c);}return null;};}function patchUpdates(_0x446629){return function(_0x33a726){try{jsonpatch[_0x707d('0x23')](_0x33a726,_0x446629,!![]);}catch(_0x2da0c0){return BPromise[_0x707d('0x24')](_0x2da0c0);}return _0x33a726[_0x707d('0x25')]();};}function saveUpdates(_0x3dc9c9,_0xd97d6b){return function(_0x30d175){if(_0x30d175){return _0x30d175[_0x707d('0x26')](_0x3dc9c9)['then'](function(_0x24ba23){return _0x24ba23;});}return null;};}function removeEntity(_0x487a9c,_0xe548a4){return function(_0x139ad5){if(_0x139ad5){return _0x139ad5[_0x707d('0x27')]()[_0x707d('0x28')](function(){_0x487a9c[_0x707d('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x115e5c,_0x5b2db7){return function(_0x3760bb){if(!_0x3760bb){_0x115e5c[_0x707d('0x1a')](0x194);}return _0x3760bb;};}function handleError(_0x2d8830,_0x26d4ee){_0x26d4ee=_0x26d4ee||0x1f4;return function(_0x40551d){logger[_0x707d('0x29')](_0x40551d[_0x707d('0x2a')]);if(_0x40551d[_0x707d('0x2b')]){delete _0x40551d[_0x707d('0x2b')];}_0x2d8830[_0x707d('0x1f')](_0x26d4ee)[_0x707d('0x2c')](_0x40551d);};}exports[_0x707d('0x2d')]=function(_0x38b44b,_0xeb85df){var _0x2102e6={},_0x309ded={},_0x599ba6={'count':0x0,'rows':[]};var _0x17bb4e=_[_0x707d('0x2e')](db[_0x707d('0x2f')]['rawAttributes'],function(_0x5e0ff9){return{'name':_0x5e0ff9['fieldName'],'type':_0x5e0ff9[_0x707d('0x30')][_0x707d('0x31')]};});_0x309ded[_0x707d('0x32')]=_[_0x707d('0x2e')](_0x17bb4e,_0x707d('0x2b'));_0x309ded[_0x707d('0x33')]=_[_0x707d('0x34')](_0x38b44b[_0x707d('0x33')]);_0x309ded[_0x707d('0x35')]=_[_0x707d('0x36')](_0x309ded[_0x707d('0x32')],_0x309ded[_0x707d('0x33')]);_0x2102e6['attributes']=_[_0x707d('0x36')](_0x309ded[_0x707d('0x32')],qs[_0x707d('0x37')](_0x38b44b[_0x707d('0x33')][_0x707d('0x37')]));_0x2102e6['attributes']=_0x2102e6[_0x707d('0x38')][_0x707d('0x39')]?_0x2102e6['attributes']:_0x309ded[_0x707d('0x32')];if(!_0x38b44b[_0x707d('0x33')][_0x707d('0x3a')](_0x707d('0x3b'))){_0x2102e6[_0x707d('0x1e')]=qs[_0x707d('0x1e')](_0x38b44b[_0x707d('0x33')][_0x707d('0x1e')]);_0x2102e6[_0x707d('0x1c')]=qs['offset'](_0x38b44b[_0x707d('0x33')][_0x707d('0x1c')]);}_0x2102e6[_0x707d('0x3c')]=qs[_0x707d('0x3d')](_0x38b44b[_0x707d('0x33')]['sort']);_0x2102e6[_0x707d('0x3e')]=qs[_0x707d('0x35')](_[_0x707d('0x3f')](_0x38b44b['query'],_0x309ded[_0x707d('0x35')]),_0x17bb4e);if(_0x38b44b['query'][_0x707d('0x40')]){_0x2102e6[_0x707d('0x3e')]=_[_0x707d('0x41')](_0x2102e6[_0x707d('0x3e')],{'$or':_['map'](_0x17bb4e,function(_0x5b3260){if(_0x5b3260[_0x707d('0x30')]!==_0x707d('0x42')){var _0x48d8e6={};_0x48d8e6[_0x5b3260['name']]={'$like':'%'+_0x38b44b[_0x707d('0x33')]['filter']+'%'};return _0x48d8e6;}})});}_0x2102e6=_['merge']({},_0x2102e6,_0x38b44b[_0x707d('0x43')]);var _0x35d3a0={'where':_0x2102e6[_0x707d('0x3e')]};return db[_0x707d('0x2f')][_0x707d('0x44')](_0x35d3a0)['then'](function(_0x59aba7){_0x599ba6[_0x707d('0x44')]=_0x59aba7;if(_0x38b44b[_0x707d('0x33')][_0x707d('0x45')]){_0x2102e6[_0x707d('0x46')]=[{'all':!![]}];}return db[_0x707d('0x2f')][_0x707d('0x47')](_0x2102e6);})[_0x707d('0x28')](function(_0x6553d2){_0x599ba6[_0x707d('0x48')]=_0x6553d2;return _0x599ba6;})[_0x707d('0x28')](respondWithFilteredResult(_0xeb85df,_0x2102e6))['catch'](handleError(_0xeb85df,null));};exports[_0x707d('0x49')]=function(_0x1b5acb,_0x483ecf){var _0xd27541={'raw':!![],'where':{'id':_0x1b5acb[_0x707d('0x4a')]['id']}},_0x186035={};_0x186035[_0x707d('0x32')]=_[_0x707d('0x34')](db['JscriptyAnswerReport'][_0x707d('0x4b')]);_0x186035[_0x707d('0x33')]=_[_0x707d('0x34')](_0x1b5acb[_0x707d('0x33')]);_0x186035[_0x707d('0x35')]=_[_0x707d('0x36')](_0x186035[_0x707d('0x32')],_0x186035[_0x707d('0x33')]);_0xd27541[_0x707d('0x38')]=_['intersection'](_0x186035[_0x707d('0x32')],qs['fields'](_0x1b5acb[_0x707d('0x33')][_0x707d('0x37')]));_0xd27541[_0x707d('0x38')]=_0xd27541[_0x707d('0x38')][_0x707d('0x39')]?_0xd27541[_0x707d('0x38')]:_0x186035[_0x707d('0x32')];if(_0x1b5acb[_0x707d('0x33')]['includeAll']){_0xd27541[_0x707d('0x46')]=[{'all':!![]}];}_0xd27541=_[_0x707d('0x41')]({},_0xd27541,_0x1b5acb[_0x707d('0x43')]);return db[_0x707d('0x2f')][_0x707d('0x4c')](_0xd27541)[_0x707d('0x28')](handleEntityNotFound(_0x483ecf,null))['then'](respondWithResult(_0x483ecf,null))[_0x707d('0x4d')](handleError(_0x483ecf,null));};exports[_0x707d('0x4e')]=function(_0x39843d,_0x3986d4){return db[_0x707d('0x2f')][_0x707d('0x4e')](_0x39843d['body'],{})['then'](respondWithResult(_0x3986d4,0xc9))[_0x707d('0x4d')](handleError(_0x3986d4,null));};exports[_0x707d('0x26')]=function(_0x5e1c34,_0x31ac73){if(_0x5e1c34[_0x707d('0x4f')]['id']){delete _0x5e1c34[_0x707d('0x4f')]['id'];}return db[_0x707d('0x2f')]['find']({'where':{'id':_0x5e1c34[_0x707d('0x4a')]['id']}})[_0x707d('0x28')](handleEntityNotFound(_0x31ac73,null))[_0x707d('0x28')](saveUpdates(_0x5e1c34['body'],null))[_0x707d('0x28')](respondWithResult(_0x31ac73,null))[_0x707d('0x4d')](handleError(_0x31ac73,null));};exports['destroy']=function(_0xe8a696,_0x4fa0f8){return db['JscriptyAnswerReport']['find']({'where':{'id':_0xe8a696[_0x707d('0x4a')]['id']}})[_0x707d('0x28')](handleEntityNotFound(_0x4fa0f8,null))[_0x707d('0x28')](removeEntity(_0x4fa0f8,null))[_0x707d('0x4d')](handleError(_0x4fa0f8,null));};exports[_0x707d('0x50')]=function(_0x19c741,_0x4d85a9){return db[_0x707d('0x2f')][_0x707d('0x50')]()['then'](respondWithResult(_0x4d85a9,null))['catch'](handleError(_0x4d85a9,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 1ffa012..7cc5429 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 _0xd360=['../../config/logger','moment','bluebird','request-promise','path','rimraf','JscriptyAnswerReport','report_jscripty_answers','lodash','util'];(function(_0x11df64,_0x2d8ef3){var _0x45e801=function(_0x115b32){while(--_0x115b32){_0x11df64['push'](_0x11df64['shift']());}};_0x45e801(++_0x2d8ef3);}(_0xd360,0x80));var _0x0d36=function(_0x255258,_0x335596){_0x255258=_0x255258-0x0;var _0x50c7af=_0xd360[_0x255258];return _0x50c7af;};'use strict';var _=require(_0x0d36('0x0'));var util=require(_0x0d36('0x1'));var logger=require(_0x0d36('0x2'))('api');var moment=require(_0x0d36('0x3'));var BPromise=require(_0x0d36('0x4'));var rp=require(_0x0d36('0x5'));var fs=require('fs');var path=require(_0x0d36('0x6'));var rimraf=require(_0x0d36('0x7'));var config=require('../../config/environment');var attributes=require('./jscriptyAnswerReport.attributes');module['exports']=function(_0x12cc9b,_0x502af8){return _0x12cc9b['define'](_0x0d36('0x8'),attributes,{'tableName':_0x0d36('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd572=['report_jscripty_answers','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport'];(function(_0x44d743,_0x42207f){var _0x592587=function(_0x103e53){while(--_0x103e53){_0x44d743['push'](_0x44d743['shift']());}};_0x592587(++_0x42207f);}(_0xd572,0xc7));var _0x2d57=function(_0x52d7f3,_0x2fc20b){_0x52d7f3=_0x52d7f3-0x0;var _0x116b77=_0xd572[_0x52d7f3];return _0x116b77;};'use strict';var _=require('lodash');var util=require(_0x2d57('0x0'));var logger=require(_0x2d57('0x1'))(_0x2d57('0x2'));var moment=require(_0x2d57('0x3'));var BPromise=require(_0x2d57('0x4'));var rp=require(_0x2d57('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2d57('0x6'));var config=require('../../config/environment');var attributes=require(_0x2d57('0x7'));module[_0x2d57('0x8')]=function(_0x243374,_0x2e5fcb){return _0x243374['define'](_0x2d57('0x9'),attributes,{'tableName':_0x2d57('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index ac64cb4..a4eb55d 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 _0x986d=['debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','util','moment','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s'];(function(_0x1b2898,_0x47b261){var _0x2a47eb=function(_0x309d34){while(--_0x309d34){_0x1b2898['push'](_0x1b2898['shift']());}};_0x2a47eb(++_0x47b261);}(_0x986d,0x137));var _0xd986=function(_0x42b592,_0x28f828){_0x42b592=_0x42b592-0x0;var _0x6338fb=_0x986d[_0x42b592];return _0x6338fb;};'use strict';var _=require('lodash');var util=require(_0xd986('0x0'));var moment=require(_0xd986('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd986('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd986('0x3'))('rpc');var config=require(_0xd986('0x4'));var jayson=require(_0xd986('0x5'));var client=jayson[_0xd986('0x6')][_0xd986('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2412ca,_0x56ca9e,_0x492f16){return new BPromise(function(_0x5a4e82,_0x2df7de){return client[_0xd986('0x8')](_0x2412ca,_0x492f16)[_0xd986('0x9')](function(_0x5e6a53){logger[_0xd986('0xa')](_0xd986('0xb'),_0x56ca9e,'request\x20sent');logger[_0xd986('0xc')](_0xd986('0xd'),_0x56ca9e,_0xd986('0xe'),JSON[_0xd986('0xf')](_0x5e6a53));if(_0x5e6a53['error']){if(_0x5e6a53[_0xd986('0x10')]['code']===0x1f4){logger[_0xd986('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x56ca9e,_0x5e6a53[_0xd986('0x10')][_0xd986('0x11')]);return _0x2df7de(_0x5e6a53[_0xd986('0x10')][_0xd986('0x11')]);}logger[_0xd986('0x10')](_0xd986('0xb'),_0x56ca9e,_0x5e6a53[_0xd986('0x10')][_0xd986('0x11')]);return _0x5a4e82(_0x5e6a53['error']['message']);}else{logger['info'](_0xd986('0xb'),_0x56ca9e,'request\x20sent');_0x5a4e82(_0x5e6a53[_0xd986('0x12')][_0xd986('0x11')]);}})['catch'](function(_0x18b85f){logger[_0xd986('0x10')](_0xd986('0xb'),_0x56ca9e,_0x18b85f);_0x2df7de(_0x18b85f);});});} \ No newline at end of file +var _0x2ef2=['JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','../../config/environment','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2ef2,0x1a8));var _0x22ef=function(_0x2183ca,_0x3778a9){_0x2183ca=_0x2183ca-0x0;var _0x21d00e=_0x2ef2[_0x2183ca];return _0x21d00e;};'use strict';var _=require(_0x22ef('0x0'));var util=require(_0x22ef('0x1'));var moment=require(_0x22ef('0x2'));var BPromise=require('bluebird');var rs=require(_0x22ef('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x22ef('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x22ef('0x5')][_0x22ef('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x35d188,_0x5457c0,_0x37043e){return new BPromise(function(_0x5bc783,_0x2c6a20){return client[_0x22ef('0x7')](_0x35d188,_0x37043e)[_0x22ef('0x8')](function(_0x5a7cda){logger[_0x22ef('0x9')](_0x22ef('0xa'),_0x5457c0,_0x22ef('0xb'));logger[_0x22ef('0xc')](_0x22ef('0xd'),_0x5457c0,_0x22ef('0xb'),JSON[_0x22ef('0xe')](_0x5a7cda));if(_0x5a7cda[_0x22ef('0xf')]){if(_0x5a7cda['error'][_0x22ef('0x10')]===0x1f4){logger['error'](_0x22ef('0xa'),_0x5457c0,_0x5a7cda[_0x22ef('0xf')][_0x22ef('0x11')]);return _0x2c6a20(_0x5a7cda[_0x22ef('0xf')]['message']);}logger[_0x22ef('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x5457c0,_0x5a7cda[_0x22ef('0xf')][_0x22ef('0x11')]);return _0x5bc783(_0x5a7cda[_0x22ef('0xf')][_0x22ef('0x11')]);}else{logger[_0x22ef('0x9')](_0x22ef('0xa'),_0x5457c0,_0x22ef('0xb'));_0x5bc783(_0x5a7cda[_0x22ef('0x12')][_0x22ef('0x11')]);}})['catch'](function(_0x19639a){logger[_0x22ef('0xf')](_0x22ef('0xa'),_0x5457c0,_0x19639a);_0x2c6a20(_0x19639a);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 1b981b8..5e11c32 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 _0x4f60=['create','clone','put','update','delete','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','get','/:id','show','/:id/sessions','isAuthenticated','/:id/answers','getAnswers','30s','getSummary','post'];(function(_0x5149fe,_0xa35d5){var _0x2aa81f=function(_0x3e858b){while(--_0x3e858b){_0x5149fe['push'](_0x5149fe['shift']());}};_0x2aa81f(++_0xa35d5);}(_0x4f60,0x148));var _0x04f6=function(_0x36c9d9,_0x551484){_0x36c9d9=_0x36c9d9-0x0;var _0x26921b=_0x4f60[_0x36c9d9];return _0x26921b;};'use strict';var multer=require(_0x04f6('0x0'));var util=require(_0x04f6('0x1'));var path=require('path');var timeout=require(_0x04f6('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x04f6('0x3'));var auth=require(_0x04f6('0x4'));var interaction=require(_0x04f6('0x5'));var config=require('../../config/environment');var controller=require(_0x04f6('0x6'));router[_0x04f6('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x04f6('0x7')](_0x04f6('0x8'),auth['isAuthenticated'](),controller[_0x04f6('0x9')]);router[_0x04f6('0x7')](_0x04f6('0xa'),auth[_0x04f6('0xb')](),controller['getSessions']);router[_0x04f6('0x7')](_0x04f6('0xc'),auth[_0x04f6('0xb')](),controller[_0x04f6('0xd')]);router[_0x04f6('0x7')]('/:id/summary',auth[_0x04f6('0xb')](),timeout(_0x04f6('0xe')),controller[_0x04f6('0xf')]);router[_0x04f6('0x10')]('/',auth['isAuthenticated'](),controller[_0x04f6('0x11')]);router[_0x04f6('0x10')]('/:id/clone',auth['isAuthenticated'](),controller[_0x04f6('0x12')]);router[_0x04f6('0x13')](_0x04f6('0x8'),auth[_0x04f6('0xb')](),controller[_0x04f6('0x14')]);router[_0x04f6('0x15')](_0x04f6('0x8'),auth[_0x04f6('0xb')](),controller['destroy']);module[_0x04f6('0x16')]=router; \ No newline at end of file +var _0x931a=['../../config/environment','./jscriptyProject.controller','get','/:id','isAuthenticated','/:id/sessions','getSessions','/:id/answers','getAnswers','30s','post','create','/:id/clone','clone','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2a7b74,_0x45b0d5){var _0x114666=function(_0x1a293b){while(--_0x1a293b){_0x2a7b74['push'](_0x2a7b74['shift']());}};_0x114666(++_0x45b0d5);}(_0x931a,0x18d));var _0xa931=function(_0x7238f4,_0x98d4df){_0x7238f4=_0x7238f4-0x0;var _0xe645e4=_0x931a[_0x7238f4];return _0xe645e4;};'use strict';var multer=require(_0xa931('0x0'));var util=require(_0xa931('0x1'));var path=require(_0xa931('0x2'));var timeout=require(_0xa931('0x3'));var express=require(_0xa931('0x4'));var router=express[_0xa931('0x5')]();var fs_extra=require(_0xa931('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xa931('0x7'));var config=require(_0xa931('0x8'));var controller=require(_0xa931('0x9'));router[_0xa931('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa931('0xa')](_0xa931('0xb'),auth[_0xa931('0xc')](),controller['show']);router[_0xa931('0xa')](_0xa931('0xd'),auth[_0xa931('0xc')](),controller[_0xa931('0xe')]);router[_0xa931('0xa')](_0xa931('0xf'),auth['isAuthenticated'](),controller[_0xa931('0x10')]);router['get']('/:id/summary',auth['isAuthenticated'](),timeout(_0xa931('0x11')),controller['getSummary']);router[_0xa931('0x12')]('/',auth[_0xa931('0xc')](),controller[_0xa931('0x13')]);router[_0xa931('0x12')](_0xa931('0x14'),auth[_0xa931('0xc')](),controller[_0xa931('0x15')]);router[_0xa931('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xa931('0x17')]);router[_0xa931('0x18')](_0xa931('0xb'),auth[_0xa931('0xc')](),controller[_0xa931('0x19')]);module[_0xa931('0x1a')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 85d7b3c..d39bd3a 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 _0x16ab=['lodash','util','exports','STRING','TEXT','isObjectLike','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize'];(function(_0x527fe0,_0x33c712){var _0x4c1c0a=function(_0x1a3a3c){while(--_0x1a3a3c){_0x527fe0['push'](_0x527fe0['shift']());}};_0x4c1c0a(++_0x33c712);}(_0x16ab,0xbf));var _0xb16a=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x16ab[_0x25e7cb];return _0x375d92;};'use strict';var Sequelize=require(_0xb16a('0x0'));var _=require(_0xb16a('0x1'));var util=require(_0xb16a('0x2'));module[_0xb16a('0x3')]={'name':{'type':Sequelize[_0xb16a('0x4')],'unique':'name'},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xb16a('0x5')]('long'),'set':function(_0xf6a323){if(_[_0xb16a('0x6')](_0xf6a323)){this[_0xb16a('0x7')](_0xb16a('0x8'),JSON[_0xb16a('0x9')](_0xf6a323));}else if(_[_0xb16a('0xa')](_0xf6a323)){this[_0xb16a('0x7')](_0xb16a('0x8'),_0xf6a323);}else{this['setDataValue'](_0xb16a('0x8'),util[_0xb16a('0xb')](_0xb16a('0xc'),this['getDataValue']('name')||'',this[_0xb16a('0xd')](_0xb16a('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xb16a('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xb16a('0xf')],'defaultValue':![]}}; \ No newline at end of file +var _0x7cb1=['setDataValue','formData','stringify','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','lodash','exports','STRING','name','TEXT','long'];(function(_0x16eca5,_0xacf5b8){var _0x55a0f3=function(_0x662ee){while(--_0x662ee){_0x16eca5['push'](_0x16eca5['shift']());}};_0x55a0f3(++_0xacf5b8);}(_0x7cb1,0x1ba));var _0x17cb=function(_0x2a8fa5,_0x354781){_0x2a8fa5=_0x2a8fa5-0x0;var _0x4a8a3d=_0x7cb1[_0x2a8fa5];return _0x4a8a3d;};'use strict';var Sequelize=require('sequelize');var _=require(_0x17cb('0x0'));var util=require('util');module[_0x17cb('0x1')]={'name':{'type':Sequelize[_0x17cb('0x2')],'unique':_0x17cb('0x3')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x17cb('0x4')](_0x17cb('0x5')),'set':function(_0x41d859){if(_['isObjectLike'](_0x41d859)){this[_0x17cb('0x6')](_0x17cb('0x7'),JSON[_0x17cb('0x8')](_0x41d859));}else if(_['isString'](_0x41d859)){this[_0x17cb('0x6')]('formData',_0x41d859);}else{this[_0x17cb('0x6')](_0x17cb('0x7'),util[_0x17cb('0x9')](_0x17cb('0xa'),this['getDataValue'](_0x17cb('0x3'))||'',this[_0x17cb('0xb')](_0x17cb('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x17cb('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x17cb('0xd')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 9c31cf9..90a4b74 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 _0xf925=['fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','merge','where','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','role','get','Projects','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','length','omit','createdAt','updatedAt','getSessions','findOne','JscriptySessionReport','pick','ProjectId','filter','JscriptyAnswerReport','number','toString','indexOf','replace','getSummary','startTime','parse','JscriptyQuestionReport','-createdAt','questionId','question','SessionId','answer','push','now','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','UserProfileResource','error','stack','name','send','index','map','JscriptyProject','rawAttributes'];(function(_0x188bcd,_0x52f234){var _0x3c4e5b=function(_0x23dc8f){while(--_0x23dc8f){_0x188bcd['push'](_0x188bcd['shift']());}};_0x3c4e5b(++_0x52f234);}(_0xf925,0xb7));var _0x5f92=function(_0x4c11fb,_0x32dbc0){_0x4c11fb=_0x4c11fb-0x0;var _0x4caf73=_0xf925[_0x4c11fb];return _0x4caf73;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5f92('0x0'));var rp=require(_0x5f92('0x1'));var moment=require(_0x5f92('0x2'));var BPromise=require(_0x5f92('0x3'));var Mustache=require('mustache');var util=require(_0x5f92('0x4'));var path=require(_0x5f92('0x5'));var sox=require(_0x5f92('0x6'));var csv=require(_0x5f92('0x7'));var ejs=require(_0x5f92('0x8'));var fs=require('fs');var fs_extra=require(_0x5f92('0x9'));var _=require(_0x5f92('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5f92('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5f92('0xc'));var Papa=require(_0x5f92('0xd'));var Redis=require('ioredis');var authService=require(_0x5f92('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x5f92('0xf'));var hardwareService=require(_0x5f92('0x10'));var logger=require(_0x5f92('0x11'))(_0x5f92('0x12'));var utils=require('../../config/utils');var config=require(_0x5f92('0x13'));var licenseUtil=require(_0x5f92('0x14'));var db=require(_0x5f92('0x15'))['db'];function respondWithStatusCode(_0x171464,_0x50dddf){_0x50dddf=_0x50dddf||0xcc;return function(_0x37640f){if(_0x37640f){return _0x171464[_0x5f92('0x16')](_0x50dddf);}return _0x171464[_0x5f92('0x17')](_0x50dddf)['end']();};}function respondWithResult(_0x5e2878,_0x3ef88d){_0x3ef88d=_0x3ef88d||0xc8;return function(_0x2642f5){if(_0x2642f5){return _0x5e2878['status'](_0x3ef88d)['json'](_0x2642f5);}};}function respondWithFilteredResult(_0xb1c3fa,_0x3151eb){return function(_0x4ccd50){if(_0x4ccd50){var _0x2099e5=typeof _0x3151eb[_0x5f92('0x18')]==='undefined'&&typeof _0x3151eb[_0x5f92('0x19')]==='undefined';var _0x4d954d=_0x4ccd50[_0x5f92('0x1a')];var _0x4d22cf=_0x2099e5?0x0:_0x3151eb[_0x5f92('0x18')];var _0xb9c506=_0x2099e5?_0x4ccd50[_0x5f92('0x1a')]:_0x3151eb[_0x5f92('0x18')]+_0x3151eb[_0x5f92('0x19')];var _0x1c8ab6;if(_0xb9c506>=_0x4d954d){_0xb9c506=_0x4d954d;_0x1c8ab6=0xc8;}else{_0x1c8ab6=0xce;}_0xb1c3fa[_0x5f92('0x17')](_0x1c8ab6);return _0xb1c3fa[_0x5f92('0x1b')](_0x5f92('0x1c'),_0x4d22cf+'-'+_0xb9c506+'/'+_0x4d954d)[_0x5f92('0x1d')](_0x4ccd50);}return null;};}function patchUpdates(_0x215085){return function(_0x3bd2c6){try{jsonpatch[_0x5f92('0x1e')](_0x3bd2c6,_0x215085,!![]);}catch(_0x4923be){return BPromise[_0x5f92('0x1f')](_0x4923be);}return _0x3bd2c6[_0x5f92('0x20')]();};}function saveUpdates(_0xd1be3,_0x57dbc8){return function(_0x534f68){if(_0x534f68){return _0x534f68[_0x5f92('0x21')](_0xd1be3)['then'](function(_0x15ba80){return _0x15ba80;});}return null;};}function removeEntity(_0x52e110,_0x21482e){return function(_0x2a4fe2){if(_0x2a4fe2){return _0x2a4fe2[_0x5f92('0x22')]()[_0x5f92('0x23')](function(){var _0x2d3a16=_0x2a4fe2['get']({'plain':!![]});var _0x4fbc22='Projects';return db[_0x5f92('0x24')][_0x5f92('0x22')]({'where':{'type':_0x4fbc22,'resourceId':_0x2d3a16['id']}})['then'](function(){return _0x2a4fe2;});})[_0x5f92('0x23')](function(){_0x52e110[_0x5f92('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x37620f,_0x49d9da){return function(_0x55a327){if(!_0x55a327){_0x37620f[_0x5f92('0x16')](0x194);}return _0x55a327;};}function handleError(_0x558867,_0x26b5b9){_0x26b5b9=_0x26b5b9||0x1f4;return function(_0x45dd8e){logger[_0x5f92('0x25')](_0x45dd8e[_0x5f92('0x26')]);if(_0x45dd8e[_0x5f92('0x27')]){delete _0x45dd8e[_0x5f92('0x27')];}_0x558867['status'](_0x26b5b9)[_0x5f92('0x28')](_0x45dd8e);};}exports[_0x5f92('0x29')]=function(_0x18258a,_0x1893d1){var _0x56369b={},_0x224972={},_0x2996ad={'count':0x0,'rows':[]};var _0x130093=_[_0x5f92('0x2a')](db[_0x5f92('0x2b')][_0x5f92('0x2c')],function(_0x124218){return{'name':_0x124218[_0x5f92('0x2d')],'type':_0x124218[_0x5f92('0x2e')][_0x5f92('0x2f')]};});_0x224972[_0x5f92('0x30')]=_['map'](_0x130093,'name');_0x224972[_0x5f92('0x31')]=_[_0x5f92('0x32')](_0x18258a['query']);_0x224972[_0x5f92('0x33')]=_['intersection'](_0x224972[_0x5f92('0x30')],_0x224972[_0x5f92('0x31')]);_0x56369b['attributes']=_[_0x5f92('0x34')](_0x224972[_0x5f92('0x30')],qs[_0x5f92('0x35')](_0x18258a[_0x5f92('0x31')][_0x5f92('0x35')]));_0x56369b[_0x5f92('0x36')]=_0x56369b['attributes']['length']?_0x56369b[_0x5f92('0x36')]:_0x224972[_0x5f92('0x30')];if(!_0x18258a[_0x5f92('0x31')][_0x5f92('0x37')](_0x5f92('0x38'))){_0x56369b[_0x5f92('0x19')]=qs[_0x5f92('0x19')](_0x18258a[_0x5f92('0x31')][_0x5f92('0x19')]);_0x56369b[_0x5f92('0x18')]=qs['offset'](_0x18258a['query'][_0x5f92('0x18')]);}_0x56369b[_0x5f92('0x39')]=qs[_0x5f92('0x3a')](_0x18258a[_0x5f92('0x31')]['sort']);_0x56369b['where']=qs['filters'](_['pick'](_0x18258a[_0x5f92('0x31')],_0x224972[_0x5f92('0x33')]),_0x130093);if(_0x18258a[_0x5f92('0x31')]['filter']){_0x56369b['where']=_[_0x5f92('0x3b')](_0x56369b[_0x5f92('0x3c')],{'$or':_[_0x5f92('0x2a')](_0x130093,function(_0xf48367){if(_0xf48367[_0x5f92('0x2e')]!=='VIRTUAL'){var _0x1d01ed={};_0x1d01ed[_0xf48367['name']]={'$like':'%'+_0x18258a[_0x5f92('0x31')]['filter']+'%'};return _0x1d01ed;}})});}_0x56369b=_[_0x5f92('0x3b')]({},_0x56369b,_0x18258a[_0x5f92('0x3d')]);var _0x40cfad={'where':_0x56369b[_0x5f92('0x3c')]};return db[_0x5f92('0x2b')][_0x5f92('0x1a')](_0x40cfad)['then'](function(_0x3c8602){_0x2996ad['count']=_0x3c8602;if(_0x18258a[_0x5f92('0x31')]['includeAll']){_0x56369b[_0x5f92('0x3e')]=[{'all':!![]}];}return db['JscriptyProject'][_0x5f92('0x3f')](_0x56369b);})[_0x5f92('0x23')](function(_0x378a43){_0x2996ad[_0x5f92('0x40')]=_0x378a43;return _0x2996ad;})['then'](respondWithFilteredResult(_0x1893d1,_0x56369b))[_0x5f92('0x41')](handleError(_0x1893d1,null));};exports[_0x5f92('0x42')]=function(_0x25ffd6,_0xd3ca9){var _0x52ee61={'raw':![],'where':{'id':_0x25ffd6[_0x5f92('0x43')]['id']}},_0x1ed7c6={};_0x1ed7c6[_0x5f92('0x30')]=_[_0x5f92('0x32')](db[_0x5f92('0x2b')]['rawAttributes']);_0x1ed7c6[_0x5f92('0x31')]=_[_0x5f92('0x32')](_0x25ffd6['query']);_0x1ed7c6[_0x5f92('0x33')]=_[_0x5f92('0x34')](_0x1ed7c6['model'],_0x1ed7c6[_0x5f92('0x31')]);_0x52ee61['attributes']=_[_0x5f92('0x34')](_0x1ed7c6[_0x5f92('0x30')],qs[_0x5f92('0x35')](_0x25ffd6[_0x5f92('0x31')]['fields']));_0x52ee61[_0x5f92('0x36')]=_0x52ee61[_0x5f92('0x36')]['length']?_0x52ee61[_0x5f92('0x36')]:_0x1ed7c6['model'];if(_0x25ffd6[_0x5f92('0x31')][_0x5f92('0x44')]){_0x52ee61[_0x5f92('0x3e')]=[{'all':!![]}];}_0x52ee61=_[_0x5f92('0x3b')]({},_0x52ee61,_0x25ffd6[_0x5f92('0x3d')]);return db[_0x5f92('0x2b')][_0x5f92('0x45')](_0x52ee61)[_0x5f92('0x23')](handleEntityNotFound(_0xd3ca9,null))['then'](respondWithResult(_0xd3ca9,null))[_0x5f92('0x41')](handleError(_0xd3ca9,null));};exports[_0x5f92('0x46')]=function(_0x6c66a5,_0x1423be){return db['JscriptyProject'][_0x5f92('0x46')](_0x6c66a5[_0x5f92('0x47')],{})[_0x5f92('0x23')](function(_0x417b8c){var _0x159365=_0x6c66a5[_0x5f92('0x48')]['get']({'plain':!![]});if(!_0x159365)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x159365[_0x5f92('0x49')]===_0x5f92('0x48')){var _0x1e6b94=_0x417b8c[_0x5f92('0x4a')]({'plain':!![]});var _0x373b6a=_0x5f92('0x4b');return db[_0x5f92('0x4c')]['find']({'where':{'name':_0x373b6a,'userProfileId':_0x159365[_0x5f92('0x4d')]},'raw':!![]})['then'](function(_0x2aecb5){if(_0x2aecb5&&_0x2aecb5[_0x5f92('0x4e')]===0x0){return db[_0x5f92('0x24')][_0x5f92('0x46')]({'name':_0x1e6b94[_0x5f92('0x27')],'resourceId':_0x1e6b94['id'],'type':_0x2aecb5[_0x5f92('0x27')],'sectionId':_0x2aecb5['id']},{})[_0x5f92('0x23')](function(){return _0x417b8c;});}else{return _0x417b8c;}})['catch'](function(_0x2791a8){logger[_0x5f92('0x25')](_0x5f92('0x4f'),_0x2791a8);throw _0x2791a8;});}return _0x417b8c;})[_0x5f92('0x23')](respondWithResult(_0x1423be,0xc9))[_0x5f92('0x41')](handleError(_0x1423be,null));};exports['clone']=function(_0x132fcb,_0x4c8e03){var _0xab8e38={'where':{'id':_0x132fcb['params']['id']}},_0x44313e={};_0x44313e[_0x5f92('0x30')]=_[_0x5f92('0x32')](db[_0x5f92('0x2b')]['rawAttributes']);_0xab8e38['attributes']=_[_0x5f92('0x34')](_0x44313e[_0x5f92('0x30')],qs['fields'](_0x132fcb[_0x5f92('0x31')]['fields']));_0xab8e38['attributes']=_0xab8e38['attributes'][_0x5f92('0x50')]?_0xab8e38[_0x5f92('0x36')]:_0x44313e[_0x5f92('0x30')];if(_0x132fcb[_0x5f92('0x31')][_0x5f92('0x44')]){_0xab8e38[_0x5f92('0x3e')]=[{'all':!![]}];}_0xab8e38=_[_0x5f92('0x3b')]({},_0xab8e38,_0x132fcb[_0x5f92('0x3d')]);return db[_0x5f92('0x2b')][_0x5f92('0x45')](_0xab8e38)[_0x5f92('0x23')](handleEntityNotFound(_0x4c8e03,null))[_0x5f92('0x23')](function(_0x205b0c){if(_0x205b0c){var _0x3910f6=_0x205b0c[_0x5f92('0x4a')]({'plain':!![]});_0x3910f6=qs[_0x5f92('0x51')](_0x3910f6,['id',_0x5f92('0x52'),_0x5f92('0x53')]);_0x132fcb['body']=_[_0x5f92('0x51')](_0x132fcb[_0x5f92('0x47')],['id',_0x5f92('0x52'),'updatedAt']);return db[_0x5f92('0x2b')][_0x5f92('0x46')](_['merge'](_0x3910f6,_0x132fcb['body']),{'include':_0x132fcb[_0x5f92('0x31')][_0x5f92('0x44')]?[{'all':!![]}]:undefined})[_0x5f92('0x23')](function(_0x32351d){var _0xaed387=_0x132fcb[_0x5f92('0x48')]['get']({'plain':!![]});if(!_0xaed387)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xaed387[_0x5f92('0x49')]===_0x5f92('0x48')){var _0x3f32e4=_0x32351d[_0x5f92('0x4a')]({'plain':!![]});var _0x45ce65='Projects';return db[_0x5f92('0x4c')]['find']({'where':{'name':_0x45ce65,'userProfileId':_0xaed387[_0x5f92('0x4d')]},'raw':!![]})[_0x5f92('0x23')](function(_0x26c64a){if(_0x26c64a&&_0x26c64a[_0x5f92('0x4e')]===0x0){return db[_0x5f92('0x24')][_0x5f92('0x46')]({'name':_0x3f32e4[_0x5f92('0x27')],'resourceId':_0x3f32e4['id'],'type':_0x26c64a[_0x5f92('0x27')],'sectionId':_0x26c64a['id']},{})['then'](function(){return _0x32351d;});}else{return _0x32351d;}})[_0x5f92('0x41')](function(_0x214c08){logger['error'](_0x5f92('0x4f'),_0x214c08);throw _0x214c08;});}return _0x32351d;});}})[_0x5f92('0x23')](respondWithResult(_0x4c8e03,0xc9))[_0x5f92('0x41')](handleError(_0x4c8e03,null));};exports[_0x5f92('0x21')]=function(_0x4d6ced,_0x28c087){if(_0x4d6ced[_0x5f92('0x47')]['id']){delete _0x4d6ced[_0x5f92('0x47')]['id'];}return db[_0x5f92('0x2b')]['find']({'where':{'id':_0x4d6ced['params']['id']}})[_0x5f92('0x23')](handleEntityNotFound(_0x28c087,null))['then'](saveUpdates(_0x4d6ced['body'],null))[_0x5f92('0x23')](respondWithResult(_0x28c087,null))[_0x5f92('0x41')](handleError(_0x28c087,null));};exports['destroy']=function(_0x306e58,_0x43fd8a){return db['JscriptyProject'][_0x5f92('0x45')]({'where':{'id':_0x306e58[_0x5f92('0x43')]['id']}})[_0x5f92('0x23')](handleEntityNotFound(_0x43fd8a,null))[_0x5f92('0x23')](removeEntity(_0x43fd8a,null))[_0x5f92('0x41')](handleError(_0x43fd8a,null));};exports[_0x5f92('0x54')]=function(_0x2908d6,_0x348e7b,_0xd58ddd){var _0xb4b55f={'raw':!![],'where':{}};var _0x887546={};var _0x1b658f={'count':0x0,'rows':[]};return db[_0x5f92('0x2b')][_0x5f92('0x55')]({'where':{'id':_0x2908d6['params']['id']}})[_0x5f92('0x23')](handleEntityNotFound(_0x348e7b,null))[_0x5f92('0x23')](function(_0x12ce5c){if(_0x12ce5c){_0x887546[_0x5f92('0x30')]=_[_0x5f92('0x32')](db[_0x5f92('0x56')][_0x5f92('0x2c')]);_0x887546[_0x5f92('0x31')]=_[_0x5f92('0x32')](_0x2908d6[_0x5f92('0x31')]);_0x887546[_0x5f92('0x33')]=_['intersection'](_0x887546[_0x5f92('0x30')],_0x887546['query']);_0xb4b55f[_0x5f92('0x36')]=_[_0x5f92('0x34')](_0x887546[_0x5f92('0x30')],qs['fields'](_0x2908d6[_0x5f92('0x31')][_0x5f92('0x35')]));_0xb4b55f['attributes']=_0xb4b55f[_0x5f92('0x36')][_0x5f92('0x50')]?_0xb4b55f[_0x5f92('0x36')]:_0x887546[_0x5f92('0x30')];if(!_0x2908d6['query'][_0x5f92('0x37')]('nolimit')){_0xb4b55f[_0x5f92('0x19')]=qs[_0x5f92('0x19')](_0x2908d6[_0x5f92('0x31')][_0x5f92('0x19')]);_0xb4b55f['offset']=qs[_0x5f92('0x18')](_0x2908d6[_0x5f92('0x31')][_0x5f92('0x18')]);}_0xb4b55f['order']=qs[_0x5f92('0x3a')](_0x2908d6[_0x5f92('0x31')][_0x5f92('0x3a')]);_0xb4b55f[_0x5f92('0x3c')]=qs[_0x5f92('0x33')](_[_0x5f92('0x57')](_0x2908d6[_0x5f92('0x31')],_0x887546[_0x5f92('0x33')]));_0xb4b55f[_0x5f92('0x3c')][_0x5f92('0x58')]=_0x12ce5c['id'];if(_0x2908d6[_0x5f92('0x31')][_0x5f92('0x59')]){_0xb4b55f[_0x5f92('0x3c')]=_['merge'](_0xb4b55f[_0x5f92('0x3c')],{'$or':_[_0x5f92('0x2a')](_0xb4b55f[_0x5f92('0x36')],function(_0xdd4528){var _0x5f1d4f={};_0x5f1d4f[_0xdd4528]={'$like':'%'+_0x2908d6[_0x5f92('0x31')][_0x5f92('0x59')]+'%'};return _0x5f1d4f;})});}_0xb4b55f=_[_0x5f92('0x3b')]({},_0xb4b55f,_0x2908d6['options']);return db['JscriptySessionReport']['count']({'where':_0xb4b55f[_0x5f92('0x3c')]})[_0x5f92('0x23')](function(_0x56346f){_0x1b658f[_0x5f92('0x1a')]=_0x56346f;if(_0x2908d6['query']['includeAll']){_0xb4b55f['include']=[{'all':!![]}];}return db[_0x5f92('0x56')][_0x5f92('0x3f')](_0xb4b55f);})[_0x5f92('0x23')](function(_0xd478b1){_0x1b658f[_0x5f92('0x40')]=_0xd478b1;return _0x1b658f;});}})[_0x5f92('0x23')](respondWithFilteredResult(_0x348e7b,_0xb4b55f))[_0x5f92('0x41')](handleError(_0x348e7b,null));};exports['getAnswers']=function(_0x26aa03,_0x326bc6,_0x3f7938){var _0x3e3b8c={'raw':!![],'where':{}};var _0x1b3b44={};var _0x1eced2={'count':0x0,'rows':[]};return db[_0x5f92('0x2b')][_0x5f92('0x55')]({'where':{'id':_0x26aa03[_0x5f92('0x43')]['id']}})[_0x5f92('0x23')](handleEntityNotFound(_0x326bc6,null))[_0x5f92('0x23')](function(_0x31ce88){if(_0x31ce88){_0x1b3b44[_0x5f92('0x30')]=_[_0x5f92('0x32')](db[_0x5f92('0x5a')][_0x5f92('0x2c')]);_0x1b3b44[_0x5f92('0x31')]=_[_0x5f92('0x32')](_0x26aa03['query']);_0x1b3b44[_0x5f92('0x33')]=_[_0x5f92('0x34')](_0x1b3b44['model'],_0x1b3b44[_0x5f92('0x31')]);_0x3e3b8c[_0x5f92('0x36')]=_[_0x5f92('0x34')](_0x1b3b44[_0x5f92('0x30')],qs[_0x5f92('0x35')](_0x26aa03['query'][_0x5f92('0x35')]));_0x3e3b8c['attributes']=_0x3e3b8c[_0x5f92('0x36')][_0x5f92('0x50')]?_0x3e3b8c[_0x5f92('0x36')]:_0x1b3b44[_0x5f92('0x30')];if(!_0x26aa03['query'][_0x5f92('0x37')](_0x5f92('0x38'))){_0x3e3b8c[_0x5f92('0x19')]=qs[_0x5f92('0x19')](_0x26aa03[_0x5f92('0x31')][_0x5f92('0x19')]);_0x3e3b8c[_0x5f92('0x18')]=qs[_0x5f92('0x18')](_0x26aa03[_0x5f92('0x31')][_0x5f92('0x18')]);}_0x3e3b8c[_0x5f92('0x39')]=qs[_0x5f92('0x3a')](_0x26aa03[_0x5f92('0x31')][_0x5f92('0x3a')]);_0x3e3b8c[_0x5f92('0x3c')]=qs['filters'](_['pick'](_0x26aa03[_0x5f92('0x31')],_0x1b3b44[_0x5f92('0x33')]));_0x3e3b8c['where'][_0x5f92('0x58')]=_0x31ce88['id'];if(_0x26aa03[_0x5f92('0x31')][_0x5f92('0x59')]){_0x3e3b8c[_0x5f92('0x3c')]=_[_0x5f92('0x3b')](_0x3e3b8c[_0x5f92('0x3c')],{'$or':_[_0x5f92('0x2a')](_0x3e3b8c[_0x5f92('0x36')],function(_0x404cfa){var _0x3535ea={};_0x3535ea[_0x404cfa]={'$like':'%'+_0x26aa03['query'][_0x5f92('0x59')]+'%'};return _0x3535ea;})});}_0x3e3b8c=_[_0x5f92('0x3b')]({},_0x3e3b8c,_0x26aa03['options']);return db[_0x5f92('0x5a')][_0x5f92('0x1a')]({'where':_0x3e3b8c[_0x5f92('0x3c')]})[_0x5f92('0x23')](function(_0x5594a7){_0x1eced2[_0x5f92('0x1a')]=_0x5594a7;if(_0x26aa03['query'][_0x5f92('0x44')]){_0x3e3b8c[_0x5f92('0x3e')]=[{'all':!![]}];}return db[_0x5f92('0x5a')][_0x5f92('0x3f')](_0x3e3b8c);})[_0x5f92('0x23')](function(_0xf9470c){_0x1eced2[_0x5f92('0x40')]=_0xf9470c;return _0x1eced2;});}})[_0x5f92('0x23')](respondWithFilteredResult(_0x326bc6,_0x3e3b8c))['catch'](handleError(_0x326bc6,null));};function char(_0x482cd2){return _0x5f92('0x5b')===typeof _0x482cd2?String['fromCharCode'][_0x5f92('0x1e')](null,arguments):_0x482cd2;}function needsEncapsulation(_0x3962cd){return!!_0x3962cd&&(_0x3962cd[_0x5f92('0x5c')]()[_0x5f92('0x5d')](char(0xd))>=0x0||_0x3962cd[_0x5f92('0x5c')]()[_0x5f92('0x5d')](char(0xa))>=0x0||_0x3962cd[_0x5f92('0x5c')]()[_0x5f92('0x5d')](char(0x2c))>=0x0||_0x3962cd[_0x5f92('0x5c')]()[_0x5f92('0x5d')](char(0x22))>=0x0);}function encapsulate(_0x4ad892){var _0x565eab=char(0x22),_0x2d49bd='\x5c'+char(0x22),_0x546419=_0x4ad892['toString']()[_0x5f92('0x5e')](new RegExp(_0x565eab,'g'),_0x2d49bd);return _0x565eab+_0x546419+_0x565eab;}exports[_0x5f92('0x5f')]=function(_0x119716,_0x424cf9,_0x2d4351){var _0x23383e,_0x2f1f97;var _0x296066={'where':{'ProjectId':_0x119716[_0x5f92('0x43')]['id']}};if(_0x119716[_0x5f92('0x31')][_0x5f92('0x60')]){_0x296066[_0x5f92('0x3c')]['starttime']=JSON[_0x5f92('0x61')](_0x119716[_0x5f92('0x31')]['startTime']);}return db[_0x5f92('0x56')][_0x5f92('0x3f')](_0x296066)['then'](handleEntityNotFound(_0x424cf9,null))[_0x5f92('0x23')](function(_0x12a92f){if(_0x12a92f){_0x23383e=_0x12a92f;return db[_0x5f92('0x62')][_0x5f92('0x3f')]({'where':{'SessionId':{'$in':_[_0x5f92('0x2a')](_0x23383e,'id')},'ProjectId':_0x119716[_0x5f92('0x43')]['id']},'order':_0x5f92('0x63')});}})[_0x5f92('0x23')](handleEntityNotFound(_0x424cf9,null))['then'](function(_0x344d26){if(_0x344d26){_0x2f1f97=_0x344d26;var _0x1751de={};for(var _0x2a3ef2=0x0,_0x165c8c=_0x2f1f97['length'];_0x2a3ef2<_0x165c8c;_0x2a3ef2++){if(!_0x1751de['hasOwnProperty'](_0x2f1f97[_0x2a3ef2]['questionId'])){_0x1751de[_0x2f1f97[_0x2a3ef2][_0x5f92('0x64')]]=needsEncapsulation(_0x2f1f97[_0x2a3ef2]['question'])?encapsulate(_0x2f1f97[_0x2a3ef2]['question']):_0x2f1f97[_0x2a3ef2][_0x5f92('0x65')];}}var _0x21943d=[],_0x381578={};for(var _0x56733c=0x0,_0x3c3e68=_0x23383e[_0x5f92('0x50')];_0x56733c<_0x3c3e68;_0x56733c++){_0x381578={'ProjectId':_0x119716[_0x5f92('0x43')]['id'],'SessionId':_0x23383e[_0x56733c]['id'],'StartTime':moment(_0x23383e[_0x56733c]['starttime'])['format']('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x1a510e=0x0,_0x1f492c=_0x2f1f97[_0x5f92('0x50')];_0x1a510e<_0x1f492c;_0x1a510e++){if(_0x2f1f97[_0x1a510e][_0x5f92('0x66')]==_0x23383e[_0x56733c]['id']&&_0x1751de[_0x5f92('0x37')](_0x2f1f97[_0x1a510e]['questionId'])){_0x381578[_0x1751de[_0x2f1f97[_0x1a510e][_0x5f92('0x64')]]]=_0x2f1f97[_0x1a510e][_0x5f92('0x67')];}}for(var _0x1e2ffd in _0x1751de){if(!_0x381578['hasOwnProperty'](_0x1751de[_0x1e2ffd])){_0x381578[_0x1751de[_0x1e2ffd]]=null;}}_0x21943d[_0x5f92('0x68')](_0x381578);}return _0x21943d;}})['then'](function(_0x1a6aa0){if(!_['isEmpty'](_0x1a6aa0)){var _0xa110c5=toCsv(_0x1a6aa0);var _0x49e033=Date[_0x5f92('0x69')]();fs[_0x5f92('0x6a')](util[_0x5f92('0x6b')](_0x5f92('0x6c'),_0x119716['params']['id'],_0x49e033),_0xa110c5);_0x424cf9[_0x5f92('0x6d')]('Content-disposition','attachment;\x20filename='+util['format'](_0x5f92('0x6e'),_0x119716[_0x5f92('0x43')]['id'],_0x49e033));_0x424cf9[_0x5f92('0x6d')](_0x5f92('0x6f'),_0x5f92('0x70'));return _0x424cf9[_0x5f92('0x71')](util[_0x5f92('0x6b')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x119716[_0x5f92('0x43')]['id'],_0x49e033));}else{return _0x424cf9[_0x5f92('0x16')](0xcc);}})['catch'](handleError(_0x424cf9,null));}; \ No newline at end of file +var _0x0d98=['rimraf','zip-dir','bluebird','mustache','util','path','to-csv','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','then','destroy','get','Projects','error','name','send','index','map','JscriptyProject','fieldName','key','model','query','keys','intersection','fields','attributes','length','nolimit','where','filters','filter','merge','type','options','includeAll','include','findAll','rows','show','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','rawAttributes','omit','createdAt','updatedAt','update','findOne','JscriptySessionReport','hasOwnProperty','order','sort','ProjectId','JscriptyAnswerReport','pick','number','fromCharCode','toString','indexOf','startTime','starttime','JscriptyQuestionReport','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','download','eml-format'];(function(_0x2c6a06,_0x1e33bd){var _0x2d1e54=function(_0x370724){while(--_0x370724){_0x2c6a06['push'](_0x2c6a06['shift']());}};_0x2d1e54(++_0x1e33bd);}(_0x0d98,0x149));var _0x80d9=function(_0x24c137,_0x3327f6){_0x24c137=_0x24c137-0x0;var _0x857247=_0x0d98[_0x24c137];return _0x857247;};'use strict';var emlformat=require(_0x80d9('0x0'));var rimraf=require(_0x80d9('0x1'));var zipdir=require(_0x80d9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x80d9('0x3'));var Mustache=require(_0x80d9('0x4'));var util=require(_0x80d9('0x5'));var path=require(_0x80d9('0x6'));var sox=require('sox');var csv=require(_0x80d9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x80d9('0x8'));var crypto=require(_0x80d9('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x80d9('0x7'));var querystring=require(_0x80d9('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x80d9('0xb'));var qs=require(_0x80d9('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x80d9('0xd'));var logger=require(_0x80d9('0xe'))(_0x80d9('0xf'));var utils=require(_0x80d9('0x10'));var config=require(_0x80d9('0x11'));var licenseUtil=require(_0x80d9('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18d8ae,_0x1981ba){_0x1981ba=_0x1981ba||0xcc;return function(_0x5250c6){if(_0x5250c6){return _0x18d8ae[_0x80d9('0x13')](_0x1981ba);}return _0x18d8ae[_0x80d9('0x14')](_0x1981ba)[_0x80d9('0x15')]();};}function respondWithResult(_0x53b0e8,_0xf3a2be){_0xf3a2be=_0xf3a2be||0xc8;return function(_0x4c89a0){if(_0x4c89a0){return _0x53b0e8[_0x80d9('0x14')](_0xf3a2be)[_0x80d9('0x16')](_0x4c89a0);}};}function respondWithFilteredResult(_0x2a5634,_0x1413f7){return function(_0x5b5b81){if(_0x5b5b81){var _0x70370e=typeof _0x1413f7[_0x80d9('0x17')]===_0x80d9('0x18')&&typeof _0x1413f7[_0x80d9('0x19')]===_0x80d9('0x18');var _0x2be823=_0x5b5b81[_0x80d9('0x1a')];var _0x2165c1=_0x70370e?0x0:_0x1413f7[_0x80d9('0x17')];var _0x3b104b=_0x70370e?_0x5b5b81[_0x80d9('0x1a')]:_0x1413f7[_0x80d9('0x17')]+_0x1413f7[_0x80d9('0x19')];var _0xd72ec;if(_0x3b104b>=_0x2be823){_0x3b104b=_0x2be823;_0xd72ec=0xc8;}else{_0xd72ec=0xce;}_0x2a5634[_0x80d9('0x14')](_0xd72ec);return _0x2a5634['set']('Content-Range',_0x2165c1+'-'+_0x3b104b+'/'+_0x2be823)[_0x80d9('0x16')](_0x5b5b81);}return null;};}function patchUpdates(_0x58157d){return function(_0x54f78b){try{jsonpatch[_0x80d9('0x1b')](_0x54f78b,_0x58157d,!![]);}catch(_0x5c2cc2){return BPromise[_0x80d9('0x1c')](_0x5c2cc2);}return _0x54f78b[_0x80d9('0x1d')]();};}function saveUpdates(_0x822bef,_0x3431be){return function(_0x3098b0){if(_0x3098b0){return _0x3098b0['update'](_0x822bef)[_0x80d9('0x1e')](function(_0x585265){return _0x585265;});}return null;};}function removeEntity(_0x2ec3b7,_0x2256b6){return function(_0x6b26d4){if(_0x6b26d4){return _0x6b26d4[_0x80d9('0x1f')]()[_0x80d9('0x1e')](function(){var _0x5b583f=_0x6b26d4[_0x80d9('0x20')]({'plain':!![]});var _0x2d32fa=_0x80d9('0x21');return db['UserProfileResource'][_0x80d9('0x1f')]({'where':{'type':_0x2d32fa,'resourceId':_0x5b583f['id']}})[_0x80d9('0x1e')](function(){return _0x6b26d4;});})[_0x80d9('0x1e')](function(){_0x2ec3b7['status'](0xcc)[_0x80d9('0x15')]();});}};}function handleEntityNotFound(_0x23c9c2,_0x34c17d){return function(_0x9c39aa){if(!_0x9c39aa){_0x23c9c2['sendStatus'](0x194);}return _0x9c39aa;};}function handleError(_0x492b29,_0x475540){_0x475540=_0x475540||0x1f4;return function(_0x104717){logger[_0x80d9('0x22')](_0x104717['stack']);if(_0x104717[_0x80d9('0x23')]){delete _0x104717[_0x80d9('0x23')];}_0x492b29[_0x80d9('0x14')](_0x475540)[_0x80d9('0x24')](_0x104717);};}exports[_0x80d9('0x25')]=function(_0x12870e,_0x2e405d){var _0x30d56b={},_0x30f4c4={},_0x3455d5={'count':0x0,'rows':[]};var _0x3950e2=_[_0x80d9('0x26')](db[_0x80d9('0x27')]['rawAttributes'],function(_0xa07b2c){return{'name':_0xa07b2c[_0x80d9('0x28')],'type':_0xa07b2c['type'][_0x80d9('0x29')]};});_0x30f4c4[_0x80d9('0x2a')]=_[_0x80d9('0x26')](_0x3950e2,_0x80d9('0x23'));_0x30f4c4[_0x80d9('0x2b')]=_[_0x80d9('0x2c')](_0x12870e['query']);_0x30f4c4['filters']=_[_0x80d9('0x2d')](_0x30f4c4[_0x80d9('0x2a')],_0x30f4c4[_0x80d9('0x2b')]);_0x30d56b['attributes']=_[_0x80d9('0x2d')](_0x30f4c4[_0x80d9('0x2a')],qs[_0x80d9('0x2e')](_0x12870e['query'][_0x80d9('0x2e')]));_0x30d56b[_0x80d9('0x2f')]=_0x30d56b[_0x80d9('0x2f')][_0x80d9('0x30')]?_0x30d56b[_0x80d9('0x2f')]:_0x30f4c4['model'];if(!_0x12870e[_0x80d9('0x2b')]['hasOwnProperty'](_0x80d9('0x31'))){_0x30d56b[_0x80d9('0x19')]=qs['limit'](_0x12870e[_0x80d9('0x2b')][_0x80d9('0x19')]);_0x30d56b[_0x80d9('0x17')]=qs[_0x80d9('0x17')](_0x12870e[_0x80d9('0x2b')][_0x80d9('0x17')]);}_0x30d56b['order']=qs['sort'](_0x12870e['query']['sort']);_0x30d56b[_0x80d9('0x32')]=qs[_0x80d9('0x33')](_['pick'](_0x12870e[_0x80d9('0x2b')],_0x30f4c4[_0x80d9('0x33')]),_0x3950e2);if(_0x12870e[_0x80d9('0x2b')][_0x80d9('0x34')]){_0x30d56b['where']=_[_0x80d9('0x35')](_0x30d56b[_0x80d9('0x32')],{'$or':_[_0x80d9('0x26')](_0x3950e2,function(_0x5c2b69){if(_0x5c2b69[_0x80d9('0x36')]!=='VIRTUAL'){var _0x3a250b={};_0x3a250b[_0x5c2b69['name']]={'$like':'%'+_0x12870e[_0x80d9('0x2b')][_0x80d9('0x34')]+'%'};return _0x3a250b;}})});}_0x30d56b=_[_0x80d9('0x35')]({},_0x30d56b,_0x12870e[_0x80d9('0x37')]);var _0x2c8587={'where':_0x30d56b[_0x80d9('0x32')]};return db['JscriptyProject']['count'](_0x2c8587)['then'](function(_0x28d437){_0x3455d5[_0x80d9('0x1a')]=_0x28d437;if(_0x12870e[_0x80d9('0x2b')][_0x80d9('0x38')]){_0x30d56b[_0x80d9('0x39')]=[{'all':!![]}];}return db[_0x80d9('0x27')][_0x80d9('0x3a')](_0x30d56b);})[_0x80d9('0x1e')](function(_0x4fc9e8){_0x3455d5[_0x80d9('0x3b')]=_0x4fc9e8;return _0x3455d5;})[_0x80d9('0x1e')](respondWithFilteredResult(_0x2e405d,_0x30d56b))['catch'](handleError(_0x2e405d,null));};exports[_0x80d9('0x3c')]=function(_0x214b87,_0x2db2a7){var _0x4351a2={'raw':![],'where':{'id':_0x214b87['params']['id']}},_0x3cae58={};_0x3cae58[_0x80d9('0x2a')]=_[_0x80d9('0x2c')](db[_0x80d9('0x27')]['rawAttributes']);_0x3cae58[_0x80d9('0x2b')]=_['keys'](_0x214b87[_0x80d9('0x2b')]);_0x3cae58[_0x80d9('0x33')]=_[_0x80d9('0x2d')](_0x3cae58[_0x80d9('0x2a')],_0x3cae58['query']);_0x4351a2[_0x80d9('0x2f')]=_['intersection'](_0x3cae58[_0x80d9('0x2a')],qs[_0x80d9('0x2e')](_0x214b87[_0x80d9('0x2b')][_0x80d9('0x2e')]));_0x4351a2['attributes']=_0x4351a2[_0x80d9('0x2f')]['length']?_0x4351a2[_0x80d9('0x2f')]:_0x3cae58[_0x80d9('0x2a')];if(_0x214b87['query'][_0x80d9('0x38')]){_0x4351a2[_0x80d9('0x39')]=[{'all':!![]}];}_0x4351a2=_[_0x80d9('0x35')]({},_0x4351a2,_0x214b87[_0x80d9('0x37')]);return db['JscriptyProject'][_0x80d9('0x3d')](_0x4351a2)[_0x80d9('0x1e')](handleEntityNotFound(_0x2db2a7,null))[_0x80d9('0x1e')](respondWithResult(_0x2db2a7,null))[_0x80d9('0x3e')](handleError(_0x2db2a7,null));};exports[_0x80d9('0x3f')]=function(_0x5137b3,_0x4b1777){return db[_0x80d9('0x27')][_0x80d9('0x3f')](_0x5137b3[_0x80d9('0x40')],{})['then'](function(_0x3167b9){var _0x59d282=_0x5137b3['user'][_0x80d9('0x20')]({'plain':!![]});if(!_0x59d282)throw new Error(_0x80d9('0x41'));if(_0x59d282[_0x80d9('0x42')]===_0x80d9('0x43')){var _0x1635fc=_0x3167b9[_0x80d9('0x20')]({'plain':!![]});var _0x488ff5=_0x80d9('0x21');return db[_0x80d9('0x44')][_0x80d9('0x3d')]({'where':{'name':_0x488ff5,'userProfileId':_0x59d282[_0x80d9('0x45')]},'raw':!![]})[_0x80d9('0x1e')](function(_0x2e7a00){if(_0x2e7a00&&_0x2e7a00[_0x80d9('0x46')]===0x0){return db[_0x80d9('0x47')][_0x80d9('0x3f')]({'name':_0x1635fc[_0x80d9('0x23')],'resourceId':_0x1635fc['id'],'type':_0x2e7a00['name'],'sectionId':_0x2e7a00['id']},{})[_0x80d9('0x1e')](function(){return _0x3167b9;});}else{return _0x3167b9;}})[_0x80d9('0x3e')](function(_0x2e3019){logger[_0x80d9('0x22')](_0x80d9('0x48'),_0x2e3019);throw _0x2e3019;});}return _0x3167b9;})[_0x80d9('0x1e')](respondWithResult(_0x4b1777,0xc9))[_0x80d9('0x3e')](handleError(_0x4b1777,null));};exports['clone']=function(_0x5b064c,_0x108e61){var _0x509856={'where':{'id':_0x5b064c[_0x80d9('0x49')]['id']}},_0x33d0c5={};_0x33d0c5['model']=_[_0x80d9('0x2c')](db['JscriptyProject'][_0x80d9('0x4a')]);_0x509856[_0x80d9('0x2f')]=_[_0x80d9('0x2d')](_0x33d0c5[_0x80d9('0x2a')],qs[_0x80d9('0x2e')](_0x5b064c[_0x80d9('0x2b')]['fields']));_0x509856[_0x80d9('0x2f')]=_0x509856[_0x80d9('0x2f')][_0x80d9('0x30')]?_0x509856[_0x80d9('0x2f')]:_0x33d0c5[_0x80d9('0x2a')];if(_0x5b064c[_0x80d9('0x2b')]['includeAll']){_0x509856[_0x80d9('0x39')]=[{'all':!![]}];}_0x509856=_['merge']({},_0x509856,_0x5b064c[_0x80d9('0x37')]);return db['JscriptyProject'][_0x80d9('0x3d')](_0x509856)[_0x80d9('0x1e')](handleEntityNotFound(_0x108e61,null))[_0x80d9('0x1e')](function(_0x33ab60){if(_0x33ab60){var _0x134a88=_0x33ab60['get']({'plain':!![]});_0x134a88=qs[_0x80d9('0x4b')](_0x134a88,['id',_0x80d9('0x4c'),_0x80d9('0x4d')]);_0x5b064c[_0x80d9('0x40')]=_[_0x80d9('0x4b')](_0x5b064c[_0x80d9('0x40')],['id','createdAt',_0x80d9('0x4d')]);return db[_0x80d9('0x27')]['create'](_['merge'](_0x134a88,_0x5b064c[_0x80d9('0x40')]),{'include':_0x5b064c['query'][_0x80d9('0x38')]?[{'all':!![]}]:undefined})[_0x80d9('0x1e')](function(_0x5b55c7){var _0x411814=_0x5b064c[_0x80d9('0x43')][_0x80d9('0x20')]({'plain':!![]});if(!_0x411814)throw new Error(_0x80d9('0x41'));if(_0x411814[_0x80d9('0x42')]===_0x80d9('0x43')){var _0x33c4ff=_0x5b55c7[_0x80d9('0x20')]({'plain':!![]});var _0x1384b9=_0x80d9('0x21');return db[_0x80d9('0x44')][_0x80d9('0x3d')]({'where':{'name':_0x1384b9,'userProfileId':_0x411814[_0x80d9('0x45')]},'raw':!![]})[_0x80d9('0x1e')](function(_0x4668a2){if(_0x4668a2&&_0x4668a2[_0x80d9('0x46')]===0x0){return db[_0x80d9('0x47')][_0x80d9('0x3f')]({'name':_0x33c4ff['name'],'resourceId':_0x33c4ff['id'],'type':_0x4668a2[_0x80d9('0x23')],'sectionId':_0x4668a2['id']},{})[_0x80d9('0x1e')](function(){return _0x5b55c7;});}else{return _0x5b55c7;}})[_0x80d9('0x3e')](function(_0x562b0f){logger[_0x80d9('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x562b0f);throw _0x562b0f;});}return _0x5b55c7;});}})[_0x80d9('0x1e')](respondWithResult(_0x108e61,0xc9))[_0x80d9('0x3e')](handleError(_0x108e61,null));};exports[_0x80d9('0x4e')]=function(_0x2980ee,_0x43e5e6){if(_0x2980ee[_0x80d9('0x40')]['id']){delete _0x2980ee[_0x80d9('0x40')]['id'];}return db['JscriptyProject'][_0x80d9('0x3d')]({'where':{'id':_0x2980ee['params']['id']}})[_0x80d9('0x1e')](handleEntityNotFound(_0x43e5e6,null))[_0x80d9('0x1e')](saveUpdates(_0x2980ee[_0x80d9('0x40')],null))[_0x80d9('0x1e')](respondWithResult(_0x43e5e6,null))[_0x80d9('0x3e')](handleError(_0x43e5e6,null));};exports['destroy']=function(_0x22fc0c,_0x2467fe){return db[_0x80d9('0x27')]['find']({'where':{'id':_0x22fc0c[_0x80d9('0x49')]['id']}})[_0x80d9('0x1e')](handleEntityNotFound(_0x2467fe,null))['then'](removeEntity(_0x2467fe,null))[_0x80d9('0x3e')](handleError(_0x2467fe,null));};exports['getSessions']=function(_0x392ad6,_0x62b57c,_0x311c16){var _0x2140b1={'raw':!![],'where':{}};var _0x54d70e={};var _0x2cdea5={'count':0x0,'rows':[]};return db[_0x80d9('0x27')][_0x80d9('0x4f')]({'where':{'id':_0x392ad6[_0x80d9('0x49')]['id']}})['then'](handleEntityNotFound(_0x62b57c,null))[_0x80d9('0x1e')](function(_0x52458a){if(_0x52458a){_0x54d70e['model']=_[_0x80d9('0x2c')](db[_0x80d9('0x50')][_0x80d9('0x4a')]);_0x54d70e[_0x80d9('0x2b')]=_[_0x80d9('0x2c')](_0x392ad6[_0x80d9('0x2b')]);_0x54d70e['filters']=_[_0x80d9('0x2d')](_0x54d70e[_0x80d9('0x2a')],_0x54d70e['query']);_0x2140b1[_0x80d9('0x2f')]=_[_0x80d9('0x2d')](_0x54d70e['model'],qs[_0x80d9('0x2e')](_0x392ad6['query'][_0x80d9('0x2e')]));_0x2140b1['attributes']=_0x2140b1[_0x80d9('0x2f')]['length']?_0x2140b1[_0x80d9('0x2f')]:_0x54d70e['model'];if(!_0x392ad6[_0x80d9('0x2b')][_0x80d9('0x51')](_0x80d9('0x31'))){_0x2140b1[_0x80d9('0x19')]=qs[_0x80d9('0x19')](_0x392ad6[_0x80d9('0x2b')][_0x80d9('0x19')]);_0x2140b1[_0x80d9('0x17')]=qs[_0x80d9('0x17')](_0x392ad6[_0x80d9('0x2b')]['offset']);}_0x2140b1[_0x80d9('0x52')]=qs[_0x80d9('0x53')](_0x392ad6[_0x80d9('0x2b')][_0x80d9('0x53')]);_0x2140b1[_0x80d9('0x32')]=qs['filters'](_['pick'](_0x392ad6[_0x80d9('0x2b')],_0x54d70e[_0x80d9('0x33')]));_0x2140b1[_0x80d9('0x32')][_0x80d9('0x54')]=_0x52458a['id'];if(_0x392ad6['query'][_0x80d9('0x34')]){_0x2140b1[_0x80d9('0x32')]=_[_0x80d9('0x35')](_0x2140b1[_0x80d9('0x32')],{'$or':_[_0x80d9('0x26')](_0x2140b1[_0x80d9('0x2f')],function(_0x598ae6){var _0x16291e={};_0x16291e[_0x598ae6]={'$like':'%'+_0x392ad6[_0x80d9('0x2b')][_0x80d9('0x34')]+'%'};return _0x16291e;})});}_0x2140b1=_[_0x80d9('0x35')]({},_0x2140b1,_0x392ad6[_0x80d9('0x37')]);return db[_0x80d9('0x50')][_0x80d9('0x1a')]({'where':_0x2140b1[_0x80d9('0x32')]})[_0x80d9('0x1e')](function(_0x2182f5){_0x2cdea5[_0x80d9('0x1a')]=_0x2182f5;if(_0x392ad6[_0x80d9('0x2b')][_0x80d9('0x38')]){_0x2140b1[_0x80d9('0x39')]=[{'all':!![]}];}return db[_0x80d9('0x50')][_0x80d9('0x3a')](_0x2140b1);})[_0x80d9('0x1e')](function(_0x298166){_0x2cdea5[_0x80d9('0x3b')]=_0x298166;return _0x2cdea5;});}})[_0x80d9('0x1e')](respondWithFilteredResult(_0x62b57c,_0x2140b1))[_0x80d9('0x3e')](handleError(_0x62b57c,null));};exports['getAnswers']=function(_0x474212,_0x381671,_0x350e78){var _0x1599d6={'raw':!![],'where':{}};var _0x5c0359={};var _0x3fd17f={'count':0x0,'rows':[]};return db[_0x80d9('0x27')][_0x80d9('0x4f')]({'where':{'id':_0x474212[_0x80d9('0x49')]['id']}})[_0x80d9('0x1e')](handleEntityNotFound(_0x381671,null))[_0x80d9('0x1e')](function(_0x4fea26){if(_0x4fea26){_0x5c0359[_0x80d9('0x2a')]=_['keys'](db[_0x80d9('0x55')][_0x80d9('0x4a')]);_0x5c0359[_0x80d9('0x2b')]=_['keys'](_0x474212[_0x80d9('0x2b')]);_0x5c0359[_0x80d9('0x33')]=_[_0x80d9('0x2d')](_0x5c0359[_0x80d9('0x2a')],_0x5c0359[_0x80d9('0x2b')]);_0x1599d6[_0x80d9('0x2f')]=_[_0x80d9('0x2d')](_0x5c0359['model'],qs[_0x80d9('0x2e')](_0x474212[_0x80d9('0x2b')]['fields']));_0x1599d6[_0x80d9('0x2f')]=_0x1599d6[_0x80d9('0x2f')]['length']?_0x1599d6['attributes']:_0x5c0359[_0x80d9('0x2a')];if(!_0x474212[_0x80d9('0x2b')][_0x80d9('0x51')](_0x80d9('0x31'))){_0x1599d6[_0x80d9('0x19')]=qs[_0x80d9('0x19')](_0x474212[_0x80d9('0x2b')][_0x80d9('0x19')]);_0x1599d6['offset']=qs['offset'](_0x474212[_0x80d9('0x2b')][_0x80d9('0x17')]);}_0x1599d6[_0x80d9('0x52')]=qs[_0x80d9('0x53')](_0x474212['query'][_0x80d9('0x53')]);_0x1599d6['where']=qs[_0x80d9('0x33')](_[_0x80d9('0x56')](_0x474212[_0x80d9('0x2b')],_0x5c0359['filters']));_0x1599d6['where']['ProjectId']=_0x4fea26['id'];if(_0x474212[_0x80d9('0x2b')][_0x80d9('0x34')]){_0x1599d6[_0x80d9('0x32')]=_[_0x80d9('0x35')](_0x1599d6[_0x80d9('0x32')],{'$or':_[_0x80d9('0x26')](_0x1599d6[_0x80d9('0x2f')],function(_0x16ae8a){var _0x3ad1b2={};_0x3ad1b2[_0x16ae8a]={'$like':'%'+_0x474212['query']['filter']+'%'};return _0x3ad1b2;})});}_0x1599d6=_[_0x80d9('0x35')]({},_0x1599d6,_0x474212[_0x80d9('0x37')]);return db[_0x80d9('0x55')][_0x80d9('0x1a')]({'where':_0x1599d6['where']})[_0x80d9('0x1e')](function(_0x1222ba){_0x3fd17f[_0x80d9('0x1a')]=_0x1222ba;if(_0x474212[_0x80d9('0x2b')]['includeAll']){_0x1599d6[_0x80d9('0x39')]=[{'all':!![]}];}return db[_0x80d9('0x55')][_0x80d9('0x3a')](_0x1599d6);})[_0x80d9('0x1e')](function(_0x3b227f){_0x3fd17f[_0x80d9('0x3b')]=_0x3b227f;return _0x3fd17f;});}})[_0x80d9('0x1e')](respondWithFilteredResult(_0x381671,_0x1599d6))[_0x80d9('0x3e')](handleError(_0x381671,null));};function char(_0x6b5afd){return _0x80d9('0x57')===typeof _0x6b5afd?String[_0x80d9('0x58')][_0x80d9('0x1b')](null,arguments):_0x6b5afd;}function needsEncapsulation(_0x1e4428){return!!_0x1e4428&&(_0x1e4428[_0x80d9('0x59')]()[_0x80d9('0x5a')](char(0xd))>=0x0||_0x1e4428[_0x80d9('0x59')]()[_0x80d9('0x5a')](char(0xa))>=0x0||_0x1e4428[_0x80d9('0x59')]()['indexOf'](char(0x2c))>=0x0||_0x1e4428[_0x80d9('0x59')]()[_0x80d9('0x5a')](char(0x22))>=0x0);}function encapsulate(_0x28d743){var _0x387289=char(0x22),_0x522bb3='\x5c'+char(0x22),_0x19e6c0=_0x28d743[_0x80d9('0x59')]()['replace'](new RegExp(_0x387289,'g'),_0x522bb3);return _0x387289+_0x19e6c0+_0x387289;}exports['getSummary']=function(_0x1784bf,_0x5d7ab5,_0x1ea462){var _0x18dc3a,_0x1c0506;var _0x4a1503={'where':{'ProjectId':_0x1784bf[_0x80d9('0x49')]['id']}};if(_0x1784bf[_0x80d9('0x2b')][_0x80d9('0x5b')]){_0x4a1503[_0x80d9('0x32')][_0x80d9('0x5c')]=JSON['parse'](_0x1784bf[_0x80d9('0x2b')][_0x80d9('0x5b')]);}return db[_0x80d9('0x50')][_0x80d9('0x3a')](_0x4a1503)['then'](handleEntityNotFound(_0x5d7ab5,null))['then'](function(_0x3b440e){if(_0x3b440e){_0x18dc3a=_0x3b440e;return db[_0x80d9('0x5d')][_0x80d9('0x3a')]({'where':{'SessionId':{'$in':_[_0x80d9('0x26')](_0x18dc3a,'id')},'ProjectId':_0x1784bf[_0x80d9('0x49')]['id']},'order':'-createdAt'});}})[_0x80d9('0x1e')](handleEntityNotFound(_0x5d7ab5,null))[_0x80d9('0x1e')](function(_0x2ec050){if(_0x2ec050){_0x1c0506=_0x2ec050;var _0x3f9ab7={};for(var _0x39e3fc=0x0,_0xaa9518=_0x1c0506[_0x80d9('0x30')];_0x39e3fc<_0xaa9518;_0x39e3fc++){if(!_0x3f9ab7[_0x80d9('0x51')](_0x1c0506[_0x39e3fc]['questionId'])){_0x3f9ab7[_0x1c0506[_0x39e3fc][_0x80d9('0x5e')]]=needsEncapsulation(_0x1c0506[_0x39e3fc][_0x80d9('0x5f')])?encapsulate(_0x1c0506[_0x39e3fc]['question']):_0x1c0506[_0x39e3fc][_0x80d9('0x5f')];}}var _0x42cc64=[],_0x39de79={};for(var _0x4f19d7=0x0,_0x5443b8=_0x18dc3a[_0x80d9('0x30')];_0x4f19d7<_0x5443b8;_0x4f19d7++){_0x39de79={'ProjectId':_0x1784bf['params']['id'],'SessionId':_0x18dc3a[_0x4f19d7]['id'],'StartTime':moment(_0x18dc3a[_0x4f19d7]['starttime'])[_0x80d9('0x60')](_0x80d9('0x61'))};for(var _0x27bcec=0x0,_0x49b11d=_0x1c0506[_0x80d9('0x30')];_0x27bcec<_0x49b11d;_0x27bcec++){if(_0x1c0506[_0x27bcec][_0x80d9('0x62')]==_0x18dc3a[_0x4f19d7]['id']&&_0x3f9ab7['hasOwnProperty'](_0x1c0506[_0x27bcec][_0x80d9('0x5e')])){_0x39de79[_0x3f9ab7[_0x1c0506[_0x27bcec][_0x80d9('0x5e')]]]=_0x1c0506[_0x27bcec][_0x80d9('0x63')];}}for(var _0x356682 in _0x3f9ab7){if(!_0x39de79[_0x80d9('0x51')](_0x3f9ab7[_0x356682])){_0x39de79[_0x3f9ab7[_0x356682]]=null;}}_0x42cc64[_0x80d9('0x64')](_0x39de79);}return _0x42cc64;}})['then'](function(_0x1e3c72){if(!_[_0x80d9('0x65')](_0x1e3c72)){var _0x3357bc=toCsv(_0x1e3c72);var _0x597fbd=Date[_0x80d9('0x66')]();fs[_0x80d9('0x67')](util[_0x80d9('0x60')](_0x80d9('0x68'),_0x1784bf[_0x80d9('0x49')]['id'],_0x597fbd),_0x3357bc);_0x5d7ab5[_0x80d9('0x69')]('Content-disposition',_0x80d9('0x6a')+util[_0x80d9('0x60')](_0x80d9('0x6b'),_0x1784bf[_0x80d9('0x49')]['id'],_0x597fbd));_0x5d7ab5['setHeader'](_0x80d9('0x6c'),'text/csv');return _0x5d7ab5[_0x80d9('0x6d')](util[_0x80d9('0x60')](_0x80d9('0x68'),_0x1784bf[_0x80d9('0x49')]['id'],_0x597fbd));}else{return _0x5d7ab5[_0x80d9('0x13')](0xcc);}})[_0x80d9('0x3e')](handleError(_0x5d7ab5,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index eea7cd7..f6297ea 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 _0xeb79=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','jscripty_projects'];(function(_0x524221,_0x198104){var _0x2310f7=function(_0x3cd95d){while(--_0x3cd95d){_0x524221['push'](_0x524221['shift']());}};_0x2310f7(++_0x198104);}(_0xeb79,0x87));var _0x9eb7=function(_0x2517e0,_0x1ab572){_0x2517e0=_0x2517e0-0x0;var _0x3b430b=_0xeb79[_0x2517e0];return _0x3b430b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9eb7('0x0'))('api');var moment=require(_0x9eb7('0x1'));var BPromise=require('bluebird');var rp=require(_0x9eb7('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9eb7('0x3'));var config=require(_0x9eb7('0x4'));var attributes=require(_0x9eb7('0x5'));module[_0x9eb7('0x6')]=function(_0x58bc03,_0x501d0c){return _0x58bc03[_0x9eb7('0x7')]('JscriptyProject',attributes,{'tableName':_0x9eb7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1b94=['exports','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./jscriptyProject.attributes'];(function(_0x8ecb36,_0x367464){var _0x5a9fc6=function(_0x14ecf1){while(--_0x14ecf1){_0x8ecb36['push'](_0x8ecb36['shift']());}};_0x5a9fc6(++_0x367464);}(_0x1b94,0x1f2));var _0x41b9=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x1b94[_0x88cd7b];return _0x56fcc8;};'use strict';var _=require(_0x41b9('0x0'));var util=require(_0x41b9('0x1'));var logger=require(_0x41b9('0x2'))(_0x41b9('0x3'));var moment=require(_0x41b9('0x4'));var BPromise=require('bluebird');var rp=require(_0x41b9('0x5'));var fs=require('fs');var path=require(_0x41b9('0x6'));var rimraf=require(_0x41b9('0x7'));var config=require('../../config/environment');var attributes=require(_0x41b9('0x8'));module[_0x41b9('0x9')]=function(_0x368c00,_0x5e58d8){return _0x368c00[_0x41b9('0xa')](_0x41b9('0xb'),attributes,{'tableName':_0x41b9('0xc'),'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 841f298..b6c9cfd 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 _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s'];(function(_0x488b05,_0x2d3ef8){var _0x29b171=function(_0xb753dc){while(--_0xb753dc){_0x488b05['push'](_0x488b05['shift']());}};_0x29b171(++_0x2d3ef8);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2543d6,_0x3a5e78){_0x2543d6=_0x2543d6-0x0;var _0x55213c=_0xcb91[_0x2543d6];return _0x55213c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file +var _0xa9e0=['http','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\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(_0x7e87d7,_0x317e6a){var _0x1e2be3=function(_0x36877c){while(--_0x36877c){_0x7e87d7['push'](_0x7e87d7['shift']());}};_0x1e2be3(++_0x317e6a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 311e275..e4c56ee 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 _0xcf94=['destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete'];(function(_0x27df4b,_0x4253de){var _0x258ef4=function(_0x4b7a97){while(--_0x4b7a97){_0x27df4b['push'](_0x27df4b['shift']());}};_0x258ef4(++_0x4253de);}(_0xcf94,0x113));var _0x4cf9=function(_0x754728,_0x4c54ab){_0x754728=_0x754728-0x0;var _0x13d2dc=_0xcf94[_0x754728];return _0x13d2dc;};'use strict';var multer=require(_0x4cf9('0x0'));var util=require(_0x4cf9('0x1'));var path=require('path');var timeout=require(_0x4cf9('0x2'));var express=require(_0x4cf9('0x3'));var router=express['Router']();var fs_extra=require(_0x4cf9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4cf9('0x5'));var config=require(_0x4cf9('0x6'));var controller=require(_0x4cf9('0x7'));router['get']('/',auth[_0x4cf9('0x8')](),controller[_0x4cf9('0x9')]);router['get'](_0x4cf9('0xa'),auth[_0x4cf9('0x8')](),controller[_0x4cf9('0xb')]);router['get'](_0x4cf9('0xc'),auth[_0x4cf9('0x8')](),controller[_0x4cf9('0xd')]);router[_0x4cf9('0xe')]('/',auth['isAuthenticated'](),controller[_0x4cf9('0xf')]);router[_0x4cf9('0x10')](_0x4cf9('0xc'),auth[_0x4cf9('0x8')](),controller[_0x4cf9('0x11')]);router[_0x4cf9('0x12')](_0x4cf9('0xc'),auth[_0x4cf9('0x8')](),controller[_0x4cf9('0x13')]);module[_0x4cf9('0x14')]=router; \ No newline at end of file +var _0x1592=['describe','/:id','show','post','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','index','get','/describe','isAuthenticated'];(function(_0x411a89,_0x3b47c9){var _0x425d49=function(_0xf8c03b){while(--_0xf8c03b){_0x411a89['push'](_0x411a89['shift']());}};_0x425d49(++_0x3b47c9);}(_0x1592,0x152));var _0x2159=function(_0x4a91d5,_0x4226e1){_0x4a91d5=_0x4a91d5-0x0;var _0x4fb827=_0x1592[_0x4a91d5];return _0x4fb827;};'use strict';var multer=require(_0x2159('0x0'));var util=require(_0x2159('0x1'));var path=require(_0x2159('0x2'));var timeout=require(_0x2159('0x3'));var express=require(_0x2159('0x4'));var router=express[_0x2159('0x5')]();var fs_extra=require(_0x2159('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x2159('0x7'));var config=require(_0x2159('0x8'));var controller=require(_0x2159('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x2159('0xa')]);router[_0x2159('0xb')](_0x2159('0xc'),auth[_0x2159('0xd')](),controller[_0x2159('0xe')]);router['get'](_0x2159('0xf'),auth[_0x2159('0xd')](),controller[_0x2159('0x10')]);router[_0x2159('0x11')]('/',auth['isAuthenticated'](),controller[_0x2159('0x12')]);router['put'](_0x2159('0xf'),auth[_0x2159('0xd')](),controller[_0x2159('0x13')]);router[_0x2159('0x14')](_0x2159('0xf'),auth[_0x2159('0xd')](),controller[_0x2159('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 692bff9..02765dd 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(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x7a54,0x106));var _0x47a5=function(_0xf4d9f0,_0x29de01){_0xf4d9f0=_0xf4d9f0-0x0;var _0x1bde9e=_0x7a54[_0xf4d9f0];return _0x1bde9e;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x7a54,0x106));var _0x47a5=function(_0x4d49cc,_0x33e738){_0x4d49cc=_0x4d49cc-0x0;var _0x3c96f4=_0x7a54[_0x4d49cc];return _0x3c96f4;};'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 b32fec4..c28f6c6 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 _0x3aaa=['fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','type','VIRTUAL','merge','options','includeAll','include','show','params','find','catch','create','body','describe','rimraf','fast-json-patch','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/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','JscriptyQuestionReport'];(function(_0x449b81,_0x4b2a6f){var _0xb9b60c=function(_0x2e9e0a){while(--_0x2e9e0a){_0x449b81['push'](_0x449b81['shift']());}};_0xb9b60c(++_0x4b2a6f);}(_0x3aaa,0xa4));var _0xa3aa=function(_0x3919c4,_0x5c13c2){_0x3919c4=_0x3919c4-0x0;var _0x31323f=_0x3aaa[_0x3919c4];return _0x31323f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa3aa('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa3aa('0x1'));var rp=require(_0xa3aa('0x2'));var moment=require(_0xa3aa('0x3'));var BPromise=require(_0xa3aa('0x4'));var Mustache=require('mustache');var util=require(_0xa3aa('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xa3aa('0x6'));var ejs=require(_0xa3aa('0x7'));var fs=require('fs');var fs_extra=require(_0xa3aa('0x8'));var _=require(_0xa3aa('0x9'));var squel=require(_0xa3aa('0xa'));var crypto=require(_0xa3aa('0xb'));var jsforce=require(_0xa3aa('0xc'));var deskjs=require(_0xa3aa('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa3aa('0xe'));var Papa=require(_0xa3aa('0xf'));var Redis=require(_0xa3aa('0x10'));var authService=require(_0xa3aa('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa3aa('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa3aa('0x13'))(_0xa3aa('0x14'));var utils=require('../../config/utils');var config=require(_0xa3aa('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1162a1,_0x3fb977){_0x3fb977=_0x3fb977||0xcc;return function(_0x5b1b83){if(_0x5b1b83){return _0x1162a1[_0xa3aa('0x16')](_0x3fb977);}return _0x1162a1[_0xa3aa('0x17')](_0x3fb977)[_0xa3aa('0x18')]();};}function respondWithResult(_0x15b6e2,_0x4a9078){_0x4a9078=_0x4a9078||0xc8;return function(_0x5cb44a){if(_0x5cb44a){return _0x15b6e2[_0xa3aa('0x17')](_0x4a9078)[_0xa3aa('0x19')](_0x5cb44a);}};}function respondWithFilteredResult(_0x4e8c37,_0x16a487){return function(_0x18339c){if(_0x18339c){var _0x310e61=typeof _0x16a487[_0xa3aa('0x1a')]===_0xa3aa('0x1b')&&typeof _0x16a487[_0xa3aa('0x1c')]===_0xa3aa('0x1b');var _0x1dde83=_0x18339c[_0xa3aa('0x1d')];var _0x181eb7=_0x310e61?0x0:_0x16a487[_0xa3aa('0x1a')];var _0x38b74a=_0x310e61?_0x18339c[_0xa3aa('0x1d')]:_0x16a487['offset']+_0x16a487[_0xa3aa('0x1c')];var _0x3c8308;if(_0x38b74a>=_0x1dde83){_0x38b74a=_0x1dde83;_0x3c8308=0xc8;}else{_0x3c8308=0xce;}_0x4e8c37[_0xa3aa('0x17')](_0x3c8308);return _0x4e8c37[_0xa3aa('0x1e')](_0xa3aa('0x1f'),_0x181eb7+'-'+_0x38b74a+'/'+_0x1dde83)['json'](_0x18339c);}return null;};}function patchUpdates(_0x22ceb2){return function(_0x1ce6c1){try{jsonpatch[_0xa3aa('0x20')](_0x1ce6c1,_0x22ceb2,!![]);}catch(_0x4eaac2){return BPromise[_0xa3aa('0x21')](_0x4eaac2);}return _0x1ce6c1[_0xa3aa('0x22')]();};}function saveUpdates(_0x23f75a,_0x31c020){return function(_0x53c44a){if(_0x53c44a){return _0x53c44a[_0xa3aa('0x23')](_0x23f75a)[_0xa3aa('0x24')](function(_0x59a573){return _0x59a573;});}return null;};}function removeEntity(_0x379cb8,_0x29488f){return function(_0x1b6105){if(_0x1b6105){return _0x1b6105[_0xa3aa('0x25')]()[_0xa3aa('0x24')](function(){_0x379cb8[_0xa3aa('0x17')](0xcc)[_0xa3aa('0x18')]();});}};}function handleEntityNotFound(_0x5c438a,_0x20f94f){return function(_0x52db98){if(!_0x52db98){_0x5c438a[_0xa3aa('0x16')](0x194);}return _0x52db98;};}function handleError(_0x4ca6c3,_0xcf2c07){_0xcf2c07=_0xcf2c07||0x1f4;return function(_0x577dda){logger['error'](_0x577dda['stack']);if(_0x577dda[_0xa3aa('0x26')]){delete _0x577dda[_0xa3aa('0x26')];}_0x4ca6c3[_0xa3aa('0x17')](_0xcf2c07)[_0xa3aa('0x27')](_0x577dda);};}exports[_0xa3aa('0x28')]=function(_0x1e1b0c,_0x1ccfe6){var _0x27ea81={},_0x4e210c={},_0x464199={'count':0x0,'rows':[]};var _0x547209=_[_0xa3aa('0x29')](db[_0xa3aa('0x2a')]['rawAttributes'],function(_0x3ca1f5){return{'name':_0x3ca1f5[_0xa3aa('0x2b')],'type':_0x3ca1f5['type']['key']};});_0x4e210c['model']=_['map'](_0x547209,_0xa3aa('0x26'));_0x4e210c[_0xa3aa('0x2c')]=_[_0xa3aa('0x2d')](_0x1e1b0c[_0xa3aa('0x2c')]);_0x4e210c[_0xa3aa('0x2e')]=_[_0xa3aa('0x2f')](_0x4e210c[_0xa3aa('0x30')],_0x4e210c[_0xa3aa('0x2c')]);_0x27ea81[_0xa3aa('0x31')]=_[_0xa3aa('0x2f')](_0x4e210c[_0xa3aa('0x30')],qs[_0xa3aa('0x32')](_0x1e1b0c['query'][_0xa3aa('0x32')]));_0x27ea81[_0xa3aa('0x31')]=_0x27ea81[_0xa3aa('0x31')][_0xa3aa('0x33')]?_0x27ea81['attributes']:_0x4e210c[_0xa3aa('0x30')];if(!_0x1e1b0c['query'][_0xa3aa('0x34')]('nolimit')){_0x27ea81[_0xa3aa('0x1c')]=qs[_0xa3aa('0x1c')](_0x1e1b0c['query'][_0xa3aa('0x1c')]);_0x27ea81[_0xa3aa('0x1a')]=qs[_0xa3aa('0x1a')](_0x1e1b0c[_0xa3aa('0x2c')][_0xa3aa('0x1a')]);}_0x27ea81[_0xa3aa('0x35')]=qs[_0xa3aa('0x36')](_0x1e1b0c[_0xa3aa('0x2c')][_0xa3aa('0x36')]);_0x27ea81['where']=qs[_0xa3aa('0x2e')](_['pick'](_0x1e1b0c[_0xa3aa('0x2c')],_0x4e210c[_0xa3aa('0x2e')]),_0x547209);if(_0x1e1b0c[_0xa3aa('0x2c')]['filter']){_0x27ea81[_0xa3aa('0x37')]=_['merge'](_0x27ea81[_0xa3aa('0x37')],{'$or':_[_0xa3aa('0x29')](_0x547209,function(_0x556883){if(_0x556883[_0xa3aa('0x38')]!==_0xa3aa('0x39')){var _0x2a0233={};_0x2a0233[_0x556883[_0xa3aa('0x26')]]={'$like':'%'+_0x1e1b0c[_0xa3aa('0x2c')]['filter']+'%'};return _0x2a0233;}})});}_0x27ea81=_[_0xa3aa('0x3a')]({},_0x27ea81,_0x1e1b0c[_0xa3aa('0x3b')]);var _0x5f0a01={'where':_0x27ea81[_0xa3aa('0x37')]};return db[_0xa3aa('0x2a')][_0xa3aa('0x1d')](_0x5f0a01)[_0xa3aa('0x24')](function(_0x4cc243){_0x464199['count']=_0x4cc243;if(_0x1e1b0c[_0xa3aa('0x2c')][_0xa3aa('0x3c')]){_0x27ea81[_0xa3aa('0x3d')]=[{'all':!![]}];}return db[_0xa3aa('0x2a')]['findAll'](_0x27ea81);})[_0xa3aa('0x24')](function(_0x2041c7){_0x464199['rows']=_0x2041c7;return _0x464199;})['then'](respondWithFilteredResult(_0x1ccfe6,_0x27ea81))['catch'](handleError(_0x1ccfe6,null));};exports[_0xa3aa('0x3e')]=function(_0x15129b,_0x52ebc1){var _0x2b31fc={'raw':!![],'where':{'id':_0x15129b[_0xa3aa('0x3f')]['id']}},_0x72302e={};_0x72302e[_0xa3aa('0x30')]=_[_0xa3aa('0x2d')](db['JscriptyQuestionReport']['rawAttributes']);_0x72302e[_0xa3aa('0x2c')]=_[_0xa3aa('0x2d')](_0x15129b[_0xa3aa('0x2c')]);_0x72302e[_0xa3aa('0x2e')]=_[_0xa3aa('0x2f')](_0x72302e['model'],_0x72302e[_0xa3aa('0x2c')]);_0x2b31fc[_0xa3aa('0x31')]=_['intersection'](_0x72302e['model'],qs[_0xa3aa('0x32')](_0x15129b[_0xa3aa('0x2c')]['fields']));_0x2b31fc['attributes']=_0x2b31fc[_0xa3aa('0x31')][_0xa3aa('0x33')]?_0x2b31fc[_0xa3aa('0x31')]:_0x72302e['model'];if(_0x15129b[_0xa3aa('0x2c')][_0xa3aa('0x3c')]){_0x2b31fc[_0xa3aa('0x3d')]=[{'all':!![]}];}_0x2b31fc=_['merge']({},_0x2b31fc,_0x15129b[_0xa3aa('0x3b')]);return db[_0xa3aa('0x2a')][_0xa3aa('0x40')](_0x2b31fc)['then'](handleEntityNotFound(_0x52ebc1,null))[_0xa3aa('0x24')](respondWithResult(_0x52ebc1,null))[_0xa3aa('0x41')](handleError(_0x52ebc1,null));};exports[_0xa3aa('0x42')]=function(_0x2b218a,_0x12f1ed){return db[_0xa3aa('0x2a')][_0xa3aa('0x42')](_0x2b218a[_0xa3aa('0x43')],{})[_0xa3aa('0x24')](respondWithResult(_0x12f1ed,0xc9))[_0xa3aa('0x41')](handleError(_0x12f1ed,null));};exports[_0xa3aa('0x23')]=function(_0x229b22,_0x52ae8a){if(_0x229b22[_0xa3aa('0x43')]['id']){delete _0x229b22['body']['id'];}return db[_0xa3aa('0x2a')][_0xa3aa('0x40')]({'where':{'id':_0x229b22[_0xa3aa('0x3f')]['id']}})[_0xa3aa('0x24')](handleEntityNotFound(_0x52ae8a,null))[_0xa3aa('0x24')](saveUpdates(_0x229b22[_0xa3aa('0x43')],null))['then'](respondWithResult(_0x52ae8a,null))[_0xa3aa('0x41')](handleError(_0x52ae8a,null));};exports[_0xa3aa('0x25')]=function(_0x33fb16,_0x4f1079){return db['JscriptyQuestionReport'][_0xa3aa('0x40')]({'where':{'id':_0x33fb16['params']['id']}})[_0xa3aa('0x24')](handleEntityNotFound(_0x4f1079,null))['then'](removeEntity(_0x4f1079,null))[_0xa3aa('0x41')](handleError(_0x4f1079,null));};exports[_0xa3aa('0x44')]=function(_0x3b15f8,_0x53d122){return db[_0xa3aa('0x2a')][_0xa3aa('0x44')]()['then'](respondWithResult(_0x53d122,null))[_0xa3aa('0x41')](handleError(_0x53d122,null));}; \ No newline at end of file +var _0xdfdf=['set','Content-Range','reject','save','then','destroy','end','error','stack','name','index','map','JscriptyQuestionReport','rawAttributes','fieldName','key','model','filters','intersection','query','attributes','fields','length','nolimit','order','where','merge','type','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','keys','find','create','body','update','catch','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','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','json','offset','undefined','limit','count'];(function(_0x18afca,_0x4219d9){var _0x11603f=function(_0x21d5d1){while(--_0x21d5d1){_0x18afca['push'](_0x18afca['shift']());}};_0x11603f(++_0x4219d9);}(_0xdfdf,0x106));var _0xfdfd=function(_0x1b840b,_0x55c5cc){_0x1b840b=_0x1b840b-0x0;var _0x110ea0=_0xdfdf[_0x1b840b];return _0x110ea0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfdfd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfdfd('0x1'));var rp=require(_0xfdfd('0x2'));var moment=require(_0xfdfd('0x3'));var BPromise=require(_0xfdfd('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xfdfd('0x5'));var sox=require(_0xfdfd('0x6'));var csv=require('to-csv');var ejs=require(_0xfdfd('0x7'));var fs=require('fs');var fs_extra=require(_0xfdfd('0x8'));var _=require(_0xfdfd('0x9'));var squel=require(_0xfdfd('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfdfd('0xb'));var toCsv=require('to-csv');var querystring=require(_0xfdfd('0xc'));var Papa=require(_0xfdfd('0xd'));var Redis=require(_0xfdfd('0xe'));var authService=require(_0xfdfd('0xf'));var qs=require(_0xfdfd('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfdfd('0x11'));var logger=require(_0xfdfd('0x12'))('api');var utils=require(_0xfdfd('0x13'));var config=require(_0xfdfd('0x14'));var licenseUtil=require(_0xfdfd('0x15'));var db=require(_0xfdfd('0x16'))['db'];function respondWithStatusCode(_0xf2be21,_0x275593){_0x275593=_0x275593||0xcc;return function(_0x1aa0d4){if(_0x1aa0d4){return _0xf2be21[_0xfdfd('0x17')](_0x275593);}return _0xf2be21[_0xfdfd('0x18')](_0x275593)['end']();};}function respondWithResult(_0x58d9cc,_0x2afb14){_0x2afb14=_0x2afb14||0xc8;return function(_0x1f462f){if(_0x1f462f){return _0x58d9cc[_0xfdfd('0x18')](_0x2afb14)[_0xfdfd('0x19')](_0x1f462f);}};}function respondWithFilteredResult(_0x4fdf40,_0x2c4ce2){return function(_0x50eb2d){if(_0x50eb2d){var _0x433c0d=typeof _0x2c4ce2[_0xfdfd('0x1a')]===_0xfdfd('0x1b')&&typeof _0x2c4ce2[_0xfdfd('0x1c')]===_0xfdfd('0x1b');var _0x25c11b=_0x50eb2d[_0xfdfd('0x1d')];var _0x46cfa5=_0x433c0d?0x0:_0x2c4ce2[_0xfdfd('0x1a')];var _0x49e8d7=_0x433c0d?_0x50eb2d['count']:_0x2c4ce2[_0xfdfd('0x1a')]+_0x2c4ce2[_0xfdfd('0x1c')];var _0xd8d425;if(_0x49e8d7>=_0x25c11b){_0x49e8d7=_0x25c11b;_0xd8d425=0xc8;}else{_0xd8d425=0xce;}_0x4fdf40[_0xfdfd('0x18')](_0xd8d425);return _0x4fdf40[_0xfdfd('0x1e')](_0xfdfd('0x1f'),_0x46cfa5+'-'+_0x49e8d7+'/'+_0x25c11b)[_0xfdfd('0x19')](_0x50eb2d);}return null;};}function patchUpdates(_0x308abb){return function(_0x4f91b3){try{jsonpatch['apply'](_0x4f91b3,_0x308abb,!![]);}catch(_0x47abe8){return BPromise[_0xfdfd('0x20')](_0x47abe8);}return _0x4f91b3[_0xfdfd('0x21')]();};}function saveUpdates(_0x2a814f,_0x58dea7){return function(_0x10e2e5){if(_0x10e2e5){return _0x10e2e5['update'](_0x2a814f)[_0xfdfd('0x22')](function(_0x14fb97){return _0x14fb97;});}return null;};}function removeEntity(_0x4ca157,_0x2ad613){return function(_0x26ec58){if(_0x26ec58){return _0x26ec58[_0xfdfd('0x23')]()[_0xfdfd('0x22')](function(){_0x4ca157['status'](0xcc)[_0xfdfd('0x24')]();});}};}function handleEntityNotFound(_0x323b83,_0x5e9e76){return function(_0x1eec48){if(!_0x1eec48){_0x323b83['sendStatus'](0x194);}return _0x1eec48;};}function handleError(_0x560177,_0x41443c){_0x41443c=_0x41443c||0x1f4;return function(_0x25926d){logger[_0xfdfd('0x25')](_0x25926d[_0xfdfd('0x26')]);if(_0x25926d['name']){delete _0x25926d[_0xfdfd('0x27')];}_0x560177[_0xfdfd('0x18')](_0x41443c)['send'](_0x25926d);};}exports[_0xfdfd('0x28')]=function(_0xa54a6a,_0x15ed50){var _0x4a3cc2={},_0x537f6c={},_0x1af0de={'count':0x0,'rows':[]};var _0x5132c5=_[_0xfdfd('0x29')](db[_0xfdfd('0x2a')][_0xfdfd('0x2b')],function(_0x4d409a){return{'name':_0x4d409a[_0xfdfd('0x2c')],'type':_0x4d409a['type'][_0xfdfd('0x2d')]};});_0x537f6c[_0xfdfd('0x2e')]=_[_0xfdfd('0x29')](_0x5132c5,_0xfdfd('0x27'));_0x537f6c['query']=_['keys'](_0xa54a6a['query']);_0x537f6c[_0xfdfd('0x2f')]=_[_0xfdfd('0x30')](_0x537f6c[_0xfdfd('0x2e')],_0x537f6c[_0xfdfd('0x31')]);_0x4a3cc2[_0xfdfd('0x32')]=_['intersection'](_0x537f6c[_0xfdfd('0x2e')],qs['fields'](_0xa54a6a[_0xfdfd('0x31')][_0xfdfd('0x33')]));_0x4a3cc2[_0xfdfd('0x32')]=_0x4a3cc2[_0xfdfd('0x32')][_0xfdfd('0x34')]?_0x4a3cc2['attributes']:_0x537f6c[_0xfdfd('0x2e')];if(!_0xa54a6a[_0xfdfd('0x31')]['hasOwnProperty'](_0xfdfd('0x35'))){_0x4a3cc2['limit']=qs[_0xfdfd('0x1c')](_0xa54a6a['query'][_0xfdfd('0x1c')]);_0x4a3cc2[_0xfdfd('0x1a')]=qs[_0xfdfd('0x1a')](_0xa54a6a[_0xfdfd('0x31')][_0xfdfd('0x1a')]);}_0x4a3cc2[_0xfdfd('0x36')]=qs['sort'](_0xa54a6a[_0xfdfd('0x31')]['sort']);_0x4a3cc2['where']=qs[_0xfdfd('0x2f')](_['pick'](_0xa54a6a['query'],_0x537f6c[_0xfdfd('0x2f')]),_0x5132c5);if(_0xa54a6a[_0xfdfd('0x31')]['filter']){_0x4a3cc2[_0xfdfd('0x37')]=_[_0xfdfd('0x38')](_0x4a3cc2['where'],{'$or':_[_0xfdfd('0x29')](_0x5132c5,function(_0x310313){if(_0x310313[_0xfdfd('0x39')]!==_0xfdfd('0x3a')){var _0xfe9482={};_0xfe9482[_0x310313[_0xfdfd('0x27')]]={'$like':'%'+_0xa54a6a['query'][_0xfdfd('0x3b')]+'%'};return _0xfe9482;}})});}_0x4a3cc2=_['merge']({},_0x4a3cc2,_0xa54a6a['options']);var _0x3cfde0={'where':_0x4a3cc2[_0xfdfd('0x37')]};return db[_0xfdfd('0x2a')]['count'](_0x3cfde0)[_0xfdfd('0x22')](function(_0x1c290b){_0x1af0de[_0xfdfd('0x1d')]=_0x1c290b;if(_0xa54a6a['query'][_0xfdfd('0x3c')]){_0x4a3cc2[_0xfdfd('0x3d')]=[{'all':!![]}];}return db[_0xfdfd('0x2a')][_0xfdfd('0x3e')](_0x4a3cc2);})[_0xfdfd('0x22')](function(_0x2e45bb){_0x1af0de[_0xfdfd('0x3f')]=_0x2e45bb;return _0x1af0de;})[_0xfdfd('0x22')](respondWithFilteredResult(_0x15ed50,_0x4a3cc2))['catch'](handleError(_0x15ed50,null));};exports[_0xfdfd('0x40')]=function(_0x762b64,_0x31a154){var _0xbf1f9a={'raw':!![],'where':{'id':_0x762b64[_0xfdfd('0x41')]['id']}},_0x4878aa={};_0x4878aa[_0xfdfd('0x2e')]=_[_0xfdfd('0x42')](db[_0xfdfd('0x2a')][_0xfdfd('0x2b')]);_0x4878aa['query']=_['keys'](_0x762b64[_0xfdfd('0x31')]);_0x4878aa[_0xfdfd('0x2f')]=_[_0xfdfd('0x30')](_0x4878aa[_0xfdfd('0x2e')],_0x4878aa[_0xfdfd('0x31')]);_0xbf1f9a[_0xfdfd('0x32')]=_[_0xfdfd('0x30')](_0x4878aa['model'],qs[_0xfdfd('0x33')](_0x762b64[_0xfdfd('0x31')][_0xfdfd('0x33')]));_0xbf1f9a['attributes']=_0xbf1f9a[_0xfdfd('0x32')][_0xfdfd('0x34')]?_0xbf1f9a[_0xfdfd('0x32')]:_0x4878aa[_0xfdfd('0x2e')];if(_0x762b64[_0xfdfd('0x31')][_0xfdfd('0x3c')]){_0xbf1f9a[_0xfdfd('0x3d')]=[{'all':!![]}];}_0xbf1f9a=_[_0xfdfd('0x38')]({},_0xbf1f9a,_0x762b64['options']);return db['JscriptyQuestionReport'][_0xfdfd('0x43')](_0xbf1f9a)['then'](handleEntityNotFound(_0x31a154,null))[_0xfdfd('0x22')](respondWithResult(_0x31a154,null))['catch'](handleError(_0x31a154,null));};exports[_0xfdfd('0x44')]=function(_0x3c405c,_0x1553f4){return db['JscriptyQuestionReport'][_0xfdfd('0x44')](_0x3c405c[_0xfdfd('0x45')],{})[_0xfdfd('0x22')](respondWithResult(_0x1553f4,0xc9))['catch'](handleError(_0x1553f4,null));};exports[_0xfdfd('0x46')]=function(_0x2b738b,_0x31d09e){if(_0x2b738b[_0xfdfd('0x45')]['id']){delete _0x2b738b['body']['id'];}return db[_0xfdfd('0x2a')][_0xfdfd('0x43')]({'where':{'id':_0x2b738b[_0xfdfd('0x41')]['id']}})[_0xfdfd('0x22')](handleEntityNotFound(_0x31d09e,null))[_0xfdfd('0x22')](saveUpdates(_0x2b738b[_0xfdfd('0x45')],null))[_0xfdfd('0x22')](respondWithResult(_0x31d09e,null))[_0xfdfd('0x47')](handleError(_0x31d09e,null));};exports['destroy']=function(_0x3584b1,_0x3f7668){return db['JscriptyQuestionReport'][_0xfdfd('0x43')]({'where':{'id':_0x3584b1[_0xfdfd('0x41')]['id']}})[_0xfdfd('0x22')](handleEntityNotFound(_0x3f7668,null))[_0xfdfd('0x22')](removeEntity(_0x3f7668,null))['catch'](handleError(_0x3f7668,null));};exports[_0xfdfd('0x48')]=function(_0x165ef0,_0x5f9cc3){return db[_0xfdfd('0x2a')][_0xfdfd('0x48')]()[_0xfdfd('0x22')](respondWithResult(_0x5f9cc3,null))[_0xfdfd('0x47')](handleError(_0x5f9cc3,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 31a5414..f74c9fe 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 _0x7136=['../../config/environment','exports','JscriptyQuestionReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x25d4ab,_0x307164){var _0x3b31f3=function(_0x12f56c){while(--_0x12f56c){_0x25d4ab['push'](_0x25d4ab['shift']());}};_0x3b31f3(++_0x307164);}(_0x7136,0x92));var _0x6713=function(_0x5ec634,_0xa835b9){_0x5ec634=_0x5ec634-0x0;var _0x5b94a9=_0x7136[_0x5ec634];return _0x5b94a9;};'use strict';var _=require(_0x6713('0x0'));var util=require(_0x6713('0x1'));var logger=require(_0x6713('0x2'))(_0x6713('0x3'));var moment=require(_0x6713('0x4'));var BPromise=require(_0x6713('0x5'));var rp=require(_0x6713('0x6'));var fs=require('fs');var path=require(_0x6713('0x7'));var rimraf=require('rimraf');var config=require(_0x6713('0x8'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0x6713('0x9')]=function(_0x1e04fb,_0x3418a5){return _0x1e04fb['define'](_0x6713('0xa'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd770=['moment','bluebird','request-promise','../../config/environment','exports','define','report_jscripty_questions','lodash','util','../../config/logger','api'];(function(_0x3da707,_0x30c36d){var _0x342ee7=function(_0x175135){while(--_0x175135){_0x3da707['push'](_0x3da707['shift']());}};_0x342ee7(++_0x30c36d);}(_0xd770,0xcd));var _0x0d77=function(_0x6bc564,_0x305571){_0x6bc564=_0x6bc564-0x0;var _0x4fb8cd=_0xd770[_0x6bc564];return _0x4fb8cd;};'use strict';var _=require(_0x0d77('0x0'));var util=require(_0x0d77('0x1'));var logger=require(_0x0d77('0x2'))(_0x0d77('0x3'));var moment=require(_0x0d77('0x4'));var BPromise=require(_0x0d77('0x5'));var rp=require(_0x0d77('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0d77('0x7'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0x0d77('0x8')]=function(_0x38ee6f,_0xadfda9){return _0x38ee6f[_0x0d77('0x9')]('JscriptyQuestionReport',attributes,{'tableName':_0x0d77('0xa'),'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 b16c8b1..6b63588 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 _0xc54d=['request','then','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x38d14a,_0x24860f){var _0x34f32a=function(_0x443c5f){while(--_0x443c5f){_0x38d14a['push'](_0x38d14a['shift']());}};_0x34f32a(++_0x24860f);}(_0xc54d,0x164));var _0xdc54=function(_0x54de5d,_0x1f8b26){_0x54de5d=_0x54de5d-0x0;var _0x1b349e=_0xc54d[_0x54de5d];return _0x1b349e;};'use strict';var _=require(_0xdc54('0x0'));var util=require(_0xdc54('0x1'));var moment=require('moment');var BPromise=require(_0xdc54('0x2'));var rs=require(_0xdc54('0x3'));var fs=require('fs');var Redis=require(_0xdc54('0x4'));var db=require(_0xdc54('0x5'))['db'];var utils=require(_0xdc54('0x6'));var logger=require(_0xdc54('0x7'))(_0xdc54('0x8'));var config=require(_0xdc54('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xdc54('0xa')][_0xdc54('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1dbf88,_0x1a7dc3,_0x281b4b){return new BPromise(function(_0x375afe,_0x323e33){return client[_0xdc54('0xc')](_0x1dbf88,_0x281b4b)[_0xdc54('0xd')](function(_0x12c726){logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x1a7dc3,_0xdc54('0xe'));logger[_0xdc54('0xf')](_0xdc54('0x10'),_0x1a7dc3,_0xdc54('0xe'),JSON[_0xdc54('0x11')](_0x12c726));if(_0x12c726[_0xdc54('0x12')]){if(_0x12c726['error'][_0xdc54('0x13')]===0x1f4){logger['error'](_0xdc54('0x14'),_0x1a7dc3,_0x12c726[_0xdc54('0x12')]['message']);return _0x323e33(_0x12c726[_0xdc54('0x12')][_0xdc54('0x15')]);}logger[_0xdc54('0x12')](_0xdc54('0x14'),_0x1a7dc3,_0x12c726[_0xdc54('0x12')][_0xdc54('0x15')]);return _0x375afe(_0x12c726[_0xdc54('0x12')][_0xdc54('0x15')]);}else{logger['info'](_0xdc54('0x14'),_0x1a7dc3,'request\x20sent');_0x375afe(_0x12c726[_0xdc54('0x16')][_0xdc54('0x15')]);}})['catch'](function(_0x2b74ab){logger['error'](_0xdc54('0x14'),_0x1a7dc3,_0x2b74ab);_0x323e33(_0x2b74ab);});});} \ No newline at end of file +var _0x0d0b=['request\x20sent','result','catch','lodash','util','randomstring','../../mysqldb','jayson/promise','client','info','JscriptyQuestionReport,\x20%s,\x20%s','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message'];(function(_0x34a68c,_0x2dc0e1){var _0x351a0f=function(_0x4a84d4){while(--_0x4a84d4){_0x34a68c['push'](_0x34a68c['shift']());}};_0x351a0f(++_0x2dc0e1);}(_0x0d0b,0x179));var _0xb0d0=function(_0x567314,_0x2fe325){_0x567314=_0x567314-0x0;var _0x37b9f9=_0x0d0b[_0x567314];return _0x37b9f9;};'use strict';var _=require(_0xb0d0('0x0'));var util=require(_0xb0d0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb0d0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb0d0('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xb0d0('0x4'));var client=jayson[_0xb0d0('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x516933,_0x52a371,_0x627ca9){return new BPromise(function(_0x46f315,_0x46efc4){return client['request'](_0x516933,_0x627ca9)['then'](function(_0x715714){logger[_0xb0d0('0x6')](_0xb0d0('0x7'),_0x52a371,'request\x20sent');logger[_0xb0d0('0x8')](_0xb0d0('0x9'),_0x52a371,'request\x20sent',JSON[_0xb0d0('0xa')](_0x715714));if(_0x715714['error']){if(_0x715714['error'][_0xb0d0('0xb')]===0x1f4){logger[_0xb0d0('0xc')](_0xb0d0('0x7'),_0x52a371,_0x715714[_0xb0d0('0xc')][_0xb0d0('0xd')]);return _0x46efc4(_0x715714[_0xb0d0('0xc')]['message']);}logger[_0xb0d0('0xc')](_0xb0d0('0x7'),_0x52a371,_0x715714[_0xb0d0('0xc')][_0xb0d0('0xd')]);return _0x46f315(_0x715714[_0xb0d0('0xc')][_0xb0d0('0xd')]);}else{logger[_0xb0d0('0x6')](_0xb0d0('0x7'),_0x52a371,_0xb0d0('0xe'));_0x46f315(_0x715714[_0xb0d0('0xf')][_0xb0d0('0xd')]);}})[_0xb0d0('0x10')](function(_0x3e1397){logger[_0xb0d0('0xc')](_0xb0d0('0x7'),_0x52a371,_0x3e1397);_0x46efc4(_0x3e1397);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index ca2eca9..0b4816b 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 _0x2b2c=['update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/questions','getQuestions','post','create','put','/:id'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x2b2c,0x16c));var _0xc2b2=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x2b2c[_0x11005e];return _0x29338f;};'use strict';var multer=require('multer');var util=require(_0xc2b2('0x0'));var path=require(_0xc2b2('0x1'));var timeout=require(_0xc2b2('0x2'));var express=require(_0xc2b2('0x3'));var router=express[_0xc2b2('0x4')]();var fs_extra=require(_0xc2b2('0x5'));var auth=require(_0xc2b2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc2b2('0x7'));var controller=require('./jscriptySessionReport.controller');router[_0xc2b2('0x8')]('/',auth[_0xc2b2('0x9')](),controller[_0xc2b2('0xa')]);router[_0xc2b2('0x8')](_0xc2b2('0xb'),auth[_0xc2b2('0x9')](),controller[_0xc2b2('0xc')]);router[_0xc2b2('0x8')]('/:id',auth[_0xc2b2('0x9')](),controller[_0xc2b2('0xd')]);router[_0xc2b2('0x8')](_0xc2b2('0xe'),auth[_0xc2b2('0x9')](),controller[_0xc2b2('0xf')]);router[_0xc2b2('0x10')]('/',auth['isAuthenticated'](),controller[_0xc2b2('0x11')]);router[_0xc2b2('0x12')](_0xc2b2('0x13'),auth[_0xc2b2('0x9')](),controller[_0xc2b2('0x14')]);router[_0xc2b2('0x15')]('/:id',auth[_0xc2b2('0x9')](),controller[_0xc2b2('0x16')]);module[_0xc2b2('0x17')]=router; \ No newline at end of file +var _0x7e36=['destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/questions','getQuestions','post','create','put','update','delete'];(function(_0x9f8783,_0x4834f9){var _0x48c7d4=function(_0x1e10da){while(--_0x1e10da){_0x9f8783['push'](_0x9f8783['shift']());}};_0x48c7d4(++_0x4834f9);}(_0x7e36,0x199));var _0x67e3=function(_0x37b1d8,_0x614312){_0x37b1d8=_0x37b1d8-0x0;var _0x3739e7=_0x7e36[_0x37b1d8];return _0x3739e7;};'use strict';var multer=require(_0x67e3('0x0'));var util=require(_0x67e3('0x1'));var path=require(_0x67e3('0x2'));var timeout=require(_0x67e3('0x3'));var express=require('express');var router=express[_0x67e3('0x4')]();var fs_extra=require(_0x67e3('0x5'));var auth=require(_0x67e3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x67e3('0x7'));var controller=require(_0x67e3('0x8'));router[_0x67e3('0x9')]('/',auth[_0x67e3('0xa')](),controller[_0x67e3('0xb')]);router['get'](_0x67e3('0xc'),auth[_0x67e3('0xa')](),controller[_0x67e3('0xd')]);router['get'](_0x67e3('0xe'),auth[_0x67e3('0xa')](),controller[_0x67e3('0xf')]);router[_0x67e3('0x9')](_0x67e3('0x10'),auth[_0x67e3('0xa')](),controller[_0x67e3('0x11')]);router[_0x67e3('0x12')]('/',auth['isAuthenticated'](),controller[_0x67e3('0x13')]);router[_0x67e3('0x14')](_0x67e3('0xe'),auth[_0x67e3('0xa')](),controller[_0x67e3('0x15')]);router[_0x67e3('0x16')](_0x67e3('0xe'),auth[_0x67e3('0xa')](),controller[_0x67e3('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 992c6cb..2af1caa 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 _0xff69=['STRING','moment','sequelize','DATE','setDataValue','starttime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x198446,_0x119c8f){var _0x38d7b7=function(_0x293752){while(--_0x293752){_0x198446['push'](_0x198446['shift']());}};_0x38d7b7(++_0x119c8f);}(_0xff69,0x119));var _0x9ff6=function(_0x44b827,_0x1bb1aa){_0x44b827=_0x44b827-0x0;var _0x527342=_0xff69[_0x44b827];return _0x527342;};'use strict';var moment=require(_0x9ff6('0x0'));var Sequelize=require(_0x9ff6('0x1'));module['exports']={'starttime':{'type':Sequelize[_0x9ff6('0x2')],'set':function(_0x1595c2){this[_0x9ff6('0x3')](_0x9ff6('0x4'),_0x1595c2);this[_0x9ff6('0x3')]('endtime',moment()[_0x9ff6('0x5')](_0x9ff6('0x6')));}},'endtime':{'type':Sequelize[_0x9ff6('0x2')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x9ff6('0x7')]},'queue':{'type':Sequelize[_0x9ff6('0x7')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x9ff6('0x7')]},'calleridnum':{'type':Sequelize[_0x9ff6('0x7')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x65ff=['exports','DATE','starttime','setDataValue','endtime','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize'];(function(_0x349b5c,_0x55e5fa){var _0x3efcac=function(_0x27832d){while(--_0x27832d){_0x349b5c['push'](_0x349b5c['shift']());}};_0x3efcac(++_0x55e5fa);}(_0x65ff,0x1d4));var _0xf65f=function(_0x1d656c,_0x14fba4){_0x1d656c=_0x1d656c-0x0;var _0x4eeb25=_0x65ff[_0x1d656c];return _0x4eeb25;};'use strict';var moment=require(_0xf65f('0x0'));var Sequelize=require(_0xf65f('0x1'));module[_0xf65f('0x2')]={'starttime':{'type':Sequelize[_0xf65f('0x3')],'set':function(_0x114a06){this['setDataValue'](_0xf65f('0x4'),_0x114a06);this[_0xf65f('0x5')](_0xf65f('0x6'),moment()['format'](_0xf65f('0x7')));}},'endtime':{'type':Sequelize[_0xf65f('0x3')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xf65f('0x8')]},'uniqueid':{'type':Sequelize[_0xf65f('0x8')]},'calleridname':{'type':Sequelize[_0xf65f('0x8')]},'calleridnum':{'type':Sequelize[_0xf65f('0x8')]},'completed':{'type':Sequelize[_0xf65f('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index fa796b1..9265f99 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 _0x527b=['keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','count','includeAll','findAll','rows','catch','show','params','include','find','create','body','update','describe','findOne','JscriptyQuestionReport','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','limit','offset','set','Content-Range','apply','reject','save','destroy','then','sendStatus','error','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model'];(function(_0xa599d0,_0xace5b3){var _0x8e728d=function(_0x50384a){while(--_0x50384a){_0xa599d0['push'](_0xa599d0['shift']());}};_0x8e728d(++_0xace5b3);}(_0x527b,0x1a5));var _0xb527=function(_0x47a40b,_0x443ecf){_0x47a40b=_0x47a40b-0x0;var _0x19610c=_0x527b[_0x47a40b];return _0x19610c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb527('0x0'));var jsonpatch=require(_0xb527('0x1'));var rp=require('request-promise');var moment=require(_0xb527('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xb527('0x3'));var util=require(_0xb527('0x4'));var path=require('path');var sox=require(_0xb527('0x5'));var csv=require(_0xb527('0x6'));var ejs=require(_0xb527('0x7'));var fs=require('fs');var fs_extra=require(_0xb527('0x8'));var _=require(_0xb527('0x9'));var squel=require(_0xb527('0xa'));var crypto=require('crypto');var jsforce=require(_0xb527('0xb'));var deskjs=require(_0xb527('0xc'));var toCsv=require(_0xb527('0x6'));var querystring=require(_0xb527('0xd'));var Papa=require('papaparse');var Redis=require(_0xb527('0xe'));var authService=require(_0xb527('0xf'));var qs=require(_0xb527('0x10'));var as=require(_0xb527('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb527('0x12'));var utils=require(_0xb527('0x13'));var config=require(_0xb527('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xb527('0x15'))['db'];function respondWithStatusCode(_0x182996,_0x42c4f2){_0x42c4f2=_0x42c4f2||0xcc;return function(_0x502f48){if(_0x502f48){return _0x182996['sendStatus'](_0x42c4f2);}return _0x182996[_0xb527('0x16')](_0x42c4f2)[_0xb527('0x17')]();};}function respondWithResult(_0x2ed068,_0x53dd84){_0x53dd84=_0x53dd84||0xc8;return function(_0x15835d){if(_0x15835d){return _0x2ed068[_0xb527('0x16')](_0x53dd84)[_0xb527('0x18')](_0x15835d);}};}function respondWithFilteredResult(_0x45a4f4,_0x43a9db){return function(_0x55b93a){if(_0x55b93a){var _0x3d88f4=typeof _0x43a9db['offset']===_0xb527('0x19')&&typeof _0x43a9db[_0xb527('0x1a')]===_0xb527('0x19');var _0x5c9deb=_0x55b93a['count'];var _0xd4af8=_0x3d88f4?0x0:_0x43a9db[_0xb527('0x1b')];var _0x3c07d4=_0x3d88f4?_0x55b93a['count']:_0x43a9db[_0xb527('0x1b')]+_0x43a9db[_0xb527('0x1a')];var _0x5825fa;if(_0x3c07d4>=_0x5c9deb){_0x3c07d4=_0x5c9deb;_0x5825fa=0xc8;}else{_0x5825fa=0xce;}_0x45a4f4['status'](_0x5825fa);return _0x45a4f4[_0xb527('0x1c')](_0xb527('0x1d'),_0xd4af8+'-'+_0x3c07d4+'/'+_0x5c9deb)[_0xb527('0x18')](_0x55b93a);}return null;};}function patchUpdates(_0x197e7c){return function(_0x5be64f){try{jsonpatch[_0xb527('0x1e')](_0x5be64f,_0x197e7c,!![]);}catch(_0xee4925){return BPromise[_0xb527('0x1f')](_0xee4925);}return _0x5be64f[_0xb527('0x20')]();};}function saveUpdates(_0xb16c69,_0x5702bc){return function(_0x2b13e4){if(_0x2b13e4){return _0x2b13e4['update'](_0xb16c69)['then'](function(_0x2fcd2b){return _0x2fcd2b;});}return null;};}function removeEntity(_0x2ae10c,_0x16403b){return function(_0x2bb846){if(_0x2bb846){return _0x2bb846[_0xb527('0x21')]()[_0xb527('0x22')](function(){_0x2ae10c['status'](0xcc)[_0xb527('0x17')]();});}};}function handleEntityNotFound(_0x5a264c,_0x2ad92b){return function(_0x99aa14){if(!_0x99aa14){_0x5a264c[_0xb527('0x23')](0x194);}return _0x99aa14;};}function handleError(_0x4c4aa3,_0x2037b2){_0x2037b2=_0x2037b2||0x1f4;return function(_0x347d60){logger[_0xb527('0x24')](_0x347d60['stack']);if(_0x347d60[_0xb527('0x25')]){delete _0x347d60[_0xb527('0x25')];}_0x4c4aa3[_0xb527('0x16')](_0x2037b2)[_0xb527('0x26')](_0x347d60);};}exports[_0xb527('0x27')]=function(_0x36db02,_0x23c6df){var _0x235906={},_0x38d3b7={},_0x3ee483={'count':0x0,'rows':[]};var _0x49c717=_[_0xb527('0x28')](db[_0xb527('0x29')][_0xb527('0x2a')],function(_0x5c539f){return{'name':_0x5c539f[_0xb527('0x2b')],'type':_0x5c539f[_0xb527('0x2c')][_0xb527('0x2d')]};});_0x38d3b7[_0xb527('0x2e')]=_[_0xb527('0x28')](_0x49c717,_0xb527('0x25'));_0x38d3b7['query']=_[_0xb527('0x2f')](_0x36db02[_0xb527('0x30')]);_0x38d3b7['filters']=_[_0xb527('0x31')](_0x38d3b7[_0xb527('0x2e')],_0x38d3b7[_0xb527('0x30')]);_0x235906['attributes']=_[_0xb527('0x31')](_0x38d3b7[_0xb527('0x2e')],qs[_0xb527('0x32')](_0x36db02['query'][_0xb527('0x32')]));_0x235906[_0xb527('0x33')]=_0x235906[_0xb527('0x33')][_0xb527('0x34')]?_0x235906['attributes']:_0x38d3b7[_0xb527('0x2e')];if(!_0x36db02[_0xb527('0x30')][_0xb527('0x35')](_0xb527('0x36'))){_0x235906['limit']=qs[_0xb527('0x1a')](_0x36db02[_0xb527('0x30')][_0xb527('0x1a')]);_0x235906[_0xb527('0x1b')]=qs[_0xb527('0x1b')](_0x36db02[_0xb527('0x30')][_0xb527('0x1b')]);}_0x235906[_0xb527('0x37')]=qs['sort'](_0x36db02[_0xb527('0x30')][_0xb527('0x38')]);_0x235906[_0xb527('0x39')]=qs[_0xb527('0x3a')](_[_0xb527('0x3b')](_0x36db02[_0xb527('0x30')],_0x38d3b7[_0xb527('0x3a')]),_0x49c717);if(_0x36db02[_0xb527('0x30')][_0xb527('0x3c')]){_0x235906[_0xb527('0x39')]=_[_0xb527('0x3d')](_0x235906[_0xb527('0x39')],{'$or':_['map'](_0x49c717,function(_0x28aa37){if(_0x28aa37[_0xb527('0x2c')]!=='VIRTUAL'){var _0x9d8e8d={};_0x9d8e8d[_0x28aa37[_0xb527('0x25')]]={'$like':'%'+_0x36db02['query'][_0xb527('0x3c')]+'%'};return _0x9d8e8d;}})});}_0x235906=_[_0xb527('0x3d')]({},_0x235906,_0x36db02[_0xb527('0x3e')]);var _0xabe764={'where':_0x235906[_0xb527('0x39')]};return db[_0xb527('0x29')]['count'](_0xabe764)[_0xb527('0x22')](function(_0x1a79d6){_0x3ee483[_0xb527('0x3f')]=_0x1a79d6;if(_0x36db02[_0xb527('0x30')][_0xb527('0x40')]){_0x235906['include']=[{'all':!![]}];}return db[_0xb527('0x29')][_0xb527('0x41')](_0x235906);})[_0xb527('0x22')](function(_0x278d44){_0x3ee483[_0xb527('0x42')]=_0x278d44;return _0x3ee483;})[_0xb527('0x22')](respondWithFilteredResult(_0x23c6df,_0x235906))[_0xb527('0x43')](handleError(_0x23c6df,null));};exports[_0xb527('0x44')]=function(_0xbf42fa,_0x366761){var _0x3b937f={'raw':!![],'where':{'id':_0xbf42fa[_0xb527('0x45')]['id']}},_0x24e78b={};_0x24e78b[_0xb527('0x2e')]=_[_0xb527('0x2f')](db[_0xb527('0x29')]['rawAttributes']);_0x24e78b[_0xb527('0x30')]=_[_0xb527('0x2f')](_0xbf42fa[_0xb527('0x30')]);_0x24e78b[_0xb527('0x3a')]=_[_0xb527('0x31')](_0x24e78b[_0xb527('0x2e')],_0x24e78b[_0xb527('0x30')]);_0x3b937f[_0xb527('0x33')]=_['intersection'](_0x24e78b[_0xb527('0x2e')],qs[_0xb527('0x32')](_0xbf42fa[_0xb527('0x30')][_0xb527('0x32')]));_0x3b937f[_0xb527('0x33')]=_0x3b937f['attributes']['length']?_0x3b937f['attributes']:_0x24e78b[_0xb527('0x2e')];if(_0xbf42fa[_0xb527('0x30')][_0xb527('0x40')]){_0x3b937f[_0xb527('0x46')]=[{'all':!![]}];}_0x3b937f=_[_0xb527('0x3d')]({},_0x3b937f,_0xbf42fa['options']);return db[_0xb527('0x29')][_0xb527('0x47')](_0x3b937f)[_0xb527('0x22')](handleEntityNotFound(_0x366761,null))[_0xb527('0x22')](respondWithResult(_0x366761,null))[_0xb527('0x43')](handleError(_0x366761,null));};exports[_0xb527('0x48')]=function(_0x9d548,_0x25b27a){return db['JscriptySessionReport'][_0xb527('0x48')](_0x9d548[_0xb527('0x49')],{})[_0xb527('0x22')](respondWithResult(_0x25b27a,0xc9))[_0xb527('0x43')](handleError(_0x25b27a,null));};exports[_0xb527('0x4a')]=function(_0x14383a,_0x35e714){if(_0x14383a['body']['id']){delete _0x14383a['body']['id'];}return db[_0xb527('0x29')][_0xb527('0x47')]({'where':{'id':_0x14383a['params']['id']}})[_0xb527('0x22')](handleEntityNotFound(_0x35e714,null))['then'](saveUpdates(_0x14383a[_0xb527('0x49')],null))[_0xb527('0x22')](respondWithResult(_0x35e714,null))[_0xb527('0x43')](handleError(_0x35e714,null));};exports[_0xb527('0x21')]=function(_0x3cf105,_0x495408){return db['JscriptySessionReport'][_0xb527('0x47')]({'where':{'id':_0x3cf105[_0xb527('0x45')]['id']}})['then'](handleEntityNotFound(_0x495408,null))['then'](removeEntity(_0x495408,null))[_0xb527('0x43')](handleError(_0x495408,null));};exports[_0xb527('0x4b')]=function(_0x4917fc,_0x5c5c34){return db[_0xb527('0x29')][_0xb527('0x4b')]()[_0xb527('0x22')](respondWithResult(_0x5c5c34,null))[_0xb527('0x43')](handleError(_0x5c5c34,null));};exports['getQuestions']=function(_0xe55dc4,_0x3c1447,_0x46a738){var _0x38b89e={'raw':!![],'where':{}};var _0x4f2350={};var _0x50999c={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0xb527('0x4c')]({'where':{'id':_0xe55dc4['params']['id']}})[_0xb527('0x22')](handleEntityNotFound(_0x3c1447,null))[_0xb527('0x22')](function(_0x508c13){if(_0x508c13){_0x4f2350[_0xb527('0x2e')]=_[_0xb527('0x2f')](db[_0xb527('0x4d')][_0xb527('0x2a')]);_0x4f2350['query']=_[_0xb527('0x2f')](_0xe55dc4[_0xb527('0x30')]);_0x4f2350['filters']=_['intersection'](_0x4f2350[_0xb527('0x2e')],_0x4f2350['query']);_0x38b89e[_0xb527('0x33')]=_[_0xb527('0x31')](_0x4f2350[_0xb527('0x2e')],qs[_0xb527('0x32')](_0xe55dc4[_0xb527('0x30')][_0xb527('0x32')]));_0x38b89e[_0xb527('0x33')]=_0x38b89e[_0xb527('0x33')][_0xb527('0x34')]?_0x38b89e[_0xb527('0x33')]:_0x4f2350[_0xb527('0x2e')];if(!_0xe55dc4[_0xb527('0x30')][_0xb527('0x35')](_0xb527('0x36'))){_0x38b89e[_0xb527('0x1a')]=qs[_0xb527('0x1a')](_0xe55dc4[_0xb527('0x30')][_0xb527('0x1a')]);_0x38b89e[_0xb527('0x1b')]=qs[_0xb527('0x1b')](_0xe55dc4[_0xb527('0x30')][_0xb527('0x1b')]);}_0x38b89e['order']=qs[_0xb527('0x38')](_0xe55dc4[_0xb527('0x30')]['sort']);_0x38b89e[_0xb527('0x39')]=qs[_0xb527('0x3a')](_[_0xb527('0x3b')](_0xe55dc4[_0xb527('0x30')],_0x4f2350[_0xb527('0x3a')]));_0x38b89e['where']['SessionId']=_0x508c13['id'];if(_0xe55dc4[_0xb527('0x30')][_0xb527('0x3c')]){_0x38b89e[_0xb527('0x39')]=_[_0xb527('0x3d')](_0x38b89e[_0xb527('0x39')],{'$or':_[_0xb527('0x28')](_0x38b89e[_0xb527('0x33')],function(_0x555332){var _0x219356={};_0x219356[_0x555332]={'$like':'%'+_0xe55dc4[_0xb527('0x30')]['filter']+'%'};return _0x219356;})});}_0x38b89e=_[_0xb527('0x3d')]({},_0x38b89e,_0xe55dc4[_0xb527('0x3e')]);return db['JscriptyQuestionReport'][_0xb527('0x3f')]({'where':_0x38b89e[_0xb527('0x39')]})[_0xb527('0x22')](function(_0x27ace7){_0x50999c[_0xb527('0x3f')]=_0x27ace7;if(_0xe55dc4[_0xb527('0x30')][_0xb527('0x40')]){_0x38b89e['include']=[{'all':!![]}];}return db[_0xb527('0x4d')][_0xb527('0x41')](_0x38b89e);})[_0xb527('0x22')](function(_0x35ca57){_0x50999c[_0xb527('0x42')]=_0x35ca57;return _0x50999c;});}})['then'](respondWithFilteredResult(_0x3c1447,_0x38b89e))[_0xb527('0x43')](handleError(_0x3c1447,null));}; \ No newline at end of file +var _0xc6c6=['order','sort','where','pick','filter','merge','VIRTUAL','options','JscriptySessionReport','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','destroy','describe','findOne','JscriptyQuestionReport','SessionId','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','save','update','then','error','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x198f7b,_0x2acdb8){var _0x48b989=function(_0x2a2fc8){while(--_0x2a2fc8){_0x198f7b['push'](_0x198f7b['shift']());}};_0x48b989(++_0x2acdb8);}(_0xc6c6,0x6b));var _0x6c6c=function(_0x30033a,_0x5ce4a6){_0x30033a=_0x30033a-0x0;var _0x5e3518=_0xc6c6[_0x30033a];return _0x5e3518;};'use strict';var emlformat=require(_0x6c6c('0x0'));var rimraf=require(_0x6c6c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6c6c('0x2'));var rp=require(_0x6c6c('0x3'));var moment=require(_0x6c6c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6c6c('0x5'));var util=require(_0x6c6c('0x6'));var path=require(_0x6c6c('0x7'));var sox=require('sox');var csv=require(_0x6c6c('0x8'));var ejs=require(_0x6c6c('0x9'));var fs=require('fs');var fs_extra=require(_0x6c6c('0xa'));var _=require(_0x6c6c('0xb'));var squel=require(_0x6c6c('0xc'));var crypto=require(_0x6c6c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6c6c('0xe'));var toCsv=require(_0x6c6c('0x8'));var querystring=require(_0x6c6c('0xf'));var Papa=require(_0x6c6c('0x10'));var Redis=require(_0x6c6c('0x11'));var authService=require(_0x6c6c('0x12'));var qs=require(_0x6c6c('0x13'));var as=require(_0x6c6c('0x14'));var hardwareService=require(_0x6c6c('0x15'));var logger=require(_0x6c6c('0x16'))(_0x6c6c('0x17'));var utils=require(_0x6c6c('0x18'));var config=require(_0x6c6c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c6c('0x1a'))['db'];function respondWithStatusCode(_0xaf7647,_0x524826){_0x524826=_0x524826||0xcc;return function(_0x25db92){if(_0x25db92){return _0xaf7647[_0x6c6c('0x1b')](_0x524826);}return _0xaf7647[_0x6c6c('0x1c')](_0x524826)[_0x6c6c('0x1d')]();};}function respondWithResult(_0x31b702,_0x231ba8){_0x231ba8=_0x231ba8||0xc8;return function(_0x6ddb9e){if(_0x6ddb9e){return _0x31b702['status'](_0x231ba8)['json'](_0x6ddb9e);}};}function respondWithFilteredResult(_0x14804b,_0x160a46){return function(_0x1b54a4){if(_0x1b54a4){var _0x4a54a9=typeof _0x160a46[_0x6c6c('0x1e')]===_0x6c6c('0x1f')&&typeof _0x160a46[_0x6c6c('0x20')]==='undefined';var _0x15d4c3=_0x1b54a4[_0x6c6c('0x21')];var _0xb5f8d0=_0x4a54a9?0x0:_0x160a46[_0x6c6c('0x1e')];var _0x434a36=_0x4a54a9?_0x1b54a4[_0x6c6c('0x21')]:_0x160a46[_0x6c6c('0x1e')]+_0x160a46['limit'];var _0x429a03;if(_0x434a36>=_0x15d4c3){_0x434a36=_0x15d4c3;_0x429a03=0xc8;}else{_0x429a03=0xce;}_0x14804b[_0x6c6c('0x1c')](_0x429a03);return _0x14804b[_0x6c6c('0x22')](_0x6c6c('0x23'),_0xb5f8d0+'-'+_0x434a36+'/'+_0x15d4c3)[_0x6c6c('0x24')](_0x1b54a4);}return null;};}function patchUpdates(_0x2fbcca){return function(_0x5c6bc9){try{jsonpatch['apply'](_0x5c6bc9,_0x2fbcca,!![]);}catch(_0x31a1fc){return BPromise['reject'](_0x31a1fc);}return _0x5c6bc9[_0x6c6c('0x25')]();};}function saveUpdates(_0x391f8e,_0x154807){return function(_0x3262de){if(_0x3262de){return _0x3262de[_0x6c6c('0x26')](_0x391f8e)[_0x6c6c('0x27')](function(_0x18bf44){return _0x18bf44;});}return null;};}function removeEntity(_0x85186d,_0x1480d0){return function(_0x13b30d){if(_0x13b30d){return _0x13b30d['destroy']()['then'](function(){_0x85186d[_0x6c6c('0x1c')](0xcc)[_0x6c6c('0x1d')]();});}};}function handleEntityNotFound(_0x1a08e0,_0x2fbf84){return function(_0x1b9720){if(!_0x1b9720){_0x1a08e0[_0x6c6c('0x1b')](0x194);}return _0x1b9720;};}function handleError(_0xe8a373,_0x490df5){_0x490df5=_0x490df5||0x1f4;return function(_0x3d1174){logger[_0x6c6c('0x28')](_0x3d1174['stack']);if(_0x3d1174['name']){delete _0x3d1174[_0x6c6c('0x29')];}_0xe8a373[_0x6c6c('0x1c')](_0x490df5)[_0x6c6c('0x2a')](_0x3d1174);};}exports['index']=function(_0x4f6499,_0xd989bd){var _0x7df88d={},_0xff6f6d={},_0x4261fe={'count':0x0,'rows':[]};var _0x3f5294=_[_0x6c6c('0x2b')](db['JscriptySessionReport'][_0x6c6c('0x2c')],function(_0x50a464){return{'name':_0x50a464[_0x6c6c('0x2d')],'type':_0x50a464[_0x6c6c('0x2e')][_0x6c6c('0x2f')]};});_0xff6f6d[_0x6c6c('0x30')]=_[_0x6c6c('0x2b')](_0x3f5294,'name');_0xff6f6d[_0x6c6c('0x31')]=_['keys'](_0x4f6499['query']);_0xff6f6d[_0x6c6c('0x32')]=_['intersection'](_0xff6f6d[_0x6c6c('0x30')],_0xff6f6d['query']);_0x7df88d[_0x6c6c('0x33')]=_[_0x6c6c('0x34')](_0xff6f6d[_0x6c6c('0x30')],qs[_0x6c6c('0x35')](_0x4f6499[_0x6c6c('0x31')][_0x6c6c('0x35')]));_0x7df88d[_0x6c6c('0x33')]=_0x7df88d[_0x6c6c('0x33')][_0x6c6c('0x36')]?_0x7df88d[_0x6c6c('0x33')]:_0xff6f6d[_0x6c6c('0x30')];if(!_0x4f6499[_0x6c6c('0x31')][_0x6c6c('0x37')](_0x6c6c('0x38'))){_0x7df88d[_0x6c6c('0x20')]=qs['limit'](_0x4f6499[_0x6c6c('0x31')][_0x6c6c('0x20')]);_0x7df88d[_0x6c6c('0x1e')]=qs[_0x6c6c('0x1e')](_0x4f6499['query'][_0x6c6c('0x1e')]);}_0x7df88d[_0x6c6c('0x39')]=qs[_0x6c6c('0x3a')](_0x4f6499['query']['sort']);_0x7df88d[_0x6c6c('0x3b')]=qs[_0x6c6c('0x32')](_[_0x6c6c('0x3c')](_0x4f6499[_0x6c6c('0x31')],_0xff6f6d['filters']),_0x3f5294);if(_0x4f6499[_0x6c6c('0x31')][_0x6c6c('0x3d')]){_0x7df88d[_0x6c6c('0x3b')]=_[_0x6c6c('0x3e')](_0x7df88d[_0x6c6c('0x3b')],{'$or':_[_0x6c6c('0x2b')](_0x3f5294,function(_0x487d28){if(_0x487d28['type']!==_0x6c6c('0x3f')){var _0x39ebda={};_0x39ebda[_0x487d28[_0x6c6c('0x29')]]={'$like':'%'+_0x4f6499[_0x6c6c('0x31')][_0x6c6c('0x3d')]+'%'};return _0x39ebda;}})});}_0x7df88d=_['merge']({},_0x7df88d,_0x4f6499[_0x6c6c('0x40')]);var _0x5a8c00={'where':_0x7df88d[_0x6c6c('0x3b')]};return db[_0x6c6c('0x41')][_0x6c6c('0x21')](_0x5a8c00)[_0x6c6c('0x27')](function(_0x1a6c92){_0x4261fe['count']=_0x1a6c92;if(_0x4f6499[_0x6c6c('0x31')][_0x6c6c('0x42')]){_0x7df88d[_0x6c6c('0x43')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x6c6c('0x44')](_0x7df88d);})[_0x6c6c('0x27')](function(_0x3ade31){_0x4261fe[_0x6c6c('0x45')]=_0x3ade31;return _0x4261fe;})[_0x6c6c('0x27')](respondWithFilteredResult(_0xd989bd,_0x7df88d))[_0x6c6c('0x46')](handleError(_0xd989bd,null));};exports[_0x6c6c('0x47')]=function(_0x40c120,_0x537bb8){var _0x2f0aad={'raw':!![],'where':{'id':_0x40c120[_0x6c6c('0x48')]['id']}},_0x5d567d={};_0x5d567d[_0x6c6c('0x30')]=_[_0x6c6c('0x49')](db['JscriptySessionReport'][_0x6c6c('0x2c')]);_0x5d567d[_0x6c6c('0x31')]=_[_0x6c6c('0x49')](_0x40c120[_0x6c6c('0x31')]);_0x5d567d[_0x6c6c('0x32')]=_[_0x6c6c('0x34')](_0x5d567d[_0x6c6c('0x30')],_0x5d567d[_0x6c6c('0x31')]);_0x2f0aad[_0x6c6c('0x33')]=_[_0x6c6c('0x34')](_0x5d567d[_0x6c6c('0x30')],qs[_0x6c6c('0x35')](_0x40c120[_0x6c6c('0x31')][_0x6c6c('0x35')]));_0x2f0aad[_0x6c6c('0x33')]=_0x2f0aad[_0x6c6c('0x33')]['length']?_0x2f0aad[_0x6c6c('0x33')]:_0x5d567d[_0x6c6c('0x30')];if(_0x40c120[_0x6c6c('0x31')][_0x6c6c('0x42')]){_0x2f0aad[_0x6c6c('0x43')]=[{'all':!![]}];}_0x2f0aad=_['merge']({},_0x2f0aad,_0x40c120[_0x6c6c('0x40')]);return db[_0x6c6c('0x41')][_0x6c6c('0x4a')](_0x2f0aad)[_0x6c6c('0x27')](handleEntityNotFound(_0x537bb8,null))['then'](respondWithResult(_0x537bb8,null))[_0x6c6c('0x46')](handleError(_0x537bb8,null));};exports['create']=function(_0x1f3f35,_0x5edd90){return db['JscriptySessionReport'][_0x6c6c('0x4b')](_0x1f3f35[_0x6c6c('0x4c')],{})[_0x6c6c('0x27')](respondWithResult(_0x5edd90,0xc9))['catch'](handleError(_0x5edd90,null));};exports['update']=function(_0x2c107d,_0xcff662){if(_0x2c107d[_0x6c6c('0x4c')]['id']){delete _0x2c107d[_0x6c6c('0x4c')]['id'];}return db[_0x6c6c('0x41')][_0x6c6c('0x4a')]({'where':{'id':_0x2c107d[_0x6c6c('0x48')]['id']}})[_0x6c6c('0x27')](handleEntityNotFound(_0xcff662,null))[_0x6c6c('0x27')](saveUpdates(_0x2c107d[_0x6c6c('0x4c')],null))[_0x6c6c('0x27')](respondWithResult(_0xcff662,null))[_0x6c6c('0x46')](handleError(_0xcff662,null));};exports[_0x6c6c('0x4d')]=function(_0x5bc88a,_0x20201d){return db[_0x6c6c('0x41')][_0x6c6c('0x4a')]({'where':{'id':_0x5bc88a[_0x6c6c('0x48')]['id']}})[_0x6c6c('0x27')](handleEntityNotFound(_0x20201d,null))[_0x6c6c('0x27')](removeEntity(_0x20201d,null))[_0x6c6c('0x46')](handleError(_0x20201d,null));};exports[_0x6c6c('0x4e')]=function(_0x406301,_0x58244c){return db[_0x6c6c('0x41')]['describe']()[_0x6c6c('0x27')](respondWithResult(_0x58244c,null))[_0x6c6c('0x46')](handleError(_0x58244c,null));};exports['getQuestions']=function(_0x1c4cd3,_0x549345,_0x419a46){var _0x59ed79={'raw':!![],'where':{}};var _0x29107d={};var _0x1d1ee5={'count':0x0,'rows':[]};return db[_0x6c6c('0x41')][_0x6c6c('0x4f')]({'where':{'id':_0x1c4cd3[_0x6c6c('0x48')]['id']}})['then'](handleEntityNotFound(_0x549345,null))[_0x6c6c('0x27')](function(_0x24ee3a){if(_0x24ee3a){_0x29107d[_0x6c6c('0x30')]=_[_0x6c6c('0x49')](db[_0x6c6c('0x50')][_0x6c6c('0x2c')]);_0x29107d[_0x6c6c('0x31')]=_['keys'](_0x1c4cd3[_0x6c6c('0x31')]);_0x29107d['filters']=_[_0x6c6c('0x34')](_0x29107d['model'],_0x29107d[_0x6c6c('0x31')]);_0x59ed79[_0x6c6c('0x33')]=_[_0x6c6c('0x34')](_0x29107d['model'],qs[_0x6c6c('0x35')](_0x1c4cd3[_0x6c6c('0x31')][_0x6c6c('0x35')]));_0x59ed79[_0x6c6c('0x33')]=_0x59ed79[_0x6c6c('0x33')][_0x6c6c('0x36')]?_0x59ed79[_0x6c6c('0x33')]:_0x29107d[_0x6c6c('0x30')];if(!_0x1c4cd3[_0x6c6c('0x31')][_0x6c6c('0x37')](_0x6c6c('0x38'))){_0x59ed79[_0x6c6c('0x20')]=qs['limit'](_0x1c4cd3[_0x6c6c('0x31')]['limit']);_0x59ed79[_0x6c6c('0x1e')]=qs[_0x6c6c('0x1e')](_0x1c4cd3[_0x6c6c('0x31')][_0x6c6c('0x1e')]);}_0x59ed79[_0x6c6c('0x39')]=qs['sort'](_0x1c4cd3[_0x6c6c('0x31')][_0x6c6c('0x3a')]);_0x59ed79[_0x6c6c('0x3b')]=qs[_0x6c6c('0x32')](_[_0x6c6c('0x3c')](_0x1c4cd3[_0x6c6c('0x31')],_0x29107d[_0x6c6c('0x32')]));_0x59ed79['where'][_0x6c6c('0x51')]=_0x24ee3a['id'];if(_0x1c4cd3['query'][_0x6c6c('0x3d')]){_0x59ed79[_0x6c6c('0x3b')]=_[_0x6c6c('0x3e')](_0x59ed79[_0x6c6c('0x3b')],{'$or':_[_0x6c6c('0x2b')](_0x59ed79[_0x6c6c('0x33')],function(_0x52ac0d){var _0x39ecf2={};_0x39ecf2[_0x52ac0d]={'$like':'%'+_0x1c4cd3[_0x6c6c('0x31')][_0x6c6c('0x3d')]+'%'};return _0x39ecf2;})});}_0x59ed79=_[_0x6c6c('0x3e')]({},_0x59ed79,_0x1c4cd3['options']);return db['JscriptyQuestionReport'][_0x6c6c('0x21')]({'where':_0x59ed79[_0x6c6c('0x3b')]})[_0x6c6c('0x27')](function(_0x2dd332){_0x1d1ee5[_0x6c6c('0x21')]=_0x2dd332;if(_0x1c4cd3[_0x6c6c('0x31')][_0x6c6c('0x42')]){_0x59ed79[_0x6c6c('0x43')]=[{'all':!![]}];}return db[_0x6c6c('0x50')]['findAll'](_0x59ed79);})['then'](function(_0x153f13){_0x1d1ee5[_0x6c6c('0x45')]=_0x153f13;return _0x1d1ee5;});}})['then'](respondWithFilteredResult(_0x549345,_0x59ed79))[_0x6c6c('0x46')](handleError(_0x549345,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 8a5ed44..f26ad38 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 _0x7278=['define','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports'];(function(_0x4b9c09,_0xfaacb4){var _0x5462a2=function(_0x19e08a){while(--_0x19e08a){_0x4b9c09['push'](_0x4b9c09['shift']());}};_0x5462a2(++_0xfaacb4);}(_0x7278,0x161));var _0x8727=function(_0x203b85,_0x3c3432){_0x203b85=_0x203b85-0x0;var _0x5d2c34=_0x7278[_0x203b85];return _0x5d2c34;};'use strict';var _=require(_0x8727('0x0'));var util=require(_0x8727('0x1'));var logger=require(_0x8727('0x2'))(_0x8727('0x3'));var moment=require(_0x8727('0x4'));var BPromise=require('bluebird');var rp=require(_0x8727('0x5'));var fs=require('fs');var path=require(_0x8727('0x6'));var rimraf=require(_0x8727('0x7'));var config=require(_0x8727('0x8'));var attributes=require(_0x8727('0x9'));module[_0x8727('0xa')]=function(_0x180b71,_0x5549d5){return _0x180b71[_0x8727('0xb')](_0x8727('0xc'),attributes,{'tableName':_0x8727('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7046=['path','../../config/environment','./jscriptySessionReport.attributes','exports','JscriptySessionReport','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x3b5416,_0x47d70c){var _0x18b7b2=function(_0x2b5efc){while(--_0x2b5efc){_0x3b5416['push'](_0x3b5416['shift']());}};_0x18b7b2(++_0x47d70c);}(_0x7046,0x144));var _0x6704=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x7046[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var logger=require(_0x6704('0x2'))(_0x6704('0x3'));var moment=require('moment');var BPromise=require(_0x6704('0x4'));var rp=require(_0x6704('0x5'));var fs=require('fs');var path=require(_0x6704('0x6'));var rimraf=require('rimraf');var config=require(_0x6704('0x7'));var attributes=require(_0x6704('0x8'));module[_0x6704('0x9')]=function(_0x626a14,_0x2917be){return _0x626a14['define'](_0x6704('0xa'),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 c7b874c..16ea89f 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 _0x781d=['debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','JscriptySessionReport,\x20%s,\x20%s'];(function(_0x55d59f,_0x31317c){var _0x2ebf84=function(_0x3d01ea){while(--_0x3d01ea){_0x55d59f['push'](_0x55d59f['shift']());}};_0x2ebf84(++_0x31317c);}(_0x781d,0x14a));var _0xd781=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x781d[_0x618414];return _0x21c19a;};'use strict';var _=require(_0xd781('0x0'));var util=require(_0xd781('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd781('0x2'));var fs=require('fs');var Redis=require(_0xd781('0x3'));var db=require(_0xd781('0x4'))['db'];var utils=require(_0xd781('0x5'));var logger=require(_0xd781('0x6'))(_0xd781('0x7'));var config=require(_0xd781('0x8'));var jayson=require(_0xd781('0x9'));var client=jayson[_0xd781('0xa')][_0xd781('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a07f0,_0x133509,_0x1a242d){return new BPromise(function(_0x50610d,_0x248172){return client['request'](_0x5a07f0,_0x1a242d)[_0xd781('0xc')](function(_0x5c18c8){logger[_0xd781('0xd')](_0xd781('0xe'),_0x133509,'request\x20sent');logger[_0xd781('0xf')](_0xd781('0x10'),_0x133509,'request\x20sent',JSON['stringify'](_0x5c18c8));if(_0x5c18c8[_0xd781('0x11')]){if(_0x5c18c8[_0xd781('0x11')][_0xd781('0x12')]===0x1f4){logger[_0xd781('0x11')](_0xd781('0xe'),_0x133509,_0x5c18c8[_0xd781('0x11')][_0xd781('0x13')]);return _0x248172(_0x5c18c8[_0xd781('0x11')][_0xd781('0x13')]);}logger[_0xd781('0x11')](_0xd781('0xe'),_0x133509,_0x5c18c8['error'][_0xd781('0x13')]);return _0x50610d(_0x5c18c8[_0xd781('0x11')]['message']);}else{logger[_0xd781('0xd')]('JscriptySessionReport,\x20%s,\x20%s',_0x133509,_0xd781('0x14'));_0x50610d(_0x5c18c8[_0xd781('0x15')][_0xd781('0x13')]);}})[_0xd781('0x16')](function(_0x42a9c1){logger[_0xd781('0x11')](_0xd781('0xe'),_0x133509,_0x42a9c1);_0x248172(_0x42a9c1);});});} \ No newline at end of file +var _0x1893=['../../config/logger','../../config/environment','jayson/promise','client','http','request','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x148c09,_0x4fd39f){var _0x18e613=function(_0xfaa810){while(--_0xfaa810){_0x148c09['push'](_0x148c09['shift']());}};_0x18e613(++_0x4fd39f);}(_0x1893,0xa2));var _0x3189=function(_0xe6e78c,_0x582369){_0xe6e78c=_0xe6e78c-0x0;var _0x2a09c8=_0x1893[_0xe6e78c];return _0x2a09c8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3189('0x0'));var BPromise=require(_0x3189('0x1'));var rs=require(_0x3189('0x2'));var fs=require('fs');var Redis=require(_0x3189('0x3'));var db=require(_0x3189('0x4'))['db'];var utils=require(_0x3189('0x5'));var logger=require(_0x3189('0x6'))('rpc');var config=require(_0x3189('0x7'));var jayson=require(_0x3189('0x8'));var client=jayson[_0x3189('0x9')][_0x3189('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x77c566,_0x118970,_0x14d84b){return new BPromise(function(_0x1f6764,_0x5312a3){return client[_0x3189('0xb')](_0x77c566,_0x14d84b)['then'](function(_0x127449){logger['info'](_0x3189('0xc'),_0x118970,_0x3189('0xd'));logger[_0x3189('0xe')](_0x3189('0xf'),_0x118970,'request\x20sent',JSON[_0x3189('0x10')](_0x127449));if(_0x127449[_0x3189('0x11')]){if(_0x127449[_0x3189('0x11')][_0x3189('0x12')]===0x1f4){logger[_0x3189('0x11')]('JscriptySessionReport,\x20%s,\x20%s',_0x118970,_0x127449[_0x3189('0x11')][_0x3189('0x13')]);return _0x5312a3(_0x127449[_0x3189('0x11')][_0x3189('0x13')]);}logger[_0x3189('0x11')](_0x3189('0xc'),_0x118970,_0x127449[_0x3189('0x11')][_0x3189('0x13')]);return _0x1f6764(_0x127449['error'][_0x3189('0x13')]);}else{logger[_0x3189('0x14')](_0x3189('0xc'),_0x118970,_0x3189('0xd'));_0x1f6764(_0x127449['result'][_0x3189('0x13')]);}})['catch'](function(_0x55f432){logger[_0x3189('0x11')]('JscriptySessionReport,\x20%s,\x20%s',_0x118970,_0x55f432);_0x5312a3(_0x55f432);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 47be5b1..11e783d 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 _0xc1fd=['exports','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./license.controller','put','/:id','isAuthenticated','get','/download_log_file'];(function(_0x117a8e,_0x31955e){var _0x1f487a=function(_0xa3607c){while(--_0xa3607c){_0x117a8e['push'](_0x117a8e['shift']());}};_0x1f487a(++_0x31955e);}(_0xc1fd,0x16d));var _0xdc1f=function(_0x258319,_0x5d618d){_0x258319=_0x258319-0x0;var _0x1ec7cb=_0xc1fd[_0x258319];return _0x1ec7cb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdc1f('0x0'));var timeout=require('connect-timeout');var express=require(_0xdc1f('0x1'));var router=express[_0xdc1f('0x2')]();var fs_extra=require(_0xdc1f('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xdc1f('0x4'));var config=require(_0xdc1f('0x5'));var controller=require(_0xdc1f('0x6'));router['get']('/',controller['index']);router[_0xdc1f('0x7')](_0xdc1f('0x8'),auth[_0xdc1f('0x9')](),controller['update']);router[_0xdc1f('0xa')](_0xdc1f('0xb'),auth[_0xdc1f('0x9')](),controller['downloadLogFile']);module[_0xdc1f('0xc')]=router; \ No newline at end of file +var _0x9fd3=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','index','put','isAuthenticated','update','/download_log_file','downloadLogFile','multer','util','path','connect-timeout','express','Router'];(function(_0x34e37e,_0x3db1ca){var _0x4eb5a3=function(_0x9e3f45){while(--_0x9e3f45){_0x34e37e['push'](_0x34e37e['shift']());}};_0x4eb5a3(++_0x3db1ca);}(_0x9fd3,0x12c));var _0x39fd=function(_0x30c133,_0x20e3bd){_0x30c133=_0x30c133-0x0;var _0x38a446=_0x9fd3[_0x30c133];return _0x38a446;};'use strict';var multer=require(_0x39fd('0x0'));var util=require(_0x39fd('0x1'));var path=require(_0x39fd('0x2'));var timeout=require(_0x39fd('0x3'));var express=require(_0x39fd('0x4'));var router=express[_0x39fd('0x5')]();var fs_extra=require(_0x39fd('0x6'));var auth=require(_0x39fd('0x7'));var interaction=require(_0x39fd('0x8'));var config=require(_0x39fd('0x9'));var controller=require(_0x39fd('0xa'));router[_0x39fd('0xb')]('/',controller[_0x39fd('0xc')]);router[_0x39fd('0xd')]('/:id',auth[_0x39fd('0xe')](),controller[_0x39fd('0xf')]);router[_0x39fd('0xb')](_0x39fd('0x10'),auth[_0x39fd('0xe')](),controller[_0x39fd('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 814cba8..71781d4 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 _0x09ea=['STRING','INTEGER','exports','TEXT'];(function(_0x5a7ed0,_0x27aae9){var _0x4a8cae=function(_0x443370){while(--_0x443370){_0x5a7ed0['push'](_0x5a7ed0['shift']());}};_0x4a8cae(++_0x27aae9);}(_0x09ea,0x9a));var _0xa09e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x09ea[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xa09e('0x0')]={'license':{'type':Sequelize[_0xa09e('0x1')]},'data1':{'type':Sequelize[_0xa09e('0x2')]},'data2':{'type':Sequelize[_0xa09e('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xa09e('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0a84=['STRING','INTEGER','sequelize','exports'];(function(_0x35adb1,_0x290436){var _0x466e8a=function(_0x18403c){while(--_0x18403c){_0x35adb1['push'](_0x35adb1['shift']());}};_0x466e8a(++_0x290436);}(_0x0a84,0x176));var _0x40a8=function(_0x211a83,_0x1e9879){_0x211a83=_0x211a83-0x0;var _0x2e6701=_0x0a84[_0x211a83];return _0x2e6701;};'use strict';var Sequelize=require(_0x40a8('0x0'));module[_0x40a8('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0x40a8('0x2')]},'data2':{'type':Sequelize[_0x40a8('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x40a8('0x3')],'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 a887307..db0b31a 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 _0x6f55=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','then','stack','name','send','index','model','keys','rawAttributes','query','filters','intersection','attributes','fields','getLicense','catch','update','body','License','find','get','key','demo','license-info.log','join','/var','log','xcally','setHeader','Content-disposition','set','text/plain','download','eml-format','rimraf','zip-dir','request-promise','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6f55,0xb6));var _0x56f5=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0x6f55[_0x166d93];return _0xba708;};'use strict';var emlformat=require(_0x56f5('0x0'));var rimraf=require(_0x56f5('0x1'));var zipdir=require(_0x56f5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x56f5('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x56f5('0x4'));var path=require(_0x56f5('0x5'));var sox=require(_0x56f5('0x6'));var csv=require(_0x56f5('0x7'));var ejs=require(_0x56f5('0x8'));var fs=require('fs');var fs_extra=require(_0x56f5('0x9'));var _=require('lodash');var squel=require(_0x56f5('0xa'));var crypto=require(_0x56f5('0xb'));var jsforce=require(_0x56f5('0xc'));var deskjs=require(_0x56f5('0xd'));var toCsv=require(_0x56f5('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x56f5('0xe'));var qs=require(_0x56f5('0xf'));var as=require(_0x56f5('0x10'));var hardwareService=require(_0x56f5('0x11'));var logger=require('../../config/logger')(_0x56f5('0x12'));var utils=require(_0x56f5('0x13'));var config=require(_0x56f5('0x14'));var licenseUtil=require(_0x56f5('0x15'));var db=require(_0x56f5('0x16'))['db'];function respondWithStatusCode(_0x38929d,_0x3ab87f){_0x3ab87f=_0x3ab87f||0xcc;return function(_0x188d9c){if(_0x188d9c){return _0x38929d[_0x56f5('0x17')](_0x3ab87f);}return _0x38929d[_0x56f5('0x18')](_0x3ab87f)[_0x56f5('0x19')]();};}function respondWithResult(_0x4e700d,_0x5619b2){_0x5619b2=_0x5619b2||0xc8;return function(_0x4e72fb){if(_0x4e72fb){return _0x4e700d[_0x56f5('0x18')](_0x5619b2)[_0x56f5('0x1a')](_0x4e72fb);}};}function respondWithFilteredResult(_0x110aca,_0x124085){return function(_0x50b986){if(_0x50b986){var _0x13ab66=typeof _0x124085[_0x56f5('0x1b')]==='undefined'&&typeof _0x124085[_0x56f5('0x1c')]===_0x56f5('0x1d');var _0x3888f9=_0x50b986[_0x56f5('0x1e')];var _0x2dab09=_0x13ab66?0x0:_0x124085[_0x56f5('0x1b')];var _0x5b522c=_0x13ab66?_0x50b986['count']:_0x124085[_0x56f5('0x1b')]+_0x124085[_0x56f5('0x1c')];var _0x3e1f2b;if(_0x5b522c>=_0x3888f9){_0x5b522c=_0x3888f9;_0x3e1f2b=0xc8;}else{_0x3e1f2b=0xce;}_0x110aca[_0x56f5('0x18')](_0x3e1f2b);return _0x110aca['set'](_0x56f5('0x1f'),_0x2dab09+'-'+_0x5b522c+'/'+_0x3888f9)[_0x56f5('0x1a')](_0x50b986);}return null;};}function patchUpdates(_0x39a3ab){return function(_0x5bf284){try{jsonpatch[_0x56f5('0x20')](_0x5bf284,_0x39a3ab,!![]);}catch(_0x248e44){return BPromise[_0x56f5('0x21')](_0x248e44);}return _0x5bf284[_0x56f5('0x22')]();};}function saveUpdates(_0x249247,_0x32224b){return function(_0x13e95a){if(_0x13e95a){return _0x13e95a['update'](_0x249247)['then'](function(_0x5ed43d){return _0x5ed43d;});}return null;};}function removeEntity(_0x4726bf,_0x3c50d9){return function(_0x506a25){if(_0x506a25){return _0x506a25['destroy']()[_0x56f5('0x23')](function(){_0x4726bf[_0x56f5('0x18')](0xcc)[_0x56f5('0x19')]();});}};}function handleEntityNotFound(_0x56fc26,_0x42ba04){return function(_0x257787){if(!_0x257787){_0x56fc26['sendStatus'](0x194);}return _0x257787;};}function handleError(_0x1ef0e1,_0x132cba){_0x132cba=_0x132cba||0x1f4;return function(_0x3802db){logger['error'](_0x3802db[_0x56f5('0x24')]);if(_0x3802db[_0x56f5('0x25')]){delete _0x3802db[_0x56f5('0x25')];}_0x1ef0e1['status'](_0x132cba)[_0x56f5('0x26')](_0x3802db);};}var utilLicense=require(_0x56f5('0x15'));exports[_0x56f5('0x27')]=function(_0x5c45c4,_0x3356cf){var _0x286cd0={'raw':!![],'where':{'id':0x1}},_0x4b507a={};_0x4b507a[_0x56f5('0x28')]=_[_0x56f5('0x29')](db['License'][_0x56f5('0x2a')]);_0x4b507a[_0x56f5('0x2b')]=_[_0x56f5('0x29')](_0x5c45c4[_0x56f5('0x2b')]);_0x4b507a[_0x56f5('0x2c')]=_[_0x56f5('0x2d')](_0x4b507a[_0x56f5('0x28')],_0x4b507a[_0x56f5('0x2b')]);_0x286cd0[_0x56f5('0x2e')]=_[_0x56f5('0x2d')](_0x4b507a[_0x56f5('0x28')],qs[_0x56f5('0x2f')](_0x5c45c4[_0x56f5('0x2b')][_0x56f5('0x2f')]));_0x286cd0[_0x56f5('0x2e')]=_0x286cd0[_0x56f5('0x2e')]['length']?_0x286cd0[_0x56f5('0x2e')]:_0x4b507a[_0x56f5('0x28')];_0x286cd0=_['merge']({},_0x286cd0,_0x5c45c4['options']);return utilLicense[_0x56f5('0x30')](_0x286cd0)[_0x56f5('0x23')](respondWithResult(_0x3356cf,null))[_0x56f5('0x31')](handleError(_0x3356cf,null));};exports[_0x56f5('0x32')]=function(_0x58c51c,_0x1975cf){if(_0x58c51c[_0x56f5('0x33')]['id']){delete _0x58c51c[_0x56f5('0x33')]['id'];}return db[_0x56f5('0x34')][_0x56f5('0x35')]({'where':{'id':_0x58c51c['params']['id']}})[_0x56f5('0x23')](handleEntityNotFound(_0x1975cf,null))[_0x56f5('0x23')](function(_0x4ff3ab){var _0x37aade=_0x4ff3ab[_0x56f5('0x36')]({'plain':!![]});return utilLicense['checkLicense'](_0x37aade,_0x58c51c[_0x56f5('0x33')][_0x56f5('0x37')]);})[_0x56f5('0x23')](function(_0x1fbd88){if(!_0x1fbd88[_0x56f5('0x38')]){return saveUpdates(_0x58c51c[_0x56f5('0x33')],null);}return _0x1fbd88;})[_0x56f5('0x23')](respondWithResult(_0x1975cf,null))[_0x56f5('0x31')](handleError(_0x1975cf,null));};exports['downloadLogFile']=function(_0x208c32,_0x31de09){var _0x4b960d=_0x56f5('0x39');var _0x98cba0=path[_0x56f5('0x3a')](_0x56f5('0x3b'),_0x56f5('0x3c'),_0x56f5('0x3d'),_0x4b960d);_0x31de09[_0x56f5('0x3e')](_0x56f5('0x3f'),'attachment;\x20filename='+_0x4b960d);_0x31de09[_0x56f5('0x40')]('Content-Type',_0x56f5('0x41'));_0x31de09[_0x56f5('0x42')](_0x98cba0);}; \ No newline at end of file +var _0x8971=['Content-Range','reject','destroy','then','end','sendStatus','error','stack','name','send','index','model','License','rawAttributes','query','keys','filters','intersection','attributes','fields','length','merge','getLicense','update','body','find','params','get','demo','catch','downloadLogFile','license-info.log','/var','log','xcally','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','count','set'];(function(_0x2f44ad,_0x317f33){var _0x3a681a=function(_0x243433){while(--_0x243433){_0x2f44ad['push'](_0x2f44ad['shift']());}};_0x3a681a(++_0x317f33);}(_0x8971,0xad));var _0x1897=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x8971[_0x17b6e3];return _0x3906f3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1897('0x0'));var zipdir=require(_0x1897('0x1'));var jsonpatch=require(_0x1897('0x2'));var rp=require(_0x1897('0x3'));var moment=require('moment');var BPromise=require(_0x1897('0x4'));var Mustache=require('mustache');var util=require(_0x1897('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x1897('0x6'));var ejs=require(_0x1897('0x7'));var fs=require('fs');var fs_extra=require(_0x1897('0x8'));var _=require(_0x1897('0x9'));var squel=require(_0x1897('0xa'));var crypto=require(_0x1897('0xb'));var jsforce=require(_0x1897('0xc'));var deskjs=require(_0x1897('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1897('0xe'));var Papa=require(_0x1897('0xf'));var Redis=require(_0x1897('0x10'));var authService=require(_0x1897('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1897('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x1897('0x13'));var licenseUtil=require(_0x1897('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a7baf,_0x259e5b){_0x259e5b=_0x259e5b||0xcc;return function(_0x5408b2){if(_0x5408b2){return _0x5a7baf['sendStatus'](_0x259e5b);}return _0x5a7baf[_0x1897('0x15')](_0x259e5b)['end']();};}function respondWithResult(_0x517846,_0x3c23bb){_0x3c23bb=_0x3c23bb||0xc8;return function(_0x432dc4){if(_0x432dc4){return _0x517846[_0x1897('0x15')](_0x3c23bb)[_0x1897('0x16')](_0x432dc4);}};}function respondWithFilteredResult(_0x39f25b,_0x470627){return function(_0x4c7cdc){if(_0x4c7cdc){var _0x2e2c9d=typeof _0x470627[_0x1897('0x17')]==='undefined'&&typeof _0x470627[_0x1897('0x18')]===_0x1897('0x19');var _0x49f658=_0x4c7cdc[_0x1897('0x1a')];var _0x1f5977=_0x2e2c9d?0x0:_0x470627[_0x1897('0x17')];var _0x42dab9=_0x2e2c9d?_0x4c7cdc['count']:_0x470627[_0x1897('0x17')]+_0x470627['limit'];var _0x327a1c;if(_0x42dab9>=_0x49f658){_0x42dab9=_0x49f658;_0x327a1c=0xc8;}else{_0x327a1c=0xce;}_0x39f25b[_0x1897('0x15')](_0x327a1c);return _0x39f25b[_0x1897('0x1b')](_0x1897('0x1c'),_0x1f5977+'-'+_0x42dab9+'/'+_0x49f658)[_0x1897('0x16')](_0x4c7cdc);}return null;};}function patchUpdates(_0x3104af){return function(_0x3cde87){try{jsonpatch['apply'](_0x3cde87,_0x3104af,!![]);}catch(_0x4f4d83){return BPromise[_0x1897('0x1d')](_0x4f4d83);}return _0x3cde87['save']();};}function saveUpdates(_0x13a76e,_0x190be9){return function(_0x2b706f){if(_0x2b706f){return _0x2b706f['update'](_0x13a76e)['then'](function(_0x28048a){return _0x28048a;});}return null;};}function removeEntity(_0x28fa67,_0x48453b){return function(_0x55213c){if(_0x55213c){return _0x55213c[_0x1897('0x1e')]()[_0x1897('0x1f')](function(){_0x28fa67[_0x1897('0x15')](0xcc)[_0x1897('0x20')]();});}};}function handleEntityNotFound(_0xd785db,_0x4e96de){return function(_0x8be0fb){if(!_0x8be0fb){_0xd785db[_0x1897('0x21')](0x194);}return _0x8be0fb;};}function handleError(_0x5c582d,_0x26100f){_0x26100f=_0x26100f||0x1f4;return function(_0x38886a){logger[_0x1897('0x22')](_0x38886a[_0x1897('0x23')]);if(_0x38886a[_0x1897('0x24')]){delete _0x38886a['name'];}_0x5c582d[_0x1897('0x15')](_0x26100f)[_0x1897('0x25')](_0x38886a);};}var utilLicense=require(_0x1897('0x14'));exports[_0x1897('0x26')]=function(_0x17523f,_0x526cb2){var _0x9ccce5={'raw':!![],'where':{'id':0x1}},_0x14473f={};_0x14473f[_0x1897('0x27')]=_['keys'](db[_0x1897('0x28')][_0x1897('0x29')]);_0x14473f[_0x1897('0x2a')]=_[_0x1897('0x2b')](_0x17523f[_0x1897('0x2a')]);_0x14473f[_0x1897('0x2c')]=_[_0x1897('0x2d')](_0x14473f[_0x1897('0x27')],_0x14473f[_0x1897('0x2a')]);_0x9ccce5[_0x1897('0x2e')]=_['intersection'](_0x14473f[_0x1897('0x27')],qs['fields'](_0x17523f[_0x1897('0x2a')][_0x1897('0x2f')]));_0x9ccce5['attributes']=_0x9ccce5[_0x1897('0x2e')][_0x1897('0x30')]?_0x9ccce5[_0x1897('0x2e')]:_0x14473f[_0x1897('0x27')];_0x9ccce5=_[_0x1897('0x31')]({},_0x9ccce5,_0x17523f['options']);return utilLicense[_0x1897('0x32')](_0x9ccce5)[_0x1897('0x1f')](respondWithResult(_0x526cb2,null))['catch'](handleError(_0x526cb2,null));};exports[_0x1897('0x33')]=function(_0x1ef730,_0x116ec4){if(_0x1ef730[_0x1897('0x34')]['id']){delete _0x1ef730[_0x1897('0x34')]['id'];}return db[_0x1897('0x28')][_0x1897('0x35')]({'where':{'id':_0x1ef730[_0x1897('0x36')]['id']}})['then'](handleEntityNotFound(_0x116ec4,null))['then'](function(_0x3fbd2b){var _0x10922d=_0x3fbd2b[_0x1897('0x37')]({'plain':!![]});return utilLicense['checkLicense'](_0x10922d,_0x1ef730[_0x1897('0x34')]['key']);})[_0x1897('0x1f')](function(_0x32ba32){if(!_0x32ba32[_0x1897('0x38')]){return saveUpdates(_0x1ef730[_0x1897('0x34')],null);}return _0x32ba32;})[_0x1897('0x1f')](respondWithResult(_0x116ec4,null))[_0x1897('0x39')](handleError(_0x116ec4,null));};exports[_0x1897('0x3a')]=function(_0x251323,_0x262b3f){var _0x187810=_0x1897('0x3b');var _0x13436d=path['join'](_0x1897('0x3c'),_0x1897('0x3d'),_0x1897('0x3e'),_0x187810);_0x262b3f['setHeader'](_0x1897('0x3f'),_0x1897('0x40')+_0x187810);_0x262b3f[_0x1897('0x1b')](_0x1897('0x41'),_0x1897('0x42'));_0x262b3f['download'](_0x13436d);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 43ac359..8bad859 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 _0x7954=['license','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./license.attributes','define','License'];(function(_0x1e9fc5,_0x288642){var _0x46576d=function(_0x38b2f9){while(--_0x38b2f9){_0x1e9fc5['push'](_0x1e9fc5['shift']());}};_0x46576d(++_0x288642);}(_0x7954,0x169));var _0x4795=function(_0x3edc8b,_0x1996cb){_0x3edc8b=_0x3edc8b-0x0;var _0xbf74e5=_0x7954[_0x3edc8b];return _0xbf74e5;};'use strict';var _=require(_0x4795('0x0'));var util=require(_0x4795('0x1'));var logger=require(_0x4795('0x2'))('api');var moment=require(_0x4795('0x3'));var BPromise=require(_0x4795('0x4'));var rp=require(_0x4795('0x5'));var fs=require('fs');var path=require(_0x4795('0x6'));var rimraf=require('rimraf');var config=require(_0x4795('0x7'));var attributes=require(_0x4795('0x8'));module['exports']=function(_0x25d835,_0xaee130){return _0x25d835[_0x4795('0x9')](_0x4795('0xa'),attributes,{'tableName':_0x4795('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x127b=['rimraf','../../config/environment','./license.attributes','define','License','license','util','../../config/logger','api','bluebird','request-promise'];(function(_0x2f3be2,_0x224419){var _0x4cf7b0=function(_0xa03718){while(--_0xa03718){_0x2f3be2['push'](_0x2f3be2['shift']());}};_0x4cf7b0(++_0x224419);}(_0x127b,0xa0));var _0xb127=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x127b[_0x4fbfd9];return _0x31dc94;};'use strict';var _=require('lodash');var util=require(_0xb127('0x0'));var logger=require(_0xb127('0x1'))(_0xb127('0x2'));var moment=require('moment');var BPromise=require(_0xb127('0x3'));var rp=require(_0xb127('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb127('0x5'));var config=require(_0xb127('0x6'));var attributes=require(_0xb127('0x7'));module['exports']=function(_0x211ab9,_0x3e1878){return _0x211ab9[_0xb127('0x8')](_0xb127('0x9'),attributes,{'tableName':_0xb127('0xa'),'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 e6c859f..0d9e7e0 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 _0x5c1b=['../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','License,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5e920f,_0x2531fa){var _0x2c2d69=function(_0xb08ab6){while(--_0xb08ab6){_0x5e920f['push'](_0x5e920f['shift']());}};_0x2c2d69(++_0x2531fa);}(_0x5c1b,0xb2));var _0xb5c1=function(_0x1ecf1b,_0xc6554){_0x1ecf1b=_0x1ecf1b-0x0;var _0x242a80=_0x5c1b[_0x1ecf1b];return _0x242a80;};'use strict';var _=require(_0xb5c1('0x0'));var util=require('util');var moment=require(_0xb5c1('0x1'));var BPromise=require('bluebird');var rs=require(_0xb5c1('0x2'));var fs=require('fs');var Redis=require(_0xb5c1('0x3'));var db=require(_0xb5c1('0x4'))['db'];var utils=require(_0xb5c1('0x5'));var logger=require(_0xb5c1('0x6'))(_0xb5c1('0x7'));var config=require(_0xb5c1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb5c1('0x9')][_0xb5c1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x236a74,_0x19aafe,_0x3e828){return new BPromise(function(_0x26d81b,_0x12ceda){return client[_0xb5c1('0xb')](_0x236a74,_0x3e828)[_0xb5c1('0xc')](function(_0x3579c7){logger['info']('License,\x20%s,\x20%s',_0x19aafe,_0xb5c1('0xd'));logger[_0xb5c1('0xe')](_0xb5c1('0xf'),_0x19aafe,_0xb5c1('0xd'),JSON[_0xb5c1('0x10')](_0x3579c7));if(_0x3579c7[_0xb5c1('0x11')]){if(_0x3579c7['error'][_0xb5c1('0x12')]===0x1f4){logger[_0xb5c1('0x11')](_0xb5c1('0x13'),_0x19aafe,_0x3579c7[_0xb5c1('0x11')][_0xb5c1('0x14')]);return _0x12ceda(_0x3579c7[_0xb5c1('0x11')]['message']);}logger[_0xb5c1('0x11')](_0xb5c1('0x13'),_0x19aafe,_0x3579c7['error'][_0xb5c1('0x14')]);return _0x26d81b(_0x3579c7[_0xb5c1('0x11')][_0xb5c1('0x14')]);}else{logger['info']('License,\x20%s,\x20%s',_0x19aafe,_0xb5c1('0xd'));_0x26d81b(_0x3579c7[_0xb5c1('0x15')][_0xb5c1('0x14')]);}})[_0xb5c1('0x16')](function(_0x26abdf){logger['error'](_0xb5c1('0x13'),_0x19aafe,_0x26abdf);_0x12ceda(_0x26abdf);});});} \ No newline at end of file +var _0xcc49=['request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','License,\x20%s,\x20%s'];(function(_0x497609,_0x426976){var _0x4ba014=function(_0x4b7508){while(--_0x4b7508){_0x497609['push'](_0x497609['shift']());}};_0x4ba014(++_0x426976);}(_0xcc49,0xea));var _0x9cc4=function(_0x53ba51,_0x2f2321){_0x53ba51=_0x53ba51-0x0;var _0x2e776e=_0xcc49[_0x53ba51];return _0x2e776e;};'use strict';var _=require('lodash');var util=require(_0x9cc4('0x0'));var moment=require(_0x9cc4('0x1'));var BPromise=require(_0x9cc4('0x2'));var rs=require(_0x9cc4('0x3'));var fs=require('fs');var Redis=require(_0x9cc4('0x4'));var db=require(_0x9cc4('0x5'))['db'];var utils=require(_0x9cc4('0x6'));var logger=require(_0x9cc4('0x7'))(_0x9cc4('0x8'));var config=require('../../config/environment');var jayson=require(_0x9cc4('0x9'));var client=jayson[_0x9cc4('0xa')][_0x9cc4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3150a0,_0x1575b0,_0x1d5187){return new BPromise(function(_0x2ae8b7,_0x22934a){return client[_0x9cc4('0xc')](_0x3150a0,_0x1d5187)[_0x9cc4('0xd')](function(_0x189838){logger[_0x9cc4('0xe')](_0x9cc4('0xf'),_0x1575b0,_0x9cc4('0x10'));logger[_0x9cc4('0x11')](_0x9cc4('0x12'),_0x1575b0,_0x9cc4('0x10'),JSON[_0x9cc4('0x13')](_0x189838));if(_0x189838[_0x9cc4('0x14')]){if(_0x189838[_0x9cc4('0x14')][_0x9cc4('0x15')]===0x1f4){logger[_0x9cc4('0x14')]('License,\x20%s,\x20%s',_0x1575b0,_0x189838['error']['message']);return _0x22934a(_0x189838[_0x9cc4('0x14')]['message']);}logger['error'](_0x9cc4('0xf'),_0x1575b0,_0x189838[_0x9cc4('0x14')][_0x9cc4('0x16')]);return _0x2ae8b7(_0x189838[_0x9cc4('0x14')][_0x9cc4('0x16')]);}else{logger['info'](_0x9cc4('0xf'),_0x1575b0,'request\x20sent');_0x2ae8b7(_0x189838[_0x9cc4('0x17')]['message']);}})[_0x9cc4('0x18')](function(_0x18ff82){logger['error'](_0x9cc4('0xf'),_0x1575b0,_0x18ff82);_0x22934a(_0x18ff82);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 98a51d0..daabf5f 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 _0xa0f9=['addSmtp','addInteraction','/:id/send','send','addAgents','delete','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','post','addDisposition','addAnswer','create','/:id/in_servers','addImap'];(function(_0x3b1188,_0x408ef3){var _0x3d103d=function(_0x3ebd0b){while(--_0x3ebd0b){_0x3b1188['push'](_0x3b1188['shift']());}};_0x3d103d(++_0x408ef3);}(_0xa0f9,0x126));var _0x9a0f=function(_0x68fd87,_0x17f037){_0x68fd87=_0x68fd87-0x0;var _0x559470=_0xa0f9[_0x68fd87];return _0x559470;};'use strict';var multer=require(_0x9a0f('0x0'));var util=require(_0x9a0f('0x1'));var path=require(_0x9a0f('0x2'));var timeout=require('connect-timeout');var express=require(_0x9a0f('0x3'));var router=express[_0x9a0f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9a0f('0x5'));var interaction=require(_0x9a0f('0x6'));var config=require(_0x9a0f('0x7'));var controller=require('./mailAccount.controller');router[_0x9a0f('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0x9a0f('0x9')](),controller[_0x9a0f('0xa')]);router[_0x9a0f('0x8')](_0x9a0f('0xb'),auth['isAuthenticated'](),controller[_0x9a0f('0xc')]);router[_0x9a0f('0x8')](_0x9a0f('0xd'),auth[_0x9a0f('0x9')](),controller[_0x9a0f('0xe')]);router[_0x9a0f('0x8')](_0x9a0f('0xf'),auth[_0x9a0f('0x9')](),controller[_0x9a0f('0x10')]);router[_0x9a0f('0x8')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0x9a0f('0x11')]);router[_0x9a0f('0x8')](_0x9a0f('0x12'),auth['isAuthenticated'](),controller[_0x9a0f('0x13')]);router[_0x9a0f('0x8')](_0x9a0f('0x14'),auth[_0x9a0f('0x9')](),controller[_0x9a0f('0x15')]);router[_0x9a0f('0x8')](_0x9a0f('0x16'),auth['isAuthenticated'](),controller[_0x9a0f('0x17')]);router[_0x9a0f('0x8')](_0x9a0f('0x18'),auth[_0x9a0f('0x9')](),controller[_0x9a0f('0x19')]);router[_0x9a0f('0x8')](_0x9a0f('0x1a'),auth[_0x9a0f('0x9')](),controller[_0x9a0f('0x1b')]);router[_0x9a0f('0x8')](_0x9a0f('0x1c'),auth[_0x9a0f('0x9')](),controller['getAgents']);router[_0x9a0f('0x1d')](_0x9a0f('0xd'),auth[_0x9a0f('0x9')](),controller[_0x9a0f('0x1e')]);router['post'](_0x9a0f('0xf'),auth[_0x9a0f('0x9')](),controller[_0x9a0f('0x1f')]);router[_0x9a0f('0x1d')]('/',auth[_0x9a0f('0x9')](),controller[_0x9a0f('0x20')]);router['post'](_0x9a0f('0x21'),auth[_0x9a0f('0x9')](),controller[_0x9a0f('0x22')]);router[_0x9a0f('0x1d')](_0x9a0f('0x12'),auth['isAuthenticated'](),controller[_0x9a0f('0x23')]);router[_0x9a0f('0x1d')](_0x9a0f('0x14'),auth[_0x9a0f('0x9')](),controller[_0x9a0f('0x24')]);router['post'](_0x9a0f('0x16'),auth[_0x9a0f('0x9')](),controller['addApplications']);router[_0x9a0f('0x1d')](_0x9a0f('0x25'),auth[_0x9a0f('0x9')](),controller[_0x9a0f('0x26')]);router[_0x9a0f('0x1d')](_0x9a0f('0x1c'),auth[_0x9a0f('0x9')](),controller[_0x9a0f('0x27')]);router['put'](_0x9a0f('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x9a0f('0x28')]('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router[_0x9a0f('0x28')](_0x9a0f('0xf'),auth[_0x9a0f('0x9')](),controller[_0x9a0f('0x29')]);router[_0x9a0f('0x28')]('/:id/in_servers',auth[_0x9a0f('0x9')](),controller[_0x9a0f('0x2a')]);router[_0x9a0f('0x28')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0x9a0f('0x2b')]);router[_0x9a0f('0x28')](_0x9a0f('0xb'),auth['isAuthenticated'](),controller[_0x9a0f('0x2c')]);router[_0x9a0f('0x28')](_0x9a0f('0x1c'),auth[_0x9a0f('0x9')](),controller[_0x9a0f('0x2d')]);module[_0x9a0f('0x2e')]=router; \ No newline at end of file +var _0x68ed=['delete','removeDispositions','removeAnswers','removeImap','/:id/out_servers','removeSmtp','destroy','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailAccount.controller','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getSmtp','/:id/interactions','getInteractions','getApplications','/:id/messages','getMessages','verifySmtp','/:id/users','getAgents','addDisposition','post','addAnswer','create','/:id/in_servers','addSmtp','addApplications','/:id/send','send','addAgents','put','update'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x68ed,0x1f3));var _0xd68e=function(_0x4e7910,_0x3b480f){_0x4e7910=_0x4e7910-0x0;var _0x4d76a0=_0x68ed[_0x4e7910];return _0x4d76a0;};'use strict';var multer=require(_0xd68e('0x0'));var util=require(_0xd68e('0x1'));var path=require('path');var timeout=require(_0xd68e('0x2'));var express=require(_0xd68e('0x3'));var router=express[_0xd68e('0x4')]();var fs_extra=require(_0xd68e('0x5'));var auth=require(_0xd68e('0x6'));var interaction=require(_0xd68e('0x7'));var config=require('../../config/environment');var controller=require(_0xd68e('0x8'));router['get']('/',auth[_0xd68e('0x9')](),controller[_0xd68e('0xa')]);router['get'](_0xd68e('0xb'),auth[_0xd68e('0x9')](),controller[_0xd68e('0xc')]);router[_0xd68e('0xd')](_0xd68e('0xe'),auth[_0xd68e('0x9')](),controller[_0xd68e('0xf')]);router[_0xd68e('0xd')](_0xd68e('0x10'),auth['isAuthenticated'](),controller[_0xd68e('0x11')]);router[_0xd68e('0xd')](_0xd68e('0x12'),auth[_0xd68e('0x9')](),controller['getAnswers']);router[_0xd68e('0xd')]('/:id/in_servers',auth[_0xd68e('0x9')](),controller['getImap']);router[_0xd68e('0xd')]('/:id/out_servers',auth[_0xd68e('0x9')](),controller[_0xd68e('0x13')]);router['get'](_0xd68e('0x14'),auth[_0xd68e('0x9')](),controller[_0xd68e('0x15')]);router[_0xd68e('0xd')]('/:id/applications',auth[_0xd68e('0x9')](),controller[_0xd68e('0x16')]);router['get'](_0xd68e('0x17'),auth[_0xd68e('0x9')](),controller[_0xd68e('0x18')]);router[_0xd68e('0xd')]('/:id/verify',auth[_0xd68e('0x9')](),controller[_0xd68e('0x19')]);router['get'](_0xd68e('0x1a'),auth[_0xd68e('0x9')](),controller[_0xd68e('0x1b')]);router['post']('/:id/dispositions',auth[_0xd68e('0x9')](),controller[_0xd68e('0x1c')]);router[_0xd68e('0x1d')](_0xd68e('0x12'),auth[_0xd68e('0x9')](),controller[_0xd68e('0x1e')]);router[_0xd68e('0x1d')]('/',auth[_0xd68e('0x9')](),controller[_0xd68e('0x1f')]);router[_0xd68e('0x1d')](_0xd68e('0x20'),auth[_0xd68e('0x9')](),controller['addImap']);router[_0xd68e('0x1d')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0xd68e('0x21')]);router['post']('/:id/interactions',auth[_0xd68e('0x9')](),controller['addInteraction']);router[_0xd68e('0x1d')]('/:id/applications',auth[_0xd68e('0x9')](),controller[_0xd68e('0x22')]);router['post'](_0xd68e('0x23'),auth[_0xd68e('0x9')](),controller[_0xd68e('0x24')]);router[_0xd68e('0x1d')](_0xd68e('0x1a'),auth[_0xd68e('0x9')](),controller[_0xd68e('0x25')]);router[_0xd68e('0x26')](_0xd68e('0xe'),auth[_0xd68e('0x9')](),controller[_0xd68e('0x27')]);router[_0xd68e('0x28')](_0xd68e('0x10'),auth['isAuthenticated'](),controller[_0xd68e('0x29')]);router[_0xd68e('0x28')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xd68e('0x2a')]);router[_0xd68e('0x28')]('/:id/in_servers',auth[_0xd68e('0x9')](),controller[_0xd68e('0x2b')]);router[_0xd68e('0x28')](_0xd68e('0x2c'),auth[_0xd68e('0x9')](),controller[_0xd68e('0x2d')]);router[_0xd68e('0x28')]('/:id',auth['isAuthenticated'](),controller[_0xd68e('0x2e')]);router[_0xd68e('0x28')](_0xd68e('0x1a'),auth['isAuthenticated'](),controller[_0xd68e('0x2f')]);module[_0xd68e('0x30')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 3ef1f51..af6ea7a 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 _0x52b3=['Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','ENUM','yahoo','outlook365','getDataValue','provider','custom','STRING','BOOLEAN','TEXT'];(function(_0x57b587,_0x60a3e4){var _0x5e51a3=function(_0x2ea512){while(--_0x2ea512){_0x57b587['push'](_0x57b587['shift']());}};_0x5e51a3(++_0x60a3e4);}(_0x52b3,0xd5));var _0x352b=function(_0x3f090f,_0xcb1291){_0x3f090f=_0x3f090f-0x0;var _0x2b76fb=_0x52b3[_0x3f090f];return _0x2b76fb;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x352b('0x0')],'allowNull':![]},'service':{'type':Sequelize[_0x352b('0x1')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x352b('0x1')],'defaultValue':!![]},'key':{'type':Sequelize[_0x352b('0x0')],'allowNull':![]},'template':{'type':Sequelize[_0x352b('0x2')]},'markAsUnread':{'type':Sequelize[_0x352b('0x1')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x352b('0x0')],'allowNull':![],'defaultValue':_0x352b('0x3')},'fontSize':{'type':Sequelize[_0x352b('0x4')](0x2)[_0x352b('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x352b('0x6');}},'notificationSound':{'type':Sequelize[_0x352b('0x1')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x352b('0x1')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x352b('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x352b('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x352b('0x1')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x352b('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0x352b('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x352b('0x1')],'defaultValue':![],'comment':_0x352b('0x8'),'set':function(_0x123c3a){if(!_0x123c3a)this['setDataValue'](_0x352b('0x9'),null);this[_0x352b('0xa')](_0x352b('0xb'),_0x123c3a);}},'provider':{'type':Sequelize[_0x352b('0xc')]('gmail','hotmail',_0x352b('0xd'),_0x352b('0xe')),'defaultValue':null,'get':function(){if(!this[_0x352b('0xf')](_0x352b('0x10')))return _0x352b('0x11');return this[_0x352b('0xf')](_0x352b('0x10'));},'set':function(_0x27ad27){if(_0x27ad27===_0x352b('0x11'))_0x27ad27=null;return this[_0x352b('0xa')](_0x352b('0x10'),_0x27ad27);}}}; \ No newline at end of file +var _0xa3ba=['hotmail','yahoo','getDataValue','custom','sequelize','STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','ENUM','gmail'];(function(_0x58bb00,_0x3f32d5){var _0x4dd053=function(_0x3c4acb){while(--_0x3c4acb){_0x58bb00['push'](_0x58bb00['shift']());}};_0x4dd053(++_0x3f32d5);}(_0xa3ba,0x6a));var _0xaa3b=function(_0x5e28c2,_0x1e48ab){_0x5e28c2=_0x5e28c2-0x0;var _0x1a8cc6=_0xa3ba[_0x5e28c2];return _0x1a8cc6;};'use strict';var Sequelize=require(_0xaa3b('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xaa3b('0x1')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xaa3b('0x2')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0xaa3b('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xaa3b('0x1')],'allowNull':![],'defaultValue':_0xaa3b('0x3')},'fontSize':{'type':Sequelize[_0xaa3b('0x4')](0x2)[_0xaa3b('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xaa3b('0x6');}},'notificationSound':{'type':Sequelize[_0xaa3b('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xaa3b('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xaa3b('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xaa3b('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xaa3b('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xaa3b('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0xaa3b('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xaa3b('0x8'),'set':function(_0x4d897c){if(!_0x4d897c)this[_0xaa3b('0x9')]('mandatoryDispositionPauseId',null);this[_0xaa3b('0x9')](_0xaa3b('0xa'),_0x4d897c);}},'provider':{'type':Sequelize[_0xaa3b('0xb')](_0xaa3b('0xc'),_0xaa3b('0xd'),_0xaa3b('0xe'),'outlook365'),'defaultValue':null,'get':function(){if(!this[_0xaa3b('0xf')]('provider'))return _0xaa3b('0x10');return this[_0xaa3b('0xf')]('provider');},'set':function(_0x2d7479){if(_0x2d7479===_0xaa3b('0x10'))_0x2d7479=null;return this[_0xaa3b('0x9')]('provider',_0x2d7479);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 8052017..5be44d8 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 _0x3db8=['filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','params','fields','includeAll','find','body','provider','custom','Smtp','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','create','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','hasOwnProperty','CannedAnswer','findAll','removeAnswers','email','ListId','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MailAccounts','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','getSmtp','addSmtp','removeSmtp','addInteraction','MailInteraction','getInteractions','Contact','Owner','fullname','Tag','Tags','color','tag','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','findAndCountAll','finally','getApplications','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','true','CmList','List','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','server/files/attachments','basename','getSmtpOptions','List\x20not\x20found','messageId','subject','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','User','moment','util','path','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','localhost','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','update','destroy','get','stack','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.mail.yahoo.com','hotmail','user','username','pass','password','modernAuthentication','CloudProviderId','port','host','secure','service','authentication','Imap','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0xe7ea8d,_0x5a0ce8){var _0x2187de=function(_0x3df1fa){while(--_0x3df1fa){_0xe7ea8d['push'](_0xe7ea8d['shift']());}};_0x2187de(++_0x5a0ce8);}(_0x3db8,0x1e9));var _0x83db=function(_0x41d477,_0x2b496e){_0x41d477=_0x41d477-0x0;var _0x490217=_0x3db8[_0x41d477];return _0x490217;};'use strict';var moment=require(_0x83db('0x0'));var BPromise=require('bluebird');var util=require(_0x83db('0x1'));var path=require(_0x83db('0x2'));var _=require(_0x83db('0x3'));var juice=require('juice');var Redis=require('ioredis');var qs=require(_0x83db('0x4'));var logger=require(_0x83db('0x5'))(_0x83db('0x6'));var config=require('../../config/environment');var db=require(_0x83db('0x7'))['db'];config[_0x83db('0x8')]=_['defaults'](config[_0x83db('0x8')],{'host':_0x83db('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x83db('0x8')]));require(_0x83db('0xa'))[_0x83db('0xb')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232b});function respondWithRpcPromise(_0x5c9c96,_0x47e24d,_0x448998,_0x33d41b){return new BPromise(function(_0x2d1079,_0x1b0bfd){var _0x2fb170=_0x33d41b||client;return _0x2fb170[_0x83db('0xc')](_0x5c9c96,_0x448998)[_0x83db('0xd')](function(_0x4615aa){logger[_0x83db('0xe')](_0x83db('0xf'),_0x47e24d,_0x83db('0x10'));logger[_0x83db('0x11')](_0x83db('0x12'),_0x47e24d,_0x83db('0x10'),JSON['stringify'](_0x4615aa));if(_0x4615aa['error']){if(_0x4615aa['error']['code']===0x1f4){logger[_0x83db('0x13')](_0x83db('0xf'),_0x47e24d,_0x4615aa[_0x83db('0x13')][_0x83db('0x14')]);return _0x1b0bfd(_0x4615aa[_0x83db('0x13')]['message']);}logger[_0x83db('0x13')](_0x83db('0xf'),_0x47e24d,_0x4615aa['error'][_0x83db('0x14')]);return _0x2d1079(_0x4615aa['error']['message']);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x47e24d,_0x83db('0x10'));_0x2d1079(_0x4615aa[_0x83db('0x15')]['message']);}})['catch'](function(_0x3be028){logger[_0x83db('0x13')]('MailAccount,\x20%s,\x20%s',_0x47e24d,_0x3be028);_0x1b0bfd(_0x3be028);});});}function respondWithStatusCode(_0x26900a,_0x42c164){_0x42c164=_0x42c164||0xcc;return function(_0x3d8ac0){if(_0x3d8ac0){return _0x26900a[_0x83db('0x16')](_0x42c164);}return _0x26900a[_0x83db('0x17')](_0x42c164)[_0x83db('0x18')]();};}function respondWithResult(_0x25889d,_0x569856){_0x569856=_0x569856||0xc8;return function(_0x2f0f12){if(_0x2f0f12){return _0x25889d[_0x83db('0x17')](_0x569856)[_0x83db('0x19')](_0x2f0f12);}};}function respondWithFilteredResult(_0x2ca37f,_0x11c5fe){return function(_0x44b07f){if(_0x44b07f){var _0x328e8d=typeof _0x11c5fe[_0x83db('0x1a')]===_0x83db('0x1b')&&typeof _0x11c5fe[_0x83db('0x1c')]==='undefined';var _0x2c618e=_0x44b07f[_0x83db('0x1d')];var _0xd3201c=_0x328e8d?0x0:_0x11c5fe[_0x83db('0x1a')];var _0x5047e3=_0x328e8d?_0x44b07f[_0x83db('0x1d')]:_0x11c5fe[_0x83db('0x1a')]+_0x11c5fe[_0x83db('0x1c')];var _0x4bd0d9;if(_0x5047e3>=_0x2c618e){_0x5047e3=_0x2c618e;_0x4bd0d9=0xc8;}else{_0x4bd0d9=0xce;}_0x2ca37f[_0x83db('0x17')](_0x4bd0d9);return _0x2ca37f[_0x83db('0x1e')]('Content-Range',_0xd3201c+'-'+_0x5047e3+'/'+_0x2c618e)[_0x83db('0x19')](_0x44b07f);}return null;};}function saveUpdates(_0x2f9e6a){return function(_0x4d5760){if(_0x4d5760){return _0x4d5760[_0x83db('0x1f')](_0x2f9e6a)[_0x83db('0xd')](function(_0x19f1ed){return _0x19f1ed;});}return null;};}function removeEntity(_0x542e1e){return function(_0x188ed3){if(_0x188ed3){return _0x188ed3[_0x83db('0x20')]()[_0x83db('0xd')](function(){var _0x2b8d40=_0x188ed3[_0x83db('0x21')]({'plain':!![]});var _0x1ce6b3='MailAccounts';return db['UserProfileResource']['destroy']({'where':{'type':_0x1ce6b3,'resourceId':_0x2b8d40['id']}})[_0x83db('0xd')](function(){return _0x188ed3;});})['then'](function(){_0x542e1e['status'](0xcc)[_0x83db('0x18')]();});}};}function handleEntityNotFound(_0x346796){return function(_0x1b8e85){if(!_0x1b8e85){_0x346796[_0x83db('0x16')](0x194);}return _0x1b8e85;};}function handleError(_0x19ca9d,_0x2d6720){_0x2d6720=_0x2d6720||0x1f4;return function(_0x269861){logger[_0x83db('0x13')](_0x269861[_0x83db('0x22')]);if(_0x269861['name']){delete _0x269861[_0x83db('0x23')];}_0x19ca9d[_0x83db('0x17')](_0x2d6720)[_0x83db('0x24')](_0x269861);};}function getImapHost(_0x487adf){switch(_0x487adf){case _0x83db('0x25'):return _0x83db('0x26');case _0x83db('0x27'):return _0x83db('0x28');case'hotmail':return _0x83db('0x29');case'outlook365':return _0x83db('0x2a');}throw new Error(_0x83db('0x2b'),_0x487adf);}function getSmtpHost(_0x1fa01c){switch(_0x1fa01c){case'gmail':return'smtp.gmail.com';case'yahoo':return _0x83db('0x2c');case _0x83db('0x2d'):return'smtp-mail.outlook.com';case'outlook365':return'smtp.office365.com';}throw new Error(_0x83db('0x2b'),_0x1fa01c);}function getAuthenticationOptions(_0xcab085,_0x569f34){var _0x13a566={};var _0x32447d={};if(_0xcab085){_0x13a566[_0x83db('0x2e')]=_0x32447d['user']=_0x569f34[_0x83db('0x2f')];_0x13a566['password']=_0x32447d[_0x83db('0x30')]=_0x569f34[_0x83db('0x31')];if(_0x569f34['modernAuthentication']){_0x13a566['modernAuthentication']=_0x32447d[_0x83db('0x32')]=!![];_0x13a566[_0x83db('0x33')]=_0x32447d[_0x83db('0x33')]=_0x569f34[_0x83db('0x33')];_0x13a566[_0x83db('0x31')]=_0x32447d[_0x83db('0x30')]=null;}else{_0x13a566['CloudProviderId']=_0x32447d[_0x83db('0x33')]=null;}_0x13a566['host']=getImapHost(_0xcab085);_0x13a566[_0x83db('0x34')]=0x3e1;_0x32447d[_0x83db('0x35')]=getSmtpHost(_0xcab085);_0x32447d[_0x83db('0x34')]=0x24b;_0x32447d[_0x83db('0x36')]=![];_0x13a566[_0x83db('0x37')]=_0x32447d[_0x83db('0x37')]=null;}else{if(_0x569f34['authentication']){_0x13a566[_0x83db('0x2e')]=_0x32447d[_0x83db('0x2e')]=_0x569f34[_0x83db('0x2f')];_0x13a566[_0x83db('0x31')]=_0x32447d[_0x83db('0x30')]=_0x569f34[_0x83db('0x31')];}else{_0x13a566[_0x83db('0x38')]=_0x32447d[_0x83db('0x38')]=![];_0x13a566['user']=_0x32447d[_0x83db('0x2e')]=null;_0x13a566['password']=_0x32447d[_0x83db('0x30')]=null;}_0x13a566[_0x83db('0x35')]=_0x569f34['Imap'][_0x83db('0x35')];_0x13a566[_0x83db('0x34')]=_0x569f34[_0x83db('0x39')][_0x83db('0x34')];_0x32447d[_0x83db('0x35')]=_0x569f34['Smtp']['host'];_0x32447d[_0x83db('0x34')]=_0x569f34['Smtp'][_0x83db('0x34')];}return{'Imap':_0x13a566,'Smtp':_0x32447d};}exports[_0x83db('0x3a')]=function(_0x3997dc,_0x12892d){var _0x12b7e4={'include':[{'model':db[_0x83db('0x3b')],'as':_0x83db('0x39')},{'model':db[_0x83db('0x3c')],'as':'Smtp'},{'model':db[_0x83db('0x3d')],'as':_0x83db('0x3e')}]},_0x478b81={},_0x135af5={'count':0x0,'rows':[]};var _0xa8cc5d=_[_0x83db('0x3f')](db[_0x83db('0x40')][_0x83db('0x41')],function(_0x2fefaf){return{'name':_0x2fefaf[_0x83db('0x42')],'type':_0x2fefaf[_0x83db('0x43')][_0x83db('0x44')]};});_0x478b81[_0x83db('0x45')]=_[_0x83db('0x3f')](_0xa8cc5d,'name');_0x478b81[_0x83db('0x46')]=_[_0x83db('0x47')](_0x3997dc[_0x83db('0x46')]);_0x478b81[_0x83db('0x48')]=_[_0x83db('0x49')](_0x478b81[_0x83db('0x45')],_0x478b81['query']);_0x12b7e4[_0x83db('0x4a')]=_['intersection'](_0x478b81['model'],qs['fields'](_0x3997dc[_0x83db('0x46')]['fields']));_0x12b7e4[_0x83db('0x4a')]=_0x12b7e4[_0x83db('0x4a')][_0x83db('0x4b')]?_0x12b7e4[_0x83db('0x4a')]:_0x478b81[_0x83db('0x45')];if(!_0x3997dc[_0x83db('0x46')]['hasOwnProperty'](_0x83db('0x4c'))){_0x12b7e4[_0x83db('0x1c')]=qs[_0x83db('0x1c')](_0x3997dc[_0x83db('0x46')][_0x83db('0x1c')]);_0x12b7e4[_0x83db('0x1a')]=qs[_0x83db('0x1a')](_0x3997dc[_0x83db('0x46')]['offset']);}_0x12b7e4[_0x83db('0x4d')]=qs[_0x83db('0x4e')](_0x3997dc['query'][_0x83db('0x4e')]);_0x12b7e4[_0x83db('0x4f')]=qs[_0x83db('0x48')](_[_0x83db('0x50')](_0x3997dc['query'],_0x478b81[_0x83db('0x48')]),_0xa8cc5d);if(_0x3997dc['query'][_0x83db('0x51')]){_0x12b7e4[_0x83db('0x4f')]=_[_0x83db('0x52')](_0x12b7e4['where'],{'$or':_['map'](_0xa8cc5d,function(_0x2ea62b){if(_0x2ea62b[_0x83db('0x43')]!==_0x83db('0x53')){var _0x12ca78={};_0x12ca78[_0x2ea62b['name']]={'$like':'%'+_0x3997dc[_0x83db('0x46')][_0x83db('0x51')]+'%'};return _0x12ca78;}})});}_0x12b7e4=_[_0x83db('0x52')]({},_0x12b7e4,_0x3997dc[_0x83db('0x54')]);var _0x1a47ce={'where':_0x12b7e4[_0x83db('0x4f')]};return db[_0x83db('0x40')]['count'](_0x1a47ce)['then'](function(_0xd72b9){_0x135af5[_0x83db('0x1d')]=_0xd72b9;if(_0x3997dc['query']['includeAll']){_0x12b7e4[_0x83db('0x55')]=[{'all':!![]}];}return db[_0x83db('0x40')]['findAll'](_0x12b7e4);})[_0x83db('0xd')](function(_0xc38c9f){_0x135af5[_0x83db('0x56')]=_0xc38c9f;return _0x135af5;})[_0x83db('0xd')](respondWithFilteredResult(_0x12892d,_0x12b7e4))[_0x83db('0x57')](handleError(_0x12892d,null));};exports['show']=function(_0xf6d19f,_0x36df05){var _0x385265={'raw':![],'where':{'id':_0xf6d19f[_0x83db('0x58')]['id']},'include':[{'model':db[_0x83db('0x3b')],'as':_0x83db('0x39')},{'model':db[_0x83db('0x3c')],'as':'Smtp'},{'model':db['Pause'],'as':_0x83db('0x3e')}]},_0x5f28c4={};_0x5f28c4[_0x83db('0x45')]=_[_0x83db('0x47')](db[_0x83db('0x40')][_0x83db('0x41')]);_0x5f28c4['query']=_[_0x83db('0x47')](_0xf6d19f['query']);_0x5f28c4['filters']=_[_0x83db('0x49')](_0x5f28c4[_0x83db('0x45')],_0x5f28c4[_0x83db('0x46')]);_0x385265[_0x83db('0x4a')]=_[_0x83db('0x49')](_0x5f28c4['model'],qs[_0x83db('0x59')](_0xf6d19f[_0x83db('0x46')][_0x83db('0x59')]));_0x385265[_0x83db('0x4a')]=_0x385265[_0x83db('0x4a')][_0x83db('0x4b')]?_0x385265[_0x83db('0x4a')]:_0x5f28c4[_0x83db('0x45')];if(_0xf6d19f[_0x83db('0x46')][_0x83db('0x5a')]){_0x385265[_0x83db('0x55')]=[{'all':!![]}];}_0x385265=_['merge']({},_0x385265,_0xf6d19f[_0x83db('0x54')]);return db[_0x83db('0x40')][_0x83db('0x5b')](_0x385265)[_0x83db('0xd')](handleEntityNotFound(_0x36df05,null))[_0x83db('0xd')](respondWithResult(_0x36df05,null))[_0x83db('0x57')](handleError(_0x36df05,null));};exports[_0x83db('0x1f')]=function(_0x55566b,_0x212706){if(_0x55566b[_0x83db('0x5c')]['id']){delete _0x55566b[_0x83db('0x5c')]['id'];}var _0x139fcd=_0x55566b['body'][_0x83db('0x5d')]===_0x83db('0x5e')?null:_0x55566b[_0x83db('0x5c')][_0x83db('0x5d')];var _0x393eb5=_0x55566b[_0x83db('0x5c')]['Imap']||{};var _0x1cb49c=_0x55566b[_0x83db('0x5c')][_0x83db('0x5f')]||{};if(_0x139fcd){_0x393eb5['host']=getImapHost(_0x139fcd);_0x393eb5[_0x83db('0x34')]=0x3e1;_0x1cb49c['host']=getSmtpHost(_0x139fcd);_0x1cb49c[_0x83db('0x34')]=0x24b;_0x1cb49c[_0x83db('0x36')]=![];}if(_0x1cb49c[_0x83db('0x32')]){_0x1cb49c['secure']=![];}else{_0x1cb49c[_0x83db('0x33')]=null;}if(!_0x393eb5[_0x83db('0x32')])_0x393eb5[_0x83db('0x33')]=null;_0x55566b['body'][_0x83db('0x39')]=_0x393eb5;_0x55566b[_0x83db('0x5c')][_0x83db('0x5f')]=_0x1cb49c;return db[_0x83db('0x40')][_0x83db('0x5b')]({'where':{'id':_0x55566b[_0x83db('0x58')]['id']},'include':[{'model':db[_0x83db('0x3b')],'as':'Imap'},{'model':db[_0x83db('0x3c')],'as':_0x83db('0x5f')},{'model':db[_0x83db('0x3d')],'as':'mandatoryDispositionPause'}]})[_0x83db('0xd')](handleEntityNotFound(_0x212706,null))['then'](function(_0x50b95d){if(!_0x50b95d)throw new Error(_0x83db('0x60'));if(_0x50b95d[_0x83db('0x37')])delete _0x55566b[_0x83db('0x5c')][_0x83db('0x39')];return _0x50b95d;})[_0x83db('0xd')](saveUpdates(_0x55566b[_0x83db('0x5c')],null))[_0x83db('0xd')](function(_0xc89fe6){if(!_0x55566b[_0x83db('0x5c')]['Imap'])return _0xc89fe6;return db['MailServerIn']['update'](_0x55566b[_0x83db('0x5c')][_0x83db('0x39')],{'where':{'MailAccountId':_0xc89fe6['id']}})[_0x83db('0xd')](function(){return _0xc89fe6;});})[_0x83db('0xd')](function(_0x4e58d0){if(!_0x55566b['body'][_0x83db('0x5f')])return _0x4e58d0;return db[_0x83db('0x3c')][_0x83db('0x1f')](_0x55566b[_0x83db('0x5c')][_0x83db('0x5f')],{'where':{'MailAccountId':_0x4e58d0['id']}})[_0x83db('0xd')](function(){return _0x4e58d0;});})[_0x83db('0xd')](respondWithResult(_0x212706,null))[_0x83db('0x57')](handleError(_0x212706,null));};exports[_0x83db('0x61')]=function(_0x5de8b9,_0x182fbc){return db[_0x83db('0x40')][_0x83db('0x61')]()[_0x83db('0xd')](respondWithResult(_0x182fbc,null))['catch'](handleError(_0x182fbc,null));};exports[_0x83db('0x62')]=function(_0x117037,_0x4011d0){if(_0x117037[_0x83db('0x5c')]['id']){delete _0x117037[_0x83db('0x5c')]['id'];}return db[_0x83db('0x40')][_0x83db('0x5b')]({'where':{'id':_0x117037[_0x83db('0x58')]['id']}})[_0x83db('0xd')](handleEntityNotFound(_0x4011d0,null))[_0x83db('0xd')](function(_0x423cfc){if(_0x423cfc){_0x117037['body'][_0x83db('0x63')]=_0x423cfc['id'];return db['Disposition'][_0x83db('0x64')](_0x117037['body']);}})[_0x83db('0xd')](respondWithResult(_0x4011d0,null))[_0x83db('0x57')](handleError(_0x4011d0,null));};exports[_0x83db('0x65')]=function(_0x123def,_0x577f71){var _0x29cce2={'raw':![],'where':{}};var _0x295d41={};var _0x2e8e4f={'count':0x0,'rows':[]};return db['MailAccount'][_0x83db('0x66')]({'where':{'id':_0x123def[_0x83db('0x58')]['id']}})[_0x83db('0xd')](handleEntityNotFound(_0x577f71,null))[_0x83db('0xd')](function(_0x266f5d){if(_0x266f5d){_0x295d41[_0x83db('0x45')]=_['keys'](db['Disposition'][_0x83db('0x41')]);_0x295d41[_0x83db('0x46')]=_[_0x83db('0x47')](_0x123def[_0x83db('0x46')]);_0x295d41[_0x83db('0x48')]=_[_0x83db('0x49')](_0x295d41[_0x83db('0x45')],_0x295d41[_0x83db('0x46')]);_0x29cce2['attributes']=_[_0x83db('0x49')](_0x295d41['model'],qs[_0x83db('0x59')](_0x123def[_0x83db('0x46')][_0x83db('0x59')]));_0x29cce2['attributes']=_0x29cce2[_0x83db('0x4a')][_0x83db('0x4b')]?_0x29cce2['attributes']:_0x295d41[_0x83db('0x45')];if(!_0x123def['query']['hasOwnProperty']('nolimit')){_0x29cce2['limit']=qs['limit'](_0x123def[_0x83db('0x46')][_0x83db('0x1c')]);_0x29cce2['offset']=qs['offset'](_0x123def[_0x83db('0x46')][_0x83db('0x1a')]);}_0x29cce2[_0x83db('0x4d')]=qs[_0x83db('0x4e')](_0x123def[_0x83db('0x46')][_0x83db('0x4e')]);_0x29cce2[_0x83db('0x4f')]=qs[_0x83db('0x48')](_['pick'](_0x123def[_0x83db('0x46')],_0x295d41[_0x83db('0x48')]));_0x29cce2[_0x83db('0x4f')][_0x83db('0x63')]=_0x266f5d['id'];if(_0x123def[_0x83db('0x46')][_0x83db('0x51')]){_0x29cce2['where']=_[_0x83db('0x52')](_0x29cce2['where'],{'$or':_['map'](_0x29cce2['attributes'],function(_0x14e7c6){var _0x50a61e={};_0x50a61e[_0x14e7c6]={'$like':'%'+_0x123def[_0x83db('0x46')]['filter']+'%'};return _0x50a61e;})});}_0x29cce2=_[_0x83db('0x52')]({},_0x29cce2,_0x123def[_0x83db('0x54')]);return db[_0x83db('0x67')]['count']({'where':_0x29cce2[_0x83db('0x4f')]})[_0x83db('0xd')](function(_0x5e36b4){_0x2e8e4f[_0x83db('0x1d')]=_0x5e36b4;if(_0x123def[_0x83db('0x46')][_0x83db('0x5a')]){_0x29cce2[_0x83db('0x55')]=[{'all':!![]}];}return db[_0x83db('0x67')]['findAll'](_0x29cce2);})[_0x83db('0xd')](function(_0x794596){_0x2e8e4f[_0x83db('0x56')]=_0x794596;return _0x2e8e4f;});}})['then'](respondWithFilteredResult(_0x577f71,_0x29cce2))[_0x83db('0x57')](handleError(_0x577f71,null));};exports[_0x83db('0x68')]=function(_0x3cc51e,_0x288a32){return db['MailAccount'][_0x83db('0x5b')]({'where':{'id':_0x3cc51e[_0x83db('0x58')]['id']}})[_0x83db('0xd')](handleEntityNotFound(_0x288a32,null))['then'](function(_0x1e7e5d){if(_0x1e7e5d){return _0x1e7e5d['removeDispositions'](_0x3cc51e['query'][_0x83db('0x69')]);}})[_0x83db('0xd')](respondWithStatusCode(_0x288a32,null))[_0x83db('0x57')](handleError(_0x288a32,null));};exports[_0x83db('0x6a')]=function(_0x310936,_0x343103){if(_0x310936[_0x83db('0x5c')]['id']){delete _0x310936['body']['id'];}return db[_0x83db('0x40')][_0x83db('0x5b')]({'where':{'id':_0x310936[_0x83db('0x58')]['id']}})[_0x83db('0xd')](handleEntityNotFound(_0x343103,null))[_0x83db('0xd')](function(_0x35312c){if(_0x35312c){_0x310936[_0x83db('0x5c')][_0x83db('0x63')]=_0x35312c['id'];return db['CannedAnswer']['create'](_0x310936[_0x83db('0x5c')]);}})[_0x83db('0xd')](respondWithResult(_0x343103,null))[_0x83db('0x57')](handleError(_0x343103,null));};exports['getAnswers']=function(_0x18e8da,_0x170481){var _0x3ff83f={'raw':![],'where':{}};var _0x31c158={};var _0x5522bc={'count':0x0,'rows':[]};return db[_0x83db('0x40')][_0x83db('0x66')]({'where':{'id':_0x18e8da[_0x83db('0x58')]['id']}})[_0x83db('0xd')](handleEntityNotFound(_0x170481,null))[_0x83db('0xd')](function(_0x369dcb){if(_0x369dcb){_0x31c158['model']=_['keys'](db['CannedAnswer'][_0x83db('0x41')]);_0x31c158[_0x83db('0x46')]=_[_0x83db('0x47')](_0x18e8da[_0x83db('0x46')]);_0x31c158[_0x83db('0x48')]=_[_0x83db('0x49')](_0x31c158[_0x83db('0x45')],_0x31c158[_0x83db('0x46')]);_0x3ff83f[_0x83db('0x4a')]=_[_0x83db('0x49')](_0x31c158['model'],qs[_0x83db('0x59')](_0x18e8da['query'][_0x83db('0x59')]));_0x3ff83f[_0x83db('0x4a')]=_0x3ff83f[_0x83db('0x4a')][_0x83db('0x4b')]?_0x3ff83f[_0x83db('0x4a')]:_0x31c158[_0x83db('0x45')];if(!_0x18e8da[_0x83db('0x46')][_0x83db('0x6b')](_0x83db('0x4c'))){_0x3ff83f[_0x83db('0x1c')]=qs[_0x83db('0x1c')](_0x18e8da[_0x83db('0x46')][_0x83db('0x1c')]);_0x3ff83f[_0x83db('0x1a')]=qs['offset'](_0x18e8da[_0x83db('0x46')][_0x83db('0x1a')]);}_0x3ff83f[_0x83db('0x4d')]=qs[_0x83db('0x4e')](_0x18e8da[_0x83db('0x46')]['sort']);_0x3ff83f[_0x83db('0x4f')]=qs[_0x83db('0x48')](_['pick'](_0x18e8da[_0x83db('0x46')],_0x31c158[_0x83db('0x48')]));_0x3ff83f[_0x83db('0x4f')]['MailAccountId']=_0x369dcb['id'];if(_0x18e8da[_0x83db('0x46')]['filter']){_0x3ff83f['where']=_[_0x83db('0x52')](_0x3ff83f[_0x83db('0x4f')],{'$or':_[_0x83db('0x3f')](_0x3ff83f['attributes'],function(_0x381eb1){var _0x2098cf={};_0x2098cf[_0x381eb1]={'$like':'%'+_0x18e8da[_0x83db('0x46')]['filter']+'%'};return _0x2098cf;})});}_0x3ff83f=_[_0x83db('0x52')]({},_0x3ff83f,_0x18e8da[_0x83db('0x54')]);return db[_0x83db('0x6c')][_0x83db('0x1d')]({'where':_0x3ff83f[_0x83db('0x4f')]})['then'](function(_0x668ce0){_0x5522bc[_0x83db('0x1d')]=_0x668ce0;if(_0x18e8da[_0x83db('0x46')][_0x83db('0x5a')]){_0x3ff83f[_0x83db('0x55')]=[{'all':!![]}];}return db[_0x83db('0x6c')][_0x83db('0x6d')](_0x3ff83f);})[_0x83db('0xd')](function(_0x4dcbe5){_0x5522bc['rows']=_0x4dcbe5;return _0x5522bc;});}})[_0x83db('0xd')](respondWithFilteredResult(_0x170481,_0x3ff83f))['catch'](handleError(_0x170481,null));};exports[_0x83db('0x6e')]=function(_0x5714c3,_0x563cfc){return db['MailAccount'][_0x83db('0x5b')]({'where':{'id':_0x5714c3[_0x83db('0x58')]['id']}})['then'](handleEntityNotFound(_0x563cfc,null))[_0x83db('0xd')](function(_0x8a0fca){if(_0x8a0fca){return _0x8a0fca['removeAnswers'](_0x5714c3[_0x83db('0x46')]['ids']);}})[_0x83db('0xd')](respondWithStatusCode(_0x563cfc,null))['catch'](handleError(_0x563cfc,null));};exports[_0x83db('0x64')]=function(_0x589243,_0x252256){var _0x3c15e3={'name':_0x589243[_0x83db('0x5c')]['name'],'key':_0x589243[_0x83db('0x5c')]['key'],'provider':_0x589243[_0x83db('0x5c')]['provider']==='custom'?null:_0x589243[_0x83db('0x5c')][_0x83db('0x5d')],'email':_0x589243[_0x83db('0x5c')][_0x83db('0x6f')],'ListId':_0x589243['body'][_0x83db('0x70')],'active':!_['isNil'](_0x589243[_0x83db('0x5c')][_0x83db('0x71')])?_0x589243[_0x83db('0x5c')][_0x83db('0x71')]:!![],'description':_0x589243[_0x83db('0x5c')][_0x83db('0x72')]||null};var _0x39dd6a=getAuthenticationOptions(_0x3c15e3['provider'],_0x589243['body']);_0x3c15e3[_0x83db('0x39')]=_0x39dd6a['Imap'];_0x3c15e3[_0x83db('0x5f')]=_0x39dd6a[_0x83db('0x5f')];return db['MailAccount'][_0x83db('0x64')](_0x3c15e3,{'include':[{'model':db['MailServerOut'],'as':'Smtp'},{'model':db['MailServerIn'],'as':_0x83db('0x39')}]})[_0x83db('0xd')](function(_0x31aa96){var _0x5bdb50=_0x589243['user'][_0x83db('0x21')]({'plain':!![]});if(!_0x5bdb50)throw new Error(_0x83db('0x73'));if(_0x5bdb50[_0x83db('0x74')]===_0x83db('0x2e')){var _0x5b867c=_0x31aa96[_0x83db('0x21')]({'plain':!![]});return db[_0x83db('0x75')][_0x83db('0x5b')]({'where':{'name':_0x83db('0x76'),'userProfileId':_0x5bdb50[_0x83db('0x77')]},'raw':!![]})[_0x83db('0xd')](function(_0x330656){if(_0x330656&&_0x330656[_0x83db('0x78')]===0x0){return db[_0x83db('0x79')][_0x83db('0x64')]({'name':_0x5b867c[_0x83db('0x23')],'resourceId':_0x5b867c['id'],'type':_0x330656['name'],'sectionId':_0x330656['id']},{})[_0x83db('0xd')](function(){return _0x31aa96;});}else{return _0x31aa96;}})[_0x83db('0x57')](function(_0x5e19dc){logger[_0x83db('0x13')](_0x83db('0x7a'),_0x5e19dc);throw _0x5e19dc;});}return _0x31aa96;})[_0x83db('0xd')](respondWithResult(_0x252256,0xc9))[_0x83db('0x57')](handleError(_0x252256,null));};exports[_0x83db('0x7b')]=function(_0x4e6b1f,_0x5f7dfe){return db['MailAccount'][_0x83db('0x66')]({'where':{'id':_0x4e6b1f[_0x83db('0x58')]['id']}})[_0x83db('0xd')](handleEntityNotFound(_0x5f7dfe,null))[_0x83db('0xd')](function(_0xc43ec0){if(_0xc43ec0){return _0xc43ec0[_0x83db('0x7b')]();}return null;})[_0x83db('0xd')](respondWithResult(_0x5f7dfe,null))[_0x83db('0x57')](handleError(_0x5f7dfe,null));};exports[_0x83db('0x7c')]=function(_0x47060d,_0x4976f6){if(_0x47060d[_0x83db('0x5c')]['id']){delete _0x47060d[_0x83db('0x5c')]['id'];}return db[_0x83db('0x40')][_0x83db('0x5b')]({'where':{'id':_0x47060d['params']['id']}})['then'](handleEntityNotFound(_0x4976f6,null))['then'](function(_0x2abeb1){if(_0x2abeb1){_0x47060d[_0x83db('0x5c')][_0x83db('0x63')]=_0x2abeb1['id'];return db[_0x83db('0x3b')]['create'](_0x47060d[_0x83db('0x5c')]);}})[_0x83db('0xd')](respondWithResult(_0x4976f6,null))[_0x83db('0x57')](handleError(_0x4976f6,null));};exports[_0x83db('0x7d')]=function(_0xbc2bf3,_0x4e722f){return db[_0x83db('0x40')][_0x83db('0x66')]({'where':{'id':_0xbc2bf3[_0x83db('0x58')]['id']}})['then'](handleEntityNotFound(_0x4e722f,null))[_0x83db('0xd')](function(_0x246205){if(_0x246205){return _0x246205['setImap'](null);}return null;})[_0x83db('0xd')](respondWithStatusCode(_0x4e722f,null))[_0x83db('0x57')](handleError(_0x4e722f,null));};exports['getSmtp']=function(_0xca14ee,_0x47d8d3){return db['MailAccount'][_0x83db('0x66')]({'where':{'id':_0xca14ee['params']['id']}})[_0x83db('0xd')](handleEntityNotFound(_0x47d8d3,null))[_0x83db('0xd')](function(_0x4be5e0){if(_0x4be5e0){return _0x4be5e0[_0x83db('0x7e')]();}return null;})[_0x83db('0xd')](respondWithResult(_0x47d8d3,null))[_0x83db('0x57')](handleError(_0x47d8d3,null));};exports[_0x83db('0x7f')]=function(_0x1621f9,_0x36fe8a){if(_0x1621f9[_0x83db('0x5c')]['id']){delete _0x1621f9[_0x83db('0x5c')]['id'];}return db[_0x83db('0x40')][_0x83db('0x5b')]({'where':{'id':_0x1621f9['params']['id']}})[_0x83db('0xd')](handleEntityNotFound(_0x36fe8a,null))[_0x83db('0xd')](function(_0xdca1dd){if(_0xdca1dd){_0x1621f9[_0x83db('0x5c')]['MailAccountId']=_0xdca1dd['id'];return db[_0x83db('0x3c')][_0x83db('0x64')](_0x1621f9[_0x83db('0x5c')]);}})[_0x83db('0xd')](respondWithResult(_0x36fe8a,null))[_0x83db('0x57')](handleError(_0x36fe8a,null));};exports[_0x83db('0x80')]=function(_0x137058,_0x336518){return db[_0x83db('0x40')]['findOne']({'where':{'id':_0x137058[_0x83db('0x58')]['id']}})[_0x83db('0xd')](handleEntityNotFound(_0x336518,null))['then'](function(_0x788968){if(_0x788968){return _0x788968['setSmtp'](null);}return null;})[_0x83db('0xd')](respondWithStatusCode(_0x336518,null))[_0x83db('0x57')](handleError(_0x336518,null));};exports[_0x83db('0x81')]=function(_0x1b3d3e,_0x40ad64){return db[_0x83db('0x82')][_0x83db('0x5b')]({'where':{'id':_0x1b3d3e['params']['id']}})['then'](handleEntityNotFound(_0x40ad64,null))[_0x83db('0xd')](function(_0x20284f){if(_0x20284f){return _0x20284f[_0x83db('0x81')](_0x1b3d3e['body'][_0x83db('0x69')],_['omit'](_0x1b3d3e[_0x83db('0x5c')],[_0x83db('0x69'),'id'])||{});}})['then'](respondWithResult(_0x40ad64,null))[_0x83db('0x57')](handleError(_0x40ad64,null));};exports[_0x83db('0x83')]=function(_0x36618a,_0x5d65a6){var _0x46e71a={'raw':![],'where':{}};var _0x759bdc={};var _0x39e867={'count':0x0,'rows':[]};return db[_0x83db('0x40')][_0x83db('0x66')]({'where':{'id':_0x36618a[_0x83db('0x58')]['id']}})[_0x83db('0xd')](handleEntityNotFound(_0x5d65a6,null))[_0x83db('0xd')](function(_0x18101e){if(_0x18101e){_0x759bdc[_0x83db('0x45')]=_['keys'](db[_0x83db('0x82')]['rawAttributes']);_0x759bdc[_0x83db('0x46')]=_[_0x83db('0x47')](_0x36618a[_0x83db('0x46')]);_0x759bdc[_0x83db('0x48')]=_[_0x83db('0x49')](_0x759bdc[_0x83db('0x45')],_0x759bdc[_0x83db('0x46')]);_0x46e71a[_0x83db('0x4a')]=_[_0x83db('0x49')](_0x759bdc[_0x83db('0x45')],qs['fields'](_0x36618a[_0x83db('0x46')]['fields']));_0x46e71a['attributes']=_0x46e71a[_0x83db('0x4a')][_0x83db('0x4b')]?_0x46e71a[_0x83db('0x4a')]:_0x759bdc['model'];if(!_0x36618a['query'][_0x83db('0x6b')](_0x83db('0x4c'))){_0x46e71a['limit']=qs[_0x83db('0x1c')](_0x36618a[_0x83db('0x46')][_0x83db('0x1c')]);_0x46e71a['offset']=qs[_0x83db('0x1a')](_0x36618a[_0x83db('0x46')]['offset']);}_0x46e71a['order']=qs[_0x83db('0x4e')](_0x36618a[_0x83db('0x46')][_0x83db('0x4e')]);_0x46e71a[_0x83db('0x4f')]=qs[_0x83db('0x48')](_[_0x83db('0x50')](_0x36618a['query'],_0x759bdc['filters']));_0x46e71a[_0x83db('0x4f')][_0x83db('0x63')]=_0x18101e['id'];if(_0x36618a['query'][_0x83db('0x51')]){_0x46e71a['where']=_['merge'](_0x46e71a[_0x83db('0x4f')],{'$or':_[_0x83db('0x3f')](_0x46e71a['attributes'],function(_0x5b98e9){var _0x543f9d={};_0x543f9d[_0x5b98e9]={'$like':'%'+_0x36618a['query'][_0x83db('0x51')]+'%'};return _0x543f9d;})});}_0x46e71a=_[_0x83db('0x52')]({},_0x46e71a,_0x36618a['options']);return db[_0x83db('0x82')][_0x83db('0x1d')]({'where':_0x46e71a[_0x83db('0x4f')]})[_0x83db('0xd')](function(_0xd58a81){_0x39e867[_0x83db('0x1d')]=_0xd58a81;if(_0x36618a[_0x83db('0x46')][_0x83db('0x5a')]){_0x46e71a[_0x83db('0x55')]=[{'model':db['CmContact'],'as':_0x83db('0x84'),'required':![]},{'model':db['User'],'as':_0x83db('0x85'),'attributes':[_0x83db('0x23'),_0x83db('0x86'),'internal'],'required':![]},{'model':db[_0x83db('0x87')],'as':_0x83db('0x88'),'attributes':['id',_0x83db('0x23'),_0x83db('0x89')],'where':_0x36618a[_0x83db('0x46')][_0x83db('0x8a')]?{'id':_0x36618a[_0x83db('0x46')]['tag']}:undefined,'required':_0x36618a[_0x83db('0x46')][_0x83db('0x8a')]?!![]:![]}];}return db[_0x83db('0x82')][_0x83db('0x6d')](_0x46e71a);})[_0x83db('0xd')](function(_0x517336){_0x39e867[_0x83db('0x56')]=_0x517336;return _0x39e867;});}})[_0x83db('0xd')](respondWithFilteredResult(_0x5d65a6,_0x46e71a))[_0x83db('0x57')](handleError(_0x5d65a6,null));};exports[_0x83db('0x8b')]=function addApplications(_0x3acc23,_0x44a428){var _0x19c9c4=_0x3acc23[_0x83db('0x58')]['id'];var _0x1793ea=_0x3acc23[_0x83db('0x5c')];var _0x538bb9=0xc8;var _0x19ae4e=null;return db['sequelize']['transaction']({'isolationLevel':db['sequelize'][_0x83db('0x8c')][_0x83db('0x8d')][_0x83db('0x8e')]},function(_0xf470c0){return db[_0x83db('0x40')][_0x83db('0x66')]({'where':{'id':_0x19c9c4},'transaction':_0xf470c0})[_0x83db('0xd')](function(_0x977428){if(_0x977428){return db[_0x83db('0x8f')][_0x83db('0x20')]({'where':{'MailAccountId':_0x19c9c4},'transaction':_0xf470c0})[_0x83db('0xd')](function(){var _0x28d54b=_[_0x83db('0x3f')](_0x1793ea,function(_0x1422c1){_0x1422c1[_0x83db('0x63')]=_0x19c9c4;return _0x1422c1;});return db[_0x83db('0x8f')]['bulkCreate'](_0x28d54b,{'transaction':_0xf470c0});});}else{_0x538bb9=0x194;_0x19ae4e=[];}});})['then'](function(){if(_0x538bb9!==0x194){return db['MailApplication'][_0x83db('0x90')]({'where':{'MailAccountId':_0x19c9c4},'order':'priority'})[_0x83db('0xd')](function(_0x57c232){_0x19ae4e=_0x57c232;});}})[_0x83db('0x57')](function(_0x35177b){_0x538bb9=0x1f4;logger[_0x83db('0x13')](_0x35177b['stack']);if(_0x35177b['name']){delete _0x35177b['name'];}_0x19ae4e=_0x35177b;})[_0x83db('0x91')](function(){if(_0x19ae4e===null){_0x44a428[_0x83db('0x16')](_0x538bb9);}else{if(_0x538bb9===0x1f4){_0x44a428[_0x83db('0x17')](_0x538bb9)['send'](_0x19ae4e);}else{_0x44a428[_0x83db('0x17')](_0x538bb9)[_0x83db('0x19')](_0x19ae4e);}}});};exports[_0x83db('0x92')]=function(_0x256cb7,_0x31e680){var _0x52dd89={};var _0x2d49a2={};var _0x3ecb7f;var _0x191d72;return db['MailAccount'][_0x83db('0x66')]({'where':{'id':_0x256cb7[_0x83db('0x58')]['id']}})[_0x83db('0xd')](handleEntityNotFound(_0x31e680,null))['then'](function(_0x48a0d6){if(_0x48a0d6){_0x3ecb7f=_0x48a0d6;_0x2d49a2[_0x83db('0x45')]=_[_0x83db('0x47')](db[_0x83db('0x8f')][_0x83db('0x41')]);_0x2d49a2['query']=_[_0x83db('0x47')](_0x256cb7[_0x83db('0x46')]);_0x2d49a2['filters']=_[_0x83db('0x49')](_0x2d49a2[_0x83db('0x45')],_0x2d49a2[_0x83db('0x46')]);_0x52dd89['attributes']=_[_0x83db('0x49')](_0x2d49a2['model'],qs[_0x83db('0x59')](_0x256cb7[_0x83db('0x46')][_0x83db('0x59')]));_0x52dd89[_0x83db('0x4a')]=_0x52dd89[_0x83db('0x4a')][_0x83db('0x4b')]?_0x52dd89[_0x83db('0x4a')]:_0x2d49a2[_0x83db('0x45')];_0x52dd89['order']=qs['sort'](_0x256cb7['query'][_0x83db('0x4e')]);_0x52dd89['where']=qs[_0x83db('0x48')](_['pick'](_0x256cb7[_0x83db('0x46')],_0x2d49a2[_0x83db('0x48')]));if(_0x256cb7[_0x83db('0x46')][_0x83db('0x51')]){_0x52dd89[_0x83db('0x4f')]=_[_0x83db('0x52')](_0x52dd89[_0x83db('0x4f')],{'$or':_[_0x83db('0x3f')](_0x52dd89['attributes'],function(_0x47195f){var _0x2ad830={};_0x2ad830[_0x47195f]={'$like':'%'+_0x256cb7[_0x83db('0x46')]['filter']+'%'};return _0x2ad830;})});}_0x52dd89=_['merge']({},_0x52dd89,_0x256cb7['options']);return _0x3ecb7f[_0x83db('0x92')](_0x52dd89);}})['then'](function(_0x3c5e9b){if(_0x3c5e9b){_0x191d72=_0x3c5e9b['length'];if(!_0x256cb7[_0x83db('0x46')][_0x83db('0x6b')](_0x83db('0x4c'))){_0x52dd89['limit']=qs[_0x83db('0x1c')](_0x256cb7['query'][_0x83db('0x1c')]);_0x52dd89[_0x83db('0x1a')]=qs[_0x83db('0x1a')](_0x256cb7[_0x83db('0x46')][_0x83db('0x1a')]);}return _0x3ecb7f[_0x83db('0x92')](_0x52dd89);}})['then'](function(_0x570f3d){if(_0x570f3d){return _0x570f3d?{'count':_0x191d72,'rows':_0x570f3d}:null;}})[_0x83db('0xd')](respondWithResult(_0x31e680,null))[_0x83db('0x57')](handleError(_0x31e680,null));};exports[_0x83db('0x93')]=function(_0x16dacf,_0x5ad8f1){var _0x2ff8ec={'raw':!![],'where':{}};var _0x3b6851={};var _0xc573eb={'count':0x0,'rows':[]};return db[_0x83db('0x40')][_0x83db('0x66')]({'where':{'id':_0x16dacf['params']['id']}})[_0x83db('0xd')](handleEntityNotFound(_0x5ad8f1,null))[_0x83db('0xd')](function(_0x2f65f9){if(_0x2f65f9){_0x3b6851[_0x83db('0x45')]=_[_0x83db('0x47')](db['MailMessage'][_0x83db('0x41')]);_0x3b6851[_0x83db('0x46')]=_[_0x83db('0x47')](_0x16dacf['query']);_0x3b6851[_0x83db('0x48')]=_['intersection'](_0x3b6851['model'],_0x3b6851[_0x83db('0x46')]);_0x2ff8ec['attributes']=_['intersection'](_0x3b6851['model'],qs['fields'](_0x16dacf['query'][_0x83db('0x59')]));_0x2ff8ec[_0x83db('0x4a')]=_0x2ff8ec[_0x83db('0x4a')][_0x83db('0x4b')]?_0x2ff8ec[_0x83db('0x4a')]:_0x3b6851[_0x83db('0x45')];if(!_0x16dacf[_0x83db('0x46')][_0x83db('0x6b')](_0x83db('0x4c'))){_0x2ff8ec[_0x83db('0x1c')]=qs[_0x83db('0x1c')](_0x16dacf['query']['limit']);_0x2ff8ec['offset']=qs[_0x83db('0x1a')](_0x16dacf[_0x83db('0x46')][_0x83db('0x1a')]);}_0x2ff8ec[_0x83db('0x4d')]=qs[_0x83db('0x4e')](_0x16dacf['query'][_0x83db('0x4e')]);_0x2ff8ec[_0x83db('0x4f')]=qs[_0x83db('0x48')](_['pick'](_0x16dacf['query'],_0x3b6851[_0x83db('0x48')]));_0x2ff8ec[_0x83db('0x4f')][_0x83db('0x63')]=_0x2f65f9['id'];if(_0x16dacf[_0x83db('0x46')]['filter']){_0x2ff8ec[_0x83db('0x4f')]=_[_0x83db('0x52')](_0x2ff8ec['where'],{'$or':_[_0x83db('0x3f')](_0x2ff8ec[_0x83db('0x4a')],function(_0x4af4a3){var _0x37f451={};_0x37f451[_0x4af4a3]={'$like':'%'+_0x16dacf['query'][_0x83db('0x51')]+'%'};return _0x37f451;})});}if(_0x16dacf[_0x83db('0x46')][_0x83db('0x94')]){var _0x37b83f=_0x16dacf[_0x83db('0x46')][_0x83db('0x94')][_0x83db('0x95')](',');var _0x45525d={};_0x45525d[_0x37b83f[0x0]]={'$gte':moment(_0x37b83f[0x1])[_0x83db('0x96')](_0x83db('0x97'))};_0x2ff8ec[_0x83db('0x4f')]=_['merge'](_0x2ff8ec['where'],_0x45525d);}_0x2ff8ec=_[_0x83db('0x52')]({},_0x2ff8ec,_0x16dacf['options']);return db[_0x83db('0x98')][_0x83db('0x1d')]({'where':_0x2ff8ec['where']})[_0x83db('0xd')](function(_0x48c420){_0xc573eb[_0x83db('0x1d')]=_0x48c420;if(_0x16dacf[_0x83db('0x46')][_0x83db('0x5a')]){_0x2ff8ec['include']=[{'all':!![]}];}return db[_0x83db('0x98')]['findAll'](_0x2ff8ec);})[_0x83db('0xd')](function(_0x1122e1){if(_0x16dacf['query']['inlineCss']===_0x83db('0x99')){for(var _0x43a6b0=0x0;_0x43a6b0<_0x1122e1[_0x83db('0x4b')];_0x43a6b0++){_0x1122e1[_0x43a6b0][_0x83db('0x5c')]=juice(_0x1122e1[_0x43a6b0][_0x83db('0x5c')]);}}_0xc573eb[_0x83db('0x56')]=_0x1122e1;return _0xc573eb;});}})[_0x83db('0xd')](respondWithFilteredResult(_0x5ad8f1,_0x2ff8ec))['catch'](handleError(_0x5ad8f1,null));};exports[_0x83db('0x24')]=function(_0x3e9cdc,_0x2dc05e){var _0x2306cc,_0x56c9f0={},_0x368060;if(_0x3e9cdc['body']['to']){_0x368060=_0x3e9cdc[_0x83db('0x5c')]['to']['split'](',')[0x0];}return db[_0x83db('0x40')]['find']({'where':{'id':_0x3e9cdc['params']['id']},'include':[{'model':db[_0x83db('0x9a')],'as':_0x83db('0x9b'),'include':[{'model':db['CmContact'],'as':_0x83db('0x9c'),'where':{'email':_0x368060},'limit':0x1,'order':[[_0x83db('0x9d'),_0x83db('0x9e')]]}]},{'model':db[_0x83db('0x3c')],'as':_0x83db('0x5f'),'raw':!![],'include':[{'model':db[_0x83db('0x9f')],'as':_0x83db('0x9f'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x2dc05e,null))['then'](function(_0x196337){if(!_0x196337)return;_0x2306cc=_0x196337;if(!_0x196337[_0x83db('0x5f')])throw new Error(_0x83db('0xa0'));if(_['isNil'](_0x3e9cdc[_0x83db('0x5c')][_0x83db('0xa1')])){_0x3e9cdc[_0x83db('0x5c')]['from']=util[_0x83db('0x96')](_0x83db('0xa2'),_0x196337[_0x83db('0x23')],_0x196337[_0x83db('0x6f')]||_0x196337[_0x83db('0x5f')][_0x83db('0x2e')]);}if(_0x3e9cdc['body'][_0x83db('0xa3')]&&_0x3e9cdc[_0x83db('0x5c')][_0x83db('0xa3')][_0x83db('0x4b')]){for(var _0x533910=0x0;_0x533910<_0x3e9cdc[_0x83db('0x5c')][_0x83db('0xa3')][_0x83db('0x4b')];_0x533910+=0x1){_0x3e9cdc['body'][_0x83db('0xa3')][_0x533910]={'filename':_0x3e9cdc['body']['attachments'][_0x533910][_0x83db('0x23')],'path':path[_0x83db('0xa4')](config['root'],_0x83db('0xa5'),_0x3e9cdc['body'][_0x83db('0xa3')][_0x533910][_0x83db('0xa6')])};}}var _0xa2d47=_0x196337[_0x83db('0xa7')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0xa2d47,'message':_0x3e9cdc[_0x83db('0x5c')]});})[_0x83db('0xd')](function(_0xac92e3){if(!_0xac92e3)return;_0x56c9f0=_0xac92e3;if(!_0x2306cc[_0x83db('0x9b')])throw new Error(_0x83db('0xa8'));if(_0x2306cc['List'][_0x83db('0x9c')][_0x83db('0x4b')])return _0x2306cc[_0x83db('0x9b')][_0x83db('0x9c')][0x0];return db['CmContact'][_0x83db('0x64')](_['defaults'](_0x3e9cdc[_0x83db('0x5c')],{'firstName':_0x3e9cdc[_0x83db('0x5c')]['to'],'email':_0x3e9cdc['body']['to'],'phone':_0x3e9cdc['body']['to'],'ListId':_0x2306cc['ListId']}));})['then'](function(_0x31b6ed){if(!_0x31b6ed)return;var _0x2c1e74={'UserId':_0x3e9cdc[_0x83db('0x2e')]['id'],'ContactId':_0x31b6ed['id'],'MailAccountId':_0x2306cc['id'],'inReplyTo':_0x56c9f0[_0x83db('0xa9')],'to':_0x3e9cdc[_0x83db('0x5c')]['from'],'cc':_0x3e9cdc['body']['cc'],'subject':_0x3e9cdc['body'][_0x83db('0xaa')],'attach':_0x3e9cdc[_0x83db('0x5c')]['attach'],'firstMsgDirection':'out','lastMsgAt':moment()[_0x83db('0x96')](_0x83db('0x97')),'lastMsgDirection':_0x83db('0xab'),'Messages':[_[_0x83db('0x52')](_0x3e9cdc[_0x83db('0x5c')],{'messageId':_0x56c9f0[_0x83db('0xa9')],'sentAt':moment()[_0x83db('0x96')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x2306cc['id'],'UserId':_0x3e9cdc[_0x83db('0x2e')]['id'],'ContactId':_0x31b6ed['id']})]};if(_0x3e9cdc[_0x83db('0x5c')]['Interaction']){_0x2c1e74=_[_0x83db('0x52')](_0x2c1e74,_0x3e9cdc[_0x83db('0x5c')][_0x83db('0xac')]);}return db[_0x83db('0x82')][_0x83db('0x64')](_0x2c1e74,{'include':[{'model':db[_0x83db('0x98')],'as':_0x83db('0xad')}]});})['then'](respondWithResult(_0x2dc05e,null))[_0x83db('0x57')](handleError(_0x2dc05e,null));};exports[_0x83db('0xae')]=function(_0x5568ec,_0x575b3b){return db[_0x83db('0x40')][_0x83db('0x5b')]({'where':{'id':_0x5568ec[_0x83db('0x58')]['id']},'include':[{'model':db[_0x83db('0x3c')],'as':_0x83db('0x5f'),'raw':!![],'include':[{'model':db[_0x83db('0x9f')],'as':_0x83db('0x9f'),'raw':!![]}]}]})[_0x83db('0xd')](handleEntityNotFound(_0x575b3b,null))[_0x83db('0xd')](function(_0xb83333){if(!_0xb83333[_0x83db('0x5f')])return;var _0x2dc0e9=_0xb83333['getSmtpOptions']();return respondWithRpcPromise(_0x83db('0xaf'),_0x83db('0xae'),{'account':_0x2dc0e9});})[_0x83db('0xd')](respondWithResult(_0x575b3b,null))[_0x83db('0x57')](handleError(_0x575b3b,null));};exports['destroy']=function(_0x205567,_0x2b24d4){return db[_0x83db('0x40')]['find']({'where':{'id':_0x205567[_0x83db('0x58')]['id']}})[_0x83db('0xd')](handleEntityNotFound(_0x2b24d4,null))[_0x83db('0xd')](function(_0x4333d9){if(_0x4333d9&&_0x4333d9[_0x83db('0x37')]){throw new db[(_0x83db('0xb0'))][(_0x83db('0xb1'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x4333d9;})[_0x83db('0xd')](removeEntity(_0x2b24d4,null))['catch'](handleError(_0x2b24d4,null));};exports[_0x83db('0xb2')]=function(_0x450834,_0x8efeb7){return db[_0x83db('0x40')][_0x83db('0x5b')]({'where':{'id':_0x450834[_0x83db('0x58')]['id']}})[_0x83db('0xd')](handleEntityNotFound(_0x8efeb7,null))[_0x83db('0xd')](function(_0x532530){if(_0x532530){return _0x532530['addAgents'](_0x450834[_0x83db('0x5c')]['ids'],_['omit'](_0x450834['body'],[_0x83db('0x69'),'id'])||{})[_0x83db('0xb3')](function(_0x1249b4){for(var _0x1be3d8=0x0;_0x1be3d8<_0x450834[_0x83db('0x5c')]['ids'][_0x83db('0x4b')];_0x1be3d8+=0x1){socket[_0x83db('0xb4')](_0x83db('0xb5'),{'UserId':Number(_0x450834[_0x83db('0x5c')]['ids'][_0x1be3d8]),'MailAccountId':Number(_0x450834[_0x83db('0x58')]['id'])});}return _0x1249b4;});}})['then'](respondWithResult(_0x8efeb7,null))['catch'](handleError(_0x8efeb7,null));};exports[_0x83db('0xb6')]=function(_0x368f14,_0xbce5f7){return db[_0x83db('0x40')][_0x83db('0x5b')]({'where':{'id':_0x368f14[_0x83db('0x58')]['id']}})[_0x83db('0xd')](handleEntityNotFound(_0xbce5f7,null))[_0x83db('0xd')](function(_0x2d8785){if(_0x2d8785){return _0x2d8785[_0x83db('0xb6')](_0x368f14[_0x83db('0x46')]['ids'])['then'](function(){if(_[_0x83db('0xb7')](_0x368f14[_0x83db('0x46')][_0x83db('0x69')])){for(var _0xda3fe9=0x0;_0xda3fe9<_0x368f14[_0x83db('0x46')][_0x83db('0x69')][_0x83db('0x4b')];_0xda3fe9+=0x1){socket[_0x83db('0xb4')](_0x83db('0xb8'),{'UserId':Number(_0x368f14[_0x83db('0x46')]['ids'][_0xda3fe9]),'MailAccountId':Number(_0x368f14[_0x83db('0x58')]['id'])});}}else{socket['emit'](_0x83db('0xb8'),{'UserId':Number(_0x368f14['query'][_0x83db('0x69')]),'MailAccountId':Number(_0x368f14[_0x83db('0x58')]['id'])});}});}})['then'](respondWithStatusCode(_0xbce5f7,null))[_0x83db('0x57')](handleError(_0xbce5f7,null));};exports[_0x83db('0xb9')]=function(_0x37e5ff,_0x203cd4){var _0x1520f2={};var _0xaea185={};var _0x12d0a1;var _0x3999a5;return db[_0x83db('0x40')][_0x83db('0x66')]({'where':{'id':_0x37e5ff[_0x83db('0x58')]['id']}})[_0x83db('0xd')](handleEntityNotFound(_0x203cd4,null))[_0x83db('0xd')](function(_0x7e0e2f){if(_0x7e0e2f){_0x12d0a1=_0x7e0e2f;_0xaea185[_0x83db('0x45')]=_['keys'](db[_0x83db('0xba')][_0x83db('0x41')]);_0xaea185[_0x83db('0x46')]=_[_0x83db('0x47')](_0x37e5ff[_0x83db('0x46')]);_0xaea185[_0x83db('0x48')]=_[_0x83db('0x49')](_0xaea185[_0x83db('0x45')],_0xaea185[_0x83db('0x46')]);_0x1520f2[_0x83db('0x4a')]=_[_0x83db('0x49')](_0xaea185[_0x83db('0x45')],qs[_0x83db('0x59')](_0x37e5ff[_0x83db('0x46')][_0x83db('0x59')]));_0x1520f2['attributes']=_0x1520f2[_0x83db('0x4a')]['length']?_0x1520f2['attributes']:_0xaea185[_0x83db('0x45')];_0x1520f2['order']=qs[_0x83db('0x4e')](_0x37e5ff[_0x83db('0x46')][_0x83db('0x4e')]);_0x1520f2['where']=qs[_0x83db('0x48')](_['pick'](_0x37e5ff[_0x83db('0x46')],_0xaea185[_0x83db('0x48')]));if(_0x37e5ff[_0x83db('0x46')][_0x83db('0x51')]){_0x1520f2['where']=_[_0x83db('0x52')](_0x1520f2[_0x83db('0x4f')],{'$or':_[_0x83db('0x3f')](_0x1520f2['attributes'],function(_0x52bef2){var _0xfd85e4={};_0xfd85e4[_0x52bef2]={'$like':'%'+_0x37e5ff[_0x83db('0x46')][_0x83db('0x51')]+'%'};return _0xfd85e4;})});}_0x1520f2=_[_0x83db('0x52')]({},_0x1520f2,_0x37e5ff[_0x83db('0x54')]);return _0x12d0a1[_0x83db('0xb9')](_0x1520f2);}})[_0x83db('0xd')](function(_0x175270){if(_0x175270){_0x3999a5=_0x175270['length'];if(!_0x37e5ff['query'][_0x83db('0x6b')](_0x83db('0x4c'))){_0x1520f2[_0x83db('0x1c')]=qs['limit'](_0x37e5ff[_0x83db('0x46')][_0x83db('0x1c')]);_0x1520f2[_0x83db('0x1a')]=qs[_0x83db('0x1a')](_0x37e5ff['query'][_0x83db('0x1a')]);}return _0x12d0a1[_0x83db('0xb9')](_0x1520f2);}})['then'](function(_0x13aa1f){if(_0x13aa1f){return _0x13aa1f?{'count':_0x3999a5,'rows':_0x13aa1f}:null;}})[_0x83db('0xd')](respondWithResult(_0x203cd4,null))[_0x83db('0x57')](handleError(_0x203cd4,null));}; \ No newline at end of file +var _0xf495=['../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','limit','undefined','count','set','json','update','destroy','get','MailAccounts','UserProfileResource','stack','name','send','gmail','yahoo','hotmail','imap-mail.outlook.com','outlook365','smtp.mail.yahoo.com','smtp-mail.outlook.com','Unknown\x20email\x20service\x20provider','user','pass','modernAuthentication','CloudProviderId','password','host','port','secure','service','authentication','username','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','include','rows','show','params','keys','includeAll','find','body','provider','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','nolimit','order','pick','removeDispositions','ids','addAnswer','CannedAnswer','findOne','custom','email','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','getImap','setImap','getSmtp','addSmtp','removeSmtp','addInteraction','MailInteraction','omit','CmContact','Contact','User','Owner','fullname','internal','Tag','color','tag','findAll','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','priority','finally','getApplications','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','true','CmList','List','Contacts','CloudProvider','isNil','from','attachments','root','server/files/attachments','getSmtpOptions','sendMail','List\x20not\x20found','ListId','messageId','subject','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','moment','util','path','lodash','ioredis'];(function(_0x4bf0bc,_0x2c6490){var _0x223837=function(_0x4edeb6){while(--_0x4edeb6){_0x4bf0bc['push'](_0x4bf0bc['shift']());}};_0x223837(++_0x2c6490);}(_0xf495,0x17f));var _0x5f49=function(_0x4b8338,_0xd13dd1){_0x4b8338=_0x4b8338-0x0;var _0x5381cc=_0xf495[_0x4b8338];return _0x5381cc;};'use strict';var moment=require(_0x5f49('0x0'));var BPromise=require('bluebird');var util=require(_0x5f49('0x1'));var path=require(_0x5f49('0x2'));var _=require(_0x5f49('0x3'));var juice=require('juice');var Redis=require(_0x5f49('0x4'));var qs=require(_0x5f49('0x5'));var logger=require(_0x5f49('0x6'))(_0x5f49('0x7'));var config=require(_0x5f49('0x8'));var db=require(_0x5f49('0x9'))['db'];config[_0x5f49('0xa')]=_[_0x5f49('0xb')](config[_0x5f49('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x5f49('0xc'))(new Redis(config['redis']));require('./mailAccount.socket')[_0x5f49('0xd')](socket);var jayson=require(_0x5f49('0xe'));var client=jayson[_0x5f49('0xf')][_0x5f49('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x12c3dc,_0x341512,_0x16c226,_0x51484d){return new BPromise(function(_0x593505,_0x1de43f){var _0x106e72=_0x51484d||client;return _0x106e72[_0x5f49('0x11')](_0x12c3dc,_0x16c226)[_0x5f49('0x12')](function(_0x154503){logger[_0x5f49('0x13')]('MailAccount,\x20%s,\x20%s',_0x341512,_0x5f49('0x14'));logger[_0x5f49('0x15')](_0x5f49('0x16'),_0x341512,_0x5f49('0x14'),JSON['stringify'](_0x154503));if(_0x154503[_0x5f49('0x17')]){if(_0x154503[_0x5f49('0x17')][_0x5f49('0x18')]===0x1f4){logger[_0x5f49('0x17')](_0x5f49('0x19'),_0x341512,_0x154503[_0x5f49('0x17')][_0x5f49('0x1a')]);return _0x1de43f(_0x154503[_0x5f49('0x17')][_0x5f49('0x1a')]);}logger[_0x5f49('0x17')]('MailAccount,\x20%s,\x20%s',_0x341512,_0x154503[_0x5f49('0x17')][_0x5f49('0x1a')]);return _0x593505(_0x154503[_0x5f49('0x17')][_0x5f49('0x1a')]);}else{logger['info'](_0x5f49('0x19'),_0x341512,_0x5f49('0x14'));_0x593505(_0x154503[_0x5f49('0x1b')]['message']);}})[_0x5f49('0x1c')](function(_0x40cea9){logger[_0x5f49('0x17')](_0x5f49('0x19'),_0x341512,_0x40cea9);_0x1de43f(_0x40cea9);});});}function respondWithStatusCode(_0xea709d,_0x44de1c){_0x44de1c=_0x44de1c||0xcc;return function(_0x50f59e){if(_0x50f59e){return _0xea709d[_0x5f49('0x1d')](_0x44de1c);}return _0xea709d[_0x5f49('0x1e')](_0x44de1c)[_0x5f49('0x1f')]();};}function respondWithResult(_0x4799f9,_0x457fb1){_0x457fb1=_0x457fb1||0xc8;return function(_0x55942d){if(_0x55942d){return _0x4799f9[_0x5f49('0x1e')](_0x457fb1)['json'](_0x55942d);}};}function respondWithFilteredResult(_0x3702ad,_0x1a2ebe){return function(_0x314ed9){if(_0x314ed9){var _0x568ccb=typeof _0x1a2ebe[_0x5f49('0x20')]==='undefined'&&typeof _0x1a2ebe[_0x5f49('0x21')]===_0x5f49('0x22');var _0x5b6984=_0x314ed9['count'];var _0x31aaac=_0x568ccb?0x0:_0x1a2ebe[_0x5f49('0x20')];var _0x1460e0=_0x568ccb?_0x314ed9[_0x5f49('0x23')]:_0x1a2ebe[_0x5f49('0x20')]+_0x1a2ebe[_0x5f49('0x21')];var _0x3b12b2;if(_0x1460e0>=_0x5b6984){_0x1460e0=_0x5b6984;_0x3b12b2=0xc8;}else{_0x3b12b2=0xce;}_0x3702ad[_0x5f49('0x1e')](_0x3b12b2);return _0x3702ad[_0x5f49('0x24')]('Content-Range',_0x31aaac+'-'+_0x1460e0+'/'+_0x5b6984)[_0x5f49('0x25')](_0x314ed9);}return null;};}function saveUpdates(_0x52bc59){return function(_0xddbe20){if(_0xddbe20){return _0xddbe20[_0x5f49('0x26')](_0x52bc59)[_0x5f49('0x12')](function(_0x3e9635){return _0x3e9635;});}return null;};}function removeEntity(_0x2dde92){return function(_0x54eb3c){if(_0x54eb3c){return _0x54eb3c[_0x5f49('0x27')]()[_0x5f49('0x12')](function(){var _0xa9f0a=_0x54eb3c[_0x5f49('0x28')]({'plain':!![]});var _0x363437=_0x5f49('0x29');return db[_0x5f49('0x2a')][_0x5f49('0x27')]({'where':{'type':_0x363437,'resourceId':_0xa9f0a['id']}})[_0x5f49('0x12')](function(){return _0x54eb3c;});})[_0x5f49('0x12')](function(){_0x2dde92[_0x5f49('0x1e')](0xcc)[_0x5f49('0x1f')]();});}};}function handleEntityNotFound(_0x553cbb){return function(_0x38d926){if(!_0x38d926){_0x553cbb[_0x5f49('0x1d')](0x194);}return _0x38d926;};}function handleError(_0x2e2745,_0x313e0f){_0x313e0f=_0x313e0f||0x1f4;return function(_0x2e8af9){logger[_0x5f49('0x17')](_0x2e8af9[_0x5f49('0x2b')]);if(_0x2e8af9[_0x5f49('0x2c')]){delete _0x2e8af9[_0x5f49('0x2c')];}_0x2e2745[_0x5f49('0x1e')](_0x313e0f)[_0x5f49('0x2d')](_0x2e8af9);};}function getImapHost(_0x16942a){switch(_0x16942a){case _0x5f49('0x2e'):return'imap.gmail.com';case _0x5f49('0x2f'):return'imap.mail.yahoo.com';case _0x5f49('0x30'):return _0x5f49('0x31');case _0x5f49('0x32'):return'outlook.office365.com';}throw new Error('Unknown\x20email\x20service\x20provider',_0x16942a);}function getSmtpHost(_0x1f6dc3){switch(_0x1f6dc3){case'gmail':return'smtp.gmail.com';case'yahoo':return _0x5f49('0x33');case _0x5f49('0x30'):return _0x5f49('0x34');case _0x5f49('0x32'):return'smtp.office365.com';}throw new Error(_0x5f49('0x35'),_0x1f6dc3);}function getAuthenticationOptions(_0x27be5f,_0xab90ec){var _0x563c04={};var _0x3ad4b7={};if(_0x27be5f){_0x563c04[_0x5f49('0x36')]=_0x3ad4b7[_0x5f49('0x36')]=_0xab90ec['username'];_0x563c04['password']=_0x3ad4b7[_0x5f49('0x37')]=_0xab90ec['password'];if(_0xab90ec[_0x5f49('0x38')]){_0x563c04[_0x5f49('0x38')]=_0x3ad4b7[_0x5f49('0x38')]=!![];_0x563c04[_0x5f49('0x39')]=_0x3ad4b7[_0x5f49('0x39')]=_0xab90ec[_0x5f49('0x39')];_0x563c04[_0x5f49('0x3a')]=_0x3ad4b7[_0x5f49('0x37')]=null;}else{_0x563c04['CloudProviderId']=_0x3ad4b7[_0x5f49('0x39')]=null;}_0x563c04['host']=getImapHost(_0x27be5f);_0x563c04['port']=0x3e1;_0x3ad4b7[_0x5f49('0x3b')]=getSmtpHost(_0x27be5f);_0x3ad4b7[_0x5f49('0x3c')]=0x24b;_0x3ad4b7[_0x5f49('0x3d')]=![];_0x563c04['service']=_0x3ad4b7[_0x5f49('0x3e')]=null;}else{if(_0xab90ec[_0x5f49('0x3f')]){_0x563c04[_0x5f49('0x36')]=_0x3ad4b7[_0x5f49('0x36')]=_0xab90ec[_0x5f49('0x40')];_0x563c04[_0x5f49('0x3a')]=_0x3ad4b7[_0x5f49('0x37')]=_0xab90ec[_0x5f49('0x3a')];}else{_0x563c04[_0x5f49('0x3f')]=_0x3ad4b7[_0x5f49('0x3f')]=![];_0x563c04['user']=_0x3ad4b7[_0x5f49('0x36')]=null;_0x563c04['password']=_0x3ad4b7['pass']=null;}_0x563c04[_0x5f49('0x3b')]=_0xab90ec[_0x5f49('0x41')][_0x5f49('0x3b')];_0x563c04['port']=_0xab90ec['Imap'][_0x5f49('0x3c')];_0x3ad4b7['host']=_0xab90ec[_0x5f49('0x42')][_0x5f49('0x3b')];_0x3ad4b7['port']=_0xab90ec[_0x5f49('0x42')][_0x5f49('0x3c')];}return{'Imap':_0x563c04,'Smtp':_0x3ad4b7};}exports[_0x5f49('0x43')]=function(_0x2349ac,_0x28d61a){var _0x3078b3={'include':[{'model':db[_0x5f49('0x44')],'as':'Imap'},{'model':db[_0x5f49('0x45')],'as':_0x5f49('0x42')},{'model':db[_0x5f49('0x46')],'as':_0x5f49('0x47')}]},_0x5c16cb={},_0x22aa51={'count':0x0,'rows':[]};var _0x4b614e=_[_0x5f49('0x48')](db[_0x5f49('0x49')][_0x5f49('0x4a')],function(_0x486ab8){return{'name':_0x486ab8[_0x5f49('0x4b')],'type':_0x486ab8[_0x5f49('0x4c')][_0x5f49('0x4d')]};});_0x5c16cb[_0x5f49('0x4e')]=_['map'](_0x4b614e,_0x5f49('0x2c'));_0x5c16cb[_0x5f49('0x4f')]=_['keys'](_0x2349ac[_0x5f49('0x4f')]);_0x5c16cb[_0x5f49('0x50')]=_[_0x5f49('0x51')](_0x5c16cb[_0x5f49('0x4e')],_0x5c16cb[_0x5f49('0x4f')]);_0x3078b3[_0x5f49('0x52')]=_[_0x5f49('0x51')](_0x5c16cb[_0x5f49('0x4e')],qs[_0x5f49('0x53')](_0x2349ac[_0x5f49('0x4f')][_0x5f49('0x53')]));_0x3078b3[_0x5f49('0x52')]=_0x3078b3[_0x5f49('0x52')][_0x5f49('0x54')]?_0x3078b3[_0x5f49('0x52')]:_0x5c16cb[_0x5f49('0x4e')];if(!_0x2349ac[_0x5f49('0x4f')][_0x5f49('0x55')]('nolimit')){_0x3078b3[_0x5f49('0x21')]=qs[_0x5f49('0x21')](_0x2349ac[_0x5f49('0x4f')][_0x5f49('0x21')]);_0x3078b3[_0x5f49('0x20')]=qs[_0x5f49('0x20')](_0x2349ac['query'][_0x5f49('0x20')]);}_0x3078b3['order']=qs['sort'](_0x2349ac[_0x5f49('0x4f')][_0x5f49('0x56')]);_0x3078b3[_0x5f49('0x57')]=qs[_0x5f49('0x50')](_['pick'](_0x2349ac[_0x5f49('0x4f')],_0x5c16cb[_0x5f49('0x50')]),_0x4b614e);if(_0x2349ac['query'][_0x5f49('0x58')]){_0x3078b3['where']=_[_0x5f49('0x59')](_0x3078b3['where'],{'$or':_[_0x5f49('0x48')](_0x4b614e,function(_0x5da414){if(_0x5da414[_0x5f49('0x4c')]!==_0x5f49('0x5a')){var _0xf354bb={};_0xf354bb[_0x5da414[_0x5f49('0x2c')]]={'$like':'%'+_0x2349ac[_0x5f49('0x4f')][_0x5f49('0x58')]+'%'};return _0xf354bb;}})});}_0x3078b3=_[_0x5f49('0x59')]({},_0x3078b3,_0x2349ac[_0x5f49('0x5b')]);var _0x297af6={'where':_0x3078b3['where']};return db[_0x5f49('0x49')][_0x5f49('0x23')](_0x297af6)['then'](function(_0x3995b8){_0x22aa51[_0x5f49('0x23')]=_0x3995b8;if(_0x2349ac[_0x5f49('0x4f')]['includeAll']){_0x3078b3[_0x5f49('0x5c')]=[{'all':!![]}];}return db[_0x5f49('0x49')]['findAll'](_0x3078b3);})[_0x5f49('0x12')](function(_0x381a20){_0x22aa51[_0x5f49('0x5d')]=_0x381a20;return _0x22aa51;})[_0x5f49('0x12')](respondWithFilteredResult(_0x28d61a,_0x3078b3))[_0x5f49('0x1c')](handleError(_0x28d61a,null));};exports[_0x5f49('0x5e')]=function(_0x51833c,_0x5e9fd9){var _0x49af11={'raw':![],'where':{'id':_0x51833c[_0x5f49('0x5f')]['id']},'include':[{'model':db[_0x5f49('0x44')],'as':_0x5f49('0x41')},{'model':db[_0x5f49('0x45')],'as':_0x5f49('0x42')},{'model':db[_0x5f49('0x46')],'as':'mandatoryDispositionPause'}]},_0x612a1={};_0x612a1[_0x5f49('0x4e')]=_[_0x5f49('0x60')](db[_0x5f49('0x49')][_0x5f49('0x4a')]);_0x612a1['query']=_[_0x5f49('0x60')](_0x51833c['query']);_0x612a1['filters']=_[_0x5f49('0x51')](_0x612a1[_0x5f49('0x4e')],_0x612a1[_0x5f49('0x4f')]);_0x49af11[_0x5f49('0x52')]=_[_0x5f49('0x51')](_0x612a1[_0x5f49('0x4e')],qs[_0x5f49('0x53')](_0x51833c[_0x5f49('0x4f')][_0x5f49('0x53')]));_0x49af11[_0x5f49('0x52')]=_0x49af11['attributes']['length']?_0x49af11[_0x5f49('0x52')]:_0x612a1[_0x5f49('0x4e')];if(_0x51833c[_0x5f49('0x4f')][_0x5f49('0x61')]){_0x49af11[_0x5f49('0x5c')]=[{'all':!![]}];}_0x49af11=_[_0x5f49('0x59')]({},_0x49af11,_0x51833c['options']);return db[_0x5f49('0x49')][_0x5f49('0x62')](_0x49af11)['then'](handleEntityNotFound(_0x5e9fd9,null))['then'](respondWithResult(_0x5e9fd9,null))[_0x5f49('0x1c')](handleError(_0x5e9fd9,null));};exports[_0x5f49('0x26')]=function(_0x1a2268,_0xa9e166){if(_0x1a2268[_0x5f49('0x63')]['id']){delete _0x1a2268[_0x5f49('0x63')]['id'];}var _0x3fe5b5=_0x1a2268[_0x5f49('0x63')][_0x5f49('0x64')]==='custom'?null:_0x1a2268[_0x5f49('0x63')][_0x5f49('0x64')];var _0x3845d2=_0x1a2268[_0x5f49('0x63')][_0x5f49('0x41')]||{};var _0x181c27=_0x1a2268['body'][_0x5f49('0x42')]||{};if(_0x3fe5b5){_0x3845d2[_0x5f49('0x3b')]=getImapHost(_0x3fe5b5);_0x3845d2[_0x5f49('0x3c')]=0x3e1;_0x181c27[_0x5f49('0x3b')]=getSmtpHost(_0x3fe5b5);_0x181c27['port']=0x24b;_0x181c27[_0x5f49('0x3d')]=![];}if(_0x181c27[_0x5f49('0x38')]){_0x181c27[_0x5f49('0x3d')]=![];}else{_0x181c27[_0x5f49('0x39')]=null;}if(!_0x3845d2[_0x5f49('0x38')])_0x3845d2['CloudProviderId']=null;_0x1a2268[_0x5f49('0x63')]['Imap']=_0x3845d2;_0x1a2268['body'][_0x5f49('0x42')]=_0x181c27;return db[_0x5f49('0x49')][_0x5f49('0x62')]({'where':{'id':_0x1a2268[_0x5f49('0x5f')]['id']},'include':[{'model':db[_0x5f49('0x44')],'as':_0x5f49('0x41')},{'model':db[_0x5f49('0x45')],'as':_0x5f49('0x42')},{'model':db[_0x5f49('0x46')],'as':'mandatoryDispositionPause'}]})[_0x5f49('0x12')](handleEntityNotFound(_0xa9e166,null))[_0x5f49('0x12')](function(_0x1dd425){if(!_0x1dd425)throw new Error(_0x5f49('0x65'));if(_0x1dd425[_0x5f49('0x3e')])delete _0x1a2268[_0x5f49('0x63')]['Imap'];return _0x1dd425;})[_0x5f49('0x12')](saveUpdates(_0x1a2268['body'],null))[_0x5f49('0x12')](function(_0x2f9490){if(!_0x1a2268[_0x5f49('0x63')][_0x5f49('0x41')])return _0x2f9490;return db[_0x5f49('0x44')]['update'](_0x1a2268[_0x5f49('0x63')][_0x5f49('0x41')],{'where':{'MailAccountId':_0x2f9490['id']}})[_0x5f49('0x12')](function(){return _0x2f9490;});})[_0x5f49('0x12')](function(_0x5570ed){if(!_0x1a2268[_0x5f49('0x63')][_0x5f49('0x42')])return _0x5570ed;return db[_0x5f49('0x45')][_0x5f49('0x26')](_0x1a2268[_0x5f49('0x63')]['Smtp'],{'where':{'MailAccountId':_0x5570ed['id']}})[_0x5f49('0x12')](function(){return _0x5570ed;});})[_0x5f49('0x12')](respondWithResult(_0xa9e166,null))[_0x5f49('0x1c')](handleError(_0xa9e166,null));};exports['describe']=function(_0x2af6f3,_0x4b11e3){return db['MailAccount'][_0x5f49('0x66')]()[_0x5f49('0x12')](respondWithResult(_0x4b11e3,null))[_0x5f49('0x1c')](handleError(_0x4b11e3,null));};exports[_0x5f49('0x67')]=function(_0x3cc2df,_0x2080a6){if(_0x3cc2df[_0x5f49('0x63')]['id']){delete _0x3cc2df['body']['id'];}return db[_0x5f49('0x49')]['find']({'where':{'id':_0x3cc2df[_0x5f49('0x5f')]['id']}})[_0x5f49('0x12')](handleEntityNotFound(_0x2080a6,null))[_0x5f49('0x12')](function(_0x374edf){if(_0x374edf){_0x3cc2df['body'][_0x5f49('0x68')]=_0x374edf['id'];return db[_0x5f49('0x69')][_0x5f49('0x6a')](_0x3cc2df[_0x5f49('0x63')]);}})[_0x5f49('0x12')](respondWithResult(_0x2080a6,null))['catch'](handleError(_0x2080a6,null));};exports[_0x5f49('0x6b')]=function(_0x47a46b,_0x47996a){var _0x11ec6c={'raw':![],'where':{}};var _0x120920={};var _0x2819e8={'count':0x0,'rows':[]};return db[_0x5f49('0x49')]['findOne']({'where':{'id':_0x47a46b['params']['id']}})[_0x5f49('0x12')](handleEntityNotFound(_0x47996a,null))[_0x5f49('0x12')](function(_0x35e4cd){if(_0x35e4cd){_0x120920[_0x5f49('0x4e')]=_['keys'](db[_0x5f49('0x69')]['rawAttributes']);_0x120920[_0x5f49('0x4f')]=_[_0x5f49('0x60')](_0x47a46b[_0x5f49('0x4f')]);_0x120920[_0x5f49('0x50')]=_[_0x5f49('0x51')](_0x120920[_0x5f49('0x4e')],_0x120920[_0x5f49('0x4f')]);_0x11ec6c[_0x5f49('0x52')]=_[_0x5f49('0x51')](_0x120920[_0x5f49('0x4e')],qs[_0x5f49('0x53')](_0x47a46b['query'][_0x5f49('0x53')]));_0x11ec6c[_0x5f49('0x52')]=_0x11ec6c['attributes']['length']?_0x11ec6c[_0x5f49('0x52')]:_0x120920[_0x5f49('0x4e')];if(!_0x47a46b[_0x5f49('0x4f')]['hasOwnProperty'](_0x5f49('0x6c'))){_0x11ec6c[_0x5f49('0x21')]=qs[_0x5f49('0x21')](_0x47a46b[_0x5f49('0x4f')][_0x5f49('0x21')]);_0x11ec6c[_0x5f49('0x20')]=qs[_0x5f49('0x20')](_0x47a46b[_0x5f49('0x4f')]['offset']);}_0x11ec6c[_0x5f49('0x6d')]=qs['sort'](_0x47a46b[_0x5f49('0x4f')][_0x5f49('0x56')]);_0x11ec6c[_0x5f49('0x57')]=qs['filters'](_[_0x5f49('0x6e')](_0x47a46b[_0x5f49('0x4f')],_0x120920[_0x5f49('0x50')]));_0x11ec6c['where'][_0x5f49('0x68')]=_0x35e4cd['id'];if(_0x47a46b['query']['filter']){_0x11ec6c[_0x5f49('0x57')]=_[_0x5f49('0x59')](_0x11ec6c[_0x5f49('0x57')],{'$or':_['map'](_0x11ec6c[_0x5f49('0x52')],function(_0x405481){var _0x491a79={};_0x491a79[_0x405481]={'$like':'%'+_0x47a46b['query'][_0x5f49('0x58')]+'%'};return _0x491a79;})});}_0x11ec6c=_[_0x5f49('0x59')]({},_0x11ec6c,_0x47a46b[_0x5f49('0x5b')]);return db[_0x5f49('0x69')][_0x5f49('0x23')]({'where':_0x11ec6c[_0x5f49('0x57')]})[_0x5f49('0x12')](function(_0x58f8a7){_0x2819e8['count']=_0x58f8a7;if(_0x47a46b['query'][_0x5f49('0x61')]){_0x11ec6c[_0x5f49('0x5c')]=[{'all':!![]}];}return db[_0x5f49('0x69')]['findAll'](_0x11ec6c);})[_0x5f49('0x12')](function(_0x541eeb){_0x2819e8['rows']=_0x541eeb;return _0x2819e8;});}})['then'](respondWithFilteredResult(_0x47996a,_0x11ec6c))[_0x5f49('0x1c')](handleError(_0x47996a,null));};exports[_0x5f49('0x6f')]=function(_0x157370,_0x195279){return db['MailAccount']['find']({'where':{'id':_0x157370[_0x5f49('0x5f')]['id']}})[_0x5f49('0x12')](handleEntityNotFound(_0x195279,null))['then'](function(_0x458d4b){if(_0x458d4b){return _0x458d4b['removeDispositions'](_0x157370[_0x5f49('0x4f')][_0x5f49('0x70')]);}})[_0x5f49('0x12')](respondWithStatusCode(_0x195279,null))['catch'](handleError(_0x195279,null));};exports[_0x5f49('0x71')]=function(_0x5666d1,_0x4010e){if(_0x5666d1[_0x5f49('0x63')]['id']){delete _0x5666d1[_0x5f49('0x63')]['id'];}return db[_0x5f49('0x49')][_0x5f49('0x62')]({'where':{'id':_0x5666d1[_0x5f49('0x5f')]['id']}})['then'](handleEntityNotFound(_0x4010e,null))[_0x5f49('0x12')](function(_0x3266c0){if(_0x3266c0){_0x5666d1[_0x5f49('0x63')]['MailAccountId']=_0x3266c0['id'];return db[_0x5f49('0x72')]['create'](_0x5666d1[_0x5f49('0x63')]);}})[_0x5f49('0x12')](respondWithResult(_0x4010e,null))[_0x5f49('0x1c')](handleError(_0x4010e,null));};exports['getAnswers']=function(_0x20da3a,_0x21c6cc){var _0x4631fe={'raw':![],'where':{}};var _0x2a05b3={};var _0x48cfcb={'count':0x0,'rows':[]};return db[_0x5f49('0x49')][_0x5f49('0x73')]({'where':{'id':_0x20da3a[_0x5f49('0x5f')]['id']}})[_0x5f49('0x12')](handleEntityNotFound(_0x21c6cc,null))[_0x5f49('0x12')](function(_0x175f53){if(_0x175f53){_0x2a05b3[_0x5f49('0x4e')]=_[_0x5f49('0x60')](db[_0x5f49('0x72')][_0x5f49('0x4a')]);_0x2a05b3[_0x5f49('0x4f')]=_[_0x5f49('0x60')](_0x20da3a[_0x5f49('0x4f')]);_0x2a05b3['filters']=_['intersection'](_0x2a05b3[_0x5f49('0x4e')],_0x2a05b3[_0x5f49('0x4f')]);_0x4631fe[_0x5f49('0x52')]=_['intersection'](_0x2a05b3[_0x5f49('0x4e')],qs[_0x5f49('0x53')](_0x20da3a[_0x5f49('0x4f')][_0x5f49('0x53')]));_0x4631fe[_0x5f49('0x52')]=_0x4631fe[_0x5f49('0x52')][_0x5f49('0x54')]?_0x4631fe['attributes']:_0x2a05b3['model'];if(!_0x20da3a[_0x5f49('0x4f')]['hasOwnProperty'](_0x5f49('0x6c'))){_0x4631fe[_0x5f49('0x21')]=qs[_0x5f49('0x21')](_0x20da3a[_0x5f49('0x4f')][_0x5f49('0x21')]);_0x4631fe[_0x5f49('0x20')]=qs[_0x5f49('0x20')](_0x20da3a[_0x5f49('0x4f')][_0x5f49('0x20')]);}_0x4631fe[_0x5f49('0x6d')]=qs[_0x5f49('0x56')](_0x20da3a[_0x5f49('0x4f')][_0x5f49('0x56')]);_0x4631fe[_0x5f49('0x57')]=qs[_0x5f49('0x50')](_[_0x5f49('0x6e')](_0x20da3a['query'],_0x2a05b3[_0x5f49('0x50')]));_0x4631fe[_0x5f49('0x57')][_0x5f49('0x68')]=_0x175f53['id'];if(_0x20da3a[_0x5f49('0x4f')][_0x5f49('0x58')]){_0x4631fe['where']=_[_0x5f49('0x59')](_0x4631fe[_0x5f49('0x57')],{'$or':_[_0x5f49('0x48')](_0x4631fe[_0x5f49('0x52')],function(_0x388570){var _0x585455={};_0x585455[_0x388570]={'$like':'%'+_0x20da3a[_0x5f49('0x4f')][_0x5f49('0x58')]+'%'};return _0x585455;})});}_0x4631fe=_[_0x5f49('0x59')]({},_0x4631fe,_0x20da3a[_0x5f49('0x5b')]);return db[_0x5f49('0x72')]['count']({'where':_0x4631fe['where']})[_0x5f49('0x12')](function(_0x292148){_0x48cfcb[_0x5f49('0x23')]=_0x292148;if(_0x20da3a['query']['includeAll']){_0x4631fe[_0x5f49('0x5c')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x4631fe);})[_0x5f49('0x12')](function(_0x54ea09){_0x48cfcb[_0x5f49('0x5d')]=_0x54ea09;return _0x48cfcb;});}})[_0x5f49('0x12')](respondWithFilteredResult(_0x21c6cc,_0x4631fe))[_0x5f49('0x1c')](handleError(_0x21c6cc,null));};exports['removeAnswers']=function(_0x57a8a3,_0x11b6eb){return db['MailAccount'][_0x5f49('0x62')]({'where':{'id':_0x57a8a3[_0x5f49('0x5f')]['id']}})[_0x5f49('0x12')](handleEntityNotFound(_0x11b6eb,null))[_0x5f49('0x12')](function(_0x5abffd){if(_0x5abffd){return _0x5abffd['removeAnswers'](_0x57a8a3[_0x5f49('0x4f')][_0x5f49('0x70')]);}})[_0x5f49('0x12')](respondWithStatusCode(_0x11b6eb,null))['catch'](handleError(_0x11b6eb,null));};exports[_0x5f49('0x6a')]=function(_0x3f9217,_0x143e6e){var _0x564da6={'name':_0x3f9217[_0x5f49('0x63')]['name'],'key':_0x3f9217[_0x5f49('0x63')]['key'],'provider':_0x3f9217[_0x5f49('0x63')]['provider']===_0x5f49('0x74')?null:_0x3f9217[_0x5f49('0x63')][_0x5f49('0x64')],'email':_0x3f9217[_0x5f49('0x63')][_0x5f49('0x75')],'ListId':_0x3f9217[_0x5f49('0x63')]['ListId'],'active':!_['isNil'](_0x3f9217[_0x5f49('0x63')][_0x5f49('0x76')])?_0x3f9217[_0x5f49('0x63')]['active']:!![],'description':_0x3f9217[_0x5f49('0x63')][_0x5f49('0x77')]||null};var _0x2c4a2e=getAuthenticationOptions(_0x564da6['provider'],_0x3f9217[_0x5f49('0x63')]);_0x564da6[_0x5f49('0x41')]=_0x2c4a2e['Imap'];_0x564da6['Smtp']=_0x2c4a2e['Smtp'];return db[_0x5f49('0x49')][_0x5f49('0x6a')](_0x564da6,{'include':[{'model':db['MailServerOut'],'as':_0x5f49('0x42')},{'model':db['MailServerIn'],'as':_0x5f49('0x41')}]})[_0x5f49('0x12')](function(_0x1a735b){var _0x1e4545=_0x3f9217[_0x5f49('0x36')][_0x5f49('0x28')]({'plain':!![]});if(!_0x1e4545)throw new Error(_0x5f49('0x78'));if(_0x1e4545[_0x5f49('0x79')]===_0x5f49('0x36')){var _0x59b327=_0x1a735b[_0x5f49('0x28')]({'plain':!![]});return db[_0x5f49('0x7a')]['find']({'where':{'name':'MailAccounts','userProfileId':_0x1e4545[_0x5f49('0x7b')]},'raw':!![]})[_0x5f49('0x12')](function(_0x494d1d){if(_0x494d1d&&_0x494d1d[_0x5f49('0x7c')]===0x0){return db[_0x5f49('0x2a')][_0x5f49('0x6a')]({'name':_0x59b327[_0x5f49('0x2c')],'resourceId':_0x59b327['id'],'type':_0x494d1d[_0x5f49('0x2c')],'sectionId':_0x494d1d['id']},{})[_0x5f49('0x12')](function(){return _0x1a735b;});}else{return _0x1a735b;}})[_0x5f49('0x1c')](function(_0x5c162c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c162c);throw _0x5c162c;});}return _0x1a735b;})[_0x5f49('0x12')](respondWithResult(_0x143e6e,0xc9))['catch'](handleError(_0x143e6e,null));};exports[_0x5f49('0x7d')]=function(_0x3c1ac6,_0x3266d1){return db['MailAccount']['findOne']({'where':{'id':_0x3c1ac6[_0x5f49('0x5f')]['id']}})[_0x5f49('0x12')](handleEntityNotFound(_0x3266d1,null))[_0x5f49('0x12')](function(_0x1c2f03){if(_0x1c2f03){return _0x1c2f03[_0x5f49('0x7d')]();}return null;})[_0x5f49('0x12')](respondWithResult(_0x3266d1,null))['catch'](handleError(_0x3266d1,null));};exports['addImap']=function(_0x1779ce,_0x5bf971){if(_0x1779ce['body']['id']){delete _0x1779ce['body']['id'];}return db[_0x5f49('0x49')][_0x5f49('0x62')]({'where':{'id':_0x1779ce['params']['id']}})[_0x5f49('0x12')](handleEntityNotFound(_0x5bf971,null))[_0x5f49('0x12')](function(_0x2b312c){if(_0x2b312c){_0x1779ce[_0x5f49('0x63')][_0x5f49('0x68')]=_0x2b312c['id'];return db['MailServerIn'][_0x5f49('0x6a')](_0x1779ce[_0x5f49('0x63')]);}})[_0x5f49('0x12')](respondWithResult(_0x5bf971,null))[_0x5f49('0x1c')](handleError(_0x5bf971,null));};exports['removeImap']=function(_0x349ecb,_0x160966){return db[_0x5f49('0x49')]['findOne']({'where':{'id':_0x349ecb[_0x5f49('0x5f')]['id']}})['then'](handleEntityNotFound(_0x160966,null))[_0x5f49('0x12')](function(_0x5d98e){if(_0x5d98e){return _0x5d98e[_0x5f49('0x7e')](null);}return null;})['then'](respondWithStatusCode(_0x160966,null))[_0x5f49('0x1c')](handleError(_0x160966,null));};exports['getSmtp']=function(_0x1dfd62,_0x54c4e3){return db[_0x5f49('0x49')]['findOne']({'where':{'id':_0x1dfd62[_0x5f49('0x5f')]['id']}})['then'](handleEntityNotFound(_0x54c4e3,null))[_0x5f49('0x12')](function(_0x32bff7){if(_0x32bff7){return _0x32bff7[_0x5f49('0x7f')]();}return null;})[_0x5f49('0x12')](respondWithResult(_0x54c4e3,null))[_0x5f49('0x1c')](handleError(_0x54c4e3,null));};exports[_0x5f49('0x80')]=function(_0x49d75a,_0x20d91f){if(_0x49d75a[_0x5f49('0x63')]['id']){delete _0x49d75a[_0x5f49('0x63')]['id'];}return db['MailAccount'][_0x5f49('0x62')]({'where':{'id':_0x49d75a[_0x5f49('0x5f')]['id']}})[_0x5f49('0x12')](handleEntityNotFound(_0x20d91f,null))[_0x5f49('0x12')](function(_0x42806a){if(_0x42806a){_0x49d75a[_0x5f49('0x63')][_0x5f49('0x68')]=_0x42806a['id'];return db[_0x5f49('0x45')][_0x5f49('0x6a')](_0x49d75a[_0x5f49('0x63')]);}})[_0x5f49('0x12')](respondWithResult(_0x20d91f,null))[_0x5f49('0x1c')](handleError(_0x20d91f,null));};exports[_0x5f49('0x81')]=function(_0xe1d758,_0x6421a4){return db[_0x5f49('0x49')]['findOne']({'where':{'id':_0xe1d758[_0x5f49('0x5f')]['id']}})['then'](handleEntityNotFound(_0x6421a4,null))[_0x5f49('0x12')](function(_0x5f0e9d){if(_0x5f0e9d){return _0x5f0e9d['setSmtp'](null);}return null;})['then'](respondWithStatusCode(_0x6421a4,null))[_0x5f49('0x1c')](handleError(_0x6421a4,null));};exports[_0x5f49('0x82')]=function(_0x33aea4,_0x1d545a){return db[_0x5f49('0x83')][_0x5f49('0x62')]({'where':{'id':_0x33aea4[_0x5f49('0x5f')]['id']}})[_0x5f49('0x12')](handleEntityNotFound(_0x1d545a,null))['then'](function(_0x139ab5){if(_0x139ab5){return _0x139ab5[_0x5f49('0x82')](_0x33aea4['body'][_0x5f49('0x70')],_[_0x5f49('0x84')](_0x33aea4[_0x5f49('0x63')],[_0x5f49('0x70'),'id'])||{});}})[_0x5f49('0x12')](respondWithResult(_0x1d545a,null))['catch'](handleError(_0x1d545a,null));};exports['getInteractions']=function(_0x5af3ab,_0x185f42){var _0x3db1ee={'raw':![],'where':{}};var _0x2676b4={};var _0x23763d={'count':0x0,'rows':[]};return db['MailAccount'][_0x5f49('0x73')]({'where':{'id':_0x5af3ab['params']['id']}})[_0x5f49('0x12')](handleEntityNotFound(_0x185f42,null))[_0x5f49('0x12')](function(_0x4a18eb){if(_0x4a18eb){_0x2676b4[_0x5f49('0x4e')]=_[_0x5f49('0x60')](db['MailInteraction']['rawAttributes']);_0x2676b4['query']=_[_0x5f49('0x60')](_0x5af3ab[_0x5f49('0x4f')]);_0x2676b4[_0x5f49('0x50')]=_['intersection'](_0x2676b4[_0x5f49('0x4e')],_0x2676b4['query']);_0x3db1ee['attributes']=_['intersection'](_0x2676b4[_0x5f49('0x4e')],qs[_0x5f49('0x53')](_0x5af3ab[_0x5f49('0x4f')]['fields']));_0x3db1ee['attributes']=_0x3db1ee['attributes'][_0x5f49('0x54')]?_0x3db1ee[_0x5f49('0x52')]:_0x2676b4['model'];if(!_0x5af3ab[_0x5f49('0x4f')][_0x5f49('0x55')](_0x5f49('0x6c'))){_0x3db1ee['limit']=qs[_0x5f49('0x21')](_0x5af3ab[_0x5f49('0x4f')][_0x5f49('0x21')]);_0x3db1ee[_0x5f49('0x20')]=qs[_0x5f49('0x20')](_0x5af3ab[_0x5f49('0x4f')]['offset']);}_0x3db1ee[_0x5f49('0x6d')]=qs[_0x5f49('0x56')](_0x5af3ab[_0x5f49('0x4f')][_0x5f49('0x56')]);_0x3db1ee[_0x5f49('0x57')]=qs[_0x5f49('0x50')](_['pick'](_0x5af3ab[_0x5f49('0x4f')],_0x2676b4[_0x5f49('0x50')]));_0x3db1ee[_0x5f49('0x57')][_0x5f49('0x68')]=_0x4a18eb['id'];if(_0x5af3ab['query'][_0x5f49('0x58')]){_0x3db1ee[_0x5f49('0x57')]=_[_0x5f49('0x59')](_0x3db1ee[_0x5f49('0x57')],{'$or':_[_0x5f49('0x48')](_0x3db1ee[_0x5f49('0x52')],function(_0x2bed37){var _0x4a1c0f={};_0x4a1c0f[_0x2bed37]={'$like':'%'+_0x5af3ab[_0x5f49('0x4f')][_0x5f49('0x58')]+'%'};return _0x4a1c0f;})});}_0x3db1ee=_['merge']({},_0x3db1ee,_0x5af3ab[_0x5f49('0x5b')]);return db[_0x5f49('0x83')]['count']({'where':_0x3db1ee[_0x5f49('0x57')]})[_0x5f49('0x12')](function(_0x5e27ce){_0x23763d['count']=_0x5e27ce;if(_0x5af3ab[_0x5f49('0x4f')][_0x5f49('0x61')]){_0x3db1ee['include']=[{'model':db[_0x5f49('0x85')],'as':_0x5f49('0x86'),'required':![]},{'model':db[_0x5f49('0x87')],'as':_0x5f49('0x88'),'attributes':[_0x5f49('0x2c'),_0x5f49('0x89'),_0x5f49('0x8a')],'required':![]},{'model':db[_0x5f49('0x8b')],'as':'Tags','attributes':['id',_0x5f49('0x2c'),_0x5f49('0x8c')],'where':_0x5af3ab[_0x5f49('0x4f')][_0x5f49('0x8d')]?{'id':_0x5af3ab['query'][_0x5f49('0x8d')]}:undefined,'required':_0x5af3ab[_0x5f49('0x4f')][_0x5f49('0x8d')]?!![]:![]}];}return db[_0x5f49('0x83')][_0x5f49('0x8e')](_0x3db1ee);})[_0x5f49('0x12')](function(_0x3ba08a){_0x23763d['rows']=_0x3ba08a;return _0x23763d;});}})['then'](respondWithFilteredResult(_0x185f42,_0x3db1ee))[_0x5f49('0x1c')](handleError(_0x185f42,null));};exports[_0x5f49('0x8f')]=function addApplications(_0x4bdfd,_0x12f91c){var _0x370323=_0x4bdfd['params']['id'];var _0x4f3d5c=_0x4bdfd['body'];var _0x3876de=0xc8;var _0x32a83f=null;return db['sequelize'][_0x5f49('0x90')]({'isolationLevel':db[_0x5f49('0x91')][_0x5f49('0x92')][_0x5f49('0x93')][_0x5f49('0x94')]},function(_0x2555cb){return db['MailAccount'][_0x5f49('0x73')]({'where':{'id':_0x370323},'transaction':_0x2555cb})['then'](function(_0x2fed18){if(_0x2fed18){return db['MailApplication'][_0x5f49('0x27')]({'where':{'MailAccountId':_0x370323},'transaction':_0x2555cb})['then'](function(){var _0x5777bd=_[_0x5f49('0x48')](_0x4f3d5c,function(_0x40a9cc){_0x40a9cc[_0x5f49('0x68')]=_0x370323;return _0x40a9cc;});return db[_0x5f49('0x95')][_0x5f49('0x96')](_0x5777bd,{'transaction':_0x2555cb});});}else{_0x3876de=0x194;_0x32a83f=[];}});})[_0x5f49('0x12')](function(){if(_0x3876de!==0x194){return db[_0x5f49('0x95')]['findAndCountAll']({'where':{'MailAccountId':_0x370323},'order':_0x5f49('0x97')})[_0x5f49('0x12')](function(_0xf89850){_0x32a83f=_0xf89850;});}})['catch'](function(_0x2f1d71){_0x3876de=0x1f4;logger[_0x5f49('0x17')](_0x2f1d71[_0x5f49('0x2b')]);if(_0x2f1d71[_0x5f49('0x2c')]){delete _0x2f1d71[_0x5f49('0x2c')];}_0x32a83f=_0x2f1d71;})[_0x5f49('0x98')](function(){if(_0x32a83f===null){_0x12f91c[_0x5f49('0x1d')](_0x3876de);}else{if(_0x3876de===0x1f4){_0x12f91c[_0x5f49('0x1e')](_0x3876de)[_0x5f49('0x2d')](_0x32a83f);}else{_0x12f91c[_0x5f49('0x1e')](_0x3876de)[_0x5f49('0x25')](_0x32a83f);}}});};exports[_0x5f49('0x99')]=function(_0x1f332c,_0x3340fe){var _0x43eac4={};var _0x29f89f={};var _0x1d32f8;var _0x1ee683;return db[_0x5f49('0x49')][_0x5f49('0x73')]({'where':{'id':_0x1f332c[_0x5f49('0x5f')]['id']}})[_0x5f49('0x12')](handleEntityNotFound(_0x3340fe,null))[_0x5f49('0x12')](function(_0x42ad61){if(_0x42ad61){_0x1d32f8=_0x42ad61;_0x29f89f[_0x5f49('0x4e')]=_[_0x5f49('0x60')](db['MailApplication']['rawAttributes']);_0x29f89f[_0x5f49('0x4f')]=_[_0x5f49('0x60')](_0x1f332c[_0x5f49('0x4f')]);_0x29f89f[_0x5f49('0x50')]=_[_0x5f49('0x51')](_0x29f89f[_0x5f49('0x4e')],_0x29f89f[_0x5f49('0x4f')]);_0x43eac4['attributes']=_[_0x5f49('0x51')](_0x29f89f[_0x5f49('0x4e')],qs[_0x5f49('0x53')](_0x1f332c[_0x5f49('0x4f')][_0x5f49('0x53')]));_0x43eac4['attributes']=_0x43eac4['attributes'][_0x5f49('0x54')]?_0x43eac4[_0x5f49('0x52')]:_0x29f89f['model'];_0x43eac4[_0x5f49('0x6d')]=qs[_0x5f49('0x56')](_0x1f332c['query'][_0x5f49('0x56')]);_0x43eac4[_0x5f49('0x57')]=qs[_0x5f49('0x50')](_[_0x5f49('0x6e')](_0x1f332c[_0x5f49('0x4f')],_0x29f89f[_0x5f49('0x50')]));if(_0x1f332c[_0x5f49('0x4f')][_0x5f49('0x58')]){_0x43eac4[_0x5f49('0x57')]=_[_0x5f49('0x59')](_0x43eac4[_0x5f49('0x57')],{'$or':_['map'](_0x43eac4[_0x5f49('0x52')],function(_0x599d20){var _0x5d7fe4={};_0x5d7fe4[_0x599d20]={'$like':'%'+_0x1f332c['query'][_0x5f49('0x58')]+'%'};return _0x5d7fe4;})});}_0x43eac4=_[_0x5f49('0x59')]({},_0x43eac4,_0x1f332c[_0x5f49('0x5b')]);return _0x1d32f8[_0x5f49('0x99')](_0x43eac4);}})[_0x5f49('0x12')](function(_0x4d1b25){if(_0x4d1b25){_0x1ee683=_0x4d1b25[_0x5f49('0x54')];if(!_0x1f332c[_0x5f49('0x4f')][_0x5f49('0x55')]('nolimit')){_0x43eac4['limit']=qs[_0x5f49('0x21')](_0x1f332c[_0x5f49('0x4f')][_0x5f49('0x21')]);_0x43eac4[_0x5f49('0x20')]=qs[_0x5f49('0x20')](_0x1f332c[_0x5f49('0x4f')]['offset']);}return _0x1d32f8['getApplications'](_0x43eac4);}})[_0x5f49('0x12')](function(_0x5982a0){if(_0x5982a0){return _0x5982a0?{'count':_0x1ee683,'rows':_0x5982a0}:null;}})[_0x5f49('0x12')](respondWithResult(_0x3340fe,null))[_0x5f49('0x1c')](handleError(_0x3340fe,null));};exports[_0x5f49('0x9a')]=function(_0x39888c,_0x7e8764){var _0x47d506={'raw':!![],'where':{}};var _0x3ea135={};var _0x1504ca={'count':0x0,'rows':[]};return db['MailAccount'][_0x5f49('0x73')]({'where':{'id':_0x39888c[_0x5f49('0x5f')]['id']}})[_0x5f49('0x12')](handleEntityNotFound(_0x7e8764,null))[_0x5f49('0x12')](function(_0x1034b7){if(_0x1034b7){_0x3ea135['model']=_[_0x5f49('0x60')](db['MailMessage'][_0x5f49('0x4a')]);_0x3ea135['query']=_[_0x5f49('0x60')](_0x39888c[_0x5f49('0x4f')]);_0x3ea135[_0x5f49('0x50')]=_[_0x5f49('0x51')](_0x3ea135[_0x5f49('0x4e')],_0x3ea135['query']);_0x47d506[_0x5f49('0x52')]=_['intersection'](_0x3ea135[_0x5f49('0x4e')],qs['fields'](_0x39888c[_0x5f49('0x4f')][_0x5f49('0x53')]));_0x47d506[_0x5f49('0x52')]=_0x47d506[_0x5f49('0x52')][_0x5f49('0x54')]?_0x47d506[_0x5f49('0x52')]:_0x3ea135[_0x5f49('0x4e')];if(!_0x39888c[_0x5f49('0x4f')][_0x5f49('0x55')](_0x5f49('0x6c'))){_0x47d506['limit']=qs[_0x5f49('0x21')](_0x39888c[_0x5f49('0x4f')][_0x5f49('0x21')]);_0x47d506[_0x5f49('0x20')]=qs[_0x5f49('0x20')](_0x39888c[_0x5f49('0x4f')][_0x5f49('0x20')]);}_0x47d506['order']=qs[_0x5f49('0x56')](_0x39888c[_0x5f49('0x4f')][_0x5f49('0x56')]);_0x47d506[_0x5f49('0x57')]=qs['filters'](_[_0x5f49('0x6e')](_0x39888c[_0x5f49('0x4f')],_0x3ea135[_0x5f49('0x50')]));_0x47d506[_0x5f49('0x57')][_0x5f49('0x68')]=_0x1034b7['id'];if(_0x39888c[_0x5f49('0x4f')][_0x5f49('0x58')]){_0x47d506[_0x5f49('0x57')]=_[_0x5f49('0x59')](_0x47d506[_0x5f49('0x57')],{'$or':_['map'](_0x47d506[_0x5f49('0x52')],function(_0x10c910){var _0x4de045={};_0x4de045[_0x10c910]={'$like':'%'+_0x39888c[_0x5f49('0x4f')][_0x5f49('0x58')]+'%'};return _0x4de045;})});}if(_0x39888c[_0x5f49('0x4f')][_0x5f49('0x9b')]){var _0x53cf12=_0x39888c[_0x5f49('0x4f')][_0x5f49('0x9b')][_0x5f49('0x9c')](',');var _0x5b770a={};_0x5b770a[_0x53cf12[0x0]]={'$gte':moment(_0x53cf12[0x1])[_0x5f49('0x9d')](_0x5f49('0x9e'))};_0x47d506[_0x5f49('0x57')]=_[_0x5f49('0x59')](_0x47d506[_0x5f49('0x57')],_0x5b770a);}_0x47d506=_[_0x5f49('0x59')]({},_0x47d506,_0x39888c[_0x5f49('0x5b')]);return db[_0x5f49('0x9f')][_0x5f49('0x23')]({'where':_0x47d506[_0x5f49('0x57')]})[_0x5f49('0x12')](function(_0x25d6f6){_0x1504ca[_0x5f49('0x23')]=_0x25d6f6;if(_0x39888c[_0x5f49('0x4f')][_0x5f49('0x61')]){_0x47d506['include']=[{'all':!![]}];}return db[_0x5f49('0x9f')][_0x5f49('0x8e')](_0x47d506);})[_0x5f49('0x12')](function(_0x440c7f){if(_0x39888c[_0x5f49('0x4f')][_0x5f49('0xa0')]===_0x5f49('0xa1')){for(var _0x5a0ad8=0x0;_0x5a0ad8<_0x440c7f[_0x5f49('0x54')];_0x5a0ad8++){_0x440c7f[_0x5a0ad8]['body']=juice(_0x440c7f[_0x5a0ad8][_0x5f49('0x63')]);}}_0x1504ca[_0x5f49('0x5d')]=_0x440c7f;return _0x1504ca;});}})[_0x5f49('0x12')](respondWithFilteredResult(_0x7e8764,_0x47d506))[_0x5f49('0x1c')](handleError(_0x7e8764,null));};exports[_0x5f49('0x2d')]=function(_0x2d0ba3,_0x5797cc){var _0xb4ca1,_0x502720={},_0x127f1f;if(_0x2d0ba3[_0x5f49('0x63')]['to']){_0x127f1f=_0x2d0ba3[_0x5f49('0x63')]['to'][_0x5f49('0x9c')](',')[0x0];}return db[_0x5f49('0x49')]['find']({'where':{'id':_0x2d0ba3['params']['id']},'include':[{'model':db[_0x5f49('0xa2')],'as':_0x5f49('0xa3'),'include':[{'model':db[_0x5f49('0x85')],'as':_0x5f49('0xa4'),'where':{'email':_0x127f1f},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x5f49('0x45')],'as':_0x5f49('0x42'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x5f49('0xa5'),'raw':!![]}]}]})[_0x5f49('0x12')](handleEntityNotFound(_0x5797cc,null))[_0x5f49('0x12')](function(_0x86a7ba){if(!_0x86a7ba)return;_0xb4ca1=_0x86a7ba;if(!_0x86a7ba['Smtp'])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0x5f49('0xa6')](_0x2d0ba3['body']['from'])){_0x2d0ba3['body'][_0x5f49('0xa7')]=util['format']('%s\x20<%s>',_0x86a7ba[_0x5f49('0x2c')],_0x86a7ba['email']||_0x86a7ba[_0x5f49('0x42')]['user']);}if(_0x2d0ba3[_0x5f49('0x63')][_0x5f49('0xa8')]&&_0x2d0ba3[_0x5f49('0x63')]['attachments'][_0x5f49('0x54')]){for(var _0x1371fd=0x0;_0x1371fd<_0x2d0ba3[_0x5f49('0x63')][_0x5f49('0xa8')][_0x5f49('0x54')];_0x1371fd+=0x1){_0x2d0ba3[_0x5f49('0x63')][_0x5f49('0xa8')][_0x1371fd]={'filename':_0x2d0ba3[_0x5f49('0x63')][_0x5f49('0xa8')][_0x1371fd][_0x5f49('0x2c')],'path':path['join'](config[_0x5f49('0xa9')],_0x5f49('0xaa'),_0x2d0ba3[_0x5f49('0x63')]['attachments'][_0x1371fd]['basename'])};}}var _0x4bff27=_0x86a7ba[_0x5f49('0xab')]();return respondWithRpcPromise('SendMail',_0x5f49('0xac'),{'account':_0x4bff27,'message':_0x2d0ba3[_0x5f49('0x63')]});})['then'](function(_0x190f1f){if(!_0x190f1f)return;_0x502720=_0x190f1f;if(!_0xb4ca1[_0x5f49('0xa3')])throw new Error(_0x5f49('0xad'));if(_0xb4ca1['List']['Contacts'][_0x5f49('0x54')])return _0xb4ca1[_0x5f49('0xa3')]['Contacts'][0x0];return db[_0x5f49('0x85')][_0x5f49('0x6a')](_['defaults'](_0x2d0ba3[_0x5f49('0x63')],{'firstName':_0x2d0ba3['body']['to'],'email':_0x2d0ba3[_0x5f49('0x63')]['to'],'phone':_0x2d0ba3['body']['to'],'ListId':_0xb4ca1[_0x5f49('0xae')]}));})[_0x5f49('0x12')](function(_0xa1b4df){if(!_0xa1b4df)return;var _0x24cdd0={'UserId':_0x2d0ba3[_0x5f49('0x36')]['id'],'ContactId':_0xa1b4df['id'],'MailAccountId':_0xb4ca1['id'],'inReplyTo':_0x502720[_0x5f49('0xaf')],'to':_0x2d0ba3['body'][_0x5f49('0xa7')],'cc':_0x2d0ba3[_0x5f49('0x63')]['cc'],'subject':_0x2d0ba3[_0x5f49('0x63')][_0x5f49('0xb0')],'attach':_0x2d0ba3[_0x5f49('0x63')][_0x5f49('0xb1')],'firstMsgDirection':_0x5f49('0xb2'),'lastMsgAt':moment()['format'](_0x5f49('0x9e')),'lastMsgDirection':_0x5f49('0xb2'),'Messages':[_[_0x5f49('0x59')](_0x2d0ba3[_0x5f49('0x63')],{'messageId':_0x502720[_0x5f49('0xaf')],'sentAt':moment()[_0x5f49('0x9d')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0xb4ca1['id'],'UserId':_0x2d0ba3[_0x5f49('0x36')]['id'],'ContactId':_0xa1b4df['id']})]};if(_0x2d0ba3[_0x5f49('0x63')][_0x5f49('0xb3')]){_0x24cdd0=_['merge'](_0x24cdd0,_0x2d0ba3[_0x5f49('0x63')]['Interaction']);}return db[_0x5f49('0x83')][_0x5f49('0x6a')](_0x24cdd0,{'include':[{'model':db[_0x5f49('0x9f')],'as':_0x5f49('0xb4')}]});})[_0x5f49('0x12')](respondWithResult(_0x5797cc,null))[_0x5f49('0x1c')](handleError(_0x5797cc,null));};exports[_0x5f49('0xb5')]=function(_0x4bbcf0,_0x1da7fb){return db[_0x5f49('0x49')][_0x5f49('0x62')]({'where':{'id':_0x4bbcf0[_0x5f49('0x5f')]['id']},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x5f49('0xa5')],'as':'CloudProvider','raw':!![]}]}]})[_0x5f49('0x12')](handleEntityNotFound(_0x1da7fb,null))[_0x5f49('0x12')](function(_0x4fc87a){if(!_0x4fc87a[_0x5f49('0x42')])return;var _0x1de8e7=_0x4fc87a[_0x5f49('0xab')]();return respondWithRpcPromise(_0x5f49('0xb6'),_0x5f49('0xb5'),{'account':_0x1de8e7});})[_0x5f49('0x12')](respondWithResult(_0x1da7fb,null))['catch'](handleError(_0x1da7fb,null));};exports[_0x5f49('0x27')]=function(_0x2ab5d9,_0x56e2da){return db[_0x5f49('0x49')][_0x5f49('0x62')]({'where':{'id':_0x2ab5d9[_0x5f49('0x5f')]['id']}})[_0x5f49('0x12')](handleEntityNotFound(_0x56e2da,null))[_0x5f49('0x12')](function(_0x47bf1a){if(_0x47bf1a&&_0x47bf1a['service']){throw new db[(_0x5f49('0xb7'))][(_0x5f49('0xb8'))](_0x5f49('0xb9'));}return _0x47bf1a;})['then'](removeEntity(_0x56e2da,null))[_0x5f49('0x1c')](handleError(_0x56e2da,null));};exports[_0x5f49('0xba')]=function(_0x471872,_0x55be9d){return db[_0x5f49('0x49')]['find']({'where':{'id':_0x471872[_0x5f49('0x5f')]['id']}})['then'](handleEntityNotFound(_0x55be9d,null))[_0x5f49('0x12')](function(_0x1e4248){if(_0x1e4248){return _0x1e4248[_0x5f49('0xba')](_0x471872[_0x5f49('0x63')]['ids'],_[_0x5f49('0x84')](_0x471872[_0x5f49('0x63')],['ids','id'])||{})[_0x5f49('0xbb')](function(_0x4bc52a){for(var _0x208856=0x0;_0x208856<_0x471872[_0x5f49('0x63')][_0x5f49('0x70')]['length'];_0x208856+=0x1){socket['emit'](_0x5f49('0xbc'),{'UserId':Number(_0x471872[_0x5f49('0x63')][_0x5f49('0x70')][_0x208856]),'MailAccountId':Number(_0x471872[_0x5f49('0x5f')]['id'])});}return _0x4bc52a;});}})[_0x5f49('0x12')](respondWithResult(_0x55be9d,null))[_0x5f49('0x1c')](handleError(_0x55be9d,null));};exports[_0x5f49('0xbd')]=function(_0x1c5c42,_0x3c18ed){return db[_0x5f49('0x49')][_0x5f49('0x62')]({'where':{'id':_0x1c5c42[_0x5f49('0x5f')]['id']}})[_0x5f49('0x12')](handleEntityNotFound(_0x3c18ed,null))['then'](function(_0x3aa07d){if(_0x3aa07d){return _0x3aa07d[_0x5f49('0xbd')](_0x1c5c42[_0x5f49('0x4f')][_0x5f49('0x70')])['then'](function(){if(_[_0x5f49('0xbe')](_0x1c5c42[_0x5f49('0x4f')][_0x5f49('0x70')])){for(var _0x5ddc57=0x0;_0x5ddc57<_0x1c5c42[_0x5f49('0x4f')][_0x5f49('0x70')]['length'];_0x5ddc57+=0x1){socket[_0x5f49('0xbf')](_0x5f49('0xc0'),{'UserId':Number(_0x1c5c42['query'][_0x5f49('0x70')][_0x5ddc57]),'MailAccountId':Number(_0x1c5c42[_0x5f49('0x5f')]['id'])});}}else{socket[_0x5f49('0xbf')](_0x5f49('0xc0'),{'UserId':Number(_0x1c5c42['query'][_0x5f49('0x70')]),'MailAccountId':Number(_0x1c5c42[_0x5f49('0x5f')]['id'])});}});}})[_0x5f49('0x12')](respondWithStatusCode(_0x3c18ed,null))[_0x5f49('0x1c')](handleError(_0x3c18ed,null));};exports['getAgents']=function(_0x25c353,_0x171eaf){var _0x42d749={};var _0x5d0570={};var _0xe7efad;var _0x380eab;return db[_0x5f49('0x49')][_0x5f49('0x73')]({'where':{'id':_0x25c353[_0x5f49('0x5f')]['id']}})[_0x5f49('0x12')](handleEntityNotFound(_0x171eaf,null))[_0x5f49('0x12')](function(_0x150260){if(_0x150260){_0xe7efad=_0x150260;_0x5d0570['model']=_[_0x5f49('0x60')](db['User'][_0x5f49('0x4a')]);_0x5d0570[_0x5f49('0x4f')]=_['keys'](_0x25c353[_0x5f49('0x4f')]);_0x5d0570['filters']=_[_0x5f49('0x51')](_0x5d0570[_0x5f49('0x4e')],_0x5d0570[_0x5f49('0x4f')]);_0x42d749[_0x5f49('0x52')]=_[_0x5f49('0x51')](_0x5d0570[_0x5f49('0x4e')],qs[_0x5f49('0x53')](_0x25c353['query'][_0x5f49('0x53')]));_0x42d749[_0x5f49('0x52')]=_0x42d749[_0x5f49('0x52')][_0x5f49('0x54')]?_0x42d749[_0x5f49('0x52')]:_0x5d0570[_0x5f49('0x4e')];_0x42d749[_0x5f49('0x6d')]=qs[_0x5f49('0x56')](_0x25c353[_0x5f49('0x4f')][_0x5f49('0x56')]);_0x42d749[_0x5f49('0x57')]=qs[_0x5f49('0x50')](_[_0x5f49('0x6e')](_0x25c353[_0x5f49('0x4f')],_0x5d0570['filters']));if(_0x25c353[_0x5f49('0x4f')][_0x5f49('0x58')]){_0x42d749[_0x5f49('0x57')]=_[_0x5f49('0x59')](_0x42d749[_0x5f49('0x57')],{'$or':_[_0x5f49('0x48')](_0x42d749['attributes'],function(_0x44a210){var _0x298ab8={};_0x298ab8[_0x44a210]={'$like':'%'+_0x25c353[_0x5f49('0x4f')][_0x5f49('0x58')]+'%'};return _0x298ab8;})});}_0x42d749=_[_0x5f49('0x59')]({},_0x42d749,_0x25c353[_0x5f49('0x5b')]);return _0xe7efad[_0x5f49('0xc1')](_0x42d749);}})[_0x5f49('0x12')](function(_0xf17bc6){if(_0xf17bc6){_0x380eab=_0xf17bc6[_0x5f49('0x54')];if(!_0x25c353['query']['hasOwnProperty']('nolimit')){_0x42d749[_0x5f49('0x21')]=qs['limit'](_0x25c353[_0x5f49('0x4f')][_0x5f49('0x21')]);_0x42d749[_0x5f49('0x20')]=qs[_0x5f49('0x20')](_0x25c353[_0x5f49('0x4f')][_0x5f49('0x20')]);}return _0xe7efad[_0x5f49('0xc1')](_0x42d749);}})[_0x5f49('0x12')](function(_0x118770){if(_0x118770){return _0x118770?{'count':_0x380eab,'rows':_0x118770}:null;}})[_0x5f49('0x12')](respondWithResult(_0x171eaf,null))[_0x5f49('0x1c')](handleError(_0x171eaf,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 4bb66e8..68971d3 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 _0x8cc1=['save','update','remove','emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x8cc1,0x14e));var _0x18cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8cc1[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0x18cc('0x0'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x18cc('0x1')](0x0);var events={'afterCreate':_0x18cc('0x2'),'afterUpdate':_0x18cc('0x3'),'afterDestroy':_0x18cc('0x4')};function emitEvent(_0x47a61b){return function(_0x42cc6b,_0x48b5b0,_0x1e39ca){MailAccountEvents[_0x18cc('0x5')](_0x47a61b+':'+_0x42cc6b['id'],_0x42cc6b);MailAccountEvents[_0x18cc('0x5')](_0x47a61b,_0x42cc6b);_0x1e39ca(null);};}for(var e in events){if(events[_0x18cc('0x6')](e)){var event=events[e];MailAccount[_0x18cc('0x7')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0x0023=['update','emit','hasOwnProperty','hook','exports','events','MailAccount','setMaxListeners','save'];(function(_0x1fd4fb,_0x4c727a){var _0x395047=function(_0x376711){while(--_0x376711){_0x1fd4fb['push'](_0x1fd4fb['shift']());}};_0x395047(++_0x4c727a);}(_0x0023,0x10a));var _0x3002=function(_0x575b4c,_0x3f1d33){_0x575b4c=_0x575b4c-0x0;var _0x169ce9=_0x0023[_0x575b4c];return _0x169ce9;};'use strict';var EventEmitter=require(_0x3002('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x3002('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x3002('0x2')](0x0);var events={'afterCreate':_0x3002('0x3'),'afterUpdate':_0x3002('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1eb073){return function(_0x5b257c,_0x531e8c,_0x220c23){MailAccountEvents['emit'](_0x1eb073+':'+_0x5b257c['id'],_0x5b257c);MailAccountEvents[_0x3002('0x5')](_0x1eb073,_0x5b257c);_0x220c23(null);};}for(var e in events){if(events[_0x3002('0x6')](e)){var event=events[e];MailAccount[_0x3002('0x7')](e,emitEvent(event));}}module[_0x3002('0x8')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 4341ca7..9e2880d 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 _0x6891=['service','host','port','Smtp','secure','authentication','modernAuthentication','auth','CloudProvider','data5','user','pass','exports','define','MailAccount','mail_accounts','provider'];(function(_0xa43e71,_0x359151){var _0x408e63=function(_0x50aaa5){while(--_0x50aaa5){_0xa43e71['push'](_0xa43e71['shift']());}};_0x408e63(++_0x359151);}(_0x6891,0xd8));var _0x1689=function(_0x2577f7,_0x4e4781){_0x2577f7=_0x2577f7-0x0;var _0x55d372=_0x6891[_0x2577f7];return _0x55d372;};'use strict';var attributes=require('./mailAccount.attributes');module[_0x1689('0x0')]=function(_0x53d2ed){return _0x53d2ed[_0x1689('0x1')](_0x1689('0x2'),attributes,{'tableName':_0x1689('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0xc7aabb=this;var _0x33c2bc={'id':_0xc7aabb['id'],'tls':{'rejectUnauthorized':![]}};if(_0xc7aabb[_0x1689('0x4')]!=='custom'){_0x33c2bc[_0x1689('0x5')]=_0xc7aabb[_0x1689('0x4')];}else{_0x33c2bc['host']=_0xc7aabb['Smtp'][_0x1689('0x6')];_0x33c2bc[_0x1689('0x7')]=_0xc7aabb[_0x1689('0x8')][_0x1689('0x7')];_0x33c2bc[_0x1689('0x9')]=_0xc7aabb[_0x1689('0x8')][_0x1689('0x9')];}if(_0xc7aabb[_0x1689('0x8')][_0x1689('0xa')]){if(_0xc7aabb[_0x1689('0x8')][_0x1689('0xb')]){if(!_0xc7aabb[_0x1689('0x8')]['CloudProvider'])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x33c2bc[_0x1689('0xc')]={'type':'OAuth2','user':_0xc7aabb[_0x1689('0x8')]['user'],'accessToken':_0xc7aabb[_0x1689('0x8')][_0x1689('0xd')][_0x1689('0xe')]};}else{_0x33c2bc[_0x1689('0xc')]={'user':_0xc7aabb['Smtp'][_0x1689('0xf')],'pass':_0xc7aabb[_0x1689('0x8')][_0x1689('0x10')]};}}return _0x33c2bc;}}});}; \ No newline at end of file +var _0xbe2c=['mail_accounts','provider','custom','service','host','port','Smtp','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','data5','pass','exports','define','MailAccount'];(function(_0x395a5c,_0x1a8e95){var _0x4c0e1e=function(_0x4338a2){while(--_0x4338a2){_0x395a5c['push'](_0x395a5c['shift']());}};_0x4c0e1e(++_0x1a8e95);}(_0xbe2c,0x9d));var _0xcbe2=function(_0x5f0ddd,_0x2e3bf0){_0x5f0ddd=_0x5f0ddd-0x0;var _0x284420=_0xbe2c[_0x5f0ddd];return _0x284420;};'use strict';var attributes=require('./mailAccount.attributes');module[_0xcbe2('0x0')]=function(_0x9988b9){return _0x9988b9[_0xcbe2('0x1')](_0xcbe2('0x2'),attributes,{'tableName':_0xcbe2('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x5526cc=this;var _0x2dbcc0={'id':_0x5526cc['id'],'tls':{'rejectUnauthorized':![]}};if(_0x5526cc[_0xcbe2('0x4')]!==_0xcbe2('0x5')){_0x2dbcc0[_0xcbe2('0x6')]=_0x5526cc[_0xcbe2('0x4')];}else{_0x2dbcc0[_0xcbe2('0x7')]=_0x5526cc['Smtp'][_0xcbe2('0x7')];_0x2dbcc0[_0xcbe2('0x8')]=_0x5526cc[_0xcbe2('0x9')][_0xcbe2('0x8')];_0x2dbcc0[_0xcbe2('0xa')]=_0x5526cc[_0xcbe2('0x9')][_0xcbe2('0xa')];}if(_0x5526cc[_0xcbe2('0x9')][_0xcbe2('0xb')]){if(_0x5526cc[_0xcbe2('0x9')][_0xcbe2('0xc')]){if(!_0x5526cc[_0xcbe2('0x9')][_0xcbe2('0xd')])throw new Error(_0xcbe2('0xe'));_0x2dbcc0[_0xcbe2('0xf')]={'type':_0xcbe2('0x10'),'user':_0x5526cc[_0xcbe2('0x9')][_0xcbe2('0x11')],'accessToken':_0x5526cc[_0xcbe2('0x9')][_0xcbe2('0xd')][_0xcbe2('0x12')]};}else{_0x2dbcc0[_0xcbe2('0xf')]={'user':_0x5526cc['Smtp'][_0xcbe2('0x11')],'pass':_0x5526cc[_0xcbe2('0x9')][_0xcbe2('0x13')]};}}return _0x2dbcc0;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index a998dc7..8038710 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 _0x4137=['Smtp','CloudProvider','get','omit','Applications','applications','priority','asc','push','length','Contacts','create','contact','messageId','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Contact\x20not\x20found','spread','update','interaction','created','MailMessage','originTo','originCc','bcc','originChannel','ChatOfflineMessageId','Attachment','Attachments','User','name','UserId','*,*,*,*','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','request\x20sent','debug','stringify','error','MailAccount,\x20%s,\x20%s','message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowMailAccount','find','smtp','setDataValue','smtpOptions','getSmtpOptions','mail','difference','keys','CmContact','createdAt','CompanyId','ListId','body','isNil','from','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','account','CmList','List','DESC','MailServerOut'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x4137,0xf8));var _0x7413=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4137[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x7413('0x0'));var moment=require(_0x7413('0x1'));var BPromise=require(_0x7413('0x2'));var rs=require(_0x7413('0x3'));var Redis=require(_0x7413('0x4'));var db=require(_0x7413('0x5'))['db'];var logger=require(_0x7413('0x6'))(_0x7413('0x7'));var config=require(_0x7413('0x8'));var jayson=require(_0x7413('0x9'));var client=jayson[_0x7413('0xa')][_0x7413('0xb')]({'port':0x232c});config['redis']=_[_0x7413('0xc')](config[_0x7413('0xd')],{'host':_0x7413('0xe'),'port':0x18eb});var socket=require(_0x7413('0xf'))(new Redis(config['redis']));require(_0x7413('0x10'))[_0x7413('0x11')](socket);function respondWithRpcPromise(_0x4e320b,_0x422bf5,_0x2f4b54){return new BPromise(function(_0x50fde0,_0x29f124){return client[_0x7413('0x12')](_0x4e320b,_0x2f4b54)[_0x7413('0x13')](function(_0x3e026b){logger[_0x7413('0x14')]('MailAccount,\x20%s,\x20%s',_0x422bf5,_0x7413('0x15'));logger[_0x7413('0x16')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x422bf5,_0x7413('0x15'),JSON[_0x7413('0x17')](_0x3e026b));if(_0x3e026b[_0x7413('0x18')]){if(_0x3e026b['error']['code']===0x1f4){logger['error'](_0x7413('0x19'),_0x422bf5,_0x3e026b[_0x7413('0x18')]['message']);return _0x29f124(_0x3e026b[_0x7413('0x18')][_0x7413('0x1a')]);}logger['error'](_0x7413('0x19'),_0x422bf5,_0x3e026b['error']['message']);return _0x50fde0(_0x3e026b[_0x7413('0x18')]['message']);}else{logger[_0x7413('0x14')]('MailAccount,\x20%s,\x20%s',_0x422bf5,_0x7413('0x15'));_0x50fde0(_0x3e026b[_0x7413('0x1b')][_0x7413('0x1a')]);}})[_0x7413('0x1c')](function(_0x2a3417){logger[_0x7413('0x18')]('MailAccount,\x20%s,\x20%s',_0x422bf5,_0x2a3417);_0x29f124(_0x2a3417);});});}exports[_0x7413('0x1d')]=function(_0x17c062){var _0x11f8a1=this;return new Promise(function(_0xfe5b8c,_0x5bee15){return db[_0x7413('0x1e')][_0x7413('0x1f')]({'raw':_0x17c062[_0x7413('0x20')]?_0x17c062[_0x7413('0x20')][_0x7413('0x21')]===undefined?!![]:![]:!![],'where':_0x17c062[_0x7413('0x20')]?_0x17c062[_0x7413('0x20')][_0x7413('0x22')]||null:null,'attributes':_0x17c062['options']?_0x17c062['options'][_0x7413('0x23')]||null:null,'limit':_0x17c062['options']?_0x17c062[_0x7413('0x20')][_0x7413('0x24')]||null:null,'include':_0x17c062[_0x7413('0x20')]?_0x17c062[_0x7413('0x20')][_0x7413('0x25')]?_[_0x7413('0x26')](_0x17c062[_0x7413('0x20')][_0x7413('0x25')],function(_0x1d455b){return{'model':db[_0x1d455b['model']],'as':_0x1d455b['as'],'attributes':_0x1d455b['attributes'],'include':_0x1d455b[_0x7413('0x25')]?_['map'](_0x1d455b[_0x7413('0x25')],function(_0x71cbb4){return{'model':db[_0x71cbb4[_0x7413('0x27')]],'as':_0x71cbb4['as'],'attributes':_0x71cbb4['attributes'],'include':_0x71cbb4[_0x7413('0x25')]?_[_0x7413('0x26')](_0x71cbb4[_0x7413('0x25')],function(_0x4843fd){return{'model':db[_0x4843fd[_0x7413('0x27')]],'as':_0x4843fd['as'],'attributes':_0x4843fd[_0x7413('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x24dce7){logger['info'](_0x7413('0x1d'),_0x17c062);logger[_0x7413('0x16')](_0x7413('0x1d'),_0x17c062,JSON[_0x7413('0x17')](_0x24dce7));_0xfe5b8c(_0x24dce7);})[_0x7413('0x1c')](function(_0x2004ea){logger['error'](_0x7413('0x1d'),_0x2004ea[_0x7413('0x1a')],_0x17c062);_0x5bee15(_0x11f8a1[_0x7413('0x18')](0x1f4,_0x2004ea[_0x7413('0x1a')]));});});};exports[_0x7413('0x28')]=function(_0x256395){var _0x185cfe=this;return new Promise(function(_0x5b4426,_0xd763f9){return db[_0x7413('0x1e')][_0x7413('0x29')]({'raw':_0x256395[_0x7413('0x20')]?_0x256395[_0x7413('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x256395[_0x7413('0x20')]?_0x256395['options'][_0x7413('0x22')]||null:null,'attributes':_0x256395[_0x7413('0x20')]?_0x256395[_0x7413('0x20')]['attributes']||null:null,'include':_0x256395[_0x7413('0x20')]?_0x256395['options'][_0x7413('0x25')]?_[_0x7413('0x26')](_0x256395['options']['include'],function(_0x440bfe){return{'model':db[_0x440bfe[_0x7413('0x27')]],'as':_0x440bfe['as'],'attributes':_0x440bfe[_0x7413('0x23')],'include':_0x440bfe['include']?_['map'](_0x440bfe[_0x7413('0x25')],function(_0x5a92ab){return{'model':db[_0x5a92ab['model']],'as':_0x5a92ab['as'],'attributes':_0x5a92ab[_0x7413('0x23')],'include':_0x5a92ab['include']?_[_0x7413('0x26')](_0x5a92ab[_0x7413('0x25')],function(_0xf34b21){return{'model':db[_0xf34b21[_0x7413('0x27')]],'as':_0xf34b21['as'],'attributes':_0xf34b21[_0x7413('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xa58bd2){if(_0x256395[_0x7413('0x20')][_0x7413('0x2a')]===!![])_0xa58bd2[_0x7413('0x2b')](_0x7413('0x2c'),_0xa58bd2[_0x7413('0x2d')]());logger[_0x7413('0x14')](_0x7413('0x28'),_0x256395);logger[_0x7413('0x16')](_0x7413('0x28'),_0x256395,JSON[_0x7413('0x17')](_0xa58bd2));_0x5b4426(_0xa58bd2);})[_0x7413('0x1c')](function(_0x5a9791){logger[_0x7413('0x18')]('ShowMailAccount',_0x5a9791['message'],_0x256395);_0xd763f9(_0x185cfe['error'](0x1f4,_0x5a9791['message']));});});};exports['NotifyMailAccount']=function(_0x44af7d){var _0x4c1770=this;return new Promise(function(_0x535e49,_0x5dc077){var _0x4d0008={'body':_0x44af7d['body'],'channel':_0x7413('0x2e')};var _0x32f1e8=_[_0x7413('0x2f')](_[_0x7413('0x30')](db[_0x7413('0x31')]['rawAttributes']),[_0x7413('0x32'),'updatedAt',_0x7413('0x33'),_0x7413('0x34')]);var _0xa063d1=![];if(_0x44af7d[_0x7413('0x35')]['id']){delete _0x44af7d[_0x7413('0x35')]['id'];}if(_[_0x7413('0x36')](_0x44af7d[_0x7413('0x35')][_0x7413('0x37')])){return _0x5dc077(_0x4c1770[_0x7413('0x18')](0x1f4,_0x7413('0x38')));}if(_[_0x7413('0x36')](_0x44af7d[_0x7413('0x35')][_0x7413('0x35')])||_0x44af7d['body'][_0x7413('0x35')]===''){return _0x5dc077(_0x4c1770[_0x7413('0x18')](0x1f4,_0x7413('0x39')));}if(_[_0x7413('0x36')](_0x44af7d[_0x7413('0x35')][_0x7413('0x3a')])){return _0x5dc077(_0x4c1770[_0x7413('0x18')](0x1f4,_0x7413('0x3b')+_0x32f1e8));}if(!_[_0x7413('0x3c')](_0x32f1e8,_0x44af7d[_0x7413('0x35')][_0x7413('0x3a')])){return _0x5dc077(_0x4c1770['error'](0x1f4,_0x7413('0x3d')+_0x32f1e8));}var _0x52a088={};_0x52a088[_0x44af7d[_0x7413('0x35')][_0x7413('0x3a')]]=_0x44af7d[_0x7413('0x35')][_0x7413('0x37')];return db[_0x7413('0x1e')][_0x7413('0x29')]({'where':{'id':_0x44af7d[_0x7413('0x3e')]['id']},'include':[{'model':db[_0x7413('0x3f')],'as':_0x7413('0x40'),'include':[{'model':db[_0x7413('0x31')],'as':'Contacts','where':_0x52a088,'limit':0x1,'order':[['updatedAt',_0x7413('0x41')]]}]},{'model':db['MailApplication'],'as':'Applications'},{'model':db[_0x7413('0x42')],'as':_0x7413('0x43'),'include':[{'model':db['CloudProvider'],'as':_0x7413('0x44')}]}]})['then'](function(_0x562bae){if(_0x562bae&&_0x562bae[_0x7413('0x40')]){var _0x5f263e=_0x562bae[_0x7413('0x45')]({'plain':!![]});_0x4d0008[_0x7413('0x3e')]=_[_0x7413('0x46')](_0x5f263e,[_0x7413('0x47'),_0x7413('0x40')]);_0x4d0008[_0x7413('0x3e')][_0x7413('0x2c')]=_0x562bae[_0x7413('0x2d')]();_0x4d0008[_0x7413('0x48')]=_0x5f263e[_0x7413('0x47')];_0x4d0008['list']=_0x5f263e[_0x7413('0x40')];_0x4d0008['applications']=_['orderBy'](_0x4d0008['applications'],[_0x7413('0x49')],[_0x7413('0x4a')]);if(_0x4d0008[_0x7413('0x3e')]&&_0x4d0008[_0x7413('0x3e')]['autoclose']){_0x4d0008['applications'][_0x7413('0x4b')]({'id':0x0,'priority':_0x4d0008['applications'][_0x7413('0x4c')]+0x1,'app':'close','appdata':'autoclose','interval':'*,*,*,*'});}if(_0x4d0008['account']['Applications']){delete _0x4d0008[_0x7413('0x3e')][_0x7413('0x47')];}if(_0x4d0008[_0x7413('0x3e')][_0x7413('0x40')]){delete _0x4d0008[_0x7413('0x3e')]['List'];}if(_0x5f263e[_0x7413('0x40')][_0x7413('0x4d')][_0x7413('0x4c')]){return _0x5f263e['List'][_0x7413('0x4d')][0x0];}var _0x5c3324=_['defaults'](_0x44af7d[_0x7413('0x35')],{'firstName':_0x44af7d[_0x7413('0x35')][_0x7413('0x37')],'ListId':_0x5f263e[_0x7413('0x34')]});_0x5c3324[_0x44af7d[_0x7413('0x35')][_0x7413('0x3a')]]=_0x44af7d['body'][_0x7413('0x37')];return db['CmContact'][_0x7413('0x4e')](_0x5c3324);}else{throw new Error('List\x20not\x20found');}})[_0x7413('0x13')](function(_0x4d4faa){_0x4d0008[_0x7413('0x4f')]=_0x4d4faa;if(_0x4d4faa){if(!_0x44af7d[_0x7413('0x35')]['message'][_0x7413('0x50')]){_0x44af7d['body'][_0x7413('0x1a')][_0x7413('0x50')]=rs['generate']()+'\x20'+_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')]['from'];}var _0x3ce34c={'ContactId':_0x4d4faa['id'],'MailAccountId':_0x44af7d[_0x7413('0x3e')]['id'],'inReplyTo':_0x44af7d['body'][_0x7413('0x1a')][_0x7413('0x50')],'to':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')][_0x7413('0x37')],'cc':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')]['cc'],'subject':_0x44af7d[_0x7413('0x35')]['message'][_0x7413('0x51')],'attach':_0x44af7d['body'][_0x7413('0x1a')][_0x7413('0x52')],'lastMsgAt':moment()[_0x7413('0x53')](_0x7413('0x54')),'lastMsgDirection':'in'};return db['MailInteraction']['find']({'where':{'closed':![],'MailAccountId':_0x44af7d['account']['id']},'include':[{'model':db['MailMessage'],'as':'Messages','attributes':[_0x7413('0x50')],'where':{'messageId':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')]['inReplyTo']}}]})[_0x7413('0x13')](function(_0xb7dd83){if(_0xb7dd83){return[_0xb7dd83,![]];}return db[_0x7413('0x55')][_0x7413('0x4e')](_0x3ce34c)[_0x7413('0x13')](function(_0x3db284){return[_0x3db284,!![]];});});}else{throw new Error(_0x7413('0x56'));}})[_0x7413('0x57')](function(_0x1ec131,_0x47512d){if(_0x1ec131){_0xa063d1=_0x47512d;if(!_0x47512d){return _0x1ec131[_0x7413('0x58')]({'inReplyTo':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')]['messageId'],'to':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')]['from'],'cc':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')]['cc'],'subject':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')][_0x7413('0x51')],'attach':_0x1ec131[_0x7413('0x52')]?_0x1ec131['attach']:_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')]['attach'],'substatus':null,'substatusAt':moment()[_0x7413('0x53')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()['format'](_0x7413('0x54')),'lastMsgDirection':'in'});}else{return _0x1ec131;}}})[_0x7413('0x13')](function(_0x167c6b){_0x4d0008[_0x7413('0x59')]=_0x167c6b[_0x7413('0x45')]({'plain':!![]});_0x4d0008[_0x7413('0x59')][_0x7413('0x5a')]=_0xa063d1;return db[_0x7413('0x5b')]['create']({'body':_0x44af7d[_0x7413('0x35')]['body'],'MailAccountId':_0x44af7d[_0x7413('0x3e')]['id'],'MailInteractionId':_0x167c6b['id'],'direction':'in','ContactId':_0x4d0008[_0x7413('0x4f')]['id'],'messageId':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')][_0x7413('0x50')],'from':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')][_0x7413('0x37')],'to':_0x44af7d[_0x7413('0x35')]['message']['to'],'cc':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')]['cc'],'subject':_0x44af7d['body'][_0x7413('0x1a')][_0x7413('0x51')],'attach':_0x44af7d['body'][_0x7413('0x1a')]['attach'],'Attachments':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')]['attachments'],'originTo':_0x44af7d['body'][_0x7413('0x1a')][_0x7413('0x5c')],'originCc':_0x44af7d[_0x7413('0x35')]['message'][_0x7413('0x5d')],'bcc':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')][_0x7413('0x5e')],'ChatWebsiteId':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')]['ChatWebsiteId']||null,'originChannel':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')][_0x7413('0x5f')]||'Email','ChatOfflineMessageId':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')][_0x7413('0x60')]||null},{'include':[{'model':db[_0x7413('0x61')],'as':_0x7413('0x62')}]});})[_0x7413('0x13')](function(_0x46e9f8){_0x4d0008[_0x7413('0x1a')]=_0x46e9f8;if(_0x4d0008[_0x7413('0x59')]['UserId']){return db[_0x7413('0x63')][_0x7413('0x29')]({'attributes':['id',_0x7413('0x64')],'where':{'id':_0x4d0008[_0x7413('0x59')][_0x7413('0x65')]}})[_0x7413('0x13')](function(_0x4c9d1b){if(_0x4c9d1b){_0x4d0008[_0x7413('0x48')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4c9d1b[_0x7413('0x64')]+','+(_0x4d0008[_0x7413('0x3e')]['waitForTheAssignedAgent']||0xa),'interval':_0x7413('0x66')});}return respondWithRpcPromise(_0x7413('0x67'),_0x7413('0x68'),_0x4d0008);});}return respondWithRpcPromise(_0x7413('0x67'),_0x7413('0x68'),_0x4d0008);})[_0x7413('0x13')](function(_0x2d361c){_0x535e49(_0x2d361c);})[_0x7413('0x1c')](function(_0x5f4765){_0x5dc077(_0x4c1770[_0x7413('0x18')](0x1f4,_0x5f4765['message']));});});}; \ No newline at end of file +var _0xba34=['MailApplication','MailServerOut','Smtp','CloudProvider','get','omit','Applications','getSmtpOptions','list','applications','orderBy','priority','asc','autoclose','push','length','close','*,*,*,*','Contacts','from','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','MailInteraction','MailMessage','Messages','inReplyTo','spread','update','YYYY-MM-DD\x20HH:mm:ss','interaction','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','GetMailAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowMailAccount','MailAccount','find','setDataValue','smtpOptions','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','DESC'];(function(_0x2c921c,_0x3c6a85){var _0x440bf2=function(_0x4db0df){while(--_0x4db0df){_0x2c921c['push'](_0x2c921c['shift']());}};_0x440bf2(++_0x3c6a85);}(_0xba34,0x119));var _0x4ba3=function(_0x398c1b,_0xa83123){_0x398c1b=_0x398c1b-0x0;var _0x42329a=_0xba34[_0x398c1b];return _0x42329a;};'use strict';var _=require(_0x4ba3('0x0'));var moment=require(_0x4ba3('0x1'));var BPromise=require(_0x4ba3('0x2'));var rs=require(_0x4ba3('0x3'));var Redis=require(_0x4ba3('0x4'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')('rpc');var config=require(_0x4ba3('0x5'));var jayson=require(_0x4ba3('0x6'));var client=jayson[_0x4ba3('0x7')][_0x4ba3('0x8')]({'port':0x232c});config[_0x4ba3('0x9')]=_[_0x4ba3('0xa')](config[_0x4ba3('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x4ba3('0xb'))(new Redis(config[_0x4ba3('0x9')]));require(_0x4ba3('0xc'))[_0x4ba3('0xd')](socket);function respondWithRpcPromise(_0x380d60,_0xcf1ec3,_0x292f58){return new BPromise(function(_0x3f653c,_0x2ed106){return client[_0x4ba3('0xe')](_0x380d60,_0x292f58)[_0x4ba3('0xf')](function(_0x51edab){logger[_0x4ba3('0x10')](_0x4ba3('0x11'),_0xcf1ec3,'request\x20sent');logger[_0x4ba3('0x12')]('MailAccount,\x20%s,\x20%s,\x20%s',_0xcf1ec3,_0x4ba3('0x13'),JSON['stringify'](_0x51edab));if(_0x51edab[_0x4ba3('0x14')]){if(_0x51edab[_0x4ba3('0x14')][_0x4ba3('0x15')]===0x1f4){logger[_0x4ba3('0x14')](_0x4ba3('0x11'),_0xcf1ec3,_0x51edab[_0x4ba3('0x14')][_0x4ba3('0x16')]);return _0x2ed106(_0x51edab[_0x4ba3('0x14')][_0x4ba3('0x16')]);}logger[_0x4ba3('0x14')](_0x4ba3('0x11'),_0xcf1ec3,_0x51edab[_0x4ba3('0x14')][_0x4ba3('0x16')]);return _0x3f653c(_0x51edab[_0x4ba3('0x14')][_0x4ba3('0x16')]);}else{logger[_0x4ba3('0x10')]('MailAccount,\x20%s,\x20%s',_0xcf1ec3,_0x4ba3('0x13'));_0x3f653c(_0x51edab[_0x4ba3('0x17')][_0x4ba3('0x16')]);}})[_0x4ba3('0x18')](function(_0x556290){logger[_0x4ba3('0x14')](_0x4ba3('0x11'),_0xcf1ec3,_0x556290);_0x2ed106(_0x556290);});});}exports[_0x4ba3('0x19')]=function(_0x1e2ce5){var _0x184332=this;return new Promise(function(_0x125944,_0x4b2791){return db['MailAccount'][_0x4ba3('0x1a')]({'raw':_0x1e2ce5['options']?_0x1e2ce5[_0x4ba3('0x1b')][_0x4ba3('0x1c')]===undefined?!![]:![]:!![],'where':_0x1e2ce5[_0x4ba3('0x1b')]?_0x1e2ce5[_0x4ba3('0x1b')][_0x4ba3('0x1d')]||null:null,'attributes':_0x1e2ce5[_0x4ba3('0x1b')]?_0x1e2ce5['options'][_0x4ba3('0x1e')]||null:null,'limit':_0x1e2ce5[_0x4ba3('0x1b')]?_0x1e2ce5['options'][_0x4ba3('0x1f')]||null:null,'include':_0x1e2ce5['options']?_0x1e2ce5[_0x4ba3('0x1b')][_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x1e2ce5[_0x4ba3('0x1b')][_0x4ba3('0x20')],function(_0xe29a49){return{'model':db[_0xe29a49[_0x4ba3('0x22')]],'as':_0xe29a49['as'],'attributes':_0xe29a49[_0x4ba3('0x1e')],'include':_0xe29a49[_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0xe29a49['include'],function(_0x252f37){return{'model':db[_0x252f37[_0x4ba3('0x22')]],'as':_0x252f37['as'],'attributes':_0x252f37[_0x4ba3('0x1e')],'include':_0x252f37['include']?_[_0x4ba3('0x21')](_0x252f37[_0x4ba3('0x20')],function(_0x44d78c){return{'model':db[_0x44d78c['model']],'as':_0x44d78c['as'],'attributes':_0x44d78c[_0x4ba3('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4ba3('0xf')](function(_0x34ecb4){logger[_0x4ba3('0x10')]('GetMailAccount',_0x1e2ce5);logger['debug'](_0x4ba3('0x19'),_0x1e2ce5,JSON[_0x4ba3('0x23')](_0x34ecb4));_0x125944(_0x34ecb4);})[_0x4ba3('0x18')](function(_0x19f039){logger[_0x4ba3('0x14')](_0x4ba3('0x19'),_0x19f039['message'],_0x1e2ce5);_0x4b2791(_0x184332[_0x4ba3('0x14')](0x1f4,_0x19f039[_0x4ba3('0x16')]));});});};exports[_0x4ba3('0x24')]=function(_0xbf95b3){var _0x2a6757=this;return new Promise(function(_0x1a7a2c,_0x457236){return db[_0x4ba3('0x25')][_0x4ba3('0x26')]({'raw':_0xbf95b3[_0x4ba3('0x1b')]?_0xbf95b3['options']['raw']===undefined?!![]:![]:!![],'where':_0xbf95b3['options']?_0xbf95b3[_0x4ba3('0x1b')][_0x4ba3('0x1d')]||null:null,'attributes':_0xbf95b3[_0x4ba3('0x1b')]?_0xbf95b3[_0x4ba3('0x1b')][_0x4ba3('0x1e')]||null:null,'include':_0xbf95b3[_0x4ba3('0x1b')]?_0xbf95b3[_0x4ba3('0x1b')][_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0xbf95b3[_0x4ba3('0x1b')][_0x4ba3('0x20')],function(_0x3439cb){return{'model':db[_0x3439cb['model']],'as':_0x3439cb['as'],'attributes':_0x3439cb[_0x4ba3('0x1e')],'include':_0x3439cb[_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x3439cb['include'],function(_0x188f8c){return{'model':db[_0x188f8c['model']],'as':_0x188f8c['as'],'attributes':_0x188f8c[_0x4ba3('0x1e')],'include':_0x188f8c[_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x188f8c[_0x4ba3('0x20')],function(_0xf892e1){return{'model':db[_0xf892e1[_0x4ba3('0x22')]],'as':_0xf892e1['as'],'attributes':_0xf892e1['attributes']};}):[]};}):[]};}):[]:[]})[_0x4ba3('0xf')](function(_0x3cf56c){if(_0xbf95b3[_0x4ba3('0x1b')]['smtp']===!![])_0x3cf56c[_0x4ba3('0x27')](_0x4ba3('0x28'),_0x3cf56c['getSmtpOptions']());logger[_0x4ba3('0x10')]('ShowMailAccount',_0xbf95b3);logger['debug'](_0x4ba3('0x24'),_0xbf95b3,JSON[_0x4ba3('0x23')](_0x3cf56c));_0x1a7a2c(_0x3cf56c);})[_0x4ba3('0x18')](function(_0x2b14e1){logger[_0x4ba3('0x14')]('ShowMailAccount',_0x2b14e1[_0x4ba3('0x16')],_0xbf95b3);_0x457236(_0x2a6757[_0x4ba3('0x14')](0x1f4,_0x2b14e1[_0x4ba3('0x16')]));});});};exports[_0x4ba3('0x29')]=function(_0xab7983){var _0x2acc92=this;return new Promise(function(_0x349af4,_0x2577be){var _0x553475={'body':_0xab7983[_0x4ba3('0x2a')],'channel':_0x4ba3('0x2b')};var _0x3cb07f=_[_0x4ba3('0x2c')](_[_0x4ba3('0x2d')](db[_0x4ba3('0x2e')][_0x4ba3('0x2f')]),[_0x4ba3('0x30'),_0x4ba3('0x31'),_0x4ba3('0x32'),_0x4ba3('0x33')]);var _0x1c58d2=![];if(_0xab7983[_0x4ba3('0x2a')]['id']){delete _0xab7983[_0x4ba3('0x2a')]['id'];}if(_['isNil'](_0xab7983['body']['from'])){return _0x2577be(_0x2acc92['error'](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x4ba3('0x34')](_0xab7983['body'][_0x4ba3('0x2a')])||_0xab7983['body'][_0x4ba3('0x2a')]===''){return _0x2577be(_0x2acc92[_0x4ba3('0x14')](0x1f4,_0x4ba3('0x35')));}if(_[_0x4ba3('0x34')](_0xab7983[_0x4ba3('0x2a')]['mapKey'])){return _0x2577be(_0x2acc92[_0x4ba3('0x14')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3cb07f));}if(!_[_0x4ba3('0x36')](_0x3cb07f,_0xab7983['body'][_0x4ba3('0x37')])){return _0x2577be(_0x2acc92[_0x4ba3('0x14')](0x1f4,_0x4ba3('0x38')+_0x3cb07f));}var _0x261a5e={};_0x261a5e[_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x37')]]=_0xab7983[_0x4ba3('0x2a')]['from'];return db[_0x4ba3('0x25')][_0x4ba3('0x26')]({'where':{'id':_0xab7983[_0x4ba3('0x39')]['id']},'include':[{'model':db[_0x4ba3('0x3a')],'as':_0x4ba3('0x3b'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x261a5e,'limit':0x1,'order':[[_0x4ba3('0x31'),_0x4ba3('0x3c')]]}]},{'model':db[_0x4ba3('0x3d')],'as':'Applications'},{'model':db[_0x4ba3('0x3e')],'as':_0x4ba3('0x3f'),'include':[{'model':db[_0x4ba3('0x40')],'as':'CloudProvider'}]}]})['then'](function(_0x34dc04){if(_0x34dc04&&_0x34dc04['List']){var _0x439acf=_0x34dc04[_0x4ba3('0x41')]({'plain':!![]});_0x553475[_0x4ba3('0x39')]=_[_0x4ba3('0x42')](_0x439acf,[_0x4ba3('0x43'),_0x4ba3('0x3b')]);_0x553475['account'][_0x4ba3('0x28')]=_0x34dc04[_0x4ba3('0x44')]();_0x553475['applications']=_0x439acf[_0x4ba3('0x43')];_0x553475[_0x4ba3('0x45')]=_0x439acf[_0x4ba3('0x3b')];_0x553475[_0x4ba3('0x46')]=_[_0x4ba3('0x47')](_0x553475['applications'],[_0x4ba3('0x48')],[_0x4ba3('0x49')]);if(_0x553475['account']&&_0x553475[_0x4ba3('0x39')][_0x4ba3('0x4a')]){_0x553475[_0x4ba3('0x46')][_0x4ba3('0x4b')]({'id':0x0,'priority':_0x553475[_0x4ba3('0x46')][_0x4ba3('0x4c')]+0x1,'app':_0x4ba3('0x4d'),'appdata':_0x4ba3('0x4a'),'interval':_0x4ba3('0x4e')});}if(_0x553475[_0x4ba3('0x39')][_0x4ba3('0x43')]){delete _0x553475[_0x4ba3('0x39')][_0x4ba3('0x43')];}if(_0x553475[_0x4ba3('0x39')][_0x4ba3('0x3b')]){delete _0x553475['account']['List'];}if(_0x439acf['List'][_0x4ba3('0x4f')][_0x4ba3('0x4c')]){return _0x439acf[_0x4ba3('0x3b')][_0x4ba3('0x4f')][0x0];}var _0x40af1d=_['defaults'](_0xab7983[_0x4ba3('0x2a')],{'firstName':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x50')],'ListId':_0x439acf[_0x4ba3('0x33')]});_0x40af1d[_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x37')]]=_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x50')];return db[_0x4ba3('0x2e')][_0x4ba3('0x51')](_0x40af1d);}else{throw new Error(_0x4ba3('0x52'));}})[_0x4ba3('0xf')](function(_0x317b9f){_0x553475[_0x4ba3('0x53')]=_0x317b9f;if(_0x317b9f){if(!_0xab7983['body'][_0x4ba3('0x16')][_0x4ba3('0x54')]){_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x54')]=rs[_0x4ba3('0x55')]()+'\x20'+_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')]['from'];}var _0x8ea419={'ContactId':_0x317b9f['id'],'MailAccountId':_0xab7983[_0x4ba3('0x39')]['id'],'inReplyTo':_0xab7983[_0x4ba3('0x2a')]['message'][_0x4ba3('0x54')],'to':_0xab7983['body'][_0x4ba3('0x16')][_0x4ba3('0x50')],'cc':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')]['cc'],'subject':_0xab7983[_0x4ba3('0x2a')]['message'][_0x4ba3('0x56')],'attach':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x57')],'lastMsgAt':moment()[_0x4ba3('0x58')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x4ba3('0x59')][_0x4ba3('0x26')]({'where':{'closed':![],'MailAccountId':_0xab7983[_0x4ba3('0x39')]['id']},'include':[{'model':db[_0x4ba3('0x5a')],'as':_0x4ba3('0x5b'),'attributes':[_0x4ba3('0x54')],'where':{'messageId':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x5c')]}}]})[_0x4ba3('0xf')](function(_0x1afc5e){if(_0x1afc5e){return[_0x1afc5e,![]];}return db['MailInteraction'][_0x4ba3('0x51')](_0x8ea419)[_0x4ba3('0xf')](function(_0x55c03c){return[_0x55c03c,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x4ba3('0x5d')](function(_0x296bf6,_0x5c7c2f){if(_0x296bf6){_0x1c58d2=_0x5c7c2f;if(!_0x5c7c2f){return _0x296bf6[_0x4ba3('0x5e')]({'inReplyTo':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')]['messageId'],'to':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x50')],'cc':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')]['cc'],'subject':_0xab7983[_0x4ba3('0x2a')]['message'][_0x4ba3('0x56')],'attach':_0x296bf6[_0x4ba3('0x57')]?_0x296bf6[_0x4ba3('0x57')]:_0xab7983['body'][_0x4ba3('0x16')][_0x4ba3('0x57')],'substatus':null,'substatusAt':moment()[_0x4ba3('0x58')](_0x4ba3('0x5f')),'lastMsgAt':moment()[_0x4ba3('0x58')](_0x4ba3('0x5f')),'lastMsgDirection':'in'});}else{return _0x296bf6;}}})[_0x4ba3('0xf')](function(_0x424477){_0x553475['interaction']=_0x424477['get']({'plain':!![]});_0x553475[_0x4ba3('0x60')]['created']=_0x1c58d2;return db[_0x4ba3('0x5a')][_0x4ba3('0x51')]({'body':_0xab7983[_0x4ba3('0x2a')]['body'],'MailAccountId':_0xab7983[_0x4ba3('0x39')]['id'],'MailInteractionId':_0x424477['id'],'direction':'in','ContactId':_0x553475[_0x4ba3('0x53')]['id'],'messageId':_0xab7983[_0x4ba3('0x2a')]['message'][_0x4ba3('0x54')],'from':_0xab7983['body'][_0x4ba3('0x16')][_0x4ba3('0x50')],'to':_0xab7983['body'][_0x4ba3('0x16')]['to'],'cc':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')]['cc'],'subject':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x56')],'attach':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x57')],'Attachments':_0xab7983['body'][_0x4ba3('0x16')][_0x4ba3('0x61')],'originTo':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x62')],'originCc':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x63')],'bcc':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x64')],'ChatWebsiteId':_0xab7983[_0x4ba3('0x2a')]['message'][_0x4ba3('0x65')]||null,'originChannel':_0xab7983[_0x4ba3('0x2a')]['message'][_0x4ba3('0x66')]||_0x4ba3('0x67'),'ChatOfflineMessageId':_0xab7983['body']['message'][_0x4ba3('0x68')]||null},{'include':[{'model':db[_0x4ba3('0x69')],'as':_0x4ba3('0x6a')}]});})[_0x4ba3('0xf')](function(_0x37b966){_0x553475[_0x4ba3('0x16')]=_0x37b966;if(_0x553475[_0x4ba3('0x60')][_0x4ba3('0x6b')]){return db['User'][_0x4ba3('0x26')]({'attributes':['id','name'],'where':{'id':_0x553475[_0x4ba3('0x60')][_0x4ba3('0x6b')]}})[_0x4ba3('0xf')](function(_0x3c3638){if(_0x3c3638){_0x553475[_0x4ba3('0x46')][_0x4ba3('0x6c')]({'id':0x0,'priority':0x0,'app':_0x4ba3('0x6d'),'appdata':_0x3c3638[_0x4ba3('0x6e')]+','+(_0x553475['account'][_0x4ba3('0x6f')]||0xa),'interval':_0x4ba3('0x4e')});}return respondWithRpcPromise(_0x4ba3('0x70'),'startRouting',_0x553475);});}return respondWithRpcPromise(_0x4ba3('0x70'),_0x4ba3('0x71'),_0x553475);})[_0x4ba3('0xf')](function(_0x39d428){_0x349af4(_0x39d428);})[_0x4ba3('0x18')](function(_0x2569bc){_0x2577be(_0x2acc92[_0x4ba3('0x14')](0x1f4,_0x2569bc['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index ffc838c..bcbc509 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 _0x1932=['remove','update','emit','removeListener','register','length','mailAccount:','./mailAccount.events','save'];(function(_0x3e478c,_0x152670){var _0x29ef89=function(_0x3d0d77){while(--_0x3d0d77){_0x3e478c['push'](_0x3e478c['shift']());}};_0x29ef89(++_0x152670);}(_0x1932,0xbb));var _0x2193=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x1932[_0x1caf6a];return _0x1bf493;};'use strict';var MailAccountEvents=require(_0x2193('0x0'));var events=[_0x2193('0x1'),_0x2193('0x2'),_0x2193('0x3')];function createListener(_0x47440d,_0x4f60ca){return function(_0x2eb2fe){_0x4f60ca[_0x2193('0x4')](_0x47440d,_0x2eb2fe);};}function removeListener(_0x1d0fc1,_0x1557cc){return function(){MailAccountEvents[_0x2193('0x5')](_0x1d0fc1,_0x1557cc);};}exports[_0x2193('0x6')]=function(_0x50aaa8){for(var _0x377c15=0x0,_0x3479ff=events[_0x2193('0x7')];_0x377c15<_0x3479ff;_0x377c15++){var _0xe886ff=events[_0x377c15];var _0x436b26=createListener(_0x2193('0x8')+_0xe886ff,_0x50aaa8);MailAccountEvents['on'](_0xe886ff,_0x436b26);}}; \ No newline at end of file +var _0x2782=['save','emit','register','length','mailAccount:','./mailAccount.events'];(function(_0x17b416,_0xc54bec){var _0x9fccb9=function(_0x4353e7){while(--_0x4353e7){_0x17b416['push'](_0x17b416['shift']());}};_0x9fccb9(++_0xc54bec);}(_0x2782,0x17f));var _0x2278=function(_0x126f47,_0x2199e9){_0x126f47=_0x126f47-0x0;var _0x49508a=_0x2782[_0x126f47];return _0x49508a;};'use strict';var MailAccountEvents=require(_0x2278('0x0'));var events=[_0x2278('0x1'),'remove','update'];function createListener(_0x44d4a1,_0xecb9){return function(_0x189852){_0xecb9[_0x2278('0x2')](_0x44d4a1,_0x189852);};}function removeListener(_0x34c792,_0x8f52e7){return function(){MailAccountEvents['removeListener'](_0x34c792,_0x8f52e7);};}exports[_0x2278('0x3')]=function(_0x3be2fa){for(var _0x3cd75d=0x0,_0x2b9fc2=events[_0x2278('0x4')];_0x3cd75d<_0x2b9fc2;_0x3cd75d++){var _0x40b1cc=events[_0x3cd75d];var _0xfae12d=createListener(_0x2278('0x5')+_0x40b1cc,_0x3be2fa);MailAccountEvents['on'](_0x40b1cc,_0xfae12d);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 94ebcde..72b9a0a 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 _0xa829=['Router','fs-extra','../../components/auth/service','../../config/environment','./mailApplication.controller','/:id','isAuthenticated','put','update','delete','destroy','util','path','connect-timeout'];(function(_0x375d7c,_0x301cb6){var _0x800b24=function(_0x1e2393){while(--_0x1e2393){_0x375d7c['push'](_0x375d7c['shift']());}};_0x800b24(++_0x301cb6);}(_0xa829,0x13f));var _0x9a82=function(_0x5e5b9d,_0x18bcd2){_0x5e5b9d=_0x5e5b9d-0x0;var _0x1e6d0e=_0xa829[_0x5e5b9d];return _0x1e6d0e;};'use strict';var multer=require('multer');var util=require(_0x9a82('0x0'));var path=require(_0x9a82('0x1'));var timeout=require(_0x9a82('0x2'));var express=require('express');var router=express[_0x9a82('0x3')]();var fs_extra=require(_0x9a82('0x4'));var auth=require(_0x9a82('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9a82('0x6'));var controller=require(_0x9a82('0x7'));router['get'](_0x9a82('0x8'),auth[_0x9a82('0x9')](),controller['show']);router[_0x9a82('0xa')](_0x9a82('0x8'),auth['isAuthenticated'](),controller[_0x9a82('0xb')]);router[_0x9a82('0xc')](_0x9a82('0x8'),auth[_0x9a82('0x9')](),controller[_0x9a82('0xd')]);module['exports']=router; \ No newline at end of file +var _0xc126=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','get','isAuthenticated','show','put','/:id','update','delete'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0xc126,0x122));var _0x6c12=function(_0x2f3587,_0x3fda73){_0x2f3587=_0x2f3587-0x0;var _0x2f0c03=_0xc126[_0x2f3587];return _0x2f0c03;};'use strict';var multer=require(_0x6c12('0x0'));var util=require(_0x6c12('0x1'));var path=require(_0x6c12('0x2'));var timeout=require(_0x6c12('0x3'));var express=require(_0x6c12('0x4'));var router=express[_0x6c12('0x5')]();var fs_extra=require(_0x6c12('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailApplication.controller');router[_0x6c12('0x7')]('/:id',auth[_0x6c12('0x8')](),controller[_0x6c12('0x9')]);router[_0x6c12('0xa')](_0x6c12('0xb'),auth[_0x6c12('0x8')](),controller[_0x6c12('0xc')]);router[_0x6c12('0xd')](_0x6c12('0xb'),auth['isAuthenticated'](),controller[_0x6c12('0xe')]);module[_0x6c12('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 144efb6..35ed50f 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 _0x2bbe=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0xb6096,_0xb27a34){var _0x1ceb53=function(_0x126f8b){while(--_0x126f8b){_0xb6096['push'](_0xb6096['shift']());}};_0x1ceb53(++_0xb27a34);}(_0x2bbe,0x1a5));var _0xe2bb=function(_0x54bc97,_0x568a67){_0x54bc97=_0x54bc97-0x0;var _0x27e624=_0x2bbe[_0x54bc97];return _0x27e624;};'use strict';var Sequelize=require(_0xe2bb('0x0'));module[_0xe2bb('0x1')]={'priority':{'type':Sequelize[_0xe2bb('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xe2bb('0x3')],'allowNull':![],'defaultValue':_0xe2bb('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xe2bb('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xe2bb('0x5')}}; \ No newline at end of file +var _0x6a69=['INTEGER','STRING','noop','TEXT','sequelize','exports'];(function(_0x27ce34,_0xab8aac){var _0x4bea77=function(_0x5ef23e){while(--_0x5ef23e){_0x27ce34['push'](_0x27ce34['shift']());}};_0x4bea77(++_0xab8aac);}(_0x6a69,0x184));var _0x96a6=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x6a69[_0x2d7f0e];return _0x110b07;};'use strict';var Sequelize=require(_0x96a6('0x0'));module[_0x96a6('0x1')]={'priority':{'type':Sequelize[_0x96a6('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x96a6('0x3')],'allowNull':![],'defaultValue':_0x96a6('0x4')},'appdata':{'type':Sequelize[_0x96a6('0x5')]()},'description':{'type':Sequelize[_0x96a6('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index c45bfa1..3a2a252 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 _0x54ef=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','name','show','params','model','rawAttributes','query','keys','filters','intersection','attributes','fields','length','merge','options','MailApplication','find','body','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x1e2b1f,_0x225881){var _0x4bb65b=function(_0x34d7aa){while(--_0x34d7aa){_0x1e2b1f['push'](_0x1e2b1f['shift']());}};_0x4bb65b(++_0x225881);}(_0x54ef,0x112));var _0xf54e=function(_0x21ac16,_0x5b17a8){_0x21ac16=_0x21ac16-0x0;var _0x33c08f=_0x54ef[_0x21ac16];return _0x33c08f;};'use strict';var emlformat=require(_0xf54e('0x0'));var rimraf=require(_0xf54e('0x1'));var zipdir=require(_0xf54e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf54e('0x3'));var moment=require(_0xf54e('0x4'));var BPromise=require(_0xf54e('0x5'));var Mustache=require(_0xf54e('0x6'));var util=require(_0xf54e('0x7'));var path=require(_0xf54e('0x8'));var sox=require(_0xf54e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf54e('0xa'));var _=require(_0xf54e('0xb'));var squel=require(_0xf54e('0xc'));var crypto=require('crypto');var jsforce=require(_0xf54e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf54e('0xe'));var querystring=require(_0xf54e('0xf'));var Papa=require('papaparse');var Redis=require(_0xf54e('0x10'));var authService=require(_0xf54e('0x11'));var qs=require(_0xf54e('0x12'));var as=require(_0xf54e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf54e('0x14'))(_0xf54e('0x15'));var utils=require(_0xf54e('0x16'));var config=require(_0xf54e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf54e('0x18'))['db'];function respondWithStatusCode(_0x4b0ee1,_0x4bd828){_0x4bd828=_0x4bd828||0xcc;return function(_0x15a9d4){if(_0x15a9d4){return _0x4b0ee1[_0xf54e('0x19')](_0x4bd828);}return _0x4b0ee1[_0xf54e('0x1a')](_0x4bd828)[_0xf54e('0x1b')]();};}function respondWithResult(_0x5644aa,_0x331732){_0x331732=_0x331732||0xc8;return function(_0x1bbeaa){if(_0x1bbeaa){return _0x5644aa[_0xf54e('0x1a')](_0x331732)[_0xf54e('0x1c')](_0x1bbeaa);}};}function respondWithFilteredResult(_0x56828e,_0x2366ee){return function(_0x389abc){if(_0x389abc){var _0x3eb415=typeof _0x2366ee['offset']==='undefined'&&typeof _0x2366ee[_0xf54e('0x1d')]===_0xf54e('0x1e');var _0x1c02e7=_0x389abc[_0xf54e('0x1f')];var _0x15cc48=_0x3eb415?0x0:_0x2366ee[_0xf54e('0x20')];var _0x2e27b6=_0x3eb415?_0x389abc[_0xf54e('0x1f')]:_0x2366ee[_0xf54e('0x20')]+_0x2366ee[_0xf54e('0x1d')];var _0x226c96;if(_0x2e27b6>=_0x1c02e7){_0x2e27b6=_0x1c02e7;_0x226c96=0xc8;}else{_0x226c96=0xce;}_0x56828e['status'](_0x226c96);return _0x56828e['set'](_0xf54e('0x21'),_0x15cc48+'-'+_0x2e27b6+'/'+_0x1c02e7)['json'](_0x389abc);}return null;};}function patchUpdates(_0x3e1556){return function(_0x1bfe99){try{jsonpatch[_0xf54e('0x22')](_0x1bfe99,_0x3e1556,!![]);}catch(_0x9903fc){return BPromise[_0xf54e('0x23')](_0x9903fc);}return _0x1bfe99[_0xf54e('0x24')]();};}function saveUpdates(_0x388aa0,_0x11985e){return function(_0x3c0169){if(_0x3c0169){return _0x3c0169[_0xf54e('0x25')](_0x388aa0)[_0xf54e('0x26')](function(_0x5b83df){return _0x5b83df;});}return null;};}function removeEntity(_0x6f6d29,_0x54f914){return function(_0x264a8f){if(_0x264a8f){return _0x264a8f[_0xf54e('0x27')]()[_0xf54e('0x26')](function(){_0x6f6d29[_0xf54e('0x1a')](0xcc)[_0xf54e('0x1b')]();});}};}function handleEntityNotFound(_0x160160,_0x1e08d1){return function(_0x43488d){if(!_0x43488d){_0x160160[_0xf54e('0x19')](0x194);}return _0x43488d;};}function handleError(_0x33457f,_0xf6cdd7){_0xf6cdd7=_0xf6cdd7||0x1f4;return function(_0x39c0ae){logger[_0xf54e('0x28')](_0x39c0ae['stack']);if(_0x39c0ae[_0xf54e('0x29')]){delete _0x39c0ae['name'];}_0x33457f[_0xf54e('0x1a')](_0xf6cdd7)['send'](_0x39c0ae);};}exports[_0xf54e('0x2a')]=function(_0x269f47,_0x21ba00){var _0xa13cd0={'raw':!![],'where':{'id':_0x269f47[_0xf54e('0x2b')]['id']}},_0x25b643={};_0x25b643[_0xf54e('0x2c')]=_['keys'](db['MailApplication'][_0xf54e('0x2d')]);_0x25b643[_0xf54e('0x2e')]=_[_0xf54e('0x2f')](_0x269f47[_0xf54e('0x2e')]);_0x25b643[_0xf54e('0x30')]=_[_0xf54e('0x31')](_0x25b643[_0xf54e('0x2c')],_0x25b643[_0xf54e('0x2e')]);_0xa13cd0[_0xf54e('0x32')]=_[_0xf54e('0x31')](_0x25b643['model'],qs['fields'](_0x269f47[_0xf54e('0x2e')][_0xf54e('0x33')]));_0xa13cd0['attributes']=_0xa13cd0[_0xf54e('0x32')][_0xf54e('0x34')]?_0xa13cd0[_0xf54e('0x32')]:_0x25b643[_0xf54e('0x2c')];if(_0x269f47['query']['includeAll']){_0xa13cd0['include']=[{'all':!![]}];}_0xa13cd0=_[_0xf54e('0x35')]({},_0xa13cd0,_0x269f47[_0xf54e('0x36')]);return db[_0xf54e('0x37')][_0xf54e('0x38')](_0xa13cd0)[_0xf54e('0x26')](handleEntityNotFound(_0x21ba00,null))[_0xf54e('0x26')](respondWithResult(_0x21ba00,null))['catch'](handleError(_0x21ba00,null));};exports['update']=function(_0x530cee,_0xc04e04){if(_0x530cee[_0xf54e('0x39')]['id']){delete _0x530cee['body']['id'];}return db['MailApplication'][_0xf54e('0x38')]({'where':{'id':_0x530cee[_0xf54e('0x2b')]['id']}})[_0xf54e('0x26')](handleEntityNotFound(_0xc04e04,null))['then'](saveUpdates(_0x530cee[_0xf54e('0x39')],null))[_0xf54e('0x26')](respondWithResult(_0xc04e04,null))['catch'](handleError(_0xc04e04,null));};exports[_0xf54e('0x27')]=function(_0x6e5bdf,_0x5af03){return db[_0xf54e('0x37')][_0xf54e('0x38')]({'where':{'id':_0x6e5bdf[_0xf54e('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5af03,null))['then'](removeEntity(_0x5af03,null))[_0xf54e('0x3a')](handleError(_0x5af03,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(_0x26d398,_0x22f9b0){var _0x3e65f2=function(_0x20c15f){while(--_0x20c15f){_0x26d398['push'](_0x26d398['shift']());}};_0x3e65f2(++_0x22f9b0);}(_0x9bde,0xe1));var _0xe9bd=function(_0x2113f5,_0x394d3d){_0x2113f5=_0x2113f5-0x0;var _0x3f516c=_0x9bde[_0x2113f5];return _0x3f516c;};'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 aa3a7d9..90b2827 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 _0xeba9=['./mailApplication.attributes','exports','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x5ae93d,_0x48a929){var _0x3bc344=function(_0x37d1e8){while(--_0x37d1e8){_0x5ae93d['push'](_0x5ae93d['shift']());}};_0x3bc344(++_0x48a929);}(_0xeba9,0x178));var _0x9eba=function(_0x5797fd,_0x27cfb0){_0x5797fd=_0x5797fd-0x0;var _0xfa26d5=_0xeba9[_0x5797fd];return _0xfa26d5;};'use strict';var _=require('lodash');var util=require(_0x9eba('0x0'));var logger=require(_0x9eba('0x1'))(_0x9eba('0x2'));var moment=require(_0x9eba('0x3'));var BPromise=require('bluebird');var rp=require(_0x9eba('0x4'));var fs=require('fs');var path=require(_0x9eba('0x5'));var rimraf=require(_0x9eba('0x6'));var config=require(_0x9eba('0x7'));var attributes=require(_0x9eba('0x8'));module[_0x9eba('0x9')]=function(_0x1b3493,_0x5f58fc){return _0x1b3493['define']('MailApplication',attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9eba('0xa'),'collate':_0x9eba('0xb')});}; \ No newline at end of file +var _0xbc75=['moment','bluebird','request-promise','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api'];(function(_0x3fa81c,_0x586d3f){var _0x403d1f=function(_0x5d8e9a){while(--_0x5d8e9a){_0x3fa81c['push'](_0x3fa81c['shift']());}};_0x403d1f(++_0x586d3f);}(_0xbc75,0x66));var _0x5bc7=function(_0x390b5a,_0x281bd7){_0x390b5a=_0x390b5a-0x0;var _0x1f8690=_0xbc75[_0x390b5a];return _0x1f8690;};'use strict';var _=require('lodash');var util=require(_0x5bc7('0x0'));var logger=require(_0x5bc7('0x1'))(_0x5bc7('0x2'));var moment=require(_0x5bc7('0x3'));var BPromise=require(_0x5bc7('0x4'));var rp=require(_0x5bc7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5bc7('0x6'));var config=require(_0x5bc7('0x7'));var attributes=require(_0x5bc7('0x8'));module[_0x5bc7('0x9')]=function(_0x462120,_0x32165b){return _0x462120[_0x5bc7('0xa')](_0x5bc7('0xb'),attributes,{'tableName':_0x5bc7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5bc7('0xd'),'collate':_0x5bc7('0xe')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 63ff639..c9232bc 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 _0x2dcf=['where','attributes','limit','then','UpdateMailApplication','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','MailApplication,\x20%s,\x20%s','result','catch','update','options','raw'];(function(_0x12bb31,_0x39ddf7){var _0x5f1503=function(_0x2e2769){while(--_0x2e2769){_0x12bb31['push'](_0x12bb31['shift']());}};_0x5f1503(++_0x39ddf7);}(_0x2dcf,0x1c5));var _0xf2dc=function(_0x35ce2a,_0x44ba7e){_0x35ce2a=_0x35ce2a-0x0;var _0x211a7a=_0x2dcf[_0x35ce2a];return _0x211a7a;};'use strict';var _=require(_0xf2dc('0x0'));var util=require(_0xf2dc('0x1'));var moment=require(_0xf2dc('0x2'));var BPromise=require(_0xf2dc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf2dc('0x4'))['db'];var utils=require(_0xf2dc('0x5'));var logger=require(_0xf2dc('0x6'))(_0xf2dc('0x7'));var config=require(_0xf2dc('0x8'));var jayson=require(_0xf2dc('0x9'));var client=jayson[_0xf2dc('0xa')][_0xf2dc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x131aee,_0x23f1d7,_0x3e1bdf){return new BPromise(function(_0x1170ce,_0x58ce23){return client[_0xf2dc('0xc')](_0x131aee,_0x3e1bdf)['then'](function(_0x20f4f9){logger[_0xf2dc('0xd')]('MailApplication,\x20%s,\x20%s',_0x23f1d7,'request\x20sent');logger[_0xf2dc('0xe')](_0xf2dc('0xf'),_0x23f1d7,_0xf2dc('0x10'),JSON[_0xf2dc('0x11')](_0x20f4f9));if(_0x20f4f9[_0xf2dc('0x12')]){if(_0x20f4f9[_0xf2dc('0x12')][_0xf2dc('0x13')]===0x1f4){logger[_0xf2dc('0x12')]('MailApplication,\x20%s,\x20%s',_0x23f1d7,_0x20f4f9['error'][_0xf2dc('0x14')]);return _0x58ce23(_0x20f4f9[_0xf2dc('0x12')]['message']);}logger['error'](_0xf2dc('0x15'),_0x23f1d7,_0x20f4f9[_0xf2dc('0x12')]['message']);return _0x1170ce(_0x20f4f9[_0xf2dc('0x12')][_0xf2dc('0x14')]);}else{logger['info'](_0xf2dc('0x15'),_0x23f1d7,'request\x20sent');_0x1170ce(_0x20f4f9[_0xf2dc('0x16')][_0xf2dc('0x14')]);}})[_0xf2dc('0x17')](function(_0x1cbffe){logger[_0xf2dc('0x12')](_0xf2dc('0x15'),_0x23f1d7,_0x1cbffe);_0x58ce23(_0x1cbffe);});});}exports['UpdateMailApplication']=function(_0x217fbb){var _0x20a6fe=this;return new Promise(function(_0x629c6a,_0x5495bc){return db['MailApplication'][_0xf2dc('0x18')](_0x217fbb['body'],{'raw':_0x217fbb[_0xf2dc('0x19')]?_0x217fbb[_0xf2dc('0x19')][_0xf2dc('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x217fbb['options']?_0x217fbb[_0xf2dc('0x19')][_0xf2dc('0x1b')]||null:null,'attributes':_0x217fbb[_0xf2dc('0x19')]?_0x217fbb[_0xf2dc('0x19')][_0xf2dc('0x1c')]||null:null,'limit':_0x217fbb['options']?_0x217fbb[_0xf2dc('0x19')][_0xf2dc('0x1d')]||null:null})[_0xf2dc('0x1e')](function(_0xfbc8){logger['info'](_0xf2dc('0x1f'),_0x217fbb);logger[_0xf2dc('0xe')](_0xf2dc('0x1f'),_0x217fbb,JSON[_0xf2dc('0x11')](_0xfbc8));_0x629c6a(_0xfbc8);})[_0xf2dc('0x17')](function(_0x2118d9){logger['error'](_0xf2dc('0x1f'),_0x2118d9[_0xf2dc('0x14')],_0x217fbb);_0x5495bc(_0x20a6fe[_0xf2dc('0x12')](0x1f4,_0x2118d9[_0xf2dc('0x14')]));});});}; \ No newline at end of file +var _0x6d45=['then','lodash','util','bluebird','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','request','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','UpdateMailApplication','MailApplication','update','body','options','raw','where'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x6d45,0x1ef));var _0x56d4=function(_0x24e0e9,_0x50b14e){_0x24e0e9=_0x24e0e9-0x0;var _0x1f5aed=_0x6d45[_0x24e0e9];return _0x1f5aed;};'use strict';var _=require(_0x56d4('0x0'));var util=require(_0x56d4('0x1'));var moment=require('moment');var BPromise=require(_0x56d4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x56d4('0x3'));var db=require(_0x56d4('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x56d4('0x5'));var jayson=require(_0x56d4('0x6'));var client=jayson[_0x56d4('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x539e4d,_0x55b744,_0x17af7a){return new BPromise(function(_0x5dab9a,_0x430081){return client[_0x56d4('0x8')](_0x539e4d,_0x17af7a)['then'](function(_0x4b2100){logger['info'](_0x56d4('0x9'),_0x55b744,_0x56d4('0xa'));logger[_0x56d4('0xb')](_0x56d4('0xc'),_0x55b744,_0x56d4('0xa'),JSON[_0x56d4('0xd')](_0x4b2100));if(_0x4b2100['error']){if(_0x4b2100[_0x56d4('0xe')]['code']===0x1f4){logger[_0x56d4('0xe')](_0x56d4('0x9'),_0x55b744,_0x4b2100[_0x56d4('0xe')][_0x56d4('0xf')]);return _0x430081(_0x4b2100[_0x56d4('0xe')][_0x56d4('0xf')]);}logger['error'](_0x56d4('0x9'),_0x55b744,_0x4b2100[_0x56d4('0xe')][_0x56d4('0xf')]);return _0x5dab9a(_0x4b2100[_0x56d4('0xe')]['message']);}else{logger[_0x56d4('0x10')](_0x56d4('0x9'),_0x55b744,_0x56d4('0xa'));_0x5dab9a(_0x4b2100['result'][_0x56d4('0xf')]);}})[_0x56d4('0x11')](function(_0x193872){logger[_0x56d4('0xe')](_0x56d4('0x9'),_0x55b744,_0x193872);_0x430081(_0x193872);});});}exports[_0x56d4('0x12')]=function(_0x2b956b){var _0x3d58b2=this;return new Promise(function(_0x50439a,_0x23baf8){return db[_0x56d4('0x13')][_0x56d4('0x14')](_0x2b956b[_0x56d4('0x15')],{'raw':_0x2b956b[_0x56d4('0x16')]?_0x2b956b['options'][_0x56d4('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b956b[_0x56d4('0x16')]?_0x2b956b[_0x56d4('0x16')][_0x56d4('0x18')]||null:null,'attributes':_0x2b956b['options']?_0x2b956b[_0x56d4('0x16')]['attributes']||null:null,'limit':_0x2b956b[_0x56d4('0x16')]?_0x2b956b['options']['limit']||null:null})[_0x56d4('0x19')](function(_0x3ab9c5){logger[_0x56d4('0x10')]('UpdateMailApplication',_0x2b956b);logger[_0x56d4('0xb')](_0x56d4('0x12'),_0x2b956b,JSON[_0x56d4('0xd')](_0x3ab9c5));_0x50439a(_0x3ab9c5);})[_0x56d4('0x11')](function(_0x405647){logger[_0x56d4('0xe')]('UpdateMailApplication',_0x405647[_0x56d4('0xf')],_0x2b956b);_0x23baf8(_0x3d58b2['error'](0x1f4,_0x405647[_0x56d4('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index c2dae83..bd8d3dc 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 _0x33ae=['destroy','delete','removeTags','exports','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','mail','tracked'];(function(_0x5afad8,_0x6737b4){var _0x47aa13=function(_0x562c51){while(--_0x562c51){_0x5afad8['push'](_0x5afad8['shift']());}};_0x47aa13(++_0x6737b4);}(_0x33ae,0x194));var _0xe33a=function(_0xbf19d7,_0x58b2bf){_0xbf19d7=_0xbf19d7-0x0;var _0x376e11=_0x33ae[_0xbf19d7];return _0x376e11;};'use strict';var express=require('express');var router=express[_0xe33a('0x0')]();var auth=require(_0xe33a('0x1'));var interaction=require(_0xe33a('0x2'));var controller=require(_0xe33a('0x3'));router[_0xe33a('0x4')]('/',auth[_0xe33a('0x5')](),controller[_0xe33a('0x6')]);router[_0xe33a('0x4')](_0xe33a('0x7'),auth['isAuthenticated'](),controller[_0xe33a('0x8')]);router[_0xe33a('0x4')](_0xe33a('0x9'),auth[_0xe33a('0x5')](),controller[_0xe33a('0xa')]);router['get'](_0xe33a('0xb'),auth[_0xe33a('0x5')](),controller[_0xe33a('0xc')]);router['get'](_0xe33a('0xd'),auth['isAuthenticated'](),controller[_0xe33a('0xe')]);router[_0xe33a('0xf')]('/',auth[_0xe33a('0x5')](),controller[_0xe33a('0x10')]);router[_0xe33a('0xf')](_0xe33a('0xb'),auth[_0xe33a('0x5')](),controller[_0xe33a('0x11')]);router[_0xe33a('0xf')](_0xe33a('0x12'),auth[_0xe33a('0x5')](),interaction['tracked'](_0xe33a('0x13'),'mailinteraction:addtags'),controller['addTags']);router['put'](_0xe33a('0x9'),auth[_0xe33a('0x5')](),interaction[_0xe33a('0x14')]('mail','mailinteraction:update'),controller['update']);router['delete'](_0xe33a('0x9'),auth[_0xe33a('0x5')](),interaction['tracked'](_0xe33a('0x13'),'mailinteraction:destroy'),controller[_0xe33a('0x15')]);router[_0xe33a('0x16')](_0xe33a('0x12'),auth[_0xe33a('0x5')](),controller[_0xe33a('0x17')]);module[_0xe33a('0x18')]=router; \ No newline at end of file +var _0x5c7c=['show','/:id/messages','getMessages','/:id/download','post','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','put','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','exports','express','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','/describe','/:id'];(function(_0x51fdbe,_0x219d67){var _0x1295ad=function(_0x114041){while(--_0x114041){_0x51fdbe['push'](_0x51fdbe['shift']());}};_0x1295ad(++_0x219d67);}(_0x5c7c,0xe2));var _0xc5c7=function(_0x31a51b,_0x4775e8){_0x31a51b=_0x31a51b-0x0;var _0x38d5d8=_0x5c7c[_0x31a51b];return _0x38d5d8;};'use strict';var express=require(_0xc5c7('0x0'));var router=express['Router']();var auth=require(_0xc5c7('0x1'));var interaction=require(_0xc5c7('0x2'));var controller=require(_0xc5c7('0x3'));router[_0xc5c7('0x4')]('/',auth[_0xc5c7('0x5')](),controller['index']);router[_0xc5c7('0x4')](_0xc5c7('0x6'),auth[_0xc5c7('0x5')](),controller['describe']);router[_0xc5c7('0x4')](_0xc5c7('0x7'),auth[_0xc5c7('0x5')](),controller[_0xc5c7('0x8')]);router[_0xc5c7('0x4')](_0xc5c7('0x9'),auth[_0xc5c7('0x5')](),controller[_0xc5c7('0xa')]);router[_0xc5c7('0x4')](_0xc5c7('0xb'),auth['isAuthenticated'](),controller['download']);router[_0xc5c7('0xc')]('/',auth[_0xc5c7('0x5')](),controller['create']);router['post']('/:id/messages',auth[_0xc5c7('0x5')](),controller[_0xc5c7('0xd')]);router[_0xc5c7('0xc')](_0xc5c7('0xe'),auth[_0xc5c7('0x5')](),interaction[_0xc5c7('0xf')](_0xc5c7('0x10'),_0xc5c7('0x11')),controller['addTags']);router[_0xc5c7('0x12')]('/:id',auth[_0xc5c7('0x5')](),interaction[_0xc5c7('0xf')](_0xc5c7('0x10'),_0xc5c7('0x13')),controller[_0xc5c7('0x14')]);router[_0xc5c7('0x15')](_0xc5c7('0x7'),auth[_0xc5c7('0x5')](),interaction['tracked'](_0xc5c7('0x10'),_0xc5c7('0x16')),controller[_0xc5c7('0x17')]);router['delete']('/:id/tags',auth[_0xc5c7('0x5')](),controller[_0xc5c7('0x18')]);module[_0xc5c7('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 1a74551..a792a1f 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 _0x8bc5=['ENUM','sequelize','iconv','exports','BOOLEAN','DATE','STRING','long','TEXT','out'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x8bc5,0xab));var _0x58bc=function(_0x182b80,_0x1b1e50){_0x182b80=_0x182b80-0x0;var _0x3ae12b=_0x8bc5[_0x182b80];return _0x3ae12b;};'use strict';var Sequelize=require(_0x58bc('0x0'));var iconv=require(_0x58bc('0x1'));module[_0x58bc('0x2')]={'closed':{'type':Sequelize[_0x58bc('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x58bc('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x58bc('0x5')]},'thirdDisposition':{'type':Sequelize[_0x58bc('0x5')]},'note':{'type':Sequelize[_0x58bc('0x5')]},'inReplyTo':{'type':Sequelize[_0x58bc('0x5')](0x1fe)},'to':{'type':Sequelize[_0x58bc('0x5')]},'cc':{'type':Sequelize['TEXT'](_0x58bc('0x6'))},'subject':{'type':Sequelize[_0x58bc('0x7')]()},'attach':{'type':Sequelize[_0x58bc('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x58bc('0x4')]},'substatus':{'type':Sequelize[_0x58bc('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0x58bc('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x58bc('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x58bc('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x58bc('0x9')]('in',_0x58bc('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x58bc('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xc1e6=['sequelize','iconv','exports','BOOLEAN','STRING','TEXT','long','DATE','ENUM','out'];(function(_0x6480f7,_0x2b3250){var _0x315968=function(_0x253790){while(--_0x253790){_0x6480f7['push'](_0x6480f7['shift']());}};_0x315968(++_0x2b3250);}(_0xc1e6,0xe6));var _0x6c1e=function(_0x3a2ab2,_0xd98974){_0x3a2ab2=_0x3a2ab2-0x0;var _0x3cefe5=_0xc1e6[_0x3a2ab2];return _0x3cefe5;};'use strict';var Sequelize=require(_0x6c1e('0x0'));var iconv=require(_0x6c1e('0x1'));module[_0x6c1e('0x2')]={'closed':{'type':Sequelize[_0x6c1e('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x6c1e('0x4')]},'secondDisposition':{'type':Sequelize[_0x6c1e('0x4')]},'thirdDisposition':{'type':Sequelize[_0x6c1e('0x4')]},'note':{'type':Sequelize[_0x6c1e('0x4')]},'inReplyTo':{'type':Sequelize[_0x6c1e('0x4')](0x1fe)},'to':{'type':Sequelize[_0x6c1e('0x4')]},'cc':{'type':Sequelize[_0x6c1e('0x5')](_0x6c1e('0x6'))},'subject':{'type':Sequelize[_0x6c1e('0x5')]()},'attach':{'type':Sequelize[_0x6c1e('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x6c1e('0x7')]},'substatus':{'type':Sequelize[_0x6c1e('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x6c1e('0x7')]},'firstMsgDirection':{'type':Sequelize[_0x6c1e('0x8')]('in',_0x6c1e('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6c1e('0x7')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x6c1e('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 8ea2d5f..2a94b81 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 _0xe3cf=['from','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','basename','existsSync','readFileSync','writeFileSync','eml-format','zip-dir','moment','util','path','lodash','juice','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','offset','undefined','count','limit','set','update','destroy','then','error','name','send','index','MailInteraction','rawAttributes','fieldName','type','findAll','mail','query','user','catch','show','params','model','keys','intersection','attributes','fields','length','includeAll','merge','find','create','body','describe','addMessage','omit','getMessages','MailMessage','filters','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','include','true','setTags','ids','color','emit','mailInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','Attachment','Attachments','bcc','subject','createdAt','get','mkdirSync','each','Messages'];(function(_0x3bbd51,_0x2c1612){var _0x387291=function(_0x12234f){while(--_0x12234f){_0x3bbd51['push'](_0x3bbd51['shift']());}};_0x387291(++_0x2c1612);}(_0xe3cf,0x150));var _0xfe3c=function(_0x4e3d3e,_0x1b3134){_0x4e3d3e=_0x4e3d3e-0x0;var _0x4ca2ee=_0xe3cf[_0x4e3d3e];return _0x4ca2ee;};'use strict';var emlformat=require(_0xfe3c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfe3c('0x1'));var moment=require(_0xfe3c('0x2'));var BPromise=require('bluebird');var util=require(_0xfe3c('0x3'));var path=require(_0xfe3c('0x4'));var fs=require('fs');var _=require(_0xfe3c('0x5'));var juice=require(_0xfe3c('0x6'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0xfe3c('0x7'));var logger=require(_0xfe3c('0x8'))(_0xfe3c('0x9'));var config=require(_0xfe3c('0xa'));var db=require(_0xfe3c('0xb'))['db'];var htmlEntities=require('html-entities');config[_0xfe3c('0xc')]=_['defaults'](config[_0xfe3c('0xc')],{'host':_0xfe3c('0xd'),'port':0x18eb});var socket=require(_0xfe3c('0xe'))(new Redis(config[_0xfe3c('0xc')]));require(_0xfe3c('0xf'))[_0xfe3c('0x10')](socket);function respondWithStatusCode(_0x298e0c,_0x1c46cf){_0x1c46cf=_0x1c46cf||0xcc;return function(_0x24fa23){if(_0x24fa23){return _0x298e0c[_0xfe3c('0x11')](_0x1c46cf);}return _0x298e0c[_0xfe3c('0x12')](_0x1c46cf)[_0xfe3c('0x13')]();};}function respondWithResult(_0x2e770e,_0x18c076){_0x18c076=_0x18c076||0xc8;return function(_0x13ce7f){if(_0x13ce7f){return _0x2e770e[_0xfe3c('0x12')](_0x18c076)['json'](_0x13ce7f);}};}function respondWithFilteredResult(_0x243812,_0x4a65a0){return function(_0xf52848){if(_0xf52848){var _0x1158e3=typeof _0x4a65a0[_0xfe3c('0x14')]===_0xfe3c('0x15')&&typeof _0x4a65a0['limit']===_0xfe3c('0x15');var _0x297201=_0xf52848[_0xfe3c('0x16')];var _0x147a66=_0x1158e3?0x0:_0x4a65a0['offset'];var _0x4a2b70=_0x1158e3?_0xf52848[_0xfe3c('0x16')]:_0x4a65a0[_0xfe3c('0x14')]+_0x4a65a0[_0xfe3c('0x17')];var _0x36eb77;if(_0x4a2b70>=_0x297201){_0x4a2b70=_0x297201;_0x36eb77=0xc8;}else{_0x36eb77=0xce;}_0x243812[_0xfe3c('0x12')](_0x36eb77);return _0x243812[_0xfe3c('0x18')]('Content-Range',_0x147a66+'-'+_0x4a2b70+'/'+_0x297201)['json'](_0xf52848);}return null;};}function saveUpdates(_0x2d52d5){return function(_0x5d3f37){if(_0x5d3f37){return _0x5d3f37[_0xfe3c('0x19')](_0x2d52d5)['then'](function(_0x16a3da){return _0x16a3da;});}return null;};}function removeEntity(_0x84b1b){return function(_0xec1c32){if(_0xec1c32){return _0xec1c32[_0xfe3c('0x1a')]()[_0xfe3c('0x1b')](function(){_0x84b1b[_0xfe3c('0x12')](0xcc)[_0xfe3c('0x13')]();});}};}function handleEntityNotFound(_0x18b20d){return function(_0x122ebd){if(!_0x122ebd){_0x18b20d[_0xfe3c('0x11')](0x194);}return _0x122ebd;};}function handleError(_0x542ec5,_0x3ce976){_0x3ce976=_0x3ce976||0x1f4;return function(_0x24af30){logger[_0xfe3c('0x1c')](_0x24af30['stack']);if(_0x24af30[_0xfe3c('0x1d')]){delete _0x24af30[_0xfe3c('0x1d')];}_0x542ec5[_0xfe3c('0x12')](_0x3ce976)[_0xfe3c('0x1e')](_0x24af30);};}exports[_0xfe3c('0x1f')]=function(_0x347a40,_0x1920cf){var _0x1129e7={};var _0x20b494=_['map'](db[_0xfe3c('0x20')][_0xfe3c('0x21')],function(_0x2e5765){return{'name':_0x2e5765[_0xfe3c('0x22')],'type':_0x2e5765[_0xfe3c('0x23')]['key']};});_0x1129e7=qs['getOptions'](_0x20b494,_0x347a40);return interaction[_0xfe3c('0x24')](_0xfe3c('0x25'),_0x347a40[_0xfe3c('0x26')],_0x347a40[_0xfe3c('0x27')],_0x1129e7,_0x20b494)[_0xfe3c('0x1b')](respondWithFilteredResult(_0x1920cf,_0x1129e7))[_0xfe3c('0x28')](handleError(_0x1920cf,null));};exports[_0xfe3c('0x29')]=function(_0x1b1b6a,_0x357170){var _0x2c18f3={'raw':![],'where':{'id':_0x1b1b6a[_0xfe3c('0x2a')]['id']}},_0x8f4481={};_0x8f4481[_0xfe3c('0x2b')]=_['keys'](db[_0xfe3c('0x20')][_0xfe3c('0x21')]);_0x8f4481[_0xfe3c('0x26')]=_[_0xfe3c('0x2c')](_0x1b1b6a[_0xfe3c('0x26')]);_0x8f4481['filters']=_[_0xfe3c('0x2d')](_0x8f4481[_0xfe3c('0x2b')],_0x8f4481[_0xfe3c('0x26')]);_0x2c18f3[_0xfe3c('0x2e')]=_[_0xfe3c('0x2d')](_0x8f4481[_0xfe3c('0x2b')],qs[_0xfe3c('0x2f')](_0x1b1b6a[_0xfe3c('0x26')][_0xfe3c('0x2f')]));_0x2c18f3[_0xfe3c('0x2e')]=_0x2c18f3[_0xfe3c('0x2e')][_0xfe3c('0x30')]?_0x2c18f3[_0xfe3c('0x2e')]:_0x8f4481['model'];if(_0x1b1b6a[_0xfe3c('0x26')][_0xfe3c('0x31')]){_0x2c18f3['include']=[{'all':!![]}];}_0x2c18f3=_[_0xfe3c('0x32')]({},_0x2c18f3,_0x1b1b6a['options']);return db[_0xfe3c('0x20')][_0xfe3c('0x33')](_0x2c18f3)[_0xfe3c('0x1b')](handleEntityNotFound(_0x357170,null))[_0xfe3c('0x1b')](respondWithResult(_0x357170,null))['catch'](handleError(_0x357170,null));};exports['create']=function(_0x2ae915,_0x58d4c3){return db['MailInteraction'][_0xfe3c('0x34')](_0x2ae915[_0xfe3c('0x35')],{})[_0xfe3c('0x1b')](respondWithResult(_0x58d4c3,0xc9))[_0xfe3c('0x28')](handleError(_0x58d4c3,null));};exports[_0xfe3c('0x19')]=function(_0x17fc65,_0x1a8d87){if(_0x17fc65[_0xfe3c('0x35')]['id']){delete _0x17fc65[_0xfe3c('0x35')]['id'];}return db[_0xfe3c('0x20')]['find']({'where':{'id':_0x17fc65[_0xfe3c('0x2a')]['id']}})[_0xfe3c('0x1b')](handleEntityNotFound(_0x1a8d87,null))[_0xfe3c('0x1b')](saveUpdates(_0x17fc65[_0xfe3c('0x35')],null))[_0xfe3c('0x1b')](respondWithResult(_0x1a8d87,null))[_0xfe3c('0x28')](handleError(_0x1a8d87,null));};exports[_0xfe3c('0x1a')]=function(_0x4c5d84,_0x394a1e){return db[_0xfe3c('0x20')][_0xfe3c('0x33')]({'where':{'id':_0x4c5d84['params']['id']}})[_0xfe3c('0x1b')](handleEntityNotFound(_0x394a1e,null))[_0xfe3c('0x1b')](removeEntity(_0x394a1e,null))[_0xfe3c('0x28')](handleError(_0x394a1e,null));};exports[_0xfe3c('0x36')]=function(_0x4692d5,_0x415b2e){return db[_0xfe3c('0x20')][_0xfe3c('0x36')]()[_0xfe3c('0x1b')](respondWithResult(_0x415b2e,null))[_0xfe3c('0x28')](handleError(_0x415b2e,null));};exports[_0xfe3c('0x37')]=function(_0x2d3387,_0x58b916){return db['MailMessage'][_0xfe3c('0x33')]({'where':{'id':_0x2d3387['params']['id']}})['then'](handleEntityNotFound(_0x58b916,null))[_0xfe3c('0x1b')](function(_0x31bc8b){if(_0x31bc8b){return _0x31bc8b[_0xfe3c('0x37')](_0x2d3387[_0xfe3c('0x35')]['ids'],_[_0xfe3c('0x38')](_0x2d3387[_0xfe3c('0x35')],['ids','id'])||{});}})['then'](respondWithResult(_0x58b916,null))[_0xfe3c('0x28')](handleError(_0x58b916,null));};exports[_0xfe3c('0x39')]=function(_0x22a9e6,_0x586bbb){var _0x2de4ef={'raw':![],'where':{}};var _0x462df7={};var _0x4ec181={'count':0x0,'rows':[]};return db[_0xfe3c('0x20')]['findOne']({'where':{'id':_0x22a9e6[_0xfe3c('0x2a')]['id']}})[_0xfe3c('0x1b')](handleEntityNotFound(_0x586bbb,null))['then'](function(_0x584633){if(_0x584633){_0x462df7[_0xfe3c('0x2b')]=_['keys'](db[_0xfe3c('0x3a')][_0xfe3c('0x21')]);_0x462df7[_0xfe3c('0x26')]=_[_0xfe3c('0x2c')](_0x22a9e6[_0xfe3c('0x26')]);_0x462df7[_0xfe3c('0x3b')]=_['intersection'](_0x462df7['model'],_0x462df7[_0xfe3c('0x26')]);_0x2de4ef['attributes']=_[_0xfe3c('0x2d')](_0x462df7[_0xfe3c('0x2b')],qs['fields'](_0x22a9e6[_0xfe3c('0x26')][_0xfe3c('0x2f')]));_0x2de4ef[_0xfe3c('0x2e')]=_0x2de4ef[_0xfe3c('0x2e')][_0xfe3c('0x30')]?_0x2de4ef[_0xfe3c('0x2e')]:_0x462df7[_0xfe3c('0x2b')];if(!_0x22a9e6[_0xfe3c('0x26')][_0xfe3c('0x3c')](_0xfe3c('0x3d'))){_0x2de4ef[_0xfe3c('0x17')]=qs[_0xfe3c('0x17')](_0x22a9e6['query']['limit']);_0x2de4ef[_0xfe3c('0x14')]=qs[_0xfe3c('0x14')](_0x22a9e6[_0xfe3c('0x26')][_0xfe3c('0x14')]);}_0x2de4ef[_0xfe3c('0x3e')]=qs[_0xfe3c('0x3f')](_0x22a9e6[_0xfe3c('0x26')][_0xfe3c('0x3f')]);_0x2de4ef[_0xfe3c('0x40')]=qs[_0xfe3c('0x3b')](_[_0xfe3c('0x41')](_0x22a9e6[_0xfe3c('0x26')],_0x462df7['filters']));_0x2de4ef[_0xfe3c('0x40')]['MailInteractionId']=_0x584633['id'];if(_0x22a9e6[_0xfe3c('0x26')][_0xfe3c('0x42')]){_0x2de4ef[_0xfe3c('0x40')]=_[_0xfe3c('0x32')](_0x2de4ef['where'],{'$or':_[_0xfe3c('0x43')](_0x2de4ef[_0xfe3c('0x2e')],function(_0x54ea42){var _0x16bd1b={};_0x16bd1b[_0x54ea42]={'$like':'%'+_0x22a9e6['query'][_0xfe3c('0x42')]+'%'};return _0x16bd1b;})});}if(_0x22a9e6['query'][_0xfe3c('0x44')]){var _0x37a17d=_0x22a9e6[_0xfe3c('0x26')][_0xfe3c('0x44')][_0xfe3c('0x45')](',');var _0x24df80={};_0x24df80[_0x37a17d[0x0]]={'$gte':moment(_0x37a17d[0x1])['format'](_0xfe3c('0x46'))};_0x2de4ef[_0xfe3c('0x40')]=_['merge'](_0x2de4ef[_0xfe3c('0x40')],_0x24df80);}_0x2de4ef=_[_0xfe3c('0x32')]({},_0x2de4ef,_0x22a9e6[_0xfe3c('0x47')]);return db[_0xfe3c('0x3a')]['count']({'where':_0x2de4ef[_0xfe3c('0x40')]})['then'](function(_0x287d0b){_0x4ec181[_0xfe3c('0x16')]=_0x287d0b;if(_0x22a9e6[_0xfe3c('0x26')][_0xfe3c('0x31')]){_0x2de4ef[_0xfe3c('0x48')]=[{'all':!![]}];}return db[_0xfe3c('0x3a')][_0xfe3c('0x24')](_0x2de4ef);})[_0xfe3c('0x1b')](function(_0x208d45){if(_0x22a9e6[_0xfe3c('0x26')]['inlineCss']===_0xfe3c('0x49')){for(var _0xcab059=0x0;_0xcab059<_0x208d45[_0xfe3c('0x30')];_0xcab059++){_0x208d45[_0xcab059]['body']=juice(_0x208d45[_0xcab059][_0xfe3c('0x35')]);}}_0x4ec181['rows']=_0x208d45;return _0x4ec181;});}})[_0xfe3c('0x1b')](respondWithFilteredResult(_0x586bbb,_0x2de4ef))['catch'](handleError(_0x586bbb,null));};exports['addTags']=function(_0xad6ef0,_0x375ae4){return db[_0xfe3c('0x20')][_0xfe3c('0x33')]({'where':{'id':_0xad6ef0[_0xfe3c('0x2a')]['id']}})['then'](handleEntityNotFound(_0x375ae4,null))['then'](function(_0x58939d){if(_0x58939d){return _0x58939d[_0xfe3c('0x4a')](_0xad6ef0[_0xfe3c('0x35')][_0xfe3c('0x4b')],_[_0xfe3c('0x38')](_0xad6ef0['body'],[_0xfe3c('0x4b'),'id'])||{})['spread'](function(){return db['Tag'][_0xfe3c('0x24')]({'attributes':['id','name',_0xfe3c('0x4c')],'where':{'id':_0xad6ef0['body'][_0xfe3c('0x4b')]}});})[_0xfe3c('0x1b')](function(_0x2c2ac6){socket[_0xfe3c('0x4d')](_0xfe3c('0x4e'),{'id':Number(_0xad6ef0[_0xfe3c('0x2a')]['id']),'tags':_0x2c2ac6||[]});return{'id':Number(_0xad6ef0[_0xfe3c('0x2a')]['id']),'tags':_0x2c2ac6||[]};});}})['then'](respondWithResult(_0x375ae4,null))['catch'](handleError(_0x375ae4,null));};exports[_0xfe3c('0x4f')]=function(_0xada8b3,_0x1be946){return db[_0xfe3c('0x20')][_0xfe3c('0x33')]({'where':{'id':_0xada8b3['params']['id']}})[_0xfe3c('0x1b')](handleEntityNotFound(_0x1be946,null))['then'](function(_0x13149a){if(_0x13149a){return _0x13149a[_0xfe3c('0x4f')](_0xada8b3[_0xfe3c('0x26')][_0xfe3c('0x4b')]);}})[_0xfe3c('0x1b')](respondWithStatusCode(_0x1be946,null))[_0xfe3c('0x28')](handleError(_0x1be946,null));};exports[_0xfe3c('0x50')]=function(_0x5a4367,_0x5f33c4){var _0xbf7387=moment()[_0xfe3c('0x51')]()[_0xfe3c('0x52')]();var _0x229a2d=path[_0xfe3c('0x53')](config[_0xfe3c('0x54')],_0xfe3c('0x55'),_0xfe3c('0x56'),_0xfe3c('0x57'));var _0x4b547d=path[_0xfe3c('0x53')](config['root'],_0xfe3c('0x55'),_0xfe3c('0x56'),_0xfe3c('0x58'));var _0x5b72b4=path[_0xfe3c('0x53')](_0x229a2d,_0xbf7387);var _0x31db56=util[_0xfe3c('0x59')](_0xfe3c('0x5a'),_0x5a4367['params']['id'],_0xbf7387);var _0x78df6f=path[_0xfe3c('0x53')](_0x229a2d,_0x31db56);var _0x4d736d=[];if(_0x5a4367[_0xfe3c('0x26')][_0xfe3c('0x58')]){_0x4d736d['push']({'model':db[_0xfe3c('0x5b')],'as':_0xfe3c('0x5c'),'raw':!![]});}var _0x31730e=[{'model':db[_0xfe3c('0x3a')],'as':'Messages','attributes':['id','body','from','to','cc',_0xfe3c('0x5d'),_0xfe3c('0x5e'),_0xfe3c('0x5f')],'where':{'secret':![]},'order':qs[_0xfe3c('0x3f')]('id'),'include':_0x4d736d}];return db['MailInteraction'][_0xfe3c('0x33')]({'where':{'id':_0x5a4367[_0xfe3c('0x2a')]['id']},'include':_0x31730e})[_0xfe3c('0x1b')](handleEntityNotFound(_0x5f33c4,null))[_0xfe3c('0x1b')](function(_0x3fa719){if(_0x3fa719&&_0x3fa719['Messages']){var _0x208872=_0x3fa719[_0xfe3c('0x60')]({'plain':!![]});fs[_0xfe3c('0x61')](_0x5b72b4);return BPromise[_0xfe3c('0x62')](_0x208872[_0xfe3c('0x63')],function(_0x4ad144,_0x4d9ad9){var _0x489edb={'from':_0x4ad144[_0xfe3c('0x64')],'to':_0x4ad144['to']||_0xfe3c('0x65'),'subject':_0x4ad144[_0xfe3c('0x5e')],'html':htmlEntities[_0xfe3c('0x66')](_0x4ad144[_0xfe3c('0x35')]),'headers':{'Date':moment(_0x4ad144[_0xfe3c('0x5f')])['format'](_0xfe3c('0x67'))},'attachments':[]};if(_0x4ad144['cc']){_0x489edb['headers']['Cc']=_0x4ad144['cc'];}if(_0x4ad144[_0xfe3c('0x5d')]){_0x489edb[_0xfe3c('0x68')]['Bcc']=_0x4ad144[_0xfe3c('0x5d')];}return new BPromise(function(_0x2311ad,_0x5f2f49){if(_0x4ad144[_0xfe3c('0x5c')]){for(var _0x285949=0x0;_0x285949<_0x4ad144[_0xfe3c('0x5c')][_0xfe3c('0x30')];_0x285949++){var _0x4864cd=_0x4ad144[_0xfe3c('0x5c')][_0x285949];var _0x226ad2=path[_0xfe3c('0x53')](_0x4b547d,_0x4864cd[_0xfe3c('0x69')]);if(fs[_0xfe3c('0x6a')](_0x226ad2)){_0x489edb[_0xfe3c('0x58')]['push']({'name':_0x4864cd['name'],'contentType':_0x4864cd[_0xfe3c('0x23')],'data':fs[_0xfe3c('0x6b')](_0x226ad2)});}}}emlformat['build'](_0x489edb,function(_0x51dbb7,_0x39084c){if(_0x51dbb7)return _0x5f2f49(_0x51dbb7);fs[_0xfe3c('0x6c')](path[_0xfe3c('0x53')](_0x5b72b4,util[_0xfe3c('0x59')]('message%d.eml',_0x4d9ad9)),_0x39084c);return _0x2311ad(_0x39084c);});});})['then'](function(){return new BPromise(function(_0xe9ffc7,_0x51c101){zipdir(_0x5b72b4,{'saveTo':_0x78df6f},function(_0x402de6,_0x33daf1){if(_0x402de6)return _0x51c101(_0x402de6);return _0xe9ffc7(_0x33daf1);});})[_0xfe3c('0x1b')](function(){return new BPromise(function(_0x264b99,_0x4b838a){rimraf(_0x5b72b4,function(_0xbb5568){if(_0xbb5568)_0x4b838a(_0xbb5568);return _0x264b99();});});})['then'](function(){return _0x5f33c4[_0xfe3c('0x50')](_0x78df6f,_0x31db56,function(_0xb6c893){if(!_0xb6c893)fs['unlinkSync'](_0x78df6f);});});});}else{return _0x5f33c4[_0xfe3c('0x11')](0xc8);}})['catch'](handleError(_0x5f33c4,null));}; \ No newline at end of file +var _0x55a4=['sort','where','MailInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','addTags','setTags','spread','Tag','color','emit','mailInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','push','Attachment','Attachments','Messages','from','bcc','createdAt','each','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','build','writeFileSync','unlinkSync','zip-dir','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../mysqldb','html-entities','defaults','redis','localhost','socket.io-emitter','register','sendStatus','end','status','limit','undefined','count','offset','set','Content-Range','json','update','then','destroy','error','stack','name','send','index','MailInteraction','rawAttributes','fieldName','type','getOptions','findAll','mail','catch','params','model','keys','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','create','body','find','describe','addMessage','ids','omit','getMessages','findOne','MailMessage','hasOwnProperty','order'];(function(_0x116159,_0x4cb6c4){var _0x45f36e=function(_0x2d6823){while(--_0x2d6823){_0x116159['push'](_0x116159['shift']());}};_0x45f36e(++_0x4cb6c4);}(_0x55a4,0x9d));var _0x455a=function(_0x48e4a4,_0x25f36b){_0x48e4a4=_0x48e4a4-0x0;var _0x39ce52=_0x55a4[_0x48e4a4];return _0x39ce52;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x455a('0x0'));var moment=require('moment');var BPromise=require(_0x455a('0x1'));var util=require(_0x455a('0x2'));var path=require(_0x455a('0x3'));var fs=require('fs');var _=require(_0x455a('0x4'));var juice=require('juice');var Redis=require(_0x455a('0x5'));var interaction=require(_0x455a('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0x455a('0x7'))(_0x455a('0x8'));var config=require('../../config/environment');var db=require(_0x455a('0x9'))['db'];var htmlEntities=require(_0x455a('0xa'));config['redis']=_[_0x455a('0xb')](config[_0x455a('0xc')],{'host':_0x455a('0xd'),'port':0x18eb});var socket=require(_0x455a('0xe'))(new Redis(config[_0x455a('0xc')]));require('./mailInteraction.socket')[_0x455a('0xf')](socket);function respondWithStatusCode(_0x4e18fe,_0x37ff2b){_0x37ff2b=_0x37ff2b||0xcc;return function(_0x13109e){if(_0x13109e){return _0x4e18fe[_0x455a('0x10')](_0x37ff2b);}return _0x4e18fe['status'](_0x37ff2b)[_0x455a('0x11')]();};}function respondWithResult(_0x2268df,_0x12ef88){_0x12ef88=_0x12ef88||0xc8;return function(_0x134ced){if(_0x134ced){return _0x2268df[_0x455a('0x12')](_0x12ef88)['json'](_0x134ced);}};}function respondWithFilteredResult(_0x405afc,_0x34587b){return function(_0x3464f8){if(_0x3464f8){var _0x296736=typeof _0x34587b['offset']==='undefined'&&typeof _0x34587b[_0x455a('0x13')]===_0x455a('0x14');var _0x324784=_0x3464f8[_0x455a('0x15')];var _0x1066b3=_0x296736?0x0:_0x34587b['offset'];var _0x47a0df=_0x296736?_0x3464f8[_0x455a('0x15')]:_0x34587b[_0x455a('0x16')]+_0x34587b[_0x455a('0x13')];var _0x4020e7;if(_0x47a0df>=_0x324784){_0x47a0df=_0x324784;_0x4020e7=0xc8;}else{_0x4020e7=0xce;}_0x405afc[_0x455a('0x12')](_0x4020e7);return _0x405afc[_0x455a('0x17')](_0x455a('0x18'),_0x1066b3+'-'+_0x47a0df+'/'+_0x324784)[_0x455a('0x19')](_0x3464f8);}return null;};}function saveUpdates(_0x2ecf56){return function(_0x5b4d24){if(_0x5b4d24){return _0x5b4d24[_0x455a('0x1a')](_0x2ecf56)[_0x455a('0x1b')](function(_0x296a77){return _0x296a77;});}return null;};}function removeEntity(_0x593d03){return function(_0x1df5af){if(_0x1df5af){return _0x1df5af[_0x455a('0x1c')]()[_0x455a('0x1b')](function(){_0x593d03[_0x455a('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x108966){return function(_0x1d698a){if(!_0x1d698a){_0x108966['sendStatus'](0x194);}return _0x1d698a;};}function handleError(_0x22ba72,_0x5c24ac){_0x5c24ac=_0x5c24ac||0x1f4;return function(_0x1c2467){logger[_0x455a('0x1d')](_0x1c2467[_0x455a('0x1e')]);if(_0x1c2467[_0x455a('0x1f')]){delete _0x1c2467[_0x455a('0x1f')];}_0x22ba72[_0x455a('0x12')](_0x5c24ac)[_0x455a('0x20')](_0x1c2467);};}exports[_0x455a('0x21')]=function(_0xf69360,_0x1fe1e4){var _0x12bc0d={};var _0x284427=_['map'](db[_0x455a('0x22')][_0x455a('0x23')],function(_0x28ab82){return{'name':_0x28ab82[_0x455a('0x24')],'type':_0x28ab82[_0x455a('0x25')]['key']};});_0x12bc0d=qs[_0x455a('0x26')](_0x284427,_0xf69360);return interaction[_0x455a('0x27')](_0x455a('0x28'),_0xf69360['query'],_0xf69360['user'],_0x12bc0d,_0x284427)[_0x455a('0x1b')](respondWithFilteredResult(_0x1fe1e4,_0x12bc0d))[_0x455a('0x29')](handleError(_0x1fe1e4,null));};exports['show']=function(_0xae55e,_0x31d0cf){var _0x1962e1={'raw':![],'where':{'id':_0xae55e[_0x455a('0x2a')]['id']}},_0x4537b9={};_0x4537b9[_0x455a('0x2b')]=_[_0x455a('0x2c')](db['MailInteraction'][_0x455a('0x23')]);_0x4537b9[_0x455a('0x2d')]=_[_0x455a('0x2c')](_0xae55e[_0x455a('0x2d')]);_0x4537b9[_0x455a('0x2e')]=_[_0x455a('0x2f')](_0x4537b9[_0x455a('0x2b')],_0x4537b9['query']);_0x1962e1['attributes']=_[_0x455a('0x2f')](_0x4537b9['model'],qs['fields'](_0xae55e[_0x455a('0x2d')][_0x455a('0x30')]));_0x1962e1[_0x455a('0x31')]=_0x1962e1[_0x455a('0x31')][_0x455a('0x32')]?_0x1962e1[_0x455a('0x31')]:_0x4537b9[_0x455a('0x2b')];if(_0xae55e[_0x455a('0x2d')][_0x455a('0x33')]){_0x1962e1[_0x455a('0x34')]=[{'all':!![]}];}_0x1962e1=_[_0x455a('0x35')]({},_0x1962e1,_0xae55e[_0x455a('0x36')]);return db['MailInteraction']['find'](_0x1962e1)[_0x455a('0x1b')](handleEntityNotFound(_0x31d0cf,null))[_0x455a('0x1b')](respondWithResult(_0x31d0cf,null))[_0x455a('0x29')](handleError(_0x31d0cf,null));};exports[_0x455a('0x37')]=function(_0x257fbf,_0x9cb2ea){return db[_0x455a('0x22')][_0x455a('0x37')](_0x257fbf[_0x455a('0x38')],{})[_0x455a('0x1b')](respondWithResult(_0x9cb2ea,0xc9))['catch'](handleError(_0x9cb2ea,null));};exports[_0x455a('0x1a')]=function(_0x508e01,_0x292678){if(_0x508e01[_0x455a('0x38')]['id']){delete _0x508e01[_0x455a('0x38')]['id'];}return db['MailInteraction'][_0x455a('0x39')]({'where':{'id':_0x508e01[_0x455a('0x2a')]['id']}})[_0x455a('0x1b')](handleEntityNotFound(_0x292678,null))['then'](saveUpdates(_0x508e01[_0x455a('0x38')],null))[_0x455a('0x1b')](respondWithResult(_0x292678,null))[_0x455a('0x29')](handleError(_0x292678,null));};exports['destroy']=function(_0x4eddb1,_0x188dc1){return db[_0x455a('0x22')]['find']({'where':{'id':_0x4eddb1['params']['id']}})[_0x455a('0x1b')](handleEntityNotFound(_0x188dc1,null))['then'](removeEntity(_0x188dc1,null))[_0x455a('0x29')](handleError(_0x188dc1,null));};exports[_0x455a('0x3a')]=function(_0x476ec6,_0x544577){return db[_0x455a('0x22')]['describe']()[_0x455a('0x1b')](respondWithResult(_0x544577,null))['catch'](handleError(_0x544577,null));};exports[_0x455a('0x3b')]=function(_0x3b887a,_0x997bd0){return db['MailMessage']['find']({'where':{'id':_0x3b887a['params']['id']}})['then'](handleEntityNotFound(_0x997bd0,null))['then'](function(_0xd0f7f3){if(_0xd0f7f3){return _0xd0f7f3[_0x455a('0x3b')](_0x3b887a[_0x455a('0x38')][_0x455a('0x3c')],_[_0x455a('0x3d')](_0x3b887a[_0x455a('0x38')],[_0x455a('0x3c'),'id'])||{});}})[_0x455a('0x1b')](respondWithResult(_0x997bd0,null))['catch'](handleError(_0x997bd0,null));};exports[_0x455a('0x3e')]=function(_0x3e756e,_0x431f0c){var _0x4deaba={'raw':![],'where':{}};var _0x5cf82a={};var _0x3e17b7={'count':0x0,'rows':[]};return db['MailInteraction'][_0x455a('0x3f')]({'where':{'id':_0x3e756e['params']['id']}})[_0x455a('0x1b')](handleEntityNotFound(_0x431f0c,null))[_0x455a('0x1b')](function(_0x563220){if(_0x563220){_0x5cf82a[_0x455a('0x2b')]=_[_0x455a('0x2c')](db[_0x455a('0x40')][_0x455a('0x23')]);_0x5cf82a[_0x455a('0x2d')]=_[_0x455a('0x2c')](_0x3e756e['query']);_0x5cf82a['filters']=_[_0x455a('0x2f')](_0x5cf82a[_0x455a('0x2b')],_0x5cf82a[_0x455a('0x2d')]);_0x4deaba[_0x455a('0x31')]=_[_0x455a('0x2f')](_0x5cf82a[_0x455a('0x2b')],qs[_0x455a('0x30')](_0x3e756e[_0x455a('0x2d')][_0x455a('0x30')]));_0x4deaba[_0x455a('0x31')]=_0x4deaba[_0x455a('0x31')][_0x455a('0x32')]?_0x4deaba['attributes']:_0x5cf82a[_0x455a('0x2b')];if(!_0x3e756e[_0x455a('0x2d')][_0x455a('0x41')]('nolimit')){_0x4deaba[_0x455a('0x13')]=qs[_0x455a('0x13')](_0x3e756e[_0x455a('0x2d')]['limit']);_0x4deaba[_0x455a('0x16')]=qs[_0x455a('0x16')](_0x3e756e[_0x455a('0x2d')][_0x455a('0x16')]);}_0x4deaba[_0x455a('0x42')]=qs[_0x455a('0x43')](_0x3e756e[_0x455a('0x2d')][_0x455a('0x43')]);_0x4deaba[_0x455a('0x44')]=qs[_0x455a('0x2e')](_['pick'](_0x3e756e['query'],_0x5cf82a[_0x455a('0x2e')]));_0x4deaba[_0x455a('0x44')][_0x455a('0x45')]=_0x563220['id'];if(_0x3e756e[_0x455a('0x2d')][_0x455a('0x46')]){_0x4deaba[_0x455a('0x44')]=_[_0x455a('0x35')](_0x4deaba[_0x455a('0x44')],{'$or':_['map'](_0x4deaba[_0x455a('0x31')],function(_0x230135){var _0x58b37b={};_0x58b37b[_0x230135]={'$like':'%'+_0x3e756e['query'][_0x455a('0x46')]+'%'};return _0x58b37b;})});}if(_0x3e756e[_0x455a('0x2d')][_0x455a('0x47')]){var _0xb6426=_0x3e756e[_0x455a('0x2d')][_0x455a('0x47')][_0x455a('0x48')](',');var _0x1811a8={};_0x1811a8[_0xb6426[0x0]]={'$gte':moment(_0xb6426[0x1])[_0x455a('0x49')](_0x455a('0x4a'))};_0x4deaba['where']=_[_0x455a('0x35')](_0x4deaba[_0x455a('0x44')],_0x1811a8);}_0x4deaba=_[_0x455a('0x35')]({},_0x4deaba,_0x3e756e[_0x455a('0x36')]);return db[_0x455a('0x40')][_0x455a('0x15')]({'where':_0x4deaba[_0x455a('0x44')]})[_0x455a('0x1b')](function(_0x4d1f1a){_0x3e17b7[_0x455a('0x15')]=_0x4d1f1a;if(_0x3e756e[_0x455a('0x2d')][_0x455a('0x33')]){_0x4deaba['include']=[{'all':!![]}];}return db[_0x455a('0x40')]['findAll'](_0x4deaba);})['then'](function(_0x2b34a0){if(_0x3e756e[_0x455a('0x2d')][_0x455a('0x4b')]===_0x455a('0x4c')){for(var _0x5708a9=0x0;_0x5708a9<_0x2b34a0[_0x455a('0x32')];_0x5708a9++){_0x2b34a0[_0x5708a9]['body']=juice(_0x2b34a0[_0x5708a9][_0x455a('0x38')]);}}_0x3e17b7['rows']=_0x2b34a0;return _0x3e17b7;});}})['then'](respondWithFilteredResult(_0x431f0c,_0x4deaba))[_0x455a('0x29')](handleError(_0x431f0c,null));};exports[_0x455a('0x4d')]=function(_0x57d426,_0x4430e5){return db[_0x455a('0x22')]['find']({'where':{'id':_0x57d426[_0x455a('0x2a')]['id']}})[_0x455a('0x1b')](handleEntityNotFound(_0x4430e5,null))[_0x455a('0x1b')](function(_0x292261){if(_0x292261){return _0x292261[_0x455a('0x4e')](_0x57d426[_0x455a('0x38')][_0x455a('0x3c')],_[_0x455a('0x3d')](_0x57d426[_0x455a('0x38')],[_0x455a('0x3c'),'id'])||{})[_0x455a('0x4f')](function(){return db[_0x455a('0x50')]['findAll']({'attributes':['id',_0x455a('0x1f'),_0x455a('0x51')],'where':{'id':_0x57d426[_0x455a('0x38')]['ids']}});})[_0x455a('0x1b')](function(_0x271150){socket[_0x455a('0x52')](_0x455a('0x53'),{'id':Number(_0x57d426[_0x455a('0x2a')]['id']),'tags':_0x271150||[]});return{'id':Number(_0x57d426['params']['id']),'tags':_0x271150||[]};});}})[_0x455a('0x1b')](respondWithResult(_0x4430e5,null))[_0x455a('0x29')](handleError(_0x4430e5,null));};exports['removeTags']=function(_0x472273,_0x55e1f5){return db['MailInteraction'][_0x455a('0x39')]({'where':{'id':_0x472273[_0x455a('0x2a')]['id']}})['then'](handleEntityNotFound(_0x55e1f5,null))[_0x455a('0x1b')](function(_0xbfb817){if(_0xbfb817){return _0xbfb817[_0x455a('0x54')](_0x472273[_0x455a('0x2d')][_0x455a('0x3c')]);}})[_0x455a('0x1b')](respondWithStatusCode(_0x55e1f5,null))['catch'](handleError(_0x55e1f5,null));};exports[_0x455a('0x55')]=function(_0x2f8061,_0x49134b){var _0x332f7c=moment()[_0x455a('0x56')]()[_0x455a('0x57')]();var _0x2a1cd6=path[_0x455a('0x58')](config[_0x455a('0x59')],_0x455a('0x5a'),_0x455a('0x5b'),_0x455a('0x5c'));var _0x554f86=path[_0x455a('0x58')](config[_0x455a('0x59')],'server',_0x455a('0x5b'),_0x455a('0x5d'));var _0x4b668d=path[_0x455a('0x58')](_0x2a1cd6,_0x332f7c);var _0x365625=util['format']('transcript-%d-%s.zip',_0x2f8061[_0x455a('0x2a')]['id'],_0x332f7c);var _0x3171d0=path[_0x455a('0x58')](_0x2a1cd6,_0x365625);var _0x350e6e=[];if(_0x2f8061[_0x455a('0x2d')][_0x455a('0x5d')]){_0x350e6e[_0x455a('0x5e')]({'model':db[_0x455a('0x5f')],'as':_0x455a('0x60'),'raw':!![]});}var _0x1e77c3=[{'model':db[_0x455a('0x40')],'as':_0x455a('0x61'),'attributes':['id',_0x455a('0x38'),_0x455a('0x62'),'to','cc',_0x455a('0x63'),'subject',_0x455a('0x64')],'where':{'secret':![]},'order':qs[_0x455a('0x43')]('id'),'include':_0x350e6e}];return db['MailInteraction'][_0x455a('0x39')]({'where':{'id':_0x2f8061[_0x455a('0x2a')]['id']},'include':_0x1e77c3})[_0x455a('0x1b')](handleEntityNotFound(_0x49134b,null))[_0x455a('0x1b')](function(_0x1c9a47){if(_0x1c9a47&&_0x1c9a47[_0x455a('0x61')]){var _0x48ec54=_0x1c9a47['get']({'plain':!![]});fs['mkdirSync'](_0x4b668d);return BPromise[_0x455a('0x65')](_0x48ec54['Messages'],function(_0x5e92dc,_0x2d4047){var _0x5059d2={'from':_0x5e92dc[_0x455a('0x62')],'to':_0x5e92dc['to']||_0x455a('0x66'),'subject':_0x5e92dc['subject'],'html':htmlEntities[_0x455a('0x67')](_0x5e92dc[_0x455a('0x38')]),'headers':{'Date':moment(_0x5e92dc['createdAt'])[_0x455a('0x49')](_0x455a('0x68'))},'attachments':[]};if(_0x5e92dc['cc']){_0x5059d2['headers']['Cc']=_0x5e92dc['cc'];}if(_0x5e92dc[_0x455a('0x63')]){_0x5059d2[_0x455a('0x69')][_0x455a('0x6a')]=_0x5e92dc[_0x455a('0x63')];}return new BPromise(function(_0x3925d8,_0x5c1d76){if(_0x5e92dc[_0x455a('0x60')]){for(var _0x356d00=0x0;_0x356d00<_0x5e92dc['Attachments'][_0x455a('0x32')];_0x356d00++){var _0x55c55f=_0x5e92dc[_0x455a('0x60')][_0x356d00];var _0x2b50ad=path['join'](_0x554f86,_0x55c55f[_0x455a('0x6b')]);if(fs[_0x455a('0x6c')](_0x2b50ad)){_0x5059d2[_0x455a('0x5d')][_0x455a('0x5e')]({'name':_0x55c55f[_0x455a('0x1f')],'contentType':_0x55c55f[_0x455a('0x25')],'data':fs['readFileSync'](_0x2b50ad)});}}}emlformat[_0x455a('0x6d')](_0x5059d2,function(_0x439320,_0x5cc7fd){if(_0x439320)return _0x5c1d76(_0x439320);fs[_0x455a('0x6e')](path[_0x455a('0x58')](_0x4b668d,util[_0x455a('0x49')]('message%d.eml',_0x2d4047)),_0x5cc7fd);return _0x3925d8(_0x5cc7fd);});});})[_0x455a('0x1b')](function(){return new BPromise(function(_0x3a6776,_0x294f12){zipdir(_0x4b668d,{'saveTo':_0x3171d0},function(_0xf2c87f,_0x46b39c){if(_0xf2c87f)return _0x294f12(_0xf2c87f);return _0x3a6776(_0x46b39c);});})[_0x455a('0x1b')](function(){return new BPromise(function(_0x272a08,_0x2396dd){rimraf(_0x4b668d,function(_0x5998f9){if(_0x5998f9)_0x2396dd(_0x5998f9);return _0x272a08();});});})['then'](function(){return _0x49134b[_0x455a('0x55')](_0x3171d0,_0x365625,function(_0x2d6acc){if(!_0x2d6acc)fs[_0x455a('0x6f')](_0x3171d0);});});});}else{return _0x49134b[_0x455a('0x10')](0xc8);}})[_0x455a('0x29')](handleError(_0x49134b,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 7372d79..8168704 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 _0xb270=['length','emit','catch','hook','exports','events','../../mysqldb','MailInteraction','setMaxListeners','save','update','remove','getUsers','then','setDataValue','map','findAll','unreadMessages'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0xb270,0xb9));var _0x0b27=function(_0x2755fb,_0x5970f1){_0x2755fb=_0x2755fb-0x0;var _0x293f12=_0xb270[_0x2755fb];return _0x293f12;};'use strict';var EventEmitter=require(_0x0b27('0x0'));var MailInteraction=require(_0x0b27('0x1'))['db'][_0x0b27('0x2')];var MailMessage=require(_0x0b27('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x0b27('0x3')](0x0);var events={'afterCreate':_0x0b27('0x4'),'afterUpdate':_0x0b27('0x5'),'afterDestroy':_0x0b27('0x6')};function emitEvent(_0x4747b7){return function(_0x5e4056,_0x5da13b,_0x2e5ce3){_0x5e4056[_0x0b27('0x7')]({'attributes':['id'],'raw':!![]})[_0x0b27('0x8')](function(_0xfe3fd9){_0x5e4056[_0x0b27('0x9')]('Users',_0xfe3fd9[_0x0b27('0xa')](function(_0x4dc6b2){return{'id':_0x4dc6b2['id']};}));return MailMessage[_0x0b27('0xb')]({'where':{'MailInteractionId':_0x5e4056['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x28e70b){_0x5e4056[_0x0b27('0x9')](_0x0b27('0xc'),_0x28e70b[_0x0b27('0xd')]);MailInteractionEvents['emit'](_0x4747b7+':'+_0x5e4056['id'],_0x5e4056);MailInteractionEvents[_0x0b27('0xe')](_0x4747b7,_0x5e4056);_0x2e5ce3(null);})[_0x0b27('0xf')](_0x2e5ce3(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x0b27('0x10')](e,emitEvent(event));}}module[_0x0b27('0x11')]=MailInteractionEvents; \ No newline at end of file +var _0xa850=['catch','hasOwnProperty','hook','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','update','remove','getUsers','then','map','findAll','setDataValue','unreadMessages','length','emit'];(function(_0x4f90b2,_0x7d4485){var _0x4fcc8a=function(_0x156a6d){while(--_0x156a6d){_0x4f90b2['push'](_0x4f90b2['shift']());}};_0x4fcc8a(++_0x7d4485);}(_0xa850,0xb7));var _0x0a85=function(_0x3c9b6f,_0x44b2a5){_0x3c9b6f=_0x3c9b6f-0x0;var _0x145e81=_0xa850[_0x3c9b6f];return _0x145e81;};'use strict';var EventEmitter=require(_0x0a85('0x0'));var MailInteraction=require(_0x0a85('0x1'))['db'][_0x0a85('0x2')];var MailMessage=require(_0x0a85('0x1'))['db'][_0x0a85('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x0a85('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0a85('0x5'),'afterDestroy':_0x0a85('0x6')};function emitEvent(_0x452c67){return function(_0x383c0c,_0x1451f7,_0x4bce02){_0x383c0c[_0x0a85('0x7')]({'attributes':['id'],'raw':!![]})[_0x0a85('0x8')](function(_0x32cf7d){_0x383c0c['setDataValue']('Users',_0x32cf7d[_0x0a85('0x9')](function(_0xf810db){return{'id':_0xf810db['id']};}));return MailMessage[_0x0a85('0xa')]({'where':{'MailInteractionId':_0x383c0c['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0a85('0x8')](function(_0x349e34){_0x383c0c[_0x0a85('0xb')](_0x0a85('0xc'),_0x349e34[_0x0a85('0xd')]);MailInteractionEvents[_0x0a85('0xe')](_0x452c67+':'+_0x383c0c['id'],_0x383c0c);MailInteractionEvents[_0x0a85('0xe')](_0x452c67,_0x383c0c);_0x4bce02(null);})[_0x0a85('0xf')](_0x4bce02(null));};}for(var e in events){if(events[_0x0a85('0x10')](e)){var event=events[e];MailInteraction[_0x0a85('0x11')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 7d244e4..1f6cf96 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 _0x14a8=['define','MailInteraction','mail_interactions','fti_mail_interactions','subject','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','changed','substatus','closedAt','format','models','get','MailMessage','update','then','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./mailInteraction.attributes','exports'];(function(_0x51113f,_0x5f056c){var _0x205716=function(_0x3c07a8){while(--_0x3c07a8){_0x51113f['push'](_0x51113f['shift']());}};_0x205716(++_0x5f056c);}(_0x14a8,0x162));var _0x814a=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0x14a8[_0x3ce3c];return _0x55a2c9;};'use strict';var _=require(_0x814a('0x0'));var util=require(_0x814a('0x1'));var logger=require(_0x814a('0x2'))(_0x814a('0x3'));var moment=require(_0x814a('0x4'));var BPromise=require(_0x814a('0x5'));var rp=require(_0x814a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x814a('0x7'));var config=require('../../config/environment');var attributes=require(_0x814a('0x8'));module[_0x814a('0x9')]=function(_0x31978a,_0x1f907d){return _0x31978a[_0x814a('0xa')](_0x814a('0xb'),attributes,{'tableName':_0x814a('0xc'),'paranoid':![],'indexes':[{'name':_0x814a('0xd'),'fields':[_0x814a('0xe'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5e8195,_0x4baaef,_0x3f4816){if(_0x5e8195['substatus']){_0x5e8195[_0x814a('0xf')]=moment()['format'](_0x814a('0x10'));}if(_0x5e8195[_0x814a('0x11')]){_0x5e8195['closedAt']=moment()['format'](_0x814a('0x10'));}_0x3f4816(null,_0x4baaef);},'beforeUpdate':function(_0x41d7b8,_0x4cc0da,_0x168723){if(_0x41d7b8[_0x814a('0x12')](_0x814a('0x13'))){_0x41d7b8[_0x814a('0xf')]=_0x41d7b8['substatus']?moment()['format'](_0x814a('0x10')):null;}if(_0x41d7b8[_0x814a('0x12')]('closed')){_0x41d7b8[_0x814a('0x14')]=moment()[_0x814a('0x15')](_0x814a('0x10'));_0x41d7b8[_0x814a('0x13')]=null;_0x41d7b8[_0x814a('0xf')]=null;}_0x168723(null,_0x41d7b8);},'afterUpdate':function(_0x2a9d75,_0x1cabfe,_0x466e1d){var _0x5ac517=_0x31978a[_0x814a('0x16')];var _0x2b4e73=_0x2a9d75[_0x814a('0x17')]({'plain':!![]});if(_0x2b4e73['closed']){return _0x5ac517[_0x814a('0x18')][_0x814a('0x19')]({'read':!![]},{'where':{'MailInteractionId':_0x2b4e73['id']}})[_0x814a('0x1a')](function(){_0x466e1d();})['catch'](function(_0x380cbd){_0x466e1d(_0x380cbd);});}else{_0x466e1d();}}},'charset':_0x814a('0x1b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x1e0b=['utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','MailMessage','update','then'];(function(_0x3c7d53,_0x2826d0){var _0x2c8387=function(_0x21f0e8){while(--_0x21f0e8){_0x3c7d53['push'](_0x3c7d53['shift']());}};_0x2c8387(++_0x2826d0);}(_0x1e0b,0x17b));var _0xb1e0=function(_0x2dd390,_0x1bc894){_0x2dd390=_0x2dd390-0x0;var _0x3afe47=_0x1e0b[_0x2dd390];return _0x3afe47;};'use strict';var _=require(_0xb1e0('0x0'));var util=require('util');var logger=require(_0xb1e0('0x1'))(_0xb1e0('0x2'));var moment=require(_0xb1e0('0x3'));var BPromise=require(_0xb1e0('0x4'));var rp=require(_0xb1e0('0x5'));var fs=require('fs');var path=require(_0xb1e0('0x6'));var rimraf=require(_0xb1e0('0x7'));var config=require('../../config/environment');var attributes=require('./mailInteraction.attributes');module[_0xb1e0('0x8')]=function(_0x246823,_0x2ef030){return _0x246823[_0xb1e0('0x9')]('MailInteraction',attributes,{'tableName':_0xb1e0('0xa'),'paranoid':![],'indexes':[{'name':_0xb1e0('0xb'),'fields':[_0xb1e0('0xc'),'to'],'type':_0xb1e0('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x416483,_0x1f5315,_0x3f3103){if(_0x416483[_0xb1e0('0xe')]){_0x416483[_0xb1e0('0xf')]=moment()[_0xb1e0('0x10')](_0xb1e0('0x11'));}if(_0x416483[_0xb1e0('0x12')]){_0x416483[_0xb1e0('0x13')]=moment()[_0xb1e0('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3f3103(null,_0x1f5315);},'beforeUpdate':function(_0x1c5faa,_0x4a70e0,_0x56de3a){if(_0x1c5faa[_0xb1e0('0x14')](_0xb1e0('0xe'))){_0x1c5faa[_0xb1e0('0xf')]=_0x1c5faa[_0xb1e0('0xe')]?moment()[_0xb1e0('0x10')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x1c5faa[_0xb1e0('0x14')](_0xb1e0('0x12'))){_0x1c5faa[_0xb1e0('0x13')]=moment()[_0xb1e0('0x10')](_0xb1e0('0x11'));_0x1c5faa['substatus']=null;_0x1c5faa['substatusAt']=null;}_0x56de3a(null,_0x1c5faa);},'afterUpdate':function(_0x5afcbd,_0x32e247,_0x5ba1db){var _0x5a74df=_0x246823[_0xb1e0('0x15')];var _0x5d8cb8=_0x5afcbd[_0xb1e0('0x16')]({'plain':!![]});if(_0x5d8cb8['closed']){return _0x5a74df[_0xb1e0('0x17')][_0xb1e0('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x5d8cb8['id']}})[_0xb1e0('0x19')](function(){_0x5ba1db();})['catch'](function(_0x1ba663){_0x5ba1db(_0x1ba663);});}else{_0x5ba1db();}}},'charset':'utf8mb4','collate':_0xb1e0('0x1a')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index fa5f066..c5691b2 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 _0xbcba=['stringify','error','message','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','attributes','limit','AddTagsToMailInteraction','where','addTags','ids','omit','AddTags','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x320876,_0x431175){var _0x29c4c2=function(_0x4e941c){while(--_0x4e941c){_0x320876['push'](_0x320876['shift']());}};_0x29c4c2(++_0x431175);}(_0xbcba,0x198));var _0xabcb=function(_0x589584,_0x9c4c6d){_0x589584=_0x589584-0x0;var _0x421662=_0xbcba[_0x589584];return _0x421662;};'use strict';var _=require(_0xabcb('0x0'));var util=require(_0xabcb('0x1'));var moment=require(_0xabcb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xabcb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xabcb('0x4'));var logger=require(_0xabcb('0x5'))(_0xabcb('0x6'));var config=require(_0xabcb('0x7'));var jayson=require(_0xabcb('0x8'));var client=jayson[_0xabcb('0x9')]['http']({'port':0x232a});config['redis']=_[_0xabcb('0xa')](config[_0xabcb('0xb')],{'host':_0xabcb('0xc'),'port':0x18eb});var socket=require(_0xabcb('0xd'))(new Redis(config['redis']));require('./mailInteraction.socket')[_0xabcb('0xe')](socket);function respondWithRpcPromise(_0x3a7bcd,_0x404d12,_0x4eeb83){return new BPromise(function(_0x726d3,_0x5cd732){return client[_0xabcb('0xf')](_0x3a7bcd,_0x4eeb83)[_0xabcb('0x10')](function(_0x409a35){logger[_0xabcb('0x11')](_0xabcb('0x12'),_0x404d12,_0xabcb('0x13'));logger[_0xabcb('0x14')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x404d12,'request\x20sent',JSON[_0xabcb('0x15')](_0x409a35));if(_0x409a35[_0xabcb('0x16')]){if(_0x409a35['error']['code']===0x1f4){logger['error'](_0xabcb('0x12'),_0x404d12,_0x409a35[_0xabcb('0x16')][_0xabcb('0x17')]);return _0x5cd732(_0x409a35['error'][_0xabcb('0x17')]);}logger[_0xabcb('0x16')](_0xabcb('0x12'),_0x404d12,_0x409a35[_0xabcb('0x16')][_0xabcb('0x17')]);return _0x726d3(_0x409a35[_0xabcb('0x16')][_0xabcb('0x17')]);}else{logger[_0xabcb('0x11')](_0xabcb('0x12'),_0x404d12,_0xabcb('0x13'));_0x726d3(_0x409a35['result'][_0xabcb('0x17')]);}})[_0xabcb('0x18')](function(_0xbd0db6){logger[_0xabcb('0x16')](_0xabcb('0x12'),_0x404d12,_0xbd0db6);_0x5cd732(_0xbd0db6);});});}exports[_0xabcb('0x19')]=function(_0x57a06c){var _0x19bcca=this;return new Promise(function(_0x4cfaf8,_0x5b6d3f){return db[_0xabcb('0x1a')][_0xabcb('0x1b')](_0x57a06c[_0xabcb('0x1c')],{'raw':_0x57a06c[_0xabcb('0x1d')]?_0x57a06c[_0xabcb('0x1d')][_0xabcb('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57a06c[_0xabcb('0x1d')]?_0x57a06c[_0xabcb('0x1d')]['where']||null:null,'attributes':_0x57a06c[_0xabcb('0x1d')]?_0x57a06c['options'][_0xabcb('0x1f')]||null:null,'limit':_0x57a06c['options']?_0x57a06c[_0xabcb('0x1d')][_0xabcb('0x20')]||null:null})['then'](function(_0x402ff3){logger['info']('UpdateMailInteraction',_0x57a06c);logger[_0xabcb('0x14')](_0xabcb('0x19'),_0x57a06c,JSON['stringify'](_0x402ff3));_0x4cfaf8(_0x402ff3);})[_0xabcb('0x18')](function(_0x2a50d7){logger[_0xabcb('0x16')]('UpdateMailInteraction',_0x2a50d7[_0xabcb('0x17')],_0x57a06c);_0x5b6d3f(_0x19bcca[_0xabcb('0x16')](0x1f4,_0x2a50d7[_0xabcb('0x17')]));});});};exports[_0xabcb('0x21')]=function(_0x1e4568){return new Promise(function(_0x432aa3,_0x4a2a92){return db[_0xabcb('0x1a')]['find']({'where':_0x1e4568['options']?_0x1e4568['options'][_0xabcb('0x22')]||null:null})[_0xabcb('0x10')](function(_0x2c25f2){if(_0x2c25f2){return _0x2c25f2[_0xabcb('0x23')](_0x1e4568[_0xabcb('0x1c')][_0xabcb('0x24')],_[_0xabcb('0x25')](_0x1e4568[_0xabcb('0x1c')],[_0xabcb('0x24'),'id'])||{});}})['spread'](function(_0x57ff5e){logger['info'](_0xabcb('0x26'),_0x1e4568);logger[_0xabcb('0x14')](_0xabcb('0x26'),_0x1e4568,JSON[_0xabcb('0x15')](_0x57ff5e));_0x432aa3(_0x57ff5e);})[_0xabcb('0x18')](function(_0x2e12a0){logger['error'](_0xabcb('0x26'),_0x2e12a0['message'],_0x1e4568);_0x4a2a92(_this[_0xabcb('0x16')](0x1f4,_0x2e12a0[_0xabcb('0x17')]));});});}; \ No newline at end of file +var _0xd781=['http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','MailInteraction,\x20%s,\x20%s','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','limit','AddTagsToMailInteraction','find','addTags','ids','omit','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0xd2e77,_0x44a34a){var _0x38d2bd=function(_0x4c66f9){while(--_0x4c66f9){_0xd2e77['push'](_0xd2e77['shift']());}};_0x38d2bd(++_0x44a34a);}(_0xd781,0x1bb));var _0x1d78=function(_0x264ce8,_0x30a5fc){_0x264ce8=_0x264ce8-0x0;var _0x1173f5=_0xd781[_0x264ce8];return _0x1173f5;};'use strict';var _=require(_0x1d78('0x0'));var util=require(_0x1d78('0x1'));var moment=require(_0x1d78('0x2'));var BPromise=require(_0x1d78('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1d78('0x4'));var db=require(_0x1d78('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1d78('0x6'));var config=require(_0x1d78('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1d78('0x8')]({'port':0x232a});config[_0x1d78('0x9')]=_[_0x1d78('0xa')](config[_0x1d78('0x9')],{'host':_0x1d78('0xb'),'port':0x18eb});var socket=require(_0x1d78('0xc'))(new Redis(config['redis']));require('./mailInteraction.socket')[_0x1d78('0xd')](socket);function respondWithRpcPromise(_0x1288b8,_0x3e122c,_0x818382){return new BPromise(function(_0x252b42,_0x40d1a4){return client[_0x1d78('0xe')](_0x1288b8,_0x818382)[_0x1d78('0xf')](function(_0xca064a){logger[_0x1d78('0x10')]('MailInteraction,\x20%s,\x20%s',_0x3e122c,_0x1d78('0x11'));logger[_0x1d78('0x12')](_0x1d78('0x13'),_0x3e122c,_0x1d78('0x11'),JSON[_0x1d78('0x14')](_0xca064a));if(_0xca064a[_0x1d78('0x15')]){if(_0xca064a[_0x1d78('0x15')][_0x1d78('0x16')]===0x1f4){logger[_0x1d78('0x15')](_0x1d78('0x17'),_0x3e122c,_0xca064a[_0x1d78('0x15')][_0x1d78('0x18')]);return _0x40d1a4(_0xca064a['error'][_0x1d78('0x18')]);}logger[_0x1d78('0x15')](_0x1d78('0x17'),_0x3e122c,_0xca064a[_0x1d78('0x15')][_0x1d78('0x18')]);return _0x252b42(_0xca064a[_0x1d78('0x15')][_0x1d78('0x18')]);}else{logger['info'](_0x1d78('0x17'),_0x3e122c,_0x1d78('0x11'));_0x252b42(_0xca064a[_0x1d78('0x19')][_0x1d78('0x18')]);}})[_0x1d78('0x1a')](function(_0x2b60f3){logger[_0x1d78('0x15')](_0x1d78('0x17'),_0x3e122c,_0x2b60f3);_0x40d1a4(_0x2b60f3);});});}exports[_0x1d78('0x1b')]=function(_0x40ed10){var _0x35ee7e=this;return new Promise(function(_0x4eb80e,_0x4e8981){return db[_0x1d78('0x1c')][_0x1d78('0x1d')](_0x40ed10[_0x1d78('0x1e')],{'raw':_0x40ed10[_0x1d78('0x1f')]?_0x40ed10[_0x1d78('0x1f')][_0x1d78('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40ed10['options']?_0x40ed10[_0x1d78('0x1f')][_0x1d78('0x21')]||null:null,'attributes':_0x40ed10[_0x1d78('0x1f')]?_0x40ed10[_0x1d78('0x1f')]['attributes']||null:null,'limit':_0x40ed10['options']?_0x40ed10['options'][_0x1d78('0x22')]||null:null})[_0x1d78('0xf')](function(_0xadbbe2){logger[_0x1d78('0x10')](_0x1d78('0x1b'),_0x40ed10);logger[_0x1d78('0x12')](_0x1d78('0x1b'),_0x40ed10,JSON[_0x1d78('0x14')](_0xadbbe2));_0x4eb80e(_0xadbbe2);})[_0x1d78('0x1a')](function(_0x7d2e53){logger[_0x1d78('0x15')](_0x1d78('0x1b'),_0x7d2e53[_0x1d78('0x18')],_0x40ed10);_0x4e8981(_0x35ee7e[_0x1d78('0x15')](0x1f4,_0x7d2e53[_0x1d78('0x18')]));});});};exports[_0x1d78('0x23')]=function(_0x27837d){return new Promise(function(_0x48178b,_0x2400d2){return db[_0x1d78('0x1c')][_0x1d78('0x24')]({'where':_0x27837d[_0x1d78('0x1f')]?_0x27837d['options'][_0x1d78('0x21')]||null:null})[_0x1d78('0xf')](function(_0x590d6f){if(_0x590d6f){return _0x590d6f[_0x1d78('0x25')](_0x27837d[_0x1d78('0x1e')][_0x1d78('0x26')],_[_0x1d78('0x27')](_0x27837d[_0x1d78('0x1e')],[_0x1d78('0x26'),'id'])||{});}})['spread'](function(_0x160b2a){logger[_0x1d78('0x10')]('AddTags',_0x27837d);logger[_0x1d78('0x12')](_0x1d78('0x28'),_0x27837d,JSON[_0x1d78('0x14')](_0x160b2a));_0x48178b(_0x160b2a);})[_0x1d78('0x1a')](function(_0x53cf5d){logger[_0x1d78('0x15')](_0x1d78('0x28'),_0x53cf5d[_0x1d78('0x18')],_0x27837d);_0x2400d2(_this[_0x1d78('0x15')](0x1f4,_0x53cf5d[_0x1d78('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index ea51661..2869824 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 _0x0412=['emit','removeListener','register','mailInteraction:','update'];(function(_0x2c18e7,_0x23ef98){var _0x46d642=function(_0x2a84cf){while(--_0x2a84cf){_0x2c18e7['push'](_0x2c18e7['shift']());}};_0x46d642(++_0x23ef98);}(_0x0412,0x194));var _0x2041=function(_0x5fd03,_0x135420){_0x5fd03=_0x5fd03-0x0;var _0x10d3fd=_0x0412[_0x5fd03];return _0x10d3fd;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=['save','remove',_0x2041('0x0')];function createListener(_0x5ae2c7,_0x740cc5){return function(_0x360341){_0x740cc5[_0x2041('0x1')](_0x5ae2c7,_0x360341);};}function removeListener(_0x293237,_0x17cbd0){return function(){MailInteractionEvents[_0x2041('0x2')](_0x293237,_0x17cbd0);};}exports[_0x2041('0x3')]=function(_0x496747){for(var _0x5238b0=0x0,_0x4411ea=events['length'];_0x5238b0<_0x4411ea;_0x5238b0++){var _0x42330d=events[_0x5238b0];var _0x57e21d=createListener(_0x2041('0x4')+_0x42330d,_0x496747);MailInteractionEvents['on'](_0x42330d,_0x57e21d);}}; \ No newline at end of file +var _0x88bf=['update','removeListener','mailInteraction:','./mailInteraction.events'];(function(_0x33cc84,_0x2c740e){var _0x14ff1a=function(_0xe2c4aa){while(--_0xe2c4aa){_0x33cc84['push'](_0x33cc84['shift']());}};_0x14ff1a(++_0x2c740e);}(_0x88bf,0x1ef));var _0xf88b=function(_0x154983,_0xc29edf){_0x154983=_0x154983-0x0;var _0x3d1243=_0x88bf[_0x154983];return _0x3d1243;};'use strict';var MailInteractionEvents=require(_0xf88b('0x0'));var events=['save','remove',_0xf88b('0x1')];function createListener(_0x4d2a6d,_0xcafa1a){return function(_0x5951d3){_0xcafa1a['emit'](_0x4d2a6d,_0x5951d3);};}function removeListener(_0x3c265b,_0x106e6b){return function(){MailInteractionEvents[_0xf88b('0x2')](_0x3c265b,_0x106e6b);};}exports['register']=function(_0x31bc02){for(var _0x2bd95c=0x0,_0x512d04=events['length'];_0x2bd95c<_0x512d04;_0x2bd95c++){var _0x65f54=events[_0x2bd95c];var _0x44e4b8=createListener(_0xf88b('0x3')+_0x65f54,_0x31bc02);MailInteractionEvents['on'](_0x65f54,_0x44e4b8);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 3a6c3c1..5b4b231 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 _0x38dc=['/describe','/:id','show','/:id/download','download','post','tracked','mailmessage:create','put','/:id/accept','accept','/:id/reject','reject','destroy','exports','path','connect-timeout','../../components/auth/service','../../config/environment','get','isAuthenticated','index'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x38dc,0x117));var _0xc38d=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x38dc[_0x4b369d];return _0x571a98;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc38d('0x0'));var timeout=require(_0xc38d('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc38d('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xc38d('0x3'));var controller=require('./mailMessage.controller');router[_0xc38d('0x4')]('/',auth[_0xc38d('0x5')](),controller[_0xc38d('0x6')]);router[_0xc38d('0x4')](_0xc38d('0x7'),auth[_0xc38d('0x5')](),controller['describe']);router[_0xc38d('0x4')](_0xc38d('0x8'),auth[_0xc38d('0x5')](),controller[_0xc38d('0x9')]);router[_0xc38d('0x4')](_0xc38d('0xa'),auth[_0xc38d('0x5')](),controller[_0xc38d('0xb')]);router[_0xc38d('0xc')]('/',auth['isAuthenticated'](),interaction[_0xc38d('0xd')]('mail',_0xc38d('0xe')),controller['create']);router[_0xc38d('0xf')](_0xc38d('0x8'),auth['isAuthenticated'](),controller['update']);router['put'](_0xc38d('0x10'),auth[_0xc38d('0x5')](),controller[_0xc38d('0x11')]);router[_0xc38d('0xf')](_0xc38d('0x12'),auth[_0xc38d('0x5')](),controller[_0xc38d('0x13')]);router['delete'](_0xc38d('0x8'),auth['isAuthenticated'](),controller[_0xc38d('0x14')]);module[_0xc38d('0x15')]=router; \ No newline at end of file +var _0x4517=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/download','download','post','tracked','create','put','/:id/accept','accept','/:id/reject','delete','util'];(function(_0x4d70e9,_0x14c9dc){var _0x5e1b23=function(_0x37c1e5){while(--_0x37c1e5){_0x4d70e9['push'](_0x4d70e9['shift']());}};_0x5e1b23(++_0x14c9dc);}(_0x4517,0x112));var _0x7451=function(_0x262b8a,_0x1c410a){_0x262b8a=_0x262b8a-0x0;var _0x4f8a8f=_0x4517[_0x262b8a];return _0x4f8a8f;};'use strict';var multer=require('multer');var util=require(_0x7451('0x0'));var path=require(_0x7451('0x1'));var timeout=require('connect-timeout');var express=require(_0x7451('0x2'));var router=express[_0x7451('0x3')]();var fs_extra=require(_0x7451('0x4'));var auth=require(_0x7451('0x5'));var interaction=require(_0x7451('0x6'));var config=require(_0x7451('0x7'));var controller=require(_0x7451('0x8'));router[_0x7451('0x9')]('/',auth[_0x7451('0xa')](),controller[_0x7451('0xb')]);router[_0x7451('0x9')](_0x7451('0xc'),auth[_0x7451('0xa')](),controller[_0x7451('0xd')]);router[_0x7451('0x9')](_0x7451('0xe'),auth[_0x7451('0xa')](),controller['show']);router[_0x7451('0x9')](_0x7451('0xf'),auth[_0x7451('0xa')](),controller[_0x7451('0x10')]);router[_0x7451('0x11')]('/',auth[_0x7451('0xa')](),interaction[_0x7451('0x12')]('mail','mailmessage:create'),controller[_0x7451('0x13')]);router['put'](_0x7451('0xe'),auth[_0x7451('0xa')](),controller['update']);router[_0x7451('0x14')](_0x7451('0x15'),auth['isAuthenticated'](),controller[_0x7451('0x16')]);router[_0x7451('0x14')](_0x7451('0x17'),auth[_0x7451('0xa')](),controller['reject']);router[_0x7451('0x18')](_0x7451('0xe'),auth[_0x7451('0xa')](),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 acd1c1d..cc1f6b1 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 _0xe949=['long','medium','ENUM','out','STRING','DATE','INTEGER','BOOLEAN','Email','Chat','sequelize','lodash','exports','TEXT'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0xe949,0x1a0));var _0x9e94=function(_0x5ddaf6,_0x3886a6){_0x5ddaf6=_0x5ddaf6-0x0;var _0x32e592=_0xe949[_0x5ddaf6];return _0x32e592;};'use strict';var Sequelize=require(_0x9e94('0x0'));var _=require(_0x9e94('0x1'));module[_0x9e94('0x2')]={'body':{'type':Sequelize[_0x9e94('0x3')](_0x9e94('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x9e94('0x3')](_0x9e94('0x5'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x9e94('0x6')]('in',_0x9e94('0x7')),'defaultValue':_0x9e94('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x9e94('0x8')](0x1fe)},'from':{'type':Sequelize[_0x9e94('0x8')]},'to':{'type':Sequelize[_0x9e94('0x3')](_0x9e94('0x4'))},'cc':{'type':Sequelize['TEXT'](_0x9e94('0x4'))},'bcc':{'type':Sequelize[_0x9e94('0x3')](_0x9e94('0x4'))},'subject':{'type':Sequelize[_0x9e94('0x3')]},'sentAt':{'type':Sequelize[_0x9e94('0x9')]},'attach':{'type':Sequelize[_0x9e94('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x9e94('0xb')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x9e94('0x3')](_0x9e94('0x4'))},'originCc':{'type':Sequelize[_0x9e94('0x3')](_0x9e94('0x4'))},'originChannel':{'type':Sequelize[_0x9e94('0x6')](_0x9e94('0xc'),_0x9e94('0xd')),'defaultValue':_0x9e94('0xc'),'allowNull':![]}}; \ No newline at end of file +var _0x1bee=['DATE','INTEGER','Email','Chat','lodash','TEXT','medium','BOOLEAN','ENUM','out','STRING','long'];(function(_0x53c264,_0x5253d9){var _0x5d718f=function(_0x52f907){while(--_0x52f907){_0x53c264['push'](_0x53c264['shift']());}};_0x5d718f(++_0x5253d9);}(_0x1bee,0xac));var _0xe1be=function(_0x158d09,_0x53f5a8){_0x158d09=_0x158d09-0x0;var _0x738525=_0x1bee[_0x158d09];return _0x738525;};'use strict';var Sequelize=require('sequelize');var _=require(_0xe1be('0x0'));module['exports']={'body':{'type':Sequelize[_0xe1be('0x1')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xe1be('0x1')](_0xe1be('0x2'))},'read':{'type':Sequelize[_0xe1be('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe1be('0x4')]('in',_0xe1be('0x5')),'defaultValue':_0xe1be('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xe1be('0x6')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xe1be('0x1')]('long')},'cc':{'type':Sequelize[_0xe1be('0x1')]('long')},'bcc':{'type':Sequelize['TEXT'](_0xe1be('0x7'))},'subject':{'type':Sequelize[_0xe1be('0x1')]},'sentAt':{'type':Sequelize[_0xe1be('0x8')]},'attach':{'type':Sequelize[_0xe1be('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xe1be('0x3')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0xe1be('0x1')](_0xe1be('0x7'))},'originCc':{'type':Sequelize['TEXT'](_0xe1be('0x7'))},'originChannel':{'type':Sequelize[_0xe1be('0x4')](_0xe1be('0xa'),_0xe1be('0xb')),'defaultValue':_0xe1be('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 20c64b5..02ee767 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 _0xe70a=['agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','email','manual','interface','SIP/%s','channel','motionChannel','event','accept','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','internal','rejectmessage','download','toString','server','files','tmp','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','basename','existsSync','push','writeFileSync','unlinkSync','eml-format','bluebird','util','path','lodash','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','html-entities','./mailMessage.socket','register','client','http','request','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailMessage,\x20%s,\x20%s','info','result','catch','status','json','offset','undefined','count','limit','Content-Range','then','destroy','end','sendStatus','name','index','map','MailMessage','rawAttributes','fieldName','type','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','model','length','find','body','describe','create','direction','out','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','DESC','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','SendMail','sendMail','update','YYYY-MM-DD\x20HH:mm:ss','mail','readAt','format','UserId','user'];(function(_0x4f0f36,_0x47775c){var _0x1078b0=function(_0x294c48){while(--_0x294c48){_0x4f0f36['push'](_0x4f0f36['shift']());}};_0x1078b0(++_0x47775c);}(_0xe70a,0x16d));var _0xae70=function(_0xb5f90d,_0x4392d3){_0xb5f90d=_0xb5f90d-0x0;var _0x14298a=_0xe70a[_0xb5f90d];return _0x14298a;};'use strict';var emlformat=require(_0xae70('0x0'));var moment=require('moment');var BPromise=require(_0xae70('0x1'));var util=require(_0xae70('0x2'));var path=require(_0xae70('0x3'));var fs=require('fs');var _=require(_0xae70('0x4'));var Redis=require('ioredis');var htmlToText=require('html-to-text');var qs=require(_0xae70('0x5'));var logger=require(_0xae70('0x6'))(_0xae70('0x7'));var interaction_log=require(_0xae70('0x6'))(_0xae70('0x8'));var config=require(_0xae70('0x9'));var db=require(_0xae70('0xa'))['db'];config[_0xae70('0xb')]=_[_0xae70('0xc')](config[_0xae70('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xae70('0xd'))(new Redis(config['redis']));var htmlEntities=require(_0xae70('0xe'));require(_0xae70('0xf'))[_0xae70('0x10')](socket);var jayson=require('jayson/promise');var client=jayson[_0xae70('0x11')][_0xae70('0x12')]({'port':0x232c});var client9003=jayson[_0xae70('0x11')][_0xae70('0x12')]({'port':0x232b});var client9002=jayson[_0xae70('0x11')][_0xae70('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x452e92,_0x295473,_0x27bbdc,_0x414661){return new BPromise(function(_0x18c63b,_0x14cffe){var _0x204e88=_0x414661||client;return _0x204e88[_0xae70('0x13')](_0x452e92,_0x27bbdc)['then'](function(_0x176df7){logger['info']('MailMessage,\x20%s,\x20%s',_0x295473,_0xae70('0x14'));logger[_0xae70('0x15')](_0xae70('0x16'),_0x295473,_0xae70('0x14'),JSON[_0xae70('0x17')](_0x176df7));if(_0x176df7[_0xae70('0x18')]){if(_0x176df7[_0xae70('0x18')][_0xae70('0x19')]===0x1f4){logger[_0xae70('0x18')]('MailMessage,\x20%s,\x20%s',_0x295473,_0x176df7[_0xae70('0x18')][_0xae70('0x1a')]);return _0x14cffe(_0x176df7[_0xae70('0x18')]['message']);}logger[_0xae70('0x18')](_0xae70('0x1b'),_0x295473,_0x176df7['error']['message']);return _0x18c63b(_0x176df7[_0xae70('0x18')][_0xae70('0x1a')]);}else{logger[_0xae70('0x1c')](_0xae70('0x1b'),_0x295473,_0xae70('0x14'));_0x18c63b(_0x176df7[_0xae70('0x1d')]['message']);}})[_0xae70('0x1e')](function(_0x3db8ef){logger[_0xae70('0x18')](_0xae70('0x1b'),_0x295473,_0x3db8ef);_0x14cffe(_0x3db8ef);});});}function respondWithResult(_0x12bc30,_0x33a901){_0x33a901=_0x33a901||0xc8;return function(_0x2c0020){if(_0x2c0020){return _0x12bc30[_0xae70('0x1f')](_0x33a901)[_0xae70('0x20')](_0x2c0020);}};}function respondWithFilteredResult(_0x815814,_0x5c80ef){return function(_0x359456){if(_0x359456){var _0x6c53c2=typeof _0x5c80ef[_0xae70('0x21')]===_0xae70('0x22')&&typeof _0x5c80ef['limit']==='undefined';var _0x87bdb7=_0x359456[_0xae70('0x23')];var _0x58af37=_0x6c53c2?0x0:_0x5c80ef[_0xae70('0x21')];var _0x38f9a4=_0x6c53c2?_0x359456['count']:_0x5c80ef[_0xae70('0x21')]+_0x5c80ef[_0xae70('0x24')];var _0x1cd2e0;if(_0x38f9a4>=_0x87bdb7){_0x38f9a4=_0x87bdb7;_0x1cd2e0=0xc8;}else{_0x1cd2e0=0xce;}_0x815814[_0xae70('0x1f')](_0x1cd2e0);return _0x815814['set'](_0xae70('0x25'),_0x58af37+'-'+_0x38f9a4+'/'+_0x87bdb7)['json'](_0x359456);}return null;};}function saveUpdates(_0xabaa0f){return function(_0x1cf52a){if(_0x1cf52a){return _0x1cf52a['update'](_0xabaa0f)[_0xae70('0x26')](function(_0x228827){return _0x228827;});}return null;};}function removeEntity(_0x4b8229){return function(_0x50d2d7){if(_0x50d2d7){return _0x50d2d7[_0xae70('0x27')]()[_0xae70('0x26')](function(){_0x4b8229[_0xae70('0x1f')](0xcc)[_0xae70('0x28')]();});}};}function handleEntityNotFound(_0x23d61f){return function(_0x3ce7a0){if(!_0x3ce7a0){_0x23d61f[_0xae70('0x29')](0x194);}return _0x3ce7a0;};}function handleError(_0x59997d,_0x518bbf){_0x518bbf=_0x518bbf||0x1f4;return function(_0x2f4b4e){logger[_0xae70('0x18')](_0x2f4b4e['stack']);if(_0x2f4b4e[_0xae70('0x2a')]){delete _0x2f4b4e[_0xae70('0x2a')];}_0x59997d[_0xae70('0x1f')](_0x518bbf)['send'](_0x2f4b4e);};}exports[_0xae70('0x2b')]=function(_0x2bccce,_0x38e20b){var _0xa23b44={},_0x4bf351={},_0x1163c1={'count':0x0,'rows':[]};var _0x4a79db=_[_0xae70('0x2c')](db[_0xae70('0x2d')][_0xae70('0x2e')],function(_0x1025fd){return{'name':_0x1025fd[_0xae70('0x2f')],'type':_0x1025fd[_0xae70('0x30')]['key']};});_0x4bf351['model']=_[_0xae70('0x2c')](_0x4a79db,_0xae70('0x2a'));_0x4bf351[_0xae70('0x31')]=_[_0xae70('0x32')](_0x2bccce[_0xae70('0x31')]);_0x4bf351['filters']=_[_0xae70('0x33')](_0x4bf351['model'],_0x4bf351[_0xae70('0x31')]);_0xa23b44[_0xae70('0x34')]=_['intersection'](_0x4bf351['model'],qs[_0xae70('0x35')](_0x2bccce[_0xae70('0x31')][_0xae70('0x35')]));_0xa23b44[_0xae70('0x34')]=_0xa23b44[_0xae70('0x34')]['length']?_0xa23b44[_0xae70('0x34')]:_0x4bf351['model'];if(!_0x2bccce[_0xae70('0x31')][_0xae70('0x36')](_0xae70('0x37'))){_0xa23b44[_0xae70('0x24')]=qs[_0xae70('0x24')](_0x2bccce['query'][_0xae70('0x24')]);_0xa23b44[_0xae70('0x21')]=qs[_0xae70('0x21')](_0x2bccce[_0xae70('0x31')][_0xae70('0x21')]);}_0xa23b44[_0xae70('0x38')]=qs[_0xae70('0x39')](_0x2bccce[_0xae70('0x31')]['sort']);_0xa23b44[_0xae70('0x3a')]=qs[_0xae70('0x3b')](_[_0xae70('0x3c')](_0x2bccce['query'],_0x4bf351[_0xae70('0x3b')]),_0x4a79db);if(_0x2bccce[_0xae70('0x31')][_0xae70('0x3d')]){_0xa23b44[_0xae70('0x3a')]=_[_0xae70('0x3e')](_0xa23b44['where'],{'$or':_[_0xae70('0x2c')](_0x4a79db,function(_0x59997a){if(_0x59997a[_0xae70('0x30')]!==_0xae70('0x3f')){var _0x2b26f6={};_0x2b26f6[_0x59997a[_0xae70('0x2a')]]={'$like':'%'+_0x2bccce[_0xae70('0x31')][_0xae70('0x3d')]+'%'};return _0x2b26f6;}})});}_0xa23b44=_[_0xae70('0x3e')]({},_0xa23b44,_0x2bccce[_0xae70('0x40')]);var _0x5eef1d={'where':_0xa23b44[_0xae70('0x3a')]};return db[_0xae70('0x2d')][_0xae70('0x23')](_0x5eef1d)[_0xae70('0x26')](function(_0x1f748c){_0x1163c1['count']=_0x1f748c;if(_0x2bccce[_0xae70('0x31')][_0xae70('0x41')]){_0xa23b44[_0xae70('0x42')]=[{'all':!![]}];}return db[_0xae70('0x2d')][_0xae70('0x43')](_0xa23b44);})[_0xae70('0x26')](function(_0x33a3fc){_0x1163c1[_0xae70('0x44')]=_0x33a3fc;return _0x1163c1;})[_0xae70('0x26')](respondWithFilteredResult(_0x38e20b,_0xa23b44))[_0xae70('0x1e')](handleError(_0x38e20b,null));};exports['show']=function(_0x49a907,_0x217c2b){var _0x334b93={'raw':!![],'where':{'id':_0x49a907[_0xae70('0x45')]['id']}},_0x59d086={};_0x59d086[_0xae70('0x46')]=_[_0xae70('0x32')](db['MailMessage'][_0xae70('0x2e')]);_0x59d086[_0xae70('0x31')]=_[_0xae70('0x32')](_0x49a907[_0xae70('0x31')]);_0x59d086[_0xae70('0x3b')]=_[_0xae70('0x33')](_0x59d086['model'],_0x59d086[_0xae70('0x31')]);_0x334b93[_0xae70('0x34')]=_[_0xae70('0x33')](_0x59d086[_0xae70('0x46')],qs[_0xae70('0x35')](_0x49a907[_0xae70('0x31')]['fields']));_0x334b93[_0xae70('0x34')]=_0x334b93[_0xae70('0x34')][_0xae70('0x47')]?_0x334b93['attributes']:_0x59d086['model'];if(_0x49a907[_0xae70('0x31')][_0xae70('0x41')]){_0x334b93['include']=[{'all':!![]}];}_0x334b93=_['merge']({},_0x334b93,_0x49a907[_0xae70('0x40')]);return db[_0xae70('0x2d')][_0xae70('0x48')](_0x334b93)['then'](handleEntityNotFound(_0x217c2b,null))['then'](respondWithResult(_0x217c2b,null))[_0xae70('0x1e')](handleError(_0x217c2b,null));};exports['update']=function(_0x535090,_0x42f3ac){if(_0x535090['body']['id']){delete _0x535090[_0xae70('0x49')]['id'];}return db['MailMessage'][_0xae70('0x48')]({'where':{'id':_0x535090[_0xae70('0x45')]['id']}})[_0xae70('0x26')](handleEntityNotFound(_0x42f3ac,null))[_0xae70('0x26')](saveUpdates(_0x535090['body'],null))[_0xae70('0x26')](respondWithResult(_0x42f3ac,null))[_0xae70('0x1e')](handleError(_0x42f3ac,null));};exports[_0xae70('0x27')]=function(_0x4d6deb,_0x350c31){return db[_0xae70('0x2d')]['find']({'where':{'id':_0x4d6deb[_0xae70('0x45')]['id']}})[_0xae70('0x26')](handleEntityNotFound(_0x350c31,null))[_0xae70('0x26')](removeEntity(_0x350c31,null))['catch'](handleError(_0x350c31,null));};exports[_0xae70('0x4a')]=function(_0x48c088,_0x2dd7bc){return db[_0xae70('0x2d')]['describe']()[_0xae70('0x26')](respondWithResult(_0x2dd7bc,null))['catch'](handleError(_0x2dd7bc,null));};exports[_0xae70('0x4b')]=function(_0x344906,_0x4558a0){return db[_0xae70('0x2d')][_0xae70('0x4b')](_0x344906[_0xae70('0x49')])[_0xae70('0x26')](function(_0xd4b7a5){if(_0xd4b7a5){if(_0xd4b7a5[_0xae70('0x4c')]===_0xae70('0x4d')&&!_0xd4b7a5['secret']){var _0x29b1de,_0x24e86a,_0x548bf3;if(_0x344906[_0xae70('0x49')]['to']){_0x24e86a=_0x344906[_0xae70('0x49')]['to'][_0xae70('0x4e')](',')[0x0];}return db[_0xae70('0x4f')][_0xae70('0x50')]({'where':{'id':_0xd4b7a5[_0xae70('0x51')]},'include':[{'model':db[_0xae70('0x52')],'as':_0xae70('0x53'),'include':[{'model':db[_0xae70('0x54')],'as':_0xae70('0x55'),'where':{'email':_0x24e86a},'limit':0x1,'order':[['updatedAt',_0xae70('0x56')]]}]},{'model':db['MailServerOut'],'as':_0xae70('0x57'),'raw':!![],'include':[{'model':db[_0xae70('0x58')],'as':'CloudProvider','raw':!![]}]}]})[_0xae70('0x26')](function(_0x10ec9d){_0x29b1de=_0x10ec9d;if(!_0x29b1de||!_0x29b1de[_0xae70('0x57')])return;var _0x9f2f0=_0x29b1de[_0xae70('0x59')]();if(_0x344906[_0xae70('0x49')][_0xae70('0x5a')]&&_0x344906[_0xae70('0x49')][_0xae70('0x5a')][_0xae70('0x47')]){for(var _0xe3f0fe=0x0;_0xe3f0fe<_0x344906[_0xae70('0x49')]['attachments'][_0xae70('0x47')];_0xe3f0fe+=0x1){_0x344906[_0xae70('0x49')][_0xae70('0x5a')][_0xe3f0fe]={'filename':_0x344906['body'][_0xae70('0x5a')][_0xe3f0fe]['name'],'path':path[_0xae70('0x5b')](config[_0xae70('0x5c')],_0xae70('0x5d'),_0x344906[_0xae70('0x49')][_0xae70('0x5a')][_0xe3f0fe]['basename'])};}}_0x548bf3={'account':_0x9f2f0,'message':_0x344906[_0xae70('0x49')]};return;})['then'](function(){if(_0x29b1de['List']){if(_0x29b1de[_0xae70('0x53')][_0xae70('0x55')]['length']){return _0x29b1de['List'][_0xae70('0x55')][0x0];}else{return db[_0xae70('0x54')][_0xae70('0x4b')](_[_0xae70('0xc')](_0x344906[_0xae70('0x49')],{'firstName':_0x344906[_0xae70('0x49')]['to'],'email':_0x344906[_0xae70('0x49')]['to'],'phone':_0x344906['body']['to'],'ListId':_0x29b1de['ListId']}));}}else{throw new Error('List\x20not\x20found');}})[_0xae70('0x26')](function(){if(_0x548bf3){return respondWithRpcPromise(_0xae70('0x5e'),_0xae70('0x5f'),_0x548bf3,client9003)[_0xae70('0x26')](function(_0xe0e3c6){return _0xd4b7a5[_0xae70('0x60')]({'read':!![],'messageId':_0xe0e3c6['messageId'],'sentAt':moment()['format'](_0xae70('0x61'))});})[_0xae70('0x1e')](function(_0x4760c1){logger[_0xae70('0x18')]('%s',JSON['stringify'](_0x4760c1));return _0xd4b7a5;});}return _0xd4b7a5;});}return _0xd4b7a5;}})[_0xae70('0x26')](respondWithResult(_0x4558a0,0xc9))[_0xae70('0x1e')](handleError(_0x4558a0,null));};exports['accept']=function(_0x3d18af,_0x1f3334){var _0x981a0d={'agent':{},'channel':_0xae70('0x62')};if(_0x3d18af[_0xae70('0x49')]['id']){delete _0x3d18af[_0xae70('0x49')]['id'];}_0x3d18af[_0xae70('0x49')]['read']=!![];_0x3d18af[_0xae70('0x49')][_0xae70('0x63')]=moment()[_0xae70('0x64')](_0xae70('0x61'));_0x3d18af[_0xae70('0x49')][_0xae70('0x65')]=_0x3d18af[_0xae70('0x49')][_0xae70('0x65')]||_0x3d18af[_0xae70('0x66')]['id'];_0x981a0d[_0xae70('0x67')]['id']=_0x3d18af[_0xae70('0x49')][_0xae70('0x65')];return db['MailMessage']['find']({'where':{'id':_0x3d18af[_0xae70('0x45')]['id'],'UserId':null}})[_0xae70('0x26')](handleEntityNotFound(_0x1f3334,null))[_0xae70('0x26')](saveUpdates(_0x3d18af[_0xae70('0x49')],null))['then'](function(_0xf38801){if(_0xf38801){_0x981a0d[_0xae70('0x1a')]=_0xf38801[_0xae70('0x68')]({'plain':!![]});return db[_0xae70('0x69')][_0xae70('0x48')]({'where':{'id':_0xf38801[_0xae70('0x6a')]}});}return null;})[_0xae70('0x26')](handleEntityNotFound(_0x1f3334,null))[_0xae70('0x26')](function(_0x2803ad){if(_0x2803ad){return _0x2803ad['update']({'UserId':_0x3d18af[_0xae70('0x49')][_0xae70('0x65')],'read1stAt':_[_0xae70('0x6b')](_0x2803ad[_0xae70('0x6c')])?moment()['format'](_0xae70('0x61')):undefined});}return null;})['then'](function(_0x53fd5f){if(_0x53fd5f){_0x981a0d[_0xae70('0x6d')]=_0x53fd5f[_0xae70('0x68')]({'plain':!![]});interaction_log[_0xae70('0x1c')](_0xae70('0x6e'),_0x3d18af[_0xae70('0x66')]['id'],_0x3d18af[_0xae70('0x66')][_0xae70('0x2a')],_0x3d18af[_0xae70('0x66')][_0xae70('0x6f')],_0x981a0d['interaction']['id'],_0x3d18af['body']?JSON[_0xae70('0x17')](_0x3d18af['body']):'null');return respondWithRpcPromise(_0xae70('0x70'),'acceptMessage',_0x981a0d);}return null;})[_0xae70('0x26')](function(_0x5b9d77){var _0x10b914=_0xae70('0x71')+_0x5b9d77[_0xae70('0x1a')][_0xae70('0x72')];return db[_0xae70('0x73')][_0xae70('0x31')](_0x10b914,{'type':db[_0xae70('0x74')][_0xae70('0x75')][_0xae70('0x76')],'raw':!![]})[_0xae70('0x26')](function(_0x21a0b9){return _0x21a0b9;});})[_0xae70('0x26')](function(_0x407bcf){if(_0x407bcf){_0x981a0d[_0xae70('0x1a')][_0xae70('0x77')]=_0x407bcf[0x0];if(!_0x3d18af['body'][_0xae70('0x65')])return;return db[_0xae70('0x78')][_0xae70('0x48')]({'where':{'id':_0x3d18af[_0xae70('0x49')][_0xae70('0x65')],'role':_0xae70('0x67')},'attributes':['id',_0xae70('0x2a'),'fullname',_0xae70('0x79'),'internal'],'raw':!![]});}return null;})[_0xae70('0x26')](function(_0x558fab){if(!_0x558fab)return null;_0x981a0d['message'][_0xae70('0x67')]=_0x558fab;return _0x981a0d;})['then'](function(_0x4abfd2){if(_0x4abfd2){if(_0x3d18af['body'][_0xae70('0x7a')]){_0x981a0d[_0xae70('0x1a')][_0xae70('0x7b')]=util[_0xae70('0x64')](_0xae70('0x7c'),_0x3d18af[_0xae70('0x66')]['name']);_0x981a0d['message'][_0xae70('0x7d')]=_0x981a0d[_0xae70('0x7d')];_0x981a0d['message'][_0xae70('0x7e')]=_0x981a0d[_0xae70('0x7d')];_0x981a0d[_0xae70('0x1a')][_0xae70('0x7f')]=_0xae70('0x80');_0x981a0d[_0xae70('0x1a')][_0xae70('0x49')]=htmlToText[_0xae70('0x81')](_0x981a0d[_0xae70('0x1a')]['body']);return respondWithRpcPromise(_0xae70('0x82'),_0xae70('0x82'),{'event':_0xae70('0x83'),'message':_0x981a0d[_0xae70('0x1a')]},client9002)[_0xae70('0x26')](function(){return _0x981a0d;});}return _0x981a0d;}return null;})[_0xae70('0x26')](respondWithResult(_0x1f3334,null))[_0xae70('0x1e')](handleError(_0x1f3334,null));};exports[_0xae70('0x84')]=function(_0x42a53d,_0x289e7a){var _0x21d47f={'agent':{},'channel':'mail'};if(_0x42a53d['body']['id']){delete _0x42a53d[_0xae70('0x49')]['id'];}_0x42a53d[_0xae70('0x49')]['UserId']=_0x42a53d[_0xae70('0x49')][_0xae70('0x65')]||_0x42a53d[_0xae70('0x66')]['id'];_0x21d47f['agent']['id']=_0x42a53d[_0xae70('0x49')]['UserId'];return db['MailMessage'][_0xae70('0x48')]({'where':{'id':_0x42a53d['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x289e7a,null))['then'](function(_0x2ad1f8){if(_0x2ad1f8){_0x21d47f['message']=_0x2ad1f8[_0xae70('0x68')]({'plain':!![]});return db[_0xae70('0x69')][_0xae70('0x48')]({'where':{'id':_0x2ad1f8[_0xae70('0x6a')]}});}return null;})[_0xae70('0x26')](handleEntityNotFound(_0x289e7a,null))[_0xae70('0x26')](function(_0x321503){if(_0x321503){_0x21d47f[_0xae70('0x6d')]=_0x321503[_0xae70('0x68')]({'plain':!![]});interaction_log[_0xae70('0x1c')](_0xae70('0x85'),_0x42a53d[_0xae70('0x66')]['id'],_0x42a53d['user'][_0xae70('0x2a')],_0x42a53d[_0xae70('0x66')][_0xae70('0x6f')],_0x21d47f[_0xae70('0x6d')]['id'],_0x42a53d[_0xae70('0x49')]?JSON['stringify'](_0x42a53d[_0xae70('0x49')]):_0xae70('0x86'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x21d47f);}return null;})[_0xae70('0x26')](function(_0x4487df){var _0x15ad7c=_0xae70('0x71')+_0x4487df[_0xae70('0x1a')][_0xae70('0x72')];return db['sequelize'][_0xae70('0x31')](_0x15ad7c,{'type':db[_0xae70('0x74')][_0xae70('0x75')]['SELECT'],'raw':!![]})[_0xae70('0x26')](function(_0x22de5c){return _0x22de5c;});})['then'](function(_0x5ea18e){if(_0x5ea18e){_0x21d47f[_0xae70('0x1a')][_0xae70('0x77')]=_0x5ea18e[0x0];if(!_0x42a53d[_0xae70('0x49')]['UserId'])return;return db[_0xae70('0x78')][_0xae70('0x48')]({'where':{'id':_0x42a53d[_0xae70('0x49')][_0xae70('0x65')],'role':'agent'},'attributes':['id',_0xae70('0x2a'),'fullname','email',_0xae70('0x87')],'raw':!![]});}return null;})[_0xae70('0x26')](function(_0x13c49c){if(!_0x13c49c)return null;_0x21d47f['message'][_0xae70('0x67')]=_0x13c49c;return _0x21d47f;})[_0xae70('0x26')](function(_0x89767e){if(_0x89767e){_0x89767e[_0xae70('0x1a')][_0xae70('0x7b')]=util[_0xae70('0x64')](_0xae70('0x7c'),_0x42a53d[_0xae70('0x66')][_0xae70('0x2a')]);_0x89767e[_0xae70('0x1a')][_0xae70('0x7d')]=_0x21d47f[_0xae70('0x7d')];_0x89767e[_0xae70('0x1a')]['motionChannel']=_0x21d47f['channel'];_0x89767e[_0xae70('0x1a')][_0xae70('0x7f')]='reject';_0x89767e['message']['body']=htmlToText[_0xae70('0x81')](_0x21d47f[_0xae70('0x1a')][_0xae70('0x49')]);respondWithRpcPromise(_0xae70('0x82'),'EventManager',{'event':_0xae70('0x88'),'message':_0x89767e[_0xae70('0x1a')]},client9002);return _0x21d47f;}return null;})[_0xae70('0x26')](respondWithResult(_0x289e7a,null))[_0xae70('0x1e')](handleError(_0x289e7a,null));};exports[_0xae70('0x89')]=function(_0xe8bbfe,_0x124b26){var _0x496f39=moment()['unix']()[_0xae70('0x8a')]();var _0x315afe=path[_0xae70('0x5b')](config[_0xae70('0x5c')],_0xae70('0x8b'),_0xae70('0x8c'),_0xae70('0x8d'));var _0x253716=path['join'](config['root'],'server',_0xae70('0x8c'),'attachments');var _0x595c35=util[_0xae70('0x64')](_0xae70('0x8e'),_0x496f39);return db[_0xae70('0x2d')][_0xae70('0x48')]({'where':{'id':_0xe8bbfe['params']['id']},'attributes':['id',_0xae70('0x49'),_0xae70('0x8f'),'to','cc',_0xae70('0x90'),_0xae70('0x91'),_0xae70('0x92')],'include':_0xe8bbfe[_0xae70('0x31')][_0xae70('0x5a')]?[{'model':db[_0xae70('0x93')],'as':_0xae70('0x94')}]:undefined})['then'](handleEntityNotFound(_0x124b26,null))[_0xae70('0x26')](function(_0x18b897){if(_0x18b897){var _0x44cbd1=_0x18b897;var _0x2bdac1={'from':_0x44cbd1[_0xae70('0x8f')],'to':_0x44cbd1['to'],'subject':_0x44cbd1[_0xae70('0x91')],'html':htmlEntities['decode'](_0x44cbd1[_0xae70('0x49')]),'headers':{'Date':moment(_0x44cbd1[_0xae70('0x92')])[_0xae70('0x64')](_0xae70('0x95'))},'attachments':[]};if(_0x18b897['cc']){_0x2bdac1[_0xae70('0x96')]['Cc']=_0x18b897['cc'];}if(_0x18b897[_0xae70('0x90')]){_0x2bdac1[_0xae70('0x96')]['Bcc']=_0x18b897['bcc'];}return new BPromise(function(_0x251eed,_0x29a0ef){if(_0x18b897[_0xae70('0x94')]){for(var _0x1b389=0x0;_0x1b389<_0x18b897['Attachments'][_0xae70('0x47')];_0x1b389++){var _0x54347e=_0x18b897[_0xae70('0x94')][_0x1b389];var _0x3f26e6=path[_0xae70('0x5b')](_0x253716,_0x54347e[_0xae70('0x97')]);if(fs[_0xae70('0x98')](_0x3f26e6)){_0x2bdac1[_0xae70('0x5a')][_0xae70('0x99')]({'name':_0x54347e['name'],'contentType':_0x54347e['type'],'data':fs['readFileSync'](_0x3f26e6)});}}}emlformat['build'](_0x2bdac1,function(_0xc6297b,_0x155854){if(_0xc6297b)return _0x29a0ef(_0xc6297b);fs[_0xae70('0x9a')](path[_0xae70('0x5b')](_0x315afe,_0x595c35),_0x155854);return _0x251eed(_0x155854);});});}})[_0xae70('0x26')](function(_0x143d03){if(_0x143d03){return _0x124b26[_0xae70('0x89')](path[_0xae70('0x5b')](_0x315afe,_0x595c35),_0x595c35,function(_0x25e29e){if(!_0x25e29e)fs[_0xae70('0x9b')](path[_0xae70('0x5b')](_0x315afe,_0x595c35));});}})['catch'](handleError(_0x124b26,null));}; \ No newline at end of file +var _0xe31b=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','find','body','params','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','List','Contacts','updatedAt','MailServerOut','Smtp','CloudProvider','attachments','join','root','server/files/attachments','basename','CmContact','defaults','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','stringify','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','MailInteraction','MailInteractionId','read1stAt','interaction','get','role','AcceptMessage','acceptMessage','sequelize','Sequelize','QueryTypes','SELECT','fullname','SIP/%s','channel','motionChannel','event','accept','acceptmessage','reject','mail','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','contact','User','email','interface','fromString','EventManager','rejectmessage','download','unix','toString','server','tmp','message-%s.eml','from','bcc','subject','Attachment','Attachments','headers','Bcc','push','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','path','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','redis','localhost','html-entities','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','status','undefined','limit','offset','count','set','Content-Range','json','update','destroy','name','send','index','map','MailMessage'];(function(_0x50ac26,_0xd85d90){var _0x23ccf6=function(_0xcfa41e){while(--_0xcfa41e){_0x50ac26['push'](_0x50ac26['shift']());}};_0x23ccf6(++_0xd85d90);}(_0xe31b,0x1b1));var _0xbe31=function(_0xa5c63f,_0x2aaaa8){_0xa5c63f=_0xa5c63f-0x0;var _0xf352b1=_0xe31b[_0xa5c63f];return _0xf352b1;};'use strict';var emlformat=require(_0xbe31('0x0'));var moment=require(_0xbe31('0x1'));var BPromise=require('bluebird');var util=require('util');var path=require(_0xbe31('0x2'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xbe31('0x3'));var htmlToText=require(_0xbe31('0x4'));var qs=require(_0xbe31('0x5'));var logger=require(_0xbe31('0x6'))('api');var interaction_log=require(_0xbe31('0x6'))(_0xbe31('0x7'));var config=require(_0xbe31('0x8'));var db=require(_0xbe31('0x9'))['db'];config[_0xbe31('0xa')]=_['defaults'](config[_0xbe31('0xa')],{'host':_0xbe31('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var htmlEntities=require(_0xbe31('0xc'));require('./mailMessage.socket')[_0xbe31('0xd')](socket);var jayson=require(_0xbe31('0xe'));var client=jayson[_0xbe31('0xf')][_0xbe31('0x10')]({'port':0x232c});var client9003=jayson[_0xbe31('0xf')]['http']({'port':0x232b});var client9002=jayson[_0xbe31('0xf')][_0xbe31('0x10')]({'port':0x232a});function respondWithRpcPromise(_0x3dec17,_0x32f4c6,_0x17377b,_0x27a25c){return new BPromise(function(_0x281dc3,_0x5d6158){var _0x483574=_0x27a25c||client;return _0x483574[_0xbe31('0x11')](_0x3dec17,_0x17377b)[_0xbe31('0x12')](function(_0x594470){logger[_0xbe31('0x13')]('MailMessage,\x20%s,\x20%s',_0x32f4c6,_0xbe31('0x14'));logger[_0xbe31('0x15')](_0xbe31('0x16'),_0x32f4c6,_0xbe31('0x14'),JSON['stringify'](_0x594470));if(_0x594470[_0xbe31('0x17')]){if(_0x594470[_0xbe31('0x17')][_0xbe31('0x18')]===0x1f4){logger['error'](_0xbe31('0x19'),_0x32f4c6,_0x594470[_0xbe31('0x17')][_0xbe31('0x1a')]);return _0x5d6158(_0x594470[_0xbe31('0x17')][_0xbe31('0x1a')]);}logger[_0xbe31('0x17')](_0xbe31('0x19'),_0x32f4c6,_0x594470[_0xbe31('0x17')][_0xbe31('0x1a')]);return _0x281dc3(_0x594470[_0xbe31('0x17')][_0xbe31('0x1a')]);}else{logger[_0xbe31('0x13')](_0xbe31('0x19'),_0x32f4c6,_0xbe31('0x14'));_0x281dc3(_0x594470[_0xbe31('0x1b')][_0xbe31('0x1a')]);}})[_0xbe31('0x1c')](function(_0x311ac3){logger['error'](_0xbe31('0x19'),_0x32f4c6,_0x311ac3);_0x5d6158(_0x311ac3);});});}function respondWithResult(_0x481ead,_0x505fac){_0x505fac=_0x505fac||0xc8;return function(_0x17b80a){if(_0x17b80a){return _0x481ead[_0xbe31('0x1d')](_0x505fac)['json'](_0x17b80a);}};}function respondWithFilteredResult(_0x4eda40,_0x24b81b){return function(_0x440420){if(_0x440420){var _0x51ab5b=typeof _0x24b81b['offset']===_0xbe31('0x1e')&&typeof _0x24b81b[_0xbe31('0x1f')]===_0xbe31('0x1e');var _0x5a3692=_0x440420['count'];var _0x4df49a=_0x51ab5b?0x0:_0x24b81b[_0xbe31('0x20')];var _0x1a99dd=_0x51ab5b?_0x440420[_0xbe31('0x21')]:_0x24b81b[_0xbe31('0x20')]+_0x24b81b[_0xbe31('0x1f')];var _0xcbebfd;if(_0x1a99dd>=_0x5a3692){_0x1a99dd=_0x5a3692;_0xcbebfd=0xc8;}else{_0xcbebfd=0xce;}_0x4eda40[_0xbe31('0x1d')](_0xcbebfd);return _0x4eda40[_0xbe31('0x22')](_0xbe31('0x23'),_0x4df49a+'-'+_0x1a99dd+'/'+_0x5a3692)[_0xbe31('0x24')](_0x440420);}return null;};}function saveUpdates(_0x23c569){return function(_0x45239b){if(_0x45239b){return _0x45239b[_0xbe31('0x25')](_0x23c569)[_0xbe31('0x12')](function(_0x4a5c3b){return _0x4a5c3b;});}return null;};}function removeEntity(_0x409404){return function(_0xd0ecb0){if(_0xd0ecb0){return _0xd0ecb0[_0xbe31('0x26')]()[_0xbe31('0x12')](function(){_0x409404[_0xbe31('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16f87d){return function(_0x2f781f){if(!_0x2f781f){_0x16f87d['sendStatus'](0x194);}return _0x2f781f;};}function handleError(_0x2f5398,_0x591d42){_0x591d42=_0x591d42||0x1f4;return function(_0x424c2c){logger[_0xbe31('0x17')](_0x424c2c['stack']);if(_0x424c2c[_0xbe31('0x27')]){delete _0x424c2c[_0xbe31('0x27')];}_0x2f5398[_0xbe31('0x1d')](_0x591d42)[_0xbe31('0x28')](_0x424c2c);};}exports[_0xbe31('0x29')]=function(_0x3feb4d,_0x13dfba){var _0x1e7b49={},_0x18fa3b={},_0x21a255={'count':0x0,'rows':[]};var _0xd9d732=_[_0xbe31('0x2a')](db[_0xbe31('0x2b')][_0xbe31('0x2c')],function(_0xcac82b){return{'name':_0xcac82b[_0xbe31('0x2d')],'type':_0xcac82b[_0xbe31('0x2e')][_0xbe31('0x2f')]};});_0x18fa3b[_0xbe31('0x30')]=_['map'](_0xd9d732,_0xbe31('0x27'));_0x18fa3b[_0xbe31('0x31')]=_[_0xbe31('0x32')](_0x3feb4d[_0xbe31('0x31')]);_0x18fa3b[_0xbe31('0x33')]=_[_0xbe31('0x34')](_0x18fa3b[_0xbe31('0x30')],_0x18fa3b[_0xbe31('0x31')]);_0x1e7b49[_0xbe31('0x35')]=_[_0xbe31('0x34')](_0x18fa3b[_0xbe31('0x30')],qs[_0xbe31('0x36')](_0x3feb4d[_0xbe31('0x31')][_0xbe31('0x36')]));_0x1e7b49[_0xbe31('0x35')]=_0x1e7b49[_0xbe31('0x35')][_0xbe31('0x37')]?_0x1e7b49[_0xbe31('0x35')]:_0x18fa3b[_0xbe31('0x30')];if(!_0x3feb4d[_0xbe31('0x31')][_0xbe31('0x38')]('nolimit')){_0x1e7b49[_0xbe31('0x1f')]=qs[_0xbe31('0x1f')](_0x3feb4d[_0xbe31('0x31')][_0xbe31('0x1f')]);_0x1e7b49[_0xbe31('0x20')]=qs['offset'](_0x3feb4d[_0xbe31('0x31')][_0xbe31('0x20')]);}_0x1e7b49[_0xbe31('0x39')]=qs[_0xbe31('0x3a')](_0x3feb4d[_0xbe31('0x31')][_0xbe31('0x3a')]);_0x1e7b49[_0xbe31('0x3b')]=qs[_0xbe31('0x33')](_[_0xbe31('0x3c')](_0x3feb4d['query'],_0x18fa3b['filters']),_0xd9d732);if(_0x3feb4d[_0xbe31('0x31')][_0xbe31('0x3d')]){_0x1e7b49[_0xbe31('0x3b')]=_[_0xbe31('0x3e')](_0x1e7b49['where'],{'$or':_[_0xbe31('0x2a')](_0xd9d732,function(_0x337bfa){if(_0x337bfa[_0xbe31('0x2e')]!==_0xbe31('0x3f')){var _0x290336={};_0x290336[_0x337bfa[_0xbe31('0x27')]]={'$like':'%'+_0x3feb4d['query'][_0xbe31('0x3d')]+'%'};return _0x290336;}})});}_0x1e7b49=_[_0xbe31('0x3e')]({},_0x1e7b49,_0x3feb4d[_0xbe31('0x40')]);var _0x24d095={'where':_0x1e7b49[_0xbe31('0x3b')]};return db[_0xbe31('0x2b')][_0xbe31('0x21')](_0x24d095)[_0xbe31('0x12')](function(_0x41d6ad){_0x21a255[_0xbe31('0x21')]=_0x41d6ad;if(_0x3feb4d['query'][_0xbe31('0x41')]){_0x1e7b49[_0xbe31('0x42')]=[{'all':!![]}];}return db[_0xbe31('0x2b')]['findAll'](_0x1e7b49);})[_0xbe31('0x12')](function(_0x487e9c){_0x21a255[_0xbe31('0x43')]=_0x487e9c;return _0x21a255;})[_0xbe31('0x12')](respondWithFilteredResult(_0x13dfba,_0x1e7b49))[_0xbe31('0x1c')](handleError(_0x13dfba,null));};exports[_0xbe31('0x44')]=function(_0x4ce0f6,_0x33f566){var _0xd9bd5={'raw':!![],'where':{'id':_0x4ce0f6['params']['id']}},_0x72bdaa={};_0x72bdaa['model']=_[_0xbe31('0x32')](db[_0xbe31('0x2b')][_0xbe31('0x2c')]);_0x72bdaa[_0xbe31('0x31')]=_[_0xbe31('0x32')](_0x4ce0f6[_0xbe31('0x31')]);_0x72bdaa[_0xbe31('0x33')]=_[_0xbe31('0x34')](_0x72bdaa[_0xbe31('0x30')],_0x72bdaa[_0xbe31('0x31')]);_0xd9bd5[_0xbe31('0x35')]=_[_0xbe31('0x34')](_0x72bdaa[_0xbe31('0x30')],qs[_0xbe31('0x36')](_0x4ce0f6[_0xbe31('0x31')]['fields']));_0xd9bd5['attributes']=_0xd9bd5[_0xbe31('0x35')][_0xbe31('0x37')]?_0xd9bd5[_0xbe31('0x35')]:_0x72bdaa['model'];if(_0x4ce0f6[_0xbe31('0x31')][_0xbe31('0x41')]){_0xd9bd5[_0xbe31('0x42')]=[{'all':!![]}];}_0xd9bd5=_[_0xbe31('0x3e')]({},_0xd9bd5,_0x4ce0f6[_0xbe31('0x40')]);return db['MailMessage'][_0xbe31('0x45')](_0xd9bd5)[_0xbe31('0x12')](handleEntityNotFound(_0x33f566,null))['then'](respondWithResult(_0x33f566,null))[_0xbe31('0x1c')](handleError(_0x33f566,null));};exports[_0xbe31('0x25')]=function(_0x43ebaf,_0x187ffa){if(_0x43ebaf[_0xbe31('0x46')]['id']){delete _0x43ebaf[_0xbe31('0x46')]['id'];}return db['MailMessage'][_0xbe31('0x45')]({'where':{'id':_0x43ebaf[_0xbe31('0x47')]['id']}})[_0xbe31('0x12')](handleEntityNotFound(_0x187ffa,null))[_0xbe31('0x12')](saveUpdates(_0x43ebaf[_0xbe31('0x46')],null))[_0xbe31('0x12')](respondWithResult(_0x187ffa,null))[_0xbe31('0x1c')](handleError(_0x187ffa,null));};exports[_0xbe31('0x26')]=function(_0x2c1da3,_0x5475e5){return db['MailMessage']['find']({'where':{'id':_0x2c1da3[_0xbe31('0x47')]['id']}})[_0xbe31('0x12')](handleEntityNotFound(_0x5475e5,null))[_0xbe31('0x12')](removeEntity(_0x5475e5,null))[_0xbe31('0x1c')](handleError(_0x5475e5,null));};exports[_0xbe31('0x48')]=function(_0x4481a6,_0xe0dfae){return db['MailMessage']['describe']()[_0xbe31('0x12')](respondWithResult(_0xe0dfae,null))[_0xbe31('0x1c')](handleError(_0xe0dfae,null));};exports['create']=function(_0x402024,_0x266924){return db[_0xbe31('0x2b')][_0xbe31('0x49')](_0x402024['body'])['then'](function(_0x480ac3){if(_0x480ac3){if(_0x480ac3[_0xbe31('0x4a')]===_0xbe31('0x4b')&&!_0x480ac3[_0xbe31('0x4c')]){var _0x320c4d,_0x53d9b1,_0x4e9f0f;if(_0x402024[_0xbe31('0x46')]['to']){_0x53d9b1=_0x402024[_0xbe31('0x46')]['to'][_0xbe31('0x4d')](',')[0x0];}return db[_0xbe31('0x4e')][_0xbe31('0x4f')]({'where':{'id':_0x480ac3[_0xbe31('0x50')]},'include':[{'model':db['CmList'],'as':_0xbe31('0x51'),'include':[{'model':db['CmContact'],'as':_0xbe31('0x52'),'where':{'email':_0x53d9b1},'limit':0x1,'order':[[_0xbe31('0x53'),'DESC']]}]},{'model':db[_0xbe31('0x54')],'as':_0xbe31('0x55'),'raw':!![],'include':[{'model':db[_0xbe31('0x56')],'as':_0xbe31('0x56'),'raw':!![]}]}]})[_0xbe31('0x12')](function(_0x289969){_0x320c4d=_0x289969;if(!_0x320c4d||!_0x320c4d[_0xbe31('0x55')])return;var _0x543608=_0x320c4d['getSmtpOptions']();if(_0x402024[_0xbe31('0x46')][_0xbe31('0x57')]&&_0x402024[_0xbe31('0x46')][_0xbe31('0x57')][_0xbe31('0x37')]){for(var _0x4f763e=0x0;_0x4f763e<_0x402024['body']['attachments'][_0xbe31('0x37')];_0x4f763e+=0x1){_0x402024[_0xbe31('0x46')]['attachments'][_0x4f763e]={'filename':_0x402024[_0xbe31('0x46')][_0xbe31('0x57')][_0x4f763e]['name'],'path':path[_0xbe31('0x58')](config[_0xbe31('0x59')],_0xbe31('0x5a'),_0x402024['body'][_0xbe31('0x57')][_0x4f763e][_0xbe31('0x5b')])};}}_0x4e9f0f={'account':_0x543608,'message':_0x402024['body']};return;})[_0xbe31('0x12')](function(){if(_0x320c4d['List']){if(_0x320c4d[_0xbe31('0x51')]['Contacts'][_0xbe31('0x37')]){return _0x320c4d[_0xbe31('0x51')][_0xbe31('0x52')][0x0];}else{return db[_0xbe31('0x5c')][_0xbe31('0x49')](_[_0xbe31('0x5d')](_0x402024[_0xbe31('0x46')],{'firstName':_0x402024['body']['to'],'email':_0x402024[_0xbe31('0x46')]['to'],'phone':_0x402024['body']['to'],'ListId':_0x320c4d[_0xbe31('0x5e')]}));}}else{throw new Error(_0xbe31('0x5f'));}})[_0xbe31('0x12')](function(){if(_0x4e9f0f){return respondWithRpcPromise(_0xbe31('0x60'),_0xbe31('0x61'),_0x4e9f0f,client9003)['then'](function(_0x276cd1){return _0x480ac3[_0xbe31('0x25')]({'read':!![],'messageId':_0x276cd1[_0xbe31('0x62')],'sentAt':moment()[_0xbe31('0x63')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0xbe31('0x1c')](function(_0x30c847){logger[_0xbe31('0x17')]('%s',JSON[_0xbe31('0x64')](_0x30c847));return _0x480ac3;});}return _0x480ac3;});}return _0x480ac3;}})[_0xbe31('0x12')](respondWithResult(_0x266924,0xc9))[_0xbe31('0x1c')](handleError(_0x266924,null));};exports['accept']=function(_0x467937,_0x19af5b){var _0x27922c={'agent':{},'channel':'mail'};if(_0x467937[_0xbe31('0x46')]['id']){delete _0x467937[_0xbe31('0x46')]['id'];}_0x467937['body'][_0xbe31('0x65')]=!![];_0x467937['body'][_0xbe31('0x66')]=moment()[_0xbe31('0x63')](_0xbe31('0x67'));_0x467937[_0xbe31('0x46')]['UserId']=_0x467937['body'][_0xbe31('0x68')]||_0x467937[_0xbe31('0x69')]['id'];_0x27922c[_0xbe31('0x6a')]['id']=_0x467937[_0xbe31('0x46')][_0xbe31('0x68')];return db['MailMessage'][_0xbe31('0x45')]({'where':{'id':_0x467937[_0xbe31('0x47')]['id'],'UserId':null}})[_0xbe31('0x12')](handleEntityNotFound(_0x19af5b,null))[_0xbe31('0x12')](saveUpdates(_0x467937[_0xbe31('0x46')],null))[_0xbe31('0x12')](function(_0x23cd2a){if(_0x23cd2a){_0x27922c['message']=_0x23cd2a['get']({'plain':!![]});return db[_0xbe31('0x6b')]['find']({'where':{'id':_0x23cd2a[_0xbe31('0x6c')]}});}return null;})[_0xbe31('0x12')](handleEntityNotFound(_0x19af5b,null))[_0xbe31('0x12')](function(_0x4f6a08){if(_0x4f6a08){return _0x4f6a08[_0xbe31('0x25')]({'UserId':_0x467937[_0xbe31('0x46')][_0xbe31('0x68')],'read1stAt':_['isNil'](_0x4f6a08[_0xbe31('0x6d')])?moment()['format'](_0xbe31('0x67')):undefined});}return null;})[_0xbe31('0x12')](function(_0x25c1ce){if(_0x25c1ce){_0x27922c[_0xbe31('0x6e')]=_0x25c1ce[_0xbe31('0x6f')]({'plain':!![]});interaction_log['info']('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x467937[_0xbe31('0x69')]['id'],_0x467937[_0xbe31('0x69')]['name'],_0x467937[_0xbe31('0x69')][_0xbe31('0x70')],_0x27922c[_0xbe31('0x6e')]['id'],_0x467937[_0xbe31('0x46')]?JSON[_0xbe31('0x64')](_0x467937[_0xbe31('0x46')]):'null');return respondWithRpcPromise(_0xbe31('0x71'),_0xbe31('0x72'),_0x27922c);}return null;})[_0xbe31('0x12')](function(_0x46e87){var _0x201275='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x46e87[_0xbe31('0x1a')]['ContactId'];return db[_0xbe31('0x73')][_0xbe31('0x31')](_0x201275,{'type':db[_0xbe31('0x74')][_0xbe31('0x75')][_0xbe31('0x76')],'raw':!![]})[_0xbe31('0x12')](function(_0x108982){return _0x108982;});})[_0xbe31('0x12')](function(_0x3e7fff){if(_0x3e7fff){_0x27922c[_0xbe31('0x1a')]['contact']=_0x3e7fff[0x0];if(!_0x467937['body']['UserId'])return;return db['User'][_0xbe31('0x45')]({'where':{'id':_0x467937[_0xbe31('0x46')][_0xbe31('0x68')],'role':_0xbe31('0x6a')},'attributes':['id','name',_0xbe31('0x77'),'email','internal'],'raw':!![]});}return null;})[_0xbe31('0x12')](function(_0x2a38c3){if(!_0x2a38c3)return null;_0x27922c[_0xbe31('0x1a')]['agent']=_0x2a38c3;return _0x27922c;})[_0xbe31('0x12')](function(_0x3541c3){if(_0x3541c3){if(_0x467937['body']['manual']){_0x27922c[_0xbe31('0x1a')]['interface']=util[_0xbe31('0x63')](_0xbe31('0x78'),_0x467937[_0xbe31('0x69')]['name']);_0x27922c[_0xbe31('0x1a')][_0xbe31('0x79')]=_0x27922c['channel'];_0x27922c[_0xbe31('0x1a')][_0xbe31('0x7a')]=_0x27922c[_0xbe31('0x79')];_0x27922c['message'][_0xbe31('0x7b')]=_0xbe31('0x7c');_0x27922c[_0xbe31('0x1a')][_0xbe31('0x46')]=htmlToText['fromString'](_0x27922c[_0xbe31('0x1a')][_0xbe31('0x46')]);return respondWithRpcPromise('EventManager','EventManager',{'event':_0xbe31('0x7d'),'message':_0x27922c[_0xbe31('0x1a')]},client9002)[_0xbe31('0x12')](function(){return _0x27922c;});}return _0x27922c;}return null;})[_0xbe31('0x12')](respondWithResult(_0x19af5b,null))[_0xbe31('0x1c')](handleError(_0x19af5b,null));};exports[_0xbe31('0x7e')]=function(_0x4117ef,_0xeca31e){var _0x536978={'agent':{},'channel':_0xbe31('0x7f')};if(_0x4117ef[_0xbe31('0x46')]['id']){delete _0x4117ef[_0xbe31('0x46')]['id'];}_0x4117ef[_0xbe31('0x46')][_0xbe31('0x68')]=_0x4117ef[_0xbe31('0x46')][_0xbe31('0x68')]||_0x4117ef['user']['id'];_0x536978[_0xbe31('0x6a')]['id']=_0x4117ef[_0xbe31('0x46')][_0xbe31('0x68')];return db['MailMessage'][_0xbe31('0x45')]({'where':{'id':_0x4117ef[_0xbe31('0x47')]['id'],'UserId':null}})[_0xbe31('0x12')](handleEntityNotFound(_0xeca31e,null))['then'](function(_0x4af658){if(_0x4af658){_0x536978[_0xbe31('0x1a')]=_0x4af658[_0xbe31('0x6f')]({'plain':!![]});return db[_0xbe31('0x6b')][_0xbe31('0x45')]({'where':{'id':_0x4af658[_0xbe31('0x6c')]}});}return null;})[_0xbe31('0x12')](handleEntityNotFound(_0xeca31e,null))[_0xbe31('0x12')](function(_0x47eb1c){if(_0x47eb1c){_0x536978[_0xbe31('0x6e')]=_0x47eb1c[_0xbe31('0x6f')]({'plain':!![]});interaction_log[_0xbe31('0x13')](_0xbe31('0x80'),_0x4117ef['user']['id'],_0x4117ef[_0xbe31('0x69')][_0xbe31('0x27')],_0x4117ef[_0xbe31('0x69')][_0xbe31('0x70')],_0x536978[_0xbe31('0x6e')]['id'],_0x4117ef[_0xbe31('0x46')]?JSON['stringify'](_0x4117ef['body']):_0xbe31('0x81'));return respondWithRpcPromise(_0xbe31('0x82'),_0xbe31('0x83'),_0x536978);}return null;})[_0xbe31('0x12')](function(_0x409dff){var _0x107135=_0xbe31('0x84')+_0x409dff[_0xbe31('0x1a')][_0xbe31('0x85')];return db['sequelize'][_0xbe31('0x31')](_0x107135,{'type':db[_0xbe31('0x74')][_0xbe31('0x75')]['SELECT'],'raw':!![]})[_0xbe31('0x12')](function(_0x24fc6e){return _0x24fc6e;});})[_0xbe31('0x12')](function(_0x3f53dc){if(_0x3f53dc){_0x536978[_0xbe31('0x1a')][_0xbe31('0x86')]=_0x3f53dc[0x0];if(!_0x4117ef[_0xbe31('0x46')][_0xbe31('0x68')])return;return db[_0xbe31('0x87')][_0xbe31('0x45')]({'where':{'id':_0x4117ef[_0xbe31('0x46')]['UserId'],'role':_0xbe31('0x6a')},'attributes':['id',_0xbe31('0x27'),'fullname',_0xbe31('0x88'),'internal'],'raw':!![]});}return null;})['then'](function(_0x2fe9af){if(!_0x2fe9af)return null;_0x536978['message']['agent']=_0x2fe9af;return _0x536978;})[_0xbe31('0x12')](function(_0x306dd1){if(_0x306dd1){_0x306dd1[_0xbe31('0x1a')][_0xbe31('0x89')]=util[_0xbe31('0x63')]('SIP/%s',_0x4117ef[_0xbe31('0x69')][_0xbe31('0x27')]);_0x306dd1[_0xbe31('0x1a')][_0xbe31('0x79')]=_0x536978[_0xbe31('0x79')];_0x306dd1[_0xbe31('0x1a')][_0xbe31('0x7a')]=_0x536978[_0xbe31('0x79')];_0x306dd1[_0xbe31('0x1a')][_0xbe31('0x7b')]='reject';_0x306dd1[_0xbe31('0x1a')][_0xbe31('0x46')]=htmlToText[_0xbe31('0x8a')](_0x536978[_0xbe31('0x1a')]['body']);respondWithRpcPromise('EventManager',_0xbe31('0x8b'),{'event':_0xbe31('0x8c'),'message':_0x306dd1['message']},client9002);return _0x536978;}return null;})['then'](respondWithResult(_0xeca31e,null))[_0xbe31('0x1c')](handleError(_0xeca31e,null));};exports[_0xbe31('0x8d')]=function(_0x37738b,_0x3b9d40){var _0x2bf537=moment()[_0xbe31('0x8e')]()[_0xbe31('0x8f')]();var _0x3bcff9=path[_0xbe31('0x58')](config[_0xbe31('0x59')],_0xbe31('0x90'),'files',_0xbe31('0x91'));var _0x2d2704=path[_0xbe31('0x58')](config['root'],'server','files',_0xbe31('0x57'));var _0x14f25f=util['format'](_0xbe31('0x92'),_0x2bf537);return db['MailMessage']['find']({'where':{'id':_0x37738b[_0xbe31('0x47')]['id']},'attributes':['id',_0xbe31('0x46'),_0xbe31('0x93'),'to','cc',_0xbe31('0x94'),_0xbe31('0x95'),'createdAt'],'include':_0x37738b[_0xbe31('0x31')][_0xbe31('0x57')]?[{'model':db[_0xbe31('0x96')],'as':_0xbe31('0x97')}]:undefined})['then'](handleEntityNotFound(_0x3b9d40,null))[_0xbe31('0x12')](function(_0x106e04){if(_0x106e04){var _0x263498=_0x106e04;var _0xf58595={'from':_0x263498[_0xbe31('0x93')],'to':_0x263498['to'],'subject':_0x263498[_0xbe31('0x95')],'html':htmlEntities['decode'](_0x263498[_0xbe31('0x46')]),'headers':{'Date':moment(_0x263498['createdAt'])[_0xbe31('0x63')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x106e04['cc']){_0xf58595[_0xbe31('0x98')]['Cc']=_0x106e04['cc'];}if(_0x106e04[_0xbe31('0x94')]){_0xf58595[_0xbe31('0x98')][_0xbe31('0x99')]=_0x106e04[_0xbe31('0x94')];}return new BPromise(function(_0x21abbe,_0x2894a2){if(_0x106e04[_0xbe31('0x97')]){for(var _0x1e6f4f=0x0;_0x1e6f4f<_0x106e04[_0xbe31('0x97')][_0xbe31('0x37')];_0x1e6f4f++){var _0x1ecdf9=_0x106e04[_0xbe31('0x97')][_0x1e6f4f];var _0x7757f5=path[_0xbe31('0x58')](_0x2d2704,_0x1ecdf9[_0xbe31('0x5b')]);if(fs['existsSync'](_0x7757f5)){_0xf58595['attachments'][_0xbe31('0x9a')]({'name':_0x1ecdf9[_0xbe31('0x27')],'contentType':_0x1ecdf9[_0xbe31('0x2e')],'data':fs[_0xbe31('0x9b')](_0x7757f5)});}}}emlformat[_0xbe31('0x9c')](_0xf58595,function(_0xa66672,_0x1f9b58){if(_0xa66672)return _0x2894a2(_0xa66672);fs[_0xbe31('0x9d')](path[_0xbe31('0x58')](_0x3bcff9,_0x14f25f),_0x1f9b58);return _0x21abbe(_0x1f9b58);});});}})[_0xbe31('0x12')](function(_0x218167){if(_0x218167){return _0x3b9d40[_0xbe31('0x8d')](path['join'](_0x3bcff9,_0x14f25f),_0x14f25f,function(_0x3d43fb){if(!_0x3d43fb)fs[_0xbe31('0x9e')](path[_0xbe31('0x58')](_0x3bcff9,_0x14f25f));});}})[_0xbe31('0x1c')](handleError(_0x3b9d40,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index b9dcfb1..ed36de4 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 _0x6a22=['hasOwnProperty','hook','exports','events','MailMessage','remove','emit'];(function(_0x12d951,_0x249808){var _0x44de17=function(_0x182fd9){while(--_0x182fd9){_0x12d951['push'](_0x12d951['shift']());}};_0x44de17(++_0x249808);}(_0x6a22,0xf8));var _0x26a2=function(_0x1b95a1,_0x529852){_0x1b95a1=_0x1b95a1-0x0;var _0x57aef1=_0x6a22[_0x1b95a1];return _0x57aef1;};'use strict';var EventEmitter=require(_0x26a2('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x26a2('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x26a2('0x2')};function emitEvent(_0x43b844){return function(_0x471020,_0x3a89de,_0x4467d3){MailMessageEvents[_0x26a2('0x3')](_0x43b844+':'+_0x471020['id'],_0x471020);MailMessageEvents['emit'](_0x43b844,_0x471020);_0x4467d3(null);};}for(var e in events){if(events[_0x26a2('0x4')](e)){var event=events[e];MailMessage[_0x26a2('0x5')](e,emitEvent(event));}}module[_0x26a2('0x6')]=MailMessageEvents; \ No newline at end of file +var _0x9df6=['MailMessage','setMaxListeners','save','update','remove','emit','hook','events','../../mysqldb'];(function(_0x169790,_0x48aa33){var _0x4d0f36=function(_0x2a848d){while(--_0x2a848d){_0x169790['push'](_0x169790['shift']());}};_0x4d0f36(++_0x48aa33);}(_0x9df6,0xd6));var _0x69df=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x9df6[_0xefd519];return _0x4bb882;};'use strict';var EventEmitter=require(_0x69df('0x0'));var MailMessage=require(_0x69df('0x1'))['db'][_0x69df('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x69df('0x3')](0x0);var events={'afterCreate':_0x69df('0x4'),'afterUpdate':_0x69df('0x5'),'afterDestroy':_0x69df('0x6')};function emitEvent(_0x40501b){return function(_0x162dee,_0x472572,_0x4331f7){MailMessageEvents['emit'](_0x40501b+':'+_0x162dee['id'],_0x162dee);MailMessageEvents[_0x69df('0x7')](_0x40501b,_0x162dee);_0x4331f7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x69df('0x8')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index d07727f..e7644f5 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 _0x49b2=['../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','plainBody','subject','FULLTEXT','body','models','get','direction','toLowerCase','MailInteraction','findOne','MailInteractionId','then','createdAt','catch','utf8mb4','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x1bfc33,_0x48c342){var _0x2422b6=function(_0x3c676e){while(--_0x3c676e){_0x1bfc33['push'](_0x1bfc33['shift']());}};_0x2422b6(++_0x48c342);}(_0x49b2,0xbe));var _0x249b=function(_0x38be4c,_0x59d584){_0x38be4c=_0x38be4c-0x0;var _0x3b82ee=_0x49b2[_0x38be4c];return _0x3b82ee;};'use strict';var _=require(_0x249b('0x0'));var util=require(_0x249b('0x1'));var logger=require(_0x249b('0x2'))(_0x249b('0x3'));var moment=require(_0x249b('0x4'));var BPromise=require('bluebird');var rp=require(_0x249b('0x5'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x249b('0x6'));var attributes=require(_0x249b('0x7'));module[_0x249b('0x8')]=function(_0x2c150d,_0x21e1a8){return _0x2c150d[_0x249b('0x9')](_0x249b('0xa'),attributes,{'tableName':_0x249b('0xb'),'paranoid':![],'indexes':[{'name':_0x249b('0xc'),'fields':[_0x249b('0xc')]},{'name':'fti_mail_messages','fields':[_0x249b('0xd'),_0x249b('0xe')],'type':_0x249b('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4a7431,_0x15fe67,_0x5035f2){if(_0x4a7431[_0x249b('0x10')]){_0x4a7431['plainBody']=htmlToText['fromString'](_0x4a7431[_0x249b('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x5035f2(null,_0x15fe67);},'afterCreate':function(_0x48d968,_0x1d0f3d,_0x33b0f2){var _0x494435=_0x2c150d[_0x249b('0x11')];var _0x5b5d59=_0x48d968[_0x249b('0x12')]({'plain':!![]});if(_0x5b5d59[_0x249b('0x13')][_0x249b('0x14')]()==='in'||_0x5b5d59['direction'][_0x249b('0x14')]()==='out'&&!_0x5b5d59['secret']&&!_['isNil'](_0x5b5d59['UserId'])){_0x494435[_0x249b('0x15')][_0x249b('0x16')]({'where':{'id':_0x5b5d59[_0x249b('0x17')]}})[_0x249b('0x18')](function(_0x32f642){if(_0x32f642){_0x32f642['update']({'lastMsgAt':_0x5b5d59[_0x249b('0x19')],'lastMsgDirection':_0x5b5d59[_0x249b('0x13')][_0x249b('0x14')]()});}})[_0x249b('0x1a')](function(_0x4dce2b){console['error'](_0x4dce2b);});}_0x33b0f2();}},'charset':_0x249b('0x1b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x876b=['../../config/environment','./mailMessage.attributes','exports','define','MailMessage','messageId','fti_mail_messages','plainBody','FULLTEXT','body','fromString','get','direction','toLowerCase','secret','UserId','MailInteraction','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text','path','rimraf'];(function(_0x2e98cc,_0x2e3fa1){var _0x34bf9c=function(_0x1f0bc7){while(--_0x1f0bc7){_0x2e98cc['push'](_0x2e98cc['shift']());}};_0x34bf9c(++_0x2e3fa1);}(_0x876b,0xbc));var _0xb876=function(_0x130ef3,_0xb6b89f){_0x130ef3=_0x130ef3-0x0;var _0xce0277=_0x876b[_0x130ef3];return _0xce0277;};'use strict';var _=require(_0xb876('0x0'));var util=require(_0xb876('0x1'));var logger=require(_0xb876('0x2'))(_0xb876('0x3'));var moment=require(_0xb876('0x4'));var BPromise=require(_0xb876('0x5'));var rp=require(_0xb876('0x6'));var htmlToText=require(_0xb876('0x7'));var fs=require('fs');var path=require(_0xb876('0x8'));var rimraf=require(_0xb876('0x9'));var config=require(_0xb876('0xa'));var attributes=require(_0xb876('0xb'));module[_0xb876('0xc')]=function(_0x29d767,_0x23cbe6){return _0x29d767[_0xb876('0xd')](_0xb876('0xe'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0xb876('0xf')]},{'name':_0xb876('0x10'),'fields':[_0xb876('0x11'),'subject'],'type':_0xb876('0x12')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x45237e,_0x44f015,_0x1850d2){if(_0x45237e[_0xb876('0x13')]){_0x45237e[_0xb876('0x11')]=htmlToText[_0xb876('0x14')](_0x45237e[_0xb876('0x13')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x1850d2(null,_0x44f015);},'afterCreate':function(_0x1f9dcc,_0x1ac8e2,_0x12d542){var _0x4c2d69=_0x29d767['models'];var _0x11b6a6=_0x1f9dcc[_0xb876('0x15')]({'plain':!![]});if(_0x11b6a6['direction']['toLowerCase']()==='in'||_0x11b6a6[_0xb876('0x16')][_0xb876('0x17')]()==='out'&&!_0x11b6a6[_0xb876('0x18')]&&!_['isNil'](_0x11b6a6[_0xb876('0x19')])){_0x4c2d69[_0xb876('0x1a')]['findOne']({'where':{'id':_0x11b6a6['MailInteractionId']}})[_0xb876('0x1b')](function(_0x37f4bf){if(_0x37f4bf){_0x37f4bf[_0xb876('0x1c')]({'lastMsgAt':_0x11b6a6['createdAt'],'lastMsgDirection':_0x11b6a6[_0xb876('0x16')][_0xb876('0x17')]()});}})[_0xb876('0x1d')](function(_0x5545b7){console[_0xb876('0x1e')](_0x5545b7);});}_0x12d542();}},'charset':_0xb876('0x1f'),'collate':_0xb876('0x20')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 99dc9b4..3d0d035 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 _0xd943=['CreateMailMessage','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','localhost','./mailMessage.socket','register','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','MailMessage','options','raw'];(function(_0x2013b9,_0x5a1e8a){var _0x369db8=function(_0x5d4ced){while(--_0x5d4ced){_0x2013b9['push'](_0x2013b9['shift']());}};_0x369db8(++_0x5a1e8a);}(_0xd943,0x15d));var _0x3d94=function(_0x2002ac,_0x3c7111){_0x2002ac=_0x2002ac-0x0;var _0x4a1eb2=_0xd943[_0x2002ac];return _0x4a1eb2;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));var BPromise=require(_0x3d94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d94('0x4'));var db=require(_0x3d94('0x5'))['db'];var utils=require(_0x3d94('0x6'));var logger=require(_0x3d94('0x7'))(_0x3d94('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d94('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x3d94('0xa')],{'host':_0x3d94('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3d94('0xc'))[_0x3d94('0xd')](socket);function respondWithRpcPromise(_0x1cc58c,_0x5908a7,_0x182066){return new BPromise(function(_0x4ac968,_0x39e2fa){return client[_0x3d94('0xe')](_0x1cc58c,_0x182066)['then'](function(_0x1897de){logger[_0x3d94('0xf')](_0x3d94('0x10'),_0x5908a7,_0x3d94('0x11'));logger[_0x3d94('0x12')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x5908a7,_0x3d94('0x11'),JSON[_0x3d94('0x13')](_0x1897de));if(_0x1897de[_0x3d94('0x14')]){if(_0x1897de['error'][_0x3d94('0x15')]===0x1f4){logger[_0x3d94('0x14')](_0x3d94('0x10'),_0x5908a7,_0x1897de['error'][_0x3d94('0x16')]);return _0x39e2fa(_0x1897de[_0x3d94('0x14')][_0x3d94('0x16')]);}logger[_0x3d94('0x14')](_0x3d94('0x10'),_0x5908a7,_0x1897de[_0x3d94('0x14')][_0x3d94('0x16')]);return _0x4ac968(_0x1897de[_0x3d94('0x14')]['message']);}else{logger[_0x3d94('0xf')](_0x3d94('0x10'),_0x5908a7,_0x3d94('0x11'));_0x4ac968(_0x1897de[_0x3d94('0x17')][_0x3d94('0x16')]);}})[_0x3d94('0x18')](function(_0xef8b3){logger['error'](_0x3d94('0x10'),_0x5908a7,_0xef8b3);_0x39e2fa(_0xef8b3);});});}exports['CreateMailMessage']=function(_0x28bead){var _0x193934=this;return new Promise(function(_0x16a6d0,_0x1e9ec2){return db[_0x3d94('0x19')]['create'](_0x28bead['body'],{'raw':_0x28bead[_0x3d94('0x1a')]?_0x28bead[_0x3d94('0x1a')][_0x3d94('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x30af25){logger[_0x3d94('0xf')](_0x3d94('0x1c'),_0x28bead);logger[_0x3d94('0x12')](_0x3d94('0x1c'),_0x28bead,JSON[_0x3d94('0x13')](_0x30af25));_0x16a6d0(_0x30af25);})[_0x3d94('0x18')](function(_0x27f978){logger[_0x3d94('0x14')](_0x3d94('0x1c'),_0x27f978[_0x3d94('0x16')],_0x28bead);_0x1e9ec2(_0x193934[_0x3d94('0x14')](0x1f4,_0x27f978[_0x3d94('0x16')]));});});}; \ No newline at end of file +var _0xbbbc=['CreateMailMessage','MailMessage','create','body','options','raw','then','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','request','info','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','MailMessage,\x20%s,\x20%s','message','result'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x1b5063,_0x36e717){_0x1b5063=_0x1b5063-0x0;var _0xb284ee=_0xbbbc[_0x1b5063];return _0xb284ee;};'use strict';var _=require(_0xcbbb('0x0'));var util=require(_0xcbbb('0x1'));var moment=require(_0xcbbb('0x2'));var BPromise=require(_0xcbbb('0x3'));var rs=require(_0xcbbb('0x4'));var fs=require('fs');var Redis=require(_0xcbbb('0x5'));var db=require(_0xcbbb('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xcbbb('0x7'))(_0xcbbb('0x8'));var config=require(_0xcbbb('0x9'));var jayson=require(_0xcbbb('0xa'));var client=jayson[_0xcbbb('0xb')]['http']({'port':0x232a});config[_0xcbbb('0xc')]=_[_0xcbbb('0xd')](config[_0xcbbb('0xc')],{'host':_0xcbbb('0xe'),'port':0x18eb});var socket=require(_0xcbbb('0xf'))(new Redis(config[_0xcbbb('0xc')]));require(_0xcbbb('0x10'))['register'](socket);function respondWithRpcPromise(_0x225156,_0x4b0138,_0x5893f9){return new BPromise(function(_0x107c35,_0x56c7d0){return client[_0xcbbb('0x11')](_0x225156,_0x5893f9)['then'](function(_0x3766c2){logger[_0xcbbb('0x12')]('MailMessage,\x20%s,\x20%s',_0x4b0138,_0xcbbb('0x13'));logger['debug'](_0xcbbb('0x14'),_0x4b0138,'request\x20sent',JSON[_0xcbbb('0x15')](_0x3766c2));if(_0x3766c2[_0xcbbb('0x16')]){if(_0x3766c2[_0xcbbb('0x16')]['code']===0x1f4){logger[_0xcbbb('0x16')](_0xcbbb('0x17'),_0x4b0138,_0x3766c2[_0xcbbb('0x16')][_0xcbbb('0x18')]);return _0x56c7d0(_0x3766c2['error']['message']);}logger[_0xcbbb('0x16')](_0xcbbb('0x17'),_0x4b0138,_0x3766c2[_0xcbbb('0x16')][_0xcbbb('0x18')]);return _0x107c35(_0x3766c2['error'][_0xcbbb('0x18')]);}else{logger['info'](_0xcbbb('0x17'),_0x4b0138,_0xcbbb('0x13'));_0x107c35(_0x3766c2[_0xcbbb('0x19')]['message']);}})['catch'](function(_0x4bcd9a){logger[_0xcbbb('0x16')](_0xcbbb('0x17'),_0x4b0138,_0x4bcd9a);_0x56c7d0(_0x4bcd9a);});});}exports[_0xcbbb('0x1a')]=function(_0x25e92f){var _0x658337=this;return new Promise(function(_0x1cca90,_0x45de5f){return db[_0xcbbb('0x1b')][_0xcbbb('0x1c')](_0x25e92f[_0xcbbb('0x1d')],{'raw':_0x25e92f['options']?_0x25e92f[_0xcbbb('0x1e')][_0xcbbb('0x1f')]===undefined?!![]:![]:!![]})[_0xcbbb('0x20')](function(_0x42aaf1){logger[_0xcbbb('0x12')](_0xcbbb('0x1a'),_0x25e92f);logger[_0xcbbb('0x21')](_0xcbbb('0x1a'),_0x25e92f,JSON[_0xcbbb('0x15')](_0x42aaf1));_0x1cca90(_0x42aaf1);})['catch'](function(_0xf39ddd){logger[_0xcbbb('0x16')]('CreateMailMessage',_0xf39ddd[_0xcbbb('0x18')],_0x25e92f);_0x45de5f(_0x658337['error'](0x1f4,_0xf39ddd['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 1b73daa..b3ed7e9 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 _0xaf93=['length','./mailMessage.events','save','emit','removeListener','register'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0xaf93,0x151));var _0x3af9=function(_0x323116,_0x5ced14){_0x323116=_0x323116-0x0;var _0x14b3ea=_0xaf93[_0x323116];return _0x14b3ea;};'use strict';var MailMessageEvents=require(_0x3af9('0x0'));var events=[_0x3af9('0x1'),'remove','update'];function createListener(_0x13f5d7,_0x3e84b6){return function(_0x528aa0){_0x3e84b6[_0x3af9('0x2')](_0x13f5d7,_0x528aa0);};}function removeListener(_0x44ae6e,_0x5add3){return function(){MailMessageEvents[_0x3af9('0x3')](_0x44ae6e,_0x5add3);};}exports[_0x3af9('0x4')]=function(_0x1ad446){for(var _0x333abb=0x0,_0x535583=events[_0x3af9('0x5')];_0x333abb<_0x535583;_0x333abb++){var _0x56e4c2=events[_0x333abb];var _0x133672=createListener('mailMessage:'+_0x56e4c2,_0x1ad446);MailMessageEvents['on'](_0x56e4c2,_0x133672);}}; \ No newline at end of file +var _0x13a2=['length','mailMessage:','./mailMessage.events','save','remove','removeListener','register'];(function(_0x5696d3,_0x2e84fa){var _0x51a2a5=function(_0x5fdb44){while(--_0x5fdb44){_0x5696d3['push'](_0x5696d3['shift']());}};_0x51a2a5(++_0x2e84fa);}(_0x13a2,0x175));var _0x213a=function(_0x1fa4ae,_0x275d5b){_0x1fa4ae=_0x1fa4ae-0x0;var _0x32eda0=_0x13a2[_0x1fa4ae];return _0x32eda0;};'use strict';var MailMessageEvents=require(_0x213a('0x0'));var events=[_0x213a('0x1'),_0x213a('0x2'),'update'];function createListener(_0x6670ec,_0x3116f1){return function(_0x530159){_0x3116f1['emit'](_0x6670ec,_0x530159);};}function removeListener(_0x48b5a2,_0x21cba8){return function(){MailMessageEvents[_0x213a('0x3')](_0x48b5a2,_0x21cba8);};}exports[_0x213a('0x4')]=function(_0x4dd41f){for(var _0x2c558d=0x0,_0x4707ea=events[_0x213a('0x5')];_0x2c558d<_0x4707ea;_0x2c558d++){var _0x49964b=events[_0x2c558d];var _0x5aa9bc=createListener(_0x213a('0x6')+_0x49964b,_0x4dd41f);MailMessageEvents['on'](_0x49964b,_0x5aa9bc);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 358efce..e8ebfad 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 _0xdbd7=['post','create','/:id/teams','addTeams','addAgents','update','delete','/:id','destroy','removeTeams','removeAgents','multer','util','path','express','Router','fs-extra','../../config/environment','./mailQueue.controller','get','isAuthenticated','/describe','describe','show','getMembers','getTeams','/:id/users','getAgents'];(function(_0x381170,_0x525e60){var _0x366e37=function(_0xe696b2){while(--_0xe696b2){_0x381170['push'](_0x381170['shift']());}};_0x366e37(++_0x525e60);}(_0xdbd7,0x1e7));var _0x7dbd=function(_0x307fcd,_0x2282b3){_0x307fcd=_0x307fcd-0x0;var _0x4daddd=_0xdbd7[_0x307fcd];return _0x4daddd;};'use strict';var multer=require(_0x7dbd('0x0'));var util=require(_0x7dbd('0x1'));var path=require(_0x7dbd('0x2'));var timeout=require('connect-timeout');var express=require(_0x7dbd('0x3'));var router=express[_0x7dbd('0x4')]();var fs_extra=require(_0x7dbd('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7dbd('0x6'));var controller=require(_0x7dbd('0x7'));router[_0x7dbd('0x8')]('/',auth[_0x7dbd('0x9')](),controller['index']);router[_0x7dbd('0x8')](_0x7dbd('0xa'),auth[_0x7dbd('0x9')](),controller[_0x7dbd('0xb')]);router[_0x7dbd('0x8')]('/:id',auth[_0x7dbd('0x9')](),controller[_0x7dbd('0xc')]);router[_0x7dbd('0x8')]('/:id/members',auth[_0x7dbd('0x9')](),controller[_0x7dbd('0xd')]);router[_0x7dbd('0x8')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7dbd('0xe')]);router['get'](_0x7dbd('0xf'),auth['isAuthenticated'](),controller[_0x7dbd('0x10')]);router[_0x7dbd('0x11')]('/',auth['isAuthenticated'](),controller[_0x7dbd('0x12')]);router['post'](_0x7dbd('0x13'),auth['isAuthenticated'](),controller[_0x7dbd('0x14')]);router[_0x7dbd('0x11')]('/:id/users',auth[_0x7dbd('0x9')](),controller[_0x7dbd('0x15')]);router['put']('/:id',auth[_0x7dbd('0x9')](),controller[_0x7dbd('0x16')]);router[_0x7dbd('0x17')](_0x7dbd('0x18'),auth[_0x7dbd('0x9')](),controller[_0x7dbd('0x19')]);router[_0x7dbd('0x17')]('/:id/teams',auth[_0x7dbd('0x9')](),controller[_0x7dbd('0x1a')]);router['delete']('/:id/users',auth[_0x7dbd('0x9')](),controller[_0x7dbd('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x441b=['../../components/auth/service','../../components/interaction/service','./mailQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','getMembers','/:id/users','post','create','/:id/teams','addTeams','addAgents','update','delete','removeTeams','removeAgents','multer','util','connect-timeout'];(function(_0x4f22c5,_0x5d045e){var _0x52d87c=function(_0x153be8){while(--_0x153be8){_0x4f22c5['push'](_0x4f22c5['shift']());}};_0x52d87c(++_0x5d045e);}(_0x441b,0x195));var _0xb441=function(_0x155b18,_0x1b209c){_0x155b18=_0x155b18-0x0;var _0x52aeac=_0x441b[_0x155b18];return _0x52aeac;};'use strict';var multer=require(_0xb441('0x0'));var util=require(_0xb441('0x1'));var path=require('path');var timeout=require(_0xb441('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb441('0x3'));var interaction=require(_0xb441('0x4'));var config=require('../../config/environment');var controller=require(_0xb441('0x5'));router[_0xb441('0x6')]('/',auth[_0xb441('0x7')](),controller[_0xb441('0x8')]);router[_0xb441('0x6')](_0xb441('0x9'),auth[_0xb441('0x7')](),controller['describe']);router[_0xb441('0x6')](_0xb441('0xa'),auth['isAuthenticated'](),controller[_0xb441('0xb')]);router[_0xb441('0x6')](_0xb441('0xc'),auth['isAuthenticated'](),controller[_0xb441('0xd')]);router['get']('/:id/teams',auth[_0xb441('0x7')](),controller['getTeams']);router[_0xb441('0x6')](_0xb441('0xe'),auth[_0xb441('0x7')](),controller['getAgents']);router[_0xb441('0xf')]('/',auth[_0xb441('0x7')](),controller[_0xb441('0x10')]);router[_0xb441('0xf')](_0xb441('0x11'),auth['isAuthenticated'](),controller[_0xb441('0x12')]);router[_0xb441('0xf')](_0xb441('0xe'),auth[_0xb441('0x7')](),controller[_0xb441('0x13')]);router['put'](_0xb441('0xa'),auth[_0xb441('0x7')](),controller[_0xb441('0x14')]);router['delete'](_0xb441('0xa'),auth[_0xb441('0x7')](),controller['destroy']);router[_0xb441('0x15')](_0xb441('0x11'),auth[_0xb441('0x7')](),controller[_0xb441('0x16')]);router[_0xb441('0x15')](_0xb441('0xe'),auth[_0xb441('0x7')](),controller[_0xb441('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index bb03385..306da7c 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 _0xd8ec=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','INTEGER','ENUM'];(function(_0xb42e7e,_0x2d0c1e){var _0x5b7890=function(_0x3cbff9){while(--_0x3cbff9){_0xb42e7e['push'](_0xb42e7e['shift']());}};_0x5b7890(++_0x2d0c1e);}(_0xd8ec,0x133));var _0xcd8e=function(_0x55dd68,_0x2dc9d8){_0x55dd68=_0x55dd68-0x0;var _0x213ac7=_0xd8ec[_0x55dd68];return _0x213ac7;};'use strict';var Sequelize=require(_0xcd8e('0x0'));module[_0xcd8e('0x1')]={'name':{'type':Sequelize[_0xcd8e('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xcd8e('0x2')]},'timeout':{'type':Sequelize[_0xcd8e('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcd8e('0x4')](_0xcd8e('0x5'),_0xcd8e('0x6'),_0xcd8e('0x7'))}}; \ No newline at end of file +var _0x76e6=['ENUM','rrmemory','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x76e6,0xcb));var _0x676e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x76e6[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x676e('0x0'));module[_0x676e('0x1')]={'name':{'type':Sequelize[_0x676e('0x2')],'unique':_0x676e('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x676e('0x2')]},'timeout':{'type':Sequelize[_0x676e('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x676e('0x5')](_0x676e('0x6'),'beepall',_0x676e('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 62ead7d..1fbabac 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 _0xb4c2=['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','./mailQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','then','destroy','get','MailQueues','UserProfileResource','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','rows','catch','params','keys','intersection','options','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','body','describe','getMembers','findOne','MailQueueId','UserMailQueue','findAll','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','pick','addTeams','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','ids','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','includes','all','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse'];(function(_0x5b48ce,_0x41950f){var _0x4bcb09=function(_0x172d3c){while(--_0x172d3c){_0x5b48ce['push'](_0x5b48ce['shift']());}};_0x4bcb09(++_0x41950f);}(_0xb4c2,0x19c));var _0x2b4c=function(_0x165663,_0x340b09){_0x165663=_0x165663-0x0;var _0x39e982=_0xb4c2[_0x165663];return _0x39e982;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2b4c('0x0'));var zipdir=require(_0x2b4c('0x1'));var jsonpatch=require(_0x2b4c('0x2'));var rp=require(_0x2b4c('0x3'));var moment=require(_0x2b4c('0x4'));var BPromise=require(_0x2b4c('0x5'));var Mustache=require(_0x2b4c('0x6'));var util=require(_0x2b4c('0x7'));var path=require(_0x2b4c('0x8'));var sox=require(_0x2b4c('0x9'));var csv=require(_0x2b4c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2b4c('0xb'));var _=require('lodash');var squel=require(_0x2b4c('0xc'));var crypto=require('crypto');var jsforce=require(_0x2b4c('0xd'));var deskjs=require(_0x2b4c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2b4c('0xf'));var Papa=require(_0x2b4c('0x10'));var Redis=require(_0x2b4c('0x11'));var authService=require(_0x2b4c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2b4c('0x13'));var hardwareService=require(_0x2b4c('0x14'));var logger=require(_0x2b4c('0x15'))(_0x2b4c('0x16'));var utils=require(_0x2b4c('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2b4c('0x18'));var db=require(_0x2b4c('0x19'))['db'];config[_0x2b4c('0x1a')]=_[_0x2b4c('0x1b')](config[_0x2b4c('0x1a')],{'host':_0x2b4c('0x1c'),'port':0x18eb});var socket=require(_0x2b4c('0x1d'))(new Redis(config[_0x2b4c('0x1a')]));require(_0x2b4c('0x1e'))[_0x2b4c('0x1f')](socket);function respondWithStatusCode(_0x52dc26,_0x2b3ca8){_0x2b3ca8=_0x2b3ca8||0xcc;return function(_0x26dec6){if(_0x26dec6){return _0x52dc26[_0x2b4c('0x20')](_0x2b3ca8);}return _0x52dc26[_0x2b4c('0x21')](_0x2b3ca8)[_0x2b4c('0x22')]();};}function respondWithResult(_0x7fcee9,_0x20fa31){_0x20fa31=_0x20fa31||0xc8;return function(_0x5a84f9){if(_0x5a84f9){return _0x7fcee9[_0x2b4c('0x21')](_0x20fa31)[_0x2b4c('0x23')](_0x5a84f9);}};}function respondWithFilteredResult(_0x3fa354,_0x3aa0bc){return function(_0x396824){if(_0x396824){var _0x20a9c4=typeof _0x3aa0bc[_0x2b4c('0x24')]===_0x2b4c('0x25')&&typeof _0x3aa0bc[_0x2b4c('0x26')]===_0x2b4c('0x25');var _0x33fe96=_0x396824[_0x2b4c('0x27')];var _0x12daa4=_0x20a9c4?0x0:_0x3aa0bc[_0x2b4c('0x24')];var _0x42abec=_0x20a9c4?_0x396824[_0x2b4c('0x27')]:_0x3aa0bc[_0x2b4c('0x24')]+_0x3aa0bc[_0x2b4c('0x26')];var _0x16bbbc;if(_0x42abec>=_0x33fe96){_0x42abec=_0x33fe96;_0x16bbbc=0xc8;}else{_0x16bbbc=0xce;}_0x3fa354[_0x2b4c('0x21')](_0x16bbbc);return _0x3fa354['set'](_0x2b4c('0x28'),_0x12daa4+'-'+_0x42abec+'/'+_0x33fe96)[_0x2b4c('0x23')](_0x396824);}return null;};}function patchUpdates(_0x2d268d){return function(_0x19dffb){try{jsonpatch['apply'](_0x19dffb,_0x2d268d,!![]);}catch(_0x2e3a06){return BPromise[_0x2b4c('0x29')](_0x2e3a06);}return _0x19dffb['save']();};}function saveUpdates(_0x3bc9c1,_0x586c55){return function(_0x37f603){if(_0x37f603){return _0x37f603['update'](_0x3bc9c1)[_0x2b4c('0x2a')](function(_0x4e66ce){return _0x4e66ce;});}return null;};}function removeEntity(_0x48aa0a,_0x38d163){return function(_0x4eff05){if(_0x4eff05){return _0x4eff05[_0x2b4c('0x2b')]()[_0x2b4c('0x2a')](function(){var _0x40b940=_0x4eff05[_0x2b4c('0x2c')]({'plain':!![]});var _0x2286f1=_0x2b4c('0x2d');return db[_0x2b4c('0x2e')]['destroy']({'where':{'type':_0x2286f1,'resourceId':_0x40b940['id']}})[_0x2b4c('0x2a')](function(){return _0x4eff05;});})[_0x2b4c('0x2a')](function(){_0x48aa0a[_0x2b4c('0x21')](0xcc)[_0x2b4c('0x22')]();});}};}function handleEntityNotFound(_0x37f7cb,_0x1ae3f9){return function(_0x2fd4b0){if(!_0x2fd4b0){_0x37f7cb[_0x2b4c('0x20')](0x194);}return _0x2fd4b0;};}function handleError(_0x40225c,_0x3ba517){_0x3ba517=_0x3ba517||0x1f4;return function(_0x2636bd){logger[_0x2b4c('0x2f')](_0x2636bd[_0x2b4c('0x30')]);if(_0x2636bd[_0x2b4c('0x31')]){delete _0x2636bd['name'];}_0x40225c['status'](_0x3ba517)[_0x2b4c('0x32')](_0x2636bd);};}exports[_0x2b4c('0x33')]=function(_0x485b42,_0x3b1b52){var _0x166e8e={},_0x59380d={},_0x5bdf48={'count':0x0,'rows':[]};var _0xf5fd79=_[_0x2b4c('0x34')](db[_0x2b4c('0x35')][_0x2b4c('0x36')],function(_0x5dd63d){return{'name':_0x5dd63d[_0x2b4c('0x37')],'type':_0x5dd63d[_0x2b4c('0x38')][_0x2b4c('0x39')]};});_0x59380d[_0x2b4c('0x3a')]=_[_0x2b4c('0x34')](_0xf5fd79,_0x2b4c('0x31'));_0x59380d[_0x2b4c('0x3b')]=_['keys'](_0x485b42[_0x2b4c('0x3b')]);_0x59380d[_0x2b4c('0x3c')]=_['intersection'](_0x59380d[_0x2b4c('0x3a')],_0x59380d[_0x2b4c('0x3b')]);_0x166e8e[_0x2b4c('0x3d')]=_['intersection'](_0x59380d[_0x2b4c('0x3a')],qs[_0x2b4c('0x3e')](_0x485b42[_0x2b4c('0x3b')][_0x2b4c('0x3e')]));_0x166e8e[_0x2b4c('0x3d')]=_0x166e8e[_0x2b4c('0x3d')][_0x2b4c('0x3f')]?_0x166e8e[_0x2b4c('0x3d')]:_0x59380d[_0x2b4c('0x3a')];if(!_0x485b42[_0x2b4c('0x3b')][_0x2b4c('0x40')](_0x2b4c('0x41'))){_0x166e8e['limit']=qs[_0x2b4c('0x26')](_0x485b42[_0x2b4c('0x3b')][_0x2b4c('0x26')]);_0x166e8e[_0x2b4c('0x24')]=qs[_0x2b4c('0x24')](_0x485b42[_0x2b4c('0x3b')][_0x2b4c('0x24')]);}_0x166e8e[_0x2b4c('0x42')]=qs[_0x2b4c('0x43')](_0x485b42['query']['sort']);_0x166e8e[_0x2b4c('0x44')]=qs[_0x2b4c('0x3c')](_['pick'](_0x485b42[_0x2b4c('0x3b')],_0x59380d['filters']),_0xf5fd79);if(_0x485b42[_0x2b4c('0x3b')][_0x2b4c('0x45')]){_0x166e8e[_0x2b4c('0x44')]=_[_0x2b4c('0x46')](_0x166e8e[_0x2b4c('0x44')],{'$or':_[_0x2b4c('0x34')](_0xf5fd79,function(_0x5b4fa0){if(_0x5b4fa0[_0x2b4c('0x38')]!==_0x2b4c('0x47')){var _0x197a8f={};_0x197a8f[_0x5b4fa0[_0x2b4c('0x31')]]={'$like':'%'+_0x485b42['query'][_0x2b4c('0x45')]+'%'};return _0x197a8f;}})});}_0x166e8e=_[_0x2b4c('0x46')]({},_0x166e8e,_0x485b42['options']);var _0x5407bb={'where':_0x166e8e['where']};return db['MailQueue'][_0x2b4c('0x27')](_0x5407bb)[_0x2b4c('0x2a')](function(_0x3cf504){_0x5bdf48['count']=_0x3cf504;if(_0x485b42[_0x2b4c('0x3b')][_0x2b4c('0x48')]){_0x166e8e[_0x2b4c('0x49')]=[{'all':!![]}];}return db['MailQueue']['findAll'](_0x166e8e);})[_0x2b4c('0x2a')](function(_0x212bd2){_0x5bdf48[_0x2b4c('0x4a')]=_0x212bd2;return _0x5bdf48;})[_0x2b4c('0x2a')](respondWithFilteredResult(_0x3b1b52,_0x166e8e))[_0x2b4c('0x4b')](handleError(_0x3b1b52,null));};exports['show']=function(_0x52945c,_0x9ed937){var _0x38fe65={'raw':!![],'where':{'id':_0x52945c[_0x2b4c('0x4c')]['id']}},_0x319011={};_0x319011[_0x2b4c('0x3a')]=_[_0x2b4c('0x4d')](db['MailQueue'][_0x2b4c('0x36')]);_0x319011[_0x2b4c('0x3b')]=_[_0x2b4c('0x4d')](_0x52945c[_0x2b4c('0x3b')]);_0x319011[_0x2b4c('0x3c')]=_[_0x2b4c('0x4e')](_0x319011[_0x2b4c('0x3a')],_0x319011[_0x2b4c('0x3b')]);_0x38fe65[_0x2b4c('0x3d')]=_[_0x2b4c('0x4e')](_0x319011[_0x2b4c('0x3a')],qs[_0x2b4c('0x3e')](_0x52945c['query'][_0x2b4c('0x3e')]));_0x38fe65['attributes']=_0x38fe65['attributes'][_0x2b4c('0x3f')]?_0x38fe65[_0x2b4c('0x3d')]:_0x319011['model'];if(_0x52945c[_0x2b4c('0x3b')]['includeAll']){_0x38fe65['include']=[{'all':!![]}];}_0x38fe65=_[_0x2b4c('0x46')]({},_0x38fe65,_0x52945c[_0x2b4c('0x4f')]);return db['MailQueue']['find'](_0x38fe65)['then'](handleEntityNotFound(_0x9ed937,null))[_0x2b4c('0x2a')](respondWithResult(_0x9ed937,null))['catch'](handleError(_0x9ed937,null));};exports[_0x2b4c('0x50')]=function(_0x2cf1af,_0x428a92){return db['MailQueue'][_0x2b4c('0x50')](_0x2cf1af['body'],{})[_0x2b4c('0x2a')](function(_0x30a16b){var _0x17fd1e=_0x2cf1af['user']['get']({'plain':!![]});if(!_0x17fd1e)throw new Error(_0x2b4c('0x51'));if(_0x17fd1e[_0x2b4c('0x52')]==='user'){var _0x23e486=_0x30a16b[_0x2b4c('0x2c')]({'plain':!![]});var _0x44d046=_0x2b4c('0x2d');return db['UserProfileSection'][_0x2b4c('0x53')]({'where':{'name':_0x44d046,'userProfileId':_0x17fd1e[_0x2b4c('0x54')]},'raw':!![]})[_0x2b4c('0x2a')](function(_0x5f24f6){if(_0x5f24f6&&_0x5f24f6[_0x2b4c('0x55')]===0x0){return db[_0x2b4c('0x2e')][_0x2b4c('0x50')]({'name':_0x23e486['name'],'resourceId':_0x23e486['id'],'type':_0x5f24f6[_0x2b4c('0x31')],'sectionId':_0x5f24f6['id']},{})[_0x2b4c('0x2a')](function(){return _0x30a16b;});}else{return _0x30a16b;}})[_0x2b4c('0x4b')](function(_0x44f314){logger[_0x2b4c('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x44f314);throw _0x44f314;});}return _0x30a16b;})[_0x2b4c('0x2a')](respondWithResult(_0x428a92,0xc9))[_0x2b4c('0x4b')](handleError(_0x428a92,null));};exports['update']=function(_0x27fbec,_0x1b5c0e){if(_0x27fbec[_0x2b4c('0x56')]['id']){delete _0x27fbec[_0x2b4c('0x56')]['id'];}return db['MailQueue'][_0x2b4c('0x53')]({'where':{'id':_0x27fbec[_0x2b4c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1b5c0e,null))[_0x2b4c('0x2a')](saveUpdates(_0x27fbec[_0x2b4c('0x56')],null))[_0x2b4c('0x2a')](respondWithResult(_0x1b5c0e,null))['catch'](handleError(_0x1b5c0e,null));};exports[_0x2b4c('0x2b')]=function(_0x1c0b74,_0x240b56){return db['MailQueue'][_0x2b4c('0x53')]({'where':{'id':_0x1c0b74[_0x2b4c('0x4c')]['id']}})[_0x2b4c('0x2a')](handleEntityNotFound(_0x240b56,null))[_0x2b4c('0x2a')](removeEntity(_0x240b56,null))['catch'](handleError(_0x240b56,null));};exports[_0x2b4c('0x57')]=function(_0x5cfa3c,_0x5e1107){return db[_0x2b4c('0x35')]['describe']()[_0x2b4c('0x2a')](respondWithResult(_0x5e1107,null))[_0x2b4c('0x4b')](handleError(_0x5e1107,null));};exports[_0x2b4c('0x58')]=function(_0xfb5e44,_0x2380ee,_0x91cf95){var _0x235bf9={'raw':!![],'where':{}},_0x17934c={},_0x4fd7b6;return db[_0x2b4c('0x35')][_0x2b4c('0x59')]({'where':{'id':_0xfb5e44['params']['id']}})[_0x2b4c('0x2a')](handleEntityNotFound(_0x2380ee,null))[_0x2b4c('0x2a')](function(_0x2bcb95){if(_0x2bcb95){_0x4fd7b6=_0x2bcb95[_0x2b4c('0x2c')]({'plain':!![]});_0x17934c[_0x2b4c('0x3a')]=_[_0x2b4c('0x4d')](db['UserMailQueue'][_0x2b4c('0x36')]);_0x17934c[_0x2b4c('0x3b')]=_[_0x2b4c('0x4d')](_0xfb5e44[_0x2b4c('0x3b')]);_0x17934c[_0x2b4c('0x3c')]=_[_0x2b4c('0x4e')](_0x17934c[_0x2b4c('0x3a')],_0x17934c[_0x2b4c('0x3b')]);_0x235bf9[_0x2b4c('0x3d')]=_[_0x2b4c('0x4e')](_0x17934c[_0x2b4c('0x3a')],qs[_0x2b4c('0x3e')](_0xfb5e44['query']['fields']));_0x235bf9[_0x2b4c('0x3d')]=_0x235bf9['attributes'][_0x2b4c('0x3f')]?_0x235bf9['attributes']:_0x17934c[_0x2b4c('0x3a')];if(!_0xfb5e44['query']['hasOwnProperty'](_0x2b4c('0x41'))){_0x235bf9[_0x2b4c('0x26')]=qs[_0x2b4c('0x26')](_0xfb5e44[_0x2b4c('0x3b')][_0x2b4c('0x26')]);_0x235bf9['offset']=qs[_0x2b4c('0x24')](_0xfb5e44['query'][_0x2b4c('0x24')]);}_0x235bf9[_0x2b4c('0x42')]=qs['sort'](_0xfb5e44['query'][_0x2b4c('0x43')]);_0x235bf9['where']=qs[_0x2b4c('0x3c')](_['pick'](_0xfb5e44['query'],_0x17934c[_0x2b4c('0x3c')]));_0x235bf9[_0x2b4c('0x44')][_0x2b4c('0x5a')]=_0x2bcb95['id'];if(_0xfb5e44[_0x2b4c('0x3b')][_0x2b4c('0x45')]){_0x235bf9['where']=_[_0x2b4c('0x46')](_0x235bf9[_0x2b4c('0x44')],{'$or':_[_0x2b4c('0x34')](_0x235bf9[_0x2b4c('0x3d')],function(_0x4351b2){var _0xa0162c={};_0xa0162c[_0x4351b2]={'$like':'%'+_0xfb5e44[_0x2b4c('0x3b')][_0x2b4c('0x45')]+'%'};return _0xa0162c;})});}_0x235bf9=_[_0x2b4c('0x46')]({},_0x235bf9,_0xfb5e44['options']);return db[_0x2b4c('0x5b')][_0x2b4c('0x5c')](_0x235bf9);}})['then'](function(_0x232c2b){if(_0x232c2b){return db[_0x2b4c('0x5d')][_0x2b4c('0x5e')]({'where':{'id':_[_0x2b4c('0x34')](_0x232c2b,_0x2b4c('0x5f')),'role':_0x2b4c('0x60')},'attributes':['id',_0x2b4c('0x31'),_0x2b4c('0x61'),_0x2b4c('0x62'),_0x2b4c('0x63')]});}})[_0x2b4c('0x2a')](function(_0x48815b){if(_0x48815b){return{'count':_0x48815b['count'],'rows':_[_0x2b4c('0x34')](_0x48815b[_0x2b4c('0x4a')],function(_0x1af7d5){return{'membername':_0x1af7d5[_0x2b4c('0x31')],'UserId':_0x1af7d5['id'],'queue_name':_0x4fd7b6[_0x2b4c('0x31')],'MailQueueId':_0x4fd7b6['id'],'interface':util['format'](_0x2b4c('0x64'),_0x2b4c('0x65'),_0x1af7d5[_0x2b4c('0x31')]),'penalty':0x0,'paused':_0x1af7d5['mailPause'],'createdAt':_0x1af7d5[_0x2b4c('0x63')],'updatedAt':_0x1af7d5[_0x2b4c('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2b4c('0x2a')](respondWithFilteredResult(_0x2380ee,_0x235bf9))[_0x2b4c('0x4b')](handleError(_0x2380ee,null));};exports[_0x2b4c('0x66')]=function(_0x131c65,_0xbc5450,_0x23349d){var _0x5b8bbc={};var _0x19ad86={};var _0xb82a8f;var _0x104580;return db[_0x2b4c('0x35')][_0x2b4c('0x59')]({'where':{'id':_0x131c65['params']['id']}})[_0x2b4c('0x2a')](handleEntityNotFound(_0xbc5450,null))[_0x2b4c('0x2a')](function(_0x3b3acf){if(_0x3b3acf){_0xb82a8f=_0x3b3acf;_0x19ad86['model']=_['keys'](db[_0x2b4c('0x67')]['rawAttributes']);_0x19ad86[_0x2b4c('0x3b')]=_[_0x2b4c('0x4d')](_0x131c65['query']);_0x19ad86[_0x2b4c('0x3c')]=_['intersection'](_0x19ad86[_0x2b4c('0x3a')],_0x19ad86[_0x2b4c('0x3b')]);_0x5b8bbc['attributes']=_[_0x2b4c('0x4e')](_0x19ad86['model'],qs['fields'](_0x131c65[_0x2b4c('0x3b')]['fields']));_0x5b8bbc['attributes']=_0x5b8bbc[_0x2b4c('0x3d')][_0x2b4c('0x3f')]?_0x5b8bbc[_0x2b4c('0x3d')]:_0x19ad86['model'];_0x5b8bbc[_0x2b4c('0x42')]=qs[_0x2b4c('0x43')](_0x131c65[_0x2b4c('0x3b')][_0x2b4c('0x43')]);_0x5b8bbc[_0x2b4c('0x44')]=qs[_0x2b4c('0x3c')](_[_0x2b4c('0x68')](_0x131c65[_0x2b4c('0x3b')],_0x19ad86[_0x2b4c('0x3c')]));if(_0x131c65[_0x2b4c('0x3b')][_0x2b4c('0x45')]){_0x5b8bbc[_0x2b4c('0x44')]=_[_0x2b4c('0x46')](_0x5b8bbc[_0x2b4c('0x44')],{'$or':_[_0x2b4c('0x34')](_0x5b8bbc['attributes'],function(_0x5c2886){var _0x2db23b={};_0x2db23b[_0x5c2886]={'$like':'%'+_0x131c65[_0x2b4c('0x3b')]['filter']+'%'};return _0x2db23b;})});}_0x5b8bbc=_[_0x2b4c('0x46')]({},_0x5b8bbc,_0x131c65[_0x2b4c('0x4f')]);return _0xb82a8f[_0x2b4c('0x66')](_0x5b8bbc);}})[_0x2b4c('0x2a')](function(_0x19b063){if(_0x19b063){_0x104580=_0x19b063[_0x2b4c('0x3f')];if(!_0x131c65['query'][_0x2b4c('0x40')](_0x2b4c('0x41'))){_0x5b8bbc[_0x2b4c('0x26')]=qs[_0x2b4c('0x26')](_0x131c65[_0x2b4c('0x3b')][_0x2b4c('0x26')]);_0x5b8bbc['offset']=qs[_0x2b4c('0x24')](_0x131c65[_0x2b4c('0x3b')][_0x2b4c('0x24')]);}return _0xb82a8f['getTeams'](_0x5b8bbc);}})[_0x2b4c('0x2a')](function(_0xf3adf){if(_0xf3adf){return _0xf3adf?{'count':_0x104580,'rows':_0xf3adf}:null;}})[_0x2b4c('0x2a')](respondWithResult(_0xbc5450,null))[_0x2b4c('0x4b')](handleError(_0xbc5450,null));};exports[_0x2b4c('0x69')]=function(_0x5e2639,_0x499177,_0x38cada){var _0x17fe6a=_0x5e2639[_0x2b4c('0x56')]['ids'];return db['Team'][_0x2b4c('0x5c')]({'where':{'id':_0x17fe6a},'attributes':['id'],'include':[{'model':db[_0x2b4c('0x5d')],'as':_0x2b4c('0x6a'),'attributes':['id',_0x2b4c('0x31'),_0x2b4c('0x6b'),'voicePause',_0x2b4c('0x6c')],'raw':!![]}]})[_0x2b4c('0x2a')](function(_0x4d3b41){if(_0x4d3b41){var _0x415718=_[_0x2b4c('0x6d')](_0x4d3b41,function(_0x10cd7c){var _0x2d5bff=_0x10cd7c['get']({'plain':!![]});return _0x2d5bff[_0x2b4c('0x6a')];});return db['MailQueue'][_0x2b4c('0x53')]({'where':{'id':_0x5e2639[_0x2b4c('0x4c')]['id']}})[_0x2b4c('0x2a')](function(_0x552b0c){return db[_0x2b4c('0x6e')][_0x2b4c('0x6f')](function(_0x387b15){return _0x552b0c[_0x2b4c('0x69')](_0x17fe6a,{'transaction':_0x387b15})[_0x2b4c('0x2a')](function(){return BPromise[_0x2b4c('0x70')](_0x415718,function(_0xcb97e7){return db['UserMailQueue'][_0x2b4c('0x71')]({'where':{'UserId':_0xcb97e7['id'],'MailQueueId':_0x5e2639['params']['id']},'transaction':_0x387b15});});})[_0x2b4c('0x2a')](function(){_0x415718[_0x2b4c('0x72')](function(_0x16cb16){socket[_0x2b4c('0x73')](_0x2b4c('0x74'),{'UserId':_0x16cb16['id'],'MailQueueId':_0x552b0c['id']});});});});});}})[_0x2b4c('0x2a')](respondWithStatusCode(_0x499177,null))[_0x2b4c('0x4b')](handleError(_0x499177,null));};exports[_0x2b4c('0x75')]=function(_0x5b30b8,_0x3551fd,_0x54c8df){return db['Team'][_0x2b4c('0x5c')]({'where':{'id':_0x5b30b8['query'][_0x2b4c('0x76')]},'attributes':['id'],'include':[{'model':db[_0x2b4c('0x5d')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x2b4c('0x2a')](handleEntityNotFound(_0x3551fd,null))[_0x2b4c('0x2a')](function(_0x4d3611){var _0x562117=_[_0x2b4c('0x34')](_0x4d3611,'id');var _0x5bf78c=[];var _0x359ac6=[];var _0x4be5d3=squel[_0x2b4c('0x77')]();_0x4be5d3[_0x2b4c('0x78')](_0x2b4c('0x79'))[_0x2b4c('0x7a')]('team_has_mail_queues','tq')[_0x2b4c('0x7b')](_0x2b4c('0x7c'),'ut',_0x2b4c('0x7d'))[_0x2b4c('0x44')](_0x2b4c('0x7e'),_0x5b30b8[_0x2b4c('0x4c')]['id']);for(var _0x1660a5=0x0;_0x1660a5<_0x4d3611[_0x2b4c('0x3f')];_0x1660a5+=0x1){let _0x6113ef=_0x4d3611[_0x1660a5];for(var _0x3bb82d=0x0;_0x3bb82d<_0x6113ef[_0x2b4c('0x6a')][_0x2b4c('0x3f')];_0x3bb82d+=0x1){let _0x1c2864=_0x6113ef[_0x2b4c('0x6a')][_0x3bb82d];var _0x534e70=_0x4be5d3['clone']();_0x534e70[_0x2b4c('0x44')](_0x2b4c('0x7f'),_0x1c2864['id']);_0x359ac6['push'](db[_0x2b4c('0x6e')][_0x2b4c('0x3b')](_0x534e70[_0x2b4c('0x80')](),{'type':db[_0x2b4c('0x6e')][_0x2b4c('0x81')][_0x2b4c('0x82')]})['then'](function(_0x30549a){if(_0x30549a[_0x2b4c('0x3f')]===0x1){return _0x1c2864['id'];}else{var _0x3c2420=_['every'](_[_0x2b4c('0x34')](_0x30549a,_0x2b4c('0x83')),function(_0x6d37c9){return _[_0x2b4c('0x84')](_0x562117,_0x6d37c9);});if(_0x3c2420){return _0x1c2864['id'];}}}));}}return BPromise[_0x2b4c('0x85')](_0x359ac6)[_0x2b4c('0x2a')](function(_0x48db04){_0x5bf78c=_(_0x5bf78c)['union'](_0x48db04)['compact']()[_0x2b4c('0x86')]();return db[_0x2b4c('0x35')][_0x2b4c('0x53')]({'where':{'id':_0x5b30b8['params']['id']}})[_0x2b4c('0x2a')](function(_0x50e384){return db['sequelize'][_0x2b4c('0x6f')](function(_0x56cac1){return _0x50e384['removeTeams'](_0x5b30b8[_0x2b4c('0x3b')][_0x2b4c('0x76')],{'transaction':_0x56cac1})['then'](function(){if(!_[_0x2b4c('0x87')](_0x5bf78c)){return _0x50e384[_0x2b4c('0x88')](_0x5bf78c,{'transaction':_0x56cac1});}})[_0x2b4c('0x2a')](function(){_0x5bf78c[_0x2b4c('0x72')](function(_0x540498){socket[_0x2b4c('0x73')](_0x2b4c('0x89'),{'UserId':_0x540498,'MailQueueId':_0x50e384['id']});});});});});});})['then'](respondWithStatusCode(_0x3551fd,null))[_0x2b4c('0x4b')](handleError(_0x3551fd,null));};exports[_0x2b4c('0x8a')]=function(_0x967c76,_0x1f878d,_0x25e212){return db[_0x2b4c('0x35')][_0x2b4c('0x53')]({'where':{'id':_0x967c76['params']['id']}})['then'](handleEntityNotFound(_0x1f878d,null))[_0x2b4c('0x2a')](function(_0x2d0613){if(_0x2d0613){return _0x2d0613['addAgents'](_0x967c76[_0x2b4c('0x56')][_0x2b4c('0x76')],_[_0x2b4c('0x8b')](_0x967c76[_0x2b4c('0x56')],[_0x2b4c('0x76'),'id'])||{})[_0x2b4c('0x8c')](function(_0x3c91c0){for(var _0xd6e0d=0x0;_0xd6e0d<_0x967c76[_0x2b4c('0x56')]['ids'][_0x2b4c('0x3f')];_0xd6e0d+=0x1){socket[_0x2b4c('0x73')](_0x2b4c('0x74'),{'UserId':Number(_0x967c76[_0x2b4c('0x56')][_0x2b4c('0x76')][_0xd6e0d]),'MailQueueId':Number(_0x967c76['params']['id'])});}return _0x3c91c0;});}})[_0x2b4c('0x2a')](respondWithResult(_0x1f878d,null))[_0x2b4c('0x4b')](handleError(_0x1f878d,null));};exports[_0x2b4c('0x88')]=function(_0x1283b5,_0x232ea9,_0x38d423){return db[_0x2b4c('0x35')]['find']({'where':{'id':_0x1283b5[_0x2b4c('0x4c')]['id']}})[_0x2b4c('0x2a')](handleEntityNotFound(_0x232ea9,null))['then'](function(_0x289abb){if(_0x289abb){return _0x289abb[_0x2b4c('0x88')](_0x1283b5[_0x2b4c('0x3b')][_0x2b4c('0x76')])[_0x2b4c('0x2a')](function(){if(_[_0x2b4c('0x8d')](_0x1283b5['query']['ids'])){for(var _0x5cbc59=0x0;_0x5cbc59<_0x1283b5['query'][_0x2b4c('0x76')][_0x2b4c('0x3f')];_0x5cbc59+=0x1){socket[_0x2b4c('0x73')](_0x2b4c('0x89'),{'UserId':Number(_0x1283b5[_0x2b4c('0x3b')][_0x2b4c('0x76')][_0x5cbc59]),'MailQueueId':Number(_0x1283b5[_0x2b4c('0x4c')]['id'])});}}else{socket[_0x2b4c('0x73')]('userMailQueue:remove',{'UserId':Number(_0x1283b5['query']['ids']),'MailQueueId':Number(_0x1283b5['params']['id'])});}});}})[_0x2b4c('0x2a')](respondWithStatusCode(_0x232ea9,null))[_0x2b4c('0x4b')](handleError(_0x232ea9,null));};exports['getAgents']=function(_0x48ee2c,_0x22b95d,_0x360194){var _0x2aaa5e={};var _0x27948d={};var _0x87d99b;var _0x4149e1;return db[_0x2b4c('0x35')][_0x2b4c('0x59')]({'where':{'id':_0x48ee2c[_0x2b4c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x22b95d,null))[_0x2b4c('0x2a')](function(_0x4e309e){if(_0x4e309e){_0x87d99b=_0x4e309e;_0x27948d['model']=_[_0x2b4c('0x4d')](db[_0x2b4c('0x5d')][_0x2b4c('0x36')]);_0x27948d[_0x2b4c('0x3b')]=_[_0x2b4c('0x4d')](_0x48ee2c[_0x2b4c('0x3b')]);_0x27948d[_0x2b4c('0x3c')]=_[_0x2b4c('0x4e')](_0x27948d[_0x2b4c('0x3a')],_0x27948d[_0x2b4c('0x3b')]);_0x2aaa5e['attributes']=_[_0x2b4c('0x4e')](_0x27948d[_0x2b4c('0x3a')],qs['fields'](_0x48ee2c['query'][_0x2b4c('0x3e')]));_0x2aaa5e[_0x2b4c('0x3d')]=_0x2aaa5e[_0x2b4c('0x3d')][_0x2b4c('0x3f')]?_0x2aaa5e[_0x2b4c('0x3d')]:_0x27948d[_0x2b4c('0x3a')];_0x2aaa5e['order']=qs[_0x2b4c('0x43')](_0x48ee2c[_0x2b4c('0x3b')][_0x2b4c('0x43')]);_0x2aaa5e['where']=qs[_0x2b4c('0x3c')](_[_0x2b4c('0x68')](_0x48ee2c[_0x2b4c('0x3b')],_0x27948d[_0x2b4c('0x3c')]));if(_0x48ee2c['query'][_0x2b4c('0x45')]){_0x2aaa5e[_0x2b4c('0x44')]=_[_0x2b4c('0x46')](_0x2aaa5e['where'],{'$or':_[_0x2b4c('0x34')](_0x2aaa5e['attributes'],function(_0x2c0738){var _0x134f07={};_0x134f07[_0x2c0738]={'$like':'%'+_0x48ee2c[_0x2b4c('0x3b')][_0x2b4c('0x45')]+'%'};return _0x134f07;})});}_0x2aaa5e=_['merge']({},_0x2aaa5e,_0x48ee2c['options']);return _0x87d99b[_0x2b4c('0x8e')](_0x2aaa5e);}})[_0x2b4c('0x2a')](function(_0x9565e7){if(_0x9565e7){_0x4149e1=_0x9565e7[_0x2b4c('0x3f')];if(!_0x48ee2c[_0x2b4c('0x3b')][_0x2b4c('0x40')]('nolimit')){_0x2aaa5e[_0x2b4c('0x26')]=qs[_0x2b4c('0x26')](_0x48ee2c[_0x2b4c('0x3b')][_0x2b4c('0x26')]);_0x2aaa5e[_0x2b4c('0x24')]=qs[_0x2b4c('0x24')](_0x48ee2c[_0x2b4c('0x3b')]['offset']);}return _0x87d99b[_0x2b4c('0x8e')](_0x2aaa5e);}})[_0x2b4c('0x2a')](function(_0x28cf3a){if(_0x28cf3a){return _0x28cf3a?{'count':_0x4149e1,'rows':_0x28cf3a}:null;}})[_0x2b4c('0x2a')](respondWithResult(_0x22b95d,null))[_0x2b4c('0x4b')](handleError(_0x22b95d,null));}; \ No newline at end of file +var _0x16f9=['forEach','emit','userMailQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','removeAgents','userMailQueue:remove','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','type','key','keys','filters','intersection','model','fields','query','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','role','MailQueues','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getMembers','findOne','UserMailQueue','nolimit','order','MailQueueId','User','UserId','agent','mailPause','createdAt','format','%s/%s','updatedAt','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each'];(function(_0x51233a,_0x32615e){var _0x43b241=function(_0x1af996){while(--_0x1af996){_0x51233a['push'](_0x51233a['shift']());}};_0x43b241(++_0x32615e);}(_0x16f9,0xae));var _0x916f=function(_0x48bc12,_0x552810){_0x48bc12=_0x48bc12-0x0;var _0x5c9033=_0x16f9[_0x48bc12];return _0x5c9033;};'use strict';var emlformat=require(_0x916f('0x0'));var rimraf=require(_0x916f('0x1'));var zipdir=require(_0x916f('0x2'));var jsonpatch=require(_0x916f('0x3'));var rp=require(_0x916f('0x4'));var moment=require(_0x916f('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x916f('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x916f('0x7'));var ejs=require(_0x916f('0x8'));var fs=require('fs');var fs_extra=require(_0x916f('0x9'));var _=require(_0x916f('0xa'));var squel=require(_0x916f('0xb'));var crypto=require(_0x916f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x916f('0xd'));var toCsv=require(_0x916f('0x7'));var querystring=require(_0x916f('0xe'));var Papa=require(_0x916f('0xf'));var Redis=require(_0x916f('0x10'));var authService=require(_0x916f('0x11'));var qs=require(_0x916f('0x12'));var as=require(_0x916f('0x13'));var hardwareService=require(_0x916f('0x14'));var logger=require(_0x916f('0x15'))(_0x916f('0x16'));var utils=require('../../config/utils');var config=require(_0x916f('0x17'));var licenseUtil=require(_0x916f('0x18'));var db=require(_0x916f('0x19'))['db'];config[_0x916f('0x1a')]=_[_0x916f('0x1b')](config[_0x916f('0x1a')],{'host':_0x916f('0x1c'),'port':0x18eb});var socket=require(_0x916f('0x1d'))(new Redis(config['redis']));require(_0x916f('0x1e'))[_0x916f('0x1f')](socket);function respondWithStatusCode(_0x1f0750,_0x45fc09){_0x45fc09=_0x45fc09||0xcc;return function(_0x4b3727){if(_0x4b3727){return _0x1f0750[_0x916f('0x20')](_0x45fc09);}return _0x1f0750[_0x916f('0x21')](_0x45fc09)[_0x916f('0x22')]();};}function respondWithResult(_0x26c304,_0x3af04c){_0x3af04c=_0x3af04c||0xc8;return function(_0x581f04){if(_0x581f04){return _0x26c304[_0x916f('0x21')](_0x3af04c)[_0x916f('0x23')](_0x581f04);}};}function respondWithFilteredResult(_0x464ef4,_0x3326b3){return function(_0x3d547e){if(_0x3d547e){var _0x27716a=typeof _0x3326b3['offset']===_0x916f('0x24')&&typeof _0x3326b3[_0x916f('0x25')]===_0x916f('0x24');var _0x1c52f1=_0x3d547e[_0x916f('0x26')];var _0x26c591=_0x27716a?0x0:_0x3326b3[_0x916f('0x27')];var _0x5d6c45=_0x27716a?_0x3d547e[_0x916f('0x26')]:_0x3326b3[_0x916f('0x27')]+_0x3326b3[_0x916f('0x25')];var _0x2b0b4e;if(_0x5d6c45>=_0x1c52f1){_0x5d6c45=_0x1c52f1;_0x2b0b4e=0xc8;}else{_0x2b0b4e=0xce;}_0x464ef4[_0x916f('0x21')](_0x2b0b4e);return _0x464ef4['set']('Content-Range',_0x26c591+'-'+_0x5d6c45+'/'+_0x1c52f1)[_0x916f('0x23')](_0x3d547e);}return null;};}function patchUpdates(_0xac7d3a){return function(_0x28c271){try{jsonpatch[_0x916f('0x28')](_0x28c271,_0xac7d3a,!![]);}catch(_0x1b7f95){return BPromise[_0x916f('0x29')](_0x1b7f95);}return _0x28c271['save']();};}function saveUpdates(_0x4bd847,_0x306642){return function(_0x21c95d){if(_0x21c95d){return _0x21c95d['update'](_0x4bd847)[_0x916f('0x2a')](function(_0x53982e){return _0x53982e;});}return null;};}function removeEntity(_0x6806fc,_0x21a2f1){return function(_0x4312a9){if(_0x4312a9){return _0x4312a9[_0x916f('0x2b')]()[_0x916f('0x2a')](function(){var _0x33c25d=_0x4312a9[_0x916f('0x2c')]({'plain':!![]});var _0x60f106='MailQueues';return db[_0x916f('0x2d')][_0x916f('0x2b')]({'where':{'type':_0x60f106,'resourceId':_0x33c25d['id']}})[_0x916f('0x2a')](function(){return _0x4312a9;});})[_0x916f('0x2a')](function(){_0x6806fc[_0x916f('0x21')](0xcc)[_0x916f('0x22')]();});}};}function handleEntityNotFound(_0x2edd35,_0x46fd3c){return function(_0x431e7e){if(!_0x431e7e){_0x2edd35['sendStatus'](0x194);}return _0x431e7e;};}function handleError(_0x37f671,_0x56ed44){_0x56ed44=_0x56ed44||0x1f4;return function(_0x152b9b){logger[_0x916f('0x2e')](_0x152b9b[_0x916f('0x2f')]);if(_0x152b9b['name']){delete _0x152b9b[_0x916f('0x30')];}_0x37f671[_0x916f('0x21')](_0x56ed44)[_0x916f('0x31')](_0x152b9b);};}exports[_0x916f('0x32')]=function(_0x2389e2,_0x631905){var _0x25ff8f={},_0x19e349={},_0x3263ac={'count':0x0,'rows':[]};var _0x1d93e9=_[_0x916f('0x33')](db[_0x916f('0x34')][_0x916f('0x35')],function(_0x52f8e3){return{'name':_0x52f8e3[_0x916f('0x36')],'type':_0x52f8e3[_0x916f('0x37')][_0x916f('0x38')]};});_0x19e349['model']=_[_0x916f('0x33')](_0x1d93e9,'name');_0x19e349['query']=_[_0x916f('0x39')](_0x2389e2['query']);_0x19e349[_0x916f('0x3a')]=_[_0x916f('0x3b')](_0x19e349[_0x916f('0x3c')],_0x19e349['query']);_0x25ff8f['attributes']=_[_0x916f('0x3b')](_0x19e349[_0x916f('0x3c')],qs[_0x916f('0x3d')](_0x2389e2[_0x916f('0x3e')][_0x916f('0x3d')]));_0x25ff8f['attributes']=_0x25ff8f[_0x916f('0x3f')][_0x916f('0x40')]?_0x25ff8f[_0x916f('0x3f')]:_0x19e349[_0x916f('0x3c')];if(!_0x2389e2['query'][_0x916f('0x41')]('nolimit')){_0x25ff8f[_0x916f('0x25')]=qs[_0x916f('0x25')](_0x2389e2['query'][_0x916f('0x25')]);_0x25ff8f[_0x916f('0x27')]=qs[_0x916f('0x27')](_0x2389e2[_0x916f('0x3e')][_0x916f('0x27')]);}_0x25ff8f['order']=qs[_0x916f('0x42')](_0x2389e2[_0x916f('0x3e')][_0x916f('0x42')]);_0x25ff8f[_0x916f('0x43')]=qs[_0x916f('0x3a')](_[_0x916f('0x44')](_0x2389e2[_0x916f('0x3e')],_0x19e349[_0x916f('0x3a')]),_0x1d93e9);if(_0x2389e2['query'][_0x916f('0x45')]){_0x25ff8f[_0x916f('0x43')]=_[_0x916f('0x46')](_0x25ff8f[_0x916f('0x43')],{'$or':_[_0x916f('0x33')](_0x1d93e9,function(_0x1c35eb){if(_0x1c35eb[_0x916f('0x37')]!==_0x916f('0x47')){var _0x1927e9={};_0x1927e9[_0x1c35eb['name']]={'$like':'%'+_0x2389e2['query'][_0x916f('0x45')]+'%'};return _0x1927e9;}})});}_0x25ff8f=_[_0x916f('0x46')]({},_0x25ff8f,_0x2389e2[_0x916f('0x48')]);var _0x571078={'where':_0x25ff8f[_0x916f('0x43')]};return db[_0x916f('0x34')][_0x916f('0x26')](_0x571078)[_0x916f('0x2a')](function(_0x2d95af){_0x3263ac[_0x916f('0x26')]=_0x2d95af;if(_0x2389e2[_0x916f('0x3e')]['includeAll']){_0x25ff8f[_0x916f('0x49')]=[{'all':!![]}];}return db[_0x916f('0x34')][_0x916f('0x4a')](_0x25ff8f);})[_0x916f('0x2a')](function(_0x39a628){_0x3263ac[_0x916f('0x4b')]=_0x39a628;return _0x3263ac;})['then'](respondWithFilteredResult(_0x631905,_0x25ff8f))[_0x916f('0x4c')](handleError(_0x631905,null));};exports[_0x916f('0x4d')]=function(_0x4284f3,_0x1f7246){var _0x2e4257={'raw':!![],'where':{'id':_0x4284f3[_0x916f('0x4e')]['id']}},_0x44bf50={};_0x44bf50[_0x916f('0x3c')]=_[_0x916f('0x39')](db[_0x916f('0x34')][_0x916f('0x35')]);_0x44bf50[_0x916f('0x3e')]=_[_0x916f('0x39')](_0x4284f3[_0x916f('0x3e')]);_0x44bf50[_0x916f('0x3a')]=_[_0x916f('0x3b')](_0x44bf50['model'],_0x44bf50[_0x916f('0x3e')]);_0x2e4257[_0x916f('0x3f')]=_[_0x916f('0x3b')](_0x44bf50[_0x916f('0x3c')],qs[_0x916f('0x3d')](_0x4284f3['query'][_0x916f('0x3d')]));_0x2e4257['attributes']=_0x2e4257[_0x916f('0x3f')][_0x916f('0x40')]?_0x2e4257['attributes']:_0x44bf50[_0x916f('0x3c')];if(_0x4284f3['query'][_0x916f('0x4f')]){_0x2e4257[_0x916f('0x49')]=[{'all':!![]}];}_0x2e4257=_[_0x916f('0x46')]({},_0x2e4257,_0x4284f3[_0x916f('0x48')]);return db[_0x916f('0x34')][_0x916f('0x50')](_0x2e4257)[_0x916f('0x2a')](handleEntityNotFound(_0x1f7246,null))[_0x916f('0x2a')](respondWithResult(_0x1f7246,null))[_0x916f('0x4c')](handleError(_0x1f7246,null));};exports[_0x916f('0x51')]=function(_0x8035c9,_0x173498){return db[_0x916f('0x34')][_0x916f('0x51')](_0x8035c9[_0x916f('0x52')],{})['then'](function(_0x290ef2){var _0x3fcff1=_0x8035c9[_0x916f('0x53')]['get']({'plain':!![]});if(!_0x3fcff1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3fcff1[_0x916f('0x54')]==='user'){var _0x9bb33a=_0x290ef2['get']({'plain':!![]});var _0x4d13bc=_0x916f('0x55');return db['UserProfileSection'][_0x916f('0x50')]({'where':{'name':_0x4d13bc,'userProfileId':_0x3fcff1[_0x916f('0x56')]},'raw':!![]})['then'](function(_0x543550){if(_0x543550&&_0x543550[_0x916f('0x57')]===0x0){return db[_0x916f('0x2d')][_0x916f('0x51')]({'name':_0x9bb33a[_0x916f('0x30')],'resourceId':_0x9bb33a['id'],'type':_0x543550[_0x916f('0x30')],'sectionId':_0x543550['id']},{})[_0x916f('0x2a')](function(){return _0x290ef2;});}else{return _0x290ef2;}})['catch'](function(_0x5db015){logger[_0x916f('0x2e')](_0x916f('0x58'),_0x5db015);throw _0x5db015;});}return _0x290ef2;})[_0x916f('0x2a')](respondWithResult(_0x173498,0xc9))['catch'](handleError(_0x173498,null));};exports[_0x916f('0x59')]=function(_0x487c1d,_0x32d385){if(_0x487c1d[_0x916f('0x52')]['id']){delete _0x487c1d[_0x916f('0x52')]['id'];}return db['MailQueue'][_0x916f('0x50')]({'where':{'id':_0x487c1d['params']['id']}})['then'](handleEntityNotFound(_0x32d385,null))[_0x916f('0x2a')](saveUpdates(_0x487c1d[_0x916f('0x52')],null))[_0x916f('0x2a')](respondWithResult(_0x32d385,null))[_0x916f('0x4c')](handleError(_0x32d385,null));};exports[_0x916f('0x2b')]=function(_0x3d526e,_0x13d2d3){return db[_0x916f('0x34')][_0x916f('0x50')]({'where':{'id':_0x3d526e[_0x916f('0x4e')]['id']}})[_0x916f('0x2a')](handleEntityNotFound(_0x13d2d3,null))[_0x916f('0x2a')](removeEntity(_0x13d2d3,null))['catch'](handleError(_0x13d2d3,null));};exports['describe']=function(_0x3cf4c2,_0x3873dd){return db[_0x916f('0x34')]['describe']()['then'](respondWithResult(_0x3873dd,null))[_0x916f('0x4c')](handleError(_0x3873dd,null));};exports[_0x916f('0x5a')]=function(_0x18b956,_0x4f0981,_0x5be2f2){var _0x1422e6={'raw':!![],'where':{}},_0x230abe={},_0x52244b;return db[_0x916f('0x34')][_0x916f('0x5b')]({'where':{'id':_0x18b956['params']['id']}})['then'](handleEntityNotFound(_0x4f0981,null))[_0x916f('0x2a')](function(_0x57d2e2){if(_0x57d2e2){_0x52244b=_0x57d2e2[_0x916f('0x2c')]({'plain':!![]});_0x230abe['model']=_[_0x916f('0x39')](db[_0x916f('0x5c')]['rawAttributes']);_0x230abe[_0x916f('0x3e')]=_[_0x916f('0x39')](_0x18b956[_0x916f('0x3e')]);_0x230abe['filters']=_['intersection'](_0x230abe[_0x916f('0x3c')],_0x230abe[_0x916f('0x3e')]);_0x1422e6[_0x916f('0x3f')]=_[_0x916f('0x3b')](_0x230abe[_0x916f('0x3c')],qs['fields'](_0x18b956['query'][_0x916f('0x3d')]));_0x1422e6[_0x916f('0x3f')]=_0x1422e6[_0x916f('0x3f')][_0x916f('0x40')]?_0x1422e6[_0x916f('0x3f')]:_0x230abe['model'];if(!_0x18b956['query']['hasOwnProperty'](_0x916f('0x5d'))){_0x1422e6['limit']=qs['limit'](_0x18b956['query'][_0x916f('0x25')]);_0x1422e6['offset']=qs[_0x916f('0x27')](_0x18b956[_0x916f('0x3e')][_0x916f('0x27')]);}_0x1422e6[_0x916f('0x5e')]=qs[_0x916f('0x42')](_0x18b956[_0x916f('0x3e')][_0x916f('0x42')]);_0x1422e6['where']=qs[_0x916f('0x3a')](_[_0x916f('0x44')](_0x18b956[_0x916f('0x3e')],_0x230abe['filters']));_0x1422e6[_0x916f('0x43')][_0x916f('0x5f')]=_0x57d2e2['id'];if(_0x18b956[_0x916f('0x3e')]['filter']){_0x1422e6[_0x916f('0x43')]=_['merge'](_0x1422e6['where'],{'$or':_['map'](_0x1422e6['attributes'],function(_0x3cee98){var _0xcb0f0f={};_0xcb0f0f[_0x3cee98]={'$like':'%'+_0x18b956['query'][_0x916f('0x45')]+'%'};return _0xcb0f0f;})});}_0x1422e6=_[_0x916f('0x46')]({},_0x1422e6,_0x18b956[_0x916f('0x48')]);return db[_0x916f('0x5c')][_0x916f('0x4a')](_0x1422e6);}})[_0x916f('0x2a')](function(_0x4a78b1){if(_0x4a78b1){return db[_0x916f('0x60')]['findAndCountAll']({'where':{'id':_[_0x916f('0x33')](_0x4a78b1,_0x916f('0x61')),'role':_0x916f('0x62')},'attributes':['id','name',_0x916f('0x63'),'updatedAt',_0x916f('0x64')]});}})[_0x916f('0x2a')](function(_0x3d26a9){if(_0x3d26a9){return{'count':_0x3d26a9[_0x916f('0x26')],'rows':_[_0x916f('0x33')](_0x3d26a9[_0x916f('0x4b')],function(_0x4a33c3){return{'membername':_0x4a33c3[_0x916f('0x30')],'UserId':_0x4a33c3['id'],'queue_name':_0x52244b[_0x916f('0x30')],'MailQueueId':_0x52244b['id'],'interface':util[_0x916f('0x65')](_0x916f('0x66'),'SIP',_0x4a33c3[_0x916f('0x30')]),'penalty':0x0,'paused':_0x4a33c3[_0x916f('0x63')],'createdAt':_0x4a33c3[_0x916f('0x64')],'updatedAt':_0x4a33c3[_0x916f('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x916f('0x2a')](respondWithFilteredResult(_0x4f0981,_0x1422e6))[_0x916f('0x4c')](handleError(_0x4f0981,null));};exports[_0x916f('0x68')]=function(_0x135fc8,_0x3cc3c7,_0x24ea41){var _0x42f9ff={};var _0x128b75={};var _0x46ca00;var _0x4d45ad;return db[_0x916f('0x34')][_0x916f('0x5b')]({'where':{'id':_0x135fc8[_0x916f('0x4e')]['id']}})[_0x916f('0x2a')](handleEntityNotFound(_0x3cc3c7,null))[_0x916f('0x2a')](function(_0x107a17){if(_0x107a17){_0x46ca00=_0x107a17;_0x128b75[_0x916f('0x3c')]=_['keys'](db[_0x916f('0x69')][_0x916f('0x35')]);_0x128b75['query']=_[_0x916f('0x39')](_0x135fc8[_0x916f('0x3e')]);_0x128b75[_0x916f('0x3a')]=_[_0x916f('0x3b')](_0x128b75[_0x916f('0x3c')],_0x128b75[_0x916f('0x3e')]);_0x42f9ff[_0x916f('0x3f')]=_[_0x916f('0x3b')](_0x128b75[_0x916f('0x3c')],qs[_0x916f('0x3d')](_0x135fc8[_0x916f('0x3e')][_0x916f('0x3d')]));_0x42f9ff[_0x916f('0x3f')]=_0x42f9ff[_0x916f('0x3f')][_0x916f('0x40')]?_0x42f9ff[_0x916f('0x3f')]:_0x128b75[_0x916f('0x3c')];_0x42f9ff[_0x916f('0x5e')]=qs['sort'](_0x135fc8[_0x916f('0x3e')][_0x916f('0x42')]);_0x42f9ff[_0x916f('0x43')]=qs['filters'](_[_0x916f('0x44')](_0x135fc8[_0x916f('0x3e')],_0x128b75[_0x916f('0x3a')]));if(_0x135fc8[_0x916f('0x3e')]['filter']){_0x42f9ff[_0x916f('0x43')]=_[_0x916f('0x46')](_0x42f9ff['where'],{'$or':_['map'](_0x42f9ff[_0x916f('0x3f')],function(_0x475561){var _0x1d79c5={};_0x1d79c5[_0x475561]={'$like':'%'+_0x135fc8[_0x916f('0x3e')][_0x916f('0x45')]+'%'};return _0x1d79c5;})});}_0x42f9ff=_[_0x916f('0x46')]({},_0x42f9ff,_0x135fc8[_0x916f('0x48')]);return _0x46ca00[_0x916f('0x68')](_0x42f9ff);}})['then'](function(_0x4e815b){if(_0x4e815b){_0x4d45ad=_0x4e815b[_0x916f('0x40')];if(!_0x135fc8[_0x916f('0x3e')]['hasOwnProperty'](_0x916f('0x5d'))){_0x42f9ff['limit']=qs['limit'](_0x135fc8[_0x916f('0x3e')][_0x916f('0x25')]);_0x42f9ff[_0x916f('0x27')]=qs[_0x916f('0x27')](_0x135fc8[_0x916f('0x3e')][_0x916f('0x27')]);}return _0x46ca00['getTeams'](_0x42f9ff);}})['then'](function(_0x4c565a){if(_0x4c565a){return _0x4c565a?{'count':_0x4d45ad,'rows':_0x4c565a}:null;}})[_0x916f('0x2a')](respondWithResult(_0x3cc3c7,null))['catch'](handleError(_0x3cc3c7,null));};exports[_0x916f('0x6a')]=function(_0x5e66ef,_0x1286d1,_0x136c43){var _0xccc768=_0x5e66ef[_0x916f('0x52')][_0x916f('0x6b')];return db[_0x916f('0x69')][_0x916f('0x4a')]({'where':{'id':_0xccc768},'attributes':['id'],'include':[{'model':db[_0x916f('0x60')],'as':_0x916f('0x6c'),'attributes':['id',_0x916f('0x30'),_0x916f('0x6d'),_0x916f('0x6e'),_0x916f('0x6f')],'raw':!![]}]})[_0x916f('0x2a')](function(_0x5187eb){if(_0x5187eb){var _0x2005c7=_[_0x916f('0x70')](_0x5187eb,function(_0x18e8ae){var _0x51c2f2=_0x18e8ae[_0x916f('0x2c')]({'plain':!![]});return _0x51c2f2[_0x916f('0x6c')];});return db['MailQueue']['find']({'where':{'id':_0x5e66ef[_0x916f('0x4e')]['id']}})[_0x916f('0x2a')](function(_0x2f3c8e){return db[_0x916f('0x71')][_0x916f('0x72')](function(_0x507c11){return _0x2f3c8e[_0x916f('0x6a')](_0xccc768,{'transaction':_0x507c11})[_0x916f('0x2a')](function(){return BPromise[_0x916f('0x73')](_0x2005c7,function(_0x472dd2){return db[_0x916f('0x5c')]['findOrCreate']({'where':{'UserId':_0x472dd2['id'],'MailQueueId':_0x5e66ef[_0x916f('0x4e')]['id']},'transaction':_0x507c11});});})[_0x916f('0x2a')](function(){_0x2005c7[_0x916f('0x74')](function(_0x4e277e){socket[_0x916f('0x75')](_0x916f('0x76'),{'UserId':_0x4e277e['id'],'MailQueueId':_0x2f3c8e['id']});});});});});}})[_0x916f('0x2a')](respondWithStatusCode(_0x1286d1,null))['catch'](handleError(_0x1286d1,null));};exports[_0x916f('0x77')]=function(_0x3af2a0,_0x43d478,_0x284daf){return db['Team']['findAll']({'where':{'id':_0x3af2a0['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x916f('0x60')],'as':_0x916f('0x6c'),'attributes':['id'],'raw':!![]}]})[_0x916f('0x2a')](handleEntityNotFound(_0x43d478,null))[_0x916f('0x2a')](function(_0x4abec1){var _0x44f613=_[_0x916f('0x33')](_0x4abec1,'id');var _0x2bc641=[];var _0x2d0f81=[];var _0x139f4f=squel[_0x916f('0x78')]();_0x139f4f[_0x916f('0x79')](_0x916f('0x7a'))[_0x916f('0x7b')](_0x916f('0x7c'),'tq')[_0x916f('0x7d')](_0x916f('0x7e'),'ut',_0x916f('0x7f'))[_0x916f('0x43')](_0x916f('0x80'),_0x3af2a0['params']['id']);for(var _0x375c4b=0x0;_0x375c4b<_0x4abec1[_0x916f('0x40')];_0x375c4b+=0x1){let _0x2b6291=_0x4abec1[_0x375c4b];for(var _0x4a5636=0x0;_0x4a5636<_0x2b6291[_0x916f('0x6c')]['length'];_0x4a5636+=0x1){let _0x5737ea=_0x2b6291[_0x916f('0x6c')][_0x4a5636];var _0x453a80=_0x139f4f['clone']();_0x453a80[_0x916f('0x43')](_0x916f('0x81'),_0x5737ea['id']);_0x2d0f81[_0x916f('0x82')](db['sequelize']['query'](_0x453a80['toString'](),{'type':db[_0x916f('0x71')][_0x916f('0x83')][_0x916f('0x84')]})[_0x916f('0x2a')](function(_0x462909){if(_0x462909[_0x916f('0x40')]===0x1){return _0x5737ea['id'];}else{var _0xec9482=_[_0x916f('0x85')](_[_0x916f('0x33')](_0x462909,_0x916f('0x86')),function(_0x3d5838){return _[_0x916f('0x87')](_0x44f613,_0x3d5838);});if(_0xec9482){return _0x5737ea['id'];}}}));}}return BPromise[_0x916f('0x88')](_0x2d0f81)[_0x916f('0x2a')](function(_0x74f41){_0x2bc641=_(_0x2bc641)[_0x916f('0x89')](_0x74f41)[_0x916f('0x8a')]()['value']();return db[_0x916f('0x34')][_0x916f('0x50')]({'where':{'id':_0x3af2a0['params']['id']}})[_0x916f('0x2a')](function(_0x127054){return db[_0x916f('0x71')][_0x916f('0x72')](function(_0x56184f){return _0x127054[_0x916f('0x77')](_0x3af2a0[_0x916f('0x3e')][_0x916f('0x6b')],{'transaction':_0x56184f})[_0x916f('0x2a')](function(){if(!_['isEmpty'](_0x2bc641)){return _0x127054[_0x916f('0x8b')](_0x2bc641,{'transaction':_0x56184f});}})[_0x916f('0x2a')](function(){_0x2bc641[_0x916f('0x74')](function(_0x140211){socket['emit'](_0x916f('0x8c'),{'UserId':_0x140211,'MailQueueId':_0x127054['id']});});});});});});})[_0x916f('0x2a')](respondWithStatusCode(_0x43d478,null))[_0x916f('0x4c')](handleError(_0x43d478,null));};exports['addAgents']=function(_0x42599a,_0x269554,_0x530bd2){return db['MailQueue'][_0x916f('0x50')]({'where':{'id':_0x42599a[_0x916f('0x4e')]['id']}})[_0x916f('0x2a')](handleEntityNotFound(_0x269554,null))[_0x916f('0x2a')](function(_0x4b402a){if(_0x4b402a){return _0x4b402a['addAgents'](_0x42599a[_0x916f('0x52')]['ids'],_[_0x916f('0x8d')](_0x42599a[_0x916f('0x52')],[_0x916f('0x6b'),'id'])||{})[_0x916f('0x8e')](function(_0x2d74c7){for(var _0x318a49=0x0;_0x318a49<_0x42599a[_0x916f('0x52')]['ids'][_0x916f('0x40')];_0x318a49+=0x1){socket[_0x916f('0x75')]('userMailQueue:save',{'UserId':Number(_0x42599a['body'][_0x916f('0x6b')][_0x318a49]),'MailQueueId':Number(_0x42599a[_0x916f('0x4e')]['id'])});}return _0x2d74c7;});}})[_0x916f('0x2a')](respondWithResult(_0x269554,null))[_0x916f('0x4c')](handleError(_0x269554,null));};exports[_0x916f('0x8b')]=function(_0x3bd162,_0x1c32f0,_0x24c9ae){return db['MailQueue'][_0x916f('0x50')]({'where':{'id':_0x3bd162[_0x916f('0x4e')]['id']}})[_0x916f('0x2a')](handleEntityNotFound(_0x1c32f0,null))[_0x916f('0x2a')](function(_0x2624f2){if(_0x2624f2){return _0x2624f2[_0x916f('0x8b')](_0x3bd162[_0x916f('0x3e')]['ids'])[_0x916f('0x2a')](function(){if(_[_0x916f('0x8f')](_0x3bd162[_0x916f('0x3e')][_0x916f('0x6b')])){for(var _0x1bc726=0x0;_0x1bc726<_0x3bd162['query'][_0x916f('0x6b')]['length'];_0x1bc726+=0x1){socket[_0x916f('0x75')](_0x916f('0x8c'),{'UserId':Number(_0x3bd162['query']['ids'][_0x1bc726]),'MailQueueId':Number(_0x3bd162['params']['id'])});}}else{socket['emit'](_0x916f('0x8c'),{'UserId':Number(_0x3bd162['query']['ids']),'MailQueueId':Number(_0x3bd162['params']['id'])});}});}})['then'](respondWithStatusCode(_0x1c32f0,null))[_0x916f('0x4c')](handleError(_0x1c32f0,null));};exports[_0x916f('0x90')]=function(_0x3ec22f,_0x3aa22c,_0x160951){var _0x360368={};var _0x2f9ea6={};var _0x210947;var _0x4cc870;return db['MailQueue'][_0x916f('0x5b')]({'where':{'id':_0x3ec22f[_0x916f('0x4e')]['id']}})[_0x916f('0x2a')](handleEntityNotFound(_0x3aa22c,null))[_0x916f('0x2a')](function(_0x2d0540){if(_0x2d0540){_0x210947=_0x2d0540;_0x2f9ea6[_0x916f('0x3c')]=_[_0x916f('0x39')](db[_0x916f('0x60')][_0x916f('0x35')]);_0x2f9ea6[_0x916f('0x3e')]=_[_0x916f('0x39')](_0x3ec22f['query']);_0x2f9ea6[_0x916f('0x3a')]=_['intersection'](_0x2f9ea6[_0x916f('0x3c')],_0x2f9ea6[_0x916f('0x3e')]);_0x360368[_0x916f('0x3f')]=_[_0x916f('0x3b')](_0x2f9ea6[_0x916f('0x3c')],qs[_0x916f('0x3d')](_0x3ec22f[_0x916f('0x3e')][_0x916f('0x3d')]));_0x360368['attributes']=_0x360368[_0x916f('0x3f')]['length']?_0x360368['attributes']:_0x2f9ea6[_0x916f('0x3c')];_0x360368[_0x916f('0x5e')]=qs['sort'](_0x3ec22f[_0x916f('0x3e')][_0x916f('0x42')]);_0x360368['where']=qs[_0x916f('0x3a')](_[_0x916f('0x44')](_0x3ec22f[_0x916f('0x3e')],_0x2f9ea6[_0x916f('0x3a')]));if(_0x3ec22f[_0x916f('0x3e')][_0x916f('0x45')]){_0x360368['where']=_[_0x916f('0x46')](_0x360368[_0x916f('0x43')],{'$or':_[_0x916f('0x33')](_0x360368[_0x916f('0x3f')],function(_0x2ef7e0){var _0x2ece10={};_0x2ece10[_0x2ef7e0]={'$like':'%'+_0x3ec22f[_0x916f('0x3e')][_0x916f('0x45')]+'%'};return _0x2ece10;})});}_0x360368=_[_0x916f('0x46')]({},_0x360368,_0x3ec22f[_0x916f('0x48')]);return _0x210947[_0x916f('0x90')](_0x360368);}})[_0x916f('0x2a')](function(_0x29111e){if(_0x29111e){_0x4cc870=_0x29111e['length'];if(!_0x3ec22f['query']['hasOwnProperty'](_0x916f('0x5d'))){_0x360368['limit']=qs[_0x916f('0x25')](_0x3ec22f[_0x916f('0x3e')][_0x916f('0x25')]);_0x360368[_0x916f('0x27')]=qs[_0x916f('0x27')](_0x3ec22f[_0x916f('0x3e')][_0x916f('0x27')]);}return _0x210947[_0x916f('0x90')](_0x360368);}})[_0x916f('0x2a')](function(_0x40a14d){if(_0x40a14d){return _0x40a14d?{'count':_0x4cc870,'rows':_0x40a14d}:null;}})[_0x916f('0x2a')](respondWithResult(_0x3aa22c,null))['catch'](handleError(_0x3aa22c,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index fe3ae41..aab510f 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 _0x735d=['remove','emit','hook','exports','events','../../mysqldb','MailQueue','setMaxListeners','update'];(function(_0x47bf54,_0x327a53){var _0x2b75bc=function(_0x4dbcd){while(--_0x4dbcd){_0x47bf54['push'](_0x47bf54['shift']());}};_0x2b75bc(++_0x327a53);}(_0x735d,0x70));var _0xd735=function(_0x4b5813,_0x5769de){_0x4b5813=_0x4b5813-0x0;var _0x423465=_0x735d[_0x4b5813];return _0x423465;};'use strict';var EventEmitter=require(_0xd735('0x0'));var MailQueue=require(_0xd735('0x1'))['db'][_0xd735('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xd735('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd735('0x4'),'afterDestroy':_0xd735('0x5')};function emitEvent(_0x320d5e){return function(_0xddfbc4,_0x5b7a4a,_0x479d77){MailQueueEvents['emit'](_0x320d5e+':'+_0xddfbc4['id'],_0xddfbc4);MailQueueEvents[_0xd735('0x6')](_0x320d5e,_0xddfbc4);_0x479d77(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0xd735('0x7')](e,emitEvent(event));}}module[_0xd735('0x8')]=MailQueueEvents; \ No newline at end of file +var _0xbd1c=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailQueue','setMaxListeners','update'];(function(_0x37f364,_0x56f6ae){var _0x1a97dd=function(_0x4f4161){while(--_0x4f4161){_0x37f364['push'](_0x37f364['shift']());}};_0x1a97dd(++_0x56f6ae);}(_0xbd1c,0x9d));var _0xcbd1=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xbd1c[_0x57b54c];return _0x59cc19;};'use strict';var EventEmitter=require(_0xcbd1('0x0'));var MailQueue=require(_0xcbd1('0x1'))['db'][_0xcbd1('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xcbd1('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcbd1('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1d8174){return function(_0x5787a3,_0x81b9a6,_0x3a4f82){MailQueueEvents[_0xcbd1('0x5')](_0x1d8174+':'+_0x5787a3['id'],_0x5787a3);MailQueueEvents[_0xcbd1('0x5')](_0x1d8174,_0x5787a3);_0x3a4f82(null);};}for(var e in events){if(events[_0xcbd1('0x6')](e)){var event=events[e];MailQueue[_0xcbd1('0x7')](e,emitEvent(event));}}module[_0xcbd1('0x8')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index e20242a..1ee0f58 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 _0xfb8d=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailQueue','mail_queues','lodash','util','../../config/logger','moment'];(function(_0x5539b3,_0x3dba3d){var _0x4c1327=function(_0x5036d6){while(--_0x5036d6){_0x5539b3['push'](_0x5539b3['shift']());}};_0x4c1327(++_0x3dba3d);}(_0xfb8d,0x7e));var _0xdfb8=function(_0x459afb,_0x308dbf){_0x459afb=_0x459afb-0x0;var _0x41dcf5=_0xfb8d[_0x459afb];return _0x41dcf5;};'use strict';var _=require(_0xdfb8('0x0'));var util=require(_0xdfb8('0x1'));var logger=require(_0xdfb8('0x2'))('api');var moment=require(_0xdfb8('0x3'));var BPromise=require(_0xdfb8('0x4'));var rp=require(_0xdfb8('0x5'));var fs=require('fs');var path=require(_0xdfb8('0x6'));var rimraf=require(_0xdfb8('0x7'));var config=require(_0xdfb8('0x8'));var attributes=require('./mailQueue.attributes');module[_0xdfb8('0x9')]=function(_0x27595c,_0x33a1cf){return _0x27595c[_0xdfb8('0xa')](_0xdfb8('0xb'),attributes,{'tableName':_0xdfb8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa03e=['api','request-promise','path','rimraf','../../config/environment','exports','define','lodash','util','../../config/logger'];(function(_0x597ce4,_0x268d0c){var _0x33f2e3=function(_0x3cf7be){while(--_0x3cf7be){_0x597ce4['push'](_0x597ce4['shift']());}};_0x33f2e3(++_0x268d0c);}(_0xa03e,0x129));var _0xea03=function(_0x395ac6,_0x2b90eb){_0x395ac6=_0x395ac6-0x0;var _0x5c648e=_0xa03e[_0x395ac6];return _0x5c648e;};'use strict';var _=require(_0xea03('0x0'));var util=require(_0xea03('0x1'));var logger=require(_0xea03('0x2'))(_0xea03('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xea03('0x4'));var fs=require('fs');var path=require(_0xea03('0x5'));var rimraf=require(_0xea03('0x6'));var config=require(_0xea03('0x7'));var attributes=require('./mailQueue.attributes');module[_0xea03('0x8')]=function(_0x5e5ff2,_0x4d4d34){return _0x5e5ff2[_0xea03('0x9')]('MailQueue',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 18045e8..2254f1a 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 _0xb973=['jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','error','code','message','MailQueue,\x20%s,\x20%s','result','catch','GetMailQueue','MailQueue','options','raw','where','attributes','limit','map','include','model','debug','stringify','ShowMailQueue','find','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2338fa,_0x80579a){var _0x42df9b=function(_0x13fe56){while(--_0x13fe56){_0x2338fa['push'](_0x2338fa['shift']());}};_0x42df9b(++_0x80579a);}(_0xb973,0xc9));var _0x3b97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb973[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3b97('0x0'));var util=require('util');var moment=require(_0x3b97('0x1'));var BPromise=require(_0x3b97('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b97('0x3'));var db=require(_0x3b97('0x4'))['db'];var utils=require(_0x3b97('0x5'));var logger=require(_0x3b97('0x6'))(_0x3b97('0x7'));var config=require(_0x3b97('0x8'));var jayson=require(_0x3b97('0x9'));var client=jayson[_0x3b97('0xa')]['http']({'port':0x232a});config[_0x3b97('0xb')]=_[_0x3b97('0xc')](config[_0x3b97('0xb')],{'host':_0x3b97('0xd'),'port':0x18eb});var socket=require(_0x3b97('0xe'))(new Redis(config[_0x3b97('0xb')]));require(_0x3b97('0xf'))[_0x3b97('0x10')](socket);function respondWithRpcPromise(_0x12cf5d,_0xfe0b7f,_0x36158a){return new BPromise(function(_0x214cbe,_0x12a0f7){return client[_0x3b97('0x11')](_0x12cf5d,_0x36158a)[_0x3b97('0x12')](function(_0x553c7f){logger[_0x3b97('0x13')]('MailQueue,\x20%s,\x20%s',_0xfe0b7f,_0x3b97('0x14'));logger['debug'](_0x3b97('0x15'),_0xfe0b7f,_0x3b97('0x14'),JSON['stringify'](_0x553c7f));if(_0x553c7f[_0x3b97('0x16')]){if(_0x553c7f[_0x3b97('0x16')][_0x3b97('0x17')]===0x1f4){logger['error']('MailQueue,\x20%s,\x20%s',_0xfe0b7f,_0x553c7f[_0x3b97('0x16')]['message']);return _0x12a0f7(_0x553c7f[_0x3b97('0x16')][_0x3b97('0x18')]);}logger['error']('MailQueue,\x20%s,\x20%s',_0xfe0b7f,_0x553c7f['error'][_0x3b97('0x18')]);return _0x214cbe(_0x553c7f[_0x3b97('0x16')][_0x3b97('0x18')]);}else{logger['info'](_0x3b97('0x19'),_0xfe0b7f,_0x3b97('0x14'));_0x214cbe(_0x553c7f[_0x3b97('0x1a')][_0x3b97('0x18')]);}})[_0x3b97('0x1b')](function(_0x12e700){logger['error']('MailQueue,\x20%s,\x20%s',_0xfe0b7f,_0x12e700);_0x12a0f7(_0x12e700);});});}exports[_0x3b97('0x1c')]=function(_0x120a67){var _0x5b4646=this;return new Promise(function(_0x3cb3c9,_0xe9e56b){return db[_0x3b97('0x1d')]['findAll']({'raw':_0x120a67[_0x3b97('0x1e')]?_0x120a67[_0x3b97('0x1e')][_0x3b97('0x1f')]===undefined?!![]:![]:!![],'where':_0x120a67['options']?_0x120a67[_0x3b97('0x1e')][_0x3b97('0x20')]||null:null,'attributes':_0x120a67[_0x3b97('0x1e')]?_0x120a67[_0x3b97('0x1e')][_0x3b97('0x21')]||null:null,'limit':_0x120a67['options']?_0x120a67[_0x3b97('0x1e')][_0x3b97('0x22')]||null:null,'include':_0x120a67[_0x3b97('0x1e')]?_0x120a67[_0x3b97('0x1e')]['include']?_[_0x3b97('0x23')](_0x120a67[_0x3b97('0x1e')][_0x3b97('0x24')],function(_0x4d1181){return{'model':db[_0x4d1181[_0x3b97('0x25')]],'as':_0x4d1181['as'],'attributes':_0x4d1181[_0x3b97('0x21')],'include':_0x4d1181[_0x3b97('0x24')]?_['map'](_0x4d1181[_0x3b97('0x24')],function(_0x403737){return{'model':db[_0x403737[_0x3b97('0x25')]],'as':_0x403737['as'],'attributes':_0x403737[_0x3b97('0x21')],'include':_0x403737['include']?_[_0x3b97('0x23')](_0x403737['include'],function(_0x59f144){return{'model':db[_0x59f144['model']],'as':_0x59f144['as'],'attributes':_0x59f144[_0x3b97('0x21')]};}):[]};}):[]};}):[]:[]})[_0x3b97('0x12')](function(_0x47e1be){logger[_0x3b97('0x13')]('GetMailQueue',_0x120a67);logger[_0x3b97('0x26')](_0x3b97('0x1c'),_0x120a67,JSON[_0x3b97('0x27')](_0x47e1be));_0x3cb3c9(_0x47e1be);})[_0x3b97('0x1b')](function(_0x23b2f3){logger['error'](_0x3b97('0x1c'),_0x23b2f3[_0x3b97('0x18')],_0x120a67);_0xe9e56b(_0x5b4646[_0x3b97('0x16')](0x1f4,_0x23b2f3[_0x3b97('0x18')]));});});};exports[_0x3b97('0x28')]=function(_0x2be49a){var _0x192722=this;return new Promise(function(_0x161176,_0xd4c07a){return db[_0x3b97('0x1d')][_0x3b97('0x29')]({'raw':_0x2be49a[_0x3b97('0x1e')]?_0x2be49a['options'][_0x3b97('0x1f')]===undefined?!![]:![]:!![],'where':_0x2be49a['options']?_0x2be49a[_0x3b97('0x1e')][_0x3b97('0x20')]||null:null,'attributes':_0x2be49a['options']?_0x2be49a[_0x3b97('0x1e')]['attributes']||null:null,'include':_0x2be49a[_0x3b97('0x1e')]?_0x2be49a[_0x3b97('0x1e')][_0x3b97('0x24')]?_[_0x3b97('0x23')](_0x2be49a[_0x3b97('0x1e')][_0x3b97('0x24')],function(_0x1123e8){return{'model':db[_0x1123e8[_0x3b97('0x25')]],'as':_0x1123e8['as'],'attributes':_0x1123e8[_0x3b97('0x21')],'include':_0x1123e8['include']?_[_0x3b97('0x23')](_0x1123e8[_0x3b97('0x24')],function(_0x366ce8){return{'model':db[_0x366ce8[_0x3b97('0x25')]],'as':_0x366ce8['as'],'attributes':_0x366ce8[_0x3b97('0x21')],'include':_0x366ce8['include']?_[_0x3b97('0x23')](_0x366ce8['include'],function(_0x455c5b){return{'model':db[_0x455c5b[_0x3b97('0x25')]],'as':_0x455c5b['as'],'attributes':_0x455c5b['attributes']};}):[]};}):[]};}):[]:[]})[_0x3b97('0x12')](function(_0x3646b3){logger[_0x3b97('0x13')]('ShowMailQueue',_0x2be49a);logger[_0x3b97('0x26')](_0x3b97('0x28'),_0x2be49a,JSON['stringify'](_0x3646b3));_0x161176(_0x3646b3);})[_0x3b97('0x1b')](function(_0x5c61a8){logger['error'](_0x3b97('0x28'),_0x5c61a8['message'],_0x2be49a);_0xd4c07a(_0x192722['error'](0x1f4,_0x5c61a8[_0x3b97('0x18')]));});});}; \ No newline at end of file +var _0xa678=['debug','MailQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','GetMailQueue','findAll','options','attributes','limit','map','include','model','stringify','catch','ShowMailQueue','find','raw','where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x2cfc63,_0x2f2d2f){var _0x1cef43=function(_0x4c079a){while(--_0x4c079a){_0x2cfc63['push'](_0x2cfc63['shift']());}};_0x1cef43(++_0x2f2d2f);}(_0xa678,0xe1));var _0x8a67=function(_0x255cae,_0x5976d7){_0x255cae=_0x255cae-0x0;var _0x567716=_0xa678[_0x255cae];return _0x567716;};'use strict';var _=require(_0x8a67('0x0'));var util=require(_0x8a67('0x1'));var moment=require(_0x8a67('0x2'));var BPromise=require(_0x8a67('0x3'));var rs=require(_0x8a67('0x4'));var fs=require('fs');var Redis=require(_0x8a67('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8a67('0x6'));var logger=require(_0x8a67('0x7'))(_0x8a67('0x8'));var config=require('../../config/environment');var jayson=require(_0x8a67('0x9'));var client=jayson['client'][_0x8a67('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x8a67('0xb')],{'host':_0x8a67('0xc'),'port':0x18eb});var socket=require(_0x8a67('0xd'))(new Redis(config[_0x8a67('0xb')]));require(_0x8a67('0xe'))[_0x8a67('0xf')](socket);function respondWithRpcPromise(_0x21e276,_0x3b8e24,_0x2e1de5){return new BPromise(function(_0x10679d,_0x583c01){return client[_0x8a67('0x10')](_0x21e276,_0x2e1de5)[_0x8a67('0x11')](function(_0x3dd716){logger[_0x8a67('0x12')](_0x8a67('0x13'),_0x3b8e24,_0x8a67('0x14'));logger[_0x8a67('0x15')](_0x8a67('0x16'),_0x3b8e24,_0x8a67('0x14'),JSON['stringify'](_0x3dd716));if(_0x3dd716[_0x8a67('0x17')]){if(_0x3dd716[_0x8a67('0x17')][_0x8a67('0x18')]===0x1f4){logger[_0x8a67('0x17')](_0x8a67('0x13'),_0x3b8e24,_0x3dd716['error'][_0x8a67('0x19')]);return _0x583c01(_0x3dd716[_0x8a67('0x17')]['message']);}logger[_0x8a67('0x17')]('MailQueue,\x20%s,\x20%s',_0x3b8e24,_0x3dd716['error'][_0x8a67('0x19')]);return _0x10679d(_0x3dd716['error'][_0x8a67('0x19')]);}else{logger[_0x8a67('0x12')]('MailQueue,\x20%s,\x20%s',_0x3b8e24,_0x8a67('0x14'));_0x10679d(_0x3dd716[_0x8a67('0x1a')]['message']);}})['catch'](function(_0x4bf316){logger[_0x8a67('0x17')]('MailQueue,\x20%s,\x20%s',_0x3b8e24,_0x4bf316);_0x583c01(_0x4bf316);});});}exports[_0x8a67('0x1b')]=function(_0x38f8ac){var _0x474d4c=this;return new Promise(function(_0x45fe8d,_0x419bc9){return db['MailQueue'][_0x8a67('0x1c')]({'raw':_0x38f8ac['options']?_0x38f8ac[_0x8a67('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x38f8ac[_0x8a67('0x1d')]?_0x38f8ac['options']['where']||null:null,'attributes':_0x38f8ac[_0x8a67('0x1d')]?_0x38f8ac[_0x8a67('0x1d')][_0x8a67('0x1e')]||null:null,'limit':_0x38f8ac[_0x8a67('0x1d')]?_0x38f8ac[_0x8a67('0x1d')][_0x8a67('0x1f')]||null:null,'include':_0x38f8ac[_0x8a67('0x1d')]?_0x38f8ac[_0x8a67('0x1d')]['include']?_[_0x8a67('0x20')](_0x38f8ac[_0x8a67('0x1d')][_0x8a67('0x21')],function(_0xb8c1f5){return{'model':db[_0xb8c1f5[_0x8a67('0x22')]],'as':_0xb8c1f5['as'],'attributes':_0xb8c1f5[_0x8a67('0x1e')],'include':_0xb8c1f5['include']?_['map'](_0xb8c1f5['include'],function(_0x50dc85){return{'model':db[_0x50dc85[_0x8a67('0x22')]],'as':_0x50dc85['as'],'attributes':_0x50dc85['attributes'],'include':_0x50dc85[_0x8a67('0x21')]?_[_0x8a67('0x20')](_0x50dc85[_0x8a67('0x21')],function(_0x25d6f2){return{'model':db[_0x25d6f2[_0x8a67('0x22')]],'as':_0x25d6f2['as'],'attributes':_0x25d6f2[_0x8a67('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8a67('0x11')](function(_0x56383d){logger[_0x8a67('0x12')](_0x8a67('0x1b'),_0x38f8ac);logger['debug'](_0x8a67('0x1b'),_0x38f8ac,JSON[_0x8a67('0x23')](_0x56383d));_0x45fe8d(_0x56383d);})[_0x8a67('0x24')](function(_0x1b9511){logger[_0x8a67('0x17')](_0x8a67('0x1b'),_0x1b9511['message'],_0x38f8ac);_0x419bc9(_0x474d4c[_0x8a67('0x17')](0x1f4,_0x1b9511[_0x8a67('0x19')]));});});};exports[_0x8a67('0x25')]=function(_0x55d0b6){var _0x1e1835=this;return new Promise(function(_0x3b4297,_0x4b4f15){return db['MailQueue'][_0x8a67('0x26')]({'raw':_0x55d0b6[_0x8a67('0x1d')]?_0x55d0b6[_0x8a67('0x1d')][_0x8a67('0x27')]===undefined?!![]:![]:!![],'where':_0x55d0b6['options']?_0x55d0b6[_0x8a67('0x1d')][_0x8a67('0x28')]||null:null,'attributes':_0x55d0b6[_0x8a67('0x1d')]?_0x55d0b6[_0x8a67('0x1d')]['attributes']||null:null,'include':_0x55d0b6['options']?_0x55d0b6[_0x8a67('0x1d')][_0x8a67('0x21')]?_['map'](_0x55d0b6[_0x8a67('0x1d')][_0x8a67('0x21')],function(_0x845ddd){return{'model':db[_0x845ddd[_0x8a67('0x22')]],'as':_0x845ddd['as'],'attributes':_0x845ddd[_0x8a67('0x1e')],'include':_0x845ddd['include']?_['map'](_0x845ddd[_0x8a67('0x21')],function(_0x1194f1){return{'model':db[_0x1194f1['model']],'as':_0x1194f1['as'],'attributes':_0x1194f1[_0x8a67('0x1e')],'include':_0x1194f1[_0x8a67('0x21')]?_[_0x8a67('0x20')](_0x1194f1[_0x8a67('0x21')],function(_0xde1093){return{'model':db[_0xde1093['model']],'as':_0xde1093['as'],'attributes':_0xde1093['attributes']};}):[]};}):[]};}):[]:[]})[_0x8a67('0x11')](function(_0x557a2d){logger[_0x8a67('0x12')](_0x8a67('0x25'),_0x55d0b6);logger[_0x8a67('0x15')](_0x8a67('0x25'),_0x55d0b6,JSON[_0x8a67('0x23')](_0x557a2d));_0x3b4297(_0x557a2d);})[_0x8a67('0x24')](function(_0x1d6eb0){logger[_0x8a67('0x17')](_0x8a67('0x25'),_0x1d6eb0[_0x8a67('0x19')],_0x55d0b6);_0x4b4f15(_0x1e1835[_0x8a67('0x17')](0x1f4,_0x1d6eb0[_0x8a67('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index a858ef0..c074f95 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 _0x01e4=['register','mailQueue:','remove','update','emit','removeListener'];(function(_0x5f34a9,_0x210296){var _0x5d09e8=function(_0x3e4374){while(--_0x3e4374){_0x5f34a9['push'](_0x5f34a9['shift']());}};_0x5d09e8(++_0x210296);}(_0x01e4,0xc2));var _0x401e=function(_0x4f2b38,_0x4e6343){_0x4f2b38=_0x4f2b38-0x0;var _0x2f6c86=_0x01e4[_0x4f2b38];return _0x2f6c86;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=['save',_0x401e('0x0'),_0x401e('0x1')];function createListener(_0x17b5d2,_0x5b0a04){return function(_0x36b96a){_0x5b0a04[_0x401e('0x2')](_0x17b5d2,_0x36b96a);};}function removeListener(_0x2427db,_0x5555ff){return function(){MailQueueEvents[_0x401e('0x3')](_0x2427db,_0x5555ff);};}exports[_0x401e('0x4')]=function(_0x5ebe33){for(var _0x3646da=0x0,_0x9e93fc=events['length'];_0x3646da<_0x9e93fc;_0x3646da++){var _0x5ed374=events[_0x3646da];var _0x466098=createListener(_0x401e('0x5')+_0x5ed374,_0x5ebe33);MailQueueEvents['on'](_0x5ed374,_0x466098);}}; \ No newline at end of file +var _0xc5f1=['emit','removeListener','register','./mailQueue.events','remove','update'];(function(_0xcfb7c6,_0x1b4de0){var _0x31cfe6=function(_0x9a6b87){while(--_0x9a6b87){_0xcfb7c6['push'](_0xcfb7c6['shift']());}};_0x31cfe6(++_0x1b4de0);}(_0xc5f1,0xb1));var _0x1c5f=function(_0x51906e,_0x3b82b9){_0x51906e=_0x51906e-0x0;var _0x20f0e1=_0xc5f1[_0x51906e];return _0x20f0e1;};'use strict';var MailQueueEvents=require(_0x1c5f('0x0'));var events=['save',_0x1c5f('0x1'),_0x1c5f('0x2')];function createListener(_0x159423,_0x1abc55){return function(_0x23f3c0){_0x1abc55[_0x1c5f('0x3')](_0x159423,_0x23f3c0);};}function removeListener(_0x97a00e,_0x22acfc){return function(){MailQueueEvents[_0x1c5f('0x4')](_0x97a00e,_0x22acfc);};}exports[_0x1c5f('0x5')]=function(_0x5c6d05){for(var _0x591b25=0x0,_0x31a784=events['length'];_0x591b25<_0x31a784;_0x591b25++){var _0x20a051=events[_0x591b25];var _0x178064=createListener('mailQueue:'+_0x20a051,_0x5c6d05);MailQueueEvents['on'](_0x20a051,_0x178064);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 3c375dd..e231342 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 _0x9f75=['/:id','show','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x45ce4e,_0x3a367c){var _0x4a105a=function(_0x52f8bb){while(--_0x52f8bb){_0x45ce4e['push'](_0x45ce4e['shift']());}};_0x4a105a(++_0x3a367c);}(_0x9f75,0x176));var _0x59f7=function(_0x54d96d,_0x4482b9){_0x54d96d=_0x54d96d-0x0;var _0xdb3f99=_0x9f75[_0x54d96d];return _0xdb3f99;};'use strict';var multer=require(_0x59f7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x59f7('0x1'));var express=require(_0x59f7('0x2'));var router=express[_0x59f7('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x59f7('0x4'));var controller=require('./mailQueueReport.controller');router[_0x59f7('0x5')]('/',auth[_0x59f7('0x6')](),controller[_0x59f7('0x7')]);router[_0x59f7('0x5')](_0x59f7('0x8'),auth['isAuthenticated'](),controller[_0x59f7('0x9')]);router[_0x59f7('0x5')](_0x59f7('0xa'),auth[_0x59f7('0x6')](),controller[_0x59f7('0xb')]);router['post']('/',auth[_0x59f7('0x6')](),controller['create']);router['put'](_0x59f7('0xa'),auth[_0x59f7('0x6')](),controller[_0x59f7('0xc')]);router[_0x59f7('0xd')](_0x59f7('0xa'),auth['isAuthenticated'](),controller[_0x59f7('0xe')]);module[_0x59f7('0xf')]=router; \ No newline at end of file +var _0x4af4=['util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','multer'];(function(_0xa744f2,_0x1fb033){var _0x59e21f=function(_0x1180bd){while(--_0x1180bd){_0xa744f2['push'](_0xa744f2['shift']());}};_0x59e21f(++_0x1fb033);}(_0x4af4,0x168));var _0x44af=function(_0x3e7099,_0x473141){_0x3e7099=_0x3e7099-0x0;var _0x28bfc1=_0x4af4[_0x3e7099];return _0x28bfc1;};'use strict';var multer=require(_0x44af('0x0'));var util=require(_0x44af('0x1'));var path=require('path');var timeout=require(_0x44af('0x2'));var express=require(_0x44af('0x3'));var router=express[_0x44af('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x44af('0x5'));var config=require(_0x44af('0x6'));var controller=require('./mailQueueReport.controller');router[_0x44af('0x7')]('/',auth[_0x44af('0x8')](),controller[_0x44af('0x9')]);router[_0x44af('0x7')]('/describe',auth[_0x44af('0x8')](),controller[_0x44af('0xa')]);router[_0x44af('0x7')](_0x44af('0xb'),auth[_0x44af('0x8')](),controller[_0x44af('0xc')]);router[_0x44af('0xd')]('/',auth[_0x44af('0x8')](),controller[_0x44af('0xe')]);router[_0x44af('0xf')](_0x44af('0xb'),auth[_0x44af('0x8')](),controller[_0x44af('0x10')]);router[_0x44af('0x11')](_0x44af('0xb'),auth['isAuthenticated'](),controller[_0x44af('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 88548be..63982aa 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 _0x081d=['STRING','DATE','moment','sequelize'];(function(_0x241928,_0x2e3104){var _0x3369b5=function(_0x5c9c6e){while(--_0x5c9c6e){_0x241928['push'](_0x241928['shift']());}};_0x3369b5(++_0x2e3104);}(_0x081d,0x11a));var _0xd081=function(_0x3984a6,_0x4adaba){_0x3984a6=_0x3984a6-0x0;var _0x2cc75f=_0x081d[_0x3984a6];return _0x2cc75f;};'use strict';var moment=require(_0xd081('0x0'));var Sequelize=require(_0xd081('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xd081('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xd081('0x2')]},'joinAt':{'type':Sequelize[_0xd081('0x3')]},'leaveAt':{'type':Sequelize[_0xd081('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xd081('0x3')]},'reason':{'type':Sequelize[_0xd081('0x2')]}}; \ No newline at end of file +var _0x103f=['STRING','DATE','moment','sequelize','exports'];(function(_0x17cc6e,_0x4c01d2){var _0x464e9a=function(_0x17db4d){while(--_0x17db4d){_0x17cc6e['push'](_0x17cc6e['shift']());}};_0x464e9a(++_0x4c01d2);}(_0x103f,0x14c));var _0xf103=function(_0x337f2a,_0x468c45){_0x337f2a=_0x337f2a-0x0;var _0x47b4e6=_0x103f[_0x337f2a];return _0x47b4e6;};'use strict';var moment=require(_0xf103('0x0'));var Sequelize=require(_0xf103('0x1'));module[_0xf103('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xf103('0x3')]},'joinAt':{'type':Sequelize[_0xf103('0x4')]},'leaveAt':{'type':Sequelize[_0xf103('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xf103('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index cad886c..d172cac 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 _0x583c=['rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','index','map','MailQueueReport','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','keys','find','create','body','update','params','describe','eml-format'];(function(_0x10da59,_0x11db13){var _0x5c1339=function(_0x5b0780){while(--_0x5b0780){_0x10da59['push'](_0x10da59['shift']());}};_0x5c1339(++_0x11db13);}(_0x583c,0x12b));var _0xc583=function(_0x1f9503,_0x8e450b){_0x1f9503=_0x1f9503-0x0;var _0xaab94f=_0x583c[_0x1f9503];return _0xaab94f;};'use strict';var emlformat=require(_0xc583('0x0'));var rimraf=require(_0xc583('0x1'));var zipdir=require(_0xc583('0x2'));var jsonpatch=require(_0xc583('0x3'));var rp=require('request-promise');var moment=require(_0xc583('0x4'));var BPromise=require(_0xc583('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc583('0x6'));var sox=require(_0xc583('0x7'));var csv=require('to-csv');var ejs=require(_0xc583('0x8'));var fs=require('fs');var fs_extra=require(_0xc583('0x9'));var _=require(_0xc583('0xa'));var squel=require(_0xc583('0xb'));var crypto=require('crypto');var jsforce=require(_0xc583('0xc'));var deskjs=require(_0xc583('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc583('0xe'));var Papa=require(_0xc583('0xf'));var Redis=require(_0xc583('0x10'));var authService=require(_0xc583('0x11'));var qs=require(_0xc583('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc583('0x13'));var logger=require(_0xc583('0x14'))('api');var utils=require(_0xc583('0x15'));var config=require(_0xc583('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc583('0x17'))['db'];function respondWithStatusCode(_0x87632d,_0x24343b){_0x24343b=_0x24343b||0xcc;return function(_0x267da0){if(_0x267da0){return _0x87632d[_0xc583('0x18')](_0x24343b);}return _0x87632d[_0xc583('0x19')](_0x24343b)[_0xc583('0x1a')]();};}function respondWithResult(_0xf81809,_0x1c6b79){_0x1c6b79=_0x1c6b79||0xc8;return function(_0x5403a3){if(_0x5403a3){return _0xf81809[_0xc583('0x19')](_0x1c6b79)['json'](_0x5403a3);}};}function respondWithFilteredResult(_0x19f46a,_0x299fa1){return function(_0x510090){if(_0x510090){var _0x263552=typeof _0x299fa1[_0xc583('0x1b')]==='undefined'&&typeof _0x299fa1[_0xc583('0x1c')]===_0xc583('0x1d');var _0x5127fa=_0x510090[_0xc583('0x1e')];var _0x8a2d84=_0x263552?0x0:_0x299fa1[_0xc583('0x1b')];var _0x36e0fd=_0x263552?_0x510090['count']:_0x299fa1[_0xc583('0x1b')]+_0x299fa1['limit'];var _0x227ec2;if(_0x36e0fd>=_0x5127fa){_0x36e0fd=_0x5127fa;_0x227ec2=0xc8;}else{_0x227ec2=0xce;}_0x19f46a[_0xc583('0x19')](_0x227ec2);return _0x19f46a[_0xc583('0x1f')](_0xc583('0x20'),_0x8a2d84+'-'+_0x36e0fd+'/'+_0x5127fa)[_0xc583('0x21')](_0x510090);}return null;};}function patchUpdates(_0x12b910){return function(_0x3ce81b){try{jsonpatch[_0xc583('0x22')](_0x3ce81b,_0x12b910,!![]);}catch(_0x37fcd4){return BPromise[_0xc583('0x23')](_0x37fcd4);}return _0x3ce81b[_0xc583('0x24')]();};}function saveUpdates(_0x3b31bc,_0x21466f){return function(_0x478ee1){if(_0x478ee1){return _0x478ee1['update'](_0x3b31bc)[_0xc583('0x25')](function(_0x3e075c){return _0x3e075c;});}return null;};}function removeEntity(_0x8443dc,_0x5ceef1){return function(_0x1521e2){if(_0x1521e2){return _0x1521e2[_0xc583('0x26')]()[_0xc583('0x25')](function(){_0x8443dc[_0xc583('0x19')](0xcc)[_0xc583('0x1a')]();});}};}function handleEntityNotFound(_0x48c95e,_0x4cad36){return function(_0x45871c){if(!_0x45871c){_0x48c95e['sendStatus'](0x194);}return _0x45871c;};}function handleError(_0x45ef74,_0xcbe9b2){_0xcbe9b2=_0xcbe9b2||0x1f4;return function(_0xbabf24){logger[_0xc583('0x27')](_0xbabf24[_0xc583('0x28')]);if(_0xbabf24['name']){delete _0xbabf24[_0xc583('0x29')];}_0x45ef74[_0xc583('0x19')](_0xcbe9b2)['send'](_0xbabf24);};}exports[_0xc583('0x2a')]=function(_0x483357,_0x2c9088){var _0x8d4ecb={},_0x1c80b1={},_0x3ed083={'count':0x0,'rows':[]};var _0x1b2b49=_[_0xc583('0x2b')](db[_0xc583('0x2c')]['rawAttributes'],function(_0x529dbe){return{'name':_0x529dbe[_0xc583('0x2d')],'type':_0x529dbe[_0xc583('0x2e')][_0xc583('0x2f')]};});_0x1c80b1[_0xc583('0x30')]=_[_0xc583('0x2b')](_0x1b2b49,'name');_0x1c80b1[_0xc583('0x31')]=_['keys'](_0x483357['query']);_0x1c80b1[_0xc583('0x32')]=_[_0xc583('0x33')](_0x1c80b1[_0xc583('0x30')],_0x1c80b1[_0xc583('0x31')]);_0x8d4ecb[_0xc583('0x34')]=_['intersection'](_0x1c80b1[_0xc583('0x30')],qs[_0xc583('0x35')](_0x483357[_0xc583('0x31')]['fields']));_0x8d4ecb[_0xc583('0x34')]=_0x8d4ecb['attributes'][_0xc583('0x36')]?_0x8d4ecb[_0xc583('0x34')]:_0x1c80b1[_0xc583('0x30')];if(!_0x483357[_0xc583('0x31')][_0xc583('0x37')]('nolimit')){_0x8d4ecb[_0xc583('0x1c')]=qs['limit'](_0x483357[_0xc583('0x31')]['limit']);_0x8d4ecb[_0xc583('0x1b')]=qs[_0xc583('0x1b')](_0x483357[_0xc583('0x31')][_0xc583('0x1b')]);}_0x8d4ecb[_0xc583('0x38')]=qs[_0xc583('0x39')](_0x483357['query']['sort']);_0x8d4ecb[_0xc583('0x3a')]=qs[_0xc583('0x32')](_['pick'](_0x483357[_0xc583('0x31')],_0x1c80b1[_0xc583('0x32')]),_0x1b2b49);if(_0x483357[_0xc583('0x31')][_0xc583('0x3b')]){_0x8d4ecb[_0xc583('0x3a')]=_[_0xc583('0x3c')](_0x8d4ecb['where'],{'$or':_[_0xc583('0x2b')](_0x1b2b49,function(_0x595351){if(_0x595351[_0xc583('0x2e')]!==_0xc583('0x3d')){var _0x39bed4={};_0x39bed4[_0x595351['name']]={'$like':'%'+_0x483357['query']['filter']+'%'};return _0x39bed4;}})});}_0x8d4ecb=_[_0xc583('0x3c')]({},_0x8d4ecb,_0x483357[_0xc583('0x3e')]);var _0x2b957d={'where':_0x8d4ecb[_0xc583('0x3a')]};return db['MailQueueReport'][_0xc583('0x1e')](_0x2b957d)[_0xc583('0x25')](function(_0x594a0b){_0x3ed083['count']=_0x594a0b;if(_0x483357[_0xc583('0x31')]['includeAll']){_0x8d4ecb[_0xc583('0x3f')]=[{'all':!![]}];}return db[_0xc583('0x2c')][_0xc583('0x40')](_0x8d4ecb);})[_0xc583('0x25')](function(_0x58553e){_0x3ed083[_0xc583('0x41')]=_0x58553e;return _0x3ed083;})[_0xc583('0x25')](respondWithFilteredResult(_0x2c9088,_0x8d4ecb))[_0xc583('0x42')](handleError(_0x2c9088,null));};exports[_0xc583('0x43')]=function(_0x2c1c22,_0x5e6e7e){var _0x3ffeb7={'raw':!![],'where':{'id':_0x2c1c22['params']['id']}},_0x5f5a97={};_0x5f5a97[_0xc583('0x30')]=_[_0xc583('0x44')](db['MailQueueReport']['rawAttributes']);_0x5f5a97[_0xc583('0x31')]=_[_0xc583('0x44')](_0x2c1c22[_0xc583('0x31')]);_0x5f5a97[_0xc583('0x32')]=_['intersection'](_0x5f5a97[_0xc583('0x30')],_0x5f5a97['query']);_0x3ffeb7[_0xc583('0x34')]=_['intersection'](_0x5f5a97[_0xc583('0x30')],qs[_0xc583('0x35')](_0x2c1c22[_0xc583('0x31')][_0xc583('0x35')]));_0x3ffeb7[_0xc583('0x34')]=_0x3ffeb7['attributes'][_0xc583('0x36')]?_0x3ffeb7[_0xc583('0x34')]:_0x5f5a97[_0xc583('0x30')];if(_0x2c1c22['query']['includeAll']){_0x3ffeb7['include']=[{'all':!![]}];}_0x3ffeb7=_[_0xc583('0x3c')]({},_0x3ffeb7,_0x2c1c22['options']);return db[_0xc583('0x2c')][_0xc583('0x45')](_0x3ffeb7)[_0xc583('0x25')](handleEntityNotFound(_0x5e6e7e,null))[_0xc583('0x25')](respondWithResult(_0x5e6e7e,null))[_0xc583('0x42')](handleError(_0x5e6e7e,null));};exports[_0xc583('0x46')]=function(_0x302038,_0x32cfbf){return db[_0xc583('0x2c')][_0xc583('0x46')](_0x302038[_0xc583('0x47')],{})['then'](respondWithResult(_0x32cfbf,0xc9))[_0xc583('0x42')](handleError(_0x32cfbf,null));};exports[_0xc583('0x48')]=function(_0x453df7,_0x230a45){if(_0x453df7['body']['id']){delete _0x453df7[_0xc583('0x47')]['id'];}return db[_0xc583('0x2c')][_0xc583('0x45')]({'where':{'id':_0x453df7[_0xc583('0x49')]['id']}})[_0xc583('0x25')](handleEntityNotFound(_0x230a45,null))[_0xc583('0x25')](saveUpdates(_0x453df7[_0xc583('0x47')],null))[_0xc583('0x25')](respondWithResult(_0x230a45,null))[_0xc583('0x42')](handleError(_0x230a45,null));};exports['destroy']=function(_0x1f4901,_0x1919fa){return db[_0xc583('0x2c')][_0xc583('0x45')]({'where':{'id':_0x1f4901[_0xc583('0x49')]['id']}})[_0xc583('0x25')](handleEntityNotFound(_0x1919fa,null))[_0xc583('0x25')](removeEntity(_0x1919fa,null))[_0xc583('0x42')](handleError(_0x1919fa,null));};exports[_0xc583('0x4a')]=function(_0xa03d53,_0x1a0f91){return db[_0xc583('0x2c')][_0xc583('0x4a')]()['then'](respondWithResult(_0x1a0f91,null))[_0xc583('0x42')](handleError(_0x1a0f91,null));}; \ No newline at end of file +var _0x7708=['map','MailQueueReport','rawAttributes','key','model','keys','intersection','query','attributes','fields','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','length','options','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','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','error','stack','name','send','index'];(function(_0x55516b,_0x38ff8b){var _0x263048=function(_0x302bc4){while(--_0x302bc4){_0x55516b['push'](_0x55516b['shift']());}};_0x263048(++_0x38ff8b);}(_0x7708,0x188));var _0x8770=function(_0x26d386,_0x1660c0){_0x26d386=_0x26d386-0x0;var _0x4ef9a8=_0x7708[_0x26d386];return _0x4ef9a8;};'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(){_0x468fc0[_0x8770('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7b4755,_0x453804){return function(_0x473d31){if(!_0x473d31){_0x7b4755[_0x8770('0x16')](0x194);}return _0x473d31;};}function handleError(_0x1538b2,_0x2cd084){_0x2cd084=_0x2cd084||0x1f4;return function(_0x293f53){logger[_0x8770('0x23')](_0x293f53[_0x8770('0x24')]);if(_0x293f53[_0x8770('0x25')]){delete _0x293f53['name'];}_0x1538b2[_0x8770('0x17')](_0x2cd084)[_0x8770('0x26')](_0x293f53);};}exports[_0x8770('0x27')]=function(_0x5c7bd,_0x246128){var _0x200a82={},_0x5ae7b8={},_0x4b284b={'count':0x0,'rows':[]};var _0x37974d=_[_0x8770('0x28')](db[_0x8770('0x29')][_0x8770('0x2a')],function(_0x23f4b0){return{'name':_0x23f4b0['fieldName'],'type':_0x23f4b0['type'][_0x8770('0x2b')]};});_0x5ae7b8[_0x8770('0x2c')]=_[_0x8770('0x28')](_0x37974d,_0x8770('0x25'));_0x5ae7b8['query']=_[_0x8770('0x2d')](_0x5c7bd['query']);_0x5ae7b8['filters']=_[_0x8770('0x2e')](_0x5ae7b8['model'],_0x5ae7b8[_0x8770('0x2f')]);_0x200a82[_0x8770('0x30')]=_[_0x8770('0x2e')](_0x5ae7b8[_0x8770('0x2c')],qs[_0x8770('0x31')](_0x5c7bd[_0x8770('0x2f')][_0x8770('0x31')]));_0x200a82[_0x8770('0x30')]=_0x200a82[_0x8770('0x30')]['length']?_0x200a82[_0x8770('0x30')]:_0x5ae7b8[_0x8770('0x2c')];if(!_0x5c7bd[_0x8770('0x2f')]['hasOwnProperty']('nolimit')){_0x200a82[_0x8770('0x1c')]=qs[_0x8770('0x1c')](_0x5c7bd[_0x8770('0x2f')]['limit']);_0x200a82[_0x8770('0x1a')]=qs['offset'](_0x5c7bd[_0x8770('0x2f')][_0x8770('0x1a')]);}_0x200a82[_0x8770('0x32')]=qs[_0x8770('0x33')](_0x5c7bd[_0x8770('0x2f')][_0x8770('0x33')]);_0x200a82[_0x8770('0x34')]=qs[_0x8770('0x35')](_[_0x8770('0x36')](_0x5c7bd[_0x8770('0x2f')],_0x5ae7b8['filters']),_0x37974d);if(_0x5c7bd[_0x8770('0x2f')][_0x8770('0x37')]){_0x200a82[_0x8770('0x34')]=_['merge'](_0x200a82[_0x8770('0x34')],{'$or':_[_0x8770('0x28')](_0x37974d,function(_0x27f91c){if(_0x27f91c[_0x8770('0x38')]!==_0x8770('0x39')){var _0x3a50db={};_0x3a50db[_0x27f91c['name']]={'$like':'%'+_0x5c7bd[_0x8770('0x2f')]['filter']+'%'};return _0x3a50db;}})});}_0x200a82=_[_0x8770('0x3a')]({},_0x200a82,_0x5c7bd['options']);var _0x41134a={'where':_0x200a82[_0x8770('0x34')]};return db[_0x8770('0x29')]['count'](_0x41134a)[_0x8770('0x21')](function(_0x3f35ac){_0x4b284b[_0x8770('0x1b')]=_0x3f35ac;if(_0x5c7bd[_0x8770('0x2f')][_0x8770('0x3b')]){_0x200a82[_0x8770('0x3c')]=[{'all':!![]}];}return db['MailQueueReport'][_0x8770('0x3d')](_0x200a82);})['then'](function(_0x4bcfc7){_0x4b284b[_0x8770('0x3e')]=_0x4bcfc7;return _0x4b284b;})[_0x8770('0x21')](respondWithFilteredResult(_0x246128,_0x200a82))[_0x8770('0x3f')](handleError(_0x246128,null));};exports[_0x8770('0x40')]=function(_0x3a51b5,_0x4b4477){var _0x35b182={'raw':!![],'where':{'id':_0x3a51b5['params']['id']}},_0x26ae1b={};_0x26ae1b[_0x8770('0x2c')]=_['keys'](db[_0x8770('0x29')][_0x8770('0x2a')]);_0x26ae1b[_0x8770('0x2f')]=_[_0x8770('0x2d')](_0x3a51b5[_0x8770('0x2f')]);_0x26ae1b[_0x8770('0x35')]=_[_0x8770('0x2e')](_0x26ae1b[_0x8770('0x2c')],_0x26ae1b[_0x8770('0x2f')]);_0x35b182[_0x8770('0x30')]=_[_0x8770('0x2e')](_0x26ae1b['model'],qs[_0x8770('0x31')](_0x3a51b5[_0x8770('0x2f')][_0x8770('0x31')]));_0x35b182[_0x8770('0x30')]=_0x35b182[_0x8770('0x30')][_0x8770('0x41')]?_0x35b182['attributes']:_0x26ae1b[_0x8770('0x2c')];if(_0x3a51b5[_0x8770('0x2f')][_0x8770('0x3b')]){_0x35b182[_0x8770('0x3c')]=[{'all':!![]}];}_0x35b182=_[_0x8770('0x3a')]({},_0x35b182,_0x3a51b5[_0x8770('0x42')]);return db[_0x8770('0x29')][_0x8770('0x43')](_0x35b182)['then'](handleEntityNotFound(_0x4b4477,null))[_0x8770('0x21')](respondWithResult(_0x4b4477,null))[_0x8770('0x3f')](handleError(_0x4b4477,null));};exports[_0x8770('0x44')]=function(_0xaeaf3b,_0x454496){return db['MailQueueReport']['create'](_0xaeaf3b[_0x8770('0x45')],{})['then'](respondWithResult(_0x454496,0xc9))[_0x8770('0x3f')](handleError(_0x454496,null));};exports['update']=function(_0x4f9e0b,_0x3805d8){if(_0x4f9e0b[_0x8770('0x45')]['id']){delete _0x4f9e0b[_0x8770('0x45')]['id'];}return db[_0x8770('0x29')]['find']({'where':{'id':_0x4f9e0b[_0x8770('0x46')]['id']}})[_0x8770('0x21')](handleEntityNotFound(_0x3805d8,null))['then'](saveUpdates(_0x4f9e0b['body'],null))[_0x8770('0x21')](respondWithResult(_0x3805d8,null))[_0x8770('0x3f')](handleError(_0x3805d8,null));};exports[_0x8770('0x22')]=function(_0x4f5cb8,_0x1584dc){return db['MailQueueReport'][_0x8770('0x43')]({'where':{'id':_0x4f5cb8[_0x8770('0x46')]['id']}})[_0x8770('0x21')](handleEntityNotFound(_0x1584dc,null))['then'](removeEntity(_0x1584dc,null))[_0x8770('0x3f')](handleError(_0x1584dc,null));};exports['describe']=function(_0x5aae53,_0x4cfacb){return db[_0x8770('0x29')][_0x8770('0x47')]()[_0x8770('0x21')](respondWithResult(_0x4cfacb,null))[_0x8770('0x3f')](handleError(_0x4cfacb,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 086081c..8a54eff 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 _0xf4da=['bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x2db1cb,_0x29c234){var _0x4a403b=function(_0x1b8d88){while(--_0x1b8d88){_0x2db1cb['push'](_0x2db1cb['shift']());}};_0x4a403b(++_0x29c234);}(_0xf4da,0x190));var _0xaf4d=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xf4da[_0x298ed3];return _0x5aad28;};'use strict';var _=require(_0xaf4d('0x0'));var util=require(_0xaf4d('0x1'));var logger=require(_0xaf4d('0x2'))(_0xaf4d('0x3'));var moment=require(_0xaf4d('0x4'));var BPromise=require(_0xaf4d('0x5'));var rp=require(_0xaf4d('0x6'));var fs=require('fs');var path=require(_0xaf4d('0x7'));var rimraf=require(_0xaf4d('0x8'));var config=require(_0xaf4d('0x9'));var attributes=require(_0xaf4d('0xa'));module['exports']=function(_0x3a9d67,_0x4e3b72){return _0x3a9d67[_0xaf4d('0xb')](_0xaf4d('0xc'),attributes,{'tableName':_0xaf4d('0xd'),'paranoid':![],'indexes':[{'name':_0xaf4d('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5fd9=['define','MailQueueReport','uniqueid','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','exports'];(function(_0x44f28a,_0x5da6d5){var _0x22d645=function(_0x4c34bb){while(--_0x4c34bb){_0x44f28a['push'](_0x44f28a['shift']());}};_0x22d645(++_0x5da6d5);}(_0x5fd9,0xbe));var _0x95fd=function(_0x300464,_0x4bdf5c){_0x300464=_0x300464-0x0;var _0x100b81=_0x5fd9[_0x300464];return _0x100b81;};'use strict';var _=require(_0x95fd('0x0'));var util=require(_0x95fd('0x1'));var logger=require(_0x95fd('0x2'))(_0x95fd('0x3'));var moment=require('moment');var BPromise=require(_0x95fd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x95fd('0x5'));var config=require(_0x95fd('0x6'));var attributes=require('./mailQueueReport.attributes');module[_0x95fd('0x7')]=function(_0x14daf8,_0x1fe346){return _0x14daf8[_0x95fd('0x8')](_0x95fd('0x9'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x95fd('0xa'),'fields':[_0x95fd('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 4fbb875..1b7446f 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 _0xadb5=['MailQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailQueueReport','create','options','raw','debug','MailQueueReport','body','attributes','limit','UpdateMailQueueReport','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0xb3eeb,_0xb365f3){var _0x5d6853=function(_0x34e808){while(--_0x34e808){_0xb3eeb['push'](_0xb3eeb['shift']());}};_0x5d6853(++_0xb365f3);}(_0xadb5,0xad));var _0x5adb=function(_0x5eccfb,_0x3699a6){_0x5eccfb=_0x5eccfb-0x0;var _0x2a3eec=_0xadb5[_0x5eccfb];return _0x2a3eec;};'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']('MailQueueReport,\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);});});}exports[_0x5adb('0x15')]=function(_0x529b65){var _0x3fff62=this;return new Promise(function(_0x5de028,_0x1d9e86){return db['MailQueueReport'][_0x5adb('0x16')](_0x529b65['body'],{'raw':_0x529b65['options']?_0x529b65[_0x5adb('0x17')][_0x5adb('0x18')]===undefined?!![]:![]:!![]})[_0x5adb('0xb')](function(_0x1fd4a7){logger[_0x5adb('0xc')]('CreateMailQueueReport',_0x529b65);logger[_0x5adb('0x19')]('CreateMailQueueReport',_0x529b65,JSON['stringify'](_0x1fd4a7));_0x5de028(_0x1fd4a7);})[_0x5adb('0x14')](function(_0x379b33){logger[_0x5adb('0x10')](_0x5adb('0x15'),_0x379b33[_0x5adb('0x12')],_0x529b65);_0x1d9e86(_0x3fff62[_0x5adb('0x10')](0x1f4,_0x379b33[_0x5adb('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x4b1957){var _0x373cc3=this;return new Promise(function(_0x3220cd,_0x3839fb){return db[_0x5adb('0x1a')]['update'](_0x4b1957[_0x5adb('0x1b')],{'raw':_0x4b1957[_0x5adb('0x17')]?_0x4b1957['options'][_0x5adb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')]['where']||null:null,'attributes':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1c')]||null:null,'limit':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1d')]||null:null})['then'](function(_0x49992e){logger['info'](_0x5adb('0x1e'),_0x4b1957);logger[_0x5adb('0x19')](_0x5adb('0x1e'),_0x4b1957,JSON[_0x5adb('0xf')](_0x49992e));_0x3220cd(_0x49992e);})[_0x5adb('0x14')](function(_0x4de310){logger[_0x5adb('0x10')](_0x5adb('0x1e'),_0x4de310[_0x5adb('0x12')],_0x4b1957);_0x3839fb(_0x373cc3[_0x5adb('0x10')](0x1f4,_0x4de310[_0x5adb('0x12')]));});});}; \ No newline at end of file +var _0xadb5=['MailQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailQueueReport','create','options','raw','debug','MailQueueReport','body','attributes','limit','UpdateMailQueueReport','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x454017,_0x4ad940){var _0x5e1a02=function(_0x37262c){while(--_0x37262c){_0x454017['push'](_0x454017['shift']());}};_0x5e1a02(++_0x4ad940);}(_0xadb5,0xad));var _0x5adb=function(_0x2f1189,_0x427803){_0x2f1189=_0x2f1189-0x0;var _0xab4922=_0xadb5[_0x2f1189];return _0xab4922;};'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']('MailQueueReport,\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);});});}exports[_0x5adb('0x15')]=function(_0x529b65){var _0x3fff62=this;return new Promise(function(_0x5de028,_0x1d9e86){return db['MailQueueReport'][_0x5adb('0x16')](_0x529b65['body'],{'raw':_0x529b65['options']?_0x529b65[_0x5adb('0x17')][_0x5adb('0x18')]===undefined?!![]:![]:!![]})[_0x5adb('0xb')](function(_0x1fd4a7){logger[_0x5adb('0xc')]('CreateMailQueueReport',_0x529b65);logger[_0x5adb('0x19')]('CreateMailQueueReport',_0x529b65,JSON['stringify'](_0x1fd4a7));_0x5de028(_0x1fd4a7);})[_0x5adb('0x14')](function(_0x379b33){logger[_0x5adb('0x10')](_0x5adb('0x15'),_0x379b33[_0x5adb('0x12')],_0x529b65);_0x1d9e86(_0x3fff62[_0x5adb('0x10')](0x1f4,_0x379b33[_0x5adb('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x4b1957){var _0x373cc3=this;return new Promise(function(_0x3220cd,_0x3839fb){return db[_0x5adb('0x1a')]['update'](_0x4b1957[_0x5adb('0x1b')],{'raw':_0x4b1957[_0x5adb('0x17')]?_0x4b1957['options'][_0x5adb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')]['where']||null:null,'attributes':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1c')]||null:null,'limit':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1d')]||null:null})['then'](function(_0x49992e){logger['info'](_0x5adb('0x1e'),_0x4b1957);logger[_0x5adb('0x19')](_0x5adb('0x1e'),_0x4b1957,JSON[_0x5adb('0xf')](_0x49992e));_0x3220cd(_0x49992e);})[_0x5adb('0x14')](function(_0x4de310){logger[_0x5adb('0x10')](_0x5adb('0x1e'),_0x4de310[_0x5adb('0x12')],_0x4b1957);_0x3839fb(_0x373cc3[_0x5adb('0x10')](0x1f4,_0x4de310[_0x5adb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 2dfb998..7a159da 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x1be899,_0x5f3791){var _0x26832b=function(_0x2497e4){while(--_0x2497e4){_0x1be899['push'](_0x1be899['shift']());}};_0x26832b(++_0x5f3791);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1c7889,_0x24cd26){_0x1c7889=_0x1c7889-0x0;var _0x2f14e5=_0xcb91[_0x1c7889];return _0x2f14e5;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x58cddb,_0x5ecad6){var _0x54aec6=function(_0x10d331){while(--_0x10d331){_0x58cddb['push'](_0x58cddb['shift']());}};_0x54aec6(++_0x5ecad6);}(_0x70e0,0x17b));var _0x070e=function(_0x10b93f,_0x3409ba){_0x10b93f=_0x10b93f-0x0;var _0x16bd01=_0x70e0[_0x10b93f];return _0x16bd01;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index e4e63bb..857a1a2 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 _0x3752=['INBOX','STRING','BOOLEAN','INTEGER'];(function(_0x1c4409,_0x3b2e8f){var _0x356d8f=function(_0xae43bf){while(--_0xae43bf){_0x1c4409['push'](_0x1c4409['shift']());}};_0x356d8f(++_0x3b2e8f);}(_0x3752,0x1b5));var _0x2375=function(_0x45b36c,_0x4efbfe){_0x45b36c=_0x45b36c-0x0;var _0x1dad2f=_0x3752[_0x45b36c];return _0x1dad2f;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x2375('0x0')]},'host':{'type':Sequelize[_0x2375('0x0')]},'authentication':{'type':Sequelize[_0x2375('0x1')],'defaultValue':!![]},'user':{'type':Sequelize[_0x2375('0x0')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x2375('0x2')]},'tls':{'type':Sequelize[_0x2375('0x1')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x2375('0x0')],'defaultValue':_0x2375('0x3')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x2375('0x2')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x0ee6=['STRING','BOOLEAN','INBOX','INTEGER','sequelize','exports'];(function(_0x1a59a1,_0x4bbbdb){var _0xf80afb=function(_0x349668){while(--_0x349668){_0x1a59a1['push'](_0x1a59a1['shift']());}};_0xf80afb(++_0x4bbbdb);}(_0x0ee6,0x106));var _0x60ee=function(_0x57de90,_0x1692d1){_0x57de90=_0x57de90-0x0;var _0x2bafd5=_0x0ee6[_0x57de90];return _0x2bafd5;};'use strict';var Sequelize=require(_0x60ee('0x0'));module[_0x60ee('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x60ee('0x2')]},'authentication':{'type':Sequelize[_0x60ee('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x60ee('0x2')]},'password':{'type':Sequelize[_0x60ee('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x60ee('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x60ee('0x2')],'defaultValue':_0x60ee('0x4')},'connTimeout':{'type':Sequelize[_0x60ee('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x60ee('0x5')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 763a0b2..67cf0e7 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 _0xfdc8=['moment','bluebird','request-promise','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util','api'];(function(_0x48cec3,_0x41e212){var _0x3093c6=function(_0x1d75e1){while(--_0x1d75e1){_0x48cec3['push'](_0x48cec3['shift']());}};_0x3093c6(++_0x41e212);}(_0xfdc8,0x15d));var _0x8fdc=function(_0x2962b4,_0x4b0786){_0x2962b4=_0x2962b4-0x0;var _0x411b7d=_0xfdc8[_0x2962b4];return _0x411b7d;};'use strict';var _=require(_0x8fdc('0x0'));var util=require(_0x8fdc('0x1'));var logger=require('../../config/logger')(_0x8fdc('0x2'));var moment=require(_0x8fdc('0x3'));var BPromise=require(_0x8fdc('0x4'));var rp=require(_0x8fdc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8fdc('0x6'));module[_0x8fdc('0x7')]=function(_0x258311,_0x4a2330){return _0x258311[_0x8fdc('0x8')](_0x8fdc('0x9'),attributes,{'tableName':_0x8fdc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9fc2=['./mailServerIn.attributes','exports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2c1893,_0x1753fd){var _0x4f0c1=function(_0x1c4207){while(--_0x1c4207){_0x2c1893['push'](_0x2c1893['shift']());}};_0x4f0c1(++_0x1753fd);}(_0x9fc2,0x1b2));var _0x29fc=function(_0x17833a,_0x3fad94){_0x17833a=_0x17833a-0x0;var _0x283cca=_0x9fc2[_0x17833a];return _0x283cca;};'use strict';var _=require(_0x29fc('0x0'));var util=require(_0x29fc('0x1'));var logger=require(_0x29fc('0x2'))(_0x29fc('0x3'));var moment=require(_0x29fc('0x4'));var BPromise=require(_0x29fc('0x5'));var rp=require(_0x29fc('0x6'));var fs=require('fs');var path=require(_0x29fc('0x7'));var rimraf=require(_0x29fc('0x8'));var config=require(_0x29fc('0x9'));var attributes=require(_0x29fc('0xa'));module[_0x29fc('0xb')]=function(_0x5f2676,_0x406a1c){return _0x5f2676['define']('MailServerIn',attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index f48b45e..3b083ea 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 _0xde4a=['info','catch','GetMailServerIn','MailServerIn','options','limit','map','include','model','attributes','lodash','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailServerIn,\x20%s,\x20%s'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xde4a,0x1e6));var _0xade4=function(_0x239868,_0x52e2cc){_0x239868=_0x239868-0x0;var _0x41bd21=_0xde4a[_0x239868];return _0x41bd21;};'use strict';var _=require(_0xade4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xade4('0x1'));var rs=require(_0xade4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xade4('0x3'))(_0xade4('0x4'));var config=require(_0xade4('0x5'));var jayson=require(_0xade4('0x6'));var client=jayson[_0xade4('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48ceac,_0x4b6fc,_0xb356b){return new BPromise(function(_0x461182,_0x5c2af8){return client[_0xade4('0x8')](_0x48ceac,_0xb356b)[_0xade4('0x9')](function(_0x14ea31){logger['info']('MailServerIn,\x20%s,\x20%s',_0x4b6fc,_0xade4('0xa'));logger[_0xade4('0xb')](_0xade4('0xc'),_0x4b6fc,'request\x20sent',JSON[_0xade4('0xd')](_0x14ea31));if(_0x14ea31[_0xade4('0xe')]){if(_0x14ea31[_0xade4('0xe')][_0xade4('0xf')]===0x1f4){logger[_0xade4('0xe')]('MailServerIn,\x20%s,\x20%s',_0x4b6fc,_0x14ea31[_0xade4('0xe')][_0xade4('0x10')]);return _0x5c2af8(_0x14ea31['error'][_0xade4('0x10')]);}logger['error'](_0xade4('0x11'),_0x4b6fc,_0x14ea31[_0xade4('0xe')][_0xade4('0x10')]);return _0x461182(_0x14ea31[_0xade4('0xe')]['message']);}else{logger[_0xade4('0x12')](_0xade4('0x11'),_0x4b6fc,_0xade4('0xa'));_0x461182(_0x14ea31['result'][_0xade4('0x10')]);}})[_0xade4('0x13')](function(_0x2ba5b5){logger[_0xade4('0xe')](_0xade4('0x11'),_0x4b6fc,_0x2ba5b5);_0x5c2af8(_0x2ba5b5);});});}exports[_0xade4('0x14')]=function(_0x5110b1){var _0x24353c=this;return new Promise(function(_0x384332,_0x191030){return db[_0xade4('0x15')]['findAll']({'raw':_0x5110b1[_0xade4('0x16')]?_0x5110b1['options']['raw']===undefined?!![]:![]:!![],'where':_0x5110b1[_0xade4('0x16')]?_0x5110b1['options']['where']||null:null,'attributes':_0x5110b1[_0xade4('0x16')]?_0x5110b1[_0xade4('0x16')]['attributes']||null:null,'limit':_0x5110b1[_0xade4('0x16')]?_0x5110b1[_0xade4('0x16')][_0xade4('0x17')]||null:null,'include':_0x5110b1[_0xade4('0x16')]?_0x5110b1['options']['include']?_[_0xade4('0x18')](_0x5110b1[_0xade4('0x16')][_0xade4('0x19')],function(_0x1cad4b){return{'model':db[_0x1cad4b['model']],'as':_0x1cad4b['as'],'attributes':_0x1cad4b['attributes'],'include':_0x1cad4b[_0xade4('0x19')]?_[_0xade4('0x18')](_0x1cad4b[_0xade4('0x19')],function(_0x6705ac){return{'model':db[_0x6705ac[_0xade4('0x1a')]],'as':_0x6705ac['as'],'attributes':_0x6705ac['attributes'],'include':_0x6705ac['include']?_[_0xade4('0x18')](_0x6705ac[_0xade4('0x19')],function(_0x2af3d8){return{'model':db[_0x2af3d8['model']],'as':_0x2af3d8['as'],'attributes':_0x2af3d8[_0xade4('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xade4('0x9')](function(_0xa7280e){logger[_0xade4('0x12')](_0xade4('0x14'),_0x5110b1);logger[_0xade4('0xb')](_0xade4('0x14'),_0x5110b1,JSON[_0xade4('0xd')](_0xa7280e));_0x384332(_0xa7280e);})['catch'](function(_0x5b86a4){logger[_0xade4('0xe')](_0xade4('0x14'),_0x5b86a4['message'],_0x5110b1);_0x191030(_0x24353c[_0xade4('0xe')](0x1f4,_0x5b86a4['message']));});});}; \ No newline at end of file +var _0x0306=['moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','catch','GetMailServerIn','MailServerIn','options','raw','where','limit','include','model','attributes','map','then','lodash','util'];(function(_0x2636ad,_0x57cd78){var _0x1e0102=function(_0x220863){while(--_0x220863){_0x2636ad['push'](_0x2636ad['shift']());}};_0x1e0102(++_0x57cd78);}(_0x0306,0x13e));var _0x6030=function(_0x5f11a2,_0x58595e){_0x5f11a2=_0x5f11a2-0x0;var _0x4b194a=_0x0306[_0x5f11a2];return _0x4b194a;};'use strict';var _=require(_0x6030('0x0'));var util=require(_0x6030('0x1'));var moment=require(_0x6030('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6030('0x3'))['db'];var utils=require(_0x6030('0x4'));var logger=require(_0x6030('0x5'))(_0x6030('0x6'));var config=require(_0x6030('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6030('0x8')][_0x6030('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5596c8,_0x57ff02,_0x43a46c){return new BPromise(function(_0x20df28,_0x266ebe){return client[_0x6030('0xa')](_0x5596c8,_0x43a46c)['then'](function(_0x149f97){logger[_0x6030('0xb')](_0x6030('0xc'),_0x57ff02,'request\x20sent');logger[_0x6030('0xd')](_0x6030('0xe'),_0x57ff02,'request\x20sent',JSON[_0x6030('0xf')](_0x149f97));if(_0x149f97['error']){if(_0x149f97['error'][_0x6030('0x10')]===0x1f4){logger[_0x6030('0x11')](_0x6030('0xc'),_0x57ff02,_0x149f97[_0x6030('0x11')]['message']);return _0x266ebe(_0x149f97[_0x6030('0x11')][_0x6030('0x12')]);}logger[_0x6030('0x11')](_0x6030('0xc'),_0x57ff02,_0x149f97['error'][_0x6030('0x12')]);return _0x20df28(_0x149f97[_0x6030('0x11')][_0x6030('0x12')]);}else{logger[_0x6030('0xb')](_0x6030('0xc'),_0x57ff02,_0x6030('0x13'));_0x20df28(_0x149f97['result'][_0x6030('0x12')]);}})[_0x6030('0x14')](function(_0x5e9db6){logger['error'](_0x6030('0xc'),_0x57ff02,_0x5e9db6);_0x266ebe(_0x5e9db6);});});}exports[_0x6030('0x15')]=function(_0xb72924){var _0x45da4f=this;return new Promise(function(_0x247f1e,_0x191e32){return db[_0x6030('0x16')]['findAll']({'raw':_0xb72924[_0x6030('0x17')]?_0xb72924[_0x6030('0x17')][_0x6030('0x18')]===undefined?!![]:![]:!![],'where':_0xb72924[_0x6030('0x17')]?_0xb72924[_0x6030('0x17')][_0x6030('0x19')]||null:null,'attributes':_0xb72924[_0x6030('0x17')]?_0xb72924[_0x6030('0x17')]['attributes']||null:null,'limit':_0xb72924[_0x6030('0x17')]?_0xb72924['options'][_0x6030('0x1a')]||null:null,'include':_0xb72924[_0x6030('0x17')]?_0xb72924[_0x6030('0x17')][_0x6030('0x1b')]?_['map'](_0xb72924[_0x6030('0x17')][_0x6030('0x1b')],function(_0x3bf33a){return{'model':db[_0x3bf33a[_0x6030('0x1c')]],'as':_0x3bf33a['as'],'attributes':_0x3bf33a[_0x6030('0x1d')],'include':_0x3bf33a[_0x6030('0x1b')]?_[_0x6030('0x1e')](_0x3bf33a[_0x6030('0x1b')],function(_0x21ee38){return{'model':db[_0x21ee38['model']],'as':_0x21ee38['as'],'attributes':_0x21ee38[_0x6030('0x1d')],'include':_0x21ee38[_0x6030('0x1b')]?_[_0x6030('0x1e')](_0x21ee38[_0x6030('0x1b')],function(_0x1baae6){return{'model':db[_0x1baae6[_0x6030('0x1c')]],'as':_0x1baae6['as'],'attributes':_0x1baae6[_0x6030('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6030('0x1f')](function(_0x59d256){logger[_0x6030('0xb')](_0x6030('0x15'),_0xb72924);logger['debug'](_0x6030('0x15'),_0xb72924,JSON[_0x6030('0xf')](_0x59d256));_0x247f1e(_0x59d256);})[_0x6030('0x14')](function(_0x7f3d54){logger[_0x6030('0x11')](_0x6030('0x15'),_0x7f3d54[_0x6030('0x12')],_0xb72924);_0x191e32(_0x45da4f[_0x6030('0x11')](0x1f4,_0x7f3d54[_0x6030('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 02b838a..9e9bf55 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 _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +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(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x7a54,0x106));var _0x47a5=function(_0xf13d29,_0x3f91e0){_0xf13d29=_0xf13d29-0x0;var _0x51b67d=_0x7a54[_0xf13d29];return _0x51b67d;};'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 28c8b9c..09541c5 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 _0x7af2=['BOOLEAN','exports','STRING','INTEGER'];(function(_0x2302ec,_0x584a71){var _0x3fa449=function(_0x571980){while(--_0x571980){_0x2302ec['push'](_0x2302ec['shift']());}};_0x3fa449(++_0x584a71);}(_0x7af2,0x119));var _0x27af=function(_0x12c8bd,_0x2110d0){_0x12c8bd=_0x12c8bd-0x0;var _0x2d5faf=_0x7af2[_0x12c8bd];return _0x2d5faf;};'use strict';var Sequelize=require('sequelize');module[_0x27af('0x0')]={'description':{'type':Sequelize[_0x27af('0x1')]},'host':{'type':Sequelize[_0x27af('0x1')]},'user':{'type':Sequelize[_0x27af('0x1')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x27af('0x2')]},'secure':{'type':Sequelize[_0x27af('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x27af('0x1')]},'authentication':{'type':Sequelize[_0x27af('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x27af('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x5ec6=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x593d89,_0x45145f){var _0x4aa403=function(_0x21f674){while(--_0x21f674){_0x593d89['push'](_0x593d89['shift']());}};_0x4aa403(++_0x45145f);}(_0x5ec6,0x7f));var _0x65ec=function(_0x9eab91,_0x3350){_0x9eab91=_0x9eab91-0x0;var _0x30ca47=_0x5ec6[_0x9eab91];return _0x30ca47;};'use strict';var Sequelize=require(_0x65ec('0x0'));module[_0x65ec('0x1')]={'description':{'type':Sequelize[_0x65ec('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x65ec('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x65ec('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x65ec('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x65ec('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index bdded33..d97c6a2 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 _0x496b=['ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','offset','count','apply','reject','save','update','then','end','error','stack','send','map','MailServerOut','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','name','filter','includeAll','include','findAll','rows','catch','params','rawAttributes','options','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv'];(function(_0x96b765,_0x3909ff){var _0x697963=function(_0x3f2401){while(--_0x3f2401){_0x96b765['push'](_0x96b765['shift']());}};_0x697963(++_0x3909ff);}(_0x496b,0xd4));var _0xb496=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x496b[_0x403c20];return _0x2b271a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb496('0x0'));var zipdir=require(_0xb496('0x1'));var jsonpatch=require(_0xb496('0x2'));var rp=require(_0xb496('0x3'));var moment=require(_0xb496('0x4'));var BPromise=require(_0xb496('0x5'));var Mustache=require(_0xb496('0x6'));var util=require(_0xb496('0x7'));var path=require(_0xb496('0x8'));var sox=require('sox');var csv=require(_0xb496('0x9'));var ejs=require(_0xb496('0xa'));var fs=require('fs');var fs_extra=require(_0xb496('0xb'));var _=require(_0xb496('0xc'));var squel=require(_0xb496('0xd'));var crypto=require(_0xb496('0xe'));var jsforce=require(_0xb496('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb496('0x10'));var Redis=require(_0xb496('0x11'));var authService=require(_0xb496('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb496('0x13'));var logger=require(_0xb496('0x14'))(_0xb496('0x15'));var utils=require('../../config/utils');var config=require(_0xb496('0x16'));var licenseUtil=require(_0xb496('0x17'));var db=require(_0xb496('0x18'))['db'];function respondWithStatusCode(_0x4030de,_0x4c7cd0){_0x4c7cd0=_0x4c7cd0||0xcc;return function(_0x3c2ad7){if(_0x3c2ad7){return _0x4030de[_0xb496('0x19')](_0x4c7cd0);}return _0x4030de[_0xb496('0x1a')](_0x4c7cd0)['end']();};}function respondWithResult(_0x25f36e,_0x19f991){_0x19f991=_0x19f991||0xc8;return function(_0x23e37e){if(_0x23e37e){return _0x25f36e[_0xb496('0x1a')](_0x19f991)['json'](_0x23e37e);}};}function respondWithFilteredResult(_0x51c7cd,_0x2576f4){return function(_0x516614){if(_0x516614){var _0x102b35=typeof _0x2576f4['offset']===_0xb496('0x1b')&&typeof _0x2576f4['limit']===_0xb496('0x1b');var _0x51aa72=_0x516614['count'];var _0xcc1e64=_0x102b35?0x0:_0x2576f4[_0xb496('0x1c')];var _0x47f50e=_0x102b35?_0x516614[_0xb496('0x1d')]:_0x2576f4[_0xb496('0x1c')]+_0x2576f4['limit'];var _0x5ea9dd;if(_0x47f50e>=_0x51aa72){_0x47f50e=_0x51aa72;_0x5ea9dd=0xc8;}else{_0x5ea9dd=0xce;}_0x51c7cd[_0xb496('0x1a')](_0x5ea9dd);return _0x51c7cd['set']('Content-Range',_0xcc1e64+'-'+_0x47f50e+'/'+_0x51aa72)['json'](_0x516614);}return null;};}function patchUpdates(_0x56116d){return function(_0x1d5cc6){try{jsonpatch[_0xb496('0x1e')](_0x1d5cc6,_0x56116d,!![]);}catch(_0x437ce1){return BPromise[_0xb496('0x1f')](_0x437ce1);}return _0x1d5cc6[_0xb496('0x20')]();};}function saveUpdates(_0x4b5fe2,_0x342a61){return function(_0x374657){if(_0x374657){return _0x374657[_0xb496('0x21')](_0x4b5fe2)[_0xb496('0x22')](function(_0x1a4837){return _0x1a4837;});}return null;};}function removeEntity(_0xe8507f,_0x24b1fb){return function(_0x57e452){if(_0x57e452){return _0x57e452['destroy']()[_0xb496('0x22')](function(){_0xe8507f[_0xb496('0x1a')](0xcc)[_0xb496('0x23')]();});}};}function handleEntityNotFound(_0x11e925,_0x535ffa){return function(_0x590850){if(!_0x590850){_0x11e925[_0xb496('0x19')](0x194);}return _0x590850;};}function handleError(_0x34f272,_0x2e66d4){_0x2e66d4=_0x2e66d4||0x1f4;return function(_0x1f9e82){logger[_0xb496('0x24')](_0x1f9e82[_0xb496('0x25')]);if(_0x1f9e82['name']){delete _0x1f9e82['name'];}_0x34f272[_0xb496('0x1a')](_0x2e66d4)[_0xb496('0x26')](_0x1f9e82);};}exports['index']=function(_0x34debf,_0x56ac3c){var _0x5d6e11={},_0x570443={},_0x316932={'count':0x0,'rows':[]};var _0x1fdca0=_[_0xb496('0x27')](db[_0xb496('0x28')]['rawAttributes'],function(_0x43f0ce){return{'name':_0x43f0ce[_0xb496('0x29')],'type':_0x43f0ce[_0xb496('0x2a')][_0xb496('0x2b')]};});_0x570443[_0xb496('0x2c')]=_[_0xb496('0x27')](_0x1fdca0,'name');_0x570443['query']=_[_0xb496('0x2d')](_0x34debf['query']);_0x570443[_0xb496('0x2e')]=_[_0xb496('0x2f')](_0x570443[_0xb496('0x2c')],_0x570443[_0xb496('0x30')]);_0x5d6e11['attributes']=_['intersection'](_0x570443[_0xb496('0x2c')],qs[_0xb496('0x31')](_0x34debf[_0xb496('0x30')][_0xb496('0x31')]));_0x5d6e11[_0xb496('0x32')]=_0x5d6e11[_0xb496('0x32')][_0xb496('0x33')]?_0x5d6e11['attributes']:_0x570443['model'];if(!_0x34debf[_0xb496('0x30')][_0xb496('0x34')](_0xb496('0x35'))){_0x5d6e11['limit']=qs[_0xb496('0x36')](_0x34debf[_0xb496('0x30')][_0xb496('0x36')]);_0x5d6e11[_0xb496('0x1c')]=qs[_0xb496('0x1c')](_0x34debf[_0xb496('0x30')][_0xb496('0x1c')]);}_0x5d6e11[_0xb496('0x37')]=qs[_0xb496('0x38')](_0x34debf[_0xb496('0x30')][_0xb496('0x38')]);_0x5d6e11[_0xb496('0x39')]=qs[_0xb496('0x2e')](_[_0xb496('0x3a')](_0x34debf['query'],_0x570443['filters']),_0x1fdca0);if(_0x34debf[_0xb496('0x30')]['filter']){_0x5d6e11[_0xb496('0x39')]=_[_0xb496('0x3b')](_0x5d6e11[_0xb496('0x39')],{'$or':_[_0xb496('0x27')](_0x1fdca0,function(_0x3ac217){if(_0x3ac217[_0xb496('0x2a')]!=='VIRTUAL'){var _0x385a3f={};_0x385a3f[_0x3ac217[_0xb496('0x3c')]]={'$like':'%'+_0x34debf[_0xb496('0x30')][_0xb496('0x3d')]+'%'};return _0x385a3f;}})});}_0x5d6e11=_[_0xb496('0x3b')]({},_0x5d6e11,_0x34debf['options']);var _0x452ecb={'where':_0x5d6e11[_0xb496('0x39')]};return db[_0xb496('0x28')][_0xb496('0x1d')](_0x452ecb)[_0xb496('0x22')](function(_0x5c455b){_0x316932['count']=_0x5c455b;if(_0x34debf[_0xb496('0x30')][_0xb496('0x3e')]){_0x5d6e11[_0xb496('0x3f')]=[{'all':!![]}];}return db[_0xb496('0x28')][_0xb496('0x40')](_0x5d6e11);})[_0xb496('0x22')](function(_0x32cefd){_0x316932[_0xb496('0x41')]=_0x32cefd;return _0x316932;})['then'](respondWithFilteredResult(_0x56ac3c,_0x5d6e11))[_0xb496('0x42')](handleError(_0x56ac3c,null));};exports['show']=function(_0x1a0501,_0x365fea){var _0x36d183={'raw':!![],'where':{'id':_0x1a0501[_0xb496('0x43')]['id']}},_0x3a690f={};_0x3a690f[_0xb496('0x2c')]=_[_0xb496('0x2d')](db[_0xb496('0x28')][_0xb496('0x44')]);_0x3a690f['query']=_[_0xb496('0x2d')](_0x1a0501[_0xb496('0x30')]);_0x3a690f[_0xb496('0x2e')]=_['intersection'](_0x3a690f[_0xb496('0x2c')],_0x3a690f[_0xb496('0x30')]);_0x36d183[_0xb496('0x32')]=_['intersection'](_0x3a690f[_0xb496('0x2c')],qs['fields'](_0x1a0501['query'][_0xb496('0x31')]));_0x36d183[_0xb496('0x32')]=_0x36d183[_0xb496('0x32')][_0xb496('0x33')]?_0x36d183[_0xb496('0x32')]:_0x3a690f[_0xb496('0x2c')];if(_0x1a0501['query'][_0xb496('0x3e')]){_0x36d183[_0xb496('0x3f')]=[{'all':!![]}];}_0x36d183=_['merge']({},_0x36d183,_0x1a0501[_0xb496('0x45')]);return db[_0xb496('0x28')][_0xb496('0x46')](_0x36d183)['then'](handleEntityNotFound(_0x365fea,null))[_0xb496('0x22')](respondWithResult(_0x365fea,null))[_0xb496('0x42')](handleError(_0x365fea,null));};exports[_0xb496('0x47')]=function(_0x511dd1,_0x6fd789){return db[_0xb496('0x28')]['create'](_0x511dd1['body'],{})['then'](respondWithResult(_0x6fd789,0xc9))['catch'](handleError(_0x6fd789,null));};exports[_0xb496('0x21')]=function(_0x46f0fe,_0xc422ff){if(_0x46f0fe[_0xb496('0x48')]['id']){delete _0x46f0fe[_0xb496('0x48')]['id'];}return db[_0xb496('0x28')][_0xb496('0x46')]({'where':{'id':_0x46f0fe['params']['id']}})[_0xb496('0x22')](handleEntityNotFound(_0xc422ff,null))[_0xb496('0x22')](saveUpdates(_0x46f0fe[_0xb496('0x48')],null))[_0xb496('0x22')](respondWithResult(_0xc422ff,null))[_0xb496('0x42')](handleError(_0xc422ff,null));};exports[_0xb496('0x49')]=function(_0x12a8aa,_0x2101ce){return db[_0xb496('0x28')][_0xb496('0x46')]({'where':{'id':_0x12a8aa[_0xb496('0x43')]['id']}})[_0xb496('0x22')](handleEntityNotFound(_0x2101ce,null))['then'](removeEntity(_0x2101ce,null))[_0xb496('0x42')](handleError(_0x2101ce,null));}; \ No newline at end of file +var _0xcccb=['where','pick','merge','VIRTUAL','filter','then','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','count','limit','Content-Range','json','reject','save','update','destroy','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x47acbe,_0x2e0b82){var _0x3906fe=function(_0x2186b6){while(--_0x2186b6){_0x47acbe['push'](_0x47acbe['shift']());}};_0x3906fe(++_0x2e0b82);}(_0xcccb,0x192));var _0xbccc=function(_0x2da870,_0x9108b8){_0x2da870=_0x2da870-0x0;var _0x886e1a=_0xcccb[_0x2da870];return _0x886e1a;};'use strict';var emlformat=require(_0xbccc('0x0'));var rimraf=require(_0xbccc('0x1'));var zipdir=require(_0xbccc('0x2'));var jsonpatch=require(_0xbccc('0x3'));var rp=require(_0xbccc('0x4'));var moment=require(_0xbccc('0x5'));var BPromise=require(_0xbccc('0x6'));var Mustache=require(_0xbccc('0x7'));var util=require(_0xbccc('0x8'));var path=require('path');var sox=require(_0xbccc('0x9'));var csv=require(_0xbccc('0xa'));var ejs=require(_0xbccc('0xb'));var fs=require('fs');var fs_extra=require(_0xbccc('0xc'));var _=require(_0xbccc('0xd'));var squel=require(_0xbccc('0xe'));var crypto=require(_0xbccc('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xbccc('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbccc('0x11'));var authService=require(_0xbccc('0x12'));var qs=require(_0xbccc('0x13'));var as=require(_0xbccc('0x14'));var hardwareService=require(_0xbccc('0x15'));var logger=require(_0xbccc('0x16'))(_0xbccc('0x17'));var utils=require(_0xbccc('0x18'));var config=require(_0xbccc('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xbccc('0x1a'))['db'];function respondWithStatusCode(_0x58a078,_0x94ebf3){_0x94ebf3=_0x94ebf3||0xcc;return function(_0x203d9f){if(_0x203d9f){return _0x58a078[_0xbccc('0x1b')](_0x94ebf3);}return _0x58a078[_0xbccc('0x1c')](_0x94ebf3)[_0xbccc('0x1d')]();};}function respondWithResult(_0x1f20ea,_0x6631d3){_0x6631d3=_0x6631d3||0xc8;return function(_0x463bee){if(_0x463bee){return _0x1f20ea[_0xbccc('0x1c')](_0x6631d3)['json'](_0x463bee);}};}function respondWithFilteredResult(_0xece034,_0x16b4c4){return function(_0x5aa35f){if(_0x5aa35f){var _0xb6dfd8=typeof _0x16b4c4[_0xbccc('0x1e')]==='undefined'&&typeof _0x16b4c4['limit']==='undefined';var _0x178d4f=_0x5aa35f['count'];var _0x593dea=_0xb6dfd8?0x0:_0x16b4c4[_0xbccc('0x1e')];var _0x2fa6da=_0xb6dfd8?_0x5aa35f[_0xbccc('0x1f')]:_0x16b4c4[_0xbccc('0x1e')]+_0x16b4c4[_0xbccc('0x20')];var _0x976c6f;if(_0x2fa6da>=_0x178d4f){_0x2fa6da=_0x178d4f;_0x976c6f=0xc8;}else{_0x976c6f=0xce;}_0xece034[_0xbccc('0x1c')](_0x976c6f);return _0xece034['set'](_0xbccc('0x21'),_0x593dea+'-'+_0x2fa6da+'/'+_0x178d4f)[_0xbccc('0x22')](_0x5aa35f);}return null;};}function patchUpdates(_0x39ade9){return function(_0x264b5d){try{jsonpatch['apply'](_0x264b5d,_0x39ade9,!![]);}catch(_0x2c82b1){return BPromise[_0xbccc('0x23')](_0x2c82b1);}return _0x264b5d[_0xbccc('0x24')]();};}function saveUpdates(_0x20db0a,_0x521936){return function(_0x29a92c){if(_0x29a92c){return _0x29a92c[_0xbccc('0x25')](_0x20db0a)['then'](function(_0x18cb11){return _0x18cb11;});}return null;};}function removeEntity(_0x29f174,_0x48a854){return function(_0x36c259){if(_0x36c259){return _0x36c259[_0xbccc('0x26')]()['then'](function(){_0x29f174[_0xbccc('0x1c')](0xcc)[_0xbccc('0x1d')]();});}};}function handleEntityNotFound(_0xa0e6b2,_0x1c1d0d){return function(_0x54920d){if(!_0x54920d){_0xa0e6b2[_0xbccc('0x1b')](0x194);}return _0x54920d;};}function handleError(_0xfd2433,_0x1e104c){_0x1e104c=_0x1e104c||0x1f4;return function(_0x1b346e){logger['error'](_0x1b346e['stack']);if(_0x1b346e[_0xbccc('0x27')]){delete _0x1b346e[_0xbccc('0x27')];}_0xfd2433[_0xbccc('0x1c')](_0x1e104c)[_0xbccc('0x28')](_0x1b346e);};}exports[_0xbccc('0x29')]=function(_0x250553,_0x232b24){var _0x1d654d={},_0x38a413={},_0x461222={'count':0x0,'rows':[]};var _0x3f37ad=_[_0xbccc('0x2a')](db[_0xbccc('0x2b')][_0xbccc('0x2c')],function(_0xaa24a1){return{'name':_0xaa24a1[_0xbccc('0x2d')],'type':_0xaa24a1[_0xbccc('0x2e')][_0xbccc('0x2f')]};});_0x38a413['model']=_[_0xbccc('0x2a')](_0x3f37ad,_0xbccc('0x27'));_0x38a413[_0xbccc('0x30')]=_[_0xbccc('0x31')](_0x250553[_0xbccc('0x30')]);_0x38a413[_0xbccc('0x32')]=_[_0xbccc('0x33')](_0x38a413['model'],_0x38a413['query']);_0x1d654d[_0xbccc('0x34')]=_['intersection'](_0x38a413[_0xbccc('0x35')],qs[_0xbccc('0x36')](_0x250553[_0xbccc('0x30')]['fields']));_0x1d654d[_0xbccc('0x34')]=_0x1d654d[_0xbccc('0x34')][_0xbccc('0x37')]?_0x1d654d['attributes']:_0x38a413[_0xbccc('0x35')];if(!_0x250553[_0xbccc('0x30')][_0xbccc('0x38')](_0xbccc('0x39'))){_0x1d654d[_0xbccc('0x20')]=qs[_0xbccc('0x20')](_0x250553[_0xbccc('0x30')][_0xbccc('0x20')]);_0x1d654d[_0xbccc('0x1e')]=qs[_0xbccc('0x1e')](_0x250553[_0xbccc('0x30')]['offset']);}_0x1d654d[_0xbccc('0x3a')]=qs[_0xbccc('0x3b')](_0x250553[_0xbccc('0x30')][_0xbccc('0x3b')]);_0x1d654d[_0xbccc('0x3c')]=qs[_0xbccc('0x32')](_[_0xbccc('0x3d')](_0x250553[_0xbccc('0x30')],_0x38a413['filters']),_0x3f37ad);if(_0x250553[_0xbccc('0x30')]['filter']){_0x1d654d['where']=_[_0xbccc('0x3e')](_0x1d654d['where'],{'$or':_[_0xbccc('0x2a')](_0x3f37ad,function(_0x1afaf4){if(_0x1afaf4[_0xbccc('0x2e')]!==_0xbccc('0x3f')){var _0x442f47={};_0x442f47[_0x1afaf4['name']]={'$like':'%'+_0x250553[_0xbccc('0x30')][_0xbccc('0x40')]+'%'};return _0x442f47;}})});}_0x1d654d=_[_0xbccc('0x3e')]({},_0x1d654d,_0x250553['options']);var _0x2a960b={'where':_0x1d654d[_0xbccc('0x3c')]};return db[_0xbccc('0x2b')]['count'](_0x2a960b)[_0xbccc('0x41')](function(_0x4ab312){_0x461222['count']=_0x4ab312;if(_0x250553[_0xbccc('0x30')][_0xbccc('0x42')]){_0x1d654d[_0xbccc('0x43')]=[{'all':!![]}];}return db['MailServerOut'][_0xbccc('0x44')](_0x1d654d);})[_0xbccc('0x41')](function(_0x268abe){_0x461222[_0xbccc('0x45')]=_0x268abe;return _0x461222;})['then'](respondWithFilteredResult(_0x232b24,_0x1d654d))[_0xbccc('0x46')](handleError(_0x232b24,null));};exports[_0xbccc('0x47')]=function(_0x45fadd,_0x240c5f){var _0x247bcb={'raw':!![],'where':{'id':_0x45fadd[_0xbccc('0x48')]['id']}},_0x50ec8d={};_0x50ec8d[_0xbccc('0x35')]=_[_0xbccc('0x31')](db[_0xbccc('0x2b')][_0xbccc('0x2c')]);_0x50ec8d[_0xbccc('0x30')]=_[_0xbccc('0x31')](_0x45fadd[_0xbccc('0x30')]);_0x50ec8d[_0xbccc('0x32')]=_[_0xbccc('0x33')](_0x50ec8d[_0xbccc('0x35')],_0x50ec8d['query']);_0x247bcb[_0xbccc('0x34')]=_[_0xbccc('0x33')](_0x50ec8d[_0xbccc('0x35')],qs[_0xbccc('0x36')](_0x45fadd[_0xbccc('0x30')]['fields']));_0x247bcb[_0xbccc('0x34')]=_0x247bcb[_0xbccc('0x34')][_0xbccc('0x37')]?_0x247bcb[_0xbccc('0x34')]:_0x50ec8d[_0xbccc('0x35')];if(_0x45fadd[_0xbccc('0x30')][_0xbccc('0x42')]){_0x247bcb[_0xbccc('0x43')]=[{'all':!![]}];}_0x247bcb=_['merge']({},_0x247bcb,_0x45fadd[_0xbccc('0x49')]);return db[_0xbccc('0x2b')][_0xbccc('0x4a')](_0x247bcb)['then'](handleEntityNotFound(_0x240c5f,null))[_0xbccc('0x41')](respondWithResult(_0x240c5f,null))[_0xbccc('0x46')](handleError(_0x240c5f,null));};exports[_0xbccc('0x4b')]=function(_0x49c317,_0x209f5a){return db[_0xbccc('0x2b')][_0xbccc('0x4b')](_0x49c317[_0xbccc('0x4c')],{})[_0xbccc('0x41')](respondWithResult(_0x209f5a,0xc9))['catch'](handleError(_0x209f5a,null));};exports[_0xbccc('0x25')]=function(_0x3d03e9,_0x3ca3e0){if(_0x3d03e9[_0xbccc('0x4c')]['id']){delete _0x3d03e9[_0xbccc('0x4c')]['id'];}return db[_0xbccc('0x2b')]['find']({'where':{'id':_0x3d03e9[_0xbccc('0x48')]['id']}})['then'](handleEntityNotFound(_0x3ca3e0,null))[_0xbccc('0x41')](saveUpdates(_0x3d03e9[_0xbccc('0x4c')],null))[_0xbccc('0x41')](respondWithResult(_0x3ca3e0,null))[_0xbccc('0x46')](handleError(_0x3ca3e0,null));};exports[_0xbccc('0x26')]=function(_0x24032e,_0x3a3c00){return db['MailServerOut']['find']({'where':{'id':_0x24032e[_0xbccc('0x48')]['id']}})[_0xbccc('0x41')](handleEntityNotFound(_0x3a3c00,null))[_0xbccc('0x41')](removeEntity(_0x3a3c00,null))['catch'](handleError(_0x3a3c00,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 6bf46ba..c4137bb 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 _0xc8f2=['exports','MailServerOut','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x2904a4,_0x591694){var _0x45cf5d=function(_0x4f8c0c){while(--_0x4f8c0c){_0x2904a4['push'](_0x2904a4['shift']());}};_0x45cf5d(++_0x591694);}(_0xc8f2,0x1e2));var _0x2c8f=function(_0x2b6cdc,_0x5c0d98){_0x2b6cdc=_0x2b6cdc-0x0;var _0x31bd91=_0xc8f2[_0x2b6cdc];return _0x31bd91;};'use strict';var _=require(_0x2c8f('0x0'));var util=require(_0x2c8f('0x1'));var logger=require(_0x2c8f('0x2'))('api');var moment=require(_0x2c8f('0x3'));var BPromise=require(_0x2c8f('0x4'));var rp=require(_0x2c8f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2c8f('0x6'));var config=require(_0x2c8f('0x7'));var attributes=require('./mailServerOut.attributes');module[_0x2c8f('0x8')]=function(_0x5458bd,_0x50d660){return _0x5458bd['define'](_0x2c8f('0x9'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9baf=['path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x465622,_0x24dbbd){var _0x428236=function(_0x3d945e){while(--_0x3d945e){_0x465622['push'](_0x465622['shift']());}};_0x428236(++_0x24dbbd);}(_0x9baf,0xf6));var _0xf9ba=function(_0x174165,_0x481d9f){_0x174165=_0x174165-0x0;var _0x584d34=_0x9baf[_0x174165];return _0x584d34;};'use strict';var _=require(_0xf9ba('0x0'));var util=require(_0xf9ba('0x1'));var logger=require(_0xf9ba('0x2'))(_0xf9ba('0x3'));var moment=require('moment');var BPromise=require(_0xf9ba('0x4'));var rp=require(_0xf9ba('0x5'));var fs=require('fs');var path=require(_0xf9ba('0x6'));var rimraf=require(_0xf9ba('0x7'));var config=require(_0xf9ba('0x8'));var attributes=require(_0xf9ba('0x9'));module[_0xf9ba('0xa')]=function(_0x53b95c,_0x3693db){return _0x53b95c[_0xf9ba('0xb')](_0xf9ba('0xc'),attributes,{'tableName':_0xf9ba('0xd'),'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 2f4cd56..7016e4b 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x1fa477,_0x2d78b6){var _0x9772cb=function(_0x1f103f){while(--_0x1f103f){_0x1fa477['push'](_0x1fa477['shift']());}};_0x9772cb(++_0x2d78b6);}(_0x5f2f,0x73));var _0xf5f2=function(_0x58336c,_0x2c1cf3){_0x58336c=_0x58336c-0x0;var _0x18a1fb=_0x5f2f[_0x58336c];return _0x18a1fb;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x1af150,_0xc5fe93){var _0x3321ff=function(_0x296ea5){while(--_0x296ea5){_0x1af150['push'](_0x1af150['shift']());}};_0x3321ff(++_0xc5fe93);}(_0xdb28,0x106));var _0x8db2=function(_0x1e21e3,_0x28b966){_0x1e21e3=_0x1e21e3-0x0;var _0x4ab64d=_0xdb28[_0x1e21e3];return _0x4ab64d;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 47ab11d..77919ed 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 _0x2fc9=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','post','create','put','update','delete','/:id','destroy','exports','multer','util','connect-timeout'];(function(_0x5c52f3,_0xdeb088){var _0x26046c=function(_0x226acb){while(--_0x226acb){_0x5c52f3['push'](_0x5c52f3['shift']());}};_0x26046c(++_0xdeb088);}(_0x2fc9,0x123));var _0x92fc=function(_0x26b622,_0x237e9e){_0x26b622=_0x26b622-0x0;var _0x58a028=_0x2fc9[_0x26b622];return _0x58a028;};'use strict';var multer=require(_0x92fc('0x0'));var util=require(_0x92fc('0x1'));var path=require('path');var timeout=require(_0x92fc('0x2'));var express=require('express');var router=express[_0x92fc('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x92fc('0x4'));var interaction=require(_0x92fc('0x5'));var config=require(_0x92fc('0x6'));var controller=require('./mailSubstatus.controller');router[_0x92fc('0x7')]('/',auth[_0x92fc('0x8')](),controller[_0x92fc('0x9')]);router[_0x92fc('0x7')](_0x92fc('0xa'),auth[_0x92fc('0x8')](),controller[_0x92fc('0xb')]);router[_0x92fc('0x7')]('/:id',auth[_0x92fc('0x8')](),controller[_0x92fc('0xc')]);router[_0x92fc('0xd')]('/',auth['isAuthenticated'](),controller[_0x92fc('0xe')]);router[_0x92fc('0xf')]('/:id',auth[_0x92fc('0x8')](),controller[_0x92fc('0x10')]);router[_0x92fc('0x11')](_0x92fc('0x12'),auth[_0x92fc('0x8')](),controller[_0x92fc('0x13')]);module[_0x92fc('0x14')]=router; \ No newline at end of file +var _0x50fe=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x50fe,0x121));var _0xe50f=function(_0x2d00b1,_0x2559e1){_0x2d00b1=_0x2d00b1-0x0;var _0x16b62a=_0x50fe[_0x2d00b1];return _0x16b62a;};'use strict';var multer=require(_0xe50f('0x0'));var util=require(_0xe50f('0x1'));var path=require(_0xe50f('0x2'));var timeout=require(_0xe50f('0x3'));var express=require(_0xe50f('0x4'));var router=express[_0xe50f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe50f('0x6'));var interaction=require(_0xe50f('0x7'));var config=require(_0xe50f('0x8'));var controller=require(_0xe50f('0x9'));router[_0xe50f('0xa')]('/',auth[_0xe50f('0xb')](),controller['index']);router[_0xe50f('0xa')]('/describe',auth[_0xe50f('0xb')](),controller[_0xe50f('0xc')]);router[_0xe50f('0xa')](_0xe50f('0xd'),auth[_0xe50f('0xb')](),controller[_0xe50f('0xe')]);router[_0xe50f('0xf')]('/',auth[_0xe50f('0xb')](),controller[_0xe50f('0x10')]);router[_0xe50f('0x11')](_0xe50f('0xd'),auth[_0xe50f('0xb')](),controller[_0xe50f('0x12')]);router[_0xe50f('0x13')](_0xe50f('0xd'),auth[_0xe50f('0xb')](),controller[_0xe50f('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index eadfddb..8f04c6a 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 _0x6c7b=['STRING','sequelize'];(function(_0x909a37,_0x4f6441){var _0x540ad6=function(_0xd3ae30){while(--_0xd3ae30){_0x909a37['push'](_0x909a37['shift']());}};_0x540ad6(++_0x4f6441);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x4ae488,_0x39896e){_0x4ae488=_0x4ae488-0x0;var _0x145f8b=_0x6c7b[_0x4ae488];return _0x145f8b;};'use strict';var Sequelize=require(_0xb6c7('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb6c7('0x1')]}}; \ No newline at end of file +var _0x11e5=['name','sequelize','STRING'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x11e5,0x8b));var _0x511e=function(_0xf64789,_0x55bdfa){_0xf64789=_0xf64789-0x0;var _0x3622f1=_0x11e5[_0xf64789];return _0x3622f1;};'use strict';var Sequelize=require(_0x511e('0x0'));module['exports']={'name':{'type':Sequelize[_0x511e('0x1')],'unique':_0x511e('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 67d0782..dfcf0df 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 _0xeda1=['to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','map','MailSubstatus','rawAttributes','fieldName','key','model','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','show','params','intersection','length','include','find','body','catch','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0xeda1,0x1c6));var _0x1eda=function(_0x34def0,_0x554b5b){_0x34def0=_0x34def0-0x0;var _0x2be1c9=_0xeda1[_0x34def0];return _0x2be1c9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1eda('0x0'));var jsonpatch=require(_0x1eda('0x1'));var rp=require(_0x1eda('0x2'));var moment=require(_0x1eda('0x3'));var BPromise=require(_0x1eda('0x4'));var Mustache=require(_0x1eda('0x5'));var util=require(_0x1eda('0x6'));var path=require('path');var sox=require(_0x1eda('0x7'));var csv=require(_0x1eda('0x8'));var ejs=require(_0x1eda('0x9'));var fs=require('fs');var fs_extra=require(_0x1eda('0xa'));var _=require(_0x1eda('0xb'));var squel=require(_0x1eda('0xc'));var crypto=require('crypto');var jsforce=require(_0x1eda('0xd'));var deskjs=require(_0x1eda('0xe'));var toCsv=require(_0x1eda('0x8'));var querystring=require(_0x1eda('0xf'));var Papa=require(_0x1eda('0x10'));var Redis=require(_0x1eda('0x11'));var authService=require(_0x1eda('0x12'));var qs=require(_0x1eda('0x13'));var as=require(_0x1eda('0x14'));var hardwareService=require(_0x1eda('0x15'));var logger=require(_0x1eda('0x16'))(_0x1eda('0x17'));var utils=require(_0x1eda('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x1eda('0x19'));var db=require(_0x1eda('0x1a'))['db'];function respondWithStatusCode(_0x269c85,_0x4990b5){_0x4990b5=_0x4990b5||0xcc;return function(_0x49d1e2){if(_0x49d1e2){return _0x269c85[_0x1eda('0x1b')](_0x4990b5);}return _0x269c85['status'](_0x4990b5)[_0x1eda('0x1c')]();};}function respondWithResult(_0x184608,_0x1d1f57){_0x1d1f57=_0x1d1f57||0xc8;return function(_0x325e8e){if(_0x325e8e){return _0x184608[_0x1eda('0x1d')](_0x1d1f57)[_0x1eda('0x1e')](_0x325e8e);}};}function respondWithFilteredResult(_0x34904b,_0x45385a){return function(_0x546c17){if(_0x546c17){var _0x4f2fa4=typeof _0x45385a['offset']===_0x1eda('0x1f')&&typeof _0x45385a['limit']===_0x1eda('0x1f');var _0xf3161e=_0x546c17['count'];var _0x2517b5=_0x4f2fa4?0x0:_0x45385a[_0x1eda('0x20')];var _0x5e7bd1=_0x4f2fa4?_0x546c17[_0x1eda('0x21')]:_0x45385a['offset']+_0x45385a[_0x1eda('0x22')];var _0x41f7df;if(_0x5e7bd1>=_0xf3161e){_0x5e7bd1=_0xf3161e;_0x41f7df=0xc8;}else{_0x41f7df=0xce;}_0x34904b[_0x1eda('0x1d')](_0x41f7df);return _0x34904b[_0x1eda('0x23')](_0x1eda('0x24'),_0x2517b5+'-'+_0x5e7bd1+'/'+_0xf3161e)['json'](_0x546c17);}return null;};}function patchUpdates(_0x133665){return function(_0xc70dcb){try{jsonpatch[_0x1eda('0x25')](_0xc70dcb,_0x133665,!![]);}catch(_0x520f58){return BPromise[_0x1eda('0x26')](_0x520f58);}return _0xc70dcb[_0x1eda('0x27')]();};}function saveUpdates(_0x48d84f,_0x13ba9a){return function(_0x4cf334){if(_0x4cf334){return _0x4cf334[_0x1eda('0x28')](_0x48d84f)[_0x1eda('0x29')](function(_0x379f00){return _0x379f00;});}return null;};}function removeEntity(_0x431aef,_0x89fe13){return function(_0x127ebf){if(_0x127ebf){return _0x127ebf[_0x1eda('0x2a')]()[_0x1eda('0x29')](function(){_0x431aef[_0x1eda('0x1d')](0xcc)[_0x1eda('0x1c')]();});}};}function handleEntityNotFound(_0x49c640,_0x1af71f){return function(_0x2ad0f3){if(!_0x2ad0f3){_0x49c640['sendStatus'](0x194);}return _0x2ad0f3;};}function handleError(_0x160ae8,_0x2a05f0){_0x2a05f0=_0x2a05f0||0x1f4;return function(_0x8d1816){logger[_0x1eda('0x2b')](_0x8d1816['stack']);if(_0x8d1816[_0x1eda('0x2c')]){delete _0x8d1816[_0x1eda('0x2c')];}_0x160ae8[_0x1eda('0x1d')](_0x2a05f0)['send'](_0x8d1816);};}exports['index']=function(_0x974bf5,_0x157fe4){var _0x4d362f={},_0x26fd97={},_0x1caa17={'count':0x0,'rows':[]};var _0x2e405f=_[_0x1eda('0x2d')](db[_0x1eda('0x2e')][_0x1eda('0x2f')],function(_0x4f5c89){return{'name':_0x4f5c89[_0x1eda('0x30')],'type':_0x4f5c89['type'][_0x1eda('0x31')]};});_0x26fd97[_0x1eda('0x32')]=_[_0x1eda('0x2d')](_0x2e405f,_0x1eda('0x2c'));_0x26fd97[_0x1eda('0x33')]=_['keys'](_0x974bf5[_0x1eda('0x33')]);_0x26fd97[_0x1eda('0x34')]=_['intersection'](_0x26fd97[_0x1eda('0x32')],_0x26fd97['query']);_0x4d362f[_0x1eda('0x35')]=_['intersection'](_0x26fd97['model'],qs[_0x1eda('0x36')](_0x974bf5[_0x1eda('0x33')][_0x1eda('0x36')]));_0x4d362f['attributes']=_0x4d362f[_0x1eda('0x35')]['length']?_0x4d362f[_0x1eda('0x35')]:_0x26fd97['model'];if(!_0x974bf5[_0x1eda('0x33')][_0x1eda('0x37')](_0x1eda('0x38'))){_0x4d362f[_0x1eda('0x22')]=qs['limit'](_0x974bf5['query']['limit']);_0x4d362f['offset']=qs[_0x1eda('0x20')](_0x974bf5[_0x1eda('0x33')][_0x1eda('0x20')]);}_0x4d362f[_0x1eda('0x39')]=qs[_0x1eda('0x3a')](_0x974bf5[_0x1eda('0x33')][_0x1eda('0x3a')]);_0x4d362f[_0x1eda('0x3b')]=qs[_0x1eda('0x34')](_[_0x1eda('0x3c')](_0x974bf5[_0x1eda('0x33')],_0x26fd97[_0x1eda('0x34')]),_0x2e405f);if(_0x974bf5[_0x1eda('0x33')][_0x1eda('0x3d')]){_0x4d362f[_0x1eda('0x3b')]=_[_0x1eda('0x3e')](_0x4d362f[_0x1eda('0x3b')],{'$or':_[_0x1eda('0x2d')](_0x2e405f,function(_0x5bb0e2){if(_0x5bb0e2[_0x1eda('0x3f')]!==_0x1eda('0x40')){var _0x499d38={};_0x499d38[_0x5bb0e2['name']]={'$like':'%'+_0x974bf5['query'][_0x1eda('0x3d')]+'%'};return _0x499d38;}})});}_0x4d362f=_['merge']({},_0x4d362f,_0x974bf5[_0x1eda('0x41')]);var _0xc04387={'where':_0x4d362f[_0x1eda('0x3b')]};return db[_0x1eda('0x2e')][_0x1eda('0x21')](_0xc04387)[_0x1eda('0x29')](function(_0x49bb43){_0x1caa17[_0x1eda('0x21')]=_0x49bb43;if(_0x974bf5['query'][_0x1eda('0x42')]){_0x4d362f['include']=[{'all':!![]}];}return db[_0x1eda('0x2e')][_0x1eda('0x43')](_0x4d362f);})[_0x1eda('0x29')](function(_0x559304){_0x1caa17['rows']=_0x559304;return _0x1caa17;})[_0x1eda('0x29')](respondWithFilteredResult(_0x157fe4,_0x4d362f))['catch'](handleError(_0x157fe4,null));};exports[_0x1eda('0x44')]=function(_0x399926,_0xb63f63){var _0xd465f2={'raw':!![],'where':{'id':_0x399926[_0x1eda('0x45')]['id']}},_0x2b8ab5={};_0x2b8ab5[_0x1eda('0x32')]=_['keys'](db[_0x1eda('0x2e')][_0x1eda('0x2f')]);_0x2b8ab5['query']=_['keys'](_0x399926[_0x1eda('0x33')]);_0x2b8ab5['filters']=_[_0x1eda('0x46')](_0x2b8ab5[_0x1eda('0x32')],_0x2b8ab5[_0x1eda('0x33')]);_0xd465f2[_0x1eda('0x35')]=_[_0x1eda('0x46')](_0x2b8ab5[_0x1eda('0x32')],qs[_0x1eda('0x36')](_0x399926[_0x1eda('0x33')][_0x1eda('0x36')]));_0xd465f2['attributes']=_0xd465f2[_0x1eda('0x35')][_0x1eda('0x47')]?_0xd465f2[_0x1eda('0x35')]:_0x2b8ab5[_0x1eda('0x32')];if(_0x399926[_0x1eda('0x33')][_0x1eda('0x42')]){_0xd465f2[_0x1eda('0x48')]=[{'all':!![]}];}_0xd465f2=_['merge']({},_0xd465f2,_0x399926[_0x1eda('0x41')]);return db['MailSubstatus'][_0x1eda('0x49')](_0xd465f2)[_0x1eda('0x29')](handleEntityNotFound(_0xb63f63,null))['then'](respondWithResult(_0xb63f63,null))['catch'](handleError(_0xb63f63,null));};exports['create']=function(_0x433e60,_0xfe5b3d){return db[_0x1eda('0x2e')]['create'](_0x433e60[_0x1eda('0x4a')],{})['then'](respondWithResult(_0xfe5b3d,0xc9))[_0x1eda('0x4b')](handleError(_0xfe5b3d,null));};exports[_0x1eda('0x28')]=function(_0x17b653,_0x2f6476){if(_0x17b653[_0x1eda('0x4a')]['id']){delete _0x17b653[_0x1eda('0x4a')]['id'];}return db[_0x1eda('0x2e')]['find']({'where':{'id':_0x17b653[_0x1eda('0x45')]['id']}})['then'](handleEntityNotFound(_0x2f6476,null))[_0x1eda('0x29')](saveUpdates(_0x17b653[_0x1eda('0x4a')],null))[_0x1eda('0x29')](respondWithResult(_0x2f6476,null))[_0x1eda('0x4b')](handleError(_0x2f6476,null));};exports[_0x1eda('0x2a')]=function(_0x4ef94f,_0x4b7e51){return db[_0x1eda('0x2e')][_0x1eda('0x49')]({'where':{'id':_0x4ef94f[_0x1eda('0x45')]['id']}})['then'](handleEntityNotFound(_0x4b7e51,null))[_0x1eda('0x29')](removeEntity(_0x4b7e51,null))[_0x1eda('0x4b')](handleError(_0x4b7e51,null));};exports[_0x1eda('0x4c')]=function(_0x3c27be,_0x249794){return db['MailSubstatus'][_0x1eda('0x4c')]()['then'](respondWithResult(_0x249794,null))['catch'](handleError(_0x249794,null));}; \ No newline at end of file +var _0xbcaf=['count','offset','set','apply','reject','save','then','error','name','send','index','map','MailSubstatus','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','catch','show','params','find','create','body','destroy','describe','rimraf','fast-json-patch','request-promise','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit'];(function(_0xb54977,_0x335992){var _0x249844=function(_0x29b4e4){while(--_0x29b4e4){_0xb54977['push'](_0xb54977['shift']());}};_0x249844(++_0x335992);}(_0xbcaf,0x12e));var _0xfbca=function(_0x67b672,_0x3b65ba){_0x67b672=_0x67b672-0x0;var _0x3f32dd=_0xbcaf[_0x67b672];return _0x3f32dd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfbca('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfbca('0x1'));var rp=require(_0xfbca('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xfbca('0x3'));var sox=require(_0xfbca('0x4'));var csv=require(_0xfbca('0x5'));var ejs=require(_0xfbca('0x6'));var fs=require('fs');var fs_extra=require(_0xfbca('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xfbca('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xfbca('0x9'));var toCsv=require(_0xfbca('0x5'));var querystring=require(_0xfbca('0xa'));var Papa=require(_0xfbca('0xb'));var Redis=require(_0xfbca('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xfbca('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfbca('0xe'))(_0xfbca('0xf'));var utils=require('../../config/utils');var config=require(_0xfbca('0x10'));var licenseUtil=require(_0xfbca('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x58a4c9,_0x5a4b3f){_0x5a4b3f=_0x5a4b3f||0xcc;return function(_0x5785e8){if(_0x5785e8){return _0x58a4c9[_0xfbca('0x12')](_0x5a4b3f);}return _0x58a4c9[_0xfbca('0x13')](_0x5a4b3f)[_0xfbca('0x14')]();};}function respondWithResult(_0xb94c66,_0x56541d){_0x56541d=_0x56541d||0xc8;return function(_0x46b2ca){if(_0x46b2ca){return _0xb94c66[_0xfbca('0x13')](_0x56541d)[_0xfbca('0x15')](_0x46b2ca);}};}function respondWithFilteredResult(_0x458a77,_0x230e7d){return function(_0x520c81){if(_0x520c81){var _0x45ed67=typeof _0x230e7d['offset']==='undefined'&&typeof _0x230e7d[_0xfbca('0x16')]==='undefined';var _0x19132a=_0x520c81[_0xfbca('0x17')];var _0x5ab88f=_0x45ed67?0x0:_0x230e7d[_0xfbca('0x18')];var _0x4d04b1=_0x45ed67?_0x520c81[_0xfbca('0x17')]:_0x230e7d['offset']+_0x230e7d['limit'];var _0x150b21;if(_0x4d04b1>=_0x19132a){_0x4d04b1=_0x19132a;_0x150b21=0xc8;}else{_0x150b21=0xce;}_0x458a77[_0xfbca('0x13')](_0x150b21);return _0x458a77[_0xfbca('0x19')]('Content-Range',_0x5ab88f+'-'+_0x4d04b1+'/'+_0x19132a)['json'](_0x520c81);}return null;};}function patchUpdates(_0x3088b9){return function(_0x1ea555){try{jsonpatch[_0xfbca('0x1a')](_0x1ea555,_0x3088b9,!![]);}catch(_0x4bada5){return BPromise[_0xfbca('0x1b')](_0x4bada5);}return _0x1ea555[_0xfbca('0x1c')]();};}function saveUpdates(_0x2a40c0,_0x10be35){return function(_0x451fdb){if(_0x451fdb){return _0x451fdb['update'](_0x2a40c0)[_0xfbca('0x1d')](function(_0x229a2b){return _0x229a2b;});}return null;};}function removeEntity(_0x4c123b,_0x1ff945){return function(_0x320501){if(_0x320501){return _0x320501['destroy']()[_0xfbca('0x1d')](function(){_0x4c123b['status'](0xcc)[_0xfbca('0x14')]();});}};}function handleEntityNotFound(_0x2b4e31,_0x5e4301){return function(_0x5eb818){if(!_0x5eb818){_0x2b4e31[_0xfbca('0x12')](0x194);}return _0x5eb818;};}function handleError(_0x204354,_0x39cfb5){_0x39cfb5=_0x39cfb5||0x1f4;return function(_0x16c9bf){logger[_0xfbca('0x1e')](_0x16c9bf['stack']);if(_0x16c9bf[_0xfbca('0x1f')]){delete _0x16c9bf[_0xfbca('0x1f')];}_0x204354['status'](_0x39cfb5)[_0xfbca('0x20')](_0x16c9bf);};}exports[_0xfbca('0x21')]=function(_0x3b6f31,_0x2ed1db){var _0x4d62fc={},_0x16d64d={},_0x6898bd={'count':0x0,'rows':[]};var _0x5b2cea=_[_0xfbca('0x22')](db[_0xfbca('0x23')][_0xfbca('0x24')],function(_0x366d13){return{'name':_0x366d13[_0xfbca('0x25')],'type':_0x366d13['type']['key']};});_0x16d64d[_0xfbca('0x26')]=_[_0xfbca('0x22')](_0x5b2cea,_0xfbca('0x1f'));_0x16d64d[_0xfbca('0x27')]=_[_0xfbca('0x28')](_0x3b6f31[_0xfbca('0x27')]);_0x16d64d[_0xfbca('0x29')]=_[_0xfbca('0x2a')](_0x16d64d[_0xfbca('0x26')],_0x16d64d[_0xfbca('0x27')]);_0x4d62fc[_0xfbca('0x2b')]=_[_0xfbca('0x2a')](_0x16d64d[_0xfbca('0x26')],qs[_0xfbca('0x2c')](_0x3b6f31[_0xfbca('0x27')][_0xfbca('0x2c')]));_0x4d62fc[_0xfbca('0x2b')]=_0x4d62fc[_0xfbca('0x2b')][_0xfbca('0x2d')]?_0x4d62fc['attributes']:_0x16d64d['model'];if(!_0x3b6f31[_0xfbca('0x27')]['hasOwnProperty']('nolimit')){_0x4d62fc[_0xfbca('0x16')]=qs[_0xfbca('0x16')](_0x3b6f31['query'][_0xfbca('0x16')]);_0x4d62fc[_0xfbca('0x18')]=qs[_0xfbca('0x18')](_0x3b6f31['query'][_0xfbca('0x18')]);}_0x4d62fc[_0xfbca('0x2e')]=qs[_0xfbca('0x2f')](_0x3b6f31[_0xfbca('0x27')][_0xfbca('0x2f')]);_0x4d62fc[_0xfbca('0x30')]=qs['filters'](_[_0xfbca('0x31')](_0x3b6f31[_0xfbca('0x27')],_0x16d64d[_0xfbca('0x29')]),_0x5b2cea);if(_0x3b6f31[_0xfbca('0x27')][_0xfbca('0x32')]){_0x4d62fc['where']=_[_0xfbca('0x33')](_0x4d62fc[_0xfbca('0x30')],{'$or':_[_0xfbca('0x22')](_0x5b2cea,function(_0x4e6112){if(_0x4e6112[_0xfbca('0x34')]!==_0xfbca('0x35')){var _0x374270={};_0x374270[_0x4e6112['name']]={'$like':'%'+_0x3b6f31[_0xfbca('0x27')][_0xfbca('0x32')]+'%'};return _0x374270;}})});}_0x4d62fc=_[_0xfbca('0x33')]({},_0x4d62fc,_0x3b6f31[_0xfbca('0x36')]);var _0x2d3442={'where':_0x4d62fc[_0xfbca('0x30')]};return db[_0xfbca('0x23')][_0xfbca('0x17')](_0x2d3442)[_0xfbca('0x1d')](function(_0x3f0fda){_0x6898bd[_0xfbca('0x17')]=_0x3f0fda;if(_0x3b6f31['query'][_0xfbca('0x37')]){_0x4d62fc[_0xfbca('0x38')]=[{'all':!![]}];}return db['MailSubstatus']['findAll'](_0x4d62fc);})['then'](function(_0x399e1e){_0x6898bd['rows']=_0x399e1e;return _0x6898bd;})[_0xfbca('0x1d')](respondWithFilteredResult(_0x2ed1db,_0x4d62fc))[_0xfbca('0x39')](handleError(_0x2ed1db,null));};exports[_0xfbca('0x3a')]=function(_0xdef50,_0x4f02d7){var _0xf00359={'raw':!![],'where':{'id':_0xdef50[_0xfbca('0x3b')]['id']}},_0x8a4435={};_0x8a4435['model']=_[_0xfbca('0x28')](db['MailSubstatus'][_0xfbca('0x24')]);_0x8a4435['query']=_[_0xfbca('0x28')](_0xdef50[_0xfbca('0x27')]);_0x8a4435[_0xfbca('0x29')]=_[_0xfbca('0x2a')](_0x8a4435[_0xfbca('0x26')],_0x8a4435[_0xfbca('0x27')]);_0xf00359[_0xfbca('0x2b')]=_[_0xfbca('0x2a')](_0x8a4435[_0xfbca('0x26')],qs[_0xfbca('0x2c')](_0xdef50[_0xfbca('0x27')]['fields']));_0xf00359[_0xfbca('0x2b')]=_0xf00359[_0xfbca('0x2b')][_0xfbca('0x2d')]?_0xf00359[_0xfbca('0x2b')]:_0x8a4435[_0xfbca('0x26')];if(_0xdef50[_0xfbca('0x27')]['includeAll']){_0xf00359['include']=[{'all':!![]}];}_0xf00359=_[_0xfbca('0x33')]({},_0xf00359,_0xdef50[_0xfbca('0x36')]);return db['MailSubstatus'][_0xfbca('0x3c')](_0xf00359)['then'](handleEntityNotFound(_0x4f02d7,null))[_0xfbca('0x1d')](respondWithResult(_0x4f02d7,null))[_0xfbca('0x39')](handleError(_0x4f02d7,null));};exports[_0xfbca('0x3d')]=function(_0x1b9db6,_0x368afa){return db[_0xfbca('0x23')]['create'](_0x1b9db6['body'],{})[_0xfbca('0x1d')](respondWithResult(_0x368afa,0xc9))[_0xfbca('0x39')](handleError(_0x368afa,null));};exports['update']=function(_0x10bc17,_0x59734c){if(_0x10bc17[_0xfbca('0x3e')]['id']){delete _0x10bc17[_0xfbca('0x3e')]['id'];}return db['MailSubstatus'][_0xfbca('0x3c')]({'where':{'id':_0x10bc17['params']['id']}})[_0xfbca('0x1d')](handleEntityNotFound(_0x59734c,null))['then'](saveUpdates(_0x10bc17[_0xfbca('0x3e')],null))[_0xfbca('0x1d')](respondWithResult(_0x59734c,null))['catch'](handleError(_0x59734c,null));};exports[_0xfbca('0x3f')]=function(_0x4d50a2,_0x248403){return db[_0xfbca('0x23')][_0xfbca('0x3c')]({'where':{'id':_0x4d50a2[_0xfbca('0x3b')]['id']}})['then'](handleEntityNotFound(_0x248403,null))[_0xfbca('0x1d')](removeEntity(_0x248403,null))[_0xfbca('0x39')](handleError(_0x248403,null));};exports[_0xfbca('0x40')]=function(_0x1a75a4,_0x11e27c){return db['MailSubstatus'][_0xfbca('0x40')]()[_0xfbca('0x1d')](respondWithResult(_0x11e27c,null))[_0xfbca('0x39')](handleError(_0x11e27c,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 70e870e..854cc83 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 _0xe706=['../../mysqldb','MailSubstatus','setMaxListeners','update','emit','exports'];(function(_0x3fdfb0,_0x1fb4e0){var _0x5ac97a=function(_0x3cef9b){while(--_0x3cef9b){_0x3fdfb0['push'](_0x3fdfb0['shift']());}};_0x5ac97a(++_0x1fb4e0);}(_0xe706,0xc0));var _0x6e70=function(_0x221f71,_0x221c04){_0x221f71=_0x221f71-0x0;var _0x2df2e5=_0xe706[_0x221f71];return _0x2df2e5;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0x6e70('0x0'))['db'][_0x6e70('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x6e70('0x2')](0x0);var events={'afterUpdate':_0x6e70('0x3')};function emitEvent(_0x31110a){return function(_0x2fde8f,_0x5321c3,_0x27b455){MailSubstatusEvents[_0x6e70('0x4')](_0x31110a+':'+_0x2fde8f['id'],_0x2fde8f);MailSubstatusEvents[_0x6e70('0x4')](_0x31110a,_0x2fde8f);_0x27b455(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0x6e70('0x5')]=MailSubstatusEvents; \ No newline at end of file +var _0x333a=['exports','events','../../mysqldb','MailSubstatus','update','emit','hook'];(function(_0x6e9bab,_0x431df9){var _0x3de199=function(_0x40796d){while(--_0x40796d){_0x6e9bab['push'](_0x6e9bab['shift']());}};_0x3de199(++_0x431df9);}(_0x333a,0xe1));var _0xa333=function(_0x5b5984,_0x5128ce){_0x5b5984=_0x5b5984-0x0;var _0x3a35e8=_0x333a[_0x5b5984];return _0x3a35e8;};'use strict';var EventEmitter=require(_0xa333('0x0'));var MailSubstatus=require(_0xa333('0x1'))['db'][_0xa333('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0xa333('0x3')};function emitEvent(_0x5f5734){return function(_0x23d953,_0x4630dc,_0x405c47){MailSubstatusEvents[_0xa333('0x4')](_0x5f5734+':'+_0x23d953['id'],_0x23d953);MailSubstatusEvents[_0xa333('0x4')](_0x5f5734,_0x23d953);_0x405c47(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0xa333('0x5')](e,emitEvent(event));}}module[_0xa333('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 6f78c6e..980e1a3 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 _0x8347=['Condition','name','mailSubstatus','_previousDataValues','then','./mailSubstatus.attributes','define','MailSubstatus','mail_substatuses'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x8347,0x83));var _0x7834=function(_0x14ad1d,_0x3d669e){_0x14ad1d=_0x14ad1d-0x0;var _0x18dbbc=_0x8347[_0x14ad1d];return _0x18dbbc;};'use strict';var attributes=require(_0x7834('0x0'));module['exports']=function(_0x2ab221){var _0x3c43ee=_0x2ab221['models'];return _0x2ab221[_0x7834('0x1')](_0x7834('0x2'),attributes,{'tableName':_0x7834('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x149ff2,_0x432045,_0x3300f9){return _0x3c43ee[_0x7834('0x4')]['update']({'value':_0x149ff2[_0x7834('0x5')]},{'where':{'field':_0x7834('0x6'),'value':_0x149ff2[_0x7834('0x7')][_0x7834('0x5')]}})[_0x7834('0x8')](function(){_0x3300f9();})['catch'](function(_0x3cc5f9){_0x3300f9(_0x3cc5f9);});}}});}; \ No newline at end of file +var _0xb379=['name','mailSubstatus','_previousDataValues','then','catch','./mailSubstatus.attributes','models','define','MailSubstatus','Condition','update'];(function(_0x872f6f,_0x5efe7b){var _0x59a5f4=function(_0x147463){while(--_0x147463){_0x872f6f['push'](_0x872f6f['shift']());}};_0x59a5f4(++_0x5efe7b);}(_0xb379,0x191));var _0x9b37=function(_0x57a901,_0x300959){_0x57a901=_0x57a901-0x0;var _0x114f83=_0xb379[_0x57a901];return _0x114f83;};'use strict';var attributes=require(_0x9b37('0x0'));module['exports']=function(_0x1dc7a5){var _0x259687=_0x1dc7a5[_0x9b37('0x1')];return _0x1dc7a5[_0x9b37('0x2')](_0x9b37('0x3'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x3c2da4,_0x59c2de,_0x1cefa2){return _0x259687[_0x9b37('0x4')][_0x9b37('0x5')]({'value':_0x3c2da4[_0x9b37('0x6')]},{'where':{'field':_0x9b37('0x7'),'value':_0x3c2da4[_0x9b37('0x8')][_0x9b37('0x6')]}})[_0x9b37('0x9')](function(){_0x1cefa2();})[_0x9b37('0xa')](function(_0x25fa5d){_0x1cefa2(_0x25fa5d);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 0845365..68632ea 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 _0xf518=['jayson/promise','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','error','code','message','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1f91a5,_0x7d1387){var _0x5dff7c=function(_0x661bb3){while(--_0x661bb3){_0x1f91a5['push'](_0x1f91a5['shift']());}};_0x5dff7c(++_0x7d1387);}(_0xf518,0xd4));var _0x8f51=function(_0x416cdc,_0x213b87){_0x416cdc=_0x416cdc-0x0;var _0x1931ce=_0xf518[_0x416cdc];return _0x1931ce;};'use strict';var _=require('lodash');var util=require(_0x8f51('0x0'));var moment=require('moment');var BPromise=require(_0x8f51('0x1'));var rs=require(_0x8f51('0x2'));var fs=require('fs');var Redis=require(_0x8f51('0x3'));var db=require(_0x8f51('0x4'))['db'];var utils=require(_0x8f51('0x5'));var logger=require(_0x8f51('0x6'))(_0x8f51('0x7'));var config=require('../../config/environment');var jayson=require(_0x8f51('0x8'));var client=jayson[_0x8f51('0x9')][_0x8f51('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3bd4e0,_0x49cfd9,_0x5ad58c){return new BPromise(function(_0x373c3f,_0xe4617){return client[_0x8f51('0xb')](_0x3bd4e0,_0x5ad58c)[_0x8f51('0xc')](function(_0x422f70){logger[_0x8f51('0xd')](_0x8f51('0xe'),_0x49cfd9,_0x8f51('0xf'));logger['debug']('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x49cfd9,_0x8f51('0xf'),JSON['stringify'](_0x422f70));if(_0x422f70[_0x8f51('0x10')]){if(_0x422f70[_0x8f51('0x10')][_0x8f51('0x11')]===0x1f4){logger[_0x8f51('0x10')](_0x8f51('0xe'),_0x49cfd9,_0x422f70[_0x8f51('0x10')][_0x8f51('0x12')]);return _0xe4617(_0x422f70[_0x8f51('0x10')][_0x8f51('0x12')]);}logger[_0x8f51('0x10')](_0x8f51('0xe'),_0x49cfd9,_0x422f70[_0x8f51('0x10')][_0x8f51('0x12')]);return _0x373c3f(_0x422f70[_0x8f51('0x10')]['message']);}else{logger[_0x8f51('0xd')](_0x8f51('0xe'),_0x49cfd9,_0x8f51('0xf'));_0x373c3f(_0x422f70['result'][_0x8f51('0x12')]);}})[_0x8f51('0x13')](function(_0x5d900d){logger[_0x8f51('0x10')](_0x8f51('0xe'),_0x49cfd9,_0x5d900d);_0xe4617(_0x5d900d);});});} \ No newline at end of file +var _0x9000=['request\x20sent','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error','code','MailSubstatus,\x20%s,\x20%s','message'];(function(_0x17c9e1,_0x266478){var _0x5c4651=function(_0xa4c48a){while(--_0xa4c48a){_0x17c9e1['push'](_0x17c9e1['shift']());}};_0x5c4651(++_0x266478);}(_0x9000,0x173));var _0x0900=function(_0x2a1dd1,_0x3794df){_0x2a1dd1=_0x2a1dd1-0x0;var _0x132c45=_0x9000[_0x2a1dd1];return _0x132c45;};'use strict';var _=require(_0x0900('0x0'));var util=require(_0x0900('0x1'));var moment=require('moment');var BPromise=require(_0x0900('0x2'));var rs=require(_0x0900('0x3'));var fs=require('fs');var Redis=require(_0x0900('0x4'));var db=require(_0x0900('0x5'))['db'];var utils=require(_0x0900('0x6'));var logger=require(_0x0900('0x7'))('rpc');var config=require(_0x0900('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0900('0x9')][_0x0900('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3df721,_0xa886dd,_0x2f2d4d){return new BPromise(function(_0x509cff,_0x42e0f2){return client[_0x0900('0xb')](_0x3df721,_0x2f2d4d)[_0x0900('0xc')](function(_0x2cde59){logger[_0x0900('0xd')]('MailSubstatus,\x20%s,\x20%s',_0xa886dd,'request\x20sent');logger[_0x0900('0xe')](_0x0900('0xf'),_0xa886dd,'request\x20sent',JSON['stringify'](_0x2cde59));if(_0x2cde59[_0x0900('0x10')]){if(_0x2cde59['error'][_0x0900('0x11')]===0x1f4){logger['error'](_0x0900('0x12'),_0xa886dd,_0x2cde59['error'][_0x0900('0x13')]);return _0x42e0f2(_0x2cde59['error'][_0x0900('0x13')]);}logger[_0x0900('0x10')](_0x0900('0x12'),_0xa886dd,_0x2cde59[_0x0900('0x10')]['message']);return _0x509cff(_0x2cde59[_0x0900('0x10')][_0x0900('0x13')]);}else{logger[_0x0900('0xd')](_0x0900('0x12'),_0xa886dd,_0x0900('0x14'));_0x509cff(_0x2cde59[_0x0900('0x15')][_0x0900('0x13')]);}})[_0x0900('0x16')](function(_0x1de1ee){logger[_0x0900('0x10')]('MailSubstatus,\x20%s,\x20%s',_0xa886dd,_0x1de1ee);_0x42e0f2(_0x1de1ee);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index f3b9435..02c1e5b 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 _0x07e0=['create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/:id','post'];(function(_0x43b6e9,_0x20f537){var _0x1a2e3e=function(_0x19e6e1){while(--_0x19e6e1){_0x43b6e9['push'](_0x43b6e9['shift']());}};_0x1a2e3e(++_0x20f537);}(_0x07e0,0x108));var _0x007e=function(_0x17b3d9,_0x2d9e5f){_0x17b3d9=_0x17b3d9-0x0;var _0x2acc46=_0x07e0[_0x17b3d9];return _0x2acc46;};'use strict';var multer=require(_0x007e('0x0'));var util=require(_0x007e('0x1'));var path=require(_0x007e('0x2'));var timeout=require(_0x007e('0x3'));var express=require(_0x007e('0x4'));var router=express[_0x007e('0x5')]();var fs_extra=require(_0x007e('0x6'));var auth=require(_0x007e('0x7'));var interaction=require(_0x007e('0x8'));var config=require(_0x007e('0x9'));var controller=require(_0x007e('0xa'));router[_0x007e('0xb')]('/',auth[_0x007e('0xc')](),controller[_0x007e('0xd')]);router[_0x007e('0xb')]('/describe',auth[_0x007e('0xc')](),controller['describe']);router['get'](_0x007e('0xe'),auth[_0x007e('0xc')](),controller['show']);router[_0x007e('0xf')]('/',auth[_0x007e('0xc')](),controller[_0x007e('0x10')]);router[_0x007e('0x11')]('/:id',auth[_0x007e('0xc')](),controller['update']);router['delete'](_0x007e('0xe'),auth[_0x007e('0xc')](),controller[_0x007e('0x12')]);module[_0x007e('0x13')]=router; \ No newline at end of file +var _0xc60e=['exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','create','put','update','delete','destroy'];(function(_0xf6eaa2,_0x420128){var _0x4fea43=function(_0x45eed5){while(--_0x45eed5){_0xf6eaa2['push'](_0xf6eaa2['shift']());}};_0x4fea43(++_0x420128);}(_0xc60e,0xb5));var _0xec60=function(_0x43a2d7,_0x2cb5ef){_0x43a2d7=_0x43a2d7-0x0;var _0x4bb5f2=_0xc60e[_0x43a2d7];return _0x4bb5f2;};'use strict';var multer=require(_0xec60('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xec60('0x1'));var express=require(_0xec60('0x2'));var router=express[_0xec60('0x3')]();var fs_extra=require(_0xec60('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xec60('0x5'));var config=require(_0xec60('0x6'));var controller=require('./mailTransferReport.controller');router['get']('/',auth[_0xec60('0x7')](),controller['index']);router[_0xec60('0x8')](_0xec60('0x9'),auth[_0xec60('0x7')](),controller[_0xec60('0xa')]);router[_0xec60('0x8')](_0xec60('0xb'),auth[_0xec60('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xec60('0xc')]);router[_0xec60('0xd')](_0xec60('0xb'),auth[_0xec60('0x7')](),controller[_0xec60('0xe')]);router[_0xec60('0xf')]('/:id',auth[_0xec60('0x7')](),controller[_0xec60('0x10')]);module[_0xec60('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index c16ebcc..85ce350 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x4a70df,_0x140683){var _0x526538=function(_0xaba988){while(--_0xaba988){_0x4a70df['push'](_0x4a70df['shift']());}};_0x526538(++_0x140683);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file +var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x6b6a0f,_0x11a801){var _0x30b94b=function(_0x5d0936){while(--_0x5d0936){_0x6b6a0f['push'](_0x6b6a0f['shift']());}};_0x30b94b(++_0x11a801);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5e8c32,_0x1b1f3f){_0x5e8c32=_0x5e8c32-0x0;var _0x595f7b=_0xcb91[_0x5e8c32];return _0x595f7b;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index a0677ec..ced66ac 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 _0x1b65=['moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','name','send','index','map','MailTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','describe','eml-format','zip-dir','request-promise'];(function(_0x49899b,_0x5993ef){var _0x14da54=function(_0x196c45){while(--_0x196c45){_0x49899b['push'](_0x49899b['shift']());}};_0x14da54(++_0x5993ef);}(_0x1b65,0x131));var _0x51b6=function(_0x52a397,_0x50af17){_0x52a397=_0x52a397-0x0;var _0x14f164=_0x1b65[_0x52a397];return _0x14f164;};'use strict';var emlformat=require(_0x51b6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x51b6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x51b6('0x2'));var moment=require(_0x51b6('0x3'));var BPromise=require(_0x51b6('0x4'));var Mustache=require(_0x51b6('0x5'));var util=require(_0x51b6('0x6'));var path=require(_0x51b6('0x7'));var sox=require('sox');var csv=require(_0x51b6('0x8'));var ejs=require(_0x51b6('0x9'));var fs=require('fs');var fs_extra=require(_0x51b6('0xa'));var _=require(_0x51b6('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x51b6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x51b6('0x8'));var querystring=require('querystring');var Papa=require(_0x51b6('0xd'));var Redis=require(_0x51b6('0xe'));var authService=require(_0x51b6('0xf'));var qs=require(_0x51b6('0x10'));var as=require(_0x51b6('0x11'));var hardwareService=require(_0x51b6('0x12'));var logger=require('../../config/logger')(_0x51b6('0x13'));var utils=require(_0x51b6('0x14'));var config=require(_0x51b6('0x15'));var licenseUtil=require(_0x51b6('0x16'));var db=require(_0x51b6('0x17'))['db'];function respondWithStatusCode(_0x37a9eb,_0x43c9d9){_0x43c9d9=_0x43c9d9||0xcc;return function(_0x309e0b){if(_0x309e0b){return _0x37a9eb[_0x51b6('0x18')](_0x43c9d9);}return _0x37a9eb[_0x51b6('0x19')](_0x43c9d9)[_0x51b6('0x1a')]();};}function respondWithResult(_0x541336,_0x5e7534){_0x5e7534=_0x5e7534||0xc8;return function(_0x3c892a){if(_0x3c892a){return _0x541336['status'](_0x5e7534)[_0x51b6('0x1b')](_0x3c892a);}};}function respondWithFilteredResult(_0x16dfa7,_0x3d1137){return function(_0x362e5a){if(_0x362e5a){var _0x5404ff=typeof _0x3d1137[_0x51b6('0x1c')]===_0x51b6('0x1d')&&typeof _0x3d1137[_0x51b6('0x1e')]===_0x51b6('0x1d');var _0x3d6017=_0x362e5a['count'];var _0x527fbb=_0x5404ff?0x0:_0x3d1137[_0x51b6('0x1c')];var _0x5d313f=_0x5404ff?_0x362e5a[_0x51b6('0x1f')]:_0x3d1137[_0x51b6('0x1c')]+_0x3d1137[_0x51b6('0x1e')];var _0x2bf911;if(_0x5d313f>=_0x3d6017){_0x5d313f=_0x3d6017;_0x2bf911=0xc8;}else{_0x2bf911=0xce;}_0x16dfa7[_0x51b6('0x19')](_0x2bf911);return _0x16dfa7[_0x51b6('0x20')](_0x51b6('0x21'),_0x527fbb+'-'+_0x5d313f+'/'+_0x3d6017)[_0x51b6('0x1b')](_0x362e5a);}return null;};}function patchUpdates(_0x71ec00){return function(_0x3bf912){try{jsonpatch[_0x51b6('0x22')](_0x3bf912,_0x71ec00,!![]);}catch(_0x28ae7a){return BPromise['reject'](_0x28ae7a);}return _0x3bf912[_0x51b6('0x23')]();};}function saveUpdates(_0x4b26ee,_0x1cb9ad){return function(_0x57450f){if(_0x57450f){return _0x57450f['update'](_0x4b26ee)[_0x51b6('0x24')](function(_0x4f14dd){return _0x4f14dd;});}return null;};}function removeEntity(_0x55d517,_0x3054bf){return function(_0x57ae2c){if(_0x57ae2c){return _0x57ae2c[_0x51b6('0x25')]()[_0x51b6('0x24')](function(){_0x55d517[_0x51b6('0x19')](0xcc)[_0x51b6('0x1a')]();});}};}function handleEntityNotFound(_0x188125,_0x5014e6){return function(_0x3e88c9){if(!_0x3e88c9){_0x188125['sendStatus'](0x194);}return _0x3e88c9;};}function handleError(_0x4c1d27,_0x3e4227){_0x3e4227=_0x3e4227||0x1f4;return function(_0x83c902){logger['error'](_0x83c902['stack']);if(_0x83c902[_0x51b6('0x26')]){delete _0x83c902[_0x51b6('0x26')];}_0x4c1d27[_0x51b6('0x19')](_0x3e4227)[_0x51b6('0x27')](_0x83c902);};}exports[_0x51b6('0x28')]=function(_0x8ada6e,_0x3525d5){var _0x5c3bbb={},_0x1d9592={},_0x42362e={'count':0x0,'rows':[]};var _0x3f6640=_[_0x51b6('0x29')](db[_0x51b6('0x2a')][_0x51b6('0x2b')],function(_0x167542){return{'name':_0x167542[_0x51b6('0x2c')],'type':_0x167542[_0x51b6('0x2d')][_0x51b6('0x2e')]};});_0x1d9592[_0x51b6('0x2f')]=_[_0x51b6('0x29')](_0x3f6640,_0x51b6('0x26'));_0x1d9592[_0x51b6('0x30')]=_[_0x51b6('0x31')](_0x8ada6e[_0x51b6('0x30')]);_0x1d9592[_0x51b6('0x32')]=_[_0x51b6('0x33')](_0x1d9592[_0x51b6('0x2f')],_0x1d9592[_0x51b6('0x30')]);_0x5c3bbb[_0x51b6('0x34')]=_['intersection'](_0x1d9592[_0x51b6('0x2f')],qs[_0x51b6('0x35')](_0x8ada6e[_0x51b6('0x30')][_0x51b6('0x35')]));_0x5c3bbb[_0x51b6('0x34')]=_0x5c3bbb[_0x51b6('0x34')][_0x51b6('0x36')]?_0x5c3bbb[_0x51b6('0x34')]:_0x1d9592[_0x51b6('0x2f')];if(!_0x8ada6e[_0x51b6('0x30')][_0x51b6('0x37')](_0x51b6('0x38'))){_0x5c3bbb[_0x51b6('0x1e')]=qs[_0x51b6('0x1e')](_0x8ada6e[_0x51b6('0x30')]['limit']);_0x5c3bbb[_0x51b6('0x1c')]=qs[_0x51b6('0x1c')](_0x8ada6e['query']['offset']);}_0x5c3bbb[_0x51b6('0x39')]=qs[_0x51b6('0x3a')](_0x8ada6e['query'][_0x51b6('0x3a')]);_0x5c3bbb['where']=qs['filters'](_[_0x51b6('0x3b')](_0x8ada6e[_0x51b6('0x30')],_0x1d9592[_0x51b6('0x32')]),_0x3f6640);if(_0x8ada6e[_0x51b6('0x30')][_0x51b6('0x3c')]){_0x5c3bbb[_0x51b6('0x3d')]=_[_0x51b6('0x3e')](_0x5c3bbb['where'],{'$or':_['map'](_0x3f6640,function(_0x558db7){if(_0x558db7[_0x51b6('0x2d')]!==_0x51b6('0x3f')){var _0x498fc7={};_0x498fc7[_0x558db7['name']]={'$like':'%'+_0x8ada6e[_0x51b6('0x30')][_0x51b6('0x3c')]+'%'};return _0x498fc7;}})});}_0x5c3bbb=_[_0x51b6('0x3e')]({},_0x5c3bbb,_0x8ada6e[_0x51b6('0x40')]);var _0x5b4ac6={'where':_0x5c3bbb[_0x51b6('0x3d')]};return db[_0x51b6('0x2a')]['count'](_0x5b4ac6)[_0x51b6('0x24')](function(_0x1bca19){_0x42362e['count']=_0x1bca19;if(_0x8ada6e[_0x51b6('0x30')][_0x51b6('0x41')]){_0x5c3bbb[_0x51b6('0x42')]=[{'all':!![]}];}return db[_0x51b6('0x2a')][_0x51b6('0x43')](_0x5c3bbb);})['then'](function(_0xc26a53){_0x42362e[_0x51b6('0x44')]=_0xc26a53;return _0x42362e;})['then'](respondWithFilteredResult(_0x3525d5,_0x5c3bbb))[_0x51b6('0x45')](handleError(_0x3525d5,null));};exports[_0x51b6('0x46')]=function(_0x2d0b61,_0x4b12bf){var _0x4fb7a5={'raw':!![],'where':{'id':_0x2d0b61[_0x51b6('0x47')]['id']}},_0x4dccd6={};_0x4dccd6[_0x51b6('0x2f')]=_[_0x51b6('0x31')](db[_0x51b6('0x2a')][_0x51b6('0x2b')]);_0x4dccd6[_0x51b6('0x30')]=_[_0x51b6('0x31')](_0x2d0b61[_0x51b6('0x30')]);_0x4dccd6[_0x51b6('0x32')]=_[_0x51b6('0x33')](_0x4dccd6[_0x51b6('0x2f')],_0x4dccd6['query']);_0x4fb7a5['attributes']=_[_0x51b6('0x33')](_0x4dccd6[_0x51b6('0x2f')],qs[_0x51b6('0x35')](_0x2d0b61[_0x51b6('0x30')]['fields']));_0x4fb7a5[_0x51b6('0x34')]=_0x4fb7a5[_0x51b6('0x34')][_0x51b6('0x36')]?_0x4fb7a5[_0x51b6('0x34')]:_0x4dccd6['model'];if(_0x2d0b61[_0x51b6('0x30')][_0x51b6('0x41')]){_0x4fb7a5['include']=[{'all':!![]}];}_0x4fb7a5=_[_0x51b6('0x3e')]({},_0x4fb7a5,_0x2d0b61[_0x51b6('0x40')]);return db[_0x51b6('0x2a')][_0x51b6('0x48')](_0x4fb7a5)['then'](handleEntityNotFound(_0x4b12bf,null))[_0x51b6('0x24')](respondWithResult(_0x4b12bf,null))[_0x51b6('0x45')](handleError(_0x4b12bf,null));};exports[_0x51b6('0x49')]=function(_0x59717a,_0x40234a){return db[_0x51b6('0x2a')][_0x51b6('0x49')](_0x59717a[_0x51b6('0x4a')],{})['then'](respondWithResult(_0x40234a,0xc9))['catch'](handleError(_0x40234a,null));};exports[_0x51b6('0x4b')]=function(_0x27d588,_0x3ef894){if(_0x27d588['body']['id']){delete _0x27d588[_0x51b6('0x4a')]['id'];}return db[_0x51b6('0x2a')][_0x51b6('0x48')]({'where':{'id':_0x27d588[_0x51b6('0x47')]['id']}})[_0x51b6('0x24')](handleEntityNotFound(_0x3ef894,null))['then'](saveUpdates(_0x27d588['body'],null))[_0x51b6('0x24')](respondWithResult(_0x3ef894,null))['catch'](handleError(_0x3ef894,null));};exports[_0x51b6('0x25')]=function(_0x19a1a4,_0x3dbd7b){return db['MailTransferReport']['find']({'where':{'id':_0x19a1a4[_0x51b6('0x47')]['id']}})[_0x51b6('0x24')](handleEntityNotFound(_0x3dbd7b,null))[_0x51b6('0x24')](removeEntity(_0x3dbd7b,null))[_0x51b6('0x45')](handleError(_0x3dbd7b,null));};exports[_0x51b6('0x4c')]=function(_0x2f8f33,_0x303ddd){return db[_0x51b6('0x2a')][_0x51b6('0x4c')]()[_0x51b6('0x24')](respondWithResult(_0x303ddd,null))[_0x51b6('0x45')](handleError(_0x303ddd,null));}; \ No newline at end of file +var _0x012d=['stack','name','send','map','MailTransferReport','rawAttributes','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','offset','sort','pick','where','merge','type','VIRTUAL','filter','options','then','includeAll','rows','show','intersection','include','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','util','path','sox','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','limit','reject','save','update','destroy','error'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x012d,0x17d));var _0xd012=function(_0x4daef5,_0x419741){_0x4daef5=_0x4daef5-0x0;var _0x4a9d29=_0x012d[_0x4daef5];return _0x4a9d29;};'use strict';var emlformat=require(_0xd012('0x0'));var rimraf=require(_0xd012('0x1'));var zipdir=require(_0xd012('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd012('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd012('0x4'));var path=require(_0xd012('0x5'));var sox=require(_0xd012('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd012('0x7'));var crypto=require(_0xd012('0x8'));var jsforce=require(_0xd012('0x9'));var deskjs=require(_0xd012('0xa'));var toCsv=require(_0xd012('0xb'));var querystring=require('querystring');var Papa=require(_0xd012('0xc'));var Redis=require(_0xd012('0xd'));var authService=require(_0xd012('0xe'));var qs=require(_0xd012('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd012('0x10'));var logger=require('../../config/logger')(_0xd012('0x11'));var utils=require(_0xd012('0x12'));var config=require(_0xd012('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xd012('0x14'))['db'];function respondWithStatusCode(_0x3ad7b5,_0x590275){_0x590275=_0x590275||0xcc;return function(_0x29e261){if(_0x29e261){return _0x3ad7b5[_0xd012('0x15')](_0x590275);}return _0x3ad7b5[_0xd012('0x16')](_0x590275)[_0xd012('0x17')]();};}function respondWithResult(_0x44362e,_0x5ad30b){_0x5ad30b=_0x5ad30b||0xc8;return function(_0x39c1e5){if(_0x39c1e5){return _0x44362e[_0xd012('0x16')](_0x5ad30b)[_0xd012('0x18')](_0x39c1e5);}};}function respondWithFilteredResult(_0xacb4c0,_0x3a0b17){return function(_0x4f4fa3){if(_0x4f4fa3){var _0x1ad76d=typeof _0x3a0b17['offset']===_0xd012('0x19')&&typeof _0x3a0b17['limit']===_0xd012('0x19');var _0x109ed5=_0x4f4fa3[_0xd012('0x1a')];var _0x2f85cb=_0x1ad76d?0x0:_0x3a0b17['offset'];var _0x4b0fbc=_0x1ad76d?_0x4f4fa3['count']:_0x3a0b17['offset']+_0x3a0b17[_0xd012('0x1b')];var _0x16c280;if(_0x4b0fbc>=_0x109ed5){_0x4b0fbc=_0x109ed5;_0x16c280=0xc8;}else{_0x16c280=0xce;}_0xacb4c0['status'](_0x16c280);return _0xacb4c0['set']('Content-Range',_0x2f85cb+'-'+_0x4b0fbc+'/'+_0x109ed5)[_0xd012('0x18')](_0x4f4fa3);}return null;};}function patchUpdates(_0x55f4d2){return function(_0x338722){try{jsonpatch['apply'](_0x338722,_0x55f4d2,!![]);}catch(_0x45d294){return BPromise[_0xd012('0x1c')](_0x45d294);}return _0x338722[_0xd012('0x1d')]();};}function saveUpdates(_0x29f796,_0x5cebef){return function(_0x3b2fb7){if(_0x3b2fb7){return _0x3b2fb7[_0xd012('0x1e')](_0x29f796)['then'](function(_0x52ff55){return _0x52ff55;});}return null;};}function removeEntity(_0x4f0d98,_0x425820){return function(_0x53dd92){if(_0x53dd92){return _0x53dd92[_0xd012('0x1f')]()['then'](function(){_0x4f0d98['status'](0xcc)[_0xd012('0x17')]();});}};}function handleEntityNotFound(_0x44e1e1,_0x1062ce){return function(_0x11772b){if(!_0x11772b){_0x44e1e1[_0xd012('0x15')](0x194);}return _0x11772b;};}function handleError(_0x200755,_0xb3b368){_0xb3b368=_0xb3b368||0x1f4;return function(_0x3ba294){logger[_0xd012('0x20')](_0x3ba294[_0xd012('0x21')]);if(_0x3ba294[_0xd012('0x22')]){delete _0x3ba294[_0xd012('0x22')];}_0x200755[_0xd012('0x16')](_0xb3b368)[_0xd012('0x23')](_0x3ba294);};}exports['index']=function(_0x282133,_0x276623){var _0x5006ce={},_0x8f62ad={},_0x51662d={'count':0x0,'rows':[]};var _0x5348f5=_[_0xd012('0x24')](db[_0xd012('0x25')][_0xd012('0x26')],function(_0x131af5){return{'name':_0x131af5['fieldName'],'type':_0x131af5['type'][_0xd012('0x27')]};});_0x8f62ad[_0xd012('0x28')]=_['map'](_0x5348f5,_0xd012('0x22'));_0x8f62ad[_0xd012('0x29')]=_[_0xd012('0x2a')](_0x282133[_0xd012('0x29')]);_0x8f62ad[_0xd012('0x2b')]=_['intersection'](_0x8f62ad[_0xd012('0x28')],_0x8f62ad['query']);_0x5006ce[_0xd012('0x2c')]=_['intersection'](_0x8f62ad['model'],qs['fields'](_0x282133[_0xd012('0x29')][_0xd012('0x2d')]));_0x5006ce[_0xd012('0x2c')]=_0x5006ce[_0xd012('0x2c')][_0xd012('0x2e')]?_0x5006ce[_0xd012('0x2c')]:_0x8f62ad[_0xd012('0x28')];if(!_0x282133[_0xd012('0x29')][_0xd012('0x2f')]('nolimit')){_0x5006ce[_0xd012('0x1b')]=qs[_0xd012('0x1b')](_0x282133[_0xd012('0x29')][_0xd012('0x1b')]);_0x5006ce[_0xd012('0x30')]=qs[_0xd012('0x30')](_0x282133['query'][_0xd012('0x30')]);}_0x5006ce['order']=qs[_0xd012('0x31')](_0x282133[_0xd012('0x29')][_0xd012('0x31')]);_0x5006ce['where']=qs['filters'](_[_0xd012('0x32')](_0x282133[_0xd012('0x29')],_0x8f62ad[_0xd012('0x2b')]),_0x5348f5);if(_0x282133[_0xd012('0x29')]['filter']){_0x5006ce[_0xd012('0x33')]=_[_0xd012('0x34')](_0x5006ce[_0xd012('0x33')],{'$or':_[_0xd012('0x24')](_0x5348f5,function(_0x51f513){if(_0x51f513[_0xd012('0x35')]!==_0xd012('0x36')){var _0x5f5c08={};_0x5f5c08[_0x51f513[_0xd012('0x22')]]={'$like':'%'+_0x282133[_0xd012('0x29')][_0xd012('0x37')]+'%'};return _0x5f5c08;}})});}_0x5006ce=_[_0xd012('0x34')]({},_0x5006ce,_0x282133[_0xd012('0x38')]);var _0x345028={'where':_0x5006ce[_0xd012('0x33')]};return db[_0xd012('0x25')][_0xd012('0x1a')](_0x345028)[_0xd012('0x39')](function(_0x5a55d9){_0x51662d[_0xd012('0x1a')]=_0x5a55d9;if(_0x282133[_0xd012('0x29')][_0xd012('0x3a')]){_0x5006ce['include']=[{'all':!![]}];}return db[_0xd012('0x25')]['findAll'](_0x5006ce);})[_0xd012('0x39')](function(_0x19d581){_0x51662d[_0xd012('0x3b')]=_0x19d581;return _0x51662d;})[_0xd012('0x39')](respondWithFilteredResult(_0x276623,_0x5006ce))['catch'](handleError(_0x276623,null));};exports[_0xd012('0x3c')]=function(_0x456662,_0x790364){var _0x3ffa78={'raw':!![],'where':{'id':_0x456662['params']['id']}},_0x4cb226={};_0x4cb226[_0xd012('0x28')]=_[_0xd012('0x2a')](db[_0xd012('0x25')][_0xd012('0x26')]);_0x4cb226[_0xd012('0x29')]=_[_0xd012('0x2a')](_0x456662[_0xd012('0x29')]);_0x4cb226[_0xd012('0x2b')]=_[_0xd012('0x3d')](_0x4cb226[_0xd012('0x28')],_0x4cb226[_0xd012('0x29')]);_0x3ffa78[_0xd012('0x2c')]=_[_0xd012('0x3d')](_0x4cb226['model'],qs['fields'](_0x456662[_0xd012('0x29')]['fields']));_0x3ffa78[_0xd012('0x2c')]=_0x3ffa78[_0xd012('0x2c')][_0xd012('0x2e')]?_0x3ffa78[_0xd012('0x2c')]:_0x4cb226[_0xd012('0x28')];if(_0x456662['query']['includeAll']){_0x3ffa78[_0xd012('0x3e')]=[{'all':!![]}];}_0x3ffa78=_['merge']({},_0x3ffa78,_0x456662[_0xd012('0x38')]);return db[_0xd012('0x25')][_0xd012('0x3f')](_0x3ffa78)[_0xd012('0x39')](handleEntityNotFound(_0x790364,null))['then'](respondWithResult(_0x790364,null))[_0xd012('0x40')](handleError(_0x790364,null));};exports[_0xd012('0x41')]=function(_0xb14951,_0x21028b){return db[_0xd012('0x25')][_0xd012('0x41')](_0xb14951[_0xd012('0x42')],{})[_0xd012('0x39')](respondWithResult(_0x21028b,0xc9))[_0xd012('0x40')](handleError(_0x21028b,null));};exports['update']=function(_0x9b9aa0,_0x5a961a){if(_0x9b9aa0[_0xd012('0x42')]['id']){delete _0x9b9aa0[_0xd012('0x42')]['id'];}return db[_0xd012('0x25')][_0xd012('0x3f')]({'where':{'id':_0x9b9aa0['params']['id']}})[_0xd012('0x39')](handleEntityNotFound(_0x5a961a,null))[_0xd012('0x39')](saveUpdates(_0x9b9aa0['body'],null))[_0xd012('0x39')](respondWithResult(_0x5a961a,null))[_0xd012('0x40')](handleError(_0x5a961a,null));};exports[_0xd012('0x1f')]=function(_0x516cf9,_0x3b62cf){return db[_0xd012('0x25')]['find']({'where':{'id':_0x516cf9[_0xd012('0x43')]['id']}})[_0xd012('0x39')](handleEntityNotFound(_0x3b62cf,null))[_0xd012('0x39')](removeEntity(_0x3b62cf,null))['catch'](handleError(_0x3b62cf,null));};exports['describe']=function(_0x197b69,_0x390f77){return db['MailTransferReport'][_0xd012('0x44')]()['then'](respondWithResult(_0x390f77,null))[_0xd012('0x40')](handleError(_0x390f77,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 485da97..8183566 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 _0x8fa6=['define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x5045ec,_0x38de9b){var _0x5d0662=function(_0x346a02){while(--_0x346a02){_0x5045ec['push'](_0x5045ec['shift']());}};_0x5d0662(++_0x38de9b);}(_0x8fa6,0x1c0));var _0x68fa=function(_0x239e4d,_0x5d7fbb){_0x239e4d=_0x239e4d-0x0;var _0x3d20c5=_0x8fa6[_0x239e4d];return _0x3d20c5;};'use strict';var _=require(_0x68fa('0x0'));var util=require(_0x68fa('0x1'));var logger=require(_0x68fa('0x2'))('api');var moment=require(_0x68fa('0x3'));var BPromise=require(_0x68fa('0x4'));var rp=require(_0x68fa('0x5'));var fs=require('fs');var path=require(_0x68fa('0x6'));var rimraf=require('rimraf');var config=require(_0x68fa('0x7'));var attributes=require('./mailTransferReport.attributes');module['exports']=function(_0x304098,_0x501af1){return _0x304098[_0x68fa('0x8')](_0x68fa('0x9'),attributes,{'tableName':_0x68fa('0xa'),'paranoid':![],'indexes':[{'name':_0x68fa('0xb'),'fields':[_0x68fa('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x624c=['report_mail_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','path','../../config/environment','exports','define','MailTransferReport'];(function(_0x4d0180,_0x2985de){var _0x336a11=function(_0x224006){while(--_0x224006){_0x4d0180['push'](_0x4d0180['shift']());}};_0x336a11(++_0x2985de);}(_0x624c,0x1ee));var _0xc624=function(_0x365525,_0x5100df){_0x365525=_0x365525-0x0;var _0x25e46a=_0x624c[_0x365525];return _0x25e46a;};'use strict';var _=require('lodash');var util=require(_0xc624('0x0'));var logger=require(_0xc624('0x1'))(_0xc624('0x2'));var moment=require(_0xc624('0x3'));var BPromise=require(_0xc624('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc624('0x5'));var rimraf=require('rimraf');var config=require(_0xc624('0x6'));var attributes=require('./mailTransferReport.attributes');module[_0xc624('0x7')]=function(_0x2d1db7,_0x39759e){return _0x2d1db7[_0xc624('0x8')](_0xc624('0x9'),attributes,{'tableName':_0xc624('0xa'),'paranoid':![],'indexes':[{'name':_0xc624('0xb'),'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 5d7dac6..09b0f80 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 _0x17d8=['client','http','then','request\x20sent','stringify','error','message','MailTransferReport,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x17d8,0x8f));var _0x817d=function(_0x3a2a8f,_0x48ba88){_0x3a2a8f=_0x3a2a8f-0x0;var _0x18f5fb=_0x17d8[_0x3a2a8f];return _0x18f5fb;};'use strict';var _=require('lodash');var util=require(_0x817d('0x0'));var moment=require(_0x817d('0x1'));var BPromise=require(_0x817d('0x2'));var rs=require(_0x817d('0x3'));var fs=require('fs');var Redis=require(_0x817d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x817d('0x5'));var logger=require(_0x817d('0x6'))(_0x817d('0x7'));var config=require('../../config/environment');var jayson=require(_0x817d('0x8'));var client=jayson[_0x817d('0x9')][_0x817d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x437252,_0x2d686d,_0x46ea24){return new BPromise(function(_0x22fbd2,_0x23c185){return client['request'](_0x437252,_0x46ea24)[_0x817d('0xb')](function(_0x20f1a5){logger['info']('MailTransferReport,\x20%s,\x20%s',_0x2d686d,_0x817d('0xc'));logger['debug']('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x2d686d,_0x817d('0xc'),JSON[_0x817d('0xd')](_0x20f1a5));if(_0x20f1a5[_0x817d('0xe')]){if(_0x20f1a5[_0x817d('0xe')]['code']===0x1f4){logger[_0x817d('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x2d686d,_0x20f1a5[_0x817d('0xe')][_0x817d('0xf')]);return _0x23c185(_0x20f1a5[_0x817d('0xe')]['message']);}logger[_0x817d('0xe')](_0x817d('0x10'),_0x2d686d,_0x20f1a5[_0x817d('0xe')][_0x817d('0xf')]);return _0x22fbd2(_0x20f1a5[_0x817d('0xe')][_0x817d('0xf')]);}else{logger['info'](_0x817d('0x10'),_0x2d686d,_0x817d('0xc'));_0x22fbd2(_0x20f1a5[_0x817d('0x11')]['message']);}})[_0x817d('0x12')](function(_0x590ff4){logger[_0x817d('0xe')](_0x817d('0x10'),_0x2d686d,_0x590ff4);_0x23c185(_0x590ff4);});});} \ No newline at end of file +var _0x4fa2=['request\x20sent','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x48e1ec,_0x35f468){var _0x3b33eb=function(_0x507bf9){while(--_0x507bf9){_0x48e1ec['push'](_0x48e1ec['shift']());}};_0x3b33eb(++_0x35f468);}(_0x4fa2,0x1e9));var _0x24fa=function(_0x1877f6,_0x36065d){_0x1877f6=_0x1877f6-0x0;var _0xc063c5=_0x4fa2[_0x1877f6];return _0xc063c5;};'use strict';var _=require(_0x24fa('0x0'));var util=require('util');var moment=require(_0x24fa('0x1'));var BPromise=require(_0x24fa('0x2'));var rs=require(_0x24fa('0x3'));var fs=require('fs');var Redis=require(_0x24fa('0x4'));var db=require(_0x24fa('0x5'))['db'];var utils=require(_0x24fa('0x6'));var logger=require(_0x24fa('0x7'))('rpc');var config=require(_0x24fa('0x8'));var jayson=require(_0x24fa('0x9'));var client=jayson['client'][_0x24fa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51c22c,_0x441b98,_0x100648){return new BPromise(function(_0x309f7f,_0x5e3f53){return client[_0x24fa('0xb')](_0x51c22c,_0x100648)[_0x24fa('0xc')](function(_0x5a912f){logger[_0x24fa('0xd')](_0x24fa('0xe'),_0x441b98,'request\x20sent');logger[_0x24fa('0xf')](_0x24fa('0x10'),_0x441b98,_0x24fa('0x11'),JSON[_0x24fa('0x12')](_0x5a912f));if(_0x5a912f['error']){if(_0x5a912f[_0x24fa('0x13')]['code']===0x1f4){logger[_0x24fa('0x13')](_0x24fa('0xe'),_0x441b98,_0x5a912f[_0x24fa('0x13')][_0x24fa('0x14')]);return _0x5e3f53(_0x5a912f['error'][_0x24fa('0x14')]);}logger['error']('MailTransferReport,\x20%s,\x20%s',_0x441b98,_0x5a912f[_0x24fa('0x13')][_0x24fa('0x14')]);return _0x309f7f(_0x5a912f['error'][_0x24fa('0x14')]);}else{logger[_0x24fa('0xd')](_0x24fa('0xe'),_0x441b98,_0x24fa('0x11'));_0x309f7f(_0x5a912f[_0x24fa('0x15')][_0x24fa('0x14')]);}})[_0x24fa('0x16')](function(_0x2b2e0c){logger[_0x24fa('0x13')](_0x24fa('0xe'),_0x441b98,_0x2b2e0c);_0x5e3f53(_0x2b2e0c);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 39c9a51..3aebf0b 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 _0xf93c=['isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','index','/describe'];(function(_0x466d24,_0x3a3d6c){var _0x535da6=function(_0x241c41){while(--_0x241c41){_0x466d24['push'](_0x466d24['shift']());}};_0x535da6(++_0x3a3d6c);}(_0xf93c,0x149));var _0xcf93=function(_0xa818b1,_0x516178){_0xa818b1=_0xa818b1-0x0;var _0x2a5711=_0xf93c[_0xa818b1];return _0x2a5711;};'use strict';var multer=require('multer');var util=require(_0xcf93('0x0'));var path=require(_0xcf93('0x1'));var timeout=require(_0xcf93('0x2'));var express=require(_0xcf93('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xcf93('0x4'));var interaction=require(_0xcf93('0x5'));var config=require(_0xcf93('0x6'));var controller=require(_0xcf93('0x7'));router[_0xcf93('0x8')]('/',auth['isAuthenticated'](),controller[_0xcf93('0x9')]);router['get'](_0xcf93('0xa'),auth[_0xcf93('0xb')](),controller[_0xcf93('0xc')]);router[_0xcf93('0x8')](_0xcf93('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xcf93('0xe')]('/',auth[_0xcf93('0xb')](),controller[_0xcf93('0xf')]);router[_0xcf93('0x10')]('/:id',auth[_0xcf93('0xb')](),controller[_0xcf93('0x11')]);router[_0xcf93('0x12')](_0xcf93('0xd'),auth[_0xcf93('0xb')](),controller[_0xcf93('0x13')]);module['exports']=router; \ No newline at end of file +var _0xc4c8=['isAuthenticated','index','/describe','/:id','show','post','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./memberReport.controller','get'];(function(_0x5bae1a,_0x7df65f){var _0x12e9f1=function(_0x53e7ea){while(--_0x53e7ea){_0x5bae1a['push'](_0x5bae1a['shift']());}};_0x12e9f1(++_0x7df65f);}(_0xc4c8,0x19a));var _0x8c4c=function(_0x3808fe,_0x26649f){_0x3808fe=_0x3808fe-0x0;var _0x457cf5=_0xc4c8[_0x3808fe];return _0x457cf5;};'use strict';var multer=require(_0x8c4c('0x0'));var util=require(_0x8c4c('0x1'));var path=require('path');var timeout=require(_0x8c4c('0x2'));var express=require(_0x8c4c('0x3'));var router=express[_0x8c4c('0x4')]();var fs_extra=require(_0x8c4c('0x5'));var auth=require(_0x8c4c('0x6'));var interaction=require(_0x8c4c('0x7'));var config=require('../../config/environment');var controller=require(_0x8c4c('0x8'));router[_0x8c4c('0x9')]('/',auth[_0x8c4c('0xa')](),controller[_0x8c4c('0xb')]);router[_0x8c4c('0x9')](_0x8c4c('0xc'),auth[_0x8c4c('0xa')](),controller['describe']);router[_0x8c4c('0x9')](_0x8c4c('0xd'),auth[_0x8c4c('0xa')](),controller[_0x8c4c('0xe')]);router[_0x8c4c('0xf')]('/',auth[_0x8c4c('0xa')](),controller['create']);router[_0x8c4c('0x10')](_0x8c4c('0xd'),auth['isAuthenticated'](),controller[_0x8c4c('0x11')]);router[_0x8c4c('0x12')](_0x8c4c('0xd'),auth[_0x8c4c('0xa')](),controller['destroy']);module[_0x8c4c('0x13')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index c05aa2b..c29fc01 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 _0xfd00=['sequelize','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[queue]','INTEGER'];(function(_0x343824,_0x5899cf){var _0x5d0b26=function(_0x5463e7){while(--_0x5463e7){_0x343824['push'](_0x343824['shift']());}};_0x5d0b26(++_0x5899cf);}(_0xfd00,0x96));var _0x0fd0=function(_0x42e175,_0x1f88f7){_0x42e175=_0x42e175-0x0;var _0x2c5590=_0xfd00[_0x42e175];return _0x2c5590;};'use strict';var Sequelize=require(_0x0fd0('0x0'));var moment=require('moment');module[_0x0fd0('0x1')]={'channel':{'type':Sequelize[_0x0fd0('0x2')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x0fd0('0x2')]},'type':{'type':Sequelize[_0x0fd0('0x2')],'defaultValue':_0x0fd0('0x3'),'comment':_0x0fd0('0x4')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x0fd0('0x5')]},'exitAt':{'type':Sequelize[_0x0fd0('0x5')],'set':function(_0x56e76e){var _0x1f996c=moment(_0x56e76e);var _0x118b64=moment(this['getDataValue']('enterAt'));var _0x1d290e=_0x1f996c[_0x0fd0('0x6')](_0x118b64,_0x0fd0('0x7'));this[_0x0fd0('0x8')](_0x0fd0('0x9'),_0x56e76e);this[_0x0fd0('0x8')](_0x0fd0('0xa'),_0x1d290e>=0x0?_0x1d290e:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x0fd0('0xb')},'data2':{'type':Sequelize[_0x0fd0('0x2')],'comment':_0x0fd0('0xc')},'data3':{'type':Sequelize[_0x0fd0('0x2')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0x0fd0('0x2')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x0fd0('0x2')],'comment':_0x0fd0('0xd')},'role':{'type':Sequelize[_0x0fd0('0x2')]},'internal':{'type':Sequelize[_0x0fd0('0xe')]},'uniqueid':{'type':Sequelize[_0x0fd0('0x2')]}}; \ No newline at end of file +var _0x6bae=['duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt'];(function(_0x5ccc73,_0xdc5594){var _0x34235e=function(_0x1d7359){while(--_0x1d7359){_0x5ccc73['push'](_0x5ccc73['shift']());}};_0x34235e(++_0xdc5594);}(_0x6bae,0x19d));var _0xe6ba=function(_0x140c72,_0x4cb14b){_0x140c72=_0x140c72-0x0;var _0xa6901b=_0x6bae[_0x140c72];return _0xa6901b;};'use strict';var Sequelize=require(_0xe6ba('0x0'));var moment=require(_0xe6ba('0x1'));module['exports']={'channel':{'type':Sequelize[_0xe6ba('0x2')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xe6ba('0x2')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0xe6ba('0x3')},'duration':{'type':Sequelize[_0xe6ba('0x4')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xe6ba('0x5')],'set':function(_0x154832){var _0x330db0=moment(_0x154832);var _0x439435=moment(this[_0xe6ba('0x6')](_0xe6ba('0x7')));var _0x18d87d=_0x330db0[_0xe6ba('0x8')](_0x439435,_0xe6ba('0x9'));this[_0xe6ba('0xa')](_0xe6ba('0xb'),_0x154832);this[_0xe6ba('0xa')](_0xe6ba('0xc'),_0x18d87d>=0x0?_0x18d87d:null);}},'data1':{'type':Sequelize[_0xe6ba('0x2')],'comment':_0xe6ba('0xd')},'data2':{'type':Sequelize[_0xe6ba('0x2')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0xe6ba('0x2')],'comment':_0xe6ba('0xe')},'data4':{'type':Sequelize[_0xe6ba('0x2')],'comment':_0xe6ba('0xf')},'data5':{'type':Sequelize[_0xe6ba('0x2')],'comment':_0xe6ba('0x10')},'role':{'type':Sequelize[_0xe6ba('0x2')]},'internal':{'type':Sequelize[_0xe6ba('0x4')]},'uniqueid':{'type':Sequelize[_0xe6ba('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 9584a59..ae74120 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 _0x008c=['destroy','sendStatus','send','index','MemberReport','rawAttributes','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','catch','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','save','update','then'];(function(_0x4ad43b,_0x304964){var _0x686a41=function(_0x3f24ef){while(--_0x3f24ef){_0x4ad43b['push'](_0x4ad43b['shift']());}};_0x686a41(++_0x304964);}(_0x008c,0x188));var _0xc008=function(_0x31687e,_0x42b91a){_0x31687e=_0x31687e-0x0;var _0x10fbb4=_0x008c[_0x31687e];return _0x10fbb4;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=typeof _0x5ee00b[_0xc008('0x1b')]===_0xc008('0x1c')&&typeof _0x5ee00b[_0xc008('0x1d')]===_0xc008('0x1c');var _0x4fe771=_0x5e894e['count'];var _0x540e45=_0x4bd0f4?0x0:_0x5ee00b['offset'];var _0x46042b=_0x4bd0f4?_0x5e894e[_0xc008('0x1e')]:_0x5ee00b['offset']+_0x5ee00b[_0xc008('0x1d')];var _0x5906e6;if(_0x46042b>=_0x4fe771){_0x46042b=_0x4fe771;_0x5906e6=0xc8;}else{_0x5906e6=0xce;}_0x3f0ecf['status'](_0x5906e6);return _0x3f0ecf['set']('Content-Range',_0x540e45+'-'+_0x46042b+'/'+_0x4fe771)[_0xc008('0x1a')](_0x5e894e);}return null;};}function patchUpdates(_0x4b9726){return function(_0x5560b1){try{jsonpatch['apply'](_0x5560b1,_0x4b9726,!![]);}catch(_0x4a582d){return BPromise['reject'](_0x4a582d);}return _0x5560b1[_0xc008('0x1f')]();};}function saveUpdates(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x20')](_0x4777a6)[_0xc008('0x21')](function(_0x4f43e2){return _0x4f43e2;});}return null;};}function removeEntity(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(_0x58a6ea){return _0x58a6ea[_0xc008('0x22')]()[_0xc008('0x21')](function(){_0x459fd9[_0xc008('0x19')](0xcc)[_0xc008('0x18')]();});}};}function handleEntityNotFound(_0x5410f5,_0x48582b){return function(_0x5de1e9){if(!_0x5de1e9){_0x5410f5[_0xc008('0x23')](0x194);}return _0x5de1e9;};}function handleError(_0x15dade,_0x92c582){_0x92c582=_0x92c582||0x1f4;return function(_0x2e31c2){logger['error'](_0x2e31c2['stack']);if(_0x2e31c2['name']){delete _0x2e31c2['name'];}_0x15dade['status'](_0x92c582)[_0xc008('0x24')](_0x2e31c2);};}exports[_0xc008('0x25')]=function(_0x25eae4,_0x529961){var _0x24c14c={},_0x32390d={},_0x209591={'count':0x0,'rows':[]};var _0x2a7d4f=_['map'](db[_0xc008('0x26')][_0xc008('0x27')],function(_0x53ed35){return{'name':_0x53ed35['fieldName'],'type':_0x53ed35['type'][_0xc008('0x28')]};});_0x32390d[_0xc008('0x29')]=_[_0xc008('0x2a')](_0x2a7d4f,_0xc008('0x2b'));_0x32390d[_0xc008('0x2c')]=_[_0xc008('0x2d')](_0x25eae4[_0xc008('0x2c')]);_0x32390d[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x32390d[_0xc008('0x29')],_0x32390d[_0xc008('0x2c')]);_0x24c14c[_0xc008('0x30')]=_['intersection'](_0x32390d[_0xc008('0x29')],qs[_0xc008('0x31')](_0x25eae4['query'][_0xc008('0x31')]));_0x24c14c[_0xc008('0x30')]=_0x24c14c[_0xc008('0x30')][_0xc008('0x32')]?_0x24c14c[_0xc008('0x30')]:_0x32390d[_0xc008('0x29')];if(!_0x25eae4[_0xc008('0x2c')][_0xc008('0x33')](_0xc008('0x34'))){_0x24c14c['limit']=qs[_0xc008('0x1d')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1d')]);_0x24c14c[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1b')]);}_0x24c14c['order']=qs[_0xc008('0x35')](_0x25eae4[_0xc008('0x2c')]['sort']);_0x24c14c[_0xc008('0x36')]=qs[_0xc008('0x2e')](_['pick'](_0x25eae4[_0xc008('0x2c')],_0x32390d[_0xc008('0x2e')]),_0x2a7d4f);if(_0x25eae4[_0xc008('0x2c')]['filter']){_0x24c14c['where']=_['merge'](_0x24c14c[_0xc008('0x36')],{'$or':_['map'](_0x2a7d4f,function(_0x3dd0ac){if(_0x3dd0ac[_0xc008('0x37')]!==_0xc008('0x38')){var _0x440459={};_0x440459[_0x3dd0ac[_0xc008('0x2b')]]={'$like':'%'+_0x25eae4[_0xc008('0x2c')][_0xc008('0x39')]+'%'};return _0x440459;}})});}_0x24c14c=_[_0xc008('0x3a')]({},_0x24c14c,_0x25eae4[_0xc008('0x3b')]);var _0x387dfd={'where':_0x24c14c[_0xc008('0x36')]};return db[_0xc008('0x26')][_0xc008('0x1e')](_0x387dfd)[_0xc008('0x21')](function(_0x4cace5){_0x209591[_0xc008('0x1e')]=_0x4cace5;if(_0x25eae4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x24c14c[_0xc008('0x3d')]=[{'all':!![]}];}return db['MemberReport'][_0xc008('0x3e')](_0x24c14c);})[_0xc008('0x21')](function(_0xc8cb91){_0x209591[_0xc008('0x3f')]=_0xc8cb91;return _0x209591;})[_0xc008('0x21')](respondWithFilteredResult(_0x529961,_0x24c14c))['catch'](handleError(_0x529961,null));};exports[_0xc008('0x40')]=function(_0x3323f4,_0x3794b0){var _0x3e9a99={'raw':!![],'where':{'id':_0x3323f4['params']['id']}},_0x7279e8={};_0x7279e8[_0xc008('0x29')]=_[_0xc008('0x2d')](db[_0xc008('0x26')][_0xc008('0x27')]);_0x7279e8['query']=_[_0xc008('0x2d')](_0x3323f4[_0xc008('0x2c')]);_0x7279e8[_0xc008('0x2e')]=_['intersection'](_0x7279e8[_0xc008('0x29')],_0x7279e8['query']);_0x3e9a99[_0xc008('0x30')]=_['intersection'](_0x7279e8[_0xc008('0x29')],qs[_0xc008('0x31')](_0x3323f4['query'][_0xc008('0x31')]));_0x3e9a99[_0xc008('0x30')]=_0x3e9a99[_0xc008('0x30')]['length']?_0x3e9a99[_0xc008('0x30')]:_0x7279e8[_0xc008('0x29')];if(_0x3323f4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x3e9a99[_0xc008('0x3d')]=[{'all':!![]}];}_0x3e9a99=_[_0xc008('0x3a')]({},_0x3e9a99,_0x3323f4['options']);return db['MemberReport']['find'](_0x3e9a99)[_0xc008('0x21')](handleEntityNotFound(_0x3794b0,null))[_0xc008('0x21')](respondWithResult(_0x3794b0,null))[_0xc008('0x41')](handleError(_0x3794b0,null));};exports[_0xc008('0x42')]=function(_0x25289f,_0x24f6a4){return db[_0xc008('0x26')][_0xc008('0x42')](_0x25289f['body'],{})['then'](respondWithResult(_0x24f6a4,0xc9))['catch'](handleError(_0x24f6a4,null));};exports[_0xc008('0x20')]=function(_0x2651cf,_0x158eae){if(_0x2651cf['body']['id']){delete _0x2651cf[_0xc008('0x43')]['id'];}return db[_0xc008('0x26')][_0xc008('0x44')]({'where':{'id':_0x2651cf[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x158eae,null))[_0xc008('0x21')](saveUpdates(_0x2651cf[_0xc008('0x43')],null))[_0xc008('0x21')](respondWithResult(_0x158eae,null))[_0xc008('0x41')](handleError(_0x158eae,null));};exports[_0xc008('0x22')]=function(_0x52c444,_0x4c63d4){return db[_0xc008('0x26')]['find']({'where':{'id':_0x52c444[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x4c63d4,null))[_0xc008('0x21')](removeEntity(_0x4c63d4,null))['catch'](handleError(_0x4c63d4,null));};exports[_0xc008('0x46')]=function(_0x32b435,_0xee64){return db[_0xc008('0x26')][_0xc008('0x46')]()['then'](respondWithResult(_0xee64,null))[_0xc008('0x41')](handleError(_0xee64,null));}; \ No newline at end of file +var _0x9957=['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','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','MemberReport','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x353cd6,_0xc795f6){var _0x55712a=function(_0x3b83e1){while(--_0x3b83e1){_0x353cd6['push'](_0x353cd6['shift']());}};_0x55712a(++_0xc795f6);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['MemberReport']['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['MemberReport'][_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['MemberReport'][_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('0x40')][_0x7995('0x47')]({'where':{'id':_0x4ffc8a['params']['id']}})['then'](handleEntityNotFound(_0x19da63,null))['then'](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x4c')]=function(_0x4cf5db,_0x1cd85){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x26')](respondWithResult(_0x1cd85,null))[_0x7995('0x49')](handleError(_0x1cd85,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index dd8c2ed..741dfae 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 _0x3787=['membername_interface','membername','interface','util','api','path','rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member'];(function(_0x570b53,_0x52ef45){var _0x4c5209=function(_0x315a61){while(--_0x315a61){_0x570b53['push'](_0x570b53['shift']());}};_0x4c5209(++_0x52ef45);}(_0x3787,0xd3));var _0x7378=function(_0x45d59b,_0x454156){_0x45d59b=_0x45d59b-0x0;var _0x966451=_0x3787[_0x45d59b];return _0x966451;};'use strict';var _=require('lodash');var util=require(_0x7378('0x0'));var logger=require('../../config/logger')(_0x7378('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7378('0x2'));var rimraf=require(_0x7378('0x3'));var config=require(_0x7378('0x4'));var attributes=require(_0x7378('0x5'));module[_0x7378('0x6')]=function(_0xd11fdd,_0x1150ba){return _0xd11fdd[_0x7378('0x7')](_0x7378('0x8'),attributes,{'tableName':_0x7378('0x9'),'paranoid':![],'indexes':[{'name':_0x7378('0xa'),'fields':[_0x7378('0xb'),_0x7378('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x872a=['report_member','membername_interface','membername','interface','lodash','util','../../config/logger','api','path','rimraf','../../config/environment','./memberReport.attributes','exports','MemberReport'];(function(_0x59e8ec,_0x593c50){var _0x578157=function(_0x3c8762){while(--_0x3c8762){_0x59e8ec['push'](_0x59e8ec['shift']());}};_0x578157(++_0x593c50);}(_0x872a,0x100));var _0xa872=function(_0xb0fe8f,_0x2dcac0){_0xb0fe8f=_0xb0fe8f-0x0;var _0x25a535=_0x872a[_0xb0fe8f];return _0x25a535;};'use strict';var _=require(_0xa872('0x0'));var util=require(_0xa872('0x1'));var logger=require(_0xa872('0x2'))(_0xa872('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa872('0x4'));var rimraf=require(_0xa872('0x5'));var config=require(_0xa872('0x6'));var attributes=require(_0xa872('0x7'));module[_0xa872('0x8')]=function(_0x1c8d2f,_0x3e3cd4){return _0x1c8d2f['define'](_0xa872('0x9'),attributes,{'tableName':_0xa872('0xa'),'paranoid':![],'indexes':[{'name':_0xa872('0xb'),'fields':[_0xa872('0xc'),_0xa872('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 28b4ba4..62717c9 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 _0xdf98=['debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMemberReport','options','raw','where','attributes','map','include','model','CreateMemberReport','body','UpdateMemberReport','MemberReport','update','limit','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MemberReport,\x20%s,\x20%s','request\x20sent'];(function(_0x1e500e,_0x2c9d74){var _0x10dc5e=function(_0x354423){while(--_0x354423){_0x1e500e['push'](_0x1e500e['shift']());}};_0x10dc5e(++_0x2c9d74);}(_0xdf98,0xcf));var _0x8df9=function(_0xadc7d9,_0x203608){_0xadc7d9=_0xadc7d9-0x0;var _0x915ca1=_0xdf98[_0xadc7d9];return _0x915ca1;};'use strict';var _=require(_0x8df9('0x0'));var util=require('util');var moment=require(_0x8df9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8df9('0x2'));var db=require(_0x8df9('0x3'))['db'];var utils=require(_0x8df9('0x4'));var logger=require(_0x8df9('0x5'))(_0x8df9('0x6'));var config=require(_0x8df9('0x7'));var jayson=require(_0x8df9('0x8'));var client=jayson[_0x8df9('0x9')][_0x8df9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e79af,_0x1ffe3b,_0x393533){return new BPromise(function(_0x410568,_0x48bc8e){return client['request'](_0x5e79af,_0x393533)[_0x8df9('0xb')](function(_0x513b37){logger[_0x8df9('0xc')](_0x8df9('0xd'),_0x1ffe3b,_0x8df9('0xe'));logger[_0x8df9('0xf')](_0x8df9('0x10'),_0x1ffe3b,_0x8df9('0xe'),JSON[_0x8df9('0x11')](_0x513b37));if(_0x513b37[_0x8df9('0x12')]){if(_0x513b37['error'][_0x8df9('0x13')]===0x1f4){logger[_0x8df9('0x12')](_0x8df9('0xd'),_0x1ffe3b,_0x513b37['error'][_0x8df9('0x14')]);return _0x48bc8e(_0x513b37[_0x8df9('0x12')][_0x8df9('0x14')]);}logger[_0x8df9('0x12')]('MemberReport,\x20%s,\x20%s',_0x1ffe3b,_0x513b37['error'][_0x8df9('0x14')]);return _0x410568(_0x513b37[_0x8df9('0x12')][_0x8df9('0x14')]);}else{logger['info'](_0x8df9('0xd'),_0x1ffe3b,'request\x20sent');_0x410568(_0x513b37[_0x8df9('0x15')]['message']);}})[_0x8df9('0x16')](function(_0x8e547d){logger[_0x8df9('0x12')](_0x8df9('0xd'),_0x1ffe3b,_0x8e547d);_0x48bc8e(_0x8e547d);});});}exports[_0x8df9('0x17')]=function(_0x16e8c4){var _0x5e19e5=this;return new Promise(function(_0x54f2b0,_0x3bf137){return db['MemberReport']['findAll']({'raw':_0x16e8c4[_0x8df9('0x18')]?_0x16e8c4[_0x8df9('0x18')][_0x8df9('0x19')]===undefined?!![]:![]:!![],'where':_0x16e8c4[_0x8df9('0x18')]?_0x16e8c4[_0x8df9('0x18')][_0x8df9('0x1a')]||null:null,'attributes':_0x16e8c4['options']?_0x16e8c4[_0x8df9('0x18')][_0x8df9('0x1b')]||null:null,'limit':_0x16e8c4[_0x8df9('0x18')]?_0x16e8c4['options']['limit']||null:null,'include':_0x16e8c4['options']?_0x16e8c4['options']['include']?_[_0x8df9('0x1c')](_0x16e8c4[_0x8df9('0x18')][_0x8df9('0x1d')],function(_0x3dea66){return{'model':db[_0x3dea66[_0x8df9('0x1e')]],'as':_0x3dea66['as'],'attributes':_0x3dea66[_0x8df9('0x1b')],'include':_0x3dea66[_0x8df9('0x1d')]?_[_0x8df9('0x1c')](_0x3dea66['include'],function(_0x3323dc){return{'model':db[_0x3323dc[_0x8df9('0x1e')]],'as':_0x3323dc['as'],'attributes':_0x3323dc[_0x8df9('0x1b')],'include':_0x3323dc['include']?_['map'](_0x3323dc[_0x8df9('0x1d')],function(_0x5117c9){return{'model':db[_0x5117c9['model']],'as':_0x5117c9['as'],'attributes':_0x5117c9[_0x8df9('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8df9('0xb')](function(_0x3a43c5){logger[_0x8df9('0xc')](_0x8df9('0x17'),_0x16e8c4);logger['debug']('GetMemberReport',_0x16e8c4,JSON[_0x8df9('0x11')](_0x3a43c5));_0x54f2b0(_0x3a43c5);})[_0x8df9('0x16')](function(_0x2a9fee){logger['error'](_0x8df9('0x17'),_0x2a9fee[_0x8df9('0x14')],_0x16e8c4);_0x3bf137(_0x5e19e5['error'](0x1f4,_0x2a9fee[_0x8df9('0x14')]));});});};exports[_0x8df9('0x1f')]=function(_0x4a522f){var _0x26b063=this;return new Promise(function(_0x6463b5,_0x13ee72){return db['MemberReport']['create'](_0x4a522f[_0x8df9('0x20')],{'raw':_0x4a522f[_0x8df9('0x18')]?_0x4a522f[_0x8df9('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x8df9('0xb')](function(_0x395651){logger[_0x8df9('0xc')](_0x8df9('0x1f'),_0x4a522f);logger['debug'](_0x8df9('0x1f'),_0x4a522f,JSON[_0x8df9('0x11')](_0x395651));_0x6463b5(_0x395651);})['catch'](function(_0x26e3b6){logger['error']('CreateMemberReport',_0x26e3b6['message'],_0x4a522f);_0x13ee72(_0x26b063['error'](0x1f4,_0x26e3b6[_0x8df9('0x14')]));});});};exports[_0x8df9('0x21')]=function(_0x16b95e){var _0x8c94f6=this;return new Promise(function(_0x43dce0,_0x3bfe71){return db[_0x8df9('0x22')][_0x8df9('0x23')](_0x16b95e[_0x8df9('0x20')],{'raw':_0x16b95e[_0x8df9('0x18')]?_0x16b95e[_0x8df9('0x18')][_0x8df9('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16b95e['options']?_0x16b95e['options']['where']||null:null,'attributes':_0x16b95e[_0x8df9('0x18')]?_0x16b95e[_0x8df9('0x18')]['attributes']||null:null,'limit':_0x16b95e[_0x8df9('0x18')]?_0x16b95e['options'][_0x8df9('0x24')]||null:null})[_0x8df9('0xb')](function(_0x4fdf54){logger['info']('UpdateMemberReport',_0x16b95e);logger[_0x8df9('0xf')](_0x8df9('0x21'),_0x16b95e,JSON[_0x8df9('0x11')](_0x4fdf54));_0x43dce0(_0x4fdf54);})['catch'](function(_0x589633){logger[_0x8df9('0x12')]('UpdateMemberReport',_0x589633[_0x8df9('0x14')],_0x16b95e);_0x3bfe71(_0x8c94f6[_0x8df9('0x12')](0x1f4,_0x589633['message']));});});}; \ No newline at end of file +var _0x3831=['model','GetMemberReport','CreateMemberReport','create','body','UpdateMemberReport','MemberReport','update','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','request','then','info','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','options','raw','where','attributes','limit','include','map'];(function(_0x377941,_0x5b5b57){var _0x3dd051=function(_0x72e088){while(--_0x72e088){_0x377941['push'](_0x377941['shift']());}};_0x3dd051(++_0x5b5b57);}(_0x3831,0x14c));var _0x1383=function(_0x33a6bd,_0x564362){_0x33a6bd=_0x33a6bd-0x0;var _0x339aff=_0x3831[_0x33a6bd];return _0x339aff;};'use strict';var _=require(_0x1383('0x0'));var util=require('util');var moment=require(_0x1383('0x1'));var BPromise=require(_0x1383('0x2'));var rs=require(_0x1383('0x3'));var fs=require('fs');var Redis=require(_0x1383('0x4'));var db=require(_0x1383('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1383('0x6'))('rpc');var config=require(_0x1383('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x45a030,_0x5a6ba0,_0x187027){return new BPromise(function(_0x1ddd4c,_0x2e9a5b){return client[_0x1383('0x8')](_0x45a030,_0x187027)[_0x1383('0x9')](function(_0x7cb670){logger[_0x1383('0xa')](_0x1383('0xb'),_0x5a6ba0,'request\x20sent');logger[_0x1383('0xc')](_0x1383('0xd'),_0x5a6ba0,_0x1383('0xe'),JSON[_0x1383('0xf')](_0x7cb670));if(_0x7cb670[_0x1383('0x10')]){if(_0x7cb670['error'][_0x1383('0x11')]===0x1f4){logger[_0x1383('0x10')](_0x1383('0xb'),_0x5a6ba0,_0x7cb670['error']['message']);return _0x2e9a5b(_0x7cb670[_0x1383('0x10')][_0x1383('0x12')]);}logger[_0x1383('0x10')](_0x1383('0xb'),_0x5a6ba0,_0x7cb670[_0x1383('0x10')][_0x1383('0x12')]);return _0x1ddd4c(_0x7cb670[_0x1383('0x10')][_0x1383('0x12')]);}else{logger['info'](_0x1383('0xb'),_0x5a6ba0,_0x1383('0xe'));_0x1ddd4c(_0x7cb670[_0x1383('0x13')][_0x1383('0x12')]);}})[_0x1383('0x14')](function(_0x388b94){logger[_0x1383('0x10')]('MemberReport,\x20%s,\x20%s',_0x5a6ba0,_0x388b94);_0x2e9a5b(_0x388b94);});});}exports['GetMemberReport']=function(_0x2301a6){var _0x5387f2=this;return new Promise(function(_0x236b29,_0x5b3705){return db['MemberReport']['findAll']({'raw':_0x2301a6[_0x1383('0x15')]?_0x2301a6['options'][_0x1383('0x16')]===undefined?!![]:![]:!![],'where':_0x2301a6['options']?_0x2301a6[_0x1383('0x15')][_0x1383('0x17')]||null:null,'attributes':_0x2301a6[_0x1383('0x15')]?_0x2301a6[_0x1383('0x15')][_0x1383('0x18')]||null:null,'limit':_0x2301a6[_0x1383('0x15')]?_0x2301a6[_0x1383('0x15')][_0x1383('0x19')]||null:null,'include':_0x2301a6[_0x1383('0x15')]?_0x2301a6['options'][_0x1383('0x1a')]?_[_0x1383('0x1b')](_0x2301a6[_0x1383('0x15')][_0x1383('0x1a')],function(_0x186524){return{'model':db[_0x186524[_0x1383('0x1c')]],'as':_0x186524['as'],'attributes':_0x186524[_0x1383('0x18')],'include':_0x186524['include']?_['map'](_0x186524[_0x1383('0x1a')],function(_0x160497){return{'model':db[_0x160497[_0x1383('0x1c')]],'as':_0x160497['as'],'attributes':_0x160497[_0x1383('0x18')],'include':_0x160497[_0x1383('0x1a')]?_['map'](_0x160497['include'],function(_0x4a8b6e){return{'model':db[_0x4a8b6e[_0x1383('0x1c')]],'as':_0x4a8b6e['as'],'attributes':_0x4a8b6e[_0x1383('0x18')]};}):[]};}):[]};}):[]:[]})[_0x1383('0x9')](function(_0x263aea){logger['info'](_0x1383('0x1d'),_0x2301a6);logger['debug'](_0x1383('0x1d'),_0x2301a6,JSON[_0x1383('0xf')](_0x263aea));_0x236b29(_0x263aea);})[_0x1383('0x14')](function(_0x23e541){logger[_0x1383('0x10')](_0x1383('0x1d'),_0x23e541[_0x1383('0x12')],_0x2301a6);_0x5b3705(_0x5387f2[_0x1383('0x10')](0x1f4,_0x23e541[_0x1383('0x12')]));});});};exports[_0x1383('0x1e')]=function(_0x1fdd75){var _0x230780=this;return new Promise(function(_0x370bea,_0x1a3305){return db['MemberReport'][_0x1383('0x1f')](_0x1fdd75[_0x1383('0x20')],{'raw':_0x1fdd75[_0x1383('0x15')]?_0x1fdd75[_0x1383('0x15')][_0x1383('0x16')]===undefined?!![]:![]:!![]})[_0x1383('0x9')](function(_0x52b5b8){logger[_0x1383('0xa')](_0x1383('0x1e'),_0x1fdd75);logger[_0x1383('0xc')](_0x1383('0x1e'),_0x1fdd75,JSON[_0x1383('0xf')](_0x52b5b8));_0x370bea(_0x52b5b8);})[_0x1383('0x14')](function(_0x5d463a){logger[_0x1383('0x10')]('CreateMemberReport',_0x5d463a['message'],_0x1fdd75);_0x1a3305(_0x230780[_0x1383('0x10')](0x1f4,_0x5d463a[_0x1383('0x12')]));});});};exports[_0x1383('0x21')]=function(_0x5f0af0){var _0x4f05ec=this;return new Promise(function(_0x5bca56,_0x336869){return db[_0x1383('0x22')][_0x1383('0x23')](_0x5f0af0['body'],{'raw':_0x5f0af0['options']?_0x5f0af0[_0x1383('0x15')][_0x1383('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f0af0[_0x1383('0x15')]?_0x5f0af0[_0x1383('0x15')]['where']||null:null,'attributes':_0x5f0af0['options']?_0x5f0af0[_0x1383('0x15')][_0x1383('0x18')]||null:null,'limit':_0x5f0af0[_0x1383('0x15')]?_0x5f0af0[_0x1383('0x15')][_0x1383('0x19')]||null:null})[_0x1383('0x9')](function(_0x330265){logger['info'](_0x1383('0x21'),_0x5f0af0);logger['debug'](_0x1383('0x21'),_0x5f0af0,JSON[_0x1383('0xf')](_0x330265));_0x5bca56(_0x330265);})[_0x1383('0x14')](function(_0x52854f){logger[_0x1383('0x10')]('UpdateMemberReport',_0x52854f['message'],_0x5f0af0);_0x336869(_0x4f05ec[_0x1383('0x10')](0x1f4,_0x52854f[_0x1383('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 41221a2..9b4bc62 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 _0x5825=['../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','index','multer','util','path','express','Router','fs-extra'];(function(_0x425cc1,_0x2ff21b){var _0x699b5d=function(_0x4a1c16){while(--_0x4a1c16){_0x425cc1['push'](_0x425cc1['shift']());}};_0x699b5d(++_0x2ff21b);}(_0x5825,0xb5));var _0x5582=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x5825[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0x5582('0x0'));var util=require(_0x5582('0x1'));var path=require(_0x5582('0x2'));var timeout=require('connect-timeout');var express=require(_0x5582('0x3'));var router=express[_0x5582('0x4')]();var fs_extra=require(_0x5582('0x5'));var auth=require(_0x5582('0x6'));var interaction=require(_0x5582('0x7'));var config=require(_0x5582('0x8'));var controller=require(_0x5582('0x9'));router['get']('/',controller[_0x5582('0xa')]);module['exports']=router; \ No newline at end of file +var _0xb4b1=['util','path','express','Router','./migration.controller','get','index','exports','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb4b1,0x1d3));var _0x1b4b=function(_0x245217,_0x2083a1){_0x245217=_0x245217-0x0;var _0x3e53fe=_0xb4b1[_0x245217];return _0x3e53fe;};'use strict';var multer=require(_0x1b4b('0x0'));var util=require(_0x1b4b('0x1'));var path=require(_0x1b4b('0x2'));var timeout=require('connect-timeout');var express=require(_0x1b4b('0x3'));var router=express[_0x1b4b('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(_0x1b4b('0x5'));router[_0x1b4b('0x6')]('/',controller[_0x1b4b('0x7')]);module[_0x1b4b('0x8')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 9fa8950..bd605c5 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 _0xed86=['sequelize','exports'];(function(_0x5a88d1,_0x52da1d){var _0x474eb2=function(_0x41d755){while(--_0x41d755){_0x5a88d1['push'](_0x5a88d1['shift']());}};_0x474eb2(++_0x52da1d);}(_0xed86,0xa0));var _0x6ed8=function(_0xdd827a,_0x482ad2){_0xdd827a=_0xdd827a-0x0;var _0x2f46f1=_0xed86[_0xdd827a];return _0x2f46f1;};'use strict';var Sequelize=require(_0x6ed8('0x0'));module[_0x6ed8('0x1')]={'version':{'type':Sequelize['STRING'],'unique':'version'}}; \ No newline at end of file +var _0xe7d8=['exports','version','sequelize'];(function(_0x4e17ee,_0x1cb39d){var _0x57d9ae=function(_0x3caf42){while(--_0x3caf42){_0x4e17ee['push'](_0x4e17ee['shift']());}};_0x57d9ae(++_0x1cb39d);}(_0xe7d8,0x1d9));var _0x8e7d=function(_0x2e8418,_0x58c529){_0x2e8418=_0x2e8418-0x0;var _0x548fe6=_0xe7d8[_0x2e8418];return _0x548fe6;};'use strict';var Sequelize=require(_0x8e7d('0x0'));module[_0x8e7d('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0x8e7d('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 112ad2e..74135ae 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 _0xc813=['merge','VIRTUAL','options','includeAll','findAll','catch','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','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','update','then','destroy','error','name','index','map','Migration','rawAttributes','fieldName','type','key','model','keys','filters','query','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0xf23730,_0x2c89d1){var _0x478303=function(_0x3ff8d4){while(--_0x3ff8d4){_0xf23730['push'](_0xf23730['shift']());}};_0x478303(++_0x2c89d1);}(_0xc813,0x1db));var _0x3c81=function(_0x15cbce,_0xda8402){_0x15cbce=_0x15cbce-0x0;var _0x257f29=_0xc813[_0x15cbce];return _0x257f29;};'use strict';var emlformat=require(_0x3c81('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3c81('0x1'));var jsonpatch=require(_0x3c81('0x2'));var rp=require(_0x3c81('0x3'));var moment=require(_0x3c81('0x4'));var BPromise=require(_0x3c81('0x5'));var Mustache=require(_0x3c81('0x6'));var util=require(_0x3c81('0x7'));var path=require(_0x3c81('0x8'));var sox=require(_0x3c81('0x9'));var csv=require(_0x3c81('0xa'));var ejs=require(_0x3c81('0xb'));var fs=require('fs');var fs_extra=require(_0x3c81('0xc'));var _=require('lodash');var squel=require(_0x3c81('0xd'));var crypto=require('crypto');var jsforce=require(_0x3c81('0xe'));var deskjs=require(_0x3c81('0xf'));var toCsv=require(_0x3c81('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3c81('0x10'));var authService=require(_0x3c81('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3c81('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3c81('0x13'))(_0x3c81('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3c81('0x15'));var db=require(_0x3c81('0x16'))['db'];function respondWithStatusCode(_0x39613e,_0x2c61ae){_0x2c61ae=_0x2c61ae||0xcc;return function(_0x51887a){if(_0x51887a){return _0x39613e[_0x3c81('0x17')](_0x2c61ae);}return _0x39613e[_0x3c81('0x18')](_0x2c61ae)[_0x3c81('0x19')]();};}function respondWithResult(_0x53aaec,_0x2e8993){_0x2e8993=_0x2e8993||0xc8;return function(_0x1113a8){if(_0x1113a8){return _0x53aaec[_0x3c81('0x18')](_0x2e8993)[_0x3c81('0x1a')](_0x1113a8);}};}function respondWithFilteredResult(_0x2af43f,_0xd045ab){return function(_0x4d3d04){if(_0x4d3d04){var _0x2cbbb2=typeof _0xd045ab[_0x3c81('0x1b')]===_0x3c81('0x1c')&&typeof _0xd045ab[_0x3c81('0x1d')]===_0x3c81('0x1c');var _0x143ed0=_0x4d3d04[_0x3c81('0x1e')];var _0x355805=_0x2cbbb2?0x0:_0xd045ab[_0x3c81('0x1b')];var _0x18fa6c=_0x2cbbb2?_0x4d3d04['count']:_0xd045ab[_0x3c81('0x1b')]+_0xd045ab['limit'];var _0xa0c16b;if(_0x18fa6c>=_0x143ed0){_0x18fa6c=_0x143ed0;_0xa0c16b=0xc8;}else{_0xa0c16b=0xce;}_0x2af43f[_0x3c81('0x18')](_0xa0c16b);return _0x2af43f[_0x3c81('0x1f')](_0x3c81('0x20'),_0x355805+'-'+_0x18fa6c+'/'+_0x143ed0)[_0x3c81('0x1a')](_0x4d3d04);}return null;};}function patchUpdates(_0x33c450){return function(_0x4f2c67){try{jsonpatch[_0x3c81('0x21')](_0x4f2c67,_0x33c450,!![]);}catch(_0x1cb471){return BPromise[_0x3c81('0x22')](_0x1cb471);}return _0x4f2c67[_0x3c81('0x23')]();};}function saveUpdates(_0x3f1e87,_0x1f5933){return function(_0x47fbff){if(_0x47fbff){return _0x47fbff[_0x3c81('0x24')](_0x3f1e87)[_0x3c81('0x25')](function(_0x3c3987){return _0x3c3987;});}return null;};}function removeEntity(_0x1ea3ef,_0x53ce15){return function(_0x52d7e3){if(_0x52d7e3){return _0x52d7e3[_0x3c81('0x26')]()[_0x3c81('0x25')](function(){_0x1ea3ef[_0x3c81('0x18')](0xcc)[_0x3c81('0x19')]();});}};}function handleEntityNotFound(_0x5d2773,_0xff1a39){return function(_0x22d7ed){if(!_0x22d7ed){_0x5d2773['sendStatus'](0x194);}return _0x22d7ed;};}function handleError(_0x43642e,_0x3375e7){_0x3375e7=_0x3375e7||0x1f4;return function(_0x1a4dd9){logger[_0x3c81('0x27')](_0x1a4dd9['stack']);if(_0x1a4dd9[_0x3c81('0x28')]){delete _0x1a4dd9[_0x3c81('0x28')];}_0x43642e[_0x3c81('0x18')](_0x3375e7)['send'](_0x1a4dd9);};}exports[_0x3c81('0x29')]=function(_0x553054,_0xaba94d){var _0x37da24={},_0x3bc617={},_0x4745a4={'count':0x0,'rows':[]};var _0x404757=_[_0x3c81('0x2a')](db[_0x3c81('0x2b')][_0x3c81('0x2c')],function(_0x532b4a){return{'name':_0x532b4a[_0x3c81('0x2d')],'type':_0x532b4a[_0x3c81('0x2e')][_0x3c81('0x2f')]};});_0x3bc617[_0x3c81('0x30')]=_['map'](_0x404757,_0x3c81('0x28'));_0x3bc617['query']=_[_0x3c81('0x31')](_0x553054['query']);_0x3bc617[_0x3c81('0x32')]=_['intersection'](_0x3bc617[_0x3c81('0x30')],_0x3bc617['query']);_0x37da24['attributes']=_['intersection'](_0x3bc617[_0x3c81('0x30')],qs['fields'](_0x553054[_0x3c81('0x33')]['fields']));_0x37da24[_0x3c81('0x34')]=_0x37da24[_0x3c81('0x34')][_0x3c81('0x35')]?_0x37da24['attributes']:_0x3bc617[_0x3c81('0x30')];if(!_0x553054[_0x3c81('0x33')][_0x3c81('0x36')](_0x3c81('0x37'))){_0x37da24['limit']=qs[_0x3c81('0x1d')](_0x553054[_0x3c81('0x33')][_0x3c81('0x1d')]);_0x37da24[_0x3c81('0x1b')]=qs[_0x3c81('0x1b')](_0x553054['query'][_0x3c81('0x1b')]);}_0x37da24[_0x3c81('0x38')]=qs[_0x3c81('0x39')](_0x553054[_0x3c81('0x33')][_0x3c81('0x39')]);_0x37da24[_0x3c81('0x3a')]=qs[_0x3c81('0x32')](_[_0x3c81('0x3b')](_0x553054[_0x3c81('0x33')],_0x3bc617[_0x3c81('0x32')]),_0x404757);if(_0x553054['query'][_0x3c81('0x3c')]){_0x37da24[_0x3c81('0x3a')]=_[_0x3c81('0x3d')](_0x37da24[_0x3c81('0x3a')],{'$or':_['map'](_0x404757,function(_0x37a487){if(_0x37a487[_0x3c81('0x2e')]!==_0x3c81('0x3e')){var _0x11eec9={};_0x11eec9[_0x37a487[_0x3c81('0x28')]]={'$like':'%'+_0x553054[_0x3c81('0x33')][_0x3c81('0x3c')]+'%'};return _0x11eec9;}})});}_0x37da24=_['merge']({},_0x37da24,_0x553054[_0x3c81('0x3f')]);var _0x1e5ae1={'where':_0x37da24[_0x3c81('0x3a')]};return db[_0x3c81('0x2b')]['count'](_0x1e5ae1)[_0x3c81('0x25')](function(_0x159e5d){_0x4745a4['count']=_0x159e5d;if(_0x553054[_0x3c81('0x33')][_0x3c81('0x40')]){_0x37da24['include']=[{'all':!![]}];}return db['Migration'][_0x3c81('0x41')](_0x37da24);})[_0x3c81('0x25')](function(_0x5465ff){_0x4745a4['rows']=_0x5465ff;return _0x4745a4;})[_0x3c81('0x25')](respondWithFilteredResult(_0xaba94d,_0x37da24))[_0x3c81('0x42')](handleError(_0xaba94d,null));}; \ No newline at end of file +var _0xb903=['length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','stack','name','send','map','Migration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields'];(function(_0x15aa8b,_0x1e02b2){var _0x24dd4b=function(_0x14e6ad){while(--_0x14e6ad){_0x15aa8b['push'](_0x15aa8b['shift']());}};_0x24dd4b(++_0x1e02b2);}(_0xb903,0x1b0));var _0x3b90=function(_0x2b0709,_0x1029f9){_0x2b0709=_0x2b0709-0x0;var _0x14efd3=_0xb903[_0x2b0709];return _0x14efd3;};'use strict';var emlformat=require(_0x3b90('0x0'));var rimraf=require(_0x3b90('0x1'));var zipdir=require(_0x3b90('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3b90('0x3'));var moment=require(_0x3b90('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3b90('0x5'));var util=require('util');var path=require(_0x3b90('0x6'));var sox=require(_0x3b90('0x7'));var csv=require(_0x3b90('0x8'));var ejs=require(_0x3b90('0x9'));var fs=require('fs');var fs_extra=require(_0x3b90('0xa'));var _=require(_0x3b90('0xb'));var squel=require(_0x3b90('0xc'));var crypto=require(_0x3b90('0xd'));var jsforce=require(_0x3b90('0xe'));var deskjs=require(_0x3b90('0xf'));var toCsv=require('to-csv');var querystring=require(_0x3b90('0x10'));var Papa=require(_0x3b90('0x11'));var Redis=require('ioredis');var authService=require(_0x3b90('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3b90('0x13'));var hardwareService=require(_0x3b90('0x14'));var logger=require(_0x3b90('0x15'))(_0x3b90('0x16'));var utils=require(_0x3b90('0x17'));var config=require(_0x3b90('0x18'));var licenseUtil=require(_0x3b90('0x19'));var db=require(_0x3b90('0x1a'))['db'];function respondWithStatusCode(_0x5bfad7,_0x3a80eb){_0x3a80eb=_0x3a80eb||0xcc;return function(_0x2fa12a){if(_0x2fa12a){return _0x5bfad7[_0x3b90('0x1b')](_0x3a80eb);}return _0x5bfad7[_0x3b90('0x1c')](_0x3a80eb)[_0x3b90('0x1d')]();};}function respondWithResult(_0x13bac8,_0x28e2cc){_0x28e2cc=_0x28e2cc||0xc8;return function(_0x25dfbe){if(_0x25dfbe){return _0x13bac8[_0x3b90('0x1c')](_0x28e2cc)['json'](_0x25dfbe);}};}function respondWithFilteredResult(_0x13e299,_0x228057){return function(_0x5f0de5){if(_0x5f0de5){var _0xbbb3b9=typeof _0x228057[_0x3b90('0x1e')]===_0x3b90('0x1f')&&typeof _0x228057[_0x3b90('0x20')]===_0x3b90('0x1f');var _0x1d5f2f=_0x5f0de5[_0x3b90('0x21')];var _0x3f5493=_0xbbb3b9?0x0:_0x228057[_0x3b90('0x1e')];var _0x3e911b=_0xbbb3b9?_0x5f0de5[_0x3b90('0x21')]:_0x228057[_0x3b90('0x1e')]+_0x228057[_0x3b90('0x20')];var _0x564306;if(_0x3e911b>=_0x1d5f2f){_0x3e911b=_0x1d5f2f;_0x564306=0xc8;}else{_0x564306=0xce;}_0x13e299[_0x3b90('0x1c')](_0x564306);return _0x13e299[_0x3b90('0x22')]('Content-Range',_0x3f5493+'-'+_0x3e911b+'/'+_0x1d5f2f)[_0x3b90('0x23')](_0x5f0de5);}return null;};}function patchUpdates(_0xe540aa){return function(_0x26005c){try{jsonpatch[_0x3b90('0x24')](_0x26005c,_0xe540aa,!![]);}catch(_0x5e69dd){return BPromise[_0x3b90('0x25')](_0x5e69dd);}return _0x26005c[_0x3b90('0x26')]();};}function saveUpdates(_0x58f0a8,_0x8b43da){return function(_0x4df85e){if(_0x4df85e){return _0x4df85e[_0x3b90('0x27')](_0x58f0a8)[_0x3b90('0x28')](function(_0xe808ac){return _0xe808ac;});}return null;};}function removeEntity(_0x11ba2b,_0x3fe569){return function(_0xb01bcc){if(_0xb01bcc){return _0xb01bcc[_0x3b90('0x29')]()[_0x3b90('0x28')](function(){_0x11ba2b[_0x3b90('0x1c')](0xcc)[_0x3b90('0x1d')]();});}};}function handleEntityNotFound(_0x3233eb,_0x51f736){return function(_0x45ef64){if(!_0x45ef64){_0x3233eb[_0x3b90('0x1b')](0x194);}return _0x45ef64;};}function handleError(_0x57eacb,_0x15f77e){_0x15f77e=_0x15f77e||0x1f4;return function(_0x42fbac){logger['error'](_0x42fbac[_0x3b90('0x2a')]);if(_0x42fbac[_0x3b90('0x2b')]){delete _0x42fbac[_0x3b90('0x2b')];}_0x57eacb[_0x3b90('0x1c')](_0x15f77e)[_0x3b90('0x2c')](_0x42fbac);};}exports['index']=function(_0x550683,_0x12b939){var _0x2cf10f={},_0x1dff99={},_0x488bf7={'count':0x0,'rows':[]};var _0x2c6c3e=_[_0x3b90('0x2d')](db[_0x3b90('0x2e')][_0x3b90('0x2f')],function(_0x5429ed){return{'name':_0x5429ed[_0x3b90('0x30')],'type':_0x5429ed[_0x3b90('0x31')][_0x3b90('0x32')]};});_0x1dff99[_0x3b90('0x33')]=_[_0x3b90('0x2d')](_0x2c6c3e,'name');_0x1dff99['query']=_[_0x3b90('0x34')](_0x550683[_0x3b90('0x35')]);_0x1dff99[_0x3b90('0x36')]=_[_0x3b90('0x37')](_0x1dff99[_0x3b90('0x33')],_0x1dff99[_0x3b90('0x35')]);_0x2cf10f[_0x3b90('0x38')]=_[_0x3b90('0x37')](_0x1dff99[_0x3b90('0x33')],qs[_0x3b90('0x39')](_0x550683[_0x3b90('0x35')][_0x3b90('0x39')]));_0x2cf10f['attributes']=_0x2cf10f['attributes'][_0x3b90('0x3a')]?_0x2cf10f[_0x3b90('0x38')]:_0x1dff99[_0x3b90('0x33')];if(!_0x550683[_0x3b90('0x35')][_0x3b90('0x3b')]('nolimit')){_0x2cf10f[_0x3b90('0x20')]=qs[_0x3b90('0x20')](_0x550683['query']['limit']);_0x2cf10f[_0x3b90('0x1e')]=qs[_0x3b90('0x1e')](_0x550683['query'][_0x3b90('0x1e')]);}_0x2cf10f[_0x3b90('0x3c')]=qs[_0x3b90('0x3d')](_0x550683['query'][_0x3b90('0x3d')]);_0x2cf10f[_0x3b90('0x3e')]=qs[_0x3b90('0x36')](_[_0x3b90('0x3f')](_0x550683[_0x3b90('0x35')],_0x1dff99[_0x3b90('0x36')]),_0x2c6c3e);if(_0x550683['query'][_0x3b90('0x40')]){_0x2cf10f[_0x3b90('0x3e')]=_[_0x3b90('0x41')](_0x2cf10f[_0x3b90('0x3e')],{'$or':_[_0x3b90('0x2d')](_0x2c6c3e,function(_0x1791c0){if(_0x1791c0[_0x3b90('0x31')]!==_0x3b90('0x42')){var _0x28b64f={};_0x28b64f[_0x1791c0['name']]={'$like':'%'+_0x550683[_0x3b90('0x35')][_0x3b90('0x40')]+'%'};return _0x28b64f;}})});}_0x2cf10f=_[_0x3b90('0x41')]({},_0x2cf10f,_0x550683['options']);var _0x4e9d64={'where':_0x2cf10f['where']};return db[_0x3b90('0x2e')][_0x3b90('0x21')](_0x4e9d64)[_0x3b90('0x28')](function(_0x24a07f){_0x488bf7[_0x3b90('0x21')]=_0x24a07f;if(_0x550683[_0x3b90('0x35')][_0x3b90('0x43')]){_0x2cf10f[_0x3b90('0x44')]=[{'all':!![]}];}return db[_0x3b90('0x2e')]['findAll'](_0x2cf10f);})[_0x3b90('0x28')](function(_0x94f8d0){_0x488bf7[_0x3b90('0x45')]=_0x94f8d0;return _0x488bf7;})[_0x3b90('0x28')](respondWithFilteredResult(_0x12b939,_0x2cf10f))['catch'](handleError(_0x12b939,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index ea05b53..63111e8 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 _0xa7ce=['../../config/environment','exports','define','Migration','migrations','util','api','bluebird','request-promise','path','rimraf'];(function(_0x3a9198,_0xabc051){var _0x54f787=function(_0x4a9bcc){while(--_0x4a9bcc){_0x3a9198['push'](_0x3a9198['shift']());}};_0x54f787(++_0xabc051);}(_0xa7ce,0x118));var _0xea7c=function(_0x3879d5,_0x459b09){_0x3879d5=_0x3879d5-0x0;var _0x387d95=_0xa7ce[_0x3879d5];return _0x387d95;};'use strict';var _=require('lodash');var util=require(_0xea7c('0x0'));var logger=require('../../config/logger')(_0xea7c('0x1'));var moment=require('moment');var BPromise=require(_0xea7c('0x2'));var rp=require(_0xea7c('0x3'));var fs=require('fs');var path=require(_0xea7c('0x4'));var rimraf=require(_0xea7c('0x5'));var config=require(_0xea7c('0x6'));var attributes=require('./migration.attributes');module[_0xea7c('0x7')]=function(_0x57b5a8,_0x45da69){return _0x57b5a8[_0xea7c('0x8')](_0xea7c('0x9'),attributes,{'tableName':_0xea7c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe4f2=['rimraf','../../config/environment','./migration.attributes','exports','define','Migration','migrations','util','../../config/logger','api','moment','path'];(function(_0x29e3ec,_0x138a18){var _0x25727e=function(_0x2bea0d){while(--_0x2bea0d){_0x29e3ec['push'](_0x29e3ec['shift']());}};_0x25727e(++_0x138a18);}(_0xe4f2,0xeb));var _0x2e4f=function(_0x10ab33,_0x2baf3d){_0x10ab33=_0x10ab33-0x0;var _0x1b6f44=_0xe4f2[_0x10ab33];return _0x1b6f44;};'use strict';var _=require('lodash');var util=require(_0x2e4f('0x0'));var logger=require(_0x2e4f('0x1'))(_0x2e4f('0x2'));var moment=require(_0x2e4f('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2e4f('0x4'));var rimraf=require(_0x2e4f('0x5'));var config=require(_0x2e4f('0x6'));var attributes=require(_0x2e4f('0x7'));module[_0x2e4f('0x8')]=function(_0x3d6e4b,_0x3df855){return _0x3d6e4b[_0x2e4f('0x9')](_0x2e4f('0xa'),attributes,{'tableName':_0x2e4f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 3561d9f..612fbe2 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 _0x67da=['error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3048ea,_0x3838c2){var _0x1a13c4=function(_0x2c6a6b){while(--_0x2c6a6b){_0x3048ea['push'](_0x3048ea['shift']());}};_0x1a13c4(++_0x3838c2);}(_0x67da,0x192));var _0xa67d=function(_0x4e377d,_0x3dd5bb){_0x4e377d=_0x4e377d-0x0;var _0x1aae22=_0x67da[_0x4e377d];return _0x1aae22;};'use strict';var _=require('lodash');var util=require(_0xa67d('0x0'));var moment=require(_0xa67d('0x1'));var BPromise=require(_0xa67d('0x2'));var rs=require(_0xa67d('0x3'));var fs=require('fs');var Redis=require(_0xa67d('0x4'));var db=require(_0xa67d('0x5'))['db'];var utils=require(_0xa67d('0x6'));var logger=require(_0xa67d('0x7'))(_0xa67d('0x8'));var config=require(_0xa67d('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa67d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d2734,_0x31d56a,_0x2346f4){return new BPromise(function(_0x10f89a,_0x2c37c2){return client[_0xa67d('0xb')](_0x4d2734,_0x2346f4)[_0xa67d('0xc')](function(_0x330a9f){logger[_0xa67d('0xd')](_0xa67d('0xe'),_0x31d56a,_0xa67d('0xf'));logger['debug'](_0xa67d('0x10'),_0x31d56a,_0xa67d('0xf'),JSON[_0xa67d('0x11')](_0x330a9f));if(_0x330a9f[_0xa67d('0x12')]){if(_0x330a9f['error'][_0xa67d('0x13')]===0x1f4){logger[_0xa67d('0x12')]('Migration,\x20%s,\x20%s',_0x31d56a,_0x330a9f['error'][_0xa67d('0x14')]);return _0x2c37c2(_0x330a9f['error'][_0xa67d('0x14')]);}logger['error']('Migration,\x20%s,\x20%s',_0x31d56a,_0x330a9f[_0xa67d('0x12')][_0xa67d('0x14')]);return _0x10f89a(_0x330a9f['error'][_0xa67d('0x14')]);}else{logger[_0xa67d('0xd')](_0xa67d('0xe'),_0x31d56a,_0xa67d('0xf'));_0x10f89a(_0x330a9f['result']['message']);}})['catch'](function(_0x4fa50f){logger[_0xa67d('0x12')]('Migration,\x20%s,\x20%s',_0x31d56a,_0x4fa50f);_0x2c37c2(_0x4fa50f);});});} \ No newline at end of file +var _0x2bdb=['request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s'];(function(_0x4e9b2a,_0x3c1e2d){var _0x59b837=function(_0x1fe229){while(--_0x1fe229){_0x4e9b2a['push'](_0x4e9b2a['shift']());}};_0x59b837(++_0x3c1e2d);}(_0x2bdb,0x105));var _0xb2bd=function(_0x3f9bbf,_0x197a82){_0x3f9bbf=_0x3f9bbf-0x0;var _0x555b03=_0x2bdb[_0x3f9bbf];return _0x555b03;};'use strict';var _=require(_0xb2bd('0x0'));var util=require('util');var moment=require(_0xb2bd('0x1'));var BPromise=require('bluebird');var rs=require(_0xb2bd('0x2'));var fs=require('fs');var Redis=require(_0xb2bd('0x3'));var db=require(_0xb2bd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb2bd('0x5'))(_0xb2bd('0x6'));var config=require(_0xb2bd('0x7'));var jayson=require(_0xb2bd('0x8'));var client=jayson[_0xb2bd('0x9')][_0xb2bd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3bff5b,_0x5bae78,_0x21462b){return new BPromise(function(_0x4d9d3f,_0x181f5a){return client[_0xb2bd('0xb')](_0x3bff5b,_0x21462b)[_0xb2bd('0xc')](function(_0xeaa2b7){logger[_0xb2bd('0xd')](_0xb2bd('0xe'),_0x5bae78,_0xb2bd('0xf'));logger[_0xb2bd('0x10')](_0xb2bd('0x11'),_0x5bae78,'request\x20sent',JSON[_0xb2bd('0x12')](_0xeaa2b7));if(_0xeaa2b7[_0xb2bd('0x13')]){if(_0xeaa2b7[_0xb2bd('0x13')][_0xb2bd('0x14')]===0x1f4){logger[_0xb2bd('0x13')](_0xb2bd('0xe'),_0x5bae78,_0xeaa2b7[_0xb2bd('0x13')][_0xb2bd('0x15')]);return _0x181f5a(_0xeaa2b7['error'][_0xb2bd('0x15')]);}logger['error'](_0xb2bd('0xe'),_0x5bae78,_0xeaa2b7[_0xb2bd('0x13')][_0xb2bd('0x15')]);return _0x4d9d3f(_0xeaa2b7[_0xb2bd('0x13')][_0xb2bd('0x15')]);}else{logger['info'](_0xb2bd('0xe'),_0x5bae78,_0xb2bd('0xf'));_0x4d9d3f(_0xeaa2b7[_0xb2bd('0x16')][_0xb2bd('0x15')]);}})['catch'](function(_0x14950f){logger[_0xb2bd('0x13')]('Migration,\x20%s,\x20%s',_0x5bae78,_0x14950f);_0x181f5a(_0x14950f);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 5bb385f..d6f86ed 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 _0x5a3c=['../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x55eef9,_0xd3605){var _0x3c681e=function(_0x5b125b){while(--_0x5b125b){_0x55eef9['push'](_0x55eef9['shift']());}};_0x3c681e(++_0xd3605);}(_0x5a3c,0x176));var _0xc5a3=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x5a3c[_0x138f59];return _0x3d114d;};'use strict';var multer=require(_0xc5a3('0x0'));var util=require(_0xc5a3('0x1'));var path=require(_0xc5a3('0x2'));var timeout=require('connect-timeout');var express=require(_0xc5a3('0x3'));var router=express[_0xc5a3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc5a3('0x5'));var interaction=require(_0xc5a3('0x6'));var config=require(_0xc5a3('0x7'));var controller=require(_0xc5a3('0x8'));router[_0xc5a3('0x9')]('/',auth[_0xc5a3('0xa')](),controller[_0xc5a3('0xb')]);router[_0xc5a3('0x9')](_0xc5a3('0xc'),auth[_0xc5a3('0xa')](),controller[_0xc5a3('0xd')]);router[_0xc5a3('0xe')]('/',auth[_0xc5a3('0xa')](),controller[_0xc5a3('0xf')]);router['put'](_0xc5a3('0xc'),auth[_0xc5a3('0xa')](),controller[_0xc5a3('0x10')]);router[_0xc5a3('0x11')](_0xc5a3('0xc'),auth[_0xc5a3('0xa')](),controller[_0xc5a3('0x12')]);module[_0xc5a3('0x13')]=router; \ No newline at end of file +var _0xf11e=['create','put','exports','multer','path','connect-timeout','express','../../components/auth/service','./network.controller','get','isAuthenticated','index','/:id','post'];(function(_0x1c4e4a,_0x14512){var _0xb16560=function(_0xfcd9f9){while(--_0xfcd9f9){_0x1c4e4a['push'](_0x1c4e4a['shift']());}};_0xb16560(++_0x14512);}(_0xf11e,0x11b));var _0xef11=function(_0x40ddac,_0xa90a81){_0x40ddac=_0x40ddac-0x0;var _0x458447=_0xf11e[_0x40ddac];return _0x458447;};'use strict';var multer=require(_0xef11('0x0'));var util=require('util');var path=require(_0xef11('0x1'));var timeout=require(_0xef11('0x2'));var express=require(_0xef11('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xef11('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xef11('0x5'));router[_0xef11('0x6')]('/',auth[_0xef11('0x7')](),controller[_0xef11('0x8')]);router[_0xef11('0x6')](_0xef11('0x9'),auth[_0xef11('0x7')](),controller['show']);router[_0xef11('0xa')]('/',auth[_0xef11('0x7')](),controller[_0xef11('0xb')]);router[_0xef11('0xc')](_0xef11('0x9'),auth[_0xef11('0x7')](),controller['update']);router['delete'](_0xef11('0x9'),auth[_0xef11('0x7')](),controller['destroy']);module[_0xef11('0xd')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 87b547e..88e45aa 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 _0x8371=['turn','STRING','sequelize','exports','localnet','externip'];(function(_0xc2a14d,_0x5a8219){var _0xf84416=function(_0x3363b7){while(--_0x3363b7){_0xc2a14d['push'](_0xc2a14d['shift']());}};_0xf84416(++_0x5a8219);}(_0x8371,0xf2));var _0x1837=function(_0x565683,_0x1d743b){_0x565683=_0x565683-0x0;var _0x34a2a8=_0x8371[_0x565683];return _0x34a2a8;};'use strict';var Sequelize=require(_0x1837('0x0'));module[_0x1837('0x1')]={'type':{'type':Sequelize['ENUM'](_0x1837('0x2'),_0x1837('0x3'),'stun',_0x1837('0x4'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x1837('0x5')]}}; \ No newline at end of file +var _0xfb6a=['sequelize','exports','ENUM','localnet','externip','stun','turn','STRING'];(function(_0x2f6233,_0x90172){var _0x1c9c36=function(_0x3ac680){while(--_0x3ac680){_0x2f6233['push'](_0x2f6233['shift']());}};_0x1c9c36(++_0x90172);}(_0xfb6a,0xd8));var _0xafb6=function(_0x3958fe,_0x3c6605){_0x3958fe=_0x3958fe-0x0;var _0x1f27d6=_0xfb6a[_0x3958fe];return _0x1f27d6;};'use strict';var Sequelize=require(_0xafb6('0x0'));module[_0xafb6('0x1')]={'type':{'type':Sequelize[_0xafb6('0x2')](_0xafb6('0x3'),_0xafb6('0x4'),_0xafb6('0x5'),_0xafb6('0x6'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xafb6('0x7')]},'password':{'type':Sequelize[_0xafb6('0x7')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 8da18f3..65b7b03 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 _0xa3fd=['Network','includeAll','include','rows','show','rawAttributes','find','create','body','toUpperCase','STUN','readFileSync','join','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','res_stun_monitor.so','TURN','root','/etc/asterisk/turn_xcally.conf','Reload','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','update','params','findAll','/etc/asterisk/stun_xcally.conf','server/files/templates/turn_multiple.ejs','path','ejs','api','../../mysqldb','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','status','json','offset','undefined','count','limit','set','Content-Range','destroy','end','sendStatus','stack','name','index','map','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','type','VIRTUAL','options'];(function(_0x1f2647,_0x1c9275){var _0x4b7045=function(_0x11c09d){while(--_0x11c09d){_0x1f2647['push'](_0x1f2647['shift']());}};_0x4b7045(++_0x1c9275);}(_0xa3fd,0x164));var _0xda3f=function(_0x21f9c2,_0x2b3d2a){_0x21f9c2=_0x21f9c2-0x0;var _0x3da17f=_0xa3fd[_0x21f9c2];return _0x3da17f;};'use strict';var util=require('util');var path=require(_0xda3f('0x0'));var ejs=require(_0xda3f('0x1'));var fs=require('fs');var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xda3f('0x2'));var config=require('../../config/environment');var db=require(_0xda3f('0x3'))['db'];var jayson=require(_0xda3f('0x4'));var client=jayson[_0xda3f('0x5')][_0xda3f('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xbdccf,_0xd675ef,_0x416e04,_0xb64f4){return new Promise(function(_0x35d8e3,_0x45fbee){var _0x47e7ac=_0xb64f4||client;return _0x47e7ac[_0xda3f('0x7')](_0xbdccf,_0x416e04)[_0xda3f('0x8')](function(_0xc4ee09){logger[_0xda3f('0x9')](_0xda3f('0xa'),_0xd675ef,_0xda3f('0xb'));logger['debug']('Network,\x20%s,\x20%s,\x20%s',_0xd675ef,_0xda3f('0xb'),JSON[_0xda3f('0xc')](_0xc4ee09));if(_0xc4ee09['error']){if(_0xc4ee09[_0xda3f('0xd')][_0xda3f('0xe')]===0x1f4){logger[_0xda3f('0xd')](_0xda3f('0xa'),_0xd675ef,_0xc4ee09['error'][_0xda3f('0xf')]);return _0x45fbee(_0xc4ee09['error'][_0xda3f('0xf')]);}logger[_0xda3f('0xd')](_0xda3f('0xa'),_0xd675ef,_0xc4ee09['error'][_0xda3f('0xf')]);return _0x35d8e3(_0xc4ee09[_0xda3f('0xd')]['message']);}else{logger[_0xda3f('0x9')](_0xda3f('0xa'),_0xd675ef,_0xda3f('0xb'));_0x35d8e3(_0xc4ee09['result'][_0xda3f('0xf')]);}})[_0xda3f('0x10')](function(_0x3f1702){logger[_0xda3f('0xd')](_0xda3f('0xa'),_0xd675ef,_0x3f1702);_0x45fbee(_0x3f1702);});});}function respondWithResult(_0x2eb4bb,_0x24dd08){_0x24dd08=_0x24dd08||0xc8;return function(_0xac8b97){if(_0xac8b97){return _0x2eb4bb[_0xda3f('0x11')](_0x24dd08)[_0xda3f('0x12')](_0xac8b97);}};}function respondWithFilteredResult(_0x5d7b96,_0x4cfc1d){return function(_0x1b30e4){if(_0x1b30e4){var _0xa5951a=typeof _0x4cfc1d[_0xda3f('0x13')]===_0xda3f('0x14')&&typeof _0x4cfc1d['limit']==='undefined';var _0x37c547=_0x1b30e4['count'];var _0x3b4411=_0xa5951a?0x0:_0x4cfc1d[_0xda3f('0x13')];var _0x5ae881=_0xa5951a?_0x1b30e4[_0xda3f('0x15')]:_0x4cfc1d[_0xda3f('0x13')]+_0x4cfc1d[_0xda3f('0x16')];var _0x3c6694;if(_0x5ae881>=_0x37c547){_0x5ae881=_0x37c547;_0x3c6694=0xc8;}else{_0x3c6694=0xce;}_0x5d7b96[_0xda3f('0x11')](_0x3c6694);return _0x5d7b96[_0xda3f('0x17')](_0xda3f('0x18'),_0x3b4411+'-'+_0x5ae881+'/'+_0x37c547)['json'](_0x1b30e4);}return null;};}function saveUpdates(_0x4c4189){return function(_0x44b78c){if(_0x44b78c){return _0x44b78c['update'](_0x4c4189)[_0xda3f('0x8')](function(_0x26aeb8){return _0x26aeb8;});}return null;};}function removeEntity(_0x3eecd7){return function(_0x8dd4f5){if(_0x8dd4f5){return _0x8dd4f5[_0xda3f('0x19')]()[_0xda3f('0x8')](function(){_0x3eecd7[_0xda3f('0x11')](0xcc)[_0xda3f('0x1a')]();});}};}function handleEntityNotFound(_0x43f7d9){return function(_0xf68304){if(!_0xf68304){_0x43f7d9[_0xda3f('0x1b')](0x194);}return _0xf68304;};}function handleError(_0x3d9b39,_0x52de48){_0x52de48=_0x52de48||0x1f4;return function(_0x26fe23){logger[_0xda3f('0xd')](_0x26fe23[_0xda3f('0x1c')]);if(_0x26fe23[_0xda3f('0x1d')]){delete _0x26fe23[_0xda3f('0x1d')];}_0x3d9b39[_0xda3f('0x11')](_0x52de48)['send'](_0x26fe23);};}exports[_0xda3f('0x1e')]=function(_0x396461,_0x4b0d6a){var _0x1b9269={},_0x296f48={},_0x4b9cb2={'count':0x0,'rows':[]};var _0x124825=_[_0xda3f('0x1f')](db['Network']['rawAttributes'],function(_0x2cc5d1){return{'name':_0x2cc5d1['fieldName'],'type':_0x2cc5d1['type'][_0xda3f('0x20')]};});_0x296f48[_0xda3f('0x21')]=_['map'](_0x124825,'name');_0x296f48[_0xda3f('0x22')]=_[_0xda3f('0x23')](_0x396461[_0xda3f('0x22')]);_0x296f48[_0xda3f('0x24')]=_['intersection'](_0x296f48['model'],_0x296f48[_0xda3f('0x22')]);_0x1b9269[_0xda3f('0x25')]=_[_0xda3f('0x26')](_0x296f48['model'],qs[_0xda3f('0x27')](_0x396461[_0xda3f('0x22')][_0xda3f('0x27')]));_0x1b9269['attributes']=_0x1b9269[_0xda3f('0x25')][_0xda3f('0x28')]?_0x1b9269[_0xda3f('0x25')]:_0x296f48[_0xda3f('0x21')];if(!_0x396461['query'][_0xda3f('0x29')]('nolimit')){_0x1b9269[_0xda3f('0x16')]=qs[_0xda3f('0x16')](_0x396461[_0xda3f('0x22')]['limit']);_0x1b9269[_0xda3f('0x13')]=qs[_0xda3f('0x13')](_0x396461[_0xda3f('0x22')][_0xda3f('0x13')]);}_0x1b9269['order']=qs[_0xda3f('0x2a')](_0x396461[_0xda3f('0x22')]['sort']);_0x1b9269[_0xda3f('0x2b')]=qs[_0xda3f('0x24')](_[_0xda3f('0x2c')](_0x396461[_0xda3f('0x22')],_0x296f48[_0xda3f('0x24')]),_0x124825);if(_0x396461[_0xda3f('0x22')][_0xda3f('0x2d')]){_0x1b9269[_0xda3f('0x2b')]=_['merge'](_0x1b9269[_0xda3f('0x2b')],{'$or':_[_0xda3f('0x1f')](_0x124825,function(_0x32e5c6){if(_0x32e5c6[_0xda3f('0x2e')]!==_0xda3f('0x2f')){var _0xe747b4={};_0xe747b4[_0x32e5c6[_0xda3f('0x1d')]]={'$like':'%'+_0x396461[_0xda3f('0x22')][_0xda3f('0x2d')]+'%'};return _0xe747b4;}})});}_0x1b9269=_['merge']({},_0x1b9269,_0x396461[_0xda3f('0x30')]);var _0x176d14={'where':_0x1b9269[_0xda3f('0x2b')]};return db[_0xda3f('0x31')][_0xda3f('0x15')](_0x176d14)[_0xda3f('0x8')](function(_0x1696e2){_0x4b9cb2[_0xda3f('0x15')]=_0x1696e2;if(_0x396461[_0xda3f('0x22')][_0xda3f('0x32')]){_0x1b9269[_0xda3f('0x33')]=[{'all':!![]}];}return db[_0xda3f('0x31')]['findAll'](_0x1b9269);})[_0xda3f('0x8')](function(_0x49e50c){_0x4b9cb2[_0xda3f('0x34')]=_0x49e50c;return _0x4b9cb2;})['then'](respondWithFilteredResult(_0x4b0d6a,_0x1b9269))[_0xda3f('0x10')](handleError(_0x4b0d6a,null));};exports[_0xda3f('0x35')]=function(_0x5a19b4,_0x555227){var _0x352b45={'raw':!![],'where':{'id':_0x5a19b4['params']['id']}},_0x41f505={};_0x41f505[_0xda3f('0x21')]=_['keys'](db[_0xda3f('0x31')][_0xda3f('0x36')]);_0x41f505[_0xda3f('0x22')]=_['keys'](_0x5a19b4[_0xda3f('0x22')]);_0x41f505[_0xda3f('0x24')]=_['intersection'](_0x41f505['model'],_0x41f505[_0xda3f('0x22')]);_0x352b45[_0xda3f('0x25')]=_[_0xda3f('0x26')](_0x41f505[_0xda3f('0x21')],qs[_0xda3f('0x27')](_0x5a19b4[_0xda3f('0x22')]['fields']));_0x352b45['attributes']=_0x352b45[_0xda3f('0x25')][_0xda3f('0x28')]?_0x352b45[_0xda3f('0x25')]:_0x41f505[_0xda3f('0x21')];if(_0x5a19b4[_0xda3f('0x22')][_0xda3f('0x32')]){_0x352b45[_0xda3f('0x33')]=[{'all':!![]}];}_0x352b45=_['merge']({},_0x352b45,_0x5a19b4['options']);return db[_0xda3f('0x31')][_0xda3f('0x37')](_0x352b45)[_0xda3f('0x8')](handleEntityNotFound(_0x555227,null))[_0xda3f('0x8')](respondWithResult(_0x555227,null))[_0xda3f('0x10')](handleError(_0x555227,null));};exports[_0xda3f('0x38')]=function(_0x1b4b21,_0x6034ff){var _0x4abfc5;return db['Network'][_0xda3f('0x38')](_0x1b4b21[_0xda3f('0x39')],{'raw':!![]})[_0xda3f('0x8')](function(_0x1217fa){_0x4abfc5=_0x1217fa;return db[_0xda3f('0x31')]['findAll']({'where':{'type':_0x1b4b21[_0xda3f('0x39')][_0xda3f('0x2e')]},'raw':!![]});})['then'](function(_0x28edb0){if(_0x4abfc5[_0xda3f('0x2e')][_0xda3f('0x3a')]()==_0xda3f('0x3b')){var _0x851a97=fs[_0xda3f('0x3c')](path[_0xda3f('0x3d')](config['root'],_0xda3f('0x3e')),_0xda3f('0x3f'));var _0x5c522c=ejs[_0xda3f('0x40')](_0x851a97,{'networks':_0x28edb0||[]});fs[_0xda3f('0x41')]('/etc/asterisk/stun_xcally.conf',_0x5c522c);return respondWithRpcPromise('Reload',_0xda3f('0x38'),{'module':_0xda3f('0x42')});}else if(_0x4abfc5[_0xda3f('0x2e')][_0xda3f('0x3a')]()==_0xda3f('0x43')){var _0x25e6a8=fs[_0xda3f('0x3c')](path[_0xda3f('0x3d')](config[_0xda3f('0x44')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x4a875d=ejs['render'](_0x25e6a8,{'networks':_0x28edb0||[]});fs[_0xda3f('0x41')](_0xda3f('0x45'),_0x4a875d);return respondWithRpcPromise(_0xda3f('0x46'),_0xda3f('0x38'),{'module':_0xda3f('0x42')});}else{var _0x511c41=fs['readFileSync'](path[_0xda3f('0x3d')](config[_0xda3f('0x44')],_0xda3f('0x47')),_0xda3f('0x3f'));var _0x34019d=ejs[_0xda3f('0x40')](_0x511c41,{'networks':_0x28edb0||[]});fs[_0xda3f('0x41')](util[_0xda3f('0x48')](_0xda3f('0x49'),_0x1b4b21[_0xda3f('0x39')]['type'][_0xda3f('0x4a')]()),_0x34019d);return respondWithRpcPromise(_0xda3f('0x46'),_0xda3f('0x38'),{'module':_0xda3f('0x4b')});}})[_0xda3f('0x8')](function(){return _0x4abfc5;})['then'](respondWithResult(_0x6034ff,0xc9))[_0xda3f('0x10')](handleError(_0x6034ff,null));};exports[_0xda3f('0x4c')]=function(_0x1aab12,_0x214528){var _0x462f64;return db[_0xda3f('0x31')]['find']({'where':{'id':_0x1aab12[_0xda3f('0x4d')]['id']}})[_0xda3f('0x8')](handleEntityNotFound(_0x214528,null))['then'](saveUpdates(_0x1aab12['body'],null))[_0xda3f('0x8')](function(_0x3566cb){if(_0x3566cb){_0x462f64=_0x3566cb;return db['Network'][_0xda3f('0x4e')]({'where':{'type':_0x462f64[_0xda3f('0x2e')]},'raw':!![]});}return null;})['then'](function(_0x20cf92){if(_0x462f64[_0xda3f('0x2e')]['toUpperCase']()=='STUN'){var _0xbec254=fs['readFileSync'](path[_0xda3f('0x3d')](config[_0xda3f('0x44')],'server/files/templates/stun_multiple.ejs'),_0xda3f('0x3f'));var _0xbb5cc1=ejs[_0xda3f('0x40')](_0xbec254,{'networks':_0x20cf92||[]});fs['writeFileSync'](_0xda3f('0x4f'),_0xbb5cc1);return respondWithRpcPromise(_0xda3f('0x46'),'update',{'module':_0xda3f('0x42')});}else if(_0x462f64[_0xda3f('0x2e')]['toUpperCase']()=='TURN'){var _0x239cdd=fs[_0xda3f('0x3c')](path[_0xda3f('0x3d')](config[_0xda3f('0x44')],'server/files/templates/turn_multiple.ejs'),_0xda3f('0x3f'));var _0xecaa76=ejs['render'](_0x239cdd,{'networks':_0x20cf92||[]});fs[_0xda3f('0x41')](_0xda3f('0x45'),_0xecaa76);return respondWithRpcPromise(_0xda3f('0x46'),_0xda3f('0x4c'),{'module':'res_stun_monitor.so'});}else{var _0xee574a=fs[_0xda3f('0x3c')](path['join'](config[_0xda3f('0x44')],_0xda3f('0x47')),_0xda3f('0x3f'));var _0x22d778=ejs[_0xda3f('0x40')](_0xee574a,{'networks':_0x20cf92||[]});fs['writeFileSync'](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x1aab12[_0xda3f('0x39')][_0xda3f('0x2e')][_0xda3f('0x4a')]()),_0x22d778);return respondWithRpcPromise('Reload','update',{'module':_0xda3f('0x4b')});}})['then'](function(_0x17acca){if(_0x17acca){return _0x462f64;}return null;})['then'](respondWithResult(_0x214528,null))['catch'](handleError(_0x214528,null));};exports['destroy']=function(_0x40b980,_0x46d54a){var _0x369a16;return db[_0xda3f('0x31')]['find']({'where':{'id':_0x40b980[_0xda3f('0x4d')]['id']}})[_0xda3f('0x8')](function(_0x18897b){_0x369a16=_0x18897b;return _0x18897b;})['then'](handleEntityNotFound(_0x46d54a,null))['then'](removeEntity(_0x46d54a,null))['then'](function(){if(_0x369a16){return db[_0xda3f('0x31')][_0xda3f('0x4e')]({'where':{'type':_0x369a16[_0xda3f('0x2e')]},'raw':!![]});}})[_0xda3f('0x8')](function(_0x3e5fa6){if(_0x369a16[_0xda3f('0x2e')][_0xda3f('0x3a')]()==_0xda3f('0x3b')){var _0x5dc21f=fs[_0xda3f('0x3c')](path[_0xda3f('0x3d')](config[_0xda3f('0x44')],_0xda3f('0x3e')),'utf8');var _0x2268ce=ejs[_0xda3f('0x40')](_0x5dc21f,{'networks':_0x3e5fa6||[]});fs[_0xda3f('0x41')](_0xda3f('0x4f'),_0x2268ce);return respondWithRpcPromise(_0xda3f('0x46'),_0xda3f('0x19'),{'module':_0xda3f('0x42')});}else if(_0x369a16[_0xda3f('0x2e')][_0xda3f('0x3a')]()==_0xda3f('0x43')){var _0x495a4e=fs[_0xda3f('0x3c')](path[_0xda3f('0x3d')](config[_0xda3f('0x44')],_0xda3f('0x50')),'utf8');var _0x409fa4=ejs['render'](_0x495a4e,{'networks':_0x3e5fa6||[]});fs[_0xda3f('0x41')](_0xda3f('0x45'),_0x409fa4);return respondWithRpcPromise(_0xda3f('0x46'),'destroy',{'module':_0xda3f('0x42')});}else{var _0x3f522d=fs[_0xda3f('0x3c')](path[_0xda3f('0x3d')](config['root'],_0xda3f('0x47')),'utf8');var _0x20a9ea=ejs[_0xda3f('0x40')](_0x3f522d,{'networks':_0x3e5fa6||[]});fs[_0xda3f('0x41')](util[_0xda3f('0x48')]('/etc/asterisk/sip_xcally_%s.conf',_0x369a16[_0xda3f('0x2e')]['toLowerCase']()),_0x20a9ea);return respondWithRpcPromise(_0xda3f('0x46'),'destroy',{'module':_0xda3f('0x4b')});}})[_0xda3f('0x10')](handleError(_0x46d54a,null));}; \ No newline at end of file +var _0x64fe=['server/files/templates/stun_multiple.ejs','/etc/asterisk/stun_xcally.conf','TURN','server/files/templates/turn_multiple.ejs','res_stun_monitor.so','destroy','util','path','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','http','request','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','undefined','limit','count','offset','set','Content-Range','update','then','end','stack','name','index','map','Network','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','include','findAll','rows','show','params','keys','includeAll','options','find','create','body','toUpperCase','readFileSync','join','root','utf8','writeFileSync','render','/etc/asterisk/turn_xcally.conf','Reload','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','STUN'];(function(_0x497880,_0x430dbc){var _0x1a3d4b=function(_0x25d7e1){while(--_0x25d7e1){_0x497880['push'](_0x497880['shift']());}};_0x1a3d4b(++_0x430dbc);}(_0x64fe,0x111));var _0xe64f=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x64fe[_0x110c3d];return _0x226d67;};'use strict';var util=require(_0xe64f('0x0'));var path=require(_0xe64f('0x1'));var ejs=require(_0xe64f('0x2'));var fs=require('fs');var _=require(_0xe64f('0x3'));var qs=require(_0xe64f('0x4'));var logger=require(_0xe64f('0x5'))(_0xe64f('0x6'));var config=require(_0xe64f('0x7'));var db=require(_0xe64f('0x8'))['db'];var jayson=require(_0xe64f('0x9'));var client=jayson['client'][_0xe64f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a7fd9,_0x4f87b3,_0x28b549,_0x359e0d){return new Promise(function(_0x24be68,_0x36a92e){var _0x4bcfe6=_0x359e0d||client;return _0x4bcfe6[_0xe64f('0xb')](_0x1a7fd9,_0x28b549)['then'](function(_0x4f3d09){logger[_0xe64f('0xc')](_0xe64f('0xd'),_0x4f87b3,_0xe64f('0xe'));logger[_0xe64f('0xf')](_0xe64f('0x10'),_0x4f87b3,_0xe64f('0xe'),JSON[_0xe64f('0x11')](_0x4f3d09));if(_0x4f3d09[_0xe64f('0x12')]){if(_0x4f3d09[_0xe64f('0x12')][_0xe64f('0x13')]===0x1f4){logger[_0xe64f('0x12')](_0xe64f('0xd'),_0x4f87b3,_0x4f3d09[_0xe64f('0x12')][_0xe64f('0x14')]);return _0x36a92e(_0x4f3d09['error']['message']);}logger[_0xe64f('0x12')](_0xe64f('0xd'),_0x4f87b3,_0x4f3d09[_0xe64f('0x12')][_0xe64f('0x14')]);return _0x24be68(_0x4f3d09[_0xe64f('0x12')][_0xe64f('0x14')]);}else{logger[_0xe64f('0xc')](_0xe64f('0xd'),_0x4f87b3,_0xe64f('0xe'));_0x24be68(_0x4f3d09[_0xe64f('0x15')][_0xe64f('0x14')]);}})[_0xe64f('0x16')](function(_0x517eac){logger[_0xe64f('0x12')](_0xe64f('0xd'),_0x4f87b3,_0x517eac);_0x36a92e(_0x517eac);});});}function respondWithResult(_0x1ed2bf,_0xdbfcbf){_0xdbfcbf=_0xdbfcbf||0xc8;return function(_0x32a90e){if(_0x32a90e){return _0x1ed2bf[_0xe64f('0x17')](_0xdbfcbf)[_0xe64f('0x18')](_0x32a90e);}};}function respondWithFilteredResult(_0x3dac5b,_0x4f162d){return function(_0x496f35){if(_0x496f35){var _0x212744=typeof _0x4f162d['offset']===_0xe64f('0x19')&&typeof _0x4f162d[_0xe64f('0x1a')]===_0xe64f('0x19');var _0x2b6b36=_0x496f35[_0xe64f('0x1b')];var _0x4b41a5=_0x212744?0x0:_0x4f162d[_0xe64f('0x1c')];var _0x497cf3=_0x212744?_0x496f35['count']:_0x4f162d[_0xe64f('0x1c')]+_0x4f162d[_0xe64f('0x1a')];var _0x146c05;if(_0x497cf3>=_0x2b6b36){_0x497cf3=_0x2b6b36;_0x146c05=0xc8;}else{_0x146c05=0xce;}_0x3dac5b[_0xe64f('0x17')](_0x146c05);return _0x3dac5b[_0xe64f('0x1d')](_0xe64f('0x1e'),_0x4b41a5+'-'+_0x497cf3+'/'+_0x2b6b36)['json'](_0x496f35);}return null;};}function saveUpdates(_0x55400c){return function(_0x51906a){if(_0x51906a){return _0x51906a[_0xe64f('0x1f')](_0x55400c)[_0xe64f('0x20')](function(_0x1f5fdc){return _0x1f5fdc;});}return null;};}function removeEntity(_0x3083c2){return function(_0x2dc6b3){if(_0x2dc6b3){return _0x2dc6b3['destroy']()[_0xe64f('0x20')](function(){_0x3083c2[_0xe64f('0x17')](0xcc)[_0xe64f('0x21')]();});}};}function handleEntityNotFound(_0x1a86da){return function(_0x1c4f4a){if(!_0x1c4f4a){_0x1a86da['sendStatus'](0x194);}return _0x1c4f4a;};}function handleError(_0x18350e,_0x4d9361){_0x4d9361=_0x4d9361||0x1f4;return function(_0x40e66f){logger[_0xe64f('0x12')](_0x40e66f[_0xe64f('0x22')]);if(_0x40e66f[_0xe64f('0x23')]){delete _0x40e66f['name'];}_0x18350e[_0xe64f('0x17')](_0x4d9361)['send'](_0x40e66f);};}exports[_0xe64f('0x24')]=function(_0x4303fb,_0x1c37b2){var _0x4b2889={},_0xea32e0={},_0x2e30f9={'count':0x0,'rows':[]};var _0x4a28fe=_[_0xe64f('0x25')](db[_0xe64f('0x26')][_0xe64f('0x27')],function(_0x37bb95){return{'name':_0x37bb95[_0xe64f('0x28')],'type':_0x37bb95[_0xe64f('0x29')][_0xe64f('0x2a')]};});_0xea32e0[_0xe64f('0x2b')]=_[_0xe64f('0x25')](_0x4a28fe,'name');_0xea32e0[_0xe64f('0x2c')]=_['keys'](_0x4303fb[_0xe64f('0x2c')]);_0xea32e0[_0xe64f('0x2d')]=_[_0xe64f('0x2e')](_0xea32e0[_0xe64f('0x2b')],_0xea32e0[_0xe64f('0x2c')]);_0x4b2889['attributes']=_['intersection'](_0xea32e0[_0xe64f('0x2b')],qs[_0xe64f('0x2f')](_0x4303fb[_0xe64f('0x2c')][_0xe64f('0x2f')]));_0x4b2889['attributes']=_0x4b2889[_0xe64f('0x30')][_0xe64f('0x31')]?_0x4b2889[_0xe64f('0x30')]:_0xea32e0[_0xe64f('0x2b')];if(!_0x4303fb[_0xe64f('0x2c')][_0xe64f('0x32')]('nolimit')){_0x4b2889[_0xe64f('0x1a')]=qs[_0xe64f('0x1a')](_0x4303fb['query'][_0xe64f('0x1a')]);_0x4b2889[_0xe64f('0x1c')]=qs[_0xe64f('0x1c')](_0x4303fb[_0xe64f('0x2c')][_0xe64f('0x1c')]);}_0x4b2889[_0xe64f('0x33')]=qs['sort'](_0x4303fb[_0xe64f('0x2c')][_0xe64f('0x34')]);_0x4b2889[_0xe64f('0x35')]=qs[_0xe64f('0x2d')](_['pick'](_0x4303fb[_0xe64f('0x2c')],_0xea32e0[_0xe64f('0x2d')]),_0x4a28fe);if(_0x4303fb[_0xe64f('0x2c')][_0xe64f('0x36')]){_0x4b2889[_0xe64f('0x35')]=_[_0xe64f('0x37')](_0x4b2889[_0xe64f('0x35')],{'$or':_[_0xe64f('0x25')](_0x4a28fe,function(_0x3b545e){if(_0x3b545e[_0xe64f('0x29')]!==_0xe64f('0x38')){var _0x1ce453={};_0x1ce453[_0x3b545e['name']]={'$like':'%'+_0x4303fb[_0xe64f('0x2c')][_0xe64f('0x36')]+'%'};return _0x1ce453;}})});}_0x4b2889=_['merge']({},_0x4b2889,_0x4303fb['options']);var _0x14dd1a={'where':_0x4b2889[_0xe64f('0x35')]};return db[_0xe64f('0x26')][_0xe64f('0x1b')](_0x14dd1a)[_0xe64f('0x20')](function(_0x456ca1){_0x2e30f9[_0xe64f('0x1b')]=_0x456ca1;if(_0x4303fb[_0xe64f('0x2c')]['includeAll']){_0x4b2889[_0xe64f('0x39')]=[{'all':!![]}];}return db[_0xe64f('0x26')][_0xe64f('0x3a')](_0x4b2889);})[_0xe64f('0x20')](function(_0x4c080e){_0x2e30f9[_0xe64f('0x3b')]=_0x4c080e;return _0x2e30f9;})[_0xe64f('0x20')](respondWithFilteredResult(_0x1c37b2,_0x4b2889))[_0xe64f('0x16')](handleError(_0x1c37b2,null));};exports[_0xe64f('0x3c')]=function(_0x56b643,_0x17a9a2){var _0xb6e818={'raw':!![],'where':{'id':_0x56b643[_0xe64f('0x3d')]['id']}},_0x393c33={};_0x393c33[_0xe64f('0x2b')]=_[_0xe64f('0x3e')](db[_0xe64f('0x26')]['rawAttributes']);_0x393c33[_0xe64f('0x2c')]=_[_0xe64f('0x3e')](_0x56b643[_0xe64f('0x2c')]);_0x393c33[_0xe64f('0x2d')]=_['intersection'](_0x393c33[_0xe64f('0x2b')],_0x393c33[_0xe64f('0x2c')]);_0xb6e818['attributes']=_[_0xe64f('0x2e')](_0x393c33[_0xe64f('0x2b')],qs[_0xe64f('0x2f')](_0x56b643[_0xe64f('0x2c')][_0xe64f('0x2f')]));_0xb6e818[_0xe64f('0x30')]=_0xb6e818[_0xe64f('0x30')]['length']?_0xb6e818[_0xe64f('0x30')]:_0x393c33[_0xe64f('0x2b')];if(_0x56b643[_0xe64f('0x2c')][_0xe64f('0x3f')]){_0xb6e818['include']=[{'all':!![]}];}_0xb6e818=_[_0xe64f('0x37')]({},_0xb6e818,_0x56b643[_0xe64f('0x40')]);return db[_0xe64f('0x26')][_0xe64f('0x41')](_0xb6e818)[_0xe64f('0x20')](handleEntityNotFound(_0x17a9a2,null))[_0xe64f('0x20')](respondWithResult(_0x17a9a2,null))[_0xe64f('0x16')](handleError(_0x17a9a2,null));};exports[_0xe64f('0x42')]=function(_0xe11a0a,_0x362227){var _0x394f98;return db[_0xe64f('0x26')][_0xe64f('0x42')](_0xe11a0a['body'],{'raw':!![]})[_0xe64f('0x20')](function(_0x38e5e3){_0x394f98=_0x38e5e3;return db[_0xe64f('0x26')][_0xe64f('0x3a')]({'where':{'type':_0xe11a0a[_0xe64f('0x43')][_0xe64f('0x29')]},'raw':!![]});})['then'](function(_0x634157){if(_0x394f98['type'][_0xe64f('0x44')]()=='STUN'){var _0x51da7a=fs[_0xe64f('0x45')](path[_0xe64f('0x46')](config[_0xe64f('0x47')],'server/files/templates/stun_multiple.ejs'),_0xe64f('0x48'));var _0x796c1a=ejs['render'](_0x51da7a,{'networks':_0x634157||[]});fs[_0xe64f('0x49')]('/etc/asterisk/stun_xcally.conf',_0x796c1a);return respondWithRpcPromise('Reload',_0xe64f('0x42'),{'module':'res_stun_monitor.so'});}else if(_0x394f98[_0xe64f('0x29')][_0xe64f('0x44')]()=='TURN'){var _0x4e6cd1=fs[_0xe64f('0x45')](path[_0xe64f('0x46')](config[_0xe64f('0x47')],'server/files/templates/turn_multiple.ejs'),_0xe64f('0x48'));var _0x559422=ejs[_0xe64f('0x4a')](_0x4e6cd1,{'networks':_0x634157||[]});fs['writeFileSync'](_0xe64f('0x4b'),_0x559422);return respondWithRpcPromise(_0xe64f('0x4c'),_0xe64f('0x42'),{'module':'res_stun_monitor.so'});}else{var _0x592288=fs[_0xe64f('0x45')](path[_0xe64f('0x46')](config['root'],_0xe64f('0x4d')),_0xe64f('0x48'));var _0xcfd019=ejs[_0xe64f('0x4a')](_0x592288,{'networks':_0x634157||[]});fs['writeFileSync'](util[_0xe64f('0x4e')](_0xe64f('0x4f'),_0xe11a0a[_0xe64f('0x43')][_0xe64f('0x29')][_0xe64f('0x50')]()),_0xcfd019);return respondWithRpcPromise(_0xe64f('0x4c'),_0xe64f('0x42'),{'module':_0xe64f('0x51')});}})[_0xe64f('0x20')](function(){return _0x394f98;})['then'](respondWithResult(_0x362227,0xc9))[_0xe64f('0x16')](handleError(_0x362227,null));};exports[_0xe64f('0x1f')]=function(_0x252a05,_0x382f4e){var _0xf01263;return db[_0xe64f('0x26')]['find']({'where':{'id':_0x252a05[_0xe64f('0x3d')]['id']}})[_0xe64f('0x20')](handleEntityNotFound(_0x382f4e,null))[_0xe64f('0x20')](saveUpdates(_0x252a05[_0xe64f('0x43')],null))[_0xe64f('0x20')](function(_0x118560){if(_0x118560){_0xf01263=_0x118560;return db[_0xe64f('0x26')]['findAll']({'where':{'type':_0xf01263[_0xe64f('0x29')]},'raw':!![]});}return null;})[_0xe64f('0x20')](function(_0x53916e){if(_0xf01263[_0xe64f('0x29')][_0xe64f('0x44')]()==_0xe64f('0x52')){var _0x281523=fs[_0xe64f('0x45')](path[_0xe64f('0x46')](config[_0xe64f('0x47')],_0xe64f('0x53')),_0xe64f('0x48'));var _0x53fd0d=ejs[_0xe64f('0x4a')](_0x281523,{'networks':_0x53916e||[]});fs[_0xe64f('0x49')](_0xe64f('0x54'),_0x53fd0d);return respondWithRpcPromise(_0xe64f('0x4c'),_0xe64f('0x1f'),{'module':'res_stun_monitor.so'});}else if(_0xf01263['type'][_0xe64f('0x44')]()==_0xe64f('0x55')){var _0x2f3bcf=fs[_0xe64f('0x45')](path[_0xe64f('0x46')](config['root'],_0xe64f('0x56')),'utf8');var _0x367a9b=ejs[_0xe64f('0x4a')](_0x2f3bcf,{'networks':_0x53916e||[]});fs[_0xe64f('0x49')](_0xe64f('0x4b'),_0x367a9b);return respondWithRpcPromise(_0xe64f('0x4c'),_0xe64f('0x1f'),{'module':_0xe64f('0x57')});}else{var _0x8d8329=fs[_0xe64f('0x45')](path[_0xe64f('0x46')](config['root'],_0xe64f('0x4d')),'utf8');var _0x1ded5d=ejs[_0xe64f('0x4a')](_0x8d8329,{'networks':_0x53916e||[]});fs[_0xe64f('0x49')](util[_0xe64f('0x4e')](_0xe64f('0x4f'),_0x252a05[_0xe64f('0x43')][_0xe64f('0x29')][_0xe64f('0x50')]()),_0x1ded5d);return respondWithRpcPromise(_0xe64f('0x4c'),_0xe64f('0x1f'),{'module':_0xe64f('0x51')});}})[_0xe64f('0x20')](function(_0x2736e5){if(_0x2736e5){return _0xf01263;}return null;})['then'](respondWithResult(_0x382f4e,null))[_0xe64f('0x16')](handleError(_0x382f4e,null));};exports[_0xe64f('0x58')]=function(_0x3d582f,_0x173c27){var _0x1640de;return db['Network']['find']({'where':{'id':_0x3d582f['params']['id']}})[_0xe64f('0x20')](function(_0x3c207e){_0x1640de=_0x3c207e;return _0x3c207e;})[_0xe64f('0x20')](handleEntityNotFound(_0x173c27,null))[_0xe64f('0x20')](removeEntity(_0x173c27,null))[_0xe64f('0x20')](function(){if(_0x1640de){return db['Network'][_0xe64f('0x3a')]({'where':{'type':_0x1640de['type']},'raw':!![]});}})['then'](function(_0x374cb3){if(_0x1640de[_0xe64f('0x29')][_0xe64f('0x44')]()==_0xe64f('0x52')){var _0x33ed8e=fs[_0xe64f('0x45')](path['join'](config[_0xe64f('0x47')],_0xe64f('0x53')),_0xe64f('0x48'));var _0x9e2974=ejs[_0xe64f('0x4a')](_0x33ed8e,{'networks':_0x374cb3||[]});fs[_0xe64f('0x49')](_0xe64f('0x54'),_0x9e2974);return respondWithRpcPromise(_0xe64f('0x4c'),_0xe64f('0x58'),{'module':_0xe64f('0x57')});}else if(_0x1640de['type'][_0xe64f('0x44')]()==_0xe64f('0x55')){var _0x2247a0=fs[_0xe64f('0x45')](path['join'](config['root'],'server/files/templates/turn_multiple.ejs'),_0xe64f('0x48'));var _0x4a1544=ejs[_0xe64f('0x4a')](_0x2247a0,{'networks':_0x374cb3||[]});fs[_0xe64f('0x49')](_0xe64f('0x4b'),_0x4a1544);return respondWithRpcPromise(_0xe64f('0x4c'),_0xe64f('0x58'),{'module':_0xe64f('0x57')});}else{var _0x1a8b17=fs[_0xe64f('0x45')](path[_0xe64f('0x46')](config[_0xe64f('0x47')],_0xe64f('0x4d')),_0xe64f('0x48'));var _0x18ddf9=ejs[_0xe64f('0x4a')](_0x1a8b17,{'networks':_0x374cb3||[]});fs[_0xe64f('0x49')](util[_0xe64f('0x4e')]('/etc/asterisk/sip_xcally_%s.conf',_0x1640de[_0xe64f('0x29')][_0xe64f('0x50')]()),_0x18ddf9);return respondWithRpcPromise(_0xe64f('0x4c'),'destroy',{'module':'chan_sip.so'});}})[_0xe64f('0x16')](handleError(_0x173c27,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 1642fba..a95e91f 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 _0x3140=['../../config/environment','./network.attributes','exports','define','Network','network','lodash','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x3fab82,_0x2dc357){var _0x52839a=function(_0x194b44){while(--_0x194b44){_0x3fab82['push'](_0x3fab82['shift']());}};_0x52839a(++_0x2dc357);}(_0x3140,0xaf));var _0x0314=function(_0x469a3c,_0x5ebc10){_0x469a3c=_0x469a3c-0x0;var _0x968f4=_0x3140[_0x469a3c];return _0x968f4;};'use strict';var _=require(_0x0314('0x0'));var util=require(_0x0314('0x1'));var logger=require(_0x0314('0x2'))(_0x0314('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0314('0x4'));var fs=require('fs');var path=require(_0x0314('0x5'));var rimraf=require(_0x0314('0x6'));var config=require(_0x0314('0x7'));var attributes=require(_0x0314('0x8'));module[_0x0314('0x9')]=function(_0x9e308d,_0xf87d26){return _0x9e308d[_0x0314('0xa')](_0x0314('0xb'),attributes,{'tableName':_0x0314('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f68=['Network','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports'];(function(_0x623e7,_0x1bef7d){var _0x121131=function(_0x59b734){while(--_0x59b734){_0x623e7['push'](_0x623e7['shift']());}};_0x121131(++_0x1bef7d);}(_0x2f68,0x9a));var _0x82f6=function(_0x559694,_0x4cd7b3){_0x559694=_0x559694-0x0;var _0x2dcf7d=_0x2f68[_0x559694];return _0x2dcf7d;};'use strict';var _=require('lodash');var util=require(_0x82f6('0x0'));var logger=require(_0x82f6('0x1'))(_0x82f6('0x2'));var moment=require(_0x82f6('0x3'));var BPromise=require('bluebird');var rp=require(_0x82f6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x82f6('0x5'));var config=require(_0x82f6('0x6'));var attributes=require('./network.attributes');module[_0x82f6('0x7')]=function(_0x2c4302,_0x542737){return _0x2c4302['define'](_0x82f6('0x8'),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 8e45e4c..ef01c47 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(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x343fb9,_0x215ad0){_0x343fb9=_0x343fb9-0x0;var _0x3c9c0d=_0x7a54[_0x343fb9];return _0x3c9c0d;};'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(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x24dde3,_0x56e89a){_0x24dde3=_0x24dde3-0x0;var _0x4bbc0f=_0x7a54[_0x24dde3];return _0x4bbc0f;};'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 1f37faf..eefd250 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 _0x7cb6=['/:id/interactions','getInteractions','/:id/users','create','post','addAnswer','/:id/notify','notify','addApplications','send','put','update','delete','destroy','/:id/dispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','isAuthenticated','index','get','/:id','show','getDispositions','/:id/canned_answers','/:id/applications','getApplications'];(function(_0x432385,_0x5b7a37){var _0x204192=function(_0x2feba8){while(--_0x2feba8){_0x432385['push'](_0x432385['shift']());}};_0x204192(++_0x5b7a37);}(_0x7cb6,0x188));var _0x67cb=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x7cb6[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0x67cb('0x0'));var util=require('util');var path=require(_0x67cb('0x1'));var timeout=require(_0x67cb('0x2'));var express=require(_0x67cb('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x67cb('0x4'));var interaction=require(_0x67cb('0x5'));var config=require('../../config/environment');var controller=require(_0x67cb('0x6'));router['get']('/',auth[_0x67cb('0x7')](),controller[_0x67cb('0x8')]);router[_0x67cb('0x9')]('/describe',auth[_0x67cb('0x7')](),controller['describe']);router[_0x67cb('0x9')](_0x67cb('0xa'),auth[_0x67cb('0x7')](),controller[_0x67cb('0xb')]);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x67cb('0xc')]);router['get'](_0x67cb('0xd'),auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x67cb('0xe'),auth[_0x67cb('0x7')](),controller[_0x67cb('0xf')]);router[_0x67cb('0x9')](_0x67cb('0x10'),auth[_0x67cb('0x7')](),controller[_0x67cb('0x11')]);router[_0x67cb('0x9')](_0x67cb('0x12'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth[_0x67cb('0x7')](),controller[_0x67cb('0x13')]);router[_0x67cb('0x14')]('/:id/dispositions',auth[_0x67cb('0x7')](),controller['addDisposition']);router['post'](_0x67cb('0xd'),auth[_0x67cb('0x7')](),controller[_0x67cb('0x15')]);router[_0x67cb('0x14')](_0x67cb('0x16'),controller[_0x67cb('0x17')]);router[_0x67cb('0x14')](_0x67cb('0xe'),auth[_0x67cb('0x7')](),controller[_0x67cb('0x18')]);router['post'](_0x67cb('0x12'),auth['isAuthenticated'](),controller['addAgents']);router[_0x67cb('0x14')]('/:id/send',auth['isAuthenticated'](),controller[_0x67cb('0x19')]);router[_0x67cb('0x1a')](_0x67cb('0xa'),auth[_0x67cb('0x7')](),controller[_0x67cb('0x1b')]);router[_0x67cb('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0x67cb('0x1d')]);router['delete'](_0x67cb('0x1e'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x67cb('0x1c')](_0x67cb('0xd'),auth[_0x67cb('0x7')](),controller[_0x67cb('0x1f')]);router[_0x67cb('0x1c')](_0x67cb('0x12'),auth[_0x67cb('0x7')](),controller[_0x67cb('0x20')]);module[_0x67cb('0x21')]=router; \ No newline at end of file +var _0x94a8=['show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','/:id/notify','notify','addApplications','addAgents','/:id/send','send','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x3fbfd8,_0x50fd0f){var _0x2fe839=function(_0x4634d5){while(--_0x4634d5){_0x3fbfd8['push'](_0x3fbfd8['shift']());}};_0x2fe839(++_0x50fd0f);}(_0x94a8,0x64));var _0x894a=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x94a8[_0x45e98e];return _0x374dba;};'use strict';var multer=require(_0x894a('0x0'));var util=require(_0x894a('0x1'));var path=require(_0x894a('0x2'));var timeout=require('connect-timeout');var express=require(_0x894a('0x3'));var router=express[_0x894a('0x4')]();var fs_extra=require(_0x894a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x894a('0x6'));var config=require('../../config/environment');var controller=require(_0x894a('0x7'));router[_0x894a('0x8')]('/',auth[_0x894a('0x9')](),controller[_0x894a('0xa')]);router[_0x894a('0x8')](_0x894a('0xb'),auth['isAuthenticated'](),controller[_0x894a('0xc')]);router[_0x894a('0x8')](_0x894a('0xd'),auth[_0x894a('0x9')](),controller[_0x894a('0xe')]);router['get'](_0x894a('0xf'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x894a('0x8')](_0x894a('0x10'),auth['isAuthenticated'](),controller[_0x894a('0x11')]);router[_0x894a('0x8')](_0x894a('0x12'),auth[_0x894a('0x9')](),controller[_0x894a('0x13')]);router[_0x894a('0x8')](_0x894a('0x14'),auth[_0x894a('0x9')](),controller[_0x894a('0x15')]);router[_0x894a('0x8')](_0x894a('0x16'),auth[_0x894a('0x9')](),controller[_0x894a('0x17')]);router[_0x894a('0x18')]('/',auth['isAuthenticated'](),controller['create']);router[_0x894a('0x18')](_0x894a('0xf'),auth[_0x894a('0x9')](),controller['addDisposition']);router[_0x894a('0x18')](_0x894a('0x10'),auth[_0x894a('0x9')](),controller['addAnswer']);router[_0x894a('0x18')](_0x894a('0x19'),controller[_0x894a('0x1a')]);router[_0x894a('0x18')]('/:id/applications',auth['isAuthenticated'](),controller[_0x894a('0x1b')]);router[_0x894a('0x18')](_0x894a('0x16'),auth[_0x894a('0x9')](),controller[_0x894a('0x1c')]);router['post'](_0x894a('0x1d'),auth[_0x894a('0x9')](),controller[_0x894a('0x1e')]);router[_0x894a('0x1f')](_0x894a('0xd'),auth[_0x894a('0x9')](),controller['update']);router[_0x894a('0x20')](_0x894a('0xd'),auth[_0x894a('0x9')](),controller[_0x894a('0x21')]);router[_0x894a('0x20')](_0x894a('0xf'),auth[_0x894a('0x9')](),controller[_0x894a('0x22')]);router[_0x894a('0x20')](_0x894a('0x10'),auth['isAuthenticated'](),controller[_0x894a('0x23')]);router[_0x894a('0x20')]('/:id/users',auth[_0x894a('0x9')](),controller[_0x894a('0x24')]);module[_0x894a('0x25')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 340a797..9a29f4b 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 _0x926c=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x15af16,_0x357799){var _0x1a3650=function(_0x3594cf){while(--_0x3594cf){_0x15af16['push'](_0x15af16['shift']());}};_0x1a3650(++_0x357799);}(_0x926c,0x166));var _0xc926=function(_0x247f19,_0x419bd5){_0x247f19=_0x247f19-0x0;var _0x554ef6=_0x926c[_0x247f19];return _0x554ef6;};'use strict';var Sequelize=require(_0xc926('0x0'));var rs=require(_0xc926('0x1'));module['exports']={'name':{'type':Sequelize[_0xc926('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xc926('0x2')]},'token':{'type':Sequelize[_0xc926('0x2')],'defaultValue':function(){return rs[_0xc926('0x3')]();}},'replyUri':{'type':Sequelize[_0xc926('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xc926('0x4')],'defaultValue':function(){return _0xc926('0x5');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc926('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc926('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xc926('0x2')]},'queueTransfer':{'type':Sequelize[_0xc926('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc926('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc926('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc926('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc926('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0xc926('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xc926('0x6')],'defaultValue':![],'comment':_0xc926('0x9'),'set':function(_0x4fd2c2){if(!_0x4fd2c2)this['setDataValue'](_0xc926('0xa'),null);this[_0xc926('0xb')](_0xc926('0xc'),_0x4fd2c2);}}}; \ No newline at end of file +var _0x6736=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','TEXT','BOOLEAN','INTEGER'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x6736,0x116));var _0x6673=function(_0x4c78c1,_0x2b84bb){_0x4c78c1=_0x4c78c1-0x0;var _0xfd18c0=_0x6736[_0x4c78c1];return _0xfd18c0;};'use strict';var Sequelize=require(_0x6673('0x0'));var rs=require(_0x6673('0x1'));module[_0x6673('0x2')]={'name':{'type':Sequelize[_0x6673('0x3')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x6673('0x3')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x6673('0x4')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x6673('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x6673('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x6673('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6673('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6673('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x6673('0x3')]},'queueTransfer':{'type':Sequelize[_0x6673('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6673('0x7')],'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[_0x6673('0x7')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x6673('0x8'),'set':function(_0x5a9f37){if(!_0x5a9f37)this[_0x6673('0x9')]('mandatoryDispositionPauseId',null);this[_0x6673('0x9')](_0x6673('0xa'),_0x5a9f37);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 9a27689..5f765e9 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 _0xe43c=['getAgents','out','Messages','spread','dataValues','push','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelAccount,\x20%s,\x20%s','result','catch','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','destroy','get','OpenchannelAccounts','UserProfileResource','end','stack','name','send','index','mandatoryDispositionPause','map','OpenchannelAccount','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','include','rows','show','Pause','keys','rawAttributes','includeAll','options','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','Disposition','findOne','OpenchannelAccountId','merge','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findAll','removeAnswers','openchannel','CmContact','ValidationError','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','OpenchannelApplication','Applications','List','account','applications','list','priority','asc','contact','lastName','threadId','OpenchannelInteraction','messageId','interaction','created','autoclose','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','notify','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xe43c,0x180));var _0xce43=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xe43c[_0x209941];return _0x1e8729;};'use strict';var emlformat=require(_0xce43('0x0'));var rimraf=require(_0xce43('0x1'));var zipdir=require(_0xce43('0x2'));var jsonpatch=require(_0xce43('0x3'));var rp=require(_0xce43('0x4'));var moment=require(_0xce43('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xce43('0x6'));var util=require('util');var path=require(_0xce43('0x7'));var sox=require(_0xce43('0x8'));var csv=require(_0xce43('0x9'));var ejs=require(_0xce43('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xce43('0xb'));var squel=require('squel');var crypto=require(_0xce43('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xce43('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xce43('0xe'));var Redis=require(_0xce43('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xce43('0x10'));var logger=require('../../config/logger')(_0xce43('0x11'));var utils=require('../../config/utils');var config=require(_0xce43('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xce43('0x13'))['db'];config[_0xce43('0x14')]=_[_0xce43('0x15')](config[_0xce43('0x14')],{'host':_0xce43('0x16'),'port':0x18eb});var socket=require(_0xce43('0x17'))(new Redis(config[_0xce43('0x14')]));require('./openchannelAccount.socket')[_0xce43('0x18')](socket);var jayson=require(_0xce43('0x19'));var client=jayson[_0xce43('0x1a')][_0xce43('0x1b')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c0948,_0x3e4218,_0x2eb70b,_0x2a9cb4){return new BPromise(function(_0xd5282,_0x3f79bd){var _0x4e166b=_0x2a9cb4||client;return _0x4e166b[_0xce43('0x1c')](_0x3c0948,_0x2eb70b)[_0xce43('0x1d')](function(_0xbc38f0){logger[_0xce43('0x1e')]('OpenchannelAccount,\x20%s,\x20%s',_0x3e4218,_0xce43('0x1f'));logger[_0xce43('0x20')](_0xce43('0x21'),_0x3e4218,_0xce43('0x1f'),JSON[_0xce43('0x22')](_0xbc38f0));if(_0xbc38f0[_0xce43('0x23')]){if(_0xbc38f0['error'][_0xce43('0x24')]===0x1f4){logger[_0xce43('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x3e4218,_0xbc38f0[_0xce43('0x23')][_0xce43('0x25')]);return _0x3f79bd(_0xbc38f0[_0xce43('0x23')]['message']);}logger['error'](_0xce43('0x26'),_0x3e4218,_0xbc38f0[_0xce43('0x23')][_0xce43('0x25')]);return _0xd5282(_0xbc38f0[_0xce43('0x23')][_0xce43('0x25')]);}else{logger[_0xce43('0x1e')](_0xce43('0x26'),_0x3e4218,'request\x20sent');_0xd5282(_0xbc38f0[_0xce43('0x27')][_0xce43('0x25')]);}})[_0xce43('0x28')](function(_0x2ae225){logger['error'](_0xce43('0x26'),_0x3e4218,_0x2ae225);_0x3f79bd(_0x2ae225);});});}function respondWithStatusCode(_0x45fec7,_0x117ac1){_0x117ac1=_0x117ac1||0xcc;return function(_0x1bb63f){if(_0x1bb63f){return _0x45fec7[_0xce43('0x29')](_0x117ac1);}return _0x45fec7[_0xce43('0x2a')](_0x117ac1)['end']();};}function respondWithResult(_0x371985,_0x5cb93a){_0x5cb93a=_0x5cb93a||0xc8;return function(_0xe9a34c){if(_0xe9a34c){return _0x371985[_0xce43('0x2a')](_0x5cb93a)[_0xce43('0x2b')](_0xe9a34c);}};}function respondWithFilteredResult(_0x167d5d,_0x536452){return function(_0xb6527c){if(_0xb6527c){var _0x4402f8=typeof _0x536452[_0xce43('0x2c')]===_0xce43('0x2d')&&typeof _0x536452['limit']===_0xce43('0x2d');var _0x345eaf=_0xb6527c['count'];var _0x388279=_0x4402f8?0x0:_0x536452[_0xce43('0x2c')];var _0x124776=_0x4402f8?_0xb6527c[_0xce43('0x2e')]:_0x536452[_0xce43('0x2c')]+_0x536452[_0xce43('0x2f')];var _0x496d25;if(_0x124776>=_0x345eaf){_0x124776=_0x345eaf;_0x496d25=0xc8;}else{_0x496d25=0xce;}_0x167d5d['status'](_0x496d25);return _0x167d5d[_0xce43('0x30')](_0xce43('0x31'),_0x388279+'-'+_0x124776+'/'+_0x345eaf)['json'](_0xb6527c);}return null;};}function patchUpdates(_0x2ebb25){return function(_0x102271){try{jsonpatch[_0xce43('0x32')](_0x102271,_0x2ebb25,!![]);}catch(_0x8e5838){return BPromise[_0xce43('0x33')](_0x8e5838);}return _0x102271['save']();};}function saveUpdates(_0x4b3d12,_0x3072e8){return function(_0x32b5e1){if(_0x32b5e1){return _0x32b5e1[_0xce43('0x34')](_0x4b3d12)[_0xce43('0x1d')](function(_0x107be7){return _0x107be7;});}return null;};}function removeEntity(_0x211252,_0x737b2c){return function(_0x667b99){if(_0x667b99){return _0x667b99[_0xce43('0x35')]()[_0xce43('0x1d')](function(){var _0x391e41=_0x667b99[_0xce43('0x36')]({'plain':!![]});var _0x24a782=_0xce43('0x37');return db[_0xce43('0x38')][_0xce43('0x35')]({'where':{'type':_0x24a782,'resourceId':_0x391e41['id']}})[_0xce43('0x1d')](function(){return _0x667b99;});})['then'](function(){_0x211252[_0xce43('0x2a')](0xcc)[_0xce43('0x39')]();});}};}function handleEntityNotFound(_0x1dd276,_0x3a9a70){return function(_0xe4449e){if(!_0xe4449e){_0x1dd276[_0xce43('0x29')](0x194);}return _0xe4449e;};}function handleError(_0x4a96ae,_0x3f8a5f){_0x3f8a5f=_0x3f8a5f||0x1f4;return function(_0x1af0c2){logger[_0xce43('0x23')](_0x1af0c2[_0xce43('0x3a')]);if(_0x1af0c2[_0xce43('0x3b')]){delete _0x1af0c2['name'];}_0x4a96ae['status'](_0x3f8a5f)[_0xce43('0x3c')](_0x1af0c2);};}exports[_0xce43('0x3d')]=function(_0x5d7d69,_0x338c54){var _0x269d81={'include':[{'model':db['Pause'],'as':_0xce43('0x3e')}]},_0x87477d={},_0x2fcb62={'count':0x0,'rows':[]};var _0x54d6c4=_[_0xce43('0x3f')](db[_0xce43('0x40')]['rawAttributes'],function(_0x30ad29){return{'name':_0x30ad29[_0xce43('0x41')],'type':_0x30ad29[_0xce43('0x42')]['key']};});_0x87477d['model']=_[_0xce43('0x3f')](_0x54d6c4,_0xce43('0x3b'));_0x87477d[_0xce43('0x43')]=_['keys'](_0x5d7d69[_0xce43('0x43')]);_0x87477d[_0xce43('0x44')]=_[_0xce43('0x45')](_0x87477d[_0xce43('0x46')],_0x87477d['query']);_0x269d81[_0xce43('0x47')]=_[_0xce43('0x45')](_0x87477d[_0xce43('0x46')],qs[_0xce43('0x48')](_0x5d7d69[_0xce43('0x43')][_0xce43('0x48')]));_0x269d81[_0xce43('0x47')]=_0x269d81[_0xce43('0x47')][_0xce43('0x49')]?_0x269d81['attributes']:_0x87477d['model'];if(!_0x5d7d69[_0xce43('0x43')][_0xce43('0x4a')](_0xce43('0x4b'))){_0x269d81[_0xce43('0x2f')]=qs[_0xce43('0x2f')](_0x5d7d69[_0xce43('0x43')][_0xce43('0x2f')]);_0x269d81[_0xce43('0x2c')]=qs[_0xce43('0x2c')](_0x5d7d69[_0xce43('0x43')][_0xce43('0x2c')]);}_0x269d81[_0xce43('0x4c')]=qs[_0xce43('0x4d')](_0x5d7d69[_0xce43('0x43')][_0xce43('0x4d')]);_0x269d81[_0xce43('0x4e')]=qs[_0xce43('0x44')](_[_0xce43('0x4f')](_0x5d7d69['query'],_0x87477d[_0xce43('0x44')]),_0x54d6c4);if(_0x5d7d69[_0xce43('0x43')][_0xce43('0x50')]){_0x269d81['where']=_['merge'](_0x269d81[_0xce43('0x4e')],{'$or':_['map'](_0x54d6c4,function(_0x4c13e4){if(_0x4c13e4['type']!=='VIRTUAL'){var _0x3de6ec={};_0x3de6ec[_0x4c13e4[_0xce43('0x3b')]]={'$like':'%'+_0x5d7d69['query'][_0xce43('0x50')]+'%'};return _0x3de6ec;}})});}_0x269d81=_['merge']({},_0x269d81,_0x5d7d69['options']);var _0x451c44={'where':_0x269d81['where']};return db['OpenchannelAccount'][_0xce43('0x2e')](_0x451c44)[_0xce43('0x1d')](function(_0x489aa2){_0x2fcb62['count']=_0x489aa2;if(_0x5d7d69[_0xce43('0x43')]['includeAll']){_0x269d81[_0xce43('0x51')]=[{'all':!![]}];}return db[_0xce43('0x40')]['findAll'](_0x269d81);})[_0xce43('0x1d')](function(_0x2421e3){_0x2fcb62[_0xce43('0x52')]=_0x2421e3;return _0x2fcb62;})[_0xce43('0x1d')](respondWithFilteredResult(_0x338c54,_0x269d81))[_0xce43('0x28')](handleError(_0x338c54,null));};exports[_0xce43('0x53')]=function(_0x3a418f,_0x2d44ac){var _0xc2c210={'raw':![],'where':{'id':_0x3a418f['params']['id']},'include':[{'model':db[_0xce43('0x54')],'as':_0xce43('0x3e')}]},_0x4933ce={};_0x4933ce[_0xce43('0x46')]=_[_0xce43('0x55')](db[_0xce43('0x40')][_0xce43('0x56')]);_0x4933ce['query']=_[_0xce43('0x55')](_0x3a418f[_0xce43('0x43')]);_0x4933ce[_0xce43('0x44')]=_[_0xce43('0x45')](_0x4933ce[_0xce43('0x46')],_0x4933ce[_0xce43('0x43')]);_0xc2c210[_0xce43('0x47')]=_[_0xce43('0x45')](_0x4933ce[_0xce43('0x46')],qs[_0xce43('0x48')](_0x3a418f[_0xce43('0x43')]['fields']));_0xc2c210[_0xce43('0x47')]=_0xc2c210[_0xce43('0x47')][_0xce43('0x49')]?_0xc2c210['attributes']:_0x4933ce[_0xce43('0x46')];if(_0x3a418f[_0xce43('0x43')][_0xce43('0x57')]){_0xc2c210['include']=[{'all':!![]}];}_0xc2c210=_['merge']({},_0xc2c210,_0x3a418f[_0xce43('0x58')]);return db['OpenchannelAccount'][_0xce43('0x59')](_0xc2c210)[_0xce43('0x1d')](handleEntityNotFound(_0x2d44ac,null))[_0xce43('0x1d')](respondWithResult(_0x2d44ac,null))['catch'](handleError(_0x2d44ac,null));};exports['create']=function(_0x5181ba,_0x5aaeeb){return db['OpenchannelAccount']['create'](_0x5181ba[_0xce43('0x5a')],{})[_0xce43('0x1d')](function(_0x1dd2ca){var _0x1acb75=_0x5181ba['user']['get']({'plain':!![]});if(!_0x1acb75)throw new Error(_0xce43('0x5b'));if(_0x1acb75[_0xce43('0x5c')]===_0xce43('0x5d')){var _0x3adb37=_0x1dd2ca['get']({'plain':!![]});var _0x456eec=_0xce43('0x37');return db['UserProfileSection'][_0xce43('0x59')]({'where':{'name':_0x456eec,'userProfileId':_0x1acb75[_0xce43('0x5e')]},'raw':!![]})[_0xce43('0x1d')](function(_0x5f49df){if(_0x5f49df&&_0x5f49df[_0xce43('0x5f')]===0x0){return db[_0xce43('0x38')][_0xce43('0x60')]({'name':_0x3adb37['name'],'resourceId':_0x3adb37['id'],'type':_0x5f49df['name'],'sectionId':_0x5f49df['id']},{})[_0xce43('0x1d')](function(){return _0x1dd2ca;});}else{return _0x1dd2ca;}})['catch'](function(_0x40e11b){logger['error'](_0xce43('0x61'),_0x40e11b);throw _0x40e11b;});}return _0x1dd2ca;})['then'](respondWithResult(_0x5aaeeb,0xc9))['catch'](handleError(_0x5aaeeb,null));};exports[_0xce43('0x34')]=function(_0x4b6956,_0x2b2af4){if(_0x4b6956[_0xce43('0x5a')]['id']){delete _0x4b6956[_0xce43('0x5a')]['id'];}return db[_0xce43('0x40')][_0xce43('0x59')]({'where':{'id':_0x4b6956[_0xce43('0x62')]['id']},'include':[{'model':db[_0xce43('0x54')],'as':_0xce43('0x3e')}]})[_0xce43('0x1d')](handleEntityNotFound(_0x2b2af4,null))[_0xce43('0x1d')](saveUpdates(_0x4b6956[_0xce43('0x5a')],null))['then'](respondWithResult(_0x2b2af4,null))[_0xce43('0x28')](handleError(_0x2b2af4,null));};exports[_0xce43('0x35')]=function(_0x25b2a8,_0x286d08){return db[_0xce43('0x40')][_0xce43('0x59')]({'where':{'id':_0x25b2a8[_0xce43('0x62')]['id']}})[_0xce43('0x1d')](handleEntityNotFound(_0x286d08,null))['then'](removeEntity(_0x286d08,null))['catch'](handleError(_0x286d08,null));};exports[_0xce43('0x63')]=function(_0x2f95f3,_0x55d73e){return db[_0xce43('0x40')]['describe']()['then'](respondWithResult(_0x55d73e,null))[_0xce43('0x28')](handleError(_0x55d73e,null));};exports[_0xce43('0x64')]=function(_0x35db1a,_0x8c3fa2,_0x183829){if(_0x35db1a['body']['id']){delete _0x35db1a[_0xce43('0x5a')]['id'];}return db[_0xce43('0x40')]['find']({'where':{'id':_0x35db1a[_0xce43('0x62')]['id']}})['then'](handleEntityNotFound(_0x8c3fa2,null))[_0xce43('0x1d')](function(_0x31c96e){if(_0x31c96e){_0x35db1a[_0xce43('0x5a')]['OpenchannelAccountId']=_0x31c96e['id'];return db[_0xce43('0x65')]['create'](_0x35db1a[_0xce43('0x5a')]);}})['then'](respondWithResult(_0x8c3fa2,null))[_0xce43('0x28')](handleError(_0x8c3fa2,null));};exports['getDispositions']=function(_0x4ac1d6,_0x529656,_0x259320){var _0x502cdf={'raw':![],'where':{}};var _0x4c8861={};var _0x2d0587={'count':0x0,'rows':[]};return db[_0xce43('0x40')][_0xce43('0x66')]({'where':{'id':_0x4ac1d6['params']['id']}})[_0xce43('0x1d')](handleEntityNotFound(_0x529656,null))[_0xce43('0x1d')](function(_0x215892){if(_0x215892){_0x4c8861[_0xce43('0x46')]=_['keys'](db['Disposition'][_0xce43('0x56')]);_0x4c8861[_0xce43('0x43')]=_[_0xce43('0x55')](_0x4ac1d6[_0xce43('0x43')]);_0x4c8861['filters']=_[_0xce43('0x45')](_0x4c8861[_0xce43('0x46')],_0x4c8861['query']);_0x502cdf[_0xce43('0x47')]=_['intersection'](_0x4c8861[_0xce43('0x46')],qs[_0xce43('0x48')](_0x4ac1d6[_0xce43('0x43')][_0xce43('0x48')]));_0x502cdf[_0xce43('0x47')]=_0x502cdf[_0xce43('0x47')][_0xce43('0x49')]?_0x502cdf[_0xce43('0x47')]:_0x4c8861[_0xce43('0x46')];if(!_0x4ac1d6[_0xce43('0x43')][_0xce43('0x4a')](_0xce43('0x4b'))){_0x502cdf[_0xce43('0x2f')]=qs[_0xce43('0x2f')](_0x4ac1d6['query']['limit']);_0x502cdf[_0xce43('0x2c')]=qs[_0xce43('0x2c')](_0x4ac1d6[_0xce43('0x43')]['offset']);}_0x502cdf[_0xce43('0x4c')]=qs['sort'](_0x4ac1d6[_0xce43('0x43')][_0xce43('0x4d')]);_0x502cdf['where']=qs[_0xce43('0x44')](_[_0xce43('0x4f')](_0x4ac1d6['query'],_0x4c8861[_0xce43('0x44')]));_0x502cdf['where'][_0xce43('0x67')]=_0x215892['id'];if(_0x4ac1d6[_0xce43('0x43')][_0xce43('0x50')]){_0x502cdf[_0xce43('0x4e')]=_[_0xce43('0x68')](_0x502cdf[_0xce43('0x4e')],{'$or':_[_0xce43('0x3f')](_0x502cdf[_0xce43('0x47')],function(_0x393552){var _0x3c1c6d={};_0x3c1c6d[_0x393552]={'$like':'%'+_0x4ac1d6[_0xce43('0x43')]['filter']+'%'};return _0x3c1c6d;})});}_0x502cdf=_['merge']({},_0x502cdf,_0x4ac1d6['options']);return db[_0xce43('0x65')][_0xce43('0x2e')]({'where':_0x502cdf[_0xce43('0x4e')]})[_0xce43('0x1d')](function(_0x334e78){_0x2d0587[_0xce43('0x2e')]=_0x334e78;if(_0x4ac1d6[_0xce43('0x43')][_0xce43('0x57')]){_0x502cdf[_0xce43('0x51')]=[{'all':!![]}];}return db[_0xce43('0x65')]['findAll'](_0x502cdf);})[_0xce43('0x1d')](function(_0x4f09da){_0x2d0587['rows']=_0x4f09da;return _0x2d0587;});}})[_0xce43('0x1d')](respondWithFilteredResult(_0x529656,_0x502cdf))[_0xce43('0x28')](handleError(_0x529656,null));};exports[_0xce43('0x69')]=function(_0x268cba,_0x34609a,_0x4188e8){return db[_0xce43('0x40')][_0xce43('0x59')]({'where':{'id':_0x268cba[_0xce43('0x62')]['id']}})[_0xce43('0x1d')](handleEntityNotFound(_0x34609a,null))[_0xce43('0x1d')](function(_0x46c2b2){if(_0x46c2b2){return _0x46c2b2[_0xce43('0x69')](_0x268cba['query'][_0xce43('0x6a')]);}})[_0xce43('0x1d')](respondWithStatusCode(_0x34609a,null))['catch'](handleError(_0x34609a,null));};exports[_0xce43('0x6b')]=function(_0x213c62,_0x8d10df,_0x591e91){if(_0x213c62[_0xce43('0x5a')]['id']){delete _0x213c62[_0xce43('0x5a')]['id'];}return db[_0xce43('0x40')][_0xce43('0x59')]({'where':{'id':_0x213c62['params']['id']}})['then'](handleEntityNotFound(_0x8d10df,null))[_0xce43('0x1d')](function(_0x120bcd){if(_0x120bcd){_0x213c62[_0xce43('0x5a')][_0xce43('0x67')]=_0x120bcd['id'];return db[_0xce43('0x6c')][_0xce43('0x60')](_0x213c62[_0xce43('0x5a')]);}})['then'](respondWithResult(_0x8d10df,null))[_0xce43('0x28')](handleError(_0x8d10df,null));};exports[_0xce43('0x6d')]=function(_0x33881f,_0x3fe1f8,_0x18cefb){var _0x58f5fd={'raw':![],'where':{}};var _0x12dc4d={};var _0xf81d42={'count':0x0,'rows':[]};return db[_0xce43('0x40')][_0xce43('0x66')]({'where':{'id':_0x33881f[_0xce43('0x62')]['id']}})[_0xce43('0x1d')](handleEntityNotFound(_0x3fe1f8,null))[_0xce43('0x1d')](function(_0x380dac){if(_0x380dac){_0x12dc4d[_0xce43('0x46')]=_['keys'](db[_0xce43('0x6c')][_0xce43('0x56')]);_0x12dc4d[_0xce43('0x43')]=_['keys'](_0x33881f[_0xce43('0x43')]);_0x12dc4d[_0xce43('0x44')]=_['intersection'](_0x12dc4d[_0xce43('0x46')],_0x12dc4d[_0xce43('0x43')]);_0x58f5fd[_0xce43('0x47')]=_['intersection'](_0x12dc4d[_0xce43('0x46')],qs['fields'](_0x33881f[_0xce43('0x43')][_0xce43('0x48')]));_0x58f5fd[_0xce43('0x47')]=_0x58f5fd[_0xce43('0x47')][_0xce43('0x49')]?_0x58f5fd[_0xce43('0x47')]:_0x12dc4d[_0xce43('0x46')];if(!_0x33881f[_0xce43('0x43')][_0xce43('0x4a')]('nolimit')){_0x58f5fd[_0xce43('0x2f')]=qs[_0xce43('0x2f')](_0x33881f[_0xce43('0x43')][_0xce43('0x2f')]);_0x58f5fd[_0xce43('0x2c')]=qs[_0xce43('0x2c')](_0x33881f['query'][_0xce43('0x2c')]);}_0x58f5fd[_0xce43('0x4c')]=qs[_0xce43('0x4d')](_0x33881f[_0xce43('0x43')][_0xce43('0x4d')]);_0x58f5fd[_0xce43('0x4e')]=qs[_0xce43('0x44')](_[_0xce43('0x4f')](_0x33881f[_0xce43('0x43')],_0x12dc4d[_0xce43('0x44')]));_0x58f5fd[_0xce43('0x4e')][_0xce43('0x67')]=_0x380dac['id'];if(_0x33881f[_0xce43('0x43')][_0xce43('0x50')]){_0x58f5fd[_0xce43('0x4e')]=_[_0xce43('0x68')](_0x58f5fd[_0xce43('0x4e')],{'$or':_[_0xce43('0x3f')](_0x58f5fd['attributes'],function(_0x477d57){var _0x2c04cf={};_0x2c04cf[_0x477d57]={'$like':'%'+_0x33881f[_0xce43('0x43')]['filter']+'%'};return _0x2c04cf;})});}_0x58f5fd=_[_0xce43('0x68')]({},_0x58f5fd,_0x33881f[_0xce43('0x58')]);return db[_0xce43('0x6c')]['count']({'where':_0x58f5fd[_0xce43('0x4e')]})[_0xce43('0x1d')](function(_0x4da74a){_0xf81d42[_0xce43('0x2e')]=_0x4da74a;if(_0x33881f['query'][_0xce43('0x57')]){_0x58f5fd[_0xce43('0x51')]=[{'all':!![]}];}return db[_0xce43('0x6c')][_0xce43('0x6e')](_0x58f5fd);})[_0xce43('0x1d')](function(_0x523528){_0xf81d42[_0xce43('0x52')]=_0x523528;return _0xf81d42;});}})[_0xce43('0x1d')](respondWithFilteredResult(_0x3fe1f8,_0x58f5fd))[_0xce43('0x28')](handleError(_0x3fe1f8,null));};exports[_0xce43('0x6f')]=function(_0x535664,_0xf93a5c,_0x3bfef1){return db[_0xce43('0x40')][_0xce43('0x59')]({'where':{'id':_0x535664[_0xce43('0x62')]['id']}})[_0xce43('0x1d')](handleEntityNotFound(_0xf93a5c,null))[_0xce43('0x1d')](function(_0x32414f){if(_0x32414f){return _0x32414f[_0xce43('0x6f')](_0x535664[_0xce43('0x43')][_0xce43('0x6a')]);}})[_0xce43('0x1d')](respondWithStatusCode(_0xf93a5c,null))[_0xce43('0x28')](handleError(_0xf93a5c,null));};exports['notify']=function(_0x3f5c74,_0x2e935a,_0x417b2e){var _0x5cfd2f={'body':_0x3f5c74[_0xce43('0x5a')],'channel':_0xce43('0x70')};var _0x4d5186=[];var _0xd9d118=[];var _0x330428={};var _0x13839e=![];return db[_0xce43('0x71')]['describe']()['then'](function(_0x928998){if(!_0x928998){throw new db['Sequelize'][(_0xce43('0x72'))]('no\x20available\x20attributes');}_0x4d5186=_['difference'](_[_0xce43('0x55')](_0x928998),['createdAt',_0xce43('0x73')]);_0xd9d118=_['difference'](_['keys'](_0x928998),['createdAt',_0xce43('0x73'),_0xce43('0x74'),_0xce43('0x75')]);if(_0x3f5c74[_0xce43('0x5a')]['id']){delete _0x3f5c74[_0xce43('0x5a')]['id'];}if(_[_0xce43('0x76')](_0x3f5c74[_0xce43('0x5a')][_0xce43('0x77')])){throw new db['Sequelize'][(_0xce43('0x72'))](_0xce43('0x78'));}if(_[_0xce43('0x76')](_0x3f5c74[_0xce43('0x5a')][_0xce43('0x5a')])||_0x3f5c74['body'][_0xce43('0x5a')]===''){throw new db[(_0xce43('0x79'))][(_0xce43('0x72'))](_0xce43('0x7a'));}if(_[_0xce43('0x76')](_0x3f5c74[_0xce43('0x5a')][_0xce43('0x7b')])){throw new db[(_0xce43('0x79'))][(_0xce43('0x72'))](_0xce43('0x7c')+_0xd9d118);}if(!_[_0xce43('0x7d')](_0xd9d118,_0x3f5c74['body'][_0xce43('0x7b')])){throw new db[(_0xce43('0x79'))][(_0xce43('0x72'))](_0xce43('0x7e')+_0xd9d118);}_0x330428[_0x3f5c74[_0xce43('0x5a')]['mapKey']]=_0x3f5c74[_0xce43('0x5a')][_0xce43('0x77')];})[_0xce43('0x1d')](function(){return db[_0xce43('0x40')][_0xce43('0x59')]({'where':{'id':_0x3f5c74[_0xce43('0x62')]['id']},'include':[{'model':db[_0xce43('0x7f')],'as':'List','include':[{'model':db[_0xce43('0x71')],'as':_0xce43('0x80'),'where':_0x330428,'limit':0x1,'order':[[_0xce43('0x73'),_0xce43('0x81')]]}]},{'model':db[_0xce43('0x82')],'as':_0xce43('0x83')}]});})[_0xce43('0x1d')](handleEntityNotFound(_0x2e935a,null))[_0xce43('0x1d')](function(_0x1bfebc){if(_0x1bfebc&&_0x1bfebc[_0xce43('0x84')]){_0x5cfd2f[_0xce43('0x85')]=_0x1bfebc;_0x5cfd2f[_0xce43('0x86')]=_0x1bfebc[_0xce43('0x83')];_0x5cfd2f[_0xce43('0x87')]=_0x1bfebc['List'];_0x5cfd2f[_0xce43('0x86')]=_['orderBy'](_0x5cfd2f[_0xce43('0x86')],[_0xce43('0x88')],[_0xce43('0x89')]);if(_0x5cfd2f['account']['Applications']){delete _0x5cfd2f['account'][_0xce43('0x83')];}if(_0x5cfd2f[_0xce43('0x85')][_0xce43('0x84')]&&_0x5cfd2f['account'][_0xce43('0x84')][_0xce43('0x80')][_0xce43('0x49')]){return _0x5cfd2f['account'][_0xce43('0x84')][_0xce43('0x80')][0x0];}var _0x5c8060=_[_0xce43('0x15')](_0x3f5c74[_0xce43('0x5a')],{'firstName':_0x3f5c74[_0xce43('0x5a')][_0xce43('0x77')],'ListId':_0x1bfebc['ListId']});_0x5c8060[_0x3f5c74[_0xce43('0x5a')][_0xce43('0x7b')]]=_0x3f5c74['body']['from'];return db[_0xce43('0x71')][_0xce43('0x60')](_0x5c8060,{'fields':_0x4d5186,'raw':!![]});}})[_0xce43('0x1d')](handleEntityNotFound(_0x2e935a,null))[_0xce43('0x1d')](function(_0x4bb6ce){_0x5cfd2f[_0xce43('0x8a')]=_0x4bb6ce;if(_0x4bb6ce){var _0x999f58={'ContactId':_0x4bb6ce['id'],'OpenchannelAccountId':_0x3f5c74[_0xce43('0x62')]['id'],'from':(_0x4bb6ce['firstName']||'')+'\x20'+(_0x4bb6ce[_0xce43('0x8b')]||'')};var _0x5bab41={'OpenchannelAccountId':_0x3f5c74[_0xce43('0x62')]['id'],'closed':![]};if(_0x3f5c74[_0xce43('0x5a')]['threadId']){_0x5bab41[_0xce43('0x8c')]=_0x3f5c74['body'][_0xce43('0x8c')];return db[_0xce43('0x8d')]['find']({'where':_0x5bab41})['then'](function(_0x337faf){if(_0x337faf){return[_0x337faf,![]];}_0x999f58['threadId']=_0x3f5c74[_0xce43('0x5a')]['threadId'];_0x999f58['externalUrl']=_0x3f5c74[_0xce43('0x5a')]['externalUrl'];return db[_0xce43('0x8d')]['create'](_0x999f58)[_0xce43('0x1d')](function(_0x55455f){return[_0x55455f,!![]];});});}else{_0x5bab41[_0xce43('0x8c')]=null;}_0x5bab41['ContactId']=_0x4bb6ce['id'];return db['OpenchannelInteraction']['find']({'where':_0x5bab41})[_0xce43('0x1d')](function(_0x3ff970){if(_0x3ff970){return[_0x3ff970,![]];}return db['OpenchannelInteraction'][_0xce43('0x60')](_0x999f58)[_0xce43('0x1d')](function(_0x3aaa15){return[_0x3aaa15,!![]];});});}})['spread'](function(_0x62efc5,_0xcb5862){if(_0x62efc5){_0x13839e=_0xcb5862;if(!_0xcb5862){var _0xfeb8cc={'from':(_0x5cfd2f[_0xce43('0x8a')]['firstName']||'')+'\x20'+(_0x5cfd2f[_0xce43('0x8a')][_0xce43('0x8b')]||'')};if(_0x3f5c74[_0xce43('0x5a')]['threadId']&&_0x3f5c74[_0xce43('0x5a')][_0xce43('0x8e')]&&_0x3f5c74[_0xce43('0x5a')][_0xce43('0x8c')]!=_0x3f5c74[_0xce43('0x5a')][_0xce43('0x8e')]){_0xfeb8cc[_0xce43('0x8c')]=_0x3f5c74[_0xce43('0x5a')]['messageId'];}return _0x62efc5['update'](_0xfeb8cc);}else{return _0x62efc5;}}})[_0xce43('0x1d')](function(_0x217343){_0x5cfd2f[_0xce43('0x8f')]=_0x217343[_0xce43('0x36')]({'plain':!![]});_0x5cfd2f[_0xce43('0x8f')][_0xce43('0x90')]=_0x13839e;if(_0x5cfd2f[_0xce43('0x8f')]['created']){if(_0x5cfd2f['account'][_0xce43('0x91')]){_0x5cfd2f['applications']['push']({'id':0x0,'priority':_0x5cfd2f[_0xce43('0x86')][_0xce43('0x49')]+0x1,'app':'close','appdata':'unmanaged','interval':_0xce43('0x92')});}}return db[_0xce43('0x93')][_0xce43('0x60')]({'body':_0x3f5c74['body'][_0xce43('0x5a')],'OpenchannelAccountId':_0x3f5c74[_0xce43('0x62')]['id'],'OpenchannelInteractionId':_0x217343['id'],'direction':'in','ContactId':_0x5cfd2f[_0xce43('0x8a')]['id'],'AttachmentId':_0x3f5c74[_0xce43('0x5a')][_0xce43('0x94')]});})['then'](function(_0x305f9e){_0x5cfd2f[_0xce43('0x25')]=_0x305f9e;if(_0x5cfd2f[_0xce43('0x8f')][_0xce43('0x95')]){return db[_0xce43('0x96')][_0xce43('0x59')]({'attributes':['id',_0xce43('0x3b')],'where':{'id':_0x5cfd2f[_0xce43('0x8f')][_0xce43('0x95')]}})[_0xce43('0x1d')](function(_0x1f52b1){if(_0x1f52b1){_0x5cfd2f[_0xce43('0x86')][_0xce43('0x97')]({'id':0x0,'priority':0x0,'app':_0xce43('0x98'),'appdata':_0x1f52b1[_0xce43('0x3b')]+','+(_0x5cfd2f[_0xce43('0x85')][_0xce43('0x99')]||0xa),'interval':_0xce43('0x92')});_0x5cfd2f[_0xce43('0x9a')]=![];}return respondWithRpcPromise('Start','startRouting',_0x5cfd2f);});}return respondWithRpcPromise(_0xce43('0x9b'),_0xce43('0x9c'),_0x5cfd2f);})[_0xce43('0x1d')](function(_0x53d525){respondWithRpcPromise('EventManager',_0xce43('0x9d'),{'event':_0xce43('0x9e'),'message':_0x53d525},client9002);return _0x53d525;})[_0xce43('0x1d')](respondWithResult(_0x2e935a,null))[_0xce43('0x28')](handleError(_0x2e935a,null));};exports[_0xce43('0x9f')]=function(_0x532721,_0x1686f0){var _0x146a2b=_0x532721[_0xce43('0x62')]['id'];var _0x3a3361=_0x532721[_0xce43('0x5a')];var _0x170fdc=0xc8;var _0x589bf3=null;return db[_0xce43('0xa0')][_0xce43('0xa1')]({'isolationLevel':db['sequelize'][_0xce43('0xa2')][_0xce43('0xa3')]['READ_COMMITTED']},function(_0x257502){return db['OpenchannelAccount'][_0xce43('0x66')]({'where':{'id':_0x146a2b},'transaction':_0x257502})['then'](function(_0x55593d){if(_0x55593d){return db[_0xce43('0x82')][_0xce43('0x35')]({'where':{'OpenchannelAccountId':_0x146a2b},'transaction':_0x257502})[_0xce43('0x1d')](function(){var _0x41b57f=_[_0xce43('0x3f')](_0x3a3361,function(_0x385b7c){_0x385b7c[_0xce43('0x67')]=_0x146a2b;return _0x385b7c;});return db[_0xce43('0x82')][_0xce43('0xa4')](_0x41b57f,{'transaction':_0x257502});});}else{_0x170fdc=0x194;_0x589bf3=[];}});})[_0xce43('0x1d')](function(){if(_0x170fdc!==0x194){return db[_0xce43('0x82')][_0xce43('0xa5')]({'where':{'OpenchannelAccountId':_0x146a2b},'order':_0xce43('0x88')})[_0xce43('0x1d')](function(_0x47f956){_0x589bf3=_0x47f956;});}})['catch'](function(_0x28e22f){_0x170fdc=0x1f4;logger[_0xce43('0x23')](_0x28e22f[_0xce43('0x3a')]);if(_0x28e22f[_0xce43('0x3b')]){delete _0x28e22f[_0xce43('0x3b')];}_0x589bf3=_0x28e22f;})[_0xce43('0xa6')](function(){if(_0x589bf3===null){_0x1686f0['sendStatus'](_0x170fdc);}else{if(_0x170fdc===0x1f4){_0x1686f0[_0xce43('0x2a')](_0x170fdc)['send'](_0x589bf3);}else{_0x1686f0[_0xce43('0x2a')](_0x170fdc)[_0xce43('0x2b')](_0x589bf3);}}});};exports[_0xce43('0xa7')]=function(_0xcf36f6,_0x9a9567,_0x1137cc){var _0x251218={};var _0x56cfda={};var _0x557e59;var _0x39c35d;return db['OpenchannelAccount'][_0xce43('0x66')]({'where':{'id':_0xcf36f6['params']['id']}})['then'](handleEntityNotFound(_0x9a9567,null))[_0xce43('0x1d')](function(_0x1b5c1d){if(_0x1b5c1d){_0x557e59=_0x1b5c1d;_0x56cfda['model']=_['keys'](db[_0xce43('0x82')][_0xce43('0x56')]);_0x56cfda[_0xce43('0x43')]=_[_0xce43('0x55')](_0xcf36f6['query']);_0x56cfda[_0xce43('0x44')]=_[_0xce43('0x45')](_0x56cfda[_0xce43('0x46')],_0x56cfda[_0xce43('0x43')]);_0x251218[_0xce43('0x47')]=_[_0xce43('0x45')](_0x56cfda[_0xce43('0x46')],qs['fields'](_0xcf36f6['query']['fields']));_0x251218[_0xce43('0x47')]=_0x251218['attributes'][_0xce43('0x49')]?_0x251218[_0xce43('0x47')]:_0x56cfda[_0xce43('0x46')];_0x251218[_0xce43('0x4c')]=qs[_0xce43('0x4d')](_0xcf36f6[_0xce43('0x43')][_0xce43('0x4d')]);_0x251218[_0xce43('0x4e')]=qs[_0xce43('0x44')](_[_0xce43('0x4f')](_0xcf36f6[_0xce43('0x43')],_0x56cfda[_0xce43('0x44')]));if(_0xcf36f6[_0xce43('0x43')]['filter']){_0x251218[_0xce43('0x4e')]=_[_0xce43('0x68')](_0x251218['where'],{'$or':_[_0xce43('0x3f')](_0x251218[_0xce43('0x47')],function(_0x38d585){var _0x1e831d={};_0x1e831d[_0x38d585]={'$like':'%'+_0xcf36f6['query']['filter']+'%'};return _0x1e831d;})});}_0x251218=_[_0xce43('0x68')]({},_0x251218,_0xcf36f6[_0xce43('0x58')]);return _0x557e59[_0xce43('0xa7')](_0x251218);}})[_0xce43('0x1d')](function(_0xfcbda9){if(_0xfcbda9){_0x39c35d=_0xfcbda9['length'];if(!_0xcf36f6[_0xce43('0x43')]['hasOwnProperty'](_0xce43('0x4b'))){_0x251218[_0xce43('0x2f')]=qs['limit'](_0xcf36f6[_0xce43('0x43')][_0xce43('0x2f')]);_0x251218[_0xce43('0x2c')]=qs[_0xce43('0x2c')](_0xcf36f6[_0xce43('0x43')]['offset']);}return _0x557e59[_0xce43('0xa7')](_0x251218);}})[_0xce43('0x1d')](function(_0x38d6b5){if(_0x38d6b5){return _0x38d6b5?{'count':_0x39c35d,'rows':_0x38d6b5}:null;}})[_0xce43('0x1d')](respondWithResult(_0x9a9567,null))[_0xce43('0x28')](handleError(_0x9a9567,null));};exports[_0xce43('0xa8')]=function(_0x2f3648,_0x43f875,_0x406899){var _0x279692={'raw':![],'where':{}};var _0x1af349={};var _0x445109={'count':0x0,'rows':[]};return db[_0xce43('0x40')][_0xce43('0x66')]({'where':{'id':_0x2f3648[_0xce43('0x62')]['id']}})[_0xce43('0x1d')](handleEntityNotFound(_0x43f875,null))[_0xce43('0x1d')](function(_0x4bdc0d){if(_0x4bdc0d){_0x1af349[_0xce43('0x46')]=_[_0xce43('0x55')](db[_0xce43('0x8d')][_0xce43('0x56')]);_0x1af349['query']=_[_0xce43('0x55')](_0x2f3648[_0xce43('0x43')]);_0x1af349['filters']=_['intersection'](_0x1af349[_0xce43('0x46')],_0x1af349['query']);_0x279692[_0xce43('0x47')]=_[_0xce43('0x45')](_0x1af349[_0xce43('0x46')],qs[_0xce43('0x48')](_0x2f3648[_0xce43('0x43')][_0xce43('0x48')]));_0x279692['attributes']=_0x279692[_0xce43('0x47')][_0xce43('0x49')]?_0x279692[_0xce43('0x47')]:_0x1af349[_0xce43('0x46')];if(!_0x2f3648[_0xce43('0x43')][_0xce43('0x4a')]('nolimit')){_0x279692[_0xce43('0x2f')]=qs[_0xce43('0x2f')](_0x2f3648[_0xce43('0x43')][_0xce43('0x2f')]);_0x279692[_0xce43('0x2c')]=qs['offset'](_0x2f3648[_0xce43('0x43')][_0xce43('0x2c')]);}_0x279692['order']=qs[_0xce43('0x4d')](_0x2f3648['query'][_0xce43('0x4d')]);_0x279692[_0xce43('0x4e')]=qs['filters'](_['pick'](_0x2f3648[_0xce43('0x43')],_0x1af349[_0xce43('0x44')]));_0x279692[_0xce43('0x4e')][_0xce43('0x67')]=_0x4bdc0d['id'];if(_0x2f3648[_0xce43('0x43')]['filter']){_0x279692[_0xce43('0x4e')]=_[_0xce43('0x68')](_0x279692[_0xce43('0x4e')],{'$or':_['map'](_0x279692[_0xce43('0x47')],function(_0x3794ba){var _0x25cbdd={};_0x25cbdd[_0x3794ba]={'$like':'%'+_0x2f3648[_0xce43('0x43')]['filter']+'%'};return _0x25cbdd;})});}_0x279692=_[_0xce43('0x68')]({},_0x279692,_0x2f3648[_0xce43('0x58')]);return db[_0xce43('0x8d')]['count']({'where':_0x279692['where']})['then'](function(_0x43b337){_0x445109[_0xce43('0x2e')]=_0x43b337;if(_0x2f3648[_0xce43('0x43')][_0xce43('0x57')]){_0x279692[_0xce43('0x51')]=[{'model':db[_0xce43('0x71')],'as':'Contact','required':![]},{'model':db['User'],'as':_0xce43('0xa9'),'attributes':[_0xce43('0x3b'),_0xce43('0xaa'),_0xce43('0xab')],'required':![]},{'model':db[_0xce43('0xac')],'as':_0xce43('0xad'),'attributes':['id',_0xce43('0x3b'),_0xce43('0xae')],'where':_0x2f3648[_0xce43('0x43')][_0xce43('0xaf')]?{'id':_0x2f3648[_0xce43('0x43')][_0xce43('0xaf')]}:undefined,'required':_0x2f3648['query'][_0xce43('0xaf')]?!![]:![]}];}return db[_0xce43('0x8d')][_0xce43('0x6e')](_0x279692);})[_0xce43('0x1d')](function(_0x49898d){_0x445109[_0xce43('0x52')]=_0x49898d;return _0x445109;});}})[_0xce43('0x1d')](respondWithFilteredResult(_0x43f875,_0x279692))['catch'](handleError(_0x43f875,null));};exports[_0xce43('0xb0')]=function(_0x179b1e,_0x2be5e2,_0xd5a22c){return db[_0xce43('0x40')][_0xce43('0x59')]({'where':{'id':_0x179b1e[_0xce43('0x62')]['id']}})[_0xce43('0x1d')](handleEntityNotFound(_0x2be5e2,null))[_0xce43('0x1d')](function(_0x3f5fb6){if(_0x3f5fb6){return _0x3f5fb6[_0xce43('0xb0')](_0x179b1e['body'][_0xce43('0x6a')],_[_0xce43('0xb1')](_0x179b1e[_0xce43('0x5a')],['ids','id'])||{})['spread'](function(_0x11656e){for(var _0x67718=0x0;_0x67718<_0x179b1e[_0xce43('0x5a')][_0xce43('0x6a')]['length'];_0x67718+=0x1){socket['emit'](_0xce43('0xb2'),{'UserId':Number(_0x179b1e['body']['ids'][_0x67718]),'OpenchannelAccountId':Number(_0x179b1e[_0xce43('0x62')]['id'])});}return _0x11656e;});}})[_0xce43('0x1d')](respondWithResult(_0x2be5e2,null))['catch'](handleError(_0x2be5e2,null));};exports['removeAgents']=function(_0x25dd5c,_0x83b513,_0x3006cc){return db['OpenchannelAccount'][_0xce43('0x59')]({'where':{'id':_0x25dd5c[_0xce43('0x62')]['id']}})[_0xce43('0x1d')](handleEntityNotFound(_0x83b513,null))['then'](function(_0x42025e){if(_0x42025e){return _0x42025e[_0xce43('0xb3')](_0x25dd5c[_0xce43('0x43')][_0xce43('0x6a')])['then'](function(){if(_[_0xce43('0xb4')](_0x25dd5c[_0xce43('0x43')]['ids'])){for(var _0x516ca6=0x0;_0x516ca6<_0x25dd5c[_0xce43('0x43')][_0xce43('0x6a')][_0xce43('0x49')];_0x516ca6+=0x1){socket[_0xce43('0xb5')]('userOpenchannelAccount:remove',{'UserId':Number(_0x25dd5c[_0xce43('0x43')][_0xce43('0x6a')][_0x516ca6]),'OpenchannelAccountId':Number(_0x25dd5c[_0xce43('0x62')]['id'])});}}else{socket[_0xce43('0xb5')](_0xce43('0xb6'),{'UserId':Number(_0x25dd5c[_0xce43('0x43')][_0xce43('0x6a')]),'OpenchannelAccountId':Number(_0x25dd5c[_0xce43('0x62')]['id'])});}});}})['then'](respondWithStatusCode(_0x83b513,null))['catch'](handleError(_0x83b513,null));};exports[_0xce43('0xb7')]=function(_0x3b0b39,_0x36ecf7,_0x2df3c4){var _0x5c2ba6={};var _0x173260={};var _0xb92d3a;var _0x4c02a9;return db[_0xce43('0x40')][_0xce43('0x66')]({'where':{'id':_0x3b0b39[_0xce43('0x62')]['id']}})['then'](handleEntityNotFound(_0x36ecf7,null))[_0xce43('0x1d')](function(_0x188eac){if(_0x188eac){_0xb92d3a=_0x188eac;_0x173260[_0xce43('0x46')]=_[_0xce43('0x55')](db[_0xce43('0x96')][_0xce43('0x56')]);_0x173260[_0xce43('0x43')]=_['keys'](_0x3b0b39[_0xce43('0x43')]);_0x173260[_0xce43('0x44')]=_[_0xce43('0x45')](_0x173260[_0xce43('0x46')],_0x173260['query']);_0x5c2ba6[_0xce43('0x47')]=_[_0xce43('0x45')](_0x173260[_0xce43('0x46')],qs[_0xce43('0x48')](_0x3b0b39[_0xce43('0x43')]['fields']));_0x5c2ba6[_0xce43('0x47')]=_0x5c2ba6['attributes'][_0xce43('0x49')]?_0x5c2ba6[_0xce43('0x47')]:_0x173260[_0xce43('0x46')];_0x5c2ba6[_0xce43('0x4c')]=qs[_0xce43('0x4d')](_0x3b0b39[_0xce43('0x43')][_0xce43('0x4d')]);_0x5c2ba6[_0xce43('0x4e')]=qs['filters'](_[_0xce43('0x4f')](_0x3b0b39[_0xce43('0x43')],_0x173260[_0xce43('0x44')]));if(_0x3b0b39['query'][_0xce43('0x50')]){_0x5c2ba6[_0xce43('0x4e')]=_[_0xce43('0x68')](_0x5c2ba6['where'],{'$or':_[_0xce43('0x3f')](_0x5c2ba6[_0xce43('0x47')],function(_0x3ba398){var _0x2b6d44={};_0x2b6d44[_0x3ba398]={'$like':'%'+_0x3b0b39[_0xce43('0x43')][_0xce43('0x50')]+'%'};return _0x2b6d44;})});}_0x5c2ba6=_['merge']({},_0x5c2ba6,_0x3b0b39[_0xce43('0x58')]);return _0xb92d3a['getAgents'](_0x5c2ba6);}})[_0xce43('0x1d')](function(_0x8100e5){if(_0x8100e5){_0x4c02a9=_0x8100e5[_0xce43('0x49')];if(!_0x3b0b39[_0xce43('0x43')][_0xce43('0x4a')](_0xce43('0x4b'))){_0x5c2ba6[_0xce43('0x2f')]=qs['limit'](_0x3b0b39[_0xce43('0x43')][_0xce43('0x2f')]);_0x5c2ba6['offset']=qs[_0xce43('0x2c')](_0x3b0b39[_0xce43('0x43')][_0xce43('0x2c')]);}return _0xb92d3a['getAgents'](_0x5c2ba6);}})['then'](function(_0x575ee2){if(_0x575ee2){return _0x575ee2?{'count':_0x4c02a9,'rows':_0x575ee2}:null;}})[_0xce43('0x1d')](respondWithResult(_0x36ecf7,null))['catch'](handleError(_0x36ecf7,null));};exports['send']=function(_0x1f454e,_0x25dd3a,_0x4adbf8){var _0x4954cd,_0x216057,_0x5b25da;if(_[_0xce43('0x76')](_0x1f454e[_0xce43('0x5a')][_0xce43('0x5a')])||_0x1f454e[_0xce43('0x5a')]['body']===''){throw new db[(_0xce43('0x79'))]['ValidationError'](_0xce43('0x7a'));}if(_['isNil'](_0x1f454e[_0xce43('0x5a')]['to'])){}_0x4954cd=_0x1f454e[_0xce43('0x5a')]['to'];return db[_0xce43('0x40')][_0xce43('0x66')]({'where':{'id':_0x1f454e[_0xce43('0x62')]['id']}})['then'](handleEntityNotFound(_0x25dd3a,null))[_0xce43('0x1d')](function(_0xe02884){if(_0xe02884){return db[_0xce43('0x40')][_0xce43('0x59')]({'where':{'id':_0xe02884['id']},'include':[{'model':db[_0xce43('0x7f')],'as':_0xce43('0x84'),'include':[{'model':db[_0xce43('0x71')],'as':'Contacts','where':{[_0xe02884[_0xce43('0x7b')]]:_0x4954cd},'limit':0x1,'order':[['updatedAt',_0xce43('0x81')]]}]}]})[_0xce43('0x1d')](handleEntityNotFound(_0x25dd3a,null))[_0xce43('0x1d')](function(_0x3a042f){if(_0x3a042f&&_0x3a042f['List']){_0x216057=_0x3a042f['get']({'plain':!![]});if(_0x216057[_0xce43('0x84')]&&_0x216057[_0xce43('0x84')]['Contacts'][_0xce43('0x49')]){return _0x216057['List'][_0xce43('0x80')][0x0];}return db[_0xce43('0x71')][_0xce43('0x60')](_[_0xce43('0x15')](_0x1f454e[_0xce43('0x5a')],{'firstName':_0x4954cd,[_0x3a042f[_0xce43('0x7b')]]:_0x4954cd,'phone':_0x4954cd,'ListId':_0x216057[_0xce43('0x75')]}));}})[_0xce43('0x1d')](handleEntityNotFound(_0x25dd3a,null))[_0xce43('0x1d')](function(_0x5aeb0a){if(_0x5aeb0a){_0x5b25da=_0x5aeb0a;return db[_0xce43('0x8d')][_0xce43('0x59')]({'where':{'ContactId':_0x5b25da['id'],'closed':![],'OpenchannelAccountId':_0x216057['id']}})[_0xce43('0x1d')](function(_0x4bbaa1){if(_0x4bbaa1){return[_0x4bbaa1,![]];}return db[_0xce43('0x8d')][_0xce43('0x60')]({'UserId':_0x1f454e[_0xce43('0x5d')]['id'],'ContactId':_0x5b25da['id'],'OpenchannelAccountId':_0x216057['id'],'lastMsgDirection':_0xce43('0xb8'),'firstMsgDirection':_0xce43('0xb8'),'Messages':[_[_0xce43('0x68')](_0x1f454e[_0xce43('0x5a')],{'read':![],'body':_0x1f454e['body'][_0xce43('0x5a')],'OpenchannelAccountId':_0x216057['id'],'UserId':_0x1f454e[_0xce43('0x5d')]['id'],'ContactId':_0x5b25da['id']})]},{'include':[{'model':db[_0xce43('0x93')],'as':_0xce43('0xb9')}]})[_0xce43('0x1d')](function(_0x5a8a85){return[_0x5a8a85,!![]];});});}})[_0xce43('0xba')](function(_0x174409,_0x538532){if(_0x538532){return _0x174409;}return db['OpenchannelMessage'][_0xce43('0x60')](_[_0xce43('0x68')](_0x1f454e[_0xce43('0x5a')],{'read':![],'body':_0x1f454e[_0xce43('0x5a')][_0xce43('0x5a')],'OpenchannelAccountId':_0x216057['id'],'OpenchannelInteractionId':_0x174409['id'],'UserId':_0x1f454e[_0xce43('0x5d')]['id'],'ContactId':_0x5b25da['id']}))[_0xce43('0x1d')](function(_0x4c76ec){_0x174409['dataValues'][_0xce43('0xb9')]=[];_0x174409[_0xce43('0xbb')][_0xce43('0xb9')][_0xce43('0xbc')](_0x4c76ec[_0xce43('0xbb')]);return _0x174409;});});}})['then'](respondWithResult(_0x25dd3a,null))['catch'](handleError(_0x25dd3a,null));}; \ No newline at end of file +var _0x7429=['attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','OpenchannelAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','notify','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','isNil','from','from\x20is\x20mandatory','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','Contacts','DESC','Applications','account','applications','list','priority','ListId','contact','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','messageId','interaction','created','autoclose','push','unmanaged','AttachmentId','User','UserId','unshift','agent','*,*,*,*','startRouting','Start','EventManager','addApplications','ISOLATION_LEVELS','READ_COMMITTED','OpenchannelApplication','bulkCreate','findAndCountAll','getApplications','Owner','fullname','Tag','Tags','color','tag','addAgents','spread','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','OpenchannelMessage','Messages','dataValues','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','status','undefined','count','offset','limit','Content-Range','json','apply','reject','save','update','destroy','then','get','UserProfileResource','end','stack','name','send','Pause','mandatoryDispositionPause','map','OpenchannelAccount','fieldName','type','key','query','keys','filters','intersection','model'];(function(_0x3fdc1f,_0x57ac87){var _0x984fd9=function(_0x23bb3e){while(--_0x23bb3e){_0x3fdc1f['push'](_0x3fdc1f['shift']());}};_0x984fd9(++_0x57ac87);}(_0x7429,0x6f));var _0x9742=function(_0x3316c1,_0x30f330){_0x3316c1=_0x3316c1-0x0;var _0x4bc925=_0x7429[_0x3316c1];return _0x4bc925;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9742('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9742('0x1'));var moment=require(_0x9742('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x9742('0x3'));var util=require(_0x9742('0x4'));var path=require(_0x9742('0x5'));var sox=require(_0x9742('0x6'));var csv=require(_0x9742('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9742('0x8'));var squel=require(_0x9742('0x9'));var crypto=require('crypto');var jsforce=require(_0x9742('0xa'));var deskjs=require(_0x9742('0xb'));var toCsv=require('to-csv');var querystring=require(_0x9742('0xc'));var Papa=require(_0x9742('0xd'));var Redis=require(_0x9742('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x9742('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9742('0x10'));var logger=require(_0x9742('0x11'))('api');var utils=require(_0x9742('0x12'));var config=require(_0x9742('0x13'));var licenseUtil=require(_0x9742('0x14'));var db=require('../../mysqldb')['db'];config[_0x9742('0x15')]=_[_0x9742('0x16')](config[_0x9742('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x9742('0x17'))(new Redis(config[_0x9742('0x15')]));require('./openchannelAccount.socket')[_0x9742('0x18')](socket);var jayson=require(_0x9742('0x19'));var client=jayson[_0x9742('0x1a')][_0x9742('0x1b')]({'port':0x232c});var client9002=jayson[_0x9742('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2bb5b1,_0x4d69d5,_0x6f4f13,_0x2e64c2){return new BPromise(function(_0xf65620,_0x27d282){var _0x416614=_0x2e64c2||client;return _0x416614['request'](_0x2bb5b1,_0x6f4f13)['then'](function(_0x400f5f){logger['info'](_0x9742('0x1c'),_0x4d69d5,_0x9742('0x1d'));logger[_0x9742('0x1e')](_0x9742('0x1f'),_0x4d69d5,_0x9742('0x1d'),JSON[_0x9742('0x20')](_0x400f5f));if(_0x400f5f[_0x9742('0x21')]){if(_0x400f5f[_0x9742('0x21')]['code']===0x1f4){logger[_0x9742('0x21')](_0x9742('0x1c'),_0x4d69d5,_0x400f5f[_0x9742('0x21')][_0x9742('0x22')]);return _0x27d282(_0x400f5f['error'][_0x9742('0x22')]);}logger[_0x9742('0x21')]('OpenchannelAccount,\x20%s,\x20%s',_0x4d69d5,_0x400f5f[_0x9742('0x21')][_0x9742('0x22')]);return _0xf65620(_0x400f5f[_0x9742('0x21')]['message']);}else{logger[_0x9742('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x4d69d5,_0x9742('0x1d'));_0xf65620(_0x400f5f[_0x9742('0x24')][_0x9742('0x22')]);}})[_0x9742('0x25')](function(_0x2242de){logger[_0x9742('0x21')](_0x9742('0x1c'),_0x4d69d5,_0x2242de);_0x27d282(_0x2242de);});});}function respondWithStatusCode(_0x5be642,_0x103247){_0x103247=_0x103247||0xcc;return function(_0x1c8136){if(_0x1c8136){return _0x5be642[_0x9742('0x26')](_0x103247);}return _0x5be642[_0x9742('0x27')](_0x103247)['end']();};}function respondWithResult(_0x588fb4,_0x146974){_0x146974=_0x146974||0xc8;return function(_0x3005c3){if(_0x3005c3){return _0x588fb4['status'](_0x146974)['json'](_0x3005c3);}};}function respondWithFilteredResult(_0x4b237b,_0x25c237){return function(_0x35dd19){if(_0x35dd19){var _0x4a7f19=typeof _0x25c237['offset']===_0x9742('0x28')&&typeof _0x25c237['limit']===_0x9742('0x28');var _0x4d3778=_0x35dd19[_0x9742('0x29')];var _0x1c5cec=_0x4a7f19?0x0:_0x25c237[_0x9742('0x2a')];var _0x13d0e5=_0x4a7f19?_0x35dd19[_0x9742('0x29')]:_0x25c237[_0x9742('0x2a')]+_0x25c237[_0x9742('0x2b')];var _0x5ccf02;if(_0x13d0e5>=_0x4d3778){_0x13d0e5=_0x4d3778;_0x5ccf02=0xc8;}else{_0x5ccf02=0xce;}_0x4b237b[_0x9742('0x27')](_0x5ccf02);return _0x4b237b['set'](_0x9742('0x2c'),_0x1c5cec+'-'+_0x13d0e5+'/'+_0x4d3778)[_0x9742('0x2d')](_0x35dd19);}return null;};}function patchUpdates(_0x1f3ae5){return function(_0x24656c){try{jsonpatch[_0x9742('0x2e')](_0x24656c,_0x1f3ae5,!![]);}catch(_0x35a772){return BPromise[_0x9742('0x2f')](_0x35a772);}return _0x24656c[_0x9742('0x30')]();};}function saveUpdates(_0xa5d889,_0x2e1193){return function(_0x3ecb60){if(_0x3ecb60){return _0x3ecb60[_0x9742('0x31')](_0xa5d889)['then'](function(_0x20d6af){return _0x20d6af;});}return null;};}function removeEntity(_0x461b27,_0x29c257){return function(_0x2b9c8d){if(_0x2b9c8d){return _0x2b9c8d[_0x9742('0x32')]()[_0x9742('0x33')](function(){var _0x2230e3=_0x2b9c8d[_0x9742('0x34')]({'plain':!![]});var _0x44a063='OpenchannelAccounts';return db[_0x9742('0x35')]['destroy']({'where':{'type':_0x44a063,'resourceId':_0x2230e3['id']}})[_0x9742('0x33')](function(){return _0x2b9c8d;});})[_0x9742('0x33')](function(){_0x461b27['status'](0xcc)[_0x9742('0x36')]();});}};}function handleEntityNotFound(_0x44bf1e,_0x2f96e9){return function(_0x414694){if(!_0x414694){_0x44bf1e['sendStatus'](0x194);}return _0x414694;};}function handleError(_0x4bce1b,_0x37021e){_0x37021e=_0x37021e||0x1f4;return function(_0x3a1aaa){logger[_0x9742('0x21')](_0x3a1aaa[_0x9742('0x37')]);if(_0x3a1aaa['name']){delete _0x3a1aaa[_0x9742('0x38')];}_0x4bce1b[_0x9742('0x27')](_0x37021e)[_0x9742('0x39')](_0x3a1aaa);};}exports['index']=function(_0x8dbed0,_0x30760e){var _0x46a51f={'include':[{'model':db[_0x9742('0x3a')],'as':_0x9742('0x3b')}]},_0x2df267={},_0x3c1f6a={'count':0x0,'rows':[]};var _0x496ae8=_[_0x9742('0x3c')](db[_0x9742('0x3d')]['rawAttributes'],function(_0x11ee0c){return{'name':_0x11ee0c[_0x9742('0x3e')],'type':_0x11ee0c[_0x9742('0x3f')][_0x9742('0x40')]};});_0x2df267['model']=_[_0x9742('0x3c')](_0x496ae8,_0x9742('0x38'));_0x2df267[_0x9742('0x41')]=_[_0x9742('0x42')](_0x8dbed0[_0x9742('0x41')]);_0x2df267[_0x9742('0x43')]=_[_0x9742('0x44')](_0x2df267[_0x9742('0x45')],_0x2df267['query']);_0x46a51f[_0x9742('0x46')]=_['intersection'](_0x2df267[_0x9742('0x45')],qs[_0x9742('0x47')](_0x8dbed0[_0x9742('0x41')][_0x9742('0x47')]));_0x46a51f[_0x9742('0x46')]=_0x46a51f[_0x9742('0x46')]['length']?_0x46a51f[_0x9742('0x46')]:_0x2df267[_0x9742('0x45')];if(!_0x8dbed0[_0x9742('0x41')][_0x9742('0x48')](_0x9742('0x49'))){_0x46a51f[_0x9742('0x2b')]=qs[_0x9742('0x2b')](_0x8dbed0[_0x9742('0x41')]['limit']);_0x46a51f[_0x9742('0x2a')]=qs[_0x9742('0x2a')](_0x8dbed0[_0x9742('0x41')][_0x9742('0x2a')]);}_0x46a51f[_0x9742('0x4a')]=qs[_0x9742('0x4b')](_0x8dbed0[_0x9742('0x41')][_0x9742('0x4b')]);_0x46a51f[_0x9742('0x4c')]=qs['filters'](_[_0x9742('0x4d')](_0x8dbed0[_0x9742('0x41')],_0x2df267['filters']),_0x496ae8);if(_0x8dbed0[_0x9742('0x41')][_0x9742('0x4e')]){_0x46a51f['where']=_['merge'](_0x46a51f[_0x9742('0x4c')],{'$or':_[_0x9742('0x3c')](_0x496ae8,function(_0x288cb5){if(_0x288cb5[_0x9742('0x3f')]!=='VIRTUAL'){var _0x32d0f6={};_0x32d0f6[_0x288cb5[_0x9742('0x38')]]={'$like':'%'+_0x8dbed0[_0x9742('0x41')][_0x9742('0x4e')]+'%'};return _0x32d0f6;}})});}_0x46a51f=_[_0x9742('0x4f')]({},_0x46a51f,_0x8dbed0[_0x9742('0x50')]);var _0x4d3509={'where':_0x46a51f[_0x9742('0x4c')]};return db[_0x9742('0x3d')][_0x9742('0x29')](_0x4d3509)['then'](function(_0x296cba){_0x3c1f6a[_0x9742('0x29')]=_0x296cba;if(_0x8dbed0[_0x9742('0x41')][_0x9742('0x51')]){_0x46a51f[_0x9742('0x52')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x9742('0x53')](_0x46a51f);})['then'](function(_0x52ca3c){_0x3c1f6a[_0x9742('0x54')]=_0x52ca3c;return _0x3c1f6a;})[_0x9742('0x33')](respondWithFilteredResult(_0x30760e,_0x46a51f))['catch'](handleError(_0x30760e,null));};exports[_0x9742('0x55')]=function(_0x5e7087,_0x2e7b6c){var _0x305ddb={'raw':![],'where':{'id':_0x5e7087[_0x9742('0x56')]['id']},'include':[{'model':db[_0x9742('0x3a')],'as':_0x9742('0x3b')}]},_0x599e6c={};_0x599e6c['model']=_[_0x9742('0x42')](db[_0x9742('0x3d')][_0x9742('0x57')]);_0x599e6c[_0x9742('0x41')]=_['keys'](_0x5e7087['query']);_0x599e6c[_0x9742('0x43')]=_[_0x9742('0x44')](_0x599e6c[_0x9742('0x45')],_0x599e6c[_0x9742('0x41')]);_0x305ddb[_0x9742('0x46')]=_[_0x9742('0x44')](_0x599e6c[_0x9742('0x45')],qs[_0x9742('0x47')](_0x5e7087['query'][_0x9742('0x47')]));_0x305ddb[_0x9742('0x46')]=_0x305ddb['attributes'][_0x9742('0x58')]?_0x305ddb[_0x9742('0x46')]:_0x599e6c[_0x9742('0x45')];if(_0x5e7087['query'][_0x9742('0x51')]){_0x305ddb['include']=[{'all':!![]}];}_0x305ddb=_[_0x9742('0x4f')]({},_0x305ddb,_0x5e7087['options']);return db[_0x9742('0x3d')][_0x9742('0x59')](_0x305ddb)[_0x9742('0x33')](handleEntityNotFound(_0x2e7b6c,null))[_0x9742('0x33')](respondWithResult(_0x2e7b6c,null))[_0x9742('0x25')](handleError(_0x2e7b6c,null));};exports[_0x9742('0x5a')]=function(_0x2ccfb2,_0x27a9dd){return db['OpenchannelAccount']['create'](_0x2ccfb2[_0x9742('0x5b')],{})[_0x9742('0x33')](function(_0x50a350){var _0x37927e=_0x2ccfb2[_0x9742('0x5c')]['get']({'plain':!![]});if(!_0x37927e)throw new Error(_0x9742('0x5d'));if(_0x37927e['role']===_0x9742('0x5c')){var _0x3d3c84=_0x50a350[_0x9742('0x34')]({'plain':!![]});var _0x160ecb=_0x9742('0x5e');return db['UserProfileSection'][_0x9742('0x59')]({'where':{'name':_0x160ecb,'userProfileId':_0x37927e[_0x9742('0x5f')]},'raw':!![]})[_0x9742('0x33')](function(_0x1845a6){if(_0x1845a6&&_0x1845a6[_0x9742('0x60')]===0x0){return db[_0x9742('0x35')][_0x9742('0x5a')]({'name':_0x3d3c84[_0x9742('0x38')],'resourceId':_0x3d3c84['id'],'type':_0x1845a6[_0x9742('0x38')],'sectionId':_0x1845a6['id']},{})[_0x9742('0x33')](function(){return _0x50a350;});}else{return _0x50a350;}})['catch'](function(_0x44607e){logger[_0x9742('0x21')](_0x9742('0x61'),_0x44607e);throw _0x44607e;});}return _0x50a350;})[_0x9742('0x33')](respondWithResult(_0x27a9dd,0xc9))[_0x9742('0x25')](handleError(_0x27a9dd,null));};exports[_0x9742('0x31')]=function(_0x2f270a,_0x2bf802){if(_0x2f270a[_0x9742('0x5b')]['id']){delete _0x2f270a['body']['id'];}return db[_0x9742('0x3d')][_0x9742('0x59')]({'where':{'id':_0x2f270a['params']['id']},'include':[{'model':db['Pause'],'as':_0x9742('0x3b')}]})['then'](handleEntityNotFound(_0x2bf802,null))[_0x9742('0x33')](saveUpdates(_0x2f270a['body'],null))['then'](respondWithResult(_0x2bf802,null))[_0x9742('0x25')](handleError(_0x2bf802,null));};exports[_0x9742('0x32')]=function(_0x48f6ad,_0x4f6c65){return db[_0x9742('0x3d')][_0x9742('0x59')]({'where':{'id':_0x48f6ad[_0x9742('0x56')]['id']}})['then'](handleEntityNotFound(_0x4f6c65,null))[_0x9742('0x33')](removeEntity(_0x4f6c65,null))[_0x9742('0x25')](handleError(_0x4f6c65,null));};exports['describe']=function(_0x2fb04c,_0x33b788){return db['OpenchannelAccount'][_0x9742('0x62')]()[_0x9742('0x33')](respondWithResult(_0x33b788,null))[_0x9742('0x25')](handleError(_0x33b788,null));};exports['addDisposition']=function(_0x217e8b,_0x4ac11a,_0xa794e){if(_0x217e8b['body']['id']){delete _0x217e8b[_0x9742('0x5b')]['id'];}return db['OpenchannelAccount'][_0x9742('0x59')]({'where':{'id':_0x217e8b[_0x9742('0x56')]['id']}})[_0x9742('0x33')](handleEntityNotFound(_0x4ac11a,null))[_0x9742('0x33')](function(_0x476043){if(_0x476043){_0x217e8b['body'][_0x9742('0x63')]=_0x476043['id'];return db[_0x9742('0x64')][_0x9742('0x5a')](_0x217e8b[_0x9742('0x5b')]);}})[_0x9742('0x33')](respondWithResult(_0x4ac11a,null))['catch'](handleError(_0x4ac11a,null));};exports[_0x9742('0x65')]=function(_0xe17165,_0x323c9d,_0x2bf46d){var _0x2ac2e8={'raw':![],'where':{}};var _0x515eaf={};var _0x1f6797={'count':0x0,'rows':[]};return db[_0x9742('0x3d')][_0x9742('0x66')]({'where':{'id':_0xe17165[_0x9742('0x56')]['id']}})[_0x9742('0x33')](handleEntityNotFound(_0x323c9d,null))['then'](function(_0x171085){if(_0x171085){_0x515eaf[_0x9742('0x45')]=_[_0x9742('0x42')](db[_0x9742('0x64')][_0x9742('0x57')]);_0x515eaf[_0x9742('0x41')]=_['keys'](_0xe17165[_0x9742('0x41')]);_0x515eaf[_0x9742('0x43')]=_['intersection'](_0x515eaf[_0x9742('0x45')],_0x515eaf[_0x9742('0x41')]);_0x2ac2e8[_0x9742('0x46')]=_['intersection'](_0x515eaf[_0x9742('0x45')],qs[_0x9742('0x47')](_0xe17165[_0x9742('0x41')]['fields']));_0x2ac2e8[_0x9742('0x46')]=_0x2ac2e8[_0x9742('0x46')][_0x9742('0x58')]?_0x2ac2e8[_0x9742('0x46')]:_0x515eaf['model'];if(!_0xe17165[_0x9742('0x41')][_0x9742('0x48')]('nolimit')){_0x2ac2e8['limit']=qs[_0x9742('0x2b')](_0xe17165[_0x9742('0x41')][_0x9742('0x2b')]);_0x2ac2e8[_0x9742('0x2a')]=qs[_0x9742('0x2a')](_0xe17165[_0x9742('0x41')]['offset']);}_0x2ac2e8[_0x9742('0x4a')]=qs['sort'](_0xe17165['query'][_0x9742('0x4b')]);_0x2ac2e8['where']=qs[_0x9742('0x43')](_[_0x9742('0x4d')](_0xe17165[_0x9742('0x41')],_0x515eaf[_0x9742('0x43')]));_0x2ac2e8[_0x9742('0x4c')][_0x9742('0x63')]=_0x171085['id'];if(_0xe17165[_0x9742('0x41')][_0x9742('0x4e')]){_0x2ac2e8['where']=_[_0x9742('0x4f')](_0x2ac2e8[_0x9742('0x4c')],{'$or':_[_0x9742('0x3c')](_0x2ac2e8['attributes'],function(_0x56933f){var _0x593c94={};_0x593c94[_0x56933f]={'$like':'%'+_0xe17165['query'][_0x9742('0x4e')]+'%'};return _0x593c94;})});}_0x2ac2e8=_['merge']({},_0x2ac2e8,_0xe17165[_0x9742('0x50')]);return db['Disposition'][_0x9742('0x29')]({'where':_0x2ac2e8['where']})[_0x9742('0x33')](function(_0x562f31){_0x1f6797[_0x9742('0x29')]=_0x562f31;if(_0xe17165[_0x9742('0x41')][_0x9742('0x51')]){_0x2ac2e8[_0x9742('0x52')]=[{'all':!![]}];}return db[_0x9742('0x64')]['findAll'](_0x2ac2e8);})[_0x9742('0x33')](function(_0x35a3a3){_0x1f6797[_0x9742('0x54')]=_0x35a3a3;return _0x1f6797;});}})[_0x9742('0x33')](respondWithFilteredResult(_0x323c9d,_0x2ac2e8))[_0x9742('0x25')](handleError(_0x323c9d,null));};exports[_0x9742('0x67')]=function(_0x2d2086,_0x4e217b,_0x5151a7){return db[_0x9742('0x3d')][_0x9742('0x59')]({'where':{'id':_0x2d2086[_0x9742('0x56')]['id']}})[_0x9742('0x33')](handleEntityNotFound(_0x4e217b,null))[_0x9742('0x33')](function(_0x1dc619){if(_0x1dc619){return _0x1dc619[_0x9742('0x67')](_0x2d2086[_0x9742('0x41')][_0x9742('0x68')]);}})[_0x9742('0x33')](respondWithStatusCode(_0x4e217b,null))['catch'](handleError(_0x4e217b,null));};exports[_0x9742('0x69')]=function(_0x53d043,_0x370eb6,_0x46bd97){if(_0x53d043[_0x9742('0x5b')]['id']){delete _0x53d043[_0x9742('0x5b')]['id'];}return db[_0x9742('0x3d')][_0x9742('0x59')]({'where':{'id':_0x53d043[_0x9742('0x56')]['id']}})[_0x9742('0x33')](handleEntityNotFound(_0x370eb6,null))[_0x9742('0x33')](function(_0x3c8763){if(_0x3c8763){_0x53d043[_0x9742('0x5b')][_0x9742('0x63')]=_0x3c8763['id'];return db['CannedAnswer'][_0x9742('0x5a')](_0x53d043[_0x9742('0x5b')]);}})['then'](respondWithResult(_0x370eb6,null))['catch'](handleError(_0x370eb6,null));};exports[_0x9742('0x6a')]=function(_0x36db64,_0xb3e43a,_0x4d5fa6){var _0x3b9be1={'raw':![],'where':{}};var _0x7db5ae={};var _0x3a7cf5={'count':0x0,'rows':[]};return db[_0x9742('0x3d')][_0x9742('0x66')]({'where':{'id':_0x36db64[_0x9742('0x56')]['id']}})[_0x9742('0x33')](handleEntityNotFound(_0xb3e43a,null))[_0x9742('0x33')](function(_0x5b3a8d){if(_0x5b3a8d){_0x7db5ae[_0x9742('0x45')]=_['keys'](db[_0x9742('0x6b')]['rawAttributes']);_0x7db5ae[_0x9742('0x41')]=_[_0x9742('0x42')](_0x36db64[_0x9742('0x41')]);_0x7db5ae[_0x9742('0x43')]=_['intersection'](_0x7db5ae[_0x9742('0x45')],_0x7db5ae[_0x9742('0x41')]);_0x3b9be1['attributes']=_[_0x9742('0x44')](_0x7db5ae['model'],qs[_0x9742('0x47')](_0x36db64[_0x9742('0x41')][_0x9742('0x47')]));_0x3b9be1[_0x9742('0x46')]=_0x3b9be1[_0x9742('0x46')][_0x9742('0x58')]?_0x3b9be1[_0x9742('0x46')]:_0x7db5ae[_0x9742('0x45')];if(!_0x36db64[_0x9742('0x41')][_0x9742('0x48')](_0x9742('0x49'))){_0x3b9be1['limit']=qs[_0x9742('0x2b')](_0x36db64[_0x9742('0x41')][_0x9742('0x2b')]);_0x3b9be1['offset']=qs[_0x9742('0x2a')](_0x36db64['query'][_0x9742('0x2a')]);}_0x3b9be1[_0x9742('0x4a')]=qs[_0x9742('0x4b')](_0x36db64[_0x9742('0x41')][_0x9742('0x4b')]);_0x3b9be1['where']=qs[_0x9742('0x43')](_[_0x9742('0x4d')](_0x36db64[_0x9742('0x41')],_0x7db5ae[_0x9742('0x43')]));_0x3b9be1[_0x9742('0x4c')][_0x9742('0x63')]=_0x5b3a8d['id'];if(_0x36db64['query'][_0x9742('0x4e')]){_0x3b9be1[_0x9742('0x4c')]=_[_0x9742('0x4f')](_0x3b9be1[_0x9742('0x4c')],{'$or':_[_0x9742('0x3c')](_0x3b9be1['attributes'],function(_0x379587){var _0x41d79a={};_0x41d79a[_0x379587]={'$like':'%'+_0x36db64['query'][_0x9742('0x4e')]+'%'};return _0x41d79a;})});}_0x3b9be1=_[_0x9742('0x4f')]({},_0x3b9be1,_0x36db64[_0x9742('0x50')]);return db[_0x9742('0x6b')][_0x9742('0x29')]({'where':_0x3b9be1[_0x9742('0x4c')]})['then'](function(_0x4c64ae){_0x3a7cf5[_0x9742('0x29')]=_0x4c64ae;if(_0x36db64['query'][_0x9742('0x51')]){_0x3b9be1[_0x9742('0x52')]=[{'all':!![]}];}return db[_0x9742('0x6b')]['findAll'](_0x3b9be1);})[_0x9742('0x33')](function(_0x493eae){_0x3a7cf5['rows']=_0x493eae;return _0x3a7cf5;});}})[_0x9742('0x33')](respondWithFilteredResult(_0xb3e43a,_0x3b9be1))[_0x9742('0x25')](handleError(_0xb3e43a,null));};exports[_0x9742('0x6c')]=function(_0x2c17f3,_0x30c964,_0x1973a7){return db[_0x9742('0x3d')]['find']({'where':{'id':_0x2c17f3[_0x9742('0x56')]['id']}})['then'](handleEntityNotFound(_0x30c964,null))[_0x9742('0x33')](function(_0x3bddc4){if(_0x3bddc4){return _0x3bddc4[_0x9742('0x6c')](_0x2c17f3[_0x9742('0x41')][_0x9742('0x68')]);}})[_0x9742('0x33')](respondWithStatusCode(_0x30c964,null))[_0x9742('0x25')](handleError(_0x30c964,null));};exports[_0x9742('0x6d')]=function(_0x160fa2,_0x27a0f0,_0x560485){var _0x51995b={'body':_0x160fa2[_0x9742('0x5b')],'channel':'openchannel'};var _0x5edf51=[];var _0x5cb327=[];var _0x1ee4bb={};var _0x568e35=![];return db[_0x9742('0x6e')]['describe']()[_0x9742('0x33')](function(_0x54c8d6){if(!_0x54c8d6){throw new db[(_0x9742('0x6f'))]['ValidationError'](_0x9742('0x70'));}_0x5edf51=_[_0x9742('0x71')](_[_0x9742('0x42')](_0x54c8d6),[_0x9742('0x72'),'updatedAt']);_0x5cb327=_[_0x9742('0x71')](_[_0x9742('0x42')](_0x54c8d6),[_0x9742('0x72'),_0x9742('0x73'),_0x9742('0x74'),'ListId']);if(_0x160fa2[_0x9742('0x5b')]['id']){delete _0x160fa2[_0x9742('0x5b')]['id'];}if(_[_0x9742('0x75')](_0x160fa2[_0x9742('0x5b')][_0x9742('0x76')])){throw new db[(_0x9742('0x6f'))]['ValidationError'](_0x9742('0x77'));}if(_[_0x9742('0x75')](_0x160fa2[_0x9742('0x5b')][_0x9742('0x5b')])||_0x160fa2[_0x9742('0x5b')][_0x9742('0x5b')]===''){throw new db[(_0x9742('0x6f'))][(_0x9742('0x78'))](_0x9742('0x79'));}if(_[_0x9742('0x75')](_0x160fa2['body'][_0x9742('0x7a')])){throw new db[(_0x9742('0x6f'))][(_0x9742('0x78'))](_0x9742('0x7b')+_0x5cb327);}if(!_[_0x9742('0x7c')](_0x5cb327,_0x160fa2['body']['mapKey'])){throw new db[(_0x9742('0x6f'))][(_0x9742('0x78'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5cb327);}_0x1ee4bb[_0x160fa2[_0x9742('0x5b')][_0x9742('0x7a')]]=_0x160fa2[_0x9742('0x5b')][_0x9742('0x76')];})['then'](function(){return db[_0x9742('0x3d')][_0x9742('0x59')]({'where':{'id':_0x160fa2['params']['id']},'include':[{'model':db[_0x9742('0x7d')],'as':_0x9742('0x7e'),'include':[{'model':db[_0x9742('0x6e')],'as':_0x9742('0x7f'),'where':_0x1ee4bb,'limit':0x1,'order':[['updatedAt',_0x9742('0x80')]]}]},{'model':db['OpenchannelApplication'],'as':_0x9742('0x81')}]});})['then'](handleEntityNotFound(_0x27a0f0,null))[_0x9742('0x33')](function(_0x5c9903){if(_0x5c9903&&_0x5c9903['List']){_0x51995b[_0x9742('0x82')]=_0x5c9903;_0x51995b[_0x9742('0x83')]=_0x5c9903['Applications'];_0x51995b[_0x9742('0x84')]=_0x5c9903['List'];_0x51995b[_0x9742('0x83')]=_['orderBy'](_0x51995b[_0x9742('0x83')],[_0x9742('0x85')],['asc']);if(_0x51995b['account'][_0x9742('0x81')]){delete _0x51995b['account'][_0x9742('0x81')];}if(_0x51995b[_0x9742('0x82')][_0x9742('0x7e')]&&_0x51995b[_0x9742('0x82')][_0x9742('0x7e')][_0x9742('0x7f')][_0x9742('0x58')]){return _0x51995b[_0x9742('0x82')]['List'][_0x9742('0x7f')][0x0];}var _0x458aa=_[_0x9742('0x16')](_0x160fa2[_0x9742('0x5b')],{'firstName':_0x160fa2[_0x9742('0x5b')]['from'],'ListId':_0x5c9903[_0x9742('0x86')]});_0x458aa[_0x160fa2[_0x9742('0x5b')][_0x9742('0x7a')]]=_0x160fa2[_0x9742('0x5b')][_0x9742('0x76')];return db['CmContact']['create'](_0x458aa,{'fields':_0x5edf51,'raw':!![]});}})[_0x9742('0x33')](handleEntityNotFound(_0x27a0f0,null))['then'](function(_0x214456){_0x51995b[_0x9742('0x87')]=_0x214456;if(_0x214456){var _0x5f07aa={'ContactId':_0x214456['id'],'OpenchannelAccountId':_0x160fa2[_0x9742('0x56')]['id'],'from':(_0x214456[_0x9742('0x88')]||'')+'\x20'+(_0x214456['lastName']||'')};var _0x19f746={'OpenchannelAccountId':_0x160fa2[_0x9742('0x56')]['id'],'closed':![]};if(_0x160fa2[_0x9742('0x5b')][_0x9742('0x89')]){_0x19f746['threadId']=_0x160fa2['body']['threadId'];return db[_0x9742('0x8a')][_0x9742('0x59')]({'where':_0x19f746})[_0x9742('0x33')](function(_0x409f55){if(_0x409f55){return[_0x409f55,![]];}_0x5f07aa['threadId']=_0x160fa2[_0x9742('0x5b')][_0x9742('0x89')];_0x5f07aa[_0x9742('0x8b')]=_0x160fa2[_0x9742('0x5b')][_0x9742('0x8b')];return db[_0x9742('0x8a')][_0x9742('0x5a')](_0x5f07aa)['then'](function(_0x430547){return[_0x430547,!![]];});});}else{_0x19f746['threadId']=null;}_0x19f746[_0x9742('0x8c')]=_0x214456['id'];return db[_0x9742('0x8a')]['find']({'where':_0x19f746})['then'](function(_0x50bf9c){if(_0x50bf9c){return[_0x50bf9c,![]];}return db['OpenchannelInteraction'][_0x9742('0x5a')](_0x5f07aa)[_0x9742('0x33')](function(_0x553528){return[_0x553528,!![]];});});}})['spread'](function(_0x4acc31,_0x4c2f26){if(_0x4acc31){_0x568e35=_0x4c2f26;if(!_0x4c2f26){var _0x295d8c={'from':(_0x51995b[_0x9742('0x87')][_0x9742('0x88')]||'')+'\x20'+(_0x51995b[_0x9742('0x87')]['lastName']||'')};if(_0x160fa2[_0x9742('0x5b')]['threadId']&&_0x160fa2[_0x9742('0x5b')][_0x9742('0x8d')]&&_0x160fa2[_0x9742('0x5b')]['threadId']!=_0x160fa2[_0x9742('0x5b')][_0x9742('0x8d')]){_0x295d8c[_0x9742('0x89')]=_0x160fa2[_0x9742('0x5b')][_0x9742('0x8d')];}return _0x4acc31[_0x9742('0x31')](_0x295d8c);}else{return _0x4acc31;}}})[_0x9742('0x33')](function(_0x3ac3c3){_0x51995b['interaction']=_0x3ac3c3[_0x9742('0x34')]({'plain':!![]});_0x51995b[_0x9742('0x8e')][_0x9742('0x8f')]=_0x568e35;if(_0x51995b['interaction'][_0x9742('0x8f')]){if(_0x51995b['account'][_0x9742('0x90')]){_0x51995b[_0x9742('0x83')][_0x9742('0x91')]({'id':0x0,'priority':_0x51995b[_0x9742('0x83')][_0x9742('0x58')]+0x1,'app':'close','appdata':_0x9742('0x92'),'interval':'*,*,*,*'});}}return db['OpenchannelMessage']['create']({'body':_0x160fa2[_0x9742('0x5b')]['body'],'OpenchannelAccountId':_0x160fa2[_0x9742('0x56')]['id'],'OpenchannelInteractionId':_0x3ac3c3['id'],'direction':'in','ContactId':_0x51995b[_0x9742('0x87')]['id'],'AttachmentId':_0x160fa2[_0x9742('0x5b')][_0x9742('0x93')]});})[_0x9742('0x33')](function(_0x4764e9){_0x51995b[_0x9742('0x22')]=_0x4764e9;if(_0x51995b[_0x9742('0x8e')]['UserId']){return db[_0x9742('0x94')][_0x9742('0x59')]({'attributes':['id',_0x9742('0x38')],'where':{'id':_0x51995b[_0x9742('0x8e')][_0x9742('0x95')]}})['then'](function(_0x204991){if(_0x204991){_0x51995b[_0x9742('0x83')][_0x9742('0x96')]({'id':0x0,'priority':0x0,'app':_0x9742('0x97'),'appdata':_0x204991[_0x9742('0x38')]+','+(_0x51995b[_0x9742('0x82')]['waitForTheAssignedAgent']||0xa),'interval':_0x9742('0x98')});_0x51995b['forcedOwnership']=![];}return respondWithRpcPromise('Start',_0x9742('0x99'),_0x51995b);});}return respondWithRpcPromise(_0x9742('0x9a'),_0x9742('0x99'),_0x51995b);})['then'](function(_0x3e2570){respondWithRpcPromise(_0x9742('0x9b'),_0x9742('0x9b'),{'event':_0x9742('0x6d'),'message':_0x3e2570},client9002);return _0x3e2570;})[_0x9742('0x33')](respondWithResult(_0x27a0f0,null))['catch'](handleError(_0x27a0f0,null));};exports[_0x9742('0x9c')]=function(_0x2a4cf4,_0x822d0){var _0x32faad=_0x2a4cf4['params']['id'];var _0x23b398=_0x2a4cf4['body'];var _0x36017c=0xc8;var _0x2a3fdf=null;return db['sequelize']['transaction']({'isolationLevel':db['sequelize']['Transaction'][_0x9742('0x9d')][_0x9742('0x9e')]},function(_0x715aa9){return db[_0x9742('0x3d')][_0x9742('0x66')]({'where':{'id':_0x32faad},'transaction':_0x715aa9})[_0x9742('0x33')](function(_0x434508){if(_0x434508){return db[_0x9742('0x9f')][_0x9742('0x32')]({'where':{'OpenchannelAccountId':_0x32faad},'transaction':_0x715aa9})[_0x9742('0x33')](function(){var _0x314d4d=_[_0x9742('0x3c')](_0x23b398,function(_0x4ef84c){_0x4ef84c[_0x9742('0x63')]=_0x32faad;return _0x4ef84c;});return db['OpenchannelApplication'][_0x9742('0xa0')](_0x314d4d,{'transaction':_0x715aa9});});}else{_0x36017c=0x194;_0x2a3fdf=[];}});})['then'](function(){if(_0x36017c!==0x194){return db[_0x9742('0x9f')][_0x9742('0xa1')]({'where':{'OpenchannelAccountId':_0x32faad},'order':_0x9742('0x85')})[_0x9742('0x33')](function(_0x31b15e){_0x2a3fdf=_0x31b15e;});}})[_0x9742('0x25')](function(_0x459a67){_0x36017c=0x1f4;logger[_0x9742('0x21')](_0x459a67[_0x9742('0x37')]);if(_0x459a67[_0x9742('0x38')]){delete _0x459a67[_0x9742('0x38')];}_0x2a3fdf=_0x459a67;})['finally'](function(){if(_0x2a3fdf===null){_0x822d0[_0x9742('0x26')](_0x36017c);}else{if(_0x36017c===0x1f4){_0x822d0[_0x9742('0x27')](_0x36017c)['send'](_0x2a3fdf);}else{_0x822d0[_0x9742('0x27')](_0x36017c)[_0x9742('0x2d')](_0x2a3fdf);}}});};exports[_0x9742('0xa2')]=function(_0x97ee3e,_0x43e662,_0x455925){var _0x3745eb={};var _0x4b8c08={};var _0x58cf81;var _0x1ef642;return db[_0x9742('0x3d')][_0x9742('0x66')]({'where':{'id':_0x97ee3e[_0x9742('0x56')]['id']}})[_0x9742('0x33')](handleEntityNotFound(_0x43e662,null))['then'](function(_0x583f0a){if(_0x583f0a){_0x58cf81=_0x583f0a;_0x4b8c08[_0x9742('0x45')]=_[_0x9742('0x42')](db['OpenchannelApplication'][_0x9742('0x57')]);_0x4b8c08[_0x9742('0x41')]=_[_0x9742('0x42')](_0x97ee3e[_0x9742('0x41')]);_0x4b8c08[_0x9742('0x43')]=_[_0x9742('0x44')](_0x4b8c08[_0x9742('0x45')],_0x4b8c08[_0x9742('0x41')]);_0x3745eb[_0x9742('0x46')]=_[_0x9742('0x44')](_0x4b8c08['model'],qs[_0x9742('0x47')](_0x97ee3e['query'][_0x9742('0x47')]));_0x3745eb[_0x9742('0x46')]=_0x3745eb['attributes'][_0x9742('0x58')]?_0x3745eb['attributes']:_0x4b8c08[_0x9742('0x45')];_0x3745eb[_0x9742('0x4a')]=qs[_0x9742('0x4b')](_0x97ee3e['query']['sort']);_0x3745eb[_0x9742('0x4c')]=qs['filters'](_[_0x9742('0x4d')](_0x97ee3e[_0x9742('0x41')],_0x4b8c08[_0x9742('0x43')]));if(_0x97ee3e[_0x9742('0x41')][_0x9742('0x4e')]){_0x3745eb['where']=_[_0x9742('0x4f')](_0x3745eb[_0x9742('0x4c')],{'$or':_['map'](_0x3745eb[_0x9742('0x46')],function(_0x107c6d){var _0x184baa={};_0x184baa[_0x107c6d]={'$like':'%'+_0x97ee3e[_0x9742('0x41')][_0x9742('0x4e')]+'%'};return _0x184baa;})});}_0x3745eb=_[_0x9742('0x4f')]({},_0x3745eb,_0x97ee3e[_0x9742('0x50')]);return _0x58cf81[_0x9742('0xa2')](_0x3745eb);}})[_0x9742('0x33')](function(_0x51f45e){if(_0x51f45e){_0x1ef642=_0x51f45e[_0x9742('0x58')];if(!_0x97ee3e['query']['hasOwnProperty']('nolimit')){_0x3745eb[_0x9742('0x2b')]=qs[_0x9742('0x2b')](_0x97ee3e[_0x9742('0x41')][_0x9742('0x2b')]);_0x3745eb[_0x9742('0x2a')]=qs[_0x9742('0x2a')](_0x97ee3e[_0x9742('0x41')]['offset']);}return _0x58cf81[_0x9742('0xa2')](_0x3745eb);}})['then'](function(_0x248928){if(_0x248928){return _0x248928?{'count':_0x1ef642,'rows':_0x248928}:null;}})[_0x9742('0x33')](respondWithResult(_0x43e662,null))[_0x9742('0x25')](handleError(_0x43e662,null));};exports['getInteractions']=function(_0x448d65,_0x59feeb,_0x2d5f2d){var _0x45f887={'raw':![],'where':{}};var _0x4333f1={};var _0x28dec6={'count':0x0,'rows':[]};return db[_0x9742('0x3d')][_0x9742('0x66')]({'where':{'id':_0x448d65[_0x9742('0x56')]['id']}})[_0x9742('0x33')](handleEntityNotFound(_0x59feeb,null))[_0x9742('0x33')](function(_0x163ed4){if(_0x163ed4){_0x4333f1['model']=_['keys'](db['OpenchannelInteraction']['rawAttributes']);_0x4333f1[_0x9742('0x41')]=_[_0x9742('0x42')](_0x448d65[_0x9742('0x41')]);_0x4333f1['filters']=_[_0x9742('0x44')](_0x4333f1['model'],_0x4333f1['query']);_0x45f887[_0x9742('0x46')]=_[_0x9742('0x44')](_0x4333f1[_0x9742('0x45')],qs[_0x9742('0x47')](_0x448d65[_0x9742('0x41')][_0x9742('0x47')]));_0x45f887[_0x9742('0x46')]=_0x45f887['attributes'][_0x9742('0x58')]?_0x45f887[_0x9742('0x46')]:_0x4333f1[_0x9742('0x45')];if(!_0x448d65[_0x9742('0x41')][_0x9742('0x48')](_0x9742('0x49'))){_0x45f887[_0x9742('0x2b')]=qs[_0x9742('0x2b')](_0x448d65[_0x9742('0x41')][_0x9742('0x2b')]);_0x45f887[_0x9742('0x2a')]=qs['offset'](_0x448d65['query'][_0x9742('0x2a')]);}_0x45f887[_0x9742('0x4a')]=qs[_0x9742('0x4b')](_0x448d65['query'][_0x9742('0x4b')]);_0x45f887[_0x9742('0x4c')]=qs[_0x9742('0x43')](_[_0x9742('0x4d')](_0x448d65['query'],_0x4333f1['filters']));_0x45f887[_0x9742('0x4c')][_0x9742('0x63')]=_0x163ed4['id'];if(_0x448d65['query'][_0x9742('0x4e')]){_0x45f887['where']=_[_0x9742('0x4f')](_0x45f887['where'],{'$or':_['map'](_0x45f887['attributes'],function(_0x373b5f){var _0x4aaa5d={};_0x4aaa5d[_0x373b5f]={'$like':'%'+_0x448d65[_0x9742('0x41')][_0x9742('0x4e')]+'%'};return _0x4aaa5d;})});}_0x45f887=_[_0x9742('0x4f')]({},_0x45f887,_0x448d65[_0x9742('0x50')]);return db[_0x9742('0x8a')]['count']({'where':_0x45f887[_0x9742('0x4c')]})[_0x9742('0x33')](function(_0x163cf7){_0x28dec6[_0x9742('0x29')]=_0x163cf7;if(_0x448d65[_0x9742('0x41')][_0x9742('0x51')]){_0x45f887['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db['User'],'as':_0x9742('0xa3'),'attributes':['name',_0x9742('0xa4'),'internal'],'required':![]},{'model':db[_0x9742('0xa5')],'as':_0x9742('0xa6'),'attributes':['id',_0x9742('0x38'),_0x9742('0xa7')],'where':_0x448d65['query'][_0x9742('0xa8')]?{'id':_0x448d65[_0x9742('0x41')][_0x9742('0xa8')]}:undefined,'required':_0x448d65[_0x9742('0x41')][_0x9742('0xa8')]?!![]:![]}];}return db[_0x9742('0x8a')]['findAll'](_0x45f887);})[_0x9742('0x33')](function(_0x51a56d){_0x28dec6[_0x9742('0x54')]=_0x51a56d;return _0x28dec6;});}})[_0x9742('0x33')](respondWithFilteredResult(_0x59feeb,_0x45f887))[_0x9742('0x25')](handleError(_0x59feeb,null));};exports[_0x9742('0xa9')]=function(_0x450151,_0x1d89a2,_0x14b171){return db['OpenchannelAccount']['find']({'where':{'id':_0x450151[_0x9742('0x56')]['id']}})[_0x9742('0x33')](handleEntityNotFound(_0x1d89a2,null))[_0x9742('0x33')](function(_0x2324e3){if(_0x2324e3){return _0x2324e3[_0x9742('0xa9')](_0x450151['body'][_0x9742('0x68')],_['omit'](_0x450151['body'],['ids','id'])||{})[_0x9742('0xaa')](function(_0x26fd68){for(var _0x24437c=0x0;_0x24437c<_0x450151[_0x9742('0x5b')][_0x9742('0x68')][_0x9742('0x58')];_0x24437c+=0x1){socket[_0x9742('0xab')](_0x9742('0xac'),{'UserId':Number(_0x450151[_0x9742('0x5b')][_0x9742('0x68')][_0x24437c]),'OpenchannelAccountId':Number(_0x450151[_0x9742('0x56')]['id'])});}return _0x26fd68;});}})['then'](respondWithResult(_0x1d89a2,null))[_0x9742('0x25')](handleError(_0x1d89a2,null));};exports[_0x9742('0xad')]=function(_0x5c3c5c,_0x11e872,_0x14d986){return db[_0x9742('0x3d')][_0x9742('0x59')]({'where':{'id':_0x5c3c5c['params']['id']}})[_0x9742('0x33')](handleEntityNotFound(_0x11e872,null))['then'](function(_0x1e4458){if(_0x1e4458){return _0x1e4458[_0x9742('0xad')](_0x5c3c5c[_0x9742('0x41')][_0x9742('0x68')])[_0x9742('0x33')](function(){if(_[_0x9742('0xae')](_0x5c3c5c[_0x9742('0x41')][_0x9742('0x68')])){for(var _0x302b0c=0x0;_0x302b0c<_0x5c3c5c[_0x9742('0x41')][_0x9742('0x68')][_0x9742('0x58')];_0x302b0c+=0x1){socket[_0x9742('0xab')](_0x9742('0xaf'),{'UserId':Number(_0x5c3c5c['query'][_0x9742('0x68')][_0x302b0c]),'OpenchannelAccountId':Number(_0x5c3c5c[_0x9742('0x56')]['id'])});}}else{socket[_0x9742('0xab')](_0x9742('0xaf'),{'UserId':Number(_0x5c3c5c[_0x9742('0x41')][_0x9742('0x68')]),'OpenchannelAccountId':Number(_0x5c3c5c[_0x9742('0x56')]['id'])});}});}})[_0x9742('0x33')](respondWithStatusCode(_0x11e872,null))[_0x9742('0x25')](handleError(_0x11e872,null));};exports[_0x9742('0xb0')]=function(_0x36be8d,_0x98d890,_0x548f0d){var _0x5cb840={};var _0x492a50={};var _0x44aca8;var _0x2105a1;return db[_0x9742('0x3d')][_0x9742('0x66')]({'where':{'id':_0x36be8d[_0x9742('0x56')]['id']}})[_0x9742('0x33')](handleEntityNotFound(_0x98d890,null))[_0x9742('0x33')](function(_0x2cae8c){if(_0x2cae8c){_0x44aca8=_0x2cae8c;_0x492a50[_0x9742('0x45')]=_['keys'](db[_0x9742('0x94')][_0x9742('0x57')]);_0x492a50['query']=_[_0x9742('0x42')](_0x36be8d['query']);_0x492a50['filters']=_[_0x9742('0x44')](_0x492a50[_0x9742('0x45')],_0x492a50['query']);_0x5cb840['attributes']=_[_0x9742('0x44')](_0x492a50[_0x9742('0x45')],qs[_0x9742('0x47')](_0x36be8d[_0x9742('0x41')]['fields']));_0x5cb840[_0x9742('0x46')]=_0x5cb840[_0x9742('0x46')][_0x9742('0x58')]?_0x5cb840['attributes']:_0x492a50['model'];_0x5cb840[_0x9742('0x4a')]=qs[_0x9742('0x4b')](_0x36be8d['query'][_0x9742('0x4b')]);_0x5cb840[_0x9742('0x4c')]=qs[_0x9742('0x43')](_[_0x9742('0x4d')](_0x36be8d[_0x9742('0x41')],_0x492a50['filters']));if(_0x36be8d['query'][_0x9742('0x4e')]){_0x5cb840[_0x9742('0x4c')]=_[_0x9742('0x4f')](_0x5cb840[_0x9742('0x4c')],{'$or':_[_0x9742('0x3c')](_0x5cb840['attributes'],function(_0x5c708e){var _0x371a51={};_0x371a51[_0x5c708e]={'$like':'%'+_0x36be8d[_0x9742('0x41')]['filter']+'%'};return _0x371a51;})});}_0x5cb840=_[_0x9742('0x4f')]({},_0x5cb840,_0x36be8d[_0x9742('0x50')]);return _0x44aca8[_0x9742('0xb0')](_0x5cb840);}})[_0x9742('0x33')](function(_0x593500){if(_0x593500){_0x2105a1=_0x593500[_0x9742('0x58')];if(!_0x36be8d[_0x9742('0x41')][_0x9742('0x48')](_0x9742('0x49'))){_0x5cb840[_0x9742('0x2b')]=qs[_0x9742('0x2b')](_0x36be8d[_0x9742('0x41')][_0x9742('0x2b')]);_0x5cb840[_0x9742('0x2a')]=qs[_0x9742('0x2a')](_0x36be8d[_0x9742('0x41')][_0x9742('0x2a')]);}return _0x44aca8[_0x9742('0xb0')](_0x5cb840);}})[_0x9742('0x33')](function(_0x311e08){if(_0x311e08){return _0x311e08?{'count':_0x2105a1,'rows':_0x311e08}:null;}})[_0x9742('0x33')](respondWithResult(_0x98d890,null))[_0x9742('0x25')](handleError(_0x98d890,null));};exports[_0x9742('0x39')]=function(_0x4c8290,_0x5ed8a9,_0x9f9dd8){var _0x526472,_0x533db1,_0x1f2b36;if(_[_0x9742('0x75')](_0x4c8290[_0x9742('0x5b')][_0x9742('0x5b')])||_0x4c8290['body'][_0x9742('0x5b')]===''){throw new db[(_0x9742('0x6f'))][(_0x9742('0x78'))](_0x9742('0x79'));}if(_[_0x9742('0x75')](_0x4c8290[_0x9742('0x5b')]['to'])){}_0x526472=_0x4c8290['body']['to'];return db['OpenchannelAccount'][_0x9742('0x66')]({'where':{'id':_0x4c8290[_0x9742('0x56')]['id']}})[_0x9742('0x33')](handleEntityNotFound(_0x5ed8a9,null))[_0x9742('0x33')](function(_0x2b7d33){if(_0x2b7d33){return db[_0x9742('0x3d')][_0x9742('0x59')]({'where':{'id':_0x2b7d33['id']},'include':[{'model':db[_0x9742('0x7d')],'as':_0x9742('0x7e'),'include':[{'model':db[_0x9742('0x6e')],'as':_0x9742('0x7f'),'where':{[_0x2b7d33[_0x9742('0x7a')]]:_0x526472},'limit':0x1,'order':[[_0x9742('0x73'),_0x9742('0x80')]]}]}]})[_0x9742('0x33')](handleEntityNotFound(_0x5ed8a9,null))['then'](function(_0x30a202){if(_0x30a202&&_0x30a202['List']){_0x533db1=_0x30a202['get']({'plain':!![]});if(_0x533db1[_0x9742('0x7e')]&&_0x533db1[_0x9742('0x7e')][_0x9742('0x7f')]['length']){return _0x533db1[_0x9742('0x7e')][_0x9742('0x7f')][0x0];}return db[_0x9742('0x6e')]['create'](_[_0x9742('0x16')](_0x4c8290[_0x9742('0x5b')],{'firstName':_0x526472,[_0x30a202['mapKey']]:_0x526472,'phone':_0x526472,'ListId':_0x533db1['ListId']}));}})[_0x9742('0x33')](handleEntityNotFound(_0x5ed8a9,null))['then'](function(_0x10d799){if(_0x10d799){_0x1f2b36=_0x10d799;return db[_0x9742('0x8a')]['find']({'where':{'ContactId':_0x1f2b36['id'],'closed':![],'OpenchannelAccountId':_0x533db1['id']}})[_0x9742('0x33')](function(_0x3082f4){if(_0x3082f4){return[_0x3082f4,![]];}return db[_0x9742('0x8a')]['create']({'UserId':_0x4c8290[_0x9742('0x5c')]['id'],'ContactId':_0x1f2b36['id'],'OpenchannelAccountId':_0x533db1['id'],'lastMsgDirection':'out','firstMsgDirection':_0x9742('0xb1'),'Messages':[_[_0x9742('0x4f')](_0x4c8290[_0x9742('0x5b')],{'read':![],'body':_0x4c8290[_0x9742('0x5b')][_0x9742('0x5b')],'OpenchannelAccountId':_0x533db1['id'],'UserId':_0x4c8290[_0x9742('0x5c')]['id'],'ContactId':_0x1f2b36['id']})]},{'include':[{'model':db[_0x9742('0xb2')],'as':_0x9742('0xb3')}]})[_0x9742('0x33')](function(_0x515496){return[_0x515496,!![]];});});}})['spread'](function(_0x3b09c2,_0x3b24e9){if(_0x3b24e9){return _0x3b09c2;}return db['OpenchannelMessage'][_0x9742('0x5a')](_['merge'](_0x4c8290[_0x9742('0x5b')],{'read':![],'body':_0x4c8290['body'][_0x9742('0x5b')],'OpenchannelAccountId':_0x533db1['id'],'OpenchannelInteractionId':_0x3b09c2['id'],'UserId':_0x4c8290[_0x9742('0x5c')]['id'],'ContactId':_0x1f2b36['id']}))[_0x9742('0x33')](function(_0x3d6349){_0x3b09c2[_0x9742('0xb4')]['Messages']=[];_0x3b09c2[_0x9742('0xb4')]['Messages']['push'](_0x3d6349['dataValues']);return _0x3b09c2;});});}})[_0x9742('0x33')](respondWithResult(_0x5ed8a9,null))[_0x9742('0x25')](handleError(_0x5ed8a9,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 37788c1..66a78a6 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 _0xa9e0=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount','update','emit'];(function(_0x25efdf,_0x521462){var _0x22c495=function(_0x184469){while(--_0x184469){_0x25efdf['push'](_0x25efdf['shift']());}};_0x22c495(++_0x521462);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var EventEmitter=require(_0x0a9e('0x0'));var OpenchannelAccount=require(_0x0a9e('0x1'))['db'][_0x0a9e('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0a9e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x333808){return function(_0x432180,_0x2ab90b,_0x991246){OpenchannelAccountEvents[_0x0a9e('0x4')](_0x333808+':'+_0x432180['id'],_0x432180);OpenchannelAccountEvents['emit'](_0x333808,_0x432180);_0x991246(null);};}for(var e in events){if(events[_0x0a9e('0x5')](e)){var event=events[e];OpenchannelAccount[_0x0a9e('0x6')](e,emitEvent(event));}}module[_0x0a9e('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xe5b5=['hook','exports','events','../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0xbe6e9,_0x119201){var _0x17a705=function(_0x3d5294){while(--_0x3d5294){_0xbe6e9['push'](_0xbe6e9['shift']());}};_0x17a705(++_0x119201);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x1529a3,_0x529f63){_0x1529a3=_0x1529a3-0x0;var _0x1a0d4b=_0xe5b5[_0x1529a3];return _0x1a0d4b;};'use strict';var EventEmitter=require(_0x5e5b('0x0'));var OpenchannelAccount=require(_0x5e5b('0x1'))['db'][_0x5e5b('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x5e5b('0x3')](0x0);var events={'afterCreate':_0x5e5b('0x4'),'afterUpdate':_0x5e5b('0x5'),'afterDestroy':_0x5e5b('0x6')};function emitEvent(_0x3dc763){return function(_0xf20c6a,_0x20a50c,_0xdc6616){OpenchannelAccountEvents[_0x5e5b('0x7')](_0x3dc763+':'+_0xf20c6a['id'],_0xf20c6a);OpenchannelAccountEvents[_0x5e5b('0x7')](_0x3dc763,_0xf20c6a);_0xdc6616(null);};}for(var e in events){if(events[_0x5e5b('0x8')](e)){var event=events[e];OpenchannelAccount[_0x5e5b('0x9')](e,emitEvent(event));}}module[_0x5e5b('0xa')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index d1370fa..978c4d3 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(_0x4b40fe,_0x505e2f){var _0x3d990c=function(_0x18afd8){while(--_0x18afd8){_0x4b40fe['push'](_0x4b40fe['shift']());}};_0x3d990c(++_0x505e2f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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(_0x5eed95,_0x414801){var _0x2ba4ad=function(_0xd0f19f){while(--_0xd0f19f){_0x5eed95['push'](_0x5eed95['shift']());}};_0x2ba4ad(++_0x414801);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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 a67dbbd..5e2e8cd 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 _0x91a7=['catch','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x159e56,_0x1adcdf){var _0x2af053=function(_0x31b526){while(--_0x31b526){_0x159e56['push'](_0x159e56['shift']());}};_0x2af053(++_0x1adcdf);}(_0x91a7,0xe7));var _0x791a=function(_0x2cc115,_0x5cdf6c){_0x2cc115=_0x2cc115-0x0;var _0x5d28e3=_0x91a7[_0x2cc115];return _0x5d28e3;};'use strict';var _=require('lodash');var util=require(_0x791a('0x0'));var moment=require(_0x791a('0x1'));var BPromise=require(_0x791a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x791a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x791a('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x791a('0x5'));var jayson=require(_0x791a('0x6'));var client=jayson['client'][_0x791a('0x7')]({'port':0x232a});config['redis']=_[_0x791a('0x8')](config[_0x791a('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x791a('0xa'))(new Redis(config[_0x791a('0x9')]));require(_0x791a('0xb'))[_0x791a('0xc')](socket);function respondWithRpcPromise(_0x266e4b,_0x5249d5,_0x21f0e0){return new BPromise(function(_0x38f7c2,_0x57e99c){return client[_0x791a('0xd')](_0x266e4b,_0x21f0e0)[_0x791a('0xe')](function(_0x167bc4){logger[_0x791a('0xf')](_0x791a('0x10'),_0x5249d5,_0x791a('0x11'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x5249d5,_0x791a('0x11'),JSON[_0x791a('0x12')](_0x167bc4));if(_0x167bc4['error']){if(_0x167bc4[_0x791a('0x13')][_0x791a('0x14')]===0x1f4){logger['error'](_0x791a('0x10'),_0x5249d5,_0x167bc4[_0x791a('0x13')][_0x791a('0x15')]);return _0x57e99c(_0x167bc4[_0x791a('0x13')]['message']);}logger[_0x791a('0x13')]('OpenchannelAccount,\x20%s,\x20%s',_0x5249d5,_0x167bc4[_0x791a('0x13')][_0x791a('0x15')]);return _0x38f7c2(_0x167bc4['error'][_0x791a('0x15')]);}else{logger['info'](_0x791a('0x10'),_0x5249d5,'request\x20sent');_0x38f7c2(_0x167bc4['result']['message']);}})[_0x791a('0x16')](function(_0x52fa43){logger['error'](_0x791a('0x10'),_0x5249d5,_0x52fa43);_0x57e99c(_0x52fa43);});});} \ No newline at end of file +var _0x9861=['debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','info','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','request\x20sent'];(function(_0x418918,_0x398bb9){var _0x3db56b=function(_0x4aee0b){while(--_0x4aee0b){_0x418918['push'](_0x418918['shift']());}};_0x3db56b(++_0x398bb9);}(_0x9861,0x176));var _0x1986=function(_0x46d816,_0x4d4f26){_0x46d816=_0x46d816-0x0;var _0x5a01d9=_0x9861[_0x46d816];return _0x5a01d9;};'use strict';var _=require(_0x1986('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1986('0x1'));var rs=require(_0x1986('0x2'));var fs=require('fs');var Redis=require(_0x1986('0x3'));var db=require(_0x1986('0x4'))['db'];var utils=require(_0x1986('0x5'));var logger=require(_0x1986('0x6'))('rpc');var config=require(_0x1986('0x7'));var jayson=require(_0x1986('0x8'));var client=jayson[_0x1986('0x9')][_0x1986('0xa')]({'port':0x232a});config[_0x1986('0xb')]=_[_0x1986('0xc')](config[_0x1986('0xb')],{'host':_0x1986('0xd'),'port':0x18eb});var socket=require(_0x1986('0xe'))(new Redis(config[_0x1986('0xb')]));require('./openchannelAccount.socket')[_0x1986('0xf')](socket);function respondWithRpcPromise(_0x1578f9,_0x66f64d,_0xb0e57b){return new BPromise(function(_0x47ab59,_0x3ef718){return client[_0x1986('0x10')](_0x1578f9,_0xb0e57b)['then'](function(_0x1e337d){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x66f64d,_0x1986('0x11'));logger[_0x1986('0x12')](_0x1986('0x13'),_0x66f64d,_0x1986('0x11'),JSON[_0x1986('0x14')](_0x1e337d));if(_0x1e337d[_0x1986('0x15')]){if(_0x1e337d[_0x1986('0x15')][_0x1986('0x16')]===0x1f4){logger[_0x1986('0x15')](_0x1986('0x17'),_0x66f64d,_0x1e337d['error']['message']);return _0x3ef718(_0x1e337d[_0x1986('0x15')][_0x1986('0x18')]);}logger['error'](_0x1986('0x17'),_0x66f64d,_0x1e337d[_0x1986('0x15')][_0x1986('0x18')]);return _0x47ab59(_0x1e337d[_0x1986('0x15')][_0x1986('0x18')]);}else{logger[_0x1986('0x19')](_0x1986('0x17'),_0x66f64d,_0x1986('0x11'));_0x47ab59(_0x1e337d[_0x1986('0x1a')][_0x1986('0x18')]);}})[_0x1986('0x1b')](function(_0x235524){logger[_0x1986('0x15')](_0x1986('0x17'),_0x66f64d,_0x235524);_0x3ef718(_0x235524);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 77df516..1e80d56 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 _0x6ce9=['remove','emit','removeListener','openchannelAccount:','./openchannelAccount.events','save'];(function(_0x486f1d,_0x90c2b5){var _0x5a2c2d=function(_0x1a5f79){while(--_0x1a5f79){_0x486f1d['push'](_0x486f1d['shift']());}};_0x5a2c2d(++_0x90c2b5);}(_0x6ce9,0x76));var _0x96ce=function(_0x3f849e,_0x1ab5db){_0x3f849e=_0x3f849e-0x0;var _0x1cf2bd=_0x6ce9[_0x3f849e];return _0x1cf2bd;};'use strict';var OpenchannelAccountEvents=require(_0x96ce('0x0'));var events=[_0x96ce('0x1'),_0x96ce('0x2'),'update'];function createListener(_0x48ccd5,_0x18bbb2){return function(_0x5bf6d5){_0x18bbb2[_0x96ce('0x3')](_0x48ccd5,_0x5bf6d5);};}function removeListener(_0x18a969,_0x2b5c98){return function(){OpenchannelAccountEvents[_0x96ce('0x4')](_0x18a969,_0x2b5c98);};}exports['register']=function(_0xce6b4f){for(var _0x2fe06e=0x0,_0x1a24c7=events['length'];_0x2fe06e<_0x1a24c7;_0x2fe06e++){var _0x1abd8c=events[_0x2fe06e];var _0x16a140=createListener(_0x96ce('0x5')+_0x1abd8c,_0xce6b4f);OpenchannelAccountEvents['on'](_0x1abd8c,_0x16a140);}}; \ No newline at end of file +var _0x6c4b=['emit','length','openchannelAccount:','./openchannelAccount.events','save','remove'];(function(_0x13d9e6,_0x2a6819){var _0x37d935=function(_0x568ab9){while(--_0x568ab9){_0x13d9e6['push'](_0x13d9e6['shift']());}};_0x37d935(++_0x2a6819);}(_0x6c4b,0x93));var _0xb6c4=function(_0x475741,_0x30bf38){_0x475741=_0x475741-0x0;var _0x4e34ec=_0x6c4b[_0x475741];return _0x4e34ec;};'use strict';var OpenchannelAccountEvents=require(_0xb6c4('0x0'));var events=[_0xb6c4('0x1'),_0xb6c4('0x2'),'update'];function createListener(_0x1f07f4,_0x2a1872){return function(_0x235930){_0x2a1872[_0xb6c4('0x3')](_0x1f07f4,_0x235930);};}function removeListener(_0x459ef7,_0x27f46b){return function(){OpenchannelAccountEvents['removeListener'](_0x459ef7,_0x27f46b);};}exports['register']=function(_0x1f7abc){for(var _0x5a290a=0x0,_0x109973=events[_0xb6c4('0x4')];_0x5a290a<_0x109973;_0x5a290a++){var _0x554935=events[_0x5a290a];var _0x312141=createListener(_0xb6c4('0x5')+_0x554935,_0x1f7abc);OpenchannelAccountEvents['on'](_0x554935,_0x312141);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 261343f..a4ba30d 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 _0x6073=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','create','put','delete','destroy','exports'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x6073,0xd2));var _0x3607=function(_0x37999b,_0x5b2b56){_0x37999b=_0x37999b-0x0;var _0x2151c6=_0x6073[_0x37999b];return _0x2151c6;};'use strict';var multer=require(_0x3607('0x0'));var util=require(_0x3607('0x1'));var path=require(_0x3607('0x2'));var timeout=require(_0x3607('0x3'));var express=require(_0x3607('0x4'));var router=express[_0x3607('0x5')]();var fs_extra=require(_0x3607('0x6'));var auth=require(_0x3607('0x7'));var interaction=require(_0x3607('0x8'));var config=require(_0x3607('0x9'));var controller=require(_0x3607('0xa'));router[_0x3607('0xb')]('/',auth[_0x3607('0xc')](),controller[_0x3607('0xd')]);router[_0x3607('0xb')](_0x3607('0xe'),auth['isAuthenticated'](),controller[_0x3607('0xf')]);router['post']('/',auth[_0x3607('0xc')](),controller[_0x3607('0x10')]);router[_0x3607('0x11')]('/:id',auth[_0x3607('0xc')](),controller['update']);router[_0x3607('0x12')](_0x3607('0xe'),auth['isAuthenticated'](),controller[_0x3607('0x13')]);module[_0x3607('0x14')]=router; \ No newline at end of file +var _0x8924=['post','create','put','update','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelApplication.controller','isAuthenticated','index','get','/:id','show'];(function(_0x339985,_0x4613c6){var _0x1264a8=function(_0x4e0940){while(--_0x4e0940){_0x339985['push'](_0x339985['shift']());}};_0x1264a8(++_0x4613c6);}(_0x8924,0x1f4));var _0x4892=function(_0x56989c,_0x6781f0){_0x56989c=_0x56989c-0x0;var _0x22ab27=_0x8924[_0x56989c];return _0x22ab27;};'use strict';var multer=require(_0x4892('0x0'));var util=require(_0x4892('0x1'));var path=require('path');var timeout=require(_0x4892('0x2'));var express=require('express');var router=express[_0x4892('0x3')]();var fs_extra=require(_0x4892('0x4'));var auth=require(_0x4892('0x5'));var interaction=require(_0x4892('0x6'));var config=require('../../config/environment');var controller=require(_0x4892('0x7'));router['get']('/',auth[_0x4892('0x8')](),controller[_0x4892('0x9')]);router[_0x4892('0xa')](_0x4892('0xb'),auth[_0x4892('0x8')](),controller[_0x4892('0xc')]);router[_0x4892('0xd')]('/',auth['isAuthenticated'](),controller[_0x4892('0xe')]);router[_0x4892('0xf')](_0x4892('0xb'),auth['isAuthenticated'](),controller[_0x4892('0x10')]);router[_0x4892('0x11')]('/:id',auth[_0x4892('0x8')](),controller['destroy']);module[_0x4892('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 2d66f20..f8f9131 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 _0x01ae=['INTEGER','TEXT','STRING','*,*,*,*','sequelize'];(function(_0x2fe44c,_0x1800bc){var _0x2005b8=function(_0x40a3d2){while(--_0x40a3d2){_0x2fe44c['push'](_0x2fe44c['shift']());}};_0x2005b8(++_0x1800bc);}(_0x01ae,0x16c));var _0xe01a=function(_0x4fbb86,_0x374ed0){_0x4fbb86=_0x4fbb86-0x0;var _0xb141fe=_0x01ae[_0x4fbb86];return _0xb141fe;};'use strict';var Sequelize=require(_0xe01a('0x0'));module['exports']={'priority':{'type':Sequelize[_0xe01a('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xe01a('0x2')]()},'description':{'type':Sequelize[_0xe01a('0x3')]},'interval':{'type':Sequelize[_0xe01a('0x3')],'defaultValue':_0xe01a('0x4')}}; \ No newline at end of file +var _0x5b24=['TEXT','STRING','noop'];(function(_0x49e065,_0x1cf4bf){var _0x1dd607=function(_0x390870){while(--_0x390870){_0x49e065['push'](_0x49e065['shift']());}};_0x1dd607(++_0x1cf4bf);}(_0x5b24,0x1a5));var _0x45b2=function(_0xf34895,_0x21fb70){_0xf34895=_0xf34895-0x0;var _0x143f44=_0x5b24[_0xf34895];return _0x143f44;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x45b2('0x0')],'allowNull':![],'defaultValue':_0x45b2('0x1')},'appdata':{'type':Sequelize[_0x45b2('0x2')]()},'description':{'type':Sequelize[_0x45b2('0x0')]},'interval':{'type':Sequelize[_0x45b2('0x0')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 56766af..79e14f2 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 _0x9e32=['update','destroy','then','error','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','OpenchannelApplication','includeAll','findAll','rows','catch','show','params','length','include','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save'];(function(_0x262201,_0x297619){var _0x2a2ee3=function(_0x12d9b7){while(--_0x12d9b7){_0x262201['push'](_0x262201['shift']());}};_0x2a2ee3(++_0x297619);}(_0x9e32,0x111));var _0x29e3=function(_0x273f88,_0x5d4150){_0x273f88=_0x273f88-0x0;var _0x177ca1=_0x9e32[_0x273f88];return _0x177ca1;};'use strict';var emlformat=require(_0x29e3('0x0'));var rimraf=require(_0x29e3('0x1'));var zipdir=require(_0x29e3('0x2'));var jsonpatch=require(_0x29e3('0x3'));var rp=require(_0x29e3('0x4'));var moment=require(_0x29e3('0x5'));var BPromise=require(_0x29e3('0x6'));var Mustache=require(_0x29e3('0x7'));var util=require(_0x29e3('0x8'));var path=require(_0x29e3('0x9'));var sox=require(_0x29e3('0xa'));var csv=require(_0x29e3('0xb'));var ejs=require(_0x29e3('0xc'));var fs=require('fs');var fs_extra=require(_0x29e3('0xd'));var _=require(_0x29e3('0xe'));var squel=require(_0x29e3('0xf'));var crypto=require(_0x29e3('0x10'));var jsforce=require(_0x29e3('0x11'));var deskjs=require('desk.js');var toCsv=require(_0x29e3('0xb'));var querystring=require(_0x29e3('0x12'));var Papa=require(_0x29e3('0x13'));var Redis=require(_0x29e3('0x14'));var authService=require(_0x29e3('0x15'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x29e3('0x16'))('api');var utils=require(_0x29e3('0x17'));var config=require(_0x29e3('0x18'));var licenseUtil=require(_0x29e3('0x19'));var db=require(_0x29e3('0x1a'))['db'];function respondWithStatusCode(_0x541eb9,_0x1c2bfd){_0x1c2bfd=_0x1c2bfd||0xcc;return function(_0x3d87ef){if(_0x3d87ef){return _0x541eb9[_0x29e3('0x1b')](_0x1c2bfd);}return _0x541eb9[_0x29e3('0x1c')](_0x1c2bfd)[_0x29e3('0x1d')]();};}function respondWithResult(_0x710fb7,_0xf99c93){_0xf99c93=_0xf99c93||0xc8;return function(_0x199ecf){if(_0x199ecf){return _0x710fb7[_0x29e3('0x1c')](_0xf99c93)['json'](_0x199ecf);}};}function respondWithFilteredResult(_0x18a3bf,_0x3a6e6e){return function(_0x50c988){if(_0x50c988){var _0x1dec6f=typeof _0x3a6e6e[_0x29e3('0x1e')]===_0x29e3('0x1f')&&typeof _0x3a6e6e[_0x29e3('0x20')]===_0x29e3('0x1f');var _0x32579a=_0x50c988[_0x29e3('0x21')];var _0x5109a1=_0x1dec6f?0x0:_0x3a6e6e[_0x29e3('0x1e')];var _0x4765a1=_0x1dec6f?_0x50c988['count']:_0x3a6e6e[_0x29e3('0x1e')]+_0x3a6e6e['limit'];var _0x2527b8;if(_0x4765a1>=_0x32579a){_0x4765a1=_0x32579a;_0x2527b8=0xc8;}else{_0x2527b8=0xce;}_0x18a3bf[_0x29e3('0x1c')](_0x2527b8);return _0x18a3bf['set'](_0x29e3('0x22'),_0x5109a1+'-'+_0x4765a1+'/'+_0x32579a)[_0x29e3('0x23')](_0x50c988);}return null;};}function patchUpdates(_0x57d66c){return function(_0x2383a1){try{jsonpatch[_0x29e3('0x24')](_0x2383a1,_0x57d66c,!![]);}catch(_0x193169){return BPromise[_0x29e3('0x25')](_0x193169);}return _0x2383a1[_0x29e3('0x26')]();};}function saveUpdates(_0x53a165,_0x370b95){return function(_0x4c5576){if(_0x4c5576){return _0x4c5576[_0x29e3('0x27')](_0x53a165)['then'](function(_0x5292da){return _0x5292da;});}return null;};}function removeEntity(_0x4d9797,_0xb0107a){return function(_0x57b2b8){if(_0x57b2b8){return _0x57b2b8[_0x29e3('0x28')]()[_0x29e3('0x29')](function(){_0x4d9797[_0x29e3('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2898a0,_0x3cd06c){return function(_0x41c5c1){if(!_0x41c5c1){_0x2898a0[_0x29e3('0x1b')](0x194);}return _0x41c5c1;};}function handleError(_0x51cb17,_0x37489d){_0x37489d=_0x37489d||0x1f4;return function(_0x1e9672){logger[_0x29e3('0x2a')](_0x1e9672['stack']);if(_0x1e9672[_0x29e3('0x2b')]){delete _0x1e9672[_0x29e3('0x2b')];}_0x51cb17[_0x29e3('0x1c')](_0x37489d)['send'](_0x1e9672);};}exports[_0x29e3('0x2c')]=function(_0x90837c,_0x2bf4ee){var _0xb8b87f={},_0x676e5e={},_0x2aabf2={'count':0x0,'rows':[]};var _0xabc56f=_[_0x29e3('0x2d')](db['OpenchannelApplication'][_0x29e3('0x2e')],function(_0x1f42a6){return{'name':_0x1f42a6[_0x29e3('0x2f')],'type':_0x1f42a6[_0x29e3('0x30')][_0x29e3('0x31')]};});_0x676e5e[_0x29e3('0x32')]=_['map'](_0xabc56f,_0x29e3('0x2b'));_0x676e5e[_0x29e3('0x33')]=_[_0x29e3('0x34')](_0x90837c[_0x29e3('0x33')]);_0x676e5e[_0x29e3('0x35')]=_['intersection'](_0x676e5e[_0x29e3('0x32')],_0x676e5e[_0x29e3('0x33')]);_0xb8b87f['attributes']=_[_0x29e3('0x36')](_0x676e5e['model'],qs['fields'](_0x90837c[_0x29e3('0x33')][_0x29e3('0x37')]));_0xb8b87f[_0x29e3('0x38')]=_0xb8b87f[_0x29e3('0x38')]['length']?_0xb8b87f[_0x29e3('0x38')]:_0x676e5e[_0x29e3('0x32')];if(!_0x90837c[_0x29e3('0x33')]['hasOwnProperty'](_0x29e3('0x39'))){_0xb8b87f['limit']=qs[_0x29e3('0x20')](_0x90837c['query'][_0x29e3('0x20')]);_0xb8b87f[_0x29e3('0x1e')]=qs[_0x29e3('0x1e')](_0x90837c[_0x29e3('0x33')][_0x29e3('0x1e')]);}_0xb8b87f[_0x29e3('0x3a')]=qs[_0x29e3('0x3b')](_0x90837c[_0x29e3('0x33')][_0x29e3('0x3b')]);_0xb8b87f['where']=qs[_0x29e3('0x35')](_[_0x29e3('0x3c')](_0x90837c[_0x29e3('0x33')],_0x676e5e['filters']),_0xabc56f);if(_0x90837c[_0x29e3('0x33')][_0x29e3('0x3d')]){_0xb8b87f[_0x29e3('0x3e')]=_[_0x29e3('0x3f')](_0xb8b87f[_0x29e3('0x3e')],{'$or':_[_0x29e3('0x2d')](_0xabc56f,function(_0xcb419){if(_0xcb419[_0x29e3('0x30')]!==_0x29e3('0x40')){var _0x1432b9={};_0x1432b9[_0xcb419['name']]={'$like':'%'+_0x90837c[_0x29e3('0x33')][_0x29e3('0x3d')]+'%'};return _0x1432b9;}})});}_0xb8b87f=_[_0x29e3('0x3f')]({},_0xb8b87f,_0x90837c['options']);var _0x4e07ac={'where':_0xb8b87f[_0x29e3('0x3e')]};return db[_0x29e3('0x41')][_0x29e3('0x21')](_0x4e07ac)[_0x29e3('0x29')](function(_0x24871e){_0x2aabf2['count']=_0x24871e;if(_0x90837c[_0x29e3('0x33')][_0x29e3('0x42')]){_0xb8b87f['include']=[{'all':!![]}];}return db['OpenchannelApplication'][_0x29e3('0x43')](_0xb8b87f);})[_0x29e3('0x29')](function(_0x27a8fd){_0x2aabf2[_0x29e3('0x44')]=_0x27a8fd;return _0x2aabf2;})[_0x29e3('0x29')](respondWithFilteredResult(_0x2bf4ee,_0xb8b87f))[_0x29e3('0x45')](handleError(_0x2bf4ee,null));};exports[_0x29e3('0x46')]=function(_0x376c34,_0x4ad4db){var _0x2ad88b={'raw':!![],'where':{'id':_0x376c34[_0x29e3('0x47')]['id']}},_0x56a1d6={};_0x56a1d6[_0x29e3('0x32')]=_[_0x29e3('0x34')](db['OpenchannelApplication'][_0x29e3('0x2e')]);_0x56a1d6[_0x29e3('0x33')]=_[_0x29e3('0x34')](_0x376c34[_0x29e3('0x33')]);_0x56a1d6[_0x29e3('0x35')]=_[_0x29e3('0x36')](_0x56a1d6[_0x29e3('0x32')],_0x56a1d6[_0x29e3('0x33')]);_0x2ad88b['attributes']=_[_0x29e3('0x36')](_0x56a1d6[_0x29e3('0x32')],qs[_0x29e3('0x37')](_0x376c34[_0x29e3('0x33')][_0x29e3('0x37')]));_0x2ad88b[_0x29e3('0x38')]=_0x2ad88b['attributes'][_0x29e3('0x48')]?_0x2ad88b[_0x29e3('0x38')]:_0x56a1d6[_0x29e3('0x32')];if(_0x376c34['query'][_0x29e3('0x42')]){_0x2ad88b[_0x29e3('0x49')]=[{'all':!![]}];}_0x2ad88b=_[_0x29e3('0x3f')]({},_0x2ad88b,_0x376c34[_0x29e3('0x4a')]);return db['OpenchannelApplication'][_0x29e3('0x4b')](_0x2ad88b)[_0x29e3('0x29')](handleEntityNotFound(_0x4ad4db,null))[_0x29e3('0x29')](respondWithResult(_0x4ad4db,null))[_0x29e3('0x45')](handleError(_0x4ad4db,null));};exports[_0x29e3('0x4c')]=function(_0x3dfb61,_0x1b1270){return db[_0x29e3('0x41')][_0x29e3('0x4c')](_0x3dfb61[_0x29e3('0x4d')],{})[_0x29e3('0x29')](respondWithResult(_0x1b1270,0xc9))['catch'](handleError(_0x1b1270,null));};exports['update']=function(_0x220f83,_0xfdde29){if(_0x220f83[_0x29e3('0x4d')]['id']){delete _0x220f83[_0x29e3('0x4d')]['id'];}return db['OpenchannelApplication'][_0x29e3('0x4b')]({'where':{'id':_0x220f83[_0x29e3('0x47')]['id']}})[_0x29e3('0x29')](handleEntityNotFound(_0xfdde29,null))[_0x29e3('0x29')](saveUpdates(_0x220f83[_0x29e3('0x4d')],null))[_0x29e3('0x29')](respondWithResult(_0xfdde29,null))['catch'](handleError(_0xfdde29,null));};exports[_0x29e3('0x28')]=function(_0xa20ecd,_0x169c93){return db[_0x29e3('0x41')][_0x29e3('0x4b')]({'where':{'id':_0xa20ecd['params']['id']}})[_0x29e3('0x29')](handleEntityNotFound(_0x169c93,null))[_0x29e3('0x29')](removeEntity(_0x169c93,null))[_0x29e3('0x45')](handleError(_0x169c93,null));}; \ No newline at end of file +var _0x4907=['fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','length','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','update','then','destroy','stack','name','send','index','map','OpenchannelApplication','rawAttributes'];(function(_0xd58a17,_0x3d09ef){var _0x48d36b=function(_0x169aa8){while(--_0x169aa8){_0xd58a17['push'](_0xd58a17['shift']());}};_0x48d36b(++_0x3d09ef);}(_0x4907,0x69));var _0x7490=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4907[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0x7490('0x0'));var rimraf=require(_0x7490('0x1'));var zipdir=require(_0x7490('0x2'));var jsonpatch=require(_0x7490('0x3'));var rp=require(_0x7490('0x4'));var moment=require(_0x7490('0x5'));var BPromise=require(_0x7490('0x6'));var Mustache=require('mustache');var util=require(_0x7490('0x7'));var path=require(_0x7490('0x8'));var sox=require(_0x7490('0x9'));var csv=require(_0x7490('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7490('0xb'));var squel=require(_0x7490('0xc'));var crypto=require(_0x7490('0xd'));var jsforce=require(_0x7490('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7490('0xa'));var querystring=require(_0x7490('0xf'));var Papa=require(_0x7490('0x10'));var Redis=require(_0x7490('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7490('0x12'));var as=require(_0x7490('0x13'));var hardwareService=require(_0x7490('0x14'));var logger=require(_0x7490('0x15'))(_0x7490('0x16'));var utils=require(_0x7490('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x7490('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8d941a,_0xda3952){_0xda3952=_0xda3952||0xcc;return function(_0x1c3ec1){if(_0x1c3ec1){return _0x8d941a[_0x7490('0x19')](_0xda3952);}return _0x8d941a[_0x7490('0x1a')](_0xda3952)[_0x7490('0x1b')]();};}function respondWithResult(_0x24ed9f,_0x23c67e){_0x23c67e=_0x23c67e||0xc8;return function(_0x13d16b){if(_0x13d16b){return _0x24ed9f[_0x7490('0x1a')](_0x23c67e)[_0x7490('0x1c')](_0x13d16b);}};}function respondWithFilteredResult(_0x74bbbc,_0x3ed3e6){return function(_0x3271de){if(_0x3271de){var _0x139c69=typeof _0x3ed3e6['offset']===_0x7490('0x1d')&&typeof _0x3ed3e6[_0x7490('0x1e')]==='undefined';var _0xed0da1=_0x3271de[_0x7490('0x1f')];var _0x1e1f9e=_0x139c69?0x0:_0x3ed3e6[_0x7490('0x20')];var _0x52f3c1=_0x139c69?_0x3271de[_0x7490('0x1f')]:_0x3ed3e6[_0x7490('0x20')]+_0x3ed3e6[_0x7490('0x1e')];var _0x5ebf37;if(_0x52f3c1>=_0xed0da1){_0x52f3c1=_0xed0da1;_0x5ebf37=0xc8;}else{_0x5ebf37=0xce;}_0x74bbbc[_0x7490('0x1a')](_0x5ebf37);return _0x74bbbc['set']('Content-Range',_0x1e1f9e+'-'+_0x52f3c1+'/'+_0xed0da1)[_0x7490('0x1c')](_0x3271de);}return null;};}function patchUpdates(_0x569490){return function(_0x315ab0){try{jsonpatch[_0x7490('0x21')](_0x315ab0,_0x569490,!![]);}catch(_0x5be0a3){return BPromise[_0x7490('0x22')](_0x5be0a3);}return _0x315ab0['save']();};}function saveUpdates(_0x514e38,_0x1bf064){return function(_0x5ced7a){if(_0x5ced7a){return _0x5ced7a[_0x7490('0x23')](_0x514e38)[_0x7490('0x24')](function(_0x43cc73){return _0x43cc73;});}return null;};}function removeEntity(_0x11acc7,_0x2776e4){return function(_0x46b9d2){if(_0x46b9d2){return _0x46b9d2[_0x7490('0x25')]()[_0x7490('0x24')](function(){_0x11acc7[_0x7490('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5eaccd,_0x59e3d5){return function(_0x4f8a4f){if(!_0x4f8a4f){_0x5eaccd[_0x7490('0x19')](0x194);}return _0x4f8a4f;};}function handleError(_0x157eb9,_0x55b04c){_0x55b04c=_0x55b04c||0x1f4;return function(_0x309037){logger['error'](_0x309037[_0x7490('0x26')]);if(_0x309037['name']){delete _0x309037[_0x7490('0x27')];}_0x157eb9[_0x7490('0x1a')](_0x55b04c)[_0x7490('0x28')](_0x309037);};}exports[_0x7490('0x29')]=function(_0x24648d,_0x25482d){var _0x243884={},_0x5975cd={},_0xeb99cb={'count':0x0,'rows':[]};var _0x522c88=_[_0x7490('0x2a')](db[_0x7490('0x2b')][_0x7490('0x2c')],function(_0x19a787){return{'name':_0x19a787[_0x7490('0x2d')],'type':_0x19a787[_0x7490('0x2e')][_0x7490('0x2f')]};});_0x5975cd[_0x7490('0x30')]=_[_0x7490('0x2a')](_0x522c88,_0x7490('0x27'));_0x5975cd['query']=_[_0x7490('0x31')](_0x24648d[_0x7490('0x32')]);_0x5975cd[_0x7490('0x33')]=_[_0x7490('0x34')](_0x5975cd['model'],_0x5975cd[_0x7490('0x32')]);_0x243884[_0x7490('0x35')]=_[_0x7490('0x34')](_0x5975cd['model'],qs[_0x7490('0x36')](_0x24648d[_0x7490('0x32')][_0x7490('0x36')]));_0x243884[_0x7490('0x35')]=_0x243884[_0x7490('0x35')]['length']?_0x243884[_0x7490('0x35')]:_0x5975cd['model'];if(!_0x24648d[_0x7490('0x32')][_0x7490('0x37')](_0x7490('0x38'))){_0x243884[_0x7490('0x1e')]=qs[_0x7490('0x1e')](_0x24648d[_0x7490('0x32')][_0x7490('0x1e')]);_0x243884['offset']=qs[_0x7490('0x20')](_0x24648d[_0x7490('0x32')][_0x7490('0x20')]);}_0x243884[_0x7490('0x39')]=qs['sort'](_0x24648d['query'][_0x7490('0x3a')]);_0x243884[_0x7490('0x3b')]=qs[_0x7490('0x33')](_[_0x7490('0x3c')](_0x24648d[_0x7490('0x32')],_0x5975cd[_0x7490('0x33')]),_0x522c88);if(_0x24648d[_0x7490('0x32')][_0x7490('0x3d')]){_0x243884[_0x7490('0x3b')]=_[_0x7490('0x3e')](_0x243884[_0x7490('0x3b')],{'$or':_[_0x7490('0x2a')](_0x522c88,function(_0x372f19){if(_0x372f19['type']!==_0x7490('0x3f')){var _0x11a01a={};_0x11a01a[_0x372f19['name']]={'$like':'%'+_0x24648d['query'][_0x7490('0x3d')]+'%'};return _0x11a01a;}})});}_0x243884=_['merge']({},_0x243884,_0x24648d['options']);var _0xb8d308={'where':_0x243884[_0x7490('0x3b')]};return db[_0x7490('0x2b')]['count'](_0xb8d308)['then'](function(_0x19d2b8){_0xeb99cb['count']=_0x19d2b8;if(_0x24648d[_0x7490('0x32')][_0x7490('0x40')]){_0x243884[_0x7490('0x41')]=[{'all':!![]}];}return db[_0x7490('0x2b')]['findAll'](_0x243884);})[_0x7490('0x24')](function(_0x29bda2){_0xeb99cb[_0x7490('0x42')]=_0x29bda2;return _0xeb99cb;})[_0x7490('0x24')](respondWithFilteredResult(_0x25482d,_0x243884))[_0x7490('0x43')](handleError(_0x25482d,null));};exports[_0x7490('0x44')]=function(_0x3618c5,_0x571304){var _0x908562={'raw':!![],'where':{'id':_0x3618c5['params']['id']}},_0x1551d5={};_0x1551d5[_0x7490('0x30')]=_['keys'](db[_0x7490('0x2b')][_0x7490('0x2c')]);_0x1551d5[_0x7490('0x32')]=_[_0x7490('0x31')](_0x3618c5[_0x7490('0x32')]);_0x1551d5['filters']=_[_0x7490('0x34')](_0x1551d5[_0x7490('0x30')],_0x1551d5['query']);_0x908562[_0x7490('0x35')]=_['intersection'](_0x1551d5[_0x7490('0x30')],qs[_0x7490('0x36')](_0x3618c5['query'][_0x7490('0x36')]));_0x908562[_0x7490('0x35')]=_0x908562[_0x7490('0x35')][_0x7490('0x45')]?_0x908562[_0x7490('0x35')]:_0x1551d5[_0x7490('0x30')];if(_0x3618c5['query']['includeAll']){_0x908562[_0x7490('0x41')]=[{'all':!![]}];}_0x908562=_[_0x7490('0x3e')]({},_0x908562,_0x3618c5[_0x7490('0x46')]);return db[_0x7490('0x2b')][_0x7490('0x47')](_0x908562)[_0x7490('0x24')](handleEntityNotFound(_0x571304,null))[_0x7490('0x24')](respondWithResult(_0x571304,null))['catch'](handleError(_0x571304,null));};exports[_0x7490('0x48')]=function(_0x4dcfc2,_0x5baabb){return db[_0x7490('0x2b')]['create'](_0x4dcfc2[_0x7490('0x49')],{})['then'](respondWithResult(_0x5baabb,0xc9))['catch'](handleError(_0x5baabb,null));};exports[_0x7490('0x23')]=function(_0x1c7323,_0x5011c8){if(_0x1c7323[_0x7490('0x49')]['id']){delete _0x1c7323[_0x7490('0x49')]['id'];}return db[_0x7490('0x2b')][_0x7490('0x47')]({'where':{'id':_0x1c7323[_0x7490('0x4a')]['id']}})[_0x7490('0x24')](handleEntityNotFound(_0x5011c8,null))[_0x7490('0x24')](saveUpdates(_0x1c7323[_0x7490('0x49')],null))['then'](respondWithResult(_0x5011c8,null))[_0x7490('0x43')](handleError(_0x5011c8,null));};exports[_0x7490('0x25')]=function(_0x8038bd,_0x200aab){return db[_0x7490('0x2b')][_0x7490('0x47')]({'where':{'id':_0x8038bd[_0x7490('0x4a')]['id']}})[_0x7490('0x24')](handleEntityNotFound(_0x200aab,null))['then'](removeEntity(_0x200aab,null))[_0x7490('0x43')](handleError(_0x200aab,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 679494c..a0e0d8a 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 _0x5e37=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','lodash'];(function(_0x3f3d69,_0x1d654a){var _0x945cfc=function(_0x1caefc){while(--_0x1caefc){_0x3f3d69['push'](_0x3f3d69['shift']());}};_0x945cfc(++_0x1d654a);}(_0x5e37,0x103));var _0x75e3=function(_0x4702ee,_0xaf6a45){_0x4702ee=_0x4702ee-0x0;var _0x62ca7d=_0x5e37[_0x4702ee];return _0x62ca7d;};'use strict';var _=require(_0x75e3('0x0'));var util=require(_0x75e3('0x1'));var logger=require(_0x75e3('0x2'))('api');var moment=require(_0x75e3('0x3'));var BPromise=require(_0x75e3('0x4'));var rp=require(_0x75e3('0x5'));var fs=require('fs');var path=require(_0x75e3('0x6'));var rimraf=require(_0x75e3('0x7'));var config=require('../../config/environment');var attributes=require('./openchannelApplication.attributes');module[_0x75e3('0x8')]=function(_0x1b1d28,_0xc2ea34){return _0x1b1d28[_0x75e3('0x9')](_0x75e3('0xa'),attributes,{'tableName':_0x75e3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x75e3('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x52ef=['utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','./openchannelApplication.attributes','exports','OpenchannelApplication','openchannel_applications','utf8mb4'];(function(_0x415229,_0x4af987){var _0x1c41e=function(_0x5af7b9){while(--_0x5af7b9){_0x415229['push'](_0x415229['shift']());}};_0x1c41e(++_0x4af987);}(_0x52ef,0x1a1));var _0xf52e=function(_0x3c98dd,_0x50ad34){_0x3c98dd=_0x3c98dd-0x0;var _0x5aa841=_0x52ef[_0x3c98dd];return _0x5aa841;};'use strict';var _=require('lodash');var util=require(_0xf52e('0x0'));var logger=require(_0xf52e('0x1'))(_0xf52e('0x2'));var moment=require(_0xf52e('0x3'));var BPromise=require(_0xf52e('0x4'));var rp=require(_0xf52e('0x5'));var fs=require('fs');var path=require(_0xf52e('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf52e('0x7'));module[_0xf52e('0x8')]=function(_0x1aaa5c,_0x38f5ce){return _0x1aaa5c['define'](_0xf52e('0x9'),attributes,{'tableName':_0xf52e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf52e('0xb'),'collate':_0xf52e('0xc')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index aeec65c..256d10d 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 _0x0637=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','attributes','limit','debug','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x15c8ca,_0x37e1a8){var _0x19cfad=function(_0x4c4335){while(--_0x4c4335){_0x15c8ca['push'](_0x15c8ca['shift']());}};_0x19cfad(++_0x37e1a8);}(_0x0637,0x7a));var _0x7063=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0637[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x7063('0x0'));var util=require(_0x7063('0x1'));var moment=require(_0x7063('0x2'));var BPromise=require(_0x7063('0x3'));var rs=require(_0x7063('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7063('0x5'))['db'];var utils=require(_0x7063('0x6'));var logger=require(_0x7063('0x7'))(_0x7063('0x8'));var config=require(_0x7063('0x9'));var jayson=require(_0x7063('0xa'));var client=jayson[_0x7063('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a723,_0x521f11,_0x4d0307){return new BPromise(function(_0x3ee129,_0x1737d3){return client[_0x7063('0xc')](_0x41a723,_0x4d0307)[_0x7063('0xd')](function(_0x1fde67){logger[_0x7063('0xe')](_0x7063('0xf'),_0x521f11,'request\x20sent');logger['debug'](_0x7063('0x10'),_0x521f11,_0x7063('0x11'),JSON['stringify'](_0x1fde67));if(_0x1fde67[_0x7063('0x12')]){if(_0x1fde67['error'][_0x7063('0x13')]===0x1f4){logger[_0x7063('0x12')](_0x7063('0xf'),_0x521f11,_0x1fde67[_0x7063('0x12')][_0x7063('0x14')]);return _0x1737d3(_0x1fde67[_0x7063('0x12')][_0x7063('0x14')]);}logger[_0x7063('0x12')](_0x7063('0xf'),_0x521f11,_0x1fde67[_0x7063('0x12')][_0x7063('0x14')]);return _0x3ee129(_0x1fde67[_0x7063('0x12')][_0x7063('0x14')]);}else{logger[_0x7063('0xe')](_0x7063('0xf'),_0x521f11,'request\x20sent');_0x3ee129(_0x1fde67[_0x7063('0x15')][_0x7063('0x14')]);}})[_0x7063('0x16')](function(_0x1f6bde){logger[_0x7063('0x12')]('OpenchannelApplication,\x20%s,\x20%s',_0x521f11,_0x1f6bde);_0x1737d3(_0x1f6bde);});});}exports[_0x7063('0x17')]=function(_0xb5496f){var _0x26f634=this;return new Promise(function(_0x4c6a3d,_0x1da1ee){return db[_0x7063('0x18')][_0x7063('0x19')](_0xb5496f['body'],{'raw':_0xb5496f['options']?_0xb5496f[_0x7063('0x1a')][_0x7063('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb5496f[_0x7063('0x1a')]?_0xb5496f[_0x7063('0x1a')]['where']||null:null,'attributes':_0xb5496f[_0x7063('0x1a')]?_0xb5496f['options'][_0x7063('0x1c')]||null:null,'limit':_0xb5496f['options']?_0xb5496f[_0x7063('0x1a')][_0x7063('0x1d')]||null:null})['then'](function(_0x3d47c1){logger[_0x7063('0xe')](_0x7063('0x17'),_0xb5496f);logger[_0x7063('0x1e')]('UpdateOpenchannelApplication',_0xb5496f,JSON[_0x7063('0x1f')](_0x3d47c1));_0x4c6a3d(_0x3d47c1);})['catch'](function(_0x56ab79){logger['error'](_0x7063('0x17'),_0x56ab79[_0x7063('0x14')],_0xb5496f);_0x1da1ee(_0x26f634[_0x7063('0x12')](0x1f4,_0x56ab79['message']));});});}; \ No newline at end of file +var _0xf2db=['attributes','limit','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateOpenchannelApplication','update','body','options','raw'];(function(_0x5c33ad,_0x5677d4){var _0x87f926=function(_0x5c8c5f){while(--_0x5c8c5f){_0x5c33ad['push'](_0x5c33ad['shift']());}};_0x87f926(++_0x5677d4);}(_0xf2db,0x11a));var _0xbf2d=function(_0x1e1041,_0x195954){_0x1e1041=_0x1e1041-0x0;var _0x859290=_0xf2db[_0x1e1041];return _0x859290;};'use strict';var _=require(_0xbf2d('0x0'));var util=require(_0xbf2d('0x1'));var moment=require(_0xbf2d('0x2'));var BPromise=require(_0xbf2d('0x3'));var rs=require(_0xbf2d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbf2d('0x5'));var logger=require(_0xbf2d('0x6'))('rpc');var config=require(_0xbf2d('0x7'));var jayson=require(_0xbf2d('0x8'));var client=jayson[_0xbf2d('0x9')][_0xbf2d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x415f27,_0x1c30a1,_0x1ad25b){return new BPromise(function(_0x243598,_0x2820c5){return client[_0xbf2d('0xb')](_0x415f27,_0x1ad25b)[_0xbf2d('0xc')](function(_0x5507da){logger[_0xbf2d('0xd')](_0xbf2d('0xe'),_0x1c30a1,_0xbf2d('0xf'));logger[_0xbf2d('0x10')](_0xbf2d('0x11'),_0x1c30a1,_0xbf2d('0xf'),JSON[_0xbf2d('0x12')](_0x5507da));if(_0x5507da[_0xbf2d('0x13')]){if(_0x5507da[_0xbf2d('0x13')][_0xbf2d('0x14')]===0x1f4){logger['error'](_0xbf2d('0xe'),_0x1c30a1,_0x5507da[_0xbf2d('0x13')][_0xbf2d('0x15')]);return _0x2820c5(_0x5507da[_0xbf2d('0x13')]['message']);}logger[_0xbf2d('0x13')](_0xbf2d('0xe'),_0x1c30a1,_0x5507da['error']['message']);return _0x243598(_0x5507da[_0xbf2d('0x13')][_0xbf2d('0x15')]);}else{logger[_0xbf2d('0xd')](_0xbf2d('0xe'),_0x1c30a1,_0xbf2d('0xf'));_0x243598(_0x5507da[_0xbf2d('0x16')]['message']);}})['catch'](function(_0x2fb6e9){logger[_0xbf2d('0x13')]('OpenchannelApplication,\x20%s,\x20%s',_0x1c30a1,_0x2fb6e9);_0x2820c5(_0x2fb6e9);});});}exports[_0xbf2d('0x17')]=function(_0x84c8c1){var _0x4cefa9=this;return new Promise(function(_0x273e85,_0x5183e2){return db['OpenchannelApplication'][_0xbf2d('0x18')](_0x84c8c1[_0xbf2d('0x19')],{'raw':_0x84c8c1[_0xbf2d('0x1a')]?_0x84c8c1['options'][_0xbf2d('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x84c8c1['options']?_0x84c8c1[_0xbf2d('0x1a')]['where']||null:null,'attributes':_0x84c8c1[_0xbf2d('0x1a')]?_0x84c8c1[_0xbf2d('0x1a')][_0xbf2d('0x1c')]||null:null,'limit':_0x84c8c1[_0xbf2d('0x1a')]?_0x84c8c1[_0xbf2d('0x1a')][_0xbf2d('0x1d')]||null:null})[_0xbf2d('0xc')](function(_0x2e1070){logger[_0xbf2d('0xd')](_0xbf2d('0x17'),_0x84c8c1);logger['debug'](_0xbf2d('0x17'),_0x84c8c1,JSON[_0xbf2d('0x12')](_0x2e1070));_0x273e85(_0x2e1070);})[_0xbf2d('0x1e')](function(_0x4dcaa1){logger[_0xbf2d('0x13')](_0xbf2d('0x17'),_0x4dcaa1['message'],_0x84c8c1);_0x5183e2(_0x4cefa9[_0xbf2d('0x13')](0x1f4,_0x4dcaa1['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index ae6c5c4..7a87f94 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 _0x6fde=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/messages','/:id/download','download','post','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','put','openchannelinteraction:update','update','openchannelinteraction:destroy','destroy','delete','removeTags','exports','multer','util','connect-timeout','express'];(function(_0x2b903f,_0x2f1dc1){var _0x3bb553=function(_0x1ad559){while(--_0x1ad559){_0x2b903f['push'](_0x2b903f['shift']());}};_0x3bb553(++_0x2f1dc1);}(_0x6fde,0x15c));var _0xe6fd=function(_0x2912ab,_0x2bc59a){_0x2912ab=_0x2912ab-0x0;var _0x11d7b2=_0x6fde[_0x2912ab];return _0x11d7b2;};'use strict';var multer=require(_0xe6fd('0x0'));var util=require(_0xe6fd('0x1'));var path=require('path');var timeout=require(_0xe6fd('0x2'));var express=require(_0xe6fd('0x3'));var router=express['Router']();var fs_extra=require(_0xe6fd('0x4'));var auth=require(_0xe6fd('0x5'));var interaction=require(_0xe6fd('0x6'));var config=require(_0xe6fd('0x7'));var controller=require(_0xe6fd('0x8'));router['get']('/',auth[_0xe6fd('0x9')](),controller['index']);router[_0xe6fd('0xa')](_0xe6fd('0xb'),auth[_0xe6fd('0x9')](),controller[_0xe6fd('0xc')]);router[_0xe6fd('0xa')](_0xe6fd('0xd'),auth[_0xe6fd('0x9')](),controller[_0xe6fd('0xe')]);router[_0xe6fd('0xa')](_0xe6fd('0xf'),auth[_0xe6fd('0x9')](),controller['getMessages']);router['get'](_0xe6fd('0x10'),auth['isAuthenticated'](),controller[_0xe6fd('0x11')]);router[_0xe6fd('0x12')]('/',auth[_0xe6fd('0x9')](),controller['create']);router[_0xe6fd('0x12')]('/:id/messages',auth[_0xe6fd('0x9')](),controller[_0xe6fd('0x13')]);router[_0xe6fd('0x12')](_0xe6fd('0x14'),auth[_0xe6fd('0x9')](),interaction[_0xe6fd('0x15')](_0xe6fd('0x16'),_0xe6fd('0x17')),controller['addTags']);router[_0xe6fd('0x18')](_0xe6fd('0xd'),auth['isAuthenticated'](),interaction[_0xe6fd('0x15')]('openchannel',_0xe6fd('0x19')),controller[_0xe6fd('0x1a')]);router['delete'](_0xe6fd('0xd'),auth[_0xe6fd('0x9')](),interaction['tracked']('openchannel',_0xe6fd('0x1b')),controller[_0xe6fd('0x1c')]);router[_0xe6fd('0x1d')]('/:id/tags',auth['isAuthenticated'](),controller[_0xe6fd('0x1e')]);module[_0xe6fd('0x1f')]=router; \ No newline at end of file +var _0x5e3d=['post','create','addMessage','tracked','openchannel','openchannelinteraction:addtags','put','openchannelinteraction:update','delete','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/messages','getMessages','/:id/download','download'];(function(_0x1564a6,_0x2781c7){var _0x3073b3=function(_0x202a70){while(--_0x202a70){_0x1564a6['push'](_0x1564a6['shift']());}};_0x3073b3(++_0x2781c7);}(_0x5e3d,0x88));var _0xd5e3=function(_0x3c6eab,_0x58e77b){_0x3c6eab=_0x3c6eab-0x0;var _0x236a79=_0x5e3d[_0x3c6eab];return _0x236a79;};'use strict';var multer=require(_0xd5e3('0x0'));var util=require(_0xd5e3('0x1'));var path=require(_0xd5e3('0x2'));var timeout=require(_0xd5e3('0x3'));var express=require('express');var router=express[_0xd5e3('0x4')]();var fs_extra=require(_0xd5e3('0x5'));var auth=require(_0xd5e3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd5e3('0x7'));var controller=require(_0xd5e3('0x8'));router['get']('/',auth[_0xd5e3('0x9')](),controller[_0xd5e3('0xa')]);router[_0xd5e3('0xb')](_0xd5e3('0xc'),auth[_0xd5e3('0x9')](),controller['describe']);router[_0xd5e3('0xb')](_0xd5e3('0xd'),auth['isAuthenticated'](),controller[_0xd5e3('0xe')]);router['get'](_0xd5e3('0xf'),auth[_0xd5e3('0x9')](),controller[_0xd5e3('0x10')]);router[_0xd5e3('0xb')](_0xd5e3('0x11'),auth['isAuthenticated'](),controller[_0xd5e3('0x12')]);router[_0xd5e3('0x13')]('/',auth[_0xd5e3('0x9')](),controller[_0xd5e3('0x14')]);router[_0xd5e3('0x13')](_0xd5e3('0xf'),auth[_0xd5e3('0x9')](),controller[_0xd5e3('0x15')]);router['post']('/:id/tags',auth[_0xd5e3('0x9')](),interaction[_0xd5e3('0x16')](_0xd5e3('0x17'),_0xd5e3('0x18')),controller['addTags']);router[_0xd5e3('0x19')](_0xd5e3('0xd'),auth['isAuthenticated'](),interaction[_0xd5e3('0x16')](_0xd5e3('0x17'),_0xd5e3('0x1a')),controller['update']);router[_0xd5e3('0x1b')](_0xd5e3('0xd'),auth['isAuthenticated'](),interaction['tracked'](_0xd5e3('0x17'),'openchannelinteraction:destroy'),controller['destroy']);router[_0xd5e3('0x1b')](_0xd5e3('0x1c'),auth[_0xd5e3('0x9')](),controller[_0xd5e3('0x1d')]);module[_0xd5e3('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index d029122..cb379cf 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 _0xf021=['sequelize','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x494912,_0x5379ea){var _0x458a93=function(_0x1c6ea9){while(--_0x1c6ea9){_0x494912['push'](_0x494912['shift']());}};_0x458a93(++_0x5379ea);}(_0xf021,0x18f));var _0x1f02=function(_0x359bbe,_0x5b7fcc){_0x359bbe=_0x359bbe-0x0;var _0x1b3353=_0xf021[_0x359bbe];return _0x1b3353;};'use strict';var Sequelize=require(_0x1f02('0x0'));module[_0x1f02('0x1')]={'closed':{'type':Sequelize[_0x1f02('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1f02('0x3')]},'disposition':{'type':Sequelize[_0x1f02('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x1f02('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x1f02('0x3')]},'threadId':{'type':Sequelize[_0x1f02('0x4')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x1f02('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x1f02('0x5')]('in',_0x1f02('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x1f02('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x1f02('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xd691=['exports','BOOLEAN','STRING','DATE','ENUM','out','sequelize'];(function(_0x4859b4,_0x10609d){var _0xffdcba=function(_0x35f919){while(--_0x35f919){_0x4859b4['push'](_0x4859b4['shift']());}};_0xffdcba(++_0x10609d);}(_0xd691,0xe6));var _0x1d69=function(_0x22789a,_0x4a1c8c){_0x22789a=_0x22789a-0x0;var _0xede88=_0xd691[_0x22789a];return _0xede88;};'use strict';var Sequelize=require(_0x1d69('0x0'));module[_0x1d69('0x1')]={'closed':{'type':Sequelize[_0x1d69('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x1d69('0x3')]},'secondDisposition':{'type':Sequelize[_0x1d69('0x3')]},'thirdDisposition':{'type':Sequelize[_0x1d69('0x3')]},'note':{'type':Sequelize[_0x1d69('0x3')]},'read1stAt':{'type':Sequelize[_0x1d69('0x4')]},'threadId':{'type':Sequelize[_0x1d69('0x3')]},'externalUrl':{'type':Sequelize[_0x1d69('0x3')]},'lastMsgAt':{'type':Sequelize[_0x1d69('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x1d69('0x5')]('in',_0x1d69('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x1d69('0x3')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 0dc8449..c33be17 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 _0xe31e=['options','create','body','find','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','filters','hasOwnProperty','order','sort','where','pick','OpenchannelInteractionId','filter','merge','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','color','emit','removeTags','download','unix','toString','join','tmp','root','server','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','firstName','lastName','Attachment','createdAt','direction','secret','read','Account','Owner','get','mkdirSync','Openchannel','closed','closedAt','Public','Private','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','Contact','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','sendStatus','rimraf','moment','util','path','ejs','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','status','end','json','undefined','limit','count','offset','Content-Range','update','then','destroy','error','name','send','OpenchannelInteraction','rawAttributes','fieldName','type','key','findAll','openchannel','query','catch','show','from','params','keys','intersection','attributes','model','fields'];(function(_0x208291,_0x973ee2){var _0x165f8c=function(_0x2fb2d9){while(--_0x2fb2d9){_0x208291['push'](_0x208291['shift']());}};_0x165f8c(++_0x973ee2);}(_0xe31e,0xc8));var _0xee31=function(_0x61045c,_0xc8a606){_0x61045c=_0x61045c-0x0;var _0x257852=_0xe31e[_0x61045c];return _0x257852;};'use strict';var rimraf=require(_0xee31('0x0'));var zipdir=require('zip-dir');var moment=require(_0xee31('0x1'));var util=require(_0xee31('0x2'));var path=require(_0xee31('0x3'));var ejs=require(_0xee31('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xee31('0x5'));var interaction=require(_0xee31('0x6'));var qs=require('../../components/parsers/qs');var pdf=require(_0xee31('0x7'));var logger=require(_0xee31('0x8'))(_0xee31('0x9'));var config=require(_0xee31('0xa'));var db=require(_0xee31('0xb'))['db'];config[_0xee31('0xc')]=_[_0xee31('0xd')](config['redis'],{'host':_0xee31('0xe'),'port':0x18eb});var socket=require(_0xee31('0xf'))(new Redis(config[_0xee31('0xc')]));require(_0xee31('0x10'))['register'](socket);function respondWithStatusCode(_0x2b5eca,_0x4465d8){_0x4465d8=_0x4465d8||0xcc;return function(_0x1eb45a){if(_0x1eb45a){return _0x2b5eca['sendStatus'](_0x4465d8);}return _0x2b5eca[_0xee31('0x11')](_0x4465d8)[_0xee31('0x12')]();};}function respondWithResult(_0x3cc8f3,_0x12e1f){_0x12e1f=_0x12e1f||0xc8;return function(_0x5d6c95){if(_0x5d6c95){return _0x3cc8f3[_0xee31('0x11')](_0x12e1f)[_0xee31('0x13')](_0x5d6c95);}};}function respondWithFilteredResult(_0x3fa478,_0x1c95eb){return function(_0x279d5c){if(_0x279d5c){var _0x41299f=typeof _0x1c95eb['offset']===_0xee31('0x14')&&typeof _0x1c95eb[_0xee31('0x15')]===_0xee31('0x14');var _0x389dfa=_0x279d5c[_0xee31('0x16')];var _0x50210e=_0x41299f?0x0:_0x1c95eb['offset'];var _0x127621=_0x41299f?_0x279d5c[_0xee31('0x16')]:_0x1c95eb[_0xee31('0x17')]+_0x1c95eb['limit'];var _0x5d0d3c;if(_0x127621>=_0x389dfa){_0x127621=_0x389dfa;_0x5d0d3c=0xc8;}else{_0x5d0d3c=0xce;}_0x3fa478['status'](_0x5d0d3c);return _0x3fa478['set'](_0xee31('0x18'),_0x50210e+'-'+_0x127621+'/'+_0x389dfa)[_0xee31('0x13')](_0x279d5c);}return null;};}function saveUpdates(_0x343b31){return function(_0x280bc8){if(_0x280bc8){return _0x280bc8[_0xee31('0x19')](_0x343b31)[_0xee31('0x1a')](function(_0x149276){return _0x149276;});}return null;};}function removeEntity(_0x1727f0){return function(_0x3e2a13){if(_0x3e2a13){return _0x3e2a13[_0xee31('0x1b')]()['then'](function(){_0x1727f0[_0xee31('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1be0e5){return function(_0x5f37d0){if(!_0x5f37d0){_0x1be0e5['sendStatus'](0x194);}return _0x5f37d0;};}function handleError(_0x8c8708,_0x426c4d){_0x426c4d=_0x426c4d||0x1f4;return function(_0x4937eb){logger[_0xee31('0x1c')](_0x4937eb['stack']);if(_0x4937eb['name']){delete _0x4937eb[_0xee31('0x1d')];}_0x8c8708[_0xee31('0x11')](_0x426c4d)[_0xee31('0x1e')](_0x4937eb);};}exports['index']=function(_0x4ee22f,_0x22c264){var _0x57aa2e={};var _0xeca358=_['map'](db[_0xee31('0x1f')][_0xee31('0x20')],function(_0x427df3){return{'name':_0x427df3[_0xee31('0x21')],'type':_0x427df3[_0xee31('0x22')][_0xee31('0x23')]};});_0x57aa2e=qs['getOptions'](_0xeca358,_0x4ee22f);return interaction[_0xee31('0x24')](_0xee31('0x25'),_0x4ee22f[_0xee31('0x26')],_0x4ee22f['user'],_0x57aa2e,_0xeca358)[_0xee31('0x1a')](respondWithFilteredResult(_0x22c264,_0x57aa2e))[_0xee31('0x27')](handleError(_0x22c264,null));};exports[_0xee31('0x28')]=function(_0x2287b1,_0x3d3df6){var _0x2bfaec={};if(_0x2287b1[_0xee31('0x26')][_0xee31('0x22')]&&_0x2287b1[_0xee31('0x26')][_0xee31('0x22')]==='from'){_0x2bfaec[_0xee31('0x29')]=_0x2287b1[_0xee31('0x2a')]['id'];}else{_0x2bfaec['id']=_0x2287b1[_0xee31('0x2a')]['id'];}var _0x16c6d1={'raw':![],'where':_0x2bfaec},_0x574be7={};_0x574be7['model']=_[_0xee31('0x2b')](db['OpenchannelInteraction'][_0xee31('0x20')]);_0x574be7[_0xee31('0x26')]=_[_0xee31('0x2b')](_0x2287b1[_0xee31('0x26')]);_0x574be7['filters']=_[_0xee31('0x2c')](_0x574be7['model'],_0x574be7[_0xee31('0x26')]);_0x16c6d1[_0xee31('0x2d')]=_['intersection'](_0x574be7[_0xee31('0x2e')],qs[_0xee31('0x2f')](_0x2287b1[_0xee31('0x26')][_0xee31('0x2f')]));_0x16c6d1[_0xee31('0x2d')]=_0x16c6d1[_0xee31('0x2d')]['length']?_0x16c6d1[_0xee31('0x2d')]:_0x574be7[_0xee31('0x2e')];if(_0x2287b1[_0xee31('0x26')]['includeAll']){_0x16c6d1['include']=[{'all':!![]}];}_0x16c6d1=_['merge']({},_0x16c6d1,_0x2287b1[_0xee31('0x30')]);return db[_0xee31('0x1f')]['find'](_0x16c6d1)[_0xee31('0x1a')](handleEntityNotFound(_0x3d3df6,null))[_0xee31('0x1a')](respondWithResult(_0x3d3df6,null))['catch'](handleError(_0x3d3df6,null));};exports[_0xee31('0x31')]=function(_0x349e26,_0x302b62){return db['OpenchannelInteraction'][_0xee31('0x31')](_0x349e26[_0xee31('0x32')],{})[_0xee31('0x1a')](respondWithResult(_0x302b62,0xc9))[_0xee31('0x27')](handleError(_0x302b62,null));};exports[_0xee31('0x19')]=function(_0x155ddc,_0x2f22fa){if(_0x155ddc[_0xee31('0x32')]['id']){delete _0x155ddc['body']['id'];}return db['OpenchannelInteraction'][_0xee31('0x33')]({'where':{'id':_0x155ddc[_0xee31('0x2a')]['id']}})[_0xee31('0x1a')](handleEntityNotFound(_0x2f22fa,null))[_0xee31('0x1a')](saveUpdates(_0x155ddc[_0xee31('0x32')],null))['then'](respondWithResult(_0x2f22fa,null))[_0xee31('0x27')](handleError(_0x2f22fa,null));};exports[_0xee31('0x1b')]=function(_0x13955e,_0x4528ae){return db[_0xee31('0x1f')][_0xee31('0x33')]({'where':{'id':_0x13955e[_0xee31('0x2a')]['id']}})[_0xee31('0x1a')](handleEntityNotFound(_0x4528ae,null))['then'](removeEntity(_0x4528ae,null))[_0xee31('0x27')](handleError(_0x4528ae,null));};exports[_0xee31('0x34')]=function(_0x1560b1,_0x103fc4){return db[_0xee31('0x1f')][_0xee31('0x34')]()[_0xee31('0x1a')](respondWithResult(_0x103fc4,null))[_0xee31('0x27')](handleError(_0x103fc4,null));};exports[_0xee31('0x35')]=function(_0x5d6821,_0x41a62d){return db[_0xee31('0x36')][_0xee31('0x33')]({'where':{'id':_0x5d6821[_0xee31('0x2a')]['id']}})[_0xee31('0x1a')](handleEntityNotFound(_0x41a62d,null))[_0xee31('0x1a')](function(_0x3fa78d){if(_0x3fa78d){return _0x3fa78d['addMessage'](_0x5d6821[_0xee31('0x32')][_0xee31('0x37')],_[_0xee31('0x38')](_0x5d6821[_0xee31('0x32')],[_0xee31('0x37'),'id'])||{});}})[_0xee31('0x1a')](respondWithResult(_0x41a62d,null))['catch'](handleError(_0x41a62d,null));};exports[_0xee31('0x39')]=function(_0x11b2c3,_0x311bd){var _0x3b447d={'raw':![],'where':{}};var _0x504551={};var _0x343d25={'count':0x0,'rows':[]};return db[_0xee31('0x1f')][_0xee31('0x3a')]({'where':{'id':_0x11b2c3[_0xee31('0x2a')]['id']}})[_0xee31('0x1a')](handleEntityNotFound(_0x311bd,null))[_0xee31('0x1a')](function(_0x1c5f0b){if(_0x1c5f0b){_0x504551[_0xee31('0x2e')]=_[_0xee31('0x2b')](db[_0xee31('0x36')][_0xee31('0x20')]);_0x504551[_0xee31('0x26')]=_[_0xee31('0x2b')](_0x11b2c3[_0xee31('0x26')]);_0x504551[_0xee31('0x3b')]=_[_0xee31('0x2c')](_0x504551[_0xee31('0x2e')],_0x504551[_0xee31('0x26')]);_0x3b447d[_0xee31('0x2d')]=_['intersection'](_0x504551[_0xee31('0x2e')],qs[_0xee31('0x2f')](_0x11b2c3[_0xee31('0x26')]['fields']));_0x3b447d[_0xee31('0x2d')]=_0x3b447d[_0xee31('0x2d')]['length']?_0x3b447d[_0xee31('0x2d')]:_0x504551['model'];if(!_0x11b2c3[_0xee31('0x26')][_0xee31('0x3c')]('nolimit')){_0x3b447d[_0xee31('0x15')]=qs[_0xee31('0x15')](_0x11b2c3[_0xee31('0x26')][_0xee31('0x15')]);_0x3b447d[_0xee31('0x17')]=qs['offset'](_0x11b2c3[_0xee31('0x26')][_0xee31('0x17')]);}_0x3b447d[_0xee31('0x3d')]=qs['sort'](_0x11b2c3['query'][_0xee31('0x3e')]);_0x3b447d[_0xee31('0x3f')]=qs[_0xee31('0x3b')](_[_0xee31('0x40')](_0x11b2c3['query'],_0x504551[_0xee31('0x3b')]));_0x3b447d['where'][_0xee31('0x41')]=_0x1c5f0b['id'];if(_0x11b2c3[_0xee31('0x26')][_0xee31('0x42')]){_0x3b447d[_0xee31('0x3f')]=_[_0xee31('0x43')](_0x3b447d['where'],{'$or':_[_0xee31('0x44')](_0x3b447d['attributes'],function(_0x5a11a7){var _0x11f0c9={};_0x11f0c9[_0x5a11a7]={'$like':'%'+_0x11b2c3[_0xee31('0x26')][_0xee31('0x42')]+'%'};return _0x11f0c9;})});}if(_0x11b2c3[_0xee31('0x26')][_0xee31('0x45')]){var _0x466e1b=_0x11b2c3[_0xee31('0x26')][_0xee31('0x45')][_0xee31('0x46')](',');var _0x2fa9b5={};_0x2fa9b5[_0x466e1b[0x0]]={'$gte':moment(_0x466e1b[0x1])[_0xee31('0x47')](_0xee31('0x48'))};_0x3b447d[_0xee31('0x3f')]=_[_0xee31('0x43')](_0x3b447d[_0xee31('0x3f')],_0x2fa9b5);}_0x3b447d=_[_0xee31('0x43')]({},_0x3b447d,_0x11b2c3['options']);return db[_0xee31('0x36')]['count']({'where':_0x3b447d['where']})[_0xee31('0x1a')](function(_0x5c83d0){_0x343d25[_0xee31('0x16')]=_0x5c83d0;if(_0x11b2c3[_0xee31('0x26')][_0xee31('0x49')]){_0x3b447d['include']=[{'all':!![]}];}return db[_0xee31('0x36')][_0xee31('0x24')](_0x3b447d);})[_0xee31('0x1a')](function(_0x3289be){_0x343d25[_0xee31('0x4a')]=_0x3289be;return _0x343d25;});}})[_0xee31('0x1a')](respondWithFilteredResult(_0x311bd,_0x3b447d))[_0xee31('0x27')](handleError(_0x311bd,null));};exports['addTags']=function(_0x33158f,_0x1fa41a){return db['OpenchannelInteraction']['find']({'where':{'id':_0x33158f['params']['id']}})[_0xee31('0x1a')](handleEntityNotFound(_0x1fa41a,null))['then'](function(_0xe0edd8){if(_0xe0edd8){return _0xe0edd8['setTags'](_0x33158f[_0xee31('0x32')]['ids'],_[_0xee31('0x38')](_0x33158f['body'],[_0xee31('0x37'),'id'])||{})['spread'](function(){return db['Tag'][_0xee31('0x24')]({'attributes':['id',_0xee31('0x1d'),_0xee31('0x4b')],'where':{'id':_0x33158f['body']['ids']}});})[_0xee31('0x1a')](function(_0x4eef7a){socket[_0xee31('0x4c')]('openchannelInteractionTags:save',{'id':Number(_0x33158f[_0xee31('0x2a')]['id']),'tags':_0x4eef7a||[]});return{'id':Number(_0x33158f['params']['id']),'tags':_0x4eef7a||[]};});}})[_0xee31('0x1a')](respondWithResult(_0x1fa41a,null))[_0xee31('0x27')](handleError(_0x1fa41a,null));};exports[_0xee31('0x4d')]=function(_0x233264,_0x2bb4ce){return db[_0xee31('0x1f')][_0xee31('0x33')]({'where':{'id':_0x233264[_0xee31('0x2a')]['id']}})[_0xee31('0x1a')](handleEntityNotFound(_0x2bb4ce,null))['then'](function(_0x1cf69b){if(_0x1cf69b){return _0x1cf69b[_0xee31('0x4d')](_0x233264['query'][_0xee31('0x37')]);}})[_0xee31('0x1a')](respondWithStatusCode(_0x2bb4ce,null))['catch'](handleError(_0x2bb4ce,null));};exports[_0xee31('0x4e')]=function(_0x4acfed,_0x53b5d1){var _0xe1c6b2=moment()[_0xee31('0x4f')]()[_0xee31('0x50')]();var _0x2ab95b=path[_0xee31('0x51')](config['root'],'server','files',_0xee31('0x52'));var _0x4bdc5e=path[_0xee31('0x51')](config[_0xee31('0x53')],_0xee31('0x54'),'files',_0xee31('0x55'));var _0x6ed35b=path[_0xee31('0x51')](_0x2ab95b,_0xe1c6b2);var _0x480899=util['format'](_0xee31('0x56'),_0x4acfed['params']['id'],_0xe1c6b2);var _0x20ab05=path['join'](_0x2ab95b,_0x480899);var _0x5621a6=[];_0x5621a6[_0xee31('0x57')]({'model':db[_0xee31('0x58')],'as':'User','attributes':['id',_0xee31('0x59')],'raw':!![]});_0x5621a6[_0xee31('0x57')]({'model':db[_0xee31('0x5a')],'as':'Contact','attributes':['id',_0xee31('0x5b'),_0xee31('0x5c')],'raw':!![]});if(_0x4acfed[_0xee31('0x26')][_0xee31('0x55')]){_0x5621a6[_0xee31('0x57')]({'model':db['Attachment'],'as':_0xee31('0x5d'),'raw':!![]});}var _0x42e106=[{'model':db[_0xee31('0x36')],'as':'Messages','attributes':['id',_0xee31('0x32'),_0xee31('0x5e'),_0xee31('0x5f'),_0xee31('0x60'),_0xee31('0x61')],'include':_0x5621a6}];_0x42e106['push']({'model':db['OpenchannelAccount'],'as':_0xee31('0x62'),'attributes':['id',_0xee31('0x1d')]});_0x42e106[_0xee31('0x57')]({'model':db[_0xee31('0x58')],'as':_0xee31('0x63'),'attributes':['id',_0xee31('0x59')]});return db[_0xee31('0x1f')][_0xee31('0x33')]({'where':{'id':_0x4acfed[_0xee31('0x2a')]['id']},'include':_0x42e106})[_0xee31('0x1a')](handleEntityNotFound(_0x53b5d1,null))[_0xee31('0x1a')](function(_0x379828){if(_0x379828){var _0x3f3ceb=_0x379828[_0xee31('0x64')]({'plain':!![]});fs[_0xee31('0x65')](_0x6ed35b);var _0x16b6b9={'channel':_0xee31('0x66'),'account':_0x3f3ceb[_0xee31('0x62')][_0xee31('0x1d')],'agent':_0x3f3ceb[_0xee31('0x63')]?_0x3f3ceb[_0xee31('0x63')][_0xee31('0x59')]:'N.A.','createdAt':moment(_0x3f3ceb[_0xee31('0x5e')])[_0xee31('0x47')](_0xee31('0x48'))[_0xee31('0x50')](),'closedAt':_0x3f3ceb[_0xee31('0x67')]?moment(_0x3f3ceb[_0xee31('0x68')])['format'](_0xee31('0x48'))[_0xee31('0x50')]():'','disposition':_0x3f3ceb['disposition'],'visibility':_0x3f3ceb['threadId']?_0xee31('0x69'):_0xee31('0x6a'),'messages':_(_0x3f3ceb[_0xee31('0x6b')])[_0xee31('0x42')]({'secret':![]})[_0xee31('0x44')](function(_0x4197f8){if(_0x4197f8[_0xee31('0x5d')]){var _0x14ff70=path[_0xee31('0x51')](_0x4bdc5e,_0x4197f8[_0xee31('0x5d')][_0xee31('0x6c')]);if(fs[_0xee31('0x6d')](_0x14ff70)){fs[_0xee31('0x6e')](_0x14ff70)[_0xee31('0x6f')](fs[_0xee31('0x70')](path[_0xee31('0x51')](_0x6ed35b,_0x4197f8[_0xee31('0x5d')][_0xee31('0x6c')])));}}return{'date':moment(_0x4197f8['createdAt'])[_0xee31('0x47')](_0xee31('0x48'))[_0xee31('0x50')](),'sender':_0x4197f8['direction']===_0xee31('0x71')?_0x4197f8['User']?_0x4197f8['User'][_0xee31('0x59')]:_0xee31('0x72'):_0x4197f8[_0xee31('0x73')][_0xee31('0x5b')]+(_0x4197f8[_0xee31('0x73')][_0xee31('0x5c')]?'\x20'+_0x4197f8['Contact'][_0xee31('0x5c')]:''),'body':_0x4197f8['Attachment']?_0x4197f8[_0xee31('0x5d')][_0xee31('0x6c')]:_0x4197f8['body'],'direction':_0x4197f8[_0xee31('0x5f')]==='out'?'A':'C','secret':_0x4197f8[_0xee31('0x60')],'read':_0x4197f8[_0xee31('0x61')],'attachment':_0x4197f8[_0xee31('0x5d')]};})['value']()};return ejs[_0xee31('0x74')](path[_0xee31('0x51')](config[_0xee31('0x53')],_0xee31('0x54'),_0xee31('0x75'),_0xee31('0x76')),{'interaction':_0x16b6b9})[_0xee31('0x1a')](function(_0x1bdc00){var _0x30ef08=path['join'](_0x6ed35b,_0xee31('0x77')+_0x3f3ceb['id']+'-'+_0xe1c6b2+_0xee31('0x78'));var _0x26b8de={'path':_0x30ef08,'channel':_0xee31('0x66'),'interactionId':_0x3f3ceb['id']};return pdf[_0xee31('0x79')](_0x1bdc00,_0x26b8de);})[_0xee31('0x1a')](function(){return new Promise(function(_0x262ed6,_0xb87eae){zipdir(_0x6ed35b,{'saveTo':_0x20ab05},function(_0x11ba06,_0x2f00d5){if(_0x11ba06)return _0xb87eae(_0x11ba06);return _0x262ed6(_0x2f00d5);});})['then'](function(){return new Promise(function(_0x35f643,_0x5c494b){rimraf(_0x6ed35b,function(_0x13114e){if(_0x13114e)_0x5c494b(_0x13114e);return _0x35f643();});});})[_0xee31('0x1a')](function(){return _0x53b5d1[_0xee31('0x4e')](_0x20ab05,_0x480899,function(_0x5f325c){if(_0x5f325c){logger[_0xee31('0x1c')](_0xee31('0x7a'),_0x5f325c);}else{fs['unlinkSync'](_0x20ab05);}});});});}else{return _0x53b5d1[_0xee31('0x7b')](0xc8);}})[_0xee31('0x27')](handleError(_0x53b5d1,null));}; \ No newline at end of file +var _0xbf43=['renderFile','views','transcript-','createPdfFromHTML','download','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','moment','ejs','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','findAll','openchannel','query','user','catch','show','type','from','params','model','keys','filters','intersection','fields','attributes','length','includeAll','OpenchannelInteraction','find','create','body','describe','addMessage','OpenchannelMessage','omit','ids','getMessages','findOne','hasOwnProperty','nolimit','limit','order','pick','filter','where','merge','$gte','split','addTags','spread','Tag','color','removeTags','toString','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','Attachment','Messages','createdAt','secret','read','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','threadId','Public','Private','basename','existsSync','createReadStream','pipe','direction','out','System','lastName','value'];(function(_0x59e380,_0x25a054){var _0x1204c2=function(_0x4b7389){while(--_0x4b7389){_0x59e380['push'](_0x59e380['shift']());}};_0x1204c2(++_0x25a054);}(_0xbf43,0x105));var _0x3bf4=function(_0x5227ef,_0x5553fe){_0x5227ef=_0x5227ef-0x0;var _0x2685df=_0xbf43[_0x5227ef];return _0x2685df;};'use strict';var rimraf=require(_0x3bf4('0x0'));var zipdir=require(_0x3bf4('0x1'));var moment=require(_0x3bf4('0x2'));var util=require('util');var path=require('path');var ejs=require(_0x3bf4('0x3'));var fs=require('fs');var _=require(_0x3bf4('0x4'));var Redis=require(_0x3bf4('0x5'));var interaction=require(_0x3bf4('0x6'));var qs=require('../../components/parsers/qs');var pdf=require(_0x3bf4('0x7'));var logger=require(_0x3bf4('0x8'))(_0x3bf4('0x9'));var config=require('../../config/environment');var db=require(_0x3bf4('0xa'))['db'];config[_0x3bf4('0xb')]=_[_0x3bf4('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3bf4('0xd'))(new Redis(config[_0x3bf4('0xb')]));require('./openchannelInteraction.socket')[_0x3bf4('0xe')](socket);function respondWithStatusCode(_0x14a934,_0x26715b){_0x26715b=_0x26715b||0xcc;return function(_0x5beab8){if(_0x5beab8){return _0x14a934[_0x3bf4('0xf')](_0x26715b);}return _0x14a934[_0x3bf4('0x10')](_0x26715b)[_0x3bf4('0x11')]();};}function respondWithResult(_0x3b2c98,_0x5c315c){_0x5c315c=_0x5c315c||0xc8;return function(_0x316ce3){if(_0x316ce3){return _0x3b2c98['status'](_0x5c315c)['json'](_0x316ce3);}};}function respondWithFilteredResult(_0x483a00,_0x2b6e71){return function(_0x50a86d){if(_0x50a86d){var _0x39b830=typeof _0x2b6e71[_0x3bf4('0x12')]==='undefined'&&typeof _0x2b6e71['limit']===_0x3bf4('0x13');var _0x3fc2a9=_0x50a86d[_0x3bf4('0x14')];var _0x46ca33=_0x39b830?0x0:_0x2b6e71[_0x3bf4('0x12')];var _0x473fad=_0x39b830?_0x50a86d[_0x3bf4('0x14')]:_0x2b6e71[_0x3bf4('0x12')]+_0x2b6e71['limit'];var _0x3433db;if(_0x473fad>=_0x3fc2a9){_0x473fad=_0x3fc2a9;_0x3433db=0xc8;}else{_0x3433db=0xce;}_0x483a00[_0x3bf4('0x10')](_0x3433db);return _0x483a00[_0x3bf4('0x15')](_0x3bf4('0x16'),_0x46ca33+'-'+_0x473fad+'/'+_0x3fc2a9)[_0x3bf4('0x17')](_0x50a86d);}return null;};}function saveUpdates(_0x2e43ed){return function(_0x3d357d){if(_0x3d357d){return _0x3d357d[_0x3bf4('0x18')](_0x2e43ed)['then'](function(_0x2c5a7b){return _0x2c5a7b;});}return null;};}function removeEntity(_0x362c3b){return function(_0x29249e){if(_0x29249e){return _0x29249e[_0x3bf4('0x19')]()[_0x3bf4('0x1a')](function(){_0x362c3b[_0x3bf4('0x10')](0xcc)[_0x3bf4('0x11')]();});}};}function handleEntityNotFound(_0x35fdbb){return function(_0x4a410c){if(!_0x4a410c){_0x35fdbb['sendStatus'](0x194);}return _0x4a410c;};}function handleError(_0x584bba,_0x3da2bc){_0x3da2bc=_0x3da2bc||0x1f4;return function(_0x1e005c){logger[_0x3bf4('0x1b')](_0x1e005c[_0x3bf4('0x1c')]);if(_0x1e005c[_0x3bf4('0x1d')]){delete _0x1e005c[_0x3bf4('0x1d')];}_0x584bba['status'](_0x3da2bc)[_0x3bf4('0x1e')](_0x1e005c);};}exports[_0x3bf4('0x1f')]=function(_0x443caa,_0x8d1d21){var _0x4e412c={};var _0xc42b60=_[_0x3bf4('0x20')](db['OpenchannelInteraction'][_0x3bf4('0x21')],function(_0x1c79fb){return{'name':_0x1c79fb[_0x3bf4('0x22')],'type':_0x1c79fb['type'][_0x3bf4('0x23')]};});_0x4e412c=qs['getOptions'](_0xc42b60,_0x443caa);return interaction[_0x3bf4('0x24')](_0x3bf4('0x25'),_0x443caa[_0x3bf4('0x26')],_0x443caa[_0x3bf4('0x27')],_0x4e412c,_0xc42b60)[_0x3bf4('0x1a')](respondWithFilteredResult(_0x8d1d21,_0x4e412c))[_0x3bf4('0x28')](handleError(_0x8d1d21,null));};exports[_0x3bf4('0x29')]=function(_0x4eef38,_0x159af0){var _0x39051c={};if(_0x4eef38[_0x3bf4('0x26')][_0x3bf4('0x2a')]&&_0x4eef38[_0x3bf4('0x26')][_0x3bf4('0x2a')]===_0x3bf4('0x2b')){_0x39051c[_0x3bf4('0x2b')]=_0x4eef38['params']['id'];}else{_0x39051c['id']=_0x4eef38[_0x3bf4('0x2c')]['id'];}var _0x2a9250={'raw':![],'where':_0x39051c},_0x392b9d={};_0x392b9d[_0x3bf4('0x2d')]=_[_0x3bf4('0x2e')](db['OpenchannelInteraction'][_0x3bf4('0x21')]);_0x392b9d['query']=_[_0x3bf4('0x2e')](_0x4eef38[_0x3bf4('0x26')]);_0x392b9d[_0x3bf4('0x2f')]=_['intersection'](_0x392b9d[_0x3bf4('0x2d')],_0x392b9d['query']);_0x2a9250['attributes']=_[_0x3bf4('0x30')](_0x392b9d[_0x3bf4('0x2d')],qs[_0x3bf4('0x31')](_0x4eef38[_0x3bf4('0x26')][_0x3bf4('0x31')]));_0x2a9250[_0x3bf4('0x32')]=_0x2a9250[_0x3bf4('0x32')][_0x3bf4('0x33')]?_0x2a9250[_0x3bf4('0x32')]:_0x392b9d[_0x3bf4('0x2d')];if(_0x4eef38[_0x3bf4('0x26')][_0x3bf4('0x34')]){_0x2a9250['include']=[{'all':!![]}];}_0x2a9250=_['merge']({},_0x2a9250,_0x4eef38['options']);return db[_0x3bf4('0x35')][_0x3bf4('0x36')](_0x2a9250)[_0x3bf4('0x1a')](handleEntityNotFound(_0x159af0,null))[_0x3bf4('0x1a')](respondWithResult(_0x159af0,null))[_0x3bf4('0x28')](handleError(_0x159af0,null));};exports[_0x3bf4('0x37')]=function(_0x234bf8,_0x4ce6b8){return db['OpenchannelInteraction'][_0x3bf4('0x37')](_0x234bf8['body'],{})[_0x3bf4('0x1a')](respondWithResult(_0x4ce6b8,0xc9))[_0x3bf4('0x28')](handleError(_0x4ce6b8,null));};exports[_0x3bf4('0x18')]=function(_0x63e293,_0x126bf5){if(_0x63e293[_0x3bf4('0x38')]['id']){delete _0x63e293[_0x3bf4('0x38')]['id'];}return db[_0x3bf4('0x35')][_0x3bf4('0x36')]({'where':{'id':_0x63e293['params']['id']}})[_0x3bf4('0x1a')](handleEntityNotFound(_0x126bf5,null))[_0x3bf4('0x1a')](saveUpdates(_0x63e293[_0x3bf4('0x38')],null))['then'](respondWithResult(_0x126bf5,null))[_0x3bf4('0x28')](handleError(_0x126bf5,null));};exports[_0x3bf4('0x19')]=function(_0x2d5b4c,_0x15b735){return db[_0x3bf4('0x35')][_0x3bf4('0x36')]({'where':{'id':_0x2d5b4c[_0x3bf4('0x2c')]['id']}})['then'](handleEntityNotFound(_0x15b735,null))['then'](removeEntity(_0x15b735,null))[_0x3bf4('0x28')](handleError(_0x15b735,null));};exports[_0x3bf4('0x39')]=function(_0x9f2779,_0x29bad1){return db[_0x3bf4('0x35')][_0x3bf4('0x39')]()[_0x3bf4('0x1a')](respondWithResult(_0x29bad1,null))['catch'](handleError(_0x29bad1,null));};exports[_0x3bf4('0x3a')]=function(_0x4077f7,_0x1bbd51){return db[_0x3bf4('0x3b')][_0x3bf4('0x36')]({'where':{'id':_0x4077f7[_0x3bf4('0x2c')]['id']}})[_0x3bf4('0x1a')](handleEntityNotFound(_0x1bbd51,null))[_0x3bf4('0x1a')](function(_0x250cbf){if(_0x250cbf){return _0x250cbf[_0x3bf4('0x3a')](_0x4077f7[_0x3bf4('0x38')]['ids'],_[_0x3bf4('0x3c')](_0x4077f7[_0x3bf4('0x38')],[_0x3bf4('0x3d'),'id'])||{});}})[_0x3bf4('0x1a')](respondWithResult(_0x1bbd51,null))['catch'](handleError(_0x1bbd51,null));};exports[_0x3bf4('0x3e')]=function(_0x349575,_0x346baa){var _0x103c6f={'raw':![],'where':{}};var _0x279f61={};var _0x5aa3e9={'count':0x0,'rows':[]};return db[_0x3bf4('0x35')][_0x3bf4('0x3f')]({'where':{'id':_0x349575[_0x3bf4('0x2c')]['id']}})[_0x3bf4('0x1a')](handleEntityNotFound(_0x346baa,null))[_0x3bf4('0x1a')](function(_0x58baef){if(_0x58baef){_0x279f61['model']=_['keys'](db[_0x3bf4('0x3b')][_0x3bf4('0x21')]);_0x279f61[_0x3bf4('0x26')]=_[_0x3bf4('0x2e')](_0x349575['query']);_0x279f61[_0x3bf4('0x2f')]=_[_0x3bf4('0x30')](_0x279f61[_0x3bf4('0x2d')],_0x279f61[_0x3bf4('0x26')]);_0x103c6f[_0x3bf4('0x32')]=_[_0x3bf4('0x30')](_0x279f61['model'],qs[_0x3bf4('0x31')](_0x349575[_0x3bf4('0x26')][_0x3bf4('0x31')]));_0x103c6f['attributes']=_0x103c6f['attributes'][_0x3bf4('0x33')]?_0x103c6f[_0x3bf4('0x32')]:_0x279f61[_0x3bf4('0x2d')];if(!_0x349575[_0x3bf4('0x26')][_0x3bf4('0x40')](_0x3bf4('0x41'))){_0x103c6f[_0x3bf4('0x42')]=qs[_0x3bf4('0x42')](_0x349575[_0x3bf4('0x26')]['limit']);_0x103c6f[_0x3bf4('0x12')]=qs[_0x3bf4('0x12')](_0x349575[_0x3bf4('0x26')][_0x3bf4('0x12')]);}_0x103c6f[_0x3bf4('0x43')]=qs['sort'](_0x349575['query']['sort']);_0x103c6f['where']=qs['filters'](_[_0x3bf4('0x44')](_0x349575[_0x3bf4('0x26')],_0x279f61[_0x3bf4('0x2f')]));_0x103c6f['where']['OpenchannelInteractionId']=_0x58baef['id'];if(_0x349575[_0x3bf4('0x26')][_0x3bf4('0x45')]){_0x103c6f[_0x3bf4('0x46')]=_[_0x3bf4('0x47')](_0x103c6f[_0x3bf4('0x46')],{'$or':_[_0x3bf4('0x20')](_0x103c6f[_0x3bf4('0x32')],function(_0xff4288){var _0x3cbcdc={};_0x3cbcdc[_0xff4288]={'$like':'%'+_0x349575[_0x3bf4('0x26')][_0x3bf4('0x45')]+'%'};return _0x3cbcdc;})});}if(_0x349575['query'][_0x3bf4('0x48')]){var _0x4bb36d=_0x349575[_0x3bf4('0x26')][_0x3bf4('0x48')][_0x3bf4('0x49')](',');var _0x1a186c={};_0x1a186c[_0x4bb36d[0x0]]={'$gte':moment(_0x4bb36d[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x103c6f[_0x3bf4('0x46')]=_[_0x3bf4('0x47')](_0x103c6f['where'],_0x1a186c);}_0x103c6f=_['merge']({},_0x103c6f,_0x349575['options']);return db[_0x3bf4('0x3b')]['count']({'where':_0x103c6f[_0x3bf4('0x46')]})[_0x3bf4('0x1a')](function(_0x5b5f0b){_0x5aa3e9[_0x3bf4('0x14')]=_0x5b5f0b;if(_0x349575[_0x3bf4('0x26')][_0x3bf4('0x34')]){_0x103c6f['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0x3bf4('0x24')](_0x103c6f);})['then'](function(_0x415bed){_0x5aa3e9['rows']=_0x415bed;return _0x5aa3e9;});}})[_0x3bf4('0x1a')](respondWithFilteredResult(_0x346baa,_0x103c6f))[_0x3bf4('0x28')](handleError(_0x346baa,null));};exports[_0x3bf4('0x4a')]=function(_0x2de803,_0x1879b8){return db[_0x3bf4('0x35')]['find']({'where':{'id':_0x2de803[_0x3bf4('0x2c')]['id']}})[_0x3bf4('0x1a')](handleEntityNotFound(_0x1879b8,null))[_0x3bf4('0x1a')](function(_0x542a5f){if(_0x542a5f){return _0x542a5f['setTags'](_0x2de803['body'][_0x3bf4('0x3d')],_[_0x3bf4('0x3c')](_0x2de803[_0x3bf4('0x38')],[_0x3bf4('0x3d'),'id'])||{})[_0x3bf4('0x4b')](function(){return db[_0x3bf4('0x4c')][_0x3bf4('0x24')]({'attributes':['id','name',_0x3bf4('0x4d')],'where':{'id':_0x2de803[_0x3bf4('0x38')][_0x3bf4('0x3d')]}});})['then'](function(_0x111171){socket['emit']('openchannelInteractionTags:save',{'id':Number(_0x2de803[_0x3bf4('0x2c')]['id']),'tags':_0x111171||[]});return{'id':Number(_0x2de803['params']['id']),'tags':_0x111171||[]};});}})['then'](respondWithResult(_0x1879b8,null))['catch'](handleError(_0x1879b8,null));};exports[_0x3bf4('0x4e')]=function(_0x135cc6,_0x5cdaa0){return db[_0x3bf4('0x35')]['find']({'where':{'id':_0x135cc6[_0x3bf4('0x2c')]['id']}})[_0x3bf4('0x1a')](handleEntityNotFound(_0x5cdaa0,null))[_0x3bf4('0x1a')](function(_0x268170){if(_0x268170){return _0x268170[_0x3bf4('0x4e')](_0x135cc6[_0x3bf4('0x26')]['ids']);}})[_0x3bf4('0x1a')](respondWithStatusCode(_0x5cdaa0,null))[_0x3bf4('0x28')](handleError(_0x5cdaa0,null));};exports['download']=function(_0x5509b0,_0xcc84e3){var _0x3856d9=moment()['unix']()[_0x3bf4('0x4f')]();var _0x512710=path[_0x3bf4('0x50')](config[_0x3bf4('0x51')],_0x3bf4('0x52'),_0x3bf4('0x53'),_0x3bf4('0x54'));var _0x2344b8=path[_0x3bf4('0x50')](config['root'],_0x3bf4('0x52'),_0x3bf4('0x53'),_0x3bf4('0x55'));var _0x1735e5=path[_0x3bf4('0x50')](_0x512710,_0x3856d9);var _0x2a940a=util[_0x3bf4('0x56')](_0x3bf4('0x57'),_0x5509b0[_0x3bf4('0x2c')]['id'],_0x3856d9);var _0x583427=path[_0x3bf4('0x50')](_0x512710,_0x2a940a);var _0x5d692f=[];_0x5d692f[_0x3bf4('0x58')]({'model':db[_0x3bf4('0x59')],'as':_0x3bf4('0x59'),'attributes':['id',_0x3bf4('0x5a')],'raw':!![]});_0x5d692f[_0x3bf4('0x58')]({'model':db[_0x3bf4('0x5b')],'as':_0x3bf4('0x5c'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x5509b0[_0x3bf4('0x26')][_0x3bf4('0x55')]){_0x5d692f[_0x3bf4('0x58')]({'model':db[_0x3bf4('0x5d')],'as':_0x3bf4('0x5d'),'raw':!![]});}var _0x8730cb=[{'model':db[_0x3bf4('0x3b')],'as':_0x3bf4('0x5e'),'attributes':['id',_0x3bf4('0x38'),_0x3bf4('0x5f'),'direction',_0x3bf4('0x60'),_0x3bf4('0x61')],'include':_0x5d692f}];_0x8730cb[_0x3bf4('0x58')]({'model':db[_0x3bf4('0x62')],'as':_0x3bf4('0x63'),'attributes':['id',_0x3bf4('0x1d')]});_0x8730cb[_0x3bf4('0x58')]({'model':db[_0x3bf4('0x59')],'as':_0x3bf4('0x64'),'attributes':['id',_0x3bf4('0x5a')]});return db[_0x3bf4('0x35')]['find']({'where':{'id':_0x5509b0[_0x3bf4('0x2c')]['id']},'include':_0x8730cb})[_0x3bf4('0x1a')](handleEntityNotFound(_0xcc84e3,null))[_0x3bf4('0x1a')](function(_0x566313){if(_0x566313){var _0x113666=_0x566313[_0x3bf4('0x65')]({'plain':!![]});fs[_0x3bf4('0x66')](_0x1735e5);var _0x1f1c9b={'channel':_0x3bf4('0x67'),'account':_0x113666[_0x3bf4('0x63')]['name'],'agent':_0x113666[_0x3bf4('0x64')]?_0x113666[_0x3bf4('0x64')][_0x3bf4('0x5a')]:_0x3bf4('0x68'),'createdAt':moment(_0x113666[_0x3bf4('0x5f')])[_0x3bf4('0x56')](_0x3bf4('0x69'))[_0x3bf4('0x4f')](),'closedAt':_0x113666[_0x3bf4('0x6a')]?moment(_0x113666[_0x3bf4('0x6b')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x3bf4('0x4f')]():'','disposition':_0x113666['disposition'],'visibility':_0x113666[_0x3bf4('0x6c')]?_0x3bf4('0x6d'):_0x3bf4('0x6e'),'messages':_(_0x113666['Messages'])[_0x3bf4('0x45')]({'secret':![]})['map'](function(_0x41a129){if(_0x41a129[_0x3bf4('0x5d')]){var _0x3fa7ba=path[_0x3bf4('0x50')](_0x2344b8,_0x41a129[_0x3bf4('0x5d')][_0x3bf4('0x6f')]);if(fs[_0x3bf4('0x70')](_0x3fa7ba)){fs[_0x3bf4('0x71')](_0x3fa7ba)[_0x3bf4('0x72')](fs['createWriteStream'](path[_0x3bf4('0x50')](_0x1735e5,_0x41a129['Attachment'][_0x3bf4('0x6f')])));}}return{'date':moment(_0x41a129[_0x3bf4('0x5f')])[_0x3bf4('0x56')](_0x3bf4('0x69'))[_0x3bf4('0x4f')](),'sender':_0x41a129[_0x3bf4('0x73')]===_0x3bf4('0x74')?_0x41a129[_0x3bf4('0x59')]?_0x41a129['User'][_0x3bf4('0x5a')]:_0x3bf4('0x75'):_0x41a129[_0x3bf4('0x5c')]['firstName']+(_0x41a129[_0x3bf4('0x5c')][_0x3bf4('0x76')]?'\x20'+_0x41a129[_0x3bf4('0x5c')]['lastName']:''),'body':_0x41a129[_0x3bf4('0x5d')]?_0x41a129[_0x3bf4('0x5d')][_0x3bf4('0x6f')]:_0x41a129['body'],'direction':_0x41a129['direction']==='out'?'A':'C','secret':_0x41a129[_0x3bf4('0x60')],'read':_0x41a129[_0x3bf4('0x61')],'attachment':_0x41a129[_0x3bf4('0x5d')]};})[_0x3bf4('0x77')]()};return ejs[_0x3bf4('0x78')](path[_0x3bf4('0x50')](config[_0x3bf4('0x51')],_0x3bf4('0x52'),_0x3bf4('0x79'),'downloadInteraction.ejs'),{'interaction':_0x1f1c9b})[_0x3bf4('0x1a')](function(_0x4bc192){var _0x1cc0ba=path[_0x3bf4('0x50')](_0x1735e5,_0x3bf4('0x7a')+_0x113666['id']+'-'+_0x3856d9+'.pdf');var _0x50400f={'path':_0x1cc0ba,'channel':_0x3bf4('0x67'),'interactionId':_0x113666['id']};return pdf[_0x3bf4('0x7b')](_0x4bc192,_0x50400f);})[_0x3bf4('0x1a')](function(){return new Promise(function(_0x375e6d,_0x3802a7){zipdir(_0x1735e5,{'saveTo':_0x583427},function(_0x229b9e,_0x16802c){if(_0x229b9e)return _0x3802a7(_0x229b9e);return _0x375e6d(_0x16802c);});})['then'](function(){return new Promise(function(_0x428ad4,_0x107ba1){rimraf(_0x1735e5,function(_0x28f821){if(_0x28f821)_0x107ba1(_0x28f821);return _0x428ad4();});});})[_0x3bf4('0x1a')](function(){return _0xcc84e3[_0x3bf4('0x7c')](_0x583427,_0x2a940a,function(_0x473202){if(_0x473202){logger[_0x3bf4('0x1b')](_0x3bf4('0x7d'),_0x473202);}else{fs[_0x3bf4('0x7e')](_0x583427);}});});});}else{return _0xcc84e3[_0x3bf4('0xf')](0xc8);}})[_0x3bf4('0x28')](handleError(_0xcc84e3,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 75cfee8..eab9381 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 _0xe6a4=['findAll','then','setDataValue','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','OpenchannelInteraction','setMaxListeners','save','remove','getUsers'];(function(_0x3b38eb,_0x15dc43){var _0x46a0e7=function(_0x53a884){while(--_0x53a884){_0x3b38eb['push'](_0x3b38eb['shift']());}};_0x46a0e7(++_0x15dc43);}(_0xe6a4,0x19d));var _0x4e6a=function(_0x52fc98,_0x234046){_0x52fc98=_0x52fc98-0x0;var _0x5ef66b=_0xe6a4[_0x52fc98];return _0x5ef66b;};'use strict';var EventEmitter=require(_0x4e6a('0x0'));var OpenchannelInteraction=require(_0x4e6a('0x1'))['db'][_0x4e6a('0x2')];var OpenchannelMessage=require(_0x4e6a('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x4e6a('0x3')](0x0);var events={'afterCreate':_0x4e6a('0x4'),'afterUpdate':'update','afterDestroy':_0x4e6a('0x5')};function emitEvent(_0x205fe3){return function(_0x226c12,_0x289d68,_0xc6583){_0x226c12[_0x4e6a('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3fa3b1){_0x226c12['setDataValue']('Users',_0x3fa3b1['map'](function(_0x51eb61){return{'id':_0x51eb61['id']};}));return OpenchannelMessage[_0x4e6a('0x7')]({'where':{'OpenchannelInteractionId':_0x226c12['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4e6a('0x8')](function(_0x14612a){_0x226c12[_0x4e6a('0x9')]('unreadMessages',_0x14612a[_0x4e6a('0xa')]);OpenchannelInteractionEvents[_0x4e6a('0xb')](_0x205fe3+':'+_0x226c12['id'],_0x226c12);OpenchannelInteractionEvents[_0x4e6a('0xb')](_0x205fe3,_0x226c12);_0xc6583(null);})[_0x4e6a('0xc')](_0xc6583(null));};}for(var e in events){if(events[_0x4e6a('0xd')](e)){var event=events[e];OpenchannelInteraction[_0x4e6a('0xe')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0xe31e=['hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers','then','Users','map','findAll','setDataValue','length','emit','catch','hasOwnProperty'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0xe31e,0x8e));var _0xee31=function(_0x265bd2,_0xa73b62){_0x265bd2=_0x265bd2-0x0;var _0x7d3318=_0xe31e[_0x265bd2];return _0x7d3318;};'use strict';var EventEmitter=require(_0xee31('0x0'));var OpenchannelInteraction=require(_0xee31('0x1'))['db'][_0xee31('0x2')];var OpenchannelMessage=require('../../mysqldb')['db'][_0xee31('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xee31('0x4')](0x0);var events={'afterCreate':_0xee31('0x5'),'afterUpdate':_0xee31('0x6'),'afterDestroy':_0xee31('0x7')};function emitEvent(_0x452123){return function(_0x177502,_0xfd6c8f,_0x22b5cc){_0x177502[_0xee31('0x8')]({'attributes':['id'],'raw':!![]})[_0xee31('0x9')](function(_0x44696c){_0x177502['setDataValue'](_0xee31('0xa'),_0x44696c[_0xee31('0xb')](function(_0xec342a){return{'id':_0xec342a['id']};}));return OpenchannelMessage[_0xee31('0xc')]({'where':{'OpenchannelInteractionId':_0x177502['id'],'direction':'in','read':![]},'raw':!![]});})[_0xee31('0x9')](function(_0x3299ac){_0x177502[_0xee31('0xd')]('unreadMessages',_0x3299ac[_0xee31('0xe')]);OpenchannelInteractionEvents[_0xee31('0xf')](_0x452123+':'+_0x177502['id'],_0x177502);OpenchannelInteractionEvents[_0xee31('0xf')](_0x452123,_0x177502);_0x22b5cc(null);})[_0xee31('0x10')](_0x22b5cc(null));};}for(var e in events){if(events[_0xee31('0x11')](e)){var event=events[e];OpenchannelInteraction[_0xee31('0x12')](e,emitEvent(event));}}module[_0xee31('0x13')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index dd8602d..fc1aaeb 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 _0x5836=['../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','bluebird','path','rimraf'];(function(_0x335e20,_0x3b998c){var _0x410b0f=function(_0x5c4075){while(--_0x5c4075){_0x335e20['push'](_0x335e20['shift']());}};_0x410b0f(++_0x3b998c);}(_0x5836,0x12c));var _0x6583=function(_0x54a892,_0x1a4eeb){_0x54a892=_0x54a892-0x0;var _0x1f24f1=_0x5836[_0x54a892];return _0x1f24f1;};'use strict';var _=require(_0x6583('0x0'));var util=require('util');var logger=require(_0x6583('0x1'))(_0x6583('0x2'));var moment=require('moment');var BPromise=require(_0x6583('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6583('0x4'));var rimraf=require(_0x6583('0x5'));var config=require(_0x6583('0x6'));var attributes=require(_0x6583('0x7'));module[_0x6583('0x8')]=function(_0x4cd71c,_0x17d685){return _0x4cd71c[_0x6583('0x9')](_0x6583('0xa'),attributes,{'tableName':_0x6583('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6583('0xc'),'collate':_0x6583('0xd'),'hooks':{'beforeUpdate':function(_0x8d2159,_0x2cbce2,_0xe48331){if(_0x8d2159[_0x6583('0xe')]('closed')){_0x8d2159[_0x6583('0xf')]=moment()[_0x6583('0x10')](_0x6583('0x11'));}_0xe48331(null,_0x8d2159);}}});}; \ No newline at end of file +var _0xf527=['bluebird','request-promise','path','../../config/environment','exports','OpenchannelInteraction','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xf527,0x1bd));var _0x7f52=function(_0x44cd39,_0x43b2b4){_0x44cd39=_0x44cd39-0x0;var _0x4b65bb=_0xf527[_0x44cd39];return _0x4b65bb;};'use strict';var _=require(_0x7f52('0x0'));var util=require(_0x7f52('0x1'));var logger=require('../../config/logger')(_0x7f52('0x2'));var moment=require('moment');var BPromise=require(_0x7f52('0x3'));var rp=require(_0x7f52('0x4'));var fs=require('fs');var path=require(_0x7f52('0x5'));var rimraf=require('rimraf');var config=require(_0x7f52('0x6'));var attributes=require('./openchannelInteraction.attributes');module[_0x7f52('0x7')]=function(_0x46fbfc,_0x12e858){return _0x46fbfc['define'](_0x7f52('0x8'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7f52('0x9'),'collate':_0x7f52('0xa'),'hooks':{'beforeUpdate':function(_0xd1c22d,_0x210f4c,_0x4d66ca){if(_0xd1c22d[_0x7f52('0xb')](_0x7f52('0xc'))){_0xd1c22d[_0x7f52('0xd')]=moment()[_0x7f52('0xe')](_0x7f52('0xf'));}_0x4d66ca(null,_0xd1c22d);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 315e055..49ac046 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 _0x4247=['error','code','message','result','catch','OpenchannelInteraction','body','options','raw','where','attributes','then','UpdateOpenchannelInteraction','addTags','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','register','request','info','OpenchannelInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x140add,_0x264320){var _0x46bef7=function(_0x149f93){while(--_0x149f93){_0x140add['push'](_0x140add['shift']());}};_0x46bef7(++_0x264320);}(_0x4247,0xaa));var _0x7424=function(_0x6cb702,_0x114093){_0x6cb702=_0x6cb702-0x0;var _0x65c56e=_0x4247[_0x6cb702];return _0x65c56e;};'use strict';var _=require('lodash');var util=require(_0x7424('0x0'));var moment=require(_0x7424('0x1'));var BPromise=require(_0x7424('0x2'));var rs=require(_0x7424('0x3'));var fs=require('fs');var Redis=require(_0x7424('0x4'));var db=require(_0x7424('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7424('0x6'))('rpc');var config=require(_0x7424('0x7'));var jayson=require(_0x7424('0x8'));var client=jayson[_0x7424('0x9')]['http']({'port':0x232a});config[_0x7424('0xa')]=_[_0x7424('0xb')](config[_0x7424('0xa')],{'host':_0x7424('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7424('0xa')]));require('./openchannelInteraction.socket')[_0x7424('0xd')](socket);function respondWithRpcPromise(_0x549acb,_0x15cdbc,_0x1cdb25){return new BPromise(function(_0x2bc004,_0x35e6c1){return client[_0x7424('0xe')](_0x549acb,_0x1cdb25)['then'](function(_0xf63d16){logger[_0x7424('0xf')](_0x7424('0x10'),_0x15cdbc,'request\x20sent');logger[_0x7424('0x11')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x15cdbc,_0x7424('0x12'),JSON[_0x7424('0x13')](_0xf63d16));if(_0xf63d16[_0x7424('0x14')]){if(_0xf63d16[_0x7424('0x14')][_0x7424('0x15')]===0x1f4){logger[_0x7424('0x14')](_0x7424('0x10'),_0x15cdbc,_0xf63d16[_0x7424('0x14')][_0x7424('0x16')]);return _0x35e6c1(_0xf63d16['error'][_0x7424('0x16')]);}logger['error'](_0x7424('0x10'),_0x15cdbc,_0xf63d16[_0x7424('0x14')][_0x7424('0x16')]);return _0x2bc004(_0xf63d16['error'][_0x7424('0x16')]);}else{logger[_0x7424('0xf')](_0x7424('0x10'),_0x15cdbc,_0x7424('0x12'));_0x2bc004(_0xf63d16[_0x7424('0x17')][_0x7424('0x16')]);}})[_0x7424('0x18')](function(_0x409db0){logger['error'](_0x7424('0x10'),_0x15cdbc,_0x409db0);_0x35e6c1(_0x409db0);});});}exports['UpdateOpenchannelInteraction']=function(_0x1a4383){var _0x3f72bc=this;return new Promise(function(_0x2dbb9e,_0x57a440){return db[_0x7424('0x19')]['update'](_0x1a4383[_0x7424('0x1a')],{'raw':_0x1a4383[_0x7424('0x1b')]?_0x1a4383['options'][_0x7424('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a4383['options']?_0x1a4383['options'][_0x7424('0x1d')]||null:null,'attributes':_0x1a4383[_0x7424('0x1b')]?_0x1a4383[_0x7424('0x1b')][_0x7424('0x1e')]||null:null,'limit':_0x1a4383['options']?_0x1a4383[_0x7424('0x1b')]['limit']||null:null})[_0x7424('0x1f')](function(_0x1eaeee){logger['info'](_0x7424('0x20'),_0x1a4383);logger['debug'](_0x7424('0x20'),_0x1a4383,JSON[_0x7424('0x13')](_0x1eaeee));_0x2dbb9e(_0x1eaeee);})[_0x7424('0x18')](function(_0x12b963){logger[_0x7424('0x14')](_0x7424('0x20'),_0x12b963[_0x7424('0x16')],_0x1a4383);_0x57a440(_0x3f72bc[_0x7424('0x14')](0x1f4,_0x12b963[_0x7424('0x16')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x2dbcf2){return new Promise(function(_0x25a9cf,_0x188e71){return db[_0x7424('0x19')]['find']({'where':_0x2dbcf2[_0x7424('0x1b')]?_0x2dbcf2[_0x7424('0x1b')][_0x7424('0x1d')]||null:null})['then'](function(_0x40ec18){if(_0x40ec18){return _0x40ec18[_0x7424('0x21')](_0x2dbcf2['body'][_0x7424('0x22')],_[_0x7424('0x23')](_0x2dbcf2[_0x7424('0x1a')],[_0x7424('0x22'),'id'])||{});}})[_0x7424('0x24')](function(_0x3365b7){logger[_0x7424('0xf')]('AddTags',_0x2dbcf2);logger[_0x7424('0x11')]('AddTags',_0x2dbcf2,JSON[_0x7424('0x13')](_0x3365b7));_0x25a9cf(_0x3365b7);})[_0x7424('0x18')](function(_0x5b3299){logger[_0x7424('0x14')](_0x7424('0x25'),_0x5b3299[_0x7424('0x16')],_0x2dbcf2);_0x188e71(_this[_0x7424('0x14')](0x1f4,_0x5b3299[_0x7424('0x16')]));});});}; \ No newline at end of file +var _0xa0f2=['../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','OpenchannelInteraction','update','body','options','raw','where','attributes','limit','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTags','omit','ids','AddTags','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x545bed,_0x221e96){var _0x16c79c=function(_0x465346){while(--_0x465346){_0x545bed['push'](_0x545bed['shift']());}};_0x16c79c(++_0x221e96);}(_0xa0f2,0xa2));var _0x2a0f=function(_0x400766,_0x368660){_0x400766=_0x400766-0x0;var _0x3ae58b=_0xa0f2[_0x400766];return _0x3ae58b;};'use strict';var _=require(_0x2a0f('0x0'));var util=require(_0x2a0f('0x1'));var moment=require('moment');var BPromise=require(_0x2a0f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2a0f('0x3'));var db=require(_0x2a0f('0x4'))['db'];var utils=require(_0x2a0f('0x5'));var logger=require(_0x2a0f('0x6'))(_0x2a0f('0x7'));var config=require('../../config/environment');var jayson=require(_0x2a0f('0x8'));var client=jayson[_0x2a0f('0x9')][_0x2a0f('0xa')]({'port':0x232a});config[_0x2a0f('0xb')]=_[_0x2a0f('0xc')](config[_0x2a0f('0xb')],{'host':_0x2a0f('0xd'),'port':0x18eb});var socket=require(_0x2a0f('0xe'))(new Redis(config[_0x2a0f('0xb')]));require(_0x2a0f('0xf'))[_0x2a0f('0x10')](socket);function respondWithRpcPromise(_0x155a1a,_0x3a2222,_0x4f030c){return new BPromise(function(_0x214211,_0x148b20){return client[_0x2a0f('0x11')](_0x155a1a,_0x4f030c)[_0x2a0f('0x12')](function(_0x2ec844){logger[_0x2a0f('0x13')](_0x2a0f('0x14'),_0x3a2222,'request\x20sent');logger[_0x2a0f('0x15')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x3a2222,_0x2a0f('0x16'),JSON[_0x2a0f('0x17')](_0x2ec844));if(_0x2ec844[_0x2a0f('0x18')]){if(_0x2ec844[_0x2a0f('0x18')][_0x2a0f('0x19')]===0x1f4){logger[_0x2a0f('0x18')]('OpenchannelInteraction,\x20%s,\x20%s',_0x3a2222,_0x2ec844[_0x2a0f('0x18')][_0x2a0f('0x1a')]);return _0x148b20(_0x2ec844[_0x2a0f('0x18')]['message']);}logger[_0x2a0f('0x18')](_0x2a0f('0x14'),_0x3a2222,_0x2ec844['error'][_0x2a0f('0x1a')]);return _0x214211(_0x2ec844[_0x2a0f('0x18')][_0x2a0f('0x1a')]);}else{logger[_0x2a0f('0x13')](_0x2a0f('0x14'),_0x3a2222,_0x2a0f('0x16'));_0x214211(_0x2ec844['result'][_0x2a0f('0x1a')]);}})[_0x2a0f('0x1b')](function(_0x38be12){logger['error'](_0x2a0f('0x14'),_0x3a2222,_0x38be12);_0x148b20(_0x38be12);});});}exports['UpdateOpenchannelInteraction']=function(_0x244b3b){var _0x1a62ec=this;return new Promise(function(_0x18417e,_0x246e7c){return db[_0x2a0f('0x1c')][_0x2a0f('0x1d')](_0x244b3b[_0x2a0f('0x1e')],{'raw':_0x244b3b[_0x2a0f('0x1f')]?_0x244b3b['options'][_0x2a0f('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x244b3b['options']?_0x244b3b[_0x2a0f('0x1f')][_0x2a0f('0x21')]||null:null,'attributes':_0x244b3b[_0x2a0f('0x1f')]?_0x244b3b[_0x2a0f('0x1f')][_0x2a0f('0x22')]||null:null,'limit':_0x244b3b[_0x2a0f('0x1f')]?_0x244b3b[_0x2a0f('0x1f')][_0x2a0f('0x23')]||null:null})[_0x2a0f('0x12')](function(_0x10d095){logger['info'](_0x2a0f('0x24'),_0x244b3b);logger[_0x2a0f('0x15')](_0x2a0f('0x24'),_0x244b3b,JSON['stringify'](_0x10d095));_0x18417e(_0x10d095);})[_0x2a0f('0x1b')](function(_0x4d0ac4){logger[_0x2a0f('0x18')](_0x2a0f('0x24'),_0x4d0ac4[_0x2a0f('0x1a')],_0x244b3b);_0x246e7c(_0x1a62ec[_0x2a0f('0x18')](0x1f4,_0x4d0ac4['message']));});});};exports[_0x2a0f('0x25')]=function(_0x1497fa){return new Promise(function(_0x54fe3d,_0x131f67){return db[_0x2a0f('0x1c')]['find']({'where':_0x1497fa[_0x2a0f('0x1f')]?_0x1497fa['options'][_0x2a0f('0x21')]||null:null})[_0x2a0f('0x12')](function(_0x240f65){if(_0x240f65){return _0x240f65[_0x2a0f('0x26')](_0x1497fa[_0x2a0f('0x1e')]['ids'],_[_0x2a0f('0x27')](_0x1497fa[_0x2a0f('0x1e')],[_0x2a0f('0x28'),'id'])||{});}})['spread'](function(_0x3e6e4e){logger[_0x2a0f('0x13')](_0x2a0f('0x29'),_0x1497fa);logger[_0x2a0f('0x15')](_0x2a0f('0x29'),_0x1497fa,JSON[_0x2a0f('0x17')](_0x3e6e4e));_0x54fe3d(_0x3e6e4e);})[_0x2a0f('0x1b')](function(_0x1ee2b9){logger[_0x2a0f('0x18')]('AddTags',_0x1ee2b9['message'],_0x1497fa);_0x131f67(_this['error'](0x1f4,_0x1ee2b9['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 457494a..c16ccbd 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 _0xb0a0=['emit','register','openchannelInteraction:','save','remove'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xb0a0,0x1c0));var _0x0b0a=function(_0x5dcbf0,_0x101d9d){_0x5dcbf0=_0x5dcbf0-0x0;var _0xcf87aa=_0xb0a0[_0x5dcbf0];return _0xcf87aa;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x0b0a('0x0'),_0x0b0a('0x1'),'update'];function createListener(_0x3e2eb4,_0x2c9f7c){return function(_0x2e19cd){_0x2c9f7c[_0x0b0a('0x2')](_0x3e2eb4,_0x2e19cd);};}function removeListener(_0x410566,_0x235a59){return function(){OpenchannelInteractionEvents['removeListener'](_0x410566,_0x235a59);};}exports[_0x0b0a('0x3')]=function(_0x49f3ba){for(var _0x6a2201=0x0,_0x359a03=events['length'];_0x6a2201<_0x359a03;_0x6a2201++){var _0x14af53=events[_0x6a2201];var _0x31eb07=createListener(_0x0b0a('0x4')+_0x14af53,_0x49f3ba);OpenchannelInteractionEvents['on'](_0x14af53,_0x31eb07);}}; \ No newline at end of file +var _0x6c97=['emit','register','length','./openchannelInteraction.events','update'];(function(_0x1776e3,_0x14e945){var _0x102946=function(_0x3455c7){while(--_0x3455c7){_0x1776e3['push'](_0x1776e3['shift']());}};_0x102946(++_0x14e945);}(_0x6c97,0x184));var _0x76c9=function(_0x19a3c6,_0x1e7843){_0x19a3c6=_0x19a3c6-0x0;var _0x34d78a=_0x6c97[_0x19a3c6];return _0x34d78a;};'use strict';var OpenchannelInteractionEvents=require(_0x76c9('0x0'));var events=['save','remove',_0x76c9('0x1')];function createListener(_0x36888f,_0x2e9c1a){return function(_0x13b336){_0x2e9c1a[_0x76c9('0x2')](_0x36888f,_0x13b336);};}function removeListener(_0x489b0f,_0x102fc1){return function(){OpenchannelInteractionEvents['removeListener'](_0x489b0f,_0x102fc1);};}exports[_0x76c9('0x3')]=function(_0x298736){for(var _0x2db369=0x0,_0x49241d=events[_0x76c9('0x4')];_0x2db369<_0x49241d;_0x2db369++){var _0x3f7d09=events[_0x2db369];var _0x5092a0=createListener('openchannelInteraction:'+_0x3f7d09,_0x298736);OpenchannelInteractionEvents['on'](_0x3f7d09,_0x5092a0);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 190da7e..4d9b4ea 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports'];(function(_0x2f559c,_0x50d317){var _0x418cde=function(_0x5e7eed){while(--_0x5e7eed){_0x2f559c['push'](_0x2f559c['shift']());}};_0x418cde(++_0x50d317);}(_0xedd9,0xfc));var _0x9edd=function(_0x483d15,_0x195c60){_0x483d15=_0x483d15-0x0;var _0xf80886=_0xedd9[_0x483d15];return _0xf80886;};'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'](),interaction[_0x9edd('0x10')](_0x9edd('0x11'),'openchannelmessage:create'),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')](_0x9edd('0x15'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x16')]);router[_0x9edd('0x13')](_0x9edd('0x17'),auth['isAuthenticated'](),controller[_0x9edd('0x18')]);router[_0x9edd('0x19')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x1a')]);module[_0x9edd('0x1b')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0x3752f8,_0xe21391){var _0x33dbb0=function(_0x1914ee){while(--_0x1914ee){_0x3752f8['push'](_0x3752f8['shift']());}};_0x33dbb0(++_0xe21391);}(_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('./openchannelMessage.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')](),interaction[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x0d8b('0x10')),controller['create']);router[_0x0d8b('0x11')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x11')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);router[_0x0d8b('0x17')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 067feae..48c603d 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 _0x9354=['out','DATE','STRING','exports','TEXT','BOOLEAN','ENUM'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x9354,0x96));var _0x4935=function(_0x2e6c19,_0x131233){_0x2e6c19=_0x2e6c19-0x0;var _0x52885d=_0x9354[_0x2e6c19];return _0x52885d;};'use strict';var Sequelize=require('sequelize');module[_0x4935('0x0')]={'body':{'type':Sequelize[_0x4935('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x4935('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x4935('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4935('0x3')]('in',_0x4935('0x4')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x4935('0x5')]},'providerName':{'type':Sequelize[_0x4935('0x6')]},'providerResponse':{'type':Sequelize[_0x4935('0x1')]}}; \ No newline at end of file +var _0x6b20=['STRING','TEXT','sequelize','exports','medium','BOOLEAN','ENUM','out','DATE'];(function(_0x516536,_0x27f68b){var _0x457651=function(_0x360361){while(--_0x360361){_0x516536['push'](_0x516536['shift']());}};_0x457651(++_0x27f68b);}(_0x6b20,0xd1));var _0x06b2=function(_0x42a80c,_0x121ad4){_0x42a80c=_0x42a80c-0x0;var _0x1a05cb=_0x6b20[_0x42a80c];return _0x1a05cb;};'use strict';var Sequelize=require(_0x06b2('0x0'));module[_0x06b2('0x1')]={'body':{'type':Sequelize['TEXT'](_0x06b2('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x06b2('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x06b2('0x4')]('in',_0x06b2('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x06b2('0x6')]},'providerName':{'type':Sequelize[_0x06b2('0x7')]},'providerResponse':{'type':Sequelize[_0x06b2('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index b2541b9..4c6ba28 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 _0xf032=['params','find','create','body','describe','openchannel-interactions','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteractionId','isNil','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','contact','User','fullname','email','internal','manual','channel','motionChannel','event','EventManager','acceptmessage','openchannel','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','QueryTypes','interface','SIP/%s','rejectmessage','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelMessage.socket','jayson/promise','client','http','info','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','OpenchannelMessage,\x20%s,\x20%s','message','result','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','end','name','send','index','map','OpenchannelMessage','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show'];(function(_0x78732b,_0x12e7b6){var _0x166267=function(_0x1cd8d9){while(--_0x1cd8d9){_0x78732b['push'](_0x78732b['shift']());}};_0x166267(++_0x12e7b6);}(_0xf032,0x131));var _0x2f03=function(_0x10322c,_0x3dedd9){_0x10322c=_0x10322c-0x0;var _0x1bded2=_0xf032[_0x10322c];return _0x1bded2;};'use strict';var emlformat=require(_0x2f03('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2f03('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2f03('0x2'));var moment=require(_0x2f03('0x3'));var BPromise=require(_0x2f03('0x4'));var Mustache=require(_0x2f03('0x5'));var util=require(_0x2f03('0x6'));var path=require(_0x2f03('0x7'));var sox=require(_0x2f03('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2f03('0x9'));var _=require(_0x2f03('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2f03('0xb'));var deskjs=require(_0x2f03('0xc'));var toCsv=require(_0x2f03('0xd'));var querystring=require(_0x2f03('0xe'));var Papa=require(_0x2f03('0xf'));var Redis=require(_0x2f03('0x10'));var authService=require(_0x2f03('0x11'));var qs=require(_0x2f03('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2f03('0x13'))(_0x2f03('0x14'));var utils=require(_0x2f03('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2f03('0x16'))['db'];config[_0x2f03('0x17')]=_['defaults'](config[_0x2f03('0x17')],{'host':_0x2f03('0x18'),'port':0x18eb});var socket=require(_0x2f03('0x19'))(new Redis(config[_0x2f03('0x17')]));require(_0x2f03('0x1a'))['register'](socket);var jayson=require(_0x2f03('0x1b'));var client=jayson[_0x2f03('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0x2f03('0x1c')][_0x2f03('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x33f998,_0x52472d,_0x13c257,_0x58f9f5){return new BPromise(function(_0x30e136,_0x1aa89b){var _0x10a22f=_0x58f9f5||client;return _0x10a22f['request'](_0x33f998,_0x13c257)['then'](function(_0x4c503f){logger[_0x2f03('0x1e')]('OpenchannelMessage,\x20%s,\x20%s',_0x52472d,'request\x20sent');logger[_0x2f03('0x1f')](_0x2f03('0x20'),_0x52472d,_0x2f03('0x21'),JSON[_0x2f03('0x22')](_0x4c503f));if(_0x4c503f[_0x2f03('0x23')]){if(_0x4c503f[_0x2f03('0x23')]['code']===0x1f4){logger[_0x2f03('0x23')](_0x2f03('0x24'),_0x52472d,_0x4c503f[_0x2f03('0x23')]['message']);return _0x1aa89b(_0x4c503f['error'][_0x2f03('0x25')]);}logger[_0x2f03('0x23')](_0x2f03('0x24'),_0x52472d,_0x4c503f[_0x2f03('0x23')][_0x2f03('0x25')]);return _0x30e136(_0x4c503f[_0x2f03('0x23')]['message']);}else{logger[_0x2f03('0x1e')](_0x2f03('0x24'),_0x52472d,'request\x20sent');_0x30e136(_0x4c503f[_0x2f03('0x26')]['message']);}})['catch'](function(_0x357d23){logger[_0x2f03('0x23')](_0x2f03('0x24'),_0x52472d,_0x357d23);_0x1aa89b(_0x357d23);});});}function respondWithStatusCode(_0x853039,_0x5a73e8){_0x5a73e8=_0x5a73e8||0xcc;return function(_0x543786){if(_0x543786){return _0x853039[_0x2f03('0x27')](_0x5a73e8);}return _0x853039['status'](_0x5a73e8)['end']();};}function respondWithResult(_0x3cc5f3,_0x1b3aad){_0x1b3aad=_0x1b3aad||0xc8;return function(_0xe290ac){if(_0xe290ac){return _0x3cc5f3[_0x2f03('0x28')](_0x1b3aad)[_0x2f03('0x29')](_0xe290ac);}};}function respondWithFilteredResult(_0x4fbf4f,_0x24c427){return function(_0x42be80){if(_0x42be80){var _0xbb9458=typeof _0x24c427[_0x2f03('0x2a')]==='undefined'&&typeof _0x24c427[_0x2f03('0x2b')]===_0x2f03('0x2c');var _0x40f402=_0x42be80[_0x2f03('0x2d')];var _0x32fce7=_0xbb9458?0x0:_0x24c427[_0x2f03('0x2a')];var _0x5c84e6=_0xbb9458?_0x42be80[_0x2f03('0x2d')]:_0x24c427[_0x2f03('0x2a')]+_0x24c427['limit'];var _0x462109;if(_0x5c84e6>=_0x40f402){_0x5c84e6=_0x40f402;_0x462109=0xc8;}else{_0x462109=0xce;}_0x4fbf4f[_0x2f03('0x28')](_0x462109);return _0x4fbf4f['set'](_0x2f03('0x2e'),_0x32fce7+'-'+_0x5c84e6+'/'+_0x40f402)[_0x2f03('0x29')](_0x42be80);}return null;};}function patchUpdates(_0x5e9483){return function(_0x33d49a){try{jsonpatch[_0x2f03('0x2f')](_0x33d49a,_0x5e9483,!![]);}catch(_0x71ba54){return BPromise[_0x2f03('0x30')](_0x71ba54);}return _0x33d49a[_0x2f03('0x31')]();};}function saveUpdates(_0x248464,_0x3e2256){return function(_0x2b13fa){if(_0x2b13fa){return _0x2b13fa[_0x2f03('0x32')](_0x248464)[_0x2f03('0x33')](function(_0x4dbcc5){return _0x4dbcc5;});}return null;};}function removeEntity(_0xde8e60,_0x2df57a){return function(_0x2d73df){if(_0x2d73df){return _0x2d73df[_0x2f03('0x34')]()[_0x2f03('0x33')](function(){_0xde8e60[_0x2f03('0x28')](0xcc)[_0x2f03('0x35')]();});}};}function handleEntityNotFound(_0x4e6cce,_0x2a6b1e){return function(_0x3197cb){if(!_0x3197cb){_0x4e6cce[_0x2f03('0x27')](0x194);}return _0x3197cb;};}function handleError(_0xfc274e,_0x258bb0){_0x258bb0=_0x258bb0||0x1f4;return function(_0x3705c4){logger['error'](_0x3705c4['stack']);if(_0x3705c4[_0x2f03('0x36')]){delete _0x3705c4[_0x2f03('0x36')];}_0xfc274e[_0x2f03('0x28')](_0x258bb0)[_0x2f03('0x37')](_0x3705c4);};}exports[_0x2f03('0x38')]=function(_0x105add,_0x49e7f0){var _0x1f9239={},_0x3b5155={},_0x3f9678={'count':0x0,'rows':[]};var _0x113338=_[_0x2f03('0x39')](db[_0x2f03('0x3a')][_0x2f03('0x3b')],function(_0x5c0424){return{'name':_0x5c0424['fieldName'],'type':_0x5c0424['type'][_0x2f03('0x3c')]};});_0x3b5155['model']=_[_0x2f03('0x39')](_0x113338,_0x2f03('0x36'));_0x3b5155[_0x2f03('0x3d')]=_[_0x2f03('0x3e')](_0x105add[_0x2f03('0x3d')]);_0x3b5155[_0x2f03('0x3f')]=_[_0x2f03('0x40')](_0x3b5155[_0x2f03('0x41')],_0x3b5155[_0x2f03('0x3d')]);_0x1f9239[_0x2f03('0x42')]=_[_0x2f03('0x40')](_0x3b5155[_0x2f03('0x41')],qs[_0x2f03('0x43')](_0x105add[_0x2f03('0x3d')][_0x2f03('0x43')]));_0x1f9239[_0x2f03('0x42')]=_0x1f9239['attributes'][_0x2f03('0x44')]?_0x1f9239[_0x2f03('0x42')]:_0x3b5155[_0x2f03('0x41')];if(!_0x105add[_0x2f03('0x3d')][_0x2f03('0x45')](_0x2f03('0x46'))){_0x1f9239[_0x2f03('0x2b')]=qs[_0x2f03('0x2b')](_0x105add[_0x2f03('0x3d')][_0x2f03('0x2b')]);_0x1f9239['offset']=qs[_0x2f03('0x2a')](_0x105add[_0x2f03('0x3d')][_0x2f03('0x2a')]);}_0x1f9239[_0x2f03('0x47')]=qs[_0x2f03('0x48')](_0x105add[_0x2f03('0x3d')][_0x2f03('0x48')]);_0x1f9239[_0x2f03('0x49')]=qs[_0x2f03('0x3f')](_[_0x2f03('0x4a')](_0x105add[_0x2f03('0x3d')],_0x3b5155[_0x2f03('0x3f')]),_0x113338);if(_0x105add[_0x2f03('0x3d')][_0x2f03('0x4b')]){_0x1f9239[_0x2f03('0x49')]=_[_0x2f03('0x4c')](_0x1f9239[_0x2f03('0x49')],{'$or':_[_0x2f03('0x39')](_0x113338,function(_0x495654){if(_0x495654[_0x2f03('0x4d')]!==_0x2f03('0x4e')){var _0xdd95bc={};_0xdd95bc[_0x495654['name']]={'$like':'%'+_0x105add[_0x2f03('0x3d')][_0x2f03('0x4b')]+'%'};return _0xdd95bc;}})});}_0x1f9239=_[_0x2f03('0x4c')]({},_0x1f9239,_0x105add['options']);var _0xf84546={'where':_0x1f9239[_0x2f03('0x49')]};return db[_0x2f03('0x3a')][_0x2f03('0x2d')](_0xf84546)[_0x2f03('0x33')](function(_0x282d52){_0x3f9678[_0x2f03('0x2d')]=_0x282d52;if(_0x105add[_0x2f03('0x3d')][_0x2f03('0x4f')]){_0x1f9239[_0x2f03('0x50')]=[{'all':!![]}];}return db[_0x2f03('0x3a')][_0x2f03('0x51')](_0x1f9239);})[_0x2f03('0x33')](function(_0x1d23bb){_0x3f9678[_0x2f03('0x52')]=_0x1d23bb;return _0x3f9678;})[_0x2f03('0x33')](respondWithFilteredResult(_0x49e7f0,_0x1f9239))[_0x2f03('0x53')](handleError(_0x49e7f0,null));};exports[_0x2f03('0x54')]=function(_0x12a91b,_0x536b85){var _0x135636={'raw':!![],'where':{'id':_0x12a91b[_0x2f03('0x55')]['id']}},_0x376ee0={};_0x376ee0[_0x2f03('0x41')]=_[_0x2f03('0x3e')](db['OpenchannelMessage'][_0x2f03('0x3b')]);_0x376ee0[_0x2f03('0x3d')]=_[_0x2f03('0x3e')](_0x12a91b[_0x2f03('0x3d')]);_0x376ee0[_0x2f03('0x3f')]=_['intersection'](_0x376ee0[_0x2f03('0x41')],_0x376ee0[_0x2f03('0x3d')]);_0x135636['attributes']=_[_0x2f03('0x40')](_0x376ee0[_0x2f03('0x41')],qs[_0x2f03('0x43')](_0x12a91b[_0x2f03('0x3d')][_0x2f03('0x43')]));_0x135636[_0x2f03('0x42')]=_0x135636[_0x2f03('0x42')][_0x2f03('0x44')]?_0x135636['attributes']:_0x376ee0[_0x2f03('0x41')];if(_0x12a91b[_0x2f03('0x3d')][_0x2f03('0x4f')]){_0x135636[_0x2f03('0x50')]=[{'all':!![]}];}_0x135636=_[_0x2f03('0x4c')]({},_0x135636,_0x12a91b['options']);return db[_0x2f03('0x3a')][_0x2f03('0x56')](_0x135636)[_0x2f03('0x33')](handleEntityNotFound(_0x536b85,null))[_0x2f03('0x33')](respondWithResult(_0x536b85,null))[_0x2f03('0x53')](handleError(_0x536b85,null));};exports[_0x2f03('0x57')]=function(_0x8fd90,_0x306d86){return db[_0x2f03('0x3a')][_0x2f03('0x57')](_0x8fd90[_0x2f03('0x58')],{})[_0x2f03('0x33')](respondWithResult(_0x306d86,0xc9))[_0x2f03('0x53')](handleError(_0x306d86,null));};exports[_0x2f03('0x32')]=function(_0x164660,_0xbf1d5c){if(_0x164660['body']['id']){delete _0x164660[_0x2f03('0x58')]['id'];}return db['OpenchannelMessage'][_0x2f03('0x56')]({'where':{'id':_0x164660['params']['id']}})[_0x2f03('0x33')](handleEntityNotFound(_0xbf1d5c,null))[_0x2f03('0x33')](saveUpdates(_0x164660[_0x2f03('0x58')],null))[_0x2f03('0x33')](respondWithResult(_0xbf1d5c,null))[_0x2f03('0x53')](handleError(_0xbf1d5c,null));};exports['destroy']=function(_0x280e00,_0x212406){return db[_0x2f03('0x3a')][_0x2f03('0x56')]({'where':{'id':_0x280e00['params']['id']}})[_0x2f03('0x33')](handleEntityNotFound(_0x212406,null))[_0x2f03('0x33')](removeEntity(_0x212406,null))['catch'](handleError(_0x212406,null));};exports[_0x2f03('0x59')]=function(_0x2fd932,_0xb0f5c0){return db[_0x2f03('0x3a')][_0x2f03('0x59')]()[_0x2f03('0x33')](respondWithResult(_0xb0f5c0,null))[_0x2f03('0x53')](handleError(_0xb0f5c0,null));};var interaction_log=require(_0x2f03('0x13'))(_0x2f03('0x5a'));exports[_0x2f03('0x5b')]=function(_0x4af710,_0x228f5f,_0x244e1b){var _0x19a03f={'agent':{},'channel':'openchannel'};if(_0x4af710[_0x2f03('0x58')]['id']){delete _0x4af710[_0x2f03('0x58')]['id'];}_0x4af710[_0x2f03('0x58')]['read']=!![];_0x4af710[_0x2f03('0x58')][_0x2f03('0x5c')]=moment()[_0x2f03('0x5d')](_0x2f03('0x5e'));_0x4af710[_0x2f03('0x58')][_0x2f03('0x5f')]=_0x4af710[_0x2f03('0x58')][_0x2f03('0x5f')]||_0x4af710[_0x2f03('0x60')]['id'];_0x19a03f[_0x2f03('0x61')]['id']=_0x4af710['body'][_0x2f03('0x5f')];return db[_0x2f03('0x3a')][_0x2f03('0x56')]({'where':{'id':_0x4af710['params']['id'],'UserId':null}})[_0x2f03('0x33')](handleEntityNotFound(_0x228f5f,null))[_0x2f03('0x33')](saveUpdates(_0x4af710[_0x2f03('0x58')],null))[_0x2f03('0x33')](function(_0x312648){if(_0x312648){_0x19a03f[_0x2f03('0x25')]=_0x312648[_0x2f03('0x62')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x312648[_0x2f03('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x228f5f,null))[_0x2f03('0x33')](function(_0x336e0f){if(_0x336e0f){return _0x336e0f[_0x2f03('0x32')]({'UserId':_0x4af710[_0x2f03('0x58')][_0x2f03('0x5f')],'read1stAt':_[_0x2f03('0x64')](_0x336e0f['read1stAt'])?moment()[_0x2f03('0x5d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x2f03('0x33')](function(_0x4b8281){if(_0x4b8281){_0x19a03f[_0x2f03('0x65')]=_0x4b8281[_0x2f03('0x62')]({'plain':!![]});interaction_log[_0x2f03('0x1e')](_0x2f03('0x66'),_0x4af710['user']['id'],_0x4af710[_0x2f03('0x60')][_0x2f03('0x36')],_0x4af710[_0x2f03('0x60')]['role'],_0x19a03f[_0x2f03('0x65')]['id'],_0x4af710['body']?JSON[_0x2f03('0x22')](_0x4af710[_0x2f03('0x58')]):_0x2f03('0x67'));return respondWithRpcPromise(_0x2f03('0x68'),_0x2f03('0x69'),_0x19a03f);}return null;})[_0x2f03('0x33')](function(_0x3098b2){var _0x43e84a=_0x2f03('0x6a')+_0x3098b2[_0x2f03('0x25')]['ContactId'];return db[_0x2f03('0x6b')]['query'](_0x43e84a,{'type':db[_0x2f03('0x6c')]['QueryTypes'][_0x2f03('0x6d')],'raw':!![]})[_0x2f03('0x33')](function(_0x11b71c){return _0x11b71c;});})[_0x2f03('0x33')](function(_0x1134fe){if(_0x1134fe){_0x19a03f[_0x2f03('0x25')][_0x2f03('0x6e')]=_0x1134fe[0x0];if(!_0x4af710[_0x2f03('0x58')]['UserId'])return;return db[_0x2f03('0x6f')]['find']({'where':{'id':_0x4af710[_0x2f03('0x58')][_0x2f03('0x5f')],'role':'agent'},'attributes':['id',_0x2f03('0x36'),_0x2f03('0x70'),_0x2f03('0x71'),_0x2f03('0x72')],'raw':!![]});}return null;})[_0x2f03('0x33')](function(_0x347d08){if(!_0x347d08)return null;_0x19a03f[_0x2f03('0x25')][_0x2f03('0x61')]=_0x347d08;return _0x19a03f;})[_0x2f03('0x33')](function(_0x3aad9b){if(_0x3aad9b){if(_0x4af710['body'][_0x2f03('0x73')]){_0x19a03f[_0x2f03('0x25')]['interface']=util[_0x2f03('0x5d')]('SIP/%s',_0x4af710[_0x2f03('0x60')][_0x2f03('0x36')]);_0x19a03f[_0x2f03('0x25')]['channel']=_0x19a03f[_0x2f03('0x74')];_0x19a03f[_0x2f03('0x25')][_0x2f03('0x75')]=_0x19a03f[_0x2f03('0x74')];_0x19a03f[_0x2f03('0x25')][_0x2f03('0x76')]='accept';return respondWithRpcPromise(_0x2f03('0x77'),_0x2f03('0x77'),{'event':_0x2f03('0x78'),'message':_0x19a03f[_0x2f03('0x25')]},client9002)['then'](function(){return _0x19a03f;});}return _0x19a03f;}return null;})[_0x2f03('0x33')](respondWithResult(_0x228f5f,null))[_0x2f03('0x53')](handleError(_0x228f5f,null));};var interaction_log=require(_0x2f03('0x13'))('openchannel-interactions');exports['reject']=function(_0x54f412,_0x51c9f0,_0x5006f){var _0x5b0a9c={'agent':{},'channel':_0x2f03('0x79')};if(_0x54f412[_0x2f03('0x58')]['id']){delete _0x54f412[_0x2f03('0x58')]['id'];}_0x54f412['body']['UserId']=_0x54f412['body'][_0x2f03('0x5f')]||_0x54f412['user']['id'];_0x5b0a9c[_0x2f03('0x61')]['id']=_0x54f412[_0x2f03('0x58')][_0x2f03('0x5f')];return db['OpenchannelMessage'][_0x2f03('0x56')]({'where':{'id':_0x54f412[_0x2f03('0x55')]['id'],'UserId':null}})[_0x2f03('0x33')](handleEntityNotFound(_0x51c9f0,null))[_0x2f03('0x33')](function(_0x24cf82){if(_0x24cf82){_0x5b0a9c[_0x2f03('0x25')]=_0x24cf82['get']({'plain':!![]});return db['OpenchannelInteraction'][_0x2f03('0x56')]({'where':{'id':_0x24cf82[_0x2f03('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x51c9f0,null))[_0x2f03('0x33')](function(_0x1ea257){if(_0x1ea257){_0x5b0a9c[_0x2f03('0x65')]=_0x1ea257['get']({'plain':!![]});interaction_log[_0x2f03('0x1e')](_0x2f03('0x7a'),_0x54f412[_0x2f03('0x60')]['id'],_0x54f412[_0x2f03('0x60')][_0x2f03('0x36')],_0x54f412['user']['role'],_0x5b0a9c[_0x2f03('0x65')]['id'],_0x54f412[_0x2f03('0x58')]?JSON[_0x2f03('0x22')](_0x54f412[_0x2f03('0x58')]):'null');return respondWithRpcPromise(_0x2f03('0x7b'),_0x2f03('0x7c'),_0x5b0a9c);}return null;})[_0x2f03('0x33')](function(_0x4a232c){var _0x382a1d=_0x2f03('0x6a')+_0x4a232c['message'][_0x2f03('0x7d')];return db[_0x2f03('0x6b')][_0x2f03('0x3d')](_0x382a1d,{'type':db['Sequelize'][_0x2f03('0x7e')][_0x2f03('0x6d')],'raw':!![]})[_0x2f03('0x33')](function(_0xcad618){return _0xcad618;});})[_0x2f03('0x33')](function(_0x102556){if(_0x102556){_0x5b0a9c[_0x2f03('0x25')][_0x2f03('0x6e')]=_0x102556[0x0];if(!_0x54f412[_0x2f03('0x58')][_0x2f03('0x5f')])return;return db['User'][_0x2f03('0x56')]({'where':{'id':_0x54f412[_0x2f03('0x58')][_0x2f03('0x5f')],'role':'agent'},'attributes':['id',_0x2f03('0x36'),'fullname',_0x2f03('0x71'),_0x2f03('0x72')],'raw':!![]});}return null;})[_0x2f03('0x33')](function(_0xccfa93){if(!_0xccfa93)return null;_0x5b0a9c['message'][_0x2f03('0x61')]=_0xccfa93;return _0x5b0a9c;})[_0x2f03('0x33')](function(_0x1ad05b){if(_0x1ad05b){_0x1ad05b[_0x2f03('0x25')][_0x2f03('0x7f')]=util[_0x2f03('0x5d')](_0x2f03('0x80'),_0x54f412[_0x2f03('0x60')][_0x2f03('0x36')]);_0x1ad05b['message'][_0x2f03('0x74')]=_0x5b0a9c[_0x2f03('0x74')];_0x1ad05b[_0x2f03('0x25')][_0x2f03('0x75')]=_0x5b0a9c[_0x2f03('0x74')];_0x1ad05b[_0x2f03('0x25')][_0x2f03('0x76')]='reject';respondWithRpcPromise(_0x2f03('0x77'),_0x2f03('0x77'),{'event':_0x2f03('0x81'),'message':_0x1ad05b[_0x2f03('0x25')]},client9002);return _0x5b0a9c;}return null;})[_0x2f03('0x33')](respondWithResult(_0x51c9f0,null))[_0x2f03('0x53')](handleError(_0x51c9f0,null));}; \ No newline at end of file +var _0x3c2a=['catch','create','body','describe','openchannel-interactions','accept','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','format','interaction','info','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','contact','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','openchannel','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SELECT','User','rejectmessage','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','client','http','request','then','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','sendStatus','status','json','offset','undefined','limit','count','apply','reject','save','update','destroy','end','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','OpenchannelMessage','includeAll','include','rows','show','params','keys','find'];(function(_0x172133,_0x10246b){var _0x2460e5=function(_0x3c4918){while(--_0x3c4918){_0x172133['push'](_0x172133['shift']());}};_0x2460e5(++_0x10246b);}(_0x3c2a,0x1b2));var _0xa3c2=function(_0x58b1cc,_0x37dcf0){_0x58b1cc=_0x58b1cc-0x0;var _0x534bfc=_0x3c2a[_0x58b1cc];return _0x534bfc;};'use strict';var emlformat=require(_0xa3c2('0x0'));var rimraf=require(_0xa3c2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa3c2('0x2'));var rp=require('request-promise');var moment=require(_0xa3c2('0x3'));var BPromise=require(_0xa3c2('0x4'));var Mustache=require(_0xa3c2('0x5'));var util=require(_0xa3c2('0x6'));var path=require(_0xa3c2('0x7'));var sox=require(_0xa3c2('0x8'));var csv=require(_0xa3c2('0x9'));var ejs=require(_0xa3c2('0xa'));var fs=require('fs');var fs_extra=require(_0xa3c2('0xb'));var _=require(_0xa3c2('0xc'));var squel=require(_0xa3c2('0xd'));var crypto=require(_0xa3c2('0xe'));var jsforce=require(_0xa3c2('0xf'));var deskjs=require(_0xa3c2('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa3c2('0x11'));var Redis=require(_0xa3c2('0x12'));var authService=require(_0xa3c2('0x13'));var qs=require(_0xa3c2('0x14'));var as=require(_0xa3c2('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa3c2('0x16'))('api');var utils=require(_0xa3c2('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa3c2('0x18'))['db'];config[_0xa3c2('0x19')]=_['defaults'](config[_0xa3c2('0x19')],{'host':_0xa3c2('0x1a'),'port':0x18eb});var socket=require(_0xa3c2('0x1b'))(new Redis(config[_0xa3c2('0x19')]));require(_0xa3c2('0x1c'))[_0xa3c2('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0xa3c2('0x1e')][_0xa3c2('0x1f')]({'port':0x232c});var client9002=jayson[_0xa3c2('0x1e')][_0xa3c2('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x20c068,_0x329f71,_0xd71f4d,_0x137535){return new BPromise(function(_0x1d544f,_0x3a666d){var _0x47a8e4=_0x137535||client;return _0x47a8e4[_0xa3c2('0x20')](_0x20c068,_0xd71f4d)[_0xa3c2('0x21')](function(_0x5cb030){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x329f71,_0xa3c2('0x22'));logger['debug'](_0xa3c2('0x23'),_0x329f71,_0xa3c2('0x22'),JSON[_0xa3c2('0x24')](_0x5cb030));if(_0x5cb030[_0xa3c2('0x25')]){if(_0x5cb030[_0xa3c2('0x25')][_0xa3c2('0x26')]===0x1f4){logger[_0xa3c2('0x25')](_0xa3c2('0x27'),_0x329f71,_0x5cb030['error'][_0xa3c2('0x28')]);return _0x3a666d(_0x5cb030[_0xa3c2('0x25')][_0xa3c2('0x28')]);}logger[_0xa3c2('0x25')](_0xa3c2('0x27'),_0x329f71,_0x5cb030[_0xa3c2('0x25')][_0xa3c2('0x28')]);return _0x1d544f(_0x5cb030[_0xa3c2('0x25')][_0xa3c2('0x28')]);}else{logger['info'](_0xa3c2('0x27'),_0x329f71,_0xa3c2('0x22'));_0x1d544f(_0x5cb030[_0xa3c2('0x29')]['message']);}})['catch'](function(_0x1f6887){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x329f71,_0x1f6887);_0x3a666d(_0x1f6887);});});}function respondWithStatusCode(_0x5c3853,_0x2ee578){_0x2ee578=_0x2ee578||0xcc;return function(_0x1e7aa8){if(_0x1e7aa8){return _0x5c3853[_0xa3c2('0x2a')](_0x2ee578);}return _0x5c3853['status'](_0x2ee578)['end']();};}function respondWithResult(_0x406057,_0x4c6c7c){_0x4c6c7c=_0x4c6c7c||0xc8;return function(_0x501bff){if(_0x501bff){return _0x406057[_0xa3c2('0x2b')](_0x4c6c7c)[_0xa3c2('0x2c')](_0x501bff);}};}function respondWithFilteredResult(_0x395f74,_0x240bc6){return function(_0x1733b1){if(_0x1733b1){var _0x1e9e6f=typeof _0x240bc6[_0xa3c2('0x2d')]===_0xa3c2('0x2e')&&typeof _0x240bc6[_0xa3c2('0x2f')]===_0xa3c2('0x2e');var _0x2ab5ca=_0x1733b1[_0xa3c2('0x30')];var _0x23d864=_0x1e9e6f?0x0:_0x240bc6[_0xa3c2('0x2d')];var _0x568220=_0x1e9e6f?_0x1733b1[_0xa3c2('0x30')]:_0x240bc6['offset']+_0x240bc6[_0xa3c2('0x2f')];var _0x7774f9;if(_0x568220>=_0x2ab5ca){_0x568220=_0x2ab5ca;_0x7774f9=0xc8;}else{_0x7774f9=0xce;}_0x395f74[_0xa3c2('0x2b')](_0x7774f9);return _0x395f74['set']('Content-Range',_0x23d864+'-'+_0x568220+'/'+_0x2ab5ca)[_0xa3c2('0x2c')](_0x1733b1);}return null;};}function patchUpdates(_0x543df4){return function(_0x3eadc1){try{jsonpatch[_0xa3c2('0x31')](_0x3eadc1,_0x543df4,!![]);}catch(_0x2eb259){return BPromise[_0xa3c2('0x32')](_0x2eb259);}return _0x3eadc1[_0xa3c2('0x33')]();};}function saveUpdates(_0x504e03,_0x1928fd){return function(_0x1d8ad3){if(_0x1d8ad3){return _0x1d8ad3[_0xa3c2('0x34')](_0x504e03)[_0xa3c2('0x21')](function(_0x203a07){return _0x203a07;});}return null;};}function removeEntity(_0x325cb2,_0x3b4c5a){return function(_0x386233){if(_0x386233){return _0x386233[_0xa3c2('0x35')]()['then'](function(){_0x325cb2[_0xa3c2('0x2b')](0xcc)[_0xa3c2('0x36')]();});}};}function handleEntityNotFound(_0x2e1dc6,_0x5736b3){return function(_0x4c0de){if(!_0x4c0de){_0x2e1dc6[_0xa3c2('0x2a')](0x194);}return _0x4c0de;};}function handleError(_0x337f1e,_0x46a4c3){_0x46a4c3=_0x46a4c3||0x1f4;return function(_0x24dd61){logger['error'](_0x24dd61['stack']);if(_0x24dd61['name']){delete _0x24dd61[_0xa3c2('0x37')];}_0x337f1e[_0xa3c2('0x2b')](_0x46a4c3)[_0xa3c2('0x38')](_0x24dd61);};}exports[_0xa3c2('0x39')]=function(_0x30bb48,_0x4a177b){var _0x3b72a9={},_0x5e0ec4={},_0x486c01={'count':0x0,'rows':[]};var _0x2321f4=_[_0xa3c2('0x3a')](db['OpenchannelMessage'][_0xa3c2('0x3b')],function(_0x42c134){return{'name':_0x42c134[_0xa3c2('0x3c')],'type':_0x42c134[_0xa3c2('0x3d')][_0xa3c2('0x3e')]};});_0x5e0ec4[_0xa3c2('0x3f')]=_['map'](_0x2321f4,_0xa3c2('0x37'));_0x5e0ec4[_0xa3c2('0x40')]=_['keys'](_0x30bb48['query']);_0x5e0ec4[_0xa3c2('0x41')]=_[_0xa3c2('0x42')](_0x5e0ec4[_0xa3c2('0x3f')],_0x5e0ec4['query']);_0x3b72a9[_0xa3c2('0x43')]=_[_0xa3c2('0x42')](_0x5e0ec4[_0xa3c2('0x3f')],qs[_0xa3c2('0x44')](_0x30bb48[_0xa3c2('0x40')]['fields']));_0x3b72a9[_0xa3c2('0x43')]=_0x3b72a9[_0xa3c2('0x43')][_0xa3c2('0x45')]?_0x3b72a9[_0xa3c2('0x43')]:_0x5e0ec4['model'];if(!_0x30bb48[_0xa3c2('0x40')][_0xa3c2('0x46')]('nolimit')){_0x3b72a9[_0xa3c2('0x2f')]=qs[_0xa3c2('0x2f')](_0x30bb48[_0xa3c2('0x40')][_0xa3c2('0x2f')]);_0x3b72a9[_0xa3c2('0x2d')]=qs[_0xa3c2('0x2d')](_0x30bb48[_0xa3c2('0x40')][_0xa3c2('0x2d')]);}_0x3b72a9[_0xa3c2('0x47')]=qs[_0xa3c2('0x48')](_0x30bb48[_0xa3c2('0x40')][_0xa3c2('0x48')]);_0x3b72a9[_0xa3c2('0x49')]=qs[_0xa3c2('0x41')](_[_0xa3c2('0x4a')](_0x30bb48['query'],_0x5e0ec4[_0xa3c2('0x41')]),_0x2321f4);if(_0x30bb48[_0xa3c2('0x40')][_0xa3c2('0x4b')]){_0x3b72a9[_0xa3c2('0x49')]=_[_0xa3c2('0x4c')](_0x3b72a9[_0xa3c2('0x49')],{'$or':_['map'](_0x2321f4,function(_0x59ffbc){if(_0x59ffbc[_0xa3c2('0x3d')]!=='VIRTUAL'){var _0xbcfb9a={};_0xbcfb9a[_0x59ffbc[_0xa3c2('0x37')]]={'$like':'%'+_0x30bb48['query'][_0xa3c2('0x4b')]+'%'};return _0xbcfb9a;}})});}_0x3b72a9=_['merge']({},_0x3b72a9,_0x30bb48[_0xa3c2('0x4d')]);var _0x12b766={'where':_0x3b72a9[_0xa3c2('0x49')]};return db[_0xa3c2('0x4e')][_0xa3c2('0x30')](_0x12b766)[_0xa3c2('0x21')](function(_0x63fa2d){_0x486c01[_0xa3c2('0x30')]=_0x63fa2d;if(_0x30bb48[_0xa3c2('0x40')][_0xa3c2('0x4f')]){_0x3b72a9[_0xa3c2('0x50')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x3b72a9);})[_0xa3c2('0x21')](function(_0x41c892){_0x486c01[_0xa3c2('0x51')]=_0x41c892;return _0x486c01;})[_0xa3c2('0x21')](respondWithFilteredResult(_0x4a177b,_0x3b72a9))['catch'](handleError(_0x4a177b,null));};exports[_0xa3c2('0x52')]=function(_0x48b72a,_0x1f570f){var _0x18a0c3={'raw':!![],'where':{'id':_0x48b72a[_0xa3c2('0x53')]['id']}},_0x54a0e3={};_0x54a0e3[_0xa3c2('0x3f')]=_['keys'](db[_0xa3c2('0x4e')]['rawAttributes']);_0x54a0e3[_0xa3c2('0x40')]=_[_0xa3c2('0x54')](_0x48b72a[_0xa3c2('0x40')]);_0x54a0e3['filters']=_['intersection'](_0x54a0e3[_0xa3c2('0x3f')],_0x54a0e3[_0xa3c2('0x40')]);_0x18a0c3[_0xa3c2('0x43')]=_[_0xa3c2('0x42')](_0x54a0e3[_0xa3c2('0x3f')],qs['fields'](_0x48b72a[_0xa3c2('0x40')][_0xa3c2('0x44')]));_0x18a0c3['attributes']=_0x18a0c3[_0xa3c2('0x43')][_0xa3c2('0x45')]?_0x18a0c3[_0xa3c2('0x43')]:_0x54a0e3[_0xa3c2('0x3f')];if(_0x48b72a[_0xa3c2('0x40')]['includeAll']){_0x18a0c3[_0xa3c2('0x50')]=[{'all':!![]}];}_0x18a0c3=_[_0xa3c2('0x4c')]({},_0x18a0c3,_0x48b72a[_0xa3c2('0x4d')]);return db[_0xa3c2('0x4e')][_0xa3c2('0x55')](_0x18a0c3)[_0xa3c2('0x21')](handleEntityNotFound(_0x1f570f,null))[_0xa3c2('0x21')](respondWithResult(_0x1f570f,null))[_0xa3c2('0x56')](handleError(_0x1f570f,null));};exports[_0xa3c2('0x57')]=function(_0x4ec2f4,_0x37d2e1){return db[_0xa3c2('0x4e')]['create'](_0x4ec2f4[_0xa3c2('0x58')],{})[_0xa3c2('0x21')](respondWithResult(_0x37d2e1,0xc9))[_0xa3c2('0x56')](handleError(_0x37d2e1,null));};exports[_0xa3c2('0x34')]=function(_0x39cf5a,_0xebe462){if(_0x39cf5a[_0xa3c2('0x58')]['id']){delete _0x39cf5a[_0xa3c2('0x58')]['id'];}return db[_0xa3c2('0x4e')][_0xa3c2('0x55')]({'where':{'id':_0x39cf5a['params']['id']}})[_0xa3c2('0x21')](handleEntityNotFound(_0xebe462,null))[_0xa3c2('0x21')](saveUpdates(_0x39cf5a[_0xa3c2('0x58')],null))[_0xa3c2('0x21')](respondWithResult(_0xebe462,null))[_0xa3c2('0x56')](handleError(_0xebe462,null));};exports[_0xa3c2('0x35')]=function(_0x29f849,_0x41d0a3){return db[_0xa3c2('0x4e')]['find']({'where':{'id':_0x29f849[_0xa3c2('0x53')]['id']}})[_0xa3c2('0x21')](handleEntityNotFound(_0x41d0a3,null))[_0xa3c2('0x21')](removeEntity(_0x41d0a3,null))[_0xa3c2('0x56')](handleError(_0x41d0a3,null));};exports['describe']=function(_0xadfb7,_0x3c434e){return db[_0xa3c2('0x4e')][_0xa3c2('0x59')]()['then'](respondWithResult(_0x3c434e,null))['catch'](handleError(_0x3c434e,null));};var interaction_log=require(_0xa3c2('0x16'))(_0xa3c2('0x5a'));exports[_0xa3c2('0x5b')]=function(_0x295c4e,_0x1165b9,_0x3848f6){var _0x5a82bb={'agent':{},'channel':'openchannel'};if(_0x295c4e['body']['id']){delete _0x295c4e[_0xa3c2('0x58')]['id'];}_0x295c4e['body']['read']=!![];_0x295c4e[_0xa3c2('0x58')][_0xa3c2('0x5c')]=moment()['format'](_0xa3c2('0x5d'));_0x295c4e[_0xa3c2('0x58')]['UserId']=_0x295c4e['body'][_0xa3c2('0x5e')]||_0x295c4e[_0xa3c2('0x5f')]['id'];_0x5a82bb[_0xa3c2('0x60')]['id']=_0x295c4e[_0xa3c2('0x58')][_0xa3c2('0x5e')];return db[_0xa3c2('0x4e')][_0xa3c2('0x55')]({'where':{'id':_0x295c4e[_0xa3c2('0x53')]['id'],'UserId':null}})[_0xa3c2('0x21')](handleEntityNotFound(_0x1165b9,null))[_0xa3c2('0x21')](saveUpdates(_0x295c4e[_0xa3c2('0x58')],null))[_0xa3c2('0x21')](function(_0x18d47b){if(_0x18d47b){_0x5a82bb[_0xa3c2('0x28')]=_0x18d47b[_0xa3c2('0x61')]({'plain':!![]});return db[_0xa3c2('0x62')][_0xa3c2('0x55')]({'where':{'id':_0x18d47b[_0xa3c2('0x63')]}});}return null;})[_0xa3c2('0x21')](handleEntityNotFound(_0x1165b9,null))[_0xa3c2('0x21')](function(_0x243516){if(_0x243516){return _0x243516[_0xa3c2('0x34')]({'UserId':_0x295c4e[_0xa3c2('0x58')][_0xa3c2('0x5e')],'read1stAt':_[_0xa3c2('0x64')](_0x243516['read1stAt'])?moment()[_0xa3c2('0x65')](_0xa3c2('0x5d')):undefined});}return null;})['then'](function(_0x9b3281){if(_0x9b3281){_0x5a82bb[_0xa3c2('0x66')]=_0x9b3281['get']({'plain':!![]});interaction_log[_0xa3c2('0x67')](_0xa3c2('0x68'),_0x295c4e[_0xa3c2('0x5f')]['id'],_0x295c4e[_0xa3c2('0x5f')]['name'],_0x295c4e[_0xa3c2('0x5f')][_0xa3c2('0x69')],_0x5a82bb[_0xa3c2('0x66')]['id'],_0x295c4e['body']?JSON[_0xa3c2('0x24')](_0x295c4e[_0xa3c2('0x58')]):_0xa3c2('0x6a'));return respondWithRpcPromise(_0xa3c2('0x6b'),_0xa3c2('0x6c'),_0x5a82bb);}return null;})[_0xa3c2('0x21')](function(_0x4794f9){var _0x19b911=_0xa3c2('0x6d')+_0x4794f9[_0xa3c2('0x28')][_0xa3c2('0x6e')];return db[_0xa3c2('0x6f')][_0xa3c2('0x40')](_0x19b911,{'type':db[_0xa3c2('0x70')]['QueryTypes']['SELECT'],'raw':!![]})[_0xa3c2('0x21')](function(_0x2f448c){return _0x2f448c;});})[_0xa3c2('0x21')](function(_0x3233dc){if(_0x3233dc){_0x5a82bb[_0xa3c2('0x28')][_0xa3c2('0x71')]=_0x3233dc[0x0];if(!_0x295c4e[_0xa3c2('0x58')][_0xa3c2('0x5e')])return;return db['User'][_0xa3c2('0x55')]({'where':{'id':_0x295c4e['body'][_0xa3c2('0x5e')],'role':'agent'},'attributes':['id',_0xa3c2('0x37'),_0xa3c2('0x72'),'email',_0xa3c2('0x73')],'raw':!![]});}return null;})[_0xa3c2('0x21')](function(_0x484e05){if(!_0x484e05)return null;_0x5a82bb[_0xa3c2('0x28')][_0xa3c2('0x60')]=_0x484e05;return _0x5a82bb;})[_0xa3c2('0x21')](function(_0x54194e){if(_0x54194e){if(_0x295c4e[_0xa3c2('0x58')][_0xa3c2('0x74')]){_0x5a82bb['message'][_0xa3c2('0x75')]=util[_0xa3c2('0x65')](_0xa3c2('0x76'),_0x295c4e['user'][_0xa3c2('0x37')]);_0x5a82bb['message'][_0xa3c2('0x77')]=_0x5a82bb[_0xa3c2('0x77')];_0x5a82bb[_0xa3c2('0x28')][_0xa3c2('0x78')]=_0x5a82bb[_0xa3c2('0x77')];_0x5a82bb[_0xa3c2('0x28')][_0xa3c2('0x79')]=_0xa3c2('0x5b');return respondWithRpcPromise('EventManager',_0xa3c2('0x7a'),{'event':_0xa3c2('0x7b'),'message':_0x5a82bb[_0xa3c2('0x28')]},client9002)[_0xa3c2('0x21')](function(){return _0x5a82bb;});}return _0x5a82bb;}return null;})[_0xa3c2('0x21')](respondWithResult(_0x1165b9,null))['catch'](handleError(_0x1165b9,null));};var interaction_log=require(_0xa3c2('0x16'))(_0xa3c2('0x5a'));exports[_0xa3c2('0x32')]=function(_0x759de8,_0x1e437e,_0x24b021){var _0x1133bc={'agent':{},'channel':_0xa3c2('0x7c')};if(_0x759de8[_0xa3c2('0x58')]['id']){delete _0x759de8[_0xa3c2('0x58')]['id'];}_0x759de8[_0xa3c2('0x58')][_0xa3c2('0x5e')]=_0x759de8[_0xa3c2('0x58')][_0xa3c2('0x5e')]||_0x759de8['user']['id'];_0x1133bc[_0xa3c2('0x60')]['id']=_0x759de8[_0xa3c2('0x58')]['UserId'];return db[_0xa3c2('0x4e')]['find']({'where':{'id':_0x759de8[_0xa3c2('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1e437e,null))[_0xa3c2('0x21')](function(_0x311fa4){if(_0x311fa4){_0x1133bc[_0xa3c2('0x28')]=_0x311fa4[_0xa3c2('0x61')]({'plain':!![]});return db[_0xa3c2('0x62')][_0xa3c2('0x55')]({'where':{'id':_0x311fa4[_0xa3c2('0x63')]}});}return null;})[_0xa3c2('0x21')](handleEntityNotFound(_0x1e437e,null))[_0xa3c2('0x21')](function(_0x38bd61){if(_0x38bd61){_0x1133bc[_0xa3c2('0x66')]=_0x38bd61[_0xa3c2('0x61')]({'plain':!![]});interaction_log['info'](_0xa3c2('0x7d'),_0x759de8['user']['id'],_0x759de8['user'][_0xa3c2('0x37')],_0x759de8[_0xa3c2('0x5f')][_0xa3c2('0x69')],_0x1133bc[_0xa3c2('0x66')]['id'],_0x759de8['body']?JSON[_0xa3c2('0x24')](_0x759de8[_0xa3c2('0x58')]):'null');return respondWithRpcPromise(_0xa3c2('0x7e'),'rejectMessage',_0x1133bc);}return null;})[_0xa3c2('0x21')](function(_0x17c90c){var _0x5401d3=_0xa3c2('0x6d')+_0x17c90c[_0xa3c2('0x28')]['ContactId'];return db[_0xa3c2('0x6f')][_0xa3c2('0x40')](_0x5401d3,{'type':db['Sequelize']['QueryTypes'][_0xa3c2('0x7f')],'raw':!![]})[_0xa3c2('0x21')](function(_0x31aacc){return _0x31aacc;});})['then'](function(_0x128288){if(_0x128288){_0x1133bc['message'][_0xa3c2('0x71')]=_0x128288[0x0];if(!_0x759de8[_0xa3c2('0x58')]['UserId'])return;return db[_0xa3c2('0x80')][_0xa3c2('0x55')]({'where':{'id':_0x759de8[_0xa3c2('0x58')][_0xa3c2('0x5e')],'role':_0xa3c2('0x60')},'attributes':['id',_0xa3c2('0x37'),_0xa3c2('0x72'),'email',_0xa3c2('0x73')],'raw':!![]});}return null;})[_0xa3c2('0x21')](function(_0x59508f){if(!_0x59508f)return null;_0x1133bc[_0xa3c2('0x28')][_0xa3c2('0x60')]=_0x59508f;return _0x1133bc;})[_0xa3c2('0x21')](function(_0x3d7c67){if(_0x3d7c67){_0x3d7c67[_0xa3c2('0x28')]['interface']=util[_0xa3c2('0x65')](_0xa3c2('0x76'),_0x759de8[_0xa3c2('0x5f')][_0xa3c2('0x37')]);_0x3d7c67[_0xa3c2('0x28')][_0xa3c2('0x77')]=_0x1133bc['channel'];_0x3d7c67[_0xa3c2('0x28')][_0xa3c2('0x78')]=_0x1133bc['channel'];_0x3d7c67[_0xa3c2('0x28')][_0xa3c2('0x79')]='reject';respondWithRpcPromise(_0xa3c2('0x7a'),_0xa3c2('0x7a'),{'event':_0xa3c2('0x81'),'message':_0x3d7c67[_0xa3c2('0x28')]},client9002);return _0x1133bc;}return null;})[_0xa3c2('0x21')](respondWithResult(_0x1e437e,null))['catch'](handleError(_0x1e437e,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 7303440..a9c0edb 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 _0xd388=['exports','events','../../mysqldb','OpenchannelMessage','emit','hasOwnProperty','hook'];(function(_0x5b7788,_0x309ae5){var _0x573871=function(_0x5c79fd){while(--_0x5c79fd){_0x5b7788['push'](_0x5b7788['shift']());}};_0x573871(++_0x309ae5);}(_0xd388,0x104));var _0x8d38=function(_0x3782c6,_0x1c7267){_0x3782c6=_0x3782c6-0x0;var _0x56f758=_0xd388[_0x3782c6];return _0x56f758;};'use strict';var EventEmitter=require(_0x8d38('0x0'));var OpenchannelMessage=require(_0x8d38('0x1'))['db'][_0x8d38('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4f7d06){return function(_0x25c531,_0x85db89,_0x2a3614){OpenchannelMessageEvents[_0x8d38('0x3')](_0x4f7d06+':'+_0x25c531['id'],_0x25c531);OpenchannelMessageEvents[_0x8d38('0x3')](_0x4f7d06,_0x25c531);_0x2a3614(null);};}for(var e in events){if(events[_0x8d38('0x4')](e)){var event=events[e];OpenchannelMessage[_0x8d38('0x5')](e,emitEvent(event));}}module[_0x8d38('0x6')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xfb8c=['OpenchannelMessage','setMaxListeners','save','update','emit','hook','events','../../mysqldb'];(function(_0x2a2468,_0x4c82e3){var _0x1e3cda=function(_0x46683f){while(--_0x46683f){_0x2a2468['push'](_0x2a2468['shift']());}};_0x1e3cda(++_0x4c82e3);}(_0xfb8c,0x176));var _0xcfb8=function(_0x39e62c,_0x38767f){_0x39e62c=_0x39e62c-0x0;var _0x4f8771=_0xfb8c[_0x39e62c];return _0x4f8771;};'use strict';var EventEmitter=require(_0xcfb8('0x0'));var OpenchannelMessage=require(_0xcfb8('0x1'))['db'][_0xcfb8('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xcfb8('0x3')](0x0);var events={'afterCreate':_0xcfb8('0x4'),'afterUpdate':_0xcfb8('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3cf846){return function(_0x53e43a,_0x13ef51,_0x1e8abd){OpenchannelMessageEvents[_0xcfb8('0x6')](_0x3cf846+':'+_0x53e43a['id'],_0x53e43a);OpenchannelMessageEvents['emit'](_0x3cf846,_0x53e43a);_0x1e8abd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0xcfb8('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index a93f9f4..7088731 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 _0x7c40=['get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','catch','error','describe','OpenchannelAccount','find','OpenchannelAccountId','CmContact','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','format','Interactions','length','Interaction','omit','Contact','POST','GET','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','utf8mb4','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','define','OpenchannelMessage','body','FULLTEXT','models'];(function(_0x1481fe,_0x497588){var _0x2281c1=function(_0x131759){while(--_0x131759){_0x1481fe['push'](_0x1481fe['shift']());}};_0x2281c1(++_0x497588);}(_0x7c40,0x83));var _0x07c4=function(_0x436c50,_0x1a35b0){_0x436c50=_0x436c50-0x0;var _0x1a315e=_0x7c40[_0x436c50];return _0x1a315e;};'use strict';var _=require('lodash');var util=require(_0x07c4('0x0'));var logger=require(_0x07c4('0x1'))(_0x07c4('0x2'));var moment=require(_0x07c4('0x3'));var BPromise=require(_0x07c4('0x4'));var rp=require(_0x07c4('0x5'));var fs=require('fs');var path=require(_0x07c4('0x6'));var rimraf=require(_0x07c4('0x7'));var config=require('../../config/environment');var attributes=require('./openchannelMessage.attributes');module['exports']=function(_0x43bd6d,_0x5abe94){return _0x43bd6d[_0x07c4('0x8')](_0x07c4('0x9'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x07c4('0xa')],'type':_0x07c4('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2b38f6,_0x55910a,_0x14a2be){var _0x1ad658=_0x43bd6d[_0x07c4('0xc')];var _0xe2ee6f=_0x2b38f6[_0x07c4('0xd')]({'plain':!![]});if(_0xe2ee6f[_0x07c4('0xe')][_0x07c4('0xf')]()==='in'||_0xe2ee6f[_0x07c4('0xe')][_0x07c4('0xf')]()===_0x07c4('0x10')&&!_0xe2ee6f[_0x07c4('0x11')]&&!_[_0x07c4('0x12')](_0xe2ee6f[_0x07c4('0x13')])){_0x1ad658[_0x07c4('0x14')][_0x07c4('0x15')]({'where':{'id':_0xe2ee6f[_0x07c4('0x16')]}})[_0x07c4('0x17')](function(_0x3bccd0){if(_0x3bccd0){_0x3bccd0[_0x07c4('0x18')]({'lastMsgAt':_0xe2ee6f['createdAt'],'lastMsgDirection':_0xe2ee6f[_0x07c4('0xe')][_0x07c4('0xf')]()});}})[_0x07c4('0x19')](function(_0x378088){console[_0x07c4('0x1a')](_0x378088);});}if(_0xe2ee6f[_0x07c4('0xe')]==='out'&&!_0xe2ee6f[_0x07c4('0x11')]){var _0xaa2fd0;_0x1ad658['CmContact'][_0x07c4('0x1b')]()['then'](function(_0x254af9){return _0x1ad658[_0x07c4('0x1c')][_0x07c4('0x1d')]({'where':{'id':_0xe2ee6f[_0x07c4('0x1e')]},'include':[{'model':_0x1ad658[_0x07c4('0x14')],'as':'Interactions','where':{'id':_0xe2ee6f[_0x07c4('0x16')]},'limit':0x1,'include':[{'model':_0x1ad658[_0x07c4('0x1f')],'as':'Contact','attributes':_['keys'](_0x254af9)}]}]});})[_0x07c4('0x17')](function(_0x3fa9bb){_0xaa2fd0=_0x3fa9bb[_0x07c4('0xd')]({'plain':!![]});if(_0xaa2fd0&&_0xaa2fd0[_0x07c4('0x20')]){logger[_0x07c4('0x21')](_0x07c4('0x22'),'afterCreate',util[_0x07c4('0x23')]('Forwarding\x20message\x20%d\x20to\x20%s',_0xe2ee6f['id'],_0xaa2fd0['replyUri']));if(_0xaa2fd0[_0x07c4('0x24')]&&_0xaa2fd0[_0x07c4('0x24')][_0x07c4('0x25')]){_0xe2ee6f[_0x07c4('0x26')]=_[_0x07c4('0x27')](_0xaa2fd0[_0x07c4('0x24')][0x0],'Contact');_0xe2ee6f[_0x07c4('0x28')]=_0xaa2fd0[_0x07c4('0x24')][0x0][_0x07c4('0x28')];}var _0x55910a={'method':_0x07c4('0x29'),'uri':encodeURI(_0xaa2fd0[_0x07c4('0x20')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x55910a['method']){case _0x07c4('0x2a'):_0x55910a['qs']=_0xe2ee6f;break;case'POST':_0x55910a[_0x07c4('0xa')]=_0xe2ee6f;break;}return rp(_0x55910a)[_0x07c4('0x17')](function(_0x5aba44){logger['info'](_0x07c4('0x22'),_0x07c4('0x2b'),util['format'](_0x07c4('0x2c'),_0xe2ee6f['id'],_0xaa2fd0['replyUri']));if(_0x5aba44[_0x07c4('0xa')]['threadId']&&_0x5aba44[_0x07c4('0xa')]['threadId']!=_0xe2ee6f[_0x07c4('0x26')][_0x07c4('0x2d')]){return _0x1ad658['OpenchannelInteraction'][_0x07c4('0x18')]({'threadId':_0x5aba44[_0x07c4('0xa')][_0x07c4('0x2d')]},{'where':{'id':_0xe2ee6f[_0x07c4('0x26')]['id']}});}else{return;}})['then'](function(){return _0x2b38f6[_0x07c4('0x18')]({'read':!![]});})[_0x07c4('0x19')](function(_0x84e5b){logger[_0x07c4('0x1a')](_0x07c4('0x22'),_0x07c4('0x2b'),util[_0x07c4('0x2e')](_0x84e5b,{'showHidden':![],'depth':null}));_0x14a2be();});}else{_0x14a2be();}})['finally'](function(){_0x14a2be();});}else{_0x14a2be();}}},'charset':_0x07c4('0x2f'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x9db4=['body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','then','update','createdAt','error','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','OpenchannelInteractionId','Contact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','length','POST','method','info','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','catch','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','OpenchannelMessage','openchannel_messages','fti_openchannel_messages'];(function(_0x3f1712,_0x310cc){var _0x143e67=function(_0x30d93a){while(--_0x30d93a){_0x3f1712['push'](_0x3f1712['shift']());}};_0x143e67(++_0x310cc);}(_0x9db4,0x1a2));var _0x49db=function(_0x115f06,_0x1cee74){_0x115f06=_0x115f06-0x0;var _0x4c57c6=_0x9db4[_0x115f06];return _0x4c57c6;};'use strict';var _=require(_0x49db('0x0'));var util=require(_0x49db('0x1'));var logger=require(_0x49db('0x2'))(_0x49db('0x3'));var moment=require(_0x49db('0x4'));var BPromise=require('bluebird');var rp=require(_0x49db('0x5'));var fs=require('fs');var path=require(_0x49db('0x6'));var rimraf=require(_0x49db('0x7'));var config=require(_0x49db('0x8'));var attributes=require(_0x49db('0x9'));module[_0x49db('0xa')]=function(_0x3199cf,_0x5101d1){return _0x3199cf['define'](_0x49db('0xb'),attributes,{'tableName':_0x49db('0xc'),'paranoid':![],'indexes':[{'name':_0x49db('0xd'),'fields':[_0x49db('0xe')],'type':_0x49db('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x55d200,_0x49117a,_0x494868){var _0x1ae4da=_0x3199cf[_0x49db('0x10')];var _0x1cef2e=_0x55d200[_0x49db('0x11')]({'plain':!![]});if(_0x1cef2e[_0x49db('0x12')]['toLowerCase']()==='in'||_0x1cef2e[_0x49db('0x12')][_0x49db('0x13')]()===_0x49db('0x14')&&!_0x1cef2e[_0x49db('0x15')]&&!_[_0x49db('0x16')](_0x1cef2e[_0x49db('0x17')])){_0x1ae4da[_0x49db('0x18')]['findOne']({'where':{'id':_0x1cef2e['OpenchannelInteractionId']}})[_0x49db('0x19')](function(_0x214341){if(_0x214341){_0x214341[_0x49db('0x1a')]({'lastMsgAt':_0x1cef2e[_0x49db('0x1b')],'lastMsgDirection':_0x1cef2e[_0x49db('0x12')][_0x49db('0x13')]()});}})['catch'](function(_0x2e75b9){console[_0x49db('0x1c')](_0x2e75b9);});}if(_0x1cef2e[_0x49db('0x12')]===_0x49db('0x14')&&!_0x1cef2e['secret']){var _0x1ecaca;_0x1ae4da['CmContact'][_0x49db('0x1d')]()[_0x49db('0x19')](function(_0x17a4a4){return _0x1ae4da[_0x49db('0x1e')][_0x49db('0x1f')]({'where':{'id':_0x1cef2e[_0x49db('0x20')]},'include':[{'model':_0x1ae4da[_0x49db('0x18')],'as':_0x49db('0x21'),'where':{'id':_0x1cef2e[_0x49db('0x22')]},'limit':0x1,'include':[{'model':_0x1ae4da['CmContact'],'as':_0x49db('0x23'),'attributes':_[_0x49db('0x24')](_0x17a4a4)}]}]});})[_0x49db('0x19')](function(_0x29136e){_0x1ecaca=_0x29136e[_0x49db('0x11')]({'plain':!![]});if(_0x1ecaca&&_0x1ecaca[_0x49db('0x25')]){logger['info'](_0x49db('0x26'),'afterCreate',util[_0x49db('0x27')](_0x49db('0x28'),_0x1cef2e['id'],_0x1ecaca[_0x49db('0x25')]));if(_0x1ecaca[_0x49db('0x21')]&&_0x1ecaca[_0x49db('0x21')][_0x49db('0x29')]){_0x1cef2e['Interaction']=_['omit'](_0x1ecaca[_0x49db('0x21')][0x0],'Contact');_0x1cef2e[_0x49db('0x23')]=_0x1ecaca[_0x49db('0x21')][0x0]['Contact'];}var _0x49117a={'method':_0x49db('0x2a'),'uri':encodeURI(_0x1ecaca[_0x49db('0x25')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x49117a[_0x49db('0x2b')]){case'GET':_0x49117a['qs']=_0x1cef2e;break;case'POST':_0x49117a[_0x49db('0xe')]=_0x1cef2e;break;}return rp(_0x49117a)['then'](function(_0x297dae){logger[_0x49db('0x2c')](_0x49db('0x26'),_0x49db('0x2d'),util[_0x49db('0x27')](_0x49db('0x2e'),_0x1cef2e['id'],_0x1ecaca['replyUri']));if(_0x297dae[_0x49db('0xe')][_0x49db('0x2f')]&&_0x297dae[_0x49db('0xe')]['threadId']!=_0x1cef2e[_0x49db('0x30')][_0x49db('0x2f')]){return _0x1ae4da[_0x49db('0x18')][_0x49db('0x1a')]({'threadId':_0x297dae[_0x49db('0xe')]['threadId']},{'where':{'id':_0x1cef2e[_0x49db('0x30')]['id']}});}else{return;}})[_0x49db('0x19')](function(){return _0x55d200[_0x49db('0x1a')]({'read':!![]});})[_0x49db('0x31')](function(_0x9b054b){logger[_0x49db('0x1c')](_0x49db('0x26'),_0x49db('0x2d'),util[_0x49db('0x32')](_0x9b054b,{'showHidden':![],'depth':null}));_0x494868();});}else{_0x494868();}})[_0x49db('0x33')](function(){_0x494868();});}else{_0x494868();}}},'charset':_0x49db('0x34'),'collate':_0x49db('0x35')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 4eafb03..a8de54d 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','OpenchannelMessage','options','raw','then','CreateOpenchannelMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2381c9,_0xddadfd){var _0x5d10ee=function(_0x233323){while(--_0x233323){_0x2381c9['push'](_0x2381c9['shift']());}};_0x5d10ee(++_0xddadfd);}(_0x1261,0x144));var _0x1126=function(_0x185334,_0x4630ac){_0x185334=_0x185334-0x0;var _0xf2e59a=_0x1261[_0x185334];return _0xf2e59a;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});config[_0x1126('0xb')]=_['defaults'](config[_0x1126('0xb')],{'host':_0x1126('0xc'),'port':0x18eb});var socket=require(_0x1126('0xd'))(new Redis(config[_0x1126('0xb')]));require(_0x1126('0xe'))['register'](socket);function respondWithRpcPromise(_0x3f09ac,_0x18dbe6,_0x167ef1){return new BPromise(function(_0x5e72e2,_0x34571c){return client['request'](_0x3f09ac,_0x167ef1)['then'](function(_0x15c071){logger['info'](_0x1126('0xf'),_0x18dbe6,_0x1126('0x10'));logger[_0x1126('0x11')](_0x1126('0x12'),_0x18dbe6,_0x1126('0x10'),JSON[_0x1126('0x13')](_0x15c071));if(_0x15c071[_0x1126('0x14')]){if(_0x15c071[_0x1126('0x14')][_0x1126('0x15')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x34571c(_0x15c071[_0x1126('0x14')]['message']);}logger[_0x1126('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x5e72e2(_0x15c071[_0x1126('0x14')]['message']);}else{logger[_0x1126('0x17')](_0x1126('0xf'),_0x18dbe6,'request\x20sent');_0x5e72e2(_0x15c071['result'][_0x1126('0x16')]);}})[_0x1126('0x18')](function(_0x58d11a){logger['error'](_0x1126('0xf'),_0x18dbe6,_0x58d11a);_0x34571c(_0x58d11a);});});}exports['CreateOpenchannelMessage']=function(_0x22ed37){var _0x1d6d19=this;return new Promise(function(_0x2f70ac,_0x54400a){return db[_0x1126('0x19')]['create'](_0x22ed37['body'],{'raw':_0x22ed37[_0x1126('0x1a')]?_0x22ed37[_0x1126('0x1a')][_0x1126('0x1b')]===undefined?!![]:![]:!![]})[_0x1126('0x1c')](function(_0x526ca1){logger[_0x1126('0x17')](_0x1126('0x1d'),_0x22ed37);logger['debug'](_0x1126('0x1d'),_0x22ed37,JSON['stringify'](_0x526ca1));_0x2f70ac(_0x526ca1);})['catch'](function(_0x4b57ab){logger[_0x1126('0x14')](_0x1126('0x1d'),_0x4b57ab[_0x1126('0x16')],_0x22ed37);_0x54400a(_0x1d6d19[_0x1126('0x14')](0x1f4,_0x4b57ab[_0x1126('0x16')]));});});}; \ No newline at end of file +var _0xdb28=['then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request'];(function(_0x3cfaa3,_0x34f6c9){var _0x55a02c=function(_0x2606fd){while(--_0x2606fd){_0x3cfaa3['push'](_0x3cfaa3['shift']());}};_0x55a02c(++_0x34f6c9);}(_0xdb28,0x106));var _0x8db2=function(_0x2b8fbf,_0x50f66a){_0x2b8fbf=_0x2b8fbf-0x0;var _0x4d5d44=_0xdb28[_0x2b8fbf];return _0x4d5d44;};'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 72434ec..9dcc349 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 _0x1883=['./openchannelMessage.events','save','remove','update','emit','removeListener','register','length','openchannelMessage:'];(function(_0x1f239a,_0x40fa90){var _0x4982b7=function(_0x54f977){while(--_0x54f977){_0x1f239a['push'](_0x1f239a['shift']());}};_0x4982b7(++_0x40fa90);}(_0x1883,0xab));var _0x3188=function(_0x4ea85b,_0x663f8a){_0x4ea85b=_0x4ea85b-0x0;var _0x1e556d=_0x1883[_0x4ea85b];return _0x1e556d;};'use strict';var OpenchannelMessageEvents=require(_0x3188('0x0'));var events=[_0x3188('0x1'),_0x3188('0x2'),_0x3188('0x3')];function createListener(_0x11e3bf,_0x7ce655){return function(_0x2551e5){_0x7ce655[_0x3188('0x4')](_0x11e3bf,_0x2551e5);};}function removeListener(_0x1c7c86,_0x44afb8){return function(){OpenchannelMessageEvents[_0x3188('0x5')](_0x1c7c86,_0x44afb8);};}exports[_0x3188('0x6')]=function(_0x408ae0){for(var _0x33b62d=0x0,_0x24f2f1=events[_0x3188('0x7')];_0x33b62d<_0x24f2f1;_0x33b62d++){var _0x3e3afb=events[_0x33b62d];var _0x5c8f26=createListener(_0x3188('0x8')+_0x3e3afb,_0x408ae0);OpenchannelMessageEvents['on'](_0x3e3afb,_0x5c8f26);}}; \ No newline at end of file +var _0xad56=['removeListener','register','openchannelMessage:','./openchannelMessage.events','save','remove','update','emit'];(function(_0x500a6c,_0x3d0f6c){var _0x5d9083=function(_0x1212e1){while(--_0x1212e1){_0x500a6c['push'](_0x500a6c['shift']());}};_0x5d9083(++_0x3d0f6c);}(_0xad56,0x11b));var _0x6ad5=function(_0x5b2e94,_0x447f7e){_0x5b2e94=_0x5b2e94-0x0;var _0x370402=_0xad56[_0x5b2e94];return _0x370402;};'use strict';var OpenchannelMessageEvents=require(_0x6ad5('0x0'));var events=[_0x6ad5('0x1'),_0x6ad5('0x2'),_0x6ad5('0x3')];function createListener(_0x8f64f5,_0xf252b0){return function(_0x29f9ef){_0xf252b0[_0x6ad5('0x4')](_0x8f64f5,_0x29f9ef);};}function removeListener(_0x2be106,_0x3d17ff){return function(){OpenchannelMessageEvents[_0x6ad5('0x5')](_0x2be106,_0x3d17ff);};}exports[_0x6ad5('0x6')]=function(_0x5bee68){for(var _0x8b8088=0x0,_0x2c518a=events['length'];_0x8b8088<_0x2c518a;_0x8b8088++){var _0x19ccdc=events[_0x8b8088];var _0x112c93=createListener(_0x6ad5('0x7')+_0x19ccdc,_0x5bee68);OpenchannelMessageEvents['on'](_0x19ccdc,_0x112c93);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 44cc23a..b08a0e7 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 _0xc6e7=['../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','describe','show','getMembers','post','create','/:id/teams','addTeams','/:id/users','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x34ff1e,_0x1b0c97){var _0x5fe980=function(_0x216989){while(--_0x216989){_0x34ff1e['push'](_0x34ff1e['shift']());}};_0x5fe980(++_0x1b0c97);}(_0xc6e7,0x112));var _0x7c6e=function(_0x146a75,_0x1a290b){_0x146a75=_0x146a75-0x0;var _0x3521d8=_0xc6e7[_0x146a75];return _0x3521d8;};'use strict';var multer=require(_0x7c6e('0x0'));var util=require('util');var path=require(_0x7c6e('0x1'));var timeout=require(_0x7c6e('0x2'));var express=require(_0x7c6e('0x3'));var router=express['Router']();var fs_extra=require(_0x7c6e('0x4'));var auth=require(_0x7c6e('0x5'));var interaction=require(_0x7c6e('0x6'));var config=require(_0x7c6e('0x7'));var controller=require(_0x7c6e('0x8'));router[_0x7c6e('0x9')]('/',auth[_0x7c6e('0xa')](),controller[_0x7c6e('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x7c6e('0xc')]);router[_0x7c6e('0x9')]('/:id',auth[_0x7c6e('0xa')](),controller[_0x7c6e('0xd')]);router[_0x7c6e('0x9')]('/:id/members',auth[_0x7c6e('0xa')](),controller[_0x7c6e('0xe')]);router[_0x7c6e('0x9')]('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router[_0x7c6e('0x9')]('/:id/users',auth[_0x7c6e('0xa')](),controller['getAgents']);router[_0x7c6e('0xf')]('/',auth[_0x7c6e('0xa')](),controller[_0x7c6e('0x10')]);router[_0x7c6e('0xf')](_0x7c6e('0x11'),auth[_0x7c6e('0xa')](),controller[_0x7c6e('0x12')]);router[_0x7c6e('0xf')](_0x7c6e('0x13'),auth[_0x7c6e('0xa')](),controller[_0x7c6e('0x14')]);router[_0x7c6e('0x15')]('/:id',auth[_0x7c6e('0xa')](),controller[_0x7c6e('0x16')]);router[_0x7c6e('0x17')]('/:id',auth[_0x7c6e('0xa')](),controller[_0x7c6e('0x18')]);router[_0x7c6e('0x17')](_0x7c6e('0x11'),auth[_0x7c6e('0xa')](),controller[_0x7c6e('0x19')]);router[_0x7c6e('0x17')](_0x7c6e('0x13'),auth[_0x7c6e('0xa')](),controller[_0x7c6e('0x1a')]);module[_0x7c6e('0x1b')]=router; \ No newline at end of file +var _0x375a=['addTeams','addAgents','update','destroy','delete','removeTeams','/:id/users','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','getMembers','getTeams','getAgents','post','create','/:id/teams'];(function(_0x1e745f,_0x533411){var _0x498800=function(_0x3cfd59){while(--_0x3cfd59){_0x1e745f['push'](_0x1e745f['shift']());}};_0x498800(++_0x533411);}(_0x375a,0x101));var _0xa375=function(_0x3062ae,_0x5d5c07){_0x3062ae=_0x3062ae-0x0;var _0x1535c8=_0x375a[_0x3062ae];return _0x1535c8;};'use strict';var multer=require(_0xa375('0x0'));var util=require(_0xa375('0x1'));var path=require(_0xa375('0x2'));var timeout=require(_0xa375('0x3'));var express=require(_0xa375('0x4'));var router=express[_0xa375('0x5')]();var fs_extra=require(_0xa375('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xa375('0x7'));var config=require(_0xa375('0x8'));var controller=require(_0xa375('0x9'));router[_0xa375('0xa')]('/',auth[_0xa375('0xb')](),controller[_0xa375('0xc')]);router[_0xa375('0xa')](_0xa375('0xd'),auth['isAuthenticated'](),controller[_0xa375('0xe')]);router[_0xa375('0xa')](_0xa375('0xf'),auth[_0xa375('0xb')](),controller['show']);router[_0xa375('0xa')]('/:id/members',auth[_0xa375('0xb')](),controller[_0xa375('0x10')]);router[_0xa375('0xa')]('/:id/teams',auth[_0xa375('0xb')](),controller[_0xa375('0x11')]);router['get']('/:id/users',auth[_0xa375('0xb')](),controller[_0xa375('0x12')]);router[_0xa375('0x13')]('/',auth['isAuthenticated'](),controller[_0xa375('0x14')]);router[_0xa375('0x13')](_0xa375('0x15'),auth[_0xa375('0xb')](),controller[_0xa375('0x16')]);router[_0xa375('0x13')]('/:id/users',auth[_0xa375('0xb')](),controller[_0xa375('0x17')]);router['put'](_0xa375('0xf'),auth[_0xa375('0xb')](),controller[_0xa375('0x18')]);router['delete'](_0xa375('0xf'),auth[_0xa375('0xb')](),controller[_0xa375('0x19')]);router[_0xa375('0x1a')](_0xa375('0x15'),auth[_0xa375('0xb')](),controller[_0xa375('0x1b')]);router[_0xa375('0x1a')](_0xa375('0x1c'),auth[_0xa375('0xb')](),controller[_0xa375('0x1d')]);module[_0xa375('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index f2f433a..ec8ea4e 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 _0xb238=['STRING','name','INTEGER','ENUM','rrmemory','beepall','exports'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0xb238,0x8b));var _0x8b23=function(_0x3a84ac,_0x3e1a0a){_0x3a84ac=_0x3a84ac-0x0;var _0x3a7c1f=_0xb238[_0x3a84ac];return _0x3a7c1f;};'use strict';var Sequelize=require('sequelize');module[_0x8b23('0x0')]={'name':{'type':Sequelize[_0x8b23('0x1')],'unique':_0x8b23('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8b23('0x1')]},'timeout':{'type':Sequelize[_0x8b23('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8b23('0x4')](_0x8b23('0x5'),_0x8b23('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x2673=['ENUM','rrmemory','roundrobin','sequelize','STRING','name','INTEGER'];(function(_0x9f2929,_0x9219b2){var _0x20e916=function(_0x344603){while(--_0x344603){_0x9f2929['push'](_0x9f2929['shift']());}};_0x20e916(++_0x9219b2);}(_0x2673,0xea));var _0x3267=function(_0x26659f,_0x32f426){_0x26659f=_0x26659f-0x0;var _0x42667f=_0x2673[_0x26659f];return _0x42667f;};'use strict';var Sequelize=require(_0x3267('0x0'));module['exports']={'name':{'type':Sequelize[_0x3267('0x1')],'unique':_0x3267('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3267('0x1')]},'timeout':{'type':Sequelize[_0x3267('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3267('0x4')](_0x3267('0x5'),'beepall',_0x3267('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index c62977f..c478338 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 _0x0ed0=['map','OpenchannelQueue','rawAttributes','key','model','query','keys','attributes','fields','length','nolimit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','findOne','UserOpenchannelQueue','intersection','hasOwnProperty','User','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','addTeams','ids','Agents','online','voicePause','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','union','value','isEmpty','addAgents','omit','spread','removeAgents','isArray','getAgents','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','get','OpenchannelQueues','UserProfileResource','destroy','end','error','stack','name','send'];(function(_0x428faa,_0x3a0227){var _0x337ddc=function(_0x1dbd70){while(--_0x1dbd70){_0x428faa['push'](_0x428faa['shift']());}};_0x337ddc(++_0x3a0227);}(_0x0ed0,0x169));var _0x00ed=function(_0x1117e,_0x2a9786){_0x1117e=_0x1117e-0x0;var _0x23e6b5=_0x0ed0[_0x1117e];return _0x23e6b5;};'use strict';var emlformat=require(_0x00ed('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x00ed('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x00ed('0x2'));var moment=require('moment');var BPromise=require(_0x00ed('0x3'));var Mustache=require(_0x00ed('0x4'));var util=require(_0x00ed('0x5'));var path=require(_0x00ed('0x6'));var sox=require(_0x00ed('0x7'));var csv=require(_0x00ed('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x00ed('0x9'));var _=require(_0x00ed('0xa'));var squel=require('squel');var crypto=require(_0x00ed('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x00ed('0x8'));var querystring=require(_0x00ed('0xc'));var Papa=require('papaparse');var Redis=require(_0x00ed('0xd'));var authService=require(_0x00ed('0xe'));var qs=require(_0x00ed('0xf'));var as=require(_0x00ed('0x10'));var hardwareService=require(_0x00ed('0x11'));var logger=require(_0x00ed('0x12'))('api');var utils=require(_0x00ed('0x13'));var config=require(_0x00ed('0x14'));var licenseUtil=require(_0x00ed('0x15'));var db=require('../../mysqldb')['db'];config[_0x00ed('0x16')]=_[_0x00ed('0x17')](config[_0x00ed('0x16')],{'host':_0x00ed('0x18'),'port':0x18eb});var socket=require(_0x00ed('0x19'))(new Redis(config[_0x00ed('0x16')]));require('./openchannelQueue.socket')['register'](socket);function respondWithStatusCode(_0x941aba,_0x18ca09){_0x18ca09=_0x18ca09||0xcc;return function(_0x5e7c64){if(_0x5e7c64){return _0x941aba[_0x00ed('0x1a')](_0x18ca09);}return _0x941aba[_0x00ed('0x1b')](_0x18ca09)['end']();};}function respondWithResult(_0x3e8246,_0x3230ea){_0x3230ea=_0x3230ea||0xc8;return function(_0xfc03ab){if(_0xfc03ab){return _0x3e8246[_0x00ed('0x1b')](_0x3230ea)[_0x00ed('0x1c')](_0xfc03ab);}};}function respondWithFilteredResult(_0x18fedf,_0xe674a2){return function(_0x5ee53d){if(_0x5ee53d){var _0x349031=typeof _0xe674a2[_0x00ed('0x1d')]==='undefined'&&typeof _0xe674a2['limit']===_0x00ed('0x1e');var _0x3fd764=_0x5ee53d[_0x00ed('0x1f')];var _0x490a7=_0x349031?0x0:_0xe674a2[_0x00ed('0x1d')];var _0x3f52c2=_0x349031?_0x5ee53d[_0x00ed('0x1f')]:_0xe674a2[_0x00ed('0x1d')]+_0xe674a2[_0x00ed('0x20')];var _0x12aa7c;if(_0x3f52c2>=_0x3fd764){_0x3f52c2=_0x3fd764;_0x12aa7c=0xc8;}else{_0x12aa7c=0xce;}_0x18fedf[_0x00ed('0x1b')](_0x12aa7c);return _0x18fedf['set'](_0x00ed('0x21'),_0x490a7+'-'+_0x3f52c2+'/'+_0x3fd764)[_0x00ed('0x1c')](_0x5ee53d);}return null;};}function patchUpdates(_0x59f092){return function(_0x573df2){try{jsonpatch[_0x00ed('0x22')](_0x573df2,_0x59f092,!![]);}catch(_0xad6ea2){return BPromise[_0x00ed('0x23')](_0xad6ea2);}return _0x573df2[_0x00ed('0x24')]();};}function saveUpdates(_0x31fca1,_0x42a434){return function(_0xaef919){if(_0xaef919){return _0xaef919['update'](_0x31fca1)[_0x00ed('0x25')](function(_0x36de3b){return _0x36de3b;});}return null;};}function removeEntity(_0x342075,_0x5152cb){return function(_0x39bef4){if(_0x39bef4){return _0x39bef4['destroy']()[_0x00ed('0x25')](function(){var _0x5adf37=_0x39bef4[_0x00ed('0x26')]({'plain':!![]});var _0x31e2e0=_0x00ed('0x27');return db[_0x00ed('0x28')][_0x00ed('0x29')]({'where':{'type':_0x31e2e0,'resourceId':_0x5adf37['id']}})[_0x00ed('0x25')](function(){return _0x39bef4;});})['then'](function(){_0x342075[_0x00ed('0x1b')](0xcc)[_0x00ed('0x2a')]();});}};}function handleEntityNotFound(_0x4a9490,_0x1c0787){return function(_0x4eb780){if(!_0x4eb780){_0x4a9490[_0x00ed('0x1a')](0x194);}return _0x4eb780;};}function handleError(_0x4eddbd,_0x4ce973){_0x4ce973=_0x4ce973||0x1f4;return function(_0x2e21c1){logger[_0x00ed('0x2b')](_0x2e21c1[_0x00ed('0x2c')]);if(_0x2e21c1['name']){delete _0x2e21c1[_0x00ed('0x2d')];}_0x4eddbd['status'](_0x4ce973)[_0x00ed('0x2e')](_0x2e21c1);};}exports['index']=function(_0x23ff89,_0x1700d5){var _0x5b4f4a={},_0x2b1a3e={},_0x44565f={'count':0x0,'rows':[]};var _0x4ef307=_[_0x00ed('0x2f')](db[_0x00ed('0x30')][_0x00ed('0x31')],function(_0x353d5f){return{'name':_0x353d5f['fieldName'],'type':_0x353d5f['type'][_0x00ed('0x32')]};});_0x2b1a3e[_0x00ed('0x33')]=_[_0x00ed('0x2f')](_0x4ef307,'name');_0x2b1a3e[_0x00ed('0x34')]=_[_0x00ed('0x35')](_0x23ff89[_0x00ed('0x34')]);_0x2b1a3e['filters']=_['intersection'](_0x2b1a3e['model'],_0x2b1a3e['query']);_0x5b4f4a[_0x00ed('0x36')]=_['intersection'](_0x2b1a3e['model'],qs['fields'](_0x23ff89[_0x00ed('0x34')][_0x00ed('0x37')]));_0x5b4f4a['attributes']=_0x5b4f4a[_0x00ed('0x36')][_0x00ed('0x38')]?_0x5b4f4a['attributes']:_0x2b1a3e['model'];if(!_0x23ff89[_0x00ed('0x34')]['hasOwnProperty'](_0x00ed('0x39'))){_0x5b4f4a[_0x00ed('0x20')]=qs['limit'](_0x23ff89[_0x00ed('0x34')][_0x00ed('0x20')]);_0x5b4f4a[_0x00ed('0x1d')]=qs[_0x00ed('0x1d')](_0x23ff89[_0x00ed('0x34')][_0x00ed('0x1d')]);}_0x5b4f4a[_0x00ed('0x3a')]=qs[_0x00ed('0x3b')](_0x23ff89[_0x00ed('0x34')]['sort']);_0x5b4f4a[_0x00ed('0x3c')]=qs['filters'](_[_0x00ed('0x3d')](_0x23ff89['query'],_0x2b1a3e[_0x00ed('0x3e')]),_0x4ef307);if(_0x23ff89[_0x00ed('0x34')][_0x00ed('0x3f')]){_0x5b4f4a[_0x00ed('0x3c')]=_[_0x00ed('0x40')](_0x5b4f4a[_0x00ed('0x3c')],{'$or':_['map'](_0x4ef307,function(_0x230fb6){if(_0x230fb6[_0x00ed('0x41')]!==_0x00ed('0x42')){var _0x2bdaad={};_0x2bdaad[_0x230fb6[_0x00ed('0x2d')]]={'$like':'%'+_0x23ff89[_0x00ed('0x34')]['filter']+'%'};return _0x2bdaad;}})});}_0x5b4f4a=_[_0x00ed('0x40')]({},_0x5b4f4a,_0x23ff89[_0x00ed('0x43')]);var _0xc705ea={'where':_0x5b4f4a[_0x00ed('0x3c')]};return db['OpenchannelQueue']['count'](_0xc705ea)['then'](function(_0x5b9df0){_0x44565f[_0x00ed('0x1f')]=_0x5b9df0;if(_0x23ff89[_0x00ed('0x34')][_0x00ed('0x44')]){_0x5b4f4a[_0x00ed('0x45')]=[{'all':!![]}];}return db[_0x00ed('0x30')][_0x00ed('0x46')](_0x5b4f4a);})[_0x00ed('0x25')](function(_0x1d06d2){_0x44565f[_0x00ed('0x47')]=_0x1d06d2;return _0x44565f;})[_0x00ed('0x25')](respondWithFilteredResult(_0x1700d5,_0x5b4f4a))[_0x00ed('0x48')](handleError(_0x1700d5,null));};exports[_0x00ed('0x49')]=function(_0x387380,_0x24f5b4){var _0x22bafd={'raw':!![],'where':{'id':_0x387380['params']['id']}},_0x1fb7cf={};_0x1fb7cf[_0x00ed('0x33')]=_['keys'](db[_0x00ed('0x30')]['rawAttributes']);_0x1fb7cf[_0x00ed('0x34')]=_['keys'](_0x387380['query']);_0x1fb7cf[_0x00ed('0x3e')]=_['intersection'](_0x1fb7cf[_0x00ed('0x33')],_0x1fb7cf['query']);_0x22bafd[_0x00ed('0x36')]=_['intersection'](_0x1fb7cf[_0x00ed('0x33')],qs[_0x00ed('0x37')](_0x387380[_0x00ed('0x34')]['fields']));_0x22bafd[_0x00ed('0x36')]=_0x22bafd[_0x00ed('0x36')][_0x00ed('0x38')]?_0x22bafd[_0x00ed('0x36')]:_0x1fb7cf['model'];if(_0x387380['query'][_0x00ed('0x44')]){_0x22bafd[_0x00ed('0x45')]=[{'all':!![]}];}_0x22bafd=_[_0x00ed('0x40')]({},_0x22bafd,_0x387380[_0x00ed('0x43')]);return db[_0x00ed('0x30')][_0x00ed('0x4a')](_0x22bafd)[_0x00ed('0x25')](handleEntityNotFound(_0x24f5b4,null))[_0x00ed('0x25')](respondWithResult(_0x24f5b4,null))[_0x00ed('0x48')](handleError(_0x24f5b4,null));};exports[_0x00ed('0x4b')]=function(_0x60f3eb,_0x2aae43){return db[_0x00ed('0x30')][_0x00ed('0x4b')](_0x60f3eb[_0x00ed('0x4c')],{})[_0x00ed('0x25')](function(_0x3c2bf2){var _0x1795cb=_0x60f3eb[_0x00ed('0x4d')][_0x00ed('0x26')]({'plain':!![]});if(!_0x1795cb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1795cb[_0x00ed('0x4e')]==='user'){var _0x421c2c=_0x3c2bf2[_0x00ed('0x26')]({'plain':!![]});var _0x30e89f=_0x00ed('0x27');return db[_0x00ed('0x4f')][_0x00ed('0x4a')]({'where':{'name':_0x30e89f,'userProfileId':_0x1795cb['userProfileId']},'raw':!![]})[_0x00ed('0x25')](function(_0x526aca){if(_0x526aca&&_0x526aca[_0x00ed('0x50')]===0x0){return db[_0x00ed('0x28')][_0x00ed('0x4b')]({'name':_0x421c2c[_0x00ed('0x2d')],'resourceId':_0x421c2c['id'],'type':_0x526aca[_0x00ed('0x2d')],'sectionId':_0x526aca['id']},{})[_0x00ed('0x25')](function(){return _0x3c2bf2;});}else{return _0x3c2bf2;}})[_0x00ed('0x48')](function(_0x580cb6){logger[_0x00ed('0x2b')](_0x00ed('0x51'),_0x580cb6);throw _0x580cb6;});}return _0x3c2bf2;})[_0x00ed('0x25')](respondWithResult(_0x2aae43,0xc9))[_0x00ed('0x48')](handleError(_0x2aae43,null));};exports[_0x00ed('0x52')]=function(_0x1d304d,_0x7f15b6){if(_0x1d304d[_0x00ed('0x4c')]['id']){delete _0x1d304d[_0x00ed('0x4c')]['id'];}return db[_0x00ed('0x30')][_0x00ed('0x4a')]({'where':{'id':_0x1d304d['params']['id']}})[_0x00ed('0x25')](handleEntityNotFound(_0x7f15b6,null))[_0x00ed('0x25')](saveUpdates(_0x1d304d[_0x00ed('0x4c')],null))[_0x00ed('0x25')](respondWithResult(_0x7f15b6,null))[_0x00ed('0x48')](handleError(_0x7f15b6,null));};exports[_0x00ed('0x29')]=function(_0x57e95d,_0x1d69eb){return db[_0x00ed('0x30')][_0x00ed('0x4a')]({'where':{'id':_0x57e95d[_0x00ed('0x53')]['id']}})[_0x00ed('0x25')](handleEntityNotFound(_0x1d69eb,null))['then'](removeEntity(_0x1d69eb,null))[_0x00ed('0x48')](handleError(_0x1d69eb,null));};exports[_0x00ed('0x54')]=function(_0x559c5d,_0x1e296b){return db[_0x00ed('0x30')][_0x00ed('0x54')]()[_0x00ed('0x25')](respondWithResult(_0x1e296b,null))[_0x00ed('0x48')](handleError(_0x1e296b,null));};exports['getMembers']=function(_0x5a63b4,_0x475908,_0x2fb3df){var _0x463093={'raw':!![],'where':{}},_0x2063f7={},_0x2205c3;return db['OpenchannelQueue'][_0x00ed('0x55')]({'where':{'id':_0x5a63b4[_0x00ed('0x53')]['id']}})[_0x00ed('0x25')](handleEntityNotFound(_0x475908,null))[_0x00ed('0x25')](function(_0x4322df){if(_0x4322df){_0x2205c3=_0x4322df[_0x00ed('0x26')]({'plain':!![]});_0x2063f7[_0x00ed('0x33')]=_[_0x00ed('0x35')](db[_0x00ed('0x56')]['rawAttributes']);_0x2063f7[_0x00ed('0x34')]=_[_0x00ed('0x35')](_0x5a63b4[_0x00ed('0x34')]);_0x2063f7[_0x00ed('0x3e')]=_[_0x00ed('0x57')](_0x2063f7[_0x00ed('0x33')],_0x2063f7[_0x00ed('0x34')]);_0x463093[_0x00ed('0x36')]=_[_0x00ed('0x57')](_0x2063f7['model'],qs[_0x00ed('0x37')](_0x5a63b4[_0x00ed('0x34')][_0x00ed('0x37')]));_0x463093['attributes']=_0x463093['attributes'][_0x00ed('0x38')]?_0x463093[_0x00ed('0x36')]:_0x2063f7[_0x00ed('0x33')];if(!_0x5a63b4[_0x00ed('0x34')][_0x00ed('0x58')](_0x00ed('0x39'))){_0x463093[_0x00ed('0x20')]=qs[_0x00ed('0x20')](_0x5a63b4[_0x00ed('0x34')][_0x00ed('0x20')]);_0x463093[_0x00ed('0x1d')]=qs[_0x00ed('0x1d')](_0x5a63b4['query'][_0x00ed('0x1d')]);}_0x463093[_0x00ed('0x3a')]=qs['sort'](_0x5a63b4['query']['sort']);_0x463093[_0x00ed('0x3c')]=qs['filters'](_['pick'](_0x5a63b4['query'],_0x2063f7[_0x00ed('0x3e')]));_0x463093['where']['OpenchannelQueueId']=_0x4322df['id'];if(_0x5a63b4['query'][_0x00ed('0x3f')]){_0x463093[_0x00ed('0x3c')]=_[_0x00ed('0x40')](_0x463093[_0x00ed('0x3c')],{'$or':_[_0x00ed('0x2f')](_0x463093[_0x00ed('0x36')],function(_0x21f830){var _0x5a0232={};_0x5a0232[_0x21f830]={'$like':'%'+_0x5a63b4[_0x00ed('0x34')][_0x00ed('0x3f')]+'%'};return _0x5a0232;})});}_0x463093=_['merge']({},_0x463093,_0x5a63b4[_0x00ed('0x43')]);return db['UserOpenchannelQueue'][_0x00ed('0x46')](_0x463093);}})[_0x00ed('0x25')](function(_0x472f5c){if(_0x472f5c){return db[_0x00ed('0x59')]['findAndCountAll']({'where':{'id':_[_0x00ed('0x2f')](_0x472f5c,'UserId'),'role':'agent'},'attributes':['id','name',_0x00ed('0x5a'),_0x00ed('0x5b'),_0x00ed('0x5c')]});}})[_0x00ed('0x25')](function(_0xa7163f){if(_0xa7163f){return{'count':_0xa7163f[_0x00ed('0x1f')],'rows':_[_0x00ed('0x2f')](_0xa7163f['rows'],function(_0x3d974a){return{'membername':_0x3d974a[_0x00ed('0x2d')],'UserId':_0x3d974a['id'],'queue_name':_0x2205c3[_0x00ed('0x2d')],'OpenchannelQueueId':_0x2205c3['id'],'interface':util[_0x00ed('0x5d')](_0x00ed('0x5e'),_0x00ed('0x5f'),_0x3d974a[_0x00ed('0x2d')]),'penalty':0x0,'paused':_0x3d974a[_0x00ed('0x5a')],'createdAt':_0x3d974a[_0x00ed('0x5c')],'updatedAt':_0x3d974a[_0x00ed('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x475908,_0x463093))['catch'](handleError(_0x475908,null));};exports['getTeams']=function(_0x6314ec,_0x56c31a,_0xb203ec){var _0x5b9f1b={};var _0x5ac5f6={};var _0x5e79b5;var _0x282907;return db[_0x00ed('0x30')]['findOne']({'where':{'id':_0x6314ec[_0x00ed('0x53')]['id']}})[_0x00ed('0x25')](handleEntityNotFound(_0x56c31a,null))[_0x00ed('0x25')](function(_0x4bb4f6){if(_0x4bb4f6){_0x5e79b5=_0x4bb4f6;_0x5ac5f6['model']=_[_0x00ed('0x35')](db[_0x00ed('0x60')][_0x00ed('0x31')]);_0x5ac5f6[_0x00ed('0x34')]=_[_0x00ed('0x35')](_0x6314ec['query']);_0x5ac5f6[_0x00ed('0x3e')]=_[_0x00ed('0x57')](_0x5ac5f6[_0x00ed('0x33')],_0x5ac5f6['query']);_0x5b9f1b[_0x00ed('0x36')]=_[_0x00ed('0x57')](_0x5ac5f6[_0x00ed('0x33')],qs['fields'](_0x6314ec[_0x00ed('0x34')][_0x00ed('0x37')]));_0x5b9f1b[_0x00ed('0x36')]=_0x5b9f1b[_0x00ed('0x36')][_0x00ed('0x38')]?_0x5b9f1b[_0x00ed('0x36')]:_0x5ac5f6[_0x00ed('0x33')];_0x5b9f1b[_0x00ed('0x3a')]=qs['sort'](_0x6314ec[_0x00ed('0x34')][_0x00ed('0x3b')]);_0x5b9f1b[_0x00ed('0x3c')]=qs[_0x00ed('0x3e')](_['pick'](_0x6314ec['query'],_0x5ac5f6[_0x00ed('0x3e')]));if(_0x6314ec[_0x00ed('0x34')][_0x00ed('0x3f')]){_0x5b9f1b[_0x00ed('0x3c')]=_[_0x00ed('0x40')](_0x5b9f1b[_0x00ed('0x3c')],{'$or':_[_0x00ed('0x2f')](_0x5b9f1b[_0x00ed('0x36')],function(_0x507e7e){var _0x4b7938={};_0x4b7938[_0x507e7e]={'$like':'%'+_0x6314ec['query'][_0x00ed('0x3f')]+'%'};return _0x4b7938;})});}_0x5b9f1b=_['merge']({},_0x5b9f1b,_0x6314ec[_0x00ed('0x43')]);return _0x5e79b5[_0x00ed('0x61')](_0x5b9f1b);}})[_0x00ed('0x25')](function(_0x2a1e88){if(_0x2a1e88){_0x282907=_0x2a1e88['length'];if(!_0x6314ec[_0x00ed('0x34')][_0x00ed('0x58')](_0x00ed('0x39'))){_0x5b9f1b[_0x00ed('0x20')]=qs[_0x00ed('0x20')](_0x6314ec['query'][_0x00ed('0x20')]);_0x5b9f1b[_0x00ed('0x1d')]=qs[_0x00ed('0x1d')](_0x6314ec['query'][_0x00ed('0x1d')]);}return _0x5e79b5['getTeams'](_0x5b9f1b);}})[_0x00ed('0x25')](function(_0x51bc03){if(_0x51bc03){return _0x51bc03?{'count':_0x282907,'rows':_0x51bc03}:null;}})[_0x00ed('0x25')](respondWithResult(_0x56c31a,null))[_0x00ed('0x48')](handleError(_0x56c31a,null));};exports[_0x00ed('0x62')]=function(_0x3ad5ff,_0x1bf053,_0x3565b3){var _0x34fdd8=_0x3ad5ff['body'][_0x00ed('0x63')];return db[_0x00ed('0x60')][_0x00ed('0x46')]({'where':{'id':_0x34fdd8},'attributes':['id'],'include':[{'model':db[_0x00ed('0x59')],'as':_0x00ed('0x64'),'attributes':['id','name',_0x00ed('0x65'),_0x00ed('0x66'),'interface'],'raw':!![]}]})[_0x00ed('0x25')](function(_0x5391d4){if(_0x5391d4){var _0x412d1e=_['flatMap'](_0x5391d4,function(_0x4b2916){var _0xfd7cd0=_0x4b2916[_0x00ed('0x26')]({'plain':!![]});return _0xfd7cd0['Agents'];});return db[_0x00ed('0x30')]['find']({'where':{'id':_0x3ad5ff[_0x00ed('0x53')]['id']}})[_0x00ed('0x25')](function(_0x5bbea2){return db[_0x00ed('0x67')][_0x00ed('0x68')](function(_0x1a8448){return _0x5bbea2[_0x00ed('0x62')](_0x34fdd8,{'transaction':_0x1a8448})[_0x00ed('0x25')](function(){return BPromise[_0x00ed('0x69')](_0x412d1e,function(_0x273860){return db[_0x00ed('0x56')][_0x00ed('0x6a')]({'where':{'UserId':_0x273860['id'],'OpenchannelQueueId':_0x3ad5ff[_0x00ed('0x53')]['id']},'transaction':_0x1a8448});});})[_0x00ed('0x25')](function(){_0x412d1e[_0x00ed('0x6b')](function(_0x4bd242){socket[_0x00ed('0x6c')](_0x00ed('0x6d'),{'UserId':_0x4bd242['id'],'OpenchannelQueueId':_0x5bbea2['id']});});});});});}})[_0x00ed('0x25')](respondWithStatusCode(_0x1bf053,null))[_0x00ed('0x48')](handleError(_0x1bf053,null));};exports[_0x00ed('0x6e')]=function(_0x19b021,_0x3556ea,_0x2efecb){return db['Team']['findAll']({'where':{'id':_0x19b021[_0x00ed('0x34')][_0x00ed('0x63')]},'attributes':['id'],'include':[{'model':db[_0x00ed('0x59')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x00ed('0x25')](handleEntityNotFound(_0x3556ea,null))[_0x00ed('0x25')](function(_0x37ca7d){var _0x31470e=_[_0x00ed('0x2f')](_0x37ca7d,'id');var _0x1a1300=[];var _0x48d7e9=[];var _0x12a118=squel[_0x00ed('0x6f')]();_0x12a118[_0x00ed('0x70')](_0x00ed('0x71'))[_0x00ed('0x72')]('team_has_openchannel_queues','tq')[_0x00ed('0x73')](_0x00ed('0x74'),'ut',_0x00ed('0x75'))['where'](_0x00ed('0x76'),_0x19b021[_0x00ed('0x53')]['id']);for(var _0x40df02=0x0;_0x40df02<_0x37ca7d[_0x00ed('0x38')];_0x40df02+=0x1){let _0x57109c=_0x37ca7d[_0x40df02];for(var _0x585bb5=0x0;_0x585bb5<_0x57109c['Agents']['length'];_0x585bb5+=0x1){let _0x9ae13b=_0x57109c[_0x00ed('0x64')][_0x585bb5];var _0x4f9eac=_0x12a118['clone']();_0x4f9eac['where'](_0x00ed('0x77'),_0x9ae13b['id']);_0x48d7e9[_0x00ed('0x78')](db[_0x00ed('0x67')][_0x00ed('0x34')](_0x4f9eac[_0x00ed('0x79')](),{'type':db['sequelize'][_0x00ed('0x7a')]['SELECT']})[_0x00ed('0x25')](function(_0x21e8bc){if(_0x21e8bc['length']===0x1){return _0x9ae13b['id'];}else{var _0x51bd69=_[_0x00ed('0x7b')](_[_0x00ed('0x2f')](_0x21e8bc,_0x00ed('0x7c')),function(_0x2ebe14){return _[_0x00ed('0x7d')](_0x31470e,_0x2ebe14);});if(_0x51bd69){return _0x9ae13b['id'];}}}));}}return BPromise[_0x00ed('0x7e')](_0x48d7e9)[_0x00ed('0x25')](function(_0x1ace21){_0x1a1300=_(_0x1a1300)[_0x00ed('0x7f')](_0x1ace21)['compact']()[_0x00ed('0x80')]();return db[_0x00ed('0x30')][_0x00ed('0x4a')]({'where':{'id':_0x19b021[_0x00ed('0x53')]['id']}})[_0x00ed('0x25')](function(_0x2cdd7a){return db[_0x00ed('0x67')]['transaction'](function(_0x343176){return _0x2cdd7a['removeTeams'](_0x19b021['query'][_0x00ed('0x63')],{'transaction':_0x343176})[_0x00ed('0x25')](function(){if(!_[_0x00ed('0x81')](_0x1a1300)){return _0x2cdd7a['removeAgents'](_0x1a1300,{'transaction':_0x343176});}})[_0x00ed('0x25')](function(){_0x1a1300['forEach'](function(_0x244765){socket[_0x00ed('0x6c')]('userOpenchannelQueue:remove',{'UserId':_0x244765,'OpenchannelQueueId':_0x2cdd7a['id']});});});});});});})[_0x00ed('0x25')](respondWithStatusCode(_0x3556ea,null))[_0x00ed('0x48')](handleError(_0x3556ea,null));};exports['addAgents']=function(_0x2708e7,_0x48c50f,_0x141dad){return db['OpenchannelQueue'][_0x00ed('0x4a')]({'where':{'id':_0x2708e7[_0x00ed('0x53')]['id']}})[_0x00ed('0x25')](handleEntityNotFound(_0x48c50f,null))[_0x00ed('0x25')](function(_0x34cab8){if(_0x34cab8){return _0x34cab8[_0x00ed('0x82')](_0x2708e7[_0x00ed('0x4c')][_0x00ed('0x63')],_[_0x00ed('0x83')](_0x2708e7[_0x00ed('0x4c')],[_0x00ed('0x63'),'id'])||{})[_0x00ed('0x84')](function(_0x384d35){for(var _0xf6f1bf=0x0;_0xf6f1bf<_0x2708e7[_0x00ed('0x4c')][_0x00ed('0x63')][_0x00ed('0x38')];_0xf6f1bf+=0x1){socket['emit'](_0x00ed('0x6d'),{'UserId':Number(_0x2708e7[_0x00ed('0x4c')][_0x00ed('0x63')][_0xf6f1bf]),'OpenchannelQueueId':Number(_0x2708e7[_0x00ed('0x53')]['id'])});}return _0x384d35;});}})['then'](respondWithResult(_0x48c50f,null))[_0x00ed('0x48')](handleError(_0x48c50f,null));};exports['removeAgents']=function(_0x24d269,_0x328b8e,_0x451f8f){return db['OpenchannelQueue'][_0x00ed('0x4a')]({'where':{'id':_0x24d269[_0x00ed('0x53')]['id']}})[_0x00ed('0x25')](handleEntityNotFound(_0x328b8e,null))[_0x00ed('0x25')](function(_0x37180d){if(_0x37180d){return _0x37180d[_0x00ed('0x85')](_0x24d269[_0x00ed('0x34')][_0x00ed('0x63')])[_0x00ed('0x25')](function(){if(_[_0x00ed('0x86')](_0x24d269[_0x00ed('0x34')][_0x00ed('0x63')])){for(var _0x56796d=0x0;_0x56796d<_0x24d269[_0x00ed('0x34')][_0x00ed('0x63')][_0x00ed('0x38')];_0x56796d+=0x1){socket[_0x00ed('0x6c')]('userOpenchannelQueue:remove',{'UserId':Number(_0x24d269['query'][_0x00ed('0x63')][_0x56796d]),'OpenchannelQueueId':Number(_0x24d269[_0x00ed('0x53')]['id'])});}}else{socket[_0x00ed('0x6c')]('userOpenchannelQueue:remove',{'UserId':Number(_0x24d269[_0x00ed('0x34')][_0x00ed('0x63')]),'OpenchannelQueueId':Number(_0x24d269[_0x00ed('0x53')]['id'])});}});}})['then'](respondWithStatusCode(_0x328b8e,null))[_0x00ed('0x48')](handleError(_0x328b8e,null));};exports[_0x00ed('0x87')]=function(_0x20685d,_0x517615,_0x1d0f8e){var _0x2e8d5c={};var _0x3aa02b={};var _0x47bd30;var _0x208640;return db[_0x00ed('0x30')][_0x00ed('0x55')]({'where':{'id':_0x20685d['params']['id']}})[_0x00ed('0x25')](handleEntityNotFound(_0x517615,null))[_0x00ed('0x25')](function(_0x1b2440){if(_0x1b2440){_0x47bd30=_0x1b2440;_0x3aa02b[_0x00ed('0x33')]=_['keys'](db[_0x00ed('0x59')][_0x00ed('0x31')]);_0x3aa02b[_0x00ed('0x34')]=_['keys'](_0x20685d[_0x00ed('0x34')]);_0x3aa02b[_0x00ed('0x3e')]=_[_0x00ed('0x57')](_0x3aa02b[_0x00ed('0x33')],_0x3aa02b[_0x00ed('0x34')]);_0x2e8d5c[_0x00ed('0x36')]=_[_0x00ed('0x57')](_0x3aa02b[_0x00ed('0x33')],qs['fields'](_0x20685d['query'][_0x00ed('0x37')]));_0x2e8d5c[_0x00ed('0x36')]=_0x2e8d5c[_0x00ed('0x36')]['length']?_0x2e8d5c[_0x00ed('0x36')]:_0x3aa02b['model'];_0x2e8d5c['order']=qs['sort'](_0x20685d[_0x00ed('0x34')][_0x00ed('0x3b')]);_0x2e8d5c[_0x00ed('0x3c')]=qs['filters'](_['pick'](_0x20685d['query'],_0x3aa02b[_0x00ed('0x3e')]));if(_0x20685d[_0x00ed('0x34')]['filter']){_0x2e8d5c[_0x00ed('0x3c')]=_[_0x00ed('0x40')](_0x2e8d5c['where'],{'$or':_[_0x00ed('0x2f')](_0x2e8d5c[_0x00ed('0x36')],function(_0x2125aa){var _0x6d2800={};_0x6d2800[_0x2125aa]={'$like':'%'+_0x20685d[_0x00ed('0x34')][_0x00ed('0x3f')]+'%'};return _0x6d2800;})});}_0x2e8d5c=_[_0x00ed('0x40')]({},_0x2e8d5c,_0x20685d[_0x00ed('0x43')]);return _0x47bd30[_0x00ed('0x87')](_0x2e8d5c);}})['then'](function(_0x390e36){if(_0x390e36){_0x208640=_0x390e36[_0x00ed('0x38')];if(!_0x20685d['query'][_0x00ed('0x58')](_0x00ed('0x39'))){_0x2e8d5c[_0x00ed('0x20')]=qs[_0x00ed('0x20')](_0x20685d[_0x00ed('0x34')]['limit']);_0x2e8d5c['offset']=qs[_0x00ed('0x1d')](_0x20685d[_0x00ed('0x34')][_0x00ed('0x1d')]);}return _0x47bd30[_0x00ed('0x87')](_0x2e8d5c);}})[_0x00ed('0x25')](function(_0x2de668){if(_0x2de668){return _0x2de668?{'count':_0x208640,'rows':_0x2de668}:null;}})[_0x00ed('0x25')](respondWithResult(_0x517615,null))[_0x00ed('0x48')](handleError(_0x517615,null));}; \ No newline at end of file +var _0x6554=['util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./openchannelQueue.socket','register','status','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','end','sendStatus','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','include','rows','catch','show','intersection','find','create','user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','findOne','UserOpenchannelQueue','order','OpenchannelQueueId','findAll','findAndCountAll','UserId','openchannelPause','updatedAt','createdAt','format','SIP','getTeams','Team','User','Agents','online','voicePause','interface','transaction','addTeams','each','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','TeamId','all','compact','value','ids','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','spread','pick','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird'];(function(_0x3c1f9f,_0x4c7622){var _0xb8eb6b=function(_0x1dd611){while(--_0x1dd611){_0x3c1f9f['push'](_0x3c1f9f['shift']());}};_0xb8eb6b(++_0x4c7622);}(_0x6554,0x85));var _0x4655=function(_0x334c32,_0x40a65d){_0x334c32=_0x334c32-0x0;var _0x2985a4=_0x6554[_0x334c32];return _0x2985a4;};'use strict';var emlformat=require(_0x4655('0x0'));var rimraf=require(_0x4655('0x1'));var zipdir=require(_0x4655('0x2'));var jsonpatch=require(_0x4655('0x3'));var rp=require(_0x4655('0x4'));var moment=require('moment');var BPromise=require(_0x4655('0x5'));var Mustache=require('mustache');var util=require(_0x4655('0x6'));var path=require(_0x4655('0x7'));var sox=require('sox');var csv=require(_0x4655('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4655('0x9'));var squel=require(_0x4655('0xa'));var crypto=require(_0x4655('0xb'));var jsforce=require(_0x4655('0xc'));var deskjs=require(_0x4655('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4655('0xe'));var Papa=require(_0x4655('0xf'));var Redis=require(_0x4655('0x10'));var authService=require(_0x4655('0x11'));var qs=require(_0x4655('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4655('0x13'))(_0x4655('0x14'));var utils=require(_0x4655('0x15'));var config=require(_0x4655('0x16'));var licenseUtil=require(_0x4655('0x17'));var db=require(_0x4655('0x18'))['db'];config['redis']=_[_0x4655('0x19')](config[_0x4655('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x4655('0x1b'))(new Redis(config['redis']));require(_0x4655('0x1c'))[_0x4655('0x1d')](socket);function respondWithStatusCode(_0x24d9a5,_0x529428){_0x529428=_0x529428||0xcc;return function(_0x1feb9d){if(_0x1feb9d){return _0x24d9a5['sendStatus'](_0x529428);}return _0x24d9a5[_0x4655('0x1e')](_0x529428)['end']();};}function respondWithResult(_0x25a2a6,_0x356603){_0x356603=_0x356603||0xc8;return function(_0x63c054){if(_0x63c054){return _0x25a2a6[_0x4655('0x1e')](_0x356603)[_0x4655('0x1f')](_0x63c054);}};}function respondWithFilteredResult(_0xa87862,_0x20b49b){return function(_0x5217f6){if(_0x5217f6){var _0x5e2311=typeof _0x20b49b[_0x4655('0x20')]===_0x4655('0x21')&&typeof _0x20b49b['limit']===_0x4655('0x21');var _0x1dad27=_0x5217f6[_0x4655('0x22')];var _0x5bd72f=_0x5e2311?0x0:_0x20b49b[_0x4655('0x20')];var _0x335623=_0x5e2311?_0x5217f6[_0x4655('0x22')]:_0x20b49b[_0x4655('0x20')]+_0x20b49b[_0x4655('0x23')];var _0x3d6f01;if(_0x335623>=_0x1dad27){_0x335623=_0x1dad27;_0x3d6f01=0xc8;}else{_0x3d6f01=0xce;}_0xa87862[_0x4655('0x1e')](_0x3d6f01);return _0xa87862[_0x4655('0x24')]('Content-Range',_0x5bd72f+'-'+_0x335623+'/'+_0x1dad27)[_0x4655('0x1f')](_0x5217f6);}return null;};}function patchUpdates(_0x209e4b){return function(_0x44232e){try{jsonpatch[_0x4655('0x25')](_0x44232e,_0x209e4b,!![]);}catch(_0x6233c2){return BPromise['reject'](_0x6233c2);}return _0x44232e[_0x4655('0x26')]();};}function saveUpdates(_0x52106f,_0x4f9319){return function(_0x1c5e06){if(_0x1c5e06){return _0x1c5e06[_0x4655('0x27')](_0x52106f)[_0x4655('0x28')](function(_0x44ae5c){return _0x44ae5c;});}return null;};}function removeEntity(_0x55d8a3,_0x444365){return function(_0x12165e){if(_0x12165e){return _0x12165e[_0x4655('0x29')]()[_0x4655('0x28')](function(){var _0x3ab3e7=_0x12165e[_0x4655('0x2a')]({'plain':!![]});var _0x14246b=_0x4655('0x2b');return db[_0x4655('0x2c')]['destroy']({'where':{'type':_0x14246b,'resourceId':_0x3ab3e7['id']}})[_0x4655('0x28')](function(){return _0x12165e;});})[_0x4655('0x28')](function(){_0x55d8a3[_0x4655('0x1e')](0xcc)[_0x4655('0x2d')]();});}};}function handleEntityNotFound(_0x35b901,_0x490268){return function(_0x2087ed){if(!_0x2087ed){_0x35b901[_0x4655('0x2e')](0x194);}return _0x2087ed;};}function handleError(_0x552b27,_0x15fdc6){_0x15fdc6=_0x15fdc6||0x1f4;return function(_0x140bab){logger['error'](_0x140bab['stack']);if(_0x140bab[_0x4655('0x2f')]){delete _0x140bab[_0x4655('0x2f')];}_0x552b27[_0x4655('0x1e')](_0x15fdc6)[_0x4655('0x30')](_0x140bab);};}exports[_0x4655('0x31')]=function(_0x368e06,_0x3a244b){var _0x1608e8={},_0x509d1c={},_0x5abe10={'count':0x0,'rows':[]};var _0xec8f88=_[_0x4655('0x32')](db[_0x4655('0x33')][_0x4655('0x34')],function(_0x579ba6){return{'name':_0x579ba6[_0x4655('0x35')],'type':_0x579ba6[_0x4655('0x36')][_0x4655('0x37')]};});_0x509d1c[_0x4655('0x38')]=_[_0x4655('0x32')](_0xec8f88,_0x4655('0x2f'));_0x509d1c[_0x4655('0x39')]=_[_0x4655('0x3a')](_0x368e06[_0x4655('0x39')]);_0x509d1c[_0x4655('0x3b')]=_['intersection'](_0x509d1c[_0x4655('0x38')],_0x509d1c[_0x4655('0x39')]);_0x1608e8[_0x4655('0x3c')]=_['intersection'](_0x509d1c['model'],qs[_0x4655('0x3d')](_0x368e06[_0x4655('0x39')]['fields']));_0x1608e8['attributes']=_0x1608e8[_0x4655('0x3c')][_0x4655('0x3e')]?_0x1608e8[_0x4655('0x3c')]:_0x509d1c[_0x4655('0x38')];if(!_0x368e06[_0x4655('0x39')][_0x4655('0x3f')](_0x4655('0x40'))){_0x1608e8[_0x4655('0x23')]=qs[_0x4655('0x23')](_0x368e06[_0x4655('0x39')][_0x4655('0x23')]);_0x1608e8[_0x4655('0x20')]=qs[_0x4655('0x20')](_0x368e06[_0x4655('0x39')][_0x4655('0x20')]);}_0x1608e8['order']=qs[_0x4655('0x41')](_0x368e06[_0x4655('0x39')]['sort']);_0x1608e8[_0x4655('0x42')]=qs['filters'](_['pick'](_0x368e06[_0x4655('0x39')],_0x509d1c[_0x4655('0x3b')]),_0xec8f88);if(_0x368e06[_0x4655('0x39')][_0x4655('0x43')]){_0x1608e8['where']=_[_0x4655('0x44')](_0x1608e8[_0x4655('0x42')],{'$or':_[_0x4655('0x32')](_0xec8f88,function(_0x35964e){if(_0x35964e[_0x4655('0x36')]!=='VIRTUAL'){var _0x46721b={};_0x46721b[_0x35964e[_0x4655('0x2f')]]={'$like':'%'+_0x368e06[_0x4655('0x39')][_0x4655('0x43')]+'%'};return _0x46721b;}})});}_0x1608e8=_[_0x4655('0x44')]({},_0x1608e8,_0x368e06[_0x4655('0x45')]);var _0x3902a6={'where':_0x1608e8['where']};return db['OpenchannelQueue']['count'](_0x3902a6)['then'](function(_0x113d71){_0x5abe10[_0x4655('0x22')]=_0x113d71;if(_0x368e06[_0x4655('0x39')][_0x4655('0x46')]){_0x1608e8[_0x4655('0x47')]=[{'all':!![]}];}return db['OpenchannelQueue']['findAll'](_0x1608e8);})[_0x4655('0x28')](function(_0x31e1b0){_0x5abe10[_0x4655('0x48')]=_0x31e1b0;return _0x5abe10;})[_0x4655('0x28')](respondWithFilteredResult(_0x3a244b,_0x1608e8))[_0x4655('0x49')](handleError(_0x3a244b,null));};exports[_0x4655('0x4a')]=function(_0x5f0d2e,_0x3bb0cb){var _0x374bba={'raw':!![],'where':{'id':_0x5f0d2e['params']['id']}},_0x552c4d={};_0x552c4d['model']=_[_0x4655('0x3a')](db['OpenchannelQueue']['rawAttributes']);_0x552c4d[_0x4655('0x39')]=_[_0x4655('0x3a')](_0x5f0d2e[_0x4655('0x39')]);_0x552c4d[_0x4655('0x3b')]=_[_0x4655('0x4b')](_0x552c4d[_0x4655('0x38')],_0x552c4d[_0x4655('0x39')]);_0x374bba[_0x4655('0x3c')]=_[_0x4655('0x4b')](_0x552c4d[_0x4655('0x38')],qs[_0x4655('0x3d')](_0x5f0d2e[_0x4655('0x39')][_0x4655('0x3d')]));_0x374bba['attributes']=_0x374bba[_0x4655('0x3c')]['length']?_0x374bba[_0x4655('0x3c')]:_0x552c4d[_0x4655('0x38')];if(_0x5f0d2e['query'][_0x4655('0x46')]){_0x374bba[_0x4655('0x47')]=[{'all':!![]}];}_0x374bba=_['merge']({},_0x374bba,_0x5f0d2e[_0x4655('0x45')]);return db[_0x4655('0x33')][_0x4655('0x4c')](_0x374bba)[_0x4655('0x28')](handleEntityNotFound(_0x3bb0cb,null))[_0x4655('0x28')](respondWithResult(_0x3bb0cb,null))[_0x4655('0x49')](handleError(_0x3bb0cb,null));};exports[_0x4655('0x4d')]=function(_0x27776a,_0x5e867e){return db[_0x4655('0x33')]['create'](_0x27776a['body'],{})[_0x4655('0x28')](function(_0x439c8e){var _0x855e42=_0x27776a[_0x4655('0x4e')]['get']({'plain':!![]});if(!_0x855e42)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x855e42[_0x4655('0x4f')]===_0x4655('0x4e')){var _0x448e8f=_0x439c8e[_0x4655('0x2a')]({'plain':!![]});var _0x412d13=_0x4655('0x2b');return db['UserProfileSection'][_0x4655('0x4c')]({'where':{'name':_0x412d13,'userProfileId':_0x855e42['userProfileId']},'raw':!![]})[_0x4655('0x28')](function(_0x58e06c){if(_0x58e06c&&_0x58e06c[_0x4655('0x50')]===0x0){return db[_0x4655('0x2c')][_0x4655('0x4d')]({'name':_0x448e8f[_0x4655('0x2f')],'resourceId':_0x448e8f['id'],'type':_0x58e06c[_0x4655('0x2f')],'sectionId':_0x58e06c['id']},{})[_0x4655('0x28')](function(){return _0x439c8e;});}else{return _0x439c8e;}})[_0x4655('0x49')](function(_0x208504){logger['error'](_0x4655('0x51'),_0x208504);throw _0x208504;});}return _0x439c8e;})[_0x4655('0x28')](respondWithResult(_0x5e867e,0xc9))[_0x4655('0x49')](handleError(_0x5e867e,null));};exports['update']=function(_0x32e95a,_0x326654){if(_0x32e95a[_0x4655('0x52')]['id']){delete _0x32e95a[_0x4655('0x52')]['id'];}return db[_0x4655('0x33')][_0x4655('0x4c')]({'where':{'id':_0x32e95a[_0x4655('0x53')]['id']}})['then'](handleEntityNotFound(_0x326654,null))[_0x4655('0x28')](saveUpdates(_0x32e95a[_0x4655('0x52')],null))[_0x4655('0x28')](respondWithResult(_0x326654,null))[_0x4655('0x49')](handleError(_0x326654,null));};exports[_0x4655('0x29')]=function(_0x1b89b2,_0x416e4f){return db['OpenchannelQueue'][_0x4655('0x4c')]({'where':{'id':_0x1b89b2[_0x4655('0x53')]['id']}})['then'](handleEntityNotFound(_0x416e4f,null))[_0x4655('0x28')](removeEntity(_0x416e4f,null))[_0x4655('0x49')](handleError(_0x416e4f,null));};exports[_0x4655('0x54')]=function(_0x288b52,_0x31c1ec){return db['OpenchannelQueue'][_0x4655('0x54')]()[_0x4655('0x28')](respondWithResult(_0x31c1ec,null))[_0x4655('0x49')](handleError(_0x31c1ec,null));};exports['getMembers']=function(_0x209c21,_0x99c882,_0x416090){var _0x55b295={'raw':!![],'where':{}},_0xd2d22={},_0x33234a;return db[_0x4655('0x33')][_0x4655('0x55')]({'where':{'id':_0x209c21[_0x4655('0x53')]['id']}})[_0x4655('0x28')](handleEntityNotFound(_0x99c882,null))[_0x4655('0x28')](function(_0x512179){if(_0x512179){_0x33234a=_0x512179[_0x4655('0x2a')]({'plain':!![]});_0xd2d22[_0x4655('0x38')]=_[_0x4655('0x3a')](db[_0x4655('0x56')]['rawAttributes']);_0xd2d22[_0x4655('0x39')]=_[_0x4655('0x3a')](_0x209c21[_0x4655('0x39')]);_0xd2d22[_0x4655('0x3b')]=_[_0x4655('0x4b')](_0xd2d22[_0x4655('0x38')],_0xd2d22[_0x4655('0x39')]);_0x55b295['attributes']=_[_0x4655('0x4b')](_0xd2d22[_0x4655('0x38')],qs[_0x4655('0x3d')](_0x209c21['query'][_0x4655('0x3d')]));_0x55b295[_0x4655('0x3c')]=_0x55b295[_0x4655('0x3c')]['length']?_0x55b295[_0x4655('0x3c')]:_0xd2d22['model'];if(!_0x209c21[_0x4655('0x39')][_0x4655('0x3f')](_0x4655('0x40'))){_0x55b295[_0x4655('0x23')]=qs[_0x4655('0x23')](_0x209c21[_0x4655('0x39')][_0x4655('0x23')]);_0x55b295[_0x4655('0x20')]=qs[_0x4655('0x20')](_0x209c21[_0x4655('0x39')][_0x4655('0x20')]);}_0x55b295[_0x4655('0x57')]=qs[_0x4655('0x41')](_0x209c21[_0x4655('0x39')][_0x4655('0x41')]);_0x55b295[_0x4655('0x42')]=qs[_0x4655('0x3b')](_['pick'](_0x209c21[_0x4655('0x39')],_0xd2d22[_0x4655('0x3b')]));_0x55b295['where'][_0x4655('0x58')]=_0x512179['id'];if(_0x209c21[_0x4655('0x39')][_0x4655('0x43')]){_0x55b295[_0x4655('0x42')]=_['merge'](_0x55b295[_0x4655('0x42')],{'$or':_['map'](_0x55b295[_0x4655('0x3c')],function(_0x504192){var _0xb17d95={};_0xb17d95[_0x504192]={'$like':'%'+_0x209c21[_0x4655('0x39')][_0x4655('0x43')]+'%'};return _0xb17d95;})});}_0x55b295=_[_0x4655('0x44')]({},_0x55b295,_0x209c21['options']);return db[_0x4655('0x56')][_0x4655('0x59')](_0x55b295);}})['then'](function(_0x54df92){if(_0x54df92){return db['User'][_0x4655('0x5a')]({'where':{'id':_[_0x4655('0x32')](_0x54df92,_0x4655('0x5b')),'role':'agent'},'attributes':['id',_0x4655('0x2f'),_0x4655('0x5c'),_0x4655('0x5d'),_0x4655('0x5e')]});}})[_0x4655('0x28')](function(_0x2db786){if(_0x2db786){return{'count':_0x2db786['count'],'rows':_[_0x4655('0x32')](_0x2db786[_0x4655('0x48')],function(_0x46e52c){return{'membername':_0x46e52c[_0x4655('0x2f')],'UserId':_0x46e52c['id'],'queue_name':_0x33234a['name'],'OpenchannelQueueId':_0x33234a['id'],'interface':util[_0x4655('0x5f')]('%s/%s',_0x4655('0x60'),_0x46e52c[_0x4655('0x2f')]),'penalty':0x0,'paused':_0x46e52c[_0x4655('0x5c')],'createdAt':_0x46e52c['createdAt'],'updatedAt':_0x46e52c[_0x4655('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4655('0x28')](respondWithFilteredResult(_0x99c882,_0x55b295))['catch'](handleError(_0x99c882,null));};exports[_0x4655('0x61')]=function(_0x74046e,_0x5d43c9,_0xe74077){var _0xad886a={};var _0x2e505e={};var _0xaf86bc;var _0x212430;return db['OpenchannelQueue'][_0x4655('0x55')]({'where':{'id':_0x74046e[_0x4655('0x53')]['id']}})['then'](handleEntityNotFound(_0x5d43c9,null))[_0x4655('0x28')](function(_0x24c629){if(_0x24c629){_0xaf86bc=_0x24c629;_0x2e505e[_0x4655('0x38')]=_[_0x4655('0x3a')](db[_0x4655('0x62')][_0x4655('0x34')]);_0x2e505e[_0x4655('0x39')]=_[_0x4655('0x3a')](_0x74046e[_0x4655('0x39')]);_0x2e505e['filters']=_[_0x4655('0x4b')](_0x2e505e[_0x4655('0x38')],_0x2e505e['query']);_0xad886a[_0x4655('0x3c')]=_['intersection'](_0x2e505e[_0x4655('0x38')],qs[_0x4655('0x3d')](_0x74046e[_0x4655('0x39')]['fields']));_0xad886a[_0x4655('0x3c')]=_0xad886a['attributes'][_0x4655('0x3e')]?_0xad886a[_0x4655('0x3c')]:_0x2e505e[_0x4655('0x38')];_0xad886a[_0x4655('0x57')]=qs[_0x4655('0x41')](_0x74046e[_0x4655('0x39')][_0x4655('0x41')]);_0xad886a[_0x4655('0x42')]=qs[_0x4655('0x3b')](_['pick'](_0x74046e[_0x4655('0x39')],_0x2e505e[_0x4655('0x3b')]));if(_0x74046e[_0x4655('0x39')][_0x4655('0x43')]){_0xad886a[_0x4655('0x42')]=_['merge'](_0xad886a[_0x4655('0x42')],{'$or':_[_0x4655('0x32')](_0xad886a['attributes'],function(_0x318114){var _0x1eef0a={};_0x1eef0a[_0x318114]={'$like':'%'+_0x74046e['query'][_0x4655('0x43')]+'%'};return _0x1eef0a;})});}_0xad886a=_[_0x4655('0x44')]({},_0xad886a,_0x74046e[_0x4655('0x45')]);return _0xaf86bc[_0x4655('0x61')](_0xad886a);}})[_0x4655('0x28')](function(_0x5dec66){if(_0x5dec66){_0x212430=_0x5dec66['length'];if(!_0x74046e[_0x4655('0x39')]['hasOwnProperty'](_0x4655('0x40'))){_0xad886a['limit']=qs['limit'](_0x74046e[_0x4655('0x39')]['limit']);_0xad886a[_0x4655('0x20')]=qs[_0x4655('0x20')](_0x74046e['query'][_0x4655('0x20')]);}return _0xaf86bc[_0x4655('0x61')](_0xad886a);}})[_0x4655('0x28')](function(_0x9ab59f){if(_0x9ab59f){return _0x9ab59f?{'count':_0x212430,'rows':_0x9ab59f}:null;}})[_0x4655('0x28')](respondWithResult(_0x5d43c9,null))[_0x4655('0x49')](handleError(_0x5d43c9,null));};exports['addTeams']=function(_0x98046e,_0x435684,_0xfeb878){var _0x4ea7c2=_0x98046e[_0x4655('0x52')]['ids'];return db['Team']['findAll']({'where':{'id':_0x4ea7c2},'attributes':['id'],'include':[{'model':db[_0x4655('0x63')],'as':_0x4655('0x64'),'attributes':['id',_0x4655('0x2f'),_0x4655('0x65'),_0x4655('0x66'),_0x4655('0x67')],'raw':!![]}]})['then'](function(_0x510a3a){if(_0x510a3a){var _0x4327dd=_['flatMap'](_0x510a3a,function(_0x50a19f){var _0x1a2cd5=_0x50a19f['get']({'plain':!![]});return _0x1a2cd5[_0x4655('0x64')];});return db[_0x4655('0x33')][_0x4655('0x4c')]({'where':{'id':_0x98046e[_0x4655('0x53')]['id']}})['then'](function(_0x71050c){return db['sequelize'][_0x4655('0x68')](function(_0x451ece){return _0x71050c[_0x4655('0x69')](_0x4ea7c2,{'transaction':_0x451ece})[_0x4655('0x28')](function(){return BPromise[_0x4655('0x6a')](_0x4327dd,function(_0x3c89d3){return db['UserOpenchannelQueue']['findOrCreate']({'where':{'UserId':_0x3c89d3['id'],'OpenchannelQueueId':_0x98046e['params']['id']},'transaction':_0x451ece});});})['then'](function(){_0x4327dd[_0x4655('0x6b')](function(_0x4c29c9){socket[_0x4655('0x6c')](_0x4655('0x6d'),{'UserId':_0x4c29c9['id'],'OpenchannelQueueId':_0x71050c['id']});});});});});}})[_0x4655('0x28')](respondWithStatusCode(_0x435684,null))[_0x4655('0x49')](handleError(_0x435684,null));};exports[_0x4655('0x6e')]=function(_0x43dda2,_0x14226c,_0x24dfd5){return db[_0x4655('0x62')][_0x4655('0x59')]({'where':{'id':_0x43dda2[_0x4655('0x39')]['ids']},'attributes':['id'],'include':[{'model':db[_0x4655('0x63')],'as':_0x4655('0x64'),'attributes':['id'],'raw':!![]}]})[_0x4655('0x28')](handleEntityNotFound(_0x14226c,null))[_0x4655('0x28')](function(_0x4c6fa7){var _0x5f5772=_[_0x4655('0x32')](_0x4c6fa7,'id');var _0x71296a=[];var _0x42298c=[];var _0x34aa98=squel[_0x4655('0x6f')]();_0x34aa98[_0x4655('0x70')](_0x4655('0x71'))[_0x4655('0x72')](_0x4655('0x73'),'tq')[_0x4655('0x74')](_0x4655('0x75'),'ut',_0x4655('0x76'))['where'](_0x4655('0x77'),_0x43dda2['params']['id']);for(var _0x28582f=0x0;_0x28582f<_0x4c6fa7['length'];_0x28582f+=0x1){let _0xd1c5b6=_0x4c6fa7[_0x28582f];for(var _0x19c9f3=0x0;_0x19c9f3<_0xd1c5b6[_0x4655('0x64')][_0x4655('0x3e')];_0x19c9f3+=0x1){let _0x58910d=_0xd1c5b6[_0x4655('0x64')][_0x19c9f3];var _0x3c3fde=_0x34aa98[_0x4655('0x78')]();_0x3c3fde['where'](_0x4655('0x79'),_0x58910d['id']);_0x42298c[_0x4655('0x7a')](db[_0x4655('0x7b')]['query'](_0x3c3fde['toString'](),{'type':db['sequelize'][_0x4655('0x7c')][_0x4655('0x7d')]})[_0x4655('0x28')](function(_0x5c34ed){if(_0x5c34ed[_0x4655('0x3e')]===0x1){return _0x58910d['id'];}else{var _0x17fa5d=_[_0x4655('0x7e')](_[_0x4655('0x32')](_0x5c34ed,_0x4655('0x7f')),function(_0x4078c9){return _['includes'](_0x5f5772,_0x4078c9);});if(_0x17fa5d){return _0x58910d['id'];}}}));}}return BPromise[_0x4655('0x80')](_0x42298c)[_0x4655('0x28')](function(_0x1d642d){_0x71296a=_(_0x71296a)['union'](_0x1d642d)[_0x4655('0x81')]()[_0x4655('0x82')]();return db[_0x4655('0x33')][_0x4655('0x4c')]({'where':{'id':_0x43dda2['params']['id']}})['then'](function(_0x531225){return db[_0x4655('0x7b')][_0x4655('0x68')](function(_0x5173ad){return _0x531225[_0x4655('0x6e')](_0x43dda2[_0x4655('0x39')][_0x4655('0x83')],{'transaction':_0x5173ad})['then'](function(){if(!_[_0x4655('0x84')](_0x71296a)){return _0x531225[_0x4655('0x85')](_0x71296a,{'transaction':_0x5173ad});}})['then'](function(){_0x71296a[_0x4655('0x6b')](function(_0x3e7c1c){socket[_0x4655('0x6c')](_0x4655('0x86'),{'UserId':_0x3e7c1c,'OpenchannelQueueId':_0x531225['id']});});});});});});})['then'](respondWithStatusCode(_0x14226c,null))[_0x4655('0x49')](handleError(_0x14226c,null));};exports['addAgents']=function(_0x35d10e,_0x281a4f,_0x42f99f){return db[_0x4655('0x33')][_0x4655('0x4c')]({'where':{'id':_0x35d10e[_0x4655('0x53')]['id']}})[_0x4655('0x28')](handleEntityNotFound(_0x281a4f,null))[_0x4655('0x28')](function(_0x71df40){if(_0x71df40){return _0x71df40[_0x4655('0x87')](_0x35d10e[_0x4655('0x52')][_0x4655('0x83')],_['omit'](_0x35d10e[_0x4655('0x52')],[_0x4655('0x83'),'id'])||{})[_0x4655('0x88')](function(_0xab0040){for(var _0x7b8ff7=0x0;_0x7b8ff7<_0x35d10e[_0x4655('0x52')][_0x4655('0x83')]['length'];_0x7b8ff7+=0x1){socket[_0x4655('0x6c')](_0x4655('0x6d'),{'UserId':Number(_0x35d10e['body'][_0x4655('0x83')][_0x7b8ff7]),'OpenchannelQueueId':Number(_0x35d10e[_0x4655('0x53')]['id'])});}return _0xab0040;});}})['then'](respondWithResult(_0x281a4f,null))['catch'](handleError(_0x281a4f,null));};exports[_0x4655('0x85')]=function(_0x570f32,_0x3d4127,_0x37160a){return db[_0x4655('0x33')][_0x4655('0x4c')]({'where':{'id':_0x570f32['params']['id']}})['then'](handleEntityNotFound(_0x3d4127,null))[_0x4655('0x28')](function(_0x5983d1){if(_0x5983d1){return _0x5983d1[_0x4655('0x85')](_0x570f32[_0x4655('0x39')]['ids'])[_0x4655('0x28')](function(){if(_['isArray'](_0x570f32[_0x4655('0x39')][_0x4655('0x83')])){for(var _0x4c21d8=0x0;_0x4c21d8<_0x570f32[_0x4655('0x39')]['ids'][_0x4655('0x3e')];_0x4c21d8+=0x1){socket[_0x4655('0x6c')](_0x4655('0x86'),{'UserId':Number(_0x570f32['query'][_0x4655('0x83')][_0x4c21d8]),'OpenchannelQueueId':Number(_0x570f32[_0x4655('0x53')]['id'])});}}else{socket[_0x4655('0x6c')](_0x4655('0x86'),{'UserId':Number(_0x570f32[_0x4655('0x39')][_0x4655('0x83')]),'OpenchannelQueueId':Number(_0x570f32['params']['id'])});}});}})['then'](respondWithStatusCode(_0x3d4127,null))[_0x4655('0x49')](handleError(_0x3d4127,null));};exports['getAgents']=function(_0x1c038f,_0x271e5e,_0x5d3939){var _0x37c88a={};var _0x32c553={};var _0x241581;var _0x3fe2e5;return db[_0x4655('0x33')][_0x4655('0x55')]({'where':{'id':_0x1c038f[_0x4655('0x53')]['id']}})[_0x4655('0x28')](handleEntityNotFound(_0x271e5e,null))[_0x4655('0x28')](function(_0x6090b8){if(_0x6090b8){_0x241581=_0x6090b8;_0x32c553['model']=_['keys'](db['User'][_0x4655('0x34')]);_0x32c553['query']=_[_0x4655('0x3a')](_0x1c038f['query']);_0x32c553['filters']=_[_0x4655('0x4b')](_0x32c553['model'],_0x32c553[_0x4655('0x39')]);_0x37c88a[_0x4655('0x3c')]=_[_0x4655('0x4b')](_0x32c553[_0x4655('0x38')],qs['fields'](_0x1c038f[_0x4655('0x39')][_0x4655('0x3d')]));_0x37c88a['attributes']=_0x37c88a[_0x4655('0x3c')]['length']?_0x37c88a[_0x4655('0x3c')]:_0x32c553[_0x4655('0x38')];_0x37c88a[_0x4655('0x57')]=qs[_0x4655('0x41')](_0x1c038f['query'][_0x4655('0x41')]);_0x37c88a[_0x4655('0x42')]=qs[_0x4655('0x3b')](_[_0x4655('0x89')](_0x1c038f[_0x4655('0x39')],_0x32c553[_0x4655('0x3b')]));if(_0x1c038f[_0x4655('0x39')][_0x4655('0x43')]){_0x37c88a[_0x4655('0x42')]=_[_0x4655('0x44')](_0x37c88a[_0x4655('0x42')],{'$or':_['map'](_0x37c88a['attributes'],function(_0x2d9bec){var _0x2471e4={};_0x2471e4[_0x2d9bec]={'$like':'%'+_0x1c038f['query']['filter']+'%'};return _0x2471e4;})});}_0x37c88a=_[_0x4655('0x44')]({},_0x37c88a,_0x1c038f[_0x4655('0x45')]);return _0x241581['getAgents'](_0x37c88a);}})['then'](function(_0x417c41){if(_0x417c41){_0x3fe2e5=_0x417c41[_0x4655('0x3e')];if(!_0x1c038f[_0x4655('0x39')][_0x4655('0x3f')]('nolimit')){_0x37c88a['limit']=qs[_0x4655('0x23')](_0x1c038f[_0x4655('0x39')][_0x4655('0x23')]);_0x37c88a[_0x4655('0x20')]=qs[_0x4655('0x20')](_0x1c038f[_0x4655('0x39')][_0x4655('0x20')]);}return _0x241581[_0x4655('0x8a')](_0x37c88a);}})[_0x4655('0x28')](function(_0x337647){if(_0x337647){return _0x337647?{'count':_0x3fe2e5,'rows':_0x337647}:null;}})[_0x4655('0x28')](respondWithResult(_0x271e5e,null))[_0x4655('0x49')](handleError(_0x271e5e,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 86371e4..9568141 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 _0x74c9=['setMaxListeners','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x5e8c32,_0x1b1f3f){var _0x595f7b=function(_0x38840e){while(--_0x38840e){_0x5e8c32['push'](_0x5e8c32['shift']());}};_0x595f7b(++_0x1b1f3f);}(_0x74c9,0xd0));var _0x974c=function(_0x48ab48,_0x2f99d1){_0x48ab48=_0x48ab48-0x0;var _0x5e8487=_0x74c9[_0x48ab48];return _0x5e8487;};'use strict';var EventEmitter=require(_0x974c('0x0'));var OpenchannelQueue=require(_0x974c('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x974c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x974c('0x3')};function emitEvent(_0x19d64d){return function(_0x48cd3c,_0x3c63d0,_0x466553){OpenchannelQueueEvents[_0x974c('0x4')](_0x19d64d+':'+_0x48cd3c['id'],_0x48cd3c);OpenchannelQueueEvents[_0x974c('0x4')](_0x19d64d,_0x48cd3c);_0x466553(null);};}for(var e in events){if(events[_0x974c('0x5')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x974c('0x6')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xa0f6=['save','update','remove','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners'];(function(_0x15bf99,_0x4b20ec){var _0x23fe82=function(_0x220a14){while(--_0x220a14){_0x15bf99['push'](_0x15bf99['shift']());}};_0x23fe82(++_0x4b20ec);}(_0xa0f6,0x1e6));var _0x6a0f=function(_0x32a7c0,_0x5ec1b8){_0x32a7c0=_0x32a7c0-0x0;var _0x3f716b=_0xa0f6[_0x32a7c0];return _0x3f716b;};'use strict';var EventEmitter=require(_0x6a0f('0x0'));var OpenchannelQueue=require(_0x6a0f('0x1'))['db'][_0x6a0f('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x6a0f('0x3')](0x0);var events={'afterCreate':_0x6a0f('0x4'),'afterUpdate':_0x6a0f('0x5'),'afterDestroy':_0x6a0f('0x6')};function emitEvent(_0x1c4207){return function(_0x32a9ed,_0x3a99f9,_0x55be14){OpenchannelQueueEvents['emit'](_0x1c4207+':'+_0x32a9ed['id'],_0x32a9ed);OpenchannelQueueEvents['emit'](_0x1c4207,_0x32a9ed);_0x55be14(null);};}for(var e in events){if(events[_0x6a0f('0x7')](e)){var event=events[e];OpenchannelQueue[_0x6a0f('0x8')](e,emitEvent(event));}}module[_0x6a0f('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 61cec07..4a2d0bd 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 _0x9d69=['OpenchannelQueue','openchannel_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define'];(function(_0x24679e,_0x22d9d7){var _0x291f21=function(_0x329529){while(--_0x329529){_0x24679e['push'](_0x24679e['shift']());}};_0x291f21(++_0x22d9d7);}(_0x9d69,0x17c));var _0x99d6=function(_0x218c29,_0x1f7753){_0x218c29=_0x218c29-0x0;var _0x9cfde1=_0x9d69[_0x218c29];return _0x9cfde1;};'use strict';var _=require(_0x99d6('0x0'));var util=require(_0x99d6('0x1'));var logger=require('../../config/logger')(_0x99d6('0x2'));var moment=require(_0x99d6('0x3'));var BPromise=require(_0x99d6('0x4'));var rp=require(_0x99d6('0x5'));var fs=require('fs');var path=require(_0x99d6('0x6'));var rimraf=require(_0x99d6('0x7'));var config=require(_0x99d6('0x8'));var attributes=require(_0x99d6('0x9'));module[_0x99d6('0xa')]=function(_0x2d0154,_0x323245){return _0x2d0154[_0x99d6('0xb')](_0x99d6('0xc'),attributes,{'tableName':_0x99d6('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xae15=['bluebird','request-promise','rimraf','../../config/environment','exports','define','openchannel_queues','lodash','util','../../config/logger','moment'];(function(_0x1e2032,_0xd5bcb6){var _0x1264d6=function(_0x5315a2){while(--_0x5315a2){_0x1e2032['push'](_0x1e2032['shift']());}};_0x1264d6(++_0xd5bcb6);}(_0xae15,0xa1));var _0x5ae1=function(_0x27241f,_0x3e5907){_0x27241f=_0x27241f-0x0;var _0x34861b=_0xae15[_0x27241f];return _0x34861b;};'use strict';var _=require(_0x5ae1('0x0'));var util=require(_0x5ae1('0x1'));var logger=require(_0x5ae1('0x2'))('api');var moment=require(_0x5ae1('0x3'));var BPromise=require(_0x5ae1('0x4'));var rp=require(_0x5ae1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5ae1('0x6'));var config=require(_0x5ae1('0x7'));var attributes=require('./openchannelQueue.attributes');module[_0x5ae1('0x8')]=function(_0x2b0779,_0x45ede0){return _0x2b0779[_0x5ae1('0x9')]('OpenchannelQueue',attributes,{'tableName':_0x5ae1('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 a33fbdf..c295502 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 _0x9e69=['where','limit','map','include','model','attributes','then','info','stringify','ShowOpenchannelQueue','find','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','defaults','redis','socket.io-emitter','register','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x9e69,0x14f));var _0x99e6=function(_0x140a98,_0x43ddbc){_0x140a98=_0x140a98-0x0;var _0x244079=_0x9e69[_0x140a98];return _0x244079;};'use strict';var _=require(_0x99e6('0x0'));var util=require(_0x99e6('0x1'));var moment=require(_0x99e6('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x99e6('0x3'));var db=require(_0x99e6('0x4'))['db'];var utils=require(_0x99e6('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x99e6('0x6'));var jayson=require(_0x99e6('0x7'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x99e6('0x8')](config[_0x99e6('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x99e6('0xa'))(new Redis(config['redis']));require('./openchannelQueue.socket')[_0x99e6('0xb')](socket);function respondWithRpcPromise(_0x233934,_0x2567e9,_0x2fbb14){return new BPromise(function(_0x2e0114,_0x1123c2){return client['request'](_0x233934,_0x2fbb14)['then'](function(_0x23d260){logger['info'](_0x99e6('0xc'),_0x2567e9,_0x99e6('0xd'));logger[_0x99e6('0xe')](_0x99e6('0xf'),_0x2567e9,_0x99e6('0xd'),JSON['stringify'](_0x23d260));if(_0x23d260[_0x99e6('0x10')]){if(_0x23d260[_0x99e6('0x10')][_0x99e6('0x11')]===0x1f4){logger[_0x99e6('0x10')](_0x99e6('0xc'),_0x2567e9,_0x23d260['error']['message']);return _0x1123c2(_0x23d260[_0x99e6('0x10')]['message']);}logger['error'](_0x99e6('0xc'),_0x2567e9,_0x23d260[_0x99e6('0x10')][_0x99e6('0x12')]);return _0x2e0114(_0x23d260[_0x99e6('0x10')]['message']);}else{logger['info'](_0x99e6('0xc'),_0x2567e9,'request\x20sent');_0x2e0114(_0x23d260[_0x99e6('0x13')][_0x99e6('0x12')]);}})[_0x99e6('0x14')](function(_0x8e2873){logger['error'](_0x99e6('0xc'),_0x2567e9,_0x8e2873);_0x1123c2(_0x8e2873);});});}exports[_0x99e6('0x15')]=function(_0x3b3741){var _0xe171d3=this;return new Promise(function(_0xaae87b,_0x353d9b){return db[_0x99e6('0x16')][_0x99e6('0x17')]({'raw':_0x3b3741[_0x99e6('0x18')]?_0x3b3741[_0x99e6('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3b3741[_0x99e6('0x18')]?_0x3b3741[_0x99e6('0x18')][_0x99e6('0x19')]||null:null,'attributes':_0x3b3741[_0x99e6('0x18')]?_0x3b3741[_0x99e6('0x18')]['attributes']||null:null,'limit':_0x3b3741[_0x99e6('0x18')]?_0x3b3741[_0x99e6('0x18')][_0x99e6('0x1a')]||null:null,'include':_0x3b3741[_0x99e6('0x18')]?_0x3b3741['options']['include']?_[_0x99e6('0x1b')](_0x3b3741['options'][_0x99e6('0x1c')],function(_0x508938){return{'model':db[_0x508938[_0x99e6('0x1d')]],'as':_0x508938['as'],'attributes':_0x508938[_0x99e6('0x1e')],'include':_0x508938['include']?_[_0x99e6('0x1b')](_0x508938[_0x99e6('0x1c')],function(_0x25e547){return{'model':db[_0x25e547['model']],'as':_0x25e547['as'],'attributes':_0x25e547[_0x99e6('0x1e')],'include':_0x25e547[_0x99e6('0x1c')]?_[_0x99e6('0x1b')](_0x25e547[_0x99e6('0x1c')],function(_0x18dfba){return{'model':db[_0x18dfba[_0x99e6('0x1d')]],'as':_0x18dfba['as'],'attributes':_0x18dfba[_0x99e6('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x99e6('0x1f')](function(_0x4d5585){logger[_0x99e6('0x20')](_0x99e6('0x15'),_0x3b3741);logger['debug'](_0x99e6('0x15'),_0x3b3741,JSON[_0x99e6('0x21')](_0x4d5585));_0xaae87b(_0x4d5585);})[_0x99e6('0x14')](function(_0x2eb3af){logger[_0x99e6('0x10')](_0x99e6('0x15'),_0x2eb3af['message'],_0x3b3741);_0x353d9b(_0xe171d3[_0x99e6('0x10')](0x1f4,_0x2eb3af[_0x99e6('0x12')]));});});};exports[_0x99e6('0x22')]=function(_0x41eb24){var _0x3ff1fb=this;return new Promise(function(_0x55d98c,_0x3da0e8){return db[_0x99e6('0x16')][_0x99e6('0x23')]({'raw':_0x41eb24[_0x99e6('0x18')]?_0x41eb24[_0x99e6('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x41eb24[_0x99e6('0x18')]?_0x41eb24[_0x99e6('0x18')]['where']||null:null,'attributes':_0x41eb24['options']?_0x41eb24['options'][_0x99e6('0x1e')]||null:null,'include':_0x41eb24[_0x99e6('0x18')]?_0x41eb24[_0x99e6('0x18')][_0x99e6('0x1c')]?_[_0x99e6('0x1b')](_0x41eb24[_0x99e6('0x18')][_0x99e6('0x1c')],function(_0x1a5d27){return{'model':db[_0x1a5d27[_0x99e6('0x1d')]],'as':_0x1a5d27['as'],'attributes':_0x1a5d27[_0x99e6('0x1e')],'include':_0x1a5d27[_0x99e6('0x1c')]?_[_0x99e6('0x1b')](_0x1a5d27[_0x99e6('0x1c')],function(_0x1ebd2c){return{'model':db[_0x1ebd2c[_0x99e6('0x1d')]],'as':_0x1ebd2c['as'],'attributes':_0x1ebd2c[_0x99e6('0x1e')],'include':_0x1ebd2c[_0x99e6('0x1c')]?_[_0x99e6('0x1b')](_0x1ebd2c[_0x99e6('0x1c')],function(_0x4702cf){return{'model':db[_0x4702cf['model']],'as':_0x4702cf['as'],'attributes':_0x4702cf[_0x99e6('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x99e6('0x1f')](function(_0x263e23){logger[_0x99e6('0x20')]('ShowOpenchannelQueue',_0x41eb24);logger[_0x99e6('0xe')](_0x99e6('0x22'),_0x41eb24,JSON[_0x99e6('0x21')](_0x263e23));_0x55d98c(_0x263e23);})[_0x99e6('0x14')](function(_0x176722){logger['error']('ShowOpenchannelQueue',_0x176722['message'],_0x41eb24);_0x3da0e8(_0x3ff1fb['error'](0x1f4,_0x176722['message']));});});}; \ No newline at end of file +var _0x3ed4=['socket.io-emitter','./openchannelQueue.socket','register','request','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetOpenchannelQueue','OpenchannelQueue','findAll','options','where','attributes','limit','include','map','model','then','catch','ShowOpenchannelQueue','find','raw','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0xb61562,_0x1c8d99){var _0x4f73c0=function(_0x2445bd){while(--_0x2445bd){_0xb61562['push'](_0xb61562['shift']());}};_0x4f73c0(++_0x1c8d99);}(_0x3ed4,0x9d));var _0x43ed=function(_0x2b3de3,_0x3c47f1){_0x2b3de3=_0x2b3de3-0x0;var _0x50011a=_0x3ed4[_0x2b3de3];return _0x50011a;};'use strict';var _=require(_0x43ed('0x0'));var util=require('util');var moment=require(_0x43ed('0x1'));var BPromise=require(_0x43ed('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x43ed('0x3'));var db=require(_0x43ed('0x4'))['db'];var utils=require(_0x43ed('0x5'));var logger=require(_0x43ed('0x6'))(_0x43ed('0x7'));var config=require(_0x43ed('0x8'));var jayson=require(_0x43ed('0x9'));var client=jayson[_0x43ed('0xa')][_0x43ed('0xb')]({'port':0x232a});config[_0x43ed('0xc')]=_[_0x43ed('0xd')](config[_0x43ed('0xc')],{'host':_0x43ed('0xe'),'port':0x18eb});var socket=require(_0x43ed('0xf'))(new Redis(config[_0x43ed('0xc')]));require(_0x43ed('0x10'))[_0x43ed('0x11')](socket);function respondWithRpcPromise(_0x54ebb5,_0x35bd4e,_0x54a7e1){return new BPromise(function(_0x4d31a9,_0x2a5152){return client[_0x43ed('0x12')](_0x54ebb5,_0x54a7e1)['then'](function(_0x2591c7){logger[_0x43ed('0x13')](_0x43ed('0x14'),_0x35bd4e,_0x43ed('0x15'));logger[_0x43ed('0x16')](_0x43ed('0x17'),_0x35bd4e,_0x43ed('0x15'),JSON[_0x43ed('0x18')](_0x2591c7));if(_0x2591c7[_0x43ed('0x19')]){if(_0x2591c7['error'][_0x43ed('0x1a')]===0x1f4){logger[_0x43ed('0x19')](_0x43ed('0x14'),_0x35bd4e,_0x2591c7[_0x43ed('0x19')]['message']);return _0x2a5152(_0x2591c7[_0x43ed('0x19')][_0x43ed('0x1b')]);}logger[_0x43ed('0x19')](_0x43ed('0x14'),_0x35bd4e,_0x2591c7[_0x43ed('0x19')][_0x43ed('0x1b')]);return _0x4d31a9(_0x2591c7[_0x43ed('0x19')][_0x43ed('0x1b')]);}else{logger[_0x43ed('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x35bd4e,_0x43ed('0x15'));_0x4d31a9(_0x2591c7['result']['message']);}})['catch'](function(_0x2fcbed){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x35bd4e,_0x2fcbed);_0x2a5152(_0x2fcbed);});});}exports[_0x43ed('0x1c')]=function(_0x553258){var _0x4301ab=this;return new Promise(function(_0x4ce6bc,_0xccb9a5){return db[_0x43ed('0x1d')][_0x43ed('0x1e')]({'raw':_0x553258['options']?_0x553258['options']['raw']===undefined?!![]:![]:!![],'where':_0x553258[_0x43ed('0x1f')]?_0x553258['options'][_0x43ed('0x20')]||null:null,'attributes':_0x553258[_0x43ed('0x1f')]?_0x553258['options'][_0x43ed('0x21')]||null:null,'limit':_0x553258[_0x43ed('0x1f')]?_0x553258[_0x43ed('0x1f')][_0x43ed('0x22')]||null:null,'include':_0x553258[_0x43ed('0x1f')]?_0x553258[_0x43ed('0x1f')]['include']?_['map'](_0x553258[_0x43ed('0x1f')][_0x43ed('0x23')],function(_0x199b3f){return{'model':db[_0x199b3f['model']],'as':_0x199b3f['as'],'attributes':_0x199b3f[_0x43ed('0x21')],'include':_0x199b3f['include']?_[_0x43ed('0x24')](_0x199b3f[_0x43ed('0x23')],function(_0x1f437f){return{'model':db[_0x1f437f[_0x43ed('0x25')]],'as':_0x1f437f['as'],'attributes':_0x1f437f[_0x43ed('0x21')],'include':_0x1f437f[_0x43ed('0x23')]?_[_0x43ed('0x24')](_0x1f437f[_0x43ed('0x23')],function(_0x2c9326){return{'model':db[_0x2c9326[_0x43ed('0x25')]],'as':_0x2c9326['as'],'attributes':_0x2c9326[_0x43ed('0x21')]};}):[]};}):[]};}):[]:[]})[_0x43ed('0x26')](function(_0x4aa587){logger[_0x43ed('0x13')](_0x43ed('0x1c'),_0x553258);logger[_0x43ed('0x16')](_0x43ed('0x1c'),_0x553258,JSON[_0x43ed('0x18')](_0x4aa587));_0x4ce6bc(_0x4aa587);})[_0x43ed('0x27')](function(_0x4f23a3){logger[_0x43ed('0x19')](_0x43ed('0x1c'),_0x4f23a3[_0x43ed('0x1b')],_0x553258);_0xccb9a5(_0x4301ab[_0x43ed('0x19')](0x1f4,_0x4f23a3[_0x43ed('0x1b')]));});});};exports[_0x43ed('0x28')]=function(_0x1cbb21){var _0x971aaa=this;return new Promise(function(_0x325233,_0x55dcf7){return db['OpenchannelQueue'][_0x43ed('0x29')]({'raw':_0x1cbb21[_0x43ed('0x1f')]?_0x1cbb21[_0x43ed('0x1f')][_0x43ed('0x2a')]===undefined?!![]:![]:!![],'where':_0x1cbb21[_0x43ed('0x1f')]?_0x1cbb21[_0x43ed('0x1f')]['where']||null:null,'attributes':_0x1cbb21[_0x43ed('0x1f')]?_0x1cbb21['options'][_0x43ed('0x21')]||null:null,'include':_0x1cbb21[_0x43ed('0x1f')]?_0x1cbb21[_0x43ed('0x1f')][_0x43ed('0x23')]?_[_0x43ed('0x24')](_0x1cbb21['options']['include'],function(_0x4e789a){return{'model':db[_0x4e789a[_0x43ed('0x25')]],'as':_0x4e789a['as'],'attributes':_0x4e789a['attributes'],'include':_0x4e789a[_0x43ed('0x23')]?_[_0x43ed('0x24')](_0x4e789a['include'],function(_0x18a6a8){return{'model':db[_0x18a6a8[_0x43ed('0x25')]],'as':_0x18a6a8['as'],'attributes':_0x18a6a8['attributes'],'include':_0x18a6a8[_0x43ed('0x23')]?_[_0x43ed('0x24')](_0x18a6a8[_0x43ed('0x23')],function(_0x1da1de){return{'model':db[_0x1da1de['model']],'as':_0x1da1de['as'],'attributes':_0x1da1de['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5eb34c){logger[_0x43ed('0x13')](_0x43ed('0x28'),_0x1cbb21);logger['debug'](_0x43ed('0x28'),_0x1cbb21,JSON[_0x43ed('0x18')](_0x5eb34c));_0x325233(_0x5eb34c);})[_0x43ed('0x27')](function(_0x57b66d){logger[_0x43ed('0x19')](_0x43ed('0x28'),_0x57b66d['message'],_0x1cbb21);_0x55dcf7(_0x971aaa['error'](0x1f4,_0x57b66d[_0x43ed('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index e890beb..54d70ba 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 _0xb4da=['remove','update','emit','removeListener','register','length','openchannelQueue:','./openchannelQueue.events','save'];(function(_0x4caf11,_0x5c9031){var _0x11b295=function(_0x1fdb87){while(--_0x1fdb87){_0x4caf11['push'](_0x4caf11['shift']());}};_0x11b295(++_0x5c9031);}(_0xb4da,0xb2));var _0xab4d=function(_0x159c5d,_0x2ab9d7){_0x159c5d=_0x159c5d-0x0;var _0x148953=_0xb4da[_0x159c5d];return _0x148953;};'use strict';var OpenchannelQueueEvents=require(_0xab4d('0x0'));var events=[_0xab4d('0x1'),_0xab4d('0x2'),_0xab4d('0x3')];function createListener(_0x1e4281,_0x10e2ae){return function(_0xd8613a){_0x10e2ae[_0xab4d('0x4')](_0x1e4281,_0xd8613a);};}function removeListener(_0x577fa7,_0x36e3b3){return function(){OpenchannelQueueEvents[_0xab4d('0x5')](_0x577fa7,_0x36e3b3);};}exports[_0xab4d('0x6')]=function(_0x3e03f2){for(var _0x5cac48=0x0,_0x5e16cb=events[_0xab4d('0x7')];_0x5cac48<_0x5e16cb;_0x5cac48++){var _0x3586fd=events[_0x5cac48];var _0x28b810=createListener(_0xab4d('0x8')+_0x3586fd,_0x3e03f2);OpenchannelQueueEvents['on'](_0x3586fd,_0x28b810);}}; \ No newline at end of file +var _0x730a=['remove','update','register','length','openchannelQueue:','./openchannelQueue.events','save'];(function(_0x5a75c0,_0x4be4eb){var _0x1e86a3=function(_0x2b29a6){while(--_0x2b29a6){_0x5a75c0['push'](_0x5a75c0['shift']());}};_0x1e86a3(++_0x4be4eb);}(_0x730a,0x1b7));var _0xa730=function(_0x151f00,_0x4ca3a1){_0x151f00=_0x151f00-0x0;var _0x418d9b=_0x730a[_0x151f00];return _0x418d9b;};'use strict';var OpenchannelQueueEvents=require(_0xa730('0x0'));var events=[_0xa730('0x1'),_0xa730('0x2'),_0xa730('0x3')];function createListener(_0xd1a53e,_0x46a7f6){return function(_0x19b9b0){_0x46a7f6['emit'](_0xd1a53e,_0x19b9b0);};}function removeListener(_0x15317e,_0x5c188a){return function(){OpenchannelQueueEvents['removeListener'](_0x15317e,_0x5c188a);};}exports[_0xa730('0x4')]=function(_0x2cecd3){for(var _0x22d77b=0x0,_0x208b69=events[_0xa730('0x5')];_0x22d77b<_0x208b69;_0x22d77b++){var _0x35fd81=events[_0x22d77b];var _0x8d0121=createListener(_0xa730('0x6')+_0x35fd81,_0x2cecd3);OpenchannelQueueEvents['on'](_0x35fd81,_0x8d0121);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 7c5ca52..9f249a4 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 _0x0e33=['./openchannelQueueReport.controller','get','/describe','describe','post','isAuthenticated','create','/:id','update','delete','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x21353c,_0x2ea587){var _0xa99120=function(_0x557f33){while(--_0x557f33){_0x21353c['push'](_0x21353c['shift']());}};_0xa99120(++_0x2ea587);}(_0x0e33,0xe3));var _0x30e3=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x0e33[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x30e3('0x0'));var util=require('util');var path=require(_0x30e3('0x1'));var timeout=require('connect-timeout');var express=require(_0x30e3('0x2'));var router=express[_0x30e3('0x3')]();var fs_extra=require(_0x30e3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x30e3('0x5'));var config=require(_0x30e3('0x6'));var controller=require(_0x30e3('0x7'));router[_0x30e3('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x30e3('0x8')](_0x30e3('0x9'),auth['isAuthenticated'](),controller[_0x30e3('0xa')]);router[_0x30e3('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x30e3('0xb')]('/',auth[_0x30e3('0xc')](),controller[_0x30e3('0xd')]);router['put'](_0x30e3('0xe'),auth[_0x30e3('0xc')](),controller[_0x30e3('0xf')]);router[_0x30e3('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x30e3('0x11')]=router; \ No newline at end of file +var _0x2a6f=['../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','index','get','/describe','isAuthenticated','/:id','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x2a6f,0xf5));var _0xf2a6=function(_0x525b61,_0x5e2e76){_0x525b61=_0x525b61-0x0;var _0x6e329a=_0x2a6f[_0x525b61];return _0x6e329a;};'use strict';var multer=require(_0xf2a6('0x0'));var util=require(_0xf2a6('0x1'));var path=require(_0xf2a6('0x2'));var timeout=require(_0xf2a6('0x3'));var express=require(_0xf2a6('0x4'));var router=express[_0xf2a6('0x5')]();var fs_extra=require(_0xf2a6('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf2a6('0x7'));var config=require(_0xf2a6('0x8'));var controller=require(_0xf2a6('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xf2a6('0xa')]);router[_0xf2a6('0xb')](_0xf2a6('0xc'),auth[_0xf2a6('0xd')](),controller['describe']);router[_0xf2a6('0xb')](_0xf2a6('0xe'),auth[_0xf2a6('0xd')](),controller['show']);router['post']('/',auth[_0xf2a6('0xd')](),controller[_0xf2a6('0xf')]);router[_0xf2a6('0x10')](_0xf2a6('0xe'),auth[_0xf2a6('0xd')](),controller[_0xf2a6('0x11')]);router[_0xf2a6('0x12')](_0xf2a6('0xe'),auth[_0xf2a6('0xd')](),controller[_0xf2a6('0x13')]);module[_0xf2a6('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index d58255f..d5b9ed8 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 _0xfd02=['DATE','moment','exports','STRING'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0xfd02,0xbd));var _0x2fd0=function(_0x8fa4bc,_0x5cd2af){_0x8fa4bc=_0x8fa4bc-0x0;var _0x35b6a7=_0xfd02[_0x8fa4bc];return _0x35b6a7;};'use strict';var moment=require(_0x2fd0('0x0'));var Sequelize=require('sequelize');module[_0x2fd0('0x1')]={'uniqueid':{'type':Sequelize[_0x2fd0('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x2fd0('0x2')]},'joinAt':{'type':Sequelize[_0x2fd0('0x3')]},'leaveAt':{'type':Sequelize[_0x2fd0('0x3')]},'acceptAt':{'type':Sequelize[_0x2fd0('0x3')]},'exitAt':{'type':Sequelize[_0x2fd0('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcd3a=['STRING','DATE','sequelize','exports'];(function(_0x38204e,_0x2186fd){var _0x2999a8=function(_0x3e6210){while(--_0x3e6210){_0x38204e['push'](_0x38204e['shift']());}};_0x2999a8(++_0x2186fd);}(_0xcd3a,0x8e));var _0xacd3=function(_0xc989ca,_0x492937){_0xc989ca=_0xc989ca-0x0;var _0x3108f4=_0xcd3a[_0xc989ca];return _0x3108f4;};'use strict';var moment=require('moment');var Sequelize=require(_0xacd3('0x0'));module[_0xacd3('0x1')]={'uniqueid':{'type':Sequelize[_0xacd3('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xacd3('0x2')]},'joinAt':{'type':Sequelize[_0xacd3('0x3')]},'leaveAt':{'type':Sequelize[_0xacd3('0x3')]},'acceptAt':{'type':Sequelize[_0xacd3('0x3')]},'exitAt':{'type':Sequelize[_0xacd3('0x3')]},'reason':{'type':Sequelize[_0xacd3('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 6b661c2..bb1843c 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 _0xde41=['query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','options','findAll','catch','show','length','include','create','body','find','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','model','keys'];(function(_0x535963,_0x326515){var _0x3975f6=function(_0x2e624f){while(--_0x2e624f){_0x535963['push'](_0x535963['shift']());}};_0x3975f6(++_0x326515);}(_0xde41,0x1d9));var _0x1de4=function(_0x36c383,_0x1f54f9){_0x36c383=_0x36c383-0x0;var _0x54388b=_0xde41[_0x36c383];return _0x54388b;};'use strict';var emlformat=require(_0x1de4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1de4('0x1'));var jsonpatch=require(_0x1de4('0x2'));var rp=require(_0x1de4('0x3'));var moment=require(_0x1de4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1de4('0x5'));var util=require(_0x1de4('0x6'));var path=require(_0x1de4('0x7'));var sox=require('sox');var csv=require(_0x1de4('0x8'));var ejs=require(_0x1de4('0x9'));var fs=require('fs');var fs_extra=require(_0x1de4('0xa'));var _=require(_0x1de4('0xb'));var squel=require('squel');var crypto=require(_0x1de4('0xc'));var jsforce=require(_0x1de4('0xd'));var deskjs=require(_0x1de4('0xe'));var toCsv=require(_0x1de4('0x8'));var querystring=require(_0x1de4('0xf'));var Papa=require('papaparse');var Redis=require(_0x1de4('0x10'));var authService=require(_0x1de4('0x11'));var qs=require(_0x1de4('0x12'));var as=require(_0x1de4('0x13'));var hardwareService=require(_0x1de4('0x14'));var logger=require(_0x1de4('0x15'))(_0x1de4('0x16'));var utils=require(_0x1de4('0x17'));var config=require(_0x1de4('0x18'));var licenseUtil=require(_0x1de4('0x19'));var db=require(_0x1de4('0x1a'))['db'];function respondWithStatusCode(_0x2501cd,_0x5d9762){_0x5d9762=_0x5d9762||0xcc;return function(_0x18f525){if(_0x18f525){return _0x2501cd[_0x1de4('0x1b')](_0x5d9762);}return _0x2501cd['status'](_0x5d9762)['end']();};}function respondWithResult(_0xb4659d,_0x1c5799){_0x1c5799=_0x1c5799||0xc8;return function(_0x4c5255){if(_0x4c5255){return _0xb4659d[_0x1de4('0x1c')](_0x1c5799)['json'](_0x4c5255);}};}function respondWithFilteredResult(_0x2ca224,_0xd88228){return function(_0x115bb4){if(_0x115bb4){var _0x322521=typeof _0xd88228[_0x1de4('0x1d')]===_0x1de4('0x1e')&&typeof _0xd88228[_0x1de4('0x1f')]===_0x1de4('0x1e');var _0xd0155b=_0x115bb4[_0x1de4('0x20')];var _0x398fb7=_0x322521?0x0:_0xd88228[_0x1de4('0x1d')];var _0x493b17=_0x322521?_0x115bb4['count']:_0xd88228[_0x1de4('0x1d')]+_0xd88228[_0x1de4('0x1f')];var _0x5acec4;if(_0x493b17>=_0xd0155b){_0x493b17=_0xd0155b;_0x5acec4=0xc8;}else{_0x5acec4=0xce;}_0x2ca224[_0x1de4('0x1c')](_0x5acec4);return _0x2ca224[_0x1de4('0x21')](_0x1de4('0x22'),_0x398fb7+'-'+_0x493b17+'/'+_0xd0155b)[_0x1de4('0x23')](_0x115bb4);}return null;};}function patchUpdates(_0x46824a){return function(_0x48970d){try{jsonpatch[_0x1de4('0x24')](_0x48970d,_0x46824a,!![]);}catch(_0x188bd6){return BPromise['reject'](_0x188bd6);}return _0x48970d[_0x1de4('0x25')]();};}function saveUpdates(_0x153439,_0x179926){return function(_0x9e6852){if(_0x9e6852){return _0x9e6852[_0x1de4('0x26')](_0x153439)[_0x1de4('0x27')](function(_0x5cbb16){return _0x5cbb16;});}return null;};}function removeEntity(_0x4c42cb,_0x107df7){return function(_0x3f6c75){if(_0x3f6c75){return _0x3f6c75[_0x1de4('0x28')]()[_0x1de4('0x27')](function(){_0x4c42cb[_0x1de4('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29556a,_0x16fb1a){return function(_0x4a320d){if(!_0x4a320d){_0x29556a['sendStatus'](0x194);}return _0x4a320d;};}function handleError(_0x5ec534,_0x2cb9ad){_0x2cb9ad=_0x2cb9ad||0x1f4;return function(_0x129993){logger['error'](_0x129993[_0x1de4('0x29')]);if(_0x129993['name']){delete _0x129993[_0x1de4('0x2a')];}_0x5ec534['status'](_0x2cb9ad)[_0x1de4('0x2b')](_0x129993);};}exports[_0x1de4('0x2c')]=function(_0x200de6,_0x2ea6a1){var _0x24f140={},_0x5a6803={},_0x43aabb={'count':0x0,'rows':[]};var _0xb4f90e=_[_0x1de4('0x2d')](db[_0x1de4('0x2e')][_0x1de4('0x2f')],function(_0xd74c72){return{'name':_0xd74c72[_0x1de4('0x30')],'type':_0xd74c72[_0x1de4('0x31')]['key']};});_0x5a6803[_0x1de4('0x32')]=_['map'](_0xb4f90e,_0x1de4('0x2a'));_0x5a6803['query']=_[_0x1de4('0x33')](_0x200de6[_0x1de4('0x34')]);_0x5a6803[_0x1de4('0x35')]=_[_0x1de4('0x36')](_0x5a6803['model'],_0x5a6803['query']);_0x24f140[_0x1de4('0x37')]=_['intersection'](_0x5a6803[_0x1de4('0x32')],qs[_0x1de4('0x38')](_0x200de6['query']['fields']));_0x24f140[_0x1de4('0x37')]=_0x24f140[_0x1de4('0x37')]['length']?_0x24f140['attributes']:_0x5a6803[_0x1de4('0x32')];if(!_0x200de6[_0x1de4('0x34')][_0x1de4('0x39')]('nolimit')){_0x24f140[_0x1de4('0x1f')]=qs['limit'](_0x200de6[_0x1de4('0x34')][_0x1de4('0x1f')]);_0x24f140[_0x1de4('0x1d')]=qs[_0x1de4('0x1d')](_0x200de6[_0x1de4('0x34')][_0x1de4('0x1d')]);}_0x24f140[_0x1de4('0x3a')]=qs['sort'](_0x200de6[_0x1de4('0x34')][_0x1de4('0x3b')]);_0x24f140['where']=qs[_0x1de4('0x35')](_['pick'](_0x200de6[_0x1de4('0x34')],_0x5a6803[_0x1de4('0x35')]),_0xb4f90e);if(_0x200de6['query'][_0x1de4('0x3c')]){_0x24f140[_0x1de4('0x3d')]=_[_0x1de4('0x3e')](_0x24f140[_0x1de4('0x3d')],{'$or':_['map'](_0xb4f90e,function(_0x2e57aa){if(_0x2e57aa[_0x1de4('0x31')]!==_0x1de4('0x3f')){var _0x2d348e={};_0x2d348e[_0x2e57aa[_0x1de4('0x2a')]]={'$like':'%'+_0x200de6[_0x1de4('0x34')][_0x1de4('0x3c')]+'%'};return _0x2d348e;}})});}_0x24f140=_['merge']({},_0x24f140,_0x200de6[_0x1de4('0x40')]);var _0x423ab1={'where':_0x24f140[_0x1de4('0x3d')]};return db['OpenchannelQueueReport'][_0x1de4('0x20')](_0x423ab1)[_0x1de4('0x27')](function(_0x5e3667){_0x43aabb[_0x1de4('0x20')]=_0x5e3667;if(_0x200de6[_0x1de4('0x34')]['includeAll']){_0x24f140['include']=[{'all':!![]}];}return db[_0x1de4('0x2e')][_0x1de4('0x41')](_0x24f140);})['then'](function(_0x2f3c60){_0x43aabb['rows']=_0x2f3c60;return _0x43aabb;})[_0x1de4('0x27')](respondWithFilteredResult(_0x2ea6a1,_0x24f140))[_0x1de4('0x42')](handleError(_0x2ea6a1,null));};exports[_0x1de4('0x43')]=function(_0xaf26b2,_0x19d704){var _0x3274a2={'raw':!![],'where':{'id':_0xaf26b2['params']['id']}},_0x387256={};_0x387256[_0x1de4('0x32')]=_['keys'](db[_0x1de4('0x2e')]['rawAttributes']);_0x387256[_0x1de4('0x34')]=_[_0x1de4('0x33')](_0xaf26b2[_0x1de4('0x34')]);_0x387256[_0x1de4('0x35')]=_[_0x1de4('0x36')](_0x387256['model'],_0x387256[_0x1de4('0x34')]);_0x3274a2[_0x1de4('0x37')]=_[_0x1de4('0x36')](_0x387256[_0x1de4('0x32')],qs[_0x1de4('0x38')](_0xaf26b2[_0x1de4('0x34')][_0x1de4('0x38')]));_0x3274a2[_0x1de4('0x37')]=_0x3274a2['attributes'][_0x1de4('0x44')]?_0x3274a2[_0x1de4('0x37')]:_0x387256[_0x1de4('0x32')];if(_0xaf26b2['query']['includeAll']){_0x3274a2[_0x1de4('0x45')]=[{'all':!![]}];}_0x3274a2=_[_0x1de4('0x3e')]({},_0x3274a2,_0xaf26b2['options']);return db[_0x1de4('0x2e')]['find'](_0x3274a2)[_0x1de4('0x27')](handleEntityNotFound(_0x19d704,null))['then'](respondWithResult(_0x19d704,null))[_0x1de4('0x42')](handleError(_0x19d704,null));};exports[_0x1de4('0x46')]=function(_0x33ea8a,_0x3a95db){return db[_0x1de4('0x2e')]['create'](_0x33ea8a[_0x1de4('0x47')],{})[_0x1de4('0x27')](respondWithResult(_0x3a95db,0xc9))[_0x1de4('0x42')](handleError(_0x3a95db,null));};exports[_0x1de4('0x26')]=function(_0x240433,_0x3c4ddc){if(_0x240433['body']['id']){delete _0x240433[_0x1de4('0x47')]['id'];}return db['OpenchannelQueueReport'][_0x1de4('0x48')]({'where':{'id':_0x240433[_0x1de4('0x49')]['id']}})[_0x1de4('0x27')](handleEntityNotFound(_0x3c4ddc,null))[_0x1de4('0x27')](saveUpdates(_0x240433['body'],null))[_0x1de4('0x27')](respondWithResult(_0x3c4ddc,null))[_0x1de4('0x42')](handleError(_0x3c4ddc,null));};exports['destroy']=function(_0x26885e,_0xc95184){return db[_0x1de4('0x2e')][_0x1de4('0x48')]({'where':{'id':_0x26885e[_0x1de4('0x49')]['id']}})[_0x1de4('0x27')](handleEntityNotFound(_0xc95184,null))[_0x1de4('0x27')](removeEntity(_0xc95184,null))[_0x1de4('0x42')](handleError(_0xc95184,null));};exports[_0x1de4('0x4a')]=function(_0x5458c8,_0x2c7901){return db[_0x1de4('0x2e')]['describe']()[_0x1de4('0x27')](respondWithResult(_0x2c7901,null))[_0x1de4('0x42')](handleError(_0x2c7901,null));}; \ No newline at end of file +var _0x7b08=['../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','then','destroy','sendStatus','stack','name','send','index','OpenchannelQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','include','findAll','show','params','options','find','catch','create','body','describe','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x57b328,_0x10742a){var _0x2e26d1=function(_0xa3f95c){while(--_0xa3f95c){_0x57b328['push'](_0x57b328['shift']());}};_0x2e26d1(++_0x10742a);}(_0x7b08,0x1de));var _0x87b0=function(_0x584a31,_0x221fed){_0x584a31=_0x584a31-0x0;var _0x93733c=_0x7b08[_0x584a31];return _0x93733c;};'use strict';var emlformat=require(_0x87b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x87b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x87b0('0x2'));var moment=require(_0x87b0('0x3'));var BPromise=require(_0x87b0('0x4'));var Mustache=require('mustache');var util=require(_0x87b0('0x5'));var path=require(_0x87b0('0x6'));var sox=require(_0x87b0('0x7'));var csv=require('to-csv');var ejs=require(_0x87b0('0x8'));var fs=require('fs');var fs_extra=require(_0x87b0('0x9'));var _=require('lodash');var squel=require(_0x87b0('0xa'));var crypto=require(_0x87b0('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x87b0('0xc'));var Papa=require(_0x87b0('0xd'));var Redis=require('ioredis');var authService=require(_0x87b0('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x87b0('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0x87b0('0x10'));var config=require(_0x87b0('0x11'));var licenseUtil=require(_0x87b0('0x12'));var db=require(_0x87b0('0x13'))['db'];function respondWithStatusCode(_0x4b78fc,_0x504f2f){_0x504f2f=_0x504f2f||0xcc;return function(_0x510872){if(_0x510872){return _0x4b78fc['sendStatus'](_0x504f2f);}return _0x4b78fc['status'](_0x504f2f)[_0x87b0('0x14')]();};}function respondWithResult(_0x266654,_0xbd18de){_0xbd18de=_0xbd18de||0xc8;return function(_0x3f4da0){if(_0x3f4da0){return _0x266654['status'](_0xbd18de)[_0x87b0('0x15')](_0x3f4da0);}};}function respondWithFilteredResult(_0x545e5b,_0x1a0fe0){return function(_0xc4b98c){if(_0xc4b98c){var _0x109cf2=typeof _0x1a0fe0[_0x87b0('0x16')]===_0x87b0('0x17')&&typeof _0x1a0fe0[_0x87b0('0x18')]===_0x87b0('0x17');var _0x438cab=_0xc4b98c[_0x87b0('0x19')];var _0xe5a35f=_0x109cf2?0x0:_0x1a0fe0[_0x87b0('0x16')];var _0x2bed63=_0x109cf2?_0xc4b98c[_0x87b0('0x19')]:_0x1a0fe0[_0x87b0('0x16')]+_0x1a0fe0[_0x87b0('0x18')];var _0x4f5da1;if(_0x2bed63>=_0x438cab){_0x2bed63=_0x438cab;_0x4f5da1=0xc8;}else{_0x4f5da1=0xce;}_0x545e5b[_0x87b0('0x1a')](_0x4f5da1);return _0x545e5b[_0x87b0('0x1b')](_0x87b0('0x1c'),_0xe5a35f+'-'+_0x2bed63+'/'+_0x438cab)[_0x87b0('0x15')](_0xc4b98c);}return null;};}function patchUpdates(_0x33f1bb){return function(_0x3fbb5d){try{jsonpatch[_0x87b0('0x1d')](_0x3fbb5d,_0x33f1bb,!![]);}catch(_0x508c6f){return BPromise['reject'](_0x508c6f);}return _0x3fbb5d['save']();};}function saveUpdates(_0x4107d4,_0x3031e0){return function(_0x51f17d){if(_0x51f17d){return _0x51f17d['update'](_0x4107d4)[_0x87b0('0x1e')](function(_0x1a5807){return _0x1a5807;});}return null;};}function removeEntity(_0x328dc9,_0x1f61ef){return function(_0xb7ecec){if(_0xb7ecec){return _0xb7ecec[_0x87b0('0x1f')]()[_0x87b0('0x1e')](function(){_0x328dc9[_0x87b0('0x1a')](0xcc)[_0x87b0('0x14')]();});}};}function handleEntityNotFound(_0x2753cd,_0x41f413){return function(_0x487b8f){if(!_0x487b8f){_0x2753cd[_0x87b0('0x20')](0x194);}return _0x487b8f;};}function handleError(_0x191579,_0x4bed5c){_0x4bed5c=_0x4bed5c||0x1f4;return function(_0x3bda06){logger['error'](_0x3bda06[_0x87b0('0x21')]);if(_0x3bda06['name']){delete _0x3bda06[_0x87b0('0x22')];}_0x191579[_0x87b0('0x1a')](_0x4bed5c)[_0x87b0('0x23')](_0x3bda06);};}exports[_0x87b0('0x24')]=function(_0x36dfc2,_0xb731b9){var _0x2e2853={},_0x5606c4={},_0x3adf9b={'count':0x0,'rows':[]};var _0x3b50c8=_['map'](db[_0x87b0('0x25')][_0x87b0('0x26')],function(_0x36bb97){return{'name':_0x36bb97[_0x87b0('0x27')],'type':_0x36bb97[_0x87b0('0x28')][_0x87b0('0x29')]};});_0x5606c4['model']=_['map'](_0x3b50c8,_0x87b0('0x22'));_0x5606c4[_0x87b0('0x2a')]=_[_0x87b0('0x2b')](_0x36dfc2[_0x87b0('0x2a')]);_0x5606c4[_0x87b0('0x2c')]=_[_0x87b0('0x2d')](_0x5606c4[_0x87b0('0x2e')],_0x5606c4[_0x87b0('0x2a')]);_0x2e2853[_0x87b0('0x2f')]=_[_0x87b0('0x2d')](_0x5606c4[_0x87b0('0x2e')],qs[_0x87b0('0x30')](_0x36dfc2[_0x87b0('0x2a')][_0x87b0('0x30')]));_0x2e2853['attributes']=_0x2e2853[_0x87b0('0x2f')][_0x87b0('0x31')]?_0x2e2853[_0x87b0('0x2f')]:_0x5606c4[_0x87b0('0x2e')];if(!_0x36dfc2['query'][_0x87b0('0x32')](_0x87b0('0x33'))){_0x2e2853['limit']=qs[_0x87b0('0x18')](_0x36dfc2[_0x87b0('0x2a')]['limit']);_0x2e2853[_0x87b0('0x16')]=qs[_0x87b0('0x16')](_0x36dfc2[_0x87b0('0x2a')][_0x87b0('0x16')]);}_0x2e2853[_0x87b0('0x34')]=qs[_0x87b0('0x35')](_0x36dfc2[_0x87b0('0x2a')][_0x87b0('0x35')]);_0x2e2853[_0x87b0('0x36')]=qs[_0x87b0('0x2c')](_[_0x87b0('0x37')](_0x36dfc2[_0x87b0('0x2a')],_0x5606c4[_0x87b0('0x2c')]),_0x3b50c8);if(_0x36dfc2[_0x87b0('0x2a')][_0x87b0('0x38')]){_0x2e2853[_0x87b0('0x36')]=_[_0x87b0('0x39')](_0x2e2853[_0x87b0('0x36')],{'$or':_[_0x87b0('0x3a')](_0x3b50c8,function(_0x1c3762){if(_0x1c3762[_0x87b0('0x28')]!==_0x87b0('0x3b')){var _0x1d3fa8={};_0x1d3fa8[_0x1c3762[_0x87b0('0x22')]]={'$like':'%'+_0x36dfc2[_0x87b0('0x2a')][_0x87b0('0x38')]+'%'};return _0x1d3fa8;}})});}_0x2e2853=_['merge']({},_0x2e2853,_0x36dfc2['options']);var _0x3bdeb3={'where':_0x2e2853[_0x87b0('0x36')]};return db[_0x87b0('0x25')][_0x87b0('0x19')](_0x3bdeb3)[_0x87b0('0x1e')](function(_0x4b1249){_0x3adf9b[_0x87b0('0x19')]=_0x4b1249;if(_0x36dfc2[_0x87b0('0x2a')][_0x87b0('0x3c')]){_0x2e2853[_0x87b0('0x3d')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x87b0('0x3e')](_0x2e2853);})[_0x87b0('0x1e')](function(_0x140c80){_0x3adf9b['rows']=_0x140c80;return _0x3adf9b;})['then'](respondWithFilteredResult(_0xb731b9,_0x2e2853))['catch'](handleError(_0xb731b9,null));};exports[_0x87b0('0x3f')]=function(_0x1a4bb4,_0x167f8c){var _0x5380d8={'raw':!![],'where':{'id':_0x1a4bb4[_0x87b0('0x40')]['id']}},_0x530eac={};_0x530eac['model']=_[_0x87b0('0x2b')](db[_0x87b0('0x25')]['rawAttributes']);_0x530eac[_0x87b0('0x2a')]=_[_0x87b0('0x2b')](_0x1a4bb4['query']);_0x530eac[_0x87b0('0x2c')]=_[_0x87b0('0x2d')](_0x530eac[_0x87b0('0x2e')],_0x530eac[_0x87b0('0x2a')]);_0x5380d8[_0x87b0('0x2f')]=_['intersection'](_0x530eac[_0x87b0('0x2e')],qs['fields'](_0x1a4bb4['query'][_0x87b0('0x30')]));_0x5380d8[_0x87b0('0x2f')]=_0x5380d8[_0x87b0('0x2f')][_0x87b0('0x31')]?_0x5380d8[_0x87b0('0x2f')]:_0x530eac[_0x87b0('0x2e')];if(_0x1a4bb4[_0x87b0('0x2a')][_0x87b0('0x3c')]){_0x5380d8['include']=[{'all':!![]}];}_0x5380d8=_[_0x87b0('0x39')]({},_0x5380d8,_0x1a4bb4[_0x87b0('0x41')]);return db[_0x87b0('0x25')][_0x87b0('0x42')](_0x5380d8)['then'](handleEntityNotFound(_0x167f8c,null))[_0x87b0('0x1e')](respondWithResult(_0x167f8c,null))[_0x87b0('0x43')](handleError(_0x167f8c,null));};exports[_0x87b0('0x44')]=function(_0xe5bef0,_0x234021){return db['OpenchannelQueueReport'][_0x87b0('0x44')](_0xe5bef0['body'],{})['then'](respondWithResult(_0x234021,0xc9))[_0x87b0('0x43')](handleError(_0x234021,null));};exports['update']=function(_0x5412ab,_0x537ae0){if(_0x5412ab[_0x87b0('0x45')]['id']){delete _0x5412ab['body']['id'];}return db[_0x87b0('0x25')][_0x87b0('0x42')]({'where':{'id':_0x5412ab[_0x87b0('0x40')]['id']}})[_0x87b0('0x1e')](handleEntityNotFound(_0x537ae0,null))[_0x87b0('0x1e')](saveUpdates(_0x5412ab['body'],null))[_0x87b0('0x1e')](respondWithResult(_0x537ae0,null))[_0x87b0('0x43')](handleError(_0x537ae0,null));};exports[_0x87b0('0x1f')]=function(_0x48b75f,_0x5c8c12){return db[_0x87b0('0x25')][_0x87b0('0x42')]({'where':{'id':_0x48b75f[_0x87b0('0x40')]['id']}})[_0x87b0('0x1e')](handleEntityNotFound(_0x5c8c12,null))[_0x87b0('0x1e')](removeEntity(_0x5c8c12,null))['catch'](handleError(_0x5c8c12,null));};exports['describe']=function(_0xb97cd5,_0x2fb9d9){return db[_0x87b0('0x25')][_0x87b0('0x46')]()[_0x87b0('0x1e')](respondWithResult(_0x2fb9d9,null))[_0x87b0('0x43')](handleError(_0x2fb9d9,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 6c227a9..c2bc8a4 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 _0x7a54=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x65653e,_0x47b5ff){var _0x3720b5=function(_0x1f9d93){while(--_0x1f9d93){_0x65653e['push'](_0x65653e['shift']());}};_0x3720b5(++_0x47b5ff);}(_0x7a54,0x106));var _0x47a5=function(_0x57c22f,_0x3ad540){_0x57c22f=_0x57c22f-0x0;var _0x2555dc=_0x7a54[_0x57c22f];return _0x2555dc;};'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':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x5640d2,_0x1fd78d){var _0x3b7162=function(_0x3d5aef){while(--_0x3d5aef){_0x5640d2['push'](_0x5640d2['shift']());}};_0x3b7162(++_0x1fd78d);}(_0x1261,0x144));var _0x1126=function(_0xdd82b4,_0x5cd8b8){_0xdd82b4=_0xdd82b4-0x0;var _0x549bb2=_0x1261[_0xdd82b4];return _0x549bb2;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index e1d71ff..29e3140 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(_0x565fed,_0xb85768){var _0x3e018f=function(_0x104d8e){while(--_0x104d8e){_0x565fed['push'](_0x565fed['shift']());}};_0x3e018f(++_0xb85768);}(_0x531a,0x100));var _0xa531=function(_0x5b0263,_0x27b189){_0x5b0263=_0x5b0263-0x0;var _0x53c82f=_0x531a[_0x5b0263];return _0x53c82f;};'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 _0xd943=['options','raw','stringify','UpdateOpenchannelQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then','info','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','body'];(function(_0x5e4179,_0x397847){var _0x5f5025=function(_0x440fbe){while(--_0x440fbe){_0x5e4179['push'](_0x5e4179['shift']());}};_0x5f5025(++_0x397847);}(_0xd943,0x15d));var _0x3d94=function(_0x17f07a,_0x235e7e){_0x17f07a=_0x17f07a-0x0;var _0x46c5a3=_0xd943[_0x17f07a];return _0x46c5a3;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));var BPromise=require(_0x3d94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d94('0x4'));var db=require(_0x3d94('0x5'))['db'];var utils=require(_0x3d94('0x6'));var logger=require(_0x3d94('0x7'))(_0x3d94('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d94('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54e81f,_0x4d29e7,_0x20f4d1){return new BPromise(function(_0x35d36a,_0x5244c3){return client['request'](_0x54e81f,_0x20f4d1)[_0x3d94('0xa')](function(_0x27e381){logger[_0x3d94('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x4d29e7,_0x3d94('0xc'));logger['debug'](_0x3d94('0xd'),_0x4d29e7,_0x3d94('0xc'),JSON['stringify'](_0x27e381));if(_0x27e381[_0x3d94('0xe')]){if(_0x27e381[_0x3d94('0xe')][_0x3d94('0xf')]===0x1f4){logger[_0x3d94('0xe')](_0x3d94('0x10'),_0x4d29e7,_0x27e381['error'][_0x3d94('0x11')]);return _0x5244c3(_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);}logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);return _0x35d36a(_0x27e381['error'][_0x3d94('0x11')]);}else{logger[_0x3d94('0xb')](_0x3d94('0x10'),_0x4d29e7,_0x3d94('0xc'));_0x35d36a(_0x27e381[_0x3d94('0x12')][_0x3d94('0x11')]);}})[_0x3d94('0x13')](function(_0x9893cb){logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x9893cb);_0x5244c3(_0x9893cb);});});}exports[_0x3d94('0x14')]=function(_0x2acee3){var _0x1c35a8=this;return new Promise(function(_0x4afc92,_0x3ca0e3){return db[_0x3d94('0x15')]['create'](_0x2acee3[_0x3d94('0x16')],{'raw':_0x2acee3['options']?_0x2acee3[_0x3d94('0x17')][_0x3d94('0x18')]===undefined?!![]:![]:!![]})[_0x3d94('0xa')](function(_0x1e9ec2){logger[_0x3d94('0xb')]('CreateOpenchannelQueueReport',_0x2acee3);logger['debug'](_0x3d94('0x14'),_0x2acee3,JSON[_0x3d94('0x19')](_0x1e9ec2));_0x4afc92(_0x1e9ec2);})[_0x3d94('0x13')](function(_0x4edee4){logger[_0x3d94('0xe')](_0x3d94('0x14'),_0x4edee4[_0x3d94('0x11')],_0x2acee3);_0x3ca0e3(_0x1c35a8[_0x3d94('0xe')](0x1f4,_0x4edee4[_0x3d94('0x11')]));});});};exports[_0x3d94('0x1a')]=function(_0x295493){var _0x27f978=this;return new Promise(function(_0xee7b8d,_0x18f58c){return db[_0x3d94('0x15')][_0x3d94('0x1b')](_0x295493[_0x3d94('0x16')],{'raw':_0x295493[_0x3d94('0x17')]?_0x295493[_0x3d94('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x295493[_0x3d94('0x17')]?_0x295493['options'][_0x3d94('0x1c')]||null:null,'attributes':_0x295493[_0x3d94('0x17')]?_0x295493[_0x3d94('0x17')][_0x3d94('0x1d')]||null:null,'limit':_0x295493[_0x3d94('0x17')]?_0x295493[_0x3d94('0x17')][_0x3d94('0x1e')]||null:null})['then'](function(_0x584c4a){logger[_0x3d94('0xb')]('UpdateOpenchannelQueueReport',_0x295493);logger['debug'](_0x3d94('0x1a'),_0x295493,JSON['stringify'](_0x584c4a));_0xee7b8d(_0x584c4a);})[_0x3d94('0x13')](function(_0xef9644){logger[_0x3d94('0xe')]('UpdateOpenchannelQueueReport',_0xef9644[_0x3d94('0x11')],_0x295493);_0x18f58c(_0x27f978['error'](0x1f4,_0xef9644[_0x3d94('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 7850084..d868466 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 _0xb5a1=['/:id','show','post','put','update','delete','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelTransferReport.controller','isAuthenticated','index','get','describe'];(function(_0x327c92,_0x230bec){var _0x7f7601=function(_0x4e3c6c){while(--_0x4e3c6c){_0x327c92['push'](_0x327c92['shift']());}};_0x7f7601(++_0x230bec);}(_0xb5a1,0x1c9));var _0x1b5a=function(_0x491faa,_0x4f2907){_0x491faa=_0x491faa-0x0;var _0x414440=_0xb5a1[_0x491faa];return _0x414440;};'use strict';var multer=require(_0x1b5a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1b5a('0x1'));var express=require(_0x1b5a('0x2'));var router=express[_0x1b5a('0x3')]();var fs_extra=require(_0x1b5a('0x4'));var auth=require(_0x1b5a('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1b5a('0x6'));router['get']('/',auth[_0x1b5a('0x7')](),controller[_0x1b5a('0x8')]);router[_0x1b5a('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x1b5a('0xa')]);router[_0x1b5a('0x9')](_0x1b5a('0xb'),auth[_0x1b5a('0x7')](),controller[_0x1b5a('0xc')]);router[_0x1b5a('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1b5a('0xe')](_0x1b5a('0xb'),auth['isAuthenticated'](),controller[_0x1b5a('0xf')]);router[_0x1b5a('0x10')](_0x1b5a('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x1b5a('0x11')]=router; \ No newline at end of file +var _0x1552=['show','post','create','put','update','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelTransferReport.controller','index','get','/describe','isAuthenticated','describe','/:id'];(function(_0x12aaee,_0x5bf50c){var _0x37c350=function(_0x182775){while(--_0x182775){_0x12aaee['push'](_0x12aaee['shift']());}};_0x37c350(++_0x5bf50c);}(_0x1552,0x119));var _0x2155=function(_0x3cec45,_0x37d817){_0x3cec45=_0x3cec45-0x0;var _0x51d691=_0x1552[_0x3cec45];return _0x51d691;};'use strict';var multer=require(_0x2155('0x0'));var util=require(_0x2155('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2155('0x2')]();var fs_extra=require(_0x2155('0x3'));var auth=require(_0x2155('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2155('0x5'));var controller=require(_0x2155('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x2155('0x7')]);router[_0x2155('0x8')](_0x2155('0x9'),auth[_0x2155('0xa')](),controller[_0x2155('0xb')]);router['get'](_0x2155('0xc'),auth[_0x2155('0xa')](),controller[_0x2155('0xd')]);router[_0x2155('0xe')]('/',auth['isAuthenticated'](),controller[_0x2155('0xf')]);router[_0x2155('0x10')](_0x2155('0xc'),auth[_0x2155('0xa')](),controller[_0x2155('0x11')]);router[_0x2155('0x12')](_0x2155('0xc'),auth[_0x2155('0xa')](),controller[_0x2155('0x13')]);module[_0x2155('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 6b67a18..7050491 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(_0x10f68e,_0xf198ea){var _0x4c8372=function(_0x38517){while(--_0x38517){_0x10f68e['push'](_0x10f68e['shift']());}};_0x4c8372(++_0xf198ea);}(_0x9bde,0xe1));var _0xe9bd=function(_0x57690f,_0x916b2f){_0x57690f=_0x57690f-0x0;var _0x492f42=_0x9bde[_0x57690f];return _0x492f42;};'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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x137d1d,_0x35c663){var _0x485108=function(_0x108a2a){while(--_0x108a2a){_0x137d1d['push'](_0x137d1d['shift']());}};_0x485108(++_0x35c663);}(_0xb43b,0x1b2));var _0xbb43=function(_0x1ad4ba,_0x1378fa){_0x1ad4ba=_0x1ad4ba-0x0;var _0x269469=_0xb43b[_0x1ad4ba];return _0x269469;};'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/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index a3eefcc..1ddef17 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 _0xc5ca=['OpenchannelTransferReport','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','include','findAll','catch','show','params','keys','rawAttributes','length','includeAll','find','body','destroy','describe','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','Content-Range','reject','save','update','then','error','stack','name','send','index','map'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xc5ca,0x1d7));var _0xac5c=function(_0x32e1d7,_0x5b1cec){_0x32e1d7=_0x32e1d7-0x0;var _0x1f06d5=_0xc5ca[_0x32e1d7];return _0x1f06d5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xac5c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xac5c('0x1'));var moment=require('moment');var BPromise=require(_0xac5c('0x2'));var Mustache=require(_0xac5c('0x3'));var util=require(_0xac5c('0x4'));var path=require(_0xac5c('0x5'));var sox=require(_0xac5c('0x6'));var csv=require(_0xac5c('0x7'));var ejs=require(_0xac5c('0x8'));var fs=require('fs');var fs_extra=require(_0xac5c('0x9'));var _=require(_0xac5c('0xa'));var squel=require(_0xac5c('0xb'));var crypto=require(_0xac5c('0xc'));var jsforce=require(_0xac5c('0xd'));var deskjs=require(_0xac5c('0xe'));var toCsv=require(_0xac5c('0x7'));var querystring=require('querystring');var Papa=require(_0xac5c('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xac5c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xac5c('0x11'));var logger=require('../../config/logger')(_0xac5c('0x12'));var utils=require(_0xac5c('0x13'));var config=require(_0xac5c('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xac5c('0x15'))['db'];function respondWithStatusCode(_0x43912e,_0x3ad062){_0x3ad062=_0x3ad062||0xcc;return function(_0x1dbba3){if(_0x1dbba3){return _0x43912e[_0xac5c('0x16')](_0x3ad062);}return _0x43912e[_0xac5c('0x17')](_0x3ad062)[_0xac5c('0x18')]();};}function respondWithResult(_0x37f8e8,_0x55e605){_0x55e605=_0x55e605||0xc8;return function(_0x266436){if(_0x266436){return _0x37f8e8[_0xac5c('0x17')](_0x55e605)[_0xac5c('0x19')](_0x266436);}};}function respondWithFilteredResult(_0x58d3f2,_0xf6b95d){return function(_0x3f1ca9){if(_0x3f1ca9){var _0x458f09=typeof _0xf6b95d[_0xac5c('0x1a')]==='undefined'&&typeof _0xf6b95d[_0xac5c('0x1b')]===_0xac5c('0x1c');var _0x4f9cfe=_0x3f1ca9['count'];var _0x5c5337=_0x458f09?0x0:_0xf6b95d['offset'];var _0x5b8a78=_0x458f09?_0x3f1ca9['count']:_0xf6b95d[_0xac5c('0x1a')]+_0xf6b95d[_0xac5c('0x1b')];var _0x5b24a0;if(_0x5b8a78>=_0x4f9cfe){_0x5b8a78=_0x4f9cfe;_0x5b24a0=0xc8;}else{_0x5b24a0=0xce;}_0x58d3f2[_0xac5c('0x17')](_0x5b24a0);return _0x58d3f2['set'](_0xac5c('0x1d'),_0x5c5337+'-'+_0x5b8a78+'/'+_0x4f9cfe)[_0xac5c('0x19')](_0x3f1ca9);}return null;};}function patchUpdates(_0x10e159){return function(_0x5b5fbf){try{jsonpatch['apply'](_0x5b5fbf,_0x10e159,!![]);}catch(_0x48c2de){return BPromise[_0xac5c('0x1e')](_0x48c2de);}return _0x5b5fbf[_0xac5c('0x1f')]();};}function saveUpdates(_0x120c44,_0x25e9ab){return function(_0x1de574){if(_0x1de574){return _0x1de574[_0xac5c('0x20')](_0x120c44)['then'](function(_0x4848c3){return _0x4848c3;});}return null;};}function removeEntity(_0x21ac0a,_0x52a458){return function(_0x35911f){if(_0x35911f){return _0x35911f['destroy']()[_0xac5c('0x21')](function(){_0x21ac0a['status'](0xcc)[_0xac5c('0x18')]();});}};}function handleEntityNotFound(_0x2ff3d7,_0x2a5505){return function(_0x3e2c48){if(!_0x3e2c48){_0x2ff3d7['sendStatus'](0x194);}return _0x3e2c48;};}function handleError(_0x23b137,_0xaad7c){_0xaad7c=_0xaad7c||0x1f4;return function(_0x459f9d){logger[_0xac5c('0x22')](_0x459f9d[_0xac5c('0x23')]);if(_0x459f9d[_0xac5c('0x24')]){delete _0x459f9d[_0xac5c('0x24')];}_0x23b137[_0xac5c('0x17')](_0xaad7c)[_0xac5c('0x25')](_0x459f9d);};}exports[_0xac5c('0x26')]=function(_0x3631d9,_0xd47f10){var _0x5baae6={},_0x49f4de={},_0x694be0={'count':0x0,'rows':[]};var _0x34d6db=_[_0xac5c('0x27')](db[_0xac5c('0x28')]['rawAttributes'],function(_0x37a84c){return{'name':_0x37a84c[_0xac5c('0x29')],'type':_0x37a84c[_0xac5c('0x2a')][_0xac5c('0x2b')]};});_0x49f4de[_0xac5c('0x2c')]=_[_0xac5c('0x27')](_0x34d6db,_0xac5c('0x24'));_0x49f4de['query']=_['keys'](_0x3631d9[_0xac5c('0x2d')]);_0x49f4de[_0xac5c('0x2e')]=_['intersection'](_0x49f4de[_0xac5c('0x2c')],_0x49f4de[_0xac5c('0x2d')]);_0x5baae6[_0xac5c('0x2f')]=_[_0xac5c('0x30')](_0x49f4de[_0xac5c('0x2c')],qs[_0xac5c('0x31')](_0x3631d9[_0xac5c('0x2d')][_0xac5c('0x31')]));_0x5baae6[_0xac5c('0x2f')]=_0x5baae6[_0xac5c('0x2f')]['length']?_0x5baae6[_0xac5c('0x2f')]:_0x49f4de[_0xac5c('0x2c')];if(!_0x3631d9[_0xac5c('0x2d')][_0xac5c('0x32')](_0xac5c('0x33'))){_0x5baae6[_0xac5c('0x1b')]=qs[_0xac5c('0x1b')](_0x3631d9[_0xac5c('0x2d')][_0xac5c('0x1b')]);_0x5baae6[_0xac5c('0x1a')]=qs[_0xac5c('0x1a')](_0x3631d9[_0xac5c('0x2d')][_0xac5c('0x1a')]);}_0x5baae6[_0xac5c('0x34')]=qs[_0xac5c('0x35')](_0x3631d9[_0xac5c('0x2d')][_0xac5c('0x35')]);_0x5baae6[_0xac5c('0x36')]=qs[_0xac5c('0x2e')](_[_0xac5c('0x37')](_0x3631d9['query'],_0x49f4de['filters']),_0x34d6db);if(_0x3631d9[_0xac5c('0x2d')][_0xac5c('0x38')]){_0x5baae6[_0xac5c('0x36')]=_[_0xac5c('0x39')](_0x5baae6[_0xac5c('0x36')],{'$or':_[_0xac5c('0x27')](_0x34d6db,function(_0x5ac1c9){if(_0x5ac1c9[_0xac5c('0x2a')]!=='VIRTUAL'){var _0x23a0aa={};_0x23a0aa[_0x5ac1c9[_0xac5c('0x24')]]={'$like':'%'+_0x3631d9[_0xac5c('0x2d')][_0xac5c('0x38')]+'%'};return _0x23a0aa;}})});}_0x5baae6=_['merge']({},_0x5baae6,_0x3631d9[_0xac5c('0x3a')]);var _0xd546f5={'where':_0x5baae6[_0xac5c('0x36')]};return db[_0xac5c('0x28')]['count'](_0xd546f5)['then'](function(_0x3e8828){_0x694be0[_0xac5c('0x3b')]=_0x3e8828;if(_0x3631d9[_0xac5c('0x2d')]['includeAll']){_0x5baae6[_0xac5c('0x3c')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0xac5c('0x3d')](_0x5baae6);})[_0xac5c('0x21')](function(_0xbce587){_0x694be0['rows']=_0xbce587;return _0x694be0;})[_0xac5c('0x21')](respondWithFilteredResult(_0xd47f10,_0x5baae6))[_0xac5c('0x3e')](handleError(_0xd47f10,null));};exports[_0xac5c('0x3f')]=function(_0x20ebf6,_0x3d911a){var _0x287858={'raw':!![],'where':{'id':_0x20ebf6[_0xac5c('0x40')]['id']}},_0x3dd8b3={};_0x3dd8b3['model']=_[_0xac5c('0x41')](db['OpenchannelTransferReport'][_0xac5c('0x42')]);_0x3dd8b3[_0xac5c('0x2d')]=_['keys'](_0x20ebf6['query']);_0x3dd8b3[_0xac5c('0x2e')]=_[_0xac5c('0x30')](_0x3dd8b3[_0xac5c('0x2c')],_0x3dd8b3[_0xac5c('0x2d')]);_0x287858[_0xac5c('0x2f')]=_['intersection'](_0x3dd8b3['model'],qs[_0xac5c('0x31')](_0x20ebf6[_0xac5c('0x2d')][_0xac5c('0x31')]));_0x287858['attributes']=_0x287858['attributes'][_0xac5c('0x43')]?_0x287858[_0xac5c('0x2f')]:_0x3dd8b3[_0xac5c('0x2c')];if(_0x20ebf6[_0xac5c('0x2d')][_0xac5c('0x44')]){_0x287858[_0xac5c('0x3c')]=[{'all':!![]}];}_0x287858=_[_0xac5c('0x39')]({},_0x287858,_0x20ebf6[_0xac5c('0x3a')]);return db[_0xac5c('0x28')][_0xac5c('0x45')](_0x287858)[_0xac5c('0x21')](handleEntityNotFound(_0x3d911a,null))[_0xac5c('0x21')](respondWithResult(_0x3d911a,null))[_0xac5c('0x3e')](handleError(_0x3d911a,null));};exports['create']=function(_0x3a9ffc,_0x502eca){return db[_0xac5c('0x28')]['create'](_0x3a9ffc[_0xac5c('0x46')],{})[_0xac5c('0x21')](respondWithResult(_0x502eca,0xc9))[_0xac5c('0x3e')](handleError(_0x502eca,null));};exports[_0xac5c('0x20')]=function(_0x6769ae,_0x47e501){if(_0x6769ae[_0xac5c('0x46')]['id']){delete _0x6769ae[_0xac5c('0x46')]['id'];}return db[_0xac5c('0x28')][_0xac5c('0x45')]({'where':{'id':_0x6769ae[_0xac5c('0x40')]['id']}})['then'](handleEntityNotFound(_0x47e501,null))[_0xac5c('0x21')](saveUpdates(_0x6769ae[_0xac5c('0x46')],null))[_0xac5c('0x21')](respondWithResult(_0x47e501,null))[_0xac5c('0x3e')](handleError(_0x47e501,null));};exports[_0xac5c('0x47')]=function(_0x504e61,_0x6ba5e0){return db['OpenchannelTransferReport'][_0xac5c('0x45')]({'where':{'id':_0x504e61[_0xac5c('0x40')]['id']}})[_0xac5c('0x21')](handleEntityNotFound(_0x6ba5e0,null))[_0xac5c('0x21')](removeEntity(_0x6ba5e0,null))[_0xac5c('0x3e')](handleError(_0x6ba5e0,null));};exports[_0xac5c('0x48')]=function(_0x58c75e,_0x38744c){return db[_0xac5c('0x28')][_0xac5c('0x48')]()[_0xac5c('0x21')](respondWithResult(_0x38744c,null))[_0xac5c('0x3e')](handleError(_0x38744c,null));}; \ No newline at end of file +var _0x6fa6=['hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','OpenchannelTransferReport','include','findAll','rows','show','keys','find','catch','create','params','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x6fa6,0x191));var _0x66fa=function(_0x1ebb98,_0x3c3419){_0x1ebb98=_0x1ebb98-0x0;var _0x3d07e0=_0x6fa6[_0x1ebb98];return _0x3d07e0;};'use strict';var emlformat=require(_0x66fa('0x0'));var rimraf=require(_0x66fa('0x1'));var zipdir=require(_0x66fa('0x2'));var jsonpatch=require(_0x66fa('0x3'));var rp=require(_0x66fa('0x4'));var moment=require('moment');var BPromise=require(_0x66fa('0x5'));var Mustache=require(_0x66fa('0x6'));var util=require(_0x66fa('0x7'));var path=require(_0x66fa('0x8'));var sox=require(_0x66fa('0x9'));var csv=require('to-csv');var ejs=require(_0x66fa('0xa'));var fs=require('fs');var fs_extra=require(_0x66fa('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x66fa('0xc'));var jsforce=require(_0x66fa('0xd'));var deskjs=require(_0x66fa('0xe'));var toCsv=require(_0x66fa('0xf'));var querystring=require(_0x66fa('0x10'));var Papa=require(_0x66fa('0x11'));var Redis=require(_0x66fa('0x12'));var authService=require(_0x66fa('0x13'));var qs=require(_0x66fa('0x14'));var as=require(_0x66fa('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x66fa('0x16'))('api');var utils=require(_0x66fa('0x17'));var config=require(_0x66fa('0x18'));var licenseUtil=require(_0x66fa('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e1296,_0x23f72a){_0x23f72a=_0x23f72a||0xcc;return function(_0x2406db){if(_0x2406db){return _0x4e1296['sendStatus'](_0x23f72a);}return _0x4e1296[_0x66fa('0x1a')](_0x23f72a)['end']();};}function respondWithResult(_0x2f014e,_0x48d85d){_0x48d85d=_0x48d85d||0xc8;return function(_0x11139d){if(_0x11139d){return _0x2f014e[_0x66fa('0x1a')](_0x48d85d)['json'](_0x11139d);}};}function respondWithFilteredResult(_0x2ad164,_0x51498f){return function(_0x3313bb){if(_0x3313bb){var _0xfd8080=typeof _0x51498f['offset']===_0x66fa('0x1b')&&typeof _0x51498f[_0x66fa('0x1c')]==='undefined';var _0x46dde1=_0x3313bb[_0x66fa('0x1d')];var _0x2c7ddb=_0xfd8080?0x0:_0x51498f[_0x66fa('0x1e')];var _0x575059=_0xfd8080?_0x3313bb[_0x66fa('0x1d')]:_0x51498f[_0x66fa('0x1e')]+_0x51498f['limit'];var _0x776214;if(_0x575059>=_0x46dde1){_0x575059=_0x46dde1;_0x776214=0xc8;}else{_0x776214=0xce;}_0x2ad164[_0x66fa('0x1a')](_0x776214);return _0x2ad164['set'](_0x66fa('0x1f'),_0x2c7ddb+'-'+_0x575059+'/'+_0x46dde1)[_0x66fa('0x20')](_0x3313bb);}return null;};}function patchUpdates(_0x3470da){return function(_0x1696d5){try{jsonpatch[_0x66fa('0x21')](_0x1696d5,_0x3470da,!![]);}catch(_0x5505a4){return BPromise[_0x66fa('0x22')](_0x5505a4);}return _0x1696d5[_0x66fa('0x23')]();};}function saveUpdates(_0x2119d8,_0x18f27a){return function(_0x4666f7){if(_0x4666f7){return _0x4666f7[_0x66fa('0x24')](_0x2119d8)['then'](function(_0x2c7638){return _0x2c7638;});}return null;};}function removeEntity(_0x1be693,_0x13a351){return function(_0x3adfe9){if(_0x3adfe9){return _0x3adfe9[_0x66fa('0x25')]()[_0x66fa('0x26')](function(){_0x1be693[_0x66fa('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50580c,_0x30a7d8){return function(_0x2ecae2){if(!_0x2ecae2){_0x50580c['sendStatus'](0x194);}return _0x2ecae2;};}function handleError(_0x3dc00f,_0x5a22af){_0x5a22af=_0x5a22af||0x1f4;return function(_0x3c52bf){logger[_0x66fa('0x27')](_0x3c52bf[_0x66fa('0x28')]);if(_0x3c52bf['name']){delete _0x3c52bf[_0x66fa('0x29')];}_0x3dc00f[_0x66fa('0x1a')](_0x5a22af)[_0x66fa('0x2a')](_0x3c52bf);};}exports[_0x66fa('0x2b')]=function(_0x1b7b8a,_0xedac21){var _0x39d3e7={},_0x198dc0={},_0x18ce22={'count':0x0,'rows':[]};var _0x1cd406=_[_0x66fa('0x2c')](db['OpenchannelTransferReport'][_0x66fa('0x2d')],function(_0x4802ce){return{'name':_0x4802ce[_0x66fa('0x2e')],'type':_0x4802ce[_0x66fa('0x2f')]['key']};});_0x198dc0[_0x66fa('0x30')]=_[_0x66fa('0x2c')](_0x1cd406,_0x66fa('0x29'));_0x198dc0[_0x66fa('0x31')]=_['keys'](_0x1b7b8a[_0x66fa('0x31')]);_0x198dc0[_0x66fa('0x32')]=_[_0x66fa('0x33')](_0x198dc0['model'],_0x198dc0[_0x66fa('0x31')]);_0x39d3e7[_0x66fa('0x34')]=_[_0x66fa('0x33')](_0x198dc0[_0x66fa('0x30')],qs[_0x66fa('0x35')](_0x1b7b8a['query'][_0x66fa('0x35')]));_0x39d3e7[_0x66fa('0x34')]=_0x39d3e7[_0x66fa('0x34')][_0x66fa('0x36')]?_0x39d3e7[_0x66fa('0x34')]:_0x198dc0[_0x66fa('0x30')];if(!_0x1b7b8a[_0x66fa('0x31')][_0x66fa('0x37')](_0x66fa('0x38'))){_0x39d3e7[_0x66fa('0x1c')]=qs['limit'](_0x1b7b8a[_0x66fa('0x31')][_0x66fa('0x1c')]);_0x39d3e7[_0x66fa('0x1e')]=qs[_0x66fa('0x1e')](_0x1b7b8a[_0x66fa('0x31')][_0x66fa('0x1e')]);}_0x39d3e7[_0x66fa('0x39')]=qs[_0x66fa('0x3a')](_0x1b7b8a[_0x66fa('0x31')][_0x66fa('0x3a')]);_0x39d3e7[_0x66fa('0x3b')]=qs[_0x66fa('0x32')](_[_0x66fa('0x3c')](_0x1b7b8a[_0x66fa('0x31')],_0x198dc0['filters']),_0x1cd406);if(_0x1b7b8a[_0x66fa('0x31')]['filter']){_0x39d3e7['where']=_[_0x66fa('0x3d')](_0x39d3e7[_0x66fa('0x3b')],{'$or':_[_0x66fa('0x2c')](_0x1cd406,function(_0x446f7a){if(_0x446f7a['type']!==_0x66fa('0x3e')){var _0x7c57a9={};_0x7c57a9[_0x446f7a['name']]={'$like':'%'+_0x1b7b8a[_0x66fa('0x31')]['filter']+'%'};return _0x7c57a9;}})});}_0x39d3e7=_[_0x66fa('0x3d')]({},_0x39d3e7,_0x1b7b8a[_0x66fa('0x3f')]);var _0x332314={'where':_0x39d3e7[_0x66fa('0x3b')]};return db[_0x66fa('0x40')]['count'](_0x332314)[_0x66fa('0x26')](function(_0x2a5cab){_0x18ce22[_0x66fa('0x1d')]=_0x2a5cab;if(_0x1b7b8a[_0x66fa('0x31')]['includeAll']){_0x39d3e7[_0x66fa('0x41')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x66fa('0x42')](_0x39d3e7);})[_0x66fa('0x26')](function(_0x1389ce){_0x18ce22[_0x66fa('0x43')]=_0x1389ce;return _0x18ce22;})[_0x66fa('0x26')](respondWithFilteredResult(_0xedac21,_0x39d3e7))['catch'](handleError(_0xedac21,null));};exports[_0x66fa('0x44')]=function(_0x47d991,_0x5e30ae){var _0xce5f65={'raw':!![],'where':{'id':_0x47d991['params']['id']}},_0xd5eebc={};_0xd5eebc['model']=_[_0x66fa('0x45')](db[_0x66fa('0x40')]['rawAttributes']);_0xd5eebc['query']=_['keys'](_0x47d991[_0x66fa('0x31')]);_0xd5eebc[_0x66fa('0x32')]=_[_0x66fa('0x33')](_0xd5eebc[_0x66fa('0x30')],_0xd5eebc[_0x66fa('0x31')]);_0xce5f65[_0x66fa('0x34')]=_['intersection'](_0xd5eebc['model'],qs[_0x66fa('0x35')](_0x47d991[_0x66fa('0x31')][_0x66fa('0x35')]));_0xce5f65[_0x66fa('0x34')]=_0xce5f65[_0x66fa('0x34')]['length']?_0xce5f65[_0x66fa('0x34')]:_0xd5eebc[_0x66fa('0x30')];if(_0x47d991[_0x66fa('0x31')]['includeAll']){_0xce5f65[_0x66fa('0x41')]=[{'all':!![]}];}_0xce5f65=_['merge']({},_0xce5f65,_0x47d991[_0x66fa('0x3f')]);return db[_0x66fa('0x40')][_0x66fa('0x46')](_0xce5f65)[_0x66fa('0x26')](handleEntityNotFound(_0x5e30ae,null))[_0x66fa('0x26')](respondWithResult(_0x5e30ae,null))[_0x66fa('0x47')](handleError(_0x5e30ae,null));};exports[_0x66fa('0x48')]=function(_0x162e4a,_0x27722a){return db['OpenchannelTransferReport'][_0x66fa('0x48')](_0x162e4a['body'],{})[_0x66fa('0x26')](respondWithResult(_0x27722a,0xc9))[_0x66fa('0x47')](handleError(_0x27722a,null));};exports['update']=function(_0x10dedd,_0x27b682){if(_0x10dedd['body']['id']){delete _0x10dedd['body']['id'];}return db[_0x66fa('0x40')]['find']({'where':{'id':_0x10dedd[_0x66fa('0x49')]['id']}})[_0x66fa('0x26')](handleEntityNotFound(_0x27b682,null))[_0x66fa('0x26')](saveUpdates(_0x10dedd[_0x66fa('0x4a')],null))[_0x66fa('0x26')](respondWithResult(_0x27b682,null))[_0x66fa('0x47')](handleError(_0x27b682,null));};exports[_0x66fa('0x25')]=function(_0x5a21dc,_0xbb6c9){return db[_0x66fa('0x40')][_0x66fa('0x46')]({'where':{'id':_0x5a21dc[_0x66fa('0x49')]['id']}})['then'](handleEntityNotFound(_0xbb6c9,null))[_0x66fa('0x26')](removeEntity(_0xbb6c9,null))['catch'](handleError(_0xbb6c9,null));};exports[_0x66fa('0x4b')]=function(_0x50ce00,_0x44e799){return db[_0x66fa('0x40')][_0x66fa('0x4b')]()[_0x66fa('0x26')](respondWithResult(_0x44e799,null))[_0x66fa('0x47')](handleError(_0x44e799,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index e4f19ed..f2639e2 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 _0x77e3=['report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./openchannelTransferReport.attributes','define','OpenchannelTransferReport'];(function(_0x5d052b,_0x4e56f1){var _0x1868d7=function(_0x1f2561){while(--_0x1f2561){_0x5d052b['push'](_0x5d052b['shift']());}};_0x1868d7(++_0x4e56f1);}(_0x77e3,0x1c9));var _0x377e=function(_0x5a6d8e,_0x1d47e2){_0x5a6d8e=_0x5a6d8e-0x0;var _0x98f676=_0x77e3[_0x5a6d8e];return _0x98f676;};'use strict';var _=require(_0x377e('0x0'));var util=require(_0x377e('0x1'));var logger=require(_0x377e('0x2'))(_0x377e('0x3'));var moment=require(_0x377e('0x4'));var BPromise=require(_0x377e('0x5'));var rp=require(_0x377e('0x6'));var fs=require('fs');var path=require(_0x377e('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x377e('0x8'));module['exports']=function(_0x276c0f,_0x40da61){return _0x276c0f[_0x377e('0x9')](_0x377e('0xa'),attributes,{'tableName':_0x377e('0xb'),'paranoid':![],'indexes':[{'name':_0x377e('0xc'),'fields':[_0x377e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb9d0=['moment','path','rimraf','../../config/environment','define','report_openchannel_transfer','uniqueid','lodash','util','api'];(function(_0x366e99,_0x15d82d){var _0x180bbe=function(_0x282498){while(--_0x282498){_0x366e99['push'](_0x366e99['shift']());}};_0x180bbe(++_0x15d82d);}(_0xb9d0,0x1d3));var _0x0b9d=function(_0x3cfc05,_0x4a2b66){_0x3cfc05=_0x3cfc05-0x0;var _0x5cdf91=_0xb9d0[_0x3cfc05];return _0x5cdf91;};'use strict';var _=require(_0x0b9d('0x0'));var util=require(_0x0b9d('0x1'));var logger=require('../../config/logger')(_0x0b9d('0x2'));var moment=require(_0x0b9d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0b9d('0x4'));var rimraf=require(_0x0b9d('0x5'));var config=require(_0x0b9d('0x6'));var attributes=require('./openchannelTransferReport.attributes');module['exports']=function(_0x12a3c8,_0x1dbada){return _0x12a3c8[_0x0b9d('0x7')]('OpenchannelTransferReport',attributes,{'tableName':_0x0b9d('0x8'),'paranoid':![],'indexes':[{'name':_0x0b9d('0x9'),'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 bb60279..58387e6 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 _0x8375=['OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x548dca,_0x178a8b){var _0xe8c63a=function(_0x206f26){while(--_0x206f26){_0x548dca['push'](_0x548dca['shift']());}};_0xe8c63a(++_0x178a8b);}(_0x8375,0xa8));var _0x5837=function(_0x6cbbf9,_0x15396d){_0x6cbbf9=_0x6cbbf9-0x0;var _0xd7ac14=_0x8375[_0x6cbbf9];return _0xd7ac14;};'use strict';var _=require(_0x5837('0x0'));var util=require(_0x5837('0x1'));var moment=require(_0x5837('0x2'));var BPromise=require('bluebird');var rs=require(_0x5837('0x3'));var fs=require('fs');var Redis=require(_0x5837('0x4'));var db=require(_0x5837('0x5'))['db'];var utils=require(_0x5837('0x6'));var logger=require(_0x5837('0x7'))(_0x5837('0x8'));var config=require('../../config/environment');var jayson=require(_0x5837('0x9'));var client=jayson[_0x5837('0xa')][_0x5837('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e383c,_0x3b11c3,_0x5bc421){return new BPromise(function(_0x508caf,_0x1e44c4){return client[_0x5837('0xc')](_0x2e383c,_0x5bc421)['then'](function(_0x24ca00){logger['info'](_0x5837('0xd'),_0x3b11c3,_0x5837('0xe'));logger[_0x5837('0xf')](_0x5837('0x10'),_0x3b11c3,_0x5837('0xe'),JSON[_0x5837('0x11')](_0x24ca00));if(_0x24ca00['error']){if(_0x24ca00[_0x5837('0x12')][_0x5837('0x13')]===0x1f4){logger[_0x5837('0x12')](_0x5837('0xd'),_0x3b11c3,_0x24ca00[_0x5837('0x12')]['message']);return _0x1e44c4(_0x24ca00['error']['message']);}logger[_0x5837('0x12')](_0x5837('0xd'),_0x3b11c3,_0x24ca00[_0x5837('0x12')][_0x5837('0x14')]);return _0x508caf(_0x24ca00[_0x5837('0x12')][_0x5837('0x14')]);}else{logger[_0x5837('0x15')](_0x5837('0xd'),_0x3b11c3,_0x5837('0xe'));_0x508caf(_0x24ca00['result'][_0x5837('0x14')]);}})[_0x5837('0x16')](function(_0x57342d){logger[_0x5837('0x12')](_0x5837('0xd'),_0x3b11c3,_0x57342d);_0x1e44c4(_0x57342d);});});} \ No newline at end of file +var _0x9829=['then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request'];(function(_0x249ed5,_0xa94c32){var _0x4e81f0=function(_0x202682){while(--_0x202682){_0x249ed5['push'](_0x249ed5['shift']());}};_0x4e81f0(++_0xa94c32);}(_0x9829,0xc4));var _0x9982=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x9829[_0x1caf6a];return _0x1bf493;};'use strict';var _=require(_0x9982('0x0'));var util=require(_0x9982('0x1'));var moment=require(_0x9982('0x2'));var BPromise=require(_0x9982('0x3'));var rs=require(_0x9982('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9982('0x5'))['db'];var utils=require(_0x9982('0x6'));var logger=require(_0x9982('0x7'))('rpc');var config=require(_0x9982('0x8'));var jayson=require(_0x9982('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x340d62,_0x35a93f,_0x5d0824){return new BPromise(function(_0x25f30a,_0x1a3931){return client[_0x9982('0xa')](_0x340d62,_0x5d0824)[_0x9982('0xb')](function(_0x1e7881){logger[_0x9982('0xc')](_0x9982('0xd'),_0x35a93f,_0x9982('0xe'));logger[_0x9982('0xf')](_0x9982('0x10'),_0x35a93f,_0x9982('0xe'),JSON[_0x9982('0x11')](_0x1e7881));if(_0x1e7881[_0x9982('0x12')]){if(_0x1e7881[_0x9982('0x12')][_0x9982('0x13')]===0x1f4){logger[_0x9982('0x12')](_0x9982('0xd'),_0x35a93f,_0x1e7881[_0x9982('0x12')]['message']);return _0x1a3931(_0x1e7881[_0x9982('0x12')][_0x9982('0x14')]);}logger['error'](_0x9982('0xd'),_0x35a93f,_0x1e7881['error'][_0x9982('0x14')]);return _0x25f30a(_0x1e7881[_0x9982('0x12')][_0x9982('0x14')]);}else{logger[_0x9982('0xc')](_0x9982('0xd'),_0x35a93f,_0x9982('0xe'));_0x25f30a(_0x1e7881[_0x9982('0x15')][_0x9982('0x14')]);}})[_0x9982('0x16')](function(_0x50ca89){logger[_0x9982('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x35a93f,_0x50ca89);_0x1a3931(_0x50ca89);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 96afdba..6b2a7ba 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 _0xc9eb=['../../config/environment','./pause.controller','get','/:id','isAuthenticated','post','create','update','delete','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x48c262,_0x433b1e){var _0x3ee79d=function(_0x2f110d){while(--_0x2f110d){_0x48c262['push'](_0x48c262['shift']());}};_0x3ee79d(++_0x433b1e);}(_0xc9eb,0xf9));var _0xbc9e=function(_0x1ebeaf,_0x2b7387){_0x1ebeaf=_0x1ebeaf-0x0;var _0x388001=_0xc9eb[_0x1ebeaf];return _0x388001;};'use strict';var multer=require(_0xbc9e('0x0'));var util=require(_0xbc9e('0x1'));var path=require('path');var timeout=require(_0xbc9e('0x2'));var express=require(_0xbc9e('0x3'));var router=express['Router']();var fs_extra=require(_0xbc9e('0x4'));var auth=require(_0xbc9e('0x5'));var interaction=require(_0xbc9e('0x6'));var config=require(_0xbc9e('0x7'));var controller=require(_0xbc9e('0x8'));router[_0xbc9e('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xbc9e('0x9')](_0xbc9e('0xa'),auth[_0xbc9e('0xb')](),controller['show']);router[_0xbc9e('0xc')]('/',auth[_0xbc9e('0xb')](),controller[_0xbc9e('0xd')]);router['put'](_0xbc9e('0xa'),auth[_0xbc9e('0xb')](),controller[_0xbc9e('0xe')]);router[_0xbc9e('0xf')](_0xbc9e('0xa'),auth[_0xbc9e('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x109b=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x109b,0xf3));var _0xb109=function(_0x2fb845,_0x54c3ab){_0x2fb845=_0x2fb845-0x0;var _0x1756c9=_0x109b[_0x2fb845];return _0x1756c9;};'use strict';var multer=require(_0xb109('0x0'));var util=require(_0xb109('0x1'));var path=require(_0xb109('0x2'));var timeout=require(_0xb109('0x3'));var express=require(_0xb109('0x4'));var router=express[_0xb109('0x5')]();var fs_extra=require(_0xb109('0x6'));var auth=require(_0xb109('0x7'));var interaction=require(_0xb109('0x8'));var config=require(_0xb109('0x9'));var controller=require(_0xb109('0xa'));router[_0xb109('0xb')]('/',auth[_0xb109('0xc')](),controller['index']);router[_0xb109('0xb')](_0xb109('0xd'),auth[_0xb109('0xc')](),controller[_0xb109('0xe')]);router[_0xb109('0xf')]('/',auth[_0xb109('0xc')](),controller[_0xb109('0x10')]);router[_0xb109('0x11')](_0xb109('0xd'),auth[_0xb109('0xc')](),controller[_0xb109('0x12')]);router[_0xb109('0x13')](_0xb109('0xd'),auth[_0xb109('0xc')](),controller[_0xb109('0x14')]);module[_0xb109('0x15')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 9b4026a..1cf1700 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 _0x1046=['STRING','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1046,0x1f2));var _0x6104=function(_0x562f9a,_0x2da4e5){_0x562f9a=_0x562f9a-0x0;var _0x5b2464=_0x1046[_0x562f9a];return _0x5b2464;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6104('0x0')],'unique':_0x6104('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x6104('0x0')]}}; \ No newline at end of file +var _0x1d78=['name'];(function(_0x1d50f2,_0x3c3ec6){var _0x3769b8=function(_0x50926a){while(--_0x50926a){_0x1d50f2['push'](_0x1d50f2['shift']());}};_0x3769b8(++_0x3c3ec6);}(_0x1d78,0x64));var _0x81d7=function(_0x21a09b,_0x440f0c){_0x21a09b=_0x21a09b-0x0;var _0x28f8a1=_0x1d78[_0x21a09b];return _0x28f8a1;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x81d7('0x0'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index d8c748c..4144f45 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 _0x7928=['eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../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','then','get','Pauses','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','merge','type','VIRTUAL','filter','options','includeAll','include','Pause','findAll','rows','show','params','keys','find','catch','create','user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy'];(function(_0x23989e,_0x115ca2){var _0x136eb3=function(_0x4d6035){while(--_0x4d6035){_0x23989e['push'](_0x23989e['shift']());}};_0x136eb3(++_0x115ca2);}(_0x7928,0xa4));var _0x8792=function(_0x274395,_0x1d5e35){_0x274395=_0x274395-0x0;var _0x1df722=_0x7928[_0x274395];return _0x1df722;};'use strict';var emlformat=require(_0x8792('0x0'));var rimraf=require(_0x8792('0x1'));var zipdir=require(_0x8792('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8792('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8792('0x4'));var util=require(_0x8792('0x5'));var path=require(_0x8792('0x6'));var sox=require(_0x8792('0x7'));var csv=require('to-csv');var ejs=require(_0x8792('0x8'));var fs=require('fs');var fs_extra=require(_0x8792('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8792('0xa'));var jsforce=require(_0x8792('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x8792('0xc'));var querystring=require(_0x8792('0xd'));var Papa=require(_0x8792('0xe'));var Redis=require('ioredis');var authService=require(_0x8792('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8792('0x10'));var logger=require(_0x8792('0x11'))(_0x8792('0x12'));var utils=require(_0x8792('0x13'));var config=require(_0x8792('0x14'));var licenseUtil=require(_0x8792('0x15'));var db=require(_0x8792('0x16'))['db'];function respondWithStatusCode(_0x3f01ff,_0x158b6b){_0x158b6b=_0x158b6b||0xcc;return function(_0x3a1827){if(_0x3a1827){return _0x3f01ff[_0x8792('0x17')](_0x158b6b);}return _0x3f01ff[_0x8792('0x18')](_0x158b6b)[_0x8792('0x19')]();};}function respondWithResult(_0x242d65,_0x5b3c4f){_0x5b3c4f=_0x5b3c4f||0xc8;return function(_0x34a852){if(_0x34a852){return _0x242d65[_0x8792('0x18')](_0x5b3c4f)[_0x8792('0x1a')](_0x34a852);}};}function respondWithFilteredResult(_0x2f731c,_0x50b798){return function(_0x55a576){if(_0x55a576){var _0xebda4=typeof _0x50b798[_0x8792('0x1b')]==='undefined'&&typeof _0x50b798['limit']===_0x8792('0x1c');var _0x4c4962=_0x55a576[_0x8792('0x1d')];var _0x3dd470=_0xebda4?0x0:_0x50b798['offset'];var _0x169fce=_0xebda4?_0x55a576[_0x8792('0x1d')]:_0x50b798['offset']+_0x50b798[_0x8792('0x1e')];var _0x21ef82;if(_0x169fce>=_0x4c4962){_0x169fce=_0x4c4962;_0x21ef82=0xc8;}else{_0x21ef82=0xce;}_0x2f731c[_0x8792('0x18')](_0x21ef82);return _0x2f731c[_0x8792('0x1f')](_0x8792('0x20'),_0x3dd470+'-'+_0x169fce+'/'+_0x4c4962)[_0x8792('0x1a')](_0x55a576);}return null;};}function patchUpdates(_0x2adb54){return function(_0x447569){try{jsonpatch[_0x8792('0x21')](_0x447569,_0x2adb54,!![]);}catch(_0x2dc486){return BPromise[_0x8792('0x22')](_0x2dc486);}return _0x447569[_0x8792('0x23')]();};}function saveUpdates(_0x536461,_0x5e97e4){return function(_0x21da6b){if(_0x21da6b){return _0x21da6b[_0x8792('0x24')](_0x536461)[_0x8792('0x25')](function(_0x33235d){return _0x33235d;});}return null;};}function removeEntity(_0x489285,_0x29d364){return function(_0x34cc2e){if(_0x34cc2e){return _0x34cc2e['destroy']()['then'](function(){var _0x4e83f6=_0x34cc2e[_0x8792('0x26')]({'plain':!![]});var _0x48cfcd=_0x8792('0x27');return db[_0x8792('0x28')]['destroy']({'where':{'type':_0x48cfcd,'resourceId':_0x4e83f6['id']}})[_0x8792('0x25')](function(){return _0x34cc2e;});})[_0x8792('0x25')](function(){_0x489285[_0x8792('0x18')](0xcc)[_0x8792('0x19')]();});}};}function handleEntityNotFound(_0x46db98,_0xf3d118){return function(_0x5c92bf){if(!_0x5c92bf){_0x46db98['sendStatus'](0x194);}return _0x5c92bf;};}function handleError(_0x2cb472,_0x1c2cba){_0x1c2cba=_0x1c2cba||0x1f4;return function(_0x705e5a){logger[_0x8792('0x29')](_0x705e5a[_0x8792('0x2a')]);if(_0x705e5a['name']){delete _0x705e5a[_0x8792('0x2b')];}_0x2cb472[_0x8792('0x18')](_0x1c2cba)[_0x8792('0x2c')](_0x705e5a);};}exports[_0x8792('0x2d')]=function(_0x3311d4,_0x5134c9){var _0x8f2c97={},_0x261047={},_0x5bc009={'count':0x0,'rows':[]};var _0x44ee07=_[_0x8792('0x2e')](db['Pause'][_0x8792('0x2f')],function(_0x596413){return{'name':_0x596413[_0x8792('0x30')],'type':_0x596413['type'][_0x8792('0x31')]};});_0x261047[_0x8792('0x32')]=_[_0x8792('0x2e')](_0x44ee07,'name');_0x261047['query']=_['keys'](_0x3311d4[_0x8792('0x33')]);_0x261047[_0x8792('0x34')]=_[_0x8792('0x35')](_0x261047['model'],_0x261047[_0x8792('0x33')]);_0x8f2c97[_0x8792('0x36')]=_[_0x8792('0x35')](_0x261047['model'],qs[_0x8792('0x37')](_0x3311d4[_0x8792('0x33')][_0x8792('0x37')]));_0x8f2c97[_0x8792('0x36')]=_0x8f2c97['attributes'][_0x8792('0x38')]?_0x8f2c97['attributes']:_0x261047[_0x8792('0x32')];if(!_0x3311d4[_0x8792('0x33')]['hasOwnProperty'](_0x8792('0x39'))){_0x8f2c97['limit']=qs[_0x8792('0x1e')](_0x3311d4[_0x8792('0x33')][_0x8792('0x1e')]);_0x8f2c97['offset']=qs[_0x8792('0x1b')](_0x3311d4[_0x8792('0x33')][_0x8792('0x1b')]);}_0x8f2c97['order']=qs[_0x8792('0x3a')](_0x3311d4['query'][_0x8792('0x3a')]);_0x8f2c97[_0x8792('0x3b')]=qs[_0x8792('0x34')](_['pick'](_0x3311d4[_0x8792('0x33')],_0x261047[_0x8792('0x34')]),_0x44ee07);if(_0x3311d4[_0x8792('0x33')]['filter']){_0x8f2c97[_0x8792('0x3b')]=_[_0x8792('0x3c')](_0x8f2c97[_0x8792('0x3b')],{'$or':_[_0x8792('0x2e')](_0x44ee07,function(_0x33e8c9){if(_0x33e8c9[_0x8792('0x3d')]!==_0x8792('0x3e')){var _0x319d81={};_0x319d81[_0x33e8c9[_0x8792('0x2b')]]={'$like':'%'+_0x3311d4[_0x8792('0x33')][_0x8792('0x3f')]+'%'};return _0x319d81;}})});}_0x8f2c97=_[_0x8792('0x3c')]({},_0x8f2c97,_0x3311d4[_0x8792('0x40')]);var _0x399736={'where':_0x8f2c97[_0x8792('0x3b')]};return db['Pause'][_0x8792('0x1d')](_0x399736)[_0x8792('0x25')](function(_0x5595f6){_0x5bc009['count']=_0x5595f6;if(_0x3311d4[_0x8792('0x33')][_0x8792('0x41')]){_0x8f2c97[_0x8792('0x42')]=[{'all':!![]}];}return db[_0x8792('0x43')][_0x8792('0x44')](_0x8f2c97);})['then'](function(_0x454bdd){_0x5bc009[_0x8792('0x45')]=_0x454bdd;return _0x5bc009;})[_0x8792('0x25')](respondWithFilteredResult(_0x5134c9,_0x8f2c97))['catch'](handleError(_0x5134c9,null));};exports[_0x8792('0x46')]=function(_0x2f5428,_0x15910c){var _0x1c8a8e={'raw':!![],'where':{'id':_0x2f5428[_0x8792('0x47')]['id']}},_0x3ac4fe={};_0x3ac4fe[_0x8792('0x32')]=_[_0x8792('0x48')](db['Pause'][_0x8792('0x2f')]);_0x3ac4fe[_0x8792('0x33')]=_[_0x8792('0x48')](_0x2f5428['query']);_0x3ac4fe['filters']=_[_0x8792('0x35')](_0x3ac4fe['model'],_0x3ac4fe[_0x8792('0x33')]);_0x1c8a8e[_0x8792('0x36')]=_[_0x8792('0x35')](_0x3ac4fe[_0x8792('0x32')],qs[_0x8792('0x37')](_0x2f5428[_0x8792('0x33')][_0x8792('0x37')]));_0x1c8a8e['attributes']=_0x1c8a8e[_0x8792('0x36')][_0x8792('0x38')]?_0x1c8a8e[_0x8792('0x36')]:_0x3ac4fe['model'];if(_0x2f5428[_0x8792('0x33')][_0x8792('0x41')]){_0x1c8a8e[_0x8792('0x42')]=[{'all':!![]}];}_0x1c8a8e=_['merge']({},_0x1c8a8e,_0x2f5428[_0x8792('0x40')]);return db[_0x8792('0x43')][_0x8792('0x49')](_0x1c8a8e)[_0x8792('0x25')](handleEntityNotFound(_0x15910c,null))[_0x8792('0x25')](respondWithResult(_0x15910c,null))[_0x8792('0x4a')](handleError(_0x15910c,null));};exports[_0x8792('0x4b')]=function(_0x3e1735,_0x76d376){return db[_0x8792('0x43')][_0x8792('0x4b')](_0x3e1735['body'],{})['then'](function(_0x586473){var _0x79b19d=_0x3e1735[_0x8792('0x4c')][_0x8792('0x26')]({'plain':!![]});if(!_0x79b19d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x79b19d[_0x8792('0x4d')]==='user'){var _0x58e55b=_0x586473[_0x8792('0x26')]({'plain':!![]});var _0x5559a5=_0x8792('0x27');return db[_0x8792('0x4e')][_0x8792('0x49')]({'where':{'name':_0x5559a5,'userProfileId':_0x79b19d['userProfileId']},'raw':!![]})[_0x8792('0x25')](function(_0x2b53be){if(_0x2b53be&&_0x2b53be['autoAssociation']===0x0){return db[_0x8792('0x28')][_0x8792('0x4b')]({'name':_0x58e55b[_0x8792('0x2b')],'resourceId':_0x58e55b['id'],'type':_0x2b53be[_0x8792('0x2b')],'sectionId':_0x2b53be['id']},{})[_0x8792('0x25')](function(){return _0x586473;});}else{return _0x586473;}})[_0x8792('0x4a')](function(_0x338b94){logger[_0x8792('0x29')](_0x8792('0x4f'),_0x338b94);throw _0x338b94;});}return _0x586473;})[_0x8792('0x25')](respondWithResult(_0x76d376,0xc9))[_0x8792('0x4a')](handleError(_0x76d376,null));};exports[_0x8792('0x24')]=function(_0x5a5126,_0x2949e4){if(_0x5a5126[_0x8792('0x50')]['id']){delete _0x5a5126[_0x8792('0x50')]['id'];}return db[_0x8792('0x43')][_0x8792('0x49')]({'where':{'id':_0x5a5126[_0x8792('0x47')]['id']}})['then'](handleEntityNotFound(_0x2949e4,null))['then'](saveUpdates(_0x5a5126[_0x8792('0x50')],null))[_0x8792('0x25')](respondWithResult(_0x2949e4,null))['catch'](handleError(_0x2949e4,null));};exports[_0x8792('0x51')]=function(_0x48141d,_0x35652f){return db[_0x8792('0x43')][_0x8792('0x49')]({'where':{'id':_0x48141d[_0x8792('0x47')]['id']}})[_0x8792('0x25')](handleEntityNotFound(_0x35652f,null))[_0x8792('0x25')](removeEntity(_0x35652f,null))[_0x8792('0x4a')](handleError(_0x35652f,null));}; \ No newline at end of file +var _0xfba5=['reject','save','update','destroy','get','Pauses','UserProfileResource','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','Pause','length','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply'];(function(_0x1a0eec,_0x6cc8d4){var _0x39d983=function(_0x2faa15){while(--_0x2faa15){_0x1a0eec['push'](_0x1a0eec['shift']());}};_0x39d983(++_0x6cc8d4);}(_0xfba5,0x8e));var _0x5fba=function(_0x4dc89,_0x15bf5a){_0x4dc89=_0x4dc89-0x0;var _0x40b398=_0xfba5[_0x4dc89];return _0x40b398;};'use strict';var emlformat=require(_0x5fba('0x0'));var rimraf=require(_0x5fba('0x1'));var zipdir=require(_0x5fba('0x2'));var jsonpatch=require(_0x5fba('0x3'));var rp=require(_0x5fba('0x4'));var moment=require(_0x5fba('0x5'));var BPromise=require(_0x5fba('0x6'));var Mustache=require(_0x5fba('0x7'));var util=require(_0x5fba('0x8'));var path=require(_0x5fba('0x9'));var sox=require(_0x5fba('0xa'));var csv=require(_0x5fba('0xb'));var ejs=require(_0x5fba('0xc'));var fs=require('fs');var fs_extra=require(_0x5fba('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5fba('0xe'));var jsforce=require(_0x5fba('0xf'));var deskjs=require(_0x5fba('0x10'));var toCsv=require(_0x5fba('0xb'));var querystring=require(_0x5fba('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5fba('0x12'));var qs=require(_0x5fba('0x13'));var as=require(_0x5fba('0x14'));var hardwareService=require(_0x5fba('0x15'));var logger=require(_0x5fba('0x16'))(_0x5fba('0x17'));var utils=require(_0x5fba('0x18'));var config=require(_0x5fba('0x19'));var licenseUtil=require(_0x5fba('0x1a'));var db=require(_0x5fba('0x1b'))['db'];function respondWithStatusCode(_0x1964c2,_0x4bd5f5){_0x4bd5f5=_0x4bd5f5||0xcc;return function(_0x550a99){if(_0x550a99){return _0x1964c2[_0x5fba('0x1c')](_0x4bd5f5);}return _0x1964c2[_0x5fba('0x1d')](_0x4bd5f5)[_0x5fba('0x1e')]();};}function respondWithResult(_0x46cf08,_0x2bd1cd){_0x2bd1cd=_0x2bd1cd||0xc8;return function(_0x58745a){if(_0x58745a){return _0x46cf08[_0x5fba('0x1d')](_0x2bd1cd)[_0x5fba('0x1f')](_0x58745a);}};}function respondWithFilteredResult(_0x34a1b2,_0x32c764){return function(_0x96fa57){if(_0x96fa57){var _0x2b6df1=typeof _0x32c764[_0x5fba('0x20')]===_0x5fba('0x21')&&typeof _0x32c764['limit']==='undefined';var _0x353d91=_0x96fa57[_0x5fba('0x22')];var _0x56c080=_0x2b6df1?0x0:_0x32c764[_0x5fba('0x20')];var _0x5b1b3d=_0x2b6df1?_0x96fa57[_0x5fba('0x22')]:_0x32c764[_0x5fba('0x20')]+_0x32c764[_0x5fba('0x23')];var _0x4211f6;if(_0x5b1b3d>=_0x353d91){_0x5b1b3d=_0x353d91;_0x4211f6=0xc8;}else{_0x4211f6=0xce;}_0x34a1b2[_0x5fba('0x1d')](_0x4211f6);return _0x34a1b2['set'](_0x5fba('0x24'),_0x56c080+'-'+_0x5b1b3d+'/'+_0x353d91)[_0x5fba('0x1f')](_0x96fa57);}return null;};}function patchUpdates(_0x121f14){return function(_0x4be0cd){try{jsonpatch[_0x5fba('0x25')](_0x4be0cd,_0x121f14,!![]);}catch(_0x75cf0f){return BPromise[_0x5fba('0x26')](_0x75cf0f);}return _0x4be0cd[_0x5fba('0x27')]();};}function saveUpdates(_0x55cae9,_0x10c7e9){return function(_0x77d2a0){if(_0x77d2a0){return _0x77d2a0[_0x5fba('0x28')](_0x55cae9)['then'](function(_0x23c6b2){return _0x23c6b2;});}return null;};}function removeEntity(_0x3d6b77,_0x53e2f0){return function(_0x2260b9){if(_0x2260b9){return _0x2260b9[_0x5fba('0x29')]()['then'](function(){var _0x274646=_0x2260b9[_0x5fba('0x2a')]({'plain':!![]});var _0x37728c=_0x5fba('0x2b');return db[_0x5fba('0x2c')]['destroy']({'where':{'type':_0x37728c,'resourceId':_0x274646['id']}})[_0x5fba('0x2d')](function(){return _0x2260b9;});})['then'](function(){_0x3d6b77[_0x5fba('0x1d')](0xcc)[_0x5fba('0x1e')]();});}};}function handleEntityNotFound(_0x58971d,_0x5f3272){return function(_0x29250){if(!_0x29250){_0x58971d['sendStatus'](0x194);}return _0x29250;};}function handleError(_0x17803d,_0x4eb145){_0x4eb145=_0x4eb145||0x1f4;return function(_0x233c8e){logger[_0x5fba('0x2e')](_0x233c8e[_0x5fba('0x2f')]);if(_0x233c8e[_0x5fba('0x30')]){delete _0x233c8e[_0x5fba('0x30')];}_0x17803d['status'](_0x4eb145)[_0x5fba('0x31')](_0x233c8e);};}exports[_0x5fba('0x32')]=function(_0x8d295,_0x4d5d14){var _0x8ec808={},_0xc48315={},_0x1081d1={'count':0x0,'rows':[]};var _0x1b03ef=_[_0x5fba('0x33')](db['Pause'][_0x5fba('0x34')],function(_0x5522bb){return{'name':_0x5522bb[_0x5fba('0x35')],'type':_0x5522bb[_0x5fba('0x36')][_0x5fba('0x37')]};});_0xc48315['model']=_['map'](_0x1b03ef,_0x5fba('0x30'));_0xc48315[_0x5fba('0x38')]=_[_0x5fba('0x39')](_0x8d295[_0x5fba('0x38')]);_0xc48315[_0x5fba('0x3a')]=_[_0x5fba('0x3b')](_0xc48315[_0x5fba('0x3c')],_0xc48315['query']);_0x8ec808[_0x5fba('0x3d')]=_[_0x5fba('0x3b')](_0xc48315['model'],qs[_0x5fba('0x3e')](_0x8d295[_0x5fba('0x38')][_0x5fba('0x3e')]));_0x8ec808[_0x5fba('0x3d')]=_0x8ec808[_0x5fba('0x3d')]['length']?_0x8ec808['attributes']:_0xc48315[_0x5fba('0x3c')];if(!_0x8d295[_0x5fba('0x38')][_0x5fba('0x3f')]('nolimit')){_0x8ec808[_0x5fba('0x23')]=qs[_0x5fba('0x23')](_0x8d295[_0x5fba('0x38')][_0x5fba('0x23')]);_0x8ec808['offset']=qs[_0x5fba('0x20')](_0x8d295[_0x5fba('0x38')][_0x5fba('0x20')]);}_0x8ec808[_0x5fba('0x40')]=qs[_0x5fba('0x41')](_0x8d295[_0x5fba('0x38')][_0x5fba('0x41')]);_0x8ec808[_0x5fba('0x42')]=qs[_0x5fba('0x3a')](_[_0x5fba('0x43')](_0x8d295['query'],_0xc48315[_0x5fba('0x3a')]),_0x1b03ef);if(_0x8d295[_0x5fba('0x38')]['filter']){_0x8ec808[_0x5fba('0x42')]=_['merge'](_0x8ec808[_0x5fba('0x42')],{'$or':_[_0x5fba('0x33')](_0x1b03ef,function(_0x4ce3d6){if(_0x4ce3d6[_0x5fba('0x36')]!==_0x5fba('0x44')){var _0x1d9650={};_0x1d9650[_0x4ce3d6[_0x5fba('0x30')]]={'$like':'%'+_0x8d295['query'][_0x5fba('0x45')]+'%'};return _0x1d9650;}})});}_0x8ec808=_['merge']({},_0x8ec808,_0x8d295['options']);var _0x216859={'where':_0x8ec808[_0x5fba('0x42')]};return db['Pause']['count'](_0x216859)[_0x5fba('0x2d')](function(_0x1ef7be){_0x1081d1[_0x5fba('0x22')]=_0x1ef7be;if(_0x8d295[_0x5fba('0x38')][_0x5fba('0x46')]){_0x8ec808[_0x5fba('0x47')]=[{'all':!![]}];}return db['Pause'][_0x5fba('0x48')](_0x8ec808);})['then'](function(_0x5a49f9){_0x1081d1[_0x5fba('0x49')]=_0x5a49f9;return _0x1081d1;})[_0x5fba('0x2d')](respondWithFilteredResult(_0x4d5d14,_0x8ec808))[_0x5fba('0x4a')](handleError(_0x4d5d14,null));};exports[_0x5fba('0x4b')]=function(_0x5b1b58,_0x3ace21){var _0x3036c1={'raw':!![],'where':{'id':_0x5b1b58[_0x5fba('0x4c')]['id']}},_0x492332={};_0x492332[_0x5fba('0x3c')]=_[_0x5fba('0x39')](db[_0x5fba('0x4d')][_0x5fba('0x34')]);_0x492332[_0x5fba('0x38')]=_[_0x5fba('0x39')](_0x5b1b58[_0x5fba('0x38')]);_0x492332[_0x5fba('0x3a')]=_[_0x5fba('0x3b')](_0x492332[_0x5fba('0x3c')],_0x492332[_0x5fba('0x38')]);_0x3036c1[_0x5fba('0x3d')]=_['intersection'](_0x492332[_0x5fba('0x3c')],qs['fields'](_0x5b1b58['query']['fields']));_0x3036c1[_0x5fba('0x3d')]=_0x3036c1[_0x5fba('0x3d')][_0x5fba('0x4e')]?_0x3036c1[_0x5fba('0x3d')]:_0x492332[_0x5fba('0x3c')];if(_0x5b1b58[_0x5fba('0x38')][_0x5fba('0x46')]){_0x3036c1['include']=[{'all':!![]}];}_0x3036c1=_[_0x5fba('0x4f')]({},_0x3036c1,_0x5b1b58[_0x5fba('0x50')]);return db[_0x5fba('0x4d')][_0x5fba('0x51')](_0x3036c1)[_0x5fba('0x2d')](handleEntityNotFound(_0x3ace21,null))[_0x5fba('0x2d')](respondWithResult(_0x3ace21,null))['catch'](handleError(_0x3ace21,null));};exports['create']=function(_0x5bc03c,_0x28e3c9){return db[_0x5fba('0x4d')][_0x5fba('0x52')](_0x5bc03c[_0x5fba('0x53')],{})['then'](function(_0x566920){var _0x16bc4c=_0x5bc03c[_0x5fba('0x54')][_0x5fba('0x2a')]({'plain':!![]});if(!_0x16bc4c)throw new Error(_0x5fba('0x55'));if(_0x16bc4c['role']===_0x5fba('0x54')){var _0x372a28=_0x566920['get']({'plain':!![]});var _0x31ddf6='Pauses';return db[_0x5fba('0x56')][_0x5fba('0x51')]({'where':{'name':_0x31ddf6,'userProfileId':_0x16bc4c[_0x5fba('0x57')]},'raw':!![]})['then'](function(_0x563089){if(_0x563089&&_0x563089[_0x5fba('0x58')]===0x0){return db[_0x5fba('0x2c')][_0x5fba('0x52')]({'name':_0x372a28['name'],'resourceId':_0x372a28['id'],'type':_0x563089[_0x5fba('0x30')],'sectionId':_0x563089['id']},{})['then'](function(){return _0x566920;});}else{return _0x566920;}})['catch'](function(_0x19d1f9){logger[_0x5fba('0x2e')](_0x5fba('0x59'),_0x19d1f9);throw _0x19d1f9;});}return _0x566920;})[_0x5fba('0x2d')](respondWithResult(_0x28e3c9,0xc9))[_0x5fba('0x4a')](handleError(_0x28e3c9,null));};exports[_0x5fba('0x28')]=function(_0x3af97d,_0x4ea7ca){if(_0x3af97d[_0x5fba('0x53')]['id']){delete _0x3af97d['body']['id'];}return db[_0x5fba('0x4d')]['find']({'where':{'id':_0x3af97d['params']['id']}})['then'](handleEntityNotFound(_0x4ea7ca,null))['then'](saveUpdates(_0x3af97d[_0x5fba('0x53')],null))['then'](respondWithResult(_0x4ea7ca,null))[_0x5fba('0x4a')](handleError(_0x4ea7ca,null));};exports[_0x5fba('0x29')]=function(_0x41efa9,_0x41858a){return db[_0x5fba('0x4d')]['find']({'where':{'id':_0x41efa9[_0x5fba('0x4c')]['id']}})[_0x5fba('0x2d')](handleEntityNotFound(_0x41858a,null))['then'](removeEntity(_0x41858a,null))[_0x5fba('0x4a')](handleError(_0x41858a,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 3bed9a9..8c8a0d4 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 _0xc4aa=['bluebird','../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xc4aa[_0x5f1391];return _0x50ebe3;};'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':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0xc4aa[_0x2e4aa2];return _0x5e6092;};'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':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 27ea538..e1bd399 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(_0x12dd54,_0x45241d){var _0x569090=function(_0x597d6b){while(--_0x597d6b){_0x12dd54['push'](_0x12dd54['shift']());}};_0x569090(++_0x45241d);}(_0x7a54,0x106));var _0x47a5=function(_0x2c1923,_0x59e5ed){_0x2c1923=_0x2c1923-0x0;var _0x465915=_0x7a54[_0x2c1923];return _0x465915;};'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(_0x37593b,_0x33171f){var _0x2ca7ee=function(_0x267369){while(--_0x267369){_0x37593b['push'](_0x37593b['shift']());}};_0x2ca7ee(++_0x33171f);}(_0x7a54,0x106));var _0x47a5=function(_0x500e36,_0x418dbd){_0x500e36=_0x500e36-0x0;var _0x12f314=_0x7a54[_0x500e36];return _0x12f314;};'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 a35d9b5..c1314ef 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 _0x2dae=['put','update','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./plugin.controller','get','index','/webhook','webhookGet','/:id','isAuthenticated','show','download','diskStorage','join','root','originalname','replace','format','%s-%s%s','basename','extname','post','file','upload'];(function(_0x183f92,_0x43ef0d){var _0x4726e8=function(_0x34a06f){while(--_0x34a06f){_0x183f92['push'](_0x183f92['shift']());}};_0x4726e8(++_0x43ef0d);}(_0x2dae,0xc3));var _0xe2da=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0x2dae[_0x58afd5];return _0x3e503b;};'use strict';var multer=require(_0xe2da('0x0'));var util=require('util');var path=require(_0xe2da('0x1'));var timeout=require(_0xe2da('0x2'));var express=require(_0xe2da('0x3'));var router=express[_0xe2da('0x4')]();var fs_extra=require(_0xe2da('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe2da('0x6'));var config=require(_0xe2da('0x7'));var controller=require(_0xe2da('0x8'));router[_0xe2da('0x9')]('/',auth['isAuthenticated'](),controller[_0xe2da('0xa')]);router[_0xe2da('0x9')](_0xe2da('0xb'),controller[_0xe2da('0xc')]);router[_0xe2da('0x9')](_0xe2da('0xd'),auth[_0xe2da('0xe')](),controller[_0xe2da('0xf')]);router[_0xe2da('0x9')]('/:id/download',auth[_0xe2da('0xe')](),controller[_0xe2da('0x10')]);var upload=multer({'storage':multer[_0xe2da('0x11')]({'destination':function(_0x17086c,_0x3c1309,_0x44ec3e){_0x44ec3e(null,path[_0xe2da('0x12')](config[_0xe2da('0x13')],'server/files/plugins'));},'filename':function(_0xb98909,_0x5200b1,_0x4377c6){_0x5200b1[_0xe2da('0x14')]=_0x5200b1[_0xe2da('0x14')][_0xe2da('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4377c6(null,util[_0xe2da('0x16')](_0xe2da('0x17'),path[_0xe2da('0x18')](_0x5200b1['originalname'],path[_0xe2da('0x19')](_0x5200b1['originalname'])),Date['now'](),path[_0xe2da('0x19')](_0x5200b1[_0xe2da('0x14')])));}})});router[_0xe2da('0x1a')]('/',upload['single'](_0xe2da('0x1b')),controller[_0xe2da('0x1c')]);router[_0xe2da('0x1a')](_0xe2da('0xb'),controller['webhookPost']);router[_0xe2da('0x1d')](_0xe2da('0xd'),auth[_0xe2da('0xe')](),controller[_0xe2da('0x1e')]);router[_0xe2da('0x1f')]('/:id',auth[_0xe2da('0xe')](),controller[_0xe2da('0x1f')]);module['exports']=router; \ No newline at end of file +var _0x668b=['fs-extra','../../components/interaction/service','../../config/environment','./plugin.controller','isAuthenticated','index','get','/webhook','webhookGet','show','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','webhookPost','put','update','/:id','delete','exports','multer','util','connect-timeout','express'];(function(_0x10949f,_0x2e8be3){var _0x1452cf=function(_0x1e121e){while(--_0x1e121e){_0x10949f['push'](_0x10949f['shift']());}};_0x1452cf(++_0x2e8be3);}(_0x668b,0x140));var _0xb668=function(_0x2e914,_0x1c7566){_0x2e914=_0x2e914-0x0;var _0x936e45=_0x668b[_0x2e914];return _0x936e45;};'use strict';var multer=require(_0xb668('0x0'));var util=require(_0xb668('0x1'));var path=require('path');var timeout=require(_0xb668('0x2'));var express=require(_0xb668('0x3'));var router=express['Router']();var fs_extra=require(_0xb668('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb668('0x5'));var config=require(_0xb668('0x6'));var controller=require(_0xb668('0x7'));router['get']('/',auth[_0xb668('0x8')](),controller[_0xb668('0x9')]);router[_0xb668('0xa')](_0xb668('0xb'),controller[_0xb668('0xc')]);router[_0xb668('0xa')]('/:id',auth[_0xb668('0x8')](),controller[_0xb668('0xd')]);router[_0xb668('0xa')](_0xb668('0xe'),auth[_0xb668('0x8')](),controller[_0xb668('0xf')]);var upload=multer({'storage':multer[_0xb668('0x10')]({'destination':function(_0x3616e9,_0x567ea9,_0x3b15a6){_0x3b15a6(null,path[_0xb668('0x11')](config[_0xb668('0x12')],_0xb668('0x13')));},'filename':function(_0x16ca75,_0x167057,_0x1d111a){_0x167057[_0xb668('0x14')]=_0x167057[_0xb668('0x14')][_0xb668('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1d111a(null,util[_0xb668('0x16')](_0xb668('0x17'),path[_0xb668('0x18')](_0x167057[_0xb668('0x14')],path[_0xb668('0x19')](_0x167057[_0xb668('0x14')])),Date[_0xb668('0x1a')](),path[_0xb668('0x19')](_0x167057[_0xb668('0x14')])));}})});router[_0xb668('0x1b')]('/',upload[_0xb668('0x1c')](_0xb668('0x1d')),controller['upload']);router[_0xb668('0x1b')]('/webhook',controller[_0xb668('0x1e')]);router[_0xb668('0x1f')]('/:id',auth[_0xb668('0x8')](),controller[_0xb668('0x20')]);router['delete'](_0xb668('0x21'),auth['isAuthenticated'](),controller[_0xb668('0x22')]);module[_0xb668('0x23')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 1964e7b..c6ad6d3 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 _0x80d1=['The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING','ENUM','html','script','TEXT'];(function(_0x524815,_0x18a7d4){var _0x4c7a2c=function(_0x2b703c){while(--_0x2b703c){_0x524815['push'](_0x524815['shift']());}};_0x4c7a2c(++_0x18a7d4);}(_0x80d1,0x17a));var _0x180d=function(_0x1e8a61,_0x364cf6){_0x1e8a61=_0x1e8a61-0x0;var _0x19fe45=_0x80d1[_0x1e8a61];return _0x19fe45;};'use strict';var Sequelize=require('sequelize');module[_0x180d('0x0')]={'name':{'type':Sequelize[_0x180d('0x1')]},'type':{'type':Sequelize[_0x180d('0x2')](_0x180d('0x3'),_0x180d('0x4'))},'description':{'type':Sequelize[_0x180d('0x5')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x180d('0x1')],'comment':_0x180d('0x6')},'active':{'type':Sequelize[_0x180d('0x7')],'defaultValue':0x0,'comment':_0x180d('0x8')},'sidebar':{'type':Sequelize[_0x180d('0x2')]('adminOnly',_0x180d('0x9'),_0x180d('0xa'),'never'),'defaultValue':_0x180d('0xa'),'comment':_0x180d('0xb')},'icon':{'type':Sequelize[_0x180d('0x1')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x180d('0x1')]},'scriptPath':{'type':Sequelize[_0x180d('0x1')]}}; \ No newline at end of file +var _0xda6e=['The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','ENUM','adminOnly','agentOnly','always','exports','STRING','html','script','TEXT'];(function(_0x1e9ab6,_0x12a908){var _0x3c95a7=function(_0x5d4560){while(--_0x5d4560){_0x1e9ab6['push'](_0x1e9ab6['shift']());}};_0x3c95a7(++_0x12a908);}(_0xda6e,0xb6));var _0xeda6=function(_0x2a611e,_0x2516e6){_0x2a611e=_0x2a611e-0x0;var _0x1d077a=_0xda6e[_0x2a611e];return _0x1d077a;};'use strict';var Sequelize=require('sequelize');module[_0xeda6('0x0')]={'name':{'type':Sequelize[_0xeda6('0x1')]},'type':{'type':Sequelize['ENUM'](_0xeda6('0x2'),_0xeda6('0x3'))},'description':{'type':Sequelize[_0xeda6('0x4')]},'version':{'type':Sequelize[_0xeda6('0x4')]},'path':{'type':Sequelize[_0xeda6('0x1')],'comment':_0xeda6('0x5')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xeda6('0x6')},'sidebar':{'type':Sequelize[_0xeda6('0x7')](_0xeda6('0x8'),_0xeda6('0x9'),_0xeda6('0xa'),'never'),'defaultValue':_0xeda6('0xa'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0xeda6('0x1')]},'adminUrl':{'type':Sequelize[_0xeda6('0x1')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0xeda6('0x1')]},'scriptPath':{'type':Sequelize[_0xeda6('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 9790c11..e65a4a7 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 _0x44af=['Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','html','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','script','create','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','body','delete','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','http://localhost:','eml-format','zip-dir','request-promise','bluebird','mustache','path','sox','fs-extra','lodash','crypto','to-csv','querystring','extract-zip','archiver','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./plugin.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','save','update','then','destroy','Plugins','error','name','send','map','Plugin','rawAttributes','fieldName','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','options','include','findAll','show','params','catch','download','find','join','root','server/files/plugins','format','%s.zip','createWriteStream','zip','warning','code','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','pipe','glob','dirname','basename','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','parameters','Invalid\x20manifest:\x20parameters\x20missing','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath'];(function(_0xd85e7b,_0x95b861){var _0x54280b=function(_0x18bc3c){while(--_0x18bc3c){_0xd85e7b['push'](_0xd85e7b['shift']());}};_0x54280b(++_0x95b861);}(_0x44af,0x17b));var _0xf44a=function(_0x29215d,_0x39143f){_0x29215d=_0x29215d-0x0;var _0x265037=_0x44af[_0x29215d];return _0x265037;};'use strict';var emlformat=require(_0xf44a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf44a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf44a('0x2'));var moment=require('moment');var BPromise=require(_0xf44a('0x3'));var Mustache=require(_0xf44a('0x4'));var util=require('util');var path=require(_0xf44a('0x5'));var sox=require(_0xf44a('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf44a('0x7'));var _=require(_0xf44a('0x8'));var squel=require('squel');var crypto=require(_0xf44a('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf44a('0xa'));var querystring=require(_0xf44a('0xb'));var Papa=require('papaparse');var extract=require(_0xf44a('0xc'));var rimraf=require('rimraf');var archiver=require(_0xf44a('0xd'));var Redis=require(_0xf44a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xf44a('0xf'));var as=require(_0xf44a('0x10'));var hardwareService=require(_0xf44a('0x11'));var logger=require(_0xf44a('0x12'))('api');var utils=require(_0xf44a('0x13'));var config=require(_0xf44a('0x14'));var licenseUtil=require(_0xf44a('0x15'));var db=require(_0xf44a('0x16'))['db'];config[_0xf44a('0x17')]=_['defaults'](config[_0xf44a('0x17')],{'host':_0xf44a('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf44a('0x17')]));require(_0xf44a('0x19'))[_0xf44a('0x1a')](socket);function respondWithStatusCode(_0x52d4ed,_0x1336f3){_0x1336f3=_0x1336f3||0xcc;return function(_0x5c6a6e){if(_0x5c6a6e){return _0x52d4ed[_0xf44a('0x1b')](_0x1336f3);}return _0x52d4ed['status'](_0x1336f3)[_0xf44a('0x1c')]();};}function respondWithResult(_0x28960e,_0x5c5b95){_0x5c5b95=_0x5c5b95||0xc8;return function(_0x31ae96){if(_0x31ae96){return _0x28960e[_0xf44a('0x1d')](_0x5c5b95)[_0xf44a('0x1e')](_0x31ae96);}};}function respondWithFilteredResult(_0x3de848,_0x321786){return function(_0x5f4653){if(_0x5f4653){var _0x22851a=typeof _0x321786[_0xf44a('0x1f')]===_0xf44a('0x20')&&typeof _0x321786[_0xf44a('0x21')]==='undefined';var _0x16727d=_0x5f4653[_0xf44a('0x22')];var _0x171f61=_0x22851a?0x0:_0x321786[_0xf44a('0x1f')];var _0x553d6b=_0x22851a?_0x5f4653[_0xf44a('0x22')]:_0x321786[_0xf44a('0x1f')]+_0x321786[_0xf44a('0x21')];var _0x2b18f5;if(_0x553d6b>=_0x16727d){_0x553d6b=_0x16727d;_0x2b18f5=0xc8;}else{_0x2b18f5=0xce;}_0x3de848[_0xf44a('0x1d')](_0x2b18f5);return _0x3de848[_0xf44a('0x23')]('Content-Range',_0x171f61+'-'+_0x553d6b+'/'+_0x16727d)['json'](_0x5f4653);}return null;};}function patchUpdates(_0x57e9d4){return function(_0x44fd18){try{jsonpatch['apply'](_0x44fd18,_0x57e9d4,!![]);}catch(_0x4e232f){return BPromise['reject'](_0x4e232f);}return _0x44fd18[_0xf44a('0x24')]();};}function saveUpdates(_0x26ddf9,_0x39da1a){return function(_0x15e80e){if(_0x15e80e){return _0x15e80e[_0xf44a('0x25')](_0x26ddf9)[_0xf44a('0x26')](function(_0x3b0e79){return _0x3b0e79;});}return null;};}function removeEntity(_0x468dbb,_0x541e14){return function(_0x449a71){if(_0x449a71){return _0x449a71[_0xf44a('0x27')]()[_0xf44a('0x26')](function(){var _0x5723d8=_0x449a71['get']({'plain':!![]});var _0x4256ce=_0xf44a('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x4256ce,'resourceId':_0x5723d8['id']}})[_0xf44a('0x26')](function(){return _0x449a71;});})[_0xf44a('0x26')](function(){_0x468dbb[_0xf44a('0x1d')](0xcc)[_0xf44a('0x1c')]();});}};}function handleEntityNotFound(_0x5a2990,_0x1ed08e){return function(_0x18d048){if(!_0x18d048){_0x5a2990[_0xf44a('0x1b')](0x194);}return _0x18d048;};}function handleError(_0xee5f2c,_0x37a040){_0x37a040=_0x37a040||0x1f4;return function(_0x17c69c){logger[_0xf44a('0x29')](_0x17c69c['stack']);if(_0x17c69c[_0xf44a('0x2a')]){delete _0x17c69c[_0xf44a('0x2a')];}_0xee5f2c[_0xf44a('0x1d')](_0x37a040)[_0xf44a('0x2b')](_0x17c69c);};}exports['index']=function(_0xdbb86e,_0x3d21b3){var _0x5a8f7a={},_0xa743d1={},_0x40c5b6={'count':0x0,'rows':[]};var _0x306b9c=_[_0xf44a('0x2c')](db[_0xf44a('0x2d')][_0xf44a('0x2e')],function(_0xe27092){return{'name':_0xe27092[_0xf44a('0x2f')],'type':_0xe27092['type'][_0xf44a('0x30')]};});_0xa743d1['model']=_[_0xf44a('0x2c')](_0x306b9c,_0xf44a('0x2a'));_0xa743d1[_0xf44a('0x31')]=_[_0xf44a('0x32')](_0xdbb86e[_0xf44a('0x31')]);_0xa743d1['filters']=_[_0xf44a('0x33')](_0xa743d1['model'],_0xa743d1[_0xf44a('0x31')]);_0x5a8f7a[_0xf44a('0x34')]=_[_0xf44a('0x33')](_0xa743d1[_0xf44a('0x35')],qs[_0xf44a('0x36')](_0xdbb86e['query'][_0xf44a('0x36')]));_0x5a8f7a[_0xf44a('0x34')]=_0x5a8f7a[_0xf44a('0x34')][_0xf44a('0x37')]?_0x5a8f7a['attributes']:_0xa743d1[_0xf44a('0x35')];if(!_0xdbb86e[_0xf44a('0x31')][_0xf44a('0x38')]('nolimit')){_0x5a8f7a[_0xf44a('0x21')]=qs[_0xf44a('0x21')](_0xdbb86e[_0xf44a('0x31')][_0xf44a('0x21')]);_0x5a8f7a[_0xf44a('0x1f')]=qs[_0xf44a('0x1f')](_0xdbb86e[_0xf44a('0x31')][_0xf44a('0x1f')]);}_0x5a8f7a[_0xf44a('0x39')]=qs[_0xf44a('0x3a')](_0xdbb86e['query'][_0xf44a('0x3a')]);_0x5a8f7a[_0xf44a('0x3b')]=qs[_0xf44a('0x3c')](_[_0xf44a('0x3d')](_0xdbb86e[_0xf44a('0x31')],_0xa743d1['filters']),_0x306b9c);if(_0xdbb86e[_0xf44a('0x31')][_0xf44a('0x3e')]){_0x5a8f7a[_0xf44a('0x3b')]=_[_0xf44a('0x3f')](_0x5a8f7a['where'],{'$or':_[_0xf44a('0x2c')](_0x306b9c,function(_0x281058){if(_0x281058[_0xf44a('0x40')]!=='VIRTUAL'){var _0x580ad0={};_0x580ad0[_0x281058[_0xf44a('0x2a')]]={'$like':'%'+_0xdbb86e[_0xf44a('0x31')][_0xf44a('0x3e')]+'%'};return _0x580ad0;}})});}_0x5a8f7a=_['merge']({},_0x5a8f7a,_0xdbb86e[_0xf44a('0x41')]);var _0x2e8fe0={'where':_0x5a8f7a[_0xf44a('0x3b')]};return db[_0xf44a('0x2d')][_0xf44a('0x22')](_0x2e8fe0)[_0xf44a('0x26')](function(_0x4d6039){_0x40c5b6[_0xf44a('0x22')]=_0x4d6039;if(_0xdbb86e['query']['includeAll']){_0x5a8f7a[_0xf44a('0x42')]=[{'all':!![]}];}return db[_0xf44a('0x2d')][_0xf44a('0x43')](_0x5a8f7a);})[_0xf44a('0x26')](function(_0x38c83f){_0x40c5b6['rows']=_0x38c83f;return _0x40c5b6;})['then'](respondWithFilteredResult(_0x3d21b3,_0x5a8f7a))['catch'](handleError(_0x3d21b3,null));};exports[_0xf44a('0x44')]=function(_0xe6dad6,_0x4e39a1){var _0x463f4e={'raw':!![],'where':{'id':_0xe6dad6[_0xf44a('0x45')]['id']}},_0xf9b9d0={};_0xf9b9d0[_0xf44a('0x35')]=_['keys'](db[_0xf44a('0x2d')][_0xf44a('0x2e')]);_0xf9b9d0[_0xf44a('0x31')]=_[_0xf44a('0x32')](_0xe6dad6['query']);_0xf9b9d0[_0xf44a('0x3c')]=_[_0xf44a('0x33')](_0xf9b9d0[_0xf44a('0x35')],_0xf9b9d0[_0xf44a('0x31')]);_0x463f4e[_0xf44a('0x34')]=_['intersection'](_0xf9b9d0[_0xf44a('0x35')],qs[_0xf44a('0x36')](_0xe6dad6['query'][_0xf44a('0x36')]));_0x463f4e[_0xf44a('0x34')]=_0x463f4e['attributes'][_0xf44a('0x37')]?_0x463f4e[_0xf44a('0x34')]:_0xf9b9d0['model'];if(_0xe6dad6[_0xf44a('0x31')]['includeAll']){_0x463f4e[_0xf44a('0x42')]=[{'all':!![]}];}_0x463f4e=_[_0xf44a('0x3f')]({},_0x463f4e,_0xe6dad6[_0xf44a('0x41')]);return db[_0xf44a('0x2d')]['find'](_0x463f4e)['then'](handleEntityNotFound(_0x4e39a1,null))['then'](respondWithResult(_0x4e39a1,null))[_0xf44a('0x46')](handleError(_0x4e39a1,null));};exports[_0xf44a('0x47')]=function(_0x16b1d4,_0x566ef7,_0x57ba70){return db[_0xf44a('0x2d')][_0xf44a('0x48')]({'where':{'id':_0x16b1d4[_0xf44a('0x45')]['id']},'attributes':[_0xf44a('0x2a'),_0xf44a('0x5')],'raw':!![]})[_0xf44a('0x26')](handleEntityNotFound(_0x566ef7,null))[_0xf44a('0x26')](function(_0x4b9735){if(_0x4b9735){var _0x4ace94=path[_0xf44a('0x49')](config[_0xf44a('0x4a')],_0xf44a('0x4b'),util[_0xf44a('0x4c')](_0xf44a('0x4d'),path['basename'](_0x4b9735['path'])));var _0x1f6133=fs[_0xf44a('0x4e')](_0x4ace94);var _0x29358f=archiver(_0xf44a('0x4f'),{'zlib':{'level':0x9}});_0x29358f['on'](_0xf44a('0x50'),function(_0x9900bf){if(_0x9900bf[_0xf44a('0x51')]===_0xf44a('0x52')){logger['error'](_0x9900bf);}else{throw new db['Sequelize'][(_0xf44a('0x53'))](_0xf44a('0x54'));}});_0x29358f['on']('error',function(_0x58abcc){throw new db[(_0xf44a('0x55'))]['Error'](_0xf44a('0x54'));});_0x29358f[_0xf44a('0x56')](_0x1f6133);_0x29358f[_0xf44a('0x57')]('**/*',{'cwd':path[_0xf44a('0x49')](config[_0xf44a('0x4a')],_0xf44a('0x4b'),path[_0xf44a('0x58')](_0x4b9735[_0xf44a('0x5')])),'ignore':[path[_0xf44a('0x49')](path[_0xf44a('0x59')](_0x4b9735[_0xf44a('0x5')]),_0xf44a('0x5a')),path[_0xf44a('0x49')](path[_0xf44a('0x59')](_0x4b9735[_0xf44a('0x5')]),_0xf44a('0x5b'))],'nodir':!![]})[_0xf44a('0x5c')]();_0x1f6133['on'](_0xf44a('0x5d'),function(){if(!fs[_0xf44a('0x5e')](_0x4ace94)){throw new db['Sequelize']['Error'](_0xf44a('0x5f'));}return _0x566ef7[_0xf44a('0x47')](_0x4ace94,util[_0xf44a('0x4c')](_0xf44a('0x4d'),path[_0xf44a('0x59')](_0x4b9735[_0xf44a('0x5')])),function(_0x1e0c58){if(_0x1e0c58){throw new db[(_0xf44a('0x55'))]['Error'](_0xf44a('0x60'));}fs[_0xf44a('0x61')](_0x4ace94);logger['info']('Download\x20completed');logger[_0xf44a('0x62')](_0xf44a('0x63'));});});}return null;})[_0xf44a('0x46')](handleError(_0x566ef7,null));};exports[_0xf44a('0x64')]=function(_0x1de3bb,_0x2c9083,_0x232940){var _0x520f94=path['basename'](_0x1de3bb[_0xf44a('0x65')][_0xf44a('0x66')],path[_0xf44a('0x67')](_0x1de3bb[_0xf44a('0x65')][_0xf44a('0x66')]));var _0x37e361=path[_0xf44a('0x49')](config[_0xf44a('0x4a')],_0xf44a('0x4b'),_0x1de3bb[_0xf44a('0x65')][_0xf44a('0x66')]);var _0x314d5d=path['join'](config[_0xf44a('0x4a')],'server/files/plugins',_0x520f94);logger[_0xf44a('0x62')]('Plugin\x20upload\x20filepath:\x20%s',_0x37e361);logger['info'](_0xf44a('0x68'),_0x314d5d);try{fs[_0xf44a('0x69')](_0x37e361,parseInt('0777',0x8));extract(_0x37e361,{'dir':_0x314d5d},function(_0x4f8bc7){if(_0x4f8bc7){logger[_0xf44a('0x29')](_0x4f8bc7);handleError(_0x4f8bc7,!![]);};var _0x5874bd=fs[_0xf44a('0x6a')](_0x314d5d);if(_0x5874bd['length']>0x1){removeReferences(_0x37e361,_0x314d5d);logger['error'](_0xf44a('0x6b'));return _0x232940(new Error(_0xf44a('0x6b')));}var _0x5f190d=fs['lstatSync'](path['join'](_0x314d5d,_0x5874bd[0x0]));if(_0x5f190d[_0xf44a('0x6c')]()){removeReferences(_0x37e361,_0x314d5d);logger[_0xf44a('0x29')](_0xf44a('0x6b'));return _0x232940(new Error(_0xf44a('0x6b')));}if(_0x5f190d[_0xf44a('0x6d')]()){var _0x6067d6=fs['readdirSync'](path[_0xf44a('0x49')](_0x314d5d,_0x5874bd[0x0]));if(_0x6067d6[_0xf44a('0x37')]===0x0){removeReferences(_0x37e361,_0x314d5d);logger[_0xf44a('0x29')](_0xf44a('0x6b'));return _0x232940(new Error(_0xf44a('0x6b')));}var _0x59e3a9=_0x6067d6[_0xf44a('0x6e')](function(_0x591f85){return _0x591f85===_0xf44a('0x6f');});if(!_0x59e3a9){return _0x232940(new Error(_0xf44a('0x70')));}var _0xfdcebf=fs[_0xf44a('0x71')](path[_0xf44a('0x49')](_0x314d5d,_0x5874bd[0x0],'manifest.json'));var _0x53db1e=JSON[_0xf44a('0x72')](_0xfdcebf);if(_0xf44a('0x20')==typeof _0x53db1e['name']){return _0x232940(new Error(_0xf44a('0x73')));}if(_0xf44a('0x20')==typeof _0x53db1e[_0xf44a('0x40')]){return _0x232940(new Error(_0xf44a('0x74')));}if('undefined'==typeof _0x53db1e[_0xf44a('0x75')]){return _0x232940(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xf44a('0x20')==typeof _0x53db1e[_0xf44a('0x76')]){return _0x232940(new Error(_0xf44a('0x77')));}if(_0x53db1e['type']==='html'){if(_0xf44a('0x20')==typeof _0x53db1e[_0xf44a('0x76')][_0xf44a('0x78')]){return _0x232940(new Error(_0xf44a('0x79')));}if('undefined'==typeof _0x53db1e[_0xf44a('0x76')]['views'][_0xf44a('0x7a')]&&'undefined'==typeof _0x53db1e[_0xf44a('0x76')][_0xf44a('0x78')][_0xf44a('0x7b')]){return _0x232940(new Error(_0xf44a('0x7c')));}}else if(_0x53db1e['type']==='script'){if(_0xf44a('0x20')==typeof _0x53db1e[_0xf44a('0x76')][_0xf44a('0x7d')]){return _0x232940(new Error(_0xf44a('0x7e')));}if('undefined'==typeof _0x53db1e[_0xf44a('0x76')][_0xf44a('0x7f')]){return _0x232940(new Error(_0xf44a('0x80')));}}else{return _0x232940(new Error(_0xf44a('0x81')));}var _0x1ae87f=_0x53db1e[_0xf44a('0x2a')];var _0x15ead7=_0x53db1e[_0xf44a('0x82')];var _0x393e72=_0x53db1e['type'];var _0x1f4f79=_0x53db1e[_0xf44a('0x83')]?_0x53db1e[_0xf44a('0x83')]:_0xf44a('0x84');var _0xf7fe9f=_0x53db1e[_0xf44a('0x85')]?_0x53db1e[_0xf44a('0x85')]:_0xf44a('0x86');var _0x434409='';var _0x232915='';var _0x124f02='';var _0x4047e6='';var _0x527497=_0x53db1e[_0xf44a('0x75')];if(_0x393e72===_0xf44a('0x87')){if(_0xf44a('0x20')!=typeof _0x53db1e['parameters'][_0xf44a('0x78')][_0xf44a('0x7a')]){var _0x3de82c=_0x53db1e[_0xf44a('0x76')]['views'][_0xf44a('0x7a')];if(!/^(f|ht)tps?:\/\//i[_0xf44a('0x88')](_0x3de82c)){_0x434409=path[_0xf44a('0x49')](_0xf44a('0x89'),_0x520f94,_0x5874bd[0x0],_0x3de82c);}else{_0x434409=_0x3de82c;}}else{logger[_0xf44a('0x62')](_0xf44a('0x8a'));}if(_0xf44a('0x20')!=typeof _0x53db1e['parameters']['views'][_0xf44a('0x7b')]){var _0x722b4e=_0x53db1e[_0xf44a('0x76')][_0xf44a('0x78')][_0xf44a('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0xf44a('0x88')](_0x722b4e)){_0x232915=path[_0xf44a('0x49')]('plugins',_0x520f94,_0x5874bd[0x0],_0x722b4e);}else{_0x232915=_0x722b4e;}}else{logger[_0xf44a('0x62')](_0xf44a('0x8b'));}}else if(_0x393e72===_0xf44a('0x8c')){_0x124f02=_0x53db1e[_0xf44a('0x76')][_0xf44a('0x7d')];_0x4047e6=_0x53db1e[_0xf44a('0x76')][_0xf44a('0x7f')];if(_0xf44a('0x20')!=typeof _0x53db1e[_0xf44a('0x76')][_0xf44a('0x78')]){if('undefined'!=typeof _0x53db1e['parameters']['views'][_0xf44a('0x7a')]){var _0x3de82c=_0x53db1e[_0xf44a('0x76')][_0xf44a('0x78')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xf44a('0x88')](_0x3de82c)){_0x434409=path[_0xf44a('0x49')](_0xf44a('0x89'),_0x520f94,_0x5874bd[0x0],_0x3de82c);}else{_0x434409=_0x3de82c;}}if('undefined'!=typeof _0x53db1e['parameters'][_0xf44a('0x78')][_0xf44a('0x7b')]){var _0x722b4e=_0x53db1e['parameters'][_0xf44a('0x78')][_0xf44a('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0xf44a('0x88')](_0x722b4e)){_0x232915=path[_0xf44a('0x49')](_0xf44a('0x89'),_0x520f94,_0x5874bd[0x0],_0x722b4e);}else{_0x232915=_0x722b4e;}}}}var _0x777126={'name':_0x1ae87f,'description':_0x15ead7,'path':path[_0xf44a('0x49')](_0x520f94,_0x5874bd[0x0]),'type':_0x393e72,'sidebar':_0x1f4f79,'icon':_0xf7fe9f,'adminUrl':_0x434409,'agentUrl':_0x232915,'scriptName':_0x124f02,'scriptPath':_0x4047e6,'version':_0x527497};removeReferences(_0x37e361,null);return db['Plugin'][_0xf44a('0x8d')](_0x777126)[_0xf44a('0x26')](function(_0x5cbcf5){var _0x598e57={'role':_0x1de3bb['body'][_0xf44a('0x8e')],'userProfileId':_0x1de3bb['body'][_0xf44a('0x8f')]};if(!_0x598e57)throw new Error(_0xf44a('0x90'));if(_0x598e57[_0xf44a('0x8e')]===_0xf44a('0x91')){var _0x5d0018=_0x5cbcf5[_0xf44a('0x92')]({'plain':!![]});return db['UserProfileSection'][_0xf44a('0x48')]({'where':{'name':_0xf44a('0x28'),'userProfileId':_0x598e57[_0xf44a('0x8f')]},'raw':!![]})[_0xf44a('0x26')](function(_0x467457){if(_0x467457&&_0x467457[_0xf44a('0x93')]===0x0){return db[_0xf44a('0x94')][_0xf44a('0x8d')]({'name':_0x5d0018[_0xf44a('0x2a')],'resourceId':_0x5d0018['id'],'type':_0x467457[_0xf44a('0x2a')],'sectionId':_0x467457['id']},{})[_0xf44a('0x26')](function(){return _0x5cbcf5;});}else{return _0x5cbcf5;}})[_0xf44a('0x46')](function(_0x5c05b0){logger[_0xf44a('0x29')](_0xf44a('0x95'),_0x5c05b0);throw _0x5c05b0;});}return _0x5cbcf5;})['then'](respondWithResult(_0x2c9083,null))[_0xf44a('0x46')](handleError(_0x2c9083,null));}});}catch(_0x3fe66e){_0x2c9083['status'](0x1f4)['send'](_0x3fe66e);}};function removeReferences(_0x11d67c,_0x567b92){try{if(_0x11d67c){fs[_0xf44a('0x61')](_0x11d67c);logger[_0xf44a('0x62')](_0xf44a('0x96'));}if(_0x567b92){rimraf(_0x567b92,function(){});logger[_0xf44a('0x62')](_0xf44a('0x97'));}}catch(_0xae778b){logger[_0xf44a('0x29')](_0xae778b);}}exports['update']=function(_0x58fff1,_0x241b9d,_0x5336d6){return db[_0xf44a('0x2d')][_0xf44a('0x48')]({'where':{'id':_0x58fff1[_0xf44a('0x45')]['id']}})[_0xf44a('0x26')](handleEntityNotFound(_0x241b9d,null))['then'](saveUpdates(_0x58fff1[_0xf44a('0x98')],null))['then'](respondWithResult(_0x241b9d,null))[_0xf44a('0x46')](handleError(_0x241b9d,null));};exports[_0xf44a('0x99')]=function(_0x59daf4,_0x3ec389,_0x1b3ef6){return db['Plugin'][_0xf44a('0x48')]({'where':{'id':_0x59daf4['params']['id']}})['then'](function(_0x4942fe){if(_0x4942fe){return _0x4942fe[_0xf44a('0x27')]();}})[_0xf44a('0x26')](function(_0x58242e){rimraf(path[_0xf44a('0x49')](config[_0xf44a('0x4a')],_0xf44a('0x4b'),path[_0xf44a('0x58')](_0x58242e[_0xf44a('0x5')])),function(){});return _0x58242e;})[_0xf44a('0x26')](handleEntityNotFound(_0x3ec389,null))[_0xf44a('0x26')](respondWithStatusCode(_0x3ec389,null))[_0xf44a('0x46')](handleError(_0x3ec389,null));};exports['webhookGet']=function(_0x5e52d8,_0x4be93f,_0x103b64){return BPromise[_0xf44a('0x9a')]()[_0xf44a('0x26')](function(){if(!_0x5e52d8['query'][_0xf44a('0x5')]){throw new Error(_0xf44a('0x9b'));}if(!_0x5e52d8[_0xf44a('0x31')][_0xf44a('0x9c')]){throw new Error(_0xf44a('0x9d'));}var _0x55c6c1=_0x5e52d8[_0xf44a('0x31')][_0xf44a('0x9e')]?_0x5e52d8[_0xf44a('0x31')][_0xf44a('0x9e')]+':'+_0x5e52d8[_0xf44a('0x31')][_0xf44a('0x9c')]:'http://localhost:'+_0x5e52d8[_0xf44a('0x31')][_0xf44a('0x9c')];var _0x447598=_0x5e52d8['query'][_0xf44a('0x1e')]?_0x5e52d8[_0xf44a('0x31')][_0xf44a('0x1e')]:!![];var _0x895724=_0x5e52d8[_0xf44a('0x31')][_0xf44a('0x9f')]?_0x5e52d8[_0xf44a('0x31')]['encoding']:null;var _0x1524c9={'method':_0x5e52d8[_0xf44a('0xa0')],'uri':util[_0xf44a('0x4c')](_0xf44a('0xa1'),_0x55c6c1,_0x5e52d8[_0xf44a('0x31')][_0xf44a('0x5')]),'json':_0x447598,'resolveWithFullResponse':!![],'encoding':_0x895724,'qs':_0x5e52d8[_0xf44a('0x31')]};if(_0x5e52d8[_0xf44a('0xa2')]){_0x1524c9[_0xf44a('0xa2')]=_0x5e52d8[_0xf44a('0xa2')];if(_0x1524c9[_0xf44a('0xa2')][_0xf44a('0xa3')]){delete _0x1524c9[_0xf44a('0xa2')][_0xf44a('0xa3')];}}if(_0x1524c9[_0xf44a('0xa2')]['content-type']){delete _0x1524c9[_0xf44a('0xa2')][_0xf44a('0xa4')];}return rp(_0x1524c9);})[_0xf44a('0x26')](function(_0x5df85a){if(_0x5df85a){_0x4be93f[_0xf44a('0x23')](_0x5df85a[_0xf44a('0xa2')]);logger[_0xf44a('0x62')](_0x5df85a[_0xf44a('0x98')]);if(_[_0xf44a('0xa5')](_0x5e52d8[_0xf44a('0x31')][_0xf44a('0x5')],'download')&&_0x5df85a[_0xf44a('0xa6')]==0x1f4){return _0x4be93f['sendStatus'](_0x5df85a[_0xf44a('0xa6')]);}else{return _0x4be93f['status'](_0x5df85a['statusCode'])['send'](_0x5df85a['body']);}}else{return _0x4be93f[_0xf44a('0x1b')](0xc8);}})[_0xf44a('0x46')](handleError(_0x4be93f,null));};exports[_0xf44a('0xa7')]=function(_0x39d8b8,_0xaaa565,_0x3b93e9){return BPromise[_0xf44a('0x9a')]()['then'](function(){if(!_0x39d8b8[_0xf44a('0x31')][_0xf44a('0x5')]){throw new Error(_0xf44a('0x9b'));}if(!_0x39d8b8[_0xf44a('0x31')][_0xf44a('0x9c')]){throw new Error(_0xf44a('0x9d'));}var _0x396a07=_0x39d8b8[_0xf44a('0x31')][_0xf44a('0x9e')]?_0x39d8b8[_0xf44a('0x31')][_0xf44a('0x9e')]+':'+_0x39d8b8[_0xf44a('0x31')][_0xf44a('0x9c')]:_0xf44a('0xa8')+_0x39d8b8[_0xf44a('0x31')][_0xf44a('0x9c')];var _0xf28713=_0x39d8b8[_0xf44a('0x31')][_0xf44a('0x1e')]?_0x39d8b8['query'][_0xf44a('0x1e')]:!![];var _0x1a4163=_0x39d8b8['query'][_0xf44a('0x9f')]?_0x39d8b8[_0xf44a('0x31')][_0xf44a('0x9f')]:null;var _0x53f4bb={'method':_0x39d8b8[_0xf44a('0xa0')],'uri':util[_0xf44a('0x4c')](_0xf44a('0xa1'),_0x396a07,_0x39d8b8['query'][_0xf44a('0x5')]),'json':_0xf28713,'resolveWithFullResponse':!![],'encoding':_0x1a4163,'body':_0x39d8b8[_0xf44a('0x98')]};if(_0x39d8b8['headers']){_0x53f4bb[_0xf44a('0xa2')]=_0x39d8b8[_0xf44a('0xa2')];if(_0x53f4bb[_0xf44a('0xa2')][_0xf44a('0xa3')]){delete _0x53f4bb[_0xf44a('0xa2')][_0xf44a('0xa3')];}}if(_0x53f4bb['headers'][_0xf44a('0xa4')]){delete _0x53f4bb[_0xf44a('0xa2')][_0xf44a('0xa4')];}return rp(_0x53f4bb);})[_0xf44a('0x26')](function(_0x1f70a2){if(_0x1f70a2){_0xaaa565[_0xf44a('0x23')](_0x1f70a2[_0xf44a('0xa2')]);logger['info'](_0x1f70a2['body']);return _0xaaa565[_0xf44a('0x1d')](_0x1f70a2[_0xf44a('0xa6')])[_0xf44a('0x2b')](_0x1f70a2['body']);}else{return _0xaaa565[_0xf44a('0x1b')](0xc8);}})[_0xf44a('0x46')](handleError(_0xaaa565,null));}; \ No newline at end of file +var _0xbd89=['Plugin\x20manifest\x20missing','manifest.json','parse','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','views','parameters','admin','script','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','icon-apps','html','plugins','agent','test','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','resolve','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','method','%s%s','headers','content-length','content-type','statusCode','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','encoding','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','to-csv','querystring','archiver','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','limit','count','offset','set','apply','save','update','then','get','Plugins','UserProfileResource','destroy','error','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','params','include','find','download','server/files/plugins','format','%s.zip','zip','warning','code','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','**/*','join','root','dirname','basename','node_modules/**/*','attachments/**/*','finalize','close','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','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xbd89,0x17e));var _0x9bd8=function(_0x2b6459,_0x153142){_0x2b6459=_0x2b6459-0x0;var _0x1ecda9=_0xbd89[_0x2b6459];return _0x1ecda9;};'use strict';var emlformat=require(_0x9bd8('0x0'));var rimraf=require(_0x9bd8('0x1'));var zipdir=require(_0x9bd8('0x2'));var jsonpatch=require(_0x9bd8('0x3'));var rp=require(_0x9bd8('0x4'));var moment=require('moment');var BPromise=require(_0x9bd8('0x5'));var Mustache=require(_0x9bd8('0x6'));var util=require(_0x9bd8('0x7'));var path=require(_0x9bd8('0x8'));var sox=require(_0x9bd8('0x9'));var csv=require('to-csv');var ejs=require(_0x9bd8('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9bd8('0xb'));var crypto=require(_0x9bd8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9bd8('0xd'));var toCsv=require(_0x9bd8('0xe'));var querystring=require(_0x9bd8('0xf'));var Papa=require('papaparse');var extract=require('extract-zip');var rimraf=require(_0x9bd8('0x1'));var archiver=require(_0x9bd8('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9bd8('0x11'));var as=require(_0x9bd8('0x12'));var hardwareService=require(_0x9bd8('0x13'));var logger=require(_0x9bd8('0x14'))(_0x9bd8('0x15'));var utils=require('../../config/utils');var config=require(_0x9bd8('0x16'));var licenseUtil=require(_0x9bd8('0x17'));var db=require(_0x9bd8('0x18'))['db'];config[_0x9bd8('0x19')]=_['defaults'](config[_0x9bd8('0x19')],{'host':_0x9bd8('0x1a'),'port':0x18eb});var socket=require(_0x9bd8('0x1b'))(new Redis(config[_0x9bd8('0x19')]));require(_0x9bd8('0x1c'))[_0x9bd8('0x1d')](socket);function respondWithStatusCode(_0x55bb12,_0x54a6dd){_0x54a6dd=_0x54a6dd||0xcc;return function(_0x1bdb92){if(_0x1bdb92){return _0x55bb12[_0x9bd8('0x1e')](_0x54a6dd);}return _0x55bb12[_0x9bd8('0x1f')](_0x54a6dd)[_0x9bd8('0x20')]();};}function respondWithResult(_0x4eadce,_0x20f3b1){_0x20f3b1=_0x20f3b1||0xc8;return function(_0x20e184){if(_0x20e184){return _0x4eadce['status'](_0x20f3b1)[_0x9bd8('0x21')](_0x20e184);}};}function respondWithFilteredResult(_0x58813a,_0x41f871){return function(_0xb6548a){if(_0xb6548a){var _0x20f49d=typeof _0x41f871['offset']==='undefined'&&typeof _0x41f871[_0x9bd8('0x22')]==='undefined';var _0x3e6812=_0xb6548a[_0x9bd8('0x23')];var _0x69db2b=_0x20f49d?0x0:_0x41f871['offset'];var _0x2ae11e=_0x20f49d?_0xb6548a[_0x9bd8('0x23')]:_0x41f871[_0x9bd8('0x24')]+_0x41f871[_0x9bd8('0x22')];var _0xc8392b;if(_0x2ae11e>=_0x3e6812){_0x2ae11e=_0x3e6812;_0xc8392b=0xc8;}else{_0xc8392b=0xce;}_0x58813a[_0x9bd8('0x1f')](_0xc8392b);return _0x58813a[_0x9bd8('0x25')]('Content-Range',_0x69db2b+'-'+_0x2ae11e+'/'+_0x3e6812)[_0x9bd8('0x21')](_0xb6548a);}return null;};}function patchUpdates(_0x49b8b3){return function(_0xe3da2d){try{jsonpatch[_0x9bd8('0x26')](_0xe3da2d,_0x49b8b3,!![]);}catch(_0x587e46){return BPromise['reject'](_0x587e46);}return _0xe3da2d[_0x9bd8('0x27')]();};}function saveUpdates(_0x52dca7,_0x243138){return function(_0x90a365){if(_0x90a365){return _0x90a365[_0x9bd8('0x28')](_0x52dca7)[_0x9bd8('0x29')](function(_0xcd997c){return _0xcd997c;});}return null;};}function removeEntity(_0xc28a44,_0x58d656){return function(_0x414af6){if(_0x414af6){return _0x414af6['destroy']()[_0x9bd8('0x29')](function(){var _0x551fd6=_0x414af6[_0x9bd8('0x2a')]({'plain':!![]});var _0xc5a8ac=_0x9bd8('0x2b');return db[_0x9bd8('0x2c')][_0x9bd8('0x2d')]({'where':{'type':_0xc5a8ac,'resourceId':_0x551fd6['id']}})[_0x9bd8('0x29')](function(){return _0x414af6;});})[_0x9bd8('0x29')](function(){_0xc28a44[_0x9bd8('0x1f')](0xcc)[_0x9bd8('0x20')]();});}};}function handleEntityNotFound(_0x161454,_0x3c7efe){return function(_0x18eee0){if(!_0x18eee0){_0x161454['sendStatus'](0x194);}return _0x18eee0;};}function handleError(_0x4407b7,_0x20f69d){_0x20f69d=_0x20f69d||0x1f4;return function(_0x410da2){logger[_0x9bd8('0x2e')](_0x410da2['stack']);if(_0x410da2[_0x9bd8('0x2f')]){delete _0x410da2['name'];}_0x4407b7[_0x9bd8('0x1f')](_0x20f69d)[_0x9bd8('0x30')](_0x410da2);};}exports[_0x9bd8('0x31')]=function(_0x2488c8,_0x22c67d){var _0x49fdbc={},_0x3eff71={},_0x2fbc17={'count':0x0,'rows':[]};var _0x541034=_[_0x9bd8('0x32')](db[_0x9bd8('0x33')][_0x9bd8('0x34')],function(_0x4b7d92){return{'name':_0x4b7d92[_0x9bd8('0x35')],'type':_0x4b7d92[_0x9bd8('0x36')][_0x9bd8('0x37')]};});_0x3eff71[_0x9bd8('0x38')]=_['map'](_0x541034,_0x9bd8('0x2f'));_0x3eff71[_0x9bd8('0x39')]=_[_0x9bd8('0x3a')](_0x2488c8[_0x9bd8('0x39')]);_0x3eff71['filters']=_[_0x9bd8('0x3b')](_0x3eff71['model'],_0x3eff71['query']);_0x49fdbc[_0x9bd8('0x3c')]=_[_0x9bd8('0x3b')](_0x3eff71['model'],qs[_0x9bd8('0x3d')](_0x2488c8[_0x9bd8('0x39')]['fields']));_0x49fdbc['attributes']=_0x49fdbc['attributes'][_0x9bd8('0x3e')]?_0x49fdbc['attributes']:_0x3eff71[_0x9bd8('0x38')];if(!_0x2488c8[_0x9bd8('0x39')][_0x9bd8('0x3f')](_0x9bd8('0x40'))){_0x49fdbc[_0x9bd8('0x22')]=qs[_0x9bd8('0x22')](_0x2488c8['query'][_0x9bd8('0x22')]);_0x49fdbc[_0x9bd8('0x24')]=qs[_0x9bd8('0x24')](_0x2488c8[_0x9bd8('0x39')][_0x9bd8('0x24')]);}_0x49fdbc[_0x9bd8('0x41')]=qs[_0x9bd8('0x42')](_0x2488c8[_0x9bd8('0x39')][_0x9bd8('0x42')]);_0x49fdbc[_0x9bd8('0x43')]=qs['filters'](_[_0x9bd8('0x44')](_0x2488c8[_0x9bd8('0x39')],_0x3eff71[_0x9bd8('0x45')]),_0x541034);if(_0x2488c8[_0x9bd8('0x39')]['filter']){_0x49fdbc['where']=_[_0x9bd8('0x46')](_0x49fdbc[_0x9bd8('0x43')],{'$or':_[_0x9bd8('0x32')](_0x541034,function(_0x233e15){if(_0x233e15['type']!==_0x9bd8('0x47')){var _0x459231={};_0x459231[_0x233e15[_0x9bd8('0x2f')]]={'$like':'%'+_0x2488c8['query'][_0x9bd8('0x48')]+'%'};return _0x459231;}})});}_0x49fdbc=_[_0x9bd8('0x46')]({},_0x49fdbc,_0x2488c8[_0x9bd8('0x49')]);var _0x3ee3a5={'where':_0x49fdbc[_0x9bd8('0x43')]};return db['Plugin'][_0x9bd8('0x23')](_0x3ee3a5)['then'](function(_0x525ba9){_0x2fbc17[_0x9bd8('0x23')]=_0x525ba9;if(_0x2488c8[_0x9bd8('0x39')][_0x9bd8('0x4a')]){_0x49fdbc['include']=[{'all':!![]}];}return db[_0x9bd8('0x33')][_0x9bd8('0x4b')](_0x49fdbc);})[_0x9bd8('0x29')](function(_0x392176){_0x2fbc17[_0x9bd8('0x4c')]=_0x392176;return _0x2fbc17;})[_0x9bd8('0x29')](respondWithFilteredResult(_0x22c67d,_0x49fdbc))[_0x9bd8('0x4d')](handleError(_0x22c67d,null));};exports['show']=function(_0x5d5dc1,_0x487f0c){var _0x202a73={'raw':!![],'where':{'id':_0x5d5dc1[_0x9bd8('0x4e')]['id']}},_0xf90282={};_0xf90282[_0x9bd8('0x38')]=_[_0x9bd8('0x3a')](db['Plugin'][_0x9bd8('0x34')]);_0xf90282[_0x9bd8('0x39')]=_['keys'](_0x5d5dc1[_0x9bd8('0x39')]);_0xf90282['filters']=_[_0x9bd8('0x3b')](_0xf90282[_0x9bd8('0x38')],_0xf90282[_0x9bd8('0x39')]);_0x202a73[_0x9bd8('0x3c')]=_[_0x9bd8('0x3b')](_0xf90282[_0x9bd8('0x38')],qs[_0x9bd8('0x3d')](_0x5d5dc1[_0x9bd8('0x39')]['fields']));_0x202a73[_0x9bd8('0x3c')]=_0x202a73[_0x9bd8('0x3c')][_0x9bd8('0x3e')]?_0x202a73['attributes']:_0xf90282[_0x9bd8('0x38')];if(_0x5d5dc1[_0x9bd8('0x39')][_0x9bd8('0x4a')]){_0x202a73[_0x9bd8('0x4f')]=[{'all':!![]}];}_0x202a73=_['merge']({},_0x202a73,_0x5d5dc1[_0x9bd8('0x49')]);return db['Plugin'][_0x9bd8('0x50')](_0x202a73)[_0x9bd8('0x29')](handleEntityNotFound(_0x487f0c,null))['then'](respondWithResult(_0x487f0c,null))[_0x9bd8('0x4d')](handleError(_0x487f0c,null));};exports[_0x9bd8('0x51')]=function(_0x2e6ba2,_0x1392c9,_0x4a753c){return db[_0x9bd8('0x33')][_0x9bd8('0x50')]({'where':{'id':_0x2e6ba2['params']['id']},'attributes':['name',_0x9bd8('0x8')],'raw':!![]})[_0x9bd8('0x29')](handleEntityNotFound(_0x1392c9,null))['then'](function(_0x49ab64){if(_0x49ab64){var _0x44fed4=path['join'](config['root'],_0x9bd8('0x52'),util[_0x9bd8('0x53')](_0x9bd8('0x54'),path['basename'](_0x49ab64[_0x9bd8('0x8')])));var _0x2cba56=fs['createWriteStream'](_0x44fed4);var _0x3a84c0=archiver(_0x9bd8('0x55'),{'zlib':{'level':0x9}});_0x3a84c0['on'](_0x9bd8('0x56'),function(_0x3b599c){if(_0x3b599c[_0x9bd8('0x57')]==='ENOENT'){logger[_0x9bd8('0x2e')](_0x3b599c);}else{throw new db[(_0x9bd8('0x58'))][(_0x9bd8('0x59'))](_0x9bd8('0x5a'));}});_0x3a84c0['on'](_0x9bd8('0x2e'),function(_0x41adaa){throw new db[(_0x9bd8('0x58'))][(_0x9bd8('0x59'))](_0x9bd8('0x5a'));});_0x3a84c0['pipe'](_0x2cba56);_0x3a84c0['glob'](_0x9bd8('0x5b'),{'cwd':path[_0x9bd8('0x5c')](config[_0x9bd8('0x5d')],_0x9bd8('0x52'),path[_0x9bd8('0x5e')](_0x49ab64[_0x9bd8('0x8')])),'ignore':[path[_0x9bd8('0x5c')](path[_0x9bd8('0x5f')](_0x49ab64[_0x9bd8('0x8')]),_0x9bd8('0x60')),path[_0x9bd8('0x5c')](path[_0x9bd8('0x5f')](_0x49ab64[_0x9bd8('0x8')]),_0x9bd8('0x61'))],'nodir':!![]})[_0x9bd8('0x62')]();_0x2cba56['on'](_0x9bd8('0x63'),function(){if(!fs['existsSync'](_0x44fed4)){throw new db[(_0x9bd8('0x58'))]['Error']('Plugin\x20not\x20found');}return _0x1392c9['download'](_0x44fed4,util[_0x9bd8('0x53')]('%s.zip',path[_0x9bd8('0x5f')](_0x49ab64[_0x9bd8('0x8')])),function(_0x46a2e8){if(_0x46a2e8){throw new db['Sequelize'][(_0x9bd8('0x59'))](_0x9bd8('0x64'));}fs[_0x9bd8('0x65')](_0x44fed4);logger[_0x9bd8('0x66')](_0x9bd8('0x67'));logger[_0x9bd8('0x66')](_0x9bd8('0x68'));});});}return null;})['catch'](handleError(_0x1392c9,null));};exports[_0x9bd8('0x69')]=function(_0x1da9ca,_0x2e1279,_0x470cad){var _0x389222=path['basename'](_0x1da9ca['file'][_0x9bd8('0x6a')],path[_0x9bd8('0x6b')](_0x1da9ca['file'][_0x9bd8('0x6a')]));var _0x59bbde=path[_0x9bd8('0x5c')](config['root'],_0x9bd8('0x52'),_0x1da9ca[_0x9bd8('0x6c')][_0x9bd8('0x6a')]);var _0x363ba4=path[_0x9bd8('0x5c')](config['root'],'server/files/plugins',_0x389222);logger['info'](_0x9bd8('0x6d'),_0x59bbde);logger[_0x9bd8('0x66')](_0x9bd8('0x6e'),_0x363ba4);try{fs[_0x9bd8('0x6f')](_0x59bbde,parseInt(_0x9bd8('0x70'),0x8));extract(_0x59bbde,{'dir':_0x363ba4},function(_0x372385){if(_0x372385){logger['error'](_0x372385);handleError(_0x372385,!![]);};var _0x2c9246=fs[_0x9bd8('0x71')](_0x363ba4);if(_0x2c9246[_0x9bd8('0x3e')]>0x1){removeReferences(_0x59bbde,_0x363ba4);logger[_0x9bd8('0x2e')]('Invalid\x20plugin\x20structure');return _0x470cad(new Error(_0x9bd8('0x72')));}var _0x190bda=fs[_0x9bd8('0x73')](path[_0x9bd8('0x5c')](_0x363ba4,_0x2c9246[0x0]));if(_0x190bda[_0x9bd8('0x74')]()){removeReferences(_0x59bbde,_0x363ba4);logger[_0x9bd8('0x2e')](_0x9bd8('0x72'));return _0x470cad(new Error(_0x9bd8('0x72')));}if(_0x190bda[_0x9bd8('0x75')]()){var _0x12b2d7=fs['readdirSync'](path[_0x9bd8('0x5c')](_0x363ba4,_0x2c9246[0x0]));if(_0x12b2d7['length']===0x0){removeReferences(_0x59bbde,_0x363ba4);logger[_0x9bd8('0x2e')]('Invalid\x20plugin\x20structure');return _0x470cad(new Error(_0x9bd8('0x72')));}var _0x43c7a9=_0x12b2d7[_0x9bd8('0x76')](function(_0x86c548){return _0x86c548==='manifest.json';});if(!_0x43c7a9){return _0x470cad(new Error(_0x9bd8('0x77')));}var _0x270645=fs['readFileSync'](path[_0x9bd8('0x5c')](_0x363ba4,_0x2c9246[0x0],_0x9bd8('0x78')));var _0xc9cf76=JSON[_0x9bd8('0x79')](_0x270645);if(_0x9bd8('0x7a')==typeof _0xc9cf76[_0x9bd8('0x2f')]){return _0x470cad(new Error(_0x9bd8('0x7b')));}if(_0x9bd8('0x7a')==typeof _0xc9cf76[_0x9bd8('0x36')]){return _0x470cad(new Error(_0x9bd8('0x7c')));}if(_0x9bd8('0x7a')==typeof _0xc9cf76[_0x9bd8('0x7d')]){return _0x470cad(new Error(_0x9bd8('0x7e')));}if(_0x9bd8('0x7a')==typeof _0xc9cf76['parameters']){return _0x470cad(new Error(_0x9bd8('0x7f')));}if(_0xc9cf76[_0x9bd8('0x36')]==='html'){if('undefined'==typeof _0xc9cf76['parameters'][_0x9bd8('0x80')]){return _0x470cad(new Error('Invalid\x20manifest:\x20views\x20missing'));}if('undefined'==typeof _0xc9cf76[_0x9bd8('0x81')][_0x9bd8('0x80')][_0x9bd8('0x82')]&&'undefined'==typeof _0xc9cf76['parameters']['views']['agent']){return _0x470cad(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0xc9cf76[_0x9bd8('0x36')]===_0x9bd8('0x83')){if(_0x9bd8('0x7a')==typeof _0xc9cf76['parameters']['scriptName']){return _0x470cad(new Error(_0x9bd8('0x84')));}if(_0x9bd8('0x7a')==typeof _0xc9cf76[_0x9bd8('0x81')]['scriptPath']){return _0x470cad(new Error(_0x9bd8('0x85')));}}else{return _0x470cad(new Error(_0x9bd8('0x86')));}var _0x1ec52f=_0xc9cf76['name'];var _0x140b2d=_0xc9cf76['description'];var _0x3cdcf0=_0xc9cf76[_0x9bd8('0x36')];var _0x167891=_0xc9cf76['sidebar']?_0xc9cf76[_0x9bd8('0x87')]:_0x9bd8('0x88');var _0x3f8407=_0xc9cf76['icon']?_0xc9cf76[_0x9bd8('0x89')]:_0x9bd8('0x8a');var _0x492f9f='';var _0xc68234='';var _0x46507e='';var _0x1da4a8='';var _0x1c4a03=_0xc9cf76[_0x9bd8('0x7d')];if(_0x3cdcf0===_0x9bd8('0x8b')){if('undefined'!=typeof _0xc9cf76[_0x9bd8('0x81')]['views'][_0x9bd8('0x82')]){var _0x5e17ac=_0xc9cf76[_0x9bd8('0x81')][_0x9bd8('0x80')][_0x9bd8('0x82')];if(!/^(f|ht)tps?:\/\//i['test'](_0x5e17ac)){_0x492f9f=path[_0x9bd8('0x5c')](_0x9bd8('0x8c'),_0x389222,_0x2c9246[0x0],_0x5e17ac);}else{_0x492f9f=_0x5e17ac;}}else{logger[_0x9bd8('0x66')]('Warning:\x20admin\x20view\x20not\x20specified');}if('undefined'!=typeof _0xc9cf76[_0x9bd8('0x81')][_0x9bd8('0x80')][_0x9bd8('0x8d')]){var _0x4f471b=_0xc9cf76['parameters'][_0x9bd8('0x80')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x9bd8('0x8e')](_0x4f471b)){_0xc68234=path[_0x9bd8('0x5c')](_0x9bd8('0x8c'),_0x389222,_0x2c9246[0x0],_0x4f471b);}else{_0xc68234=_0x4f471b;}}else{logger[_0x9bd8('0x66')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x3cdcf0==='script'){_0x46507e=_0xc9cf76[_0x9bd8('0x81')]['scriptName'];_0x1da4a8=_0xc9cf76['parameters']['scriptPath'];if('undefined'!=typeof _0xc9cf76[_0x9bd8('0x81')][_0x9bd8('0x80')]){if(_0x9bd8('0x7a')!=typeof _0xc9cf76[_0x9bd8('0x81')][_0x9bd8('0x80')]['admin']){var _0x5e17ac=_0xc9cf76[_0x9bd8('0x81')]['views'][_0x9bd8('0x82')];if(!/^(f|ht)tps?:\/\//i['test'](_0x5e17ac)){_0x492f9f=path[_0x9bd8('0x5c')](_0x9bd8('0x8c'),_0x389222,_0x2c9246[0x0],_0x5e17ac);}else{_0x492f9f=_0x5e17ac;}}if('undefined'!=typeof _0xc9cf76[_0x9bd8('0x81')][_0x9bd8('0x80')][_0x9bd8('0x8d')]){var _0x4f471b=_0xc9cf76[_0x9bd8('0x81')][_0x9bd8('0x80')][_0x9bd8('0x8d')];if(!/^(f|ht)tps?:\/\//i[_0x9bd8('0x8e')](_0x4f471b)){_0xc68234=path[_0x9bd8('0x5c')]('plugins',_0x389222,_0x2c9246[0x0],_0x4f471b);}else{_0xc68234=_0x4f471b;}}}}var _0x5088d2={'name':_0x1ec52f,'description':_0x140b2d,'path':path['join'](_0x389222,_0x2c9246[0x0]),'type':_0x3cdcf0,'sidebar':_0x167891,'icon':_0x3f8407,'adminUrl':_0x492f9f,'agentUrl':_0xc68234,'scriptName':_0x46507e,'scriptPath':_0x1da4a8,'version':_0x1c4a03};removeReferences(_0x59bbde,null);return db['Plugin']['create'](_0x5088d2)['then'](function(_0x5ccaf5){var _0x5d8f68={'role':_0x1da9ca['body'][_0x9bd8('0x8f')],'userProfileId':_0x1da9ca[_0x9bd8('0x90')][_0x9bd8('0x91')]};if(!_0x5d8f68)throw new Error(_0x9bd8('0x92'));if(_0x5d8f68[_0x9bd8('0x8f')]===_0x9bd8('0x93')){var _0x1e5b15=_0x5ccaf5['get']({'plain':!![]});return db['UserProfileSection'][_0x9bd8('0x50')]({'where':{'name':_0x9bd8('0x2b'),'userProfileId':_0x5d8f68[_0x9bd8('0x91')]},'raw':!![]})[_0x9bd8('0x29')](function(_0x18631a){if(_0x18631a&&_0x18631a[_0x9bd8('0x94')]===0x0){return db[_0x9bd8('0x2c')]['create']({'name':_0x1e5b15[_0x9bd8('0x2f')],'resourceId':_0x1e5b15['id'],'type':_0x18631a[_0x9bd8('0x2f')],'sectionId':_0x18631a['id']},{})['then'](function(){return _0x5ccaf5;});}else{return _0x5ccaf5;}})[_0x9bd8('0x4d')](function(_0x45abf1){logger[_0x9bd8('0x2e')](_0x9bd8('0x95'),_0x45abf1);throw _0x45abf1;});}return _0x5ccaf5;})[_0x9bd8('0x29')](respondWithResult(_0x2e1279,null))['catch'](handleError(_0x2e1279,null));}});}catch(_0xa49174){_0x2e1279[_0x9bd8('0x1f')](0x1f4)[_0x9bd8('0x30')](_0xa49174);}};function removeReferences(_0xa0efe7,_0x343c9d){try{if(_0xa0efe7){fs[_0x9bd8('0x65')](_0xa0efe7);logger[_0x9bd8('0x66')](_0x9bd8('0x96'));}if(_0x343c9d){rimraf(_0x343c9d,function(){});logger[_0x9bd8('0x66')](_0x9bd8('0x97'));}}catch(_0x4037b9){logger['error'](_0x4037b9);}}exports[_0x9bd8('0x28')]=function(_0x4d3b79,_0x3c325f,_0x48d81f){return db[_0x9bd8('0x33')][_0x9bd8('0x50')]({'where':{'id':_0x4d3b79[_0x9bd8('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3c325f,null))[_0x9bd8('0x29')](saveUpdates(_0x4d3b79['body'],null))[_0x9bd8('0x29')](respondWithResult(_0x3c325f,null))[_0x9bd8('0x4d')](handleError(_0x3c325f,null));};exports[_0x9bd8('0x98')]=function(_0x12a15e,_0x4cb04e,_0xb0fdda){return db['Plugin'][_0x9bd8('0x50')]({'where':{'id':_0x12a15e[_0x9bd8('0x4e')]['id']}})['then'](function(_0xf28bb5){if(_0xf28bb5){return _0xf28bb5[_0x9bd8('0x2d')]();}})[_0x9bd8('0x29')](function(_0x41e43e){rimraf(path[_0x9bd8('0x5c')](config['root'],_0x9bd8('0x52'),path[_0x9bd8('0x5e')](_0x41e43e['path'])),function(){});return _0x41e43e;})[_0x9bd8('0x29')](handleEntityNotFound(_0x4cb04e,null))[_0x9bd8('0x29')](respondWithStatusCode(_0x4cb04e,null))[_0x9bd8('0x4d')](handleError(_0x4cb04e,null));};exports['webhookGet']=function(_0x274671,_0xde793c,_0xe77b37){return BPromise[_0x9bd8('0x99')]()['then'](function(){if(!_0x274671['query']['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x274671['query']['port']){throw new Error(_0x9bd8('0x9a'));}var _0x5496f5=_0x274671[_0x9bd8('0x39')][_0x9bd8('0x9b')]?_0x274671['query']['hostname']+':'+_0x274671[_0x9bd8('0x39')][_0x9bd8('0x9c')]:_0x9bd8('0x9d')+_0x274671[_0x9bd8('0x39')]['port'];var _0x18ca42=_0x274671[_0x9bd8('0x39')][_0x9bd8('0x21')]?_0x274671[_0x9bd8('0x39')]['json']:!![];var _0x1d1afd=_0x274671[_0x9bd8('0x39')]['encoding']?_0x274671['query']['encoding']:null;var _0x5a761f={'method':_0x274671[_0x9bd8('0x9e')],'uri':util[_0x9bd8('0x53')](_0x9bd8('0x9f'),_0x5496f5,_0x274671[_0x9bd8('0x39')]['path']),'json':_0x18ca42,'resolveWithFullResponse':!![],'encoding':_0x1d1afd,'qs':_0x274671[_0x9bd8('0x39')]};if(_0x274671['headers']){_0x5a761f[_0x9bd8('0xa0')]=_0x274671[_0x9bd8('0xa0')];if(_0x5a761f[_0x9bd8('0xa0')][_0x9bd8('0xa1')]){delete _0x5a761f['headers'][_0x9bd8('0xa1')];}}if(_0x5a761f[_0x9bd8('0xa0')][_0x9bd8('0xa2')]){delete _0x5a761f['headers'][_0x9bd8('0xa2')];}return rp(_0x5a761f);})[_0x9bd8('0x29')](function(_0x3dc058){if(_0x3dc058){_0xde793c[_0x9bd8('0x25')](_0x3dc058[_0x9bd8('0xa0')]);logger[_0x9bd8('0x66')](_0x3dc058[_0x9bd8('0x90')]);if(_['endsWith'](_0x274671[_0x9bd8('0x39')][_0x9bd8('0x8')],'download')&&_0x3dc058[_0x9bd8('0xa3')]==0x1f4){return _0xde793c['sendStatus'](_0x3dc058['statusCode']);}else{return _0xde793c[_0x9bd8('0x1f')](_0x3dc058[_0x9bd8('0xa3')])[_0x9bd8('0x30')](_0x3dc058[_0x9bd8('0x90')]);}}else{return _0xde793c['sendStatus'](0xc8);}})['catch'](handleError(_0xde793c,null));};exports[_0x9bd8('0xa4')]=function(_0x5464dc,_0x1c3911,_0x5235ee){return BPromise[_0x9bd8('0x99')]()[_0x9bd8('0x29')](function(){if(!_0x5464dc[_0x9bd8('0x39')][_0x9bd8('0x8')]){throw new Error(_0x9bd8('0xa5'));}if(!_0x5464dc['query'][_0x9bd8('0x9c')]){throw new Error(_0x9bd8('0x9a'));}var _0x2dca17=_0x5464dc[_0x9bd8('0x39')][_0x9bd8('0x9b')]?_0x5464dc[_0x9bd8('0x39')]['hostname']+':'+_0x5464dc[_0x9bd8('0x39')]['port']:_0x9bd8('0x9d')+_0x5464dc[_0x9bd8('0x39')][_0x9bd8('0x9c')];var _0x57c63c=_0x5464dc[_0x9bd8('0x39')][_0x9bd8('0x21')]?_0x5464dc[_0x9bd8('0x39')][_0x9bd8('0x21')]:!![];var _0x14098c=_0x5464dc['query'][_0x9bd8('0xa6')]?_0x5464dc[_0x9bd8('0x39')]['encoding']:null;var _0x11389d={'method':_0x5464dc['method'],'uri':util[_0x9bd8('0x53')](_0x9bd8('0x9f'),_0x2dca17,_0x5464dc[_0x9bd8('0x39')]['path']),'json':_0x57c63c,'resolveWithFullResponse':!![],'encoding':_0x14098c,'body':_0x5464dc[_0x9bd8('0x90')]};if(_0x5464dc[_0x9bd8('0xa0')]){_0x11389d[_0x9bd8('0xa0')]=_0x5464dc['headers'];if(_0x11389d[_0x9bd8('0xa0')]['content-length']){delete _0x11389d[_0x9bd8('0xa0')]['content-length'];}}if(_0x11389d[_0x9bd8('0xa0')][_0x9bd8('0xa2')]){delete _0x11389d[_0x9bd8('0xa0')][_0x9bd8('0xa2')];}return rp(_0x11389d);})[_0x9bd8('0x29')](function(_0x33cbd0){if(_0x33cbd0){_0x1c3911[_0x9bd8('0x25')](_0x33cbd0[_0x9bd8('0xa0')]);logger[_0x9bd8('0x66')](_0x33cbd0[_0x9bd8('0x90')]);return _0x1c3911['status'](_0x33cbd0[_0x9bd8('0xa3')])['send'](_0x33cbd0['body']);}else{return _0x1c3911[_0x9bd8('0x1e')](0xc8);}})[_0x9bd8('0x4d')](handleError(_0x1c3911,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 1ee5a8f..7c67a78 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 _0xbb67=['hook','../../mysqldb','Plugin','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0xbb67,0x161));var _0x7bb6=function(_0x4ae14f,_0x13c217){_0x4ae14f=_0x4ae14f-0x0;var _0x23631b=_0xbb67[_0x4ae14f];return _0x23631b;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x7bb6('0x0'))['db'][_0x7bb6('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x7bb6('0x2')](0x0);var events={'afterCreate':_0x7bb6('0x3'),'afterUpdate':_0x7bb6('0x4'),'afterDestroy':'remove'};function emitEvent(_0x33a5c4){return function(_0x2c1ddb,_0x1f527c,_0x7fb7c9){PluginEvents[_0x7bb6('0x5')](_0x33a5c4+':'+_0x2c1ddb['id'],_0x2c1ddb);PluginEvents[_0x7bb6('0x5')](_0x33a5c4,_0x2c1ddb);_0x7fb7c9(null);};}for(var e in events){if(events[_0x7bb6('0x6')](e)){var event=events[e];Plugin[_0x7bb6('0x7')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0xdf98=['remove','emit','hasOwnProperty','exports','events','Plugin','update'];(function(_0x57975f,_0x388556){var _0x4793b8=function(_0x652c05){while(--_0x652c05){_0x57975f['push'](_0x57975f['shift']());}};_0x4793b8(++_0x388556);}(_0xdf98,0xcf));var _0x8df9=function(_0x4924ae,_0x1dd735){_0x4924ae=_0x4924ae-0x0;var _0x2238e4=_0xdf98[_0x4924ae];return _0x2238e4;};'use strict';var EventEmitter=require(_0x8df9('0x0'));var Plugin=require('../../mysqldb')['db'][_0x8df9('0x1')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x8df9('0x2'),'afterDestroy':_0x8df9('0x3')};function emitEvent(_0x19edc7){return function(_0xeec2ab,_0x3f2ade,_0x207605){PluginEvents[_0x8df9('0x4')](_0x19edc7+':'+_0xeec2ab['id'],_0xeec2ab);PluginEvents[_0x8df9('0x4')](_0x19edc7,_0xeec2ab);_0x207605(null);};}for(var e in events){if(events[_0x8df9('0x5')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x8df9('0x6')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 38c436f..df94a3e 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 _0x92d2=['exports','define','Plugin','plugins','lodash','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes'];(function(_0x3d05d0,_0xf4f18f){var _0x4b1f5a=function(_0x1f759f){while(--_0x1f759f){_0x3d05d0['push'](_0x3d05d0['shift']());}};_0x4b1f5a(++_0xf4f18f);}(_0x92d2,0x67));var _0x292d=function(_0x4a95a2,_0x1bc2a5){_0x4a95a2=_0x4a95a2-0x0;var _0x509a3a=_0x92d2[_0x4a95a2];return _0x509a3a;};'use strict';var _=require(_0x292d('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x292d('0x1'));var rp=require(_0x292d('0x2'));var fs=require('fs');var path=require(_0x292d('0x3'));var rimraf=require(_0x292d('0x4'));var config=require(_0x292d('0x5'));var attributes=require(_0x292d('0x6'));module[_0x292d('0x7')]=function(_0x1bc3cb,_0x2f8387){return _0x1bc3cb[_0x292d('0x8')](_0x292d('0x9'),attributes,{'tableName':_0x292d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x06fe=['exports','define','Plugin','lodash','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x4fb927,_0x42f767){var _0x2178ba=function(_0x44f4bd){while(--_0x44f4bd){_0x4fb927['push'](_0x4fb927['shift']());}};_0x2178ba(++_0x42f767);}(_0x06fe,0xff));var _0xe06f=function(_0x4207f4,_0x1f778b){_0x4207f4=_0x4207f4-0x0;var _0x29a621=_0x06fe[_0x4207f4];return _0x29a621;};'use strict';var _=require(_0xe06f('0x0'));var util=require('util');var logger=require(_0xe06f('0x1'))('api');var moment=require(_0xe06f('0x2'));var BPromise=require(_0xe06f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe06f('0x4'));var rimraf=require(_0xe06f('0x5'));var config=require('../../config/environment');var attributes=require('./plugin.attributes');module[_0xe06f('0x6')]=function(_0x1692c0,_0x3aa8c0){return _0x1692c0[_0xe06f('0x7')](_0xe06f('0x8'),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 8559496..aeb46f0 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 _0x95ba=['stringify','error','code','message','result','CreatePlugin','Plugin','create','body','options','raw','info','catch','lodash','bluebird','ioredis','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','then','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x95ba,0x70));var _0xa95b=function(_0x3f8e9f,_0x5e58da){_0x3f8e9f=_0x3f8e9f-0x0;var _0x4777a3=_0x95ba[_0x3f8e9f];return _0x4777a3;};'use strict';var _=require(_0xa95b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa95b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa95b('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa95b('0x3'))(_0xa95b('0x4'));var config=require('../../config/environment');var jayson=require(_0xa95b('0x5'));var client=jayson[_0xa95b('0x6')][_0xa95b('0x7')]({'port':0x232a});config[_0xa95b('0x8')]=_[_0xa95b('0x9')](config[_0xa95b('0x8')],{'host':_0xa95b('0xa'),'port':0x18eb});var socket=require(_0xa95b('0xb'))(new Redis(config[_0xa95b('0x8')]));require(_0xa95b('0xc'))[_0xa95b('0xd')](socket);function respondWithRpcPromise(_0x237c23,_0x2a03bd,_0x4c2b12){return new BPromise(function(_0x445dbf,_0x46cab3){return client[_0xa95b('0xe')](_0x237c23,_0x4c2b12)[_0xa95b('0xf')](function(_0x50c1c8){logger['info'](_0xa95b('0x10'),_0x2a03bd,_0xa95b('0x11'));logger[_0xa95b('0x12')](_0xa95b('0x13'),_0x2a03bd,_0xa95b('0x11'),JSON[_0xa95b('0x14')](_0x50c1c8));if(_0x50c1c8['error']){if(_0x50c1c8[_0xa95b('0x15')][_0xa95b('0x16')]===0x1f4){logger[_0xa95b('0x15')](_0xa95b('0x10'),_0x2a03bd,_0x50c1c8['error']['message']);return _0x46cab3(_0x50c1c8[_0xa95b('0x15')][_0xa95b('0x17')]);}logger[_0xa95b('0x15')](_0xa95b('0x10'),_0x2a03bd,_0x50c1c8[_0xa95b('0x15')][_0xa95b('0x17')]);return _0x445dbf(_0x50c1c8[_0xa95b('0x15')][_0xa95b('0x17')]);}else{logger['info']('Plugin,\x20%s,\x20%s',_0x2a03bd,_0xa95b('0x11'));_0x445dbf(_0x50c1c8[_0xa95b('0x18')][_0xa95b('0x17')]);}})['catch'](function(_0x30caa2){logger[_0xa95b('0x15')]('Plugin,\x20%s,\x20%s',_0x2a03bd,_0x30caa2);_0x46cab3(_0x30caa2);});});}exports[_0xa95b('0x19')]=function(_0x46d0ce){var _0xd3ef6f=this;return new Promise(function(_0x307d8c,_0x11fb02){return db[_0xa95b('0x1a')][_0xa95b('0x1b')](_0x46d0ce[_0xa95b('0x1c')],{'raw':_0x46d0ce['options']?_0x46d0ce[_0xa95b('0x1d')][_0xa95b('0x1e')]===undefined?!![]:![]:!![]})[_0xa95b('0xf')](function(_0xc32f8e){logger[_0xa95b('0x1f')](_0xa95b('0x19'),_0x46d0ce);logger[_0xa95b('0x12')](_0xa95b('0x19'),_0x46d0ce,JSON[_0xa95b('0x14')](_0xc32f8e));_0x307d8c(_0xc32f8e);})[_0xa95b('0x20')](function(_0x35c582){logger[_0xa95b('0x15')](_0xa95b('0x19'),_0x35c582['message'],_0x46d0ce);_0x11fb02(_0xd3ef6f[_0xa95b('0x15')](0x1f4,_0x35c582['message']));});});}; \ No newline at end of file +var _0xff8d=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreatePlugin','Plugin','body','options','debug','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x5b76b1,_0x1317c6){var _0x5a6b70=function(_0x18826e){while(--_0x18826e){_0x5b76b1['push'](_0x5b76b1['shift']());}};_0x5a6b70(++_0x1317c6);}(_0xff8d,0x7d));var _0xdff8=function(_0x23020f,_0x22dfd0){_0x23020f=_0x23020f-0x0;var _0x446065=_0xff8d[_0x23020f];return _0x446065;};'use strict';var _=require('lodash');var util=require(_0xdff8('0x0'));var moment=require(_0xdff8('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdff8('0x2'));var db=require(_0xdff8('0x3'))['db'];var utils=require(_0xdff8('0x4'));var logger=require(_0xdff8('0x5'))('rpc');var config=require(_0xdff8('0x6'));var jayson=require(_0xdff8('0x7'));var client=jayson[_0xdff8('0x8')][_0xdff8('0x9')]({'port':0x232a});config[_0xdff8('0xa')]=_[_0xdff8('0xb')](config[_0xdff8('0xa')],{'host':_0xdff8('0xc'),'port':0x18eb});var socket=require(_0xdff8('0xd'))(new Redis(config[_0xdff8('0xa')]));require(_0xdff8('0xe'))[_0xdff8('0xf')](socket);function respondWithRpcPromise(_0x3c6b88,_0x56af7e,_0x354d3a){return new BPromise(function(_0x21b81e,_0x2bac0a){return client[_0xdff8('0x10')](_0x3c6b88,_0x354d3a)[_0xdff8('0x11')](function(_0x41f4bc){logger[_0xdff8('0x12')](_0xdff8('0x13'),_0x56af7e,_0xdff8('0x14'));logger['debug'](_0xdff8('0x15'),_0x56af7e,_0xdff8('0x14'),JSON[_0xdff8('0x16')](_0x41f4bc));if(_0x41f4bc[_0xdff8('0x17')]){if(_0x41f4bc[_0xdff8('0x17')][_0xdff8('0x18')]===0x1f4){logger[_0xdff8('0x17')](_0xdff8('0x13'),_0x56af7e,_0x41f4bc[_0xdff8('0x17')][_0xdff8('0x19')]);return _0x2bac0a(_0x41f4bc[_0xdff8('0x17')][_0xdff8('0x19')]);}logger[_0xdff8('0x17')](_0xdff8('0x13'),_0x56af7e,_0x41f4bc[_0xdff8('0x17')][_0xdff8('0x19')]);return _0x21b81e(_0x41f4bc[_0xdff8('0x17')][_0xdff8('0x19')]);}else{logger[_0xdff8('0x12')](_0xdff8('0x13'),_0x56af7e,_0xdff8('0x14'));_0x21b81e(_0x41f4bc[_0xdff8('0x1a')]['message']);}})['catch'](function(_0x386720){logger[_0xdff8('0x17')](_0xdff8('0x13'),_0x56af7e,_0x386720);_0x2bac0a(_0x386720);});});}exports[_0xdff8('0x1b')]=function(_0x33d96e){var _0x24091a=this;return new Promise(function(_0x11e35a,_0x2ee8d0){return db[_0xdff8('0x1c')]['create'](_0x33d96e[_0xdff8('0x1d')],{'raw':_0x33d96e[_0xdff8('0x1e')]?_0x33d96e['options']['raw']===undefined?!![]:![]:!![]})[_0xdff8('0x11')](function(_0x4054a8){logger[_0xdff8('0x12')]('CreatePlugin',_0x33d96e);logger[_0xdff8('0x1f')](_0xdff8('0x1b'),_0x33d96e,JSON[_0xdff8('0x16')](_0x4054a8));_0x11e35a(_0x4054a8);})[_0xdff8('0x20')](function(_0x1f2a9f){logger[_0xdff8('0x17')](_0xdff8('0x1b'),_0x1f2a9f[_0xdff8('0x19')],_0x33d96e);_0x2ee8d0(_0x24091a[_0xdff8('0x17')](0x1f4,_0x1f2a9f[_0xdff8('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 3729f9c..058973e 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 _0x3519=['update','emit','removeListener','length','save','remove'];(function(_0x3add58,_0x49ee99){var _0x3d655e=function(_0x186437){while(--_0x186437){_0x3add58['push'](_0x3add58['shift']());}};_0x3d655e(++_0x49ee99);}(_0x3519,0x1b4));var _0x9351=function(_0x5184d5,_0x57e7e9){_0x5184d5=_0x5184d5-0x0;var _0x21f67b=_0x3519[_0x5184d5];return _0x21f67b;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x9351('0x0'),_0x9351('0x1'),_0x9351('0x2')];function createListener(_0x4d01b3,_0x5c7ef5){return function(_0x2dde47){_0x5c7ef5[_0x9351('0x3')](_0x4d01b3,_0x2dde47);};}function removeListener(_0x511ffc,_0x23d55){return function(){PluginEvents[_0x9351('0x4')](_0x511ffc,_0x23d55);};}exports['register']=function(_0x1ffe42){for(var _0x31b219=0x0,_0x3776f0=events[_0x9351('0x5')];_0x31b219<_0x3776f0;_0x31b219++){var _0x2dd0d1=events[_0x31b219];var _0x5769de=createListener('plugin:'+_0x2dd0d1,_0x1ffe42);PluginEvents['on'](_0x2dd0d1,_0x5769de);}}; \ No newline at end of file +var _0x8689=['plugin:','save','remove','update','removeListener','register'];(function(_0x172660,_0x260d9b){var _0x83204f=function(_0x4d6c80){while(--_0x4d6c80){_0x172660['push'](_0x172660['shift']());}};_0x83204f(++_0x260d9b);}(_0x8689,0x15d));var _0x9868=function(_0x252ca4,_0xce8771){_0x252ca4=_0x252ca4-0x0;var _0x372be6=_0x8689[_0x252ca4];return _0x372be6;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x9868('0x0'),_0x9868('0x1'),_0x9868('0x2')];function createListener(_0x528449,_0x4566de){return function(_0x294151){_0x4566de['emit'](_0x528449,_0x294151);};}function removeListener(_0xae7b8e,_0x1c4794){return function(){PluginEvents[_0x9868('0x3')](_0xae7b8e,_0x1c4794);};}exports[_0x9868('0x4')]=function(_0x19b972){for(var _0x125c5b=0x0,_0xcdee22=events['length'];_0x125c5b<_0xcdee22;_0x125c5b++){var _0x124bd8=events[_0x125c5b];var _0x1f2e97=createListener(_0x9868('0x5')+_0x124bd8,_0x19b972);PluginEvents['on'](_0x124bd8,_0x1f2e97);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 824064f..aff8701 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(_0x64ce40,_0x21507d){var _0x41a783=function(_0xc2fcef){while(--_0xc2fcef){_0x64ce40['push'](_0x64ce40['shift']());}};_0x41a783(++_0x21507d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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(_0xc3591f,_0x1363ba){var _0x5ccc6b=function(_0x5a3417){while(--_0x5a3417){_0xc3591f['push'](_0xc3591f['shift']());}};_0x5ccc6b(++_0x1363ba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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 6072c9c..f3ab733 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 _0xbfcc=['exec','sendStatus','json','stack','name','status','send','npm\x20install','info','error','index','list','then','reject','express','motion2','catch','show','params','create','body','script','../../files/plugins','start','dump','Missing\x20name\x20and/or\x20path','update','stop','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','api','path','child_process'];(function(_0x7d62cb,_0x7622c){var _0x3a6266=function(_0x1cc5fa){while(--_0x1cc5fa){_0x7d62cb['push'](_0x7d62cb['shift']());}};_0x3a6266(++_0x7622c);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x23c6f2,_0x4e033c){_0x23c6f2=_0x23c6f2-0x0;var _0x4c270b=_0xbfcc[_0x23c6f2];return _0x4c270b;};'use strict';var _=require(_0xcbfc('0x0'));var pm2=require('../../config/pm2');var logger=require('../../config/logger')(_0xcbfc('0x1'));var path=require(_0xcbfc('0x2'));var exec=require(_0xcbfc('0x3'))[_0xcbfc('0x4')];var BPromise=require('bluebird');function handleEntityNotFound(_0x59b1de,_0x54f81b){return function(_0x4b8361){if(!_0x4b8361){_0x59b1de[_0xcbfc('0x5')](0x194);;}return _0x4b8361;};}function respondWithResult(_0x2dbb05,_0x537813){_0x537813=_0x537813||0xc8;return function(_0x1b3917){if(_0x1b3917){return _0x2dbb05['status'](_0x537813)[_0xcbfc('0x6')](_0x1b3917);}return null;};}function handleError(_0x1f8b71,_0x1b1377){_0x1b1377=_0x1b1377||0x1f4;return function(_0xa1c83b){logger['error'](_0xa1c83b[_0xcbfc('0x7')]);if(_0xa1c83b[_0xcbfc('0x8')]){delete _0xa1c83b[_0xcbfc('0x8')];}_0x1f8b71[_0xcbfc('0x9')](_0x1b1377)[_0xcbfc('0xa')](_0xa1c83b);};}function execChildProcess(){return new BPromise(function(_0x3498c7,_0x4b34aa){exec(_0xcbfc('0xb'),function(_0x376a4c,_0x1e0d79,_0xbbb176){logger[_0xcbfc('0xc')](_0x1e0d79);logger['info'](_0xbbb176);if(_0x376a4c){logger[_0xcbfc('0xd')](_0x376a4c);return _0x4b34aa(_0x376a4c);}return _0x3498c7(_0x1e0d79);});});}exports[_0xcbfc('0xe')]=function(_0x80d08d,_0x5ba249){return pm2[_0xcbfc('0xf')]()[_0xcbfc('0x10')](function(_0x2f2bdd){if(_0x2f2bdd){var _0x45a5cc=_[_0xcbfc('0x11')](_0x2f2bdd,function(_0x53a7ea){return _0x53a7ea[_0xcbfc('0x8')]===_0xcbfc('0x12')||_0x53a7ea[_0xcbfc('0x8')]===_0xcbfc('0x13');});return{'rows':_0x45a5cc,'count':_0x45a5cc['length']};}return null;})['then'](respondWithResult(_0x5ba249,null))[_0xcbfc('0x14')](handleError(_0x5ba249,null));};exports[_0xcbfc('0x15')]=function(_0xa65368,_0x4d6946){return pm2['describe'](_0xa65368[_0xcbfc('0x16')]['id'])[_0xcbfc('0x10')](respondWithResult(_0x4d6946,null))[_0xcbfc('0x10')](handleEntityNotFound(_0x4d6946,null))['catch'](handleError(_0x4d6946,null));};exports[_0xcbfc('0x17')]=function(_0x552777,_0x28f7fb){if(_0x552777[_0xcbfc('0x18')][_0xcbfc('0x8')]&&_0x552777[_0xcbfc('0x18')][_0xcbfc('0x19')]){var _0x2653b1=path['join'](__dirname,_0xcbfc('0x1a'),_0x552777[_0xcbfc('0x18')]['script']);var _0x1da958=process['cwd']();process['chdir'](path['dirname'](_0x2653b1));return execChildProcess()[_0xcbfc('0x10')](function(_0x4a0fcb){process['chdir'](_0x1da958);return pm2[_0xcbfc('0x1b')]({'name':_0x552777[_0xcbfc('0x18')][_0xcbfc('0x8')],'script':_0x2653b1});})[_0xcbfc('0x10')](function(_0x49f5bf){pm2[_0xcbfc('0x1c')]();return _0x49f5bf[0x0];})['then'](respondWithResult(_0x28f7fb,0xc9))[_0xcbfc('0x14')](handleError(_0x28f7fb,null));}else{return _0x28f7fb[_0xcbfc('0x9')](0x1f4)['send']({'message':_0xcbfc('0x1d')});}};exports[_0xcbfc('0x1e')]=function(_0x4ab48e,_0x1b2c01){if(_0x4ab48e[_0xcbfc('0x18')]['id']){delete _0x4ab48e[_0xcbfc('0x18')]['id'];}var _0x41f3b8={'online':'restart','stopped':_0xcbfc('0x1f')};if(_0x41f3b8[_0xcbfc('0x20')](_0x4ab48e['body'][_0xcbfc('0x9')])){return pm2[_0x41f3b8[_0x4ab48e[_0xcbfc('0x18')][_0xcbfc('0x9')]]](_0x4ab48e[_0xcbfc('0x16')]['id'])[_0xcbfc('0x10')](respondWithResult(_0x1b2c01,0xc8))[_0xcbfc('0x14')](handleError(_0x1b2c01,null));}else{return _0x1b2c01[_0xcbfc('0x9')](0x1f4)['send']({'message':_0xcbfc('0x21')});}};exports[_0xcbfc('0x22')]=function(_0x3f9d20,_0x20a378){if(_0x3f9d20['body']['id']){delete _0x3f9d20[_0xcbfc('0x18')]['id'];}if(_0x3f9d20[_0xcbfc('0x16')]['id']){return pm2[_0xcbfc('0x23')](_0x3f9d20[_0xcbfc('0x16')]['id'])[_0xcbfc('0x10')](function(_0x34baa6){pm2[_0xcbfc('0x1c')]();return _0x34baa6[0x0];})['then'](respondWithResult(_0x20a378,null))[_0xcbfc('0x14')](handleError(_0x20a378,null));}else{return _0x20a378[_0xcbfc('0x9')](0x1f4)['send']({'message':_0xcbfc('0x24')});}}; \ No newline at end of file +var _0x34e5=['info','error','list','then','reject','motion2','catch','show','describe','params','create','body','script','join','../../files/plugins','cwd','dirname','chdir','start','dump','send','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty','Unknown\x20status','destroy','delete','../../config/pm2','api','path','child_process','exec','bluebird','sendStatus','status','name','npm\x20install'];(function(_0x196fb1,_0x3bcecc){var _0x5d0854=function(_0x26c566){while(--_0x26c566){_0x196fb1['push'](_0x196fb1['shift']());}};_0x5d0854(++_0x3bcecc);}(_0x34e5,0x172));var _0x534e=function(_0x4ff9be,_0x346a0c){_0x4ff9be=_0x4ff9be-0x0;var _0x262037=_0x34e5[_0x4ff9be];return _0x262037;};'use strict';var _=require('lodash');var pm2=require(_0x534e('0x0'));var logger=require('../../config/logger')(_0x534e('0x1'));var path=require(_0x534e('0x2'));var exec=require(_0x534e('0x3'))[_0x534e('0x4')];var BPromise=require(_0x534e('0x5'));function handleEntityNotFound(_0x50b790,_0x11a158){return function(_0x3d8287){if(!_0x3d8287){_0x50b790[_0x534e('0x6')](0x194);;}return _0x3d8287;};}function respondWithResult(_0x117f0c,_0x436a92){_0x436a92=_0x436a92||0xc8;return function(_0x2d0370){if(_0x2d0370){return _0x117f0c[_0x534e('0x7')](_0x436a92)['json'](_0x2d0370);}return null;};}function handleError(_0x24d562,_0x929597){_0x929597=_0x929597||0x1f4;return function(_0xa836bb){logger['error'](_0xa836bb['stack']);if(_0xa836bb[_0x534e('0x8')]){delete _0xa836bb['name'];}_0x24d562[_0x534e('0x7')](_0x929597)['send'](_0xa836bb);};}function execChildProcess(){return new BPromise(function(_0xb30dd6,_0x310b6d){exec(_0x534e('0x9'),function(_0x529726,_0x1b7a5a,_0x229352){logger[_0x534e('0xa')](_0x1b7a5a);logger[_0x534e('0xa')](_0x229352);if(_0x529726){logger[_0x534e('0xb')](_0x529726);return _0x310b6d(_0x529726);}return _0xb30dd6(_0x1b7a5a);});});}exports['index']=function(_0x31d764,_0x23c11c){return pm2[_0x534e('0xc')]()[_0x534e('0xd')](function(_0x359565){if(_0x359565){var _0x478027=_[_0x534e('0xe')](_0x359565,function(_0x17c068){return _0x17c068[_0x534e('0x8')]==='express'||_0x17c068[_0x534e('0x8')]===_0x534e('0xf');});return{'rows':_0x478027,'count':_0x478027['length']};}return null;})['then'](respondWithResult(_0x23c11c,null))[_0x534e('0x10')](handleError(_0x23c11c,null));};exports[_0x534e('0x11')]=function(_0x9297b6,_0x16ad40){return pm2[_0x534e('0x12')](_0x9297b6[_0x534e('0x13')]['id'])[_0x534e('0xd')](respondWithResult(_0x16ad40,null))['then'](handleEntityNotFound(_0x16ad40,null))[_0x534e('0x10')](handleError(_0x16ad40,null));};exports[_0x534e('0x14')]=function(_0x466d74,_0x1bef0a){if(_0x466d74[_0x534e('0x15')]['name']&&_0x466d74[_0x534e('0x15')][_0x534e('0x16')]){var _0x5f9ae9=path[_0x534e('0x17')](__dirname,_0x534e('0x18'),_0x466d74[_0x534e('0x15')][_0x534e('0x16')]);var _0x85188b=process[_0x534e('0x19')]();process['chdir'](path[_0x534e('0x1a')](_0x5f9ae9));return execChildProcess()[_0x534e('0xd')](function(_0x39466c){process[_0x534e('0x1b')](_0x85188b);return pm2[_0x534e('0x1c')]({'name':_0x466d74[_0x534e('0x15')][_0x534e('0x8')],'script':_0x5f9ae9});})[_0x534e('0xd')](function(_0x53a6ef){pm2[_0x534e('0x1d')]();return _0x53a6ef[0x0];})['then'](respondWithResult(_0x1bef0a,0xc9))[_0x534e('0x10')](handleError(_0x1bef0a,null));}else{return _0x1bef0a[_0x534e('0x7')](0x1f4)[_0x534e('0x1e')]({'message':_0x534e('0x1f')});}};exports[_0x534e('0x20')]=function(_0x57b216,_0x743974){if(_0x57b216[_0x534e('0x15')]['id']){delete _0x57b216['body']['id'];}var _0x4bd073={'online':_0x534e('0x21'),'stopped':'stop'};if(_0x4bd073[_0x534e('0x22')](_0x57b216[_0x534e('0x15')][_0x534e('0x7')])){return pm2[_0x4bd073[_0x57b216[_0x534e('0x15')][_0x534e('0x7')]]](_0x57b216[_0x534e('0x13')]['id'])[_0x534e('0xd')](respondWithResult(_0x743974,0xc8))['catch'](handleError(_0x743974,null));}else{return _0x743974['status'](0x1f4)[_0x534e('0x1e')]({'message':_0x534e('0x23')});}};exports[_0x534e('0x24')]=function(_0x2f1c49,_0x423502){if(_0x2f1c49[_0x534e('0x15')]['id']){delete _0x2f1c49[_0x534e('0x15')]['id'];}if(_0x2f1c49[_0x534e('0x13')]['id']){return pm2[_0x534e('0x25')](_0x2f1c49[_0x534e('0x13')]['id'])[_0x534e('0xd')](function(_0x1d6fb1){pm2['dump']();return _0x1d6fb1[0x0];})[_0x534e('0xd')](respondWithResult(_0x423502,null))[_0x534e('0x10')](handleError(_0x423502,null));}else{return _0x423502['status'](0x1f4)[_0x534e('0x1e')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index e2bb1c6..256d889 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 _0x15ef=['./realtime.controller','get','/agents','isAuthenticated','getAgents','exports','express','Router','../../components/auth/service'];(function(_0x122983,_0x3a9e38){var _0x596f84=function(_0x3e46ee){while(--_0x3e46ee){_0x122983['push'](_0x122983['shift']());}};_0x596f84(++_0x3a9e38);}(_0x15ef,0x1b6));var _0xf15e=function(_0x4f2631,_0x88cbf7){_0x4f2631=_0x4f2631-0x0;var _0x2d2f74=_0x15ef[_0x4f2631];return _0x2d2f74;};'use strict';var express=require(_0xf15e('0x0'));var router=express[_0xf15e('0x1')]();var auth=require(_0xf15e('0x2'));var controller=require(_0xf15e('0x3'));router[_0xf15e('0x4')](_0xf15e('0x5'),auth[_0xf15e('0x6')](),controller[_0xf15e('0x7')]);router[_0xf15e('0x4')]('/queues',auth[_0xf15e('0x6')](),controller['getQueues']);module[_0xf15e('0x8')]=router; \ No newline at end of file +var _0x46a2=['express','Router','../../components/auth/service','./realtime.controller','/agents','isAuthenticated','/queues','getQueues'];(function(_0x1b6234,_0x42a3e9){var _0x209b77=function(_0x5c17bd){while(--_0x5c17bd){_0x1b6234['push'](_0x1b6234['shift']());}};_0x209b77(++_0x42a3e9);}(_0x46a2,0x110));var _0x246a=function(_0x82140,_0x3a9d87){_0x82140=_0x82140-0x0;var _0x2b15a6=_0x46a2[_0x82140];return _0x2b15a6;};'use strict';var express=require(_0x246a('0x0'));var router=express[_0x246a('0x1')]();var auth=require(_0x246a('0x2'));var controller=require(_0x246a('0x3'));router['get'](_0x246a('0x4'),auth[_0x246a('0x5')](),controller['getAgents']);router['get'](_0x246a('0x6'),auth['isAuthenticated'](),controller[_0x246a('0x7')]);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 fca7118..071c87a 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 _0xf917=['join','getAgentIdsByQueues','getRealtimeAgents','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','User','rawAttributes','fieldName','type','key','role','agent','online','getOptions','raw','push','sequelize','literal','FIELD(id,','order','forEach','Pause','merge','where','user','Agents','assign','UserProfile','findAndCountAll','rows','map','find','getAgentStatus','sortAgentsByStatus','fields','split','pick','getQueues','format','Channel\x20parameter\x20%s\x20is\x20invalid','startCase','Queue','name','outbound','dialActive','userProfileId','voice','QueueCampaigns','Queues','filter','getResources','getRealtimeQueues','util','../../components/parsers/qs','../../config/utils','../../mysqldb','APIBadRequestError','../../errors/api','handleError','undefined','count','offset','limit','status','set','Content-Range','json','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','pause','*pause','resolve','then','channel','isValidChannel','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions'];(function(_0x24f053,_0x2c4af1){var _0x3674f4=function(_0x28c615){while(--_0x28c615){_0x24f053['push'](_0x24f053['shift']());}};_0x3674f4(++_0x2c4af1);}(_0xf917,0x8b));var _0x7f91=function(_0x73ba1f,_0x588ccb){_0x73ba1f=_0x73ba1f-0x0;var _0x2e2725=_0xf917[_0x73ba1f];return _0x2e2725;};'use strict';var _=require('lodash');var util=require(_0x7f91('0x0'));var rta=require('../../components/realtime/agents');var rtq=require('../../components/realtime/queues');var qs=require(_0x7f91('0x1'));var utils=require(_0x7f91('0x2'));var db=require(_0x7f91('0x3'))['db'];var APIBadRequestError=require('../../errors/api')[_0x7f91('0x4')];var APIHandleError=require(_0x7f91('0x5'))[_0x7f91('0x6')];function respondWithFilteredResult(_0x2729bf,_0x165c24){return function(_0x572853){if(_0x572853){var _0x20c416=typeof _0x165c24['offset']===_0x7f91('0x7')&&typeof _0x165c24['limit']==='undefined';var _0x5e757a=_0x572853[_0x7f91('0x8')];var _0xb80de5=_0x20c416?0x0:_0x165c24[_0x7f91('0x9')];var _0x4dee95=_0x20c416?_0x572853[_0x7f91('0x8')]:_0x165c24[_0x7f91('0x9')]+_0x165c24[_0x7f91('0xa')];var _0x359079;if(_0x4dee95>=_0x5e757a){_0x4dee95=_0x5e757a;_0x359079=0xc8;}else{_0x359079=0xce;}_0x2729bf[_0x7f91('0xb')](_0x359079);return _0x2729bf[_0x7f91('0xc')](_0x7f91('0xd'),_0xb80de5+'-'+_0x4dee95+'/'+_0x5e757a)[_0x7f91('0xe')](_0x572853);}return null;};}exports[_0x7f91('0xf')]=function(_0x3d0959,_0x5603d1){var _0x4f1a85={'count':0x0,'rows':[]};var _0x3e6416={};var _0x547918;var _0x318a26=utils[_0x7f91('0x10')]();var _0x2c9295;var _0x133a88;var _0x3e1314=_0x3d0959[_0x7f91('0x11')][_0x7f91('0x12')];var _0x165f0a=_0x3d0959['query'][_0x7f91('0x13')];var _0x4a4848=_0x3d0959[_0x7f91('0x11')][_0x7f91('0x14')];var _0x4dbbc0=_0x165f0a===_0x7f91('0x15')||_0x165f0a===_0x7f91('0x16')?!![]:![];var _0x417b67=[];var _0x3c6da7;var _0x438b0a;Promise[_0x7f91('0x17')]()[_0x7f91('0x18')](function(){if(_0x3d0959['query'][_0x7f91('0x19')]){if(!utils[_0x7f91('0x1a')](_0x3d0959[_0x7f91('0x11')][_0x7f91('0x19')])){throw new APIBadRequestError(util['format']('Channel\x20parameter\x20%s\x20is\x20invalid',_0x3d0959[_0x7f91('0x11')][_0x7f91('0x19')]));}_0x547918=_0x3d0959['query']['channel'][_0x7f91('0x1b')]();}if(!_0x3d0959[_0x7f91('0x11')][_0x7f91('0x1c')]||!_0x3d0959[_0x7f91('0x11')][_0x7f91('0x1c')][_0x7f91('0x1d')](_0x7f91('0x1e'))){_0x3d0959[_0x7f91('0x11')][_0x7f91('0x1c')]=rta[_0x7f91('0x1f')](_0x3d0959[_0x7f91('0x11')][_0x7f91('0x1c')]);return;}var _0x528c73=rta[_0x7f91('0x20')](_0x3d0959[_0x7f91('0x11')][_0x7f91('0x1c')]);_0x3d0959['query']['sort']=_0x528c73['fields'][_0x7f91('0x21')](',');_0x3c6da7=_0x528c73['order'];})[_0x7f91('0x18')](function(){if(!_0x3e1314){return[];}return rta[_0x7f91('0x22')](_0x3e1314,_0x547918);})['then'](function(_0xdb541b){_0x417b67=_0xdb541b;return rta[_0x7f91('0x23')]();})[_0x7f91('0x18')](function(_0x4a5340){_0x133a88=_0x4a5340['rows'];if((!_0x165f0a||_0x4dbbc0)&&!_0x3c6da7){return _0x417b67;}if(_0x3c6da7&&!_0x165f0a){return rta[_0x7f91('0x24')](_0x133a88,_0x417b67,_0x3c6da7);}else{return rta[_0x7f91('0x25')](_0x133a88,_0x417b67,_0x165f0a);}})[_0x7f91('0x18')](function(_0x302777){_0x417b67=_0x302777;var _0x44f6a4=![];if(_0x417b67[_0x7f91('0x26')]===0x0){if(_0x3e1314||_0x165f0a){_0x44f6a4=!![];}if(_0x4dbbc0){_0x44f6a4=![];}}if(_0x44f6a4){return _0x4f1a85;}var _0x2e2feb=_['map'](db[_0x7f91('0x27')][_0x7f91('0x28')],function(_0x59842f){return{'name':_0x59842f[_0x7f91('0x29')],'type':_0x59842f[_0x7f91('0x2a')][_0x7f91('0x2b')]};});_0x3d0959[_0x7f91('0x11')][_0x7f91('0x2c')]=_0x7f91('0x2d');_0x3d0959[_0x7f91('0x11')][_0x7f91('0x2e')]=!![];_0x3e6416=qs[_0x7f91('0x2f')](_0x2e2feb,_0x3d0959);_0x3e6416[_0x7f91('0x30')]=!![];var _0x373686=[];if(_0x417b67[_0x7f91('0x26')]>0x0){_0x373686[_0x7f91('0x31')]({'id':{'$in':_0x417b67}});if(_0x3c6da7&&!_0x165f0a){_0x438b0a=[db[_0x7f91('0x32')][_0x7f91('0x33')](_0x7f91('0x34')+_0x417b67+')')];_0x3e6416[_0x7f91('0x35')]=_0x438b0a;}}if(_0x4dbbc0){_0x318a26[_0x7f91('0x36')](function(_0x5f2297){var _0x50e095=!![];if(_0x165f0a===_0x7f91('0x16')&&_0x547918!==_0x5f2297){_0x50e095=![];}_0x373686[_0x7f91('0x31')]({[_0x5f2297+_0x7f91('0x37')]:_0x50e095});});if(_0x4a4848){_0x373686['push']({'pauseType':_0x4a4848});}}else if(_0x165f0a){_0x318a26[_0x7f91('0x36')](function(_0x116954){_0x373686[_0x7f91('0x31')]({[_0x116954+'Pause']:![]});});}_0x3e6416['where']=_[_0x7f91('0x38')](_0x3e6416[_0x7f91('0x39')],{'$and':_0x373686});if(_0x3d0959['user'][_0x7f91('0x2c')]==='user'){var _0x412c61={'params':{'id':_0x3d0959[_0x7f91('0x3a')]['userProfileId']},'query':{'section':_0x7f91('0x3b'),'role':'agent','online':!![],'raw':!![],'ids':_0x417b67,'customSorting':_0x438b0a}};if(_0x4dbbc0){_0x412c61[_0x7f91('0x11')]['extraQueryConditions']=_0x373686;}_0x412c61[_0x7f91('0x11')]=Object[_0x7f91('0x3c')](_0x412c61['query'],_0x3d0959[_0x7f91('0x11')]);delete _0x412c61[_0x7f91('0x11')]['id'];return db[_0x7f91('0x3d')]['getResources'](_0x412c61);}return db[_0x7f91('0x27')][_0x7f91('0x3e')](_0x3e6416);})[_0x7f91('0x18')](function(_0x51638a){_0x4f1a85[_0x7f91('0x8')]=_0x51638a[_0x7f91('0x8')];_0x2c9295=_0x51638a[_0x7f91('0x3f')];return _0x2c9295[_0x7f91('0x40')](function(_0x4c6004){var _0x5b9eb8=_[_0x7f91('0x41')](_0x133a88,['id',_0x4c6004['id']]);if(_0x5b9eb8){var _0x17b8da=rta['filterAgentAttributes'](_0x5b9eb8);_['merge'](_0x4c6004,_0x17b8da);}_0x4c6004[_0x7f91('0x1e')]=rta[_0x7f91('0x42')](_0x4c6004);if(_0x4c6004[_0x7f91('0x1e')]['includes']('pause')){_0x318a26[_0x7f91('0x36')](function(_0x499622){if(_0x4c6004[_0x499622+_0x7f91('0x37')]){_0x4c6004[_0x499622+'Status']='pause';}});}return _0x4c6004;});})[_0x7f91('0x18')](function(_0x1822d4){if(!_0x3c6da7||_0x438b0a){return _0x1822d4;}return rta[_0x7f91('0x43')](_0x1822d4,_0x3c6da7);})['then'](function(_0x50d4e8){var _0x136506=null;if(_0x3d0959[_0x7f91('0x11')][_0x7f91('0x44')]){var _0x2a24a8=_0x3d0959[_0x7f91('0x11')][_0x7f91('0x44')][_0x7f91('0x45')](',');_0x136506=_0x50d4e8[_0x7f91('0x40')](function(_0x5c7914){return _[_0x7f91('0x46')](_0x5c7914,_0x2a24a8);});}_0x4f1a85['rows']=_0x136506||_0x50d4e8;return _0x4f1a85;})[_0x7f91('0x18')](respondWithFilteredResult(_0x5603d1,_0x3e6416))['catch'](APIHandleError(_0x5603d1));};exports[_0x7f91('0x47')]=function(_0x4cdb28,_0x361359){var _0x189ba8={'count':0x0,'rows':[]};var _0x4a424a={};var _0x28a92a;var _0x189051;var _0x480599;Promise['resolve']()[_0x7f91('0x18')](function(){if(_0x4cdb28[_0x7f91('0x11')][_0x7f91('0x19')]){if(!utils[_0x7f91('0x1a')](_0x4cdb28[_0x7f91('0x11')][_0x7f91('0x19')])){throw new APIBadRequestError(util[_0x7f91('0x48')](_0x7f91('0x49'),_0x4cdb28[_0x7f91('0x11')][_0x7f91('0x19')]));}_0x28a92a=_0x4cdb28[_0x7f91('0x11')][_0x7f91('0x19')][_0x7f91('0x1b')]();}var _0x197399=_[_0x7f91('0x4a')](_0x28a92a)+_0x7f91('0x4b');var _0x11ba70=_['map'](db[_0x197399][_0x7f91('0x28')],function(_0x2066f9){return{'name':_0x2066f9[_0x7f91('0x29')],'type':_0x2066f9[_0x7f91('0x2a')][_0x7f91('0x2b')]};});if(!_0x4cdb28[_0x7f91('0x11')][_0x7f91('0x44')]){var _0x2d1c64=['id',_0x7f91('0x4c')];if(_0x28a92a==='voice'){_0x2d1c64[_0x7f91('0x31')](_0x7f91('0x2a'));if(_0x4cdb28[_0x7f91('0x11')][_0x7f91('0x2a')]===_0x7f91('0x4d')){_0x2d1c64['push']([_0x7f91('0x4e'),'dialMethod']);}}_0x4cdb28[_0x7f91('0x11')]['fields']=_0x2d1c64[_0x7f91('0x21')](',');}_0x4a424a=qs[_0x7f91('0x2f')](_0x11ba70,_0x4cdb28);if(_0x4cdb28[_0x7f91('0x3a')]['role']===_0x7f91('0x3a')){var _0x87d495={'params':{'id':_0x4cdb28[_0x7f91('0x3a')][_0x7f91('0x4f')]},'query':{'section':_0x28a92a===_0x7f91('0x50')&&_0x4cdb28[_0x7f91('0x11')][_0x7f91('0x2a')]===_0x7f91('0x4d')?_0x7f91('0x51'):_[_0x7f91('0x4a')](_0x28a92a)+_0x7f91('0x52'),'type':_0x4cdb28[_0x7f91('0x11')][_0x7f91('0x2a')],'nolimit':!![],'sort':_0x7f91('0x4c'),'filter':_0x4cdb28[_0x7f91('0x11')][_0x7f91('0x53')]}};return db[_0x7f91('0x3d')][_0x7f91('0x54')](_0x87d495);}return db[_0x197399][_0x7f91('0x3e')](_0x4a424a);})[_0x7f91('0x18')](function(_0x19fc98){_0x189ba8[_0x7f91('0x8')]=_0x19fc98['count'];_0x189051=_0x19fc98[_0x7f91('0x3f')];return rtq[_0x7f91('0x55')](_0x4cdb28,_0x28a92a);})[_0x7f91('0x18')](function(_0x3147e5){_0x480599=_0x3147e5[_0x7f91('0x3f')];return rtq['initializeQueues'](_0x189051,_0x480599,_0x28a92a,_0x4cdb28[_0x7f91('0x11')]['type']);})[_0x7f91('0x18')](function(_0x4bc284){_0x189ba8[_0x7f91('0x3f')]=_0x4bc284;return _0x189ba8;})[_0x7f91('0x18')](respondWithFilteredResult(_0x361359,_0x4a424a))['catch'](APIHandleError(_0x361359));}; \ No newline at end of file +var _0x32f4=['sortAgentsByStatus','split','pick','catch','getQueues','startCase','Queue','name','voice','outbound','dialMethod','join','QueueCampaigns','Queues','filter','getResources','initializeQueues','lodash','util','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','handleError','offset','undefined','limit','count','status','set','Content-Range','json','getAgents','query','globalQueueFilter','globalStatusFilter','*pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','globalStatus','fields','order','getRealtimeAgents','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','User','rawAttributes','fieldName','type','key','role','agent','online','getOptions','raw','push','sequelize','literal','forEach','Pause','where','merge','user','userProfileId','Agents','extraQueryConditions','assign','UserProfile','findAndCountAll','rows','map','find','filterAgentAttributes','getAgentStatus','includes','pause','Status'];(function(_0x11a943,_0x3b72ef){var _0x54afca=function(_0x3db07a){while(--_0x3db07a){_0x11a943['push'](_0x11a943['shift']());}};_0x54afca(++_0x3b72ef);}(_0x32f4,0x113));var _0x432f=function(_0x3eaf47,_0x5cea5c){_0x3eaf47=_0x3eaf47-0x0;var _0x433a58=_0x32f4[_0x3eaf47];return _0x433a58;};'use strict';var _=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var rta=require('../../components/realtime/agents');var rtq=require(_0x432f('0x2'));var qs=require(_0x432f('0x3'));var utils=require(_0x432f('0x4'));var db=require(_0x432f('0x5'))['db'];var APIBadRequestError=require(_0x432f('0x6'))[_0x432f('0x7')];var APIHandleError=require(_0x432f('0x6'))[_0x432f('0x8')];function respondWithFilteredResult(_0x579e09,_0x39bad6){return function(_0x4b93dc){if(_0x4b93dc){var _0x2bb056=typeof _0x39bad6[_0x432f('0x9')]===_0x432f('0xa')&&typeof _0x39bad6[_0x432f('0xb')]==='undefined';var _0x2765e7=_0x4b93dc['count'];var _0x1c6be9=_0x2bb056?0x0:_0x39bad6[_0x432f('0x9')];var _0x2d4250=_0x2bb056?_0x4b93dc[_0x432f('0xc')]:_0x39bad6[_0x432f('0x9')]+_0x39bad6[_0x432f('0xb')];var _0x1039aa;if(_0x2d4250>=_0x2765e7){_0x2d4250=_0x2765e7;_0x1039aa=0xc8;}else{_0x1039aa=0xce;}_0x579e09[_0x432f('0xd')](_0x1039aa);return _0x579e09[_0x432f('0xe')](_0x432f('0xf'),_0x1c6be9+'-'+_0x2d4250+'/'+_0x2765e7)[_0x432f('0x10')](_0x4b93dc);}return null;};}exports[_0x432f('0x11')]=function(_0x5b7193,_0x4d2296){var _0x366097={'count':0x0,'rows':[]};var _0x41e4e2={};var _0x366939;var _0x373cb1=utils['getChannels']();var _0x24a313;var _0x267252;var _0x302269=_0x5b7193[_0x432f('0x12')][_0x432f('0x13')];var _0x4930b7=_0x5b7193['query'][_0x432f('0x14')];var _0x3ca7f1=_0x5b7193[_0x432f('0x12')]['pauseTypeFilter'];var _0x6b98e6=_0x4930b7==='pause'||_0x4930b7===_0x432f('0x15')?!![]:![];var _0x1c6688=[];var _0xba7b74;var _0x31e9c6;Promise[_0x432f('0x16')]()[_0x432f('0x17')](function(){if(_0x5b7193[_0x432f('0x12')][_0x432f('0x18')]){if(!utils[_0x432f('0x19')](_0x5b7193[_0x432f('0x12')][_0x432f('0x18')])){throw new APIBadRequestError(util[_0x432f('0x1a')](_0x432f('0x1b'),_0x5b7193[_0x432f('0x12')][_0x432f('0x18')]));}_0x366939=_0x5b7193[_0x432f('0x12')][_0x432f('0x18')][_0x432f('0x1c')]();}if(!_0x5b7193['query'][_0x432f('0x1d')]||!_0x5b7193[_0x432f('0x12')][_0x432f('0x1d')]['includes'](_0x432f('0x1e'))){_0x5b7193['query']['sort']=rta['validateSortParameter'](_0x5b7193[_0x432f('0x12')][_0x432f('0x1d')]);return;}var _0x2332e4=rta['getUpdatedSortOptions'](_0x5b7193[_0x432f('0x12')][_0x432f('0x1d')]);_0x5b7193[_0x432f('0x12')][_0x432f('0x1d')]=_0x2332e4[_0x432f('0x1f')]['join'](',');_0xba7b74=_0x2332e4[_0x432f('0x20')];})['then'](function(){if(!_0x302269){return[];}return rta['getAgentIdsByQueues'](_0x302269,_0x366939);})[_0x432f('0x17')](function(_0x46cf7b){_0x1c6688=_0x46cf7b;return rta[_0x432f('0x21')]();})[_0x432f('0x17')](function(_0x4975fb){_0x267252=_0x4975fb['rows'];if((!_0x4930b7||_0x6b98e6)&&!_0xba7b74){return _0x1c6688;}if(_0xba7b74&&!_0x4930b7){return rta[_0x432f('0x22')](_0x267252,_0x1c6688,_0xba7b74);}else{return rta[_0x432f('0x23')](_0x267252,_0x1c6688,_0x4930b7);}})[_0x432f('0x17')](function(_0x5925ad){_0x1c6688=_0x5925ad;var _0x2b9384=![];if(_0x1c6688[_0x432f('0x24')]===0x0){if(_0x302269||_0x4930b7){_0x2b9384=!![];}if(_0x6b98e6){_0x2b9384=![];}}if(_0x2b9384){return _0x366097;}var _0x50aaeb=_['map'](db[_0x432f('0x25')][_0x432f('0x26')],function(_0x39199c){return{'name':_0x39199c[_0x432f('0x27')],'type':_0x39199c[_0x432f('0x28')][_0x432f('0x29')]};});_0x5b7193['query'][_0x432f('0x2a')]=_0x432f('0x2b');_0x5b7193[_0x432f('0x12')][_0x432f('0x2c')]=!![];_0x41e4e2=qs[_0x432f('0x2d')](_0x50aaeb,_0x5b7193);_0x41e4e2[_0x432f('0x2e')]=!![];var _0x180e46=[];if(_0x1c6688['length']>0x0){_0x180e46[_0x432f('0x2f')]({'id':{'$in':_0x1c6688}});if(_0xba7b74&&!_0x4930b7){_0x31e9c6=[db[_0x432f('0x30')][_0x432f('0x31')]('FIELD(id,'+_0x1c6688+')')];_0x41e4e2[_0x432f('0x20')]=_0x31e9c6;}}if(_0x6b98e6){_0x373cb1[_0x432f('0x32')](function(_0xd603ec){var _0x581927=!![];if(_0x4930b7===_0x432f('0x15')&&_0x366939!==_0xd603ec){_0x581927=![];}_0x180e46[_0x432f('0x2f')]({[_0xd603ec+_0x432f('0x33')]:_0x581927});});if(_0x3ca7f1){_0x180e46[_0x432f('0x2f')]({'pauseType':_0x3ca7f1});}}else if(_0x4930b7){_0x373cb1['forEach'](function(_0x2359fe){_0x180e46[_0x432f('0x2f')]({[_0x2359fe+_0x432f('0x33')]:![]});});}_0x41e4e2[_0x432f('0x34')]=_[_0x432f('0x35')](_0x41e4e2[_0x432f('0x34')],{'$and':_0x180e46});if(_0x5b7193[_0x432f('0x36')][_0x432f('0x2a')]===_0x432f('0x36')){var _0x351f0f={'params':{'id':_0x5b7193[_0x432f('0x36')][_0x432f('0x37')]},'query':{'section':_0x432f('0x38'),'role':_0x432f('0x2b'),'online':!![],'raw':!![],'ids':_0x1c6688,'customSorting':_0x31e9c6}};if(_0x6b98e6){_0x351f0f['query'][_0x432f('0x39')]=_0x180e46;}_0x351f0f['query']=Object[_0x432f('0x3a')](_0x351f0f[_0x432f('0x12')],_0x5b7193[_0x432f('0x12')]);delete _0x351f0f[_0x432f('0x12')]['id'];return db[_0x432f('0x3b')]['getResources'](_0x351f0f);}return db['User'][_0x432f('0x3c')](_0x41e4e2);})[_0x432f('0x17')](function(_0x241a77){_0x366097[_0x432f('0xc')]=_0x241a77['count'];_0x24a313=_0x241a77[_0x432f('0x3d')];return _0x24a313[_0x432f('0x3e')](function(_0x90507){var _0x5ac52a=_[_0x432f('0x3f')](_0x267252,['id',_0x90507['id']]);if(_0x5ac52a){var _0x1cb68b=rta[_0x432f('0x40')](_0x5ac52a);_['merge'](_0x90507,_0x1cb68b);}_0x90507[_0x432f('0x1e')]=rta[_0x432f('0x41')](_0x90507);if(_0x90507['globalStatus'][_0x432f('0x42')](_0x432f('0x43'))){_0x373cb1[_0x432f('0x32')](function(_0x514a65){if(_0x90507[_0x514a65+_0x432f('0x33')]){_0x90507[_0x514a65+_0x432f('0x44')]=_0x432f('0x43');}});}return _0x90507;});})[_0x432f('0x17')](function(_0x48aa2f){if(!_0xba7b74||_0x31e9c6){return _0x48aa2f;}return rta[_0x432f('0x45')](_0x48aa2f,_0xba7b74);})[_0x432f('0x17')](function(_0x150620){var _0x41d839=null;if(_0x5b7193[_0x432f('0x12')][_0x432f('0x1f')]){var _0x562f51=_0x5b7193[_0x432f('0x12')][_0x432f('0x1f')][_0x432f('0x46')](',');_0x41d839=_0x150620[_0x432f('0x3e')](function(_0x571989){return _[_0x432f('0x47')](_0x571989,_0x562f51);});}_0x366097['rows']=_0x41d839||_0x150620;return _0x366097;})[_0x432f('0x17')](respondWithFilteredResult(_0x4d2296,_0x41e4e2))[_0x432f('0x48')](APIHandleError(_0x4d2296));};exports[_0x432f('0x49')]=function(_0x381be2,_0x22efa8){var _0x3803ca={'count':0x0,'rows':[]};var _0x533548={};var _0x9a488d;var _0x4adb49;var _0x483f5a;Promise[_0x432f('0x16')]()[_0x432f('0x17')](function(){if(_0x381be2[_0x432f('0x12')][_0x432f('0x18')]){if(!utils[_0x432f('0x19')](_0x381be2[_0x432f('0x12')][_0x432f('0x18')])){throw new APIBadRequestError(util['format'](_0x432f('0x1b'),_0x381be2[_0x432f('0x12')][_0x432f('0x18')]));}_0x9a488d=_0x381be2['query'][_0x432f('0x18')][_0x432f('0x1c')]();}var _0x4c8a01=_[_0x432f('0x4a')](_0x9a488d)+_0x432f('0x4b');var _0x5e5407=_[_0x432f('0x3e')](db[_0x4c8a01][_0x432f('0x26')],function(_0x274ff9){return{'name':_0x274ff9[_0x432f('0x27')],'type':_0x274ff9[_0x432f('0x28')][_0x432f('0x29')]};});if(!_0x381be2[_0x432f('0x12')][_0x432f('0x1f')]){var _0xec257b=['id',_0x432f('0x4c')];if(_0x9a488d===_0x432f('0x4d')){_0xec257b[_0x432f('0x2f')](_0x432f('0x28'));if(_0x381be2[_0x432f('0x12')]['type']===_0x432f('0x4e')){_0xec257b[_0x432f('0x2f')](['dialActive',_0x432f('0x4f')]);}}_0x381be2[_0x432f('0x12')][_0x432f('0x1f')]=_0xec257b[_0x432f('0x50')](',');}_0x533548=qs['getOptions'](_0x5e5407,_0x381be2);if(_0x381be2['user'][_0x432f('0x2a')]==='user'){var _0x33711d={'params':{'id':_0x381be2['user'][_0x432f('0x37')]},'query':{'section':_0x9a488d===_0x432f('0x4d')&&_0x381be2['query']['type']===_0x432f('0x4e')?_0x432f('0x51'):_[_0x432f('0x4a')](_0x9a488d)+_0x432f('0x52'),'type':_0x381be2[_0x432f('0x12')][_0x432f('0x28')],'nolimit':!![],'sort':'name','filter':_0x381be2[_0x432f('0x12')][_0x432f('0x53')]}};return db[_0x432f('0x3b')][_0x432f('0x54')](_0x33711d);}return db[_0x4c8a01][_0x432f('0x3c')](_0x533548);})['then'](function(_0xcdeeb6){_0x3803ca[_0x432f('0xc')]=_0xcdeeb6[_0x432f('0xc')];_0x4adb49=_0xcdeeb6[_0x432f('0x3d')];return rtq['getRealtimeQueues'](_0x381be2,_0x9a488d);})[_0x432f('0x17')](function(_0x18122f){_0x483f5a=_0x18122f[_0x432f('0x3d')];return rtq[_0x432f('0x55')](_0x4adb49,_0x483f5a,_0x9a488d,_0x381be2[_0x432f('0x12')][_0x432f('0x28')]);})[_0x432f('0x17')](function(_0x52af09){_0x3803ca[_0x432f('0x3d')]=_0x52af09;return _0x3803ca;})[_0x432f('0x17')](respondWithFilteredResult(_0x22efa8,_0x533548))[_0x432f('0x48')](APIHandleError(_0x22efa8));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index c197c19..9fc71da 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2d604b,_0x4f1748){var _0x504857=function(_0x3c4990){while(--_0x3c4990){_0x2d604b['push'](_0x2d604b['shift']());}};_0x504857(++_0x4f1748);}(_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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x28c4db,_0x2ccd05){var _0x5907ed=function(_0x1d83c2){while(--_0x1d83c2){_0x28c4db['push'](_0x28c4db['shift']());}};_0x5907ed(++_0x2ccd05);}(_0x9c44,0x178));var _0x49c4=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x9c44[_0x15bc81];return _0x59440e;};'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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index ac77e49..c919365 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 _0x5a63=['INTEGER','STRING','sequelize','exports','DATE'];(function(_0x233586,_0x538c59){var _0xb5f65d=function(_0x2eb586){while(--_0x2eb586){_0x233586['push'](_0x233586['shift']());}};_0xb5f65d(++_0x538c59);}(_0x5a63,0xe3));var _0x35a6=function(_0x3ff8df,_0x25bf76){_0x3ff8df=_0x3ff8df-0x0;var _0x4e435e=_0x5a63[_0x3ff8df];return _0x4e435e;};'use strict';var Sequelize=require(_0x35a6('0x0'));module[_0x35a6('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x35a6('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x35a6('0x2')]},'ringtime':{'type':Sequelize[_0x35a6('0x3')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x35a6('0x4')]},'campaigntype':{'type':Sequelize[_0x35a6('0x4')]},'membername':{'type':Sequelize[_0x35a6('0x4')]}}; \ No newline at end of file +var _0x7ad3=['sequelize','exports','INTEGER','STRING'];(function(_0x4cfc1d,_0x2c0927){var _0x1c01a0=function(_0x264a74){while(--_0x264a74){_0x4cfc1d['push'](_0x4cfc1d['shift']());}};_0x1c01a0(++_0x2c0927);}(_0x7ad3,0x108));var _0x37ad=function(_0x386c3e,_0x44a375){_0x386c3e=_0x386c3e-0x0;var _0x4b8e13=_0x7ad3[_0x386c3e];return _0x4b8e13;};'use strict';var Sequelize=require(_0x37ad('0x0'));module[_0x37ad('0x1')]={'state':{'type':Sequelize[_0x37ad('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x37ad('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x37ad('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x37ad('0x2')],'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 053ddd9..ee13490 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 _0x25ef=['path','rimraf','./reportAgentPreview.attributes','define','ReportAgentPreview','report_agent_preview','util','../../config/logger','moment'];(function(_0xc0c240,_0x53f03e){var _0x3b97ea=function(_0x2b1bee){while(--_0x2b1bee){_0xc0c240['push'](_0xc0c240['shift']());}};_0x3b97ea(++_0x53f03e);}(_0x25ef,0x9f));var _0xf25e=function(_0x2bd311,_0x43156b){_0x2bd311=_0x2bd311-0x0;var _0x4af1c7=_0x25ef[_0x2bd311];return _0x4af1c7;};'use strict';var _=require('lodash');var util=require(_0xf25e('0x0'));var logger=require(_0xf25e('0x1'))('api');var moment=require(_0xf25e('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf25e('0x3'));var rimraf=require(_0xf25e('0x4'));var config=require('../../config/environment');var attributes=require(_0xf25e('0x5'));module['exports']=function(_0x27b46e,_0x59d4f9){return _0x27b46e[_0xf25e('0x6')](_0xf25e('0x7'),attributes,{'tableName':_0xf25e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5579=['../../config/environment','./reportAgentPreview.attributes','define','report_agent_preview','lodash','util','../../config/logger','api','bluebird','rimraf'];(function(_0x1bb8a2,_0x124292){var _0x18a250=function(_0xe48fa7){while(--_0xe48fa7){_0x1bb8a2['push'](_0x1bb8a2['shift']());}};_0x18a250(++_0x124292);}(_0x5579,0x1a8));var _0x9557=function(_0x425094,_0xbf27da){_0x425094=_0x425094-0x0;var _0x4cc6ca=_0x5579[_0x425094];return _0x4cc6ca;};'use strict';var _=require(_0x9557('0x0'));var util=require(_0x9557('0x1'));var logger=require(_0x9557('0x2'))(_0x9557('0x3'));var moment=require('moment');var BPromise=require(_0x9557('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9557('0x5'));var config=require(_0x9557('0x6'));var attributes=require(_0x9557('0x7'));module['exports']=function(_0x14b7f9,_0x458131){return _0x14b7f9[_0x9557('0x8')]('ReportAgentPreview',attributes,{'tableName':_0x9557('0x9'),'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 af4a4e8..5145dee 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 _0x881c=['body','options','raw','debug','lodash','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','ReportAgentPreview,\x20%s,\x20%s','message','catch','CreateReportAgentPreview','ReportAgentPreview','create'];(function(_0x3c172b,_0x5dbd06){var _0x3d06ea=function(_0x1b755a){while(--_0x1b755a){_0x3c172b['push'](_0x3c172b['shift']());}};_0x3d06ea(++_0x5dbd06);}(_0x881c,0xdc));var _0xc881=function(_0x537ddc,_0x4b8246){_0x537ddc=_0x537ddc-0x0;var _0x1691e7=_0x881c[_0x537ddc];return _0x1691e7;};'use strict';var _=require(_0xc881('0x0'));var util=require('util');var moment=require(_0xc881('0x1'));var BPromise=require(_0xc881('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc881('0x3'));var logger=require(_0xc881('0x4'))(_0xc881('0x5'));var config=require(_0xc881('0x6'));var jayson=require(_0xc881('0x7'));var client=jayson[_0xc881('0x8')][_0xc881('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b5a08,_0x54596f,_0x4d3b8e){return new BPromise(function(_0x556503,_0x574f63){return client['request'](_0x5b5a08,_0x4d3b8e)[_0xc881('0xa')](function(_0x15c30d){logger[_0xc881('0xb')]('ReportAgentPreview,\x20%s,\x20%s',_0x54596f,_0xc881('0xc'));logger['debug'](_0xc881('0xd'),_0x54596f,_0xc881('0xc'),JSON[_0xc881('0xe')](_0x15c30d));if(_0x15c30d[_0xc881('0xf')]){if(_0x15c30d[_0xc881('0xf')][_0xc881('0x10')]===0x1f4){logger['error'](_0xc881('0x11'),_0x54596f,_0x15c30d[_0xc881('0xf')][_0xc881('0x12')]);return _0x574f63(_0x15c30d[_0xc881('0xf')][_0xc881('0x12')]);}logger[_0xc881('0xf')](_0xc881('0x11'),_0x54596f,_0x15c30d[_0xc881('0xf')]['message']);return _0x556503(_0x15c30d['error'][_0xc881('0x12')]);}else{logger['info'](_0xc881('0x11'),_0x54596f,'request\x20sent');_0x556503(_0x15c30d['result'][_0xc881('0x12')]);}})[_0xc881('0x13')](function(_0x1017a){logger[_0xc881('0xf')](_0xc881('0x11'),_0x54596f,_0x1017a);_0x574f63(_0x1017a);});});}exports[_0xc881('0x14')]=function(_0x2caf90){var _0x162319=this;return new Promise(function(_0xcd763b,_0x382f40){return db[_0xc881('0x15')][_0xc881('0x16')](_0x2caf90[_0xc881('0x17')],{'raw':_0x2caf90[_0xc881('0x18')]?_0x2caf90['options'][_0xc881('0x19')]===undefined?!![]:![]:!![]})[_0xc881('0xa')](function(_0x2a882c){logger[_0xc881('0xb')](_0xc881('0x14'),_0x2caf90);logger[_0xc881('0x1a')](_0xc881('0x14'),_0x2caf90,JSON[_0xc881('0xe')](_0x2a882c));_0xcd763b(_0x2a882c);})[_0xc881('0x13')](function(_0x118838){logger[_0xc881('0xf')]('CreateReportAgentPreview',_0x118838[_0xc881('0x12')],_0x2caf90);_0x382f40(_0x162319[_0xc881('0xf')](0x1f4,_0x118838[_0xc881('0x12')]));});});}; \ No newline at end of file +var _0x594a=['message','info','result','CreateReportAgentPreview','ReportAgentPreview','create','options','raw','then','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','ReportAgentPreview,\x20%s,\x20%s'];(function(_0x281958,_0x15b761){var _0x31dab8=function(_0x5ad840){while(--_0x5ad840){_0x281958['push'](_0x281958['shift']());}};_0x31dab8(++_0x15b761);}(_0x594a,0x176));var _0xa594=function(_0x441fea,_0x83161d){_0x441fea=_0x441fea-0x0;var _0xb1e5e4=_0x594a[_0x441fea];return _0xb1e5e4;};'use strict';var _=require(_0xa594('0x0'));var util=require(_0xa594('0x1'));var moment=require(_0xa594('0x2'));var BPromise=require(_0xa594('0x3'));var rs=require(_0xa594('0x4'));var fs=require('fs');var Redis=require(_0xa594('0x5'));var db=require(_0xa594('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa594('0x7'))(_0xa594('0x8'));var config=require(_0xa594('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa594('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1fd6a6,_0x3f1bd4,_0x23efc4){return new BPromise(function(_0x4f90c1,_0x3a7966){return client[_0xa594('0xb')](_0x1fd6a6,_0x23efc4)['then'](function(_0x4914d3){logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x3f1bd4,_0xa594('0xc'));logger[_0xa594('0xd')](_0xa594('0xe'),_0x3f1bd4,'request\x20sent',JSON[_0xa594('0xf')](_0x4914d3));if(_0x4914d3['error']){if(_0x4914d3['error']['code']===0x1f4){logger[_0xa594('0x10')](_0xa594('0x11'),_0x3f1bd4,_0x4914d3[_0xa594('0x10')][_0xa594('0x12')]);return _0x3a7966(_0x4914d3['error'][_0xa594('0x12')]);}logger[_0xa594('0x10')](_0xa594('0x11'),_0x3f1bd4,_0x4914d3[_0xa594('0x10')]['message']);return _0x4f90c1(_0x4914d3[_0xa594('0x10')][_0xa594('0x12')]);}else{logger[_0xa594('0x13')](_0xa594('0x11'),_0x3f1bd4,_0xa594('0xc'));_0x4f90c1(_0x4914d3[_0xa594('0x14')][_0xa594('0x12')]);}})['catch'](function(_0x2816a3){logger[_0xa594('0x10')](_0xa594('0x11'),_0x3f1bd4,_0x2816a3);_0x3a7966(_0x2816a3);});});}exports[_0xa594('0x15')]=function(_0x40efbd){var _0x5bbdb8=this;return new Promise(function(_0x116d16,_0x524359){return db[_0xa594('0x16')][_0xa594('0x17')](_0x40efbd['body'],{'raw':_0x40efbd[_0xa594('0x18')]?_0x40efbd[_0xa594('0x18')][_0xa594('0x19')]===undefined?!![]:![]:!![]})[_0xa594('0x1a')](function(_0x293a31){logger[_0xa594('0x13')](_0xa594('0x15'),_0x40efbd);logger['debug'](_0xa594('0x15'),_0x40efbd,JSON['stringify'](_0x293a31));_0x116d16(_0x293a31);})[_0xa594('0x1b')](function(_0x4a0adf){logger[_0xa594('0x10')](_0xa594('0x15'),_0x4a0adf[_0xa594('0x12')],_0x40efbd);_0x524359(_0x5bbdb8['error'](0x1f4,_0x4a0adf[_0xa594('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 4e533aa..7a839bb 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 _0x3a89=['/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','queueNotify','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','sms','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','./rpc.controller','get','/voice/channels','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','openchannelQueues','/sms/queues','smsQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','/voice/queues/:id','showVoiceQueues','/outbound','/outbound/channels','outboundChannels','/agents','agents','put','/agents/:id/capacity','agentCapacity','/telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0x3a89,0x114));var _0x93a8=function(_0x2a56bc,_0x49ba0f){_0x2a56bc=_0x2a56bc-0x0;var _0x76cb14=_0x3a89[_0x2a56bc];return _0x76cb14;};'use strict';var multer=require(_0x93a8('0x0'));var util=require(_0x93a8('0x1'));var path=require(_0x93a8('0x2'));var express=require(_0x93a8('0x3'));var router=express[_0x93a8('0x4')]();var auth=require('../../components/auth/service');var controller=require(_0x93a8('0x5'));router[_0x93a8('0x6')](_0x93a8('0x7'),auth['isAuthenticated'](),controller[_0x93a8('0x8')]);router[_0x93a8('0x6')](_0x93a8('0x9'),auth[_0x93a8('0xa')](),controller[_0x93a8('0xb')]);router[_0x93a8('0x6')]('/voice/channels/:uniqueid/stopmixmonitor',auth['isAuthenticated'](),controller[_0x93a8('0xc')]);router[_0x93a8('0x6')](_0x93a8('0xd'),auth[_0x93a8('0xa')](),controller[_0x93a8('0xe')]);router[_0x93a8('0x6')](_0x93a8('0xf'),auth[_0x93a8('0xa')](),controller[_0x93a8('0x10')]);router[_0x93a8('0x6')](_0x93a8('0x11'),auth[_0x93a8('0xa')](),controller[_0x93a8('0x12')]);router[_0x93a8('0x6')]('/mail/accounts',auth[_0x93a8('0xa')](),controller['mailAccounts']);router[_0x93a8('0x6')]('/openchannel/queues',auth[_0x93a8('0xa')](),controller[_0x93a8('0x13')]);router[_0x93a8('0x6')](_0x93a8('0x14'),auth[_0x93a8('0xa')](),controller[_0x93a8('0x15')]);router[_0x93a8('0x6')]('/whatsapp/queues',auth[_0x93a8('0xa')](),controller['whatsappQueues']);router[_0x93a8('0x6')](_0x93a8('0x16'),auth[_0x93a8('0xa')](),controller[_0x93a8('0x17')]);router[_0x93a8('0x6')](_0x93a8('0x18'),auth[_0x93a8('0xa')](),controller[_0x93a8('0x19')]);router[_0x93a8('0x6')](_0x93a8('0x1a'),auth[_0x93a8('0xa')](),controller[_0x93a8('0x1b')]);router[_0x93a8('0x6')](_0x93a8('0x1c'),auth['isAuthenticated'](),controller['voiceQueuesChannel']);router[_0x93a8('0x6')](_0x93a8('0x1d'),auth[_0x93a8('0xa')](),controller['voiceQueuesChannelHangup']);router[_0x93a8('0x6')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x93a8('0xa')](),controller['voiceQueuesChannelRedirect']);router[_0x93a8('0x6')](_0x93a8('0x1e'),auth[_0x93a8('0xa')](),controller[_0x93a8('0x1f')]);router['put']('/voice/queues/:id',auth[_0x93a8('0xa')](),controller['updateVoiceQueue']);router[_0x93a8('0x6')](_0x93a8('0x20'),auth[_0x93a8('0xa')](),controller['outbound']);router['get'](_0x93a8('0x21'),auth[_0x93a8('0xa')](),controller[_0x93a8('0x22')]);router[_0x93a8('0x6')](_0x93a8('0x23'),auth['isAuthenticated'](),controller[_0x93a8('0x24')]);router[_0x93a8('0x25')](_0x93a8('0x26'),auth[_0x93a8('0xa')](),controller[_0x93a8('0x27')]);router[_0x93a8('0x6')](_0x93a8('0x28'),auth[_0x93a8('0xa')](),controller['telephones']);router['get'](_0x93a8('0x29'),auth[_0x93a8('0xa')](),controller[_0x93a8('0x2a')]);router['get'](_0x93a8('0x2b'),auth[_0x93a8('0xa')](),controller[_0x93a8('0x2c')]);router[_0x93a8('0x6')](_0x93a8('0x2d'),auth[_0x93a8('0xa')](),controller[_0x93a8('0x2e')]);router['get'](_0x93a8('0x2f'),auth[_0x93a8('0xa')](),controller[_0x93a8('0x30')]);router['get']('/mail/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x93a8('0x31')]);router[_0x93a8('0x6')](_0x93a8('0x32'),auth[_0x93a8('0xa')](),controller[_0x93a8('0x33')]);router[_0x93a8('0x6')](_0x93a8('0x34'),auth['isAuthenticated'](),controller[_0x93a8('0x35')]);router['get'](_0x93a8('0x36'),auth[_0x93a8('0xa')](),controller[_0x93a8('0x37')]);router['get'](_0x93a8('0x38'),auth[_0x93a8('0xa')](),controller['whatsappQueuesWaitingInteractions']);router[_0x93a8('0x6')](_0x93a8('0x39'),auth[_0x93a8('0xa')](),controller[_0x93a8('0x3a')]);router[_0x93a8('0x3b')]('/mail/queues/:id/notify',auth['isAuthenticated'](),controller[_0x93a8('0x3c')]('mail'));router['get'](_0x93a8('0x3d'),auth[_0x93a8('0xa')](),controller[_0x93a8('0x3e')]);router[_0x93a8('0x3b')](_0x93a8('0x3f'),auth[_0x93a8('0xa')](),controller[_0x93a8('0x3c')](_0x93a8('0x40')));router[_0x93a8('0x6')](_0x93a8('0x41'),auth[_0x93a8('0xa')](),controller[_0x93a8('0x42')]);router[_0x93a8('0x3b')]('/fax/queues/:id/notify',auth[_0x93a8('0xa')](),controller[_0x93a8('0x3c')](_0x93a8('0x43')));router['get'](_0x93a8('0x44'),auth[_0x93a8('0xa')](),controller[_0x93a8('0x45')]);router[_0x93a8('0x3b')](_0x93a8('0x46'),auth[_0x93a8('0xa')](),controller[_0x93a8('0x3c')](_0x93a8('0x47')));router[_0x93a8('0x6')](_0x93a8('0x48'),auth[_0x93a8('0xa')](),controller[_0x93a8('0x49')]);router[_0x93a8('0x3b')]('/sms/queues/:id/notify',auth[_0x93a8('0xa')](),controller[_0x93a8('0x3c')](_0x93a8('0x4a')));router[_0x93a8('0x3b')](_0x93a8('0x4b'),auth['isAuthenticated'](),controller[_0x93a8('0x3c')](_0x93a8('0x4c')));router[_0x93a8('0x6')]('/sms/queues/:id',auth[_0x93a8('0xa')](),controller[_0x93a8('0x4d')]);router['get'](_0x93a8('0x4e'),auth[_0x93a8('0xa')](),controller[_0x93a8('0x4f')]);router['post'](_0x93a8('0x50'),auth[_0x93a8('0xa')](),controller[_0x93a8('0x51')]);module[_0x93a8('0x52')]=router; \ No newline at end of file +var _0x1d7e=['queueNotify','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','/fax/queues/:id','showFaxQueues','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','express','Router','../../components/auth/service','./rpc.controller','/voice/channels','isAuthenticated','voiceChannels','voiceChannelMixMonitor','get','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','chatQueues','mailQueues','/mail/accounts','mailAccounts','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','/outbound','outbound','/outbound/channels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','/campaigns','/fax/accounts','faxAccounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x1d7e,0x1d4));var _0xe1d7=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x1d7e[_0x5783f4];return _0x28e380;};'use strict';var multer=require(_0xe1d7('0x0'));var util=require('util');var path=require('path');var express=require(_0xe1d7('0x1'));var router=express[_0xe1d7('0x2')]();var auth=require(_0xe1d7('0x3'));var controller=require(_0xe1d7('0x4'));router['get'](_0xe1d7('0x5'),auth[_0xe1d7('0x6')](),controller[_0xe1d7('0x7')]);router['get']('/voice/channels/:uniqueid/mixmonitor',auth[_0xe1d7('0x6')](),controller[_0xe1d7('0x8')]);router[_0xe1d7('0x9')](_0xe1d7('0xa'),auth[_0xe1d7('0x6')](),controller[_0xe1d7('0xb')]);router[_0xe1d7('0x9')]('/voice/queues',auth[_0xe1d7('0x6')](),controller[_0xe1d7('0xc')]);router[_0xe1d7('0x9')](_0xe1d7('0xd'),auth[_0xe1d7('0x6')](),controller[_0xe1d7('0xe')]);router[_0xe1d7('0x9')]('/mail/queues',auth[_0xe1d7('0x6')](),controller[_0xe1d7('0xf')]);router[_0xe1d7('0x9')](_0xe1d7('0x10'),auth[_0xe1d7('0x6')](),controller[_0xe1d7('0x11')]);router[_0xe1d7('0x9')]('/openchannel/queues',auth['isAuthenticated'](),controller[_0xe1d7('0x12')]);router[_0xe1d7('0x9')](_0xe1d7('0x13'),auth[_0xe1d7('0x6')](),controller[_0xe1d7('0x14')]);router[_0xe1d7('0x9')](_0xe1d7('0x15'),auth[_0xe1d7('0x6')](),controller[_0xe1d7('0x16')]);router[_0xe1d7('0x9')](_0xe1d7('0x17'),auth['isAuthenticated'](),controller['faxQueues']);router[_0xe1d7('0x9')](_0xe1d7('0x18'),auth[_0xe1d7('0x6')](),controller[_0xe1d7('0x19')]);router[_0xe1d7('0x9')]('/voice/queues/channels',auth['isAuthenticated'](),controller[_0xe1d7('0x1a')]);router['get'](_0xe1d7('0x1b'),auth[_0xe1d7('0x6')](),controller[_0xe1d7('0x1c')]);router['get']('/voice/queues/channels/:uniqueid/hangup',auth[_0xe1d7('0x6')](),controller[_0xe1d7('0x1d')]);router[_0xe1d7('0x9')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0xe1d7('0x6')](),controller[_0xe1d7('0x1e')]);router['get'](_0xe1d7('0x1f'),auth[_0xe1d7('0x6')](),controller[_0xe1d7('0x20')]);router[_0xe1d7('0x21')](_0xe1d7('0x1f'),auth[_0xe1d7('0x6')](),controller['updateVoiceQueue']);router[_0xe1d7('0x9')](_0xe1d7('0x22'),auth['isAuthenticated'](),controller[_0xe1d7('0x23')]);router[_0xe1d7('0x9')](_0xe1d7('0x24'),auth[_0xe1d7('0x6')](),controller['outboundChannels']);router[_0xe1d7('0x9')](_0xe1d7('0x25'),auth[_0xe1d7('0x6')](),controller[_0xe1d7('0x26')]);router[_0xe1d7('0x21')](_0xe1d7('0x27'),auth[_0xe1d7('0x6')](),controller[_0xe1d7('0x28')]);router[_0xe1d7('0x9')](_0xe1d7('0x29'),auth[_0xe1d7('0x6')](),controller['telephones']);router['get']('/trunks',auth[_0xe1d7('0x6')](),controller['trunks']);router['get'](_0xe1d7('0x2a'),auth['isAuthenticated'](),controller['campaigns']);router[_0xe1d7('0x9')](_0xe1d7('0x2b'),auth['isAuthenticated'](),controller[_0xe1d7('0x2c')]);router[_0xe1d7('0x9')]('/chat/queues/waitinginteractions',auth[_0xe1d7('0x6')](),controller[_0xe1d7('0x2d')]);router[_0xe1d7('0x9')](_0xe1d7('0x2e'),auth[_0xe1d7('0x6')](),controller[_0xe1d7('0x2f')]);router['get'](_0xe1d7('0x30'),auth[_0xe1d7('0x6')](),controller[_0xe1d7('0x31')]);router[_0xe1d7('0x9')]('/openchannel/queues/:id/waitinginteractions',auth[_0xe1d7('0x6')](),controller[_0xe1d7('0x32')]);router[_0xe1d7('0x9')](_0xe1d7('0x33'),auth[_0xe1d7('0x6')](),controller[_0xe1d7('0x34')]);router[_0xe1d7('0x9')](_0xe1d7('0x35'),auth[_0xe1d7('0x6')](),controller['whatsappQueuesWaitingInteractions']);router[_0xe1d7('0x9')]('/fax/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xe1d7('0x36')]);router[_0xe1d7('0x37')](_0xe1d7('0x38'),auth[_0xe1d7('0x6')](),controller[_0xe1d7('0x39')]('mail'));router[_0xe1d7('0x9')](_0xe1d7('0x3a'),auth[_0xe1d7('0x6')](),controller[_0xe1d7('0x3b')]);router[_0xe1d7('0x37')](_0xe1d7('0x3c'),auth[_0xe1d7('0x6')](),controller['queueNotify'](_0xe1d7('0x3d')));router['get'](_0xe1d7('0x3e'),auth[_0xe1d7('0x6')](),controller['showChatQueues']);router[_0xe1d7('0x37')]('/fax/queues/:id/notify',auth[_0xe1d7('0x6')](),controller[_0xe1d7('0x39')]('fax'));router['get'](_0xe1d7('0x3f'),auth[_0xe1d7('0x6')](),controller[_0xe1d7('0x40')]);router[_0xe1d7('0x37')]('/openchannel/queues/:id/notify',auth[_0xe1d7('0x6')](),controller[_0xe1d7('0x39')](_0xe1d7('0x41')));router[_0xe1d7('0x9')]('/openchannel/queues/:id',auth[_0xe1d7('0x6')](),controller[_0xe1d7('0x42')]);router['post'](_0xe1d7('0x43'),auth[_0xe1d7('0x6')](),controller[_0xe1d7('0x39')]('sms'));router[_0xe1d7('0x37')](_0xe1d7('0x44'),auth[_0xe1d7('0x6')](),controller[_0xe1d7('0x39')]('whatsapp'));router['get'](_0xe1d7('0x45'),auth[_0xe1d7('0x6')](),controller[_0xe1d7('0x46')]);router[_0xe1d7('0x9')]('/whatsapp/queues/:id',auth[_0xe1d7('0x6')](),controller[_0xe1d7('0x47')]);router[_0xe1d7('0x37')](_0xe1d7('0x48'),auth[_0xe1d7('0x6')](),controller[_0xe1d7('0x49')]);module[_0xe1d7('0x4a')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 33e319b..cec99f6 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 _0x8958=['faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','TransferReport','create','agentNotify','channel','Agent\x20not\x20found','Message','Start','agentTransferTimeout','*,*,*,*','moment','api','client','http','request','then','error','code','message','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','voiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','interaction','MemberReport','findAll','user','INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','WhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','queue_id','uniq','value','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions'];(function(_0x143a39,_0x33be87){var _0xeef454=function(_0x3b4ff7){while(--_0x3b4ff7){_0x143a39['push'](_0x143a39['shift']());}};_0xeef454(++_0x33be87);}(_0x8958,0x93));var _0x8895=function(_0x1d0499,_0x23e22f){_0x1d0499=_0x1d0499-0x0;var _0x153fb3=_0x8958[_0x1d0499];return _0x153fb3;};'use strict';var BPromise=require('bluebird');var moment=require(_0x8895('0x0'));var _=require('lodash');var util=require('util');var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x8895('0x1'));var jayson=require('jayson/promise');var amiClient=jayson[_0x8895('0x2')][_0x8895('0x3')]({'port':0x232a});var mailClient=jayson[_0x8895('0x2')]['http']({'port':0x232b});var routingClient=jayson[_0x8895('0x2')][_0x8895('0x3')]({'port':0x232c});function respondWithRpcPromise(_0x124e1e,_0x40cec6,_0x33013a){return new BPromise(function(_0x51376b,_0xe018b8){var _0xc2be9f=_0x33013a?_0x33013a:amiClient;return _0xc2be9f[_0x8895('0x4')](_0x124e1e,_0x40cec6)[_0x8895('0x5')](function(_0x6eab1e){if(_0x6eab1e[_0x8895('0x6')]){if(_0x6eab1e[_0x8895('0x6')][_0x8895('0x7')]===0x1f4){return _0xe018b8(_0x6eab1e[_0x8895('0x6')][_0x8895('0x8')]);}return _0x51376b(_0x6eab1e['error'][_0x8895('0x8')]);}else{_0x51376b(_0x6eab1e[_0x8895('0x9')]);}})[_0x8895('0xa')](function(_0x301bec){_0xe018b8(_0x301bec);});});}function respondWithResult(_0x446e1a,_0xaf93bc){_0xaf93bc=_0xaf93bc||0xc8;return function(_0x5af0ef){if(_0x5af0ef){return _0x446e1a[_0x8895('0xb')](_0xaf93bc)[_0x8895('0xc')](_0x5af0ef);}return _0x446e1a[_0x8895('0xd')](0x194);};}function handleError(_0x57d40a,_0x47b9fe){_0x47b9fe=_0x47b9fe||0x1f4;return function(_0x9191b8){logger['error'](_0x9191b8[_0x8895('0xe')]);if(_0x9191b8[_0x8895('0xf')]){delete _0x9191b8[_0x8895('0xf')];}_0x57d40a[_0x8895('0xb')](_0x47b9fe)[_0x8895('0x10')](_0x9191b8);};}function findById(_0x5b4c2e){return function(_0x4128e2){if(!_[_0x8895('0x11')](_0x5b4c2e)&&!_[_0x8895('0x11')](_0x4128e2)&&!_[_0x8895('0x11')](_0x4128e2[_0x8895('0x12')])){return _[_0x8895('0x13')](_0x4128e2[_0x8895('0x12')],function(_0x26cee0){return _0x26cee0['id']==_0x5b4c2e;});}return null;};}exports[_0x8895('0x14')]=function(_0x2da618,_0x24fef0){return respondWithRpcPromise(_0x8895('0x15'),_0x2da618[_0x8895('0x16')])['then'](respondWithResult(_0x24fef0,null))['catch'](handleError(_0x24fef0,null));};exports['voiceChannelMixMonitor']=function(_0x3daf43,_0x456282){return respondWithRpcPromise(_0x8895('0x17'),_[_0x8895('0x18')](_0x3daf43[_0x8895('0x16')],_0x3daf43[_0x8895('0x19')]))[_0x8895('0x5')](respondWithResult(_0x456282,null))[_0x8895('0xa')](handleError(_0x456282,null));};exports['voiceChannelStopMixMonitor']=function(_0x1a4c5b,_0x5db3a0){return respondWithRpcPromise(_0x8895('0x1a'),_[_0x8895('0x18')](_0x1a4c5b[_0x8895('0x16')],_0x1a4c5b['params']))['then'](respondWithResult(_0x5db3a0,null))[_0x8895('0xa')](handleError(_0x5db3a0,null));};exports[_0x8895('0x1b')]=function(_0x38f7ad,_0x24a376){return respondWithRpcPromise('VoiceQueues',_0x38f7ad[_0x8895('0x16')])[_0x8895('0x5')](respondWithResult(_0x24a376,null))[_0x8895('0xa')](handleError(_0x24a376,null));};exports['showVoiceQueues']=function(_0x4aee03,_0x78b57){return respondWithRpcPromise('VoiceQueues',_0x4aee03[_0x8895('0x16')])[_0x8895('0x5')](findById(_0x4aee03[_0x8895('0x19')]['id']))[_0x8895('0x5')](respondWithResult(_0x78b57,null))[_0x8895('0xa')](handleError(_0x78b57,null));};exports['updateVoiceQueue']=function(_0x4d567a,_0x6e449d){return respondWithRpcPromise(_0x8895('0x1c'),_[_0x8895('0x18')](_0x4d567a[_0x8895('0x1d')],_0x4d567a[_0x8895('0x19')]))['then'](respondWithResult(_0x6e449d,null))['catch'](handleError(_0x6e449d,null));};exports[_0x8895('0x1e')]=function(_0x848a11,_0x1c16f6){return respondWithRpcPromise(_0x8895('0x1f'),_[_0x8895('0x18')](_0x848a11['query'],_0x848a11[_0x8895('0x19')]))['then'](respondWithResult(_0x1c16f6,null))[_0x8895('0xa')](handleError(_0x1c16f6,null));};exports['voiceQueuesChannels']=function(_0x40ba14,_0x1a3fe5){return respondWithRpcPromise(_0x8895('0x20'),_0x40ba14[_0x8895('0x16')])[_0x8895('0x5')](respondWithResult(_0x1a3fe5,null))['catch'](handleError(_0x1a3fe5,null));};exports[_0x8895('0x21')]=function(_0xcba076,_0x1b5359){return respondWithRpcPromise(_0x8895('0x22'),_[_0x8895('0x18')](_0xcba076['query'],_0xcba076[_0x8895('0x19')]))['then'](respondWithResult(_0x1b5359,null))[_0x8895('0xa')](handleError(_0x1b5359,null));};exports['voiceQueuesChannelHangup']=function(_0x21c22b,_0x15a865){return respondWithRpcPromise(_0x8895('0x23'),_[_0x8895('0x18')](_0x21c22b[_0x8895('0x16')],_0x21c22b['params']))[_0x8895('0x5')](respondWithResult(_0x15a865,null))['catch'](handleError(_0x15a865,null));};exports[_0x8895('0x24')]=function(_0xcc735f,_0x36e13b){return respondWithRpcPromise(_0x8895('0x25'),_[_0x8895('0x18')](_0xcc735f[_0x8895('0x16')],_0xcc735f['params']))[_0x8895('0x5')](respondWithResult(_0x36e13b,null))[_0x8895('0xa')](handleError(_0x36e13b,null));};exports['outbound']=function(_0x2557fc,_0x54ca09){return respondWithRpcPromise(_0x8895('0x26'),_0x2557fc[_0x8895('0x16')])['then'](respondWithResult(_0x54ca09,null))[_0x8895('0xa')](handleError(_0x54ca09,null));};exports[_0x8895('0x27')]=function(_0x5b7204,_0x58751a){return respondWithRpcPromise(_0x8895('0x28'),_0x5b7204[_0x8895('0x16')])[_0x8895('0x5')](respondWithResult(_0x58751a,null))[_0x8895('0xa')](handleError(_0x58751a,null));};exports[_0x8895('0x29')]=function(_0x4917d1,_0x42ed1f){var _0x25c854;return respondWithRpcPromise(_0x8895('0x2a'),_0x4917d1[_0x8895('0x16')])[_0x8895('0x5')](function(_0x534876){_0x25c854=_0x534876;return respondWithRpcPromise('Agents',_0x4917d1[_0x8895('0x16')],routingClient);})['then'](function(_0x20a521){return _[_0x8895('0x18')]({},_0x20a521,_0x25c854);})['then'](respondWithResult(_0x42ed1f,null))[_0x8895('0xa')](handleError(_0x42ed1f,null));};exports['agentCapacity']=function(_0x1e6395,_0x5e6413){if(_0x1e6395['body']&&_0x1e6395['body']['interaction']&&_0x1e6395['user']&&_0x1e6395['user'][_0x8895('0xf')]){for(var _0x206f57 in _0x1e6395['body']['interaction']){if(_0x1e6395[_0x8895('0x1d')][_0x8895('0x2b')]['hasOwnProperty'](_0x206f57)){db[_0x8895('0x2c')][_0x8895('0x2d')]({'where':{'channel':_0x206f57,'membername':_0x1e6395[_0x8895('0x2e')][_0x8895('0xf')],'type':_0x8895('0x2f'),'exitAt':null,'uniqueid':_0x1e6395['body']['interaction'][_0x206f57]&&_0x1e6395['body'][_0x8895('0x2b')][_0x206f57]['length']?{'$notIn':_0x1e6395[_0x8895('0x1d')][_0x8895('0x2b')][_0x206f57]}:{'$ne':null}}})[_0x8895('0x5')](function(_0x28aaa9){var _0x587ccb=moment()[_0x8895('0x30')](_0x8895('0x31'));for(var _0x3413cd=0x0,_0x167302=_0x28aaa9[_0x8895('0x32')];_0x3413cd<_0x167302;_0x3413cd+=0x1){_0x28aaa9[_0x3413cd][_0x8895('0x33')]({'exitAt':_0x587ccb});}});for(var _0x14295a=0x0;_0x14295a<_0x1e6395[_0x8895('0x1d')]['interaction'][_0x206f57][_0x8895('0x32')];_0x14295a+=0x1){db[_0x8895('0x2c')]['findOrCreate']({'where':{'channel':_0x206f57,'membername':_0x1e6395[_0x8895('0x2e')]['name'],'type':'INTERACTION','uniqueid':_0x1e6395[_0x8895('0x1d')][_0x8895('0x2b')][_0x206f57][_0x14295a],'exitAt':null},'defaults':{'channel':_0x206f57,'membername':_0x1e6395[_0x8895('0x2e')]['name'],'interface':_[_0x8895('0x11')](_0x1e6395['user'][_0x8895('0x34')])?util[_0x8895('0x30')](_0x8895('0x35'),_0x1e6395[_0x8895('0x2e')][_0x8895('0xf')]):_0x1e6395[_0x8895('0x2e')][_0x8895('0x34')],'type':'INTERACTION','enterAt':moment()['format'](_0x8895('0x31')),'role':_0x8895('0x36'),'internal':_0x1e6395['user'][_0x8895('0x37')],'uniqueid':_0x1e6395['body']['interaction'][_0x206f57][_0x14295a]}});}}}}return respondWithRpcPromise(_0x8895('0x38'),{'id':_0x1e6395['params']['id'],'capacity':_0x1e6395[_0x8895('0x1d')][_0x8895('0x39')]},routingClient)[_0x8895('0x5')](respondWithResult(_0x5e6413,null))[_0x8895('0xa')](handleError(_0x5e6413,null));};exports[_0x8895('0x3a')]=function(_0x39a1d9,_0x306481){return respondWithRpcPromise(_0x8895('0x3b'),_0x39a1d9['query'])[_0x8895('0x5')](respondWithResult(_0x306481,null))[_0x8895('0xa')](handleError(_0x306481,null));};exports[_0x8895('0x3c')]=function(_0x5a5bc6,_0x1935aa){return respondWithRpcPromise(_0x8895('0x3d'),_0x5a5bc6[_0x8895('0x16')])[_0x8895('0x5')](respondWithResult(_0x1935aa,null))[_0x8895('0xa')](handleError(_0x1935aa,null));};exports[_0x8895('0x3e')]=function(_0x434ab8,_0x216e6e){return respondWithRpcPromise(_0x8895('0x3f'),_0x434ab8[_0x8895('0x16')])['then'](respondWithResult(_0x216e6e,null))[_0x8895('0xa')](handleError(_0x216e6e,null));};exports[_0x8895('0x40')]=function(_0xb3d1ab,_0x10560a){return respondWithRpcPromise(_0x8895('0x41'),_0xb3d1ab['query'],routingClient)[_0x8895('0x5')](respondWithResult(_0x10560a,null))[_0x8895('0xa')](handleError(_0x10560a,null));};exports[_0x8895('0x42')]=function(_0x3d17bd,_0x37a7b4){return respondWithRpcPromise('ChatQueues',_0x3d17bd[_0x8895('0x16')],routingClient)[_0x8895('0x5')](findById(_0x3d17bd[_0x8895('0x19')]['id']))['then'](respondWithResult(_0x37a7b4,null))[_0x8895('0xa')](handleError(_0x37a7b4,null));};exports[_0x8895('0x43')]=function(_0x2c777b,_0x4ec8eb){return respondWithRpcPromise(_0x8895('0x44'),_0x2c777b[_0x8895('0x16')],routingClient)['then'](respondWithResult(_0x4ec8eb,null))[_0x8895('0xa')](handleError(_0x4ec8eb,null));};exports[_0x8895('0x45')]=function(_0x5198f8,_0x2f990a){return respondWithRpcPromise(_0x8895('0x44'),_0x5198f8[_0x8895('0x16')],routingClient)[_0x8895('0x5')](findById(_0x5198f8['params']['id']))['then'](respondWithResult(_0x2f990a,null))[_0x8895('0xa')](handleError(_0x2f990a,null));};exports[_0x8895('0x46')]=function(_0x49877,_0x51eb9c){return respondWithRpcPromise(_0x8895('0x47'),_0x49877[_0x8895('0x16')],mailClient)['then'](respondWithResult(_0x51eb9c,null))[_0x8895('0xa')](handleError(_0x51eb9c,null));};exports['openchannelQueues']=function(_0x435e36,_0x2bd955){return respondWithRpcPromise(_0x8895('0x48'),_0x435e36[_0x8895('0x16')],routingClient)[_0x8895('0x5')](respondWithResult(_0x2bd955,null))['catch'](handleError(_0x2bd955,null));};exports['showOpenchannelQueues']=function(_0x239401,_0x216abb){return respondWithRpcPromise('OpenchannelQueues',_0x239401[_0x8895('0x16')],routingClient)[_0x8895('0x5')](findById(_0x239401[_0x8895('0x19')]['id']))[_0x8895('0x5')](respondWithResult(_0x216abb,null))['catch'](handleError(_0x216abb,null));};exports[_0x8895('0x49')]=function(_0x2d2bf9,_0x1b1bc0){return respondWithRpcPromise(_0x8895('0x4a'),_0x2d2bf9[_0x8895('0x16')],routingClient)[_0x8895('0x5')](respondWithResult(_0x1b1bc0,null))[_0x8895('0xa')](handleError(_0x1b1bc0,null));};exports[_0x8895('0x4b')]=function(_0x2bffd7,_0x21c7bb){return respondWithRpcPromise(_0x8895('0x4a'),_0x2bffd7[_0x8895('0x16')],routingClient)[_0x8895('0x5')](findById(_0x2bffd7[_0x8895('0x19')]['id']))[_0x8895('0x5')](respondWithResult(_0x21c7bb,null))['catch'](handleError(_0x21c7bb,null));};exports['whatsappQueues']=function(_0x5b96fe,_0x13b143){return respondWithRpcPromise(_0x8895('0x4c'),_0x5b96fe[_0x8895('0x16')],routingClient)[_0x8895('0x5')](respondWithResult(_0x13b143,null))[_0x8895('0xa')](handleError(_0x13b143,null));};exports['showWhatsappQueues']=function(_0x816803,_0xc6af80){return respondWithRpcPromise('WhatsappQueues',_0x816803[_0x8895('0x16')],routingClient)[_0x8895('0x5')](findById(_0x816803[_0x8895('0x19')]['id']))[_0x8895('0x5')](respondWithResult(_0xc6af80,null))[_0x8895('0xa')](handleError(_0xc6af80,null));};exports['faxQueues']=function(_0x6440ea,_0x3c318c){return respondWithRpcPromise(_0x8895('0x4d'),_0x6440ea[_0x8895('0x16')],routingClient)[_0x8895('0x5')](respondWithResult(_0x3c318c,null))[_0x8895('0xa')](handleError(_0x3c318c,null));};exports[_0x8895('0x4e')]=function(_0x5e7048,_0x10d395){return respondWithRpcPromise(_0x8895('0x4d'),_0x5e7048['query'],routingClient)[_0x8895('0x5')](findById(_0x5e7048[_0x8895('0x19')]['id']))[_0x8895('0x5')](respondWithResult(_0x10d395,null))[_0x8895('0xa')](handleError(_0x10d395,null));};exports[_0x8895('0x4f')]=function(_0x560381,_0x16cd17){return respondWithRpcPromise('FaxAccounts',_0x560381[_0x8895('0x16')])[_0x8895('0x5')](respondWithResult(_0x16cd17,null))['catch'](handleError(_0x16cd17,null));};exports[_0x8895('0x50')]=function(_0x24f1c5,_0x140b2a){return respondWithRpcPromise(_0x8895('0x51'),_0x24f1c5['query'],routingClient)[_0x8895('0x5')](respondWithResult(_0x140b2a,null))['catch'](handleError(_0x140b2a,null));};exports['mailQueuesWaitingInteractions']=function(_0x1a198d,_0x185351){return respondWithRpcPromise(_0x8895('0x52'),_0x1a198d['query'],routingClient)[_0x8895('0x5')](respondWithResult(_0x185351,null))['catch'](handleError(_0x185351,null));};exports[_0x8895('0x53')]=function(_0x930a13,_0x3893fb){return respondWithRpcPromise(_0x8895('0x54'),_0x930a13[_0x8895('0x16')],routingClient)['then'](respondWithResult(_0x3893fb,null))['catch'](handleError(_0x3893fb,null));};exports[_0x8895('0x55')]=function(_0x5517a2,_0x3707a6){return respondWithRpcPromise(_0x8895('0x54'),_0x5517a2['query'],routingClient)[_0x8895('0x5')](function(_0xd9637a){if(_0x5517a2[_0x8895('0x16')][_0x8895('0x56')]!==undefined){var _0x166e9a=_(_0xd9637a['rows'])[_0x8895('0x57')]([_0x5517a2['query']['type'],_0x5517a2[_0x8895('0x19')]['id']])['map'](_0x8895('0x58'))[_0x8895('0x59')]()[_0x8895('0x5a')]();return _0xd9637a[_0x8895('0x12')]['filter'](function(_0x4d802e){return _0x166e9a['indexOf'](_0x4d802e[_0x8895('0x58')])>-0x1;});}else{return _0xd9637a[_0x8895('0x12')][_0x8895('0x57')](function(_0x14fd1f){return _0x14fd1f[_0x8895('0x58')]===parseInt(_0x5517a2[_0x8895('0x19')]['id']);});}})['then'](respondWithResult(_0x3707a6,null))[_0x8895('0xa')](handleError(_0x3707a6,null));};exports[_0x8895('0x5b')]=function(_0x4deccc,_0x584a1f){return respondWithRpcPromise(_0x8895('0x5c'),_0x4deccc['query'],routingClient)[_0x8895('0x5')](respondWithResult(_0x584a1f,null))['catch'](handleError(_0x584a1f,null));};exports[_0x8895('0x5d')]=function(_0x452756,_0x553437){return respondWithRpcPromise(_0x8895('0x5e'),_0x452756[_0x8895('0x16')],routingClient)['then'](respondWithResult(_0x553437,null))[_0x8895('0xa')](handleError(_0x553437,null));};exports[_0x8895('0x5f')]=function(_0x2af98f,_0xef59db){return respondWithRpcPromise(_0x8895('0x60'),_0x2af98f[_0x8895('0x16')],routingClient)[_0x8895('0x5')](respondWithResult(_0xef59db,null))['catch'](handleError(_0xef59db,null));};exports[_0x8895('0x61')]=function(_0x5ada19){return function(_0x330506,_0x1f583a){var _0x32d52c,_0x325597;var _0x4e6691=_[_0x8895('0x62')](_0x5ada19);var _0x1d50f6=_0x5ada19===_0x8895('0x63')?_0x8895('0x64'):_0x8895('0x65');return db[_0x4e6691+_0x8895('0x66')][_0x8895('0x67')]({'raw':!![],'where':{'id':_0x330506[_0x8895('0x19')]['id']}})['then'](function(_0x3b4092){if(_[_0x8895('0x11')](_0x3b4092)){throw new Error(_0x4e6691+'\x20Queue\x20not\x20found');}_0x32d52c=_0x3b4092;return db[_0x4e6691+'Message'][_0x8895('0x67')]({'where':{'id':_0x330506[_0x8895('0x1d')][_0x8895('0x68')]},'include':[{'model':db[_0x4e6691+_0x8895('0x69')],'as':'Interaction'},{'model':db[_0x4e6691+_0x1d50f6],'as':'Account'}]});})[_0x8895('0x5')](function(_0x42ebe2){if(_[_0x8895('0x11')](_0x42ebe2)){throw new Error(_0x4e6691+_0x8895('0x6a'));}_0x325597=_0x42ebe2;return _0x42ebe2[_0x8895('0x6b')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x2cd8b0={'uniqueid':_0x5ada19+'.'+_0x325597['id']+'.'+_0x325597[_0x8895('0x69')]['id'],'FromUserId':_0x330506['user']['id'],'type':_0x8895('0x6c')};_0x2cd8b0[_0x4e6691+_0x8895('0x6d')]=_0x325597['id'];_0x2cd8b0[_0x4e6691+_0x8895('0x6e')]=_0x325597[_0x8895('0x69')]['id'];_0x2cd8b0[_0x8895('0x6f')+_0x4e6691+_0x1d50f6+'Id']=_0x325597[_0x8895('0x65')]['id'];_0x2cd8b0['To'+_0x4e6691+'QueueId']=_0x32d52c['id'];return db[_0x4e6691+_0x8895('0x70')][_0x8895('0x71')](_0x2cd8b0);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x5ada19,'interaction':_0x325597['Interaction'],'message':_0x325597,'account':_0x325597[_0x8895('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0x8895('0x6c'),'appdata':_0x32d52c['name']+','+(_0x325597[_0x8895('0x65')]['queueTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0x1f583a,null))[_0x8895('0xa')](handleError(_0x1f583a,null));};};exports[_0x8895('0x72')]=function(_0x28d7ab,_0x20b607){var _0x605f47,_0x54cf18;if(_[_0x8895('0x11')](_0x28d7ab[_0x8895('0x1d')][_0x8895('0x73')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x4a4d4b=_0x28d7ab['body'][_0x8895('0x73')];var _0x1d796a=_[_0x8895('0x62')](_0x4a4d4b);var _0x2084b1=_0x4a4d4b===_0x8895('0x63')?_0x8895('0x64'):_0x8895('0x65');return db['User'][_0x8895('0x67')]({'raw':!![],'where':{'id':_0x28d7ab['params']['id'],'role':_0x8895('0x36')}})['then'](function(_0x2f2908){if(_[_0x8895('0x11')](_0x2f2908)){throw new Error(_0x8895('0x74'));}_0x605f47=_0x2f2908;return db[_0x1d796a+_0x8895('0x75')][_0x8895('0x67')]({'where':{'id':_0x28d7ab[_0x8895('0x1d')][_0x8895('0x68')]},'include':[{'model':db[_0x1d796a+'Interaction'],'as':_0x8895('0x69')},{'model':db[_0x1d796a+_0x2084b1],'as':_0x8895('0x65')}]});})[_0x8895('0x5')](function(_0x3ce240){if(_[_0x8895('0x11')](_0x3ce240)){throw new Error(_0x1d796a+'\x20Message\x20not\x20found');}_0x54cf18=_0x3ce240;return _0x3ce240[_0x8895('0x6b')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x20f574={'uniqueid':_0x4a4d4b+'.'+_0x54cf18['id']+'.'+_0x54cf18[_0x8895('0x69')]['id'],'FromUserId':_0x28d7ab[_0x8895('0x2e')]['id'],'type':_0x8895('0x6c'),'ToUserId':_0x605f47['id']};_0x20f574[_0x1d796a+_0x8895('0x6d')]=_0x54cf18['id'];_0x20f574[_0x1d796a+_0x8895('0x6e')]=_0x54cf18[_0x8895('0x69')]['id'];_0x20f574[_0x8895('0x6f')+_0x1d796a+_0x2084b1+'Id']=_0x54cf18[_0x8895('0x65')]['id'];return db[_0x1d796a+'TransferReport'][_0x8895('0x71')](_0x20f574);})['then'](function(){return respondWithRpcPromise(_0x8895('0x76'),{'channel':_0x4a4d4b,'interaction':_0x54cf18[_0x8895('0x69')],'message':_0x54cf18,'account':_0x54cf18[_0x8895('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x605f47[_0x8895('0xf')]+','+(_0x54cf18['Account'][_0x8895('0x77')]||0x12c),'interval':_0x8895('0x78')}]},routingClient);})[_0x8895('0x5')](respondWithResult(_0x20b607,null))[_0x8895('0xa')](handleError(_0x20b607,null));}; \ No newline at end of file +var _0xd8fb=['ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','map','queue_id','uniq','filter','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','messageId','Interaction','update','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','User','Message','bluebird','moment','lodash','util','jayson/promise','client','http','then','error','code','message','result','catch','status','json','sendStatus','stack','name','isNil','find','rows','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','updateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','findAll','length','format','updateAttributes','findOrCreate','INTERACTION','interface','SIP/%s','agent','internal','AgentCapacity','capacity','Telephones','Trunks','campaigns','Campaigns','ChatQueues','mailQueues','MailQueues','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','showWhatsappQueues','WhatsappQueues','FaxQueues','faxAccounts','chatQueuesWaitingInteractions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd8fb,0x99));var _0xbd8f=function(_0x14d60e,_0xb6a334){_0x14d60e=_0x14d60e-0x0;var _0x344d28=_0xd8fb[_0x14d60e];return _0x344d28;};'use strict';var BPromise=require(_0xbd8f('0x0'));var moment=require(_0xbd8f('0x1'));var _=require(_0xbd8f('0x2'));var util=require(_0xbd8f('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')('api');var jayson=require(_0xbd8f('0x4'));var amiClient=jayson[_0xbd8f('0x5')]['http']({'port':0x232a});var mailClient=jayson[_0xbd8f('0x5')][_0xbd8f('0x6')]({'port':0x232b});var routingClient=jayson['client'][_0xbd8f('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x4e97cf,_0xf503c4,_0x578499){return new BPromise(function(_0x197827,_0x403edc){var _0x493298=_0x578499?_0x578499:amiClient;return _0x493298['request'](_0x4e97cf,_0xf503c4)[_0xbd8f('0x7')](function(_0x2393a9){if(_0x2393a9[_0xbd8f('0x8')]){if(_0x2393a9['error'][_0xbd8f('0x9')]===0x1f4){return _0x403edc(_0x2393a9[_0xbd8f('0x8')]['message']);}return _0x197827(_0x2393a9['error'][_0xbd8f('0xa')]);}else{_0x197827(_0x2393a9[_0xbd8f('0xb')]);}})[_0xbd8f('0xc')](function(_0x5d5705){_0x403edc(_0x5d5705);});});}function respondWithResult(_0x230988,_0x159f09){_0x159f09=_0x159f09||0xc8;return function(_0x39be16){if(_0x39be16){return _0x230988[_0xbd8f('0xd')](_0x159f09)[_0xbd8f('0xe')](_0x39be16);}return _0x230988[_0xbd8f('0xf')](0x194);};}function handleError(_0x37d4d5,_0x29ffe8){_0x29ffe8=_0x29ffe8||0x1f4;return function(_0x14606c){logger['error'](_0x14606c[_0xbd8f('0x10')]);if(_0x14606c[_0xbd8f('0x11')]){delete _0x14606c[_0xbd8f('0x11')];}_0x37d4d5[_0xbd8f('0xd')](_0x29ffe8)['send'](_0x14606c);};}function findById(_0x174929){return function(_0x63db18){if(!_['isNil'](_0x174929)&&!_[_0xbd8f('0x12')](_0x63db18)&&!_[_0xbd8f('0x12')](_0x63db18['rows'])){return _[_0xbd8f('0x13')](_0x63db18[_0xbd8f('0x14')],function(_0x47d317){return _0x47d317['id']==_0x174929;});}return null;};}exports['voiceChannels']=function(_0x33f77c,_0x5d2fdb){return respondWithRpcPromise('VoiceChannels',_0x33f77c[_0xbd8f('0x15')])['then'](respondWithResult(_0x5d2fdb,null))[_0xbd8f('0xc')](handleError(_0x5d2fdb,null));};exports[_0xbd8f('0x16')]=function(_0xb47c8e,_0x897f25){return respondWithRpcPromise(_0xbd8f('0x17'),_[_0xbd8f('0x18')](_0xb47c8e[_0xbd8f('0x15')],_0xb47c8e[_0xbd8f('0x19')]))[_0xbd8f('0x7')](respondWithResult(_0x897f25,null))[_0xbd8f('0xc')](handleError(_0x897f25,null));};exports[_0xbd8f('0x1a')]=function(_0x1628f5,_0x2f7c45){return respondWithRpcPromise(_0xbd8f('0x1b'),_[_0xbd8f('0x18')](_0x1628f5[_0xbd8f('0x15')],_0x1628f5[_0xbd8f('0x19')]))['then'](respondWithResult(_0x2f7c45,null))[_0xbd8f('0xc')](handleError(_0x2f7c45,null));};exports[_0xbd8f('0x1c')]=function(_0x1f9fcc,_0x2f3df7){return respondWithRpcPromise(_0xbd8f('0x1d'),_0x1f9fcc[_0xbd8f('0x15')])[_0xbd8f('0x7')](respondWithResult(_0x2f3df7,null))[_0xbd8f('0xc')](handleError(_0x2f3df7,null));};exports['showVoiceQueues']=function(_0x40cb43,_0x421f3e){return respondWithRpcPromise('VoiceQueues',_0x40cb43[_0xbd8f('0x15')])['then'](findById(_0x40cb43[_0xbd8f('0x19')]['id']))[_0xbd8f('0x7')](respondWithResult(_0x421f3e,null))[_0xbd8f('0xc')](handleError(_0x421f3e,null));};exports[_0xbd8f('0x1e')]=function(_0x2aefa2,_0x247b07){return respondWithRpcPromise('UpdateVoiceQueue',_[_0xbd8f('0x18')](_0x2aefa2[_0xbd8f('0x1f')],_0x2aefa2[_0xbd8f('0x19')]))[_0xbd8f('0x7')](respondWithResult(_0x247b07,null))[_0xbd8f('0xc')](handleError(_0x247b07,null));};exports[_0xbd8f('0x20')]=function(_0x2a4b32,_0x479a0c){return respondWithRpcPromise(_0xbd8f('0x21'),_[_0xbd8f('0x18')](_0x2a4b32[_0xbd8f('0x15')],_0x2a4b32[_0xbd8f('0x19')]))['then'](respondWithResult(_0x479a0c,null))['catch'](handleError(_0x479a0c,null));};exports[_0xbd8f('0x22')]=function(_0x3cdec2,_0x2fd6f8){return respondWithRpcPromise(_0xbd8f('0x23'),_0x3cdec2['query'])[_0xbd8f('0x7')](respondWithResult(_0x2fd6f8,null))[_0xbd8f('0xc')](handleError(_0x2fd6f8,null));};exports[_0xbd8f('0x24')]=function(_0x2137ed,_0x25ad9a){return respondWithRpcPromise('VoiceQueuesChannel',_[_0xbd8f('0x18')](_0x2137ed[_0xbd8f('0x15')],_0x2137ed[_0xbd8f('0x19')]))[_0xbd8f('0x7')](respondWithResult(_0x25ad9a,null))[_0xbd8f('0xc')](handleError(_0x25ad9a,null));};exports['voiceQueuesChannelHangup']=function(_0x24e5f4,_0x5f404e){return respondWithRpcPromise(_0xbd8f('0x25'),_[_0xbd8f('0x18')](_0x24e5f4[_0xbd8f('0x15')],_0x24e5f4[_0xbd8f('0x19')]))[_0xbd8f('0x7')](respondWithResult(_0x5f404e,null))[_0xbd8f('0xc')](handleError(_0x5f404e,null));};exports['voiceQueuesChannelRedirect']=function(_0x4bafcd,_0x4c9a8d){return respondWithRpcPromise(_0xbd8f('0x26'),_[_0xbd8f('0x18')](_0x4bafcd[_0xbd8f('0x15')],_0x4bafcd[_0xbd8f('0x19')]))[_0xbd8f('0x7')](respondWithResult(_0x4c9a8d,null))[_0xbd8f('0xc')](handleError(_0x4c9a8d,null));};exports[_0xbd8f('0x27')]=function(_0x30c1c2,_0x2d4882){return respondWithRpcPromise(_0xbd8f('0x28'),_0x30c1c2[_0xbd8f('0x15')])[_0xbd8f('0x7')](respondWithResult(_0x2d4882,null))[_0xbd8f('0xc')](handleError(_0x2d4882,null));};exports[_0xbd8f('0x29')]=function(_0x391d45,_0x50e081){return respondWithRpcPromise(_0xbd8f('0x2a'),_0x391d45[_0xbd8f('0x15')])['then'](respondWithResult(_0x50e081,null))[_0xbd8f('0xc')](handleError(_0x50e081,null));};exports[_0xbd8f('0x2b')]=function(_0x3d3902,_0x582bcf){var _0x21da54;return respondWithRpcPromise('Agents',_0x3d3902[_0xbd8f('0x15')])[_0xbd8f('0x7')](function(_0x298952){_0x21da54=_0x298952;return respondWithRpcPromise('Agents',_0x3d3902[_0xbd8f('0x15')],routingClient);})[_0xbd8f('0x7')](function(_0xdab323){return _['merge']({},_0xdab323,_0x21da54);})[_0xbd8f('0x7')](respondWithResult(_0x582bcf,null))[_0xbd8f('0xc')](handleError(_0x582bcf,null));};exports[_0xbd8f('0x2c')]=function(_0x351027,_0x280d95){if(_0x351027[_0xbd8f('0x1f')]&&_0x351027[_0xbd8f('0x1f')][_0xbd8f('0x2d')]&&_0x351027[_0xbd8f('0x2e')]&&_0x351027['user']['name']){for(var _0x2907a3 in _0x351027[_0xbd8f('0x1f')][_0xbd8f('0x2d')]){if(_0x351027[_0xbd8f('0x1f')]['interaction'][_0xbd8f('0x2f')](_0x2907a3)){db[_0xbd8f('0x30')][_0xbd8f('0x31')]({'where':{'channel':_0x2907a3,'membername':_0x351027[_0xbd8f('0x2e')][_0xbd8f('0x11')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x351027['body'][_0xbd8f('0x2d')][_0x2907a3]&&_0x351027['body'][_0xbd8f('0x2d')][_0x2907a3][_0xbd8f('0x32')]?{'$notIn':_0x351027[_0xbd8f('0x1f')][_0xbd8f('0x2d')][_0x2907a3]}:{'$ne':null}}})[_0xbd8f('0x7')](function(_0x151f82){var _0x1ea49a=moment()[_0xbd8f('0x33')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x36c43f=0x0,_0x2fbbbe=_0x151f82[_0xbd8f('0x32')];_0x36c43f<_0x2fbbbe;_0x36c43f+=0x1){_0x151f82[_0x36c43f][_0xbd8f('0x34')]({'exitAt':_0x1ea49a});}});for(var _0x229bc0=0x0;_0x229bc0<_0x351027[_0xbd8f('0x1f')][_0xbd8f('0x2d')][_0x2907a3][_0xbd8f('0x32')];_0x229bc0+=0x1){db['MemberReport'][_0xbd8f('0x35')]({'where':{'channel':_0x2907a3,'membername':_0x351027[_0xbd8f('0x2e')][_0xbd8f('0x11')],'type':_0xbd8f('0x36'),'uniqueid':_0x351027[_0xbd8f('0x1f')][_0xbd8f('0x2d')][_0x2907a3][_0x229bc0],'exitAt':null},'defaults':{'channel':_0x2907a3,'membername':_0x351027[_0xbd8f('0x2e')][_0xbd8f('0x11')],'interface':_[_0xbd8f('0x12')](_0x351027[_0xbd8f('0x2e')][_0xbd8f('0x37')])?util[_0xbd8f('0x33')](_0xbd8f('0x38'),_0x351027[_0xbd8f('0x2e')][_0xbd8f('0x11')]):_0x351027[_0xbd8f('0x2e')][_0xbd8f('0x37')],'type':_0xbd8f('0x36'),'enterAt':moment()[_0xbd8f('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xbd8f('0x39'),'internal':_0x351027[_0xbd8f('0x2e')][_0xbd8f('0x3a')],'uniqueid':_0x351027[_0xbd8f('0x1f')]['interaction'][_0x2907a3][_0x229bc0]}});}}}}return respondWithRpcPromise(_0xbd8f('0x3b'),{'id':_0x351027['params']['id'],'capacity':_0x351027[_0xbd8f('0x1f')][_0xbd8f('0x3c')]},routingClient)[_0xbd8f('0x7')](respondWithResult(_0x280d95,null))[_0xbd8f('0xc')](handleError(_0x280d95,null));};exports['telephones']=function(_0x3964f5,_0x35b814){return respondWithRpcPromise(_0xbd8f('0x3d'),_0x3964f5[_0xbd8f('0x15')])[_0xbd8f('0x7')](respondWithResult(_0x35b814,null))[_0xbd8f('0xc')](handleError(_0x35b814,null));};exports['trunks']=function(_0x42a597,_0x4a2da8){return respondWithRpcPromise(_0xbd8f('0x3e'),_0x42a597[_0xbd8f('0x15')])[_0xbd8f('0x7')](respondWithResult(_0x4a2da8,null))[_0xbd8f('0xc')](handleError(_0x4a2da8,null));};exports[_0xbd8f('0x3f')]=function(_0x358424,_0x2a331d){return respondWithRpcPromise(_0xbd8f('0x40'),_0x358424[_0xbd8f('0x15')])['then'](respondWithResult(_0x2a331d,null))[_0xbd8f('0xc')](handleError(_0x2a331d,null));};exports['chatQueues']=function(_0xd09e5,_0xb04dae){return respondWithRpcPromise('ChatQueues',_0xd09e5[_0xbd8f('0x15')],routingClient)['then'](respondWithResult(_0xb04dae,null))['catch'](handleError(_0xb04dae,null));};exports['showChatQueues']=function(_0x55de68,_0x4042e0){return respondWithRpcPromise(_0xbd8f('0x41'),_0x55de68[_0xbd8f('0x15')],routingClient)[_0xbd8f('0x7')](findById(_0x55de68[_0xbd8f('0x19')]['id']))['then'](respondWithResult(_0x4042e0,null))['catch'](handleError(_0x4042e0,null));};exports[_0xbd8f('0x42')]=function(_0x3848cb,_0x21d40b){return respondWithRpcPromise(_0xbd8f('0x43'),_0x3848cb[_0xbd8f('0x15')],routingClient)['then'](respondWithResult(_0x21d40b,null))[_0xbd8f('0xc')](handleError(_0x21d40b,null));};exports['showMailQueues']=function(_0x9cf2d5,_0x40c834){return respondWithRpcPromise(_0xbd8f('0x43'),_0x9cf2d5['query'],routingClient)[_0xbd8f('0x7')](findById(_0x9cf2d5[_0xbd8f('0x19')]['id']))[_0xbd8f('0x7')](respondWithResult(_0x40c834,null))[_0xbd8f('0xc')](handleError(_0x40c834,null));};exports['mailAccounts']=function(_0x5327f2,_0x388af8){return respondWithRpcPromise('MailAccounts',_0x5327f2[_0xbd8f('0x15')],mailClient)[_0xbd8f('0x7')](respondWithResult(_0x388af8,null))[_0xbd8f('0xc')](handleError(_0x388af8,null));};exports[_0xbd8f('0x44')]=function(_0x4a86a9,_0x5ea275){return respondWithRpcPromise(_0xbd8f('0x45'),_0x4a86a9[_0xbd8f('0x15')],routingClient)[_0xbd8f('0x7')](respondWithResult(_0x5ea275,null))[_0xbd8f('0xc')](handleError(_0x5ea275,null));};exports[_0xbd8f('0x46')]=function(_0x21cad7,_0x31adfb){return respondWithRpcPromise(_0xbd8f('0x45'),_0x21cad7[_0xbd8f('0x15')],routingClient)[_0xbd8f('0x7')](findById(_0x21cad7[_0xbd8f('0x19')]['id']))['then'](respondWithResult(_0x31adfb,null))[_0xbd8f('0xc')](handleError(_0x31adfb,null));};exports[_0xbd8f('0x47')]=function(_0x225ebd,_0x12ee82){return respondWithRpcPromise(_0xbd8f('0x48'),_0x225ebd[_0xbd8f('0x15')],routingClient)['then'](respondWithResult(_0x12ee82,null))[_0xbd8f('0xc')](handleError(_0x12ee82,null));};exports[_0xbd8f('0x49')]=function(_0x538fd7,_0x5e18fc){return respondWithRpcPromise(_0xbd8f('0x48'),_0x538fd7[_0xbd8f('0x15')],routingClient)[_0xbd8f('0x7')](findById(_0x538fd7['params']['id']))['then'](respondWithResult(_0x5e18fc,null))[_0xbd8f('0xc')](handleError(_0x5e18fc,null));};exports['whatsappQueues']=function(_0x565e63,_0x5b5bd8){return respondWithRpcPromise('WhatsappQueues',_0x565e63['query'],routingClient)[_0xbd8f('0x7')](respondWithResult(_0x5b5bd8,null))['catch'](handleError(_0x5b5bd8,null));};exports[_0xbd8f('0x4a')]=function(_0x400aac,_0x53f297){return respondWithRpcPromise(_0xbd8f('0x4b'),_0x400aac[_0xbd8f('0x15')],routingClient)[_0xbd8f('0x7')](findById(_0x400aac[_0xbd8f('0x19')]['id']))[_0xbd8f('0x7')](respondWithResult(_0x53f297,null))['catch'](handleError(_0x53f297,null));};exports['faxQueues']=function(_0x378e72,_0x44469e){return respondWithRpcPromise(_0xbd8f('0x4c'),_0x378e72[_0xbd8f('0x15')],routingClient)[_0xbd8f('0x7')](respondWithResult(_0x44469e,null))[_0xbd8f('0xc')](handleError(_0x44469e,null));};exports['showFaxQueues']=function(_0x4eddf2,_0x467b0f){return respondWithRpcPromise(_0xbd8f('0x4c'),_0x4eddf2['query'],routingClient)[_0xbd8f('0x7')](findById(_0x4eddf2[_0xbd8f('0x19')]['id']))['then'](respondWithResult(_0x467b0f,null))[_0xbd8f('0xc')](handleError(_0x467b0f,null));};exports[_0xbd8f('0x4d')]=function(_0x10268a,_0x5a8c8f){return respondWithRpcPromise('FaxAccounts',_0x10268a[_0xbd8f('0x15')])[_0xbd8f('0x7')](respondWithResult(_0x5a8c8f,null))[_0xbd8f('0xc')](handleError(_0x5a8c8f,null));};exports[_0xbd8f('0x4e')]=function(_0x41be86,_0x5b900c){return respondWithRpcPromise(_0xbd8f('0x4f'),_0x41be86[_0xbd8f('0x15')],routingClient)[_0xbd8f('0x7')](respondWithResult(_0x5b900c,null))[_0xbd8f('0xc')](handleError(_0x5b900c,null));};exports[_0xbd8f('0x50')]=function(_0x3574a6,_0x2a7eaa){return respondWithRpcPromise(_0xbd8f('0x51'),_0x3574a6[_0xbd8f('0x15')],routingClient)[_0xbd8f('0x7')](respondWithResult(_0x2a7eaa,null))[_0xbd8f('0xc')](handleError(_0x2a7eaa,null));};exports[_0xbd8f('0x52')]=function(_0x34eec5,_0x40fc53){return respondWithRpcPromise(_0xbd8f('0x53'),_0x34eec5[_0xbd8f('0x15')],routingClient)[_0xbd8f('0x7')](respondWithResult(_0x40fc53,null))[_0xbd8f('0xc')](handleError(_0x40fc53,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x38d98e,_0x2957fd){return respondWithRpcPromise(_0xbd8f('0x53'),_0x38d98e[_0xbd8f('0x15')],routingClient)[_0xbd8f('0x7')](function(_0x18ccf2){if(_0x38d98e['query']['type']!==undefined){var _0x2a3982=_(_0x18ccf2[_0xbd8f('0x14')])['filter']([_0x38d98e[_0xbd8f('0x15')]['type'],_0x38d98e[_0xbd8f('0x19')]['id']])[_0xbd8f('0x54')](_0xbd8f('0x55'))[_0xbd8f('0x56')]()['value']();return _0x18ccf2[_0xbd8f('0x14')][_0xbd8f('0x57')](function(_0x84e98d){return _0x2a3982['indexOf'](_0x84e98d[_0xbd8f('0x55')])>-0x1;});}else{return _0x18ccf2[_0xbd8f('0x14')][_0xbd8f('0x57')](function(_0x161ec8){return _0x161ec8['queue_id']===parseInt(_0x38d98e[_0xbd8f('0x19')]['id']);});}})[_0xbd8f('0x7')](respondWithResult(_0x2957fd,null))[_0xbd8f('0xc')](handleError(_0x2957fd,null));};exports[_0xbd8f('0x58')]=function(_0x18645e,_0x23e962){return respondWithRpcPromise(_0xbd8f('0x59'),_0x18645e[_0xbd8f('0x15')],routingClient)['then'](respondWithResult(_0x23e962,null))[_0xbd8f('0xc')](handleError(_0x23e962,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x3da31b,_0x4e908d){return respondWithRpcPromise(_0xbd8f('0x5a'),_0x3da31b[_0xbd8f('0x15')],routingClient)['then'](respondWithResult(_0x4e908d,null))[_0xbd8f('0xc')](handleError(_0x4e908d,null));};exports[_0xbd8f('0x5b')]=function(_0x60cd2b,_0x2ab853){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x60cd2b[_0xbd8f('0x15')],routingClient)[_0xbd8f('0x7')](respondWithResult(_0x2ab853,null))[_0xbd8f('0xc')](handleError(_0x2ab853,null));};exports[_0xbd8f('0x5c')]=function(_0x58651d){return function(_0x4e19ec,_0x2fb942){var _0x3641e9,_0x1f685d;var _0x2acd13=_[_0xbd8f('0x5d')](_0x58651d);var _0x53076d=_0x58651d===_0xbd8f('0x5e')?_0xbd8f('0x5f'):_0xbd8f('0x60');return db[_0x2acd13+_0xbd8f('0x61')][_0xbd8f('0x62')]({'raw':!![],'where':{'id':_0x4e19ec['params']['id']}})['then'](function(_0x542075){if(_[_0xbd8f('0x12')](_0x542075)){throw new Error(_0x2acd13+'\x20Queue\x20not\x20found');}_0x3641e9=_0x542075;return db[_0x2acd13+'Message']['findOne']({'where':{'id':_0x4e19ec[_0xbd8f('0x1f')][_0xbd8f('0x63')]},'include':[{'model':db[_0x2acd13+_0xbd8f('0x64')],'as':_0xbd8f('0x64')},{'model':db[_0x2acd13+_0x53076d],'as':_0xbd8f('0x60')}]});})[_0xbd8f('0x7')](function(_0xefcfc1){if(_[_0xbd8f('0x12')](_0xefcfc1)){throw new Error(_0x2acd13+'\x20Message\x20not\x20found');}_0x1f685d=_0xefcfc1;return _0xefcfc1[_0xbd8f('0x65')]({'read':0x0,'readAt':null,'UserId':null});})[_0xbd8f('0x7')](function(){var _0x3caa98={'uniqueid':_0x58651d+'.'+_0x1f685d['id']+'.'+_0x1f685d['Interaction']['id'],'FromUserId':_0x4e19ec[_0xbd8f('0x2e')]['id'],'type':_0xbd8f('0x66')};_0x3caa98[_0x2acd13+_0xbd8f('0x67')]=_0x1f685d['id'];_0x3caa98[_0x2acd13+_0xbd8f('0x68')]=_0x1f685d[_0xbd8f('0x64')]['id'];_0x3caa98[_0xbd8f('0x69')+_0x2acd13+_0x53076d+'Id']=_0x1f685d[_0xbd8f('0x60')]['id'];_0x3caa98['To'+_0x2acd13+_0xbd8f('0x6a')]=_0x3641e9['id'];return db[_0x2acd13+_0xbd8f('0x6b')][_0xbd8f('0x6c')](_0x3caa98);})['then'](function(){return respondWithRpcPromise(_0xbd8f('0x6d'),{'channel':_0x58651d,'interaction':_0x1f685d[_0xbd8f('0x64')],'message':_0x1f685d,'account':_0x1f685d[_0xbd8f('0x60')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x3641e9[_0xbd8f('0x11')]+','+(_0x1f685d['Account'][_0xbd8f('0x6e')]||0x12c),'interval':_0xbd8f('0x6f')}]},routingClient);})[_0xbd8f('0x7')](respondWithResult(_0x2fb942,null))[_0xbd8f('0xc')](handleError(_0x2fb942,null));};};exports[_0xbd8f('0x70')]=function(_0x57762c,_0xe58b64){var _0x198d4b,_0x60c94c;if(_[_0xbd8f('0x12')](_0x57762c[_0xbd8f('0x1f')][_0xbd8f('0x71')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x672cfb=_0x57762c[_0xbd8f('0x1f')]['channel'];var _0x49e15e=_[_0xbd8f('0x5d')](_0x672cfb);var _0x5b0716=_0x672cfb==='chat'?'Website':_0xbd8f('0x60');return db[_0xbd8f('0x72')][_0xbd8f('0x62')]({'raw':!![],'where':{'id':_0x57762c[_0xbd8f('0x19')]['id'],'role':'agent'}})[_0xbd8f('0x7')](function(_0x398cc9){if(_['isNil'](_0x398cc9)){throw new Error('Agent\x20not\x20found');}_0x198d4b=_0x398cc9;return db[_0x49e15e+_0xbd8f('0x73')]['findOne']({'where':{'id':_0x57762c[_0xbd8f('0x1f')]['messageId']},'include':[{'model':db[_0x49e15e+'Interaction'],'as':_0xbd8f('0x64')},{'model':db[_0x49e15e+_0x5b0716],'as':_0xbd8f('0x60')}]});})[_0xbd8f('0x7')](function(_0x18e9f0){if(_[_0xbd8f('0x12')](_0x18e9f0)){throw new Error(_0x49e15e+'\x20Message\x20not\x20found');}_0x60c94c=_0x18e9f0;return _0x18e9f0[_0xbd8f('0x65')]({'read':0x0,'readAt':null,'UserId':null});})[_0xbd8f('0x7')](function(){var _0x3a6ec4={'uniqueid':_0x672cfb+'.'+_0x60c94c['id']+'.'+_0x60c94c['Interaction']['id'],'FromUserId':_0x57762c[_0xbd8f('0x2e')]['id'],'type':_0xbd8f('0x66'),'ToUserId':_0x198d4b['id']};_0x3a6ec4[_0x49e15e+_0xbd8f('0x67')]=_0x60c94c['id'];_0x3a6ec4[_0x49e15e+_0xbd8f('0x68')]=_0x60c94c[_0xbd8f('0x64')]['id'];_0x3a6ec4[_0xbd8f('0x69')+_0x49e15e+_0x5b0716+'Id']=_0x60c94c[_0xbd8f('0x60')]['id'];return db[_0x49e15e+_0xbd8f('0x6b')][_0xbd8f('0x6c')](_0x3a6ec4);})[_0xbd8f('0x7')](function(){return respondWithRpcPromise('Start',{'channel':_0x672cfb,'interaction':_0x60c94c['Interaction'],'message':_0x60c94c,'account':_0x60c94c['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x198d4b[_0xbd8f('0x11')]+','+(_0x60c94c[_0xbd8f('0x60')]['agentTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0xe58b64,null))['catch'](handleError(_0xe58b64,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 23f02cd..8b93713 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 _0x962e=['get','isAuthenticated','index','show','/:id/run','run','post','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x38b2e7,_0x2f605b){var _0x308d09=function(_0x5ad923){while(--_0x5ad923){_0x38b2e7['push'](_0x38b2e7['shift']());}};_0x308d09(++_0x2f605b);}(_0x962e,0x1da));var _0xe962=function(_0xa65ffb,_0x53dd5b){_0xa65ffb=_0xa65ffb-0x0;var _0x491769=_0x962e[_0xa65ffb];return _0x491769;};'use strict';var multer=require(_0xe962('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe962('0x1'));var express=require(_0xe962('0x2'));var router=express[_0xe962('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe962('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe962('0x5'));var controller=require('./schedule.controller');router[_0xe962('0x6')]('/',auth[_0xe962('0x7')](),controller[_0xe962('0x8')]);router['get']('/:id',auth[_0xe962('0x7')](),controller[_0xe962('0x9')]);router[_0xe962('0x6')](_0xe962('0xa'),auth[_0xe962('0x7')](),controller[_0xe962('0xb')]);router[_0xe962('0xc')]('/',auth[_0xe962('0x7')](),controller[_0xe962('0xd')]);router[_0xe962('0xe')](_0xe962('0xf'),auth[_0xe962('0x7')](),controller[_0xe962('0x10')]);router[_0xe962('0x11')]('/:id',auth[_0xe962('0x7')](),controller[_0xe962('0x12')]);module[_0xe962('0x13')]=router; \ No newline at end of file +var _0xcc5e=['get','/:id','show','/:id/run','run','post','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','isAuthenticated','index'];(function(_0x34b167,_0x5bf6b8){var _0x9bcc7a=function(_0x148423){while(--_0x148423){_0x34b167['push'](_0x34b167['shift']());}};_0x9bcc7a(++_0x5bf6b8);}(_0xcc5e,0x155));var _0xecc5=function(_0x23c217,_0x3aee12){_0x23c217=_0x23c217-0x0;var _0x53fcf8=_0xcc5e[_0x23c217];return _0x53fcf8;};'use strict';var multer=require(_0xecc5('0x0'));var util=require(_0xecc5('0x1'));var path=require(_0xecc5('0x2'));var timeout=require('connect-timeout');var express=require(_0xecc5('0x3'));var router=express[_0xecc5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xecc5('0x5'));var interaction=require(_0xecc5('0x6'));var config=require(_0xecc5('0x7'));var controller=require(_0xecc5('0x8'));router['get']('/',auth[_0xecc5('0x9')](),controller[_0xecc5('0xa')]);router[_0xecc5('0xb')](_0xecc5('0xc'),auth[_0xecc5('0x9')](),controller[_0xecc5('0xd')]);router[_0xecc5('0xb')](_0xecc5('0xe'),auth[_0xecc5('0x9')](),controller[_0xecc5('0xf')]);router[_0xecc5('0x10')]('/',auth[_0xecc5('0x9')](),controller['create']);router[_0xecc5('0x11')]('/:id',auth[_0xecc5('0x9')](),controller[_0xecc5('0x12')]);router[_0xecc5('0x13')](_0xecc5('0xc'),auth['isAuthenticated'](),controller[_0xecc5('0x14')]);module[_0xecc5('0x15')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index a9e92d9..631dfd9 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 _0x56dd=['weeks','hours','minutes','days','pdf','xlsx','csv','default','TEXT','sequelize','exports','STRING','BOOLEAN','DATE','INTEGER','ENUM','months'];(function(_0x444781,_0x4c1340){var _0x3d87af=function(_0x4bb7ac){while(--_0x4bb7ac){_0x444781['push'](_0x444781['shift']());}};_0x3d87af(++_0x4c1340);}(_0x56dd,0x1b2));var _0xd56d=function(_0xb6e43,_0x1568fc){_0xb6e43=_0xb6e43-0x0;var _0x47c40f=_0x56dd[_0xb6e43];return _0x47c40f;};'use strict';var Sequelize=require(_0xd56d('0x0'));module[_0xd56d('0x1')]={'name':{'type':Sequelize[_0xd56d('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xd56d('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xd56d('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0xd56d('0x4')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xd56d('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xd56d('0x6')]('years','quarters',_0xd56d('0x7'),_0xd56d('0x8'),'days',_0xd56d('0x9'),_0xd56d('0xa')),'allowNull':![],'defaultValue':_0xd56d('0xb')},'output':{'type':Sequelize['ENUM']('csv',_0xd56d('0xc'),_0xd56d('0xd')),'allowNull':![],'defaultValue':_0xd56d('0xe')},'type':{'type':Sequelize[_0xd56d('0x6')]('custom',_0xd56d('0xf')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0xd56d('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xd56d('0x2')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0xd56d('0x10')]},'sendIfEmpty':{'type':Sequelize[_0xd56d('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x0c2e=['months','weeks','days','hours','minutes','csv','pdf','xlsx','custom','default','TEXT','sequelize','STRING','BOOLEAN','DATE','INTEGER','ENUM','years','quarters'];(function(_0x286726,_0x20a337){var _0xcd4fe9=function(_0x4d7da6){while(--_0x4d7da6){_0x286726['push'](_0x286726['shift']());}};_0xcd4fe9(++_0x20a337);}(_0x0c2e,0x90));var _0xe0c2=function(_0x512a1f,_0x1ac90f){_0x512a1f=_0x512a1f-0x0;var _0x2fe01f=_0x0c2e[_0x512a1f];return _0x2fe01f;};'use strict';var Sequelize=require(_0xe0c2('0x0'));module['exports']={'name':{'type':Sequelize[_0xe0c2('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xe0c2('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xe0c2('0x1')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0xe0c2('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xe0c2('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xe0c2('0x5')](_0xe0c2('0x6'),_0xe0c2('0x7'),_0xe0c2('0x8'),_0xe0c2('0x9'),_0xe0c2('0xa'),_0xe0c2('0xb'),_0xe0c2('0xc')),'allowNull':![],'defaultValue':_0xe0c2('0xa')},'output':{'type':Sequelize['ENUM'](_0xe0c2('0xd'),_0xe0c2('0xe'),_0xe0c2('0xf')),'allowNull':![],'defaultValue':_0xe0c2('0xd')},'type':{'type':Sequelize[_0xe0c2('0x5')](_0xe0c2('0x10'),_0xe0c2('0x11')),'allowNull':![],'defaultValue':_0xe0c2('0x10')},'sendMail':{'type':Sequelize[_0xe0c2('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xe0c2('0x1')]},'cc':{'type':Sequelize[_0xe0c2('0x12')]},'bcc':{'type':Sequelize[_0xe0c2('0x12')]},'sendIfEmpty':{'type':Sequelize[_0xe0c2('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 0c3c402..0ea28c2 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 _0xa33f=['sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','save','update','destroy','then','Scheduler','error','stack','name','index','map','Schedule','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','filters','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path'];(function(_0x175abe,_0x205ebe){var _0x2bd805=function(_0x4e93e9){while(--_0x4e93e9){_0x175abe['push'](_0x175abe['shift']());}};_0x2bd805(++_0x205ebe);}(_0xa33f,0xfb));var _0xfa33=function(_0xb4fd1,_0x42375f){_0xb4fd1=_0xb4fd1-0x0;var _0xf69a8c=_0xa33f[_0xb4fd1];return _0xf69a8c;};'use strict';var emlformat=require(_0xfa33('0x0'));var rimraf=require(_0xfa33('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfa33('0x2'));var rp=require(_0xfa33('0x3'));var moment=require(_0xfa33('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfa33('0x5'));var path=require(_0xfa33('0x6'));var sox=require(_0xfa33('0x7'));var csv=require('to-csv');var ejs=require(_0xfa33('0x8'));var fs=require('fs');var fs_extra=require(_0xfa33('0x9'));var _=require(_0xfa33('0xa'));var squel=require(_0xfa33('0xb'));var crypto=require(_0xfa33('0xc'));var jsforce=require(_0xfa33('0xd'));var deskjs=require(_0xfa33('0xe'));var toCsv=require(_0xfa33('0xf'));var querystring=require(_0xfa33('0x10'));var Papa=require(_0xfa33('0x11'));var Redis=require(_0xfa33('0x12'));var authService=require(_0xfa33('0x13'));var qs=require(_0xfa33('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfa33('0x15'));var logger=require(_0xfa33('0x16'))(_0xfa33('0x17'));var utils=require(_0xfa33('0x18'));var config=require(_0xfa33('0x19'));var licenseUtil=require(_0xfa33('0x1a'));var db=require(_0xfa33('0x1b'))['db'];function respondWithStatusCode(_0x13b1ae,_0x230b73){_0x230b73=_0x230b73||0xcc;return function(_0xe4b3ec){if(_0xe4b3ec){return _0x13b1ae[_0xfa33('0x1c')](_0x230b73);}return _0x13b1ae[_0xfa33('0x1d')](_0x230b73)[_0xfa33('0x1e')]();};}function respondWithResult(_0x269518,_0x245d2b){_0x245d2b=_0x245d2b||0xc8;return function(_0x4a5002){if(_0x4a5002){return _0x269518[_0xfa33('0x1d')](_0x245d2b)[_0xfa33('0x1f')](_0x4a5002);}};}function respondWithFilteredResult(_0x45955d,_0x2d14df){return function(_0x6fad0){if(_0x6fad0){var _0x2c5317=typeof _0x2d14df[_0xfa33('0x20')]===_0xfa33('0x21')&&typeof _0x2d14df[_0xfa33('0x22')]===_0xfa33('0x21');var _0x59df54=_0x6fad0[_0xfa33('0x23')];var _0x300632=_0x2c5317?0x0:_0x2d14df['offset'];var _0x29625f=_0x2c5317?_0x6fad0[_0xfa33('0x23')]:_0x2d14df[_0xfa33('0x20')]+_0x2d14df[_0xfa33('0x22')];var _0x3bbb90;if(_0x29625f>=_0x59df54){_0x29625f=_0x59df54;_0x3bbb90=0xc8;}else{_0x3bbb90=0xce;}_0x45955d[_0xfa33('0x1d')](_0x3bbb90);return _0x45955d[_0xfa33('0x24')]('Content-Range',_0x300632+'-'+_0x29625f+'/'+_0x59df54)[_0xfa33('0x1f')](_0x6fad0);}return null;};}function patchUpdates(_0x28ee65){return function(_0x551c15){try{jsonpatch['apply'](_0x551c15,_0x28ee65,!![]);}catch(_0x399916){return BPromise['reject'](_0x399916);}return _0x551c15[_0xfa33('0x25')]();};}function saveUpdates(_0x909fb4,_0x582839){return function(_0x1c7bc3){if(_0x1c7bc3){return _0x1c7bc3[_0xfa33('0x26')](_0x909fb4)['then'](function(_0x4c75f1){return _0x4c75f1;});}return null;};}function removeEntity(_0x377b94,_0x5504a5){return function(_0x58c84c){if(_0x58c84c){return _0x58c84c[_0xfa33('0x27')]()[_0xfa33('0x28')](function(){var _0xe1cad0=_0x58c84c['get']({'plain':!![]});var _0x13bc5c=_0xfa33('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x13bc5c,'resourceId':_0xe1cad0['id']}})['then'](function(){return _0x58c84c;});})[_0xfa33('0x28')](function(){_0x377b94[_0xfa33('0x1d')](0xcc)[_0xfa33('0x1e')]();});}};}function handleEntityNotFound(_0x2e4556,_0x2f7adb){return function(_0x1a39ff){if(!_0x1a39ff){_0x2e4556[_0xfa33('0x1c')](0x194);}return _0x1a39ff;};}function handleError(_0x26b3f5,_0x3f53d4){_0x3f53d4=_0x3f53d4||0x1f4;return function(_0x1c03a9){logger[_0xfa33('0x2a')](_0x1c03a9[_0xfa33('0x2b')]);if(_0x1c03a9[_0xfa33('0x2c')]){delete _0x1c03a9[_0xfa33('0x2c')];}_0x26b3f5[_0xfa33('0x1d')](_0x3f53d4)['send'](_0x1c03a9);};}exports[_0xfa33('0x2d')]=function(_0x192bfa,_0x58f456){var _0x11a9fb={},_0xb74ab5={},_0x2118c8={'count':0x0,'rows':[]};var _0x18ef0a=_[_0xfa33('0x2e')](db[_0xfa33('0x2f')][_0xfa33('0x30')],function(_0x42714d){return{'name':_0x42714d[_0xfa33('0x31')],'type':_0x42714d[_0xfa33('0x32')]['key']};});_0xb74ab5[_0xfa33('0x33')]=_['map'](_0x18ef0a,'name');_0xb74ab5[_0xfa33('0x34')]=_[_0xfa33('0x35')](_0x192bfa[_0xfa33('0x34')]);_0xb74ab5['filters']=_['intersection'](_0xb74ab5['model'],_0xb74ab5[_0xfa33('0x34')]);_0x11a9fb[_0xfa33('0x36')]=_[_0xfa33('0x37')](_0xb74ab5[_0xfa33('0x33')],qs[_0xfa33('0x38')](_0x192bfa[_0xfa33('0x34')]['fields']));_0x11a9fb[_0xfa33('0x36')]=_0x11a9fb['attributes'][_0xfa33('0x39')]?_0x11a9fb[_0xfa33('0x36')]:_0xb74ab5[_0xfa33('0x33')];if(!_0x192bfa[_0xfa33('0x34')][_0xfa33('0x3a')](_0xfa33('0x3b'))){_0x11a9fb[_0xfa33('0x22')]=qs[_0xfa33('0x22')](_0x192bfa[_0xfa33('0x34')][_0xfa33('0x22')]);_0x11a9fb['offset']=qs['offset'](_0x192bfa[_0xfa33('0x34')][_0xfa33('0x20')]);}_0x11a9fb[_0xfa33('0x3c')]=qs['sort'](_0x192bfa[_0xfa33('0x34')]['sort']);_0x11a9fb['where']=qs[_0xfa33('0x3d')](_[_0xfa33('0x3e')](_0x192bfa[_0xfa33('0x34')],_0xb74ab5['filters']),_0x18ef0a);if(_0x192bfa['query'][_0xfa33('0x3f')]){_0x11a9fb[_0xfa33('0x40')]=_[_0xfa33('0x41')](_0x11a9fb[_0xfa33('0x40')],{'$or':_[_0xfa33('0x2e')](_0x18ef0a,function(_0x57a727){if(_0x57a727[_0xfa33('0x32')]!=='VIRTUAL'){var _0x4e75ea={};_0x4e75ea[_0x57a727[_0xfa33('0x2c')]]={'$like':'%'+_0x192bfa['query'][_0xfa33('0x3f')]+'%'};return _0x4e75ea;}})});}_0x11a9fb=_['merge']({},_0x11a9fb,_0x192bfa[_0xfa33('0x42')]);var _0xf1b1fb={'where':_0x11a9fb[_0xfa33('0x40')]};return db[_0xfa33('0x2f')][_0xfa33('0x23')](_0xf1b1fb)[_0xfa33('0x28')](function(_0x179b50){_0x2118c8['count']=_0x179b50;if(_0x192bfa[_0xfa33('0x34')][_0xfa33('0x43')]){_0x11a9fb[_0xfa33('0x44')]=[{'all':!![]}];}return db[_0xfa33('0x2f')][_0xfa33('0x45')](_0x11a9fb);})[_0xfa33('0x28')](function(_0x4ed255){_0x2118c8[_0xfa33('0x46')]=_0x4ed255;return _0x2118c8;})[_0xfa33('0x28')](respondWithFilteredResult(_0x58f456,_0x11a9fb))[_0xfa33('0x47')](handleError(_0x58f456,null));};exports['show']=function(_0x126ee7,_0x573a3d){var _0xb2613a={'raw':![],'where':{'id':_0x126ee7[_0xfa33('0x48')]['id']}},_0x392b67={};_0x392b67[_0xfa33('0x33')]=_[_0xfa33('0x35')](db[_0xfa33('0x2f')][_0xfa33('0x30')]);_0x392b67[_0xfa33('0x34')]=_['keys'](_0x126ee7[_0xfa33('0x34')]);_0x392b67['filters']=_['intersection'](_0x392b67[_0xfa33('0x33')],_0x392b67['query']);_0xb2613a[_0xfa33('0x36')]=_['intersection'](_0x392b67[_0xfa33('0x33')],qs[_0xfa33('0x38')](_0x126ee7[_0xfa33('0x34')][_0xfa33('0x38')]));_0xb2613a['attributes']=_0xb2613a[_0xfa33('0x36')][_0xfa33('0x39')]?_0xb2613a[_0xfa33('0x36')]:_0x392b67[_0xfa33('0x33')];if(_0x126ee7[_0xfa33('0x34')]['includeAll']){_0xb2613a[_0xfa33('0x44')]=[{'all':!![]}];}_0xb2613a=_['merge']({},_0xb2613a,_0x126ee7[_0xfa33('0x42')]);return db[_0xfa33('0x2f')][_0xfa33('0x49')](_0xb2613a)[_0xfa33('0x28')](handleEntityNotFound(_0x573a3d,null))['then'](respondWithResult(_0x573a3d,null))['catch'](handleError(_0x573a3d,null));};exports[_0xfa33('0x4a')]=function(_0x168653,_0x40f507){return db[_0xfa33('0x2f')][_0xfa33('0x4a')](_0x168653[_0xfa33('0x4b')],{})[_0xfa33('0x28')](function(_0x37e637){var _0xbb026c=_0x168653[_0xfa33('0x4c')]['get']({'plain':!![]});if(!_0xbb026c)throw new Error(_0xfa33('0x4d'));if(_0xbb026c[_0xfa33('0x4e')]===_0xfa33('0x4c')){var _0x2f4ec5=_0x37e637[_0xfa33('0x4f')]({'plain':!![]});var _0x223bae=_0xfa33('0x29');return db[_0xfa33('0x50')]['find']({'where':{'name':_0x223bae,'userProfileId':_0xbb026c['userProfileId']},'raw':!![]})[_0xfa33('0x28')](function(_0x2b1969){if(_0x2b1969&&_0x2b1969[_0xfa33('0x51')]===0x0){return db[_0xfa33('0x52')][_0xfa33('0x4a')]({'name':_0x2f4ec5[_0xfa33('0x2c')],'resourceId':_0x2f4ec5['id'],'type':_0x2b1969[_0xfa33('0x2c')],'sectionId':_0x2b1969['id']},{})[_0xfa33('0x28')](function(){return _0x37e637;});}else{return _0x37e637;}})[_0xfa33('0x47')](function(_0x42674f){logger['error'](_0xfa33('0x53'),_0x42674f);throw _0x42674f;});}return _0x37e637;})[_0xfa33('0x28')](respondWithResult(_0x40f507,0xc9))[_0xfa33('0x47')](handleError(_0x40f507,null));};exports[_0xfa33('0x26')]=function(_0x161556,_0x2fda6f){if(_0x161556[_0xfa33('0x4b')]['id']){delete _0x161556['body']['id'];}return db['Schedule'][_0xfa33('0x49')]({'where':{'id':_0x161556[_0xfa33('0x48')]['id']}})['then'](handleEntityNotFound(_0x2fda6f,null))['then'](saveUpdates(_0x161556[_0xfa33('0x4b')],null))[_0xfa33('0x28')](respondWithResult(_0x2fda6f,null))[_0xfa33('0x47')](handleError(_0x2fda6f,null));};exports['destroy']=function(_0x5b35c7,_0x38b70c){return db[_0xfa33('0x2f')]['find']({'where':{'id':_0x5b35c7[_0xfa33('0x48')]['id']}})['then'](handleEntityNotFound(_0x38b70c,null))[_0xfa33('0x28')](removeEntity(_0x38b70c,null))[_0xfa33('0x47')](handleError(_0x38b70c,null));};exports[_0xfa33('0x54')]=function(_0x44375d,_0x1b18ce,_0x56888c){var _0x28b52a=require(_0xfa33('0x55'));return db[_0xfa33('0x2f')][_0xfa33('0x49')]({'where':{'id':_0x44375d[_0xfa33('0x48')]['id']},'raw':!![]})[_0xfa33('0x28')](handleEntityNotFound(_0x1b18ce,null))[_0xfa33('0x28')](function(){_0x28b52a[_0xfa33('0x54')](_0x44375d[_0xfa33('0x48')]['id']);})[_0xfa33('0x28')](respondWithStatusCode(_0x1b18ce,null))['catch'](handleError(_0x1b18ce,null));}; \ No newline at end of file +var _0xe303=['merge','VIRTUAL','options','includeAll','include','findAll','catch','params','rawAttributes','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','run','../../config/schedule','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then','destroy','get','Scheduler','UserProfileResource','end','error','stack','name','send','index','map','Schedule','fieldName','type','query','filters','intersection','model','fields','attributes','nolimit','order','sort','pick','filter','where'];(function(_0x4ed1d4,_0x512d9a){var _0x28e363=function(_0x2bdfb7){while(--_0x2bdfb7){_0x4ed1d4['push'](_0x4ed1d4['shift']());}};_0x28e363(++_0x512d9a);}(_0xe303,0xbc));var _0x3e30=function(_0x40095e,_0x29becf){_0x40095e=_0x40095e-0x0;var _0x1a10ec=_0xe303[_0x40095e];return _0x1a10ec;};'use strict';var emlformat=require(_0x3e30('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3e30('0x1'));var rp=require('request-promise');var moment=require(_0x3e30('0x2'));var BPromise=require(_0x3e30('0x3'));var Mustache=require(_0x3e30('0x4'));var util=require(_0x3e30('0x5'));var path=require(_0x3e30('0x6'));var sox=require(_0x3e30('0x7'));var csv=require(_0x3e30('0x8'));var ejs=require(_0x3e30('0x9'));var fs=require('fs');var fs_extra=require(_0x3e30('0xa'));var _=require(_0x3e30('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3e30('0xc'));var deskjs=require(_0x3e30('0xd'));var toCsv=require(_0x3e30('0x8'));var querystring=require(_0x3e30('0xe'));var Papa=require('papaparse');var Redis=require(_0x3e30('0xf'));var authService=require(_0x3e30('0x10'));var qs=require(_0x3e30('0x11'));var as=require(_0x3e30('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3e30('0x13'))(_0x3e30('0x14'));var utils=require(_0x3e30('0x15'));var config=require(_0x3e30('0x16'));var licenseUtil=require(_0x3e30('0x17'));var db=require(_0x3e30('0x18'))['db'];function respondWithStatusCode(_0x41b1a7,_0x4d5888){_0x4d5888=_0x4d5888||0xcc;return function(_0x3fd8e1){if(_0x3fd8e1){return _0x41b1a7[_0x3e30('0x19')](_0x4d5888);}return _0x41b1a7['status'](_0x4d5888)['end']();};}function respondWithResult(_0x1061a9,_0xdfab7d){_0xdfab7d=_0xdfab7d||0xc8;return function(_0x6e4306){if(_0x6e4306){return _0x1061a9[_0x3e30('0x1a')](_0xdfab7d)['json'](_0x6e4306);}};}function respondWithFilteredResult(_0x4c75fc,_0x31f12d){return function(_0x376eb4){if(_0x376eb4){var _0x204128=typeof _0x31f12d['offset']===_0x3e30('0x1b')&&typeof _0x31f12d[_0x3e30('0x1c')]===_0x3e30('0x1b');var _0xb4fc71=_0x376eb4[_0x3e30('0x1d')];var _0x595114=_0x204128?0x0:_0x31f12d['offset'];var _0x5c0487=_0x204128?_0x376eb4['count']:_0x31f12d[_0x3e30('0x1e')]+_0x31f12d['limit'];var _0x2c0ea9;if(_0x5c0487>=_0xb4fc71){_0x5c0487=_0xb4fc71;_0x2c0ea9=0xc8;}else{_0x2c0ea9=0xce;}_0x4c75fc['status'](_0x2c0ea9);return _0x4c75fc[_0x3e30('0x1f')](_0x3e30('0x20'),_0x595114+'-'+_0x5c0487+'/'+_0xb4fc71)[_0x3e30('0x21')](_0x376eb4);}return null;};}function patchUpdates(_0x5e72af){return function(_0x4e3d05){try{jsonpatch[_0x3e30('0x22')](_0x4e3d05,_0x5e72af,!![]);}catch(_0x3afc87){return BPromise['reject'](_0x3afc87);}return _0x4e3d05[_0x3e30('0x23')]();};}function saveUpdates(_0x2dab1b,_0x2c86d0){return function(_0x3dee45){if(_0x3dee45){return _0x3dee45[_0x3e30('0x24')](_0x2dab1b)[_0x3e30('0x25')](function(_0x31c4db){return _0x31c4db;});}return null;};}function removeEntity(_0x6533de,_0x4be91e){return function(_0x10b403){if(_0x10b403){return _0x10b403[_0x3e30('0x26')]()[_0x3e30('0x25')](function(){var _0x5f0381=_0x10b403[_0x3e30('0x27')]({'plain':!![]});var _0x2ec2b4=_0x3e30('0x28');return db[_0x3e30('0x29')]['destroy']({'where':{'type':_0x2ec2b4,'resourceId':_0x5f0381['id']}})[_0x3e30('0x25')](function(){return _0x10b403;});})[_0x3e30('0x25')](function(){_0x6533de[_0x3e30('0x1a')](0xcc)[_0x3e30('0x2a')]();});}};}function handleEntityNotFound(_0x400473,_0x17bd6d){return function(_0x511186){if(!_0x511186){_0x400473[_0x3e30('0x19')](0x194);}return _0x511186;};}function handleError(_0x4cef26,_0x502c62){_0x502c62=_0x502c62||0x1f4;return function(_0x2a8658){logger[_0x3e30('0x2b')](_0x2a8658[_0x3e30('0x2c')]);if(_0x2a8658['name']){delete _0x2a8658[_0x3e30('0x2d')];}_0x4cef26[_0x3e30('0x1a')](_0x502c62)[_0x3e30('0x2e')](_0x2a8658);};}exports[_0x3e30('0x2f')]=function(_0x4cd16c,_0x1a4b69){var _0x2d0024={},_0x3b45e4={},_0xa533d5={'count':0x0,'rows':[]};var _0x50203b=_[_0x3e30('0x30')](db[_0x3e30('0x31')]['rawAttributes'],function(_0x359a38){return{'name':_0x359a38[_0x3e30('0x32')],'type':_0x359a38[_0x3e30('0x33')]['key']};});_0x3b45e4['model']=_[_0x3e30('0x30')](_0x50203b,_0x3e30('0x2d'));_0x3b45e4['query']=_['keys'](_0x4cd16c[_0x3e30('0x34')]);_0x3b45e4[_0x3e30('0x35')]=_[_0x3e30('0x36')](_0x3b45e4[_0x3e30('0x37')],_0x3b45e4[_0x3e30('0x34')]);_0x2d0024['attributes']=_[_0x3e30('0x36')](_0x3b45e4[_0x3e30('0x37')],qs[_0x3e30('0x38')](_0x4cd16c[_0x3e30('0x34')][_0x3e30('0x38')]));_0x2d0024[_0x3e30('0x39')]=_0x2d0024[_0x3e30('0x39')]['length']?_0x2d0024[_0x3e30('0x39')]:_0x3b45e4[_0x3e30('0x37')];if(!_0x4cd16c[_0x3e30('0x34')]['hasOwnProperty'](_0x3e30('0x3a'))){_0x2d0024[_0x3e30('0x1c')]=qs[_0x3e30('0x1c')](_0x4cd16c[_0x3e30('0x34')][_0x3e30('0x1c')]);_0x2d0024[_0x3e30('0x1e')]=qs[_0x3e30('0x1e')](_0x4cd16c['query'][_0x3e30('0x1e')]);}_0x2d0024[_0x3e30('0x3b')]=qs[_0x3e30('0x3c')](_0x4cd16c[_0x3e30('0x34')][_0x3e30('0x3c')]);_0x2d0024['where']=qs[_0x3e30('0x35')](_[_0x3e30('0x3d')](_0x4cd16c['query'],_0x3b45e4['filters']),_0x50203b);if(_0x4cd16c[_0x3e30('0x34')][_0x3e30('0x3e')]){_0x2d0024[_0x3e30('0x3f')]=_[_0x3e30('0x40')](_0x2d0024['where'],{'$or':_[_0x3e30('0x30')](_0x50203b,function(_0x2a6e15){if(_0x2a6e15[_0x3e30('0x33')]!==_0x3e30('0x41')){var _0xf55b8c={};_0xf55b8c[_0x2a6e15[_0x3e30('0x2d')]]={'$like':'%'+_0x4cd16c[_0x3e30('0x34')][_0x3e30('0x3e')]+'%'};return _0xf55b8c;}})});}_0x2d0024=_['merge']({},_0x2d0024,_0x4cd16c[_0x3e30('0x42')]);var _0x3f13b0={'where':_0x2d0024[_0x3e30('0x3f')]};return db[_0x3e30('0x31')]['count'](_0x3f13b0)['then'](function(_0x35dd30){_0xa533d5['count']=_0x35dd30;if(_0x4cd16c[_0x3e30('0x34')][_0x3e30('0x43')]){_0x2d0024[_0x3e30('0x44')]=[{'all':!![]}];}return db[_0x3e30('0x31')][_0x3e30('0x45')](_0x2d0024);})[_0x3e30('0x25')](function(_0xe62769){_0xa533d5['rows']=_0xe62769;return _0xa533d5;})[_0x3e30('0x25')](respondWithFilteredResult(_0x1a4b69,_0x2d0024))[_0x3e30('0x46')](handleError(_0x1a4b69,null));};exports['show']=function(_0x1d944a,_0x1a0bd6){var _0x3b2f9a={'raw':![],'where':{'id':_0x1d944a[_0x3e30('0x47')]['id']}},_0x4dfbaf={};_0x4dfbaf[_0x3e30('0x37')]=_['keys'](db[_0x3e30('0x31')][_0x3e30('0x48')]);_0x4dfbaf[_0x3e30('0x34')]=_['keys'](_0x1d944a[_0x3e30('0x34')]);_0x4dfbaf[_0x3e30('0x35')]=_[_0x3e30('0x36')](_0x4dfbaf[_0x3e30('0x37')],_0x4dfbaf[_0x3e30('0x34')]);_0x3b2f9a[_0x3e30('0x39')]=_[_0x3e30('0x36')](_0x4dfbaf[_0x3e30('0x37')],qs[_0x3e30('0x38')](_0x1d944a[_0x3e30('0x34')][_0x3e30('0x38')]));_0x3b2f9a[_0x3e30('0x39')]=_0x3b2f9a[_0x3e30('0x39')][_0x3e30('0x49')]?_0x3b2f9a['attributes']:_0x4dfbaf['model'];if(_0x1d944a[_0x3e30('0x34')][_0x3e30('0x43')]){_0x3b2f9a[_0x3e30('0x44')]=[{'all':!![]}];}_0x3b2f9a=_[_0x3e30('0x40')]({},_0x3b2f9a,_0x1d944a['options']);return db[_0x3e30('0x31')]['find'](_0x3b2f9a)['then'](handleEntityNotFound(_0x1a0bd6,null))[_0x3e30('0x25')](respondWithResult(_0x1a0bd6,null))[_0x3e30('0x46')](handleError(_0x1a0bd6,null));};exports[_0x3e30('0x4a')]=function(_0x46264c,_0x1c16e1){return db['Schedule'][_0x3e30('0x4a')](_0x46264c[_0x3e30('0x4b')],{})['then'](function(_0x4f181d){var _0x57dfe1=_0x46264c[_0x3e30('0x4c')][_0x3e30('0x27')]({'plain':!![]});if(!_0x57dfe1)throw new Error(_0x3e30('0x4d'));if(_0x57dfe1[_0x3e30('0x4e')]==='user'){var _0x2bb5db=_0x4f181d[_0x3e30('0x27')]({'plain':!![]});var _0x19e061='Scheduler';return db['UserProfileSection']['find']({'where':{'name':_0x19e061,'userProfileId':_0x57dfe1[_0x3e30('0x4f')]},'raw':!![]})[_0x3e30('0x25')](function(_0x2c31da){if(_0x2c31da&&_0x2c31da['autoAssociation']===0x0){return db[_0x3e30('0x29')][_0x3e30('0x4a')]({'name':_0x2bb5db[_0x3e30('0x2d')],'resourceId':_0x2bb5db['id'],'type':_0x2c31da[_0x3e30('0x2d')],'sectionId':_0x2c31da['id']},{})[_0x3e30('0x25')](function(){return _0x4f181d;});}else{return _0x4f181d;}})[_0x3e30('0x46')](function(_0x1800c1){logger[_0x3e30('0x2b')](_0x3e30('0x50'),_0x1800c1);throw _0x1800c1;});}return _0x4f181d;})[_0x3e30('0x25')](respondWithResult(_0x1c16e1,0xc9))[_0x3e30('0x46')](handleError(_0x1c16e1,null));};exports[_0x3e30('0x24')]=function(_0xd8b69e,_0x309e4f){if(_0xd8b69e[_0x3e30('0x4b')]['id']){delete _0xd8b69e[_0x3e30('0x4b')]['id'];}return db['Schedule'][_0x3e30('0x51')]({'where':{'id':_0xd8b69e['params']['id']}})[_0x3e30('0x25')](handleEntityNotFound(_0x309e4f,null))['then'](saveUpdates(_0xd8b69e[_0x3e30('0x4b')],null))[_0x3e30('0x25')](respondWithResult(_0x309e4f,null))['catch'](handleError(_0x309e4f,null));};exports['destroy']=function(_0x74ac53,_0x1e0ad3){return db[_0x3e30('0x31')][_0x3e30('0x51')]({'where':{'id':_0x74ac53['params']['id']}})[_0x3e30('0x25')](handleEntityNotFound(_0x1e0ad3,null))['then'](removeEntity(_0x1e0ad3,null))['catch'](handleError(_0x1e0ad3,null));};exports[_0x3e30('0x52')]=function(_0x448de5,_0x3709bb,_0x3ace72){var _0x2096a4=require(_0x3e30('0x53'));return db[_0x3e30('0x31')][_0x3e30('0x51')]({'where':{'id':_0x448de5[_0x3e30('0x47')]['id']},'raw':!![]})[_0x3e30('0x25')](handleEntityNotFound(_0x3709bb,null))[_0x3e30('0x25')](function(){_0x2096a4[_0x3e30('0x52')](_0x448de5[_0x3e30('0x47')]['id']);})[_0x3e30('0x25')](respondWithStatusCode(_0x3709bb,null))[_0x3e30('0x46')](handleError(_0x3709bb,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 5f39ca5..e351870 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 _0x1134=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','define','Schedule','tools_schedules'];(function(_0x47bd60,_0x22f024){var _0x523729=function(_0x9b333a){while(--_0x9b333a){_0x47bd60['push'](_0x47bd60['shift']());}};_0x523729(++_0x22f024);}(_0x1134,0x8f));var _0x4113=function(_0x269282,_0x202e94){_0x269282=_0x269282-0x0;var _0x366654=_0x1134[_0x269282];return _0x366654;};'use strict';var _=require('lodash');var util=require(_0x4113('0x0'));var logger=require(_0x4113('0x1'))(_0x4113('0x2'));var moment=require(_0x4113('0x3'));var BPromise=require(_0x4113('0x4'));var rp=require(_0x4113('0x5'));var fs=require('fs');var path=require(_0x4113('0x6'));var rimraf=require(_0x4113('0x7'));var config=require(_0x4113('0x8'));var attributes=require(_0x4113('0x9'));module['exports']=function(_0x583b75,_0xd76955){return _0x583b75[_0x4113('0xa')](_0x4113('0xb'),attributes,{'tableName':_0x4113('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5574=['../../config/logger','moment','path','rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash'];(function(_0x5eec39,_0x2e7a82){var _0xf1f7c4=function(_0x1e5c89){while(--_0x1e5c89){_0x5eec39['push'](_0x5eec39['shift']());}};_0xf1f7c4(++_0x2e7a82);}(_0x5574,0x83));var _0x4557=function(_0x558073,_0x1be920){_0x558073=_0x558073-0x0;var _0x40de47=_0x5574[_0x558073];return _0x40de47;};'use strict';var _=require(_0x4557('0x0'));var util=require('util');var logger=require(_0x4557('0x1'))('api');var moment=require(_0x4557('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4557('0x3'));var rimraf=require(_0x4557('0x4'));var config=require(_0x4557('0x5'));var attributes=require(_0x4557('0x6'));module[_0x4557('0x7')]=function(_0x49c9de,_0x1947f4){return _0x49c9de[_0x4557('0x8')](_0x4557('0x9'),attributes,{'tableName':_0x4557('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 e170af2..06e1aa8 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 _0x9d27=['jayson/promise','client','http','request','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4020bf,_0x4fa223){var _0x49bf21=function(_0x1656d4){while(--_0x1656d4){_0x4020bf['push'](_0x4020bf['shift']());}};_0x49bf21(++_0x4fa223);}(_0x9d27,0x16e));var _0x79d2=function(_0x17b47d,_0x3136fb){_0x17b47d=_0x17b47d-0x0;var _0x3c643e=_0x9d27[_0x17b47d];return _0x3c643e;};'use strict';var _=require(_0x79d2('0x0'));var util=require(_0x79d2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x79d2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x79d2('0x3'))['db'];var utils=require(_0x79d2('0x4'));var logger=require(_0x79d2('0x5'))(_0x79d2('0x6'));var config=require(_0x79d2('0x7'));var jayson=require(_0x79d2('0x8'));var client=jayson[_0x79d2('0x9')][_0x79d2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x490099,_0x315a18,_0x509b86){return new BPromise(function(_0x105a67,_0x17722b){return client[_0x79d2('0xb')](_0x490099,_0x509b86)['then'](function(_0xd71750){logger[_0x79d2('0xc')](_0x79d2('0xd'),_0x315a18,_0x79d2('0xe'));logger[_0x79d2('0xf')](_0x79d2('0x10'),_0x315a18,_0x79d2('0xe'),JSON[_0x79d2('0x11')](_0xd71750));if(_0xd71750[_0x79d2('0x12')]){if(_0xd71750[_0x79d2('0x12')]['code']===0x1f4){logger['error'](_0x79d2('0xd'),_0x315a18,_0xd71750[_0x79d2('0x12')]['message']);return _0x17722b(_0xd71750[_0x79d2('0x12')][_0x79d2('0x13')]);}logger[_0x79d2('0x12')](_0x79d2('0xd'),_0x315a18,_0xd71750['error'][_0x79d2('0x13')]);return _0x105a67(_0xd71750[_0x79d2('0x12')][_0x79d2('0x13')]);}else{logger[_0x79d2('0xc')](_0x79d2('0xd'),_0x315a18,_0x79d2('0xe'));_0x105a67(_0xd71750[_0x79d2('0x14')][_0x79d2('0x13')]);}})[_0x79d2('0x15')](function(_0x5480b4){logger[_0x79d2('0x12')](_0x79d2('0xd'),_0x315a18,_0x5480b4);_0x17722b(_0x5480b4);});});} \ No newline at end of file +var _0xc288=['request','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http'];(function(_0x5bc859,_0x2d02e2){var _0xe55d0f=function(_0x3b6346){while(--_0x3b6346){_0x5bc859['push'](_0x5bc859['shift']());}};_0xe55d0f(++_0x2d02e2);}(_0xc288,0x15a));var _0x8c28=function(_0x50eb66,_0x3febdf){_0x50eb66=_0x50eb66-0x0;var _0x3a95c0=_0xc288[_0x50eb66];return _0x3a95c0;};'use strict';var _=require(_0x8c28('0x0'));var util=require(_0x8c28('0x1'));var moment=require(_0x8c28('0x2'));var BPromise=require(_0x8c28('0x3'));var rs=require(_0x8c28('0x4'));var fs=require('fs');var Redis=require(_0x8c28('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8c28('0x6'));var logger=require(_0x8c28('0x7'))(_0x8c28('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8c28('0x9')][_0x8c28('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8c596,_0x46b156,_0x5e2570){return new BPromise(function(_0x54e3ca,_0x5a70ce){return client[_0x8c28('0xb')](_0x8c596,_0x5e2570)['then'](function(_0x728be){logger['info'](_0x8c28('0xc'),_0x46b156,_0x8c28('0xd'));logger['debug'](_0x8c28('0xe'),_0x46b156,_0x8c28('0xd'),JSON[_0x8c28('0xf')](_0x728be));if(_0x728be[_0x8c28('0x10')]){if(_0x728be[_0x8c28('0x10')][_0x8c28('0x11')]===0x1f4){logger[_0x8c28('0x10')](_0x8c28('0xc'),_0x46b156,_0x728be[_0x8c28('0x10')][_0x8c28('0x12')]);return _0x5a70ce(_0x728be['error'][_0x8c28('0x12')]);}logger[_0x8c28('0x10')](_0x8c28('0xc'),_0x46b156,_0x728be[_0x8c28('0x10')][_0x8c28('0x12')]);return _0x54e3ca(_0x728be[_0x8c28('0x10')][_0x8c28('0x12')]);}else{logger[_0x8c28('0x13')](_0x8c28('0xc'),_0x46b156,_0x8c28('0xd'));_0x54e3ca(_0x728be['result'][_0x8c28('0x12')]);}})[_0x8c28('0x14')](function(_0x45256c){logger[_0x8c28('0x10')](_0x8c28('0xc'),_0x46b156,_0x45256c);_0x5a70ce(_0x45256c);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index ba802b9..6ee0ec5 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 _0x9425=['/:id/download','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./screenRecording.controller','isAuthenticated','get','/describe','describe','/:id','show'];(function(_0x5700ae,_0x1388b9){var _0x3a7e1e=function(_0x42eaef){while(--_0x42eaef){_0x5700ae['push'](_0x5700ae['shift']());}};_0x3a7e1e(++_0x1388b9);}(_0x9425,0x91));var _0x5942=function(_0x57f9a6,_0x474e88){_0x57f9a6=_0x57f9a6-0x0;var _0x436487=_0x9425[_0x57f9a6];return _0x436487;};'use strict';var multer=require('multer');var util=require(_0x5942('0x0'));var path=require(_0x5942('0x1'));var timeout=require(_0x5942('0x2'));var express=require(_0x5942('0x3'));var router=express[_0x5942('0x4')]();var fs_extra=require(_0x5942('0x5'));var auth=require(_0x5942('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5942('0x7'));var controller=require(_0x5942('0x8'));router['get']('/',auth[_0x5942('0x9')](),controller['index']);router[_0x5942('0xa')](_0x5942('0xb'),auth[_0x5942('0x9')](),controller[_0x5942('0xc')]);router['get'](_0x5942('0xd'),auth[_0x5942('0x9')](),controller[_0x5942('0xe')]);router[_0x5942('0xa')](_0x5942('0xf'),auth[_0x5942('0x9')](),controller['download']);router['post']('/',auth[_0x5942('0x9')](),controller['create']);router[_0x5942('0x10')](_0x5942('0xd'),auth[_0x5942('0x9')](),controller[_0x5942('0x11')]);router[_0x5942('0x12')](_0x5942('0xd'),auth[_0x5942('0x9')](),controller[_0x5942('0x13')]);module['exports']=router; \ No newline at end of file +var _0xe310=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./screenRecording.controller','get','index','/describe','isAuthenticated','describe','show','/:id/download','download','post','create','/:id','delete','destroy'];(function(_0x572b09,_0x55f9f5){var _0x21720c=function(_0x23ab89){while(--_0x23ab89){_0x572b09['push'](_0x572b09['shift']());}};_0x21720c(++_0x55f9f5);}(_0xe310,0x143));var _0x0e31=function(_0x1f8964,_0x324f49){_0x1f8964=_0x1f8964-0x0;var _0x28d0d1=_0xe310[_0x1f8964];return _0x28d0d1;};'use strict';var multer=require(_0x0e31('0x0'));var util=require('util');var path=require(_0x0e31('0x1'));var timeout=require(_0x0e31('0x2'));var express=require(_0x0e31('0x3'));var router=express[_0x0e31('0x4')]();var fs_extra=require(_0x0e31('0x5'));var auth=require(_0x0e31('0x6'));var interaction=require(_0x0e31('0x7'));var config=require('../../config/environment');var controller=require(_0x0e31('0x8'));router[_0x0e31('0x9')]('/',auth['isAuthenticated'](),controller[_0x0e31('0xa')]);router['get'](_0x0e31('0xb'),auth[_0x0e31('0xc')](),controller[_0x0e31('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x0e31('0xe')]);router[_0x0e31('0x9')](_0x0e31('0xf'),auth[_0x0e31('0xc')](),controller[_0x0e31('0x10')]);router[_0x0e31('0x11')]('/',auth['isAuthenticated'](),controller[_0x0e31('0x12')]);router['put'](_0x0e31('0x13'),auth[_0x0e31('0xc')](),controller['update']);router[_0x0e31('0x14')](_0x0e31('0x13'),auth[_0x0e31('0xc')](),controller[_0x0e31('0x15')]);module[_0x0e31('0x16')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 3a75e24..28fd980 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 _0xb5fa=['DATE','MM-DD-YYYY\x20HH:mm','toString','format','createdAt','updatedAt','sequelize','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','INTEGER','setDataValue','subtract','closedAt','duration'];(function(_0x3822ab,_0x4a4dd2){var _0x5e4d2c=function(_0xab8e45){while(--_0xab8e45){_0x3822ab['push'](_0x3822ab['shift']());}};_0x5e4d2c(++_0x4a4dd2);}(_0xb5fa,0xf8));var _0xab5f=function(_0x548f5d,_0x3b4c43){_0x548f5d=_0x548f5d-0x0;var _0x40e907=_0xb5fa[_0x548f5d];return _0x40e907;};'use strict';var Sequelize=require(_0xab5f('0x0'));var moment=require(_0xab5f('0x1'));var path=require(_0xab5f('0x2'));var config=require(_0xab5f('0x3'));module[_0xab5f('0x4')]={'format':{'type':Sequelize[_0xab5f('0x5')],'get':function(){return this[_0xab5f('0x6')](_0xab5f('0x7'))?path[_0xab5f('0x8')](this[_0xab5f('0x6')](_0xab5f('0x7'))):undefined;}},'interactionid':{'type':Sequelize[_0xab5f('0x9')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize['STRING'],'set':function(_0x489cd2){var _0x1e5941=_0x489cd2[_0xab5f('0xa')](/\\/g,'/');this['setDataValue'](_0xab5f('0x7'),_0x1e5941);}},'rating':{'type':Sequelize[_0xab5f('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xab5f('0xb')],'set':function(_0x177190){this[_0xab5f('0xc')]('startedAt',moment()[_0xab5f('0xd')](_0x177190,'ms'));this['setDataValue'](_0xab5f('0xe'),moment());this['setDataValue'](_0xab5f('0xf'),_0x177190);}},'startedAt':{'type':Sequelize[_0xab5f('0x10')],'get':function(){return moment(this['getDataValue']('startedAt'))['format'](_0xab5f('0x11'))[_0xab5f('0x12')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xab5f('0x6')](_0xab5f('0xe')))[_0xab5f('0x13')](_0xab5f('0x11'))[_0xab5f('0x12')]();}},'createdAt':{'type':Sequelize[_0xab5f('0x10')],'get':function(){return moment(this[_0xab5f('0x6')](_0xab5f('0x14')))[_0xab5f('0x13')](_0xab5f('0x11'))[_0xab5f('0x12')]();}},'updatedAt':{'type':Sequelize[_0xab5f('0x10')],'get':function(){return moment(this[_0xab5f('0x6')](_0xab5f('0x15')))[_0xab5f('0x13')](_0xab5f('0x11'))[_0xab5f('0x12')]();}}}; \ No newline at end of file +var _0xbbbc=['format','toString','closedAt','createdAt','updatedAt','MM-DD-YYYY\x20HH:mm','sequelize','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','extname','value','STRING','replace','setDataValue','INTEGER','DATE'];(function(_0x57b248,_0x2d5053){var _0x3a55f5=function(_0x145403){while(--_0x145403){_0x57b248['push'](_0x57b248['shift']());}};_0x3a55f5(++_0x2d5053);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x293e39,_0x34315f){_0x293e39=_0x293e39-0x0;var _0x118450=_0xbbbc[_0x293e39];return _0x118450;};'use strict';var Sequelize=require(_0xcbbb('0x0'));var moment=require(_0xcbbb('0x1'));var path=require(_0xcbbb('0x2'));var config=require(_0xcbbb('0x3'));module[_0xcbbb('0x4')]={'format':{'type':Sequelize[_0xcbbb('0x5')],'get':function(){return this[_0xcbbb('0x6')]('value')?path[_0xcbbb('0x7')](this[_0xcbbb('0x6')](_0xcbbb('0x8'))):undefined;}},'interactionid':{'type':Sequelize[_0xcbbb('0x9')]},'channel':{'type':Sequelize[_0xcbbb('0x9')]},'value':{'type':Sequelize['STRING'],'set':function(_0x388197){var _0x1796b4=_0x388197[_0xcbbb('0xa')](/\\/g,'/');this[_0xcbbb('0xb')](_0xcbbb('0x8'),_0x1796b4);}},'rating':{'type':Sequelize[_0xcbbb('0xc')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xcbbb('0xc')],'set':function(_0x4ec90a){this[_0xcbbb('0xb')]('startedAt',moment()['subtract'](_0x4ec90a,'ms'));this[_0xcbbb('0xb')]('closedAt',moment());this[_0xcbbb('0xb')]('duration',_0x4ec90a);}},'startedAt':{'type':Sequelize[_0xcbbb('0xd')],'get':function(){return moment(this[_0xcbbb('0x6')]('startedAt'))[_0xcbbb('0xe')]('MM-DD-YYYY\x20HH:mm')[_0xcbbb('0xf')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xcbbb('0x6')](_0xcbbb('0x10')))[_0xcbbb('0xe')]('MM-DD-YYYY\x20HH:mm')[_0xcbbb('0xf')]();}},'createdAt':{'type':Sequelize[_0xcbbb('0xd')],'get':function(){return moment(this[_0xcbbb('0x6')](_0xcbbb('0x11')))['format']('MM-DD-YYYY\x20HH:mm')[_0xcbbb('0xf')]();}},'updatedAt':{'type':Sequelize[_0xcbbb('0xd')],'get':function(){return moment(this[_0xcbbb('0x6')](_0xcbbb('0x12')))['format'](_0xcbbb('0x13'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 309f20b..610140f 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 _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(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x46ed,0x168));var _0xd46e=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x46ed[_0x199572];return _0x13cfa3;};'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 +var _0x9957=['sort','pick','filter','where','merge','map','VIRTUAL','options','ScreenRecording','includeAll','include','catch','show','rawAttributes','find','create','body','duration','closedAt','params','describe','download','uniqueid','value','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','Sequelize','filename','extname','unlink','message','ScreenRecording\x20not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','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','index','fieldName','type','key','model','differenceBy','format','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order'];(function(_0x554d5b,_0x3f3389){var _0x41f81d=function(_0x5781d2){while(--_0x5781d2){_0x554d5b['push'](_0x554d5b['shift']());}};_0x41f81d(++_0x3f3389);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ScreenRecording']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_['map'](_0x4253e5,'name'),[_0x7995('0x31')]);_0x456a28['query']=_[_0x7995('0x32')](_0x4b6f99[_0x7995('0x33')]);_0x456a28[_0x7995('0x34')]=_[_0x7995('0x35')](_0x456a28[_0x7995('0x2f')],_0x456a28['query']);_0x514445[_0x7995('0x36')]=_[_0x7995('0x35')](_0x456a28['model'],qs['fields'](_0x4b6f99['query'][_0x7995('0x37')]));_0x514445[_0x7995('0x36')]=_0x514445['attributes'][_0x7995('0x38')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99[_0x7995('0x33')][_0x7995('0x39')]('nolimit')){_0x514445['limit']=qs[_0x7995('0x21')](_0x4b6f99['query']['limit']);_0x514445[_0x7995('0x20')]=qs[_0x7995('0x20')](_0x4b6f99['query'][_0x7995('0x20')]);}_0x514445[_0x7995('0x3a')]=qs[_0x7995('0x3b')](_0x4b6f99[_0x7995('0x33')][_0x7995('0x3b')]);_0x514445['where']=qs[_0x7995('0x34')](_[_0x7995('0x3c')](_0x4b6f99[_0x7995('0x33')],_0x456a28[_0x7995('0x34')]),_0x4253e5);if(_0x4b6f99['query'][_0x7995('0x3d')]){_0x514445[_0x7995('0x3e')]=_[_0x7995('0x3f')](_0x514445[_0x7995('0x3e')],{'$or':_[_0x7995('0x40')](_0x4253e5,function(_0x1035dc){if(_0x1035dc['type']!==_0x7995('0x41')){var _0x3be298={};_0x3be298[_0x1035dc[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x33')][_0x7995('0x3d')]+'%'};return _0x3be298;}})});}_0x514445=_[_0x7995('0x3f')]({},_0x514445,_0x4b6f99[_0x7995('0x42')]);var _0x270c0e={'where':_0x514445[_0x7995('0x3e')]};return db[_0x7995('0x43')][_0x7995('0x1f')](_0x270c0e)[_0x7995('0x26')](function(_0x7b4e67){_0x3250e0['count']=_0x7b4e67;if(_0x4b6f99['query'][_0x7995('0x44')]){_0x514445[_0x7995('0x45')]=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x514445);})[_0x7995('0x26')](function(_0x4a9fef){_0x3250e0['rows']=_0x4a9fef;return _0x3250e0;})[_0x7995('0x26')](respondWithFilteredResult(_0x9b2a15,_0x514445))[_0x7995('0x46')](handleError(_0x9b2a15,null));};exports[_0x7995('0x47')]=function(_0x576b96,_0x46ac4f){var _0x5e85b9={'raw':![],'where':{'id':_0x576b96['params']['id']}},_0x3993b5={};_0x3993b5['model']=_[_0x7995('0x32')](db[_0x7995('0x43')][_0x7995('0x48')]);_0x3993b5[_0x7995('0x33')]=_['keys'](_0x576b96[_0x7995('0x33')]);_0x3993b5[_0x7995('0x34')]=_[_0x7995('0x35')](_0x3993b5[_0x7995('0x2f')],_0x3993b5['query']);_0x5e85b9['attributes']=_[_0x7995('0x35')](_0x3993b5['model'],qs[_0x7995('0x37')](_0x576b96['query'][_0x7995('0x37')]));_0x5e85b9['attributes']=_0x5e85b9[_0x7995('0x36')][_0x7995('0x38')]?_0x5e85b9['attributes']:_0x3993b5[_0x7995('0x2f')];if(_0x576b96[_0x7995('0x33')][_0x7995('0x44')]){_0x5e85b9[_0x7995('0x45')]=[{'all':!![]}];}_0x5e85b9=_['merge']({},_0x5e85b9,_0x576b96[_0x7995('0x42')]);return db[_0x7995('0x43')][_0x7995('0x49')](_0x5e85b9)['then'](handleEntityNotFound(_0x46ac4f,null))[_0x7995('0x26')](respondWithResult(_0x46ac4f,null))[_0x7995('0x46')](handleError(_0x46ac4f,null));};exports[_0x7995('0x4a')]=function(_0x3d8ae3,_0x255313){return db['ScreenRecording'][_0x7995('0x4a')](_0x3d8ae3[_0x7995('0x4b')],{})['then'](respondWithResult(_0x255313,0xc9))[_0x7995('0x46')](handleError(_0x255313,null));};exports['update']=function(_0x1d87f9,_0x187735){if(_0x1d87f9[_0x7995('0x4b')]['id']){delete _0x1d87f9[_0x7995('0x4b')]['id'];}delete _0x1d87f9[_0x7995('0x4b')][_0x7995('0x4c')];delete _0x1d87f9[_0x7995('0x4b')]['createdAt'];delete _0x1d87f9[_0x7995('0x4b')][_0x7995('0x4d')];delete _0x1d87f9[_0x7995('0x4b')]['value'];return db[_0x7995('0x43')][_0x7995('0x49')]({'where':{'id':_0x1d87f9[_0x7995('0x4e')]['id']}})['then'](handleEntityNotFound(_0x187735,null))['then'](saveUpdates(_0x1d87f9['body'],null))[_0x7995('0x26')](respondWithResult(_0x187735,null))[_0x7995('0x46')](handleError(_0x187735,null));};exports['describe']=function(_0x1cd85,_0x29f300){return db[_0x7995('0x43')][_0x7995('0x4f')]()[_0x7995('0x26')](respondWithResult(_0x29f300,null))['catch'](handleError(_0x29f300,null));};exports[_0x7995('0x50')]=function(_0x4ab09f,_0x14fe7f,_0x33c801){var _0x206d2a=require('../../components/encryptor');var _0x5e1f34=![];var _0x54e2b1={};if(_0x4ab09f['query'][_0x7995('0x2d')]&&_0x4ab09f[_0x7995('0x33')][_0x7995('0x2d')]===_0x7995('0x51')){_0x54e2b1[_0x7995('0x51')]=_0x4ab09f[_0x7995('0x4e')]['id'];}else{_0x54e2b1['id']=_0x4ab09f[_0x7995('0x4e')]['id'];}return db[_0x7995('0x43')][_0x7995('0x49')]({'where':_0x54e2b1,'attributes':['id',_0x7995('0x52')],'raw':!![]})[_0x7995('0x26')](handleEntityNotFound(_0x14fe7f,null))[_0x7995('0x26')](function(_0x3da72b){if(_0x3da72b){var _0x35bea3=path[_0x7995('0x53')](config[_0x7995('0x54')],_0x7995('0x55'),_0x3da72b[_0x7995('0x52')]);var _0x45e86e=util['format'](_0x7995('0x56'),_0x35bea3);if(fs[_0x7995('0x57')](_0x45e86e)){_0x5e1f34=!![];return _0x206d2a[_0x7995('0x58')](_0x45e86e,_0x35bea3,config[_0x7995('0x59')]['recording'])['then'](function(){return _0x3da72b;});}return _0x3da72b;}})[_0x7995('0x26')](function(_0x197b52){if(_0x197b52){var _0x5b9467=path[_0x7995('0x53')](config['root'],_0x7995('0x55'),_0x197b52[_0x7995('0x52')]);if(!fs[_0x7995('0x57')](_0x5b9467)){throw new db[(_0x7995('0x5a'))]['ValidationError']('ScreenRecording\x20not\x20found');}if(_0x197b52[_0x7995('0x5b')]){return _0x14fe7f[_0x7995('0x50')](_0x5b9467,_0x197b52[_0x7995('0x5b')]+path[_0x7995('0x5c')](_0x5b9467),function(){if(_0x5e1f34){fs[_0x7995('0x5d')](_0x5b9467);}});}else{return _0x14fe7f[_0x7995('0x50')](_0x5b9467,function(_0x1d4689){if(_0x5e1f34){fs[_0x7995('0x5d')](_0x5b9467);}});}}})[_0x7995('0x46')](function(_0x50caf5){if(_0x50caf5[_0x7995('0x5e')]===_0x7995('0x5f')){_0x14fe7f[_0x7995('0x1c')](0x194)[_0x7995('0x2a')]('Not\x20found');}else{return handleError(_0x14fe7f,null);}});};exports['destroy']=function(_0x3053fd,_0xebb5c8){return db['ScreenRecording'][_0x7995('0x49')]({'where':{'id':_0x3053fd[_0x7995('0x4e')]['id']}})[_0x7995('0x26')](function(_0x57727e){if(_[_0x7995('0x60')](_0x57727e)){throw new ReferenceError('Entity\x20not\x20found');}return _0x57727e;})[_0x7995('0x26')](function(_0x564fca){var _0x3e0a46=path[_0x7995('0x53')](config[_0x7995('0x54')],_0x7995('0x55'),_0x564fca[_0x7995('0x52')]);logger[_0x7995('0x61')](_0x7995('0x62'),_0x3e0a46);if(!_[_0x7995('0x60')](_0x564fca[_0x7995('0x52')])&&fs[_0x7995('0x57')](_0x3e0a46)){logger[_0x7995('0x61')](_0x7995('0x63')+_0x3e0a46+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x7995('0x64')](_0x3e0a46);}_0x3e0a46=_0x3e0a46+_0x7995('0x65');if(!_[_0x7995('0x60')](_0x564fca[_0x7995('0x52')])&&fs[_0x7995('0x57')](_0x3e0a46)){logger['info']('File:\x20\x22'+_0x3e0a46+_0x7995('0x66'));fs[_0x7995('0x64')](_0x3e0a46);}return _0x564fca;})[_0x7995('0x26')](function(_0xae6166){if(!_0xae6166)throw new InternalError();return _0xae6166['destroy']();})[_0x7995('0x26')](function(){_0xebb5c8['status'](0xcc)['end']();})[_0x7995('0x46')](handleError(_0xebb5c8,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 0bcf70d..5efe0e8 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 _0x0e80=['rimraf','./screenRecording.attributes','exports','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xd0f423,_0x18dd7f){var _0x50f469=function(_0x185921){while(--_0x185921){_0xd0f423['push'](_0xd0f423['shift']());}};_0x50f469(++_0x18dd7f);}(_0x0e80,0x172));var _0x00e8=function(_0x1fc89c,_0x50c6f9){_0x1fc89c=_0x1fc89c-0x0;var _0x23533d=_0x0e80[_0x1fc89c];return _0x23533d;};'use strict';var _=require(_0x00e8('0x0'));var util=require(_0x00e8('0x1'));var logger=require(_0x00e8('0x2'))(_0x00e8('0x3'));var moment=require(_0x00e8('0x4'));var BPromise=require(_0x00e8('0x5'));var rp=require(_0x00e8('0x6'));var fs=require('fs');var path=require(_0x00e8('0x7'));var rimraf=require(_0x00e8('0x8'));var config=require('../../config/environment');var attributes=require(_0x00e8('0x9'));module[_0x00e8('0xa')]=function(_0x2d42d6,_0x3af631){return _0x2d42d6['define'](_0x00e8('0xb'),attributes,{'tableName':_0x00e8('0xc'),'paranoid':![],'indexes':[{'name':_0x00e8('0xd'),'fields':[_0x00e8('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa23d=['exports','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./screenRecording.attributes'];(function(_0x234ce7,_0x3e909c){var _0x57c561=function(_0x8ac1bb){while(--_0x8ac1bb){_0x234ce7['push'](_0x234ce7['shift']());}};_0x57c561(++_0x3e909c);}(_0xa23d,0xd4));var _0xda23=function(_0x26b060,_0x2d06c2){_0x26b060=_0x26b060-0x0;var _0x5383db=_0xa23d[_0x26b060];return _0x5383db;};'use strict';var _=require(_0xda23('0x0'));var util=require(_0xda23('0x1'));var logger=require(_0xda23('0x2'))(_0xda23('0x3'));var moment=require(_0xda23('0x4'));var BPromise=require(_0xda23('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xda23('0x6'));var rimraf=require('rimraf');var config=require(_0xda23('0x7'));var attributes=require(_0xda23('0x8'));module[_0xda23('0x9')]=function(_0x250194,_0x13c054){return _0x250194['define'](_0xda23('0xa'),attributes,{'tableName':_0xda23('0xb'),'paranoid':![],'indexes':[{'name':_0xda23('0xc'),'fields':[_0xda23('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index e3f5e97..88f8a2e 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 _0xe997=['message','result','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','ScreenRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x190323,_0x4e67dd){var _0x1f0899=function(_0x72e018){while(--_0x72e018){_0x190323['push'](_0x190323['shift']());}};_0x1f0899(++_0x4e67dd);}(_0xe997,0x8e));var _0x7e99=function(_0x6420ed,_0x1c652b){_0x6420ed=_0x6420ed-0x0;var _0x244d3a=_0xe997[_0x6420ed];return _0x244d3a;};'use strict';var _=require(_0x7e99('0x0'));var util=require(_0x7e99('0x1'));var moment=require('moment');var BPromise=require(_0x7e99('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7e99('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7e99('0x4'));var logger=require(_0x7e99('0x5'))(_0x7e99('0x6'));var config=require('../../config/environment');var jayson=require(_0x7e99('0x7'));var client=jayson[_0x7e99('0x8')][_0x7e99('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x306408,_0x30a140,_0x375d32){return new BPromise(function(_0x1e29e7,_0x5d5b55){return client[_0x7e99('0xa')](_0x306408,_0x375d32)[_0x7e99('0xb')](function(_0x2a263d){logger[_0x7e99('0xc')](_0x7e99('0xd'),_0x30a140,'request\x20sent');logger['debug'](_0x7e99('0xe'),_0x30a140,_0x7e99('0xf'),JSON[_0x7e99('0x10')](_0x2a263d));if(_0x2a263d[_0x7e99('0x11')]){if(_0x2a263d[_0x7e99('0x11')]['code']===0x1f4){logger[_0x7e99('0x11')](_0x7e99('0xd'),_0x30a140,_0x2a263d['error'][_0x7e99('0x12')]);return _0x5d5b55(_0x2a263d[_0x7e99('0x11')]['message']);}logger[_0x7e99('0x11')](_0x7e99('0xd'),_0x30a140,_0x2a263d[_0x7e99('0x11')][_0x7e99('0x12')]);return _0x1e29e7(_0x2a263d[_0x7e99('0x11')][_0x7e99('0x12')]);}else{logger[_0x7e99('0xc')](_0x7e99('0xd'),_0x30a140,_0x7e99('0xf'));_0x1e29e7(_0x2a263d[_0x7e99('0x13')]['message']);}})['catch'](function(_0x1c3da7){logger[_0x7e99('0x11')](_0x7e99('0xd'),_0x30a140,_0x1c3da7);_0x5d5b55(_0x1c3da7);});});} \ No newline at end of file +var _0x10ae=['code','ScreenRecording,\x20%s,\x20%s','message','info','catch','lodash','util','moment','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error'];(function(_0x5a967f,_0xc5ba10){var _0x33f9a9=function(_0x32f346){while(--_0x32f346){_0x5a967f['push'](_0x5a967f['shift']());}};_0x33f9a9(++_0xc5ba10);}(_0x10ae,0x11d));var _0xe10a=function(_0x521e69,_0x215349){_0x521e69=_0x521e69-0x0;var _0x549413=_0x10ae[_0x521e69];return _0x549413;};'use strict';var _=require(_0xe10a('0x0'));var util=require(_0xe10a('0x1'));var moment=require(_0xe10a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe10a('0x3'));var logger=require('../../config/logger')(_0xe10a('0x4'));var config=require(_0xe10a('0x5'));var jayson=require(_0xe10a('0x6'));var client=jayson[_0xe10a('0x7')][_0xe10a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4a223e,_0x33aa96,_0x39c067){return new BPromise(function(_0x2ca331,_0x1c9380){return client[_0xe10a('0x9')](_0x4a223e,_0x39c067)[_0xe10a('0xa')](function(_0x134cb7){logger['info']('ScreenRecording,\x20%s,\x20%s',_0x33aa96,_0xe10a('0xb'));logger[_0xe10a('0xc')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x33aa96,_0xe10a('0xb'),JSON[_0xe10a('0xd')](_0x134cb7));if(_0x134cb7[_0xe10a('0xe')]){if(_0x134cb7[_0xe10a('0xe')][_0xe10a('0xf')]===0x1f4){logger['error'](_0xe10a('0x10'),_0x33aa96,_0x134cb7[_0xe10a('0xe')]['message']);return _0x1c9380(_0x134cb7['error'][_0xe10a('0x11')]);}logger['error'](_0xe10a('0x10'),_0x33aa96,_0x134cb7[_0xe10a('0xe')][_0xe10a('0x11')]);return _0x2ca331(_0x134cb7[_0xe10a('0xe')][_0xe10a('0x11')]);}else{logger[_0xe10a('0x12')](_0xe10a('0x10'),_0x33aa96,_0xe10a('0xb'));_0x2ca331(_0x134cb7['result'][_0xe10a('0x11')]);}})[_0xe10a('0x13')](function(_0x201357){logger[_0xe10a('0xe')](_0xe10a('0x10'),_0x33aa96,_0x201357);_0x1c9380(_0x201357);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index b6b17db..3aa7890 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 _0xc282=['root','logologin','post','addLogoLogin','preferred','/:id/preferred','addPreferred','favicon','addFavicon','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./setting.controller','index','get','getDate','show','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','getPreferred','/:id/favicon','getFavicon','diskStorage','join','server/files/images/logos/','format','%s%s','extname','originalname','single','file','addLogo'];(function(_0x2b0cc5,_0x357db5){var _0x48dac6=function(_0x2eacd5){while(--_0x2eacd5){_0x2b0cc5['push'](_0x2b0cc5['shift']());}};_0x48dac6(++_0x357db5);}(_0xc282,0x139));var _0x2c28=function(_0x1afd42,_0x45613a){_0x1afd42=_0x1afd42-0x0;var _0x41d885=_0xc282[_0x1afd42];return _0x41d885;};'use strict';var multer=require(_0x2c28('0x0'));var util=require(_0x2c28('0x1'));var path=require(_0x2c28('0x2'));var timeout=require(_0x2c28('0x3'));var express=require(_0x2c28('0x4'));var router=express[_0x2c28('0x5')]();var fs_extra=require(_0x2c28('0x6'));var auth=require(_0x2c28('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x2c28('0x8'));var controller=require(_0x2c28('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x2c28('0xa')]);router[_0x2c28('0xb')]('/now',controller[_0x2c28('0xc')]);router['get']('/:id',controller[_0x2c28('0xd')]);router['get'](_0x2c28('0xe'),controller['getLogo']);router['get'](_0x2c28('0xf'),controller[_0x2c28('0x10')]);router[_0x2c28('0xb')](_0x2c28('0x11'),controller['gdpr']);router[_0x2c28('0xb')]('/:id/preferred',controller[_0x2c28('0x12')]);router[_0x2c28('0xb')](_0x2c28('0x13'),controller[_0x2c28('0x14')]);var upload=multer({'storage':multer[_0x2c28('0x15')]({'destination':function(_0x482f03,_0x34c564,_0x2b339e){_0x2b339e(null,path[_0x2c28('0x16')](config['root'],_0x2c28('0x17')));},'filename':function(_0x14099c,_0x1aa40a,_0x4b3feb){_0x4b3feb(null,util[_0x2c28('0x18')](_0x2c28('0x19'),'logo',path[_0x2c28('0x1a')](_0x1aa40a[_0x2c28('0x1b')])));}})});router['post'](_0x2c28('0xe'),upload[_0x2c28('0x1c')](_0x2c28('0x1d')),controller[_0x2c28('0x1e')]);var upload=multer({'storage':multer[_0x2c28('0x15')]({'destination':function(_0x1e7e94,_0x535372,_0xefc3f7){_0xefc3f7(null,path[_0x2c28('0x16')](config[_0x2c28('0x1f')],_0x2c28('0x17')));},'filename':function(_0x5d1bd4,_0x552a28,_0x2b6543){_0x2b6543(null,util[_0x2c28('0x18')](_0x2c28('0x19'),_0x2c28('0x20'),path['extname'](_0x552a28[_0x2c28('0x1b')])));}})});router[_0x2c28('0x21')](_0x2c28('0xf'),upload[_0x2c28('0x1c')]('file'),controller[_0x2c28('0x22')]);var upload=multer({'storage':multer[_0x2c28('0x15')]({'destination':function(_0x46bd80,_0x4be112,_0x129d94){_0x129d94(null,path['join'](config[_0x2c28('0x1f')],_0x2c28('0x17')));},'filename':function(_0x427c15,_0x43c41d,_0x39e040){_0x39e040(null,util[_0x2c28('0x18')]('%s%s',_0x2c28('0x23'),path[_0x2c28('0x1a')](_0x43c41d[_0x2c28('0x1b')])));}})});router[_0x2c28('0x21')](_0x2c28('0x24'),upload['single'](_0x2c28('0x1d')),controller[_0x2c28('0x25')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x520a01,_0x66aa44,_0xb4c8b5){_0xb4c8b5(null,path[_0x2c28('0x16')](config['root'],'server/files/images/logos/'));},'filename':function(_0x5f2567,_0x1a934b,_0x287339){_0x287339(null,util[_0x2c28('0x18')](_0x2c28('0x19'),_0x2c28('0x26'),path[_0x2c28('0x1a')](_0x1a934b[_0x2c28('0x1b')])));}})});router[_0x2c28('0x21')](_0x2c28('0x13'),upload[_0x2c28('0x1c')](_0x2c28('0x1d')),controller[_0x2c28('0x27')]);router[_0x2c28('0x28')]('/:id',auth['isAuthenticated'](),controller[_0x2c28('0x29')]);module[_0x2c28('0x2a')]=router; \ No newline at end of file +var _0x3a1c=['root','server/files/images/logos/','format','%s%s','logo','extname','single','file','addLogo','logologin','originalname','post','addPreferred','put','isAuthenticated','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./setting.controller','get','index','/now','getDate','/:id','show','getLogo','/:id/logo_login','/:id/gdpr','gdpr','/:id/preferred','/:id/favicon','getFavicon','diskStorage','join'];(function(_0x2d2416,_0x32d65d){var _0x46aba2=function(_0x5bbb2c){while(--_0x5bbb2c){_0x2d2416['push'](_0x2d2416['shift']());}};_0x46aba2(++_0x32d65d);}(_0x3a1c,0x182));var _0xc3a1=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0x3a1c[_0x5cb1af];return _0x8d7940;};'use strict';var multer=require(_0xc3a1('0x0'));var util=require(_0xc3a1('0x1'));var path=require('path');var timeout=require(_0xc3a1('0x2'));var express=require(_0xc3a1('0x3'));var router=express[_0xc3a1('0x4')]();var fs_extra=require(_0xc3a1('0x5'));var auth=require(_0xc3a1('0x6'));var interaction=require(_0xc3a1('0x7'));var config=require('../../config/environment');var controller=require(_0xc3a1('0x8'));router[_0xc3a1('0x9')]('/',auth['isAuthenticated'](),controller[_0xc3a1('0xa')]);router[_0xc3a1('0x9')](_0xc3a1('0xb'),controller[_0xc3a1('0xc')]);router[_0xc3a1('0x9')](_0xc3a1('0xd'),controller[_0xc3a1('0xe')]);router[_0xc3a1('0x9')]('/:id/logo',controller[_0xc3a1('0xf')]);router[_0xc3a1('0x9')](_0xc3a1('0x10'),controller['getLogoLogin']);router['get'](_0xc3a1('0x11'),controller[_0xc3a1('0x12')]);router[_0xc3a1('0x9')](_0xc3a1('0x13'),controller['getPreferred']);router[_0xc3a1('0x9')](_0xc3a1('0x14'),controller[_0xc3a1('0x15')]);var upload=multer({'storage':multer[_0xc3a1('0x16')]({'destination':function(_0x1132c9,_0x325c80,_0x1be9e0){_0x1be9e0(null,path[_0xc3a1('0x17')](config[_0xc3a1('0x18')],_0xc3a1('0x19')));},'filename':function(_0x177814,_0x33a54c,_0x5699db){_0x5699db(null,util[_0xc3a1('0x1a')](_0xc3a1('0x1b'),_0xc3a1('0x1c'),path[_0xc3a1('0x1d')](_0x33a54c['originalname'])));}})});router['post']('/:id/logo',upload[_0xc3a1('0x1e')](_0xc3a1('0x1f')),controller[_0xc3a1('0x20')]);var upload=multer({'storage':multer[_0xc3a1('0x16')]({'destination':function(_0x2517e7,_0x4884b3,_0x56a34d){_0x56a34d(null,path[_0xc3a1('0x17')](config['root'],_0xc3a1('0x19')));},'filename':function(_0x522f3c,_0x48686d,_0x50b4e6){_0x50b4e6(null,util[_0xc3a1('0x1a')](_0xc3a1('0x1b'),_0xc3a1('0x21'),path[_0xc3a1('0x1d')](_0x48686d[_0xc3a1('0x22')])));}})});router[_0xc3a1('0x23')](_0xc3a1('0x10'),upload[_0xc3a1('0x1e')]('file'),controller['addLogoLogin']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4534a7,_0x466e70,_0x2f014b){_0x2f014b(null,path[_0xc3a1('0x17')](config[_0xc3a1('0x18')],'server/files/images/logos/'));},'filename':function(_0x258882,_0x50d8b2,_0x2d1e70){_0x2d1e70(null,util['format'](_0xc3a1('0x1b'),'preferred',path[_0xc3a1('0x1d')](_0x50d8b2[_0xc3a1('0x22')])));}})});router[_0xc3a1('0x23')](_0xc3a1('0x13'),upload['single'](_0xc3a1('0x1f')),controller[_0xc3a1('0x24')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x132620,_0x3259fc,_0x37d92d){_0x37d92d(null,path[_0xc3a1('0x17')](config[_0xc3a1('0x18')],_0xc3a1('0x19')));},'filename':function(_0x2defe3,_0x1abe18,_0x4a997b){_0x4a997b(null,util['format'](_0xc3a1('0x1b'),'favicon',path[_0xc3a1('0x1d')](_0x1abe18[_0xc3a1('0x22')])));}})});router['post'](_0xc3a1('0x14'),upload['single'](_0xc3a1('0x1f')),controller['addFavicon']);router[_0xc3a1('0x25')](_0xc3a1('0xd'),auth[_0xc3a1('0x26')](),controller[_0xc3a1('0x27')]);module[_0xc3a1('0x28')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 8a4fa27..e2b3c73 100644 --- a/server/api/setting/setting.attributes.js +++ b/server/api/setting/setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x3ca1e6,_0x1f1d8c){var _0x16760b=function(_0x243836){while(--_0x243836){_0x3ca1e6['push'](_0x3ca1e6['shift']());}};_0x16760b(++_0x1f1d8c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x14f3c7,_0x3e52b0){var _0x428fae=function(_0x4f1af9){while(--_0x4f1af9){_0x14f3c7['push'](_0x14f3c7['shift']());}};_0x428fae(++_0x3e52b0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 9873707..a65d1f7 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 _0x5ebe=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','info','request\x20sent','result','catch','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','destroy','then','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','include','Setting','findAll','params','find','body','file','logo','filename','loginLogo','server/files/images/logos','getLicense','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','join','root','toLower','default_logo.svg','custom','existsSync','Sequelize','upperFirst','download','getLogoLogin','default_loginLogo.svg','default','addPreferred','preferred','getPreferred','default_preferred.png','\x20not\x20found','addFavicon','getFavicon','default_favicon.ico','ValidationError','getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0xdb5b68,_0x1303ee){var _0x5a441d=function(_0xa01d04){while(--_0xa01d04){_0xdb5b68['push'](_0xdb5b68['shift']());}};_0x5a441d(++_0x1303ee);}(_0x5ebe,0x69));var _0xe5eb=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5ebe[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe5eb('0x0'));var zipdir=require(_0xe5eb('0x1'));var jsonpatch=require(_0xe5eb('0x2'));var rp=require(_0xe5eb('0x3'));var moment=require(_0xe5eb('0x4'));var BPromise=require(_0xe5eb('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe5eb('0x6'));var sox=require(_0xe5eb('0x7'));var csv=require(_0xe5eb('0x8'));var ejs=require(_0xe5eb('0x9'));var fs=require('fs');var fs_extra=require(_0xe5eb('0xa'));var _=require(_0xe5eb('0xb'));var squel=require(_0xe5eb('0xc'));var crypto=require(_0xe5eb('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe5eb('0xe'));var Redis=require('ioredis');var authService=require(_0xe5eb('0xf'));var qs=require(_0xe5eb('0x10'));var as=require(_0xe5eb('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe5eb('0x12'))(_0xe5eb('0x13'));var utils=require(_0xe5eb('0x14'));var config=require(_0xe5eb('0x15'));var licenseUtil=require(_0xe5eb('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0xe5eb('0x17'));var client=jayson[_0xe5eb('0x18')][_0xe5eb('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x53fda0,_0x4c32d1,_0x28e90c,_0xe91be9){return new BPromise(function(_0x22e644,_0x531940){var _0x40ae36=_0xe91be9||client;return _0x40ae36[_0xe5eb('0x1a')](_0x53fda0,_0x28e90c)['then'](function(_0x425747){logger['info']('Setting,\x20%s,\x20%s',_0x4c32d1,'request\x20sent');logger[_0xe5eb('0x1b')](_0xe5eb('0x1c'),_0x4c32d1,'request\x20sent',JSON[_0xe5eb('0x1d')](_0x425747));if(_0x425747['error']){if(_0x425747[_0xe5eb('0x1e')][_0xe5eb('0x1f')]===0x1f4){logger[_0xe5eb('0x1e')](_0xe5eb('0x20'),_0x4c32d1,_0x425747['error'][_0xe5eb('0x21')]);return _0x531940(_0x425747[_0xe5eb('0x1e')][_0xe5eb('0x21')]);}logger[_0xe5eb('0x1e')](_0xe5eb('0x20'),_0x4c32d1,_0x425747[_0xe5eb('0x1e')][_0xe5eb('0x21')]);return _0x22e644(_0x425747['error']['message']);}else{logger[_0xe5eb('0x22')]('Setting,\x20%s,\x20%s',_0x4c32d1,_0xe5eb('0x23'));_0x22e644(_0x425747[_0xe5eb('0x24')]['message']);}})[_0xe5eb('0x25')](function(_0x3e49a4){logger[_0xe5eb('0x1e')]('Setting,\x20%s,\x20%s',_0x4c32d1,_0x3e49a4);_0x531940(_0x3e49a4);});});}function respondWithStatusCode(_0x1cb938,_0x430836){_0x430836=_0x430836||0xcc;return function(_0x41fda4){if(_0x41fda4){return _0x1cb938['sendStatus'](_0x430836);}return _0x1cb938[_0xe5eb('0x26')](_0x430836)[_0xe5eb('0x27')]();};}function respondWithResult(_0x5d5348,_0x2cd698){_0x2cd698=_0x2cd698||0xc8;return function(_0x3c7e15){if(_0x3c7e15){return _0x5d5348[_0xe5eb('0x26')](_0x2cd698)['json'](_0x3c7e15);}};}function respondWithFilteredResult(_0x52b62e,_0x1bc160){return function(_0x40ecb1){if(_0x40ecb1){var _0x1234c6=typeof _0x1bc160[_0xe5eb('0x28')]==='undefined'&&typeof _0x1bc160[_0xe5eb('0x29')]===_0xe5eb('0x2a');var _0x137350=_0x40ecb1[_0xe5eb('0x2b')];var _0x49cb02=_0x1234c6?0x0:_0x1bc160['offset'];var _0x4ff77a=_0x1234c6?_0x40ecb1[_0xe5eb('0x2b')]:_0x1bc160['offset']+_0x1bc160[_0xe5eb('0x29')];var _0x225010;if(_0x4ff77a>=_0x137350){_0x4ff77a=_0x137350;_0x225010=0xc8;}else{_0x225010=0xce;}_0x52b62e['status'](_0x225010);return _0x52b62e[_0xe5eb('0x2c')](_0xe5eb('0x2d'),_0x49cb02+'-'+_0x4ff77a+'/'+_0x137350)[_0xe5eb('0x2e')](_0x40ecb1);}return null;};}function patchUpdates(_0x56c5bc){return function(_0x39b546){try{jsonpatch[_0xe5eb('0x2f')](_0x39b546,_0x56c5bc,!![]);}catch(_0x398938){return BPromise['reject'](_0x398938);}return _0x39b546[_0xe5eb('0x30')]();};}function saveUpdates(_0x439148,_0x32f5a5){return function(_0xd9a667){if(_0xd9a667){return _0xd9a667[_0xe5eb('0x31')](_0x439148)['then'](function(_0x5aa9f8){return _0x5aa9f8;});}return null;};}function removeEntity(_0x4db989,_0x36db77){return function(_0x1e51ce){if(_0x1e51ce){return _0x1e51ce[_0xe5eb('0x32')]()[_0xe5eb('0x33')](function(){_0x4db989[_0xe5eb('0x26')](0xcc)[_0xe5eb('0x27')]();});}};}function handleEntityNotFound(_0x344310,_0x5ad3f7){return function(_0x56eaa4){if(!_0x56eaa4){_0x344310['sendStatus'](0x194);}return _0x56eaa4;};}function handleError(_0x5654b2,_0x2ac7e4){_0x2ac7e4=_0x2ac7e4||0x1f4;return function(_0x56d6f8){logger[_0xe5eb('0x1e')](_0x56d6f8[_0xe5eb('0x34')]);if(_0x56d6f8[_0xe5eb('0x35')]){delete _0x56d6f8['name'];}_0x5654b2[_0xe5eb('0x26')](_0x2ac7e4)[_0xe5eb('0x36')](_0x56d6f8);};}exports[_0xe5eb('0x37')]=function(_0x50eb30,_0x635b21){var _0x21f91b={},_0x4b749c={},_0x4e9113={'count':0x0,'rows':[]};var _0x5e87c7=_[_0xe5eb('0x38')](db['Setting'][_0xe5eb('0x39')],function(_0x37f19e){return{'name':_0x37f19e[_0xe5eb('0x3a')],'type':_0x37f19e['type'][_0xe5eb('0x3b')]};});_0x4b749c[_0xe5eb('0x3c')]=_['map'](_0x5e87c7,_0xe5eb('0x35'));_0x4b749c[_0xe5eb('0x3d')]=_[_0xe5eb('0x3e')](_0x50eb30[_0xe5eb('0x3d')]);_0x4b749c['filters']=_[_0xe5eb('0x3f')](_0x4b749c[_0xe5eb('0x3c')],_0x4b749c[_0xe5eb('0x3d')]);_0x21f91b[_0xe5eb('0x40')]=_[_0xe5eb('0x3f')](_0x4b749c[_0xe5eb('0x3c')],qs[_0xe5eb('0x41')](_0x50eb30[_0xe5eb('0x3d')]['fields']));_0x21f91b[_0xe5eb('0x40')]=_0x21f91b['attributes'][_0xe5eb('0x42')]?_0x21f91b[_0xe5eb('0x40')]:_0x4b749c[_0xe5eb('0x3c')];if(!_0x50eb30[_0xe5eb('0x3d')][_0xe5eb('0x43')](_0xe5eb('0x44'))){_0x21f91b[_0xe5eb('0x29')]=qs[_0xe5eb('0x29')](_0x50eb30['query'][_0xe5eb('0x29')]);_0x21f91b[_0xe5eb('0x28')]=qs[_0xe5eb('0x28')](_0x50eb30[_0xe5eb('0x3d')]['offset']);}_0x21f91b[_0xe5eb('0x45')]=qs[_0xe5eb('0x46')](_0x50eb30[_0xe5eb('0x3d')][_0xe5eb('0x46')]);_0x21f91b[_0xe5eb('0x47')]=qs['filters'](_[_0xe5eb('0x48')](_0x50eb30[_0xe5eb('0x3d')],_0x4b749c[_0xe5eb('0x49')]),_0x5e87c7);if(_0x50eb30[_0xe5eb('0x3d')][_0xe5eb('0x4a')]){_0x21f91b[_0xe5eb('0x47')]=_[_0xe5eb('0x4b')](_0x21f91b[_0xe5eb('0x47')],{'$or':_[_0xe5eb('0x38')](_0x5e87c7,function(_0x1be3fc){if(_0x1be3fc[_0xe5eb('0x4c')]!==_0xe5eb('0x4d')){var _0x2a72cf={};_0x2a72cf[_0x1be3fc[_0xe5eb('0x35')]]={'$like':'%'+_0x50eb30['query']['filter']+'%'};return _0x2a72cf;}})});}_0x21f91b=_[_0xe5eb('0x4b')]({},_0x21f91b,_0x50eb30[_0xe5eb('0x4e')]);var _0x403490={'where':_0x21f91b[_0xe5eb('0x47')]};return db['Setting']['count'](_0x403490)[_0xe5eb('0x33')](function(_0x2e3e39){_0x4e9113['count']=_0x2e3e39;if(_0x50eb30[_0xe5eb('0x3d')][_0xe5eb('0x4f')]){_0x21f91b[_0xe5eb('0x50')]=[{'all':!![]}];}return db[_0xe5eb('0x51')][_0xe5eb('0x52')](_0x21f91b);})['then'](function(_0x36a2b6){_0x4e9113['rows']=_0x36a2b6;return _0x4e9113;})[_0xe5eb('0x33')](respondWithFilteredResult(_0x635b21,_0x21f91b))[_0xe5eb('0x25')](handleError(_0x635b21,null));};exports['show']=function(_0x51e2e1,_0x39b523){var _0x306830={'raw':![],'where':{'id':_0x51e2e1[_0xe5eb('0x53')]['id']}},_0x32ee6e={};_0x32ee6e[_0xe5eb('0x3c')]=_[_0xe5eb('0x3e')](db[_0xe5eb('0x51')][_0xe5eb('0x39')]);_0x32ee6e['query']=_['keys'](_0x51e2e1[_0xe5eb('0x3d')]);_0x32ee6e[_0xe5eb('0x49')]=_['intersection'](_0x32ee6e[_0xe5eb('0x3c')],_0x32ee6e[_0xe5eb('0x3d')]);_0x306830['attributes']=_[_0xe5eb('0x3f')](_0x32ee6e[_0xe5eb('0x3c')],qs[_0xe5eb('0x41')](_0x51e2e1[_0xe5eb('0x3d')][_0xe5eb('0x41')]));_0x306830[_0xe5eb('0x40')]=_0x306830[_0xe5eb('0x40')][_0xe5eb('0x42')]?_0x306830[_0xe5eb('0x40')]:_0x32ee6e[_0xe5eb('0x3c')];if(_0x51e2e1[_0xe5eb('0x3d')]['includeAll']){_0x306830[_0xe5eb('0x50')]=[{'all':!![]}];}_0x306830=_[_0xe5eb('0x4b')]({},_0x306830,_0x51e2e1[_0xe5eb('0x4e')]);return db[_0xe5eb('0x51')][_0xe5eb('0x54')](_0x306830)[_0xe5eb('0x33')](handleEntityNotFound(_0x39b523,null))[_0xe5eb('0x33')](respondWithResult(_0x39b523,null))[_0xe5eb('0x25')](handleError(_0x39b523,null));};exports[_0xe5eb('0x31')]=function(_0x115eb7,_0x6e8a1b){if(_0x115eb7[_0xe5eb('0x55')]['id']){delete _0x115eb7['body']['id'];}return db[_0xe5eb('0x51')]['find']({'where':{'id':_0x115eb7['params']['id']}})[_0xe5eb('0x33')](handleEntityNotFound(_0x6e8a1b,null))[_0xe5eb('0x33')](saveUpdates(_0x115eb7[_0xe5eb('0x55')],null))[_0xe5eb('0x33')](respondWithResult(_0x6e8a1b,null))[_0xe5eb('0x25')](handleError(_0x6e8a1b,null));};exports['addLogo']=function(_0x38fb49,_0x22c2bf,_0x23a029){if(_0x38fb49[_0xe5eb('0x56')]&&_0x38fb49['file']['filename']){_0x38fb49[_0xe5eb('0x55')][_0xe5eb('0x57')]=_0x38fb49[_0xe5eb('0x56')][_0xe5eb('0x58')];}return db[_0xe5eb('0x51')][_0xe5eb('0x54')]({'where':{'id':_0x38fb49['params']['id']}})[_0xe5eb('0x33')](handleEntityNotFound(_0x22c2bf,null))[_0xe5eb('0x33')](saveUpdates(_0x38fb49[_0xe5eb('0x55')],null))['then'](respondWithResult(_0x22c2bf,null))[_0xe5eb('0x25')](handleError(_0x22c2bf,null));};exports['addLogoLogin']=function(_0x434a29,_0x29bd69,_0x2cc5d0){if(_0x434a29['file']&&_0x434a29[_0xe5eb('0x56')][_0xe5eb('0x58')]){_0x434a29[_0xe5eb('0x55')][_0xe5eb('0x59')]=_0x434a29[_0xe5eb('0x56')][_0xe5eb('0x58')];}return db[_0xe5eb('0x51')][_0xe5eb('0x54')]({'where':{'id':_0x434a29[_0xe5eb('0x53')]['id']}})[_0xe5eb('0x33')](handleEntityNotFound(_0x29bd69,null))[_0xe5eb('0x33')](saveUpdates(_0x434a29[_0xe5eb('0x55')],null))[_0xe5eb('0x33')](respondWithResult(_0x29bd69,null))[_0xe5eb('0x25')](handleError(_0x29bd69,null));};var utilLicense=require('../../config/license/util');exports['getLogo']=function(_0x22e831,_0x3e86f6,_0x305b0e){var _0x354122=_0xe5eb('0x5a');var _0x2ea551={'custom':![]};return utilLicense[_0xe5eb('0x5b')]()[_0xe5eb('0x33')](function(_0x41ac4a){if(_0x41ac4a){_0x2ea551=_0x41ac4a;}return db[_0xe5eb('0x51')][_0xe5eb('0x54')]({'where':{'id':_0x22e831[_0xe5eb('0x53')]['id']},'attributes':[_0xe5eb('0x57'),_0xe5eb('0x59'),'preferred',_0xe5eb('0x5c'),_0xe5eb('0x5d'),_0xe5eb('0x5e'),_0xe5eb('0x5f'),_0xe5eb('0x60')],'raw':!![]});})['then'](handleEntityNotFound(_0x3e86f6,null))[_0xe5eb('0x33')](function(_0x38363){if(_0x38363){var _0x347871=_0x38363[_0xe5eb('0x57')]&&fs['existsSync'](path[_0xe5eb('0x61')](config[_0xe5eb('0x62')],_0x354122,_[_0xe5eb('0x63')](_0x38363[_0xe5eb('0x57')])))?path[_0xe5eb('0x61')](config[_0xe5eb('0x62')],_0x354122,_[_0xe5eb('0x63')](_0x38363['logo'])):path[_0xe5eb('0x61')](config[_0xe5eb('0x62')],_0x354122,_[_0xe5eb('0x63')](_0xe5eb('0x64')));var _0x3c055c='default'+_['upperFirst'](_0xe5eb('0x57'));if(_0x38363[_0x3c055c]||!_0x2ea551[_0xe5eb('0x65')]){_0x347871=path[_0xe5eb('0x61')](config[_0xe5eb('0x62')],_0x354122,_[_0xe5eb('0x63')]('default_logo.svg'));}if(!fs[_0xe5eb('0x66')](_0x347871)){throw new db[(_0xe5eb('0x67'))]['ValidationError'](_[_0xe5eb('0x68')](_0xe5eb('0x57'))+'\x20not\x20found');}return _0x3e86f6[_0xe5eb('0x69')](_0x347871);}})['catch'](handleError(_0x3e86f6,null));};var utilLicense=require('../../config/license/util');exports[_0xe5eb('0x6a')]=function(_0x18604b,_0x391881,_0x1803e3){var _0x58d00f=_0xe5eb('0x5a');var _0x51ff8c={'custom':![]};return utilLicense[_0xe5eb('0x5b')]()['then'](function(_0x3ee7e5){if(_0x3ee7e5){_0x51ff8c=_0x3ee7e5;}return db[_0xe5eb('0x51')][_0xe5eb('0x54')]({'where':{'id':_0x18604b[_0xe5eb('0x53')]['id']},'attributes':[_0xe5eb('0x57'),_0xe5eb('0x59'),'preferred','favicon','defaultLogo','defaultLoginLogo',_0xe5eb('0x5f'),_0xe5eb('0x60')],'raw':!![]});})[_0xe5eb('0x33')](handleEntityNotFound(_0x391881,null))['then'](function(_0x24a2f9){if(_0x24a2f9){var _0x1743a0=_0x24a2f9['loginLogo']&&fs[_0xe5eb('0x66')](path[_0xe5eb('0x61')](config[_0xe5eb('0x62')],_0x58d00f,_[_0xe5eb('0x63')](_0x24a2f9[_0xe5eb('0x59')])))?path[_0xe5eb('0x61')](config[_0xe5eb('0x62')],_0x58d00f,_[_0xe5eb('0x63')](_0x24a2f9[_0xe5eb('0x59')])):path[_0xe5eb('0x61')](config[_0xe5eb('0x62')],_0x58d00f,_['toLower'](_0xe5eb('0x6b')));var _0x236376=_0xe5eb('0x6c')+_['upperFirst'](_0xe5eb('0x59'));if(_0x24a2f9[_0x236376]||!_0x51ff8c['custom']){_0x1743a0=path[_0xe5eb('0x61')](config['root'],_0x58d00f,_[_0xe5eb('0x63')]('default_loginLogo.svg'));}if(!fs[_0xe5eb('0x66')](_0x1743a0)){throw new db[(_0xe5eb('0x67'))]['ValidationError'](_['upperFirst'](_0xe5eb('0x59'))+'\x20not\x20found');}return _0x391881[_0xe5eb('0x69')](_0x1743a0);}})[_0xe5eb('0x25')](handleError(_0x391881,null));};exports['gdpr']=function(_0xc3af8f,_0x5a03d1){return db[_0xe5eb('0x51')][_0xe5eb('0x54')]({'where':{'id':_0xc3af8f[_0xe5eb('0x53')]['id']},'attributes':['securePassword']})['then'](respondWithResult(_0x5a03d1,null))['catch'](handleError(_0x5a03d1,null));};exports[_0xe5eb('0x6d')]=function(_0x298135,_0xba502d,_0x15490e){if(_0x298135[_0xe5eb('0x56')]&&_0x298135[_0xe5eb('0x56')]['filename']){_0x298135[_0xe5eb('0x55')][_0xe5eb('0x6e')]=_0x298135[_0xe5eb('0x56')][_0xe5eb('0x58')];}return db[_0xe5eb('0x51')]['find']({'where':{'id':_0x298135[_0xe5eb('0x53')]['id']}})[_0xe5eb('0x33')](handleEntityNotFound(_0xba502d,null))[_0xe5eb('0x33')](saveUpdates(_0x298135[_0xe5eb('0x55')],null))[_0xe5eb('0x33')](respondWithResult(_0xba502d,null))[_0xe5eb('0x25')](handleError(_0xba502d,null));};var utilLicense=require('../../config/license/util');exports[_0xe5eb('0x6f')]=function(_0x4e8f5c,_0x477a11,_0x3e3ce7){var _0x10ef75='server/files/images/logos';var _0x1b92dc={'custom':![]};return utilLicense[_0xe5eb('0x5b')]()[_0xe5eb('0x33')](function(_0xad490a){if(_0xad490a){_0x1b92dc=_0xad490a;}return db[_0xe5eb('0x51')]['find']({'where':{'id':_0x4e8f5c[_0xe5eb('0x53')]['id']},'attributes':['logo',_0xe5eb('0x59'),_0xe5eb('0x6e'),_0xe5eb('0x5c'),_0xe5eb('0x5d'),_0xe5eb('0x5e'),_0xe5eb('0x5f'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x477a11,null))[_0xe5eb('0x33')](function(_0x762892){if(_0x762892){var _0x39f578=_0x762892[_0xe5eb('0x6e')]&&fs[_0xe5eb('0x66')](path['join'](config[_0xe5eb('0x62')],_0x10ef75,_['toLower'](_0x762892[_0xe5eb('0x6e')])))?path[_0xe5eb('0x61')](config[_0xe5eb('0x62')],_0x10ef75,_['toLower'](_0x762892[_0xe5eb('0x6e')])):path['join'](config[_0xe5eb('0x62')],_0x10ef75,_[_0xe5eb('0x63')](_0xe5eb('0x70')));var _0x282f1a=_0xe5eb('0x6c')+_[_0xe5eb('0x68')](_0xe5eb('0x6e'));if(_0x762892[_0x282f1a]||!_0x1b92dc[_0xe5eb('0x65')]||!_0x1b92dc[_0xe5eb('0x6e')]){_0x39f578=path[_0xe5eb('0x61')](config[_0xe5eb('0x62')],_0x10ef75,_[_0xe5eb('0x63')]('default_preferred.png'));}if(!fs[_0xe5eb('0x66')](_0x39f578)){throw new db['Sequelize']['ValidationError'](_[_0xe5eb('0x68')]('preferred')+_0xe5eb('0x71'));}return _0x477a11[_0xe5eb('0x69')](_0x39f578);}})['catch'](handleError(_0x477a11,null));};exports[_0xe5eb('0x72')]=function(_0x246902,_0xf0d6b5,_0x7f37bc){if(_0x246902['file']&&_0x246902[_0xe5eb('0x56')][_0xe5eb('0x58')]){_0x246902[_0xe5eb('0x55')][_0xe5eb('0x5c')]=_0x246902['file'][_0xe5eb('0x58')];}return db[_0xe5eb('0x51')][_0xe5eb('0x54')]({'where':{'id':_0x246902['params']['id']}})['then'](handleEntityNotFound(_0xf0d6b5,null))[_0xe5eb('0x33')](saveUpdates(_0x246902['body'],null))[_0xe5eb('0x33')](respondWithResult(_0xf0d6b5,null))[_0xe5eb('0x25')](handleError(_0xf0d6b5,null));};var utilLicense=require(_0xe5eb('0x16'));exports[_0xe5eb('0x73')]=function(_0x2c9532,_0x29bed7,_0x3e1340){var _0x24a550=_0xe5eb('0x5a');var _0x17a362={'custom':![]};return utilLicense[_0xe5eb('0x5b')]()[_0xe5eb('0x33')](function(_0x38eb76){if(_0x38eb76){_0x17a362=_0x38eb76;}return db[_0xe5eb('0x51')][_0xe5eb('0x54')]({'where':{'id':_0x2c9532[_0xe5eb('0x53')]['id']},'attributes':[_0xe5eb('0x57'),_0xe5eb('0x59'),'preferred',_0xe5eb('0x5c'),'defaultLogo',_0xe5eb('0x5e'),_0xe5eb('0x5f'),_0xe5eb('0x60')],'raw':!![]});})[_0xe5eb('0x33')](handleEntityNotFound(_0x29bed7,null))[_0xe5eb('0x33')](function(_0x17a45a){if(_0x17a45a){var _0x1a7b43=_0x17a45a['favicon']&&fs['existsSync'](path['join'](config[_0xe5eb('0x62')],_0x24a550,_[_0xe5eb('0x63')](_0x17a45a[_0xe5eb('0x5c')])))?path[_0xe5eb('0x61')](config[_0xe5eb('0x62')],_0x24a550,_[_0xe5eb('0x63')](_0x17a45a[_0xe5eb('0x5c')])):path[_0xe5eb('0x61')](config['root'],_0x24a550,_[_0xe5eb('0x63')](_0xe5eb('0x74')));var _0x2e8ec7=_0xe5eb('0x6c')+_[_0xe5eb('0x68')](_0xe5eb('0x5c'));if(_0x17a45a[_0x2e8ec7]||!_0x17a362['custom']){_0x1a7b43=path[_0xe5eb('0x61')](config['root'],_0x24a550,_['toLower'](_0xe5eb('0x74')));}if(!fs[_0xe5eb('0x66')](_0x1a7b43)){throw new db[(_0xe5eb('0x67'))][(_0xe5eb('0x75'))](_['upperFirst']('favicon')+_0xe5eb('0x71'));}return _0x29bed7[_0xe5eb('0x69')](_0x1a7b43);}})[_0xe5eb('0x25')](handleError(_0x29bed7,null));};exports[_0xe5eb('0x76')]=function(_0x45ffef,_0x5b5205){var _0x421000={'offset':moment()[_0xe5eb('0x77')]()};_0x421000['now']=moment()[_0xe5eb('0x77')](_0x421000[_0xe5eb('0x28')])[_0xe5eb('0x78')](_0xe5eb('0x79'));return _0x5b5205[_0xe5eb('0x26')](0xc8)[_0xe5eb('0x36')](_0x421000);}; \ No newline at end of file +var _0x639d=['rawAttributes','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','merge','options','includeAll','include','show','params','keys','find','update','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','getLogo','getLicense','preferred','defaultLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','server/files/images/logos','favicon','defaultLoginLogo','default_loginLogo.svg','default','gdpr','securePassword','getPreferred','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','format','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','Setting'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x639d,0xbb));var _0xd639=function(_0x3fee4d,_0x3d2a5d){_0x3fee4d=_0x3fee4d-0x0;var _0x858550=_0x639d[_0x3fee4d];return _0x858550;};'use strict';var emlformat=require(_0xd639('0x0'));var rimraf=require(_0xd639('0x1'));var zipdir=require(_0xd639('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd639('0x3'));var moment=require(_0xd639('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd639('0x5'));var util=require('util');var path=require(_0xd639('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd639('0x7'));var fs=require('fs');var fs_extra=require(_0xd639('0x8'));var _=require(_0xd639('0x9'));var squel=require(_0xd639('0xa'));var crypto=require(_0xd639('0xb'));var jsforce=require(_0xd639('0xc'));var deskjs=require(_0xd639('0xd'));var toCsv=require(_0xd639('0xe'));var querystring=require('querystring');var Papa=require(_0xd639('0xf'));var Redis=require(_0xd639('0x10'));var authService=require(_0xd639('0x11'));var qs=require(_0xd639('0x12'));var as=require(_0xd639('0x13'));var hardwareService=require(_0xd639('0x14'));var logger=require(_0xd639('0x15'))(_0xd639('0x16'));var utils=require(_0xd639('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xd639('0x18'));var db=require(_0xd639('0x19'))['db'];var jayson=require(_0xd639('0x1a'));var client=jayson['client'][_0xd639('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x2d064e,_0x43d09b,_0x59a6e2,_0x1ecb44){return new BPromise(function(_0x406392,_0x5c58fa){var _0x2be37e=_0x1ecb44||client;return _0x2be37e[_0xd639('0x1c')](_0x2d064e,_0x59a6e2)['then'](function(_0x3e4080){logger[_0xd639('0x1d')](_0xd639('0x1e'),_0x43d09b,_0xd639('0x1f'));logger[_0xd639('0x20')]('Setting,\x20%s,\x20%s,\x20%s',_0x43d09b,_0xd639('0x1f'),JSON[_0xd639('0x21')](_0x3e4080));if(_0x3e4080[_0xd639('0x22')]){if(_0x3e4080['error'][_0xd639('0x23')]===0x1f4){logger[_0xd639('0x22')](_0xd639('0x1e'),_0x43d09b,_0x3e4080['error'][_0xd639('0x24')]);return _0x5c58fa(_0x3e4080[_0xd639('0x22')][_0xd639('0x24')]);}logger['error'](_0xd639('0x1e'),_0x43d09b,_0x3e4080[_0xd639('0x22')][_0xd639('0x24')]);return _0x406392(_0x3e4080[_0xd639('0x22')][_0xd639('0x24')]);}else{logger[_0xd639('0x1d')](_0xd639('0x1e'),_0x43d09b,'request\x20sent');_0x406392(_0x3e4080['result'][_0xd639('0x24')]);}})[_0xd639('0x25')](function(_0x8d42b2){logger[_0xd639('0x22')](_0xd639('0x1e'),_0x43d09b,_0x8d42b2);_0x5c58fa(_0x8d42b2);});});}function respondWithStatusCode(_0x149ea1,_0x1f0265){_0x1f0265=_0x1f0265||0xcc;return function(_0x393c52){if(_0x393c52){return _0x149ea1[_0xd639('0x26')](_0x1f0265);}return _0x149ea1[_0xd639('0x27')](_0x1f0265)[_0xd639('0x28')]();};}function respondWithResult(_0x4f9a99,_0x22f65c){_0x22f65c=_0x22f65c||0xc8;return function(_0x2497b3){if(_0x2497b3){return _0x4f9a99[_0xd639('0x27')](_0x22f65c)[_0xd639('0x29')](_0x2497b3);}};}function respondWithFilteredResult(_0x136a1a,_0x21d350){return function(_0x5d026c){if(_0x5d026c){var _0x1b0638=typeof _0x21d350[_0xd639('0x2a')]==='undefined'&&typeof _0x21d350[_0xd639('0x2b')]===_0xd639('0x2c');var _0x474c90=_0x5d026c[_0xd639('0x2d')];var _0xbd387d=_0x1b0638?0x0:_0x21d350[_0xd639('0x2a')];var _0x4347d5=_0x1b0638?_0x5d026c['count']:_0x21d350[_0xd639('0x2a')]+_0x21d350[_0xd639('0x2b')];var _0x5285d3;if(_0x4347d5>=_0x474c90){_0x4347d5=_0x474c90;_0x5285d3=0xc8;}else{_0x5285d3=0xce;}_0x136a1a['status'](_0x5285d3);return _0x136a1a[_0xd639('0x2e')](_0xd639('0x2f'),_0xbd387d+'-'+_0x4347d5+'/'+_0x474c90)[_0xd639('0x29')](_0x5d026c);}return null;};}function patchUpdates(_0x3c0471){return function(_0x5a8941){try{jsonpatch[_0xd639('0x30')](_0x5a8941,_0x3c0471,!![]);}catch(_0xef28ab){return BPromise[_0xd639('0x31')](_0xef28ab);}return _0x5a8941[_0xd639('0x32')]();};}function saveUpdates(_0x4666a4,_0x582dcd){return function(_0x560324){if(_0x560324){return _0x560324['update'](_0x4666a4)[_0xd639('0x33')](function(_0x1e3998){return _0x1e3998;});}return null;};}function removeEntity(_0x1bb821,_0x55be3f){return function(_0xc8f394){if(_0xc8f394){return _0xc8f394[_0xd639('0x34')]()[_0xd639('0x33')](function(){_0x1bb821[_0xd639('0x27')](0xcc)[_0xd639('0x28')]();});}};}function handleEntityNotFound(_0x37e652,_0x1ba513){return function(_0x1338e8){if(!_0x1338e8){_0x37e652[_0xd639('0x26')](0x194);}return _0x1338e8;};}function handleError(_0x1f5e73,_0x1ce5bb){_0x1ce5bb=_0x1ce5bb||0x1f4;return function(_0x4ae612){logger[_0xd639('0x22')](_0x4ae612[_0xd639('0x35')]);if(_0x4ae612[_0xd639('0x36')]){delete _0x4ae612[_0xd639('0x36')];}_0x1f5e73[_0xd639('0x27')](_0x1ce5bb)[_0xd639('0x37')](_0x4ae612);};}exports[_0xd639('0x38')]=function(_0xafed92,_0x1b96f0){var _0x39c857={},_0x2d9e05={},_0x57d642={'count':0x0,'rows':[]};var _0x2f6d35=_[_0xd639('0x39')](db[_0xd639('0x3a')][_0xd639('0x3b')],function(_0x45631b){return{'name':_0x45631b['fieldName'],'type':_0x45631b['type'][_0xd639('0x3c')]};});_0x2d9e05['model']=_[_0xd639('0x39')](_0x2f6d35,_0xd639('0x36'));_0x2d9e05[_0xd639('0x3d')]=_['keys'](_0xafed92[_0xd639('0x3d')]);_0x2d9e05[_0xd639('0x3e')]=_[_0xd639('0x3f')](_0x2d9e05[_0xd639('0x40')],_0x2d9e05['query']);_0x39c857[_0xd639('0x41')]=_['intersection'](_0x2d9e05['model'],qs['fields'](_0xafed92[_0xd639('0x3d')][_0xd639('0x42')]));_0x39c857[_0xd639('0x41')]=_0x39c857[_0xd639('0x41')][_0xd639('0x43')]?_0x39c857[_0xd639('0x41')]:_0x2d9e05[_0xd639('0x40')];if(!_0xafed92[_0xd639('0x3d')][_0xd639('0x44')](_0xd639('0x45'))){_0x39c857['limit']=qs[_0xd639('0x2b')](_0xafed92['query']['limit']);_0x39c857['offset']=qs[_0xd639('0x2a')](_0xafed92[_0xd639('0x3d')][_0xd639('0x2a')]);}_0x39c857[_0xd639('0x46')]=qs[_0xd639('0x47')](_0xafed92[_0xd639('0x3d')]['sort']);_0x39c857[_0xd639('0x48')]=qs[_0xd639('0x3e')](_['pick'](_0xafed92['query'],_0x2d9e05['filters']),_0x2f6d35);if(_0xafed92[_0xd639('0x3d')]['filter']){_0x39c857[_0xd639('0x48')]=_['merge'](_0x39c857['where'],{'$or':_[_0xd639('0x39')](_0x2f6d35,function(_0xf16844){if(_0xf16844[_0xd639('0x49')]!==_0xd639('0x4a')){var _0x121ec1={};_0x121ec1[_0xf16844[_0xd639('0x36')]]={'$like':'%'+_0xafed92[_0xd639('0x3d')]['filter']+'%'};return _0x121ec1;}})});}_0x39c857=_[_0xd639('0x4b')]({},_0x39c857,_0xafed92[_0xd639('0x4c')]);var _0x4bc866={'where':_0x39c857[_0xd639('0x48')]};return db[_0xd639('0x3a')][_0xd639('0x2d')](_0x4bc866)[_0xd639('0x33')](function(_0x388c08){_0x57d642[_0xd639('0x2d')]=_0x388c08;if(_0xafed92[_0xd639('0x3d')][_0xd639('0x4d')]){_0x39c857[_0xd639('0x4e')]=[{'all':!![]}];}return db[_0xd639('0x3a')]['findAll'](_0x39c857);})[_0xd639('0x33')](function(_0xefa4c1){_0x57d642['rows']=_0xefa4c1;return _0x57d642;})['then'](respondWithFilteredResult(_0x1b96f0,_0x39c857))[_0xd639('0x25')](handleError(_0x1b96f0,null));};exports[_0xd639('0x4f')]=function(_0xa94cbb,_0x4a3556){var _0x2c37e3={'raw':![],'where':{'id':_0xa94cbb[_0xd639('0x50')]['id']}},_0x2009be={};_0x2009be['model']=_['keys'](db[_0xd639('0x3a')][_0xd639('0x3b')]);_0x2009be['query']=_[_0xd639('0x51')](_0xa94cbb[_0xd639('0x3d')]);_0x2009be['filters']=_[_0xd639('0x3f')](_0x2009be[_0xd639('0x40')],_0x2009be[_0xd639('0x3d')]);_0x2c37e3[_0xd639('0x41')]=_[_0xd639('0x3f')](_0x2009be[_0xd639('0x40')],qs[_0xd639('0x42')](_0xa94cbb[_0xd639('0x3d')][_0xd639('0x42')]));_0x2c37e3[_0xd639('0x41')]=_0x2c37e3[_0xd639('0x41')][_0xd639('0x43')]?_0x2c37e3[_0xd639('0x41')]:_0x2009be[_0xd639('0x40')];if(_0xa94cbb[_0xd639('0x3d')][_0xd639('0x4d')]){_0x2c37e3[_0xd639('0x4e')]=[{'all':!![]}];}_0x2c37e3=_[_0xd639('0x4b')]({},_0x2c37e3,_0xa94cbb[_0xd639('0x4c')]);return db[_0xd639('0x3a')][_0xd639('0x52')](_0x2c37e3)[_0xd639('0x33')](handleEntityNotFound(_0x4a3556,null))[_0xd639('0x33')](respondWithResult(_0x4a3556,null))['catch'](handleError(_0x4a3556,null));};exports[_0xd639('0x53')]=function(_0x5ecd69,_0x268693){if(_0x5ecd69['body']['id']){delete _0x5ecd69[_0xd639('0x54')]['id'];}return db[_0xd639('0x3a')][_0xd639('0x52')]({'where':{'id':_0x5ecd69[_0xd639('0x50')]['id']}})[_0xd639('0x33')](handleEntityNotFound(_0x268693,null))[_0xd639('0x33')](saveUpdates(_0x5ecd69['body'],null))[_0xd639('0x33')](respondWithResult(_0x268693,null))[_0xd639('0x25')](handleError(_0x268693,null));};exports[_0xd639('0x55')]=function(_0x2755d0,_0x2a8309,_0x3c759e){if(_0x2755d0[_0xd639('0x56')]&&_0x2755d0['file'][_0xd639('0x57')]){_0x2755d0[_0xd639('0x54')][_0xd639('0x58')]=_0x2755d0['file'][_0xd639('0x57')];}return db[_0xd639('0x3a')][_0xd639('0x52')]({'where':{'id':_0x2755d0['params']['id']}})[_0xd639('0x33')](handleEntityNotFound(_0x2a8309,null))[_0xd639('0x33')](saveUpdates(_0x2755d0['body'],null))[_0xd639('0x33')](respondWithResult(_0x2a8309,null))[_0xd639('0x25')](handleError(_0x2a8309,null));};exports[_0xd639('0x59')]=function(_0x3817de,_0x5ac5f1,_0x482d74){if(_0x3817de['file']&&_0x3817de['file'][_0xd639('0x57')]){_0x3817de[_0xd639('0x54')][_0xd639('0x5a')]=_0x3817de['file'][_0xd639('0x57')];}return db[_0xd639('0x3a')][_0xd639('0x52')]({'where':{'id':_0x3817de[_0xd639('0x50')]['id']}})[_0xd639('0x33')](handleEntityNotFound(_0x5ac5f1,null))[_0xd639('0x33')](saveUpdates(_0x3817de[_0xd639('0x54')],null))[_0xd639('0x33')](respondWithResult(_0x5ac5f1,null))[_0xd639('0x25')](handleError(_0x5ac5f1,null));};var utilLicense=require(_0xd639('0x18'));exports[_0xd639('0x5b')]=function(_0x2a493e,_0x4414e2,_0x324e89){var _0x374842='server/files/images/logos';var _0x29043e={'custom':![]};return utilLicense[_0xd639('0x5c')]()['then'](function(_0x5cf6e6){if(_0x5cf6e6){_0x29043e=_0x5cf6e6;}return db[_0xd639('0x3a')][_0xd639('0x52')]({'where':{'id':_0x2a493e['params']['id']},'attributes':[_0xd639('0x58'),_0xd639('0x5a'),_0xd639('0x5d'),'favicon',_0xd639('0x5e'),'defaultLoginLogo',_0xd639('0x5f'),_0xd639('0x60')],'raw':!![]});})[_0xd639('0x33')](handleEntityNotFound(_0x4414e2,null))[_0xd639('0x33')](function(_0x42c9bb){if(_0x42c9bb){var _0x556338=_0x42c9bb[_0xd639('0x58')]&&fs[_0xd639('0x61')](path[_0xd639('0x62')](config[_0xd639('0x63')],_0x374842,_[_0xd639('0x64')](_0x42c9bb[_0xd639('0x58')])))?path[_0xd639('0x62')](config[_0xd639('0x63')],_0x374842,_[_0xd639('0x64')](_0x42c9bb[_0xd639('0x58')])):path['join'](config[_0xd639('0x63')],_0x374842,_[_0xd639('0x64')](_0xd639('0x65')));var _0x3b92a9='default'+_[_0xd639('0x66')](_0xd639('0x58'));if(_0x42c9bb[_0x3b92a9]||!_0x29043e[_0xd639('0x67')]){_0x556338=path['join'](config['root'],_0x374842,_[_0xd639('0x64')](_0xd639('0x65')));}if(!fs[_0xd639('0x61')](_0x556338)){throw new db[(_0xd639('0x68'))][(_0xd639('0x69'))](_['upperFirst'](_0xd639('0x58'))+_0xd639('0x6a'));}return _0x4414e2[_0xd639('0x6b')](_0x556338);}})[_0xd639('0x25')](handleError(_0x4414e2,null));};var utilLicense=require(_0xd639('0x18'));exports[_0xd639('0x6c')]=function(_0x35b3e9,_0x273a8d,_0x44ee47){var _0x16def5=_0xd639('0x6d');var _0x24fa27={'custom':![]};return utilLicense[_0xd639('0x5c')]()[_0xd639('0x33')](function(_0x43ae10){if(_0x43ae10){_0x24fa27=_0x43ae10;}return db[_0xd639('0x3a')][_0xd639('0x52')]({'where':{'id':_0x35b3e9['params']['id']},'attributes':[_0xd639('0x58'),_0xd639('0x5a'),'preferred',_0xd639('0x6e'),_0xd639('0x5e'),_0xd639('0x6f'),'defaultPreferred',_0xd639('0x60')],'raw':!![]});})['then'](handleEntityNotFound(_0x273a8d,null))['then'](function(_0x4c5961){if(_0x4c5961){var _0x480ca7=_0x4c5961['loginLogo']&&fs[_0xd639('0x61')](path['join'](config[_0xd639('0x63')],_0x16def5,_[_0xd639('0x64')](_0x4c5961[_0xd639('0x5a')])))?path[_0xd639('0x62')](config['root'],_0x16def5,_[_0xd639('0x64')](_0x4c5961['loginLogo'])):path[_0xd639('0x62')](config['root'],_0x16def5,_[_0xd639('0x64')](_0xd639('0x70')));var _0x4dff4a=_0xd639('0x71')+_[_0xd639('0x66')]('loginLogo');if(_0x4c5961[_0x4dff4a]||!_0x24fa27[_0xd639('0x67')]){_0x480ca7=path[_0xd639('0x62')](config['root'],_0x16def5,_['toLower'](_0xd639('0x70')));}if(!fs[_0xd639('0x61')](_0x480ca7)){throw new db['Sequelize'][(_0xd639('0x69'))](_['upperFirst'](_0xd639('0x5a'))+'\x20not\x20found');}return _0x273a8d[_0xd639('0x6b')](_0x480ca7);}})[_0xd639('0x25')](handleError(_0x273a8d,null));};exports[_0xd639('0x72')]=function(_0x2611f4,_0xd3874a){return db[_0xd639('0x3a')][_0xd639('0x52')]({'where':{'id':_0x2611f4['params']['id']},'attributes':[_0xd639('0x73')]})[_0xd639('0x33')](respondWithResult(_0xd3874a,null))[_0xd639('0x25')](handleError(_0xd3874a,null));};exports['addPreferred']=function(_0x1f418c,_0x4c1d58,_0x31af2c){if(_0x1f418c[_0xd639('0x56')]&&_0x1f418c[_0xd639('0x56')][_0xd639('0x57')]){_0x1f418c[_0xd639('0x54')][_0xd639('0x5d')]=_0x1f418c[_0xd639('0x56')]['filename'];}return db[_0xd639('0x3a')][_0xd639('0x52')]({'where':{'id':_0x1f418c[_0xd639('0x50')]['id']}})[_0xd639('0x33')](handleEntityNotFound(_0x4c1d58,null))[_0xd639('0x33')](saveUpdates(_0x1f418c['body'],null))['then'](respondWithResult(_0x4c1d58,null))['catch'](handleError(_0x4c1d58,null));};var utilLicense=require(_0xd639('0x18'));exports[_0xd639('0x74')]=function(_0x590946,_0x5ef77b,_0x3ee67d){var _0x14a4c9=_0xd639('0x6d');var _0x5b54eb={'custom':![]};return utilLicense[_0xd639('0x5c')]()[_0xd639('0x33')](function(_0x177b09){if(_0x177b09){_0x5b54eb=_0x177b09;}return db[_0xd639('0x3a')][_0xd639('0x52')]({'where':{'id':_0x590946[_0xd639('0x50')]['id']},'attributes':[_0xd639('0x58'),'loginLogo','preferred',_0xd639('0x6e'),_0xd639('0x5e'),_0xd639('0x6f'),_0xd639('0x5f'),_0xd639('0x60')],'raw':!![]});})['then'](handleEntityNotFound(_0x5ef77b,null))[_0xd639('0x33')](function(_0x3a5665){if(_0x3a5665){var _0x2d3363=_0x3a5665['preferred']&&fs[_0xd639('0x61')](path[_0xd639('0x62')](config['root'],_0x14a4c9,_[_0xd639('0x64')](_0x3a5665[_0xd639('0x5d')])))?path[_0xd639('0x62')](config[_0xd639('0x63')],_0x14a4c9,_[_0xd639('0x64')](_0x3a5665['preferred'])):path[_0xd639('0x62')](config[_0xd639('0x63')],_0x14a4c9,_[_0xd639('0x64')]('default_preferred.png'));var _0x1c0a1a=_0xd639('0x71')+_[_0xd639('0x66')](_0xd639('0x5d'));if(_0x3a5665[_0x1c0a1a]||!_0x5b54eb[_0xd639('0x67')]||!_0x5b54eb[_0xd639('0x5d')]){_0x2d3363=path[_0xd639('0x62')](config[_0xd639('0x63')],_0x14a4c9,_[_0xd639('0x64')]('default_preferred.png'));}if(!fs['existsSync'](_0x2d3363)){throw new db['Sequelize'][(_0xd639('0x69'))](_[_0xd639('0x66')](_0xd639('0x5d'))+_0xd639('0x6a'));}return _0x5ef77b[_0xd639('0x6b')](_0x2d3363);}})[_0xd639('0x25')](handleError(_0x5ef77b,null));};exports[_0xd639('0x75')]=function(_0x70f78a,_0x7c327,_0x23e3a6){if(_0x70f78a[_0xd639('0x56')]&&_0x70f78a[_0xd639('0x56')][_0xd639('0x57')]){_0x70f78a[_0xd639('0x54')][_0xd639('0x6e')]=_0x70f78a[_0xd639('0x56')][_0xd639('0x57')];}return db[_0xd639('0x3a')][_0xd639('0x52')]({'where':{'id':_0x70f78a[_0xd639('0x50')]['id']}})['then'](handleEntityNotFound(_0x7c327,null))[_0xd639('0x33')](saveUpdates(_0x70f78a[_0xd639('0x54')],null))[_0xd639('0x33')](respondWithResult(_0x7c327,null))[_0xd639('0x25')](handleError(_0x7c327,null));};var utilLicense=require(_0xd639('0x18'));exports[_0xd639('0x76')]=function(_0x13b56e,_0x4b0bfe,_0x1f0118){var _0x3659af=_0xd639('0x6d');var _0x43ddcc={'custom':![]};return utilLicense['getLicense']()[_0xd639('0x33')](function(_0x26521d){if(_0x26521d){_0x43ddcc=_0x26521d;}return db[_0xd639('0x3a')][_0xd639('0x52')]({'where':{'id':_0x13b56e['params']['id']},'attributes':['logo',_0xd639('0x5a'),'preferred',_0xd639('0x6e'),'defaultLogo','defaultLoginLogo',_0xd639('0x5f'),_0xd639('0x60')],'raw':!![]});})['then'](handleEntityNotFound(_0x4b0bfe,null))['then'](function(_0x1e6bc7){if(_0x1e6bc7){var _0x5200ff=_0x1e6bc7[_0xd639('0x6e')]&&fs[_0xd639('0x61')](path['join'](config[_0xd639('0x63')],_0x3659af,_[_0xd639('0x64')](_0x1e6bc7[_0xd639('0x6e')])))?path['join'](config[_0xd639('0x63')],_0x3659af,_[_0xd639('0x64')](_0x1e6bc7['favicon'])):path[_0xd639('0x62')](config[_0xd639('0x63')],_0x3659af,_['toLower'](_0xd639('0x77')));var _0x21e771='default'+_[_0xd639('0x66')](_0xd639('0x6e'));if(_0x1e6bc7[_0x21e771]||!_0x43ddcc[_0xd639('0x67')]){_0x5200ff=path[_0xd639('0x62')](config['root'],_0x3659af,_[_0xd639('0x64')](_0xd639('0x77')));}if(!fs['existsSync'](_0x5200ff)){throw new db[(_0xd639('0x68'))][(_0xd639('0x69'))](_[_0xd639('0x66')](_0xd639('0x6e'))+_0xd639('0x6a'));}return _0x4b0bfe['download'](_0x5200ff);}})[_0xd639('0x25')](handleError(_0x4b0bfe,null));};exports[_0xd639('0x78')]=function(_0x26a858,_0x3e0311){var _0x2123e3={'offset':moment()[_0xd639('0x79')]()};_0x2123e3['now']=moment()[_0xd639('0x79')](_0x2123e3[_0xd639('0x2a')])[_0xd639('0x7a')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x3e0311[_0xd639('0x27')](0xc8)[_0xd639('0x37')](_0x2123e3);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 9f1d3d5..40e3d85 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['settings','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports','Setting'];(function(_0x550156,_0x58b99f){var _0x132e92=function(_0x54e413){while(--_0x54e413){_0x550156['push'](_0x550156['shift']());}};_0x132e92(++_0x58b99f);}(_0x34e8,0x12c));var _0x834e=function(_0xfcd53b,_0x4468f1){_0xfcd53b=_0xfcd53b-0x0;var _0x57fc82=_0x34e8[_0xfcd53b];return _0x57fc82;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Setting','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./setting.attributes'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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':'settings','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 c6dd8d7..e3da64e 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 _0x8832=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','stringify','error','message','Setting,\x20%s,\x20%s','result','catch','Setting','options','raw','attributes','include','model','map','ShowSetting','debug','lodash'];(function(_0x2aaec6,_0x291a6f){var _0x179e5b=function(_0x164f34){while(--_0x164f34){_0x2aaec6['push'](_0x2aaec6['shift']());}};_0x179e5b(++_0x291a6f);}(_0x8832,0x77));var _0x2883=function(_0x26cefd,_0x53e737){_0x26cefd=_0x26cefd-0x0;var _0x2b1b1c=_0x8832[_0x26cefd];return _0x2b1b1c;};'use strict';var _=require(_0x2883('0x0'));var util=require('util');var moment=require(_0x2883('0x1'));var BPromise=require(_0x2883('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2883('0x3'));var db=require(_0x2883('0x4'))['db'];var utils=require(_0x2883('0x5'));var logger=require(_0x2883('0x6'))(_0x2883('0x7'));var config=require(_0x2883('0x8'));var jayson=require(_0x2883('0x9'));var client=jayson[_0x2883('0xa')][_0x2883('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1179f1,_0x1a5466,_0x5e152c){return new BPromise(function(_0x33f0d0,_0x4b8f5e){return client[_0x2883('0xc')](_0x1179f1,_0x5e152c)['then'](function(_0x4e14be){logger[_0x2883('0xd')]('Setting,\x20%s,\x20%s',_0x1a5466,_0x2883('0xe'));logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x1a5466,_0x2883('0xe'),JSON[_0x2883('0xf')](_0x4e14be));if(_0x4e14be[_0x2883('0x10')]){if(_0x4e14be['error']['code']===0x1f4){logger[_0x2883('0x10')]('Setting,\x20%s,\x20%s',_0x1a5466,_0x4e14be[_0x2883('0x10')][_0x2883('0x11')]);return _0x4b8f5e(_0x4e14be['error'][_0x2883('0x11')]);}logger[_0x2883('0x10')](_0x2883('0x12'),_0x1a5466,_0x4e14be[_0x2883('0x10')]['message']);return _0x33f0d0(_0x4e14be['error']['message']);}else{logger[_0x2883('0xd')](_0x2883('0x12'),_0x1a5466,_0x2883('0xe'));_0x33f0d0(_0x4e14be[_0x2883('0x13')]['message']);}})[_0x2883('0x14')](function(_0x24b33a){logger[_0x2883('0x10')](_0x2883('0x12'),_0x1a5466,_0x24b33a);_0x4b8f5e(_0x24b33a);});});}exports['ShowSetting']=function(_0x1bba69){var _0x39c5d2=this;return new Promise(function(_0x460851,_0x13d764){return db[_0x2883('0x15')]['find']({'raw':_0x1bba69[_0x2883('0x16')]?_0x1bba69[_0x2883('0x16')][_0x2883('0x17')]===undefined?!![]:![]:!![],'where':_0x1bba69[_0x2883('0x16')]?_0x1bba69[_0x2883('0x16')]['where']||null:null,'attributes':_0x1bba69[_0x2883('0x16')]?_0x1bba69[_0x2883('0x16')][_0x2883('0x18')]||null:null,'include':_0x1bba69[_0x2883('0x16')]?_0x1bba69[_0x2883('0x16')][_0x2883('0x19')]?_['map'](_0x1bba69[_0x2883('0x16')][_0x2883('0x19')],function(_0x505967){return{'model':db[_0x505967[_0x2883('0x1a')]],'as':_0x505967['as'],'attributes':_0x505967[_0x2883('0x18')],'include':_0x505967[_0x2883('0x19')]?_['map'](_0x505967[_0x2883('0x19')],function(_0x2b1f48){return{'model':db[_0x2b1f48[_0x2883('0x1a')]],'as':_0x2b1f48['as'],'attributes':_0x2b1f48[_0x2883('0x18')],'include':_0x2b1f48[_0x2883('0x19')]?_[_0x2883('0x1b')](_0x2b1f48[_0x2883('0x19')],function(_0xd415c){return{'model':db[_0xd415c[_0x2883('0x1a')]],'as':_0xd415c['as'],'attributes':_0xd415c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x243858){logger[_0x2883('0xd')](_0x2883('0x1c'),_0x1bba69);logger[_0x2883('0x1d')]('ShowSetting',_0x1bba69,JSON['stringify'](_0x243858));_0x460851(_0x243858);})[_0x2883('0x14')](function(_0x58c265){logger[_0x2883('0x10')]('ShowSetting',_0x58c265[_0x2883('0x11')],_0x1bba69);_0x13d764(_0x39c5d2[_0x2883('0x10')](0x1f4,_0x58c265[_0x2883('0x11')]));});});}; \ No newline at end of file +var _0xb340=['util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','ShowSetting','Setting','find','options','raw','where','attributes','include','map','model','lodash'];(function(_0x441bed,_0x2b4abb){var _0x41a28e=function(_0x1ec98c){while(--_0x1ec98c){_0x441bed['push'](_0x441bed['shift']());}};_0x41a28e(++_0x2b4abb);}(_0xb340,0x185));var _0x0b34=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xb340[_0xf50820];return _0x2a9b10;};'use strict';var _=require(_0x0b34('0x0'));var util=require(_0x0b34('0x1'));var moment=require(_0x0b34('0x2'));var BPromise=require(_0x0b34('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0b34('0x4'))['db'];var utils=require(_0x0b34('0x5'));var logger=require(_0x0b34('0x6'))(_0x0b34('0x7'));var config=require(_0x0b34('0x8'));var jayson=require(_0x0b34('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4a1ca4,_0x5ce5fd,_0x4d522d){return new BPromise(function(_0x59de8f,_0x1c029d){return client['request'](_0x4a1ca4,_0x4d522d)[_0x0b34('0xa')](function(_0x18034c){logger[_0x0b34('0xb')](_0x0b34('0xc'),_0x5ce5fd,_0x0b34('0xd'));logger[_0x0b34('0xe')]('Setting,\x20%s,\x20%s,\x20%s',_0x5ce5fd,_0x0b34('0xd'),JSON[_0x0b34('0xf')](_0x18034c));if(_0x18034c[_0x0b34('0x10')]){if(_0x18034c['error']['code']===0x1f4){logger[_0x0b34('0x10')](_0x0b34('0xc'),_0x5ce5fd,_0x18034c[_0x0b34('0x10')][_0x0b34('0x11')]);return _0x1c029d(_0x18034c[_0x0b34('0x10')][_0x0b34('0x11')]);}logger[_0x0b34('0x10')](_0x0b34('0xc'),_0x5ce5fd,_0x18034c['error']['message']);return _0x59de8f(_0x18034c[_0x0b34('0x10')]['message']);}else{logger[_0x0b34('0xb')]('Setting,\x20%s,\x20%s',_0x5ce5fd,'request\x20sent');_0x59de8f(_0x18034c[_0x0b34('0x12')][_0x0b34('0x11')]);}})[_0x0b34('0x13')](function(_0x3066d3){logger[_0x0b34('0x10')](_0x0b34('0xc'),_0x5ce5fd,_0x3066d3);_0x1c029d(_0x3066d3);});});}exports[_0x0b34('0x14')]=function(_0x3b7012){var _0x49a59b=this;return new Promise(function(_0x208a0d,_0x1e5b50){return db[_0x0b34('0x15')][_0x0b34('0x16')]({'raw':_0x3b7012[_0x0b34('0x17')]?_0x3b7012[_0x0b34('0x17')][_0x0b34('0x18')]===undefined?!![]:![]:!![],'where':_0x3b7012[_0x0b34('0x17')]?_0x3b7012[_0x0b34('0x17')][_0x0b34('0x19')]||null:null,'attributes':_0x3b7012[_0x0b34('0x17')]?_0x3b7012['options'][_0x0b34('0x1a')]||null:null,'include':_0x3b7012[_0x0b34('0x17')]?_0x3b7012['options'][_0x0b34('0x1b')]?_[_0x0b34('0x1c')](_0x3b7012[_0x0b34('0x17')][_0x0b34('0x1b')],function(_0x211d7e){return{'model':db[_0x211d7e['model']],'as':_0x211d7e['as'],'attributes':_0x211d7e['attributes'],'include':_0x211d7e[_0x0b34('0x1b')]?_[_0x0b34('0x1c')](_0x211d7e[_0x0b34('0x1b')],function(_0x5e5d05){return{'model':db[_0x5e5d05[_0x0b34('0x1d')]],'as':_0x5e5d05['as'],'attributes':_0x5e5d05['attributes'],'include':_0x5e5d05[_0x0b34('0x1b')]?_[_0x0b34('0x1c')](_0x5e5d05[_0x0b34('0x1b')],function(_0x1e84f0){return{'model':db[_0x1e84f0[_0x0b34('0x1d')]],'as':_0x1e84f0['as'],'attributes':_0x1e84f0[_0x0b34('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a28dc){logger[_0x0b34('0xb')](_0x0b34('0x14'),_0x3b7012);logger[_0x0b34('0xe')](_0x0b34('0x14'),_0x3b7012,JSON[_0x0b34('0xf')](_0x3a28dc));_0x208a0d(_0x3a28dc);})[_0x0b34('0x13')](function(_0xa77c52){logger['error'](_0x0b34('0x14'),_0xa77c52[_0x0b34('0x11')],_0x3b7012);_0x1e5b50(_0x49a59b[_0x0b34('0x10')](0x1f4,_0xa77c52[_0x0b34('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 946f4be..3c53a41 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 _0xe14b=['./smsAccount.controller','get','isAuthenticated','index','/describe','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','send','put','update','/:id','destroy','removeDispositions','delete','/:id/users','removeAgents','multer','util','express','Router','../../components/auth/service'];(function(_0x3e25bc,_0x1b01f3){var _0x345958=function(_0x289e7e){while(--_0x289e7e){_0x3e25bc['push'](_0x3e25bc['shift']());}};_0x345958(++_0x1b01f3);}(_0xe14b,0x93));var _0xbe14=function(_0x40be86,_0x3d790b){_0x40be86=_0x40be86-0x0;var _0x1c8c33=_0xe14b[_0x40be86];return _0x1c8c33;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x6')](_0xbe14('0x10'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x6')](_0xbe14('0x12'),controller[_0xbe14('0x13')]);router[_0xbe14('0x6')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x14')]);router[_0xbe14('0x15')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x16')]);router['post'](_0xbe14('0xb'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x15')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);router['post'](_0xbe14('0x19'),controller[_0xbe14('0x1a')]);router[_0xbe14('0x15')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x1b')]);router['post'](_0xbe14('0x1c'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x1d')]);router[_0xbe14('0x15')](_0xbe14('0x12'),controller['status']);router[_0xbe14('0x15')]('/:id/users',auth[_0xbe14('0x7')](),controller['addAgents']);router[_0xbe14('0x1e')]('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0x1f')]);router['delete'](_0xbe14('0x20'),auth['isAuthenticated'](),controller[_0xbe14('0x21')]);router['delete'](_0xbe14('0xb'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x22')]);router[_0xbe14('0x23')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeAnswers']);router[_0xbe14('0x23')](_0xbe14('0x24'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x25')]);module['exports']=router; \ No newline at end of file +var _0xf494=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','getAgents','post','/:id/applications','addApplications','/:id/send','send','/:id/users','put','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf494,0x1c6));var _0x4f49=function(_0x34211e,_0x13f2cd){_0x34211e=_0x34211e-0x0;var _0x4c4a5c=_0xf494[_0x34211e];return _0x4c4a5c;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f49('0x3'));var router=express[_0x4f49('0x4')]();var fs_extra=require(_0x4f49('0x5'));var auth=require(_0x4f49('0x6'));var interaction=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var controller=require(_0x4f49('0x9'));router[_0x4f49('0xa')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0xc')]);router[_0x4f49('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x4f49('0xd')]);router[_0x4f49('0xa')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0xf')]);router[_0x4f49('0xa')](_0x4f49('0x10'),auth[_0x4f49('0xb')](),controller['getDispositions']);router[_0x4f49('0xa')](_0x4f49('0x11'),auth['isAuthenticated'](),controller[_0x4f49('0x12')]);router['get']('/:id/applications',auth[_0x4f49('0xb')](),controller[_0x4f49('0x13')]);router['get'](_0x4f49('0x14'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x15')]);router[_0x4f49('0xa')](_0x4f49('0x16'),controller[_0x4f49('0x17')]);router[_0x4f49('0xa')]('/:id/users',auth[_0x4f49('0xb')](),controller[_0x4f49('0x18')]);router[_0x4f49('0x19')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4f49('0x19')](_0x4f49('0x10'),auth[_0x4f49('0xb')](),controller['addDisposition']);router[_0x4f49('0x19')](_0x4f49('0x11'),auth[_0x4f49('0xb')](),controller['addAnswer']);router['post']('/:id/notify',controller['notify']);router[_0x4f49('0x19')](_0x4f49('0x1a'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x1b')]);router['post'](_0x4f49('0x1c'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x1d')]);router[_0x4f49('0x19')](_0x4f49('0x16'),controller['status']);router[_0x4f49('0x19')](_0x4f49('0x1e'),auth[_0x4f49('0xb')](),controller['addAgents']);router[_0x4f49('0x1f')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x20')]);router[_0x4f49('0x21')](_0x4f49('0xe'),auth['isAuthenticated'](),controller['destroy']);router[_0x4f49('0x21')](_0x4f49('0x10'),auth['isAuthenticated'](),controller[_0x4f49('0x22')]);router[_0x4f49('0x21')](_0x4f49('0x11'),auth['isAuthenticated'](),controller[_0x4f49('0x23')]);router[_0x4f49('0x21')](_0x4f49('0x1e'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x24')]);module[_0x4f49('0x25')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 6751d50..0934579 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 _0xeba7=['exports','STRING','name','generate','ENUM','skebby','connectel','clicksend','plivo','clickatell','csc','intelepeer','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring'];(function(_0x21130b,_0x519278){var _0x5babb1=function(_0x12a5ad){while(--_0x12a5ad){_0x21130b['push'](_0x21130b['shift']());}};_0x5babb1(++_0x519278);}(_0xeba7,0xae));var _0x7eba=function(_0x522039,_0x39a20a){_0x522039=_0x522039-0x0;var _0x1e8f33=_0xeba7[_0x522039];return _0x1e8f33;};'use strict';var Sequelize=require(_0x7eba('0x0'));var rs=require(_0x7eba('0x1'));module[_0x7eba('0x2')]={'name':{'type':Sequelize[_0x7eba('0x3')],'unique':_0x7eba('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x7eba('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x7eba('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x7eba('0x3')],'defaultValue':function(){return rs[_0x7eba('0x5')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x7eba('0x6')]('twilio',_0x7eba('0x7'),_0x7eba('0x8'),_0x7eba('0x9'),_0x7eba('0xa'),_0x7eba('0xb'),'bandwidth',_0x7eba('0xc'),'infobip',_0x7eba('0xd'))},'accountSid':{'type':Sequelize[_0x7eba('0x3')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x7eba('0x3')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x7eba('0x3')]},'apiKey':{'type':Sequelize[_0x7eba('0x3')]},'applicationId':{'type':Sequelize[_0x7eba('0x3')]},'accountId':{'type':Sequelize[_0x7eba('0x3')]},'senderString':{'type':Sequelize[_0x7eba('0x3')]},'deliveryReport':{'type':Sequelize[_0x7eba('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0x7eba('0x3')]},'notificationTemplate':{'type':Sequelize[_0x7eba('0xf')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x7eba('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7eba('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x7eba('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7eba('0x10')],'comment':_0x7eba('0x11')},'mandatoryDisposition':{'type':Sequelize[_0x7eba('0xe')],'defaultValue':![],'comment':_0x7eba('0x12'),'set':function(_0x5959df){if(!_0x5959df)this[_0x7eba('0x13')](_0x7eba('0x14'),null);this[_0x7eba('0x13')](_0x7eba('0x15'),_0x5959df);}}}; \ No newline at end of file +var _0xa62e=['mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','connectel','plivo','clickatell','bandwidth','csc','infobip','intelepeer','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0x44b084,_0x57d9b2){var _0x1e384c=function(_0x235f4e){while(--_0x235f4e){_0x44b084['push'](_0x44b084['shift']());}};_0x1e384c(++_0x57d9b2);}(_0xa62e,0x1b6));var _0xea62=function(_0x28cae3,_0x3b8701){_0x28cae3=_0x28cae3-0x0;var _0x532948=_0xa62e[_0x28cae3];return _0x532948;};'use strict';var Sequelize=require(_0xea62('0x0'));var rs=require(_0xea62('0x1'));module[_0xea62('0x2')]={'name':{'type':Sequelize[_0xea62('0x3')],'unique':_0xea62('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xea62('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xea62('0x5')]();}},'phone':{'type':Sequelize[_0xea62('0x3')]},'type':{'type':Sequelize[_0xea62('0x6')]('twilio','skebby',_0xea62('0x7'),'clicksend',_0xea62('0x8'),_0xea62('0x9'),_0xea62('0xa'),_0xea62('0xb'),_0xea62('0xc'),_0xea62('0xd'))},'accountSid':{'type':Sequelize[_0xea62('0x3')]},'authId':{'type':Sequelize[_0xea62('0x3')]},'authToken':{'type':Sequelize[_0xea62('0x3')]},'smsMethod':{'type':Sequelize[_0xea62('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0xea62('0x3')]},'password':{'type':Sequelize[_0xea62('0x3')]},'apiKey':{'type':Sequelize[_0xea62('0x3')]},'applicationId':{'type':Sequelize[_0xea62('0x3')]},'accountId':{'type':Sequelize[_0xea62('0x3')]},'senderString':{'type':Sequelize[_0xea62('0x3')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xea62('0xe')],'defaultValue':function(){return _0xea62('0xf');}},'notificationSound':{'type':Sequelize[_0xea62('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xea62('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xea62('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xea62('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xea62('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xea62('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xea62('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xea62('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xea62('0x11')],'comment':_0xea62('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xea62('0x13'),'set':function(_0x3472bc){if(!_0x3472bc)this[_0xea62('0x14')](_0xea62('0x15'),null);this[_0xea62('0x14')](_0xea62('0x16'),_0x3472bc);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 3e571ee..7a9c49e 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 _0xd100=['merge','VIRTUAL','filter','include','rows','catch','show','params','keys','fields','length','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','SmsAccounts','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','getDispositions','findOne','Disposition','SmsAccountId','findAll','removeDispositions','CannedAnswer','getAnswers','removeAnswers','ids','notify','sms','SmsApplication','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','twilio','from','From','messageId','skebby','sender','text','clicksend','plivo','MessageUUID','infobip','results','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','ValidationError','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','SmsInteraction','interaction','created','autoclose','push','SmsMessage','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','Content-Type','text/xml','\x0a','addApplications','sequelize','Transaction','READ_COMMITTED','findAndCountAll','stack','finally','getApplications','nolimit','Contact','fullname','internal','Tag','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','skebby_dispatch_id','connectel','requestid','status_code','message_id','groupName','inspect','error_code','DELIVERED','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','csc','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','User','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./smsAccount.socket','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','query','model','attributes','intersection','hasOwnProperty','order','sort','where','pick','filters'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xd100,0x178));var _0x0d10=function(_0x5353ba,_0x3f2a00){_0x5353ba=_0x5353ba-0x0;var _0x4efd8c=_0xd100[_0x5353ba];return _0x4efd8c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0d10('0x0'));var jsonpatch=require(_0x0d10('0x1'));var rp=require(_0x0d10('0x2'));var moment=require(_0x0d10('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0d10('0x4'));var util=require(_0x0d10('0x5'));var path=require(_0x0d10('0x6'));var sox=require(_0x0d10('0x7'));var csv=require(_0x0d10('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0d10('0x9'));var _=require(_0x0d10('0xa'));var squel=require(_0x0d10('0xb'));var crypto=require(_0x0d10('0xc'));var jsforce=require(_0x0d10('0xd'));var deskjs=require(_0x0d10('0xe'));var toCsv=require(_0x0d10('0x8'));var querystring=require(_0x0d10('0xf'));var Papa=require(_0x0d10('0x10'));var Redis=require(_0x0d10('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0d10('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0d10('0x13'));var utils=require('../../config/utils');var config=require(_0x0d10('0x14'));var licenseUtil=require(_0x0d10('0x15'));var db=require(_0x0d10('0x16'))['db'];config[_0x0d10('0x17')]=_[_0x0d10('0x18')](config[_0x0d10('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x0d10('0x19'))(new Redis(config['redis']));require(_0x0d10('0x1a'))['register'](socket);var jayson=require(_0x0d10('0x1b'));var client=jayson[_0x0d10('0x1c')][_0x0d10('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x339811,_0x4afc77,_0x48f8b5,_0x48fa7e){return new BPromise(function(_0x2d6c88,_0x2e3cf8){var _0x28c755=_0x48fa7e||client;return _0x28c755[_0x0d10('0x1e')](_0x339811,_0x48f8b5)[_0x0d10('0x1f')](function(_0x2b3bef){logger[_0x0d10('0x20')](_0x0d10('0x21'),_0x4afc77,_0x0d10('0x22'));logger[_0x0d10('0x23')](_0x0d10('0x24'),_0x4afc77,_0x0d10('0x22'),JSON[_0x0d10('0x25')](_0x2b3bef));if(_0x2b3bef[_0x0d10('0x26')]){if(_0x2b3bef[_0x0d10('0x26')][_0x0d10('0x27')]===0x1f4){logger[_0x0d10('0x26')](_0x0d10('0x21'),_0x4afc77,_0x2b3bef['error'][_0x0d10('0x28')]);return _0x2e3cf8(_0x2b3bef[_0x0d10('0x26')]['message']);}logger['error'](_0x0d10('0x21'),_0x4afc77,_0x2b3bef[_0x0d10('0x26')][_0x0d10('0x28')]);return _0x2d6c88(_0x2b3bef[_0x0d10('0x26')]['message']);}else{logger[_0x0d10('0x20')](_0x0d10('0x21'),_0x4afc77,_0x0d10('0x22'));_0x2d6c88(_0x2b3bef[_0x0d10('0x29')][_0x0d10('0x28')]);}})['catch'](function(_0x56abf3){logger[_0x0d10('0x26')](_0x0d10('0x21'),_0x4afc77,_0x56abf3);_0x2e3cf8(_0x56abf3);});});}function respondWithStatusCode(_0x4bbce7,_0x4fb557){_0x4fb557=_0x4fb557||0xcc;return function(_0x47a26d){if(_0x47a26d){return _0x4bbce7[_0x0d10('0x2a')](_0x4fb557);}return _0x4bbce7[_0x0d10('0x2b')](_0x4fb557)['end']();};}function respondWithResult(_0x2a664b,_0x3f1f50){_0x3f1f50=_0x3f1f50||0xc8;return function(_0x54df46){if(_0x54df46){return _0x2a664b[_0x0d10('0x2b')](_0x3f1f50)[_0x0d10('0x2c')](_0x54df46);}};}function respondWithFilteredResult(_0x520a90,_0xfafe3c){return function(_0x325f0f){if(_0x325f0f){var _0x375bf4=typeof _0xfafe3c['offset']===_0x0d10('0x2d')&&typeof _0xfafe3c[_0x0d10('0x2e')]==='undefined';var _0x3f30e7=_0x325f0f[_0x0d10('0x2f')];var _0x40ff88=_0x375bf4?0x0:_0xfafe3c[_0x0d10('0x30')];var _0xae3030=_0x375bf4?_0x325f0f['count']:_0xfafe3c[_0x0d10('0x30')]+_0xfafe3c[_0x0d10('0x2e')];var _0x552b30;if(_0xae3030>=_0x3f30e7){_0xae3030=_0x3f30e7;_0x552b30=0xc8;}else{_0x552b30=0xce;}_0x520a90['status'](_0x552b30);return _0x520a90[_0x0d10('0x31')](_0x0d10('0x32'),_0x40ff88+'-'+_0xae3030+'/'+_0x3f30e7)[_0x0d10('0x2c')](_0x325f0f);}return null;};}function patchUpdates(_0x263353){return function(_0x2161bb){try{jsonpatch[_0x0d10('0x33')](_0x2161bb,_0x263353,!![]);}catch(_0x82a73a){return BPromise[_0x0d10('0x34')](_0x82a73a);}return _0x2161bb[_0x0d10('0x35')]();};}function saveUpdates(_0xe53356,_0x29cf82){return function(_0x2e30e3){if(_0x2e30e3){return _0x2e30e3[_0x0d10('0x36')](_0xe53356)['then'](function(_0x3eae85){return _0x3eae85;});}return null;};}function removeEntity(_0x199caf,_0x3e33a1){return function(_0x150ae5){if(_0x150ae5){return _0x150ae5[_0x0d10('0x37')]()['then'](function(){var _0x23d237=_0x150ae5['get']({'plain':!![]});var _0x17fa80='SmsAccounts';return db[_0x0d10('0x38')]['destroy']({'where':{'type':_0x17fa80,'resourceId':_0x23d237['id']}})[_0x0d10('0x1f')](function(){return _0x150ae5;});})[_0x0d10('0x1f')](function(){_0x199caf['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x35fa9a,_0x3e7fef){return function(_0x5cce81){if(!_0x5cce81){_0x35fa9a[_0x0d10('0x2a')](0x194);}return _0x5cce81;};}function handleError(_0x285bdc,_0x24e1a9){_0x24e1a9=_0x24e1a9||0x1f4;return function(_0x153f8b){logger[_0x0d10('0x26')](_0x153f8b['stack']);if(_0x153f8b[_0x0d10('0x39')]){delete _0x153f8b[_0x0d10('0x39')];}_0x285bdc[_0x0d10('0x2b')](_0x24e1a9)[_0x0d10('0x3a')](_0x153f8b);};}exports[_0x0d10('0x3b')]=function(_0x5250af,_0x4475ca){var _0xf0663a={'include':[{'model':db[_0x0d10('0x3c')],'as':_0x0d10('0x3d')}]},_0x3dda53={},_0x4ea2b1={'count':0x0,'rows':[]};var _0x3bc373=_[_0x0d10('0x3e')](db[_0x0d10('0x3f')][_0x0d10('0x40')],function(_0x91ba7a){return{'name':_0x91ba7a[_0x0d10('0x41')],'type':_0x91ba7a[_0x0d10('0x42')][_0x0d10('0x43')]};});_0x3dda53['model']=_[_0x0d10('0x3e')](_0x3bc373,'name');_0x3dda53[_0x0d10('0x44')]=_['keys'](_0x5250af[_0x0d10('0x44')]);_0x3dda53['filters']=_['intersection'](_0x3dda53[_0x0d10('0x45')],_0x3dda53[_0x0d10('0x44')]);_0xf0663a[_0x0d10('0x46')]=_[_0x0d10('0x47')](_0x3dda53['model'],qs['fields'](_0x5250af[_0x0d10('0x44')]['fields']));_0xf0663a[_0x0d10('0x46')]=_0xf0663a[_0x0d10('0x46')]['length']?_0xf0663a[_0x0d10('0x46')]:_0x3dda53[_0x0d10('0x45')];if(!_0x5250af[_0x0d10('0x44')][_0x0d10('0x48')]('nolimit')){_0xf0663a[_0x0d10('0x2e')]=qs['limit'](_0x5250af['query'][_0x0d10('0x2e')]);_0xf0663a[_0x0d10('0x30')]=qs[_0x0d10('0x30')](_0x5250af[_0x0d10('0x44')][_0x0d10('0x30')]);}_0xf0663a[_0x0d10('0x49')]=qs[_0x0d10('0x4a')](_0x5250af['query'][_0x0d10('0x4a')]);_0xf0663a[_0x0d10('0x4b')]=qs['filters'](_[_0x0d10('0x4c')](_0x5250af[_0x0d10('0x44')],_0x3dda53[_0x0d10('0x4d')]),_0x3bc373);if(_0x5250af[_0x0d10('0x44')]['filter']){_0xf0663a[_0x0d10('0x4b')]=_[_0x0d10('0x4e')](_0xf0663a[_0x0d10('0x4b')],{'$or':_[_0x0d10('0x3e')](_0x3bc373,function(_0x73636c){if(_0x73636c['type']!==_0x0d10('0x4f')){var _0x4ad312={};_0x4ad312[_0x73636c['name']]={'$like':'%'+_0x5250af[_0x0d10('0x44')][_0x0d10('0x50')]+'%'};return _0x4ad312;}})});}_0xf0663a=_[_0x0d10('0x4e')]({},_0xf0663a,_0x5250af['options']);var _0x579573={'where':_0xf0663a[_0x0d10('0x4b')]};return db[_0x0d10('0x3f')][_0x0d10('0x2f')](_0x579573)['then'](function(_0x597446){_0x4ea2b1['count']=_0x597446;if(_0x5250af['query']['includeAll']){_0xf0663a[_0x0d10('0x51')]=[{'all':!![]}];}return db[_0x0d10('0x3f')]['findAll'](_0xf0663a);})[_0x0d10('0x1f')](function(_0x2014d4){_0x4ea2b1[_0x0d10('0x52')]=_0x2014d4;return _0x4ea2b1;})['then'](respondWithFilteredResult(_0x4475ca,_0xf0663a))[_0x0d10('0x53')](handleError(_0x4475ca,null));};exports[_0x0d10('0x54')]=function(_0x5b6b6a,_0x40d6b3){var _0x4ec77f={'raw':![],'where':{'id':_0x5b6b6a[_0x0d10('0x55')]['id']},'include':[{'model':db[_0x0d10('0x3c')],'as':_0x0d10('0x3d')}]},_0x21acf4={};_0x21acf4['model']=_[_0x0d10('0x56')](db[_0x0d10('0x3f')][_0x0d10('0x40')]);_0x21acf4[_0x0d10('0x44')]=_[_0x0d10('0x56')](_0x5b6b6a[_0x0d10('0x44')]);_0x21acf4['filters']=_[_0x0d10('0x47')](_0x21acf4[_0x0d10('0x45')],_0x21acf4['query']);_0x4ec77f[_0x0d10('0x46')]=_[_0x0d10('0x47')](_0x21acf4[_0x0d10('0x45')],qs[_0x0d10('0x57')](_0x5b6b6a['query'][_0x0d10('0x57')]));_0x4ec77f[_0x0d10('0x46')]=_0x4ec77f['attributes'][_0x0d10('0x58')]?_0x4ec77f[_0x0d10('0x46')]:_0x21acf4['model'];if(_0x5b6b6a[_0x0d10('0x44')][_0x0d10('0x59')]){_0x4ec77f['include']=[{'all':!![]}];}_0x4ec77f=_[_0x0d10('0x4e')]({},_0x4ec77f,_0x5b6b6a[_0x0d10('0x5a')]);return db[_0x0d10('0x3f')][_0x0d10('0x5b')](_0x4ec77f)[_0x0d10('0x1f')](handleEntityNotFound(_0x40d6b3,null))[_0x0d10('0x1f')](respondWithResult(_0x40d6b3,null))[_0x0d10('0x53')](handleError(_0x40d6b3,null));};exports[_0x0d10('0x5c')]=function(_0x282ec2,_0x519c6b){return db[_0x0d10('0x3f')][_0x0d10('0x5c')](_0x282ec2[_0x0d10('0x5d')],{})['then'](function(_0x520e5b){var _0x5bb588=_0x282ec2[_0x0d10('0x5e')]['get']({'plain':!![]});if(!_0x5bb588)throw new Error(_0x0d10('0x5f'));if(_0x5bb588[_0x0d10('0x60')]===_0x0d10('0x5e')){var _0x1dca10=_0x520e5b[_0x0d10('0x61')]({'plain':!![]});var _0x834db9=_0x0d10('0x62');return db['UserProfileSection']['find']({'where':{'name':_0x834db9,'userProfileId':_0x5bb588['userProfileId']},'raw':!![]})[_0x0d10('0x1f')](function(_0x5161f3){if(_0x5161f3&&_0x5161f3['autoAssociation']===0x0){return db[_0x0d10('0x38')][_0x0d10('0x5c')]({'name':_0x1dca10['name'],'resourceId':_0x1dca10['id'],'type':_0x5161f3['name'],'sectionId':_0x5161f3['id']},{})[_0x0d10('0x1f')](function(){return _0x520e5b;});}else{return _0x520e5b;}})['catch'](function(_0x54a8a1){logger[_0x0d10('0x26')](_0x0d10('0x63'),_0x54a8a1);throw _0x54a8a1;});}return _0x520e5b;})[_0x0d10('0x1f')](respondWithResult(_0x519c6b,0xc9))[_0x0d10('0x53')](handleError(_0x519c6b,null));};exports['update']=function(_0x12fe18,_0x33fd82){if(_0x12fe18['body']['id']){delete _0x12fe18[_0x0d10('0x5d')]['id'];}return db[_0x0d10('0x3f')][_0x0d10('0x5b')]({'where':{'id':_0x12fe18[_0x0d10('0x55')]['id']},'include':[{'model':db[_0x0d10('0x3c')],'as':_0x0d10('0x3d')}]})[_0x0d10('0x1f')](handleEntityNotFound(_0x33fd82,null))[_0x0d10('0x1f')](saveUpdates(_0x12fe18[_0x0d10('0x5d')],null))['then'](respondWithResult(_0x33fd82,null))[_0x0d10('0x53')](handleError(_0x33fd82,null));};exports[_0x0d10('0x37')]=function(_0x4bb2da,_0x483c1e){return db[_0x0d10('0x3f')][_0x0d10('0x5b')]({'where':{'id':_0x4bb2da['params']['id']}})[_0x0d10('0x1f')](handleEntityNotFound(_0x483c1e,null))[_0x0d10('0x1f')](removeEntity(_0x483c1e,null))[_0x0d10('0x53')](handleError(_0x483c1e,null));};exports[_0x0d10('0x64')]=function(_0xa4c65e,_0x3ea691){return db[_0x0d10('0x3f')][_0x0d10('0x64')]()['then'](respondWithResult(_0x3ea691,null))[_0x0d10('0x53')](handleError(_0x3ea691,null));};exports[_0x0d10('0x65')]=function(_0x405a18,_0x566c98,_0x306e7a){if(_0x405a18[_0x0d10('0x5d')]['id']){delete _0x405a18[_0x0d10('0x5d')]['id'];}return db[_0x0d10('0x3f')][_0x0d10('0x5b')]({'where':{'id':_0x405a18[_0x0d10('0x55')]['id']}})[_0x0d10('0x1f')](handleEntityNotFound(_0x566c98,null))[_0x0d10('0x1f')](function(_0x4b223d){if(_0x4b223d){_0x405a18[_0x0d10('0x5d')]['SmsAccountId']=_0x4b223d['id'];return db['Disposition']['create'](_0x405a18[_0x0d10('0x5d')]);}})[_0x0d10('0x1f')](respondWithResult(_0x566c98,null))['catch'](handleError(_0x566c98,null));};exports[_0x0d10('0x66')]=function(_0x4a919d,_0x42d6e2,_0x56e493){var _0x5d5cb6={'raw':![],'where':{}};var _0x24040e={};var _0x13a19d={'count':0x0,'rows':[]};return db[_0x0d10('0x3f')][_0x0d10('0x67')]({'where':{'id':_0x4a919d[_0x0d10('0x55')]['id']}})['then'](handleEntityNotFound(_0x42d6e2,null))[_0x0d10('0x1f')](function(_0x24d284){if(_0x24d284){_0x24040e[_0x0d10('0x45')]=_[_0x0d10('0x56')](db[_0x0d10('0x68')][_0x0d10('0x40')]);_0x24040e['query']=_[_0x0d10('0x56')](_0x4a919d[_0x0d10('0x44')]);_0x24040e[_0x0d10('0x4d')]=_[_0x0d10('0x47')](_0x24040e[_0x0d10('0x45')],_0x24040e[_0x0d10('0x44')]);_0x5d5cb6[_0x0d10('0x46')]=_[_0x0d10('0x47')](_0x24040e['model'],qs['fields'](_0x4a919d[_0x0d10('0x44')][_0x0d10('0x57')]));_0x5d5cb6['attributes']=_0x5d5cb6[_0x0d10('0x46')][_0x0d10('0x58')]?_0x5d5cb6[_0x0d10('0x46')]:_0x24040e['model'];if(!_0x4a919d[_0x0d10('0x44')][_0x0d10('0x48')]('nolimit')){_0x5d5cb6[_0x0d10('0x2e')]=qs['limit'](_0x4a919d[_0x0d10('0x44')][_0x0d10('0x2e')]);_0x5d5cb6[_0x0d10('0x30')]=qs[_0x0d10('0x30')](_0x4a919d[_0x0d10('0x44')]['offset']);}_0x5d5cb6[_0x0d10('0x49')]=qs['sort'](_0x4a919d[_0x0d10('0x44')][_0x0d10('0x4a')]);_0x5d5cb6[_0x0d10('0x4b')]=qs[_0x0d10('0x4d')](_[_0x0d10('0x4c')](_0x4a919d[_0x0d10('0x44')],_0x24040e[_0x0d10('0x4d')]));_0x5d5cb6[_0x0d10('0x4b')][_0x0d10('0x69')]=_0x24d284['id'];if(_0x4a919d[_0x0d10('0x44')][_0x0d10('0x50')]){_0x5d5cb6[_0x0d10('0x4b')]=_['merge'](_0x5d5cb6[_0x0d10('0x4b')],{'$or':_[_0x0d10('0x3e')](_0x5d5cb6[_0x0d10('0x46')],function(_0x2c2c1a){var _0x45b85c={};_0x45b85c[_0x2c2c1a]={'$like':'%'+_0x4a919d[_0x0d10('0x44')][_0x0d10('0x50')]+'%'};return _0x45b85c;})});}_0x5d5cb6=_[_0x0d10('0x4e')]({},_0x5d5cb6,_0x4a919d[_0x0d10('0x5a')]);return db[_0x0d10('0x68')][_0x0d10('0x2f')]({'where':_0x5d5cb6['where']})['then'](function(_0x973fa){_0x13a19d[_0x0d10('0x2f')]=_0x973fa;if(_0x4a919d[_0x0d10('0x44')][_0x0d10('0x59')]){_0x5d5cb6[_0x0d10('0x51')]=[{'all':!![]}];}return db[_0x0d10('0x68')][_0x0d10('0x6a')](_0x5d5cb6);})[_0x0d10('0x1f')](function(_0xcd8219){_0x13a19d[_0x0d10('0x52')]=_0xcd8219;return _0x13a19d;});}})[_0x0d10('0x1f')](respondWithFilteredResult(_0x42d6e2,_0x5d5cb6))[_0x0d10('0x53')](handleError(_0x42d6e2,null));};exports[_0x0d10('0x6b')]=function(_0x40a8eb,_0x9fd9c0,_0x307861){return db['SmsAccount'][_0x0d10('0x5b')]({'where':{'id':_0x40a8eb[_0x0d10('0x55')]['id']}})[_0x0d10('0x1f')](handleEntityNotFound(_0x9fd9c0,null))['then'](function(_0x1dc198){if(_0x1dc198){return _0x1dc198[_0x0d10('0x6b')](_0x40a8eb[_0x0d10('0x44')]['ids']);}})[_0x0d10('0x1f')](respondWithStatusCode(_0x9fd9c0,null))[_0x0d10('0x53')](handleError(_0x9fd9c0,null));};exports['addAnswer']=function(_0x3c0c92,_0x5a71c7,_0x2cfb7c){if(_0x3c0c92[_0x0d10('0x5d')]['id']){delete _0x3c0c92[_0x0d10('0x5d')]['id'];}return db[_0x0d10('0x3f')][_0x0d10('0x5b')]({'where':{'id':_0x3c0c92[_0x0d10('0x55')]['id']}})[_0x0d10('0x1f')](handleEntityNotFound(_0x5a71c7,null))[_0x0d10('0x1f')](function(_0xcb8fd4){if(_0xcb8fd4){_0x3c0c92[_0x0d10('0x5d')]['SmsAccountId']=_0xcb8fd4['id'];return db[_0x0d10('0x6c')][_0x0d10('0x5c')](_0x3c0c92[_0x0d10('0x5d')]);}})[_0x0d10('0x1f')](respondWithResult(_0x5a71c7,null))[_0x0d10('0x53')](handleError(_0x5a71c7,null));};exports[_0x0d10('0x6d')]=function(_0x34fa03,_0x13db3c,_0x2e0937){var _0x2155ef={'raw':![],'where':{}};var _0x2c8b04={};var _0x13945d={'count':0x0,'rows':[]};return db['SmsAccount'][_0x0d10('0x67')]({'where':{'id':_0x34fa03[_0x0d10('0x55')]['id']}})[_0x0d10('0x1f')](handleEntityNotFound(_0x13db3c,null))['then'](function(_0x112ee3){if(_0x112ee3){_0x2c8b04[_0x0d10('0x45')]=_[_0x0d10('0x56')](db[_0x0d10('0x6c')][_0x0d10('0x40')]);_0x2c8b04['query']=_[_0x0d10('0x56')](_0x34fa03[_0x0d10('0x44')]);_0x2c8b04[_0x0d10('0x4d')]=_[_0x0d10('0x47')](_0x2c8b04[_0x0d10('0x45')],_0x2c8b04[_0x0d10('0x44')]);_0x2155ef[_0x0d10('0x46')]=_['intersection'](_0x2c8b04[_0x0d10('0x45')],qs['fields'](_0x34fa03['query'][_0x0d10('0x57')]));_0x2155ef['attributes']=_0x2155ef[_0x0d10('0x46')][_0x0d10('0x58')]?_0x2155ef[_0x0d10('0x46')]:_0x2c8b04[_0x0d10('0x45')];if(!_0x34fa03[_0x0d10('0x44')][_0x0d10('0x48')]('nolimit')){_0x2155ef[_0x0d10('0x2e')]=qs[_0x0d10('0x2e')](_0x34fa03[_0x0d10('0x44')]['limit']);_0x2155ef[_0x0d10('0x30')]=qs[_0x0d10('0x30')](_0x34fa03[_0x0d10('0x44')][_0x0d10('0x30')]);}_0x2155ef[_0x0d10('0x49')]=qs[_0x0d10('0x4a')](_0x34fa03[_0x0d10('0x44')][_0x0d10('0x4a')]);_0x2155ef['where']=qs[_0x0d10('0x4d')](_[_0x0d10('0x4c')](_0x34fa03['query'],_0x2c8b04[_0x0d10('0x4d')]));_0x2155ef[_0x0d10('0x4b')]['SmsAccountId']=_0x112ee3['id'];if(_0x34fa03[_0x0d10('0x44')][_0x0d10('0x50')]){_0x2155ef[_0x0d10('0x4b')]=_[_0x0d10('0x4e')](_0x2155ef['where'],{'$or':_[_0x0d10('0x3e')](_0x2155ef['attributes'],function(_0x15caeb){var _0x3a1681={};_0x3a1681[_0x15caeb]={'$like':'%'+_0x34fa03[_0x0d10('0x44')]['filter']+'%'};return _0x3a1681;})});}_0x2155ef=_[_0x0d10('0x4e')]({},_0x2155ef,_0x34fa03[_0x0d10('0x5a')]);return db[_0x0d10('0x6c')][_0x0d10('0x2f')]({'where':_0x2155ef[_0x0d10('0x4b')]})['then'](function(_0x5b5b9d){_0x13945d[_0x0d10('0x2f')]=_0x5b5b9d;if(_0x34fa03[_0x0d10('0x44')]['includeAll']){_0x2155ef[_0x0d10('0x51')]=[{'all':!![]}];}return db[_0x0d10('0x6c')][_0x0d10('0x6a')](_0x2155ef);})['then'](function(_0x2b5d56){_0x13945d[_0x0d10('0x52')]=_0x2b5d56;return _0x13945d;});}})[_0x0d10('0x1f')](respondWithFilteredResult(_0x13db3c,_0x2155ef))[_0x0d10('0x53')](handleError(_0x13db3c,null));};exports[_0x0d10('0x6e')]=function(_0x4699a2,_0x17ebb0,_0x2293be){return db[_0x0d10('0x3f')][_0x0d10('0x5b')]({'where':{'id':_0x4699a2['params']['id']}})[_0x0d10('0x1f')](handleEntityNotFound(_0x17ebb0,null))[_0x0d10('0x1f')](function(_0x53d0d1){if(_0x53d0d1){return _0x53d0d1[_0x0d10('0x6e')](_0x4699a2[_0x0d10('0x44')][_0x0d10('0x6f')]);}})[_0x0d10('0x1f')](respondWithStatusCode(_0x17ebb0,null))[_0x0d10('0x53')](handleError(_0x17ebb0,null));};exports[_0x0d10('0x70')]=function(_0x380e8d,_0x1b88bf,_0x44ab9b){var _0x54fa60={'channel':_0x0d10('0x71')};var _0x4672e6=[];var _0x43d21b=[];var _0x451109={};return db[_0x0d10('0x3f')][_0x0d10('0x5b')]({'where':{'id':_0x380e8d[_0x0d10('0x55')]['id']},'include':[{'model':db[_0x0d10('0x72')],'as':_0x0d10('0x73')}]})[_0x0d10('0x1f')](handleEntityNotFound(_0x1b88bf,null))['then'](function(_0x5afc20){_0x54fa60[_0x0d10('0x74')]=_0x5afc20;_0x54fa60[_0x0d10('0x75')]=_[_0x0d10('0x76')](_0x5afc20[_0x0d10('0x73')],[_0x0d10('0x77')],[_0x0d10('0x78')]);if(_0x54fa60[_0x0d10('0x74')]['Applications']){delete _0x54fa60['account'][_0x0d10('0x73')];}return db[_0x0d10('0x79')][_0x0d10('0x64')]();})['then'](function(_0x5ae693){if(!_0x5ae693){throw new db[(_0x0d10('0x7a'))]['ValidationError'](_0x0d10('0x7b'));}_0x4672e6=_[_0x0d10('0x7c')](_[_0x0d10('0x56')](_0x5ae693),['createdAt',_0x0d10('0x7d')]);_0x43d21b=_[_0x0d10('0x7c')](_[_0x0d10('0x56')](_0x5ae693),[_0x0d10('0x7e'),_0x0d10('0x7d'),_0x0d10('0x7f'),_0x0d10('0x80')]);_0x54fa60[_0x0d10('0x5d')]={'mapKey':'mobile'};if(_0x54fa60[_0x0d10('0x74')]['type']){switch(_0x54fa60[_0x0d10('0x74')]['type']){case _0x0d10('0x81'):_0x54fa60[_0x0d10('0x5d')][_0x0d10('0x82')]=_0x380e8d[_0x0d10('0x5d')][_0x0d10('0x83')];_0x54fa60[_0x0d10('0x5d')]['body']=_0x380e8d['body']['Body'];_0x54fa60[_0x0d10('0x5d')][_0x0d10('0x84')]=_0x380e8d[_0x0d10('0x5d')]['MessageSid'];break;case _0x0d10('0x85'):_0x54fa60[_0x0d10('0x5d')]['from']='+'+_0x380e8d[_0x0d10('0x5d')][_0x0d10('0x86')];_0x54fa60[_0x0d10('0x5d')][_0x0d10('0x5d')]=_0x380e8d[_0x0d10('0x5d')][_0x0d10('0x87')];break;case'connectel':_0x54fa60['body'][_0x0d10('0x82')]=_0x380e8d[_0x0d10('0x5d')]['from'];_0x54fa60['body'][_0x0d10('0x5d')]=_0x380e8d[_0x0d10('0x5d')]['message'];break;case _0x0d10('0x88'):_0x54fa60[_0x0d10('0x5d')][_0x0d10('0x82')]=_0x380e8d[_0x0d10('0x5d')][_0x0d10('0x82')];_0x54fa60[_0x0d10('0x5d')]['body']=_0x380e8d[_0x0d10('0x5d')][_0x0d10('0x5d')];_0x54fa60[_0x0d10('0x5d')][_0x0d10('0x84')]=_0x380e8d[_0x0d10('0x5d')]['message_id'];break;case _0x0d10('0x89'):_0x54fa60[_0x0d10('0x5d')]['from']=_0x380e8d[_0x0d10('0x5d')][_0x0d10('0x83')];_0x54fa60[_0x0d10('0x5d')]['body']=_0x380e8d[_0x0d10('0x5d')]['Text'];_0x54fa60[_0x0d10('0x5d')][_0x0d10('0x84')]=_0x380e8d[_0x0d10('0x5d')][_0x0d10('0x8a')];break;case _0x0d10('0x8b'):_0x54fa60['body']['from']='+'+_0x380e8d[_0x0d10('0x5d')][_0x0d10('0x8c')][0x0][_0x0d10('0x82')];_0x54fa60[_0x0d10('0x5d')][_0x0d10('0x5d')]=_0x380e8d[_0x0d10('0x5d')]['results'][0x0][_0x0d10('0x87')];_0x54fa60[_0x0d10('0x5d')]['messageId']=_0x380e8d['body'][_0x0d10('0x8c')][0x0][_0x0d10('0x84')];break;case'csc':_0x54fa60['body']['from']=_0x380e8d[_0x0d10('0x5d')][_0x0d10('0x8d')];_0x54fa60[_0x0d10('0x5d')][_0x0d10('0x5d')]=_0x380e8d[_0x0d10('0x5d')][_0x0d10('0x8e')][_0x0d10('0x28')];break;case _0x0d10('0x8f'):_0x54fa60['body'][_0x0d10('0x82')]=_0x380e8d['body'][_0x0d10('0x90')];_0x54fa60[_0x0d10('0x5d')]['body']=_0x380e8d[_0x0d10('0x5d')]['text'];_0x54fa60[_0x0d10('0x5d')][_0x0d10('0x84')]=_0x380e8d[_0x0d10('0x5d')][_0x0d10('0x91')];break;case _0x0d10('0x92'):_0x54fa60[_0x0d10('0x5d')][_0x0d10('0x84')]=_0x380e8d[_0x0d10('0x5d')][0x0][_0x0d10('0x28')]['id'];_0x54fa60[_0x0d10('0x5d')][_0x0d10('0x82')]=_0x380e8d[_0x0d10('0x5d')][0x0][_0x0d10('0x28')]['from'];_0x54fa60[_0x0d10('0x5d')][_0x0d10('0x5d')]=_0x380e8d['body'][0x0]['message'][_0x0d10('0x87')];break;case _0x0d10('0x93'):_0x54fa60['body']['from']=_0x380e8d[_0x0d10('0x5d')]['from'];_0x54fa60[_0x0d10('0x5d')]['body']=_0x380e8d[_0x0d10('0x5d')]['message'];_0x54fa60[_0x0d10('0x5d')][_0x0d10('0x84')]=_0x380e8d[_0x0d10('0x5d')][_0x0d10('0x94')];break;}}if(_0x54fa60['body']['id']){delete _0x54fa60[_0x0d10('0x5d')]['id'];}if(_['isNil'](_0x54fa60[_0x0d10('0x5d')][_0x0d10('0x82')])){throw new db['Sequelize'][(_0x0d10('0x95'))](_0x0d10('0x96'));}if(_[_0x0d10('0x97')](_0x54fa60[_0x0d10('0x5d')][_0x0d10('0x5d')])||_0x54fa60[_0x0d10('0x5d')][_0x0d10('0x5d')]===''){throw new db['Sequelize'][(_0x0d10('0x95'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x0d10('0x97')](_0x54fa60[_0x0d10('0x5d')][_0x0d10('0x98')])){throw new db[(_0x0d10('0x7a'))][(_0x0d10('0x95'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x43d21b);}if(!_['includes'](_0x43d21b,_0x54fa60[_0x0d10('0x5d')][_0x0d10('0x98')])){throw new db[(_0x0d10('0x7a'))][(_0x0d10('0x95'))](_0x0d10('0x99')+_0x43d21b);}_0x451109[_0x54fa60[_0x0d10('0x5d')][_0x0d10('0x98')]]=_0x54fa60['body'][_0x0d10('0x82')];return db[_0x0d10('0x9a')]['find']({'where':{'id':_0x54fa60[_0x0d10('0x74')][_0x0d10('0x80')]},'include':[{'model':db['CmContact'],'as':_0x0d10('0x9b'),'where':_0x451109,'limit':0x1,'order':[['updatedAt',_0x0d10('0x9c')]]}]});})[_0x0d10('0x1f')](handleEntityNotFound(_0x1b88bf,null))[_0x0d10('0x1f')](function(_0x18764b){if(_0x18764b){_0x54fa60[_0x0d10('0x9d')]=_[_0x0d10('0x9e')](_0x18764b,['Contacts']);if(_0x18764b[_0x0d10('0x9b')][_0x0d10('0x58')]){return _0x18764b['Contacts'][0x0];}var _0x52d694=_[_0x0d10('0x18')](_0x54fa60['body'],{'firstName':_0x54fa60[_0x0d10('0x5d')][_0x0d10('0x82')],'ListId':_0x18764b['id']});_0x52d694[_0x54fa60[_0x0d10('0x5d')][_0x0d10('0x98')]]=_0x54fa60[_0x0d10('0x5d')][_0x0d10('0x82')];return db[_0x0d10('0x79')][_0x0d10('0x5c')](_0x52d694,{'fields':_0x4672e6,'raw':!![]});}})[_0x0d10('0x1f')](handleEntityNotFound(_0x1b88bf,null))['then'](function(_0x4fc06c){if(_0x4fc06c){_0x54fa60['contact']=_0x4fc06c;var _0x2f14b3={'ContactId':_0x4fc06c['id'],'phone':_0x54fa60['body'][_0x0d10('0x82')],'SmsAccountId':_0x380e8d[_0x0d10('0x55')]['id']};var _0x20dba6={'ContactId':_0x4fc06c['id'],'SmsAccountId':_0x380e8d[_0x0d10('0x55')]['id'],'closed':![]};return db[_0x0d10('0x9f')][_0x0d10('0x5b')]({'where':_0x20dba6})[_0x0d10('0x1f')](function(_0x363240){if(_0x363240){return[_0x363240,![]];}return db[_0x0d10('0x9f')][_0x0d10('0x5c')](_0x2f14b3)[_0x0d10('0x1f')](function(_0x1996dc){return[_0x1996dc,!![]];});});}})['spread'](function(_0x16a2f5,_0x440670){_0x54fa60[_0x0d10('0xa0')]=_0x16a2f5[_0x0d10('0x61')]({'plain':!![]});_0x54fa60[_0x0d10('0xa0')][_0x0d10('0xa1')]=![];if(_0x440670){if(_0x54fa60[_0x0d10('0x74')][_0x0d10('0xa2')]){_0x54fa60[_0x0d10('0x75')][_0x0d10('0xa3')]({'id':0x0,'priority':_0x54fa60[_0x0d10('0x75')]['length']+0x1,'app':'close','appdata':'unmanaged','interval':'*,*,*,*'});}_0x54fa60['interaction']['created']=!![];}return db[_0x0d10('0xa4')][_0x0d10('0x5c')]({'phone':_0x54fa60[_0x0d10('0x5d')]['from'],'messageId':_0x54fa60[_0x0d10('0x5d')][_0x0d10('0x84')],'body':_0x54fa60[_0x0d10('0x5d')][_0x0d10('0x5d')],'SmsAccountId':_0x380e8d[_0x0d10('0x55')]['id'],'SmsInteractionId':_0x16a2f5['id'],'direction':'in','ContactId':_0x16a2f5[_0x0d10('0xa5')],'AttachmentId':_0x54fa60[_0x0d10('0x5d')][_0x0d10('0xa6')]});})['then'](function(_0x59144b){_0x54fa60[_0x0d10('0x28')]=_0x59144b;if(_0x54fa60[_0x0d10('0xa0')]['UserId']){return db['User'][_0x0d10('0x5b')]({'attributes':['id',_0x0d10('0x39')],'where':{'id':_0x54fa60[_0x0d10('0xa0')][_0x0d10('0xa7')]}})[_0x0d10('0x1f')](function(_0x2a9b25){if(_0x2a9b25){_0x54fa60[_0x0d10('0x75')][_0x0d10('0xa8')]({'id':0x0,'priority':0x0,'app':_0x0d10('0xa9'),'appdata':_0x2a9b25[_0x0d10('0x39')]+','+(_0x54fa60[_0x0d10('0x74')][_0x0d10('0xaa')]||0xa),'interval':_0x0d10('0xab')});}return respondWithRpcPromise(_0x0d10('0xac'),_0x0d10('0xad'),_0x54fa60);});}return respondWithRpcPromise(_0x0d10('0xac'),_0x0d10('0xad'),_0x54fa60);})['then'](function(_0x9f8ba4){if(_0x9f8ba4){var _0x8304f0=0xc8;var _0x188d7d=_0x0d10('0xae');logger[_0x0d10('0x20')](_0x0d10('0x24'),_0x188d7d,_0x8304f0,_0x0d10('0xaf'));logger[_0x0d10('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x188d7d,_0x8304f0,'entity\x20found',JSON[_0x0d10('0x25')](_0x9f8ba4));if(_0x54fa60[_0x0d10('0x74')][_0x0d10('0x42')]==='twilio'){return _0x1b88bf[_0x0d10('0x2b')](_0x8304f0)[_0x0d10('0x31')](_0x0d10('0xb0'),_0x0d10('0xb1'))[_0x0d10('0x3a')](_0x0d10('0xb2'));}else{return _0x1b88bf[_0x0d10('0x2b')](_0x8304f0)[_0x0d10('0x2c')](_0x9f8ba4);}}})[_0x0d10('0x53')](handleError(_0x1b88bf,null));};exports[_0x0d10('0xb3')]=function(_0x50c706,_0x380c76){var _0x40907b=_0x50c706[_0x0d10('0x55')]['id'];var _0x1e2e05=_0x50c706['body'];var _0x5d3043=0xc8;var _0x48cc98=null;return db[_0x0d10('0xb4')]['transaction']({'isolationLevel':db[_0x0d10('0xb4')][_0x0d10('0xb5')]['ISOLATION_LEVELS'][_0x0d10('0xb6')]},function(_0x63558e){return db[_0x0d10('0x3f')][_0x0d10('0x67')]({'where':{'id':_0x40907b},'transaction':_0x63558e})[_0x0d10('0x1f')](function(_0x511161){if(_0x511161){return db[_0x0d10('0x72')][_0x0d10('0x37')]({'where':{'SmsAccountId':_0x40907b},'transaction':_0x63558e})[_0x0d10('0x1f')](function(){var _0x48ae51=_['map'](_0x1e2e05,function(_0xfa7042){_0xfa7042[_0x0d10('0x69')]=_0x40907b;return _0xfa7042;});return db[_0x0d10('0x72')]['bulkCreate'](_0x48ae51,{'transaction':_0x63558e});});}else{_0x5d3043=0x194;_0x48cc98=[];}});})[_0x0d10('0x1f')](function(){if(_0x5d3043!==0x194){return db[_0x0d10('0x72')][_0x0d10('0xb7')]({'where':{'SmsAccountId':_0x40907b},'order':_0x0d10('0x77')})['then'](function(_0x2713ff){_0x48cc98=_0x2713ff;});}})[_0x0d10('0x53')](function(_0xb60599){_0x5d3043=0x1f4;logger['error'](_0xb60599[_0x0d10('0xb8')]);if(_0xb60599[_0x0d10('0x39')]){delete _0xb60599[_0x0d10('0x39')];}_0x48cc98=_0xb60599;})[_0x0d10('0xb9')](function(){if(_0x48cc98===null){_0x380c76['sendStatus'](_0x5d3043);}else{if(_0x5d3043===0x1f4){_0x380c76[_0x0d10('0x2b')](_0x5d3043)[_0x0d10('0x3a')](_0x48cc98);}else{_0x380c76[_0x0d10('0x2b')](_0x5d3043)[_0x0d10('0x2c')](_0x48cc98);}}});};exports[_0x0d10('0xba')]=function(_0xf5f251,_0x7d5f38,_0x20d71b){var _0x218beb={};var _0xb270bc={};var _0x555b6b;var _0x9142f0;return db['SmsAccount'][_0x0d10('0x67')]({'where':{'id':_0xf5f251['params']['id']}})[_0x0d10('0x1f')](handleEntityNotFound(_0x7d5f38,null))[_0x0d10('0x1f')](function(_0x12b628){if(_0x12b628){_0x555b6b=_0x12b628;_0xb270bc[_0x0d10('0x45')]=_[_0x0d10('0x56')](db[_0x0d10('0x72')][_0x0d10('0x40')]);_0xb270bc[_0x0d10('0x44')]=_['keys'](_0xf5f251[_0x0d10('0x44')]);_0xb270bc[_0x0d10('0x4d')]=_[_0x0d10('0x47')](_0xb270bc[_0x0d10('0x45')],_0xb270bc[_0x0d10('0x44')]);_0x218beb[_0x0d10('0x46')]=_[_0x0d10('0x47')](_0xb270bc['model'],qs['fields'](_0xf5f251[_0x0d10('0x44')]['fields']));_0x218beb[_0x0d10('0x46')]=_0x218beb['attributes'][_0x0d10('0x58')]?_0x218beb[_0x0d10('0x46')]:_0xb270bc[_0x0d10('0x45')];_0x218beb[_0x0d10('0x49')]=qs[_0x0d10('0x4a')](_0xf5f251['query'][_0x0d10('0x4a')]);_0x218beb['where']=qs[_0x0d10('0x4d')](_[_0x0d10('0x4c')](_0xf5f251[_0x0d10('0x44')],_0xb270bc[_0x0d10('0x4d')]));if(_0xf5f251['query'][_0x0d10('0x50')]){_0x218beb[_0x0d10('0x4b')]=_[_0x0d10('0x4e')](_0x218beb[_0x0d10('0x4b')],{'$or':_[_0x0d10('0x3e')](_0x218beb[_0x0d10('0x46')],function(_0x35fb18){var _0x5c7d05={};_0x5c7d05[_0x35fb18]={'$like':'%'+_0xf5f251[_0x0d10('0x44')][_0x0d10('0x50')]+'%'};return _0x5c7d05;})});}_0x218beb=_['merge']({},_0x218beb,_0xf5f251[_0x0d10('0x5a')]);return _0x555b6b[_0x0d10('0xba')](_0x218beb);}})[_0x0d10('0x1f')](function(_0x456af4){if(_0x456af4){_0x9142f0=_0x456af4['length'];if(!_0xf5f251[_0x0d10('0x44')][_0x0d10('0x48')](_0x0d10('0xbb'))){_0x218beb['limit']=qs[_0x0d10('0x2e')](_0xf5f251[_0x0d10('0x44')][_0x0d10('0x2e')]);_0x218beb['offset']=qs[_0x0d10('0x30')](_0xf5f251[_0x0d10('0x44')][_0x0d10('0x30')]);}return _0x555b6b[_0x0d10('0xba')](_0x218beb);}})['then'](function(_0x4255aa){if(_0x4255aa){return _0x4255aa?{'count':_0x9142f0,'rows':_0x4255aa}:null;}})['then'](respondWithResult(_0x7d5f38,null))['catch'](handleError(_0x7d5f38,null));};exports['getInteractions']=function(_0x5b3e30,_0x41abca,_0x2961d7){var _0x1c0215={'raw':![],'where':{}};var _0x22a408={};var _0x332fe5={'count':0x0,'rows':[]};return db[_0x0d10('0x3f')][_0x0d10('0x67')]({'where':{'id':_0x5b3e30[_0x0d10('0x55')]['id']}})[_0x0d10('0x1f')](handleEntityNotFound(_0x41abca,null))[_0x0d10('0x1f')](function(_0x13e1b6){if(_0x13e1b6){_0x22a408[_0x0d10('0x45')]=_[_0x0d10('0x56')](db['SmsInteraction'][_0x0d10('0x40')]);_0x22a408[_0x0d10('0x44')]=_[_0x0d10('0x56')](_0x5b3e30[_0x0d10('0x44')]);_0x22a408[_0x0d10('0x4d')]=_[_0x0d10('0x47')](_0x22a408[_0x0d10('0x45')],_0x22a408['query']);_0x1c0215['attributes']=_['intersection'](_0x22a408[_0x0d10('0x45')],qs['fields'](_0x5b3e30['query']['fields']));_0x1c0215[_0x0d10('0x46')]=_0x1c0215[_0x0d10('0x46')][_0x0d10('0x58')]?_0x1c0215['attributes']:_0x22a408['model'];if(!_0x5b3e30[_0x0d10('0x44')][_0x0d10('0x48')]('nolimit')){_0x1c0215['limit']=qs[_0x0d10('0x2e')](_0x5b3e30['query'][_0x0d10('0x2e')]);_0x1c0215[_0x0d10('0x30')]=qs[_0x0d10('0x30')](_0x5b3e30[_0x0d10('0x44')]['offset']);}_0x1c0215[_0x0d10('0x49')]=qs[_0x0d10('0x4a')](_0x5b3e30[_0x0d10('0x44')]['sort']);_0x1c0215[_0x0d10('0x4b')]=qs['filters'](_[_0x0d10('0x4c')](_0x5b3e30[_0x0d10('0x44')],_0x22a408[_0x0d10('0x4d')]));_0x1c0215[_0x0d10('0x4b')][_0x0d10('0x69')]=_0x13e1b6['id'];if(_0x5b3e30[_0x0d10('0x44')][_0x0d10('0x50')]){_0x1c0215['where']=_['merge'](_0x1c0215['where'],{'$or':_[_0x0d10('0x3e')](_0x1c0215[_0x0d10('0x46')],function(_0x5db3c1){var _0x599433={};_0x599433[_0x5db3c1]={'$like':'%'+_0x5b3e30[_0x0d10('0x44')][_0x0d10('0x50')]+'%'};return _0x599433;})});}_0x1c0215=_[_0x0d10('0x4e')]({},_0x1c0215,_0x5b3e30[_0x0d10('0x5a')]);return db[_0x0d10('0x9f')][_0x0d10('0x2f')]({'where':_0x1c0215['where']})[_0x0d10('0x1f')](function(_0x1a0505){_0x332fe5[_0x0d10('0x2f')]=_0x1a0505;if(_0x5b3e30['query'][_0x0d10('0x59')]){_0x1c0215[_0x0d10('0x51')]=[{'model':db[_0x0d10('0x79')],'as':_0x0d10('0xbc'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x0d10('0x39'),_0x0d10('0xbd'),_0x0d10('0xbe')],'required':![]},{'model':db[_0x0d10('0xbf')],'as':_0x0d10('0xc0'),'attributes':['id',_0x0d10('0x39'),_0x0d10('0xc1')],'where':_0x5b3e30[_0x0d10('0x44')]['tag']?{'id':_0x5b3e30[_0x0d10('0x44')][_0x0d10('0xc2')]}:undefined,'required':_0x5b3e30['query'][_0x0d10('0xc2')]?!![]:![]}];}return db[_0x0d10('0x9f')]['findAll'](_0x1c0215);})[_0x0d10('0x1f')](function(_0x5e4007){_0x332fe5[_0x0d10('0x52')]=_0x5e4007;return _0x332fe5;});}})[_0x0d10('0x1f')](respondWithFilteredResult(_0x41abca,_0x1c0215))[_0x0d10('0x53')](handleError(_0x41abca,null));};exports['send']=function(_0x3b41fd,_0x1922dc,_0x105280){var _0x14214b,_0x1344af,_0x2f4a1b;if(_[_0x0d10('0x97')](_0x3b41fd[_0x0d10('0x5d')][_0x0d10('0x5d')])||_0x3b41fd[_0x0d10('0x5d')][_0x0d10('0x5d')]===''){throw new db[(_0x0d10('0x7a'))][(_0x0d10('0x95'))](_0x0d10('0xc3'));}if(_[_0x0d10('0x97')](_0x3b41fd[_0x0d10('0x5d')]['to'])){throw new db['Sequelize'][(_0x0d10('0x95'))]('to\x20is\x20mandatory');}_0x14214b=_0x3b41fd[_0x0d10('0x5d')]['to'];return db[_0x0d10('0x3f')][_0x0d10('0x5b')]({'where':{'id':_0x3b41fd['params']['id']},'include':[{'model':db[_0x0d10('0x9a')],'as':_0x0d10('0xc4'),'include':[{'model':db[_0x0d10('0x79')],'as':'Contacts','where':{'mobile':_0x14214b},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x0d10('0x1f')](handleEntityNotFound(_0x1922dc,null))[_0x0d10('0x1f')](function(_0x463b18){if(_0x463b18&&_0x463b18[_0x0d10('0xc4')]){_0x1344af=_0x463b18[_0x0d10('0x61')]({'plain':!![]});if(_0x1344af[_0x0d10('0xc4')]&&_0x1344af[_0x0d10('0xc4')][_0x0d10('0x9b')]['length']){return _0x1344af[_0x0d10('0xc4')][_0x0d10('0x9b')][0x0];}return db[_0x0d10('0x79')][_0x0d10('0x5c')](_[_0x0d10('0x18')](_0x3b41fd[_0x0d10('0x5d')],{'firstName':_0x14214b,'mobile':_0x14214b,'phone':_0x14214b,'ListId':_0x1344af[_0x0d10('0x80')]}));}})['then'](handleEntityNotFound(_0x1922dc,null))[_0x0d10('0x1f')](function(_0x302da0){if(_0x302da0){_0x2f4a1b=_0x302da0;return db[_0x0d10('0x9f')]['find']({'where':{'ContactId':_0x2f4a1b['id'],'closed':![],'SmsAccountId':_0x1344af['id']}})[_0x0d10('0x1f')](function(_0x1700ed){if(_0x1700ed){return[_0x1700ed,![]];}return db[_0x0d10('0x9f')][_0x0d10('0x5c')]({'UserId':_0x3b41fd['user']['id'],'ContactId':_0x2f4a1b['id'],'SmsAccountId':_0x1344af['id'],'phone':_0x14214b,'firstMsgDirection':_0x0d10('0xc5'),'Messages':[_[_0x0d10('0x4e')](_0x3b41fd['body'],{'read':![],'body':_0x3b41fd[_0x0d10('0x5d')][_0x0d10('0x5d')],'phone':_0x14214b,'SmsAccountId':_0x1344af['id'],'UserId':_0x3b41fd[_0x0d10('0x5e')]['id'],'ContactId':_0x2f4a1b['id']})]},{'include':[{'model':db[_0x0d10('0xa4')],'as':_0x0d10('0xc6')}]})[_0x0d10('0x1f')](function(_0x2366ab){return[_0x2366ab,!![]];});});}})['spread'](function(_0x32bf05,_0x518591){if(_0x518591){return _0x32bf05;}return db[_0x0d10('0xa4')][_0x0d10('0x5c')](_[_0x0d10('0x4e')](_0x3b41fd[_0x0d10('0x5d')],{'read':![],'body':_0x3b41fd[_0x0d10('0x5d')][_0x0d10('0x5d')],'phone':_0x14214b,'SmsAccountId':_0x1344af['id'],'SmsInteractionId':_0x32bf05['id'],'UserId':_0x3b41fd[_0x0d10('0x5e')]['id'],'ContactId':_0x2f4a1b['id']}))['then'](function(_0x29409b){_0x32bf05[_0x0d10('0xc7')][_0x0d10('0xc6')]=[];_0x32bf05['dataValues']['Messages'][_0x0d10('0xa3')](_0x29409b[_0x0d10('0xc7')]);return _0x32bf05;});})[_0x0d10('0x1f')](respondWithResult(_0x1922dc,null))[_0x0d10('0x53')](handleError(_0x1922dc,null));};exports[_0x0d10('0x2b')]=function(_0x316698,_0x39bd5e,_0x5e85dd){if(_0x316698[_0x0d10('0x5d')]['id']){delete _0x316698[_0x0d10('0x5d')]['id'];}var _0x893930,_0x58e09e,_0x331fd8;return db[_0x0d10('0x3f')][_0x0d10('0x5b')]({'where':{'id':_0x316698['params']['id']}})['then'](handleEntityNotFound(_0x39bd5e,null))[_0x0d10('0x1f')](function(_0x906215){if(_0x906215){_0x331fd8=_0x906215;logger[_0x0d10('0x23')](_0x0d10('0x24'),_0x0d10('0x2b'),_0x0d10('0xc8'),_0x906215[_0x0d10('0x42')],util['inspect'](_0x316698[_0x0d10('0x5d')],{'showHidden':![],'depth':null}));switch(_0x906215[_0x0d10('0x42')]){case _0x0d10('0x85'):if(_0x316698[_0x0d10('0x5d')][_0x0d10('0xc9')]&&_0x316698[_0x0d10('0x5d')][_0x0d10('0x2b')]){_0x58e09e=_0x316698['body'][_0x0d10('0x2b')];return db[_0x0d10('0xa4')][_0x0d10('0x5b')]({'where':{'messageId':_0x316698[_0x0d10('0x5d')][_0x0d10('0xc9')]}});}break;case _0x0d10('0xca'):if(_0x316698[_0x0d10('0x5d')][_0x0d10('0xcb')]&&_0x316698['body']['statusInt']){_0x58e09e=_0x316698[_0x0d10('0x5d')]['statusInt'];return db['SmsMessage']['find']({'where':{'messageId':_0x316698[_0x0d10('0x5d')][_0x0d10('0xcb')]}});}break;case _0x0d10('0x88'):if(_0x316698[_0x0d10('0x5d')]['message_id']&&_0x316698['body']['status_code']){_0x58e09e=_0x316698[_0x0d10('0x5d')][_0x0d10('0xcc')];return db['SmsMessage']['find']({'where':{'messageId':_0x316698[_0x0d10('0x5d')][_0x0d10('0xcd')]}});}break;case _0x0d10('0x8b'):var _0x3bf60e=_0x316698[_0x0d10('0x5d')][_0x0d10('0x8c')][0x0];if(_0x3bf60e[_0x0d10('0x84')]&&_0x3bf60e['status'][_0x0d10('0xce')]==='DELIVERED'){_0x58e09e=_0x3bf60e[_0x0d10('0x2b')][_0x0d10('0xce')];return db[_0x0d10('0xa4')][_0x0d10('0x5b')]({'where':{'messageId':_0x3bf60e['messageId']}});}break;case _0x0d10('0x8f'):if(_0x316698[_0x0d10('0x5d')][_0x0d10('0x84')]&&_0x316698['body'][_0x0d10('0x2b')]){_0x58e09e=_0x316698[_0x0d10('0x5d')][_0x0d10('0x2b')];return db[_0x0d10('0xa4')][_0x0d10('0x5b')]({'where':{'messageId':_0x316698[_0x0d10('0x5d')]['messageId']}});}break;case _0x0d10('0x92'):if(_0x316698[_0x0d10('0x5d')][0x0][_0x0d10('0x28')]['id']){_0x58e09e=_0x316698['body'][0x0]['type'];return db[_0x0d10('0xa4')][_0x0d10('0x5b')]({'where':{'messageId':_0x316698[_0x0d10('0x5d')][0x0][_0x0d10('0x28')]['id']}});}break;case _0x0d10('0x93'):if(_0x316698[_0x0d10('0x5d')]['redif']&&_0x316698[_0x0d10('0x5d')][_0x0d10('0x2b')]){_0x58e09e=_0x316698[_0x0d10('0x5d')][_0x0d10('0x2b')];return db['SmsMessage'][_0x0d10('0x5b')]({'where':{'messageId':_0x316698['body']['redif']}});}break;}}})['then'](handleEntityNotFound(_0x39bd5e,null))[_0x0d10('0x1f')](function(_0x27318e){if(_0x27318e){_0x893930=_0x27318e;switch(_0x331fd8[_0x0d10('0x42')]){case _0x0d10('0x85'):if(_0x58e09e==='DELIVERED'){return _0x893930[_0x0d10('0x36')]({'read':!![]});}else{logger[_0x0d10('0x26')](_0x0d10('0x24'),_0x0d10('0x2b'),'skebby',util[_0x0d10('0xcf')](_0x316698[_0x0d10('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x0d10('0xca'):if(_0x58e09e==='1'){return _0x893930['update']({'read':!![]});}else{logger[_0x0d10('0x26')](_0x0d10('0x24'),'status',_0x0d10('0x85'),util[_0x0d10('0xcf')](_0x316698[_0x0d10('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x0d10('0x88'):if(!_0x316698['body'][_0x0d10('0xd0')]&&_0x58e09e>=0xc8&&_0x58e09e<=0xce){return _0x893930['update']({'read':!![]});}else{logger[_0x0d10('0x26')](_0x0d10('0x24'),'status','clicksend',util['inspect'](_0x316698[_0x0d10('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x0d10('0x8b'):var _0x1ba4f8=_0x316698[_0x0d10('0x5d')][_0x0d10('0x8c')][0x0];if(_0x1ba4f8[_0x0d10('0x2b')][_0x0d10('0xce')]===_0x0d10('0xd1')){return _0x893930[_0x0d10('0x36')]({'read':!![]});}else{logger[_0x0d10('0x26')](_0x0d10('0x24'),_0x0d10('0x2b'),_0x0d10('0x8b'),util[_0x0d10('0xcf')](_0x316698['body'],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x58e09e==_0x0d10('0xd2')||_0x58e09e==_0x0d10('0xd3')){return _0x893930['update']({'read':!![]});}else{logger[_0x0d10('0x26')](_0x0d10('0x24'),'status','clickatell',util[_0x0d10('0xcf')](_0x316698[_0x0d10('0x5d')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x58e09e==_0x0d10('0xd4')){return _0x893930['update']({'read':!![]});}else{logger[_0x0d10('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x0d10('0x2b'),'bandwidth',util['inspect'](_0x316698['body'],{'showHidden':![],'depth':null}));}break;case _0x0d10('0x93'):if(_0x58e09e===_0x0d10('0xd5')||_0x58e09e===_0x0d10('0xd6')){return _0x893930[_0x0d10('0x36')]({'read':!![]});}else{logger['error'](_0x0d10('0x24'),_0x0d10('0x2b'),_0x0d10('0x93'),util[_0x0d10('0xcf')](_0x316698[_0x0d10('0x5d')],{'showHidden':![],'depth':null}));}break;}return _0x893930;}})['then'](respondWithResult(_0x39bd5e,null))[_0x0d10('0x53')](handleError(_0x39bd5e,null));};exports[_0x0d10('0xd7')]=function(_0x16ea31,_0x982f65,_0x278dd8){var _0x476009,_0xb4c05b,_0x2193df;return db[_0x0d10('0x3f')][_0x0d10('0x5b')]({'where':{'id':_0x16ea31[_0x0d10('0x55')]['id']}})[_0x0d10('0x1f')](handleEntityNotFound(_0x982f65,null))[_0x0d10('0x1f')](function(_0x78cdee){if(_0x78cdee){_0x2193df=_0x78cdee;logger[_0x0d10('0x23')](_0x0d10('0x24'),_0x0d10('0x2b'),_0x0d10('0xc8'),_0x78cdee[_0x0d10('0x42')],util[_0x0d10('0xcf')](_0x16ea31['query'],{'showHidden':![],'depth':null}));switch(_0x78cdee[_0x0d10('0x42')]){case _0x0d10('0xd8'):if(_0x16ea31['query'][_0x0d10('0xd9')]&&_0x16ea31[_0x0d10('0x44')][_0x0d10('0xda')]){_0xb4c05b=_0x16ea31['query'][_0x0d10('0xda')];return db[_0x0d10('0xa4')][_0x0d10('0x5b')]({'where':{'messageId':_0x16ea31[_0x0d10('0x44')][_0x0d10('0xd9')]}});}break;}}})[_0x0d10('0x1f')](handleEntityNotFound(_0x982f65,null))[_0x0d10('0x1f')](function(_0x75c2e7){if(_0x75c2e7){_0x476009=_0x75c2e7;switch(_0x2193df['type']){case _0x0d10('0xd8'):if(_0xb4c05b==='2'||_0xb4c05b==='6'){return _0x476009[_0x0d10('0x36')]({'read':!![]});}else{logger['error'](_0x0d10('0x24'),'status','csc',util[_0x0d10('0xcf')](_0x16ea31[_0x0d10('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x476009;}})[_0x0d10('0x1f')](respondWithResult(_0x982f65,null))[_0x0d10('0x53')](handleError(_0x982f65,null));};exports[_0x0d10('0xdb')]=function(_0x15e53e,_0x1dcae5,_0x4ebbdc){return db['SmsAccount'][_0x0d10('0x5b')]({'where':{'id':_0x15e53e[_0x0d10('0x55')]['id']}})[_0x0d10('0x1f')](handleEntityNotFound(_0x1dcae5,null))['then'](function(_0x4b51a2){if(_0x4b51a2){return _0x4b51a2[_0x0d10('0xdb')](_0x15e53e[_0x0d10('0x5d')][_0x0d10('0x6f')],_[_0x0d10('0x9e')](_0x15e53e[_0x0d10('0x5d')],['ids','id'])||{})['spread'](function(_0x3dfb91){for(var _0x22ab52=0x0;_0x22ab52<_0x15e53e[_0x0d10('0x5d')][_0x0d10('0x6f')][_0x0d10('0x58')];_0x22ab52+=0x1){socket[_0x0d10('0xdc')](_0x0d10('0xdd'),{'UserId':Number(_0x15e53e[_0x0d10('0x5d')]['ids'][_0x22ab52]),'SmsAccountId':Number(_0x15e53e[_0x0d10('0x55')]['id'])});}return _0x3dfb91;});}})[_0x0d10('0x1f')](respondWithResult(_0x1dcae5,null))[_0x0d10('0x53')](handleError(_0x1dcae5,null));};exports['removeAgents']=function(_0x186cf4,_0x30ef1d,_0x29f34d){return db[_0x0d10('0x3f')][_0x0d10('0x5b')]({'where':{'id':_0x186cf4[_0x0d10('0x55')]['id']}})[_0x0d10('0x1f')](handleEntityNotFound(_0x30ef1d,null))[_0x0d10('0x1f')](function(_0x5439ff){if(_0x5439ff){return _0x5439ff[_0x0d10('0xde')](_0x186cf4[_0x0d10('0x44')]['ids'])[_0x0d10('0x1f')](function(){if(_[_0x0d10('0xdf')](_0x186cf4['query'][_0x0d10('0x6f')])){for(var _0x24762b=0x0;_0x24762b<_0x186cf4[_0x0d10('0x44')][_0x0d10('0x6f')]['length'];_0x24762b+=0x1){socket[_0x0d10('0xdc')](_0x0d10('0xe0'),{'UserId':Number(_0x186cf4[_0x0d10('0x44')][_0x0d10('0x6f')][_0x24762b]),'SmsAccountId':Number(_0x186cf4[_0x0d10('0x55')]['id'])});}}else{socket[_0x0d10('0xdc')](_0x0d10('0xe0'),{'UserId':Number(_0x186cf4[_0x0d10('0x44')]['ids']),'SmsAccountId':Number(_0x186cf4[_0x0d10('0x55')]['id'])});}});}})[_0x0d10('0x1f')](respondWithStatusCode(_0x30ef1d,null))[_0x0d10('0x53')](handleError(_0x30ef1d,null));};exports[_0x0d10('0xe1')]=function(_0x19204b,_0x2ab7cf,_0x2e2ba8){var _0x24612a={};var _0x553414={};var _0x275298;var _0x58e2b7;return db[_0x0d10('0x3f')][_0x0d10('0x67')]({'where':{'id':_0x19204b['params']['id']}})['then'](handleEntityNotFound(_0x2ab7cf,null))[_0x0d10('0x1f')](function(_0x23b880){if(_0x23b880){_0x275298=_0x23b880;_0x553414[_0x0d10('0x45')]=_[_0x0d10('0x56')](db[_0x0d10('0xe2')]['rawAttributes']);_0x553414[_0x0d10('0x44')]=_[_0x0d10('0x56')](_0x19204b['query']);_0x553414[_0x0d10('0x4d')]=_[_0x0d10('0x47')](_0x553414[_0x0d10('0x45')],_0x553414[_0x0d10('0x44')]);_0x24612a[_0x0d10('0x46')]=_[_0x0d10('0x47')](_0x553414[_0x0d10('0x45')],qs['fields'](_0x19204b[_0x0d10('0x44')][_0x0d10('0x57')]));_0x24612a[_0x0d10('0x46')]=_0x24612a[_0x0d10('0x46')]['length']?_0x24612a[_0x0d10('0x46')]:_0x553414[_0x0d10('0x45')];_0x24612a[_0x0d10('0x49')]=qs[_0x0d10('0x4a')](_0x19204b[_0x0d10('0x44')][_0x0d10('0x4a')]);_0x24612a[_0x0d10('0x4b')]=qs['filters'](_['pick'](_0x19204b[_0x0d10('0x44')],_0x553414[_0x0d10('0x4d')]));if(_0x19204b['query'][_0x0d10('0x50')]){_0x24612a['where']=_['merge'](_0x24612a[_0x0d10('0x4b')],{'$or':_['map'](_0x24612a[_0x0d10('0x46')],function(_0x179e07){var _0x298a71={};_0x298a71[_0x179e07]={'$like':'%'+_0x19204b[_0x0d10('0x44')][_0x0d10('0x50')]+'%'};return _0x298a71;})});}_0x24612a=_[_0x0d10('0x4e')]({},_0x24612a,_0x19204b['options']);return _0x275298[_0x0d10('0xe1')](_0x24612a);}})['then'](function(_0x103cd8){if(_0x103cd8){_0x58e2b7=_0x103cd8['length'];if(!_0x19204b[_0x0d10('0x44')][_0x0d10('0x48')](_0x0d10('0xbb'))){_0x24612a[_0x0d10('0x2e')]=qs[_0x0d10('0x2e')](_0x19204b['query'][_0x0d10('0x2e')]);_0x24612a[_0x0d10('0x30')]=qs[_0x0d10('0x30')](_0x19204b[_0x0d10('0x44')][_0x0d10('0x30')]);}return _0x275298[_0x0d10('0xe1')](_0x24612a);}})['then'](function(_0x222791){if(_0x222791){return _0x222791?{'count':_0x58e2b7,'rows':_0x222791}:null;}})[_0x0d10('0x1f')](respondWithResult(_0x2ab7cf,null))[_0x0d10('0x53')](handleError(_0x2ab7cf,null));}; \ No newline at end of file +var _0xc62e=['save','update','destroy','get','SmsAccounts','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map','SmsAccount','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','include','findAll','rows','show','params','includeAll','find','create','role','userProfileId','autoAssociation','body','describe','SmsAccountId','findOne','rawAttributes','nolimit','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','From','messageId','MessageSid','skebby','from','sender','text','clicksend','message_id','plivo','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','replyMessageId','intelepeer','refid','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','created','autoclose','push','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','Start','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','stringify','twilio','set','Content-Type','text/xml','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','finally','getApplications','getInteractions','Owner','internal','Tag','Tags','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','List','user','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','connectel','requestid','statusInt','status_code','groupName','DELIVERED','bandwidth','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','ACCEPTD','statusGet','message-id','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','lodash','crypto','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','SmsAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','result','catch','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0xc62e,0x190));var _0xec62=function(_0x5a4526,_0x521684){_0x5a4526=_0x5a4526-0x0;var _0x4d5f94=_0xc62e[_0x5a4526];return _0x4d5f94;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xec62('0x0'));var zipdir=require(_0xec62('0x1'));var jsonpatch=require(_0xec62('0x2'));var rp=require('request-promise');var moment=require(_0xec62('0x3'));var BPromise=require(_0xec62('0x4'));var Mustache=require(_0xec62('0x5'));var util=require(_0xec62('0x6'));var path=require(_0xec62('0x7'));var sox=require(_0xec62('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xec62('0x9'));var squel=require('squel');var crypto=require(_0xec62('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xec62('0xb'));var querystring=require(_0xec62('0xc'));var Papa=require(_0xec62('0xd'));var Redis=require('ioredis');var authService=require(_0xec62('0xe'));var qs=require(_0xec62('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xec62('0x10'));var logger=require(_0xec62('0x11'))(_0xec62('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xec62('0x13'));var db=require('../../mysqldb')['db'];config[_0xec62('0x14')]=_[_0xec62('0x15')](config['redis'],{'host':_0xec62('0x16'),'port':0x18eb});var socket=require(_0xec62('0x17'))(new Redis(config['redis']));require('./smsAccount.socket')[_0xec62('0x18')](socket);var jayson=require(_0xec62('0x19'));var client=jayson[_0xec62('0x1a')][_0xec62('0x1b')]({'port':0x232c});function respondWithRpcPromise(_0x56d523,_0x55250e,_0x4b5dad,_0x2c8412){return new BPromise(function(_0x10d058,_0x4eaa85){var _0x56548f=_0x2c8412||client;return _0x56548f[_0xec62('0x1c')](_0x56d523,_0x4b5dad)[_0xec62('0x1d')](function(_0x20f7df){logger['info'](_0xec62('0x1e'),_0x55250e,'request\x20sent');logger[_0xec62('0x1f')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x55250e,_0xec62('0x20'),JSON['stringify'](_0x20f7df));if(_0x20f7df[_0xec62('0x21')]){if(_0x20f7df[_0xec62('0x21')][_0xec62('0x22')]===0x1f4){logger[_0xec62('0x21')](_0xec62('0x1e'),_0x55250e,_0x20f7df[_0xec62('0x21')][_0xec62('0x23')]);return _0x4eaa85(_0x20f7df[_0xec62('0x21')][_0xec62('0x23')]);}logger['error'](_0xec62('0x1e'),_0x55250e,_0x20f7df[_0xec62('0x21')]['message']);return _0x10d058(_0x20f7df[_0xec62('0x21')][_0xec62('0x23')]);}else{logger[_0xec62('0x24')](_0xec62('0x1e'),_0x55250e,_0xec62('0x20'));_0x10d058(_0x20f7df[_0xec62('0x25')][_0xec62('0x23')]);}})[_0xec62('0x26')](function(_0x15708c){logger['error'](_0xec62('0x1e'),_0x55250e,_0x15708c);_0x4eaa85(_0x15708c);});});}function respondWithStatusCode(_0x59d69b,_0x464d92){_0x464d92=_0x464d92||0xcc;return function(_0x2a218f){if(_0x2a218f){return _0x59d69b[_0xec62('0x27')](_0x464d92);}return _0x59d69b[_0xec62('0x28')](_0x464d92)[_0xec62('0x29')]();};}function respondWithResult(_0x648746,_0x465608){_0x465608=_0x465608||0xc8;return function(_0x2ce4c5){if(_0x2ce4c5){return _0x648746[_0xec62('0x28')](_0x465608)['json'](_0x2ce4c5);}};}function respondWithFilteredResult(_0x5566da,_0x3d8386){return function(_0x18f047){if(_0x18f047){var _0x145243=typeof _0x3d8386[_0xec62('0x2a')]===_0xec62('0x2b')&&typeof _0x3d8386[_0xec62('0x2c')]===_0xec62('0x2b');var _0x482c6c=_0x18f047['count'];var _0x4a133e=_0x145243?0x0:_0x3d8386[_0xec62('0x2a')];var _0x3d2d48=_0x145243?_0x18f047[_0xec62('0x2d')]:_0x3d8386[_0xec62('0x2a')]+_0x3d8386[_0xec62('0x2c')];var _0x419326;if(_0x3d2d48>=_0x482c6c){_0x3d2d48=_0x482c6c;_0x419326=0xc8;}else{_0x419326=0xce;}_0x5566da['status'](_0x419326);return _0x5566da['set'](_0xec62('0x2e'),_0x4a133e+'-'+_0x3d2d48+'/'+_0x482c6c)[_0xec62('0x2f')](_0x18f047);}return null;};}function patchUpdates(_0x27d02c){return function(_0x4e0bd7){try{jsonpatch[_0xec62('0x30')](_0x4e0bd7,_0x27d02c,!![]);}catch(_0x3c2d1c){return BPromise[_0xec62('0x31')](_0x3c2d1c);}return _0x4e0bd7[_0xec62('0x32')]();};}function saveUpdates(_0x3f1f86,_0x215eff){return function(_0x44f104){if(_0x44f104){return _0x44f104[_0xec62('0x33')](_0x3f1f86)['then'](function(_0x15e48e){return _0x15e48e;});}return null;};}function removeEntity(_0x303ee3,_0x5a988c){return function(_0x27e38c){if(_0x27e38c){return _0x27e38c[_0xec62('0x34')]()[_0xec62('0x1d')](function(){var _0x2c4d77=_0x27e38c[_0xec62('0x35')]({'plain':!![]});var _0x7d73a7=_0xec62('0x36');return db[_0xec62('0x37')]['destroy']({'where':{'type':_0x7d73a7,'resourceId':_0x2c4d77['id']}})['then'](function(){return _0x27e38c;});})['then'](function(){_0x303ee3['status'](0xcc)[_0xec62('0x29')]();});}};}function handleEntityNotFound(_0x4b84b0,_0x30b6c0){return function(_0x33535f){if(!_0x33535f){_0x4b84b0[_0xec62('0x27')](0x194);}return _0x33535f;};}function handleError(_0x1c450c,_0x323167){_0x323167=_0x323167||0x1f4;return function(_0x585235){logger['error'](_0x585235[_0xec62('0x38')]);if(_0x585235[_0xec62('0x39')]){delete _0x585235[_0xec62('0x39')];}_0x1c450c[_0xec62('0x28')](_0x323167)[_0xec62('0x3a')](_0x585235);};}exports['index']=function(_0x5d9ac7,_0x4b737d){var _0x3cf38b={'include':[{'model':db[_0xec62('0x3b')],'as':_0xec62('0x3c')}]},_0xd03077={},_0xa71ca3={'count':0x0,'rows':[]};var _0x2aa1c1=_[_0xec62('0x3d')](db[_0xec62('0x3e')]['rawAttributes'],function(_0xe982b2){return{'name':_0xe982b2[_0xec62('0x3f')],'type':_0xe982b2[_0xec62('0x40')]['key']};});_0xd03077[_0xec62('0x41')]=_['map'](_0x2aa1c1,_0xec62('0x39'));_0xd03077[_0xec62('0x42')]=_[_0xec62('0x43')](_0x5d9ac7[_0xec62('0x42')]);_0xd03077[_0xec62('0x44')]=_['intersection'](_0xd03077[_0xec62('0x41')],_0xd03077[_0xec62('0x42')]);_0x3cf38b[_0xec62('0x45')]=_[_0xec62('0x46')](_0xd03077['model'],qs[_0xec62('0x47')](_0x5d9ac7['query']['fields']));_0x3cf38b[_0xec62('0x45')]=_0x3cf38b[_0xec62('0x45')][_0xec62('0x48')]?_0x3cf38b['attributes']:_0xd03077[_0xec62('0x41')];if(!_0x5d9ac7[_0xec62('0x42')][_0xec62('0x49')]('nolimit')){_0x3cf38b[_0xec62('0x2c')]=qs[_0xec62('0x2c')](_0x5d9ac7[_0xec62('0x42')][_0xec62('0x2c')]);_0x3cf38b['offset']=qs['offset'](_0x5d9ac7[_0xec62('0x42')][_0xec62('0x2a')]);}_0x3cf38b[_0xec62('0x4a')]=qs['sort'](_0x5d9ac7[_0xec62('0x42')][_0xec62('0x4b')]);_0x3cf38b[_0xec62('0x4c')]=qs[_0xec62('0x44')](_[_0xec62('0x4d')](_0x5d9ac7[_0xec62('0x42')],_0xd03077['filters']),_0x2aa1c1);if(_0x5d9ac7[_0xec62('0x42')][_0xec62('0x4e')]){_0x3cf38b[_0xec62('0x4c')]=_[_0xec62('0x4f')](_0x3cf38b[_0xec62('0x4c')],{'$or':_[_0xec62('0x3d')](_0x2aa1c1,function(_0x10f840){if(_0x10f840[_0xec62('0x40')]!=='VIRTUAL'){var _0x500de1={};_0x500de1[_0x10f840[_0xec62('0x39')]]={'$like':'%'+_0x5d9ac7[_0xec62('0x42')][_0xec62('0x4e')]+'%'};return _0x500de1;}})});}_0x3cf38b=_[_0xec62('0x4f')]({},_0x3cf38b,_0x5d9ac7[_0xec62('0x50')]);var _0x36e441={'where':_0x3cf38b['where']};return db[_0xec62('0x3e')][_0xec62('0x2d')](_0x36e441)[_0xec62('0x1d')](function(_0x17f450){_0xa71ca3[_0xec62('0x2d')]=_0x17f450;if(_0x5d9ac7[_0xec62('0x42')]['includeAll']){_0x3cf38b[_0xec62('0x51')]=[{'all':!![]}];}return db[_0xec62('0x3e')][_0xec62('0x52')](_0x3cf38b);})[_0xec62('0x1d')](function(_0x472f45){_0xa71ca3[_0xec62('0x53')]=_0x472f45;return _0xa71ca3;})[_0xec62('0x1d')](respondWithFilteredResult(_0x4b737d,_0x3cf38b))[_0xec62('0x26')](handleError(_0x4b737d,null));};exports[_0xec62('0x54')]=function(_0x2a0b29,_0x19f6f2){var _0x50efb8={'raw':![],'where':{'id':_0x2a0b29[_0xec62('0x55')]['id']},'include':[{'model':db[_0xec62('0x3b')],'as':_0xec62('0x3c')}]},_0xc9aa8={};_0xc9aa8[_0xec62('0x41')]=_[_0xec62('0x43')](db[_0xec62('0x3e')]['rawAttributes']);_0xc9aa8[_0xec62('0x42')]=_[_0xec62('0x43')](_0x2a0b29[_0xec62('0x42')]);_0xc9aa8[_0xec62('0x44')]=_[_0xec62('0x46')](_0xc9aa8[_0xec62('0x41')],_0xc9aa8[_0xec62('0x42')]);_0x50efb8[_0xec62('0x45')]=_[_0xec62('0x46')](_0xc9aa8[_0xec62('0x41')],qs[_0xec62('0x47')](_0x2a0b29[_0xec62('0x42')][_0xec62('0x47')]));_0x50efb8[_0xec62('0x45')]=_0x50efb8[_0xec62('0x45')][_0xec62('0x48')]?_0x50efb8[_0xec62('0x45')]:_0xc9aa8['model'];if(_0x2a0b29[_0xec62('0x42')][_0xec62('0x56')]){_0x50efb8[_0xec62('0x51')]=[{'all':!![]}];}_0x50efb8=_['merge']({},_0x50efb8,_0x2a0b29[_0xec62('0x50')]);return db['SmsAccount'][_0xec62('0x57')](_0x50efb8)[_0xec62('0x1d')](handleEntityNotFound(_0x19f6f2,null))[_0xec62('0x1d')](respondWithResult(_0x19f6f2,null))[_0xec62('0x26')](handleError(_0x19f6f2,null));};exports['create']=function(_0x3c6e1d,_0x599d57){return db[_0xec62('0x3e')][_0xec62('0x58')](_0x3c6e1d['body'],{})[_0xec62('0x1d')](function(_0x573d51){var _0x2d6ab1=_0x3c6e1d['user'][_0xec62('0x35')]({'plain':!![]});if(!_0x2d6ab1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2d6ab1[_0xec62('0x59')]==='user'){var _0xe8d7a4=_0x573d51[_0xec62('0x35')]({'plain':!![]});var _0x13a9cc=_0xec62('0x36');return db['UserProfileSection'][_0xec62('0x57')]({'where':{'name':_0x13a9cc,'userProfileId':_0x2d6ab1[_0xec62('0x5a')]},'raw':!![]})['then'](function(_0x246213){if(_0x246213&&_0x246213[_0xec62('0x5b')]===0x0){return db[_0xec62('0x37')]['create']({'name':_0xe8d7a4['name'],'resourceId':_0xe8d7a4['id'],'type':_0x246213[_0xec62('0x39')],'sectionId':_0x246213['id']},{})[_0xec62('0x1d')](function(){return _0x573d51;});}else{return _0x573d51;}})[_0xec62('0x26')](function(_0x133758){logger[_0xec62('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x133758);throw _0x133758;});}return _0x573d51;})[_0xec62('0x1d')](respondWithResult(_0x599d57,0xc9))[_0xec62('0x26')](handleError(_0x599d57,null));};exports[_0xec62('0x33')]=function(_0xce042a,_0x131a01){if(_0xce042a['body']['id']){delete _0xce042a['body']['id'];}return db['SmsAccount'][_0xec62('0x57')]({'where':{'id':_0xce042a[_0xec62('0x55')]['id']},'include':[{'model':db[_0xec62('0x3b')],'as':'mandatoryDispositionPause'}]})[_0xec62('0x1d')](handleEntityNotFound(_0x131a01,null))[_0xec62('0x1d')](saveUpdates(_0xce042a[_0xec62('0x5c')],null))[_0xec62('0x1d')](respondWithResult(_0x131a01,null))[_0xec62('0x26')](handleError(_0x131a01,null));};exports[_0xec62('0x34')]=function(_0x227e33,_0x1df31a){return db[_0xec62('0x3e')][_0xec62('0x57')]({'where':{'id':_0x227e33[_0xec62('0x55')]['id']}})[_0xec62('0x1d')](handleEntityNotFound(_0x1df31a,null))['then'](removeEntity(_0x1df31a,null))['catch'](handleError(_0x1df31a,null));};exports[_0xec62('0x5d')]=function(_0x32ec2e,_0x2ebd2a){return db['SmsAccount'][_0xec62('0x5d')]()[_0xec62('0x1d')](respondWithResult(_0x2ebd2a,null))[_0xec62('0x26')](handleError(_0x2ebd2a,null));};exports['addDisposition']=function(_0x1943c5,_0xe0452,_0x3c4bdb){if(_0x1943c5['body']['id']){delete _0x1943c5[_0xec62('0x5c')]['id'];}return db[_0xec62('0x3e')]['find']({'where':{'id':_0x1943c5[_0xec62('0x55')]['id']}})[_0xec62('0x1d')](handleEntityNotFound(_0xe0452,null))[_0xec62('0x1d')](function(_0x3c9f35){if(_0x3c9f35){_0x1943c5['body'][_0xec62('0x5e')]=_0x3c9f35['id'];return db['Disposition'][_0xec62('0x58')](_0x1943c5[_0xec62('0x5c')]);}})[_0xec62('0x1d')](respondWithResult(_0xe0452,null))[_0xec62('0x26')](handleError(_0xe0452,null));};exports['getDispositions']=function(_0x5df8a3,_0x4e3888,_0x24e205){var _0x3e93b2={'raw':![],'where':{}};var _0x17d1b9={};var _0x4b788a={'count':0x0,'rows':[]};return db[_0xec62('0x3e')][_0xec62('0x5f')]({'where':{'id':_0x5df8a3['params']['id']}})[_0xec62('0x1d')](handleEntityNotFound(_0x4e3888,null))[_0xec62('0x1d')](function(_0x44a32a){if(_0x44a32a){_0x17d1b9['model']=_['keys'](db['Disposition'][_0xec62('0x60')]);_0x17d1b9[_0xec62('0x42')]=_['keys'](_0x5df8a3[_0xec62('0x42')]);_0x17d1b9[_0xec62('0x44')]=_[_0xec62('0x46')](_0x17d1b9['model'],_0x17d1b9[_0xec62('0x42')]);_0x3e93b2[_0xec62('0x45')]=_[_0xec62('0x46')](_0x17d1b9[_0xec62('0x41')],qs[_0xec62('0x47')](_0x5df8a3['query']['fields']));_0x3e93b2[_0xec62('0x45')]=_0x3e93b2['attributes'][_0xec62('0x48')]?_0x3e93b2[_0xec62('0x45')]:_0x17d1b9[_0xec62('0x41')];if(!_0x5df8a3[_0xec62('0x42')][_0xec62('0x49')](_0xec62('0x61'))){_0x3e93b2[_0xec62('0x2c')]=qs[_0xec62('0x2c')](_0x5df8a3[_0xec62('0x42')][_0xec62('0x2c')]);_0x3e93b2[_0xec62('0x2a')]=qs[_0xec62('0x2a')](_0x5df8a3[_0xec62('0x42')][_0xec62('0x2a')]);}_0x3e93b2[_0xec62('0x4a')]=qs['sort'](_0x5df8a3[_0xec62('0x42')][_0xec62('0x4b')]);_0x3e93b2['where']=qs['filters'](_[_0xec62('0x4d')](_0x5df8a3[_0xec62('0x42')],_0x17d1b9[_0xec62('0x44')]));_0x3e93b2[_0xec62('0x4c')]['SmsAccountId']=_0x44a32a['id'];if(_0x5df8a3[_0xec62('0x42')][_0xec62('0x4e')]){_0x3e93b2['where']=_['merge'](_0x3e93b2[_0xec62('0x4c')],{'$or':_[_0xec62('0x3d')](_0x3e93b2[_0xec62('0x45')],function(_0x343321){var _0x2701b6={};_0x2701b6[_0x343321]={'$like':'%'+_0x5df8a3[_0xec62('0x42')][_0xec62('0x4e')]+'%'};return _0x2701b6;})});}_0x3e93b2=_[_0xec62('0x4f')]({},_0x3e93b2,_0x5df8a3[_0xec62('0x50')]);return db['Disposition'][_0xec62('0x2d')]({'where':_0x3e93b2[_0xec62('0x4c')]})[_0xec62('0x1d')](function(_0x1f5b8b){_0x4b788a['count']=_0x1f5b8b;if(_0x5df8a3[_0xec62('0x42')][_0xec62('0x56')]){_0x3e93b2['include']=[{'all':!![]}];}return db[_0xec62('0x62')][_0xec62('0x52')](_0x3e93b2);})[_0xec62('0x1d')](function(_0x5d82b8){_0x4b788a[_0xec62('0x53')]=_0x5d82b8;return _0x4b788a;});}})[_0xec62('0x1d')](respondWithFilteredResult(_0x4e3888,_0x3e93b2))['catch'](handleError(_0x4e3888,null));};exports['removeDispositions']=function(_0x236fce,_0x441d98,_0x1f8e73){return db[_0xec62('0x3e')][_0xec62('0x57')]({'where':{'id':_0x236fce[_0xec62('0x55')]['id']}})[_0xec62('0x1d')](handleEntityNotFound(_0x441d98,null))['then'](function(_0x16f3a6){if(_0x16f3a6){return _0x16f3a6[_0xec62('0x63')](_0x236fce[_0xec62('0x42')][_0xec62('0x64')]);}})['then'](respondWithStatusCode(_0x441d98,null))['catch'](handleError(_0x441d98,null));};exports[_0xec62('0x65')]=function(_0xcb6938,_0xa03ff6,_0x458cb9){if(_0xcb6938[_0xec62('0x5c')]['id']){delete _0xcb6938[_0xec62('0x5c')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0xcb6938[_0xec62('0x55')]['id']}})[_0xec62('0x1d')](handleEntityNotFound(_0xa03ff6,null))['then'](function(_0x3b325e){if(_0x3b325e){_0xcb6938[_0xec62('0x5c')][_0xec62('0x5e')]=_0x3b325e['id'];return db[_0xec62('0x66')][_0xec62('0x58')](_0xcb6938[_0xec62('0x5c')]);}})[_0xec62('0x1d')](respondWithResult(_0xa03ff6,null))[_0xec62('0x26')](handleError(_0xa03ff6,null));};exports[_0xec62('0x67')]=function(_0x1a38d8,_0x1d7aec,_0x577d73){var _0x593634={'raw':![],'where':{}};var _0x4f1314={};var _0x282f23={'count':0x0,'rows':[]};return db[_0xec62('0x3e')][_0xec62('0x5f')]({'where':{'id':_0x1a38d8[_0xec62('0x55')]['id']}})['then'](handleEntityNotFound(_0x1d7aec,null))['then'](function(_0x52f568){if(_0x52f568){_0x4f1314[_0xec62('0x41')]=_[_0xec62('0x43')](db[_0xec62('0x66')][_0xec62('0x60')]);_0x4f1314[_0xec62('0x42')]=_[_0xec62('0x43')](_0x1a38d8['query']);_0x4f1314['filters']=_['intersection'](_0x4f1314[_0xec62('0x41')],_0x4f1314[_0xec62('0x42')]);_0x593634['attributes']=_[_0xec62('0x46')](_0x4f1314[_0xec62('0x41')],qs[_0xec62('0x47')](_0x1a38d8['query'][_0xec62('0x47')]));_0x593634[_0xec62('0x45')]=_0x593634[_0xec62('0x45')]['length']?_0x593634[_0xec62('0x45')]:_0x4f1314[_0xec62('0x41')];if(!_0x1a38d8['query'][_0xec62('0x49')](_0xec62('0x61'))){_0x593634[_0xec62('0x2c')]=qs[_0xec62('0x2c')](_0x1a38d8[_0xec62('0x42')][_0xec62('0x2c')]);_0x593634['offset']=qs['offset'](_0x1a38d8[_0xec62('0x42')][_0xec62('0x2a')]);}_0x593634['order']=qs[_0xec62('0x4b')](_0x1a38d8[_0xec62('0x42')][_0xec62('0x4b')]);_0x593634['where']=qs['filters'](_['pick'](_0x1a38d8['query'],_0x4f1314[_0xec62('0x44')]));_0x593634[_0xec62('0x4c')][_0xec62('0x5e')]=_0x52f568['id'];if(_0x1a38d8['query'][_0xec62('0x4e')]){_0x593634[_0xec62('0x4c')]=_[_0xec62('0x4f')](_0x593634[_0xec62('0x4c')],{'$or':_[_0xec62('0x3d')](_0x593634[_0xec62('0x45')],function(_0x2b3b46){var _0x510c88={};_0x510c88[_0x2b3b46]={'$like':'%'+_0x1a38d8['query'][_0xec62('0x4e')]+'%'};return _0x510c88;})});}_0x593634=_['merge']({},_0x593634,_0x1a38d8[_0xec62('0x50')]);return db[_0xec62('0x66')][_0xec62('0x2d')]({'where':_0x593634['where']})[_0xec62('0x1d')](function(_0x4217b3){_0x282f23[_0xec62('0x2d')]=_0x4217b3;if(_0x1a38d8[_0xec62('0x42')]['includeAll']){_0x593634[_0xec62('0x51')]=[{'all':!![]}];}return db[_0xec62('0x66')]['findAll'](_0x593634);})[_0xec62('0x1d')](function(_0x2bbd05){_0x282f23[_0xec62('0x53')]=_0x2bbd05;return _0x282f23;});}})[_0xec62('0x1d')](respondWithFilteredResult(_0x1d7aec,_0x593634))[_0xec62('0x26')](handleError(_0x1d7aec,null));};exports['removeAnswers']=function(_0x20dbb8,_0x13ea6b,_0x344fdd){return db[_0xec62('0x3e')][_0xec62('0x57')]({'where':{'id':_0x20dbb8[_0xec62('0x55')]['id']}})[_0xec62('0x1d')](handleEntityNotFound(_0x13ea6b,null))[_0xec62('0x1d')](function(_0x1cb0c2){if(_0x1cb0c2){return _0x1cb0c2[_0xec62('0x68')](_0x20dbb8[_0xec62('0x42')][_0xec62('0x64')]);}})[_0xec62('0x1d')](respondWithStatusCode(_0x13ea6b,null))['catch'](handleError(_0x13ea6b,null));};exports[_0xec62('0x69')]=function(_0x5a561d,_0x326d6f,_0x241671){var _0x2fd5c9={'channel':_0xec62('0x6a')};var _0x306fb4=[];var _0x1c26a7=[];var _0x124125={};return db[_0xec62('0x3e')][_0xec62('0x57')]({'where':{'id':_0x5a561d[_0xec62('0x55')]['id']},'include':[{'model':db[_0xec62('0x6b')],'as':_0xec62('0x6c')}]})[_0xec62('0x1d')](handleEntityNotFound(_0x326d6f,null))[_0xec62('0x1d')](function(_0x241539){_0x2fd5c9[_0xec62('0x6d')]=_0x241539;_0x2fd5c9[_0xec62('0x6e')]=_[_0xec62('0x6f')](_0x241539['Applications'],[_0xec62('0x70')],[_0xec62('0x71')]);if(_0x2fd5c9[_0xec62('0x6d')][_0xec62('0x6c')]){delete _0x2fd5c9[_0xec62('0x6d')]['Applications'];}return db[_0xec62('0x72')]['describe']();})[_0xec62('0x1d')](function(_0x3bc253){if(!_0x3bc253){throw new db[(_0xec62('0x73'))][(_0xec62('0x74'))](_0xec62('0x75'));}_0x306fb4=_[_0xec62('0x76')](_[_0xec62('0x43')](_0x3bc253),[_0xec62('0x77'),_0xec62('0x78')]);_0x1c26a7=_[_0xec62('0x76')](_['keys'](_0x3bc253),['createdAt','updatedAt',_0xec62('0x79'),'ListId']);_0x2fd5c9['body']={'mapKey':'mobile'};if(_0x2fd5c9[_0xec62('0x6d')][_0xec62('0x40')]){switch(_0x2fd5c9['account'][_0xec62('0x40')]){case'twilio':_0x2fd5c9['body']['from']=_0x5a561d['body'][_0xec62('0x7a')];_0x2fd5c9[_0xec62('0x5c')][_0xec62('0x5c')]=_0x5a561d[_0xec62('0x5c')]['Body'];_0x2fd5c9[_0xec62('0x5c')][_0xec62('0x7b')]=_0x5a561d['body'][_0xec62('0x7c')];break;case _0xec62('0x7d'):_0x2fd5c9['body'][_0xec62('0x7e')]='+'+_0x5a561d[_0xec62('0x5c')][_0xec62('0x7f')];_0x2fd5c9[_0xec62('0x5c')]['body']=_0x5a561d[_0xec62('0x5c')][_0xec62('0x80')];break;case'connectel':_0x2fd5c9['body'][_0xec62('0x7e')]=_0x5a561d[_0xec62('0x5c')][_0xec62('0x7e')];_0x2fd5c9[_0xec62('0x5c')][_0xec62('0x5c')]=_0x5a561d[_0xec62('0x5c')][_0xec62('0x23')];break;case _0xec62('0x81'):_0x2fd5c9['body']['from']=_0x5a561d[_0xec62('0x5c')]['from'];_0x2fd5c9['body'][_0xec62('0x5c')]=_0x5a561d['body']['body'];_0x2fd5c9[_0xec62('0x5c')][_0xec62('0x7b')]=_0x5a561d['body'][_0xec62('0x82')];break;case _0xec62('0x83'):_0x2fd5c9[_0xec62('0x5c')][_0xec62('0x7e')]=_0x5a561d['body'][_0xec62('0x7a')];_0x2fd5c9[_0xec62('0x5c')]['body']=_0x5a561d['body']['Text'];_0x2fd5c9[_0xec62('0x5c')]['messageId']=_0x5a561d['body'][_0xec62('0x84')];break;case _0xec62('0x85'):_0x2fd5c9[_0xec62('0x5c')][_0xec62('0x7e')]='+'+_0x5a561d['body'][_0xec62('0x86')][0x0][_0xec62('0x7e')];_0x2fd5c9[_0xec62('0x5c')][_0xec62('0x5c')]=_0x5a561d[_0xec62('0x5c')][_0xec62('0x86')][0x0]['text'];_0x2fd5c9[_0xec62('0x5c')][_0xec62('0x7b')]=_0x5a561d[_0xec62('0x5c')]['results'][0x0][_0xec62('0x7b')];break;case _0xec62('0x87'):_0x2fd5c9['body'][_0xec62('0x7e')]=_0x5a561d[_0xec62('0x5c')][_0xec62('0x88')];_0x2fd5c9['body']['body']=_0x5a561d[_0xec62('0x5c')][_0xec62('0x89')][_0xec62('0x23')];break;case _0xec62('0x8a'):_0x2fd5c9['body'][_0xec62('0x7e')]=_0x5a561d[_0xec62('0x5c')]['fromNumber'];_0x2fd5c9[_0xec62('0x5c')][_0xec62('0x5c')]=_0x5a561d['body'][_0xec62('0x80')];_0x2fd5c9[_0xec62('0x5c')]['messageId']=_0x5a561d[_0xec62('0x5c')][_0xec62('0x8b')];break;case'bandwidth':_0x2fd5c9[_0xec62('0x5c')][_0xec62('0x7b')]=_0x5a561d[_0xec62('0x5c')][0x0][_0xec62('0x23')]['id'];_0x2fd5c9[_0xec62('0x5c')][_0xec62('0x7e')]=_0x5a561d['body'][0x0]['message'][_0xec62('0x7e')];_0x2fd5c9[_0xec62('0x5c')]['body']=_0x5a561d[_0xec62('0x5c')][0x0][_0xec62('0x23')][_0xec62('0x80')];break;case _0xec62('0x8c'):_0x2fd5c9[_0xec62('0x5c')]['from']=_0x5a561d[_0xec62('0x5c')][_0xec62('0x7e')];_0x2fd5c9[_0xec62('0x5c')][_0xec62('0x5c')]=_0x5a561d[_0xec62('0x5c')]['message'];_0x2fd5c9[_0xec62('0x5c')][_0xec62('0x7b')]=_0x5a561d[_0xec62('0x5c')][_0xec62('0x8d')];break;}}if(_0x2fd5c9[_0xec62('0x5c')]['id']){delete _0x2fd5c9[_0xec62('0x5c')]['id'];}if(_[_0xec62('0x8e')](_0x2fd5c9[_0xec62('0x5c')]['from'])){throw new db['Sequelize'][(_0xec62('0x74'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x2fd5c9[_0xec62('0x5c')][_0xec62('0x5c')])||_0x2fd5c9['body'][_0xec62('0x5c')]===''){throw new db[(_0xec62('0x73'))][(_0xec62('0x74'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xec62('0x8e')](_0x2fd5c9[_0xec62('0x5c')][_0xec62('0x8f')])){throw new db['Sequelize']['ValidationError'](_0xec62('0x90')+_0x1c26a7);}if(!_[_0xec62('0x91')](_0x1c26a7,_0x2fd5c9[_0xec62('0x5c')][_0xec62('0x8f')])){throw new db[(_0xec62('0x73'))][(_0xec62('0x74'))](_0xec62('0x92')+_0x1c26a7);}_0x124125[_0x2fd5c9['body'][_0xec62('0x8f')]]=_0x2fd5c9[_0xec62('0x5c')]['from'];return db[_0xec62('0x93')][_0xec62('0x57')]({'where':{'id':_0x2fd5c9[_0xec62('0x6d')][_0xec62('0x94')]},'include':[{'model':db['CmContact'],'as':_0xec62('0x95'),'where':_0x124125,'limit':0x1,'order':[['updatedAt',_0xec62('0x96')]]}]});})[_0xec62('0x1d')](handleEntityNotFound(_0x326d6f,null))['then'](function(_0x312877){if(_0x312877){_0x2fd5c9[_0xec62('0x97')]=_[_0xec62('0x98')](_0x312877,[_0xec62('0x95')]);if(_0x312877[_0xec62('0x95')][_0xec62('0x48')]){return _0x312877[_0xec62('0x95')][0x0];}var _0x2990ae=_['defaults'](_0x2fd5c9['body'],{'firstName':_0x2fd5c9['body']['from'],'ListId':_0x312877['id']});_0x2990ae[_0x2fd5c9[_0xec62('0x5c')]['mapKey']]=_0x2fd5c9['body'][_0xec62('0x7e')];return db[_0xec62('0x72')]['create'](_0x2990ae,{'fields':_0x306fb4,'raw':!![]});}})[_0xec62('0x1d')](handleEntityNotFound(_0x326d6f,null))[_0xec62('0x1d')](function(_0x2d0c48){if(_0x2d0c48){_0x2fd5c9[_0xec62('0x99')]=_0x2d0c48;var _0x404f9c={'ContactId':_0x2d0c48['id'],'phone':_0x2fd5c9[_0xec62('0x5c')]['from'],'SmsAccountId':_0x5a561d['params']['id']};var _0x307cb6={'ContactId':_0x2d0c48['id'],'SmsAccountId':_0x5a561d[_0xec62('0x55')]['id'],'closed':![]};return db[_0xec62('0x9a')]['find']({'where':_0x307cb6})[_0xec62('0x1d')](function(_0x3cf20d){if(_0x3cf20d){return[_0x3cf20d,![]];}return db[_0xec62('0x9a')][_0xec62('0x58')](_0x404f9c)[_0xec62('0x1d')](function(_0x10006e){return[_0x10006e,!![]];});});}})[_0xec62('0x9b')](function(_0x27c1d6,_0x1a2033){_0x2fd5c9[_0xec62('0x9c')]=_0x27c1d6[_0xec62('0x35')]({'plain':!![]});_0x2fd5c9[_0xec62('0x9c')][_0xec62('0x9d')]=![];if(_0x1a2033){if(_0x2fd5c9[_0xec62('0x6d')][_0xec62('0x9e')]){_0x2fd5c9[_0xec62('0x6e')][_0xec62('0x9f')]({'id':0x0,'priority':_0x2fd5c9[_0xec62('0x6e')][_0xec62('0x48')]+0x1,'app':'close','appdata':_0xec62('0xa0'),'interval':_0xec62('0xa1')});}_0x2fd5c9[_0xec62('0x9c')][_0xec62('0x9d')]=!![];}return db[_0xec62('0xa2')][_0xec62('0x58')]({'phone':_0x2fd5c9['body']['from'],'messageId':_0x2fd5c9[_0xec62('0x5c')][_0xec62('0x7b')],'body':_0x2fd5c9[_0xec62('0x5c')]['body'],'SmsAccountId':_0x5a561d[_0xec62('0x55')]['id'],'SmsInteractionId':_0x27c1d6['id'],'direction':'in','ContactId':_0x27c1d6[_0xec62('0xa3')],'AttachmentId':_0x2fd5c9[_0xec62('0x5c')][_0xec62('0xa4')]});})['then'](function(_0x2e90a9){_0x2fd5c9[_0xec62('0x23')]=_0x2e90a9;if(_0x2fd5c9[_0xec62('0x9c')]['UserId']){return db[_0xec62('0xa5')][_0xec62('0x57')]({'attributes':['id',_0xec62('0x39')],'where':{'id':_0x2fd5c9[_0xec62('0x9c')][_0xec62('0xa6')]}})['then'](function(_0x3d7bed){if(_0x3d7bed){_0x2fd5c9[_0xec62('0x6e')][_0xec62('0xa7')]({'id':0x0,'priority':0x0,'app':_0xec62('0xa8'),'appdata':_0x3d7bed[_0xec62('0x39')]+','+(_0x2fd5c9[_0xec62('0x6d')][_0xec62('0xa9')]||0xa),'interval':_0xec62('0xa1')});}return respondWithRpcPromise('Start','startRouting',_0x2fd5c9);});}return respondWithRpcPromise(_0xec62('0xaa'),'startRouting',_0x2fd5c9);})[_0xec62('0x1d')](function(_0x151a53){if(_0x151a53){var _0x304099=0xc8;var _0x2d678e=_0xec62('0xab');logger[_0xec62('0x24')](_0xec62('0xac'),_0x2d678e,_0x304099,_0xec62('0xad'));logger[_0xec62('0x1f')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x2d678e,_0x304099,_0xec62('0xad'),JSON[_0xec62('0xae')](_0x151a53));if(_0x2fd5c9[_0xec62('0x6d')]['type']===_0xec62('0xaf')){return _0x326d6f[_0xec62('0x28')](_0x304099)[_0xec62('0xb0')](_0xec62('0xb1'),_0xec62('0xb2'))[_0xec62('0x3a')]('\x0a');}else{return _0x326d6f[_0xec62('0x28')](_0x304099)[_0xec62('0x2f')](_0x151a53);}}})[_0xec62('0x26')](handleError(_0x326d6f,null));};exports[_0xec62('0xb3')]=function(_0x19af5f,_0x483462){var _0x509163=_0x19af5f[_0xec62('0x55')]['id'];var _0x3815e4=_0x19af5f[_0xec62('0x5c')];var _0x2029d7=0xc8;var _0x255294=null;return db[_0xec62('0xb4')][_0xec62('0xb5')]({'isolationLevel':db['sequelize'][_0xec62('0xb6')][_0xec62('0xb7')][_0xec62('0xb8')]},function(_0x2fc8b9){return db[_0xec62('0x3e')][_0xec62('0x5f')]({'where':{'id':_0x509163},'transaction':_0x2fc8b9})[_0xec62('0x1d')](function(_0x479c67){if(_0x479c67){return db[_0xec62('0x6b')][_0xec62('0x34')]({'where':{'SmsAccountId':_0x509163},'transaction':_0x2fc8b9})[_0xec62('0x1d')](function(){var _0x163c1f=_[_0xec62('0x3d')](_0x3815e4,function(_0x22f62c){_0x22f62c[_0xec62('0x5e')]=_0x509163;return _0x22f62c;});return db[_0xec62('0x6b')][_0xec62('0xb9')](_0x163c1f,{'transaction':_0x2fc8b9});});}else{_0x2029d7=0x194;_0x255294=[];}});})[_0xec62('0x1d')](function(){if(_0x2029d7!==0x194){return db[_0xec62('0x6b')]['findAndCountAll']({'where':{'SmsAccountId':_0x509163},'order':'priority'})[_0xec62('0x1d')](function(_0xdf8b3){_0x255294=_0xdf8b3;});}})['catch'](function(_0x2ea81e){_0x2029d7=0x1f4;logger['error'](_0x2ea81e[_0xec62('0x38')]);if(_0x2ea81e[_0xec62('0x39')]){delete _0x2ea81e[_0xec62('0x39')];}_0x255294=_0x2ea81e;})[_0xec62('0xba')](function(){if(_0x255294===null){_0x483462[_0xec62('0x27')](_0x2029d7);}else{if(_0x2029d7===0x1f4){_0x483462[_0xec62('0x28')](_0x2029d7)['send'](_0x255294);}else{_0x483462[_0xec62('0x28')](_0x2029d7)[_0xec62('0x2f')](_0x255294);}}});};exports['getApplications']=function(_0x44450e,_0x386c01,_0x1f3c06){var _0x3ce71f={};var _0xb63d3b={};var _0xbc4fb4;var _0x100876;return db[_0xec62('0x3e')][_0xec62('0x5f')]({'where':{'id':_0x44450e[_0xec62('0x55')]['id']}})['then'](handleEntityNotFound(_0x386c01,null))[_0xec62('0x1d')](function(_0x3384af){if(_0x3384af){_0xbc4fb4=_0x3384af;_0xb63d3b[_0xec62('0x41')]=_['keys'](db[_0xec62('0x6b')][_0xec62('0x60')]);_0xb63d3b[_0xec62('0x42')]=_[_0xec62('0x43')](_0x44450e[_0xec62('0x42')]);_0xb63d3b[_0xec62('0x44')]=_[_0xec62('0x46')](_0xb63d3b[_0xec62('0x41')],_0xb63d3b[_0xec62('0x42')]);_0x3ce71f[_0xec62('0x45')]=_['intersection'](_0xb63d3b['model'],qs[_0xec62('0x47')](_0x44450e['query'][_0xec62('0x47')]));_0x3ce71f[_0xec62('0x45')]=_0x3ce71f['attributes'][_0xec62('0x48')]?_0x3ce71f[_0xec62('0x45')]:_0xb63d3b[_0xec62('0x41')];_0x3ce71f[_0xec62('0x4a')]=qs[_0xec62('0x4b')](_0x44450e[_0xec62('0x42')]['sort']);_0x3ce71f[_0xec62('0x4c')]=qs[_0xec62('0x44')](_[_0xec62('0x4d')](_0x44450e['query'],_0xb63d3b[_0xec62('0x44')]));if(_0x44450e[_0xec62('0x42')]['filter']){_0x3ce71f[_0xec62('0x4c')]=_['merge'](_0x3ce71f[_0xec62('0x4c')],{'$or':_['map'](_0x3ce71f[_0xec62('0x45')],function(_0x3c8f2f){var _0x1f81ff={};_0x1f81ff[_0x3c8f2f]={'$like':'%'+_0x44450e[_0xec62('0x42')][_0xec62('0x4e')]+'%'};return _0x1f81ff;})});}_0x3ce71f=_['merge']({},_0x3ce71f,_0x44450e[_0xec62('0x50')]);return _0xbc4fb4[_0xec62('0xbb')](_0x3ce71f);}})[_0xec62('0x1d')](function(_0x459d05){if(_0x459d05){_0x100876=_0x459d05[_0xec62('0x48')];if(!_0x44450e[_0xec62('0x42')][_0xec62('0x49')](_0xec62('0x61'))){_0x3ce71f['limit']=qs[_0xec62('0x2c')](_0x44450e[_0xec62('0x42')][_0xec62('0x2c')]);_0x3ce71f[_0xec62('0x2a')]=qs['offset'](_0x44450e[_0xec62('0x42')][_0xec62('0x2a')]);}return _0xbc4fb4[_0xec62('0xbb')](_0x3ce71f);}})['then'](function(_0x48c99a){if(_0x48c99a){return _0x48c99a?{'count':_0x100876,'rows':_0x48c99a}:null;}})[_0xec62('0x1d')](respondWithResult(_0x386c01,null))[_0xec62('0x26')](handleError(_0x386c01,null));};exports[_0xec62('0xbc')]=function(_0x2338fc,_0x51c4b3,_0x2ee10c){var _0x1ee721={'raw':![],'where':{}};var _0x53be25={};var _0x5e1269={'count':0x0,'rows':[]};return db['SmsAccount'][_0xec62('0x5f')]({'where':{'id':_0x2338fc[_0xec62('0x55')]['id']}})['then'](handleEntityNotFound(_0x51c4b3,null))[_0xec62('0x1d')](function(_0x2e63aa){if(_0x2e63aa){_0x53be25[_0xec62('0x41')]=_['keys'](db[_0xec62('0x9a')]['rawAttributes']);_0x53be25[_0xec62('0x42')]=_['keys'](_0x2338fc[_0xec62('0x42')]);_0x53be25[_0xec62('0x44')]=_[_0xec62('0x46')](_0x53be25[_0xec62('0x41')],_0x53be25['query']);_0x1ee721[_0xec62('0x45')]=_['intersection'](_0x53be25[_0xec62('0x41')],qs[_0xec62('0x47')](_0x2338fc['query'][_0xec62('0x47')]));_0x1ee721['attributes']=_0x1ee721[_0xec62('0x45')][_0xec62('0x48')]?_0x1ee721[_0xec62('0x45')]:_0x53be25[_0xec62('0x41')];if(!_0x2338fc[_0xec62('0x42')]['hasOwnProperty'](_0xec62('0x61'))){_0x1ee721['limit']=qs['limit'](_0x2338fc[_0xec62('0x42')][_0xec62('0x2c')]);_0x1ee721[_0xec62('0x2a')]=qs['offset'](_0x2338fc['query'][_0xec62('0x2a')]);}_0x1ee721[_0xec62('0x4a')]=qs[_0xec62('0x4b')](_0x2338fc[_0xec62('0x42')][_0xec62('0x4b')]);_0x1ee721[_0xec62('0x4c')]=qs[_0xec62('0x44')](_['pick'](_0x2338fc[_0xec62('0x42')],_0x53be25[_0xec62('0x44')]));_0x1ee721[_0xec62('0x4c')][_0xec62('0x5e')]=_0x2e63aa['id'];if(_0x2338fc[_0xec62('0x42')][_0xec62('0x4e')]){_0x1ee721[_0xec62('0x4c')]=_['merge'](_0x1ee721['where'],{'$or':_[_0xec62('0x3d')](_0x1ee721[_0xec62('0x45')],function(_0x9b9229){var _0x416c85={};_0x416c85[_0x9b9229]={'$like':'%'+_0x2338fc['query']['filter']+'%'};return _0x416c85;})});}_0x1ee721=_['merge']({},_0x1ee721,_0x2338fc[_0xec62('0x50')]);return db[_0xec62('0x9a')][_0xec62('0x2d')]({'where':_0x1ee721[_0xec62('0x4c')]})[_0xec62('0x1d')](function(_0x489934){_0x5e1269[_0xec62('0x2d')]=_0x489934;if(_0x2338fc[_0xec62('0x42')][_0xec62('0x56')]){_0x1ee721[_0xec62('0x51')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0xec62('0xa5')],'as':_0xec62('0xbd'),'attributes':['name','fullname',_0xec62('0xbe')],'required':![]},{'model':db[_0xec62('0xbf')],'as':_0xec62('0xc0'),'attributes':['id',_0xec62('0x39'),'color'],'where':_0x2338fc[_0xec62('0x42')]['tag']?{'id':_0x2338fc['query'][_0xec62('0xc1')]}:undefined,'required':_0x2338fc[_0xec62('0x42')]['tag']?!![]:![]}];}return db[_0xec62('0x9a')][_0xec62('0x52')](_0x1ee721);})[_0xec62('0x1d')](function(_0x5d3545){_0x5e1269[_0xec62('0x53')]=_0x5d3545;return _0x5e1269;});}})[_0xec62('0x1d')](respondWithFilteredResult(_0x51c4b3,_0x1ee721))[_0xec62('0x26')](handleError(_0x51c4b3,null));};exports[_0xec62('0x3a')]=function(_0x4a3ff0,_0x4c6358,_0x5eaa24){var _0x1960dd,_0x54b400,_0x2a57e6;if(_[_0xec62('0x8e')](_0x4a3ff0[_0xec62('0x5c')][_0xec62('0x5c')])||_0x4a3ff0[_0xec62('0x5c')][_0xec62('0x5c')]===''){throw new db[(_0xec62('0x73'))]['ValidationError'](_0xec62('0xc2'));}if(_['isNil'](_0x4a3ff0['body']['to'])){throw new db[(_0xec62('0x73'))][(_0xec62('0x74'))]('to\x20is\x20mandatory');}_0x1960dd=_0x4a3ff0['body']['to'];return db[_0xec62('0x3e')][_0xec62('0x57')]({'where':{'id':_0x4a3ff0[_0xec62('0x55')]['id']},'include':[{'model':db[_0xec62('0x93')],'as':_0xec62('0xc3'),'include':[{'model':db[_0xec62('0x72')],'as':_0xec62('0x95'),'where':{'mobile':_0x1960dd},'limit':0x1,'order':[[_0xec62('0x78'),_0xec62('0x96')]]}]}]})[_0xec62('0x1d')](handleEntityNotFound(_0x4c6358,null))[_0xec62('0x1d')](function(_0x1146eb){if(_0x1146eb&&_0x1146eb[_0xec62('0xc3')]){_0x54b400=_0x1146eb[_0xec62('0x35')]({'plain':!![]});if(_0x54b400[_0xec62('0xc3')]&&_0x54b400[_0xec62('0xc3')][_0xec62('0x95')][_0xec62('0x48')]){return _0x54b400['List'][_0xec62('0x95')][0x0];}return db['CmContact'][_0xec62('0x58')](_[_0xec62('0x15')](_0x4a3ff0['body'],{'firstName':_0x1960dd,'mobile':_0x1960dd,'phone':_0x1960dd,'ListId':_0x54b400['ListId']}));}})[_0xec62('0x1d')](handleEntityNotFound(_0x4c6358,null))[_0xec62('0x1d')](function(_0x4d12ac){if(_0x4d12ac){_0x2a57e6=_0x4d12ac;return db[_0xec62('0x9a')]['find']({'where':{'ContactId':_0x2a57e6['id'],'closed':![],'SmsAccountId':_0x54b400['id']}})[_0xec62('0x1d')](function(_0x4d94a0){if(_0x4d94a0){return[_0x4d94a0,![]];}return db[_0xec62('0x9a')][_0xec62('0x58')]({'UserId':_0x4a3ff0[_0xec62('0xc4')]['id'],'ContactId':_0x2a57e6['id'],'SmsAccountId':_0x54b400['id'],'phone':_0x1960dd,'firstMsgDirection':_0xec62('0xc5'),'Messages':[_['merge'](_0x4a3ff0['body'],{'read':![],'body':_0x4a3ff0[_0xec62('0x5c')][_0xec62('0x5c')],'phone':_0x1960dd,'SmsAccountId':_0x54b400['id'],'UserId':_0x4a3ff0[_0xec62('0xc4')]['id'],'ContactId':_0x2a57e6['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0xec62('0xc6')}]})[_0xec62('0x1d')](function(_0x56a070){return[_0x56a070,!![]];});});}})['spread'](function(_0x3dd4a1,_0x9b6629){if(_0x9b6629){return _0x3dd4a1;}return db['SmsMessage'][_0xec62('0x58')](_['merge'](_0x4a3ff0['body'],{'read':![],'body':_0x4a3ff0[_0xec62('0x5c')]['body'],'phone':_0x1960dd,'SmsAccountId':_0x54b400['id'],'SmsInteractionId':_0x3dd4a1['id'],'UserId':_0x4a3ff0[_0xec62('0xc4')]['id'],'ContactId':_0x2a57e6['id']}))[_0xec62('0x1d')](function(_0x5abac9){_0x3dd4a1[_0xec62('0xc7')]['Messages']=[];_0x3dd4a1[_0xec62('0xc7')][_0xec62('0xc6')][_0xec62('0x9f')](_0x5abac9['dataValues']);return _0x3dd4a1;});})[_0xec62('0x1d')](respondWithResult(_0x4c6358,null))['catch'](handleError(_0x4c6358,null));};exports[_0xec62('0x28')]=function(_0x304a62,_0x6e45a9,_0x359f6f){if(_0x304a62[_0xec62('0x5c')]['id']){delete _0x304a62[_0xec62('0x5c')]['id'];}var _0x4811b5,_0x1f03ca,_0x54aa97;return db[_0xec62('0x3e')][_0xec62('0x57')]({'where':{'id':_0x304a62[_0xec62('0x55')]['id']}})['then'](handleEntityNotFound(_0x6e45a9,null))[_0xec62('0x1d')](function(_0x190348){if(_0x190348){_0x54aa97=_0x190348;logger[_0xec62('0x1f')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xec62('0x28'),_0xec62('0xc8'),_0x190348['type'],util[_0xec62('0xc9')](_0x304a62['body'],{'showHidden':![],'depth':null}));switch(_0x190348[_0xec62('0x40')]){case'skebby':if(_0x304a62['body'][_0xec62('0xca')]&&_0x304a62['body'][_0xec62('0x28')]){_0x1f03ca=_0x304a62[_0xec62('0x5c')][_0xec62('0x28')];return db['SmsMessage'][_0xec62('0x57')]({'where':{'messageId':_0x304a62[_0xec62('0x5c')]['skebby_dispatch_id']}});}break;case _0xec62('0xcb'):if(_0x304a62[_0xec62('0x5c')][_0xec62('0xcc')]&&_0x304a62['body'][_0xec62('0xcd')]){_0x1f03ca=_0x304a62[_0xec62('0x5c')][_0xec62('0xcd')];return db[_0xec62('0xa2')]['find']({'where':{'messageId':_0x304a62[_0xec62('0x5c')]['requestid']}});}break;case _0xec62('0x81'):if(_0x304a62[_0xec62('0x5c')]['message_id']&&_0x304a62[_0xec62('0x5c')][_0xec62('0xce')]){_0x1f03ca=_0x304a62[_0xec62('0x5c')][_0xec62('0xce')];return db['SmsMessage'][_0xec62('0x57')]({'where':{'messageId':_0x304a62['body']['message_id']}});}break;case _0xec62('0x85'):var _0x3b2ea1=_0x304a62[_0xec62('0x5c')]['results'][0x0];if(_0x3b2ea1['messageId']&&_0x3b2ea1['status'][_0xec62('0xcf')]===_0xec62('0xd0')){_0x1f03ca=_0x3b2ea1['status'][_0xec62('0xcf')];return db[_0xec62('0xa2')][_0xec62('0x57')]({'where':{'messageId':_0x3b2ea1[_0xec62('0x7b')]}});}break;case _0xec62('0x8a'):if(_0x304a62[_0xec62('0x5c')]['messageId']&&_0x304a62[_0xec62('0x5c')][_0xec62('0x28')]){_0x1f03ca=_0x304a62[_0xec62('0x5c')][_0xec62('0x28')];return db[_0xec62('0xa2')][_0xec62('0x57')]({'where':{'messageId':_0x304a62[_0xec62('0x5c')][_0xec62('0x7b')]}});}break;case _0xec62('0xd1'):if(_0x304a62[_0xec62('0x5c')][0x0][_0xec62('0x23')]['id']){_0x1f03ca=_0x304a62['body'][0x0][_0xec62('0x40')];return db[_0xec62('0xa2')][_0xec62('0x57')]({'where':{'messageId':_0x304a62[_0xec62('0x5c')][0x0]['message']['id']}});}break;case _0xec62('0x8c'):if(_0x304a62[_0xec62('0x5c')][_0xec62('0xd2')]&&_0x304a62[_0xec62('0x5c')]['status']){_0x1f03ca=_0x304a62[_0xec62('0x5c')][_0xec62('0x28')];return db[_0xec62('0xa2')][_0xec62('0x57')]({'where':{'messageId':_0x304a62[_0xec62('0x5c')][_0xec62('0xd2')]}});}break;}}})[_0xec62('0x1d')](handleEntityNotFound(_0x6e45a9,null))[_0xec62('0x1d')](function(_0x4cbb8d){if(_0x4cbb8d){_0x4811b5=_0x4cbb8d;switch(_0x54aa97[_0xec62('0x40')]){case _0xec62('0x7d'):if(_0x1f03ca==='DELIVERED'){return _0x4811b5[_0xec62('0x33')]({'read':!![]});}else{logger[_0xec62('0x21')](_0xec62('0xac'),'status','skebby',util['inspect'](_0x304a62[_0xec62('0x5c')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x1f03ca==='1'){return _0x4811b5[_0xec62('0x33')]({'read':!![]});}else{logger['error'](_0xec62('0xac'),_0xec62('0x28'),'skebby',util[_0xec62('0xc9')](_0x304a62[_0xec62('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xec62('0x81'):if(!_0x304a62[_0xec62('0x5c')][_0xec62('0xd3')]&&_0x1f03ca>=0xc8&&_0x1f03ca<=0xce){return _0x4811b5[_0xec62('0x33')]({'read':!![]});}else{logger[_0xec62('0x21')](_0xec62('0xac'),_0xec62('0x28'),_0xec62('0x81'),util[_0xec62('0xc9')](_0x304a62[_0xec62('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xec62('0x85'):var _0x8b1871=_0x304a62['body'][_0xec62('0x86')][0x0];if(_0x8b1871[_0xec62('0x28')][_0xec62('0xcf')]===_0xec62('0xd0')){return _0x4811b5[_0xec62('0x33')]({'read':!![]});}else{logger[_0xec62('0x21')](_0xec62('0xac'),'status','infobip',util['inspect'](_0x304a62[_0xec62('0x5c')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x1f03ca==_0xec62('0xd4')||_0x1f03ca==_0xec62('0xd5')){return _0x4811b5[_0xec62('0x33')]({'read':!![]});}else{logger[_0xec62('0x21')](_0xec62('0xac'),'status',_0xec62('0x8a'),util[_0xec62('0xc9')](_0x304a62[_0xec62('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xec62('0xd1'):if(_0x1f03ca==_0xec62('0xd6')){return _0x4811b5[_0xec62('0x33')]({'read':!![]});}else{logger[_0xec62('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','bandwidth',util[_0xec62('0xc9')](_0x304a62['body'],{'showHidden':![],'depth':null}));}break;case _0xec62('0x8c'):if(_0x1f03ca==='DELIVRD'||_0x1f03ca===_0xec62('0xd7')){return _0x4811b5['update']({'read':!![]});}else{logger[_0xec62('0x21')](_0xec62('0xac'),_0xec62('0x28'),_0xec62('0x8c'),util[_0xec62('0xc9')](_0x304a62[_0xec62('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x4811b5;}})[_0xec62('0x1d')](respondWithResult(_0x6e45a9,null))['catch'](handleError(_0x6e45a9,null));};exports[_0xec62('0xd8')]=function(_0x426632,_0x3d7772,_0x5e811c){var _0x494e9c,_0x4e35ec,_0x3acbee;return db[_0xec62('0x3e')][_0xec62('0x57')]({'where':{'id':_0x426632[_0xec62('0x55')]['id']}})[_0xec62('0x1d')](handleEntityNotFound(_0x3d7772,null))[_0xec62('0x1d')](function(_0x59cb9b){if(_0x59cb9b){_0x3acbee=_0x59cb9b;logger[_0xec62('0x1f')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xec62('0x28'),_0xec62('0xc8'),_0x59cb9b[_0xec62('0x40')],util[_0xec62('0xc9')](_0x426632[_0xec62('0x42')],{'showHidden':![],'depth':null}));switch(_0x59cb9b[_0xec62('0x40')]){case _0xec62('0x87'):if(_0x426632[_0xec62('0x42')]['message-id']&&_0x426632[_0xec62('0x42')]['state']){_0x4e35ec=_0x426632[_0xec62('0x42')]['state'];return db[_0xec62('0xa2')]['find']({'where':{'messageId':_0x426632[_0xec62('0x42')][_0xec62('0xd9')]}});}break;}}})[_0xec62('0x1d')](handleEntityNotFound(_0x3d7772,null))['then'](function(_0x44da02){if(_0x44da02){_0x494e9c=_0x44da02;switch(_0x3acbee['type']){case _0xec62('0x87'):if(_0x4e35ec==='2'||_0x4e35ec==='6'){return _0x494e9c[_0xec62('0x33')]({'read':!![]});}else{logger['error'](_0xec62('0xac'),_0xec62('0x28'),_0xec62('0x87'),util[_0xec62('0xc9')](_0x426632['query'],{'showHidden':![],'depth':null}));};break;}return _0x494e9c;}})[_0xec62('0x1d')](respondWithResult(_0x3d7772,null))[_0xec62('0x26')](handleError(_0x3d7772,null));};exports[_0xec62('0xda')]=function(_0x2e6e0e,_0x2cbde0,_0x4ba345){return db[_0xec62('0x3e')][_0xec62('0x57')]({'where':{'id':_0x2e6e0e[_0xec62('0x55')]['id']}})[_0xec62('0x1d')](handleEntityNotFound(_0x2cbde0,null))[_0xec62('0x1d')](function(_0x5c4297){if(_0x5c4297){return _0x5c4297[_0xec62('0xda')](_0x2e6e0e['body'][_0xec62('0x64')],_['omit'](_0x2e6e0e[_0xec62('0x5c')],[_0xec62('0x64'),'id'])||{})[_0xec62('0x9b')](function(_0x3f60d0){for(var _0x307eb2=0x0;_0x307eb2<_0x2e6e0e['body'][_0xec62('0x64')][_0xec62('0x48')];_0x307eb2+=0x1){socket[_0xec62('0xdb')](_0xec62('0xdc'),{'UserId':Number(_0x2e6e0e[_0xec62('0x5c')]['ids'][_0x307eb2]),'SmsAccountId':Number(_0x2e6e0e[_0xec62('0x55')]['id'])});}return _0x3f60d0;});}})[_0xec62('0x1d')](respondWithResult(_0x2cbde0,null))[_0xec62('0x26')](handleError(_0x2cbde0,null));};exports['removeAgents']=function(_0xd3a4c0,_0x23262c,_0x29a525){return db[_0xec62('0x3e')][_0xec62('0x57')]({'where':{'id':_0xd3a4c0['params']['id']}})[_0xec62('0x1d')](handleEntityNotFound(_0x23262c,null))[_0xec62('0x1d')](function(_0x365144){if(_0x365144){return _0x365144[_0xec62('0xdd')](_0xd3a4c0[_0xec62('0x42')]['ids'])[_0xec62('0x1d')](function(){if(_[_0xec62('0xde')](_0xd3a4c0['query']['ids'])){for(var _0x110634=0x0;_0x110634<_0xd3a4c0[_0xec62('0x42')]['ids'][_0xec62('0x48')];_0x110634+=0x1){socket['emit'](_0xec62('0xdf'),{'UserId':Number(_0xd3a4c0[_0xec62('0x42')][_0xec62('0x64')][_0x110634]),'SmsAccountId':Number(_0xd3a4c0[_0xec62('0x55')]['id'])});}}else{socket['emit'](_0xec62('0xdf'),{'UserId':Number(_0xd3a4c0[_0xec62('0x42')]['ids']),'SmsAccountId':Number(_0xd3a4c0[_0xec62('0x55')]['id'])});}});}})['then'](respondWithStatusCode(_0x23262c,null))[_0xec62('0x26')](handleError(_0x23262c,null));};exports[_0xec62('0xe0')]=function(_0x5d4fda,_0x26a748,_0xca9765){var _0x3c8f6c={};var _0x455ad7={};var _0x1f6393;var _0x5701b2;return db[_0xec62('0x3e')]['findOne']({'where':{'id':_0x5d4fda[_0xec62('0x55')]['id']}})[_0xec62('0x1d')](handleEntityNotFound(_0x26a748,null))[_0xec62('0x1d')](function(_0x40dd90){if(_0x40dd90){_0x1f6393=_0x40dd90;_0x455ad7[_0xec62('0x41')]=_['keys'](db['User'][_0xec62('0x60')]);_0x455ad7['query']=_[_0xec62('0x43')](_0x5d4fda[_0xec62('0x42')]);_0x455ad7[_0xec62('0x44')]=_['intersection'](_0x455ad7['model'],_0x455ad7[_0xec62('0x42')]);_0x3c8f6c[_0xec62('0x45')]=_[_0xec62('0x46')](_0x455ad7[_0xec62('0x41')],qs[_0xec62('0x47')](_0x5d4fda[_0xec62('0x42')][_0xec62('0x47')]));_0x3c8f6c[_0xec62('0x45')]=_0x3c8f6c['attributes'][_0xec62('0x48')]?_0x3c8f6c[_0xec62('0x45')]:_0x455ad7[_0xec62('0x41')];_0x3c8f6c[_0xec62('0x4a')]=qs[_0xec62('0x4b')](_0x5d4fda[_0xec62('0x42')][_0xec62('0x4b')]);_0x3c8f6c[_0xec62('0x4c')]=qs['filters'](_[_0xec62('0x4d')](_0x5d4fda[_0xec62('0x42')],_0x455ad7['filters']));if(_0x5d4fda['query'][_0xec62('0x4e')]){_0x3c8f6c[_0xec62('0x4c')]=_['merge'](_0x3c8f6c[_0xec62('0x4c')],{'$or':_[_0xec62('0x3d')](_0x3c8f6c[_0xec62('0x45')],function(_0x1775a0){var _0x5b8cf0={};_0x5b8cf0[_0x1775a0]={'$like':'%'+_0x5d4fda['query']['filter']+'%'};return _0x5b8cf0;})});}_0x3c8f6c=_[_0xec62('0x4f')]({},_0x3c8f6c,_0x5d4fda[_0xec62('0x50')]);return _0x1f6393['getAgents'](_0x3c8f6c);}})[_0xec62('0x1d')](function(_0x190b60){if(_0x190b60){_0x5701b2=_0x190b60[_0xec62('0x48')];if(!_0x5d4fda[_0xec62('0x42')][_0xec62('0x49')]('nolimit')){_0x3c8f6c[_0xec62('0x2c')]=qs[_0xec62('0x2c')](_0x5d4fda[_0xec62('0x42')][_0xec62('0x2c')]);_0x3c8f6c[_0xec62('0x2a')]=qs[_0xec62('0x2a')](_0x5d4fda[_0xec62('0x42')][_0xec62('0x2a')]);}return _0x1f6393['getAgents'](_0x3c8f6c);}})[_0xec62('0x1d')](function(_0x2e99fe){if(_0x2e99fe){return _0x2e99fe?{'count':_0x5701b2,'rows':_0x2e99fe}:null;}})[_0xec62('0x1d')](respondWithResult(_0x26a748,null))[_0xec62('0x26')](handleError(_0x26a748,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index e30042a..c100530 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 _0x0cab=['SmsAccount','setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x405657,_0x5d2317){var _0x5e3e84=function(_0x55d8f2){while(--_0x55d8f2){_0x405657['push'](_0x405657['shift']());}};_0x5e3e84(++_0x5d2317);}(_0x0cab,0x166));var _0xb0ca=function(_0x4c5cbe,_0x24fbe5){_0x4c5cbe=_0x4c5cbe-0x0;var _0x52d809=_0x0cab[_0x4c5cbe];return _0x52d809;};'use strict';var EventEmitter=require(_0xb0ca('0x0'));var SmsAccount=require(_0xb0ca('0x1'))['db'][_0xb0ca('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xb0ca('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xb0ca('0x4')};function emitEvent(_0x38c5be){return function(_0x1bc472,_0x13d698,_0x595e80){SmsAccountEvents[_0xb0ca('0x5')](_0x38c5be+':'+_0x1bc472['id'],_0x1bc472);SmsAccountEvents['emit'](_0x38c5be,_0x1bc472);_0x595e80(null);};}for(var e in events){if(events[_0xb0ca('0x6')](e)){var event=events[e];SmsAccount[_0xb0ca('0x7')](e,emitEvent(event));}}module[_0xb0ca('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0x59bb=['update','remove','emit','hook','exports','events','../../mysqldb','SmsAccount','setMaxListeners','save'];(function(_0x338861,_0x4d7206){var _0x5c95d9=function(_0x156167){while(--_0x156167){_0x338861['push'](_0x338861['shift']());}};_0x5c95d9(++_0x4d7206);}(_0x59bb,0x181));var _0xb59b=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x59bb[_0x3e5086];return _0xfeb102;};'use strict';var EventEmitter=require(_0xb59b('0x0'));var SmsAccount=require(_0xb59b('0x1'))['db'][_0xb59b('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xb59b('0x3')](0x0);var events={'afterCreate':_0xb59b('0x4'),'afterUpdate':_0xb59b('0x5'),'afterDestroy':_0xb59b('0x6')};function emitEvent(_0x1a9f85){return function(_0x4fd756,_0x3209ba,_0x5a83d0){SmsAccountEvents[_0xb59b('0x7')](_0x1a9f85+':'+_0x4fd756['id'],_0x4fd756);SmsAccountEvents[_0xb59b('0x7')](_0x1a9f85,_0x4fd756);_0x5a83d0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0xb59b('0x8')](e,emitEvent(event));}}module[_0xb59b('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 3f49000..c9cb643 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 _0x1de5=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts'];(function(_0x16c659,_0x8f7257){var _0x5a08f5=function(_0x2fd0bb){while(--_0x2fd0bb){_0x16c659['push'](_0x16c659['shift']());}};_0x5a08f5(++_0x8f7257);}(_0x1de5,0x118));var _0x51de=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0x1de5[_0x45bf86];return _0x1f02b7;};'use strict';var _=require(_0x51de('0x0'));var util=require(_0x51de('0x1'));var logger=require(_0x51de('0x2'))(_0x51de('0x3'));var moment=require(_0x51de('0x4'));var BPromise=require(_0x51de('0x5'));var rp=require(_0x51de('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x51de('0x7'));var config=require(_0x51de('0x8'));var attributes=require(_0x51de('0x9'));module[_0x51de('0xa')]=function(_0x3713ae,_0x4e1a86){return _0x3713ae[_0x51de('0xb')](_0x51de('0xc'),attributes,{'tableName':_0x51de('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c1a=['../../config/environment','exports','sms_accounts','lodash','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3e4785,_0x5a7d7e){var _0x127dad=function(_0x13c32e){while(--_0x13c32e){_0x3e4785['push'](_0x3e4785['shift']());}};_0x127dad(++_0x5a7d7e);}(_0x2c1a,0x1bb));var _0xa2c1=function(_0x113037,_0x39e670){_0x113037=_0x113037-0x0;var _0x42c84c=_0x2c1a[_0x113037];return _0x42c84c;};'use strict';var _=require(_0xa2c1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa2c1('0x1'));var moment=require(_0xa2c1('0x2'));var BPromise=require(_0xa2c1('0x3'));var rp=require(_0xa2c1('0x4'));var fs=require('fs');var path=require(_0xa2c1('0x5'));var rimraf=require(_0xa2c1('0x6'));var config=require(_0xa2c1('0x7'));var attributes=require('./smsAccount.attributes');module[_0xa2c1('0x8')]=function(_0xa8d4c,_0x588316){return _0xa8d4c['define']('SmsAccount',attributes,{'tableName':_0xa2c1('0x9'),'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 e35096a..0416277 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 _0xcac7=['http','redis','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','request\x20sent','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','SmsAccount','find','options','raw','include','map','model','attributes','ShowSmsAccount','debug','lodash','bluebird','ioredis','../../mysqldb','../../config/logger','client'];(function(_0x37ecc2,_0x23573a){var _0x14c2db=function(_0x250e29){while(--_0x250e29){_0x37ecc2['push'](_0x37ecc2['shift']());}};_0x14c2db(++_0x23573a);}(_0xcac7,0x102));var _0x7cac=function(_0x5b6f05,_0x3d7351){_0x5b6f05=_0x5b6f05-0x0;var _0xd814cc=_0xcac7[_0x5b6f05];return _0xd814cc;};'use strict';var _=require(_0x7cac('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7cac('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7cac('0x2'));var db=require(_0x7cac('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7cac('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7cac('0x5')][_0x7cac('0x6')]({'port':0x232a});config[_0x7cac('0x7')]=_['defaults'](config[_0x7cac('0x7')],{'host':_0x7cac('0x8'),'port':0x18eb});var socket=require(_0x7cac('0x9'))(new Redis(config[_0x7cac('0x7')]));require(_0x7cac('0xa'))[_0x7cac('0xb')](socket);function respondWithRpcPromise(_0x52e8d4,_0xf88a3f,_0x3d5956){return new BPromise(function(_0x4499ab,_0x25f18a){return client[_0x7cac('0xc')](_0x52e8d4,_0x3d5956)[_0x7cac('0xd')](function(_0x59c726){logger[_0x7cac('0xe')]('SmsAccount,\x20%s,\x20%s',_0xf88a3f,_0x7cac('0xf'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xf88a3f,_0x7cac('0xf'),JSON[_0x7cac('0x10')](_0x59c726));if(_0x59c726[_0x7cac('0x11')]){if(_0x59c726[_0x7cac('0x11')][_0x7cac('0x12')]===0x1f4){logger[_0x7cac('0x11')](_0x7cac('0x13'),_0xf88a3f,_0x59c726[_0x7cac('0x11')][_0x7cac('0x14')]);return _0x25f18a(_0x59c726[_0x7cac('0x11')][_0x7cac('0x14')]);}logger[_0x7cac('0x11')](_0x7cac('0x13'),_0xf88a3f,_0x59c726[_0x7cac('0x11')][_0x7cac('0x14')]);return _0x4499ab(_0x59c726[_0x7cac('0x11')]['message']);}else{logger[_0x7cac('0xe')]('SmsAccount,\x20%s,\x20%s',_0xf88a3f,_0x7cac('0xf'));_0x4499ab(_0x59c726[_0x7cac('0x15')][_0x7cac('0x14')]);}})[_0x7cac('0x16')](function(_0x126a1d){logger[_0x7cac('0x11')](_0x7cac('0x13'),_0xf88a3f,_0x126a1d);_0x25f18a(_0x126a1d);});});}exports['ShowSmsAccount']=function(_0x3f36e5){var _0x52c24b=this;return new Promise(function(_0x354259,_0x55442b){return db[_0x7cac('0x17')][_0x7cac('0x18')]({'raw':_0x3f36e5[_0x7cac('0x19')]?_0x3f36e5[_0x7cac('0x19')][_0x7cac('0x1a')]===undefined?!![]:![]:!![],'where':_0x3f36e5['options']?_0x3f36e5['options']['where']||null:null,'attributes':_0x3f36e5[_0x7cac('0x19')]?_0x3f36e5[_0x7cac('0x19')]['attributes']||null:null,'include':_0x3f36e5['options']?_0x3f36e5[_0x7cac('0x19')][_0x7cac('0x1b')]?_[_0x7cac('0x1c')](_0x3f36e5[_0x7cac('0x19')]['include'],function(_0x42b3ad){return{'model':db[_0x42b3ad[_0x7cac('0x1d')]],'as':_0x42b3ad['as'],'attributes':_0x42b3ad['attributes'],'include':_0x42b3ad['include']?_[_0x7cac('0x1c')](_0x42b3ad['include'],function(_0x1eecf0){return{'model':db[_0x1eecf0[_0x7cac('0x1d')]],'as':_0x1eecf0['as'],'attributes':_0x1eecf0[_0x7cac('0x1e')],'include':_0x1eecf0[_0x7cac('0x1b')]?_['map'](_0x1eecf0[_0x7cac('0x1b')],function(_0x421e0a){return{'model':db[_0x421e0a[_0x7cac('0x1d')]],'as':_0x421e0a['as'],'attributes':_0x421e0a[_0x7cac('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7cac('0xd')](function(_0x1e66c2){logger[_0x7cac('0xe')](_0x7cac('0x1f'),_0x3f36e5);logger[_0x7cac('0x20')](_0x7cac('0x1f'),_0x3f36e5,JSON[_0x7cac('0x10')](_0x1e66c2));_0x354259(_0x1e66c2);})[_0x7cac('0x16')](function(_0x177c18){logger[_0x7cac('0x11')](_0x7cac('0x1f'),_0x177c18['message'],_0x3f36e5);_0x55442b(_0x52c24b[_0x7cac('0x11')](0x1f4,_0x177c18[_0x7cac('0x14')]));});});}; \ No newline at end of file +var _0xef48=['../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','map','model','stringify','lodash','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0xef48,0x1ce));var _0x8ef4=function(_0x2ec0c9,_0x1bfb51){_0x2ec0c9=_0x2ec0c9-0x0;var _0x522fee=_0xef48[_0x2ec0c9];return _0x522fee;};'use strict';var _=require(_0x8ef4('0x0'));var util=require('util');var moment=require(_0x8ef4('0x1'));var BPromise=require(_0x8ef4('0x2'));var rs=require(_0x8ef4('0x3'));var fs=require('fs');var Redis=require(_0x8ef4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8ef4('0x5'));var logger=require(_0x8ef4('0x6'))(_0x8ef4('0x7'));var config=require(_0x8ef4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8ef4('0x9')][_0x8ef4('0xa')]({'port':0x232a});config[_0x8ef4('0xb')]=_[_0x8ef4('0xc')](config[_0x8ef4('0xb')],{'host':_0x8ef4('0xd'),'port':0x18eb});var socket=require(_0x8ef4('0xe'))(new Redis(config[_0x8ef4('0xb')]));require('./smsAccount.socket')['register'](socket);function respondWithRpcPromise(_0x1374db,_0x41b0fd,_0x987e0e){return new BPromise(function(_0x340f3c,_0x443384){return client[_0x8ef4('0xf')](_0x1374db,_0x987e0e)[_0x8ef4('0x10')](function(_0x1cc2fc){logger['info'](_0x8ef4('0x11'),_0x41b0fd,_0x8ef4('0x12'));logger[_0x8ef4('0x13')](_0x8ef4('0x14'),_0x41b0fd,'request\x20sent',JSON['stringify'](_0x1cc2fc));if(_0x1cc2fc[_0x8ef4('0x15')]){if(_0x1cc2fc['error'][_0x8ef4('0x16')]===0x1f4){logger['error'](_0x8ef4('0x11'),_0x41b0fd,_0x1cc2fc[_0x8ef4('0x15')]['message']);return _0x443384(_0x1cc2fc['error'][_0x8ef4('0x17')]);}logger['error'](_0x8ef4('0x11'),_0x41b0fd,_0x1cc2fc['error'][_0x8ef4('0x17')]);return _0x340f3c(_0x1cc2fc[_0x8ef4('0x15')][_0x8ef4('0x17')]);}else{logger['info'](_0x8ef4('0x11'),_0x41b0fd,_0x8ef4('0x12'));_0x340f3c(_0x1cc2fc['result'][_0x8ef4('0x17')]);}})[_0x8ef4('0x18')](function(_0x4d56d6){logger['error'](_0x8ef4('0x11'),_0x41b0fd,_0x4d56d6);_0x443384(_0x4d56d6);});});}exports[_0x8ef4('0x19')]=function(_0x49e52d){var _0x4d7232=this;return new Promise(function(_0x5805a4,_0x391aa9){return db[_0x8ef4('0x1a')][_0x8ef4('0x1b')]({'raw':_0x49e52d[_0x8ef4('0x1c')]?_0x49e52d['options'][_0x8ef4('0x1d')]===undefined?!![]:![]:!![],'where':_0x49e52d[_0x8ef4('0x1c')]?_0x49e52d['options'][_0x8ef4('0x1e')]||null:null,'attributes':_0x49e52d[_0x8ef4('0x1c')]?_0x49e52d[_0x8ef4('0x1c')][_0x8ef4('0x1f')]||null:null,'include':_0x49e52d[_0x8ef4('0x1c')]?_0x49e52d[_0x8ef4('0x1c')][_0x8ef4('0x20')]?_[_0x8ef4('0x21')](_0x49e52d[_0x8ef4('0x1c')][_0x8ef4('0x20')],function(_0x23e8e8){return{'model':db[_0x23e8e8[_0x8ef4('0x22')]],'as':_0x23e8e8['as'],'attributes':_0x23e8e8[_0x8ef4('0x1f')],'include':_0x23e8e8[_0x8ef4('0x20')]?_['map'](_0x23e8e8[_0x8ef4('0x20')],function(_0x4b3285){return{'model':db[_0x4b3285[_0x8ef4('0x22')]],'as':_0x4b3285['as'],'attributes':_0x4b3285['attributes'],'include':_0x4b3285[_0x8ef4('0x20')]?_[_0x8ef4('0x21')](_0x4b3285[_0x8ef4('0x20')],function(_0x5a394a){return{'model':db[_0x5a394a[_0x8ef4('0x22')]],'as':_0x5a394a['as'],'attributes':_0x5a394a['attributes']};}):[]};}):[]};}):[]:[]})[_0x8ef4('0x10')](function(_0xbf0a36){logger['info'](_0x8ef4('0x19'),_0x49e52d);logger[_0x8ef4('0x13')]('ShowSmsAccount',_0x49e52d,JSON[_0x8ef4('0x23')](_0xbf0a36));_0x5805a4(_0xbf0a36);})[_0x8ef4('0x18')](function(_0x1271dd){logger[_0x8ef4('0x15')](_0x8ef4('0x19'),_0x1271dd[_0x8ef4('0x17')],_0x49e52d);_0x391aa9(_0x4d7232[_0x8ef4('0x15')](0x1f4,_0x1271dd['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index fe44ed7..83b2b42 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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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 400f2e8..7de8f81 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(_0x3f6f7b,_0x59216f){var _0x59bff8=function(_0x395ef6){while(--_0x395ef6){_0x3f6f7b['push'](_0x3f6f7b['shift']());}};_0x59bff8(++_0x59216f);}(_0x3e74,0x175));var _0x43e7=function(_0x208c29,_0x2bbd43){_0x208c29=_0x208c29-0x0;var _0x25e358=_0x3e74[_0x208c29];return _0x25e358;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 87aedcf..656942f 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 _0x040b=['TEXT','*,*,*,*','INTEGER','STRING','noop'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x040b,0xac));var _0xb040=function(_0xa033ca,_0x508188){_0xa033ca=_0xa033ca-0x0;var _0x35a948=_0x040b[_0xa033ca];return _0x35a948;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0xb040('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0xb040('0x1')],'allowNull':![],'defaultValue':_0xb040('0x2')},'appdata':{'type':Sequelize[_0xb040('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xb040('0x1')],'defaultValue':_0xb040('0x4')}}; \ No newline at end of file +var _0xf8eb=['TEXT','STRING','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x5f149e,_0x5f0ad4){var _0x3b1848=function(_0x3b227d){while(--_0x3b227d){_0x5f149e['push'](_0x5f149e['shift']());}};_0x3b1848(++_0x5f0ad4);}(_0xf8eb,0x159));var _0xbf8e=function(_0x35895d,_0x1c2955){_0x35895d=_0x35895d-0x0;var _0x120a74=_0xf8eb[_0x35895d];return _0x120a74;};'use strict';var Sequelize=require(_0xbf8e('0x0'));module[_0xbf8e('0x1')]={'priority':{'type':Sequelize[_0xbf8e('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xbf8e('0x3')]()},'description':{'type':Sequelize[_0xbf8e('0x4')]},'interval':{'type':Sequelize[_0xbf8e('0x4')],'defaultValue':_0xbf8e('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 8b6dfc1..bacd9ef 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 _0xcf28=['type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','map','VIRTUAL','findAll','rows','show','params','rawAttributes','include','options','find','catch','create','body','eml-format','rimraf','request-promise','mustache','util','path','sox','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','save','update','then','destroy','error','stack','name','send','index','SmsApplication'];(function(_0x2a276d,_0x482b0c){var _0x2914cd=function(_0x452b8b){while(--_0x452b8b){_0x2a276d['push'](_0x2a276d['shift']());}};_0x2914cd(++_0x482b0c);}(_0xcf28,0xab));var _0x8cf2=function(_0x2a4bd9,_0x4731cf){_0x2a4bd9=_0x2a4bd9-0x0;var _0x535c4e=_0xcf28[_0x2a4bd9];return _0x535c4e;};'use strict';var emlformat=require(_0x8cf2('0x0'));var rimraf=require(_0x8cf2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8cf2('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8cf2('0x3'));var util=require(_0x8cf2('0x4'));var path=require(_0x8cf2('0x5'));var sox=require(_0x8cf2('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8cf2('0x7'));var squel=require(_0x8cf2('0x8'));var crypto=require(_0x8cf2('0x9'));var jsforce=require(_0x8cf2('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x8cf2('0xb'));var querystring=require('querystring');var Papa=require(_0x8cf2('0xc'));var Redis=require(_0x8cf2('0xd'));var authService=require(_0x8cf2('0xe'));var qs=require(_0x8cf2('0xf'));var as=require(_0x8cf2('0x10'));var hardwareService=require(_0x8cf2('0x11'));var logger=require(_0x8cf2('0x12'))(_0x8cf2('0x13'));var utils=require(_0x8cf2('0x14'));var config=require(_0x8cf2('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x8cf2('0x16'))['db'];function respondWithStatusCode(_0x50fd98,_0x19bfd7){_0x19bfd7=_0x19bfd7||0xcc;return function(_0x578864){if(_0x578864){return _0x50fd98[_0x8cf2('0x17')](_0x19bfd7);}return _0x50fd98[_0x8cf2('0x18')](_0x19bfd7)[_0x8cf2('0x19')]();};}function respondWithResult(_0x14f3f6,_0x3e8d64){_0x3e8d64=_0x3e8d64||0xc8;return function(_0x9bb405){if(_0x9bb405){return _0x14f3f6['status'](_0x3e8d64)[_0x8cf2('0x1a')](_0x9bb405);}};}function respondWithFilteredResult(_0x743394,_0x5dc0d0){return function(_0x452cc9){if(_0x452cc9){var _0x454912=typeof _0x5dc0d0[_0x8cf2('0x1b')]==='undefined'&&typeof _0x5dc0d0[_0x8cf2('0x1c')]===_0x8cf2('0x1d');var _0x360c13=_0x452cc9[_0x8cf2('0x1e')];var _0x4c7847=_0x454912?0x0:_0x5dc0d0[_0x8cf2('0x1b')];var _0x304a62=_0x454912?_0x452cc9['count']:_0x5dc0d0['offset']+_0x5dc0d0[_0x8cf2('0x1c')];var _0x5f2522;if(_0x304a62>=_0x360c13){_0x304a62=_0x360c13;_0x5f2522=0xc8;}else{_0x5f2522=0xce;}_0x743394['status'](_0x5f2522);return _0x743394[_0x8cf2('0x1f')]('Content-Range',_0x4c7847+'-'+_0x304a62+'/'+_0x360c13)[_0x8cf2('0x1a')](_0x452cc9);}return null;};}function patchUpdates(_0x457caa){return function(_0x3240c6){try{jsonpatch['apply'](_0x3240c6,_0x457caa,!![]);}catch(_0x515a70){return BPromise['reject'](_0x515a70);}return _0x3240c6[_0x8cf2('0x20')]();};}function saveUpdates(_0x2a2b24,_0x410db0){return function(_0x10a2ea){if(_0x10a2ea){return _0x10a2ea[_0x8cf2('0x21')](_0x2a2b24)[_0x8cf2('0x22')](function(_0x4a04a5){return _0x4a04a5;});}return null;};}function removeEntity(_0x499ec4,_0x1cf948){return function(_0x34265b){if(_0x34265b){return _0x34265b[_0x8cf2('0x23')]()[_0x8cf2('0x22')](function(){_0x499ec4[_0x8cf2('0x18')](0xcc)[_0x8cf2('0x19')]();});}};}function handleEntityNotFound(_0x5985a6,_0x493f11){return function(_0x1b9e67){if(!_0x1b9e67){_0x5985a6[_0x8cf2('0x17')](0x194);}return _0x1b9e67;};}function handleError(_0x5afacd,_0x25be61){_0x25be61=_0x25be61||0x1f4;return function(_0x38a55f){logger[_0x8cf2('0x24')](_0x38a55f[_0x8cf2('0x25')]);if(_0x38a55f[_0x8cf2('0x26')]){delete _0x38a55f['name'];}_0x5afacd['status'](_0x25be61)[_0x8cf2('0x27')](_0x38a55f);};}exports[_0x8cf2('0x28')]=function(_0x35fb5e,_0x5735dc){var _0x3663d1={},_0x4472a4={},_0x4e28af={'count':0x0,'rows':[]};var _0x53a0fc=_['map'](db[_0x8cf2('0x29')]['rawAttributes'],function(_0x42da28){return{'name':_0x42da28['fieldName'],'type':_0x42da28[_0x8cf2('0x2a')][_0x8cf2('0x2b')]};});_0x4472a4[_0x8cf2('0x2c')]=_['map'](_0x53a0fc,_0x8cf2('0x26'));_0x4472a4[_0x8cf2('0x2d')]=_[_0x8cf2('0x2e')](_0x35fb5e[_0x8cf2('0x2d')]);_0x4472a4[_0x8cf2('0x2f')]=_[_0x8cf2('0x30')](_0x4472a4[_0x8cf2('0x2c')],_0x4472a4[_0x8cf2('0x2d')]);_0x3663d1[_0x8cf2('0x31')]=_[_0x8cf2('0x30')](_0x4472a4[_0x8cf2('0x2c')],qs['fields'](_0x35fb5e[_0x8cf2('0x2d')][_0x8cf2('0x32')]));_0x3663d1[_0x8cf2('0x31')]=_0x3663d1['attributes'][_0x8cf2('0x33')]?_0x3663d1['attributes']:_0x4472a4[_0x8cf2('0x2c')];if(!_0x35fb5e['query'][_0x8cf2('0x34')]('nolimit')){_0x3663d1[_0x8cf2('0x1c')]=qs[_0x8cf2('0x1c')](_0x35fb5e[_0x8cf2('0x2d')][_0x8cf2('0x1c')]);_0x3663d1['offset']=qs[_0x8cf2('0x1b')](_0x35fb5e[_0x8cf2('0x2d')]['offset']);}_0x3663d1[_0x8cf2('0x35')]=qs[_0x8cf2('0x36')](_0x35fb5e['query'][_0x8cf2('0x36')]);_0x3663d1[_0x8cf2('0x37')]=qs[_0x8cf2('0x2f')](_['pick'](_0x35fb5e[_0x8cf2('0x2d')],_0x4472a4[_0x8cf2('0x2f')]),_0x53a0fc);if(_0x35fb5e['query'][_0x8cf2('0x38')]){_0x3663d1[_0x8cf2('0x37')]=_[_0x8cf2('0x39')](_0x3663d1['where'],{'$or':_[_0x8cf2('0x3a')](_0x53a0fc,function(_0x12af5c){if(_0x12af5c[_0x8cf2('0x2a')]!==_0x8cf2('0x3b')){var _0x3338f4={};_0x3338f4[_0x12af5c[_0x8cf2('0x26')]]={'$like':'%'+_0x35fb5e[_0x8cf2('0x2d')][_0x8cf2('0x38')]+'%'};return _0x3338f4;}})});}_0x3663d1=_[_0x8cf2('0x39')]({},_0x3663d1,_0x35fb5e['options']);var _0x3f662f={'where':_0x3663d1['where']};return db[_0x8cf2('0x29')][_0x8cf2('0x1e')](_0x3f662f)['then'](function(_0x222eb9){_0x4e28af[_0x8cf2('0x1e')]=_0x222eb9;if(_0x35fb5e[_0x8cf2('0x2d')]['includeAll']){_0x3663d1['include']=[{'all':!![]}];}return db[_0x8cf2('0x29')][_0x8cf2('0x3c')](_0x3663d1);})[_0x8cf2('0x22')](function(_0x349461){_0x4e28af[_0x8cf2('0x3d')]=_0x349461;return _0x4e28af;})[_0x8cf2('0x22')](respondWithFilteredResult(_0x5735dc,_0x3663d1))['catch'](handleError(_0x5735dc,null));};exports[_0x8cf2('0x3e')]=function(_0xa3deeb,_0x11d0c0){var _0x211ca8={'raw':!![],'where':{'id':_0xa3deeb[_0x8cf2('0x3f')]['id']}},_0x19cebb={};_0x19cebb[_0x8cf2('0x2c')]=_['keys'](db[_0x8cf2('0x29')][_0x8cf2('0x40')]);_0x19cebb[_0x8cf2('0x2d')]=_[_0x8cf2('0x2e')](_0xa3deeb[_0x8cf2('0x2d')]);_0x19cebb[_0x8cf2('0x2f')]=_[_0x8cf2('0x30')](_0x19cebb[_0x8cf2('0x2c')],_0x19cebb[_0x8cf2('0x2d')]);_0x211ca8[_0x8cf2('0x31')]=_['intersection'](_0x19cebb[_0x8cf2('0x2c')],qs[_0x8cf2('0x32')](_0xa3deeb['query'][_0x8cf2('0x32')]));_0x211ca8[_0x8cf2('0x31')]=_0x211ca8[_0x8cf2('0x31')][_0x8cf2('0x33')]?_0x211ca8[_0x8cf2('0x31')]:_0x19cebb[_0x8cf2('0x2c')];if(_0xa3deeb[_0x8cf2('0x2d')]['includeAll']){_0x211ca8[_0x8cf2('0x41')]=[{'all':!![]}];}_0x211ca8=_[_0x8cf2('0x39')]({},_0x211ca8,_0xa3deeb[_0x8cf2('0x42')]);return db['SmsApplication'][_0x8cf2('0x43')](_0x211ca8)['then'](handleEntityNotFound(_0x11d0c0,null))['then'](respondWithResult(_0x11d0c0,null))[_0x8cf2('0x44')](handleError(_0x11d0c0,null));};exports['create']=function(_0x4cf8ec,_0x5a374b){return db['SmsApplication'][_0x8cf2('0x45')](_0x4cf8ec[_0x8cf2('0x46')],{})[_0x8cf2('0x22')](respondWithResult(_0x5a374b,0xc9))[_0x8cf2('0x44')](handleError(_0x5a374b,null));};exports[_0x8cf2('0x21')]=function(_0x3fb3bf,_0x31c541){if(_0x3fb3bf['body']['id']){delete _0x3fb3bf[_0x8cf2('0x46')]['id'];}return db['SmsApplication']['find']({'where':{'id':_0x3fb3bf[_0x8cf2('0x3f')]['id']}})[_0x8cf2('0x22')](handleEntityNotFound(_0x31c541,null))['then'](saveUpdates(_0x3fb3bf[_0x8cf2('0x46')],null))[_0x8cf2('0x22')](respondWithResult(_0x31c541,null))[_0x8cf2('0x44')](handleError(_0x31c541,null));};exports['destroy']=function(_0x5992ba,_0x1aadc7){return db[_0x8cf2('0x29')][_0x8cf2('0x43')]({'where':{'id':_0x5992ba[_0x8cf2('0x3f')]['id']}})[_0x8cf2('0x22')](handleEntityNotFound(_0x1aadc7,null))[_0x8cf2('0x22')](removeEntity(_0x1aadc7,null))['catch'](handleError(_0x1aadc7,null));}; \ No newline at end of file +var _0xb7c8=['nolimit','sort','where','pick','merge','type','options','include','findAll','catch','show','params','fields','includeAll','find','create','body','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty'];(function(_0x4fdea3,_0x1d79d0){var _0x51a433=function(_0x13da9f){while(--_0x13da9f){_0x4fdea3['push'](_0x4fdea3['shift']());}};_0x51a433(++_0x1d79d0);}(_0xb7c8,0x1ed));var _0x8b7c=function(_0x9e8d71,_0x4154fc){_0x9e8d71=_0x9e8d71-0x0;var _0x17adf3=_0xb7c8[_0x9e8d71];return _0x17adf3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8b7c('0x0'));var zipdir=require(_0x8b7c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8b7c('0x2'));var moment=require(_0x8b7c('0x3'));var BPromise=require(_0x8b7c('0x4'));var Mustache=require(_0x8b7c('0x5'));var util=require(_0x8b7c('0x6'));var path=require('path');var sox=require(_0x8b7c('0x7'));var csv=require('to-csv');var ejs=require(_0x8b7c('0x8'));var fs=require('fs');var fs_extra=require(_0x8b7c('0x9'));var _=require(_0x8b7c('0xa'));var squel=require(_0x8b7c('0xb'));var crypto=require(_0x8b7c('0xc'));var jsforce=require(_0x8b7c('0xd'));var deskjs=require(_0x8b7c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8b7c('0xf'));var Papa=require(_0x8b7c('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8b7c('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8b7c('0x12'))['db'];function respondWithStatusCode(_0x172548,_0x299964){_0x299964=_0x299964||0xcc;return function(_0x491a08){if(_0x491a08){return _0x172548[_0x8b7c('0x13')](_0x299964);}return _0x172548[_0x8b7c('0x14')](_0x299964)[_0x8b7c('0x15')]();};}function respondWithResult(_0x1a5093,_0x58b783){_0x58b783=_0x58b783||0xc8;return function(_0x568d4d){if(_0x568d4d){return _0x1a5093[_0x8b7c('0x14')](_0x58b783)[_0x8b7c('0x16')](_0x568d4d);}};}function respondWithFilteredResult(_0xc29c2d,_0x33c654){return function(_0x4493d9){if(_0x4493d9){var _0x3a7383=typeof _0x33c654[_0x8b7c('0x17')]===_0x8b7c('0x18')&&typeof _0x33c654[_0x8b7c('0x19')]==='undefined';var _0x50cb46=_0x4493d9[_0x8b7c('0x1a')];var _0x1d66ae=_0x3a7383?0x0:_0x33c654[_0x8b7c('0x17')];var _0x4f352a=_0x3a7383?_0x4493d9[_0x8b7c('0x1a')]:_0x33c654[_0x8b7c('0x17')]+_0x33c654['limit'];var _0x4642bc;if(_0x4f352a>=_0x50cb46){_0x4f352a=_0x50cb46;_0x4642bc=0xc8;}else{_0x4642bc=0xce;}_0xc29c2d['status'](_0x4642bc);return _0xc29c2d[_0x8b7c('0x1b')](_0x8b7c('0x1c'),_0x1d66ae+'-'+_0x4f352a+'/'+_0x50cb46)['json'](_0x4493d9);}return null;};}function patchUpdates(_0x4ca42c){return function(_0x407772){try{jsonpatch[_0x8b7c('0x1d')](_0x407772,_0x4ca42c,!![]);}catch(_0x509be2){return BPromise[_0x8b7c('0x1e')](_0x509be2);}return _0x407772[_0x8b7c('0x1f')]();};}function saveUpdates(_0x429b38,_0x233133){return function(_0x2a4347){if(_0x2a4347){return _0x2a4347[_0x8b7c('0x20')](_0x429b38)['then'](function(_0x59bc6f){return _0x59bc6f;});}return null;};}function removeEntity(_0x7a4202,_0x435a54){return function(_0x285aff){if(_0x285aff){return _0x285aff['destroy']()[_0x8b7c('0x21')](function(){_0x7a4202[_0x8b7c('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x86980e,_0x10239c){return function(_0x190e68){if(!_0x190e68){_0x86980e[_0x8b7c('0x13')](0x194);}return _0x190e68;};}function handleError(_0x10b6b2,_0x49bee7){_0x49bee7=_0x49bee7||0x1f4;return function(_0x5f4e9d){logger['error'](_0x5f4e9d[_0x8b7c('0x22')]);if(_0x5f4e9d[_0x8b7c('0x23')]){delete _0x5f4e9d[_0x8b7c('0x23')];}_0x10b6b2[_0x8b7c('0x14')](_0x49bee7)[_0x8b7c('0x24')](_0x5f4e9d);};}exports[_0x8b7c('0x25')]=function(_0x316591,_0x575ec0){var _0x621f21={},_0x354f30={},_0x7e295e={'count':0x0,'rows':[]};var _0x3889c5=_[_0x8b7c('0x26')](db[_0x8b7c('0x27')][_0x8b7c('0x28')],function(_0x174023){return{'name':_0x174023[_0x8b7c('0x29')],'type':_0x174023['type'][_0x8b7c('0x2a')]};});_0x354f30[_0x8b7c('0x2b')]=_[_0x8b7c('0x26')](_0x3889c5,_0x8b7c('0x23'));_0x354f30[_0x8b7c('0x2c')]=_[_0x8b7c('0x2d')](_0x316591[_0x8b7c('0x2c')]);_0x354f30[_0x8b7c('0x2e')]=_['intersection'](_0x354f30['model'],_0x354f30[_0x8b7c('0x2c')]);_0x621f21[_0x8b7c('0x2f')]=_[_0x8b7c('0x30')](_0x354f30[_0x8b7c('0x2b')],qs['fields'](_0x316591[_0x8b7c('0x2c')]['fields']));_0x621f21['attributes']=_0x621f21[_0x8b7c('0x2f')][_0x8b7c('0x31')]?_0x621f21['attributes']:_0x354f30[_0x8b7c('0x2b')];if(!_0x316591[_0x8b7c('0x2c')][_0x8b7c('0x32')](_0x8b7c('0x33'))){_0x621f21['limit']=qs[_0x8b7c('0x19')](_0x316591[_0x8b7c('0x2c')][_0x8b7c('0x19')]);_0x621f21['offset']=qs['offset'](_0x316591[_0x8b7c('0x2c')][_0x8b7c('0x17')]);}_0x621f21['order']=qs['sort'](_0x316591['query'][_0x8b7c('0x34')]);_0x621f21[_0x8b7c('0x35')]=qs[_0x8b7c('0x2e')](_[_0x8b7c('0x36')](_0x316591[_0x8b7c('0x2c')],_0x354f30[_0x8b7c('0x2e')]),_0x3889c5);if(_0x316591[_0x8b7c('0x2c')]['filter']){_0x621f21[_0x8b7c('0x35')]=_[_0x8b7c('0x37')](_0x621f21[_0x8b7c('0x35')],{'$or':_[_0x8b7c('0x26')](_0x3889c5,function(_0xe272f1){if(_0xe272f1[_0x8b7c('0x38')]!=='VIRTUAL'){var _0x17a6f0={};_0x17a6f0[_0xe272f1[_0x8b7c('0x23')]]={'$like':'%'+_0x316591[_0x8b7c('0x2c')]['filter']+'%'};return _0x17a6f0;}})});}_0x621f21=_[_0x8b7c('0x37')]({},_0x621f21,_0x316591[_0x8b7c('0x39')]);var _0x37e062={'where':_0x621f21[_0x8b7c('0x35')]};return db['SmsApplication'][_0x8b7c('0x1a')](_0x37e062)['then'](function(_0x2c45a1){_0x7e295e['count']=_0x2c45a1;if(_0x316591[_0x8b7c('0x2c')]['includeAll']){_0x621f21[_0x8b7c('0x3a')]=[{'all':!![]}];}return db[_0x8b7c('0x27')][_0x8b7c('0x3b')](_0x621f21);})['then'](function(_0x32b453){_0x7e295e['rows']=_0x32b453;return _0x7e295e;})['then'](respondWithFilteredResult(_0x575ec0,_0x621f21))[_0x8b7c('0x3c')](handleError(_0x575ec0,null));};exports[_0x8b7c('0x3d')]=function(_0x1d9c5e,_0x5b4bcd){var _0x583ab0={'raw':!![],'where':{'id':_0x1d9c5e[_0x8b7c('0x3e')]['id']}},_0xa40f50={};_0xa40f50[_0x8b7c('0x2b')]=_[_0x8b7c('0x2d')](db[_0x8b7c('0x27')][_0x8b7c('0x28')]);_0xa40f50[_0x8b7c('0x2c')]=_[_0x8b7c('0x2d')](_0x1d9c5e['query']);_0xa40f50[_0x8b7c('0x2e')]=_[_0x8b7c('0x30')](_0xa40f50[_0x8b7c('0x2b')],_0xa40f50[_0x8b7c('0x2c')]);_0x583ab0[_0x8b7c('0x2f')]=_[_0x8b7c('0x30')](_0xa40f50['model'],qs[_0x8b7c('0x3f')](_0x1d9c5e[_0x8b7c('0x2c')]['fields']));_0x583ab0['attributes']=_0x583ab0['attributes'][_0x8b7c('0x31')]?_0x583ab0[_0x8b7c('0x2f')]:_0xa40f50[_0x8b7c('0x2b')];if(_0x1d9c5e[_0x8b7c('0x2c')][_0x8b7c('0x40')]){_0x583ab0[_0x8b7c('0x3a')]=[{'all':!![]}];}_0x583ab0=_[_0x8b7c('0x37')]({},_0x583ab0,_0x1d9c5e['options']);return db[_0x8b7c('0x27')][_0x8b7c('0x41')](_0x583ab0)['then'](handleEntityNotFound(_0x5b4bcd,null))[_0x8b7c('0x21')](respondWithResult(_0x5b4bcd,null))[_0x8b7c('0x3c')](handleError(_0x5b4bcd,null));};exports[_0x8b7c('0x42')]=function(_0xa4700e,_0x3020c1){return db[_0x8b7c('0x27')]['create'](_0xa4700e[_0x8b7c('0x43')],{})[_0x8b7c('0x21')](respondWithResult(_0x3020c1,0xc9))['catch'](handleError(_0x3020c1,null));};exports[_0x8b7c('0x20')]=function(_0x553f46,_0x5bed87){if(_0x553f46[_0x8b7c('0x43')]['id']){delete _0x553f46[_0x8b7c('0x43')]['id'];}return db[_0x8b7c('0x27')][_0x8b7c('0x41')]({'where':{'id':_0x553f46[_0x8b7c('0x3e')]['id']}})[_0x8b7c('0x21')](handleEntityNotFound(_0x5bed87,null))[_0x8b7c('0x21')](saveUpdates(_0x553f46[_0x8b7c('0x43')],null))[_0x8b7c('0x21')](respondWithResult(_0x5bed87,null))[_0x8b7c('0x3c')](handleError(_0x5bed87,null));};exports['destroy']=function(_0x2e47e5,_0x476360){return db[_0x8b7c('0x27')][_0x8b7c('0x41')]({'where':{'id':_0x2e47e5[_0x8b7c('0x3e')]['id']}})[_0x8b7c('0x21')](handleEntityNotFound(_0x476360,null))['then'](removeEntity(_0x476360,null))[_0x8b7c('0x3c')](handleError(_0x476360,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index f651749..41cc6cc 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 _0xf201=['path','rimraf','../../config/environment','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf201,0x199));var _0x1f20=function(_0xfe3e19,_0x4f9f2f){_0xfe3e19=_0xfe3e19-0x0;var _0x2a3442=_0xf201[_0xfe3e19];return _0x2a3442;};'use strict';var _=require(_0x1f20('0x0'));var util=require(_0x1f20('0x1'));var logger=require(_0x1f20('0x2'))(_0x1f20('0x3'));var moment=require(_0x1f20('0x4'));var BPromise=require(_0x1f20('0x5'));var rp=require(_0x1f20('0x6'));var fs=require('fs');var path=require(_0x1f20('0x7'));var rimraf=require(_0x1f20('0x8'));var config=require(_0x1f20('0x9'));var attributes=require('./smsApplication.attributes');module[_0x1f20('0xa')]=function(_0x5c266b,_0x43741b){return _0x5c266b[_0x1f20('0xb')](_0x1f20('0xc'),attributes,{'tableName':_0x1f20('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1f20('0xe'),'collate':_0x1f20('0xf')});}; \ No newline at end of file +var _0x9a45=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','define','sms_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger'];(function(_0x302ebe,_0x4f4943){var _0x3c7926=function(_0x462042){while(--_0x462042){_0x302ebe['push'](_0x302ebe['shift']());}};_0x3c7926(++_0x4f4943);}(_0x9a45,0x11d));var _0x59a4=function(_0x3c7996,_0x1b65a3){_0x3c7996=_0x3c7996-0x0;var _0x1d1170=_0x9a45[_0x3c7996];return _0x1d1170;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x59a4('0x0'))(_0x59a4('0x1'));var moment=require(_0x59a4('0x2'));var BPromise=require(_0x59a4('0x3'));var rp=require(_0x59a4('0x4'));var fs=require('fs');var path=require(_0x59a4('0x5'));var rimraf=require(_0x59a4('0x6'));var config=require(_0x59a4('0x7'));var attributes=require(_0x59a4('0x8'));module['exports']=function(_0x47e973,_0x4aa3d7){return _0x47e973[_0x59a4('0x9')]('SmsApplication',attributes,{'tableName':_0x59a4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x59a4('0xb'),'collate':_0x59a4('0xc')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index b209605..5d5b6c9 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 _0xeca8=['../../config/environment','jayson/promise','http','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xeca8,0x1f2));var _0x8eca=function(_0x45a434,_0x1930b7){_0x45a434=_0x45a434-0x0;var _0x45aee1=_0xeca8[_0x45a434];return _0x45aee1;};'use strict';var _=require(_0x8eca('0x0'));var util=require(_0x8eca('0x1'));var moment=require(_0x8eca('0x2'));var BPromise=require(_0x8eca('0x3'));var rs=require(_0x8eca('0x4'));var fs=require('fs');var Redis=require(_0x8eca('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8eca('0x6'));var logger=require('../../config/logger')(_0x8eca('0x7'));var config=require(_0x8eca('0x8'));var jayson=require(_0x8eca('0x9'));var client=jayson['client'][_0x8eca('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12c679,_0xe6e3f2,_0x39f40a){return new BPromise(function(_0xedaeca,_0x3b901f){return client['request'](_0x12c679,_0x39f40a)[_0x8eca('0xb')](function(_0x19208c){logger[_0x8eca('0xc')](_0x8eca('0xd'),_0xe6e3f2,_0x8eca('0xe'));logger[_0x8eca('0xf')](_0x8eca('0x10'),_0xe6e3f2,_0x8eca('0xe'),JSON[_0x8eca('0x11')](_0x19208c));if(_0x19208c[_0x8eca('0x12')]){if(_0x19208c['error'][_0x8eca('0x13')]===0x1f4){logger['error'](_0x8eca('0xd'),_0xe6e3f2,_0x19208c[_0x8eca('0x12')]['message']);return _0x3b901f(_0x19208c[_0x8eca('0x12')]['message']);}logger['error']('SmsApplication,\x20%s,\x20%s',_0xe6e3f2,_0x19208c[_0x8eca('0x12')][_0x8eca('0x14')]);return _0xedaeca(_0x19208c[_0x8eca('0x12')][_0x8eca('0x14')]);}else{logger[_0x8eca('0xc')](_0x8eca('0xd'),_0xe6e3f2,_0x8eca('0xe'));_0xedaeca(_0x19208c['result'][_0x8eca('0x14')]);}})[_0x8eca('0x15')](function(_0x4b8c67){logger[_0x8eca('0x12')](_0x8eca('0xd'),_0xe6e3f2,_0x4b8c67);_0x3b901f(_0x4b8c67);});});} \ No newline at end of file +var _0x4201=['debug','stringify','error','code','SmsApplication,\x20%s,\x20%s','message','info','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','request\x20sent'];(function(_0x184613,_0x48d15c){var _0x2db72f=function(_0x12b1dd){while(--_0x12b1dd){_0x184613['push'](_0x184613['shift']());}};_0x2db72f(++_0x48d15c);}(_0x4201,0x71));var _0x1420=function(_0x42bd43,_0x59fb77){_0x42bd43=_0x42bd43-0x0;var _0x421e88=_0x4201[_0x42bd43];return _0x421e88;};'use strict';var _=require(_0x1420('0x0'));var util=require(_0x1420('0x1'));var moment=require('moment');var BPromise=require(_0x1420('0x2'));var rs=require(_0x1420('0x3'));var fs=require('fs');var Redis=require(_0x1420('0x4'));var db=require(_0x1420('0x5'))['db'];var utils=require(_0x1420('0x6'));var logger=require(_0x1420('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1420('0x8'));var client=jayson[_0x1420('0x9')][_0x1420('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35a8ba,_0x239e16,_0x59ddc5){return new BPromise(function(_0x5a925c,_0x46d303){return client[_0x1420('0xb')](_0x35a8ba,_0x59ddc5)['then'](function(_0x1d52ff){logger['info']('SmsApplication,\x20%s,\x20%s',_0x239e16,_0x1420('0xc'));logger[_0x1420('0xd')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x239e16,_0x1420('0xc'),JSON[_0x1420('0xe')](_0x1d52ff));if(_0x1d52ff[_0x1420('0xf')]){if(_0x1d52ff[_0x1420('0xf')][_0x1420('0x10')]===0x1f4){logger[_0x1420('0xf')](_0x1420('0x11'),_0x239e16,_0x1d52ff[_0x1420('0xf')]['message']);return _0x46d303(_0x1d52ff['error']['message']);}logger['error'](_0x1420('0x11'),_0x239e16,_0x1d52ff[_0x1420('0xf')][_0x1420('0x12')]);return _0x5a925c(_0x1d52ff[_0x1420('0xf')][_0x1420('0x12')]);}else{logger[_0x1420('0x13')]('SmsApplication,\x20%s,\x20%s',_0x239e16,'request\x20sent');_0x5a925c(_0x1d52ff[_0x1420('0x14')]['message']);}})['catch'](function(_0x231659){logger[_0x1420('0xf')](_0x1420('0x11'),_0x239e16,_0x231659);_0x46d303(_0x231659);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 36e4160..69b0126 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 _0xea28=['put','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','/:id/tags','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','/:id/download','download','create','post','tracked','sms','smsinteraction:addtags','addTags'];(function(_0x12d58e,_0x1a2c7f){var _0x35d730=function(_0x4741ec){while(--_0x4741ec){_0x12d58e['push'](_0x12d58e['shift']());}};_0x35d730(++_0x1a2c7f);}(_0xea28,0x13a));var _0x8ea2=function(_0x3f4528,_0x1bd907){_0x3f4528=_0x3f4528-0x0;var _0x90a8be=_0xea28[_0x3f4528];return _0x90a8be;};'use strict';var multer=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var path=require(_0x8ea2('0x2'));var timeout=require(_0x8ea2('0x3'));var express=require(_0x8ea2('0x4'));var router=express[_0x8ea2('0x5')]();var fs_extra=require(_0x8ea2('0x6'));var auth=require(_0x8ea2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8ea2('0x8'));var controller=require(_0x8ea2('0x9'));router[_0x8ea2('0xa')]('/',auth['isAuthenticated'](),controller[_0x8ea2('0xb')]);router[_0x8ea2('0xa')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0xe')]);router[_0x8ea2('0xa')](_0x8ea2('0xf'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x10')]);router[_0x8ea2('0xa')](_0x8ea2('0x11'),auth[_0x8ea2('0xd')](),controller['getMessages']);router['get'](_0x8ea2('0x12'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x13')]);router['post']('/',auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x14')]);router[_0x8ea2('0x15')](_0x8ea2('0x11'),auth[_0x8ea2('0xd')](),controller['addMessage']);router[_0x8ea2('0x15')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x8ea2('0x16')](_0x8ea2('0x17'),_0x8ea2('0x18')),controller[_0x8ea2('0x19')]);router[_0x8ea2('0x1a')](_0x8ea2('0xf'),auth[_0x8ea2('0xd')](),interaction[_0x8ea2('0x16')](_0x8ea2('0x17'),_0x8ea2('0x1b')),controller[_0x8ea2('0x1c')]);router[_0x8ea2('0x1d')](_0x8ea2('0xf'),auth[_0x8ea2('0xd')](),interaction[_0x8ea2('0x16')](_0x8ea2('0x17'),_0x8ea2('0x1e')),controller[_0x8ea2('0x1f')]);router[_0x8ea2('0x1d')](_0x8ea2('0x20'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x21')]);module['exports']=router; \ No newline at end of file +var _0x4fc2=['removeTags','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./smsInteraction.controller','isAuthenticated','index','/describe','describe','get','/:id','/:id/messages','getMessages','/:id/download','download','create','addMessage','post','/:id/tags','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','delete','tracked','smsinteraction:destroy','destroy'];(function(_0x361431,_0x231672){var _0x30bac4=function(_0x4131f8){while(--_0x4131f8){_0x361431['push'](_0x361431['shift']());}};_0x30bac4(++_0x231672);}(_0x4fc2,0x111));var _0x24fc=function(_0x631c23,_0x3e18bc){_0x631c23=_0x631c23-0x0;var _0x37f536=_0x4fc2[_0x631c23];return _0x37f536;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')](_0x24fc('0xe'),auth[_0x24fc('0x9')](),controller['show']);router[_0x24fc('0xd')](_0x24fc('0xf'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x10')]);router[_0x24fc('0xd')](_0x24fc('0x11'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x12')]);router['post']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0x13')]);router['post'](_0x24fc('0xf'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x14')]);router[_0x24fc('0x15')](_0x24fc('0x16'),auth[_0x24fc('0x9')](),interaction['tracked'](_0x24fc('0x17'),_0x24fc('0x18')),controller[_0x24fc('0x19')]);router[_0x24fc('0x1a')]('/:id',auth[_0x24fc('0x9')](),interaction['tracked'](_0x24fc('0x17'),_0x24fc('0x1b')),controller[_0x24fc('0x1c')]);router[_0x24fc('0x1d')](_0x24fc('0xe'),auth['isAuthenticated'](),interaction[_0x24fc('0x1e')](_0x24fc('0x17'),_0x24fc('0x1f')),controller[_0x24fc('0x20')]);router['delete'](_0x24fc('0x16'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x21')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 48910fc..ef9f974 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 _0xf842=['out','DATE','sequelize','moment','exports','BOOLEAN','STRING','ENUM'];(function(_0x5141bb,_0x350625){var _0x6483d2=function(_0x494c4e){while(--_0x494c4e){_0x5141bb['push'](_0x5141bb['shift']());}};_0x6483d2(++_0x350625);}(_0xf842,0x172));var _0x2f84=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0xf842[_0x2fc012];return _0x2891f9;};'use strict';var Sequelize=require(_0x2f84('0x0'));var moment=require(_0x2f84('0x1'));module[_0x2f84('0x2')]={'closed':{'type':Sequelize[_0x2f84('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x2f84('0x4')]},'secondDisposition':{'type':Sequelize[_0x2f84('0x4')]},'thirdDisposition':{'type':Sequelize[_0x2f84('0x4')]},'note':{'type':Sequelize[_0x2f84('0x4')]},'phone':{'type':Sequelize[_0x2f84('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x2f84('0x5')]('in',_0x2f84('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2f84('0x7')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x2f84('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x2f84('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x539d=['ENUM','sequelize','exports','BOOLEAN','STRING','DATE','out'];(function(_0x4a7756,_0x97b450){var _0x26b489=function(_0x1147e9){while(--_0x1147e9){_0x4a7756['push'](_0x4a7756['shift']());}};_0x26b489(++_0x97b450);}(_0x539d,0x17b));var _0xd539=function(_0x45fb76,_0x35fd5d){_0x45fb76=_0x45fb76-0x0;var _0x338556=_0x539d[_0x45fb76];return _0x338556;};'use strict';var Sequelize=require(_0xd539('0x0'));var moment=require('moment');module[_0xd539('0x1')]={'closed':{'type':Sequelize[_0xd539('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xd539('0x3')]},'thirdDisposition':{'type':Sequelize[_0xd539('0x3')]},'note':{'type':Sequelize[_0xd539('0x3')]},'phone':{'type':Sequelize[_0xd539('0x3')]},'read1stAt':{'type':Sequelize[_0xd539('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xd539('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd539('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xd539('0x6')]('in',_0xd539('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xd539('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 00e80cd..3181638 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 _0xc553=['Tag','smsInteractionTags:save','removeTags','root','files','tmp','join','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','createdAt','secret','read','Account','Owner','get','N.A.','closed','toString','Messages','direction','out','renderFile','server','views','Sms','download','err','unlinkSync','rimraf','moment','bluebird','util','path','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','error','name','send','index','map','SmsInteraction','rawAttributes','type','getOptions','findAll','user','catch','show','params','model','keys','query','filters','intersection','fields','attributes','length','includeAll','include','options','find','create','body','describe','addMessage','SmsMessage','ids','omit','findOne','hasOwnProperty','nolimit','order','where','pick','merge','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread'];(function(_0x541c36,_0x178566){var _0x39a741=function(_0x3e7a40){while(--_0x3e7a40){_0x541c36['push'](_0x541c36['shift']());}};_0x39a741(++_0x178566);}(_0xc553,0x16c));var _0x3c55=function(_0x21b198,_0x345482){_0x21b198=_0x21b198-0x0;var _0x52ddbc=_0xc553[_0x21b198];return _0x52ddbc;};'use strict';var rimraf=require(_0x3c55('0x0'));var zipdir=require('zip-dir');var moment=require(_0x3c55('0x1'));var BPromise=require(_0x3c55('0x2'));var util=require(_0x3c55('0x3'));var path=require(_0x3c55('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require(_0x3c55('0x5'));var interaction=require('../../components/interaction/service');var qs=require(_0x3c55('0x6'));var pdf=require(_0x3c55('0x7'));var logger=require(_0x3c55('0x8'))('api');var config=require(_0x3c55('0x9'));var db=require('../../mysqldb')['db'];config[_0x3c55('0xa')]=_[_0x3c55('0xb')](config[_0x3c55('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x3c55('0xc'))(new Redis(config['redis']));require(_0x3c55('0xd'))[_0x3c55('0xe')](socket);function respondWithStatusCode(_0x467b44,_0x2c4f1c){_0x2c4f1c=_0x2c4f1c||0xcc;return function(_0x1a65c5){if(_0x1a65c5){return _0x467b44[_0x3c55('0xf')](_0x2c4f1c);}return _0x467b44[_0x3c55('0x10')](_0x2c4f1c)['end']();};}function respondWithResult(_0x1475ba,_0x15d372){_0x15d372=_0x15d372||0xc8;return function(_0x1a6a65){if(_0x1a6a65){return _0x1475ba[_0x3c55('0x10')](_0x15d372)['json'](_0x1a6a65);}};}function respondWithFilteredResult(_0x18b75f,_0x2d6e04){return function(_0x2f19f1){if(_0x2f19f1){var _0xc01377=typeof _0x2d6e04[_0x3c55('0x11')]===_0x3c55('0x12')&&typeof _0x2d6e04[_0x3c55('0x13')]===_0x3c55('0x12');var _0x21506a=_0x2f19f1[_0x3c55('0x14')];var _0x4e6b13=_0xc01377?0x0:_0x2d6e04[_0x3c55('0x11')];var _0x2a9d4b=_0xc01377?_0x2f19f1[_0x3c55('0x14')]:_0x2d6e04[_0x3c55('0x11')]+_0x2d6e04['limit'];var _0x590d87;if(_0x2a9d4b>=_0x21506a){_0x2a9d4b=_0x21506a;_0x590d87=0xc8;}else{_0x590d87=0xce;}_0x18b75f['status'](_0x590d87);return _0x18b75f[_0x3c55('0x15')](_0x3c55('0x16'),_0x4e6b13+'-'+_0x2a9d4b+'/'+_0x21506a)[_0x3c55('0x17')](_0x2f19f1);}return null;};}function saveUpdates(_0x5dc1d7){return function(_0x9c2f53){if(_0x9c2f53){return _0x9c2f53[_0x3c55('0x18')](_0x5dc1d7)[_0x3c55('0x19')](function(_0x349294){return _0x349294;});}return null;};}function removeEntity(_0x5e1be4){return function(_0x3e1781){if(_0x3e1781){return _0x3e1781[_0x3c55('0x1a')]()[_0x3c55('0x19')](function(){_0x5e1be4[_0x3c55('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b9381){return function(_0x4b18f8){if(!_0x4b18f8){_0x3b9381[_0x3c55('0xf')](0x194);}return _0x4b18f8;};}function handleError(_0xab8d4b,_0x280d33){_0x280d33=_0x280d33||0x1f4;return function(_0x447bcb){logger[_0x3c55('0x1b')](_0x447bcb['stack']);if(_0x447bcb[_0x3c55('0x1c')]){delete _0x447bcb[_0x3c55('0x1c')];}_0xab8d4b['status'](_0x280d33)[_0x3c55('0x1d')](_0x447bcb);};}exports[_0x3c55('0x1e')]=function(_0x3af66f,_0x484c37){var _0x4febb0={};var _0x1ecae8=_[_0x3c55('0x1f')](db[_0x3c55('0x20')][_0x3c55('0x21')],function(_0x53e572){return{'name':_0x53e572['fieldName'],'type':_0x53e572[_0x3c55('0x22')]['key']};});_0x4febb0=qs[_0x3c55('0x23')](_0x1ecae8,_0x3af66f);return interaction[_0x3c55('0x24')]('sms',_0x3af66f['query'],_0x3af66f[_0x3c55('0x25')],_0x4febb0,_0x1ecae8)[_0x3c55('0x19')](respondWithFilteredResult(_0x484c37,_0x4febb0))[_0x3c55('0x26')](handleError(_0x484c37,null));};exports[_0x3c55('0x27')]=function(_0x656407,_0x40b4a8){var _0x1a2204={'raw':![],'where':{'id':_0x656407[_0x3c55('0x28')]['id']}},_0x39cfcb={};_0x39cfcb[_0x3c55('0x29')]=_[_0x3c55('0x2a')](db['SmsInteraction']['rawAttributes']);_0x39cfcb[_0x3c55('0x2b')]=_[_0x3c55('0x2a')](_0x656407[_0x3c55('0x2b')]);_0x39cfcb[_0x3c55('0x2c')]=_[_0x3c55('0x2d')](_0x39cfcb[_0x3c55('0x29')],_0x39cfcb['query']);_0x1a2204['attributes']=_[_0x3c55('0x2d')](_0x39cfcb[_0x3c55('0x29')],qs['fields'](_0x656407['query'][_0x3c55('0x2e')]));_0x1a2204[_0x3c55('0x2f')]=_0x1a2204['attributes'][_0x3c55('0x30')]?_0x1a2204['attributes']:_0x39cfcb[_0x3c55('0x29')];if(_0x656407[_0x3c55('0x2b')][_0x3c55('0x31')]){_0x1a2204[_0x3c55('0x32')]=[{'all':!![]}];}_0x1a2204=_['merge']({},_0x1a2204,_0x656407[_0x3c55('0x33')]);return db['SmsInteraction'][_0x3c55('0x34')](_0x1a2204)[_0x3c55('0x19')](handleEntityNotFound(_0x40b4a8,null))[_0x3c55('0x19')](respondWithResult(_0x40b4a8,null))[_0x3c55('0x26')](handleError(_0x40b4a8,null));};exports[_0x3c55('0x35')]=function(_0x4e877d,_0x4be12c){return db[_0x3c55('0x20')]['create'](_0x4e877d[_0x3c55('0x36')],{})[_0x3c55('0x19')](respondWithResult(_0x4be12c,0xc9))[_0x3c55('0x26')](handleError(_0x4be12c,null));};exports['update']=function(_0x2e8de5,_0x8916e9){if(_0x2e8de5[_0x3c55('0x36')]['id']){delete _0x2e8de5[_0x3c55('0x36')]['id'];}return db[_0x3c55('0x20')][_0x3c55('0x34')]({'where':{'id':_0x2e8de5[_0x3c55('0x28')]['id']}})['then'](handleEntityNotFound(_0x8916e9,null))[_0x3c55('0x19')](saveUpdates(_0x2e8de5[_0x3c55('0x36')],null))[_0x3c55('0x19')](respondWithResult(_0x8916e9,null))[_0x3c55('0x26')](handleError(_0x8916e9,null));};exports[_0x3c55('0x1a')]=function(_0xa0e16d,_0x1c2de9){return db[_0x3c55('0x20')]['find']({'where':{'id':_0xa0e16d[_0x3c55('0x28')]['id']}})[_0x3c55('0x19')](handleEntityNotFound(_0x1c2de9,null))[_0x3c55('0x19')](removeEntity(_0x1c2de9,null))[_0x3c55('0x26')](handleError(_0x1c2de9,null));};exports[_0x3c55('0x37')]=function(_0x4933f1,_0x404830){return db[_0x3c55('0x20')][_0x3c55('0x37')]()[_0x3c55('0x19')](respondWithResult(_0x404830,null))[_0x3c55('0x26')](handleError(_0x404830,null));};exports[_0x3c55('0x38')]=function(_0x26092c,_0x307d7a){return db[_0x3c55('0x39')]['find']({'where':{'id':_0x26092c[_0x3c55('0x28')]['id']}})[_0x3c55('0x19')](handleEntityNotFound(_0x307d7a,null))[_0x3c55('0x19')](function(_0x5e6fa2){if(_0x5e6fa2){return _0x5e6fa2[_0x3c55('0x38')](_0x26092c[_0x3c55('0x36')][_0x3c55('0x3a')],_[_0x3c55('0x3b')](_0x26092c[_0x3c55('0x36')],[_0x3c55('0x3a'),'id'])||{});}})['then'](respondWithResult(_0x307d7a,null))[_0x3c55('0x26')](handleError(_0x307d7a,null));};exports['getMessages']=function(_0x10b9b8,_0x2204ad){var _0x1adf50={'raw':![],'where':{}};var _0x6b0d1={};var _0x382920={'count':0x0,'rows':[]};return db[_0x3c55('0x20')][_0x3c55('0x3c')]({'where':{'id':_0x10b9b8[_0x3c55('0x28')]['id']}})[_0x3c55('0x19')](handleEntityNotFound(_0x2204ad,null))['then'](function(_0x5a1f8b){if(_0x5a1f8b){_0x6b0d1[_0x3c55('0x29')]=_[_0x3c55('0x2a')](db['SmsMessage'][_0x3c55('0x21')]);_0x6b0d1['query']=_['keys'](_0x10b9b8[_0x3c55('0x2b')]);_0x6b0d1[_0x3c55('0x2c')]=_[_0x3c55('0x2d')](_0x6b0d1[_0x3c55('0x29')],_0x6b0d1['query']);_0x1adf50['attributes']=_[_0x3c55('0x2d')](_0x6b0d1[_0x3c55('0x29')],qs[_0x3c55('0x2e')](_0x10b9b8[_0x3c55('0x2b')][_0x3c55('0x2e')]));_0x1adf50[_0x3c55('0x2f')]=_0x1adf50[_0x3c55('0x2f')][_0x3c55('0x30')]?_0x1adf50[_0x3c55('0x2f')]:_0x6b0d1[_0x3c55('0x29')];if(!_0x10b9b8['query'][_0x3c55('0x3d')](_0x3c55('0x3e'))){_0x1adf50[_0x3c55('0x13')]=qs[_0x3c55('0x13')](_0x10b9b8[_0x3c55('0x2b')][_0x3c55('0x13')]);_0x1adf50['offset']=qs[_0x3c55('0x11')](_0x10b9b8[_0x3c55('0x2b')][_0x3c55('0x11')]);}_0x1adf50[_0x3c55('0x3f')]=qs['sort'](_0x10b9b8['query']['sort']);_0x1adf50[_0x3c55('0x40')]=qs[_0x3c55('0x2c')](_[_0x3c55('0x41')](_0x10b9b8[_0x3c55('0x2b')],_0x6b0d1[_0x3c55('0x2c')]));_0x1adf50[_0x3c55('0x40')]['SmsInteractionId']=_0x5a1f8b['id'];if(_0x10b9b8[_0x3c55('0x2b')]['filter']){_0x1adf50['where']=_[_0x3c55('0x42')](_0x1adf50[_0x3c55('0x40')],{'$or':_[_0x3c55('0x1f')](_0x1adf50[_0x3c55('0x2f')],function(_0x2c3a02){var _0x2f3285={};_0x2f3285[_0x2c3a02]={'$like':'%'+_0x10b9b8[_0x3c55('0x2b')][_0x3c55('0x43')]+'%'};return _0x2f3285;})});}if(_0x10b9b8[_0x3c55('0x2b')]['$gte']){var _0x5cb4e5=_0x10b9b8[_0x3c55('0x2b')][_0x3c55('0x44')][_0x3c55('0x45')](',');var _0x1845ab={};_0x1845ab[_0x5cb4e5[0x0]]={'$gte':moment(_0x5cb4e5[0x1])[_0x3c55('0x46')](_0x3c55('0x47'))};_0x1adf50[_0x3c55('0x40')]=_[_0x3c55('0x42')](_0x1adf50['where'],_0x1845ab);}_0x1adf50=_[_0x3c55('0x42')]({},_0x1adf50,_0x10b9b8[_0x3c55('0x33')]);return db['SmsMessage']['count']({'where':_0x1adf50['where']})[_0x3c55('0x19')](function(_0x29eae4){_0x382920['count']=_0x29eae4;if(_0x10b9b8['query'][_0x3c55('0x31')]){_0x1adf50[_0x3c55('0x32')]=[{'all':!![]}];}return db['SmsMessage'][_0x3c55('0x24')](_0x1adf50);})[_0x3c55('0x19')](function(_0x1ce214){_0x382920[_0x3c55('0x48')]=_0x1ce214;return _0x382920;});}})[_0x3c55('0x19')](respondWithFilteredResult(_0x2204ad,_0x1adf50))['catch'](handleError(_0x2204ad,null));};exports[_0x3c55('0x49')]=function(_0x3a8d2c,_0x53b360){return db['SmsInteraction'][_0x3c55('0x34')]({'where':{'id':_0x3a8d2c[_0x3c55('0x28')]['id']}})[_0x3c55('0x19')](handleEntityNotFound(_0x53b360,null))['then'](function(_0xab600b){if(_0xab600b){return _0xab600b[_0x3c55('0x4a')](_0x3a8d2c[_0x3c55('0x36')]['ids'],_[_0x3c55('0x3b')](_0x3a8d2c[_0x3c55('0x36')],[_0x3c55('0x3a'),'id'])||{})[_0x3c55('0x4b')](function(){return db[_0x3c55('0x4c')]['findAll']({'attributes':['id',_0x3c55('0x1c'),'color'],'where':{'id':_0x3a8d2c[_0x3c55('0x36')][_0x3c55('0x3a')]}});})[_0x3c55('0x19')](function(_0x3d693a){socket['emit'](_0x3c55('0x4d'),{'id':Number(_0x3a8d2c[_0x3c55('0x28')]['id']),'tags':_0x3d693a||[]});return{'id':Number(_0x3a8d2c[_0x3c55('0x28')]['id']),'tags':_0x3d693a||[]};});}})['then'](respondWithResult(_0x53b360,null))[_0x3c55('0x26')](handleError(_0x53b360,null));};exports[_0x3c55('0x4e')]=function(_0x278069,_0x38cf9c){return db[_0x3c55('0x20')][_0x3c55('0x34')]({'where':{'id':_0x278069[_0x3c55('0x28')]['id']}})['then'](handleEntityNotFound(_0x38cf9c,null))[_0x3c55('0x19')](function(_0x16d3a2){if(_0x16d3a2){return _0x16d3a2[_0x3c55('0x4e')](_0x278069[_0x3c55('0x2b')]['ids']);}})['then'](respondWithStatusCode(_0x38cf9c,null))[_0x3c55('0x26')](handleError(_0x38cf9c,null));};exports['download']=function(_0x520b4b,_0x5e346d){var _0xb2b637=moment()['unix']()['toString']();var _0x413681=path['join'](config[_0x3c55('0x4f')],'server',_0x3c55('0x50'),_0x3c55('0x51'));var _0x18331e=path[_0x3c55('0x52')](_0x413681,_0xb2b637);var _0x35b072=util[_0x3c55('0x46')](_0x3c55('0x53'),_0x520b4b[_0x3c55('0x28')]['id'],_0xb2b637);var _0xb632d6=path[_0x3c55('0x52')](_0x413681,_0x35b072);var _0x391e17=[];_0x391e17[_0x3c55('0x54')]({'model':db[_0x3c55('0x55')],'as':_0x3c55('0x55'),'attributes':['id',_0x3c55('0x56')],'raw':!![]});_0x391e17[_0x3c55('0x54')]({'model':db[_0x3c55('0x57')],'as':_0x3c55('0x58'),'attributes':['id',_0x3c55('0x59'),_0x3c55('0x5a')],'raw':!![]});var _0x2110c3=[{'model':db[_0x3c55('0x39')],'as':'Messages','attributes':['id',_0x3c55('0x36'),_0x3c55('0x5b'),'direction',_0x3c55('0x5c'),_0x3c55('0x5d')],'include':_0x391e17}];_0x2110c3[_0x3c55('0x54')]({'model':db['SmsAccount'],'as':_0x3c55('0x5e'),'attributes':['id','name']});_0x2110c3[_0x3c55('0x54')]({'model':db['User'],'as':_0x3c55('0x5f'),'attributes':['id','fullname']});return db[_0x3c55('0x20')][_0x3c55('0x34')]({'where':{'id':_0x520b4b[_0x3c55('0x28')]['id']},'include':_0x2110c3})[_0x3c55('0x19')](handleEntityNotFound(_0x5e346d,null))['then'](function(_0x489916){if(_0x489916){var _0x26ba76=_0x489916[_0x3c55('0x60')]({'plain':!![]});fs['mkdirSync'](_0x18331e);var _0x41d96a={'channel':'Sms','account':_0x26ba76[_0x3c55('0x5e')][_0x3c55('0x1c')],'agent':_0x26ba76[_0x3c55('0x5f')]?_0x26ba76[_0x3c55('0x5f')][_0x3c55('0x56')]:_0x3c55('0x61'),'createdAt':moment(_0x26ba76[_0x3c55('0x5b')])[_0x3c55('0x46')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x26ba76[_0x3c55('0x62')]?moment(_0x26ba76['closedAt'])[_0x3c55('0x46')](_0x3c55('0x47'))[_0x3c55('0x63')]():'','disposition':_0x26ba76['disposition'],'messages':_(_0x26ba76[_0x3c55('0x64')])[_0x3c55('0x43')]({'secret':![]})[_0x3c55('0x1f')](function(_0x113f4d){return{'date':moment(_0x113f4d['createdAt'])[_0x3c55('0x46')](_0x3c55('0x47'))[_0x3c55('0x63')](),'sender':_0x113f4d[_0x3c55('0x65')]===_0x3c55('0x66')?_0x113f4d[_0x3c55('0x55')]?_0x113f4d['User']['fullname']:'System':_0x113f4d[_0x3c55('0x58')][_0x3c55('0x59')]+(_0x113f4d[_0x3c55('0x58')][_0x3c55('0x5a')]?'\x20'+_0x113f4d['Contact'][_0x3c55('0x5a')]:''),'body':_0x113f4d[_0x3c55('0x36')],'direction':_0x113f4d[_0x3c55('0x65')]===_0x3c55('0x66')?'A':'C','secret':_0x113f4d[_0x3c55('0x5c')],'read':_0x113f4d['read']};})['value']()};return ejs[_0x3c55('0x67')](path[_0x3c55('0x52')](config[_0x3c55('0x4f')],_0x3c55('0x68'),_0x3c55('0x69'),'downloadInteraction.ejs'),{'interaction':_0x41d96a})[_0x3c55('0x19')](function(_0x44948c){var _0x8a49bd=path[_0x3c55('0x52')](_0x18331e,'transcript-'+_0x26ba76['id']+'-'+_0xb2b637+'.pdf');var _0xc31688={'path':_0x8a49bd,'channel':_0x3c55('0x6a'),'interactionId':_0x26ba76['id']};return pdf['createPdfFromHTML'](_0x44948c,_0xc31688);})[_0x3c55('0x19')](function(){return new BPromise(function(_0x538354,_0x557e9a){zipdir(_0x18331e,{'saveTo':_0xb632d6},function(_0x43dfe2,_0x47341f){if(_0x43dfe2)return _0x557e9a(_0x43dfe2);return _0x538354(_0x47341f);});})['then'](function(){return new BPromise(function(_0x252e4e,_0x20e96f){rimraf(_0x18331e,function(_0x533a4f){if(_0x533a4f)_0x20e96f(_0x533a4f);return _0x252e4e();});});})[_0x3c55('0x19')](function(){return _0x5e346d[_0x3c55('0x6b')](_0xb632d6,_0x35b072,function(_0x505ae7){if(_0x505ae7){console['log'](_0x3c55('0x6c'),_0x505ae7);}else{fs[_0x3c55('0x6d')](_0xb632d6);}});});});}else{return _0x5e346d[_0x3c55('0xf')](0xc8);}})[_0x3c55('0x26')](handleError(_0x5e346d,null));}; \ No newline at end of file +var _0x4faf=['server','views','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','map','SmsInteraction','key','getOptions','findAll','sms','query','catch','keys','rawAttributes','filters','intersection','attributes','model','fields','length','include','options','find','create','body','params','describe','addMessage','ids','SmsMessage','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','$gte','split','includeAll','setTags','spread','color','emit','removeTags','download','unix','join','root','tmp','transcript-%d-%s.zip','User','fullname','push','CmContact','Contact','firstName','lastName','Messages','createdAt','secret','read','SmsAccount','Account','Owner','mkdirSync','Sms','N.A.','format','YYYY-MM-DD\x20HH:mm:ss','toString','closed','closedAt','disposition','System','direction','out','value'];(function(_0x4aefc9,_0x27bfdc){var _0x1537a4=function(_0x3836a6){while(--_0x3836a6){_0x4aefc9['push'](_0x4aefc9['shift']());}};_0x1537a4(++_0x27bfdc);}(_0x4faf,0x1dc));var _0xf4fa=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4faf[_0x20a584];return _0x4b41a8;};'use strict';var rimraf=require(_0xf4fa('0x0'));var zipdir=require(_0xf4fa('0x1'));var moment=require(_0xf4fa('0x2'));var BPromise=require(_0xf4fa('0x3'));var util=require(_0xf4fa('0x4'));var path=require('path');var ejs=require(_0xf4fa('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xf4fa('0x6'));var interaction=require(_0xf4fa('0x7'));var qs=require(_0xf4fa('0x8'));var pdf=require(_0xf4fa('0x9'));var logger=require('../../config/logger')(_0xf4fa('0xa'));var config=require(_0xf4fa('0xb'));var db=require(_0xf4fa('0xc'))['db'];config['redis']=_[_0xf4fa('0xd')](config['redis'],{'host':_0xf4fa('0xe'),'port':0x18eb});var socket=require(_0xf4fa('0xf'))(new Redis(config[_0xf4fa('0x10')]));require('./smsInteraction.socket')[_0xf4fa('0x11')](socket);function respondWithStatusCode(_0xe44ee4,_0x18bf4b){_0x18bf4b=_0x18bf4b||0xcc;return function(_0x572dbf){if(_0x572dbf){return _0xe44ee4[_0xf4fa('0x12')](_0x18bf4b);}return _0xe44ee4[_0xf4fa('0x13')](_0x18bf4b)['end']();};}function respondWithResult(_0x58a809,_0x5e4a67){_0x5e4a67=_0x5e4a67||0xc8;return function(_0x11356e){if(_0x11356e){return _0x58a809[_0xf4fa('0x13')](_0x5e4a67)[_0xf4fa('0x14')](_0x11356e);}};}function respondWithFilteredResult(_0x1bb5af,_0x821ea9){return function(_0xc21b49){if(_0xc21b49){var _0x3b58a2=typeof _0x821ea9[_0xf4fa('0x15')]===_0xf4fa('0x16')&&typeof _0x821ea9[_0xf4fa('0x17')]===_0xf4fa('0x16');var _0x3b0843=_0xc21b49[_0xf4fa('0x18')];var _0x51190f=_0x3b58a2?0x0:_0x821ea9[_0xf4fa('0x15')];var _0x3f53c1=_0x3b58a2?_0xc21b49[_0xf4fa('0x18')]:_0x821ea9['offset']+_0x821ea9[_0xf4fa('0x17')];var _0x22c4d5;if(_0x3f53c1>=_0x3b0843){_0x3f53c1=_0x3b0843;_0x22c4d5=0xc8;}else{_0x22c4d5=0xce;}_0x1bb5af[_0xf4fa('0x13')](_0x22c4d5);return _0x1bb5af[_0xf4fa('0x19')](_0xf4fa('0x1a'),_0x51190f+'-'+_0x3f53c1+'/'+_0x3b0843)[_0xf4fa('0x14')](_0xc21b49);}return null;};}function saveUpdates(_0x3c88f8){return function(_0x56089a){if(_0x56089a){return _0x56089a[_0xf4fa('0x1b')](_0x3c88f8)[_0xf4fa('0x1c')](function(_0x3ebd4a){return _0x3ebd4a;});}return null;};}function removeEntity(_0x378dcf){return function(_0x2c310c){if(_0x2c310c){return _0x2c310c[_0xf4fa('0x1d')]()[_0xf4fa('0x1c')](function(){_0x378dcf[_0xf4fa('0x13')](0xcc)[_0xf4fa('0x1e')]();});}};}function handleEntityNotFound(_0x1f8df1){return function(_0x5849be){if(!_0x5849be){_0x1f8df1[_0xf4fa('0x12')](0x194);}return _0x5849be;};}function handleError(_0x52fc7d,_0x2f4da9){_0x2f4da9=_0x2f4da9||0x1f4;return function(_0x5d6474){logger['error'](_0x5d6474[_0xf4fa('0x1f')]);if(_0x5d6474[_0xf4fa('0x20')]){delete _0x5d6474[_0xf4fa('0x20')];}_0x52fc7d[_0xf4fa('0x13')](_0x2f4da9)[_0xf4fa('0x21')](_0x5d6474);};}exports['index']=function(_0x26cf63,_0x41302c){var _0x520aee={};var _0x3ba634=_[_0xf4fa('0x22')](db[_0xf4fa('0x23')]['rawAttributes'],function(_0x1e4571){return{'name':_0x1e4571['fieldName'],'type':_0x1e4571['type'][_0xf4fa('0x24')]};});_0x520aee=qs[_0xf4fa('0x25')](_0x3ba634,_0x26cf63);return interaction[_0xf4fa('0x26')](_0xf4fa('0x27'),_0x26cf63[_0xf4fa('0x28')],_0x26cf63['user'],_0x520aee,_0x3ba634)[_0xf4fa('0x1c')](respondWithFilteredResult(_0x41302c,_0x520aee))[_0xf4fa('0x29')](handleError(_0x41302c,null));};exports['show']=function(_0x25ba68,_0x4eae18){var _0x1cb598={'raw':![],'where':{'id':_0x25ba68['params']['id']}},_0x140dda={};_0x140dda['model']=_[_0xf4fa('0x2a')](db[_0xf4fa('0x23')][_0xf4fa('0x2b')]);_0x140dda[_0xf4fa('0x28')]=_[_0xf4fa('0x2a')](_0x25ba68[_0xf4fa('0x28')]);_0x140dda[_0xf4fa('0x2c')]=_[_0xf4fa('0x2d')](_0x140dda['model'],_0x140dda[_0xf4fa('0x28')]);_0x1cb598[_0xf4fa('0x2e')]=_['intersection'](_0x140dda[_0xf4fa('0x2f')],qs[_0xf4fa('0x30')](_0x25ba68[_0xf4fa('0x28')]['fields']));_0x1cb598['attributes']=_0x1cb598['attributes'][_0xf4fa('0x31')]?_0x1cb598[_0xf4fa('0x2e')]:_0x140dda['model'];if(_0x25ba68['query']['includeAll']){_0x1cb598[_0xf4fa('0x32')]=[{'all':!![]}];}_0x1cb598=_['merge']({},_0x1cb598,_0x25ba68[_0xf4fa('0x33')]);return db[_0xf4fa('0x23')][_0xf4fa('0x34')](_0x1cb598)[_0xf4fa('0x1c')](handleEntityNotFound(_0x4eae18,null))['then'](respondWithResult(_0x4eae18,null))['catch'](handleError(_0x4eae18,null));};exports['create']=function(_0x10968b,_0x2e37b6){return db[_0xf4fa('0x23')][_0xf4fa('0x35')](_0x10968b[_0xf4fa('0x36')],{})[_0xf4fa('0x1c')](respondWithResult(_0x2e37b6,0xc9))[_0xf4fa('0x29')](handleError(_0x2e37b6,null));};exports[_0xf4fa('0x1b')]=function(_0x3ebd33,_0x11b287){if(_0x3ebd33[_0xf4fa('0x36')]['id']){delete _0x3ebd33['body']['id'];}return db[_0xf4fa('0x23')][_0xf4fa('0x34')]({'where':{'id':_0x3ebd33[_0xf4fa('0x37')]['id']}})[_0xf4fa('0x1c')](handleEntityNotFound(_0x11b287,null))[_0xf4fa('0x1c')](saveUpdates(_0x3ebd33[_0xf4fa('0x36')],null))[_0xf4fa('0x1c')](respondWithResult(_0x11b287,null))[_0xf4fa('0x29')](handleError(_0x11b287,null));};exports[_0xf4fa('0x1d')]=function(_0x9b4ae0,_0x388602){return db[_0xf4fa('0x23')][_0xf4fa('0x34')]({'where':{'id':_0x9b4ae0[_0xf4fa('0x37')]['id']}})[_0xf4fa('0x1c')](handleEntityNotFound(_0x388602,null))[_0xf4fa('0x1c')](removeEntity(_0x388602,null))[_0xf4fa('0x29')](handleError(_0x388602,null));};exports[_0xf4fa('0x38')]=function(_0x2f866d,_0x2f7520){return db[_0xf4fa('0x23')][_0xf4fa('0x38')]()[_0xf4fa('0x1c')](respondWithResult(_0x2f7520,null))[_0xf4fa('0x29')](handleError(_0x2f7520,null));};exports[_0xf4fa('0x39')]=function(_0x5ae8bd,_0x2f88eb){return db['SmsMessage'][_0xf4fa('0x34')]({'where':{'id':_0x5ae8bd[_0xf4fa('0x37')]['id']}})['then'](handleEntityNotFound(_0x2f88eb,null))['then'](function(_0x48d369){if(_0x48d369){return _0x48d369['addMessage'](_0x5ae8bd[_0xf4fa('0x36')][_0xf4fa('0x3a')],_['omit'](_0x5ae8bd['body'],[_0xf4fa('0x3a'),'id'])||{});}})[_0xf4fa('0x1c')](respondWithResult(_0x2f88eb,null))[_0xf4fa('0x29')](handleError(_0x2f88eb,null));};exports['getMessages']=function(_0x496ef2,_0x228991){var _0x48ec3d={'raw':![],'where':{}};var _0x44aeb5={};var _0x45e59f={'count':0x0,'rows':[]};return db[_0xf4fa('0x23')]['findOne']({'where':{'id':_0x496ef2[_0xf4fa('0x37')]['id']}})['then'](handleEntityNotFound(_0x228991,null))[_0xf4fa('0x1c')](function(_0x91cce9){if(_0x91cce9){_0x44aeb5[_0xf4fa('0x2f')]=_['keys'](db[_0xf4fa('0x3b')][_0xf4fa('0x2b')]);_0x44aeb5[_0xf4fa('0x28')]=_[_0xf4fa('0x2a')](_0x496ef2[_0xf4fa('0x28')]);_0x44aeb5[_0xf4fa('0x2c')]=_[_0xf4fa('0x2d')](_0x44aeb5[_0xf4fa('0x2f')],_0x44aeb5[_0xf4fa('0x28')]);_0x48ec3d[_0xf4fa('0x2e')]=_[_0xf4fa('0x2d')](_0x44aeb5[_0xf4fa('0x2f')],qs[_0xf4fa('0x30')](_0x496ef2[_0xf4fa('0x28')]['fields']));_0x48ec3d[_0xf4fa('0x2e')]=_0x48ec3d[_0xf4fa('0x2e')][_0xf4fa('0x31')]?_0x48ec3d[_0xf4fa('0x2e')]:_0x44aeb5[_0xf4fa('0x2f')];if(!_0x496ef2[_0xf4fa('0x28')][_0xf4fa('0x3c')](_0xf4fa('0x3d'))){_0x48ec3d[_0xf4fa('0x17')]=qs['limit'](_0x496ef2[_0xf4fa('0x28')]['limit']);_0x48ec3d['offset']=qs['offset'](_0x496ef2[_0xf4fa('0x28')][_0xf4fa('0x15')]);}_0x48ec3d[_0xf4fa('0x3e')]=qs[_0xf4fa('0x3f')](_0x496ef2[_0xf4fa('0x28')][_0xf4fa('0x3f')]);_0x48ec3d[_0xf4fa('0x40')]=qs[_0xf4fa('0x2c')](_[_0xf4fa('0x41')](_0x496ef2[_0xf4fa('0x28')],_0x44aeb5[_0xf4fa('0x2c')]));_0x48ec3d['where']['SmsInteractionId']=_0x91cce9['id'];if(_0x496ef2['query'][_0xf4fa('0x42')]){_0x48ec3d[_0xf4fa('0x40')]=_[_0xf4fa('0x43')](_0x48ec3d['where'],{'$or':_['map'](_0x48ec3d[_0xf4fa('0x2e')],function(_0x1ced51){var _0x5ceb7a={};_0x5ceb7a[_0x1ced51]={'$like':'%'+_0x496ef2['query'][_0xf4fa('0x42')]+'%'};return _0x5ceb7a;})});}if(_0x496ef2[_0xf4fa('0x28')][_0xf4fa('0x44')]){var _0x171973=_0x496ef2[_0xf4fa('0x28')]['$gte'][_0xf4fa('0x45')](',');var _0x2726d7={};_0x2726d7[_0x171973[0x0]]={'$gte':moment(_0x171973[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x48ec3d[_0xf4fa('0x40')]=_['merge'](_0x48ec3d[_0xf4fa('0x40')],_0x2726d7);}_0x48ec3d=_[_0xf4fa('0x43')]({},_0x48ec3d,_0x496ef2[_0xf4fa('0x33')]);return db[_0xf4fa('0x3b')]['count']({'where':_0x48ec3d[_0xf4fa('0x40')]})[_0xf4fa('0x1c')](function(_0x31f812){_0x45e59f[_0xf4fa('0x18')]=_0x31f812;if(_0x496ef2[_0xf4fa('0x28')][_0xf4fa('0x46')]){_0x48ec3d[_0xf4fa('0x32')]=[{'all':!![]}];}return db[_0xf4fa('0x3b')]['findAll'](_0x48ec3d);})[_0xf4fa('0x1c')](function(_0x209973){_0x45e59f['rows']=_0x209973;return _0x45e59f;});}})[_0xf4fa('0x1c')](respondWithFilteredResult(_0x228991,_0x48ec3d))[_0xf4fa('0x29')](handleError(_0x228991,null));};exports['addTags']=function(_0x2abd79,_0x4946fd){return db[_0xf4fa('0x23')][_0xf4fa('0x34')]({'where':{'id':_0x2abd79['params']['id']}})[_0xf4fa('0x1c')](handleEntityNotFound(_0x4946fd,null))['then'](function(_0x3d0282){if(_0x3d0282){return _0x3d0282[_0xf4fa('0x47')](_0x2abd79[_0xf4fa('0x36')][_0xf4fa('0x3a')],_['omit'](_0x2abd79['body'],[_0xf4fa('0x3a'),'id'])||{})[_0xf4fa('0x48')](function(){return db['Tag'][_0xf4fa('0x26')]({'attributes':['id',_0xf4fa('0x20'),_0xf4fa('0x49')],'where':{'id':_0x2abd79[_0xf4fa('0x36')][_0xf4fa('0x3a')]}});})[_0xf4fa('0x1c')](function(_0x203e4b){socket[_0xf4fa('0x4a')]('smsInteractionTags:save',{'id':Number(_0x2abd79[_0xf4fa('0x37')]['id']),'tags':_0x203e4b||[]});return{'id':Number(_0x2abd79[_0xf4fa('0x37')]['id']),'tags':_0x203e4b||[]};});}})[_0xf4fa('0x1c')](respondWithResult(_0x4946fd,null))[_0xf4fa('0x29')](handleError(_0x4946fd,null));};exports['removeTags']=function(_0xc89b69,_0x273d83){return db[_0xf4fa('0x23')][_0xf4fa('0x34')]({'where':{'id':_0xc89b69['params']['id']}})['then'](handleEntityNotFound(_0x273d83,null))[_0xf4fa('0x1c')](function(_0x301324){if(_0x301324){return _0x301324[_0xf4fa('0x4b')](_0xc89b69['query']['ids']);}})[_0xf4fa('0x1c')](respondWithStatusCode(_0x273d83,null))['catch'](handleError(_0x273d83,null));};exports[_0xf4fa('0x4c')]=function(_0x3c687b,_0x3f75a5){var _0x1d02d1=moment()[_0xf4fa('0x4d')]()['toString']();var _0x319737=path[_0xf4fa('0x4e')](config[_0xf4fa('0x4f')],'server','files',_0xf4fa('0x50'));var _0x53b3d7=path[_0xf4fa('0x4e')](_0x319737,_0x1d02d1);var _0x13da90=util['format'](_0xf4fa('0x51'),_0x3c687b[_0xf4fa('0x37')]['id'],_0x1d02d1);var _0x2a8461=path[_0xf4fa('0x4e')](_0x319737,_0x13da90);var _0x42c454=[];_0x42c454['push']({'model':db[_0xf4fa('0x52')],'as':_0xf4fa('0x52'),'attributes':['id',_0xf4fa('0x53')],'raw':!![]});_0x42c454[_0xf4fa('0x54')]({'model':db[_0xf4fa('0x55')],'as':_0xf4fa('0x56'),'attributes':['id',_0xf4fa('0x57'),_0xf4fa('0x58')],'raw':!![]});var _0x3ad620=[{'model':db[_0xf4fa('0x3b')],'as':_0xf4fa('0x59'),'attributes':['id',_0xf4fa('0x36'),_0xf4fa('0x5a'),'direction',_0xf4fa('0x5b'),_0xf4fa('0x5c')],'include':_0x42c454}];_0x3ad620['push']({'model':db[_0xf4fa('0x5d')],'as':_0xf4fa('0x5e'),'attributes':['id',_0xf4fa('0x20')]});_0x3ad620[_0xf4fa('0x54')]({'model':db[_0xf4fa('0x52')],'as':_0xf4fa('0x5f'),'attributes':['id',_0xf4fa('0x53')]});return db[_0xf4fa('0x23')]['find']({'where':{'id':_0x3c687b[_0xf4fa('0x37')]['id']},'include':_0x3ad620})[_0xf4fa('0x1c')](handleEntityNotFound(_0x3f75a5,null))[_0xf4fa('0x1c')](function(_0x5c214e){if(_0x5c214e){var _0x2b2016=_0x5c214e['get']({'plain':!![]});fs[_0xf4fa('0x60')](_0x53b3d7);var _0xe9928e={'channel':_0xf4fa('0x61'),'account':_0x2b2016[_0xf4fa('0x5e')][_0xf4fa('0x20')],'agent':_0x2b2016['Owner']?_0x2b2016[_0xf4fa('0x5f')][_0xf4fa('0x53')]:_0xf4fa('0x62'),'createdAt':moment(_0x2b2016['createdAt'])[_0xf4fa('0x63')](_0xf4fa('0x64'))[_0xf4fa('0x65')](),'closedAt':_0x2b2016[_0xf4fa('0x66')]?moment(_0x2b2016[_0xf4fa('0x67')])[_0xf4fa('0x63')](_0xf4fa('0x64'))[_0xf4fa('0x65')]():'','disposition':_0x2b2016[_0xf4fa('0x68')],'messages':_(_0x2b2016[_0xf4fa('0x59')])[_0xf4fa('0x42')]({'secret':![]})[_0xf4fa('0x22')](function(_0x5b0b4c){return{'date':moment(_0x5b0b4c['createdAt'])[_0xf4fa('0x63')](_0xf4fa('0x64'))[_0xf4fa('0x65')](),'sender':_0x5b0b4c['direction']==='out'?_0x5b0b4c[_0xf4fa('0x52')]?_0x5b0b4c[_0xf4fa('0x52')][_0xf4fa('0x53')]:_0xf4fa('0x69'):_0x5b0b4c[_0xf4fa('0x56')]['firstName']+(_0x5b0b4c[_0xf4fa('0x56')][_0xf4fa('0x58')]?'\x20'+_0x5b0b4c[_0xf4fa('0x56')][_0xf4fa('0x58')]:''),'body':_0x5b0b4c['body'],'direction':_0x5b0b4c[_0xf4fa('0x6a')]===_0xf4fa('0x6b')?'A':'C','secret':_0x5b0b4c[_0xf4fa('0x5b')],'read':_0x5b0b4c[_0xf4fa('0x5c')]};})[_0xf4fa('0x6c')]()};return ejs['renderFile'](path['join'](config[_0xf4fa('0x4f')],_0xf4fa('0x6d'),_0xf4fa('0x6e'),'downloadInteraction.ejs'),{'interaction':_0xe9928e})[_0xf4fa('0x1c')](function(_0x58229c){var _0x4fd390=path[_0xf4fa('0x4e')](_0x53b3d7,_0xf4fa('0x6f')+_0x2b2016['id']+'-'+_0x1d02d1+_0xf4fa('0x70'));var _0x2a4f62={'path':_0x4fd390,'channel':_0xf4fa('0x61'),'interactionId':_0x2b2016['id']};return pdf[_0xf4fa('0x71')](_0x58229c,_0x2a4f62);})[_0xf4fa('0x1c')](function(){return new BPromise(function(_0x2b768b,_0x39cd02){zipdir(_0x53b3d7,{'saveTo':_0x2a8461},function(_0x5e458b,_0x4a1600){if(_0x5e458b)return _0x39cd02(_0x5e458b);return _0x2b768b(_0x4a1600);});})['then'](function(){return new BPromise(function(_0x4b99ab,_0x1b6c9d){rimraf(_0x53b3d7,function(_0x8b6248){if(_0x8b6248)_0x1b6c9d(_0x8b6248);return _0x4b99ab();});});})['then'](function(){return _0x3f75a5[_0xf4fa('0x4c')](_0x2a8461,_0x13da90,function(_0x5ead5a){if(_0x5ead5a){console[_0xf4fa('0x72')](_0xf4fa('0x73'),_0x5ead5a);}else{fs[_0xf4fa('0x74')](_0x2a8461);}});});});}else{return _0x3f75a5[_0xf4fa('0x12')](0xc8);}})['catch'](handleError(_0x3f75a5,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 4405734..59ee64a 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 _0x4325=['Users','map','findAll','then','setDataValue','length','emit','catch','exports','events','../../mysqldb','SmsMessage','setMaxListeners','remove','getUsers'];(function(_0x2263cc,_0x2e1dc9){var _0x1ba214=function(_0x2c4fe3){while(--_0x2c4fe3){_0x2263cc['push'](_0x2263cc['shift']());}};_0x1ba214(++_0x2e1dc9);}(_0x4325,0x1da));var _0x5432=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x4325[_0x4b369d];return _0x571a98;};'use strict';var EventEmitter=require(_0x5432('0x0'));var SmsInteraction=require(_0x5432('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0x5432('0x1'))['db'][_0x5432('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x5432('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5432('0x4')};function emitEvent(_0x36ce53){return function(_0xad26e9,_0x4acbe4,_0x209e2e){_0xad26e9[_0x5432('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x106ec9){_0xad26e9['setDataValue'](_0x5432('0x6'),_0x106ec9[_0x5432('0x7')](function(_0x40e756){return{'id':_0x40e756['id']};}));return SmsMessage[_0x5432('0x8')]({'where':{'SmsInteractionId':_0xad26e9['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5432('0x9')](function(_0x4a9a51){_0xad26e9[_0x5432('0xa')]('unreadMessages',_0x4a9a51[_0x5432('0xb')]);SmsInteractionEvents[_0x5432('0xc')](_0x36ce53+':'+_0xad26e9['id'],_0xad26e9);SmsInteractionEvents[_0x5432('0xc')](_0x36ce53,_0xad26e9);_0x209e2e(null);})[_0x5432('0xd')](_0x209e2e(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x5432('0xe')]=SmsInteractionEvents; \ No newline at end of file +var _0xef0f=['SmsInteraction','../../mysqldb','SmsMessage','save','update','remove','getUsers','then','Users','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events'];(function(_0x544ded,_0x2cd874){var _0x598372=function(_0x3b0cda){while(--_0x3b0cda){_0x544ded['push'](_0x544ded['shift']());}};_0x598372(++_0x2cd874);}(_0xef0f,0x168));var _0xfef0=function(_0x1e69e5,_0x31c9d7){_0x1e69e5=_0x1e69e5-0x0;var _0x54927a=_0xef0f[_0x1e69e5];return _0x54927a;};'use strict';var EventEmitter=require(_0xfef0('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0xfef0('0x1')];var SmsMessage=require(_0xfef0('0x2'))['db'][_0xfef0('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfef0('0x4'),'afterUpdate':_0xfef0('0x5'),'afterDestroy':_0xfef0('0x6')};function emitEvent(_0x4e1af6){return function(_0x2a6fcf,_0x9b8b9e,_0x2697df){_0x2a6fcf[_0xfef0('0x7')]({'attributes':['id'],'raw':!![]})[_0xfef0('0x8')](function(_0x11dfd7){_0x2a6fcf['setDataValue'](_0xfef0('0x9'),_0x11dfd7['map'](function(_0x82e37a){return{'id':_0x82e37a['id']};}));return SmsMessage[_0xfef0('0xa')]({'where':{'SmsInteractionId':_0x2a6fcf['id'],'direction':'in','read':![]},'raw':!![]});})[_0xfef0('0x8')](function(_0x2d42dc){_0x2a6fcf[_0xfef0('0xb')](_0xfef0('0xc'),_0x2d42dc[_0xfef0('0xd')]);SmsInteractionEvents[_0xfef0('0xe')](_0x4e1af6+':'+_0x2a6fcf['id'],_0x2a6fcf);SmsInteractionEvents[_0xfef0('0xe')](_0x4e1af6,_0x2a6fcf);_0x2697df(null);})[_0xfef0('0xf')](_0x2697df(null));};}for(var e in events){if(events[_0xfef0('0x10')](e)){var event=events[e];SmsInteraction[_0xfef0('0x11')](e,emitEvent(event));}}module[_0xfef0('0x12')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index c3073c4..25d63dd 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 _0x6d07=['../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x6d07,0x12a));var _0x76d0=function(_0x485381,_0x4713fd){_0x485381=_0x485381-0x0;var _0x1f2550=_0x6d07[_0x485381];return _0x1f2550;};'use strict';var _=require(_0x76d0('0x0'));var util=require(_0x76d0('0x1'));var logger=require(_0x76d0('0x2'))(_0x76d0('0x3'));var moment=require(_0x76d0('0x4'));var BPromise=require(_0x76d0('0x5'));var rp=require(_0x76d0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x76d0('0x7'));var config=require(_0x76d0('0x8'));var attributes=require(_0x76d0('0x9'));module[_0x76d0('0xa')]=function(_0x1a5c30,_0x591b53){return _0x1a5c30[_0x76d0('0xb')](_0x76d0('0xc'),attributes,{'tableName':_0x76d0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xba36eb,_0x333530,_0x500070){if(_0xba36eb[_0x76d0('0xe')](_0x76d0('0xf'))){_0xba36eb['closedAt']=moment()[_0x76d0('0x10')](_0x76d0('0x11'));}_0x500070(null,_0xba36eb);}}});}; \ No newline at end of file +var _0x067b=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','bluebird','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','closed'];(function(_0x501116,_0x2250fc){var _0x470d8a=function(_0x2ce7b5){while(--_0x2ce7b5){_0x501116['push'](_0x501116['shift']());}};_0x470d8a(++_0x2250fc);}(_0x067b,0xf1));var _0xb067=function(_0x221b1f,_0x4dac52){_0x221b1f=_0x221b1f-0x0;var _0x1e6ecf=_0x067b[_0x221b1f];return _0x1e6ecf;};'use strict';var _=require(_0xb067('0x0'));var util=require(_0xb067('0x1'));var logger=require('../../config/logger')(_0xb067('0x2'));var moment=require('moment');var BPromise=require(_0xb067('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb067('0x4'));var rimraf=require(_0xb067('0x5'));var config=require(_0xb067('0x6'));var attributes=require(_0xb067('0x7'));module[_0xb067('0x8')]=function(_0x512bae,_0x348031){return _0x512bae[_0xb067('0x9')](_0xb067('0xa'),attributes,{'tableName':_0xb067('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2af275,_0x3375d9,_0x4ac12d){if(_0x2af275[_0xb067('0xc')](_0xb067('0xd'))){_0x2af275[_0xb067('0xe')]=moment()[_0xb067('0xf')](_0xb067('0x10'));}_0x4ac12d(null,_0x2af275);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index a29623f..541d132 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 _0xd64a=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','request','info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateSmsInteraction','update','body','raw','options','where','attributes','then','AddTagsToSmsInteraction','find','addTags','ids','AddTags','util'];(function(_0x36a2eb,_0x452589){var _0x4c9840=function(_0x5a00f2){while(--_0x5a00f2){_0x36a2eb['push'](_0x36a2eb['shift']());}};_0x4c9840(++_0x452589);}(_0xd64a,0x179));var _0xad64=function(_0x4af374,_0x4c7a56){_0x4af374=_0x4af374-0x0;var _0x3cf52d=_0xd64a[_0x4af374];return _0x3cf52d;};'use strict';var _=require('lodash');var util=require(_0xad64('0x0'));var moment=require('moment');var BPromise=require(_0xad64('0x1'));var rs=require(_0xad64('0x2'));var fs=require('fs');var Redis=require(_0xad64('0x3'));var db=require(_0xad64('0x4'))['db'];var utils=require(_0xad64('0x5'));var logger=require(_0xad64('0x6'))(_0xad64('0x7'));var config=require(_0xad64('0x8'));var jayson=require(_0xad64('0x9'));var client=jayson[_0xad64('0xa')][_0xad64('0xb')]({'port':0x232a});config[_0xad64('0xc')]=_[_0xad64('0xd')](config[_0xad64('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xad64('0xe'))(new Redis(config[_0xad64('0xc')]));require(_0xad64('0xf'))[_0xad64('0x10')](socket);function respondWithRpcPromise(_0x6336fd,_0x5e8e56,_0x292ae8){return new BPromise(function(_0x2f9c97,_0x3809cc){return client[_0xad64('0x11')](_0x6336fd,_0x292ae8)['then'](function(_0x57cf4d){logger[_0xad64('0x12')](_0xad64('0x13'),_0x5e8e56,'request\x20sent');logger[_0xad64('0x14')](_0xad64('0x15'),_0x5e8e56,_0xad64('0x16'),JSON[_0xad64('0x17')](_0x57cf4d));if(_0x57cf4d[_0xad64('0x18')]){if(_0x57cf4d[_0xad64('0x18')][_0xad64('0x19')]===0x1f4){logger[_0xad64('0x18')](_0xad64('0x13'),_0x5e8e56,_0x57cf4d[_0xad64('0x18')][_0xad64('0x1a')]);return _0x3809cc(_0x57cf4d[_0xad64('0x18')]['message']);}logger[_0xad64('0x18')](_0xad64('0x13'),_0x5e8e56,_0x57cf4d[_0xad64('0x18')][_0xad64('0x1a')]);return _0x2f9c97(_0x57cf4d[_0xad64('0x18')]['message']);}else{logger[_0xad64('0x12')](_0xad64('0x13'),_0x5e8e56,_0xad64('0x16'));_0x2f9c97(_0x57cf4d[_0xad64('0x1b')][_0xad64('0x1a')]);}})[_0xad64('0x1c')](function(_0x47c807){logger[_0xad64('0x18')]('SmsInteraction,\x20%s,\x20%s',_0x5e8e56,_0x47c807);_0x3809cc(_0x47c807);});});}exports[_0xad64('0x1d')]=function(_0x29ad78){var _0x4def90=this;return new Promise(function(_0x198099,_0x475a3d){return db['SmsInteraction'][_0xad64('0x1e')](_0x29ad78[_0xad64('0x1f')],{'raw':_0x29ad78['options']?_0x29ad78['options'][_0xad64('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x29ad78['options']?_0x29ad78[_0xad64('0x21')][_0xad64('0x22')]||null:null,'attributes':_0x29ad78[_0xad64('0x21')]?_0x29ad78['options'][_0xad64('0x23')]||null:null,'limit':_0x29ad78[_0xad64('0x21')]?_0x29ad78[_0xad64('0x21')]['limit']||null:null})[_0xad64('0x24')](function(_0x155e6b){logger[_0xad64('0x12')](_0xad64('0x1d'),_0x29ad78);logger['debug']('UpdateSmsInteraction',_0x29ad78,JSON[_0xad64('0x17')](_0x155e6b));_0x198099(_0x155e6b);})['catch'](function(_0xfdd083){logger[_0xad64('0x18')](_0xad64('0x1d'),_0xfdd083['message'],_0x29ad78);_0x475a3d(_0x4def90['error'](0x1f4,_0xfdd083['message']));});});};exports[_0xad64('0x25')]=function(_0x177724){return new Promise(function(_0x32a933,_0x333ef9){return db['SmsInteraction'][_0xad64('0x26')]({'where':_0x177724['options']?_0x177724[_0xad64('0x21')][_0xad64('0x22')]||null:null})[_0xad64('0x24')](function(_0x47af01){if(_0x47af01){return _0x47af01[_0xad64('0x27')](_0x177724[_0xad64('0x1f')][_0xad64('0x28')],_['omit'](_0x177724[_0xad64('0x1f')],[_0xad64('0x28'),'id'])||{});}})['spread'](function(_0x4c413c){logger[_0xad64('0x12')](_0xad64('0x29'),_0x177724);logger['debug']('AddTags',_0x177724,JSON['stringify'](_0x4c413c));_0x32a933(_0x4c413c);})['catch'](function(_0x5d617e){logger[_0xad64('0x18')]('AddTags',_0x5d617e[_0xad64('0x1a')],_0x177724);_0x333ef9(_this[_0xad64('0x18')](0x1f4,_0x5d617e[_0xad64('0x1a')]));});});}; \ No newline at end of file +var _0xd860=['http','redis','defaults','request','then','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','message','SmsInteraction,\x20%s,\x20%s','info','result','UpdateSmsInteraction','SmsInteraction','body','options','limit','stringify','catch','AddTagsToSmsInteraction','find','where','addTags','ids','omit','AddTags','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2250da,_0xdb9fe6){var _0x573dc5=function(_0x3f397a){while(--_0x3f397a){_0x2250da['push'](_0x2250da['shift']());}};_0x573dc5(++_0xdb9fe6);}(_0xd860,0x6a));var _0x0d86=function(_0x2bd12c,_0x5e06cc){_0x2bd12c=_0x2bd12c-0x0;var _0x2b8f09=_0xd860[_0x2bd12c];return _0x2b8f09;};'use strict';var _=require('lodash');var util=require(_0x0d86('0x0'));var moment=require(_0x0d86('0x1'));var BPromise=require(_0x0d86('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d86('0x3'));var db=require(_0x0d86('0x4'))['db'];var utils=require(_0x0d86('0x5'));var logger=require(_0x0d86('0x6'))(_0x0d86('0x7'));var config=require(_0x0d86('0x8'));var jayson=require(_0x0d86('0x9'));var client=jayson[_0x0d86('0xa')][_0x0d86('0xb')]({'port':0x232a});config[_0x0d86('0xc')]=_[_0x0d86('0xd')](config[_0x0d86('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0d86('0xc')]));require('./smsInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x16acf2,_0x292888,_0xcb83d9){return new BPromise(function(_0x324374,_0x3998f0){return client[_0x0d86('0xe')](_0x16acf2,_0xcb83d9)[_0x0d86('0xf')](function(_0x5ce4b8){logger['info']('SmsInteraction,\x20%s,\x20%s',_0x292888,_0x0d86('0x10'));logger[_0x0d86('0x11')](_0x0d86('0x12'),_0x292888,'request\x20sent',JSON['stringify'](_0x5ce4b8));if(_0x5ce4b8[_0x0d86('0x13')]){if(_0x5ce4b8[_0x0d86('0x13')][_0x0d86('0x14')]===0x1f4){logger[_0x0d86('0x13')]('SmsInteraction,\x20%s,\x20%s',_0x292888,_0x5ce4b8[_0x0d86('0x13')][_0x0d86('0x15')]);return _0x3998f0(_0x5ce4b8['error']['message']);}logger[_0x0d86('0x13')](_0x0d86('0x16'),_0x292888,_0x5ce4b8['error'][_0x0d86('0x15')]);return _0x324374(_0x5ce4b8[_0x0d86('0x13')][_0x0d86('0x15')]);}else{logger[_0x0d86('0x17')](_0x0d86('0x16'),_0x292888,'request\x20sent');_0x324374(_0x5ce4b8[_0x0d86('0x18')][_0x0d86('0x15')]);}})['catch'](function(_0x462e73){logger['error'](_0x0d86('0x16'),_0x292888,_0x462e73);_0x3998f0(_0x462e73);});});}exports[_0x0d86('0x19')]=function(_0x2b7189){var _0x3ce9b8=this;return new Promise(function(_0x660de2,_0x5bc624){return db[_0x0d86('0x1a')]['update'](_0x2b7189[_0x0d86('0x1b')],{'raw':_0x2b7189[_0x0d86('0x1c')]?_0x2b7189[_0x0d86('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b7189[_0x0d86('0x1c')]?_0x2b7189[_0x0d86('0x1c')]['where']||null:null,'attributes':_0x2b7189[_0x0d86('0x1c')]?_0x2b7189[_0x0d86('0x1c')]['attributes']||null:null,'limit':_0x2b7189[_0x0d86('0x1c')]?_0x2b7189[_0x0d86('0x1c')][_0x0d86('0x1d')]||null:null})[_0x0d86('0xf')](function(_0x4b1629){logger[_0x0d86('0x17')](_0x0d86('0x19'),_0x2b7189);logger[_0x0d86('0x11')]('UpdateSmsInteraction',_0x2b7189,JSON[_0x0d86('0x1e')](_0x4b1629));_0x660de2(_0x4b1629);})[_0x0d86('0x1f')](function(_0x354636){logger[_0x0d86('0x13')](_0x0d86('0x19'),_0x354636[_0x0d86('0x15')],_0x2b7189);_0x5bc624(_0x3ce9b8[_0x0d86('0x13')](0x1f4,_0x354636[_0x0d86('0x15')]));});});};exports[_0x0d86('0x20')]=function(_0x47a2e5){return new Promise(function(_0x5562bb,_0x4af492){return db[_0x0d86('0x1a')][_0x0d86('0x21')]({'where':_0x47a2e5[_0x0d86('0x1c')]?_0x47a2e5['options'][_0x0d86('0x22')]||null:null})[_0x0d86('0xf')](function(_0x1c6132){if(_0x1c6132){return _0x1c6132[_0x0d86('0x23')](_0x47a2e5[_0x0d86('0x1b')][_0x0d86('0x24')],_[_0x0d86('0x25')](_0x47a2e5[_0x0d86('0x1b')],['ids','id'])||{});}})['spread'](function(_0x28263b){logger[_0x0d86('0x17')]('AddTags',_0x47a2e5);logger[_0x0d86('0x11')](_0x0d86('0x26'),_0x47a2e5,JSON['stringify'](_0x28263b));_0x5562bb(_0x28263b);})[_0x0d86('0x1f')](function(_0xdc7e19){logger[_0x0d86('0x13')](_0x0d86('0x26'),_0xdc7e19[_0x0d86('0x15')],_0x47a2e5);_0x4af492(_this[_0x0d86('0x13')](0x1f4,_0xdc7e19[_0x0d86('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index d2b38bd..c90c077 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 _0x7b03=['length','smsInteraction:','./smsInteraction.events','save','remove','emit','removeListener'];(function(_0x2c53a3,_0x4f3c2f){var _0x3d80b2=function(_0x2eff88){while(--_0x2eff88){_0x2c53a3['push'](_0x2c53a3['shift']());}};_0x3d80b2(++_0x4f3c2f);}(_0x7b03,0x9c));var _0x37b0=function(_0x56ba92,_0xb3c986){_0x56ba92=_0x56ba92-0x0;var _0x8fe94d=_0x7b03[_0x56ba92];return _0x8fe94d;};'use strict';var SmsInteractionEvents=require(_0x37b0('0x0'));var events=[_0x37b0('0x1'),_0x37b0('0x2'),'update'];function createListener(_0x521551,_0x224d18){return function(_0x5b90a3){_0x224d18[_0x37b0('0x3')](_0x521551,_0x5b90a3);};}function removeListener(_0x249093,_0xf20f58){return function(){SmsInteractionEvents[_0x37b0('0x4')](_0x249093,_0xf20f58);};}exports['register']=function(_0x3fbe72){for(var _0x5da5e3=0x0,_0x7c9095=events[_0x37b0('0x5')];_0x5da5e3<_0x7c9095;_0x5da5e3++){var _0x363216=events[_0x5da5e3];var _0x195fad=createListener(_0x37b0('0x6')+_0x363216,_0x3fbe72);SmsInteractionEvents['on'](_0x363216,_0x195fad);}}; \ No newline at end of file +var _0x5557=['smsInteraction:','./smsInteraction.events','save','update','emit','register'];(function(_0x11fa4b,_0x2e0ec1){var _0x122a99=function(_0x305e92){while(--_0x305e92){_0x11fa4b['push'](_0x11fa4b['shift']());}};_0x122a99(++_0x2e0ec1);}(_0x5557,0x1b7));var _0x7555=function(_0x5cae66,_0x4dfbbb){_0x5cae66=_0x5cae66-0x0;var _0x5021b9=_0x5557[_0x5cae66];return _0x5021b9;};'use strict';var SmsInteractionEvents=require(_0x7555('0x0'));var events=[_0x7555('0x1'),'remove',_0x7555('0x2')];function createListener(_0x1b9111,_0x5d8aec){return function(_0x366a46){_0x5d8aec[_0x7555('0x3')](_0x1b9111,_0x366a46);};}function removeListener(_0x2360bd,_0x1aaa6c){return function(){SmsInteractionEvents['removeListener'](_0x2360bd,_0x1aaa6c);};}exports[_0x7555('0x4')]=function(_0x504536){for(var _0x2d1e04=0x0,_0x3dab4b=events['length'];_0x2d1e04<_0x3dab4b;_0x2d1e04++){var _0x2ed414=events[_0x2d1e04];var _0x30b614=createListener(_0x7555('0x5')+_0x2ed414,_0x504536);SmsInteractionEvents['on'](_0x2ed414,_0x30b614);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index ee14ec3..ac10799 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 _0x868c=['describe','/:id','show','post','tracked','sms','smsmessage:create','create','/:id/status','status','put','update','accept','/:id/reject','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./smsMessage.controller','isAuthenticated','get','/describe'];(function(_0x6b79a5,_0x2eeafb){var _0x4a0fe8=function(_0x2ce863){while(--_0x2ce863){_0x6b79a5['push'](_0x6b79a5['shift']());}};_0x4a0fe8(++_0x2eeafb);}(_0x868c,0x16e));var _0xc868=function(_0x3fb030,_0x12aebe){_0x3fb030=_0x3fb030-0x0;var _0xd6899b=_0x868c[_0x3fb030];return _0xd6899b;};'use strict';var multer=require(_0xc868('0x0'));var util=require(_0xc868('0x1'));var path=require(_0xc868('0x2'));var timeout=require(_0xc868('0x3'));var express=require(_0xc868('0x4'));var router=express[_0xc868('0x5')]();var fs_extra=require(_0xc868('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc868('0x7'));var controller=require(_0xc868('0x8'));router['get']('/',auth[_0xc868('0x9')](),controller['index']);router[_0xc868('0xa')](_0xc868('0xb'),auth[_0xc868('0x9')](),controller[_0xc868('0xc')]);router[_0xc868('0xa')](_0xc868('0xd'),auth[_0xc868('0x9')](),controller[_0xc868('0xe')]);router[_0xc868('0xf')]('/',auth[_0xc868('0x9')](),interaction[_0xc868('0x10')](_0xc868('0x11'),_0xc868('0x12')),controller[_0xc868('0x13')]);router[_0xc868('0xf')](_0xc868('0x14'),controller[_0xc868('0x15')]);router[_0xc868('0x16')](_0xc868('0xd'),auth[_0xc868('0x9')](),controller[_0xc868('0x17')]);router['put']('/:id/accept',auth[_0xc868('0x9')](),controller[_0xc868('0x18')]);router['put'](_0xc868('0x19'),auth[_0xc868('0x9')](),controller['reject']);router['delete'](_0xc868('0xd'),auth[_0xc868('0x9')](),controller[_0xc868('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x075e=['../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','/:id','show','post','tracked','smsmessage:create','/:id/status','update','/:id/accept','accept','put','/:id/reject','reject','delete','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x075e,0x1a4));var _0xe075=function(_0xe01035,_0x4e8b7f){_0xe01035=_0xe01035-0x0;var _0x3c7ab9=_0x075e[_0xe01035];return _0x3c7ab9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe075('0x0'));var timeout=require(_0xe075('0x1'));var express=require('express');var router=express[_0xe075('0x2')]();var fs_extra=require(_0xe075('0x3'));var auth=require(_0xe075('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe075('0x5'));var controller=require(_0xe075('0x6'));router[_0xe075('0x7')]('/',auth[_0xe075('0x8')](),controller[_0xe075('0x9')]);router[_0xe075('0x7')](_0xe075('0xa'),auth[_0xe075('0x8')](),controller['describe']);router['get'](_0xe075('0xb'),auth['isAuthenticated'](),controller[_0xe075('0xc')]);router[_0xe075('0xd')]('/',auth['isAuthenticated'](),interaction[_0xe075('0xe')]('sms',_0xe075('0xf')),controller['create']);router[_0xe075('0xd')](_0xe075('0x10'),controller['status']);router['put'](_0xe075('0xb'),auth[_0xe075('0x8')](),controller[_0xe075('0x11')]);router['put'](_0xe075('0x12'),auth[_0xe075('0x8')](),controller[_0xe075('0x13')]);router[_0xe075('0x14')](_0xe075('0x15'),auth[_0xe075('0x8')](),controller[_0xe075('0x16')]);router[_0xe075('0x17')](_0xe075('0xb'),auth[_0xe075('0x8')](),controller['destroy']);module[_0xe075('0x18')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 529e65b..ff1c59f 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 _0xb808=['ENUM','out','STRING','DATE','TEXT','sequelize','exports','BOOLEAN'];(function(_0x152961,_0x2d8e71){var _0x302053=function(_0x2f94c2){while(--_0x2f94c2){_0x152961['push'](_0x152961['shift']());}};_0x302053(++_0x2d8e71);}(_0xb808,0x12d));var _0x8b80=function(_0x406ad2,_0x43d82b){_0x406ad2=_0x406ad2-0x0;var _0x49fe60=_0xb808[_0x406ad2];return _0x49fe60;};'use strict';var Sequelize=require(_0x8b80('0x0'));module[_0x8b80('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x8b80('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8b80('0x3')]('in',_0x8b80('0x4')),'defaultValue':_0x8b80('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x8b80('0x5')](0xbe)},'phone':{'type':Sequelize[_0x8b80('0x5')]},'readAt':{'type':Sequelize[_0x8b80('0x6')]},'secret':{'type':Sequelize[_0x8b80('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x8b80('0x5')]},'providerResponse':{'type':Sequelize[_0x8b80('0x7')]}}; \ No newline at end of file +var _0x6b27=['out','STRING','DATE','sequelize','TEXT','medium','BOOLEAN','ENUM'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x6b27,0xc3));var _0x76b2=function(_0x53dd86,_0x23865f){_0x53dd86=_0x53dd86-0x0;var _0x42e08a=_0x6b27[_0x53dd86];return _0x42e08a;};'use strict';var Sequelize=require(_0x76b2('0x0'));module['exports']={'body':{'type':Sequelize[_0x76b2('0x1')](_0x76b2('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x76b2('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x76b2('0x4')]('in',_0x76b2('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x76b2('0x6')](0xbe)},'phone':{'type':Sequelize[_0x76b2('0x6')]},'readAt':{'type':Sequelize[_0x76b2('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x76b2('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 0c3801e..faebb85 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 _0xeb0f=['pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','body','find','describe','../../config/logger','sms-interactions','sms','read','readAt','format','UserId','user','agent','get','SmsInteraction','SmsInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','channel','motionChannel','accept','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','event','rejectmessage','SmsAccountId','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','indexOf','sent','Status','plivio','infobip','groupName','DELIVERED','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','reject','save','update','destroy','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x2b4411,_0x28b2f4){var _0x5cefe0=function(_0x12c5e6){while(--_0x12c5e6){_0x2b4411['push'](_0x2b4411['shift']());}};_0x5cefe0(++_0x28b2f4);}(_0xeb0f,0x176));var _0xfeb0=function(_0x3f6c45,_0x3b8c71){_0x3f6c45=_0x3f6c45-0x0;var _0x252282=_0xeb0f[_0x3f6c45];return _0x252282;};'use strict';var emlformat=require(_0xfeb0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfeb0('0x1'));var jsonpatch=require(_0xfeb0('0x2'));var rp=require(_0xfeb0('0x3'));var moment=require(_0xfeb0('0x4'));var BPromise=require(_0xfeb0('0x5'));var Mustache=require(_0xfeb0('0x6'));var util=require('util');var path=require(_0xfeb0('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfeb0('0x8'));var fs=require('fs');var fs_extra=require(_0xfeb0('0x9'));var _=require(_0xfeb0('0xa'));var squel=require(_0xfeb0('0xb'));var crypto=require(_0xfeb0('0xc'));var jsforce=require(_0xfeb0('0xd'));var deskjs=require(_0xfeb0('0xe'));var toCsv=require(_0xfeb0('0xf'));var querystring=require(_0xfeb0('0x10'));var Papa=require(_0xfeb0('0x11'));var Redis=require(_0xfeb0('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfeb0('0x13'));var hardwareService=require(_0xfeb0('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xfeb0('0x15'));var config=require(_0xfeb0('0x16'));var licenseUtil=require(_0xfeb0('0x17'));var db=require(_0xfeb0('0x18'))['db'];config[_0xfeb0('0x19')]=_['defaults'](config[_0xfeb0('0x19')],{'host':_0xfeb0('0x1a'),'port':0x18eb});var socket=require(_0xfeb0('0x1b'))(new Redis(config[_0xfeb0('0x19')]));require(_0xfeb0('0x1c'))[_0xfeb0('0x1d')](socket);var jayson=require(_0xfeb0('0x1e'));var client=jayson[_0xfeb0('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0xfeb0('0x1f')][_0xfeb0('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x1d7f72,_0x58662b,_0x4f0c65,_0x4ede0e){return new BPromise(function(_0x1aa982,_0x4714cb){var _0x3428ee=_0x4ede0e||client;return _0x3428ee[_0xfeb0('0x21')](_0x1d7f72,_0x4f0c65)[_0xfeb0('0x22')](function(_0x82a86e){logger[_0xfeb0('0x23')](_0xfeb0('0x24'),_0x58662b,'request\x20sent');logger[_0xfeb0('0x25')](_0xfeb0('0x26'),_0x58662b,'request\x20sent',JSON[_0xfeb0('0x27')](_0x82a86e));if(_0x82a86e[_0xfeb0('0x28')]){if(_0x82a86e[_0xfeb0('0x28')]['code']===0x1f4){logger[_0xfeb0('0x28')]('SmsMessage,\x20%s,\x20%s',_0x58662b,_0x82a86e[_0xfeb0('0x28')][_0xfeb0('0x29')]);return _0x4714cb(_0x82a86e[_0xfeb0('0x28')][_0xfeb0('0x29')]);}logger['error']('SmsMessage,\x20%s,\x20%s',_0x58662b,_0x82a86e[_0xfeb0('0x28')]['message']);return _0x1aa982(_0x82a86e[_0xfeb0('0x28')][_0xfeb0('0x29')]);}else{logger[_0xfeb0('0x23')](_0xfeb0('0x24'),_0x58662b,'request\x20sent');_0x1aa982(_0x82a86e[_0xfeb0('0x2a')][_0xfeb0('0x29')]);}})['catch'](function(_0x73119e){logger[_0xfeb0('0x28')](_0xfeb0('0x24'),_0x58662b,_0x73119e);_0x4714cb(_0x73119e);});});}function respondWithStatusCode(_0x388c62,_0x2114dc){_0x2114dc=_0x2114dc||0xcc;return function(_0x34ba8f){if(_0x34ba8f){return _0x388c62[_0xfeb0('0x2b')](_0x2114dc);}return _0x388c62[_0xfeb0('0x2c')](_0x2114dc)[_0xfeb0('0x2d')]();};}function respondWithResult(_0x547d4c,_0x44811a){_0x44811a=_0x44811a||0xc8;return function(_0x2f4d02){if(_0x2f4d02){return _0x547d4c['status'](_0x44811a)[_0xfeb0('0x2e')](_0x2f4d02);}};}function respondWithFilteredResult(_0x2f875c,_0x2a2b52){return function(_0x14eed2){if(_0x14eed2){var _0x58cf1=typeof _0x2a2b52['offset']===_0xfeb0('0x2f')&&typeof _0x2a2b52['limit']==='undefined';var _0x4cd828=_0x14eed2[_0xfeb0('0x30')];var _0x40cd34=_0x58cf1?0x0:_0x2a2b52[_0xfeb0('0x31')];var _0x4c4fe6=_0x58cf1?_0x14eed2[_0xfeb0('0x30')]:_0x2a2b52[_0xfeb0('0x31')]+_0x2a2b52[_0xfeb0('0x32')];var _0x266edb;if(_0x4c4fe6>=_0x4cd828){_0x4c4fe6=_0x4cd828;_0x266edb=0xc8;}else{_0x266edb=0xce;}_0x2f875c[_0xfeb0('0x2c')](_0x266edb);return _0x2f875c[_0xfeb0('0x33')]('Content-Range',_0x40cd34+'-'+_0x4c4fe6+'/'+_0x4cd828)['json'](_0x14eed2);}return null;};}function patchUpdates(_0x14bc1b){return function(_0x5d188e){try{jsonpatch[_0xfeb0('0x34')](_0x5d188e,_0x14bc1b,!![]);}catch(_0x1dde16){return BPromise[_0xfeb0('0x35')](_0x1dde16);}return _0x5d188e[_0xfeb0('0x36')]();};}function saveUpdates(_0x45d664,_0x45ba50){return function(_0x11cfe6){if(_0x11cfe6){return _0x11cfe6[_0xfeb0('0x37')](_0x45d664)[_0xfeb0('0x22')](function(_0x37a1d9){return _0x37a1d9;});}return null;};}function removeEntity(_0x41295c,_0x2cb4fb){return function(_0x28d4a6){if(_0x28d4a6){return _0x28d4a6[_0xfeb0('0x38')]()[_0xfeb0('0x22')](function(){_0x41295c[_0xfeb0('0x2c')](0xcc)[_0xfeb0('0x2d')]();});}};}function handleEntityNotFound(_0x4e047d,_0x20b206){return function(_0x33fe82){if(!_0x33fe82){_0x4e047d['sendStatus'](0x194);}return _0x33fe82;};}function handleError(_0xc694d9,_0x11215f){_0x11215f=_0x11215f||0x1f4;return function(_0x369a15){logger[_0xfeb0('0x28')](_0x369a15[_0xfeb0('0x39')]);if(_0x369a15['name']){delete _0x369a15[_0xfeb0('0x3a')];}_0xc694d9['status'](_0x11215f)[_0xfeb0('0x3b')](_0x369a15);};}exports[_0xfeb0('0x3c')]=function(_0x5acd6f,_0x3851fb){var _0x58a729={},_0x2888f2={},_0x2dc8fe={'count':0x0,'rows':[]};var _0x3a545b=_[_0xfeb0('0x3d')](db[_0xfeb0('0x3e')][_0xfeb0('0x3f')],function(_0x27a6ae){return{'name':_0x27a6ae[_0xfeb0('0x40')],'type':_0x27a6ae[_0xfeb0('0x41')]['key']};});_0x2888f2[_0xfeb0('0x42')]=_[_0xfeb0('0x3d')](_0x3a545b,_0xfeb0('0x3a'));_0x2888f2[_0xfeb0('0x43')]=_[_0xfeb0('0x44')](_0x5acd6f['query']);_0x2888f2[_0xfeb0('0x45')]=_[_0xfeb0('0x46')](_0x2888f2[_0xfeb0('0x42')],_0x2888f2[_0xfeb0('0x43')]);_0x58a729['attributes']=_[_0xfeb0('0x46')](_0x2888f2[_0xfeb0('0x42')],qs[_0xfeb0('0x47')](_0x5acd6f[_0xfeb0('0x43')][_0xfeb0('0x47')]));_0x58a729[_0xfeb0('0x48')]=_0x58a729['attributes'][_0xfeb0('0x49')]?_0x58a729['attributes']:_0x2888f2[_0xfeb0('0x42')];if(!_0x5acd6f['query'][_0xfeb0('0x4a')](_0xfeb0('0x4b'))){_0x58a729[_0xfeb0('0x32')]=qs[_0xfeb0('0x32')](_0x5acd6f[_0xfeb0('0x43')][_0xfeb0('0x32')]);_0x58a729[_0xfeb0('0x31')]=qs[_0xfeb0('0x31')](_0x5acd6f[_0xfeb0('0x43')]['offset']);}_0x58a729[_0xfeb0('0x4c')]=qs['sort'](_0x5acd6f[_0xfeb0('0x43')][_0xfeb0('0x4d')]);_0x58a729[_0xfeb0('0x4e')]=qs[_0xfeb0('0x45')](_[_0xfeb0('0x4f')](_0x5acd6f['query'],_0x2888f2['filters']),_0x3a545b);if(_0x5acd6f[_0xfeb0('0x43')][_0xfeb0('0x50')]){_0x58a729[_0xfeb0('0x4e')]=_[_0xfeb0('0x51')](_0x58a729[_0xfeb0('0x4e')],{'$or':_[_0xfeb0('0x3d')](_0x3a545b,function(_0x12d24f){if(_0x12d24f[_0xfeb0('0x41')]!==_0xfeb0('0x52')){var _0x130916={};_0x130916[_0x12d24f['name']]={'$like':'%'+_0x5acd6f[_0xfeb0('0x43')][_0xfeb0('0x50')]+'%'};return _0x130916;}})});}_0x58a729=_['merge']({},_0x58a729,_0x5acd6f[_0xfeb0('0x53')]);var _0x3ee041={'where':_0x58a729[_0xfeb0('0x4e')]};return db['SmsMessage'][_0xfeb0('0x30')](_0x3ee041)[_0xfeb0('0x22')](function(_0x5dfbdb){_0x2dc8fe[_0xfeb0('0x30')]=_0x5dfbdb;if(_0x5acd6f[_0xfeb0('0x43')][_0xfeb0('0x54')]){_0x58a729['include']=[{'all':!![]}];}return db['SmsMessage'][_0xfeb0('0x55')](_0x58a729);})['then'](function(_0x2ab71c){_0x2dc8fe[_0xfeb0('0x56')]=_0x2ab71c;return _0x2dc8fe;})[_0xfeb0('0x22')](respondWithFilteredResult(_0x3851fb,_0x58a729))[_0xfeb0('0x57')](handleError(_0x3851fb,null));};exports[_0xfeb0('0x58')]=function(_0x2bd414,_0x41de77){var _0x5ef8f9={'raw':!![],'where':{'id':_0x2bd414[_0xfeb0('0x59')]['id']}},_0x52ebfd={};_0x52ebfd['model']=_[_0xfeb0('0x44')](db['SmsMessage']['rawAttributes']);_0x52ebfd[_0xfeb0('0x43')]=_[_0xfeb0('0x44')](_0x2bd414[_0xfeb0('0x43')]);_0x52ebfd[_0xfeb0('0x45')]=_[_0xfeb0('0x46')](_0x52ebfd[_0xfeb0('0x42')],_0x52ebfd[_0xfeb0('0x43')]);_0x5ef8f9[_0xfeb0('0x48')]=_[_0xfeb0('0x46')](_0x52ebfd[_0xfeb0('0x42')],qs[_0xfeb0('0x47')](_0x2bd414[_0xfeb0('0x43')][_0xfeb0('0x47')]));_0x5ef8f9[_0xfeb0('0x48')]=_0x5ef8f9[_0xfeb0('0x48')]['length']?_0x5ef8f9['attributes']:_0x52ebfd[_0xfeb0('0x42')];if(_0x2bd414['query'][_0xfeb0('0x54')]){_0x5ef8f9[_0xfeb0('0x5a')]=[{'all':!![]}];}_0x5ef8f9=_[_0xfeb0('0x51')]({},_0x5ef8f9,_0x2bd414[_0xfeb0('0x53')]);return db['SmsMessage']['find'](_0x5ef8f9)['then'](handleEntityNotFound(_0x41de77,null))[_0xfeb0('0x22')](respondWithResult(_0x41de77,null))[_0xfeb0('0x57')](handleError(_0x41de77,null));};exports['create']=function(_0x11e95f,_0x1dc290){return db[_0xfeb0('0x3e')]['create'](_0x11e95f['body'],{})[_0xfeb0('0x22')](respondWithResult(_0x1dc290,0xc9))[_0xfeb0('0x57')](handleError(_0x1dc290,null));};exports[_0xfeb0('0x37')]=function(_0x2fa55b,_0x33c64f){if(_0x2fa55b[_0xfeb0('0x5b')]['id']){delete _0x2fa55b[_0xfeb0('0x5b')]['id'];}return db[_0xfeb0('0x3e')]['find']({'where':{'id':_0x2fa55b[_0xfeb0('0x59')]['id']}})[_0xfeb0('0x22')](handleEntityNotFound(_0x33c64f,null))[_0xfeb0('0x22')](saveUpdates(_0x2fa55b['body'],null))[_0xfeb0('0x22')](respondWithResult(_0x33c64f,null))[_0xfeb0('0x57')](handleError(_0x33c64f,null));};exports['destroy']=function(_0xafb423,_0xf2025b){return db[_0xfeb0('0x3e')][_0xfeb0('0x5c')]({'where':{'id':_0xafb423[_0xfeb0('0x59')]['id']}})['then'](handleEntityNotFound(_0xf2025b,null))[_0xfeb0('0x22')](removeEntity(_0xf2025b,null))[_0xfeb0('0x57')](handleError(_0xf2025b,null));};exports[_0xfeb0('0x5d')]=function(_0x4d02e4,_0x4dd525){return db[_0xfeb0('0x3e')][_0xfeb0('0x5d')]()['then'](respondWithResult(_0x4dd525,null))[_0xfeb0('0x57')](handleError(_0x4dd525,null));};var interaction_log=require(_0xfeb0('0x5e'))(_0xfeb0('0x5f'));exports['accept']=function(_0x351d55,_0xca4e9c,_0x2b6c7b){var _0x3321e7={'agent':{},'channel':_0xfeb0('0x60')};if(_0x351d55[_0xfeb0('0x5b')]['id']){delete _0x351d55[_0xfeb0('0x5b')]['id'];}_0x351d55['body'][_0xfeb0('0x61')]=!![];_0x351d55[_0xfeb0('0x5b')][_0xfeb0('0x62')]=moment()[_0xfeb0('0x63')]('YYYY-MM-DD\x20HH:mm:ss');_0x351d55['body'][_0xfeb0('0x64')]=_0x351d55[_0xfeb0('0x5b')][_0xfeb0('0x64')]||_0x351d55[_0xfeb0('0x65')]['id'];_0x3321e7[_0xfeb0('0x66')]['id']=_0x351d55[_0xfeb0('0x5b')][_0xfeb0('0x64')];return db[_0xfeb0('0x3e')][_0xfeb0('0x5c')]({'where':{'id':_0x351d55[_0xfeb0('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xca4e9c,null))[_0xfeb0('0x22')](saveUpdates(_0x351d55['body'],null))['then'](function(_0x21a359){if(_0x21a359){_0x3321e7['message']=_0x21a359[_0xfeb0('0x67')]({'plain':!![]});return db[_0xfeb0('0x68')][_0xfeb0('0x5c')]({'where':{'id':_0x21a359[_0xfeb0('0x69')]}});}return null;})[_0xfeb0('0x22')](handleEntityNotFound(_0xca4e9c,null))['then'](function(_0x2ef790){if(_0x2ef790){return _0x2ef790['update']({'UserId':_0x351d55[_0xfeb0('0x5b')]['UserId'],'read1stAt':_['isNil'](_0x2ef790[_0xfeb0('0x6a')])?moment()[_0xfeb0('0x63')](_0xfeb0('0x6b')):undefined});}return null;})[_0xfeb0('0x22')](function(_0x5f51a1){if(_0x5f51a1){_0x3321e7[_0xfeb0('0x6c')]=_0x5f51a1[_0xfeb0('0x67')]({'plain':!![]});interaction_log['info'](_0xfeb0('0x6d'),_0x351d55[_0xfeb0('0x65')]['id'],_0x351d55[_0xfeb0('0x65')][_0xfeb0('0x3a')],_0x351d55[_0xfeb0('0x65')][_0xfeb0('0x6e')],_0x3321e7[_0xfeb0('0x6c')]['id'],_0x351d55['body']?JSON[_0xfeb0('0x27')](_0x351d55[_0xfeb0('0x5b')]):_0xfeb0('0x6f'));return respondWithRpcPromise(_0xfeb0('0x70'),_0xfeb0('0x71'),_0x3321e7);}return null;})['then'](function(_0x43cf8e){var _0x2dd7d3=_0xfeb0('0x72')+_0x43cf8e[_0xfeb0('0x29')][_0xfeb0('0x73')];return db[_0xfeb0('0x74')][_0xfeb0('0x43')](_0x2dd7d3,{'type':db[_0xfeb0('0x75')][_0xfeb0('0x76')][_0xfeb0('0x77')],'raw':!![]})[_0xfeb0('0x22')](function(_0x167532){return _0x167532;});})[_0xfeb0('0x22')](function(_0x438a3a){if(_0x438a3a){_0x3321e7[_0xfeb0('0x29')][_0xfeb0('0x78')]=_0x438a3a[0x0];if(!_0x351d55['body'][_0xfeb0('0x64')])return;return db[_0xfeb0('0x79')][_0xfeb0('0x5c')]({'where':{'id':_0x351d55[_0xfeb0('0x5b')][_0xfeb0('0x64')],'role':_0xfeb0('0x66')},'attributes':['id',_0xfeb0('0x3a'),_0xfeb0('0x7a'),_0xfeb0('0x7b'),_0xfeb0('0x7c')],'raw':!![]});}return null;})[_0xfeb0('0x22')](function(_0x503f8e){if(!_0x503f8e)return null;_0x3321e7[_0xfeb0('0x29')]['agent']=_0x503f8e;return _0x3321e7;})['then'](function(_0x502db6){if(_0x502db6){if(_0x351d55[_0xfeb0('0x5b')]['manual']){_0x3321e7['message'][_0xfeb0('0x7d')]=util[_0xfeb0('0x63')]('SIP/%s',_0x351d55[_0xfeb0('0x65')]['name']);_0x3321e7[_0xfeb0('0x29')][_0xfeb0('0x7e')]=_0x3321e7[_0xfeb0('0x7e')];_0x3321e7['message'][_0xfeb0('0x7f')]=_0x3321e7[_0xfeb0('0x7e')];_0x3321e7[_0xfeb0('0x29')]['event']=_0xfeb0('0x80');return respondWithRpcPromise(_0xfeb0('0x81'),_0xfeb0('0x81'),{'event':_0xfeb0('0x82'),'message':_0x3321e7[_0xfeb0('0x29')]},client9002)['then'](function(){return _0x3321e7;});}return _0x3321e7;}return null;})['then'](respondWithResult(_0xca4e9c,null))['catch'](handleError(_0xca4e9c,null));};var interaction_log=require(_0xfeb0('0x5e'))('sms-interactions');exports[_0xfeb0('0x35')]=function(_0x2a58aa,_0x435dc8,_0x51d242){var _0x4b6a93={'agent':{},'channel':_0xfeb0('0x60')};if(_0x2a58aa[_0xfeb0('0x5b')]['id']){delete _0x2a58aa[_0xfeb0('0x5b')]['id'];}_0x2a58aa[_0xfeb0('0x5b')]['UserId']=_0x2a58aa[_0xfeb0('0x5b')]['UserId']||_0x2a58aa[_0xfeb0('0x65')]['id'];_0x4b6a93[_0xfeb0('0x66')]['id']=_0x2a58aa[_0xfeb0('0x5b')]['UserId'];return db[_0xfeb0('0x3e')]['find']({'where':{'id':_0x2a58aa[_0xfeb0('0x59')]['id'],'UserId':null}})[_0xfeb0('0x22')](handleEntityNotFound(_0x435dc8,null))[_0xfeb0('0x22')](function(_0x41d150){if(_0x41d150){_0x4b6a93[_0xfeb0('0x29')]=_0x41d150[_0xfeb0('0x67')]({'plain':!![]});return db[_0xfeb0('0x68')][_0xfeb0('0x5c')]({'where':{'id':_0x41d150[_0xfeb0('0x69')]}});}return null;})[_0xfeb0('0x22')](handleEntityNotFound(_0x435dc8,null))[_0xfeb0('0x22')](function(_0x40e2f8){if(_0x40e2f8){_0x4b6a93[_0xfeb0('0x6c')]=_0x40e2f8[_0xfeb0('0x67')]({'plain':!![]});interaction_log[_0xfeb0('0x23')](_0xfeb0('0x83'),_0x2a58aa['user']['id'],_0x2a58aa[_0xfeb0('0x65')][_0xfeb0('0x3a')],_0x2a58aa['user'][_0xfeb0('0x6e')],_0x4b6a93[_0xfeb0('0x6c')]['id'],_0x2a58aa['body']?JSON[_0xfeb0('0x27')](_0x2a58aa[_0xfeb0('0x5b')]):_0xfeb0('0x6f'));return respondWithRpcPromise(_0xfeb0('0x84'),_0xfeb0('0x85'),_0x4b6a93);}return null;})[_0xfeb0('0x22')](function(_0x56a2e6){var _0x2ed16c=_0xfeb0('0x72')+_0x56a2e6[_0xfeb0('0x29')][_0xfeb0('0x73')];return db[_0xfeb0('0x74')]['query'](_0x2ed16c,{'type':db[_0xfeb0('0x75')][_0xfeb0('0x76')][_0xfeb0('0x77')],'raw':!![]})[_0xfeb0('0x22')](function(_0x3e275a){return _0x3e275a;});})[_0xfeb0('0x22')](function(_0x727c2d){if(_0x727c2d){_0x4b6a93[_0xfeb0('0x29')][_0xfeb0('0x78')]=_0x727c2d[0x0];if(!_0x2a58aa[_0xfeb0('0x5b')][_0xfeb0('0x64')])return;return db['User'][_0xfeb0('0x5c')]({'where':{'id':_0x2a58aa['body'][_0xfeb0('0x64')],'role':'agent'},'attributes':['id',_0xfeb0('0x3a'),_0xfeb0('0x7a'),_0xfeb0('0x7b'),_0xfeb0('0x7c')],'raw':!![]});}return null;})['then'](function(_0x34fb6d){if(!_0x34fb6d)return null;_0x4b6a93['message'][_0xfeb0('0x66')]=_0x34fb6d;return _0x4b6a93;})[_0xfeb0('0x22')](function(_0x191146){if(_0x191146){_0x191146[_0xfeb0('0x29')][_0xfeb0('0x7d')]=util[_0xfeb0('0x63')]('SIP/%s',_0x2a58aa[_0xfeb0('0x65')][_0xfeb0('0x3a')]);_0x191146['message'][_0xfeb0('0x7e')]=_0x4b6a93[_0xfeb0('0x7e')];_0x191146[_0xfeb0('0x29')]['motionChannel']=_0x4b6a93[_0xfeb0('0x7e')];_0x191146[_0xfeb0('0x29')][_0xfeb0('0x86')]='reject';respondWithRpcPromise('EventManager',_0xfeb0('0x81'),{'event':_0xfeb0('0x87'),'message':_0x191146[_0xfeb0('0x29')]},client9002);return _0x4b6a93;}return null;})['then'](respondWithResult(_0x435dc8,null))[_0xfeb0('0x57')](handleError(_0x435dc8,null));};exports[_0xfeb0('0x2c')]=function(_0x58cdde,_0xd59620,_0x57acc7){if(_0x58cdde['body']['id']){delete _0x58cdde[_0xfeb0('0x5b')]['id'];}var _0x56a191;return db['SmsMessage']['find']({'where':{'id':_0x58cdde[_0xfeb0('0x59')]['id']}})[_0xfeb0('0x22')](handleEntityNotFound(_0xd59620,null))['then'](function(_0x5d4a02){if(_0x5d4a02){_0x56a191=_0x5d4a02;return db['SmsAccount']['find']({'where':{'id':_0x5d4a02[_0xfeb0('0x88')]}});}})[_0xfeb0('0x22')](handleEntityNotFound(_0xd59620,null))[_0xfeb0('0x22')](function(_0x3902d7){if(_0x3902d7){logger[_0xfeb0('0x25')](_0xfeb0('0x26'),_0xfeb0('0x2c'),'received\x20delivery\x20report\x20from',_0x3902d7[_0xfeb0('0x41')],util['inspect'](_0x58cdde[_0xfeb0('0x5b')],{'showHidden':![],'depth':null}));switch(_0x3902d7[_0xfeb0('0x41')]){case _0xfeb0('0x89'):if(_0x58cdde['body'][_0xfeb0('0x8a')]&&_0x58cdde['body'][_0xfeb0('0x8a')]===_0x56a191[_0xfeb0('0x8b')]){return _0x56a191[_0xfeb0('0x37')]({'read':!![]});}else{logger[_0xfeb0('0x28')](_0xfeb0('0x8c'),_0xfeb0('0x2c'),'twilio',util[_0xfeb0('0x8d')](_0x58cdde[_0xfeb0('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xfeb0('0x8e'):if(_0x58cdde[_0xfeb0('0x5b')]['MessageUUID']&&_0x58cdde['body'][_0xfeb0('0x8f')]===_0x56a191['messageId']&&_[_0xfeb0('0x90')]([_0xfeb0('0x91'),'delivered'],_0x58cdde['body'][_0xfeb0('0x92')])>=0x0){return _0x56a191[_0xfeb0('0x37')]({'read':!![]});}else{logger[_0xfeb0('0x28')](_0xfeb0('0x8c'),_0xfeb0('0x2c'),_0xfeb0('0x93'),util['inspect'](_0x58cdde['body'],{'showHidden':![],'depth':null}));}break;case _0xfeb0('0x94'):var _0x36e26e=_0x58cdde[_0xfeb0('0x5b')]['results'][0x0];if(_0x36e26e['status'][_0xfeb0('0x95')]===_0xfeb0('0x96')){return _0x56a191[_0xfeb0('0x37')]({'read':!![]});}else{logger[_0xfeb0('0x28')](_0xfeb0('0x8c'),_0xfeb0('0x2c'),_0xfeb0('0x94'),util[_0xfeb0('0x8d')](_0x58cdde[_0xfeb0('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x56a191;}})['then'](respondWithResult(_0xd59620,null))['catch'](handleError(_0xd59620,null));}; \ No newline at end of file +var _0xa533=['motionChannel','rejectmessage','SmsAccountId','type','inspect','MessageSid','twilio','plivo','MessageUUID','messageId','indexOf','delivered','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','results','groupName','DELIVERED','infobip','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./smsMessage.socket','jayson/promise','client','http','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','end','status','json','undefined','offset','count','limit','apply','update','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','show','params','create','body','find','destroy','describe','sms-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','interface','SIP/%s','channel','EventManager','reject','SmsInteractionId','rejectMessage'];(function(_0xf48bee,_0x115451){var _0x10f6ac=function(_0x25e54b){while(--_0x25e54b){_0xf48bee['push'](_0xf48bee['shift']());}};_0x10f6ac(++_0x115451);}(_0xa533,0x1c6));var _0x3a53=function(_0x55e9cb,_0x19cde6){_0x55e9cb=_0x55e9cb-0x0;var _0x2e7862=_0xa533[_0x55e9cb];return _0x2e7862;};'use strict';var emlformat=require(_0x3a53('0x0'));var rimraf=require(_0x3a53('0x1'));var zipdir=require(_0x3a53('0x2'));var jsonpatch=require(_0x3a53('0x3'));var rp=require(_0x3a53('0x4'));var moment=require(_0x3a53('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3a53('0x6'));var util=require(_0x3a53('0x7'));var path=require(_0x3a53('0x8'));var sox=require(_0x3a53('0x9'));var csv=require(_0x3a53('0xa'));var ejs=require(_0x3a53('0xb'));var fs=require('fs');var fs_extra=require(_0x3a53('0xc'));var _=require(_0x3a53('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3a53('0xe'));var deskjs=require(_0x3a53('0xf'));var toCsv=require(_0x3a53('0xa'));var querystring=require(_0x3a53('0x10'));var Papa=require(_0x3a53('0x11'));var Redis=require(_0x3a53('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x3a53('0x13'));var as=require(_0x3a53('0x14'));var hardwareService=require(_0x3a53('0x15'));var logger=require(_0x3a53('0x16'))(_0x3a53('0x17'));var utils=require(_0x3a53('0x18'));var config=require(_0x3a53('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x3a53('0x1a'))['db'];config[_0x3a53('0x1b')]=_[_0x3a53('0x1c')](config[_0x3a53('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x3a53('0x1d'))(new Redis(config['redis']));require(_0x3a53('0x1e'))['register'](socket);var jayson=require(_0x3a53('0x1f'));var client=jayson[_0x3a53('0x20')][_0x3a53('0x21')]({'port':0x232c});var client9002=jayson['client'][_0x3a53('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x13a8de,_0x438353,_0x59dabb,_0x5a059d){return new BPromise(function(_0x316873,_0x25393a){var _0x4e3edb=_0x5a059d||client;return _0x4e3edb['request'](_0x13a8de,_0x59dabb)[_0x3a53('0x22')](function(_0x1e1b03){logger[_0x3a53('0x23')](_0x3a53('0x24'),_0x438353,_0x3a53('0x25'));logger[_0x3a53('0x26')](_0x3a53('0x27'),_0x438353,_0x3a53('0x25'),JSON[_0x3a53('0x28')](_0x1e1b03));if(_0x1e1b03['error']){if(_0x1e1b03['error'][_0x3a53('0x29')]===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x438353,_0x1e1b03[_0x3a53('0x2a')][_0x3a53('0x2b')]);return _0x25393a(_0x1e1b03['error'][_0x3a53('0x2b')]);}logger[_0x3a53('0x2a')](_0x3a53('0x24'),_0x438353,_0x1e1b03['error']['message']);return _0x316873(_0x1e1b03[_0x3a53('0x2a')][_0x3a53('0x2b')]);}else{logger['info'](_0x3a53('0x24'),_0x438353,_0x3a53('0x25'));_0x316873(_0x1e1b03[_0x3a53('0x2c')][_0x3a53('0x2b')]);}})[_0x3a53('0x2d')](function(_0xb63d33){logger[_0x3a53('0x2a')](_0x3a53('0x24'),_0x438353,_0xb63d33);_0x25393a(_0xb63d33);});});}function respondWithStatusCode(_0x32963f,_0x415a16){_0x415a16=_0x415a16||0xcc;return function(_0x2666ac){if(_0x2666ac){return _0x32963f[_0x3a53('0x2e')](_0x415a16);}return _0x32963f['status'](_0x415a16)[_0x3a53('0x2f')]();};}function respondWithResult(_0x42f23a,_0x210a81){_0x210a81=_0x210a81||0xc8;return function(_0x460a2e){if(_0x460a2e){return _0x42f23a[_0x3a53('0x30')](_0x210a81)[_0x3a53('0x31')](_0x460a2e);}};}function respondWithFilteredResult(_0x2e3506,_0x5f3022){return function(_0x7402de){if(_0x7402de){var _0x905690=typeof _0x5f3022['offset']===_0x3a53('0x32')&&typeof _0x5f3022['limit']==='undefined';var _0x4204e3=_0x7402de['count'];var _0x3d4e2b=_0x905690?0x0:_0x5f3022[_0x3a53('0x33')];var _0x314e84=_0x905690?_0x7402de[_0x3a53('0x34')]:_0x5f3022[_0x3a53('0x33')]+_0x5f3022[_0x3a53('0x35')];var _0x459e10;if(_0x314e84>=_0x4204e3){_0x314e84=_0x4204e3;_0x459e10=0xc8;}else{_0x459e10=0xce;}_0x2e3506[_0x3a53('0x30')](_0x459e10);return _0x2e3506['set']('Content-Range',_0x3d4e2b+'-'+_0x314e84+'/'+_0x4204e3)[_0x3a53('0x31')](_0x7402de);}return null;};}function patchUpdates(_0x2ea4a7){return function(_0x2dd75b){try{jsonpatch[_0x3a53('0x36')](_0x2dd75b,_0x2ea4a7,!![]);}catch(_0x143c9e){return BPromise['reject'](_0x143c9e);}return _0x2dd75b['save']();};}function saveUpdates(_0x1fd27a,_0x3b8388){return function(_0x30723c){if(_0x30723c){return _0x30723c[_0x3a53('0x37')](_0x1fd27a)[_0x3a53('0x22')](function(_0x379155){return _0x379155;});}return null;};}function removeEntity(_0x4126d9,_0x487e91){return function(_0xcb63f9){if(_0xcb63f9){return _0xcb63f9['destroy']()[_0x3a53('0x22')](function(){_0x4126d9[_0x3a53('0x30')](0xcc)[_0x3a53('0x2f')]();});}};}function handleEntityNotFound(_0x1b3495,_0x175fb1){return function(_0x1255ac){if(!_0x1255ac){_0x1b3495[_0x3a53('0x2e')](0x194);}return _0x1255ac;};}function handleError(_0x53b92d,_0xf9328c){_0xf9328c=_0xf9328c||0x1f4;return function(_0x3c10e0){logger[_0x3a53('0x2a')](_0x3c10e0[_0x3a53('0x38')]);if(_0x3c10e0[_0x3a53('0x39')]){delete _0x3c10e0['name'];}_0x53b92d[_0x3a53('0x30')](_0xf9328c)[_0x3a53('0x3a')](_0x3c10e0);};}exports[_0x3a53('0x3b')]=function(_0x4839f8,_0x3c853b){var _0x589557={},_0x25ee74={},_0x5105fd={'count':0x0,'rows':[]};var _0x1b7cd4=_[_0x3a53('0x3c')](db[_0x3a53('0x3d')][_0x3a53('0x3e')],function(_0x142dee){return{'name':_0x142dee[_0x3a53('0x3f')],'type':_0x142dee['type'][_0x3a53('0x40')]};});_0x25ee74[_0x3a53('0x41')]=_[_0x3a53('0x3c')](_0x1b7cd4,_0x3a53('0x39'));_0x25ee74[_0x3a53('0x42')]=_[_0x3a53('0x43')](_0x4839f8[_0x3a53('0x42')]);_0x25ee74[_0x3a53('0x44')]=_[_0x3a53('0x45')](_0x25ee74['model'],_0x25ee74[_0x3a53('0x42')]);_0x589557[_0x3a53('0x46')]=_[_0x3a53('0x45')](_0x25ee74[_0x3a53('0x41')],qs[_0x3a53('0x47')](_0x4839f8['query'][_0x3a53('0x47')]));_0x589557[_0x3a53('0x46')]=_0x589557[_0x3a53('0x46')][_0x3a53('0x48')]?_0x589557[_0x3a53('0x46')]:_0x25ee74[_0x3a53('0x41')];if(!_0x4839f8[_0x3a53('0x42')][_0x3a53('0x49')]('nolimit')){_0x589557[_0x3a53('0x35')]=qs[_0x3a53('0x35')](_0x4839f8[_0x3a53('0x42')][_0x3a53('0x35')]);_0x589557[_0x3a53('0x33')]=qs['offset'](_0x4839f8[_0x3a53('0x42')][_0x3a53('0x33')]);}_0x589557[_0x3a53('0x4a')]=qs['sort'](_0x4839f8['query']['sort']);_0x589557['where']=qs[_0x3a53('0x44')](_['pick'](_0x4839f8[_0x3a53('0x42')],_0x25ee74[_0x3a53('0x44')]),_0x1b7cd4);if(_0x4839f8['query'][_0x3a53('0x4b')]){_0x589557[_0x3a53('0x4c')]=_[_0x3a53('0x4d')](_0x589557[_0x3a53('0x4c')],{'$or':_[_0x3a53('0x3c')](_0x1b7cd4,function(_0x17070d){if(_0x17070d['type']!==_0x3a53('0x4e')){var _0x55394d={};_0x55394d[_0x17070d[_0x3a53('0x39')]]={'$like':'%'+_0x4839f8['query'][_0x3a53('0x4b')]+'%'};return _0x55394d;}})});}_0x589557=_[_0x3a53('0x4d')]({},_0x589557,_0x4839f8[_0x3a53('0x4f')]);var _0x47b392={'where':_0x589557[_0x3a53('0x4c')]};return db[_0x3a53('0x3d')][_0x3a53('0x34')](_0x47b392)[_0x3a53('0x22')](function(_0x1e32e0){_0x5105fd[_0x3a53('0x34')]=_0x1e32e0;if(_0x4839f8['query'][_0x3a53('0x50')]){_0x589557[_0x3a53('0x51')]=[{'all':!![]}];}return db[_0x3a53('0x3d')][_0x3a53('0x52')](_0x589557);})['then'](function(_0x536aa2){_0x5105fd['rows']=_0x536aa2;return _0x5105fd;})[_0x3a53('0x22')](respondWithFilteredResult(_0x3c853b,_0x589557))[_0x3a53('0x2d')](handleError(_0x3c853b,null));};exports[_0x3a53('0x53')]=function(_0x230289,_0x4dac1a){var _0x44d671={'raw':!![],'where':{'id':_0x230289[_0x3a53('0x54')]['id']}},_0x1b58f7={};_0x1b58f7['model']=_[_0x3a53('0x43')](db['SmsMessage'][_0x3a53('0x3e')]);_0x1b58f7[_0x3a53('0x42')]=_[_0x3a53('0x43')](_0x230289[_0x3a53('0x42')]);_0x1b58f7[_0x3a53('0x44')]=_[_0x3a53('0x45')](_0x1b58f7[_0x3a53('0x41')],_0x1b58f7[_0x3a53('0x42')]);_0x44d671[_0x3a53('0x46')]=_[_0x3a53('0x45')](_0x1b58f7['model'],qs[_0x3a53('0x47')](_0x230289[_0x3a53('0x42')]['fields']));_0x44d671[_0x3a53('0x46')]=_0x44d671[_0x3a53('0x46')][_0x3a53('0x48')]?_0x44d671['attributes']:_0x1b58f7[_0x3a53('0x41')];if(_0x230289[_0x3a53('0x42')][_0x3a53('0x50')]){_0x44d671[_0x3a53('0x51')]=[{'all':!![]}];}_0x44d671=_['merge']({},_0x44d671,_0x230289[_0x3a53('0x4f')]);return db[_0x3a53('0x3d')]['find'](_0x44d671)[_0x3a53('0x22')](handleEntityNotFound(_0x4dac1a,null))[_0x3a53('0x22')](respondWithResult(_0x4dac1a,null))[_0x3a53('0x2d')](handleError(_0x4dac1a,null));};exports[_0x3a53('0x55')]=function(_0x2fc363,_0x5dde37){return db['SmsMessage'][_0x3a53('0x55')](_0x2fc363['body'],{})[_0x3a53('0x22')](respondWithResult(_0x5dde37,0xc9))[_0x3a53('0x2d')](handleError(_0x5dde37,null));};exports[_0x3a53('0x37')]=function(_0x484db5,_0x4c89bd){if(_0x484db5[_0x3a53('0x56')]['id']){delete _0x484db5[_0x3a53('0x56')]['id'];}return db[_0x3a53('0x3d')][_0x3a53('0x57')]({'where':{'id':_0x484db5[_0x3a53('0x54')]['id']}})[_0x3a53('0x22')](handleEntityNotFound(_0x4c89bd,null))[_0x3a53('0x22')](saveUpdates(_0x484db5[_0x3a53('0x56')],null))['then'](respondWithResult(_0x4c89bd,null))['catch'](handleError(_0x4c89bd,null));};exports[_0x3a53('0x58')]=function(_0x1e1145,_0x36960c){return db[_0x3a53('0x3d')][_0x3a53('0x57')]({'where':{'id':_0x1e1145[_0x3a53('0x54')]['id']}})[_0x3a53('0x22')](handleEntityNotFound(_0x36960c,null))[_0x3a53('0x22')](removeEntity(_0x36960c,null))[_0x3a53('0x2d')](handleError(_0x36960c,null));};exports['describe']=function(_0x3739e1,_0x209feb){return db[_0x3a53('0x3d')][_0x3a53('0x59')]()[_0x3a53('0x22')](respondWithResult(_0x209feb,null))['catch'](handleError(_0x209feb,null));};var interaction_log=require(_0x3a53('0x16'))(_0x3a53('0x5a'));exports[_0x3a53('0x5b')]=function(_0x11ec13,_0x5f5c41,_0x3b6333){var _0xba6e66={'agent':{},'channel':'sms'};if(_0x11ec13[_0x3a53('0x56')]['id']){delete _0x11ec13['body']['id'];}_0x11ec13[_0x3a53('0x56')][_0x3a53('0x5c')]=!![];_0x11ec13['body'][_0x3a53('0x5d')]=moment()[_0x3a53('0x5e')](_0x3a53('0x5f'));_0x11ec13['body']['UserId']=_0x11ec13[_0x3a53('0x56')][_0x3a53('0x60')]||_0x11ec13[_0x3a53('0x61')]['id'];_0xba6e66[_0x3a53('0x62')]['id']=_0x11ec13['body'][_0x3a53('0x60')];return db[_0x3a53('0x3d')][_0x3a53('0x57')]({'where':{'id':_0x11ec13['params']['id'],'UserId':null}})[_0x3a53('0x22')](handleEntityNotFound(_0x5f5c41,null))[_0x3a53('0x22')](saveUpdates(_0x11ec13[_0x3a53('0x56')],null))[_0x3a53('0x22')](function(_0x46bffd){if(_0x46bffd){_0xba6e66[_0x3a53('0x2b')]=_0x46bffd[_0x3a53('0x63')]({'plain':!![]});return db[_0x3a53('0x64')][_0x3a53('0x57')]({'where':{'id':_0x46bffd['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x5f5c41,null))[_0x3a53('0x22')](function(_0x3b371c){if(_0x3b371c){return _0x3b371c[_0x3a53('0x37')]({'UserId':_0x11ec13['body'][_0x3a53('0x60')],'read1stAt':_[_0x3a53('0x65')](_0x3b371c[_0x3a53('0x66')])?moment()[_0x3a53('0x5e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x34d9e3){if(_0x34d9e3){_0xba6e66[_0x3a53('0x67')]=_0x34d9e3[_0x3a53('0x63')]({'plain':!![]});interaction_log[_0x3a53('0x23')](_0x3a53('0x68'),_0x11ec13['user']['id'],_0x11ec13[_0x3a53('0x61')]['name'],_0x11ec13[_0x3a53('0x61')][_0x3a53('0x69')],_0xba6e66[_0x3a53('0x67')]['id'],_0x11ec13[_0x3a53('0x56')]?JSON[_0x3a53('0x28')](_0x11ec13[_0x3a53('0x56')]):_0x3a53('0x6a'));return respondWithRpcPromise('AcceptMessage',_0x3a53('0x6b'),_0xba6e66);}return null;})[_0x3a53('0x22')](function(_0x3f4cb3){var _0x26d7b3=_0x3a53('0x6c')+_0x3f4cb3[_0x3a53('0x2b')][_0x3a53('0x6d')];return db[_0x3a53('0x6e')]['query'](_0x26d7b3,{'type':db[_0x3a53('0x6f')][_0x3a53('0x70')][_0x3a53('0x71')],'raw':!![]})[_0x3a53('0x22')](function(_0x48e379){return _0x48e379;});})['then'](function(_0x409717){if(_0x409717){_0xba6e66['message'][_0x3a53('0x72')]=_0x409717[0x0];if(!_0x11ec13[_0x3a53('0x56')][_0x3a53('0x60')])return;return db['User'][_0x3a53('0x57')]({'where':{'id':_0x11ec13[_0x3a53('0x56')]['UserId'],'role':'agent'},'attributes':['id','name',_0x3a53('0x73'),_0x3a53('0x74'),_0x3a53('0x75')],'raw':!![]});}return null;})[_0x3a53('0x22')](function(_0x46fe27){if(!_0x46fe27)return null;_0xba6e66['message']['agent']=_0x46fe27;return _0xba6e66;})[_0x3a53('0x22')](function(_0x1a51e1){if(_0x1a51e1){if(_0x11ec13[_0x3a53('0x56')][_0x3a53('0x76')]){_0xba6e66[_0x3a53('0x2b')][_0x3a53('0x77')]=util[_0x3a53('0x5e')](_0x3a53('0x78'),_0x11ec13[_0x3a53('0x61')][_0x3a53('0x39')]);_0xba6e66[_0x3a53('0x2b')][_0x3a53('0x79')]=_0xba6e66[_0x3a53('0x79')];_0xba6e66[_0x3a53('0x2b')]['motionChannel']=_0xba6e66[_0x3a53('0x79')];_0xba6e66[_0x3a53('0x2b')]['event']=_0x3a53('0x5b');return respondWithRpcPromise('EventManager',_0x3a53('0x7a'),{'event':'acceptmessage','message':_0xba6e66[_0x3a53('0x2b')]},client9002)['then'](function(){return _0xba6e66;});}return _0xba6e66;}return null;})[_0x3a53('0x22')](respondWithResult(_0x5f5c41,null))[_0x3a53('0x2d')](handleError(_0x5f5c41,null));};var interaction_log=require(_0x3a53('0x16'))(_0x3a53('0x5a'));exports[_0x3a53('0x7b')]=function(_0x173e64,_0x4b0499,_0x456fb7){var _0x4dbc1b={'agent':{},'channel':'sms'};if(_0x173e64[_0x3a53('0x56')]['id']){delete _0x173e64[_0x3a53('0x56')]['id'];}_0x173e64[_0x3a53('0x56')]['UserId']=_0x173e64[_0x3a53('0x56')][_0x3a53('0x60')]||_0x173e64[_0x3a53('0x61')]['id'];_0x4dbc1b[_0x3a53('0x62')]['id']=_0x173e64[_0x3a53('0x56')][_0x3a53('0x60')];return db[_0x3a53('0x3d')]['find']({'where':{'id':_0x173e64['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4b0499,null))[_0x3a53('0x22')](function(_0x204a38){if(_0x204a38){_0x4dbc1b[_0x3a53('0x2b')]=_0x204a38['get']({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x204a38[_0x3a53('0x7c')]}});}return null;})[_0x3a53('0x22')](handleEntityNotFound(_0x4b0499,null))['then'](function(_0x177b80){if(_0x177b80){_0x4dbc1b[_0x3a53('0x67')]=_0x177b80['get']({'plain':!![]});interaction_log['info']('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x173e64[_0x3a53('0x61')]['id'],_0x173e64[_0x3a53('0x61')][_0x3a53('0x39')],_0x173e64[_0x3a53('0x61')][_0x3a53('0x69')],_0x4dbc1b[_0x3a53('0x67')]['id'],_0x173e64['body']?JSON['stringify'](_0x173e64[_0x3a53('0x56')]):'null');return respondWithRpcPromise('RejectMessage',_0x3a53('0x7d'),_0x4dbc1b);}return null;})[_0x3a53('0x22')](function(_0x5e8ce0){var _0x426365=_0x3a53('0x6c')+_0x5e8ce0['message'][_0x3a53('0x6d')];return db[_0x3a53('0x6e')][_0x3a53('0x42')](_0x426365,{'type':db[_0x3a53('0x6f')][_0x3a53('0x70')][_0x3a53('0x71')],'raw':!![]})[_0x3a53('0x22')](function(_0x41588d){return _0x41588d;});})['then'](function(_0x57479a){if(_0x57479a){_0x4dbc1b[_0x3a53('0x2b')]['contact']=_0x57479a[0x0];if(!_0x173e64[_0x3a53('0x56')]['UserId'])return;return db['User'][_0x3a53('0x57')]({'where':{'id':_0x173e64[_0x3a53('0x56')][_0x3a53('0x60')],'role':_0x3a53('0x62')},'attributes':['id',_0x3a53('0x39'),_0x3a53('0x73'),'email',_0x3a53('0x75')],'raw':!![]});}return null;})[_0x3a53('0x22')](function(_0x2751b3){if(!_0x2751b3)return null;_0x4dbc1b['message'][_0x3a53('0x62')]=_0x2751b3;return _0x4dbc1b;})[_0x3a53('0x22')](function(_0x20e266){if(_0x20e266){_0x20e266['message'][_0x3a53('0x77')]=util[_0x3a53('0x5e')](_0x3a53('0x78'),_0x173e64[_0x3a53('0x61')][_0x3a53('0x39')]);_0x20e266['message'][_0x3a53('0x79')]=_0x4dbc1b['channel'];_0x20e266[_0x3a53('0x2b')][_0x3a53('0x7e')]=_0x4dbc1b[_0x3a53('0x79')];_0x20e266[_0x3a53('0x2b')]['event']='reject';respondWithRpcPromise('EventManager',_0x3a53('0x7a'),{'event':_0x3a53('0x7f'),'message':_0x20e266[_0x3a53('0x2b')]},client9002);return _0x4dbc1b;}return null;})[_0x3a53('0x22')](respondWithResult(_0x4b0499,null))[_0x3a53('0x2d')](handleError(_0x4b0499,null));};exports[_0x3a53('0x30')]=function(_0x419dc1,_0x84d299,_0x48f463){if(_0x419dc1[_0x3a53('0x56')]['id']){delete _0x419dc1[_0x3a53('0x56')]['id'];}var _0x126a16;return db[_0x3a53('0x3d')][_0x3a53('0x57')]({'where':{'id':_0x419dc1[_0x3a53('0x54')]['id']}})['then'](handleEntityNotFound(_0x84d299,null))[_0x3a53('0x22')](function(_0x224e48){if(_0x224e48){_0x126a16=_0x224e48;return db['SmsAccount']['find']({'where':{'id':_0x224e48[_0x3a53('0x80')]}});}})['then'](handleEntityNotFound(_0x84d299,null))['then'](function(_0x31a7db){if(_0x31a7db){logger[_0x3a53('0x26')](_0x3a53('0x27'),_0x3a53('0x30'),'received\x20delivery\x20report\x20from',_0x31a7db[_0x3a53('0x81')],util[_0x3a53('0x82')](_0x419dc1[_0x3a53('0x56')],{'showHidden':![],'depth':null}));switch(_0x31a7db[_0x3a53('0x81')]){case'twilio':if(_0x419dc1[_0x3a53('0x56')]['MessageSid']&&_0x419dc1[_0x3a53('0x56')][_0x3a53('0x83')]===_0x126a16['messageId']){return _0x126a16[_0x3a53('0x37')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3a53('0x30'),_0x3a53('0x84'),util[_0x3a53('0x82')](_0x419dc1[_0x3a53('0x56')],{'showHidden':![],'depth':null}));}break;case _0x3a53('0x85'):if(_0x419dc1[_0x3a53('0x56')][_0x3a53('0x86')]&&_0x419dc1[_0x3a53('0x56')][_0x3a53('0x86')]===_0x126a16[_0x3a53('0x87')]&&_[_0x3a53('0x88')](['sent',_0x3a53('0x89')],_0x419dc1[_0x3a53('0x56')][_0x3a53('0x8a')])>=0x0){return _0x126a16[_0x3a53('0x37')]({'read':!![]});}else{logger[_0x3a53('0x2a')](_0x3a53('0x8b'),_0x3a53('0x30'),_0x3a53('0x8c'),util[_0x3a53('0x82')](_0x419dc1['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x219e68=_0x419dc1[_0x3a53('0x56')][_0x3a53('0x8d')][0x0];if(_0x219e68['status'][_0x3a53('0x8e')]===_0x3a53('0x8f')){return _0x126a16[_0x3a53('0x37')]({'read':!![]});}else{logger[_0x3a53('0x2a')](_0x3a53('0x8b'),_0x3a53('0x30'),_0x3a53('0x90'),util[_0x3a53('0x82')](_0x419dc1[_0x3a53('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x126a16;}})[_0x3a53('0x22')](respondWithResult(_0x84d299,null))[_0x3a53('0x2d')](handleError(_0x84d299,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 52297b3..8e32725 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 _0x6995=['setMaxListeners','save','remove','emit','hasOwnProperty','exports','events','SmsMessage'];(function(_0x34bc6c,_0x10d089){var _0x168820=function(_0xb058d9){while(--_0xb058d9){_0x34bc6c['push'](_0x34bc6c['shift']());}};_0x168820(++_0x10d089);}(_0x6995,0x1a6));var _0x5699=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6995[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0x5699('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0x5699('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x5699('0x2')](0x0);var events={'afterCreate':_0x5699('0x3'),'afterUpdate':'update','afterDestroy':_0x5699('0x4')};function emitEvent(_0x5e073b){return function(_0x4fc27b,_0x2482fc,_0x4e3a4f){SmsMessageEvents[_0x5699('0x5')](_0x5e073b+':'+_0x4fc27b['id'],_0x4fc27b);SmsMessageEvents[_0x5699('0x5')](_0x5e073b,_0x4fc27b);_0x4e3a4f(null);};}for(var e in events){if(events[_0x5699('0x6')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x5699('0x7')]=SmsMessageEvents; \ No newline at end of file +var _0xde2c=['emit','hasOwnProperty','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','remove'];(function(_0x4fd24c,_0x305f94){var _0x3ab150=function(_0x2602cb){while(--_0x2602cb){_0x4fd24c['push'](_0x4fd24c['shift']());}};_0x3ab150(++_0x305f94);}(_0xde2c,0x66));var _0xcde2=function(_0x3f94f9,_0x42774b){_0x3f94f9=_0x3f94f9-0x0;var _0x46f84f=_0xde2c[_0x3f94f9];return _0x46f84f;};'use strict';var EventEmitter=require(_0xcde2('0x0'));var SmsMessage=require(_0xcde2('0x1'))['db'][_0xcde2('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xcde2('0x3')](0x0);var events={'afterCreate':_0xcde2('0x4'),'afterUpdate':'update','afterDestroy':_0xcde2('0x5')};function emitEvent(_0x543c88){return function(_0x7aa0eb,_0x1f9e8b,_0x155b15){SmsMessageEvents[_0xcde2('0x6')](_0x543c88+':'+_0x7aa0eb['id'],_0x7aa0eb);SmsMessageEvents['emit'](_0x543c88,_0x7aa0eb);_0x155b15(null);};}for(var e in events){if(events[_0xcde2('0x7')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xcde2('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 12bdcde..c5a979f 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 _0x4150=['/status?token=','https://api.plivo.com/v1/Account/%s/Message/','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','login','timestamp','keys','sort','length','apiKey','createHash','md5','digest','hex','signature=','id_sms','clickatell','UTF-8','apiMessageId','Missing\x20parameters:\x20apiKey','bandwidth','accountId','/messages','applicationId','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','intelepeer','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','then','update','error','SmsAccount','find','SmsAccountId','type','twilio','authToken','accountSid','messages','body','phone','/api/sms/messages/','token','sid','afterCreate','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','GET','split','POST','user_key','total_sent','internal_order_id','deliveryReport','read','SmsMessage,\x20%s,\x20%s,\x20%s','skebby','inspect','catch','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','clickSend','plivo','authId','remote'];(function(_0x239b5e,_0x208a3f){var _0x577f3d=function(_0x2880de){while(--_0x2880de){_0x239b5e['push'](_0x239b5e['shift']());}};_0x577f3d(++_0x208a3f);}(_0x4150,0x118));var _0x0415=function(_0x56a154,_0x3cfc02){_0x56a154=_0x56a154-0x0;var _0x66a60=_0x4150[_0x56a154];return _0x66a60;};'use strict';var _=require(_0x0415('0x0'));var util=require(_0x0415('0x1'));var logger=require(_0x0415('0x2'))(_0x0415('0x3'));var moment=require(_0x0415('0x4'));var BPromise=require(_0x0415('0x5'));var rp=require(_0x0415('0x6'));var fs=require('fs');var path=require(_0x0415('0x7'));var rimraf=require(_0x0415('0x8'));var config=require('../../config/environment');var attributes=require(_0x0415('0x9'));module[_0x0415('0xa')]=function(_0x1db742,_0x30f72c){return _0x1db742[_0x0415('0xb')](_0x0415('0xc'),attributes,{'tableName':_0x0415('0xd'),'paranoid':![],'indexes':[{'name':_0x0415('0xe'),'fields':[_0x0415('0xe')]},{'name':'fti_sms_messages','fields':['body'],'type':_0x0415('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xefaa16,_0x49560d,_0x40f0c8){var _0x3f9529=_0x1db742[_0x0415('0x10')];var _0x92aa23=_0xefaa16['get']({'plain':!![]});if(_0x92aa23[_0x0415('0x11')][_0x0415('0x12')]()==='in'||_0x92aa23['direction'][_0x0415('0x12')]()===_0x0415('0x13')&&!_0x92aa23[_0x0415('0x14')]&&!_[_0x0415('0x15')](_0x92aa23[_0x0415('0x16')])&&!_['isNil'](_0x92aa23['SmsInteractionId'])){_0x3f9529[_0x0415('0x17')]['findOne']({'where':{'id':_0x92aa23['SmsInteractionId']}})[_0x0415('0x18')](function(_0x50193e){if(_0x50193e){_0x50193e[_0x0415('0x19')]({'lastMsgAt':_0x92aa23['createdAt'],'lastMsgDirection':_0x92aa23[_0x0415('0x11')][_0x0415('0x12')]()});}})['catch'](function(_0x1c86aa){console[_0x0415('0x1a')](_0x1c86aa);});}if(_0x92aa23[_0x0415('0x11')]===_0x0415('0x13')&&!_0x92aa23[_0x0415('0x14')]){var _0x21677a;_0x3f9529[_0x0415('0x1b')][_0x0415('0x1c')]({'where':{'id':_0x92aa23[_0x0415('0x1d')]},'raw':!![]})['then'](function(_0x5bab9f){_0x21677a=_0x5bab9f;if(_0x21677a&&_0x21677a[_0x0415('0x1e')]){switch(_0x21677a[_0x0415('0x1e')]){case _0x0415('0x1f'):var _0x4fe3fa=require('twilio');if(_0x21677a['accountSid']&&_0x21677a[_0x0415('0x20')]&&_0x21677a['phone']){var _0x4e1d17=new _0x4fe3fa(_0x21677a[_0x0415('0x21')],_0x21677a[_0x0415('0x20')]);_0x4e1d17[_0x0415('0x22')]['create']({'body':_0x92aa23[_0x0415('0x23')],'to':_0x92aa23[_0x0415('0x24')],'from':_0x21677a[_0x0415('0x24')],'statusCallback':_0x21677a['remote']+_0x0415('0x25')+_0x92aa23['id']+'/status?token='+_0x21677a[_0x0415('0x26')]})[_0x0415('0x18')](function(_0x3ad2d9){if(_0x3ad2d9['sid']){return _0xefaa16[_0x0415('0x19')]({'messageId':_0x3ad2d9[_0x0415('0x27')]});}})['catch'](function(_0x2803f0){logger[_0x0415('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x0415('0x1f'),util['inspect'](_0x2803f0,{'showHidden':![],'depth':null}));});}else{logger[_0x0415('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0415('0x28'),_0x0415('0x1f'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case'skebby':var _0x54f79c=_0x0415('0x29');if(_0x21677a[_0x0415('0x2a')]&&_0x21677a[_0x0415('0x2b')]){var _0x53f95f={'recipient':[_0x92aa23['phone']],'message':_0x92aa23[_0x0415('0x23')],'message_type':_0x21677a['smsMethod']};if(_0x21677a[_0x0415('0x2c')]&&_0x21677a['smsMethod']!=='SI'){_0x53f95f[_0x0415('0x2d')]=_0x21677a[_0x0415('0x24')];}var _0x3a39c3={'url':_0x54f79c+'login?username='+_0x21677a['username']+'&password='+_0x21677a[_0x0415('0x2b')],'method':_0x0415('0x2e')};rp(_0x3a39c3)['then'](function(_0x536b5b){var _0x780c86=_0x536b5b[_0x0415('0x2f')](';');var _0x1b4114={'user_key':_0x780c86[0x0],'session_key':_0x780c86[0x1]};_0x3a39c3={'url':_0x54f79c+'sms','method':_0x0415('0x30'),'headers':{'user_key':_0x1b4114[_0x0415('0x31')],'Session_key':_0x1b4114['session_key']},'json':!![],'body':_0x53f95f};return rp(_0x3a39c3);})[_0x0415('0x18')](function(_0x3f795f){if(_0x3f795f[_0x0415('0x32')]>=0x1){var _0x588cbe={'messageId':_0x3f795f[_0x0415('0x33')]};if(_0x21677a[_0x0415('0x2c')]!=='GP'||!_0x21677a[_0x0415('0x34')]){_0x588cbe[_0x0415('0x35')]=!![];}return _0xefaa16[_0x0415('0x19')](_0x588cbe);}else{return logger['error'](_0x0415('0x36'),'afterCreate',_0x0415('0x37'),util[_0x0415('0x38')](_0x3f795f,{'showHidden':![],'depth':null}));}})[_0x0415('0x39')](function(_0x2ff96a){return logger[_0x0415('0x1a')](_0x0415('0x36'),_0x0415('0x28'),_0x0415('0x37'),util[_0x0415('0x38')](_0x2ff96a,{'showHidden':![],'depth':null}));});}else{logger[_0x0415('0x1a')](_0x0415('0x36'),_0x0415('0x28'),_0x0415('0x37'),_0x0415('0x3a'));}break;case _0x0415('0x3b'):if(_0x21677a[_0x0415('0x20')]){var _0x3b8adb={'recipient':_0x92aa23['phone'],'message':_0x92aa23['body'],'sender':_0x21677a[_0x0415('0x3c')]||_0x21677a[_0x0415('0x24')],'authorization':_0x21677a[_0x0415('0x20')]};var _0x49560d={'method':'POST','uri':_0x0415('0x3d'),'body':_0x3b8adb,'json':!![]};rp(_0x49560d)[_0x0415('0x18')](function(_0x20e275){var _0x55d994={'messageId':_0x20e275[_0x0415('0x3e')]};if(!_0x21677a[_0x0415('0x34')]){_0x55d994[_0x0415('0x35')]=!![];}return _0xefaa16[_0x0415('0x19')](_0x55d994);})[_0x0415('0x39')](function(_0x3ac806){logger[_0x0415('0x1a')](_0x0415('0x36'),_0x0415('0x28'),_0x0415('0x3b'),util[_0x0415('0x38')](_0x3ac806,{'showHidden':![],'depth':null}));});}else{logger[_0x0415('0x1a')](_0x0415('0x36'),'afterCreate',_0x0415('0x3b'),'Missing\x20parameters:\x20authToken');}break;case'clicksend':if(_0x21677a[_0x0415('0x2a')]&&_0x21677a[_0x0415('0x2b')]){var _0x3b8adb={'messages':[{'source':_0x0415('0x3f'),'to':_0x92aa23[_0x0415('0x24')],'body':_0x92aa23['body'],'from':_0x21677a[_0x0415('0x3c')]||_0x21677a['phone']}]};var _0x5918a1=util[_0x0415('0x40')](_0x0415('0x41'),_0x21677a[_0x0415('0x2a')],_0x21677a[_0x0415('0x2b')]);var _0x49560d={'method':_0x0415('0x30'),'uri':_0x0415('0x42'),'body':_0x3b8adb,'headers':{'Authorization':util[_0x0415('0x40')](_0x0415('0x43'),new Buffer(_0x5918a1)[_0x0415('0x44')](_0x0415('0x45')))},'json':!![]};rp(_0x49560d)[_0x0415('0x18')](function(_0x18946b){if(_0x18946b[_0x0415('0x46')]>=0xc8&&_0x18946b[_0x0415('0x46')]<=0xce){if(_0x18946b['data']&&_0x18946b[_0x0415('0x47')][_0x0415('0x48')]>0x0){var _0x426b68=_['head'](_0x18946b[_0x0415('0x47')][_0x0415('0x22')]);var _0x53230b={'messageId':_0x426b68['message_id']};if(!_0x21677a['deliveryReport']){_0x53230b['read']=!![];}return _0xefaa16['update'](_0x53230b);}else{logger[_0x0415('0x1a')](_0x0415('0x36'),_0x0415('0x28'),_0x0415('0x49'),util['inspect'](_0x18946b,{'showHidden':![],'depth':null}));}}else{logger[_0x0415('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0415('0x28'),'clickSend',util[_0x0415('0x38')](_0x18946b,{'showHidden':![],'depth':null}));}})[_0x0415('0x39')](function(_0x4e336c){logger['error'](_0x0415('0x36'),_0x0415('0x28'),'clickSend',util['inspect'](_0x4e336c,{'showHidden':![],'depth':null}));});}else{logger[_0x0415('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0415('0x28'),_0x0415('0x49'),_0x0415('0x3a'));}break;case _0x0415('0x4a'):if(_0x21677a[_0x0415('0x4b')]&&_0x21677a[_0x0415('0x20')]){var _0x3b8adb={'dst':_0x92aa23[_0x0415('0x24')],'text':_0x92aa23['body'],'src':_0x21677a[_0x0415('0x3c')]||_0x21677a['phone'],'url':_0x21677a[_0x0415('0x4c')]+_0x0415('0x25')+_0x92aa23['id']+_0x0415('0x4d')+_0x21677a[_0x0415('0x26')]};var _0x5918a1=util[_0x0415('0x40')](_0x0415('0x41'),_0x21677a['authId'],_0x21677a[_0x0415('0x20')]);var _0x49560d={'method':_0x0415('0x30'),'uri':util[_0x0415('0x40')](_0x0415('0x4e'),_0x21677a[_0x0415('0x4b')]),'body':_0x3b8adb,'headers':{'Authorization':util[_0x0415('0x40')](_0x0415('0x43'),new Buffer(_0x5918a1)[_0x0415('0x44')](_0x0415('0x45')))},'json':!![]};rp(_0x49560d)[_0x0415('0x18')](function(_0x32487b){var _0xfc8a70={'messageId':_0x32487b['message_uuid'][0x0]};return _0xefaa16['update'](_0xfc8a70);})[_0x0415('0x39')](function(_0x44ea39){logger[_0x0415('0x1a')](_0x0415('0x36'),_0x0415('0x28'),'plivo',util[_0x0415('0x38')](_0x44ea39,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x0415('0x36'),_0x0415('0x28'),'plivo',_0x0415('0x4f'));}break;case _0x0415('0x50'):if(_0x21677a[_0x0415('0x2a')]&&_0x21677a[_0x0415('0x2b')]){if(_0x21677a[_0x0415('0x51')]){var _0x5c6cda={'method':_0x0415('0x30'),'uri':_0x21677a[_0x0415('0x51')]+_0x0415('0x52'),'body':{'username':_0x21677a[_0x0415('0x2a')],'password':_0x21677a[_0x0415('0x2b')]},'json':!![]};return rp(_0x5c6cda)['then'](function(_0x3af75b){var _0x3d153e={'method':_0x0415('0x30'),'uri':_0x21677a[_0x0415('0x51')]+_0x0415('0x53'),'body':{'messages':[{'from':_0x21677a[_0x0415('0x24')],'destinations':[{'to':_0x92aa23[_0x0415('0x24')]}],'text':_0x92aa23[_0x0415('0x23')],'notifyUrl':_0x21677a[_0x0415('0x4c')]+_0x0415('0x25')+_0x92aa23['id']+'/status?token='+_0x21677a['token'],'notifyContentType':'application/json','callbackData':_0x21677a[_0x0415('0x24')]+';'+_0x92aa23[_0x0415('0x23')]}]},'headers':{'Authorization':_0x0415('0x54')+_0x3af75b[_0x0415('0x26')]},'json':!![]};return rp(_0x3d153e)[_0x0415('0x18')](function(_0x4cb90c){if(_0x4cb90c[_0x0415('0x22')]){var _0x1b1fe8={'messageId':_0x4cb90c[_0x0415('0x22')][0x0][_0x0415('0xe')]};if(!_0x21677a[_0x0415('0x34')]){_0x1b1fe8['read']=!![];}return _0xefaa16['update'](_0x1b1fe8);}else{return logger[_0x0415('0x1a')](_0x0415('0x36'),_0x0415('0x28'),'infobip',util[_0x0415('0x38')](_0x4cb90c,{'showHidden':![],'depth':null}));}});})[_0x0415('0x39')](function(_0x18213f){return logger[_0x0415('0x1a')](_0x0415('0x36'),_0x0415('0x28'),_0x0415('0x50'),util['inspect'](_0x18213f,{'showHidden':![],'depth':null}));});}else{logger[_0x0415('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0415('0x28'),_0x0415('0x50'),_0x0415('0x55'));}}else{logger[_0x0415('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0415('0x28'),'infobip','Missing\x20parameters:\x20username,\x20password');}break;case _0x0415('0x56'):var _0x27a8fb=require(_0x0415('0x57'));if(_0x21677a['apiKey']){var _0x1f9b0a={};_0x1f9b0a[_0x0415('0x58')]=_0x21677a[_0x0415('0x2a')];_0x1f9b0a[_0x0415('0x24')]=_0x92aa23[_0x0415('0x24')];_0x1f9b0a[_0x0415('0x2d')]=_0x21677a[_0x0415('0x24')];_0x1f9b0a['text']=_0x92aa23['body'];_0x1f9b0a[_0x0415('0x59')]=+new Date();var _0x3c06f7='';var _0x18ad20='';var _0x2a20ee=Object[_0x0415('0x5a')](_0x1f9b0a);_0x2a20ee[_0x0415('0x5b')]();for(var _0x213f89=0x0;_0x213f89<_0x2a20ee[_0x0415('0x5c')];_0x213f89++){if(_0x3c06f7!=''){_0x3c06f7+='&';}_0x3c06f7+=_0x2a20ee[_0x213f89]+'='+encodeURIComponent(_0x1f9b0a[_0x2a20ee[_0x213f89]]);_0x18ad20+=_0x1f9b0a[_0x2a20ee[_0x213f89]];}_0x18ad20+=_0x21677a[_0x0415('0x5d')];_0x18ad20=_0x27a8fb[_0x0415('0x5e')](_0x0415('0x5f'))[_0x0415('0x19')](_0x18ad20)[_0x0415('0x60')](_0x0415('0x61'));if(_0x3c06f7!==''){_0x3c06f7+='&';}_0x3c06f7+=_0x0415('0x62')+_0x18ad20;var _0x3a39c3={'method':_0x0415('0x2e'),'uri':_0x21677a[_0x0415('0x51')]+'/external/get/send.php?'+_0x3c06f7,'json':!![]};return rp(_0x3a39c3)[_0x0415('0x18')](function(_0x288993){var _0x18ca04=Object[_0x0415('0x5a')](_0x288993);if(_0x288993[_0x18ca04[0x0]][_0x0415('0x1a')]&&parseInt(_0x288993[_0x18ca04[0x0]]['error'])===0x0){var _0x143dbf={'messageId':_0x288993[_0x18ca04[0x0]][_0x0415('0x63')]};if(!_0x21677a[_0x0415('0x34')]){_0x143dbf[_0x0415('0x35')]=!![];}return _0xefaa16[_0x0415('0x19')](_0x143dbf);}else{return logger[_0x0415('0x1a')](_0x0415('0x36'),_0x0415('0x28'),_0x0415('0x56'),util[_0x0415('0x38')](_0x288993[_0x0415('0x1a')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x268690){return logger[_0x0415('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0415('0x28'),_0x0415('0x56'),util[_0x0415('0x38')](_0x268690,{'showHidden':![],'depth':null}));});}else{logger[_0x0415('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0415('0x28'),_0x0415('0x56'),'Missing\x20parameters:\x20apiKey');}break;case _0x0415('0x64'):if(_0x21677a[_0x0415('0x5d')]){var _0x56f1b5={'method':_0x0415('0x30'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x21677a[_0x0415('0x5d')]},'body':{'content':_0x92aa23[_0x0415('0x23')],'to':[_0x92aa23['phone']],'from':_0x21677a['phone'],'binary':![],'clientMessageId':'uuid','charset':_0x0415('0x65')},'json':!![]};rp(_0x56f1b5)['then'](function(_0x406a2b){if(!_0x406a2b[_0x0415('0x1a')]){var _0x3a034b={'messageId':_0x406a2b[_0x0415('0x22')][0x0][_0x0415('0x66')]};if(!_0x21677a[_0x0415('0x34')]){_0x3a034b[_0x0415('0x35')]=!![];}return _0xefaa16[_0x0415('0x19')](_0x3a034b);}else{return logger[_0x0415('0x1a')](_0x0415('0x36'),_0x0415('0x28'),_0x0415('0x64'),util['inspect'](_0x406a2b['error'],{'showHidden':![],'depth':null}));}})[_0x0415('0x39')](function(_0x4dad33){return logger[_0x0415('0x1a')](_0x0415('0x36'),'afterCreate',_0x0415('0x64'),util['inspect'](_0x4dad33,{'showHidden':![],'depth':null}));});}else{logger[_0x0415('0x1a')](_0x0415('0x36'),_0x0415('0x28'),_0x0415('0x64'),_0x0415('0x67'));}break;case _0x0415('0x68'):if(_0x21677a['username']&&_0x21677a['password']){var _0x5918a1=util[_0x0415('0x40')](_0x0415('0x41'),_0x21677a[_0x0415('0x2a')],_0x21677a[_0x0415('0x2b')]);var _0x49560d={'method':_0x0415('0x30'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x21677a[_0x0415('0x69')]+_0x0415('0x6a'),'body':{'to':[_0x92aa23[_0x0415('0x24')]],'text':_0x92aa23['body'],'from':_0x21677a['phone'],'applicationId':_0x21677a[_0x0415('0x6b')]},'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x5918a1)[_0x0415('0x44')](_0x0415('0x45')))},'json':!![]};rp(_0x49560d)[_0x0415('0x18')](function(_0x5deff9){if(_0x5deff9['id']){var _0x286eab={'messageId':_0x5deff9['id']};return _0xefaa16[_0x0415('0x19')](_0x286eab);}else{logger[_0x0415('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','bandwidth',util[_0x0415('0x38')](_0x5deff9,{'showHidden':![],'depth':null}));}})[_0x0415('0x39')](function(_0x5c9b54){logger['error'](_0x0415('0x36'),'afterCreate',_0x0415('0x68'),util['inspect'](_0x5c9b54,{'showHidden':![],'depth':null}));});}else{logger[_0x0415('0x1a')](_0x0415('0x36'),_0x0415('0x28'),_0x0415('0x68'),_0x0415('0x3a'));}break;case'intelepeer':if(_0x21677a['apiKey']){var _0x50c06d={};var _0x3a39c3={'method':_0x0415('0x30'),'uri':_0x0415('0x6c'),'headers':{'Authorization':_0x0415('0x6d')+_0x21677a[_0x0415('0x5d')],'Content-Type':_0x0415('0x6e')},'body':{'from':_0x21677a[_0x0415('0x24')],'to':_0x92aa23['phone'],'text':_0x92aa23[_0x0415('0x23')]},'json':!![]};return rp(_0x3a39c3)[_0x0415('0x18')](function(_0x4b3d3b){if(_0x4b3d3b[_0x0415('0x6f')]==0xca){_0x50c06d[_0x0415('0x70')]=_0x4b3d3b;var _0x1ca1b0={'method':_0x0415('0x30'),'uri':_0x0415('0x71'),'headers':{'Authorization':_0x0415('0x6d')+_0x21677a['apiKey'],'Content-Type':'application/json'},'body':{'refid':_0x50c06d[_0x0415('0x70')][_0x0415('0x72')]},'json':!![]};return rp(_0x1ca1b0)[_0x0415('0x18')](function(_0x3b602d){_0x50c06d[_0x0415('0x73')]=_0x3b602d;var _0x350548={'messageId':_0x50c06d['message'][_0x0415('0x72')],'read':!![]};return _0xefaa16['update'](_0x350548);});}else{return logger[_0x0415('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0415('0x28'),_0x0415('0x74'),util[_0x0415('0x38')](_0x4b3d3b,{'showHidden':![],'depth':null}));}})[_0x0415('0x39')](function(_0x359177){return logger[_0x0415('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','intelepeer',util[_0x0415('0x38')](_0x359177,{'showHidden':![],'depth':null}));});}else{return logger[_0x0415('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0415('0x28'),_0x0415('0x74'),'Token\x20not\x20received');}break;}}})[_0x0415('0x75')](function(){_0x40f0c8();});}else{_0x40f0c8();}}},'charset':'utf8mb4','collate':_0x0415('0x76')});}; \ No newline at end of file +var _0x32a1=['Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','application/json','csc','crypto','text','timestamp','sort','apiKey','md5','digest','hex','GET','/external/get/send.php?','keys','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','refid','intelepeer','Token\x20not\x20received','finally','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','models','get','direction','toLowerCase','out','secret','UserId','isNil','SmsInteractionId','SmsInteraction','findOne','then','createdAt','catch','SmsAccount','find','SmsAccountId','type','accountSid','phone','authToken','messages','remote','/api/sms/messages/','/status?token=','token','update','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','body','smsMethod','sender','login?username=','&password=','split','sms','user_key','session_key','total_sent','internal_order_id','skebby','inspect','Missing\x20parameters:\x20username,\x20password','connectel','POST','https://smsapi.connectel.se/api/v2/send/','requestid','read','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','senderString','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','base64','http_code','data','queued_count','head','message_id','deliveryReport','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','toString'];(function(_0x51bbc1,_0x3946f3){var _0x2de4ff=function(_0x509d3b){while(--_0x509d3b){_0x51bbc1['push'](_0x51bbc1['shift']());}};_0x2de4ff(++_0x3946f3);}(_0x32a1,0x1a0));var _0x132a=function(_0x5b083b,_0x145a9b){_0x5b083b=_0x5b083b-0x0;var _0x6c2225=_0x32a1[_0x5b083b];return _0x6c2225;};'use strict';var _=require(_0x132a('0x0'));var util=require(_0x132a('0x1'));var logger=require('../../config/logger')(_0x132a('0x2'));var moment=require(_0x132a('0x3'));var BPromise=require('bluebird');var rp=require(_0x132a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x132a('0x5'));var config=require(_0x132a('0x6'));var attributes=require(_0x132a('0x7'));module[_0x132a('0x8')]=function(_0x26eb7f,_0x59a864){return _0x26eb7f[_0x132a('0x9')](_0x132a('0xa'),attributes,{'tableName':_0x132a('0xb'),'paranoid':![],'indexes':[{'name':_0x132a('0xc'),'fields':['messageId']},{'name':_0x132a('0xd'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3a72f6,_0xaed9a,_0x5b1ee7){var _0x1fb742=_0x26eb7f[_0x132a('0xe')];var _0x34cf81=_0x3a72f6[_0x132a('0xf')]({'plain':!![]});if(_0x34cf81[_0x132a('0x10')][_0x132a('0x11')]()==='in'||_0x34cf81[_0x132a('0x10')][_0x132a('0x11')]()===_0x132a('0x12')&&!_0x34cf81[_0x132a('0x13')]&&!_['isNil'](_0x34cf81[_0x132a('0x14')])&&!_[_0x132a('0x15')](_0x34cf81[_0x132a('0x16')])){_0x1fb742[_0x132a('0x17')][_0x132a('0x18')]({'where':{'id':_0x34cf81[_0x132a('0x16')]}})[_0x132a('0x19')](function(_0x2c6836){if(_0x2c6836){_0x2c6836['update']({'lastMsgAt':_0x34cf81[_0x132a('0x1a')],'lastMsgDirection':_0x34cf81['direction'][_0x132a('0x11')]()});}})[_0x132a('0x1b')](function(_0xdc1048){console['error'](_0xdc1048);});}if(_0x34cf81[_0x132a('0x10')]==='out'&&!_0x34cf81[_0x132a('0x13')]){var _0x1471fa;_0x1fb742[_0x132a('0x1c')][_0x132a('0x1d')]({'where':{'id':_0x34cf81[_0x132a('0x1e')]},'raw':!![]})['then'](function(_0x4abdd0){_0x1471fa=_0x4abdd0;if(_0x1471fa&&_0x1471fa['type']){switch(_0x1471fa[_0x132a('0x1f')]){case'twilio':var _0x2f6c7d=require('twilio');if(_0x1471fa[_0x132a('0x20')]&&_0x1471fa['authToken']&&_0x1471fa[_0x132a('0x21')]){var _0x4e3cd0=new _0x2f6c7d(_0x1471fa[_0x132a('0x20')],_0x1471fa[_0x132a('0x22')]);_0x4e3cd0[_0x132a('0x23')]['create']({'body':_0x34cf81['body'],'to':_0x34cf81[_0x132a('0x21')],'from':_0x1471fa[_0x132a('0x21')],'statusCallback':_0x1471fa[_0x132a('0x24')]+_0x132a('0x25')+_0x34cf81['id']+_0x132a('0x26')+_0x1471fa[_0x132a('0x27')]})[_0x132a('0x19')](function(_0x5def1d){if(_0x5def1d['sid']){return _0x3a72f6[_0x132a('0x28')]({'messageId':_0x5def1d['sid']});}})[_0x132a('0x1b')](function(_0x582250){logger[_0x132a('0x29')](_0x132a('0x2a'),_0x132a('0x2b'),_0x132a('0x2c'),util['inspect'](_0x582250,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x132a('0x2a'),'afterCreate',_0x132a('0x2c'),_0x132a('0x2d'));}break;case'skebby':var _0x47a0da=_0x132a('0x2e');if(_0x1471fa[_0x132a('0x2f')]&&_0x1471fa[_0x132a('0x30')]){var _0x2d2c6b={'recipient':[_0x34cf81[_0x132a('0x21')]],'message':_0x34cf81[_0x132a('0x31')],'message_type':_0x1471fa[_0x132a('0x32')]};if(_0x1471fa[_0x132a('0x32')]&&_0x1471fa[_0x132a('0x32')]!=='SI'){_0x2d2c6b[_0x132a('0x33')]=_0x1471fa[_0x132a('0x21')];}var _0xe10a6a={'url':_0x47a0da+_0x132a('0x34')+_0x1471fa[_0x132a('0x2f')]+_0x132a('0x35')+_0x1471fa[_0x132a('0x30')],'method':'GET'};rp(_0xe10a6a)[_0x132a('0x19')](function(_0x574fa4){var _0x5292bc=_0x574fa4[_0x132a('0x36')](';');var _0x16a55a={'user_key':_0x5292bc[0x0],'session_key':_0x5292bc[0x1]};_0xe10a6a={'url':_0x47a0da+_0x132a('0x37'),'method':'POST','headers':{'user_key':_0x16a55a[_0x132a('0x38')],'Session_key':_0x16a55a[_0x132a('0x39')]},'json':!![],'body':_0x2d2c6b};return rp(_0xe10a6a);})['then'](function(_0x2509f2){if(_0x2509f2[_0x132a('0x3a')]>=0x1){var _0xc88663={'messageId':_0x2509f2[_0x132a('0x3b')]};if(_0x1471fa[_0x132a('0x32')]!=='GP'||!_0x1471fa['deliveryReport']){_0xc88663['read']=!![];}return _0x3a72f6[_0x132a('0x28')](_0xc88663);}else{return logger[_0x132a('0x29')](_0x132a('0x2a'),_0x132a('0x2b'),_0x132a('0x3c'),util[_0x132a('0x3d')](_0x2509f2,{'showHidden':![],'depth':null}));}})['catch'](function(_0x4e195a){return logger[_0x132a('0x29')](_0x132a('0x2a'),_0x132a('0x2b'),_0x132a('0x3c'),util[_0x132a('0x3d')](_0x4e195a,{'showHidden':![],'depth':null}));});}else{logger[_0x132a('0x29')](_0x132a('0x2a'),_0x132a('0x2b'),_0x132a('0x3c'),_0x132a('0x3e'));}break;case _0x132a('0x3f'):if(_0x1471fa[_0x132a('0x22')]){var _0x1f12b1={'recipient':_0x34cf81[_0x132a('0x21')],'message':_0x34cf81[_0x132a('0x31')],'sender':_0x1471fa['senderString']||_0x1471fa[_0x132a('0x21')],'authorization':_0x1471fa['authToken']};var _0xaed9a={'method':_0x132a('0x40'),'uri':_0x132a('0x41'),'body':_0x1f12b1,'json':!![]};rp(_0xaed9a)[_0x132a('0x19')](function(_0x2da9dc){var _0x929371={'messageId':_0x2da9dc[_0x132a('0x42')]};if(!_0x1471fa['deliveryReport']){_0x929371[_0x132a('0x43')]=!![];}return _0x3a72f6['update'](_0x929371);})['catch'](function(_0x499bfe){logger[_0x132a('0x29')](_0x132a('0x2a'),_0x132a('0x2b'),_0x132a('0x3f'),util[_0x132a('0x3d')](_0x499bfe,{'showHidden':![],'depth':null}));});}else{logger[_0x132a('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x132a('0x2b'),_0x132a('0x3f'),_0x132a('0x44'));}break;case _0x132a('0x45'):if(_0x1471fa[_0x132a('0x2f')]&&_0x1471fa[_0x132a('0x30')]){var _0x1f12b1={'messages':[{'source':_0x132a('0x46'),'to':_0x34cf81[_0x132a('0x21')],'body':_0x34cf81[_0x132a('0x31')],'from':_0x1471fa[_0x132a('0x47')]||_0x1471fa[_0x132a('0x21')]}]};var _0x3bd49a=util[_0x132a('0x48')](_0x132a('0x49'),_0x1471fa[_0x132a('0x2f')],_0x1471fa[_0x132a('0x30')]);var _0xaed9a={'method':_0x132a('0x40'),'uri':_0x132a('0x4a'),'body':_0x1f12b1,'headers':{'Authorization':util[_0x132a('0x48')](_0x132a('0x4b'),new Buffer(_0x3bd49a)['toString'](_0x132a('0x4c')))},'json':!![]};rp(_0xaed9a)[_0x132a('0x19')](function(_0x3d959f){if(_0x3d959f[_0x132a('0x4d')]>=0xc8&&_0x3d959f['http_code']<=0xce){if(_0x3d959f[_0x132a('0x4e')]&&_0x3d959f[_0x132a('0x4e')][_0x132a('0x4f')]>0x0){var _0x2c56d3=_[_0x132a('0x50')](_0x3d959f[_0x132a('0x4e')][_0x132a('0x23')]);var _0x3f8d81={'messageId':_0x2c56d3[_0x132a('0x51')]};if(!_0x1471fa[_0x132a('0x52')]){_0x3f8d81[_0x132a('0x43')]=!![];}return _0x3a72f6['update'](_0x3f8d81);}else{logger[_0x132a('0x29')](_0x132a('0x2a'),'afterCreate',_0x132a('0x53'),util['inspect'](_0x3d959f,{'showHidden':![],'depth':null}));}}else{logger[_0x132a('0x29')](_0x132a('0x2a'),_0x132a('0x2b'),'clickSend',util['inspect'](_0x3d959f,{'showHidden':![],'depth':null}));}})[_0x132a('0x1b')](function(_0x9c7c96){logger[_0x132a('0x29')](_0x132a('0x2a'),_0x132a('0x2b'),_0x132a('0x53'),util[_0x132a('0x3d')](_0x9c7c96,{'showHidden':![],'depth':null}));});}else{logger[_0x132a('0x29')](_0x132a('0x2a'),_0x132a('0x2b'),'clickSend',_0x132a('0x3e'));}break;case _0x132a('0x54'):if(_0x1471fa[_0x132a('0x55')]&&_0x1471fa[_0x132a('0x22')]){var _0x1f12b1={'dst':_0x34cf81['phone'],'text':_0x34cf81[_0x132a('0x31')],'src':_0x1471fa[_0x132a('0x47')]||_0x1471fa[_0x132a('0x21')],'url':_0x1471fa[_0x132a('0x24')]+_0x132a('0x25')+_0x34cf81['id']+_0x132a('0x26')+_0x1471fa['token']};var _0x3bd49a=util[_0x132a('0x48')]('%s:%s',_0x1471fa[_0x132a('0x55')],_0x1471fa['authToken']);var _0xaed9a={'method':'POST','uri':util['format'](_0x132a('0x56'),_0x1471fa[_0x132a('0x55')]),'body':_0x1f12b1,'headers':{'Authorization':util['format'](_0x132a('0x4b'),new Buffer(_0x3bd49a)[_0x132a('0x57')](_0x132a('0x4c')))},'json':!![]};rp(_0xaed9a)[_0x132a('0x19')](function(_0x299b6a){var _0x2e307f={'messageId':_0x299b6a['message_uuid'][0x0]};return _0x3a72f6[_0x132a('0x28')](_0x2e307f);})['catch'](function(_0x218b62){logger['error'](_0x132a('0x2a'),_0x132a('0x2b'),'plivo',util[_0x132a('0x3d')](_0x218b62,{'showHidden':![],'depth':null}));});}else{logger[_0x132a('0x29')](_0x132a('0x2a'),'afterCreate',_0x132a('0x54'),_0x132a('0x58'));}break;case _0x132a('0x59'):if(_0x1471fa['username']&&_0x1471fa['password']){if(_0x1471fa[_0x132a('0x5a')]){var _0x36c00f={'method':_0x132a('0x40'),'uri':_0x1471fa[_0x132a('0x5a')]+'/auth/1/session','body':{'username':_0x1471fa[_0x132a('0x2f')],'password':_0x1471fa[_0x132a('0x30')]},'json':!![]};return rp(_0x36c00f)[_0x132a('0x19')](function(_0x1aafd0){var _0x2050cf={'method':_0x132a('0x40'),'uri':_0x1471fa[_0x132a('0x5a')]+_0x132a('0x5b'),'body':{'messages':[{'from':_0x1471fa[_0x132a('0x21')],'destinations':[{'to':_0x34cf81[_0x132a('0x21')]}],'text':_0x34cf81[_0x132a('0x31')],'notifyUrl':_0x1471fa[_0x132a('0x24')]+_0x132a('0x25')+_0x34cf81['id']+_0x132a('0x26')+_0x1471fa['token'],'notifyContentType':_0x132a('0x5c'),'callbackData':_0x1471fa[_0x132a('0x21')]+';'+_0x34cf81[_0x132a('0x31')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x1aafd0[_0x132a('0x27')]},'json':!![]};return rp(_0x2050cf)[_0x132a('0x19')](function(_0x30c019){if(_0x30c019['messages']){var _0x58f926={'messageId':_0x30c019['messages'][0x0][_0x132a('0xc')]};if(!_0x1471fa['deliveryReport']){_0x58f926[_0x132a('0x43')]=!![];}return _0x3a72f6[_0x132a('0x28')](_0x58f926);}else{return logger['error'](_0x132a('0x2a'),'afterCreate',_0x132a('0x59'),util[_0x132a('0x3d')](_0x30c019,{'showHidden':![],'depth':null}));}});})[_0x132a('0x1b')](function(_0x175ec6){return logger['error'](_0x132a('0x2a'),_0x132a('0x2b'),_0x132a('0x59'),util[_0x132a('0x3d')](_0x175ec6,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x132a('0x2a'),_0x132a('0x2b'),_0x132a('0x59'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x132a('0x29')](_0x132a('0x2a'),'afterCreate',_0x132a('0x59'),_0x132a('0x3e'));}break;case _0x132a('0x5d'):var _0x4872f8=require(_0x132a('0x5e'));if(_0x1471fa['apiKey']){var _0x52ad70={};_0x52ad70['login']=_0x1471fa[_0x132a('0x2f')];_0x52ad70[_0x132a('0x21')]=_0x34cf81[_0x132a('0x21')];_0x52ad70[_0x132a('0x33')]=_0x1471fa[_0x132a('0x21')];_0x52ad70[_0x132a('0x5f')]=_0x34cf81[_0x132a('0x31')];_0x52ad70[_0x132a('0x60')]=+new Date();var _0x39aeac='';var _0x37f969='';var _0x4b0fb3=Object['keys'](_0x52ad70);_0x4b0fb3[_0x132a('0x61')]();for(var _0x19c262=0x0;_0x19c262<_0x4b0fb3['length'];_0x19c262++){if(_0x39aeac!=''){_0x39aeac+='&';}_0x39aeac+=_0x4b0fb3[_0x19c262]+'='+encodeURIComponent(_0x52ad70[_0x4b0fb3[_0x19c262]]);_0x37f969+=_0x52ad70[_0x4b0fb3[_0x19c262]];}_0x37f969+=_0x1471fa[_0x132a('0x62')];_0x37f969=_0x4872f8['createHash'](_0x132a('0x63'))['update'](_0x37f969)[_0x132a('0x64')](_0x132a('0x65'));if(_0x39aeac!==''){_0x39aeac+='&';}_0x39aeac+='signature='+_0x37f969;var _0xe10a6a={'method':_0x132a('0x66'),'uri':_0x1471fa[_0x132a('0x5a')]+_0x132a('0x67')+_0x39aeac,'json':!![]};return rp(_0xe10a6a)[_0x132a('0x19')](function(_0x36c401){var _0x472e2a=Object[_0x132a('0x68')](_0x36c401);if(_0x36c401[_0x472e2a[0x0]][_0x132a('0x29')]&&parseInt(_0x36c401[_0x472e2a[0x0]][_0x132a('0x29')])===0x0){var _0x528e78={'messageId':_0x36c401[_0x472e2a[0x0]][_0x132a('0x69')]};if(!_0x1471fa[_0x132a('0x52')]){_0x528e78['read']=!![];}return _0x3a72f6['update'](_0x528e78);}else{return logger[_0x132a('0x29')](_0x132a('0x2a'),_0x132a('0x2b'),_0x132a('0x5d'),util[_0x132a('0x3d')](_0x36c401[_0x132a('0x29')],{'showHidden':![],'depth':null}));}})[_0x132a('0x1b')](function(_0x5b282a){return logger[_0x132a('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x132a('0x5d'),util['inspect'](_0x5b282a,{'showHidden':![],'depth':null}));});}else{logger[_0x132a('0x29')](_0x132a('0x2a'),_0x132a('0x2b'),'csc',_0x132a('0x6a'));}break;case _0x132a('0x6b'):if(_0x1471fa[_0x132a('0x62')]){var _0x4d45eb={'method':_0x132a('0x40'),'uri':_0x132a('0x6c'),'headers':{'Authorization':_0x1471fa['apiKey']},'body':{'content':_0x34cf81[_0x132a('0x31')],'to':[_0x34cf81[_0x132a('0x21')]],'from':_0x1471fa[_0x132a('0x21')],'binary':![],'clientMessageId':_0x132a('0x6d'),'charset':_0x132a('0x6e')},'json':!![]};rp(_0x4d45eb)[_0x132a('0x19')](function(_0xd3ef40){if(!_0xd3ef40[_0x132a('0x29')]){var _0x46baae={'messageId':_0xd3ef40[_0x132a('0x23')][0x0][_0x132a('0x6f')]};if(!_0x1471fa['deliveryReport']){_0x46baae['read']=!![];}return _0x3a72f6[_0x132a('0x28')](_0x46baae);}else{return logger[_0x132a('0x29')](_0x132a('0x2a'),'afterCreate',_0x132a('0x6b'),util[_0x132a('0x3d')](_0xd3ef40[_0x132a('0x29')],{'showHidden':![],'depth':null}));}})[_0x132a('0x1b')](function(_0x5aae9c){return logger[_0x132a('0x29')](_0x132a('0x2a'),'afterCreate','clickatell',util[_0x132a('0x3d')](_0x5aae9c,{'showHidden':![],'depth':null}));});}else{logger[_0x132a('0x29')](_0x132a('0x2a'),_0x132a('0x2b'),_0x132a('0x6b'),'Missing\x20parameters:\x20apiKey');}break;case _0x132a('0x70'):if(_0x1471fa[_0x132a('0x2f')]&&_0x1471fa[_0x132a('0x30')]){var _0x3bd49a=util['format'](_0x132a('0x49'),_0x1471fa['username'],_0x1471fa['password']);var _0xaed9a={'method':_0x132a('0x40'),'uri':_0x132a('0x71')+_0x1471fa[_0x132a('0x72')]+_0x132a('0x73'),'body':{'to':[_0x34cf81[_0x132a('0x21')]],'text':_0x34cf81[_0x132a('0x31')],'from':_0x1471fa[_0x132a('0x21')],'applicationId':_0x1471fa[_0x132a('0x74')]},'headers':{'Authorization':util[_0x132a('0x48')](_0x132a('0x4b'),new Buffer(_0x3bd49a)[_0x132a('0x57')](_0x132a('0x4c')))},'json':!![]};rp(_0xaed9a)[_0x132a('0x19')](function(_0x4ed40c){if(_0x4ed40c['id']){var _0x108e30={'messageId':_0x4ed40c['id']};return _0x3a72f6[_0x132a('0x28')](_0x108e30);}else{logger[_0x132a('0x29')](_0x132a('0x2a'),_0x132a('0x2b'),_0x132a('0x70'),util[_0x132a('0x3d')](_0x4ed40c,{'showHidden':![],'depth':null}));}})[_0x132a('0x1b')](function(_0x5935af){logger[_0x132a('0x29')](_0x132a('0x2a'),_0x132a('0x2b'),'bandwidth',util[_0x132a('0x3d')](_0x5935af,{'showHidden':![],'depth':null}));});}else{logger[_0x132a('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x132a('0x2b'),_0x132a('0x70'),_0x132a('0x3e'));}break;case'intelepeer':if(_0x1471fa['apiKey']){var _0x4d15b2={};var _0xe10a6a={'method':'POST','uri':_0x132a('0x75'),'headers':{'Authorization':_0x132a('0x76')+_0x1471fa[_0x132a('0x62')],'Content-Type':'application/json'},'body':{'from':_0x1471fa[_0x132a('0x21')],'to':_0x34cf81[_0x132a('0x21')],'text':_0x34cf81[_0x132a('0x31')]},'json':!![]};return rp(_0xe10a6a)[_0x132a('0x19')](function(_0x44699b){if(_0x44699b['code']==0xca){_0x4d15b2['message']=_0x44699b;var _0x42844e={'method':_0x132a('0x40'),'uri':_0x132a('0x77'),'headers':{'Authorization':_0x132a('0x76')+_0x1471fa[_0x132a('0x62')],'Content-Type':'application/json'},'body':{'refid':_0x4d15b2[_0x132a('0x78')][_0x132a('0x79')]},'json':!![]};return rp(_0x42844e)['then'](function(_0x4cf716){_0x4d15b2['status']=_0x4cf716;var _0x4cb111={'messageId':_0x4d15b2[_0x132a('0x78')][_0x132a('0x79')],'read':!![]};return _0x3a72f6[_0x132a('0x28')](_0x4cb111);});}else{return logger[_0x132a('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x132a('0x2b'),'intelepeer',util['inspect'](_0x44699b,{'showHidden':![],'depth':null}));}})[_0x132a('0x1b')](function(_0x2be81e){return logger['error'](_0x132a('0x2a'),_0x132a('0x2b'),_0x132a('0x7a'),util[_0x132a('0x3d')](_0x2be81e,{'showHidden':![],'depth':null}));});}else{return logger[_0x132a('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x132a('0x2b'),_0x132a('0x7a'),_0x132a('0x7b'));}break;}}})[_0x132a('0x7c')](function(){_0x5b1ee7();});}else{_0x5b1ee7();}}},'charset':'utf8mb4','collate':_0x132a('0x7d')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index c6f615e..779566b 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 _0xe63f=['raw','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSmsMessage','SmsMessage','body','options'];(function(_0x51ed62,_0x574379){var _0x34aee3=function(_0x2958bc){while(--_0x2958bc){_0x51ed62['push'](_0x51ed62['shift']());}};_0x34aee3(++_0x574379);}(_0xe63f,0x133));var _0xfe63=function(_0x533aa4,_0x33668a){_0x533aa4=_0x533aa4-0x0;var _0x12a1a4=_0xe63f[_0x533aa4];return _0x12a1a4;};'use strict';var _=require(_0xfe63('0x0'));var util=require(_0xfe63('0x1'));var moment=require(_0xfe63('0x2'));var BPromise=require(_0xfe63('0x3'));var rs=require(_0xfe63('0x4'));var fs=require('fs');var Redis=require(_0xfe63('0x5'));var db=require(_0xfe63('0x6'))['db'];var utils=require(_0xfe63('0x7'));var logger=require(_0xfe63('0x8'))(_0xfe63('0x9'));var config=require(_0xfe63('0xa'));var jayson=require(_0xfe63('0xb'));var client=jayson[_0xfe63('0xc')][_0xfe63('0xd')]({'port':0x232a});config[_0xfe63('0xe')]=_[_0xfe63('0xf')](config[_0xfe63('0xe')],{'host':_0xfe63('0x10'),'port':0x18eb});var socket=require(_0xfe63('0x11'))(new Redis(config[_0xfe63('0xe')]));require(_0xfe63('0x12'))[_0xfe63('0x13')](socket);function respondWithRpcPromise(_0x2d83ce,_0x9fb7be,_0x1022b2){return new BPromise(function(_0x2dfe33,_0x48fd83){return client[_0xfe63('0x14')](_0x2d83ce,_0x1022b2)[_0xfe63('0x15')](function(_0x1417bb){logger[_0xfe63('0x16')](_0xfe63('0x17'),_0x9fb7be,_0xfe63('0x18'));logger['debug'](_0xfe63('0x19'),_0x9fb7be,'request\x20sent',JSON[_0xfe63('0x1a')](_0x1417bb));if(_0x1417bb[_0xfe63('0x1b')]){if(_0x1417bb[_0xfe63('0x1b')][_0xfe63('0x1c')]===0x1f4){logger[_0xfe63('0x1b')](_0xfe63('0x17'),_0x9fb7be,_0x1417bb[_0xfe63('0x1b')]['message']);return _0x48fd83(_0x1417bb[_0xfe63('0x1b')][_0xfe63('0x1d')]);}logger[_0xfe63('0x1b')](_0xfe63('0x17'),_0x9fb7be,_0x1417bb['error'][_0xfe63('0x1d')]);return _0x2dfe33(_0x1417bb[_0xfe63('0x1b')][_0xfe63('0x1d')]);}else{logger[_0xfe63('0x16')]('SmsMessage,\x20%s,\x20%s',_0x9fb7be,'request\x20sent');_0x2dfe33(_0x1417bb[_0xfe63('0x1e')][_0xfe63('0x1d')]);}})['catch'](function(_0x2272e6){logger[_0xfe63('0x1b')]('SmsMessage,\x20%s,\x20%s',_0x9fb7be,_0x2272e6);_0x48fd83(_0x2272e6);});});}exports[_0xfe63('0x1f')]=function(_0x23b6b0){var _0x2e9cbf=this;return new Promise(function(_0x565f67,_0x539f45){return db[_0xfe63('0x20')]['create'](_0x23b6b0[_0xfe63('0x21')],{'raw':_0x23b6b0[_0xfe63('0x22')]?_0x23b6b0[_0xfe63('0x22')][_0xfe63('0x23')]===undefined?!![]:![]:!![]})['then'](function(_0x2e5353){logger[_0xfe63('0x16')](_0xfe63('0x1f'),_0x23b6b0);logger[_0xfe63('0x24')](_0xfe63('0x1f'),_0x23b6b0,JSON['stringify'](_0x2e5353));_0x565f67(_0x2e5353);})[_0xfe63('0x25')](function(_0x257668){logger[_0xfe63('0x1b')]('CreateSmsMessage',_0x257668['message'],_0x23b6b0);_0x539f45(_0x2e9cbf['error'](0x1f4,_0x257668['message']));});});}; \ No newline at end of file +var _0x4d20=['info','result','CreateSmsMessage','SmsMessage','body','raw','then','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request\x20sent','debug','error','code','SmsMessage,\x20%s,\x20%s','message'];(function(_0x5d30b4,_0x199248){var _0x1acfb8=function(_0x3544b2){while(--_0x3544b2){_0x5d30b4['push'](_0x5d30b4['shift']());}};_0x1acfb8(++_0x199248);}(_0x4d20,0x174));var _0x04d2=function(_0x59c74c,_0x588238){_0x59c74c=_0x59c74c-0x0;var _0x59349f=_0x4d20[_0x59c74c];return _0x59349f;};'use strict';var _=require(_0x04d2('0x0'));var util=require(_0x04d2('0x1'));var moment=require(_0x04d2('0x2'));var BPromise=require(_0x04d2('0x3'));var rs=require(_0x04d2('0x4'));var fs=require('fs');var Redis=require(_0x04d2('0x5'));var db=require(_0x04d2('0x6'))['db'];var utils=require(_0x04d2('0x7'));var logger=require(_0x04d2('0x8'))(_0x04d2('0x9'));var config=require(_0x04d2('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x04d2('0xb')]({'port':0x232a});config[_0x04d2('0xc')]=_[_0x04d2('0xd')](config[_0x04d2('0xc')],{'host':_0x04d2('0xe'),'port':0x18eb});var socket=require(_0x04d2('0xf'))(new Redis(config[_0x04d2('0xc')]));require(_0x04d2('0x10'))[_0x04d2('0x11')](socket);function respondWithRpcPromise(_0x44c905,_0x1e99de,_0x353ab0){return new BPromise(function(_0x5e91ae,_0x1023f4){return client['request'](_0x44c905,_0x353ab0)['then'](function(_0x6082d2){logger['info']('SmsMessage,\x20%s,\x20%s',_0x1e99de,_0x04d2('0x12'));logger[_0x04d2('0x13')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1e99de,'request\x20sent',JSON['stringify'](_0x6082d2));if(_0x6082d2[_0x04d2('0x14')]){if(_0x6082d2[_0x04d2('0x14')][_0x04d2('0x15')]===0x1f4){logger[_0x04d2('0x14')](_0x04d2('0x16'),_0x1e99de,_0x6082d2['error'][_0x04d2('0x17')]);return _0x1023f4(_0x6082d2['error'][_0x04d2('0x17')]);}logger[_0x04d2('0x14')](_0x04d2('0x16'),_0x1e99de,_0x6082d2[_0x04d2('0x14')][_0x04d2('0x17')]);return _0x5e91ae(_0x6082d2[_0x04d2('0x14')]['message']);}else{logger[_0x04d2('0x18')]('SmsMessage,\x20%s,\x20%s',_0x1e99de,_0x04d2('0x12'));_0x5e91ae(_0x6082d2[_0x04d2('0x19')][_0x04d2('0x17')]);}})['catch'](function(_0x448515){logger['error'](_0x04d2('0x16'),_0x1e99de,_0x448515);_0x1023f4(_0x448515);});});}exports[_0x04d2('0x1a')]=function(_0x57f1de){var _0x4d858c=this;return new Promise(function(_0x4dbf78,_0x3375ce){return db[_0x04d2('0x1b')]['create'](_0x57f1de[_0x04d2('0x1c')],{'raw':_0x57f1de['options']?_0x57f1de['options'][_0x04d2('0x1d')]===undefined?!![]:![]:!![]})[_0x04d2('0x1e')](function(_0x1a0476){logger[_0x04d2('0x18')](_0x04d2('0x1a'),_0x57f1de);logger[_0x04d2('0x13')]('CreateSmsMessage',_0x57f1de,JSON[_0x04d2('0x1f')](_0x1a0476));_0x4dbf78(_0x1a0476);})[_0x04d2('0x20')](function(_0x21c70b){logger[_0x04d2('0x14')](_0x04d2('0x1a'),_0x21c70b[_0x04d2('0x17')],_0x57f1de);_0x3375ce(_0x4d858c[_0x04d2('0x14')](0x1f4,_0x21c70b[_0x04d2('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 38df2da..4c12858 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 _0x0c05=['register','length','./smsMessage.events','save','remove','update','removeListener'];(function(_0x3c95f4,_0x4adbfd){var _0x1711fa=function(_0x502f69){while(--_0x502f69){_0x3c95f4['push'](_0x3c95f4['shift']());}};_0x1711fa(++_0x4adbfd);}(_0x0c05,0xfe));var _0x50c0=function(_0x75e2c9,_0x50b412){_0x75e2c9=_0x75e2c9-0x0;var _0x388ddb=_0x0c05[_0x75e2c9];return _0x388ddb;};'use strict';var SmsMessageEvents=require(_0x50c0('0x0'));var events=[_0x50c0('0x1'),_0x50c0('0x2'),_0x50c0('0x3')];function createListener(_0x94ac82,_0x1d21d0){return function(_0x548493){_0x1d21d0['emit'](_0x94ac82,_0x548493);};}function removeListener(_0x45089c,_0x3338f5){return function(){SmsMessageEvents[_0x50c0('0x4')](_0x45089c,_0x3338f5);};}exports[_0x50c0('0x5')]=function(_0x413be4){for(var _0x37aa00=0x0,_0x417f31=events[_0x50c0('0x6')];_0x37aa00<_0x417f31;_0x37aa00++){var _0x570b44=events[_0x37aa00];var _0x14a94b=createListener('smsMessage:'+_0x570b44,_0x413be4);SmsMessageEvents['on'](_0x570b44,_0x14a94b);}}; \ No newline at end of file +var _0x7c61=['register','length','smsMessage:','save','removeListener'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x7c61,0xbc));var _0x17c6=function(_0x1eccea,_0x12a7fd){_0x1eccea=_0x1eccea-0x0;var _0x37c701=_0x7c61[_0x1eccea];return _0x37c701;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x17c6('0x0'),'remove','update'];function createListener(_0xa25317,_0x2b5ac4){return function(_0x5e2bb4){_0x2b5ac4['emit'](_0xa25317,_0x5e2bb4);};}function removeListener(_0x882914,_0x183ac2){return function(){SmsMessageEvents[_0x17c6('0x1')](_0x882914,_0x183ac2);};}exports[_0x17c6('0x2')]=function(_0x6111c3){for(var _0x59c1a8=0x0,_0x2f2f24=events[_0x17c6('0x3')];_0x59c1a8<_0x2f2f24;_0x59c1a8++){var _0x217ce5=events[_0x59c1a8];var _0x2ed88a=createListener(_0x17c6('0x4')+_0x217ce5,_0x6111c3);SmsMessageEvents['on'](_0x217ce5,_0x2ed88a);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index f3a163d..0e3869b 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 _0x012f=['removeTeams','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./smsQueue.controller','get','isAuthenticated','index','/:id','show','/:id/teams','/:id/users','getAgents','post','create','addAgents','put','update','delete','destroy'];(function(_0x15bc8a,_0x48f2f5){var _0x343080=function(_0x3a07be){while(--_0x3a07be){_0x15bc8a['push'](_0x15bc8a['shift']());}};_0x343080(++_0x48f2f5);}(_0x012f,0xc1));var _0xf012=function(_0x46275a,_0x157c56){_0x46275a=_0x46275a-0x0;var _0x1b6b39=_0x012f[_0x46275a];return _0x1b6b39;};'use strict';var multer=require(_0xf012('0x0'));var util=require('util');var path=require(_0xf012('0x1'));var timeout=require(_0xf012('0x2'));var express=require(_0xf012('0x3'));var router=express[_0xf012('0x4')]();var fs_extra=require(_0xf012('0x5'));var auth=require(_0xf012('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf012('0x7'));router[_0xf012('0x8')]('/',auth[_0xf012('0x9')](),controller[_0xf012('0xa')]);router[_0xf012('0x8')]('/describe',auth[_0xf012('0x9')](),controller['describe']);router[_0xf012('0x8')](_0xf012('0xb'),auth['isAuthenticated'](),controller[_0xf012('0xc')]);router[_0xf012('0x8')]('/:id/members',auth[_0xf012('0x9')](),controller['getMembers']);router[_0xf012('0x8')](_0xf012('0xd'),auth[_0xf012('0x9')](),controller['getTeams']);router[_0xf012('0x8')](_0xf012('0xe'),auth['isAuthenticated'](),controller[_0xf012('0xf')]);router[_0xf012('0x10')]('/',auth[_0xf012('0x9')](),controller[_0xf012('0x11')]);router['post'](_0xf012('0xd'),auth['isAuthenticated'](),controller['addTeams']);router[_0xf012('0x10')]('/:id/users',auth[_0xf012('0x9')](),controller[_0xf012('0x12')]);router[_0xf012('0x13')](_0xf012('0xb'),auth[_0xf012('0x9')](),controller[_0xf012('0x14')]);router[_0xf012('0x15')](_0xf012('0xb'),auth['isAuthenticated'](),controller[_0xf012('0x16')]);router['delete'](_0xf012('0xd'),auth[_0xf012('0x9')](),controller[_0xf012('0x17')]);router[_0xf012('0x15')]('/:id/users',auth[_0xf012('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x1caa=['describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','put','update','removeTeams','delete','removeAgents','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','isAuthenticated','index','get'];(function(_0xd270d,_0x4ca094){var _0x1f9ec3=function(_0x5d53ff){while(--_0x5d53ff){_0xd270d['push'](_0xd270d['shift']());}};_0x1f9ec3(++_0x4ca094);}(_0x1caa,0x1c4));var _0xa1ca=function(_0x5adc35,_0x2b8f62){_0x5adc35=_0x5adc35-0x0;var _0x6096f=_0x1caa[_0x5adc35];return _0x6096f;};'use strict';var multer=require(_0xa1ca('0x0'));var util=require(_0xa1ca('0x1'));var path=require(_0xa1ca('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa1ca('0x3')]();var fs_extra=require(_0xa1ca('0x4'));var auth=require(_0xa1ca('0x5'));var interaction=require(_0xa1ca('0x6'));var config=require(_0xa1ca('0x7'));var controller=require(_0xa1ca('0x8'));router['get']('/',auth[_0xa1ca('0x9')](),controller[_0xa1ca('0xa')]);router[_0xa1ca('0xb')]('/describe',auth[_0xa1ca('0x9')](),controller[_0xa1ca('0xc')]);router[_0xa1ca('0xb')](_0xa1ca('0xd'),auth[_0xa1ca('0x9')](),controller[_0xa1ca('0xe')]);router[_0xa1ca('0xb')](_0xa1ca('0xf'),auth[_0xa1ca('0x9')](),controller[_0xa1ca('0x10')]);router[_0xa1ca('0xb')](_0xa1ca('0x11'),auth[_0xa1ca('0x9')](),controller[_0xa1ca('0x12')]);router[_0xa1ca('0xb')](_0xa1ca('0x13'),auth['isAuthenticated'](),controller['getAgents']);router[_0xa1ca('0x14')]('/',auth[_0xa1ca('0x9')](),controller[_0xa1ca('0x15')]);router[_0xa1ca('0x14')]('/:id/teams',auth[_0xa1ca('0x9')](),controller[_0xa1ca('0x16')]);router[_0xa1ca('0x14')](_0xa1ca('0x13'),auth[_0xa1ca('0x9')](),controller['addAgents']);router[_0xa1ca('0x17')](_0xa1ca('0xd'),auth[_0xa1ca('0x9')](),controller[_0xa1ca('0x18')]);router['delete'](_0xa1ca('0xd'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0xa1ca('0x11'),auth[_0xa1ca('0x9')](),controller[_0xa1ca('0x19')]);router[_0xa1ca('0x1a')](_0xa1ca('0x13'),auth[_0xa1ca('0x9')](),controller[_0xa1ca('0x1b')]);module[_0xa1ca('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 9b3f5d1..c69b515 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 _0x7f99=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x7f99,0x1e2));var _0x97f9=function(_0x3bcfee,_0x411cc7){_0x3bcfee=_0x3bcfee-0x0;var _0x161f14=_0x7f99[_0x3bcfee];return _0x161f14;};'use strict';var Sequelize=require(_0x97f9('0x0'));module[_0x97f9('0x1')]={'name':{'type':Sequelize[_0x97f9('0x2')],'unique':_0x97f9('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x97f9('0x2')]},'timeout':{'type':Sequelize[_0x97f9('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x97f9('0x5')](_0x97f9('0x6'),_0x97f9('0x7'),_0x97f9('0x8'))}}; \ No newline at end of file +var _0x781e=['STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','name'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x781e,0x180));var _0xe781=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x781e[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xe781('0x0'));module[_0xe781('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xe781('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe781('0x3')]},'timeout':{'type':Sequelize[_0xe781('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe781('0x5')](_0xe781('0x6'),_0xe781('0x7'),_0xe781('0x8'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 188ef24..9dee973 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 _0x2884=['name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','filter','merge','VIRTUAL','options','SmsQueue','includeAll','include','findAll','show','find','catch','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserSmsQueue','nolimit','pick','SmsQueueId','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','rows','format','%s/%s','getTeams','Team','hasOwnProperty','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','team_has_sms_queues','join','user_has_teams','SmsQueueId\x20=\x20?','clone','push','toString','SELECT','TeamId','includes','all','union','compact','value','isEmpty','userSmsQueue:remove','addAgents','spread','removeAgents','isArray','getAgents','eml-format','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','end','json','undefined','limit','count','offset','status','set','apply','reject','save','update','then','destroy','get','SmsQueues','UserProfileResource','sendStatus','error'];(function(_0x3611d0,_0x315141){var _0x45a5af=function(_0x966173){while(--_0x966173){_0x3611d0['push'](_0x3611d0['shift']());}};_0x45a5af(++_0x315141);}(_0x2884,0xea));var _0x4288=function(_0x39bf66,_0x35c96c){_0x39bf66=_0x39bf66-0x0;var _0x431030=_0x2884[_0x39bf66];return _0x431030;};'use strict';var emlformat=require(_0x4288('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4288('0x1'));var rp=require(_0x4288('0x2'));var moment=require('moment');var BPromise=require(_0x4288('0x3'));var Mustache=require('mustache');var util=require(_0x4288('0x4'));var path=require(_0x4288('0x5'));var sox=require(_0x4288('0x6'));var csv=require(_0x4288('0x7'));var ejs=require(_0x4288('0x8'));var fs=require('fs');var fs_extra=require(_0x4288('0x9'));var _=require(_0x4288('0xa'));var squel=require(_0x4288('0xb'));var crypto=require('crypto');var jsforce=require(_0x4288('0xc'));var deskjs=require(_0x4288('0xd'));var toCsv=require(_0x4288('0x7'));var querystring=require(_0x4288('0xe'));var Papa=require(_0x4288('0xf'));var Redis=require('ioredis');var authService=require(_0x4288('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4288('0x11'));var hardwareService=require(_0x4288('0x12'));var logger=require('../../config/logger')(_0x4288('0x13'));var utils=require(_0x4288('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4288('0x15'))['db'];config[_0x4288('0x16')]=_[_0x4288('0x17')](config[_0x4288('0x16')],{'host':_0x4288('0x18'),'port':0x18eb});var socket=require(_0x4288('0x19'))(new Redis(config[_0x4288('0x16')]));require(_0x4288('0x1a'))['register'](socket);function respondWithStatusCode(_0x25d8e5,_0x3fe827){_0x3fe827=_0x3fe827||0xcc;return function(_0x275acf){if(_0x275acf){return _0x25d8e5['sendStatus'](_0x3fe827);}return _0x25d8e5['status'](_0x3fe827)[_0x4288('0x1b')]();};}function respondWithResult(_0x52d80f,_0x3b192c){_0x3b192c=_0x3b192c||0xc8;return function(_0x4ead58){if(_0x4ead58){return _0x52d80f['status'](_0x3b192c)[_0x4288('0x1c')](_0x4ead58);}};}function respondWithFilteredResult(_0x3445ad,_0x3ffa4d){return function(_0x4564c7){if(_0x4564c7){var _0x1e6e43=typeof _0x3ffa4d['offset']===_0x4288('0x1d')&&typeof _0x3ffa4d[_0x4288('0x1e')]===_0x4288('0x1d');var _0x49724a=_0x4564c7[_0x4288('0x1f')];var _0x1a1153=_0x1e6e43?0x0:_0x3ffa4d[_0x4288('0x20')];var _0x59ac3f=_0x1e6e43?_0x4564c7[_0x4288('0x1f')]:_0x3ffa4d[_0x4288('0x20')]+_0x3ffa4d[_0x4288('0x1e')];var _0x2c68e0;if(_0x59ac3f>=_0x49724a){_0x59ac3f=_0x49724a;_0x2c68e0=0xc8;}else{_0x2c68e0=0xce;}_0x3445ad[_0x4288('0x21')](_0x2c68e0);return _0x3445ad[_0x4288('0x22')]('Content-Range',_0x1a1153+'-'+_0x59ac3f+'/'+_0x49724a)[_0x4288('0x1c')](_0x4564c7);}return null;};}function patchUpdates(_0x160b86){return function(_0x473904){try{jsonpatch[_0x4288('0x23')](_0x473904,_0x160b86,!![]);}catch(_0x49d3d6){return BPromise[_0x4288('0x24')](_0x49d3d6);}return _0x473904[_0x4288('0x25')]();};}function saveUpdates(_0x22f339,_0x24091b){return function(_0x2c1162){if(_0x2c1162){return _0x2c1162[_0x4288('0x26')](_0x22f339)[_0x4288('0x27')](function(_0x5e1c4b){return _0x5e1c4b;});}return null;};}function removeEntity(_0x176b61,_0x1e0434){return function(_0x466d25){if(_0x466d25){return _0x466d25[_0x4288('0x28')]()[_0x4288('0x27')](function(){var _0x30ffc3=_0x466d25[_0x4288('0x29')]({'plain':!![]});var _0x51f041=_0x4288('0x2a');return db[_0x4288('0x2b')][_0x4288('0x28')]({'where':{'type':_0x51f041,'resourceId':_0x30ffc3['id']}})[_0x4288('0x27')](function(){return _0x466d25;});})[_0x4288('0x27')](function(){_0x176b61[_0x4288('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x60e6c6,_0x594f6b){return function(_0x5b4e23){if(!_0x5b4e23){_0x60e6c6[_0x4288('0x2c')](0x194);}return _0x5b4e23;};}function handleError(_0x577ad7,_0x6d02f){_0x6d02f=_0x6d02f||0x1f4;return function(_0x344683){logger[_0x4288('0x2d')](_0x344683['stack']);if(_0x344683[_0x4288('0x2e')]){delete _0x344683[_0x4288('0x2e')];}_0x577ad7['status'](_0x6d02f)[_0x4288('0x2f')](_0x344683);};}exports[_0x4288('0x30')]=function(_0xe1ee33,_0x5a0de4){var _0x59f20a={},_0xfdd444={},_0x566bbf={'count':0x0,'rows':[]};var _0xc626be=_[_0x4288('0x31')](db['SmsQueue'][_0x4288('0x32')],function(_0xd636d7){return{'name':_0xd636d7[_0x4288('0x33')],'type':_0xd636d7[_0x4288('0x34')]['key']};});_0xfdd444[_0x4288('0x35')]=_['map'](_0xc626be,_0x4288('0x2e'));_0xfdd444[_0x4288('0x36')]=_[_0x4288('0x37')](_0xe1ee33[_0x4288('0x36')]);_0xfdd444[_0x4288('0x38')]=_[_0x4288('0x39')](_0xfdd444[_0x4288('0x35')],_0xfdd444['query']);_0x59f20a[_0x4288('0x3a')]=_['intersection'](_0xfdd444[_0x4288('0x35')],qs['fields'](_0xe1ee33[_0x4288('0x36')][_0x4288('0x3b')]));_0x59f20a[_0x4288('0x3a')]=_0x59f20a[_0x4288('0x3a')][_0x4288('0x3c')]?_0x59f20a[_0x4288('0x3a')]:_0xfdd444[_0x4288('0x35')];if(!_0xe1ee33['query']['hasOwnProperty']('nolimit')){_0x59f20a['limit']=qs[_0x4288('0x1e')](_0xe1ee33[_0x4288('0x36')]['limit']);_0x59f20a[_0x4288('0x20')]=qs[_0x4288('0x20')](_0xe1ee33[_0x4288('0x36')][_0x4288('0x20')]);}_0x59f20a[_0x4288('0x3d')]=qs[_0x4288('0x3e')](_0xe1ee33[_0x4288('0x36')][_0x4288('0x3e')]);_0x59f20a[_0x4288('0x3f')]=qs[_0x4288('0x38')](_['pick'](_0xe1ee33['query'],_0xfdd444[_0x4288('0x38')]),_0xc626be);if(_0xe1ee33[_0x4288('0x36')][_0x4288('0x40')]){_0x59f20a[_0x4288('0x3f')]=_[_0x4288('0x41')](_0x59f20a[_0x4288('0x3f')],{'$or':_[_0x4288('0x31')](_0xc626be,function(_0x4e6008){if(_0x4e6008[_0x4288('0x34')]!==_0x4288('0x42')){var _0x44cb99={};_0x44cb99[_0x4e6008['name']]={'$like':'%'+_0xe1ee33[_0x4288('0x36')][_0x4288('0x40')]+'%'};return _0x44cb99;}})});}_0x59f20a=_[_0x4288('0x41')]({},_0x59f20a,_0xe1ee33[_0x4288('0x43')]);var _0x498c9f={'where':_0x59f20a[_0x4288('0x3f')]};return db[_0x4288('0x44')][_0x4288('0x1f')](_0x498c9f)['then'](function(_0x39f2ae){_0x566bbf['count']=_0x39f2ae;if(_0xe1ee33[_0x4288('0x36')][_0x4288('0x45')]){_0x59f20a[_0x4288('0x46')]=[{'all':!![]}];}return db[_0x4288('0x44')][_0x4288('0x47')](_0x59f20a);})['then'](function(_0xf79236){_0x566bbf['rows']=_0xf79236;return _0x566bbf;})[_0x4288('0x27')](respondWithFilteredResult(_0x5a0de4,_0x59f20a))['catch'](handleError(_0x5a0de4,null));};exports[_0x4288('0x48')]=function(_0x16db49,_0x118ba6){var _0x238f74={'raw':!![],'where':{'id':_0x16db49['params']['id']}},_0xec4323={};_0xec4323[_0x4288('0x35')]=_[_0x4288('0x37')](db['SmsQueue'][_0x4288('0x32')]);_0xec4323['query']=_[_0x4288('0x37')](_0x16db49[_0x4288('0x36')]);_0xec4323['filters']=_[_0x4288('0x39')](_0xec4323[_0x4288('0x35')],_0xec4323[_0x4288('0x36')]);_0x238f74['attributes']=_[_0x4288('0x39')](_0xec4323[_0x4288('0x35')],qs['fields'](_0x16db49['query'][_0x4288('0x3b')]));_0x238f74['attributes']=_0x238f74['attributes'][_0x4288('0x3c')]?_0x238f74[_0x4288('0x3a')]:_0xec4323[_0x4288('0x35')];if(_0x16db49['query'][_0x4288('0x45')]){_0x238f74[_0x4288('0x46')]=[{'all':!![]}];}_0x238f74=_[_0x4288('0x41')]({},_0x238f74,_0x16db49[_0x4288('0x43')]);return db[_0x4288('0x44')][_0x4288('0x49')](_0x238f74)[_0x4288('0x27')](handleEntityNotFound(_0x118ba6,null))[_0x4288('0x27')](respondWithResult(_0x118ba6,null))[_0x4288('0x4a')](handleError(_0x118ba6,null));};exports['create']=function(_0x23be6e,_0x12f677){return db[_0x4288('0x44')][_0x4288('0x4b')](_0x23be6e[_0x4288('0x4c')],{})[_0x4288('0x27')](function(_0x5c7e8a){var _0x7e7bce=_0x23be6e[_0x4288('0x4d')]['get']({'plain':!![]});if(!_0x7e7bce)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x7e7bce[_0x4288('0x4e')]==='user'){var _0xa287c3=_0x5c7e8a[_0x4288('0x29')]({'plain':!![]});var _0x5ad04f=_0x4288('0x2a');return db['UserProfileSection']['find']({'where':{'name':_0x5ad04f,'userProfileId':_0x7e7bce[_0x4288('0x4f')]},'raw':!![]})[_0x4288('0x27')](function(_0xa2ae8e){if(_0xa2ae8e&&_0xa2ae8e[_0x4288('0x50')]===0x0){return db[_0x4288('0x2b')][_0x4288('0x4b')]({'name':_0xa287c3[_0x4288('0x2e')],'resourceId':_0xa287c3['id'],'type':_0xa2ae8e[_0x4288('0x2e')],'sectionId':_0xa2ae8e['id']},{})[_0x4288('0x27')](function(){return _0x5c7e8a;});}else{return _0x5c7e8a;}})[_0x4288('0x4a')](function(_0x232ec5){logger[_0x4288('0x2d')](_0x4288('0x51'),_0x232ec5);throw _0x232ec5;});}return _0x5c7e8a;})['then'](respondWithResult(_0x12f677,0xc9))[_0x4288('0x4a')](handleError(_0x12f677,null));};exports[_0x4288('0x26')]=function(_0x3e4144,_0x13ac75){if(_0x3e4144[_0x4288('0x4c')]['id']){delete _0x3e4144[_0x4288('0x4c')]['id'];}return db[_0x4288('0x44')][_0x4288('0x49')]({'where':{'id':_0x3e4144['params']['id']}})[_0x4288('0x27')](handleEntityNotFound(_0x13ac75,null))['then'](saveUpdates(_0x3e4144[_0x4288('0x4c')],null))[_0x4288('0x27')](respondWithResult(_0x13ac75,null))[_0x4288('0x4a')](handleError(_0x13ac75,null));};exports[_0x4288('0x28')]=function(_0x419e93,_0x473da9){return db[_0x4288('0x44')]['find']({'where':{'id':_0x419e93[_0x4288('0x52')]['id']}})[_0x4288('0x27')](handleEntityNotFound(_0x473da9,null))[_0x4288('0x27')](removeEntity(_0x473da9,null))[_0x4288('0x4a')](handleError(_0x473da9,null));};exports['describe']=function(_0x56363f,_0x3923a7){return db['SmsQueue'][_0x4288('0x53')]()[_0x4288('0x27')](respondWithResult(_0x3923a7,null))[_0x4288('0x4a')](handleError(_0x3923a7,null));};exports[_0x4288('0x54')]=function(_0x122e09,_0x25ab93,_0x256fd9){var _0x932b1c={'raw':!![],'where':{}},_0x2a7579={},_0x431b45;return db[_0x4288('0x44')][_0x4288('0x55')]({'where':{'id':_0x122e09[_0x4288('0x52')]['id']}})[_0x4288('0x27')](handleEntityNotFound(_0x25ab93,null))[_0x4288('0x27')](function(_0x2d69d1){if(_0x2d69d1){_0x431b45=_0x2d69d1[_0x4288('0x29')]({'plain':!![]});_0x2a7579[_0x4288('0x35')]=_[_0x4288('0x37')](db[_0x4288('0x56')][_0x4288('0x32')]);_0x2a7579[_0x4288('0x36')]=_[_0x4288('0x37')](_0x122e09[_0x4288('0x36')]);_0x2a7579[_0x4288('0x38')]=_[_0x4288('0x39')](_0x2a7579[_0x4288('0x35')],_0x2a7579[_0x4288('0x36')]);_0x932b1c[_0x4288('0x3a')]=_['intersection'](_0x2a7579[_0x4288('0x35')],qs['fields'](_0x122e09['query'][_0x4288('0x3b')]));_0x932b1c['attributes']=_0x932b1c[_0x4288('0x3a')][_0x4288('0x3c')]?_0x932b1c[_0x4288('0x3a')]:_0x2a7579['model'];if(!_0x122e09[_0x4288('0x36')]['hasOwnProperty'](_0x4288('0x57'))){_0x932b1c[_0x4288('0x1e')]=qs[_0x4288('0x1e')](_0x122e09['query'][_0x4288('0x1e')]);_0x932b1c[_0x4288('0x20')]=qs[_0x4288('0x20')](_0x122e09[_0x4288('0x36')][_0x4288('0x20')]);}_0x932b1c[_0x4288('0x3d')]=qs[_0x4288('0x3e')](_0x122e09[_0x4288('0x36')]['sort']);_0x932b1c['where']=qs[_0x4288('0x38')](_[_0x4288('0x58')](_0x122e09[_0x4288('0x36')],_0x2a7579[_0x4288('0x38')]));_0x932b1c[_0x4288('0x3f')][_0x4288('0x59')]=_0x2d69d1['id'];if(_0x122e09[_0x4288('0x36')][_0x4288('0x40')]){_0x932b1c[_0x4288('0x3f')]=_[_0x4288('0x41')](_0x932b1c[_0x4288('0x3f')],{'$or':_['map'](_0x932b1c[_0x4288('0x3a')],function(_0x40bb73){var _0x49ff41={};_0x49ff41[_0x40bb73]={'$like':'%'+_0x122e09[_0x4288('0x36')][_0x4288('0x40')]+'%'};return _0x49ff41;})});}_0x932b1c=_[_0x4288('0x41')]({},_0x932b1c,_0x122e09[_0x4288('0x43')]);return db[_0x4288('0x56')]['findAll'](_0x932b1c);}})[_0x4288('0x27')](function(_0x57d8ee){if(_0x57d8ee){return db[_0x4288('0x5a')][_0x4288('0x5b')]({'where':{'id':_[_0x4288('0x31')](_0x57d8ee,_0x4288('0x5c')),'role':_0x4288('0x5d')},'attributes':['id','name',_0x4288('0x5e'),_0x4288('0x5f'),_0x4288('0x60')]});}})[_0x4288('0x27')](function(_0x5f5a67){if(_0x5f5a67){return{'count':_0x5f5a67['count'],'rows':_[_0x4288('0x31')](_0x5f5a67[_0x4288('0x61')],function(_0x35daf2){return{'membername':_0x35daf2[_0x4288('0x2e')],'UserId':_0x35daf2['id'],'queue_name':_0x431b45['name'],'SmsQueueId':_0x431b45['id'],'interface':util[_0x4288('0x62')](_0x4288('0x63'),'SIP',_0x35daf2[_0x4288('0x2e')]),'penalty':0x0,'paused':_0x35daf2[_0x4288('0x5e')],'createdAt':_0x35daf2['createdAt'],'updatedAt':_0x35daf2[_0x4288('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x25ab93,_0x932b1c))[_0x4288('0x4a')](handleError(_0x25ab93,null));};exports[_0x4288('0x64')]=function(_0x5e6b21,_0x56cbb0,_0x1fef76){var _0x171269={};var _0xd0bb73={};var _0xdb1427;var _0x37a6fe;return db[_0x4288('0x44')][_0x4288('0x55')]({'where':{'id':_0x5e6b21[_0x4288('0x52')]['id']}})[_0x4288('0x27')](handleEntityNotFound(_0x56cbb0,null))['then'](function(_0x1a9164){if(_0x1a9164){_0xdb1427=_0x1a9164;_0xd0bb73[_0x4288('0x35')]=_[_0x4288('0x37')](db[_0x4288('0x65')][_0x4288('0x32')]);_0xd0bb73[_0x4288('0x36')]=_[_0x4288('0x37')](_0x5e6b21[_0x4288('0x36')]);_0xd0bb73[_0x4288('0x38')]=_[_0x4288('0x39')](_0xd0bb73[_0x4288('0x35')],_0xd0bb73[_0x4288('0x36')]);_0x171269[_0x4288('0x3a')]=_['intersection'](_0xd0bb73['model'],qs[_0x4288('0x3b')](_0x5e6b21[_0x4288('0x36')][_0x4288('0x3b')]));_0x171269[_0x4288('0x3a')]=_0x171269['attributes'][_0x4288('0x3c')]?_0x171269[_0x4288('0x3a')]:_0xd0bb73[_0x4288('0x35')];_0x171269[_0x4288('0x3d')]=qs['sort'](_0x5e6b21[_0x4288('0x36')][_0x4288('0x3e')]);_0x171269[_0x4288('0x3f')]=qs['filters'](_[_0x4288('0x58')](_0x5e6b21[_0x4288('0x36')],_0xd0bb73[_0x4288('0x38')]));if(_0x5e6b21[_0x4288('0x36')]['filter']){_0x171269[_0x4288('0x3f')]=_['merge'](_0x171269[_0x4288('0x3f')],{'$or':_[_0x4288('0x31')](_0x171269[_0x4288('0x3a')],function(_0x2f2ec9){var _0xed88a7={};_0xed88a7[_0x2f2ec9]={'$like':'%'+_0x5e6b21[_0x4288('0x36')][_0x4288('0x40')]+'%'};return _0xed88a7;})});}_0x171269=_[_0x4288('0x41')]({},_0x171269,_0x5e6b21[_0x4288('0x43')]);return _0xdb1427[_0x4288('0x64')](_0x171269);}})['then'](function(_0x58cde0){if(_0x58cde0){_0x37a6fe=_0x58cde0[_0x4288('0x3c')];if(!_0x5e6b21[_0x4288('0x36')][_0x4288('0x66')]('nolimit')){_0x171269[_0x4288('0x1e')]=qs[_0x4288('0x1e')](_0x5e6b21[_0x4288('0x36')][_0x4288('0x1e')]);_0x171269['offset']=qs[_0x4288('0x20')](_0x5e6b21[_0x4288('0x36')][_0x4288('0x20')]);}return _0xdb1427[_0x4288('0x64')](_0x171269);}})[_0x4288('0x27')](function(_0x41b507){if(_0x41b507){return _0x41b507?{'count':_0x37a6fe,'rows':_0x41b507}:null;}})['then'](respondWithResult(_0x56cbb0,null))[_0x4288('0x4a')](handleError(_0x56cbb0,null));};exports['addTeams']=function(_0x387480,_0x419cac,_0x301214){var _0x385558=_0x387480[_0x4288('0x4c')][_0x4288('0x67')];return db[_0x4288('0x65')][_0x4288('0x47')]({'where':{'id':_0x385558},'attributes':['id'],'include':[{'model':db[_0x4288('0x5a')],'as':_0x4288('0x68'),'attributes':['id',_0x4288('0x2e'),_0x4288('0x69'),_0x4288('0x6a'),_0x4288('0x6b')],'raw':!![]}]})['then'](function(_0xd6a3a1){if(_0xd6a3a1){var _0x505bc6=_[_0x4288('0x6c')](_0xd6a3a1,function(_0xaac934){var _0xa5e3bc=_0xaac934['get']({'plain':!![]});return _0xa5e3bc[_0x4288('0x68')];});return db[_0x4288('0x44')]['find']({'where':{'id':_0x387480[_0x4288('0x52')]['id']}})[_0x4288('0x27')](function(_0x140d8e){return db[_0x4288('0x6d')][_0x4288('0x6e')](function(_0x2f9ddf){return _0x140d8e['addTeams'](_0x385558,{'transaction':_0x2f9ddf})[_0x4288('0x27')](function(){return BPromise[_0x4288('0x6f')](_0x505bc6,function(_0xd581f){return db[_0x4288('0x56')][_0x4288('0x70')]({'where':{'UserId':_0xd581f['id'],'SmsQueueId':_0x387480['params']['id']},'transaction':_0x2f9ddf});});})['then'](function(){_0x505bc6[_0x4288('0x71')](function(_0x13413e){socket[_0x4288('0x72')]('userSmsQueue:save',{'UserId':_0x13413e['id'],'SmsQueueId':_0x140d8e['id']});});});});});}})[_0x4288('0x27')](respondWithStatusCode(_0x419cac,null))[_0x4288('0x4a')](handleError(_0x419cac,null));};exports[_0x4288('0x73')]=function(_0x7a289c,_0x1557fa,_0x54c42b){return db['Team'][_0x4288('0x47')]({'where':{'id':_0x7a289c['query'][_0x4288('0x67')]},'attributes':['id'],'include':[{'model':db[_0x4288('0x5a')],'as':_0x4288('0x68'),'attributes':['id'],'raw':!![]}]})[_0x4288('0x27')](handleEntityNotFound(_0x1557fa,null))[_0x4288('0x27')](function(_0x4963a6){var _0x342cef=_['map'](_0x4963a6,'id');var _0x19cd2d=[];var _0x59eb82=[];var _0x351e24=squel[_0x4288('0x74')]();_0x351e24[_0x4288('0x75')](_0x4288('0x76'))['from'](_0x4288('0x77'),'tq')[_0x4288('0x78')](_0x4288('0x79'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x4288('0x3f')](_0x4288('0x7a'),_0x7a289c[_0x4288('0x52')]['id']);for(var _0x53074f=0x0;_0x53074f<_0x4963a6['length'];_0x53074f+=0x1){let _0x24d8a8=_0x4963a6[_0x53074f];for(var _0x3821b5=0x0;_0x3821b5<_0x24d8a8[_0x4288('0x68')]['length'];_0x3821b5+=0x1){let _0x54eed1=_0x24d8a8[_0x4288('0x68')][_0x3821b5];var _0x4abe69=_0x351e24[_0x4288('0x7b')]();_0x4abe69[_0x4288('0x3f')]('ut.UserId\x20=\x20?',_0x54eed1['id']);_0x59eb82[_0x4288('0x7c')](db[_0x4288('0x6d')][_0x4288('0x36')](_0x4abe69[_0x4288('0x7d')](),{'type':db[_0x4288('0x6d')]['QueryTypes'][_0x4288('0x7e')]})[_0x4288('0x27')](function(_0x37d03e){if(_0x37d03e[_0x4288('0x3c')]===0x1){return _0x54eed1['id'];}else{var _0x42bd8a=_['every'](_[_0x4288('0x31')](_0x37d03e,_0x4288('0x7f')),function(_0x2602f2){return _[_0x4288('0x80')](_0x342cef,_0x2602f2);});if(_0x42bd8a){return _0x54eed1['id'];}}}));}}return BPromise[_0x4288('0x81')](_0x59eb82)['then'](function(_0x5038af){_0x19cd2d=_(_0x19cd2d)[_0x4288('0x82')](_0x5038af)[_0x4288('0x83')]()[_0x4288('0x84')]();return db[_0x4288('0x44')][_0x4288('0x49')]({'where':{'id':_0x7a289c[_0x4288('0x52')]['id']}})[_0x4288('0x27')](function(_0xb34932){return db[_0x4288('0x6d')][_0x4288('0x6e')](function(_0x4d0dfb){return _0xb34932[_0x4288('0x73')](_0x7a289c[_0x4288('0x36')][_0x4288('0x67')],{'transaction':_0x4d0dfb})[_0x4288('0x27')](function(){if(!_[_0x4288('0x85')](_0x19cd2d)){return _0xb34932['removeAgents'](_0x19cd2d,{'transaction':_0x4d0dfb});}})[_0x4288('0x27')](function(){_0x19cd2d[_0x4288('0x71')](function(_0x5c8d0b){socket[_0x4288('0x72')](_0x4288('0x86'),{'UserId':_0x5c8d0b,'SmsQueueId':_0xb34932['id']});});});});});});})[_0x4288('0x27')](respondWithStatusCode(_0x1557fa,null))[_0x4288('0x4a')](handleError(_0x1557fa,null));};exports[_0x4288('0x87')]=function(_0x3aacdc,_0x2e63a5,_0x10bff5){return db[_0x4288('0x44')][_0x4288('0x49')]({'where':{'id':_0x3aacdc['params']['id']}})[_0x4288('0x27')](handleEntityNotFound(_0x2e63a5,null))[_0x4288('0x27')](function(_0x1749a9){if(_0x1749a9){return _0x1749a9[_0x4288('0x87')](_0x3aacdc['body'][_0x4288('0x67')],_['omit'](_0x3aacdc[_0x4288('0x4c')],[_0x4288('0x67'),'id'])||{})[_0x4288('0x88')](function(_0x322a86){for(var _0xd8287d=0x0;_0xd8287d<_0x3aacdc[_0x4288('0x4c')]['ids'][_0x4288('0x3c')];_0xd8287d+=0x1){socket[_0x4288('0x72')]('userSmsQueue:save',{'UserId':Number(_0x3aacdc[_0x4288('0x4c')][_0x4288('0x67')][_0xd8287d]),'SmsQueueId':Number(_0x3aacdc[_0x4288('0x52')]['id'])});}return _0x322a86;});}})[_0x4288('0x27')](respondWithResult(_0x2e63a5,null))[_0x4288('0x4a')](handleError(_0x2e63a5,null));};exports['removeAgents']=function(_0x2d03e3,_0x536582,_0x24f0de){return db[_0x4288('0x44')]['find']({'where':{'id':_0x2d03e3[_0x4288('0x52')]['id']}})[_0x4288('0x27')](handleEntityNotFound(_0x536582,null))[_0x4288('0x27')](function(_0x5a218a){if(_0x5a218a){return _0x5a218a[_0x4288('0x89')](_0x2d03e3[_0x4288('0x36')][_0x4288('0x67')])['then'](function(){if(_[_0x4288('0x8a')](_0x2d03e3[_0x4288('0x36')][_0x4288('0x67')])){for(var _0x137610=0x0;_0x137610<_0x2d03e3[_0x4288('0x36')][_0x4288('0x67')][_0x4288('0x3c')];_0x137610+=0x1){socket[_0x4288('0x72')]('userSmsQueue:remove',{'UserId':Number(_0x2d03e3[_0x4288('0x36')][_0x4288('0x67')][_0x137610]),'SmsQueueId':Number(_0x2d03e3[_0x4288('0x52')]['id'])});}}else{socket[_0x4288('0x72')](_0x4288('0x86'),{'UserId':Number(_0x2d03e3[_0x4288('0x36')][_0x4288('0x67')]),'SmsQueueId':Number(_0x2d03e3[_0x4288('0x52')]['id'])});}});}})[_0x4288('0x27')](respondWithStatusCode(_0x536582,null))[_0x4288('0x4a')](handleError(_0x536582,null));};exports[_0x4288('0x8b')]=function(_0x5a7d5b,_0x5babbf,_0x12727e){var _0x401ad0={};var _0x19f364={};var _0x55f018;var _0x246f9b;return db[_0x4288('0x44')][_0x4288('0x55')]({'where':{'id':_0x5a7d5b[_0x4288('0x52')]['id']}})[_0x4288('0x27')](handleEntityNotFound(_0x5babbf,null))[_0x4288('0x27')](function(_0x43c8ae){if(_0x43c8ae){_0x55f018=_0x43c8ae;_0x19f364[_0x4288('0x35')]=_[_0x4288('0x37')](db[_0x4288('0x5a')]['rawAttributes']);_0x19f364[_0x4288('0x36')]=_[_0x4288('0x37')](_0x5a7d5b['query']);_0x19f364[_0x4288('0x38')]=_[_0x4288('0x39')](_0x19f364[_0x4288('0x35')],_0x19f364[_0x4288('0x36')]);_0x401ad0[_0x4288('0x3a')]=_['intersection'](_0x19f364[_0x4288('0x35')],qs[_0x4288('0x3b')](_0x5a7d5b['query'][_0x4288('0x3b')]));_0x401ad0[_0x4288('0x3a')]=_0x401ad0[_0x4288('0x3a')][_0x4288('0x3c')]?_0x401ad0[_0x4288('0x3a')]:_0x19f364['model'];_0x401ad0[_0x4288('0x3d')]=qs['sort'](_0x5a7d5b[_0x4288('0x36')][_0x4288('0x3e')]);_0x401ad0[_0x4288('0x3f')]=qs[_0x4288('0x38')](_['pick'](_0x5a7d5b[_0x4288('0x36')],_0x19f364[_0x4288('0x38')]));if(_0x5a7d5b[_0x4288('0x36')][_0x4288('0x40')]){_0x401ad0[_0x4288('0x3f')]=_[_0x4288('0x41')](_0x401ad0['where'],{'$or':_[_0x4288('0x31')](_0x401ad0['attributes'],function(_0x10decf){var _0x19dae6={};_0x19dae6[_0x10decf]={'$like':'%'+_0x5a7d5b[_0x4288('0x36')][_0x4288('0x40')]+'%'};return _0x19dae6;})});}_0x401ad0=_['merge']({},_0x401ad0,_0x5a7d5b[_0x4288('0x43')]);return _0x55f018[_0x4288('0x8b')](_0x401ad0);}})[_0x4288('0x27')](function(_0x5192d1){if(_0x5192d1){_0x246f9b=_0x5192d1[_0x4288('0x3c')];if(!_0x5a7d5b[_0x4288('0x36')][_0x4288('0x66')](_0x4288('0x57'))){_0x401ad0[_0x4288('0x1e')]=qs[_0x4288('0x1e')](_0x5a7d5b['query'][_0x4288('0x1e')]);_0x401ad0[_0x4288('0x20')]=qs[_0x4288('0x20')](_0x5a7d5b[_0x4288('0x36')][_0x4288('0x20')]);}return _0x55f018[_0x4288('0x8b')](_0x401ad0);}})[_0x4288('0x27')](function(_0x469692){if(_0x469692){return _0x469692?{'count':_0x246f9b,'rows':_0x469692}:null;}})[_0x4288('0x27')](respondWithResult(_0x5babbf,null))[_0x4288('0x4a')](handleError(_0x5babbf,null));}; \ No newline at end of file +var _0x9d44=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','SmsQueue','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserSmsQueue','hasOwnProperty','SmsQueueId','User','findAndCountAll','UserId','agent','updatedAt','createdAt','%s/%s','getTeams','Team','pick','addTeams','ids','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','Agents','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','all','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x30f573,_0xf99d11){var _0x5b8fee=function(_0x5aa1ca){while(--_0x5aa1ca){_0x30f573['push'](_0x30f573['shift']());}};_0x5b8fee(++_0xf99d11);}(_0x9d44,0x1af));var _0x49d4=function(_0x1d7b16,_0x168739){_0x1d7b16=_0x1d7b16-0x0;var _0x59d484=_0x9d44[_0x1d7b16];return _0x59d484;};'use strict';var emlformat=require(_0x49d4('0x0'));var rimraf=require(_0x49d4('0x1'));var zipdir=require(_0x49d4('0x2'));var jsonpatch=require(_0x49d4('0x3'));var rp=require(_0x49d4('0x4'));var moment=require(_0x49d4('0x5'));var BPromise=require(_0x49d4('0x6'));var Mustache=require(_0x49d4('0x7'));var util=require(_0x49d4('0x8'));var path=require(_0x49d4('0x9'));var sox=require(_0x49d4('0xa'));var csv=require(_0x49d4('0xb'));var ejs=require(_0x49d4('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x49d4('0xd'));var squel=require(_0x49d4('0xe'));var crypto=require(_0x49d4('0xf'));var jsforce=require(_0x49d4('0x10'));var deskjs=require(_0x49d4('0x11'));var toCsv=require(_0x49d4('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x49d4('0x12'));var authService=require(_0x49d4('0x13'));var qs=require(_0x49d4('0x14'));var as=require(_0x49d4('0x15'));var hardwareService=require(_0x49d4('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x49d4('0x17'));var config=require(_0x49d4('0x18'));var licenseUtil=require(_0x49d4('0x19'));var db=require(_0x49d4('0x1a'))['db'];config[_0x49d4('0x1b')]=_[_0x49d4('0x1c')](config[_0x49d4('0x1b')],{'host':_0x49d4('0x1d'),'port':0x18eb});var socket=require(_0x49d4('0x1e'))(new Redis(config[_0x49d4('0x1b')]));require('./smsQueue.socket')['register'](socket);function respondWithStatusCode(_0x1794f3,_0x4883cc){_0x4883cc=_0x4883cc||0xcc;return function(_0x110814){if(_0x110814){return _0x1794f3[_0x49d4('0x1f')](_0x4883cc);}return _0x1794f3[_0x49d4('0x20')](_0x4883cc)[_0x49d4('0x21')]();};}function respondWithResult(_0x283515,_0x1175f5){_0x1175f5=_0x1175f5||0xc8;return function(_0x56abc7){if(_0x56abc7){return _0x283515[_0x49d4('0x20')](_0x1175f5)[_0x49d4('0x22')](_0x56abc7);}};}function respondWithFilteredResult(_0x9b8d49,_0x862c2f){return function(_0xa46295){if(_0xa46295){var _0x17d35e=typeof _0x862c2f[_0x49d4('0x23')]==='undefined'&&typeof _0x862c2f[_0x49d4('0x24')]===_0x49d4('0x25');var _0x4b6e8e=_0xa46295['count'];var _0xfb784b=_0x17d35e?0x0:_0x862c2f['offset'];var _0x5acde5=_0x17d35e?_0xa46295[_0x49d4('0x26')]:_0x862c2f[_0x49d4('0x23')]+_0x862c2f['limit'];var _0x26f33c;if(_0x5acde5>=_0x4b6e8e){_0x5acde5=_0x4b6e8e;_0x26f33c=0xc8;}else{_0x26f33c=0xce;}_0x9b8d49['status'](_0x26f33c);return _0x9b8d49['set'](_0x49d4('0x27'),_0xfb784b+'-'+_0x5acde5+'/'+_0x4b6e8e)[_0x49d4('0x22')](_0xa46295);}return null;};}function patchUpdates(_0x382107){return function(_0x4624df){try{jsonpatch[_0x49d4('0x28')](_0x4624df,_0x382107,!![]);}catch(_0x2f4755){return BPromise['reject'](_0x2f4755);}return _0x4624df[_0x49d4('0x29')]();};}function saveUpdates(_0x2ebe31,_0x5ddce5){return function(_0x633aee){if(_0x633aee){return _0x633aee[_0x49d4('0x2a')](_0x2ebe31)[_0x49d4('0x2b')](function(_0xb2bdf9){return _0xb2bdf9;});}return null;};}function removeEntity(_0x4e9e15,_0x366064){return function(_0x3eb06a){if(_0x3eb06a){return _0x3eb06a['destroy']()[_0x49d4('0x2b')](function(){var _0x2f80f6=_0x3eb06a[_0x49d4('0x2c')]({'plain':!![]});var _0xf2cb06='SmsQueues';return db[_0x49d4('0x2d')][_0x49d4('0x2e')]({'where':{'type':_0xf2cb06,'resourceId':_0x2f80f6['id']}})[_0x49d4('0x2b')](function(){return _0x3eb06a;});})[_0x49d4('0x2b')](function(){_0x4e9e15[_0x49d4('0x20')](0xcc)[_0x49d4('0x21')]();});}};}function handleEntityNotFound(_0x5cdc2e,_0x23c270){return function(_0x57bde0){if(!_0x57bde0){_0x5cdc2e[_0x49d4('0x1f')](0x194);}return _0x57bde0;};}function handleError(_0x4d3918,_0x1e1785){_0x1e1785=_0x1e1785||0x1f4;return function(_0x258b6e){logger[_0x49d4('0x2f')](_0x258b6e[_0x49d4('0x30')]);if(_0x258b6e[_0x49d4('0x31')]){delete _0x258b6e[_0x49d4('0x31')];}_0x4d3918['status'](_0x1e1785)[_0x49d4('0x32')](_0x258b6e);};}exports[_0x49d4('0x33')]=function(_0x3e78d5,_0x10a3f1){var _0x56cb66={},_0x39c32c={},_0x42c494={'count':0x0,'rows':[]};var _0x726161=_[_0x49d4('0x34')](db[_0x49d4('0x35')][_0x49d4('0x36')],function(_0x4a57b3){return{'name':_0x4a57b3[_0x49d4('0x37')],'type':_0x4a57b3['type'][_0x49d4('0x38')]};});_0x39c32c['model']=_[_0x49d4('0x34')](_0x726161,_0x49d4('0x31'));_0x39c32c[_0x49d4('0x39')]=_['keys'](_0x3e78d5[_0x49d4('0x39')]);_0x39c32c[_0x49d4('0x3a')]=_[_0x49d4('0x3b')](_0x39c32c[_0x49d4('0x3c')],_0x39c32c[_0x49d4('0x39')]);_0x56cb66[_0x49d4('0x3d')]=_[_0x49d4('0x3b')](_0x39c32c[_0x49d4('0x3c')],qs[_0x49d4('0x3e')](_0x3e78d5[_0x49d4('0x39')]['fields']));_0x56cb66[_0x49d4('0x3d')]=_0x56cb66[_0x49d4('0x3d')][_0x49d4('0x3f')]?_0x56cb66['attributes']:_0x39c32c[_0x49d4('0x3c')];if(!_0x3e78d5[_0x49d4('0x39')]['hasOwnProperty'](_0x49d4('0x40'))){_0x56cb66[_0x49d4('0x24')]=qs[_0x49d4('0x24')](_0x3e78d5[_0x49d4('0x39')]['limit']);_0x56cb66[_0x49d4('0x23')]=qs[_0x49d4('0x23')](_0x3e78d5[_0x49d4('0x39')][_0x49d4('0x23')]);}_0x56cb66[_0x49d4('0x41')]=qs[_0x49d4('0x42')](_0x3e78d5[_0x49d4('0x39')][_0x49d4('0x42')]);_0x56cb66[_0x49d4('0x43')]=qs['filters'](_['pick'](_0x3e78d5['query'],_0x39c32c[_0x49d4('0x3a')]),_0x726161);if(_0x3e78d5[_0x49d4('0x39')][_0x49d4('0x44')]){_0x56cb66['where']=_[_0x49d4('0x45')](_0x56cb66[_0x49d4('0x43')],{'$or':_[_0x49d4('0x34')](_0x726161,function(_0xa2c4c0){if(_0xa2c4c0['type']!==_0x49d4('0x46')){var _0x573fb1={};_0x573fb1[_0xa2c4c0[_0x49d4('0x31')]]={'$like':'%'+_0x3e78d5[_0x49d4('0x39')][_0x49d4('0x44')]+'%'};return _0x573fb1;}})});}_0x56cb66=_[_0x49d4('0x45')]({},_0x56cb66,_0x3e78d5[_0x49d4('0x47')]);var _0x4b0b74={'where':_0x56cb66[_0x49d4('0x43')]};return db['SmsQueue']['count'](_0x4b0b74)[_0x49d4('0x2b')](function(_0x51215c){_0x42c494[_0x49d4('0x26')]=_0x51215c;if(_0x3e78d5['query'][_0x49d4('0x48')]){_0x56cb66['include']=[{'all':!![]}];}return db['SmsQueue'][_0x49d4('0x49')](_0x56cb66);})[_0x49d4('0x2b')](function(_0x34acfc){_0x42c494[_0x49d4('0x4a')]=_0x34acfc;return _0x42c494;})[_0x49d4('0x2b')](respondWithFilteredResult(_0x10a3f1,_0x56cb66))[_0x49d4('0x4b')](handleError(_0x10a3f1,null));};exports[_0x49d4('0x4c')]=function(_0x328b02,_0x5ad698){var _0x2b5d46={'raw':!![],'where':{'id':_0x328b02[_0x49d4('0x4d')]['id']}},_0x460125={};_0x460125[_0x49d4('0x3c')]=_['keys'](db[_0x49d4('0x35')]['rawAttributes']);_0x460125[_0x49d4('0x39')]=_[_0x49d4('0x4e')](_0x328b02[_0x49d4('0x39')]);_0x460125[_0x49d4('0x3a')]=_[_0x49d4('0x3b')](_0x460125[_0x49d4('0x3c')],_0x460125[_0x49d4('0x39')]);_0x2b5d46[_0x49d4('0x3d')]=_[_0x49d4('0x3b')](_0x460125[_0x49d4('0x3c')],qs[_0x49d4('0x3e')](_0x328b02[_0x49d4('0x39')]['fields']));_0x2b5d46[_0x49d4('0x3d')]=_0x2b5d46[_0x49d4('0x3d')][_0x49d4('0x3f')]?_0x2b5d46['attributes']:_0x460125[_0x49d4('0x3c')];if(_0x328b02[_0x49d4('0x39')]['includeAll']){_0x2b5d46[_0x49d4('0x4f')]=[{'all':!![]}];}_0x2b5d46=_[_0x49d4('0x45')]({},_0x2b5d46,_0x328b02['options']);return db[_0x49d4('0x35')][_0x49d4('0x50')](_0x2b5d46)[_0x49d4('0x2b')](handleEntityNotFound(_0x5ad698,null))[_0x49d4('0x2b')](respondWithResult(_0x5ad698,null))[_0x49d4('0x4b')](handleError(_0x5ad698,null));};exports[_0x49d4('0x51')]=function(_0x37a79d,_0x4458c7){return db[_0x49d4('0x35')][_0x49d4('0x51')](_0x37a79d[_0x49d4('0x52')],{})[_0x49d4('0x2b')](function(_0xd26881){var _0x55ce85=_0x37a79d[_0x49d4('0x53')][_0x49d4('0x2c')]({'plain':!![]});if(!_0x55ce85)throw new Error(_0x49d4('0x54'));if(_0x55ce85[_0x49d4('0x55')]==='user'){var _0x2d0ed6=_0xd26881[_0x49d4('0x2c')]({'plain':!![]});var _0x4bb6a7=_0x49d4('0x56');return db[_0x49d4('0x57')][_0x49d4('0x50')]({'where':{'name':_0x4bb6a7,'userProfileId':_0x55ce85[_0x49d4('0x58')]},'raw':!![]})[_0x49d4('0x2b')](function(_0x3f78e6){if(_0x3f78e6&&_0x3f78e6['autoAssociation']===0x0){return db['UserProfileResource'][_0x49d4('0x51')]({'name':_0x2d0ed6[_0x49d4('0x31')],'resourceId':_0x2d0ed6['id'],'type':_0x3f78e6[_0x49d4('0x31')],'sectionId':_0x3f78e6['id']},{})[_0x49d4('0x2b')](function(){return _0xd26881;});}else{return _0xd26881;}})[_0x49d4('0x4b')](function(_0x1bd880){logger[_0x49d4('0x2f')](_0x49d4('0x59'),_0x1bd880);throw _0x1bd880;});}return _0xd26881;})[_0x49d4('0x2b')](respondWithResult(_0x4458c7,0xc9))['catch'](handleError(_0x4458c7,null));};exports[_0x49d4('0x2a')]=function(_0x14fdc0,_0x5463e9){if(_0x14fdc0[_0x49d4('0x52')]['id']){delete _0x14fdc0['body']['id'];}return db[_0x49d4('0x35')]['find']({'where':{'id':_0x14fdc0['params']['id']}})[_0x49d4('0x2b')](handleEntityNotFound(_0x5463e9,null))[_0x49d4('0x2b')](saveUpdates(_0x14fdc0[_0x49d4('0x52')],null))[_0x49d4('0x2b')](respondWithResult(_0x5463e9,null))[_0x49d4('0x4b')](handleError(_0x5463e9,null));};exports[_0x49d4('0x2e')]=function(_0x4032e0,_0x1a45d2){return db[_0x49d4('0x35')]['find']({'where':{'id':_0x4032e0[_0x49d4('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1a45d2,null))[_0x49d4('0x2b')](removeEntity(_0x1a45d2,null))[_0x49d4('0x4b')](handleError(_0x1a45d2,null));};exports[_0x49d4('0x5a')]=function(_0x1ea101,_0x154f15){return db[_0x49d4('0x35')]['describe']()[_0x49d4('0x2b')](respondWithResult(_0x154f15,null))['catch'](handleError(_0x154f15,null));};exports['getMembers']=function(_0x37a43f,_0x15f2b2,_0x5e8668){var _0x479806={'raw':!![],'where':{}},_0x44f4c7={},_0x4fb58b;return db['SmsQueue'][_0x49d4('0x5b')]({'where':{'id':_0x37a43f[_0x49d4('0x4d')]['id']}})[_0x49d4('0x2b')](handleEntityNotFound(_0x15f2b2,null))[_0x49d4('0x2b')](function(_0x16d0c4){if(_0x16d0c4){_0x4fb58b=_0x16d0c4[_0x49d4('0x2c')]({'plain':!![]});_0x44f4c7[_0x49d4('0x3c')]=_[_0x49d4('0x4e')](db[_0x49d4('0x5c')][_0x49d4('0x36')]);_0x44f4c7[_0x49d4('0x39')]=_[_0x49d4('0x4e')](_0x37a43f[_0x49d4('0x39')]);_0x44f4c7['filters']=_[_0x49d4('0x3b')](_0x44f4c7[_0x49d4('0x3c')],_0x44f4c7['query']);_0x479806['attributes']=_['intersection'](_0x44f4c7[_0x49d4('0x3c')],qs[_0x49d4('0x3e')](_0x37a43f[_0x49d4('0x39')][_0x49d4('0x3e')]));_0x479806['attributes']=_0x479806[_0x49d4('0x3d')][_0x49d4('0x3f')]?_0x479806[_0x49d4('0x3d')]:_0x44f4c7[_0x49d4('0x3c')];if(!_0x37a43f[_0x49d4('0x39')][_0x49d4('0x5d')](_0x49d4('0x40'))){_0x479806[_0x49d4('0x24')]=qs[_0x49d4('0x24')](_0x37a43f['query'][_0x49d4('0x24')]);_0x479806[_0x49d4('0x23')]=qs[_0x49d4('0x23')](_0x37a43f[_0x49d4('0x39')][_0x49d4('0x23')]);}_0x479806[_0x49d4('0x41')]=qs[_0x49d4('0x42')](_0x37a43f['query'][_0x49d4('0x42')]);_0x479806[_0x49d4('0x43')]=qs['filters'](_['pick'](_0x37a43f[_0x49d4('0x39')],_0x44f4c7[_0x49d4('0x3a')]));_0x479806['where'][_0x49d4('0x5e')]=_0x16d0c4['id'];if(_0x37a43f[_0x49d4('0x39')]['filter']){_0x479806['where']=_[_0x49d4('0x45')](_0x479806[_0x49d4('0x43')],{'$or':_[_0x49d4('0x34')](_0x479806[_0x49d4('0x3d')],function(_0xdf503){var _0x36b58a={};_0x36b58a[_0xdf503]={'$like':'%'+_0x37a43f[_0x49d4('0x39')][_0x49d4('0x44')]+'%'};return _0x36b58a;})});}_0x479806=_[_0x49d4('0x45')]({},_0x479806,_0x37a43f[_0x49d4('0x47')]);return db[_0x49d4('0x5c')][_0x49d4('0x49')](_0x479806);}})[_0x49d4('0x2b')](function(_0x4a396b){if(_0x4a396b){return db[_0x49d4('0x5f')][_0x49d4('0x60')]({'where':{'id':_[_0x49d4('0x34')](_0x4a396b,_0x49d4('0x61')),'role':_0x49d4('0x62')},'attributes':['id',_0x49d4('0x31'),'smsPause',_0x49d4('0x63'),_0x49d4('0x64')]});}})[_0x49d4('0x2b')](function(_0xa6077d){if(_0xa6077d){return{'count':_0xa6077d[_0x49d4('0x26')],'rows':_[_0x49d4('0x34')](_0xa6077d[_0x49d4('0x4a')],function(_0x49218d){return{'membername':_0x49218d[_0x49d4('0x31')],'UserId':_0x49218d['id'],'queue_name':_0x4fb58b[_0x49d4('0x31')],'SmsQueueId':_0x4fb58b['id'],'interface':util['format'](_0x49d4('0x65'),'SIP',_0x49218d[_0x49d4('0x31')]),'penalty':0x0,'paused':_0x49218d['smsPause'],'createdAt':_0x49218d[_0x49d4('0x64')],'updatedAt':_0x49218d['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x49d4('0x2b')](respondWithFilteredResult(_0x15f2b2,_0x479806))[_0x49d4('0x4b')](handleError(_0x15f2b2,null));};exports[_0x49d4('0x66')]=function(_0x2fd81d,_0x441633,_0x3c772f){var _0x48b57b={};var _0x1e375c={};var _0x3bd029;var _0x50d554;return db[_0x49d4('0x35')][_0x49d4('0x5b')]({'where':{'id':_0x2fd81d[_0x49d4('0x4d')]['id']}})[_0x49d4('0x2b')](handleEntityNotFound(_0x441633,null))[_0x49d4('0x2b')](function(_0x5c0e07){if(_0x5c0e07){_0x3bd029=_0x5c0e07;_0x1e375c[_0x49d4('0x3c')]=_['keys'](db[_0x49d4('0x67')][_0x49d4('0x36')]);_0x1e375c[_0x49d4('0x39')]=_[_0x49d4('0x4e')](_0x2fd81d[_0x49d4('0x39')]);_0x1e375c[_0x49d4('0x3a')]=_[_0x49d4('0x3b')](_0x1e375c[_0x49d4('0x3c')],_0x1e375c[_0x49d4('0x39')]);_0x48b57b[_0x49d4('0x3d')]=_['intersection'](_0x1e375c[_0x49d4('0x3c')],qs[_0x49d4('0x3e')](_0x2fd81d[_0x49d4('0x39')][_0x49d4('0x3e')]));_0x48b57b[_0x49d4('0x3d')]=_0x48b57b['attributes'][_0x49d4('0x3f')]?_0x48b57b[_0x49d4('0x3d')]:_0x1e375c[_0x49d4('0x3c')];_0x48b57b[_0x49d4('0x41')]=qs[_0x49d4('0x42')](_0x2fd81d[_0x49d4('0x39')][_0x49d4('0x42')]);_0x48b57b[_0x49d4('0x43')]=qs[_0x49d4('0x3a')](_[_0x49d4('0x68')](_0x2fd81d[_0x49d4('0x39')],_0x1e375c[_0x49d4('0x3a')]));if(_0x2fd81d['query'][_0x49d4('0x44')]){_0x48b57b[_0x49d4('0x43')]=_[_0x49d4('0x45')](_0x48b57b[_0x49d4('0x43')],{'$or':_[_0x49d4('0x34')](_0x48b57b[_0x49d4('0x3d')],function(_0x420ca6){var _0x31743d={};_0x31743d[_0x420ca6]={'$like':'%'+_0x2fd81d[_0x49d4('0x39')][_0x49d4('0x44')]+'%'};return _0x31743d;})});}_0x48b57b=_[_0x49d4('0x45')]({},_0x48b57b,_0x2fd81d[_0x49d4('0x47')]);return _0x3bd029[_0x49d4('0x66')](_0x48b57b);}})[_0x49d4('0x2b')](function(_0x5359ce){if(_0x5359ce){_0x50d554=_0x5359ce['length'];if(!_0x2fd81d['query'][_0x49d4('0x5d')](_0x49d4('0x40'))){_0x48b57b['limit']=qs[_0x49d4('0x24')](_0x2fd81d['query'][_0x49d4('0x24')]);_0x48b57b[_0x49d4('0x23')]=qs['offset'](_0x2fd81d[_0x49d4('0x39')]['offset']);}return _0x3bd029[_0x49d4('0x66')](_0x48b57b);}})[_0x49d4('0x2b')](function(_0x2c03dd){if(_0x2c03dd){return _0x2c03dd?{'count':_0x50d554,'rows':_0x2c03dd}:null;}})[_0x49d4('0x2b')](respondWithResult(_0x441633,null))['catch'](handleError(_0x441633,null));};exports[_0x49d4('0x69')]=function(_0x1642fe,_0x2ecfd7,_0x35fabe){var _0x3ccb1a=_0x1642fe[_0x49d4('0x52')][_0x49d4('0x6a')];return db[_0x49d4('0x67')][_0x49d4('0x49')]({'where':{'id':_0x3ccb1a},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x49d4('0x31'),_0x49d4('0x6b'),_0x49d4('0x6c'),_0x49d4('0x6d')],'raw':!![]}]})['then'](function(_0xd54a5d){if(_0xd54a5d){var _0x251af1=_[_0x49d4('0x6e')](_0xd54a5d,function(_0x2dcce3){var _0x515dae=_0x2dcce3[_0x49d4('0x2c')]({'plain':!![]});return _0x515dae['Agents'];});return db['SmsQueue']['find']({'where':{'id':_0x1642fe['params']['id']}})['then'](function(_0x10f63a){return db[_0x49d4('0x6f')][_0x49d4('0x70')](function(_0x3eb1fb){return _0x10f63a[_0x49d4('0x69')](_0x3ccb1a,{'transaction':_0x3eb1fb})['then'](function(){return BPromise['each'](_0x251af1,function(_0x19b094){return db['UserSmsQueue'][_0x49d4('0x71')]({'where':{'UserId':_0x19b094['id'],'SmsQueueId':_0x1642fe[_0x49d4('0x4d')]['id']},'transaction':_0x3eb1fb});});})[_0x49d4('0x2b')](function(){_0x251af1[_0x49d4('0x72')](function(_0x3a7b67){socket[_0x49d4('0x73')](_0x49d4('0x74'),{'UserId':_0x3a7b67['id'],'SmsQueueId':_0x10f63a['id']});});});});});}})[_0x49d4('0x2b')](respondWithStatusCode(_0x2ecfd7,null))[_0x49d4('0x4b')](handleError(_0x2ecfd7,null));};exports[_0x49d4('0x75')]=function(_0x4db221,_0x180ad0,_0x1b0e62){return db[_0x49d4('0x67')]['findAll']({'where':{'id':_0x4db221[_0x49d4('0x39')][_0x49d4('0x6a')]},'attributes':['id'],'include':[{'model':db[_0x49d4('0x5f')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x49d4('0x2b')](handleEntityNotFound(_0x180ad0,null))['then'](function(_0x5e605f){var _0x2335db=_[_0x49d4('0x34')](_0x5e605f,'id');var _0x4dddfd=[];var _0x123db8=[];var _0x544e2c=squel[_0x49d4('0x76')]();_0x544e2c[_0x49d4('0x77')](_0x49d4('0x78'))[_0x49d4('0x79')](_0x49d4('0x7a'),'tq')['join'](_0x49d4('0x7b'),'ut',_0x49d4('0x7c'))[_0x49d4('0x43')](_0x49d4('0x7d'),_0x4db221[_0x49d4('0x4d')]['id']);for(var _0x4aeeee=0x0;_0x4aeeee<_0x5e605f['length'];_0x4aeeee+=0x1){let _0x284fa3=_0x5e605f[_0x4aeeee];for(var _0x252f71=0x0;_0x252f71<_0x284fa3['Agents']['length'];_0x252f71+=0x1){let _0x520f25=_0x284fa3[_0x49d4('0x7e')][_0x252f71];var _0x4dd896=_0x544e2c[_0x49d4('0x7f')]();_0x4dd896[_0x49d4('0x43')](_0x49d4('0x80'),_0x520f25['id']);_0x123db8['push'](db[_0x49d4('0x6f')][_0x49d4('0x39')](_0x4dd896[_0x49d4('0x81')](),{'type':db[_0x49d4('0x6f')][_0x49d4('0x82')][_0x49d4('0x83')]})[_0x49d4('0x2b')](function(_0x98f81a){if(_0x98f81a[_0x49d4('0x3f')]===0x1){return _0x520f25['id'];}else{var _0x27d4d4=_[_0x49d4('0x84')](_[_0x49d4('0x34')](_0x98f81a,_0x49d4('0x85')),function(_0x5244b3){return _['includes'](_0x2335db,_0x5244b3);});if(_0x27d4d4){return _0x520f25['id'];}}}));}}return BPromise[_0x49d4('0x86')](_0x123db8)[_0x49d4('0x2b')](function(_0xa3ac4b){_0x4dddfd=_(_0x4dddfd)['union'](_0xa3ac4b)[_0x49d4('0x87')]()[_0x49d4('0x88')]();return db[_0x49d4('0x35')][_0x49d4('0x50')]({'where':{'id':_0x4db221['params']['id']}})['then'](function(_0x3eaa22){return db[_0x49d4('0x6f')][_0x49d4('0x70')](function(_0xab1408){return _0x3eaa22[_0x49d4('0x75')](_0x4db221[_0x49d4('0x39')][_0x49d4('0x6a')],{'transaction':_0xab1408})[_0x49d4('0x2b')](function(){if(!_[_0x49d4('0x89')](_0x4dddfd)){return _0x3eaa22[_0x49d4('0x8a')](_0x4dddfd,{'transaction':_0xab1408});}})[_0x49d4('0x2b')](function(){_0x4dddfd[_0x49d4('0x72')](function(_0xd93042){socket[_0x49d4('0x73')](_0x49d4('0x8b'),{'UserId':_0xd93042,'SmsQueueId':_0x3eaa22['id']});});});});});});})['then'](respondWithStatusCode(_0x180ad0,null))[_0x49d4('0x4b')](handleError(_0x180ad0,null));};exports[_0x49d4('0x8c')]=function(_0x52b22f,_0x2e90be,_0x315f0b){return db[_0x49d4('0x35')][_0x49d4('0x50')]({'where':{'id':_0x52b22f[_0x49d4('0x4d')]['id']}})[_0x49d4('0x2b')](handleEntityNotFound(_0x2e90be,null))[_0x49d4('0x2b')](function(_0xe90f1f){if(_0xe90f1f){return _0xe90f1f[_0x49d4('0x8c')](_0x52b22f[_0x49d4('0x52')][_0x49d4('0x6a')],_[_0x49d4('0x8d')](_0x52b22f[_0x49d4('0x52')],[_0x49d4('0x6a'),'id'])||{})[_0x49d4('0x8e')](function(_0x688e78){for(var _0x470911=0x0;_0x470911<_0x52b22f[_0x49d4('0x52')][_0x49d4('0x6a')][_0x49d4('0x3f')];_0x470911+=0x1){socket[_0x49d4('0x73')](_0x49d4('0x74'),{'UserId':Number(_0x52b22f[_0x49d4('0x52')][_0x49d4('0x6a')][_0x470911]),'SmsQueueId':Number(_0x52b22f[_0x49d4('0x4d')]['id'])});}return _0x688e78;});}})[_0x49d4('0x2b')](respondWithResult(_0x2e90be,null))[_0x49d4('0x4b')](handleError(_0x2e90be,null));};exports[_0x49d4('0x8a')]=function(_0x569628,_0x39c8b4,_0x4eabb7){return db[_0x49d4('0x35')]['find']({'where':{'id':_0x569628[_0x49d4('0x4d')]['id']}})[_0x49d4('0x2b')](handleEntityNotFound(_0x39c8b4,null))[_0x49d4('0x2b')](function(_0x12eeeb){if(_0x12eeeb){return _0x12eeeb[_0x49d4('0x8a')](_0x569628['query'][_0x49d4('0x6a')])[_0x49d4('0x2b')](function(){if(_[_0x49d4('0x8f')](_0x569628[_0x49d4('0x39')]['ids'])){for(var _0x3830e5=0x0;_0x3830e5<_0x569628[_0x49d4('0x39')][_0x49d4('0x6a')][_0x49d4('0x3f')];_0x3830e5+=0x1){socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x569628['query'][_0x49d4('0x6a')][_0x3830e5]),'SmsQueueId':Number(_0x569628[_0x49d4('0x4d')]['id'])});}}else{socket[_0x49d4('0x73')](_0x49d4('0x8b'),{'UserId':Number(_0x569628[_0x49d4('0x39')][_0x49d4('0x6a')]),'SmsQueueId':Number(_0x569628[_0x49d4('0x4d')]['id'])});}});}})[_0x49d4('0x2b')](respondWithStatusCode(_0x39c8b4,null))['catch'](handleError(_0x39c8b4,null));};exports['getAgents']=function(_0x3347a5,_0x4286f1,_0x2452ec){var _0x21b780={};var _0x58bb70={};var _0x4eb845;var _0x28655a;return db[_0x49d4('0x35')]['findOne']({'where':{'id':_0x3347a5[_0x49d4('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4286f1,null))[_0x49d4('0x2b')](function(_0x2f1e40){if(_0x2f1e40){_0x4eb845=_0x2f1e40;_0x58bb70[_0x49d4('0x3c')]=_[_0x49d4('0x4e')](db[_0x49d4('0x5f')][_0x49d4('0x36')]);_0x58bb70[_0x49d4('0x39')]=_[_0x49d4('0x4e')](_0x3347a5[_0x49d4('0x39')]);_0x58bb70[_0x49d4('0x3a')]=_[_0x49d4('0x3b')](_0x58bb70[_0x49d4('0x3c')],_0x58bb70['query']);_0x21b780[_0x49d4('0x3d')]=_['intersection'](_0x58bb70['model'],qs[_0x49d4('0x3e')](_0x3347a5[_0x49d4('0x39')][_0x49d4('0x3e')]));_0x21b780[_0x49d4('0x3d')]=_0x21b780[_0x49d4('0x3d')][_0x49d4('0x3f')]?_0x21b780[_0x49d4('0x3d')]:_0x58bb70['model'];_0x21b780[_0x49d4('0x41')]=qs[_0x49d4('0x42')](_0x3347a5[_0x49d4('0x39')][_0x49d4('0x42')]);_0x21b780[_0x49d4('0x43')]=qs[_0x49d4('0x3a')](_['pick'](_0x3347a5[_0x49d4('0x39')],_0x58bb70[_0x49d4('0x3a')]));if(_0x3347a5[_0x49d4('0x39')][_0x49d4('0x44')]){_0x21b780[_0x49d4('0x43')]=_[_0x49d4('0x45')](_0x21b780[_0x49d4('0x43')],{'$or':_['map'](_0x21b780['attributes'],function(_0x105582){var _0x1003f5={};_0x1003f5[_0x105582]={'$like':'%'+_0x3347a5[_0x49d4('0x39')][_0x49d4('0x44')]+'%'};return _0x1003f5;})});}_0x21b780=_[_0x49d4('0x45')]({},_0x21b780,_0x3347a5[_0x49d4('0x47')]);return _0x4eb845[_0x49d4('0x90')](_0x21b780);}})[_0x49d4('0x2b')](function(_0x53fff6){if(_0x53fff6){_0x28655a=_0x53fff6[_0x49d4('0x3f')];if(!_0x3347a5[_0x49d4('0x39')]['hasOwnProperty']('nolimit')){_0x21b780['limit']=qs['limit'](_0x3347a5[_0x49d4('0x39')][_0x49d4('0x24')]);_0x21b780[_0x49d4('0x23')]=qs[_0x49d4('0x23')](_0x3347a5['query'][_0x49d4('0x23')]);}return _0x4eb845[_0x49d4('0x90')](_0x21b780);}})[_0x49d4('0x2b')](function(_0x135a7b){if(_0x135a7b){return _0x135a7b?{'count':_0x28655a,'rows':_0x135a7b}:null;}})[_0x49d4('0x2b')](respondWithResult(_0x4286f1,null))[_0x49d4('0x4b')](handleError(_0x4286f1,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index e4da7a4..36092d9 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 _0x3d35=['hook','events','../../mysqldb','SmsQueue','setMaxListeners','save','update','remove','emit'];(function(_0x1dac7a,_0x1828ce){var _0x4cb363=function(_0x80f6de){while(--_0x80f6de){_0x1dac7a['push'](_0x1dac7a['shift']());}};_0x4cb363(++_0x1828ce);}(_0x3d35,0x17b));var _0x53d3=function(_0x17a28b,_0x5d1465){_0x17a28b=_0x17a28b-0x0;var _0x9cbb5a=_0x3d35[_0x17a28b];return _0x9cbb5a;};'use strict';var EventEmitter=require(_0x53d3('0x0'));var SmsQueue=require(_0x53d3('0x1'))['db'][_0x53d3('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x53d3('0x3')](0x0);var events={'afterCreate':_0x53d3('0x4'),'afterUpdate':_0x53d3('0x5'),'afterDestroy':_0x53d3('0x6')};function emitEvent(_0x2de5f2){return function(_0x5f4e78,_0x573f88,_0xbca937){SmsQueueEvents['emit'](_0x2de5f2+':'+_0x5f4e78['id'],_0x5f4e78);SmsQueueEvents[_0x53d3('0x7')](_0x2de5f2,_0x5f4e78);_0xbca937(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x53d3('0x8')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0x6f0f=['remove','emit','hasOwnProperty','hook','exports','events','SmsQueue','setMaxListeners'];(function(_0x19d487,_0x5d923f){var _0x43dd67=function(_0x59dc96){while(--_0x59dc96){_0x19d487['push'](_0x19d487['shift']());}};_0x43dd67(++_0x5d923f);}(_0x6f0f,0x185));var _0xf6f0=function(_0x5a7fbc,_0xa081de){_0x5a7fbc=_0x5a7fbc-0x0;var _0xcba0fc=_0x6f0f[_0x5a7fbc];return _0xcba0fc;};'use strict';var EventEmitter=require(_0xf6f0('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0xf6f0('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xf6f0('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xf6f0('0x3')};function emitEvent(_0x149a80){return function(_0xda793d,_0x36b4af,_0x24b189){SmsQueueEvents[_0xf6f0('0x4')](_0x149a80+':'+_0xda793d['id'],_0xda793d);SmsQueueEvents[_0xf6f0('0x4')](_0x149a80,_0xda793d);_0x24b189(null);};}for(var e in events){if(events[_0xf6f0('0x5')](e)){var event=events[e];SmsQueue[_0xf6f0('0x6')](e,emitEvent(event));}}module[_0xf6f0('0x7')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 7d3e8a1..27c0814 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 _0x9c21=['moment','bluebird','request-promise','path','exports','define','SmsQueue','sms_queues','../../config/logger','api'];(function(_0x4f8d61,_0x29eff0){var _0x3bc078=function(_0x4c7203){while(--_0x4c7203){_0x4f8d61['push'](_0x4f8d61['shift']());}};_0x3bc078(++_0x29eff0);}(_0x9c21,0xee));var _0x19c2=function(_0x21c799,_0x174965){_0x21c799=_0x21c799-0x0;var _0x1c50a0=_0x9c21[_0x21c799];return _0x1c50a0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x19c2('0x0'))(_0x19c2('0x1'));var moment=require(_0x19c2('0x2'));var BPromise=require(_0x19c2('0x3'));var rp=require(_0x19c2('0x4'));var fs=require('fs');var path=require(_0x19c2('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsQueue.attributes');module[_0x19c2('0x6')]=function(_0x448226,_0x1965c5){return _0x448226[_0x19c2('0x7')](_0x19c2('0x8'),attributes,{'tableName':_0x19c2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2da=['define','SmsQueue','sms_queues','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes'];(function(_0x337146,_0xeebf1b){var _0x52da63=function(_0x46c9c3){while(--_0x46c9c3){_0x337146['push'](_0x337146['shift']());}};_0x52da63(++_0xeebf1b);}(_0xd2da,0x1ef));var _0xad2d=function(_0xb68772,_0x5253ac){_0xb68772=_0xb68772-0x0;var _0x4189bb=_0xd2da[_0xb68772];return _0x4189bb;};'use strict';var _=require('lodash');var util=require(_0xad2d('0x0'));var logger=require(_0xad2d('0x1'))('api');var moment=require(_0xad2d('0x2'));var BPromise=require(_0xad2d('0x3'));var rp=require(_0xad2d('0x4'));var fs=require('fs');var path=require(_0xad2d('0x5'));var rimraf=require(_0xad2d('0x6'));var config=require(_0xad2d('0x7'));var attributes=require(_0xad2d('0x8'));module['exports']=function(_0x5a5132,_0x20baed){return _0x5a5132[_0xad2d('0x9')](_0xad2d('0xa'),attributes,{'tableName':_0xad2d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index f3e771b..4bd9121 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 _0xc595=['ShowSmsQueue','SmsQueue','find','where','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetSmsQueue','options','raw','attributes','limit','include','map','model'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xc595,0x9c));var _0x5c59=function(_0x4b564f,_0x33648d){_0x4b564f=_0x4b564f-0x0;var _0x586821=_0xc595[_0x4b564f];return _0x586821;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5c59('0x0'));var BPromise=require(_0x5c59('0x1'));var rs=require(_0x5c59('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5c59('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5c59('0x4'))('rpc');var config=require(_0x5c59('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x5c59('0x6')][_0x5c59('0x7')]({'port':0x232a});config[_0x5c59('0x8')]=_[_0x5c59('0x9')](config['redis'],{'host':_0x5c59('0xa'),'port':0x18eb});var socket=require(_0x5c59('0xb'))(new Redis(config['redis']));require(_0x5c59('0xc'))[_0x5c59('0xd')](socket);function respondWithRpcPromise(_0x3d0c2d,_0x29c69d,_0x166bd1){return new BPromise(function(_0x3a75f4,_0x393cf0){return client[_0x5c59('0xe')](_0x3d0c2d,_0x166bd1)[_0x5c59('0xf')](function(_0x1e8888){logger['info'](_0x5c59('0x10'),_0x29c69d,_0x5c59('0x11'));logger[_0x5c59('0x12')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x29c69d,_0x5c59('0x11'),JSON[_0x5c59('0x13')](_0x1e8888));if(_0x1e8888[_0x5c59('0x14')]){if(_0x1e8888[_0x5c59('0x14')][_0x5c59('0x15')]===0x1f4){logger[_0x5c59('0x14')](_0x5c59('0x10'),_0x29c69d,_0x1e8888[_0x5c59('0x14')][_0x5c59('0x16')]);return _0x393cf0(_0x1e8888[_0x5c59('0x14')][_0x5c59('0x16')]);}logger[_0x5c59('0x14')]('SmsQueue,\x20%s,\x20%s',_0x29c69d,_0x1e8888[_0x5c59('0x14')]['message']);return _0x3a75f4(_0x1e8888[_0x5c59('0x14')][_0x5c59('0x16')]);}else{logger[_0x5c59('0x17')](_0x5c59('0x10'),_0x29c69d,'request\x20sent');_0x3a75f4(_0x1e8888[_0x5c59('0x18')][_0x5c59('0x16')]);}})[_0x5c59('0x19')](function(_0x1825f0){logger[_0x5c59('0x14')]('SmsQueue,\x20%s,\x20%s',_0x29c69d,_0x1825f0);_0x393cf0(_0x1825f0);});});}exports[_0x5c59('0x1a')]=function(_0x578528){var _0x1979fc=this;return new Promise(function(_0x4ac658,_0xf239aa){return db['SmsQueue']['findAll']({'raw':_0x578528[_0x5c59('0x1b')]?_0x578528['options'][_0x5c59('0x1c')]===undefined?!![]:![]:!![],'where':_0x578528[_0x5c59('0x1b')]?_0x578528[_0x5c59('0x1b')]['where']||null:null,'attributes':_0x578528[_0x5c59('0x1b')]?_0x578528[_0x5c59('0x1b')][_0x5c59('0x1d')]||null:null,'limit':_0x578528[_0x5c59('0x1b')]?_0x578528[_0x5c59('0x1b')][_0x5c59('0x1e')]||null:null,'include':_0x578528[_0x5c59('0x1b')]?_0x578528[_0x5c59('0x1b')][_0x5c59('0x1f')]?_[_0x5c59('0x20')](_0x578528[_0x5c59('0x1b')][_0x5c59('0x1f')],function(_0x1e2177){return{'model':db[_0x1e2177[_0x5c59('0x21')]],'as':_0x1e2177['as'],'attributes':_0x1e2177[_0x5c59('0x1d')],'include':_0x1e2177[_0x5c59('0x1f')]?_[_0x5c59('0x20')](_0x1e2177[_0x5c59('0x1f')],function(_0x36f4c5){return{'model':db[_0x36f4c5[_0x5c59('0x21')]],'as':_0x36f4c5['as'],'attributes':_0x36f4c5[_0x5c59('0x1d')],'include':_0x36f4c5[_0x5c59('0x1f')]?_[_0x5c59('0x20')](_0x36f4c5[_0x5c59('0x1f')],function(_0x53d9a6){return{'model':db[_0x53d9a6['model']],'as':_0x53d9a6['as'],'attributes':_0x53d9a6[_0x5c59('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xff5880){logger[_0x5c59('0x17')](_0x5c59('0x1a'),_0x578528);logger[_0x5c59('0x12')](_0x5c59('0x1a'),_0x578528,JSON[_0x5c59('0x13')](_0xff5880));_0x4ac658(_0xff5880);})['catch'](function(_0x3e67c7){logger[_0x5c59('0x14')](_0x5c59('0x1a'),_0x3e67c7[_0x5c59('0x16')],_0x578528);_0xf239aa(_0x1979fc['error'](0x1f4,_0x3e67c7['message']));});});};exports[_0x5c59('0x22')]=function(_0x88695c){var _0x2bc33f=this;return new Promise(function(_0x434ae2,_0x425936){return db[_0x5c59('0x23')][_0x5c59('0x24')]({'raw':_0x88695c[_0x5c59('0x1b')]?_0x88695c[_0x5c59('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x88695c['options']?_0x88695c[_0x5c59('0x1b')][_0x5c59('0x25')]||null:null,'attributes':_0x88695c[_0x5c59('0x1b')]?_0x88695c[_0x5c59('0x1b')]['attributes']||null:null,'include':_0x88695c['options']?_0x88695c[_0x5c59('0x1b')][_0x5c59('0x1f')]?_['map'](_0x88695c['options'][_0x5c59('0x1f')],function(_0x3dc3c8){return{'model':db[_0x3dc3c8[_0x5c59('0x21')]],'as':_0x3dc3c8['as'],'attributes':_0x3dc3c8['attributes'],'include':_0x3dc3c8['include']?_[_0x5c59('0x20')](_0x3dc3c8[_0x5c59('0x1f')],function(_0x4d9f1d){return{'model':db[_0x4d9f1d['model']],'as':_0x4d9f1d['as'],'attributes':_0x4d9f1d[_0x5c59('0x1d')],'include':_0x4d9f1d['include']?_['map'](_0x4d9f1d['include'],function(_0xe26b32){return{'model':db[_0xe26b32[_0x5c59('0x21')]],'as':_0xe26b32['as'],'attributes':_0xe26b32[_0x5c59('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b852c){logger[_0x5c59('0x17')](_0x5c59('0x22'),_0x88695c);logger[_0x5c59('0x12')](_0x5c59('0x22'),_0x88695c,JSON['stringify'](_0x3b852c));_0x434ae2(_0x3b852c);})[_0x5c59('0x19')](function(_0x4b03e1){logger[_0x5c59('0x14')]('ShowSmsQueue',_0x4b03e1['message'],_0x88695c);_0x425936(_0x2bc33f[_0x5c59('0x14')](0x1f4,_0x4b03e1['message']));});});}; \ No newline at end of file +var _0x39ef=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetSmsQueue','SmsQueue','options','raw','attributes','limit','include','map','model','catch','ShowSmsQueue','find','where','lodash','moment','randomstring','../../mysqldb'];(function(_0x4d69d1,_0x211712){var _0x4950ad=function(_0x4868b8){while(--_0x4868b8){_0x4d69d1['push'](_0x4d69d1['shift']());}};_0x4950ad(++_0x211712);}(_0x39ef,0x1dc));var _0xf39e=function(_0x3a2749,_0x3c152c){_0x3a2749=_0x3a2749-0x0;var _0x3f18dd=_0x39ef[_0x3a2749];return _0x3f18dd;};'use strict';var _=require(_0xf39e('0x0'));var util=require('util');var moment=require(_0xf39e('0x1'));var BPromise=require('bluebird');var rs=require(_0xf39e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf39e('0x3'))['db'];var utils=require(_0xf39e('0x4'));var logger=require(_0xf39e('0x5'))(_0xf39e('0x6'));var config=require('../../config/environment');var jayson=require(_0xf39e('0x7'));var client=jayson[_0xf39e('0x8')][_0xf39e('0x9')]({'port':0x232a});config[_0xf39e('0xa')]=_[_0xf39e('0xb')](config[_0xf39e('0xa')],{'host':_0xf39e('0xc'),'port':0x18eb});var socket=require(_0xf39e('0xd'))(new Redis(config[_0xf39e('0xa')]));require('./smsQueue.socket')[_0xf39e('0xe')](socket);function respondWithRpcPromise(_0x3b8b51,_0x3a73f6,_0xa04807){return new BPromise(function(_0x356492,_0x22eadf){return client[_0xf39e('0xf')](_0x3b8b51,_0xa04807)[_0xf39e('0x10')](function(_0x213e58){logger[_0xf39e('0x11')](_0xf39e('0x12'),_0x3a73f6,_0xf39e('0x13'));logger[_0xf39e('0x14')](_0xf39e('0x15'),_0x3a73f6,'request\x20sent',JSON[_0xf39e('0x16')](_0x213e58));if(_0x213e58[_0xf39e('0x17')]){if(_0x213e58['error'][_0xf39e('0x18')]===0x1f4){logger[_0xf39e('0x17')](_0xf39e('0x12'),_0x3a73f6,_0x213e58[_0xf39e('0x17')][_0xf39e('0x19')]);return _0x22eadf(_0x213e58[_0xf39e('0x17')][_0xf39e('0x19')]);}logger['error'](_0xf39e('0x12'),_0x3a73f6,_0x213e58[_0xf39e('0x17')]['message']);return _0x356492(_0x213e58['error']['message']);}else{logger[_0xf39e('0x11')](_0xf39e('0x12'),_0x3a73f6,'request\x20sent');_0x356492(_0x213e58[_0xf39e('0x1a')][_0xf39e('0x19')]);}})['catch'](function(_0x3e0e3f){logger['error'](_0xf39e('0x12'),_0x3a73f6,_0x3e0e3f);_0x22eadf(_0x3e0e3f);});});}exports[_0xf39e('0x1b')]=function(_0x50324){var _0x165102=this;return new Promise(function(_0x479647,_0x1213b9){return db[_0xf39e('0x1c')]['findAll']({'raw':_0x50324[_0xf39e('0x1d')]?_0x50324[_0xf39e('0x1d')][_0xf39e('0x1e')]===undefined?!![]:![]:!![],'where':_0x50324[_0xf39e('0x1d')]?_0x50324[_0xf39e('0x1d')]['where']||null:null,'attributes':_0x50324[_0xf39e('0x1d')]?_0x50324[_0xf39e('0x1d')][_0xf39e('0x1f')]||null:null,'limit':_0x50324[_0xf39e('0x1d')]?_0x50324[_0xf39e('0x1d')][_0xf39e('0x20')]||null:null,'include':_0x50324[_0xf39e('0x1d')]?_0x50324[_0xf39e('0x1d')][_0xf39e('0x21')]?_[_0xf39e('0x22')](_0x50324[_0xf39e('0x1d')][_0xf39e('0x21')],function(_0x565fa6){return{'model':db[_0x565fa6['model']],'as':_0x565fa6['as'],'attributes':_0x565fa6['attributes'],'include':_0x565fa6[_0xf39e('0x21')]?_['map'](_0x565fa6[_0xf39e('0x21')],function(_0x16a7f7){return{'model':db[_0x16a7f7[_0xf39e('0x23')]],'as':_0x16a7f7['as'],'attributes':_0x16a7f7[_0xf39e('0x1f')],'include':_0x16a7f7['include']?_[_0xf39e('0x22')](_0x16a7f7[_0xf39e('0x21')],function(_0x29b30d){return{'model':db[_0x29b30d[_0xf39e('0x23')]],'as':_0x29b30d['as'],'attributes':_0x29b30d[_0xf39e('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf39e('0x10')](function(_0x34a937){logger[_0xf39e('0x11')](_0xf39e('0x1b'),_0x50324);logger[_0xf39e('0x14')](_0xf39e('0x1b'),_0x50324,JSON[_0xf39e('0x16')](_0x34a937));_0x479647(_0x34a937);})[_0xf39e('0x24')](function(_0x47b2da){logger['error']('GetSmsQueue',_0x47b2da[_0xf39e('0x19')],_0x50324);_0x1213b9(_0x165102[_0xf39e('0x17')](0x1f4,_0x47b2da['message']));});});};exports[_0xf39e('0x25')]=function(_0x4cd180){var _0x5605d8=this;return new Promise(function(_0x194e0c,_0x2586be){return db[_0xf39e('0x1c')][_0xf39e('0x26')]({'raw':_0x4cd180[_0xf39e('0x1d')]?_0x4cd180[_0xf39e('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x4cd180[_0xf39e('0x1d')]?_0x4cd180[_0xf39e('0x1d')][_0xf39e('0x27')]||null:null,'attributes':_0x4cd180[_0xf39e('0x1d')]?_0x4cd180[_0xf39e('0x1d')][_0xf39e('0x1f')]||null:null,'include':_0x4cd180[_0xf39e('0x1d')]?_0x4cd180[_0xf39e('0x1d')][_0xf39e('0x21')]?_[_0xf39e('0x22')](_0x4cd180['options'][_0xf39e('0x21')],function(_0x350490){return{'model':db[_0x350490['model']],'as':_0x350490['as'],'attributes':_0x350490[_0xf39e('0x1f')],'include':_0x350490['include']?_['map'](_0x350490[_0xf39e('0x21')],function(_0x2eb7fa){return{'model':db[_0x2eb7fa[_0xf39e('0x23')]],'as':_0x2eb7fa['as'],'attributes':_0x2eb7fa[_0xf39e('0x1f')],'include':_0x2eb7fa[_0xf39e('0x21')]?_['map'](_0x2eb7fa['include'],function(_0x22039c){return{'model':db[_0x22039c['model']],'as':_0x22039c['as'],'attributes':_0x22039c[_0xf39e('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf39e('0x10')](function(_0x49a101){logger['info'](_0xf39e('0x25'),_0x4cd180);logger[_0xf39e('0x14')](_0xf39e('0x25'),_0x4cd180,JSON['stringify'](_0x49a101));_0x194e0c(_0x49a101);})['catch'](function(_0x574383){logger[_0xf39e('0x17')](_0xf39e('0x25'),_0x574383['message'],_0x4cd180);_0x2586be(_0x5605d8[_0xf39e('0x17')](0x1f4,_0x574383[_0xf39e('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 0078545..d16fdfb 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 _0xc829=['update','emit','register','length','smsQueue:','./smsQueue.events','save','remove'];(function(_0x591d21,_0xca2016){var _0x2dd074=function(_0x445cba){while(--_0x445cba){_0x591d21['push'](_0x591d21['shift']());}};_0x2dd074(++_0xca2016);}(_0xc829,0x10d));var _0x9c82=function(_0x3c0318,_0x32d5af){_0x3c0318=_0x3c0318-0x0;var _0x193e74=_0xc829[_0x3c0318];return _0x193e74;};'use strict';var SmsQueueEvents=require(_0x9c82('0x0'));var events=[_0x9c82('0x1'),_0x9c82('0x2'),_0x9c82('0x3')];function createListener(_0x38a9c5,_0x48a0be){return function(_0x549e4c){_0x48a0be[_0x9c82('0x4')](_0x38a9c5,_0x549e4c);};}function removeListener(_0x582b6a,_0x44e7b0){return function(){SmsQueueEvents['removeListener'](_0x582b6a,_0x44e7b0);};}exports[_0x9c82('0x5')]=function(_0x6eeba4){for(var _0x2717b8=0x0,_0x594ef3=events[_0x9c82('0x6')];_0x2717b8<_0x594ef3;_0x2717b8++){var _0x28dd63=events[_0x2717b8];var _0x494a84=createListener(_0x9c82('0x7')+_0x28dd63,_0x6eeba4);SmsQueueEvents['on'](_0x28dd63,_0x494a84);}}; \ No newline at end of file +var _0x3f03=['removeListener','register','smsQueue:','save','update'];(function(_0x509cb1,_0x551f69){var _0x48bd69=function(_0x40c72b){while(--_0x40c72b){_0x509cb1['push'](_0x509cb1['shift']());}};_0x48bd69(++_0x551f69);}(_0x3f03,0x1de));var _0x33f0=function(_0x51336d,_0xca8067){_0x51336d=_0x51336d-0x0;var _0x2ac9eb=_0x3f03[_0x51336d];return _0x2ac9eb;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x33f0('0x0'),'remove',_0x33f0('0x1')];function createListener(_0x381762,_0x233441){return function(_0x27a5a2){_0x233441['emit'](_0x381762,_0x27a5a2);};}function removeListener(_0x1fdadf,_0x2b10a0){return function(){SmsQueueEvents[_0x33f0('0x2')](_0x1fdadf,_0x2b10a0);};}exports[_0x33f0('0x3')]=function(_0x4b1492){for(var _0x392620=0x0,_0x7b944c=events['length'];_0x392620<_0x7b944c;_0x392620++){var _0x2049b9=events[_0x392620];var _0x12e90f=createListener(_0x33f0('0x4')+_0x2049b9,_0x4b1492);SmsQueueEvents['on'](_0x2049b9,_0x12e90f);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index aa1de05..49ee1e9 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 _0x2a56=['../../components/auth/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','destroy','util','connect-timeout','express','Router','fs-extra'];(function(_0x38dcfd,_0x527ade){var _0x25c1b7=function(_0x3a581e){while(--_0x3a581e){_0x38dcfd['push'](_0x38dcfd['shift']());}};_0x25c1b7(++_0x527ade);}(_0x2a56,0xaf));var _0x62a5=function(_0x4ed92d,_0x506288){_0x4ed92d=_0x4ed92d-0x0;var _0x1550f6=_0x2a56[_0x4ed92d];return _0x1550f6;};'use strict';var multer=require('multer');var util=require(_0x62a5('0x0'));var path=require('path');var timeout=require(_0x62a5('0x1'));var express=require(_0x62a5('0x2'));var router=express[_0x62a5('0x3')]();var fs_extra=require(_0x62a5('0x4'));var auth=require(_0x62a5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x62a5('0x6'));var controller=require(_0x62a5('0x7'));router[_0x62a5('0x8')]('/',auth[_0x62a5('0x9')](),controller[_0x62a5('0xa')]);router[_0x62a5('0x8')](_0x62a5('0xb'),auth[_0x62a5('0x9')](),controller['describe']);router[_0x62a5('0x8')](_0x62a5('0xc'),auth[_0x62a5('0x9')](),controller[_0x62a5('0xd')]);router[_0x62a5('0xe')]('/',auth['isAuthenticated'](),controller[_0x62a5('0xf')]);router[_0x62a5('0x10')](_0x62a5('0xc'),auth[_0x62a5('0x9')](),controller[_0x62a5('0x11')]);router[_0x62a5('0x12')](_0x62a5('0xc'),auth[_0x62a5('0x9')](),controller[_0x62a5('0x13')]);module['exports']=router; \ No newline at end of file +var _0x0f80=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x2b9847,_0x5b5294){var _0x4e393f=function(_0x5f0d4c){while(--_0x5f0d4c){_0x2b9847['push'](_0x2b9847['shift']());}};_0x4e393f(++_0x5b5294);}(_0x0f80,0x108));var _0x00f8=function(_0x3237aa,_0x52f965){_0x3237aa=_0x3237aa-0x0;var _0x3076c2=_0x0f80[_0x3237aa];return _0x3076c2;};'use strict';var multer=require('multer');var util=require(_0x00f8('0x0'));var path=require(_0x00f8('0x1'));var timeout=require(_0x00f8('0x2'));var express=require(_0x00f8('0x3'));var router=express[_0x00f8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x00f8('0x5'));var interaction=require(_0x00f8('0x6'));var config=require(_0x00f8('0x7'));var controller=require('./smsQueueReport.controller');router[_0x00f8('0x8')]('/',auth[_0x00f8('0x9')](),controller[_0x00f8('0xa')]);router[_0x00f8('0x8')](_0x00f8('0xb'),auth[_0x00f8('0x9')](),controller[_0x00f8('0xc')]);router['get'](_0x00f8('0xd'),auth[_0x00f8('0x9')](),controller[_0x00f8('0xe')]);router['post']('/',auth[_0x00f8('0x9')](),controller[_0x00f8('0xf')]);router[_0x00f8('0x10')](_0x00f8('0xd'),auth[_0x00f8('0x9')](),controller['update']);router['delete'](_0x00f8('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x00f8('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index f273073..2175a12 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 _0x6d4d=['DATE','STRING','moment','exports'];(function(_0x197683,_0x21df72){var _0x137639=function(_0x46b902){while(--_0x46b902){_0x197683['push'](_0x197683['shift']());}};_0x137639(++_0x21df72);}(_0x6d4d,0x86));var _0xd6d4=function(_0x405778,_0xa4dd3b){_0x405778=_0x405778-0x0;var _0x341735=_0x6d4d[_0x405778];return _0x341735;};'use strict';var moment=require(_0xd6d4('0x0'));var Sequelize=require('sequelize');module[_0xd6d4('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xd6d4('0x2')]},'exitAt':{'type':Sequelize[_0xd6d4('0x2')]},'reason':{'type':Sequelize[_0xd6d4('0x3')]}}; \ No newline at end of file +var _0x2b7c=['moment','sequelize','STRING','DATE'];(function(_0x4a9370,_0x34884c){var _0x24ab49=function(_0x2c2bb0){while(--_0x2c2bb0){_0x4a9370['push'](_0x4a9370['shift']());}};_0x24ab49(++_0x34884c);}(_0x2b7c,0x158));var _0xc2b7=function(_0xfbab88,_0x471b25){_0xfbab88=_0xfbab88-0x0;var _0x2f6614=_0x2b7c[_0xfbab88];return _0x2f6614;};'use strict';var moment=require(_0xc2b7('0x0'));var Sequelize=require(_0xc2b7('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xc2b7('0x2')]},'joinAt':{'type':Sequelize[_0xc2b7('0x3')]},'leaveAt':{'type':Sequelize[_0xc2b7('0x3')]},'acceptAt':{'type':Sequelize[_0xc2b7('0x3')]},'exitAt':{'type':Sequelize[_0xc2b7('0x3')]},'reason':{'type':Sequelize[_0xc2b7('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index a7c8039..c98e27f 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 _0xb126=['count','set','Content-Range','apply','reject','destroy','then','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','merge','find','create','update','body','describe','eml-format','rimraf','request-promise','moment','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit'];(function(_0x420513,_0x30eae3){var _0x1b44ec=function(_0x644f88){while(--_0x644f88){_0x420513['push'](_0x420513['shift']());}};_0x1b44ec(++_0x30eae3);}(_0xb126,0x105));var _0x6b12=function(_0x321876,_0x3c61bb){_0x321876=_0x321876-0x0;var _0x337c75=_0xb126[_0x321876];return _0x337c75;};'use strict';var emlformat=require(_0x6b12('0x0'));var rimraf=require(_0x6b12('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6b12('0x2'));var moment=require(_0x6b12('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6b12('0x4'));var util=require(_0x6b12('0x5'));var path=require('path');var sox=require(_0x6b12('0x6'));var csv=require('to-csv');var ejs=require(_0x6b12('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6b12('0x8'));var squel=require(_0x6b12('0x9'));var crypto=require(_0x6b12('0xa'));var jsforce=require(_0x6b12('0xb'));var deskjs=require(_0x6b12('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6b12('0xd'));var authService=require(_0x6b12('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x6b12('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b12('0x10'))(_0x6b12('0x11'));var utils=require(_0x6b12('0x12'));var config=require(_0x6b12('0x13'));var licenseUtil=require(_0x6b12('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x387398,_0x4336e3){_0x4336e3=_0x4336e3||0xcc;return function(_0x4dfa09){if(_0x4dfa09){return _0x387398[_0x6b12('0x15')](_0x4336e3);}return _0x387398['status'](_0x4336e3)[_0x6b12('0x16')]();};}function respondWithResult(_0x549aa8,_0x5ee334){_0x5ee334=_0x5ee334||0xc8;return function(_0x4afbcd){if(_0x4afbcd){return _0x549aa8[_0x6b12('0x17')](_0x5ee334)['json'](_0x4afbcd);}};}function respondWithFilteredResult(_0x398310,_0x2ece69){return function(_0x23e439){if(_0x23e439){var _0x45bc4a=typeof _0x2ece69[_0x6b12('0x18')]===_0x6b12('0x19')&&typeof _0x2ece69[_0x6b12('0x1a')]===_0x6b12('0x19');var _0x4878ba=_0x23e439[_0x6b12('0x1b')];var _0x5f5573=_0x45bc4a?0x0:_0x2ece69[_0x6b12('0x18')];var _0x55f7c9=_0x45bc4a?_0x23e439[_0x6b12('0x1b')]:_0x2ece69[_0x6b12('0x18')]+_0x2ece69['limit'];var _0x29f027;if(_0x55f7c9>=_0x4878ba){_0x55f7c9=_0x4878ba;_0x29f027=0xc8;}else{_0x29f027=0xce;}_0x398310[_0x6b12('0x17')](_0x29f027);return _0x398310[_0x6b12('0x1c')](_0x6b12('0x1d'),_0x5f5573+'-'+_0x55f7c9+'/'+_0x4878ba)['json'](_0x23e439);}return null;};}function patchUpdates(_0x509421){return function(_0x4d9cb7){try{jsonpatch[_0x6b12('0x1e')](_0x4d9cb7,_0x509421,!![]);}catch(_0x2342b5){return BPromise[_0x6b12('0x1f')](_0x2342b5);}return _0x4d9cb7['save']();};}function saveUpdates(_0x127053,_0x494233){return function(_0x2e6424){if(_0x2e6424){return _0x2e6424['update'](_0x127053)['then'](function(_0x1e4d05){return _0x1e4d05;});}return null;};}function removeEntity(_0x30ff25,_0x5aa570){return function(_0xbd7147){if(_0xbd7147){return _0xbd7147[_0x6b12('0x20')]()[_0x6b12('0x21')](function(){_0x30ff25['status'](0xcc)[_0x6b12('0x16')]();});}};}function handleEntityNotFound(_0x1f893c,_0x344033){return function(_0x30a593){if(!_0x30a593){_0x1f893c[_0x6b12('0x15')](0x194);}return _0x30a593;};}function handleError(_0x356c35,_0x2c08f4){_0x2c08f4=_0x2c08f4||0x1f4;return function(_0x585600){logger[_0x6b12('0x22')](_0x585600[_0x6b12('0x23')]);if(_0x585600['name']){delete _0x585600[_0x6b12('0x24')];}_0x356c35[_0x6b12('0x17')](_0x2c08f4)[_0x6b12('0x25')](_0x585600);};}exports[_0x6b12('0x26')]=function(_0x25d5a3,_0x1829b9){var _0x5be5d4={},_0x48ec90={},_0x406e47={'count':0x0,'rows':[]};var _0x2385cc=_[_0x6b12('0x27')](db[_0x6b12('0x28')][_0x6b12('0x29')],function(_0xcd3f6e){return{'name':_0xcd3f6e[_0x6b12('0x2a')],'type':_0xcd3f6e[_0x6b12('0x2b')][_0x6b12('0x2c')]};});_0x48ec90[_0x6b12('0x2d')]=_[_0x6b12('0x27')](_0x2385cc,_0x6b12('0x24'));_0x48ec90[_0x6b12('0x2e')]=_['keys'](_0x25d5a3[_0x6b12('0x2e')]);_0x48ec90['filters']=_[_0x6b12('0x2f')](_0x48ec90[_0x6b12('0x2d')],_0x48ec90[_0x6b12('0x2e')]);_0x5be5d4[_0x6b12('0x30')]=_[_0x6b12('0x2f')](_0x48ec90[_0x6b12('0x2d')],qs['fields'](_0x25d5a3[_0x6b12('0x2e')][_0x6b12('0x31')]));_0x5be5d4['attributes']=_0x5be5d4[_0x6b12('0x30')]['length']?_0x5be5d4[_0x6b12('0x30')]:_0x48ec90[_0x6b12('0x2d')];if(!_0x25d5a3[_0x6b12('0x2e')][_0x6b12('0x32')](_0x6b12('0x33'))){_0x5be5d4[_0x6b12('0x1a')]=qs[_0x6b12('0x1a')](_0x25d5a3[_0x6b12('0x2e')][_0x6b12('0x1a')]);_0x5be5d4[_0x6b12('0x18')]=qs['offset'](_0x25d5a3[_0x6b12('0x2e')][_0x6b12('0x18')]);}_0x5be5d4['order']=qs[_0x6b12('0x34')](_0x25d5a3['query'][_0x6b12('0x34')]);_0x5be5d4[_0x6b12('0x35')]=qs['filters'](_[_0x6b12('0x36')](_0x25d5a3[_0x6b12('0x2e')],_0x48ec90[_0x6b12('0x37')]),_0x2385cc);if(_0x25d5a3[_0x6b12('0x2e')][_0x6b12('0x38')]){_0x5be5d4[_0x6b12('0x35')]=_['merge'](_0x5be5d4['where'],{'$or':_[_0x6b12('0x27')](_0x2385cc,function(_0x229558){if(_0x229558['type']!==_0x6b12('0x39')){var _0x275a50={};_0x275a50[_0x229558[_0x6b12('0x24')]]={'$like':'%'+_0x25d5a3[_0x6b12('0x2e')][_0x6b12('0x38')]+'%'};return _0x275a50;}})});}_0x5be5d4=_['merge']({},_0x5be5d4,_0x25d5a3[_0x6b12('0x3a')]);var _0x21524d={'where':_0x5be5d4['where']};return db[_0x6b12('0x28')][_0x6b12('0x1b')](_0x21524d)[_0x6b12('0x21')](function(_0x47a217){_0x406e47[_0x6b12('0x1b')]=_0x47a217;if(_0x25d5a3[_0x6b12('0x2e')][_0x6b12('0x3b')]){_0x5be5d4[_0x6b12('0x3c')]=[{'all':!![]}];}return db[_0x6b12('0x28')]['findAll'](_0x5be5d4);})[_0x6b12('0x21')](function(_0x5e56f2){_0x406e47[_0x6b12('0x3d')]=_0x5e56f2;return _0x406e47;})[_0x6b12('0x21')](respondWithFilteredResult(_0x1829b9,_0x5be5d4))[_0x6b12('0x3e')](handleError(_0x1829b9,null));};exports[_0x6b12('0x3f')]=function(_0x5dca1b,_0x31f737){var _0x1c96c8={'raw':!![],'where':{'id':_0x5dca1b[_0x6b12('0x40')]['id']}},_0x4950c8={};_0x4950c8[_0x6b12('0x2d')]=_[_0x6b12('0x41')](db[_0x6b12('0x28')][_0x6b12('0x29')]);_0x4950c8['query']=_[_0x6b12('0x41')](_0x5dca1b[_0x6b12('0x2e')]);_0x4950c8[_0x6b12('0x37')]=_['intersection'](_0x4950c8[_0x6b12('0x2d')],_0x4950c8[_0x6b12('0x2e')]);_0x1c96c8['attributes']=_[_0x6b12('0x2f')](_0x4950c8['model'],qs[_0x6b12('0x31')](_0x5dca1b[_0x6b12('0x2e')][_0x6b12('0x31')]));_0x1c96c8['attributes']=_0x1c96c8[_0x6b12('0x30')]['length']?_0x1c96c8[_0x6b12('0x30')]:_0x4950c8[_0x6b12('0x2d')];if(_0x5dca1b[_0x6b12('0x2e')][_0x6b12('0x3b')]){_0x1c96c8['include']=[{'all':!![]}];}_0x1c96c8=_[_0x6b12('0x42')]({},_0x1c96c8,_0x5dca1b['options']);return db[_0x6b12('0x28')][_0x6b12('0x43')](_0x1c96c8)[_0x6b12('0x21')](handleEntityNotFound(_0x31f737,null))['then'](respondWithResult(_0x31f737,null))[_0x6b12('0x3e')](handleError(_0x31f737,null));};exports['create']=function(_0x4e8fff,_0x3c4904){return db[_0x6b12('0x28')][_0x6b12('0x44')](_0x4e8fff['body'],{})[_0x6b12('0x21')](respondWithResult(_0x3c4904,0xc9))[_0x6b12('0x3e')](handleError(_0x3c4904,null));};exports[_0x6b12('0x45')]=function(_0x371f68,_0x5ef6bc){if(_0x371f68[_0x6b12('0x46')]['id']){delete _0x371f68['body']['id'];}return db[_0x6b12('0x28')][_0x6b12('0x43')]({'where':{'id':_0x371f68[_0x6b12('0x40')]['id']}})[_0x6b12('0x21')](handleEntityNotFound(_0x5ef6bc,null))[_0x6b12('0x21')](saveUpdates(_0x371f68['body'],null))[_0x6b12('0x21')](respondWithResult(_0x5ef6bc,null))[_0x6b12('0x3e')](handleError(_0x5ef6bc,null));};exports[_0x6b12('0x20')]=function(_0x591a55,_0x3358ee){return db['SmsQueueReport'][_0x6b12('0x43')]({'where':{'id':_0x591a55[_0x6b12('0x40')]['id']}})[_0x6b12('0x21')](handleEntityNotFound(_0x3358ee,null))[_0x6b12('0x21')](removeEntity(_0x3358ee,null))[_0x6b12('0x3e')](handleError(_0x3358ee,null));};exports[_0x6b12('0x47')]=function(_0x2a0206,_0x2aeada){return db[_0x6b12('0x28')][_0x6b12('0x47')]()[_0x6b12('0x21')](respondWithResult(_0x2aeada,null))[_0x6b12('0x3e')](handleError(_0x2aeada,null));}; \ No newline at end of file +var _0x9031=['jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','end','sendStatus','error','stack','name','send','index','map','SmsQueueReport','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','include','findAll','catch','show','params','length','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','lodash','crypto'];(function(_0x202d81,_0x5a8425){var _0x5e52c5=function(_0x1de625){while(--_0x1de625){_0x202d81['push'](_0x202d81['shift']());}};_0x5e52c5(++_0x5a8425);}(_0x9031,0x82));var _0x1903=function(_0x6dc0b9,_0x33a742){_0x6dc0b9=_0x6dc0b9-0x0;var _0x352661=_0x9031[_0x6dc0b9];return _0x352661;};'use strict';var emlformat=require(_0x1903('0x0'));var rimraf=require(_0x1903('0x1'));var zipdir=require(_0x1903('0x2'));var jsonpatch=require(_0x1903('0x3'));var rp=require(_0x1903('0x4'));var moment=require('moment');var BPromise=require(_0x1903('0x5'));var Mustache=require('mustache');var util=require(_0x1903('0x6'));var path=require('path');var sox=require(_0x1903('0x7'));var csv=require(_0x1903('0x8'));var ejs=require(_0x1903('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1903('0xa'));var squel=require('squel');var crypto=require(_0x1903('0xb'));var jsforce=require(_0x1903('0xc'));var deskjs=require(_0x1903('0xd'));var toCsv=require(_0x1903('0x8'));var querystring=require(_0x1903('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1903('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1903('0x10'));var logger=require(_0x1903('0x11'))(_0x1903('0x12'));var utils=require(_0x1903('0x13'));var config=require(_0x1903('0x14'));var licenseUtil=require(_0x1903('0x15'));var db=require(_0x1903('0x16'))['db'];function respondWithStatusCode(_0x5c9e9f,_0x5c61ec){_0x5c61ec=_0x5c61ec||0xcc;return function(_0x35cdf5){if(_0x35cdf5){return _0x5c9e9f['sendStatus'](_0x5c61ec);}return _0x5c9e9f[_0x1903('0x17')](_0x5c61ec)['end']();};}function respondWithResult(_0xd023b6,_0x583461){_0x583461=_0x583461||0xc8;return function(_0x59726d){if(_0x59726d){return _0xd023b6[_0x1903('0x17')](_0x583461)[_0x1903('0x18')](_0x59726d);}};}function respondWithFilteredResult(_0x426807,_0x565118){return function(_0x10c7c7){if(_0x10c7c7){var _0x1f10ee=typeof _0x565118[_0x1903('0x19')]===_0x1903('0x1a')&&typeof _0x565118[_0x1903('0x1b')]===_0x1903('0x1a');var _0x289431=_0x10c7c7['count'];var _0x285f98=_0x1f10ee?0x0:_0x565118['offset'];var _0x8f93d6=_0x1f10ee?_0x10c7c7[_0x1903('0x1c')]:_0x565118[_0x1903('0x19')]+_0x565118[_0x1903('0x1b')];var _0x3ba4de;if(_0x8f93d6>=_0x289431){_0x8f93d6=_0x289431;_0x3ba4de=0xc8;}else{_0x3ba4de=0xce;}_0x426807[_0x1903('0x17')](_0x3ba4de);return _0x426807[_0x1903('0x1d')](_0x1903('0x1e'),_0x285f98+'-'+_0x8f93d6+'/'+_0x289431)['json'](_0x10c7c7);}return null;};}function patchUpdates(_0x179bc9){return function(_0x46e7f9){try{jsonpatch[_0x1903('0x1f')](_0x46e7f9,_0x179bc9,!![]);}catch(_0x3428af){return BPromise[_0x1903('0x20')](_0x3428af);}return _0x46e7f9['save']();};}function saveUpdates(_0x18f8c6,_0x33effc){return function(_0x4f6a4f){if(_0x4f6a4f){return _0x4f6a4f[_0x1903('0x21')](_0x18f8c6)[_0x1903('0x22')](function(_0x51bc5b){return _0x51bc5b;});}return null;};}function removeEntity(_0xba35df,_0x4f3277){return function(_0x4df6b6){if(_0x4df6b6){return _0x4df6b6['destroy']()[_0x1903('0x22')](function(){_0xba35df[_0x1903('0x17')](0xcc)[_0x1903('0x23')]();});}};}function handleEntityNotFound(_0x4a8b77,_0x36cf09){return function(_0x384b2f){if(!_0x384b2f){_0x4a8b77[_0x1903('0x24')](0x194);}return _0x384b2f;};}function handleError(_0x3d8aeb,_0x34c331){_0x34c331=_0x34c331||0x1f4;return function(_0x551d52){logger[_0x1903('0x25')](_0x551d52[_0x1903('0x26')]);if(_0x551d52[_0x1903('0x27')]){delete _0x551d52[_0x1903('0x27')];}_0x3d8aeb[_0x1903('0x17')](_0x34c331)[_0x1903('0x28')](_0x551d52);};}exports[_0x1903('0x29')]=function(_0x5ac1d6,_0xaf86ee){var _0x56e0a4={},_0x4be961={},_0x5a2364={'count':0x0,'rows':[]};var _0x9c5935=_[_0x1903('0x2a')](db[_0x1903('0x2b')]['rawAttributes'],function(_0xb5e391){return{'name':_0xb5e391['fieldName'],'type':_0xb5e391[_0x1903('0x2c')]['key']};});_0x4be961[_0x1903('0x2d')]=_[_0x1903('0x2a')](_0x9c5935,_0x1903('0x27'));_0x4be961['query']=_[_0x1903('0x2e')](_0x5ac1d6[_0x1903('0x2f')]);_0x4be961[_0x1903('0x30')]=_[_0x1903('0x31')](_0x4be961['model'],_0x4be961['query']);_0x56e0a4[_0x1903('0x32')]=_['intersection'](_0x4be961[_0x1903('0x2d')],qs[_0x1903('0x33')](_0x5ac1d6[_0x1903('0x2f')]['fields']));_0x56e0a4[_0x1903('0x32')]=_0x56e0a4['attributes']['length']?_0x56e0a4[_0x1903('0x32')]:_0x4be961[_0x1903('0x2d')];if(!_0x5ac1d6[_0x1903('0x2f')][_0x1903('0x34')](_0x1903('0x35'))){_0x56e0a4[_0x1903('0x1b')]=qs[_0x1903('0x1b')](_0x5ac1d6['query'][_0x1903('0x1b')]);_0x56e0a4['offset']=qs[_0x1903('0x19')](_0x5ac1d6[_0x1903('0x2f')]['offset']);}_0x56e0a4['order']=qs[_0x1903('0x36')](_0x5ac1d6[_0x1903('0x2f')][_0x1903('0x36')]);_0x56e0a4[_0x1903('0x37')]=qs[_0x1903('0x30')](_['pick'](_0x5ac1d6[_0x1903('0x2f')],_0x4be961[_0x1903('0x30')]),_0x9c5935);if(_0x5ac1d6['query'][_0x1903('0x38')]){_0x56e0a4['where']=_['merge'](_0x56e0a4['where'],{'$or':_[_0x1903('0x2a')](_0x9c5935,function(_0x1a36a7){if(_0x1a36a7[_0x1903('0x2c')]!=='VIRTUAL'){var _0xa7db56={};_0xa7db56[_0x1a36a7[_0x1903('0x27')]]={'$like':'%'+_0x5ac1d6[_0x1903('0x2f')][_0x1903('0x38')]+'%'};return _0xa7db56;}})});}_0x56e0a4=_[_0x1903('0x39')]({},_0x56e0a4,_0x5ac1d6[_0x1903('0x3a')]);var _0x4d19d7={'where':_0x56e0a4[_0x1903('0x37')]};return db[_0x1903('0x2b')][_0x1903('0x1c')](_0x4d19d7)[_0x1903('0x22')](function(_0x2e4be0){_0x5a2364['count']=_0x2e4be0;if(_0x5ac1d6[_0x1903('0x2f')][_0x1903('0x3b')]){_0x56e0a4[_0x1903('0x3c')]=[{'all':!![]}];}return db['SmsQueueReport'][_0x1903('0x3d')](_0x56e0a4);})['then'](function(_0x3c3123){_0x5a2364['rows']=_0x3c3123;return _0x5a2364;})['then'](respondWithFilteredResult(_0xaf86ee,_0x56e0a4))[_0x1903('0x3e')](handleError(_0xaf86ee,null));};exports[_0x1903('0x3f')]=function(_0x41af0a,_0x3c16b6){var _0x236c3b={'raw':!![],'where':{'id':_0x41af0a[_0x1903('0x40')]['id']}},_0x3c0109={};_0x3c0109[_0x1903('0x2d')]=_[_0x1903('0x2e')](db[_0x1903('0x2b')]['rawAttributes']);_0x3c0109[_0x1903('0x2f')]=_[_0x1903('0x2e')](_0x41af0a[_0x1903('0x2f')]);_0x3c0109[_0x1903('0x30')]=_['intersection'](_0x3c0109['model'],_0x3c0109[_0x1903('0x2f')]);_0x236c3b[_0x1903('0x32')]=_[_0x1903('0x31')](_0x3c0109['model'],qs['fields'](_0x41af0a[_0x1903('0x2f')][_0x1903('0x33')]));_0x236c3b[_0x1903('0x32')]=_0x236c3b['attributes'][_0x1903('0x41')]?_0x236c3b[_0x1903('0x32')]:_0x3c0109[_0x1903('0x2d')];if(_0x41af0a[_0x1903('0x2f')][_0x1903('0x3b')]){_0x236c3b[_0x1903('0x3c')]=[{'all':!![]}];}_0x236c3b=_[_0x1903('0x39')]({},_0x236c3b,_0x41af0a[_0x1903('0x3a')]);return db[_0x1903('0x2b')][_0x1903('0x42')](_0x236c3b)['then'](handleEntityNotFound(_0x3c16b6,null))[_0x1903('0x22')](respondWithResult(_0x3c16b6,null))[_0x1903('0x3e')](handleError(_0x3c16b6,null));};exports[_0x1903('0x43')]=function(_0x1707e4,_0x541e47){return db[_0x1903('0x2b')][_0x1903('0x43')](_0x1707e4['body'],{})[_0x1903('0x22')](respondWithResult(_0x541e47,0xc9))[_0x1903('0x3e')](handleError(_0x541e47,null));};exports[_0x1903('0x21')]=function(_0x34aaa4,_0x2e10d9){if(_0x34aaa4[_0x1903('0x44')]['id']){delete _0x34aaa4[_0x1903('0x44')]['id'];}return db['SmsQueueReport'][_0x1903('0x42')]({'where':{'id':_0x34aaa4[_0x1903('0x40')]['id']}})[_0x1903('0x22')](handleEntityNotFound(_0x2e10d9,null))[_0x1903('0x22')](saveUpdates(_0x34aaa4['body'],null))[_0x1903('0x22')](respondWithResult(_0x2e10d9,null))[_0x1903('0x3e')](handleError(_0x2e10d9,null));};exports[_0x1903('0x45')]=function(_0x599c88,_0x20db69){return db[_0x1903('0x2b')][_0x1903('0x42')]({'where':{'id':_0x599c88[_0x1903('0x40')]['id']}})['then'](handleEntityNotFound(_0x20db69,null))[_0x1903('0x22')](removeEntity(_0x20db69,null))[_0x1903('0x3e')](handleError(_0x20db69,null));};exports[_0x1903('0x46')]=function(_0x5baa1b,_0x4bab42){return db[_0x1903('0x2b')][_0x1903('0x46')]()[_0x1903('0x22')](respondWithResult(_0x4bab42,null))[_0x1903('0x3e')](handleError(_0x4bab42,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 206ca53..12cffd4 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(_0x309be0,_0x5704f3){var _0x324e18=function(_0x144a65){while(--_0x144a65){_0x309be0['push'](_0x309be0['shift']());}};_0x324e18(++_0x5704f3);}(_0xe706,0xa3));var _0x6e70=function(_0x3a7bdf,_0x58bdd8){_0x3a7bdf=_0x3a7bdf-0x0;var _0x35a9a8=_0xe706[_0x3a7bdf];return _0x35a9a8;};'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 _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x37ba57,_0x4c0c76){var _0x4df6b5=function(_0x1801f7){while(--_0x1801f7){_0x37ba57['push'](_0x37ba57['shift']());}};_0x4df6b5(++_0x4c0c76);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 6b2305f..2719e21 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 _0xccd9=['catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','then','debug','raw','where','attributes','limit','UpdateSmsQueueReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x60782,_0x49a7cc){var _0x2cc911=function(_0x1db7c8){while(--_0x1db7c8){_0x60782['push'](_0x60782['shift']());}};_0x2cc911(++_0x49a7cc);}(_0xccd9,0xb7));var _0x9ccd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xccd9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9ccd('0x0'));var util=require(_0x9ccd('0x1'));var moment=require(_0x9ccd('0x2'));var BPromise=require('bluebird');var rs=require(_0x9ccd('0x3'));var fs=require('fs');var Redis=require(_0x9ccd('0x4'));var db=require(_0x9ccd('0x5'))['db'];var utils=require(_0x9ccd('0x6'));var logger=require(_0x9ccd('0x7'))(_0x9ccd('0x8'));var config=require(_0x9ccd('0x9'));var jayson=require(_0x9ccd('0xa'));var client=jayson['client'][_0x9ccd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x65cefb,_0x47be35,_0x53108e){return new BPromise(function(_0x3e25e9,_0x23a349){return client[_0x9ccd('0xc')](_0x65cefb,_0x53108e)['then'](function(_0x280939){logger[_0x9ccd('0xd')](_0x9ccd('0xe'),_0x47be35,_0x9ccd('0xf'));logger['debug']('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x47be35,_0x9ccd('0xf'),JSON[_0x9ccd('0x10')](_0x280939));if(_0x280939[_0x9ccd('0x11')]){if(_0x280939[_0x9ccd('0x11')][_0x9ccd('0x12')]===0x1f4){logger[_0x9ccd('0x11')](_0x9ccd('0xe'),_0x47be35,_0x280939[_0x9ccd('0x11')][_0x9ccd('0x13')]);return _0x23a349(_0x280939[_0x9ccd('0x11')]['message']);}logger[_0x9ccd('0x11')](_0x9ccd('0xe'),_0x47be35,_0x280939['error'][_0x9ccd('0x13')]);return _0x3e25e9(_0x280939['error'][_0x9ccd('0x13')]);}else{logger[_0x9ccd('0xd')](_0x9ccd('0xe'),_0x47be35,'request\x20sent');_0x3e25e9(_0x280939[_0x9ccd('0x14')][_0x9ccd('0x13')]);}})[_0x9ccd('0x15')](function(_0x63254){logger['error'](_0x9ccd('0xe'),_0x47be35,_0x63254);_0x23a349(_0x63254);});});}exports[_0x9ccd('0x16')]=function(_0x4bb260){var _0x41b80c=this;return new Promise(function(_0x46db0c,_0x87f0e){return db[_0x9ccd('0x17')][_0x9ccd('0x18')](_0x4bb260[_0x9ccd('0x19')],{'raw':_0x4bb260[_0x9ccd('0x1a')]?_0x4bb260[_0x9ccd('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x9ccd('0x1b')](function(_0x836652){logger[_0x9ccd('0xd')](_0x9ccd('0x16'),_0x4bb260);logger[_0x9ccd('0x1c')](_0x9ccd('0x16'),_0x4bb260,JSON['stringify'](_0x836652));_0x46db0c(_0x836652);})[_0x9ccd('0x15')](function(_0x11f372){logger[_0x9ccd('0x11')](_0x9ccd('0x16'),_0x11f372['message'],_0x4bb260);_0x87f0e(_0x41b80c[_0x9ccd('0x11')](0x1f4,_0x11f372[_0x9ccd('0x13')]));});});};exports['UpdateSmsQueueReport']=function(_0x25f0c8){var _0x7d9263=this;return new Promise(function(_0x41c5fa,_0x467638){return db[_0x9ccd('0x17')]['update'](_0x25f0c8[_0x9ccd('0x19')],{'raw':_0x25f0c8['options']?_0x25f0c8[_0x9ccd('0x1a')][_0x9ccd('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25f0c8[_0x9ccd('0x1a')]?_0x25f0c8['options'][_0x9ccd('0x1e')]||null:null,'attributes':_0x25f0c8[_0x9ccd('0x1a')]?_0x25f0c8[_0x9ccd('0x1a')][_0x9ccd('0x1f')]||null:null,'limit':_0x25f0c8['options']?_0x25f0c8['options'][_0x9ccd('0x20')]||null:null})[_0x9ccd('0x1b')](function(_0x4c6c06){logger[_0x9ccd('0xd')](_0x9ccd('0x21'),_0x25f0c8);logger['debug'](_0x9ccd('0x21'),_0x25f0c8,JSON[_0x9ccd('0x10')](_0x4c6c06));_0x41c5fa(_0x4c6c06);})[_0x9ccd('0x15')](function(_0x3aa404){logger['error']('UpdateSmsQueueReport',_0x3aa404[_0x9ccd('0x13')],_0x25f0c8);_0x467638(_0x7d9263[_0x9ccd('0x11')](0x1f4,_0x3aa404[_0x9ccd('0x13')]));});});}; \ No newline at end of file +var _0xb1c4=['request','then','info','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsQueueReport,\x20%s,\x20%s','result','catch','CreateSmsQueueReport','SmsQueueReport','create','options','raw','UpdateSmsQueueReport','update','body','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x408e38,_0x23cda8){var _0x426b0e=function(_0x8f2898){while(--_0x8f2898){_0x408e38['push'](_0x408e38['shift']());}};_0x426b0e(++_0x23cda8);}(_0xb1c4,0x19b));var _0x4b1c=function(_0x264d38,_0x37a005){_0x264d38=_0x264d38-0x0;var _0x33cc1b=_0xb1c4[_0x264d38];return _0x33cc1b;};'use strict';var _=require(_0x4b1c('0x0'));var util=require(_0x4b1c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4b1c('0x2'));var db=require(_0x4b1c('0x3'))['db'];var utils=require(_0x4b1c('0x4'));var logger=require(_0x4b1c('0x5'))(_0x4b1c('0x6'));var config=require('../../config/environment');var jayson=require(_0x4b1c('0x7'));var client=jayson[_0x4b1c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c65d3,_0x47f596,_0x4204d6){return new BPromise(function(_0x3e77f5,_0x4d4a06){return client[_0x4b1c('0x9')](_0x3c65d3,_0x4204d6)[_0x4b1c('0xa')](function(_0x38dd26){logger[_0x4b1c('0xb')]('SmsQueueReport,\x20%s,\x20%s',_0x47f596,_0x4b1c('0xc'));logger[_0x4b1c('0xd')](_0x4b1c('0xe'),_0x47f596,_0x4b1c('0xc'),JSON[_0x4b1c('0xf')](_0x38dd26));if(_0x38dd26[_0x4b1c('0x10')]){if(_0x38dd26[_0x4b1c('0x10')][_0x4b1c('0x11')]===0x1f4){logger[_0x4b1c('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x47f596,_0x38dd26['error'][_0x4b1c('0x12')]);return _0x4d4a06(_0x38dd26['error']['message']);}logger[_0x4b1c('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x47f596,_0x38dd26['error'][_0x4b1c('0x12')]);return _0x3e77f5(_0x38dd26[_0x4b1c('0x10')][_0x4b1c('0x12')]);}else{logger[_0x4b1c('0xb')](_0x4b1c('0x13'),_0x47f596,_0x4b1c('0xc'));_0x3e77f5(_0x38dd26[_0x4b1c('0x14')][_0x4b1c('0x12')]);}})[_0x4b1c('0x15')](function(_0x14ac36){logger[_0x4b1c('0x10')](_0x4b1c('0x13'),_0x47f596,_0x14ac36);_0x4d4a06(_0x14ac36);});});}exports[_0x4b1c('0x16')]=function(_0x2bc2fb){var _0x1a6fea=this;return new Promise(function(_0x57b66f,_0x2eb049){return db[_0x4b1c('0x17')][_0x4b1c('0x18')](_0x2bc2fb['body'],{'raw':_0x2bc2fb[_0x4b1c('0x19')]?_0x2bc2fb[_0x4b1c('0x19')][_0x4b1c('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x576db2){logger[_0x4b1c('0xb')](_0x4b1c('0x16'),_0x2bc2fb);logger['debug'](_0x4b1c('0x16'),_0x2bc2fb,JSON[_0x4b1c('0xf')](_0x576db2));_0x57b66f(_0x576db2);})[_0x4b1c('0x15')](function(_0x2af678){logger['error'](_0x4b1c('0x16'),_0x2af678[_0x4b1c('0x12')],_0x2bc2fb);_0x2eb049(_0x1a6fea['error'](0x1f4,_0x2af678[_0x4b1c('0x12')]));});});};exports[_0x4b1c('0x1b')]=function(_0x210741){var _0x581281=this;return new Promise(function(_0x14cc70,_0xd387fe){return db[_0x4b1c('0x17')][_0x4b1c('0x1c')](_0x210741[_0x4b1c('0x1d')],{'raw':_0x210741[_0x4b1c('0x19')]?_0x210741['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x210741['options']?_0x210741[_0x4b1c('0x19')]['where']||null:null,'attributes':_0x210741[_0x4b1c('0x19')]?_0x210741['options']['attributes']||null:null,'limit':_0x210741[_0x4b1c('0x19')]?_0x210741[_0x4b1c('0x19')]['limit']||null:null})['then'](function(_0x563385){logger[_0x4b1c('0xb')](_0x4b1c('0x1b'),_0x210741);logger[_0x4b1c('0xd')](_0x4b1c('0x1b'),_0x210741,JSON['stringify'](_0x563385));_0x14cc70(_0x563385);})['catch'](function(_0x6ea4fa){logger[_0x4b1c('0x10')](_0x4b1c('0x1b'),_0x6ea4fa['message'],_0x210741);_0xd387fe(_0x581281['error'](0x1f4,_0x6ea4fa[_0x4b1c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 83d7b4a..34caaa0 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 _0xa9b1=['exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','destroy'];(function(_0x31b9cf,_0x1a809b){var _0x357b8a=function(_0x50a273){while(--_0x50a273){_0x31b9cf['push'](_0x31b9cf['shift']());}};_0x357b8a(++_0x1a809b);}(_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 +var _0xab86=['../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x5516c7,_0x3d46e4){var _0x314076=function(_0x3e3b38){while(--_0x3e3b38){_0x5516c7['push'](_0x5516c7['shift']());}};_0x314076(++_0x3d46e4);}(_0xab86,0x13e));var _0x6ab8=function(_0x5b8566,_0x552979){_0x5b8566=_0x5b8566-0x0;var _0x1da4cf=_0xab86[_0x5b8566];return _0x1da4cf;};'use strict';var multer=require(_0x6ab8('0x0'));var util=require(_0x6ab8('0x1'));var path=require(_0x6ab8('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6ab8('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6ab8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6ab8('0x5'));var controller=require(_0x6ab8('0x6'));router[_0x6ab8('0x7')]('/',auth[_0x6ab8('0x8')](),controller[_0x6ab8('0x9')]);router[_0x6ab8('0x7')](_0x6ab8('0xa'),auth[_0x6ab8('0x8')](),controller[_0x6ab8('0xb')]);router[_0x6ab8('0x7')](_0x6ab8('0xc'),auth[_0x6ab8('0x8')](),controller[_0x6ab8('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6ab8('0xe')]);router['put'](_0x6ab8('0xc'),auth[_0x6ab8('0x8')](),controller[_0x6ab8('0xf')]);router['delete'](_0x6ab8('0xc'),auth[_0x6ab8('0x8')](),controller['destroy']);module[_0x6ab8('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 81f4fdd..89a1f11 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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x58c608,_0x16f6df){var _0x4fb8aa=function(_0xcc6b8d){while(--_0xcc6b8d){_0x58c608['push'](_0x58c608['shift']());}};_0x4fb8aa(++_0x16f6df);}(_0x9c44,0x178));var _0x49c4=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9c44[_0x53ccf2];return _0x5a2964;};'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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x2c0fd2,_0x21f4b9){var _0x38a1d8=function(_0x38f51d){while(--_0x38f51d){_0x2c0fd2['push'](_0x2c0fd2['shift']());}};_0x38a1d8(++_0x21f4b9);}(_0x9c44,0x178));var _0x49c4=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x9c44[_0x2b7764];return _0x848dcb;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index a35792b..632c858 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 _0x5bac=['rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','SmsTransferReport','findAll','rows','catch','show','params','find','create','body','describe','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','reject','save','update','then','destroy','error','stack','name','send','index'];(function(_0x530245,_0x1541ab){var _0x22506d=function(_0x395400){while(--_0x395400){_0x530245['push'](_0x530245['shift']());}};_0x22506d(++_0x1541ab);}(_0x5bac,0x6c));var _0xc5ba=function(_0x349914,_0xfb52b9){_0x349914=_0x349914-0x0;var _0x37c0f1=_0x5bac[_0x349914];return _0x37c0f1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc5ba('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc5ba('0x1'));var moment=require(_0xc5ba('0x2'));var BPromise=require(_0xc5ba('0x3'));var Mustache=require(_0xc5ba('0x4'));var util=require(_0xc5ba('0x5'));var path=require(_0xc5ba('0x6'));var sox=require(_0xc5ba('0x7'));var csv=require(_0xc5ba('0x8'));var ejs=require(_0xc5ba('0x9'));var fs=require('fs');var fs_extra=require(_0xc5ba('0xa'));var _=require('lodash');var squel=require(_0xc5ba('0xb'));var crypto=require(_0xc5ba('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc5ba('0x8'));var querystring=require(_0xc5ba('0xd'));var Papa=require(_0xc5ba('0xe'));var Redis=require(_0xc5ba('0xf'));var authService=require(_0xc5ba('0x10'));var qs=require(_0xc5ba('0x11'));var as=require(_0xc5ba('0x12'));var hardwareService=require(_0xc5ba('0x13'));var logger=require(_0xc5ba('0x14'))(_0xc5ba('0x15'));var utils=require(_0xc5ba('0x16'));var config=require(_0xc5ba('0x17'));var licenseUtil=require(_0xc5ba('0x18'));var db=require(_0xc5ba('0x19'))['db'];function respondWithStatusCode(_0x13d964,_0x3e5e86){_0x3e5e86=_0x3e5e86||0xcc;return function(_0x50a14a){if(_0x50a14a){return _0x13d964[_0xc5ba('0x1a')](_0x3e5e86);}return _0x13d964[_0xc5ba('0x1b')](_0x3e5e86)[_0xc5ba('0x1c')]();};}function respondWithResult(_0x47449d,_0x483037){_0x483037=_0x483037||0xc8;return function(_0x23d70c){if(_0x23d70c){return _0x47449d[_0xc5ba('0x1b')](_0x483037)[_0xc5ba('0x1d')](_0x23d70c);}};}function respondWithFilteredResult(_0x5c37e5,_0x36ab0e){return function(_0x32e040){if(_0x32e040){var _0x8fe95a=typeof _0x36ab0e['offset']==='undefined'&&typeof _0x36ab0e['limit']===_0xc5ba('0x1e');var _0x309621=_0x32e040['count'];var _0x4f3995=_0x8fe95a?0x0:_0x36ab0e[_0xc5ba('0x1f')];var _0x2de556=_0x8fe95a?_0x32e040[_0xc5ba('0x20')]:_0x36ab0e[_0xc5ba('0x1f')]+_0x36ab0e[_0xc5ba('0x21')];var _0x330e5a;if(_0x2de556>=_0x309621){_0x2de556=_0x309621;_0x330e5a=0xc8;}else{_0x330e5a=0xce;}_0x5c37e5[_0xc5ba('0x1b')](_0x330e5a);return _0x5c37e5['set']('Content-Range',_0x4f3995+'-'+_0x2de556+'/'+_0x309621)[_0xc5ba('0x1d')](_0x32e040);}return null;};}function patchUpdates(_0x3d89a4){return function(_0xde1ec3){try{jsonpatch['apply'](_0xde1ec3,_0x3d89a4,!![]);}catch(_0x544b00){return BPromise[_0xc5ba('0x22')](_0x544b00);}return _0xde1ec3[_0xc5ba('0x23')]();};}function saveUpdates(_0x26d73e,_0x14708e){return function(_0x49b6f4){if(_0x49b6f4){return _0x49b6f4[_0xc5ba('0x24')](_0x26d73e)[_0xc5ba('0x25')](function(_0x172283){return _0x172283;});}return null;};}function removeEntity(_0x509475,_0x5001df){return function(_0x718f19){if(_0x718f19){return _0x718f19[_0xc5ba('0x26')]()[_0xc5ba('0x25')](function(){_0x509475[_0xc5ba('0x1b')](0xcc)[_0xc5ba('0x1c')]();});}};}function handleEntityNotFound(_0x2726f3,_0x3dde8e){return function(_0x38930c){if(!_0x38930c){_0x2726f3[_0xc5ba('0x1a')](0x194);}return _0x38930c;};}function handleError(_0x585e4b,_0x5665db){_0x5665db=_0x5665db||0x1f4;return function(_0x5bd6ac){logger[_0xc5ba('0x27')](_0x5bd6ac[_0xc5ba('0x28')]);if(_0x5bd6ac[_0xc5ba('0x29')]){delete _0x5bd6ac[_0xc5ba('0x29')];}_0x585e4b[_0xc5ba('0x1b')](_0x5665db)[_0xc5ba('0x2a')](_0x5bd6ac);};}exports[_0xc5ba('0x2b')]=function(_0x325adf,_0x187bc3){var _0x2746bf={},_0x43b4aa={},_0x358cb4={'count':0x0,'rows':[]};var _0x4a7ae8=_['map'](db['SmsTransferReport'][_0xc5ba('0x2c')],function(_0x13f214){return{'name':_0x13f214[_0xc5ba('0x2d')],'type':_0x13f214[_0xc5ba('0x2e')]['key']};});_0x43b4aa[_0xc5ba('0x2f')]=_[_0xc5ba('0x30')](_0x4a7ae8,'name');_0x43b4aa[_0xc5ba('0x31')]=_[_0xc5ba('0x32')](_0x325adf[_0xc5ba('0x31')]);_0x43b4aa[_0xc5ba('0x33')]=_[_0xc5ba('0x34')](_0x43b4aa[_0xc5ba('0x2f')],_0x43b4aa[_0xc5ba('0x31')]);_0x2746bf[_0xc5ba('0x35')]=_['intersection'](_0x43b4aa[_0xc5ba('0x2f')],qs[_0xc5ba('0x36')](_0x325adf[_0xc5ba('0x31')][_0xc5ba('0x36')]));_0x2746bf['attributes']=_0x2746bf['attributes'][_0xc5ba('0x37')]?_0x2746bf[_0xc5ba('0x35')]:_0x43b4aa[_0xc5ba('0x2f')];if(!_0x325adf[_0xc5ba('0x31')][_0xc5ba('0x38')](_0xc5ba('0x39'))){_0x2746bf['limit']=qs['limit'](_0x325adf[_0xc5ba('0x31')][_0xc5ba('0x21')]);_0x2746bf[_0xc5ba('0x1f')]=qs['offset'](_0x325adf[_0xc5ba('0x31')][_0xc5ba('0x1f')]);}_0x2746bf[_0xc5ba('0x3a')]=qs['sort'](_0x325adf[_0xc5ba('0x31')][_0xc5ba('0x3b')]);_0x2746bf[_0xc5ba('0x3c')]=qs[_0xc5ba('0x33')](_['pick'](_0x325adf[_0xc5ba('0x31')],_0x43b4aa[_0xc5ba('0x33')]),_0x4a7ae8);if(_0x325adf[_0xc5ba('0x31')][_0xc5ba('0x3d')]){_0x2746bf['where']=_[_0xc5ba('0x3e')](_0x2746bf['where'],{'$or':_[_0xc5ba('0x30')](_0x4a7ae8,function(_0x98ffd2){if(_0x98ffd2[_0xc5ba('0x2e')]!==_0xc5ba('0x3f')){var _0xf6159b={};_0xf6159b[_0x98ffd2['name']]={'$like':'%'+_0x325adf[_0xc5ba('0x31')]['filter']+'%'};return _0xf6159b;}})});}_0x2746bf=_['merge']({},_0x2746bf,_0x325adf['options']);var _0x26ea56={'where':_0x2746bf[_0xc5ba('0x3c')]};return db['SmsTransferReport'][_0xc5ba('0x20')](_0x26ea56)['then'](function(_0x306ffe){_0x358cb4[_0xc5ba('0x20')]=_0x306ffe;if(_0x325adf[_0xc5ba('0x31')][_0xc5ba('0x40')]){_0x2746bf[_0xc5ba('0x41')]=[{'all':!![]}];}return db[_0xc5ba('0x42')][_0xc5ba('0x43')](_0x2746bf);})[_0xc5ba('0x25')](function(_0x10801f){_0x358cb4[_0xc5ba('0x44')]=_0x10801f;return _0x358cb4;})['then'](respondWithFilteredResult(_0x187bc3,_0x2746bf))[_0xc5ba('0x45')](handleError(_0x187bc3,null));};exports[_0xc5ba('0x46')]=function(_0x2ae174,_0x2fb30c){var _0x259bdd={'raw':!![],'where':{'id':_0x2ae174[_0xc5ba('0x47')]['id']}},_0x1c4dab={};_0x1c4dab[_0xc5ba('0x2f')]=_[_0xc5ba('0x32')](db[_0xc5ba('0x42')][_0xc5ba('0x2c')]);_0x1c4dab['query']=_[_0xc5ba('0x32')](_0x2ae174[_0xc5ba('0x31')]);_0x1c4dab[_0xc5ba('0x33')]=_[_0xc5ba('0x34')](_0x1c4dab[_0xc5ba('0x2f')],_0x1c4dab[_0xc5ba('0x31')]);_0x259bdd[_0xc5ba('0x35')]=_[_0xc5ba('0x34')](_0x1c4dab[_0xc5ba('0x2f')],qs[_0xc5ba('0x36')](_0x2ae174[_0xc5ba('0x31')][_0xc5ba('0x36')]));_0x259bdd[_0xc5ba('0x35')]=_0x259bdd[_0xc5ba('0x35')][_0xc5ba('0x37')]?_0x259bdd[_0xc5ba('0x35')]:_0x1c4dab[_0xc5ba('0x2f')];if(_0x2ae174['query'][_0xc5ba('0x40')]){_0x259bdd['include']=[{'all':!![]}];}_0x259bdd=_[_0xc5ba('0x3e')]({},_0x259bdd,_0x2ae174['options']);return db[_0xc5ba('0x42')][_0xc5ba('0x48')](_0x259bdd)[_0xc5ba('0x25')](handleEntityNotFound(_0x2fb30c,null))[_0xc5ba('0x25')](respondWithResult(_0x2fb30c,null))[_0xc5ba('0x45')](handleError(_0x2fb30c,null));};exports[_0xc5ba('0x49')]=function(_0x473b17,_0x4339be){return db['SmsTransferReport'][_0xc5ba('0x49')](_0x473b17[_0xc5ba('0x4a')],{})[_0xc5ba('0x25')](respondWithResult(_0x4339be,0xc9))[_0xc5ba('0x45')](handleError(_0x4339be,null));};exports[_0xc5ba('0x24')]=function(_0x523539,_0x301c91){if(_0x523539['body']['id']){delete _0x523539[_0xc5ba('0x4a')]['id'];}return db['SmsTransferReport'][_0xc5ba('0x48')]({'where':{'id':_0x523539[_0xc5ba('0x47')]['id']}})['then'](handleEntityNotFound(_0x301c91,null))['then'](saveUpdates(_0x523539['body'],null))['then'](respondWithResult(_0x301c91,null))[_0xc5ba('0x45')](handleError(_0x301c91,null));};exports[_0xc5ba('0x26')]=function(_0x34278e,_0x3601da){return db['SmsTransferReport'][_0xc5ba('0x48')]({'where':{'id':_0x34278e[_0xc5ba('0x47')]['id']}})[_0xc5ba('0x25')](handleEntityNotFound(_0x3601da,null))[_0xc5ba('0x25')](removeEntity(_0x3601da,null))[_0xc5ba('0x45')](handleError(_0x3601da,null));};exports['describe']=function(_0x2cd02e,_0x1a3e70){return db[_0xc5ba('0x42')][_0xc5ba('0x4b')]()[_0xc5ba('0x25')](respondWithResult(_0x1a3e70,null))[_0xc5ba('0x45')](handleError(_0x1a3e70,null));}; \ No newline at end of file +var _0x7c9d=['querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','count','Content-Range','reject','save','then','destroy','stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x7c9d,0xdb));var _0xd7c9=function(_0xb5e8f4,_0x1adab0){_0xb5e8f4=_0xb5e8f4-0x0;var _0x20551b=_0x7c9d[_0xb5e8f4];return _0x20551b;};'use strict';var emlformat=require(_0xd7c9('0x0'));var rimraf=require(_0xd7c9('0x1'));var zipdir=require(_0xd7c9('0x2'));var jsonpatch=require(_0xd7c9('0x3'));var rp=require(_0xd7c9('0x4'));var moment=require(_0xd7c9('0x5'));var BPromise=require(_0xd7c9('0x6'));var Mustache=require(_0xd7c9('0x7'));var util=require(_0xd7c9('0x8'));var path=require(_0xd7c9('0x9'));var sox=require(_0xd7c9('0xa'));var csv=require(_0xd7c9('0xb'));var ejs=require(_0xd7c9('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd7c9('0xd'));var squel=require(_0xd7c9('0xe'));var crypto=require(_0xd7c9('0xf'));var jsforce=require(_0xd7c9('0x10'));var deskjs=require(_0xd7c9('0x11'));var toCsv=require('to-csv');var querystring=require(_0xd7c9('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd7c9('0x13'));var qs=require(_0xd7c9('0x14'));var as=require(_0xd7c9('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd7c9('0x16'))(_0xd7c9('0x17'));var utils=require('../../config/utils');var config=require(_0xd7c9('0x18'));var licenseUtil=require(_0xd7c9('0x19'));var db=require(_0xd7c9('0x1a'))['db'];function respondWithStatusCode(_0x225645,_0x11ddd8){_0x11ddd8=_0x11ddd8||0xcc;return function(_0x4cb609){if(_0x4cb609){return _0x225645[_0xd7c9('0x1b')](_0x11ddd8);}return _0x225645['status'](_0x11ddd8)[_0xd7c9('0x1c')]();};}function respondWithResult(_0x50e26f,_0x4b1748){_0x4b1748=_0x4b1748||0xc8;return function(_0x48a209){if(_0x48a209){return _0x50e26f[_0xd7c9('0x1d')](_0x4b1748)[_0xd7c9('0x1e')](_0x48a209);}};}function respondWithFilteredResult(_0x8eefca,_0x301df3){return function(_0x258f2a){if(_0x258f2a){var _0x3db238=typeof _0x301df3[_0xd7c9('0x1f')]==='undefined'&&typeof _0x301df3[_0xd7c9('0x20')]==='undefined';var _0x2acc72=_0x258f2a[_0xd7c9('0x21')];var _0x3f701f=_0x3db238?0x0:_0x301df3[_0xd7c9('0x1f')];var _0x1e27cd=_0x3db238?_0x258f2a[_0xd7c9('0x21')]:_0x301df3[_0xd7c9('0x1f')]+_0x301df3[_0xd7c9('0x20')];var _0x4f8ba8;if(_0x1e27cd>=_0x2acc72){_0x1e27cd=_0x2acc72;_0x4f8ba8=0xc8;}else{_0x4f8ba8=0xce;}_0x8eefca['status'](_0x4f8ba8);return _0x8eefca['set'](_0xd7c9('0x22'),_0x3f701f+'-'+_0x1e27cd+'/'+_0x2acc72)['json'](_0x258f2a);}return null;};}function patchUpdates(_0x215177){return function(_0x4f4b9c){try{jsonpatch['apply'](_0x4f4b9c,_0x215177,!![]);}catch(_0xa95388){return BPromise[_0xd7c9('0x23')](_0xa95388);}return _0x4f4b9c[_0xd7c9('0x24')]();};}function saveUpdates(_0x3c55a0,_0x5a4c36){return function(_0x36b65e){if(_0x36b65e){return _0x36b65e['update'](_0x3c55a0)[_0xd7c9('0x25')](function(_0x4ba986){return _0x4ba986;});}return null;};}function removeEntity(_0x4f9241,_0x5cc7a8){return function(_0x8cdf52){if(_0x8cdf52){return _0x8cdf52[_0xd7c9('0x26')]()['then'](function(){_0x4f9241[_0xd7c9('0x1d')](0xcc)[_0xd7c9('0x1c')]();});}};}function handleEntityNotFound(_0x45298a,_0x41b495){return function(_0x173843){if(!_0x173843){_0x45298a[_0xd7c9('0x1b')](0x194);}return _0x173843;};}function handleError(_0x54106d,_0x5e3339){_0x5e3339=_0x5e3339||0x1f4;return function(_0x27e642){logger['error'](_0x27e642[_0xd7c9('0x27')]);if(_0x27e642[_0xd7c9('0x28')]){delete _0x27e642['name'];}_0x54106d[_0xd7c9('0x1d')](_0x5e3339)[_0xd7c9('0x29')](_0x27e642);};}exports[_0xd7c9('0x2a')]=function(_0x33cf39,_0x433478){var _0x16264e={},_0x5cf625={},_0x513621={'count':0x0,'rows':[]};var _0x56ff28=_[_0xd7c9('0x2b')](db[_0xd7c9('0x2c')][_0xd7c9('0x2d')],function(_0x23f434){return{'name':_0x23f434[_0xd7c9('0x2e')],'type':_0x23f434[_0xd7c9('0x2f')][_0xd7c9('0x30')]};});_0x5cf625[_0xd7c9('0x31')]=_['map'](_0x56ff28,_0xd7c9('0x28'));_0x5cf625['query']=_[_0xd7c9('0x32')](_0x33cf39[_0xd7c9('0x33')]);_0x5cf625[_0xd7c9('0x34')]=_[_0xd7c9('0x35')](_0x5cf625[_0xd7c9('0x31')],_0x5cf625[_0xd7c9('0x33')]);_0x16264e[_0xd7c9('0x36')]=_[_0xd7c9('0x35')](_0x5cf625[_0xd7c9('0x31')],qs[_0xd7c9('0x37')](_0x33cf39[_0xd7c9('0x33')]['fields']));_0x16264e[_0xd7c9('0x36')]=_0x16264e[_0xd7c9('0x36')][_0xd7c9('0x38')]?_0x16264e[_0xd7c9('0x36')]:_0x5cf625['model'];if(!_0x33cf39['query'][_0xd7c9('0x39')](_0xd7c9('0x3a'))){_0x16264e['limit']=qs['limit'](_0x33cf39['query'][_0xd7c9('0x20')]);_0x16264e[_0xd7c9('0x1f')]=qs[_0xd7c9('0x1f')](_0x33cf39['query'][_0xd7c9('0x1f')]);}_0x16264e[_0xd7c9('0x3b')]=qs[_0xd7c9('0x3c')](_0x33cf39[_0xd7c9('0x33')][_0xd7c9('0x3c')]);_0x16264e['where']=qs[_0xd7c9('0x34')](_[_0xd7c9('0x3d')](_0x33cf39['query'],_0x5cf625[_0xd7c9('0x34')]),_0x56ff28);if(_0x33cf39[_0xd7c9('0x33')][_0xd7c9('0x3e')]){_0x16264e['where']=_['merge'](_0x16264e[_0xd7c9('0x3f')],{'$or':_[_0xd7c9('0x2b')](_0x56ff28,function(_0xece596){if(_0xece596[_0xd7c9('0x2f')]!==_0xd7c9('0x40')){var _0x14e435={};_0x14e435[_0xece596[_0xd7c9('0x28')]]={'$like':'%'+_0x33cf39[_0xd7c9('0x33')][_0xd7c9('0x3e')]+'%'};return _0x14e435;}})});}_0x16264e=_[_0xd7c9('0x41')]({},_0x16264e,_0x33cf39[_0xd7c9('0x42')]);var _0x893469={'where':_0x16264e[_0xd7c9('0x3f')]};return db[_0xd7c9('0x2c')]['count'](_0x893469)['then'](function(_0x5e0cdc){_0x513621[_0xd7c9('0x21')]=_0x5e0cdc;if(_0x33cf39['query'][_0xd7c9('0x43')]){_0x16264e[_0xd7c9('0x44')]=[{'all':!![]}];}return db[_0xd7c9('0x2c')][_0xd7c9('0x45')](_0x16264e);})[_0xd7c9('0x25')](function(_0x466444){_0x513621[_0xd7c9('0x46')]=_0x466444;return _0x513621;})[_0xd7c9('0x25')](respondWithFilteredResult(_0x433478,_0x16264e))[_0xd7c9('0x47')](handleError(_0x433478,null));};exports[_0xd7c9('0x48')]=function(_0x246ac0,_0x34b24d){var _0x2eae23={'raw':!![],'where':{'id':_0x246ac0[_0xd7c9('0x49')]['id']}},_0x754b1e={};_0x754b1e[_0xd7c9('0x31')]=_[_0xd7c9('0x32')](db[_0xd7c9('0x2c')][_0xd7c9('0x2d')]);_0x754b1e[_0xd7c9('0x33')]=_['keys'](_0x246ac0[_0xd7c9('0x33')]);_0x754b1e[_0xd7c9('0x34')]=_['intersection'](_0x754b1e[_0xd7c9('0x31')],_0x754b1e['query']);_0x2eae23[_0xd7c9('0x36')]=_[_0xd7c9('0x35')](_0x754b1e[_0xd7c9('0x31')],qs[_0xd7c9('0x37')](_0x246ac0['query']['fields']));_0x2eae23[_0xd7c9('0x36')]=_0x2eae23[_0xd7c9('0x36')][_0xd7c9('0x38')]?_0x2eae23['attributes']:_0x754b1e['model'];if(_0x246ac0[_0xd7c9('0x33')][_0xd7c9('0x43')]){_0x2eae23['include']=[{'all':!![]}];}_0x2eae23=_[_0xd7c9('0x41')]({},_0x2eae23,_0x246ac0[_0xd7c9('0x42')]);return db[_0xd7c9('0x2c')]['find'](_0x2eae23)[_0xd7c9('0x25')](handleEntityNotFound(_0x34b24d,null))['then'](respondWithResult(_0x34b24d,null))[_0xd7c9('0x47')](handleError(_0x34b24d,null));};exports[_0xd7c9('0x4a')]=function(_0x21f82e,_0x1695d8){return db['SmsTransferReport'][_0xd7c9('0x4a')](_0x21f82e[_0xd7c9('0x4b')],{})[_0xd7c9('0x25')](respondWithResult(_0x1695d8,0xc9))[_0xd7c9('0x47')](handleError(_0x1695d8,null));};exports[_0xd7c9('0x4c')]=function(_0x11bbe1,_0x4d23e7){if(_0x11bbe1['body']['id']){delete _0x11bbe1[_0xd7c9('0x4b')]['id'];}return db[_0xd7c9('0x2c')][_0xd7c9('0x4d')]({'where':{'id':_0x11bbe1[_0xd7c9('0x49')]['id']}})[_0xd7c9('0x25')](handleEntityNotFound(_0x4d23e7,null))[_0xd7c9('0x25')](saveUpdates(_0x11bbe1[_0xd7c9('0x4b')],null))['then'](respondWithResult(_0x4d23e7,null))['catch'](handleError(_0x4d23e7,null));};exports[_0xd7c9('0x26')]=function(_0x3e56bc,_0x2e9440){return db['SmsTransferReport']['find']({'where':{'id':_0x3e56bc[_0xd7c9('0x49')]['id']}})[_0xd7c9('0x25')](handleEntityNotFound(_0x2e9440,null))[_0xd7c9('0x25')](removeEntity(_0x2e9440,null))[_0xd7c9('0x47')](handleError(_0x2e9440,null));};exports[_0xd7c9('0x4e')]=function(_0x5bd816,_0x325e64){return db['SmsTransferReport'][_0xd7c9('0x4e')]()[_0xd7c9('0x25')](respondWithResult(_0x325e64,null))[_0xd7c9('0x47')](handleError(_0x325e64,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 168064a..b85ecee 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 _0x0c6d=['moment','bluebird','request-promise','rimraf','define','report_sms_transfer','uniqueid','util','../../config/logger','api'];(function(_0x480b3d,_0x60d08e){var _0x26047b=function(_0x263e64){while(--_0x263e64){_0x480b3d['push'](_0x480b3d['shift']());}};_0x26047b(++_0x60d08e);}(_0x0c6d,0xf7));var _0xd0c6=function(_0x225081,_0x36d62d){_0x225081=_0x225081-0x0;var _0x7753f1=_0x0c6d[_0x225081];return _0x7753f1;};'use strict';var _=require('lodash');var util=require(_0xd0c6('0x0'));var logger=require(_0xd0c6('0x1'))(_0xd0c6('0x2'));var moment=require(_0xd0c6('0x3'));var BPromise=require(_0xd0c6('0x4'));var rp=require(_0xd0c6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd0c6('0x6'));var config=require('../../config/environment');var attributes=require('./smsTransferReport.attributes');module['exports']=function(_0x2b4c40,_0x41f475){return _0x2b4c40[_0xd0c6('0x7')]('SmsTransferReport',attributes,{'tableName':_0xd0c6('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xd0c6('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3bbf=['exports','define','report_sms_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','path','rimraf','./smsTransferReport.attributes'];(function(_0x49aa4e,_0x560eb7){var _0x58ed43=function(_0x2a483c){while(--_0x2a483c){_0x49aa4e['push'](_0x49aa4e['shift']());}};_0x58ed43(++_0x560eb7);}(_0x3bbf,0x130));var _0xf3bb=function(_0x59ddb0,_0x2081c3){_0x59ddb0=_0x59ddb0-0x0;var _0x1dba64=_0x3bbf[_0x59ddb0];return _0x1dba64;};'use strict';var _=require('lodash');var util=require(_0xf3bb('0x0'));var logger=require(_0xf3bb('0x1'))(_0xf3bb('0x2'));var moment=require(_0xf3bb('0x3'));var BPromise=require(_0xf3bb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf3bb('0x5'));var rimraf=require(_0xf3bb('0x6'));var config=require('../../config/environment');var attributes=require(_0xf3bb('0x7'));module[_0xf3bb('0x8')]=function(_0x1811e6,_0x1d26d2){return _0x1811e6[_0xf3bb('0x9')]('SmsTransferReport',attributes,{'tableName':_0xf3bb('0xa'),'paranoid':![],'indexes':[{'name':_0xf3bb('0xb'),'fields':[_0xf3bb('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 496d721..9cc7fea 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 _0x74f3=['code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x74f3,0x164));var _0x374f=function(_0x3af5d0,_0x1ba303){_0x3af5d0=_0x3af5d0-0x0;var _0x46ebd3=_0x74f3[_0x3af5d0];return _0x46ebd3;};'use strict';var _=require(_0x374f('0x0'));var util=require(_0x374f('0x1'));var moment=require(_0x374f('0x2'));var BPromise=require('bluebird');var rs=require(_0x374f('0x3'));var fs=require('fs');var Redis=require(_0x374f('0x4'));var db=require(_0x374f('0x5'))['db'];var utils=require(_0x374f('0x6'));var logger=require('../../config/logger')(_0x374f('0x7'));var config=require(_0x374f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x374f('0x9')][_0x374f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x405e93,_0x407df1,_0x3bcc86){return new BPromise(function(_0x394073,_0x32861f){return client[_0x374f('0xb')](_0x405e93,_0x3bcc86)['then'](function(_0x2b0d45){logger[_0x374f('0xc')](_0x374f('0xd'),_0x407df1,_0x374f('0xe'));logger[_0x374f('0xf')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x407df1,_0x374f('0xe'),JSON[_0x374f('0x10')](_0x2b0d45));if(_0x2b0d45['error']){if(_0x2b0d45[_0x374f('0x11')][_0x374f('0x12')]===0x1f4){logger[_0x374f('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0x407df1,_0x2b0d45[_0x374f('0x11')][_0x374f('0x13')]);return _0x32861f(_0x2b0d45['error'][_0x374f('0x13')]);}logger[_0x374f('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0x407df1,_0x2b0d45[_0x374f('0x11')]['message']);return _0x394073(_0x2b0d45[_0x374f('0x11')][_0x374f('0x13')]);}else{logger[_0x374f('0xc')](_0x374f('0xd'),_0x407df1,_0x374f('0xe'));_0x394073(_0x2b0d45[_0x374f('0x14')][_0x374f('0x13')]);}})[_0x374f('0x15')](function(_0x250e33){logger[_0x374f('0x11')](_0x374f('0xd'),_0x407df1,_0x250e33);_0x32861f(_0x250e33);});});} \ No newline at end of file +var _0x16cc=['result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message'];(function(_0x489cb6,_0x299fab){var _0x299d5e=function(_0x44bf37){while(--_0x44bf37){_0x489cb6['push'](_0x489cb6['shift']());}};_0x299d5e(++_0x299fab);}(_0x16cc,0x120));var _0xc16c=function(_0x1404cd,_0x689802){_0x1404cd=_0x1404cd-0x0;var _0x37551e=_0x16cc[_0x1404cd];return _0x37551e;};'use strict';var _=require('lodash');var util=require(_0xc16c('0x0'));var moment=require(_0xc16c('0x1'));var BPromise=require(_0xc16c('0x2'));var rs=require(_0xc16c('0x3'));var fs=require('fs');var Redis=require(_0xc16c('0x4'));var db=require(_0xc16c('0x5'))['db'];var utils=require(_0xc16c('0x6'));var logger=require('../../config/logger')(_0xc16c('0x7'));var config=require(_0xc16c('0x8'));var jayson=require(_0xc16c('0x9'));var client=jayson[_0xc16c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3492da,_0x561b61,_0x828798){return new BPromise(function(_0x14d607,_0x37b245){return client[_0xc16c('0xb')](_0x3492da,_0x828798)['then'](function(_0x27f3e6){logger[_0xc16c('0xc')](_0xc16c('0xd'),_0x561b61,_0xc16c('0xe'));logger['debug'](_0xc16c('0xf'),_0x561b61,_0xc16c('0xe'),JSON[_0xc16c('0x10')](_0x27f3e6));if(_0x27f3e6['error']){if(_0x27f3e6['error'][_0xc16c('0x11')]===0x1f4){logger[_0xc16c('0x12')](_0xc16c('0xd'),_0x561b61,_0x27f3e6['error']['message']);return _0x37b245(_0x27f3e6['error'][_0xc16c('0x13')]);}logger[_0xc16c('0x12')](_0xc16c('0xd'),_0x561b61,_0x27f3e6[_0xc16c('0x12')][_0xc16c('0x13')]);return _0x14d607(_0x27f3e6[_0xc16c('0x12')][_0xc16c('0x13')]);}else{logger[_0xc16c('0xc')](_0xc16c('0xd'),_0x561b61,_0xc16c('0xe'));_0x14d607(_0x27f3e6[_0xc16c('0x14')][_0xc16c('0x13')]);}})[_0xc16c('0x15')](function(_0x2bf102){logger[_0xc16c('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x561b61,_0x2bf102);_0x37b245(_0x2bf102);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 5f1a148..b2f5b94 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 _0xc1c8=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id','show','/:id/download','isAuthenticated','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','post','single','file','create','put','update'];(function(_0x49c4e6,_0x3a001c){var _0x4a7c14=function(_0x469ea2){while(--_0x469ea2){_0x49c4e6['push'](_0x49c4e6['shift']());}};_0x4a7c14(++_0x3a001c);}(_0xc1c8,0x117));var _0x8c1c=function(_0x496980,_0x2bf7de){_0x496980=_0x496980-0x0;var _0xdb0ef8=_0xc1c8[_0x496980];return _0xdb0ef8;};'use strict';var multer=require(_0x8c1c('0x0'));var util=require(_0x8c1c('0x1'));var path=require(_0x8c1c('0x2'));var timeout=require(_0x8c1c('0x3'));var express=require(_0x8c1c('0x4'));var router=express['Router']();var fs_extra=require(_0x8c1c('0x5'));var auth=require(_0x8c1c('0x6'));var interaction=require(_0x8c1c('0x7'));var config=require('../../config/environment');var controller=require('./sound.controller');router[_0x8c1c('0x8')]('/',auth['isAuthenticated'](),controller[_0x8c1c('0x9')]);router[_0x8c1c('0x8')](_0x8c1c('0xa'),auth['isAuthenticated'](),controller[_0x8c1c('0xb')]);router[_0x8c1c('0x8')](_0x8c1c('0xc'),auth[_0x8c1c('0xd')](),controller[_0x8c1c('0xe')]);var upload=multer({'storage':multer[_0x8c1c('0xf')]({'destination':function(_0x4eb419,_0x45421a,_0xba667d){_0xba667d(null,path[_0x8c1c('0x10')](config[_0x8c1c('0x11')],_0x8c1c('0x12')));},'filename':function(_0x1ceb86,_0x392121,_0x1fb4fa){_0x392121[_0x8c1c('0x13')]=_0x392121[_0x8c1c('0x13')][_0x8c1c('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1fb4fa(null,util[_0x8c1c('0x15')](_0x8c1c('0x16'),path[_0x8c1c('0x17')](_0x392121[_0x8c1c('0x13')],path[_0x8c1c('0x18')](_0x392121[_0x8c1c('0x13')])),Date['now'](),path[_0x8c1c('0x18')](_0x392121[_0x8c1c('0x13')])));}})});router[_0x8c1c('0x19')]('/',upload[_0x8c1c('0x1a')](_0x8c1c('0x1b')),controller[_0x8c1c('0x1c')]);router[_0x8c1c('0x1d')]('/:id',auth['isAuthenticated'](),controller[_0x8c1c('0x1e')]);router['delete'](_0x8c1c('0xa'),auth[_0x8c1c('0xd')](),controller['delete']);module['exports']=router; \ No newline at end of file +var _0x901e=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','download','join','root','server/files/sounds/original/','originalname','replace','format','basename','extname','post','single','file','create','put','delete'];(function(_0x3540f8,_0x22514){var _0x33afef=function(_0x474213){while(--_0x474213){_0x3540f8['push'](_0x3540f8['shift']());}};_0x33afef(++_0x22514);}(_0x901e,0x1cb));var _0xe901=function(_0x189d3c,_0x5efebf){_0x189d3c=_0x189d3c-0x0;var _0x485959=_0x901e[_0x189d3c];return _0x485959;};'use strict';var multer=require('multer');var util=require(_0xe901('0x0'));var path=require(_0xe901('0x1'));var timeout=require(_0xe901('0x2'));var express=require('express');var router=express[_0xe901('0x3')]();var fs_extra=require(_0xe901('0x4'));var auth=require(_0xe901('0x5'));var interaction=require(_0xe901('0x6'));var config=require('../../config/environment');var controller=require('./sound.controller');router[_0xe901('0x7')]('/',auth[_0xe901('0x8')](),controller[_0xe901('0x9')]);router[_0xe901('0x7')](_0xe901('0xa'),auth[_0xe901('0x8')](),controller[_0xe901('0xb')]);router[_0xe901('0x7')]('/:id/download',auth[_0xe901('0x8')](),controller[_0xe901('0xc')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4d3970,_0x5282ea,_0x4eaa85){_0x4eaa85(null,path[_0xe901('0xd')](config[_0xe901('0xe')],_0xe901('0xf')));},'filename':function(_0x234056,_0x2ce3ac,_0xf2f33a){_0x2ce3ac[_0xe901('0x10')]=_0x2ce3ac[_0xe901('0x10')][_0xe901('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xf2f33a(null,util[_0xe901('0x12')]('%s-%s%s',path[_0xe901('0x13')](_0x2ce3ac['originalname'],path['extname'](_0x2ce3ac['originalname'])),Date['now'](),path[_0xe901('0x14')](_0x2ce3ac[_0xe901('0x10')])));}})});router[_0xe901('0x15')]('/',upload[_0xe901('0x16')](_0xe901('0x17')),controller[_0xe901('0x18')]);router[_0xe901('0x19')](_0xe901('0xa'),auth[_0xe901('0x8')](),controller['update']);router[_0xe901('0x1a')](_0xe901('0xa'),auth['isAuthenticated'](),controller['delete']);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index ba782af..2b4996f 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 _0xc54f=['sequelize','exports','STRING','FLOAT','INTEGER'];(function(_0x463b6a,_0x55f852){var _0xbe1722=function(_0xaed61c){while(--_0xaed61c){_0x463b6a['push'](_0x463b6a['shift']());}};_0xbe1722(++_0x55f852);}(_0xc54f,0x19f));var _0xfc54=function(_0x1d8068,_0x3fef2){_0x1d8068=_0x1d8068-0x0;var _0x3d546f=_0xc54f[_0x1d8068];return _0x3d546f;};'use strict';var Sequelize=require(_0xfc54('0x0'));module[_0xfc54('0x1')]={'name':{'type':Sequelize[_0xfc54('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0xfc54('0x2')]},'display_name':{'type':Sequelize[_0xfc54('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xfc54('0x2')]},'original_format':{'type':Sequelize[_0xfc54('0x2')]},'original_duration':{'type':Sequelize[_0xfc54('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0xfc54('0x4')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0xfc54('0x2')]},'converted_duration':{'type':Sequelize[_0xfc54('0x3')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0xfc54('0x4')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xfc54('0x4')]}}; \ No newline at end of file +var _0xfda0=['STRING','FLOAT','BIGINT','INTEGER','sequelize','exports'];(function(_0x2550ce,_0x45209b){var _0x25748d=function(_0x806ad5){while(--_0x806ad5){_0x2550ce['push'](_0x2550ce['shift']());}};_0x25748d(++_0x45209b);}(_0xfda0,0xee));var _0x0fda=function(_0x53deb4,_0xcbd828){_0x53deb4=_0x53deb4-0x0;var _0x1b1489=_0xfda0[_0x53deb4];return _0x1b1489;};'use strict';var Sequelize=require(_0x0fda('0x0'));module[_0x0fda('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x0fda('0x2')]},'display_name':{'type':Sequelize[_0x0fda('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x0fda('0x2')]},'original_format':{'type':Sequelize[_0x0fda('0x2')]},'original_duration':{'type':Sequelize[_0x0fda('0x3')]},'original_sampleCount':{'type':Sequelize[_0x0fda('0x4')]},'original_channelCount':{'type':Sequelize[_0x0fda('0x5')]},'original_bitRate':{'type':Sequelize[_0x0fda('0x4')]},'original_sampleRate':{'type':Sequelize[_0x0fda('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x0fda('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x0fda('0x4')]},'converted_channelCount':{'type':Sequelize[_0x0fda('0x5')]},'converted_bitRate':{'type':Sequelize[_0x0fda('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x0fda('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index a47c2c2..bf22b71 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 _0x1abe=['eml-format','zip-dir','fast-json-patch','request-promise','util','path','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/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','get','Sounds','UserProfileResource','sendStatus','stack','name','send','index','map','Sound','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','length','include','find','download','save_name','converted_format','join','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','root','format','%s.%s','create','basename','file','extname','originalname','filename','substring','wav','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','0777','unlinkSync','original_duration','duration','original_sampleCount','sampleCount','channelCount','bitRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','chmodSync','body','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','pick','description','original_format'];(function(_0x287ac2,_0x4541c0){var _0x17074b=function(_0x5b7927){while(--_0x5b7927){_0x287ac2['push'](_0x287ac2['shift']());}};_0x17074b(++_0x4541c0);}(_0x1abe,0x79));var _0xe1ab=function(_0x500704,_0x49d8e1){_0x500704=_0x500704-0x0;var _0x100bb5=_0x1abe[_0x500704];return _0x100bb5;};'use strict';var emlformat=require(_0xe1ab('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe1ab('0x1'));var jsonpatch=require(_0xe1ab('0x2'));var rp=require(_0xe1ab('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe1ab('0x4'));var path=require(_0xe1ab('0x5'));var sox=require('sox');var csv=require(_0xe1ab('0x6'));var ejs=require(_0xe1ab('0x7'));var fs=require('fs');var fs_extra=require(_0xe1ab('0x8'));var _=require(_0xe1ab('0x9'));var squel=require(_0xe1ab('0xa'));var crypto=require(_0xe1ab('0xb'));var jsforce=require(_0xe1ab('0xc'));var deskjs=require(_0xe1ab('0xd'));var toCsv=require(_0xe1ab('0x6'));var querystring=require('querystring');var Papa=require(_0xe1ab('0xe'));var Redis=require(_0xe1ab('0xf'));var authService=require(_0xe1ab('0x10'));var qs=require(_0xe1ab('0x11'));var as=require(_0xe1ab('0x12'));var hardwareService=require(_0xe1ab('0x13'));var logger=require('../../config/logger')(_0xe1ab('0x14'));var utils=require(_0xe1ab('0x15'));var config=require(_0xe1ab('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe1ab('0x17'))['db'];function respondWithStatusCode(_0xf767c3,_0x4f74c2){_0x4f74c2=_0x4f74c2||0xcc;return function(_0x23feac){if(_0x23feac){return _0xf767c3['sendStatus'](_0x4f74c2);}return _0xf767c3[_0xe1ab('0x18')](_0x4f74c2)[_0xe1ab('0x19')]();};}function respondWithResult(_0x245426,_0x281537){_0x281537=_0x281537||0xc8;return function(_0x1188eb){if(_0x1188eb){return _0x245426[_0xe1ab('0x18')](_0x281537)[_0xe1ab('0x1a')](_0x1188eb);}};}function respondWithFilteredResult(_0x4e5fb5,_0x33a375){return function(_0x517f4a){if(_0x517f4a){var _0x3aba97=typeof _0x33a375[_0xe1ab('0x1b')]===_0xe1ab('0x1c')&&typeof _0x33a375[_0xe1ab('0x1d')]==='undefined';var _0x3dc616=_0x517f4a[_0xe1ab('0x1e')];var _0x4610f9=_0x3aba97?0x0:_0x33a375[_0xe1ab('0x1b')];var _0x77f9e4=_0x3aba97?_0x517f4a[_0xe1ab('0x1e')]:_0x33a375[_0xe1ab('0x1b')]+_0x33a375[_0xe1ab('0x1d')];var _0x5179c7;if(_0x77f9e4>=_0x3dc616){_0x77f9e4=_0x3dc616;_0x5179c7=0xc8;}else{_0x5179c7=0xce;}_0x4e5fb5[_0xe1ab('0x18')](_0x5179c7);return _0x4e5fb5[_0xe1ab('0x1f')](_0xe1ab('0x20'),_0x4610f9+'-'+_0x77f9e4+'/'+_0x3dc616)[_0xe1ab('0x1a')](_0x517f4a);}return null;};}function patchUpdates(_0x2ee594){return function(_0xfd0f64){try{jsonpatch[_0xe1ab('0x21')](_0xfd0f64,_0x2ee594,!![]);}catch(_0x348f00){return BPromise['reject'](_0x348f00);}return _0xfd0f64[_0xe1ab('0x22')]();};}function saveUpdates(_0x3b3335,_0x2e8f14){return function(_0x1731c8){if(_0x1731c8){return _0x1731c8[_0xe1ab('0x23')](_0x3b3335)['then'](function(_0x17705c){return _0x17705c;});}return null;};}function removeEntity(_0x1d4cd2,_0x184c39){return function(_0x24401c){if(_0x24401c){return _0x24401c[_0xe1ab('0x24')]()[_0xe1ab('0x25')](function(){var _0x49e35d=_0x24401c[_0xe1ab('0x26')]({'plain':!![]});var _0x431e35=_0xe1ab('0x27');return db[_0xe1ab('0x28')][_0xe1ab('0x24')]({'where':{'type':_0x431e35,'resourceId':_0x49e35d['id']}})[_0xe1ab('0x25')](function(){return _0x24401c;});})[_0xe1ab('0x25')](function(){_0x1d4cd2[_0xe1ab('0x18')](0xcc)[_0xe1ab('0x19')]();});}};}function handleEntityNotFound(_0x18e2bc,_0x44e254){return function(_0x206ee2){if(!_0x206ee2){_0x18e2bc[_0xe1ab('0x29')](0x194);}return _0x206ee2;};}function handleError(_0x2ef96e,_0x4c0e7d){_0x4c0e7d=_0x4c0e7d||0x1f4;return function(_0x366c8f){logger['error'](_0x366c8f[_0xe1ab('0x2a')]);if(_0x366c8f[_0xe1ab('0x2b')]){delete _0x366c8f[_0xe1ab('0x2b')];}_0x2ef96e['status'](_0x4c0e7d)[_0xe1ab('0x2c')](_0x366c8f);};}exports[_0xe1ab('0x2d')]=function(_0x262e6f,_0x52c3c2){var _0x460f1a={},_0x29c79d={},_0x4f47ca={'count':0x0,'rows':[]};var _0x4bda14=_[_0xe1ab('0x2e')](db[_0xe1ab('0x2f')][_0xe1ab('0x30')],function(_0x5bfcc8){return{'name':_0x5bfcc8[_0xe1ab('0x31')],'type':_0x5bfcc8[_0xe1ab('0x32')]['key']};});_0x29c79d[_0xe1ab('0x33')]=_[_0xe1ab('0x2e')](_0x4bda14,_0xe1ab('0x2b'));_0x29c79d[_0xe1ab('0x34')]=_[_0xe1ab('0x35')](_0x262e6f['query']);_0x29c79d[_0xe1ab('0x36')]=_[_0xe1ab('0x37')](_0x29c79d[_0xe1ab('0x33')],_0x29c79d[_0xe1ab('0x34')]);_0x460f1a[_0xe1ab('0x38')]=_[_0xe1ab('0x37')](_0x29c79d[_0xe1ab('0x33')],qs[_0xe1ab('0x39')](_0x262e6f[_0xe1ab('0x34')][_0xe1ab('0x39')]));_0x460f1a['attributes']=_0x460f1a[_0xe1ab('0x38')]['length']?_0x460f1a['attributes']:_0x29c79d[_0xe1ab('0x33')];if(!_0x262e6f['query'][_0xe1ab('0x3a')](_0xe1ab('0x3b'))){_0x460f1a[_0xe1ab('0x1d')]=qs['limit'](_0x262e6f['query'][_0xe1ab('0x1d')]);_0x460f1a[_0xe1ab('0x1b')]=qs[_0xe1ab('0x1b')](_0x262e6f[_0xe1ab('0x34')][_0xe1ab('0x1b')]);}_0x460f1a[_0xe1ab('0x3c')]=qs[_0xe1ab('0x3d')](_0x262e6f['query'][_0xe1ab('0x3d')]);_0x460f1a['where']=qs[_0xe1ab('0x36')](_['pick'](_0x262e6f[_0xe1ab('0x34')],_0x29c79d['filters']),_0x4bda14);if(_0x262e6f[_0xe1ab('0x34')][_0xe1ab('0x3e')]){_0x460f1a[_0xe1ab('0x3f')]=_[_0xe1ab('0x40')](_0x460f1a[_0xe1ab('0x3f')],{'$or':_[_0xe1ab('0x2e')](_0x4bda14,function(_0x2d20da){if(_0x2d20da[_0xe1ab('0x32')]!==_0xe1ab('0x41')){var _0x1b36f9={};_0x1b36f9[_0x2d20da['name']]={'$like':'%'+_0x262e6f[_0xe1ab('0x34')][_0xe1ab('0x3e')]+'%'};return _0x1b36f9;}})});}_0x460f1a=_['merge']({},_0x460f1a,_0x262e6f[_0xe1ab('0x42')]);var _0x1b1489={'where':_0x460f1a[_0xe1ab('0x3f')]};return db[_0xe1ab('0x2f')][_0xe1ab('0x1e')](_0x1b1489)['then'](function(_0x315e82){_0x4f47ca[_0xe1ab('0x1e')]=_0x315e82;if(_0x262e6f['query'][_0xe1ab('0x43')]){_0x460f1a['include']=[{'all':!![]}];}return db[_0xe1ab('0x2f')][_0xe1ab('0x44')](_0x460f1a);})[_0xe1ab('0x25')](function(_0x40e68c){_0x4f47ca['rows']=_0x40e68c;return _0x4f47ca;})['then'](respondWithFilteredResult(_0x52c3c2,_0x460f1a))[_0xe1ab('0x45')](handleError(_0x52c3c2,null));};exports[_0xe1ab('0x46')]=function(_0x130f82,_0x23d33b){var _0x50eb61={'raw':!![],'where':{'id':_0x130f82[_0xe1ab('0x47')]['id']}},_0x33cf2d={};_0x33cf2d[_0xe1ab('0x33')]=_[_0xe1ab('0x35')](db['Sound'][_0xe1ab('0x30')]);_0x33cf2d[_0xe1ab('0x34')]=_[_0xe1ab('0x35')](_0x130f82[_0xe1ab('0x34')]);_0x33cf2d[_0xe1ab('0x36')]=_['intersection'](_0x33cf2d[_0xe1ab('0x33')],_0x33cf2d[_0xe1ab('0x34')]);_0x50eb61[_0xe1ab('0x38')]=_[_0xe1ab('0x37')](_0x33cf2d[_0xe1ab('0x33')],qs[_0xe1ab('0x39')](_0x130f82[_0xe1ab('0x34')]['fields']));_0x50eb61[_0xe1ab('0x38')]=_0x50eb61[_0xe1ab('0x38')][_0xe1ab('0x48')]?_0x50eb61[_0xe1ab('0x38')]:_0x33cf2d[_0xe1ab('0x33')];if(_0x130f82['query'][_0xe1ab('0x43')]){_0x50eb61[_0xe1ab('0x49')]=[{'all':!![]}];}_0x50eb61=_[_0xe1ab('0x40')]({},_0x50eb61,_0x130f82[_0xe1ab('0x42')]);return db[_0xe1ab('0x2f')][_0xe1ab('0x4a')](_0x50eb61)[_0xe1ab('0x25')](handleEntityNotFound(_0x23d33b,null))[_0xe1ab('0x25')](respondWithResult(_0x23d33b,null))[_0xe1ab('0x45')](handleError(_0x23d33b,null));};exports[_0xe1ab('0x4b')]=function(_0x244a46,_0x5dd921,_0x4b4b1e){return db[_0xe1ab('0x2f')][_0xe1ab('0x4a')]({'where':{'id':_0x244a46[_0xe1ab('0x47')]['id']},'attributes':[_0xe1ab('0x2b'),_0xe1ab('0x4c'),_0xe1ab('0x4d')],'raw':!![]})[_0xe1ab('0x25')](handleEntityNotFound(_0x5dd921,null))['then'](function(_0x33f6ee){if(_0x33f6ee){if(!fs['existsSync'](path[_0xe1ab('0x4e')](config['root'],_0xe1ab('0x4f'),_0x33f6ee[_0xe1ab('0x4c')]+'.'+_0x33f6ee[_0xe1ab('0x4d')]))){throw new db[(_0xe1ab('0x50'))][(_0xe1ab('0x51'))](_0xe1ab('0x52'));}return _0x5dd921[_0xe1ab('0x4b')](path[_0xe1ab('0x4e')](config[_0xe1ab('0x53')],_0xe1ab('0x4f'),util[_0xe1ab('0x54')]('%s.%s',_0x33f6ee[_0xe1ab('0x4c')],_0x33f6ee[_0xe1ab('0x4d')])),util[_0xe1ab('0x54')](_0xe1ab('0x55'),_0x33f6ee[_0xe1ab('0x2b')],_0x33f6ee['converted_format']));}return null;})[_0xe1ab('0x45')](handleError(_0x5dd921,null));};exports[_0xe1ab('0x56')]=function(_0x165b20,_0x3d0cd8,_0x53157c){var _0x357a73={'name':path[_0xe1ab('0x57')](_0x165b20[_0xe1ab('0x58')]['originalname'],path[_0xe1ab('0x59')](_0x165b20['file'][_0xe1ab('0x5a')])),'save_name':path[_0xe1ab('0x57')](_0x165b20[_0xe1ab('0x58')][_0xe1ab('0x5b')],path[_0xe1ab('0x59')](_0x165b20['file'][_0xe1ab('0x5b')])),'original_format':path[_0xe1ab('0x59')](_0x165b20[_0xe1ab('0x58')][_0xe1ab('0x5a')])[_0xe1ab('0x5c')](0x1),'converted_format':_0xe1ab('0x5d')};var _0x43e25f=path[_0xe1ab('0x4e')](config['root'],_0xe1ab('0x5e'),_0x165b20[_0xe1ab('0x58')]['filename']);var _0x4474af=path[_0xe1ab('0x4e')](config[_0xe1ab('0x53')],_0xe1ab('0x4f'),util['format'](_0xe1ab('0x55'),path[_0xe1ab('0x57')](_0x165b20[_0xe1ab('0x58')]['filename'],path[_0xe1ab('0x59')](_0x165b20['file'][_0xe1ab('0x5b')])),_0x357a73[_0xe1ab('0x4d')]));logger['info'](_0xe1ab('0x5f'),_0x43e25f);logger[_0xe1ab('0x60')](_0xe1ab('0x61'),_0x4474af);try{fs['chmodSync'](_0x43e25f,parseInt(_0xe1ab('0x62'),0x8));var _0x411468=sox['transcode'](_0x43e25f,_0x4474af,{'sampleRate':0x1f40,'format':_0xe1ab('0x5d'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x411468['on']('error',function(_0x4d9afa){fs[_0xe1ab('0x63')](_0x43e25f);_0x3d0cd8[_0xe1ab('0x18')](0x1f4)[_0xe1ab('0x2c')](_0x4d9afa);});_0x411468['on']('src',function(_0x5c6cba){_0x357a73[_0xe1ab('0x64')]=isNaN(_0x5c6cba[_0xe1ab('0x65')])?null:_0x5c6cba[_0xe1ab('0x65')]*0x3e8;_0x357a73[_0xe1ab('0x66')]=isNaN(_0x5c6cba[_0xe1ab('0x67')])?null:_0x5c6cba[_0xe1ab('0x67')];_0x357a73['original_channelCount']=isNaN(_0x5c6cba[_0xe1ab('0x68')])?null:_0x5c6cba[_0xe1ab('0x68')];_0x357a73['original_bitRate']=isNaN(_0x5c6cba[_0xe1ab('0x69')])?null:_0x5c6cba[_0xe1ab('0x69')];_0x357a73['original_sampleRate']=isNaN(_0x5c6cba['sampleRate'])?null:_0x5c6cba[_0xe1ab('0x6a')];});_0x411468['on'](_0xe1ab('0x6b'),function(_0x2a2f07){_0x357a73[_0xe1ab('0x6c')]=isNaN(_0x2a2f07[_0xe1ab('0x65')])?null:_0x2a2f07[_0xe1ab('0x65')]*0x3e8;_0x357a73[_0xe1ab('0x6d')]=isNaN(_0x2a2f07[_0xe1ab('0x67')])?null:_0x2a2f07[_0xe1ab('0x67')];_0x357a73[_0xe1ab('0x6e')]=isNaN(_0x2a2f07['channelCount'])?null:_0x2a2f07[_0xe1ab('0x68')];_0x357a73['converted_bitRate']=isNaN(_0x2a2f07['bitRate'])?null:_0x2a2f07[_0xe1ab('0x69')];_0x357a73['converted_sampleRate']=isNaN(_0x2a2f07[_0xe1ab('0x6a')])?null:_0x2a2f07[_0xe1ab('0x6a')];});_0x411468['on'](_0xe1ab('0x19'),function(){fs[_0xe1ab('0x6f')](_0x4474af,parseInt(_0xe1ab('0x62'),0x8));return db[_0xe1ab('0x2f')]['create'](_0x357a73)[_0xe1ab('0x25')](function(_0x3e545a){var _0x217501={'role':_0x165b20[_0xe1ab('0x70')][_0xe1ab('0x71')],'userProfileId':_0x165b20[_0xe1ab('0x70')][_0xe1ab('0x72')]};if(!_0x217501)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x217501[_0xe1ab('0x71')]==='user'){var _0x1d02c7=_0x3e545a['get']({'plain':!![]});return db['UserProfileSection'][_0xe1ab('0x4a')]({'where':{'name':_0xe1ab('0x27'),'userProfileId':_0x217501[_0xe1ab('0x72')]},'raw':!![]})['then'](function(_0x27c21e){if(_0x27c21e&&_0x27c21e[_0xe1ab('0x73')]===0x0){return db[_0xe1ab('0x28')][_0xe1ab('0x56')]({'name':_0x1d02c7[_0xe1ab('0x2b')],'resourceId':_0x1d02c7['id'],'type':_0x27c21e[_0xe1ab('0x2b')],'sectionId':_0x27c21e['id']},{})['then'](function(){return _0x3e545a;});}else{return _0x3e545a;}})[_0xe1ab('0x45')](function(_0x533556){logger[_0xe1ab('0x74')](_0xe1ab('0x75'),_0x533556);throw _0x533556;});}return _0x3e545a;})['then'](respondWithResult(_0x3d0cd8,null))[_0xe1ab('0x45')](handleError(_0x3d0cd8,null));});_0x411468['start']();}catch(_0x3df63a){_0x3d0cd8['status'](0x1f4)['send'](_0x3df63a);}};exports[_0xe1ab('0x23')]=function(_0x53f4bd,_0x357ff8,_0xa5723b){return db[_0xe1ab('0x2f')]['find']({'where':{'id':_0x53f4bd[_0xe1ab('0x47')]['id']}})[_0xe1ab('0x25')](handleEntityNotFound(_0x357ff8,null))[_0xe1ab('0x25')](saveUpdates(_[_0xe1ab('0x76')](_0x53f4bd['body'],['name',_0xe1ab('0x77')]),null))[_0xe1ab('0x25')](respondWithResult(_0x357ff8,null))[_0xe1ab('0x45')](handleError(_0x357ff8,null));};exports['delete']=function(_0x361cec,_0x5b6695,_0x1135b0){return db[_0xe1ab('0x2f')][_0xe1ab('0x4a')]({'where':{'id':_0x361cec[_0xe1ab('0x47')]['id']}})[_0xe1ab('0x25')](function(_0x4af104){if(_0x4af104){return _0x4af104['destroy']();}})[_0xe1ab('0x25')](function(_0x36dae1){var _0xeb8d29=path['join'](config[_0xe1ab('0x53')],_0xe1ab('0x5e'),util[_0xe1ab('0x54')]('%s.%s',_0x36dae1[_0xe1ab('0x4c')],_0x36dae1[_0xe1ab('0x78')]));var _0x21bc4a=path[_0xe1ab('0x4e')](config[_0xe1ab('0x53')],_0xe1ab('0x4f'),util['format'](_0xe1ab('0x55'),_0x36dae1[_0xe1ab('0x4c')],_0x36dae1['converted_format']));fs[_0xe1ab('0x63')](_0xeb8d29);fs[_0xe1ab('0x63')](_0x21bc4a);return _0x36dae1;})[_0xe1ab('0x25')](function(_0x50f109){if(_0x50f109){return _0x5b6695[_0xe1ab('0x18')](0xcc)['end']();}})[_0xe1ab('0x25')](handleEntityNotFound(_0x5b6695,null))[_0xe1ab('0x45')](handleError(_0x5b6695,null));}; \ No newline at end of file +var _0x2680=['duration','sampleCount','channelCount','original_bitRate','bitRate','sampleRate','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','0777','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Sounds','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','delete','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','get','UserProfileResource','destroy','sendStatus','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','sort','where','merge','filter','options','Sound','include','findAll','show','params','keys','find','save_name','converted_format','join','root','server/files/sounds/converted','Sequelize','Sound\x20not\x20found','format','%s.%s','catch','basename','file','extname','originalname','filename','substring','wav','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','src'];(function(_0x2f320c,_0x243a26){var _0x33249b=function(_0x5bc1b7){while(--_0x5bc1b7){_0x2f320c['push'](_0x2f320c['shift']());}};_0x33249b(++_0x243a26);}(_0x2680,0x1f4));var _0x0268=function(_0x5a7751,_0x44a978){_0x5a7751=_0x5a7751-0x0;var _0x2627b5=_0x2680[_0x5a7751];return _0x2627b5;};'use strict';var emlformat=require(_0x0268('0x0'));var rimraf=require(_0x0268('0x1'));var zipdir=require(_0x0268('0x2'));var jsonpatch=require(_0x0268('0x3'));var rp=require(_0x0268('0x4'));var moment=require(_0x0268('0x5'));var BPromise=require(_0x0268('0x6'));var Mustache=require(_0x0268('0x7'));var util=require('util');var path=require(_0x0268('0x8'));var sox=require(_0x0268('0x9'));var csv=require(_0x0268('0xa'));var ejs=require(_0x0268('0xb'));var fs=require('fs');var fs_extra=require(_0x0268('0xc'));var _=require(_0x0268('0xd'));var squel=require(_0x0268('0xe'));var crypto=require(_0x0268('0xf'));var jsforce=require(_0x0268('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x0268('0xa'));var querystring=require(_0x0268('0x11'));var Papa=require('papaparse');var Redis=require(_0x0268('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0268('0x13'));var hardwareService=require(_0x0268('0x14'));var logger=require(_0x0268('0x15'))(_0x0268('0x16'));var utils=require('../../config/utils');var config=require(_0x0268('0x17'));var licenseUtil=require(_0x0268('0x18'));var db=require(_0x0268('0x19'))['db'];function respondWithStatusCode(_0xbb7b4c,_0x276549){_0x276549=_0x276549||0xcc;return function(_0x16b20f){if(_0x16b20f){return _0xbb7b4c['sendStatus'](_0x276549);}return _0xbb7b4c[_0x0268('0x1a')](_0x276549)[_0x0268('0x1b')]();};}function respondWithResult(_0x467461,_0x4bd445){_0x4bd445=_0x4bd445||0xc8;return function(_0x5f116e){if(_0x5f116e){return _0x467461[_0x0268('0x1a')](_0x4bd445)['json'](_0x5f116e);}};}function respondWithFilteredResult(_0x4feef6,_0x47904f){return function(_0x37fac8){if(_0x37fac8){var _0x2a1ba4=typeof _0x47904f[_0x0268('0x1c')]===_0x0268('0x1d')&&typeof _0x47904f[_0x0268('0x1e')]===_0x0268('0x1d');var _0x415ad1=_0x37fac8[_0x0268('0x1f')];var _0x2fae92=_0x2a1ba4?0x0:_0x47904f['offset'];var _0xf0881f=_0x2a1ba4?_0x37fac8[_0x0268('0x1f')]:_0x47904f['offset']+_0x47904f[_0x0268('0x1e')];var _0x9dcb3a;if(_0xf0881f>=_0x415ad1){_0xf0881f=_0x415ad1;_0x9dcb3a=0xc8;}else{_0x9dcb3a=0xce;}_0x4feef6[_0x0268('0x1a')](_0x9dcb3a);return _0x4feef6[_0x0268('0x20')](_0x0268('0x21'),_0x2fae92+'-'+_0xf0881f+'/'+_0x415ad1)[_0x0268('0x22')](_0x37fac8);}return null;};}function patchUpdates(_0x59c0bd){return function(_0x57b8a5){try{jsonpatch[_0x0268('0x23')](_0x57b8a5,_0x59c0bd,!![]);}catch(_0x110c75){return BPromise[_0x0268('0x24')](_0x110c75);}return _0x57b8a5[_0x0268('0x25')]();};}function saveUpdates(_0x4c4998,_0x3b4690){return function(_0x38a814){if(_0x38a814){return _0x38a814[_0x0268('0x26')](_0x4c4998)[_0x0268('0x27')](function(_0x1d3f24){return _0x1d3f24;});}return null;};}function removeEntity(_0x38b119,_0x195aaf){return function(_0x972fab){if(_0x972fab){return _0x972fab['destroy']()['then'](function(){var _0x212acb=_0x972fab[_0x0268('0x28')]({'plain':!![]});var _0x15c87f='Sounds';return db[_0x0268('0x29')][_0x0268('0x2a')]({'where':{'type':_0x15c87f,'resourceId':_0x212acb['id']}})[_0x0268('0x27')](function(){return _0x972fab;});})[_0x0268('0x27')](function(){_0x38b119[_0x0268('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x356743,_0x5342cf){return function(_0x18fa53){if(!_0x18fa53){_0x356743[_0x0268('0x2b')](0x194);}return _0x18fa53;};}function handleError(_0x2de406,_0x274a29){_0x274a29=_0x274a29||0x1f4;return function(_0x41bb60){logger['error'](_0x41bb60[_0x0268('0x2c')]);if(_0x41bb60[_0x0268('0x2d')]){delete _0x41bb60[_0x0268('0x2d')];}_0x2de406[_0x0268('0x1a')](_0x274a29)[_0x0268('0x2e')](_0x41bb60);};}exports[_0x0268('0x2f')]=function(_0x28e339,_0x107f88){var _0xbe45fd={},_0x38799a={},_0x4cf98c={'count':0x0,'rows':[]};var _0x2a7e90=_['map'](db['Sound'][_0x0268('0x30')],function(_0x284729){return{'name':_0x284729[_0x0268('0x31')],'type':_0x284729[_0x0268('0x32')]['key']};});_0x38799a[_0x0268('0x33')]=_[_0x0268('0x34')](_0x2a7e90,'name');_0x38799a[_0x0268('0x35')]=_['keys'](_0x28e339[_0x0268('0x35')]);_0x38799a[_0x0268('0x36')]=_[_0x0268('0x37')](_0x38799a[_0x0268('0x33')],_0x38799a[_0x0268('0x35')]);_0xbe45fd[_0x0268('0x38')]=_[_0x0268('0x37')](_0x38799a[_0x0268('0x33')],qs[_0x0268('0x39')](_0x28e339[_0x0268('0x35')][_0x0268('0x39')]));_0xbe45fd[_0x0268('0x38')]=_0xbe45fd['attributes'][_0x0268('0x3a')]?_0xbe45fd[_0x0268('0x38')]:_0x38799a[_0x0268('0x33')];if(!_0x28e339[_0x0268('0x35')]['hasOwnProperty']('nolimit')){_0xbe45fd['limit']=qs[_0x0268('0x1e')](_0x28e339[_0x0268('0x35')][_0x0268('0x1e')]);_0xbe45fd['offset']=qs[_0x0268('0x1c')](_0x28e339[_0x0268('0x35')][_0x0268('0x1c')]);}_0xbe45fd['order']=qs['sort'](_0x28e339[_0x0268('0x35')][_0x0268('0x3b')]);_0xbe45fd[_0x0268('0x3c')]=qs['filters'](_['pick'](_0x28e339['query'],_0x38799a[_0x0268('0x36')]),_0x2a7e90);if(_0x28e339[_0x0268('0x35')]['filter']){_0xbe45fd['where']=_[_0x0268('0x3d')](_0xbe45fd[_0x0268('0x3c')],{'$or':_[_0x0268('0x34')](_0x2a7e90,function(_0x393e52){if(_0x393e52[_0x0268('0x32')]!=='VIRTUAL'){var _0x28d17e={};_0x28d17e[_0x393e52[_0x0268('0x2d')]]={'$like':'%'+_0x28e339[_0x0268('0x35')][_0x0268('0x3e')]+'%'};return _0x28d17e;}})});}_0xbe45fd=_['merge']({},_0xbe45fd,_0x28e339[_0x0268('0x3f')]);var _0xf99d9a={'where':_0xbe45fd[_0x0268('0x3c')]};return db[_0x0268('0x40')][_0x0268('0x1f')](_0xf99d9a)[_0x0268('0x27')](function(_0x3f06f6){_0x4cf98c['count']=_0x3f06f6;if(_0x28e339['query']['includeAll']){_0xbe45fd[_0x0268('0x41')]=[{'all':!![]}];}return db[_0x0268('0x40')][_0x0268('0x42')](_0xbe45fd);})['then'](function(_0x33f1bf){_0x4cf98c['rows']=_0x33f1bf;return _0x4cf98c;})[_0x0268('0x27')](respondWithFilteredResult(_0x107f88,_0xbe45fd))['catch'](handleError(_0x107f88,null));};exports[_0x0268('0x43')]=function(_0x2e4c22,_0x9aaf11){var _0x31ca73={'raw':!![],'where':{'id':_0x2e4c22[_0x0268('0x44')]['id']}},_0x4ba0f8={};_0x4ba0f8['model']=_['keys'](db['Sound'][_0x0268('0x30')]);_0x4ba0f8[_0x0268('0x35')]=_[_0x0268('0x45')](_0x2e4c22[_0x0268('0x35')]);_0x4ba0f8[_0x0268('0x36')]=_['intersection'](_0x4ba0f8['model'],_0x4ba0f8[_0x0268('0x35')]);_0x31ca73['attributes']=_[_0x0268('0x37')](_0x4ba0f8['model'],qs[_0x0268('0x39')](_0x2e4c22[_0x0268('0x35')]['fields']));_0x31ca73[_0x0268('0x38')]=_0x31ca73[_0x0268('0x38')][_0x0268('0x3a')]?_0x31ca73[_0x0268('0x38')]:_0x4ba0f8[_0x0268('0x33')];if(_0x2e4c22[_0x0268('0x35')]['includeAll']){_0x31ca73['include']=[{'all':!![]}];}_0x31ca73=_[_0x0268('0x3d')]({},_0x31ca73,_0x2e4c22[_0x0268('0x3f')]);return db['Sound']['find'](_0x31ca73)[_0x0268('0x27')](handleEntityNotFound(_0x9aaf11,null))[_0x0268('0x27')](respondWithResult(_0x9aaf11,null))['catch'](handleError(_0x9aaf11,null));};exports['download']=function(_0x2bdf46,_0x183918,_0x286a44){return db[_0x0268('0x40')][_0x0268('0x46')]({'where':{'id':_0x2bdf46[_0x0268('0x44')]['id']},'attributes':[_0x0268('0x2d'),_0x0268('0x47'),_0x0268('0x48')],'raw':!![]})[_0x0268('0x27')](handleEntityNotFound(_0x183918,null))[_0x0268('0x27')](function(_0x1dd294){if(_0x1dd294){if(!fs['existsSync'](path[_0x0268('0x49')](config[_0x0268('0x4a')],_0x0268('0x4b'),_0x1dd294[_0x0268('0x47')]+'.'+_0x1dd294[_0x0268('0x48')]))){throw new db[(_0x0268('0x4c'))]['ValidationError'](_0x0268('0x4d'));}return _0x183918['download'](path[_0x0268('0x49')](config['root'],_0x0268('0x4b'),util[_0x0268('0x4e')](_0x0268('0x4f'),_0x1dd294[_0x0268('0x47')],_0x1dd294[_0x0268('0x48')])),util[_0x0268('0x4e')]('%s.%s',_0x1dd294[_0x0268('0x2d')],_0x1dd294[_0x0268('0x48')]));}return null;})[_0x0268('0x50')](handleError(_0x183918,null));};exports['create']=function(_0x27745c,_0x53db1e,_0x283029){var _0x562dc7={'name':path[_0x0268('0x51')](_0x27745c[_0x0268('0x52')]['originalname'],path[_0x0268('0x53')](_0x27745c[_0x0268('0x52')][_0x0268('0x54')])),'save_name':path['basename'](_0x27745c['file'][_0x0268('0x55')],path[_0x0268('0x53')](_0x27745c[_0x0268('0x52')][_0x0268('0x55')])),'original_format':path[_0x0268('0x53')](_0x27745c['file']['originalname'])[_0x0268('0x56')](0x1),'converted_format':_0x0268('0x57')};var _0x463a9e=path['join'](config[_0x0268('0x4a')],_0x0268('0x58'),_0x27745c[_0x0268('0x52')][_0x0268('0x55')]);var _0x3fc04f=path[_0x0268('0x49')](config[_0x0268('0x4a')],_0x0268('0x4b'),util[_0x0268('0x4e')](_0x0268('0x4f'),path[_0x0268('0x51')](_0x27745c[_0x0268('0x52')][_0x0268('0x55')],path[_0x0268('0x53')](_0x27745c[_0x0268('0x52')]['filename'])),_0x562dc7[_0x0268('0x48')]));logger['info'](_0x0268('0x59'),_0x463a9e);logger[_0x0268('0x5a')](_0x0268('0x5b'),_0x3fc04f);try{fs[_0x0268('0x5c')](_0x463a9e,parseInt('0777',0x8));var _0x47d3af=sox[_0x0268('0x5d')](_0x463a9e,_0x3fc04f,{'sampleRate':0x1f40,'format':_0x0268('0x57'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x47d3af['on']('error',function(_0xf8eebc){fs['unlinkSync'](_0x463a9e);_0x53db1e[_0x0268('0x1a')](0x1f4)['send'](_0xf8eebc);});_0x47d3af['on'](_0x0268('0x5e'),function(_0x1365c9){_0x562dc7['original_duration']=isNaN(_0x1365c9[_0x0268('0x5f')])?null:_0x1365c9[_0x0268('0x5f')]*0x3e8;_0x562dc7['original_sampleCount']=isNaN(_0x1365c9['sampleCount'])?null:_0x1365c9[_0x0268('0x60')];_0x562dc7['original_channelCount']=isNaN(_0x1365c9[_0x0268('0x61')])?null:_0x1365c9['channelCount'];_0x562dc7[_0x0268('0x62')]=isNaN(_0x1365c9[_0x0268('0x63')])?null:_0x1365c9['bitRate'];_0x562dc7['original_sampleRate']=isNaN(_0x1365c9[_0x0268('0x64')])?null:_0x1365c9['sampleRate'];});_0x47d3af['on']('dest',function(_0xe6e739){_0x562dc7[_0x0268('0x65')]=isNaN(_0xe6e739[_0x0268('0x5f')])?null:_0xe6e739[_0x0268('0x5f')]*0x3e8;_0x562dc7[_0x0268('0x66')]=isNaN(_0xe6e739[_0x0268('0x60')])?null:_0xe6e739[_0x0268('0x60')];_0x562dc7[_0x0268('0x67')]=isNaN(_0xe6e739['channelCount'])?null:_0xe6e739[_0x0268('0x61')];_0x562dc7[_0x0268('0x68')]=isNaN(_0xe6e739[_0x0268('0x63')])?null:_0xe6e739[_0x0268('0x63')];_0x562dc7[_0x0268('0x69')]=isNaN(_0xe6e739[_0x0268('0x64')])?null:_0xe6e739[_0x0268('0x64')];});_0x47d3af['on'](_0x0268('0x1b'),function(){fs['chmodSync'](_0x3fc04f,parseInt(_0x0268('0x6a'),0x8));return db['Sound']['create'](_0x562dc7)[_0x0268('0x27')](function(_0xfcfae5){var _0x3e829c={'role':_0x27745c[_0x0268('0x6b')]['role'],'userProfileId':_0x27745c[_0x0268('0x6b')][_0x0268('0x6c')]};if(!_0x3e829c)throw new Error(_0x0268('0x6d'));if(_0x3e829c[_0x0268('0x6e')]===_0x0268('0x6f')){var _0x16ea88=_0xfcfae5[_0x0268('0x28')]({'plain':!![]});return db[_0x0268('0x70')]['find']({'where':{'name':_0x0268('0x71'),'userProfileId':_0x3e829c[_0x0268('0x6c')]},'raw':!![]})[_0x0268('0x27')](function(_0x1bf5ef){if(_0x1bf5ef&&_0x1bf5ef['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x16ea88[_0x0268('0x2d')],'resourceId':_0x16ea88['id'],'type':_0x1bf5ef[_0x0268('0x2d')],'sectionId':_0x1bf5ef['id']},{})['then'](function(){return _0xfcfae5;});}else{return _0xfcfae5;}})[_0x0268('0x50')](function(_0x9e3fef){logger[_0x0268('0x72')](_0x0268('0x73'),_0x9e3fef);throw _0x9e3fef;});}return _0xfcfae5;})[_0x0268('0x27')](respondWithResult(_0x53db1e,null))['catch'](handleError(_0x53db1e,null));});_0x47d3af[_0x0268('0x74')]();}catch(_0x11d7f){_0x53db1e[_0x0268('0x1a')](0x1f4)[_0x0268('0x2e')](_0x11d7f);}};exports[_0x0268('0x26')]=function(_0x36749d,_0x39d52e,_0x10aa60){return db[_0x0268('0x40')][_0x0268('0x46')]({'where':{'id':_0x36749d['params']['id']}})['then'](handleEntityNotFound(_0x39d52e,null))[_0x0268('0x27')](saveUpdates(_['pick'](_0x36749d['body'],[_0x0268('0x2d'),'description']),null))[_0x0268('0x27')](respondWithResult(_0x39d52e,null))['catch'](handleError(_0x39d52e,null));};exports[_0x0268('0x75')]=function(_0x487003,_0x1bfbad,_0x101ddb){return db[_0x0268('0x40')]['find']({'where':{'id':_0x487003[_0x0268('0x44')]['id']}})[_0x0268('0x27')](function(_0xa71e71){if(_0xa71e71){return _0xa71e71[_0x0268('0x2a')]();}})[_0x0268('0x27')](function(_0x5de991){var _0x72d4ad=path['join'](config[_0x0268('0x4a')],'server/files/sounds/original',util['format'](_0x0268('0x4f'),_0x5de991['save_name'],_0x5de991['original_format']));var _0x2bbe12=path[_0x0268('0x49')](config[_0x0268('0x4a')],_0x0268('0x4b'),util[_0x0268('0x4e')](_0x0268('0x4f'),_0x5de991['save_name'],_0x5de991[_0x0268('0x48')]));fs[_0x0268('0x76')](_0x72d4ad);fs[_0x0268('0x76')](_0x2bbe12);return _0x5de991;})[_0x0268('0x27')](function(_0x2d0d7f){if(_0x2d0d7f){return _0x1bfbad['status'](0xcc)['end']();}})[_0x0268('0x27')](handleEntityNotFound(_0x1bfbad,null))['catch'](handleError(_0x1bfbad,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 795b763..b598dba 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 _0xa822=['util','../../config/logger','request-promise','path','../../config/environment','exports','define','Sound','tools_sounds','lodash'];(function(_0x4aecfa,_0x28c3bd){var _0x3659d0=function(_0x1e96ce){while(--_0x1e96ce){_0x4aecfa['push'](_0x4aecfa['shift']());}};_0x3659d0(++_0x28c3bd);}(_0xa822,0x1c1));var _0x2a82=function(_0x3b6f58,_0x5870de){_0x3b6f58=_0x3b6f58-0x0;var _0x987c61=_0xa822[_0x3b6f58];return _0x987c61;};'use strict';var _=require(_0x2a82('0x0'));var util=require(_0x2a82('0x1'));var logger=require(_0x2a82('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2a82('0x3'));var fs=require('fs');var path=require(_0x2a82('0x4'));var rimraf=require('rimraf');var config=require(_0x2a82('0x5'));var attributes=require('./sound.attributes');module[_0x2a82('0x6')]=function(_0x4c404f,_0x1a5a19){return _0x4c404f[_0x2a82('0x7')](_0x2a82('0x8'),attributes,{'tableName':_0x2a82('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x340b=['./sound.attributes','exports','tools_sounds','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x343aa1,_0x443588){var _0x145484=function(_0x4f14ee){while(--_0x4f14ee){_0x343aa1['push'](_0x343aa1['shift']());}};_0x145484(++_0x443588);}(_0x340b,0x139));var _0xb340=function(_0x2d68c9,_0x411beb){_0x2d68c9=_0x2d68c9-0x0;var _0x59a7b6=_0x340b[_0x2d68c9];return _0x59a7b6;};'use strict';var _=require(_0xb340('0x0'));var util=require(_0xb340('0x1'));var logger=require(_0xb340('0x2'))('api');var moment=require(_0xb340('0x3'));var BPromise=require(_0xb340('0x4'));var rp=require(_0xb340('0x5'));var fs=require('fs');var path=require(_0xb340('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb340('0x7'));module[_0xb340('0x8')]=function(_0x1ab9a2,_0x2895d3){return _0x1ab9a2['define']('Sound',attributes,{'tableName':_0xb340('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index e4912f8..e7807ef 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 _0xa45b=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Sound,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','ShowSound','Sound','find','options','raw','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x382e63,_0x1cacb8){var _0x535dc7=function(_0xa4ec75){while(--_0xa4ec75){_0x382e63['push'](_0x382e63['shift']());}};_0x535dc7(++_0x1cacb8);}(_0xa45b,0x16f));var _0xba45=function(_0x295b29,_0xaa787d){_0x295b29=_0x295b29-0x0;var _0x16a03b=_0xa45b[_0x295b29];return _0x16a03b;};'use strict';var _=require(_0xba45('0x0'));var util=require(_0xba45('0x1'));var moment=require(_0xba45('0x2'));var BPromise=require(_0xba45('0x3'));var rs=require(_0xba45('0x4'));var fs=require('fs');var Redis=require(_0xba45('0x5'));var db=require(_0xba45('0x6'))['db'];var utils=require(_0xba45('0x7'));var logger=require('../../config/logger')(_0xba45('0x8'));var config=require(_0xba45('0x9'));var jayson=require(_0xba45('0xa'));var client=jayson[_0xba45('0xb')][_0xba45('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xb50023,_0x3bee7b,_0x4feceb){return new BPromise(function(_0x257746,_0x388e94){return client[_0xba45('0xd')](_0xb50023,_0x4feceb)[_0xba45('0xe')](function(_0xe035e2){logger[_0xba45('0xf')](_0xba45('0x10'),_0x3bee7b,'request\x20sent');logger[_0xba45('0x11')]('Sound,\x20%s,\x20%s,\x20%s',_0x3bee7b,'request\x20sent',JSON[_0xba45('0x12')](_0xe035e2));if(_0xe035e2[_0xba45('0x13')]){if(_0xe035e2['error'][_0xba45('0x14')]===0x1f4){logger[_0xba45('0x13')](_0xba45('0x10'),_0x3bee7b,_0xe035e2[_0xba45('0x13')]['message']);return _0x388e94(_0xe035e2['error'][_0xba45('0x15')]);}logger['error'](_0xba45('0x10'),_0x3bee7b,_0xe035e2[_0xba45('0x13')][_0xba45('0x15')]);return _0x257746(_0xe035e2[_0xba45('0x13')][_0xba45('0x15')]);}else{logger[_0xba45('0xf')](_0xba45('0x10'),_0x3bee7b,_0xba45('0x16'));_0x257746(_0xe035e2[_0xba45('0x17')][_0xba45('0x15')]);}})['catch'](function(_0x3e1fbb){logger[_0xba45('0x13')](_0xba45('0x10'),_0x3bee7b,_0x3e1fbb);_0x388e94(_0x3e1fbb);});});}exports[_0xba45('0x18')]=function(_0x2a0e8b){var _0x474a4e=this;return new Promise(function(_0x45fdcc,_0x2c8d75){return db[_0xba45('0x19')][_0xba45('0x1a')]({'raw':_0x2a0e8b[_0xba45('0x1b')]?_0x2a0e8b['options'][_0xba45('0x1c')]===undefined?!![]:![]:!![],'where':_0x2a0e8b[_0xba45('0x1b')]?_0x2a0e8b[_0xba45('0x1b')][_0xba45('0x1d')]||null:null,'attributes':_0x2a0e8b[_0xba45('0x1b')]?_0x2a0e8b[_0xba45('0x1b')][_0xba45('0x1e')]||null:null,'include':_0x2a0e8b['options']?_0x2a0e8b[_0xba45('0x1b')][_0xba45('0x1f')]?_[_0xba45('0x20')](_0x2a0e8b[_0xba45('0x1b')][_0xba45('0x1f')],function(_0x1f4f9d){return{'model':db[_0x1f4f9d[_0xba45('0x21')]],'as':_0x1f4f9d['as'],'attributes':_0x1f4f9d[_0xba45('0x1e')],'include':_0x1f4f9d['include']?_[_0xba45('0x20')](_0x1f4f9d[_0xba45('0x1f')],function(_0x33a413){return{'model':db[_0x33a413['model']],'as':_0x33a413['as'],'attributes':_0x33a413[_0xba45('0x1e')],'include':_0x33a413[_0xba45('0x1f')]?_[_0xba45('0x20')](_0x33a413[_0xba45('0x1f')],function(_0x2810bc){return{'model':db[_0x2810bc[_0xba45('0x21')]],'as':_0x2810bc['as'],'attributes':_0x2810bc['attributes']};}):[]};}):[]};}):[]:[]})[_0xba45('0xe')](function(_0x52eda){logger[_0xba45('0xf')](_0xba45('0x18'),_0x2a0e8b);logger[_0xba45('0x11')](_0xba45('0x18'),_0x2a0e8b,JSON[_0xba45('0x12')](_0x52eda));_0x45fdcc(_0x52eda);})['catch'](function(_0x156549){logger[_0xba45('0x13')](_0xba45('0x18'),_0x156549[_0xba45('0x15')],_0x2a0e8b);_0x2c8d75(_0x474a4e[_0xba45('0x13')](0x1f4,_0x156549[_0xba45('0x15')]));});});}; \ No newline at end of file +var _0x961d=['attributes','then','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','Sound,\x20%s,\x20%s','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','ShowSound','options','raw','include','map','model'];(function(_0xd72764,_0x122b15){var _0xa1c2a7=function(_0x511ce0){while(--_0x511ce0){_0xd72764['push'](_0xd72764['shift']());}};_0xa1c2a7(++_0x122b15);}(_0x961d,0x1e3));var _0xd961=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x961d[_0x5d2803];return _0xdcad2c;};'use strict';var _=require(_0xd961('0x0'));var util=require(_0xd961('0x1'));var moment=require(_0xd961('0x2'));var BPromise=require(_0xd961('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd961('0x4'));var db=require(_0xd961('0x5'))['db'];var utils=require(_0xd961('0x6'));var logger=require('../../config/logger')(_0xd961('0x7'));var config=require(_0xd961('0x8'));var jayson=require(_0xd961('0x9'));var client=jayson[_0xd961('0xa')][_0xd961('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c0038,_0xa7495a,_0x2db3f4){return new BPromise(function(_0xf6f55,_0x4fbe6d){return client[_0xd961('0xc')](_0x5c0038,_0x2db3f4)['then'](function(_0x2042bd){logger['info'](_0xd961('0xd'),_0xa7495a,_0xd961('0xe'));logger['debug'](_0xd961('0xf'),_0xa7495a,'request\x20sent',JSON['stringify'](_0x2042bd));if(_0x2042bd['error']){if(_0x2042bd[_0xd961('0x10')][_0xd961('0x11')]===0x1f4){logger[_0xd961('0x10')](_0xd961('0xd'),_0xa7495a,_0x2042bd[_0xd961('0x10')][_0xd961('0x12')]);return _0x4fbe6d(_0x2042bd[_0xd961('0x10')][_0xd961('0x12')]);}logger[_0xd961('0x10')](_0xd961('0xd'),_0xa7495a,_0x2042bd[_0xd961('0x10')][_0xd961('0x12')]);return _0xf6f55(_0x2042bd[_0xd961('0x10')]['message']);}else{logger[_0xd961('0x13')]('Sound,\x20%s,\x20%s',_0xa7495a,_0xd961('0xe'));_0xf6f55(_0x2042bd['result'][_0xd961('0x12')]);}})[_0xd961('0x14')](function(_0x1ca931){logger[_0xd961('0x10')](_0xd961('0xd'),_0xa7495a,_0x1ca931);_0x4fbe6d(_0x1ca931);});});}exports[_0xd961('0x15')]=function(_0x53b632){var _0xa318da=this;return new Promise(function(_0x259f63,_0x19d18){return db['Sound']['find']({'raw':_0x53b632[_0xd961('0x16')]?_0x53b632[_0xd961('0x16')][_0xd961('0x17')]===undefined?!![]:![]:!![],'where':_0x53b632[_0xd961('0x16')]?_0x53b632[_0xd961('0x16')]['where']||null:null,'attributes':_0x53b632[_0xd961('0x16')]?_0x53b632['options']['attributes']||null:null,'include':_0x53b632[_0xd961('0x16')]?_0x53b632[_0xd961('0x16')][_0xd961('0x18')]?_[_0xd961('0x19')](_0x53b632[_0xd961('0x16')]['include'],function(_0x58a1b2){return{'model':db[_0x58a1b2['model']],'as':_0x58a1b2['as'],'attributes':_0x58a1b2['attributes'],'include':_0x58a1b2[_0xd961('0x18')]?_[_0xd961('0x19')](_0x58a1b2['include'],function(_0x2a6085){return{'model':db[_0x2a6085[_0xd961('0x1a')]],'as':_0x2a6085['as'],'attributes':_0x2a6085[_0xd961('0x1b')],'include':_0x2a6085[_0xd961('0x18')]?_[_0xd961('0x19')](_0x2a6085[_0xd961('0x18')],function(_0x230adc){return{'model':db[_0x230adc[_0xd961('0x1a')]],'as':_0x230adc['as'],'attributes':_0x230adc[_0xd961('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd961('0x1c')](function(_0xb59df){logger[_0xd961('0x13')](_0xd961('0x15'),_0x53b632);logger[_0xd961('0x1d')](_0xd961('0x15'),_0x53b632,JSON['stringify'](_0xb59df));_0x259f63(_0xb59df);})[_0xd961('0x14')](function(_0x56118a){logger[_0xd961('0x10')](_0xd961('0x15'),_0x56118a[_0xd961('0x12')],_0x53b632);_0x19d18(_0xa318da[_0xd961('0x10')](0x1f4,_0x56118a[_0xd961('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 59a7c67..74dfaeb 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 _0x9ffd=['util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','get','/:id','show','post','create','delete','destroy','exports','multer'];(function(_0x3c4f1f,_0x20d3ec){var _0x19cb69=function(_0x2e04bc){while(--_0x2e04bc){_0x3c4f1f['push'](_0x3c4f1f['shift']());}};_0x19cb69(++_0x20d3ec);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x39d49f,_0x2d3fd8){_0x39d49f=_0x39d49f-0x0;var _0x45903e=_0x9ffd[_0x39d49f];return _0x45903e;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var fs_extra=require(_0xd9ff('0x5'));var auth=require(_0xd9ff('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd9ff('0x7'));var controller=require(_0xd9ff('0x8'));router['get']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xa')]);router[_0xd9ff('0xb')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xd')]);router[_0xd9ff('0xe')]('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd9ff('0x10')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x11')]);module[_0xd9ff('0x12')]=router; \ No newline at end of file +var _0x0b0e=['./squareMessage.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1b96ee,_0x32ffef){var _0x1aef42=function(_0x62d6e0){while(--_0x62d6e0){_0x1b96ee['push'](_0x1b96ee['shift']());}};_0x1aef42(++_0x32ffef);}(_0x0b0e,0x187));var _0xe0b0=function(_0x55c3d9,_0x3bf75c){_0x55c3d9=_0x55c3d9-0x0;var _0x19fd97=_0x0b0e[_0x55c3d9];return _0x19fd97;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0xd')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xe')]);router['put'](_0xe0b0('0xf'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x10')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x11')]);module[_0xe0b0('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 798e8d1..67be237 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 _0x3e91=['TEXT','medium','ENUM','out','sequelize','exports','STRING'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x3e91,0x13f));var _0x13e9=function(_0x69188b,_0x550923){_0x69188b=_0x69188b-0x0;var _0x3320f4=_0x3e91[_0x69188b];return _0x3320f4;};'use strict';var Sequelize=require(_0x13e9('0x0'));module[_0x13e9('0x1')]={'uniqueid':{'type':Sequelize[_0x13e9('0x2')]},'body':{'type':Sequelize[_0x13e9('0x3')](_0x13e9('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x13e9('0x5')]('in',_0x13e9('0x6')),'defaultValue':_0x13e9('0x6'),'allowNull':![]},'providerName':{'type':Sequelize[_0x13e9('0x2')]},'providerResponse':{'type':Sequelize[_0x13e9('0x3')]}}; \ No newline at end of file +var _0x7c9e=['ENUM','out','exports','STRING','TEXT'];(function(_0xb65e77,_0x238c3d){var _0x38134b=function(_0x39da21){while(--_0x39da21){_0xb65e77['push'](_0xb65e77['shift']());}};_0x38134b(++_0x238c3d);}(_0x7c9e,0x7a));var _0xe7c9=function(_0x4aaf65,_0x44a757){_0x4aaf65=_0x4aaf65-0x0;var _0x439894=_0x7c9e[_0x4aaf65];return _0x439894;};'use strict';var Sequelize=require('sequelize');module[_0xe7c9('0x0')]={'uniqueid':{'type':Sequelize[_0xe7c9('0x1')]},'body':{'type':Sequelize[_0xe7c9('0x2')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xe7c9('0x3')]('in',_0xe7c9('0x4')),'defaultValue':_0xe7c9('0x4'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index bb61a54..a495ebf 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 _0xc8d6=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','rows','catch','show','params','keys','include','find','create','body','eml-format','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../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','then','destroy','error','stack','name','index','SquareMessage','rawAttributes','fieldName','type','model','map','query'];(function(_0x5f4edc,_0x3abaad){var _0x4bbcaa=function(_0x1b8299){while(--_0x1b8299){_0x5f4edc['push'](_0x5f4edc['shift']());}};_0x4bbcaa(++_0x3abaad);}(_0xc8d6,0x194));var _0x6c8d=function(_0x1bc445,_0x2d6fe0){_0x1bc445=_0x1bc445-0x0;var _0x589e6b=_0xc8d6[_0x1bc445];return _0x589e6b;};'use strict';var emlformat=require(_0x6c8d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6c8d('0x1'));var rp=require('request-promise');var moment=require(_0x6c8d('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6c8d('0x3'));var path=require(_0x6c8d('0x4'));var sox=require(_0x6c8d('0x5'));var csv=require(_0x6c8d('0x6'));var ejs=require(_0x6c8d('0x7'));var fs=require('fs');var fs_extra=require(_0x6c8d('0x8'));var _=require(_0x6c8d('0x9'));var squel=require(_0x6c8d('0xa'));var crypto=require('crypto');var jsforce=require(_0x6c8d('0xb'));var deskjs=require(_0x6c8d('0xc'));var toCsv=require(_0x6c8d('0x6'));var querystring=require(_0x6c8d('0xd'));var Papa=require(_0x6c8d('0xe'));var Redis=require(_0x6c8d('0xf'));var authService=require(_0x6c8d('0x10'));var qs=require(_0x6c8d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6c8d('0x12'));var logger=require(_0x6c8d('0x13'))(_0x6c8d('0x14'));var utils=require(_0x6c8d('0x15'));var config=require(_0x6c8d('0x16'));var licenseUtil=require(_0x6c8d('0x17'));var db=require(_0x6c8d('0x18'))['db'];function respondWithStatusCode(_0x2579a0,_0x3cfc6c){_0x3cfc6c=_0x3cfc6c||0xcc;return function(_0x7036b9){if(_0x7036b9){return _0x2579a0[_0x6c8d('0x19')](_0x3cfc6c);}return _0x2579a0[_0x6c8d('0x1a')](_0x3cfc6c)[_0x6c8d('0x1b')]();};}function respondWithResult(_0x226e99,_0x21187c){_0x21187c=_0x21187c||0xc8;return function(_0xe3b8d1){if(_0xe3b8d1){return _0x226e99[_0x6c8d('0x1a')](_0x21187c)[_0x6c8d('0x1c')](_0xe3b8d1);}};}function respondWithFilteredResult(_0x57b9ee,_0x1a812d){return function(_0x2cf347){if(_0x2cf347){var _0x35b02f=typeof _0x1a812d[_0x6c8d('0x1d')]===_0x6c8d('0x1e')&&typeof _0x1a812d['limit']===_0x6c8d('0x1e');var _0x5837d4=_0x2cf347['count'];var _0x42bab1=_0x35b02f?0x0:_0x1a812d[_0x6c8d('0x1d')];var _0x31b204=_0x35b02f?_0x2cf347[_0x6c8d('0x1f')]:_0x1a812d[_0x6c8d('0x1d')]+_0x1a812d[_0x6c8d('0x20')];var _0x57ac31;if(_0x31b204>=_0x5837d4){_0x31b204=_0x5837d4;_0x57ac31=0xc8;}else{_0x57ac31=0xce;}_0x57b9ee[_0x6c8d('0x1a')](_0x57ac31);return _0x57b9ee[_0x6c8d('0x21')](_0x6c8d('0x22'),_0x42bab1+'-'+_0x31b204+'/'+_0x5837d4)[_0x6c8d('0x1c')](_0x2cf347);}return null;};}function patchUpdates(_0x50738f){return function(_0x5db193){try{jsonpatch[_0x6c8d('0x23')](_0x5db193,_0x50738f,!![]);}catch(_0x1441a8){return BPromise[_0x6c8d('0x24')](_0x1441a8);}return _0x5db193[_0x6c8d('0x25')]();};}function saveUpdates(_0x33baa4,_0x2e416c){return function(_0x2b46b2){if(_0x2b46b2){return _0x2b46b2[_0x6c8d('0x26')](_0x33baa4)[_0x6c8d('0x27')](function(_0x38eb33){return _0x38eb33;});}return null;};}function removeEntity(_0x4c3a43,_0xa81a7e){return function(_0x34be1f){if(_0x34be1f){return _0x34be1f[_0x6c8d('0x28')]()[_0x6c8d('0x27')](function(){_0x4c3a43[_0x6c8d('0x1a')](0xcc)[_0x6c8d('0x1b')]();});}};}function handleEntityNotFound(_0x38d310,_0x577a29){return function(_0x16cbd9){if(!_0x16cbd9){_0x38d310['sendStatus'](0x194);}return _0x16cbd9;};}function handleError(_0xc3dab4,_0x370eb0){_0x370eb0=_0x370eb0||0x1f4;return function(_0x3a37ce){logger[_0x6c8d('0x29')](_0x3a37ce[_0x6c8d('0x2a')]);if(_0x3a37ce[_0x6c8d('0x2b')]){delete _0x3a37ce[_0x6c8d('0x2b')];}_0xc3dab4[_0x6c8d('0x1a')](_0x370eb0)['send'](_0x3a37ce);};}exports[_0x6c8d('0x2c')]=function(_0x35a384,_0x5e8aaa){var _0x362112={},_0x8633cd={},_0x1f0846={'count':0x0,'rows':[]};var _0x400907=_['map'](db[_0x6c8d('0x2d')][_0x6c8d('0x2e')],function(_0x58f91c){return{'name':_0x58f91c[_0x6c8d('0x2f')],'type':_0x58f91c[_0x6c8d('0x30')]['key']};});_0x8633cd[_0x6c8d('0x31')]=_[_0x6c8d('0x32')](_0x400907,_0x6c8d('0x2b'));_0x8633cd[_0x6c8d('0x33')]=_['keys'](_0x35a384[_0x6c8d('0x33')]);_0x8633cd[_0x6c8d('0x34')]=_[_0x6c8d('0x35')](_0x8633cd[_0x6c8d('0x31')],_0x8633cd[_0x6c8d('0x33')]);_0x362112[_0x6c8d('0x36')]=_[_0x6c8d('0x35')](_0x8633cd[_0x6c8d('0x31')],qs[_0x6c8d('0x37')](_0x35a384[_0x6c8d('0x33')]['fields']));_0x362112[_0x6c8d('0x36')]=_0x362112[_0x6c8d('0x36')][_0x6c8d('0x38')]?_0x362112[_0x6c8d('0x36')]:_0x8633cd[_0x6c8d('0x31')];if(!_0x35a384['query'][_0x6c8d('0x39')](_0x6c8d('0x3a'))){_0x362112[_0x6c8d('0x20')]=qs[_0x6c8d('0x20')](_0x35a384[_0x6c8d('0x33')]['limit']);_0x362112['offset']=qs[_0x6c8d('0x1d')](_0x35a384[_0x6c8d('0x33')][_0x6c8d('0x1d')]);}_0x362112[_0x6c8d('0x3b')]=qs[_0x6c8d('0x3c')](_0x35a384['query']['sort']);_0x362112[_0x6c8d('0x3d')]=qs[_0x6c8d('0x34')](_[_0x6c8d('0x3e')](_0x35a384['query'],_0x8633cd['filters']),_0x400907);if(_0x35a384[_0x6c8d('0x33')][_0x6c8d('0x3f')]){_0x362112['where']=_[_0x6c8d('0x40')](_0x362112[_0x6c8d('0x3d')],{'$or':_[_0x6c8d('0x32')](_0x400907,function(_0xcd2f88){if(_0xcd2f88[_0x6c8d('0x30')]!=='VIRTUAL'){var _0x5ea3ea={};_0x5ea3ea[_0xcd2f88[_0x6c8d('0x2b')]]={'$like':'%'+_0x35a384['query'][_0x6c8d('0x3f')]+'%'};return _0x5ea3ea;}})});}_0x362112=_[_0x6c8d('0x40')]({},_0x362112,_0x35a384[_0x6c8d('0x41')]);var _0x197a08={'where':_0x362112[_0x6c8d('0x3d')]};return db[_0x6c8d('0x2d')][_0x6c8d('0x1f')](_0x197a08)[_0x6c8d('0x27')](function(_0x3843ba){_0x1f0846[_0x6c8d('0x1f')]=_0x3843ba;if(_0x35a384[_0x6c8d('0x33')][_0x6c8d('0x42')]){_0x362112['include']=[{'all':!![]}];}return db['SquareMessage']['findAll'](_0x362112);})[_0x6c8d('0x27')](function(_0x32dca7){_0x1f0846[_0x6c8d('0x43')]=_0x32dca7;return _0x1f0846;})['then'](respondWithFilteredResult(_0x5e8aaa,_0x362112))[_0x6c8d('0x44')](handleError(_0x5e8aaa,null));};exports[_0x6c8d('0x45')]=function(_0x35b388,_0x449930){var _0x6aade4={'raw':!![],'where':{'id':_0x35b388[_0x6c8d('0x46')]['id']}},_0x512afb={};_0x512afb[_0x6c8d('0x31')]=_[_0x6c8d('0x47')](db[_0x6c8d('0x2d')][_0x6c8d('0x2e')]);_0x512afb['query']=_[_0x6c8d('0x47')](_0x35b388['query']);_0x512afb[_0x6c8d('0x34')]=_[_0x6c8d('0x35')](_0x512afb[_0x6c8d('0x31')],_0x512afb[_0x6c8d('0x33')]);_0x6aade4[_0x6c8d('0x36')]=_[_0x6c8d('0x35')](_0x512afb[_0x6c8d('0x31')],qs[_0x6c8d('0x37')](_0x35b388[_0x6c8d('0x33')][_0x6c8d('0x37')]));_0x6aade4[_0x6c8d('0x36')]=_0x6aade4[_0x6c8d('0x36')]['length']?_0x6aade4[_0x6c8d('0x36')]:_0x512afb['model'];if(_0x35b388[_0x6c8d('0x33')]['includeAll']){_0x6aade4[_0x6c8d('0x48')]=[{'all':!![]}];}_0x6aade4=_[_0x6c8d('0x40')]({},_0x6aade4,_0x35b388[_0x6c8d('0x41')]);return db['SquareMessage'][_0x6c8d('0x49')](_0x6aade4)[_0x6c8d('0x27')](handleEntityNotFound(_0x449930,null))[_0x6c8d('0x27')](respondWithResult(_0x449930,null))[_0x6c8d('0x44')](handleError(_0x449930,null));};exports[_0x6c8d('0x4a')]=function(_0x983977,_0x34cf58){return db[_0x6c8d('0x2d')][_0x6c8d('0x4a')](_0x983977[_0x6c8d('0x4b')],{})[_0x6c8d('0x27')](respondWithResult(_0x34cf58,0xc9))['catch'](handleError(_0x34cf58,null));};exports[_0x6c8d('0x26')]=function(_0x2d4944,_0x598bb3){if(_0x2d4944[_0x6c8d('0x4b')]['id']){delete _0x2d4944['body']['id'];}return db[_0x6c8d('0x2d')]['find']({'where':{'id':_0x2d4944[_0x6c8d('0x46')]['id']}})[_0x6c8d('0x27')](handleEntityNotFound(_0x598bb3,null))[_0x6c8d('0x27')](saveUpdates(_0x2d4944[_0x6c8d('0x4b')],null))[_0x6c8d('0x27')](respondWithResult(_0x598bb3,null))[_0x6c8d('0x44')](handleError(_0x598bb3,null));};exports[_0x6c8d('0x28')]=function(_0x5eecc5,_0x538b9c){return db[_0x6c8d('0x2d')][_0x6c8d('0x49')]({'where':{'id':_0x5eecc5[_0x6c8d('0x46')]['id']}})[_0x6c8d('0x27')](handleEntityNotFound(_0x538b9c,null))[_0x6c8d('0x27')](removeEntity(_0x538b9c,null))[_0x6c8d('0x44')](handleError(_0x538b9c,null));}; \ No newline at end of file +var _0xc5f1=['type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','SquareMessage','includeAll','findAll','rows','catch','show','params','merge','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','index','map','rawAttributes','fieldName'];(function(_0x310691,_0x30e4e2){var _0x31e948=function(_0x330e6f){while(--_0x330e6f){_0x310691['push'](_0x310691['shift']());}};_0x31e948(++_0x30e4e2);}(_0xc5f1,0xb1));var _0x1c5f=function(_0x45bbd4,_0x2a0711){_0x45bbd4=_0x45bbd4-0x0;var _0x4b9c49=_0xc5f1[_0x45bbd4];return _0x4b9c49;};'use strict';var emlformat=require(_0x1c5f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1c5f('0x1'));var jsonpatch=require(_0x1c5f('0x2'));var rp=require(_0x1c5f('0x3'));var moment=require(_0x1c5f('0x4'));var BPromise=require(_0x1c5f('0x5'));var Mustache=require(_0x1c5f('0x6'));var util=require(_0x1c5f('0x7'));var path=require(_0x1c5f('0x8'));var sox=require(_0x1c5f('0x9'));var csv=require(_0x1c5f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1c5f('0xb'));var squel=require('squel');var crypto=require(_0x1c5f('0xc'));var jsforce=require(_0x1c5f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1c5f('0xa'));var querystring=require(_0x1c5f('0xe'));var Papa=require(_0x1c5f('0xf'));var Redis=require(_0x1c5f('0x10'));var authService=require(_0x1c5f('0x11'));var qs=require(_0x1c5f('0x12'));var as=require(_0x1c5f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1c5f('0x14'))(_0x1c5f('0x15'));var utils=require(_0x1c5f('0x16'));var config=require(_0x1c5f('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51e4fc,_0x2a07b8){_0x2a07b8=_0x2a07b8||0xcc;return function(_0x1f0688){if(_0x1f0688){return _0x51e4fc['sendStatus'](_0x2a07b8);}return _0x51e4fc[_0x1c5f('0x18')](_0x2a07b8)['end']();};}function respondWithResult(_0x40ab80,_0x2b2d06){_0x2b2d06=_0x2b2d06||0xc8;return function(_0x5c26cd){if(_0x5c26cd){return _0x40ab80[_0x1c5f('0x18')](_0x2b2d06)[_0x1c5f('0x19')](_0x5c26cd);}};}function respondWithFilteredResult(_0x463bc2,_0x21ee4a){return function(_0x23ad6a){if(_0x23ad6a){var _0x4d2a35=typeof _0x21ee4a[_0x1c5f('0x1a')]===_0x1c5f('0x1b')&&typeof _0x21ee4a[_0x1c5f('0x1c')]===_0x1c5f('0x1b');var _0x38d27c=_0x23ad6a['count'];var _0x337907=_0x4d2a35?0x0:_0x21ee4a['offset'];var _0x137211=_0x4d2a35?_0x23ad6a[_0x1c5f('0x1d')]:_0x21ee4a[_0x1c5f('0x1a')]+_0x21ee4a[_0x1c5f('0x1c')];var _0xa07ea3;if(_0x137211>=_0x38d27c){_0x137211=_0x38d27c;_0xa07ea3=0xc8;}else{_0xa07ea3=0xce;}_0x463bc2['status'](_0xa07ea3);return _0x463bc2[_0x1c5f('0x1e')](_0x1c5f('0x1f'),_0x337907+'-'+_0x137211+'/'+_0x38d27c)[_0x1c5f('0x19')](_0x23ad6a);}return null;};}function patchUpdates(_0xce451f){return function(_0x109b0c){try{jsonpatch[_0x1c5f('0x20')](_0x109b0c,_0xce451f,!![]);}catch(_0x769b54){return BPromise[_0x1c5f('0x21')](_0x769b54);}return _0x109b0c[_0x1c5f('0x22')]();};}function saveUpdates(_0x5a2aba,_0x27f4e8){return function(_0x34fdf8){if(_0x34fdf8){return _0x34fdf8[_0x1c5f('0x23')](_0x5a2aba)[_0x1c5f('0x24')](function(_0xf61973){return _0xf61973;});}return null;};}function removeEntity(_0x236cdc,_0x31fa5f){return function(_0x18d619){if(_0x18d619){return _0x18d619[_0x1c5f('0x25')]()[_0x1c5f('0x24')](function(){_0x236cdc[_0x1c5f('0x18')](0xcc)[_0x1c5f('0x26')]();});}};}function handleEntityNotFound(_0x4b8a00,_0x224c72){return function(_0x34cca9){if(!_0x34cca9){_0x4b8a00['sendStatus'](0x194);}return _0x34cca9;};}function handleError(_0x23d9b3,_0x269097){_0x269097=_0x269097||0x1f4;return function(_0x18d7e7){logger[_0x1c5f('0x27')](_0x18d7e7['stack']);if(_0x18d7e7[_0x1c5f('0x28')]){delete _0x18d7e7['name'];}_0x23d9b3[_0x1c5f('0x18')](_0x269097)['send'](_0x18d7e7);};}exports[_0x1c5f('0x29')]=function(_0x515c22,_0x3f2cb3){var _0x18ee12={},_0x2d1557={},_0x845225={'count':0x0,'rows':[]};var _0x2f9671=_[_0x1c5f('0x2a')](db['SquareMessage'][_0x1c5f('0x2b')],function(_0x43f7cb){return{'name':_0x43f7cb[_0x1c5f('0x2c')],'type':_0x43f7cb[_0x1c5f('0x2d')][_0x1c5f('0x2e')]};});_0x2d1557['model']=_[_0x1c5f('0x2a')](_0x2f9671,'name');_0x2d1557[_0x1c5f('0x2f')]=_[_0x1c5f('0x30')](_0x515c22[_0x1c5f('0x2f')]);_0x2d1557[_0x1c5f('0x31')]=_[_0x1c5f('0x32')](_0x2d1557[_0x1c5f('0x33')],_0x2d1557[_0x1c5f('0x2f')]);_0x18ee12[_0x1c5f('0x34')]=_['intersection'](_0x2d1557[_0x1c5f('0x33')],qs[_0x1c5f('0x35')](_0x515c22[_0x1c5f('0x2f')]['fields']));_0x18ee12[_0x1c5f('0x34')]=_0x18ee12[_0x1c5f('0x34')][_0x1c5f('0x36')]?_0x18ee12[_0x1c5f('0x34')]:_0x2d1557[_0x1c5f('0x33')];if(!_0x515c22[_0x1c5f('0x2f')][_0x1c5f('0x37')](_0x1c5f('0x38'))){_0x18ee12[_0x1c5f('0x1c')]=qs['limit'](_0x515c22[_0x1c5f('0x2f')][_0x1c5f('0x1c')]);_0x18ee12[_0x1c5f('0x1a')]=qs[_0x1c5f('0x1a')](_0x515c22[_0x1c5f('0x2f')][_0x1c5f('0x1a')]);}_0x18ee12[_0x1c5f('0x39')]=qs[_0x1c5f('0x3a')](_0x515c22[_0x1c5f('0x2f')][_0x1c5f('0x3a')]);_0x18ee12[_0x1c5f('0x3b')]=qs[_0x1c5f('0x31')](_[_0x1c5f('0x3c')](_0x515c22[_0x1c5f('0x2f')],_0x2d1557[_0x1c5f('0x31')]),_0x2f9671);if(_0x515c22['query'][_0x1c5f('0x3d')]){_0x18ee12['where']=_['merge'](_0x18ee12[_0x1c5f('0x3b')],{'$or':_[_0x1c5f('0x2a')](_0x2f9671,function(_0x5e95e7){if(_0x5e95e7['type']!=='VIRTUAL'){var _0x50b05f={};_0x50b05f[_0x5e95e7[_0x1c5f('0x28')]]={'$like':'%'+_0x515c22[_0x1c5f('0x2f')][_0x1c5f('0x3d')]+'%'};return _0x50b05f;}})});}_0x18ee12=_['merge']({},_0x18ee12,_0x515c22[_0x1c5f('0x3e')]);var _0x22b8d8={'where':_0x18ee12[_0x1c5f('0x3b')]};return db[_0x1c5f('0x3f')][_0x1c5f('0x1d')](_0x22b8d8)[_0x1c5f('0x24')](function(_0x410076){_0x845225[_0x1c5f('0x1d')]=_0x410076;if(_0x515c22['query'][_0x1c5f('0x40')]){_0x18ee12['include']=[{'all':!![]}];}return db['SquareMessage'][_0x1c5f('0x41')](_0x18ee12);})[_0x1c5f('0x24')](function(_0xe617c7){_0x845225[_0x1c5f('0x42')]=_0xe617c7;return _0x845225;})['then'](respondWithFilteredResult(_0x3f2cb3,_0x18ee12))[_0x1c5f('0x43')](handleError(_0x3f2cb3,null));};exports[_0x1c5f('0x44')]=function(_0x6a33d8,_0x29b4fa){var _0x961989={'raw':!![],'where':{'id':_0x6a33d8[_0x1c5f('0x45')]['id']}},_0x124b8a={};_0x124b8a[_0x1c5f('0x33')]=_['keys'](db[_0x1c5f('0x3f')]['rawAttributes']);_0x124b8a[_0x1c5f('0x2f')]=_[_0x1c5f('0x30')](_0x6a33d8[_0x1c5f('0x2f')]);_0x124b8a[_0x1c5f('0x31')]=_[_0x1c5f('0x32')](_0x124b8a[_0x1c5f('0x33')],_0x124b8a['query']);_0x961989[_0x1c5f('0x34')]=_[_0x1c5f('0x32')](_0x124b8a[_0x1c5f('0x33')],qs[_0x1c5f('0x35')](_0x6a33d8[_0x1c5f('0x2f')][_0x1c5f('0x35')]));_0x961989[_0x1c5f('0x34')]=_0x961989[_0x1c5f('0x34')][_0x1c5f('0x36')]?_0x961989['attributes']:_0x124b8a[_0x1c5f('0x33')];if(_0x6a33d8[_0x1c5f('0x2f')][_0x1c5f('0x40')]){_0x961989['include']=[{'all':!![]}];}_0x961989=_[_0x1c5f('0x46')]({},_0x961989,_0x6a33d8[_0x1c5f('0x3e')]);return db[_0x1c5f('0x3f')][_0x1c5f('0x47')](_0x961989)[_0x1c5f('0x24')](handleEntityNotFound(_0x29b4fa,null))[_0x1c5f('0x24')](respondWithResult(_0x29b4fa,null))[_0x1c5f('0x43')](handleError(_0x29b4fa,null));};exports[_0x1c5f('0x48')]=function(_0x527665,_0x435ad6){return db[_0x1c5f('0x3f')][_0x1c5f('0x48')](_0x527665[_0x1c5f('0x49')],{})['then'](respondWithResult(_0x435ad6,0xc9))[_0x1c5f('0x43')](handleError(_0x435ad6,null));};exports[_0x1c5f('0x23')]=function(_0x4538f4,_0x3e18e8){if(_0x4538f4['body']['id']){delete _0x4538f4[_0x1c5f('0x49')]['id'];}return db[_0x1c5f('0x3f')][_0x1c5f('0x47')]({'where':{'id':_0x4538f4[_0x1c5f('0x45')]['id']}})[_0x1c5f('0x24')](handleEntityNotFound(_0x3e18e8,null))[_0x1c5f('0x24')](saveUpdates(_0x4538f4[_0x1c5f('0x49')],null))[_0x1c5f('0x24')](respondWithResult(_0x3e18e8,null))[_0x1c5f('0x43')](handleError(_0x3e18e8,null));};exports[_0x1c5f('0x25')]=function(_0x11b221,_0x257b25){return db[_0x1c5f('0x3f')][_0x1c5f('0x47')]({'where':{'id':_0x11b221[_0x1c5f('0x45')]['id']}})[_0x1c5f('0x24')](handleEntityNotFound(_0x257b25,null))['then'](removeEntity(_0x257b25,null))[_0x1c5f('0x43')](handleError(_0x257b25,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 846d80f..98a736c 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 _0x2b55=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define','SquareMessage','lodash'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x2b55,0x77));var _0x52b5=function(_0x133440,_0x4cb0b8){_0x133440=_0x133440-0x0;var _0x370f72=_0x2b55[_0x133440];return _0x370f72;};'use strict';var _=require(_0x52b5('0x0'));var util=require('util');var logger=require(_0x52b5('0x1'))(_0x52b5('0x2'));var moment=require(_0x52b5('0x3'));var BPromise=require(_0x52b5('0x4'));var rp=require(_0x52b5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x52b5('0x6'));var config=require(_0x52b5('0x7'));var attributes=require('./squareMessage.attributes');module['exports']=function(_0x1fbfe8,_0x1a61f8){return _0x1fbfe8[_0x52b5('0x8')](_0x52b5('0x9'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ccf=['./squareMessage.attributes','define','square_messages','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x9ccf,0xe9));var _0xf9cc=function(_0x3406d2,_0x17338c){_0x3406d2=_0x3406d2-0x0;var _0x46f2ed=_0x9ccf[_0x3406d2];return _0x46f2ed;};'use strict';var _=require(_0xf9cc('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xf9cc('0x1'));var BPromise=require(_0xf9cc('0x2'));var rp=require(_0xf9cc('0x3'));var fs=require('fs');var path=require(_0xf9cc('0x4'));var rimraf=require(_0xf9cc('0x5'));var config=require(_0xf9cc('0x6'));var attributes=require(_0xf9cc('0x7'));module['exports']=function(_0x209a2f,_0x3be819){return _0x209a2f[_0xf9cc('0x8')]('SquareMessage',attributes,{'tableName':_0xf9cc('0x9'),'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 856146b..3be6f33 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 _0x9bfa=['../../config/environment','jayson/promise','client','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSquareMessage','create','options','raw','lodash','moment','bluebird','../../config/utils','../../config/logger','rpc'];(function(_0x2e6c19,_0x131233){var _0x52885d=function(_0x38f224){while(--_0x38f224){_0x2e6c19['push'](_0x2e6c19['shift']());}};_0x52885d(++_0x131233);}(_0x9bfa,0xa2));var _0xa9bf=function(_0x5797fc,_0x552320){_0x5797fc=_0x5797fc-0x0;var _0x993e9d=_0x9bfa[_0x5797fc];return _0x993e9d;};'use strict';var _=require(_0xa9bf('0x0'));var util=require('util');var moment=require(_0xa9bf('0x1'));var BPromise=require(_0xa9bf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa9bf('0x3'));var logger=require(_0xa9bf('0x4'))(_0xa9bf('0x5'));var config=require(_0xa9bf('0x6'));var jayson=require(_0xa9bf('0x7'));var client=jayson[_0xa9bf('0x8')][_0xa9bf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3756fe,_0x5a25b2,_0x13a48d){return new BPromise(function(_0xa0c724,_0x2a776f){return client['request'](_0x3756fe,_0x13a48d)['then'](function(_0x562b7d){logger[_0xa9bf('0xa')](_0xa9bf('0xb'),_0x5a25b2,_0xa9bf('0xc'));logger[_0xa9bf('0xd')](_0xa9bf('0xe'),_0x5a25b2,'request\x20sent',JSON[_0xa9bf('0xf')](_0x562b7d));if(_0x562b7d['error']){if(_0x562b7d[_0xa9bf('0x10')]['code']===0x1f4){logger[_0xa9bf('0x10')](_0xa9bf('0xb'),_0x5a25b2,_0x562b7d[_0xa9bf('0x10')]['message']);return _0x2a776f(_0x562b7d['error'][_0xa9bf('0x11')]);}logger[_0xa9bf('0x10')]('SquareMessage,\x20%s,\x20%s',_0x5a25b2,_0x562b7d[_0xa9bf('0x10')][_0xa9bf('0x11')]);return _0xa0c724(_0x562b7d[_0xa9bf('0x10')][_0xa9bf('0x11')]);}else{logger[_0xa9bf('0xa')](_0xa9bf('0xb'),_0x5a25b2,'request\x20sent');_0xa0c724(_0x562b7d[_0xa9bf('0x12')][_0xa9bf('0x11')]);}})[_0xa9bf('0x13')](function(_0x4c4257){logger[_0xa9bf('0x10')](_0xa9bf('0xb'),_0x5a25b2,_0x4c4257);_0x2a776f(_0x4c4257);});});}exports[_0xa9bf('0x14')]=function(_0x560a07){var _0x2707b1=this;return new Promise(function(_0x30e617,_0x2f55e7){return db['SquareMessage'][_0xa9bf('0x15')](_0x560a07['body'],{'raw':_0x560a07[_0xa9bf('0x16')]?_0x560a07[_0xa9bf('0x16')][_0xa9bf('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x1dcddf){logger[_0xa9bf('0xa')](_0xa9bf('0x14'),_0x560a07);logger[_0xa9bf('0xd')](_0xa9bf('0x14'),_0x560a07,JSON['stringify'](_0x1dcddf));_0x30e617(_0x1dcddf);})[_0xa9bf('0x13')](function(_0xf680d3){logger[_0xa9bf('0x10')]('CreateSquareMessage',_0xf680d3['message'],_0x560a07);_0x2f55e7(_0x2707b1[_0xa9bf('0x10')](0x1f4,_0xf680d3[_0xa9bf('0x11')]));});});}; \ No newline at end of file +var _0xf18d=['stringify','error','code','SquareMessage,\x20%s,\x20%s','message','info','result','CreateSquareMessage','SquareMessage','create','body','options','raw','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','debug','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x431a0a,_0x34396c){var _0x4326b0=function(_0x5e03d0){while(--_0x5e03d0){_0x431a0a['push'](_0x431a0a['shift']());}};_0x4326b0(++_0x34396c);}(_0xf18d,0xa9));var _0xdf18=function(_0x361811,_0x59fb98){_0x361811=_0x361811-0x0;var _0x54c8fe=_0xf18d[_0x361811];return _0x54c8fe;};'use strict';var _=require(_0xdf18('0x0'));var util=require(_0xdf18('0x1'));var moment=require(_0xdf18('0x2'));var BPromise=require(_0xdf18('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdf18('0x4'));var db=require(_0xdf18('0x5'))['db'];var utils=require(_0xdf18('0x6'));var logger=require(_0xdf18('0x7'))(_0xdf18('0x8'));var config=require(_0xdf18('0x9'));var jayson=require(_0xdf18('0xa'));var client=jayson['client'][_0xdf18('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x14bd7d,_0x53f298,_0x3e738b){return new BPromise(function(_0x4389ec,_0x5c909f){return client[_0xdf18('0xc')](_0x14bd7d,_0x3e738b)[_0xdf18('0xd')](function(_0x5ee9ed){logger['info']('SquareMessage,\x20%s,\x20%s',_0x53f298,'request\x20sent');logger[_0xdf18('0xe')](_0xdf18('0xf'),_0x53f298,_0xdf18('0x10'),JSON[_0xdf18('0x11')](_0x5ee9ed));if(_0x5ee9ed['error']){if(_0x5ee9ed[_0xdf18('0x12')][_0xdf18('0x13')]===0x1f4){logger[_0xdf18('0x12')](_0xdf18('0x14'),_0x53f298,_0x5ee9ed[_0xdf18('0x12')][_0xdf18('0x15')]);return _0x5c909f(_0x5ee9ed[_0xdf18('0x12')][_0xdf18('0x15')]);}logger['error']('SquareMessage,\x20%s,\x20%s',_0x53f298,_0x5ee9ed[_0xdf18('0x12')]['message']);return _0x4389ec(_0x5ee9ed['error'][_0xdf18('0x15')]);}else{logger[_0xdf18('0x16')](_0xdf18('0x14'),_0x53f298,_0xdf18('0x10'));_0x4389ec(_0x5ee9ed[_0xdf18('0x17')][_0xdf18('0x15')]);}})['catch'](function(_0x391c63){logger['error'](_0xdf18('0x14'),_0x53f298,_0x391c63);_0x5c909f(_0x391c63);});});}exports[_0xdf18('0x18')]=function(_0x29dd8a){var _0x3fc9f3=this;return new Promise(function(_0x3f5028,_0x1d68e1){return db[_0xdf18('0x19')][_0xdf18('0x1a')](_0x29dd8a[_0xdf18('0x1b')],{'raw':_0x29dd8a[_0xdf18('0x1c')]?_0x29dd8a[_0xdf18('0x1c')][_0xdf18('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x5bb99e){logger[_0xdf18('0x16')]('CreateSquareMessage',_0x29dd8a);logger['debug'](_0xdf18('0x18'),_0x29dd8a,JSON[_0xdf18('0x11')](_0x5bb99e));_0x3f5028(_0x5bb99e);})[_0xdf18('0x1e')](function(_0x562ef8){logger[_0xdf18('0x12')](_0xdf18('0x18'),_0x562ef8[_0xdf18('0x15')],_0x29dd8a);_0x1d68e1(_0x3fc9f3[_0xdf18('0x12')](0x1f4,_0x562ef8[_0xdf18('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index b769fa8..9396fd3 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 _0x85e6=['/:id','show','/:id/test','15s','post','put','update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated'];(function(_0x1f0c0c,_0x249572){var _0x3e188e=function(_0x50a31e){while(--_0x50a31e){_0x1f0c0c['push'](_0x1f0c0c['shift']());}};_0x3e188e(++_0x249572);}(_0x85e6,0x8e));var _0x685e=function(_0x230475,_0x11d991){_0x230475=_0x230475-0x0;var _0x441f2c=_0x85e6[_0x230475];return _0x441f2c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x685e('0x0'));var timeout=require(_0x685e('0x1'));var express=require(_0x685e('0x2'));var router=express[_0x685e('0x3')]();var fs_extra=require(_0x685e('0x4'));var auth=require(_0x685e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x685e('0x6'));var controller=require(_0x685e('0x7'));router[_0x685e('0x8')]('/',auth[_0x685e('0x9')](),controller['index']);router[_0x685e('0x8')](_0x685e('0xa'),auth[_0x685e('0x9')](),controller[_0x685e('0xb')]);router[_0x685e('0x8')](_0x685e('0xc'),auth[_0x685e('0x9')](),timeout(_0x685e('0xd')),controller['test']);router[_0x685e('0xe')]('/',auth[_0x685e('0x9')](),controller['create']);router[_0x685e('0xf')](_0x685e('0xa'),auth[_0x685e('0x9')](),controller[_0x685e('0x10')]);router[_0x685e('0x11')](_0x685e('0xa'),auth[_0x685e('0x9')](),controller['destroy']);module[_0x685e('0x12')]=router; \ No newline at end of file +var _0x1a4e=['post','create','put','delete','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareOdbc.controller','isAuthenticated','index','get','/:id','show','/:id/test','15s'];(function(_0x3196b8,_0x36b9df){var _0x576283=function(_0x97f4c7){while(--_0x97f4c7){_0x3196b8['push'](_0x3196b8['shift']());}};_0x576283(++_0x36b9df);}(_0x1a4e,0x92));var _0xe1a4=function(_0x2b950c,_0x57cc37){_0x2b950c=_0x2b950c-0x0;var _0x592648=_0x1a4e[_0x2b950c];return _0x592648;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe1a4('0x0'));var timeout=require(_0xe1a4('0x1'));var express=require('express');var router=express[_0xe1a4('0x2')]();var fs_extra=require(_0xe1a4('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xe1a4('0x4'));var config=require(_0xe1a4('0x5'));var controller=require(_0xe1a4('0x6'));router['get']('/',auth[_0xe1a4('0x7')](),controller[_0xe1a4('0x8')]);router[_0xe1a4('0x9')](_0xe1a4('0xa'),auth[_0xe1a4('0x7')](),controller[_0xe1a4('0xb')]);router[_0xe1a4('0x9')](_0xe1a4('0xc'),auth[_0xe1a4('0x7')](),timeout(_0xe1a4('0xd')),controller['test']);router[_0xe1a4('0xe')]('/',auth[_0xe1a4('0x7')](),controller[_0xe1a4('0xf')]);router[_0xe1a4('0x10')](_0xe1a4('0xa'),auth[_0xe1a4('0x7')](),controller['update']);router[_0xe1a4('0x11')](_0xe1a4('0xa'),auth[_0xe1a4('0x7')](),controller[_0xe1a4('0x12')]);module[_0xe1a4('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index f733df9..b72b3a4 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 _0x239b=['STRING','name','exports'];(function(_0x44eaab,_0x5eca55){var _0x3f6818=function(_0x447ce7){while(--_0x447ce7){_0x44eaab['push'](_0x44eaab['shift']());}};_0x3f6818(++_0x5eca55);}(_0x239b,0xd1));var _0xb239=function(_0x1c4e9c,_0x467ac6){_0x1c4e9c=_0x1c4e9c-0x0;var _0xac45c1=_0x239b[_0x1c4e9c];return _0xac45c1;};'use strict';var Sequelize=require('sequelize');module[_0xb239('0x0')]={'name':{'type':Sequelize[_0xb239('0x1')],'unique':_0xb239('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0xb239('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x27d3=['exports','STRING','name','sequelize'];(function(_0x553150,_0x589ff3){var _0x18193d=function(_0x3a5ae6){while(--_0x3a5ae6){_0x553150['push'](_0x553150['shift']());}};_0x18193d(++_0x589ff3);}(_0x27d3,0x17b));var _0x327d=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x27d3[_0x47aa64];return _0x549c7a;};'use strict';var Sequelize=require(_0x327d('0x0'));module[_0x327d('0x1')]={'name':{'type':Sequelize[_0x327d('0x2')],'unique':_0x327d('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x327d('0x2')]},'description':{'type':Sequelize[_0x327d('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 139ba6a..405b8b2 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 _0x39c1=['dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','then','get','destroy','error','stack','name','send','map','SquareOdbc','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','update','test'];(function(_0xb9655b,_0x52d5fb){var _0x27ebaa=function(_0xfa5363){while(--_0xfa5363){_0xb9655b['push'](_0xb9655b['shift']());}};_0x27ebaa(++_0x52d5fb);}(_0x39c1,0xac));var _0x139c=function(_0x44bb1d,_0x130b30){_0x44bb1d=_0x44bb1d-0x0;var _0x380ed5=_0x39c1[_0x44bb1d];return _0x380ed5;};'use strict';var emlformat=require(_0x139c('0x0'));var rimraf=require(_0x139c('0x1'));var zipdir=require(_0x139c('0x2'));var jsonpatch=require(_0x139c('0x3'));var rp=require(_0x139c('0x4'));var moment=require(_0x139c('0x5'));var BPromise=require(_0x139c('0x6'));var Mustache=require(_0x139c('0x7'));var util=require(_0x139c('0x8'));var path=require(_0x139c('0x9'));var sox=require(_0x139c('0xa'));var csv=require(_0x139c('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x139c('0xc'));var _=require(_0x139c('0xd'));var squel=require(_0x139c('0xe'));var crypto=require('crypto');var jsforce=require(_0x139c('0xf'));var deskjs=require(_0x139c('0x10'));var toCsv=require(_0x139c('0xb'));var querystring=require(_0x139c('0x11'));var Papa=require(_0x139c('0x12'));var Redis=require('ioredis');var authService=require(_0x139c('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x139c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x139c('0x15'))(_0x139c('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x139c('0x17'));var db=require(_0x139c('0x18'))['db'];function respondWithStatusCode(_0x175604,_0x485ca1){_0x485ca1=_0x485ca1||0xcc;return function(_0x5055ca){if(_0x5055ca){return _0x175604[_0x139c('0x19')](_0x485ca1);}return _0x175604[_0x139c('0x1a')](_0x485ca1)[_0x139c('0x1b')]();};}function respondWithResult(_0x1208f4,_0x31c522){_0x31c522=_0x31c522||0xc8;return function(_0x33c8c7){if(_0x33c8c7){return _0x1208f4[_0x139c('0x1a')](_0x31c522)[_0x139c('0x1c')](_0x33c8c7);}};}function respondWithFilteredResult(_0x597953,_0xf55b02){return function(_0x23ab2){if(_0x23ab2){var _0xe7b2b0=typeof _0xf55b02[_0x139c('0x1d')]==='undefined'&&typeof _0xf55b02[_0x139c('0x1e')]==='undefined';var _0x4f382=_0x23ab2[_0x139c('0x1f')];var _0x196d1e=_0xe7b2b0?0x0:_0xf55b02['offset'];var _0x1078ed=_0xe7b2b0?_0x23ab2[_0x139c('0x1f')]:_0xf55b02[_0x139c('0x1d')]+_0xf55b02[_0x139c('0x1e')];var _0x3fc76a;if(_0x1078ed>=_0x4f382){_0x1078ed=_0x4f382;_0x3fc76a=0xc8;}else{_0x3fc76a=0xce;}_0x597953[_0x139c('0x1a')](_0x3fc76a);return _0x597953[_0x139c('0x20')](_0x139c('0x21'),_0x196d1e+'-'+_0x1078ed+'/'+_0x4f382)[_0x139c('0x1c')](_0x23ab2);}return null;};}function patchUpdates(_0xb307ec){return function(_0x55f43d){try{jsonpatch[_0x139c('0x22')](_0x55f43d,_0xb307ec,!![]);}catch(_0x5ec86e){return BPromise['reject'](_0x5ec86e);}return _0x55f43d['save']();};}function saveUpdates(_0x229a75,_0x2e8c62){return function(_0x3cdc94){if(_0x3cdc94){return _0x3cdc94['update'](_0x229a75)[_0x139c('0x23')](function(_0x4b1ab6){return _0x4b1ab6;});}return null;};}function removeEntity(_0x38ac8a,_0x4bf9f4){return function(_0x40f24d){if(_0x40f24d){return _0x40f24d['destroy']()[_0x139c('0x23')](function(){var _0x1a185c=_0x40f24d[_0x139c('0x24')]({'plain':!![]});var _0x35c24a='ODBC';return db['UserProfileResource'][_0x139c('0x25')]({'where':{'type':_0x35c24a,'resourceId':_0x1a185c['id']}})['then'](function(){return _0x40f24d;});})[_0x139c('0x23')](function(){_0x38ac8a[_0x139c('0x1a')](0xcc)[_0x139c('0x1b')]();});}};}function handleEntityNotFound(_0x350365,_0x562025){return function(_0x588c41){if(!_0x588c41){_0x350365['sendStatus'](0x194);}return _0x588c41;};}function handleError(_0x935675,_0x4149c2){_0x4149c2=_0x4149c2||0x1f4;return function(_0x4afdcc){logger[_0x139c('0x26')](_0x4afdcc[_0x139c('0x27')]);if(_0x4afdcc['name']){delete _0x4afdcc[_0x139c('0x28')];}_0x935675[_0x139c('0x1a')](_0x4149c2)[_0x139c('0x29')](_0x4afdcc);};}exports['index']=function(_0x222dca,_0x2b35c4){var _0x30c196={},_0x14b6dd={},_0x207e64={'count':0x0,'rows':[]};var _0x3ac27d=_[_0x139c('0x2a')](db[_0x139c('0x2b')][_0x139c('0x2c')],function(_0x30f911){return{'name':_0x30f911[_0x139c('0x2d')],'type':_0x30f911[_0x139c('0x2e')][_0x139c('0x2f')]};});_0x14b6dd[_0x139c('0x30')]=_[_0x139c('0x2a')](_0x3ac27d,_0x139c('0x28'));_0x14b6dd['query']=_[_0x139c('0x31')](_0x222dca[_0x139c('0x32')]);_0x14b6dd[_0x139c('0x33')]=_[_0x139c('0x34')](_0x14b6dd[_0x139c('0x30')],_0x14b6dd[_0x139c('0x32')]);_0x30c196[_0x139c('0x35')]=_[_0x139c('0x34')](_0x14b6dd[_0x139c('0x30')],qs['fields'](_0x222dca[_0x139c('0x32')]['fields']));_0x30c196[_0x139c('0x35')]=_0x30c196[_0x139c('0x35')][_0x139c('0x36')]?_0x30c196['attributes']:_0x14b6dd['model'];if(!_0x222dca[_0x139c('0x32')][_0x139c('0x37')](_0x139c('0x38'))){_0x30c196['limit']=qs['limit'](_0x222dca[_0x139c('0x32')][_0x139c('0x1e')]);_0x30c196[_0x139c('0x1d')]=qs[_0x139c('0x1d')](_0x222dca['query'][_0x139c('0x1d')]);}_0x30c196['order']=qs[_0x139c('0x39')](_0x222dca[_0x139c('0x32')][_0x139c('0x39')]);_0x30c196[_0x139c('0x3a')]=qs[_0x139c('0x33')](_['pick'](_0x222dca[_0x139c('0x32')],_0x14b6dd['filters']),_0x3ac27d);if(_0x222dca[_0x139c('0x32')][_0x139c('0x3b')]){_0x30c196['where']=_[_0x139c('0x3c')](_0x30c196[_0x139c('0x3a')],{'$or':_['map'](_0x3ac27d,function(_0x4998c5){if(_0x4998c5[_0x139c('0x2e')]!==_0x139c('0x3d')){var _0x41a530={};_0x41a530[_0x4998c5[_0x139c('0x28')]]={'$like':'%'+_0x222dca['query'][_0x139c('0x3b')]+'%'};return _0x41a530;}})});}_0x30c196=_[_0x139c('0x3c')]({},_0x30c196,_0x222dca[_0x139c('0x3e')]);var _0x298098={'where':_0x30c196[_0x139c('0x3a')]};return db['SquareOdbc']['count'](_0x298098)[_0x139c('0x23')](function(_0xa7d402){_0x207e64['count']=_0xa7d402;if(_0x222dca['query'][_0x139c('0x3f')]){_0x30c196[_0x139c('0x40')]=[{'all':!![]}];}return db[_0x139c('0x2b')][_0x139c('0x41')](_0x30c196);})['then'](function(_0x3741de){_0x207e64[_0x139c('0x42')]=_0x3741de;return _0x207e64;})[_0x139c('0x23')](respondWithFilteredResult(_0x2b35c4,_0x30c196))['catch'](handleError(_0x2b35c4,null));};exports[_0x139c('0x43')]=function(_0x44f9bc,_0x49cc68){var _0x1291e7={'raw':!![],'where':{'id':_0x44f9bc[_0x139c('0x44')]['id']}},_0x2e8ef8={};_0x2e8ef8[_0x139c('0x30')]=_[_0x139c('0x31')](db['SquareOdbc'][_0x139c('0x2c')]);_0x2e8ef8['query']=_[_0x139c('0x31')](_0x44f9bc[_0x139c('0x32')]);_0x2e8ef8[_0x139c('0x33')]=_[_0x139c('0x34')](_0x2e8ef8['model'],_0x2e8ef8[_0x139c('0x32')]);_0x1291e7[_0x139c('0x35')]=_[_0x139c('0x34')](_0x2e8ef8[_0x139c('0x30')],qs['fields'](_0x44f9bc[_0x139c('0x32')]['fields']));_0x1291e7[_0x139c('0x35')]=_0x1291e7[_0x139c('0x35')][_0x139c('0x36')]?_0x1291e7['attributes']:_0x2e8ef8[_0x139c('0x30')];if(_0x44f9bc[_0x139c('0x32')][_0x139c('0x3f')]){_0x1291e7['include']=[{'all':!![]}];}_0x1291e7=_[_0x139c('0x3c')]({},_0x1291e7,_0x44f9bc[_0x139c('0x3e')]);return db[_0x139c('0x2b')][_0x139c('0x45')](_0x1291e7)[_0x139c('0x23')](handleEntityNotFound(_0x49cc68,null))[_0x139c('0x23')](respondWithResult(_0x49cc68,null))['catch'](handleError(_0x49cc68,null));};exports[_0x139c('0x46')]=function(_0x2b092d,_0x4c63ea){return db[_0x139c('0x2b')][_0x139c('0x46')](_0x2b092d[_0x139c('0x47')],{})[_0x139c('0x23')](function(_0x45d0c2){var _0x3dd81a=_0x2b092d['user']['get']({'plain':!![]});if(!_0x3dd81a)throw new Error(_0x139c('0x48'));if(_0x3dd81a[_0x139c('0x49')]==='user'){var _0x13a29d=_0x45d0c2[_0x139c('0x24')]({'plain':!![]});var _0x2193e9='ODBC';return db['UserProfileSection']['find']({'where':{'name':_0x2193e9,'userProfileId':_0x3dd81a['userProfileId']},'raw':!![]})[_0x139c('0x23')](function(_0x204194){if(_0x204194&&_0x204194[_0x139c('0x4a')]===0x0){return db[_0x139c('0x4b')]['create']({'name':_0x13a29d['name'],'resourceId':_0x13a29d['id'],'type':_0x204194[_0x139c('0x28')],'sectionId':_0x204194['id']},{})[_0x139c('0x23')](function(){return _0x45d0c2;});}else{return _0x45d0c2;}})['catch'](function(_0x2ff606){logger[_0x139c('0x26')](_0x139c('0x4c'),_0x2ff606);throw _0x2ff606;});}return _0x45d0c2;})[_0x139c('0x23')](respondWithResult(_0x4c63ea,0xc9))[_0x139c('0x4d')](handleError(_0x4c63ea,null));};exports[_0x139c('0x4e')]=function(_0x5c43ba,_0xe4bf4){if(_0x5c43ba['body']['id']){delete _0x5c43ba[_0x139c('0x47')]['id'];}return db[_0x139c('0x2b')]['find']({'where':{'id':_0x5c43ba[_0x139c('0x44')]['id']}})[_0x139c('0x23')](handleEntityNotFound(_0xe4bf4,null))[_0x139c('0x23')](saveUpdates(_0x5c43ba[_0x139c('0x47')],null))[_0x139c('0x23')](respondWithResult(_0xe4bf4,null))[_0x139c('0x4d')](handleError(_0xe4bf4,null));};exports[_0x139c('0x25')]=function(_0x568c58,_0x3ef1e1){return db[_0x139c('0x2b')][_0x139c('0x45')]({'where':{'id':_0x568c58[_0x139c('0x44')]['id']}})[_0x139c('0x23')](handleEntityNotFound(_0x3ef1e1,null))[_0x139c('0x23')](removeEntity(_0x3ef1e1,null))[_0x139c('0x4d')](handleError(_0x3ef1e1,null));};exports[_0x139c('0x4f')]=function(_0x1b76b8,_0x366710,_0x62ea32){var _0x9fece0;return db[_0x139c('0x2b')][_0x139c('0x45')]({'where':{'id':_0x1b76b8[_0x139c('0x44')]['id']},'attributes':['id',_0x139c('0x50')]})['then'](handleEntityNotFound(_0x366710,null))[_0x139c('0x23')](function(_0x17ae51){if(_0x17ae51){var _0x253c41=require(_0x139c('0x51'))();_0x253c41[_0x139c('0x52')](_0x17ae51[_0x139c('0x50')]);_0x253c41[_0x139c('0x53')]();return _0x17ae51;}})[_0x139c('0x23')](respondWithResult(_0x366710,null))[_0x139c('0x4d')](handleError(_0x366710,null));}; \ No newline at end of file +var _0xefed=['path','sox','to-csv','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','destroy','then','get','ODBC','error','name','send','index','map','SquareOdbc','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','includeAll','findAll','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','test','dsn','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util'];(function(_0x54e3a9,_0x14e64d){var _0x3a3774=function(_0x42e4c9){while(--_0x42e4c9){_0x54e3a9['push'](_0x54e3a9['shift']());}};_0x3a3774(++_0x14e64d);}(_0xefed,0xe7));var _0xdefe=function(_0x5c811c,_0x313b25){_0x5c811c=_0x5c811c-0x0;var _0x5df3af=_0xefed[_0x5c811c];return _0x5df3af;};'use strict';var emlformat=require(_0xdefe('0x0'));var rimraf=require(_0xdefe('0x1'));var zipdir=require(_0xdefe('0x2'));var jsonpatch=require(_0xdefe('0x3'));var rp=require(_0xdefe('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdefe('0x5'));var path=require(_0xdefe('0x6'));var sox=require(_0xdefe('0x7'));var csv=require(_0xdefe('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdefe('0x9'));var deskjs=require(_0xdefe('0xa'));var toCsv=require(_0xdefe('0x8'));var querystring=require(_0xdefe('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdefe('0xc'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdefe('0xd'))(_0xdefe('0xe'));var utils=require(_0xdefe('0xf'));var config=require(_0xdefe('0x10'));var licenseUtil=require(_0xdefe('0x11'));var db=require(_0xdefe('0x12'))['db'];function respondWithStatusCode(_0x578c63,_0x5f164c){_0x5f164c=_0x5f164c||0xcc;return function(_0x343f67){if(_0x343f67){return _0x578c63[_0xdefe('0x13')](_0x5f164c);}return _0x578c63[_0xdefe('0x14')](_0x5f164c)[_0xdefe('0x15')]();};}function respondWithResult(_0x4bf9d7,_0x47ad2a){_0x47ad2a=_0x47ad2a||0xc8;return function(_0x47dcdf){if(_0x47dcdf){return _0x4bf9d7[_0xdefe('0x14')](_0x47ad2a)[_0xdefe('0x16')](_0x47dcdf);}};}function respondWithFilteredResult(_0x4eb775,_0x5375ca){return function(_0x344b24){if(_0x344b24){var _0x3e3551=typeof _0x5375ca[_0xdefe('0x17')]===_0xdefe('0x18')&&typeof _0x5375ca[_0xdefe('0x19')]===_0xdefe('0x18');var _0x327eff=_0x344b24['count'];var _0x56acbf=_0x3e3551?0x0:_0x5375ca[_0xdefe('0x17')];var _0x35e713=_0x3e3551?_0x344b24[_0xdefe('0x1a')]:_0x5375ca[_0xdefe('0x17')]+_0x5375ca[_0xdefe('0x19')];var _0x3ac5df;if(_0x35e713>=_0x327eff){_0x35e713=_0x327eff;_0x3ac5df=0xc8;}else{_0x3ac5df=0xce;}_0x4eb775['status'](_0x3ac5df);return _0x4eb775['set'](_0xdefe('0x1b'),_0x56acbf+'-'+_0x35e713+'/'+_0x327eff)['json'](_0x344b24);}return null;};}function patchUpdates(_0x25876f){return function(_0x1a245c){try{jsonpatch[_0xdefe('0x1c')](_0x1a245c,_0x25876f,!![]);}catch(_0x412411){return BPromise[_0xdefe('0x1d')](_0x412411);}return _0x1a245c['save']();};}function saveUpdates(_0x394868,_0x4a3bbc){return function(_0x3d8106){if(_0x3d8106){return _0x3d8106['update'](_0x394868)['then'](function(_0x4317f7){return _0x4317f7;});}return null;};}function removeEntity(_0x375ef3,_0x6bce96){return function(_0x151640){if(_0x151640){return _0x151640[_0xdefe('0x1e')]()[_0xdefe('0x1f')](function(){var _0x419664=_0x151640[_0xdefe('0x20')]({'plain':!![]});var _0x4fc088=_0xdefe('0x21');return db['UserProfileResource']['destroy']({'where':{'type':_0x4fc088,'resourceId':_0x419664['id']}})[_0xdefe('0x1f')](function(){return _0x151640;});})[_0xdefe('0x1f')](function(){_0x375ef3[_0xdefe('0x14')](0xcc)[_0xdefe('0x15')]();});}};}function handleEntityNotFound(_0x3cbded,_0x18109d){return function(_0x53f1ed){if(!_0x53f1ed){_0x3cbded[_0xdefe('0x13')](0x194);}return _0x53f1ed;};}function handleError(_0x16f098,_0x155c39){_0x155c39=_0x155c39||0x1f4;return function(_0x3ff38f){logger[_0xdefe('0x22')](_0x3ff38f['stack']);if(_0x3ff38f[_0xdefe('0x23')]){delete _0x3ff38f[_0xdefe('0x23')];}_0x16f098[_0xdefe('0x14')](_0x155c39)[_0xdefe('0x24')](_0x3ff38f);};}exports[_0xdefe('0x25')]=function(_0x59be22,_0x3751df){var _0x51f1eb={},_0x1b87f4={},_0x3a0790={'count':0x0,'rows':[]};var _0x5515c3=_[_0xdefe('0x26')](db[_0xdefe('0x27')][_0xdefe('0x28')],function(_0x410ca2){return{'name':_0x410ca2[_0xdefe('0x29')],'type':_0x410ca2['type']['key']};});_0x1b87f4[_0xdefe('0x2a')]=_[_0xdefe('0x26')](_0x5515c3,_0xdefe('0x23'));_0x1b87f4[_0xdefe('0x2b')]=_[_0xdefe('0x2c')](_0x59be22[_0xdefe('0x2b')]);_0x1b87f4[_0xdefe('0x2d')]=_[_0xdefe('0x2e')](_0x1b87f4['model'],_0x1b87f4['query']);_0x51f1eb[_0xdefe('0x2f')]=_['intersection'](_0x1b87f4[_0xdefe('0x2a')],qs[_0xdefe('0x30')](_0x59be22['query']['fields']));_0x51f1eb[_0xdefe('0x2f')]=_0x51f1eb[_0xdefe('0x2f')][_0xdefe('0x31')]?_0x51f1eb['attributes']:_0x1b87f4[_0xdefe('0x2a')];if(!_0x59be22[_0xdefe('0x2b')][_0xdefe('0x32')](_0xdefe('0x33'))){_0x51f1eb[_0xdefe('0x19')]=qs[_0xdefe('0x19')](_0x59be22['query'][_0xdefe('0x19')]);_0x51f1eb[_0xdefe('0x17')]=qs[_0xdefe('0x17')](_0x59be22[_0xdefe('0x2b')][_0xdefe('0x17')]);}_0x51f1eb['order']=qs[_0xdefe('0x34')](_0x59be22[_0xdefe('0x2b')][_0xdefe('0x34')]);_0x51f1eb[_0xdefe('0x35')]=qs[_0xdefe('0x2d')](_[_0xdefe('0x36')](_0x59be22[_0xdefe('0x2b')],_0x1b87f4['filters']),_0x5515c3);if(_0x59be22[_0xdefe('0x2b')][_0xdefe('0x37')]){_0x51f1eb[_0xdefe('0x35')]=_[_0xdefe('0x38')](_0x51f1eb[_0xdefe('0x35')],{'$or':_[_0xdefe('0x26')](_0x5515c3,function(_0x138c0e){if(_0x138c0e[_0xdefe('0x39')]!=='VIRTUAL'){var _0x108668={};_0x108668[_0x138c0e['name']]={'$like':'%'+_0x59be22[_0xdefe('0x2b')][_0xdefe('0x37')]+'%'};return _0x108668;}})});}_0x51f1eb=_[_0xdefe('0x38')]({},_0x51f1eb,_0x59be22[_0xdefe('0x3a')]);var _0x2b93d4={'where':_0x51f1eb[_0xdefe('0x35')]};return db[_0xdefe('0x27')]['count'](_0x2b93d4)[_0xdefe('0x1f')](function(_0x2fc1ec){_0x3a0790[_0xdefe('0x1a')]=_0x2fc1ec;if(_0x59be22[_0xdefe('0x2b')][_0xdefe('0x3b')]){_0x51f1eb['include']=[{'all':!![]}];}return db['SquareOdbc'][_0xdefe('0x3c')](_0x51f1eb);})[_0xdefe('0x1f')](function(_0x38920a){_0x3a0790['rows']=_0x38920a;return _0x3a0790;})[_0xdefe('0x1f')](respondWithFilteredResult(_0x3751df,_0x51f1eb))[_0xdefe('0x3d')](handleError(_0x3751df,null));};exports[_0xdefe('0x3e')]=function(_0x54a8ed,_0xaf2013){var _0x42b9c3={'raw':!![],'where':{'id':_0x54a8ed['params']['id']}},_0x8bcb1a={};_0x8bcb1a['model']=_['keys'](db['SquareOdbc'][_0xdefe('0x28')]);_0x8bcb1a[_0xdefe('0x2b')]=_['keys'](_0x54a8ed[_0xdefe('0x2b')]);_0x8bcb1a[_0xdefe('0x2d')]=_[_0xdefe('0x2e')](_0x8bcb1a['model'],_0x8bcb1a[_0xdefe('0x2b')]);_0x42b9c3[_0xdefe('0x2f')]=_['intersection'](_0x8bcb1a[_0xdefe('0x2a')],qs[_0xdefe('0x30')](_0x54a8ed[_0xdefe('0x2b')][_0xdefe('0x30')]));_0x42b9c3[_0xdefe('0x2f')]=_0x42b9c3['attributes']['length']?_0x42b9c3[_0xdefe('0x2f')]:_0x8bcb1a[_0xdefe('0x2a')];if(_0x54a8ed[_0xdefe('0x2b')][_0xdefe('0x3b')]){_0x42b9c3['include']=[{'all':!![]}];}_0x42b9c3=_[_0xdefe('0x38')]({},_0x42b9c3,_0x54a8ed[_0xdefe('0x3a')]);return db[_0xdefe('0x27')][_0xdefe('0x3f')](_0x42b9c3)['then'](handleEntityNotFound(_0xaf2013,null))['then'](respondWithResult(_0xaf2013,null))[_0xdefe('0x3d')](handleError(_0xaf2013,null));};exports[_0xdefe('0x40')]=function(_0x2474d5,_0x5b8cc5){return db[_0xdefe('0x27')][_0xdefe('0x40')](_0x2474d5[_0xdefe('0x41')],{})[_0xdefe('0x1f')](function(_0x11a558){var _0xbb61b8=_0x2474d5[_0xdefe('0x42')]['get']({'plain':!![]});if(!_0xbb61b8)throw new Error(_0xdefe('0x43'));if(_0xbb61b8[_0xdefe('0x44')]===_0xdefe('0x42')){var _0x59d620=_0x11a558[_0xdefe('0x20')]({'plain':!![]});var _0x2ca5ac=_0xdefe('0x21');return db[_0xdefe('0x45')]['find']({'where':{'name':_0x2ca5ac,'userProfileId':_0xbb61b8[_0xdefe('0x46')]},'raw':!![]})[_0xdefe('0x1f')](function(_0x263097){if(_0x263097&&_0x263097[_0xdefe('0x47')]===0x0){return db[_0xdefe('0x48')][_0xdefe('0x40')]({'name':_0x59d620[_0xdefe('0x23')],'resourceId':_0x59d620['id'],'type':_0x263097[_0xdefe('0x23')],'sectionId':_0x263097['id']},{})[_0xdefe('0x1f')](function(){return _0x11a558;});}else{return _0x11a558;}})[_0xdefe('0x3d')](function(_0x57303c){logger[_0xdefe('0x22')](_0xdefe('0x49'),_0x57303c);throw _0x57303c;});}return _0x11a558;})[_0xdefe('0x1f')](respondWithResult(_0x5b8cc5,0xc9))[_0xdefe('0x3d')](handleError(_0x5b8cc5,null));};exports[_0xdefe('0x4a')]=function(_0x533c1c,_0x332415){if(_0x533c1c[_0xdefe('0x41')]['id']){delete _0x533c1c[_0xdefe('0x41')]['id'];}return db[_0xdefe('0x27')][_0xdefe('0x3f')]({'where':{'id':_0x533c1c[_0xdefe('0x4b')]['id']}})['then'](handleEntityNotFound(_0x332415,null))[_0xdefe('0x1f')](saveUpdates(_0x533c1c[_0xdefe('0x41')],null))[_0xdefe('0x1f')](respondWithResult(_0x332415,null))[_0xdefe('0x3d')](handleError(_0x332415,null));};exports[_0xdefe('0x1e')]=function(_0xe61b3a,_0x126d3c){return db[_0xdefe('0x27')][_0xdefe('0x3f')]({'where':{'id':_0xe61b3a['params']['id']}})['then'](handleEntityNotFound(_0x126d3c,null))[_0xdefe('0x1f')](removeEntity(_0x126d3c,null))['catch'](handleError(_0x126d3c,null));};exports[_0xdefe('0x4c')]=function(_0x29b032,_0x5c37a8,_0x5120b9){var _0x10e5de;return db['SquareOdbc'][_0xdefe('0x3f')]({'where':{'id':_0x29b032[_0xdefe('0x4b')]['id']},'attributes':['id',_0xdefe('0x4d')]})[_0xdefe('0x1f')](handleEntityNotFound(_0x5c37a8,null))[_0xdefe('0x1f')](function(_0x3968cb){if(_0x3968cb){var _0x37e46a=require('odbc')();_0x37e46a['openSync'](_0x3968cb[_0xdefe('0x4d')]);_0x37e46a[_0xdefe('0x4e')]();return _0x3968cb;}})['then'](respondWithResult(_0x5c37a8,null))[_0xdefe('0x3d')](handleError(_0x5c37a8,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 3d869b7..40d5c3f 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 _0x7207=['define','SquareOdbc','square_odbc','lodash','api','bluebird','request-promise','path','../../config/environment','./squareOdbc.attributes','exports'];(function(_0xed0a68,_0x416fca){var _0x41393a=function(_0x1e9828){while(--_0x1e9828){_0xed0a68['push'](_0xed0a68['shift']());}};_0x41393a(++_0x416fca);}(_0x7207,0x18f));var _0x7720=function(_0x5017d3,_0x37eb90){_0x5017d3=_0x5017d3-0x0;var _0x27db57=_0x7207[_0x5017d3];return _0x27db57;};'use strict';var _=require(_0x7720('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7720('0x1'));var moment=require('moment');var BPromise=require(_0x7720('0x2'));var rp=require(_0x7720('0x3'));var fs=require('fs');var path=require(_0x7720('0x4'));var rimraf=require('rimraf');var config=require(_0x7720('0x5'));var attributes=require(_0x7720('0x6'));module[_0x7720('0x7')]=function(_0x2a2dc3,_0x3b9f76){return _0x2a2dc3[_0x7720('0x8')](_0x7720('0x9'),attributes,{'tableName':_0x7720('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac74=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','define','square_odbc','lodash','util'];(function(_0x7d9c61,_0x2e8c97){var _0x39e41f=function(_0x917dae){while(--_0x917dae){_0x7d9c61['push'](_0x7d9c61['shift']());}};_0x39e41f(++_0x2e8c97);}(_0xac74,0x1cc));var _0x4ac7=function(_0x421e36,_0x18776e){_0x421e36=_0x421e36-0x0;var _0x20b3e3=_0xac74[_0x421e36];return _0x20b3e3;};'use strict';var _=require(_0x4ac7('0x0'));var util=require(_0x4ac7('0x1'));var logger=require(_0x4ac7('0x2'))(_0x4ac7('0x3'));var moment=require(_0x4ac7('0x4'));var BPromise=require(_0x4ac7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4ac7('0x6'));var config=require(_0x4ac7('0x7'));var attributes=require('./squareOdbc.attributes');module[_0x4ac7('0x8')]=function(_0xffc165,_0x59be4d){return _0xffc165[_0x4ac7('0x9')]('SquareOdbc',attributes,{'tableName':_0x4ac7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 3d6181e..145c3c4 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 _0x8d94=['debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SquareOdbc','find','options','where','attributes','include','map','model','ShowSquareOdbc','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent'];(function(_0x8b987c,_0x5262e7){var _0x7b8b61=function(_0x3ede04){while(--_0x3ede04){_0x8b987c['push'](_0x8b987c['shift']());}};_0x7b8b61(++_0x5262e7);}(_0x8d94,0x1b1));var _0x48d9=function(_0x4cd424,_0x4d58c7){_0x4cd424=_0x4cd424-0x0;var _0x1962c4=_0x8d94[_0x4cd424];return _0x1962c4;};'use strict';var _=require(_0x48d9('0x0'));var util=require('util');var moment=require(_0x48d9('0x1'));var BPromise=require(_0x48d9('0x2'));var rs=require(_0x48d9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x48d9('0x4'))['db'];var utils=require(_0x48d9('0x5'));var logger=require(_0x48d9('0x6'))(_0x48d9('0x7'));var config=require(_0x48d9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x48d9('0x9')][_0x48d9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e4711,_0x3934ad,_0xc73126){return new BPromise(function(_0x2f956b,_0x237ad9){return client['request'](_0x1e4711,_0xc73126)[_0x48d9('0xb')](function(_0x19cdac){logger[_0x48d9('0xc')](_0x48d9('0xd'),_0x3934ad,_0x48d9('0xe'));logger[_0x48d9('0xf')](_0x48d9('0x10'),_0x3934ad,_0x48d9('0xe'),JSON[_0x48d9('0x11')](_0x19cdac));if(_0x19cdac[_0x48d9('0x12')]){if(_0x19cdac['error'][_0x48d9('0x13')]===0x1f4){logger[_0x48d9('0x12')](_0x48d9('0xd'),_0x3934ad,_0x19cdac[_0x48d9('0x12')]['message']);return _0x237ad9(_0x19cdac[_0x48d9('0x12')][_0x48d9('0x14')]);}logger[_0x48d9('0x12')](_0x48d9('0xd'),_0x3934ad,_0x19cdac['error'][_0x48d9('0x14')]);return _0x2f956b(_0x19cdac['error']['message']);}else{logger[_0x48d9('0xc')](_0x48d9('0xd'),_0x3934ad,_0x48d9('0xe'));_0x2f956b(_0x19cdac[_0x48d9('0x15')][_0x48d9('0x14')]);}})[_0x48d9('0x16')](function(_0x2c59d9){logger[_0x48d9('0x12')](_0x48d9('0xd'),_0x3934ad,_0x2c59d9);_0x237ad9(_0x2c59d9);});});}exports['ShowSquareOdbc']=function(_0x4d3aae){var _0x1bc4e7=this;return new Promise(function(_0x4aa7ff,_0x2799de){return db[_0x48d9('0x17')][_0x48d9('0x18')]({'raw':_0x4d3aae['options']?_0x4d3aae[_0x48d9('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4d3aae['options']?_0x4d3aae['options'][_0x48d9('0x1a')]||null:null,'attributes':_0x4d3aae[_0x48d9('0x19')]?_0x4d3aae[_0x48d9('0x19')][_0x48d9('0x1b')]||null:null,'include':_0x4d3aae[_0x48d9('0x19')]?_0x4d3aae[_0x48d9('0x19')][_0x48d9('0x1c')]?_[_0x48d9('0x1d')](_0x4d3aae[_0x48d9('0x19')]['include'],function(_0x10f290){return{'model':db[_0x10f290['model']],'as':_0x10f290['as'],'attributes':_0x10f290[_0x48d9('0x1b')],'include':_0x10f290['include']?_[_0x48d9('0x1d')](_0x10f290[_0x48d9('0x1c')],function(_0x5748c3){return{'model':db[_0x5748c3[_0x48d9('0x1e')]],'as':_0x5748c3['as'],'attributes':_0x5748c3[_0x48d9('0x1b')],'include':_0x5748c3[_0x48d9('0x1c')]?_['map'](_0x5748c3[_0x48d9('0x1c')],function(_0x10be54){return{'model':db[_0x10be54[_0x48d9('0x1e')]],'as':_0x10be54['as'],'attributes':_0x10be54['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xa30218){logger['info'](_0x48d9('0x1f'),_0x4d3aae);logger[_0x48d9('0xf')](_0x48d9('0x1f'),_0x4d3aae,JSON[_0x48d9('0x11')](_0xa30218));_0x4aa7ff(_0xa30218);})[_0x48d9('0x16')](function(_0x2ffbe3){logger[_0x48d9('0x12')](_0x48d9('0x1f'),_0x2ffbe3['message'],_0x4d3aae);_0x2799de(_0x1bc4e7[_0x48d9('0x12')](0x1f4,_0x2ffbe3[_0x48d9('0x14')]));});});}; \ No newline at end of file +var _0x7e49=['then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSquareOdbc','find','options','attributes','include','model','map','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x4c05da,_0x414720){var _0x1614db=function(_0xa19cf6){while(--_0xa19cf6){_0x4c05da['push'](_0x4c05da['shift']());}};_0x1614db(++_0x414720);}(_0x7e49,0xe4));var _0x97e4=function(_0x32c3cf,_0x165622){_0x32c3cf=_0x32c3cf-0x0;var _0x2600a2=_0x7e49[_0x32c3cf];return _0x2600a2;};'use strict';var _=require(_0x97e4('0x0'));var util=require('util');var moment=require(_0x97e4('0x1'));var BPromise=require(_0x97e4('0x2'));var rs=require(_0x97e4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x97e4('0x4'))['db'];var utils=require(_0x97e4('0x5'));var logger=require(_0x97e4('0x6'))(_0x97e4('0x7'));var config=require(_0x97e4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x97e4('0x9')][_0x97e4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a3ae4,_0x4c94fa,_0x438d4c){return new BPromise(function(_0x441848,_0x3ca0f){return client[_0x97e4('0xb')](_0x1a3ae4,_0x438d4c)[_0x97e4('0xc')](function(_0x5f2102){logger[_0x97e4('0xd')](_0x97e4('0xe'),_0x4c94fa,_0x97e4('0xf'));logger['debug'](_0x97e4('0x10'),_0x4c94fa,'request\x20sent',JSON[_0x97e4('0x11')](_0x5f2102));if(_0x5f2102[_0x97e4('0x12')]){if(_0x5f2102[_0x97e4('0x12')][_0x97e4('0x13')]===0x1f4){logger[_0x97e4('0x12')](_0x97e4('0xe'),_0x4c94fa,_0x5f2102[_0x97e4('0x12')][_0x97e4('0x14')]);return _0x3ca0f(_0x5f2102[_0x97e4('0x12')]['message']);}logger[_0x97e4('0x12')]('SquareOdbc,\x20%s,\x20%s',_0x4c94fa,_0x5f2102[_0x97e4('0x12')][_0x97e4('0x14')]);return _0x441848(_0x5f2102['error'][_0x97e4('0x14')]);}else{logger[_0x97e4('0xd')](_0x97e4('0xe'),_0x4c94fa,'request\x20sent');_0x441848(_0x5f2102[_0x97e4('0x15')]['message']);}})[_0x97e4('0x16')](function(_0x39181d){logger[_0x97e4('0x12')](_0x97e4('0xe'),_0x4c94fa,_0x39181d);_0x3ca0f(_0x39181d);});});}exports[_0x97e4('0x17')]=function(_0x407f59){var _0x583c2d=this;return new Promise(function(_0xe52391,_0x5ed2b0){return db['SquareOdbc'][_0x97e4('0x18')]({'raw':_0x407f59[_0x97e4('0x19')]?_0x407f59[_0x97e4('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x407f59['options']?_0x407f59[_0x97e4('0x19')]['where']||null:null,'attributes':_0x407f59[_0x97e4('0x19')]?_0x407f59[_0x97e4('0x19')][_0x97e4('0x1a')]||null:null,'include':_0x407f59['options']?_0x407f59[_0x97e4('0x19')][_0x97e4('0x1b')]?_['map'](_0x407f59['options']['include'],function(_0x3c80f2){return{'model':db[_0x3c80f2[_0x97e4('0x1c')]],'as':_0x3c80f2['as'],'attributes':_0x3c80f2[_0x97e4('0x1a')],'include':_0x3c80f2[_0x97e4('0x1b')]?_[_0x97e4('0x1d')](_0x3c80f2[_0x97e4('0x1b')],function(_0xbac610){return{'model':db[_0xbac610[_0x97e4('0x1c')]],'as':_0xbac610['as'],'attributes':_0xbac610[_0x97e4('0x1a')],'include':_0xbac610['include']?_[_0x97e4('0x1d')](_0xbac610[_0x97e4('0x1b')],function(_0x2ae62a){return{'model':db[_0x2ae62a['model']],'as':_0x2ae62a['as'],'attributes':_0x2ae62a[_0x97e4('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x97e4('0xc')](function(_0x11a7e8){logger['info']('ShowSquareOdbc',_0x407f59);logger['debug']('ShowSquareOdbc',_0x407f59,JSON[_0x97e4('0x11')](_0x11a7e8));_0xe52391(_0x11a7e8);})['catch'](function(_0xcbbec9){logger['error'](_0x97e4('0x17'),_0xcbbec9[_0x97e4('0x14')],_0x407f59);_0x5ed2b0(_0x583c2d[_0x97e4('0x12')](0x1f4,_0xcbbec9[_0x97e4('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 18d2236..fe71f4f 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 _0x0c61=['update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','isAuthenticated','index','get','/:id','show','create'];(function(_0x57a01e,_0x446ad1){var _0x2e0a23=function(_0x2fc2f8){while(--_0x2fc2f8){_0x57a01e['push'](_0x57a01e['shift']());}};_0x2e0a23(++_0x446ad1);}(_0x0c61,0x159));var _0x10c6=function(_0x4af01e,_0x543f5c){_0x4af01e=_0x4af01e-0x0;var _0x178c11=_0x0c61[_0x4af01e];return _0x178c11;};'use strict';var multer=require(_0x10c6('0x0'));var util=require(_0x10c6('0x1'));var path=require(_0x10c6('0x2'));var timeout=require(_0x10c6('0x3'));var express=require(_0x10c6('0x4'));var router=express[_0x10c6('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x10c6('0x6'));var interaction=require(_0x10c6('0x7'));var config=require(_0x10c6('0x8'));var controller=require(_0x10c6('0x9'));router['get']('/',auth[_0x10c6('0xa')](),controller[_0x10c6('0xb')]);router[_0x10c6('0xc')](_0x10c6('0xd'),auth['isAuthenticated'](),controller[_0x10c6('0xe')]);router['post']('/',auth[_0x10c6('0xa')](),controller[_0x10c6('0xf')]);router['put']('/:id',auth[_0x10c6('0xa')](),controller[_0x10c6('0x10')]);router[_0x10c6('0x11')]('/:id',auth[_0x10c6('0xa')](),controller['destroy']);module[_0x10c6('0x12')]=router; \ No newline at end of file +var _0x7f32=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x581b30,_0x3fcdb8){var _0x2b2fe8=function(_0x93a02f){while(--_0x93a02f){_0x581b30['push'](_0x581b30['shift']());}};_0x2b2fe8(++_0x3fcdb8);}(_0x7f32,0xeb));var _0x27f3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7f32[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x27f3('0x0'));var util=require(_0x27f3('0x1'));var path=require(_0x27f3('0x2'));var timeout=require(_0x27f3('0x3'));var express=require(_0x27f3('0x4'));var router=express[_0x27f3('0x5')]();var fs_extra=require(_0x27f3('0x6'));var auth=require(_0x27f3('0x7'));var interaction=require(_0x27f3('0x8'));var config=require(_0x27f3('0x9'));var controller=require('./squareProject.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x27f3('0xa')]('/:id',auth[_0x27f3('0xb')](),controller[_0x27f3('0xc')]);router[_0x27f3('0xd')]('/',auth['isAuthenticated'](),controller[_0x27f3('0xe')]);router[_0x27f3('0xf')](_0x27f3('0x10'),auth[_0x27f3('0xb')](),controller[_0x27f3('0x11')]);router[_0x27f3('0x12')](_0x27f3('0x10'),auth[_0x27f3('0xb')](),controller['destroy']);module[_0x27f3('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 7714445..41b7e89 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 _0x2ef3=['production','toString','utf8','DATE','sequelize','exports','STRING','name','TEXT','long','getDataValue','preproduction','BLOB'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x2ef3,0xba));var _0x32ef=function(_0x418e6d,_0x4c7a06){_0x418e6d=_0x418e6d-0x0;var _0x42c086=_0x2ef3[_0x418e6d];return _0x42c086;};'use strict';var Sequelize=require(_0x32ef('0x0'));module[_0x32ef('0x1')]={'name':{'type':Sequelize[_0x32ef('0x2')],'unique':_0x32ef('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x32ef('0x2')]},'notes':{'type':Sequelize[_0x32ef('0x4')]},'preproduction':{'type':Sequelize['BLOB'](_0x32ef('0x5')),'get':function(){if(this[_0x32ef('0x6')]('preproduction')){return this[_0x32ef('0x6')](_0x32ef('0x7'))['toString']('utf8');}}},'production':{'type':Sequelize[_0x32ef('0x8')](_0x32ef('0x5')),'get':function(){if(this[_0x32ef('0x6')](_0x32ef('0x9'))){return this[_0x32ef('0x6')](_0x32ef('0x9'))[_0x32ef('0xa')](_0x32ef('0xb'));}}},'savedAt':{'type':Sequelize[_0x32ef('0xc')]},'publishedAt':{'type':Sequelize[_0x32ef('0xc')]}}; \ No newline at end of file +var _0xd397=['production','DATE','sequelize','exports','name','STRING','TEXT','BLOB','getDataValue','preproduction','toString','utf8','long'];(function(_0x349148,_0x31eabb){var _0x2f2b0f=function(_0x44726e){while(--_0x44726e){_0x349148['push'](_0x349148['shift']());}};_0x2f2b0f(++_0x31eabb);}(_0xd397,0x113));var _0x7d39=function(_0x1f2022,_0x119bbb){_0x1f2022=_0x1f2022-0x0;var _0x397e35=_0xd397[_0x1f2022];return _0x397e35;};'use strict';var Sequelize=require(_0x7d39('0x0'));module[_0x7d39('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x7d39('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x7d39('0x3')]},'notes':{'type':Sequelize[_0x7d39('0x4')]},'preproduction':{'type':Sequelize[_0x7d39('0x5')]('long'),'get':function(){if(this[_0x7d39('0x6')]('preproduction')){return this[_0x7d39('0x6')](_0x7d39('0x7'))[_0x7d39('0x8')](_0x7d39('0x9'));}}},'production':{'type':Sequelize['BLOB'](_0x7d39('0xa')),'get':function(){if(this[_0x7d39('0x6')](_0x7d39('0xb'))){return this[_0x7d39('0x6')](_0x7d39('0xb'))['toString']('utf8');}}},'savedAt':{'type':Sequelize[_0x7d39('0xc')]},'publishedAt':{'type':Sequelize[_0x7d39('0xc')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index fce4e48..ab71400 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 _0x3db4=['../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','./squareProject.socket','status','json','offset','limit','count','set','Content-Range','update','then','destroy','get','UserProfileResource','publish','agi','stringify','end','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','SquareProject','include','findAll','rows','catch','show','params','includeAll','create','user','role','SquareProjects','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','lodash','ioredis','../../components/parsers/qs'];(function(_0x45cbcf,_0xfbdbc2){var _0x52ece8=function(_0x498579){while(--_0x498579){_0x45cbcf['push'](_0x45cbcf['shift']());}};_0x52ece8(++_0xfbdbc2);}(_0x3db4,0x1a1));var _0x43db=function(_0x5cb483,_0x9066c4){_0x5cb483=_0x5cb483-0x0;var _0x40488a=_0x3db4[_0x5cb483];return _0x40488a;};'use strict';var _=require(_0x43db('0x0'));var Redis=require(_0x43db('0x1'));var qs=require(_0x43db('0x2'));var logger=require(_0x43db('0x3'))('api');var config=require(_0x43db('0x4'));var db=require(_0x43db('0x5'))['db'];config[_0x43db('0x6')]=_[_0x43db('0x7')](config[_0x43db('0x6')],{'host':_0x43db('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x43db('0x9'))['register'](socket);function respondWithResult(_0x5e1658,_0x255387){_0x255387=_0x255387||0xc8;return function(_0x38f4a2){if(_0x38f4a2){return _0x5e1658[_0x43db('0xa')](_0x255387)[_0x43db('0xb')](_0x38f4a2);}};}function respondWithFilteredResult(_0x5928c4,_0x12cecf){return function(_0x162350){if(_0x162350){var _0x28a5c9=typeof _0x12cecf[_0x43db('0xc')]==='undefined'&&typeof _0x12cecf[_0x43db('0xd')]==='undefined';var _0x522ef2=_0x162350[_0x43db('0xe')];var _0xc2747d=_0x28a5c9?0x0:_0x12cecf[_0x43db('0xc')];var _0x140a71=_0x28a5c9?_0x162350[_0x43db('0xe')]:_0x12cecf['offset']+_0x12cecf[_0x43db('0xd')];var _0x44ed74;if(_0x140a71>=_0x522ef2){_0x140a71=_0x522ef2;_0x44ed74=0xc8;}else{_0x44ed74=0xce;}_0x5928c4[_0x43db('0xa')](_0x44ed74);return _0x5928c4[_0x43db('0xf')](_0x43db('0x10'),_0xc2747d+'-'+_0x140a71+'/'+_0x522ef2)['json'](_0x162350);}return null;};}function saveUpdates(_0x5afb0c){return function(_0x17e8f5){if(_0x17e8f5){return _0x17e8f5[_0x43db('0x11')](_0x5afb0c)[_0x43db('0x12')](function(_0x41835e){return _0x41835e;});}return null;};}function removeEntity(_0x48c354){return function(_0x176a8c){if(_0x176a8c){return _0x176a8c[_0x43db('0x13')]()[_0x43db('0x12')](function(){var _0x329e2a=_0x176a8c[_0x43db('0x14')]({'plain':!![]});var _0x2731a5='SquareProjects';return db[_0x43db('0x15')][_0x43db('0x13')]({'where':{'type':_0x2731a5,'resourceId':_0x329e2a['id']}})[_0x43db('0x12')](function(){return _0x176a8c;});})[_0x43db('0x12')](function(){var _0x48888b=new Redis(config[_0x43db('0x6')]);_0x48888b[_0x43db('0x16')](_0x43db('0x17'),JSON[_0x43db('0x18')]({'id':_0x176a8c['id'],'deleted':!![]}));})[_0x43db('0x12')](function(){_0x48c354[_0x43db('0xa')](0xcc)[_0x43db('0x19')]();});}};}function handleEntityNotFound(_0x404b27){return function(_0x2a295c){if(!_0x2a295c){_0x404b27[_0x43db('0x1a')](0x194);}return _0x2a295c;};}function handleError(_0x2c1483,_0x964f21){_0x964f21=_0x964f21||0x1f4;return function(_0x45e36b){logger[_0x43db('0x1b')](_0x45e36b[_0x43db('0x1c')]);if(_0x45e36b['name']){delete _0x45e36b[_0x43db('0x1d')];}_0x2c1483[_0x43db('0xa')](_0x964f21)[_0x43db('0x1e')](_0x45e36b);};}exports['index']=function(_0x1590df,_0x58ea91){var _0x286f76={},_0x21b29f={},_0x25c98d={'count':0x0,'rows':[]};var _0x4d7923=_[_0x43db('0x1f')](db['SquareProject'][_0x43db('0x20')],function(_0x27ce16){return{'name':_0x27ce16[_0x43db('0x21')],'type':_0x27ce16[_0x43db('0x22')][_0x43db('0x23')]};});_0x21b29f[_0x43db('0x24')]=_[_0x43db('0x1f')](_0x4d7923,_0x43db('0x1d'));_0x21b29f[_0x43db('0x25')]=_[_0x43db('0x26')](_0x1590df[_0x43db('0x25')]);_0x21b29f['filters']=_[_0x43db('0x27')](_0x21b29f[_0x43db('0x24')],_0x21b29f[_0x43db('0x25')]);_0x286f76['attributes']=_[_0x43db('0x27')](_0x21b29f['model'],qs[_0x43db('0x28')](_0x1590df[_0x43db('0x25')][_0x43db('0x28')]));_0x286f76[_0x43db('0x29')]=_0x286f76[_0x43db('0x29')][_0x43db('0x2a')]?_0x286f76[_0x43db('0x29')]:_0x21b29f['model'];if(!_0x1590df[_0x43db('0x25')][_0x43db('0x2b')](_0x43db('0x2c'))){_0x286f76['limit']=qs[_0x43db('0xd')](_0x1590df[_0x43db('0x25')][_0x43db('0xd')]);_0x286f76[_0x43db('0xc')]=qs[_0x43db('0xc')](_0x1590df[_0x43db('0x25')][_0x43db('0xc')]);}_0x286f76[_0x43db('0x2d')]=qs[_0x43db('0x2e')](_0x1590df[_0x43db('0x25')]['sort']);_0x286f76[_0x43db('0x2f')]=qs[_0x43db('0x30')](_['pick'](_0x1590df[_0x43db('0x25')],_0x21b29f[_0x43db('0x30')]),_0x4d7923);if(_0x1590df[_0x43db('0x25')]['filter']){_0x286f76['where']=_[_0x43db('0x31')](_0x286f76[_0x43db('0x2f')],{'$or':_[_0x43db('0x1f')](_0x4d7923,function(_0x4807b6){if(_0x4807b6[_0x43db('0x22')]!==_0x43db('0x32')){var _0x5d0150={};_0x5d0150[_0x4807b6[_0x43db('0x1d')]]={'$like':'%'+_0x1590df[_0x43db('0x25')][_0x43db('0x33')]+'%'};return _0x5d0150;}})});}_0x286f76=_[_0x43db('0x31')]({},_0x286f76,_0x1590df[_0x43db('0x34')]);var _0x567814={'where':_0x286f76[_0x43db('0x2f')]};return db[_0x43db('0x35')][_0x43db('0xe')](_0x567814)['then'](function(_0xf9114){_0x25c98d[_0x43db('0xe')]=_0xf9114;if(_0x1590df[_0x43db('0x25')]['includeAll']){_0x286f76[_0x43db('0x36')]=[{'all':!![]}];}return db[_0x43db('0x35')][_0x43db('0x37')](_0x286f76);})['then'](function(_0x5b4471){_0x25c98d[_0x43db('0x38')]=_0x5b4471;return _0x25c98d;})[_0x43db('0x12')](respondWithFilteredResult(_0x58ea91,_0x286f76))[_0x43db('0x39')](handleError(_0x58ea91,null));};exports[_0x43db('0x3a')]=function(_0x298fb6,_0x3e02d4){var _0x215af5={'raw':![],'where':{'id':_0x298fb6[_0x43db('0x3b')]['id']}},_0x37dccc={};_0x37dccc[_0x43db('0x24')]=_[_0x43db('0x26')](db['SquareProject'][_0x43db('0x20')]);_0x37dccc[_0x43db('0x25')]=_[_0x43db('0x26')](_0x298fb6[_0x43db('0x25')]);_0x37dccc['filters']=_[_0x43db('0x27')](_0x37dccc[_0x43db('0x24')],_0x37dccc[_0x43db('0x25')]);_0x215af5[_0x43db('0x29')]=_[_0x43db('0x27')](_0x37dccc[_0x43db('0x24')],qs[_0x43db('0x28')](_0x298fb6[_0x43db('0x25')]['fields']));_0x215af5[_0x43db('0x29')]=_0x215af5[_0x43db('0x29')][_0x43db('0x2a')]?_0x215af5[_0x43db('0x29')]:_0x37dccc[_0x43db('0x24')];if(_0x298fb6['query'][_0x43db('0x3c')]){_0x215af5[_0x43db('0x36')]=[{'all':!![]}];}_0x215af5=_[_0x43db('0x31')]({},_0x215af5,_0x298fb6[_0x43db('0x34')]);return db[_0x43db('0x35')]['find'](_0x215af5)[_0x43db('0x12')](handleEntityNotFound(_0x3e02d4,null))[_0x43db('0x12')](respondWithResult(_0x3e02d4,null))[_0x43db('0x39')](handleError(_0x3e02d4,null));};exports['create']=function(_0xbf1018,_0x212c6c){return db[_0x43db('0x35')][_0x43db('0x3d')](_0xbf1018['body'],{})[_0x43db('0x12')](function(_0x3e9980){var _0x45d9e5=_0xbf1018[_0x43db('0x3e')][_0x43db('0x14')]({'plain':!![]});if(!_0x45d9e5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x45d9e5[_0x43db('0x3f')]===_0x43db('0x3e')){var _0x4619b8=_0x3e9980[_0x43db('0x14')]({'plain':!![]});var _0xf06c66=_0x43db('0x40');return db[_0x43db('0x41')][_0x43db('0x42')]({'where':{'name':_0xf06c66,'userProfileId':_0x45d9e5[_0x43db('0x43')]},'raw':!![]})[_0x43db('0x12')](function(_0x23cd20){if(_0x23cd20&&_0x23cd20['autoAssociation']===0x0){return db[_0x43db('0x15')][_0x43db('0x3d')]({'name':_0x4619b8[_0x43db('0x1d')],'resourceId':_0x4619b8['id'],'type':_0x23cd20[_0x43db('0x1d')],'sectionId':_0x23cd20['id']},{})['then'](function(){return _0x3e9980;});}else{return _0x3e9980;}})['catch'](function(_0x4e793a){logger[_0x43db('0x1b')](_0x43db('0x44'),_0x4e793a);throw _0x4e793a;});}return _0x3e9980;})[_0x43db('0x12')](respondWithResult(_0x212c6c,0xc9))[_0x43db('0x39')](handleError(_0x212c6c,null));};exports[_0x43db('0x11')]=function(_0x1de97b,_0x29a3ae){if(_0x1de97b[_0x43db('0x45')]['id']){delete _0x1de97b['body']['id'];}return db['SquareProject']['find']({'where':{'id':_0x1de97b[_0x43db('0x3b')]['id']}})['then'](handleEntityNotFound(_0x29a3ae,null))[_0x43db('0x12')](saveUpdates(_0x1de97b[_0x43db('0x45')],null))[_0x43db('0x12')](function(_0x1ed153){if(!_0x1ed153)return;var _0x295b5e=_0x1ed153[_0x43db('0x14')]({'plain':!![]});return _0x295b5e;})[_0x43db('0x12')](function(_0x520475){var _0x43f880=new Redis(config[_0x43db('0x6')]);_0x43f880[_0x43db('0x16')](_0x43db('0x17'),JSON[_0x43db('0x18')](_['pick'](_0x520475,['id',_0x43db('0x1d'),'production'])));return _0x520475;})['then'](respondWithResult(_0x29a3ae,null))['catch'](handleError(_0x29a3ae,null));};exports['destroy']=function(_0xfe978e,_0x458a35){return db['SquareProject'][_0x43db('0x42')]({'where':{'id':_0xfe978e['params']['id']}})[_0x43db('0x12')](handleEntityNotFound(_0x458a35,null))['then'](removeEntity(_0x458a35,null))['catch'](handleError(_0x458a35,null));}; \ No newline at end of file +var _0x871d=['socket.io-emitter','./squareProject.socket','register','status','json','offset','limit','undefined','count','set','Content-Range','update','then','destroy','get','SquareProjects','UserProfileResource','publish','stringify','end','error','stack','name','send','index','map','SquareProject','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','filter','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','agi','pick','production','lodash','ioredis','../../components/parsers/qs','api','../../mysqldb','redis','defaults','localhost'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x871d,0x120));var _0xd871=function(_0x4d86c5,_0x47bee8){_0x4d86c5=_0x4d86c5-0x0;var _0x202a36=_0x871d[_0x4d86c5];return _0x202a36;};'use strict';var _=require(_0xd871('0x0'));var Redis=require(_0xd871('0x1'));var qs=require(_0xd871('0x2'));var logger=require('../../config/logger')(_0xd871('0x3'));var config=require('../../config/environment');var db=require(_0xd871('0x4'))['db'];config[_0xd871('0x5')]=_[_0xd871('0x6')](config[_0xd871('0x5')],{'host':_0xd871('0x7'),'port':0x18eb});var socket=require(_0xd871('0x8'))(new Redis(config['redis']));require(_0xd871('0x9'))[_0xd871('0xa')](socket);function respondWithResult(_0x37eb31,_0x3ee430){_0x3ee430=_0x3ee430||0xc8;return function(_0x8aab05){if(_0x8aab05){return _0x37eb31[_0xd871('0xb')](_0x3ee430)[_0xd871('0xc')](_0x8aab05);}};}function respondWithFilteredResult(_0xc25514,_0x103dd2){return function(_0x447057){if(_0x447057){var _0x3031e6=typeof _0x103dd2[_0xd871('0xd')]==='undefined'&&typeof _0x103dd2[_0xd871('0xe')]===_0xd871('0xf');var _0x3d0bc0=_0x447057[_0xd871('0x10')];var _0x250fa1=_0x3031e6?0x0:_0x103dd2['offset'];var _0x5d07ce=_0x3031e6?_0x447057[_0xd871('0x10')]:_0x103dd2[_0xd871('0xd')]+_0x103dd2[_0xd871('0xe')];var _0x1af403;if(_0x5d07ce>=_0x3d0bc0){_0x5d07ce=_0x3d0bc0;_0x1af403=0xc8;}else{_0x1af403=0xce;}_0xc25514[_0xd871('0xb')](_0x1af403);return _0xc25514[_0xd871('0x11')](_0xd871('0x12'),_0x250fa1+'-'+_0x5d07ce+'/'+_0x3d0bc0)[_0xd871('0xc')](_0x447057);}return null;};}function saveUpdates(_0x3dcaaf){return function(_0x4b412f){if(_0x4b412f){return _0x4b412f[_0xd871('0x13')](_0x3dcaaf)[_0xd871('0x14')](function(_0x337288){return _0x337288;});}return null;};}function removeEntity(_0x152d22){return function(_0x560905){if(_0x560905){return _0x560905[_0xd871('0x15')]()[_0xd871('0x14')](function(){var _0x45ae1a=_0x560905[_0xd871('0x16')]({'plain':!![]});var _0x4e0296=_0xd871('0x17');return db[_0xd871('0x18')][_0xd871('0x15')]({'where':{'type':_0x4e0296,'resourceId':_0x45ae1a['id']}})[_0xd871('0x14')](function(){return _0x560905;});})['then'](function(){var _0x2ab486=new Redis(config[_0xd871('0x5')]);_0x2ab486[_0xd871('0x19')]('agi',JSON[_0xd871('0x1a')]({'id':_0x560905['id'],'deleted':!![]}));})[_0xd871('0x14')](function(){_0x152d22['status'](0xcc)[_0xd871('0x1b')]();});}};}function handleEntityNotFound(_0xed29ad){return function(_0x1fc80c){if(!_0x1fc80c){_0xed29ad['sendStatus'](0x194);}return _0x1fc80c;};}function handleError(_0xe2b4d,_0x402d2d){_0x402d2d=_0x402d2d||0x1f4;return function(_0x432214){logger[_0xd871('0x1c')](_0x432214[_0xd871('0x1d')]);if(_0x432214[_0xd871('0x1e')]){delete _0x432214[_0xd871('0x1e')];}_0xe2b4d['status'](_0x402d2d)[_0xd871('0x1f')](_0x432214);};}exports[_0xd871('0x20')]=function(_0x44c756,_0x67fefe){var _0x27895a={},_0x4666fd={},_0xbd160c={'count':0x0,'rows':[]};var _0x195f61=_[_0xd871('0x21')](db[_0xd871('0x22')][_0xd871('0x23')],function(_0x1ffcc5){return{'name':_0x1ffcc5['fieldName'],'type':_0x1ffcc5['type'][_0xd871('0x24')]};});_0x4666fd[_0xd871('0x25')]=_[_0xd871('0x21')](_0x195f61,_0xd871('0x1e'));_0x4666fd['query']=_[_0xd871('0x26')](_0x44c756[_0xd871('0x27')]);_0x4666fd[_0xd871('0x28')]=_[_0xd871('0x29')](_0x4666fd[_0xd871('0x25')],_0x4666fd[_0xd871('0x27')]);_0x27895a[_0xd871('0x2a')]=_[_0xd871('0x29')](_0x4666fd[_0xd871('0x25')],qs[_0xd871('0x2b')](_0x44c756[_0xd871('0x27')][_0xd871('0x2b')]));_0x27895a[_0xd871('0x2a')]=_0x27895a[_0xd871('0x2a')][_0xd871('0x2c')]?_0x27895a[_0xd871('0x2a')]:_0x4666fd[_0xd871('0x25')];if(!_0x44c756[_0xd871('0x27')][_0xd871('0x2d')](_0xd871('0x2e'))){_0x27895a[_0xd871('0xe')]=qs[_0xd871('0xe')](_0x44c756[_0xd871('0x27')]['limit']);_0x27895a[_0xd871('0xd')]=qs[_0xd871('0xd')](_0x44c756[_0xd871('0x27')][_0xd871('0xd')]);}_0x27895a[_0xd871('0x2f')]=qs[_0xd871('0x30')](_0x44c756[_0xd871('0x27')][_0xd871('0x30')]);_0x27895a['where']=qs[_0xd871('0x28')](_['pick'](_0x44c756['query'],_0x4666fd['filters']),_0x195f61);if(_0x44c756[_0xd871('0x27')]['filter']){_0x27895a[_0xd871('0x31')]=_[_0xd871('0x32')](_0x27895a[_0xd871('0x31')],{'$or':_[_0xd871('0x21')](_0x195f61,function(_0x4768ba){if(_0x4768ba[_0xd871('0x33')]!=='VIRTUAL'){var _0x2b342b={};_0x2b342b[_0x4768ba[_0xd871('0x1e')]]={'$like':'%'+_0x44c756[_0xd871('0x27')][_0xd871('0x34')]+'%'};return _0x2b342b;}})});}_0x27895a=_[_0xd871('0x32')]({},_0x27895a,_0x44c756['options']);var _0x5567c7={'where':_0x27895a['where']};return db[_0xd871('0x22')][_0xd871('0x10')](_0x5567c7)['then'](function(_0x3b93ce){_0xbd160c['count']=_0x3b93ce;if(_0x44c756[_0xd871('0x27')][_0xd871('0x35')]){_0x27895a[_0xd871('0x36')]=[{'all':!![]}];}return db[_0xd871('0x22')][_0xd871('0x37')](_0x27895a);})[_0xd871('0x14')](function(_0x5e7ca1){_0xbd160c[_0xd871('0x38')]=_0x5e7ca1;return _0xbd160c;})[_0xd871('0x14')](respondWithFilteredResult(_0x67fefe,_0x27895a))['catch'](handleError(_0x67fefe,null));};exports[_0xd871('0x39')]=function(_0x5ef3cf,_0x49445c){var _0x46c857={'raw':![],'where':{'id':_0x5ef3cf[_0xd871('0x3a')]['id']}},_0xda9ad7={};_0xda9ad7['model']=_['keys'](db['SquareProject'][_0xd871('0x23')]);_0xda9ad7[_0xd871('0x27')]=_[_0xd871('0x26')](_0x5ef3cf[_0xd871('0x27')]);_0xda9ad7[_0xd871('0x28')]=_['intersection'](_0xda9ad7[_0xd871('0x25')],_0xda9ad7[_0xd871('0x27')]);_0x46c857[_0xd871('0x2a')]=_[_0xd871('0x29')](_0xda9ad7['model'],qs[_0xd871('0x2b')](_0x5ef3cf['query'][_0xd871('0x2b')]));_0x46c857[_0xd871('0x2a')]=_0x46c857[_0xd871('0x2a')][_0xd871('0x2c')]?_0x46c857[_0xd871('0x2a')]:_0xda9ad7['model'];if(_0x5ef3cf[_0xd871('0x27')][_0xd871('0x35')]){_0x46c857[_0xd871('0x36')]=[{'all':!![]}];}_0x46c857=_[_0xd871('0x32')]({},_0x46c857,_0x5ef3cf[_0xd871('0x3b')]);return db[_0xd871('0x22')][_0xd871('0x3c')](_0x46c857)[_0xd871('0x14')](handleEntityNotFound(_0x49445c,null))[_0xd871('0x14')](respondWithResult(_0x49445c,null))[_0xd871('0x3d')](handleError(_0x49445c,null));};exports[_0xd871('0x3e')]=function(_0x5a4676,_0x41810c){return db[_0xd871('0x22')]['create'](_0x5a4676[_0xd871('0x3f')],{})[_0xd871('0x14')](function(_0x51b9c0){var _0x49df4d=_0x5a4676[_0xd871('0x40')][_0xd871('0x16')]({'plain':!![]});if(!_0x49df4d)throw new Error(_0xd871('0x41'));if(_0x49df4d[_0xd871('0x42')]===_0xd871('0x40')){var _0x4c986b=_0x51b9c0[_0xd871('0x16')]({'plain':!![]});var _0x1328f3=_0xd871('0x17');return db[_0xd871('0x43')][_0xd871('0x3c')]({'where':{'name':_0x1328f3,'userProfileId':_0x49df4d[_0xd871('0x44')]},'raw':!![]})[_0xd871('0x14')](function(_0x211adf){if(_0x211adf&&_0x211adf[_0xd871('0x45')]===0x0){return db[_0xd871('0x18')][_0xd871('0x3e')]({'name':_0x4c986b['name'],'resourceId':_0x4c986b['id'],'type':_0x211adf[_0xd871('0x1e')],'sectionId':_0x211adf['id']},{})[_0xd871('0x14')](function(){return _0x51b9c0;});}else{return _0x51b9c0;}})[_0xd871('0x3d')](function(_0x515750){logger[_0xd871('0x1c')](_0xd871('0x46'),_0x515750);throw _0x515750;});}return _0x51b9c0;})[_0xd871('0x14')](respondWithResult(_0x41810c,0xc9))[_0xd871('0x3d')](handleError(_0x41810c,null));};exports[_0xd871('0x13')]=function(_0x50efe7,_0xb20a0e){if(_0x50efe7['body']['id']){delete _0x50efe7[_0xd871('0x3f')]['id'];}return db[_0xd871('0x22')][_0xd871('0x3c')]({'where':{'id':_0x50efe7[_0xd871('0x3a')]['id']}})[_0xd871('0x14')](handleEntityNotFound(_0xb20a0e,null))['then'](saveUpdates(_0x50efe7[_0xd871('0x3f')],null))['then'](function(_0x236d83){if(!_0x236d83)return;var _0x341a93=_0x236d83[_0xd871('0x16')]({'plain':!![]});return _0x341a93;})['then'](function(_0x113f86){var _0x1ce0dd=new Redis(config[_0xd871('0x5')]);_0x1ce0dd['publish'](_0xd871('0x47'),JSON['stringify'](_[_0xd871('0x48')](_0x113f86,['id','name',_0xd871('0x49')])));return _0x113f86;})['then'](respondWithResult(_0xb20a0e,null))[_0xd871('0x3d')](handleError(_0xb20a0e,null));};exports[_0xd871('0x15')]=function(_0x31b3ec,_0xa419dc){return db[_0xd871('0x22')]['find']({'where':{'id':_0x31b3ec[_0xd871('0x3a')]['id']}})['then'](handleEntityNotFound(_0xa419dc,null))[_0xd871('0x14')](removeEntity(_0xa419dc,null))[_0xd871('0x3d')](handleError(_0xa419dc,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 3526c44..381b783 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 _0x944d=['../../mysqldb','SquareProject','setMaxListeners','remove','emit','hasOwnProperty','hook','events'];(function(_0x19de20,_0x4e6684){var _0x55d051=function(_0x5ce498){while(--_0x5ce498){_0x19de20['push'](_0x19de20['shift']());}};_0x55d051(++_0x4e6684);}(_0x944d,0xbf));var _0xd944=function(_0x1e8c9b,_0x519939){_0x1e8c9b=_0x1e8c9b-0x0;var _0x5ececb=_0x944d[_0x1e8c9b];return _0x5ececb;};'use strict';var EventEmitter=require(_0xd944('0x0'));var SquareProject=require(_0xd944('0x1'))['db'][_0xd944('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xd944('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xd944('0x4')};function emitEvent(_0x4ba28f){return function(_0x2cf9ce,_0x507261,_0x3109de){SquareProjectEvents[_0xd944('0x5')](_0x4ba28f+':'+_0x2cf9ce['id'],_0x2cf9ce);SquareProjectEvents[_0xd944('0x5')](_0x4ba28f,_0x2cf9ce);_0x3109de(null);};}for(var e in events){if(events[_0xd944('0x6')](e)){var event=events[e];SquareProject[_0xd944('0x7')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0x365a=['hasOwnProperty','hook','exports','events','../../mysqldb','SquareProject','setMaxListeners','save','update','remove','emit'];(function(_0x374ada,_0x27b3a5){var _0x449ed8=function(_0x3efc46){while(--_0x3efc46){_0x374ada['push'](_0x374ada['shift']());}};_0x449ed8(++_0x27b3a5);}(_0x365a,0x18f));var _0xa365=function(_0x36c82a,_0x4cc242){_0x36c82a=_0x36c82a-0x0;var _0x49e0cc=_0x365a[_0x36c82a];return _0x49e0cc;};'use strict';var EventEmitter=require(_0xa365('0x0'));var SquareProject=require(_0xa365('0x1'))['db'][_0xa365('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xa365('0x3')](0x0);var events={'afterCreate':_0xa365('0x4'),'afterUpdate':_0xa365('0x5'),'afterDestroy':_0xa365('0x6')};function emitEvent(_0x1596a3){return function(_0x279309,_0x504886,_0x5191bf){SquareProjectEvents[_0xa365('0x7')](_0x1596a3+':'+_0x279309['id'],_0x279309);SquareProjectEvents[_0xa365('0x7')](_0x1596a3,_0x279309);_0x5191bf(null);};}for(var e in events){if(events[_0xa365('0x8')](e)){var event=events[e];SquareProject[_0xa365('0x9')](e,emitEvent(event));}}module[_0xa365('0xa')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 55e8cee..5ff234e 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 _0x2756=['rimraf','./squareProject.attributes','exports','changed','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','bluebird','request-promise','path'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x2756,0xa4));var _0x6275=function(_0x2d4421,_0x15a84f){_0x2d4421=_0x2d4421-0x0;var _0x2d3b01=_0x2756[_0x2d4421];return _0x2d3b01;};'use strict';var _=require(_0x6275('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x6275('0x1'));var rp=require(_0x6275('0x2'));var fs=require('fs');var path=require(_0x6275('0x3'));var rimraf=require(_0x6275('0x4'));var config=require('../../config/environment');var attributes=require(_0x6275('0x5'));module[_0x6275('0x6')]=function(_0x19f3ec,_0x43cb42){return _0x19f3ec['define']('SquareProject',attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x57e561,_0x2371b6,_0x1fa1e8){if(_0x57e561[_0x6275('0x7')]('preproduction')){_0x57e561['savedAt']=moment()[_0x6275('0x8')](_0x6275('0x9'));}if(_0x57e561['changed'](_0x6275('0xa'))){_0x57e561[_0x6275('0xb')]=moment()[_0x6275('0x8')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1fa1e8(null,_0x57e561);}}});}; \ No newline at end of file +var _0x5f97=['rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','publishedAt','lodash','util','api','bluebird','request-promise','path'];(function(_0x4ba18d,_0x134851){var _0x3a9bc6=function(_0x46f9e2){while(--_0x46f9e2){_0x4ba18d['push'](_0x4ba18d['shift']());}};_0x3a9bc6(++_0x134851);}(_0x5f97,0xd2));var _0x75f9=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5f97[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x75f9('0x0'));var util=require(_0x75f9('0x1'));var logger=require('../../config/logger')(_0x75f9('0x2'));var moment=require('moment');var BPromise=require(_0x75f9('0x3'));var rp=require(_0x75f9('0x4'));var fs=require('fs');var path=require(_0x75f9('0x5'));var rimraf=require(_0x75f9('0x6'));var config=require(_0x75f9('0x7'));var attributes=require(_0x75f9('0x8'));module[_0x75f9('0x9')]=function(_0x5a7039,_0x2d9786){return _0x5a7039[_0x75f9('0xa')](_0x75f9('0xb'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5cf354,_0x1615bb,_0x501198){if(_0x5cf354[_0x75f9('0xc')](_0x75f9('0xd'))){_0x5cf354[_0x75f9('0xe')]=moment()[_0x75f9('0xf')](_0x75f9('0x10'));}if(_0x5cf354[_0x75f9('0xc')]('production')){_0x5cf354[_0x75f9('0x11')]=moment()[_0x75f9('0xf')](_0x75f9('0x10'));}_0x501198(null,_0x5cf354);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 3ec08a8..8a50cb8 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 _0xd7df=['defaults','localhost','socket.io-emitter','./squareProject.socket','GetSquareProjects','SquareProject','findAll','options','raw','where','attributes','limit','map','include','model','info','stringify','error','message','ShowSquareProject','find','then','debug','catch','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis'];(function(_0x2a62ce,_0x41dd6d){var _0xcbbb31=function(_0x28e5db){while(--_0x28e5db){_0x2a62ce['push'](_0x2a62ce['shift']());}};_0xcbbb31(++_0x41dd6d);}(_0xd7df,0x16d));var _0xfd7d=function(_0x165ee2,_0x8630fd){_0x165ee2=_0x165ee2-0x0;var _0x4b3e21=_0xd7df[_0x165ee2];return _0x4b3e21;};'use strict';var _=require(_0xfd7d('0x0'));var Redis=require(_0xfd7d('0x1'));var db=require(_0xfd7d('0x2'))['db'];var logger=require(_0xfd7d('0x3'))(_0xfd7d('0x4'));var config=require(_0xfd7d('0x5'));config[_0xfd7d('0x6')]=_[_0xfd7d('0x7')](config['redis'],{'host':_0xfd7d('0x8'),'port':0x18eb});var socket=require(_0xfd7d('0x9'))(new Redis(config[_0xfd7d('0x6')]));require(_0xfd7d('0xa'))['register'](socket);exports[_0xfd7d('0xb')]=function(_0x1e38e4){var _0x3e833d=this;return new Promise(function(_0x3600db,_0x336b42){return db[_0xfd7d('0xc')][_0xfd7d('0xd')]({'raw':_0x1e38e4[_0xfd7d('0xe')]?_0x1e38e4[_0xfd7d('0xe')][_0xfd7d('0xf')]===undefined?!![]:![]:!![],'where':_0x1e38e4[_0xfd7d('0xe')]?_0x1e38e4[_0xfd7d('0xe')][_0xfd7d('0x10')]||null:null,'attributes':_0x1e38e4[_0xfd7d('0xe')]?_0x1e38e4[_0xfd7d('0xe')][_0xfd7d('0x11')]||null:null,'limit':_0x1e38e4['options']?_0x1e38e4[_0xfd7d('0xe')][_0xfd7d('0x12')]||null:null,'include':_0x1e38e4['options']?_0x1e38e4[_0xfd7d('0xe')]['include']?_[_0xfd7d('0x13')](_0x1e38e4[_0xfd7d('0xe')][_0xfd7d('0x14')],function(_0x3d5ab2){return{'model':db[_0x3d5ab2[_0xfd7d('0x15')]],'as':_0x3d5ab2['as'],'attributes':_0x3d5ab2['attributes'],'include':_0x3d5ab2['include']?_[_0xfd7d('0x13')](_0x3d5ab2['include'],function(_0x5e82e5){return{'model':db[_0x5e82e5['model']],'as':_0x5e82e5['as'],'attributes':_0x5e82e5[_0xfd7d('0x11')],'include':_0x5e82e5[_0xfd7d('0x14')]?_[_0xfd7d('0x13')](_0x5e82e5[_0xfd7d('0x14')],function(_0x4ea511){return{'model':db[_0x4ea511['model']],'as':_0x4ea511['as'],'attributes':_0x4ea511[_0xfd7d('0x11')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a601e){logger[_0xfd7d('0x16')](_0xfd7d('0xb'),_0x1e38e4);logger['debug'](_0xfd7d('0xb'),_0x1e38e4,JSON[_0xfd7d('0x17')](_0x3a601e));_0x3600db(_0x3a601e);})['catch'](function(_0x570a04){logger[_0xfd7d('0x18')](_0xfd7d('0xb'),_0x570a04[_0xfd7d('0x19')],_0x1e38e4);_0x336b42(_0x3e833d[_0xfd7d('0x18')](0x1f4,_0x570a04[_0xfd7d('0x19')]));});});};exports[_0xfd7d('0x1a')]=function(_0x28c63e){var _0x5185da=this;return new Promise(function(_0x217cbf,_0x1765b2){return db[_0xfd7d('0xc')][_0xfd7d('0x1b')]({'raw':_0x28c63e[_0xfd7d('0xe')]?_0x28c63e['options']['raw']===undefined?!![]:![]:!![],'where':_0x28c63e[_0xfd7d('0xe')]?_0x28c63e['options'][_0xfd7d('0x10')]||null:null,'attributes':_0x28c63e[_0xfd7d('0xe')]?_0x28c63e[_0xfd7d('0xe')]['attributes']||null:null,'include':_0x28c63e[_0xfd7d('0xe')]?_0x28c63e[_0xfd7d('0xe')][_0xfd7d('0x14')]?_[_0xfd7d('0x13')](_0x28c63e[_0xfd7d('0xe')][_0xfd7d('0x14')],function(_0x28fc85){return{'model':db[_0x28fc85[_0xfd7d('0x15')]],'as':_0x28fc85['as'],'attributes':_0x28fc85['attributes'],'include':_0x28fc85['include']?_['map'](_0x28fc85[_0xfd7d('0x14')],function(_0x51e844){return{'model':db[_0x51e844[_0xfd7d('0x15')]],'as':_0x51e844['as'],'attributes':_0x51e844['attributes'],'include':_0x51e844[_0xfd7d('0x14')]?_['map'](_0x51e844[_0xfd7d('0x14')],function(_0x2068f5){return{'model':db[_0x2068f5[_0xfd7d('0x15')]],'as':_0x2068f5['as'],'attributes':_0x2068f5[_0xfd7d('0x11')]};}):[]};}):[]};}):[]:[]})[_0xfd7d('0x1c')](function(_0x2befdd){logger[_0xfd7d('0x16')]('ShowSquareProject',_0x28c63e);logger[_0xfd7d('0x1d')]('ShowSquareProject',_0x28c63e,JSON[_0xfd7d('0x17')](_0x2befdd));_0x217cbf(_0x2befdd);})[_0xfd7d('0x1e')](function(_0x1785cf){logger[_0xfd7d('0x18')](_0xfd7d('0x1a'),_0x1785cf['message'],_0x28c63e);_0x1765b2(_0x5185da[_0xfd7d('0x18')](0x1f4,_0x1785cf[_0xfd7d('0x19')]));});});}; \ No newline at end of file +var _0x06a9=['attributes','map','GetSquareProjects','stringify','catch','error','message','SquareProject','find','then','info','ShowSquareProject','lodash','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','findAll','options','raw','limit','include','model'];(function(_0x28ea3b,_0x13d7a1){var _0x5ac766=function(_0x1ea77b){while(--_0x1ea77b){_0x28ea3b['push'](_0x28ea3b['shift']());}};_0x5ac766(++_0x13d7a1);}(_0x06a9,0xae));var _0x906a=function(_0x5e99c9,_0x2d9a74){_0x5e99c9=_0x5e99c9-0x0;var _0x2e519d=_0x06a9[_0x5e99c9];return _0x2e519d;};'use strict';var _=require(_0x906a('0x0'));var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var logger=require(_0x906a('0x1'))('rpc');var config=require(_0x906a('0x2'));config[_0x906a('0x3')]=_[_0x906a('0x4')](config[_0x906a('0x3')],{'host':_0x906a('0x5'),'port':0x18eb});var socket=require(_0x906a('0x6'))(new Redis(config[_0x906a('0x3')]));require(_0x906a('0x7'))[_0x906a('0x8')](socket);exports['GetSquareProjects']=function(_0x51e46f){var _0xa112e2=this;return new Promise(function(_0x226336,_0x282455){return db['SquareProject'][_0x906a('0x9')]({'raw':_0x51e46f[_0x906a('0xa')]?_0x51e46f[_0x906a('0xa')][_0x906a('0xb')]===undefined?!![]:![]:!![],'where':_0x51e46f[_0x906a('0xa')]?_0x51e46f[_0x906a('0xa')]['where']||null:null,'attributes':_0x51e46f[_0x906a('0xa')]?_0x51e46f[_0x906a('0xa')]['attributes']||null:null,'limit':_0x51e46f[_0x906a('0xa')]?_0x51e46f[_0x906a('0xa')][_0x906a('0xc')]||null:null,'include':_0x51e46f[_0x906a('0xa')]?_0x51e46f[_0x906a('0xa')][_0x906a('0xd')]?_['map'](_0x51e46f[_0x906a('0xa')][_0x906a('0xd')],function(_0x4558fc){return{'model':db[_0x4558fc[_0x906a('0xe')]],'as':_0x4558fc['as'],'attributes':_0x4558fc[_0x906a('0xf')],'include':_0x4558fc[_0x906a('0xd')]?_[_0x906a('0x10')](_0x4558fc['include'],function(_0x107bb2){return{'model':db[_0x107bb2[_0x906a('0xe')]],'as':_0x107bb2['as'],'attributes':_0x107bb2[_0x906a('0xf')],'include':_0x107bb2[_0x906a('0xd')]?_[_0x906a('0x10')](_0x107bb2[_0x906a('0xd')],function(_0x49ecd6){return{'model':db[_0x49ecd6['model']],'as':_0x49ecd6['as'],'attributes':_0x49ecd6[_0x906a('0xf')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x144642){logger['info'](_0x906a('0x11'),_0x51e46f);logger['debug'](_0x906a('0x11'),_0x51e46f,JSON[_0x906a('0x12')](_0x144642));_0x226336(_0x144642);})[_0x906a('0x13')](function(_0xcf5c8d){logger[_0x906a('0x14')](_0x906a('0x11'),_0xcf5c8d[_0x906a('0x15')],_0x51e46f);_0x282455(_0xa112e2[_0x906a('0x14')](0x1f4,_0xcf5c8d[_0x906a('0x15')]));});});};exports['ShowSquareProject']=function(_0x50a2cd){var _0x8fe316=this;return new Promise(function(_0xa716ba,_0x316aa0){return db[_0x906a('0x16')][_0x906a('0x17')]({'raw':_0x50a2cd[_0x906a('0xa')]?_0x50a2cd[_0x906a('0xa')][_0x906a('0xb')]===undefined?!![]:![]:!![],'where':_0x50a2cd['options']?_0x50a2cd[_0x906a('0xa')]['where']||null:null,'attributes':_0x50a2cd[_0x906a('0xa')]?_0x50a2cd[_0x906a('0xa')][_0x906a('0xf')]||null:null,'include':_0x50a2cd[_0x906a('0xa')]?_0x50a2cd[_0x906a('0xa')][_0x906a('0xd')]?_['map'](_0x50a2cd[_0x906a('0xa')]['include'],function(_0x43208e){return{'model':db[_0x43208e[_0x906a('0xe')]],'as':_0x43208e['as'],'attributes':_0x43208e[_0x906a('0xf')],'include':_0x43208e[_0x906a('0xd')]?_['map'](_0x43208e[_0x906a('0xd')],function(_0x13c3c2){return{'model':db[_0x13c3c2[_0x906a('0xe')]],'as':_0x13c3c2['as'],'attributes':_0x13c3c2[_0x906a('0xf')],'include':_0x13c3c2[_0x906a('0xd')]?_[_0x906a('0x10')](_0x13c3c2[_0x906a('0xd')],function(_0x3dc81d){return{'model':db[_0x3dc81d['model']],'as':_0x3dc81d['as'],'attributes':_0x3dc81d[_0x906a('0xf')]};}):[]};}):[]};}):[]:[]})[_0x906a('0x18')](function(_0x2c8201){logger[_0x906a('0x19')]('ShowSquareProject',_0x50a2cd);logger['debug'](_0x906a('0x1a'),_0x50a2cd,JSON[_0x906a('0x12')](_0x2c8201));_0xa716ba(_0x2c8201);})[_0x906a('0x13')](function(_0x161c83){logger[_0x906a('0x14')](_0x906a('0x1a'),_0x161c83[_0x906a('0x15')],_0x50a2cd);_0x316aa0(_0x8fe316[_0x906a('0x14')](0x1f4,_0x161c83[_0x906a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index caf6ade..f008b81 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 _0xa09c=['remove','update','emit','removeListener','length','squareProject:','./squareProject.events','save'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xa09c,0x1e6));var _0xca09=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa09c[_0x4709c0];return _0x13348b;};'use strict';var SquareProjectEvents=require(_0xca09('0x0'));var events=[_0xca09('0x1'),_0xca09('0x2'),_0xca09('0x3')];function createListener(_0x2074c7,_0x25673f){return function(_0x3b6af8){_0x25673f[_0xca09('0x4')](_0x2074c7,_0x3b6af8);};}function removeListener(_0x28234b,_0x1b6ee1){return function(){SquareProjectEvents[_0xca09('0x5')](_0x28234b,_0x1b6ee1);};}exports['register']=function(_0x2e0086){for(var _0x1c84a1=0x0,_0x373e64=events[_0xca09('0x6')];_0x1c84a1<_0x373e64;_0x1c84a1++){var _0x113ea0=events[_0x1c84a1];var _0x17a2d3=createListener(_0xca09('0x7')+_0x113ea0,_0x2e0086);SquareProjectEvents['on'](_0x113ea0,_0x17a2d3);}}; \ No newline at end of file +var _0xa548=['remove','update','emit','removeListener','register','length','squareProject:','./squareProject.events'];(function(_0xe43511,_0xe1ccb8){var _0x19dbea=function(_0xe62369){while(--_0xe62369){_0xe43511['push'](_0xe43511['shift']());}};_0x19dbea(++_0xe1ccb8);}(_0xa548,0x1bf));var _0x8a54=function(_0x5edf9e,_0x365be1){_0x5edf9e=_0x5edf9e-0x0;var _0x127d1b=_0xa548[_0x5edf9e];return _0x127d1b;};'use strict';var SquareProjectEvents=require(_0x8a54('0x0'));var events=['save',_0x8a54('0x1'),_0x8a54('0x2')];function createListener(_0x4b7123,_0x4cbad0){return function(_0x586b5f){_0x4cbad0[_0x8a54('0x3')](_0x4b7123,_0x586b5f);};}function removeListener(_0x3c26ed,_0x787715){return function(){SquareProjectEvents[_0x8a54('0x4')](_0x3c26ed,_0x787715);};}exports[_0x8a54('0x5')]=function(_0x577322){for(var _0x55af86=0x0,_0x1b7998=events[_0x8a54('0x6')];_0x55af86<_0x1b7998;_0x55af86++){var _0x48d7ea=events[_0x55af86];var _0x10270c=createListener(_0x8a54('0x7')+_0x48d7ea,_0x577322);SquareProjectEvents['on'](_0x48d7ea,_0x10270c);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 24c7d40..f66af1c 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 _0x7fbe=['/:id','show','/:id/download','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','index'];(function(_0x1fbbd6,_0x2fd90e){var _0x31acdc=function(_0x50bc3d){while(--_0x50bc3d){_0x1fbbd6['push'](_0x1fbbd6['shift']());}};_0x31acdc(++_0x2fd90e);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x45655c,_0x407b81){_0x45655c=_0x45655c-0x0;var _0x24a8d9=_0x7fbe[_0x45655c];return _0x24a8d9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var fs_extra=require(_0xe7fb('0x4'));var auth=require(_0xe7fb('0x5'));var interaction=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var controller=require(_0xe7fb('0x8'));router[_0xe7fb('0x9')]('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xb')]);router[_0xe7fb('0x9')](_0xe7fb('0xc'),auth['isAuthenticated'](),controller[_0xe7fb('0xd')]);router[_0xe7fb('0x9')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller['download']);router['post']('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xf')]);router[_0xe7fb('0x10')](_0xe7fb('0xc'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x11')]);router[_0xe7fb('0x12')](_0xe7fb('0xc'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x13')]);module[_0xe7fb('0x14')]=router; \ No newline at end of file +var _0xe14b=['Router','../../components/auth/service','./squareRecording.controller','get','isAuthenticated','index','/:id','download','post','delete','destroy','exports','multer','util','express'];(function(_0x3264d1,_0x4dbcb7){var _0x4fd95d=function(_0x1a97c8){while(--_0x1a97c8){_0x3264d1['push'](_0x3264d1['shift']());}};_0x4fd95d(++_0x4dbcb7);}(_0xe14b,0x93));var _0xbe14=function(_0x5743f5,_0x42f1b1){_0x5743f5=_0x5743f5-0x0;var _0x1ed2b6=_0xe14b[_0x5743f5];return _0x1ed2b6;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['show']);router['get']('/:id/download',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0xb')]('/',auth[_0xbe14('0x7')](),controller['create']);router['put'](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0xc')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xd')]);module[_0xbe14('0xe')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index c639a58..f4054a0 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 _0xd6d6=['substring','sequelize','exports','STRING','VIRTUAL','getDataValue','savePath'];(function(_0x1dd8a3,_0x49a0c2){var _0x185f77=function(_0x2d3427){while(--_0x2d3427){_0x1dd8a3['push'](_0x1dd8a3['shift']());}};_0x185f77(++_0x49a0c2);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x2807cb,_0x152a04){_0x2807cb=_0x2807cb-0x0;var _0xbc50ec=_0xd6d6[_0x2807cb];return _0xbc50ec;};'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 +var _0x2bd8=['STRING','VIRTUAL','getDataValue','substring','sequelize'];(function(_0xb833b1,_0x1c3d3f){var _0x1ab87a=function(_0x1c9f6c){while(--_0x1c9f6c){_0xb833b1['push'](_0xb833b1['shift']());}};_0x1ab87a(++_0x1c3d3f);}(_0x2bd8,0x130));var _0x82bd=function(_0x3e5e65,_0x58c4f4){_0x3e5e65=_0x3e5e65-0x0;var _0xbe9361=_0x2bd8[_0x3e5e65];return _0xbe9361;};'use strict';var Sequelize=require(_0x82bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x82bd('0x1')]},'callerid':{'type':Sequelize[_0x82bd('0x1')]},'calleridname':{'type':Sequelize[_0x82bd('0x1')]},'context':{'type':Sequelize[_0x82bd('0x1')]},'extension':{'type':Sequelize[_0x82bd('0x1')]},'priority':{'type':Sequelize[_0x82bd('0x1')]},'accountcode':{'type':Sequelize[_0x82bd('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x82bd('0x1')]},'saveName':{'type':Sequelize[_0x82bd('0x1')]},'filename':{'type':Sequelize[_0x82bd('0x1')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x82bd('0x2')],'get':function(){var _0x77d7a9='';var _0x226f60=this[_0x82bd('0x3')]('savePath');if(_0x226f60){_0x77d7a9=_0x226f60[_0x82bd('0x4')](_0x226f60['lastIndexOf']('.'));}return _0x77d7a9;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 366fc13..a2a8a0e 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 _0x41d3=['name','send','index','SquareRecording','fieldName','type','key','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','where','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','length','find','catch','create','body','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','decryptFile','secrets','existsSync','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','update','then','error','stack'];(function(_0x26ad0d,_0x383fdd){var _0x19af1a=function(_0x319b08){while(--_0x319b08){_0x26ad0d['push'](_0x26ad0d['shift']());}};_0x19af1a(++_0x383fdd);}(_0x41d3,0x1c6));var _0x341d=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x41d3[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0x341d('0x0'));var rimraf=require(_0x341d('0x1'));var zipdir=require(_0x341d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x341d('0x3'));var moment=require(_0x341d('0x4'));var BPromise=require(_0x341d('0x5'));var Mustache=require('mustache');var util=require(_0x341d('0x6'));var path=require(_0x341d('0x7'));var sox=require(_0x341d('0x8'));var csv=require('to-csv');var ejs=require(_0x341d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x341d('0xa'));var squel=require(_0x341d('0xb'));var crypto=require(_0x341d('0xc'));var jsforce=require(_0x341d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x341d('0xe'));var querystring=require(_0x341d('0xf'));var Papa=require(_0x341d('0x10'));var Redis=require(_0x341d('0x11'));var authService=require(_0x341d('0x12'));var qs=require(_0x341d('0x13'));var as=require(_0x341d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x341d('0x15'))(_0x341d('0x16'));var utils=require(_0x341d('0x17'));var config=require(_0x341d('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x341d('0x19'))['db'];function respondWithStatusCode(_0x280fdb,_0x21f09f){_0x21f09f=_0x21f09f||0xcc;return function(_0x2fe2b1){if(_0x2fe2b1){return _0x280fdb[_0x341d('0x1a')](_0x21f09f);}return _0x280fdb[_0x341d('0x1b')](_0x21f09f)[_0x341d('0x1c')]();};}function respondWithResult(_0x477de0,_0xa85a54){_0xa85a54=_0xa85a54||0xc8;return function(_0x328ad6){if(_0x328ad6){return _0x477de0['status'](_0xa85a54)[_0x341d('0x1d')](_0x328ad6);}};}function respondWithFilteredResult(_0x92d29b,_0x405499){return function(_0x3f802e){if(_0x3f802e){var _0xeb003e=typeof _0x405499[_0x341d('0x1e')]==='undefined'&&typeof _0x405499[_0x341d('0x1f')]===_0x341d('0x20');var _0x3c4a1e=_0x3f802e[_0x341d('0x21')];var _0x2cbe5f=_0xeb003e?0x0:_0x405499[_0x341d('0x1e')];var _0x5e8f37=_0xeb003e?_0x3f802e[_0x341d('0x21')]:_0x405499['offset']+_0x405499['limit'];var _0x48c537;if(_0x5e8f37>=_0x3c4a1e){_0x5e8f37=_0x3c4a1e;_0x48c537=0xc8;}else{_0x48c537=0xce;}_0x92d29b['status'](_0x48c537);return _0x92d29b[_0x341d('0x22')]('Content-Range',_0x2cbe5f+'-'+_0x5e8f37+'/'+_0x3c4a1e)[_0x341d('0x1d')](_0x3f802e);}return null;};}function patchUpdates(_0x451661){return function(_0x5c6f22){try{jsonpatch[_0x341d('0x23')](_0x5c6f22,_0x451661,!![]);}catch(_0x196b66){return BPromise[_0x341d('0x24')](_0x196b66);}return _0x5c6f22['save']();};}function saveUpdates(_0x5c754b,_0x1027c7){return function(_0x59fe2f){if(_0x59fe2f){return _0x59fe2f[_0x341d('0x25')](_0x5c754b)[_0x341d('0x26')](function(_0x274b2c){return _0x274b2c;});}return null;};}function removeEntity(_0x74b2af,_0x776b35){return function(_0x221e79){if(_0x221e79){return _0x221e79['destroy']()[_0x341d('0x26')](function(){_0x74b2af[_0x341d('0x1b')](0xcc)[_0x341d('0x1c')]();});}};}function handleEntityNotFound(_0x46a5d7,_0x3ea150){return function(_0x5072ee){if(!_0x5072ee){_0x46a5d7[_0x341d('0x1a')](0x194);}return _0x5072ee;};}function handleError(_0x4d6647,_0x2e0070){_0x2e0070=_0x2e0070||0x1f4;return function(_0x32cae1){logger[_0x341d('0x27')](_0x32cae1[_0x341d('0x28')]);if(_0x32cae1['name']){delete _0x32cae1[_0x341d('0x29')];}_0x4d6647[_0x341d('0x1b')](_0x2e0070)[_0x341d('0x2a')](_0x32cae1);};}exports[_0x341d('0x2b')]=function(_0x5af585,_0x1bf1b0){var _0x54c4d4={},_0x2044a0={},_0x5e545b={'count':0x0,'rows':[]};var _0x26fb31=_['map'](db[_0x341d('0x2c')]['rawAttributes'],function(_0x235a91){return{'name':_0x235a91[_0x341d('0x2d')],'type':_0x235a91[_0x341d('0x2e')][_0x341d('0x2f')]};});_0x2044a0['model']=_['map'](_0x26fb31,'name');_0x2044a0[_0x341d('0x30')]=_[_0x341d('0x31')](_0x5af585[_0x341d('0x30')]);_0x2044a0['filters']=_[_0x341d('0x32')](_0x2044a0[_0x341d('0x33')],_0x2044a0[_0x341d('0x30')]);_0x54c4d4['attributes']=_[_0x341d('0x32')](_0x2044a0[_0x341d('0x33')],qs['fields'](_0x5af585[_0x341d('0x30')][_0x341d('0x34')]));_0x54c4d4[_0x341d('0x35')]=_0x54c4d4[_0x341d('0x35')]['length']?_0x54c4d4['attributes']:_0x2044a0[_0x341d('0x33')];if(!_0x5af585['query'][_0x341d('0x36')](_0x341d('0x37'))){_0x54c4d4[_0x341d('0x1f')]=qs[_0x341d('0x1f')](_0x5af585[_0x341d('0x30')]['limit']);_0x54c4d4[_0x341d('0x1e')]=qs[_0x341d('0x1e')](_0x5af585[_0x341d('0x30')][_0x341d('0x1e')]);}_0x54c4d4[_0x341d('0x38')]=qs['sort'](_0x5af585[_0x341d('0x30')][_0x341d('0x39')]);_0x54c4d4['where']=qs[_0x341d('0x3a')](_[_0x341d('0x3b')](_0x5af585[_0x341d('0x30')],_0x2044a0[_0x341d('0x3a')]),_0x26fb31);if(_0x5af585[_0x341d('0x30')]['filter']){_0x54c4d4['where']=_['merge'](_0x54c4d4[_0x341d('0x3c')],{'$or':_[_0x341d('0x3d')](_0x26fb31,function(_0x33d6e1){if(_0x33d6e1[_0x341d('0x2e')]!==_0x341d('0x3e')){var _0x13e0c6={};_0x13e0c6[_0x33d6e1['name']]={'$like':'%'+_0x5af585['query'][_0x341d('0x3f')]+'%'};return _0x13e0c6;}})});}_0x54c4d4=_['merge']({},_0x54c4d4,_0x5af585[_0x341d('0x40')]);var _0x3e737a={'where':_0x54c4d4['where']};return db[_0x341d('0x2c')][_0x341d('0x21')](_0x3e737a)['then'](function(_0x5b845f){_0x5e545b['count']=_0x5b845f;if(_0x5af585[_0x341d('0x30')][_0x341d('0x41')]){_0x54c4d4[_0x341d('0x42')]=[{'all':!![]}];}return db[_0x341d('0x2c')][_0x341d('0x43')](_0x54c4d4);})[_0x341d('0x26')](function(_0x2fc9f1){_0x5e545b[_0x341d('0x44')]=_0x2fc9f1;return _0x5e545b;})[_0x341d('0x26')](respondWithFilteredResult(_0x1bf1b0,_0x54c4d4))['catch'](handleError(_0x1bf1b0,null));};exports['show']=function(_0x2c3bef,_0x29456a){var _0x12d211={'raw':!![],'where':{'id':_0x2c3bef[_0x341d('0x45')]['id']}},_0xce236a={};_0xce236a[_0x341d('0x33')]=_[_0x341d('0x31')](db[_0x341d('0x2c')]['rawAttributes']);_0xce236a['query']=_[_0x341d('0x31')](_0x2c3bef[_0x341d('0x30')]);_0xce236a['filters']=_[_0x341d('0x32')](_0xce236a[_0x341d('0x33')],_0xce236a[_0x341d('0x30')]);_0x12d211[_0x341d('0x35')]=_['intersection'](_0xce236a['model'],qs['fields'](_0x2c3bef[_0x341d('0x30')]['fields']));_0x12d211[_0x341d('0x35')]=_0x12d211[_0x341d('0x35')][_0x341d('0x46')]?_0x12d211[_0x341d('0x35')]:_0xce236a[_0x341d('0x33')];if(_0x2c3bef[_0x341d('0x30')]['includeAll']){_0x12d211['include']=[{'all':!![]}];}_0x12d211=_['merge']({},_0x12d211,_0x2c3bef[_0x341d('0x40')]);return db[_0x341d('0x2c')][_0x341d('0x47')](_0x12d211)[_0x341d('0x26')](handleEntityNotFound(_0x29456a,null))['then'](respondWithResult(_0x29456a,null))[_0x341d('0x48')](handleError(_0x29456a,null));};exports['create']=function(_0x1ec103,_0xe1c50c){return db[_0x341d('0x2c')][_0x341d('0x49')](_0x1ec103[_0x341d('0x4a')],{})['then'](respondWithResult(_0xe1c50c,0xc9))[_0x341d('0x48')](handleError(_0xe1c50c,null));};exports['update']=function(_0x3998b2,_0x1ea007){if(_0x3998b2[_0x341d('0x4a')]['id']){delete _0x3998b2[_0x341d('0x4a')]['id'];}return db[_0x341d('0x2c')][_0x341d('0x47')]({'where':{'id':_0x3998b2['params']['id']}})[_0x341d('0x26')](handleEntityNotFound(_0x1ea007,null))['then'](saveUpdates(_0x3998b2[_0x341d('0x4a')],null))[_0x341d('0x26')](respondWithResult(_0x1ea007,null))['catch'](handleError(_0x1ea007,null));};exports[_0x341d('0x4b')]=function(_0xeabd41,_0x5a3cab,_0x3f0899){var _0x33f902=require(_0x341d('0x4c'));var _0x3fa6f1=![];var _0x350225={};if(_0xeabd41[_0x341d('0x30')][_0x341d('0x2e')]&&_0xeabd41[_0x341d('0x30')]['type']===_0x341d('0x4d')){_0x350225[_0x341d('0x4d')]=_0xeabd41[_0x341d('0x45')]['id'];}else{_0x350225['id']=_0xeabd41[_0x341d('0x45')]['id'];}return db['SquareRecording']['find']({'where':_0x350225,'attributes':['id',_0x341d('0x4e'),_0x341d('0x4f')],'raw':!![]})[_0x341d('0x26')](handleEntityNotFound(_0x5a3cab,null))['then'](function(_0x7ae700){if(_0x7ae700){var _0x405e2f=_0x7ae700[_0x341d('0x4e')];var _0x364cfa=util[_0x341d('0x50')](_0x341d('0x51'),_0x405e2f);if(fs['existsSync'](_0x364cfa)){_0x3fa6f1=!![];return _0x33f902[_0x341d('0x52')](_0x364cfa,_0x405e2f,config[_0x341d('0x53')]['recording'])[_0x341d('0x26')](function(){return _0x7ae700;});}return _0x7ae700;}})[_0x341d('0x26')](function(_0x2cc175){if(_0x2cc175){var _0x56dcdf=_0x2cc175[_0x341d('0x4e')];if(!fs[_0x341d('0x54')](_0x56dcdf)){throw new db[(_0x341d('0x55'))][(_0x341d('0x56'))](_0x341d('0x57'));}if(_0x2cc175['filename']){return _0x5a3cab[_0x341d('0x4b')](_0x56dcdf,_0x2cc175[_0x341d('0x4f')]+path[_0x341d('0x58')](_0x56dcdf),function(){if(_0x3fa6f1){fs[_0x341d('0x59')](_0x56dcdf);}});}else{return _0x5a3cab[_0x341d('0x4b')](_0x56dcdf,function(_0x218125){if(_0x3fa6f1){fs['unlink'](_0x56dcdf);}});}}})[_0x341d('0x48')](function(_0x51a06e){if(_0x51a06e['message']===_0x341d('0x57')){_0x5a3cab[_0x341d('0x1b')](0x194)['send']('Not\x20found');}else{return handleError(_0x5a3cab,null);}});};exports[_0x341d('0x5a')]=function(_0x23b022,_0xedd352){return db[_0x341d('0x2c')]['find']({'where':{'id':_0x23b022[_0x341d('0x45')]['id']}})[_0x341d('0x26')](function(_0x4b0797){if(_[_0x341d('0x5b')](_0x4b0797)){throw new ReferenceError(_0x341d('0x5c'));}return _0x4b0797;})[_0x341d('0x26')](function(_0x35abde){var _0x277775=_0x35abde['savePath'];logger[_0x341d('0x5d')](_0x341d('0x5e'),_0x277775);if(!_[_0x341d('0x5b')](_0x35abde[_0x341d('0x4e')])&&fs[_0x341d('0x54')](_0x277775)){logger[_0x341d('0x5d')]('File:\x20\x22'+_0x277775+_0x341d('0x5f'));fs[_0x341d('0x60')](_0x277775);}_0x277775=_0x277775+_0x341d('0x61');if(!_[_0x341d('0x5b')](_0x35abde[_0x341d('0x4e')])&&fs[_0x341d('0x54')](_0x277775)){logger[_0x341d('0x5d')](_0x341d('0x62')+_0x277775+_0x341d('0x5f'));fs['unlinkSync'](_0x277775);}return _0x35abde;})[_0x341d('0x26')](function(_0x2b3b4a){if(!_0x2b3b4a)throw new InternalError();return _0x2b3b4a['destroy']();})[_0x341d('0x26')](function(){_0xedd352['status'](0xcc)['end']();})[_0x341d('0x48')](handleError(_0xedd352,null));}; \ No newline at end of file +var _0x7f06=['keys','create','body','download','../../components/encryptor','uniqueid','savePath','format','%s.cypher','decryptFile','secrets','recording','existsSync','ValidationError','SquareRecording\x20not\x20found','filename','unlink','Not\x20found','find','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','update','then','destroy','error','name','index','map','SquareRecording','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','catch','params'];(function(_0xe6e78c,_0x582369){var _0x2a09c8=function(_0x470ccc){while(--_0x470ccc){_0xe6e78c['push'](_0xe6e78c['shift']());}};_0x2a09c8(++_0x582369);}(_0x7f06,0x193));var _0x67f0=function(_0x44ad0c,_0x10eec7){_0x44ad0c=_0x44ad0c-0x0;var _0x5c5954=_0x7f06[_0x44ad0c];return _0x5c5954;};'use strict';var emlformat=require(_0x67f0('0x0'));var rimraf=require(_0x67f0('0x1'));var zipdir=require(_0x67f0('0x2'));var jsonpatch=require(_0x67f0('0x3'));var rp=require(_0x67f0('0x4'));var moment=require('moment');var BPromise=require(_0x67f0('0x5'));var Mustache=require(_0x67f0('0x6'));var util=require(_0x67f0('0x7'));var path=require('path');var sox=require(_0x67f0('0x8'));var csv=require('to-csv');var ejs=require(_0x67f0('0x9'));var fs=require('fs');var fs_extra=require(_0x67f0('0xa'));var _=require('lodash');var squel=require(_0x67f0('0xb'));var crypto=require(_0x67f0('0xc'));var jsforce=require(_0x67f0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x67f0('0xe'));var querystring=require(_0x67f0('0xf'));var Papa=require(_0x67f0('0x10'));var Redis=require(_0x67f0('0x11'));var authService=require(_0x67f0('0x12'));var qs=require(_0x67f0('0x13'));var as=require(_0x67f0('0x14'));var hardwareService=require(_0x67f0('0x15'));var logger=require(_0x67f0('0x16'))(_0x67f0('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x67f0('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xedd751,_0x42d3aa){_0x42d3aa=_0x42d3aa||0xcc;return function(_0x3c5928){if(_0x3c5928){return _0xedd751[_0x67f0('0x19')](_0x42d3aa);}return _0xedd751[_0x67f0('0x1a')](_0x42d3aa)[_0x67f0('0x1b')]();};}function respondWithResult(_0x35b4e8,_0x4aa970){_0x4aa970=_0x4aa970||0xc8;return function(_0x482981){if(_0x482981){return _0x35b4e8[_0x67f0('0x1a')](_0x4aa970)['json'](_0x482981);}};}function respondWithFilteredResult(_0x331024,_0x630422){return function(_0x2f3c7f){if(_0x2f3c7f){var _0x542921=typeof _0x630422[_0x67f0('0x1c')]===_0x67f0('0x1d')&&typeof _0x630422[_0x67f0('0x1e')]==='undefined';var _0xf0960=_0x2f3c7f[_0x67f0('0x1f')];var _0xc2f9ea=_0x542921?0x0:_0x630422[_0x67f0('0x1c')];var _0x3dfad6=_0x542921?_0x2f3c7f[_0x67f0('0x1f')]:_0x630422[_0x67f0('0x1c')]+_0x630422[_0x67f0('0x1e')];var _0xed2f01;if(_0x3dfad6>=_0xf0960){_0x3dfad6=_0xf0960;_0xed2f01=0xc8;}else{_0xed2f01=0xce;}_0x331024[_0x67f0('0x1a')](_0xed2f01);return _0x331024[_0x67f0('0x20')]('Content-Range',_0xc2f9ea+'-'+_0x3dfad6+'/'+_0xf0960)[_0x67f0('0x21')](_0x2f3c7f);}return null;};}function patchUpdates(_0x5936f9){return function(_0x1b39d2){try{jsonpatch[_0x67f0('0x22')](_0x1b39d2,_0x5936f9,!![]);}catch(_0x59bb29){return BPromise[_0x67f0('0x23')](_0x59bb29);}return _0x1b39d2['save']();};}function saveUpdates(_0x58dbc9,_0x5b7056){return function(_0x3eb69a){if(_0x3eb69a){return _0x3eb69a[_0x67f0('0x24')](_0x58dbc9)[_0x67f0('0x25')](function(_0x1fc414){return _0x1fc414;});}return null;};}function removeEntity(_0x593bd8,_0x2513e6){return function(_0x10de0e){if(_0x10de0e){return _0x10de0e[_0x67f0('0x26')]()[_0x67f0('0x25')](function(){_0x593bd8[_0x67f0('0x1a')](0xcc)[_0x67f0('0x1b')]();});}};}function handleEntityNotFound(_0x747e80,_0x3af952){return function(_0xcf1876){if(!_0xcf1876){_0x747e80['sendStatus'](0x194);}return _0xcf1876;};}function handleError(_0xfca599,_0x381e79){_0x381e79=_0x381e79||0x1f4;return function(_0x4c9b0d){logger[_0x67f0('0x27')](_0x4c9b0d['stack']);if(_0x4c9b0d['name']){delete _0x4c9b0d[_0x67f0('0x28')];}_0xfca599[_0x67f0('0x1a')](_0x381e79)['send'](_0x4c9b0d);};}exports[_0x67f0('0x29')]=function(_0x43703d,_0x577d44){var _0x102de5={},_0x4d738e={},_0x2e711f={'count':0x0,'rows':[]};var _0x387296=_[_0x67f0('0x2a')](db[_0x67f0('0x2b')][_0x67f0('0x2c')],function(_0x9da1a5){return{'name':_0x9da1a5[_0x67f0('0x2d')],'type':_0x9da1a5[_0x67f0('0x2e')][_0x67f0('0x2f')]};});_0x4d738e['model']=_['map'](_0x387296,'name');_0x4d738e[_0x67f0('0x30')]=_['keys'](_0x43703d[_0x67f0('0x30')]);_0x4d738e['filters']=_[_0x67f0('0x31')](_0x4d738e[_0x67f0('0x32')],_0x4d738e['query']);_0x102de5[_0x67f0('0x33')]=_[_0x67f0('0x31')](_0x4d738e[_0x67f0('0x32')],qs['fields'](_0x43703d[_0x67f0('0x30')][_0x67f0('0x34')]));_0x102de5[_0x67f0('0x33')]=_0x102de5[_0x67f0('0x33')][_0x67f0('0x35')]?_0x102de5[_0x67f0('0x33')]:_0x4d738e['model'];if(!_0x43703d['query'][_0x67f0('0x36')]('nolimit')){_0x102de5['limit']=qs[_0x67f0('0x1e')](_0x43703d[_0x67f0('0x30')][_0x67f0('0x1e')]);_0x102de5[_0x67f0('0x1c')]=qs[_0x67f0('0x1c')](_0x43703d[_0x67f0('0x30')]['offset']);}_0x102de5['order']=qs[_0x67f0('0x37')](_0x43703d[_0x67f0('0x30')][_0x67f0('0x37')]);_0x102de5[_0x67f0('0x38')]=qs[_0x67f0('0x39')](_[_0x67f0('0x3a')](_0x43703d[_0x67f0('0x30')],_0x4d738e[_0x67f0('0x39')]),_0x387296);if(_0x43703d[_0x67f0('0x30')][_0x67f0('0x3b')]){_0x102de5[_0x67f0('0x38')]=_['merge'](_0x102de5['where'],{'$or':_['map'](_0x387296,function(_0x30ed79){if(_0x30ed79[_0x67f0('0x2e')]!==_0x67f0('0x3c')){var _0x278351={};_0x278351[_0x30ed79[_0x67f0('0x28')]]={'$like':'%'+_0x43703d['query'][_0x67f0('0x3b')]+'%'};return _0x278351;}})});}_0x102de5=_[_0x67f0('0x3d')]({},_0x102de5,_0x43703d[_0x67f0('0x3e')]);var _0x341a89={'where':_0x102de5[_0x67f0('0x38')]};return db['SquareRecording'][_0x67f0('0x1f')](_0x341a89)[_0x67f0('0x25')](function(_0x474cf7){_0x2e711f[_0x67f0('0x1f')]=_0x474cf7;if(_0x43703d[_0x67f0('0x30')][_0x67f0('0x3f')]){_0x102de5[_0x67f0('0x40')]=[{'all':!![]}];}return db[_0x67f0('0x2b')]['findAll'](_0x102de5);})['then'](function(_0x10f10a){_0x2e711f['rows']=_0x10f10a;return _0x2e711f;})[_0x67f0('0x25')](respondWithFilteredResult(_0x577d44,_0x102de5))[_0x67f0('0x41')](handleError(_0x577d44,null));};exports['show']=function(_0x73d19d,_0x2439c3){var _0x1e44d8={'raw':!![],'where':{'id':_0x73d19d[_0x67f0('0x42')]['id']}},_0xe9407c={};_0xe9407c[_0x67f0('0x32')]=_[_0x67f0('0x43')](db[_0x67f0('0x2b')][_0x67f0('0x2c')]);_0xe9407c[_0x67f0('0x30')]=_[_0x67f0('0x43')](_0x73d19d[_0x67f0('0x30')]);_0xe9407c['filters']=_[_0x67f0('0x31')](_0xe9407c['model'],_0xe9407c[_0x67f0('0x30')]);_0x1e44d8[_0x67f0('0x33')]=_['intersection'](_0xe9407c['model'],qs['fields'](_0x73d19d[_0x67f0('0x30')][_0x67f0('0x34')]));_0x1e44d8['attributes']=_0x1e44d8[_0x67f0('0x33')][_0x67f0('0x35')]?_0x1e44d8[_0x67f0('0x33')]:_0xe9407c['model'];if(_0x73d19d[_0x67f0('0x30')][_0x67f0('0x3f')]){_0x1e44d8[_0x67f0('0x40')]=[{'all':!![]}];}_0x1e44d8=_[_0x67f0('0x3d')]({},_0x1e44d8,_0x73d19d[_0x67f0('0x3e')]);return db[_0x67f0('0x2b')]['find'](_0x1e44d8)[_0x67f0('0x25')](handleEntityNotFound(_0x2439c3,null))[_0x67f0('0x25')](respondWithResult(_0x2439c3,null))[_0x67f0('0x41')](handleError(_0x2439c3,null));};exports['create']=function(_0x151b05,_0x2123c2){return db['SquareRecording'][_0x67f0('0x44')](_0x151b05[_0x67f0('0x45')],{})[_0x67f0('0x25')](respondWithResult(_0x2123c2,0xc9))[_0x67f0('0x41')](handleError(_0x2123c2,null));};exports['update']=function(_0x3a1d80,_0x3a86b3){if(_0x3a1d80[_0x67f0('0x45')]['id']){delete _0x3a1d80[_0x67f0('0x45')]['id'];}return db['SquareRecording']['find']({'where':{'id':_0x3a1d80[_0x67f0('0x42')]['id']}})[_0x67f0('0x25')](handleEntityNotFound(_0x3a86b3,null))['then'](saveUpdates(_0x3a1d80[_0x67f0('0x45')],null))[_0x67f0('0x25')](respondWithResult(_0x3a86b3,null))[_0x67f0('0x41')](handleError(_0x3a86b3,null));};exports[_0x67f0('0x46')]=function(_0x4b1de9,_0x39f61f,_0x4c71e7){var _0x1719be=require(_0x67f0('0x47'));var _0x4c7f1a=![];var _0x48695c={};if(_0x4b1de9['query'][_0x67f0('0x2e')]&&_0x4b1de9['query'][_0x67f0('0x2e')]===_0x67f0('0x48')){_0x48695c[_0x67f0('0x48')]=_0x4b1de9[_0x67f0('0x42')]['id'];}else{_0x48695c['id']=_0x4b1de9[_0x67f0('0x42')]['id'];}return db[_0x67f0('0x2b')]['find']({'where':_0x48695c,'attributes':['id',_0x67f0('0x49'),'filename'],'raw':!![]})[_0x67f0('0x25')](handleEntityNotFound(_0x39f61f,null))[_0x67f0('0x25')](function(_0x5c3c41){if(_0x5c3c41){var _0x5d0f42=_0x5c3c41[_0x67f0('0x49')];var _0x48a830=util[_0x67f0('0x4a')](_0x67f0('0x4b'),_0x5d0f42);if(fs['existsSync'](_0x48a830)){_0x4c7f1a=!![];return _0x1719be[_0x67f0('0x4c')](_0x48a830,_0x5d0f42,config[_0x67f0('0x4d')][_0x67f0('0x4e')])[_0x67f0('0x25')](function(){return _0x5c3c41;});}return _0x5c3c41;}})[_0x67f0('0x25')](function(_0x31269b){if(_0x31269b){var _0x336b4f=_0x31269b[_0x67f0('0x49')];if(!fs[_0x67f0('0x4f')](_0x336b4f)){throw new db['Sequelize'][(_0x67f0('0x50'))](_0x67f0('0x51'));}if(_0x31269b['filename']){return _0x39f61f[_0x67f0('0x46')](_0x336b4f,_0x31269b[_0x67f0('0x52')]+path['extname'](_0x336b4f),function(){if(_0x4c7f1a){fs['unlink'](_0x336b4f);}});}else{return _0x39f61f[_0x67f0('0x46')](_0x336b4f,function(_0x32c9fe){if(_0x4c7f1a){fs[_0x67f0('0x53')](_0x336b4f);}});}}})[_0x67f0('0x41')](function(_0x561d52){if(_0x561d52['message']==='SquareRecording\x20not\x20found'){_0x39f61f[_0x67f0('0x1a')](0x194)['send'](_0x67f0('0x54'));}else{return handleError(_0x39f61f,null);}});};exports[_0x67f0('0x26')]=function(_0x3da52d,_0x2211b5){return db[_0x67f0('0x2b')][_0x67f0('0x55')]({'where':{'id':_0x3da52d['params']['id']}})[_0x67f0('0x25')](function(_0x1471f9){if(_[_0x67f0('0x56')](_0x1471f9)){throw new ReferenceError(_0x67f0('0x57'));}return _0x1471f9;})[_0x67f0('0x25')](function(_0x4f237a){var _0xf5e512=_0x4f237a['savePath'];logger[_0x67f0('0x58')](_0x67f0('0x59'),_0xf5e512);if(!_[_0x67f0('0x56')](_0x4f237a[_0x67f0('0x49')])&&fs['existsSync'](_0xf5e512)){logger[_0x67f0('0x58')](_0x67f0('0x5a')+_0xf5e512+_0x67f0('0x5b'));fs[_0x67f0('0x5c')](_0xf5e512);}_0xf5e512=_0xf5e512+_0x67f0('0x5d');if(!_[_0x67f0('0x56')](_0x4f237a['savePath'])&&fs[_0x67f0('0x4f')](_0xf5e512)){logger[_0x67f0('0x58')](_0x67f0('0x5a')+_0xf5e512+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x67f0('0x5c')](_0xf5e512);}return _0x4f237a;})['then'](function(_0x5ba093){if(!_0x5ba093)throw new InternalError();return _0x5ba093[_0x67f0('0x26')]();})[_0x67f0('0x25')](function(){_0x2211b5[_0x67f0('0x1a')](0xcc)[_0x67f0('0x1b')]();})[_0x67f0('0x41')](handleError(_0x2211b5,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 45a9c28..cf94801 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 _0xb242=['./squareRecording.attributes','exports','define','SquareRecording','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5516a1,_0x215ca4){var _0x4a957b=function(_0x39b0e6){while(--_0x39b0e6){_0x5516a1['push'](_0x5516a1['shift']());}};_0x4a957b(++_0x215ca4);}(_0xb242,0x1f3));var _0x2b24=function(_0x49d41c,_0x2bdc35){_0x49d41c=_0x49d41c-0x0;var _0xb64c5f=_0xb242[_0x49d41c];return _0xb64c5f;};'use strict';var _=require('lodash');var util=require(_0x2b24('0x0'));var logger=require(_0x2b24('0x1'))(_0x2b24('0x2'));var moment=require(_0x2b24('0x3'));var BPromise=require(_0x2b24('0x4'));var rp=require(_0x2b24('0x5'));var fs=require('fs');var path=require(_0x2b24('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2b24('0x7'));module[_0x2b24('0x8')]=function(_0x5c1f57,_0x341c66){return _0x5c1f57[_0x2b24('0x9')](_0x2b24('0xa'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ce1=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareRecording.attributes','exports','define','square_recordings'];(function(_0x5f505c,_0x2d7d50){var _0x46824b=function(_0x458500){while(--_0x458500){_0x5f505c['push'](_0x5f505c['shift']());}};_0x46824b(++_0x2d7d50);}(_0x8ce1,0x152));var _0x18ce=function(_0x4608e8,_0xaee706){_0x4608e8=_0x4608e8-0x0;var _0x37270b=_0x8ce1[_0x4608e8];return _0x37270b;};'use strict';var _=require(_0x18ce('0x0'));var util=require(_0x18ce('0x1'));var logger=require(_0x18ce('0x2'))(_0x18ce('0x3'));var moment=require(_0x18ce('0x4'));var BPromise=require(_0x18ce('0x5'));var rp=require(_0x18ce('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x18ce('0x7'));var config=require(_0x18ce('0x8'));var attributes=require(_0x18ce('0x9'));module[_0x18ce('0xa')]=function(_0x532604,_0x17d12a){return _0x532604[_0x18ce('0xb')]('SquareRecording',attributes,{'tableName':_0x18ce('0xc'),'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 3f7aac3..6da68a7 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 _0x0119=['then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','SquareRecording','create','body','options','raw','CreateSquareRecording','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x1c3e53,_0x276928){var _0x3fd2c2=function(_0x2338fa){while(--_0x2338fa){_0x1c3e53['push'](_0x1c3e53['shift']());}};_0x3fd2c2(++_0x276928);}(_0x0119,0x160));var _0x9011=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x0119[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require(_0x9011('0x0'));var moment=require(_0x9011('0x1'));var BPromise=require(_0x9011('0x2'));var rs=require(_0x9011('0x3'));var fs=require('fs');var Redis=require(_0x9011('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9011('0x5'));var logger=require(_0x9011('0x6'))(_0x9011('0x7'));var config=require(_0x9011('0x8'));var jayson=require(_0x9011('0x9'));var client=jayson[_0x9011('0xa')][_0x9011('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x356d9d,_0x5b66af,_0x3f77e3){return new BPromise(function(_0x4bea4f,_0x303203){return client['request'](_0x356d9d,_0x3f77e3)[_0x9011('0xc')](function(_0x27936e){logger[_0x9011('0xd')](_0x9011('0xe'),_0x5b66af,_0x9011('0xf'));logger[_0x9011('0x10')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x5b66af,'request\x20sent',JSON[_0x9011('0x11')](_0x27936e));if(_0x27936e[_0x9011('0x12')]){if(_0x27936e['error']['code']===0x1f4){logger['error'](_0x9011('0xe'),_0x5b66af,_0x27936e[_0x9011('0x12')][_0x9011('0x13')]);return _0x303203(_0x27936e[_0x9011('0x12')]['message']);}logger['error'](_0x9011('0xe'),_0x5b66af,_0x27936e[_0x9011('0x12')]['message']);return _0x4bea4f(_0x27936e[_0x9011('0x12')][_0x9011('0x13')]);}else{logger[_0x9011('0xd')]('SquareRecording,\x20%s,\x20%s',_0x5b66af,'request\x20sent');_0x4bea4f(_0x27936e[_0x9011('0x14')]['message']);}})[_0x9011('0x15')](function(_0x4aa012){logger['error']('SquareRecording,\x20%s,\x20%s',_0x5b66af,_0x4aa012);_0x303203(_0x4aa012);});});}exports['CreateSquareRecording']=function(_0x5abcb1){var _0x27bad3=this;return new Promise(function(_0x26bd08,_0xebff48){return db[_0x9011('0x16')][_0x9011('0x17')](_0x5abcb1[_0x9011('0x18')],{'raw':_0x5abcb1[_0x9011('0x19')]?_0x5abcb1[_0x9011('0x19')][_0x9011('0x1a')]===undefined?!![]:![]:!![]})[_0x9011('0xc')](function(_0x4eb87e){logger[_0x9011('0xd')](_0x9011('0x1b'),_0x5abcb1);logger['debug']('CreateSquareRecording',_0x5abcb1,JSON[_0x9011('0x11')](_0x4eb87e));_0x26bd08(_0x4eb87e);})[_0x9011('0x15')](function(_0x10207e){logger[_0x9011('0x12')](_0x9011('0x1b'),_0x10207e[_0x9011('0x13')],_0x5abcb1);_0xebff48(_0x27bad3[_0x9011('0x12')](0x1f4,_0x10207e[_0x9011('0x13')]));});});}; \ No newline at end of file +var _0x3981=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareRecording,\x20%s,\x20%s','result','catch','SquareRecording','options','raw','then','CreateSquareRecording','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3b951e,_0x2d3e77){var _0x5980dc=function(_0x2471f8){while(--_0x2471f8){_0x3b951e['push'](_0x3b951e['shift']());}};_0x5980dc(++_0x2d3e77);}(_0x3981,0xff));var _0x1398=function(_0x468f75,_0x21cae8){_0x468f75=_0x468f75-0x0;var _0x4697ba=_0x3981[_0x468f75];return _0x4697ba;};'use strict';var _=require('lodash');var util=require(_0x1398('0x0'));var moment=require(_0x1398('0x1'));var BPromise=require(_0x1398('0x2'));var rs=require(_0x1398('0x3'));var fs=require('fs');var Redis=require(_0x1398('0x4'));var db=require(_0x1398('0x5'))['db'];var utils=require(_0x1398('0x6'));var logger=require('../../config/logger')(_0x1398('0x7'));var config=require(_0x1398('0x8'));var jayson=require(_0x1398('0x9'));var client=jayson[_0x1398('0xa')][_0x1398('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x359d38,_0x2e03e7,_0x216ec4){return new BPromise(function(_0x509ec1,_0x2d0b7c){return client[_0x1398('0xc')](_0x359d38,_0x216ec4)['then'](function(_0x164ca0){logger[_0x1398('0xd')]('SquareRecording,\x20%s,\x20%s',_0x2e03e7,_0x1398('0xe'));logger[_0x1398('0xf')](_0x1398('0x10'),_0x2e03e7,'request\x20sent',JSON[_0x1398('0x11')](_0x164ca0));if(_0x164ca0['error']){if(_0x164ca0[_0x1398('0x12')][_0x1398('0x13')]===0x1f4){logger[_0x1398('0x12')]('SquareRecording,\x20%s,\x20%s',_0x2e03e7,_0x164ca0[_0x1398('0x12')][_0x1398('0x14')]);return _0x2d0b7c(_0x164ca0['error'][_0x1398('0x14')]);}logger['error'](_0x1398('0x15'),_0x2e03e7,_0x164ca0[_0x1398('0x12')]['message']);return _0x509ec1(_0x164ca0[_0x1398('0x12')][_0x1398('0x14')]);}else{logger[_0x1398('0xd')](_0x1398('0x15'),_0x2e03e7,_0x1398('0xe'));_0x509ec1(_0x164ca0[_0x1398('0x16')]['message']);}})[_0x1398('0x17')](function(_0x25ab35){logger[_0x1398('0x12')]('SquareRecording,\x20%s,\x20%s',_0x2e03e7,_0x25ab35);_0x2d0b7c(_0x25ab35);});});}exports['CreateSquareRecording']=function(_0x5dbf9d){var _0x227926=this;return new Promise(function(_0x31bc7f,_0x4ce657){return db[_0x1398('0x18')]['create'](_0x5dbf9d['body'],{'raw':_0x5dbf9d[_0x1398('0x19')]?_0x5dbf9d[_0x1398('0x19')][_0x1398('0x1a')]===undefined?!![]:![]:!![]})[_0x1398('0x1b')](function(_0xdb6e3e){logger[_0x1398('0xd')](_0x1398('0x1c'),_0x5dbf9d);logger[_0x1398('0xf')](_0x1398('0x1c'),_0x5dbf9d,JSON[_0x1398('0x11')](_0xdb6e3e));_0x31bc7f(_0xdb6e3e);})[_0x1398('0x17')](function(_0x3cffc8){logger[_0x1398('0x12')](_0x1398('0x1c'),_0x3cffc8['message'],_0x5dbf9d);_0x4ce657(_0x227926[_0x1398('0x12')](0x1f4,_0x3cffc8[_0x1398('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 0860f81..7c920ee 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x459d7d,_0x55db19){var _0x26abf1=function(_0x39e5d5){while(--_0x39e5d5){_0x459d7d['push'](_0x459d7d['shift']());}};_0x26abf1(++_0x55db19);}(_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('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _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(_0x8e2bf4,_0x486715){var _0x3528c9=function(_0x1b1041){while(--_0x1b1041){_0x8e2bf4['push'](_0x8e2bf4['shift']());}};_0x3528c9(++_0x486715);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'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 a1048d8..3103472 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 _0xd6c1=['STRING','DATE','sequelize','exports'];(function(_0x9a4f5a,_0xc292b0){var _0x3914d7=function(_0xfcc545){while(--_0xfcc545){_0x9a4f5a['push'](_0x9a4f5a['shift']());}};_0x3914d7(++_0xc292b0);}(_0xd6c1,0x196));var _0x1d6c=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xd6c1[_0x27af45];return _0x18df21;};'use strict';var Sequelize=require(_0x1d6c('0x0'));module[_0x1d6c('0x1')]={'network':{'type':Sequelize[_0x1d6c('0x2')]},'network_script':{'type':Sequelize[_0x1d6c('0x2')]},'request':{'type':Sequelize[_0x1d6c('0x2')]},'channel':{'type':Sequelize[_0x1d6c('0x2')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x1d6c('0x2')]},'uniqueid':{'type':Sequelize[_0x1d6c('0x2')]},'version':{'type':Sequelize[_0x1d6c('0x2')]},'callerid':{'type':Sequelize[_0x1d6c('0x2')]},'calleridname':{'type':Sequelize[_0x1d6c('0x2')]},'callingpres':{'type':Sequelize[_0x1d6c('0x2')]},'callingani2':{'type':Sequelize[_0x1d6c('0x2')]},'callington':{'type':Sequelize[_0x1d6c('0x2')]},'callingtns':{'type':Sequelize[_0x1d6c('0x2')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x1d6c('0x2')]},'context':{'type':Sequelize[_0x1d6c('0x2')]},'extension':{'type':Sequelize[_0x1d6c('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x1d6c('0x2')]},'accountcode':{'type':Sequelize[_0x1d6c('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0x1d6c('0x2')]},'joinAt':{'type':Sequelize[_0x1d6c('0x3')]},'leaveAt':{'type':Sequelize[_0x1d6c('0x3')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x044f=['STRING','DATE','BOOLEAN','exports'];(function(_0x44a752,_0x50201f){var _0x139356=function(_0x124b22){while(--_0x124b22){_0x44a752['push'](_0x44a752['shift']());}};_0x139356(++_0x50201f);}(_0x044f,0x7f));var _0xf044=function(_0xd333a1,_0x1f61a0){_0xd333a1=_0xd333a1-0x0;var _0x553a60=_0x044f[_0xd333a1];return _0x553a60;};'use strict';var Sequelize=require('sequelize');module[_0xf044('0x0')]={'network':{'type':Sequelize[_0xf044('0x1')]},'network_script':{'type':Sequelize[_0xf044('0x1')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xf044('0x1')]},'language':{'type':Sequelize[_0xf044('0x1')]},'type':{'type':Sequelize[_0xf044('0x1')]},'uniqueid':{'type':Sequelize[_0xf044('0x1')]},'version':{'type':Sequelize[_0xf044('0x1')]},'callerid':{'type':Sequelize[_0xf044('0x1')]},'calleridname':{'type':Sequelize[_0xf044('0x1')]},'callingpres':{'type':Sequelize[_0xf044('0x1')]},'callingani2':{'type':Sequelize[_0xf044('0x1')]},'callington':{'type':Sequelize[_0xf044('0x1')]},'callingtns':{'type':Sequelize[_0xf044('0x1')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0xf044('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xf044('0x1')]},'priority':{'type':Sequelize[_0xf044('0x1')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0xf044('0x1')]},'project_name':{'type':Sequelize[_0xf044('0x1')]},'joinAt':{'type':Sequelize[_0xf044('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0xf044('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 9169304..b100f19 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 _0x92f6=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','limit','undefined','count','offset','set','save','update','then','end','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','filter','options','SquareReport','includeAll','findAll','rows','catch','show','params','include','create','body','find','destroy','describe','eml-format','zip-dir','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring'];(function(_0x423b18,_0x58fca0){var _0x205922=function(_0x37de6d){while(--_0x37de6d){_0x423b18['push'](_0x423b18['shift']());}};_0x205922(++_0x58fca0);}(_0x92f6,0x1b4));var _0x692f=function(_0x14e049,_0x490cfd){_0x14e049=_0x14e049-0x0;var _0x4a4308=_0x92f6[_0x14e049];return _0x4a4308;};'use strict';var emlformat=require(_0x692f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x692f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x692f('0x2'));var BPromise=require(_0x692f('0x3'));var Mustache=require(_0x692f('0x4'));var util=require(_0x692f('0x5'));var path=require(_0x692f('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x692f('0x7'));var fs=require('fs');var fs_extra=require(_0x692f('0x8'));var _=require(_0x692f('0x9'));var squel=require(_0x692f('0xa'));var crypto=require(_0x692f('0xb'));var jsforce=require(_0x692f('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x692f('0xd'));var Papa=require(_0x692f('0xe'));var Redis=require(_0x692f('0xf'));var authService=require(_0x692f('0x10'));var qs=require(_0x692f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x692f('0x12'));var logger=require(_0x692f('0x13'))('api');var utils=require(_0x692f('0x14'));var config=require(_0x692f('0x15'));var licenseUtil=require(_0x692f('0x16'));var db=require(_0x692f('0x17'))['db'];function respondWithStatusCode(_0x45deb3,_0x3fec5e){_0x3fec5e=_0x3fec5e||0xcc;return function(_0x3365bf){if(_0x3365bf){return _0x45deb3['sendStatus'](_0x3fec5e);}return _0x45deb3['status'](_0x3fec5e)['end']();};}function respondWithResult(_0x2cc01b,_0x3679c8){_0x3679c8=_0x3679c8||0xc8;return function(_0x4456d4){if(_0x4456d4){return _0x2cc01b[_0x692f('0x18')](_0x3679c8)[_0x692f('0x19')](_0x4456d4);}};}function respondWithFilteredResult(_0x3d56ce,_0x219d8a){return function(_0x34a784){if(_0x34a784){var _0x263053=typeof _0x219d8a['offset']==='undefined'&&typeof _0x219d8a[_0x692f('0x1a')]===_0x692f('0x1b');var _0x5a88cc=_0x34a784[_0x692f('0x1c')];var _0x56d1ac=_0x263053?0x0:_0x219d8a[_0x692f('0x1d')];var _0x11bd9e=_0x263053?_0x34a784[_0x692f('0x1c')]:_0x219d8a['offset']+_0x219d8a[_0x692f('0x1a')];var _0x415452;if(_0x11bd9e>=_0x5a88cc){_0x11bd9e=_0x5a88cc;_0x415452=0xc8;}else{_0x415452=0xce;}_0x3d56ce[_0x692f('0x18')](_0x415452);return _0x3d56ce[_0x692f('0x1e')]('Content-Range',_0x56d1ac+'-'+_0x11bd9e+'/'+_0x5a88cc)['json'](_0x34a784);}return null;};}function patchUpdates(_0x108b5f){return function(_0x46ff65){try{jsonpatch['apply'](_0x46ff65,_0x108b5f,!![]);}catch(_0x26638c){return BPromise['reject'](_0x26638c);}return _0x46ff65[_0x692f('0x1f')]();};}function saveUpdates(_0x1284fc,_0x4b1628){return function(_0x341479){if(_0x341479){return _0x341479[_0x692f('0x20')](_0x1284fc)[_0x692f('0x21')](function(_0x118f10){return _0x118f10;});}return null;};}function removeEntity(_0x45312c,_0xc9d2ac){return function(_0x500a27){if(_0x500a27){return _0x500a27['destroy']()['then'](function(){_0x45312c[_0x692f('0x18')](0xcc)[_0x692f('0x22')]();});}};}function handleEntityNotFound(_0x4ecd29,_0x567f54){return function(_0x33dc46){if(!_0x33dc46){_0x4ecd29[_0x692f('0x23')](0x194);}return _0x33dc46;};}function handleError(_0x323c5e,_0x1cce18){_0x1cce18=_0x1cce18||0x1f4;return function(_0x2805be){logger[_0x692f('0x24')](_0x2805be[_0x692f('0x25')]);if(_0x2805be[_0x692f('0x26')]){delete _0x2805be[_0x692f('0x26')];}_0x323c5e[_0x692f('0x18')](_0x1cce18)[_0x692f('0x27')](_0x2805be);};}exports['index']=function(_0x3b044a,_0x173f57){var _0x292ae0={},_0x154c30={},_0x3c4592={'count':0x0,'rows':[]};var _0x2942ed=_[_0x692f('0x28')](db['SquareReport'][_0x692f('0x29')],function(_0x30e3ac){return{'name':_0x30e3ac[_0x692f('0x2a')],'type':_0x30e3ac[_0x692f('0x2b')][_0x692f('0x2c')]};});_0x154c30[_0x692f('0x2d')]=_[_0x692f('0x28')](_0x2942ed,'name');_0x154c30['query']=_[_0x692f('0x2e')](_0x3b044a[_0x692f('0x2f')]);_0x154c30[_0x692f('0x30')]=_[_0x692f('0x31')](_0x154c30[_0x692f('0x2d')],_0x154c30[_0x692f('0x2f')]);_0x292ae0['attributes']=_[_0x692f('0x31')](_0x154c30[_0x692f('0x2d')],qs[_0x692f('0x32')](_0x3b044a[_0x692f('0x2f')]['fields']));_0x292ae0[_0x692f('0x33')]=_0x292ae0[_0x692f('0x33')][_0x692f('0x34')]?_0x292ae0[_0x692f('0x33')]:_0x154c30['model'];if(!_0x3b044a['query'][_0x692f('0x35')](_0x692f('0x36'))){_0x292ae0['limit']=qs['limit'](_0x3b044a[_0x692f('0x2f')][_0x692f('0x1a')]);_0x292ae0['offset']=qs[_0x692f('0x1d')](_0x3b044a[_0x692f('0x2f')][_0x692f('0x1d')]);}_0x292ae0[_0x692f('0x37')]=qs[_0x692f('0x38')](_0x3b044a[_0x692f('0x2f')]['sort']);_0x292ae0['where']=qs['filters'](_[_0x692f('0x39')](_0x3b044a[_0x692f('0x2f')],_0x154c30[_0x692f('0x30')]),_0x2942ed);if(_0x3b044a[_0x692f('0x2f')]['filter']){_0x292ae0[_0x692f('0x3a')]=_[_0x692f('0x3b')](_0x292ae0[_0x692f('0x3a')],{'$or':_[_0x692f('0x28')](_0x2942ed,function(_0x312b63){if(_0x312b63[_0x692f('0x2b')]!=='VIRTUAL'){var _0x53a83a={};_0x53a83a[_0x312b63[_0x692f('0x26')]]={'$like':'%'+_0x3b044a[_0x692f('0x2f')][_0x692f('0x3c')]+'%'};return _0x53a83a;}})});}_0x292ae0=_[_0x692f('0x3b')]({},_0x292ae0,_0x3b044a[_0x692f('0x3d')]);var _0x1006bd={'where':_0x292ae0[_0x692f('0x3a')]};return db[_0x692f('0x3e')][_0x692f('0x1c')](_0x1006bd)[_0x692f('0x21')](function(_0x5f5a12){_0x3c4592[_0x692f('0x1c')]=_0x5f5a12;if(_0x3b044a[_0x692f('0x2f')][_0x692f('0x3f')]){_0x292ae0['include']=[{'all':!![]}];}return db[_0x692f('0x3e')][_0x692f('0x40')](_0x292ae0);})[_0x692f('0x21')](function(_0x26043){_0x3c4592[_0x692f('0x41')]=_0x26043;return _0x3c4592;})[_0x692f('0x21')](respondWithFilteredResult(_0x173f57,_0x292ae0))[_0x692f('0x42')](handleError(_0x173f57,null));};exports[_0x692f('0x43')]=function(_0x4397cd,_0x25ba9d){var _0x5432c3={'raw':!![],'where':{'id':_0x4397cd[_0x692f('0x44')]['id']}},_0x17e37d={};_0x17e37d[_0x692f('0x2d')]=_[_0x692f('0x2e')](db['SquareReport'][_0x692f('0x29')]);_0x17e37d[_0x692f('0x2f')]=_[_0x692f('0x2e')](_0x4397cd[_0x692f('0x2f')]);_0x17e37d['filters']=_['intersection'](_0x17e37d[_0x692f('0x2d')],_0x17e37d['query']);_0x5432c3[_0x692f('0x33')]=_[_0x692f('0x31')](_0x17e37d['model'],qs[_0x692f('0x32')](_0x4397cd['query']['fields']));_0x5432c3[_0x692f('0x33')]=_0x5432c3[_0x692f('0x33')][_0x692f('0x34')]?_0x5432c3[_0x692f('0x33')]:_0x17e37d[_0x692f('0x2d')];if(_0x4397cd[_0x692f('0x2f')]['includeAll']){_0x5432c3[_0x692f('0x45')]=[{'all':!![]}];}_0x5432c3=_[_0x692f('0x3b')]({},_0x5432c3,_0x4397cd[_0x692f('0x3d')]);return db[_0x692f('0x3e')]['find'](_0x5432c3)[_0x692f('0x21')](handleEntityNotFound(_0x25ba9d,null))[_0x692f('0x21')](respondWithResult(_0x25ba9d,null))['catch'](handleError(_0x25ba9d,null));};exports['create']=function(_0x3c3f26,_0x58d75c){return db[_0x692f('0x3e')][_0x692f('0x46')](_0x3c3f26['body'],{})[_0x692f('0x21')](respondWithResult(_0x58d75c,0xc9))[_0x692f('0x42')](handleError(_0x58d75c,null));};exports['update']=function(_0x4ddc30,_0x378eab){if(_0x4ddc30[_0x692f('0x47')]['id']){delete _0x4ddc30[_0x692f('0x47')]['id'];}return db['SquareReport'][_0x692f('0x48')]({'where':{'id':_0x4ddc30['params']['id']}})[_0x692f('0x21')](handleEntityNotFound(_0x378eab,null))[_0x692f('0x21')](saveUpdates(_0x4ddc30[_0x692f('0x47')],null))[_0x692f('0x21')](respondWithResult(_0x378eab,null))[_0x692f('0x42')](handleError(_0x378eab,null));};exports[_0x692f('0x49')]=function(_0x1f5149,_0x14ce73){return db[_0x692f('0x3e')][_0x692f('0x48')]({'where':{'id':_0x1f5149[_0x692f('0x44')]['id']}})[_0x692f('0x21')](handleEntityNotFound(_0x14ce73,null))[_0x692f('0x21')](removeEntity(_0x14ce73,null))[_0x692f('0x42')](handleError(_0x14ce73,null));};exports[_0x692f('0x4a')]=function(_0x3cea46,_0x4d4100){return db[_0x692f('0x3e')]['describe']()[_0x692f('0x21')](respondWithResult(_0x4d4100,null))[_0x692f('0x42')](handleError(_0x4d4100,null));}; \ No newline at end of file +var _0xb4e2=['crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','update','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x586802,_0x2406bf){var _0x28b9c4=function(_0x4fa571){while(--_0x4fa571){_0x586802['push'](_0x586802['shift']());}};_0x28b9c4(++_0x2406bf);}(_0xb4e2,0xe8));var _0x2b4e=function(_0x56f92b,_0x8221dd){_0x56f92b=_0x56f92b-0x0;var _0x523c7b=_0xb4e2[_0x56f92b];return _0x523c7b;};'use strict';var emlformat=require(_0x2b4e('0x0'));var rimraf=require(_0x2b4e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2b4e('0x2'));var rp=require(_0x2b4e('0x3'));var moment=require(_0x2b4e('0x4'));var BPromise=require(_0x2b4e('0x5'));var Mustache=require('mustache');var util=require(_0x2b4e('0x6'));var path=require(_0x2b4e('0x7'));var sox=require(_0x2b4e('0x8'));var csv=require(_0x2b4e('0x9'));var ejs=require(_0x2b4e('0xa'));var fs=require('fs');var fs_extra=require(_0x2b4e('0xb'));var _=require(_0x2b4e('0xc'));var squel=require(_0x2b4e('0xd'));var crypto=require(_0x2b4e('0xe'));var jsforce=require(_0x2b4e('0xf'));var deskjs=require(_0x2b4e('0x10'));var toCsv=require('to-csv');var querystring=require(_0x2b4e('0x11'));var Papa=require(_0x2b4e('0x12'));var Redis=require('ioredis');var authService=require(_0x2b4e('0x13'));var qs=require(_0x2b4e('0x14'));var as=require(_0x2b4e('0x15'));var hardwareService=require(_0x2b4e('0x16'));var logger=require(_0x2b4e('0x17'))(_0x2b4e('0x18'));var utils=require(_0x2b4e('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x2b4e('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45f151,_0x38c0f6){_0x38c0f6=_0x38c0f6||0xcc;return function(_0x3c5064){if(_0x3c5064){return _0x45f151[_0x2b4e('0x1b')](_0x38c0f6);}return _0x45f151[_0x2b4e('0x1c')](_0x38c0f6)[_0x2b4e('0x1d')]();};}function respondWithResult(_0x7249fa,_0x3f00a5){_0x3f00a5=_0x3f00a5||0xc8;return function(_0x51d48b){if(_0x51d48b){return _0x7249fa['status'](_0x3f00a5)[_0x2b4e('0x1e')](_0x51d48b);}};}function respondWithFilteredResult(_0x3c5693,_0x223b5d){return function(_0x18e4dc){if(_0x18e4dc){var _0x3d21ee=typeof _0x223b5d[_0x2b4e('0x1f')]===_0x2b4e('0x20')&&typeof _0x223b5d[_0x2b4e('0x21')]===_0x2b4e('0x20');var _0x326b56=_0x18e4dc[_0x2b4e('0x22')];var _0x209623=_0x3d21ee?0x0:_0x223b5d[_0x2b4e('0x1f')];var _0xb8ccce=_0x3d21ee?_0x18e4dc[_0x2b4e('0x22')]:_0x223b5d[_0x2b4e('0x1f')]+_0x223b5d[_0x2b4e('0x21')];var _0x227c6b;if(_0xb8ccce>=_0x326b56){_0xb8ccce=_0x326b56;_0x227c6b=0xc8;}else{_0x227c6b=0xce;}_0x3c5693[_0x2b4e('0x1c')](_0x227c6b);return _0x3c5693[_0x2b4e('0x23')](_0x2b4e('0x24'),_0x209623+'-'+_0xb8ccce+'/'+_0x326b56)[_0x2b4e('0x1e')](_0x18e4dc);}return null;};}function patchUpdates(_0x2f348c){return function(_0x3a01e9){try{jsonpatch[_0x2b4e('0x25')](_0x3a01e9,_0x2f348c,!![]);}catch(_0x504d39){return BPromise[_0x2b4e('0x26')](_0x504d39);}return _0x3a01e9[_0x2b4e('0x27')]();};}function saveUpdates(_0x1c5658,_0x15ae58){return function(_0x5ca5c2){if(_0x5ca5c2){return _0x5ca5c2['update'](_0x1c5658)['then'](function(_0x2c86ae){return _0x2c86ae;});}return null;};}function removeEntity(_0x23783c,_0xf5460e){return function(_0x2ed7c7){if(_0x2ed7c7){return _0x2ed7c7[_0x2b4e('0x28')]()[_0x2b4e('0x29')](function(){_0x23783c['status'](0xcc)[_0x2b4e('0x1d')]();});}};}function handleEntityNotFound(_0x24d5eb,_0x29919b){return function(_0x123cb4){if(!_0x123cb4){_0x24d5eb[_0x2b4e('0x1b')](0x194);}return _0x123cb4;};}function handleError(_0x29b425,_0x4554f8){_0x4554f8=_0x4554f8||0x1f4;return function(_0x2a2797){logger[_0x2b4e('0x2a')](_0x2a2797[_0x2b4e('0x2b')]);if(_0x2a2797[_0x2b4e('0x2c')]){delete _0x2a2797[_0x2b4e('0x2c')];}_0x29b425[_0x2b4e('0x1c')](_0x4554f8)[_0x2b4e('0x2d')](_0x2a2797);};}exports[_0x2b4e('0x2e')]=function(_0x5df133,_0x349322){var _0x2bcb17={},_0x2f107a={},_0xb28e7a={'count':0x0,'rows':[]};var _0x23c29d=_[_0x2b4e('0x2f')](db[_0x2b4e('0x30')][_0x2b4e('0x31')],function(_0x90bb3e){return{'name':_0x90bb3e[_0x2b4e('0x32')],'type':_0x90bb3e[_0x2b4e('0x33')][_0x2b4e('0x34')]};});_0x2f107a[_0x2b4e('0x35')]=_[_0x2b4e('0x2f')](_0x23c29d,_0x2b4e('0x2c'));_0x2f107a['query']=_[_0x2b4e('0x36')](_0x5df133['query']);_0x2f107a[_0x2b4e('0x37')]=_[_0x2b4e('0x38')](_0x2f107a[_0x2b4e('0x35')],_0x2f107a['query']);_0x2bcb17[_0x2b4e('0x39')]=_[_0x2b4e('0x38')](_0x2f107a[_0x2b4e('0x35')],qs[_0x2b4e('0x3a')](_0x5df133[_0x2b4e('0x3b')][_0x2b4e('0x3a')]));_0x2bcb17[_0x2b4e('0x39')]=_0x2bcb17[_0x2b4e('0x39')][_0x2b4e('0x3c')]?_0x2bcb17[_0x2b4e('0x39')]:_0x2f107a[_0x2b4e('0x35')];if(!_0x5df133[_0x2b4e('0x3b')][_0x2b4e('0x3d')]('nolimit')){_0x2bcb17[_0x2b4e('0x21')]=qs[_0x2b4e('0x21')](_0x5df133[_0x2b4e('0x3b')][_0x2b4e('0x21')]);_0x2bcb17[_0x2b4e('0x1f')]=qs[_0x2b4e('0x1f')](_0x5df133[_0x2b4e('0x3b')][_0x2b4e('0x1f')]);}_0x2bcb17[_0x2b4e('0x3e')]=qs[_0x2b4e('0x3f')](_0x5df133['query'][_0x2b4e('0x3f')]);_0x2bcb17[_0x2b4e('0x40')]=qs[_0x2b4e('0x37')](_[_0x2b4e('0x41')](_0x5df133['query'],_0x2f107a[_0x2b4e('0x37')]),_0x23c29d);if(_0x5df133['query']['filter']){_0x2bcb17[_0x2b4e('0x40')]=_[_0x2b4e('0x42')](_0x2bcb17['where'],{'$or':_[_0x2b4e('0x2f')](_0x23c29d,function(_0x3c824c){if(_0x3c824c[_0x2b4e('0x33')]!==_0x2b4e('0x43')){var _0xd4153={};_0xd4153[_0x3c824c[_0x2b4e('0x2c')]]={'$like':'%'+_0x5df133['query'][_0x2b4e('0x44')]+'%'};return _0xd4153;}})});}_0x2bcb17=_[_0x2b4e('0x42')]({},_0x2bcb17,_0x5df133[_0x2b4e('0x45')]);var _0x362a86={'where':_0x2bcb17[_0x2b4e('0x40')]};return db[_0x2b4e('0x30')][_0x2b4e('0x22')](_0x362a86)[_0x2b4e('0x29')](function(_0x55d0fe){_0xb28e7a['count']=_0x55d0fe;if(_0x5df133[_0x2b4e('0x3b')][_0x2b4e('0x46')]){_0x2bcb17[_0x2b4e('0x47')]=[{'all':!![]}];}return db[_0x2b4e('0x30')][_0x2b4e('0x48')](_0x2bcb17);})[_0x2b4e('0x29')](function(_0x2b0633){_0xb28e7a[_0x2b4e('0x49')]=_0x2b0633;return _0xb28e7a;})['then'](respondWithFilteredResult(_0x349322,_0x2bcb17))['catch'](handleError(_0x349322,null));};exports[_0x2b4e('0x4a')]=function(_0x1ae717,_0x1353c2){var _0x195cac={'raw':!![],'where':{'id':_0x1ae717[_0x2b4e('0x4b')]['id']}},_0x55212f={};_0x55212f[_0x2b4e('0x35')]=_['keys'](db[_0x2b4e('0x30')][_0x2b4e('0x31')]);_0x55212f['query']=_[_0x2b4e('0x36')](_0x1ae717[_0x2b4e('0x3b')]);_0x55212f[_0x2b4e('0x37')]=_[_0x2b4e('0x38')](_0x55212f[_0x2b4e('0x35')],_0x55212f['query']);_0x195cac['attributes']=_[_0x2b4e('0x38')](_0x55212f[_0x2b4e('0x35')],qs[_0x2b4e('0x3a')](_0x1ae717[_0x2b4e('0x3b')][_0x2b4e('0x3a')]));_0x195cac[_0x2b4e('0x39')]=_0x195cac[_0x2b4e('0x39')][_0x2b4e('0x3c')]?_0x195cac[_0x2b4e('0x39')]:_0x55212f[_0x2b4e('0x35')];if(_0x1ae717[_0x2b4e('0x3b')][_0x2b4e('0x46')]){_0x195cac['include']=[{'all':!![]}];}_0x195cac=_[_0x2b4e('0x42')]({},_0x195cac,_0x1ae717[_0x2b4e('0x45')]);return db[_0x2b4e('0x30')][_0x2b4e('0x4c')](_0x195cac)[_0x2b4e('0x29')](handleEntityNotFound(_0x1353c2,null))[_0x2b4e('0x29')](respondWithResult(_0x1353c2,null))[_0x2b4e('0x4d')](handleError(_0x1353c2,null));};exports[_0x2b4e('0x4e')]=function(_0x30e28f,_0x59d2bf){return db[_0x2b4e('0x30')][_0x2b4e('0x4e')](_0x30e28f[_0x2b4e('0x4f')],{})['then'](respondWithResult(_0x59d2bf,0xc9))[_0x2b4e('0x4d')](handleError(_0x59d2bf,null));};exports[_0x2b4e('0x50')]=function(_0x4e6ae2,_0x579d5c){if(_0x4e6ae2[_0x2b4e('0x4f')]['id']){delete _0x4e6ae2['body']['id'];}return db[_0x2b4e('0x30')][_0x2b4e('0x4c')]({'where':{'id':_0x4e6ae2[_0x2b4e('0x4b')]['id']}})[_0x2b4e('0x29')](handleEntityNotFound(_0x579d5c,null))[_0x2b4e('0x29')](saveUpdates(_0x4e6ae2[_0x2b4e('0x4f')],null))[_0x2b4e('0x29')](respondWithResult(_0x579d5c,null))[_0x2b4e('0x4d')](handleError(_0x579d5c,null));};exports[_0x2b4e('0x28')]=function(_0x1c1114,_0x36b932){return db[_0x2b4e('0x30')][_0x2b4e('0x4c')]({'where':{'id':_0x1c1114['params']['id']}})[_0x2b4e('0x29')](handleEntityNotFound(_0x36b932,null))['then'](removeEntity(_0x36b932,null))[_0x2b4e('0x4d')](handleError(_0x36b932,null));};exports[_0x2b4e('0x51')]=function(_0x29ee73,_0x32d195){return db['SquareReport']['describe']()['then'](respondWithResult(_0x32d195,null))[_0x2b4e('0x4d')](handleError(_0x32d195,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 1ad72fe..14aeeb2 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 _0x2f77=['bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','report_square','uniqueid','leaveAt','lodash','util','../../config/logger','api'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x2f77,0x6c));var _0x72f7=function(_0x39e884,_0x4a01e6){_0x39e884=_0x39e884-0x0;var _0x26358e=_0x2f77[_0x39e884];return _0x26358e;};'use strict';var _=require(_0x72f7('0x0'));var util=require(_0x72f7('0x1'));var logger=require(_0x72f7('0x2'))(_0x72f7('0x3'));var moment=require('moment');var BPromise=require(_0x72f7('0x4'));var rp=require(_0x72f7('0x5'));var fs=require('fs');var path=require(_0x72f7('0x6'));var rimraf=require(_0x72f7('0x7'));var config=require(_0x72f7('0x8'));var attributes=require(_0x72f7('0x9'));module[_0x72f7('0xa')]=function(_0x5ba409,_0x2445c2){return _0x5ba409['define']('SquareReport',attributes,{'tableName':_0x72f7('0xb'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x72f7('0xc'),'project_name']},{'name':'leaveAt','fields':[_0x72f7('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7993=['uid_pname','uniqueid','project_name','leaveAt','lodash','util','api','moment','request-promise','path','rimraf','./squareReport.attributes','exports','define','report_square'];(function(_0x198add,_0x239d3c){var _0x35bfaa=function(_0x30eed2){while(--_0x30eed2){_0x198add['push'](_0x198add['shift']());}};_0x35bfaa(++_0x239d3c);}(_0x7993,0x1b7));var _0x3799=function(_0x3a4963,_0x48d920){_0x3a4963=_0x3a4963-0x0;var _0x58f07c=_0x7993[_0x3a4963];return _0x58f07c;};'use strict';var _=require(_0x3799('0x0'));var util=require(_0x3799('0x1'));var logger=require('../../config/logger')(_0x3799('0x2'));var moment=require(_0x3799('0x3'));var BPromise=require('bluebird');var rp=require(_0x3799('0x4'));var fs=require('fs');var path=require(_0x3799('0x5'));var rimraf=require(_0x3799('0x6'));var config=require('../../config/environment');var attributes=require(_0x3799('0x7'));module[_0x3799('0x8')]=function(_0x2acc4b,_0xefe373){return _0x2acc4b[_0x3799('0x9')]('SquareReport',attributes,{'tableName':_0x3799('0xa'),'paranoid':![],'indexes':[{'name':_0x3799('0xb'),'fields':[_0x3799('0xc'),_0x3799('0xd')]},{'name':'leaveAt','fields':[_0x3799('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 3a78975..a936393 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 _0xc29a=['options','raw','then','catch','UpdateSquareReport','update','where','attributes','limit','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','CreateSquareReport','SquareReport','create'];(function(_0x593cbd,_0x141c5b){var _0x1ea4aa=function(_0x5d42ba){while(--_0x5d42ba){_0x593cbd['push'](_0x593cbd['shift']());}};_0x1ea4aa(++_0x141c5b);}(_0xc29a,0x11a));var _0xac29=function(_0x58105c,_0x339a6f){_0x58105c=_0x58105c-0x0;var _0x3ff521=_0xc29a[_0x58105c];return _0x3ff521;};'use strict';var _=require(_0xac29('0x0'));var util=require(_0xac29('0x1'));var moment=require(_0xac29('0x2'));var BPromise=require(_0xac29('0x3'));var rs=require(_0xac29('0x4'));var fs=require('fs');var Redis=require(_0xac29('0x5'));var db=require(_0xac29('0x6'))['db'];var utils=require(_0xac29('0x7'));var logger=require(_0xac29('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xac29('0x9'));var client=jayson[_0xac29('0xa')][_0xac29('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x34ec21,_0x249ad6,_0x5a7a27){return new BPromise(function(_0x164903,_0x223868){return client[_0xac29('0xc')](_0x34ec21,_0x5a7a27)['then'](function(_0x1b2cf6){logger[_0xac29('0xd')](_0xac29('0xe'),_0x249ad6,_0xac29('0xf'));logger[_0xac29('0x10')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x249ad6,_0xac29('0xf'),JSON['stringify'](_0x1b2cf6));if(_0x1b2cf6[_0xac29('0x11')]){if(_0x1b2cf6[_0xac29('0x11')][_0xac29('0x12')]===0x1f4){logger['error'](_0xac29('0xe'),_0x249ad6,_0x1b2cf6[_0xac29('0x11')]['message']);return _0x223868(_0x1b2cf6[_0xac29('0x11')][_0xac29('0x13')]);}logger[_0xac29('0x11')]('SquareReport,\x20%s,\x20%s',_0x249ad6,_0x1b2cf6['error'][_0xac29('0x13')]);return _0x164903(_0x1b2cf6[_0xac29('0x11')][_0xac29('0x13')]);}else{logger[_0xac29('0xd')](_0xac29('0xe'),_0x249ad6,_0xac29('0xf'));_0x164903(_0x1b2cf6[_0xac29('0x14')][_0xac29('0x13')]);}})['catch'](function(_0x2efb88){logger['error'](_0xac29('0xe'),_0x249ad6,_0x2efb88);_0x223868(_0x2efb88);});});}exports[_0xac29('0x15')]=function(_0x4ad743){var _0x1aa79c=this;return new Promise(function(_0x4b32bc,_0x487c84){return db[_0xac29('0x16')][_0xac29('0x17')](_0x4ad743['body'],{'raw':_0x4ad743[_0xac29('0x18')]?_0x4ad743[_0xac29('0x18')][_0xac29('0x19')]===undefined?!![]:![]:!![]})[_0xac29('0x1a')](function(_0x48e757){logger[_0xac29('0xd')]('CreateSquareReport',_0x4ad743);logger[_0xac29('0x10')]('CreateSquareReport',_0x4ad743,JSON['stringify'](_0x48e757));_0x4b32bc(_0x48e757);})[_0xac29('0x1b')](function(_0x1d381d){logger[_0xac29('0x11')](_0xac29('0x15'),_0x1d381d[_0xac29('0x13')],_0x4ad743);_0x487c84(_0x1aa79c[_0xac29('0x11')](0x1f4,_0x1d381d[_0xac29('0x13')]));});});};exports[_0xac29('0x1c')]=function(_0x246b14){var _0x3a0d5b=this;return new Promise(function(_0x9c77e8,_0x8ae3b1){return db['SquareReport'][_0xac29('0x1d')](_0x246b14['body'],{'raw':_0x246b14[_0xac29('0x18')]?_0x246b14[_0xac29('0x18')][_0xac29('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x246b14[_0xac29('0x18')]?_0x246b14[_0xac29('0x18')][_0xac29('0x1e')]||null:null,'attributes':_0x246b14[_0xac29('0x18')]?_0x246b14[_0xac29('0x18')][_0xac29('0x1f')]||null:null,'limit':_0x246b14['options']?_0x246b14[_0xac29('0x18')][_0xac29('0x20')]||null:null})[_0xac29('0x1a')](function(_0x355495){logger[_0xac29('0xd')](_0xac29('0x1c'),_0x246b14);logger[_0xac29('0x10')](_0xac29('0x1c'),_0x246b14,JSON[_0xac29('0x21')](_0x355495));_0x9c77e8(_0x355495);})[_0xac29('0x1b')](function(_0x2d7024){logger['error'](_0xac29('0x1c'),_0x2d7024['message'],_0x246b14);_0x8ae3b1(_0x3a0d5b[_0xac29('0x11')](0x1f4,_0x2d7024[_0xac29('0x13')]));});});}; \ No newline at end of file +var _0x71d4=['rpc','../../config/environment','jayson/promise','client','http','info','SquareReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','CreateSquareReport','create','body','options','catch','UpdateSquareReport','SquareReport','update','where','attributes','then','lodash','util','bluebird','randomstring','../../mysqldb'];(function(_0x1f3e8a,_0x435141){var _0x9928e3=function(_0x54af13){while(--_0x54af13){_0x1f3e8a['push'](_0x1f3e8a['shift']());}};_0x9928e3(++_0x435141);}(_0x71d4,0xcd));var _0x471d=function(_0x3473fa,_0xfe3958){_0x3473fa=_0x3473fa-0x0;var _0x257121=_0x71d4[_0x3473fa];return _0x257121;};'use strict';var _=require(_0x471d('0x0'));var util=require(_0x471d('0x1'));var moment=require('moment');var BPromise=require(_0x471d('0x2'));var rs=require(_0x471d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x471d('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x471d('0x5'));var config=require(_0x471d('0x6'));var jayson=require(_0x471d('0x7'));var client=jayson[_0x471d('0x8')][_0x471d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd733ea,_0x157f13,_0x204782){return new BPromise(function(_0x33b017,_0x228c8f){return client['request'](_0xd733ea,_0x204782)['then'](function(_0x5e1198){logger[_0x471d('0xa')](_0x471d('0xb'),_0x157f13,'request\x20sent');logger[_0x471d('0xc')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x157f13,_0x471d('0xd'),JSON[_0x471d('0xe')](_0x5e1198));if(_0x5e1198['error']){if(_0x5e1198[_0x471d('0xf')][_0x471d('0x10')]===0x1f4){logger[_0x471d('0xf')](_0x471d('0xb'),_0x157f13,_0x5e1198[_0x471d('0xf')]['message']);return _0x228c8f(_0x5e1198[_0x471d('0xf')][_0x471d('0x11')]);}logger[_0x471d('0xf')]('SquareReport,\x20%s,\x20%s',_0x157f13,_0x5e1198[_0x471d('0xf')]['message']);return _0x33b017(_0x5e1198[_0x471d('0xf')][_0x471d('0x11')]);}else{logger[_0x471d('0xa')](_0x471d('0xb'),_0x157f13,_0x471d('0xd'));_0x33b017(_0x5e1198[_0x471d('0x12')][_0x471d('0x11')]);}})['catch'](function(_0x413ce9){logger['error'](_0x471d('0xb'),_0x157f13,_0x413ce9);_0x228c8f(_0x413ce9);});});}exports[_0x471d('0x13')]=function(_0x149b11){var _0x29f65a=this;return new Promise(function(_0x4c7760,_0x4ea7cf){return db['SquareReport'][_0x471d('0x14')](_0x149b11[_0x471d('0x15')],{'raw':_0x149b11[_0x471d('0x16')]?_0x149b11[_0x471d('0x16')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x26128a){logger[_0x471d('0xa')](_0x471d('0x13'),_0x149b11);logger[_0x471d('0xc')]('CreateSquareReport',_0x149b11,JSON[_0x471d('0xe')](_0x26128a));_0x4c7760(_0x26128a);})[_0x471d('0x17')](function(_0x49f1c2){logger[_0x471d('0xf')](_0x471d('0x13'),_0x49f1c2[_0x471d('0x11')],_0x149b11);_0x4ea7cf(_0x29f65a[_0x471d('0xf')](0x1f4,_0x49f1c2['message']));});});};exports[_0x471d('0x18')]=function(_0xce6045){var _0x25d112=this;return new Promise(function(_0x3eae9e,_0x239875){return db[_0x471d('0x19')][_0x471d('0x1a')](_0xce6045['body'],{'raw':_0xce6045[_0x471d('0x16')]?_0xce6045[_0x471d('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xce6045['options']?_0xce6045[_0x471d('0x16')][_0x471d('0x1b')]||null:null,'attributes':_0xce6045[_0x471d('0x16')]?_0xce6045[_0x471d('0x16')][_0x471d('0x1c')]||null:null,'limit':_0xce6045[_0x471d('0x16')]?_0xce6045[_0x471d('0x16')]['limit']||null:null})[_0x471d('0x1d')](function(_0x375987){logger['info'](_0x471d('0x18'),_0xce6045);logger[_0x471d('0xc')](_0x471d('0x18'),_0xce6045,JSON[_0x471d('0xe')](_0x375987));_0x3eae9e(_0x375987);})['catch'](function(_0x24b1ad){logger[_0x471d('0xf')]('UpdateSquareReport',_0x24b1ad[_0x471d('0x11')],_0xce6045);_0x239875(_0x25d112['error'](0x1f4,_0x24b1ad[_0x471d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index cd00fef..c5eec00 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 _0x3b35=['../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','/:id','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x1cec84,_0x101ec2){var _0x12b7d3=function(_0x9679d8){while(--_0x9679d8){_0x1cec84['push'](_0x1cec84['shift']());}};_0x12b7d3(++_0x101ec2);}(_0x3b35,0x7e));var _0x53b3=function(_0x25bde7,_0x2e30b4){_0x25bde7=_0x25bde7-0x0;var _0x5d6618=_0x3b35[_0x25bde7];return _0x5d6618;};'use strict';var multer=require('multer');var util=require(_0x53b3('0x0'));var path=require(_0x53b3('0x1'));var timeout=require(_0x53b3('0x2'));var express=require(_0x53b3('0x3'));var router=express[_0x53b3('0x4')]();var fs_extra=require(_0x53b3('0x5'));var auth=require(_0x53b3('0x6'));var interaction=require(_0x53b3('0x7'));var config=require(_0x53b3('0x8'));var controller=require(_0x53b3('0x9'));router[_0x53b3('0xa')]('/',auth[_0x53b3('0xb')](),controller[_0x53b3('0xc')]);router[_0x53b3('0xa')](_0x53b3('0xd'),auth[_0x53b3('0xb')](),controller['describe']);router[_0x53b3('0xa')](_0x53b3('0xe'),auth[_0x53b3('0xb')](),controller['show']);router[_0x53b3('0xf')]('/',auth['isAuthenticated'](),controller[_0x53b3('0x10')]);router[_0x53b3('0x11')](_0x53b3('0xe'),auth[_0x53b3('0xb')](),controller[_0x53b3('0x12')]);router[_0x53b3('0x13')](_0x53b3('0xe'),auth[_0x53b3('0xb')](),controller[_0x53b3('0x14')]);module[_0x53b3('0x15')]=router; \ No newline at end of file +var _0xc5f0=['put','update','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x595138,_0x38e061){var _0x3a0686=function(_0x2e948f){while(--_0x2e948f){_0x595138['push'](_0x595138['shift']());}};_0x3a0686(++_0x38e061);}(_0xc5f0,0x1a7));var _0x0c5f=function(_0x334f9a,_0x542f01){_0x334f9a=_0x334f9a-0x0;var _0x2b219d=_0xc5f0[_0x334f9a];return _0x2b219d;};'use strict';var multer=require(_0x0c5f('0x0'));var util=require(_0x0c5f('0x1'));var path=require(_0x0c5f('0x2'));var timeout=require(_0x0c5f('0x3'));var express=require('express');var router=express[_0x0c5f('0x4')]();var fs_extra=require(_0x0c5f('0x5'));var auth=require(_0x0c5f('0x6'));var interaction=require(_0x0c5f('0x7'));var config=require(_0x0c5f('0x8'));var controller=require(_0x0c5f('0x9'));router[_0x0c5f('0xa')]('/',auth[_0x0c5f('0xb')](),controller[_0x0c5f('0xc')]);router[_0x0c5f('0xa')](_0x0c5f('0xd'),auth[_0x0c5f('0xb')](),controller[_0x0c5f('0xe')]);router[_0x0c5f('0xa')](_0x0c5f('0xf'),auth['isAuthenticated'](),controller[_0x0c5f('0x10')]);router[_0x0c5f('0x11')]('/',auth[_0x0c5f('0xb')](),controller['create']);router[_0x0c5f('0x12')](_0x0c5f('0xf'),auth[_0x0c5f('0xb')](),controller[_0x0c5f('0x13')]);router[_0x0c5f('0x14')](_0x0c5f('0xf'),auth[_0x0c5f('0xb')](),controller['destroy']);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 c40f8d6..afa5fec 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 _0x835c=['exports','STRING','TEXT','sequelize'];(function(_0x1ae005,_0x18f2ba){var _0x2d8df5=function(_0x271009){while(--_0x271009){_0x1ae005['push'](_0x1ae005['shift']());}};_0x2d8df5(++_0x18f2ba);}(_0x835c,0x177));var _0xc835=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x835c[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xc835('0x0'));module[_0xc835('0x1')]={'uniqueid':{'type':Sequelize[_0xc835('0x2')]},'node':{'type':Sequelize[_0xc835('0x2')]},'application':{'type':Sequelize[_0xc835('0x2')]},'data':{'type':Sequelize[_0xc835('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xc835('0x2')]}}; \ No newline at end of file +var _0xf2a9=['STRING','TEXT','exports'];(function(_0x566727,_0x4ab4e5){var _0x1bb679=function(_0x492ee0){while(--_0x492ee0){_0x566727['push'](_0x566727['shift']());}};_0x1bb679(++_0x4ab4e5);}(_0xf2a9,0x77));var _0x9f2a=function(_0x45ef4a,_0x40135e){_0x45ef4a=_0x45ef4a-0x0;var _0x476f4e=_0xf2a9[_0x45ef4a];return _0x476f4e;};'use strict';var Sequelize=require('sequelize');module[_0x9f2a('0x0')]={'uniqueid':{'type':Sequelize[_0x9f2a('0x1')]},'node':{'type':Sequelize[_0x9f2a('0x1')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x9f2a('0x2')]},'project_name':{'type':Sequelize[_0x9f2a('0x1')]},'callerid':{'type':Sequelize[_0x9f2a('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index df95915..17bd409 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 _0xecc4=['moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','sendStatus','error','stack','send','map','rawAttributes','type','key','model','name','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','SquareDetailsReport','includeAll','include','findAll','rows','catch','params','fields','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x1ee1f9,_0x22021d){var _0x357c8d=function(_0x5ba14a){while(--_0x5ba14a){_0x1ee1f9['push'](_0x1ee1f9['shift']());}};_0x357c8d(++_0x22021d);}(_0xecc4,0x181));var _0x4ecc=function(_0xb54ffa,_0x31d47f){_0xb54ffa=_0xb54ffa-0x0;var _0x5294a0=_0xecc4[_0xb54ffa];return _0x5294a0;};'use strict';var emlformat=require(_0x4ecc('0x0'));var rimraf=require(_0x4ecc('0x1'));var zipdir=require(_0x4ecc('0x2'));var jsonpatch=require(_0x4ecc('0x3'));var rp=require(_0x4ecc('0x4'));var moment=require(_0x4ecc('0x5'));var BPromise=require(_0x4ecc('0x6'));var Mustache=require('mustache');var util=require(_0x4ecc('0x7'));var path=require(_0x4ecc('0x8'));var sox=require(_0x4ecc('0x9'));var csv=require(_0x4ecc('0xa'));var ejs=require(_0x4ecc('0xb'));var fs=require('fs');var fs_extra=require(_0x4ecc('0xc'));var _=require('lodash');var squel=require(_0x4ecc('0xd'));var crypto=require(_0x4ecc('0xe'));var jsforce=require(_0x4ecc('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x4ecc('0xa'));var querystring=require(_0x4ecc('0x10'));var Papa=require(_0x4ecc('0x11'));var Redis=require(_0x4ecc('0x12'));var authService=require(_0x4ecc('0x13'));var qs=require(_0x4ecc('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4ecc('0x15'));var logger=require(_0x4ecc('0x16'))(_0x4ecc('0x17'));var utils=require(_0x4ecc('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x4ecc('0x19'));var db=require(_0x4ecc('0x1a'))['db'];function respondWithStatusCode(_0xcf686a,_0x5291a5){_0x5291a5=_0x5291a5||0xcc;return function(_0x309fe2){if(_0x309fe2){return _0xcf686a['sendStatus'](_0x5291a5);}return _0xcf686a[_0x4ecc('0x1b')](_0x5291a5)[_0x4ecc('0x1c')]();};}function respondWithResult(_0x5581da,_0x1dd1bc){_0x1dd1bc=_0x1dd1bc||0xc8;return function(_0x31c767){if(_0x31c767){return _0x5581da[_0x4ecc('0x1b')](_0x1dd1bc)[_0x4ecc('0x1d')](_0x31c767);}};}function respondWithFilteredResult(_0x179b2f,_0x40406f){return function(_0x1b7da4){if(_0x1b7da4){var _0x34796d=typeof _0x40406f[_0x4ecc('0x1e')]===_0x4ecc('0x1f')&&typeof _0x40406f[_0x4ecc('0x20')]===_0x4ecc('0x1f');var _0x55dd52=_0x1b7da4['count'];var _0x4f998b=_0x34796d?0x0:_0x40406f[_0x4ecc('0x1e')];var _0x186141=_0x34796d?_0x1b7da4[_0x4ecc('0x21')]:_0x40406f[_0x4ecc('0x1e')]+_0x40406f[_0x4ecc('0x20')];var _0x318829;if(_0x186141>=_0x55dd52){_0x186141=_0x55dd52;_0x318829=0xc8;}else{_0x318829=0xce;}_0x179b2f[_0x4ecc('0x1b')](_0x318829);return _0x179b2f[_0x4ecc('0x22')](_0x4ecc('0x23'),_0x4f998b+'-'+_0x186141+'/'+_0x55dd52)['json'](_0x1b7da4);}return null;};}function patchUpdates(_0x38c9fe){return function(_0x3edd5a){try{jsonpatch['apply'](_0x3edd5a,_0x38c9fe,!![]);}catch(_0x2ac0ae){return BPromise[_0x4ecc('0x24')](_0x2ac0ae);}return _0x3edd5a[_0x4ecc('0x25')]();};}function saveUpdates(_0x1e7ed3,_0x5861f4){return function(_0x2a4456){if(_0x2a4456){return _0x2a4456[_0x4ecc('0x26')](_0x1e7ed3)[_0x4ecc('0x27')](function(_0x523ce0){return _0x523ce0;});}return null;};}function removeEntity(_0x556944,_0x276989){return function(_0x5d1422){if(_0x5d1422){return _0x5d1422['destroy']()[_0x4ecc('0x27')](function(){_0x556944['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d041d,_0x37e730){return function(_0x3bec84){if(!_0x3bec84){_0x4d041d[_0x4ecc('0x28')](0x194);}return _0x3bec84;};}function handleError(_0x4d39df,_0x2479d9){_0x2479d9=_0x2479d9||0x1f4;return function(_0x5ddd4d){logger[_0x4ecc('0x29')](_0x5ddd4d[_0x4ecc('0x2a')]);if(_0x5ddd4d['name']){delete _0x5ddd4d['name'];}_0x4d39df[_0x4ecc('0x1b')](_0x2479d9)[_0x4ecc('0x2b')](_0x5ddd4d);};}exports['index']=function(_0x11dd5a,_0x18f0e9){var _0x268dfd={},_0x3f0a38={},_0x3dbded={'count':0x0,'rows':[]};var _0x1333ef=_[_0x4ecc('0x2c')](db['SquareDetailsReport'][_0x4ecc('0x2d')],function(_0x55cfbc){return{'name':_0x55cfbc['fieldName'],'type':_0x55cfbc[_0x4ecc('0x2e')][_0x4ecc('0x2f')]};});_0x3f0a38[_0x4ecc('0x30')]=_[_0x4ecc('0x2c')](_0x1333ef,_0x4ecc('0x31'));_0x3f0a38[_0x4ecc('0x32')]=_[_0x4ecc('0x33')](_0x11dd5a['query']);_0x3f0a38[_0x4ecc('0x34')]=_[_0x4ecc('0x35')](_0x3f0a38[_0x4ecc('0x30')],_0x3f0a38[_0x4ecc('0x32')]);_0x268dfd[_0x4ecc('0x36')]=_[_0x4ecc('0x35')](_0x3f0a38[_0x4ecc('0x30')],qs['fields'](_0x11dd5a[_0x4ecc('0x32')]['fields']));_0x268dfd[_0x4ecc('0x36')]=_0x268dfd[_0x4ecc('0x36')][_0x4ecc('0x37')]?_0x268dfd[_0x4ecc('0x36')]:_0x3f0a38[_0x4ecc('0x30')];if(!_0x11dd5a[_0x4ecc('0x32')][_0x4ecc('0x38')](_0x4ecc('0x39'))){_0x268dfd[_0x4ecc('0x20')]=qs[_0x4ecc('0x20')](_0x11dd5a[_0x4ecc('0x32')][_0x4ecc('0x20')]);_0x268dfd[_0x4ecc('0x1e')]=qs['offset'](_0x11dd5a[_0x4ecc('0x32')][_0x4ecc('0x1e')]);}_0x268dfd[_0x4ecc('0x3a')]=qs[_0x4ecc('0x3b')](_0x11dd5a[_0x4ecc('0x32')][_0x4ecc('0x3b')]);_0x268dfd[_0x4ecc('0x3c')]=qs[_0x4ecc('0x34')](_[_0x4ecc('0x3d')](_0x11dd5a[_0x4ecc('0x32')],_0x3f0a38[_0x4ecc('0x34')]),_0x1333ef);if(_0x11dd5a[_0x4ecc('0x32')][_0x4ecc('0x3e')]){_0x268dfd['where']=_['merge'](_0x268dfd['where'],{'$or':_[_0x4ecc('0x2c')](_0x1333ef,function(_0x42aceb){if(_0x42aceb['type']!=='VIRTUAL'){var _0x3af0c3={};_0x3af0c3[_0x42aceb[_0x4ecc('0x31')]]={'$like':'%'+_0x11dd5a['query'][_0x4ecc('0x3e')]+'%'};return _0x3af0c3;}})});}_0x268dfd=_[_0x4ecc('0x3f')]({},_0x268dfd,_0x11dd5a[_0x4ecc('0x40')]);var _0x52c0dc={'where':_0x268dfd[_0x4ecc('0x3c')]};return db[_0x4ecc('0x41')][_0x4ecc('0x21')](_0x52c0dc)[_0x4ecc('0x27')](function(_0x35c0bf){_0x3dbded[_0x4ecc('0x21')]=_0x35c0bf;if(_0x11dd5a['query'][_0x4ecc('0x42')]){_0x268dfd[_0x4ecc('0x43')]=[{'all':!![]}];}return db[_0x4ecc('0x41')][_0x4ecc('0x44')](_0x268dfd);})[_0x4ecc('0x27')](function(_0x30ff28){_0x3dbded[_0x4ecc('0x45')]=_0x30ff28;return _0x3dbded;})[_0x4ecc('0x27')](respondWithFilteredResult(_0x18f0e9,_0x268dfd))[_0x4ecc('0x46')](handleError(_0x18f0e9,null));};exports['show']=function(_0x5ea1f0,_0x131324){var _0x394c6e={'raw':!![],'where':{'id':_0x5ea1f0[_0x4ecc('0x47')]['id']}},_0x21ea04={};_0x21ea04[_0x4ecc('0x30')]=_[_0x4ecc('0x33')](db[_0x4ecc('0x41')][_0x4ecc('0x2d')]);_0x21ea04[_0x4ecc('0x32')]=_[_0x4ecc('0x33')](_0x5ea1f0['query']);_0x21ea04[_0x4ecc('0x34')]=_[_0x4ecc('0x35')](_0x21ea04[_0x4ecc('0x30')],_0x21ea04[_0x4ecc('0x32')]);_0x394c6e[_0x4ecc('0x36')]=_['intersection'](_0x21ea04['model'],qs[_0x4ecc('0x48')](_0x5ea1f0[_0x4ecc('0x32')][_0x4ecc('0x48')]));_0x394c6e[_0x4ecc('0x36')]=_0x394c6e['attributes']['length']?_0x394c6e[_0x4ecc('0x36')]:_0x21ea04[_0x4ecc('0x30')];if(_0x5ea1f0[_0x4ecc('0x32')]['includeAll']){_0x394c6e[_0x4ecc('0x43')]=[{'all':!![]}];}_0x394c6e=_[_0x4ecc('0x3f')]({},_0x394c6e,_0x5ea1f0['options']);return db['SquareDetailsReport'][_0x4ecc('0x49')](_0x394c6e)['then'](handleEntityNotFound(_0x131324,null))['then'](respondWithResult(_0x131324,null))[_0x4ecc('0x46')](handleError(_0x131324,null));};exports['create']=function(_0x117457,_0x1bd9cc){return db[_0x4ecc('0x41')][_0x4ecc('0x4a')](_0x117457[_0x4ecc('0x4b')],{})[_0x4ecc('0x27')](respondWithResult(_0x1bd9cc,0xc9))[_0x4ecc('0x46')](handleError(_0x1bd9cc,null));};exports[_0x4ecc('0x26')]=function(_0x3ee67d,_0x5286e9){if(_0x3ee67d[_0x4ecc('0x4b')]['id']){delete _0x3ee67d[_0x4ecc('0x4b')]['id'];}return db[_0x4ecc('0x41')][_0x4ecc('0x49')]({'where':{'id':_0x3ee67d[_0x4ecc('0x47')]['id']}})['then'](handleEntityNotFound(_0x5286e9,null))[_0x4ecc('0x27')](saveUpdates(_0x3ee67d[_0x4ecc('0x4b')],null))['then'](respondWithResult(_0x5286e9,null))['catch'](handleError(_0x5286e9,null));};exports[_0x4ecc('0x4c')]=function(_0x433b71,_0x456b44){return db[_0x4ecc('0x41')][_0x4ecc('0x49')]({'where':{'id':_0x433b71[_0x4ecc('0x47')]['id']}})[_0x4ecc('0x27')](handleEntityNotFound(_0x456b44,null))[_0x4ecc('0x27')](removeEntity(_0x456b44,null))['catch'](handleError(_0x456b44,null));};exports['describe']=function(_0xdf5d12,_0x596fe8){return db[_0x4ecc('0x41')][_0x4ecc('0x4d')]()['then'](respondWithResult(_0x596fe8,null))[_0x4ecc('0x46')](handleError(_0x596fe8,null));}; \ No newline at end of file +var _0xc52b=['then','destroy','stack','name','index','map','SquareDetailsReport','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','count','limit','set','Content-Range','json','apply','reject','save'];(function(_0x5bac46,_0x34d07f){var _0x407ef3=function(_0x61de33){while(--_0x61de33){_0x5bac46['push'](_0x5bac46['shift']());}};_0x407ef3(++_0x34d07f);}(_0xc52b,0xf7));var _0xbc52=function(_0x37a70e,_0x2d0ec4){_0x37a70e=_0x37a70e-0x0;var _0x308d28=_0xc52b[_0x37a70e];return _0x308d28;};'use strict';var emlformat=require(_0xbc52('0x0'));var rimraf=require(_0xbc52('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbc52('0x2'));var rp=require(_0xbc52('0x3'));var moment=require(_0xbc52('0x4'));var BPromise=require(_0xbc52('0x5'));var Mustache=require('mustache');var util=require(_0xbc52('0x6'));var path=require(_0xbc52('0x7'));var sox=require('sox');var csv=require(_0xbc52('0x8'));var ejs=require(_0xbc52('0x9'));var fs=require('fs');var fs_extra=require(_0xbc52('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbc52('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xbc52('0x8'));var querystring=require('querystring');var Papa=require(_0xbc52('0xc'));var Redis=require(_0xbc52('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xbc52('0xe'));var as=require(_0xbc52('0xf'));var hardwareService=require(_0xbc52('0x10'));var logger=require('../../config/logger')(_0xbc52('0x11'));var utils=require('../../config/utils');var config=require(_0xbc52('0x12'));var licenseUtil=require(_0xbc52('0x13'));var db=require(_0xbc52('0x14'))['db'];function respondWithStatusCode(_0x1bf505,_0x169159){_0x169159=_0x169159||0xcc;return function(_0x5a0773){if(_0x5a0773){return _0x1bf505[_0xbc52('0x15')](_0x169159);}return _0x1bf505[_0xbc52('0x16')](_0x169159)[_0xbc52('0x17')]();};}function respondWithResult(_0x4f89f6,_0x2ec5d9){_0x2ec5d9=_0x2ec5d9||0xc8;return function(_0x57a533){if(_0x57a533){return _0x4f89f6['status'](_0x2ec5d9)['json'](_0x57a533);}};}function respondWithFilteredResult(_0xaa98f8,_0x468e9d){return function(_0x16da78){if(_0x16da78){var _0x34cdc0=typeof _0x468e9d[_0xbc52('0x18')]==='undefined'&&typeof _0x468e9d['limit']==='undefined';var _0x3df120=_0x16da78[_0xbc52('0x19')];var _0x412b86=_0x34cdc0?0x0:_0x468e9d[_0xbc52('0x18')];var _0xbfa483=_0x34cdc0?_0x16da78[_0xbc52('0x19')]:_0x468e9d['offset']+_0x468e9d[_0xbc52('0x1a')];var _0x39b719;if(_0xbfa483>=_0x3df120){_0xbfa483=_0x3df120;_0x39b719=0xc8;}else{_0x39b719=0xce;}_0xaa98f8['status'](_0x39b719);return _0xaa98f8[_0xbc52('0x1b')](_0xbc52('0x1c'),_0x412b86+'-'+_0xbfa483+'/'+_0x3df120)[_0xbc52('0x1d')](_0x16da78);}return null;};}function patchUpdates(_0x424de6){return function(_0xb2393f){try{jsonpatch[_0xbc52('0x1e')](_0xb2393f,_0x424de6,!![]);}catch(_0x5545a8){return BPromise[_0xbc52('0x1f')](_0x5545a8);}return _0xb2393f[_0xbc52('0x20')]();};}function saveUpdates(_0x56b560,_0x2a25af){return function(_0x496e8a){if(_0x496e8a){return _0x496e8a['update'](_0x56b560)[_0xbc52('0x21')](function(_0x3a9761){return _0x3a9761;});}return null;};}function removeEntity(_0x5b4eb3,_0x184ec6){return function(_0x520ff8){if(_0x520ff8){return _0x520ff8[_0xbc52('0x22')]()[_0xbc52('0x21')](function(){_0x5b4eb3['status'](0xcc)[_0xbc52('0x17')]();});}};}function handleEntityNotFound(_0x582b0d,_0x2978ed){return function(_0x1dc677){if(!_0x1dc677){_0x582b0d[_0xbc52('0x15')](0x194);}return _0x1dc677;};}function handleError(_0x5bf2b6,_0x3db549){_0x3db549=_0x3db549||0x1f4;return function(_0x20954f){logger['error'](_0x20954f[_0xbc52('0x23')]);if(_0x20954f['name']){delete _0x20954f[_0xbc52('0x24')];}_0x5bf2b6[_0xbc52('0x16')](_0x3db549)['send'](_0x20954f);};}exports[_0xbc52('0x25')]=function(_0x2f375c,_0x3902d6){var _0x32e8f0={},_0x14161c={},_0x446a9b={'count':0x0,'rows':[]};var _0x144d6a=_[_0xbc52('0x26')](db[_0xbc52('0x27')]['rawAttributes'],function(_0x303aae){return{'name':_0x303aae[_0xbc52('0x28')],'type':_0x303aae[_0xbc52('0x29')][_0xbc52('0x2a')]};});_0x14161c[_0xbc52('0x2b')]=_[_0xbc52('0x26')](_0x144d6a,_0xbc52('0x24'));_0x14161c[_0xbc52('0x2c')]=_['keys'](_0x2f375c['query']);_0x14161c[_0xbc52('0x2d')]=_[_0xbc52('0x2e')](_0x14161c[_0xbc52('0x2b')],_0x14161c[_0xbc52('0x2c')]);_0x32e8f0[_0xbc52('0x2f')]=_[_0xbc52('0x2e')](_0x14161c[_0xbc52('0x2b')],qs[_0xbc52('0x30')](_0x2f375c[_0xbc52('0x2c')][_0xbc52('0x30')]));_0x32e8f0[_0xbc52('0x2f')]=_0x32e8f0[_0xbc52('0x2f')][_0xbc52('0x31')]?_0x32e8f0[_0xbc52('0x2f')]:_0x14161c[_0xbc52('0x2b')];if(!_0x2f375c[_0xbc52('0x2c')][_0xbc52('0x32')](_0xbc52('0x33'))){_0x32e8f0[_0xbc52('0x1a')]=qs[_0xbc52('0x1a')](_0x2f375c[_0xbc52('0x2c')][_0xbc52('0x1a')]);_0x32e8f0['offset']=qs['offset'](_0x2f375c['query'][_0xbc52('0x18')]);}_0x32e8f0['order']=qs[_0xbc52('0x34')](_0x2f375c['query']['sort']);_0x32e8f0[_0xbc52('0x35')]=qs[_0xbc52('0x2d')](_['pick'](_0x2f375c[_0xbc52('0x2c')],_0x14161c[_0xbc52('0x2d')]),_0x144d6a);if(_0x2f375c[_0xbc52('0x2c')]['filter']){_0x32e8f0[_0xbc52('0x35')]=_[_0xbc52('0x36')](_0x32e8f0[_0xbc52('0x35')],{'$or':_['map'](_0x144d6a,function(_0x4212df){if(_0x4212df[_0xbc52('0x29')]!==_0xbc52('0x37')){var _0x1189df={};_0x1189df[_0x4212df[_0xbc52('0x24')]]={'$like':'%'+_0x2f375c[_0xbc52('0x2c')][_0xbc52('0x38')]+'%'};return _0x1189df;}})});}_0x32e8f0=_[_0xbc52('0x36')]({},_0x32e8f0,_0x2f375c[_0xbc52('0x39')]);var _0x2b751b={'where':_0x32e8f0['where']};return db[_0xbc52('0x27')]['count'](_0x2b751b)[_0xbc52('0x21')](function(_0x45baf6){_0x446a9b[_0xbc52('0x19')]=_0x45baf6;if(_0x2f375c[_0xbc52('0x2c')][_0xbc52('0x3a')]){_0x32e8f0[_0xbc52('0x3b')]=[{'all':!![]}];}return db[_0xbc52('0x27')][_0xbc52('0x3c')](_0x32e8f0);})[_0xbc52('0x21')](function(_0x34a937){_0x446a9b[_0xbc52('0x3d')]=_0x34a937;return _0x446a9b;})[_0xbc52('0x21')](respondWithFilteredResult(_0x3902d6,_0x32e8f0))[_0xbc52('0x3e')](handleError(_0x3902d6,null));};exports[_0xbc52('0x3f')]=function(_0x186240,_0xb8a61e){var _0x192d65={'raw':!![],'where':{'id':_0x186240['params']['id']}},_0x1b5260={};_0x1b5260['model']=_[_0xbc52('0x40')](db[_0xbc52('0x27')]['rawAttributes']);_0x1b5260[_0xbc52('0x2c')]=_[_0xbc52('0x40')](_0x186240['query']);_0x1b5260[_0xbc52('0x2d')]=_[_0xbc52('0x2e')](_0x1b5260['model'],_0x1b5260[_0xbc52('0x2c')]);_0x192d65[_0xbc52('0x2f')]=_[_0xbc52('0x2e')](_0x1b5260[_0xbc52('0x2b')],qs[_0xbc52('0x30')](_0x186240['query']['fields']));_0x192d65['attributes']=_0x192d65[_0xbc52('0x2f')][_0xbc52('0x31')]?_0x192d65[_0xbc52('0x2f')]:_0x1b5260[_0xbc52('0x2b')];if(_0x186240[_0xbc52('0x2c')][_0xbc52('0x3a')]){_0x192d65[_0xbc52('0x3b')]=[{'all':!![]}];}_0x192d65=_[_0xbc52('0x36')]({},_0x192d65,_0x186240[_0xbc52('0x39')]);return db[_0xbc52('0x27')][_0xbc52('0x41')](_0x192d65)[_0xbc52('0x21')](handleEntityNotFound(_0xb8a61e,null))[_0xbc52('0x21')](respondWithResult(_0xb8a61e,null))[_0xbc52('0x3e')](handleError(_0xb8a61e,null));};exports[_0xbc52('0x42')]=function(_0x2dc423,_0x28cc45){return db['SquareDetailsReport'][_0xbc52('0x42')](_0x2dc423[_0xbc52('0x43')],{})[_0xbc52('0x21')](respondWithResult(_0x28cc45,0xc9))[_0xbc52('0x3e')](handleError(_0x28cc45,null));};exports['update']=function(_0x1d63e6,_0x2dc6c0){if(_0x1d63e6[_0xbc52('0x43')]['id']){delete _0x1d63e6['body']['id'];}return db[_0xbc52('0x27')][_0xbc52('0x41')]({'where':{'id':_0x1d63e6[_0xbc52('0x44')]['id']}})[_0xbc52('0x21')](handleEntityNotFound(_0x2dc6c0,null))[_0xbc52('0x21')](saveUpdates(_0x1d63e6[_0xbc52('0x43')],null))[_0xbc52('0x21')](respondWithResult(_0x2dc6c0,null))[_0xbc52('0x3e')](handleError(_0x2dc6c0,null));};exports[_0xbc52('0x22')]=function(_0x4a5375,_0x2b661c){return db[_0xbc52('0x27')][_0xbc52('0x41')]({'where':{'id':_0x4a5375[_0xbc52('0x44')]['id']}})['then'](handleEntityNotFound(_0x2b661c,null))['then'](removeEntity(_0x2b661c,null))['catch'](handleError(_0x2b661c,null));};exports[_0xbc52('0x45')]=function(_0xe0fae5,_0x569a8e){return db['SquareDetailsReport'][_0xbc52('0x45')]()[_0xbc52('0x21')](respondWithResult(_0x569a8e,null))[_0xbc52('0x3e')](handleError(_0x569a8e,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 0606156..05ab258 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 _0x0f11=['exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./squareReportDetail.attributes'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x0f11,0x100));var _0x10f1=function(_0x32e69e,_0x5d1c13){_0x32e69e=_0x32e69e-0x0;var _0x27dc49=_0x0f11[_0x32e69e];return _0x27dc49;};'use strict';var _=require(_0x10f1('0x0'));var util=require(_0x10f1('0x1'));var logger=require(_0x10f1('0x2'))(_0x10f1('0x3'));var moment=require(_0x10f1('0x4'));var BPromise=require(_0x10f1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x10f1('0x6'));var rimraf=require(_0x10f1('0x7'));var config=require(_0x10f1('0x8'));var attributes=require(_0x10f1('0x9'));module[_0x10f1('0xa')]=function(_0x363844,_0x40e658){return _0x363844[_0x10f1('0xb')](_0x10f1('0xc'),attributes,{'tableName':_0x10f1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedac=['define','SquareDetailsReport','report_square_details','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x5ce68f,_0x1c468d){var _0x2a7421=function(_0x3e8270){while(--_0x3e8270){_0x5ce68f['push'](_0x5ce68f['shift']());}};_0x2a7421(++_0x1c468d);}(_0xedac,0x10b));var _0xceda=function(_0xdb06a7,_0x235ea2){_0xdb06a7=_0xdb06a7-0x0;var _0xf60ee0=_0xedac[_0xdb06a7];return _0xf60ee0;};'use strict';var _=require('lodash');var util=require(_0xceda('0x0'));var logger=require(_0xceda('0x1'))(_0xceda('0x2'));var moment=require('moment');var BPromise=require(_0xceda('0x3'));var rp=require(_0xceda('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xceda('0x5'));var config=require(_0xceda('0x6'));var attributes=require('./squareReportDetail.attributes');module[_0xceda('0x7')]=function(_0x2a21cc,_0x5904bb){return _0x2a21cc[_0xceda('0x8')](_0xceda('0x9'),attributes,{'tableName':_0xceda('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 c2ac27a..0a1d5f9 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 _0x1399=['lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SquareDetailsReport','create','options','raw','info','CreateSquareDetailsReport','debug'];(function(_0x5d809f,_0x8934f0){var _0x564557=function(_0x111f4b){while(--_0x111f4b){_0x5d809f['push'](_0x5d809f['shift']());}};_0x564557(++_0x8934f0);}(_0x1399,0x16c));var _0x9139=function(_0x2d72b7,_0x583095){_0x2d72b7=_0x2d72b7-0x0;var _0x9b5296=_0x1399[_0x2d72b7];return _0x9b5296;};'use strict';var _=require(_0x9139('0x0'));var util=require(_0x9139('0x1'));var moment=require('moment');var BPromise=require(_0x9139('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9139('0x3'));var db=require(_0x9139('0x4'))['db'];var utils=require(_0x9139('0x5'));var logger=require(_0x9139('0x6'))(_0x9139('0x7'));var config=require(_0x9139('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9139('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11d2ed,_0x4d5d1e,_0x51832d){return new BPromise(function(_0x11a03f,_0x59aec5){return client['request'](_0x11d2ed,_0x51832d)[_0x9139('0xa')](function(_0x385e2c){logger['info'](_0x9139('0xb'),_0x4d5d1e,_0x9139('0xc'));logger['debug']('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x4d5d1e,_0x9139('0xc'),JSON[_0x9139('0xd')](_0x385e2c));if(_0x385e2c[_0x9139('0xe')]){if(_0x385e2c[_0x9139('0xe')][_0x9139('0xf')]===0x1f4){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x4d5d1e,_0x385e2c['error'][_0x9139('0x10')]);return _0x59aec5(_0x385e2c['error'][_0x9139('0x10')]);}logger[_0x9139('0xe')](_0x9139('0xb'),_0x4d5d1e,_0x385e2c[_0x9139('0xe')]['message']);return _0x11a03f(_0x385e2c[_0x9139('0xe')]['message']);}else{logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x4d5d1e,_0x9139('0xc'));_0x11a03f(_0x385e2c[_0x9139('0x11')][_0x9139('0x10')]);}})[_0x9139('0x12')](function(_0x18801b){logger[_0x9139('0xe')]('SquareDetailsReport,\x20%s,\x20%s',_0x4d5d1e,_0x18801b);_0x59aec5(_0x18801b);});});}exports['CreateSquareDetailsReport']=function(_0x13cab8){var _0xe39cbc=this;return new Promise(function(_0x5e0a59,_0x56b316){return db[_0x9139('0x13')][_0x9139('0x14')](_0x13cab8['body'],{'raw':_0x13cab8[_0x9139('0x15')]?_0x13cab8[_0x9139('0x15')][_0x9139('0x16')]===undefined?!![]:![]:!![]})[_0x9139('0xa')](function(_0xd2eb33){logger[_0x9139('0x17')](_0x9139('0x18'),_0x13cab8);logger[_0x9139('0x19')](_0x9139('0x18'),_0x13cab8,JSON[_0x9139('0xd')](_0xd2eb33));_0x5e0a59(_0xd2eb33);})[_0x9139('0x12')](function(_0x269f8a){logger[_0x9139('0xe')](_0x9139('0x18'),_0x269f8a[_0x9139('0x10')],_0x13cab8);_0x56b316(_0xe39cbc[_0x9139('0xe')](0x1f4,_0x269f8a[_0x9139('0x10')]));});});}; \ No newline at end of file +var _0xd5fc=['SquareDetailsReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','result','catch','create','body','options','CreateSquareDetailsReport','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0xd5fc,0xae));var _0xcd5f=function(_0x387f8d,_0x2fe559){_0x387f8d=_0x387f8d-0x0;var _0x31399d=_0xd5fc[_0x387f8d];return _0x31399d;};'use strict';var _=require(_0xcd5f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcd5f('0x1'));var fs=require('fs');var Redis=require(_0xcd5f('0x2'));var db=require(_0xcd5f('0x3'))['db'];var utils=require(_0xcd5f('0x4'));var logger=require(_0xcd5f('0x5'))(_0xcd5f('0x6'));var config=require('../../config/environment');var jayson=require(_0xcd5f('0x7'));var client=jayson['client'][_0xcd5f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x159b3f,_0x5af696,_0x58d65d){return new BPromise(function(_0x4e668e,_0x102ce9){return client['request'](_0x159b3f,_0x58d65d)[_0xcd5f('0x9')](function(_0x3e63d4){logger['info'](_0xcd5f('0xa'),_0x5af696,'request\x20sent');logger[_0xcd5f('0xb')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x5af696,_0xcd5f('0xc'),JSON[_0xcd5f('0xd')](_0x3e63d4));if(_0x3e63d4[_0xcd5f('0xe')]){if(_0x3e63d4[_0xcd5f('0xe')]['code']===0x1f4){logger[_0xcd5f('0xe')](_0xcd5f('0xa'),_0x5af696,_0x3e63d4['error'][_0xcd5f('0xf')]);return _0x102ce9(_0x3e63d4[_0xcd5f('0xe')][_0xcd5f('0xf')]);}logger[_0xcd5f('0xe')](_0xcd5f('0xa'),_0x5af696,_0x3e63d4['error'][_0xcd5f('0xf')]);return _0x4e668e(_0x3e63d4[_0xcd5f('0xe')][_0xcd5f('0xf')]);}else{logger[_0xcd5f('0x10')](_0xcd5f('0xa'),_0x5af696,_0xcd5f('0xc'));_0x4e668e(_0x3e63d4[_0xcd5f('0x11')]['message']);}})[_0xcd5f('0x12')](function(_0x33ab1a){logger[_0xcd5f('0xe')](_0xcd5f('0xa'),_0x5af696,_0x33ab1a);_0x102ce9(_0x33ab1a);});});}exports['CreateSquareDetailsReport']=function(_0x1a4cb6){var _0x56a874=this;return new Promise(function(_0xb23761,_0x36c60c){return db['SquareDetailsReport'][_0xcd5f('0x13')](_0x1a4cb6[_0xcd5f('0x14')],{'raw':_0x1a4cb6['options']?_0x1a4cb6[_0xcd5f('0x15')]['raw']===undefined?!![]:![]:!![]})[_0xcd5f('0x9')](function(_0x5c3c9f){logger['info'](_0xcd5f('0x16'),_0x1a4cb6);logger['debug']('CreateSquareDetailsReport',_0x1a4cb6,JSON['stringify'](_0x5c3c9f));_0xb23761(_0x5c3c9f);})[_0xcd5f('0x12')](function(_0x5c03b9){logger[_0xcd5f('0xe')](_0xcd5f('0x16'),_0x5c03b9[_0xcd5f('0xf')],_0x1a4cb6);_0x36c60c(_0x56a874[_0xcd5f('0xe')](0x1f4,_0x5c03b9[_0xcd5f('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 1d147cb..120ee0b 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 _0xcadb=['/process/:pid/kill','killProcess','express','../../components/auth/service','isAuthenticated','index','get'];(function(_0x448f23,_0x62556f){var _0x545300=function(_0x24e4af){while(--_0x24e4af){_0x448f23['push'](_0x448f23['shift']());}};_0x545300(++_0x62556f);}(_0xcadb,0xdb));var _0xbcad=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0xcadb[_0x50aa2e];return _0x5e07f0;};'use strict';var express=require(_0xbcad('0x0'));var router=express['Router']();var auth=require(_0xbcad('0x1'));var controller=require('./system.controller');router['get']('/',auth[_0xbcad('0x2')](),controller[_0xbcad('0x3')]);router[_0xbcad('0x4')](_0xbcad('0x5'),auth['isAuthenticated'](),controller[_0xbcad('0x6')]);module['exports']=router; \ No newline at end of file +var _0x40e9=['../../components/auth/service','./system.controller','get','isAuthenticated','index','/process/:pid/kill','killProcess','exports','express'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x40e9,0x116));var _0x940e=function(_0x4a6759,_0x3d76e4){_0x4a6759=_0x4a6759-0x0;var _0x438ca8=_0x40e9[_0x4a6759];return _0x438ca8;};'use strict';var express=require(_0x940e('0x0'));var router=express['Router']();var auth=require(_0x940e('0x1'));var controller=require(_0x940e('0x2'));router[_0x940e('0x3')]('/',auth[_0x940e('0x4')](),controller[_0x940e('0x5')]);router['get'](_0x940e('0x6'),auth[_0x940e('0x4')](),controller[_0x940e('0x7')]);module[_0x940e('0x8')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index bad3a61..2521597 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 _0xb685=['send','index','getAllData','then','json','killProcess','components/import/cm','format','pid','split','length','Process\x20with\x20pid\x20%s\x20not\x20found!','params','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','systeminformation','child_process','../../config/logger','api','util','bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status'];(function(_0x39772f,_0x5605cb){var _0xc9edbf=function(_0x106a39){while(--_0x106a39){_0x39772f['push'](_0x39772f['shift']());}};_0xc9edbf(++_0x5605cb);}(_0xb685,0x10d));var _0x5b68=function(_0x1b3d60,_0x51583b){_0x1b3d60=_0x1b3d60-0x0;var _0x4abc3d=_0xb685[_0x1b3d60];return _0x4abc3d;};'use strict';var info=require(_0x5b68('0x0'));var exec=require(_0x5b68('0x1'))['exec'];var logger=require(_0x5b68('0x2'))(_0x5b68('0x3'));var util=require(_0x5b68('0x4'));var BPromise=require(_0x5b68('0x5'));var _=require('lodash');function handleError(_0x3faffe,_0xf2f791,_0x129130){_0xf2f791=_0xf2f791||0x1f4;return function(_0x4653e5){logger[_0x5b68('0x6')](_0x5b68('0x7'),_0x129130,_0xf2f791,util[_0x5b68('0x8')](_0x4653e5,{'showHidden':![],'depth':null}));delete _0x4653e5[_0x5b68('0x9')];_0x3faffe[_0x5b68('0xa')](_0xf2f791)[_0x5b68('0xb')](_0x4653e5);};}exports[_0x5b68('0xc')]=function(_0x1079bf,_0x31ef5f){return info[_0x5b68('0xd')]()[_0x5b68('0xe')](function(_0x224705){return _0x31ef5f['status'](0xc8)[_0x5b68('0xf')](_0x224705);})['catch'](function(_0x39d283){return _0x31ef5f['status'](0x1f4)[_0x5b68('0xf')](_0x39d283);});};exports[_0x5b68('0x10')]=function(_0x20f87e,_0x300620){var _0x39f95b=[_0x5b68('0x11')];return new BPromise(function(_0x621885,_0x486f65){return exec(util[_0x5b68('0x12')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x20f87e['params'][_0x5b68('0x13')]),function(_0x4986f7,_0x8b567b,_0x360fd9){if(_0x4986f7){return _0x486f65(_0x4986f7);}return _0x621885(_0x8b567b);});})[_0x5b68('0xe')](function(_0x387080){var _0x23f68e=![];var _0x3d83cd=_0x387080[_0x5b68('0x14')](/\n/);for(var _0x5d34cc=0x0,_0x6fa9f2=_0x39f95b[_0x5b68('0x15')];_0x5d34cc<_0x6fa9f2,_0x23f68e===![];_0x5d34cc+=0x1){if(_0x387080['indexOf'](_0x39f95b[_0x5d34cc])>=0x0){_0x23f68e=!![];}}if(!_0x23f68e){throw new Error(util['format'](_0x5b68('0x16'),_0x20f87e[_0x5b68('0x17')]['pid']));}process[_0x5b68('0x18')](_0x20f87e[_0x5b68('0x17')]['pid'],_0x5b68('0x19'));return _0x300620['status'](0xc8)[_0x5b68('0xf')]({'message':util[_0x5b68('0x12')](_0x5b68('0x1a'),_0x20f87e['params'][_0x5b68('0x13')])});})[_0x5b68('0x1b')](handleError(_0x300620,null,_0x5b68('0x10')));}; \ No newline at end of file +var _0x03db=['SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','child_process','exec','../../config/logger','api','util','bluebird','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','then','json','catch','killProcess','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!','kill'];(function(_0x421102,_0x457a13){var _0x16b9e3=function(_0x3429f2){while(--_0x3429f2){_0x421102['push'](_0x421102['shift']());}};_0x16b9e3(++_0x457a13);}(_0x03db,0xea));var _0xb03d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x03db[_0x3dd15e];return _0x231fd0;};'use strict';var info=require('systeminformation');var exec=require(_0xb03d('0x0'))[_0xb03d('0x1')];var logger=require(_0xb03d('0x2'))(_0xb03d('0x3'));var util=require(_0xb03d('0x4'));var BPromise=require(_0xb03d('0x5'));var _=require('lodash');function handleError(_0x1b33db,_0x126b2c,_0x4614cf){_0x126b2c=_0x126b2c||0x1f4;return function(_0x56292e){logger['error'](_0xb03d('0x6'),_0x4614cf,_0x126b2c,util[_0xb03d('0x7')](_0x56292e,{'showHidden':![],'depth':null}));delete _0x56292e[_0xb03d('0x8')];_0x1b33db[_0xb03d('0x9')](_0x126b2c)[_0xb03d('0xa')](_0x56292e);};}exports[_0xb03d('0xb')]=function(_0x859941,_0x5d6c28){return info[_0xb03d('0xc')]()[_0xb03d('0xd')](function(_0x4d2aa5){return _0x5d6c28[_0xb03d('0x9')](0xc8)[_0xb03d('0xe')](_0x4d2aa5);})[_0xb03d('0xf')](function(_0x47cb5b){return _0x5d6c28[_0xb03d('0x9')](0x1f4)[_0xb03d('0xe')](_0x47cb5b);});};exports[_0xb03d('0x10')]=function(_0x21778e,_0x224325){var _0x2a39bf=[_0xb03d('0x11')];return new BPromise(function(_0x4094a2,_0x46fdf5){return exec(util['format'](_0xb03d('0x12'),_0x21778e[_0xb03d('0x13')][_0xb03d('0x14')]),function(_0x403ed8,_0x296a3e,_0x239808){if(_0x403ed8){return _0x46fdf5(_0x403ed8);}return _0x4094a2(_0x296a3e);});})[_0xb03d('0xd')](function(_0x432004){var _0x2d0be2=![];var _0x15add3=_0x432004[_0xb03d('0x15')](/\n/);for(var _0x3ca17a=0x0,_0x59a7a4=_0x2a39bf[_0xb03d('0x16')];_0x3ca17a<_0x59a7a4,_0x2d0be2===![];_0x3ca17a+=0x1){if(_0x432004[_0xb03d('0x17')](_0x2a39bf[_0x3ca17a])>=0x0){_0x2d0be2=!![];}}if(!_0x2d0be2){throw new Error(util[_0xb03d('0x18')](_0xb03d('0x19'),_0x21778e[_0xb03d('0x13')][_0xb03d('0x14')]));}process[_0xb03d('0x1a')](_0x21778e[_0xb03d('0x13')][_0xb03d('0x14')],_0xb03d('0x1b'));return _0x224325['status'](0xc8)[_0xb03d('0xe')]({'message':util[_0xb03d('0x18')](_0xb03d('0x1c'),_0x21778e['params']['pid'])});})['catch'](handleError(_0x224325,null,_0xb03d('0x10')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 7e90c2b..bd78f42 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 _0xb856=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','/:id','isAuthenticated','create','update','destroy','multer'];(function(_0x4c99c6,_0x25931a){var _0x2da1c3=function(_0x55ba7e){while(--_0x55ba7e){_0x4c99c6['push'](_0x4c99c6['shift']());}};_0x2da1c3(++_0x25931a);}(_0xb856,0xcf));var _0x6b85=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb856[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x6b85('0x0'));var util=require('util');var path=require(_0x6b85('0x1'));var timeout=require(_0x6b85('0x2'));var express=require(_0x6b85('0x3'));var router=express[_0x6b85('0x4')]();var fs_extra=require(_0x6b85('0x5'));var auth=require(_0x6b85('0x6'));var interaction=require(_0x6b85('0x7'));var config=require(_0x6b85('0x8'));var controller=require(_0x6b85('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x6b85('0xa')](_0x6b85('0xb'),auth[_0x6b85('0xc')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x6b85('0xd')]);router['put']('/:id',auth[_0x6b85('0xc')](),controller[_0x6b85('0xe')]);router['delete'](_0x6b85('0xb'),auth[_0x6b85('0xc')](),controller[_0x6b85('0xf')]);module['exports']=router; \ No newline at end of file +var _0x73a1=['get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5e1687,_0x213e25){var _0x20b4ec=function(_0x4e6deb){while(--_0x4e6deb){_0x5e1687['push'](_0x5e1687['shift']());}};_0x20b4ec(++_0x213e25);}(_0x73a1,0x161));var _0x173a=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x73a1[_0x1969a7];return _0x3d665f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x173a('0x0'));var timeout=require(_0x173a('0x1'));var express=require('express');var router=express[_0x173a('0x2')]();var fs_extra=require(_0x173a('0x3'));var auth=require(_0x173a('0x4'));var interaction=require(_0x173a('0x5'));var config=require(_0x173a('0x6'));var controller=require('./tag.controller');router[_0x173a('0x7')]('/',auth[_0x173a('0x8')](),controller[_0x173a('0x9')]);router[_0x173a('0x7')](_0x173a('0xa'),auth[_0x173a('0x8')](),controller[_0x173a('0xb')]);router[_0x173a('0xc')]('/',auth[_0x173a('0x8')](),controller[_0x173a('0xd')]);router[_0x173a('0xe')](_0x173a('0xa'),auth['isAuthenticated'](),controller[_0x173a('0xf')]);router['delete'](_0x173a('0xa'),auth[_0x173a('0x8')](),controller[_0x173a('0x10')]);module[_0x173a('0x11')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 0417fb3..1324a4e 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 _0x4ffe=['STRING','#0091EA','sequelize','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x4ffe,0x172));var _0xe4ff=function(_0x193109,_0x50a9ca){_0x193109=_0x193109-0x0;var _0x4af109=_0x4ffe[_0x193109];return _0x4af109;};'use strict';var Sequelize=require(_0xe4ff('0x0'));module[_0xe4ff('0x1')]={'name':{'type':Sequelize[_0xe4ff('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xe4ff('0x2')],'defaultValue':_0xe4ff('0x3')},'description':{'type':Sequelize[_0xe4ff('0x2')]}}; \ No newline at end of file +var _0x63a5=['exports','STRING','sequelize'];(function(_0x2dbb3e,_0x2686b5){var _0x211782=function(_0x1c7ed2){while(--_0x1c7ed2){_0x2dbb3e['push'](_0x2dbb3e['shift']());}};_0x211782(++_0x2686b5);}(_0x63a5,0x18e));var _0x563a=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x63a5[_0x403c20];return _0x2b271a;};'use strict';var Sequelize=require(_0x563a('0x0'));module[_0x563a('0x1')]={'name':{'type':Sequelize[_0x563a('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x563a('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x563a('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index ba1f06b..12cf232 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 _0x049e=['map','rawAttributes','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','Tag','includeAll','include','rows','catch','show','params','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','Content-Range','json','reject','save','update','then','Tags','destroy','end','error','stack','name','send','index'];(function(_0x330141,_0x1dd290){var _0x1b68a2=function(_0x4e7f3c){while(--_0x4e7f3c){_0x330141['push'](_0x330141['shift']());}};_0x1b68a2(++_0x1dd290);}(_0x049e,0x16a));var _0xe049=function(_0x2d982d,_0x121028){_0x2d982d=_0x2d982d-0x0;var _0x4f36b0=_0x049e[_0x2d982d];return _0x4f36b0;};'use strict';var emlformat=require(_0xe049('0x0'));var rimraf=require(_0xe049('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe049('0x2'));var rp=require('request-promise');var moment=require(_0xe049('0x3'));var BPromise=require(_0xe049('0x4'));var Mustache=require(_0xe049('0x5'));var util=require(_0xe049('0x6'));var path=require(_0xe049('0x7'));var sox=require('sox');var csv=require(_0xe049('0x8'));var ejs=require(_0xe049('0x9'));var fs=require('fs');var fs_extra=require(_0xe049('0xa'));var _=require(_0xe049('0xb'));var squel=require(_0xe049('0xc'));var crypto=require(_0xe049('0xd'));var jsforce=require(_0xe049('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe049('0x8'));var querystring=require(_0xe049('0xf'));var Papa=require(_0xe049('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe049('0x11'));var as=require(_0xe049('0x12'));var hardwareService=require(_0xe049('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xe049('0x14'));var licenseUtil=require(_0xe049('0x15'));var db=require(_0xe049('0x16'))['db'];function respondWithStatusCode(_0x359931,_0x301c7e){_0x301c7e=_0x301c7e||0xcc;return function(_0x1021e7){if(_0x1021e7){return _0x359931[_0xe049('0x17')](_0x301c7e);}return _0x359931[_0xe049('0x18')](_0x301c7e)['end']();};}function respondWithResult(_0x20c286,_0x3f4a57){_0x3f4a57=_0x3f4a57||0xc8;return function(_0x3924a4){if(_0x3924a4){return _0x20c286[_0xe049('0x18')](_0x3f4a57)['json'](_0x3924a4);}};}function respondWithFilteredResult(_0x3a539b,_0xcc35b6){return function(_0x5c90fd){if(_0x5c90fd){var _0x388be0=typeof _0xcc35b6[_0xe049('0x19')]==='undefined'&&typeof _0xcc35b6[_0xe049('0x1a')]===_0xe049('0x1b');var _0x5d435b=_0x5c90fd[_0xe049('0x1c')];var _0x54c303=_0x388be0?0x0:_0xcc35b6['offset'];var _0x3cbbeb=_0x388be0?_0x5c90fd['count']:_0xcc35b6['offset']+_0xcc35b6[_0xe049('0x1a')];var _0x1092ec;if(_0x3cbbeb>=_0x5d435b){_0x3cbbeb=_0x5d435b;_0x1092ec=0xc8;}else{_0x1092ec=0xce;}_0x3a539b['status'](_0x1092ec);return _0x3a539b['set'](_0xe049('0x1d'),_0x54c303+'-'+_0x3cbbeb+'/'+_0x5d435b)[_0xe049('0x1e')](_0x5c90fd);}return null;};}function patchUpdates(_0x1d2f5b){return function(_0x430421){try{jsonpatch['apply'](_0x430421,_0x1d2f5b,!![]);}catch(_0x572f29){return BPromise[_0xe049('0x1f')](_0x572f29);}return _0x430421[_0xe049('0x20')]();};}function saveUpdates(_0x572a80,_0x36a03b){return function(_0x3f14eb){if(_0x3f14eb){return _0x3f14eb[_0xe049('0x21')](_0x572a80)['then'](function(_0x197358){return _0x197358;});}return null;};}function removeEntity(_0x3b0f54,_0x4c7492){return function(_0x4848c9){if(_0x4848c9){return _0x4848c9['destroy']()[_0xe049('0x22')](function(){var _0x5954c0=_0x4848c9['get']({'plain':!![]});var _0x1aafd1=_0xe049('0x23');return db['UserProfileResource'][_0xe049('0x24')]({'where':{'type':_0x1aafd1,'resourceId':_0x5954c0['id']}})[_0xe049('0x22')](function(){return _0x4848c9;});})[_0xe049('0x22')](function(){_0x3b0f54[_0xe049('0x18')](0xcc)[_0xe049('0x25')]();});}};}function handleEntityNotFound(_0x1843b8,_0x5b0e64){return function(_0x50552d){if(!_0x50552d){_0x1843b8[_0xe049('0x17')](0x194);}return _0x50552d;};}function handleError(_0x542c7c,_0x38ff5b){_0x38ff5b=_0x38ff5b||0x1f4;return function(_0x495d33){logger[_0xe049('0x26')](_0x495d33[_0xe049('0x27')]);if(_0x495d33['name']){delete _0x495d33[_0xe049('0x28')];}_0x542c7c[_0xe049('0x18')](_0x38ff5b)[_0xe049('0x29')](_0x495d33);};}exports[_0xe049('0x2a')]=function(_0x4464b2,_0x4055fc){var _0x123d2e={},_0x44faff={},_0x4038f0={'count':0x0,'rows':[]};var _0x1a4b97=_[_0xe049('0x2b')](db['Tag'][_0xe049('0x2c')],function(_0x1e99c8){return{'name':_0x1e99c8['fieldName'],'type':_0x1e99c8['type']['key']};});_0x44faff['model']=_[_0xe049('0x2b')](_0x1a4b97,_0xe049('0x28'));_0x44faff[_0xe049('0x2d')]=_[_0xe049('0x2e')](_0x4464b2[_0xe049('0x2d')]);_0x44faff['filters']=_[_0xe049('0x2f')](_0x44faff[_0xe049('0x30')],_0x44faff[_0xe049('0x2d')]);_0x123d2e[_0xe049('0x31')]=_[_0xe049('0x2f')](_0x44faff['model'],qs[_0xe049('0x32')](_0x4464b2['query'][_0xe049('0x32')]));_0x123d2e['attributes']=_0x123d2e[_0xe049('0x31')][_0xe049('0x33')]?_0x123d2e[_0xe049('0x31')]:_0x44faff[_0xe049('0x30')];if(!_0x4464b2[_0xe049('0x2d')][_0xe049('0x34')](_0xe049('0x35'))){_0x123d2e[_0xe049('0x1a')]=qs[_0xe049('0x1a')](_0x4464b2[_0xe049('0x2d')][_0xe049('0x1a')]);_0x123d2e['offset']=qs[_0xe049('0x19')](_0x4464b2[_0xe049('0x2d')][_0xe049('0x19')]);}_0x123d2e[_0xe049('0x36')]=qs[_0xe049('0x37')](_0x4464b2[_0xe049('0x2d')][_0xe049('0x37')]);_0x123d2e[_0xe049('0x38')]=qs['filters'](_[_0xe049('0x39')](_0x4464b2[_0xe049('0x2d')],_0x44faff[_0xe049('0x3a')]),_0x1a4b97);if(_0x4464b2[_0xe049('0x2d')][_0xe049('0x3b')]){_0x123d2e[_0xe049('0x38')]=_[_0xe049('0x3c')](_0x123d2e[_0xe049('0x38')],{'$or':_[_0xe049('0x2b')](_0x1a4b97,function(_0x3d6a4b){if(_0x3d6a4b['type']!==_0xe049('0x3d')){var _0x176374={};_0x176374[_0x3d6a4b[_0xe049('0x28')]]={'$like':'%'+_0x4464b2['query'][_0xe049('0x3b')]+'%'};return _0x176374;}})});}_0x123d2e=_['merge']({},_0x123d2e,_0x4464b2['options']);var _0x19dbc4={'where':_0x123d2e['where']};return db[_0xe049('0x3e')][_0xe049('0x1c')](_0x19dbc4)[_0xe049('0x22')](function(_0xe4f184){_0x4038f0[_0xe049('0x1c')]=_0xe4f184;if(_0x4464b2['query'][_0xe049('0x3f')]){_0x123d2e[_0xe049('0x40')]=[{'all':!![]}];}return db['Tag']['findAll'](_0x123d2e);})[_0xe049('0x22')](function(_0x20d264){_0x4038f0[_0xe049('0x41')]=_0x20d264;return _0x4038f0;})[_0xe049('0x22')](respondWithFilteredResult(_0x4055fc,_0x123d2e))[_0xe049('0x42')](handleError(_0x4055fc,null));};exports[_0xe049('0x43')]=function(_0x56a309,_0x1a4707){var _0x3f92ee={'raw':!![],'where':{'id':_0x56a309[_0xe049('0x44')]['id']}},_0x5c04f6={};_0x5c04f6[_0xe049('0x30')]=_[_0xe049('0x2e')](db[_0xe049('0x3e')][_0xe049('0x2c')]);_0x5c04f6['query']=_['keys'](_0x56a309[_0xe049('0x2d')]);_0x5c04f6[_0xe049('0x3a')]=_[_0xe049('0x2f')](_0x5c04f6[_0xe049('0x30')],_0x5c04f6[_0xe049('0x2d')]);_0x3f92ee[_0xe049('0x31')]=_['intersection'](_0x5c04f6[_0xe049('0x30')],qs[_0xe049('0x32')](_0x56a309['query'][_0xe049('0x32')]));_0x3f92ee['attributes']=_0x3f92ee[_0xe049('0x31')]['length']?_0x3f92ee[_0xe049('0x31')]:_0x5c04f6['model'];if(_0x56a309[_0xe049('0x2d')][_0xe049('0x3f')]){_0x3f92ee[_0xe049('0x40')]=[{'all':!![]}];}_0x3f92ee=_[_0xe049('0x3c')]({},_0x3f92ee,_0x56a309[_0xe049('0x45')]);return db['Tag'][_0xe049('0x46')](_0x3f92ee)[_0xe049('0x22')](handleEntityNotFound(_0x1a4707,null))[_0xe049('0x22')](respondWithResult(_0x1a4707,null))[_0xe049('0x42')](handleError(_0x1a4707,null));};exports[_0xe049('0x47')]=function(_0x3c15a2,_0x12f9b8){return db[_0xe049('0x3e')][_0xe049('0x47')](_0x3c15a2['body'],{})['then'](function(_0x478387){var _0xd1beaf=_0x3c15a2[_0xe049('0x48')][_0xe049('0x49')]({'plain':!![]});if(!_0xd1beaf)throw new Error(_0xe049('0x4a'));if(_0xd1beaf[_0xe049('0x4b')]===_0xe049('0x48')){var _0x2e4dce=_0x478387[_0xe049('0x49')]({'plain':!![]});var _0x23da27=_0xe049('0x23');return db['UserProfileSection'][_0xe049('0x46')]({'where':{'name':_0x23da27,'userProfileId':_0xd1beaf[_0xe049('0x4c')]},'raw':!![]})[_0xe049('0x22')](function(_0x4710ae){if(_0x4710ae&&_0x4710ae[_0xe049('0x4d')]===0x0){return db[_0xe049('0x4e')][_0xe049('0x47')]({'name':_0x2e4dce['name'],'resourceId':_0x2e4dce['id'],'type':_0x4710ae['name'],'sectionId':_0x4710ae['id']},{})['then'](function(){return _0x478387;});}else{return _0x478387;}})[_0xe049('0x42')](function(_0x2e508e){logger['error'](_0xe049('0x4f'),_0x2e508e);throw _0x2e508e;});}return _0x478387;})[_0xe049('0x22')](respondWithResult(_0x12f9b8,0xc9))[_0xe049('0x42')](handleError(_0x12f9b8,null));};exports[_0xe049('0x21')]=function(_0x4c3ba3,_0x5b0155){if(_0x4c3ba3[_0xe049('0x50')]['id']){delete _0x4c3ba3[_0xe049('0x50')]['id'];}return db['Tag']['find']({'where':{'id':_0x4c3ba3[_0xe049('0x44')]['id']}})['then'](handleEntityNotFound(_0x5b0155,null))[_0xe049('0x22')](saveUpdates(_0x4c3ba3[_0xe049('0x50')],null))['then'](respondWithResult(_0x5b0155,null))[_0xe049('0x42')](handleError(_0x5b0155,null));};exports['destroy']=function(_0x356605,_0x3ec963){return db['Tag'][_0xe049('0x46')]({'where':{'id':_0x356605[_0xe049('0x44')]['id']}})[_0xe049('0x22')](handleEntityNotFound(_0x3ec963,null))[_0xe049('0x22')](removeEntity(_0x3ec963,null))[_0xe049('0x42')](handleError(_0x3ec963,null));}; \ No newline at end of file +var _0x01fe=['where','filters','pick','filter','merge','options','includeAll','include','catch','show','rawAttributes','length','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','Tags','UserProfileResource','stack','name','send','index','map','Tag','fieldName','type','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort'];(function(_0x2d93d3,_0x51fb8c){var _0x1c252f=function(_0x1a7cd7){while(--_0x1a7cd7){_0x2d93d3['push'](_0x2d93d3['shift']());}};_0x1c252f(++_0x51fb8c);}(_0x01fe,0x102));var _0xe01f=function(_0x167481,_0x1b55b9){_0x167481=_0x167481-0x0;var _0x3424c9=_0x01fe[_0x167481];return _0x3424c9;};'use strict';var emlformat=require(_0xe01f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe01f('0x1'));var jsonpatch=require(_0xe01f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe01f('0x3'));var Mustache=require(_0xe01f('0x4'));var util=require(_0xe01f('0x5'));var path=require(_0xe01f('0x6'));var sox=require('sox');var csv=require(_0xe01f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe01f('0x8'));var _=require(_0xe01f('0x9'));var squel=require(_0xe01f('0xa'));var crypto=require(_0xe01f('0xb'));var jsforce=require(_0xe01f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe01f('0x7'));var querystring=require(_0xe01f('0xd'));var Papa=require('papaparse');var Redis=require(_0xe01f('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe01f('0xf'));var as=require(_0xe01f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe01f('0x11'))('api');var utils=require(_0xe01f('0x12'));var config=require(_0xe01f('0x13'));var licenseUtil=require(_0xe01f('0x14'));var db=require(_0xe01f('0x15'))['db'];function respondWithStatusCode(_0x2d3162,_0x94e3d8){_0x94e3d8=_0x94e3d8||0xcc;return function(_0x81aef3){if(_0x81aef3){return _0x2d3162[_0xe01f('0x16')](_0x94e3d8);}return _0x2d3162['status'](_0x94e3d8)[_0xe01f('0x17')]();};}function respondWithResult(_0x3a9b4b,_0x2d55c8){_0x2d55c8=_0x2d55c8||0xc8;return function(_0x3cb8ac){if(_0x3cb8ac){return _0x3a9b4b[_0xe01f('0x18')](_0x2d55c8)[_0xe01f('0x19')](_0x3cb8ac);}};}function respondWithFilteredResult(_0x664fbb,_0x5e5e30){return function(_0x53d3a1){if(_0x53d3a1){var _0x5e3877=typeof _0x5e5e30[_0xe01f('0x1a')]===_0xe01f('0x1b')&&typeof _0x5e5e30[_0xe01f('0x1c')]===_0xe01f('0x1b');var _0x26cd4c=_0x53d3a1[_0xe01f('0x1d')];var _0x144eef=_0x5e3877?0x0:_0x5e5e30[_0xe01f('0x1a')];var _0x9ee4b5=_0x5e3877?_0x53d3a1[_0xe01f('0x1d')]:_0x5e5e30['offset']+_0x5e5e30[_0xe01f('0x1c')];var _0x5ca305;if(_0x9ee4b5>=_0x26cd4c){_0x9ee4b5=_0x26cd4c;_0x5ca305=0xc8;}else{_0x5ca305=0xce;}_0x664fbb[_0xe01f('0x18')](_0x5ca305);return _0x664fbb[_0xe01f('0x1e')](_0xe01f('0x1f'),_0x144eef+'-'+_0x9ee4b5+'/'+_0x26cd4c)[_0xe01f('0x19')](_0x53d3a1);}return null;};}function patchUpdates(_0x5e9523){return function(_0x32a6b9){try{jsonpatch[_0xe01f('0x20')](_0x32a6b9,_0x5e9523,!![]);}catch(_0xccaf80){return BPromise[_0xe01f('0x21')](_0xccaf80);}return _0x32a6b9[_0xe01f('0x22')]();};}function saveUpdates(_0x3c34fa,_0x570d48){return function(_0x1faeb8){if(_0x1faeb8){return _0x1faeb8[_0xe01f('0x23')](_0x3c34fa)[_0xe01f('0x24')](function(_0xa6da95){return _0xa6da95;});}return null;};}function removeEntity(_0x2480ec,_0x38efcc){return function(_0x1ea55b){if(_0x1ea55b){return _0x1ea55b[_0xe01f('0x25')]()[_0xe01f('0x24')](function(){var _0x4b44b6=_0x1ea55b['get']({'plain':!![]});var _0x3138d3=_0xe01f('0x26');return db[_0xe01f('0x27')][_0xe01f('0x25')]({'where':{'type':_0x3138d3,'resourceId':_0x4b44b6['id']}})['then'](function(){return _0x1ea55b;});})[_0xe01f('0x24')](function(){_0x2480ec[_0xe01f('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x378c93,_0x5b9c5e){return function(_0x1b77c8){if(!_0x1b77c8){_0x378c93[_0xe01f('0x16')](0x194);}return _0x1b77c8;};}function handleError(_0x13dcd4,_0x4b85b8){_0x4b85b8=_0x4b85b8||0x1f4;return function(_0x940cb6){logger['error'](_0x940cb6[_0xe01f('0x28')]);if(_0x940cb6[_0xe01f('0x29')]){delete _0x940cb6[_0xe01f('0x29')];}_0x13dcd4[_0xe01f('0x18')](_0x4b85b8)[_0xe01f('0x2a')](_0x940cb6);};}exports[_0xe01f('0x2b')]=function(_0x11386e,_0x41d13d){var _0x1bdfcf={},_0x590598={},_0x3f725a={'count':0x0,'rows':[]};var _0x4bc3c8=_[_0xe01f('0x2c')](db[_0xe01f('0x2d')]['rawAttributes'],function(_0x15f98f){return{'name':_0x15f98f[_0xe01f('0x2e')],'type':_0x15f98f[_0xe01f('0x2f')]['key']};});_0x590598[_0xe01f('0x30')]=_[_0xe01f('0x2c')](_0x4bc3c8,_0xe01f('0x29'));_0x590598[_0xe01f('0x31')]=_[_0xe01f('0x32')](_0x11386e['query']);_0x590598['filters']=_['intersection'](_0x590598[_0xe01f('0x30')],_0x590598['query']);_0x1bdfcf[_0xe01f('0x33')]=_[_0xe01f('0x34')](_0x590598[_0xe01f('0x30')],qs[_0xe01f('0x35')](_0x11386e[_0xe01f('0x31')][_0xe01f('0x35')]));_0x1bdfcf[_0xe01f('0x33')]=_0x1bdfcf[_0xe01f('0x33')]['length']?_0x1bdfcf['attributes']:_0x590598[_0xe01f('0x30')];if(!_0x11386e[_0xe01f('0x31')][_0xe01f('0x36')](_0xe01f('0x37'))){_0x1bdfcf['limit']=qs[_0xe01f('0x1c')](_0x11386e[_0xe01f('0x31')][_0xe01f('0x1c')]);_0x1bdfcf['offset']=qs[_0xe01f('0x1a')](_0x11386e[_0xe01f('0x31')][_0xe01f('0x1a')]);}_0x1bdfcf[_0xe01f('0x38')]=qs[_0xe01f('0x39')](_0x11386e[_0xe01f('0x31')][_0xe01f('0x39')]);_0x1bdfcf[_0xe01f('0x3a')]=qs[_0xe01f('0x3b')](_[_0xe01f('0x3c')](_0x11386e[_0xe01f('0x31')],_0x590598[_0xe01f('0x3b')]),_0x4bc3c8);if(_0x11386e[_0xe01f('0x31')][_0xe01f('0x3d')]){_0x1bdfcf[_0xe01f('0x3a')]=_['merge'](_0x1bdfcf[_0xe01f('0x3a')],{'$or':_[_0xe01f('0x2c')](_0x4bc3c8,function(_0x1deac7){if(_0x1deac7[_0xe01f('0x2f')]!=='VIRTUAL'){var _0x36783f={};_0x36783f[_0x1deac7[_0xe01f('0x29')]]={'$like':'%'+_0x11386e[_0xe01f('0x31')][_0xe01f('0x3d')]+'%'};return _0x36783f;}})});}_0x1bdfcf=_[_0xe01f('0x3e')]({},_0x1bdfcf,_0x11386e[_0xe01f('0x3f')]);var _0x4fbb62={'where':_0x1bdfcf[_0xe01f('0x3a')]};return db[_0xe01f('0x2d')][_0xe01f('0x1d')](_0x4fbb62)[_0xe01f('0x24')](function(_0x20421f){_0x3f725a[_0xe01f('0x1d')]=_0x20421f;if(_0x11386e[_0xe01f('0x31')][_0xe01f('0x40')]){_0x1bdfcf[_0xe01f('0x41')]=[{'all':!![]}];}return db['Tag']['findAll'](_0x1bdfcf);})[_0xe01f('0x24')](function(_0x50b47){_0x3f725a['rows']=_0x50b47;return _0x3f725a;})[_0xe01f('0x24')](respondWithFilteredResult(_0x41d13d,_0x1bdfcf))[_0xe01f('0x42')](handleError(_0x41d13d,null));};exports[_0xe01f('0x43')]=function(_0x5625d8,_0x2eb993){var _0x2da2e9={'raw':!![],'where':{'id':_0x5625d8['params']['id']}},_0x56785b={};_0x56785b['model']=_[_0xe01f('0x32')](db['Tag'][_0xe01f('0x44')]);_0x56785b['query']=_[_0xe01f('0x32')](_0x5625d8[_0xe01f('0x31')]);_0x56785b[_0xe01f('0x3b')]=_[_0xe01f('0x34')](_0x56785b[_0xe01f('0x30')],_0x56785b[_0xe01f('0x31')]);_0x2da2e9[_0xe01f('0x33')]=_[_0xe01f('0x34')](_0x56785b[_0xe01f('0x30')],qs[_0xe01f('0x35')](_0x5625d8[_0xe01f('0x31')]['fields']));_0x2da2e9[_0xe01f('0x33')]=_0x2da2e9[_0xe01f('0x33')][_0xe01f('0x45')]?_0x2da2e9[_0xe01f('0x33')]:_0x56785b[_0xe01f('0x30')];if(_0x5625d8['query'][_0xe01f('0x40')]){_0x2da2e9['include']=[{'all':!![]}];}_0x2da2e9=_['merge']({},_0x2da2e9,_0x5625d8[_0xe01f('0x3f')]);return db[_0xe01f('0x2d')][_0xe01f('0x46')](_0x2da2e9)[_0xe01f('0x24')](handleEntityNotFound(_0x2eb993,null))[_0xe01f('0x24')](respondWithResult(_0x2eb993,null))['catch'](handleError(_0x2eb993,null));};exports[_0xe01f('0x47')]=function(_0x337c5d,_0x3bb3b7){return db[_0xe01f('0x2d')][_0xe01f('0x47')](_0x337c5d[_0xe01f('0x48')],{})[_0xe01f('0x24')](function(_0x5a511c){var _0x3f4ae0=_0x337c5d['user'][_0xe01f('0x49')]({'plain':!![]});if(!_0x3f4ae0)throw new Error(_0xe01f('0x4a'));if(_0x3f4ae0['role']===_0xe01f('0x4b')){var _0x100742=_0x5a511c[_0xe01f('0x49')]({'plain':!![]});var _0xea4320=_0xe01f('0x26');return db[_0xe01f('0x4c')]['find']({'where':{'name':_0xea4320,'userProfileId':_0x3f4ae0['userProfileId']},'raw':!![]})[_0xe01f('0x24')](function(_0x216f69){if(_0x216f69&&_0x216f69['autoAssociation']===0x0){return db[_0xe01f('0x27')][_0xe01f('0x47')]({'name':_0x100742[_0xe01f('0x29')],'resourceId':_0x100742['id'],'type':_0x216f69[_0xe01f('0x29')],'sectionId':_0x216f69['id']},{})[_0xe01f('0x24')](function(){return _0x5a511c;});}else{return _0x5a511c;}})[_0xe01f('0x42')](function(_0x4ffa43){logger[_0xe01f('0x4d')](_0xe01f('0x4e'),_0x4ffa43);throw _0x4ffa43;});}return _0x5a511c;})['then'](respondWithResult(_0x3bb3b7,0xc9))[_0xe01f('0x42')](handleError(_0x3bb3b7,null));};exports[_0xe01f('0x23')]=function(_0x33b9a8,_0x47089f){if(_0x33b9a8[_0xe01f('0x48')]['id']){delete _0x33b9a8[_0xe01f('0x48')]['id'];}return db['Tag'][_0xe01f('0x46')]({'where':{'id':_0x33b9a8['params']['id']}})['then'](handleEntityNotFound(_0x47089f,null))[_0xe01f('0x24')](saveUpdates(_0x33b9a8[_0xe01f('0x48')],null))[_0xe01f('0x24')](respondWithResult(_0x47089f,null))[_0xe01f('0x42')](handleError(_0x47089f,null));};exports[_0xe01f('0x25')]=function(_0x3b0ab1,_0x3949e1){return db[_0xe01f('0x2d')]['find']({'where':{'id':_0x3b0ab1['params']['id']}})[_0xe01f('0x24')](handleEntityNotFound(_0x3949e1,null))['then'](removeEntity(_0x3949e1,null))[_0xe01f('0x42')](handleError(_0x3949e1,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 3e5a352..af3642f 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 _0xa490=['request-promise','rimraf','../../config/environment','./tag.attributes','exports','define','tools_tags','lodash','util','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa490,0x11b));var _0x0a49=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa490[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x0a49('0x0'));var util=require(_0x0a49('0x1'));var logger=require(_0x0a49('0x2'))(_0x0a49('0x3'));var moment=require(_0x0a49('0x4'));var BPromise=require('bluebird');var rp=require(_0x0a49('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0a49('0x6'));var config=require(_0x0a49('0x7'));var attributes=require(_0x0a49('0x8'));module[_0x0a49('0x9')]=function(_0x515bd0,_0xd3340e){return _0x515bd0[_0x0a49('0xa')]('Tag',attributes,{'tableName':_0x0a49('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3449=['request-promise','rimraf','../../config/environment','exports','tools_tags','lodash','util','../../config/logger','moment','bluebird'];(function(_0x4d281f,_0x55e16f){var _0xd9b390=function(_0x53d5e9){while(--_0x53d5e9){_0x4d281f['push'](_0x4d281f['shift']());}};_0xd9b390(++_0x55e16f);}(_0x3449,0x11d));var _0x9344=function(_0x5c3822,_0x1ef1b1){_0x5c3822=_0x5c3822-0x0;var _0x5baa30=_0x3449[_0x5c3822];return _0x5baa30;};'use strict';var _=require(_0x9344('0x0'));var util=require(_0x9344('0x1'));var logger=require(_0x9344('0x2'))('api');var moment=require(_0x9344('0x3'));var BPromise=require(_0x9344('0x4'));var rp=require(_0x9344('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9344('0x6'));var config=require(_0x9344('0x7'));var attributes=require('./tag.attributes');module[_0x9344('0x8')]=function(_0x285f1c,_0x949a6f){return _0x285f1c['define']('Tag',attributes,{'tableName':_0x9344('0x9'),'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 b868863..78b18ca 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 _0x84ab=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then','info','Tag,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x1c17e3,_0x5995b9){var _0x54a18b=function(_0x201d78){while(--_0x201d78){_0x1c17e3['push'](_0x1c17e3['shift']());}};_0x54a18b(++_0x5995b9);}(_0x84ab,0x12f));var _0xb84a=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x84ab[_0x1beef3];return _0x5af964;};'use strict';var _=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var moment=require(_0xb84a('0x2'));var BPromise=require(_0xb84a('0x3'));var rs=require(_0xb84a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb84a('0x5'))['db'];var utils=require(_0xb84a('0x6'));var logger=require('../../config/logger')(_0xb84a('0x7'));var config=require(_0xb84a('0x8'));var jayson=require(_0xb84a('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4dc496,_0xd445b5,_0x4fac4d){return new BPromise(function(_0x3e9086,_0x8d9dbe){return client['request'](_0x4dc496,_0x4fac4d)[_0xb84a('0xa')](function(_0x525cb7){logger[_0xb84a('0xb')](_0xb84a('0xc'),_0xd445b5,_0xb84a('0xd'));logger['debug']('Tag,\x20%s,\x20%s,\x20%s',_0xd445b5,'request\x20sent',JSON[_0xb84a('0xe')](_0x525cb7));if(_0x525cb7[_0xb84a('0xf')]){if(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x10')]===0x1f4){logger[_0xb84a('0xf')]('Tag,\x20%s,\x20%s',_0xd445b5,_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);return _0x8d9dbe(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);}logger[_0xb84a('0xf')](_0xb84a('0xc'),_0xd445b5,_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);return _0x3e9086(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);}else{logger[_0xb84a('0xb')](_0xb84a('0xc'),_0xd445b5,'request\x20sent');_0x3e9086(_0x525cb7[_0xb84a('0x12')][_0xb84a('0x11')]);}})[_0xb84a('0x13')](function(_0x3c0b54){logger[_0xb84a('0xf')](_0xb84a('0xc'),_0xd445b5,_0x3c0b54);_0x8d9dbe(_0x3c0b54);});});} \ No newline at end of file +var _0x4c4e=['result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x509e8f,_0x4dab0b){var _0x48f572=function(_0x3e7fe8){while(--_0x3e7fe8){_0x509e8f['push'](_0x509e8f['shift']());}};_0x48f572(++_0x4dab0b);}(_0x4c4e,0x152));var _0xe4c4=function(_0x38839d,_0x22a75c){_0x38839d=_0x38839d-0x0;var _0x210d23=_0x4c4e[_0x38839d];return _0x210d23;};'use strict';var _=require(_0xe4c4('0x0'));var util=require('util');var moment=require(_0xe4c4('0x1'));var BPromise=require(_0xe4c4('0x2'));var rs=require(_0xe4c4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe4c4('0x4'))['db'];var utils=require(_0xe4c4('0x5'));var logger=require(_0xe4c4('0x6'))('rpc');var config=require(_0xe4c4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe4c4('0x8')][_0xe4c4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x262b64,_0xad105,_0x22085a){return new BPromise(function(_0x329d29,_0x28a42e){return client[_0xe4c4('0xa')](_0x262b64,_0x22085a)['then'](function(_0x589b2e){logger[_0xe4c4('0xb')](_0xe4c4('0xc'),_0xad105,_0xe4c4('0xd'));logger[_0xe4c4('0xe')](_0xe4c4('0xf'),_0xad105,_0xe4c4('0xd'),JSON['stringify'](_0x589b2e));if(_0x589b2e[_0xe4c4('0x10')]){if(_0x589b2e[_0xe4c4('0x10')][_0xe4c4('0x11')]===0x1f4){logger[_0xe4c4('0x10')]('Tag,\x20%s,\x20%s',_0xad105,_0x589b2e[_0xe4c4('0x10')][_0xe4c4('0x12')]);return _0x28a42e(_0x589b2e['error'][_0xe4c4('0x12')]);}logger[_0xe4c4('0x10')]('Tag,\x20%s,\x20%s',_0xad105,_0x589b2e[_0xe4c4('0x10')][_0xe4c4('0x12')]);return _0x329d29(_0x589b2e['error'][_0xe4c4('0x12')]);}else{logger[_0xe4c4('0xb')](_0xe4c4('0xc'),_0xad105,_0xe4c4('0xd'));_0x329d29(_0x589b2e[_0xe4c4('0x13')][_0xe4c4('0x12')]);}})[_0xe4c4('0x14')](function(_0x1038cb){logger[_0xe4c4('0x10')](_0xe4c4('0xc'),_0xad105,_0x1038cb);_0x28a42e(_0x1038cb);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 50e18f6..ceb3221 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(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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 113fee3..fc21d43 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 _0x757a=['exports','STRING'];(function(_0x13b110,_0xaed0f2){var _0xd52387=function(_0x204138){while(--_0x204138){_0x13b110['push'](_0x13b110['shift']());}};_0xd52387(++_0xaed0f2);}(_0x757a,0xde));var _0xa757=function(_0x123ec9,_0x21a322){_0x123ec9=_0x123ec9-0x0;var _0x4a3146=_0x757a[_0x123ec9];return _0x4a3146;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2032=['name','exports','STRING'];(function(_0x3a04f1,_0x3fd8c5){var _0x33f24e=function(_0x17c3ca){while(--_0x17c3ca){_0x3a04f1['push'](_0x3a04f1['shift']());}};_0x33f24e(++_0x3fd8c5);}(_0x2032,0xd9));var _0x2203=function(_0x2c5c6c,_0x2410cf){_0x2c5c6c=_0x2c5c6c-0x0;var _0x447785=_0x2032[_0x2c5c6c];return _0x447785;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'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 73e876a..73d1870 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 _0xbb73=['../../config/logger','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./team.socket','sendStatus','end','status','undefined','limit','count','offset','set','json','apply','reject','save','update','then','error','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','Team','findAll','catch','show','params','keys','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Teams','UserProfileSection','autoAssociation','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','UserVoiceQueue','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','destroy','SELECT','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','TeamVoicePrefix','VoicePrefixId','UserProfileResource','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','addQueues','add','Queues','removeQueues','remove','ids','addAgents','Voice','Chat','Sms','Fax','Whatsapp','transaction','through','defaults','penalty','Queue','findOrCreate','emit','Queue:save','User','online','voicePause','UserVoiceQueueRt','isNil','interface','format','SIP/%s','TeamVoiceQueue','all','UserVoicePrefix','upsert','spread','removeAgents','isArray','Mail','Openchannel','getAgents','nolimit','eml-format','rimraf','zip-dir','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis'];(function(_0x4cd14a,_0x3c08b4){var _0x59ac6a=function(_0x5d95ec){while(--_0x5d95ec){_0x4cd14a['push'](_0x4cd14a['shift']());}};_0x59ac6a(++_0x3c08b4);}(_0xbb73,0x1b8));var _0x3bb7=function(_0x5aac5d,_0x17ec74){_0x5aac5d=_0x5aac5d-0x0;var _0xc8395=_0xbb73[_0x5aac5d];return _0xc8395;};'use strict';var emlformat=require(_0x3bb7('0x0'));var rimraf=require(_0x3bb7('0x1'));var zipdir=require(_0x3bb7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3bb7('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3bb7('0x4'));var util=require('util');var path=require(_0x3bb7('0x5'));var sox=require(_0x3bb7('0x6'));var csv=require(_0x3bb7('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3bb7('0x8'));var _=require(_0x3bb7('0x9'));var squel=require(_0x3bb7('0xa'));var crypto=require(_0x3bb7('0xb'));var jsforce=require(_0x3bb7('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3bb7('0x7'));var querystring=require(_0x3bb7('0xd'));var Papa=require(_0x3bb7('0xe'));var Redis=require(_0x3bb7('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(_0x3bb7('0x10'))('api');var utils=require(_0x3bb7('0x11'));var config=require(_0x3bb7('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x3bb7('0x13')]=_['defaults'](config[_0x3bb7('0x13')],{'host':_0x3bb7('0x14'),'port':0x18eb});var socket=require(_0x3bb7('0x15'))(new Redis(config[_0x3bb7('0x13')]));require(_0x3bb7('0x16'))['register'](socket);function respondWithStatusCode(_0x4a04db,_0x352638){_0x352638=_0x352638||0xcc;return function(_0x25bb2a){if(_0x25bb2a){return _0x4a04db[_0x3bb7('0x17')](_0x352638);}return _0x4a04db['status'](_0x352638)[_0x3bb7('0x18')]();};}function respondWithResult(_0x3db494,_0x5b7016){_0x5b7016=_0x5b7016||0xc8;return function(_0xe54fb9){if(_0xe54fb9){return _0x3db494[_0x3bb7('0x19')](_0x5b7016)['json'](_0xe54fb9);}};}function respondWithFilteredResult(_0x564855,_0x844240){return function(_0x117281){if(_0x117281){var _0x5a9df0=typeof _0x844240['offset']===_0x3bb7('0x1a')&&typeof _0x844240[_0x3bb7('0x1b')]===_0x3bb7('0x1a');var _0x22f4bf=_0x117281[_0x3bb7('0x1c')];var _0x227605=_0x5a9df0?0x0:_0x844240[_0x3bb7('0x1d')];var _0x13c3d0=_0x5a9df0?_0x117281['count']:_0x844240[_0x3bb7('0x1d')]+_0x844240['limit'];var _0x1504e5;if(_0x13c3d0>=_0x22f4bf){_0x13c3d0=_0x22f4bf;_0x1504e5=0xc8;}else{_0x1504e5=0xce;}_0x564855[_0x3bb7('0x19')](_0x1504e5);return _0x564855[_0x3bb7('0x1e')]('Content-Range',_0x227605+'-'+_0x13c3d0+'/'+_0x22f4bf)[_0x3bb7('0x1f')](_0x117281);}return null;};}function patchUpdates(_0x599a7a){return function(_0x25f2f5){try{jsonpatch[_0x3bb7('0x20')](_0x25f2f5,_0x599a7a,!![]);}catch(_0x502460){return BPromise[_0x3bb7('0x21')](_0x502460);}return _0x25f2f5[_0x3bb7('0x22')]();};}function saveUpdates(_0x5d2eab,_0xdc1804){return function(_0x300ee6){if(_0x300ee6){return _0x300ee6[_0x3bb7('0x23')](_0x5d2eab)[_0x3bb7('0x24')](function(_0x30bf30){return _0x30bf30;});}return null;};}function handleEntityNotFound(_0xedbdff,_0x224bd6){return function(_0x44ecb4){if(!_0x44ecb4){_0xedbdff['sendStatus'](0x194);}return _0x44ecb4;};}function handleError(_0x25d312,_0x21f285){_0x21f285=_0x21f285||0x1f4;return function(_0xb06d70){logger[_0x3bb7('0x25')](_0xb06d70[_0x3bb7('0x26')]);if(_0xb06d70[_0x3bb7('0x27')]){delete _0xb06d70[_0x3bb7('0x27')];}_0x25d312[_0x3bb7('0x19')](_0x21f285)[_0x3bb7('0x28')](_0xb06d70);};}exports['index']=function(_0xda1a4d,_0x143a8d){var _0x179945={},_0x380465={},_0x304da6={'count':0x0,'rows':[]};var _0x142d84=_['map'](db['Team'][_0x3bb7('0x29')],function(_0x40882d){return{'name':_0x40882d[_0x3bb7('0x2a')],'type':_0x40882d[_0x3bb7('0x2b')][_0x3bb7('0x2c')]};});_0x380465[_0x3bb7('0x2d')]=_[_0x3bb7('0x2e')](_0x142d84,_0x3bb7('0x27'));_0x380465[_0x3bb7('0x2f')]=_['keys'](_0xda1a4d['query']);_0x380465[_0x3bb7('0x30')]=_['intersection'](_0x380465[_0x3bb7('0x2d')],_0x380465['query']);_0x179945[_0x3bb7('0x31')]=_[_0x3bb7('0x32')](_0x380465[_0x3bb7('0x2d')],qs[_0x3bb7('0x33')](_0xda1a4d[_0x3bb7('0x2f')][_0x3bb7('0x33')]));_0x179945['attributes']=_0x179945[_0x3bb7('0x31')]['length']?_0x179945[_0x3bb7('0x31')]:_0x380465[_0x3bb7('0x2d')];if(!_0xda1a4d[_0x3bb7('0x2f')][_0x3bb7('0x34')]('nolimit')){_0x179945['limit']=qs[_0x3bb7('0x1b')](_0xda1a4d[_0x3bb7('0x2f')]['limit']);_0x179945[_0x3bb7('0x1d')]=qs[_0x3bb7('0x1d')](_0xda1a4d['query']['offset']);}_0x179945[_0x3bb7('0x35')]=qs['sort'](_0xda1a4d[_0x3bb7('0x2f')][_0x3bb7('0x36')]);_0x179945[_0x3bb7('0x37')]=qs[_0x3bb7('0x30')](_[_0x3bb7('0x38')](_0xda1a4d[_0x3bb7('0x2f')],_0x380465[_0x3bb7('0x30')]),_0x142d84);if(_0xda1a4d[_0x3bb7('0x2f')][_0x3bb7('0x39')]){_0x179945['where']=_[_0x3bb7('0x3a')](_0x179945[_0x3bb7('0x37')],{'$or':_['map'](_0x142d84,function(_0x5d863c){if(_0x5d863c['type']!==_0x3bb7('0x3b')){var _0x1a3383={};_0x1a3383[_0x5d863c[_0x3bb7('0x27')]]={'$like':'%'+_0xda1a4d[_0x3bb7('0x2f')]['filter']+'%'};return _0x1a3383;}})});}_0x179945=_['merge']({},_0x179945,_0xda1a4d[_0x3bb7('0x3c')]);var _0x520f41={'where':_0x179945[_0x3bb7('0x37')]};return db['Team']['count'](_0x520f41)['then'](function(_0x2f0495){_0x304da6['count']=_0x2f0495;if(_0xda1a4d['query'][_0x3bb7('0x3d')]){_0x179945['include']=[{'all':!![]}];}return db[_0x3bb7('0x3e')][_0x3bb7('0x3f')](_0x179945);})[_0x3bb7('0x24')](function(_0x57a499){_0x304da6['rows']=_0x57a499;return _0x304da6;})[_0x3bb7('0x24')](respondWithFilteredResult(_0x143a8d,_0x179945))[_0x3bb7('0x40')](handleError(_0x143a8d,null));};exports[_0x3bb7('0x41')]=function(_0x2155d9,_0x54d222){var _0x4a94ad={'raw':![],'where':{'id':_0x2155d9[_0x3bb7('0x42')]['id']}},_0x3f8f8b={};_0x3f8f8b[_0x3bb7('0x2d')]=_['keys'](db[_0x3bb7('0x3e')][_0x3bb7('0x29')]);_0x3f8f8b[_0x3bb7('0x2f')]=_[_0x3bb7('0x43')](_0x2155d9[_0x3bb7('0x2f')]);_0x3f8f8b[_0x3bb7('0x30')]=_[_0x3bb7('0x32')](_0x3f8f8b[_0x3bb7('0x2d')],_0x3f8f8b[_0x3bb7('0x2f')]);_0x4a94ad['attributes']=_[_0x3bb7('0x32')](_0x3f8f8b[_0x3bb7('0x2d')],qs['fields'](_0x2155d9[_0x3bb7('0x2f')][_0x3bb7('0x33')]));_0x4a94ad[_0x3bb7('0x31')]=_0x4a94ad[_0x3bb7('0x31')][_0x3bb7('0x44')]?_0x4a94ad[_0x3bb7('0x31')]:_0x3f8f8b['model'];if(_0x2155d9[_0x3bb7('0x2f')][_0x3bb7('0x3d')]){_0x4a94ad['include']=[{'all':!![]}];}_0x4a94ad=_[_0x3bb7('0x3a')]({},_0x4a94ad,_0x2155d9[_0x3bb7('0x3c')]);return db[_0x3bb7('0x3e')][_0x3bb7('0x45')](_0x4a94ad)[_0x3bb7('0x24')](handleEntityNotFound(_0x54d222,null))[_0x3bb7('0x24')](respondWithResult(_0x54d222,null))[_0x3bb7('0x40')](handleError(_0x54d222,null));};exports[_0x3bb7('0x46')]=function(_0x3ea931,_0x249ef9){return db[_0x3bb7('0x3e')][_0x3bb7('0x46')](_0x3ea931[_0x3bb7('0x47')],{})[_0x3bb7('0x24')](function(_0xb39978){var _0x23f7d2=_0x3ea931[_0x3bb7('0x48')][_0x3bb7('0x49')]({'plain':!![]});if(!_0x23f7d2)throw new Error(_0x3bb7('0x4a'));if(_0x23f7d2['role']===_0x3bb7('0x48')){var _0x5ea97f=_0xb39978[_0x3bb7('0x49')]({'plain':!![]});var _0x38b2f9=_0x3bb7('0x4b');return db[_0x3bb7('0x4c')][_0x3bb7('0x45')]({'where':{'name':_0x38b2f9,'userProfileId':_0x23f7d2['userProfileId']},'raw':!![]})[_0x3bb7('0x24')](function(_0x34746f){if(_0x34746f&&_0x34746f[_0x3bb7('0x4d')]===0x0){return db['UserProfileResource'][_0x3bb7('0x46')]({'name':_0x5ea97f[_0x3bb7('0x27')],'resourceId':_0x5ea97f['id'],'type':_0x34746f[_0x3bb7('0x27')],'sectionId':_0x34746f['id']},{})[_0x3bb7('0x24')](function(){return _0xb39978;});}else{return _0xb39978;}})[_0x3bb7('0x40')](function(_0x294499){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x294499);throw _0x294499;});}return _0xb39978;})[_0x3bb7('0x24')](respondWithResult(_0x249ef9,0xc9))[_0x3bb7('0x40')](handleError(_0x249ef9,null));};exports[_0x3bb7('0x23')]=function(_0x38685d,_0x493808){if(_0x38685d['body']['id']){delete _0x38685d[_0x3bb7('0x47')]['id'];}return db[_0x3bb7('0x3e')][_0x3bb7('0x45')]({'where':{'id':_0x38685d[_0x3bb7('0x42')]['id']}})['then'](handleEntityNotFound(_0x493808,null))['then'](saveUpdates(_0x38685d[_0x3bb7('0x47')],null))[_0x3bb7('0x24')](respondWithResult(_0x493808,null))[_0x3bb7('0x40')](handleError(_0x493808,null));};exports['destroy']=function(_0x49d0b7,_0x13884a){var _0x4f310c=_0x49d0b7[_0x3bb7('0x42')]['id'];var _0x1573d6=[];return db[_0x3bb7('0x4e')]['transaction'](function(_0x4b34de){var _0x2d178d=_0x3bb7('0x4f')+_0x4f310c;return db['sequelize'][_0x3bb7('0x2f')](_0x2d178d,{'type':db[_0x3bb7('0x50')][_0x3bb7('0x51')]['SELECT'],'raw':!![],'transaction':_0x4b34de})[_0x3bb7('0x24')](function(_0x12e65c){_0x1573d6=_[_0x3bb7('0x2e')](_0x12e65c,function(_0x18f8b0){return Number(_0x18f8b0[_0x3bb7('0x52')]);});})[_0x3bb7('0x24')](function(){var _0x5db2b7=_0x3bb7('0x53')+_0x4f310c;return db[_0x3bb7('0x4e')][_0x3bb7('0x2f')](_0x5db2b7,{'type':db[_0x3bb7('0x50')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x4b34de});})[_0x3bb7('0x24')](function(_0x81f704){var _0xd199ab=_[_0x3bb7('0x2e')](_0x81f704,function(_0x1a13e3){return Number(_0x1a13e3['VoiceQueueId']);});return db[_0x3bb7('0x54')]['destroy']({'where':{'UserId':{'$in':_0x1573d6},'VoiceQueueId':{'$in':_0xd199ab}},'transaction':_0x4b34de});})[_0x3bb7('0x24')](function(){var _0x34fcc2='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x4f310c;return db[_0x3bb7('0x4e')][_0x3bb7('0x2f')](_0x34fcc2,{'type':db[_0x3bb7('0x50')][_0x3bb7('0x51')]['SELECT'],'raw':!![],'transaction':_0x4b34de});})[_0x3bb7('0x24')](function(_0x2defa9){var _0xbae0a7=_[_0x3bb7('0x2e')](_0x2defa9,function(_0x40cc76){return Number(_0x40cc76[_0x3bb7('0x55')]);});return db[_0x3bb7('0x56')]['destroy']({'where':{'UserId':{'$in':_0x1573d6},'MailQueueId':{'$in':_0xbae0a7}},'transaction':_0x4b34de});})[_0x3bb7('0x24')](function(){var _0x15533b=_0x3bb7('0x57')+_0x4f310c;return db[_0x3bb7('0x4e')][_0x3bb7('0x2f')](_0x15533b,{'type':db[_0x3bb7('0x50')][_0x3bb7('0x51')]['SELECT'],'raw':!![],'transaction':_0x4b34de});})[_0x3bb7('0x24')](function(_0x1c5e76){var _0x4ba362=_[_0x3bb7('0x2e')](_0x1c5e76,function(_0x7164d2){return Number(_0x7164d2[_0x3bb7('0x58')]);});return db[_0x3bb7('0x59')][_0x3bb7('0x5a')]({'where':{'UserId':{'$in':_0x1573d6},'SmsQueueId':{'$in':_0x4ba362}},'transaction':_0x4b34de});})['then'](function(){var _0x2c6e0d='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x4f310c;return db[_0x3bb7('0x4e')][_0x3bb7('0x2f')](_0x2c6e0d,{'type':db[_0x3bb7('0x50')][_0x3bb7('0x51')][_0x3bb7('0x5b')],'raw':!![],'transaction':_0x4b34de});})['then'](function(_0x4c3140){var _0x88334e=_[_0x3bb7('0x2e')](_0x4c3140,function(_0xcf3eb8){return Number(_0xcf3eb8[_0x3bb7('0x5c')]);});return db[_0x3bb7('0x5d')][_0x3bb7('0x5a')]({'where':{'UserId':{'$in':_0x1573d6},'ChatQueueId':{'$in':_0x88334e}},'transaction':_0x4b34de});})['then'](function(){var _0x40b7e0=_0x3bb7('0x5e')+_0x4f310c;return db[_0x3bb7('0x4e')]['query'](_0x40b7e0,{'type':db[_0x3bb7('0x50')][_0x3bb7('0x51')][_0x3bb7('0x5b')],'raw':!![],'transaction':_0x4b34de});})[_0x3bb7('0x24')](function(_0xb8b5a6){var _0x434e8b=_['map'](_0xb8b5a6,function(_0x4d4784){return Number(_0x4d4784[_0x3bb7('0x5f')]);});return db[_0x3bb7('0x60')][_0x3bb7('0x5a')]({'where':{'UserId':{'$in':_0x1573d6},'FaxQueueId':{'$in':_0x434e8b}},'transaction':_0x4b34de});})['then'](function(){var _0x4689c9=_0x3bb7('0x61')+_0x4f310c;return db[_0x3bb7('0x4e')][_0x3bb7('0x2f')](_0x4689c9,{'type':db[_0x3bb7('0x50')][_0x3bb7('0x51')][_0x3bb7('0x5b')],'raw':!![],'transaction':_0x4b34de});})[_0x3bb7('0x24')](function(_0x320908){var _0x22ec97=_[_0x3bb7('0x2e')](_0x320908,function(_0xb78bde){return Number(_0xb78bde[_0x3bb7('0x62')]);});return db[_0x3bb7('0x63')][_0x3bb7('0x5a')]({'where':{'UserId':{'$in':_0x1573d6},'OpenchannelQueueId':{'$in':_0x22ec97}},'transaction':_0x4b34de});})[_0x3bb7('0x24')](function(){var _0x32e83d=_0x3bb7('0x64')+_0x4f310c;return db[_0x3bb7('0x4e')][_0x3bb7('0x2f')](_0x32e83d,{'type':db[_0x3bb7('0x50')][_0x3bb7('0x51')][_0x3bb7('0x5b')],'raw':!![],'transaction':_0x4b34de});})['then'](function(_0x5761c5){var _0x4f57d4=_[_0x3bb7('0x2e')](_0x5761c5,function(_0x24f9ac){return Number(_0x24f9ac['WhatsappQueueId']);});return db[_0x3bb7('0x65')][_0x3bb7('0x5a')]({'where':{'UserId':{'$in':_0x1573d6},'WhatsappQueueId':{'$in':_0x4f57d4}},'transaction':_0x4b34de});})[_0x3bb7('0x24')](function(){return db[_0x3bb7('0x66')][_0x3bb7('0x45')]({'where':{'TeamId':_0x4f310c}});})[_0x3bb7('0x24')](function(_0x4f13c5){if(_0x4f13c5===null){return;}return db['UserVoicePrefix'][_0x3bb7('0x5a')]({'where':{'UserId':{'$in':_0x1573d6},'VoicePrefixId':_0x4f13c5[_0x3bb7('0x67')]},'transaction':_0x4b34de});})['then'](function(){return db['Team']['destroy']({'where':{'id':_0x4f310c},'cascade':!![],'transaction':_0x4b34de});})[_0x3bb7('0x24')](function(_0x5dfe2a){if(_0x5dfe2a===0x0){_0x13884a['sendStatus'](0x194);}else{return db[_0x3bb7('0x68')][_0x3bb7('0x5a')]({'where':{'type':_0x3bb7('0x4b'),'resourceId':_0x4f310c},'cascade':!![],'transaction':_0x4b34de})[_0x3bb7('0x24')](function(){_0x13884a[_0x3bb7('0x19')](0xcc)[_0x3bb7('0x18')]();});}})[_0x3bb7('0x40')](function(_0x1d5985){_0x13884a[_0x3bb7('0x19')](0x1f4)[_0x3bb7('0x28')](_0x1d5985);});});};exports[_0x3bb7('0x69')]=function(_0x577bf5,_0x1b4f52,_0x545b47){return db[_0x3bb7('0x3e')][_0x3bb7('0x6a')]({'where':{'id':_0x577bf5['params']['id']}})[_0x3bb7('0x24')](handleEntityNotFound(_0x1b4f52,null))[_0x3bb7('0x24')](function(_0x13649d){if(!_0x577bf5[_0x3bb7('0x2f')][_0x3bb7('0x6b')]||!utils[_0x3bb7('0x6c')](_0x577bf5[_0x3bb7('0x2f')][_0x3bb7('0x6b')])){throw new db[(_0x3bb7('0x50'))][(_0x3bb7('0x6d'))](_0x3bb7('0x6e'));}var _0x173c97={};var _0x422265={};_0x422265[_0x3bb7('0x2d')]=_[_0x3bb7('0x43')](db[_[_0x3bb7('0x6f')](_0x577bf5[_0x3bb7('0x2f')][_0x3bb7('0x6b')][_0x3bb7('0x70')]())+'Queue'][_0x3bb7('0x29')]);_0x422265[_0x3bb7('0x2f')]=_['keys'](_0x577bf5[_0x3bb7('0x2f')]);_0x422265[_0x3bb7('0x30')]=_[_0x3bb7('0x32')](_0x422265[_0x3bb7('0x2d')],_0x422265[_0x3bb7('0x2f')]);_0x173c97[_0x3bb7('0x31')]=_[_0x3bb7('0x32')](_0x422265['model'],qs[_0x3bb7('0x33')](_0x577bf5[_0x3bb7('0x2f')][_0x3bb7('0x33')]));_0x173c97[_0x3bb7('0x31')]=_0x173c97['attributes'][_0x3bb7('0x44')]?_0x173c97[_0x3bb7('0x31')]:_0x422265[_0x3bb7('0x2d')];_0x173c97[_0x3bb7('0x1b')]=qs[_0x3bb7('0x1b')](_0x577bf5['query'][_0x3bb7('0x1b')]);_0x173c97[_0x3bb7('0x1d')]=qs['offset'](_0x577bf5['query'][_0x3bb7('0x1d')]);_0x173c97['order']=qs[_0x3bb7('0x36')](_0x577bf5[_0x3bb7('0x2f')][_0x3bb7('0x36')]);_0x173c97['where']=qs[_0x3bb7('0x30')](_[_0x3bb7('0x38')](_0x577bf5['query'],_0x422265[_0x3bb7('0x30')]));_0x173c97=_[_0x3bb7('0x3a')]({},_0x173c97,_0x577bf5['options']);return _0x13649d[_0x3bb7('0x49')+_[_0x3bb7('0x6f')](_0x577bf5[_0x3bb7('0x2f')]['channel']['toLowerCase']())+'Queues'](_0x173c97);})[_0x3bb7('0x24')](respondWithResult(_0x1b4f52,null))[_0x3bb7('0x40')](handleError(_0x1b4f52,null));};exports[_0x3bb7('0x71')]=function(_0x36c7f2,_0x25534a,_0x48f0f9){return db[_0x3bb7('0x3e')][_0x3bb7('0x6a')]({'where':{'id':_0x36c7f2[_0x3bb7('0x42')]['id']}})[_0x3bb7('0x24')](function(_0x1e819f){if(_0x1e819f){if(!_0x36c7f2[_0x3bb7('0x47')]['channel']||!utils[_0x3bb7('0x6c')](_0x36c7f2['body'][_0x3bb7('0x6b')])){throw new db['Sequelize'][(_0x3bb7('0x6d'))](_0x3bb7('0x6e'));}return _0x1e819f[_0x3bb7('0x72')+_[_0x3bb7('0x6f')](_0x36c7f2['body'][_0x3bb7('0x6b')][_0x3bb7('0x70')]())+_0x3bb7('0x73')](_0x36c7f2[_0x3bb7('0x47')]['ids']);}return null;})[_0x3bb7('0x24')](handleEntityNotFound(_0x25534a,null))[_0x3bb7('0x24')](respondWithStatusCode(_0x25534a,null))[_0x3bb7('0x40')](handleError(_0x25534a,null));};exports[_0x3bb7('0x74')]=function(_0x1f3849,_0x1de62e,_0x1787ce){return db[_0x3bb7('0x3e')]['findOne']({'where':{'id':_0x1f3849[_0x3bb7('0x42')]['id']}})[_0x3bb7('0x24')](function(_0x31cf60){if(_0x31cf60){if(!_0x1f3849[_0x3bb7('0x2f')][_0x3bb7('0x6b')]||!utils['isValidChannel'](_0x1f3849[_0x3bb7('0x2f')]['channel'])){throw new db['Sequelize'][(_0x3bb7('0x6d'))]('Unknown\x20channel');}return _0x31cf60[_0x3bb7('0x75')+_[_0x3bb7('0x6f')](_0x1f3849[_0x3bb7('0x2f')][_0x3bb7('0x6b')][_0x3bb7('0x70')]())+'Queues'](_0x1f3849[_0x3bb7('0x2f')][_0x3bb7('0x76')]);}return null;})[_0x3bb7('0x24')](handleEntityNotFound(_0x1de62e,null))[_0x3bb7('0x24')](respondWithStatusCode(_0x1de62e,null))[_0x3bb7('0x40')](handleError(_0x1de62e,null));};exports[_0x3bb7('0x77')]=function(_0x225c59,_0x33707c){var _0x297fd5=_['isArray'](_0x225c59['body'][_0x3bb7('0x76')])?_0x225c59[_0x3bb7('0x47')][_0x3bb7('0x76')]:[_0x225c59[_0x3bb7('0x47')][_0x3bb7('0x76')]];var _0x4bac47=_0x225c59['params']['id'];return db[_0x3bb7('0x3e')][_0x3bb7('0x45')]({'where':{'id':_0x4bac47}})[_0x3bb7('0x24')](handleEntityNotFound(_0x33707c,null))['then'](function(_0x3358d8){if(_0x3358d8){var _0x359bf5=[_0x3bb7('0x78'),_0x3bb7('0x79'),'Mail',_0x3bb7('0x7a'),_0x3bb7('0x7b'),'Openchannel',_0x3bb7('0x7c')];return db['sequelize'][_0x3bb7('0x7d')](function(_0x47fb81){var _0xce3bca=_['map'](_0x359bf5,function(_0x9ed5fe){var _0x58133a={'attributes':['id',_0x3bb7('0x27')]};if(_0x9ed5fe===_0x3bb7('0x78')){_0x58133a[_0x3bb7('0x7e')]={'attributes':['penalty']};}return _0x3358d8[_0x3bb7('0x49')+_0x9ed5fe+'Queues'](_0x58133a)[_0x3bb7('0x24')](function(_0x5afc6e){var _0x4b6bed=_[_0x3bb7('0x2e')](_0x5afc6e,function(_0x3538fc){var _0x106f4e=_[_0x3bb7('0x2e')](_0x297fd5,function(_0x5e6d8d){var _0x1ac1b8={'where':{'UserId':_0x5e6d8d,[_0x9ed5fe+'QueueId']:_0x3538fc['id']},'transaction':_0x47fb81};if(_0x9ed5fe===_0x3bb7('0x78')){_0x1ac1b8[_0x3bb7('0x7f')]={'penalty':_0x3538fc['TeamVoiceQueue'][_0x3bb7('0x80')]};}return db['User'+_0x9ed5fe+_0x3bb7('0x81')][_0x3bb7('0x82')](_0x1ac1b8)['then'](function(){socket[_0x3bb7('0x83')](_0x3bb7('0x48')+_0x9ed5fe+_0x3bb7('0x84'),{'UserId':_0x5e6d8d,[_0x9ed5fe+'QueueId']:_0x3538fc['id']});if(_0x9ed5fe!==_0x3bb7('0x78')){return;}return db[_0x3bb7('0x85')][_0x3bb7('0x3f')]({'where':{'id':_0x297fd5,'online':0x1},'attributes':['id',_0x3bb7('0x27'),_0x3bb7('0x86'),_0x3bb7('0x87'),'interface'],'raw':!![]})[_0x3bb7('0x24')](function(_0xe6b93){var _0x49af88=_[_0x3bb7('0x2e')](_0xe6b93,function(_0x51787b){return db[_0x3bb7('0x88')]['upsert']({'membername':_0x51787b[_0x3bb7('0x27')],'UserId':_0x51787b['id'],'queue_name':_0x3538fc['name'],'VoiceQueueId':_0x3538fc['id'],'interface':_[_0x3bb7('0x89')](_0x51787b[_0x3bb7('0x8a')])?util[_0x3bb7('0x8b')](_0x3bb7('0x8c'),_0x51787b[_0x3bb7('0x27')]):_0x51787b[_0x3bb7('0x8a')],'paused':_0x51787b[_0x3bb7('0x87')]||![],'penalty':_0x3538fc[_0x3bb7('0x8d')][_0x3bb7('0x80')]},{'transaction':_0x47fb81});});return Promise[_0x3bb7('0x8e')](_0x49af88);});});});return Promise['all'](_0x106f4e);});return Promise[_0x3bb7('0x8e')](_0x4b6bed);})[_0x3bb7('0x24')](function(){return db[_0x3bb7('0x66')]['findOne']({'where':{'teamId':_0x4bac47}})[_0x3bb7('0x24')](function(_0x5a3e8f){if(_0x5a3e8f){var _0x2c1d81=_[_0x3bb7('0x2e')](_0x297fd5,function(_0x16a274){db[_0x3bb7('0x8f')][_0x3bb7('0x90')]({'UserId':_0x16a274,'VoicePrefixId':_0x5a3e8f[_0x3bb7('0x67')]});});return Promise[_0x3bb7('0x8e')](_0x2c1d81);}});});});return Promise[_0x3bb7('0x8e')](_0xce3bca)['then'](function(){return _0x3358d8[_0x3bb7('0x77')](_0x297fd5,{'transaction':_0x47fb81})[_0x3bb7('0x91')](function(_0x7e9410){return _0x7e9410;});});});}})[_0x3bb7('0x24')](respondWithResult(_0x33707c,null))[_0x3bb7('0x40')](handleError(_0x33707c,null));};exports[_0x3bb7('0x92')]=function(_0x64c42e,_0x3dc4f2){var _0x1b1214=_[_0x3bb7('0x93')](_0x64c42e[_0x3bb7('0x2f')][_0x3bb7('0x76')])?_0x64c42e[_0x3bb7('0x2f')][_0x3bb7('0x76')]:[_0x64c42e[_0x3bb7('0x2f')][_0x3bb7('0x76')]];var _0x1eb5ff=_0x64c42e['params']['id'];return db[_0x3bb7('0x3e')][_0x3bb7('0x45')]({'where':{'id':_0x1eb5ff}})[_0x3bb7('0x24')](handleEntityNotFound(_0x3dc4f2,null))[_0x3bb7('0x24')](function(_0x36f3f5){if(_0x36f3f5){var _0x3ec57b=[_0x3bb7('0x78'),_0x3bb7('0x79'),_0x3bb7('0x94'),_0x3bb7('0x7a'),_0x3bb7('0x7b'),_0x3bb7('0x95'),_0x3bb7('0x7c')];return db['sequelize'][_0x3bb7('0x7d')](function(_0x3c6091){var _0x3a78c6=_['map'](_0x3ec57b,function(_0x30a153){var _0x50ad2f={'attributes':['id',_0x3bb7('0x27')]};return _0x36f3f5[_0x3bb7('0x49')+_0x30a153+'Queues'](_0x50ad2f)['then'](function(_0x40acc1){var _0x53e4d6=_[_0x3bb7('0x2e')](_0x40acc1,function(_0xf90679){return _0xf90679[_0x3bb7('0x92')](_0x1b1214,{'transaction':_0x3c6091})[_0x3bb7('0x24')](function(){var _0x3252cd=_[_0x3bb7('0x2e')](_0x1b1214,function(_0x158f1b){socket[_0x3bb7('0x83')]('user'+_0x30a153+'Queue:remove',{'UserId':Number(_0x158f1b),[_0x30a153+'QueueId']:_0xf90679['id']});if(_0x30a153!=='Voice'){return;}return db[_0x3bb7('0x88')]['destroy']({'where':{'VoiceQueueId':_0xf90679['id'],'UserId':_0x158f1b},'transaction':_0x3c6091});});return Promise[_0x3bb7('0x8e')](_0x3252cd);});});return Promise['all'](_0x53e4d6);});});return Promise[_0x3bb7('0x8e')](_0x3a78c6)[_0x3bb7('0x24')](function(){return _0x36f3f5[_0x3bb7('0x92')](_0x1b1214,{'transaction':_0x3c6091});})[_0x3bb7('0x24')](function(){return db[_0x3bb7('0x66')]['findOne']({'where':{'teamId':_0x1eb5ff}})['then'](function(_0xbfa611){if(_0xbfa611){var _0x3f92b8=_['map'](_0x1b1214,function(_0x1d9311){db[_0x3bb7('0x8f')][_0x3bb7('0x5a')]({'where':{'UserId':_0x1d9311,'VoicePrefixId':_0xbfa611[_0x3bb7('0x67')]}});});return Promise[_0x3bb7('0x8e')](_0x3f92b8);}});});});}})[_0x3bb7('0x24')](respondWithStatusCode(_0x3dc4f2,null))[_0x3bb7('0x40')](handleError(_0x3dc4f2,null));};exports[_0x3bb7('0x96')]=function(_0x2846cf,_0x9800f5,_0x35839d){var _0x347de8={};var _0x46d073={};var _0x2f39ba;var _0x483bee;return db['Team']['findOne']({'where':{'id':_0x2846cf['params']['id']}})[_0x3bb7('0x24')](handleEntityNotFound(_0x9800f5,null))[_0x3bb7('0x24')](function(_0x38ef33){if(_0x38ef33){_0x2f39ba=_0x38ef33;_0x46d073[_0x3bb7('0x2d')]=_[_0x3bb7('0x43')](db[_0x3bb7('0x85')]['rawAttributes']);_0x46d073['query']=_[_0x3bb7('0x43')](_0x2846cf[_0x3bb7('0x2f')]);_0x46d073[_0x3bb7('0x30')]=_[_0x3bb7('0x32')](_0x46d073[_0x3bb7('0x2d')],_0x46d073['query']);_0x347de8[_0x3bb7('0x31')]=_[_0x3bb7('0x32')](_0x46d073['model'],qs[_0x3bb7('0x33')](_0x2846cf[_0x3bb7('0x2f')][_0x3bb7('0x33')]));_0x347de8[_0x3bb7('0x31')]=_0x347de8[_0x3bb7('0x31')]['length']?_0x347de8[_0x3bb7('0x31')]:_0x46d073[_0x3bb7('0x2d')];_0x347de8[_0x3bb7('0x35')]=qs[_0x3bb7('0x36')](_0x2846cf[_0x3bb7('0x2f')][_0x3bb7('0x36')]);_0x347de8[_0x3bb7('0x37')]=qs['filters'](_[_0x3bb7('0x38')](_0x2846cf[_0x3bb7('0x2f')],_0x46d073['filters']));if(_0x2846cf[_0x3bb7('0x2f')]['filter']){_0x347de8[_0x3bb7('0x37')]=_['merge'](_0x347de8['where'],{'$or':_[_0x3bb7('0x2e')](_0x347de8[_0x3bb7('0x31')],function(_0x3bec29){var _0x3509d1={};_0x3509d1[_0x3bec29]={'$like':'%'+_0x2846cf[_0x3bb7('0x2f')][_0x3bb7('0x39')]+'%'};return _0x3509d1;})});}_0x347de8=_['merge']({},_0x347de8,_0x2846cf[_0x3bb7('0x3c')]);return _0x2f39ba[_0x3bb7('0x96')](_0x347de8);}})['then'](function(_0x1e3fcb){if(_0x1e3fcb){_0x483bee=_0x1e3fcb[_0x3bb7('0x44')];if(!_0x2846cf['query']['hasOwnProperty'](_0x3bb7('0x97'))){_0x347de8[_0x3bb7('0x1b')]=qs[_0x3bb7('0x1b')](_0x2846cf[_0x3bb7('0x2f')][_0x3bb7('0x1b')]);_0x347de8[_0x3bb7('0x1d')]=qs[_0x3bb7('0x1d')](_0x2846cf['query'][_0x3bb7('0x1d')]);}return _0x2f39ba['getAgents'](_0x347de8);}})[_0x3bb7('0x24')](function(_0x992d16){if(_0x992d16){return _0x992d16?{'count':_0x483bee,'rows':_0x992d16}:null;}})[_0x3bb7('0x24')](respondWithResult(_0x9800f5,null))[_0x3bb7('0x40')](handleError(_0x9800f5,null));}; \ No newline at end of file +var _0xb95a=['desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','Team','include','findAll','rows','params','includeAll','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','Teams','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','SELECT','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','VoicePrefixId','UserProfileResource','send','getQueues','isValidChannel','ValidationError','Unknown\x20channel','channel','toLowerCase','Queue','length','order','capitalize','Queues','addQueues','findOne','add','ids','remove','addAgents','Voice','Mail','Sms','Fax','Openchannel','Whatsapp','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','online','voicePause','interface','UserVoiceQueueRt','upsert','format','SIP/%s','all','spread','removeAgents','isArray','Queue:remove','UserVoicePrefix','getAgents','rimraf','fast-json-patch','util','sox','to-csv','lodash','squel','crypto','jsforce'];(function(_0x27bcf5,_0x236765){var _0x4ce4cf=function(_0x4864ea){while(--_0x4864ea){_0x27bcf5['push'](_0x27bcf5['shift']());}};_0x4ce4cf(++_0x236765);}(_0xb95a,0x90));var _0xab95=function(_0x5b646c,_0x1e1694){_0x5b646c=_0x5b646c-0x0;var _0x3f49cf=_0xb95a[_0x5b646c];return _0x3f49cf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xab95('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xab95('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xab95('0x2'));var path=require('path');var sox=require(_0xab95('0x3'));var csv=require(_0xab95('0x4'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xab95('0x5'));var squel=require(_0xab95('0x6'));var crypto=require(_0xab95('0x7'));var jsforce=require(_0xab95('0x8'));var deskjs=require(_0xab95('0x9'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xab95('0xa'));var Redis=require(_0xab95('0xb'));var authService=require(_0xab95('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xab95('0xd'));var logger=require(_0xab95('0xe'))(_0xab95('0xf'));var utils=require(_0xab95('0x10'));var config=require(_0xab95('0x11'));var licenseUtil=require(_0xab95('0x12'));var db=require(_0xab95('0x13'))['db'];config['redis']=_[_0xab95('0x14')](config[_0xab95('0x15')],{'host':_0xab95('0x16'),'port':0x18eb});var socket=require(_0xab95('0x17'))(new Redis(config['redis']));require(_0xab95('0x18'))[_0xab95('0x19')](socket);function respondWithStatusCode(_0x9706cf,_0x27cb1f){_0x27cb1f=_0x27cb1f||0xcc;return function(_0x366c59){if(_0x366c59){return _0x9706cf[_0xab95('0x1a')](_0x27cb1f);}return _0x9706cf[_0xab95('0x1b')](_0x27cb1f)[_0xab95('0x1c')]();};}function respondWithResult(_0x26b51f,_0xbc0820){_0xbc0820=_0xbc0820||0xc8;return function(_0x66d6e6){if(_0x66d6e6){return _0x26b51f['status'](_0xbc0820)[_0xab95('0x1d')](_0x66d6e6);}};}function respondWithFilteredResult(_0xd74d89,_0x3bb85d){return function(_0x5a1e22){if(_0x5a1e22){var _0x1eb1eb=typeof _0x3bb85d[_0xab95('0x1e')]===_0xab95('0x1f')&&typeof _0x3bb85d[_0xab95('0x20')]===_0xab95('0x1f');var _0x169e4c=_0x5a1e22[_0xab95('0x21')];var _0x11f50e=_0x1eb1eb?0x0:_0x3bb85d[_0xab95('0x1e')];var _0x3e0278=_0x1eb1eb?_0x5a1e22['count']:_0x3bb85d[_0xab95('0x1e')]+_0x3bb85d['limit'];var _0x5da939;if(_0x3e0278>=_0x169e4c){_0x3e0278=_0x169e4c;_0x5da939=0xc8;}else{_0x5da939=0xce;}_0xd74d89['status'](_0x5da939);return _0xd74d89[_0xab95('0x22')]('Content-Range',_0x11f50e+'-'+_0x3e0278+'/'+_0x169e4c)[_0xab95('0x1d')](_0x5a1e22);}return null;};}function patchUpdates(_0x545d39){return function(_0x52df5d){try{jsonpatch['apply'](_0x52df5d,_0x545d39,!![]);}catch(_0xc180f2){return BPromise[_0xab95('0x23')](_0xc180f2);}return _0x52df5d[_0xab95('0x24')]();};}function saveUpdates(_0x55e2b3,_0x405783){return function(_0x10e045){if(_0x10e045){return _0x10e045[_0xab95('0x25')](_0x55e2b3)[_0xab95('0x26')](function(_0x42f886){return _0x42f886;});}return null;};}function handleEntityNotFound(_0x4d3676,_0x4d1e32){return function(_0x51c2c){if(!_0x51c2c){_0x4d3676['sendStatus'](0x194);}return _0x51c2c;};}function handleError(_0x5b6d7e,_0x542ef7){_0x542ef7=_0x542ef7||0x1f4;return function(_0x81277a){logger['error'](_0x81277a[_0xab95('0x27')]);if(_0x81277a[_0xab95('0x28')]){delete _0x81277a[_0xab95('0x28')];}_0x5b6d7e[_0xab95('0x1b')](_0x542ef7)['send'](_0x81277a);};}exports[_0xab95('0x29')]=function(_0x4ae70f,_0x5a6d8a){var _0x30b7c9={},_0x58b19e={},_0x2f1d96={'count':0x0,'rows':[]};var _0x1c3078=_[_0xab95('0x2a')](db['Team'][_0xab95('0x2b')],function(_0x5d605b){return{'name':_0x5d605b[_0xab95('0x2c')],'type':_0x5d605b[_0xab95('0x2d')][_0xab95('0x2e')]};});_0x58b19e['model']=_[_0xab95('0x2a')](_0x1c3078,_0xab95('0x28'));_0x58b19e[_0xab95('0x2f')]=_[_0xab95('0x30')](_0x4ae70f[_0xab95('0x2f')]);_0x58b19e[_0xab95('0x31')]=_[_0xab95('0x32')](_0x58b19e[_0xab95('0x33')],_0x58b19e[_0xab95('0x2f')]);_0x30b7c9[_0xab95('0x34')]=_[_0xab95('0x32')](_0x58b19e[_0xab95('0x33')],qs[_0xab95('0x35')](_0x4ae70f[_0xab95('0x2f')]['fields']));_0x30b7c9[_0xab95('0x34')]=_0x30b7c9[_0xab95('0x34')]['length']?_0x30b7c9[_0xab95('0x34')]:_0x58b19e[_0xab95('0x33')];if(!_0x4ae70f[_0xab95('0x2f')][_0xab95('0x36')](_0xab95('0x37'))){_0x30b7c9[_0xab95('0x20')]=qs['limit'](_0x4ae70f[_0xab95('0x2f')][_0xab95('0x20')]);_0x30b7c9[_0xab95('0x1e')]=qs[_0xab95('0x1e')](_0x4ae70f[_0xab95('0x2f')]['offset']);}_0x30b7c9['order']=qs[_0xab95('0x38')](_0x4ae70f[_0xab95('0x2f')]['sort']);_0x30b7c9['where']=qs[_0xab95('0x31')](_[_0xab95('0x39')](_0x4ae70f['query'],_0x58b19e[_0xab95('0x31')]),_0x1c3078);if(_0x4ae70f[_0xab95('0x2f')][_0xab95('0x3a')]){_0x30b7c9[_0xab95('0x3b')]=_[_0xab95('0x3c')](_0x30b7c9[_0xab95('0x3b')],{'$or':_[_0xab95('0x2a')](_0x1c3078,function(_0xed2d45){if(_0xed2d45[_0xab95('0x2d')]!==_0xab95('0x3d')){var _0x10609d={};_0x10609d[_0xed2d45[_0xab95('0x28')]]={'$like':'%'+_0x4ae70f['query'][_0xab95('0x3a')]+'%'};return _0x10609d;}})});}_0x30b7c9=_[_0xab95('0x3c')]({},_0x30b7c9,_0x4ae70f[_0xab95('0x3e')]);var _0xd9cd36={'where':_0x30b7c9['where']};return db[_0xab95('0x3f')][_0xab95('0x21')](_0xd9cd36)[_0xab95('0x26')](function(_0x2337de){_0x2f1d96[_0xab95('0x21')]=_0x2337de;if(_0x4ae70f['query']['includeAll']){_0x30b7c9[_0xab95('0x40')]=[{'all':!![]}];}return db[_0xab95('0x3f')][_0xab95('0x41')](_0x30b7c9);})['then'](function(_0x477121){_0x2f1d96[_0xab95('0x42')]=_0x477121;return _0x2f1d96;})[_0xab95('0x26')](respondWithFilteredResult(_0x5a6d8a,_0x30b7c9))['catch'](handleError(_0x5a6d8a,null));};exports['show']=function(_0x50787e,_0x1a508f){var _0x49d20a={'raw':![],'where':{'id':_0x50787e[_0xab95('0x43')]['id']}},_0x5161b1={};_0x5161b1['model']=_[_0xab95('0x30')](db[_0xab95('0x3f')][_0xab95('0x2b')]);_0x5161b1[_0xab95('0x2f')]=_[_0xab95('0x30')](_0x50787e['query']);_0x5161b1[_0xab95('0x31')]=_[_0xab95('0x32')](_0x5161b1[_0xab95('0x33')],_0x5161b1['query']);_0x49d20a[_0xab95('0x34')]=_[_0xab95('0x32')](_0x5161b1['model'],qs[_0xab95('0x35')](_0x50787e['query'][_0xab95('0x35')]));_0x49d20a['attributes']=_0x49d20a['attributes']['length']?_0x49d20a['attributes']:_0x5161b1[_0xab95('0x33')];if(_0x50787e[_0xab95('0x2f')][_0xab95('0x44')]){_0x49d20a[_0xab95('0x40')]=[{'all':!![]}];}_0x49d20a=_[_0xab95('0x3c')]({},_0x49d20a,_0x50787e[_0xab95('0x3e')]);return db[_0xab95('0x3f')][_0xab95('0x45')](_0x49d20a)['then'](handleEntityNotFound(_0x1a508f,null))[_0xab95('0x26')](respondWithResult(_0x1a508f,null))[_0xab95('0x46')](handleError(_0x1a508f,null));};exports[_0xab95('0x47')]=function(_0x2e291d,_0x5bd7b7){return db[_0xab95('0x3f')][_0xab95('0x47')](_0x2e291d['body'],{})[_0xab95('0x26')](function(_0x3da931){var _0x3740e6=_0x2e291d[_0xab95('0x48')]['get']({'plain':!![]});if(!_0x3740e6)throw new Error(_0xab95('0x49'));if(_0x3740e6['role']===_0xab95('0x48')){var _0x4e8b66=_0x3da931[_0xab95('0x4a')]({'plain':!![]});var _0x5e5bf4=_0xab95('0x4b');return db[_0xab95('0x4c')][_0xab95('0x45')]({'where':{'name':_0x5e5bf4,'userProfileId':_0x3740e6['userProfileId']},'raw':!![]})[_0xab95('0x26')](function(_0x5431f8){if(_0x5431f8&&_0x5431f8['autoAssociation']===0x0){return db['UserProfileResource'][_0xab95('0x47')]({'name':_0x4e8b66[_0xab95('0x28')],'resourceId':_0x4e8b66['id'],'type':_0x5431f8[_0xab95('0x28')],'sectionId':_0x5431f8['id']},{})['then'](function(){return _0x3da931;});}else{return _0x3da931;}})[_0xab95('0x46')](function(_0x2cf926){logger[_0xab95('0x4d')](_0xab95('0x4e'),_0x2cf926);throw _0x2cf926;});}return _0x3da931;})[_0xab95('0x26')](respondWithResult(_0x5bd7b7,0xc9))['catch'](handleError(_0x5bd7b7,null));};exports[_0xab95('0x25')]=function(_0x2b8555,_0x36135f){if(_0x2b8555[_0xab95('0x4f')]['id']){delete _0x2b8555[_0xab95('0x4f')]['id'];}return db[_0xab95('0x3f')]['find']({'where':{'id':_0x2b8555[_0xab95('0x43')]['id']}})['then'](handleEntityNotFound(_0x36135f,null))['then'](saveUpdates(_0x2b8555[_0xab95('0x4f')],null))['then'](respondWithResult(_0x36135f,null))[_0xab95('0x46')](handleError(_0x36135f,null));};exports[_0xab95('0x50')]=function(_0x1d5c2d,_0x4c6a46){var _0x1aa7c5=_0x1d5c2d[_0xab95('0x43')]['id'];var _0x5d630d=[];return db[_0xab95('0x51')][_0xab95('0x52')](function(_0x4bbde0){var _0x26a003=_0xab95('0x53')+_0x1aa7c5;return db[_0xab95('0x51')][_0xab95('0x2f')](_0x26a003,{'type':db[_0xab95('0x54')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x4bbde0})[_0xab95('0x26')](function(_0x19f2bb){_0x5d630d=_[_0xab95('0x2a')](_0x19f2bb,function(_0x93a5d5){return Number(_0x93a5d5[_0xab95('0x55')]);});})[_0xab95('0x26')](function(){var _0xad2fcb=_0xab95('0x56')+_0x1aa7c5;return db[_0xab95('0x51')][_0xab95('0x2f')](_0xad2fcb,{'type':db[_0xab95('0x54')][_0xab95('0x57')][_0xab95('0x58')],'raw':!![],'transaction':_0x4bbde0});})[_0xab95('0x26')](function(_0x94ebe8){var _0x31aff6=_[_0xab95('0x2a')](_0x94ebe8,function(_0x2f0c20){return Number(_0x2f0c20[_0xab95('0x59')]);});return db[_0xab95('0x5a')][_0xab95('0x50')]({'where':{'UserId':{'$in':_0x5d630d},'VoiceQueueId':{'$in':_0x31aff6}},'transaction':_0x4bbde0});})['then'](function(){var _0x37a852=_0xab95('0x5b')+_0x1aa7c5;return db[_0xab95('0x51')]['query'](_0x37a852,{'type':db['Sequelize'][_0xab95('0x57')]['SELECT'],'raw':!![],'transaction':_0x4bbde0});})[_0xab95('0x26')](function(_0x149b86){var _0x199c1d=_[_0xab95('0x2a')](_0x149b86,function(_0xef5df){return Number(_0xef5df['MailQueueId']);});return db[_0xab95('0x5c')][_0xab95('0x50')]({'where':{'UserId':{'$in':_0x5d630d},'MailQueueId':{'$in':_0x199c1d}},'transaction':_0x4bbde0});})['then'](function(){var _0x1b7344=_0xab95('0x5d')+_0x1aa7c5;return db[_0xab95('0x51')]['query'](_0x1b7344,{'type':db[_0xab95('0x54')][_0xab95('0x57')][_0xab95('0x58')],'raw':!![],'transaction':_0x4bbde0});})['then'](function(_0x2eaaa1){var _0x52d5c8=_[_0xab95('0x2a')](_0x2eaaa1,function(_0x2e2132){return Number(_0x2e2132['SmsQueueId']);});return db['UserSmsQueue'][_0xab95('0x50')]({'where':{'UserId':{'$in':_0x5d630d},'SmsQueueId':{'$in':_0x52d5c8}},'transaction':_0x4bbde0});})['then'](function(){var _0x49b5ee=_0xab95('0x5e')+_0x1aa7c5;return db[_0xab95('0x51')]['query'](_0x49b5ee,{'type':db['Sequelize'][_0xab95('0x57')][_0xab95('0x58')],'raw':!![],'transaction':_0x4bbde0});})[_0xab95('0x26')](function(_0x361229){var _0x5c22c9=_['map'](_0x361229,function(_0x11f991){return Number(_0x11f991[_0xab95('0x5f')]);});return db[_0xab95('0x60')][_0xab95('0x50')]({'where':{'UserId':{'$in':_0x5d630d},'ChatQueueId':{'$in':_0x5c22c9}},'transaction':_0x4bbde0});})[_0xab95('0x26')](function(){var _0x369f96=_0xab95('0x61')+_0x1aa7c5;return db['sequelize'][_0xab95('0x2f')](_0x369f96,{'type':db[_0xab95('0x54')][_0xab95('0x57')][_0xab95('0x58')],'raw':!![],'transaction':_0x4bbde0});})[_0xab95('0x26')](function(_0x37d8fc){var _0x76b3bc=_[_0xab95('0x2a')](_0x37d8fc,function(_0x4c1cdf){return Number(_0x4c1cdf[_0xab95('0x62')]);});return db[_0xab95('0x63')][_0xab95('0x50')]({'where':{'UserId':{'$in':_0x5d630d},'FaxQueueId':{'$in':_0x76b3bc}},'transaction':_0x4bbde0});})[_0xab95('0x26')](function(){var _0x1d267e=_0xab95('0x64')+_0x1aa7c5;return db[_0xab95('0x51')][_0xab95('0x2f')](_0x1d267e,{'type':db[_0xab95('0x54')][_0xab95('0x57')][_0xab95('0x58')],'raw':!![],'transaction':_0x4bbde0});})[_0xab95('0x26')](function(_0x163e9c){var _0x584125=_[_0xab95('0x2a')](_0x163e9c,function(_0x11b8dd){return Number(_0x11b8dd[_0xab95('0x65')]);});return db['UserOpenchannelQueue']['destroy']({'where':{'UserId':{'$in':_0x5d630d},'OpenchannelQueueId':{'$in':_0x584125}},'transaction':_0x4bbde0});})['then'](function(){var _0x50a9f4=_0xab95('0x66')+_0x1aa7c5;return db[_0xab95('0x51')][_0xab95('0x2f')](_0x50a9f4,{'type':db[_0xab95('0x54')][_0xab95('0x57')]['SELECT'],'raw':!![],'transaction':_0x4bbde0});})[_0xab95('0x26')](function(_0x16bdec){var _0x41e03f=_[_0xab95('0x2a')](_0x16bdec,function(_0x194a95){return Number(_0x194a95[_0xab95('0x67')]);});return db[_0xab95('0x68')]['destroy']({'where':{'UserId':{'$in':_0x5d630d},'WhatsappQueueId':{'$in':_0x41e03f}},'transaction':_0x4bbde0});})['then'](function(){return db[_0xab95('0x69')][_0xab95('0x45')]({'where':{'TeamId':_0x1aa7c5}});})['then'](function(_0x361a53){if(_0x361a53===null){return;}return db['UserVoicePrefix'][_0xab95('0x50')]({'where':{'UserId':{'$in':_0x5d630d},'VoicePrefixId':_0x361a53[_0xab95('0x6a')]},'transaction':_0x4bbde0});})[_0xab95('0x26')](function(){return db['Team'][_0xab95('0x50')]({'where':{'id':_0x1aa7c5},'cascade':!![],'transaction':_0x4bbde0});})['then'](function(_0x387827){if(_0x387827===0x0){_0x4c6a46['sendStatus'](0x194);}else{return db[_0xab95('0x6b')]['destroy']({'where':{'type':_0xab95('0x4b'),'resourceId':_0x1aa7c5},'cascade':!![],'transaction':_0x4bbde0})[_0xab95('0x26')](function(){_0x4c6a46[_0xab95('0x1b')](0xcc)['end']();});}})[_0xab95('0x46')](function(_0x4e0182){_0x4c6a46[_0xab95('0x1b')](0x1f4)[_0xab95('0x6c')](_0x4e0182);});});};exports[_0xab95('0x6d')]=function(_0xf28fd5,_0x59ea78,_0x4cac85){return db['Team']['findOne']({'where':{'id':_0xf28fd5['params']['id']}})['then'](handleEntityNotFound(_0x59ea78,null))['then'](function(_0x5178a1){if(!_0xf28fd5[_0xab95('0x2f')]['channel']||!utils[_0xab95('0x6e')](_0xf28fd5['query']['channel'])){throw new db[(_0xab95('0x54'))][(_0xab95('0x6f'))](_0xab95('0x70'));}var _0x132a0e={};var _0x444f3f={};_0x444f3f['model']=_[_0xab95('0x30')](db[_['capitalize'](_0xf28fd5[_0xab95('0x2f')][_0xab95('0x71')][_0xab95('0x72')]())+_0xab95('0x73')][_0xab95('0x2b')]);_0x444f3f[_0xab95('0x2f')]=_[_0xab95('0x30')](_0xf28fd5[_0xab95('0x2f')]);_0x444f3f[_0xab95('0x31')]=_[_0xab95('0x32')](_0x444f3f[_0xab95('0x33')],_0x444f3f[_0xab95('0x2f')]);_0x132a0e[_0xab95('0x34')]=_[_0xab95('0x32')](_0x444f3f[_0xab95('0x33')],qs[_0xab95('0x35')](_0xf28fd5['query'][_0xab95('0x35')]));_0x132a0e[_0xab95('0x34')]=_0x132a0e['attributes'][_0xab95('0x74')]?_0x132a0e[_0xab95('0x34')]:_0x444f3f[_0xab95('0x33')];_0x132a0e[_0xab95('0x20')]=qs[_0xab95('0x20')](_0xf28fd5[_0xab95('0x2f')][_0xab95('0x20')]);_0x132a0e[_0xab95('0x1e')]=qs[_0xab95('0x1e')](_0xf28fd5[_0xab95('0x2f')]['offset']);_0x132a0e[_0xab95('0x75')]=qs['sort'](_0xf28fd5[_0xab95('0x2f')][_0xab95('0x38')]);_0x132a0e['where']=qs[_0xab95('0x31')](_[_0xab95('0x39')](_0xf28fd5[_0xab95('0x2f')],_0x444f3f[_0xab95('0x31')]));_0x132a0e=_['merge']({},_0x132a0e,_0xf28fd5[_0xab95('0x3e')]);return _0x5178a1[_0xab95('0x4a')+_[_0xab95('0x76')](_0xf28fd5['query'][_0xab95('0x71')][_0xab95('0x72')]())+_0xab95('0x77')](_0x132a0e);})[_0xab95('0x26')](respondWithResult(_0x59ea78,null))[_0xab95('0x46')](handleError(_0x59ea78,null));};exports[_0xab95('0x78')]=function(_0x27bbbe,_0x391f57,_0x5003a1){return db['Team'][_0xab95('0x79')]({'where':{'id':_0x27bbbe['params']['id']}})[_0xab95('0x26')](function(_0x55481d){if(_0x55481d){if(!_0x27bbbe[_0xab95('0x4f')][_0xab95('0x71')]||!utils[_0xab95('0x6e')](_0x27bbbe[_0xab95('0x4f')][_0xab95('0x71')])){throw new db[(_0xab95('0x54'))]['ValidationError'](_0xab95('0x70'));}return _0x55481d[_0xab95('0x7a')+_[_0xab95('0x76')](_0x27bbbe[_0xab95('0x4f')][_0xab95('0x71')][_0xab95('0x72')]())+_0xab95('0x77')](_0x27bbbe[_0xab95('0x4f')][_0xab95('0x7b')]);}return null;})['then'](handleEntityNotFound(_0x391f57,null))['then'](respondWithStatusCode(_0x391f57,null))['catch'](handleError(_0x391f57,null));};exports['removeQueues']=function(_0x1e6801,_0x29908a,_0x113669){return db[_0xab95('0x3f')][_0xab95('0x79')]({'where':{'id':_0x1e6801['params']['id']}})[_0xab95('0x26')](function(_0xea28a8){if(_0xea28a8){if(!_0x1e6801[_0xab95('0x2f')][_0xab95('0x71')]||!utils[_0xab95('0x6e')](_0x1e6801['query'][_0xab95('0x71')])){throw new db[(_0xab95('0x54'))][(_0xab95('0x6f'))](_0xab95('0x70'));}return _0xea28a8[_0xab95('0x7c')+_[_0xab95('0x76')](_0x1e6801['query'][_0xab95('0x71')][_0xab95('0x72')]())+'Queues'](_0x1e6801['query']['ids']);}return null;})[_0xab95('0x26')](handleEntityNotFound(_0x29908a,null))['then'](respondWithStatusCode(_0x29908a,null))[_0xab95('0x46')](handleError(_0x29908a,null));};exports[_0xab95('0x7d')]=function(_0x1af16e,_0x1777ad){var _0x186be6=_['isArray'](_0x1af16e['body'][_0xab95('0x7b')])?_0x1af16e['body'][_0xab95('0x7b')]:[_0x1af16e[_0xab95('0x4f')]['ids']];var _0x31af5e=_0x1af16e[_0xab95('0x43')]['id'];return db[_0xab95('0x3f')][_0xab95('0x45')]({'where':{'id':_0x31af5e}})[_0xab95('0x26')](handleEntityNotFound(_0x1777ad,null))['then'](function(_0x514889){if(_0x514889){var _0x1a7440=[_0xab95('0x7e'),'Chat',_0xab95('0x7f'),_0xab95('0x80'),_0xab95('0x81'),_0xab95('0x82'),_0xab95('0x83')];return db[_0xab95('0x51')]['transaction'](function(_0x314239){var _0xf15a87=_[_0xab95('0x2a')](_0x1a7440,function(_0x189068){var _0x2d57af={'attributes':['id',_0xab95('0x28')]};if(_0x189068===_0xab95('0x7e')){_0x2d57af['through']={'attributes':[_0xab95('0x84')]};}return _0x514889['get'+_0x189068+_0xab95('0x77')](_0x2d57af)[_0xab95('0x26')](function(_0x2b75a2){var _0x10d3df=_[_0xab95('0x2a')](_0x2b75a2,function(_0x4ea6aa){var _0x2b6c95=_[_0xab95('0x2a')](_0x186be6,function(_0xce849b){var _0x55f9d3={'where':{'UserId':_0xce849b,[_0x189068+_0xab95('0x85')]:_0x4ea6aa['id']},'transaction':_0x314239};if(_0x189068===_0xab95('0x7e')){_0x55f9d3[_0xab95('0x14')]={'penalty':_0x4ea6aa[_0xab95('0x86')]['penalty']};}return db[_0xab95('0x87')+_0x189068+_0xab95('0x73')][_0xab95('0x88')](_0x55f9d3)[_0xab95('0x26')](function(){socket[_0xab95('0x89')]('user'+_0x189068+_0xab95('0x8a'),{'UserId':_0xce849b,[_0x189068+'QueueId']:_0x4ea6aa['id']});if(_0x189068!==_0xab95('0x7e')){return;}return db['User']['findAll']({'where':{'id':_0x186be6,'online':0x1},'attributes':['id',_0xab95('0x28'),_0xab95('0x8b'),_0xab95('0x8c'),_0xab95('0x8d')],'raw':!![]})[_0xab95('0x26')](function(_0x5ed3df){var _0x49106b=_[_0xab95('0x2a')](_0x5ed3df,function(_0x5085e0){return db[_0xab95('0x8e')][_0xab95('0x8f')]({'membername':_0x5085e0[_0xab95('0x28')],'UserId':_0x5085e0['id'],'queue_name':_0x4ea6aa['name'],'VoiceQueueId':_0x4ea6aa['id'],'interface':_['isNil'](_0x5085e0[_0xab95('0x8d')])?util[_0xab95('0x90')](_0xab95('0x91'),_0x5085e0['name']):_0x5085e0[_0xab95('0x8d')],'paused':_0x5085e0[_0xab95('0x8c')]||![],'penalty':_0x4ea6aa[_0xab95('0x86')][_0xab95('0x84')]},{'transaction':_0x314239});});return Promise[_0xab95('0x92')](_0x49106b);});});});return Promise[_0xab95('0x92')](_0x2b6c95);});return Promise[_0xab95('0x92')](_0x10d3df);})[_0xab95('0x26')](function(){return db[_0xab95('0x69')]['findOne']({'where':{'teamId':_0x31af5e}})[_0xab95('0x26')](function(_0x505a77){if(_0x505a77){var _0x14159b=_[_0xab95('0x2a')](_0x186be6,function(_0x4fccd2){db['UserVoicePrefix'][_0xab95('0x8f')]({'UserId':_0x4fccd2,'VoicePrefixId':_0x505a77[_0xab95('0x6a')]});});return Promise[_0xab95('0x92')](_0x14159b);}});});});return Promise[_0xab95('0x92')](_0xf15a87)[_0xab95('0x26')](function(){return _0x514889[_0xab95('0x7d')](_0x186be6,{'transaction':_0x314239})[_0xab95('0x93')](function(_0x4a50f1){return _0x4a50f1;});});});}})[_0xab95('0x26')](respondWithResult(_0x1777ad,null))[_0xab95('0x46')](handleError(_0x1777ad,null));};exports[_0xab95('0x94')]=function(_0x3f9488,_0x5a3ece){var _0x47938a=_[_0xab95('0x95')](_0x3f9488['query'][_0xab95('0x7b')])?_0x3f9488['query'][_0xab95('0x7b')]:[_0x3f9488[_0xab95('0x2f')][_0xab95('0x7b')]];var _0xe818a0=_0x3f9488['params']['id'];return db[_0xab95('0x3f')]['find']({'where':{'id':_0xe818a0}})[_0xab95('0x26')](handleEntityNotFound(_0x5a3ece,null))[_0xab95('0x26')](function(_0x420f97){if(_0x420f97){var _0x3f5961=[_0xab95('0x7e'),'Chat',_0xab95('0x7f'),_0xab95('0x80'),'Fax',_0xab95('0x82'),'Whatsapp'];return db[_0xab95('0x51')][_0xab95('0x52')](function(_0x397d6b){var _0xa4f8e=_[_0xab95('0x2a')](_0x3f5961,function(_0x374d06){var _0x54bf15={'attributes':['id',_0xab95('0x28')]};return _0x420f97[_0xab95('0x4a')+_0x374d06+_0xab95('0x77')](_0x54bf15)[_0xab95('0x26')](function(_0x909ad6){var _0x200f0c=_[_0xab95('0x2a')](_0x909ad6,function(_0x93a26c){return _0x93a26c[_0xab95('0x94')](_0x47938a,{'transaction':_0x397d6b})['then'](function(){var _0x85fce5=_['map'](_0x47938a,function(_0x56694a){socket[_0xab95('0x89')]('user'+_0x374d06+_0xab95('0x96'),{'UserId':Number(_0x56694a),[_0x374d06+_0xab95('0x85')]:_0x93a26c['id']});if(_0x374d06!==_0xab95('0x7e')){return;}return db[_0xab95('0x8e')]['destroy']({'where':{'VoiceQueueId':_0x93a26c['id'],'UserId':_0x56694a},'transaction':_0x397d6b});});return Promise['all'](_0x85fce5);});});return Promise[_0xab95('0x92')](_0x200f0c);});});return Promise[_0xab95('0x92')](_0xa4f8e)[_0xab95('0x26')](function(){return _0x420f97[_0xab95('0x94')](_0x47938a,{'transaction':_0x397d6b});})[_0xab95('0x26')](function(){return db['TeamVoicePrefix'][_0xab95('0x79')]({'where':{'teamId':_0xe818a0}})[_0xab95('0x26')](function(_0x1c768a){if(_0x1c768a){var _0x10db59=_['map'](_0x47938a,function(_0x5390d2){db[_0xab95('0x97')]['destroy']({'where':{'UserId':_0x5390d2,'VoicePrefixId':_0x1c768a['VoicePrefixId']}});});return Promise[_0xab95('0x92')](_0x10db59);}});});});}})[_0xab95('0x26')](respondWithStatusCode(_0x5a3ece,null))['catch'](handleError(_0x5a3ece,null));};exports[_0xab95('0x98')]=function(_0x1ef06c,_0x31b738,_0x4244cb){var _0x3b851f={};var _0x2c939e={};var _0x477b4e;var _0x24e4b5;return db[_0xab95('0x3f')][_0xab95('0x79')]({'where':{'id':_0x1ef06c[_0xab95('0x43')]['id']}})[_0xab95('0x26')](handleEntityNotFound(_0x31b738,null))[_0xab95('0x26')](function(_0x9b4ab8){if(_0x9b4ab8){_0x477b4e=_0x9b4ab8;_0x2c939e[_0xab95('0x33')]=_[_0xab95('0x30')](db['User'][_0xab95('0x2b')]);_0x2c939e['query']=_['keys'](_0x1ef06c['query']);_0x2c939e[_0xab95('0x31')]=_[_0xab95('0x32')](_0x2c939e[_0xab95('0x33')],_0x2c939e[_0xab95('0x2f')]);_0x3b851f[_0xab95('0x34')]=_[_0xab95('0x32')](_0x2c939e[_0xab95('0x33')],qs[_0xab95('0x35')](_0x1ef06c[_0xab95('0x2f')][_0xab95('0x35')]));_0x3b851f[_0xab95('0x34')]=_0x3b851f[_0xab95('0x34')][_0xab95('0x74')]?_0x3b851f[_0xab95('0x34')]:_0x2c939e['model'];_0x3b851f['order']=qs[_0xab95('0x38')](_0x1ef06c[_0xab95('0x2f')][_0xab95('0x38')]);_0x3b851f['where']=qs[_0xab95('0x31')](_[_0xab95('0x39')](_0x1ef06c[_0xab95('0x2f')],_0x2c939e[_0xab95('0x31')]));if(_0x1ef06c['query'][_0xab95('0x3a')]){_0x3b851f[_0xab95('0x3b')]=_[_0xab95('0x3c')](_0x3b851f[_0xab95('0x3b')],{'$or':_[_0xab95('0x2a')](_0x3b851f[_0xab95('0x34')],function(_0x58c9ae){var _0x49fa2d={};_0x49fa2d[_0x58c9ae]={'$like':'%'+_0x1ef06c[_0xab95('0x2f')][_0xab95('0x3a')]+'%'};return _0x49fa2d;})});}_0x3b851f=_[_0xab95('0x3c')]({},_0x3b851f,_0x1ef06c[_0xab95('0x3e')]);return _0x477b4e['getAgents'](_0x3b851f);}})[_0xab95('0x26')](function(_0x5ad149){if(_0x5ad149){_0x24e4b5=_0x5ad149[_0xab95('0x74')];if(!_0x1ef06c[_0xab95('0x2f')][_0xab95('0x36')]('nolimit')){_0x3b851f[_0xab95('0x20')]=qs[_0xab95('0x20')](_0x1ef06c[_0xab95('0x2f')][_0xab95('0x20')]);_0x3b851f['offset']=qs['offset'](_0x1ef06c[_0xab95('0x2f')][_0xab95('0x1e')]);}return _0x477b4e[_0xab95('0x98')](_0x3b851f);}})[_0xab95('0x26')](function(_0x27ff5b){if(_0x27ff5b){return _0x27ff5b?{'count':_0x24e4b5,'rows':_0x27ff5b}:null;}})[_0xab95('0x26')](respondWithResult(_0x31b738,null))[_0xab95('0x46')](handleError(_0x31b738,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 59e3542..b1531d5 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 _0x4e88=['../../mysqldb','Team','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x401d67,_0xeb1592){var _0x25076b=function(_0x233577){while(--_0x233577){_0x401d67['push'](_0x401d67['shift']());}};_0x25076b(++_0xeb1592);}(_0x4e88,0x1cb));var _0x84e8=function(_0x206024,_0xca71f2){_0x206024=_0x206024-0x0;var _0x125ff7=_0x4e88[_0x206024];return _0x125ff7;};'use strict';var EventEmitter=require(_0x84e8('0x0'));var Team=require(_0x84e8('0x1'))['db'][_0x84e8('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x84e8('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x84e8('0x4'),'afterDestroy':_0x84e8('0x5')};function emitEvent(_0x38705f){return function(_0x20d2cf,_0x3278f3,_0x39e7a7){TeamEvents[_0x84e8('0x6')](_0x38705f+':'+_0x20d2cf['id'],_0x20d2cf);TeamEvents[_0x84e8('0x6')](_0x38705f,_0x20d2cf);_0x39e7a7(null);};}for(var e in events){if(events[_0x84e8('0x7')](e)){var event=events[e];Team[_0x84e8('0x8')](e,emitEvent(event));}}module[_0x84e8('0x9')]=TeamEvents; \ No newline at end of file +var _0x813d=['hasOwnProperty','exports','Team','save','remove','emit'];(function(_0x4b74b5,_0x911674){var _0x45e396=function(_0xb66af8){while(--_0xb66af8){_0x4b74b5['push'](_0x4b74b5['shift']());}};_0x45e396(++_0x911674);}(_0x813d,0x11c));var _0xd813=function(_0x134be9,_0xabdd00){_0x134be9=_0x134be9-0x0;var _0x1e98e3=_0x813d[_0x134be9];return _0x1e98e3;};'use strict';var EventEmitter=require('events');var Team=require('../../mysqldb')['db'][_0xd813('0x0')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd813('0x1'),'afterUpdate':'update','afterDestroy':_0xd813('0x2')};function emitEvent(_0x5ac4ab){return function(_0x3184cc,_0x3fa51d,_0x264175){TeamEvents[_0xd813('0x3')](_0x5ac4ab+':'+_0x3184cc['id'],_0x3184cc);TeamEvents[_0xd813('0x3')](_0x5ac4ab,_0x3184cc);_0x264175(null);};}for(var e in events){if(events[_0xd813('0x4')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0xd813('0x5')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index a7eae24..a5e7ae7 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 _0x5ca7=['setDataValue','channel','catch','exports','define','Team','teams','Chat','Fax','Mail','Openchannel','Sms','Voice','Whatsapp','lodash','./team.attributes','Queues','then','map'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5ca7,0xdf));var _0x75ca=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x5ca7[_0x33032e];return _0x13316b;};'use strict';var _=require(_0x75ca('0x0'));var attributes=require(_0x75ca('0x1'));function getQueuesByChannel(_0x4f3988,_0x5e7382){var _0x5b5607='get'+_0x5e7382+_0x75ca('0x2');return _0x4f3988[_0x5b5607]()[_0x75ca('0x3')](function(_0x2dc660){return _[_0x75ca('0x4')](_0x2dc660,function(_0xdde36e){_0xdde36e[_0x75ca('0x5')](_0x75ca('0x6'),_0x5e7382);return _0xdde36e;});})[_0x75ca('0x7')](function(_0x1b21a6){throw _0x1b21a6;});}module[_0x75ca('0x8')]=function(_0x47f612){return _0x47f612[_0x75ca('0x9')](_0x75ca('0xa'),attributes,{'tableName':_0x75ca('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x5dc29c=this;var _0x146afb=[_0x75ca('0xc'),_0x75ca('0xd'),_0x75ca('0xe'),_0x75ca('0xf'),_0x75ca('0x10'),_0x75ca('0x11'),_0x75ca('0x12')];return Promise['resolve']()['then'](function(){var _0x17256a=_['map'](_0x146afb,function(_0x163e9f){return getQueuesByChannel(_0x5dc29c,_0x163e9f);});return Promise['all'](_0x17256a);})[_0x75ca('0x7')](function(_0x7c2f6b){throw _0x7c2f6b;});}}});}; \ No newline at end of file +var _0xcbfc=['Fax','Sms','Voice','Whatsapp','resolve','all','lodash','./team.attributes','get','then','map','setDataValue','channel','catch','Team','teams'];(function(_0x5968a7,_0x4775f2){var _0x5442b1=function(_0x42553a){while(--_0x42553a){_0x5968a7['push'](_0x5968a7['shift']());}};_0x5442b1(++_0x4775f2);}(_0xcbfc,0x166));var _0xccbf=function(_0x2ebc62,_0x2793c0){_0x2ebc62=_0x2ebc62-0x0;var _0x2eaef7=_0xcbfc[_0x2ebc62];return _0x2eaef7;};'use strict';var _=require(_0xccbf('0x0'));var attributes=require(_0xccbf('0x1'));function getQueuesByChannel(_0x5c0c76,_0x3d4446){var _0x418846=_0xccbf('0x2')+_0x3d4446+'Queues';return _0x5c0c76[_0x418846]()[_0xccbf('0x3')](function(_0x4542d0){return _[_0xccbf('0x4')](_0x4542d0,function(_0x335935){_0x335935[_0xccbf('0x5')](_0xccbf('0x6'),_0x3d4446);return _0x335935;});})[_0xccbf('0x7')](function(_0x3728f7){throw _0x3728f7;});}module['exports']=function(_0xb9d08c){return _0xb9d08c['define'](_0xccbf('0x8'),attributes,{'tableName':_0xccbf('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x85a221=this;var _0xb8811e=['Chat',_0xccbf('0xa'),'Mail','Openchannel',_0xccbf('0xb'),_0xccbf('0xc'),_0xccbf('0xd')];return Promise[_0xccbf('0xe')]()['then'](function(){var _0x41eccc=_[_0xccbf('0x4')](_0xb8811e,function(_0x4e709c){return getQueuesByChannel(_0x85a221,_0x4e709c);});return Promise[_0xccbf('0xf')](_0x41eccc);})[_0xccbf('0x7')](function(_0x2f403d){throw _0x2f403d;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index bcc0a35..25fd507 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 _0x73da=['then','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','code','error','message','Team,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','request'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x73da,0x142));var _0xa73d=function(_0xb4fe2c,_0x3d2be6){_0xb4fe2c=_0xb4fe2c-0x0;var _0x460a1a=_0x73da[_0xb4fe2c];return _0x460a1a;};'use strict';var _=require(_0xa73d('0x0'));var util=require(_0xa73d('0x1'));var moment=require(_0xa73d('0x2'));var BPromise=require(_0xa73d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa73d('0x4'));var db=require(_0xa73d('0x5'))['db'];var utils=require(_0xa73d('0x6'));var logger=require(_0xa73d('0x7'))(_0xa73d('0x8'));var config=require(_0xa73d('0x9'));var jayson=require(_0xa73d('0xa'));var client=jayson[_0xa73d('0xb')][_0xa73d('0xc')]({'port':0x232a});config[_0xa73d('0xd')]=_[_0xa73d('0xe')](config[_0xa73d('0xd')],{'host':_0xa73d('0xf'),'port':0x18eb});var socket=require(_0xa73d('0x10'))(new Redis(config['redis']));require(_0xa73d('0x11'))['register'](socket);function respondWithRpcPromise(_0x28870e,_0x120f58,_0x4dbdc1){return new BPromise(function(_0x50cd44,_0x37b461){return client[_0xa73d('0x12')](_0x28870e,_0x4dbdc1)[_0xa73d('0x13')](function(_0x35e0c9){logger[_0xa73d('0x14')]('Team,\x20%s,\x20%s',_0x120f58,_0xa73d('0x15'));logger[_0xa73d('0x16')](_0xa73d('0x17'),_0x120f58,_0xa73d('0x15'),JSON[_0xa73d('0x18')](_0x35e0c9));if(_0x35e0c9['error']){if(_0x35e0c9['error'][_0xa73d('0x19')]===0x1f4){logger[_0xa73d('0x1a')]('Team,\x20%s,\x20%s',_0x120f58,_0x35e0c9[_0xa73d('0x1a')][_0xa73d('0x1b')]);return _0x37b461(_0x35e0c9[_0xa73d('0x1a')][_0xa73d('0x1b')]);}logger[_0xa73d('0x1a')](_0xa73d('0x1c'),_0x120f58,_0x35e0c9[_0xa73d('0x1a')][_0xa73d('0x1b')]);return _0x50cd44(_0x35e0c9[_0xa73d('0x1a')][_0xa73d('0x1b')]);}else{logger[_0xa73d('0x14')](_0xa73d('0x1c'),_0x120f58,_0xa73d('0x15'));_0x50cd44(_0x35e0c9[_0xa73d('0x1d')]['message']);}})[_0xa73d('0x1e')](function(_0xe6a4a3){logger[_0xa73d('0x1a')]('Team,\x20%s,\x20%s',_0x120f58,_0xe6a4a3);_0x37b461(_0xe6a4a3);});});} \ No newline at end of file +var _0x1311=['result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./team.socket','register','request','then','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','Team,\x20%s,\x20%s','message','info'];(function(_0x356a01,_0x1f5dff){var _0x26c348=function(_0x508f4a){while(--_0x508f4a){_0x356a01['push'](_0x356a01['shift']());}};_0x26c348(++_0x1f5dff);}(_0x1311,0x1c4));var _0x1131=function(_0xf680e,_0x56c3c3){_0xf680e=_0xf680e-0x0;var _0x379bd0=_0x1311[_0xf680e];return _0x379bd0;};'use strict';var _=require(_0x1131('0x0'));var util=require(_0x1131('0x1'));var moment=require(_0x1131('0x2'));var BPromise=require(_0x1131('0x3'));var rs=require(_0x1131('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1131('0x5'));var logger=require(_0x1131('0x6'))(_0x1131('0x7'));var config=require(_0x1131('0x8'));var jayson=require(_0x1131('0x9'));var client=jayson[_0x1131('0xa')][_0x1131('0xb')]({'port':0x232a});config[_0x1131('0xc')]=_[_0x1131('0xd')](config[_0x1131('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x1131('0xe'))(new Redis(config['redis']));require(_0x1131('0xf'))[_0x1131('0x10')](socket);function respondWithRpcPromise(_0x140139,_0x43d25f,_0x4b426d){return new BPromise(function(_0x636270,_0x3440ac){return client[_0x1131('0x11')](_0x140139,_0x4b426d)[_0x1131('0x12')](function(_0x1268a7){logger['info']('Team,\x20%s,\x20%s',_0x43d25f,_0x1131('0x13'));logger[_0x1131('0x14')](_0x1131('0x15'),_0x43d25f,_0x1131('0x13'),JSON[_0x1131('0x16')](_0x1268a7));if(_0x1268a7['error']){if(_0x1268a7[_0x1131('0x17')][_0x1131('0x18')]===0x1f4){logger[_0x1131('0x17')](_0x1131('0x19'),_0x43d25f,_0x1268a7[_0x1131('0x17')][_0x1131('0x1a')]);return _0x3440ac(_0x1268a7[_0x1131('0x17')][_0x1131('0x1a')]);}logger[_0x1131('0x17')](_0x1131('0x19'),_0x43d25f,_0x1268a7['error'][_0x1131('0x1a')]);return _0x636270(_0x1268a7[_0x1131('0x17')][_0x1131('0x1a')]);}else{logger[_0x1131('0x1b')](_0x1131('0x19'),_0x43d25f,_0x1131('0x13'));_0x636270(_0x1268a7[_0x1131('0x1c')][_0x1131('0x1a')]);}})[_0x1131('0x1d')](function(_0x3a6914){logger[_0x1131('0x17')](_0x1131('0x19'),_0x43d25f,_0x3a6914);_0x3440ac(_0x3a6914);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index d1ddc56..4d154e0 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 _0xa846=['update','emit','register','length','./team.events','save','remove'];(function(_0x4f4c11,_0xdb6add){var _0x4dfd33=function(_0x163cfe){while(--_0x163cfe){_0x4f4c11['push'](_0x4f4c11['shift']());}};_0x4dfd33(++_0xdb6add);}(_0xa846,0x12a));var _0x6a84=function(_0x4f3dee,_0x46bb90){_0x4f3dee=_0x4f3dee-0x0;var _0x291aad=_0xa846[_0x4f3dee];return _0x291aad;};'use strict';var TeamEvents=require(_0x6a84('0x0'));var events=[_0x6a84('0x1'),_0x6a84('0x2'),_0x6a84('0x3')];function createListener(_0x2a2bcf,_0x27c2d){return function(_0x1760ed){_0x27c2d[_0x6a84('0x4')](_0x2a2bcf,_0x1760ed);};}function removeListener(_0x2522ac,_0x2fea99){return function(){TeamEvents['removeListener'](_0x2522ac,_0x2fea99);};}exports[_0x6a84('0x5')]=function(_0x150d82){for(var _0x4c87f7=0x0,_0x1ca80d=events[_0x6a84('0x6')];_0x4c87f7<_0x1ca80d;_0x4c87f7++){var _0x360827=events[_0x4c87f7];var _0xe79de7=createListener('team:'+_0x360827,_0x150d82);TeamEvents['on'](_0x360827,_0xe79de7);}}; \ No newline at end of file +var _0xc38e=['team:','./team.events','save','remove','emit','removeListener','register'];(function(_0x303d9d,_0x363884){var _0x4ccd15=function(_0x1b497b){while(--_0x1b497b){_0x303d9d['push'](_0x303d9d['shift']());}};_0x4ccd15(++_0x363884);}(_0xc38e,0x19e));var _0xec38=function(_0x455e29,_0x50a03d){_0x455e29=_0x455e29-0x0;var _0x5bca41=_0xc38e[_0x455e29];return _0x5bca41;};'use strict';var TeamEvents=require(_0xec38('0x0'));var events=[_0xec38('0x1'),_0xec38('0x2'),'update'];function createListener(_0x25a8d8,_0x3dbcb4){return function(_0x106527){_0x3dbcb4[_0xec38('0x3')](_0x25a8d8,_0x106527);};}function removeListener(_0x4e4859,_0xdf0c4f){return function(){TeamEvents[_0xec38('0x4')](_0x4e4859,_0xdf0c4f);};}exports[_0xec38('0x5')]=function(_0x355232){for(var _0x7213b6=0x0,_0x37c29d=events['length'];_0x7213b6<_0x37c29d;_0x7213b6++){var _0x3dbf95=events[_0x7213b6];var _0x1a46cc=createListener(_0xec38('0x6')+_0x3dbf95,_0x355232);TeamEvents['on'](_0x3dbf95,_0x1a46cc);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 6a12f5b..8a72aaf 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 _0xd5d3=['exports','INTEGER','sequelize'];(function(_0x41993e,_0x4ad3ab){var _0x60093e=function(_0x3edf11){while(--_0x3edf11){_0x41993e['push'](_0x41993e['shift']());}};_0x60093e(++_0x4ad3ab);}(_0xd5d3,0x113));var _0x3d5d=function(_0x15d8a5,_0x83652d){_0x15d8a5=_0x15d8a5-0x0;var _0x13fad4=_0xd5d3[_0x15d8a5];return _0x13fad4;};'use strict';var Sequelize=require(_0x3d5d('0x0'));module[_0x3d5d('0x1')]={'TeamId':{'type':Sequelize[_0x3d5d('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x8ec7=['exports','INTEGER','sequelize'];(function(_0x17c0ba,_0x2610a3){var _0x62d301=function(_0x45a5dd){while(--_0x45a5dd){_0x17c0ba['push'](_0x17c0ba['shift']());}};_0x62d301(++_0x2610a3);}(_0x8ec7,0x1f1));var _0x78ec=function(_0x3ef4f1,_0x5f0f9b){_0x3ef4f1=_0x3ef4f1-0x0;var _0x69953c=_0x8ec7[_0x3ef4f1];return _0x69953c;};'use strict';var Sequelize=require(_0x78ec('0x0'));module[_0x78ec('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x78ec('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index a390add..845da65 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 _0xe6d7=['util','api','moment','bluebird','request-promise','rimraf','exports','define','TeamVoicePrefix','team_has_voice_prefixes'];(function(_0x2ee0d6,_0x2562ff){var _0x299d21=function(_0x16cb6c){while(--_0x16cb6c){_0x2ee0d6['push'](_0x2ee0d6['shift']());}};_0x299d21(++_0x2562ff);}(_0xe6d7,0x1ae));var _0x7e6d=function(_0x3d93c6,_0x5b9eaa){_0x3d93c6=_0x3d93c6-0x0;var _0x4c31a6=_0xe6d7[_0x3d93c6];return _0x4c31a6;};'use strict';var _=require('lodash');var util=require(_0x7e6d('0x0'));var logger=require('../../config/logger')(_0x7e6d('0x1'));var moment=require(_0x7e6d('0x2'));var BPromise=require(_0x7e6d('0x3'));var rp=require(_0x7e6d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7e6d('0x5'));var config=require('../../config/environment');var attributes=require('./teamVoicePrefix.attributes');module[_0x7e6d('0x6')]=function(_0x23c09e,_0x4faafe){return _0x23c09e[_0x7e6d('0x7')](_0x7e6d('0x8'),attributes,{'tableName':_0x7e6d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x457b=['api','moment','bluebird','request-promise','path','../../config/environment','./teamVoicePrefix.attributes','exports','TeamVoicePrefix','team_has_voice_prefixes','lodash','util'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0x457b,0xca));var _0xb457=function(_0x54dc48,_0xf3557c){_0x54dc48=_0x54dc48-0x0;var _0x57237b=_0x457b[_0x54dc48];return _0x57237b;};'use strict';var _=require(_0xb457('0x0'));var util=require(_0xb457('0x1'));var logger=require('../../config/logger')(_0xb457('0x2'));var moment=require(_0xb457('0x3'));var BPromise=require(_0xb457('0x4'));var rp=require(_0xb457('0x5'));var fs=require('fs');var path=require(_0xb457('0x6'));var rimraf=require('rimraf');var config=require(_0xb457('0x7'));var attributes=require(_0xb457('0x8'));module[_0xb457('0x9')]=function(_0x3823c7,_0x3cefc3){return _0x3823c7['define'](_0xb457('0xa'),attributes,{'tableName':_0xb457('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 4aebd67..0467b89 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2710b5,_0x215b7e){var _0x77c06f=function(_0x47c049){while(--_0x47c049){_0x2710b5['push'](_0x2710b5['shift']());}};_0x77c06f(++_0x215b7e);}(_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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x582ee7,_0x2dda6c){var _0x555695=function(_0x224351){while(--_0x224351){_0x582ee7['push'](_0x582ee7['shift']());}};_0x555695(++_0x2dda6c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x107f10,_0x5529f2){_0x107f10=_0x107f10-0x0;var _0x811cab=_0xcb91[_0x107f10];return _0x811cab;};'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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index e6a6d83..cf58512 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 _0xe1e5=['sequelize','exports','INTEGER'];(function(_0x3e309e,_0x475d41){var _0x2f216f=function(_0x10b2e7){while(--_0x10b2e7){_0x3e309e['push'](_0x3e309e['shift']());}};_0x2f216f(++_0x475d41);}(_0xe1e5,0x156));var _0x5e1e=function(_0x19be52,_0x417078){_0x19be52=_0x19be52-0x0;var _0x42dfd2=_0xe1e5[_0x19be52];return _0x42dfd2;};'use strict';var Sequelize=require(_0x5e1e('0x0'));module[_0x5e1e('0x1')]={'penalty':{'type':Sequelize[_0x5e1e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x45aa=['INTEGER','exports'];(function(_0x59daab,_0x39939a){var _0x20026e=function(_0x20c321){while(--_0x20c321){_0x59daab['push'](_0x59daab['shift']());}};_0x20026e(++_0x39939a);}(_0x45aa,0xdf));var _0xa45a=function(_0x5ed3b1,_0x3e59b2){_0x5ed3b1=_0x5ed3b1-0x0;var _0x3cc545=_0x45aa[_0x5ed3b1];return _0x3cc545;};'use strict';var Sequelize=require('sequelize');module[_0xa45a('0x0')]={'penalty':{'type':Sequelize[_0xa45a('0x1')],'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 6f7f12f..e615b87 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 _0xf4d9=['./teamVoiceQueue.attributes','define','team_has_voice_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x368fc7,_0x405940){var _0x5b0f86=function(_0x49c32c){while(--_0x49c32c){_0x368fc7['push'](_0x368fc7['shift']());}};_0x5b0f86(++_0x405940);}(_0xf4d9,0x7c));var _0x9f4d=function(_0x547b24,_0x420bae){_0x547b24=_0x547b24-0x0;var _0x42f7ee=_0xf4d9[_0x547b24];return _0x42f7ee;};'use strict';var _=require(_0x9f4d('0x0'));var util=require('util');var logger=require(_0x9f4d('0x1'))(_0x9f4d('0x2'));var moment=require(_0x9f4d('0x3'));var BPromise=require(_0x9f4d('0x4'));var rp=require(_0x9f4d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9f4d('0x6'));var config=require(_0x9f4d('0x7'));var attributes=require(_0x9f4d('0x8'));module['exports']=function(_0x191f1c,_0x370059){return _0x191f1c[_0x9f4d('0x9')]('TeamVoiceQueue',attributes,{'tableName':_0x9f4d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x33a4=['util','api','moment','bluebird','../../config/environment','./teamVoiceQueue.attributes','exports','TeamVoiceQueue'];(function(_0x1baf0b,_0x1aaf5e){var _0x43cc4a=function(_0x279ed2){while(--_0x279ed2){_0x1baf0b['push'](_0x1baf0b['shift']());}};_0x43cc4a(++_0x1aaf5e);}(_0x33a4,0x88));var _0x433a=function(_0x20b200,_0x1c6ef6){_0x20b200=_0x20b200-0x0;var _0x16eef6=_0x33a4[_0x20b200];return _0x16eef6;};'use strict';var _=require('lodash');var util=require(_0x433a('0x0'));var logger=require('../../config/logger')(_0x433a('0x1'));var moment=require(_0x433a('0x2'));var BPromise=require(_0x433a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x433a('0x4'));var attributes=require(_0x433a('0x5'));module[_0x433a('0x6')]=function(_0x60b6b3,_0x1b6f5a){return _0x60b6b3['define'](_0x433a('0x7'),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 c7dcef5..e134d1f 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 _0x9c64=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xe30e17,_0xce02be){var _0x2342c9=function(_0x20b733){while(--_0x20b733){_0xe30e17['push'](_0xe30e17['shift']());}};_0x2342c9(++_0xce02be);}(_0x9c64,0x16a));var _0x49c6=function(_0xa45fa6,_0x340406){_0xa45fa6=_0xa45fa6-0x0;var _0x5b2164=_0x9c64[_0xa45fa6];return _0x5b2164;};'use strict';var _=require('lodash');var util=require(_0x49c6('0x0'));var moment=require(_0x49c6('0x1'));var BPromise=require(_0x49c6('0x2'));var rs=require(_0x49c6('0x3'));var fs=require('fs');var Redis=require(_0x49c6('0x4'));var db=require(_0x49c6('0x5'))['db'];var utils=require(_0x49c6('0x6'));var logger=require(_0x49c6('0x7'))(_0x49c6('0x8'));var config=require(_0x49c6('0x9'));var jayson=require(_0x49c6('0xa'));var client=jayson[_0x49c6('0xb')][_0x49c6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x194b7f,_0x5e65ed,_0x5b648e){return new BPromise(function(_0x31acfe,_0x129d8a){return client[_0x49c6('0xd')](_0x194b7f,_0x5b648e)[_0x49c6('0xe')](function(_0xc23520){logger[_0x49c6('0xf')](_0x49c6('0x10'),_0x5e65ed,'request\x20sent');logger[_0x49c6('0x11')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x5e65ed,_0x49c6('0x12'),JSON[_0x49c6('0x13')](_0xc23520));if(_0xc23520[_0x49c6('0x14')]){if(_0xc23520[_0x49c6('0x14')][_0x49c6('0x15')]===0x1f4){logger[_0x49c6('0x14')](_0x49c6('0x10'),_0x5e65ed,_0xc23520[_0x49c6('0x14')][_0x49c6('0x16')]);return _0x129d8a(_0xc23520[_0x49c6('0x14')]['message']);}logger[_0x49c6('0x14')](_0x49c6('0x10'),_0x5e65ed,_0xc23520[_0x49c6('0x14')][_0x49c6('0x16')]);return _0x31acfe(_0xc23520[_0x49c6('0x14')][_0x49c6('0x16')]);}else{logger[_0x49c6('0xf')](_0x49c6('0x10'),_0x5e65ed,_0x49c6('0x12'));_0x31acfe(_0xc23520['result'][_0x49c6('0x16')]);}})['catch'](function(_0x2bafcd){logger[_0x49c6('0x14')](_0x49c6('0x10'),_0x5e65ed,_0x2bafcd);_0x129d8a(_0x2bafcd);});});} \ No newline at end of file +var _0x0cfa=['TeamVoiceQueue,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','stringify','error'];(function(_0x51722d,_0x1d05a5){var _0x5b6701=function(_0x436c5b){while(--_0x436c5b){_0x51722d['push'](_0x51722d['shift']());}};_0x5b6701(++_0x1d05a5);}(_0x0cfa,0x18f));var _0xa0cf=function(_0x5d5346,_0x4745c3){_0x5d5346=_0x5d5346-0x0;var _0x5e1184=_0x0cfa[_0x5d5346];return _0x5e1184;};'use strict';var _=require(_0xa0cf('0x0'));var util=require(_0xa0cf('0x1'));var moment=require(_0xa0cf('0x2'));var BPromise=require(_0xa0cf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa0cf('0x4'));var logger=require('../../config/logger')(_0xa0cf('0x5'));var config=require(_0xa0cf('0x6'));var jayson=require(_0xa0cf('0x7'));var client=jayson[_0xa0cf('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27eb15,_0x5d9035,_0x232245){return new BPromise(function(_0x5f0054,_0xdee9d7){return client['request'](_0x27eb15,_0x232245)[_0xa0cf('0x9')](function(_0xaf7216){logger[_0xa0cf('0xa')]('TeamVoiceQueue,\x20%s,\x20%s',_0x5d9035,_0xa0cf('0xb'));logger[_0xa0cf('0xc')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x5d9035,'request\x20sent',JSON[_0xa0cf('0xd')](_0xaf7216));if(_0xaf7216[_0xa0cf('0xe')]){if(_0xaf7216[_0xa0cf('0xe')]['code']===0x1f4){logger[_0xa0cf('0xe')](_0xa0cf('0xf'),_0x5d9035,_0xaf7216[_0xa0cf('0xe')][_0xa0cf('0x10')]);return _0xdee9d7(_0xaf7216[_0xa0cf('0xe')][_0xa0cf('0x10')]);}logger[_0xa0cf('0xe')]('TeamVoiceQueue,\x20%s,\x20%s',_0x5d9035,_0xaf7216[_0xa0cf('0xe')][_0xa0cf('0x10')]);return _0x5f0054(_0xaf7216[_0xa0cf('0xe')]['message']);}else{logger[_0xa0cf('0xa')](_0xa0cf('0xf'),_0x5d9035,_0xa0cf('0xb'));_0x5f0054(_0xaf7216[_0xa0cf('0x11')][_0xa0cf('0x10')]);}})['catch'](function(_0x19e263){logger[_0xa0cf('0xe')]('TeamVoiceQueue,\x20%s,\x20%s',_0x5d9035,_0x19e263);_0xdee9d7(_0x19e263);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 0c0ee80..d0c1b4c 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 _0x531a=['get','index','/:id','isAuthenticated','show','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x77ab7f,_0x28e841){var _0x510d3c=function(_0x2e3ab8){while(--_0x2e3ab8){_0x77ab7f['push'](_0x77ab7f['shift']());}};_0x510d3c(++_0x28e841);}(_0x531a,0x100));var _0xa531=function(_0x32ce20,_0x315ba9){_0x32ce20=_0x32ce20-0x0;var _0x41a705=_0x531a[_0x32ce20];return _0x41a705;};'use strict';var multer=require(_0xa531('0x0'));var util=require(_0xa531('0x1'));var path=require(_0xa531('0x2'));var timeout=require(_0xa531('0x3'));var express=require(_0xa531('0x4'));var router=express[_0xa531('0x5')]();var fs_extra=require(_0xa531('0x6'));var auth=require(_0xa531('0x7'));var interaction=require(_0xa531('0x8'));var config=require(_0xa531('0x9'));var controller=require('./template.controller');router[_0xa531('0xa')]('/',auth['isAuthenticated'](),controller[_0xa531('0xb')]);router[_0xa531('0xa')](_0xa531('0xc'),auth[_0xa531('0xd')](),controller[_0xa531('0xe')]);router['post']('/',auth[_0xa531('0xd')](),controller[_0xa531('0xf')]);router['put'](_0xa531('0xc'),auth[_0xa531('0xd')](),controller[_0xa531('0x10')]);router[_0xa531('0x11')](_0xa531('0xc'),auth['isAuthenticated'](),controller[_0xa531('0x12')]);module['exports']=router; \ No newline at end of file +var _0xf34f=['express','fs-extra','../../components/auth/service','../../components/interaction/service','./template.controller','isAuthenticated','get','show','create','put','/:id','update','delete','destroy','exports','multer','path'];(function(_0xc00536,_0x347e15){var _0x2e4de9=function(_0xc6c596){while(--_0xc6c596){_0xc00536['push'](_0xc00536['shift']());}};_0x2e4de9(++_0x347e15);}(_0xf34f,0x64));var _0xff34=function(_0xb5ef9,_0x57332c){_0xb5ef9=_0xb5ef9-0x0;var _0x2ef10c=_0xf34f[_0xb5ef9];return _0x2ef10c;};'use strict';var multer=require(_0xff34('0x0'));var util=require('util');var path=require(_0xff34('0x1'));var timeout=require('connect-timeout');var express=require(_0xff34('0x2'));var router=express['Router']();var fs_extra=require(_0xff34('0x3'));var auth=require(_0xff34('0x4'));var interaction=require(_0xff34('0x5'));var config=require('../../config/environment');var controller=require(_0xff34('0x6'));router['get']('/',auth[_0xff34('0x7')](),controller['index']);router[_0xff34('0x8')]('/:id',auth[_0xff34('0x7')](),controller[_0xff34('0x9')]);router['post']('/',auth['isAuthenticated'](),controller[_0xff34('0xa')]);router[_0xff34('0xb')](_0xff34('0xc'),auth['isAuthenticated'](),controller[_0xff34('0xd')]);router[_0xff34('0xe')]('/:id',auth[_0xff34('0x7')](),controller[_0xff34('0xf')]);module[_0xff34('0x10')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index b1c0d7b..49b74d6 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 _0x47e6=['STRING','TEXT','sequelize'];(function(_0x29da39,_0x4e393a){var _0x348c06=function(_0x2b0451){while(--_0x2b0451){_0x29da39['push'](_0x29da39['shift']());}};_0x348c06(++_0x4e393a);}(_0x47e6,0x164));var _0x647e=function(_0x25a61b,_0x3cef39){_0x25a61b=_0x25a61b-0x0;var _0x468b4d=_0x47e6[_0x25a61b];return _0x468b4d;};'use strict';var Sequelize=require(_0x647e('0x0'));module['exports']={'name':{'type':Sequelize[_0x647e('0x1')]},'description':{'type':Sequelize[_0x647e('0x1')]},'html':{'type':Sequelize[_0x647e('0x2')]}}; \ No newline at end of file +var _0xa4f2=['sequelize','STRING'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa4f2,0xa4));var _0x2a4f=function(_0x50cc54,_0x54c15f){_0x50cc54=_0x50cc54-0x0;var _0x28ecca=_0xa4f2[_0x50cc54];return _0x28ecca;};'use strict';var Sequelize=require(_0x2a4f('0x0'));module['exports']={'name':{'type':Sequelize[_0x2a4f('0x1')]},'description':{'type':Sequelize[_0x2a4f('0x1')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index a25ba51..15eec9e 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 _0xa2a0=['jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','end','json','offset','limit','undefined','count','status','save','then','destroy','get','error','name','send','index','map','Template','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','params','length','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Templates','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto'];(function(_0x5ef55a,_0x2a03b1){var _0x20ae40=function(_0x46ce81){while(--_0x46ce81){_0x5ef55a['push'](_0x5ef55a['shift']());}};_0x20ae40(++_0x2a03b1);}(_0xa2a0,0x8c));var _0x0a2a=function(_0x656d83,_0x5b4630){_0x656d83=_0x656d83-0x0;var _0x100db8=_0xa2a0[_0x656d83];return _0x100db8;};'use strict';var emlformat=require(_0x0a2a('0x0'));var rimraf=require(_0x0a2a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0a2a('0x2'));var rp=require(_0x0a2a('0x3'));var moment=require(_0x0a2a('0x4'));var BPromise=require(_0x0a2a('0x5'));var Mustache=require(_0x0a2a('0x6'));var util=require(_0x0a2a('0x7'));var path=require(_0x0a2a('0x8'));var sox=require(_0x0a2a('0x9'));var csv=require('to-csv');var ejs=require(_0x0a2a('0xa'));var fs=require('fs');var fs_extra=require(_0x0a2a('0xb'));var _=require(_0x0a2a('0xc'));var squel=require('squel');var crypto=require(_0x0a2a('0xd'));var jsforce=require(_0x0a2a('0xe'));var deskjs=require(_0x0a2a('0xf'));var toCsv=require(_0x0a2a('0x10'));var querystring=require('querystring');var Papa=require(_0x0a2a('0x11'));var Redis=require(_0x0a2a('0x12'));var authService=require(_0x0a2a('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0a2a('0x14'));var logger=require(_0x0a2a('0x15'))('api');var utils=require(_0x0a2a('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0a2a('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x441abc,_0x55cbc7){_0x55cbc7=_0x55cbc7||0xcc;return function(_0xcd224e){if(_0xcd224e){return _0x441abc[_0x0a2a('0x18')](_0x55cbc7);}return _0x441abc['status'](_0x55cbc7)[_0x0a2a('0x19')]();};}function respondWithResult(_0x5983ff,_0x3cc01e){_0x3cc01e=_0x3cc01e||0xc8;return function(_0x120639){if(_0x120639){return _0x5983ff['status'](_0x3cc01e)[_0x0a2a('0x1a')](_0x120639);}};}function respondWithFilteredResult(_0x4e8b80,_0x4f0ad3){return function(_0x26797a){if(_0x26797a){var _0x47265c=typeof _0x4f0ad3[_0x0a2a('0x1b')]==='undefined'&&typeof _0x4f0ad3[_0x0a2a('0x1c')]===_0x0a2a('0x1d');var _0x439df9=_0x26797a[_0x0a2a('0x1e')];var _0x52a3e7=_0x47265c?0x0:_0x4f0ad3[_0x0a2a('0x1b')];var _0x15c2ba=_0x47265c?_0x26797a[_0x0a2a('0x1e')]:_0x4f0ad3[_0x0a2a('0x1b')]+_0x4f0ad3[_0x0a2a('0x1c')];var _0x314e5c;if(_0x15c2ba>=_0x439df9){_0x15c2ba=_0x439df9;_0x314e5c=0xc8;}else{_0x314e5c=0xce;}_0x4e8b80[_0x0a2a('0x1f')](_0x314e5c);return _0x4e8b80['set']('Content-Range',_0x52a3e7+'-'+_0x15c2ba+'/'+_0x439df9)[_0x0a2a('0x1a')](_0x26797a);}return null;};}function patchUpdates(_0x27cb53){return function(_0x4121d4){try{jsonpatch['apply'](_0x4121d4,_0x27cb53,!![]);}catch(_0x5dd2fc){return BPromise['reject'](_0x5dd2fc);}return _0x4121d4[_0x0a2a('0x20')]();};}function saveUpdates(_0x458631,_0x191e7c){return function(_0x26379d){if(_0x26379d){return _0x26379d['update'](_0x458631)[_0x0a2a('0x21')](function(_0xf7d116){return _0xf7d116;});}return null;};}function removeEntity(_0x4062de,_0x5db71e){return function(_0x564210){if(_0x564210){return _0x564210[_0x0a2a('0x22')]()[_0x0a2a('0x21')](function(){var _0x373f1f=_0x564210[_0x0a2a('0x23')]({'plain':!![]});var _0x3a41ba='Templates';return db['UserProfileResource'][_0x0a2a('0x22')]({'where':{'type':_0x3a41ba,'resourceId':_0x373f1f['id']}})[_0x0a2a('0x21')](function(){return _0x564210;});})['then'](function(){_0x4062de[_0x0a2a('0x1f')](0xcc)[_0x0a2a('0x19')]();});}};}function handleEntityNotFound(_0x24cb8b,_0x739ea4){return function(_0x45fa45){if(!_0x45fa45){_0x24cb8b['sendStatus'](0x194);}return _0x45fa45;};}function handleError(_0x101d1d,_0x3ff6d7){_0x3ff6d7=_0x3ff6d7||0x1f4;return function(_0x5ee859){logger[_0x0a2a('0x24')](_0x5ee859['stack']);if(_0x5ee859[_0x0a2a('0x25')]){delete _0x5ee859[_0x0a2a('0x25')];}_0x101d1d[_0x0a2a('0x1f')](_0x3ff6d7)[_0x0a2a('0x26')](_0x5ee859);};}exports[_0x0a2a('0x27')]=function(_0x17b6df,_0x527d90){var _0x15482d={},_0x5a5a04={},_0x4e8882={'count':0x0,'rows':[]};var _0x1e8083=_[_0x0a2a('0x28')](db[_0x0a2a('0x29')][_0x0a2a('0x2a')],function(_0x25d106){return{'name':_0x25d106['fieldName'],'type':_0x25d106['type'][_0x0a2a('0x2b')]};});_0x5a5a04[_0x0a2a('0x2c')]=_[_0x0a2a('0x28')](_0x1e8083,'name');_0x5a5a04[_0x0a2a('0x2d')]=_[_0x0a2a('0x2e')](_0x17b6df[_0x0a2a('0x2d')]);_0x5a5a04[_0x0a2a('0x2f')]=_[_0x0a2a('0x30')](_0x5a5a04['model'],_0x5a5a04[_0x0a2a('0x2d')]);_0x15482d[_0x0a2a('0x31')]=_[_0x0a2a('0x30')](_0x5a5a04[_0x0a2a('0x2c')],qs[_0x0a2a('0x32')](_0x17b6df[_0x0a2a('0x2d')]['fields']));_0x15482d[_0x0a2a('0x31')]=_0x15482d['attributes']['length']?_0x15482d[_0x0a2a('0x31')]:_0x5a5a04[_0x0a2a('0x2c')];if(!_0x17b6df[_0x0a2a('0x2d')][_0x0a2a('0x33')]('nolimit')){_0x15482d[_0x0a2a('0x1c')]=qs[_0x0a2a('0x1c')](_0x17b6df[_0x0a2a('0x2d')][_0x0a2a('0x1c')]);_0x15482d[_0x0a2a('0x1b')]=qs['offset'](_0x17b6df[_0x0a2a('0x2d')]['offset']);}_0x15482d[_0x0a2a('0x34')]=qs[_0x0a2a('0x35')](_0x17b6df[_0x0a2a('0x2d')]['sort']);_0x15482d[_0x0a2a('0x36')]=qs[_0x0a2a('0x2f')](_[_0x0a2a('0x37')](_0x17b6df['query'],_0x5a5a04[_0x0a2a('0x2f')]),_0x1e8083);if(_0x17b6df[_0x0a2a('0x2d')][_0x0a2a('0x38')]){_0x15482d[_0x0a2a('0x36')]=_[_0x0a2a('0x39')](_0x15482d[_0x0a2a('0x36')],{'$or':_['map'](_0x1e8083,function(_0x3eeeb0){if(_0x3eeeb0[_0x0a2a('0x3a')]!==_0x0a2a('0x3b')){var _0x12242c={};_0x12242c[_0x3eeeb0[_0x0a2a('0x25')]]={'$like':'%'+_0x17b6df[_0x0a2a('0x2d')][_0x0a2a('0x38')]+'%'};return _0x12242c;}})});}_0x15482d=_['merge']({},_0x15482d,_0x17b6df[_0x0a2a('0x3c')]);var _0x413e23={'where':_0x15482d['where']};return db[_0x0a2a('0x29')][_0x0a2a('0x1e')](_0x413e23)[_0x0a2a('0x21')](function(_0xdda72c){_0x4e8882[_0x0a2a('0x1e')]=_0xdda72c;if(_0x17b6df['query'][_0x0a2a('0x3d')]){_0x15482d['include']=[{'all':!![]}];}return db['Template'][_0x0a2a('0x3e')](_0x15482d);})['then'](function(_0x5771c0){_0x4e8882[_0x0a2a('0x3f')]=_0x5771c0;return _0x4e8882;})[_0x0a2a('0x21')](respondWithFilteredResult(_0x527d90,_0x15482d))[_0x0a2a('0x40')](handleError(_0x527d90,null));};exports['show']=function(_0x10cfed,_0x3df4b5){var _0x54cb08={'raw':!![],'where':{'id':_0x10cfed[_0x0a2a('0x41')]['id']}},_0x225662={};_0x225662[_0x0a2a('0x2c')]=_[_0x0a2a('0x2e')](db[_0x0a2a('0x29')][_0x0a2a('0x2a')]);_0x225662[_0x0a2a('0x2d')]=_[_0x0a2a('0x2e')](_0x10cfed[_0x0a2a('0x2d')]);_0x225662['filters']=_[_0x0a2a('0x30')](_0x225662[_0x0a2a('0x2c')],_0x225662[_0x0a2a('0x2d')]);_0x54cb08['attributes']=_['intersection'](_0x225662[_0x0a2a('0x2c')],qs[_0x0a2a('0x32')](_0x10cfed['query'][_0x0a2a('0x32')]));_0x54cb08[_0x0a2a('0x31')]=_0x54cb08[_0x0a2a('0x31')][_0x0a2a('0x42')]?_0x54cb08[_0x0a2a('0x31')]:_0x225662['model'];if(_0x10cfed[_0x0a2a('0x2d')][_0x0a2a('0x3d')]){_0x54cb08[_0x0a2a('0x43')]=[{'all':!![]}];}_0x54cb08=_[_0x0a2a('0x39')]({},_0x54cb08,_0x10cfed[_0x0a2a('0x3c')]);return db[_0x0a2a('0x29')][_0x0a2a('0x44')](_0x54cb08)[_0x0a2a('0x21')](handleEntityNotFound(_0x3df4b5,null))[_0x0a2a('0x21')](respondWithResult(_0x3df4b5,null))[_0x0a2a('0x40')](handleError(_0x3df4b5,null));};exports['create']=function(_0x11e087,_0x1b7e6f){return db[_0x0a2a('0x29')][_0x0a2a('0x45')](_0x11e087[_0x0a2a('0x46')],{})['then'](function(_0x1e7081){var _0xf6eef0=_0x11e087['user'][_0x0a2a('0x23')]({'plain':!![]});if(!_0xf6eef0)throw new Error(_0x0a2a('0x47'));if(_0xf6eef0['role']===_0x0a2a('0x48')){var _0x1e4c8a=_0x1e7081[_0x0a2a('0x23')]({'plain':!![]});var _0x57c576=_0x0a2a('0x49');return db[_0x0a2a('0x4a')]['find']({'where':{'name':_0x57c576,'userProfileId':_0xf6eef0[_0x0a2a('0x4b')]},'raw':!![]})[_0x0a2a('0x21')](function(_0x5944c3){if(_0x5944c3&&_0x5944c3[_0x0a2a('0x4c')]===0x0){return db['UserProfileResource'][_0x0a2a('0x45')]({'name':_0x1e4c8a['name'],'resourceId':_0x1e4c8a['id'],'type':_0x5944c3[_0x0a2a('0x25')],'sectionId':_0x5944c3['id']},{})[_0x0a2a('0x21')](function(){return _0x1e7081;});}else{return _0x1e7081;}})['catch'](function(_0x1ea7ea){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ea7ea);throw _0x1ea7ea;});}return _0x1e7081;})[_0x0a2a('0x21')](respondWithResult(_0x1b7e6f,0xc9))[_0x0a2a('0x40')](handleError(_0x1b7e6f,null));};exports['update']=function(_0x79b7f6,_0x610db4){if(_0x79b7f6[_0x0a2a('0x46')]['id']){delete _0x79b7f6['body']['id'];}return db[_0x0a2a('0x29')]['find']({'where':{'id':_0x79b7f6[_0x0a2a('0x41')]['id']}})[_0x0a2a('0x21')](handleEntityNotFound(_0x610db4,null))[_0x0a2a('0x21')](saveUpdates(_0x79b7f6[_0x0a2a('0x46')],null))['then'](respondWithResult(_0x610db4,null))[_0x0a2a('0x40')](handleError(_0x610db4,null));};exports[_0x0a2a('0x22')]=function(_0x4bb884,_0x27b3dd){return db[_0x0a2a('0x29')][_0x0a2a('0x44')]({'where':{'id':_0x4bb884[_0x0a2a('0x41')]['id']}})['then'](handleEntityNotFound(_0x27b3dd,null))['then'](removeEntity(_0x27b3dd,null))[_0x0a2a('0x40')](handleError(_0x27b3dd,null));}; \ No newline at end of file +var _0x8d81=['fieldName','type','key','query','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','filters','merge','VIRTUAL','filter','Template','includeAll','include','findAll','rows','catch','keys','length','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','error','params','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/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','count','limit','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','sendStatus','stack','name','map','rawAttributes'];(function(_0x3690f5,_0x3b908d){var _0x456fd5=function(_0x481fca){while(--_0x481fca){_0x3690f5['push'](_0x3690f5['shift']());}};_0x456fd5(++_0x3b908d);}(_0x8d81,0x11d));var _0x18d8=function(_0x3b3e9a,_0x34e0cb){_0x3b3e9a=_0x3b3e9a-0x0;var _0x23e46e=_0x8d81[_0x3b3e9a];return _0x23e46e;};'use strict';var emlformat=require(_0x18d8('0x0'));var rimraf=require(_0x18d8('0x1'));var zipdir=require(_0x18d8('0x2'));var jsonpatch=require(_0x18d8('0x3'));var rp=require(_0x18d8('0x4'));var moment=require(_0x18d8('0x5'));var BPromise=require(_0x18d8('0x6'));var Mustache=require(_0x18d8('0x7'));var util=require(_0x18d8('0x8'));var path=require(_0x18d8('0x9'));var sox=require(_0x18d8('0xa'));var csv=require('to-csv');var ejs=require(_0x18d8('0xb'));var fs=require('fs');var fs_extra=require(_0x18d8('0xc'));var _=require(_0x18d8('0xd'));var squel=require(_0x18d8('0xe'));var crypto=require(_0x18d8('0xf'));var jsforce=require(_0x18d8('0x10'));var deskjs=require(_0x18d8('0x11'));var toCsv=require(_0x18d8('0x12'));var querystring=require(_0x18d8('0x13'));var Papa=require(_0x18d8('0x14'));var Redis=require(_0x18d8('0x15'));var authService=require(_0x18d8('0x16'));var qs=require('../../components/parsers/qs');var as=require(_0x18d8('0x17'));var hardwareService=require(_0x18d8('0x18'));var logger=require(_0x18d8('0x19'))(_0x18d8('0x1a'));var utils=require(_0x18d8('0x1b'));var config=require(_0x18d8('0x1c'));var licenseUtil=require(_0x18d8('0x1d'));var db=require(_0x18d8('0x1e'))['db'];function respondWithStatusCode(_0x28621e,_0x9a9250){_0x9a9250=_0x9a9250||0xcc;return function(_0x2baa72){if(_0x2baa72){return _0x28621e['sendStatus'](_0x9a9250);}return _0x28621e['status'](_0x9a9250)['end']();};}function respondWithResult(_0x8e391a,_0x1f098e){_0x1f098e=_0x1f098e||0xc8;return function(_0x27128d){if(_0x27128d){return _0x8e391a[_0x18d8('0x1f')](_0x1f098e)[_0x18d8('0x20')](_0x27128d);}};}function respondWithFilteredResult(_0x4847e9,_0x17d25e){return function(_0x58b61f){if(_0x58b61f){var _0x15d325=typeof _0x17d25e['offset']==='undefined'&&typeof _0x17d25e['limit']==='undefined';var _0x108821=_0x58b61f['count'];var _0x381031=_0x15d325?0x0:_0x17d25e[_0x18d8('0x21')];var _0x16b673=_0x15d325?_0x58b61f[_0x18d8('0x22')]:_0x17d25e['offset']+_0x17d25e[_0x18d8('0x23')];var _0x3fa182;if(_0x16b673>=_0x108821){_0x16b673=_0x108821;_0x3fa182=0xc8;}else{_0x3fa182=0xce;}_0x4847e9[_0x18d8('0x1f')](_0x3fa182);return _0x4847e9['set'](_0x18d8('0x24'),_0x381031+'-'+_0x16b673+'/'+_0x108821)[_0x18d8('0x20')](_0x58b61f);}return null;};}function patchUpdates(_0x2d6cd1){return function(_0x362c76){try{jsonpatch[_0x18d8('0x25')](_0x362c76,_0x2d6cd1,!![]);}catch(_0x1e51ee){return BPromise[_0x18d8('0x26')](_0x1e51ee);}return _0x362c76[_0x18d8('0x27')]();};}function saveUpdates(_0xf88f6e,_0x36cfdf){return function(_0x8b754c){if(_0x8b754c){return _0x8b754c[_0x18d8('0x28')](_0xf88f6e)[_0x18d8('0x29')](function(_0x5d205a){return _0x5d205a;});}return null;};}function removeEntity(_0x5d1ee3,_0x2cbd0b){return function(_0x520a93){if(_0x520a93){return _0x520a93[_0x18d8('0x2a')]()[_0x18d8('0x29')](function(){var _0x1089c4=_0x520a93[_0x18d8('0x2b')]({'plain':!![]});var _0x3d38fc='Templates';return db[_0x18d8('0x2c')][_0x18d8('0x2a')]({'where':{'type':_0x3d38fc,'resourceId':_0x1089c4['id']}})[_0x18d8('0x29')](function(){return _0x520a93;});})['then'](function(){_0x5d1ee3[_0x18d8('0x1f')](0xcc)[_0x18d8('0x2d')]();});}};}function handleEntityNotFound(_0x207c2a,_0x1c2d7d){return function(_0x5c2eba){if(!_0x5c2eba){_0x207c2a[_0x18d8('0x2e')](0x194);}return _0x5c2eba;};}function handleError(_0x41bd1b,_0x998d08){_0x998d08=_0x998d08||0x1f4;return function(_0x181df5){logger['error'](_0x181df5[_0x18d8('0x2f')]);if(_0x181df5[_0x18d8('0x30')]){delete _0x181df5['name'];}_0x41bd1b[_0x18d8('0x1f')](_0x998d08)['send'](_0x181df5);};}exports['index']=function(_0x4a209f,_0x51d529){var _0x256edd={},_0x14f8f0={},_0x27b278={'count':0x0,'rows':[]};var _0x5b83c1=_[_0x18d8('0x31')](db['Template'][_0x18d8('0x32')],function(_0x228b19){return{'name':_0x228b19[_0x18d8('0x33')],'type':_0x228b19[_0x18d8('0x34')][_0x18d8('0x35')]};});_0x14f8f0['model']=_['map'](_0x5b83c1,_0x18d8('0x30'));_0x14f8f0[_0x18d8('0x36')]=_['keys'](_0x4a209f['query']);_0x14f8f0['filters']=_[_0x18d8('0x37')](_0x14f8f0[_0x18d8('0x38')],_0x14f8f0[_0x18d8('0x36')]);_0x256edd[_0x18d8('0x39')]=_[_0x18d8('0x37')](_0x14f8f0[_0x18d8('0x38')],qs[_0x18d8('0x3a')](_0x4a209f[_0x18d8('0x36')][_0x18d8('0x3a')]));_0x256edd[_0x18d8('0x39')]=_0x256edd[_0x18d8('0x39')]['length']?_0x256edd[_0x18d8('0x39')]:_0x14f8f0[_0x18d8('0x38')];if(!_0x4a209f['query'][_0x18d8('0x3b')]('nolimit')){_0x256edd['limit']=qs['limit'](_0x4a209f['query']['limit']);_0x256edd[_0x18d8('0x21')]=qs['offset'](_0x4a209f[_0x18d8('0x36')][_0x18d8('0x21')]);}_0x256edd[_0x18d8('0x3c')]=qs[_0x18d8('0x3d')](_0x4a209f['query'][_0x18d8('0x3d')]);_0x256edd[_0x18d8('0x3e')]=qs[_0x18d8('0x3f')](_['pick'](_0x4a209f[_0x18d8('0x36')],_0x14f8f0[_0x18d8('0x3f')]),_0x5b83c1);if(_0x4a209f[_0x18d8('0x36')]['filter']){_0x256edd[_0x18d8('0x3e')]=_[_0x18d8('0x40')](_0x256edd['where'],{'$or':_[_0x18d8('0x31')](_0x5b83c1,function(_0x1729aa){if(_0x1729aa[_0x18d8('0x34')]!==_0x18d8('0x41')){var _0x8ea01c={};_0x8ea01c[_0x1729aa['name']]={'$like':'%'+_0x4a209f[_0x18d8('0x36')][_0x18d8('0x42')]+'%'};return _0x8ea01c;}})});}_0x256edd=_['merge']({},_0x256edd,_0x4a209f['options']);var _0x5b60c2={'where':_0x256edd[_0x18d8('0x3e')]};return db[_0x18d8('0x43')][_0x18d8('0x22')](_0x5b60c2)[_0x18d8('0x29')](function(_0x29716c){_0x27b278[_0x18d8('0x22')]=_0x29716c;if(_0x4a209f['query'][_0x18d8('0x44')]){_0x256edd[_0x18d8('0x45')]=[{'all':!![]}];}return db[_0x18d8('0x43')][_0x18d8('0x46')](_0x256edd);})[_0x18d8('0x29')](function(_0x45d722){_0x27b278[_0x18d8('0x47')]=_0x45d722;return _0x27b278;})[_0x18d8('0x29')](respondWithFilteredResult(_0x51d529,_0x256edd))[_0x18d8('0x48')](handleError(_0x51d529,null));};exports['show']=function(_0x4a8f64,_0x486d70){var _0xb459e6={'raw':!![],'where':{'id':_0x4a8f64['params']['id']}},_0x52d8c7={};_0x52d8c7[_0x18d8('0x38')]=_[_0x18d8('0x49')](db['Template'][_0x18d8('0x32')]);_0x52d8c7[_0x18d8('0x36')]=_[_0x18d8('0x49')](_0x4a8f64[_0x18d8('0x36')]);_0x52d8c7[_0x18d8('0x3f')]=_[_0x18d8('0x37')](_0x52d8c7['model'],_0x52d8c7[_0x18d8('0x36')]);_0xb459e6[_0x18d8('0x39')]=_[_0x18d8('0x37')](_0x52d8c7['model'],qs[_0x18d8('0x3a')](_0x4a8f64[_0x18d8('0x36')][_0x18d8('0x3a')]));_0xb459e6[_0x18d8('0x39')]=_0xb459e6[_0x18d8('0x39')][_0x18d8('0x4a')]?_0xb459e6['attributes']:_0x52d8c7[_0x18d8('0x38')];if(_0x4a8f64['query']['includeAll']){_0xb459e6['include']=[{'all':!![]}];}_0xb459e6=_[_0x18d8('0x40')]({},_0xb459e6,_0x4a8f64[_0x18d8('0x4b')]);return db['Template'][_0x18d8('0x4c')](_0xb459e6)[_0x18d8('0x29')](handleEntityNotFound(_0x486d70,null))[_0x18d8('0x29')](respondWithResult(_0x486d70,null))[_0x18d8('0x48')](handleError(_0x486d70,null));};exports[_0x18d8('0x4d')]=function(_0x200ffb,_0x21255d){return db[_0x18d8('0x43')][_0x18d8('0x4d')](_0x200ffb[_0x18d8('0x4e')],{})[_0x18d8('0x29')](function(_0x4e4488){var _0x53fa98=_0x200ffb['user'][_0x18d8('0x2b')]({'plain':!![]});if(!_0x53fa98)throw new Error(_0x18d8('0x4f'));if(_0x53fa98['role']==='user'){var _0x13ec15=_0x4e4488[_0x18d8('0x2b')]({'plain':!![]});var _0x12f77d='Templates';return db[_0x18d8('0x50')][_0x18d8('0x4c')]({'where':{'name':_0x12f77d,'userProfileId':_0x53fa98['userProfileId']},'raw':!![]})[_0x18d8('0x29')](function(_0x5ba7aa){if(_0x5ba7aa&&_0x5ba7aa[_0x18d8('0x51')]===0x0){return db[_0x18d8('0x2c')][_0x18d8('0x4d')]({'name':_0x13ec15[_0x18d8('0x30')],'resourceId':_0x13ec15['id'],'type':_0x5ba7aa['name'],'sectionId':_0x5ba7aa['id']},{})['then'](function(){return _0x4e4488;});}else{return _0x4e4488;}})[_0x18d8('0x48')](function(_0x3417d1){logger[_0x18d8('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3417d1);throw _0x3417d1;});}return _0x4e4488;})[_0x18d8('0x29')](respondWithResult(_0x21255d,0xc9))[_0x18d8('0x48')](handleError(_0x21255d,null));};exports['update']=function(_0x1efa31,_0x20489d){if(_0x1efa31[_0x18d8('0x4e')]['id']){delete _0x1efa31[_0x18d8('0x4e')]['id'];}return db[_0x18d8('0x43')][_0x18d8('0x4c')]({'where':{'id':_0x1efa31[_0x18d8('0x53')]['id']}})[_0x18d8('0x29')](handleEntityNotFound(_0x20489d,null))[_0x18d8('0x29')](saveUpdates(_0x1efa31['body'],null))[_0x18d8('0x29')](respondWithResult(_0x20489d,null))[_0x18d8('0x48')](handleError(_0x20489d,null));};exports[_0x18d8('0x2a')]=function(_0x315f23,_0x4cee6b){return db[_0x18d8('0x43')]['find']({'where':{'id':_0x315f23[_0x18d8('0x53')]['id']}})[_0x18d8('0x29')](handleEntityNotFound(_0x4cee6b,null))[_0x18d8('0x29')](removeEntity(_0x4cee6b,null))['catch'](handleError(_0x4cee6b,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 768120b..99738c4 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 _0x7252=['tools_templates','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./template.attributes','exports','define'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0x7252,0x146));var _0x2725=function(_0x674df3,_0x5abbed){_0x674df3=_0x674df3-0x0;var _0x4fafc5=_0x7252[_0x674df3];return _0x4fafc5;};'use strict';var _=require(_0x2725('0x0'));var util=require(_0x2725('0x1'));var logger=require(_0x2725('0x2'))(_0x2725('0x3'));var moment=require(_0x2725('0x4'));var BPromise=require(_0x2725('0x5'));var rp=require(_0x2725('0x6'));var fs=require('fs');var path=require(_0x2725('0x7'));var rimraf=require('rimraf');var config=require(_0x2725('0x8'));var attributes=require(_0x2725('0x9'));module[_0x2725('0xa')]=function(_0x21ad65,_0x586dcb){return _0x21ad65[_0x2725('0xb')]('Template',attributes,{'tableName':_0x2725('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x32d2=['api','moment','path','rimraf','./template.attributes','exports','define','Template','tools_templates','lodash','../../config/logger'];(function(_0x2100d6,_0x55362c){var _0x298ddd=function(_0x7435e8){while(--_0x7435e8){_0x2100d6['push'](_0x2100d6['shift']());}};_0x298ddd(++_0x55362c);}(_0x32d2,0x1c1));var _0x232d=function(_0x3739bc,_0xf646b1){_0x3739bc=_0x3739bc-0x0;var _0x42285d=_0x32d2[_0x3739bc];return _0x42285d;};'use strict';var _=require(_0x232d('0x0'));var util=require('util');var logger=require(_0x232d('0x1'))(_0x232d('0x2'));var moment=require(_0x232d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x232d('0x4'));var rimraf=require(_0x232d('0x5'));var config=require('../../config/environment');var attributes=require(_0x232d('0x6'));module[_0x232d('0x7')]=function(_0x2db879,_0x31b8e4){return _0x2db879[_0x232d('0x8')](_0x232d('0x9'),attributes,{'tableName':_0x232d('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 f9e7d69..2a282cc 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 _0x9803=['model','include','then','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','debug','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Template,\x20%s,\x20%s','message','info','catch','GetTemplate','Template','findAll','options','where','attributes','limit','map'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9803,0x113));var _0x3980=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9803[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x3980('0x0'));var util=require(_0x3980('0x1'));var moment=require(_0x3980('0x2'));var BPromise=require(_0x3980('0x3'));var rs=require(_0x3980('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3980('0x5'))['db'];var utils=require(_0x3980('0x6'));var logger=require(_0x3980('0x7'))(_0x3980('0x8'));var config=require(_0x3980('0x9'));var jayson=require(_0x3980('0xa'));var client=jayson['client'][_0x3980('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf59bce,_0x6818f3,_0x1138e7){return new BPromise(function(_0x1f2a6c,_0x3110f5){return client[_0x3980('0xc')](_0xf59bce,_0x1138e7)['then'](function(_0x51631a){logger['info']('Template,\x20%s,\x20%s',_0x6818f3,'request\x20sent');logger[_0x3980('0xd')](_0x3980('0xe'),_0x6818f3,_0x3980('0xf'),JSON[_0x3980('0x10')](_0x51631a));if(_0x51631a[_0x3980('0x11')]){if(_0x51631a[_0x3980('0x11')][_0x3980('0x12')]===0x1f4){logger['error'](_0x3980('0x13'),_0x6818f3,_0x51631a['error']['message']);return _0x3110f5(_0x51631a[_0x3980('0x11')]['message']);}logger[_0x3980('0x11')](_0x3980('0x13'),_0x6818f3,_0x51631a['error'][_0x3980('0x14')]);return _0x1f2a6c(_0x51631a[_0x3980('0x11')][_0x3980('0x14')]);}else{logger[_0x3980('0x15')](_0x3980('0x13'),_0x6818f3,'request\x20sent');_0x1f2a6c(_0x51631a['result'][_0x3980('0x14')]);}})[_0x3980('0x16')](function(_0x5687a1){logger['error'](_0x3980('0x13'),_0x6818f3,_0x5687a1);_0x3110f5(_0x5687a1);});});}exports[_0x3980('0x17')]=function(_0x17fd4a){var _0x15fa05=this;return new Promise(function(_0x1840d7,_0x1c868f){return db[_0x3980('0x18')][_0x3980('0x19')]({'raw':_0x17fd4a[_0x3980('0x1a')]?_0x17fd4a['options']['raw']===undefined?!![]:![]:!![],'where':_0x17fd4a[_0x3980('0x1a')]?_0x17fd4a['options'][_0x3980('0x1b')]||null:null,'attributes':_0x17fd4a[_0x3980('0x1a')]?_0x17fd4a[_0x3980('0x1a')][_0x3980('0x1c')]||null:null,'limit':_0x17fd4a[_0x3980('0x1a')]?_0x17fd4a['options'][_0x3980('0x1d')]||null:null,'include':_0x17fd4a[_0x3980('0x1a')]?_0x17fd4a[_0x3980('0x1a')]['include']?_[_0x3980('0x1e')](_0x17fd4a['options']['include'],function(_0x13807c){return{'model':db[_0x13807c[_0x3980('0x1f')]],'as':_0x13807c['as'],'attributes':_0x13807c['attributes'],'include':_0x13807c[_0x3980('0x20')]?_[_0x3980('0x1e')](_0x13807c[_0x3980('0x20')],function(_0x5260b8){return{'model':db[_0x5260b8['model']],'as':_0x5260b8['as'],'attributes':_0x5260b8[_0x3980('0x1c')],'include':_0x5260b8['include']?_['map'](_0x5260b8[_0x3980('0x20')],function(_0x335d18){return{'model':db[_0x335d18[_0x3980('0x1f')]],'as':_0x335d18['as'],'attributes':_0x335d18[_0x3980('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3980('0x21')](function(_0x2364ed){logger[_0x3980('0x15')](_0x3980('0x17'),_0x17fd4a);logger['debug'](_0x3980('0x17'),_0x17fd4a,JSON[_0x3980('0x10')](_0x2364ed));_0x1840d7(_0x2364ed);})['catch'](function(_0x10f0e8){logger[_0x3980('0x11')](_0x3980('0x17'),_0x10f0e8[_0x3980('0x14')],_0x17fd4a);_0x1c868f(_0x15fa05['error'](0x1f4,_0x10f0e8[_0x3980('0x14')]));});});}; \ No newline at end of file +var _0x6945=['where','attributes','limit','include','map','model','then','GetTemplate','debug','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','Template,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','findAll','options','raw'];(function(_0x3e6fbb,_0x1a19f3){var _0x29f4b3=function(_0x2ece07){while(--_0x2ece07){_0x3e6fbb['push'](_0x3e6fbb['shift']());}};_0x29f4b3(++_0x1a19f3);}(_0x6945,0xdb));var _0x5694=function(_0x335f56,_0x1338dc){_0x335f56=_0x335f56-0x0;var _0x243112=_0x6945[_0x335f56];return _0x243112;};'use strict';var _=require(_0x5694('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5694('0x1'));var fs=require('fs');var Redis=require(_0x5694('0x2'));var db=require(_0x5694('0x3'))['db'];var utils=require(_0x5694('0x4'));var logger=require(_0x5694('0x5'))(_0x5694('0x6'));var config=require(_0x5694('0x7'));var jayson=require(_0x5694('0x8'));var client=jayson[_0x5694('0x9')][_0x5694('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50952f,_0x108d21,_0x402461){return new BPromise(function(_0x340b47,_0x2f9165){return client['request'](_0x50952f,_0x402461)['then'](function(_0x279c0a){logger[_0x5694('0xb')](_0x5694('0xc'),_0x108d21,_0x5694('0xd'));logger['debug']('Template,\x20%s,\x20%s,\x20%s',_0x108d21,_0x5694('0xd'),JSON[_0x5694('0xe')](_0x279c0a));if(_0x279c0a['error']){if(_0x279c0a[_0x5694('0xf')][_0x5694('0x10')]===0x1f4){logger['error'](_0x5694('0xc'),_0x108d21,_0x279c0a[_0x5694('0xf')][_0x5694('0x11')]);return _0x2f9165(_0x279c0a[_0x5694('0xf')][_0x5694('0x11')]);}logger[_0x5694('0xf')]('Template,\x20%s,\x20%s',_0x108d21,_0x279c0a[_0x5694('0xf')][_0x5694('0x11')]);return _0x340b47(_0x279c0a[_0x5694('0xf')][_0x5694('0x11')]);}else{logger[_0x5694('0xb')]('Template,\x20%s,\x20%s',_0x108d21,_0x5694('0xd'));_0x340b47(_0x279c0a['result'][_0x5694('0x11')]);}})['catch'](function(_0x435018){logger[_0x5694('0xf')](_0x5694('0xc'),_0x108d21,_0x435018);_0x2f9165(_0x435018);});});}exports['GetTemplate']=function(_0x3da74a){var _0x435dc4=this;return new Promise(function(_0x572553,_0x3eb405){return db['Template'][_0x5694('0x12')]({'raw':_0x3da74a['options']?_0x3da74a[_0x5694('0x13')][_0x5694('0x14')]===undefined?!![]:![]:!![],'where':_0x3da74a['options']?_0x3da74a[_0x5694('0x13')][_0x5694('0x15')]||null:null,'attributes':_0x3da74a[_0x5694('0x13')]?_0x3da74a[_0x5694('0x13')][_0x5694('0x16')]||null:null,'limit':_0x3da74a[_0x5694('0x13')]?_0x3da74a[_0x5694('0x13')][_0x5694('0x17')]||null:null,'include':_0x3da74a['options']?_0x3da74a[_0x5694('0x13')][_0x5694('0x18')]?_[_0x5694('0x19')](_0x3da74a['options']['include'],function(_0x14da98){return{'model':db[_0x14da98[_0x5694('0x1a')]],'as':_0x14da98['as'],'attributes':_0x14da98[_0x5694('0x16')],'include':_0x14da98[_0x5694('0x18')]?_[_0x5694('0x19')](_0x14da98[_0x5694('0x18')],function(_0x1b97dc){return{'model':db[_0x1b97dc[_0x5694('0x1a')]],'as':_0x1b97dc['as'],'attributes':_0x1b97dc['attributes'],'include':_0x1b97dc[_0x5694('0x18')]?_[_0x5694('0x19')](_0x1b97dc[_0x5694('0x18')],function(_0x14bded){return{'model':db[_0x14bded['model']],'as':_0x14bded['as'],'attributes':_0x14bded[_0x5694('0x16')]};}):[]};}):[]};}):[]:[]})[_0x5694('0x1b')](function(_0x58ea99){logger['info'](_0x5694('0x1c'),_0x3da74a);logger[_0x5694('0x1d')]('GetTemplate',_0x3da74a,JSON[_0x5694('0xe')](_0x58ea99));_0x572553(_0x58ea99);})['catch'](function(_0x9efcda){logger[_0x5694('0xf')](_0x5694('0x1c'),_0x9efcda['message'],_0x3da74a);_0x3eb405(_0x435dc4['error'](0x1f4,_0x9efcda[_0x5694('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 13f2ae7..ea1b491 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 _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(_0x304fdf,_0x1c0a90){var _0x354fb4=function(_0x11f111){while(--_0x11f111){_0x304fdf['push'](_0x304fdf['shift']());}};_0x354fb4(++_0x1c0a90);}(_0x2032,0xd9));var _0x2203=function(_0x4ca4fa,_0x5815cd){_0x4ca4fa=_0x4ca4fa-0x0;var _0x4732fc=_0x2032[_0x4ca4fa];return _0x4732fc;};'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 +var _0xac0e=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','isAuthenticated','index','get','/:id','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','getActions','post','create','addAnyCondition','/:id/actions','addAction','put','exports','multer','util','path','connect-timeout','express'];(function(_0x4c486a,_0x584462){var _0xc820c1=function(_0x569f9a){while(--_0x569f9a){_0x4c486a['push'](_0x4c486a['shift']());}};_0xc820c1(++_0x584462);}(_0xac0e,0x13f));var _0xeac0=function(_0x583c66,_0x5bf48f){_0x583c66=_0x583c66-0x0;var _0x1c8925=_0xac0e[_0x583c66];return _0x1c8925;};'use strict';var multer=require(_0xeac0('0x0'));var util=require(_0xeac0('0x1'));var path=require(_0xeac0('0x2'));var timeout=require(_0xeac0('0x3'));var express=require(_0xeac0('0x4'));var router=express[_0xeac0('0x5')]();var fs_extra=require(_0xeac0('0x6'));var auth=require(_0xeac0('0x7'));var interaction=require(_0xeac0('0x8'));var config=require(_0xeac0('0x9'));var controller=require(_0xeac0('0xa'));router['get']('/',auth[_0xeac0('0xb')](),controller[_0xeac0('0xc')]);router[_0xeac0('0xd')](_0xeac0('0xe'),auth[_0xeac0('0xb')](),controller['show']);router[_0xeac0('0xd')](_0xeac0('0xf'),auth[_0xeac0('0xb')](),controller[_0xeac0('0x10')]);router['get'](_0xeac0('0x11'),auth[_0xeac0('0xb')](),controller[_0xeac0('0x12')]);router[_0xeac0('0xd')]('/:id/actions',auth[_0xeac0('0xb')](),controller[_0xeac0('0x13')]);router[_0xeac0('0x14')]('/',auth[_0xeac0('0xb')](),controller[_0xeac0('0x15')]);router[_0xeac0('0x14')]('/:id/all_conditions',auth[_0xeac0('0xb')](),controller['addAllCondition']);router[_0xeac0('0x14')](_0xeac0('0x11'),auth[_0xeac0('0xb')](),controller[_0xeac0('0x16')]);router[_0xeac0('0x14')](_0xeac0('0x17'),auth['isAuthenticated'](),controller[_0xeac0('0x18')]);router[_0xeac0('0x19')](_0xeac0('0xe'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xeac0('0xb')](),controller['destroy']);module[_0xeac0('0x1a')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 91627e0..03dde92 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 _0x6a94=['STRING','BOOLEAN','sequelize','exports'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x6a94,0x122));var _0x46a9=function(_0x581649,_0x15ff8e){_0x581649=_0x581649-0x0;var _0x5122b4=_0x6a94[_0x581649];return _0x5122b4;};'use strict';var Sequelize=require(_0x46a9('0x0'));module[_0x46a9('0x1')]={'name':{'type':Sequelize[_0x46a9('0x2')]},'channel':{'type':Sequelize[_0x46a9('0x2')]},'description':{'type':Sequelize[_0x46a9('0x2')]},'status':{'type':Sequelize[_0x46a9('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x5539=['sequelize','exports','STRING','BOOLEAN'];(function(_0x4100ad,_0x2567cf){var _0x1c6db7=function(_0x1010f7){while(--_0x1010f7){_0x4100ad['push'](_0x4100ad['shift']());}};_0x1c6db7(++_0x2567cf);}(_0x5539,0x6c));var _0x9553=function(_0x3ab3b5,_0x290726){_0x3ab3b5=_0x3ab3b5-0x0;var _0x5c27d9=_0x5539[_0x3ab3b5];return _0x5c27d9;};'use strict';var Sequelize=require(_0x9553('0x0'));module[_0x9553('0x1')]={'name':{'type':Sequelize[_0x9553('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9553('0x2')]},'status':{'type':Sequelize[_0x9553('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 4e1d3ef..ff793eb 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 _0x9062=['order','sort','where','pick','filter','merge','type','options','includeAll','include','rows','catch','show','params','rawAttributes','create','body','user','find','userProfileId','autoAssociation','error','update','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','reject','save','then','destroy','get','Triggers','UserProfileResource','stack','name','map','Trigger','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x187203,_0x3ab8bb){var _0x4dc3e4=function(_0x447314){while(--_0x447314){_0x187203['push'](_0x187203['shift']());}};_0x4dc3e4(++_0x3ab8bb);}(_0x9062,0x137));var _0x2906=function(_0x23beac,_0x15437a){_0x23beac=_0x23beac-0x0;var _0x4faad9=_0x9062[_0x23beac];return _0x4faad9;};'use strict';var emlformat=require(_0x2906('0x0'));var rimraf=require(_0x2906('0x1'));var zipdir=require(_0x2906('0x2'));var jsonpatch=require(_0x2906('0x3'));var rp=require(_0x2906('0x4'));var moment=require(_0x2906('0x5'));var BPromise=require(_0x2906('0x6'));var Mustache=require(_0x2906('0x7'));var util=require('util');var path=require(_0x2906('0x8'));var sox=require(_0x2906('0x9'));var csv=require(_0x2906('0xa'));var ejs=require(_0x2906('0xb'));var fs=require('fs');var fs_extra=require(_0x2906('0xc'));var _=require(_0x2906('0xd'));var squel=require('squel');var crypto=require(_0x2906('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x2906('0xf'));var toCsv=require(_0x2906('0xa'));var querystring=require('querystring');var Papa=require(_0x2906('0x10'));var Redis=require(_0x2906('0x11'));var authService=require(_0x2906('0x12'));var qs=require(_0x2906('0x13'));var as=require(_0x2906('0x14'));var hardwareService=require(_0x2906('0x15'));var logger=require(_0x2906('0x16'))(_0x2906('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x82481f,_0x59fcf0){_0x59fcf0=_0x59fcf0||0xcc;return function(_0x2158b6){if(_0x2158b6){return _0x82481f[_0x2906('0x18')](_0x59fcf0);}return _0x82481f[_0x2906('0x19')](_0x59fcf0)[_0x2906('0x1a')]();};}function respondWithResult(_0x503ccd,_0x5e341f){_0x5e341f=_0x5e341f||0xc8;return function(_0x511de5){if(_0x511de5){return _0x503ccd[_0x2906('0x19')](_0x5e341f)[_0x2906('0x1b')](_0x511de5);}};}function respondWithFilteredResult(_0xa69c6a,_0x4bc581){return function(_0x33f6bc){if(_0x33f6bc){var _0x4cb025=typeof _0x4bc581['offset']===_0x2906('0x1c')&&typeof _0x4bc581['limit']===_0x2906('0x1c');var _0x55b656=_0x33f6bc['count'];var _0x17833a=_0x4cb025?0x0:_0x4bc581['offset'];var _0x1a14d5=_0x4cb025?_0x33f6bc[_0x2906('0x1d')]:_0x4bc581[_0x2906('0x1e')]+_0x4bc581[_0x2906('0x1f')];var _0x646d85;if(_0x1a14d5>=_0x55b656){_0x1a14d5=_0x55b656;_0x646d85=0xc8;}else{_0x646d85=0xce;}_0xa69c6a[_0x2906('0x19')](_0x646d85);return _0xa69c6a[_0x2906('0x20')]('Content-Range',_0x17833a+'-'+_0x1a14d5+'/'+_0x55b656)[_0x2906('0x1b')](_0x33f6bc);}return null;};}function patchUpdates(_0x3713c7){return function(_0x1ab4bf){try{jsonpatch[_0x2906('0x21')](_0x1ab4bf,_0x3713c7,!![]);}catch(_0x55a583){return BPromise[_0x2906('0x22')](_0x55a583);}return _0x1ab4bf[_0x2906('0x23')]();};}function saveUpdates(_0x4f93cc,_0x1e698d){return function(_0x5a2dbe){if(_0x5a2dbe){return _0x5a2dbe['update'](_0x4f93cc)[_0x2906('0x24')](function(_0x337349){return _0x337349;});}return null;};}function removeEntity(_0x594f32,_0x2bdb4b){return function(_0x14ddc4){if(_0x14ddc4){return _0x14ddc4[_0x2906('0x25')]()['then'](function(){var _0x304742=_0x14ddc4[_0x2906('0x26')]({'plain':!![]});var _0x457a7e=_0x2906('0x27');return db[_0x2906('0x28')]['destroy']({'where':{'type':_0x457a7e,'resourceId':_0x304742['id']}})[_0x2906('0x24')](function(){return _0x14ddc4;});})[_0x2906('0x24')](function(){_0x594f32[_0x2906('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x460aa6,_0x491e13){return function(_0x5dcf11){if(!_0x5dcf11){_0x460aa6[_0x2906('0x18')](0x194);}return _0x5dcf11;};}function handleError(_0x279c43,_0x3b88fc){_0x3b88fc=_0x3b88fc||0x1f4;return function(_0x23906d){logger['error'](_0x23906d[_0x2906('0x29')]);if(_0x23906d[_0x2906('0x2a')]){delete _0x23906d[_0x2906('0x2a')];}_0x279c43['status'](_0x3b88fc)['send'](_0x23906d);};}exports['index']=function(_0x12979a,_0xba9de1){var _0x3804e7={},_0x516d7c={},_0x1a18eb={'count':0x0,'rows':[]};var _0x240aa7=_[_0x2906('0x2b')](db[_0x2906('0x2c')]['rawAttributes'],function(_0x1f5009){return{'name':_0x1f5009[_0x2906('0x2d')],'type':_0x1f5009['type'][_0x2906('0x2e')]};});_0x516d7c[_0x2906('0x2f')]=_[_0x2906('0x2b')](_0x240aa7,_0x2906('0x2a'));_0x516d7c['query']=_[_0x2906('0x30')](_0x12979a[_0x2906('0x31')]);_0x516d7c[_0x2906('0x32')]=_[_0x2906('0x33')](_0x516d7c[_0x2906('0x2f')],_0x516d7c[_0x2906('0x31')]);_0x3804e7[_0x2906('0x34')]=_['intersection'](_0x516d7c[_0x2906('0x2f')],qs[_0x2906('0x35')](_0x12979a['query'][_0x2906('0x35')]));_0x3804e7['attributes']=_0x3804e7[_0x2906('0x34')][_0x2906('0x36')]?_0x3804e7[_0x2906('0x34')]:_0x516d7c['model'];if(!_0x12979a[_0x2906('0x31')][_0x2906('0x37')](_0x2906('0x38'))){_0x3804e7['limit']=qs[_0x2906('0x1f')](_0x12979a[_0x2906('0x31')]['limit']);_0x3804e7[_0x2906('0x1e')]=qs[_0x2906('0x1e')](_0x12979a[_0x2906('0x31')]['offset']);}_0x3804e7[_0x2906('0x39')]=qs[_0x2906('0x3a')](_0x12979a[_0x2906('0x31')][_0x2906('0x3a')]);_0x3804e7[_0x2906('0x3b')]=qs['filters'](_[_0x2906('0x3c')](_0x12979a[_0x2906('0x31')],_0x516d7c[_0x2906('0x32')]),_0x240aa7);if(_0x12979a[_0x2906('0x31')][_0x2906('0x3d')]){_0x3804e7[_0x2906('0x3b')]=_[_0x2906('0x3e')](_0x3804e7['where'],{'$or':_[_0x2906('0x2b')](_0x240aa7,function(_0x5170f1){if(_0x5170f1[_0x2906('0x3f')]!=='VIRTUAL'){var _0x33f06c={};_0x33f06c[_0x5170f1[_0x2906('0x2a')]]={'$like':'%'+_0x12979a[_0x2906('0x31')]['filter']+'%'};return _0x33f06c;}})});}_0x3804e7=_['merge']({},_0x3804e7,_0x12979a[_0x2906('0x40')]);var _0x5b0eaa={'where':_0x3804e7[_0x2906('0x3b')]};return db[_0x2906('0x2c')][_0x2906('0x1d')](_0x5b0eaa)[_0x2906('0x24')](function(_0xcd3427){_0x1a18eb['count']=_0xcd3427;if(_0x12979a[_0x2906('0x31')][_0x2906('0x41')]){_0x3804e7[_0x2906('0x42')]=[{'all':!![]}];}return db[_0x2906('0x2c')]['findAll'](_0x3804e7);})[_0x2906('0x24')](function(_0x5a97bc){_0x1a18eb[_0x2906('0x43')]=_0x5a97bc;return _0x1a18eb;})[_0x2906('0x24')](respondWithFilteredResult(_0xba9de1,_0x3804e7))[_0x2906('0x44')](handleError(_0xba9de1,null));};exports[_0x2906('0x45')]=function(_0x2b62d9,_0x5a18c0){var _0xe1b5c4={'raw':![],'where':{'id':_0x2b62d9[_0x2906('0x46')]['id']}},_0x298bce={};_0x298bce[_0x2906('0x2f')]=_['keys'](db[_0x2906('0x2c')][_0x2906('0x47')]);_0x298bce[_0x2906('0x31')]=_[_0x2906('0x30')](_0x2b62d9['query']);_0x298bce['filters']=_[_0x2906('0x33')](_0x298bce[_0x2906('0x2f')],_0x298bce[_0x2906('0x31')]);_0xe1b5c4[_0x2906('0x34')]=_[_0x2906('0x33')](_0x298bce[_0x2906('0x2f')],qs[_0x2906('0x35')](_0x2b62d9['query'][_0x2906('0x35')]));_0xe1b5c4[_0x2906('0x34')]=_0xe1b5c4[_0x2906('0x34')]['length']?_0xe1b5c4[_0x2906('0x34')]:_0x298bce[_0x2906('0x2f')];if(_0x2b62d9[_0x2906('0x31')][_0x2906('0x41')]){_0xe1b5c4['include']=[{'all':!![]}];}_0xe1b5c4=_[_0x2906('0x3e')]({},_0xe1b5c4,_0x2b62d9[_0x2906('0x40')]);return db['Trigger']['find'](_0xe1b5c4)['then'](handleEntityNotFound(_0x5a18c0,null))[_0x2906('0x24')](respondWithResult(_0x5a18c0,null))[_0x2906('0x44')](handleError(_0x5a18c0,null));};exports[_0x2906('0x48')]=function(_0x492a6c,_0x575428){return db[_0x2906('0x2c')]['create'](_0x492a6c[_0x2906('0x49')],{})[_0x2906('0x24')](function(_0x494dd1){var _0xf192fe=_0x492a6c['user'][_0x2906('0x26')]({'plain':!![]});if(!_0xf192fe)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xf192fe['role']===_0x2906('0x4a')){var _0x59dc3a=_0x494dd1[_0x2906('0x26')]({'plain':!![]});var _0x39a547=_0x2906('0x27');return db['UserProfileSection'][_0x2906('0x4b')]({'where':{'name':_0x39a547,'userProfileId':_0xf192fe[_0x2906('0x4c')]},'raw':!![]})[_0x2906('0x24')](function(_0x5080cf){if(_0x5080cf&&_0x5080cf[_0x2906('0x4d')]===0x0){return db[_0x2906('0x28')][_0x2906('0x48')]({'name':_0x59dc3a[_0x2906('0x2a')],'resourceId':_0x59dc3a['id'],'type':_0x5080cf['name'],'sectionId':_0x5080cf['id']},{})[_0x2906('0x24')](function(){return _0x494dd1;});}else{return _0x494dd1;}})[_0x2906('0x44')](function(_0x59dee9){logger[_0x2906('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x59dee9);throw _0x59dee9;});}return _0x494dd1;})[_0x2906('0x24')](respondWithResult(_0x575428,0xc9))[_0x2906('0x44')](handleError(_0x575428,null));};exports[_0x2906('0x4f')]=function(_0x321f27,_0x15fa03){if(_0x321f27[_0x2906('0x49')]['id']){delete _0x321f27[_0x2906('0x49')]['id'];}return db['Trigger'][_0x2906('0x4b')]({'where':{'id':_0x321f27[_0x2906('0x46')]['id']}})[_0x2906('0x24')](handleEntityNotFound(_0x15fa03,null))[_0x2906('0x24')](saveUpdates(_0x321f27[_0x2906('0x49')],null))[_0x2906('0x24')](respondWithResult(_0x15fa03,null))[_0x2906('0x44')](handleError(_0x15fa03,null));};exports[_0x2906('0x25')]=function(_0x3f857e,_0x5dfac2){return db['Trigger'][_0x2906('0x4b')]({'where':{'id':_0x3f857e[_0x2906('0x46')]['id']}})[_0x2906('0x24')](handleEntityNotFound(_0x5dfac2,null))[_0x2906('0x24')](removeEntity(_0x5dfac2,null))[_0x2906('0x44')](handleError(_0x5dfac2,null));};exports[_0x2906('0x50')]=function(_0x2bbf44,_0x21a4c6,_0x8b0af1){if(_0x2bbf44[_0x2906('0x49')]['id']){delete _0x2bbf44[_0x2906('0x49')]['id'];}return db[_0x2906('0x2c')][_0x2906('0x4b')]({'where':{'id':_0x2bbf44[_0x2906('0x46')]['id']}})[_0x2906('0x24')](handleEntityNotFound(_0x21a4c6,null))[_0x2906('0x24')](function(_0x25d669){if(_0x25d669){_0x2bbf44[_0x2906('0x49')][_0x2906('0x51')]=_0x25d669['id'];return db[_0x2906('0x52')][_0x2906('0x48')](_0x2bbf44[_0x2906('0x49')]);}})['then'](respondWithResult(_0x21a4c6,null))[_0x2906('0x44')](handleError(_0x21a4c6,null));};exports[_0x2906('0x53')]=function(_0x4342bf,_0x346c8a,_0x1c4e53){if(_0x4342bf[_0x2906('0x49')]['id']){delete _0x4342bf[_0x2906('0x49')]['id'];}return db[_0x2906('0x2c')][_0x2906('0x4b')]({'where':{'id':_0x4342bf[_0x2906('0x46')]['id']}})[_0x2906('0x24')](handleEntityNotFound(_0x346c8a,null))['then'](function(_0x3a2572){if(_0x3a2572){_0x4342bf[_0x2906('0x49')][_0x2906('0x54')]=_0x3a2572['id'];return db[_0x2906('0x52')][_0x2906('0x48')](_0x4342bf[_0x2906('0x49')]);}})['then'](respondWithResult(_0x346c8a,null))[_0x2906('0x44')](handleError(_0x346c8a,null));};exports[_0x2906('0x55')]=function(_0x5ba134,_0x24bbe3,_0x224f53){var _0x1f054e={};var _0x2d3a14={};var _0x3430e4;var _0x1122fb;return db[_0x2906('0x2c')][_0x2906('0x56')]({'where':{'id':_0x5ba134['params']['id']}})[_0x2906('0x24')](handleEntityNotFound(_0x24bbe3,null))[_0x2906('0x24')](function(_0x175694){if(_0x175694){_0x3430e4=_0x175694;_0x2d3a14[_0x2906('0x2f')]=_[_0x2906('0x30')](db[_0x2906('0x52')][_0x2906('0x47')]);_0x2d3a14['query']=_[_0x2906('0x30')](_0x5ba134[_0x2906('0x31')]);_0x2d3a14[_0x2906('0x32')]=_[_0x2906('0x33')](_0x2d3a14[_0x2906('0x2f')],_0x2d3a14[_0x2906('0x31')]);_0x1f054e[_0x2906('0x34')]=_[_0x2906('0x33')](_0x2d3a14[_0x2906('0x2f')],qs[_0x2906('0x35')](_0x5ba134['query'][_0x2906('0x35')]));_0x1f054e[_0x2906('0x34')]=_0x1f054e[_0x2906('0x34')]['length']?_0x1f054e[_0x2906('0x34')]:_0x2d3a14['model'];_0x1f054e['order']=qs[_0x2906('0x3a')](_0x5ba134[_0x2906('0x31')]['sort']);_0x1f054e[_0x2906('0x3b')]=qs[_0x2906('0x32')](_[_0x2906('0x3c')](_0x5ba134['query'],_0x2d3a14[_0x2906('0x32')]));if(_0x5ba134[_0x2906('0x31')]['filter']){_0x1f054e[_0x2906('0x3b')]=_[_0x2906('0x3e')](_0x1f054e['where'],{'$or':_[_0x2906('0x2b')](_0x1f054e[_0x2906('0x34')],function(_0x5bebc9){var _0x3cf19e={};_0x3cf19e[_0x5bebc9]={'$like':'%'+_0x5ba134['query']['filter']+'%'};return _0x3cf19e;})});}_0x1f054e=_[_0x2906('0x3e')]({},_0x1f054e,_0x5ba134[_0x2906('0x40')]);return _0x3430e4[_0x2906('0x55')](_0x1f054e);}})['then'](function(_0x5e424b){if(_0x5e424b){_0x1122fb=_0x5e424b[_0x2906('0x36')];if(!_0x5ba134['query'][_0x2906('0x37')](_0x2906('0x38'))){_0x1f054e[_0x2906('0x1f')]=qs[_0x2906('0x1f')](_0x5ba134[_0x2906('0x31')][_0x2906('0x1f')]);_0x1f054e[_0x2906('0x1e')]=qs['offset'](_0x5ba134[_0x2906('0x31')]['offset']);}return _0x3430e4[_0x2906('0x55')](_0x1f054e);}})[_0x2906('0x24')](function(_0x3d5b19){if(_0x3d5b19){return _0x3d5b19?{'count':_0x1122fb,'rows':_0x3d5b19}:null;}})['then'](respondWithResult(_0x24bbe3,null))[_0x2906('0x44')](handleError(_0x24bbe3,null));};exports[_0x2906('0x57')]=function(_0x10eaa2,_0x4dc638,_0x1b7b27){var _0x3cb64c={};var _0x54dd4d={};var _0x15c37d;var _0x1aba51;return db[_0x2906('0x2c')][_0x2906('0x56')]({'where':{'id':_0x10eaa2[_0x2906('0x46')]['id']}})['then'](handleEntityNotFound(_0x4dc638,null))[_0x2906('0x24')](function(_0x2fba60){if(_0x2fba60){_0x15c37d=_0x2fba60;_0x54dd4d['model']=_[_0x2906('0x30')](db[_0x2906('0x52')][_0x2906('0x47')]);_0x54dd4d[_0x2906('0x31')]=_[_0x2906('0x30')](_0x10eaa2[_0x2906('0x31')]);_0x54dd4d[_0x2906('0x32')]=_[_0x2906('0x33')](_0x54dd4d[_0x2906('0x2f')],_0x54dd4d[_0x2906('0x31')]);_0x3cb64c['attributes']=_['intersection'](_0x54dd4d[_0x2906('0x2f')],qs['fields'](_0x10eaa2['query'][_0x2906('0x35')]));_0x3cb64c['attributes']=_0x3cb64c[_0x2906('0x34')][_0x2906('0x36')]?_0x3cb64c[_0x2906('0x34')]:_0x54dd4d[_0x2906('0x2f')];_0x3cb64c['order']=qs['sort'](_0x10eaa2['query']['sort']);_0x3cb64c[_0x2906('0x3b')]=qs[_0x2906('0x32')](_['pick'](_0x10eaa2[_0x2906('0x31')],_0x54dd4d['filters']));if(_0x10eaa2[_0x2906('0x31')][_0x2906('0x3d')]){_0x3cb64c[_0x2906('0x3b')]=_[_0x2906('0x3e')](_0x3cb64c[_0x2906('0x3b')],{'$or':_[_0x2906('0x2b')](_0x3cb64c[_0x2906('0x34')],function(_0x3ba3bd){var _0x211d8c={};_0x211d8c[_0x3ba3bd]={'$like':'%'+_0x10eaa2[_0x2906('0x31')][_0x2906('0x3d')]+'%'};return _0x211d8c;})});}_0x3cb64c=_[_0x2906('0x3e')]({},_0x3cb64c,_0x10eaa2['options']);return _0x15c37d['getAnyConditions'](_0x3cb64c);}})[_0x2906('0x24')](function(_0x36de42){if(_0x36de42){_0x1aba51=_0x36de42[_0x2906('0x36')];if(!_0x10eaa2['query'][_0x2906('0x37')]('nolimit')){_0x3cb64c['limit']=qs[_0x2906('0x1f')](_0x10eaa2[_0x2906('0x31')]['limit']);_0x3cb64c[_0x2906('0x1e')]=qs['offset'](_0x10eaa2[_0x2906('0x31')]['offset']);}return _0x15c37d[_0x2906('0x57')](_0x3cb64c);}})['then'](function(_0x27bd30){if(_0x27bd30){return _0x27bd30?{'count':_0x1aba51,'rows':_0x27bd30}:null;}})['then'](respondWithResult(_0x4dc638,null))['catch'](handleError(_0x4dc638,null));};exports[_0x2906('0x58')]=function(_0x488de4,_0x2e92bc,_0x65a21a){if(_0x488de4[_0x2906('0x49')]['id']){delete _0x488de4[_0x2906('0x49')]['id'];}return db[_0x2906('0x2c')][_0x2906('0x4b')]({'where':{'id':_0x488de4[_0x2906('0x46')]['id']}})[_0x2906('0x24')](handleEntityNotFound(_0x2e92bc,null))[_0x2906('0x24')](function(_0x329889){if(_0x329889){_0x488de4[_0x2906('0x49')][_0x2906('0x59')]=_0x329889['id'];return db[_0x2906('0x5a')][_0x2906('0x48')](_0x488de4[_0x2906('0x49')]);}})[_0x2906('0x24')](respondWithResult(_0x2e92bc,null))[_0x2906('0x44')](handleError(_0x2e92bc,null));};exports['getActions']=function(_0x2727c3,_0x25795f,_0x203e87){var _0x247c1b={};var _0x5ca903={};var _0x413dc2;var _0x314792;return db[_0x2906('0x2c')][_0x2906('0x56')]({'where':{'id':_0x2727c3[_0x2906('0x46')]['id']}})['then'](handleEntityNotFound(_0x25795f,null))['then'](function(_0x5f1509){if(_0x5f1509){_0x413dc2=_0x5f1509;_0x5ca903['model']=_[_0x2906('0x30')](db[_0x2906('0x5a')]['rawAttributes']);_0x5ca903['query']=_[_0x2906('0x30')](_0x2727c3[_0x2906('0x31')]);_0x5ca903[_0x2906('0x32')]=_['intersection'](_0x5ca903[_0x2906('0x2f')],_0x5ca903[_0x2906('0x31')]);_0x247c1b[_0x2906('0x34')]=_[_0x2906('0x33')](_0x5ca903[_0x2906('0x2f')],qs[_0x2906('0x35')](_0x2727c3['query'][_0x2906('0x35')]));_0x247c1b[_0x2906('0x34')]=_0x247c1b[_0x2906('0x34')][_0x2906('0x36')]?_0x247c1b[_0x2906('0x34')]:_0x5ca903['model'];_0x247c1b[_0x2906('0x39')]=qs['sort'](_0x2727c3['query'][_0x2906('0x3a')]);_0x247c1b['where']=qs[_0x2906('0x32')](_[_0x2906('0x3c')](_0x2727c3[_0x2906('0x31')],_0x5ca903[_0x2906('0x32')]));if(_0x2727c3[_0x2906('0x31')][_0x2906('0x3d')]){_0x247c1b[_0x2906('0x3b')]=_[_0x2906('0x3e')](_0x247c1b[_0x2906('0x3b')],{'$or':_[_0x2906('0x2b')](_0x247c1b['attributes'],function(_0xf1150d){var _0x5489e6={};_0x5489e6[_0xf1150d]={'$like':'%'+_0x2727c3[_0x2906('0x31')][_0x2906('0x3d')]+'%'};return _0x5489e6;})});}_0x247c1b=_['merge']({},_0x247c1b,_0x2727c3[_0x2906('0x40')]);return _0x413dc2['getActions'](_0x247c1b);}})[_0x2906('0x24')](function(_0x5c9d2a){if(_0x5c9d2a){_0x314792=_0x5c9d2a[_0x2906('0x36')];if(!_0x2727c3[_0x2906('0x31')][_0x2906('0x37')](_0x2906('0x38'))){_0x247c1b[_0x2906('0x1f')]=qs['limit'](_0x2727c3['query'][_0x2906('0x1f')]);_0x247c1b[_0x2906('0x1e')]=qs['offset'](_0x2727c3['query'][_0x2906('0x1e')]);}return _0x413dc2[_0x2906('0x5b')](_0x247c1b);}})['then'](function(_0x21e2f2){if(_0x21e2f2){return _0x21e2f2?{'count':_0x314792,'rows':_0x21e2f2}:null;}})[_0x2906('0x24')](respondWithResult(_0x25795f,null))[_0x2906('0x44')](handleError(_0x25795f,null));}; \ No newline at end of file +var _0x985d=['apply','reject','save','update','then','destroy','get','Triggers','UserProfileResource','end','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','Trigger','includeAll','include','findAll','rows','catch','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','findOne','pick','getAllConditions','getAnyConditions','order','addAction','Action','getActions','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range'];(function(_0x1e6b15,_0x279531){var _0x2380f6=function(_0x485d87){while(--_0x485d87){_0x1e6b15['push'](_0x1e6b15['shift']());}};_0x2380f6(++_0x279531);}(_0x985d,0x169));var _0xd985=function(_0x1bee7,_0x349839){_0x1bee7=_0x1bee7-0x0;var _0x583b6f=_0x985d[_0x1bee7];return _0x583b6f;};'use strict';var emlformat=require(_0xd985('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd985('0x1'));var jsonpatch=require(_0xd985('0x2'));var rp=require(_0xd985('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd985('0x4'));var util=require(_0xd985('0x5'));var path=require(_0xd985('0x6'));var sox=require(_0xd985('0x7'));var csv=require('to-csv');var ejs=require(_0xd985('0x8'));var fs=require('fs');var fs_extra=require(_0xd985('0x9'));var _=require(_0xd985('0xa'));var squel=require(_0xd985('0xb'));var crypto=require(_0xd985('0xc'));var jsforce=require(_0xd985('0xd'));var deskjs=require(_0xd985('0xe'));var toCsv=require(_0xd985('0xf'));var querystring=require(_0xd985('0x10'));var Papa=require(_0xd985('0x11'));var Redis=require(_0xd985('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd985('0x13'));var as=require(_0xd985('0x14'));var hardwareService=require(_0xd985('0x15'));var logger=require(_0xd985('0x16'))('api');var utils=require(_0xd985('0x17'));var config=require(_0xd985('0x18'));var licenseUtil=require(_0xd985('0x19'));var db=require(_0xd985('0x1a'))['db'];function respondWithStatusCode(_0x55eb4a,_0x3049db){_0x3049db=_0x3049db||0xcc;return function(_0x1479e0){if(_0x1479e0){return _0x55eb4a[_0xd985('0x1b')](_0x3049db);}return _0x55eb4a[_0xd985('0x1c')](_0x3049db)['end']();};}function respondWithResult(_0x8827e2,_0x53d946){_0x53d946=_0x53d946||0xc8;return function(_0xe46739){if(_0xe46739){return _0x8827e2['status'](_0x53d946)[_0xd985('0x1d')](_0xe46739);}};}function respondWithFilteredResult(_0x5468a0,_0x1ab177){return function(_0x1db437){if(_0x1db437){var _0x22808e=typeof _0x1ab177['offset']==='undefined'&&typeof _0x1ab177['limit']==='undefined';var _0x2bad8f=_0x1db437[_0xd985('0x1e')];var _0x1cfa64=_0x22808e?0x0:_0x1ab177[_0xd985('0x1f')];var _0x1c9852=_0x22808e?_0x1db437[_0xd985('0x1e')]:_0x1ab177[_0xd985('0x1f')]+_0x1ab177[_0xd985('0x20')];var _0x34b3b0;if(_0x1c9852>=_0x2bad8f){_0x1c9852=_0x2bad8f;_0x34b3b0=0xc8;}else{_0x34b3b0=0xce;}_0x5468a0[_0xd985('0x1c')](_0x34b3b0);return _0x5468a0[_0xd985('0x21')](_0xd985('0x22'),_0x1cfa64+'-'+_0x1c9852+'/'+_0x2bad8f)['json'](_0x1db437);}return null;};}function patchUpdates(_0x447aa7){return function(_0xf7e41){try{jsonpatch[_0xd985('0x23')](_0xf7e41,_0x447aa7,!![]);}catch(_0x3b2545){return BPromise[_0xd985('0x24')](_0x3b2545);}return _0xf7e41[_0xd985('0x25')]();};}function saveUpdates(_0x3d133b,_0x167659){return function(_0x5e14e1){if(_0x5e14e1){return _0x5e14e1[_0xd985('0x26')](_0x3d133b)[_0xd985('0x27')](function(_0x510ee8){return _0x510ee8;});}return null;};}function removeEntity(_0xc19b4b,_0x24ac6f){return function(_0x9e2fdb){if(_0x9e2fdb){return _0x9e2fdb[_0xd985('0x28')]()[_0xd985('0x27')](function(){var _0x15e3e6=_0x9e2fdb[_0xd985('0x29')]({'plain':!![]});var _0x32bebe=_0xd985('0x2a');return db[_0xd985('0x2b')][_0xd985('0x28')]({'where':{'type':_0x32bebe,'resourceId':_0x15e3e6['id']}})[_0xd985('0x27')](function(){return _0x9e2fdb;});})[_0xd985('0x27')](function(){_0xc19b4b[_0xd985('0x1c')](0xcc)[_0xd985('0x2c')]();});}};}function handleEntityNotFound(_0x3ebc73,_0x142b79){return function(_0x514371){if(!_0x514371){_0x3ebc73[_0xd985('0x1b')](0x194);}return _0x514371;};}function handleError(_0x221d9b,_0x11c72f){_0x11c72f=_0x11c72f||0x1f4;return function(_0x3fdcc4){logger[_0xd985('0x2d')](_0x3fdcc4[_0xd985('0x2e')]);if(_0x3fdcc4[_0xd985('0x2f')]){delete _0x3fdcc4[_0xd985('0x2f')];}_0x221d9b['status'](_0x11c72f)['send'](_0x3fdcc4);};}exports['index']=function(_0x2b7b41,_0x515d6b){var _0x4d0289={},_0x403ac5={},_0x19c08d={'count':0x0,'rows':[]};var _0x273c3a=_[_0xd985('0x30')](db['Trigger'][_0xd985('0x31')],function(_0x227840){return{'name':_0x227840[_0xd985('0x32')],'type':_0x227840[_0xd985('0x33')][_0xd985('0x34')]};});_0x403ac5[_0xd985('0x35')]=_[_0xd985('0x30')](_0x273c3a,_0xd985('0x2f'));_0x403ac5[_0xd985('0x36')]=_[_0xd985('0x37')](_0x2b7b41[_0xd985('0x36')]);_0x403ac5[_0xd985('0x38')]=_['intersection'](_0x403ac5[_0xd985('0x35')],_0x403ac5[_0xd985('0x36')]);_0x4d0289[_0xd985('0x39')]=_[_0xd985('0x3a')](_0x403ac5['model'],qs[_0xd985('0x3b')](_0x2b7b41[_0xd985('0x36')][_0xd985('0x3b')]));_0x4d0289[_0xd985('0x39')]=_0x4d0289[_0xd985('0x39')][_0xd985('0x3c')]?_0x4d0289['attributes']:_0x403ac5[_0xd985('0x35')];if(!_0x2b7b41[_0xd985('0x36')][_0xd985('0x3d')](_0xd985('0x3e'))){_0x4d0289['limit']=qs[_0xd985('0x20')](_0x2b7b41['query']['limit']);_0x4d0289[_0xd985('0x1f')]=qs[_0xd985('0x1f')](_0x2b7b41[_0xd985('0x36')][_0xd985('0x1f')]);}_0x4d0289['order']=qs[_0xd985('0x3f')](_0x2b7b41[_0xd985('0x36')]['sort']);_0x4d0289[_0xd985('0x40')]=qs[_0xd985('0x38')](_['pick'](_0x2b7b41[_0xd985('0x36')],_0x403ac5['filters']),_0x273c3a);if(_0x2b7b41[_0xd985('0x36')][_0xd985('0x41')]){_0x4d0289['where']=_[_0xd985('0x42')](_0x4d0289[_0xd985('0x40')],{'$or':_[_0xd985('0x30')](_0x273c3a,function(_0x2fe276){if(_0x2fe276['type']!==_0xd985('0x43')){var _0x197b77={};_0x197b77[_0x2fe276[_0xd985('0x2f')]]={'$like':'%'+_0x2b7b41[_0xd985('0x36')][_0xd985('0x41')]+'%'};return _0x197b77;}})});}_0x4d0289=_[_0xd985('0x42')]({},_0x4d0289,_0x2b7b41[_0xd985('0x44')]);var _0xa6692e={'where':_0x4d0289[_0xd985('0x40')]};return db[_0xd985('0x45')][_0xd985('0x1e')](_0xa6692e)[_0xd985('0x27')](function(_0x1d1c3d){_0x19c08d[_0xd985('0x1e')]=_0x1d1c3d;if(_0x2b7b41['query'][_0xd985('0x46')]){_0x4d0289[_0xd985('0x47')]=[{'all':!![]}];}return db[_0xd985('0x45')][_0xd985('0x48')](_0x4d0289);})[_0xd985('0x27')](function(_0x5d6e15){_0x19c08d[_0xd985('0x49')]=_0x5d6e15;return _0x19c08d;})[_0xd985('0x27')](respondWithFilteredResult(_0x515d6b,_0x4d0289))[_0xd985('0x4a')](handleError(_0x515d6b,null));};exports['show']=function(_0x470311,_0x16b845){var _0x5adc98={'raw':![],'where':{'id':_0x470311['params']['id']}},_0x4baf31={};_0x4baf31[_0xd985('0x35')]=_[_0xd985('0x37')](db[_0xd985('0x45')][_0xd985('0x31')]);_0x4baf31[_0xd985('0x36')]=_['keys'](_0x470311['query']);_0x4baf31['filters']=_[_0xd985('0x3a')](_0x4baf31['model'],_0x4baf31['query']);_0x5adc98[_0xd985('0x39')]=_[_0xd985('0x3a')](_0x4baf31[_0xd985('0x35')],qs['fields'](_0x470311[_0xd985('0x36')][_0xd985('0x3b')]));_0x5adc98['attributes']=_0x5adc98[_0xd985('0x39')]['length']?_0x5adc98[_0xd985('0x39')]:_0x4baf31[_0xd985('0x35')];if(_0x470311['query']['includeAll']){_0x5adc98['include']=[{'all':!![]}];}_0x5adc98=_[_0xd985('0x42')]({},_0x5adc98,_0x470311[_0xd985('0x44')]);return db[_0xd985('0x45')][_0xd985('0x4b')](_0x5adc98)[_0xd985('0x27')](handleEntityNotFound(_0x16b845,null))[_0xd985('0x27')](respondWithResult(_0x16b845,null))[_0xd985('0x4a')](handleError(_0x16b845,null));};exports[_0xd985('0x4c')]=function(_0x516abe,_0x34c851){return db[_0xd985('0x45')]['create'](_0x516abe['body'],{})[_0xd985('0x27')](function(_0x3c18a0){var _0x3e2308=_0x516abe['user'][_0xd985('0x29')]({'plain':!![]});if(!_0x3e2308)throw new Error(_0xd985('0x4d'));if(_0x3e2308[_0xd985('0x4e')]===_0xd985('0x4f')){var _0x269745=_0x3c18a0[_0xd985('0x29')]({'plain':!![]});var _0x46bccf=_0xd985('0x2a');return db[_0xd985('0x50')]['find']({'where':{'name':_0x46bccf,'userProfileId':_0x3e2308[_0xd985('0x51')]},'raw':!![]})[_0xd985('0x27')](function(_0x2c7d58){if(_0x2c7d58&&_0x2c7d58[_0xd985('0x52')]===0x0){return db[_0xd985('0x2b')][_0xd985('0x4c')]({'name':_0x269745['name'],'resourceId':_0x269745['id'],'type':_0x2c7d58['name'],'sectionId':_0x2c7d58['id']},{})[_0xd985('0x27')](function(){return _0x3c18a0;});}else{return _0x3c18a0;}})[_0xd985('0x4a')](function(_0x589246){logger[_0xd985('0x2d')](_0xd985('0x53'),_0x589246);throw _0x589246;});}return _0x3c18a0;})[_0xd985('0x27')](respondWithResult(_0x34c851,0xc9))[_0xd985('0x4a')](handleError(_0x34c851,null));};exports['update']=function(_0x29f46c,_0x5aa386){if(_0x29f46c[_0xd985('0x54')]['id']){delete _0x29f46c[_0xd985('0x54')]['id'];}return db['Trigger']['find']({'where':{'id':_0x29f46c['params']['id']}})[_0xd985('0x27')](handleEntityNotFound(_0x5aa386,null))[_0xd985('0x27')](saveUpdates(_0x29f46c[_0xd985('0x54')],null))[_0xd985('0x27')](respondWithResult(_0x5aa386,null))[_0xd985('0x4a')](handleError(_0x5aa386,null));};exports['destroy']=function(_0x281e6c,_0x3e0f61){return db[_0xd985('0x45')][_0xd985('0x4b')]({'where':{'id':_0x281e6c[_0xd985('0x55')]['id']}})['then'](handleEntityNotFound(_0x3e0f61,null))[_0xd985('0x27')](removeEntity(_0x3e0f61,null))[_0xd985('0x4a')](handleError(_0x3e0f61,null));};exports[_0xd985('0x56')]=function(_0x12fff1,_0x2affef,_0xcb6c8e){if(_0x12fff1[_0xd985('0x54')]['id']){delete _0x12fff1[_0xd985('0x54')]['id'];}return db[_0xd985('0x45')][_0xd985('0x4b')]({'where':{'id':_0x12fff1[_0xd985('0x55')]['id']}})[_0xd985('0x27')](handleEntityNotFound(_0x2affef,null))[_0xd985('0x27')](function(_0x41c3da){if(_0x41c3da){_0x12fff1[_0xd985('0x54')][_0xd985('0x57')]=_0x41c3da['id'];return db[_0xd985('0x58')][_0xd985('0x4c')](_0x12fff1[_0xd985('0x54')]);}})[_0xd985('0x27')](respondWithResult(_0x2affef,null))[_0xd985('0x4a')](handleError(_0x2affef,null));};exports[_0xd985('0x59')]=function(_0x1c78ab,_0x16e7df,_0xed878f){if(_0x1c78ab[_0xd985('0x54')]['id']){delete _0x1c78ab[_0xd985('0x54')]['id'];}return db[_0xd985('0x45')][_0xd985('0x4b')]({'where':{'id':_0x1c78ab['params']['id']}})[_0xd985('0x27')](handleEntityNotFound(_0x16e7df,null))[_0xd985('0x27')](function(_0x3ba9fa){if(_0x3ba9fa){_0x1c78ab[_0xd985('0x54')][_0xd985('0x5a')]=_0x3ba9fa['id'];return db['Condition'][_0xd985('0x4c')](_0x1c78ab[_0xd985('0x54')]);}})[_0xd985('0x27')](respondWithResult(_0x16e7df,null))[_0xd985('0x4a')](handleError(_0x16e7df,null));};exports['getAllConditions']=function(_0x4c870a,_0x2fe421,_0xb38016){var _0x3cc6e4={};var _0x4a793f={};var _0x2d2aa9;var _0x13de02;return db[_0xd985('0x45')][_0xd985('0x5b')]({'where':{'id':_0x4c870a[_0xd985('0x55')]['id']}})[_0xd985('0x27')](handleEntityNotFound(_0x2fe421,null))[_0xd985('0x27')](function(_0x4632fa){if(_0x4632fa){_0x2d2aa9=_0x4632fa;_0x4a793f['model']=_[_0xd985('0x37')](db[_0xd985('0x58')][_0xd985('0x31')]);_0x4a793f[_0xd985('0x36')]=_['keys'](_0x4c870a[_0xd985('0x36')]);_0x4a793f[_0xd985('0x38')]=_[_0xd985('0x3a')](_0x4a793f['model'],_0x4a793f['query']);_0x3cc6e4[_0xd985('0x39')]=_[_0xd985('0x3a')](_0x4a793f[_0xd985('0x35')],qs[_0xd985('0x3b')](_0x4c870a[_0xd985('0x36')][_0xd985('0x3b')]));_0x3cc6e4[_0xd985('0x39')]=_0x3cc6e4[_0xd985('0x39')][_0xd985('0x3c')]?_0x3cc6e4[_0xd985('0x39')]:_0x4a793f[_0xd985('0x35')];_0x3cc6e4['order']=qs[_0xd985('0x3f')](_0x4c870a[_0xd985('0x36')][_0xd985('0x3f')]);_0x3cc6e4['where']=qs[_0xd985('0x38')](_[_0xd985('0x5c')](_0x4c870a[_0xd985('0x36')],_0x4a793f[_0xd985('0x38')]));if(_0x4c870a[_0xd985('0x36')][_0xd985('0x41')]){_0x3cc6e4['where']=_[_0xd985('0x42')](_0x3cc6e4[_0xd985('0x40')],{'$or':_['map'](_0x3cc6e4[_0xd985('0x39')],function(_0x33d2d6){var _0x52ea85={};_0x52ea85[_0x33d2d6]={'$like':'%'+_0x4c870a[_0xd985('0x36')][_0xd985('0x41')]+'%'};return _0x52ea85;})});}_0x3cc6e4=_[_0xd985('0x42')]({},_0x3cc6e4,_0x4c870a[_0xd985('0x44')]);return _0x2d2aa9[_0xd985('0x5d')](_0x3cc6e4);}})[_0xd985('0x27')](function(_0x10f2a3){if(_0x10f2a3){_0x13de02=_0x10f2a3[_0xd985('0x3c')];if(!_0x4c870a[_0xd985('0x36')]['hasOwnProperty']('nolimit')){_0x3cc6e4['limit']=qs[_0xd985('0x20')](_0x4c870a[_0xd985('0x36')][_0xd985('0x20')]);_0x3cc6e4['offset']=qs[_0xd985('0x1f')](_0x4c870a[_0xd985('0x36')][_0xd985('0x1f')]);}return _0x2d2aa9[_0xd985('0x5d')](_0x3cc6e4);}})[_0xd985('0x27')](function(_0x2b5616){if(_0x2b5616){return _0x2b5616?{'count':_0x13de02,'rows':_0x2b5616}:null;}})[_0xd985('0x27')](respondWithResult(_0x2fe421,null))[_0xd985('0x4a')](handleError(_0x2fe421,null));};exports[_0xd985('0x5e')]=function(_0x158f40,_0x2c829b,_0x55d316){var _0x4ef9df={};var _0x4d6336={};var _0x2084b0;var _0x305422;return db[_0xd985('0x45')][_0xd985('0x5b')]({'where':{'id':_0x158f40['params']['id']}})[_0xd985('0x27')](handleEntityNotFound(_0x2c829b,null))['then'](function(_0x88a230){if(_0x88a230){_0x2084b0=_0x88a230;_0x4d6336[_0xd985('0x35')]=_[_0xd985('0x37')](db[_0xd985('0x58')][_0xd985('0x31')]);_0x4d6336[_0xd985('0x36')]=_[_0xd985('0x37')](_0x158f40['query']);_0x4d6336[_0xd985('0x38')]=_[_0xd985('0x3a')](_0x4d6336[_0xd985('0x35')],_0x4d6336['query']);_0x4ef9df[_0xd985('0x39')]=_[_0xd985('0x3a')](_0x4d6336[_0xd985('0x35')],qs['fields'](_0x158f40['query'][_0xd985('0x3b')]));_0x4ef9df[_0xd985('0x39')]=_0x4ef9df[_0xd985('0x39')][_0xd985('0x3c')]?_0x4ef9df[_0xd985('0x39')]:_0x4d6336[_0xd985('0x35')];_0x4ef9df[_0xd985('0x5f')]=qs['sort'](_0x158f40['query'][_0xd985('0x3f')]);_0x4ef9df[_0xd985('0x40')]=qs[_0xd985('0x38')](_[_0xd985('0x5c')](_0x158f40[_0xd985('0x36')],_0x4d6336[_0xd985('0x38')]));if(_0x158f40[_0xd985('0x36')][_0xd985('0x41')]){_0x4ef9df['where']=_[_0xd985('0x42')](_0x4ef9df[_0xd985('0x40')],{'$or':_[_0xd985('0x30')](_0x4ef9df[_0xd985('0x39')],function(_0x6ff033){var _0x45dbe8={};_0x45dbe8[_0x6ff033]={'$like':'%'+_0x158f40[_0xd985('0x36')][_0xd985('0x41')]+'%'};return _0x45dbe8;})});}_0x4ef9df=_[_0xd985('0x42')]({},_0x4ef9df,_0x158f40[_0xd985('0x44')]);return _0x2084b0[_0xd985('0x5e')](_0x4ef9df);}})['then'](function(_0x3ac1bb){if(_0x3ac1bb){_0x305422=_0x3ac1bb[_0xd985('0x3c')];if(!_0x158f40[_0xd985('0x36')][_0xd985('0x3d')](_0xd985('0x3e'))){_0x4ef9df[_0xd985('0x20')]=qs[_0xd985('0x20')](_0x158f40[_0xd985('0x36')]['limit']);_0x4ef9df[_0xd985('0x1f')]=qs[_0xd985('0x1f')](_0x158f40['query'][_0xd985('0x1f')]);}return _0x2084b0[_0xd985('0x5e')](_0x4ef9df);}})['then'](function(_0x4ecca9){if(_0x4ecca9){return _0x4ecca9?{'count':_0x305422,'rows':_0x4ecca9}:null;}})[_0xd985('0x27')](respondWithResult(_0x2c829b,null))[_0xd985('0x4a')](handleError(_0x2c829b,null));};exports[_0xd985('0x60')]=function(_0x196e71,_0x2236d3,_0x430a29){if(_0x196e71['body']['id']){delete _0x196e71[_0xd985('0x54')]['id'];}return db[_0xd985('0x45')][_0xd985('0x4b')]({'where':{'id':_0x196e71[_0xd985('0x55')]['id']}})[_0xd985('0x27')](handleEntityNotFound(_0x2236d3,null))[_0xd985('0x27')](function(_0x49f5d7){if(_0x49f5d7){_0x196e71[_0xd985('0x54')]['TriggerId']=_0x49f5d7['id'];return db[_0xd985('0x61')][_0xd985('0x4c')](_0x196e71[_0xd985('0x54')]);}})[_0xd985('0x27')](respondWithResult(_0x2236d3,null))[_0xd985('0x4a')](handleError(_0x2236d3,null));};exports[_0xd985('0x62')]=function(_0x157859,_0x121bb0,_0x3ac44d){var _0x481253={};var _0x97b19e={};var _0x1b6dea;var _0x1f2187;return db['Trigger'][_0xd985('0x5b')]({'where':{'id':_0x157859[_0xd985('0x55')]['id']}})[_0xd985('0x27')](handleEntityNotFound(_0x121bb0,null))['then'](function(_0x49096f){if(_0x49096f){_0x1b6dea=_0x49096f;_0x97b19e['model']=_['keys'](db[_0xd985('0x61')]['rawAttributes']);_0x97b19e[_0xd985('0x36')]=_['keys'](_0x157859[_0xd985('0x36')]);_0x97b19e[_0xd985('0x38')]=_[_0xd985('0x3a')](_0x97b19e[_0xd985('0x35')],_0x97b19e[_0xd985('0x36')]);_0x481253[_0xd985('0x39')]=_[_0xd985('0x3a')](_0x97b19e[_0xd985('0x35')],qs[_0xd985('0x3b')](_0x157859[_0xd985('0x36')]['fields']));_0x481253[_0xd985('0x39')]=_0x481253[_0xd985('0x39')]['length']?_0x481253['attributes']:_0x97b19e['model'];_0x481253[_0xd985('0x5f')]=qs[_0xd985('0x3f')](_0x157859['query'][_0xd985('0x3f')]);_0x481253[_0xd985('0x40')]=qs['filters'](_[_0xd985('0x5c')](_0x157859[_0xd985('0x36')],_0x97b19e[_0xd985('0x38')]));if(_0x157859[_0xd985('0x36')][_0xd985('0x41')]){_0x481253[_0xd985('0x40')]=_[_0xd985('0x42')](_0x481253['where'],{'$or':_[_0xd985('0x30')](_0x481253[_0xd985('0x39')],function(_0x468d7a){var _0x1d0c89={};_0x1d0c89[_0x468d7a]={'$like':'%'+_0x157859[_0xd985('0x36')]['filter']+'%'};return _0x1d0c89;})});}_0x481253=_[_0xd985('0x42')]({},_0x481253,_0x157859['options']);return _0x1b6dea[_0xd985('0x62')](_0x481253);}})[_0xd985('0x27')](function(_0x47746c){if(_0x47746c){_0x1f2187=_0x47746c['length'];if(!_0x157859['query']['hasOwnProperty']('nolimit')){_0x481253[_0xd985('0x20')]=qs['limit'](_0x157859[_0xd985('0x36')][_0xd985('0x20')]);_0x481253[_0xd985('0x1f')]=qs[_0xd985('0x1f')](_0x157859['query'][_0xd985('0x1f')]);}return _0x1b6dea[_0xd985('0x62')](_0x481253);}})[_0xd985('0x27')](function(_0x4dd20b){if(_0x4dd20b){return _0x4dd20b?{'count':_0x1f2187,'rows':_0x4dd20b}:null;}})[_0xd985('0x27')](respondWithResult(_0x121bb0,null))[_0xd985('0x4a')](handleError(_0x121bb0,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 1bf5398..ac07e60 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 _0xa98d=['moment','bluebird','path','rimraf','../../config/environment','exports','define','Trigger','tools_triggers','lodash','../../config/logger'];(function(_0x19141d,_0x11f5da){var _0x298310=function(_0x2e855b){while(--_0x2e855b){_0x19141d['push'](_0x19141d['shift']());}};_0x298310(++_0x11f5da);}(_0xa98d,0xa3));var _0xda98=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa98d[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xda98('0x0'));var util=require('util');var logger=require(_0xda98('0x1'))('api');var moment=require(_0xda98('0x2'));var BPromise=require(_0xda98('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xda98('0x4'));var rimraf=require(_0xda98('0x5'));var config=require(_0xda98('0x6'));var attributes=require('./trigger.attributes');module[_0xda98('0x7')]=function(_0x39acbf,_0x218e43){return _0x39acbf[_0xda98('0x8')](_0xda98('0x9'),attributes,{'tableName':_0xda98('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe062=['moment','bluebird','rimraf','../../config/environment','tools_triggers','lodash','util','api'];(function(_0x123532,_0xc71b20){var _0x13f8a6=function(_0x4d726){while(--_0x4d726){_0x123532['push'](_0x123532['shift']());}};_0x13f8a6(++_0xc71b20);}(_0xe062,0xd5));var _0x2e06=function(_0x250947,_0x157b9d){_0x250947=_0x250947-0x0;var _0x4471fb=_0xe062[_0x250947];return _0x4471fb;};'use strict';var _=require(_0x2e06('0x0'));var util=require(_0x2e06('0x1'));var logger=require('../../config/logger')(_0x2e06('0x2'));var moment=require(_0x2e06('0x3'));var BPromise=require(_0x2e06('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2e06('0x5'));var config=require(_0x2e06('0x6'));var attributes=require('./trigger.attributes');module['exports']=function(_0x912daf,_0x31d2a3){return _0x912daf['define']('Trigger',attributes,{'tableName':_0x2e06('0x7'),'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 9d79e5f..5efe626 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 _0x5729=['rpc','../../config/environment','jayson/promise','http','then','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetTrigger','Trigger','options','raw','where','attributes','limit','include','model','map','catch','find','ShowTrigger','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x29d7f2,_0x523803){var _0x4295c7=function(_0x3220b9){while(--_0x3220b9){_0x29d7f2['push'](_0x29d7f2['shift']());}};_0x4295c7(++_0x523803);}(_0x5729,0xe8));var _0x9572=function(_0x5da01c,_0x53bf77){_0x5da01c=_0x5da01c-0x0;var _0x1216c2=_0x5729[_0x5da01c];return _0x1216c2;};'use strict';var _=require(_0x9572('0x0'));var util=require(_0x9572('0x1'));var moment=require('moment');var BPromise=require(_0x9572('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9572('0x3'));var db=require(_0x9572('0x4'))['db'];var utils=require(_0x9572('0x5'));var logger=require('../../config/logger')(_0x9572('0x6'));var config=require(_0x9572('0x7'));var jayson=require(_0x9572('0x8'));var client=jayson['client'][_0x9572('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x151301,_0x9e5746,_0x5e823a){return new BPromise(function(_0x33d7fe,_0x60fb4f){return client['request'](_0x151301,_0x5e823a)[_0x9572('0xa')](function(_0x51792d){logger['info'](_0x9572('0xb'),_0x9e5746,_0x9572('0xc'));logger[_0x9572('0xd')](_0x9572('0xe'),_0x9e5746,'request\x20sent',JSON[_0x9572('0xf')](_0x51792d));if(_0x51792d[_0x9572('0x10')]){if(_0x51792d[_0x9572('0x10')][_0x9572('0x11')]===0x1f4){logger[_0x9572('0x10')](_0x9572('0xb'),_0x9e5746,_0x51792d['error'][_0x9572('0x12')]);return _0x60fb4f(_0x51792d[_0x9572('0x10')]['message']);}logger[_0x9572('0x10')](_0x9572('0xb'),_0x9e5746,_0x51792d['error'][_0x9572('0x12')]);return _0x33d7fe(_0x51792d[_0x9572('0x10')][_0x9572('0x12')]);}else{logger[_0x9572('0x13')]('Trigger,\x20%s,\x20%s',_0x9e5746,_0x9572('0xc'));_0x33d7fe(_0x51792d[_0x9572('0x14')][_0x9572('0x12')]);}})['catch'](function(_0x5a99cb){logger['error'](_0x9572('0xb'),_0x9e5746,_0x5a99cb);_0x60fb4f(_0x5a99cb);});});}exports[_0x9572('0x15')]=function(_0x542bb0){var _0x5b219a=this;return new Promise(function(_0x284b43,_0x150566){return db[_0x9572('0x16')]['findAll']({'raw':_0x542bb0[_0x9572('0x17')]?_0x542bb0['options'][_0x9572('0x18')]===undefined?!![]:![]:!![],'where':_0x542bb0['options']?_0x542bb0[_0x9572('0x17')][_0x9572('0x19')]||null:null,'attributes':_0x542bb0['options']?_0x542bb0[_0x9572('0x17')][_0x9572('0x1a')]||null:null,'limit':_0x542bb0[_0x9572('0x17')]?_0x542bb0['options'][_0x9572('0x1b')]||null:null,'include':_0x542bb0[_0x9572('0x17')]?_0x542bb0[_0x9572('0x17')]['include']?_['map'](_0x542bb0['options'][_0x9572('0x1c')],function(_0x5e7b9c){return{'model':db[_0x5e7b9c[_0x9572('0x1d')]],'as':_0x5e7b9c['as'],'attributes':_0x5e7b9c[_0x9572('0x1a')],'include':_0x5e7b9c[_0x9572('0x1c')]?_[_0x9572('0x1e')](_0x5e7b9c[_0x9572('0x1c')],function(_0x2e8c57){return{'model':db[_0x2e8c57[_0x9572('0x1d')]],'as':_0x2e8c57['as'],'attributes':_0x2e8c57[_0x9572('0x1a')],'include':_0x2e8c57[_0x9572('0x1c')]?_[_0x9572('0x1e')](_0x2e8c57[_0x9572('0x1c')],function(_0x5c229f){return{'model':db[_0x5c229f[_0x9572('0x1d')]],'as':_0x5c229f['as'],'attributes':_0x5c229f[_0x9572('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x9572('0xa')](function(_0x1c14ba){logger[_0x9572('0x13')](_0x9572('0x15'),_0x542bb0);logger['debug'](_0x9572('0x15'),_0x542bb0,JSON[_0x9572('0xf')](_0x1c14ba));_0x284b43(_0x1c14ba);})[_0x9572('0x1f')](function(_0x23e08){logger['error'](_0x9572('0x15'),_0x23e08[_0x9572('0x12')],_0x542bb0);_0x150566(_0x5b219a[_0x9572('0x10')](0x1f4,_0x23e08[_0x9572('0x12')]));});});};exports['ShowTrigger']=function(_0x391728){var _0x535377=this;return new Promise(function(_0x452cde,_0x1a76e1){return db[_0x9572('0x16')][_0x9572('0x20')]({'raw':_0x391728[_0x9572('0x17')]?_0x391728['options']['raw']===undefined?!![]:![]:!![],'where':_0x391728['options']?_0x391728[_0x9572('0x17')][_0x9572('0x19')]||null:null,'attributes':_0x391728[_0x9572('0x17')]?_0x391728[_0x9572('0x17')][_0x9572('0x1a')]||null:null,'include':_0x391728[_0x9572('0x17')]?_0x391728[_0x9572('0x17')]['include']?_[_0x9572('0x1e')](_0x391728[_0x9572('0x17')][_0x9572('0x1c')],function(_0x31258){return{'model':db[_0x31258[_0x9572('0x1d')]],'as':_0x31258['as'],'attributes':_0x31258[_0x9572('0x1a')],'include':_0x31258[_0x9572('0x1c')]?_[_0x9572('0x1e')](_0x31258['include'],function(_0x1c9825){return{'model':db[_0x1c9825[_0x9572('0x1d')]],'as':_0x1c9825['as'],'attributes':_0x1c9825[_0x9572('0x1a')],'include':_0x1c9825[_0x9572('0x1c')]?_[_0x9572('0x1e')](_0x1c9825[_0x9572('0x1c')],function(_0x48c39b){return{'model':db[_0x48c39b[_0x9572('0x1d')]],'as':_0x48c39b['as'],'attributes':_0x48c39b[_0x9572('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x9572('0xa')](function(_0x2a8f8f){logger[_0x9572('0x13')](_0x9572('0x21'),_0x391728);logger[_0x9572('0xd')]('ShowTrigger',_0x391728,JSON[_0x9572('0xf')](_0x2a8f8f));_0x452cde(_0x2a8f8f);})[_0x9572('0x1f')](function(_0xbf8857){logger[_0x9572('0x10')]('ShowTrigger',_0xbf8857[_0x9572('0x12')],_0x391728);_0x1a76e1(_0x535377['error'](0x1f4,_0xbf8857[_0x9572('0x12')]));});});}; \ No newline at end of file +var _0x7ea9=['Trigger','findAll','options','raw','where','attributes','limit','include','model','map','then','debug','ShowTrigger','find','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetTrigger'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7ea9,0xec));var _0x97ea=function(_0x27a5d2,_0x3032b6){_0x27a5d2=_0x27a5d2-0x0;var _0x3d1c96=_0x7ea9[_0x27a5d2];return _0x3d1c96;};'use strict';var _=require('lodash');var util=require(_0x97ea('0x0'));var moment=require(_0x97ea('0x1'));var BPromise=require(_0x97ea('0x2'));var rs=require(_0x97ea('0x3'));var fs=require('fs');var Redis=require(_0x97ea('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x97ea('0x5'));var logger=require(_0x97ea('0x6'))(_0x97ea('0x7'));var config=require('../../config/environment');var jayson=require(_0x97ea('0x8'));var client=jayson[_0x97ea('0x9')][_0x97ea('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17209a,_0x517067,_0x41fb15){return new BPromise(function(_0x424a73,_0x4af95f){return client[_0x97ea('0xb')](_0x17209a,_0x41fb15)['then'](function(_0x179953){logger['info'](_0x97ea('0xc'),_0x517067,_0x97ea('0xd'));logger['debug'](_0x97ea('0xe'),_0x517067,_0x97ea('0xd'),JSON[_0x97ea('0xf')](_0x179953));if(_0x179953[_0x97ea('0x10')]){if(_0x179953[_0x97ea('0x10')][_0x97ea('0x11')]===0x1f4){logger[_0x97ea('0x10')](_0x97ea('0xc'),_0x517067,_0x179953[_0x97ea('0x10')][_0x97ea('0x12')]);return _0x4af95f(_0x179953['error'][_0x97ea('0x12')]);}logger[_0x97ea('0x10')]('Trigger,\x20%s,\x20%s',_0x517067,_0x179953[_0x97ea('0x10')][_0x97ea('0x12')]);return _0x424a73(_0x179953[_0x97ea('0x10')]['message']);}else{logger[_0x97ea('0x13')](_0x97ea('0xc'),_0x517067,'request\x20sent');_0x424a73(_0x179953[_0x97ea('0x14')]['message']);}})[_0x97ea('0x15')](function(_0x135018){logger[_0x97ea('0x10')](_0x97ea('0xc'),_0x517067,_0x135018);_0x4af95f(_0x135018);});});}exports[_0x97ea('0x16')]=function(_0x2e9f07){var _0x228c13=this;return new Promise(function(_0x59f558,_0xda7b4){return db[_0x97ea('0x17')][_0x97ea('0x18')]({'raw':_0x2e9f07[_0x97ea('0x19')]?_0x2e9f07[_0x97ea('0x19')][_0x97ea('0x1a')]===undefined?!![]:![]:!![],'where':_0x2e9f07[_0x97ea('0x19')]?_0x2e9f07[_0x97ea('0x19')][_0x97ea('0x1b')]||null:null,'attributes':_0x2e9f07[_0x97ea('0x19')]?_0x2e9f07[_0x97ea('0x19')][_0x97ea('0x1c')]||null:null,'limit':_0x2e9f07['options']?_0x2e9f07[_0x97ea('0x19')][_0x97ea('0x1d')]||null:null,'include':_0x2e9f07['options']?_0x2e9f07[_0x97ea('0x19')][_0x97ea('0x1e')]?_['map'](_0x2e9f07['options'][_0x97ea('0x1e')],function(_0x2690ba){return{'model':db[_0x2690ba[_0x97ea('0x1f')]],'as':_0x2690ba['as'],'attributes':_0x2690ba[_0x97ea('0x1c')],'include':_0x2690ba[_0x97ea('0x1e')]?_['map'](_0x2690ba[_0x97ea('0x1e')],function(_0x29e9e){return{'model':db[_0x29e9e['model']],'as':_0x29e9e['as'],'attributes':_0x29e9e['attributes'],'include':_0x29e9e[_0x97ea('0x1e')]?_[_0x97ea('0x20')](_0x29e9e[_0x97ea('0x1e')],function(_0x2c69aa){return{'model':db[_0x2c69aa[_0x97ea('0x1f')]],'as':_0x2c69aa['as'],'attributes':_0x2c69aa[_0x97ea('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x97ea('0x21')](function(_0x32b300){logger[_0x97ea('0x13')](_0x97ea('0x16'),_0x2e9f07);logger[_0x97ea('0x22')](_0x97ea('0x16'),_0x2e9f07,JSON[_0x97ea('0xf')](_0x32b300));_0x59f558(_0x32b300);})['catch'](function(_0x334464){logger[_0x97ea('0x10')]('GetTrigger',_0x334464['message'],_0x2e9f07);_0xda7b4(_0x228c13[_0x97ea('0x10')](0x1f4,_0x334464[_0x97ea('0x12')]));});});};exports[_0x97ea('0x23')]=function(_0x240b94){var _0x36956f=this;return new Promise(function(_0xdb2f0e,_0x299ae9){return db[_0x97ea('0x17')][_0x97ea('0x24')]({'raw':_0x240b94[_0x97ea('0x19')]?_0x240b94[_0x97ea('0x19')][_0x97ea('0x1a')]===undefined?!![]:![]:!![],'where':_0x240b94[_0x97ea('0x19')]?_0x240b94[_0x97ea('0x19')][_0x97ea('0x1b')]||null:null,'attributes':_0x240b94[_0x97ea('0x19')]?_0x240b94['options'][_0x97ea('0x1c')]||null:null,'include':_0x240b94[_0x97ea('0x19')]?_0x240b94['options'][_0x97ea('0x1e')]?_[_0x97ea('0x20')](_0x240b94[_0x97ea('0x19')][_0x97ea('0x1e')],function(_0x58812c){return{'model':db[_0x58812c['model']],'as':_0x58812c['as'],'attributes':_0x58812c[_0x97ea('0x1c')],'include':_0x58812c[_0x97ea('0x1e')]?_[_0x97ea('0x20')](_0x58812c[_0x97ea('0x1e')],function(_0x38f152){return{'model':db[_0x38f152[_0x97ea('0x1f')]],'as':_0x38f152['as'],'attributes':_0x38f152['attributes'],'include':_0x38f152[_0x97ea('0x1e')]?_[_0x97ea('0x20')](_0x38f152['include'],function(_0x24c5c7){return{'model':db[_0x24c5c7[_0x97ea('0x1f')]],'as':_0x24c5c7['as'],'attributes':_0x24c5c7[_0x97ea('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d97ec){logger[_0x97ea('0x13')](_0x97ea('0x23'),_0x240b94);logger['debug']('ShowTrigger',_0x240b94,JSON[_0x97ea('0xf')](_0x3d97ec));_0xdb2f0e(_0x3d97ec);})[_0x97ea('0x15')](function(_0x7f5276){logger[_0x97ea('0x10')]('ShowTrigger',_0x7f5276[_0x97ea('0x12')],_0x240b94);_0x299ae9(_0x36956f[_0x97ea('0x10')](0x1f4,_0x7f5276[_0x97ea('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 622c21d..56a62e3 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 _0x2e3f=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./trunk.controller','get','index','/:id','isAuthenticated','show'];(function(_0x188128,_0xc8a300){var _0x367d22=function(_0x504d1d){while(--_0x504d1d){_0x188128['push'](_0x188128['shift']());}};_0x367d22(++_0xc8a300);}(_0x2e3f,0x8b));var _0xf2e3=function(_0x59a703,_0x248012){_0x59a703=_0x59a703-0x0;var _0x5ad181=_0x2e3f[_0x59a703];return _0x5ad181;};'use strict';var multer=require(_0xf2e3('0x0'));var util=require(_0xf2e3('0x1'));var path=require(_0xf2e3('0x2'));var timeout=require(_0xf2e3('0x3'));var express=require(_0xf2e3('0x4'));var router=express[_0xf2e3('0x5')]();var fs_extra=require(_0xf2e3('0x6'));var auth=require(_0xf2e3('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xf2e3('0x8'));var controller=require(_0xf2e3('0x9'));router[_0xf2e3('0xa')]('/',auth['isAuthenticated'](),controller[_0xf2e3('0xb')]);router[_0xf2e3('0xa')](_0xf2e3('0xc'),auth[_0xf2e3('0xd')](),controller[_0xf2e3('0xe')]);router[_0xf2e3('0xf')]('/:id/clone',auth[_0xf2e3('0xd')](),controller['clone']);router[_0xf2e3('0xf')]('/',auth[_0xf2e3('0xd')](),controller[_0xf2e3('0x10')]);router[_0xf2e3('0x11')](_0xf2e3('0xc'),auth[_0xf2e3('0xd')](),controller[_0xf2e3('0x12')]);router[_0xf2e3('0x13')](_0xf2e3('0xc'),auth[_0xf2e3('0xd')](),controller[_0xf2e3('0x14')]);module[_0xf2e3('0x15')]=router; \ No newline at end of file +var _0x96b3=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./trunk.controller','get','isAuthenticated','show','post','create','put','/:id','delete','exports','multer'];(function(_0x38a46d,_0x4154d0){var _0x351b57=function(_0x25a512){while(--_0x25a512){_0x38a46d['push'](_0x38a46d['shift']());}};_0x351b57(++_0x4154d0);}(_0x96b3,0x97));var _0x396b=function(_0x3ed54c,_0x22f7b4){_0x3ed54c=_0x3ed54c-0x0;var _0x5da586=_0x96b3[_0x3ed54c];return _0x5da586;};'use strict';var multer=require(_0x396b('0x0'));var util=require(_0x396b('0x1'));var path=require(_0x396b('0x2'));var timeout=require(_0x396b('0x3'));var express=require(_0x396b('0x4'));var router=express[_0x396b('0x5')]();var fs_extra=require(_0x396b('0x6'));var auth=require(_0x396b('0x7'));var interaction=require(_0x396b('0x8'));var config=require('../../config/environment');var controller=require(_0x396b('0x9'));router[_0x396b('0xa')]('/',auth[_0x396b('0xb')](),controller['index']);router[_0x396b('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x396b('0xc')]);router[_0x396b('0xd')]('/:id/clone',auth['isAuthenticated'](),controller['clone']);router[_0x396b('0xd')]('/',auth['isAuthenticated'](),controller[_0x396b('0xe')]);router[_0x396b('0xf')](_0x396b('0x10'),auth[_0x396b('0xb')](),controller['update']);router[_0x396b('0x11')](_0x396b('0x10'),auth[_0x396b('0xb')](),controller['destroy']);module[_0x396b('0x12')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 45cd9be..7baae28 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 _0x1561=['name','ENUM','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','auto','rfc2833','yes','nonat','update','outgoing','force_rport,comedia','setDataValue','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','never','\x22\x22\x20<>','INTEGER','accept','refuse','originate','uac','uas','pai','certificate','active','passive','actpass','update,nonat','BOOLEAN','sequelize','exports','STRING'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0x1561,0x1c8));var _0x1156=function(_0x90787b,_0x151dfb){_0x90787b=_0x90787b-0x0;var _0xbcbd4e=_0x1561[_0x90787b];return _0xbcbd4e;};'use strict';var Sequelize=require(_0x1156('0x0'));module[_0x1156('0x1')]={'name':{'type':Sequelize[_0x1156('0x2')],'allowNull':![],'unique':_0x1156('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x1156('0x4')]('friend',_0x1156('0x5'),_0x1156('0x6')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x1156('0x2')],'allowNull':![],'defaultValue':_0x1156('0x7')},'callingpres':{'type':Sequelize[_0x1156('0x4')](_0x1156('0x8'),'ALLOWED_PASSED_SCREEN',_0x1156('0x9'),_0x1156('0xa'),'PROHIB_NOT_SCREENED',_0x1156('0xb'),_0x1156('0xc'),_0x1156('0xd'))},'deny':{'type':Sequelize[_0x1156('0x2')]},'permit':{'type':Sequelize[_0x1156('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x1156('0x2')]},'remotesecret':{'type':Sequelize[_0x1156('0x2')]},'transport':{'type':Sequelize[_0x1156('0x2')],'defaultValue':_0x1156('0xe'),'set':function(_0x20a63a){this['setDataValue'](_0x1156('0xf'),_0x20a63a?_0x20a63a[_0x1156('0x10')](','):null);},'get':function(){return this[_0x1156('0x11')](_0x1156('0xf'))?this['getDataValue']('transport')['split'](','):null;},'comment':_0x1156('0x12')},'dtmfmode':{'type':Sequelize[_0x1156('0x4')]('rfc2833',_0x1156('0x13'),'shortinfo','inband',_0x1156('0x14')),'defaultValue':_0x1156('0x15')},'directmedia':{'type':Sequelize[_0x1156('0x4')](_0x1156('0x16'),'no',_0x1156('0x17'),_0x1156('0x18'),_0x1156('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1156('0x4')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1156('0x2')]},'directmediadeny':{'type':Sequelize[_0x1156('0x2')]},'nat':{'type':Sequelize[_0x1156('0x2')],'defaultValue':_0x1156('0x1a'),'set':function(_0x1db594){this[_0x1156('0x1b')]('nat',_0x1db594?_0x1db594[_0x1156('0x10')](','):null);},'get':function(){return this[_0x1156('0x11')](_0x1156('0x1c'))?this['getDataValue']('nat')[_0x1156('0x1d')](','):null;},'comment':_0x1156('0x1e')},'callgroup':{'type':Sequelize[_0x1156('0x2')]},'namedcallgroup':{'type':Sequelize[_0x1156('0x2')]},'pickupgroup':{'type':Sequelize[_0x1156('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x1156('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x1156('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x1156('0x2')],'defaultValue':_0x1156('0x1f')},'allow':{'type':Sequelize[_0x1156('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x3a76d3){this[_0x1156('0x1b')]('allow',_0x3a76d3?_0x3a76d3[_0x1156('0x10')](';'):_0x1156('0x20'));},'get':function(){return this[_0x1156('0x11')]('allow')?this[_0x1156('0x11')]('allow')['split'](';'):null;},'comment':_0x1156('0x21')},'autoframing':{'type':Sequelize[_0x1156('0x4')](_0x1156('0x16'),'no')},'insecure':{'type':Sequelize[_0x1156('0x2')],'defaultValue':_0x1156('0x22'),'set':function(_0x5cf590){this['setDataValue'](_0x1156('0x23'),_0x5cf590?_0x5cf590['join'](','):null);},'get':function(){return this[_0x1156('0x11')](_0x1156('0x23'))?this[_0x1156('0x11')](_0x1156('0x23'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x1156('0x4')](_0x1156('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x1156('0x4')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x1156('0x4')](_0x1156('0x16'),'no',_0x1156('0x24'))},'promiscredir':{'type':Sequelize[_0x1156('0x4')]('yes','no')},'useclientcode':{'type':Sequelize['ENUM'](_0x1156('0x16'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x1156('0x2')],'defaultValue':_0x1156('0x25')},'amaflags':{'type':Sequelize[_0x1156('0x2')]},'callcounter':{'type':Sequelize[_0x1156('0x4')](_0x1156('0x16'),'no'),'defaultValue':_0x1156('0x16')},'busylevel':{'type':Sequelize[_0x1156('0x26')](0xb)},'allowoverlap':{'type':Sequelize[_0x1156('0x4')](_0x1156('0x16'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x1156('0x16'),'no')},'allowtransfer':{'type':Sequelize[_0x1156('0x4')](_0x1156('0x16'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x1156('0x16'),'no')},'subscribecontext':{'type':Sequelize[_0x1156('0x2')]},'template':{'type':Sequelize[_0x1156('0x2')]},'videosupport':{'type':Sequelize[_0x1156('0x4')](_0x1156('0x16'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x1156('0x4')]('yes','no')},'mailbox':{'type':Sequelize[_0x1156('0x2')]},'session_timers':{'type':Sequelize['ENUM'](_0x1156('0x27'),_0x1156('0x28'),_0x1156('0x29'))},'session_expires':{'type':Sequelize[_0x1156('0x26')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x1156('0x4')](_0x1156('0x2a'),_0x1156('0x2b')),'defaultValue':_0x1156('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0x1156('0x2')]},'regexten':{'type':Sequelize[_0x1156('0x2')]},'fromdomain':{'type':Sequelize[_0x1156('0x2')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x1156('0x26')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x1156('0x16'),'no'),'defaultValue':_0x1156('0x16')},'keepalive':{'type':Sequelize[_0x1156('0x26')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0x1156('0x26')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x1156('0x26')](0xb)},'sendrpid':{'type':Sequelize[_0x1156('0x4')](_0x1156('0x16'),'no',_0x1156('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1156('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x1156('0x26')](0xb)},'qualifyfreq':{'type':Sequelize[_0x1156('0x26')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x1156('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x1156('0x2')]},'use_q850_reason':{'type':Sequelize[_0x1156('0x2')]},'maxforwards':{'type':Sequelize[_0x1156('0x26')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x1156('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x1156('0x16'),'no')},'force_avp':{'type':Sequelize[_0x1156('0x4')](_0x1156('0x16'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0x1156('0x16'),'no')},'dtlsenable':{'type':Sequelize[_0x1156('0x4')](_0x1156('0x16'),'no')},'dtlsverify':{'type':Sequelize[_0x1156('0x4')](_0x1156('0x16'),'no','fingerprint',_0x1156('0x2d'))},'dtlsrekey':{'type':Sequelize[_0x1156('0x26')](0xb)},'dtlscertfile':{'type':Sequelize[_0x1156('0x2')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x1156('0x2')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x1156('0x4')](_0x1156('0x2e'),_0x1156('0x2f'),_0x1156('0x30')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x1156('0x2')]},'usereqphone':{'type':Sequelize[_0x1156('0x4')](_0x1156('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1156('0x2')]},'recordofffeature':{'type':Sequelize[_0x1156('0x2')]},'call_limit':{'type':Sequelize[_0x1156('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x1156('0x16'),'no')},'subscribemwi':{'type':Sequelize[_0x1156('0x4')](_0x1156('0x16'),'no')},'vmexten':{'type':Sequelize[_0x1156('0x2')]},'mohinterpret':{'type':Sequelize[_0x1156('0x2')]},'mohsuggest':{'type':Sequelize[_0x1156('0x2')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1156('0x2')]},'host':{'type':Sequelize[_0x1156('0x2')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x1156('0x4')](_0x1156('0x16'),'no',_0x1156('0x17'),_0x1156('0x18'),_0x1156('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x1156('0x2')]},'otherFields':{'type':Sequelize[_0x1156('0x2')]},'active':{'type':Sequelize[_0x1156('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x1156('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x36a8=['INTEGER','accept','refuse','uas','pai','fingerprint','certificate','passive','actpass','update,nonat','BOOLEAN','sequelize','STRING','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>'];(function(_0x1efe6e,_0x14fbed){var _0x2ca52e=function(_0x1a923a){while(--_0x1a923a){_0x1efe6e['push'](_0x1efe6e['shift']());}};_0x2ca52e(++_0x14fbed);}(_0x36a8,0x6d));var _0x836a=function(_0x559364,_0x223995){_0x559364=_0x559364-0x0;var _0x3b4555=_0x36a8[_0x559364];return _0x3b4555;};'use strict';var Sequelize=require(_0x836a('0x0'));module['exports']={'name':{'type':Sequelize[_0x836a('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x836a('0x2')](_0x836a('0x3'),_0x836a('0x4'),_0x836a('0x5')),'allowNull':![],'defaultValue':_0x836a('0x3')},'context':{'type':Sequelize[_0x836a('0x1')],'allowNull':![],'defaultValue':_0x836a('0x6')},'callingpres':{'type':Sequelize['ENUM'](_0x836a('0x7'),_0x836a('0x8'),'ALLOWED_FAILED_SCREEN',_0x836a('0x9'),_0x836a('0xa'),_0x836a('0xb'),'PROHIB_FAILED_SCREEN',_0x836a('0xc'))},'deny':{'type':Sequelize[_0x836a('0x1')]},'permit':{'type':Sequelize[_0x836a('0x1')]},'secret':{'type':Sequelize[_0x836a('0x1')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0x836a('0x1')]},'transport':{'type':Sequelize[_0x836a('0x1')],'defaultValue':'udp','set':function(_0x45aebc){this[_0x836a('0xd')](_0x836a('0xe'),_0x45aebc?_0x45aebc[_0x836a('0xf')](','):null);},'get':function(){return this[_0x836a('0x10')](_0x836a('0xe'))?this[_0x836a('0x10')](_0x836a('0xe'))[_0x836a('0x11')](','):null;},'comment':_0x836a('0x12')},'dtmfmode':{'type':Sequelize['ENUM'](_0x836a('0x13'),_0x836a('0x14'),_0x836a('0x15'),_0x836a('0x16'),'auto'),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x836a('0x2')](_0x836a('0x17'),'no',_0x836a('0x18'),_0x836a('0x19'),_0x836a('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x836a('0x1')]},'nat':{'type':Sequelize[_0x836a('0x1')],'defaultValue':_0x836a('0x1b'),'set':function(_0x49e762){this['setDataValue'](_0x836a('0x1c'),_0x49e762?_0x49e762[_0x836a('0xf')](','):null);},'get':function(){return this[_0x836a('0x10')](_0x836a('0x1c'))?this[_0x836a('0x10')](_0x836a('0x1c'))[_0x836a('0x11')](','):null;},'comment':_0x836a('0x1d')},'callgroup':{'type':Sequelize[_0x836a('0x1')]},'namedcallgroup':{'type':Sequelize[_0x836a('0x1')]},'pickupgroup':{'type':Sequelize[_0x836a('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x836a('0x1')]},'language':{'type':Sequelize[_0x836a('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x836a('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x836a('0x1')],'defaultValue':_0x836a('0x1e')},'allow':{'type':Sequelize[_0x836a('0x1')],'allowNull':![],'defaultValue':_0x836a('0x1f'),'set':function(_0x5ab904){this['setDataValue']('allow',_0x5ab904?_0x5ab904[_0x836a('0xf')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x836a('0x10')]('allow')?this[_0x836a('0x10')]('allow')[_0x836a('0x11')](';'):null;},'comment':_0x836a('0x20')},'autoframing':{'type':Sequelize[_0x836a('0x2')](_0x836a('0x17'),'no')},'insecure':{'type':Sequelize[_0x836a('0x1')],'defaultValue':_0x836a('0x21'),'set':function(_0x3be721){this[_0x836a('0xd')](_0x836a('0x22'),_0x3be721?_0x3be721['join'](','):null);},'get':function(){return this[_0x836a('0x10')]('insecure')?this['getDataValue'](_0x836a('0x22'))[_0x836a('0x11')](','):null;},'comment':_0x836a('0x23')},'trustrpid':{'type':Sequelize[_0x836a('0x2')](_0x836a('0x17'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x836a('0x2')](_0x836a('0x17'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x836a('0x2')]('yes','no',_0x836a('0x24'))},'promiscredir':{'type':Sequelize[_0x836a('0x2')](_0x836a('0x17'),'no')},'useclientcode':{'type':Sequelize[_0x836a('0x2')]('yes','no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x836a('0x1')]},'callerid':{'type':Sequelize[_0x836a('0x1')],'defaultValue':_0x836a('0x25')},'amaflags':{'type':Sequelize[_0x836a('0x1')]},'callcounter':{'type':Sequelize[_0x836a('0x2')](_0x836a('0x17'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x836a('0x2')]('yes','no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x836a('0x17'),'no')},'allowtransfer':{'type':Sequelize[_0x836a('0x2')](_0x836a('0x17'),'no')},'ignoresdpversion':{'type':Sequelize[_0x836a('0x2')](_0x836a('0x17'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x836a('0x1')]},'videosupport':{'type':Sequelize[_0x836a('0x2')](_0x836a('0x17'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x836a('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x836a('0x2')](_0x836a('0x17'),'no')},'mailbox':{'type':Sequelize[_0x836a('0x1')]},'session_timers':{'type':Sequelize[_0x836a('0x2')](_0x836a('0x27'),_0x836a('0x28'),'originate')},'session_expires':{'type':Sequelize[_0x836a('0x26')](0xb)},'session_minse':{'type':Sequelize[_0x836a('0x26')](0xb)},'session_refresher':{'type':Sequelize[_0x836a('0x2')]('uac',_0x836a('0x29')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x836a('0x1')]},'port':{'type':Sequelize[_0x836a('0x26')](0x5)},'qualify':{'type':Sequelize[_0x836a('0x2')](_0x836a('0x17'),'no'),'defaultValue':_0x836a('0x17')},'keepalive':{'type':Sequelize[_0x836a('0x26')](0xb)},'defaultip':{'type':Sequelize[_0x836a('0x1')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0x836a('0x26')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x836a('0x26')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x836a('0x17'),'no',_0x836a('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x836a('0x26')](0xb)},'timerb':{'type':Sequelize[_0x836a('0x26')](0xb)},'qualifyfreq':{'type':Sequelize[_0x836a('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0x836a('0x1')]},'contactdeny':{'type':Sequelize[_0x836a('0x1')]},'contactacl':{'type':Sequelize[_0x836a('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x836a('0x1')]},'use_q850_reason':{'type':Sequelize[_0x836a('0x1')]},'maxforwards':{'type':Sequelize[_0x836a('0x26')](0xb)},'encryption':{'type':Sequelize[_0x836a('0x2')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x836a('0x17'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0x836a('0x17'),'no')},'icesupport':{'type':Sequelize[_0x836a('0x2')](_0x836a('0x17'),'no')},'dtlsenable':{'type':Sequelize[_0x836a('0x2')](_0x836a('0x17'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x836a('0x17'),'no',_0x836a('0x2b'),_0x836a('0x2c'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x836a('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x836a('0x1')]},'dtlscipher':{'type':Sequelize[_0x836a('0x1')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x836a('0x1')]},'dtlssetup':{'type':Sequelize[_0x836a('0x2')]('active',_0x836a('0x2d'),_0x836a('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x836a('0x1')]},'usereqphone':{'type':Sequelize['ENUM'](_0x836a('0x17'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x836a('0x1')]},'recordofffeature':{'type':Sequelize[_0x836a('0x1')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x836a('0x2')](_0x836a('0x17'),'no')},'subscribemwi':{'type':Sequelize[_0x836a('0x2')]('yes','no')},'vmexten':{'type':Sequelize[_0x836a('0x1')]},'mohinterpret':{'type':Sequelize[_0x836a('0x1')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x836a('0x1')]},'description':{'type':Sequelize[_0x836a('0x1')]},'host':{'type':Sequelize[_0x836a('0x1')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize['ENUM'](_0x836a('0x17'),'no',_0x836a('0x18'),'update',_0x836a('0x2f')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x836a('0x1')]},'otherFields':{'type':Sequelize[_0x836a('0x1')]},'active':{'type':Sequelize[_0x836a('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x836a('0x1')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 4848970..a8d3124 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 _0xbec5=['readFileSync','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_registers.conf','Reload','Unable\x20to\x20retrieve\x20the\x20current\x20user','update','/etc/asterisk/sip_xcally_trunks.conf','chan_sip.so','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','reject','Trunks','UserProfileResource','destroy','stack','name','send','map','Trunk','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','attributes','find','clone','get','omit','updatedAt','body','createdAt','create','user','role','UserProfileSection','userProfileId','autoAssociation','join','server/files/templates/trunk.ejs','utf8'];(function(_0x4a21eb,_0x28988d){var _0x5702f4=function(_0xaf4e32){while(--_0xaf4e32){_0x4a21eb['push'](_0x4a21eb['shift']());}};_0x5702f4(++_0x28988d);}(_0xbec5,0xe5));var _0x5bec=function(_0x10dc64,_0x11bb29){_0x10dc64=_0x10dc64-0x0;var _0x9cf98d=_0xbec5[_0x10dc64];return _0x9cf98d;};'use strict';var emlformat=require(_0x5bec('0x0'));var rimraf=require(_0x5bec('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5bec('0x2'));var rp=require(_0x5bec('0x3'));var moment=require(_0x5bec('0x4'));var BPromise=require(_0x5bec('0x5'));var Mustache=require(_0x5bec('0x6'));var util=require('util');var path=require(_0x5bec('0x7'));var sox=require(_0x5bec('0x8'));var csv=require(_0x5bec('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5bec('0xa'));var _=require(_0x5bec('0xb'));var squel=require(_0x5bec('0xc'));var crypto=require(_0x5bec('0xd'));var jsforce=require(_0x5bec('0xe'));var deskjs=require(_0x5bec('0xf'));var toCsv=require(_0x5bec('0x9'));var querystring=require(_0x5bec('0x10'));var Papa=require('papaparse');var Redis=require(_0x5bec('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5bec('0x12'));var as=require(_0x5bec('0x13'));var hardwareService=require(_0x5bec('0x14'));var logger=require('../../config/logger')(_0x5bec('0x15'));var utils=require(_0x5bec('0x16'));var config=require(_0x5bec('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5bec('0x18'))['db'];var jayson=require(_0x5bec('0x19'));var client=jayson['client'][_0x5bec('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xaa984d,_0x35393a,_0x6888a4,_0x3198e0){return new BPromise(function(_0xcd6d90,_0x24dcd6){var _0x43fd2a=_0x3198e0||client;return _0x43fd2a[_0x5bec('0x1b')](_0xaa984d,_0x6888a4)[_0x5bec('0x1c')](function(_0x31b9e4){logger[_0x5bec('0x1d')](_0x5bec('0x1e'),_0x35393a,'request\x20sent');logger['debug'](_0x5bec('0x1f'),_0x35393a,_0x5bec('0x20'),JSON[_0x5bec('0x21')](_0x31b9e4));if(_0x31b9e4[_0x5bec('0x22')]){if(_0x31b9e4['error']['code']===0x1f4){logger[_0x5bec('0x22')](_0x5bec('0x1e'),_0x35393a,_0x31b9e4['error'][_0x5bec('0x23')]);return _0x24dcd6(_0x31b9e4[_0x5bec('0x22')][_0x5bec('0x23')]);}logger[_0x5bec('0x22')]('Trunk,\x20%s,\x20%s',_0x35393a,_0x31b9e4[_0x5bec('0x22')]['message']);return _0xcd6d90(_0x31b9e4[_0x5bec('0x22')][_0x5bec('0x23')]);}else{logger[_0x5bec('0x1d')](_0x5bec('0x1e'),_0x35393a,_0x5bec('0x20'));_0xcd6d90(_0x31b9e4['result'][_0x5bec('0x23')]);}})['catch'](function(_0x2b2d26){logger[_0x5bec('0x22')]('Trunk,\x20%s,\x20%s',_0x35393a,_0x2b2d26);_0x24dcd6(_0x2b2d26);});});}function respondWithStatusCode(_0xa414f8,_0xbef70b){_0xbef70b=_0xbef70b||0xcc;return function(_0x4e0ca2){if(_0x4e0ca2){return _0xa414f8[_0x5bec('0x24')](_0xbef70b);}return _0xa414f8[_0x5bec('0x25')](_0xbef70b)[_0x5bec('0x26')]();};}function respondWithResult(_0x20da89,_0x226d55){_0x226d55=_0x226d55||0xc8;return function(_0x131143){if(_0x131143){return _0x20da89[_0x5bec('0x25')](_0x226d55)['json'](_0x131143);}};}function respondWithFilteredResult(_0x5b63ab,_0x5e44b3){return function(_0x2961bd){if(_0x2961bd){var _0x2cdd2f=typeof _0x5e44b3[_0x5bec('0x27')]==='undefined'&&typeof _0x5e44b3[_0x5bec('0x28')]===_0x5bec('0x29');var _0x57331b=_0x2961bd[_0x5bec('0x2a')];var _0x63ac8=_0x2cdd2f?0x0:_0x5e44b3['offset'];var _0x5336b3=_0x2cdd2f?_0x2961bd[_0x5bec('0x2a')]:_0x5e44b3[_0x5bec('0x27')]+_0x5e44b3[_0x5bec('0x28')];var _0x2c7a7b;if(_0x5336b3>=_0x57331b){_0x5336b3=_0x57331b;_0x2c7a7b=0xc8;}else{_0x2c7a7b=0xce;}_0x5b63ab[_0x5bec('0x25')](_0x2c7a7b);return _0x5b63ab[_0x5bec('0x2b')]('Content-Range',_0x63ac8+'-'+_0x5336b3+'/'+_0x57331b)[_0x5bec('0x2c')](_0x2961bd);}return null;};}function patchUpdates(_0x59b5b6){return function(_0x45863b){try{jsonpatch[_0x5bec('0x2d')](_0x45863b,_0x59b5b6,!![]);}catch(_0x3034c9){return BPromise[_0x5bec('0x2e')](_0x3034c9);}return _0x45863b['save']();};}function saveUpdates(_0x2b42c8,_0x1aba46){return function(_0xfc7d41){if(_0xfc7d41){return _0xfc7d41['update'](_0x2b42c8)[_0x5bec('0x1c')](function(_0x4cfb89){return _0x4cfb89;});}return null;};}function removeEntity(_0x14cdbf,_0x207192){return function(_0x29df14){if(_0x29df14){return _0x29df14['destroy']()[_0x5bec('0x1c')](function(){var _0x420ad4=_0x29df14['get']({'plain':!![]});var _0x34b441=_0x5bec('0x2f');return db[_0x5bec('0x30')][_0x5bec('0x31')]({'where':{'type':_0x34b441,'resourceId':_0x420ad4['id']}})[_0x5bec('0x1c')](function(){return _0x29df14;});})['then'](function(){_0x14cdbf[_0x5bec('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d3793,_0x384f04){return function(_0x182b86){if(!_0x182b86){_0x2d3793[_0x5bec('0x24')](0x194);}return _0x182b86;};}function handleError(_0x2e421e,_0x1923fc){_0x1923fc=_0x1923fc||0x1f4;return function(_0x49c8ef){logger[_0x5bec('0x22')](_0x49c8ef[_0x5bec('0x32')]);if(_0x49c8ef[_0x5bec('0x33')]){delete _0x49c8ef['name'];}_0x2e421e[_0x5bec('0x25')](_0x1923fc)[_0x5bec('0x34')](_0x49c8ef);};}exports['index']=function(_0xdb0430,_0x58c34e){var _0x400e22={},_0x2c0b08={},_0x402e5d={'count':0x0,'rows':[]};var _0x49cdfa=_[_0x5bec('0x35')](db[_0x5bec('0x36')][_0x5bec('0x37')],function(_0x139859){return{'name':_0x139859[_0x5bec('0x38')],'type':_0x139859[_0x5bec('0x39')][_0x5bec('0x3a')]};});_0x2c0b08['model']=_[_0x5bec('0x35')](_0x49cdfa,_0x5bec('0x33'));_0x2c0b08[_0x5bec('0x3b')]=_[_0x5bec('0x3c')](_0xdb0430['query']);_0x2c0b08[_0x5bec('0x3d')]=_[_0x5bec('0x3e')](_0x2c0b08[_0x5bec('0x3f')],_0x2c0b08['query']);_0x400e22['attributes']=_[_0x5bec('0x3e')](_0x2c0b08[_0x5bec('0x3f')],qs[_0x5bec('0x40')](_0xdb0430[_0x5bec('0x3b')][_0x5bec('0x40')]));_0x400e22['attributes']=_0x400e22['attributes'][_0x5bec('0x41')]?_0x400e22['attributes']:_0x2c0b08[_0x5bec('0x3f')];if(!_0xdb0430[_0x5bec('0x3b')][_0x5bec('0x42')]('nolimit')){_0x400e22[_0x5bec('0x28')]=qs[_0x5bec('0x28')](_0xdb0430['query'][_0x5bec('0x28')]);_0x400e22[_0x5bec('0x27')]=qs[_0x5bec('0x27')](_0xdb0430[_0x5bec('0x3b')][_0x5bec('0x27')]);}_0x400e22[_0x5bec('0x43')]=qs[_0x5bec('0x44')](_0xdb0430['query']['sort']);_0x400e22[_0x5bec('0x45')]=qs['filters'](_['pick'](_0xdb0430[_0x5bec('0x3b')],_0x2c0b08['filters']),_0x49cdfa);if(_0xdb0430['query']['filter']){_0x400e22[_0x5bec('0x45')]=_[_0x5bec('0x46')](_0x400e22[_0x5bec('0x45')],{'$or':_[_0x5bec('0x35')](_0x49cdfa,function(_0x48858a){if(_0x48858a[_0x5bec('0x39')]!==_0x5bec('0x47')){var _0xa4d32={};_0xa4d32[_0x48858a[_0x5bec('0x33')]]={'$like':'%'+_0xdb0430['query'][_0x5bec('0x48')]+'%'};return _0xa4d32;}})});}_0x400e22=_[_0x5bec('0x46')]({},_0x400e22,_0xdb0430[_0x5bec('0x49')]);var _0x51a3f9={'where':_0x400e22[_0x5bec('0x45')]};return db['Trunk'][_0x5bec('0x2a')](_0x51a3f9)[_0x5bec('0x1c')](function(_0x133d5c){_0x402e5d[_0x5bec('0x2a')]=_0x133d5c;if(_0xdb0430['query'][_0x5bec('0x4a')]){_0x400e22[_0x5bec('0x4b')]=[{'all':!![]}];}return db[_0x5bec('0x36')][_0x5bec('0x4c')](_0x400e22);})[_0x5bec('0x1c')](function(_0x123758){_0x402e5d[_0x5bec('0x4d')]=_0x123758;return _0x402e5d;})['then'](respondWithFilteredResult(_0x58c34e,_0x400e22))[_0x5bec('0x4e')](handleError(_0x58c34e,null));};exports[_0x5bec('0x4f')]=function(_0x5775ca,_0x273e09){var _0x3e6180={'raw':![],'where':{'id':_0x5775ca[_0x5bec('0x50')]['id']}},_0x34ee24={};_0x34ee24[_0x5bec('0x3f')]=_[_0x5bec('0x3c')](db[_0x5bec('0x36')]['rawAttributes']);_0x34ee24[_0x5bec('0x3b')]=_['keys'](_0x5775ca[_0x5bec('0x3b')]);_0x34ee24[_0x5bec('0x3d')]=_[_0x5bec('0x3e')](_0x34ee24[_0x5bec('0x3f')],_0x34ee24[_0x5bec('0x3b')]);_0x3e6180[_0x5bec('0x51')]=_[_0x5bec('0x3e')](_0x34ee24[_0x5bec('0x3f')],qs[_0x5bec('0x40')](_0x5775ca[_0x5bec('0x3b')]['fields']));_0x3e6180[_0x5bec('0x51')]=_0x3e6180['attributes']['length']?_0x3e6180[_0x5bec('0x51')]:_0x34ee24['model'];if(_0x5775ca['query'][_0x5bec('0x4a')]){_0x3e6180[_0x5bec('0x4b')]=[{'all':!![]}];}_0x3e6180=_[_0x5bec('0x46')]({},_0x3e6180,_0x5775ca['options']);return db[_0x5bec('0x36')][_0x5bec('0x52')](_0x3e6180)[_0x5bec('0x1c')](handleEntityNotFound(_0x273e09,null))[_0x5bec('0x1c')](respondWithResult(_0x273e09,null))['catch'](handleError(_0x273e09,null));};exports[_0x5bec('0x53')]=function(_0x209da3,_0x9cae50){var _0xc8563a={'where':{'id':_0x209da3[_0x5bec('0x50')]['id']}},_0x2f736c={};_0x2f736c[_0x5bec('0x3f')]=_['keys'](db['Trunk'][_0x5bec('0x37')]);_0xc8563a['attributes']=_[_0x5bec('0x3e')](_0x2f736c[_0x5bec('0x3f')],qs['fields'](_0x209da3[_0x5bec('0x3b')]['fields']));_0xc8563a[_0x5bec('0x51')]=_0xc8563a[_0x5bec('0x51')][_0x5bec('0x41')]?_0xc8563a[_0x5bec('0x51')]:_0x2f736c[_0x5bec('0x3f')];if(_0x209da3[_0x5bec('0x3b')][_0x5bec('0x4a')]){_0xc8563a[_0x5bec('0x4b')]=[{'all':!![]}];}_0xc8563a=_[_0x5bec('0x46')]({},_0xc8563a,_0x209da3[_0x5bec('0x49')]);return db[_0x5bec('0x36')][_0x5bec('0x52')](_0xc8563a)[_0x5bec('0x1c')](handleEntityNotFound(_0x9cae50,null))[_0x5bec('0x1c')](function(_0x51b25d){if(_0x51b25d){var _0x2e33a7=_0x51b25d[_0x5bec('0x54')]({'plain':!![]});_0x2e33a7=qs[_0x5bec('0x55')](_0x2e33a7,['id','createdAt',_0x5bec('0x56')]);_0x209da3[_0x5bec('0x57')]=_[_0x5bec('0x55')](_0x209da3[_0x5bec('0x57')],['id',_0x5bec('0x58'),'updatedAt']);return db[_0x5bec('0x36')][_0x5bec('0x59')](_[_0x5bec('0x46')](_0x2e33a7,_0x209da3[_0x5bec('0x57')]),{'include':_0x209da3['query'][_0x5bec('0x4a')]?[{'all':!![]}]:undefined})['then'](function(_0x2b701f){var _0x38deb0=_0x209da3[_0x5bec('0x5a')][_0x5bec('0x54')]({'plain':!![]});if(!_0x38deb0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x38deb0[_0x5bec('0x5b')]===_0x5bec('0x5a')){var _0x1b3c40=_0x2b701f[_0x5bec('0x54')]({'plain':!![]});var _0xc3e3df=_0x5bec('0x2f');return db[_0x5bec('0x5c')][_0x5bec('0x52')]({'where':{'name':_0xc3e3df,'userProfileId':_0x38deb0[_0x5bec('0x5d')]},'raw':!![]})[_0x5bec('0x1c')](function(_0xfa751f){if(_0xfa751f&&_0xfa751f[_0x5bec('0x5e')]===0x0){return db[_0x5bec('0x30')][_0x5bec('0x59')]({'name':_0x1b3c40[_0x5bec('0x33')],'resourceId':_0x1b3c40['id'],'type':_0xfa751f['name'],'sectionId':_0xfa751f['id']},{})[_0x5bec('0x1c')](function(){return _0x2b701f;});}else{return _0x2b701f;}})[_0x5bec('0x4e')](function(_0x4e899c){logger[_0x5bec('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4e899c);throw _0x4e899c;});}return _0x2b701f;});}})[_0x5bec('0x1c')](respondWithResult(_0x9cae50,0xc9))[_0x5bec('0x4e')](handleError(_0x9cae50,null));};exports['create']=function(_0x5a2a85,_0xd54be0,_0xcac51d){var _0xb6cf85;return db[_0x5bec('0x36')][_0x5bec('0x59')](_0x5a2a85['body'],{'raw':!![]})[_0x5bec('0x1c')](function(_0x39cb06){_0xb6cf85=_0x39cb06;return db['Trunk'][_0x5bec('0x4c')]({'raw':!![]});})[_0x5bec('0x1c')](function(_0x44a945){var _0x34f31c=fs['readFileSync'](path[_0x5bec('0x5f')](config['root'],_0x5bec('0x60')),_0x5bec('0x61'));var _0x3ede1d=fs[_0x5bec('0x62')](path[_0x5bec('0x5f')](config[_0x5bec('0x63')],_0x5bec('0x64')),_0x5bec('0x61'));var _0x1ee139=ejs[_0x5bec('0x65')](_0x34f31c,{'trunks':_0x44a945||[]});fs[_0x5bec('0x66')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1ee139);if(_0xb6cf85['registry']){var _0x3c305e=ejs[_0x5bec('0x65')](_0x3ede1d,{'trunks':_0x44a945||[]});fs[_0x5bec('0x66')](_0x5bec('0x67'),_0x3c305e);}})[_0x5bec('0x1c')](function(){return respondWithRpcPromise(_0x5bec('0x68'),_0x5bec('0x59'),{'module':'chan_sip.so'});})['then'](function(){var _0xc81e8f=_0x5a2a85[_0x5bec('0x5a')][_0x5bec('0x54')]({'plain':!![]});if(!_0xc81e8f)throw new Error(_0x5bec('0x69'));if(_0xc81e8f[_0x5bec('0x5b')]===_0x5bec('0x5a')){var _0x17cd00=_0xb6cf85[_0x5bec('0x54')]({'plain':!![]});return db[_0x5bec('0x5c')][_0x5bec('0x52')]({'where':{'name':_0x5bec('0x2f'),'userProfileId':_0xc81e8f[_0x5bec('0x5d')]},'raw':!![]})[_0x5bec('0x1c')](function(_0x325044){if(_0x325044&&_0x325044[_0x5bec('0x5e')]===0x0){return db[_0x5bec('0x30')][_0x5bec('0x59')]({'name':_0x17cd00[_0x5bec('0x33')],'resourceId':_0x17cd00['id'],'type':_0x325044[_0x5bec('0x33')],'sectionId':_0x325044['id']},{})[_0x5bec('0x1c')](function(){return _0xb6cf85;});}else{return _0xb6cf85;}})['catch'](function(_0x2e76c0){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2e76c0);throw _0x2e76c0;});}return _0xb6cf85;})[_0x5bec('0x1c')](respondWithResult(_0xd54be0,0xc9))['catch'](handleError(_0xd54be0,null));};exports[_0x5bec('0x6a')]=function(_0x5d6af3,_0x5ca280,_0x2e849b){var _0x1b5ec0;return db['Trunk'][_0x5bec('0x52')]({'where':{'id':_0x5d6af3[_0x5bec('0x50')]['id']}})[_0x5bec('0x1c')](handleEntityNotFound(_0x5ca280,null))[_0x5bec('0x1c')](saveUpdates(_0x5d6af3[_0x5bec('0x57')],null))[_0x5bec('0x1c')](function(_0xb76af2){if(_0xb76af2){_0x1b5ec0=_0xb76af2;return db[_0x5bec('0x36')]['findAll']({'raw':!![]});}})['then'](function(_0x2e8cd3){if(_0x2e8cd3){var _0x122c7f=fs[_0x5bec('0x62')](path[_0x5bec('0x5f')](config['root'],_0x5bec('0x60')),'utf8');var _0x44ceec=fs[_0x5bec('0x62')](path[_0x5bec('0x5f')](config[_0x5bec('0x63')],_0x5bec('0x64')),_0x5bec('0x61'));var _0x38be2d=ejs[_0x5bec('0x65')](_0x122c7f,{'trunks':_0x2e8cd3||[]});fs['writeFileSync'](_0x5bec('0x6b'),_0x38be2d);var _0xe5f9e5=ejs[_0x5bec('0x65')](_0x44ceec,{'trunks':_0x2e8cd3||[]});fs[_0x5bec('0x66')](_0x5bec('0x67'),_0xe5f9e5);return respondWithRpcPromise('Reload',_0x5bec('0x6a'),{'module':_0x5bec('0x6c')});}return null;})['then'](function(_0x195c12){if(_0x195c12){return _0x1b5ec0;}})['then'](respondWithResult(_0x5ca280,null))[_0x5bec('0x4e')](handleError(_0x5ca280,null));};exports[_0x5bec('0x31')]=function(_0x4646a3,_0x313e1c,_0x437c3e){var _0x3d7600;return db[_0x5bec('0x36')][_0x5bec('0x52')]({'where':{'id':_0x4646a3[_0x5bec('0x50')]['id']}})[_0x5bec('0x1c')](handleEntityNotFound(_0x313e1c,null))[_0x5bec('0x1c')](removeEntity(_0x313e1c,null))[_0x5bec('0x1c')](function(){return db[_0x5bec('0x36')][_0x5bec('0x4c')]({'raw':!![]});})[_0x5bec('0x1c')](function(_0x1eaf2f){var _0x317e2a=fs[_0x5bec('0x62')](path['join'](config[_0x5bec('0x63')],'server/files/templates/trunk.ejs'),_0x5bec('0x61'));var _0xfcef92=fs['readFileSync'](path['join'](config[_0x5bec('0x63')],'server/files/templates/registry.ejs'),_0x5bec('0x61'));var _0x4b70df=ejs[_0x5bec('0x65')](_0x317e2a,{'trunks':_0x1eaf2f});var _0x27b40b=ejs['render'](_0xfcef92,{'trunks':_0x1eaf2f});fs[_0x5bec('0x66')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4b70df);fs[_0x5bec('0x66')]('/etc/asterisk/sip_xcally_registers.conf',_0x27b40b);return respondWithRpcPromise(_0x5bec('0x68'),_0x5bec('0x31'),{'module':'chan_sip.so'});})[_0x5bec('0x4e')](handleError(_0x313e1c,null));}; \ No newline at end of file +var _0x6aa7=['sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','length','includeAll','clone','find','get','createdAt','body','omit','updatedAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','render','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','autoAssociation','update','utf8','server/files/templates/registry.ejs','writeFileSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','http','then','Trunk,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','Trunks','UserProfileResource','stack','name','index','map','Trunk','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','order'];(function(_0x5c4630,_0x184042){var _0x9e63ac=function(_0x1a868a){while(--_0x1a868a){_0x5c4630['push'](_0x5c4630['shift']());}};_0x9e63ac(++_0x184042);}(_0x6aa7,0x178));var _0x76aa=function(_0xa24881,_0x43f67d){_0xa24881=_0xa24881-0x0;var _0x1551f0=_0x6aa7[_0xa24881];return _0x1551f0;};'use strict';var emlformat=require(_0x76aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x76aa('0x1'));var jsonpatch=require(_0x76aa('0x2'));var rp=require(_0x76aa('0x3'));var moment=require(_0x76aa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x76aa('0x5'));var util=require(_0x76aa('0x6'));var path=require(_0x76aa('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x76aa('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76aa('0x9'));var squel=require(_0x76aa('0xa'));var crypto=require(_0x76aa('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x76aa('0xc'));var toCsv=require(_0x76aa('0xd'));var querystring=require(_0x76aa('0xe'));var Papa=require('papaparse');var Redis=require(_0x76aa('0xf'));var authService=require(_0x76aa('0x10'));var qs=require(_0x76aa('0x11'));var as=require(_0x76aa('0x12'));var hardwareService=require(_0x76aa('0x13'));var logger=require(_0x76aa('0x14'))(_0x76aa('0x15'));var utils=require(_0x76aa('0x16'));var config=require(_0x76aa('0x17'));var licenseUtil=require(_0x76aa('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0x76aa('0x19'));var client=jayson['client'][_0x76aa('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x12dde0,_0x3f8f6b,_0x8e44ed,_0x10432c){return new BPromise(function(_0x4e309f,_0x5f5b59){var _0x2b3b4f=_0x10432c||client;return _0x2b3b4f['request'](_0x12dde0,_0x8e44ed)[_0x76aa('0x1b')](function(_0x319bf1){logger['info'](_0x76aa('0x1c'),_0x3f8f6b,'request\x20sent');logger[_0x76aa('0x1d')]('Trunk,\x20%s,\x20%s,\x20%s',_0x3f8f6b,_0x76aa('0x1e'),JSON[_0x76aa('0x1f')](_0x319bf1));if(_0x319bf1[_0x76aa('0x20')]){if(_0x319bf1[_0x76aa('0x20')][_0x76aa('0x21')]===0x1f4){logger[_0x76aa('0x20')]('Trunk,\x20%s,\x20%s',_0x3f8f6b,_0x319bf1['error'][_0x76aa('0x22')]);return _0x5f5b59(_0x319bf1[_0x76aa('0x20')][_0x76aa('0x22')]);}logger[_0x76aa('0x20')](_0x76aa('0x1c'),_0x3f8f6b,_0x319bf1[_0x76aa('0x20')][_0x76aa('0x22')]);return _0x4e309f(_0x319bf1[_0x76aa('0x20')][_0x76aa('0x22')]);}else{logger['info'](_0x76aa('0x1c'),_0x3f8f6b,_0x76aa('0x1e'));_0x4e309f(_0x319bf1[_0x76aa('0x23')]['message']);}})[_0x76aa('0x24')](function(_0x189cb6){logger[_0x76aa('0x20')](_0x76aa('0x1c'),_0x3f8f6b,_0x189cb6);_0x5f5b59(_0x189cb6);});});}function respondWithStatusCode(_0x29c50c,_0xc1044c){_0xc1044c=_0xc1044c||0xcc;return function(_0x3cd039){if(_0x3cd039){return _0x29c50c[_0x76aa('0x25')](_0xc1044c);}return _0x29c50c[_0x76aa('0x26')](_0xc1044c)[_0x76aa('0x27')]();};}function respondWithResult(_0x37f1ab,_0x26b75e){_0x26b75e=_0x26b75e||0xc8;return function(_0x3599a9){if(_0x3599a9){return _0x37f1ab['status'](_0x26b75e)[_0x76aa('0x28')](_0x3599a9);}};}function respondWithFilteredResult(_0x1d6d15,_0x25c614){return function(_0x2e7ab4){if(_0x2e7ab4){var _0xa1e6=typeof _0x25c614[_0x76aa('0x29')]===_0x76aa('0x2a')&&typeof _0x25c614[_0x76aa('0x2b')]===_0x76aa('0x2a');var _0x1bdc3d=_0x2e7ab4['count'];var _0x3fcb7f=_0xa1e6?0x0:_0x25c614['offset'];var _0x994550=_0xa1e6?_0x2e7ab4[_0x76aa('0x2c')]:_0x25c614[_0x76aa('0x29')]+_0x25c614[_0x76aa('0x2b')];var _0x1eecd9;if(_0x994550>=_0x1bdc3d){_0x994550=_0x1bdc3d;_0x1eecd9=0xc8;}else{_0x1eecd9=0xce;}_0x1d6d15[_0x76aa('0x26')](_0x1eecd9);return _0x1d6d15[_0x76aa('0x2d')](_0x76aa('0x2e'),_0x3fcb7f+'-'+_0x994550+'/'+_0x1bdc3d)[_0x76aa('0x28')](_0x2e7ab4);}return null;};}function patchUpdates(_0x3ea05a){return function(_0x5edcd8){try{jsonpatch[_0x76aa('0x2f')](_0x5edcd8,_0x3ea05a,!![]);}catch(_0x5532c7){return BPromise[_0x76aa('0x30')](_0x5532c7);}return _0x5edcd8[_0x76aa('0x31')]();};}function saveUpdates(_0x458ac3,_0x38ecd1){return function(_0x35a705){if(_0x35a705){return _0x35a705['update'](_0x458ac3)[_0x76aa('0x1b')](function(_0x25a11f){return _0x25a11f;});}return null;};}function removeEntity(_0x5a0f72,_0x2ee338){return function(_0x58d860){if(_0x58d860){return _0x58d860[_0x76aa('0x32')]()['then'](function(){var _0x8479a3=_0x58d860['get']({'plain':!![]});var _0x58f135=_0x76aa('0x33');return db[_0x76aa('0x34')][_0x76aa('0x32')]({'where':{'type':_0x58f135,'resourceId':_0x8479a3['id']}})[_0x76aa('0x1b')](function(){return _0x58d860;});})['then'](function(){_0x5a0f72['status'](0xcc)[_0x76aa('0x27')]();});}};}function handleEntityNotFound(_0x1c7b6f,_0x58127c){return function(_0x23e2fd){if(!_0x23e2fd){_0x1c7b6f[_0x76aa('0x25')](0x194);}return _0x23e2fd;};}function handleError(_0x5b57d8,_0x9ce5f4){_0x9ce5f4=_0x9ce5f4||0x1f4;return function(_0x5c77f1){logger['error'](_0x5c77f1[_0x76aa('0x35')]);if(_0x5c77f1[_0x76aa('0x36')]){delete _0x5c77f1[_0x76aa('0x36')];}_0x5b57d8[_0x76aa('0x26')](_0x9ce5f4)['send'](_0x5c77f1);};}exports[_0x76aa('0x37')]=function(_0x1c22f7,_0x2eea79){var _0x4e131a={},_0x113770={},_0x1638db={'count':0x0,'rows':[]};var _0x2f7726=_[_0x76aa('0x38')](db[_0x76aa('0x39')][_0x76aa('0x3a')],function(_0x878903){return{'name':_0x878903[_0x76aa('0x3b')],'type':_0x878903[_0x76aa('0x3c')]['key']};});_0x113770[_0x76aa('0x3d')]=_[_0x76aa('0x38')](_0x2f7726,_0x76aa('0x36'));_0x113770[_0x76aa('0x3e')]=_[_0x76aa('0x3f')](_0x1c22f7[_0x76aa('0x3e')]);_0x113770['filters']=_['intersection'](_0x113770[_0x76aa('0x3d')],_0x113770[_0x76aa('0x3e')]);_0x4e131a[_0x76aa('0x40')]=_[_0x76aa('0x41')](_0x113770['model'],qs[_0x76aa('0x42')](_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x42')]));_0x4e131a[_0x76aa('0x40')]=_0x4e131a[_0x76aa('0x40')]['length']?_0x4e131a[_0x76aa('0x40')]:_0x113770['model'];if(!_0x1c22f7[_0x76aa('0x3e')]['hasOwnProperty']('nolimit')){_0x4e131a['limit']=qs[_0x76aa('0x2b')](_0x1c22f7['query']['limit']);_0x4e131a['offset']=qs[_0x76aa('0x29')](_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x29')]);}_0x4e131a[_0x76aa('0x43')]=qs[_0x76aa('0x44')](_0x1c22f7['query'][_0x76aa('0x44')]);_0x4e131a[_0x76aa('0x45')]=qs[_0x76aa('0x46')](_[_0x76aa('0x47')](_0x1c22f7[_0x76aa('0x3e')],_0x113770['filters']),_0x2f7726);if(_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x48')]){_0x4e131a['where']=_[_0x76aa('0x49')](_0x4e131a['where'],{'$or':_[_0x76aa('0x38')](_0x2f7726,function(_0x24ea05){if(_0x24ea05[_0x76aa('0x3c')]!==_0x76aa('0x4a')){var _0x2d0bc4={};_0x2d0bc4[_0x24ea05[_0x76aa('0x36')]]={'$like':'%'+_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x48')]+'%'};return _0x2d0bc4;}})});}_0x4e131a=_[_0x76aa('0x49')]({},_0x4e131a,_0x1c22f7[_0x76aa('0x4b')]);var _0x5e4967={'where':_0x4e131a[_0x76aa('0x45')]};return db['Trunk'][_0x76aa('0x2c')](_0x5e4967)[_0x76aa('0x1b')](function(_0x5e95f5){_0x1638db[_0x76aa('0x2c')]=_0x5e95f5;if(_0x1c22f7['query']['includeAll']){_0x4e131a[_0x76aa('0x4c')]=[{'all':!![]}];}return db['Trunk'][_0x76aa('0x4d')](_0x4e131a);})[_0x76aa('0x1b')](function(_0x4315b3){_0x1638db[_0x76aa('0x4e')]=_0x4315b3;return _0x1638db;})[_0x76aa('0x1b')](respondWithFilteredResult(_0x2eea79,_0x4e131a))[_0x76aa('0x24')](handleError(_0x2eea79,null));};exports['show']=function(_0x564546,_0x2fcf8f){var _0x1eafb2={'raw':![],'where':{'id':_0x564546[_0x76aa('0x4f')]['id']}},_0x1708d4={};_0x1708d4[_0x76aa('0x3d')]=_[_0x76aa('0x3f')](db['Trunk'][_0x76aa('0x3a')]);_0x1708d4[_0x76aa('0x3e')]=_[_0x76aa('0x3f')](_0x564546['query']);_0x1708d4[_0x76aa('0x46')]=_['intersection'](_0x1708d4[_0x76aa('0x3d')],_0x1708d4['query']);_0x1eafb2[_0x76aa('0x40')]=_[_0x76aa('0x41')](_0x1708d4[_0x76aa('0x3d')],qs[_0x76aa('0x42')](_0x564546[_0x76aa('0x3e')][_0x76aa('0x42')]));_0x1eafb2[_0x76aa('0x40')]=_0x1eafb2['attributes'][_0x76aa('0x50')]?_0x1eafb2['attributes']:_0x1708d4[_0x76aa('0x3d')];if(_0x564546[_0x76aa('0x3e')][_0x76aa('0x51')]){_0x1eafb2[_0x76aa('0x4c')]=[{'all':!![]}];}_0x1eafb2=_[_0x76aa('0x49')]({},_0x1eafb2,_0x564546[_0x76aa('0x4b')]);return db[_0x76aa('0x39')]['find'](_0x1eafb2)[_0x76aa('0x1b')](handleEntityNotFound(_0x2fcf8f,null))[_0x76aa('0x1b')](respondWithResult(_0x2fcf8f,null))[_0x76aa('0x24')](handleError(_0x2fcf8f,null));};exports[_0x76aa('0x52')]=function(_0x5c742c,_0xb9401b){var _0x163440={'where':{'id':_0x5c742c[_0x76aa('0x4f')]['id']}},_0x8dc601={};_0x8dc601[_0x76aa('0x3d')]=_[_0x76aa('0x3f')](db['Trunk'][_0x76aa('0x3a')]);_0x163440[_0x76aa('0x40')]=_[_0x76aa('0x41')](_0x8dc601[_0x76aa('0x3d')],qs[_0x76aa('0x42')](_0x5c742c[_0x76aa('0x3e')][_0x76aa('0x42')]));_0x163440['attributes']=_0x163440['attributes'][_0x76aa('0x50')]?_0x163440[_0x76aa('0x40')]:_0x8dc601['model'];if(_0x5c742c[_0x76aa('0x3e')][_0x76aa('0x51')]){_0x163440['include']=[{'all':!![]}];}_0x163440=_[_0x76aa('0x49')]({},_0x163440,_0x5c742c[_0x76aa('0x4b')]);return db[_0x76aa('0x39')][_0x76aa('0x53')](_0x163440)[_0x76aa('0x1b')](handleEntityNotFound(_0xb9401b,null))[_0x76aa('0x1b')](function(_0x3376ec){if(_0x3376ec){var _0x30573a=_0x3376ec[_0x76aa('0x54')]({'plain':!![]});_0x30573a=qs['omit'](_0x30573a,['id',_0x76aa('0x55'),'updatedAt']);_0x5c742c[_0x76aa('0x56')]=_[_0x76aa('0x57')](_0x5c742c[_0x76aa('0x56')],['id',_0x76aa('0x55'),_0x76aa('0x58')]);return db[_0x76aa('0x39')][_0x76aa('0x59')](_[_0x76aa('0x49')](_0x30573a,_0x5c742c[_0x76aa('0x56')]),{'include':_0x5c742c['query'][_0x76aa('0x51')]?[{'all':!![]}]:undefined})[_0x76aa('0x1b')](function(_0x5c542b){var _0xe5957d=_0x5c742c[_0x76aa('0x5a')][_0x76aa('0x54')]({'plain':!![]});if(!_0xe5957d)throw new Error(_0x76aa('0x5b'));if(_0xe5957d[_0x76aa('0x5c')]==='user'){var _0x364d05=_0x5c542b['get']({'plain':!![]});var _0x35bd2b=_0x76aa('0x33');return db[_0x76aa('0x5d')][_0x76aa('0x53')]({'where':{'name':_0x35bd2b,'userProfileId':_0xe5957d[_0x76aa('0x5e')]},'raw':!![]})[_0x76aa('0x1b')](function(_0x2bfb46){if(_0x2bfb46&&_0x2bfb46['autoAssociation']===0x0){return db[_0x76aa('0x34')][_0x76aa('0x59')]({'name':_0x364d05['name'],'resourceId':_0x364d05['id'],'type':_0x2bfb46['name'],'sectionId':_0x2bfb46['id']},{})[_0x76aa('0x1b')](function(){return _0x5c542b;});}else{return _0x5c542b;}})[_0x76aa('0x24')](function(_0x5295a7){logger[_0x76aa('0x20')](_0x76aa('0x5f'),_0x5295a7);throw _0x5295a7;});}return _0x5c542b;});}})[_0x76aa('0x1b')](respondWithResult(_0xb9401b,0xc9))['catch'](handleError(_0xb9401b,null));};exports[_0x76aa('0x59')]=function(_0x47f733,_0xf31e1f,_0x1178e5){var _0x2315cf;return db[_0x76aa('0x39')]['create'](_0x47f733['body'],{'raw':!![]})[_0x76aa('0x1b')](function(_0x4dfeb3){_0x2315cf=_0x4dfeb3;return db[_0x76aa('0x39')][_0x76aa('0x4d')]({'raw':!![]});})[_0x76aa('0x1b')](function(_0x43a2af){var _0x2dd320=fs[_0x76aa('0x60')](path[_0x76aa('0x61')](config[_0x76aa('0x62')],_0x76aa('0x63')),'utf8');var _0x7d02e7=fs[_0x76aa('0x60')](path[_0x76aa('0x61')](config[_0x76aa('0x62')],'server/files/templates/registry.ejs'),'utf8');var _0x557c11=ejs[_0x76aa('0x64')](_0x2dd320,{'trunks':_0x43a2af||[]});fs['writeFileSync'](_0x76aa('0x65'),_0x557c11);if(_0x2315cf[_0x76aa('0x66')]){var _0x38faff=ejs[_0x76aa('0x64')](_0x7d02e7,{'trunks':_0x43a2af||[]});fs['writeFileSync'](_0x76aa('0x67'),_0x38faff);}})['then'](function(){return respondWithRpcPromise(_0x76aa('0x68'),_0x76aa('0x59'),{'module':_0x76aa('0x69')});})[_0x76aa('0x1b')](function(){var _0x1037fb=_0x47f733['user'][_0x76aa('0x54')]({'plain':!![]});if(!_0x1037fb)throw new Error(_0x76aa('0x5b'));if(_0x1037fb[_0x76aa('0x5c')]===_0x76aa('0x5a')){var _0x32c1de=_0x2315cf[_0x76aa('0x54')]({'plain':!![]});return db[_0x76aa('0x5d')][_0x76aa('0x53')]({'where':{'name':'Trunks','userProfileId':_0x1037fb[_0x76aa('0x5e')]},'raw':!![]})[_0x76aa('0x1b')](function(_0x48136a){if(_0x48136a&&_0x48136a[_0x76aa('0x6a')]===0x0){return db[_0x76aa('0x34')][_0x76aa('0x59')]({'name':_0x32c1de[_0x76aa('0x36')],'resourceId':_0x32c1de['id'],'type':_0x48136a[_0x76aa('0x36')],'sectionId':_0x48136a['id']},{})[_0x76aa('0x1b')](function(){return _0x2315cf;});}else{return _0x2315cf;}})[_0x76aa('0x24')](function(_0x5dc923){logger[_0x76aa('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5dc923);throw _0x5dc923;});}return _0x2315cf;})['then'](respondWithResult(_0xf31e1f,0xc9))[_0x76aa('0x24')](handleError(_0xf31e1f,null));};exports[_0x76aa('0x6b')]=function(_0x5d8947,_0x5d1de1,_0x36da4d){var _0x14b5a2;return db[_0x76aa('0x39')]['find']({'where':{'id':_0x5d8947['params']['id']}})[_0x76aa('0x1b')](handleEntityNotFound(_0x5d1de1,null))[_0x76aa('0x1b')](saveUpdates(_0x5d8947[_0x76aa('0x56')],null))['then'](function(_0xb70589){if(_0xb70589){_0x14b5a2=_0xb70589;return db['Trunk'][_0x76aa('0x4d')]({'raw':!![]});}})[_0x76aa('0x1b')](function(_0x383290){if(_0x383290){var _0x325ffa=fs[_0x76aa('0x60')](path['join'](config['root'],_0x76aa('0x63')),_0x76aa('0x6c'));var _0x19ebb7=fs['readFileSync'](path[_0x76aa('0x61')](config[_0x76aa('0x62')],_0x76aa('0x6d')),_0x76aa('0x6c'));var _0x303b78=ejs['render'](_0x325ffa,{'trunks':_0x383290||[]});fs[_0x76aa('0x6e')]('/etc/asterisk/sip_xcally_trunks.conf',_0x303b78);var _0x213f7f=ejs[_0x76aa('0x64')](_0x19ebb7,{'trunks':_0x383290||[]});fs[_0x76aa('0x6e')](_0x76aa('0x67'),_0x213f7f);return respondWithRpcPromise(_0x76aa('0x68'),_0x76aa('0x6b'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x547411){if(_0x547411){return _0x14b5a2;}})['then'](respondWithResult(_0x5d1de1,null))['catch'](handleError(_0x5d1de1,null));};exports[_0x76aa('0x32')]=function(_0x22f44f,_0x52c5be,_0x5c2c91){var _0x4f01e9;return db[_0x76aa('0x39')][_0x76aa('0x53')]({'where':{'id':_0x22f44f[_0x76aa('0x4f')]['id']}})['then'](handleEntityNotFound(_0x52c5be,null))['then'](removeEntity(_0x52c5be,null))[_0x76aa('0x1b')](function(){return db[_0x76aa('0x39')][_0x76aa('0x4d')]({'raw':!![]});})[_0x76aa('0x1b')](function(_0x354c7b){var _0x55e526=fs['readFileSync'](path[_0x76aa('0x61')](config['root'],'server/files/templates/trunk.ejs'),'utf8');var _0x4673e6=fs[_0x76aa('0x60')](path['join'](config[_0x76aa('0x62')],_0x76aa('0x6d')),'utf8');var _0x22063f=ejs[_0x76aa('0x64')](_0x55e526,{'trunks':_0x354c7b});var _0x11d91f=ejs[_0x76aa('0x64')](_0x4673e6,{'trunks':_0x354c7b});fs[_0x76aa('0x6e')](_0x76aa('0x65'),_0x22063f);fs[_0x76aa('0x6e')](_0x76aa('0x67'),_0x11d91f);return respondWithRpcPromise(_0x76aa('0x68'),'destroy',{'module':_0x76aa('0x69')});})[_0x76aa('0x24')](handleError(_0x52c5be,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index fc7de33..5536be2 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 _0xb163=['tools_trunks','lodash','api','moment','bluebird','path','rimraf','./trunk.attributes','exports','define','Trunk'];(function(_0x727b33,_0x684869){var _0xe69eee=function(_0x51da3c){while(--_0x51da3c){_0x727b33['push'](_0x727b33['shift']());}};_0xe69eee(++_0x684869);}(_0xb163,0x135));var _0x3b16=function(_0x1b2414,_0x294d27){_0x1b2414=_0x1b2414-0x0;var _0x2e9886=_0xb163[_0x1b2414];return _0x2e9886;};'use strict';var _=require(_0x3b16('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3b16('0x1'));var moment=require(_0x3b16('0x2'));var BPromise=require(_0x3b16('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3b16('0x4'));var rimraf=require(_0x3b16('0x5'));var config=require('../../config/environment');var attributes=require(_0x3b16('0x6'));module[_0x3b16('0x7')]=function(_0xa3f444,_0x29fca8){return _0xa3f444[_0x3b16('0x8')](_0x3b16('0x9'),attributes,{'tableName':_0x3b16('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb1f8=['define','Trunk','tools_trunks','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./trunk.attributes'];(function(_0x93f77a,_0x3c6caa){var _0x23a34f=function(_0x5c650f){while(--_0x5c650f){_0x93f77a['push'](_0x93f77a['shift']());}};_0x23a34f(++_0x3c6caa);}(_0xb1f8,0x7b));var _0x8b1f=function(_0x1ed9ae,_0x49753c){_0x1ed9ae=_0x1ed9ae-0x0;var _0x4d292c=_0xb1f8[_0x1ed9ae];return _0x4d292c;};'use strict';var _=require(_0x8b1f('0x0'));var util=require(_0x8b1f('0x1'));var logger=require(_0x8b1f('0x2'))(_0x8b1f('0x3'));var moment=require(_0x8b1f('0x4'));var BPromise=require(_0x8b1f('0x5'));var rp=require(_0x8b1f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8b1f('0x7'));var attributes=require(_0x8b1f('0x8'));module['exports']=function(_0x41d3ef,_0x3e178c){return _0x41d3ef[_0x8b1f('0x9')](_0x8b1f('0xa'),attributes,{'tableName':_0x8b1f('0xb'),'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 c683e7c..7277767 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 _0x6682=['then','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes','include','map','model','find','ShowTrunk','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x4729b6,_0x1ba372){var _0x4ccc0b=function(_0x121280){while(--_0x121280){_0x4729b6['push'](_0x4729b6['shift']());}};_0x4ccc0b(++_0x1ba372);}(_0x6682,0xe2));var _0x2668=function(_0x2148e2,_0x43989c){_0x2148e2=_0x2148e2-0x0;var _0x1de357=_0x6682[_0x2148e2];return _0x1de357;};'use strict';var _=require(_0x2668('0x0'));var util=require(_0x2668('0x1'));var moment=require(_0x2668('0x2'));var BPromise=require(_0x2668('0x3'));var rs=require(_0x2668('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2668('0x5'))['db'];var utils=require(_0x2668('0x6'));var logger=require('../../config/logger')(_0x2668('0x7'));var config=require(_0x2668('0x8'));var jayson=require(_0x2668('0x9'));var client=jayson[_0x2668('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d883e,_0xb425cb,_0x246655){return new BPromise(function(_0x198ebe,_0x3bd5b9){return client[_0x2668('0xb')](_0x5d883e,_0x246655)[_0x2668('0xc')](function(_0x4ab7c8){logger['info'](_0x2668('0xd'),_0xb425cb,_0x2668('0xe'));logger[_0x2668('0xf')](_0x2668('0x10'),_0xb425cb,_0x2668('0xe'),JSON[_0x2668('0x11')](_0x4ab7c8));if(_0x4ab7c8['error']){if(_0x4ab7c8[_0x2668('0x12')]['code']===0x1f4){logger[_0x2668('0x12')](_0x2668('0xd'),_0xb425cb,_0x4ab7c8[_0x2668('0x12')][_0x2668('0x13')]);return _0x3bd5b9(_0x4ab7c8['error'][_0x2668('0x13')]);}logger[_0x2668('0x12')](_0x2668('0xd'),_0xb425cb,_0x4ab7c8[_0x2668('0x12')]['message']);return _0x198ebe(_0x4ab7c8[_0x2668('0x12')][_0x2668('0x13')]);}else{logger[_0x2668('0x14')]('Trunk,\x20%s,\x20%s',_0xb425cb,_0x2668('0xe'));_0x198ebe(_0x4ab7c8['result'][_0x2668('0x13')]);}})[_0x2668('0x15')](function(_0x1ceb5c){logger[_0x2668('0x12')](_0x2668('0xd'),_0xb425cb,_0x1ceb5c);_0x3bd5b9(_0x1ceb5c);});});}exports[_0x2668('0x16')]=function(_0x235756){var _0x56e6ee=this;return new Promise(function(_0x4d898e,_0x36476f){return db[_0x2668('0x17')][_0x2668('0x18')]({'raw':_0x235756[_0x2668('0x19')]?_0x235756[_0x2668('0x19')][_0x2668('0x1a')]===undefined?!![]:![]:!![],'where':_0x235756[_0x2668('0x19')]?_0x235756['options'][_0x2668('0x1b')]||null:null,'attributes':_0x235756['options']?_0x235756['options'][_0x2668('0x1c')]||null:null,'limit':_0x235756[_0x2668('0x19')]?_0x235756['options']['limit']||null:null,'include':_0x235756[_0x2668('0x19')]?_0x235756[_0x2668('0x19')][_0x2668('0x1d')]?_[_0x2668('0x1e')](_0x235756[_0x2668('0x19')][_0x2668('0x1d')],function(_0x57fe7c){return{'model':db[_0x57fe7c[_0x2668('0x1f')]],'as':_0x57fe7c['as'],'attributes':_0x57fe7c[_0x2668('0x1c')],'include':_0x57fe7c[_0x2668('0x1d')]?_[_0x2668('0x1e')](_0x57fe7c['include'],function(_0x44b837){return{'model':db[_0x44b837[_0x2668('0x1f')]],'as':_0x44b837['as'],'attributes':_0x44b837[_0x2668('0x1c')],'include':_0x44b837['include']?_[_0x2668('0x1e')](_0x44b837[_0x2668('0x1d')],function(_0x18a847){return{'model':db[_0x18a847[_0x2668('0x1f')]],'as':_0x18a847['as'],'attributes':_0x18a847[_0x2668('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2668('0xc')](function(_0xf58e09){logger['info']('GetTrunk',_0x235756);logger['debug'](_0x2668('0x16'),_0x235756,JSON[_0x2668('0x11')](_0xf58e09));_0x4d898e(_0xf58e09);})['catch'](function(_0x14f066){logger['error'](_0x2668('0x16'),_0x14f066[_0x2668('0x13')],_0x235756);_0x36476f(_0x56e6ee['error'](0x1f4,_0x14f066[_0x2668('0x13')]));});});};exports['ShowTrunk']=function(_0x50147e){var _0xa42d2e=this;return new Promise(function(_0x45d563,_0x8baafb){return db[_0x2668('0x17')][_0x2668('0x20')]({'raw':_0x50147e['options']?_0x50147e['options'][_0x2668('0x1a')]===undefined?!![]:![]:!![],'where':_0x50147e[_0x2668('0x19')]?_0x50147e[_0x2668('0x19')][_0x2668('0x1b')]||null:null,'attributes':_0x50147e[_0x2668('0x19')]?_0x50147e[_0x2668('0x19')][_0x2668('0x1c')]||null:null,'include':_0x50147e[_0x2668('0x19')]?_0x50147e['options'][_0x2668('0x1d')]?_['map'](_0x50147e['options'][_0x2668('0x1d')],function(_0x628e6b){return{'model':db[_0x628e6b[_0x2668('0x1f')]],'as':_0x628e6b['as'],'attributes':_0x628e6b['attributes'],'include':_0x628e6b['include']?_[_0x2668('0x1e')](_0x628e6b[_0x2668('0x1d')],function(_0x299ad9){return{'model':db[_0x299ad9[_0x2668('0x1f')]],'as':_0x299ad9['as'],'attributes':_0x299ad9[_0x2668('0x1c')],'include':_0x299ad9[_0x2668('0x1d')]?_['map'](_0x299ad9[_0x2668('0x1d')],function(_0x5a07c3){return{'model':db[_0x5a07c3['model']],'as':_0x5a07c3['as'],'attributes':_0x5a07c3[_0x2668('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2668('0xc')](function(_0x25b0df){logger['info']('ShowTrunk',_0x50147e);logger[_0x2668('0xf')](_0x2668('0x21'),_0x50147e,JSON['stringify'](_0x25b0df));_0x45d563(_0x25b0df);})['catch'](function(_0x7854d8){logger['error']('ShowTrunk',_0x7854d8[_0x2668('0x13')],_0x50147e);_0x8baafb(_0xa42d2e['error'](0x1f4,_0x7854d8['message']));});});}; \ No newline at end of file +var _0x75cf=['error','code','Trunk,\x20%s,\x20%s','message','info','result','GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowTrunk','find','lodash','util','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','stringify'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x75cf,0x18a));var _0xf75c=function(_0x58f579,_0x232e82){_0x58f579=_0x58f579-0x0;var _0x5d294c=_0x75cf[_0x58f579];return _0x5d294c;};'use strict';var _=require(_0xf75c('0x0'));var util=require(_0xf75c('0x1'));var moment=require('moment');var BPromise=require(_0xf75c('0x2'));var rs=require(_0xf75c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf75c('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf75c('0x5'));var config=require(_0xf75c('0x6'));var jayson=require(_0xf75c('0x7'));var client=jayson['client'][_0xf75c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x42726c,_0x17a78c,_0x3f76ae){return new BPromise(function(_0x4e010b,_0xe1b8c4){return client[_0xf75c('0x9')](_0x42726c,_0x3f76ae)[_0xf75c('0xa')](function(_0x29571b){logger['info']('Trunk,\x20%s,\x20%s',_0x17a78c,_0xf75c('0xb'));logger[_0xf75c('0xc')]('Trunk,\x20%s,\x20%s,\x20%s',_0x17a78c,'request\x20sent',JSON[_0xf75c('0xd')](_0x29571b));if(_0x29571b[_0xf75c('0xe')]){if(_0x29571b['error'][_0xf75c('0xf')]===0x1f4){logger[_0xf75c('0xe')](_0xf75c('0x10'),_0x17a78c,_0x29571b['error'][_0xf75c('0x11')]);return _0xe1b8c4(_0x29571b[_0xf75c('0xe')]['message']);}logger[_0xf75c('0xe')]('Trunk,\x20%s,\x20%s',_0x17a78c,_0x29571b[_0xf75c('0xe')][_0xf75c('0x11')]);return _0x4e010b(_0x29571b[_0xf75c('0xe')][_0xf75c('0x11')]);}else{logger[_0xf75c('0x12')](_0xf75c('0x10'),_0x17a78c,_0xf75c('0xb'));_0x4e010b(_0x29571b[_0xf75c('0x13')][_0xf75c('0x11')]);}})['catch'](function(_0x671055){logger[_0xf75c('0xe')](_0xf75c('0x10'),_0x17a78c,_0x671055);_0xe1b8c4(_0x671055);});});}exports[_0xf75c('0x14')]=function(_0x4e9f76){var _0x2ee5ea=this;return new Promise(function(_0x56c975,_0x38968a){return db[_0xf75c('0x15')][_0xf75c('0x16')]({'raw':_0x4e9f76[_0xf75c('0x17')]?_0x4e9f76[_0xf75c('0x17')][_0xf75c('0x18')]===undefined?!![]:![]:!![],'where':_0x4e9f76['options']?_0x4e9f76[_0xf75c('0x17')][_0xf75c('0x19')]||null:null,'attributes':_0x4e9f76['options']?_0x4e9f76[_0xf75c('0x17')][_0xf75c('0x1a')]||null:null,'limit':_0x4e9f76[_0xf75c('0x17')]?_0x4e9f76['options'][_0xf75c('0x1b')]||null:null,'include':_0x4e9f76[_0xf75c('0x17')]?_0x4e9f76[_0xf75c('0x17')][_0xf75c('0x1c')]?_[_0xf75c('0x1d')](_0x4e9f76[_0xf75c('0x17')]['include'],function(_0x1ef226){return{'model':db[_0x1ef226[_0xf75c('0x1e')]],'as':_0x1ef226['as'],'attributes':_0x1ef226[_0xf75c('0x1a')],'include':_0x1ef226[_0xf75c('0x1c')]?_[_0xf75c('0x1d')](_0x1ef226[_0xf75c('0x1c')],function(_0x39105f){return{'model':db[_0x39105f[_0xf75c('0x1e')]],'as':_0x39105f['as'],'attributes':_0x39105f[_0xf75c('0x1a')],'include':_0x39105f[_0xf75c('0x1c')]?_[_0xf75c('0x1d')](_0x39105f[_0xf75c('0x1c')],function(_0x2d07e8){return{'model':db[_0x2d07e8[_0xf75c('0x1e')]],'as':_0x2d07e8['as'],'attributes':_0x2d07e8['attributes']};}):[]};}):[]};}):[]:[]})[_0xf75c('0xa')](function(_0x5d5d42){logger[_0xf75c('0x12')](_0xf75c('0x14'),_0x4e9f76);logger[_0xf75c('0xc')](_0xf75c('0x14'),_0x4e9f76,JSON[_0xf75c('0xd')](_0x5d5d42));_0x56c975(_0x5d5d42);})[_0xf75c('0x1f')](function(_0x1e8a7a){logger[_0xf75c('0xe')](_0xf75c('0x14'),_0x1e8a7a['message'],_0x4e9f76);_0x38968a(_0x2ee5ea['error'](0x1f4,_0x1e8a7a[_0xf75c('0x11')]));});});};exports[_0xf75c('0x20')]=function(_0x106996){var _0x307fdf=this;return new Promise(function(_0x683557,_0x5889d9){return db[_0xf75c('0x15')][_0xf75c('0x21')]({'raw':_0x106996['options']?_0x106996['options'][_0xf75c('0x18')]===undefined?!![]:![]:!![],'where':_0x106996[_0xf75c('0x17')]?_0x106996[_0xf75c('0x17')][_0xf75c('0x19')]||null:null,'attributes':_0x106996[_0xf75c('0x17')]?_0x106996[_0xf75c('0x17')]['attributes']||null:null,'include':_0x106996[_0xf75c('0x17')]?_0x106996[_0xf75c('0x17')][_0xf75c('0x1c')]?_[_0xf75c('0x1d')](_0x106996['options'][_0xf75c('0x1c')],function(_0x2be37e){return{'model':db[_0x2be37e[_0xf75c('0x1e')]],'as':_0x2be37e['as'],'attributes':_0x2be37e['attributes'],'include':_0x2be37e[_0xf75c('0x1c')]?_[_0xf75c('0x1d')](_0x2be37e[_0xf75c('0x1c')],function(_0x21c149){return{'model':db[_0x21c149[_0xf75c('0x1e')]],'as':_0x21c149['as'],'attributes':_0x21c149[_0xf75c('0x1a')],'include':_0x21c149[_0xf75c('0x1c')]?_[_0xf75c('0x1d')](_0x21c149[_0xf75c('0x1c')],function(_0x31e7a5){return{'model':db[_0x31e7a5['model']],'as':_0x31e7a5['as'],'attributes':_0x31e7a5[_0xf75c('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf75c('0xa')](function(_0x5cd1ec){logger[_0xf75c('0x12')](_0xf75c('0x20'),_0x106996);logger[_0xf75c('0xc')](_0xf75c('0x20'),_0x106996,JSON[_0xf75c('0xd')](_0x5cd1ec));_0x683557(_0x5cd1ec);})[_0xf75c('0x1f')](function(_0x549bf5){logger[_0xf75c('0xe')](_0xf75c('0x20'),_0x549bf5[_0xf75c('0x11')],_0x106996);_0x5889d9(_0x307fdf[_0xf75c('0xe')](0x1f4,_0x549bf5['message']));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index b618d36..d78c035 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 _0x487b=['../../components/auth/service','put','/:id','isAuthenticated','update','exports','express'];(function(_0xc2688f,_0x1f2382){var _0x5175b5=function(_0x546bdc){while(--_0x546bdc){_0xc2688f['push'](_0xc2688f['shift']());}};_0x5175b5(++_0x1f2382);}(_0x487b,0x172));var _0xb487=function(_0xb99646,_0x5546f3){_0xb99646=_0xb99646-0x0;var _0x439ed7=_0x487b[_0xb99646];return _0x439ed7;};'use strict';var express=require(_0xb487('0x0'));var router=express['Router']();var auth=require(_0xb487('0x1'));var controller=require('./user-setting.controller');router[_0xb487('0x2')](_0xb487('0x3'),auth[_0xb487('0x4')](),controller[_0xb487('0x5')]);module[_0xb487('0x6')]=router; \ No newline at end of file +var _0xbe16=['exports','./user-setting.controller','put','/:id','isAuthenticated','update'];(function(_0x2bdc9c,_0x5e8782){var _0x4f906f=function(_0x1edcac){while(--_0x1edcac){_0x2bdc9c['push'](_0x2bdc9c['shift']());}};_0x4f906f(++_0x5e8782);}(_0xbe16,0xe5));var _0x6be1=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0xbe16[_0x1589dd];return _0x1bddd1;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x6be1('0x0'));router[_0x6be1('0x1')](_0x6be1('0x2'),auth[_0x6be1('0x3')](),controller[_0x6be1('0x4')]);module[_0x6be1('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 8429577..6dedd9e 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 _0xa578=['info','exports','ENUM','BOOLEAN','TEXT','DATE','UserId','sequelize','error'];(function(_0x4c750c,_0x3614ab){var _0x5d4cb8=function(_0x175dd1){while(--_0x175dd1){_0x4c750c['push'](_0x4c750c['shift']());}};_0x5d4cb8(++_0x3614ab);}(_0xa578,0x142));var _0x8a57=function(_0x2cc2f7,_0x9a53fd){_0x2cc2f7=_0x2cc2f7-0x0;var _0x17cfcf=_0xa578[_0x2cc2f7];return _0x17cfcf;};'use strict';var Sequelize=require(_0x8a57('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x8a57('0x1'),'warning',_0x8a57('0x2'),'debug'];module[_0x8a57('0x3')]={'clientSideLoggingLevel':{'type':Sequelize[_0x8a57('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x8a57('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x8a57('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x8a57('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':_0x8a57('0x8')}}; \ No newline at end of file +var _0x0eee=['info','debug','exports','ENUM','error','BOOLEAN','TEXT','INTEGER','sequelize','warning'];(function(_0xb301d4,_0x27ed18){var _0x3b5bde=function(_0x1fbc5f){while(--_0x1fbc5f){_0xb301d4['push'](_0xb301d4['shift']());}};_0x3b5bde(++_0x27ed18);}(_0x0eee,0x6c));var _0xe0ee=function(_0x75f869,_0x3690d6){_0x75f869=_0x75f869-0x0;var _0x10af8b=_0x0eee[_0x75f869];return _0x10af8b;};'use strict';var Sequelize=require(_0xe0ee('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error',_0xe0ee('0x1'),_0xe0ee('0x2'),_0xe0ee('0x3')];module[_0xe0ee('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0xe0ee('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xe0ee('0x6'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xe0ee('0x7')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xe0ee('0x8')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xe0ee('0x9')],'unique':'UserId'}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 712843a..dac59b4 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 _0x9bde=['stack','name','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','body','ioredis','api','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','defaults','localhost','status','json','update','then','sendStatus','error'];(function(_0x592196,_0x50c878){var _0x54825b=function(_0x42ff0d){while(--_0x42ff0d){_0x592196['push'](_0x592196['shift']());}};_0x54825b(++_0x50c878);}(_0x9bde,0xe1));var _0xe9bd=function(_0x4d2264,_0x70a1a9){_0x4d2264=_0x4d2264-0x0;var _0x3bb64c=_0x9bde[_0x4d2264];return _0x3bb64c;};'use strict';var _=require('lodash');var Redis=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var config=require('../../config/environment');var db=require(_0xe9bd('0x2'))['db'];var socket=require(_0xe9bd('0x3'))(new Redis(config[_0xe9bd('0x4')]));require(_0xe9bd('0x5'))[_0xe9bd('0x6')](socket);config[_0xe9bd('0x4')]=_[_0xe9bd('0x7')](config['redis'],{'host':_0xe9bd('0x8'),'port':0x18eb});function respondWithResult(_0x5f18fe,_0x22a438){_0x22a438=_0x22a438||0xc8;return function(_0xa66ae2){if(_0xa66ae2){return _0x5f18fe[_0xe9bd('0x9')](_0x22a438)[_0xe9bd('0xa')](_0xa66ae2);}};}function saveUpdates(_0x29bc2b){return function(_0xbefddb){if(_0xbefddb){return _0xbefddb[_0xe9bd('0xb')](_0x29bc2b)[_0xe9bd('0xc')](function(_0x581602){return _0x581602;});}return null;};}function handleEntityNotFound(_0x5f36c8){return function(_0x3c8e95){if(!_0x3c8e95){_0x5f36c8[_0xe9bd('0xd')](0x194);}return _0x3c8e95;};}function handleError(_0x2601ac,_0x581ab9){_0x581ab9=_0x581ab9||0x1f4;return function(_0x12c96e){logger[_0xe9bd('0xe')](_0x12c96e[_0xe9bd('0xf')]);if(_0x12c96e[_0xe9bd('0x10')]){delete _0x12c96e['name'];}_0x2601ac[_0xe9bd('0x9')](_0x581ab9)['send'](_0x12c96e);};}exports[_0xe9bd('0xb')]=function(_0x429e88,_0x3435b4){if(_0x429e88['user']['role']!==_0xe9bd('0x11'))throw new Error(_0xe9bd('0x12'));if(isNaN(Number(_0x429e88[_0xe9bd('0x13')]['id'])))throw new Error(_0xe9bd('0x14'));return db[_0xe9bd('0x15')][_0xe9bd('0x16')]({'where':{'id':_0x429e88[_0xe9bd('0x13')]['id']}})['then'](handleEntityNotFound(_0x3435b4,null))[_0xe9bd('0xc')](saveUpdates(_0x429e88[_0xe9bd('0x17')],null))[_0xe9bd('0xc')](respondWithResult(_0x3435b4,null))['catch'](handleError(_0x3435b4,null));}; \ No newline at end of file +var _0xf4dd=['../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','./user-setting.socket','redis','json','then','sendStatus','error','name','status','send','update','user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','body','lodash','ioredis'];(function(_0x4d4d3f,_0x5a3b09){var _0x17c930=function(_0xce3f2c){while(--_0xce3f2c){_0x4d4d3f['push'](_0x4d4d3f['shift']());}};_0x17c930(++_0x5a3b09);}(_0xf4dd,0xb4));var _0xdf4d=function(_0x13bdb4,_0x1f3f6c){_0x13bdb4=_0x13bdb4-0x0;var _0x101fbd=_0xf4dd[_0x13bdb4];return _0x101fbd;};'use strict';var _=require(_0xdf4d('0x0'));var Redis=require(_0xdf4d('0x1'));var logger=require(_0xdf4d('0x2'))(_0xdf4d('0x3'));var config=require(_0xdf4d('0x4'));var db=require(_0xdf4d('0x5'))['db'];var socket=require(_0xdf4d('0x6'))(new Redis(config['redis']));require(_0xdf4d('0x7'))['register'](socket);config[_0xdf4d('0x8')]=_['defaults'](config[_0xdf4d('0x8')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x4334b0,_0x5ee8f5){_0x5ee8f5=_0x5ee8f5||0xc8;return function(_0x64c256){if(_0x64c256){return _0x4334b0['status'](_0x5ee8f5)[_0xdf4d('0x9')](_0x64c256);}};}function saveUpdates(_0x313d25){return function(_0x1698c8){if(_0x1698c8){return _0x1698c8['update'](_0x313d25)[_0xdf4d('0xa')](function(_0x2a36e8){return _0x2a36e8;});}return null;};}function handleEntityNotFound(_0x1d9192){return function(_0x2eb239){if(!_0x2eb239){_0x1d9192[_0xdf4d('0xb')](0x194);}return _0x2eb239;};}function handleError(_0x2e2962,_0x3b332d){_0x3b332d=_0x3b332d||0x1f4;return function(_0x196875){logger[_0xdf4d('0xc')](_0x196875['stack']);if(_0x196875[_0xdf4d('0xd')]){delete _0x196875[_0xdf4d('0xd')];}_0x2e2962[_0xdf4d('0xe')](_0x3b332d)[_0xdf4d('0xf')](_0x196875);};}exports[_0xdf4d('0x10')]=function(_0x1dee52,_0x218cc3){if(_0x1dee52[_0xdf4d('0x11')][_0xdf4d('0x12')]!==_0xdf4d('0x13'))throw new Error(_0xdf4d('0x14'));if(isNaN(Number(_0x1dee52[_0xdf4d('0x15')]['id'])))throw new Error(_0xdf4d('0x16'));return db[_0xdf4d('0x17')][_0xdf4d('0x18')]({'where':{'id':_0x1dee52[_0xdf4d('0x15')]['id']}})[_0xdf4d('0xa')](handleEntityNotFound(_0x218cc3,null))[_0xdf4d('0xa')](saveUpdates(_0x1dee52[_0xdf4d('0x19')],null))['then'](respondWithResult(_0x218cc3,null))['catch'](handleError(_0x218cc3,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 5edc199..448d19d 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 _0x4ea1=['setMaxListeners','update','remove','emit','hook','exports','events','../../mysqldb','UserSetting'];(function(_0x4c207b,_0x59f530){var _0x560c4f=function(_0x289669){while(--_0x289669){_0x4c207b['push'](_0x4c207b['shift']());}};_0x560c4f(++_0x59f530);}(_0x4ea1,0xd5));var _0x14ea=function(_0x126006,_0x29d087){_0x126006=_0x126006-0x0;var _0x4df414=_0x4ea1[_0x126006];return _0x4df414;};'use strict';var EventEmitter=require(_0x14ea('0x0'));var UserSetting=require(_0x14ea('0x1'))['db'][_0x14ea('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x14ea('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x14ea('0x4'),'afterDestroy':_0x14ea('0x5')};function emitEvent(_0x39ca96){return function(_0x2ce945,_0x1669fb,_0xeb4d5c){UserSettingEvents[_0x14ea('0x6')](_0x39ca96+':'+_0x2ce945['id'],_0x2ce945);UserSettingEvents['emit'](_0x39ca96,_0x2ce945);_0xeb4d5c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0x14ea('0x7')](e,emitEvent(event));}}module[_0x14ea('0x8')]=UserSettingEvents; \ No newline at end of file +var _0x4101=['hook','exports','events','UserSetting','setMaxListeners','remove','hasOwnProperty'];(function(_0x1717a0,_0x3df0e9){var _0x4065f3=function(_0x54fce6){while(--_0x54fce6){_0x1717a0['push'](_0x1717a0['shift']());}};_0x4065f3(++_0x3df0e9);}(_0x4101,0x1e5));var _0x1410=function(_0x239632,_0x472e6a){_0x239632=_0x239632-0x0;var _0x2fad25=_0x4101[_0x239632];return _0x2fad25;};'use strict';var EventEmitter=require(_0x1410('0x0'));var UserSetting=require('../../mysqldb')['db'][_0x1410('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x1410('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x1410('0x3')};function emitEvent(_0x44e28a){return function(_0x35d487,_0x104106,_0x18ed17){UserSettingEvents['emit'](_0x44e28a+':'+_0x35d487['id'],_0x35d487);UserSettingEvents['emit'](_0x44e28a,_0x35d487);_0x18ed17(null);};}for(var e in events){if(events[_0x1410('0x4')](e)){var event=events[e];UserSetting[_0x1410('0x5')](e,emitEvent(event));}}module[_0x1410('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 48706e1..049f211 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 _0x9348=['exports','define','UserSetting','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x4578e7,_0x1c72a2){var _0x3db768=function(_0x58a4ed){while(--_0x58a4ed){_0x4578e7['push'](_0x4578e7['shift']());}};_0x3db768(++_0x1c72a2);}(_0x9348,0x10d));var _0x8934=function(_0x398f0d,_0x5150f8){_0x398f0d=_0x398f0d-0x0;var _0x1c9e8f=_0x9348[_0x398f0d];return _0x1c9e8f;};'use strict';var attributes=require(_0x8934('0x0'));module[_0x8934('0x1')]=function(_0x472223){return _0x472223[_0x8934('0x2')](_0x8934('0x3'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x34d032){if(!_0x34d032[_0x8934('0x4')])_0x34d032['clientSideLoggingEnabledSince']=null;else if(_0x34d032[_0x8934('0x5')]===null)_0x34d032[_0x8934('0x5')]=new Date();}}});}; \ No newline at end of file +var _0x8580=['define','clientSideLoggingEnabled','clientSideLoggingEnabledSince','exports'];(function(_0x54c72a,_0x5dd092){var _0x4264a2=function(_0x4905e1){while(--_0x4905e1){_0x54c72a['push'](_0x54c72a['shift']());}};_0x4264a2(++_0x5dd092);}(_0x8580,0x1c7));var _0x0858=function(_0x17a2d7,_0x3d3daa){_0x17a2d7=_0x17a2d7-0x0;var _0x4a38e3=_0x8580[_0x17a2d7];return _0x4a38e3;};'use strict';var attributes=require('./user-setting.attributes');module[_0x0858('0x0')]=function(_0x515938){return _0x515938[_0x0858('0x1')]('UserSetting',attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x12b52e){if(!_0x12b52e[_0x0858('0x2')])_0x12b52e['clientSideLoggingEnabledSince']=null;else if(_0x12b52e[_0x0858('0x3')]===null)_0x12b52e[_0x0858('0x3')]=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 a75c9f9..a03a375 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 _0xb583=['UserId','user-setting:','./user-setting.events','save','update','emit','user-setting:update','user-setting:update:user-'];(function(_0x795d1d,_0x2a06df){var _0x260dca=function(_0x12ce5f){while(--_0x12ce5f){_0x795d1d['push'](_0x795d1d['shift']());}};_0x260dca(++_0x2a06df);}(_0xb583,0x1b2));var _0x3b58=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xb583[_0x5b644e];return _0x49c6bf;};'use strict';var UserSettingEvents=require(_0x3b58('0x0'));var events=[_0x3b58('0x1'),'remove',_0x3b58('0x2')];function createListener(_0x1b725b,_0x100daf){return function(_0x34cc1b){_0x100daf[_0x3b58('0x3')](_0x1b725b,_0x34cc1b);if(_0x1b725b===_0x3b58('0x4')){_0x100daf[_0x3b58('0x3')](_0x3b58('0x5')+_0x34cc1b[_0x3b58('0x6')],_0x34cc1b);}};}exports['register']=function(_0x35ef44){for(var _0x1deb2e=0x0,_0x57de69=events['length'];_0x1deb2e<_0x57de69;_0x1deb2e++){var _0x1d44ff=events[_0x1deb2e];var _0x1eb9f5=createListener(_0x3b58('0x7')+_0x1d44ff,_0x35ef44);UserSettingEvents['on'](_0x1d44ff,_0x1eb9f5);}}; \ No newline at end of file +var _0xae75=['UserId','register','length','user-setting:','remove','emit','user-setting:update'];(function(_0x13f257,_0x3c3d67){var _0x455f37=function(_0x3471eb){while(--_0x3471eb){_0x13f257['push'](_0x13f257['shift']());}};_0x455f37(++_0x3c3d67);}(_0xae75,0x131));var _0x5ae7=function(_0x4dab62,_0x4ca2c9){_0x4dab62=_0x4dab62-0x0;var _0x4d0f07=_0xae75[_0x4dab62];return _0x4d0f07;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=['save',_0x5ae7('0x0'),'update'];function createListener(_0x573f75,_0xd79f4e){return function(_0x2b8c68){_0xd79f4e[_0x5ae7('0x1')](_0x573f75,_0x2b8c68);if(_0x573f75===_0x5ae7('0x2')){_0xd79f4e[_0x5ae7('0x1')]('user-setting:update:user-'+_0x2b8c68[_0x5ae7('0x3')],_0x2b8c68);}};}exports[_0x5ae7('0x4')]=function(_0x189527){for(var _0x251bb1=0x0,_0x209753=events[_0x5ae7('0x5')];_0x251bb1<_0x209753;_0x251bb1++){var _0x139b77=events[_0x251bb1];var _0x18bc03=createListener(_0x5ae7('0x6')+_0x139b77,_0x189527);UserSettingEvents['on'](_0x139b77,_0x18bc03);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 192a4b6..48528b3 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 _0xfb3f=['removeSmsInteractions','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeWhatsappAccounts','removeApiKey','exports','multer','util','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','/whoami','whoami','/presence','getPresence','/:id','show','getAvatar','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getLists','/:id/agents','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','addContacts','/create_many','addQueues','join','server/files/images/','format','%s-%s','now','originalname','/:id/avatar','single','file','addAvatar','/:id/login','login','/:id/logout','logout','pause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addMailAccounts','addChatWebsites','addWhatsappAccounts','createApiKey','put','update','/:id/password','removeTeams','delete','destroy','removeChatInteractions','/:id/fax_interactions'];(function(_0x223e5,_0x2cfbe8){var _0x49c76f=function(_0x2780b5){while(--_0x2780b5){_0x223e5['push'](_0x223e5['shift']());}};_0x49c76f(++_0x2cfbe8);}(_0xfb3f,0xd9));var _0xffb3=function(_0x4ffd5d,_0x13f96f){_0x4ffd5d=_0x4ffd5d-0x0;var _0x2ff70f=_0xfb3f[_0x4ffd5d];return _0x2ff70f;};'use strict';var multer=require(_0xffb3('0x0'));var util=require(_0xffb3('0x1'));var path=require('path');var timeout=require(_0xffb3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xffb3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xffb3('0x4'));var config=require(_0xffb3('0x5'));var controller=require(_0xffb3('0x6'));router[_0xffb3('0x7')]('/',auth[_0xffb3('0x8')](),controller[_0xffb3('0x9')]);router[_0xffb3('0x7')](_0xffb3('0xa'),auth['isAuthenticated'](),controller[_0xffb3('0xb')]);router[_0xffb3('0x7')](_0xffb3('0xc'),auth[_0xffb3('0x8')](),controller[_0xffb3('0xd')]);router['get'](_0xffb3('0xe'),auth[_0xffb3('0x8')](),controller[_0xffb3('0xf')]);router[_0xffb3('0x7')](_0xffb3('0x10'),auth[_0xffb3('0x8')](),controller[_0xffb3('0x11')]);router[_0xffb3('0x7')]('/:id/avatar',controller[_0xffb3('0x12')]);router[_0xffb3('0x7')]('/:id/open_tabs',auth[_0xffb3('0x8')](),controller[_0xffb3('0x13')]);router[_0xffb3('0x7')](_0xffb3('0x14'),auth[_0xffb3('0x8')](),controller[_0xffb3('0x15')]);router[_0xffb3('0x7')](_0xffb3('0x16'),auth[_0xffb3('0x8')](),controller[_0xffb3('0x17')]);router[_0xffb3('0x7')](_0xffb3('0x18'),auth['isAuthenticated'](),controller[_0xffb3('0x19')]);router[_0xffb3('0x7')](_0xffb3('0x1a'),auth['isAuthenticated'](),controller['getGroups']);router[_0xffb3('0x7')](_0xffb3('0x1b'),auth['isAuthenticated'](),controller[_0xffb3('0x1c')]);router[_0xffb3('0x7')](_0xffb3('0x1d'),auth['isAuthenticated'](),controller[_0xffb3('0x1e')]);router[_0xffb3('0x7')]('/:id/chat/interactions',auth[_0xffb3('0x8')](),controller[_0xffb3('0x1f')]);router[_0xffb3('0x7')](_0xffb3('0x20'),auth[_0xffb3('0x8')](),controller[_0xffb3('0x21')]);router[_0xffb3('0x7')]('/:id/mail/interactions',auth[_0xffb3('0x8')](),controller[_0xffb3('0x22')]);router['get'](_0xffb3('0x23'),auth['isAuthenticated'](),controller['getSmsInteractions']);router[_0xffb3('0x7')](_0xffb3('0x24'),auth[_0xffb3('0x8')](),controller[_0xffb3('0x25')]);router[_0xffb3('0x7')](_0xffb3('0x26'),auth['isAuthenticated'](),controller[_0xffb3('0x27')]);router['get'](_0xffb3('0x28'),auth[_0xffb3('0x8')](),controller['getTeams']);router[_0xffb3('0x7')]('/:id/lists',auth[_0xffb3('0x8')](),controller[_0xffb3('0x29')]);router[_0xffb3('0x7')](_0xffb3('0x2a'),auth['isAuthenticated'](),controller['getAgents']);router['get']('/:id/prefixes',auth[_0xffb3('0x8')](),controller['getVoicePrefixes']);router[_0xffb3('0x7')](_0xffb3('0x2b'),auth[_0xffb3('0x8')](),controller[_0xffb3('0x2c')]);router['get'](_0xffb3('0x2d'),auth[_0xffb3('0x8')](),controller['getMailAccounts']);router[_0xffb3('0x7')](_0xffb3('0x2e'),auth[_0xffb3('0x8')](),controller['getOpenchannelAccounts']);router[_0xffb3('0x7')](_0xffb3('0x2f'),auth[_0xffb3('0x8')](),controller['getSmsAccounts']);router[_0xffb3('0x7')](_0xffb3('0x30'),auth['isAuthenticated'](),controller[_0xffb3('0x31')]);router[_0xffb3('0x7')](_0xffb3('0x32'),auth[_0xffb3('0x8')](),controller[_0xffb3('0x33')]);router['get'](_0xffb3('0x34'),auth[_0xffb3('0x8')](),controller[_0xffb3('0x35')]);router['get'](_0xffb3('0x36'),auth[_0xffb3('0x8')](),controller['getApiKey']);router[_0xffb3('0x37')](_0xffb3('0x14'),auth['isAuthenticated'](),controller[_0xffb3('0x38')]);router[_0xffb3('0x37')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xffb3('0x39'),auth[_0xffb3('0x8')](),controller['bulkCreate']);router[_0xffb3('0x37')]('/:id/queues',auth[_0xffb3('0x8')](),controller[_0xffb3('0x3a')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xbe01ca,_0x562740,_0x20a558){_0x20a558(null,path[_0xffb3('0x3b')](config['root'],_0xffb3('0x3c')));},'filename':function(_0x42ef03,_0x2ff1b1,_0x153457){_0x153457(null,util[_0xffb3('0x3d')](_0xffb3('0x3e'),Date[_0xffb3('0x3f')](),_0x2ff1b1[_0xffb3('0x40')]));}})});router[_0xffb3('0x37')](_0xffb3('0x41'),upload[_0xffb3('0x42')](_0xffb3('0x43')),controller[_0xffb3('0x44')]);router['post'](_0xffb3('0x45'),auth[_0xffb3('0x8')](),controller[_0xffb3('0x46')]);router['post'](_0xffb3('0x47'),auth['isAuthenticated'](),controller[_0xffb3('0x48')]);router[_0xffb3('0x37')]('/:id/pause',auth[_0xffb3('0x8')](),controller[_0xffb3('0x49')]);router['post']('/:id/unpause',auth[_0xffb3('0x8')](),controller[_0xffb3('0x4a')]);router['post'](_0xffb3('0x28'),auth[_0xffb3('0x8')](),controller[_0xffb3('0x4b')]);router[_0xffb3('0x37')](_0xffb3('0x4c'),auth['isAuthenticated'](),controller[_0xffb3('0x4d')]);router[_0xffb3('0x37')](_0xffb3('0x4e'),auth[_0xffb3('0x8')](),controller[_0xffb3('0x4f')]);router['post']('/:id/fax_interactions',auth[_0xffb3('0x8')](),controller[_0xffb3('0x50')]);router['post'](_0xffb3('0x51'),auth[_0xffb3('0x8')](),controller[_0xffb3('0x52')]);router[_0xffb3('0x37')]('/:id/openchannel_interactions',auth['isAuthenticated'](),controller[_0xffb3('0x53')]);router[_0xffb3('0x37')](_0xffb3('0x54'),auth[_0xffb3('0x8')](),controller[_0xffb3('0x55')]);router[_0xffb3('0x37')]('/:id/fax_accounts',auth[_0xffb3('0x8')](),controller['addFaxAccounts']);router[_0xffb3('0x37')](_0xffb3('0x2d'),auth[_0xffb3('0x8')](),controller[_0xffb3('0x56')]);router['post']('/:id/openchannel_accounts',auth[_0xffb3('0x8')](),controller['addOpenchannelAccounts']);router[_0xffb3('0x37')](_0xffb3('0x2f'),auth[_0xffb3('0x8')](),controller['addSmsAccounts']);router[_0xffb3('0x37')](_0xffb3('0x30'),auth[_0xffb3('0x8')](),controller[_0xffb3('0x57')]);router[_0xffb3('0x37')]('/:id/whatsapp_accounts',auth[_0xffb3('0x8')](),controller[_0xffb3('0x58')]);router[_0xffb3('0x37')]('/:id/api_key',auth[_0xffb3('0x8')](),controller[_0xffb3('0x59')]);router[_0xffb3('0x5a')]('/:id',auth[_0xffb3('0x8')](),controller[_0xffb3('0x5b')]);router[_0xffb3('0x5a')](_0xffb3('0x5c'),auth['isAuthenticated'](),controller['changePassword']);router['delete']('/:id/queues',auth[_0xffb3('0x8')](),controller['removeQueues']);router['delete'](_0xffb3('0x28'),auth[_0xffb3('0x8')](),controller[_0xffb3('0x5d')]);router[_0xffb3('0x5e')](_0xffb3('0x10'),auth[_0xffb3('0x8')](),controller[_0xffb3('0x5f')]);router['delete'](_0xffb3('0x4c'),auth[_0xffb3('0x8')](),controller[_0xffb3('0x60')]);router[_0xffb3('0x5e')](_0xffb3('0x4e'),auth[_0xffb3('0x8')](),controller['removeMailInteractions']);router[_0xffb3('0x5e')](_0xffb3('0x61'),auth['isAuthenticated'](),controller['removeFaxInteractions']);router[_0xffb3('0x5e')]('/:id/sms_interactions',auth[_0xffb3('0x8')](),controller[_0xffb3('0x62')]);router[_0xffb3('0x5e')]('/:id/openchannel_interactions',auth['isAuthenticated'](),controller['removeOpenchannelInteractions']);router[_0xffb3('0x5e')]('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller['removeWhatsappInteractions']);router[_0xffb3('0x5e')](_0xffb3('0x2b'),auth[_0xffb3('0x8')](),controller['removeFaxAccounts']);router[_0xffb3('0x5e')]('/:id/mail_accounts',auth[_0xffb3('0x8')](),controller[_0xffb3('0x63')]);router['delete'](_0xffb3('0x2e'),auth[_0xffb3('0x8')](),controller[_0xffb3('0x64')]);router[_0xffb3('0x5e')]('/:id/sms_accounts',auth[_0xffb3('0x8')](),controller[_0xffb3('0x65')]);router[_0xffb3('0x5e')]('/:id/chat_websites',auth['isAuthenticated'](),controller['removeChatWebsites']);router[_0xffb3('0x5e')](_0xffb3('0x32'),auth['isAuthenticated'](),controller[_0xffb3('0x66')]);router[_0xffb3('0x5e')]('/:id/api_key',auth[_0xffb3('0x8')](),controller[_0xffb3('0x67')]);module[_0xffb3('0x68')]=router; \ No newline at end of file +var _0x6037=['changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeSmsInteractions','removeWhatsappInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./user.controller','isAuthenticated','index','get','/describe','describe','getPresence','show','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues_rt','getVoiceQueuesRt','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','/:id/teams','/:id/lists','/:id/agents','/:id/prefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','addContacts','/create_many','bulkCreate','/:id/queues','diskStorage','join','root','%s-%s','originalname','file','addAvatar','/:id/login','login','/:id/logout','/:id/pause','pause','/:id/unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addMailAccounts','addSmsAccounts','addChatWebsites','put','/:id','update','/:id/password'];(function(_0x2060d5,_0x158a73){var _0x3a7c33=function(_0x5dff04){while(--_0x5dff04){_0x2060d5['push'](_0x2060d5['shift']());}};_0x3a7c33(++_0x158a73);}(_0x6037,0xe2));var _0x7603=function(_0x5812f8,_0x53416d){_0x5812f8=_0x5812f8-0x0;var _0x18cbd5=_0x6037[_0x5812f8];return _0x18cbd5;};'use strict';var multer=require(_0x7603('0x0'));var util=require(_0x7603('0x1'));var path=require(_0x7603('0x2'));var timeout=require('connect-timeout');var express=require(_0x7603('0x3'));var router=express['Router']();var fs_extra=require(_0x7603('0x4'));var auth=require(_0x7603('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7603('0x6'));var controller=require(_0x7603('0x7'));router['get']('/',auth[_0x7603('0x8')](),controller[_0x7603('0x9')]);router[_0x7603('0xa')](_0x7603('0xb'),auth[_0x7603('0x8')](),controller[_0x7603('0xc')]);router[_0x7603('0xa')]('/whoami',auth[_0x7603('0x8')](),controller['whoami']);router[_0x7603('0xa')]('/presence',auth['isAuthenticated'](),controller[_0x7603('0xd')]);router[_0x7603('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x7603('0xe')]);router['get']('/:id/avatar',controller[_0x7603('0xf')]);router[_0x7603('0xa')](_0x7603('0x10'),auth[_0x7603('0x8')](),controller[_0x7603('0x11')]);router['get'](_0x7603('0x12'),auth[_0x7603('0x8')](),controller[_0x7603('0x13')]);router[_0x7603('0xa')]('/:id/queues',auth[_0x7603('0x8')](),controller['getQueues']);router[_0x7603('0xa')](_0x7603('0x14'),auth[_0x7603('0x8')](),controller[_0x7603('0x15')]);router[_0x7603('0xa')]('/:id/groups',auth[_0x7603('0x8')](),controller['getGroups']);router['get'](_0x7603('0x16'),auth[_0x7603('0x8')](),controller[_0x7603('0x17')]);router[_0x7603('0xa')](_0x7603('0x18'),auth['isAuthenticated'](),controller[_0x7603('0x19')]);router[_0x7603('0xa')](_0x7603('0x1a'),auth[_0x7603('0x8')](),controller['getChatInteractions']);router['get']('/:id/openchannel/interactions',auth[_0x7603('0x8')](),controller[_0x7603('0x1b')]);router[_0x7603('0xa')](_0x7603('0x1c'),auth[_0x7603('0x8')](),controller[_0x7603('0x1d')]);router[_0x7603('0xa')](_0x7603('0x1e'),auth[_0x7603('0x8')](),controller[_0x7603('0x1f')]);router['get'](_0x7603('0x20'),auth[_0x7603('0x8')](),controller[_0x7603('0x21')]);router[_0x7603('0xa')]('/:id/whatsapp/interactions',auth[_0x7603('0x8')](),controller[_0x7603('0x22')]);router[_0x7603('0xa')](_0x7603('0x23'),auth[_0x7603('0x8')](),controller['getTeams']);router[_0x7603('0xa')](_0x7603('0x24'),auth[_0x7603('0x8')](),controller['getLists']);router[_0x7603('0xa')](_0x7603('0x25'),auth['isAuthenticated'](),controller['getAgents']);router[_0x7603('0xa')](_0x7603('0x26'),auth[_0x7603('0x8')](),controller['getVoicePrefixes']);router['get'](_0x7603('0x27'),auth[_0x7603('0x8')](),controller[_0x7603('0x28')]);router[_0x7603('0xa')](_0x7603('0x29'),auth[_0x7603('0x8')](),controller[_0x7603('0x2a')]);router[_0x7603('0xa')](_0x7603('0x2b'),auth[_0x7603('0x8')](),controller['getOpenchannelAccounts']);router['get'](_0x7603('0x2c'),auth[_0x7603('0x8')](),controller[_0x7603('0x2d')]);router[_0x7603('0xa')](_0x7603('0x2e'),auth[_0x7603('0x8')](),controller['getChatWebsites']);router['get'](_0x7603('0x2f'),auth[_0x7603('0x8')](),controller[_0x7603('0x30')]);router[_0x7603('0xa')](_0x7603('0x31'),auth[_0x7603('0x8')](),controller[_0x7603('0x32')]);router[_0x7603('0xa')](_0x7603('0x33'),auth[_0x7603('0x8')](),controller['getApiKey']);router[_0x7603('0x34')](_0x7603('0x12'),auth[_0x7603('0x8')](),controller[_0x7603('0x35')]);router['post']('/',auth[_0x7603('0x8')](),controller['create']);router[_0x7603('0x34')](_0x7603('0x36'),auth['isAuthenticated'](),controller[_0x7603('0x37')]);router[_0x7603('0x34')](_0x7603('0x38'),auth['isAuthenticated'](),controller['addQueues']);var upload=multer({'storage':multer[_0x7603('0x39')]({'destination':function(_0x1bad72,_0x41601c,_0x14d484){_0x14d484(null,path[_0x7603('0x3a')](config[_0x7603('0x3b')],'server/files/images/'));},'filename':function(_0x1fed12,_0x5d41a0,_0x4106d6){_0x4106d6(null,util['format'](_0x7603('0x3c'),Date['now'](),_0x5d41a0[_0x7603('0x3d')]));}})});router[_0x7603('0x34')]('/:id/avatar',upload['single'](_0x7603('0x3e')),controller[_0x7603('0x3f')]);router['post'](_0x7603('0x40'),auth[_0x7603('0x8')](),controller[_0x7603('0x41')]);router[_0x7603('0x34')](_0x7603('0x42'),auth[_0x7603('0x8')](),controller['logout']);router[_0x7603('0x34')](_0x7603('0x43'),auth[_0x7603('0x8')](),controller[_0x7603('0x44')]);router[_0x7603('0x34')](_0x7603('0x45'),auth[_0x7603('0x8')](),controller['unpause']);router[_0x7603('0x34')]('/:id/teams',auth[_0x7603('0x8')](),controller[_0x7603('0x46')]);router[_0x7603('0x34')](_0x7603('0x47'),auth[_0x7603('0x8')](),controller[_0x7603('0x48')]);router[_0x7603('0x34')](_0x7603('0x49'),auth[_0x7603('0x8')](),controller[_0x7603('0x4a')]);router[_0x7603('0x34')](_0x7603('0x4b'),auth[_0x7603('0x8')](),controller[_0x7603('0x4c')]);router['post']('/:id/sms_interactions',auth[_0x7603('0x8')](),controller[_0x7603('0x4d')]);router['post'](_0x7603('0x4e'),auth[_0x7603('0x8')](),controller[_0x7603('0x4f')]);router[_0x7603('0x34')](_0x7603('0x50'),auth[_0x7603('0x8')](),controller[_0x7603('0x51')]);router['post']('/:id/fax_accounts',auth['isAuthenticated'](),controller['addFaxAccounts']);router[_0x7603('0x34')]('/:id/mail_accounts',auth[_0x7603('0x8')](),controller[_0x7603('0x52')]);router[_0x7603('0x34')]('/:id/openchannel_accounts',auth[_0x7603('0x8')](),controller['addOpenchannelAccounts']);router[_0x7603('0x34')](_0x7603('0x2c'),auth[_0x7603('0x8')](),controller[_0x7603('0x53')]);router[_0x7603('0x34')]('/:id/chat_websites',auth[_0x7603('0x8')](),controller[_0x7603('0x54')]);router[_0x7603('0x34')](_0x7603('0x2f'),auth[_0x7603('0x8')](),controller['addWhatsappAccounts']);router[_0x7603('0x34')](_0x7603('0x33'),auth[_0x7603('0x8')](),controller['createApiKey']);router[_0x7603('0x55')](_0x7603('0x56'),auth[_0x7603('0x8')](),controller[_0x7603('0x57')]);router[_0x7603('0x55')](_0x7603('0x58'),auth[_0x7603('0x8')](),controller[_0x7603('0x59')]);router[_0x7603('0x5a')](_0x7603('0x38'),auth[_0x7603('0x8')](),controller[_0x7603('0x5b')]);router[_0x7603('0x5a')](_0x7603('0x23'),auth['isAuthenticated'](),controller[_0x7603('0x5c')]);router[_0x7603('0x5a')](_0x7603('0x56'),auth['isAuthenticated'](),controller[_0x7603('0x5d')]);router[_0x7603('0x5a')]('/:id/chat_interactions',auth[_0x7603('0x8')](),controller[_0x7603('0x5e')]);router['delete']('/:id/mail_interactions',auth[_0x7603('0x8')](),controller[_0x7603('0x5f')]);router['delete'](_0x7603('0x4b'),auth[_0x7603('0x8')](),controller['removeFaxInteractions']);router[_0x7603('0x5a')]('/:id/sms_interactions',auth[_0x7603('0x8')](),controller[_0x7603('0x60')]);router['delete'](_0x7603('0x4e'),auth[_0x7603('0x8')](),controller['removeOpenchannelInteractions']);router[_0x7603('0x5a')](_0x7603('0x50'),auth[_0x7603('0x8')](),controller[_0x7603('0x61')]);router[_0x7603('0x5a')]('/:id/fax_accounts',auth[_0x7603('0x8')](),controller[_0x7603('0x62')]);router[_0x7603('0x5a')](_0x7603('0x29'),auth['isAuthenticated'](),controller['removeMailAccounts']);router[_0x7603('0x5a')](_0x7603('0x2b'),auth[_0x7603('0x8')](),controller[_0x7603('0x63')]);router[_0x7603('0x5a')](_0x7603('0x2c'),auth[_0x7603('0x8')](),controller[_0x7603('0x64')]);router[_0x7603('0x5a')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0x7603('0x65')]);router[_0x7603('0x5a')](_0x7603('0x2f'),auth['isAuthenticated'](),controller[_0x7603('0x66')]);router['delete'](_0x7603('0x33'),auth['isAuthenticated'](),controller[_0x7603('0x67')]);module[_0x7603('0x68')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index e633c7d..47e304a 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 _0x34e8=['isArray','wss','encryption','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','rtcp_mux','avpf','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','permissions','map','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','sequelize','moment','util','lodash','STRING','name','setDataValue','defaultuser','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','agent','telephone','local','INTEGER','accountcode','BOOLEAN','DEFAULT\x20PAUSE','DATE','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','certificate','passive','actpass','update,nonat','TEXT','showWebBar','get'];(function(_0x59c160,_0x3f143c){var _0x10de43=function(_0x4be0f3){while(--_0x4be0f3){_0x59c160['push'](_0x59c160['shift']());}};_0x10de43(++_0x3f143c);}(_0x34e8,0x12c));var _0x834e=function(_0x5518e9,_0x30ca01){_0x5518e9=_0x5518e9-0x0;var _0x70fbd8=_0x34e8[_0x5518e9];return _0x70fbd8;};'use strict';var Sequelize=require(_0x834e('0x0'));var moment=require(_0x834e('0x1'));var util=require(_0x834e('0x2'));var _=require(_0x834e('0x3'));module['exports']={'name':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'unique':_0x834e('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x472111){this[_0x834e('0x6')](_0x834e('0x5'),_0x472111);this[_0x834e('0x6')](_0x834e('0x7'),_0x472111);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'set':function(_0x52056d){this[_0x834e('0x6')](_0x834e('0x8'),_0x52056d);this[_0x834e('0x6')](_0x834e('0x9'),util[_0x834e('0xa')](_0x834e('0xb'),_0x52056d,this[_0x834e('0xc')](_0x834e('0xd'))));}},'alias':{'type':Sequelize[_0x834e('0x4')]},'email':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'unique':_0x834e('0xe'),'validate':{'isEmail':!![]},'set':function(_0x36e124){if(_0x36e124){this[_0x834e('0x6')](_0x834e('0xe'),_0x36e124[_0x834e('0xf')]());}}},'role':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x11'),'user',_0x834e('0x12'),_0x834e('0x13')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x834e('0x4')],'defaultValue':_0x834e('0x14')},'internal':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':![],'unique':_0x834e('0xd'),'set':function(_0x50e860){this[_0x834e('0x6')](_0x834e('0xd'),_0x50e860);this['setDataValue'](_0x834e('0x16'),_0x50e860);this['setDataValue'](_0x834e('0x9'),util[_0x834e('0xa')]('\x22%s\x22\x20<%s>',this[_0x834e('0xc')](_0x834e('0x8')),_0x50e860));}},'salt':{'type':Sequelize[_0x834e('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x834e('0x4')]},'address':{'type':Sequelize[_0x834e('0x4')]},'zipcode':{'type':Sequelize[_0x834e('0x4')]},'userpic':{'type':Sequelize[_0x834e('0x4')]},'city':{'type':Sequelize[_0x834e('0x4')]},'country':{'type':Sequelize[_0x834e('0x4')]},'online':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x834e('0x18')},'lastPauseAt':{'type':Sequelize[_0x834e('0x19')]},'chatCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x834e('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x834e('0x1a')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x834e('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM']('friend','user','peer'),'allowNull':!![],'defaultValue':_0x834e('0x1b')},'context':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x1c')},'callingpres':{'type':Sequelize['ENUM'](_0x834e('0x1d'),_0x834e('0x1e'),_0x834e('0x1f'),_0x834e('0x20'),_0x834e('0x21'),_0x834e('0x22'),_0x834e('0x23'),_0x834e('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x25'),'set':function(_0x2b3418){this[_0x834e('0x6')](_0x834e('0x26'),_0x2b3418?_0x2b3418[_0x834e('0x27')](','):null);},'get':function(){return this[_0x834e('0xc')](_0x834e('0x26'))?this[_0x834e('0xc')]('transport')[_0x834e('0x28')](','):null;},'comment':_0x834e('0x29')},'dtmfmode':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2a'),'info',_0x834e('0x2b'),_0x834e('0x2c'),'auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x2e'),_0x834e('0x2f'),_0x834e('0x30')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x834e('0x31'),'set':function(_0x6a3ac){this['setDataValue'](_0x834e('0x32'),_0x6a3ac?_0x6a3ac[_0x834e('0x27')](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0x834e('0xc')](_0x834e('0x32'))[_0x834e('0x28')](','):null;},'comment':_0x834e('0x33')},'callgroup':{'type':Sequelize[_0x834e('0x4')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x834e('0x4')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x834e('0x4')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x834e('0x34')},'allow':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'defaultValue':_0x834e('0x35'),'set':function(_0x3c59af){this[_0x834e('0x6')]('allow',_0x3c59af?_0x3c59af[_0x834e('0x27')](';'):_0x834e('0x35'));},'get':function(){return this[_0x834e('0xc')]('allow')?this[_0x834e('0xc')](_0x834e('0x36'))['split'](';'):null;},'comment':_0x834e('0x37')},'autoframing':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'set':function(_0x4a18bb){this['setDataValue'](_0x834e('0x38'),_0x4a18bb?_0x4a18bb[_0x834e('0x27')](','):null);},'get':function(){return this[_0x834e('0xc')](_0x834e('0x38'))?this[_0x834e('0xc')](_0x834e('0x38'))[_0x834e('0x28')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x834e('0x10')]('yes','no',_0x834e('0x39')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x3a')},'amaflags':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x834e('0x2d')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x3b')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x3c'),_0x834e('0x3d'),_0x834e('0x3e')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x3f'),_0x834e('0x40')),'allowNull':!![],'defaultValue':_0x834e('0x40')},'t38pt_usertpsource':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x834e('0x2d')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x834e('0x10')]('yes','no','fingerprint',_0x834e('0x41')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x834e('0x10')]('active',_0x834e('0x42'),_0x834e('0x43')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x2e'),_0x834e('0x2f'),_0x834e('0x44')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x834e('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x834e('0x19')]},'passwordResetAt':{'type':Sequelize[_0x834e('0x19')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x834e('0x45')]},'showWebBar':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0,'set':function(_0x1e4310){this[_0x834e('0x6')](_0x834e('0x46'),_0x1e4310);var _0x1659c8=this[_0x834e('0x47')]({'plain':!![]});switch(_0x1e4310){case 0x0:case 0x1:var _0x17b8e3=_0x1659c8[_0x834e('0x26')]?_[_0x834e('0x48')](_0x1659c8[_0x834e('0x26')])?_0x1659c8[_0x834e('0x26')][_0x834e('0x27')]():_0x1659c8[_0x834e('0x26')]:'udp';if(_0x17b8e3===_0x834e('0x49')){_0x17b8e3=_0x834e('0x25');}this[_0x834e('0x6')](_0x834e('0x26'),_0x17b8e3);this['setDataValue'](_0x834e('0x4a'),'no');this['setDataValue']('avpf',null);this[_0x834e('0x6')](_0x834e('0x4b'),null);this[_0x834e('0x6')](_0x834e('0x4c'),null);this[_0x834e('0x6')](_0x834e('0x4d'),null);this[_0x834e('0x6')](_0x834e('0x4e'),null);this['setDataValue'](_0x834e('0x4f'),null);this['setDataValue'](_0x834e('0x50'),null);this[_0x834e('0x6')]('dtlsprivatekey',null);this['setDataValue'](_0x834e('0x51'),'no');break;case 0x2:this[_0x834e('0x6')](_0x834e('0x26'),_0x834e('0x49'));this[_0x834e('0x6')]('encryption',_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x52'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4b'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4c'),_0x834e('0x2d'));this['setDataValue'](_0x834e('0x4d'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4e'),'no');this['setDataValue'](_0x834e('0x4f'),'actpass');this['setDataValue']('dtlscertfile',_0x1659c8[_0x834e('0x50')]||_0x834e('0x53'));this['setDataValue'](_0x834e('0x54'),_0x1659c8[_0x834e('0x54')]||'/etc/pki/tls/private/motion.key');this[_0x834e('0x6')](_0x834e('0x51'),'yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x346be5){this[_0x834e('0x6')](_0x834e('0x55'),_0x346be5?_0x346be5[_0x834e('0x27')](','):[]);},'get':function(){return this[_0x834e('0xc')]('permissions')?_[_0x834e('0x56')](this['getDataValue'](_0x834e('0x55'))[_0x834e('0x28')](','),function(_0x2c758c){return parseInt(_0x2c758c,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x834e('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x834e('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x834e('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x834e('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('phoneBarEnableScreenRecordingByAgent')?this[_0x834e('0xc')](_0x834e('0x57')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![],'set':function(_0x18ddac){if(typeof _0x18ddac===_0x834e('0x58')){var _0x5acf5c=_0x18ddac==='1'?!![]:_0x18ddac==='0'?![]:_0x18ddac===_0x834e('0x59')?!![]:_0x18ddac===_0x834e('0x5a')?![]:![];this[_0x834e('0x6')]('screenrecording',_0x5acf5c);}else{this[_0x834e('0x6')](_0x834e('0x5b'),_0x18ddac);}}},'blocked':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![],'set':function(_0x443633){this[_0x834e('0x6')]('blocked',_0x443633);if(_0x443633===!![]){this['setDataValue'](_0x834e('0x5c'),moment());this[_0x834e('0x6')]('loginAttempts',0x0);}else{this[_0x834e('0x6')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x834e('0x19')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x834e('0x15')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0}}; \ No newline at end of file +var _0x70e0=['refuse','originate','uac','uas','fingerprint','update,nonat','TEXT','showWebBar','get','isArray','wss','udp','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','actpass','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','INTEGER','BOOLEAN','DATE','dynamic','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','join','transport','split','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','ulaw;alaw;gsm','allow','insecure','\x22\x22\x20<>','always','accept'];(function(_0x5655f6,_0x11cb44){var _0x4162c3=function(_0x9ce0da){while(--_0x9ce0da){_0x5655f6['push'](_0x5655f6['shift']());}};_0x4162c3(++_0x11cb44);}(_0x70e0,0x17b));var _0x070e=function(_0x2cff92,_0x3f6b35){_0x2cff92=_0x2cff92-0x0;var _0x976087=_0x70e0[_0x2cff92];return _0x976087;};'use strict';var Sequelize=require(_0x070e('0x0'));var moment=require(_0x070e('0x1'));var util=require(_0x070e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'unique':_0x070e('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x277d32){this[_0x070e('0x5')]('name',_0x277d32);this[_0x070e('0x5')]('defaultuser',_0x277d32);},'comment':_0x070e('0x6')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x56e420){this['setDataValue'](_0x070e('0x7'),_0x56e420);this[_0x070e('0x5')](_0x070e('0x8'),util[_0x070e('0x9')](_0x070e('0xa'),_0x56e420,this[_0x070e('0xb')](_0x070e('0xc'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x070e('0xd'),'validate':{'isEmail':!![]},'set':function(_0x2e3e5e){if(_0x2e3e5e){this[_0x070e('0x5')](_0x070e('0xd'),_0x2e3e5e[_0x070e('0xe')]());}}},'role':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x10'),_0x070e('0x11'),_0x070e('0x12'),_0x070e('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':![],'unique':'internal','set':function(_0x4a33d2){this['setDataValue'](_0x070e('0xc'),_0x4a33d2);this[_0x070e('0x5')]('accountcode',_0x4a33d2);this['setDataValue'](_0x070e('0x8'),util[_0x070e('0x9')](_0x070e('0xa'),this[_0x070e('0xb')]('fullname'),_0x4a33d2));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x070e('0x3')]},'mobile':{'type':Sequelize[_0x070e('0x3')]},'address':{'type':Sequelize[_0x070e('0x3')]},'zipcode':{'type':Sequelize[_0x070e('0x3')]},'userpic':{'type':Sequelize[_0x070e('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x070e('0x3')]},'online':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x070e('0x16')]},'voicePause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x070e('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x070e('0x16')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x070e('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x17')},'ipaddr':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x070e('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x18'),_0x070e('0x11'),_0x070e('0x19')),'allowNull':!![],'defaultValue':_0x070e('0x18')},'context':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x1a'),_0x070e('0x1b'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0x070e('0x1c'),_0x070e('0x1d'),_0x070e('0x1e'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'udp','set':function(_0x59c5b4){this[_0x070e('0x5')]('transport',_0x59c5b4?_0x59c5b4[_0x070e('0x1f')](','):null);},'get':function(){return this[_0x070e('0xb')]('transport')?this['getDataValue'](_0x070e('0x20'))[_0x070e('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0x070e('0x22'),_0x070e('0x23'),_0x070e('0x24'),_0x070e('0x25'),_0x070e('0x26')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no',_0x070e('0x28'),_0x070e('0x29'),_0x070e('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x2b'),'set':function(_0x34746e){this['setDataValue']('nat',_0x34746e?_0x34746e['join'](','):null);},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2c'))?this[_0x070e('0xb')](_0x070e('0x2c'))[_0x070e('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x070e('0x3')]},'namedcallgroup':{'type':Sequelize[_0x070e('0x3')]},'pickupgroup':{'type':Sequelize[_0x070e('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x070e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x070e('0x3')]},'disallow':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'defaultValue':_0x070e('0x2d'),'set':function(_0x4800a9){this[_0x070e('0x5')]('allow',_0x4800a9?_0x4800a9[_0x070e('0x1f')](';'):_0x070e('0x2d'));},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2e'))?this[_0x070e('0xb')]('allow')[_0x070e('0x21')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![],'set':function(_0x38879f){this['setDataValue'](_0x070e('0x2f'),_0x38879f?_0x38879f[_0x070e('0x1f')](','):null);},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2f'))?this['getDataValue'](_0x070e('0x2f'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x30')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':_0x070e('0x27')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no',_0x070e('0x31')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x32'),_0x070e('0x33'),_0x070e('0x34')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x35'),'uas'),'allowNull':!![],'defaultValue':_0x070e('0x36')},'t38pt_usertpsource':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':_0x070e('0x27')},'keepalive':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no',_0x070e('0x37'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x070e('0xf')]('active','passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no',_0x070e('0x28'),'update',_0x070e('0x38')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x070e('0x16')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x070e('0x39')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x4cb86f){this['setDataValue'](_0x070e('0x3a'),_0x4cb86f);var _0x1ae5cb=this[_0x070e('0x3b')]({'plain':!![]});switch(_0x4cb86f){case 0x0:case 0x1:var _0x122198=_0x1ae5cb[_0x070e('0x20')]?_[_0x070e('0x3c')](_0x1ae5cb['transport'])?_0x1ae5cb[_0x070e('0x20')]['join']():_0x1ae5cb[_0x070e('0x20')]:'udp';if(_0x122198===_0x070e('0x3d')){_0x122198=_0x070e('0x3e');}this['setDataValue'](_0x070e('0x20'),_0x122198);this['setDataValue'](_0x070e('0x3f'),'no');this[_0x070e('0x5')](_0x070e('0x40'),null);this[_0x070e('0x5')](_0x070e('0x41'),null);this[_0x070e('0x5')](_0x070e('0x42'),null);this[_0x070e('0x5')](_0x070e('0x43'),null);this[_0x070e('0x5')](_0x070e('0x44'),null);this[_0x070e('0x5')](_0x070e('0x45'),null);this[_0x070e('0x5')]('dtlscertfile',null);this[_0x070e('0x5')](_0x070e('0x46'),null);this[_0x070e('0x5')](_0x070e('0x47'),'no');break;case 0x2:this['setDataValue'](_0x070e('0x20'),_0x070e('0x3d'));this[_0x070e('0x5')](_0x070e('0x3f'),_0x070e('0x27'));this[_0x070e('0x5')]('avpf',_0x070e('0x27'));this[_0x070e('0x5')](_0x070e('0x41'),_0x070e('0x27'));this['setDataValue'](_0x070e('0x42'),'yes');this[_0x070e('0x5')](_0x070e('0x43'),_0x070e('0x27'));this[_0x070e('0x5')](_0x070e('0x44'),'no');this['setDataValue'](_0x070e('0x45'),_0x070e('0x48'));this[_0x070e('0x5')](_0x070e('0x49'),_0x1ae5cb['dtlscertfile']||_0x070e('0x4a'));this['setDataValue'](_0x070e('0x46'),_0x1ae5cb[_0x070e('0x46')]||_0x070e('0x4b'));this['setDataValue'](_0x070e('0x47'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x070e('0x39')],'set':function(_0x5ce157){this[_0x070e('0x5')](_0x070e('0x4c'),_0x5ce157?_0x5ce157['join'](','):[]);},'get':function(){return this[_0x070e('0xb')]('permissions')?_[_0x070e('0x4d')](this[_0x070e('0xb')]('permissions')['split'](','),function(_0x29ee66){return parseInt(_0x29ee66,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x070e('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x070e('0x4e')],'get':function(){return this[_0x070e('0xb')](_0x070e('0x4f'))?this[_0x070e('0xb')](_0x070e('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0x070e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x4f720f){if(typeof _0x4f720f==='string'){var _0x1624cd=_0x4f720f==='1'?!![]:_0x4f720f==='0'?![]:_0x4f720f===_0x070e('0x50')?!![]:_0x4f720f===_0x070e('0x51')?![]:![];this[_0x070e('0x5')]('screenrecording',_0x1624cd);}else{this[_0x070e('0x5')](_0x070e('0x52'),_0x4f720f);}}},'blocked':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![],'set':function(_0xd74f9c){this[_0x070e('0x5')](_0x070e('0x53'),_0xd74f9c);if(_0xd74f9c===!![]){this['setDataValue'](_0x070e('0x54'),moment());this['setDataValue'](_0x070e('0x55'),0x0);}else{this[_0x070e('0x5')](_0x070e('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0x070e('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x070e('0x14')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index d6bdd6d..08b6eba 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 _0xcdaa=['MailOpenTabs','MAIL','SMS','WhatsappOpenTabs','WHATSAPP','getContacts','CmContact','order','sort','hasOwnProperty','Tag','Tags','tag','nolimit','getQueues','Queue','Unknown\x20role','getVoiceQueuesRt','pick','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','OpenchannelInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','FaxInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','login','mobile','format','LOCAL/%s@from-sip/n','intrf','SIP/%s','user:%s','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','MemberReport','getChannels','YYYY-MM-DD\x20HH:mm:ss','forEach','LOGIN','PAUSE','bulkCreate','concat','resolve','logout','pause','QueuePause','updateAttributes','DEFAULT\x20PAUSE','unpause','chatPause','faxPause','smsPause','pauseType','User\x20with\x20id\x20%s\x20not\x20found','getTeams','Team','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','flattenDeep','addAgent','getDataValue','UserVoicePrefix','VoicePrefixId','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','getAssociatedQueues','removeAgent','Voice','TeamVoicePrefix','getLists','CmList','values','addChatInteractions','omit','user_has_chat_interactions:save','removeChatInteractions','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','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','$and','$gt','$gte','$lt','$lte','$ne','$eq','$between','$notBetween','$notIn','$like','$notLike','$notILike','$contained','$any','CmHopper','firstName','lastName','Contact','dialActive','VoiceQueue','getApiKey','retrieveApiKey','token','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','removeApiKey','API\x20key\x20not\x20available','whoami','send','getUserSetting','getPresence','queues','inbound','flatten','getAgents','lower','col','toString','asc','desc','substring','uniqBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','client','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','unknown','unavailable','ringing','voiceStatus','busy','slice','charAt','toUpperCase','QueryTypes','SELECT','select','field','InteractionId','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','moment','lodash','squel','jayson/promise','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../errors/api','APIBadRequestError','APINotFoundError','socket.io-emitter','register','redis','localhost','then','info','request\x20sent','User,\x20%s,\x20%s,\x20%s','stringify','code','error','message','User,\x20%s,\x20%s','catch','status','end','json','limit','undefined','offset','count','set','Content-Range','update','role','agent','emit','userNotification:recalc:','destroy','get','admin','Users','Agents','telephone','filter','map','value','includes','find','name','sendStatus','stack','User','rawAttributes','fieldName','type','key','password','salt','where','query','includeAll','include','userSetting','true','UserSetting','attributes','push','rows','length','chat','dataValues','mail','openchannel','whatsapp','show','params','model','differenceBy','keys','filters','intersection','fields','merge','options','openTabs','sms','fax','all','body','describe','addContacts','ids','internal','Setting','validatePasswordPattern','max','min_internal','isNil','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)','sequelize','from','voicemail','VoiceMail','fullname','permissions','101','102','103','113','104','106','107','108','109','100','111','114','115','create','user','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','checkUserLimits','settingsEnabled','userProfileId','UserProfileSection','Telephones','autoAssociation','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','isEmpty','compact','changePassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','oldPassword','Wrong\x20credentials','newPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','validatePasswordHistory','updatePasswordsHistory','channel','loginInPause','Unknown\x20channel','add','capitalize','Queues','spread','toLowerCase','QueueId','Queue:save','voice','findAll','online','interface','voicePause','penalty','upsert','removeQueues','isValidChannel','remove','isArray','Queue:remove','UserVoiceQueueRt','addAvatar','userpic','file','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','ChatOpenTabs','createdAt','OpenchannelOpenTabs','OPENCHANNEL'];(function(_0x2892b3,_0x56c382){var _0x356541=function(_0x1e9aa9){while(--_0x1e9aa9){_0x2892b3['push'](_0x2892b3['shift']());}};_0x356541(++_0x56c382);}(_0xcdaa,0xcc));var _0xacda=function(_0x158b0d,_0x3563b2){_0x158b0d=_0x158b0d-0x0;var _0x4b1758=_0xcdaa[_0x158b0d];return _0x4b1758;};'use strict';var moment=require(_0xacda('0x0'));var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0xacda('0x1'));var squel=require(_0xacda('0x2'));var jayson=require(_0xacda('0x3'));var Redis=require('ioredis');var authService=require(_0xacda('0x4'));var qs=require(_0xacda('0x5'));var logger=require(_0xacda('0x6'))('api');var utils=require(_0xacda('0x7'));var config=require(_0xacda('0x8'));var licenseUtil=require(_0xacda('0x9'));var APIBadRequestError=require(_0xacda('0xa'))[_0xacda('0xb')];var APINotFoundError=require('../../errors/api')[_0xacda('0xc')];var APIHandleError=require(_0xacda('0xa'))['handleError'];var db=require('../../mysqldb')['db'];var socket=require(_0xacda('0xd'))(new Redis(config['redis']));require('./user.socket')[_0xacda('0xe')](socket);config[_0xacda('0xf')]=_['defaults'](config['redis'],{'host':_0xacda('0x10'),'port':0x18eb});var amiClient=jayson['client']['http']({'port':0x232a});var values;function respondWithRpcPromise(_0x1ce782,_0x30446d,_0x1b77b5,_0x32cf53){return new Promise(function(_0x1ce604,_0x1626d4){var _0x559931=_0x32cf53||amiClient;return _0x559931['request'](_0x1ce782,_0x1b77b5)[_0xacda('0x11')](function(_0x4136b1){logger[_0xacda('0x12')]('User,\x20%s,\x20%s',_0x30446d,_0xacda('0x13'));logger['debug'](_0xacda('0x14'),_0x30446d,_0xacda('0x13'),JSON[_0xacda('0x15')](_0x4136b1));if(_0x4136b1['error']){if(_0x4136b1['error'][_0xacda('0x16')]===0x1f4){logger[_0xacda('0x17')]('User,\x20%s,\x20%s',_0x30446d,_0x4136b1[_0xacda('0x17')][_0xacda('0x18')]);return _0x1626d4(_0x4136b1['error'][_0xacda('0x18')]);}logger['error']('User,\x20%s,\x20%s',_0x30446d,_0x4136b1[_0xacda('0x17')]['message']);return _0x1ce604(_0x4136b1[_0xacda('0x17')][_0xacda('0x18')]);}else{logger[_0xacda('0x12')](_0xacda('0x19'),_0x30446d,_0xacda('0x13'));_0x1ce604(_0x4136b1['result'][_0xacda('0x18')]);}})[_0xacda('0x1a')](function(_0x451ff3){logger[_0xacda('0x17')](_0xacda('0x19'),_0x30446d,_0x451ff3);_0x1626d4(_0x451ff3);});});}function respondWithStatusCode(_0x1fb41d,_0xf19cb8){_0xf19cb8=_0xf19cb8||0xcc;return function(_0x3d7c73){if(_0x3d7c73){return _0x1fb41d['sendStatus'](_0xf19cb8);}return _0x1fb41d[_0xacda('0x1b')](_0xf19cb8)[_0xacda('0x1c')]();};}function respondWithResult(_0x3eb2ba,_0x1d10f5){_0x1d10f5=_0x1d10f5||0xc8;return function(_0x312af6){if(_0x312af6){return _0x3eb2ba[_0xacda('0x1b')](_0x1d10f5)[_0xacda('0x1d')](_0x312af6);}};}function respondWithFilteredResult(_0x266b99,_0x31620a){return function(_0x7cc664){if(_0x7cc664){var _0x5e0d4c=typeof _0x31620a['offset']==='undefined'&&typeof _0x31620a[_0xacda('0x1e')]===_0xacda('0x1f');var _0xe67132=_0x7cc664['count'];var _0x2cf117=_0x5e0d4c?0x0:_0x31620a[_0xacda('0x20')];var _0x50906a=_0x5e0d4c?_0x7cc664[_0xacda('0x21')]:_0x31620a[_0xacda('0x20')]+_0x31620a[_0xacda('0x1e')];var _0x58ab6b;if(_0x50906a>=_0xe67132){_0x50906a=_0xe67132;_0x58ab6b=0xc8;}else{_0x58ab6b=0xce;}_0x266b99[_0xacda('0x1b')](_0x58ab6b);return _0x266b99[_0xacda('0x22')](_0xacda('0x23'),_0x2cf117+'-'+_0x50906a+'/'+_0xe67132)[_0xacda('0x1d')](_0x7cc664);}return null;};}function saveUpdates(_0x1b772d){return function(_0x379b15){if(_0x379b15){return _0x379b15[_0xacda('0x24')](_0x1b772d)[_0xacda('0x11')](function(_0x1fdbd9){if(_0x1fdbd9[_0xacda('0x25')]===_0xacda('0x26')){socket[_0xacda('0x27')](_0xacda('0x28')+_0x1fdbd9['id'],_0x1fdbd9);}return _0x1fdbd9;});}return null;};}function removeEntity(_0x20e175){return function(_0x19857a){if(_0x19857a){return _0x19857a[_0xacda('0x29')]()[_0xacda('0x11')](function(){var _0x6eb4c2=_0x19857a[_0xacda('0x2a')]({'plain':!![]});if(_0x6eb4c2['role']===_0xacda('0x2b'))return;var _0x46e3a2=[{'name':_0xacda('0x2c'),'value':'user','ignore':!![]},{'name':_0xacda('0x2d'),'value':_0xacda('0x26'),'ignore':![]},{'name':'Telephones','value':_0xacda('0x2e'),'ignore':![]}];var _0x31273b=_(_0x46e3a2)[_0xacda('0x2f')]('ignore')[_0xacda('0x30')](_0xacda('0x31'))[_0xacda('0x31')]();if(_[_0xacda('0x32')](_0x31273b,_0x6eb4c2[_0xacda('0x25')])){return;}var _0x2e1595=_[_0xacda('0x33')](_0x46e3a2,[_0xacda('0x31'),_0x6eb4c2[_0xacda('0x25')]])[_0xacda('0x34')];return db['UserProfileResource'][_0xacda('0x29')]({'where':{'type':_0x2e1595,'resourceId':_0x6eb4c2['id']}})['then'](function(){return _0x19857a;});})[_0xacda('0x11')](function(){_0x20e175[_0xacda('0x1b')](0xcc)[_0xacda('0x1c')]();});}};}function handleEntityNotFound(_0x41779f){return function(_0x4e04bd){if(!_0x4e04bd){_0x41779f[_0xacda('0x35')](0x194);}return _0x4e04bd;};}function handleError(_0x33c8fe,_0x41dfcd){_0x41dfcd=_0x41dfcd||0x1f4;return function(_0x39d0dd){logger['error'](_0x39d0dd[_0xacda('0x36')]);if(_0x39d0dd['name']){delete _0x39d0dd['name'];}_0x33c8fe[_0xacda('0x1b')](_0x41dfcd)['send'](_0x39d0dd);};}exports['index']=function(_0x14f26b,_0x2a2f81){var _0x3c4cb2={},_0x44e4af={'count':0x0,'rows':[]};var _0x2585c1=_(db[_0xacda('0x37')][_0xacda('0x38')])[_0xacda('0x30')](function(_0x11c812){return{'name':_0x11c812[_0xacda('0x39')],'type':_0x11c812[_0xacda('0x3a')][_0xacda('0x3b')]};})[_0xacda('0x2f')](function(_0x3b5166){return!_[_0xacda('0x32')]([_0xacda('0x3c'),_0xacda('0x3d')],_0x3b5166[_0xacda('0x34')]);})[_0xacda('0x31')]();_0x3c4cb2=qs['getOptions'](_0x2585c1,_0x14f26b);var _0x2e51d0={'where':_0x3c4cb2[_0xacda('0x3e')]};return db[_0xacda('0x37')][_0xacda('0x21')](_0x2e51d0)[_0xacda('0x11')](function(_0x5d177f){_0x44e4af[_0xacda('0x21')]=_0x5d177f;if(_0x14f26b[_0xacda('0x3f')][_0xacda('0x40')]){_0x3c4cb2[_0xacda('0x41')]=[{'all':!![]}];}if(_0x14f26b['query'][_0xacda('0x42')]===_0xacda('0x43')){_0x3c4cb2[_0xacda('0x41')]=[{'model':db[_0xacda('0x44')],'as':_0xacda('0x42')}];}if(!_['includes'](_0x3c4cb2[_0xacda('0x45')],'id')){_0x3c4cb2[_0xacda('0x45')][_0xacda('0x46')]('id');}return db[_0xacda('0x37')]['findAll'](_0x3c4cb2);})[_0xacda('0x11')](function(_0x5a3438){_0x44e4af['rows']=_0x5a3438;if(_0x14f26b[_0xacda('0x3f')]['openTabs']==='true'){var _0x4062b9=[];for(var _0x3dc32f=0x0;_0x3dc32f<_0x44e4af[_0xacda('0x47')][_0xacda('0x48')];_0x3dc32f++){_0x4062b9[_0xacda('0x46')](get_open_tabs(_0xacda('0x49'),_0x44e4af['rows'][_0x3dc32f][_0xacda('0x4a')]));_0x4062b9[_0xacda('0x46')](get_open_tabs('sms',_0x44e4af['rows'][_0x3dc32f][_0xacda('0x4a')]));_0x4062b9['push'](get_open_tabs('fax',_0x44e4af['rows'][_0x3dc32f][_0xacda('0x4a')]));_0x4062b9[_0xacda('0x46')](get_open_tabs(_0xacda('0x4b'),_0x44e4af[_0xacda('0x47')][_0x3dc32f][_0xacda('0x4a')]));_0x4062b9[_0xacda('0x46')](get_open_tabs(_0xacda('0x4c'),_0x44e4af[_0xacda('0x47')][_0x3dc32f][_0xacda('0x4a')]));_0x4062b9[_0xacda('0x46')](get_open_tabs(_0xacda('0x4d'),_0x44e4af[_0xacda('0x47')][_0x3dc32f][_0xacda('0x4a')]));}return Promise['all'](_0x4062b9)['then'](function(){return _0x44e4af;});}else{return _0x44e4af;}})[_0xacda('0x11')](respondWithFilteredResult(_0x2a2f81,_0x3c4cb2))['catch'](handleError(_0x2a2f81,null));};exports[_0xacda('0x4e')]=function(_0x5b3b76,_0x410d00){var _0x16ea53={'raw':![],'where':{'id':_0x5b3b76[_0xacda('0x4f')]['id']}},_0x19240b={};_0x19240b[_0xacda('0x50')]=_[_0xacda('0x51')](_['keys'](db[_0xacda('0x37')][_0xacda('0x38')]),[_0xacda('0x3c'),_0xacda('0x3d')]);_0x19240b[_0xacda('0x3f')]=_[_0xacda('0x52')](_0x5b3b76['query']);_0x19240b[_0xacda('0x53')]=_[_0xacda('0x54')](_0x19240b[_0xacda('0x50')],_0x19240b['query']);_0x16ea53[_0xacda('0x45')]=_['intersection'](_0x19240b[_0xacda('0x50')],qs[_0xacda('0x55')](_0x5b3b76[_0xacda('0x3f')][_0xacda('0x55')]));_0x16ea53[_0xacda('0x45')]=_0x16ea53['attributes'][_0xacda('0x48')]?_0x16ea53[_0xacda('0x45')]:_0x19240b[_0xacda('0x50')];if(_0x5b3b76[_0xacda('0x3f')]['includeAll']){_0x16ea53['include']=[{'all':!![]}];}if(_0x5b3b76[_0xacda('0x3f')][_0xacda('0x42')]==='true'){_0x16ea53['include']=[{'model':db[_0xacda('0x44')],'as':'userSetting'}];}_0x16ea53=_[_0xacda('0x56')]({},_0x16ea53,_0x5b3b76[_0xacda('0x57')]);if(!_[_0xacda('0x32')](_0x16ea53[_0xacda('0x45')],'id')){_0x16ea53[_0xacda('0x45')][_0xacda('0x46')]('id');}return db[_0xacda('0x37')][_0xacda('0x33')](_0x16ea53)[_0xacda('0x11')](handleEntityNotFound(_0x410d00,null))['then'](function(_0x3c28a9){var _0x4e1cb7=[];values=_0x3c28a9;if(_0x5b3b76['query'][_0xacda('0x58')]===_0xacda('0x43')){_0x4e1cb7['push'](get_open_tabs(_0xacda('0x49'),_0x3c28a9[_0xacda('0x4a')]));_0x4e1cb7[_0xacda('0x46')](get_open_tabs(_0xacda('0x59'),_0x3c28a9[_0xacda('0x4a')]));_0x4e1cb7[_0xacda('0x46')](get_open_tabs(_0xacda('0x4c'),_0x3c28a9[_0xacda('0x4a')]));_0x4e1cb7[_0xacda('0x46')](get_open_tabs('whatsapp',_0x3c28a9[_0xacda('0x4a')]));_0x4e1cb7[_0xacda('0x46')](get_open_tabs(_0xacda('0x5a'),_0x3c28a9[_0xacda('0x4a')]));_0x4e1cb7[_0xacda('0x46')](get_open_tabs(_0xacda('0x4b'),_0x3c28a9[_0xacda('0x4a')]));return Promise[_0xacda('0x5b')](_0x4e1cb7);}else{return values;}})[_0xacda('0x11')](function(){return values;})[_0xacda('0x11')](respondWithResult(_0x410d00,null))[_0xacda('0x1a')](handleError(_0x410d00,null));};exports[_0xacda('0x24')]=function(_0x31bcc7,_0x550423){if(_0x31bcc7['body']['id']){delete _0x31bcc7[_0xacda('0x5c')]['id'];}delete _0x31bcc7[_0xacda('0x5c')][_0xacda('0x25')];return db[_0xacda('0x37')][_0xacda('0x33')]({'where':{'id':_0x31bcc7[_0xacda('0x4f')]['id']}})[_0xacda('0x11')](handleEntityNotFound(_0x550423,null))[_0xacda('0x11')](saveUpdates(_0x31bcc7['body'],null))[_0xacda('0x11')](respondWithResult(_0x550423,null))[_0xacda('0x1a')](handleError(_0x550423,null));};exports[_0xacda('0x5d')]=function(_0x347621,_0x229240){return db[_0xacda('0x37')][_0xacda('0x5d')]()[_0xacda('0x11')](respondWithResult(_0x229240,null))[_0xacda('0x1a')](handleError(_0x229240,null));};exports[_0xacda('0x5e')]=function(_0x58a2cc,_0x1ac357){return db[_0xacda('0x37')][_0xacda('0x33')]({'where':{'id':_0x58a2cc['params']['id']}})[_0xacda('0x11')](handleEntityNotFound(_0x1ac357,null))[_0xacda('0x11')](function(_0x249a1b){if(_0x249a1b){return _0x249a1b[_0xacda('0x5e')](_0x58a2cc[_0xacda('0x5c')][_0xacda('0x5f')],_['omit'](_0x58a2cc[_0xacda('0x5c')],[_0xacda('0x5f'),'id'])||{});}})[_0xacda('0x11')](respondWithResult(_0x1ac357,null))[_0xacda('0x1a')](handleError(_0x1ac357,null));};function validateUser(_0x44635d){return new Promise(function(_0x121073,_0x139fcf){if(_0x44635d[_0xacda('0x60')])return _0x121073(_0x44635d);return db[_0xacda('0x61')]['findById'](0x1)['then'](function(_0x4e6e44){if(_0x4e6e44['securePassword'])authService[_0xacda('0x62')](_0x44635d[_0xacda('0x3c')]);db[_0xacda('0x37')][_0xacda('0x63')](_0xacda('0x60'))['then'](function(_0x53f173){if(_['isNil'](_0x53f173)){_0x44635d['internal']=_0x4e6e44[_0xacda('0x64')]||0x1;return;}if(_[_0xacda('0x65')](_0x4e6e44['min_internal'])||_0x4e6e44[_0xacda('0x64')]===_0x53f173){_0x44635d[_0xacda('0x60')]=_0x53f173+0x1;return;}if(_0x4e6e44[_0xacda('0x64')]>_0x53f173){_0x44635d[_0xacda('0x60')]=_0x4e6e44['min_internal'];return;}return db['sequelize'][_0xacda('0x3f')](_0xacda('0x66'),{'type':db[_0xacda('0x67')]['QueryTypes']['SELECT']})[_0xacda('0x11')](function(_0x5c9867){if(_0x5c9867&&_0x5c9867[_0xacda('0x48')]){for(var _0x438b6e=0x0,_0xcfd304=_0x5c9867['length'];_0x438b6e<_0xcfd304&&_[_0xacda('0x65')](_0x44635d[_0xacda('0x60')]);_0x438b6e++){if(_0x4e6e44[_0xacda('0x64')]<=_0x5c9867[_0x438b6e][_0xacda('0x68')]){_0x44635d['internal']=_0x5c9867[_0x438b6e]['from'];}else if(_0x4e6e44[_0xacda('0x64')]>_0x5c9867[_0x438b6e][_0xacda('0x68')]&&_0x4e6e44[_0xacda('0x64')]<=_0x5c9867[_0x438b6e]['to']){_0x44635d[_0xacda('0x60')]=_0x4e6e44[_0xacda('0x64')];}}}if(_[_0xacda('0x65')](_0x44635d['internal'])){_0x44635d[_0xacda('0x60')]=_0x53f173+0x1;}return _0x121073(_0x44635d);});});})[_0xacda('0x1a')](function(_0x564920){_0x139fcf(_0x564920);});});}function updateUser(_0x6bde09){return new Promise(function(_0xcb2349,_0x56adde){try{if(_0x6bde09[_0xacda('0x69')]){_0x6bde09['mailbox']=_0x6bde09[_0xacda('0x60')];_0x6bde09[_0xacda('0x6a')]={'mailbox':_0x6bde09[_0xacda('0x60')],'password':_0x6bde09[_0xacda('0x3c')],'fullname':_0x6bde09[_0xacda('0x6b')],'email':_0x6bde09['email']};}if(_0x6bde09[_0xacda('0x25')]===_0xacda('0x26')){if(!_0x6bde09['permissions'])_0x6bde09[_0xacda('0x6c')]=[_0xacda('0x6d'),_0xacda('0x6e'),_0xacda('0x6f'),_0xacda('0x70'),'110',_0xacda('0x71'),'105',_0xacda('0x72'),_0xacda('0x73'),_0xacda('0x74'),_0xacda('0x75'),_0xacda('0x76'),_0xacda('0x77'),_0xacda('0x78'),_0xacda('0x79')];}_0xcb2349(_0x6bde09);}catch(_0x4c0941){_0x56adde(_0x4c0941);}});}exports[_0xacda('0x7a')]=function(_0x4ea9d3,_0x3f5798){if(_0x4ea9d3[_0xacda('0x7b')][_0xacda('0x25')]===_0xacda('0x26'))throw new Error(_0xacda('0x7c'));if(_0x4ea9d3[_0xacda('0x5c')][_0xacda('0x25')]==='user'&&_0x4ea9d3[_0xacda('0x7b')]['role']!=='admin'){throw new Error(_0xacda('0x7d'));}if(_0x4ea9d3[_0xacda('0x5c')][_0xacda('0x25')]===_0xacda('0x2b')&&_0x4ea9d3[_0xacda('0x7b')][_0xacda('0x25')]!==_0xacda('0x2b')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0xacda('0x7e')]([_0x4ea9d3['body']])['then'](function(){return validateUser(_0x4ea9d3[_0xacda('0x5c')]);})[_0xacda('0x11')](function(_0x167b77){return updateUser(_0x167b77)[_0xacda('0x11')](function(_0x5d80bc){if(_0x5d80bc[_0xacda('0x25')]===_0xacda('0x2b')){_0x5d80bc[_0xacda('0x7f')]=_0x4ea9d3['user'][_0xacda('0x7f')];delete _0x5d80bc[_0xacda('0x80')];}return _0x5d80bc;});})[_0xacda('0x11')](function(_0x4ae874){return db[_0xacda('0x37')][_0xacda('0x7a')](_0x4ae874,{'include':[{'model':db[_0xacda('0x6a')],'as':'VoiceMail'}]});})[_0xacda('0x11')](function(_0x278518){if(_0x4ea9d3[_0xacda('0x5c')]['role']===_0xacda('0x7b'))return _0x278518;if(_0x4ea9d3[_0xacda('0x7b')]['role']!=='user')return _0x278518;return db[_0xacda('0x81')][_0xacda('0x33')]({'where':{'name':_0x278518[_0xacda('0x25')]===_0xacda('0x26')?_0xacda('0x2d'):_0xacda('0x82'),'userProfileId':_0x4ea9d3['user'][_0xacda('0x80')]},'raw':!![]})['then'](function(_0x5ac43b){if(!_0x5ac43b||_0x5ac43b[_0xacda('0x83')]!=0x0)return _0x278518;return db['UserProfileResource'][_0xacda('0x7a')]({'name':_0x278518[_0xacda('0x34')],'resourceId':_0x278518['id'],'type':_0x5ac43b['name'],'sectionId':_0x5ac43b['id']},{})['then'](function(){return _0x278518;});})[_0xacda('0x1a')](function(_0xd87a95){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xd87a95);throw _0xd87a95;});})[_0xacda('0x11')](respondWithResult(_0x3f5798,0xc9))[_0xacda('0x1a')](handleError(_0x3f5798,null));};exports['bulkCreate']=function(_0x224107,_0x5e2375){var _0x138c30=_0x224107['body'];var _0x82a241=[];if(_0x224107[_0xacda('0x7b')]['role']==='agent')throw new Error(_0xacda('0x7c'));if(_[_0xacda('0x84')](_0x138c30,[_0xacda('0x25'),_0xacda('0x7b')])&&_0x224107[_0xacda('0x7b')][_0xacda('0x25')]!==_0xacda('0x2b')){throw new Error(_0xacda('0x7d'));}if(_[_0xacda('0x84')](_0x138c30,[_0xacda('0x25'),'admin'])&&_0x224107[_0xacda('0x7b')]['role']!==_0xacda('0x2b')){throw new Error(_0xacda('0x85'));}return licenseUtil[_0xacda('0x7e')](_0x138c30)[_0xacda('0x11')](function(){return validateUser(_0x138c30[0x0]);})['then'](function(){for(var _0x3a71be=0x1;_0x3a71be<_0x138c30['length'];_0x3a71be++){var _0x34e209=_0x138c30[_0x3a71be-0x1][_0xacda('0x60')];if(!_0x138c30[_0x3a71be][_0xacda('0x60')])_0x138c30[_0x3a71be][_0xacda('0x60')]=_0x34e209+0x1;_0x82a241['push'](validateUser(_0x138c30[_0x3a71be]));}return Promise[_0xacda('0x5b')](_0x82a241);})[_0xacda('0x11')](function(){_0x82a241=[];for(var _0x5d566d=0x0;_0x5d566d<_0x138c30[_0xacda('0x48')];_0x5d566d++){_0x82a241[_0xacda('0x46')](updateUser(_0x138c30[_0x5d566d]));}return Promise[_0xacda('0x5b')](_0x82a241);})[_0xacda('0x11')](function(){_0x82a241=_0x138c30[_0xacda('0x30')](function(_0x5977a2){return db[_0xacda('0x37')]['create'](_0x5977a2,{'include':[{'model':db[_0xacda('0x6a')],'as':_0xacda('0x6a')}]})[_0xacda('0x11')](function(_0x515787){_0x5977a2['id']=_0x515787['id'];return _0x5977a2;});});return Promise[_0xacda('0x5b')](_0x82a241);})[_0xacda('0x11')](function(_0x2caba2){if(_0x224107['body'][_0xacda('0x25')]===_0xacda('0x7b'))return _0x2caba2;if(_0x224107[_0xacda('0x7b')][_0xacda('0x25')]!==_0xacda('0x7b'))return _0x2caba2;var _0x35aab1=_[_0xacda('0x84')](_0x2caba2,function(_0x1469bc){return _0x1469bc['role']==='agent'||_0x1469bc[_0xacda('0x25')]===_0xacda('0x2e');});if(!_0x35aab1)return _0x2caba2;return db[_0xacda('0x81')]['findAll']({'where':{'name':{'$or':[_0xacda('0x2d'),_0xacda('0x82')]},'userProfileId':_0x224107['user'][_0xacda('0x80')]},'raw':!![]})[_0xacda('0x11')](function(_0x1aa72b){if(_[_0xacda('0x86')](_0x1aa72b)||!_[_0xacda('0x84')](_0x1aa72b,['autoAssociation',0x0]))return _0x2caba2;_0x82a241=[];var _0x15c51c=_(_0x1aa72b)[_0xacda('0x30')](function(_0xcced50){if(_0xcced50[_0xacda('0x83')]===0x1)return;return _0xcced50[_0xacda('0x34')]===_0xacda('0x2d')?_0xacda('0x26'):_0xacda('0x2e');})[_0xacda('0x87')]()[_0xacda('0x31')]();for(var _0x261a1e=0x0;_0x261a1e<_0x2caba2[_0xacda('0x48')];_0x261a1e++){if(!_['includes'](_0x15c51c,_0x2caba2[_0x261a1e]['role']))return;var _0x26df7d=_0x2caba2[_0x261a1e][_0xacda('0x25')]===_0xacda('0x26')?'Agents':_0xacda('0x82');_0x82a241[_0xacda('0x46')](db['UserProfileResource']['create']({'name':_0x2caba2[_0x261a1e][_0xacda('0x34')],'resourceId':_0x2caba2[_0x261a1e]['id'],'type':_0x26df7d,'sectionId':_['find'](_0x1aa72b,[_0xacda('0x34'),_0x26df7d])['id']},{}));}return Promise[_0xacda('0x5b')](_0x82a241);});})[_0xacda('0x11')](respondWithResult(_0x5e2375,0xc9))[_0xacda('0x1a')](handleError(_0x5e2375,null));};exports[_0xacda('0x88')]=function(_0x56ba48,_0x550089){if(_0x56ba48['body']['id']){delete _0x56ba48['body']['id'];}return db['User'][_0xacda('0x33')]({'where':{'id':_0x56ba48['params']['id']}})[_0xacda('0x11')](function(_0x23fd00){if(!_0x23fd00)return null;if(_0x23fd00['id']===_0x56ba48[_0xacda('0x7b')]['id']){if(!_0x56ba48[_0xacda('0x5c')]['oldPassword']||!_0x56ba48[_0xacda('0x5c')]['newPassword']){throw new db[(_0xacda('0x89'))][(_0xacda('0x8a'))](_0xacda('0x8b'));}if(!_0x23fd00[_0xacda('0x8c')](_0x56ba48[_0xacda('0x5c')][_0xacda('0x8d')])){throw new db[(_0xacda('0x89'))][(_0xacda('0x8a'))](_0xacda('0x8e'));}if(_0x56ba48[_0xacda('0x5c')]['oldPassword']===_0x56ba48[_0xacda('0x5c')][_0xacda('0x8f')]){throw new db[(_0xacda('0x89'))]['ValidationError'](_0xacda('0x90'));}}else if(_0x56ba48['user'][_0xacda('0x25')]===_0xacda('0x2b')){if(!_0x56ba48[_0xacda('0x5c')][_0xacda('0x8f')]){throw new db[(_0xacda('0x89'))][(_0xacda('0x8a'))](_0xacda('0x91'));}}else if(_0x56ba48[_0xacda('0x7b')][_0xacda('0x25')]==='user'){if(!_0x56ba48[_0xacda('0x5c')]['newPassword']){throw new db[(_0xacda('0x89'))][(_0xacda('0x8a'))](_0xacda('0x91'));}if(_0x23fd00[_0xacda('0x25')]!=='agent'){throw new db['Sequelize']['ValidationError'](_0xacda('0x7c'));}}else{throw new db[(_0xacda('0x89'))][(_0xacda('0x8a'))](_0xacda('0x7c'));}return _0x23fd00;})[_0xacda('0x11')](handleEntityNotFound(_0x550089,null))[_0xacda('0x11')](function(_0x2ef6b2){return db['Setting'][_0xacda('0x92')]({'attributes':['id','securePassword','enforcePasswordHistory','passwordHistoryLimit']})['then'](function(_0x1fa0c8){if(_0x1fa0c8['securePassword'])authService[_0xacda('0x62')](_0x56ba48[_0xacda('0x5c')]['newPassword']);if(!_0x1fa0c8[_0xacda('0x93')]||!_0x2ef6b2['previousPasswords'])return _0x2ef6b2;authService[_0xacda('0x94')](_0x56ba48['body'][_0xacda('0x8f')],_0x2ef6b2['previousPasswords'],_0x1fa0c8['passwordHistoryLimit']);return _0x2ef6b2;})[_0xacda('0x11')](saveUpdates({'password':_0x56ba48['body']['newPassword'],'passwordResetAt':_0x56ba48['user']['id']==_0x56ba48[_0xacda('0x4f')]['id']?moment():null,'previousPasswords':authService[_0xacda('0x95')](_0x56ba48[_0xacda('0x5c')]['newPassword'],_0x2ef6b2['previousPasswords'])},null));})[_0xacda('0x11')](respondWithResult(_0x550089,null))['catch'](handleError(_0x550089,null));};exports['addQueues']=function(_0x337e8f,_0x493d68){var _0x272220=_0x337e8f['body'][_0xacda('0x96')];return db[_0xacda('0x37')]['find']({'where':{'id':_0x337e8f['params']['id']},'attributes':['id',_0xacda('0x34'),'role','online',_0xacda('0x97'),'voicePause','interface']})[_0xacda('0x11')](handleEntityNotFound(_0x493d68,null))[_0xacda('0x11')](function(_0x5162a1){if(_0x5162a1){if(!utils['isValidChannel'](_0x272220)){throw new db[(_0xacda('0x89'))][(_0xacda('0x8a'))](_0xacda('0x98'));}return _0x5162a1[_0xacda('0x99')+_[_0xacda('0x9a')](_0x272220['toLowerCase']())+_0xacda('0x9b')](_0x337e8f['body'][_0xacda('0x5f')],{'penalty':_0x337e8f[_0xacda('0x5c')]['penalty']||0x0})[_0xacda('0x9c')](function(_0x3dc725){for(var _0x16705c=0x0;_0x16705c<_0x337e8f[_0xacda('0x5c')][_0xacda('0x5f')][_0xacda('0x48')];_0x16705c+=0x1){var _0x3bc517={'UserId':Number(_0x337e8f['params']['id'])};_0x3bc517[_['capitalize'](_0x272220[_0xacda('0x9d')]())+_0xacda('0x9e')]=Number(_0x337e8f[_0xacda('0x5c')]['ids'][_0x16705c]);socket[_0xacda('0x27')](_0xacda('0x7b')+_[_0xacda('0x9a')](_0x272220[_0xacda('0x9d')]())+_0xacda('0x9f'),_0x3bc517);}return _0x3dc725;})[_0xacda('0x11')](function(){if(_0x272220===_0xacda('0xa0')){return db['VoiceQueue'][_0xacda('0xa1')]({'where':{'id':_0x337e8f[_0xacda('0x5c')][_0xacda('0x5f')]||[]},'raw':!![],'attributes':['id',_0xacda('0x34')]});}})['then'](function(_0x1e8d6e){var _0x4ece90=_0x5162a1['get']({'plain':!![]});var _0x2e264e=[];if(_0x272220==='voice'&&_0x4ece90[_0xacda('0x25')]===_0xacda('0x26')&&_0x4ece90[_0xacda('0xa2')]){for(let _0x2c3b71=0x0;_0x2c3b71<_0x1e8d6e[_0xacda('0x48')];_0x2c3b71+=0x1){_0x2e264e[_0xacda('0x46')]({'membername':_0x4ece90[_0xacda('0x34')],'UserId':_0x4ece90['id'],'queue_name':_0x1e8d6e[_0x2c3b71]['name'],'VoiceQueueId':_0x1e8d6e[_0x2c3b71]['id'],'interface':_[_0xacda('0x65')](_0x4ece90[_0xacda('0xa3')])?util['format']('SIP/%s',_0x4ece90[_0xacda('0x34')]):_0x4ece90[_0xacda('0xa3')],'paused':_0x4ece90[_0xacda('0xa4')]||![],'penalty':_0x337e8f[_0xacda('0x5c')][_0xacda('0xa5')]||0x0});}return Promise[_0xacda('0x5b')](_0x2e264e[_0xacda('0x30')](function(_0x413193){return db['UserVoiceQueueRt'][_0xacda('0xa6')](_0x413193);}));}return _0x5162a1;});}})['then'](respondWithStatusCode(_0x493d68,null))[_0xacda('0x1a')](handleError(_0x493d68,null));};exports[_0xacda('0xa7')]=function(_0x30f74c,_0x3b4e48){var _0x10030a,_0x17ff8a;return db[_0xacda('0x37')][_0xacda('0x33')]({'where':{'id':_0x30f74c['params']['id']},'attributes':['id',_0xacda('0x34'),_0xacda('0x25')]})[_0xacda('0x11')](handleEntityNotFound(_0x3b4e48,null))[_0xacda('0x11')](function(_0x2f6d89){if(_0x2f6d89){_0x10030a=_0x2f6d89;if(!_0x30f74c['query'][_0xacda('0x96')]||!utils[_0xacda('0xa8')](_0x30f74c[_0xacda('0x3f')][_0xacda('0x96')])){throw new db['Sequelize'][(_0xacda('0x8a'))]('Unknown\x20channel');}return _0x2f6d89[_0xacda('0xa9')+_[_0xacda('0x9a')](_0x30f74c[_0xacda('0x3f')][_0xacda('0x96')]['toLowerCase']())+'Queues'](_0x30f74c[_0xacda('0x3f')][_0xacda('0x5f')]);}})[_0xacda('0x11')](function(_0x5d3581){if(_[_0xacda('0xaa')](_0x30f74c['query']['ids'])){for(var _0x50a912=0x0;_0x50a912<_0x30f74c[_0xacda('0x3f')][_0xacda('0x5f')][_0xacda('0x48')];_0x50a912+=0x1){_0x17ff8a={'UserId':Number(_0x30f74c[_0xacda('0x4f')]['id'])};_0x17ff8a[_[_0xacda('0x9a')](_0x30f74c[_0xacda('0x3f')][_0xacda('0x96')][_0xacda('0x9d')]())+_0xacda('0x9e')]=Number(_0x30f74c[_0xacda('0x3f')]['ids'][_0x50a912]);socket[_0xacda('0x27')](_0xacda('0x7b')+_[_0xacda('0x9a')](_0x30f74c['query'][_0xacda('0x96')]['toLowerCase']())+_0xacda('0xab'),_0x17ff8a);}}else{_0x17ff8a={'UserId':Number(_0x30f74c[_0xacda('0x4f')]['id'])};_0x17ff8a[_['capitalize'](_0x30f74c[_0xacda('0x3f')][_0xacda('0x96')]['toLowerCase']())+_0xacda('0x9e')]=Number(_0x30f74c[_0xacda('0x3f')][_0xacda('0x5f')]);socket[_0xacda('0x27')](_0xacda('0x7b')+_[_0xacda('0x9a')](_0x30f74c['query'][_0xacda('0x96')]['toLowerCase']())+'Queue:remove',_0x17ff8a);}return _0x5d3581;})[_0xacda('0x11')](function(){if(_0x30f74c[_0xacda('0x3f')][_0xacda('0x96')]===_0xacda('0xa0')){return db[_0xacda('0xac')]['destroy']({'where':{'UserId':_0x30f74c['params']['id'],'VoiceQueueId':_0x30f74c[_0xacda('0x3f')][_0xacda('0x5f')]},'individualHooks':!![]})['then'](function(){return _0x10030a;});}return _0x10030a;})[_0xacda('0x11')](respondWithStatusCode(_0x3b4e48,null))[_0xacda('0x1a')](handleError(_0x3b4e48,null));};exports[_0xacda('0xad')]=function(_0x1deb1f,_0x150b5d){_0x1deb1f['body'][_0xacda('0xae')]=_0x1deb1f[_0xacda('0xaf')][_0xacda('0xb0')];return db[_0xacda('0x37')]['find']({'where':{'id':_0x1deb1f['params']['id']}})['then'](handleEntityNotFound(_0x150b5d,null))['then'](saveUpdates(_0x1deb1f[_0xacda('0x5c')],null))['then'](respondWithResult(_0x150b5d,null))['catch'](handleError(_0x150b5d,null));};exports[_0xacda('0xb1')]=function(_0x578e85,_0x17ff75){var _0x40c3ae=path[_0xacda('0xb2')](config[_0xacda('0xb3')],_0xacda('0xb4'));return db['User'][_0xacda('0x33')]({'where':{'id':_0x578e85['params']['id']},'attributes':['id',_0xacda('0xae')],'raw':!![]})['then'](handleEntityNotFound(_0x17ff75,null))['then'](function(_0x57b3eb){if(_0x57b3eb){if(_[_0xacda('0x65')](_0x57b3eb[_0xacda('0xae')])){return _0x17ff75[_0xacda('0xb5')](_0x40c3ae);}else{if(!fs[_0xacda('0xb6')](path[_0xacda('0xb2')](config[_0xacda('0xb3')],_0xacda('0xb7'),_0x57b3eb[_0xacda('0xae')]))){return _0x17ff75['download'](_0x40c3ae);}return _0x17ff75[_0xacda('0xb5')](path[_0xacda('0xb2')](config[_0xacda('0xb3')],_0xacda('0xb7'),_0x57b3eb['userpic']));}}})['catch'](handleError(_0x17ff75,null));};exports['getOpenTabs']=function(_0x5e27f7,_0x57ec6e){return db[_0xacda('0x37')]['find']({'where':{'id':_0x5e27f7[_0xacda('0x4f')]['id']},'attributes':['id']})[_0xacda('0x11')](handleEntityNotFound(_0x57ec6e,null))[_0xacda('0x11')](function(_0x596e3f){var _0x2eea16=[];values=_0x596e3f['dataValues'];_0x2eea16[_0xacda('0x46')](get_open_tabs(_0xacda('0x49'),_0x596e3f['dataValues']));_0x2eea16[_0xacda('0x46')](get_open_tabs(_0xacda('0x59'),_0x596e3f[_0xacda('0x4a')]));_0x2eea16[_0xacda('0x46')](get_open_tabs(_0xacda('0x4c'),_0x596e3f['dataValues']));_0x2eea16[_0xacda('0x46')](get_open_tabs(_0xacda('0x4d'),_0x596e3f[_0xacda('0x4a')]));_0x2eea16[_0xacda('0x46')](get_open_tabs('fax',_0x596e3f['dataValues']));_0x2eea16[_0xacda('0x46')](get_open_tabs(_0xacda('0x4b'),_0x596e3f[_0xacda('0x4a')]));return Promise['all'](_0x2eea16);})[_0xacda('0x11')](function(_0x55746b){if(_0x55746b){var _0x2d5920=_['map'](values[_0xacda('0xb8')],function(_0x2281fb){return{'channel':'CHAT','id':_0x2281fb['id'],'createdAt':_0x2281fb['createdAt']};});var _0x1deacb=_['map'](values['FaxOpenTabs'],function(_0x3b20c0){return{'channel':'FAX','id':_0x3b20c0['id'],'createdAt':_0x3b20c0[_0xacda('0xb9')]};});var _0x54e6a1=_['map'](values[_0xacda('0xba')],function(_0x3a0dd7){return{'channel':_0xacda('0xbb'),'id':_0x3a0dd7['id'],'createdAt':_0x3a0dd7[_0xacda('0xb9')]};});var _0x57eeff=_[_0xacda('0x30')](values[_0xacda('0xbc')],function(_0x3ac0db){return{'channel':_0xacda('0xbd'),'id':_0x3ac0db['id'],'createdAt':_0x3ac0db[_0xacda('0xb9')]};});var _0x291938=_[_0xacda('0x30')](values['SmsOpenTabs'],function(_0x293ad3){return{'channel':_0xacda('0xbe'),'id':_0x293ad3['id'],'createdAt':_0x293ad3['createdAt']};});var _0x41a756=_[_0xacda('0x30')](values[_0xacda('0xbf')],function(_0x4f23d7){return{'channel':_0xacda('0xc0'),'id':_0x4f23d7['id'],'createdAt':_0x4f23d7[_0xacda('0xb9')]};});var _0x3b1b89=_['concat'](_0x2d5920,_0x1deacb,_0x54e6a1,_0x57eeff,_0x291938,_0x41a756);var _0x58c82f={'count':_0x3b1b89[_0xacda('0x48')],'rows':_0x3b1b89};return _0x58c82f;}else return null;})[_0xacda('0x11')](respondWithResult(_0x57ec6e,null))[_0xacda('0x1a')](handleError(_0x57ec6e,null));};exports[_0xacda('0xc1')]=function(_0x54608c,_0x4e1948){var _0x455759={};var _0x4f546c={};var _0x2fd6a2;var _0x4e1b90;return db[_0xacda('0x37')][_0xacda('0x92')]({'where':{'id':_0x54608c[_0xacda('0x4f')]['id']}})[_0xacda('0x11')](handleEntityNotFound(_0x4e1948,null))['then'](function(_0x1304af){if(_0x1304af){_0x2fd6a2=_0x1304af;_0x4f546c[_0xacda('0x50')]=_[_0xacda('0x52')](db[_0xacda('0xc2')][_0xacda('0x38')]);_0x4f546c[_0xacda('0x3f')]=_[_0xacda('0x52')](_0x54608c[_0xacda('0x3f')]);_0x4f546c[_0xacda('0x53')]=_[_0xacda('0x54')](_0x4f546c[_0xacda('0x50')],_0x4f546c[_0xacda('0x3f')]);_0x455759[_0xacda('0x45')]=_[_0xacda('0x54')](_0x4f546c[_0xacda('0x50')],qs[_0xacda('0x55')](_0x54608c['query'][_0xacda('0x55')]));_0x455759[_0xacda('0x45')]=_0x455759[_0xacda('0x45')][_0xacda('0x48')]?_0x455759['attributes']:_0x4f546c[_0xacda('0x50')];_0x455759[_0xacda('0xc3')]=qs[_0xacda('0xc4')](_0x54608c['query'][_0xacda('0xc4')]);_0x455759[_0xacda('0x3e')]=qs[_0xacda('0x53')](_['pick'](_0x54608c['query'],_0x4f546c['filters']));if(_0x54608c[_0xacda('0x3f')][_0xacda('0x2f')]){_0x455759[_0xacda('0x3e')]=_['merge'](_0x455759['where'],{'$or':_[_0xacda('0x30')](_0x455759['attributes'],function(_0x3937b1){var _0x42de3f={};_0x42de3f[_0x3937b1]={'$like':'%'+_0x54608c['query'][_0xacda('0x2f')]+'%'};return _0x42de3f;})});}_0x455759=_[_0xacda('0x56')]({},_0x455759,_0x54608c[_0xacda('0x57')]);return _0x2fd6a2['getContacts'](_0x455759);}})['then'](function(_0x208712){if(_0x208712){_0x4e1b90=_0x208712[_0xacda('0x48')];if(_0x54608c[_0xacda('0x3f')][_0xacda('0xc5')](_0xacda('0x40'))){_0x455759[_0xacda('0x41')]=[{'model':db['CmList'],'as':'List','required':![]},{'model':db[_0xacda('0xc6')],'as':_0xacda('0xc7'),'attributes':['id',_0xacda('0x34'),'color'],'where':_0x54608c['query']['tag']?{'id':_0x54608c[_0xacda('0x3f')][_0xacda('0xc8')]}:undefined,'required':_0x54608c[_0xacda('0x3f')][_0xacda('0xc8')]?!![]:![]}];}if(!_0x54608c[_0xacda('0x3f')][_0xacda('0xc5')](_0xacda('0xc9'))){_0x455759[_0xacda('0x1e')]=qs[_0xacda('0x1e')](_0x54608c['query'][_0xacda('0x1e')]);_0x455759[_0xacda('0x20')]=qs[_0xacda('0x20')](_0x54608c['query'][_0xacda('0x20')]);}return _0x2fd6a2[_0xacda('0xc1')](_0x455759);}})[_0xacda('0x11')](function(_0x4d42e8){if(_0x4d42e8){return _0x4d42e8?{'count':_0x4e1b90,'rows':_0x4d42e8}:null;}})['then'](respondWithResult(_0x4e1948,null))[_0xacda('0x1a')](handleError(_0x4e1948,null));};exports[_0xacda('0xca')]=function(_0x4b9fe4,_0x46e2fb){var _0x1bfd4f;var _0x445592={};var _0xde7f3c;return db[_0xacda('0x37')][_0xacda('0x92')]({'where':{'id':_0x4b9fe4[_0xacda('0x4f')]['id']},'attributes':['id','name',_0xacda('0x25')]})[_0xacda('0x11')](handleEntityNotFound(_0x46e2fb,null))[_0xacda('0x11')](function(_0x35d814){if(!utils[_0xacda('0xa8')](_0x4b9fe4[_0xacda('0x3f')][_0xacda('0x96')])){throw new db[(_0xacda('0x89'))][(_0xacda('0x8a'))](_0xacda('0x98'));}_0x1bfd4f=_0x35d814;var _0x19e9c8={};_0x19e9c8[_0xacda('0x50')]=_[_0xacda('0x52')](db[_['capitalize'](_0x4b9fe4['query'][_0xacda('0x96')])+_0xacda('0xcb')][_0xacda('0x38')]);_0x19e9c8[_0xacda('0x3f')]=_['keys'](_0x4b9fe4[_0xacda('0x3f')]);_0x19e9c8[_0xacda('0x53')]=_[_0xacda('0x54')](_0x19e9c8[_0xacda('0x50')],_0x19e9c8[_0xacda('0x3f')]);_0x445592['attributes']=_[_0xacda('0x54')](_0x19e9c8[_0xacda('0x50')],qs['fields'](_0x4b9fe4[_0xacda('0x3f')][_0xacda('0x55')]));_0x445592[_0xacda('0x45')]=_0x445592['attributes'][_0xacda('0x48')]?_0x445592['attributes']:_0x19e9c8[_0xacda('0x50')];_0x445592['order']=qs[_0xacda('0xc4')](_0x4b9fe4[_0xacda('0x3f')][_0xacda('0xc4')]);_0x445592[_0xacda('0x3e')]=qs[_0xacda('0x53')](_['pick'](_0x4b9fe4[_0xacda('0x3f')],_0x19e9c8[_0xacda('0x53')]));if(_0x4b9fe4['query'][_0xacda('0x2f')]){_0x445592[_0xacda('0x3e')]=_[_0xacda('0x56')](_0x445592['where'],{'$or':_[_0xacda('0x30')](_0x445592[_0xacda('0x45')],function(_0xe27af4){var _0x399027={};_0x399027[_0xe27af4]={'$like':'%'+_0x4b9fe4[_0xacda('0x3f')][_0xacda('0x2f')]+'%'};return _0x399027;})});}_0x445592=_['merge']({},_0x445592,_0x4b9fe4[_0xacda('0x57')]);switch(_0x1bfd4f[_0xacda('0x25')]){case _0xacda('0x2b'):return db[_[_0xacda('0x9a')](_0x4b9fe4['query']['channel'])+_0xacda('0xcb')][_0xacda('0xa1')](_0x445592);case _0xacda('0x7b'):case _0xacda('0x26'):return _0x1bfd4f[_0xacda('0x2a')+_[_0xacda('0x9a')](_0x4b9fe4['query'][_0xacda('0x96')])+'Queues'](_0x445592);default:throw new db[(_0xacda('0x89'))][(_0xacda('0x8a'))](_0xacda('0xcc'));}})[_0xacda('0x11')](function(_0x2ce971){_0xde7f3c=_0x2ce971[_0xacda('0x48')];if(!_0x4b9fe4[_0xacda('0x3f')][_0xacda('0xc5')](_0xacda('0xc9'))){_0x445592['limit']=qs['limit'](_0x4b9fe4['query'][_0xacda('0x1e')]);_0x445592['offset']=qs[_0xacda('0x20')](_0x4b9fe4[_0xacda('0x3f')]['offset']);}switch(_0x1bfd4f['role']){case _0xacda('0x2b'):return db[_[_0xacda('0x9a')](_0x4b9fe4[_0xacda('0x3f')][_0xacda('0x96')])+_0xacda('0xcb')][_0xacda('0xa1')](_0x445592);case _0xacda('0x7b'):case _0xacda('0x26'):return _0x1bfd4f[_0xacda('0x2a')+_[_0xacda('0x9a')](_0x4b9fe4[_0xacda('0x3f')]['channel'])+_0xacda('0x9b')](_0x445592);}})[_0xacda('0x11')](function(_0x26541a){return{'count':_0xde7f3c,'rows':_0x26541a};})[_0xacda('0x11')](respondWithResult(_0x46e2fb,null))[_0xacda('0x1a')](handleError(_0x46e2fb,null));};exports[_0xacda('0xcd')]=function(_0x3f47ed,_0x2f8e64){var _0x1ce495={};var _0x440e6e={};var _0x1c9e01;var _0xaa9f5;return db['User'][_0xacda('0x92')]({'where':{'id':_0x3f47ed[_0xacda('0x4f')]['id']}})[_0xacda('0x11')](handleEntityNotFound(_0x2f8e64,null))['then'](function(_0x166e1d){if(_0x166e1d){_0x1c9e01=_0x166e1d;_0x440e6e[_0xacda('0x50')]=_[_0xacda('0x52')](db['UserVoiceQueueRt'][_0xacda('0x38')]);_0x440e6e[_0xacda('0x3f')]=_[_0xacda('0x52')](_0x3f47ed[_0xacda('0x3f')]);_0x440e6e[_0xacda('0x53')]=_[_0xacda('0x54')](_0x440e6e[_0xacda('0x50')],_0x440e6e[_0xacda('0x3f')]);_0x1ce495[_0xacda('0x45')]=_[_0xacda('0x54')](_0x440e6e['model'],qs[_0xacda('0x55')](_0x3f47ed['query']['fields']));_0x1ce495[_0xacda('0x45')]=_0x1ce495[_0xacda('0x45')][_0xacda('0x48')]?_0x1ce495['attributes']:_0x440e6e['model'];_0x1ce495['order']=qs['sort'](_0x3f47ed[_0xacda('0x3f')][_0xacda('0xc4')]);_0x1ce495[_0xacda('0x3e')]=qs[_0xacda('0x53')](_[_0xacda('0xce')](_0x3f47ed[_0xacda('0x3f')],_0x440e6e[_0xacda('0x53')]));if(_0x3f47ed[_0xacda('0x3f')]['filter']){_0x1ce495[_0xacda('0x3e')]=_[_0xacda('0x56')](_0x1ce495['where'],{'$or':_[_0xacda('0x30')](_0x1ce495['attributes'],function(_0x140f0e){var _0x2922ef={};_0x2922ef[_0x140f0e]={'$like':'%'+_0x3f47ed[_0xacda('0x3f')][_0xacda('0x2f')]+'%'};return _0x2922ef;})});}_0x1ce495=_[_0xacda('0x56')]({},_0x1ce495,_0x3f47ed[_0xacda('0x57')]);return _0x1c9e01['getVoiceQueuesRt'](_0x1ce495);}})[_0xacda('0x11')](function(_0x535257){if(_0x535257){_0xaa9f5=_0x535257[_0xacda('0x48')];if(!_0x3f47ed[_0xacda('0x3f')][_0xacda('0xc5')](_0xacda('0xc9'))){_0x1ce495['limit']=qs[_0xacda('0x1e')](_0x3f47ed[_0xacda('0x3f')][_0xacda('0x1e')]);_0x1ce495[_0xacda('0x20')]=qs[_0xacda('0x20')](_0x3f47ed['query']['offset']);}return _0x1c9e01[_0xacda('0xcd')](_0x1ce495);}})[_0xacda('0x11')](function(_0x407ae0){if(_0x407ae0){return _0x407ae0?{'count':_0xaa9f5,'rows':_0x407ae0}:null;}})[_0xacda('0x11')](respondWithResult(_0x2f8e64,null))[_0xacda('0x1a')](handleError(_0x2f8e64,null));};exports[_0xacda('0xcf')]=function(_0x422c59,_0x24c6b8){var _0x51fe80={};var _0x182eb8={};var _0x7e9fd8;var _0x1e8593;return db[_0xacda('0x37')][_0xacda('0x92')]({'where':{'id':_0x422c59[_0xacda('0x4f')]['id']}})['then'](handleEntityNotFound(_0x24c6b8,null))['then'](function(_0x312e08){if(_0x312e08){_0x7e9fd8=_0x312e08;_0x182eb8[_0xacda('0x50')]=_['keys'](db[_0xacda('0xd0')][_0xacda('0x38')]);_0x182eb8[_0xacda('0x3f')]=_[_0xacda('0x52')](_0x422c59[_0xacda('0x3f')]);_0x182eb8[_0xacda('0x53')]=_[_0xacda('0x54')](_0x182eb8['model'],_0x182eb8['query']);_0x51fe80[_0xacda('0x45')]=_[_0xacda('0x54')](_0x182eb8[_0xacda('0x50')],qs[_0xacda('0x55')](_0x422c59[_0xacda('0x3f')][_0xacda('0x55')]));_0x51fe80[_0xacda('0x45')]=_0x51fe80[_0xacda('0x45')]['length']?_0x51fe80['attributes']:_0x182eb8[_0xacda('0x50')];_0x51fe80['order']=qs[_0xacda('0xc4')](_0x422c59[_0xacda('0x3f')][_0xacda('0xc4')]);_0x51fe80[_0xacda('0x3e')]=qs[_0xacda('0x53')](_[_0xacda('0xce')](_0x422c59['query'],_0x182eb8[_0xacda('0x53')]));if(_0x422c59['query'][_0xacda('0x2f')]){_0x51fe80['where']=_[_0xacda('0x56')](_0x51fe80[_0xacda('0x3e')],{'$or':_[_0xacda('0x30')](_0x51fe80[_0xacda('0x45')],function(_0x35926a){var _0x2247da={};_0x2247da[_0x35926a]={'$like':'%'+_0x422c59[_0xacda('0x3f')][_0xacda('0x2f')]+'%'};return _0x2247da;})});}_0x51fe80=_[_0xacda('0x56')]({},_0x51fe80,_0x422c59['options']);return _0x7e9fd8[_0xacda('0xcf')](_0x51fe80);}})[_0xacda('0x11')](function(_0x55f615){if(_0x55f615){_0x1e8593=_0x55f615['length'];if(!_0x422c59[_0xacda('0x3f')][_0xacda('0xc5')]('nolimit')){_0x51fe80[_0xacda('0x1e')]=qs[_0xacda('0x1e')](_0x422c59[_0xacda('0x3f')][_0xacda('0x1e')]);_0x51fe80[_0xacda('0x20')]=qs[_0xacda('0x20')](_0x422c59[_0xacda('0x3f')][_0xacda('0x20')]);}return _0x7e9fd8[_0xacda('0xcf')](_0x51fe80);}})['then'](function(_0x43fbc4){if(_0x43fbc4){return _0x43fbc4?{'count':_0x1e8593,'rows':_0x43fbc4}:null;}})[_0xacda('0x11')](respondWithResult(_0x24c6b8,null))['catch'](handleError(_0x24c6b8,null));};exports[_0xacda('0xd1')]=function(_0x4a4949,_0x4c9cd0){var _0x4258cf={'raw':!![],'where':{}};var _0x4c1cae={};var _0x8069cb={'count':0x0,'rows':[]};return db[_0xacda('0x37')][_0xacda('0x92')]({'where':{'id':_0x4a4949[_0xacda('0x4f')]['id']}})[_0xacda('0x11')](handleEntityNotFound(_0x4c9cd0,null))[_0xacda('0x11')](function(_0x222460){if(_0x222460){_0x4c1cae[_0xacda('0x50')]=_[_0xacda('0x52')](db[_0xacda('0xd2')]['rawAttributes']);_0x4c1cae[_0xacda('0x3f')]=_['keys'](_0x4a4949[_0xacda('0x3f')]);_0x4c1cae['filters']=_[_0xacda('0x54')](_0x4c1cae['model'],_0x4c1cae[_0xacda('0x3f')]);_0x4258cf['attributes']=_['intersection'](_0x4c1cae['model'],qs[_0xacda('0x55')](_0x4a4949[_0xacda('0x3f')][_0xacda('0x55')]));_0x4258cf['attributes']=_0x4258cf[_0xacda('0x45')][_0xacda('0x48')]?_0x4258cf['attributes']:_0x4c1cae[_0xacda('0x50')];if(!_0x4a4949[_0xacda('0x3f')][_0xacda('0xc5')](_0xacda('0xc9'))){_0x4258cf[_0xacda('0x1e')]=qs[_0xacda('0x1e')](_0x4a4949[_0xacda('0x3f')]['limit']);_0x4258cf[_0xacda('0x20')]=qs[_0xacda('0x20')](_0x4a4949[_0xacda('0x3f')][_0xacda('0x20')]);}_0x4258cf[_0xacda('0xc3')]=qs[_0xacda('0xc4')](_0x4a4949[_0xacda('0x3f')][_0xacda('0xc4')]);_0x4258cf[_0xacda('0x3e')]=qs[_0xacda('0x53')](_[_0xacda('0xce')](_0x4a4949[_0xacda('0x3f')],_0x4c1cae[_0xacda('0x53')]));_0x4258cf[_0xacda('0x3e')][_0xacda('0xd3')]=_0x222460['id'];if(_0x4a4949[_0xacda('0x3f')][_0xacda('0x2f')]){_0x4258cf[_0xacda('0x3e')]=_['merge'](_0x4258cf[_0xacda('0x3e')],{'$or':_[_0xacda('0x30')](_0x4258cf[_0xacda('0x45')],function(_0x5ebe7d){var _0xfbccce={};_0xfbccce[_0x5ebe7d]={'$like':'%'+_0x4a4949[_0xacda('0x3f')][_0xacda('0x2f')]+'%'};return _0xfbccce;})});}_0x4258cf=_[_0xacda('0x56')]({},_0x4258cf,_0x4a4949[_0xacda('0x57')]);return db['VoiceRecording'][_0xacda('0x21')]({'where':_0x4258cf[_0xacda('0x3e')]})['then'](function(_0x40605c){_0x8069cb[_0xacda('0x21')]=_0x40605c;if(_0x4a4949[_0xacda('0x3f')][_0xacda('0x40')]){_0x4258cf[_0xacda('0x41')]=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x4258cf);})['then'](function(_0x43cbce){_0x8069cb[_0xacda('0x47')]=_0x43cbce;return _0x8069cb;});}})[_0xacda('0x11')](respondWithFilteredResult(_0x4c9cd0,_0x4258cf))[_0xacda('0x1a')](handleError(_0x4c9cd0,null));};exports[_0xacda('0xd4')]=function(_0x145498,_0x143ba8){var _0x4fedae={'raw':!![],'where':{}};var _0x2dbe77={};var _0x4f5968={'count':0x0,'rows':[]};return db[_0xacda('0x37')]['findOne']({'where':{'id':_0x145498[_0xacda('0x4f')]['id']}})[_0xacda('0x11')](handleEntityNotFound(_0x143ba8,null))[_0xacda('0x11')](function(_0x332767){if(_0x332767){_0x2dbe77['model']=_[_0xacda('0x52')](db[_0xacda('0xd5')][_0xacda('0x38')]);_0x2dbe77[_0xacda('0x3f')]=_[_0xacda('0x52')](_0x145498[_0xacda('0x3f')]);_0x2dbe77['filters']=_[_0xacda('0x54')](_0x2dbe77[_0xacda('0x50')],_0x2dbe77['query']);_0x4fedae[_0xacda('0x45')]=_[_0xacda('0x54')](_0x2dbe77[_0xacda('0x50')],qs[_0xacda('0x55')](_0x145498[_0xacda('0x3f')]['fields']));_0x4fedae[_0xacda('0x45')]=_0x4fedae[_0xacda('0x45')][_0xacda('0x48')]?_0x4fedae[_0xacda('0x45')]:_0x2dbe77[_0xacda('0x50')];if(!_0x145498['query'][_0xacda('0xc5')](_0xacda('0xc9'))){_0x4fedae[_0xacda('0x1e')]=qs[_0xacda('0x1e')](_0x145498[_0xacda('0x3f')][_0xacda('0x1e')]);_0x4fedae[_0xacda('0x20')]=qs[_0xacda('0x20')](_0x145498[_0xacda('0x3f')][_0xacda('0x20')]);}_0x4fedae[_0xacda('0xc3')]=qs[_0xacda('0xc4')](_0x145498[_0xacda('0x3f')][_0xacda('0xc4')]);_0x4fedae[_0xacda('0x3e')]=qs[_0xacda('0x53')](_[_0xacda('0xce')](_0x145498[_0xacda('0x3f')],_0x2dbe77[_0xacda('0x53')]));_0x4fedae[_0xacda('0x3e')][_0xacda('0xd3')]=_0x332767['id'];if(_0x145498[_0xacda('0x3f')][_0xacda('0x2f')]){_0x4fedae['where']=_[_0xacda('0x56')](_0x4fedae[_0xacda('0x3e')],{'$or':_['map'](_0x4fedae[_0xacda('0x45')],function(_0x4eeb7f){var _0x1a9cd1={};_0x1a9cd1[_0x4eeb7f]={'$like':'%'+_0x145498['query']['filter']+'%'};return _0x1a9cd1;})});}_0x4fedae=_[_0xacda('0x56')]({},_0x4fedae,_0x145498['options']);return db['ScreenRecording'][_0xacda('0x21')]({'where':_0x4fedae[_0xacda('0x3e')]})[_0xacda('0x11')](function(_0x4112d9){_0x4f5968[_0xacda('0x21')]=_0x4112d9;if(_0x145498[_0xacda('0x3f')]['includeAll']){_0x4fedae[_0xacda('0x41')]=[{'all':!![]}];}return db[_0xacda('0xd5')][_0xacda('0xa1')](_0x4fedae);})['then'](function(_0x8a022d){_0x4f5968[_0xacda('0x47')]=_0x8a022d;return _0x4f5968;});}})[_0xacda('0x11')](respondWithFilteredResult(_0x143ba8,_0x4fedae))[_0xacda('0x1a')](handleError(_0x143ba8,null));};exports[_0xacda('0xd6')]=function(_0x1e256c,_0x38297d){var _0x4f063c={};var _0x2d2f31={};var _0x33c0ef;var _0x25a9ed;return db[_0xacda('0x37')]['findOne']({'where':{'id':_0x1e256c[_0xacda('0x4f')]['id']}})[_0xacda('0x11')](handleEntityNotFound(_0x38297d,null))[_0xacda('0x11')](function(_0x49a674){if(_0x49a674){_0x33c0ef=_0x49a674;_0x2d2f31[_0xacda('0x50')]=_[_0xacda('0x52')](db[_0xacda('0xd7')][_0xacda('0x38')]);_0x2d2f31['query']=_[_0xacda('0x52')](_0x1e256c[_0xacda('0x3f')]);_0x2d2f31[_0xacda('0x53')]=_[_0xacda('0x54')](_0x2d2f31[_0xacda('0x50')],_0x2d2f31[_0xacda('0x3f')]);_0x4f063c['attributes']=_[_0xacda('0x54')](_0x2d2f31[_0xacda('0x50')],qs[_0xacda('0x55')](_0x1e256c[_0xacda('0x3f')]['fields']));_0x4f063c[_0xacda('0x45')]=_0x4f063c[_0xacda('0x45')]['length']?_0x4f063c[_0xacda('0x45')]:_0x2d2f31[_0xacda('0x50')];_0x4f063c[_0xacda('0xc3')]=qs[_0xacda('0xc4')](_0x1e256c[_0xacda('0x3f')][_0xacda('0xc4')]);_0x4f063c['where']=qs['filters'](_[_0xacda('0xce')](_0x1e256c['query'],_0x2d2f31[_0xacda('0x53')]));if(_0x1e256c[_0xacda('0x3f')][_0xacda('0x2f')]){_0x4f063c[_0xacda('0x3e')]=_[_0xacda('0x56')](_0x4f063c[_0xacda('0x3e')],{'$or':_['map'](_0x4f063c[_0xacda('0x45')],function(_0x25aa40){var _0x554aac={};_0x554aac[_0x25aa40]={'$like':'%'+_0x1e256c[_0xacda('0x3f')]['filter']+'%'};return _0x554aac;})});}_0x4f063c=_[_0xacda('0x56')]({},_0x4f063c,_0x1e256c[_0xacda('0x57')]);return _0x33c0ef[_0xacda('0xd6')](_0x4f063c);}})['then'](function(_0x1c48dd){if(_0x1c48dd){_0x25a9ed=_0x1c48dd[_0xacda('0x48')];if(!_0x1e256c[_0xacda('0x3f')][_0xacda('0xc5')](_0xacda('0xc9'))){_0x4f063c[_0xacda('0x1e')]=qs['limit'](_0x1e256c[_0xacda('0x3f')][_0xacda('0x1e')]);_0x4f063c['offset']=qs[_0xacda('0x20')](_0x1e256c['query'][_0xacda('0x20')]);}return _0x33c0ef[_0xacda('0xd6')](_0x4f063c);}})['then'](function(_0x3baa80){if(_0x3baa80){return _0x3baa80?{'count':_0x25a9ed,'rows':_0x3baa80}:null;}})['then'](respondWithResult(_0x38297d,null))[_0xacda('0x1a')](handleError(_0x38297d,null));};exports['getOpenchannelInteractions']=function(_0x528229,_0x12115a){var _0xfdf214={};var _0x9968c8={};var _0xc0d84f;var _0x63a3f7;return db[_0xacda('0x37')][_0xacda('0x92')]({'where':{'id':_0x528229[_0xacda('0x4f')]['id']}})[_0xacda('0x11')](handleEntityNotFound(_0x12115a,null))['then'](function(_0x1e644f){if(_0x1e644f){_0xc0d84f=_0x1e644f;_0x9968c8[_0xacda('0x50')]=_[_0xacda('0x52')](db[_0xacda('0xd8')][_0xacda('0x38')]);_0x9968c8['query']=_[_0xacda('0x52')](_0x528229[_0xacda('0x3f')]);_0x9968c8[_0xacda('0x53')]=_[_0xacda('0x54')](_0x9968c8[_0xacda('0x50')],_0x9968c8['query']);_0xfdf214[_0xacda('0x45')]=_[_0xacda('0x54')](_0x9968c8[_0xacda('0x50')],qs['fields'](_0x528229['query'][_0xacda('0x55')]));_0xfdf214[_0xacda('0x45')]=_0xfdf214['attributes'][_0xacda('0x48')]?_0xfdf214['attributes']:_0x9968c8[_0xacda('0x50')];_0xfdf214['order']=qs[_0xacda('0xc4')](_0x528229[_0xacda('0x3f')][_0xacda('0xc4')]);_0xfdf214[_0xacda('0x3e')]=qs['filters'](_[_0xacda('0xce')](_0x528229[_0xacda('0x3f')],_0x9968c8['filters']));if(_0x528229[_0xacda('0x3f')][_0xacda('0x2f')]){_0xfdf214[_0xacda('0x3e')]=_['merge'](_0xfdf214['where'],{'$or':_[_0xacda('0x30')](_0xfdf214['attributes'],function(_0x14f3ca){var _0x323b6e={};_0x323b6e[_0x14f3ca]={'$like':'%'+_0x528229[_0xacda('0x3f')][_0xacda('0x2f')]+'%'};return _0x323b6e;})});}_0xfdf214=_[_0xacda('0x56')]({},_0xfdf214,_0x528229[_0xacda('0x57')]);return _0xc0d84f[_0xacda('0xd9')](_0xfdf214);}})[_0xacda('0x11')](function(_0x12e1b7){if(_0x12e1b7){_0x63a3f7=_0x12e1b7[_0xacda('0x48')];if(!_0x528229[_0xacda('0x3f')][_0xacda('0xc5')](_0xacda('0xc9'))){_0xfdf214[_0xacda('0x1e')]=qs[_0xacda('0x1e')](_0x528229[_0xacda('0x3f')]['limit']);_0xfdf214[_0xacda('0x20')]=qs['offset'](_0x528229[_0xacda('0x3f')][_0xacda('0x20')]);}return _0xc0d84f['getOpenchannelInteractions'](_0xfdf214);}})[_0xacda('0x11')](function(_0xc4d395){if(_0xc4d395){return _0xc4d395?{'count':_0x63a3f7,'rows':_0xc4d395}:null;}})[_0xacda('0x11')](respondWithResult(_0x12115a,null))[_0xacda('0x1a')](handleError(_0x12115a,null));};exports[_0xacda('0xda')]=function(_0x189de3,_0x40d2ba){var _0x3f91e5={'raw':!![],'where':{}};var _0x360ab2={};var _0x28f87b={'count':0x0,'rows':[]};return db[_0xacda('0x37')][_0xacda('0x92')]({'where':{'id':_0x189de3['params']['id']}})[_0xacda('0x11')](handleEntityNotFound(_0x40d2ba,null))[_0xacda('0x11')](function(_0x4f432a){if(_0x4f432a){_0x360ab2[_0xacda('0x50')]=_[_0xacda('0x52')](db[_0xacda('0xdb')][_0xacda('0x38')]);_0x360ab2[_0xacda('0x3f')]=_[_0xacda('0x52')](_0x189de3[_0xacda('0x3f')]);_0x360ab2[_0xacda('0x53')]=_[_0xacda('0x54')](_0x360ab2['model'],_0x360ab2[_0xacda('0x3f')]);_0x3f91e5[_0xacda('0x45')]=_[_0xacda('0x54')](_0x360ab2[_0xacda('0x50')],qs[_0xacda('0x55')](_0x189de3[_0xacda('0x3f')][_0xacda('0x55')]));_0x3f91e5['attributes']=_0x3f91e5['attributes'][_0xacda('0x48')]?_0x3f91e5['attributes']:_0x360ab2[_0xacda('0x50')];if(!_0x189de3['query']['hasOwnProperty'](_0xacda('0xc9'))){_0x3f91e5[_0xacda('0x1e')]=qs['limit'](_0x189de3[_0xacda('0x3f')]['limit']);_0x3f91e5[_0xacda('0x20')]=qs[_0xacda('0x20')](_0x189de3['query'][_0xacda('0x20')]);}_0x3f91e5[_0xacda('0xc3')]=qs[_0xacda('0xc4')](_0x189de3[_0xacda('0x3f')][_0xacda('0xc4')]);_0x3f91e5['where']=qs['filters'](_[_0xacda('0xce')](_0x189de3['query'],_0x360ab2[_0xacda('0x53')]));_0x3f91e5['where'][_0xacda('0xd3')]=_0x4f432a['id'];if(_0x189de3['query'][_0xacda('0x2f')]){_0x3f91e5[_0xacda('0x3e')]=_[_0xacda('0x56')](_0x3f91e5['where'],{'$or':_[_0xacda('0x30')](_0x3f91e5['attributes'],function(_0x37759c){var _0x2ba46d={};_0x2ba46d[_0x37759c]={'$like':'%'+_0x189de3[_0xacda('0x3f')]['filter']+'%'};return _0x2ba46d;})});}_0x3f91e5=_[_0xacda('0x56')]({},_0x3f91e5,_0x189de3[_0xacda('0x57')]);return db[_0xacda('0xdb')][_0xacda('0x21')]({'where':_0x3f91e5[_0xacda('0x3e')]})[_0xacda('0x11')](function(_0x41fe08){_0x28f87b[_0xacda('0x21')]=_0x41fe08;if(_0x189de3[_0xacda('0x3f')]['includeAll']){_0x3f91e5[_0xacda('0x41')]=[{'all':!![]}];}return db[_0xacda('0xdb')][_0xacda('0xa1')](_0x3f91e5);})[_0xacda('0x11')](function(_0x3f1c48){_0x28f87b[_0xacda('0x47')]=_0x3f1c48;return _0x28f87b;});}})[_0xacda('0x11')](respondWithFilteredResult(_0x40d2ba,_0x3f91e5))[_0xacda('0x1a')](handleError(_0x40d2ba,null));};exports[_0xacda('0xdc')]=function(_0x226808,_0x10be91){var _0x30d9bc={};var _0x534231={};var _0x4d1c0b;var _0x2451d8;return db['User'][_0xacda('0x92')]({'where':{'id':_0x226808['params']['id']}})[_0xacda('0x11')](handleEntityNotFound(_0x10be91,null))[_0xacda('0x11')](function(_0x2cdac1){if(_0x2cdac1){_0x4d1c0b=_0x2cdac1;_0x534231['model']=_['keys'](db['SmsInteraction']['rawAttributes']);_0x534231[_0xacda('0x3f')]=_[_0xacda('0x52')](_0x226808[_0xacda('0x3f')]);_0x534231[_0xacda('0x53')]=_[_0xacda('0x54')](_0x534231[_0xacda('0x50')],_0x534231['query']);_0x30d9bc[_0xacda('0x45')]=_['intersection'](_0x534231['model'],qs[_0xacda('0x55')](_0x226808['query'][_0xacda('0x55')]));_0x30d9bc[_0xacda('0x45')]=_0x30d9bc[_0xacda('0x45')][_0xacda('0x48')]?_0x30d9bc[_0xacda('0x45')]:_0x534231[_0xacda('0x50')];_0x30d9bc['order']=qs[_0xacda('0xc4')](_0x226808[_0xacda('0x3f')][_0xacda('0xc4')]);_0x30d9bc['where']=qs[_0xacda('0x53')](_[_0xacda('0xce')](_0x226808[_0xacda('0x3f')],_0x534231[_0xacda('0x53')]));if(_0x226808['query']['filter']){_0x30d9bc[_0xacda('0x3e')]=_[_0xacda('0x56')](_0x30d9bc[_0xacda('0x3e')],{'$or':_['map'](_0x30d9bc[_0xacda('0x45')],function(_0x342016){var _0x538f8f={};_0x538f8f[_0x342016]={'$like':'%'+_0x226808[_0xacda('0x3f')][_0xacda('0x2f')]+'%'};return _0x538f8f;})});}_0x30d9bc=_[_0xacda('0x56')]({},_0x30d9bc,_0x226808['options']);return _0x4d1c0b[_0xacda('0xdc')](_0x30d9bc);}})[_0xacda('0x11')](function(_0x2d6cba){if(_0x2d6cba){_0x2451d8=_0x2d6cba[_0xacda('0x48')];if(!_0x226808[_0xacda('0x3f')][_0xacda('0xc5')](_0xacda('0xc9'))){_0x30d9bc[_0xacda('0x1e')]=qs[_0xacda('0x1e')](_0x226808[_0xacda('0x3f')][_0xacda('0x1e')]);_0x30d9bc[_0xacda('0x20')]=qs[_0xacda('0x20')](_0x226808[_0xacda('0x3f')][_0xacda('0x20')]);}return _0x4d1c0b['getSmsInteractions'](_0x30d9bc);}})[_0xacda('0x11')](function(_0x4813ad){if(_0x4813ad){return _0x4813ad?{'count':_0x2451d8,'rows':_0x4813ad}:null;}})['then'](respondWithResult(_0x10be91,null))['catch'](handleError(_0x10be91,null));};exports['getFaxInteractions']=function(_0x54d1aa,_0xc60ec3){var _0x244425={};var _0x1a29ab={};var _0x4dc8a1;var _0x352229;return db[_0xacda('0x37')][_0xacda('0x92')]({'where':{'id':_0x54d1aa[_0xacda('0x4f')]['id']}})[_0xacda('0x11')](handleEntityNotFound(_0xc60ec3,null))['then'](function(_0x2c75ee){if(_0x2c75ee){_0x4dc8a1=_0x2c75ee;_0x1a29ab[_0xacda('0x50')]=_[_0xacda('0x52')](db[_0xacda('0xdd')][_0xacda('0x38')]);_0x1a29ab['query']=_['keys'](_0x54d1aa[_0xacda('0x3f')]);_0x1a29ab[_0xacda('0x53')]=_['intersection'](_0x1a29ab[_0xacda('0x50')],_0x1a29ab[_0xacda('0x3f')]);_0x244425[_0xacda('0x45')]=_[_0xacda('0x54')](_0x1a29ab[_0xacda('0x50')],qs[_0xacda('0x55')](_0x54d1aa[_0xacda('0x3f')][_0xacda('0x55')]));_0x244425[_0xacda('0x45')]=_0x244425[_0xacda('0x45')][_0xacda('0x48')]?_0x244425[_0xacda('0x45')]:_0x1a29ab[_0xacda('0x50')];_0x244425[_0xacda('0xc3')]=qs[_0xacda('0xc4')](_0x54d1aa['query'][_0xacda('0xc4')]);_0x244425[_0xacda('0x3e')]=qs[_0xacda('0x53')](_['pick'](_0x54d1aa['query'],_0x1a29ab['filters']));if(_0x54d1aa[_0xacda('0x3f')][_0xacda('0x2f')]){_0x244425[_0xacda('0x3e')]=_['merge'](_0x244425[_0xacda('0x3e')],{'$or':_['map'](_0x244425['attributes'],function(_0x2cbeba){var _0x3b3a69={};_0x3b3a69[_0x2cbeba]={'$like':'%'+_0x54d1aa[_0xacda('0x3f')]['filter']+'%'};return _0x3b3a69;})});}_0x244425=_['merge']({},_0x244425,_0x54d1aa[_0xacda('0x57')]);return _0x4dc8a1[_0xacda('0xde')](_0x244425);}})[_0xacda('0x11')](function(_0x43a4e4){if(_0x43a4e4){_0x352229=_0x43a4e4[_0xacda('0x48')];if(!_0x54d1aa[_0xacda('0x3f')][_0xacda('0xc5')](_0xacda('0xc9'))){_0x244425[_0xacda('0x1e')]=qs[_0xacda('0x1e')](_0x54d1aa['query'][_0xacda('0x1e')]);_0x244425['offset']=qs['offset'](_0x54d1aa[_0xacda('0x3f')]['offset']);}return _0x4dc8a1[_0xacda('0xde')](_0x244425);}})['then'](function(_0x365332){if(_0x365332){return _0x365332?{'count':_0x352229,'rows':_0x365332}:null;}})[_0xacda('0x11')](respondWithResult(_0xc60ec3,null))[_0xacda('0x1a')](handleError(_0xc60ec3,null));};exports[_0xacda('0xdf')]=function(_0x4a0792,_0x591c06){var _0x22c056={};var _0x2359f5={};var _0x3a2563;var _0x4058c8;return db['User'][_0xacda('0x92')]({'where':{'id':_0x4a0792['params']['id']}})[_0xacda('0x11')](handleEntityNotFound(_0x591c06,null))['then'](function(_0x1f48bf){if(_0x1f48bf){_0x3a2563=_0x1f48bf;_0x2359f5[_0xacda('0x50')]=_[_0xacda('0x52')](db[_0xacda('0xe0')][_0xacda('0x38')]);_0x2359f5[_0xacda('0x3f')]=_[_0xacda('0x52')](_0x4a0792[_0xacda('0x3f')]);_0x2359f5['filters']=_[_0xacda('0x54')](_0x2359f5[_0xacda('0x50')],_0x2359f5[_0xacda('0x3f')]);_0x22c056[_0xacda('0x45')]=_['intersection'](_0x2359f5[_0xacda('0x50')],qs[_0xacda('0x55')](_0x4a0792[_0xacda('0x3f')][_0xacda('0x55')]));_0x22c056[_0xacda('0x45')]=_0x22c056[_0xacda('0x45')]['length']?_0x22c056[_0xacda('0x45')]:_0x2359f5[_0xacda('0x50')];_0x22c056[_0xacda('0xc3')]=qs['sort'](_0x4a0792[_0xacda('0x3f')][_0xacda('0xc4')]);_0x22c056['where']=qs[_0xacda('0x53')](_['pick'](_0x4a0792['query'],_0x2359f5['filters']));if(_0x4a0792[_0xacda('0x3f')]['filter']){_0x22c056[_0xacda('0x3e')]=_[_0xacda('0x56')](_0x22c056[_0xacda('0x3e')],{'$or':_[_0xacda('0x30')](_0x22c056[_0xacda('0x45')],function(_0x3f7760){var _0x513c1c={};_0x513c1c[_0x3f7760]={'$like':'%'+_0x4a0792[_0xacda('0x3f')][_0xacda('0x2f')]+'%'};return _0x513c1c;})});}_0x22c056=_[_0xacda('0x56')]({},_0x22c056,_0x4a0792['options']);return _0x3a2563[_0xacda('0xdf')](_0x22c056);}})['then'](function(_0x225aa6){if(_0x225aa6){_0x4058c8=_0x225aa6[_0xacda('0x48')];if(!_0x4a0792[_0xacda('0x3f')][_0xacda('0xc5')](_0xacda('0xc9'))){_0x22c056[_0xacda('0x1e')]=qs[_0xacda('0x1e')](_0x4a0792['query'][_0xacda('0x1e')]);_0x22c056[_0xacda('0x20')]=qs[_0xacda('0x20')](_0x4a0792[_0xacda('0x3f')][_0xacda('0x20')]);}return _0x3a2563[_0xacda('0xdf')](_0x22c056);}})[_0xacda('0x11')](function(_0x530cd0){if(_0x530cd0){return _0x530cd0?{'count':_0x4058c8,'rows':_0x530cd0}:null;}})[_0xacda('0x11')](respondWithResult(_0x591c06,null))[_0xacda('0x1a')](handleError(_0x591c06,null));};exports[_0xacda('0xe1')]=function(_0x26e5ec,_0x2202ad,_0x1f1b88){var _0x389e4a;var _0x356cad;var _0x19b0a5;var _0x162335=!_[_0xacda('0x65')](_0x26e5ec['params']['id'])?_0x26e5ec[_0xacda('0x4f')]['id']:!_['isNil'](_0x26e5ec[_0xacda('0x7b')]['id'])?_0x26e5ec[_0xacda('0x7b')]['id']:null;return db['User'][_0xacda('0x33')]({'where':{'id':_0x162335,'role':{'$or':['admin','user',_0xacda('0x26')]}},'attributes':['id',_0xacda('0x34'),'phone',_0xacda('0xe2'),'role',_0xacda('0x60'),_0xacda('0x97')]})['then'](function(_0x1686b9){if(_0x1686b9){if(_0x1686b9['role']==='agent'){_0x389e4a=_0x1686b9;if(_0x26e5ec[_0xacda('0x5c')]['interface']){_0x19b0a5=util[_0xacda('0xe3')](_0xacda('0xe4'),_0x389e4a[_0x26e5ec[_0xacda('0x5c')][_0xacda('0xa3')]]);}else if(_0x26e5ec[_0xacda('0x5c')][_0xacda('0xe5')]){_0x19b0a5=util[_0xacda('0xe3')](_0xacda('0xe6'),_0x26e5ec[_0xacda('0x5c')][_0xacda('0xe5')]);}else{_0x19b0a5=util[_0xacda('0xe3')](_0xacda('0xe6'),_0x389e4a[_0xacda('0x34')]);}socket['to'](util[_0xacda('0xe3')](_0xacda('0xe7'),_0x389e4a[_0xacda('0x34')]))[_0xacda('0x27')]('user:forcelogout',{'user':{'id':_0x389e4a['id'],'name':_0x389e4a['name']},'ip':_0x26e5ec[_0xacda('0xe8')][_0xacda('0xe9')]||_0x26e5ec[_0xacda('0xea')][_0xacda('0xeb')]||_0x26e5ec[_0xacda('0xec')][_0xacda('0xeb')]||_0x26e5ec[_0xacda('0xea')]['socket']['remoteAddress']});return db[_0xacda('0xac')][_0xacda('0x29')]({'where':{'membername':_0x389e4a[_0xacda('0x34')]},'individualHooks':!![]});}}else{throw new db[(_0xacda('0x89'))][(_0xacda('0x8a'))](_0xacda('0xed'));}})['then'](function(){if(_0x389e4a){return _0x389e4a[_0xacda('0xee')]({'raw':!![]});}})['then'](function(_0x51079f){if(_0x389e4a){if(_0x51079f){_0x356cad=_0x51079f;if(_0x356cad[_0xacda('0x48')]){var _0x46aa47=_0x356cad[_0xacda('0x30')](function(_0x17ee07){var _0x2a9b6d={'membername':_0x389e4a[_0xacda('0x34')],'UserId':_0x389e4a['id'],'queue_name':_0x17ee07[_0xacda('0x34')],'VoiceQueueId':_0x17ee07['id'],'interface':_0x19b0a5,'paused':_0x389e4a[_0xacda('0x97')]||![],'penalty':_0x17ee07['UserVoiceQueue.penalty']||0x0};return db[_0xacda('0xac')]['upsert'](_0x2a9b6d);});return Promise[_0xacda('0x5b')](_0x46aa47);}}}})[_0xacda('0x11')](function(){if(_0x389e4a){return db[_0xacda('0xef')][_0xacda('0xa1')]({'where':{'membername':_0x389e4a[_0xacda('0x34')],'exitAt':null}});}})[_0xacda('0x11')](function(_0x20979b){if(_0x389e4a){var _0x25c89e=[];_0x20979b['forEach'](function(_0x1d6eae){_0x25c89e[_0xacda('0x46')](_0x1d6eae[_0xacda('0x24')]({'exitAt':moment()[_0xacda('0xe3')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise['all'](_0x25c89e);}})[_0xacda('0x11')](function(){if(_0x389e4a){var _0x294db4=[];var _0x4cca48=[];var _0x540d16=utils[_0xacda('0xf0')]();var _0x34e97d={'membername':_0x389e4a[_0xacda('0x34')],'interface':_0x19b0a5,'enterAt':moment()[_0xacda('0xe3')](_0xacda('0xf1')),'role':_0x389e4a[_0xacda('0x25')],'internal':_0x389e4a['internal']};_0x540d16[_0xacda('0xf2')](function(_0x4a4759){_0x294db4['push'](_[_0xacda('0x56')]({'channel':_0x4a4759,'type':_0xacda('0xf3'),'data1':_0x26e5ec[_0xacda('0x5c')]['device'],'data2':_0x19b0a5},_0x34e97d));if(_0x389e4a[_0xacda('0x97')]){_0x4cca48[_0xacda('0x46')](_['merge']({'channel':_0x4a4759,'type':_0xacda('0xf4'),'data1':'LOGININPAUSE'},_0x34e97d));}});return db['MemberReport'][_0xacda('0xf5')](_0x294db4[_0xacda('0xf6')](_0x4cca48),{'individualHooks':!![]});}})[_0xacda('0x11')](function(){if(_0x389e4a){return _0x389e4a['update']({'online':!![],'lastLoginAt':moment()['format'](_0xacda('0xf1')),'voicePause':_0x389e4a[_0xacda('0x97')]||![],'mailPause':_0x389e4a[_0xacda('0x97')]||![],'chatPause':_0x389e4a[_0xacda('0x97')]||![],'faxPause':_0x389e4a[_0xacda('0x97')]||![],'smsPause':_0x389e4a['loginInPause']||![],'openchannelPause':_0x389e4a['loginInPause']||![],'whatsappPause':_0x389e4a[_0xacda('0x97')]||![],'pauseType':_0x389e4a[_0xacda('0x97')]?'LOGININPAUSE':null,'interface':_0x19b0a5,'lastPauseAt':moment()[_0xacda('0xe3')](_0xacda('0xf1'))});}})[_0xacda('0x11')](function(_0x3627ac){if(_0x26e5ec['isMiddleware']){return _0x1f1b88();}else{return Promise[_0xacda('0xf7')](_0x3627ac)[_0xacda('0x11')](respondWithResult(_0x2202ad,null));}})[_0xacda('0x1a')](handleError(_0x2202ad,null));};exports[_0xacda('0xf8')]=function(_0x152abf,_0x1dbf56){var _0x11b68e;return db[_0xacda('0x37')][_0xacda('0x33')]({'where':{'id':_0x152abf[_0xacda('0x4f')]['id'],'role':'agent'},'attributes':['id',_0xacda('0x34'),_0xacda('0x25')]})[_0xacda('0x11')](handleEntityNotFound(_0x1dbf56,null))[_0xacda('0x11')](function(_0x1eb9f9){if(_0x1eb9f9){_0x11b68e=_0x1eb9f9;return db[_0xacda('0xac')][_0xacda('0x29')]({'where':{'membername':_0x11b68e['name']},'individualHooks':!![]});}})[_0xacda('0x11')](function(){return db[_0xacda('0xef')][_0xacda('0xa1')]({'where':{'membername':_0x11b68e[_0xacda('0x34')],'exitAt':null}});})[_0xacda('0x11')](function(_0xf849e9){var _0x3d7ee3=[];_0xf849e9[_0xacda('0xf2')](function(_0x46c69c){_0x3d7ee3[_0xacda('0x46')](_0x46c69c[_0xacda('0x24')]({'exitAt':moment()['format'](_0xacda('0xf1'))}));});return Promise['all'](_0x3d7ee3);})['then'](function(){return _0x11b68e[_0xacda('0x24')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x1dbf56,null))[_0xacda('0x1a')](handleError(_0x1dbf56,null));};exports[_0xacda('0xf9')]=function(_0x56ac86,_0x31634c){var _0x3a27c0;return db[_0xacda('0xac')][_0xacda('0x24')]({'paused':0x1},{'where':{'UserId':_0x56ac86['params']['id']},'individualHooks':!![]})['then'](function(){return db[_0xacda('0x37')][_0xacda('0x33')]({'where':{'id':_0x56ac86['params']['id'],'role':_0xacda('0x26')},'attributes':['id',_0xacda('0x34'),_0xacda('0x25'),_0xacda('0x60'),'interface',_0xacda('0xa2')]});})[_0xacda('0x11')](handleEntityNotFound(_0x31634c,null))[_0xacda('0x11')](function(_0x5eae97){if(_0x5eae97){_0x3a27c0=_0x5eae97;return respondWithRpcPromise(_0xacda('0xfa'),_0xacda('0xf9'),{'id':_0x3a27c0['id'],'name':_0x3a27c0[_0xacda('0x34')],'pause':!![]});}})[_0xacda('0x11')](function(){if(_0x3a27c0){return db[_0xacda('0xef')][_0xacda('0xa1')]({'where':{'membername':_0x3a27c0[_0xacda('0x34')],'type':_0xacda('0xf4'),'exitAt':null}});}})[_0xacda('0x11')](function(_0x33f674){if(_0x33f674[_0xacda('0x48')]){var _0x461f63=moment()['format'](_0xacda('0xf1'));for(var _0x5a501d=0x0,_0x11b185=_0x33f674['length'];_0x5a501d<_0x11b185;_0x5a501d++){_0x33f674[_0x5a501d][_0xacda('0xfb')]({'exitAt':_0x461f63});}}})[_0xacda('0x11')](function(){var _0x18cccf=[];var _0x459ac6=utils[_0xacda('0xf0')]();_0x459ac6[_0xacda('0xf2')](function(_0x336539){_0x18cccf['push']({'channel':_0x336539,'membername':_0x3a27c0[_0xacda('0x34')],'interface':_[_0xacda('0x65')](_0x3a27c0[_0xacda('0xa3')])?util['format']('SIP/%s',_0x3a27c0['name']):_0x3a27c0[_0xacda('0xa3')],'type':_0xacda('0xf4'),'enterAt':moment()[_0xacda('0xe3')](_0xacda('0xf1')),'data1':_0x56ac86['body'][_0xacda('0x3a')]||_0xacda('0xfc'),'role':_0x3a27c0['role'],'internal':_0x3a27c0['internal']});});return db[_0xacda('0xef')][_0xacda('0xf5')](_0x18cccf,{'individualHooks':!![]});})['then'](function(){return _0x3a27c0[_0xacda('0x24')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x56ac86[_0xacda('0x5c')][_0xacda('0x3a')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xacda('0xe3')](_0xacda('0xf1'))});})[_0xacda('0x11')](respondWithResult(_0x31634c,null))[_0xacda('0x1a')](handleError(_0x31634c,null));};exports[_0xacda('0xfd')]=function(_0x5e8a2b,_0x337665){if(_0x5e8a2b[_0xacda('0x5c')][_0xacda('0x96')]&&!utils['isValidChannel'](_0x5e8a2b[_0xacda('0x5c')][_0xacda('0x96')])){throw new APIBadRequestError(util[_0xacda('0xe3')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x5e8a2b[_0xacda('0x5c')]['channel']));}return db[_0xacda('0x37')][_0xacda('0x33')]({'where':{'id':_0x5e8a2b[_0xacda('0x4f')]['id']},'attributes':['id','name','role',_0xacda('0x60'),'interface','online',_0xacda('0xa4'),'mailPause',_0xacda('0xfe'),_0xacda('0xff'),'openchannelPause',_0xacda('0x100'),'whatsappPause',_0xacda('0x101'),'lastPauseAt']})[_0xacda('0x11')](function(_0x273e6e){if(!_0x273e6e){throw new APINotFoundError(util[_0xacda('0xe3')](_0xacda('0x102'),_0x5e8a2b[_0xacda('0x4f')]['id']));}return _0x273e6e[_0xacda('0xfd')](_0x5e8a2b['body'][_0xacda('0x96')]);})['then'](respondWithResult(_0x337665,null))['catch'](APIHandleError(_0x337665));};exports[_0xacda('0x103')]=function(_0xcb8f1e,_0x338b2b){var _0xe48647={};var _0x309c2d={};var _0x4f094f;var _0x1d18ae;return db['User']['findOne']({'where':{'id':_0xcb8f1e[_0xacda('0x4f')]['id']}})[_0xacda('0x11')](handleEntityNotFound(_0x338b2b,null))[_0xacda('0x11')](function(_0x4b25a4){if(_0x4b25a4){_0x4f094f=_0x4b25a4;_0x309c2d[_0xacda('0x50')]=_[_0xacda('0x52')](db[_0xacda('0x104')][_0xacda('0x38')]);_0x309c2d[_0xacda('0x3f')]=_['keys'](_0xcb8f1e[_0xacda('0x3f')]);_0x309c2d['filters']=_[_0xacda('0x54')](_0x309c2d['model'],_0x309c2d[_0xacda('0x3f')]);_0xe48647[_0xacda('0x45')]=_['intersection'](_0x309c2d['model'],qs[_0xacda('0x55')](_0xcb8f1e[_0xacda('0x3f')][_0xacda('0x55')]));_0xe48647[_0xacda('0x45')]=_0xe48647[_0xacda('0x45')][_0xacda('0x48')]?_0xe48647[_0xacda('0x45')]:_0x309c2d[_0xacda('0x50')];_0xe48647['order']=qs[_0xacda('0xc4')](_0xcb8f1e[_0xacda('0x3f')][_0xacda('0xc4')]);_0xe48647[_0xacda('0x3e')]=qs[_0xacda('0x53')](_['pick'](_0xcb8f1e[_0xacda('0x3f')],_0x309c2d[_0xacda('0x53')]));if(_0xcb8f1e[_0xacda('0x3f')][_0xacda('0x2f')]){_0xe48647['where']=_[_0xacda('0x56')](_0xe48647['where'],{'$or':_['map'](_0xe48647[_0xacda('0x45')],function(_0xce70b5){var _0x403a99={};_0x403a99[_0xce70b5]={'$like':'%'+_0xcb8f1e[_0xacda('0x3f')][_0xacda('0x2f')]+'%'};return _0x403a99;})});}_0xe48647=_[_0xacda('0x56')]({},_0xe48647,_0xcb8f1e[_0xacda('0x57')]);return _0x4f094f[_0xacda('0x103')](_0xe48647);}})[_0xacda('0x11')](function(_0x4da4a1){if(_0x4da4a1){_0x1d18ae=_0x4da4a1[_0xacda('0x48')];if(!_0xcb8f1e[_0xacda('0x3f')][_0xacda('0xc5')](_0xacda('0xc9'))){_0xe48647[_0xacda('0x1e')]=qs['limit'](_0xcb8f1e[_0xacda('0x3f')][_0xacda('0x1e')]);_0xe48647[_0xacda('0x20')]=qs[_0xacda('0x20')](_0xcb8f1e['query'][_0xacda('0x20')]);}return _0x4f094f['getTeams'](_0xe48647);}})[_0xacda('0x11')](function(_0xa3331c){if(_0xa3331c){return _0xa3331c?{'count':_0x1d18ae,'rows':_0xa3331c}:null;}})[_0xacda('0x11')](respondWithResult(_0x338b2b,null))['catch'](handleError(_0x338b2b,null));};exports[_0xacda('0x105')]=function(_0x51a334,_0x16c2a7){var _0x1125ec=_0x51a334['params']['id'];var _0x106380=_0x51a334[_0xacda('0x5c')]?_0x51a334['body'][_0xacda('0x5f')]:null;var _0x27adec=[];return Promise[_0xacda('0xf7')]()[_0xacda('0x11')](function(){if(!_0x106380)throw new APIBadRequestError(_0xacda('0x106'));})[_0xacda('0x11')](function(){return db['User'][_0xacda('0x92')]({'where':{'id':_0x1125ec}});})[_0xacda('0x11')](function(_0x41e964){if(!_0x41e964)throw new APINotFoundError(util[_0xacda('0xe3')](_0xacda('0x102'),_0x51a334[_0xacda('0x4f')]['id']));return db[_0xacda('0x67')][_0xacda('0x107')](function(_0x3e7eb8){return _0x41e964[_0xacda('0x105')](_0x106380,{'transaction':_0x3e7eb8})[_0xacda('0x11')](function(){return db[_0xacda('0x104')][_0xacda('0xa1')]({'where':{'id':{'$in':_0x106380}}});})[_0xacda('0x11')](function(_0x54bebe){var _0x5a40a0=_[_0xacda('0x30')](_0x54bebe,function(_0x9630bc){return _0x9630bc['getAssociatedQueues']();});return Promise['all'](_0x5a40a0);})['then'](function(_0x1b4384){_0x27adec=_[_0xacda('0x108')](_0x1b4384);var _0x18478f=_[_0xacda('0x30')](_0x27adec,function(_0x5740b7){return _0x5740b7[_0xacda('0x109')](_0x41e964['id'],{'transaction':_0x3e7eb8});});return Promise[_0xacda('0x5b')](_0x18478f);})[_0xacda('0x11')](function(){if(!_0x41e964['online'])return;var _0x5719e4=_[_0xacda('0x2f')](_0x27adec,function(_0x3c83d6){return _0x3c83d6[_0xacda('0x10a')]('channel')==='Voice';});var _0x13c4a1=_[_0xacda('0x30')](_0x5719e4,function(_0x5d8816){return db['UserVoiceQueueRt'][_0xacda('0xa6')]({'membername':_0x41e964['name'],'UserId':_0x41e964['id'],'queue_name':_0x5d8816[_0xacda('0x34')],'VoiceQueueId':_0x5d8816['id'],'interface':_[_0xacda('0x65')](_0x41e964['interface'])?util[_0xacda('0xe3')](_0xacda('0xe6'),_0x41e964[_0xacda('0x34')]):_0x41e964['interface'],'paused':_0x41e964[_0xacda('0xa4')]||![],'penalty':_0x41e964[_0xacda('0xa5')]},{'transaction':_0x3e7eb8});});return Promise[_0xacda('0x5b')](_0x13c4a1);})[_0xacda('0x11')](function(){return db['TeamVoicePrefix']['findAll']({'where':{'teamId':{'$in':_0x106380}}});})[_0xacda('0x11')](function(_0x51eee4){var _0x3d1092=_[_0xacda('0x30')](_0x51eee4,function(_0x158b5c){return db[_0xacda('0x10b')][_0xacda('0x7a')]({'UserId':_0x41e964['id'],'VoicePrefixId':_0x158b5c[_0xacda('0x10c')]},{'transaction':_0x3e7eb8});});return Promise[_0xacda('0x5b')](_0x3d1092);});});})[_0xacda('0x11')](function(){for(var _0x5d5d36=0x0;_0x5d5d36<_0x27adec['length'];_0x5d5d36++){var _0xaf9abc=_0x27adec[_0x5d5d36]['getDataValue'](_0xacda('0x96'));var _0x1e98c8=_0xaf9abc+_0xacda('0x9e');socket[_0xacda('0x27')](_0xacda('0x7b')+_0xaf9abc+'Queue:save',{'UserId':_0x1125ec,['queueField']:_0x27adec[_0x5d5d36]['id']});}})[_0xacda('0x11')](respondWithStatusCode(_0x16c2a7,null))[_0xacda('0x1a')](APIHandleError(_0x16c2a7));};exports[_0xacda('0x10d')]=function(_0x480b77,_0x28cda4){var _0x3ee307=_0x480b77[_0xacda('0x4f')]['id'];var _0x498ae5=null;if(_0x480b77['query']['ids']){_0x498ae5=_[_0xacda('0xaa')](_0x480b77[_0xacda('0x3f')][_0xacda('0x5f')])?_0x480b77[_0xacda('0x3f')][_0xacda('0x5f')]:[_0x480b77[_0xacda('0x3f')][_0xacda('0x5f')]];}var _0x153c2b=[];return Promise[_0xacda('0xf7')]()[_0xacda('0x11')](function(){if(!_0x498ae5)throw new APIBadRequestError(_0xacda('0x10e'));})['then'](function(){return db[_0xacda('0x37')][_0xacda('0x92')]({'where':{'id':_0x3ee307}});})['then'](function(_0xe1ca55){if(!_0xe1ca55)throw new APINotFoundError(util[_0xacda('0xe3')](_0xacda('0x102'),_0x480b77[_0xacda('0x4f')]['id']));return db['sequelize'][_0xacda('0x107')](function(_0x5ca3f5){return _0xe1ca55[_0xacda('0x10d')](_0x498ae5,{'transaction':_0x5ca3f5})[_0xacda('0x11')](function(){return db['Team']['findAll']({'where':{'id':{'$in':_0x498ae5}}});})[_0xacda('0x11')](function(_0x3b8459){var _0x47e18f=_[_0xacda('0x30')](_0x3b8459,function(_0x1c5b0b){return _0x1c5b0b[_0xacda('0x10f')]();});return Promise[_0xacda('0x5b')](_0x47e18f);})[_0xacda('0x11')](function(_0x4288d2){_0x153c2b=_[_0xacda('0x108')](_0x4288d2);var _0x193ffb=_[_0xacda('0x30')](_0x153c2b,function(_0x1e5d7f){return _0x1e5d7f[_0xacda('0x110')](_0xe1ca55['id'],{'transaction':_0x5ca3f5});});return Promise[_0xacda('0x5b')](_0x193ffb);})[_0xacda('0x11')](function(){if(!_0xe1ca55['online'])return;var _0x191150=_['filter'](_0x153c2b,function(_0xa55f26){return _0xa55f26[_0xacda('0x10a')](_0xacda('0x96'))===_0xacda('0x111');});var _0x314658=_[_0xacda('0x30')](_0x191150,function(_0x4128cd){return db['UserVoiceQueueRt'][_0xacda('0x29')]({'where':{'VoiceQueueId':_0x4128cd['id'],'UserId':_0xe1ca55['id']},'transaction':_0x5ca3f5});});return Promise[_0xacda('0x5b')](_0x314658);})[_0xacda('0x11')](function(){return db[_0xacda('0x112')][_0xacda('0xa1')]({'where':{'teamId':{'$in':_0x498ae5}}});})['then'](function(_0x2d2e92){var _0x308729=_['map'](_0x2d2e92,function(_0x43cb34){return db['UserVoicePrefix'][_0xacda('0x29')]({'where':{'UserId':_0xe1ca55['id'],'VoicePrefixId':_0x43cb34[_0xacda('0x10c')]}},{'transaction':_0x5ca3f5});});return Promise['all'](_0x308729);});});})[_0xacda('0x11')](function(){for(var _0x3785d6=0x0;_0x3785d6<_0x153c2b[_0xacda('0x48')];_0x3785d6++){var _0x138dbb=_0x153c2b[_0x3785d6][_0xacda('0x10a')]('channel');var _0x4eee6e=_0x138dbb+_0xacda('0x9e');socket[_0xacda('0x27')](_0xacda('0x7b')+_0x138dbb+_0xacda('0xab'),{'UserId':_0x3ee307,['queueField']:_0x153c2b[_0x3785d6]['id']});}})[_0xacda('0x11')](respondWithStatusCode(_0x28cda4,null))[_0xacda('0x1a')](APIHandleError(_0x28cda4));};exports[_0xacda('0x113')]=function(_0x173b8d,_0x51e906){var _0x16ed08={};var _0x2a1633={};var _0x5a95f5;var _0x1c14a3;return db[_0xacda('0x37')][_0xacda('0x92')]({'where':{'id':_0x173b8d[_0xacda('0x4f')]['id']}})[_0xacda('0x11')](handleEntityNotFound(_0x51e906,null))[_0xacda('0x11')](function(_0x1dcc15){if(_0x1dcc15){_0x5a95f5=_0x1dcc15;_0x2a1633[_0xacda('0x50')]=_[_0xacda('0x52')](db[_0xacda('0x114')][_0xacda('0x38')]);_0x2a1633[_0xacda('0x3f')]=_['keys'](_0x173b8d['query']);_0x2a1633[_0xacda('0x53')]=_['intersection'](_0x2a1633[_0xacda('0x50')],_0x2a1633[_0xacda('0x3f')]);_0x16ed08[_0xacda('0x45')]=_['intersection'](_0x2a1633[_0xacda('0x50')],qs[_0xacda('0x55')](_0x173b8d['query']['fields']));_0x16ed08[_0xacda('0x45')]=_0x16ed08[_0xacda('0x45')][_0xacda('0x48')]?_0x16ed08[_0xacda('0x45')]:_0x2a1633['model'];_0x16ed08[_0xacda('0xc3')]=qs['sort'](_0x173b8d[_0xacda('0x3f')][_0xacda('0xc4')]);_0x16ed08[_0xacda('0x3e')]=qs[_0xacda('0x53')](_[_0xacda('0xce')](_0x173b8d[_0xacda('0x3f')],_0x2a1633['filters']));if(_0x173b8d[_0xacda('0x3f')][_0xacda('0x2f')]){_0x16ed08[_0xacda('0x3e')]=_[_0xacda('0x56')](_0x16ed08[_0xacda('0x3e')],{'$or':_[_0xacda('0x30')](_0x16ed08[_0xacda('0x45')],function(_0x2f8d0f){var _0x17b6b2={};_0x17b6b2[_0x2f8d0f]={'$like':'%'+_0x173b8d['query']['filter']+'%'};return _0x17b6b2;})});}_0x16ed08=_[_0xacda('0x56')]({},_0x16ed08,_0x173b8d['options']);return _0x5a95f5[_0xacda('0x113')](_0x16ed08);}})[_0xacda('0x11')](function(_0x4bc9d1){if(_0x4bc9d1){_0x1c14a3=_0x4bc9d1[_0xacda('0x48')];if(!_0x173b8d[_0xacda('0x3f')][_0xacda('0xc5')]('nolimit')){_0x16ed08[_0xacda('0x1e')]=qs['limit'](_0x173b8d[_0xacda('0x3f')][_0xacda('0x1e')]);_0x16ed08[_0xacda('0x20')]=qs[_0xacda('0x20')](_0x173b8d['query'][_0xacda('0x20')]);}return _0x5a95f5[_0xacda('0x113')](_0x16ed08);}})[_0xacda('0x11')](function(_0x35badc){if(_0x35badc){return _0x35badc?{'count':_0x1c14a3,'rows':_0x35badc}:null;}})[_0xacda('0x11')](respondWithResult(_0x51e906,null))[_0xacda('0x1a')](handleError(_0x51e906,null));};exports['getAgents']=function(_0x549fd5,_0x56f766){var _0x2145f8={};var _0x58c3f6={};var _0x23f000;return db[_0xacda('0x37')][_0xacda('0x92')]({'where':{'id':_0x549fd5[_0xacda('0x4f')]['id']}})[_0xacda('0x11')](handleEntityNotFound(_0x56f766,null))['then'](function(_0x453ebf){if(_0x453ebf){_0x23f000=_0x453ebf;_0x58c3f6['model']=_[_0xacda('0x52')](db[_0xacda('0x37')][_0xacda('0x38')]);_0x58c3f6['query']=_[_0xacda('0x52')](_0x549fd5[_0xacda('0x3f')]);_0x58c3f6[_0xacda('0x53')]=_[_0xacda('0x54')](_0x58c3f6[_0xacda('0x50')],_0x58c3f6['query']);_0x2145f8[_0xacda('0x45')]=_[_0xacda('0x54')](_0x58c3f6[_0xacda('0x50')],qs[_0xacda('0x55')](_0x549fd5[_0xacda('0x3f')]['fields']));_0x2145f8[_0xacda('0x45')]=_0x2145f8[_0xacda('0x45')][_0xacda('0x48')]?_0x2145f8[_0xacda('0x45')]:_0x58c3f6[_0xacda('0x50')];_0x2145f8[_0xacda('0xc3')]=qs[_0xacda('0xc4')](_0x549fd5['query']['sort']);_0x2145f8['where']=qs[_0xacda('0x53')](_[_0xacda('0xce')](_0x549fd5[_0xacda('0x3f')],_0x58c3f6[_0xacda('0x53')]));if(_0x549fd5[_0xacda('0x3f')][_0xacda('0x2f')]){_0x2145f8['where']=_[_0xacda('0x56')](_0x2145f8['where'],{'$or':_[_0xacda('0x30')](_0x2145f8[_0xacda('0x45')],function(_0x547624){var _0x525b89={};_0x525b89[_0x547624]={'$like':'%'+_0x549fd5[_0xacda('0x3f')][_0xacda('0x2f')]+'%'};return _0x525b89;})});}_0x2145f8[_0xacda('0x50')]=db[_0xacda('0x37')];_0x2145f8['as']='Agents';_0x2145f8=_[_0xacda('0x56')]({},_0x2145f8,_0x549fd5['options']);return _0x23f000[_0xacda('0xee')]({'include':[_0x2145f8]});}})[_0xacda('0x11')](function(_0x356fb3){if(_0x356fb3){var _0x14f958={},_0x2cd5cb=[];for(var _0x4eb7fc=0x0;_0x4eb7fc<_0x356fb3[_0xacda('0x48')];_0x4eb7fc+=0x1){for(var _0x452025=0x0,_0x4cc7a;_0x452025<_0x356fb3[_0x4eb7fc][_0xacda('0x2d')]['length'];_0x452025+=0x1){_0x4cc7a=_0x356fb3[_0x4eb7fc]['Agents'][_0x452025][_0xacda('0x2a')]({'plain':!![]});_0x14f958[_0x4cc7a['id']]=_0x4cc7a;}}_0x14f958=_[_0xacda('0x115')](_0x14f958);for(var _0x100b64=qs['offset'](_0x549fd5[_0xacda('0x3f')][_0xacda('0x20')]);_0x100b64<_0x14f958[_0xacda('0x48')]&&_0x2cd5cb[_0xacda('0x48')]=_0x3600c4){_0x250216=_0x3600c4;_0x2188cd=0xc8;}else{_0x2188cd=0xce;}_0x36c462['status'](_0x2188cd);return _0x36c462[_0xa9a9('0x26')](_0xa9a9('0x27'),_0x20bffb+'-'+_0x250216+'/'+_0x3600c4)[_0xa9a9('0x21')](_0x5a837d);}return null;};}function saveUpdates(_0x14c9a1){return function(_0x3f663b){if(_0x3f663b){return _0x3f663b['update'](_0x14c9a1)[_0xa9a9('0x28')](function(_0x21fa85){if(_0x21fa85[_0xa9a9('0x29')]===_0xa9a9('0x2a')){socket['emit'](_0xa9a9('0x2b')+_0x21fa85['id'],_0x21fa85);}return _0x21fa85;});}return null;};}function removeEntity(_0xbcc67b){return function(_0x4a0a7f){if(_0x4a0a7f){return _0x4a0a7f[_0xa9a9('0x2c')]()['then'](function(){var _0x3bcf06=_0x4a0a7f['get']({'plain':!![]});if(_0x3bcf06[_0xa9a9('0x29')]==='admin')return;var _0x2a8d45=[{'name':_0xa9a9('0x2d'),'value':_0xa9a9('0x2e'),'ignore':!![]},{'name':_0xa9a9('0x2f'),'value':_0xa9a9('0x2a'),'ignore':![]},{'name':_0xa9a9('0x30'),'value':_0xa9a9('0x31'),'ignore':![]}];var _0x21f6ab=_(_0x2a8d45)[_0xa9a9('0x32')](_0xa9a9('0x33'))[_0xa9a9('0x34')]('value')[_0xa9a9('0x35')]();if(_[_0xa9a9('0x36')](_0x21f6ab,_0x3bcf06['role'])){return;}var _0x499786=_[_0xa9a9('0x37')](_0x2a8d45,[_0xa9a9('0x35'),_0x3bcf06[_0xa9a9('0x29')]])['name'];return db['UserProfileResource'][_0xa9a9('0x2c')]({'where':{'type':_0x499786,'resourceId':_0x3bcf06['id']}})[_0xa9a9('0x28')](function(){return _0x4a0a7f;});})['then'](function(){_0xbcc67b['status'](0xcc)[_0xa9a9('0x20')]();});}};}function handleEntityNotFound(_0x2a3371){return function(_0xf72319){if(!_0xf72319){_0x2a3371[_0xa9a9('0x38')](0x194);}return _0xf72319;};}function handleError(_0x5ca24e,_0x432015){_0x432015=_0x432015||0x1f4;return function(_0x3dcb61){logger[_0xa9a9('0x1c')](_0x3dcb61[_0xa9a9('0x39')]);if(_0x3dcb61['name']){delete _0x3dcb61['name'];}_0x5ca24e[_0xa9a9('0x1f')](_0x432015)[_0xa9a9('0x3a')](_0x3dcb61);};}exports[_0xa9a9('0x3b')]=function(_0x35309c,_0x2dd27b){var _0x2cb3ac={},_0xecbb73={'count':0x0,'rows':[]};var _0xc24794=_(db[_0xa9a9('0x3c')][_0xa9a9('0x3d')])[_0xa9a9('0x34')](function(_0x4fd46b){return{'name':_0x4fd46b['fieldName'],'type':_0x4fd46b['type'][_0xa9a9('0x3e')]};})['filter'](function(_0x496776){return!_[_0xa9a9('0x36')](['password',_0xa9a9('0x3f')],_0x496776[_0xa9a9('0x40')]);})['value']();_0x2cb3ac=qs[_0xa9a9('0x41')](_0xc24794,_0x35309c);var _0x2e4445={'where':_0x2cb3ac[_0xa9a9('0x42')]};return db['User'][_0xa9a9('0x25')](_0x2e4445)[_0xa9a9('0x28')](function(_0x1f56bd){_0xecbb73[_0xa9a9('0x25')]=_0x1f56bd;if(_0x35309c[_0xa9a9('0x43')][_0xa9a9('0x44')]){_0x2cb3ac[_0xa9a9('0x45')]=[{'all':!![]}];}if(_0x35309c[_0xa9a9('0x43')][_0xa9a9('0x46')]===_0xa9a9('0x47')){_0x2cb3ac[_0xa9a9('0x45')]=[{'model':db['UserSetting'],'as':_0xa9a9('0x46')}];}if(!_['includes'](_0x2cb3ac[_0xa9a9('0x48')],'id')){_0x2cb3ac[_0xa9a9('0x48')][_0xa9a9('0x49')]('id');}return db[_0xa9a9('0x3c')][_0xa9a9('0x4a')](_0x2cb3ac);})[_0xa9a9('0x28')](function(_0x4981a5){_0xecbb73[_0xa9a9('0x4b')]=_0x4981a5;if(_0x35309c['query'][_0xa9a9('0x4c')]===_0xa9a9('0x47')){var _0x23f804=[];for(var _0x5a6fe5=0x0;_0x5a6fe5<_0xecbb73[_0xa9a9('0x4b')][_0xa9a9('0x4d')];_0x5a6fe5++){_0x23f804['push'](get_open_tabs(_0xa9a9('0x4e'),_0xecbb73[_0xa9a9('0x4b')][_0x5a6fe5]['dataValues']));_0x23f804[_0xa9a9('0x49')](get_open_tabs(_0xa9a9('0x4f'),_0xecbb73[_0xa9a9('0x4b')][_0x5a6fe5][_0xa9a9('0x50')]));_0x23f804[_0xa9a9('0x49')](get_open_tabs('fax',_0xecbb73[_0xa9a9('0x4b')][_0x5a6fe5]['dataValues']));_0x23f804[_0xa9a9('0x49')](get_open_tabs('mail',_0xecbb73[_0xa9a9('0x4b')][_0x5a6fe5][_0xa9a9('0x50')]));_0x23f804['push'](get_open_tabs('openchannel',_0xecbb73[_0xa9a9('0x4b')][_0x5a6fe5][_0xa9a9('0x50')]));_0x23f804[_0xa9a9('0x49')](get_open_tabs(_0xa9a9('0x51'),_0xecbb73[_0xa9a9('0x4b')][_0x5a6fe5]['dataValues']));}return Promise['all'](_0x23f804)[_0xa9a9('0x28')](function(){return _0xecbb73;});}else{return _0xecbb73;}})['then'](respondWithFilteredResult(_0x2dd27b,_0x2cb3ac))[_0xa9a9('0x52')](handleError(_0x2dd27b,null));};exports[_0xa9a9('0x53')]=function(_0x544ef0,_0x533534){var _0x495d57={'raw':![],'where':{'id':_0x544ef0[_0xa9a9('0x54')]['id']}},_0x24d8fe={};_0x24d8fe[_0xa9a9('0x55')]=_[_0xa9a9('0x56')](_[_0xa9a9('0x57')](db[_0xa9a9('0x3c')]['rawAttributes']),[_0xa9a9('0x58'),'salt']);_0x24d8fe[_0xa9a9('0x43')]=_[_0xa9a9('0x57')](_0x544ef0[_0xa9a9('0x43')]);_0x24d8fe['filters']=_[_0xa9a9('0x59')](_0x24d8fe[_0xa9a9('0x55')],_0x24d8fe[_0xa9a9('0x43')]);_0x495d57[_0xa9a9('0x48')]=_['intersection'](_0x24d8fe['model'],qs[_0xa9a9('0x5a')](_0x544ef0[_0xa9a9('0x43')][_0xa9a9('0x5a')]));_0x495d57[_0xa9a9('0x48')]=_0x495d57[_0xa9a9('0x48')][_0xa9a9('0x4d')]?_0x495d57[_0xa9a9('0x48')]:_0x24d8fe[_0xa9a9('0x55')];if(_0x544ef0[_0xa9a9('0x43')][_0xa9a9('0x44')]){_0x495d57[_0xa9a9('0x45')]=[{'all':!![]}];}if(_0x544ef0[_0xa9a9('0x43')][_0xa9a9('0x46')]===_0xa9a9('0x47')){_0x495d57[_0xa9a9('0x45')]=[{'model':db['UserSetting'],'as':_0xa9a9('0x46')}];}_0x495d57=_[_0xa9a9('0x5b')]({},_0x495d57,_0x544ef0['options']);if(!_['includes'](_0x495d57[_0xa9a9('0x48')],'id')){_0x495d57['attributes'][_0xa9a9('0x49')]('id');}return db[_0xa9a9('0x3c')][_0xa9a9('0x37')](_0x495d57)[_0xa9a9('0x28')](handleEntityNotFound(_0x533534,null))['then'](function(_0x4310a0){var _0x3d7276=[];values=_0x4310a0;if(_0x544ef0['query'][_0xa9a9('0x4c')]===_0xa9a9('0x47')){_0x3d7276['push'](get_open_tabs(_0xa9a9('0x4e'),_0x4310a0['dataValues']));_0x3d7276['push'](get_open_tabs(_0xa9a9('0x4f'),_0x4310a0['dataValues']));_0x3d7276[_0xa9a9('0x49')](get_open_tabs('openchannel',_0x4310a0[_0xa9a9('0x50')]));_0x3d7276[_0xa9a9('0x49')](get_open_tabs(_0xa9a9('0x51'),_0x4310a0[_0xa9a9('0x50')]));_0x3d7276[_0xa9a9('0x49')](get_open_tabs('fax',_0x4310a0[_0xa9a9('0x50')]));_0x3d7276[_0xa9a9('0x49')](get_open_tabs('mail',_0x4310a0[_0xa9a9('0x50')]));return Promise['all'](_0x3d7276);}else{return values;}})['then'](function(){return values;})['then'](respondWithResult(_0x533534,null))[_0xa9a9('0x52')](handleError(_0x533534,null));};exports[_0xa9a9('0x5c')]=function(_0x6fdef5,_0x1f095d){if(_0x6fdef5[_0xa9a9('0x5d')]['id']){delete _0x6fdef5[_0xa9a9('0x5d')]['id'];}delete _0x6fdef5[_0xa9a9('0x5d')]['role'];return db[_0xa9a9('0x3c')][_0xa9a9('0x37')]({'where':{'id':_0x6fdef5[_0xa9a9('0x54')]['id']}})[_0xa9a9('0x28')](handleEntityNotFound(_0x1f095d,null))[_0xa9a9('0x28')](saveUpdates(_0x6fdef5[_0xa9a9('0x5d')],null))[_0xa9a9('0x28')](respondWithResult(_0x1f095d,null))[_0xa9a9('0x52')](handleError(_0x1f095d,null));};exports['describe']=function(_0x15e4ec,_0xa11b17){return db['User'][_0xa9a9('0x5e')]()[_0xa9a9('0x28')](respondWithResult(_0xa11b17,null))[_0xa9a9('0x52')](handleError(_0xa11b17,null));};exports[_0xa9a9('0x5f')]=function(_0x17c05b,_0x13b36b){return db['User'][_0xa9a9('0x37')]({'where':{'id':_0x17c05b[_0xa9a9('0x54')]['id']}})[_0xa9a9('0x28')](handleEntityNotFound(_0x13b36b,null))[_0xa9a9('0x28')](function(_0x1c7edb){if(_0x1c7edb){return _0x1c7edb[_0xa9a9('0x5f')](_0x17c05b[_0xa9a9('0x5d')][_0xa9a9('0x60')],_[_0xa9a9('0x61')](_0x17c05b[_0xa9a9('0x5d')],[_0xa9a9('0x60'),'id'])||{});}})[_0xa9a9('0x28')](respondWithResult(_0x13b36b,null))[_0xa9a9('0x52')](handleError(_0x13b36b,null));};function validateUser(_0x377b77){return new Promise(function(_0x1046b6,_0x4b6110){if(_0x377b77[_0xa9a9('0x62')])return _0x1046b6(_0x377b77);return db[_0xa9a9('0x63')][_0xa9a9('0x64')](0x1)[_0xa9a9('0x28')](function(_0x23e868){if(_0x23e868[_0xa9a9('0x65')])authService[_0xa9a9('0x66')](_0x377b77['password']);db[_0xa9a9('0x3c')][_0xa9a9('0x67')](_0xa9a9('0x62'))['then'](function(_0x2a4d12){if(_['isNil'](_0x2a4d12)){_0x377b77[_0xa9a9('0x62')]=_0x23e868[_0xa9a9('0x68')]||0x1;return;}if(_['isNil'](_0x23e868['min_internal'])||_0x23e868[_0xa9a9('0x68')]===_0x2a4d12){_0x377b77[_0xa9a9('0x62')]=_0x2a4d12+0x1;return;}if(_0x23e868[_0xa9a9('0x68')]>_0x2a4d12){_0x377b77[_0xa9a9('0x62')]=_0x23e868[_0xa9a9('0x68')];return;}return db[_0xa9a9('0x69')][_0xa9a9('0x43')](_0xa9a9('0x6a'),{'type':db[_0xa9a9('0x69')]['QueryTypes'][_0xa9a9('0x6b')]})[_0xa9a9('0x28')](function(_0x4fe9e3){if(_0x4fe9e3&&_0x4fe9e3['length']){for(var _0x351b77=0x0,_0xaaf2d9=_0x4fe9e3[_0xa9a9('0x4d')];_0x351b77<_0xaaf2d9&&_[_0xa9a9('0x6c')](_0x377b77['internal']);_0x351b77++){if(_0x23e868[_0xa9a9('0x68')]<=_0x4fe9e3[_0x351b77]['from']){_0x377b77['internal']=_0x4fe9e3[_0x351b77][_0xa9a9('0x6d')];}else if(_0x23e868[_0xa9a9('0x68')]>_0x4fe9e3[_0x351b77][_0xa9a9('0x6d')]&&_0x23e868[_0xa9a9('0x68')]<=_0x4fe9e3[_0x351b77]['to']){_0x377b77['internal']=_0x23e868[_0xa9a9('0x68')];}}}if(_[_0xa9a9('0x6c')](_0x377b77['internal'])){_0x377b77[_0xa9a9('0x62')]=_0x2a4d12+0x1;}return _0x1046b6(_0x377b77);});});})[_0xa9a9('0x52')](function(_0x243612){_0x4b6110(_0x243612);});});}function updateUser(_0x23da56){return new Promise(function(_0x12f9cd,_0x316fef){try{if(_0x23da56[_0xa9a9('0x6e')]){_0x23da56[_0xa9a9('0x6f')]=_0x23da56[_0xa9a9('0x62')];_0x23da56[_0xa9a9('0x70')]={'mailbox':_0x23da56['internal'],'password':_0x23da56['password'],'fullname':_0x23da56[_0xa9a9('0x71')],'email':_0x23da56[_0xa9a9('0x72')]};}if(_0x23da56[_0xa9a9('0x29')]==='agent'){if(!_0x23da56[_0xa9a9('0x73')])_0x23da56[_0xa9a9('0x73')]=[_0xa9a9('0x74'),_0xa9a9('0x75'),'103',_0xa9a9('0x76'),'110',_0xa9a9('0x77'),_0xa9a9('0x78'),_0xa9a9('0x79'),_0xa9a9('0x7a'),'108',_0xa9a9('0x7b'),_0xa9a9('0x7c'),_0xa9a9('0x7d'),_0xa9a9('0x7e'),_0xa9a9('0x7f')];}_0x12f9cd(_0x23da56);}catch(_0x39a5c3){_0x316fef(_0x39a5c3);}});}exports[_0xa9a9('0x80')]=function(_0x485dfa,_0x3a065f){if(_0x485dfa[_0xa9a9('0x2e')][_0xa9a9('0x29')]==='agent')throw new Error(_0xa9a9('0x81'));if(_0x485dfa[_0xa9a9('0x5d')][_0xa9a9('0x29')]===_0xa9a9('0x2e')&&_0x485dfa[_0xa9a9('0x2e')][_0xa9a9('0x29')]!=='admin'){throw new Error(_0xa9a9('0x82'));}if(_0x485dfa[_0xa9a9('0x5d')][_0xa9a9('0x29')]===_0xa9a9('0x83')&&_0x485dfa['user'][_0xa9a9('0x29')]!==_0xa9a9('0x83')){throw new Error(_0xa9a9('0x84'));}return licenseUtil['checkUserLimits']([_0x485dfa[_0xa9a9('0x5d')]])[_0xa9a9('0x28')](function(){return validateUser(_0x485dfa['body']);})[_0xa9a9('0x28')](function(_0xbe944f){return updateUser(_0xbe944f)[_0xa9a9('0x28')](function(_0x2a03e5){if(_0x2a03e5[_0xa9a9('0x29')]===_0xa9a9('0x83')){_0x2a03e5[_0xa9a9('0x85')]=_0x485dfa[_0xa9a9('0x2e')][_0xa9a9('0x85')];delete _0x2a03e5['userProfileId'];}return _0x2a03e5;});})['then'](function(_0x3a03fd){return db[_0xa9a9('0x3c')][_0xa9a9('0x80')](_0x3a03fd,{'include':[{'model':db[_0xa9a9('0x70')],'as':_0xa9a9('0x70')}]});})[_0xa9a9('0x28')](function(_0x3899d3){if(_0x485dfa[_0xa9a9('0x5d')][_0xa9a9('0x29')]===_0xa9a9('0x2e'))return _0x3899d3;if(_0x485dfa[_0xa9a9('0x2e')][_0xa9a9('0x29')]!==_0xa9a9('0x2e'))return _0x3899d3;return db[_0xa9a9('0x86')]['find']({'where':{'name':_0x3899d3['role']===_0xa9a9('0x2a')?_0xa9a9('0x2f'):_0xa9a9('0x30'),'userProfileId':_0x485dfa[_0xa9a9('0x2e')]['userProfileId']},'raw':!![]})[_0xa9a9('0x28')](function(_0x343ae6){if(!_0x343ae6||_0x343ae6[_0xa9a9('0x87')]!=0x0)return _0x3899d3;return db[_0xa9a9('0x88')][_0xa9a9('0x80')]({'name':_0x3899d3['name'],'resourceId':_0x3899d3['id'],'type':_0x343ae6['name'],'sectionId':_0x343ae6['id']},{})[_0xa9a9('0x28')](function(){return _0x3899d3;});})[_0xa9a9('0x52')](function(_0x21d35f){logger['error'](_0xa9a9('0x89'),_0x21d35f);throw _0x21d35f;});})[_0xa9a9('0x28')](respondWithResult(_0x3a065f,0xc9))[_0xa9a9('0x52')](handleError(_0x3a065f,null));};exports[_0xa9a9('0x8a')]=function(_0x2bf412,_0x452b5f){var _0x3efeef=_0x2bf412[_0xa9a9('0x5d')];var _0x26d3cf=[];if(_0x2bf412['user']['role']===_0xa9a9('0x2a'))throw new Error(_0xa9a9('0x81'));if(_[_0xa9a9('0x8b')](_0x3efeef,[_0xa9a9('0x29'),'user'])&&_0x2bf412['user'][_0xa9a9('0x29')]!==_0xa9a9('0x83')){throw new Error(_0xa9a9('0x82'));}if(_[_0xa9a9('0x8b')](_0x3efeef,[_0xa9a9('0x29'),_0xa9a9('0x83')])&&_0x2bf412[_0xa9a9('0x2e')][_0xa9a9('0x29')]!==_0xa9a9('0x83')){throw new Error(_0xa9a9('0x8c'));}return licenseUtil[_0xa9a9('0x8d')](_0x3efeef)[_0xa9a9('0x28')](function(){return validateUser(_0x3efeef[0x0]);})[_0xa9a9('0x28')](function(){for(var _0x2d689d=0x1;_0x2d689d<_0x3efeef[_0xa9a9('0x4d')];_0x2d689d++){var _0x9ac30e=_0x3efeef[_0x2d689d-0x1][_0xa9a9('0x62')];if(!_0x3efeef[_0x2d689d][_0xa9a9('0x62')])_0x3efeef[_0x2d689d][_0xa9a9('0x62')]=_0x9ac30e+0x1;_0x26d3cf[_0xa9a9('0x49')](validateUser(_0x3efeef[_0x2d689d]));}return Promise['all'](_0x26d3cf);})[_0xa9a9('0x28')](function(){_0x26d3cf=[];for(var _0x6124f6=0x0;_0x6124f6<_0x3efeef[_0xa9a9('0x4d')];_0x6124f6++){_0x26d3cf['push'](updateUser(_0x3efeef[_0x6124f6]));}return Promise[_0xa9a9('0x8e')](_0x26d3cf);})['then'](function(){_0x26d3cf=_0x3efeef[_0xa9a9('0x34')](function(_0x19aa9f){return db[_0xa9a9('0x3c')][_0xa9a9('0x80')](_0x19aa9f,{'include':[{'model':db[_0xa9a9('0x70')],'as':'VoiceMail'}]})[_0xa9a9('0x28')](function(_0x539752){_0x19aa9f['id']=_0x539752['id'];return _0x19aa9f;});});return Promise['all'](_0x26d3cf);})[_0xa9a9('0x28')](function(_0x8f8b27){if(_0x2bf412[_0xa9a9('0x5d')][_0xa9a9('0x29')]===_0xa9a9('0x2e'))return _0x8f8b27;if(_0x2bf412[_0xa9a9('0x2e')][_0xa9a9('0x29')]!==_0xa9a9('0x2e'))return _0x8f8b27;var _0x5b04fc=_[_0xa9a9('0x8b')](_0x8f8b27,function(_0x8b7010){return _0x8b7010[_0xa9a9('0x29')]===_0xa9a9('0x2a')||_0x8b7010[_0xa9a9('0x29')]===_0xa9a9('0x31');});if(!_0x5b04fc)return _0x8f8b27;return db[_0xa9a9('0x86')][_0xa9a9('0x4a')]({'where':{'name':{'$or':['Agents',_0xa9a9('0x30')]},'userProfileId':_0x2bf412[_0xa9a9('0x2e')][_0xa9a9('0x8f')]},'raw':!![]})[_0xa9a9('0x28')](function(_0x418381){if(_[_0xa9a9('0x90')](_0x418381)||!_[_0xa9a9('0x8b')](_0x418381,[_0xa9a9('0x87'),0x0]))return _0x8f8b27;_0x26d3cf=[];var _0x46ce32=_(_0x418381)[_0xa9a9('0x34')](function(_0x42b244){if(_0x42b244['autoAssociation']===0x1)return;return _0x42b244[_0xa9a9('0x40')]===_0xa9a9('0x2f')?_0xa9a9('0x2a'):_0xa9a9('0x31');})[_0xa9a9('0x91')]()[_0xa9a9('0x35')]();for(var _0x48124d=0x0;_0x48124d<_0x8f8b27['length'];_0x48124d++){if(!_[_0xa9a9('0x36')](_0x46ce32,_0x8f8b27[_0x48124d][_0xa9a9('0x29')]))return;var _0x427e2b=_0x8f8b27[_0x48124d][_0xa9a9('0x29')]==='agent'?_0xa9a9('0x2f'):'Telephones';_0x26d3cf[_0xa9a9('0x49')](db['UserProfileResource']['create']({'name':_0x8f8b27[_0x48124d][_0xa9a9('0x40')],'resourceId':_0x8f8b27[_0x48124d]['id'],'type':_0x427e2b,'sectionId':_['find'](_0x418381,[_0xa9a9('0x40'),_0x427e2b])['id']},{}));}return Promise[_0xa9a9('0x8e')](_0x26d3cf);});})[_0xa9a9('0x28')](respondWithResult(_0x452b5f,0xc9))[_0xa9a9('0x52')](handleError(_0x452b5f,null));};exports['changePassword']=function(_0x16266f,_0x4abd6e){if(_0x16266f['body']['id']){delete _0x16266f[_0xa9a9('0x5d')]['id'];}return db[_0xa9a9('0x3c')][_0xa9a9('0x37')]({'where':{'id':_0x16266f[_0xa9a9('0x54')]['id']}})[_0xa9a9('0x28')](function(_0x21578c){if(!_0x21578c)return null;if(_0x21578c['id']===_0x16266f[_0xa9a9('0x2e')]['id']){if(!_0x16266f[_0xa9a9('0x5d')]['oldPassword']||!_0x16266f['body'][_0xa9a9('0x92')]){throw new db[(_0xa9a9('0x93'))][(_0xa9a9('0x94'))](_0xa9a9('0x95'));}if(!_0x21578c[_0xa9a9('0x96')](_0x16266f['body'][_0xa9a9('0x97')])){throw new db[(_0xa9a9('0x93'))][(_0xa9a9('0x94'))](_0xa9a9('0x98'));}if(_0x16266f[_0xa9a9('0x5d')][_0xa9a9('0x97')]===_0x16266f[_0xa9a9('0x5d')][_0xa9a9('0x92')]){throw new db[(_0xa9a9('0x93'))][(_0xa9a9('0x94'))](_0xa9a9('0x99'));}}else if(_0x16266f[_0xa9a9('0x2e')]['role']===_0xa9a9('0x83')){if(!_0x16266f[_0xa9a9('0x5d')][_0xa9a9('0x92')]){throw new db[(_0xa9a9('0x93'))][(_0xa9a9('0x94'))](_0xa9a9('0x9a'));}}else if(_0x16266f[_0xa9a9('0x2e')][_0xa9a9('0x29')]===_0xa9a9('0x2e')){if(!_0x16266f['body'][_0xa9a9('0x92')]){throw new db[(_0xa9a9('0x93'))][(_0xa9a9('0x94'))](_0xa9a9('0x9a'));}if(_0x21578c[_0xa9a9('0x29')]!==_0xa9a9('0x2a')){throw new db[(_0xa9a9('0x93'))][(_0xa9a9('0x94'))](_0xa9a9('0x81'));}}else{throw new db[(_0xa9a9('0x93'))][(_0xa9a9('0x94'))](_0xa9a9('0x81'));}return _0x21578c;})[_0xa9a9('0x28')](handleEntityNotFound(_0x4abd6e,null))['then'](function(_0x277948){return db[_0xa9a9('0x63')][_0xa9a9('0x9b')]({'attributes':['id','securePassword',_0xa9a9('0x9c'),_0xa9a9('0x9d')]})[_0xa9a9('0x28')](function(_0x3211b9){if(_0x3211b9['securePassword'])authService[_0xa9a9('0x66')](_0x16266f[_0xa9a9('0x5d')][_0xa9a9('0x92')]);if(!_0x3211b9[_0xa9a9('0x9c')]||!_0x277948[_0xa9a9('0x9e')])return _0x277948;authService['validatePasswordHistory'](_0x16266f[_0xa9a9('0x5d')]['newPassword'],_0x277948[_0xa9a9('0x9e')],_0x3211b9[_0xa9a9('0x9d')]);return _0x277948;})[_0xa9a9('0x28')](saveUpdates({'password':_0x16266f['body'][_0xa9a9('0x92')],'passwordResetAt':_0x16266f['user']['id']==_0x16266f[_0xa9a9('0x54')]['id']?moment():null,'previousPasswords':authService[_0xa9a9('0x9f')](_0x16266f[_0xa9a9('0x5d')]['newPassword'],_0x277948[_0xa9a9('0x9e')])},null));})['then'](respondWithResult(_0x4abd6e,null))[_0xa9a9('0x52')](handleError(_0x4abd6e,null));};exports[_0xa9a9('0xa0')]=function(_0x5741b9,_0x368656){var _0x2a4407=_0x5741b9[_0xa9a9('0x5d')]['channel'];return db[_0xa9a9('0x3c')]['find']({'where':{'id':_0x5741b9['params']['id']},'attributes':['id','name',_0xa9a9('0x29'),_0xa9a9('0xa1'),'loginInPause','voicePause',_0xa9a9('0xa2')]})[_0xa9a9('0x28')](handleEntityNotFound(_0x368656,null))[_0xa9a9('0x28')](function(_0x3ba1a9){if(_0x3ba1a9){if(!utils[_0xa9a9('0xa3')](_0x2a4407)){throw new db[(_0xa9a9('0x93'))][(_0xa9a9('0x94'))](_0xa9a9('0xa4'));}return _0x3ba1a9['add'+_['capitalize'](_0x2a4407[_0xa9a9('0xa5')]())+_0xa9a9('0xa6')](_0x5741b9[_0xa9a9('0x5d')][_0xa9a9('0x60')],{'penalty':_0x5741b9[_0xa9a9('0x5d')]['penalty']||0x0})[_0xa9a9('0xa7')](function(_0xf3bcc6){for(var _0x16e0cd=0x0;_0x16e0cd<_0x5741b9[_0xa9a9('0x5d')][_0xa9a9('0x60')][_0xa9a9('0x4d')];_0x16e0cd+=0x1){var _0x4b9eee={'UserId':Number(_0x5741b9[_0xa9a9('0x54')]['id'])};_0x4b9eee[_[_0xa9a9('0xa8')](_0x2a4407[_0xa9a9('0xa5')]())+_0xa9a9('0xa9')]=Number(_0x5741b9[_0xa9a9('0x5d')][_0xa9a9('0x60')][_0x16e0cd]);socket[_0xa9a9('0xaa')]('user'+_[_0xa9a9('0xa8')](_0x2a4407[_0xa9a9('0xa5')]())+'Queue:save',_0x4b9eee);}return _0xf3bcc6;})['then'](function(){if(_0x2a4407===_0xa9a9('0xab')){return db[_0xa9a9('0xac')][_0xa9a9('0x4a')]({'where':{'id':_0x5741b9['body'][_0xa9a9('0x60')]||[]},'raw':!![],'attributes':['id',_0xa9a9('0x40')]});}})[_0xa9a9('0x28')](function(_0x4cdaca){var _0xfc7dd7=_0x3ba1a9[_0xa9a9('0xad')]({'plain':!![]});var _0x562262=[];if(_0x2a4407==='voice'&&_0xfc7dd7[_0xa9a9('0x29')]==='agent'&&_0xfc7dd7['online']){for(let _0x5092d9=0x0;_0x5092d9<_0x4cdaca[_0xa9a9('0x4d')];_0x5092d9+=0x1){_0x562262['push']({'membername':_0xfc7dd7['name'],'UserId':_0xfc7dd7['id'],'queue_name':_0x4cdaca[_0x5092d9][_0xa9a9('0x40')],'VoiceQueueId':_0x4cdaca[_0x5092d9]['id'],'interface':_[_0xa9a9('0x6c')](_0xfc7dd7[_0xa9a9('0xa2')])?util[_0xa9a9('0xae')](_0xa9a9('0xaf'),_0xfc7dd7['name']):_0xfc7dd7[_0xa9a9('0xa2')],'paused':_0xfc7dd7[_0xa9a9('0xb0')]||![],'penalty':_0x5741b9['body'][_0xa9a9('0xb1')]||0x0});}return Promise[_0xa9a9('0x8e')](_0x562262[_0xa9a9('0x34')](function(_0x3eaf81){return db[_0xa9a9('0xb2')]['upsert'](_0x3eaf81);}));}return _0x3ba1a9;});}})['then'](respondWithStatusCode(_0x368656,null))['catch'](handleError(_0x368656,null));};exports[_0xa9a9('0xb3')]=function(_0x510052,_0x148537){var _0x179225,_0x21ff98;return db[_0xa9a9('0x3c')][_0xa9a9('0x37')]({'where':{'id':_0x510052[_0xa9a9('0x54')]['id']},'attributes':['id','name',_0xa9a9('0x29')]})[_0xa9a9('0x28')](handleEntityNotFound(_0x148537,null))['then'](function(_0x2089c5){if(_0x2089c5){_0x179225=_0x2089c5;if(!_0x510052[_0xa9a9('0x43')][_0xa9a9('0xb4')]||!utils['isValidChannel'](_0x510052['query'][_0xa9a9('0xb4')])){throw new db[(_0xa9a9('0x93'))][(_0xa9a9('0x94'))](_0xa9a9('0xa4'));}return _0x2089c5['remove'+_[_0xa9a9('0xa8')](_0x510052[_0xa9a9('0x43')][_0xa9a9('0xb4')]['toLowerCase']())+_0xa9a9('0xa6')](_0x510052[_0xa9a9('0x43')][_0xa9a9('0x60')]);}})[_0xa9a9('0x28')](function(_0x3b3a07){if(_[_0xa9a9('0xb5')](_0x510052[_0xa9a9('0x43')]['ids'])){for(var _0x5862aa=0x0;_0x5862aa<_0x510052[_0xa9a9('0x43')][_0xa9a9('0x60')][_0xa9a9('0x4d')];_0x5862aa+=0x1){_0x21ff98={'UserId':Number(_0x510052[_0xa9a9('0x54')]['id'])};_0x21ff98[_['capitalize'](_0x510052[_0xa9a9('0x43')][_0xa9a9('0xb4')][_0xa9a9('0xa5')]())+_0xa9a9('0xa9')]=Number(_0x510052[_0xa9a9('0x43')][_0xa9a9('0x60')][_0x5862aa]);socket['emit'](_0xa9a9('0x2e')+_[_0xa9a9('0xa8')](_0x510052[_0xa9a9('0x43')][_0xa9a9('0xb4')][_0xa9a9('0xa5')]())+_0xa9a9('0xb6'),_0x21ff98);}}else{_0x21ff98={'UserId':Number(_0x510052['params']['id'])};_0x21ff98[_[_0xa9a9('0xa8')](_0x510052[_0xa9a9('0x43')]['channel'][_0xa9a9('0xa5')]())+_0xa9a9('0xa9')]=Number(_0x510052[_0xa9a9('0x43')][_0xa9a9('0x60')]);socket[_0xa9a9('0xaa')](_0xa9a9('0x2e')+_[_0xa9a9('0xa8')](_0x510052['query'][_0xa9a9('0xb4')][_0xa9a9('0xa5')]())+_0xa9a9('0xb6'),_0x21ff98);}return _0x3b3a07;})[_0xa9a9('0x28')](function(){if(_0x510052['query'][_0xa9a9('0xb4')]===_0xa9a9('0xab')){return db[_0xa9a9('0xb2')]['destroy']({'where':{'UserId':_0x510052[_0xa9a9('0x54')]['id'],'VoiceQueueId':_0x510052[_0xa9a9('0x43')][_0xa9a9('0x60')]},'individualHooks':!![]})[_0xa9a9('0x28')](function(){return _0x179225;});}return _0x179225;})['then'](respondWithStatusCode(_0x148537,null))['catch'](handleError(_0x148537,null));};exports[_0xa9a9('0xb7')]=function(_0x542a39,_0x136d15){_0x542a39['body'][_0xa9a9('0xb8')]=_0x542a39[_0xa9a9('0xb9')]['filename'];return db[_0xa9a9('0x3c')]['find']({'where':{'id':_0x542a39['params']['id']}})[_0xa9a9('0x28')](handleEntityNotFound(_0x136d15,null))[_0xa9a9('0x28')](saveUpdates(_0x542a39[_0xa9a9('0x5d')],null))[_0xa9a9('0x28')](respondWithResult(_0x136d15,null))[_0xa9a9('0x52')](handleError(_0x136d15,null));};exports[_0xa9a9('0xba')]=function(_0x283754,_0x58d793){var _0x303171=path['join'](config[_0xa9a9('0xbb')],'server/files/images/logos/default_profile.png');return db[_0xa9a9('0x3c')]['find']({'where':{'id':_0x283754['params']['id']},'attributes':['id',_0xa9a9('0xb8')],'raw':!![]})[_0xa9a9('0x28')](handleEntityNotFound(_0x58d793,null))['then'](function(_0x5a9644){if(_0x5a9644){if(_['isNil'](_0x5a9644['userpic'])){return _0x58d793[_0xa9a9('0xbc')](_0x303171);}else{if(!fs[_0xa9a9('0xbd')](path[_0xa9a9('0xbe')](config['root'],'server/files/images/',_0x5a9644[_0xa9a9('0xb8')]))){return _0x58d793[_0xa9a9('0xbc')](_0x303171);}return _0x58d793[_0xa9a9('0xbc')](path[_0xa9a9('0xbe')](config[_0xa9a9('0xbb')],'server/files/images/',_0x5a9644[_0xa9a9('0xb8')]));}}})['catch'](handleError(_0x58d793,null));};exports[_0xa9a9('0xbf')]=function(_0x223959,_0x2c9d14){return db['User']['find']({'where':{'id':_0x223959[_0xa9a9('0x54')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x2c9d14,null))[_0xa9a9('0x28')](function(_0x23c9c8){var _0x5d5105=[];values=_0x23c9c8[_0xa9a9('0x50')];_0x5d5105['push'](get_open_tabs(_0xa9a9('0x4e'),_0x23c9c8[_0xa9a9('0x50')]));_0x5d5105[_0xa9a9('0x49')](get_open_tabs(_0xa9a9('0x4f'),_0x23c9c8[_0xa9a9('0x50')]));_0x5d5105[_0xa9a9('0x49')](get_open_tabs('openchannel',_0x23c9c8[_0xa9a9('0x50')]));_0x5d5105[_0xa9a9('0x49')](get_open_tabs(_0xa9a9('0x51'),_0x23c9c8[_0xa9a9('0x50')]));_0x5d5105['push'](get_open_tabs(_0xa9a9('0xc0'),_0x23c9c8[_0xa9a9('0x50')]));_0x5d5105['push'](get_open_tabs(_0xa9a9('0xc1'),_0x23c9c8['dataValues']));return Promise[_0xa9a9('0x8e')](_0x5d5105);})['then'](function(_0x2739d8){if(_0x2739d8){var _0x5aef5c=_[_0xa9a9('0x34')](values[_0xa9a9('0xc2')],function(_0x80d27e){return{'channel':'CHAT','id':_0x80d27e['id'],'createdAt':_0x80d27e[_0xa9a9('0xc3')]};});var _0x92216e=_['map'](values['FaxOpenTabs'],function(_0x47a6e2){return{'channel':'FAX','id':_0x47a6e2['id'],'createdAt':_0x47a6e2[_0xa9a9('0xc3')]};});var _0x1be569=_['map'](values[_0xa9a9('0xc4')],function(_0x3945b2){return{'channel':_0xa9a9('0xc5'),'id':_0x3945b2['id'],'createdAt':_0x3945b2[_0xa9a9('0xc3')]};});var _0x4f5f27=_[_0xa9a9('0x34')](values[_0xa9a9('0xc6')],function(_0x339fff){return{'channel':_0xa9a9('0xc7'),'id':_0x339fff['id'],'createdAt':_0x339fff['createdAt']};});var _0x21b955=_[_0xa9a9('0x34')](values[_0xa9a9('0xc8')],function(_0x4bce18){return{'channel':_0xa9a9('0xc9'),'id':_0x4bce18['id'],'createdAt':_0x4bce18[_0xa9a9('0xc3')]};});var _0x16c8ab=_['map'](values['WhatsappOpenTabs'],function(_0x40cd54){return{'channel':'WHATSAPP','id':_0x40cd54['id'],'createdAt':_0x40cd54['createdAt']};});var _0x12c0fb=_[_0xa9a9('0xca')](_0x5aef5c,_0x92216e,_0x1be569,_0x4f5f27,_0x21b955,_0x16c8ab);var _0xe82b61={'count':_0x12c0fb[_0xa9a9('0x4d')],'rows':_0x12c0fb};return _0xe82b61;}else return null;})['then'](respondWithResult(_0x2c9d14,null))[_0xa9a9('0x52')](handleError(_0x2c9d14,null));};exports[_0xa9a9('0xcb')]=function(_0x19a11f,_0x417b24){var _0x13a1d0={};var _0x5812e4={};var _0x32f2f6;var _0x1614e5;return db[_0xa9a9('0x3c')]['findOne']({'where':{'id':_0x19a11f[_0xa9a9('0x54')]['id']}})[_0xa9a9('0x28')](handleEntityNotFound(_0x417b24,null))[_0xa9a9('0x28')](function(_0x472461){if(_0x472461){_0x32f2f6=_0x472461;_0x5812e4['model']=_['keys'](db[_0xa9a9('0xcc')][_0xa9a9('0x3d')]);_0x5812e4['query']=_[_0xa9a9('0x57')](_0x19a11f[_0xa9a9('0x43')]);_0x5812e4[_0xa9a9('0xcd')]=_[_0xa9a9('0x59')](_0x5812e4[_0xa9a9('0x55')],_0x5812e4[_0xa9a9('0x43')]);_0x13a1d0[_0xa9a9('0x48')]=_[_0xa9a9('0x59')](_0x5812e4['model'],qs[_0xa9a9('0x5a')](_0x19a11f['query'][_0xa9a9('0x5a')]));_0x13a1d0[_0xa9a9('0x48')]=_0x13a1d0[_0xa9a9('0x48')][_0xa9a9('0x4d')]?_0x13a1d0['attributes']:_0x5812e4[_0xa9a9('0x55')];_0x13a1d0[_0xa9a9('0xce')]=qs['sort'](_0x19a11f[_0xa9a9('0x43')]['sort']);_0x13a1d0[_0xa9a9('0x42')]=qs['filters'](_[_0xa9a9('0xcf')](_0x19a11f[_0xa9a9('0x43')],_0x5812e4[_0xa9a9('0xcd')]));if(_0x19a11f[_0xa9a9('0x43')][_0xa9a9('0x32')]){_0x13a1d0['where']=_[_0xa9a9('0x5b')](_0x13a1d0[_0xa9a9('0x42')],{'$or':_[_0xa9a9('0x34')](_0x13a1d0[_0xa9a9('0x48')],function(_0x19ab28){var _0x456c7c={};_0x456c7c[_0x19ab28]={'$like':'%'+_0x19a11f[_0xa9a9('0x43')][_0xa9a9('0x32')]+'%'};return _0x456c7c;})});}_0x13a1d0=_[_0xa9a9('0x5b')]({},_0x13a1d0,_0x19a11f[_0xa9a9('0xd0')]);return _0x32f2f6[_0xa9a9('0xcb')](_0x13a1d0);}})[_0xa9a9('0x28')](function(_0x2bc7a4){if(_0x2bc7a4){_0x1614e5=_0x2bc7a4[_0xa9a9('0x4d')];if(_0x19a11f[_0xa9a9('0x43')][_0xa9a9('0xd1')](_0xa9a9('0x44'))){_0x13a1d0[_0xa9a9('0x45')]=[{'model':db[_0xa9a9('0xd2')],'as':'List','required':![]},{'model':db[_0xa9a9('0xd3')],'as':_0xa9a9('0xd4'),'attributes':['id',_0xa9a9('0x40'),'color'],'where':_0x19a11f[_0xa9a9('0x43')][_0xa9a9('0xd5')]?{'id':_0x19a11f[_0xa9a9('0x43')][_0xa9a9('0xd5')]}:undefined,'required':_0x19a11f[_0xa9a9('0x43')]['tag']?!![]:![]}];}if(!_0x19a11f[_0xa9a9('0x43')][_0xa9a9('0xd1')](_0xa9a9('0xd6'))){_0x13a1d0[_0xa9a9('0x24')]=qs['limit'](_0x19a11f[_0xa9a9('0x43')][_0xa9a9('0x24')]);_0x13a1d0[_0xa9a9('0x22')]=qs['offset'](_0x19a11f[_0xa9a9('0x43')]['offset']);}return _0x32f2f6[_0xa9a9('0xcb')](_0x13a1d0);}})['then'](function(_0xd42a24){if(_0xd42a24){return _0xd42a24?{'count':_0x1614e5,'rows':_0xd42a24}:null;}})['then'](respondWithResult(_0x417b24,null))[_0xa9a9('0x52')](handleError(_0x417b24,null));};exports[_0xa9a9('0xd7')]=function(_0x31b457,_0x1f4512){var _0x49509e;var _0x594cd4={};var _0x1f7ce4;return db[_0xa9a9('0x3c')][_0xa9a9('0x9b')]({'where':{'id':_0x31b457[_0xa9a9('0x54')]['id']},'attributes':['id',_0xa9a9('0x40'),'role']})[_0xa9a9('0x28')](handleEntityNotFound(_0x1f4512,null))[_0xa9a9('0x28')](function(_0x435a37){if(!utils[_0xa9a9('0xa3')](_0x31b457['query']['channel'])){throw new db[(_0xa9a9('0x93'))][(_0xa9a9('0x94'))](_0xa9a9('0xa4'));}_0x49509e=_0x435a37;var _0x390923={};_0x390923['model']=_[_0xa9a9('0x57')](db[_[_0xa9a9('0xa8')](_0x31b457[_0xa9a9('0x43')][_0xa9a9('0xb4')])+_0xa9a9('0xd8')][_0xa9a9('0x3d')]);_0x390923[_0xa9a9('0x43')]=_[_0xa9a9('0x57')](_0x31b457[_0xa9a9('0x43')]);_0x390923['filters']=_['intersection'](_0x390923['model'],_0x390923[_0xa9a9('0x43')]);_0x594cd4[_0xa9a9('0x48')]=_[_0xa9a9('0x59')](_0x390923['model'],qs[_0xa9a9('0x5a')](_0x31b457[_0xa9a9('0x43')][_0xa9a9('0x5a')]));_0x594cd4[_0xa9a9('0x48')]=_0x594cd4[_0xa9a9('0x48')]['length']?_0x594cd4[_0xa9a9('0x48')]:_0x390923[_0xa9a9('0x55')];_0x594cd4[_0xa9a9('0xce')]=qs[_0xa9a9('0xd9')](_0x31b457[_0xa9a9('0x43')][_0xa9a9('0xd9')]);_0x594cd4[_0xa9a9('0x42')]=qs[_0xa9a9('0xcd')](_['pick'](_0x31b457[_0xa9a9('0x43')],_0x390923[_0xa9a9('0xcd')]));if(_0x31b457[_0xa9a9('0x43')][_0xa9a9('0x32')]){_0x594cd4[_0xa9a9('0x42')]=_[_0xa9a9('0x5b')](_0x594cd4[_0xa9a9('0x42')],{'$or':_[_0xa9a9('0x34')](_0x594cd4[_0xa9a9('0x48')],function(_0x9cb95f){var _0x227580={};_0x227580[_0x9cb95f]={'$like':'%'+_0x31b457[_0xa9a9('0x43')][_0xa9a9('0x32')]+'%'};return _0x227580;})});}_0x594cd4=_['merge']({},_0x594cd4,_0x31b457[_0xa9a9('0xd0')]);switch(_0x49509e[_0xa9a9('0x29')]){case _0xa9a9('0x83'):return db[_[_0xa9a9('0xa8')](_0x31b457[_0xa9a9('0x43')][_0xa9a9('0xb4')])+_0xa9a9('0xd8')][_0xa9a9('0x4a')](_0x594cd4);case _0xa9a9('0x2e'):case _0xa9a9('0x2a'):return _0x49509e[_0xa9a9('0xad')+_[_0xa9a9('0xa8')](_0x31b457[_0xa9a9('0x43')][_0xa9a9('0xb4')])+_0xa9a9('0xa6')](_0x594cd4);default:throw new db['Sequelize'][(_0xa9a9('0x94'))](_0xa9a9('0xda'));}})[_0xa9a9('0x28')](function(_0xf20835){_0x1f7ce4=_0xf20835['length'];if(!_0x31b457['query']['hasOwnProperty']('nolimit')){_0x594cd4['limit']=qs['limit'](_0x31b457[_0xa9a9('0x43')][_0xa9a9('0x24')]);_0x594cd4[_0xa9a9('0x22')]=qs[_0xa9a9('0x22')](_0x31b457[_0xa9a9('0x43')]['offset']);}switch(_0x49509e[_0xa9a9('0x29')]){case'admin':return db[_[_0xa9a9('0xa8')](_0x31b457[_0xa9a9('0x43')][_0xa9a9('0xb4')])+_0xa9a9('0xd8')][_0xa9a9('0x4a')](_0x594cd4);case _0xa9a9('0x2e'):case _0xa9a9('0x2a'):return _0x49509e['get'+_[_0xa9a9('0xa8')](_0x31b457[_0xa9a9('0x43')][_0xa9a9('0xb4')])+_0xa9a9('0xa6')](_0x594cd4);}})[_0xa9a9('0x28')](function(_0x2dac5f){return{'count':_0x1f7ce4,'rows':_0x2dac5f};})['then'](respondWithResult(_0x1f4512,null))[_0xa9a9('0x52')](handleError(_0x1f4512,null));};exports[_0xa9a9('0xdb')]=function(_0x597908,_0x35e8bc){var _0x275894={};var _0x2d61d1={};var _0x2e6b91;var _0x17c56e;return db[_0xa9a9('0x3c')]['findOne']({'where':{'id':_0x597908[_0xa9a9('0x54')]['id']}})[_0xa9a9('0x28')](handleEntityNotFound(_0x35e8bc,null))[_0xa9a9('0x28')](function(_0x2002b8){if(_0x2002b8){_0x2e6b91=_0x2002b8;_0x2d61d1[_0xa9a9('0x55')]=_[_0xa9a9('0x57')](db[_0xa9a9('0xb2')][_0xa9a9('0x3d')]);_0x2d61d1[_0xa9a9('0x43')]=_[_0xa9a9('0x57')](_0x597908[_0xa9a9('0x43')]);_0x2d61d1[_0xa9a9('0xcd')]=_[_0xa9a9('0x59')](_0x2d61d1[_0xa9a9('0x55')],_0x2d61d1[_0xa9a9('0x43')]);_0x275894['attributes']=_[_0xa9a9('0x59')](_0x2d61d1[_0xa9a9('0x55')],qs[_0xa9a9('0x5a')](_0x597908[_0xa9a9('0x43')]['fields']));_0x275894[_0xa9a9('0x48')]=_0x275894['attributes']['length']?_0x275894[_0xa9a9('0x48')]:_0x2d61d1[_0xa9a9('0x55')];_0x275894['order']=qs[_0xa9a9('0xd9')](_0x597908[_0xa9a9('0x43')][_0xa9a9('0xd9')]);_0x275894[_0xa9a9('0x42')]=qs[_0xa9a9('0xcd')](_[_0xa9a9('0xcf')](_0x597908[_0xa9a9('0x43')],_0x2d61d1[_0xa9a9('0xcd')]));if(_0x597908[_0xa9a9('0x43')][_0xa9a9('0x32')]){_0x275894[_0xa9a9('0x42')]=_[_0xa9a9('0x5b')](_0x275894[_0xa9a9('0x42')],{'$or':_['map'](_0x275894[_0xa9a9('0x48')],function(_0x338cff){var _0x5af1d3={};_0x5af1d3[_0x338cff]={'$like':'%'+_0x597908['query']['filter']+'%'};return _0x5af1d3;})});}_0x275894=_[_0xa9a9('0x5b')]({},_0x275894,_0x597908[_0xa9a9('0xd0')]);return _0x2e6b91[_0xa9a9('0xdb')](_0x275894);}})[_0xa9a9('0x28')](function(_0x5d9718){if(_0x5d9718){_0x17c56e=_0x5d9718[_0xa9a9('0x4d')];if(!_0x597908['query'][_0xa9a9('0xd1')](_0xa9a9('0xd6'))){_0x275894[_0xa9a9('0x24')]=qs[_0xa9a9('0x24')](_0x597908[_0xa9a9('0x43')][_0xa9a9('0x24')]);_0x275894['offset']=qs['offset'](_0x597908[_0xa9a9('0x43')]['offset']);}return _0x2e6b91[_0xa9a9('0xdb')](_0x275894);}})['then'](function(_0x3da89a){if(_0x3da89a){return _0x3da89a?{'count':_0x17c56e,'rows':_0x3da89a}:null;}})[_0xa9a9('0x28')](respondWithResult(_0x35e8bc,null))['catch'](handleError(_0x35e8bc,null));};exports[_0xa9a9('0xdc')]=function(_0x5d9055,_0x2900d0){var _0x5a232b={};var _0x10d60f={};var _0x1f66fe;var _0x40b700;return db['User']['findOne']({'where':{'id':_0x5d9055[_0xa9a9('0x54')]['id']}})[_0xa9a9('0x28')](handleEntityNotFound(_0x2900d0,null))[_0xa9a9('0x28')](function(_0x14e5cc){if(_0x14e5cc){_0x1f66fe=_0x14e5cc;_0x10d60f[_0xa9a9('0x55')]=_[_0xa9a9('0x57')](db[_0xa9a9('0xdd')][_0xa9a9('0x3d')]);_0x10d60f[_0xa9a9('0x43')]=_[_0xa9a9('0x57')](_0x5d9055[_0xa9a9('0x43')]);_0x10d60f['filters']=_['intersection'](_0x10d60f['model'],_0x10d60f['query']);_0x5a232b[_0xa9a9('0x48')]=_[_0xa9a9('0x59')](_0x10d60f[_0xa9a9('0x55')],qs[_0xa9a9('0x5a')](_0x5d9055['query'][_0xa9a9('0x5a')]));_0x5a232b[_0xa9a9('0x48')]=_0x5a232b[_0xa9a9('0x48')]['length']?_0x5a232b[_0xa9a9('0x48')]:_0x10d60f[_0xa9a9('0x55')];_0x5a232b[_0xa9a9('0xce')]=qs[_0xa9a9('0xd9')](_0x5d9055[_0xa9a9('0x43')][_0xa9a9('0xd9')]);_0x5a232b[_0xa9a9('0x42')]=qs[_0xa9a9('0xcd')](_['pick'](_0x5d9055['query'],_0x10d60f[_0xa9a9('0xcd')]));if(_0x5d9055[_0xa9a9('0x43')][_0xa9a9('0x32')]){_0x5a232b['where']=_[_0xa9a9('0x5b')](_0x5a232b[_0xa9a9('0x42')],{'$or':_[_0xa9a9('0x34')](_0x5a232b[_0xa9a9('0x48')],function(_0x881c44){var _0x26ff10={};_0x26ff10[_0x881c44]={'$like':'%'+_0x5d9055[_0xa9a9('0x43')][_0xa9a9('0x32')]+'%'};return _0x26ff10;})});}_0x5a232b=_[_0xa9a9('0x5b')]({},_0x5a232b,_0x5d9055['options']);return _0x1f66fe[_0xa9a9('0xdc')](_0x5a232b);}})['then'](function(_0x14d2f6){if(_0x14d2f6){_0x40b700=_0x14d2f6['length'];if(!_0x5d9055[_0xa9a9('0x43')]['hasOwnProperty'](_0xa9a9('0xd6'))){_0x5a232b[_0xa9a9('0x24')]=qs[_0xa9a9('0x24')](_0x5d9055[_0xa9a9('0x43')]['limit']);_0x5a232b[_0xa9a9('0x22')]=qs['offset'](_0x5d9055[_0xa9a9('0x43')][_0xa9a9('0x22')]);}return _0x1f66fe[_0xa9a9('0xdc')](_0x5a232b);}})['then'](function(_0x3d2622){if(_0x3d2622){return _0x3d2622?{'count':_0x40b700,'rows':_0x3d2622}:null;}})[_0xa9a9('0x28')](respondWithResult(_0x2900d0,null))[_0xa9a9('0x52')](handleError(_0x2900d0,null));};exports[_0xa9a9('0xde')]=function(_0x5742bb,_0x3fadb9){var _0x70095={'raw':!![],'where':{}};var _0x1bf04d={};var _0x4d71a7={'count':0x0,'rows':[]};return db[_0xa9a9('0x3c')][_0xa9a9('0x9b')]({'where':{'id':_0x5742bb['params']['id']}})['then'](handleEntityNotFound(_0x3fadb9,null))['then'](function(_0x112607){if(_0x112607){_0x1bf04d[_0xa9a9('0x55')]=_[_0xa9a9('0x57')](db[_0xa9a9('0xdf')][_0xa9a9('0x3d')]);_0x1bf04d[_0xa9a9('0x43')]=_[_0xa9a9('0x57')](_0x5742bb[_0xa9a9('0x43')]);_0x1bf04d[_0xa9a9('0xcd')]=_['intersection'](_0x1bf04d[_0xa9a9('0x55')],_0x1bf04d[_0xa9a9('0x43')]);_0x70095[_0xa9a9('0x48')]=_[_0xa9a9('0x59')](_0x1bf04d[_0xa9a9('0x55')],qs[_0xa9a9('0x5a')](_0x5742bb['query'][_0xa9a9('0x5a')]));_0x70095[_0xa9a9('0x48')]=_0x70095[_0xa9a9('0x48')][_0xa9a9('0x4d')]?_0x70095[_0xa9a9('0x48')]:_0x1bf04d[_0xa9a9('0x55')];if(!_0x5742bb[_0xa9a9('0x43')][_0xa9a9('0xd1')]('nolimit')){_0x70095[_0xa9a9('0x24')]=qs[_0xa9a9('0x24')](_0x5742bb['query'][_0xa9a9('0x24')]);_0x70095[_0xa9a9('0x22')]=qs[_0xa9a9('0x22')](_0x5742bb['query'][_0xa9a9('0x22')]);}_0x70095[_0xa9a9('0xce')]=qs[_0xa9a9('0xd9')](_0x5742bb[_0xa9a9('0x43')][_0xa9a9('0xd9')]);_0x70095[_0xa9a9('0x42')]=qs[_0xa9a9('0xcd')](_['pick'](_0x5742bb[_0xa9a9('0x43')],_0x1bf04d[_0xa9a9('0xcd')]));_0x70095['where'][_0xa9a9('0xe0')]=_0x112607['id'];if(_0x5742bb[_0xa9a9('0x43')][_0xa9a9('0x32')]){_0x70095[_0xa9a9('0x42')]=_[_0xa9a9('0x5b')](_0x70095[_0xa9a9('0x42')],{'$or':_['map'](_0x70095['attributes'],function(_0x4c25a3){var _0x390911={};_0x390911[_0x4c25a3]={'$like':'%'+_0x5742bb[_0xa9a9('0x43')]['filter']+'%'};return _0x390911;})});}_0x70095=_[_0xa9a9('0x5b')]({},_0x70095,_0x5742bb[_0xa9a9('0xd0')]);return db['VoiceRecording'][_0xa9a9('0x25')]({'where':_0x70095['where']})[_0xa9a9('0x28')](function(_0x397826){_0x4d71a7[_0xa9a9('0x25')]=_0x397826;if(_0x5742bb[_0xa9a9('0x43')][_0xa9a9('0x44')]){_0x70095['include']=[{'all':!![]}];}return db[_0xa9a9('0xdf')][_0xa9a9('0x4a')](_0x70095);})['then'](function(_0x215436){_0x4d71a7[_0xa9a9('0x4b')]=_0x215436;return _0x4d71a7;});}})[_0xa9a9('0x28')](respondWithFilteredResult(_0x3fadb9,_0x70095))[_0xa9a9('0x52')](handleError(_0x3fadb9,null));};exports[_0xa9a9('0xe1')]=function(_0x149a67,_0x3ea8d2){var _0x4e5fcc={'raw':!![],'where':{}};var _0x53065c={};var _0x46eee8={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x149a67[_0xa9a9('0x54')]['id']}})[_0xa9a9('0x28')](handleEntityNotFound(_0x3ea8d2,null))[_0xa9a9('0x28')](function(_0x5eab62){if(_0x5eab62){_0x53065c[_0xa9a9('0x55')]=_['keys'](db['ScreenRecording'][_0xa9a9('0x3d')]);_0x53065c['query']=_['keys'](_0x149a67[_0xa9a9('0x43')]);_0x53065c['filters']=_[_0xa9a9('0x59')](_0x53065c[_0xa9a9('0x55')],_0x53065c[_0xa9a9('0x43')]);_0x4e5fcc[_0xa9a9('0x48')]=_[_0xa9a9('0x59')](_0x53065c[_0xa9a9('0x55')],qs[_0xa9a9('0x5a')](_0x149a67[_0xa9a9('0x43')][_0xa9a9('0x5a')]));_0x4e5fcc['attributes']=_0x4e5fcc['attributes'][_0xa9a9('0x4d')]?_0x4e5fcc['attributes']:_0x53065c[_0xa9a9('0x55')];if(!_0x149a67[_0xa9a9('0x43')][_0xa9a9('0xd1')](_0xa9a9('0xd6'))){_0x4e5fcc[_0xa9a9('0x24')]=qs[_0xa9a9('0x24')](_0x149a67[_0xa9a9('0x43')][_0xa9a9('0x24')]);_0x4e5fcc[_0xa9a9('0x22')]=qs['offset'](_0x149a67[_0xa9a9('0x43')][_0xa9a9('0x22')]);}_0x4e5fcc[_0xa9a9('0xce')]=qs[_0xa9a9('0xd9')](_0x149a67[_0xa9a9('0x43')][_0xa9a9('0xd9')]);_0x4e5fcc['where']=qs['filters'](_['pick'](_0x149a67[_0xa9a9('0x43')],_0x53065c[_0xa9a9('0xcd')]));_0x4e5fcc[_0xa9a9('0x42')][_0xa9a9('0xe0')]=_0x5eab62['id'];if(_0x149a67['query'][_0xa9a9('0x32')]){_0x4e5fcc['where']=_[_0xa9a9('0x5b')](_0x4e5fcc['where'],{'$or':_[_0xa9a9('0x34')](_0x4e5fcc[_0xa9a9('0x48')],function(_0x1ad68a){var _0x5be9bf={};_0x5be9bf[_0x1ad68a]={'$like':'%'+_0x149a67['query'][_0xa9a9('0x32')]+'%'};return _0x5be9bf;})});}_0x4e5fcc=_[_0xa9a9('0x5b')]({},_0x4e5fcc,_0x149a67['options']);return db[_0xa9a9('0xe2')][_0xa9a9('0x25')]({'where':_0x4e5fcc[_0xa9a9('0x42')]})[_0xa9a9('0x28')](function(_0x10bf3b){_0x46eee8[_0xa9a9('0x25')]=_0x10bf3b;if(_0x149a67[_0xa9a9('0x43')][_0xa9a9('0x44')]){_0x4e5fcc[_0xa9a9('0x45')]=[{'all':!![]}];}return db[_0xa9a9('0xe2')][_0xa9a9('0x4a')](_0x4e5fcc);})[_0xa9a9('0x28')](function(_0x115070){_0x46eee8['rows']=_0x115070;return _0x46eee8;});}})['then'](respondWithFilteredResult(_0x3ea8d2,_0x4e5fcc))[_0xa9a9('0x52')](handleError(_0x3ea8d2,null));};exports[_0xa9a9('0xe3')]=function(_0x3f7f18,_0x2da4ce){var _0x250867={};var _0xaefc1c={};var _0x1d5ed7;var _0x9ab4e4;return db[_0xa9a9('0x3c')][_0xa9a9('0x9b')]({'where':{'id':_0x3f7f18[_0xa9a9('0x54')]['id']}})[_0xa9a9('0x28')](handleEntityNotFound(_0x2da4ce,null))[_0xa9a9('0x28')](function(_0x55af0d){if(_0x55af0d){_0x1d5ed7=_0x55af0d;_0xaefc1c[_0xa9a9('0x55')]=_[_0xa9a9('0x57')](db[_0xa9a9('0xe4')][_0xa9a9('0x3d')]);_0xaefc1c[_0xa9a9('0x43')]=_[_0xa9a9('0x57')](_0x3f7f18[_0xa9a9('0x43')]);_0xaefc1c[_0xa9a9('0xcd')]=_[_0xa9a9('0x59')](_0xaefc1c[_0xa9a9('0x55')],_0xaefc1c['query']);_0x250867[_0xa9a9('0x48')]=_['intersection'](_0xaefc1c['model'],qs[_0xa9a9('0x5a')](_0x3f7f18[_0xa9a9('0x43')]['fields']));_0x250867[_0xa9a9('0x48')]=_0x250867['attributes'][_0xa9a9('0x4d')]?_0x250867[_0xa9a9('0x48')]:_0xaefc1c['model'];_0x250867[_0xa9a9('0xce')]=qs[_0xa9a9('0xd9')](_0x3f7f18[_0xa9a9('0x43')][_0xa9a9('0xd9')]);_0x250867[_0xa9a9('0x42')]=qs['filters'](_[_0xa9a9('0xcf')](_0x3f7f18[_0xa9a9('0x43')],_0xaefc1c[_0xa9a9('0xcd')]));if(_0x3f7f18['query']['filter']){_0x250867[_0xa9a9('0x42')]=_[_0xa9a9('0x5b')](_0x250867['where'],{'$or':_[_0xa9a9('0x34')](_0x250867[_0xa9a9('0x48')],function(_0x4d4dbc){var _0x5bd273={};_0x5bd273[_0x4d4dbc]={'$like':'%'+_0x3f7f18[_0xa9a9('0x43')]['filter']+'%'};return _0x5bd273;})});}_0x250867=_['merge']({},_0x250867,_0x3f7f18[_0xa9a9('0xd0')]);return _0x1d5ed7[_0xa9a9('0xe3')](_0x250867);}})[_0xa9a9('0x28')](function(_0x5a6bc7){if(_0x5a6bc7){_0x9ab4e4=_0x5a6bc7[_0xa9a9('0x4d')];if(!_0x3f7f18[_0xa9a9('0x43')][_0xa9a9('0xd1')](_0xa9a9('0xd6'))){_0x250867[_0xa9a9('0x24')]=qs[_0xa9a9('0x24')](_0x3f7f18['query'][_0xa9a9('0x24')]);_0x250867[_0xa9a9('0x22')]=qs[_0xa9a9('0x22')](_0x3f7f18['query'][_0xa9a9('0x22')]);}return _0x1d5ed7[_0xa9a9('0xe3')](_0x250867);}})[_0xa9a9('0x28')](function(_0x193aae){if(_0x193aae){return _0x193aae?{'count':_0x9ab4e4,'rows':_0x193aae}:null;}})[_0xa9a9('0x28')](respondWithResult(_0x2da4ce,null))[_0xa9a9('0x52')](handleError(_0x2da4ce,null));};exports[_0xa9a9('0xe5')]=function(_0x1179a3,_0x33c79b){var _0x5ab56e={};var _0x56bb21={};var _0x1ad50c;var _0x3f1c07;return db[_0xa9a9('0x3c')][_0xa9a9('0x9b')]({'where':{'id':_0x1179a3[_0xa9a9('0x54')]['id']}})[_0xa9a9('0x28')](handleEntityNotFound(_0x33c79b,null))[_0xa9a9('0x28')](function(_0x330e04){if(_0x330e04){_0x1ad50c=_0x330e04;_0x56bb21[_0xa9a9('0x55')]=_[_0xa9a9('0x57')](db[_0xa9a9('0xe6')][_0xa9a9('0x3d')]);_0x56bb21[_0xa9a9('0x43')]=_[_0xa9a9('0x57')](_0x1179a3['query']);_0x56bb21[_0xa9a9('0xcd')]=_['intersection'](_0x56bb21[_0xa9a9('0x55')],_0x56bb21['query']);_0x5ab56e[_0xa9a9('0x48')]=_[_0xa9a9('0x59')](_0x56bb21[_0xa9a9('0x55')],qs[_0xa9a9('0x5a')](_0x1179a3['query'][_0xa9a9('0x5a')]));_0x5ab56e[_0xa9a9('0x48')]=_0x5ab56e[_0xa9a9('0x48')][_0xa9a9('0x4d')]?_0x5ab56e[_0xa9a9('0x48')]:_0x56bb21[_0xa9a9('0x55')];_0x5ab56e[_0xa9a9('0xce')]=qs[_0xa9a9('0xd9')](_0x1179a3['query'][_0xa9a9('0xd9')]);_0x5ab56e[_0xa9a9('0x42')]=qs['filters'](_[_0xa9a9('0xcf')](_0x1179a3[_0xa9a9('0x43')],_0x56bb21[_0xa9a9('0xcd')]));if(_0x1179a3[_0xa9a9('0x43')][_0xa9a9('0x32')]){_0x5ab56e['where']=_[_0xa9a9('0x5b')](_0x5ab56e['where'],{'$or':_[_0xa9a9('0x34')](_0x5ab56e['attributes'],function(_0x1020c2){var _0x4c568c={};_0x4c568c[_0x1020c2]={'$like':'%'+_0x1179a3['query'][_0xa9a9('0x32')]+'%'};return _0x4c568c;})});}_0x5ab56e=_[_0xa9a9('0x5b')]({},_0x5ab56e,_0x1179a3['options']);return _0x1ad50c['getOpenchannelInteractions'](_0x5ab56e);}})['then'](function(_0x951891){if(_0x951891){_0x3f1c07=_0x951891[_0xa9a9('0x4d')];if(!_0x1179a3[_0xa9a9('0x43')][_0xa9a9('0xd1')](_0xa9a9('0xd6'))){_0x5ab56e['limit']=qs[_0xa9a9('0x24')](_0x1179a3[_0xa9a9('0x43')][_0xa9a9('0x24')]);_0x5ab56e[_0xa9a9('0x22')]=qs[_0xa9a9('0x22')](_0x1179a3['query'][_0xa9a9('0x22')]);}return _0x1ad50c[_0xa9a9('0xe5')](_0x5ab56e);}})['then'](function(_0x4a97b1){if(_0x4a97b1){return _0x4a97b1?{'count':_0x3f1c07,'rows':_0x4a97b1}:null;}})[_0xa9a9('0x28')](respondWithResult(_0x33c79b,null))[_0xa9a9('0x52')](handleError(_0x33c79b,null));};exports[_0xa9a9('0xe7')]=function(_0x1c2536,_0x59d071){var _0xd98559={'raw':!![],'where':{}};var _0x41fa2b={};var _0x3c82f1={'count':0x0,'rows':[]};return db[_0xa9a9('0x3c')]['findOne']({'where':{'id':_0x1c2536['params']['id']}})['then'](handleEntityNotFound(_0x59d071,null))[_0xa9a9('0x28')](function(_0x257d39){if(_0x257d39){_0x41fa2b[_0xa9a9('0x55')]=_['keys'](db[_0xa9a9('0xe8')][_0xa9a9('0x3d')]);_0x41fa2b[_0xa9a9('0x43')]=_[_0xa9a9('0x57')](_0x1c2536[_0xa9a9('0x43')]);_0x41fa2b[_0xa9a9('0xcd')]=_[_0xa9a9('0x59')](_0x41fa2b[_0xa9a9('0x55')],_0x41fa2b[_0xa9a9('0x43')]);_0xd98559[_0xa9a9('0x48')]=_[_0xa9a9('0x59')](_0x41fa2b[_0xa9a9('0x55')],qs[_0xa9a9('0x5a')](_0x1c2536[_0xa9a9('0x43')][_0xa9a9('0x5a')]));_0xd98559[_0xa9a9('0x48')]=_0xd98559[_0xa9a9('0x48')][_0xa9a9('0x4d')]?_0xd98559[_0xa9a9('0x48')]:_0x41fa2b[_0xa9a9('0x55')];if(!_0x1c2536[_0xa9a9('0x43')][_0xa9a9('0xd1')](_0xa9a9('0xd6'))){_0xd98559[_0xa9a9('0x24')]=qs['limit'](_0x1c2536[_0xa9a9('0x43')][_0xa9a9('0x24')]);_0xd98559[_0xa9a9('0x22')]=qs['offset'](_0x1c2536['query'][_0xa9a9('0x22')]);}_0xd98559[_0xa9a9('0xce')]=qs[_0xa9a9('0xd9')](_0x1c2536[_0xa9a9('0x43')][_0xa9a9('0xd9')]);_0xd98559[_0xa9a9('0x42')]=qs[_0xa9a9('0xcd')](_[_0xa9a9('0xcf')](_0x1c2536[_0xa9a9('0x43')],_0x41fa2b[_0xa9a9('0xcd')]));_0xd98559[_0xa9a9('0x42')][_0xa9a9('0xe0')]=_0x257d39['id'];if(_0x1c2536[_0xa9a9('0x43')][_0xa9a9('0x32')]){_0xd98559[_0xa9a9('0x42')]=_['merge'](_0xd98559[_0xa9a9('0x42')],{'$or':_[_0xa9a9('0x34')](_0xd98559[_0xa9a9('0x48')],function(_0x80951a){var _0x28fc54={};_0x28fc54[_0x80951a]={'$like':'%'+_0x1c2536['query'][_0xa9a9('0x32')]+'%'};return _0x28fc54;})});}_0xd98559=_[_0xa9a9('0x5b')]({},_0xd98559,_0x1c2536[_0xa9a9('0xd0')]);return db[_0xa9a9('0xe8')][_0xa9a9('0x25')]({'where':_0xd98559[_0xa9a9('0x42')]})[_0xa9a9('0x28')](function(_0x2e0284){_0x3c82f1[_0xa9a9('0x25')]=_0x2e0284;if(_0x1c2536[_0xa9a9('0x43')][_0xa9a9('0x44')]){_0xd98559[_0xa9a9('0x45')]=[{'all':!![]}];}return db['MailInteraction'][_0xa9a9('0x4a')](_0xd98559);})[_0xa9a9('0x28')](function(_0x3ba486){_0x3c82f1[_0xa9a9('0x4b')]=_0x3ba486;return _0x3c82f1;});}})[_0xa9a9('0x28')](respondWithFilteredResult(_0x59d071,_0xd98559))[_0xa9a9('0x52')](handleError(_0x59d071,null));};exports[_0xa9a9('0xe9')]=function(_0x8104df,_0x1b3fe9){var _0x4637d5={};var _0x493ed8={};var _0x579a1c;var _0x570e40;return db[_0xa9a9('0x3c')][_0xa9a9('0x9b')]({'where':{'id':_0x8104df[_0xa9a9('0x54')]['id']}})[_0xa9a9('0x28')](handleEntityNotFound(_0x1b3fe9,null))[_0xa9a9('0x28')](function(_0x562e2a){if(_0x562e2a){_0x579a1c=_0x562e2a;_0x493ed8[_0xa9a9('0x55')]=_[_0xa9a9('0x57')](db['SmsInteraction'][_0xa9a9('0x3d')]);_0x493ed8['query']=_[_0xa9a9('0x57')](_0x8104df[_0xa9a9('0x43')]);_0x493ed8[_0xa9a9('0xcd')]=_[_0xa9a9('0x59')](_0x493ed8[_0xa9a9('0x55')],_0x493ed8['query']);_0x4637d5[_0xa9a9('0x48')]=_[_0xa9a9('0x59')](_0x493ed8[_0xa9a9('0x55')],qs[_0xa9a9('0x5a')](_0x8104df[_0xa9a9('0x43')][_0xa9a9('0x5a')]));_0x4637d5[_0xa9a9('0x48')]=_0x4637d5['attributes']['length']?_0x4637d5[_0xa9a9('0x48')]:_0x493ed8[_0xa9a9('0x55')];_0x4637d5[_0xa9a9('0xce')]=qs[_0xa9a9('0xd9')](_0x8104df[_0xa9a9('0x43')][_0xa9a9('0xd9')]);_0x4637d5[_0xa9a9('0x42')]=qs[_0xa9a9('0xcd')](_[_0xa9a9('0xcf')](_0x8104df['query'],_0x493ed8[_0xa9a9('0xcd')]));if(_0x8104df[_0xa9a9('0x43')]['filter']){_0x4637d5['where']=_[_0xa9a9('0x5b')](_0x4637d5[_0xa9a9('0x42')],{'$or':_[_0xa9a9('0x34')](_0x4637d5[_0xa9a9('0x48')],function(_0x40eec5){var _0x4f0094={};_0x4f0094[_0x40eec5]={'$like':'%'+_0x8104df[_0xa9a9('0x43')][_0xa9a9('0x32')]+'%'};return _0x4f0094;})});}_0x4637d5=_[_0xa9a9('0x5b')]({},_0x4637d5,_0x8104df['options']);return _0x579a1c['getSmsInteractions'](_0x4637d5);}})[_0xa9a9('0x28')](function(_0x4cb037){if(_0x4cb037){_0x570e40=_0x4cb037[_0xa9a9('0x4d')];if(!_0x8104df[_0xa9a9('0x43')][_0xa9a9('0xd1')](_0xa9a9('0xd6'))){_0x4637d5[_0xa9a9('0x24')]=qs[_0xa9a9('0x24')](_0x8104df['query'][_0xa9a9('0x24')]);_0x4637d5[_0xa9a9('0x22')]=qs[_0xa9a9('0x22')](_0x8104df['query'][_0xa9a9('0x22')]);}return _0x579a1c[_0xa9a9('0xe9')](_0x4637d5);}})['then'](function(_0x1a89e3){if(_0x1a89e3){return _0x1a89e3?{'count':_0x570e40,'rows':_0x1a89e3}:null;}})[_0xa9a9('0x28')](respondWithResult(_0x1b3fe9,null))[_0xa9a9('0x52')](handleError(_0x1b3fe9,null));};exports[_0xa9a9('0xea')]=function(_0x5f457b,_0x54cda2){var _0x2725d8={};var _0x20e7f8={};var _0x48152e;var _0x32dcbe;return db[_0xa9a9('0x3c')][_0xa9a9('0x9b')]({'where':{'id':_0x5f457b[_0xa9a9('0x54')]['id']}})['then'](handleEntityNotFound(_0x54cda2,null))['then'](function(_0x4024dc){if(_0x4024dc){_0x48152e=_0x4024dc;_0x20e7f8[_0xa9a9('0x55')]=_['keys'](db[_0xa9a9('0xeb')]['rawAttributes']);_0x20e7f8[_0xa9a9('0x43')]=_[_0xa9a9('0x57')](_0x5f457b['query']);_0x20e7f8[_0xa9a9('0xcd')]=_[_0xa9a9('0x59')](_0x20e7f8[_0xa9a9('0x55')],_0x20e7f8[_0xa9a9('0x43')]);_0x2725d8[_0xa9a9('0x48')]=_[_0xa9a9('0x59')](_0x20e7f8[_0xa9a9('0x55')],qs[_0xa9a9('0x5a')](_0x5f457b[_0xa9a9('0x43')]['fields']));_0x2725d8['attributes']=_0x2725d8['attributes'][_0xa9a9('0x4d')]?_0x2725d8['attributes']:_0x20e7f8['model'];_0x2725d8[_0xa9a9('0xce')]=qs[_0xa9a9('0xd9')](_0x5f457b[_0xa9a9('0x43')][_0xa9a9('0xd9')]);_0x2725d8[_0xa9a9('0x42')]=qs[_0xa9a9('0xcd')](_[_0xa9a9('0xcf')](_0x5f457b['query'],_0x20e7f8[_0xa9a9('0xcd')]));if(_0x5f457b['query'][_0xa9a9('0x32')]){_0x2725d8['where']=_[_0xa9a9('0x5b')](_0x2725d8[_0xa9a9('0x42')],{'$or':_[_0xa9a9('0x34')](_0x2725d8['attributes'],function(_0x573624){var _0x5446d5={};_0x5446d5[_0x573624]={'$like':'%'+_0x5f457b['query'][_0xa9a9('0x32')]+'%'};return _0x5446d5;})});}_0x2725d8=_[_0xa9a9('0x5b')]({},_0x2725d8,_0x5f457b['options']);return _0x48152e['getFaxInteractions'](_0x2725d8);}})[_0xa9a9('0x28')](function(_0x14fb0f){if(_0x14fb0f){_0x32dcbe=_0x14fb0f[_0xa9a9('0x4d')];if(!_0x5f457b[_0xa9a9('0x43')][_0xa9a9('0xd1')](_0xa9a9('0xd6'))){_0x2725d8[_0xa9a9('0x24')]=qs[_0xa9a9('0x24')](_0x5f457b[_0xa9a9('0x43')][_0xa9a9('0x24')]);_0x2725d8[_0xa9a9('0x22')]=qs['offset'](_0x5f457b['query'][_0xa9a9('0x22')]);}return _0x48152e[_0xa9a9('0xea')](_0x2725d8);}})[_0xa9a9('0x28')](function(_0x21dcff){if(_0x21dcff){return _0x21dcff?{'count':_0x32dcbe,'rows':_0x21dcff}:null;}})[_0xa9a9('0x28')](respondWithResult(_0x54cda2,null))[_0xa9a9('0x52')](handleError(_0x54cda2,null));};exports[_0xa9a9('0xec')]=function(_0x3ab540,_0x3e2e1c){var _0x3d5285={};var _0x3b98c0={};var _0x3a412a;var _0x2543f9;return db['User'][_0xa9a9('0x9b')]({'where':{'id':_0x3ab540[_0xa9a9('0x54')]['id']}})[_0xa9a9('0x28')](handleEntityNotFound(_0x3e2e1c,null))[_0xa9a9('0x28')](function(_0x49a4ef){if(_0x49a4ef){_0x3a412a=_0x49a4ef;_0x3b98c0[_0xa9a9('0x55')]=_[_0xa9a9('0x57')](db[_0xa9a9('0xed')][_0xa9a9('0x3d')]);_0x3b98c0['query']=_[_0xa9a9('0x57')](_0x3ab540[_0xa9a9('0x43')]);_0x3b98c0[_0xa9a9('0xcd')]=_[_0xa9a9('0x59')](_0x3b98c0['model'],_0x3b98c0[_0xa9a9('0x43')]);_0x3d5285['attributes']=_[_0xa9a9('0x59')](_0x3b98c0[_0xa9a9('0x55')],qs['fields'](_0x3ab540[_0xa9a9('0x43')][_0xa9a9('0x5a')]));_0x3d5285['attributes']=_0x3d5285[_0xa9a9('0x48')][_0xa9a9('0x4d')]?_0x3d5285[_0xa9a9('0x48')]:_0x3b98c0[_0xa9a9('0x55')];_0x3d5285[_0xa9a9('0xce')]=qs[_0xa9a9('0xd9')](_0x3ab540[_0xa9a9('0x43')][_0xa9a9('0xd9')]);_0x3d5285[_0xa9a9('0x42')]=qs['filters'](_['pick'](_0x3ab540[_0xa9a9('0x43')],_0x3b98c0[_0xa9a9('0xcd')]));if(_0x3ab540[_0xa9a9('0x43')]['filter']){_0x3d5285[_0xa9a9('0x42')]=_[_0xa9a9('0x5b')](_0x3d5285[_0xa9a9('0x42')],{'$or':_[_0xa9a9('0x34')](_0x3d5285[_0xa9a9('0x48')],function(_0x21584d){var _0x2a9d77={};_0x2a9d77[_0x21584d]={'$like':'%'+_0x3ab540[_0xa9a9('0x43')][_0xa9a9('0x32')]+'%'};return _0x2a9d77;})});}_0x3d5285=_[_0xa9a9('0x5b')]({},_0x3d5285,_0x3ab540['options']);return _0x3a412a[_0xa9a9('0xec')](_0x3d5285);}})[_0xa9a9('0x28')](function(_0x4e23ca){if(_0x4e23ca){_0x2543f9=_0x4e23ca['length'];if(!_0x3ab540['query']['hasOwnProperty'](_0xa9a9('0xd6'))){_0x3d5285['limit']=qs['limit'](_0x3ab540[_0xa9a9('0x43')][_0xa9a9('0x24')]);_0x3d5285[_0xa9a9('0x22')]=qs[_0xa9a9('0x22')](_0x3ab540[_0xa9a9('0x43')][_0xa9a9('0x22')]);}return _0x3a412a['getWhatsappInteractions'](_0x3d5285);}})[_0xa9a9('0x28')](function(_0xf56f47){if(_0xf56f47){return _0xf56f47?{'count':_0x2543f9,'rows':_0xf56f47}:null;}})[_0xa9a9('0x28')](respondWithResult(_0x3e2e1c,null))[_0xa9a9('0x52')](handleError(_0x3e2e1c,null));};exports[_0xa9a9('0xee')]=function(_0xf160a7,_0xe0ccb,_0x2bc737){var _0x4e7d21;var _0x134eed;var _0x177f56;var _0x3df8a6=!_[_0xa9a9('0x6c')](_0xf160a7[_0xa9a9('0x54')]['id'])?_0xf160a7[_0xa9a9('0x54')]['id']:!_['isNil'](_0xf160a7[_0xa9a9('0x2e')]['id'])?_0xf160a7[_0xa9a9('0x2e')]['id']:null;return db[_0xa9a9('0x3c')][_0xa9a9('0x37')]({'where':{'id':_0x3df8a6,'role':{'$or':[_0xa9a9('0x83'),_0xa9a9('0x2e'),_0xa9a9('0x2a')]}},'attributes':['id',_0xa9a9('0x40'),_0xa9a9('0xef'),_0xa9a9('0xf0'),_0xa9a9('0x29'),_0xa9a9('0x62'),_0xa9a9('0xf1')]})[_0xa9a9('0x28')](function(_0x3fd728){if(_0x3fd728){if(_0x3fd728[_0xa9a9('0x29')]==='agent'){_0x4e7d21=_0x3fd728;if(_0xf160a7[_0xa9a9('0x5d')][_0xa9a9('0xa2')]){_0x177f56=util[_0xa9a9('0xae')](_0xa9a9('0xf2'),_0x4e7d21[_0xf160a7['body']['interface']]);}else if(_0xf160a7[_0xa9a9('0x5d')][_0xa9a9('0xf3')]){_0x177f56=util[_0xa9a9('0xae')](_0xa9a9('0xaf'),_0xf160a7[_0xa9a9('0x5d')][_0xa9a9('0xf3')]);}else{_0x177f56=util['format'](_0xa9a9('0xaf'),_0x4e7d21[_0xa9a9('0x40')]);}socket['to'](util[_0xa9a9('0xae')]('user:%s',_0x4e7d21[_0xa9a9('0x40')]))[_0xa9a9('0xaa')](_0xa9a9('0xf4'),{'user':{'id':_0x4e7d21['id'],'name':_0x4e7d21['name']},'ip':_0xf160a7[_0xa9a9('0xf5')][_0xa9a9('0xf6')]||_0xf160a7[_0xa9a9('0xf7')]['remoteAddress']||_0xf160a7[_0xa9a9('0xf8')]['remoteAddress']||_0xf160a7['connection'][_0xa9a9('0xf8')][_0xa9a9('0xf9')]});return db[_0xa9a9('0xb2')][_0xa9a9('0x2c')]({'where':{'membername':_0x4e7d21[_0xa9a9('0x40')]},'individualHooks':!![]});}}else{throw new db[(_0xa9a9('0x93'))][(_0xa9a9('0x94'))](_0xa9a9('0xfa'));}})[_0xa9a9('0x28')](function(){if(_0x4e7d21){return _0x4e7d21['getVoiceQueues']({'raw':!![]});}})[_0xa9a9('0x28')](function(_0x236585){if(_0x4e7d21){if(_0x236585){_0x134eed=_0x236585;if(_0x134eed[_0xa9a9('0x4d')]){var _0x8ab0db=_0x134eed[_0xa9a9('0x34')](function(_0x49bb3d){var _0x1cc88e={'membername':_0x4e7d21[_0xa9a9('0x40')],'UserId':_0x4e7d21['id'],'queue_name':_0x49bb3d['name'],'VoiceQueueId':_0x49bb3d['id'],'interface':_0x177f56,'paused':_0x4e7d21[_0xa9a9('0xf1')]||![],'penalty':_0x49bb3d[_0xa9a9('0xfb')]||0x0};return db['UserVoiceQueueRt'][_0xa9a9('0xfc')](_0x1cc88e);});return Promise[_0xa9a9('0x8e')](_0x8ab0db);}}}})[_0xa9a9('0x28')](function(){if(_0x4e7d21){return db[_0xa9a9('0xfd')][_0xa9a9('0x4a')]({'where':{'membername':_0x4e7d21[_0xa9a9('0x40')],'exitAt':null}});}})[_0xa9a9('0x28')](function(_0x5926e8){if(_0x4e7d21){var _0x5c8e9c=[];_0x5926e8[_0xa9a9('0xfe')](function(_0x48bbad){_0x5c8e9c[_0xa9a9('0x49')](_0x48bbad['update']({'exitAt':moment()[_0xa9a9('0xae')](_0xa9a9('0xff'))}));});return Promise[_0xa9a9('0x8e')](_0x5c8e9c);}})[_0xa9a9('0x28')](function(){if(_0x4e7d21){var _0x4240dc=[];var _0xdf8ee8=[];var _0x876d3e=utils['getChannels']();var _0x47675c={'membername':_0x4e7d21['name'],'interface':_0x177f56,'enterAt':moment()['format'](_0xa9a9('0xff')),'role':_0x4e7d21[_0xa9a9('0x29')],'internal':_0x4e7d21['internal']};_0x876d3e[_0xa9a9('0xfe')](function(_0xddf8c8){_0x4240dc[_0xa9a9('0x49')](_[_0xa9a9('0x5b')]({'channel':_0xddf8c8,'type':'LOGIN','data1':_0xf160a7['body']['device'],'data2':_0x177f56},_0x47675c));if(_0x4e7d21['loginInPause']){_0xdf8ee8[_0xa9a9('0x49')](_[_0xa9a9('0x5b')]({'channel':_0xddf8c8,'type':'PAUSE','data1':'LOGININPAUSE'},_0x47675c));}});return db[_0xa9a9('0xfd')][_0xa9a9('0x8a')](_0x4240dc['concat'](_0xdf8ee8),{'individualHooks':!![]});}})[_0xa9a9('0x28')](function(){if(_0x4e7d21){return _0x4e7d21[_0xa9a9('0x5c')]({'online':!![],'lastLoginAt':moment()[_0xa9a9('0xae')](_0xa9a9('0xff')),'voicePause':_0x4e7d21[_0xa9a9('0xf1')]||![],'mailPause':_0x4e7d21[_0xa9a9('0xf1')]||![],'chatPause':_0x4e7d21[_0xa9a9('0xf1')]||![],'faxPause':_0x4e7d21[_0xa9a9('0xf1')]||![],'smsPause':_0x4e7d21['loginInPause']||![],'openchannelPause':_0x4e7d21[_0xa9a9('0xf1')]||![],'whatsappPause':_0x4e7d21['loginInPause']||![],'pauseType':_0x4e7d21[_0xa9a9('0xf1')]?_0xa9a9('0x100'):null,'interface':_0x177f56,'lastPauseAt':moment()[_0xa9a9('0xae')](_0xa9a9('0xff'))});}})['then'](function(_0x40f62e){if(_0xf160a7[_0xa9a9('0x101')]){return _0x2bc737();}else{return Promise[_0xa9a9('0x102')](_0x40f62e)['then'](respondWithResult(_0xe0ccb,null));}})[_0xa9a9('0x52')](handleError(_0xe0ccb,null));};exports['logout']=function(_0x2bb1d3,_0x1e0dea){var _0x3a3c8c;return db[_0xa9a9('0x3c')][_0xa9a9('0x37')]({'where':{'id':_0x2bb1d3[_0xa9a9('0x54')]['id'],'role':_0xa9a9('0x2a')},'attributes':['id','name',_0xa9a9('0x29')]})['then'](handleEntityNotFound(_0x1e0dea,null))[_0xa9a9('0x28')](function(_0xf08462){if(_0xf08462){_0x3a3c8c=_0xf08462;return db[_0xa9a9('0xb2')]['destroy']({'where':{'membername':_0x3a3c8c[_0xa9a9('0x40')]},'individualHooks':!![]});}})[_0xa9a9('0x28')](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x3a3c8c[_0xa9a9('0x40')],'exitAt':null}});})[_0xa9a9('0x28')](function(_0x404b61){var _0x59d52c=[];_0x404b61[_0xa9a9('0xfe')](function(_0x3764ac){_0x59d52c[_0xa9a9('0x49')](_0x3764ac[_0xa9a9('0x5c')]({'exitAt':moment()['format'](_0xa9a9('0xff'))}));});return Promise['all'](_0x59d52c);})[_0xa9a9('0x28')](function(){return _0x3a3c8c[_0xa9a9('0x5c')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xa9a9('0x28')](respondWithResult(_0x1e0dea,null))[_0xa9a9('0x52')](handleError(_0x1e0dea,null));};exports[_0xa9a9('0x103')]=function(_0xf0500d,_0x2c7f70){var _0x2486bb;return db[_0xa9a9('0xb2')]['update']({'paused':0x1},{'where':{'UserId':_0xf0500d[_0xa9a9('0x54')]['id']},'individualHooks':!![]})[_0xa9a9('0x28')](function(){return db[_0xa9a9('0x3c')]['find']({'where':{'id':_0xf0500d[_0xa9a9('0x54')]['id'],'role':'agent'},'attributes':['id',_0xa9a9('0x40'),_0xa9a9('0x29'),_0xa9a9('0x62'),_0xa9a9('0xa2'),'online']});})[_0xa9a9('0x28')](handleEntityNotFound(_0x2c7f70,null))[_0xa9a9('0x28')](function(_0x299897){if(_0x299897){_0x2486bb=_0x299897;return respondWithRpcPromise(_0xa9a9('0x104'),_0xa9a9('0x103'),{'id':_0x2486bb['id'],'name':_0x2486bb[_0xa9a9('0x40')],'pause':!![]});}})['then'](function(){if(_0x2486bb){return db['MemberReport'][_0xa9a9('0x4a')]({'where':{'membername':_0x2486bb[_0xa9a9('0x40')],'type':'PAUSE','exitAt':null}});}})[_0xa9a9('0x28')](function(_0x457342){if(_0x457342['length']){var _0x580c39=moment()[_0xa9a9('0xae')](_0xa9a9('0xff'));for(var _0x3b8d12=0x0,_0x2f7797=_0x457342['length'];_0x3b8d12<_0x2f7797;_0x3b8d12++){_0x457342[_0x3b8d12][_0xa9a9('0x105')]({'exitAt':_0x580c39});}}})[_0xa9a9('0x28')](function(){var _0x5df9a7=[];var _0xa76050=utils[_0xa9a9('0x106')]();_0xa76050['forEach'](function(_0xdf5138){_0x5df9a7[_0xa9a9('0x49')]({'channel':_0xdf5138,'membername':_0x2486bb[_0xa9a9('0x40')],'interface':_['isNil'](_0x2486bb[_0xa9a9('0xa2')])?util[_0xa9a9('0xae')](_0xa9a9('0xaf'),_0x2486bb['name']):_0x2486bb['interface'],'type':_0xa9a9('0x107'),'enterAt':moment()[_0xa9a9('0xae')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0xf0500d[_0xa9a9('0x5d')][_0xa9a9('0x108')]||'DEFAULT\x20PAUSE','role':_0x2486bb['role'],'internal':_0x2486bb[_0xa9a9('0x62')]});});return db[_0xa9a9('0xfd')][_0xa9a9('0x8a')](_0x5df9a7,{'individualHooks':!![]});})[_0xa9a9('0x28')](function(){return _0x2486bb[_0xa9a9('0x5c')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0xf0500d[_0xa9a9('0x5d')][_0xa9a9('0x108')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xa9a9('0xae')](_0xa9a9('0xff'))});})[_0xa9a9('0x28')](respondWithResult(_0x2c7f70,null))['catch'](handleError(_0x2c7f70,null));};exports['unpause']=function(_0x43e35e,_0x1a6321){if(_0x43e35e[_0xa9a9('0x5d')]['channel']&&!utils[_0xa9a9('0xa3')](_0x43e35e['body'][_0xa9a9('0xb4')])){throw new APIBadRequestError(util['format']('Channel\x20parameter\x20%s\x20is\x20invalid',_0x43e35e[_0xa9a9('0x5d')][_0xa9a9('0xb4')]));}return db[_0xa9a9('0x3c')][_0xa9a9('0x37')]({'where':{'id':_0x43e35e['params']['id']},'attributes':['id',_0xa9a9('0x40'),_0xa9a9('0x29'),_0xa9a9('0x62'),'interface',_0xa9a9('0xa1'),_0xa9a9('0xb0'),_0xa9a9('0x109'),_0xa9a9('0x10a'),_0xa9a9('0x10b'),_0xa9a9('0x10c'),_0xa9a9('0x10d'),_0xa9a9('0x10e'),'pauseType','lastPauseAt']})[_0xa9a9('0x28')](function(_0x300d9e){if(!_0x300d9e){throw new APINotFoundError(util[_0xa9a9('0xae')](_0xa9a9('0x10f'),_0x43e35e[_0xa9a9('0x54')]['id']));}return _0x300d9e[_0xa9a9('0x110')](_0x43e35e[_0xa9a9('0x5d')]['channel']);})[_0xa9a9('0x28')](respondWithResult(_0x1a6321,null))[_0xa9a9('0x52')](APIHandleError(_0x1a6321));};exports[_0xa9a9('0x111')]=function(_0x220a4c,_0x2c097c){var _0x2fb2f9={};var _0x306168={};var _0x1c661f;var _0x5567ac;return db[_0xa9a9('0x3c')][_0xa9a9('0x9b')]({'where':{'id':_0x220a4c['params']['id']}})[_0xa9a9('0x28')](handleEntityNotFound(_0x2c097c,null))[_0xa9a9('0x28')](function(_0x5ed649){if(_0x5ed649){_0x1c661f=_0x5ed649;_0x306168['model']=_[_0xa9a9('0x57')](db[_0xa9a9('0x112')]['rawAttributes']);_0x306168[_0xa9a9('0x43')]=_['keys'](_0x220a4c[_0xa9a9('0x43')]);_0x306168[_0xa9a9('0xcd')]=_[_0xa9a9('0x59')](_0x306168[_0xa9a9('0x55')],_0x306168['query']);_0x2fb2f9['attributes']=_[_0xa9a9('0x59')](_0x306168['model'],qs['fields'](_0x220a4c['query'][_0xa9a9('0x5a')]));_0x2fb2f9[_0xa9a9('0x48')]=_0x2fb2f9[_0xa9a9('0x48')]['length']?_0x2fb2f9[_0xa9a9('0x48')]:_0x306168['model'];_0x2fb2f9[_0xa9a9('0xce')]=qs['sort'](_0x220a4c[_0xa9a9('0x43')][_0xa9a9('0xd9')]);_0x2fb2f9[_0xa9a9('0x42')]=qs[_0xa9a9('0xcd')](_[_0xa9a9('0xcf')](_0x220a4c[_0xa9a9('0x43')],_0x306168['filters']));if(_0x220a4c[_0xa9a9('0x43')][_0xa9a9('0x32')]){_0x2fb2f9[_0xa9a9('0x42')]=_[_0xa9a9('0x5b')](_0x2fb2f9['where'],{'$or':_['map'](_0x2fb2f9['attributes'],function(_0xc7875e){var _0x10bdfe={};_0x10bdfe[_0xc7875e]={'$like':'%'+_0x220a4c['query']['filter']+'%'};return _0x10bdfe;})});}_0x2fb2f9=_['merge']({},_0x2fb2f9,_0x220a4c[_0xa9a9('0xd0')]);return _0x1c661f[_0xa9a9('0x111')](_0x2fb2f9);}})[_0xa9a9('0x28')](function(_0x4565b5){if(_0x4565b5){_0x5567ac=_0x4565b5[_0xa9a9('0x4d')];if(!_0x220a4c[_0xa9a9('0x43')][_0xa9a9('0xd1')](_0xa9a9('0xd6'))){_0x2fb2f9['limit']=qs[_0xa9a9('0x24')](_0x220a4c[_0xa9a9('0x43')][_0xa9a9('0x24')]);_0x2fb2f9[_0xa9a9('0x22')]=qs[_0xa9a9('0x22')](_0x220a4c[_0xa9a9('0x43')][_0xa9a9('0x22')]);}return _0x1c661f['getTeams'](_0x2fb2f9);}})[_0xa9a9('0x28')](function(_0x3c6def){if(_0x3c6def){return _0x3c6def?{'count':_0x5567ac,'rows':_0x3c6def}:null;}})[_0xa9a9('0x28')](respondWithResult(_0x2c097c,null))[_0xa9a9('0x52')](handleError(_0x2c097c,null));};exports['addTeams']=function(_0xae45d8,_0x5eae3a){var _0x2d8124=_0xae45d8['params']['id'];var _0x1f506b=_0xae45d8[_0xa9a9('0x5d')]?_0xae45d8['body'][_0xa9a9('0x60')]:null;var _0x1cadc0=[];return Promise['resolve']()['then'](function(){if(!_0x1f506b)throw new APIBadRequestError(_0xa9a9('0x113'));})[_0xa9a9('0x28')](function(){return db[_0xa9a9('0x3c')][_0xa9a9('0x9b')]({'where':{'id':_0x2d8124}});})[_0xa9a9('0x28')](function(_0x52ae7d){if(!_0x52ae7d)throw new APINotFoundError(util['format'](_0xa9a9('0x10f'),_0xae45d8['params']['id']));return db[_0xa9a9('0x69')][_0xa9a9('0x114')](function(_0x1d34c5){return _0x52ae7d['addTeams'](_0x1f506b,{'transaction':_0x1d34c5})['then'](function(){return db['Team']['findAll']({'where':{'id':{'$in':_0x1f506b}}});})[_0xa9a9('0x28')](function(_0x216e15){var _0x300e53=_['map'](_0x216e15,function(_0x4d57cb){return _0x4d57cb[_0xa9a9('0x115')]();});return Promise[_0xa9a9('0x8e')](_0x300e53);})[_0xa9a9('0x28')](function(_0x5f0425){_0x1cadc0=_['flattenDeep'](_0x5f0425);var _0x3801da=_['map'](_0x1cadc0,function(_0x4ea092){return _0x4ea092[_0xa9a9('0x116')](_0x52ae7d['id'],{'transaction':_0x1d34c5});});return Promise['all'](_0x3801da);})[_0xa9a9('0x28')](function(){if(!_0x52ae7d[_0xa9a9('0xa1')])return;var _0x3af1bf=_[_0xa9a9('0x32')](_0x1cadc0,function(_0x2c7714){return _0x2c7714[_0xa9a9('0x117')](_0xa9a9('0xb4'))===_0xa9a9('0x118');});var _0x28c07b=_[_0xa9a9('0x34')](_0x3af1bf,function(_0x238426){return db[_0xa9a9('0xb2')][_0xa9a9('0xfc')]({'membername':_0x52ae7d[_0xa9a9('0x40')],'UserId':_0x52ae7d['id'],'queue_name':_0x238426[_0xa9a9('0x40')],'VoiceQueueId':_0x238426['id'],'interface':_[_0xa9a9('0x6c')](_0x52ae7d[_0xa9a9('0xa2')])?util[_0xa9a9('0xae')](_0xa9a9('0xaf'),_0x52ae7d[_0xa9a9('0x40')]):_0x52ae7d['interface'],'paused':_0x52ae7d['voicePause']||![],'penalty':_0x52ae7d[_0xa9a9('0xb1')]},{'transaction':_0x1d34c5});});return Promise[_0xa9a9('0x8e')](_0x28c07b);})[_0xa9a9('0x28')](function(){return db[_0xa9a9('0x119')][_0xa9a9('0x4a')]({'where':{'teamId':{'$in':_0x1f506b}}});})['then'](function(_0x217029){var _0x52a4c3=_[_0xa9a9('0x34')](_0x217029,function(_0x32db76){return db[_0xa9a9('0x11a')][_0xa9a9('0x80')]({'UserId':_0x52ae7d['id'],'VoicePrefixId':_0x32db76[_0xa9a9('0x11b')]},{'transaction':_0x1d34c5});});return Promise[_0xa9a9('0x8e')](_0x52a4c3);});});})[_0xa9a9('0x28')](function(){for(var _0x36f9dc=0x0;_0x36f9dc<_0x1cadc0['length'];_0x36f9dc++){var _0x512b14=_0x1cadc0[_0x36f9dc][_0xa9a9('0x117')](_0xa9a9('0xb4'));var _0x289536=_0x512b14+'QueueId';socket['emit']('user'+_0x512b14+_0xa9a9('0x11c'),{'UserId':_0x2d8124,['queueField']:_0x1cadc0[_0x36f9dc]['id']});}})[_0xa9a9('0x28')](respondWithStatusCode(_0x5eae3a,null))[_0xa9a9('0x52')](APIHandleError(_0x5eae3a));};exports['removeTeams']=function(_0x1497ee,_0xf0ce5e){var _0x1f39a5=_0x1497ee[_0xa9a9('0x54')]['id'];var _0x4b69ed=null;if(_0x1497ee[_0xa9a9('0x43')][_0xa9a9('0x60')]){_0x4b69ed=_[_0xa9a9('0xb5')](_0x1497ee[_0xa9a9('0x43')]['ids'])?_0x1497ee[_0xa9a9('0x43')]['ids']:[_0x1497ee[_0xa9a9('0x43')][_0xa9a9('0x60')]];}var _0x171d7a=[];return Promise['resolve']()[_0xa9a9('0x28')](function(){if(!_0x4b69ed)throw new APIBadRequestError(_0xa9a9('0x11d'));})[_0xa9a9('0x28')](function(){return db[_0xa9a9('0x3c')]['findOne']({'where':{'id':_0x1f39a5}});})[_0xa9a9('0x28')](function(_0xc50829){if(!_0xc50829)throw new APINotFoundError(util['format'](_0xa9a9('0x10f'),_0x1497ee[_0xa9a9('0x54')]['id']));return db['sequelize']['transaction'](function(_0x5169bc){return _0xc50829[_0xa9a9('0x11e')](_0x4b69ed,{'transaction':_0x5169bc})['then'](function(){return db['Team'][_0xa9a9('0x4a')]({'where':{'id':{'$in':_0x4b69ed}}});})[_0xa9a9('0x28')](function(_0x5c7beb){var _0x424c3c=_[_0xa9a9('0x34')](_0x5c7beb,function(_0x4ac29f){return _0x4ac29f[_0xa9a9('0x115')]();});return Promise[_0xa9a9('0x8e')](_0x424c3c);})[_0xa9a9('0x28')](function(_0x5c9955){_0x171d7a=_[_0xa9a9('0x11f')](_0x5c9955);var _0x59ef8e=_[_0xa9a9('0x34')](_0x171d7a,function(_0x414104){return _0x414104[_0xa9a9('0x120')](_0xc50829['id'],{'transaction':_0x5169bc});});return Promise['all'](_0x59ef8e);})['then'](function(){if(!_0xc50829[_0xa9a9('0xa1')])return;var _0x5328ad=_[_0xa9a9('0x32')](_0x171d7a,function(_0x13acbf){return _0x13acbf[_0xa9a9('0x117')]('channel')===_0xa9a9('0x118');});var _0xb7551e=_['map'](_0x5328ad,function(_0x1f4edd){return db[_0xa9a9('0xb2')][_0xa9a9('0x2c')]({'where':{'VoiceQueueId':_0x1f4edd['id'],'UserId':_0xc50829['id']},'transaction':_0x5169bc});});return Promise[_0xa9a9('0x8e')](_0xb7551e);})[_0xa9a9('0x28')](function(){return db['TeamVoicePrefix'][_0xa9a9('0x4a')]({'where':{'teamId':{'$in':_0x4b69ed}}});})['then'](function(_0x506e9c){var _0x27cf15=_[_0xa9a9('0x34')](_0x506e9c,function(_0x30e87f){return db[_0xa9a9('0x11a')][_0xa9a9('0x2c')]({'where':{'UserId':_0xc50829['id'],'VoicePrefixId':_0x30e87f[_0xa9a9('0x11b')]}},{'transaction':_0x5169bc});});return Promise['all'](_0x27cf15);});});})[_0xa9a9('0x28')](function(){for(var _0x3c3f9c=0x0;_0x3c3f9c<_0x171d7a[_0xa9a9('0x4d')];_0x3c3f9c++){var _0x1e931b=_0x171d7a[_0x3c3f9c][_0xa9a9('0x117')]('channel');var _0x19818c=_0x1e931b+_0xa9a9('0xa9');socket['emit'](_0xa9a9('0x2e')+_0x1e931b+_0xa9a9('0xb6'),{'UserId':_0x1f39a5,['queueField']:_0x171d7a[_0x3c3f9c]['id']});}})[_0xa9a9('0x28')](respondWithStatusCode(_0xf0ce5e,null))['catch'](APIHandleError(_0xf0ce5e));};exports[_0xa9a9('0x121')]=function(_0x56bf8d,_0x263d39){var _0x4c4678={};var _0x4d8cac={};var _0x34aa55;var _0x46c87a;return db[_0xa9a9('0x3c')][_0xa9a9('0x9b')]({'where':{'id':_0x56bf8d[_0xa9a9('0x54')]['id']}})[_0xa9a9('0x28')](handleEntityNotFound(_0x263d39,null))[_0xa9a9('0x28')](function(_0x1b07cc){if(_0x1b07cc){_0x34aa55=_0x1b07cc;_0x4d8cac['model']=_[_0xa9a9('0x57')](db[_0xa9a9('0xd2')][_0xa9a9('0x3d')]);_0x4d8cac[_0xa9a9('0x43')]=_[_0xa9a9('0x57')](_0x56bf8d[_0xa9a9('0x43')]);_0x4d8cac['filters']=_['intersection'](_0x4d8cac['model'],_0x4d8cac['query']);_0x4c4678[_0xa9a9('0x48')]=_[_0xa9a9('0x59')](_0x4d8cac[_0xa9a9('0x55')],qs[_0xa9a9('0x5a')](_0x56bf8d[_0xa9a9('0x43')][_0xa9a9('0x5a')]));_0x4c4678[_0xa9a9('0x48')]=_0x4c4678[_0xa9a9('0x48')][_0xa9a9('0x4d')]?_0x4c4678[_0xa9a9('0x48')]:_0x4d8cac[_0xa9a9('0x55')];_0x4c4678[_0xa9a9('0xce')]=qs[_0xa9a9('0xd9')](_0x56bf8d['query'][_0xa9a9('0xd9')]);_0x4c4678['where']=qs[_0xa9a9('0xcd')](_[_0xa9a9('0xcf')](_0x56bf8d[_0xa9a9('0x43')],_0x4d8cac[_0xa9a9('0xcd')]));if(_0x56bf8d['query']['filter']){_0x4c4678[_0xa9a9('0x42')]=_[_0xa9a9('0x5b')](_0x4c4678[_0xa9a9('0x42')],{'$or':_['map'](_0x4c4678[_0xa9a9('0x48')],function(_0xbd765b){var _0x5de93f={};_0x5de93f[_0xbd765b]={'$like':'%'+_0x56bf8d[_0xa9a9('0x43')]['filter']+'%'};return _0x5de93f;})});}_0x4c4678=_[_0xa9a9('0x5b')]({},_0x4c4678,_0x56bf8d[_0xa9a9('0xd0')]);return _0x34aa55[_0xa9a9('0x121')](_0x4c4678);}})['then'](function(_0x18f2d7){if(_0x18f2d7){_0x46c87a=_0x18f2d7['length'];if(!_0x56bf8d[_0xa9a9('0x43')]['hasOwnProperty'](_0xa9a9('0xd6'))){_0x4c4678[_0xa9a9('0x24')]=qs[_0xa9a9('0x24')](_0x56bf8d[_0xa9a9('0x43')][_0xa9a9('0x24')]);_0x4c4678[_0xa9a9('0x22')]=qs[_0xa9a9('0x22')](_0x56bf8d[_0xa9a9('0x43')][_0xa9a9('0x22')]);}return _0x34aa55[_0xa9a9('0x121')](_0x4c4678);}})['then'](function(_0x1a3603){if(_0x1a3603){return _0x1a3603?{'count':_0x46c87a,'rows':_0x1a3603}:null;}})[_0xa9a9('0x28')](respondWithResult(_0x263d39,null))['catch'](handleError(_0x263d39,null));};exports['getAgents']=function(_0x5c2013,_0x30be8f){var _0x558234={};var _0xb5c8fb={};var _0x4d8938;return db[_0xa9a9('0x3c')][_0xa9a9('0x9b')]({'where':{'id':_0x5c2013[_0xa9a9('0x54')]['id']}})[_0xa9a9('0x28')](handleEntityNotFound(_0x30be8f,null))['then'](function(_0xfe54e6){if(_0xfe54e6){_0x4d8938=_0xfe54e6;_0xb5c8fb['model']=_[_0xa9a9('0x57')](db[_0xa9a9('0x3c')][_0xa9a9('0x3d')]);_0xb5c8fb['query']=_['keys'](_0x5c2013[_0xa9a9('0x43')]);_0xb5c8fb['filters']=_[_0xa9a9('0x59')](_0xb5c8fb[_0xa9a9('0x55')],_0xb5c8fb[_0xa9a9('0x43')]);_0x558234['attributes']=_[_0xa9a9('0x59')](_0xb5c8fb[_0xa9a9('0x55')],qs[_0xa9a9('0x5a')](_0x5c2013[_0xa9a9('0x43')]['fields']));_0x558234[_0xa9a9('0x48')]=_0x558234[_0xa9a9('0x48')]['length']?_0x558234[_0xa9a9('0x48')]:_0xb5c8fb['model'];_0x558234[_0xa9a9('0xce')]=qs['sort'](_0x5c2013['query'][_0xa9a9('0xd9')]);_0x558234[_0xa9a9('0x42')]=qs[_0xa9a9('0xcd')](_[_0xa9a9('0xcf')](_0x5c2013['query'],_0xb5c8fb[_0xa9a9('0xcd')]));if(_0x5c2013[_0xa9a9('0x43')][_0xa9a9('0x32')]){_0x558234[_0xa9a9('0x42')]=_['merge'](_0x558234['where'],{'$or':_[_0xa9a9('0x34')](_0x558234[_0xa9a9('0x48')],function(_0x23e2d1){var _0xc18012={};_0xc18012[_0x23e2d1]={'$like':'%'+_0x5c2013[_0xa9a9('0x43')][_0xa9a9('0x32')]+'%'};return _0xc18012;})});}_0x558234['model']=db[_0xa9a9('0x3c')];_0x558234['as']=_0xa9a9('0x2f');_0x558234=_[_0xa9a9('0x5b')]({},_0x558234,_0x5c2013['options']);return _0x4d8938[_0xa9a9('0x122')]({'include':[_0x558234]});}})['then'](function(_0x33c36f){if(_0x33c36f){var _0x15933d={},_0x5921df=[];for(var _0x51a3a1=0x0;_0x51a3a1<_0x33c36f[_0xa9a9('0x4d')];_0x51a3a1+=0x1){for(var _0x3eb3b2=0x0,_0x2ee3c4;_0x3eb3b2<_0x33c36f[_0x51a3a1][_0xa9a9('0x2f')][_0xa9a9('0x4d')];_0x3eb3b2+=0x1){_0x2ee3c4=_0x33c36f[_0x51a3a1][_0xa9a9('0x2f')][_0x3eb3b2][_0xa9a9('0xad')]({'plain':!![]});_0x15933d[_0x2ee3c4['id']]=_0x2ee3c4;}}_0x15933d=_[_0xa9a9('0x123')](_0x15933d);for(var _0x4c88d6=qs[_0xa9a9('0x22')](_0x5c2013[_0xa9a9('0x43')][_0xa9a9('0x22')]);_0x4c88d6<_0x15933d[_0xa9a9('0x4d')]&&_0x5921df[_0xa9a9('0x4d')]=_0x42e9b4[_0xd94f('0x4f')]){throw new Error(_0xd94f('0x50'));}})[_0xd94f('0x20')](function(){if(_0x1f8984){return db[_0xd94f('0x27')][_0xd94f('0x47')]({'where':{'membername':_0x1f8984['name']},'individualHooks':!![]});}})['then'](function(){if(_0x1f8984){return _0x1f8984['getVoiceQueues']({'raw':!![]});}})[_0xd94f('0x20')](function(_0x6a2500){if(_0x1f8984){if(_0x6a2500){var _0x459943=[];_0x48cc49=_0x6a2500;if(_0x48cc49[_0xd94f('0x51')]){for(var _0x144c8a=0x0;_0x144c8a<_0x48cc49[_0xd94f('0x51')];_0x144c8a++){_0x459943[_0xd94f('0x49')](db[_0xd94f('0x27')][_0xd94f('0x52')]({'membername':_0x1f8984[_0xd94f('0x29')],'UserId':_0x1f8984['id'],'queue_name':_0x48cc49[_0x144c8a][_0xd94f('0x29')],'VoiceQueueId':_0x48cc49[_0x144c8a]['id'],'interface':_0x190c90,'paused':_0x1f8984[_0xd94f('0x4d')]||![],'penalty':_0x48cc49[_0x144c8a][_0xd94f('0x53')]||0x0}));}return BPromise['all'](_0x459943);}}}})[_0xd94f('0x20')](function(){if(_0x1f8984){return db[_0xd94f('0x32')][_0xd94f('0xf')]({'where':{'membername':_0x1f8984[_0xd94f('0x29')],'exitAt':null}});}})[_0xd94f('0x20')](function(_0x8f5625){if(_0x1f8984){if(_0x8f5625&&_0x8f5625['length']){var _0x26649c=[];_0x8f5625[_0xd94f('0x48')](function(_0xa9eda7){_0x26649c['push'](_0xa9eda7[_0xd94f('0x28')]({'exitAt':moment()[_0xd94f('0x25')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x26649c);}}})[_0xd94f('0x20')](function(){if(_0x1f8984){var _0x141d2d=[];var _0x1288a2=[];var _0x3a8f25=utils['getChannels']();var _0x32e0ae={'membername':_0x1f8984['name'],'interface':_0x190c90,'enterAt':moment()[_0xd94f('0x25')](_0xd94f('0x2e')),'role':_0x1f8984['role'],'internal':_0x1f8984[_0xd94f('0x23')]};_0x3a8f25[_0xd94f('0x48')](function(_0x4a217a){_0x141d2d[_0xd94f('0x49')](_[_0xd94f('0x54')]({'channel':_0x4a217a,'type':_0xd94f('0x55'),'data1':'callysquare','data2':_0x190c90},_0x32e0ae));if(_0x1f8984[_0xd94f('0x4d')]){_0x1288a2[_0xd94f('0x49')](_['merge']({'channel':_0x4a217a,'type':_0xd94f('0x2d'),'data1':_0xd94f('0x56')},_0x32e0ae));}});return db[_0xd94f('0x32')]['bulkCreate'](_0x141d2d[_0xd94f('0x57')](_0x1288a2),{'individualHooks':!![]});}})[_0xd94f('0x20')](function(){if(_0x1f8984){return _0x1f8984['update']({'online':!![],'lastLoginAt':moment()[_0xd94f('0x25')](_0xd94f('0x2e')),'voicePause':_0x1f8984[_0xd94f('0x4d')]||![],'mailPause':_0x1f8984[_0xd94f('0x4d')]||![],'chatPause':_0x1f8984[_0xd94f('0x4d')]||![],'faxPause':_0x1f8984['loginInPause']||![],'smsPause':_0x1f8984[_0xd94f('0x4d')]||![],'openchannelPause':_0x1f8984[_0xd94f('0x4d')]||![],'pauseType':_0x1f8984['loginInPause']?_0xd94f('0x56'):null,'lastPauseAt':moment()[_0xd94f('0x25')](_0xd94f('0x2e')),'interface':_0x190c90});}})['then'](function(_0x536e37){_0x1966c5(_0x536e37);})[_0xd94f('0x1b')](function(_0x1b975c){_0x919ea9(_0x573b01[_0xd94f('0x1d')](0x1f4,_0x1b975c[_0xd94f('0x1c')]));});});}; \ No newline at end of file +var _0xa42b=['internal','LOGIN','merge','LOGININPAUSE','bulkCreate','concat','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./user.socket','register','User','findAll','options','raw','limit','include','map','model','attributes','info','GetUser','debug','stringify','catch','error','message','ShowUser','where','PauseUser','find','name','then','format','User\x20with\x20id\x20%s\x20not\x20found','params','UserVoiceQueueRt','MemberReport','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','interface','SIP/%s','body','type','DEFAULT\x20PAUSE','role','uniqueid','UnpauseUser','resolve','channel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','voicePause','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','unpause','system','LogoutUser','destroy','push','update','all','LoginUser','loginInPause','count','agent','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty'];(function(_0x15aea1,_0x2b2ac5){var _0x6cf455=function(_0x5dd56d){while(--_0x5dd56d){_0x15aea1['push'](_0x15aea1['shift']());}};_0x6cf455(++_0x2b2ac5);}(_0xa42b,0x11a));var _0xba42=function(_0x46602f,_0xf64075){_0x46602f=_0x46602f-0x0;var _0xd669c=_0xa42b[_0x46602f];return _0xd669c;};'use strict';var _=require('lodash');var util=require(_0xba42('0x0'));var moment=require(_0xba42('0x1'));var BPromise=require(_0xba42('0x2'));var Redis=require(_0xba42('0x3'));var db=require(_0xba42('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xba42('0x5'))(_0xba42('0x6'));var config=require(_0xba42('0x7'));config[_0xba42('0x8')]=_[_0xba42('0x9')](config[_0xba42('0x8')],{'host':_0xba42('0xa'),'port':0x18eb});var socket=require(_0xba42('0xb'))(new Redis(config[_0xba42('0x8')]));require(_0xba42('0xc'))[_0xba42('0xd')](socket);exports['GetUser']=function(_0x27a7d4){var _0x4871ff=this;return new Promise(function(_0xd2c008,_0x1a3db3){return db[_0xba42('0xe')][_0xba42('0xf')]({'raw':_0x27a7d4[_0xba42('0x10')]?_0x27a7d4['options'][_0xba42('0x11')]===undefined?!![]:![]:!![],'where':_0x27a7d4['options']?_0x27a7d4[_0xba42('0x10')]['where']||null:null,'attributes':_0x27a7d4[_0xba42('0x10')]?_0x27a7d4[_0xba42('0x10')]['attributes']||null:null,'limit':_0x27a7d4[_0xba42('0x10')]?_0x27a7d4[_0xba42('0x10')][_0xba42('0x12')]||null:null,'include':_0x27a7d4[_0xba42('0x10')]?_0x27a7d4[_0xba42('0x10')][_0xba42('0x13')]?_[_0xba42('0x14')](_0x27a7d4['options'][_0xba42('0x13')],function(_0x3e4618){return{'model':db[_0x3e4618[_0xba42('0x15')]],'as':_0x3e4618['as'],'attributes':_0x3e4618[_0xba42('0x16')],'include':_0x3e4618[_0xba42('0x13')]?_[_0xba42('0x14')](_0x3e4618[_0xba42('0x13')],function(_0x7a05fd){return{'model':db[_0x7a05fd[_0xba42('0x15')]],'as':_0x7a05fd['as'],'attributes':_0x7a05fd['attributes'],'include':_0x7a05fd[_0xba42('0x13')]?_[_0xba42('0x14')](_0x7a05fd[_0xba42('0x13')],function(_0x9bde2d){return{'model':db[_0x9bde2d[_0xba42('0x15')]],'as':_0x9bde2d['as'],'attributes':_0x9bde2d[_0xba42('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x542f9c){logger[_0xba42('0x17')](_0xba42('0x18'),_0x27a7d4);logger[_0xba42('0x19')](_0xba42('0x18'),_0x27a7d4,JSON[_0xba42('0x1a')](_0x542f9c));_0xd2c008(_0x542f9c);})[_0xba42('0x1b')](function(_0x25241e){logger[_0xba42('0x1c')](_0xba42('0x18'),_0x25241e[_0xba42('0x1d')],_0x27a7d4);_0x1a3db3(_0x4871ff['error'](0x1f4,_0x25241e[_0xba42('0x1d')]));});});};exports[_0xba42('0x1e')]=function(_0x1b376d){var _0x447684=this;return new Promise(function(_0x6b317e,_0x18ff54){return db['User']['find']({'raw':_0x1b376d[_0xba42('0x10')]?_0x1b376d[_0xba42('0x10')][_0xba42('0x11')]===undefined?!![]:![]:!![],'where':_0x1b376d[_0xba42('0x10')]?_0x1b376d[_0xba42('0x10')][_0xba42('0x1f')]||null:null,'attributes':_0x1b376d[_0xba42('0x10')]?_0x1b376d['options'][_0xba42('0x16')]||null:null,'include':_0x1b376d[_0xba42('0x10')]?_0x1b376d['options'][_0xba42('0x13')]?_[_0xba42('0x14')](_0x1b376d[_0xba42('0x10')][_0xba42('0x13')],function(_0x536a1f){return{'model':db[_0x536a1f[_0xba42('0x15')]],'as':_0x536a1f['as'],'attributes':_0x536a1f[_0xba42('0x16')],'include':_0x536a1f['include']?_[_0xba42('0x14')](_0x536a1f[_0xba42('0x13')],function(_0x3c3d11){return{'model':db[_0x3c3d11[_0xba42('0x15')]],'as':_0x3c3d11['as'],'attributes':_0x3c3d11[_0xba42('0x16')],'include':_0x3c3d11['include']?_['map'](_0x3c3d11['include'],function(_0x10ba6b){return{'model':db[_0x10ba6b[_0xba42('0x15')]],'as':_0x10ba6b['as'],'attributes':_0x10ba6b[_0xba42('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x37235b){logger[_0xba42('0x17')]('ShowUser',_0x1b376d);logger[_0xba42('0x19')](_0xba42('0x1e'),_0x1b376d,JSON[_0xba42('0x1a')](_0x37235b));_0x6b317e(_0x37235b);})[_0xba42('0x1b')](function(_0x124321){logger[_0xba42('0x1c')](_0xba42('0x1e'),_0x124321['message'],_0x1b376d);_0x18ff54(_0x447684[_0xba42('0x1c')](0x1f4,_0x124321['message']));});});};exports[_0xba42('0x20')]=function(_0x529e1f){var _0x5aeac9;return db[_0xba42('0xe')][_0xba42('0x21')]({'where':_0x529e1f['options'][_0xba42('0x1f')]||{},'attributes':['id',_0xba42('0x22'),'role','internal','interface']})[_0xba42('0x23')](function(_0x2e75de){if(!_0x2e75de){throw new Error(util[_0xba42('0x24')](_0xba42('0x25'),_0x529e1f[_0xba42('0x26')]['id']));}_0x5aeac9=_0x2e75de;return db[_0xba42('0x27')]['update']({'paused':0x1},{'where':{'UserId':_0x5aeac9['id']},'individualHooks':!![]});})[_0xba42('0x23')](function(){return db[_0xba42('0x28')][_0xba42('0xf')]({'where':{'membername':_0x5aeac9[_0xba42('0x22')],'type':_0xba42('0x29'),'exitAt':null}});})[_0xba42('0x23')](function(_0x3b920e){if(_0x3b920e&&_0x3b920e[_0xba42('0x2a')]){var _0x2b21db=moment()[_0xba42('0x24')](_0xba42('0x2b'));for(var _0x1713f2=0x0,_0x1d1f3f=_0x3b920e[_0xba42('0x2a')];_0x1713f2<_0x1d1f3f;_0x1713f2++){_0x3b920e[_0x1713f2][_0xba42('0x2c')]({'exitAt':_0x2b21db});}}})[_0xba42('0x23')](function(){var _0x16ecd7=[];var _0x656ce2=utils[_0xba42('0x2d')]();_0x656ce2[_0xba42('0x2e')](function(_0x32ae36){_0x16ecd7['push']({'channel':_0x32ae36,'membername':_0x5aeac9[_0xba42('0x22')],'interface':_['isNil'](_0x5aeac9[_0xba42('0x2f')])?util[_0xba42('0x24')](_0xba42('0x30'),_0x5aeac9[_0xba42('0x22')]):_0x5aeac9['interface'],'type':'PAUSE','enterAt':moment()['format'](_0xba42('0x2b')),'data1':_0x529e1f[_0xba42('0x31')][_0xba42('0x32')]||_0xba42('0x33'),'role':_0x5aeac9[_0xba42('0x34')],'internal':_0x5aeac9['internal'],'uniqueid':_0x529e1f['body'][_0xba42('0x35')]||null});});return db[_0xba42('0x28')]['bulkCreate'](_0x16ecd7,{'individualHooks':!![]});})[_0xba42('0x23')](function(){return _0x5aeac9['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x529e1f[_0xba42('0x31')][_0xba42('0x32')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xba42('0x24')](_0xba42('0x2b'))});})[_0xba42('0x1b')](function(_0x580171){throw _0x580171;});};exports[_0xba42('0x36')]=function(_0x4227b8){return Promise[_0xba42('0x37')]()[_0xba42('0x23')](function(){if(_0x4227b8[_0xba42('0x31')][_0xba42('0x38')]&&!utils['isValidChannel'](_0x4227b8[_0xba42('0x31')][_0xba42('0x38')])){throw new Error(util['format'](_0xba42('0x39'),_0x4227b8[_0xba42('0x31')]['channel']));}return db[_0xba42('0xe')][_0xba42('0x3a')]({'where':_0x4227b8['options'][_0xba42('0x1f')]||{},'attributes':['id',_0xba42('0x22'),'role','internal',_0xba42('0x2f'),_0xba42('0x3b'),_0xba42('0x3c'),_0xba42('0x3d'),_0xba42('0x3e'),_0xba42('0x3f'),_0xba42('0x40'),_0xba42('0x41'),_0xba42('0x42'),_0xba42('0x43'),_0xba42('0x44')]});})[_0xba42('0x23')](function(_0x2627c2){if(!_0x2627c2){throw new Error(util[_0xba42('0x24')](_0xba42('0x25'),_0x4227b8[_0xba42('0x26')]['id']));}return _0x2627c2[_0xba42('0x45')](_0x4227b8[_0xba42('0x31')][_0xba42('0x38')],_0xba42('0x46'));})[_0xba42('0x1b')](function(_0x18f560){throw _0x18f560;});};exports[_0xba42('0x47')]=function(_0x2db3fe){var _0x3d6425=this;return new Promise(function(_0x35881f,_0x56a12b){var _0x4ba779;return db['User'][_0xba42('0x3a')]({'where':_0x2db3fe[_0xba42('0x10')]['where']||{},'attributes':['id',_0xba42('0x22')]})[_0xba42('0x23')](function(_0x15dea8){if(_0x15dea8){_0x4ba779=_0x15dea8;return db['UserVoiceQueueRt'][_0xba42('0x48')]({'where':{'membername':_0x4ba779['name']},'individualHooks':!![]});}})[_0xba42('0x23')](function(){if(_0x4ba779){return db[_0xba42('0x28')][_0xba42('0xf')]({'where':{'membername':_0x4ba779['name'],'exitAt':null}});}})[_0xba42('0x23')](function(_0x41080a){if(_0x4ba779){if(_0x41080a&&_0x41080a['length']){var _0x439b23=[];_0x41080a[_0xba42('0x2e')](function(_0x4c36da){_0x439b23[_0xba42('0x49')](_0x4c36da[_0xba42('0x4a')]({'exitAt':moment()[_0xba42('0x24')](_0xba42('0x2b'))}));});return BPromise[_0xba42('0x4b')](_0x439b23);}}})[_0xba42('0x23')](function(){if(_0x4ba779){return _0x4ba779[_0xba42('0x4a')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xba42('0x23')](function(_0x4e758d){_0x35881f(_0x4e758d);})[_0xba42('0x1b')](function(_0x1f6568){_0x56a12b(_0x3d6425[_0xba42('0x1c')](0x1f4,_0x1f6568['message']));});});};exports[_0xba42('0x4c')]=function(_0xf2cfbb){var _0x43c05e=this;return new Promise(function(_0x16149b,_0x45db11){var _0x3706a8;var _0x2d6d90;var _0x4fc7cb;var _0x8bc1b6;return db['User'][_0xba42('0x3a')]({'where':_0xf2cfbb[_0xba42('0x10')][_0xba42('0x1f')]||{},'attributes':['id',_0xba42('0x22'),_0xba42('0x34'),'mobile','phone','internal',_0xba42('0x4d'),_0xba42('0x2f')]})[_0xba42('0x23')](function(_0x24fda8){if(_0x24fda8){_0x3706a8=_0x24fda8;_0x8bc1b6=_0xf2cfbb['body'][_0xba42('0x2f')]?_0xf2cfbb[_0xba42('0x31')][_0xba42('0x2f')]:util[_0xba42('0x24')](_0xba42('0x30'),_0x3706a8[_0xba42('0x22')]);return db[_0xba42('0xe')][_0xba42('0x4e')]({'where':{'role':_0xba42('0x4f'),'online':!![],'id':{'$ne':_0x3706a8['id']}}});}})['then'](function(_0x5b9245){if(_0x5b9245){_0x4fc7cb=_0x5b9245;return require('../../config/license/util')[_0xba42('0x50')]();}})['then'](function(_0x5c3258){if(_0x5c3258&&_0x5c3258['agents']&&_0x4fc7cb>=_0x5c3258[_0xba42('0x51')]){throw new Error(_0xba42('0x52'));}})[_0xba42('0x23')](function(){if(_0x3706a8){return db['UserVoiceQueueRt'][_0xba42('0x48')]({'where':{'membername':_0x3706a8[_0xba42('0x22')]},'individualHooks':!![]});}})[_0xba42('0x23')](function(){if(_0x3706a8){return _0x3706a8[_0xba42('0x53')]({'raw':!![]});}})['then'](function(_0x55e61b){if(_0x3706a8){if(_0x55e61b){var _0x27acac=[];_0x2d6d90=_0x55e61b;if(_0x2d6d90[_0xba42('0x2a')]){for(var _0x74253=0x0;_0x74253<_0x2d6d90[_0xba42('0x2a')];_0x74253++){_0x27acac[_0xba42('0x49')](db[_0xba42('0x27')][_0xba42('0x54')]({'membername':_0x3706a8['name'],'UserId':_0x3706a8['id'],'queue_name':_0x2d6d90[_0x74253][_0xba42('0x22')],'VoiceQueueId':_0x2d6d90[_0x74253]['id'],'interface':_0x8bc1b6,'paused':_0x3706a8[_0xba42('0x4d')]||![],'penalty':_0x2d6d90[_0x74253][_0xba42('0x55')]||0x0}));}return BPromise['all'](_0x27acac);}}}})[_0xba42('0x23')](function(){if(_0x3706a8){return db[_0xba42('0x28')][_0xba42('0xf')]({'where':{'membername':_0x3706a8['name'],'exitAt':null}});}})['then'](function(_0x35a7b2){if(_0x3706a8){if(_0x35a7b2&&_0x35a7b2[_0xba42('0x2a')]){var _0xf5e277=[];_0x35a7b2[_0xba42('0x2e')](function(_0x170a39){_0xf5e277[_0xba42('0x49')](_0x170a39[_0xba42('0x4a')]({'exitAt':moment()[_0xba42('0x24')](_0xba42('0x2b'))}));});return BPromise[_0xba42('0x4b')](_0xf5e277);}}})[_0xba42('0x23')](function(){if(_0x3706a8){var _0x1f2b89=[];var _0x27c4b0=[];var _0x32b4de=utils[_0xba42('0x2d')]();var _0x478e80={'membername':_0x3706a8[_0xba42('0x22')],'interface':_0x8bc1b6,'enterAt':moment()[_0xba42('0x24')](_0xba42('0x2b')),'role':_0x3706a8[_0xba42('0x34')],'internal':_0x3706a8[_0xba42('0x56')]};_0x32b4de['forEach'](function(_0x138986){_0x1f2b89[_0xba42('0x49')](_['merge']({'channel':_0x138986,'type':_0xba42('0x57'),'data1':'callysquare','data2':_0x8bc1b6},_0x478e80));if(_0x3706a8[_0xba42('0x4d')]){_0x27c4b0[_0xba42('0x49')](_[_0xba42('0x58')]({'channel':_0x138986,'type':'PAUSE','data1':_0xba42('0x59')},_0x478e80));}});return db[_0xba42('0x28')][_0xba42('0x5a')](_0x1f2b89[_0xba42('0x5b')](_0x27c4b0),{'individualHooks':!![]});}})[_0xba42('0x23')](function(){if(_0x3706a8){return _0x3706a8[_0xba42('0x4a')]({'online':!![],'lastLoginAt':moment()[_0xba42('0x24')](_0xba42('0x2b')),'voicePause':_0x3706a8['loginInPause']||![],'mailPause':_0x3706a8['loginInPause']||![],'chatPause':_0x3706a8[_0xba42('0x4d')]||![],'faxPause':_0x3706a8[_0xba42('0x4d')]||![],'smsPause':_0x3706a8[_0xba42('0x4d')]||![],'openchannelPause':_0x3706a8[_0xba42('0x4d')]||![],'pauseType':_0x3706a8[_0xba42('0x4d')]?'LOGININPAUSE':null,'lastPauseAt':moment()['format'](_0xba42('0x2b')),'interface':_0x8bc1b6});}})[_0xba42('0x23')](function(_0xabef6f){_0x16149b(_0xabef6f);})[_0xba42('0x1b')](function(_0xa66090){_0x45db11(_0x43c05e[_0xba42('0x1c')](0x1f4,_0xa66090[_0xba42('0x1d')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 2633ddb..03b3277 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 _0x86b3=['update','emit','removeListener','length','user:','./user.events','save','remove'];(function(_0x18a626,_0x5ee82d){var _0x5d2771=function(_0xdf4b56){while(--_0xdf4b56){_0x18a626['push'](_0x18a626['shift']());}};_0x5d2771(++_0x5ee82d);}(_0x86b3,0x115));var _0x386b=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x86b3[_0x59ee6f];return _0x4c0979;};'use strict';var UserEvents=require(_0x386b('0x0'));var events=[_0x386b('0x1'),_0x386b('0x2'),_0x386b('0x3')];function createListener(_0xcf42cc,_0x394805){return function(_0x1c3cb1){_0x394805[_0x386b('0x4')](_0xcf42cc,_0x1c3cb1);};}function removeListener(_0x53c4fd,_0x1bbea3){return function(){UserEvents[_0x386b('0x5')](_0x53c4fd,_0x1bbea3);};}exports['register']=function(_0x2e9952){for(var _0x2e8d0d=0x0,_0x55f2dc=events[_0x386b('0x6')];_0x2e8d0d<_0x55f2dc;_0x2e8d0d++){var _0x4b27d4=events[_0x2e8d0d];var _0xd71fd7=createListener(_0x386b('0x7')+_0x4b27d4,_0x2e9952);UserEvents['on'](_0x4b27d4,_0xd71fd7);}}; \ No newline at end of file +var _0x2b28=['register','length','user:','remove','emit'];(function(_0x268dc1,_0x42ae73){var _0x447a42=function(_0x4d93cc){while(--_0x4d93cc){_0x268dc1['push'](_0x268dc1['shift']());}};_0x447a42(++_0x42ae73);}(_0x2b28,0x120));var _0x82b2=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x2b28[_0x1694f5];return _0x5b4321;};'use strict';var UserEvents=require('./user.events');var events=['save',_0x82b2('0x0'),'update'];function createListener(_0x31d6c2,_0x24485e){return function(_0x2d7a43){_0x24485e[_0x82b2('0x1')](_0x31d6c2,_0x2d7a43);};}function removeListener(_0xe22387,_0x1efdb1){return function(){UserEvents['removeListener'](_0xe22387,_0x1efdb1);};}exports[_0x82b2('0x2')]=function(_0x378bb8){for(var _0x58c0b3=0x0,_0x40d457=events[_0x82b2('0x3')];_0x58c0b3<_0x40d457;_0x58c0b3++){var _0x28bf5c=events[_0x58c0b3];var _0x4c534d=createListener(_0x82b2('0x4')+_0x28bf5c,_0x378bb8);UserEvents['on'](_0x28bf5c,_0x4c534d);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 1908d39..170bba4 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x3ee91e,_0x466a5a){var _0x239405=function(_0x3f2d09){while(--_0x3f2d09){_0x3ee91e['push'](_0x3ee91e['shift']());}};_0x239405(++_0x466a5a);}(_0x9c44,0x178));var _0x49c4=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9c44[_0x5d2803];return _0xdcad2c;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x56e3f2,_0x4c3db1){var _0x1a0106=function(_0x1e3960){while(--_0x1e3960){_0x56e3f2['push'](_0x56e3f2['shift']());}};_0x1a0106(++_0x4c3db1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 0f24671..6a21441 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 _0xab6f=['exports','INTEGER','sequelize'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xab6f,0x1af));var _0xfab6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xab6f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xfab6('0x0'));module[_0xfab6('0x1')]={'penalty':{'type':Sequelize[_0xfab6('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfb01=['INTEGER','exports'];(function(_0x4c912c,_0x5cf4aa){var _0x38c1ba=function(_0x5b1bf7){while(--_0x5b1bf7){_0x4c912c['push'](_0x4c912c['shift']());}};_0x38c1ba(++_0x5cf4aa);}(_0xfb01,0x153));var _0x1fb0=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0xfb01[_0x599e60];return _0x468e19;};'use strict';var Sequelize=require('sequelize');module[_0x1fb0('0x0')]={'penalty':{'type':Sequelize[_0x1fb0('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 3905efe..960b029 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 _0x792f=['request-promise','../../config/environment','./userChatQueue.attributes','UserChatQueue','lodash','api','moment','bluebird'];(function(_0xee1692,_0x56d5b6){var _0x46a683=function(_0x4a722c){while(--_0x4a722c){_0xee1692['push'](_0xee1692['shift']());}};_0x46a683(++_0x56d5b6);}(_0x792f,0x11c));var _0xf792=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x792f[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xf792('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf792('0x1'));var moment=require(_0xf792('0x2'));var BPromise=require(_0xf792('0x3'));var rp=require(_0xf792('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf792('0x5'));var attributes=require(_0xf792('0x6'));module['exports']=function(_0xf22ed5,_0x44ff55){return _0xf22ed5['define'](_0xf792('0x7'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x650e=['./userChatQueue.attributes','define','UserChatQueue','../../config/logger','api','request-promise','path','../../config/environment'];(function(_0xd2f4ac,_0x5aa8e5){var _0x9757b2=function(_0x442ced){while(--_0x442ced){_0xd2f4ac['push'](_0xd2f4ac['shift']());}};_0x9757b2(++_0x5aa8e5);}(_0x650e,0x15b));var _0xe650=function(_0x39388d,_0x4c69f4){_0x39388d=_0x39388d-0x0;var _0x109170=_0x650e[_0x39388d];return _0x109170;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe650('0x0'))(_0xe650('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe650('0x2'));var fs=require('fs');var path=require(_0xe650('0x3'));var rimraf=require('rimraf');var config=require(_0xe650('0x4'));var attributes=require(_0xe650('0x5'));module['exports']=function(_0xa13599,_0x614990){return _0xa13599[_0xe650('0x6')](_0xe650('0x7'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 6d377f0..5b5ca03 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 _0xd0bf=['UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x251b14,_0x410c59){var _0x513ac4=function(_0x1f86b2){while(--_0x1f86b2){_0x251b14['push'](_0x251b14['shift']());}};_0x513ac4(++_0x410c59);}(_0xd0bf,0x1ea));var _0xfd0b=function(_0x5045a2,_0x5757a3){_0x5045a2=_0x5045a2-0x0;var _0x137ee9=_0xd0bf[_0x5045a2];return _0x137ee9;};'use strict';var _=require(_0xfd0b('0x0'));var util=require(_0xfd0b('0x1'));var moment=require(_0xfd0b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfd0b('0x3'))['db'];var utils=require(_0xfd0b('0x4'));var logger=require('../../config/logger')(_0xfd0b('0x5'));var config=require(_0xfd0b('0x6'));var jayson=require(_0xfd0b('0x7'));var client=jayson[_0xfd0b('0x8')][_0xfd0b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f4ef3,_0x4d2129,_0x5948b8){return new BPromise(function(_0x553e09,_0x26b8b4){return client[_0xfd0b('0xa')](_0x1f4ef3,_0x5948b8)[_0xfd0b('0xb')](function(_0x6477e){logger[_0xfd0b('0xc')](_0xfd0b('0xd'),_0x4d2129,_0xfd0b('0xe'));logger[_0xfd0b('0xf')](_0xfd0b('0x10'),_0x4d2129,_0xfd0b('0xe'),JSON[_0xfd0b('0x11')](_0x6477e));if(_0x6477e[_0xfd0b('0x12')]){if(_0x6477e['error'][_0xfd0b('0x13')]===0x1f4){logger['error'](_0xfd0b('0xd'),_0x4d2129,_0x6477e[_0xfd0b('0x12')][_0xfd0b('0x14')]);return _0x26b8b4(_0x6477e['error'][_0xfd0b('0x14')]);}logger[_0xfd0b('0x12')](_0xfd0b('0xd'),_0x4d2129,_0x6477e[_0xfd0b('0x12')][_0xfd0b('0x14')]);return _0x553e09(_0x6477e[_0xfd0b('0x12')][_0xfd0b('0x14')]);}else{logger[_0xfd0b('0xc')]('UserChatQueue,\x20%s,\x20%s',_0x4d2129,'request\x20sent');_0x553e09(_0x6477e[_0xfd0b('0x15')]['message']);}})['catch'](function(_0x23b716){logger[_0xfd0b('0x12')]('UserChatQueue,\x20%s,\x20%s',_0x4d2129,_0x23b716);_0x26b8b4(_0x23b716);});});} \ No newline at end of file +var _0x53f7=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0x22688b,_0x34f2d2){var _0xd37dab=function(_0x47ee8c){while(--_0x47ee8c){_0x22688b['push'](_0x22688b['shift']());}};_0xd37dab(++_0x34f2d2);}(_0x53f7,0x12d));var _0x753f=function(_0x1c08f6,_0x14c077){_0x1c08f6=_0x1c08f6-0x0;var _0xbc156a=_0x53f7[_0x1c08f6];return _0xbc156a;};'use strict';var _=require('lodash');var util=require(_0x753f('0x0'));var moment=require(_0x753f('0x1'));var BPromise=require(_0x753f('0x2'));var rs=require(_0x753f('0x3'));var fs=require('fs');var Redis=require(_0x753f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x753f('0x5'))(_0x753f('0x6'));var config=require(_0x753f('0x7'));var jayson=require(_0x753f('0x8'));var client=jayson[_0x753f('0x9')][_0x753f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5f13fe,_0xe4fb14,_0xb1905f){return new BPromise(function(_0x56a401,_0x5473e0){return client[_0x753f('0xb')](_0x5f13fe,_0xb1905f)[_0x753f('0xc')](function(_0x5c808c){logger[_0x753f('0xd')]('UserChatQueue,\x20%s,\x20%s',_0xe4fb14,_0x753f('0xe'));logger['debug'](_0x753f('0xf'),_0xe4fb14,'request\x20sent',JSON[_0x753f('0x10')](_0x5c808c));if(_0x5c808c[_0x753f('0x11')]){if(_0x5c808c[_0x753f('0x11')][_0x753f('0x12')]===0x1f4){logger[_0x753f('0x11')](_0x753f('0x13'),_0xe4fb14,_0x5c808c['error'][_0x753f('0x14')]);return _0x5473e0(_0x5c808c[_0x753f('0x11')][_0x753f('0x14')]);}logger[_0x753f('0x11')](_0x753f('0x13'),_0xe4fb14,_0x5c808c[_0x753f('0x11')]['message']);return _0x56a401(_0x5c808c[_0x753f('0x11')][_0x753f('0x14')]);}else{logger[_0x753f('0xd')](_0x753f('0x13'),_0xe4fb14,_0x753f('0xe'));_0x56a401(_0x5c808c[_0x753f('0x15')][_0x753f('0x14')]);}})['catch'](function(_0x108b35){logger['error'](_0x753f('0x13'),_0xe4fb14,_0x108b35);_0x5473e0(_0x108b35);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index e20e0db..bfe1b3c 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x50f158,_0x1b49ef){var _0x380590=function(_0x197041){while(--_0x197041){_0x50f158['push'](_0x50f158['shift']());}};_0x380590(++_0x1b49ef);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x2e925e,_0x57f3f1){var _0x25b4d1=function(_0x262f19){while(--_0x262f19){_0x2e925e['push'](_0x2e925e['shift']());}};_0x25b4d1(++_0x57f3f1);}(_0x70e0,0x17b));var _0x070e=function(_0x3d29ab,_0x3c7e79){_0x3d29ab=_0x3d29ab-0x0;var _0x334e29=_0x70e0[_0x3d29ab];return _0x334e29;};'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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 92ef60b..ed32ab2 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 _0x8b87=['INTEGER','STRING','sequelize','exports'];(function(_0x5e760b,_0xd8ad88){var _0x315791=function(_0x24d2ce){while(--_0x24d2ce){_0x5e760b['push'](_0x5e760b['shift']());}};_0x315791(++_0xd8ad88);}(_0x8b87,0x11e));var _0x78b8=function(_0x1b4c5f,_0x5cffd6){_0x1b4c5f=_0x1b4c5f-0x0;var _0x25c1bd=_0x8b87[_0x1b4c5f];return _0x25c1bd;};'use strict';var Sequelize=require(_0x78b8('0x0'));module[_0x78b8('0x1')]={'penalty':{'type':Sequelize[_0x78b8('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x78b8('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x78b8('0x3')]}}; \ No newline at end of file +var _0x2a8e=['INTEGER'];(function(_0xa4f636,_0xaca1b6){var _0x37e02a=function(_0x49bd47){while(--_0x49bd47){_0xa4f636['push'](_0xa4f636['shift']());}};_0x37e02a(++_0xaca1b6);}(_0x2a8e,0x191));var _0xe2a8=function(_0x9e4cb2,_0x214243){_0x9e4cb2=_0x9e4cb2-0x0;var _0xd4cc55=_0x2a8e[_0x9e4cb2];return _0xd4cc55;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xe2a8('0x0')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xe2a8('0x0')],'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 8e22be5..4654465 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 _0xae59=['UserFaxQueue','user_has_fax_queues','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x2f7be9,_0x173b28){var _0x22b2ad=function(_0x2f50e4){while(--_0x2f50e4){_0x2f7be9['push'](_0x2f7be9['shift']());}};_0x22b2ad(++_0x173b28);}(_0xae59,0xd3));var _0x9ae5=function(_0x277e1a,_0x2878d0){_0x277e1a=_0x277e1a-0x0;var _0x609da3=_0xae59[_0x277e1a];return _0x609da3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9ae5('0x0'))(_0x9ae5('0x1'));var moment=require(_0x9ae5('0x2'));var BPromise=require('bluebird');var rp=require(_0x9ae5('0x3'));var fs=require('fs');var path=require(_0x9ae5('0x4'));var rimraf=require(_0x9ae5('0x5'));var config=require(_0x9ae5('0x6'));var attributes=require('./userFaxQueue.attributes');module[_0x9ae5('0x7')]=function(_0x54f97c,_0x5b04dc){return _0x54f97c[_0x9ae5('0x8')](_0x9ae5('0x9'),attributes,{'tableName':_0x9ae5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7568=['bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','user_has_fax_queues','lodash','util','../../config/logger','api','moment'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x7568,0xbb));var _0x8756=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x7568[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require(_0x8756('0x0'));var util=require(_0x8756('0x1'));var logger=require(_0x8756('0x2'))(_0x8756('0x3'));var moment=require(_0x8756('0x4'));var BPromise=require(_0x8756('0x5'));var rp=require(_0x8756('0x6'));var fs=require('fs');var path=require(_0x8756('0x7'));var rimraf=require(_0x8756('0x8'));var config=require(_0x8756('0x9'));var attributes=require(_0x8756('0xa'));module['exports']=function(_0x4dce69,_0x16b9b6){return _0x4dce69['define']('UserFaxQueue',attributes,{'tableName':_0x8756('0xb'),'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 f7973ca..791331d 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 _0x8058=['request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s'];(function(_0x49fb6e,_0x2b1a51){var _0x3c03cc=function(_0x2184ff){while(--_0x2184ff){_0x49fb6e['push'](_0x49fb6e['shift']());}};_0x3c03cc(++_0x2b1a51);}(_0x8058,0x162));var _0x8805=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x8058[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x8805('0x0'));var util=require(_0x8805('0x1'));var moment=require(_0x8805('0x2'));var BPromise=require(_0x8805('0x3'));var rs=require(_0x8805('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8805('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x8805('0x6'));var jayson=require(_0x8805('0x7'));var client=jayson[_0x8805('0x8')][_0x8805('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c3e01,_0x5abf41,_0x20ca0c){return new BPromise(function(_0x33567e,_0xf0c97){return client[_0x8805('0xa')](_0x1c3e01,_0x20ca0c)[_0x8805('0xb')](function(_0x5350eb){logger[_0x8805('0xc')](_0x8805('0xd'),_0x5abf41,_0x8805('0xe'));logger[_0x8805('0xf')](_0x8805('0x10'),_0x5abf41,_0x8805('0xe'),JSON[_0x8805('0x11')](_0x5350eb));if(_0x5350eb[_0x8805('0x12')]){if(_0x5350eb[_0x8805('0x12')][_0x8805('0x13')]===0x1f4){logger[_0x8805('0x12')](_0x8805('0xd'),_0x5abf41,_0x5350eb[_0x8805('0x12')]['message']);return _0xf0c97(_0x5350eb[_0x8805('0x12')]['message']);}logger[_0x8805('0x12')](_0x8805('0xd'),_0x5abf41,_0x5350eb[_0x8805('0x12')][_0x8805('0x14')]);return _0x33567e(_0x5350eb[_0x8805('0x12')]['message']);}else{logger[_0x8805('0xc')](_0x8805('0xd'),_0x5abf41,'request\x20sent');_0x33567e(_0x5350eb[_0x8805('0x15')]['message']);}})[_0x8805('0x16')](function(_0x5368f6){logger[_0x8805('0x12')](_0x8805('0xd'),_0x5abf41,_0x5368f6);_0xf0c97(_0x5368f6);});});} \ No newline at end of file +var _0x8153=['jayson/promise','client','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x306f2a,_0x22d466){var _0xc11026=function(_0xab5c71){while(--_0xab5c71){_0x306f2a['push'](_0x306f2a['shift']());}};_0xc11026(++_0x22d466);}(_0x8153,0x97));var _0x3815=function(_0xf61512,_0x511fc7){_0xf61512=_0xf61512-0x0;var _0x1a9f3e=_0x8153[_0xf61512];return _0x1a9f3e;};'use strict';var _=require(_0x3815('0x0'));var util=require(_0x3815('0x1'));var moment=require(_0x3815('0x2'));var BPromise=require(_0x3815('0x3'));var rs=require(_0x3815('0x4'));var fs=require('fs');var Redis=require(_0x3815('0x5'));var db=require(_0x3815('0x6'))['db'];var utils=require(_0x3815('0x7'));var logger=require('../../config/logger')(_0x3815('0x8'));var config=require(_0x3815('0x9'));var jayson=require(_0x3815('0xa'));var client=jayson[_0x3815('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x28b632,_0x3e30f2,_0x4a725f){return new BPromise(function(_0x7c8556,_0x1deb43){return client[_0x3815('0xc')](_0x28b632,_0x4a725f)[_0x3815('0xd')](function(_0x4a051a){logger[_0x3815('0xe')](_0x3815('0xf'),_0x3e30f2,_0x3815('0x10'));logger['debug']('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x3e30f2,_0x3815('0x10'),JSON[_0x3815('0x11')](_0x4a051a));if(_0x4a051a[_0x3815('0x12')]){if(_0x4a051a['error'][_0x3815('0x13')]===0x1f4){logger['error'](_0x3815('0xf'),_0x3e30f2,_0x4a051a[_0x3815('0x12')][_0x3815('0x14')]);return _0x1deb43(_0x4a051a[_0x3815('0x12')][_0x3815('0x14')]);}logger[_0x3815('0x12')](_0x3815('0xf'),_0x3e30f2,_0x4a051a[_0x3815('0x12')][_0x3815('0x14')]);return _0x7c8556(_0x4a051a[_0x3815('0x12')][_0x3815('0x14')]);}else{logger[_0x3815('0xe')](_0x3815('0xf'),_0x3e30f2,_0x3815('0x10'));_0x7c8556(_0x4a051a[_0x3815('0x15')]['message']);}})[_0x3815('0x16')](function(_0x4ad12f){logger[_0x3815('0x12')](_0x3815('0xf'),_0x3e30f2,_0x4ad12f);_0x1deb43(_0x4ad12f);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index d50c43a..7034dbd 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2c6fc0,_0x9d9592){var _0x4722b9=function(_0x4ac804){while(--_0x4ac804){_0x2c6fc0['push'](_0x2c6fc0['shift']());}};_0x4722b9(++_0x9d9592);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3cf4d3,_0x48065e){_0x3cf4d3=_0x3cf4d3-0x0;var _0x4e547b=_0xcb91[_0x3cf4d3];return _0x4e547b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5a9666,_0x30bc94){var _0x28601f=function(_0x52e447){while(--_0x52e447){_0x5a9666['push'](_0x5a9666['shift']());}};_0x28601f(++_0x30bc94);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 2fe1abc..9a64ffd 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 _0xac2b=['INTEGER','sequelize'];(function(_0x2588e4,_0x470392){var _0x3cd817=function(_0x184b50){while(--_0x184b50){_0x2588e4['push'](_0x2588e4['shift']());}};_0x3cd817(++_0x470392);}(_0xac2b,0x175));var _0xbac2=function(_0x53bf67,_0x4a3559){_0x53bf67=_0x53bf67-0x0;var _0x1a2701=_0xac2b[_0x53bf67];return _0x1a2701;};'use strict';var Sequelize=require(_0xbac2('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbac2('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3fdc=['exports','INTEGER'];(function(_0x4e220c,_0x39acb1){var _0x2a7f73=function(_0x2e67fa){while(--_0x2e67fa){_0x4e220c['push'](_0x4e220c['shift']());}};_0x2a7f73(++_0x39acb1);}(_0x3fdc,0x96));var _0xc3fd=function(_0x11871f,_0xaf6bd){_0x11871f=_0x11871f-0x0;var _0x5130ac=_0x3fdc[_0x11871f];return _0x5130ac;};'use strict';var Sequelize=require('sequelize');module[_0xc3fd('0x0')]={'penalty':{'type':Sequelize[_0xc3fd('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index ed209bf..f5d7e36 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 _0xaefc=['UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./userMailQueue.attributes','exports','define'];(function(_0x4dbda8,_0xbce830){var _0x1149ed=function(_0x299a39){while(--_0x299a39){_0x4dbda8['push'](_0x4dbda8['shift']());}};_0x1149ed(++_0xbce830);}(_0xaefc,0x154));var _0xcaef=function(_0x41469c,_0x1388a8){_0x41469c=_0x41469c-0x0;var _0x30caa3=_0xaefc[_0x41469c];return _0x30caa3;};'use strict';var _=require(_0xcaef('0x0'));var util=require(_0xcaef('0x1'));var logger=require(_0xcaef('0x2'))(_0xcaef('0x3'));var moment=require(_0xcaef('0x4'));var BPromise=require(_0xcaef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcaef('0x6'));var rimraf=require(_0xcaef('0x7'));var config=require('../../config/environment');var attributes=require(_0xcaef('0x8'));module[_0xcaef('0x9')]=function(_0x7fc236,_0x571eae){return _0x7fc236[_0xcaef('0xa')](_0xcaef('0xb'),attributes,{'tableName':_0xcaef('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf06b=['path','../../config/environment','exports','user_has_mail_queues','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x1bf3d9,_0x50a9bc){var _0x3c30e2=function(_0x162c8e){while(--_0x162c8e){_0x1bf3d9['push'](_0x1bf3d9['shift']());}};_0x3c30e2(++_0x50a9bc);}(_0xf06b,0x187));var _0xbf06=function(_0x3e3185,_0x5ae0b7){_0x3e3185=_0x3e3185-0x0;var _0x26c936=_0xf06b[_0x3e3185];return _0x26c936;};'use strict';var _=require(_0xbf06('0x0'));var util=require(_0xbf06('0x1'));var logger=require(_0xbf06('0x2'))('api');var moment=require('moment');var BPromise=require(_0xbf06('0x3'));var rp=require(_0xbf06('0x4'));var fs=require('fs');var path=require(_0xbf06('0x5'));var rimraf=require('rimraf');var config=require(_0xbf06('0x6'));var attributes=require('./userMailQueue.attributes');module[_0xbf06('0x7')]=function(_0x33fbea,_0x4fcf3a){return _0x33fbea['define']('UserMailQueue',attributes,{'tableName':_0xbf06('0x8'),'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 7b535a4..d4534a4 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 _0x4b84=['../../config/logger','rpc','http','then','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserMailQueue,\x20%s,\x20%s','message','lodash','util','randomstring','../../config/utils'];(function(_0x114a45,_0x364722){var _0x121422=function(_0x4dff92){while(--_0x4dff92){_0x114a45['push'](_0x114a45['shift']());}};_0x121422(++_0x364722);}(_0x4b84,0x1cc));var _0x44b8=function(_0x25b4a4,_0x2e081b){_0x25b4a4=_0x25b4a4-0x0;var _0x707267=_0x4b84[_0x25b4a4];return _0x707267;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x54274b,_0x327f59,_0x5947f7){return new BPromise(function(_0x3e87c5,_0x5a2353){return client['request'](_0x54274b,_0x5947f7)[_0x44b8('0x7')](function(_0x42319d){logger[_0x44b8('0x8')]('UserMailQueue,\x20%s,\x20%s',_0x327f59,_0x44b8('0x9'));logger[_0x44b8('0xa')](_0x44b8('0xb'),_0x327f59,_0x44b8('0x9'),JSON[_0x44b8('0xc')](_0x42319d));if(_0x42319d[_0x44b8('0xd')]){if(_0x42319d[_0x44b8('0xd')]['code']===0x1f4){logger[_0x44b8('0xd')](_0x44b8('0xe'),_0x327f59,_0x42319d['error'][_0x44b8('0xf')]);return _0x5a2353(_0x42319d['error'][_0x44b8('0xf')]);}logger[_0x44b8('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x327f59,_0x42319d[_0x44b8('0xd')]['message']);return _0x3e87c5(_0x42319d['error'][_0x44b8('0xf')]);}else{logger[_0x44b8('0x8')](_0x44b8('0xe'),_0x327f59,_0x44b8('0x9'));_0x3e87c5(_0x42319d['result']['message']);}})['catch'](function(_0x3fe9fb){logger['error'](_0x44b8('0xe'),_0x327f59,_0x3fe9fb);_0x5a2353(_0x3fe9fb);});});} \ No newline at end of file +var _0x7fbe=['request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x154b53,_0x256537){var _0x1dcde5=function(_0x540817){while(--_0x540817){_0x154b53['push'](_0x154b53['shift']());}};_0x1dcde5(++_0x256537);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x3c57c7,_0x18e494){_0x3c57c7=_0x3c57c7-0x0;var _0x9c2cbb=_0x7fbe[_0x3c57c7];return _0x9c2cbb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index a818b6e..84f9f7e 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 _0x927b=['../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x1356fc,_0x4d3b5b){var _0x1772c8=function(_0x5aee2d){while(--_0x5aee2d){_0x1356fc['push'](_0x1356fc['shift']());}};_0x1772c8(++_0x4d3b5b);}(_0x927b,0x159));var _0xb927=function(_0xafdf47,_0x38b5b3){_0xafdf47=_0xafdf47-0x0;var _0x1e6c17=_0x927b[_0xafdf47];return _0x1e6c17;};'use strict';var multer=require(_0xb927('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb927('0x1'));var express=require(_0xb927('0x2'));var router=express[_0xb927('0x3')]();var fs_extra=require(_0xb927('0x4'));var auth=require(_0xb927('0x5'));var interaction=require(_0xb927('0x6'));var config=require(_0xb927('0x7'));var controller=require(_0xb927('0x8'));router[_0xb927('0x9')]('/',auth[_0xb927('0xa')](),controller[_0xb927('0xb')]);module[_0xb927('0xc')]=router; \ No newline at end of file +var _0xbc77=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','post','isAuthenticated','sendUserNotification','exports'];(function(_0xa37a56,_0x3f104a){var _0x25c89b=function(_0x59eb38){while(--_0x59eb38){_0xa37a56['push'](_0xa37a56['shift']());}};_0x25c89b(++_0x3f104a);}(_0xbc77,0xb4));var _0x7bc7=function(_0x10d34b,_0x4fef76){_0x10d34b=_0x10d34b-0x0;var _0x92b0bf=_0xbc77[_0x10d34b];return _0x92b0bf;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x7bc7('0x0'));var express=require(_0x7bc7('0x1'));var router=express['Router']();var fs_extra=require(_0x7bc7('0x2'));var auth=require(_0x7bc7('0x3'));var interaction=require(_0x7bc7('0x4'));var config=require(_0x7bc7('0x5'));var controller=require('./userNotification.controller');router[_0x7bc7('0x6')]('/',auth[_0x7bc7('0x7')](),controller[_0x7bc7('0x8')]);module[_0x7bc7('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 068528e..928e0b7 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 _0x3a34=['TEXT','sequelize','exports','STRING'];(function(_0x4c184d,_0x4278ab){var _0x23d997=function(_0x22d068){while(--_0x22d068){_0x4c184d['push'](_0x4c184d['shift']());}};_0x23d997(++_0x4278ab);}(_0x3a34,0x115));var _0x43a3=function(_0x2bfd90,_0x102539){_0x2bfd90=_0x2bfd90-0x0;var _0x33e709=_0x3a34[_0x2bfd90];return _0x33e709;};'use strict';var Sequelize=require(_0x43a3('0x0'));module[_0x43a3('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0x43a3('0x2')]},'recipientsId':{'type':Sequelize[_0x43a3('0x3')]},'recipientsDescription':{'type':Sequelize[_0x43a3('0x2')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0x33f7=['sequelize','exports','STRING','TEXT','BOOLEAN'];(function(_0x175643,_0x1d7e2e){var _0x4d8179=function(_0x135c31){while(--_0x135c31){_0x175643['push'](_0x175643['shift']());}};_0x4d8179(++_0x1d7e2e);}(_0x33f7,0x15e));var _0x733f=function(_0x190ff6,_0x515cfd){_0x190ff6=_0x190ff6-0x0;var _0x5356d2=_0x33f7[_0x190ff6];return _0x5356d2;};'use strict';var Sequelize=require(_0x733f('0x0'));module[_0x733f('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0x733f('0x2')]},'recipientsId':{'type':Sequelize[_0x733f('0x3')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x733f('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 06ee484..71f91d4 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 _0x6cff=['User','union','queue','Queue','ids','push','all','map','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','lodash','crypto','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','./userNotification.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','reject','then','destroy','error','stack','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','view','Missing\x20\x27view\x27\x20parameter','recipients','ValidationError','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','openchannelqueue','smsqueue','whatsappqueue','team','user','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','forEach','recipient','emit','userNotification:send','catch','Template','findOne','html','startCase'];(function(_0x3d0b4d,_0x47cd13){var _0x3e57e1=function(_0x39b539){while(--_0x39b539){_0x3d0b4d['push'](_0x3d0b4d['shift']());}};_0x3e57e1(++_0x47cd13);}(_0x6cff,0x116));var _0xf6cf=function(_0x2bcb75,_0x5789a7){_0x2bcb75=_0x2bcb75-0x0;var _0x175345=_0x6cff[_0x2bcb75];return _0x175345;};'use strict';var emlformat=require(_0xf6cf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf6cf('0x1'));var jsonpatch=require(_0xf6cf('0x2'));var rp=require('request-promise');var moment=require(_0xf6cf('0x3'));var BPromise=require(_0xf6cf('0x4'));var Mustache=require(_0xf6cf('0x5'));var util=require(_0xf6cf('0x6'));var path=require(_0xf6cf('0x7'));var sox=require('sox');var csv=require(_0xf6cf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf6cf('0x9'));var squel=require('squel');var crypto=require(_0xf6cf('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf6cf('0xb'));var Papa=require('papaparse');var Redis=require(_0xf6cf('0xc'));var authService=require(_0xf6cf('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf6cf('0xe'));var logger=require(_0xf6cf('0xf'))(_0xf6cf('0x10'));var utils=require(_0xf6cf('0x11'));var config=require(_0xf6cf('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xf6cf('0x13')]=_['defaults'](config[_0xf6cf('0x13')],{'host':_0xf6cf('0x14'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf6cf('0x13')]));require(_0xf6cf('0x15'))[_0xf6cf('0x16')](socket);function respondWithStatusCode(_0x75a88a,_0x1825a3){_0x1825a3=_0x1825a3||0xcc;return function(_0x2e8d55){if(_0x2e8d55){return _0x75a88a[_0xf6cf('0x17')](_0x1825a3);}return _0x75a88a[_0xf6cf('0x18')](_0x1825a3)[_0xf6cf('0x19')]();};}function respondWithResult(_0x1e747a,_0x3643bc){_0x3643bc=_0x3643bc||0xc8;return function(_0x523850){if(_0x523850){return _0x1e747a[_0xf6cf('0x18')](_0x3643bc)[_0xf6cf('0x1a')](_0x523850);}};}function respondWithFilteredResult(_0x4ddd29,_0x2449e4){return function(_0x439d27){if(_0x439d27){var _0x4371e0=typeof _0x2449e4[_0xf6cf('0x1b')]===_0xf6cf('0x1c')&&typeof _0x2449e4[_0xf6cf('0x1d')]===_0xf6cf('0x1c');var _0x16c4b3=_0x439d27[_0xf6cf('0x1e')];var _0x1a9e56=_0x4371e0?0x0:_0x2449e4[_0xf6cf('0x1b')];var _0x38b3d7=_0x4371e0?_0x439d27['count']:_0x2449e4[_0xf6cf('0x1b')]+_0x2449e4['limit'];var _0x198bc5;if(_0x38b3d7>=_0x16c4b3){_0x38b3d7=_0x16c4b3;_0x198bc5=0xc8;}else{_0x198bc5=0xce;}_0x4ddd29[_0xf6cf('0x18')](_0x198bc5);return _0x4ddd29['set']('Content-Range',_0x1a9e56+'-'+_0x38b3d7+'/'+_0x16c4b3)[_0xf6cf('0x1a')](_0x439d27);}return null;};}function patchUpdates(_0x4ea0d0){return function(_0x195029){try{jsonpatch['apply'](_0x195029,_0x4ea0d0,!![]);}catch(_0x4492c6){return BPromise[_0xf6cf('0x1f')](_0x4492c6);}return _0x195029['save']();};}function saveUpdates(_0x594624,_0x3fb53b){return function(_0x2da6de){if(_0x2da6de){return _0x2da6de['update'](_0x594624)[_0xf6cf('0x20')](function(_0x2f541b){return _0x2f541b;});}return null;};}function removeEntity(_0x5d26eb,_0x1bc364){return function(_0x472480){if(_0x472480){return _0x472480[_0xf6cf('0x21')]()[_0xf6cf('0x20')](function(){_0x5d26eb[_0xf6cf('0x18')](0xcc)[_0xf6cf('0x19')]();});}};}function handleEntityNotFound(_0x25b40e,_0x2cd10d){return function(_0x58e940){if(!_0x58e940){_0x25b40e[_0xf6cf('0x17')](0x194);}return _0x58e940;};}function handleError(_0x19dd45,_0xab37e3){_0xab37e3=_0xab37e3||0x1f4;return function(_0x3ee446){logger[_0xf6cf('0x22')](_0x3ee446[_0xf6cf('0x23')]);if(_0x3ee446[_0xf6cf('0x24')]){delete _0x3ee446[_0xf6cf('0x24')];}_0x19dd45[_0xf6cf('0x18')](_0xab37e3)[_0xf6cf('0x25')](_0x3ee446);};}exports[_0xf6cf('0x26')]=function(_0x2d0c9c,_0x1c5a57,_0x542229){if(!_0x2d0c9c[_0xf6cf('0x27')][_0xf6cf('0x28')](_0xf6cf('0x29'))&&!_0x2d0c9c[_0xf6cf('0x27')][_0xf6cf('0x28')](_0xf6cf('0x2a'))){throw new db[(_0xf6cf('0x2b'))]['ValidationError']('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x2d0c9c['body'][_0xf6cf('0x28')](_0xf6cf('0x2a'))&&!_0x2d0c9c['body'][_0xf6cf('0x28')](_0xf6cf('0x2c'))){throw new db['Sequelize']['ValidationError'](_0xf6cf('0x2d'));}if(!_0x2d0c9c[_0xf6cf('0x27')][_0xf6cf('0x28')](_0xf6cf('0x2e'))){throw new db[(_0xf6cf('0x2b'))][(_0xf6cf('0x2f'))](_0xf6cf('0x30'));}else{try{var _0x55028a=JSON[_0xf6cf('0x31')](_0x2d0c9c[_0xf6cf('0x27')][_0xf6cf('0x2e')]);}catch(_0x302eac){logger['error'](_0x302eac);throw new db[(_0xf6cf('0x2b'))][(_0xf6cf('0x2f'))](_0xf6cf('0x32'));}var _0x588aee=['chatqueue',_0xf6cf('0x33'),_0xf6cf('0x34'),_0xf6cf('0x35'),_0xf6cf('0x36'),'voicequeue',_0xf6cf('0x37'),_0xf6cf('0x38'),_0xf6cf('0x39')];if(_['some'](_0x55028a,function(_0x1ed731){return!_[_0xf6cf('0x3a')](_0x588aee,_0x1ed731[_0xf6cf('0x3b')]['toLowerCase']());})){throw new db[(_0xf6cf('0x2b'))][(_0xf6cf('0x2f'))](_0xf6cf('0x3c'));}}}var _0x392ca1={};_0x392ca1[_0xf6cf('0x3d')]=_0x2d0c9c[_0xf6cf('0x27')]['hasOwnProperty'](_0xf6cf('0x3d'))?_0x2d0c9c[_0xf6cf('0x27')][_0xf6cf('0x3d')]:_0x2d0c9c[_0xf6cf('0x39')][_0xf6cf('0x3e')];_0x392ca1[_0xf6cf('0x3f')]=_[_0xf6cf('0x40')](_0x2d0c9c['body'][_0xf6cf('0x3f')])?null:_0x2d0c9c['body'][_0xf6cf('0x3f')];_0x392ca1[_0xf6cf('0x41')]=_0x2d0c9c[_0xf6cf('0x27')]['beep']||![];_0x392ca1[_0xf6cf('0x42')]=_0x2d0c9c[_0xf6cf('0x39')]['id'];return getContent(_0x2d0c9c['body'])[_0xf6cf('0x20')](function(_0x2e9963){_0x392ca1[_0xf6cf('0x27')]=_0x2e9963;return getRecipients(_0x55028a);})['then'](function(_0x22ab71){_0x392ca1[_0xf6cf('0x43')]=_[_0xf6cf('0x44')](_0x22ab71)[_0xf6cf('0x45')](',');return db[_0xf6cf('0x46')][_0xf6cf('0x47')](function(_0x5de0a8){return db[_0xf6cf('0x48')]['create'](_0x392ca1,{'raw':!![],'transaction':_0x5de0a8})[_0xf6cf('0x20')](function(_0x5bebac){var _0x2e8a0d={'sender':_0x392ca1['senderName'],'description':_0x392ca1[_0xf6cf('0x3f')],'content':_0x392ca1[_0xf6cf('0x27')],'beep':_0x392ca1[_0xf6cf('0x41')]};_0x22ab71[_0xf6cf('0x49')](function(_0x2956fb){_0x2e8a0d[_0xf6cf('0x4a')]=_0x2956fb;socket[_0xf6cf('0x4b')](_0xf6cf('0x4c'),_0x2e8a0d);});return _0x5bebac;});});})[_0xf6cf('0x20')](respondWithResult(_0x1c5a57,0xc9))[_0xf6cf('0x4d')](handleError(_0x1c5a57,null));};function getContent(_0x591905){return new BPromise(function(_0x30f5e0,_0x2e5749){if(_0x591905['text']){_0x30f5e0(_0x591905[_0xf6cf('0x29')]);return;}return db[_0xf6cf('0x4e')][_0xf6cf('0x4f')]({'attributes':['html'],'where':{'id':_0x591905[_0xf6cf('0x2a')]},'raw':!![]})[_0xf6cf('0x20')](function(_0x1a527c){if(!_0x1a527c)throw new db['Sequelize']['ValidationError']('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x1eb254=Mustache['render'](_0x1a527c[_0xf6cf('0x50')],_0x591905[_0xf6cf('0x2c')]);_0x30f5e0(_0x1eb254);})[_0xf6cf('0x4d')](function(_0x55551d){_0x2e5749(_0x55551d);});});}function getRecipients(_0x3770b5){return new BPromise(function(_0x43842c,_0x3104e7){var _0x5e967f=[];var _0x5500b4=[];_0x3770b5[_0xf6cf('0x49')](function(_0x483b4b){var _0x12fd09=_[_0xf6cf('0x51')](_0x483b4b[_0xf6cf('0x3b')]['toLowerCase']());if(_0x12fd09===_0xf6cf('0x52')){_0x5e967f=_[_0xf6cf('0x53')](_0x5e967f,_0x483b4b['ids']);}else{if(_[_0xf6cf('0x3a')](_0x12fd09,_0xf6cf('0x54')))_0x12fd09=_0x12fd09['replace'](_0xf6cf('0x54'),_0xf6cf('0x55'));_0x483b4b[_0xf6cf('0x56')][_0xf6cf('0x49')](function(_0x77490a){_0x5500b4[_0xf6cf('0x57')](getAgents(_0x12fd09,_0x77490a));});}});return BPromise[_0xf6cf('0x58')](_0x5500b4)[_0xf6cf('0x20')](function(_0x141048){_0x5e967f=_[_0xf6cf('0x53')](_0x5e967f,_['flatten'](_0x141048));_0x43842c(_0x5e967f);})[_0xf6cf('0x4d')](function(_0xa991d3){_0x3104e7(_0xa991d3);});});}function getAgents(_0x1b62c8,_0x27108c){return new BPromise(function(_0x4b6d22,_0x21c420){return db[_0x1b62c8][_0xf6cf('0x4f')]({'where':{'id':_0x27108c}})[_0xf6cf('0x20')](function(_0x3811dd){return _0x3811dd['getAgents']({'attributes':['id'],'raw':!![]})['then'](function(_0x3a556d){var _0x13cb62=_[_0xf6cf('0x59')](_0x3a556d,'id');_0x4b6d22(_0x13cb62);});})[_0xf6cf('0x4d')](function(_0x879956){_0x21c420(_0x879956);});});} \ No newline at end of file +var _0x54d4=['queue','all','union','flatten','getAgents','map','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./userNotification.socket','register','sendStatus','status','end','offset','undefined','count','Content-Range','json','save','update','then','destroy','error','name','send','sendUserNotification','body','hasOwnProperty','text','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','Missing\x20\x27view\x27\x20parameter','recipients','parse','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','user','includes','toLowerCase','senderName','fullname','isEmpty','recipientsDescription','beep','SenderId','sortBy','join','transaction','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','model','ids'];(function(_0x3638a8,_0x32b8f9){var _0x46ca0e=function(_0x4bd7f3){while(--_0x4bd7f3){_0x3638a8['push'](_0x3638a8['shift']());}};_0x46ca0e(++_0x32b8f9);}(_0x54d4,0x66));var _0x454d=function(_0x521ad6,_0x547638){_0x521ad6=_0x521ad6-0x0;var _0x27a4e5=_0x54d4[_0x521ad6];return _0x27a4e5;};'use strict';var emlformat=require(_0x454d('0x0'));var rimraf=require(_0x454d('0x1'));var zipdir=require(_0x454d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x454d('0x3'));var moment=require(_0x454d('0x4'));var BPromise=require(_0x454d('0x5'));var Mustache=require('mustache');var util=require(_0x454d('0x6'));var path=require('path');var sox=require(_0x454d('0x7'));var csv=require(_0x454d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x454d('0x9'));var _=require(_0x454d('0xa'));var squel=require(_0x454d('0xb'));var crypto=require(_0x454d('0xc'));var jsforce=require(_0x454d('0xd'));var deskjs=require(_0x454d('0xe'));var toCsv=require(_0x454d('0x8'));var querystring=require(_0x454d('0xf'));var Papa=require(_0x454d('0x10'));var Redis=require(_0x454d('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x454d('0x12'));var hardwareService=require(_0x454d('0x13'));var logger=require(_0x454d('0x14'))(_0x454d('0x15'));var utils=require(_0x454d('0x16'));var config=require(_0x454d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x454d('0x18'))['db'];config['redis']=_[_0x454d('0x19')](config['redis'],{'host':_0x454d('0x1a'),'port':0x18eb});var socket=require(_0x454d('0x1b'))(new Redis(config[_0x454d('0x1c')]));require(_0x454d('0x1d'))[_0x454d('0x1e')](socket);function respondWithStatusCode(_0x22d031,_0x10ae94){_0x10ae94=_0x10ae94||0xcc;return function(_0x48ede3){if(_0x48ede3){return _0x22d031[_0x454d('0x1f')](_0x10ae94);}return _0x22d031[_0x454d('0x20')](_0x10ae94)[_0x454d('0x21')]();};}function respondWithResult(_0x308dde,_0x2096b2){_0x2096b2=_0x2096b2||0xc8;return function(_0xff5d10){if(_0xff5d10){return _0x308dde[_0x454d('0x20')](_0x2096b2)['json'](_0xff5d10);}};}function respondWithFilteredResult(_0x4ad198,_0x20403c){return function(_0x568844){if(_0x568844){var _0x221387=typeof _0x20403c[_0x454d('0x22')]===_0x454d('0x23')&&typeof _0x20403c['limit']===_0x454d('0x23');var _0x463faa=_0x568844[_0x454d('0x24')];var _0x27f715=_0x221387?0x0:_0x20403c[_0x454d('0x22')];var _0x126469=_0x221387?_0x568844[_0x454d('0x24')]:_0x20403c['offset']+_0x20403c['limit'];var _0x7ee48f;if(_0x126469>=_0x463faa){_0x126469=_0x463faa;_0x7ee48f=0xc8;}else{_0x7ee48f=0xce;}_0x4ad198['status'](_0x7ee48f);return _0x4ad198['set'](_0x454d('0x25'),_0x27f715+'-'+_0x126469+'/'+_0x463faa)[_0x454d('0x26')](_0x568844);}return null;};}function patchUpdates(_0x2bd38c){return function(_0x10d57a){try{jsonpatch['apply'](_0x10d57a,_0x2bd38c,!![]);}catch(_0x4407a6){return BPromise['reject'](_0x4407a6);}return _0x10d57a[_0x454d('0x27')]();};}function saveUpdates(_0x42bd10,_0x4e8af0){return function(_0x1c5135){if(_0x1c5135){return _0x1c5135[_0x454d('0x28')](_0x42bd10)[_0x454d('0x29')](function(_0x39ddba){return _0x39ddba;});}return null;};}function removeEntity(_0x425fa6,_0x255646){return function(_0x5c4cf0){if(_0x5c4cf0){return _0x5c4cf0[_0x454d('0x2a')]()[_0x454d('0x29')](function(){_0x425fa6[_0x454d('0x20')](0xcc)[_0x454d('0x21')]();});}};}function handleEntityNotFound(_0x461913,_0x5aada4){return function(_0x496da9){if(!_0x496da9){_0x461913['sendStatus'](0x194);}return _0x496da9;};}function handleError(_0xd9db7d,_0x142cb8){_0x142cb8=_0x142cb8||0x1f4;return function(_0x2f39a4){logger[_0x454d('0x2b')](_0x2f39a4['stack']);if(_0x2f39a4[_0x454d('0x2c')]){delete _0x2f39a4[_0x454d('0x2c')];}_0xd9db7d[_0x454d('0x20')](_0x142cb8)[_0x454d('0x2d')](_0x2f39a4);};}exports[_0x454d('0x2e')]=function(_0x2d0f86,_0x1b37c5,_0x40aa64){if(!_0x2d0f86[_0x454d('0x2f')][_0x454d('0x30')](_0x454d('0x31'))&&!_0x2d0f86[_0x454d('0x2f')][_0x454d('0x30')]('TemplateId')){throw new db[(_0x454d('0x32'))][(_0x454d('0x33'))](_0x454d('0x34'));}else{if(_0x2d0f86[_0x454d('0x2f')][_0x454d('0x30')](_0x454d('0x35'))&&!_0x2d0f86[_0x454d('0x2f')]['hasOwnProperty']('view')){throw new db[(_0x454d('0x32'))][(_0x454d('0x33'))](_0x454d('0x36'));}if(!_0x2d0f86[_0x454d('0x2f')][_0x454d('0x30')](_0x454d('0x37'))){throw new db[(_0x454d('0x32'))][(_0x454d('0x33'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x299135=JSON[_0x454d('0x38')](_0x2d0f86[_0x454d('0x2f')][_0x454d('0x37')]);}catch(_0x74bfe4){logger[_0x454d('0x2b')](_0x74bfe4);throw new db[(_0x454d('0x32'))]['ValidationError']('Invalid\x20\x27recipients\x27\x20object');}var _0x2f3e8b=[_0x454d('0x39'),_0x454d('0x3a'),_0x454d('0x3b'),_0x454d('0x3c'),_0x454d('0x3d'),_0x454d('0x3e'),'whatsappqueue','team',_0x454d('0x3f')];if(_['some'](_0x299135,function(_0x50bab3){return!_[_0x454d('0x40')](_0x2f3e8b,_0x50bab3['model'][_0x454d('0x41')]());})){throw new db[(_0x454d('0x32'))][(_0x454d('0x33'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x14c546={};_0x14c546[_0x454d('0x42')]=_0x2d0f86['body']['hasOwnProperty'](_0x454d('0x42'))?_0x2d0f86[_0x454d('0x2f')][_0x454d('0x42')]:_0x2d0f86[_0x454d('0x3f')][_0x454d('0x43')];_0x14c546['recipientsDescription']=_[_0x454d('0x44')](_0x2d0f86[_0x454d('0x2f')][_0x454d('0x45')])?null:_0x2d0f86[_0x454d('0x2f')][_0x454d('0x45')];_0x14c546[_0x454d('0x46')]=_0x2d0f86['body'][_0x454d('0x46')]||![];_0x14c546[_0x454d('0x47')]=_0x2d0f86[_0x454d('0x3f')]['id'];return getContent(_0x2d0f86[_0x454d('0x2f')])[_0x454d('0x29')](function(_0x19aa5a){_0x14c546['body']=_0x19aa5a;return getRecipients(_0x299135);})['then'](function(_0x25de02){_0x14c546['recipientsId']=_[_0x454d('0x48')](_0x25de02)[_0x454d('0x49')](',');return db['sequelize'][_0x454d('0x4a')](function(_0x345aa5){return db[_0x454d('0x4b')][_0x454d('0x4c')](_0x14c546,{'raw':!![],'transaction':_0x345aa5})[_0x454d('0x29')](function(_0x1b90e9){var _0x92ab50={'sender':_0x14c546[_0x454d('0x42')],'description':_0x14c546[_0x454d('0x45')],'content':_0x14c546[_0x454d('0x2f')],'beep':_0x14c546[_0x454d('0x46')]};_0x25de02[_0x454d('0x4d')](function(_0x55488b){_0x92ab50[_0x454d('0x4e')]=_0x55488b;socket[_0x454d('0x4f')](_0x454d('0x50'),_0x92ab50);});return _0x1b90e9;});});})['then'](respondWithResult(_0x1b37c5,0xc9))[_0x454d('0x51')](handleError(_0x1b37c5,null));};function getContent(_0x6b96e4){return new BPromise(function(_0x5442fc,_0x4fbece){if(_0x6b96e4[_0x454d('0x31')]){_0x5442fc(_0x6b96e4['text']);return;}return db[_0x454d('0x52')][_0x454d('0x53')]({'attributes':[_0x454d('0x54')],'where':{'id':_0x6b96e4['TemplateId']},'raw':!![]})[_0x454d('0x29')](function(_0x46dba2){if(!_0x46dba2)throw new db['Sequelize'][(_0x454d('0x33'))](_0x454d('0x55'));var _0x2d0898=Mustache[_0x454d('0x56')](_0x46dba2[_0x454d('0x54')],_0x6b96e4['view']);_0x5442fc(_0x2d0898);})['catch'](function(_0x3f71cf){_0x4fbece(_0x3f71cf);});});}function getRecipients(_0x2b5dae){return new BPromise(function(_0x1af994,_0x48ccd2){var _0x12ea64=[];var _0x4c2326=[];_0x2b5dae[_0x454d('0x4d')](function(_0x267d6a){var _0x232d19=_[_0x454d('0x57')](_0x267d6a[_0x454d('0x58')][_0x454d('0x41')]());if(_0x232d19==='User'){_0x12ea64=_['union'](_0x12ea64,_0x267d6a[_0x454d('0x59')]);}else{if(_[_0x454d('0x40')](_0x232d19,_0x454d('0x5a')))_0x232d19=_0x232d19['replace'](_0x454d('0x5a'),'Queue');_0x267d6a[_0x454d('0x59')][_0x454d('0x4d')](function(_0x189257){_0x4c2326['push'](getAgents(_0x232d19,_0x189257));});}});return BPromise[_0x454d('0x5b')](_0x4c2326)[_0x454d('0x29')](function(_0x18bf58){_0x12ea64=_[_0x454d('0x5c')](_0x12ea64,_[_0x454d('0x5d')](_0x18bf58));_0x1af994(_0x12ea64);})['catch'](function(_0x367439){_0x48ccd2(_0x367439);});});}function getAgents(_0x608a9a,_0x4b6287){return new BPromise(function(_0x5dd822,_0x4f7a9f){return db[_0x608a9a][_0x454d('0x53')]({'where':{'id':_0x4b6287}})[_0x454d('0x29')](function(_0x3af18f){return _0x3af18f[_0x454d('0x5e')]({'attributes':['id'],'raw':!![]})[_0x454d('0x29')](function(_0x3b3d03){var _0x2ca16d=_[_0x454d('0x5f')](_0x3b3d03,'id');_0x5dd822(_0x2ca16d);});})[_0x454d('0x51')](function(_0x4b18ea){_0x4f7a9f(_0x4b18ea);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index f6c07f9..96f9c80 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 _0x7310=['remove','emit','hasOwnProperty','events','../../mysqldb','UserNotification','setMaxListeners','save'];(function(_0x4268eb,_0x79c33b){var _0x98b2e2=function(_0x10e454){while(--_0x10e454){_0x4268eb['push'](_0x4268eb['shift']());}};_0x98b2e2(++_0x79c33b);}(_0x7310,0xbb));var _0x0731=function(_0x5d6eaf,_0x5e8c49){_0x5d6eaf=_0x5d6eaf-0x0;var _0x8ab44b=_0x7310[_0x5d6eaf];return _0x8ab44b;};'use strict';var EventEmitter=require(_0x0731('0x0'));var UserNotification=require(_0x0731('0x1'))['db'][_0x0731('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x0731('0x3')](0x0);var events={'afterCreate':_0x0731('0x4'),'afterUpdate':'update','afterDestroy':_0x0731('0x5')};function emitEvent(_0x58314a){return function(_0x3ac732,_0x214777,_0x1a1214){UserNotificationEvents[_0x0731('0x6')](_0x58314a+':'+_0x3ac732['id'],_0x3ac732);UserNotificationEvents[_0x0731('0x6')](_0x58314a,_0x3ac732);_0x1a1214(null);};}for(var e in events){if(events[_0x0731('0x7')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file +var _0xd42d=['UserNotification','setMaxListeners','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x2abb92,_0x4d180c){var _0x1a09d1=function(_0xd6a15b){while(--_0xd6a15b){_0x2abb92['push'](_0x2abb92['shift']());}};_0x1a09d1(++_0x4d180c);}(_0xd42d,0x1ae));var _0xdd42=function(_0x4e0e26,_0x13a029){_0x4e0e26=_0x4e0e26-0x0;var _0x53b093=_0xd42d[_0x4e0e26];return _0x53b093;};'use strict';var EventEmitter=require(_0xdd42('0x0'));var UserNotification=require(_0xdd42('0x1'))['db'][_0xdd42('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xdd42('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdd42('0x4'),'afterDestroy':'remove'};function emitEvent(_0xe9be4a){return function(_0x469603,_0x50dd0e,_0x142064){UserNotificationEvents[_0xdd42('0x5')](_0xe9be4a+':'+_0x469603['id'],_0x469603);UserNotificationEvents[_0xdd42('0x5')](_0xe9be4a,_0x469603);_0x142064(null);};}for(var e in events){if(events[_0xdd42('0x6')](e)){var event=events[e];UserNotification[_0xdd42('0x7')](e,emitEvent(event));}}module[_0xdd42('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 811c142..abbeb86 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 _0x0d4f=['utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','./userNotification.attributes','exports','define','utf8mb4'];(function(_0x11494b,_0x59e319){var _0x22728d=function(_0x4e11e9){while(--_0x4e11e9){_0x11494b['push'](_0x11494b['shift']());}};_0x22728d(++_0x59e319);}(_0x0d4f,0x169));var _0xf0d4=function(_0x33bc64,_0x4d1e92){_0x33bc64=_0x33bc64-0x0;var _0x3fdd34=_0x0d4f[_0x33bc64];return _0x3fdd34;};'use strict';var _=require(_0xf0d4('0x0'));var util=require(_0xf0d4('0x1'));var logger=require(_0xf0d4('0x2'))('api');var moment=require(_0xf0d4('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf0d4('0x4'));var rimraf=require(_0xf0d4('0x5'));var config=require(_0xf0d4('0x6'));var attributes=require(_0xf0d4('0x7'));module[_0xf0d4('0x8')]=function(_0x270d1a,_0x364b1){return _0x270d1a[_0xf0d4('0x9')]('UserNotification',attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf0d4('0xa'),'collate':_0xf0d4('0xb')});}; \ No newline at end of file +var _0x06a6=['userNotifications','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./userNotification.attributes','exports','define'];(function(_0xea68f1,_0x9ab108){var _0xa3af29=function(_0x2a8b24){while(--_0x2a8b24){_0xea68f1['push'](_0xea68f1['shift']());}};_0xa3af29(++_0x9ab108);}(_0x06a6,0x12d));var _0x606a=function(_0x102705,_0xd2d3b0){_0x102705=_0x102705-0x0;var _0x125547=_0x06a6[_0x102705];return _0x125547;};'use strict';var _=require(_0x606a('0x0'));var util=require(_0x606a('0x1'));var logger=require(_0x606a('0x2'))(_0x606a('0x3'));var moment=require(_0x606a('0x4'));var BPromise=require(_0x606a('0x5'));var rp=require(_0x606a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x606a('0x7'));var attributes=require(_0x606a('0x8'));module[_0x606a('0x9')]=function(_0x52065b,_0x119592){return _0x52065b[_0x606a('0xa')]('UserNotification',attributes,{'tableName':_0x606a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index d93f36b..848578e 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 _0x0d18=['result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','register','request','then','info','UserNotification,\x20%s,\x20%s','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0x0d18,0x12e));var _0x80d1=function(_0x4c9058,_0x445379){_0x4c9058=_0x4c9058-0x0;var _0x309ec6=_0x0d18[_0x4c9058];return _0x309ec6;};'use strict';var _=require(_0x80d1('0x0'));var util=require(_0x80d1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x80d1('0x2'));var db=require(_0x80d1('0x3'))['db'];var utils=require(_0x80d1('0x4'));var logger=require(_0x80d1('0x5'))(_0x80d1('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x80d1('0x7')][_0x80d1('0x8')]({'port':0x232a});config[_0x80d1('0x9')]=_[_0x80d1('0xa')](config[_0x80d1('0x9')],{'host':_0x80d1('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./userNotification.socket')[_0x80d1('0xc')](socket);function respondWithRpcPromise(_0x4daeec,_0x1e3378,_0x3328c6){return new BPromise(function(_0x8e7699,_0x244e9d){return client[_0x80d1('0xd')](_0x4daeec,_0x3328c6)[_0x80d1('0xe')](function(_0x4d999f){logger[_0x80d1('0xf')](_0x80d1('0x10'),_0x1e3378,'request\x20sent');logger['debug'](_0x80d1('0x11'),_0x1e3378,_0x80d1('0x12'),JSON[_0x80d1('0x13')](_0x4d999f));if(_0x4d999f[_0x80d1('0x14')]){if(_0x4d999f[_0x80d1('0x14')][_0x80d1('0x15')]===0x1f4){logger[_0x80d1('0x14')](_0x80d1('0x10'),_0x1e3378,_0x4d999f['error'][_0x80d1('0x16')]);return _0x244e9d(_0x4d999f[_0x80d1('0x14')]['message']);}logger['error'](_0x80d1('0x10'),_0x1e3378,_0x4d999f[_0x80d1('0x14')]['message']);return _0x8e7699(_0x4d999f[_0x80d1('0x14')]['message']);}else{logger['info']('UserNotification,\x20%s,\x20%s',_0x1e3378,_0x80d1('0x12'));_0x8e7699(_0x4d999f[_0x80d1('0x17')]['message']);}})[_0x80d1('0x18')](function(_0x311bad){logger[_0x80d1('0x14')]('UserNotification,\x20%s,\x20%s',_0x1e3378,_0x311bad);_0x244e9d(_0x311bad);});});} \ No newline at end of file +var _0x5ff4=['result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','redis','defaults','socket.io-emitter','./userNotification.socket','register','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2d4065,_0x38dc95){var _0xef6016=function(_0x195cee){while(--_0x195cee){_0x2d4065['push'](_0x2d4065['shift']());}};_0xef6016(++_0x38dc95);}(_0x5ff4,0xca));var _0x45ff=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x5ff4[_0x273c39];return _0x46d6b5;};'use strict';var _=require('lodash');var util=require(_0x45ff('0x0'));var moment=require(_0x45ff('0x1'));var BPromise=require(_0x45ff('0x2'));var rs=require(_0x45ff('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x45ff('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x45ff('0x5'))(_0x45ff('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x45ff('0x7')]['http']({'port':0x232a});config[_0x45ff('0x8')]=_[_0x45ff('0x9')](config[_0x45ff('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x45ff('0xa'))(new Redis(config[_0x45ff('0x8')]));require(_0x45ff('0xb'))[_0x45ff('0xc')](socket);function respondWithRpcPromise(_0x52f1d6,_0x347f27,_0x5154d9){return new BPromise(function(_0x50ddfa,_0x567e7b){return client['request'](_0x52f1d6,_0x5154d9)[_0x45ff('0xd')](function(_0x37ea32){logger[_0x45ff('0xe')](_0x45ff('0xf'),_0x347f27,_0x45ff('0x10'));logger[_0x45ff('0x11')](_0x45ff('0x12'),_0x347f27,'request\x20sent',JSON[_0x45ff('0x13')](_0x37ea32));if(_0x37ea32['error']){if(_0x37ea32[_0x45ff('0x14')][_0x45ff('0x15')]===0x1f4){logger[_0x45ff('0x14')]('UserNotification,\x20%s,\x20%s',_0x347f27,_0x37ea32[_0x45ff('0x14')][_0x45ff('0x16')]);return _0x567e7b(_0x37ea32[_0x45ff('0x14')][_0x45ff('0x16')]);}logger[_0x45ff('0x14')](_0x45ff('0xf'),_0x347f27,_0x37ea32[_0x45ff('0x14')][_0x45ff('0x16')]);return _0x50ddfa(_0x37ea32[_0x45ff('0x14')][_0x45ff('0x16')]);}else{logger['info'](_0x45ff('0xf'),_0x347f27,'request\x20sent');_0x50ddfa(_0x37ea32[_0x45ff('0x17')][_0x45ff('0x16')]);}})[_0x45ff('0x18')](function(_0x1a2359){logger[_0x45ff('0x14')]('UserNotification,\x20%s,\x20%s',_0x347f27,_0x1a2359);_0x567e7b(_0x1a2359);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 090ef4f..88f2ce4 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 _0xe7e0=['register','length','userNotification:','./userNotification.events','save','remove','update','emit'];(function(_0x2e5256,_0x21ed55){var _0xa380ae=function(_0x43dffc){while(--_0x43dffc){_0x2e5256['push'](_0x2e5256['shift']());}};_0xa380ae(++_0x21ed55);}(_0xe7e0,0xd3));var _0x0e7e=function(_0x442a22,_0x22ad39){_0x442a22=_0x442a22-0x0;var _0x427073=_0xe7e0[_0x442a22];return _0x427073;};'use strict';var UserNotificationEvents=require(_0x0e7e('0x0'));var events=[_0x0e7e('0x1'),_0x0e7e('0x2'),_0x0e7e('0x3')];function createListener(_0x28857d,_0x24f1c2){return function(_0x54a69b){_0x24f1c2[_0x0e7e('0x4')](_0x28857d,_0x54a69b);};}function removeListener(_0xb88d07,_0x5c943f){return function(){UserNotificationEvents['removeListener'](_0xb88d07,_0x5c943f);};}exports[_0x0e7e('0x5')]=function(_0x122abd){for(var _0x21d46c=0x0,_0x459194=events[_0x0e7e('0x6')];_0x21d46c<_0x459194;_0x21d46c++){var _0x509af4=events[_0x21d46c];var _0x43b72b=createListener(_0x0e7e('0x7')+_0x509af4,_0x122abd);UserNotificationEvents['on'](_0x509af4,_0x43b72b);}}; \ No newline at end of file +var _0xa2e0=['register','userNotification:','./userNotification.events','remove','update','emit','removeListener'];(function(_0x544463,_0x214963){var _0x1add2a=function(_0x5e1006){while(--_0x5e1006){_0x544463['push'](_0x544463['shift']());}};_0x1add2a(++_0x214963);}(_0xa2e0,0x105));var _0x0a2e=function(_0x5e1506,_0x10e46b){_0x5e1506=_0x5e1506-0x0;var _0x529a59=_0xa2e0[_0x5e1506];return _0x529a59;};'use strict';var UserNotificationEvents=require(_0x0a2e('0x0'));var events=['save',_0x0a2e('0x1'),_0x0a2e('0x2')];function createListener(_0x485f47,_0x1b3b59){return function(_0x14bc8f){_0x1b3b59[_0x0a2e('0x3')](_0x485f47,_0x14bc8f);};}function removeListener(_0x49375e,_0x53f4ad){return function(){UserNotificationEvents[_0x0a2e('0x4')](_0x49375e,_0x53f4ad);};}exports[_0x0a2e('0x5')]=function(_0x354055){for(var _0x3725bc=0x0,_0x2ff6b4=events['length'];_0x3725bc<_0x2ff6b4;_0x3725bc++){var _0xf5fcd0=events[_0x3725bc];var _0x39de83=createListener(_0x0a2e('0x6')+_0xf5fcd0,_0x354055);UserNotificationEvents['on'](_0xf5fcd0,_0x39de83);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index fb62558..150c43f 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0xeb4a01,_0xc83300){var _0x39d234=function(_0x585c79){while(--_0x585c79){_0xeb4a01['push'](_0xeb4a01['shift']());}};_0x39d234(++_0xc83300);}(_0xedd9,0xfc));var _0x9edd=function(_0x41430d,_0x45f545){_0x41430d=_0x41430d-0x0;var _0x3167da=_0xedd9[_0x41430d];return _0x3167da;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x1ae104,_0x8a970e){var _0x3ea7c5=function(_0x2e97b8){while(--_0x2e97b8){_0x1ae104['push'](_0x1ae104['shift']());}};_0x3ea7c5(++_0x8a970e);}(_0xe706,0xa3));var _0x6e70=function(_0x1c31f4,_0x8e8aeb){_0x1c31f4=_0x1c31f4-0x0;var _0x5a3f66=_0xe706[_0x1c31f4];return _0x5a3f66;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 31bf4a0..193626d 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 _0xc811=['exports'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xc811,0x182));var _0x1c81=function(_0x536a01,_0x5312d1){_0x536a01=_0x536a01-0x0;var _0x40fd57=_0xc811[_0x536a01];return _0x40fd57;};'use strict';var Sequelize=require('sequelize');module[_0x1c81('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x927c=['exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x927c,0x190));var _0xc927=function(_0x2ab41d,_0x29d10b){_0x2ab41d=_0x2ab41d-0x0;var _0x226b8d=_0x927c[_0x2ab41d];return _0x226b8d;};'use strict';var Sequelize=require('sequelize');module[_0xc927('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 736c2dc..8d6efc2 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 _0xb09b=['../../config/environment','./userOpenchannelQueue.attributes','exports','user_has_openchannel_queues','lodash','../../config/logger','api','bluebird','path','rimraf'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xb09b,0x1e4));var _0xbb09=function(_0x199c9b,_0xd6e4c3){_0x199c9b=_0x199c9b-0x0;var _0x2f4c42=_0xb09b[_0x199c9b];return _0x2f4c42;};'use strict';var _=require(_0xbb09('0x0'));var util=require('util');var logger=require(_0xbb09('0x1'))(_0xbb09('0x2'));var moment=require('moment');var BPromise=require(_0xbb09('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb09('0x4'));var rimraf=require(_0xbb09('0x5'));var config=require(_0xbb09('0x6'));var attributes=require(_0xbb09('0x7'));module[_0xbb09('0x8')]=function(_0x3b9d7a,_0x15a213){return _0x3b9d7a['define']('UserOpenchannelQueue',attributes,{'tableName':_0xbb09('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6564=['api','moment','bluebird','rimraf','./userOpenchannelQueue.attributes','exports','define','user_has_openchannel_queues','lodash','util','../../config/logger'];(function(_0x21dfaa,_0x7d966a){var _0x35001b=function(_0x39c120){while(--_0x39c120){_0x21dfaa['push'](_0x21dfaa['shift']());}};_0x35001b(++_0x7d966a);}(_0x6564,0x15d));var _0x4656=function(_0x46cd14,_0x4d29ce){_0x46cd14=_0x46cd14-0x0;var _0x1effe1=_0x6564[_0x46cd14];return _0x1effe1;};'use strict';var _=require(_0x4656('0x0'));var util=require(_0x4656('0x1'));var logger=require(_0x4656('0x2'))(_0x4656('0x3'));var moment=require(_0x4656('0x4'));var BPromise=require(_0x4656('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4656('0x6'));var config=require('../../config/environment');var attributes=require(_0x4656('0x7'));module[_0x4656('0x8')]=function(_0x2d600a,_0x3e57f2){return _0x2d600a[_0x4656('0x9')]('UserOpenchannelQueue',attributes,{'tableName':_0x4656('0xa'),'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 65fab80..bfa0c0a 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 _0x7966=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5499aa,_0x209ade){var _0x4ce862=function(_0x2b2af4){while(--_0x2b2af4){_0x5499aa['push'](_0x5499aa['shift']());}};_0x4ce862(++_0x209ade);}(_0x7966,0x1cc));var _0x6796=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x7966[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require(_0x6796('0x0'));var moment=require(_0x6796('0x1'));var BPromise=require(_0x6796('0x2'));var rs=require(_0x6796('0x3'));var fs=require('fs');var Redis=require(_0x6796('0x4'));var db=require(_0x6796('0x5'))['db'];var utils=require(_0x6796('0x6'));var logger=require(_0x6796('0x7'))(_0x6796('0x8'));var config=require(_0x6796('0x9'));var jayson=require(_0x6796('0xa'));var client=jayson[_0x6796('0xb')][_0x6796('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3371ad,_0x7accde,_0x209e25){return new BPromise(function(_0x19e6f5,_0x30701d){return client[_0x6796('0xd')](_0x3371ad,_0x209e25)[_0x6796('0xe')](function(_0x48069c){logger[_0x6796('0xf')](_0x6796('0x10'),_0x7accde,_0x6796('0x11'));logger[_0x6796('0x12')](_0x6796('0x13'),_0x7accde,_0x6796('0x11'),JSON[_0x6796('0x14')](_0x48069c));if(_0x48069c[_0x6796('0x15')]){if(_0x48069c['error'][_0x6796('0x16')]===0x1f4){logger['error'](_0x6796('0x10'),_0x7accde,_0x48069c[_0x6796('0x15')][_0x6796('0x17')]);return _0x30701d(_0x48069c[_0x6796('0x15')][_0x6796('0x17')]);}logger[_0x6796('0x15')](_0x6796('0x10'),_0x7accde,_0x48069c[_0x6796('0x15')][_0x6796('0x17')]);return _0x19e6f5(_0x48069c[_0x6796('0x15')][_0x6796('0x17')]);}else{logger[_0x6796('0xf')](_0x6796('0x10'),_0x7accde,_0x6796('0x11'));_0x19e6f5(_0x48069c[_0x6796('0x18')]['message']);}})[_0x6796('0x19')](function(_0x3093d9){logger[_0x6796('0x15')](_0x6796('0x10'),_0x7accde,_0x3093d9);_0x30701d(_0x3093d9);});});} \ No newline at end of file +var _0xa0d8=['result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa0d8,0x1ce));var _0x8a0d=function(_0x3ed540,_0x532559){_0x3ed540=_0x3ed540-0x0;var _0x13cada=_0xa0d8[_0x3ed540];return _0x13cada;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8a0d('0x0'));var BPromise=require(_0x8a0d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a0d('0x2'));var db=require(_0x8a0d('0x3'))['db'];var utils=require(_0x8a0d('0x4'));var logger=require(_0x8a0d('0x5'))(_0x8a0d('0x6'));var config=require(_0x8a0d('0x7'));var jayson=require(_0x8a0d('0x8'));var client=jayson[_0x8a0d('0x9')][_0x8a0d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x56c1c9,_0x2f83c9,_0x3a7de4){return new BPromise(function(_0x202827,_0x177821){return client[_0x8a0d('0xb')](_0x56c1c9,_0x3a7de4)['then'](function(_0x3913a1){logger[_0x8a0d('0xc')](_0x8a0d('0xd'),_0x2f83c9,'request\x20sent');logger[_0x8a0d('0xe')](_0x8a0d('0xf'),_0x2f83c9,_0x8a0d('0x10'),JSON[_0x8a0d('0x11')](_0x3913a1));if(_0x3913a1['error']){if(_0x3913a1[_0x8a0d('0x12')][_0x8a0d('0x13')]===0x1f4){logger[_0x8a0d('0x12')](_0x8a0d('0xd'),_0x2f83c9,_0x3913a1[_0x8a0d('0x12')][_0x8a0d('0x14')]);return _0x177821(_0x3913a1[_0x8a0d('0x12')]['message']);}logger[_0x8a0d('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x2f83c9,_0x3913a1['error'][_0x8a0d('0x14')]);return _0x202827(_0x3913a1[_0x8a0d('0x12')]['message']);}else{logger['info'](_0x8a0d('0xd'),_0x2f83c9,_0x8a0d('0x10'));_0x202827(_0x3913a1[_0x8a0d('0x15')][_0x8a0d('0x14')]);}})[_0x8a0d('0x16')](function(_0x7bbc0){logger['error'](_0x8a0d('0xd'),_0x2f83c9,_0x7bbc0);_0x177821(_0x7bbc0);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 21fc5dc..106df9c 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 _0x36b2=['util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','/:id/clone','clone','post','addSections','put','update','delete','destroy','removeResources','multer'];(function(_0x13572e,_0x427d52){var _0x5ce115=function(_0x1167c9){while(--_0x1167c9){_0x13572e['push'](_0x13572e['shift']());}};_0x5ce115(++_0x427d52);}(_0x36b2,0x6b));var _0x236b=function(_0x1ec8f9,_0x20e983){_0x1ec8f9=_0x1ec8f9-0x0;var _0x1520ec=_0x36b2[_0x1ec8f9];return _0x1520ec;};'use strict';var multer=require(_0x236b('0x0'));var util=require(_0x236b('0x1'));var path=require(_0x236b('0x2'));var timeout=require('connect-timeout');var express=require(_0x236b('0x3'));var router=express[_0x236b('0x4')]();var fs_extra=require(_0x236b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x236b('0x6'));var config=require(_0x236b('0x7'));var controller=require('./userProfile.controller');router[_0x236b('0x8')]('/',auth[_0x236b('0x9')](),controller[_0x236b('0xa')]);router[_0x236b('0x8')](_0x236b('0xb'),auth[_0x236b('0x9')](),controller['describe']);router[_0x236b('0x8')](_0x236b('0xc'),auth[_0x236b('0x9')](),controller[_0x236b('0xd')]);router['get'](_0x236b('0xe'),auth[_0x236b('0x9')](),controller[_0x236b('0xf')]);router['get'](_0x236b('0x10'),auth[_0x236b('0x9')](),controller[_0x236b('0x11')]);router['post']('/',auth[_0x236b('0x9')](),controller['create']);router['post'](_0x236b('0x12'),auth['isAuthenticated'](),controller[_0x236b('0x13')]);router[_0x236b('0x14')](_0x236b('0xe'),auth[_0x236b('0x9')](),controller[_0x236b('0x15')]);router[_0x236b('0x14')](_0x236b('0x10'),auth['isAuthenticated'](),controller['addResources']);router[_0x236b('0x16')](_0x236b('0xc'),auth[_0x236b('0x9')](),controller[_0x236b('0x17')]);router[_0x236b('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x236b('0x19')]);router['delete'](_0x236b('0xe'),auth[_0x236b('0x9')](),controller['removeSections']);router['delete'](_0x236b('0x10'),auth['isAuthenticated'](),controller[_0x236b('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x91ed=['path','connect-timeout','express','../../components/interaction/service','./userProfile.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/sections','/:id/resources','getResources','post','create','addSections','put','update','destroy','delete','removeSections','removeResources','exports','util'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0x91ed,0xb5));var _0xd91e=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x91ed[_0x1deb03];return _0x189fe7;};'use strict';var multer=require('multer');var util=require(_0xd91e('0x0'));var path=require(_0xd91e('0x1'));var timeout=require(_0xd91e('0x2'));var express=require(_0xd91e('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd91e('0x4'));var config=require('../../config/environment');var controller=require(_0xd91e('0x5'));router['get']('/',auth[_0xd91e('0x6')](),controller[_0xd91e('0x7')]);router[_0xd91e('0x8')](_0xd91e('0x9'),auth[_0xd91e('0x6')](),controller[_0xd91e('0xa')]);router[_0xd91e('0x8')](_0xd91e('0xb'),auth[_0xd91e('0x6')](),controller[_0xd91e('0xc')]);router[_0xd91e('0x8')](_0xd91e('0xd'),auth[_0xd91e('0x6')](),controller['getSections']);router[_0xd91e('0x8')](_0xd91e('0xe'),auth[_0xd91e('0x6')](),controller[_0xd91e('0xf')]);router[_0xd91e('0x10')]('/',auth[_0xd91e('0x6')](),controller[_0xd91e('0x11')]);router[_0xd91e('0x10')]('/:id/clone',auth['isAuthenticated'](),controller['clone']);router[_0xd91e('0x10')](_0xd91e('0xd'),auth[_0xd91e('0x6')](),controller[_0xd91e('0x12')]);router[_0xd91e('0x10')](_0xd91e('0xe'),auth[_0xd91e('0x6')](),controller['addResources']);router[_0xd91e('0x13')](_0xd91e('0xb'),auth['isAuthenticated'](),controller[_0xd91e('0x14')]);router['delete'](_0xd91e('0xb'),auth[_0xd91e('0x6')](),controller[_0xd91e('0x15')]);router[_0xd91e('0x16')](_0xd91e('0xd'),auth[_0xd91e('0x6')](),controller[_0xd91e('0x17')]);router[_0xd91e('0x16')]('/:id/resources',auth[_0xd91e('0x6')](),controller[_0xd91e('0x18')]);module[_0xd91e('0x19')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index dbc65a5..1c6fcd8 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 _0x5daa=['setDataValue','crudPermissions','join','getDataValue','split','STRING','BOOLEAN','exports'];(function(_0x4d8666,_0x2ff19d){var _0x37175b=function(_0x1b8de6){while(--_0x1b8de6){_0x4d8666['push'](_0x4d8666['shift']());}};_0x37175b(++_0x2ff19d);}(_0x5daa,0x18f));var _0xa5da=function(_0x309f06,_0x134bf8){_0x309f06=_0x309f06-0x0;var _0x189309=_0x5daa[_0x309f06];return _0x189309;};'use strict';var Sequelize=require('sequelize');module[_0xa5da('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x5dccf5){this[_0xa5da('0x1')](_0xa5da('0x2'),_0x5dccf5?_0x5dccf5[_0xa5da('0x3')](''):[]);},'get':function(){return this[_0xa5da('0x4')](_0xa5da('0x2'))?this[_0xa5da('0x4')](_0xa5da('0x2'))[_0xa5da('0x5')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xa5da('0x6')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xa5da('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xa5da('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xa5da('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xa5da('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xa5da('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xa5da('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xa5da('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x566b=['exports','STRING','name','setDataValue','getDataValue','crudPermissions','BOOLEAN','sequelize'];(function(_0x4394b6,_0x12357f){var _0x360244=function(_0x5689a1){while(--_0x5689a1){_0x4394b6['push'](_0x4394b6['shift']());}};_0x360244(++_0x12357f);}(_0x566b,0x187));var _0xb566=function(_0x1bc013,_0x7771c6){_0x1bc013=_0x1bc013-0x0;var _0x55df36=_0x566b[_0x1bc013];return _0x55df36;};'use strict';var Sequelize=require(_0xb566('0x0'));module[_0xb566('0x1')]={'name':{'type':Sequelize[_0xb566('0x2')],'allowNull':![],'unique':_0xb566('0x3')},'crudPermissions':{'type':Sequelize[_0xb566('0x2')],'set':function(_0x2bcf3e){this[_0xb566('0x4')]('crudPermissions',_0x2bcf3e?_0x2bcf3e['join'](''):[]);},'get':function(){return this[_0xb566('0x5')](_0xb566('0x6'))?this[_0xb566('0x5')](_0xb566('0x6'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xb566('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xb566('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xb566('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xb566('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xb566('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xb566('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index bb7ba07..9ab38a6 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 _0xc0d3=['query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','include','findAll','rows','params','create','body','catch','clone','includeAll','options','find','get','omit','createdAt','updatedAt','crudPermissions','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','userProfileId','Resources','update','describe','sectionId','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','concat','push','findOne','Dashboard','forEach','resourceId','Plugin','sequelize','bulkCreate','removeResources','getResources','section','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','localhost','socket.io-emitter','redis','./userProfile.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','then','destroy','end','stack','send','index','map','UserProfile','rawAttributes','type','key','model','name'];(function(_0x4eb7e6,_0x451464){var _0x3cf508=function(_0x462471){while(--_0x462471){_0x4eb7e6['push'](_0x4eb7e6['shift']());}};_0x3cf508(++_0x451464);}(_0xc0d3,0x191));var _0x3c0d=function(_0x4717dc,_0x22cbf9){_0x4717dc=_0x4717dc-0x0;var _0x23025b=_0xc0d3[_0x4717dc];return _0x23025b;};'use strict';var emlformat=require(_0x3c0d('0x0'));var rimraf=require(_0x3c0d('0x1'));var zipdir=require(_0x3c0d('0x2'));var jsonpatch=require(_0x3c0d('0x3'));var rp=require(_0x3c0d('0x4'));var moment=require(_0x3c0d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3c0d('0x6'));var util=require('util');var path=require(_0x3c0d('0x7'));var sox=require(_0x3c0d('0x8'));var csv=require(_0x3c0d('0x9'));var ejs=require(_0x3c0d('0xa'));var fs=require('fs');var fs_extra=require(_0x3c0d('0xb'));var _=require(_0x3c0d('0xc'));var squel=require(_0x3c0d('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3c0d('0x9'));var querystring=require('querystring');var Papa=require(_0x3c0d('0xe'));var Redis=require(_0x3c0d('0xf'));var authService=require(_0x3c0d('0x10'));var qs=require(_0x3c0d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3c0d('0x12'));var logger=require(_0x3c0d('0x13'))(_0x3c0d('0x14'));var utils=require(_0x3c0d('0x15'));var config=require(_0x3c0d('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x3c0d('0x17')](config['redis'],{'host':_0x3c0d('0x18'),'port':0x18eb});var socket=require(_0x3c0d('0x19'))(new Redis(config[_0x3c0d('0x1a')]));require(_0x3c0d('0x1b'))[_0x3c0d('0x1c')](socket);function respondWithStatusCode(_0x448c6f,_0xc249bf){_0xc249bf=_0xc249bf||0xcc;return function(_0x1e4469){if(_0x1e4469){return _0x448c6f[_0x3c0d('0x1d')](_0xc249bf);}return _0x448c6f[_0x3c0d('0x1e')](_0xc249bf)['end']();};}function respondWithResult(_0x22481b,_0x544142){_0x544142=_0x544142||0xc8;return function(_0x4cb4fb){if(_0x4cb4fb){return _0x22481b[_0x3c0d('0x1e')](_0x544142)[_0x3c0d('0x1f')](_0x4cb4fb);}};}function respondWithFilteredResult(_0x49b8dd,_0x1ce0e1){return function(_0x3a31a3){if(_0x3a31a3){var _0x3d6c04=typeof _0x1ce0e1[_0x3c0d('0x20')]===_0x3c0d('0x21')&&typeof _0x1ce0e1[_0x3c0d('0x22')]==='undefined';var _0x1be730=_0x3a31a3[_0x3c0d('0x23')];var _0x46b791=_0x3d6c04?0x0:_0x1ce0e1[_0x3c0d('0x20')];var _0x31a3c3=_0x3d6c04?_0x3a31a3[_0x3c0d('0x23')]:_0x1ce0e1[_0x3c0d('0x20')]+_0x1ce0e1[_0x3c0d('0x22')];var _0xfe1e26;if(_0x31a3c3>=_0x1be730){_0x31a3c3=_0x1be730;_0xfe1e26=0xc8;}else{_0xfe1e26=0xce;}_0x49b8dd['status'](_0xfe1e26);return _0x49b8dd[_0x3c0d('0x24')](_0x3c0d('0x25'),_0x46b791+'-'+_0x31a3c3+'/'+_0x1be730)[_0x3c0d('0x1f')](_0x3a31a3);}return null;};}function patchUpdates(_0x593919){return function(_0x3a6f71){try{jsonpatch['apply'](_0x3a6f71,_0x593919,!![]);}catch(_0x57f5b7){return BPromise['reject'](_0x57f5b7);}return _0x3a6f71['save']();};}function saveUpdates(_0x514bdd,_0x55c956){return function(_0x5c381f){if(_0x5c381f){return _0x5c381f['update'](_0x514bdd)[_0x3c0d('0x26')](function(_0xc32b7a){return _0xc32b7a;});}return null;};}function removeEntity(_0x52438c,_0x46b7ef){return function(_0x4e8a86){if(_0x4e8a86){return _0x4e8a86[_0x3c0d('0x27')]()['then'](function(){_0x52438c[_0x3c0d('0x1e')](0xcc)[_0x3c0d('0x28')]();});}};}function handleEntityNotFound(_0x5dd1eb,_0x8d38bb){return function(_0x4543aa){if(!_0x4543aa){_0x5dd1eb[_0x3c0d('0x1d')](0x194);}return _0x4543aa;};}function handleError(_0x180914,_0x359332){_0x359332=_0x359332||0x1f4;return function(_0x2b34ae){logger['error'](_0x2b34ae[_0x3c0d('0x29')]);if(_0x2b34ae['name']){delete _0x2b34ae['name'];}_0x180914[_0x3c0d('0x1e')](_0x359332)[_0x3c0d('0x2a')](_0x2b34ae);};}exports[_0x3c0d('0x2b')]=function(_0x213452,_0x149b59){var _0x3b0d5c={},_0x2434ae={},_0x2328e7={'count':0x0,'rows':[]};var _0x3f75a3=_[_0x3c0d('0x2c')](db[_0x3c0d('0x2d')][_0x3c0d('0x2e')],function(_0x4d9973){return{'name':_0x4d9973['fieldName'],'type':_0x4d9973[_0x3c0d('0x2f')][_0x3c0d('0x30')]};});_0x2434ae[_0x3c0d('0x31')]=_[_0x3c0d('0x2c')](_0x3f75a3,_0x3c0d('0x32'));_0x2434ae[_0x3c0d('0x33')]=_[_0x3c0d('0x34')](_0x213452[_0x3c0d('0x33')]);_0x2434ae[_0x3c0d('0x35')]=_[_0x3c0d('0x36')](_0x2434ae[_0x3c0d('0x31')],_0x2434ae[_0x3c0d('0x33')]);_0x3b0d5c[_0x3c0d('0x37')]=_[_0x3c0d('0x36')](_0x2434ae['model'],qs['fields'](_0x213452[_0x3c0d('0x33')][_0x3c0d('0x38')]));_0x3b0d5c['attributes']=_0x3b0d5c['attributes'][_0x3c0d('0x39')]?_0x3b0d5c[_0x3c0d('0x37')]:_0x2434ae[_0x3c0d('0x31')];if(!_0x213452[_0x3c0d('0x33')]['hasOwnProperty'](_0x3c0d('0x3a'))){_0x3b0d5c[_0x3c0d('0x22')]=qs[_0x3c0d('0x22')](_0x213452[_0x3c0d('0x33')][_0x3c0d('0x22')]);_0x3b0d5c['offset']=qs[_0x3c0d('0x20')](_0x213452['query'][_0x3c0d('0x20')]);}_0x3b0d5c[_0x3c0d('0x3b')]=qs[_0x3c0d('0x3c')](_0x213452[_0x3c0d('0x33')][_0x3c0d('0x3c')]);_0x3b0d5c['where']=qs[_0x3c0d('0x35')](_[_0x3c0d('0x3d')](_0x213452[_0x3c0d('0x33')],_0x2434ae[_0x3c0d('0x35')]),_0x3f75a3);if(_0x213452[_0x3c0d('0x33')][_0x3c0d('0x3e')]){_0x3b0d5c[_0x3c0d('0x3f')]=_[_0x3c0d('0x40')](_0x3b0d5c[_0x3c0d('0x3f')],{'$or':_[_0x3c0d('0x2c')](_0x3f75a3,function(_0x2893c0){if(_0x2893c0[_0x3c0d('0x2f')]!==_0x3c0d('0x41')){var _0x2283a4={};_0x2283a4[_0x2893c0[_0x3c0d('0x32')]]={'$like':'%'+_0x213452['query'][_0x3c0d('0x3e')]+'%'};return _0x2283a4;}})});}_0x3b0d5c=_[_0x3c0d('0x40')]({},_0x3b0d5c,_0x213452['options']);var _0x1f14c8={'where':_0x3b0d5c[_0x3c0d('0x3f')]};return db[_0x3c0d('0x2d')][_0x3c0d('0x23')](_0x1f14c8)[_0x3c0d('0x26')](function(_0x122bc3){_0x2328e7[_0x3c0d('0x23')]=_0x122bc3;if(_0x213452[_0x3c0d('0x33')]['includeAll']){_0x3b0d5c[_0x3c0d('0x42')]=[{'all':!![]}];}return db['UserProfile'][_0x3c0d('0x43')](_0x3b0d5c);})[_0x3c0d('0x26')](function(_0x4e4938){_0x2328e7[_0x3c0d('0x44')]=_0x4e4938;return _0x2328e7;})[_0x3c0d('0x26')](respondWithFilteredResult(_0x149b59,_0x3b0d5c))['catch'](handleError(_0x149b59,null));};exports['show']=function(_0x2bf81f,_0x1cdd14){var _0x27ee5d={'raw':![],'where':{'id':_0x2bf81f[_0x3c0d('0x45')]['id']}},_0x151b1e={};_0x151b1e[_0x3c0d('0x31')]=_[_0x3c0d('0x34')](db[_0x3c0d('0x2d')]['rawAttributes']);_0x151b1e['query']=_[_0x3c0d('0x34')](_0x2bf81f[_0x3c0d('0x33')]);_0x151b1e['filters']=_[_0x3c0d('0x36')](_0x151b1e['model'],_0x151b1e[_0x3c0d('0x33')]);_0x27ee5d[_0x3c0d('0x37')]=_[_0x3c0d('0x36')](_0x151b1e[_0x3c0d('0x31')],qs[_0x3c0d('0x38')](_0x2bf81f[_0x3c0d('0x33')][_0x3c0d('0x38')]));_0x27ee5d[_0x3c0d('0x37')]=_0x27ee5d[_0x3c0d('0x37')]['length']?_0x27ee5d[_0x3c0d('0x37')]:_0x151b1e[_0x3c0d('0x31')];if(_0x2bf81f[_0x3c0d('0x33')]['includeAll']){_0x27ee5d[_0x3c0d('0x42')]=[{'all':!![]}];}_0x27ee5d=_[_0x3c0d('0x40')]({},_0x27ee5d,_0x2bf81f['options']);return db['UserProfile']['find'](_0x27ee5d)['then'](handleEntityNotFound(_0x1cdd14,null))[_0x3c0d('0x26')](respondWithResult(_0x1cdd14,null))['catch'](handleError(_0x1cdd14,null));};exports[_0x3c0d('0x46')]=function(_0x3ff01d,_0x228f2e){return db[_0x3c0d('0x2d')]['create'](_0x3ff01d[_0x3c0d('0x47')],{})[_0x3c0d('0x26')](respondWithResult(_0x228f2e,0xc9))[_0x3c0d('0x48')](handleError(_0x228f2e,null));};exports[_0x3c0d('0x49')]=function(_0xddedd3,_0x32d140){var _0x1b054b={'where':{'id':_0xddedd3[_0x3c0d('0x45')]['id']}},_0x5184d9={};_0x5184d9['model']=_[_0x3c0d('0x34')](db['UserProfile'][_0x3c0d('0x2e')]);_0x1b054b[_0x3c0d('0x37')]=_[_0x3c0d('0x36')](_0x5184d9[_0x3c0d('0x31')],qs[_0x3c0d('0x38')](_0xddedd3['query'][_0x3c0d('0x38')]));_0x1b054b['attributes']=_0x1b054b['attributes'][_0x3c0d('0x39')]?_0x1b054b[_0x3c0d('0x37')]:_0x5184d9[_0x3c0d('0x31')];if(_0xddedd3[_0x3c0d('0x33')][_0x3c0d('0x4a')]){_0x1b054b['include']=[{'all':!![]}];}_0x1b054b=_['merge']({},_0x1b054b,_0xddedd3[_0x3c0d('0x4b')]);return db[_0x3c0d('0x2d')][_0x3c0d('0x4c')](_0x1b054b)[_0x3c0d('0x26')](handleEntityNotFound(_0x32d140,null))['then'](function(_0x1895d3){if(_0x1895d3){var _0x39b932=_0x1895d3[_0x3c0d('0x4d')]({'plain':!![]});_0x39b932=qs[_0x3c0d('0x4e')](_0x39b932,['id',_0x3c0d('0x4f'),_0x3c0d('0x50'),_0x3c0d('0x51')]);_0xddedd3[_0x3c0d('0x47')]=_['omit'](_0xddedd3[_0x3c0d('0x47')],['id',_0x3c0d('0x4f'),_0x3c0d('0x50')]);return db['sequelize'][_0x3c0d('0x52')](function(_0x38b9d0){return db['UserProfile'][_0x3c0d('0x46')](_[_0x3c0d('0x40')](_0x39b932,_0xddedd3[_0x3c0d('0x47')]),{'include':_0xddedd3['query']['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x38b9d0})[_0x3c0d('0x26')](function(_0x40b043){var _0x4ca187=_0x40b043[_0x3c0d('0x4d')]({'plain':!![]});return db[_0x3c0d('0x53')][_0x3c0d('0x43')]({'where':{'userProfileId':_0xddedd3['params']['id']},'raw':!![]})['then'](function(_0x11a85e){if(_0x11a85e){return BPromise[_0x3c0d('0x54')](_0x11a85e,function(_0x2e961d){return new BPromise(function(_0x997bcb,_0x400ab8){if(_0x2e961d[_0x3c0d('0x55')]===null||_0x2e961d[_0x3c0d('0x55')]===0x1)_0x997bcb(null);return db[_0x3c0d('0x56')][_0x3c0d('0x43')]({'where':{'sectionId':_0x2e961d['id']},'raw':!![]})['then'](function(_0x446e58){var _0x5bb804=_['map'](_0x446e58,function(_0x5b638d){return qs[_0x3c0d('0x4e')](_0x5b638d,['id',_0x3c0d('0x4f'),_0x3c0d('0x50'),'sectionId']);});_0x997bcb(_0x5bb804);})['catch'](function(_0x2a2c7f){_0x400ab8(_0x2a2c7f);});})['then'](function(_0x380c7f){var _0x424749=qs['omit'](_0x2e961d,['id','createdAt',_0x3c0d('0x50')]);_0x424749[_0x3c0d('0x57')]=_0x4ca187['id'];if(_0x380c7f)_0x424749['Resources']=_0x380c7f;return _0x424749;})[_0x3c0d('0x26')](function(_0x13790f){return db['UserProfileSection'][_0x3c0d('0x46')](_0x13790f,{'include':[{'model':db[_0x3c0d('0x56')],'as':_0x3c0d('0x58')}],'raw':!![],'transaction':_0x38b9d0});});})[_0x3c0d('0x26')](function(){return _0x4ca187;});}});});});}})[_0x3c0d('0x26')](respondWithResult(_0x32d140,0xc9))[_0x3c0d('0x48')](handleError(_0x32d140,null));};exports[_0x3c0d('0x59')]=function(_0x3b8fd7,_0xa81fbd){if(_0x3b8fd7[_0x3c0d('0x47')]['id']){delete _0x3b8fd7['body']['id'];}return db[_0x3c0d('0x2d')][_0x3c0d('0x4c')]({'where':{'id':_0x3b8fd7['params']['id']}})[_0x3c0d('0x26')](handleEntityNotFound(_0xa81fbd,null))['then'](saveUpdates(_0x3b8fd7[_0x3c0d('0x47')],null))[_0x3c0d('0x26')](respondWithResult(_0xa81fbd,null))['catch'](handleError(_0xa81fbd,null));};exports[_0x3c0d('0x27')]=function(_0x161d41,_0x44f101){return db[_0x3c0d('0x2d')][_0x3c0d('0x4c')]({'where':{'id':_0x161d41[_0x3c0d('0x45')]['id']}})[_0x3c0d('0x26')](handleEntityNotFound(_0x44f101,null))[_0x3c0d('0x26')](removeEntity(_0x44f101,null))[_0x3c0d('0x48')](handleError(_0x44f101,null));};exports[_0x3c0d('0x5a')]=function(_0x42ade1,_0x51df90){return db['UserProfile'][_0x3c0d('0x5a')]()['then'](respondWithResult(_0x51df90,null))['catch'](handleError(_0x51df90,null));};exports['addSections']=function(_0x4c7f2a,_0x15b0a3){var _0x36c2d6=_0x4c7f2a[_0x3c0d('0x47')];return db[_0x3c0d('0x2d')]['find']({'where':{'id':_0x4c7f2a[_0x3c0d('0x45')]['id']}})[_0x3c0d('0x26')](handleEntityNotFound(_0x15b0a3,null))[_0x3c0d('0x26')](function(_0x2087ef){if(_0x2087ef){return db['sequelize'][_0x3c0d('0x52')](function(_0x11c095){return db[_0x3c0d('0x53')][_0x3c0d('0x27')]({'where':{'userProfileId':_0x4c7f2a[_0x3c0d('0x45')]['id'],'sectionId':_[_0x3c0d('0x2c')](_0x36c2d6,function(_0x2feff1){return _0x2feff1[_0x3c0d('0x5b')];})},'transaction':_0x11c095})['then'](function(){var _0xa150ea=_['map'](_0x36c2d6,function(_0x586feb){_0x586feb[_0x3c0d('0x57')]=_0x4c7f2a['params']['id'];return _0x586feb;});var _0x1753aa=[];return BPromise[_0x3c0d('0x54')](_0xa150ea,function(_0x6311b){return db[_0x3c0d('0x53')][_0x3c0d('0x46')](_0x6311b,{'include':[{'model':db[_0x3c0d('0x56')],'as':'Resources'}],'raw':!![],'transaction':_0x11c095})['then'](function(_0x1d3acf){_0x1753aa['push'](_0x1d3acf['get']({'plain':!![]}));});})[_0x3c0d('0x26')](function(){return _0x1753aa;});});});}})['then'](function(_0x183cf8){return _0x183cf8;})['then'](respondWithResult(_0x15b0a3,null))['catch'](handleError(_0x15b0a3,null));};exports[_0x3c0d('0x5c')]=function(_0x406328,_0x4558c3){var _0x1eddb0;return db[_0x3c0d('0x2d')][_0x3c0d('0x4c')]({'where':{'id':_0x406328['params']['id']},'attributes':['id',_0x3c0d('0x32')]})[_0x3c0d('0x26')](handleEntityNotFound(_0x4558c3,null))[_0x3c0d('0x26')](function(_0x503824){if(_0x503824){_0x1eddb0=_0x503824;return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x406328[_0x3c0d('0x45')]['id'],'sectionId':_0x406328[_0x3c0d('0x33')][_0x3c0d('0x5d')]}});}})[_0x3c0d('0x26')](function(){return _0x1eddb0;})['then'](respondWithStatusCode(_0x4558c3,null))['catch'](handleError(_0x4558c3,null));};exports[_0x3c0d('0x5e')]=function(_0x55c2be,_0x54784d){var _0x55d7e9=[];var _0x2930ec=[];return db[_0x3c0d('0x53')]['findAll']({'where':{'userProfileId':_0x55c2be['params']['id']},'raw':!![]})['then'](function(_0x40e8af){_0x55d7e9=_['filter'](_0x40e8af,function(_0x1d8e5f){return _0x1d8e5f[_0x3c0d('0x5f')]===0x1||_[_0x3c0d('0x60')]([0x3eb,0x709],_0x1d8e5f['sectionId']);});if(!_[_0x3c0d('0x61')](_0x55d7e9)){return _[_0x3c0d('0x2c')](_0x55d7e9,function(_0xc35f5f){return _0xc35f5f['sectionId'];});}else{return;}})[_0x3c0d('0x26')](function(_0x3d931f){if(_0x3d931f)_0x2930ec=_0x3d931f;if(_[_0x3c0d('0x60')](_0x2930ec,0x64)){var _0x514d94=_[_0x3c0d('0x4c')](_0x55d7e9,{'sectionId':0x64});return hasDefaultDashboard(_0x514d94)[_0x3c0d('0x26')](function(_0x4b6085){return _[_0x3c0d('0x2c')](_0x55d7e9,function(_0x44a45f){if(_0x44a45f[_0x3c0d('0x5b')]===0x64){_0x44a45f[_0x3c0d('0x62')]=_0x4b6085;}return _0x44a45f;});});}else{return;}})[_0x3c0d('0x26')](function(_0x2c5192){if(_0x2c5192)_0x55d7e9=_0x2c5192;if(_['includes'](_0x2930ec,0x3eb)){var _0x117481=_[_0x3c0d('0x4c')](_0x55d7e9,{'sectionId':0x3eb});return getCustomDashboards(_0x117481)[_0x3c0d('0x26')](function(_0x4200c8){return _[_0x3c0d('0x2c')](_0x55d7e9,function(_0x3ede0c){if(_0x117481['enabled']){if(_0x3ede0c[_0x3c0d('0x5b')]===0x3eb){_0x3ede0c[_0x3c0d('0x62')]=_0x4200c8;}}else{if(_0x3ede0c[_0x3c0d('0x5b')]===0x64){if(!_0x3ede0c[_0x3c0d('0x62')]){_0x3ede0c['subsections']=[];}_0x3ede0c[_0x3c0d('0x62')]=_0x3ede0c['subsections'][_0x3c0d('0x63')](_0x4200c8);}}return _0x3ede0c;});});}else{return;}})[_0x3c0d('0x26')](function(_0x358ef3){if(_0x358ef3)_0x55d7e9=_0x358ef3;if(_[_0x3c0d('0x60')](_0x2930ec,0x709)){var _0x382cf6=_[_0x3c0d('0x4c')](_0x55d7e9,{'sectionId':0x709});return getPlugins(_0x382cf6)['then'](function(_0x190fc2){if(_0x382cf6[_0x3c0d('0x5f')]){return _[_0x3c0d('0x2c')](_0x55d7e9,function(_0x3b5875){if(_0x3b5875['sectionId']===0x709){_0x3b5875[_0x3c0d('0x62')]=_0x190fc2;}return _0x3b5875;});}else{var _0x4175bb={'sectionId':0x76c,'enabled':0x1,'subsections':_0x190fc2};var _0x16f526=_[_0x3c0d('0x2c')](_0x55d7e9);_0x16f526[_0x3c0d('0x64')](_0x4175bb);return _0x16f526;}});}else{return;}})[_0x3c0d('0x26')](function(_0x2c054e){if(_0x2c054e)_0x55d7e9=_0x2c054e;return _[_0x3c0d('0x3e')](_0x55d7e9,[_0x3c0d('0x5f'),0x1]);})[_0x3c0d('0x26')](respondWithResult(_0x54784d,null))[_0x3c0d('0x48')](handleError(_0x54784d,null));};function hasDefaultDashboard(_0x2cf935){var _0x40158b=[0x65];return new BPromise(function(_0x544ec8,_0x22340d){try{if(_0x2cf935[_0x3c0d('0x55')]){_0x544ec8(_0x40158b);}else{return db['UserProfileResource'][_0x3c0d('0x65')]({'where':{'sectionId':_0x2cf935['id']},'raw':!![]})[_0x3c0d('0x26')](function(_0x247dfe){_0x247dfe?_0x544ec8(_0x40158b):_0x544ec8();});}}catch(_0x162e8e){_0x22340d(_0x162e8e);}});}function getCustomDashboards(_0x45f994){var _0x5426a3=[];return new BPromise(function(_0x388e02,_0x52e954){try{if(_0x45f994['autoAssociation']){return db[_0x3c0d('0x66')][_0x3c0d('0x43')]({'raw':!![]})[_0x3c0d('0x26')](function(_0x9576){_0x9576[_0x3c0d('0x67')](function(_0x3697b2){_0x5426a3[_0x3c0d('0x64')](_0x3697b2['id']+0x1869f);});_0x388e02(_0x5426a3);});}else{return db[_0x3c0d('0x56')]['findAll']({'where':{'sectionId':_0x45f994['id']},'raw':!![]})[_0x3c0d('0x26')](function(_0x582fa6){_0x582fa6['forEach'](function(_0x1038c5){_0x5426a3[_0x3c0d('0x64')](_0x1038c5[_0x3c0d('0x68')]+0x1869f);});_0x388e02(_0x5426a3);});}}catch(_0x2349ba){_0x52e954(_0x2349ba);}});}function getPlugins(_0x3b9493){var _0x17c354=[];return new BPromise(function(_0x53592e,_0x57ead2){try{if(_0x3b9493[_0x3c0d('0x55')]){return db[_0x3c0d('0x69')][_0x3c0d('0x43')]({'raw':!![]})['then'](function(_0x48a930){_0x48a930[_0x3c0d('0x67')](function(_0x5765fc){_0x17c354[_0x3c0d('0x64')](_0x5765fc['id']+0x15b38);});_0x53592e(_0x17c354);});}else{return db[_0x3c0d('0x56')][_0x3c0d('0x43')]({'where':{'sectionId':_0x3b9493['id']},'raw':!![]})[_0x3c0d('0x26')](function(_0x3d09e5){_0x3d09e5[_0x3c0d('0x67')](function(_0x13b712){_0x17c354[_0x3c0d('0x64')](_0x13b712[_0x3c0d('0x68')]+0x15b38);});_0x53592e(_0x17c354);});}}catch(_0x353968){_0x57ead2(_0x353968);}});}exports['addResources']=function(_0x564916,_0x3233f9){return db['UserProfile'][_0x3c0d('0x4c')]({'where':{'id':_0x564916['params']['id']}})['then'](handleEntityNotFound(_0x3233f9,null))[_0x3c0d('0x26')](function(_0x4c1003){if(_0x4c1003){return db[_0x3c0d('0x6a')][_0x3c0d('0x52')](function(_0x3fc2d0){return db[_0x3c0d('0x53')][_0x3c0d('0x43')]({'where':{'userProfileId':_0x564916[_0x3c0d('0x45')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x350561){if(_0x350561){return db[_0x3c0d('0x53')][_0x3c0d('0x27')]({'where':{'userProfileId':_0x564916[_0x3c0d('0x45')]['id'],'id':_[_0x3c0d('0x2c')](_0x350561,function(_0x277b5e){return _0x277b5e['id'];})},'transaction':_0x3fc2d0});}})[_0x3c0d('0x26')](function(_0x14a1ec){var _0x3e6722=_['map'](_0x564916['body'],function(_0x1d2f47){_0x1d2f47[_0x3c0d('0x57')]=_0x564916['params']['id'];return _0x1d2f47;});return db[_0x3c0d('0x53')][_0x3c0d('0x6b')](_0x3e6722,{'raw':!![],'transaction':_0x3fc2d0});})[_0x3c0d('0x26')](function(_0x1df7c3){var _0x186cd0=_[_0x3c0d('0x3e')](_[_0x3c0d('0x2c')](_0x1df7c3,function(_0x1aa920){return _0x1aa920[_0x3c0d('0x4d')]({'plain':!![]});}),{'includeAll':![]});if(_0x186cd0){return db[_0x3c0d('0x53')]['findAll']({'where':{'userProfileId':_0x564916[_0x3c0d('0x45')]['id'],'sectionId':_['map'](_0x186cd0,function(_0x1dd81d){return _0x1dd81d['sectionId'];})},'attributes':['id','sectionId'],'raw':!![]})[_0x3c0d('0x26')](function(_0x3ce398){var _0x2bc953=_[_0x3c0d('0x2c')](_0x564916[_0x3c0d('0x47')],function(_0x2230ce){_0x2230ce[_0x3c0d('0x57')]=_0x564916['params']['id'];return _0x2230ce;});return db['UserProfileResource'][_0x3c0d('0x6b')](_0x2bc953,{'raw':!![],'transaction':_0x3fc2d0});});}})['catch'](handleError(_0x3233f9,null));});}})[_0x3c0d('0x26')](function(_0x2596d6){var _0x11da6c=_['map'](_0x2596d6,function(_0x145cab){return _0x145cab['get']({'plain':!![]});});})[_0x3c0d('0x26')](respondWithResult(_0x3233f9,null))[_0x3c0d('0x48')](handleError(_0x3233f9,null));};exports[_0x3c0d('0x6c')]=function(_0x1dfa8a,_0x430268,_0x12f254){return db[_0x3c0d('0x2d')]['find']({'where':{'id':_0x1dfa8a['params']['id']}})[_0x3c0d('0x26')](handleEntityNotFound(_0x430268,null))[_0x3c0d('0x26')](function(_0x15a79a){if(_0x15a79a){return _0x15a79a['removeResources'](_0x1dfa8a['query'][_0x3c0d('0x5d')]);}})['then'](respondWithStatusCode(_0x430268,null))[_0x3c0d('0x48')](handleError(_0x430268,null));};exports[_0x3c0d('0x6d')]=function(_0xdbdd72,_0xeab5e4){var _0x544c11={};if(!_0xdbdd72[_0x3c0d('0x33')][_0x3c0d('0x6e')])throw new Error('Missing\x20section\x20parameter');if(!_0xdbdd72[_0x3c0d('0x33')][_0x3c0d('0x6f')](_0x3c0d('0x3a'))){_0x544c11[_0x3c0d('0x22')]=qs['limit'](_0xdbdd72[_0x3c0d('0x33')][_0x3c0d('0x22')]);_0x544c11[_0x3c0d('0x20')]=qs['offset'](_0xdbdd72[_0x3c0d('0x33')][_0x3c0d('0x20')]);}return db[_0x3c0d('0x2d')]['find']({'where':{'id':_0xdbdd72['params']['id']}})[_0x3c0d('0x26')](function(_0x57e5ee){if(!_0x57e5ee)throw new Error(_0x3c0d('0x70')+_0xdbdd72[_0x3c0d('0x45')]['id']);return db[_0x3c0d('0x2d')][_0x3c0d('0x6d')](_0xdbdd72);})[_0x3c0d('0x26')](respondWithFilteredResult(_0xeab5e4,_0x544c11))['catch'](handleError(_0xeab5e4,null));}; \ No newline at end of file +var _0x2a41=['nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','then','includeAll','include','findAll','rows','catch','show','params','options','find','clone','get','omit','createdAt','crudPermissions','body','updatedAt','transaction','create','UserProfileSection','each','autoAssociation','UserProfileResource','Resources','describe','addSections','sequelize','sectionId','userProfileId','push','ids','enabled','includes','isEmpty','subsections','concat','findOne','Dashboard','forEach','resourceId','bulkCreate','removeResources','getResources','section','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','map','UserProfile','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x16a5b8,_0x392cb4){var _0x3aeb19=function(_0xfcaddb){while(--_0xfcaddb){_0x16a5b8['push'](_0x16a5b8['shift']());}};_0x3aeb19(++_0x392cb4);}(_0x2a41,0x126));var _0x12a4=function(_0x4e9466,_0x290606){_0x4e9466=_0x4e9466-0x0;var _0x5e8099=_0x2a41[_0x4e9466];return _0x5e8099;};'use strict';var emlformat=require(_0x12a4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x12a4('0x1'));var jsonpatch=require(_0x12a4('0x2'));var rp=require(_0x12a4('0x3'));var moment=require(_0x12a4('0x4'));var BPromise=require(_0x12a4('0x5'));var Mustache=require(_0x12a4('0x6'));var util=require(_0x12a4('0x7'));var path=require(_0x12a4('0x8'));var sox=require(_0x12a4('0x9'));var csv=require('to-csv');var ejs=require(_0x12a4('0xa'));var fs=require('fs');var fs_extra=require(_0x12a4('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x12a4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x12a4('0xd'));var toCsv=require(_0x12a4('0xe'));var querystring=require(_0x12a4('0xf'));var Papa=require(_0x12a4('0x10'));var Redis=require(_0x12a4('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x12a4('0x12'));var as=require(_0x12a4('0x13'));var hardwareService=require(_0x12a4('0x14'));var logger=require(_0x12a4('0x15'))(_0x12a4('0x16'));var utils=require(_0x12a4('0x17'));var config=require(_0x12a4('0x18'));var licenseUtil=require(_0x12a4('0x19'));var db=require(_0x12a4('0x1a'))['db'];config[_0x12a4('0x1b')]=_[_0x12a4('0x1c')](config[_0x12a4('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x12a4('0x1d'))(new Redis(config[_0x12a4('0x1b')]));require(_0x12a4('0x1e'))[_0x12a4('0x1f')](socket);function respondWithStatusCode(_0x2b6e72,_0x558377){_0x558377=_0x558377||0xcc;return function(_0x4b86ae){if(_0x4b86ae){return _0x2b6e72[_0x12a4('0x20')](_0x558377);}return _0x2b6e72[_0x12a4('0x21')](_0x558377)[_0x12a4('0x22')]();};}function respondWithResult(_0x1cce66,_0x5f5d38){_0x5f5d38=_0x5f5d38||0xc8;return function(_0x1e4cca){if(_0x1e4cca){return _0x1cce66[_0x12a4('0x21')](_0x5f5d38)[_0x12a4('0x23')](_0x1e4cca);}};}function respondWithFilteredResult(_0x25d54f,_0x3023b6){return function(_0xe274e1){if(_0xe274e1){var _0x4d7c49=typeof _0x3023b6[_0x12a4('0x24')]===_0x12a4('0x25')&&typeof _0x3023b6[_0x12a4('0x26')]==='undefined';var _0x569763=_0xe274e1[_0x12a4('0x27')];var _0x68998e=_0x4d7c49?0x0:_0x3023b6[_0x12a4('0x24')];var _0x2c026e=_0x4d7c49?_0xe274e1[_0x12a4('0x27')]:_0x3023b6['offset']+_0x3023b6[_0x12a4('0x26')];var _0x5617d6;if(_0x2c026e>=_0x569763){_0x2c026e=_0x569763;_0x5617d6=0xc8;}else{_0x5617d6=0xce;}_0x25d54f[_0x12a4('0x21')](_0x5617d6);return _0x25d54f[_0x12a4('0x28')](_0x12a4('0x29'),_0x68998e+'-'+_0x2c026e+'/'+_0x569763)[_0x12a4('0x23')](_0xe274e1);}return null;};}function patchUpdates(_0x17a4cc){return function(_0x520d45){try{jsonpatch[_0x12a4('0x2a')](_0x520d45,_0x17a4cc,!![]);}catch(_0x188930){return BPromise[_0x12a4('0x2b')](_0x188930);}return _0x520d45[_0x12a4('0x2c')]();};}function saveUpdates(_0x499b22,_0x38deed){return function(_0x34cbec){if(_0x34cbec){return _0x34cbec[_0x12a4('0x2d')](_0x499b22)['then'](function(_0x395749){return _0x395749;});}return null;};}function removeEntity(_0x2f3cae,_0x5950fe){return function(_0x4081b7){if(_0x4081b7){return _0x4081b7[_0x12a4('0x2e')]()['then'](function(){_0x2f3cae['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x41e832,_0x6ac80c){return function(_0x3314da){if(!_0x3314da){_0x41e832[_0x12a4('0x20')](0x194);}return _0x3314da;};}function handleError(_0x4843f8,_0x443c90){_0x443c90=_0x443c90||0x1f4;return function(_0x56c3da){logger[_0x12a4('0x2f')](_0x56c3da[_0x12a4('0x30')]);if(_0x56c3da[_0x12a4('0x31')]){delete _0x56c3da[_0x12a4('0x31')];}_0x4843f8['status'](_0x443c90)[_0x12a4('0x32')](_0x56c3da);};}exports[_0x12a4('0x33')]=function(_0x4e38f7,_0x283668){var _0x4cff97={},_0x36edf3={},_0x2de4d5={'count':0x0,'rows':[]};var _0x534ab5=_[_0x12a4('0x34')](db[_0x12a4('0x35')][_0x12a4('0x36')],function(_0x5ce983){return{'name':_0x5ce983[_0x12a4('0x37')],'type':_0x5ce983['type'][_0x12a4('0x38')]};});_0x36edf3[_0x12a4('0x39')]=_[_0x12a4('0x34')](_0x534ab5,_0x12a4('0x31'));_0x36edf3[_0x12a4('0x3a')]=_[_0x12a4('0x3b')](_0x4e38f7['query']);_0x36edf3[_0x12a4('0x3c')]=_[_0x12a4('0x3d')](_0x36edf3[_0x12a4('0x39')],_0x36edf3['query']);_0x4cff97['attributes']=_[_0x12a4('0x3d')](_0x36edf3['model'],qs[_0x12a4('0x3e')](_0x4e38f7[_0x12a4('0x3a')]['fields']));_0x4cff97[_0x12a4('0x3f')]=_0x4cff97[_0x12a4('0x3f')][_0x12a4('0x40')]?_0x4cff97[_0x12a4('0x3f')]:_0x36edf3['model'];if(!_0x4e38f7[_0x12a4('0x3a')][_0x12a4('0x41')](_0x12a4('0x42'))){_0x4cff97[_0x12a4('0x26')]=qs[_0x12a4('0x26')](_0x4e38f7['query']['limit']);_0x4cff97[_0x12a4('0x24')]=qs['offset'](_0x4e38f7[_0x12a4('0x3a')][_0x12a4('0x24')]);}_0x4cff97[_0x12a4('0x43')]=qs[_0x12a4('0x44')](_0x4e38f7[_0x12a4('0x3a')][_0x12a4('0x44')]);_0x4cff97[_0x12a4('0x45')]=qs[_0x12a4('0x3c')](_[_0x12a4('0x46')](_0x4e38f7[_0x12a4('0x3a')],_0x36edf3['filters']),_0x534ab5);if(_0x4e38f7['query']['filter']){_0x4cff97[_0x12a4('0x45')]=_[_0x12a4('0x47')](_0x4cff97['where'],{'$or':_[_0x12a4('0x34')](_0x534ab5,function(_0x1841c){if(_0x1841c[_0x12a4('0x48')]!==_0x12a4('0x49')){var _0x146713={};_0x146713[_0x1841c[_0x12a4('0x31')]]={'$like':'%'+_0x4e38f7[_0x12a4('0x3a')][_0x12a4('0x4a')]+'%'};return _0x146713;}})});}_0x4cff97=_[_0x12a4('0x47')]({},_0x4cff97,_0x4e38f7['options']);var _0x9f6fa8={'where':_0x4cff97['where']};return db[_0x12a4('0x35')][_0x12a4('0x27')](_0x9f6fa8)[_0x12a4('0x4b')](function(_0x2826fb){_0x2de4d5[_0x12a4('0x27')]=_0x2826fb;if(_0x4e38f7['query'][_0x12a4('0x4c')]){_0x4cff97[_0x12a4('0x4d')]=[{'all':!![]}];}return db[_0x12a4('0x35')][_0x12a4('0x4e')](_0x4cff97);})[_0x12a4('0x4b')](function(_0xf2751e){_0x2de4d5[_0x12a4('0x4f')]=_0xf2751e;return _0x2de4d5;})['then'](respondWithFilteredResult(_0x283668,_0x4cff97))[_0x12a4('0x50')](handleError(_0x283668,null));};exports[_0x12a4('0x51')]=function(_0x44c499,_0x2745b7){var _0x33143b={'raw':![],'where':{'id':_0x44c499[_0x12a4('0x52')]['id']}},_0x331605={};_0x331605[_0x12a4('0x39')]=_[_0x12a4('0x3b')](db[_0x12a4('0x35')][_0x12a4('0x36')]);_0x331605['query']=_[_0x12a4('0x3b')](_0x44c499[_0x12a4('0x3a')]);_0x331605[_0x12a4('0x3c')]=_['intersection'](_0x331605['model'],_0x331605[_0x12a4('0x3a')]);_0x33143b[_0x12a4('0x3f')]=_[_0x12a4('0x3d')](_0x331605['model'],qs[_0x12a4('0x3e')](_0x44c499[_0x12a4('0x3a')][_0x12a4('0x3e')]));_0x33143b[_0x12a4('0x3f')]=_0x33143b['attributes']['length']?_0x33143b['attributes']:_0x331605['model'];if(_0x44c499[_0x12a4('0x3a')][_0x12a4('0x4c')]){_0x33143b[_0x12a4('0x4d')]=[{'all':!![]}];}_0x33143b=_[_0x12a4('0x47')]({},_0x33143b,_0x44c499[_0x12a4('0x53')]);return db['UserProfile'][_0x12a4('0x54')](_0x33143b)[_0x12a4('0x4b')](handleEntityNotFound(_0x2745b7,null))[_0x12a4('0x4b')](respondWithResult(_0x2745b7,null))['catch'](handleError(_0x2745b7,null));};exports['create']=function(_0x41516b,_0x11ef07){return db['UserProfile']['create'](_0x41516b['body'],{})[_0x12a4('0x4b')](respondWithResult(_0x11ef07,0xc9))[_0x12a4('0x50')](handleError(_0x11ef07,null));};exports[_0x12a4('0x55')]=function(_0x5dd875,_0x403d90){var _0x270fbb={'where':{'id':_0x5dd875[_0x12a4('0x52')]['id']}},_0x5b428b={};_0x5b428b[_0x12a4('0x39')]=_[_0x12a4('0x3b')](db[_0x12a4('0x35')][_0x12a4('0x36')]);_0x270fbb[_0x12a4('0x3f')]=_['intersection'](_0x5b428b[_0x12a4('0x39')],qs['fields'](_0x5dd875[_0x12a4('0x3a')][_0x12a4('0x3e')]));_0x270fbb[_0x12a4('0x3f')]=_0x270fbb[_0x12a4('0x3f')][_0x12a4('0x40')]?_0x270fbb[_0x12a4('0x3f')]:_0x5b428b[_0x12a4('0x39')];if(_0x5dd875['query'][_0x12a4('0x4c')]){_0x270fbb[_0x12a4('0x4d')]=[{'all':!![]}];}_0x270fbb=_[_0x12a4('0x47')]({},_0x270fbb,_0x5dd875[_0x12a4('0x53')]);return db[_0x12a4('0x35')][_0x12a4('0x54')](_0x270fbb)[_0x12a4('0x4b')](handleEntityNotFound(_0x403d90,null))[_0x12a4('0x4b')](function(_0x15dd71){if(_0x15dd71){var _0x2e19c2=_0x15dd71[_0x12a4('0x56')]({'plain':!![]});_0x2e19c2=qs[_0x12a4('0x57')](_0x2e19c2,['id',_0x12a4('0x58'),'updatedAt',_0x12a4('0x59')]);_0x5dd875[_0x12a4('0x5a')]=_[_0x12a4('0x57')](_0x5dd875[_0x12a4('0x5a')],['id','createdAt',_0x12a4('0x5b')]);return db['sequelize'][_0x12a4('0x5c')](function(_0x14ce90){return db[_0x12a4('0x35')][_0x12a4('0x5d')](_[_0x12a4('0x47')](_0x2e19c2,_0x5dd875[_0x12a4('0x5a')]),{'include':_0x5dd875[_0x12a4('0x3a')][_0x12a4('0x4c')]?[{'all':!![]}]:undefined,'transaction':_0x14ce90})['then'](function(_0x370b7d){var _0x53a6b4=_0x370b7d[_0x12a4('0x56')]({'plain':!![]});return db[_0x12a4('0x5e')][_0x12a4('0x4e')]({'where':{'userProfileId':_0x5dd875[_0x12a4('0x52')]['id']},'raw':!![]})[_0x12a4('0x4b')](function(_0x30ef8b){if(_0x30ef8b){return BPromise[_0x12a4('0x5f')](_0x30ef8b,function(_0x48bbc7){return new BPromise(function(_0xcc63bd,_0x456aea){if(_0x48bbc7[_0x12a4('0x60')]===null||_0x48bbc7[_0x12a4('0x60')]===0x1)_0xcc63bd(null);return db[_0x12a4('0x61')][_0x12a4('0x4e')]({'where':{'sectionId':_0x48bbc7['id']},'raw':!![]})['then'](function(_0x22b607){var _0x48fd04=_['map'](_0x22b607,function(_0x365d19){return qs[_0x12a4('0x57')](_0x365d19,['id',_0x12a4('0x58'),_0x12a4('0x5b'),'sectionId']);});_0xcc63bd(_0x48fd04);})[_0x12a4('0x50')](function(_0x2e7102){_0x456aea(_0x2e7102);});})['then'](function(_0x108c1a){var _0x17f1fd=qs['omit'](_0x48bbc7,['id','createdAt',_0x12a4('0x5b')]);_0x17f1fd['userProfileId']=_0x53a6b4['id'];if(_0x108c1a)_0x17f1fd[_0x12a4('0x62')]=_0x108c1a;return _0x17f1fd;})[_0x12a4('0x4b')](function(_0x5e6e0f){return db[_0x12a4('0x5e')]['create'](_0x5e6e0f,{'include':[{'model':db[_0x12a4('0x61')],'as':'Resources'}],'raw':!![],'transaction':_0x14ce90});});})[_0x12a4('0x4b')](function(){return _0x53a6b4;});}});});});}})[_0x12a4('0x4b')](respondWithResult(_0x403d90,0xc9))[_0x12a4('0x50')](handleError(_0x403d90,null));};exports['update']=function(_0x26bf5f,_0x4d6270){if(_0x26bf5f[_0x12a4('0x5a')]['id']){delete _0x26bf5f['body']['id'];}return db[_0x12a4('0x35')]['find']({'where':{'id':_0x26bf5f[_0x12a4('0x52')]['id']}})['then'](handleEntityNotFound(_0x4d6270,null))[_0x12a4('0x4b')](saveUpdates(_0x26bf5f[_0x12a4('0x5a')],null))[_0x12a4('0x4b')](respondWithResult(_0x4d6270,null))[_0x12a4('0x50')](handleError(_0x4d6270,null));};exports[_0x12a4('0x2e')]=function(_0x5af3b4,_0x45352c){return db[_0x12a4('0x35')][_0x12a4('0x54')]({'where':{'id':_0x5af3b4[_0x12a4('0x52')]['id']}})[_0x12a4('0x4b')](handleEntityNotFound(_0x45352c,null))['then'](removeEntity(_0x45352c,null))[_0x12a4('0x50')](handleError(_0x45352c,null));};exports[_0x12a4('0x63')]=function(_0x5a5c81,_0x4e2f8b){return db[_0x12a4('0x35')][_0x12a4('0x63')]()[_0x12a4('0x4b')](respondWithResult(_0x4e2f8b,null))[_0x12a4('0x50')](handleError(_0x4e2f8b,null));};exports[_0x12a4('0x64')]=function(_0x5c6548,_0x146149){var _0x128e71=_0x5c6548[_0x12a4('0x5a')];return db[_0x12a4('0x35')][_0x12a4('0x54')]({'where':{'id':_0x5c6548['params']['id']}})[_0x12a4('0x4b')](handleEntityNotFound(_0x146149,null))['then'](function(_0x2ea7b){if(_0x2ea7b){return db[_0x12a4('0x65')][_0x12a4('0x5c')](function(_0x1abeb6){return db['UserProfileSection'][_0x12a4('0x2e')]({'where':{'userProfileId':_0x5c6548[_0x12a4('0x52')]['id'],'sectionId':_[_0x12a4('0x34')](_0x128e71,function(_0x27b29b){return _0x27b29b[_0x12a4('0x66')];})},'transaction':_0x1abeb6})[_0x12a4('0x4b')](function(){var _0x251289=_['map'](_0x128e71,function(_0x4098ee){_0x4098ee[_0x12a4('0x67')]=_0x5c6548[_0x12a4('0x52')]['id'];return _0x4098ee;});var _0x47f45e=[];return BPromise[_0x12a4('0x5f')](_0x251289,function(_0x29679e){return db[_0x12a4('0x5e')][_0x12a4('0x5d')](_0x29679e,{'include':[{'model':db[_0x12a4('0x61')],'as':_0x12a4('0x62')}],'raw':!![],'transaction':_0x1abeb6})[_0x12a4('0x4b')](function(_0x411c78){_0x47f45e[_0x12a4('0x68')](_0x411c78[_0x12a4('0x56')]({'plain':!![]}));});})['then'](function(){return _0x47f45e;});});});}})[_0x12a4('0x4b')](function(_0x22a5c0){return _0x22a5c0;})[_0x12a4('0x4b')](respondWithResult(_0x146149,null))[_0x12a4('0x50')](handleError(_0x146149,null));};exports['removeSections']=function(_0x49894a,_0x5ce731){var _0x5cc631;return db[_0x12a4('0x35')]['find']({'where':{'id':_0x49894a[_0x12a4('0x52')]['id']},'attributes':['id',_0x12a4('0x31')]})['then'](handleEntityNotFound(_0x5ce731,null))['then'](function(_0x3964d1){if(_0x3964d1){_0x5cc631=_0x3964d1;return db[_0x12a4('0x5e')]['destroy']({'where':{'userProfileId':_0x49894a[_0x12a4('0x52')]['id'],'sectionId':_0x49894a['query'][_0x12a4('0x69')]}});}})[_0x12a4('0x4b')](function(){return _0x5cc631;})[_0x12a4('0x4b')](respondWithStatusCode(_0x5ce731,null))[_0x12a4('0x50')](handleError(_0x5ce731,null));};exports['getSections']=function(_0x4c45f4,_0x21be34){var _0x4927ea=[];var _0x1fd7e4=[];return db[_0x12a4('0x5e')][_0x12a4('0x4e')]({'where':{'userProfileId':_0x4c45f4[_0x12a4('0x52')]['id']},'raw':!![]})[_0x12a4('0x4b')](function(_0x1c30ce){_0x4927ea=_[_0x12a4('0x4a')](_0x1c30ce,function(_0x28dc45){return _0x28dc45[_0x12a4('0x6a')]===0x1||_[_0x12a4('0x6b')]([0x3eb,0x709],_0x28dc45[_0x12a4('0x66')]);});if(!_[_0x12a4('0x6c')](_0x4927ea)){return _[_0x12a4('0x34')](_0x4927ea,function(_0x38e37c){return _0x38e37c['sectionId'];});}else{return;}})[_0x12a4('0x4b')](function(_0x2e22e1){if(_0x2e22e1)_0x1fd7e4=_0x2e22e1;if(_[_0x12a4('0x6b')](_0x1fd7e4,0x64)){var _0x39047d=_[_0x12a4('0x54')](_0x4927ea,{'sectionId':0x64});return hasDefaultDashboard(_0x39047d)[_0x12a4('0x4b')](function(_0x425af0){return _[_0x12a4('0x34')](_0x4927ea,function(_0x2a36cf){if(_0x2a36cf[_0x12a4('0x66')]===0x64){_0x2a36cf[_0x12a4('0x6d')]=_0x425af0;}return _0x2a36cf;});});}else{return;}})['then'](function(_0x3f52a1){if(_0x3f52a1)_0x4927ea=_0x3f52a1;if(_[_0x12a4('0x6b')](_0x1fd7e4,0x3eb)){var _0x3e1d3e=_[_0x12a4('0x54')](_0x4927ea,{'sectionId':0x3eb});return getCustomDashboards(_0x3e1d3e)[_0x12a4('0x4b')](function(_0x2145d3){return _['map'](_0x4927ea,function(_0x99906a){if(_0x3e1d3e[_0x12a4('0x6a')]){if(_0x99906a[_0x12a4('0x66')]===0x3eb){_0x99906a['subsections']=_0x2145d3;}}else{if(_0x99906a['sectionId']===0x64){if(!_0x99906a['subsections']){_0x99906a['subsections']=[];}_0x99906a['subsections']=_0x99906a['subsections'][_0x12a4('0x6e')](_0x2145d3);}}return _0x99906a;});});}else{return;}})[_0x12a4('0x4b')](function(_0x408ed4){if(_0x408ed4)_0x4927ea=_0x408ed4;if(_[_0x12a4('0x6b')](_0x1fd7e4,0x709)){var _0x3e3afe=_[_0x12a4('0x54')](_0x4927ea,{'sectionId':0x709});return getPlugins(_0x3e3afe)[_0x12a4('0x4b')](function(_0x365202){if(_0x3e3afe[_0x12a4('0x6a')]){return _[_0x12a4('0x34')](_0x4927ea,function(_0x1afd81){if(_0x1afd81[_0x12a4('0x66')]===0x709){_0x1afd81[_0x12a4('0x6d')]=_0x365202;}return _0x1afd81;});}else{var _0x3d76a4={'sectionId':0x76c,'enabled':0x1,'subsections':_0x365202};var _0x300baf=_[_0x12a4('0x34')](_0x4927ea);_0x300baf[_0x12a4('0x68')](_0x3d76a4);return _0x300baf;}});}else{return;}})[_0x12a4('0x4b')](function(_0xdba1e3){if(_0xdba1e3)_0x4927ea=_0xdba1e3;return _['filter'](_0x4927ea,[_0x12a4('0x6a'),0x1]);})[_0x12a4('0x4b')](respondWithResult(_0x21be34,null))[_0x12a4('0x50')](handleError(_0x21be34,null));};function hasDefaultDashboard(_0x3d4c53){var _0x2d9707=[0x65];return new BPromise(function(_0x83c6e0,_0x28b350){try{if(_0x3d4c53[_0x12a4('0x60')]){_0x83c6e0(_0x2d9707);}else{return db[_0x12a4('0x61')][_0x12a4('0x6f')]({'where':{'sectionId':_0x3d4c53['id']},'raw':!![]})[_0x12a4('0x4b')](function(_0x59e9f8){_0x59e9f8?_0x83c6e0(_0x2d9707):_0x83c6e0();});}}catch(_0xfc7d06){_0x28b350(_0xfc7d06);}});}function getCustomDashboards(_0xd9888b){var _0x4c3873=[];return new BPromise(function(_0x3bb5f8,_0x210523){try{if(_0xd9888b[_0x12a4('0x60')]){return db[_0x12a4('0x70')][_0x12a4('0x4e')]({'raw':!![]})[_0x12a4('0x4b')](function(_0x495795){_0x495795['forEach'](function(_0x33bf74){_0x4c3873[_0x12a4('0x68')](_0x33bf74['id']+0x1869f);});_0x3bb5f8(_0x4c3873);});}else{return db[_0x12a4('0x61')][_0x12a4('0x4e')]({'where':{'sectionId':_0xd9888b['id']},'raw':!![]})['then'](function(_0x322706){_0x322706[_0x12a4('0x71')](function(_0x4b37e1){_0x4c3873[_0x12a4('0x68')](_0x4b37e1['resourceId']+0x1869f);});_0x3bb5f8(_0x4c3873);});}}catch(_0x38f5d6){_0x210523(_0x38f5d6);}});}function getPlugins(_0x303b64){var _0x320bb5=[];return new BPromise(function(_0x24f9e3,_0xbfa3ee){try{if(_0x303b64[_0x12a4('0x60')]){return db['Plugin'][_0x12a4('0x4e')]({'raw':!![]})['then'](function(_0x28e188){_0x28e188[_0x12a4('0x71')](function(_0x17bbc7){_0x320bb5['push'](_0x17bbc7['id']+0x15b38);});_0x24f9e3(_0x320bb5);});}else{return db[_0x12a4('0x61')]['findAll']({'where':{'sectionId':_0x303b64['id']},'raw':!![]})['then'](function(_0x2ade66){_0x2ade66[_0x12a4('0x71')](function(_0xbc65eb){_0x320bb5[_0x12a4('0x68')](_0xbc65eb[_0x12a4('0x72')]+0x15b38);});_0x24f9e3(_0x320bb5);});}}catch(_0x26c2e4){_0xbfa3ee(_0x26c2e4);}});}exports['addResources']=function(_0x5ca462,_0x462df7){return db[_0x12a4('0x35')][_0x12a4('0x54')]({'where':{'id':_0x5ca462[_0x12a4('0x52')]['id']}})[_0x12a4('0x4b')](handleEntityNotFound(_0x462df7,null))[_0x12a4('0x4b')](function(_0x1e0423){if(_0x1e0423){return db[_0x12a4('0x65')][_0x12a4('0x5c')](function(_0x36a068){return db[_0x12a4('0x5e')][_0x12a4('0x4e')]({'where':{'userProfileId':_0x5ca462[_0x12a4('0x52')]['id']},'attributes':['id'],'raw':!![]})[_0x12a4('0x4b')](function(_0x164bd0){if(_0x164bd0){return db[_0x12a4('0x5e')][_0x12a4('0x2e')]({'where':{'userProfileId':_0x5ca462[_0x12a4('0x52')]['id'],'id':_[_0x12a4('0x34')](_0x164bd0,function(_0x5a1cea){return _0x5a1cea['id'];})},'transaction':_0x36a068});}})[_0x12a4('0x4b')](function(_0xb58353){var _0x441bdd=_[_0x12a4('0x34')](_0x5ca462[_0x12a4('0x5a')],function(_0x40cc25){_0x40cc25['userProfileId']=_0x5ca462[_0x12a4('0x52')]['id'];return _0x40cc25;});return db[_0x12a4('0x5e')][_0x12a4('0x73')](_0x441bdd,{'raw':!![],'transaction':_0x36a068});})[_0x12a4('0x4b')](function(_0x16685c){var _0x12155f=_[_0x12a4('0x4a')](_[_0x12a4('0x34')](_0x16685c,function(_0x1c42ef){return _0x1c42ef[_0x12a4('0x56')]({'plain':!![]});}),{'includeAll':![]});if(_0x12155f){return db[_0x12a4('0x5e')][_0x12a4('0x4e')]({'where':{'userProfileId':_0x5ca462[_0x12a4('0x52')]['id'],'sectionId':_[_0x12a4('0x34')](_0x12155f,function(_0x12c140){return _0x12c140['sectionId'];})},'attributes':['id',_0x12a4('0x66')],'raw':!![]})[_0x12a4('0x4b')](function(_0x43eefe){var _0x4385a2=_['map'](_0x5ca462[_0x12a4('0x5a')],function(_0x8b574d){_0x8b574d[_0x12a4('0x67')]=_0x5ca462[_0x12a4('0x52')]['id'];return _0x8b574d;});return db[_0x12a4('0x61')]['bulkCreate'](_0x4385a2,{'raw':!![],'transaction':_0x36a068});});}})[_0x12a4('0x50')](handleError(_0x462df7,null));});}})['then'](function(_0x167749){var _0x581950=_['map'](_0x167749,function(_0x3d6e0f){return _0x3d6e0f[_0x12a4('0x56')]({'plain':!![]});});})['then'](respondWithResult(_0x462df7,null))[_0x12a4('0x50')](handleError(_0x462df7,null));};exports[_0x12a4('0x74')]=function(_0x19c038,_0x216ecb,_0x5851e7){return db['UserProfile'][_0x12a4('0x54')]({'where':{'id':_0x19c038['params']['id']}})['then'](handleEntityNotFound(_0x216ecb,null))['then'](function(_0x5c0208){if(_0x5c0208){return _0x5c0208['removeResources'](_0x19c038[_0x12a4('0x3a')][_0x12a4('0x69')]);}})['then'](respondWithStatusCode(_0x216ecb,null))[_0x12a4('0x50')](handleError(_0x216ecb,null));};exports[_0x12a4('0x75')]=function(_0x1ea53b,_0x4767d1){var _0x1e5335={};if(!_0x1ea53b[_0x12a4('0x3a')][_0x12a4('0x76')])throw new Error('Missing\x20section\x20parameter');if(!_0x1ea53b[_0x12a4('0x3a')]['hasOwnProperty'](_0x12a4('0x42'))){_0x1e5335[_0x12a4('0x26')]=qs['limit'](_0x1ea53b[_0x12a4('0x3a')]['limit']);_0x1e5335[_0x12a4('0x24')]=qs[_0x12a4('0x24')](_0x1ea53b[_0x12a4('0x3a')]['offset']);}return db['UserProfile']['find']({'where':{'id':_0x1ea53b[_0x12a4('0x52')]['id']}})[_0x12a4('0x4b')](function(_0x370c1c){if(!_0x370c1c)throw new Error(_0x12a4('0x77')+_0x1ea53b['params']['id']);return db[_0x12a4('0x35')][_0x12a4('0x75')](_0x1ea53b);})[_0x12a4('0x4b')](respondWithFilteredResult(_0x4767d1,_0x1e5335))[_0x12a4('0x50')](handleError(_0x4767d1,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index bc1d303..c399e3c 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 _0x13c5=['emit','hasOwnProperty','events'];(function(_0x5ac821,_0x5d6bd3){var _0x1937df=function(_0x120d38){while(--_0x120d38){_0x5ac821['push'](_0x5ac821['shift']());}};_0x1937df(++_0x5d6bd3);}(_0x13c5,0x7a));var _0x513c=function(_0x261ac9,_0x42f3b6){_0x261ac9=_0x261ac9-0x0;var _0x130eb6=_0x13c5[_0x261ac9];return _0x130eb6;};'use strict';var EventEmitter=require(_0x513c('0x0'));var UserProfile=require('../../mysqldb')['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x432ab7){return function(_0x516e1a,_0x4d46c0,_0x477e2c){UserProfileEvents[_0x513c('0x1')](_0x432ab7+':'+_0x516e1a['id'],_0x516e1a);UserProfileEvents[_0x513c('0x1')](_0x432ab7,_0x516e1a);_0x477e2c(null);};}for(var e in events){if(events[_0x513c('0x2')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0x9bd9=['events','../../mysqldb','UserProfile','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x1948b5,_0x2a222e){var _0x597f7b=function(_0x4f01f3){while(--_0x4f01f3){_0x1948b5['push'](_0x1948b5['shift']());}};_0x597f7b(++_0x2a222e);}(_0x9bd9,0x1a4));var _0x99bd=function(_0x429c0c,_0x560f5b){_0x429c0c=_0x429c0c-0x0;var _0x45c8a5=_0x9bd9[_0x429c0c];return _0x45c8a5;};'use strict';var EventEmitter=require(_0x99bd('0x0'));var UserProfile=require(_0x99bd('0x1'))['db'][_0x99bd('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x99bd('0x3')](0x0);var events={'afterCreate':_0x99bd('0x4'),'afterUpdate':_0x99bd('0x5'),'afterDestroy':'remove'};function emitEvent(_0x34aff7){return function(_0x4a0491,_0x204fbb,_0x1b3141){UserProfileEvents['emit'](_0x34aff7+':'+_0x4a0491['id'],_0x4a0491);UserProfileEvents[_0x99bd('0x6')](_0x34aff7,_0x4a0491);_0x1b3141(null);};}for(var e in events){if(events[_0x99bd('0x7')](e)){var event=events[e];UserProfile[_0x99bd('0x8')](e,emitEvent(event));}}module[_0x99bd('0x9')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 11bbf37..3227d7c 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 _0x3169=['filter','field','value','findAll','then','associatedResources','map','catch','model','resolve','UserProfileResource','toLowerCase','squareprojects','childModel','odbc','SquareOdbc','SquareProjects','name','projectName','contacts','parentSections','Lists','ListId','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','chatwebsites','ChatWebsite','faxqueues','FaxQueue','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','voicerecordings','VoiceRecording','Agents','User','role','agent','Telephones','VoiceQueues','queue','inbound','QueueCampaigns','VoiceQueue','type','musiconholds','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','WhatsappAccount','voicequeues','queuecampaigns','agents','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','FreshdeskAccount','sugarcrmaccounts','deskaccounts','zohoaccounts','ZohoAccount','vtigeraccounts','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','scheduler','Schedule','sounds','Sound','tags','Tag','templates','triggers','Trigger','trunks','Variable','Plugin','AnalyticExtractedReport','Reports','reportId','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','ui.','InteractionId','ui.createdAt','user_has_','where','sequelize','toString','OpenTabs','define','UserProfile','user_profiles','raw','query','section','mergeResources','isEmpty','length','find','params','all','ignore','union','push','autoAssociation','rawAttributes','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','offset','order','sort','pick','key','foreignKey','forEach','merge','options','includeAll','include','default','DefaultReports','custom','rows','ids','customSorting','extraQueryConditions','count','tag','ThroughTags','true','chat','dataValues','sms','fax','mail','openchannel','whatsapp','../../components/parsers/qs','squel','exports'];(function(_0xbec5ca,_0x5b8778){var _0x4d8b96=function(_0x34412f){while(--_0x34412f){_0xbec5ca['push'](_0xbec5ca['shift']());}};_0x4d8b96(++_0x5b8778);}(_0x3169,0x165));var _0x9316=function(_0x10dbf6,_0x3ff964){_0x10dbf6=_0x10dbf6-0x0;var _0x452147=_0x3169[_0x10dbf6];return _0x452147;};'use strict';var _=require('lodash');var attributes=require('./userProfile.attributes');var qs=require(_0x9316('0x0'));var squel=require(_0x9316('0x1'));module[_0x9316('0x2')]=function(_0x2c7521){var _0x3d32a3=_0x2c7521['models'];function _0x352671(_0x2fb109,_0x1f89e4){return new Promise(function(_0x302d08,_0xf7b868){if(!_0x1f89e4)return _0x302d08(null);var _0x5213a1=_0x1f89e4[_0x9316('0x3')]?{[_0x1f89e4[_0x9316('0x3')][_0x9316('0x4')]]:_0x1f89e4['filter'][_0x9316('0x5')]}:undefined;return _0x3d32a3[_0x2fb109][_0x9316('0x6')]({'where':_0x5213a1,'raw':!![]})[_0x9316('0x7')](function(_0x25c60e){_0x1f89e4[_0x9316('0x8')]=_[_0x9316('0x9')](_0x25c60e,'id');_0x302d08(_0x1f89e4);})[_0x9316('0xa')](function(_0x396529){_0xf7b868(_0x396529);});});}function _0xee4b1f(_0x3f715d,_0xfda701){return new Promise(function(_0x11b374,_0x1a76b5){var _0x5335b6=_0x3f715d[_0x9316('0x3')]?{[_0x3f715d['filter'][_0x9316('0x4')]]:_0x3f715d[_0x9316('0x3')][_0x9316('0x5')]}:undefined;return _0x3d32a3[_0x3f715d[_0x9316('0xb')]][_0x9316('0x6')]({'where':_0x5335b6,'raw':!![]})[_0x9316('0x7')](function(_0x5b8ff2){_0xfda701['associatedResources']=_['map'](_0x5b8ff2,function(_0x210b28){return _0x210b28['name'];});_0x11b374(_0xfda701);})['catch'](function(_0x230320){_0x1a76b5(_0x230320);});});}function _0x1229c6(_0x13b10f,_0x49fb37,_0x17686b){if(!_0x49fb37)return Promise[_0x9316('0xc')](null);return new Promise(function(_0x320652,_0x49c000){return _0x3d32a3[_0x9316('0xd')]['findAll']({'where':{'sectionId':_0x49fb37['id']},'raw':!![]})[_0x9316('0x7')](function(_0x22c17d){if(_0x13b10f['field']&&_0x13b10f[_0x9316('0x4')]!=='id'){_0x49fb37[_0x9316('0x8')]=_['map'](_0x22c17d,function(_0x4777b3){return _0x4777b3[_0x13b10f['field']];});}else{if(_0x17686b==='AnalyticExtractedReport'){_0x49fb37[_0x9316('0x8')]=_[_0x9316('0x9')](_0x22c17d,function(_0x4a9249){return{'id':_0x4a9249['resourceId'],'type':_0x4a9249['type']};});}else{_0x49fb37[_0x9316('0x8')]=_[_0x9316('0x9')](_0x22c17d,function(_0x495621){return _0x495621['resourceId'];});}}_0x320652(_0x49fb37);})[_0x9316('0xa')](function(_0x132f7d){_0x49c000(_0x132f7d);});});}function _0x41c75b(_0x44a7e9,_0x2c29b5){var _0x13caf6={'parentSections':[]};switch(_0x44a7e9[_0x9316('0xe')]()){case _0x9316('0xf'):_0x13caf6[_0x9316('0x10')]='SquareProject';break;case _0x9316('0x11'):_0x13caf6[_0x9316('0x10')]=_0x9316('0x12');break;case'squarerecordings':_0x13caf6[_0x9316('0x10')]='SquareRecording';_0x13caf6['parentSections']=[{'name':_0x9316('0x13'),'field':_0x9316('0x14'),'foreignKey':_0x9316('0x15')}];break;case'projects':_0x13caf6[_0x9316('0x10')]='JscriptyProject';break;case _0x9316('0x16'):_0x13caf6['childModel']='CmContact';_0x13caf6[_0x9316('0x17')]=[{'name':_0x9316('0x18'),'field':'id','foreignKey':_0x9316('0x19')}];break;case'lists':_0x13caf6[_0x9316('0x10')]='CmList';break;case _0x9316('0x1a'):_0x13caf6[_0x9316('0x10')]=_0x9316('0x1b');break;case _0x9316('0x1c'):_0x13caf6[_0x9316('0x10')]=_0x9316('0x1d');break;case _0x9316('0x1e'):_0x13caf6[_0x9316('0x10')]='ChatQueue';break;case _0x9316('0x1f'):_0x13caf6[_0x9316('0x10')]=_0x9316('0x20');break;case _0x9316('0x21'):_0x13caf6[_0x9316('0x10')]=_0x9316('0x22');break;case'faxaccounts':_0x13caf6[_0x9316('0x10')]='FaxAccount';break;case _0x9316('0x23'):case _0x9316('0x24'):case _0x9316('0x25'):_0x13caf6[_0x9316('0x10')]=_0x9316('0x26');break;case _0x9316('0x27'):_0x13caf6[_0x9316('0x10')]=_0x9316('0x28');break;case _0x9316('0x29'):_0x13caf6[_0x9316('0x10')]='VoiceMail';break;case _0x9316('0x2a'):_0x13caf6[_0x9316('0x10')]=_0x9316('0x2b');_0x13caf6[_0x9316('0x17')]=[{'name':_0x9316('0x2c'),'field':_0x9316('0x14'),'foreignKey':'membername','model':_0x9316('0x2d'),'filter':{'field':_0x9316('0x2e'),'value':[_0x9316('0x2f')]}},{'name':_0x9316('0x30'),'field':_0x9316('0x14'),'foreignKey':'membername','model':_0x9316('0x2d'),'filter':{'field':'role','value':['telephone']}},{'name':_0x9316('0x31'),'field':_0x9316('0x14'),'foreignKey':_0x9316('0x32'),'model':'VoiceQueue','filter':{'field':'type','value':[_0x9316('0x33')]}},{'name':_0x9316('0x34'),'field':'name','foreignKey':_0x9316('0x32'),'model':_0x9316('0x35'),'filter':{'field':_0x9316('0x36'),'value':['outbound']}}];break;case _0x9316('0x37'):_0x13caf6[_0x9316('0x10')]='VoiceMusicOnHold';break;case'chanspies':_0x13caf6[_0x9316('0x10')]='VoiceChanSpy';break;case _0x9316('0x38'):_0x13caf6[_0x9316('0x10')]=_0x9316('0x39');break;case _0x9316('0x3a'):_0x13caf6['childModel']=_0x9316('0x3b');break;case _0x9316('0x3c'):_0x13caf6[_0x9316('0x10')]=_0x9316('0x3d');break;case'mailaccounts':_0x13caf6[_0x9316('0x10')]=_0x9316('0x3e');break;case _0x9316('0x3f'):_0x13caf6['childModel']=_0x9316('0x40');break;case _0x9316('0x41'):_0x13caf6[_0x9316('0x10')]=_0x9316('0x42');break;case'openchannelaccounts':_0x13caf6[_0x9316('0x10')]=_0x9316('0x43');break;case _0x9316('0x44'):_0x13caf6['childModel']=_0x9316('0x45');break;case _0x9316('0x46'):_0x13caf6[_0x9316('0x10')]=_0x9316('0x47');break;case _0x9316('0x48'):_0x13caf6[_0x9316('0x10')]=_0x9316('0x49');break;case'whatsappaccounts':_0x13caf6[_0x9316('0x10')]=_0x9316('0x4a');break;case'teams':_0x13caf6[_0x9316('0x10')]='Team';break;case _0x9316('0x4b'):case _0x9316('0x4c'):_0x13caf6[_0x9316('0x10')]='VoiceQueue';if(_0x2c29b5){_0x13caf6[_0x9316('0x17')]=[{'name':_0x9316('0x31')},{'name':'QueueCampaigns'}];}break;case'users':case _0x9316('0x4d'):case'telephones':_0x13caf6[_0x9316('0x10')]=_0x9316('0x2d');if(_0x2c29b5){_0x13caf6[_0x9316('0x17')]=[{'name':_0x9316('0x4e'),'filter':{'field':_0x9316('0x2e'),'value':[_0x9316('0x4f'),_0x9316('0x50')]},'ignore':!![]},{'name':_0x9316('0x2c')},{'name':_0x9316('0x30')}];}break;case _0x9316('0x51'):_0x13caf6[_0x9316('0x10')]=_0x9316('0x52');break;case _0x9316('0x53'):_0x13caf6[_0x9316('0x10')]='SalesforceAccount';break;case'freshdeskaccounts':_0x13caf6[_0x9316('0x10')]=_0x9316('0x54');break;case _0x9316('0x55'):_0x13caf6[_0x9316('0x10')]='SugarcrmAccount';break;case _0x9316('0x56'):_0x13caf6['childModel']='DeskAccount';break;case _0x9316('0x57'):_0x13caf6[_0x9316('0x10')]=_0x9316('0x58');break;case _0x9316('0x59'):_0x13caf6['childModel']='User';break;case'cannedanswers':_0x13caf6[_0x9316('0x10')]='CannedAnswer';break;case'dispositions':_0x13caf6['childModel']=_0x9316('0x5a');break;case _0x9316('0x5b'):_0x13caf6[_0x9316('0x10')]=_0x9316('0x5c');break;case _0x9316('0x5d'):_0x13caf6[_0x9316('0x10')]=_0x9316('0x5e');break;case _0x9316('0x5f'):_0x13caf6[_0x9316('0x10')]='Pause';break;case _0x9316('0x60'):_0x13caf6[_0x9316('0x10')]=_0x9316('0x61');break;case _0x9316('0x62'):_0x13caf6[_0x9316('0x10')]=_0x9316('0x63');break;case _0x9316('0x64'):_0x13caf6[_0x9316('0x10')]=_0x9316('0x65');break;case _0x9316('0x66'):_0x13caf6['childModel']='Template';break;case _0x9316('0x67'):_0x13caf6[_0x9316('0x10')]=_0x9316('0x68');break;case _0x9316('0x69'):_0x13caf6['childModel']='Trunk';break;case'variables':_0x13caf6[_0x9316('0x10')]=_0x9316('0x6a');break;case'plugins':_0x13caf6[_0x9316('0x10')]=_0x9316('0x6b');break;case'extractedreports':_0x13caf6[_0x9316('0x10')]=_0x9316('0x6c');_0x13caf6[_0x9316('0x17')]=[{'name':_0x9316('0x6d'),'field':'id','foreignKey':_0x9316('0x6e')}];break;case'metrics':_0x13caf6[_0x9316('0x10')]=_0x9316('0x6f');break;}return _0x13caf6;}function _0x158ecb(_0x55b9d3,_0x20a3e0){var _0x2b4ceb=_0x55b9d3[_0x9316('0x70')](0x0)[_0x9316('0x71')]()+_0x55b9d3[_0x9316('0x72')](0x1);var _0x3da757={'type':_0x3d32a3[_0x9316('0x73')][_0x9316('0x74')][_0x9316('0x75')],'raw':!![]};return new Promise(function(_0x53a1e4,_0x503567){var _0x3eb046=squel['select']()[_0x9316('0x4')](_0x9316('0x76')+_0x2b4ceb+_0x9316('0x77'),'id')[_0x9316('0x4')](_0x9316('0x78'))['from'](_0x9316('0x79')+_0x55b9d3+'_interactions','ui')[_0x9316('0x7a')]('ui.UserId\x20=\x20?',_0x20a3e0['id']);return _0x3d32a3[_0x9316('0x7b')]['query'](_0x3eb046[_0x9316('0x7c')](),_0x3da757)[_0x9316('0x7')](function(_0x45c991){_0x20a3e0[_0x2b4ceb+_0x9316('0x7d')]=_0x45c991;_0x53a1e4(_0x45c991);})[_0x9316('0xa')](function(_0x521280){_0x503567(_0x521280);});});}return _0x2c7521[_0x9316('0x7e')](_0x9316('0x7f'),attributes,{'tableName':_0x9316('0x80'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x24121d){var _0x5e748e={'raw':_0x24121d['query'][_0x9316('0x81')],'where':{}};var _0x1b6f7a={};var _0x53c091={'count':0x0,'rows':[]};var _0x385b02=_0x24121d[_0x9316('0x82')][_0x9316('0x83')];var _0xe57b52=_0x24121d[_0x9316('0x82')][_0x9316('0x84')]||![];var _0x2491f5=_0x41c75b(_0x385b02,_0xe57b52);if(!_0x2491f5[_0x9316('0x10')])throw new Error('Invalid\x20section\x20\x27'+_0x385b02+'\x27');var _0x1174b7=[{'name':_0x385b02}];if(!_[_0x9316('0x85')](_0x2491f5['parentSections']))_0x1174b7=_0x2491f5[_0x9316('0x17')];var _0x46ccfb=[];for(var _0x308447=0x0;_0x308447<_0x1174b7[_0x9316('0x86')];_0x308447++){_0x46ccfb['push'](_0x3d32a3['UserProfileSection'][_0x9316('0x87')]({'where':{'userProfileId':_0x24121d[_0x9316('0x88')]['id'],'name':_0x1174b7[_0x308447][_0x9316('0x14')]},'raw':!![]}));}return Promise[_0x9316('0x89')](_0x46ccfb)[_0x9316('0x7')](function(_0x9af72d){var _0x296a9c=_[_0x9316('0x3')](_0x9af72d,function(_0x9e8402){return _0x9e8402?_0x9e8402:undefined;});var _0xd3df8=_[_0x9316('0x3')](_0x1174b7,[_0x9316('0x8a'),!![]]);var _0x3fb5c5=_['isEmpty'](_0x296a9c)&&_['isEmpty'](_0xd3df8)?null:_[_0x9316('0x8b')](_0xd3df8,_0x296a9c);if(!_0x3fb5c5)return null;var _0x38f343=[];for(var _0x440474=0x0;_0x440474<_0x3fb5c5['length'];_0x440474++){var _0x4470fe=_['find'](_0x1174b7,function(_0x5c4b2c){return _0x3fb5c5[_0x440474]?_0x5c4b2c[_0x9316('0x14')]===_0x3fb5c5[_0x440474][_0x9316('0x14')]:null;});if(_0x4470fe){if(_0x3fb5c5[_0x440474][_0x9316('0x8a')]){_0x38f343[_0x9316('0x8c')](_0x352671(_0x2491f5[_0x9316('0x10')],_0x3fb5c5[_0x440474]));}else{if(!_0x3fb5c5[_0x440474][_0x9316('0x8d')]){_0x38f343[_0x9316('0x8c')](_0x1229c6(_0x4470fe,_0x3fb5c5[_0x440474],_0x2491f5[_0x9316('0x10')]));}else{if(_0x4470fe[_0x9316('0xb')]){_0x38f343[_0x9316('0x8c')](_0xee4b1f(_0x4470fe,_0x3fb5c5[_0x440474]));}}}}}return Promise[_0x9316('0x89')](_0x38f343);})['then'](function(_0x3acc91){var _0x13fa03=_0x3acc91;var _0x5086ac=null;if(_0x13fa03){_0x5086ac=_0x13fa03['length']===0x1?_0x13fa03[0x0]:null;}if(!_0x5086ac&&!_0x13fa03)return _0x53c091;var _0x5e2f34=_0x3d32a3[_0x2491f5[_0x9316('0x10')]][_0x9316('0x8e')];_0x1b6f7a[_0x9316('0xb')]=_[_0x9316('0x8f')](_0x5e2f34);_0x1b6f7a[_0x9316('0x82')]=_[_0x9316('0x8f')](_0x24121d[_0x9316('0x82')]);_0x1b6f7a[_0x9316('0x90')]=_[_0x9316('0x91')](_0x1b6f7a[_0x9316('0xb')],_0x1b6f7a[_0x9316('0x82')]);_0x5e748e['attributes']=_['intersection'](_0x1b6f7a[_0x9316('0xb')],qs[_0x9316('0x92')](_0x24121d['query'][_0x9316('0x92')]));_0x5e748e[_0x9316('0x93')]=_0x5e748e['attributes'][_0x9316('0x86')]?_0x5e748e[_0x9316('0x93')]:_0x1b6f7a['model'];if(!_0x24121d[_0x9316('0x82')][_0x9316('0x94')](_0x9316('0x95'))){_0x5e748e['limit']=qs['limit'](_0x24121d[_0x9316('0x82')][_0x9316('0x96')]);_0x5e748e['offset']=qs[_0x9316('0x97')](_0x24121d['query'][_0x9316('0x97')]);}_0x5e748e[_0x9316('0x98')]=qs[_0x9316('0x99')](_0x24121d['query'][_0x9316('0x99')]);_0x5e748e[_0x9316('0x7a')]=qs[_0x9316('0x90')](_[_0x9316('0x9a')](_0x24121d['query'],_0x1b6f7a[_0x9316('0x90')]));if(_0x24121d[_0x9316('0x82')]['filter']){_0x5e748e[_0x9316('0x7a')]=_['merge'](_0x5e748e[_0x9316('0x7a')],{'$or':_[_0x9316('0x9')](_0x5e2f34,function(_0xfad572){if(_0xfad572[_0x9316('0x36')][_0x9316('0x9b')]!=='VIRTUAL'){var _0x197bd5={};_0x197bd5[_0xfad572[_0x9316('0x4')]]={'$like':'%'+_0x24121d[_0x9316('0x82')]['filter']+'%'};return _0x197bd5;}})});}var _0x5a4528=[];var _0x28a96c=null;var _0x2c17fd={};if(_0x5086ac){_0x28a96c=_[_0x9316('0x87')](_0x1174b7,['name',_0x5086ac[_0x9316('0x14')]]);if(_0x28a96c[_0x9316('0x4')]){_0x2c17fd={};if(_0x2491f5[_0x9316('0x10')]==='AnalyticExtractedReport'){_0x2c17fd[_0x28a96c[_0x9316('0x9c')]]=_['map'](_0x5086ac[_0x9316('0x8')],'id');}else{_0x2c17fd[_0x28a96c[_0x9316('0x9c')]]=_0x5086ac[_0x9316('0x8')];}_0x5a4528[_0x9316('0x8c')](_0x2c17fd);}else{_0x5e748e['where']['id']=_0x5086ac[_0x9316('0x8')];}}else{for(var _0x757df5=0x0;_0x757df5<_0x13fa03['length'];_0x757df5++){_0x28a96c=_[_0x9316('0x87')](_0x1174b7,[_0x9316('0x14'),_0x13fa03[_0x757df5][_0x9316('0x14')]]);if(_0x28a96c[_0x9316('0x4')]){_0x2c17fd={};_0x2c17fd[_0x28a96c[_0x9316('0x9c')]]=_0x13fa03[_0x757df5][_0x9316('0x8')];_0x5a4528[_0x9316('0x8c')](_0x2c17fd);}else{if(!_0x5e748e[_0x9316('0x7a')]['id'])_0x5e748e[_0x9316('0x7a')]['id']=[];_0x13fa03[_0x757df5][_0x9316('0x8')][_0x9316('0x9d')](function(_0x5e784e){_0x5e748e[_0x9316('0x7a')]['id']['push'](_0x5e784e);});}}}if(!_['isEmpty'](_0x5a4528)){_0x5e748e[_0x9316('0x7a')]=_[_0x9316('0x9e')](_0x5e748e[_0x9316('0x7a')],{'$and':{'$or':_0x5a4528}});}_0x5e748e=_[_0x9316('0x9e')]({},_0x5e748e,_0x24121d[_0x9316('0x9f')]);if(_0x5086ac&&!_0x5086ac[_0x9316('0x8d')]&&_0x2491f5[_0x9316('0x10')]===_0x9316('0x6c')){if(_0x24121d['query'][_0x9316('0xa0')]){_0x5e748e[_0x9316('0xa1')]=[{'all':!![]}];}return _0x3d32a3[_0x2491f5[_0x9316('0x10')]][_0x9316('0x6')](_0x5e748e)['then'](function(_0x4ccfb0){var _0x55c3d9=[];_0x4ccfb0[_0x9316('0x9d')](function(_0x206800){var _0x38ac59;switch(_0x206800['reportType']){case _0x9316('0xa2'):_0x38ac59=_[_0x9316('0x87')](_0x5086ac[_0x9316('0x8')],function(_0x35c789){return _0x35c789['id']===_0x206800['reportId']&&_0x35c789[_0x9316('0x36')]===_0x9316('0xa3');});break;case _0x9316('0xa4'):_0x38ac59=_[_0x9316('0x87')](_0x5086ac[_0x9316('0x8')],function(_0x2ba136){return _0x2ba136['id']===_0x206800[_0x9316('0x6e')]&&_0x2ba136[_0x9316('0x36')]==='CustomReports';});break;}if(_0x38ac59)_0x55c3d9[_0x9316('0x8c')](_0x206800);});_0x53c091['count']=_0x55c3d9[_0x9316('0x86')];_0x53c091[_0x9316('0xa5')]=_0x55c3d9;return _0x53c091;});}else{if(!_[_0x9316('0x85')](_0x24121d[_0x9316('0x82')][_0x9316('0xa6')])){_0x5e748e[_0x9316('0x7a')]['id']=_0x5e748e[_0x9316('0x7a')]['id']?_[_0x9316('0x91')](_0x5e748e['where']['id'],_0x24121d['query'][_0x9316('0xa6')]):_0x24121d[_0x9316('0x82')][_0x9316('0xa6')];if(_0x24121d[_0x9316('0x82')][_0x9316('0xa7')]){_0x5e748e['order']=_0x24121d['query'][_0x9316('0xa7')];}}if(_0x24121d['query'][_0x9316('0xa8')]){_0x5e748e[_0x9316('0x7a')]=_[_0x9316('0x9e')](_0x5e748e[_0x9316('0x7a')],{'$and':_0x24121d[_0x9316('0x82')][_0x9316('0xa8')]});}return _0x3d32a3[_0x2491f5[_0x9316('0x10')]][_0x9316('0xa9')]({'where':_0x5e748e[_0x9316('0x7a')]})['then'](function(_0x2ae000){_0x53c091[_0x9316('0xa9')]=_0x2ae000;if(_0x24121d[_0x9316('0x82')][_0x9316('0xa0')]){if(_0x2491f5[_0x9316('0x10')]==='CmContact'){_0x5e748e[_0x9316('0xa1')]=[{'model':_0x3d32a3[_0x9316('0x65')],'as':'Tags','attributes':['id',_0x9316('0x14'),'color'],'required':_0x24121d['query'][_0x9316('0xaa')]?!![]:![]},{'model':_0x3d32a3[_0x9316('0x65')],'as':_0x9316('0xab'),'attributes':['id',_0x9316('0x14'),'color'],'through':_0x24121d[_0x9316('0x82')][_0x9316('0xaa')]?{'attributes':[],'where':{'TagId':_0x24121d[_0x9316('0x82')][_0x9316('0xaa')]||undefined}}:{},'required':_0x24121d[_0x9316('0x82')][_0x9316('0xaa')]?!![]:![]}];}else{_0x5e748e[_0x9316('0xa1')]=[{'all':!![]}];}}return _0x3d32a3[_0x2491f5[_0x9316('0x10')]]['findAll'](_0x5e748e);})[_0x9316('0x7')](function(_0x325fd0){_0x53c091['rows']=_0x325fd0;if(_0x385b02===_0x9316('0x2c')&&_0x24121d[_0x9316('0x82')]['openTabs']===_0x9316('0xac')){var _0x39c0c9=[];for(var _0x5d37e8=0x0;_0x5d37e8<_0x53c091[_0x9316('0xa5')][_0x9316('0x86')];_0x5d37e8++){_0x39c0c9[_0x9316('0x8c')](_0x158ecb(_0x9316('0xad'),_0x53c091[_0x9316('0xa5')][_0x5d37e8][_0x9316('0xae')]));_0x39c0c9['push'](_0x158ecb(_0x9316('0xaf'),_0x53c091[_0x9316('0xa5')][_0x5d37e8][_0x9316('0xae')]));_0x39c0c9[_0x9316('0x8c')](_0x158ecb(_0x9316('0xb0'),_0x53c091['rows'][_0x5d37e8][_0x9316('0xae')]));_0x39c0c9[_0x9316('0x8c')](_0x158ecb(_0x9316('0xb1'),_0x53c091['rows'][_0x5d37e8]['dataValues']));_0x39c0c9[_0x9316('0x8c')](_0x158ecb(_0x9316('0xb2'),_0x53c091[_0x9316('0xa5')][_0x5d37e8][_0x9316('0xae')]));_0x39c0c9[_0x9316('0x8c')](_0x158ecb(_0x9316('0xb3'),_0x53c091['rows'][_0x5d37e8][_0x9316('0xae')]));}return Promise[_0x9316('0x89')](_0x39c0c9)[_0x9316('0x7')](function(){return _0x53c091;});}return _0x53c091;});}});}}});}; \ No newline at end of file +var _0x7f63=['models','filter','field','value','then','catch','model','findAll','map','name','resolve','associatedResources','resourceId','childModel','odbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','chatwebsites','FaxQueue','faxaccounts','FaxAccount','internalroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','User','agent','membername','telephone','VoiceQueues','queue','type','inbound','outbound','musiconholds','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailaccounts','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','voicequeues','queuecampaigns','VoiceQueue','QueueCampaigns','agents','Users','role','admin','user','Telephones','zendeskaccounts','ZendeskAccount','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','tags','Tag','triggers','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','AnalyticExtractedReport','Reports','reportId','metrics','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','toString','OpenTabs','define','user_profiles','query','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','params','all','ignore','union','find','rawAttributes','keys','filters','intersection','attributes','fields','nolimit','limit','offset','order','sort','merge','foreignKey','forEach','options','autoAssociation','includeAll','reportType','default','DefaultReports','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','CmContact','include','Tags','color','tag','ThroughTags','true','chat','dataValues','fax','mail','openchannel','whatsapp','./userProfile.attributes','../../components/parsers/qs','squel'];(function(_0x18b086,_0xfcf61d){var _0x115ee8=function(_0x7fb4f1){while(--_0x7fb4f1){_0x18b086['push'](_0x18b086['shift']());}};_0x115ee8(++_0xfcf61d);}(_0x7f63,0x17b));var _0x37f6=function(_0xe45c3a,_0x183904){_0xe45c3a=_0xe45c3a-0x0;var _0x1bc5e8=_0x7f63[_0xe45c3a];return _0x1bc5e8;};'use strict';var _=require('lodash');var attributes=require(_0x37f6('0x0'));var qs=require(_0x37f6('0x1'));var squel=require(_0x37f6('0x2'));module['exports']=function(_0x1114c6){var _0x37c05c=_0x1114c6[_0x37f6('0x3')];function _0x10066c(_0x3d1b7e,_0x30dd79){return new Promise(function(_0x3ad41b,_0x5068d6){if(!_0x30dd79)return _0x3ad41b(null);var _0x522a2c=_0x30dd79['filter']?{[_0x30dd79[_0x37f6('0x4')][_0x37f6('0x5')]]:_0x30dd79[_0x37f6('0x4')][_0x37f6('0x6')]}:undefined;return _0x37c05c[_0x3d1b7e]['findAll']({'where':_0x522a2c,'raw':!![]})[_0x37f6('0x7')](function(_0x2d9040){_0x30dd79['associatedResources']=_['map'](_0x2d9040,'id');_0x3ad41b(_0x30dd79);})[_0x37f6('0x8')](function(_0x4ba61b){_0x5068d6(_0x4ba61b);});});}function _0x22d200(_0x1ca19f,_0x18de40){return new Promise(function(_0x4ab16e,_0x277825){var _0x4f43a4=_0x1ca19f[_0x37f6('0x4')]?{[_0x1ca19f[_0x37f6('0x4')]['field']]:_0x1ca19f[_0x37f6('0x4')]['value']}:undefined;return _0x37c05c[_0x1ca19f[_0x37f6('0x9')]][_0x37f6('0xa')]({'where':_0x4f43a4,'raw':!![]})[_0x37f6('0x7')](function(_0x1c302e){_0x18de40['associatedResources']=_[_0x37f6('0xb')](_0x1c302e,function(_0x31ea5e){return _0x31ea5e[_0x37f6('0xc')];});_0x4ab16e(_0x18de40);})[_0x37f6('0x8')](function(_0xe52659){_0x277825(_0xe52659);});});}function _0x22e4df(_0x4fd81e,_0x1711ae,_0x26cba7){if(!_0x1711ae)return Promise[_0x37f6('0xd')](null);return new Promise(function(_0x38403b,_0x47e7f8){return _0x37c05c['UserProfileResource'][_0x37f6('0xa')]({'where':{'sectionId':_0x1711ae['id']},'raw':!![]})[_0x37f6('0x7')](function(_0x59425e){if(_0x4fd81e[_0x37f6('0x5')]&&_0x4fd81e[_0x37f6('0x5')]!=='id'){_0x1711ae[_0x37f6('0xe')]=_[_0x37f6('0xb')](_0x59425e,function(_0x4ea671){return _0x4ea671[_0x4fd81e[_0x37f6('0x5')]];});}else{if(_0x26cba7==='AnalyticExtractedReport'){_0x1711ae['associatedResources']=_[_0x37f6('0xb')](_0x59425e,function(_0x1a3c36){return{'id':_0x1a3c36[_0x37f6('0xf')],'type':_0x1a3c36['type']};});}else{_0x1711ae['associatedResources']=_[_0x37f6('0xb')](_0x59425e,function(_0x313a09){return _0x313a09[_0x37f6('0xf')];});}}_0x38403b(_0x1711ae);})[_0x37f6('0x8')](function(_0x4ede7d){_0x47e7f8(_0x4ede7d);});});}function _0x5e06ed(_0x53655b,_0x1e87a5){var _0x34dcb6={'parentSections':[]};switch(_0x53655b['toLowerCase']()){case'squareprojects':_0x34dcb6[_0x37f6('0x10')]='SquareProject';break;case _0x37f6('0x11'):_0x34dcb6[_0x37f6('0x10')]='SquareOdbc';break;case _0x37f6('0x12'):_0x34dcb6['childModel']=_0x37f6('0x13');_0x34dcb6[_0x37f6('0x14')]=[{'name':_0x37f6('0x15'),'field':'name','foreignKey':_0x37f6('0x16')}];break;case _0x37f6('0x17'):_0x34dcb6[_0x37f6('0x10')]=_0x37f6('0x18');break;case _0x37f6('0x19'):_0x34dcb6[_0x37f6('0x10')]='CmContact';_0x34dcb6[_0x37f6('0x14')]=[{'name':_0x37f6('0x1a'),'field':'id','foreignKey':_0x37f6('0x1b')}];break;case _0x37f6('0x1c'):_0x34dcb6[_0x37f6('0x10')]=_0x37f6('0x1d');break;case _0x37f6('0x1e'):_0x34dcb6['childModel']=_0x37f6('0x1f');break;case _0x37f6('0x20'):_0x34dcb6['childModel']=_0x37f6('0x21');break;case _0x37f6('0x22'):_0x34dcb6[_0x37f6('0x10')]='ChatQueue';break;case _0x37f6('0x23'):_0x34dcb6['childModel']='ChatWebsite';break;case'faxqueues':_0x34dcb6[_0x37f6('0x10')]=_0x37f6('0x24');break;case _0x37f6('0x25'):_0x34dcb6[_0x37f6('0x10')]=_0x37f6('0x26');break;case'inboundroutes':case _0x37f6('0x27'):case'outboundroutes':_0x34dcb6[_0x37f6('0x10')]=_0x37f6('0x28');break;case _0x37f6('0x29'):_0x34dcb6[_0x37f6('0x10')]=_0x37f6('0x2a');break;case _0x37f6('0x2b'):_0x34dcb6[_0x37f6('0x10')]=_0x37f6('0x2c');break;case _0x37f6('0x2d'):_0x34dcb6[_0x37f6('0x10')]=_0x37f6('0x2e');_0x34dcb6[_0x37f6('0x14')]=[{'name':_0x37f6('0x2f'),'field':'name','foreignKey':'membername','model':_0x37f6('0x30'),'filter':{'field':'role','value':[_0x37f6('0x31')]}},{'name':'Telephones','field':_0x37f6('0xc'),'foreignKey':_0x37f6('0x32'),'model':_0x37f6('0x30'),'filter':{'field':'role','value':[_0x37f6('0x33')]}},{'name':_0x37f6('0x34'),'field':_0x37f6('0xc'),'foreignKey':_0x37f6('0x35'),'model':'VoiceQueue','filter':{'field':_0x37f6('0x36'),'value':[_0x37f6('0x37')]}},{'name':'QueueCampaigns','field':_0x37f6('0xc'),'foreignKey':'queue','model':'VoiceQueue','filter':{'field':_0x37f6('0x36'),'value':[_0x37f6('0x38')]}}];break;case _0x37f6('0x39'):_0x34dcb6[_0x37f6('0x10')]=_0x37f6('0x3a');break;case'chanspies':_0x34dcb6[_0x37f6('0x10')]=_0x37f6('0x3b');break;case _0x37f6('0x3c'):_0x34dcb6[_0x37f6('0x10')]=_0x37f6('0x3d');break;case _0x37f6('0x3e'):_0x34dcb6[_0x37f6('0x10')]=_0x37f6('0x3f');break;case'mailqueues':_0x34dcb6[_0x37f6('0x10')]='MailQueue';break;case _0x37f6('0x40'):_0x34dcb6[_0x37f6('0x10')]='MailAccount';break;case _0x37f6('0x41'):_0x34dcb6[_0x37f6('0x10')]=_0x37f6('0x42');break;case _0x37f6('0x43'):_0x34dcb6[_0x37f6('0x10')]=_0x37f6('0x44');break;case _0x37f6('0x45'):_0x34dcb6[_0x37f6('0x10')]=_0x37f6('0x46');break;case _0x37f6('0x47'):_0x34dcb6[_0x37f6('0x10')]='SmsQueue';break;case _0x37f6('0x48'):_0x34dcb6[_0x37f6('0x10')]='SmsAccount';break;case _0x37f6('0x49'):_0x34dcb6[_0x37f6('0x10')]=_0x37f6('0x4a');break;case _0x37f6('0x4b'):_0x34dcb6[_0x37f6('0x10')]=_0x37f6('0x4c');break;case'teams':_0x34dcb6[_0x37f6('0x10')]='Team';break;case _0x37f6('0x4d'):case _0x37f6('0x4e'):_0x34dcb6[_0x37f6('0x10')]=_0x37f6('0x4f');if(_0x1e87a5){_0x34dcb6['parentSections']=[{'name':_0x37f6('0x34')},{'name':_0x37f6('0x50')}];}break;case'users':case _0x37f6('0x51'):case'telephones':_0x34dcb6[_0x37f6('0x10')]=_0x37f6('0x30');if(_0x1e87a5){_0x34dcb6[_0x37f6('0x14')]=[{'name':_0x37f6('0x52'),'filter':{'field':_0x37f6('0x53'),'value':[_0x37f6('0x54'),_0x37f6('0x55')]},'ignore':!![]},{'name':_0x37f6('0x2f')},{'name':_0x37f6('0x56')}];}break;case _0x37f6('0x57'):_0x34dcb6['childModel']=_0x37f6('0x58');break;case'salesforceaccounts':_0x34dcb6[_0x37f6('0x10')]=_0x37f6('0x59');break;case _0x37f6('0x5a'):_0x34dcb6['childModel']=_0x37f6('0x5b');break;case _0x37f6('0x5c'):_0x34dcb6[_0x37f6('0x10')]=_0x37f6('0x5d');break;case _0x37f6('0x5e'):_0x34dcb6['childModel']=_0x37f6('0x5f');break;case _0x37f6('0x60'):_0x34dcb6[_0x37f6('0x10')]='ZohoAccount';break;case'vtigeraccounts':_0x34dcb6['childModel']='User';break;case'cannedanswers':_0x34dcb6[_0x37f6('0x10')]='CannedAnswer';break;case _0x37f6('0x61'):_0x34dcb6[_0x37f6('0x10')]=_0x37f6('0x62');break;case _0x37f6('0x63'):_0x34dcb6[_0x37f6('0x10')]=_0x37f6('0x64');break;case _0x37f6('0x65'):_0x34dcb6[_0x37f6('0x10')]=_0x37f6('0x66');break;case _0x37f6('0x67'):_0x34dcb6[_0x37f6('0x10')]=_0x37f6('0x68');break;case _0x37f6('0x69'):_0x34dcb6[_0x37f6('0x10')]=_0x37f6('0x6a');break;case _0x37f6('0x6b'):_0x34dcb6[_0x37f6('0x10')]='Sound';break;case _0x37f6('0x6c'):_0x34dcb6[_0x37f6('0x10')]=_0x37f6('0x6d');break;case'templates':_0x34dcb6[_0x37f6('0x10')]='Template';break;case _0x37f6('0x6e'):_0x34dcb6['childModel']='Trigger';break;case _0x37f6('0x6f'):_0x34dcb6[_0x37f6('0x10')]=_0x37f6('0x70');break;case _0x37f6('0x71'):_0x34dcb6[_0x37f6('0x10')]=_0x37f6('0x72');break;case _0x37f6('0x73'):_0x34dcb6['childModel']=_0x37f6('0x74');break;case _0x37f6('0x75'):_0x34dcb6[_0x37f6('0x10')]=_0x37f6('0x76');_0x34dcb6[_0x37f6('0x14')]=[{'name':_0x37f6('0x77'),'field':'id','foreignKey':_0x37f6('0x78')}];break;case _0x37f6('0x79'):_0x34dcb6[_0x37f6('0x10')]='AnalyticMetric';break;}return _0x34dcb6;}function _0x20be2e(_0x5a0b42,_0x4661a8){var _0x160243=_0x5a0b42[_0x37f6('0x7a')](0x0)[_0x37f6('0x7b')]()+_0x5a0b42[_0x37f6('0x7c')](0x1);var _0x1f5d29={'type':_0x37c05c[_0x37f6('0x7d')][_0x37f6('0x7e')][_0x37f6('0x7f')],'raw':!![]};return new Promise(function(_0x30105d,_0x4215ed){var _0x3067de=squel[_0x37f6('0x80')]()[_0x37f6('0x5')]('ui.'+_0x160243+_0x37f6('0x81'),'id')[_0x37f6('0x5')](_0x37f6('0x82'))[_0x37f6('0x83')](_0x37f6('0x84')+_0x5a0b42+_0x37f6('0x85'),'ui')[_0x37f6('0x86')](_0x37f6('0x87'),_0x4661a8['id']);return _0x37c05c['sequelize']['query'](_0x3067de[_0x37f6('0x88')](),_0x1f5d29)[_0x37f6('0x7')](function(_0x544c6a){_0x4661a8[_0x160243+_0x37f6('0x89')]=_0x544c6a;_0x30105d(_0x544c6a);})[_0x37f6('0x8')](function(_0x4806fe){_0x4215ed(_0x4806fe);});});}return _0x1114c6[_0x37f6('0x8a')]('UserProfile',attributes,{'tableName':_0x37f6('0x8b'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x3f2e45){var _0x18089d={'raw':_0x3f2e45[_0x37f6('0x8c')]['raw'],'where':{}};var _0x286f00={};var _0x3647ca={'count':0x0,'rows':[]};var _0xd56f6=_0x3f2e45[_0x37f6('0x8c')]['section'];var _0x211b25=_0x3f2e45[_0x37f6('0x8c')][_0x37f6('0x8d')]||![];var _0x145271=_0x5e06ed(_0xd56f6,_0x211b25);if(!_0x145271[_0x37f6('0x10')])throw new Error(_0x37f6('0x8e')+_0xd56f6+'\x27');var _0x4f8d02=[{'name':_0xd56f6}];if(!_[_0x37f6('0x8f')](_0x145271[_0x37f6('0x14')]))_0x4f8d02=_0x145271[_0x37f6('0x14')];var _0x46cd83=[];for(var _0x2feb6f=0x0;_0x2feb6f<_0x4f8d02[_0x37f6('0x90')];_0x2feb6f++){_0x46cd83[_0x37f6('0x91')](_0x37c05c['UserProfileSection']['find']({'where':{'userProfileId':_0x3f2e45[_0x37f6('0x92')]['id'],'name':_0x4f8d02[_0x2feb6f][_0x37f6('0xc')]},'raw':!![]}));}return Promise[_0x37f6('0x93')](_0x46cd83)[_0x37f6('0x7')](function(_0x140240){var _0x2f26a2=_[_0x37f6('0x4')](_0x140240,function(_0x3e9e7c){return _0x3e9e7c?_0x3e9e7c:undefined;});var _0x247c75=_[_0x37f6('0x4')](_0x4f8d02,[_0x37f6('0x94'),!![]]);var _0x1fc80e=_[_0x37f6('0x8f')](_0x2f26a2)&&_[_0x37f6('0x8f')](_0x247c75)?null:_[_0x37f6('0x95')](_0x247c75,_0x2f26a2);if(!_0x1fc80e)return null;var _0x2d6a34=[];for(var _0x33538a=0x0;_0x33538a<_0x1fc80e[_0x37f6('0x90')];_0x33538a++){var _0x1c5f3c=_[_0x37f6('0x96')](_0x4f8d02,function(_0x48adfc){return _0x1fc80e[_0x33538a]?_0x48adfc[_0x37f6('0xc')]===_0x1fc80e[_0x33538a][_0x37f6('0xc')]:null;});if(_0x1c5f3c){if(_0x1fc80e[_0x33538a][_0x37f6('0x94')]){_0x2d6a34[_0x37f6('0x91')](_0x10066c(_0x145271[_0x37f6('0x10')],_0x1fc80e[_0x33538a]));}else{if(!_0x1fc80e[_0x33538a]['autoAssociation']){_0x2d6a34[_0x37f6('0x91')](_0x22e4df(_0x1c5f3c,_0x1fc80e[_0x33538a],_0x145271[_0x37f6('0x10')]));}else{if(_0x1c5f3c['model']){_0x2d6a34[_0x37f6('0x91')](_0x22d200(_0x1c5f3c,_0x1fc80e[_0x33538a]));}}}}}return Promise[_0x37f6('0x93')](_0x2d6a34);})['then'](function(_0x11c16b){var _0x1d8a3a=_0x11c16b;var _0x527e4e=null;if(_0x1d8a3a){_0x527e4e=_0x1d8a3a[_0x37f6('0x90')]===0x1?_0x1d8a3a[0x0]:null;}if(!_0x527e4e&&!_0x1d8a3a)return _0x3647ca;var _0x46b475=_0x37c05c[_0x145271[_0x37f6('0x10')]][_0x37f6('0x97')];_0x286f00['model']=_['keys'](_0x46b475);_0x286f00[_0x37f6('0x8c')]=_[_0x37f6('0x98')](_0x3f2e45[_0x37f6('0x8c')]);_0x286f00[_0x37f6('0x99')]=_[_0x37f6('0x9a')](_0x286f00[_0x37f6('0x9')],_0x286f00[_0x37f6('0x8c')]);_0x18089d[_0x37f6('0x9b')]=_[_0x37f6('0x9a')](_0x286f00[_0x37f6('0x9')],qs[_0x37f6('0x9c')](_0x3f2e45[_0x37f6('0x8c')][_0x37f6('0x9c')]));_0x18089d[_0x37f6('0x9b')]=_0x18089d[_0x37f6('0x9b')]['length']?_0x18089d['attributes']:_0x286f00[_0x37f6('0x9')];if(!_0x3f2e45[_0x37f6('0x8c')]['hasOwnProperty'](_0x37f6('0x9d'))){_0x18089d[_0x37f6('0x9e')]=qs[_0x37f6('0x9e')](_0x3f2e45['query'][_0x37f6('0x9e')]);_0x18089d[_0x37f6('0x9f')]=qs[_0x37f6('0x9f')](_0x3f2e45[_0x37f6('0x8c')][_0x37f6('0x9f')]);}_0x18089d[_0x37f6('0xa0')]=qs['sort'](_0x3f2e45['query'][_0x37f6('0xa1')]);_0x18089d[_0x37f6('0x86')]=qs[_0x37f6('0x99')](_['pick'](_0x3f2e45[_0x37f6('0x8c')],_0x286f00[_0x37f6('0x99')]));if(_0x3f2e45[_0x37f6('0x8c')][_0x37f6('0x4')]){_0x18089d['where']=_[_0x37f6('0xa2')](_0x18089d['where'],{'$or':_['map'](_0x46b475,function(_0x44792e){if(_0x44792e['type']['key']!=='VIRTUAL'){var _0x575982={};_0x575982[_0x44792e['field']]={'$like':'%'+_0x3f2e45[_0x37f6('0x8c')]['filter']+'%'};return _0x575982;}})});}var _0x420cf2=[];var _0x45bc74=null;var _0x473fd1={};if(_0x527e4e){_0x45bc74=_[_0x37f6('0x96')](_0x4f8d02,['name',_0x527e4e[_0x37f6('0xc')]]);if(_0x45bc74[_0x37f6('0x5')]){_0x473fd1={};if(_0x145271[_0x37f6('0x10')]===_0x37f6('0x76')){_0x473fd1[_0x45bc74['foreignKey']]=_[_0x37f6('0xb')](_0x527e4e[_0x37f6('0xe')],'id');}else{_0x473fd1[_0x45bc74[_0x37f6('0xa3')]]=_0x527e4e['associatedResources'];}_0x420cf2['push'](_0x473fd1);}else{_0x18089d['where']['id']=_0x527e4e[_0x37f6('0xe')];}}else{for(var _0x4d3372=0x0;_0x4d3372<_0x1d8a3a[_0x37f6('0x90')];_0x4d3372++){_0x45bc74=_[_0x37f6('0x96')](_0x4f8d02,['name',_0x1d8a3a[_0x4d3372][_0x37f6('0xc')]]);if(_0x45bc74[_0x37f6('0x5')]){_0x473fd1={};_0x473fd1[_0x45bc74[_0x37f6('0xa3')]]=_0x1d8a3a[_0x4d3372][_0x37f6('0xe')];_0x420cf2[_0x37f6('0x91')](_0x473fd1);}else{if(!_0x18089d[_0x37f6('0x86')]['id'])_0x18089d[_0x37f6('0x86')]['id']=[];_0x1d8a3a[_0x4d3372][_0x37f6('0xe')][_0x37f6('0xa4')](function(_0x3ff919){_0x18089d[_0x37f6('0x86')]['id'][_0x37f6('0x91')](_0x3ff919);});}}}if(!_['isEmpty'](_0x420cf2)){_0x18089d[_0x37f6('0x86')]=_['merge'](_0x18089d[_0x37f6('0x86')],{'$and':{'$or':_0x420cf2}});}_0x18089d=_['merge']({},_0x18089d,_0x3f2e45[_0x37f6('0xa5')]);if(_0x527e4e&&!_0x527e4e[_0x37f6('0xa6')]&&_0x145271[_0x37f6('0x10')]===_0x37f6('0x76')){if(_0x3f2e45['query'][_0x37f6('0xa7')]){_0x18089d['include']=[{'all':!![]}];}return _0x37c05c[_0x145271['childModel']][_0x37f6('0xa')](_0x18089d)['then'](function(_0x64b2ac){var _0x428b9a=[];_0x64b2ac[_0x37f6('0xa4')](function(_0x9cf630){var _0x18e124;switch(_0x9cf630[_0x37f6('0xa8')]){case _0x37f6('0xa9'):_0x18e124=_[_0x37f6('0x96')](_0x527e4e['associatedResources'],function(_0x467257){return _0x467257['id']===_0x9cf630['reportId']&&_0x467257['type']===_0x37f6('0xaa');});break;case _0x37f6('0xab'):_0x18e124=_[_0x37f6('0x96')](_0x527e4e[_0x37f6('0xe')],function(_0x773a2f){return _0x773a2f['id']===_0x9cf630['reportId']&&_0x773a2f[_0x37f6('0x36')]===_0x37f6('0xac');});break;}if(_0x18e124)_0x428b9a[_0x37f6('0x91')](_0x9cf630);});_0x3647ca[_0x37f6('0xad')]=_0x428b9a[_0x37f6('0x90')];_0x3647ca[_0x37f6('0xae')]=_0x428b9a;return _0x3647ca;});}else{if(!_[_0x37f6('0x8f')](_0x3f2e45['query']['ids'])){_0x18089d[_0x37f6('0x86')]['id']=_0x18089d[_0x37f6('0x86')]['id']?_['intersection'](_0x18089d['where']['id'],_0x3f2e45[_0x37f6('0x8c')][_0x37f6('0xaf')]):_0x3f2e45[_0x37f6('0x8c')]['ids'];if(_0x3f2e45[_0x37f6('0x8c')][_0x37f6('0xb0')]){_0x18089d[_0x37f6('0xa0')]=_0x3f2e45['query'][_0x37f6('0xb0')];}}if(_0x3f2e45[_0x37f6('0x8c')][_0x37f6('0xb1')]){_0x18089d[_0x37f6('0x86')]=_['merge'](_0x18089d[_0x37f6('0x86')],{'$and':_0x3f2e45[_0x37f6('0x8c')][_0x37f6('0xb1')]});}return _0x37c05c[_0x145271[_0x37f6('0x10')]][_0x37f6('0xad')]({'where':_0x18089d[_0x37f6('0x86')]})[_0x37f6('0x7')](function(_0xddb115){_0x3647ca['count']=_0xddb115;if(_0x3f2e45['query'][_0x37f6('0xa7')]){if(_0x145271[_0x37f6('0x10')]===_0x37f6('0xb2')){_0x18089d[_0x37f6('0xb3')]=[{'model':_0x37c05c[_0x37f6('0x6d')],'as':_0x37f6('0xb4'),'attributes':['id',_0x37f6('0xc'),_0x37f6('0xb5')],'required':_0x3f2e45['query'][_0x37f6('0xb6')]?!![]:![]},{'model':_0x37c05c[_0x37f6('0x6d')],'as':_0x37f6('0xb7'),'attributes':['id',_0x37f6('0xc'),_0x37f6('0xb5')],'through':_0x3f2e45[_0x37f6('0x8c')][_0x37f6('0xb6')]?{'attributes':[],'where':{'TagId':_0x3f2e45[_0x37f6('0x8c')][_0x37f6('0xb6')]||undefined}}:{},'required':_0x3f2e45[_0x37f6('0x8c')][_0x37f6('0xb6')]?!![]:![]}];}else{_0x18089d[_0x37f6('0xb3')]=[{'all':!![]}];}}return _0x37c05c[_0x145271[_0x37f6('0x10')]][_0x37f6('0xa')](_0x18089d);})[_0x37f6('0x7')](function(_0x29fd43){_0x3647ca[_0x37f6('0xae')]=_0x29fd43;if(_0xd56f6===_0x37f6('0x2f')&&_0x3f2e45[_0x37f6('0x8c')]['openTabs']===_0x37f6('0xb8')){var _0x3e9cc5=[];for(var _0x502e11=0x0;_0x502e11<_0x3647ca[_0x37f6('0xae')][_0x37f6('0x90')];_0x502e11++){_0x3e9cc5[_0x37f6('0x91')](_0x20be2e(_0x37f6('0xb9'),_0x3647ca['rows'][_0x502e11][_0x37f6('0xba')]));_0x3e9cc5[_0x37f6('0x91')](_0x20be2e('sms',_0x3647ca[_0x37f6('0xae')][_0x502e11]['dataValues']));_0x3e9cc5[_0x37f6('0x91')](_0x20be2e(_0x37f6('0xbb'),_0x3647ca[_0x37f6('0xae')][_0x502e11][_0x37f6('0xba')]));_0x3e9cc5[_0x37f6('0x91')](_0x20be2e(_0x37f6('0xbc'),_0x3647ca[_0x37f6('0xae')][_0x502e11]['dataValues']));_0x3e9cc5['push'](_0x20be2e(_0x37f6('0xbd'),_0x3647ca['rows'][_0x502e11][_0x37f6('0xba')]));_0x3e9cc5[_0x37f6('0x91')](_0x20be2e(_0x37f6('0xbe'),_0x3647ca['rows'][_0x502e11][_0x37f6('0xba')]));}return Promise['all'](_0x3e9cc5)[_0x37f6('0x7')](function(){return _0x3647ca;});}return _0x3647ca;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 3931b39..2829efd 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 _0x806d=['client','http','redis','defaults','localhost','./userProfile.socket','register','request','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0x2dee29,_0x4014f4){var _0xe49090=function(_0x4f932c){while(--_0x4f932c){_0x2dee29['push'](_0x2dee29['shift']());}};_0xe49090(++_0x4014f4);}(_0x806d,0x131));var _0xd806=function(_0x38c494,_0x4cf0f5){_0x38c494=_0x38c494-0x0;var _0x1ab68f=_0x806d[_0x38c494];return _0x1ab68f;};'use strict';var _=require(_0xd806('0x0'));var util=require(_0xd806('0x1'));var moment=require(_0xd806('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd806('0x3'))['db'];var utils=require(_0xd806('0x4'));var logger=require('../../config/logger')(_0xd806('0x5'));var config=require('../../config/environment');var jayson=require(_0xd806('0x6'));var client=jayson[_0xd806('0x7')][_0xd806('0x8')]({'port':0x232a});config[_0xd806('0x9')]=_[_0xd806('0xa')](config[_0xd806('0x9')],{'host':_0xd806('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd806('0x9')]));require(_0xd806('0xc'))[_0xd806('0xd')](socket);function respondWithRpcPromise(_0xf68dd6,_0x55fb02,_0x1b15ca){return new BPromise(function(_0x58d59d,_0x25c6be){return client[_0xd806('0xe')](_0xf68dd6,_0x1b15ca)['then'](function(_0x992b73){logger[_0xd806('0xf')](_0xd806('0x10'),_0x55fb02,_0xd806('0x11'));logger[_0xd806('0x12')](_0xd806('0x13'),_0x55fb02,_0xd806('0x11'),JSON[_0xd806('0x14')](_0x992b73));if(_0x992b73[_0xd806('0x15')]){if(_0x992b73[_0xd806('0x15')][_0xd806('0x16')]===0x1f4){logger['error'](_0xd806('0x10'),_0x55fb02,_0x992b73[_0xd806('0x15')][_0xd806('0x17')]);return _0x25c6be(_0x992b73['error'][_0xd806('0x17')]);}logger['error'](_0xd806('0x10'),_0x55fb02,_0x992b73[_0xd806('0x15')][_0xd806('0x17')]);return _0x58d59d(_0x992b73[_0xd806('0x15')][_0xd806('0x17')]);}else{logger[_0xd806('0xf')](_0xd806('0x10'),_0x55fb02,_0xd806('0x11'));_0x58d59d(_0x992b73[_0xd806('0x18')]['message']);}})[_0xd806('0x19')](function(_0x4321f3){logger[_0xd806('0x15')]('UserProfile,\x20%s,\x20%s',_0x55fb02,_0x4321f3);_0x25c6be(_0x4321f3);});});} \ No newline at end of file +var _0xa3fe=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','moment','bluebird','ioredis'];(function(_0x212b5d,_0x318113){var _0xd29835=function(_0x39dc22){while(--_0x39dc22){_0x212b5d['push'](_0x212b5d['shift']());}};_0xd29835(++_0x318113);}(_0xa3fe,0xd8));var _0xea3f=function(_0x12f9a2,_0xded013){_0x12f9a2=_0x12f9a2-0x0;var _0x45e376=_0xa3fe[_0x12f9a2];return _0x45e376;};'use strict';var _=require(_0xea3f('0x0'));var util=require('util');var moment=require(_0xea3f('0x1'));var BPromise=require(_0xea3f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xea3f('0x3'));var db=require(_0xea3f('0x4'))['db'];var utils=require(_0xea3f('0x5'));var logger=require('../../config/logger')(_0xea3f('0x6'));var config=require('../../config/environment');var jayson=require(_0xea3f('0x7'));var client=jayson[_0xea3f('0x8')][_0xea3f('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xea3f('0xa')],{'host':_0xea3f('0xb'),'port':0x18eb});var socket=require(_0xea3f('0xc'))(new Redis(config['redis']));require('./userProfile.socket')[_0xea3f('0xd')](socket);function respondWithRpcPromise(_0x5d9b2c,_0x526024,_0x249e8e){return new BPromise(function(_0xa8b25b,_0x414ddb){return client['request'](_0x5d9b2c,_0x249e8e)['then'](function(_0x5c8cd3){logger[_0xea3f('0xe')](_0xea3f('0xf'),_0x526024,_0xea3f('0x10'));logger[_0xea3f('0x11')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x526024,'request\x20sent',JSON['stringify'](_0x5c8cd3));if(_0x5c8cd3[_0xea3f('0x12')]){if(_0x5c8cd3[_0xea3f('0x12')]['code']===0x1f4){logger[_0xea3f('0x12')](_0xea3f('0xf'),_0x526024,_0x5c8cd3['error'][_0xea3f('0x13')]);return _0x414ddb(_0x5c8cd3[_0xea3f('0x12')][_0xea3f('0x13')]);}logger[_0xea3f('0x12')](_0xea3f('0xf'),_0x526024,_0x5c8cd3[_0xea3f('0x12')][_0xea3f('0x13')]);return _0xa8b25b(_0x5c8cd3[_0xea3f('0x12')][_0xea3f('0x13')]);}else{logger[_0xea3f('0xe')](_0xea3f('0xf'),_0x526024,_0xea3f('0x10'));_0xa8b25b(_0x5c8cd3[_0xea3f('0x14')][_0xea3f('0x13')]);}})[_0xea3f('0x15')](function(_0xc199e4){logger[_0xea3f('0x12')](_0xea3f('0xf'),_0x526024,_0xc199e4);_0x414ddb(_0xc199e4);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index f38ce58..dba335e 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 _0x265b=['save','remove','emit','removeListener','register','userProfile:','./userProfile.events'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x265b,0xb5));var _0xb265=function(_0x228700,_0x1b536f){_0x228700=_0x228700-0x0;var _0xcc59ad=_0x265b[_0x228700];return _0xcc59ad;};'use strict';var UserProfileEvents=require(_0xb265('0x0'));var events=[_0xb265('0x1'),_0xb265('0x2'),'update'];function createListener(_0x3e4101,_0x29a250){return function(_0x10b2fd){_0x29a250[_0xb265('0x3')](_0x3e4101,_0x10b2fd);};}function removeListener(_0x470d2a,_0x48e489){return function(){UserProfileEvents[_0xb265('0x4')](_0x470d2a,_0x48e489);};}exports[_0xb265('0x5')]=function(_0x3d350e){for(var _0x59354c=0x0,_0x4d91fc=events['length'];_0x59354c<_0x4d91fc;_0x59354c++){var _0x28fed5=events[_0x59354c];var _0x182e9c=createListener(_0xb265('0x6')+_0x28fed5,_0x3d350e);UserProfileEvents['on'](_0x28fed5,_0x182e9c);}}; \ No newline at end of file +var _0xcf6a=['register','save','remove','removeListener'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xcf6a,0x139));var _0xacf6=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0xcf6a[_0x5d80de];return _0x1c7556;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0xacf6('0x0'),_0xacf6('0x1'),'update'];function createListener(_0x5d4459,_0x471b86){return function(_0x5167d3){_0x471b86['emit'](_0x5d4459,_0x5167d3);};}function removeListener(_0x3219ff,_0x2c78e4){return function(){UserProfileEvents[_0xacf6('0x2')](_0x3219ff,_0x2c78e4);};}exports[_0xacf6('0x3')]=function(_0xb922fa){for(var _0x55326c=0x0,_0x3c84de=events['length'];_0x55326c<_0x3c84de;_0x55326c++){var _0x2a520c=events[_0x55326c];var _0x2d0f63=createListener('userProfile:'+_0x2a520c,_0xb922fa);UserProfileEvents['on'](_0x2a520c,_0x2d0f63);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 9a841f5..77d9b94 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 _0x6f75=['put','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','./userProfileResource.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post'];(function(_0x4c6c9d,_0x574fe1){var _0x1eeb1a=function(_0x113cc5){while(--_0x113cc5){_0x4c6c9d['push'](_0x4c6c9d['shift']());}};_0x1eeb1a(++_0x574fe1);}(_0x6f75,0x15a));var _0x56f7=function(_0x330f07,_0x2fb85c){_0x330f07=_0x330f07-0x0;var _0x150d9a=_0x6f75[_0x330f07];return _0x150d9a;};'use strict';var multer=require(_0x56f7('0x0'));var util=require('util');var path=require(_0x56f7('0x1'));var timeout=require('connect-timeout');var express=require(_0x56f7('0x2'));var router=express[_0x56f7('0x3')]();var fs_extra=require(_0x56f7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x56f7('0x5'));var config=require('../../config/environment');var controller=require(_0x56f7('0x6'));router[_0x56f7('0x7')]('/',auth['isAuthenticated'](),controller[_0x56f7('0x8')]);router['get'](_0x56f7('0x9'),auth[_0x56f7('0xa')](),controller[_0x56f7('0xb')]);router[_0x56f7('0x7')](_0x56f7('0xc'),auth[_0x56f7('0xa')](),controller[_0x56f7('0xd')]);router[_0x56f7('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x56f7('0xf')](_0x56f7('0xc'),auth[_0x56f7('0xa')](),controller[_0x56f7('0x10')]);router['delete'](_0x56f7('0xc'),auth[_0x56f7('0xa')](),controller[_0x56f7('0x11')]);module[_0x56f7('0x12')]=router; \ No newline at end of file +var _0x6f09=['../../components/interaction/service','../../config/environment','./userProfileResource.controller','index','get','isAuthenticated','/:id','show','post','create','put','update','destroy','exports','multer','path','connect-timeout','Router'];(function(_0x365ac6,_0x1677e7){var _0x5f652f=function(_0x431758){while(--_0x431758){_0x365ac6['push'](_0x365ac6['shift']());}};_0x5f652f(++_0x1677e7);}(_0x6f09,0x1ac));var _0x96f0=function(_0x6ab7a3,_0x5121bd){_0x6ab7a3=_0x6ab7a3-0x0;var _0x46529c=_0x6f09[_0x6ab7a3];return _0x46529c;};'use strict';var multer=require(_0x96f0('0x0'));var util=require('util');var path=require(_0x96f0('0x1'));var timeout=require(_0x96f0('0x2'));var express=require('express');var router=express[_0x96f0('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x96f0('0x4'));var config=require(_0x96f0('0x5'));var controller=require(_0x96f0('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x96f0('0x7')]);router[_0x96f0('0x8')]('/describe',auth[_0x96f0('0x9')](),controller['describe']);router['get'](_0x96f0('0xa'),auth[_0x96f0('0x9')](),controller[_0x96f0('0xb')]);router[_0x96f0('0xc')]('/',auth[_0x96f0('0x9')](),controller[_0x96f0('0xd')]);router[_0x96f0('0xe')](_0x96f0('0xa'),auth[_0x96f0('0x9')](),controller[_0x96f0('0xf')]);router['delete'](_0x96f0('0xa'),auth['isAuthenticated'](),controller[_0x96f0('0x10')]);module[_0x96f0('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index a3daf29..276f869 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 _0xb678=['exports','STRING','INTEGER','sequelize'];(function(_0x41891a,_0x17fafa){var _0x1029b8=function(_0x3f78f9){while(--_0x3f78f9){_0x41891a['push'](_0x41891a['shift']());}};_0x1029b8(++_0x17fafa);}(_0xb678,0x15b));var _0x8b67=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0xb678[_0x231e16];return _0x570a7c;};'use strict';var Sequelize=require(_0x8b67('0x0'));module[_0x8b67('0x1')]={'name':{'type':Sequelize[_0x8b67('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x8b67('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x8b67('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x1a4f=['STRING','INTEGER','sequelize','exports'];(function(_0x3ecf65,_0x3bac13){var _0x1907df=function(_0x247dd9){while(--_0x247dd9){_0x3ecf65['push'](_0x3ecf65['shift']());}};_0x1907df(++_0x3bac13);}(_0x1a4f,0x86));var _0xf1a4=function(_0x141f1a,_0x1a5386){_0x141f1a=_0x141f1a-0x0;var _0x3e5e65=_0x1a4f[_0x141f1a];return _0x3e5e65;};'use strict';var Sequelize=require(_0xf1a4('0x0'));module[_0xf1a4('0x1')]={'name':{'type':Sequelize[_0xf1a4('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xf1a4('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 340d8a3..fdf680a 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 _0x47c5=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','map','VIRTUAL','filter','merge','count','includeAll','include','findAll','show','params','options','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','UserProfileResource','rawAttributes','fieldName','type','key','model'];(function(_0x368a53,_0x6db452){var _0x5c1f8d=function(_0x8ac720){while(--_0x8ac720){_0x368a53['push'](_0x368a53['shift']());}};_0x5c1f8d(++_0x6db452);}(_0x47c5,0x165));var _0x547c=function(_0x297acf,_0x530d6c){_0x297acf=_0x297acf-0x0;var _0x2dd757=_0x47c5[_0x297acf];return _0x2dd757;};'use strict';var emlformat=require(_0x547c('0x0'));var rimraf=require(_0x547c('0x1'));var zipdir=require(_0x547c('0x2'));var jsonpatch=require(_0x547c('0x3'));var rp=require(_0x547c('0x4'));var moment=require(_0x547c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x547c('0x6'));var util=require(_0x547c('0x7'));var path=require('path');var sox=require(_0x547c('0x8'));var csv=require(_0x547c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x547c('0xa'));var _=require(_0x547c('0xb'));var squel=require(_0x547c('0xc'));var crypto=require(_0x547c('0xd'));var jsforce=require(_0x547c('0xe'));var deskjs=require(_0x547c('0xf'));var toCsv=require(_0x547c('0x9'));var querystring=require(_0x547c('0x10'));var Papa=require(_0x547c('0x11'));var Redis=require(_0x547c('0x12'));var authService=require(_0x547c('0x13'));var qs=require(_0x547c('0x14'));var as=require(_0x547c('0x15'));var hardwareService=require(_0x547c('0x16'));var logger=require(_0x547c('0x17'))(_0x547c('0x18'));var utils=require(_0x547c('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x547c('0x1a'));var db=require(_0x547c('0x1b'))['db'];function respondWithStatusCode(_0x5eea67,_0x436c19){_0x436c19=_0x436c19||0xcc;return function(_0x201d95){if(_0x201d95){return _0x5eea67[_0x547c('0x1c')](_0x436c19);}return _0x5eea67[_0x547c('0x1d')](_0x436c19)[_0x547c('0x1e')]();};}function respondWithResult(_0x150317,_0x2bc289){_0x2bc289=_0x2bc289||0xc8;return function(_0xa3c7b0){if(_0xa3c7b0){return _0x150317[_0x547c('0x1d')](_0x2bc289)[_0x547c('0x1f')](_0xa3c7b0);}};}function respondWithFilteredResult(_0x240243,_0x103455){return function(_0x39f316){if(_0x39f316){var _0x23644b=typeof _0x103455[_0x547c('0x20')]===_0x547c('0x21')&&typeof _0x103455[_0x547c('0x22')]===_0x547c('0x21');var _0x49acca=_0x39f316['count'];var _0x23fa9e=_0x23644b?0x0:_0x103455[_0x547c('0x20')];var _0xeb059e=_0x23644b?_0x39f316['count']:_0x103455[_0x547c('0x20')]+_0x103455[_0x547c('0x22')];var _0x1ddbd3;if(_0xeb059e>=_0x49acca){_0xeb059e=_0x49acca;_0x1ddbd3=0xc8;}else{_0x1ddbd3=0xce;}_0x240243['status'](_0x1ddbd3);return _0x240243[_0x547c('0x23')](_0x547c('0x24'),_0x23fa9e+'-'+_0xeb059e+'/'+_0x49acca)['json'](_0x39f316);}return null;};}function patchUpdates(_0x5453f9){return function(_0x35040a){try{jsonpatch[_0x547c('0x25')](_0x35040a,_0x5453f9,!![]);}catch(_0x4f20c1){return BPromise[_0x547c('0x26')](_0x4f20c1);}return _0x35040a[_0x547c('0x27')]();};}function saveUpdates(_0x592e46,_0x2e317a){return function(_0x17fd97){if(_0x17fd97){return _0x17fd97[_0x547c('0x28')](_0x592e46)['then'](function(_0x3a55a0){return _0x3a55a0;});}return null;};}function removeEntity(_0x361c5c,_0x470694){return function(_0x26823c){if(_0x26823c){return _0x26823c[_0x547c('0x29')]()[_0x547c('0x2a')](function(){_0x361c5c[_0x547c('0x1d')](0xcc)[_0x547c('0x1e')]();});}};}function handleEntityNotFound(_0x507895,_0x39c5f9){return function(_0x4c66b9){if(!_0x4c66b9){_0x507895['sendStatus'](0x194);}return _0x4c66b9;};}function handleError(_0x4855fd,_0x478f04){_0x478f04=_0x478f04||0x1f4;return function(_0x2c725d){logger['error'](_0x2c725d[_0x547c('0x2b')]);if(_0x2c725d['name']){delete _0x2c725d[_0x547c('0x2c')];}_0x4855fd['status'](_0x478f04)[_0x547c('0x2d')](_0x2c725d);};}exports[_0x547c('0x2e')]=function(_0x2389de,_0x30a96c){var _0x198afb={},_0x569924={},_0x575c74={'count':0x0,'rows':[]};var _0x28c282=_['map'](db[_0x547c('0x2f')][_0x547c('0x30')],function(_0x3e7652){return{'name':_0x3e7652[_0x547c('0x31')],'type':_0x3e7652[_0x547c('0x32')][_0x547c('0x33')]};});_0x569924[_0x547c('0x34')]=_['map'](_0x28c282,'name');_0x569924[_0x547c('0x35')]=_[_0x547c('0x36')](_0x2389de[_0x547c('0x35')]);_0x569924[_0x547c('0x37')]=_[_0x547c('0x38')](_0x569924[_0x547c('0x34')],_0x569924[_0x547c('0x35')]);_0x198afb[_0x547c('0x39')]=_[_0x547c('0x38')](_0x569924[_0x547c('0x34')],qs[_0x547c('0x3a')](_0x2389de[_0x547c('0x35')][_0x547c('0x3a')]));_0x198afb[_0x547c('0x39')]=_0x198afb['attributes'][_0x547c('0x3b')]?_0x198afb['attributes']:_0x569924['model'];if(!_0x2389de['query'][_0x547c('0x3c')](_0x547c('0x3d'))){_0x198afb[_0x547c('0x22')]=qs[_0x547c('0x22')](_0x2389de[_0x547c('0x35')][_0x547c('0x22')]);_0x198afb['offset']=qs['offset'](_0x2389de['query'][_0x547c('0x20')]);}_0x198afb[_0x547c('0x3e')]=qs[_0x547c('0x3f')](_0x2389de[_0x547c('0x35')][_0x547c('0x3f')]);_0x198afb[_0x547c('0x40')]=qs['filters'](_[_0x547c('0x41')](_0x2389de['query'],_0x569924[_0x547c('0x37')]),_0x28c282);if(_0x2389de[_0x547c('0x35')]['filter']){_0x198afb[_0x547c('0x40')]=_['merge'](_0x198afb['where'],{'$or':_[_0x547c('0x42')](_0x28c282,function(_0x281d52){if(_0x281d52[_0x547c('0x32')]!==_0x547c('0x43')){var _0x4c36b9={};_0x4c36b9[_0x281d52['name']]={'$like':'%'+_0x2389de[_0x547c('0x35')][_0x547c('0x44')]+'%'};return _0x4c36b9;}})});}_0x198afb=_[_0x547c('0x45')]({},_0x198afb,_0x2389de['options']);var _0x3886ae={'where':_0x198afb[_0x547c('0x40')]};return db[_0x547c('0x2f')]['count'](_0x3886ae)[_0x547c('0x2a')](function(_0x3a6a0a){_0x575c74[_0x547c('0x46')]=_0x3a6a0a;if(_0x2389de['query'][_0x547c('0x47')]){_0x198afb[_0x547c('0x48')]=[{'all':!![]}];}return db['UserProfileResource'][_0x547c('0x49')](_0x198afb);})[_0x547c('0x2a')](function(_0x9c3cb2){_0x575c74['rows']=_0x9c3cb2;return _0x575c74;})[_0x547c('0x2a')](respondWithFilteredResult(_0x30a96c,_0x198afb))['catch'](handleError(_0x30a96c,null));};exports[_0x547c('0x4a')]=function(_0x5393a2,_0xb86f5f){var _0x414b9d={'raw':![],'where':{'id':_0x5393a2[_0x547c('0x4b')]['id']}},_0x3d37d7={};_0x3d37d7[_0x547c('0x34')]=_[_0x547c('0x36')](db['UserProfileResource']['rawAttributes']);_0x3d37d7[_0x547c('0x35')]=_[_0x547c('0x36')](_0x5393a2[_0x547c('0x35')]);_0x3d37d7['filters']=_[_0x547c('0x38')](_0x3d37d7[_0x547c('0x34')],_0x3d37d7[_0x547c('0x35')]);_0x414b9d[_0x547c('0x39')]=_[_0x547c('0x38')](_0x3d37d7[_0x547c('0x34')],qs['fields'](_0x5393a2[_0x547c('0x35')][_0x547c('0x3a')]));_0x414b9d[_0x547c('0x39')]=_0x414b9d['attributes'][_0x547c('0x3b')]?_0x414b9d[_0x547c('0x39')]:_0x3d37d7[_0x547c('0x34')];if(_0x5393a2[_0x547c('0x35')]['includeAll']){_0x414b9d[_0x547c('0x48')]=[{'all':!![]}];}_0x414b9d=_['merge']({},_0x414b9d,_0x5393a2[_0x547c('0x4c')]);return db['UserProfileResource'][_0x547c('0x4d')](_0x414b9d)[_0x547c('0x2a')](handleEntityNotFound(_0xb86f5f,null))['then'](respondWithResult(_0xb86f5f,null))[_0x547c('0x4e')](handleError(_0xb86f5f,null));};exports[_0x547c('0x4f')]=function(_0xa005cc,_0x1ddf30){return db['UserProfileResource'][_0x547c('0x4f')](_0xa005cc['body'],{})['then'](respondWithResult(_0x1ddf30,0xc9))[_0x547c('0x4e')](handleError(_0x1ddf30,null));};exports[_0x547c('0x28')]=function(_0x3e3f52,_0x11a878){if(_0x3e3f52[_0x547c('0x50')]['id']){delete _0x3e3f52[_0x547c('0x50')]['id'];}return db[_0x547c('0x2f')][_0x547c('0x4d')]({'where':{'id':_0x3e3f52[_0x547c('0x4b')]['id']}})[_0x547c('0x2a')](handleEntityNotFound(_0x11a878,null))[_0x547c('0x2a')](saveUpdates(_0x3e3f52[_0x547c('0x50')],null))['then'](respondWithResult(_0x11a878,null))['catch'](handleError(_0x11a878,null));};exports[_0x547c('0x29')]=function(_0x21ea26,_0x48de6e){return db[_0x547c('0x2f')][_0x547c('0x4d')]({'where':{'id':_0x21ea26[_0x547c('0x4b')]['id']}})[_0x547c('0x2a')](handleEntityNotFound(_0x48de6e,null))[_0x547c('0x2a')](removeEntity(_0x48de6e,null))[_0x547c('0x4e')](handleError(_0x48de6e,null));};exports['describe']=function(_0x152982,_0x5258cf){return db[_0x547c('0x2f')][_0x547c('0x51')]()[_0x547c('0x2a')](respondWithResult(_0x5258cf,null))['catch'](handleError(_0x5258cf,null));}; \ No newline at end of file +var _0x4975=['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','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','fieldName','type','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','map','VIRTUAL','options','UserProfileResource','count','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x5ba05f,_0x3ca624){var _0x22a9fe=function(_0x5cfc27){while(--_0x5cfc27){_0x5ba05f['push'](_0x5ba05f['shift']());}};_0x22a9fe(++_0x3ca624);}(_0x4975,0x86));var _0x5497=function(_0x682ee9,_0x8c16){_0x682ee9=_0x682ee9-0x0;var _0xb73b9d=_0x4975[_0x682ee9];return _0xb73b9d;};'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'];function respondWithStatusCode(_0x1b23df,_0x1bb794){_0x1bb794=_0x1bb794||0xcc;return function(_0x984990){if(_0x984990){return _0x1b23df[_0x5497('0x18')](_0x1bb794);}return _0x1b23df[_0x5497('0x19')](_0x1bb794)[_0x5497('0x1a')]();};}function respondWithResult(_0xaca97d,_0x363a5b){_0x363a5b=_0x363a5b||0xc8;return function(_0x1a4c74){if(_0x1a4c74){return _0xaca97d['status'](_0x363a5b)[_0x5497('0x1b')](_0x1a4c74);}};}function respondWithFilteredResult(_0x4fb8e9,_0x4237a9){return function(_0x2bfd8a){if(_0x2bfd8a){var _0x19e5f3=typeof _0x4237a9[_0x5497('0x1c')]===_0x5497('0x1d')&&typeof _0x4237a9[_0x5497('0x1e')]===_0x5497('0x1d');var _0x575f6b=_0x2bfd8a['count'];var _0x3f4d20=_0x19e5f3?0x0:_0x4237a9[_0x5497('0x1c')];var _0x3a47fd=_0x19e5f3?_0x2bfd8a['count']:_0x4237a9[_0x5497('0x1c')]+_0x4237a9[_0x5497('0x1e')];var _0x18e8a8;if(_0x3a47fd>=_0x575f6b){_0x3a47fd=_0x575f6b;_0x18e8a8=0xc8;}else{_0x18e8a8=0xce;}_0x4fb8e9[_0x5497('0x19')](_0x18e8a8);return _0x4fb8e9[_0x5497('0x1f')](_0x5497('0x20'),_0x3f4d20+'-'+_0x3a47fd+'/'+_0x575f6b)[_0x5497('0x1b')](_0x2bfd8a);}return null;};}function patchUpdates(_0x10226f){return function(_0x2e3960){try{jsonpatch[_0x5497('0x21')](_0x2e3960,_0x10226f,!![]);}catch(_0x186065){return BPromise['reject'](_0x186065);}return _0x2e3960[_0x5497('0x22')]();};}function saveUpdates(_0x4d1b27,_0x19200a){return function(_0xd0868d){if(_0xd0868d){return _0xd0868d[_0x5497('0x23')](_0x4d1b27)[_0x5497('0x24')](function(_0x35ecd9){return _0x35ecd9;});}return null;};}function removeEntity(_0x3b2fbc,_0x5018fa){return function(_0x54043a){if(_0x54043a){return _0x54043a[_0x5497('0x25')]()[_0x5497('0x24')](function(){_0x3b2fbc[_0x5497('0x19')](0xcc)[_0x5497('0x1a')]();});}};}function handleEntityNotFound(_0x5223b5,_0x13b7a4){return function(_0x57268c){if(!_0x57268c){_0x5223b5[_0x5497('0x18')](0x194);}return _0x57268c;};}function handleError(_0x16a2b4,_0x429d36){_0x429d36=_0x429d36||0x1f4;return function(_0x34a1a5){logger[_0x5497('0x26')](_0x34a1a5[_0x5497('0x27')]);if(_0x34a1a5['name']){delete _0x34a1a5[_0x5497('0x28')];}_0x16a2b4['status'](_0x429d36)['send'](_0x34a1a5);};}exports['index']=function(_0x39a2b7,_0x48d146){var _0x5e9356={},_0xc3465={},_0xb14593={'count':0x0,'rows':[]};var _0x1cf908=_['map'](db['UserProfileResource']['rawAttributes'],function(_0x371874){return{'name':_0x371874[_0x5497('0x29')],'type':_0x371874[_0x5497('0x2a')]['key']};});_0xc3465['model']=_['map'](_0x1cf908,_0x5497('0x28'));_0xc3465['query']=_[_0x5497('0x2b')](_0x39a2b7[_0x5497('0x2c')]);_0xc3465[_0x5497('0x2d')]=_['intersection'](_0xc3465[_0x5497('0x2e')],_0xc3465[_0x5497('0x2c')]);_0x5e9356['attributes']=_[_0x5497('0x2f')](_0xc3465[_0x5497('0x2e')],qs[_0x5497('0x30')](_0x39a2b7['query'][_0x5497('0x30')]));_0x5e9356[_0x5497('0x31')]=_0x5e9356[_0x5497('0x31')][_0x5497('0x32')]?_0x5e9356[_0x5497('0x31')]:_0xc3465['model'];if(!_0x39a2b7[_0x5497('0x2c')][_0x5497('0x33')]('nolimit')){_0x5e9356[_0x5497('0x1e')]=qs[_0x5497('0x1e')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x1e')]);_0x5e9356[_0x5497('0x1c')]=qs[_0x5497('0x1c')](_0x39a2b7['query'][_0x5497('0x1c')]);}_0x5e9356['order']=qs[_0x5497('0x34')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x34')]);_0x5e9356['where']=qs['filters'](_[_0x5497('0x35')](_0x39a2b7[_0x5497('0x2c')],_0xc3465[_0x5497('0x2d')]),_0x1cf908);if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]){_0x5e9356[_0x5497('0x37')]=_['merge'](_0x5e9356[_0x5497('0x37')],{'$or':_[_0x5497('0x38')](_0x1cf908,function(_0x3de8fe){if(_0x3de8fe[_0x5497('0x2a')]!==_0x5497('0x39')){var _0x468902={};_0x468902[_0x3de8fe[_0x5497('0x28')]]={'$like':'%'+_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]+'%'};return _0x468902;}})});}_0x5e9356=_['merge']({},_0x5e9356,_0x39a2b7[_0x5497('0x3a')]);var _0x32fa2b={'where':_0x5e9356[_0x5497('0x37')]};return db[_0x5497('0x3b')][_0x5497('0x3c')](_0x32fa2b)[_0x5497('0x24')](function(_0x4299be){_0xb14593['count']=_0x4299be;if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x3d')]){_0x5e9356[_0x5497('0x3e')]=[{'all':!![]}];}return db[_0x5497('0x3b')][_0x5497('0x3f')](_0x5e9356);})[_0x5497('0x24')](function(_0x114471){_0xb14593['rows']=_0x114471;return _0xb14593;})[_0x5497('0x24')](respondWithFilteredResult(_0x48d146,_0x5e9356))[_0x5497('0x40')](handleError(_0x48d146,null));};exports[_0x5497('0x41')]=function(_0x1e6389,_0x20e947){var _0xd90608={'raw':![],'where':{'id':_0x1e6389[_0x5497('0x42')]['id']}},_0xc1a999={};_0xc1a999[_0x5497('0x2e')]=_[_0x5497('0x2b')](db['UserProfileResource'][_0x5497('0x43')]);_0xc1a999['query']=_[_0x5497('0x2b')](_0x1e6389[_0x5497('0x2c')]);_0xc1a999[_0x5497('0x2d')]=_[_0x5497('0x2f')](_0xc1a999[_0x5497('0x2e')],_0xc1a999['query']);_0xd90608[_0x5497('0x31')]=_[_0x5497('0x2f')](_0xc1a999['model'],qs[_0x5497('0x30')](_0x1e6389['query'][_0x5497('0x30')]));_0xd90608['attributes']=_0xd90608[_0x5497('0x31')][_0x5497('0x32')]?_0xd90608[_0x5497('0x31')]:_0xc1a999[_0x5497('0x2e')];if(_0x1e6389[_0x5497('0x2c')]['includeAll']){_0xd90608['include']=[{'all':!![]}];}_0xd90608=_['merge']({},_0xd90608,_0x1e6389['options']);return db[_0x5497('0x3b')][_0x5497('0x44')](_0xd90608)[_0x5497('0x24')](handleEntityNotFound(_0x20e947,null))[_0x5497('0x24')](respondWithResult(_0x20e947,null))[_0x5497('0x40')](handleError(_0x20e947,null));};exports[_0x5497('0x45')]=function(_0xc78abe,_0x466287){return db[_0x5497('0x3b')]['create'](_0xc78abe[_0x5497('0x46')],{})[_0x5497('0x24')](respondWithResult(_0x466287,0xc9))[_0x5497('0x40')](handleError(_0x466287,null));};exports['update']=function(_0x3e4da2,_0x530475){if(_0x3e4da2[_0x5497('0x46')]['id']){delete _0x3e4da2[_0x5497('0x46')]['id'];}return db[_0x5497('0x3b')]['find']({'where':{'id':_0x3e4da2[_0x5497('0x42')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x530475,null))['then'](saveUpdates(_0x3e4da2[_0x5497('0x46')],null))['then'](respondWithResult(_0x530475,null))[_0x5497('0x40')](handleError(_0x530475,null));};exports['destroy']=function(_0x416f76,_0x400860){return db[_0x5497('0x3b')][_0x5497('0x44')]({'where':{'id':_0x416f76[_0x5497('0x42')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x400860,null))[_0x5497('0x24')](removeEntity(_0x400860,null))[_0x5497('0x40')](handleError(_0x400860,null));};exports['describe']=function(_0x1f73eb,_0x5b2c22){return db['UserProfileResource'][_0x5497('0x47')]()[_0x5497('0x24')](respondWithResult(_0x5b2c22,null))['catch'](handleError(_0x5b2c22,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 5e27668..dde1c08 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 _0xf1bd=['define','UserProfileResource','sectionId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x7a2d8b,_0x29c294){var _0x1a3c6c=function(_0x188f2b){while(--_0x188f2b){_0x7a2d8b['push'](_0x7a2d8b['shift']());}};_0x1a3c6c(++_0x29c294);}(_0xf1bd,0x1d7));var _0xdf1b=function(_0x2429b0,_0x240c1e){_0x2429b0=_0x2429b0-0x0;var _0x56e532=_0xf1bd[_0x2429b0];return _0x56e532;};'use strict';var _=require('lodash');var util=require(_0xdf1b('0x0'));var logger=require(_0xdf1b('0x1'))(_0xdf1b('0x2'));var moment=require(_0xdf1b('0x3'));var BPromise=require(_0xdf1b('0x4'));var rp=require(_0xdf1b('0x5'));var fs=require('fs');var path=require(_0xdf1b('0x6'));var rimraf=require(_0xdf1b('0x7'));var config=require(_0xdf1b('0x8'));var attributes=require('./userProfileResource.attributes');module['exports']=function(_0x5f34c0,_0x38968e){return _0x5f34c0[_0xdf1b('0x9')](_0xdf1b('0xa'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':'compositeIndex','fields':['resourceId',_0xdf1b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6d81=['bluebird','rimraf','../../config/environment','define','UserProfileResource','sectionId','lodash','util','../../config/logger','api'];(function(_0x308c00,_0x3cbd67){var _0x2b21b2=function(_0x4ce3fc){while(--_0x4ce3fc){_0x308c00['push'](_0x308c00['shift']());}};_0x2b21b2(++_0x3cbd67);}(_0x6d81,0xb0));var _0x16d8=function(_0x1d2cc5,_0x17819b){_0x1d2cc5=_0x1d2cc5-0x0;var _0x124aea=_0x6d81[_0x1d2cc5];return _0x124aea;};'use strict';var _=require(_0x16d8('0x0'));var util=require(_0x16d8('0x1'));var logger=require(_0x16d8('0x2'))(_0x16d8('0x3'));var moment=require('moment');var BPromise=require(_0x16d8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x16d8('0x5'));var config=require(_0x16d8('0x6'));var attributes=require('./userProfileResource.attributes');module['exports']=function(_0x5f1f69,_0x3ebc12){return _0x5f1f69[_0x16d8('0x7')](_0x16d8('0x8'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':'compositeIndex','fields':['resourceId',_0x16d8('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 7437035..b1f261e 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 _0xb3b1=['jayson/promise','client','http','request','then','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','UserProfileResource,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x4efdb8,_0x369b59){var _0x3ce171=function(_0x3d782a){while(--_0x3d782a){_0x4efdb8['push'](_0x4efdb8['shift']());}};_0x3ce171(++_0x369b59);}(_0xb3b1,0x160));var _0x1b3b=function(_0xec6cb4,_0x45e2b5){_0xec6cb4=_0xec6cb4-0x0;var _0x50b464=_0xb3b1[_0xec6cb4];return _0x50b464;};'use strict';var _=require(_0x1b3b('0x0'));var util=require('util');var moment=require(_0x1b3b('0x1'));var BPromise=require(_0x1b3b('0x2'));var rs=require(_0x1b3b('0x3'));var fs=require('fs');var Redis=require(_0x1b3b('0x4'));var db=require(_0x1b3b('0x5'))['db'];var utils=require(_0x1b3b('0x6'));var logger=require('../../config/logger')(_0x1b3b('0x7'));var config=require('../../config/environment');var jayson=require(_0x1b3b('0x8'));var client=jayson[_0x1b3b('0x9')][_0x1b3b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d752e,_0x1936f5,_0x475e52){return new BPromise(function(_0xa33ec5,_0x14a837){return client[_0x1b3b('0xb')](_0x5d752e,_0x475e52)[_0x1b3b('0xc')](function(_0x2bd953){logger['info']('UserProfileResource,\x20%s,\x20%s',_0x1936f5,'request\x20sent');logger[_0x1b3b('0xd')](_0x1b3b('0xe'),_0x1936f5,_0x1b3b('0xf'),JSON[_0x1b3b('0x10')](_0x2bd953));if(_0x2bd953['error']){if(_0x2bd953[_0x1b3b('0x11')][_0x1b3b('0x12')]===0x1f4){logger[_0x1b3b('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x1936f5,_0x2bd953[_0x1b3b('0x11')][_0x1b3b('0x13')]);return _0x14a837(_0x2bd953['error'][_0x1b3b('0x13')]);}logger[_0x1b3b('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x1936f5,_0x2bd953[_0x1b3b('0x11')][_0x1b3b('0x13')]);return _0xa33ec5(_0x2bd953[_0x1b3b('0x11')]['message']);}else{logger[_0x1b3b('0x14')](_0x1b3b('0x15'),_0x1936f5,_0x1b3b('0xf'));_0xa33ec5(_0x2bd953[_0x1b3b('0x16')][_0x1b3b('0x13')]);}})[_0x1b3b('0x17')](function(_0x47a34b){logger[_0x1b3b('0x11')](_0x1b3b('0x15'),_0x1936f5,_0x47a34b);_0x14a837(_0x47a34b);});});} \ No newline at end of file +var _0xa7b7=['error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','then','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa7b7,0x1a6));var _0x7a7b=function(_0x2eac47,_0x54fbc6){_0x2eac47=_0x2eac47-0x0;var _0x35fbe5=_0xa7b7[_0x2eac47];return _0x35fbe5;};'use strict';var _=require(_0x7a7b('0x0'));var util=require(_0x7a7b('0x1'));var moment=require('moment');var BPromise=require(_0x7a7b('0x2'));var rs=require(_0x7a7b('0x3'));var fs=require('fs');var Redis=require(_0x7a7b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7a7b('0x5'));var logger=require(_0x7a7b('0x6'))(_0x7a7b('0x7'));var config=require('../../config/environment');var jayson=require(_0x7a7b('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4c5b8b,_0x2772e2,_0x2c2753){return new BPromise(function(_0x9c8a02,_0x75a603){return client['request'](_0x4c5b8b,_0x2c2753)[_0x7a7b('0x9')](function(_0x48a0dc){logger['info'](_0x7a7b('0xa'),_0x2772e2,_0x7a7b('0xb'));logger[_0x7a7b('0xc')](_0x7a7b('0xd'),_0x2772e2,'request\x20sent',JSON[_0x7a7b('0xe')](_0x48a0dc));if(_0x48a0dc[_0x7a7b('0xf')]){if(_0x48a0dc[_0x7a7b('0xf')][_0x7a7b('0x10')]===0x1f4){logger[_0x7a7b('0xf')]('UserProfileResource,\x20%s,\x20%s',_0x2772e2,_0x48a0dc['error'][_0x7a7b('0x11')]);return _0x75a603(_0x48a0dc['error'][_0x7a7b('0x11')]);}logger['error'](_0x7a7b('0xa'),_0x2772e2,_0x48a0dc['error']['message']);return _0x9c8a02(_0x48a0dc[_0x7a7b('0xf')][_0x7a7b('0x11')]);}else{logger['info'](_0x7a7b('0xa'),_0x2772e2,_0x7a7b('0xb'));_0x9c8a02(_0x48a0dc['result'][_0x7a7b('0x11')]);}})[_0x7a7b('0x12')](function(_0x1e4feb){logger[_0x7a7b('0xf')](_0x7a7b('0xa'),_0x2772e2,_0x1e4feb);_0x75a603(_0x1e4feb);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 23428a0..0b2c593 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 _0x1e63=['exports','util','path','connect-timeout','fs-extra','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy'];(function(_0x3dbb2a,_0x54fab8){var _0x3511ce=function(_0x351332){while(--_0x351332){_0x3dbb2a['push'](_0x3dbb2a['shift']());}};_0x3511ce(++_0x54fab8);}(_0x1e63,0x73));var _0x31e6=function(_0x1a87c9,_0x37ed88){_0x1a87c9=_0x1a87c9-0x0;var _0x348509=_0x1e63[_0x1a87c9];return _0x348509;};'use strict';var multer=require('multer');var util=require(_0x31e6('0x0'));var path=require(_0x31e6('0x1'));var timeout=require(_0x31e6('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x31e6('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x31e6('0x4'));var controller=require(_0x31e6('0x5'));router[_0x31e6('0x6')]('/',auth[_0x31e6('0x7')](),controller[_0x31e6('0x8')]);router[_0x31e6('0x6')](_0x31e6('0x9'),auth[_0x31e6('0x7')](),controller[_0x31e6('0xa')]);router[_0x31e6('0x6')](_0x31e6('0xb'),auth[_0x31e6('0x7')](),controller[_0x31e6('0xc')]);router[_0x31e6('0xd')]('/',auth[_0x31e6('0x7')](),controller[_0x31e6('0xe')]);router[_0x31e6('0xf')](_0x31e6('0xb'),auth['isAuthenticated'](),controller[_0x31e6('0x10')]);router['delete'](_0x31e6('0xb'),auth[_0x31e6('0x7')](),controller[_0x31e6('0x11')]);module[_0x31e6('0x12')]=router; \ No newline at end of file +var _0xba7f=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','isAuthenticated','index','get','describe','/:id','show','post','create','put','update','delete','exports'];(function(_0x4367ea,_0x4aa912){var _0x551a2d=function(_0x59b7c4){while(--_0x59b7c4){_0x4367ea['push'](_0x4367ea['shift']());}};_0x551a2d(++_0x4aa912);}(_0xba7f,0x6e));var _0xfba7=function(_0x2bf6a1,_0x97be9a){_0x2bf6a1=_0x2bf6a1-0x0;var _0xe49e2e=_0xba7f[_0x2bf6a1];return _0xe49e2e;};'use strict';var multer=require(_0xfba7('0x0'));var util=require(_0xfba7('0x1'));var path=require(_0xfba7('0x2'));var timeout=require(_0xfba7('0x3'));var express=require(_0xfba7('0x4'));var router=express[_0xfba7('0x5')]();var fs_extra=require(_0xfba7('0x6'));var auth=require(_0xfba7('0x7'));var interaction=require(_0xfba7('0x8'));var config=require('../../config/environment');var controller=require(_0xfba7('0x9'));router['get']('/',auth[_0xfba7('0xa')](),controller[_0xfba7('0xb')]);router[_0xfba7('0xc')]('/describe',auth[_0xfba7('0xa')](),controller[_0xfba7('0xd')]);router['get'](_0xfba7('0xe'),auth[_0xfba7('0xa')](),controller[_0xfba7('0xf')]);router[_0xfba7('0x10')]('/',auth[_0xfba7('0xa')](),controller[_0xfba7('0x11')]);router[_0xfba7('0x12')](_0xfba7('0xe'),auth[_0xfba7('0xa')](),controller[_0xfba7('0x13')]);router[_0xfba7('0x14')]('/:id',auth[_0xfba7('0xa')](),controller['destroy']);module[_0xfba7('0x15')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index c19dd00..e453f37 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 _0xda3f=['join','getDataValue','crudPermissions','split','exports','STRING','BOOLEAN','setDataValue'];(function(_0x3b4802,_0x3f8265){var _0x35d6ad=function(_0x2f90a1){while(--_0x2f90a1){_0x3b4802['push'](_0x3b4802['shift']());}};_0x35d6ad(++_0x3f8265);}(_0xda3f,0xec));var _0xfda3=function(_0x4e4324,_0x2dfac1){_0x4e4324=_0x4e4324-0x0;var _0x4a1fa5=_0xda3f[_0x4e4324];return _0x4a1fa5;};'use strict';var Sequelize=require('sequelize');module[_0xfda3('0x0')]={'name':{'type':Sequelize[_0xfda3('0x1')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xfda3('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x36dc71){this[_0xfda3('0x3')]('crudPermissions',_0x36dc71?_0x36dc71[_0xfda3('0x4')](''):[]);},'get':function(){return this[_0xfda3('0x5')]('crudPermissions')?this['getDataValue'](_0xfda3('0x6'))[_0xfda3('0x7')](''):[];}}}; \ No newline at end of file +var _0x236c=['STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split','sequelize'];(function(_0x9d37d9,_0x4cdbf8){var _0x22db05=function(_0x5c1df7){while(--_0x5c1df7){_0x9d37d9['push'](_0x9d37d9['shift']());}};_0x22db05(++_0x4cdbf8);}(_0x236c,0x155));var _0xc236=function(_0x41cbab,_0x3a63e9){_0x41cbab=_0x41cbab-0x0;var _0x299523=_0x236c[_0x41cbab];return _0x299523;};'use strict';var Sequelize=require(_0xc236('0x0'));module['exports']={'name':{'type':Sequelize[_0xc236('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0xc236('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xc236('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0xc236('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xc236('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x3adce9){this[_0xc236('0x4')](_0xc236('0x5'),_0x3adce9?_0x3adce9[_0xc236('0x6')](''):[]);},'get':function(){return this[_0xc236('0x7')](_0xc236('0x5'))?this['getDataValue'](_0xc236('0x5'))[_0xc236('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 8f29168..83b74f6 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 _0xa23a=['squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','error','stack','name','send','map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','include','rows','catch','show','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash'];(function(_0x4a7790,_0x47dead){var _0x37104a=function(_0x14812a){while(--_0x14812a){_0x4a7790['push'](_0x4a7790['shift']());}};_0x37104a(++_0x47dead);}(_0xa23a,0x11f));var _0xaa23=function(_0x114321,_0x1ce445){_0x114321=_0x114321-0x0;var _0x3f070f=_0xa23a[_0x114321];return _0x3f070f;};'use strict';var emlformat=require(_0xaa23('0x0'));var rimraf=require(_0xaa23('0x1'));var zipdir=require(_0xaa23('0x2'));var jsonpatch=require(_0xaa23('0x3'));var rp=require(_0xaa23('0x4'));var moment=require(_0xaa23('0x5'));var BPromise=require(_0xaa23('0x6'));var Mustache=require(_0xaa23('0x7'));var util=require('util');var path=require(_0xaa23('0x8'));var sox=require(_0xaa23('0x9'));var csv=require('to-csv');var ejs=require(_0xaa23('0xa'));var fs=require('fs');var fs_extra=require(_0xaa23('0xb'));var _=require(_0xaa23('0xc'));var squel=require(_0xaa23('0xd'));var crypto=require(_0xaa23('0xe'));var jsforce=require(_0xaa23('0xf'));var deskjs=require(_0xaa23('0x10'));var toCsv=require(_0xaa23('0x11'));var querystring=require(_0xaa23('0x12'));var Papa=require(_0xaa23('0x13'));var Redis=require(_0xaa23('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaa23('0x15'));var hardwareService=require(_0xaa23('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xaa23('0x17'));var licenseUtil=require(_0xaa23('0x18'));var db=require(_0xaa23('0x19'))['db'];function respondWithStatusCode(_0x23de09,_0x79f1fb){_0x79f1fb=_0x79f1fb||0xcc;return function(_0x105a29){if(_0x105a29){return _0x23de09[_0xaa23('0x1a')](_0x79f1fb);}return _0x23de09[_0xaa23('0x1b')](_0x79f1fb)[_0xaa23('0x1c')]();};}function respondWithResult(_0x303b39,_0x4dcb5f){_0x4dcb5f=_0x4dcb5f||0xc8;return function(_0x17c4ba){if(_0x17c4ba){return _0x303b39[_0xaa23('0x1b')](_0x4dcb5f)[_0xaa23('0x1d')](_0x17c4ba);}};}function respondWithFilteredResult(_0x414626,_0x27c756){return function(_0x53459d){if(_0x53459d){var _0x466bae=typeof _0x27c756[_0xaa23('0x1e')]===_0xaa23('0x1f')&&typeof _0x27c756[_0xaa23('0x20')]==='undefined';var _0x5a490f=_0x53459d['count'];var _0x5b4cbb=_0x466bae?0x0:_0x27c756[_0xaa23('0x1e')];var _0x43b91c=_0x466bae?_0x53459d[_0xaa23('0x21')]:_0x27c756[_0xaa23('0x1e')]+_0x27c756[_0xaa23('0x20')];var _0xb0214f;if(_0x43b91c>=_0x5a490f){_0x43b91c=_0x5a490f;_0xb0214f=0xc8;}else{_0xb0214f=0xce;}_0x414626[_0xaa23('0x1b')](_0xb0214f);return _0x414626[_0xaa23('0x22')]('Content-Range',_0x5b4cbb+'-'+_0x43b91c+'/'+_0x5a490f)[_0xaa23('0x1d')](_0x53459d);}return null;};}function patchUpdates(_0x18ee34){return function(_0x456c8b){try{jsonpatch['apply'](_0x456c8b,_0x18ee34,!![]);}catch(_0x382aab){return BPromise[_0xaa23('0x23')](_0x382aab);}return _0x456c8b[_0xaa23('0x24')]();};}function saveUpdates(_0x3a9a29,_0xce5372){return function(_0x1e5f7a){if(_0x1e5f7a){return _0x1e5f7a[_0xaa23('0x25')](_0x3a9a29)[_0xaa23('0x26')](function(_0x4e9354){return _0x4e9354;});}return null;};}function removeEntity(_0x30af73,_0x1141b3){return function(_0x10f31f){if(_0x10f31f){return _0x10f31f[_0xaa23('0x27')]()[_0xaa23('0x26')](function(){_0x30af73[_0xaa23('0x1b')](0xcc)[_0xaa23('0x1c')]();});}};}function handleEntityNotFound(_0x225e7e,_0x39b00e){return function(_0x692e42){if(!_0x692e42){_0x225e7e[_0xaa23('0x1a')](0x194);}return _0x692e42;};}function handleError(_0x4b1f80,_0x307369){_0x307369=_0x307369||0x1f4;return function(_0x12397e){logger[_0xaa23('0x28')](_0x12397e[_0xaa23('0x29')]);if(_0x12397e[_0xaa23('0x2a')]){delete _0x12397e[_0xaa23('0x2a')];}_0x4b1f80['status'](_0x307369)[_0xaa23('0x2b')](_0x12397e);};}exports['index']=function(_0x94506d,_0x487c35){var _0x80f00={},_0x33fdaa={},_0x3f6742={'count':0x0,'rows':[]};var _0x996d9b=_[_0xaa23('0x2c')](db[_0xaa23('0x2d')][_0xaa23('0x2e')],function(_0x9a1259){return{'name':_0x9a1259[_0xaa23('0x2f')],'type':_0x9a1259[_0xaa23('0x30')][_0xaa23('0x31')]};});_0x33fdaa[_0xaa23('0x32')]=_[_0xaa23('0x2c')](_0x996d9b,'name');_0x33fdaa[_0xaa23('0x33')]=_[_0xaa23('0x34')](_0x94506d[_0xaa23('0x33')]);_0x33fdaa[_0xaa23('0x35')]=_['intersection'](_0x33fdaa[_0xaa23('0x32')],_0x33fdaa[_0xaa23('0x33')]);_0x80f00[_0xaa23('0x36')]=_[_0xaa23('0x37')](_0x33fdaa[_0xaa23('0x32')],qs[_0xaa23('0x38')](_0x94506d['query']['fields']));_0x80f00[_0xaa23('0x36')]=_0x80f00[_0xaa23('0x36')]['length']?_0x80f00['attributes']:_0x33fdaa[_0xaa23('0x32')];if(!_0x94506d[_0xaa23('0x33')][_0xaa23('0x39')](_0xaa23('0x3a'))){_0x80f00['limit']=qs[_0xaa23('0x20')](_0x94506d['query'][_0xaa23('0x20')]);_0x80f00[_0xaa23('0x1e')]=qs['offset'](_0x94506d['query'][_0xaa23('0x1e')]);}_0x80f00['order']=qs[_0xaa23('0x3b')](_0x94506d[_0xaa23('0x33')][_0xaa23('0x3b')]);_0x80f00[_0xaa23('0x3c')]=qs['filters'](_[_0xaa23('0x3d')](_0x94506d['query'],_0x33fdaa[_0xaa23('0x35')]),_0x996d9b);if(_0x94506d[_0xaa23('0x33')][_0xaa23('0x3e')]){_0x80f00['where']=_['merge'](_0x80f00[_0xaa23('0x3c')],{'$or':_[_0xaa23('0x2c')](_0x996d9b,function(_0x4aad6d){if(_0x4aad6d[_0xaa23('0x30')]!==_0xaa23('0x3f')){var _0x22a571={};_0x22a571[_0x4aad6d[_0xaa23('0x2a')]]={'$like':'%'+_0x94506d['query'][_0xaa23('0x3e')]+'%'};return _0x22a571;}})});}_0x80f00=_[_0xaa23('0x40')]({},_0x80f00,_0x94506d[_0xaa23('0x41')]);var _0x3b3d1b={'where':_0x80f00[_0xaa23('0x3c')]};return db[_0xaa23('0x2d')][_0xaa23('0x21')](_0x3b3d1b)['then'](function(_0x441d91){_0x3f6742[_0xaa23('0x21')]=_0x441d91;if(_0x94506d[_0xaa23('0x33')]['includeAll']){_0x80f00[_0xaa23('0x42')]=[{'all':!![]}];}return db['UserProfileSection']['findAll'](_0x80f00);})['then'](function(_0x2cb309){_0x3f6742[_0xaa23('0x43')]=_0x2cb309;return _0x3f6742;})[_0xaa23('0x26')](respondWithFilteredResult(_0x487c35,_0x80f00))[_0xaa23('0x44')](handleError(_0x487c35,null));};exports[_0xaa23('0x45')]=function(_0x41b452,_0x3cbe7c){var _0x26fca7={'raw':![],'where':{'id':_0x41b452['params']['id']}},_0x484802={};_0x484802[_0xaa23('0x32')]=_['keys'](db[_0xaa23('0x2d')][_0xaa23('0x2e')]);_0x484802[_0xaa23('0x33')]=_[_0xaa23('0x34')](_0x41b452[_0xaa23('0x33')]);_0x484802[_0xaa23('0x35')]=_[_0xaa23('0x37')](_0x484802[_0xaa23('0x32')],_0x484802[_0xaa23('0x33')]);_0x26fca7[_0xaa23('0x36')]=_[_0xaa23('0x37')](_0x484802['model'],qs[_0xaa23('0x38')](_0x41b452['query'][_0xaa23('0x38')]));_0x26fca7['attributes']=_0x26fca7['attributes']['length']?_0x26fca7['attributes']:_0x484802[_0xaa23('0x32')];if(_0x41b452[_0xaa23('0x33')]['includeAll']){_0x26fca7[_0xaa23('0x42')]=[{'all':!![]}];}_0x26fca7=_[_0xaa23('0x40')]({},_0x26fca7,_0x41b452[_0xaa23('0x41')]);return db[_0xaa23('0x2d')][_0xaa23('0x46')](_0x26fca7)['then'](handleEntityNotFound(_0x3cbe7c,null))[_0xaa23('0x26')](respondWithResult(_0x3cbe7c,null))['catch'](handleError(_0x3cbe7c,null));};exports[_0xaa23('0x47')]=function(_0x35cd67,_0x1312b4){return db[_0xaa23('0x2d')][_0xaa23('0x47')](_0x35cd67['body'],{})[_0xaa23('0x26')](respondWithResult(_0x1312b4,0xc9))['catch'](handleError(_0x1312b4,null));};exports['update']=function(_0x349078,_0x5f473f){if(_0x349078[_0xaa23('0x48')]['id']){delete _0x349078['body']['id'];}return db[_0xaa23('0x2d')]['find']({'where':{'id':_0x349078['params']['id']}})[_0xaa23('0x26')](handleEntityNotFound(_0x5f473f,null))[_0xaa23('0x26')](saveUpdates(_0x349078[_0xaa23('0x48')],null))[_0xaa23('0x26')](respondWithResult(_0x5f473f,null))[_0xaa23('0x44')](handleError(_0x5f473f,null));};exports[_0xaa23('0x27')]=function(_0x378ac8,_0x3340c2){return db[_0xaa23('0x2d')][_0xaa23('0x46')]({'where':{'id':_0x378ac8[_0xaa23('0x49')]['id']}})['then'](handleEntityNotFound(_0x3340c2,null))[_0xaa23('0x26')](removeEntity(_0x3340c2,null))[_0xaa23('0x44')](handleError(_0x3340c2,null));};exports[_0xaa23('0x4a')]=function(_0xe0af10,_0x47dd11){return db['UserProfileSection'][_0xaa23('0x4a')]()['then'](respondWithResult(_0x47dd11,null))[_0xaa23('0x44')](handleError(_0x47dd11,null));}; \ No newline at end of file +var _0x6f37=['sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','rawAttributes','include','catch','create','body','find','params','destroy','describe','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','apply','save','update','then','end','sendStatus','error','stack','name','send','index','map','UserProfileSection','fieldName','type','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty'];(function(_0x2d9931,_0x213ad8){var _0x4b8522=function(_0x39bfb2){while(--_0x39bfb2){_0x2d9931['push'](_0x2d9931['shift']());}};_0x4b8522(++_0x213ad8);}(_0x6f37,0xf1));var _0x76f3=function(_0x5c0979,_0x287854){_0x5c0979=_0x5c0979-0x0;var _0x309972=_0x6f37[_0x5c0979];return _0x309972;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x76f3('0x0'));var zipdir=require(_0x76f3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x76f3('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x76f3('0x3'));var util=require(_0x76f3('0x4'));var path=require(_0x76f3('0x5'));var sox=require(_0x76f3('0x6'));var csv=require(_0x76f3('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x76f3('0x8'));var _=require(_0x76f3('0x9'));var squel=require(_0x76f3('0xa'));var crypto=require(_0x76f3('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x76f3('0xc'));var toCsv=require(_0x76f3('0x7'));var querystring=require(_0x76f3('0xd'));var Papa=require(_0x76f3('0xe'));var Redis=require(_0x76f3('0xf'));var authService=require(_0x76f3('0x10'));var qs=require(_0x76f3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x76f3('0x12'));var logger=require(_0x76f3('0x13'))('api');var utils=require(_0x76f3('0x14'));var config=require(_0x76f3('0x15'));var licenseUtil=require(_0x76f3('0x16'));var db=require(_0x76f3('0x17'))['db'];function respondWithStatusCode(_0x5f0693,_0x14d9e8){_0x14d9e8=_0x14d9e8||0xcc;return function(_0x4be0b5){if(_0x4be0b5){return _0x5f0693['sendStatus'](_0x14d9e8);}return _0x5f0693['status'](_0x14d9e8)['end']();};}function respondWithResult(_0x228c36,_0x54d7c0){_0x54d7c0=_0x54d7c0||0xc8;return function(_0x29b12b){if(_0x29b12b){return _0x228c36[_0x76f3('0x18')](_0x54d7c0)[_0x76f3('0x19')](_0x29b12b);}};}function respondWithFilteredResult(_0x42afb4,_0x43eb40){return function(_0x277cfa){if(_0x277cfa){var _0x21fad=typeof _0x43eb40['offset']===_0x76f3('0x1a')&&typeof _0x43eb40[_0x76f3('0x1b')]==='undefined';var _0x11f8b7=_0x277cfa[_0x76f3('0x1c')];var _0x1c223e=_0x21fad?0x0:_0x43eb40[_0x76f3('0x1d')];var _0x5d21bb=_0x21fad?_0x277cfa[_0x76f3('0x1c')]:_0x43eb40['offset']+_0x43eb40[_0x76f3('0x1b')];var _0x21e1c9;if(_0x5d21bb>=_0x11f8b7){_0x5d21bb=_0x11f8b7;_0x21e1c9=0xc8;}else{_0x21e1c9=0xce;}_0x42afb4[_0x76f3('0x18')](_0x21e1c9);return _0x42afb4[_0x76f3('0x1e')]('Content-Range',_0x1c223e+'-'+_0x5d21bb+'/'+_0x11f8b7)[_0x76f3('0x19')](_0x277cfa);}return null;};}function patchUpdates(_0x3ee37f){return function(_0x3893db){try{jsonpatch[_0x76f3('0x1f')](_0x3893db,_0x3ee37f,!![]);}catch(_0x4085cf){return BPromise['reject'](_0x4085cf);}return _0x3893db[_0x76f3('0x20')]();};}function saveUpdates(_0xf76dfe,_0x1f6d27){return function(_0x555414){if(_0x555414){return _0x555414[_0x76f3('0x21')](_0xf76dfe)[_0x76f3('0x22')](function(_0x5c4251){return _0x5c4251;});}return null;};}function removeEntity(_0x130c74,_0x1f2771){return function(_0x42c42a){if(_0x42c42a){return _0x42c42a['destroy']()[_0x76f3('0x22')](function(){_0x130c74[_0x76f3('0x18')](0xcc)[_0x76f3('0x23')]();});}};}function handleEntityNotFound(_0x188a08,_0x5710ac){return function(_0x485303){if(!_0x485303){_0x188a08[_0x76f3('0x24')](0x194);}return _0x485303;};}function handleError(_0x4a8620,_0x2da026){_0x2da026=_0x2da026||0x1f4;return function(_0x6cc63e){logger[_0x76f3('0x25')](_0x6cc63e[_0x76f3('0x26')]);if(_0x6cc63e['name']){delete _0x6cc63e[_0x76f3('0x27')];}_0x4a8620[_0x76f3('0x18')](_0x2da026)[_0x76f3('0x28')](_0x6cc63e);};}exports[_0x76f3('0x29')]=function(_0x5168e9,_0x1f212f){var _0x516e45={},_0x47756e={},_0x3f5eb7={'count':0x0,'rows':[]};var _0x31c150=_[_0x76f3('0x2a')](db[_0x76f3('0x2b')]['rawAttributes'],function(_0x1f6506){return{'name':_0x1f6506[_0x76f3('0x2c')],'type':_0x1f6506[_0x76f3('0x2d')]['key']};});_0x47756e[_0x76f3('0x2e')]=_[_0x76f3('0x2a')](_0x31c150,_0x76f3('0x27'));_0x47756e[_0x76f3('0x2f')]=_[_0x76f3('0x30')](_0x5168e9['query']);_0x47756e[_0x76f3('0x31')]=_['intersection'](_0x47756e[_0x76f3('0x2e')],_0x47756e['query']);_0x516e45['attributes']=_[_0x76f3('0x32')](_0x47756e[_0x76f3('0x2e')],qs[_0x76f3('0x33')](_0x5168e9['query'][_0x76f3('0x33')]));_0x516e45['attributes']=_0x516e45['attributes'][_0x76f3('0x34')]?_0x516e45[_0x76f3('0x35')]:_0x47756e[_0x76f3('0x2e')];if(!_0x5168e9[_0x76f3('0x2f')][_0x76f3('0x36')]('nolimit')){_0x516e45[_0x76f3('0x1b')]=qs['limit'](_0x5168e9['query'][_0x76f3('0x1b')]);_0x516e45['offset']=qs[_0x76f3('0x1d')](_0x5168e9[_0x76f3('0x2f')][_0x76f3('0x1d')]);}_0x516e45['order']=qs[_0x76f3('0x37')](_0x5168e9[_0x76f3('0x2f')][_0x76f3('0x37')]);_0x516e45[_0x76f3('0x38')]=qs[_0x76f3('0x31')](_[_0x76f3('0x39')](_0x5168e9[_0x76f3('0x2f')],_0x47756e[_0x76f3('0x31')]),_0x31c150);if(_0x5168e9[_0x76f3('0x2f')][_0x76f3('0x3a')]){_0x516e45[_0x76f3('0x38')]=_[_0x76f3('0x3b')](_0x516e45[_0x76f3('0x38')],{'$or':_[_0x76f3('0x2a')](_0x31c150,function(_0x41e989){if(_0x41e989[_0x76f3('0x2d')]!=='VIRTUAL'){var _0x1a2b4e={};_0x1a2b4e[_0x41e989[_0x76f3('0x27')]]={'$like':'%'+_0x5168e9['query'][_0x76f3('0x3a')]+'%'};return _0x1a2b4e;}})});}_0x516e45=_[_0x76f3('0x3b')]({},_0x516e45,_0x5168e9[_0x76f3('0x3c')]);var _0x570a59={'where':_0x516e45['where']};return db[_0x76f3('0x2b')]['count'](_0x570a59)['then'](function(_0x28655d){_0x3f5eb7[_0x76f3('0x1c')]=_0x28655d;if(_0x5168e9[_0x76f3('0x2f')][_0x76f3('0x3d')]){_0x516e45['include']=[{'all':!![]}];}return db['UserProfileSection'][_0x76f3('0x3e')](_0x516e45);})['then'](function(_0x471d62){_0x3f5eb7[_0x76f3('0x3f')]=_0x471d62;return _0x3f5eb7;})[_0x76f3('0x22')](respondWithFilteredResult(_0x1f212f,_0x516e45))['catch'](handleError(_0x1f212f,null));};exports[_0x76f3('0x40')]=function(_0x43d8c9,_0x47446f){var _0x5bbf32={'raw':![],'where':{'id':_0x43d8c9['params']['id']}},_0x15bf64={};_0x15bf64['model']=_[_0x76f3('0x30')](db[_0x76f3('0x2b')][_0x76f3('0x41')]);_0x15bf64['query']=_[_0x76f3('0x30')](_0x43d8c9[_0x76f3('0x2f')]);_0x15bf64['filters']=_[_0x76f3('0x32')](_0x15bf64[_0x76f3('0x2e')],_0x15bf64['query']);_0x5bbf32[_0x76f3('0x35')]=_[_0x76f3('0x32')](_0x15bf64[_0x76f3('0x2e')],qs['fields'](_0x43d8c9[_0x76f3('0x2f')][_0x76f3('0x33')]));_0x5bbf32['attributes']=_0x5bbf32[_0x76f3('0x35')][_0x76f3('0x34')]?_0x5bbf32[_0x76f3('0x35')]:_0x15bf64[_0x76f3('0x2e')];if(_0x43d8c9[_0x76f3('0x2f')][_0x76f3('0x3d')]){_0x5bbf32[_0x76f3('0x42')]=[{'all':!![]}];}_0x5bbf32=_[_0x76f3('0x3b')]({},_0x5bbf32,_0x43d8c9[_0x76f3('0x3c')]);return db[_0x76f3('0x2b')]['find'](_0x5bbf32)[_0x76f3('0x22')](handleEntityNotFound(_0x47446f,null))[_0x76f3('0x22')](respondWithResult(_0x47446f,null))[_0x76f3('0x43')](handleError(_0x47446f,null));};exports[_0x76f3('0x44')]=function(_0x18ab46,_0xd80323){return db[_0x76f3('0x2b')][_0x76f3('0x44')](_0x18ab46[_0x76f3('0x45')],{})[_0x76f3('0x22')](respondWithResult(_0xd80323,0xc9))[_0x76f3('0x43')](handleError(_0xd80323,null));};exports[_0x76f3('0x21')]=function(_0x51538c,_0x3e1bf4){if(_0x51538c['body']['id']){delete _0x51538c[_0x76f3('0x45')]['id'];}return db[_0x76f3('0x2b')][_0x76f3('0x46')]({'where':{'id':_0x51538c[_0x76f3('0x47')]['id']}})[_0x76f3('0x22')](handleEntityNotFound(_0x3e1bf4,null))[_0x76f3('0x22')](saveUpdates(_0x51538c[_0x76f3('0x45')],null))['then'](respondWithResult(_0x3e1bf4,null))[_0x76f3('0x43')](handleError(_0x3e1bf4,null));};exports[_0x76f3('0x48')]=function(_0x36de46,_0x809326){return db[_0x76f3('0x2b')][_0x76f3('0x46')]({'where':{'id':_0x36de46['params']['id']}})['then'](handleEntityNotFound(_0x809326,null))[_0x76f3('0x22')](removeEntity(_0x809326,null))['catch'](handleError(_0x809326,null));};exports['describe']=function(_0x158b50,_0x4892ed){return db[_0x76f3('0x2b')][_0x76f3('0x49')]()[_0x76f3('0x22')](respondWithResult(_0x4892ed,null))[_0x76f3('0x43')](handleError(_0x4892ed,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index ec8ede5..8a840cf 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 _0x9c9c=['rimraf','../../config/environment','./userProfileSection.attributes','define','UserProfileSection','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x459a0a,_0x25c46f){var _0x4ab46c=function(_0x451a6a){while(--_0x451a6a){_0x459a0a['push'](_0x459a0a['shift']());}};_0x4ab46c(++_0x25c46f);}(_0x9c9c,0x1e4));var _0xc9c9=function(_0x21b95c,_0x35c39e){_0x21b95c=_0x21b95c-0x0;var _0x1ede2f=_0x9c9c[_0x21b95c];return _0x1ede2f;};'use strict';var _=require(_0xc9c9('0x0'));var util=require(_0xc9c9('0x1'));var logger=require(_0xc9c9('0x2'))(_0xc9c9('0x3'));var moment=require('moment');var BPromise=require(_0xc9c9('0x4'));var rp=require(_0xc9c9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc9c9('0x6'));var config=require(_0xc9c9('0x7'));var attributes=require(_0xc9c9('0x8'));module['exports']=function(_0x8f81c,_0x456b6b){return _0x8f81c[_0xc9c9('0x9')](_0xc9c9('0xa'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0xc9c9('0xb'),'fields':[_0xc9c9('0xc'),_0xc9c9('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1c2e=['rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','sectionId','util','bluebird','path'];(function(_0x517cb4,_0x4212a1){var _0x28e052=function(_0x8f7fef){while(--_0x8f7fef){_0x517cb4['push'](_0x517cb4['shift']());}};_0x28e052(++_0x4212a1);}(_0x1c2e,0xb8));var _0xe1c2=function(_0x35e1e2,_0x7b84b0){_0x35e1e2=_0x35e1e2-0x0;var _0x43d096=_0x1c2e[_0x35e1e2];return _0x43d096;};'use strict';var _=require('lodash');var util=require(_0xe1c2('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xe1c2('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe1c2('0x2'));var rimraf=require(_0xe1c2('0x3'));var config=require(_0xe1c2('0x4'));var attributes=require(_0xe1c2('0x5'));module[_0xe1c2('0x6')]=function(_0x32d4b0,_0x5dac40){return _0x32d4b0[_0xe1c2('0x7')](_0xe1c2('0x8'),attributes,{'tableName':_0xe1c2('0x9'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xe1c2('0xa'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index ba3cc52..a687d9b 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 _0xca8a=['../../config/environment','client','http','request','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x27fa17,_0x59dade){var _0x3c8c82=function(_0x120476){while(--_0x120476){_0x27fa17['push'](_0x27fa17['shift']());}};_0x3c8c82(++_0x59dade);}(_0xca8a,0xca));var _0xaca8=function(_0x3ff936,_0x3bcaab){_0x3ff936=_0x3ff936-0x0;var _0x4f3380=_0xca8a[_0x3ff936];return _0x4f3380;};'use strict';var _=require(_0xaca8('0x0'));var util=require(_0xaca8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xaca8('0x2'));var fs=require('fs');var Redis=require(_0xaca8('0x3'));var db=require(_0xaca8('0x4'))['db'];var utils=require(_0xaca8('0x5'));var logger=require(_0xaca8('0x6'))(_0xaca8('0x7'));var config=require(_0xaca8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaca8('0x9')][_0xaca8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3de899,_0x61a3a0,_0x38548c){return new BPromise(function(_0x4ef266,_0x278b21){return client[_0xaca8('0xb')](_0x3de899,_0x38548c)[_0xaca8('0xc')](function(_0x2c640f){logger['info'](_0xaca8('0xd'),_0x61a3a0,_0xaca8('0xe'));logger[_0xaca8('0xf')](_0xaca8('0x10'),_0x61a3a0,_0xaca8('0xe'),JSON[_0xaca8('0x11')](_0x2c640f));if(_0x2c640f[_0xaca8('0x12')]){if(_0x2c640f[_0xaca8('0x12')][_0xaca8('0x13')]===0x1f4){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x61a3a0,_0x2c640f[_0xaca8('0x12')][_0xaca8('0x14')]);return _0x278b21(_0x2c640f[_0xaca8('0x12')][_0xaca8('0x14')]);}logger['error'](_0xaca8('0xd'),_0x61a3a0,_0x2c640f[_0xaca8('0x12')][_0xaca8('0x14')]);return _0x4ef266(_0x2c640f[_0xaca8('0x12')][_0xaca8('0x14')]);}else{logger['info'](_0xaca8('0xd'),_0x61a3a0,_0xaca8('0xe'));_0x4ef266(_0x2c640f['result']['message']);}})['catch'](function(_0x3706ad){logger[_0xaca8('0x12')](_0xaca8('0xd'),_0x61a3a0,_0x3706ad);_0x278b21(_0x3706ad);});});} \ No newline at end of file +var _0x6e92=['http','request','then','info','request\x20sent','debug','error','code','message','UserProfileSection,\x20%s,\x20%s','result','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x6e92,0x13b));var _0x26e9=function(_0x4435c2,_0x3c12f2){_0x4435c2=_0x4435c2-0x0;var _0x160402=_0x6e92[_0x4435c2];return _0x160402;};'use strict';var _=require('lodash');var util=require(_0x26e9('0x0'));var moment=require(_0x26e9('0x1'));var BPromise=require('bluebird');var rs=require(_0x26e9('0x2'));var fs=require('fs');var Redis=require(_0x26e9('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x26e9('0x4'))(_0x26e9('0x5'));var config=require(_0x26e9('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x26e9('0x7')][_0x26e9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4a2792,_0x2560ed,_0x19c2b1){return new BPromise(function(_0x340549,_0xb35bd2){return client[_0x26e9('0x9')](_0x4a2792,_0x19c2b1)[_0x26e9('0xa')](function(_0x1d3637){logger[_0x26e9('0xb')]('UserProfileSection,\x20%s,\x20%s',_0x2560ed,_0x26e9('0xc'));logger[_0x26e9('0xd')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x2560ed,_0x26e9('0xc'),JSON['stringify'](_0x1d3637));if(_0x1d3637['error']){if(_0x1d3637[_0x26e9('0xe')][_0x26e9('0xf')]===0x1f4){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x2560ed,_0x1d3637[_0x26e9('0xe')][_0x26e9('0x10')]);return _0xb35bd2(_0x1d3637[_0x26e9('0xe')][_0x26e9('0x10')]);}logger[_0x26e9('0xe')](_0x26e9('0x11'),_0x2560ed,_0x1d3637[_0x26e9('0xe')][_0x26e9('0x10')]);return _0x340549(_0x1d3637[_0x26e9('0xe')][_0x26e9('0x10')]);}else{logger[_0x26e9('0xb')](_0x26e9('0x11'),_0x2560ed,_0x26e9('0xc'));_0x340549(_0x1d3637[_0x26e9('0x12')]['message']);}})['catch'](function(_0x207d8e){logger[_0x26e9('0xe')](_0x26e9('0x11'),_0x2560ed,_0x207d8e);_0xb35bd2(_0x207d8e);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 980a604..b094512 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x3fde44,_0x53f072){var _0x4550c0=function(_0x57af42){while(--_0x57af42){_0x3fde44['push'](_0x3fde44['shift']());}};_0x4550c0(++_0x53f072);}(_0x70e0,0x17b));var _0x070e=function(_0x31277b,_0x32d9c3){_0x31277b=_0x31277b-0x0;var _0x4e6e8d=_0x70e0[_0x31277b];return _0x4e6e8d;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x1977c2,_0x19446a){var _0x1f591c=function(_0x33d69d){while(--_0x33d69d){_0x1977c2['push'](_0x1977c2['shift']());}};_0x1f591c(++_0x19446a);}(_0x9c44,0x178));var _0x49c4=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x9c44[_0x3511d3];return _0x5d6321;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index b0f73d7..8795e5b 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 _0x9220=['sequelize','exports'];(function(_0x48779a,_0x2afba6){var _0x4af39b=function(_0x3b5d26){while(--_0x3b5d26){_0x48779a['push'](_0x48779a['shift']());}};_0x4af39b(++_0x2afba6);}(_0x9220,0x96));var _0x0922=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x9220[_0x5a776b];return _0xbbef59;};'use strict';var Sequelize=require(_0x0922('0x0'));module[_0x0922('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x36ee=['exports','sequelize'];(function(_0x282a1f,_0x49a6ef){var _0x296ea7=function(_0x4bac68){while(--_0x4bac68){_0x282a1f['push'](_0x282a1f['shift']());}};_0x296ea7(++_0x49a6ef);}(_0x36ee,0xbf));var _0xe36e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x36ee[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0xe36e('0x0'));module[_0xe36e('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'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 1292509..bb9ac24 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 _0xa498=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserSmsQueue'];(function(_0x2517bc,_0x2b292c){var _0x57bbc7=function(_0x1431a0){while(--_0x1431a0){_0x2517bc['push'](_0x2517bc['shift']());}};_0x57bbc7(++_0x2b292c);}(_0xa498,0x1d6));var _0x8a49=function(_0x4f8b2b,_0x1dc8dd){_0x4f8b2b=_0x4f8b2b-0x0;var _0x2f230a=_0xa498[_0x4f8b2b];return _0x2f230a;};'use strict';var _=require('lodash');var util=require(_0x8a49('0x0'));var logger=require(_0x8a49('0x1'))('api');var moment=require('moment');var BPromise=require(_0x8a49('0x2'));var rp=require(_0x8a49('0x3'));var fs=require('fs');var path=require(_0x8a49('0x4'));var rimraf=require(_0x8a49('0x5'));var config=require(_0x8a49('0x6'));var attributes=require('./userSmsQueue.attributes');module[_0x8a49('0x7')]=function(_0x5c5df6,_0x366d5b){return _0x5c5df6[_0x8a49('0x8')](_0x8a49('0x9'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4351=['exports','define','user_has_sms_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes'];(function(_0x11946c,_0x12152c){var _0x383935=function(_0x61fce2){while(--_0x61fce2){_0x11946c['push'](_0x11946c['shift']());}};_0x383935(++_0x12152c);}(_0x4351,0x1b5));var _0x1435=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x4351[_0x4fde08];return _0x12e725;};'use strict';var _=require(_0x1435('0x0'));var util=require(_0x1435('0x1'));var logger=require(_0x1435('0x2'))(_0x1435('0x3'));var moment=require(_0x1435('0x4'));var BPromise=require(_0x1435('0x5'));var rp=require(_0x1435('0x6'));var fs=require('fs');var path=require(_0x1435('0x7'));var rimraf=require(_0x1435('0x8'));var config=require(_0x1435('0x9'));var attributes=require(_0x1435('0xa'));module[_0x1435('0xb')]=function(_0x1f0838,_0x3a9f9a){return _0x1f0838[_0x1435('0xc')]('UserSmsQueue',attributes,{'tableName':_0x1435('0xd'),'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 2a09d4a..2989829 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 _0xbdf8=['request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0xbdf8,0x67));var _0x8bdf=function(_0x3364fc,_0x559233){_0x3364fc=_0x3364fc-0x0;var _0x10df36=_0xbdf8[_0x3364fc];return _0x10df36;};'use strict';var _=require(_0x8bdf('0x0'));var util=require(_0x8bdf('0x1'));var moment=require(_0x8bdf('0x2'));var BPromise=require(_0x8bdf('0x3'));var rs=require(_0x8bdf('0x4'));var fs=require('fs');var Redis=require(_0x8bdf('0x5'));var db=require(_0x8bdf('0x6'))['db'];var utils=require(_0x8bdf('0x7'));var logger=require(_0x8bdf('0x8'))(_0x8bdf('0x9'));var config=require(_0x8bdf('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x8bdf('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a375f,_0x59e0fd,_0x3ea6d3){return new BPromise(function(_0x2a3f1c,_0x393955){return client[_0x8bdf('0xc')](_0x4a375f,_0x3ea6d3)[_0x8bdf('0xd')](function(_0x98212d){logger[_0x8bdf('0xe')](_0x8bdf('0xf'),_0x59e0fd,_0x8bdf('0x10'));logger[_0x8bdf('0x11')](_0x8bdf('0x12'),_0x59e0fd,_0x8bdf('0x10'),JSON['stringify'](_0x98212d));if(_0x98212d['error']){if(_0x98212d[_0x8bdf('0x13')][_0x8bdf('0x14')]===0x1f4){logger[_0x8bdf('0x13')](_0x8bdf('0xf'),_0x59e0fd,_0x98212d['error'][_0x8bdf('0x15')]);return _0x393955(_0x98212d['error'][_0x8bdf('0x15')]);}logger[_0x8bdf('0x13')]('UserSmsQueue,\x20%s,\x20%s',_0x59e0fd,_0x98212d[_0x8bdf('0x13')][_0x8bdf('0x15')]);return _0x2a3f1c(_0x98212d[_0x8bdf('0x13')][_0x8bdf('0x15')]);}else{logger[_0x8bdf('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x59e0fd,_0x8bdf('0x10'));_0x2a3f1c(_0x98212d[_0x8bdf('0x16')][_0x8bdf('0x15')]);}})['catch'](function(_0x29507a){logger['error'](_0x8bdf('0xf'),_0x59e0fd,_0x29507a);_0x393955(_0x29507a);});});} \ No newline at end of file +var _0x3d07=['message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x3d07,0xc8));var _0x73d0=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x3d07[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0x73d0('0x0'));var util=require(_0x73d0('0x1'));var moment=require('moment');var BPromise=require(_0x73d0('0x2'));var rs=require(_0x73d0('0x3'));var fs=require('fs');var Redis=require(_0x73d0('0x4'));var db=require(_0x73d0('0x5'))['db'];var utils=require(_0x73d0('0x6'));var logger=require(_0x73d0('0x7'))(_0x73d0('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x73d0('0x9')][_0x73d0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbb283d,_0x18c3a1,_0x19745d){return new BPromise(function(_0x5e5cea,_0x25c622){return client[_0x73d0('0xb')](_0xbb283d,_0x19745d)[_0x73d0('0xc')](function(_0x310b0b){logger[_0x73d0('0xd')](_0x73d0('0xe'),_0x18c3a1,_0x73d0('0xf'));logger['debug'](_0x73d0('0x10'),_0x18c3a1,_0x73d0('0xf'),JSON[_0x73d0('0x11')](_0x310b0b));if(_0x310b0b[_0x73d0('0x12')]){if(_0x310b0b[_0x73d0('0x12')][_0x73d0('0x13')]===0x1f4){logger['error'](_0x73d0('0xe'),_0x18c3a1,_0x310b0b[_0x73d0('0x12')][_0x73d0('0x14')]);return _0x25c622(_0x310b0b[_0x73d0('0x12')]['message']);}logger[_0x73d0('0x12')](_0x73d0('0xe'),_0x18c3a1,_0x310b0b[_0x73d0('0x12')][_0x73d0('0x14')]);return _0x5e5cea(_0x310b0b['error'][_0x73d0('0x14')]);}else{logger[_0x73d0('0xd')](_0x73d0('0xe'),_0x18c3a1,_0x73d0('0xf'));_0x5e5cea(_0x310b0b['result']['message']);}})[_0x73d0('0x15')](function(_0x1394c8){logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x18c3a1,_0x1394c8);_0x25c622(_0x1394c8);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 2c85250..5c0501f 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 _0xd67d=['exports','INTEGER','sequelize'];(function(_0x469a3c,_0x5ebc10){var _0x968f4=function(_0x22403b){while(--_0x22403b){_0x469a3c['push'](_0x469a3c['shift']());}};_0x968f4(++_0x5ebc10);}(_0xd67d,0x1a9));var _0xdd67=function(_0x121d9e,_0x11b966){_0x121d9e=_0x121d9e-0x0;var _0x5df466=_0xd67d[_0x121d9e];return _0x5df466;};'use strict';var Sequelize=require(_0xdd67('0x0'));module[_0xdd67('0x1')]={'UserId':{'type':Sequelize[_0xdd67('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xdd67('0x2')]}}; \ No newline at end of file +var _0x2034=['INTEGER','sequelize','exports'];(function(_0xf10840,_0xad3916){var _0x1fdf7e=function(_0x463be3){while(--_0x463be3){_0xf10840['push'](_0xf10840['shift']());}};_0x1fdf7e(++_0xad3916);}(_0x2034,0x115));var _0x4203=function(_0x268fd8,_0x249420){_0x268fd8=_0x268fd8-0x0;var _0xd592fa=_0x2034[_0x268fd8];return _0xd592fa;};'use strict';var Sequelize=require(_0x4203('0x0'));module[_0x4203('0x1')]={'UserId':{'type':Sequelize[_0x4203('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index e1a0a55..c423946 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(_0x5d5c3c,_0x400884){var _0x55088d=function(_0x38e2f1){while(--_0x38e2f1){_0x5d5c3c['push'](_0x5d5c3c['shift']());}};_0x55088d(++_0x400884);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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(_0x2df587,_0x300b7c){var _0x21ca1f=function(_0x2d64da){while(--_0x2d64da){_0x2df587['push'](_0x2df587['shift']());}};_0x21ca1f(++_0x300b7c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'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 d438f97..cdca77c 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x172f09,_0x38765e){var _0x389c91=function(_0x1c7779){while(--_0x1c7779){_0x172f09['push'](_0x172f09['shift']());}};_0x389c91(++_0x38765e);}(_0x70e0,0x17b));var _0x070e=function(_0xd3eece,_0x4eaff6){_0xd3eece=_0xd3eece-0x0;var _0x50444d=_0x70e0[_0xd3eece];return _0x50444d;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x1977b0,_0x5dcdd1){var _0x57c0df=function(_0x3f2e0c){while(--_0x3f2e0c){_0x1977b0['push'](_0x1977b0['shift']());}};_0x57c0df(++_0x5dcdd1);}(_0xe706,0xa3));var _0x6e70=function(_0x35a384,_0x1e102e){_0x35a384=_0x35a384-0x0;var _0x3d6e8e=_0xe706[_0x35a384];return _0x3d6e8e;};'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 1fc071f..c661034 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 _0xd4de=['exports','INTEGER','sequelize'];(function(_0x4237d8,_0x13cc54){var _0x1e8caf=function(_0x1b18c5){while(--_0x1b18c5){_0x4237d8['push'](_0x4237d8['shift']());}};_0x1e8caf(++_0x13cc54);}(_0xd4de,0x173));var _0xed4d=function(_0x1433d6,_0x23c7f7){_0x1433d6=_0x1433d6-0x0;var _0x33ae59=_0xd4de[_0x1433d6];return _0x33ae59;};'use strict';var Sequelize=require(_0xed4d('0x0'));module[_0xed4d('0x1')]={'penalty':{'type':Sequelize[_0xed4d('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x839e=['INTEGER','sequelize'];(function(_0x56bcf7,_0x4c440b){var _0xad1ba0=function(_0x4fc539){while(--_0x4fc539){_0x56bcf7['push'](_0x56bcf7['shift']());}};_0xad1ba0(++_0x4c440b);}(_0x839e,0x117));var _0xe839=function(_0x3a0863,_0x4cd5ef){_0x3a0863=_0x3a0863-0x0;var _0x85c557=_0x839e[_0x3a0863];return _0x85c557;};'use strict';var Sequelize=require(_0xe839('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xe839('0x1')],'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 c61f45f..028f627 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 _0x7038=['moment','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','UserVoiceQueue','user_has_voice_queues','../../config/logger','api'];(function(_0x545b71,_0x4f44eb){var _0x26e587=function(_0x293b81){while(--_0x293b81){_0x545b71['push'](_0x545b71['shift']());}};_0x26e587(++_0x4f44eb);}(_0x7038,0x19c));var _0x8703=function(_0x3ac45a,_0x50eb44){_0x3ac45a=_0x3ac45a-0x0;var _0x2c8ab4=_0x7038[_0x3ac45a];return _0x2c8ab4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8703('0x0'))(_0x8703('0x1'));var moment=require(_0x8703('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8703('0x3'));var config=require(_0x8703('0x4'));var attributes=require(_0x8703('0x5'));module[_0x8703('0x6')]=function(_0x2f89cb,_0x2a506d){return _0x2f89cb['define'](_0x8703('0x7'),attributes,{'tableName':_0x8703('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4f1=['../../config/environment','exports','define','UserVoiceQueue','user_has_voice_queues','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0xb4f1,0x19c));var _0x1b4f=function(_0x3f6278,_0x3a0e3a){_0x3f6278=_0x3f6278-0x0;var _0x2efd63=_0xb4f1[_0x3f6278];return _0x2efd63;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1b4f('0x0'))(_0x1b4f('0x1'));var moment=require(_0x1b4f('0x2'));var BPromise=require(_0x1b4f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1b4f('0x4'));var rimraf=require(_0x1b4f('0x5'));var config=require(_0x1b4f('0x6'));var attributes=require('./userVoiceQueue.attributes');module[_0x1b4f('0x7')]=function(_0x146d1c,_0x1a453f){return _0x146d1c[_0x1b4f('0x8')](_0x1b4f('0x9'),attributes,{'tableName':_0x1b4f('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 ff9dfb5..7e6b685 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 _0xe174=['then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x48e1ec,_0x35f468){var _0x3b33eb=function(_0x507bf9){while(--_0x507bf9){_0x48e1ec['push'](_0x48e1ec['shift']());}};_0x3b33eb(++_0x35f468);}(_0xe174,0x160));var _0x4e17=function(_0x13e31f,_0x14bbc9){_0x13e31f=_0x13e31f-0x0;var _0x5c3161=_0xe174[_0x13e31f];return _0x5c3161;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x4e17('0x0'));var rs=require(_0x4e17('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4e17('0x2'));var logger=require(_0x4e17('0x3'))(_0x4e17('0x4'));var config=require(_0x4e17('0x5'));var jayson=require(_0x4e17('0x6'));var client=jayson[_0x4e17('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f6569,_0x32c3de,_0x553468){return new BPromise(function(_0x204a3b,_0x109b05){return client[_0x4e17('0x8')](_0x3f6569,_0x553468)[_0x4e17('0x9')](function(_0x2b0e45){logger[_0x4e17('0xa')](_0x4e17('0xb'),_0x32c3de,_0x4e17('0xc'));logger['debug'](_0x4e17('0xd'),_0x32c3de,'request\x20sent',JSON[_0x4e17('0xe')](_0x2b0e45));if(_0x2b0e45[_0x4e17('0xf')]){if(_0x2b0e45[_0x4e17('0xf')][_0x4e17('0x10')]===0x1f4){logger[_0x4e17('0xf')](_0x4e17('0xb'),_0x32c3de,_0x2b0e45[_0x4e17('0xf')]['message']);return _0x109b05(_0x2b0e45[_0x4e17('0xf')][_0x4e17('0x11')]);}logger[_0x4e17('0xf')]('UserVoiceQueue,\x20%s,\x20%s',_0x32c3de,_0x2b0e45[_0x4e17('0xf')][_0x4e17('0x11')]);return _0x204a3b(_0x2b0e45['error'][_0x4e17('0x11')]);}else{logger[_0x4e17('0xa')](_0x4e17('0xb'),_0x32c3de,_0x4e17('0xc'));_0x204a3b(_0x2b0e45[_0x4e17('0x12')][_0x4e17('0x11')]);}})['catch'](function(_0xe23839){logger[_0x4e17('0xf')](_0x4e17('0xb'),_0x32c3de,_0xe23839);_0x109b05(_0xe23839);});});} \ No newline at end of file +var _0x3e41=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','lodash','util','moment'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x3e41,0x93));var _0x13e4=function(_0x5370d1,_0x55644e){_0x5370d1=_0x5370d1-0x0;var _0x479410=_0x3e41[_0x5370d1];return _0x479410;};'use strict';var _=require(_0x13e4('0x0'));var util=require(_0x13e4('0x1'));var moment=require(_0x13e4('0x2'));var BPromise=require(_0x13e4('0x3'));var rs=require(_0x13e4('0x4'));var fs=require('fs');var Redis=require(_0x13e4('0x5'));var db=require(_0x13e4('0x6'))['db'];var utils=require(_0x13e4('0x7'));var logger=require('../../config/logger')(_0x13e4('0x8'));var config=require(_0x13e4('0x9'));var jayson=require(_0x13e4('0xa'));var client=jayson[_0x13e4('0xb')][_0x13e4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x314476,_0x59706b,_0x37e760){return new BPromise(function(_0xc87c3a,_0x53256b){return client[_0x13e4('0xd')](_0x314476,_0x37e760)[_0x13e4('0xe')](function(_0x16aabb){logger[_0x13e4('0xf')](_0x13e4('0x10'),_0x59706b,'request\x20sent');logger[_0x13e4('0x11')](_0x13e4('0x12'),_0x59706b,'request\x20sent',JSON['stringify'](_0x16aabb));if(_0x16aabb[_0x13e4('0x13')]){if(_0x16aabb['error'][_0x13e4('0x14')]===0x1f4){logger['error'](_0x13e4('0x10'),_0x59706b,_0x16aabb[_0x13e4('0x13')]['message']);return _0x53256b(_0x16aabb['error']['message']);}logger[_0x13e4('0x13')](_0x13e4('0x10'),_0x59706b,_0x16aabb['error']['message']);return _0xc87c3a(_0x16aabb[_0x13e4('0x13')][_0x13e4('0x15')]);}else{logger[_0x13e4('0xf')](_0x13e4('0x10'),_0x59706b,_0x13e4('0x16'));_0xc87c3a(_0x16aabb[_0x13e4('0x17')]['message']);}})[_0x13e4('0x18')](function(_0x344d3e){logger[_0x13e4('0x13')](_0x13e4('0x10'),_0x59706b,_0x344d3e);_0x53256b(_0x344d3e);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 6725d68..6349871 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x22071a,_0x4bcf62){var _0x5c6c85=function(_0x4c531b){while(--_0x4c531b){_0x22071a['push'](_0x22071a['shift']());}};_0x5c6c85(++_0x4bcf62);}(_0x9c44,0x178));var _0x49c4=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x9c44[_0x2064e5];return _0x21a233;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x8cd8da,_0x13ce25){var _0x5c59f2=function(_0x134cc1){while(--_0x134cc1){_0x8cd8da['push'](_0x8cd8da['shift']());}};_0x5c59f2(++_0x13ce25);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 25b5a99..aff2a21 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 _0xf1d4=['STRING','sequelize','exports','Required\x20by\x20Asterisk','INTEGER'];(function(_0x446140,_0xd9d626){var _0x4e1f09=function(_0xbc1c95){while(--_0xbc1c95){_0x446140['push'](_0x446140['shift']());}};_0x4e1f09(++_0xd9d626);}(_0xf1d4,0x128));var _0x4f1d=function(_0x433398,_0x38762b){_0x433398=_0x433398-0x0;var _0x456e22=_0xf1d4[_0x433398];return _0x456e22;};'use strict';var Sequelize=require(_0x4f1d('0x0'));module[_0x4f1d('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x4f1d('0x2')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x4f1d('0x2')},'UserId':{'type':Sequelize[_0x4f1d('0x3')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x4f1d('0x4')],'allowNull':![],'unique':'queue_interface','comment':_0x4f1d('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x4f1d('0x4')],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x4f1d('0x3')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x4f1d('0x3')](0xb),'defaultValue':0x0,'comment':_0x4f1d('0x2')}}; \ No newline at end of file +var _0x36a6=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports'];(function(_0x53a5f6,_0x4e0900){var _0x55deb4=function(_0x51c9dc){while(--_0x51c9dc){_0x53a5f6['push'](_0x53a5f6['shift']());}};_0x55deb4(++_0x4e0900);}(_0x36a6,0x1a2));var _0x636a=function(_0x2dfe88,_0x2339d7){_0x2dfe88=_0x2dfe88-0x0;var _0x36ee03=_0x36a6[_0x2dfe88];return _0x36ee03;};'use strict';var Sequelize=require(_0x636a('0x0'));module[_0x636a('0x1')]={'uniqueid':{'type':Sequelize[_0x636a('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x636a('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x636a('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x636a('0x4')],'allowNull':![],'unique':'queue_interface','comment':_0x636a('0x3')},'VoiceQueueId':{'type':Sequelize[_0x636a('0x2')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x636a('0x5'),'comment':_0x636a('0x3')},'penalty':{'type':Sequelize[_0x636a('0x2')](0xb),'defaultValue':0x0,'comment':_0x636a('0x3')},'paused':{'type':Sequelize['INTEGER'](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 5088305..f527e9c 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 _0x251b=['exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x2bf10c,_0x567a0c){var _0x24091d=function(_0x2bde04){while(--_0x2bde04){_0x2bf10c['push'](_0x2bf10c['shift']());}};_0x24091d(++_0x567a0c);}(_0x251b,0x1b1));var _0xb251=function(_0x2053ea,_0x1ab2d4){_0x2053ea=_0x2053ea-0x0;var _0x2232c4=_0x251b[_0x2053ea];return _0x2232c4;};'use strict';var EventEmitter=require(_0xb251('0x0'));var UserVoiceQueueRt=require(_0xb251('0x1'))['db'][_0xb251('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xb251('0x3')](0x0);var events={'afterCreate':_0xb251('0x4'),'afterUpdate':'update','afterDestroy':_0xb251('0x5')};function emitEvent(_0x4c1fbb){return function(_0x14dde6,_0x44ceab,_0x53f631){UserVoiceQueueRtEvents['emit'](_0x4c1fbb+':'+_0x14dde6['id'],_0x14dde6);UserVoiceQueueRtEvents[_0xb251('0x6')](_0x4c1fbb,_0x14dde6);_0x53f631(null);};}for(var e in events){if(events[_0xb251('0x7')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0xb251('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xfbbd=['emit','hasOwnProperty','exports','../../mysqldb','UserVoiceQueueRt','save','update'];(function(_0x5da615,_0x4b87c4){var _0x424651=function(_0x82d5b8){while(--_0x82d5b8){_0x5da615['push'](_0x5da615['shift']());}};_0x424651(++_0x4b87c4);}(_0xfbbd,0xdc));var _0xdfbb=function(_0x41bdc1,_0x3b1c37){_0x41bdc1=_0x41bdc1-0x0;var _0x36d3a4=_0xfbbd[_0x41bdc1];return _0x36d3a4;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0xdfbb('0x0'))['db'][_0xdfbb('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdfbb('0x2'),'afterUpdate':_0xdfbb('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1edcff){return function(_0x8a4cfc,_0x1f3389,_0x3f0388){UserVoiceQueueRtEvents[_0xdfbb('0x4')](_0x1edcff+':'+_0x8a4cfc['id'],_0x8a4cfc);UserVoiceQueueRtEvents['emit'](_0x1edcff,_0x8a4cfc);_0x3f0388(null);};}for(var e in events){if(events[_0xdfbb('0x5')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0xdfbb('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index a2e03ee..3a8f757 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 _0x2369=['path','rimraf','../../config/environment','exports','define','user_has_voice_queues_rt','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x6da2fa,_0x11cc7c){var _0x11d07a=function(_0x38548c){while(--_0x38548c){_0x6da2fa['push'](_0x6da2fa['shift']());}};_0x11d07a(++_0x11cc7c);}(_0x2369,0x1f2));var _0x9236=function(_0xd0abf3,_0x261ded){_0xd0abf3=_0xd0abf3-0x0;var _0x4562d3=_0x2369[_0xd0abf3];return _0x4562d3;};'use strict';var _=require(_0x9236('0x0'));var util=require(_0x9236('0x1'));var logger=require(_0x9236('0x2'))('api');var moment=require(_0x9236('0x3'));var BPromise=require(_0x9236('0x4'));var rp=require(_0x9236('0x5'));var fs=require('fs');var path=require(_0x9236('0x6'));var rimraf=require(_0x9236('0x7'));var config=require(_0x9236('0x8'));var attributes=require('./userVoiceQueueRt.attributes');module[_0x9236('0x9')]=function(_0x32a3c0,_0x2703ed){return _0x32a3c0[_0x9236('0xa')]('UserVoiceQueueRt',attributes,{'tableName':_0x9236('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7108=['bluebird','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','user_has_voice_queues_rt','lodash','../../config/logger','api','moment'];(function(_0x4bbffb,_0x107d37){var _0x4e6dbd=function(_0x6b7581){while(--_0x6b7581){_0x4bbffb['push'](_0x4bbffb['shift']());}};_0x4e6dbd(++_0x107d37);}(_0x7108,0xd8));var _0x8710=function(_0x4ea280,_0x480eba){_0x4ea280=_0x4ea280-0x0;var _0x108072=_0x7108[_0x4ea280];return _0x108072;};'use strict';var _=require(_0x8710('0x0'));var util=require('util');var logger=require(_0x8710('0x1'))(_0x8710('0x2'));var moment=require(_0x8710('0x3'));var BPromise=require(_0x8710('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8710('0x5'));var config=require(_0x8710('0x6'));var attributes=require(_0x8710('0x7'));module[_0x8710('0x8')]=function(_0xe9fd42,_0x2d77bb){return _0xe9fd42[_0x8710('0x9')]('UserVoiceQueueRt',attributes,{'tableName':_0x8710('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 178e556..257430e 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 _0x527b=['rpc','../../config/environment','client','redis','defaults','register','then','info','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','stringify','catch','moment','bluebird','randomstring','../../mysqldb'];(function(_0x485413,_0x39cff6){var _0x281995=function(_0x32c7e5){while(--_0x32c7e5){_0x485413['push'](_0x485413['shift']());}};_0x281995(++_0x39cff6);}(_0x527b,0xb6));var _0xb527=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x527b[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb527('0x0'));var BPromise=require(_0xb527('0x1'));var rs=require(_0xb527('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb527('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb527('0x4'));var config=require(_0xb527('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xb527('0x6')]['http']({'port':0x232a});config[_0xb527('0x7')]=_[_0xb527('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb527('0x7')]));require('./userVoiceQueueRt.socket')[_0xb527('0x9')](socket);function respondWithRpcPromise(_0x3ac3a1,_0xdaab10,_0x371aae){return new BPromise(function(_0x484581,_0x13042d){return client['request'](_0x3ac3a1,_0x371aae)[_0xb527('0xa')](function(_0x48d6f6){logger[_0xb527('0xb')]('UserVoiceQueueRt,\x20%s,\x20%s',_0xdaab10,_0xb527('0xc'));logger[_0xb527('0xd')](_0xb527('0xe'),_0xdaab10,'request\x20sent',JSON['stringify'](_0x48d6f6));if(_0x48d6f6[_0xb527('0xf')]){if(_0x48d6f6[_0xb527('0xf')][_0xb527('0x10')]===0x1f4){logger[_0xb527('0xf')](_0xb527('0x11'),_0xdaab10,_0x48d6f6[_0xb527('0xf')]['message']);return _0x13042d(_0x48d6f6['error'][_0xb527('0x12')]);}logger[_0xb527('0xf')](_0xb527('0x11'),_0xdaab10,_0x48d6f6[_0xb527('0xf')][_0xb527('0x12')]);return _0x484581(_0x48d6f6[_0xb527('0xf')][_0xb527('0x12')]);}else{logger[_0xb527('0xb')](_0xb527('0x11'),_0xdaab10,_0xb527('0xc'));_0x484581(_0x48d6f6[_0xb527('0x13')][_0xb527('0x12')]);}})['catch'](function(_0x2e1bb0){logger['error'](_0xb527('0x11'),_0xdaab10,_0x2e1bb0);_0x13042d(_0x2e1bb0);});});}exports[_0xb527('0x14')]=function(_0xd7075){var _0x30820f=this;return new Promise(function(_0x3f0c3f,_0x30d368){return db[_0xb527('0x15')]['findAll']({'raw':_0xd7075['options']?_0xd7075[_0xb527('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0xd7075[_0xb527('0x16')]?_0xd7075['options'][_0xb527('0x17')]||null:null,'attributes':[[db[_0xb527('0x18')]['fn'](_0xb527('0x19'),db[_0xb527('0x18')]['fn']('IF',db[_0xb527('0x18')][_0xb527('0x1a')](_0xb527('0x1b')))),_0xb527('0x1c')]]})['then'](function(_0x433ea8){logger[_0xb527('0xb')](_0xb527('0x14'),_0xd7075);logger[_0xb527('0xd')](_0xb527('0x14'),_0xd7075,JSON[_0xb527('0x1d')](_0x433ea8));_0x3f0c3f(_0x433ea8);})[_0xb527('0x1e')](function(_0x587871){logger[_0xb527('0xf')]('GetVoiceQueueRtPauses',_0x587871[_0xb527('0x12')],_0xd7075);_0x30d368(_0x30820f[_0xb527('0xf')](0x1f4,_0x587871['message']));});});}; \ No newline at end of file +var _0x5ba4=['../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','GetVoiceQueueRtPauses','findAll','options','where','sequelize','literal','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5ba4,0x119));var _0x45ba=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x5ba4[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x45ba('0x0'));var util=require(_0x45ba('0x1'));var moment=require(_0x45ba('0x2'));var BPromise=require('bluebird');var rs=require(_0x45ba('0x3'));var fs=require('fs');var Redis=require(_0x45ba('0x4'));var db=require(_0x45ba('0x5'))['db'];var utils=require(_0x45ba('0x6'));var logger=require(_0x45ba('0x7'))('rpc');var config=require(_0x45ba('0x8'));var jayson=require(_0x45ba('0x9'));var client=jayson[_0x45ba('0xa')][_0x45ba('0xb')]({'port':0x232a});config['redis']=_[_0x45ba('0xc')](config[_0x45ba('0xd')],{'host':_0x45ba('0xe'),'port':0x18eb});var socket=require(_0x45ba('0xf'))(new Redis(config[_0x45ba('0xd')]));require(_0x45ba('0x10'))[_0x45ba('0x11')](socket);function respondWithRpcPromise(_0x34b08d,_0x13e958,_0x21962e){return new BPromise(function(_0x28a162,_0x443f5b){return client[_0x45ba('0x12')](_0x34b08d,_0x21962e)[_0x45ba('0x13')](function(_0x33cd48){logger['info'](_0x45ba('0x14'),_0x13e958,_0x45ba('0x15'));logger[_0x45ba('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x13e958,_0x45ba('0x15'),JSON['stringify'](_0x33cd48));if(_0x33cd48['error']){if(_0x33cd48[_0x45ba('0x17')][_0x45ba('0x18')]===0x1f4){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x13e958,_0x33cd48[_0x45ba('0x17')][_0x45ba('0x19')]);return _0x443f5b(_0x33cd48[_0x45ba('0x17')][_0x45ba('0x19')]);}logger[_0x45ba('0x17')](_0x45ba('0x14'),_0x13e958,_0x33cd48['error'][_0x45ba('0x19')]);return _0x28a162(_0x33cd48['error'][_0x45ba('0x19')]);}else{logger[_0x45ba('0x1a')](_0x45ba('0x14'),_0x13e958,_0x45ba('0x15'));_0x28a162(_0x33cd48[_0x45ba('0x1b')][_0x45ba('0x19')]);}})[_0x45ba('0x1c')](function(_0x37b9f9){logger['error'](_0x45ba('0x14'),_0x13e958,_0x37b9f9);_0x443f5b(_0x37b9f9);});});}exports[_0x45ba('0x1d')]=function(_0x182203){var _0x80a47=this;return new Promise(function(_0x20b940,_0x2e15fb){return db['UserVoiceQueueRt'][_0x45ba('0x1e')]({'raw':_0x182203[_0x45ba('0x1f')]?_0x182203[_0x45ba('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x182203[_0x45ba('0x1f')]?_0x182203[_0x45ba('0x1f')][_0x45ba('0x20')]||null:null,'attributes':[[db[_0x45ba('0x21')]['fn']('COUNT',db[_0x45ba('0x21')]['fn']('IF',db[_0x45ba('0x21')][_0x45ba('0x22')]('`paused`\x20=\x201,\x201,\x20null'))),'outboundQueuePauses']]})['then'](function(_0x5d7c3e){logger['info'](_0x45ba('0x1d'),_0x182203);logger['debug'](_0x45ba('0x1d'),_0x182203,JSON[_0x45ba('0x23')](_0x5d7c3e));_0x20b940(_0x5d7c3e);})[_0x45ba('0x1c')](function(_0x510199){logger[_0x45ba('0x17')](_0x45ba('0x1d'),_0x510199[_0x45ba('0x19')],_0x182203);_0x2e15fb(_0x80a47[_0x45ba('0x17')](0x1f4,_0x510199[_0x45ba('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index de39209..73df4b3 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 _0x78b7=['removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','update','emit'];(function(_0x1040ce,_0x4b41b6){var _0x310f73=function(_0x1a05ac){while(--_0x1a05ac){_0x1040ce['push'](_0x1040ce['shift']());}};_0x310f73(++_0x4b41b6);}(_0x78b7,0x194));var _0x778b=function(_0x4cc60f,_0x475f0a){_0x4cc60f=_0x4cc60f-0x0;var _0x25a0ee=_0x78b7[_0x4cc60f];return _0x25a0ee;};'use strict';var UserVoiceQueueRtEvents=require(_0x778b('0x0'));var events=[_0x778b('0x1'),'remove',_0x778b('0x2')];function createListener(_0x3072bd,_0x422fff){return function(_0x3221de){_0x422fff[_0x778b('0x3')](_0x3072bd,_0x3221de);};}function removeListener(_0x4d298d,_0x4c91f3){return function(){UserVoiceQueueRtEvents[_0x778b('0x4')](_0x4d298d,_0x4c91f3);};}exports[_0x778b('0x5')]=function(_0x11b624){for(var _0xb6f0af=0x0,_0x41ca62=events[_0x778b('0x6')];_0xb6f0af<_0x41ca62;_0xb6f0af++){var _0x49a27a=events[_0xb6f0af];var _0x3fba10=createListener(_0x778b('0x7')+_0x49a27a,_0x11b624);UserVoiceQueueRtEvents['on'](_0x49a27a,_0x3fba10);}}; \ No newline at end of file +var _0x1a28=['update','removeListener','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove'];(function(_0xecfc51,_0x3d8acc){var _0xa3fdaa=function(_0x1820f8){while(--_0x1820f8){_0xecfc51['push'](_0xecfc51['shift']());}};_0xa3fdaa(++_0x3d8acc);}(_0x1a28,0x10e));var _0x81a2=function(_0xf0bc07,_0x510ebf){_0xf0bc07=_0xf0bc07-0x0;var _0x1c50c2=_0x1a28[_0xf0bc07];return _0x1c50c2;};'use strict';var UserVoiceQueueRtEvents=require(_0x81a2('0x0'));var events=[_0x81a2('0x1'),_0x81a2('0x2'),_0x81a2('0x3')];function createListener(_0x46ac8d,_0x19b137){return function(_0x5e5b20){_0x19b137['emit'](_0x46ac8d,_0x5e5b20);};}function removeListener(_0x350cfe,_0x41fa0c){return function(){UserVoiceQueueRtEvents[_0x81a2('0x4')](_0x350cfe,_0x41fa0c);};}exports['register']=function(_0x4188d7){for(var _0x20dcd4=0x0,_0x597932=events[_0x81a2('0x5')];_0x20dcd4<_0x597932;_0x20dcd4++){var _0x2aa66f=events[_0x20dcd4];var _0x453392=createListener(_0x81a2('0x6')+_0x2aa66f,_0x4188d7);UserVoiceQueueRtEvents['on'](_0x2aa66f,_0x453392);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index ac6cc93..d8fa48f 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x748fb7,_0x59a9f9){var _0xd74bff=function(_0x4effb2){while(--_0x4effb2){_0x748fb7['push'](_0x748fb7['shift']());}};_0xd74bff(++_0x59a9f9);}(_0xe706,0xa3));var _0x6e70=function(_0x109c40,_0x3463fa){_0x109c40=_0x109c40-0x0;var _0x3d5aed=_0xe706[_0x109c40];return _0x3d5aed;};'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(_0x49e0e5,_0x1f1f6b){var _0x249c90=function(_0x2851ea){while(--_0x2851ea){_0x49e0e5['push'](_0x49e0e5['shift']());}};_0x249c90(++_0x1f1f6b);}(_0x9c44,0x178));var _0x49c4=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x9c44[_0x18ab2a];return _0x16dcee;};'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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 112bb53..5012517 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 _0x08da=['exports','INTEGER'];(function(_0x39479f,_0x822ae4){var _0x4a6d96=function(_0x55bfba){while(--_0x55bfba){_0x39479f['push'](_0x39479f['shift']());}};_0x4a6d96(++_0x822ae4);}(_0x08da,0x180));var _0xa08d=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x08da[_0x173441];return _0x2423a8;};'use strict';var Sequelize=require('sequelize');module[_0xa08d('0x0')]={'penalty':{'type':Sequelize[_0xa08d('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0a51=['INTEGER'];(function(_0x59f522,_0x25fefb){var _0x151256=function(_0x13a1e9){while(--_0x13a1e9){_0x59f522['push'](_0x59f522['shift']());}};_0x151256(++_0x25fefb);}(_0x0a51,0x158));var _0x10a5=function(_0x46c4ec,_0x36d01e){_0x46c4ec=_0x46c4ec-0x0;var _0x3eb7ac=_0x0a51[_0x46c4ec];return _0x3eb7ac;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x10a5('0x0')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 080d426..1ec69f1 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 _0x9da1=['exports','define','UserWhatsappQueue','util','moment','request-promise','rimraf','../../config/environment','./userWhatsappQueue.attributes'];(function(_0x48783c,_0x1f986b){var _0x2ce586=function(_0x38e1bd){while(--_0x38e1bd){_0x48783c['push'](_0x48783c['shift']());}};_0x2ce586(++_0x1f986b);}(_0x9da1,0xc0));var _0x19da=function(_0x4776cc,_0x3a715e){_0x4776cc=_0x4776cc-0x0;var _0x427bda=_0x9da1[_0x4776cc];return _0x427bda;};'use strict';var _=require('lodash');var util=require(_0x19da('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x19da('0x1'));var BPromise=require('bluebird');var rp=require(_0x19da('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x19da('0x3'));var config=require(_0x19da('0x4'));var attributes=require(_0x19da('0x5'));module[_0x19da('0x6')]=function(_0x13faad,_0x23b479){return _0x13faad[_0x19da('0x7')](_0x19da('0x8'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34e9=['api','moment','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util'];(function(_0x5a8584,_0x2a8452){var _0x2e68f9=function(_0xcacd24){while(--_0xcacd24){_0x5a8584['push'](_0x5a8584['shift']());}};_0x2e68f9(++_0x2a8452);}(_0x34e9,0xe5));var _0x934e=function(_0x1c5b88,_0x43d811){_0x1c5b88=_0x1c5b88-0x0;var _0x5b9704=_0x34e9[_0x1c5b88];return _0x5b9704;};'use strict';var _=require(_0x934e('0x0'));var util=require(_0x934e('0x1'));var logger=require('../../config/logger')(_0x934e('0x2'));var moment=require(_0x934e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x934e('0x4'));var config=require(_0x934e('0x5'));var attributes=require(_0x934e('0x6'));module[_0x934e('0x7')]=function(_0x28805a,_0x38676b){return _0x28805a[_0x934e('0x8')](_0x934e('0x9'),attributes,{'tableName':_0x934e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 555148e..cb2e561 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 _0x90c0=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x5c5b95,_0x3994b4){var _0x26a867=function(_0x4464ee){while(--_0x4464ee){_0x5c5b95['push'](_0x5c5b95['shift']());}};_0x26a867(++_0x3994b4);}(_0x90c0,0xb7));var _0x090c=function(_0x2f90c0,_0x5d162a){_0x2f90c0=_0x2f90c0-0x0;var _0x2e3552=_0x90c0[_0x2f90c0];return _0x2e3552;};'use strict';var _=require(_0x090c('0x0'));var util=require(_0x090c('0x1'));var moment=require(_0x090c('0x2'));var BPromise=require(_0x090c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x090c('0x4'));var db=require(_0x090c('0x5'))['db'];var utils=require(_0x090c('0x6'));var logger=require('../../config/logger')(_0x090c('0x7'));var config=require(_0x090c('0x8'));var jayson=require(_0x090c('0x9'));var client=jayson[_0x090c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a1931,_0x1253a7,_0x341b01){return new BPromise(function(_0x1d751d,_0x4cbcf1){return client['request'](_0x4a1931,_0x341b01)[_0x090c('0xb')](function(_0x314c4d){logger[_0x090c('0xc')](_0x090c('0xd'),_0x1253a7,_0x090c('0xe'));logger[_0x090c('0xf')](_0x090c('0x10'),_0x1253a7,_0x090c('0xe'),JSON[_0x090c('0x11')](_0x314c4d));if(_0x314c4d[_0x090c('0x12')]){if(_0x314c4d['error'][_0x090c('0x13')]===0x1f4){logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x1253a7,_0x314c4d['error']['message']);return _0x4cbcf1(_0x314c4d['error']['message']);}logger[_0x090c('0x12')](_0x090c('0xd'),_0x1253a7,_0x314c4d['error']['message']);return _0x1d751d(_0x314c4d[_0x090c('0x12')][_0x090c('0x14')]);}else{logger[_0x090c('0xc')](_0x090c('0xd'),_0x1253a7,_0x090c('0xe'));_0x1d751d(_0x314c4d[_0x090c('0x15')]['message']);}})[_0x090c('0x16')](function(_0x58456a){logger[_0x090c('0x12')](_0x090c('0xd'),_0x1253a7,_0x58456a);_0x4cbcf1(_0x58456a);});});} \ No newline at end of file +var _0x52ae=['jayson/promise','http','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x367a3d,_0x452717){var _0x460539=function(_0x1e8beb){while(--_0x1e8beb){_0x367a3d['push'](_0x367a3d['shift']());}};_0x460539(++_0x452717);}(_0x52ae,0x13c));var _0xe52a=function(_0x2ce6d5,_0x333e0c){_0x2ce6d5=_0x2ce6d5-0x0;var _0x32d272=_0x52ae[_0x2ce6d5];return _0x32d272;};'use strict';var _=require('lodash');var util=require(_0xe52a('0x0'));var moment=require(_0xe52a('0x1'));var BPromise=require('bluebird');var rs=require(_0xe52a('0x2'));var fs=require('fs');var Redis=require(_0xe52a('0x3'));var db=require(_0xe52a('0x4'))['db'];var utils=require(_0xe52a('0x5'));var logger=require(_0xe52a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe52a('0x7'));var client=jayson['client'][_0xe52a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2327a6,_0x1ace4a,_0x555e8c){return new BPromise(function(_0x19c0ad,_0x485821){return client['request'](_0x2327a6,_0x555e8c)['then'](function(_0x2e5213){logger[_0xe52a('0x9')](_0xe52a('0xa'),_0x1ace4a,_0xe52a('0xb'));logger[_0xe52a('0xc')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x1ace4a,_0xe52a('0xb'),JSON[_0xe52a('0xd')](_0x2e5213));if(_0x2e5213[_0xe52a('0xe')]){if(_0x2e5213[_0xe52a('0xe')][_0xe52a('0xf')]===0x1f4){logger[_0xe52a('0xe')](_0xe52a('0xa'),_0x1ace4a,_0x2e5213[_0xe52a('0xe')][_0xe52a('0x10')]);return _0x485821(_0x2e5213[_0xe52a('0xe')][_0xe52a('0x10')]);}logger['error'](_0xe52a('0xa'),_0x1ace4a,_0x2e5213[_0xe52a('0xe')][_0xe52a('0x10')]);return _0x19c0ad(_0x2e5213[_0xe52a('0xe')][_0xe52a('0x10')]);}else{logger[_0xe52a('0x9')]('UserWhatsappQueue,\x20%s,\x20%s',_0x1ace4a,_0xe52a('0xb'));_0x19c0ad(_0x2e5213[_0xe52a('0x11')]['message']);}})[_0xe52a('0x12')](function(_0x24221f){logger['error'](_0xe52a('0xa'),_0x1ace4a,_0x24221f);_0x485821(_0x24221f);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 11d8571..0524bc2 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 _0xaefc=['index','/:id','post','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x210d7f,_0x2abe4f){var _0x42d687=function(_0x46b2ae){while(--_0x46b2ae){_0x210d7f['push'](_0x210d7f['shift']());}};_0x42d687(++_0x2abe4f);}(_0xaefc,0xc8));var _0xcaef=function(_0x3c4087,_0x5c764b){_0x3c4087=_0x3c4087-0x0;var _0x23ad1f=_0xaefc[_0x3c4087];return _0x23ad1f;};'use strict';var multer=require(_0xcaef('0x0'));var util=require(_0xcaef('0x1'));var path=require(_0xcaef('0x2'));var timeout=require('connect-timeout');var express=require(_0xcaef('0x3'));var router=express[_0xcaef('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xcaef('0x5'));var config=require(_0xcaef('0x6'));var controller=require('./variable.controller');router['get']('/',auth[_0xcaef('0x7')](),controller[_0xcaef('0x8')]);router['get'](_0xcaef('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xcaef('0xa')]('/',auth[_0xcaef('0x7')](),controller['create']);router[_0xcaef('0xb')](_0xcaef('0x9'),auth['isAuthenticated'](),controller[_0xcaef('0xc')]);router[_0xcaef('0xd')](_0xcaef('0x9'),auth[_0xcaef('0x7')](),controller[_0xcaef('0xe')]);module[_0xcaef('0xf')]=router; \ No newline at end of file +var _0xcee8=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','isAuthenticated','index','post','create','put','update','/:id','exports','multer','util','path'];(function(_0x6b22b5,_0xa1a5b6){var _0x17dbf1=function(_0xde0156){while(--_0xde0156){_0x6b22b5['push'](_0x6b22b5['shift']());}};_0x17dbf1(++_0xa1a5b6);}(_0xcee8,0xb1));var _0x8cee=function(_0x2c890f,_0x1c1c94){_0x2c890f=_0x2c890f-0x0;var _0x176268=_0xcee8[_0x2c890f];return _0x176268;};'use strict';var multer=require(_0x8cee('0x0'));var util=require(_0x8cee('0x1'));var path=require(_0x8cee('0x2'));var timeout=require(_0x8cee('0x3'));var express=require(_0x8cee('0x4'));var router=express[_0x8cee('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8cee('0x6'));var interaction=require(_0x8cee('0x7'));var config=require(_0x8cee('0x8'));var controller=require(_0x8cee('0x9'));router['get']('/',auth[_0x8cee('0xa')](),controller[_0x8cee('0xb')]);router['get']('/:id',auth[_0x8cee('0xa')](),controller['show']);router[_0x8cee('0xc')]('/',auth[_0x8cee('0xa')](),controller[_0x8cee('0xd')]);router[_0x8cee('0xe')]('/:id',auth[_0x8cee('0xa')](),controller[_0x8cee('0xf')]);router['delete'](_0x8cee('0x10'),auth[_0x8cee('0xa')](),controller['destroy']);module[_0x8cee('0x11')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index ef15fa7..2c4020b 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 _0x9e42=['STRING','exports'];(function(_0x185cde,_0x16f3d3){var _0x15ebad=function(_0x1ba19d){while(--_0x1ba19d){_0x185cde['push'](_0x185cde['shift']());}};_0x15ebad(++_0x16f3d3);}(_0x9e42,0x157));var _0x29e4=function(_0x631a3c,_0x1b61b6){_0x631a3c=_0x631a3c-0x0;var _0x2bdfa3=_0x9e42[_0x631a3c];return _0x2bdfa3;};'use strict';var Sequelize=require('sequelize');module[_0x29e4('0x0')]={'name':{'type':Sequelize[_0x29e4('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x29e4('0x1')]}}; \ No newline at end of file +var _0x0124=['sequelize','exports','STRING','name'];(function(_0x3cdf64,_0x326109){var _0xba20f6=function(_0x1527b){while(--_0x1527b){_0x3cdf64['push'](_0x3cdf64['shift']());}};_0xba20f6(++_0x326109);}(_0x0124,0x108));var _0x4012=function(_0xb26065,_0x36df08){_0xb26065=_0xb26065-0x0;var _0x974dce=_0x0124[_0xb26065];return _0x974dce;};'use strict';var Sequelize=require(_0x4012('0x0'));module[_0x4012('0x1')]={'name':{'type':Sequelize[_0x4012('0x2')],'unique':_0x4012('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4012('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 2dff58b..f823c7a 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 _0x2f3c=['findAll','catch','show','keys','includeAll','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','UserProfileResource','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','Variables','error','name','send','index','map','Variable','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include'];(function(_0x26a293,_0x198770){var _0x4d0bd6=function(_0x38f289){while(--_0x38f289){_0x26a293['push'](_0x26a293['shift']());}};_0x4d0bd6(++_0x198770);}(_0x2f3c,0xfd));var _0xc2f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2f3c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc2f3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc2f3('0x1'));var jsonpatch=require(_0xc2f3('0x2'));var rp=require(_0xc2f3('0x3'));var moment=require(_0xc2f3('0x4'));var BPromise=require(_0xc2f3('0x5'));var Mustache=require(_0xc2f3('0x6'));var util=require(_0xc2f3('0x7'));var path=require('path');var sox=require(_0xc2f3('0x8'));var csv=require(_0xc2f3('0x9'));var ejs=require(_0xc2f3('0xa'));var fs=require('fs');var fs_extra=require(_0xc2f3('0xb'));var _=require(_0xc2f3('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc2f3('0xd'));var toCsv=require(_0xc2f3('0x9'));var querystring=require('querystring');var Papa=require(_0xc2f3('0xe'));var Redis=require(_0xc2f3('0xf'));var authService=require(_0xc2f3('0x10'));var qs=require(_0xc2f3('0x11'));var as=require(_0xc2f3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc2f3('0x13'))(_0xc2f3('0x14'));var utils=require(_0xc2f3('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc2f3('0x16'))['db'];function respondWithStatusCode(_0x3f87a7,_0x3ae32c){_0x3ae32c=_0x3ae32c||0xcc;return function(_0xdc7dcb){if(_0xdc7dcb){return _0x3f87a7[_0xc2f3('0x17')](_0x3ae32c);}return _0x3f87a7['status'](_0x3ae32c)[_0xc2f3('0x18')]();};}function respondWithResult(_0x1791df,_0x2d9b87){_0x2d9b87=_0x2d9b87||0xc8;return function(_0x45e531){if(_0x45e531){return _0x1791df[_0xc2f3('0x19')](_0x2d9b87)[_0xc2f3('0x1a')](_0x45e531);}};}function respondWithFilteredResult(_0x579ddc,_0x27f088){return function(_0xa3c358){if(_0xa3c358){var _0xe291b=typeof _0x27f088[_0xc2f3('0x1b')]===_0xc2f3('0x1c')&&typeof _0x27f088[_0xc2f3('0x1d')]===_0xc2f3('0x1c');var _0x100193=_0xa3c358['count'];var _0x59d3ee=_0xe291b?0x0:_0x27f088[_0xc2f3('0x1b')];var _0x1c36f7=_0xe291b?_0xa3c358[_0xc2f3('0x1e')]:_0x27f088[_0xc2f3('0x1b')]+_0x27f088['limit'];var _0x26931e;if(_0x1c36f7>=_0x100193){_0x1c36f7=_0x100193;_0x26931e=0xc8;}else{_0x26931e=0xce;}_0x579ddc[_0xc2f3('0x19')](_0x26931e);return _0x579ddc['set'](_0xc2f3('0x1f'),_0x59d3ee+'-'+_0x1c36f7+'/'+_0x100193)[_0xc2f3('0x1a')](_0xa3c358);}return null;};}function patchUpdates(_0x530cf4){return function(_0xa91b30){try{jsonpatch['apply'](_0xa91b30,_0x530cf4,!![]);}catch(_0x5de9da){return BPromise[_0xc2f3('0x20')](_0x5de9da);}return _0xa91b30['save']();};}function saveUpdates(_0x3b0096,_0x244bbf){return function(_0xb47180){if(_0xb47180){return _0xb47180[_0xc2f3('0x21')](_0x3b0096)[_0xc2f3('0x22')](function(_0x5d877e){return _0x5d877e;});}return null;};}function removeEntity(_0x46b57f,_0xdc6361){return function(_0x5b5eb0){if(_0x5b5eb0){return _0x5b5eb0[_0xc2f3('0x23')]()[_0xc2f3('0x22')](function(){var _0xbbcf59=_0x5b5eb0['get']({'plain':!![]});var _0x26aee9=_0xc2f3('0x24');return db['UserProfileResource'][_0xc2f3('0x23')]({'where':{'type':_0x26aee9,'resourceId':_0xbbcf59['id']}})['then'](function(){return _0x5b5eb0;});})[_0xc2f3('0x22')](function(){_0x46b57f[_0xc2f3('0x19')](0xcc)[_0xc2f3('0x18')]();});}};}function handleEntityNotFound(_0xa7b71f,_0x215f96){return function(_0x108b76){if(!_0x108b76){_0xa7b71f['sendStatus'](0x194);}return _0x108b76;};}function handleError(_0x3b18b8,_0x42eacb){_0x42eacb=_0x42eacb||0x1f4;return function(_0x3d76e6){logger[_0xc2f3('0x25')](_0x3d76e6['stack']);if(_0x3d76e6[_0xc2f3('0x26')]){delete _0x3d76e6[_0xc2f3('0x26')];}_0x3b18b8['status'](_0x42eacb)[_0xc2f3('0x27')](_0x3d76e6);};}exports[_0xc2f3('0x28')]=function(_0x13b305,_0x47c85c){var _0x129b6a={},_0x4ab57b={},_0x18d606={'count':0x0,'rows':[]};var _0x3bda5f=_[_0xc2f3('0x29')](db[_0xc2f3('0x2a')]['rawAttributes'],function(_0x239f05){return{'name':_0x239f05[_0xc2f3('0x2b')],'type':_0x239f05[_0xc2f3('0x2c')][_0xc2f3('0x2d')]};});_0x4ab57b[_0xc2f3('0x2e')]=_['map'](_0x3bda5f,'name');_0x4ab57b[_0xc2f3('0x2f')]=_['keys'](_0x13b305['query']);_0x4ab57b[_0xc2f3('0x30')]=_[_0xc2f3('0x31')](_0x4ab57b[_0xc2f3('0x2e')],_0x4ab57b[_0xc2f3('0x2f')]);_0x129b6a[_0xc2f3('0x32')]=_[_0xc2f3('0x31')](_0x4ab57b[_0xc2f3('0x2e')],qs[_0xc2f3('0x33')](_0x13b305[_0xc2f3('0x2f')][_0xc2f3('0x33')]));_0x129b6a[_0xc2f3('0x32')]=_0x129b6a[_0xc2f3('0x32')][_0xc2f3('0x34')]?_0x129b6a['attributes']:_0x4ab57b[_0xc2f3('0x2e')];if(!_0x13b305[_0xc2f3('0x2f')][_0xc2f3('0x35')](_0xc2f3('0x36'))){_0x129b6a['limit']=qs[_0xc2f3('0x1d')](_0x13b305['query'][_0xc2f3('0x1d')]);_0x129b6a[_0xc2f3('0x1b')]=qs['offset'](_0x13b305['query']['offset']);}_0x129b6a[_0xc2f3('0x37')]=qs['sort'](_0x13b305[_0xc2f3('0x2f')][_0xc2f3('0x38')]);_0x129b6a[_0xc2f3('0x39')]=qs[_0xc2f3('0x30')](_[_0xc2f3('0x3a')](_0x13b305[_0xc2f3('0x2f')],_0x4ab57b[_0xc2f3('0x30')]),_0x3bda5f);if(_0x13b305[_0xc2f3('0x2f')]['filter']){_0x129b6a[_0xc2f3('0x39')]=_['merge'](_0x129b6a['where'],{'$or':_[_0xc2f3('0x29')](_0x3bda5f,function(_0x5d5bec){if(_0x5d5bec['type']!=='VIRTUAL'){var _0x4414fb={};_0x4414fb[_0x5d5bec['name']]={'$like':'%'+_0x13b305[_0xc2f3('0x2f')][_0xc2f3('0x3b')]+'%'};return _0x4414fb;}})});}_0x129b6a=_[_0xc2f3('0x3c')]({},_0x129b6a,_0x13b305[_0xc2f3('0x3d')]);var _0x2d479a={'where':_0x129b6a['where']};return db[_0xc2f3('0x2a')][_0xc2f3('0x1e')](_0x2d479a)[_0xc2f3('0x22')](function(_0x207fc3){_0x18d606[_0xc2f3('0x1e')]=_0x207fc3;if(_0x13b305['query']['includeAll']){_0x129b6a[_0xc2f3('0x3e')]=[{'all':!![]}];}return db[_0xc2f3('0x2a')][_0xc2f3('0x3f')](_0x129b6a);})['then'](function(_0x43c880){_0x18d606['rows']=_0x43c880;return _0x18d606;})[_0xc2f3('0x22')](respondWithFilteredResult(_0x47c85c,_0x129b6a))[_0xc2f3('0x40')](handleError(_0x47c85c,null));};exports[_0xc2f3('0x41')]=function(_0x1ae088,_0x418ef6){var _0x8e707b={'raw':!![],'where':{'id':_0x1ae088['params']['id']}},_0x139851={};_0x139851['model']=_[_0xc2f3('0x42')](db[_0xc2f3('0x2a')]['rawAttributes']);_0x139851['query']=_[_0xc2f3('0x42')](_0x1ae088[_0xc2f3('0x2f')]);_0x139851[_0xc2f3('0x30')]=_[_0xc2f3('0x31')](_0x139851['model'],_0x139851[_0xc2f3('0x2f')]);_0x8e707b[_0xc2f3('0x32')]=_[_0xc2f3('0x31')](_0x139851[_0xc2f3('0x2e')],qs[_0xc2f3('0x33')](_0x1ae088[_0xc2f3('0x2f')]['fields']));_0x8e707b[_0xc2f3('0x32')]=_0x8e707b['attributes'][_0xc2f3('0x34')]?_0x8e707b[_0xc2f3('0x32')]:_0x139851[_0xc2f3('0x2e')];if(_0x1ae088['query'][_0xc2f3('0x43')]){_0x8e707b[_0xc2f3('0x3e')]=[{'all':!![]}];}_0x8e707b=_[_0xc2f3('0x3c')]({},_0x8e707b,_0x1ae088[_0xc2f3('0x3d')]);return db[_0xc2f3('0x2a')]['find'](_0x8e707b)['then'](handleEntityNotFound(_0x418ef6,null))['then'](respondWithResult(_0x418ef6,null))['catch'](handleError(_0x418ef6,null));};exports['create']=function(_0x528224,_0x17404e){return db[_0xc2f3('0x2a')][_0xc2f3('0x44')](_0x528224[_0xc2f3('0x45')],{})[_0xc2f3('0x22')](function(_0x114c3c){var _0xc82ce4=_0x528224[_0xc2f3('0x46')][_0xc2f3('0x47')]({'plain':!![]});if(!_0xc82ce4)throw new Error(_0xc2f3('0x48'));if(_0xc82ce4[_0xc2f3('0x49')]===_0xc2f3('0x46')){var _0x57e859=_0x114c3c[_0xc2f3('0x47')]({'plain':!![]});var _0x5450ce=_0xc2f3('0x24');return db['UserProfileSection'][_0xc2f3('0x4a')]({'where':{'name':_0x5450ce,'userProfileId':_0xc82ce4[_0xc2f3('0x4b')]},'raw':!![]})['then'](function(_0x24cd9a){if(_0x24cd9a&&_0x24cd9a[_0xc2f3('0x4c')]===0x0){return db[_0xc2f3('0x4d')]['create']({'name':_0x57e859[_0xc2f3('0x26')],'resourceId':_0x57e859['id'],'type':_0x24cd9a['name'],'sectionId':_0x24cd9a['id']},{})[_0xc2f3('0x22')](function(){return _0x114c3c;});}else{return _0x114c3c;}})['catch'](function(_0x3cdaba){logger[_0xc2f3('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3cdaba);throw _0x3cdaba;});}return _0x114c3c;})['then'](respondWithResult(_0x17404e,0xc9))[_0xc2f3('0x40')](handleError(_0x17404e,null));};exports[_0xc2f3('0x21')]=function(_0x40cd74,_0x4d4b20){if(_0x40cd74[_0xc2f3('0x45')]['id']){delete _0x40cd74[_0xc2f3('0x45')]['id'];}return db[_0xc2f3('0x2a')][_0xc2f3('0x4a')]({'where':{'id':_0x40cd74['params']['id']}})[_0xc2f3('0x22')](handleEntityNotFound(_0x4d4b20,null))[_0xc2f3('0x22')](saveUpdates(_0x40cd74['body'],null))['then'](respondWithResult(_0x4d4b20,null))[_0xc2f3('0x40')](handleError(_0x4d4b20,null));};exports['destroy']=function(_0x6b7619,_0xcdd50){return db['Variable']['find']({'where':{'id':_0x6b7619[_0xc2f3('0x4e')]['id']}})[_0xc2f3('0x22')](handleEntityNotFound(_0xcdd50,null))[_0xc2f3('0x22')](removeEntity(_0xcdd50,null))[_0xc2f3('0x40')](handleError(_0xcdd50,null));}; \ No newline at end of file +var _0xf242=['rawAttributes','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','apply','reject','save','destroy','then','get','Variables','stack','name','send','index','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','Variable','rows','show','params'];(function(_0x43eeaa,_0x27ebeb){var _0x270775=function(_0x449b44){while(--_0x449b44){_0x43eeaa['push'](_0x43eeaa['shift']());}};_0x270775(++_0x27ebeb);}(_0xf242,0x171));var _0x2f24=function(_0x45fc6a,_0x166adb){_0x45fc6a=_0x45fc6a-0x0;var _0x14bcfd=_0xf242[_0x45fc6a];return _0x14bcfd;};'use strict';var emlformat=require(_0x2f24('0x0'));var rimraf=require(_0x2f24('0x1'));var zipdir=require(_0x2f24('0x2'));var jsonpatch=require(_0x2f24('0x3'));var rp=require(_0x2f24('0x4'));var moment=require(_0x2f24('0x5'));var BPromise=require(_0x2f24('0x6'));var Mustache=require('mustache');var util=require(_0x2f24('0x7'));var path=require(_0x2f24('0x8'));var sox=require(_0x2f24('0x9'));var csv=require(_0x2f24('0xa'));var ejs=require(_0x2f24('0xb'));var fs=require('fs');var fs_extra=require(_0x2f24('0xc'));var _=require(_0x2f24('0xd'));var squel=require(_0x2f24('0xe'));var crypto=require(_0x2f24('0xf'));var jsforce=require(_0x2f24('0x10'));var deskjs=require(_0x2f24('0x11'));var toCsv=require(_0x2f24('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2f24('0x12'));var authService=require(_0x2f24('0x13'));var qs=require(_0x2f24('0x14'));var as=require(_0x2f24('0x15'));var hardwareService=require(_0x2f24('0x16'));var logger=require(_0x2f24('0x17'))(_0x2f24('0x18'));var utils=require(_0x2f24('0x19'));var config=require(_0x2f24('0x1a'));var licenseUtil=require(_0x2f24('0x1b'));var db=require(_0x2f24('0x1c'))['db'];function respondWithStatusCode(_0x2a0bef,_0x2da383){_0x2da383=_0x2da383||0xcc;return function(_0x2498b5){if(_0x2498b5){return _0x2a0bef[_0x2f24('0x1d')](_0x2da383);}return _0x2a0bef[_0x2f24('0x1e')](_0x2da383)[_0x2f24('0x1f')]();};}function respondWithResult(_0x29ea62,_0x106e63){_0x106e63=_0x106e63||0xc8;return function(_0x1a780a){if(_0x1a780a){return _0x29ea62[_0x2f24('0x1e')](_0x106e63)['json'](_0x1a780a);}};}function respondWithFilteredResult(_0x24b7ac,_0x3487ee){return function(_0x1a4928){if(_0x1a4928){var _0x7d6b56=typeof _0x3487ee[_0x2f24('0x20')]===_0x2f24('0x21')&&typeof _0x3487ee['limit']===_0x2f24('0x21');var _0x5d7118=_0x1a4928[_0x2f24('0x22')];var _0x463077=_0x7d6b56?0x0:_0x3487ee[_0x2f24('0x20')];var _0x3be8f2=_0x7d6b56?_0x1a4928[_0x2f24('0x22')]:_0x3487ee[_0x2f24('0x20')]+_0x3487ee['limit'];var _0x17e303;if(_0x3be8f2>=_0x5d7118){_0x3be8f2=_0x5d7118;_0x17e303=0xc8;}else{_0x17e303=0xce;}_0x24b7ac[_0x2f24('0x1e')](_0x17e303);return _0x24b7ac[_0x2f24('0x23')](_0x2f24('0x24'),_0x463077+'-'+_0x3be8f2+'/'+_0x5d7118)['json'](_0x1a4928);}return null;};}function patchUpdates(_0x3546bb){return function(_0x5c0ab1){try{jsonpatch[_0x2f24('0x25')](_0x5c0ab1,_0x3546bb,!![]);}catch(_0x1b6c4f){return BPromise[_0x2f24('0x26')](_0x1b6c4f);}return _0x5c0ab1[_0x2f24('0x27')]();};}function saveUpdates(_0x2244ed,_0xe33020){return function(_0x2c3d2b){if(_0x2c3d2b){return _0x2c3d2b['update'](_0x2244ed)['then'](function(_0x3a1947){return _0x3a1947;});}return null;};}function removeEntity(_0x19d44b,_0x37247f){return function(_0x3683e0){if(_0x3683e0){return _0x3683e0[_0x2f24('0x28')]()[_0x2f24('0x29')](function(){var _0x1a1658=_0x3683e0[_0x2f24('0x2a')]({'plain':!![]});var _0x56c3ef=_0x2f24('0x2b');return db['UserProfileResource'][_0x2f24('0x28')]({'where':{'type':_0x56c3ef,'resourceId':_0x1a1658['id']}})['then'](function(){return _0x3683e0;});})['then'](function(){_0x19d44b[_0x2f24('0x1e')](0xcc)[_0x2f24('0x1f')]();});}};}function handleEntityNotFound(_0x5b7882,_0x5629f3){return function(_0x1bd04c){if(!_0x1bd04c){_0x5b7882[_0x2f24('0x1d')](0x194);}return _0x1bd04c;};}function handleError(_0x2c6a95,_0x243081){_0x243081=_0x243081||0x1f4;return function(_0x5c7ec8){logger['error'](_0x5c7ec8[_0x2f24('0x2c')]);if(_0x5c7ec8[_0x2f24('0x2d')]){delete _0x5c7ec8[_0x2f24('0x2d')];}_0x2c6a95[_0x2f24('0x1e')](_0x243081)[_0x2f24('0x2e')](_0x5c7ec8);};}exports[_0x2f24('0x2f')]=function(_0x4d9f8c,_0x1a60b4){var _0x9011a0={},_0x43d5fd={},_0x271b5a={'count':0x0,'rows':[]};var _0xd54977=_[_0x2f24('0x30')](db['Variable']['rawAttributes'],function(_0x19d242){return{'name':_0x19d242[_0x2f24('0x31')],'type':_0x19d242['type'][_0x2f24('0x32')]};});_0x43d5fd[_0x2f24('0x33')]=_['map'](_0xd54977,_0x2f24('0x2d'));_0x43d5fd[_0x2f24('0x34')]=_[_0x2f24('0x35')](_0x4d9f8c[_0x2f24('0x34')]);_0x43d5fd[_0x2f24('0x36')]=_[_0x2f24('0x37')](_0x43d5fd[_0x2f24('0x33')],_0x43d5fd[_0x2f24('0x34')]);_0x9011a0[_0x2f24('0x38')]=_['intersection'](_0x43d5fd[_0x2f24('0x33')],qs[_0x2f24('0x39')](_0x4d9f8c[_0x2f24('0x34')]['fields']));_0x9011a0[_0x2f24('0x38')]=_0x9011a0[_0x2f24('0x38')][_0x2f24('0x3a')]?_0x9011a0[_0x2f24('0x38')]:_0x43d5fd[_0x2f24('0x33')];if(!_0x4d9f8c[_0x2f24('0x34')][_0x2f24('0x3b')]('nolimit')){_0x9011a0['limit']=qs[_0x2f24('0x3c')](_0x4d9f8c['query'][_0x2f24('0x3c')]);_0x9011a0['offset']=qs['offset'](_0x4d9f8c[_0x2f24('0x34')][_0x2f24('0x20')]);}_0x9011a0[_0x2f24('0x3d')]=qs['sort'](_0x4d9f8c['query'][_0x2f24('0x3e')]);_0x9011a0[_0x2f24('0x3f')]=qs['filters'](_[_0x2f24('0x40')](_0x4d9f8c[_0x2f24('0x34')],_0x43d5fd['filters']),_0xd54977);if(_0x4d9f8c['query'][_0x2f24('0x41')]){_0x9011a0[_0x2f24('0x3f')]=_[_0x2f24('0x42')](_0x9011a0[_0x2f24('0x3f')],{'$or':_[_0x2f24('0x30')](_0xd54977,function(_0x1d90d2){if(_0x1d90d2[_0x2f24('0x43')]!==_0x2f24('0x44')){var _0x39f8eb={};_0x39f8eb[_0x1d90d2['name']]={'$like':'%'+_0x4d9f8c['query'][_0x2f24('0x41')]+'%'};return _0x39f8eb;}})});}_0x9011a0=_[_0x2f24('0x42')]({},_0x9011a0,_0x4d9f8c[_0x2f24('0x45')]);var _0x241a95={'where':_0x9011a0[_0x2f24('0x3f')]};return db['Variable'][_0x2f24('0x22')](_0x241a95)[_0x2f24('0x29')](function(_0x3aa948){_0x271b5a[_0x2f24('0x22')]=_0x3aa948;if(_0x4d9f8c['query'][_0x2f24('0x46')]){_0x9011a0[_0x2f24('0x47')]=[{'all':!![]}];}return db[_0x2f24('0x48')]['findAll'](_0x9011a0);})[_0x2f24('0x29')](function(_0x54b5c3){_0x271b5a[_0x2f24('0x49')]=_0x54b5c3;return _0x271b5a;})[_0x2f24('0x29')](respondWithFilteredResult(_0x1a60b4,_0x9011a0))['catch'](handleError(_0x1a60b4,null));};exports[_0x2f24('0x4a')]=function(_0x54a3db,_0xeaf3e1){var _0x186abf={'raw':!![],'where':{'id':_0x54a3db[_0x2f24('0x4b')]['id']}},_0x5903a0={};_0x5903a0['model']=_[_0x2f24('0x35')](db[_0x2f24('0x48')][_0x2f24('0x4c')]);_0x5903a0[_0x2f24('0x34')]=_[_0x2f24('0x35')](_0x54a3db[_0x2f24('0x34')]);_0x5903a0['filters']=_[_0x2f24('0x37')](_0x5903a0[_0x2f24('0x33')],_0x5903a0[_0x2f24('0x34')]);_0x186abf['attributes']=_['intersection'](_0x5903a0[_0x2f24('0x33')],qs[_0x2f24('0x39')](_0x54a3db[_0x2f24('0x34')][_0x2f24('0x39')]));_0x186abf[_0x2f24('0x38')]=_0x186abf['attributes'][_0x2f24('0x3a')]?_0x186abf[_0x2f24('0x38')]:_0x5903a0[_0x2f24('0x33')];if(_0x54a3db[_0x2f24('0x34')][_0x2f24('0x46')]){_0x186abf[_0x2f24('0x47')]=[{'all':!![]}];}_0x186abf=_[_0x2f24('0x42')]({},_0x186abf,_0x54a3db[_0x2f24('0x45')]);return db[_0x2f24('0x48')]['find'](_0x186abf)['then'](handleEntityNotFound(_0xeaf3e1,null))[_0x2f24('0x29')](respondWithResult(_0xeaf3e1,null))[_0x2f24('0x4d')](handleError(_0xeaf3e1,null));};exports[_0x2f24('0x4e')]=function(_0x3d6746,_0x651235){return db[_0x2f24('0x48')][_0x2f24('0x4e')](_0x3d6746[_0x2f24('0x4f')],{})[_0x2f24('0x29')](function(_0x19dca0){var _0x3a1cb0=_0x3d6746['user'][_0x2f24('0x2a')]({'plain':!![]});if(!_0x3a1cb0)throw new Error(_0x2f24('0x50'));if(_0x3a1cb0[_0x2f24('0x51')]==='user'){var _0x149a24=_0x19dca0[_0x2f24('0x2a')]({'plain':!![]});var _0x527ac9=_0x2f24('0x2b');return db[_0x2f24('0x52')]['find']({'where':{'name':_0x527ac9,'userProfileId':_0x3a1cb0[_0x2f24('0x53')]},'raw':!![]})['then'](function(_0x4553e7){if(_0x4553e7&&_0x4553e7[_0x2f24('0x54')]===0x0){return db[_0x2f24('0x55')]['create']({'name':_0x149a24[_0x2f24('0x2d')],'resourceId':_0x149a24['id'],'type':_0x4553e7[_0x2f24('0x2d')],'sectionId':_0x4553e7['id']},{})[_0x2f24('0x29')](function(){return _0x19dca0;});}else{return _0x19dca0;}})[_0x2f24('0x4d')](function(_0x23771e){logger[_0x2f24('0x56')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x23771e);throw _0x23771e;});}return _0x19dca0;})[_0x2f24('0x29')](respondWithResult(_0x651235,0xc9))[_0x2f24('0x4d')](handleError(_0x651235,null));};exports[_0x2f24('0x57')]=function(_0x4af1d4,_0x2aab20){if(_0x4af1d4['body']['id']){delete _0x4af1d4[_0x2f24('0x4f')]['id'];}return db['Variable'][_0x2f24('0x58')]({'where':{'id':_0x4af1d4[_0x2f24('0x4b')]['id']}})[_0x2f24('0x29')](handleEntityNotFound(_0x2aab20,null))[_0x2f24('0x29')](saveUpdates(_0x4af1d4[_0x2f24('0x4f')],null))[_0x2f24('0x29')](respondWithResult(_0x2aab20,null))[_0x2f24('0x4d')](handleError(_0x2aab20,null));};exports[_0x2f24('0x28')]=function(_0x79b57b,_0x5534a4){return db[_0x2f24('0x48')]['find']({'where':{'id':_0x79b57b['params']['id']}})[_0x2f24('0x29')](handleEntityNotFound(_0x5534a4,null))[_0x2f24('0x29')](removeEntity(_0x5534a4,null))['catch'](handleError(_0x5534a4,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 92a42fe..462c3c7 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 _0x41f8=['bluebird','path','rimraf','../../config/environment','./variable.attributes','define','Variable','tools_variables','lodash','../../config/logger','api'];(function(_0x269149,_0x7d2d30){var _0x163361=function(_0x485640){while(--_0x485640){_0x269149['push'](_0x269149['shift']());}};_0x163361(++_0x7d2d30);}(_0x41f8,0x13c));var _0x841f=function(_0x46bf87,_0x2e6dbd){_0x46bf87=_0x46bf87-0x0;var _0x2e6d6e=_0x41f8[_0x46bf87];return _0x2e6d6e;};'use strict';var _=require(_0x841f('0x0'));var util=require('util');var logger=require(_0x841f('0x1'))(_0x841f('0x2'));var moment=require('moment');var BPromise=require(_0x841f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x841f('0x4'));var rimraf=require(_0x841f('0x5'));var config=require(_0x841f('0x6'));var attributes=require(_0x841f('0x7'));module['exports']=function(_0x2ae460,_0x12e4b4){return _0x2ae460[_0x841f('0x8')](_0x841f('0x9'),attributes,{'tableName':_0x841f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd6b1=['path','rimraf','./variable.attributes','exports','define','Variable','tools_variables','util','../../config/logger','api','bluebird','request-promise'];(function(_0x22868f,_0x450f48){var _0x97bc75=function(_0x447cb4){while(--_0x447cb4){_0x22868f['push'](_0x22868f['shift']());}};_0x97bc75(++_0x450f48);}(_0xd6b1,0x10f));var _0x1d6b=function(_0x137ad9,_0x4b9162){_0x137ad9=_0x137ad9-0x0;var _0xf0e978=_0xd6b1[_0x137ad9];return _0xf0e978;};'use strict';var _=require('lodash');var util=require(_0x1d6b('0x0'));var logger=require(_0x1d6b('0x1'))(_0x1d6b('0x2'));var moment=require('moment');var BPromise=require(_0x1d6b('0x3'));var rp=require(_0x1d6b('0x4'));var fs=require('fs');var path=require(_0x1d6b('0x5'));var rimraf=require(_0x1d6b('0x6'));var config=require('../../config/environment');var attributes=require(_0x1d6b('0x7'));module[_0x1d6b('0x8')]=function(_0x2b5bc7,_0x24abf8){return _0x2b5bc7[_0x1d6b('0x9')](_0x1d6b('0xa'),attributes,{'tableName':_0x1d6b('0xb'),'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 bbeef74..3dd050c 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 _0x6aa7=['include','model','attributes','map','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowVariable','find','options','raw','where'];(function(_0x2111a8,_0x14dc89){var _0xe20384=function(_0x5992ab){while(--_0x5992ab){_0x2111a8['push'](_0x2111a8['shift']());}};_0xe20384(++_0x14dc89);}(_0x6aa7,0x178));var _0x76aa=function(_0x3b3a99,_0x3d4087){_0x3b3a99=_0x3b3a99-0x0;var _0x17f049=_0x6aa7[_0x3b3a99];return _0x17f049;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});}exports[_0x76aa('0x16')]=function(_0x21c16d){var _0xa1bc7=this;return new Promise(function(_0x3ead3f,_0x496902){return db['Variable'][_0x76aa('0x17')]({'raw':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x19')]===undefined?!![]:![]:!![],'where':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1a')]||null:null,'attributes':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')]['attributes']||null:null,'include':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')]?_['map'](_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')],function(_0x31252f){return{'model':db[_0x31252f[_0x76aa('0x1c')]],'as':_0x31252f['as'],'attributes':_0x31252f[_0x76aa('0x1d')],'include':_0x31252f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x31252f[_0x76aa('0x1b')],function(_0x32bf9f){return{'model':db[_0x32bf9f[_0x76aa('0x1c')]],'as':_0x32bf9f['as'],'attributes':_0x32bf9f[_0x76aa('0x1d')],'include':_0x32bf9f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x32bf9f['include'],function(_0xb5e8a9){return{'model':db[_0xb5e8a9[_0x76aa('0x1c')]],'as':_0xb5e8a9['as'],'attributes':_0xb5e8a9[_0x76aa('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x76aa('0xa')](function(_0xa1e6){logger[_0x76aa('0xb')](_0x76aa('0x16'),_0x21c16d);logger[_0x76aa('0xe')](_0x76aa('0x16'),_0x21c16d,JSON[_0x76aa('0x10')](_0xa1e6));_0x3ead3f(_0xa1e6);})['catch'](function(_0x3fcb7f){logger['error'](_0x76aa('0x16'),_0x3fcb7f[_0x76aa('0x13')],_0x21c16d);_0x496902(_0xa1bc7[_0x76aa('0x11')](0x1f4,_0x3fcb7f[_0x76aa('0x13')]));});});}; \ No newline at end of file +var _0x5fc3=['info','request\x20sent','debug','stringify','error','code','message','Variable,\x20%s,\x20%s','result','catch','ShowVariable','find','options','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x33c9f8,_0x5aedbb){var _0x2d7004=function(_0x4f4f43){while(--_0x4f4f43){_0x33c9f8['push'](_0x33c9f8['shift']());}};_0x2d7004(++_0x5aedbb);}(_0x5fc3,0xa8));var _0x35fc=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x5fc3[_0x273c39];return _0x46d6b5;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('Variable,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('Variable,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('Variable,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});}exports[_0x35fc('0x16')]=function(_0x553677){var _0x41e165=this;return new Promise(function(_0x363e47,_0x2e513b){return db['Variable'][_0x35fc('0x17')]({'raw':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x19')]||null:null,'attributes':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1a')]||null:null,'include':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x553677['options'][_0x35fc('0x1b')],function(_0xd5399f){return{'model':db[_0xd5399f[_0x35fc('0x1d')]],'as':_0xd5399f['as'],'attributes':_0xd5399f[_0x35fc('0x1a')],'include':_0xd5399f[_0x35fc('0x1b')]?_['map'](_0xd5399f[_0x35fc('0x1b')],function(_0x4c587a){return{'model':db[_0x4c587a['model']],'as':_0x4c587a['as'],'attributes':_0x4c587a[_0x35fc('0x1a')],'include':_0x4c587a[_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x4c587a['include'],function(_0x4086e9){return{'model':db[_0x4086e9['model']],'as':_0x4086e9['as'],'attributes':_0x4086e9[_0x35fc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x35fc('0xb')](function(_0x5cb986){logger['info'](_0x35fc('0x16'),_0x553677);logger['debug'](_0x35fc('0x16'),_0x553677,JSON[_0x35fc('0xf')](_0x5cb986));_0x363e47(_0x5cb986);})['catch'](function(_0x26b7cb){logger[_0x35fc('0x10')](_0x35fc('0x16'),_0x26b7cb[_0x35fc('0x12')],_0x553677);_0x2e513b(_0x41e165[_0x35fc('0x10')](0x1f4,_0x26b7cb[_0x35fc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 8bffbbd..45a73af 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 _0x5fad=['canUpdate','fetch','isAuthenticated','reset','pull','/restart','restart','/migrations','exports','express','Router','../../components/auth/service','./version.controller','get','index','/fetch'];(function(_0x32efb5,_0x1b6f42){var _0x5b644c=function(_0x44e59b){while(--_0x44e59b){_0x32efb5['push'](_0x32efb5['shift']());}};_0x5b644c(++_0x1b6f42);}(_0x5fad,0x1e9));var _0xd5fa=function(_0x34f930,_0x597cb0){_0x34f930=_0x34f930-0x0;var _0x55b287=_0x5fad[_0x34f930];return _0x55b287;};'use strict';var express=require(_0xd5fa('0x0'));var router=express[_0xd5fa('0x1')]();var auth=require(_0xd5fa('0x2'));var controller=require(_0xd5fa('0x3'));router[_0xd5fa('0x4')]('/',controller[_0xd5fa('0x5')]);router[_0xd5fa('0x4')](_0xd5fa('0x6'),auth['isAuthenticated'](),auth[_0xd5fa('0x7')](),controller[_0xd5fa('0x8')]);router[_0xd5fa('0x4')]('/reset',auth[_0xd5fa('0x9')](),auth[_0xd5fa('0x7')](),controller[_0xd5fa('0xa')]);router[_0xd5fa('0x4')]('/pull',auth[_0xd5fa('0x9')](),auth['canUpdate'](),controller[_0xd5fa('0xb')]);router['get'](_0xd5fa('0xc'),auth[_0xd5fa('0x9')](),controller[_0xd5fa('0xd')]);router['get'](_0xd5fa('0xe'),controller['migrations']);module[_0xd5fa('0xf')]=router; \ No newline at end of file +var _0x3f1a=['canUpdate','reset','/pull','pull','/restart','/migrations','migrations','exports','../../components/auth/service','get','index','/fetch','isAuthenticated'];(function(_0x5661c1,_0x1d3440){var _0x15790c=function(_0x4dea41){while(--_0x4dea41){_0x5661c1['push'](_0x5661c1['shift']());}};_0x15790c(++_0x1d3440);}(_0x3f1a,0xcb));var _0xa3f1=function(_0x2291ee,_0x3c4052){_0x2291ee=_0x2291ee-0x0;var _0x45b271=_0x3f1a[_0x2291ee];return _0x45b271;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xa3f1('0x0'));var controller=require('./version.controller');router[_0xa3f1('0x1')]('/',controller[_0xa3f1('0x2')]);router[_0xa3f1('0x1')](_0xa3f1('0x3'),auth[_0xa3f1('0x4')](),auth[_0xa3f1('0x5')](),controller['fetch']);router[_0xa3f1('0x1')]('/reset',auth[_0xa3f1('0x4')](),auth['canUpdate'](),controller[_0xa3f1('0x6')]);router['get'](_0xa3f1('0x7'),auth[_0xa3f1('0x4')](),auth[_0xa3f1('0x5')](),controller[_0xa3f1('0x8')]);router[_0xa3f1('0x1')](_0xa3f1('0x9'),auth['isAuthenticated'](),controller['restart']);router[_0xa3f1('0x1')](_0xa3f1('0xa'),controller[_0xa3f1('0xb')]);module[_0xa3f1('0xc')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 9015ac2..268d936 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 _0x569c=['simple-git','exports','query','latest','2.0.0','status','fetch','origin','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','git\x20reset\x20--hard\x20FETCH_HEAD','json','git\x20reset\x20--hard','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','readdirSync','root','server','length','replace','.js','push','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','then','\x20to\x20','last','join','catch','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/logger','update'];(function(_0x53b55f,_0x7980d0){var _0x71d9fa=function(_0x1c30c2){while(--_0x1c30c2){_0x53b55f['push'](_0x53b55f['shift']());}};_0x71d9fa(++_0x7980d0);}(_0x569c,0x133));var _0xc569=function(_0x129fcf,_0x60afbb){_0x129fcf=_0x129fcf-0x0;var _0x23a6d0=_0x569c[_0x129fcf];return _0x23a6d0;};'use strict';var Umzug=require(_0xc569('0x0'));var path=require('path');var fs=require('fs');var _=require(_0xc569('0x1'));var pkginfo=require(_0xc569('0x2'))(module,_0xc569('0x3'));var compareVersions=require(_0xc569('0x4'));var exec=require(_0xc569('0x5'))[_0xc569('0x6')];var db=require(_0xc569('0x7'))['db'];var config=require(_0xc569('0x8'));var pm2=require('../../config/pm2');var logger=require(_0xc569('0x9'))(_0xc569('0xa'));var git=require(_0xc569('0xb'))(config['root']);exports['index']=function(_0x38bb3a,_0x1c39ca){var _0x4906b4={'current':module[_0xc569('0xc')]['version'],'phonebar':0x2};if(_0x38bb3a[_0xc569('0xd')]&&_0x38bb3a[_0xc569('0xd')][_0xc569('0xe')]){return git['fetch']()['tags'](function(_0x1a2311,_0x54bdb7){_0x4906b4[_0xc569('0xe')]=(_0x1a2311?module[_0xc569('0xc')][_0xc569('0x3')]:_0x54bdb7[_0xc569('0xe')])||_0xc569('0xf');return _0x1c39ca[_0xc569('0x10')](0xc8)['json'](_0x4906b4);});}else{return _0x1c39ca['status'](0xc8)['json'](_0x4906b4);}};exports[_0xc569('0x11')]=function(_0x2581f1,_0x51f92b){return git[_0xc569('0x11')]([_0xc569('0x12'),'master'],function(_0x1cf836){if(_0x1cf836){logger[_0xc569('0x13')](_0x1cf836);return _0x51f92b[_0xc569('0x10')](0x1f4)['json'](_0x1cf836);}logger[_0xc569('0x14')](_0xc569('0x15'));return _0x51f92b[_0xc569('0x10')](0xc8)['json']({'output':_0xc569('0x16')});});};exports[_0xc569('0x17')]=function(_0x51cf53,_0x42712b){return git[_0xc569('0x17')](['--hard','FETCH_HEAD'],function(_0x1a692f){if(_0x1a692f){logger['error'](_0x1a692f);return _0x42712b[_0xc569('0x10')](0x1f4)['json'](_0x1a692f);}logger[_0xc569('0x14')](_0xc569('0x18'));return _0x42712b['status'](0xc8)[_0xc569('0x19')]({'output':_0xc569('0x1a')});});};exports['pull']=function(_0x5198fc,_0x189be7){exec('npm\x20install\x20--production',function(_0x222a9b,_0x40fb56,_0x4e7433){logger[_0xc569('0x14')](_0x40fb56);logger[_0xc569('0x14')](_0x4e7433);if(_0x222a9b){logger[_0xc569('0x13')](_0x222a9b);return _0x189be7[_0xc569('0x10')](0x1f4)['json'](_0x222a9b);}return _0x189be7[_0xc569('0x10')](0xc8)['json']({'output':_0x40fb56});});};exports['restart']=function(_0x31aa22,_0x4fa3c4){return pm2[_0xc569('0x1b')](_0xc569('0x1c'))['then'](function(_0x2cf1d7){logger[_0xc569('0x14')](_0xc569('0x1d'),_0x2cf1d7);return _0x4fa3c4[_0xc569('0x10')](0xc8)['json']({'output':_0xc569('0x1e')});})['catch'](function(_0x4cf2fb){logger[_0xc569('0x13')](_0x4cf2fb);return _0x4fa3c4['status'](0x1f4)[_0xc569('0x19')](_0x4cf2fb);});};exports[_0xc569('0x1f')]=function(_0x393691,_0x1fd2a0){var _0x4501b2=fs[_0xc569('0x20')](path['join'](config[_0xc569('0x21')],_0xc569('0x22'),_0xc569('0x1f')));var _0x28e276=[];for(var _0x17510c=0x0;_0x17510c<_0x4501b2[_0xc569('0x23')];_0x17510c++){var _0x3af554=_0x4501b2[_0x17510c][_0xc569('0x24')](_0xc569('0x25'),'');if(compareVersions(module['exports'][_0xc569('0x3')],_0x3af554)===-0x1){_0x28e276[_0xc569('0x26')](_0x3af554);}}if(_0x28e276[_0xc569('0x23')]){var _0x4603e6=_0x28e276[_0xc569('0x27')](compareVersions);var _0x3477c=new Umzug({'storage':_0xc569('0x28'),'storageOptions':{'model':db[_0xc569('0x29')],'modelName':'Migration','columnName':_0xc569('0x3')},'migrations':{'params':[db[_0xc569('0x28')][_0xc569('0x2a')](),db[_0xc569('0x28')][_0xc569('0x2b')],function(){throw new Error(_0xc569('0x2c'));}],'path':path['join'](config['root'],_0xc569('0x22'),_0xc569('0x1f')),'pattern':/\.js$/}});_0x3477c['up']({'migrations':_[_0xc569('0x2d')](_0x4603e6,function(_0x38f440){return _0x38f440+_0xc569('0x25');})})[_0xc569('0x2e')](function(){return _0x1fd2a0['status'](0xc8)[_0xc569('0x19')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0xc569('0xc')]['version']+_0xc569('0x2f')+_[_0xc569('0x30')](_0x4603e6),'migrations':_[_0xc569('0x31')](_0x4603e6)});})[_0xc569('0x32')](function(_0x4f8ed4){if(_0x4f8ed4 instanceof db[_0xc569('0x28')][_0xc569('0x33')]){return _0x1fd2a0['status'](0xc8)[_0xc569('0x19')]({'output':_0xc569('0x34')});}else{return _0x1fd2a0[_0xc569('0x10')](0x1f4)[_0xc569('0x19')](_0x4f8ed4);}});}else{return _0x1fd2a0[_0xc569('0x10')](0xc8)[_0xc569('0x19')]({'output':_0xc569('0x34')});}}; \ No newline at end of file +var _0x3f96=['last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','exec','../../mysqldb','../../config/pm2','simple-git','index','latest','fetch','tags','exports','2.0.0','status','json','master','reset','--hard','FETCH_HEAD','info','git\x20reset\x20--hard\x20FETCH_HEAD','pull','npm\x20install\x20--production','error','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','root','length','push','sequelize','Migration','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','server','map','.js','then','Database\x20migrated\x20successfully\x20from\x20version\x20'];(function(_0x50148e,_0x4c99c7){var _0x446e9d=function(_0x42a9ed){while(--_0x42a9ed){_0x50148e['push'](_0x50148e['shift']());}};_0x446e9d(++_0x4c99c7);}(_0x3f96,0x1ed));var _0x63f9=function(_0x1a2020,_0x473e86){_0x1a2020=_0x1a2020-0x0;var _0x23c032=_0x3f96[_0x1a2020];return _0x23c032;};'use strict';var Umzug=require(_0x63f9('0x0'));var path=require(_0x63f9('0x1'));var fs=require('fs');var _=require(_0x63f9('0x2'));var pkginfo=require(_0x63f9('0x3'))(module,_0x63f9('0x4'));var compareVersions=require(_0x63f9('0x5'));var exec=require('child_process')[_0x63f9('0x6')];var db=require(_0x63f9('0x7'))['db'];var config=require('../../config/environment');var pm2=require(_0x63f9('0x8'));var logger=require('../../config/logger')('update');var git=require(_0x63f9('0x9'))(config['root']);exports[_0x63f9('0xa')]=function(_0x11778a,_0x465f6a){var _0x58e20a={'current':module['exports'][_0x63f9('0x4')],'phonebar':0x2};if(_0x11778a['query']&&_0x11778a['query'][_0x63f9('0xb')]){return git[_0x63f9('0xc')]()[_0x63f9('0xd')](function(_0x132c68,_0x5b847e){_0x58e20a[_0x63f9('0xb')]=(_0x132c68?module[_0x63f9('0xe')][_0x63f9('0x4')]:_0x5b847e['latest'])||_0x63f9('0xf');return _0x465f6a[_0x63f9('0x10')](0xc8)[_0x63f9('0x11')](_0x58e20a);});}else{return _0x465f6a[_0x63f9('0x10')](0xc8)['json'](_0x58e20a);}};exports[_0x63f9('0xc')]=function(_0x6251d0,_0x56d8b7){return git[_0x63f9('0xc')](['origin',_0x63f9('0x12')],function(_0x54d5fd){if(_0x54d5fd){logger['error'](_0x54d5fd);return _0x56d8b7[_0x63f9('0x10')](0x1f4)[_0x63f9('0x11')](_0x54d5fd);}logger['info']('git\x20fetch');return _0x56d8b7[_0x63f9('0x10')](0xc8)[_0x63f9('0x11')]({'output':'git\x20fetch\x20origin\x20master'});});};exports['reset']=function(_0x3c799e,_0x18a382){return git[_0x63f9('0x13')]([_0x63f9('0x14'),_0x63f9('0x15')],function(_0x20def5){if(_0x20def5){logger['error'](_0x20def5);return _0x18a382[_0x63f9('0x10')](0x1f4)[_0x63f9('0x11')](_0x20def5);}logger[_0x63f9('0x16')](_0x63f9('0x17'));return _0x18a382['status'](0xc8)[_0x63f9('0x11')]({'output':'git\x20reset\x20--hard'});});};exports[_0x63f9('0x18')]=function(_0x305e07,_0x3edc1a){exec(_0x63f9('0x19'),function(_0x22e732,_0x12f246,_0x2e1cb8){logger[_0x63f9('0x16')](_0x12f246);logger['info'](_0x2e1cb8);if(_0x22e732){logger[_0x63f9('0x1a')](_0x22e732);return _0x3edc1a['status'](0x1f4)[_0x63f9('0x11')](_0x22e732);}return _0x3edc1a[_0x63f9('0x10')](0xc8)[_0x63f9('0x11')]({'output':_0x12f246});});};exports['restart']=function(_0x235810,_0x20ae4b){return pm2[_0x63f9('0x1b')](_0x63f9('0x1c'))['then'](function(_0x7a9c04){logger[_0x63f9('0x16')](_0x63f9('0x1d'),_0x7a9c04);return _0x20ae4b['status'](0xc8)['json']({'output':_0x63f9('0x1e')});})[_0x63f9('0x1f')](function(_0xbf742){logger['error'](_0xbf742);return _0x20ae4b[_0x63f9('0x10')](0x1f4)[_0x63f9('0x11')](_0xbf742);});};exports[_0x63f9('0x20')]=function(_0x10999b,_0x298edf){var _0x338462=fs[_0x63f9('0x21')](path[_0x63f9('0x22')](config[_0x63f9('0x23')],'server',_0x63f9('0x20')));var _0x283250=[];for(var _0x5b30f7=0x0;_0x5b30f7<_0x338462[_0x63f9('0x24')];_0x5b30f7++){var _0x37db73=_0x338462[_0x5b30f7]['replace']('.js','');if(compareVersions(module['exports'][_0x63f9('0x4')],_0x37db73)===-0x1){_0x283250[_0x63f9('0x25')](_0x37db73);}}if(_0x283250[_0x63f9('0x24')]){var _0x588524=_0x283250['sort'](compareVersions);var _0x16ed8a=new Umzug({'storage':_0x63f9('0x26'),'storageOptions':{'model':db[_0x63f9('0x27')],'modelName':_0x63f9('0x27'),'columnName':'version'},'migrations':{'params':[db[_0x63f9('0x26')]['getQueryInterface'](),db[_0x63f9('0x26')]['constructor'],function(){throw new Error(_0x63f9('0x28'));}],'path':path[_0x63f9('0x22')](config[_0x63f9('0x23')],_0x63f9('0x29'),_0x63f9('0x20')),'pattern':/\.js$/}});_0x16ed8a['up']({'migrations':_[_0x63f9('0x2a')](_0x588524,function(_0x33a04e){return _0x33a04e+_0x63f9('0x2b');})})[_0x63f9('0x2c')](function(){return _0x298edf[_0x63f9('0x10')](0xc8)[_0x63f9('0x11')]({'output':_0x63f9('0x2d')+module[_0x63f9('0xe')][_0x63f9('0x4')]+'\x20to\x20'+_[_0x63f9('0x2e')](_0x588524),'migrations':_['join'](_0x588524)});})[_0x63f9('0x1f')](function(_0x437882){if(_0x437882 instanceof db['sequelize'][_0x63f9('0x2f')]){return _0x298edf[_0x63f9('0x10')](0xc8)['json']({'output':_0x63f9('0x30')});}else{return _0x298edf[_0x63f9('0x10')](0x1f4)[_0x63f9('0x11')](_0x437882);}});}else{return _0x298edf[_0x63f9('0x10')](0xc8)['json']({'output':_0x63f9('0x30')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index d3404e5..058e3b6 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 _0x1e94=['../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','get','index','/describe','describe','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1e94,0x64));var _0x41e9=function(_0x36dc04,_0x77c234){_0x36dc04=_0x36dc04-0x0;var _0x43d207=_0x1e94[_0x36dc04];return _0x43d207;};'use strict';var multer=require(_0x41e9('0x0'));var util=require('util');var path=require(_0x41e9('0x1'));var timeout=require(_0x41e9('0x2'));var express=require(_0x41e9('0x3'));var router=express[_0x41e9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x41e9('0x5'));var interaction=require(_0x41e9('0x6'));var config=require('../../config/environment');var controller=require(_0x41e9('0x7'));router[_0x41e9('0x8')]('/',auth['isAuthenticated'](),controller[_0x41e9('0x9')]);router[_0x41e9('0x8')](_0x41e9('0xa'),auth['isAuthenticated'](),controller[_0x41e9('0xb')]);router[_0x41e9('0x8')](_0x41e9('0xc'),auth[_0x41e9('0xd')](),controller[_0x41e9('0xe')]);router[_0x41e9('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x41e9('0x10')](_0x41e9('0xc'),auth['isAuthenticated'](),controller[_0x41e9('0x11')]);router[_0x41e9('0x12')](_0x41e9('0xc'),auth[_0x41e9('0xd')](),controller[_0x41e9('0x13')]);module[_0x41e9('0x14')]=router; \ No newline at end of file +var _0xa948=['/describe','isAuthenticated','show','create','put','update','delete','/:id','exports','multer','fs-extra','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','index'];(function(_0x2a58f4,_0x13885b){var _0x58ef72=function(_0x44cf8f){while(--_0x44cf8f){_0x2a58f4['push'](_0x2a58f4['shift']());}};_0x58ef72(++_0x13885b);}(_0xa948,0x119));var _0x8a94=function(_0x2bf1fb,_0x10022d){_0x2bf1fb=_0x2bf1fb-0x0;var _0x5e7e68=_0xa948[_0x2bf1fb];return _0x5e7e68;};'use strict';var multer=require(_0x8a94('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x8a94('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0x8a94('0x2'));var config=require(_0x8a94('0x3'));var controller=require(_0x8a94('0x4'));router[_0x8a94('0x5')]('/',auth['isAuthenticated'](),controller[_0x8a94('0x6')]);router[_0x8a94('0x5')](_0x8a94('0x7'),auth[_0x8a94('0x8')](),controller['describe']);router[_0x8a94('0x5')]('/:id',auth[_0x8a94('0x8')](),controller[_0x8a94('0x9')]);router['post']('/',auth[_0x8a94('0x8')](),controller[_0x8a94('0xa')]);router[_0x8a94('0xb')]('/:id',auth[_0x8a94('0x8')](),controller[_0x8a94('0xc')]);router[_0x8a94('0xd')](_0x8a94('0xe'),auth[_0x8a94('0x8')](),controller['destroy']);module[_0x8a94('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index a495ac7..7e436db 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 _0xfef3=['DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING'];(function(_0x356121,_0x9c3f35){var _0x5d5117=function(_0x6b4349){while(--_0x6b4349){_0x356121['push'](_0x356121['shift']());}};_0x5d5117(++_0x9c3f35);}(_0xfef3,0x118));var _0x3fef=function(_0x3d87c9,_0x19cedd){_0x3d87c9=_0x3d87c9-0x0;var _0x43d3f0=_0xfef3[_0x3d87c9];return _0x43d3f0;};'use strict';var Sequelize=require(_0x3fef('0x0'));module['exports']={'type':{'type':Sequelize[_0x3fef('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x3fef('0x1')]},'calleridname':{'type':Sequelize[_0x3fef('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x3fef('0x1')]},'membername':{'type':Sequelize[_0x3fef('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x3fef('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x3fef('0x2')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x3fef('0x2')]},'holdtime':{'type':Sequelize[_0x3fef('0x3')]},'agentcomplete':{'type':Sequelize[_0x3fef('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x3fef('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x3fef('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x3fef('0x3')]},'agentacw':{'type':Sequelize[_0x3fef('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x3fef('0x3')]},'reason':{'type':Sequelize[_0x3fef('0x1')]},'lastevent':{'type':Sequelize[_0x3fef('0x1')]},'channel':{'type':Sequelize[_0x3fef('0x1')]},'channelstate':{'type':Sequelize[_0x3fef('0x3')]},'channelstatedesc':{'type':Sequelize[_0x3fef('0x1')]},'connectedlinenum':{'type':Sequelize[_0x3fef('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x3fef('0x1')]},'accountcode':{'type':Sequelize[_0x3fef('0x1')]},'context':{'type':Sequelize[_0x3fef('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x3fef('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x3fef('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x3fef('0x1')]},'destcalleridnum':{'type':Sequelize[_0x3fef('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x3fef('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x3fef('0x1')]},'destaccountcode':{'type':Sequelize[_0x3fef('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x3fef('0x1')]},'destpriority':{'type':Sequelize[_0x3fef('0x1')]},'destuniqueid':{'type':Sequelize[_0x3fef('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x3fef('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x3fef('0x1')]},'transfer':{'type':Sequelize[_0x3fef('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x3fef('0x5')},'transferexten':{'type':Sequelize[_0x3fef('0x1')]},'transferuniqueid':{'type':Sequelize[_0x3fef('0x1')]},'agententerreason':{'type':Sequelize[_0x3fef('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x69d3=['INTEGER','BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x2c563a,_0x18b498){var _0x5c5e96=function(_0x31abfe){while(--_0x31abfe){_0x2c563a['push'](_0x2c563a['shift']());}};_0x5c5e96(++_0x18b498);}(_0x69d3,0xda));var _0x369d=function(_0x3755b5,_0x1eae78){_0x3755b5=_0x3755b5-0x0;var _0x2906b4=_0x69d3[_0x3755b5];return _0x2906b4;};'use strict';var Sequelize=require(_0x369d('0x0'));module[_0x369d('0x1')]={'type':{'type':Sequelize[_0x369d('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x369d('0x2')]},'calleridname':{'type':Sequelize[_0x369d('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x369d('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x369d('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x369d('0x3')]},'agentdumpAt':{'type':Sequelize[_0x369d('0x3')]},'holdtime':{'type':Sequelize[_0x369d('0x4')]},'agentcomplete':{'type':Sequelize[_0x369d('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x369d('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x369d('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x369d('0x4')]},'agentacw':{'type':Sequelize[_0x369d('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x369d('0x2')]},'channel':{'type':Sequelize[_0x369d('0x2')]},'channelstate':{'type':Sequelize[_0x369d('0x4')]},'channelstatedesc':{'type':Sequelize[_0x369d('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x369d('0x2')]},'accountcode':{'type':Sequelize[_0x369d('0x2')]},'context':{'type':Sequelize[_0x369d('0x2')]},'exten':{'type':Sequelize[_0x369d('0x2')]},'priority':{'type':Sequelize[_0x369d('0x2')]},'destchannel':{'type':Sequelize[_0x369d('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x369d('0x2')]},'destcalleridnum':{'type':Sequelize[_0x369d('0x2')]},'destcalleridname':{'type':Sequelize[_0x369d('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x369d('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x369d('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x369d('0x2')]},'destpriority':{'type':Sequelize[_0x369d('0x2')]},'destuniqueid':{'type':Sequelize[_0x369d('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x369d('0x2')]},'transfer':{'type':Sequelize[_0x369d('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x369d('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x369d('0x2')]},'transferuniqueid':{'type':Sequelize[_0x369d('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'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 e87de4f..841489f 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(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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 8085ecc..07963cd 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 _0x6bdc=['define','VoiceAgentReport','report_agent','destuniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x476a7e,_0x1c2720){var _0x1be744=function(_0x3b5485){while(--_0x3b5485){_0x476a7e['push'](_0x476a7e['shift']());}};_0x1be744(++_0x1c2720);}(_0x6bdc,0x14e));var _0xc6bd=function(_0x359cd8,_0x16a552){_0x359cd8=_0x359cd8-0x0;var _0x342065=_0x6bdc[_0x359cd8];return _0x342065;};'use strict';var _=require(_0xc6bd('0x0'));var util=require(_0xc6bd('0x1'));var logger=require(_0xc6bd('0x2'))(_0xc6bd('0x3'));var moment=require(_0xc6bd('0x4'));var BPromise=require(_0xc6bd('0x5'));var rp=require(_0xc6bd('0x6'));var fs=require('fs');var path=require(_0xc6bd('0x7'));var rimraf=require(_0xc6bd('0x8'));var config=require(_0xc6bd('0x9'));var attributes=require('./voiceAgentReport.attributes');module[_0xc6bd('0xa')]=function(_0x26218a,_0x158271){return _0x26218a[_0xc6bd('0xb')](_0xc6bd('0xc'),attributes,{'tableName':_0xc6bd('0xd'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0xc6bd('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb99=['../../config/environment','./voiceAgentReport.attributes','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','../../config/logger','bluebird','request-promise','path'];(function(_0x40609d,_0x1cf5f8){var _0x198a5e=function(_0x2b683a){while(--_0x2b683a){_0x40609d['push'](_0x40609d['shift']());}};_0x198a5e(++_0x1cf5f8);}(_0xcb99,0x8b));var _0x9cb9=function(_0x1f175e,_0x25487c){_0x1f175e=_0x1f175e-0x0;var _0x4ab74c=_0xcb99[_0x1f175e];return _0x4ab74c;};'use strict';var _=require(_0x9cb9('0x0'));var util=require('util');var logger=require(_0x9cb9('0x1'))('api');var moment=require('moment');var BPromise=require(_0x9cb9('0x2'));var rp=require(_0x9cb9('0x3'));var fs=require('fs');var path=require(_0x9cb9('0x4'));var rimraf=require('rimraf');var config=require(_0x9cb9('0x5'));var attributes=require(_0x9cb9('0x6'));module['exports']=function(_0x214b72,_0x509cfc){return _0x214b72[_0x9cb9('0x7')](_0x9cb9('0x8'),attributes,{'tableName':_0x9cb9('0x9'),'paranoid':![],'indexes':[{'fields':[_0x9cb9('0xa'),_0x9cb9('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 3376a71..9e1e93a 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 _0x4cdd=['result','CreateVoiceAgentReport','VoiceAgentReport','body','options','catch','UpdateVoiceAgentReport','update','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x9d8112,_0x4ae0c5){var _0x19269c=function(_0x4d1874){while(--_0x4d1874){_0x9d8112['push'](_0x9d8112['shift']());}};_0x19269c(++_0x4ae0c5);}(_0x4cdd,0x94));var _0xd4cd=function(_0x55cd89,_0x576ff8){_0x55cd89=_0x55cd89-0x0;var _0x4eef01=_0x4cdd[_0x55cd89];return _0x4eef01;};'use strict';var _=require(_0xd4cd('0x0'));var util=require(_0xd4cd('0x1'));var moment=require(_0xd4cd('0x2'));var BPromise=require(_0xd4cd('0x3'));var rs=require(_0xd4cd('0x4'));var fs=require('fs');var Redis=require(_0xd4cd('0x5'));var db=require(_0xd4cd('0x6'))['db'];var utils=require(_0xd4cd('0x7'));var logger=require(_0xd4cd('0x8'))(_0xd4cd('0x9'));var config=require(_0xd4cd('0xa'));var jayson=require(_0xd4cd('0xb'));var client=jayson['client'][_0xd4cd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x477d4a,_0x39f2e1,_0x45030a){return new BPromise(function(_0x583a3f,_0x55ab48){return client[_0xd4cd('0xd')](_0x477d4a,_0x45030a)[_0xd4cd('0xe')](function(_0x335bd6){logger[_0xd4cd('0xf')](_0xd4cd('0x10'),_0x39f2e1,_0xd4cd('0x11'));logger['debug'](_0xd4cd('0x12'),_0x39f2e1,'request\x20sent',JSON[_0xd4cd('0x13')](_0x335bd6));if(_0x335bd6['error']){if(_0x335bd6['error']['code']===0x1f4){logger[_0xd4cd('0x14')](_0xd4cd('0x10'),_0x39f2e1,_0x335bd6[_0xd4cd('0x14')][_0xd4cd('0x15')]);return _0x55ab48(_0x335bd6['error'][_0xd4cd('0x15')]);}logger['error'](_0xd4cd('0x10'),_0x39f2e1,_0x335bd6['error'][_0xd4cd('0x15')]);return _0x583a3f(_0x335bd6[_0xd4cd('0x14')][_0xd4cd('0x15')]);}else{logger['info'](_0xd4cd('0x10'),_0x39f2e1,_0xd4cd('0x11'));_0x583a3f(_0x335bd6[_0xd4cd('0x16')][_0xd4cd('0x15')]);}})['catch'](function(_0x2a6b59){logger[_0xd4cd('0x14')](_0xd4cd('0x10'),_0x39f2e1,_0x2a6b59);_0x55ab48(_0x2a6b59);});});}exports[_0xd4cd('0x17')]=function(_0x3dbd5b){var _0x22137f=this;return new Promise(function(_0x39e126,_0x43d2cf){return db[_0xd4cd('0x18')]['create'](_0x3dbd5b[_0xd4cd('0x19')],{'raw':_0x3dbd5b[_0xd4cd('0x1a')]?_0x3dbd5b[_0xd4cd('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3aed7f){logger[_0xd4cd('0xf')](_0xd4cd('0x17'),_0x3dbd5b);logger['debug'](_0xd4cd('0x17'),_0x3dbd5b,JSON[_0xd4cd('0x13')](_0x3aed7f));_0x39e126(_0x3aed7f);})[_0xd4cd('0x1b')](function(_0x215b50){logger['error'](_0xd4cd('0x17'),_0x215b50[_0xd4cd('0x15')],_0x3dbd5b);_0x43d2cf(_0x22137f['error'](0x1f4,_0x215b50['message']));});});};exports[_0xd4cd('0x1c')]=function(_0x5e615e){var _0x5ee8f1=this;return new Promise(function(_0x23c3a8,_0x3654a4){return db[_0xd4cd('0x18')][_0xd4cd('0x1d')](_0x5e615e['body'],{'raw':_0x5e615e[_0xd4cd('0x1a')]?_0x5e615e[_0xd4cd('0x1a')][_0xd4cd('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e615e[_0xd4cd('0x1a')]?_0x5e615e['options'][_0xd4cd('0x1f')]||null:null,'attributes':_0x5e615e[_0xd4cd('0x1a')]?_0x5e615e[_0xd4cd('0x1a')][_0xd4cd('0x20')]||null:null,'limit':_0x5e615e[_0xd4cd('0x1a')]?_0x5e615e[_0xd4cd('0x1a')][_0xd4cd('0x21')]||null:null})[_0xd4cd('0xe')](function(_0x4ca2c6){logger['info'](_0xd4cd('0x1c'),_0x5e615e);logger['debug'](_0xd4cd('0x1c'),_0x5e615e,JSON[_0xd4cd('0x13')](_0x4ca2c6));_0x23c3a8(_0x4ca2c6);})['catch'](function(_0xb9e186){logger[_0xd4cd('0x14')](_0xd4cd('0x1c'),_0xb9e186[_0xd4cd('0x15')],_0x5e615e);_0x3654a4(_0x5ee8f1[_0xd4cd('0x14')](0x1f4,_0xb9e186['message']));});});}; \ No newline at end of file +var _0x84b1=['randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','request','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','then','UpdateVoiceAgentReport','update','where','attributes','limit','moment','bluebird'];(function(_0x5d0218,_0x51ccc6){var _0x5a1644=function(_0x4bb38e){while(--_0x4bb38e){_0x5d0218['push'](_0x5d0218['shift']());}};_0x5a1644(++_0x51ccc6);}(_0x84b1,0x17e));var _0x184b=function(_0x472094,_0x55487d){_0x472094=_0x472094-0x0;var _0x42870e=_0x84b1[_0x472094];return _0x42870e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x184b('0x0'));var BPromise=require(_0x184b('0x1'));var rs=require(_0x184b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x184b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x184b('0x4'))('rpc');var config=require(_0x184b('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x184b('0x6')][_0x184b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1410af,_0x48ba62,_0x3cb385){return new BPromise(function(_0x19adf0,_0x524f95){return client[_0x184b('0x8')](_0x1410af,_0x3cb385)['then'](function(_0x1c1d22){logger[_0x184b('0x9')](_0x184b('0xa'),_0x48ba62,_0x184b('0xb'));logger[_0x184b('0xc')](_0x184b('0xd'),_0x48ba62,_0x184b('0xb'),JSON[_0x184b('0xe')](_0x1c1d22));if(_0x1c1d22[_0x184b('0xf')]){if(_0x1c1d22[_0x184b('0xf')][_0x184b('0x10')]===0x1f4){logger[_0x184b('0xf')](_0x184b('0xa'),_0x48ba62,_0x1c1d22['error']['message']);return _0x524f95(_0x1c1d22[_0x184b('0xf')][_0x184b('0x11')]);}logger[_0x184b('0xf')](_0x184b('0xa'),_0x48ba62,_0x1c1d22[_0x184b('0xf')][_0x184b('0x11')]);return _0x19adf0(_0x1c1d22[_0x184b('0xf')][_0x184b('0x11')]);}else{logger['info'](_0x184b('0xa'),_0x48ba62,_0x184b('0xb'));_0x19adf0(_0x1c1d22[_0x184b('0x12')]['message']);}})[_0x184b('0x13')](function(_0x55f10a){logger['error'](_0x184b('0xa'),_0x48ba62,_0x55f10a);_0x524f95(_0x55f10a);});});}exports[_0x184b('0x14')]=function(_0x155f8e){var _0xa32a0e=this;return new Promise(function(_0xf98467,_0x5a90b9){return db[_0x184b('0x15')][_0x184b('0x16')](_0x155f8e[_0x184b('0x17')],{'raw':_0x155f8e[_0x184b('0x18')]?_0x155f8e[_0x184b('0x18')][_0x184b('0x19')]===undefined?!![]:![]:!![]})[_0x184b('0x1a')](function(_0x107e7a){logger[_0x184b('0x9')](_0x184b('0x14'),_0x155f8e);logger[_0x184b('0xc')](_0x184b('0x14'),_0x155f8e,JSON[_0x184b('0xe')](_0x107e7a));_0xf98467(_0x107e7a);})[_0x184b('0x13')](function(_0xeb70f2){logger[_0x184b('0xf')](_0x184b('0x14'),_0xeb70f2[_0x184b('0x11')],_0x155f8e);_0x5a90b9(_0xa32a0e[_0x184b('0xf')](0x1f4,_0xeb70f2[_0x184b('0x11')]));});});};exports[_0x184b('0x1b')]=function(_0x7fd930){var _0x399b0b=this;return new Promise(function(_0x5c7120,_0x22f457){return db[_0x184b('0x15')][_0x184b('0x1c')](_0x7fd930[_0x184b('0x17')],{'raw':_0x7fd930[_0x184b('0x18')]?_0x7fd930[_0x184b('0x18')][_0x184b('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7fd930['options']?_0x7fd930[_0x184b('0x18')][_0x184b('0x1d')]||null:null,'attributes':_0x7fd930['options']?_0x7fd930[_0x184b('0x18')][_0x184b('0x1e')]||null:null,'limit':_0x7fd930[_0x184b('0x18')]?_0x7fd930['options'][_0x184b('0x1f')]||null:null})[_0x184b('0x1a')](function(_0x45d256){logger[_0x184b('0x9')](_0x184b('0x1b'),_0x7fd930);logger[_0x184b('0xc')](_0x184b('0x1b'),_0x7fd930,JSON[_0x184b('0xe')](_0x45d256));_0x5c7120(_0x45d256);})[_0x184b('0x13')](function(_0x59e742){logger[_0x184b('0xf')](_0x184b('0x1b'),_0x59e742[_0x184b('0x11')],_0x7fd930);_0x22f457(_0x399b0b[_0x184b('0xf')](0x1f4,_0x59e742[_0x184b('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 8b06f72..0245a1f 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 _0xdb94=['/describe','/:id','show','post','create','put','update','delete','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','isAuthenticated','index','get'];(function(_0x3e0feb,_0x30e912){var _0x7e64b1=function(_0x35162c){while(--_0x35162c){_0x3e0feb['push'](_0x3e0feb['shift']());}};_0x7e64b1(++_0x30e912);}(_0xdb94,0xe5));var _0x4db9=function(_0x3430d0,_0x4d9156){_0x3430d0=_0x3430d0-0x0;var _0x39a41e=_0xdb94[_0x3430d0];return _0x39a41e;};'use strict';var multer=require('multer');var util=require(_0x4db9('0x0'));var path=require(_0x4db9('0x1'));var timeout=require('connect-timeout');var express=require(_0x4db9('0x2'));var router=express[_0x4db9('0x3')]();var fs_extra=require(_0x4db9('0x4'));var auth=require(_0x4db9('0x5'));var interaction=require(_0x4db9('0x6'));var config=require('../../config/environment');var controller=require(_0x4db9('0x7'));router['get']('/',auth[_0x4db9('0x8')](),controller[_0x4db9('0x9')]);router[_0x4db9('0xa')](_0x4db9('0xb'),auth[_0x4db9('0x8')](),controller['describe']);router[_0x4db9('0xa')](_0x4db9('0xc'),auth[_0x4db9('0x8')](),controller[_0x4db9('0xd')]);router[_0x4db9('0xe')]('/',auth['isAuthenticated'](),controller[_0x4db9('0xf')]);router[_0x4db9('0x10')](_0x4db9('0xc'),auth[_0x4db9('0x8')](),controller[_0x4db9('0x11')]);router[_0x4db9('0x12')]('/:id',auth[_0x4db9('0x8')](),controller[_0x4db9('0x13')]);module['exports']=router; \ No newline at end of file +var _0x0fda=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','multer','path','connect-timeout','express'];(function(_0x3a1e3b,_0x574f07){var _0x3975f7=function(_0x1dcd1a){while(--_0x1dcd1a){_0x3a1e3b['push'](_0x3a1e3b['shift']());}};_0x3975f7(++_0x574f07);}(_0x0fda,0x1a0));var _0xa0fd=function(_0x1380ce,_0x20ba11){_0x1380ce=_0x1380ce-0x0;var _0x2efe7c=_0x0fda[_0x1380ce];return _0x2efe7c;};'use strict';var multer=require(_0xa0fd('0x0'));var util=require('util');var path=require(_0xa0fd('0x1'));var timeout=require(_0xa0fd('0x2'));var express=require(_0xa0fd('0x3'));var router=express[_0xa0fd('0x4')]();var fs_extra=require(_0xa0fd('0x5'));var auth=require(_0xa0fd('0x6'));var interaction=require(_0xa0fd('0x7'));var config=require('../../config/environment');var controller=require('./voiceCallReport.controller');router[_0xa0fd('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa0fd('0x8')](_0xa0fd('0x9'),auth[_0xa0fd('0xa')](),controller[_0xa0fd('0xb')]);router['get'](_0xa0fd('0xc'),auth[_0xa0fd('0xa')](),controller[_0xa0fd('0xd')]);router[_0xa0fd('0xe')]('/',auth['isAuthenticated'](),controller[_0xa0fd('0xf')]);router[_0xa0fd('0x10')](_0xa0fd('0xc'),auth['isAuthenticated'](),controller[_0xa0fd('0x11')]);router[_0xa0fd('0x12')](_0xa0fd('0xc'),auth[_0xa0fd('0xa')](),controller[_0xa0fd('0x13')]);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 1b64123..9be4456 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 _0x23db=['DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound','internal','outbound-fax','dialer','TEXT'];(function(_0x2dbebb,_0x20ee63){var _0x55bc32=function(_0x3e852b){while(--_0x3e852b){_0x2dbebb['push'](_0x2dbebb['shift']());}};_0x55bc32(++_0x20ee63);}(_0x23db,0x141));var _0xb23d=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x23db[_0x40ac5e];return _0x2839d6;};'use strict';var Sequelize=require(_0xb23d('0x0'));module[_0xb23d('0x1')]={'uniqueid':{'type':Sequelize[_0xb23d('0x2')]},'type':{'type':Sequelize[_0xb23d('0x3')](_0xb23d('0x4'),_0xb23d('0x5'),'outbound','inbound-fax',_0xb23d('0x6'),_0xb23d('0x7'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xb23d('0x2')]},'source':{'type':Sequelize[_0xb23d('0x2')]},'destination':{'type':Sequelize[_0xb23d('0x2')]},'destinationcontext':{'type':Sequelize[_0xb23d('0x2')]},'callerid':{'type':Sequelize[_0xb23d('0x2')]},'channel':{'type':Sequelize[_0xb23d('0x2')]},'destinationchannel':{'type':Sequelize[_0xb23d('0x2')]},'lastapplication':{'type':Sequelize[_0xb23d('0x2')]},'lastdata':{'type':Sequelize[_0xb23d('0x8')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0xb23d('0x9')]},'answertime':{'type':Sequelize[_0xb23d('0x9')]},'endtime':{'type':Sequelize[_0xb23d('0x9')]},'duration':{'type':Sequelize[_0xb23d('0xa')]},'billableseconds':{'type':Sequelize[_0xb23d('0xa')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xb23d('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0xb23d('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xb23d('0x2')]},'note':{'type':Sequelize[_0xb23d('0x2')]},'prefix':{'type':Sequelize[_0xb23d('0x2')]},'routeid':{'type':Sequelize[_0xb23d('0xa')]},'sipcallid':{'type':Sequelize[_0xb23d('0x2')]}}; \ No newline at end of file +var _0xcc97=['outbound','inbound-fax','outbound-fax','dialer','STRING','TEXT','DATE','INTEGER','sequelize','exports','ENUM','inbound','internal'];(function(_0x2a69c9,_0x17286d){var _0x5c149f=function(_0x117dd7){while(--_0x117dd7){_0x2a69c9['push'](_0x2a69c9['shift']());}};_0x5c149f(++_0x17286d);}(_0xcc97,0x1a8));var _0x7cc9=function(_0x200ccd,_0x15110e){_0x200ccd=_0x200ccd-0x0;var _0x132d1f=_0xcc97[_0x200ccd];return _0x132d1f;};'use strict';var Sequelize=require(_0x7cc9('0x0'));module[_0x7cc9('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x7cc9('0x2')](_0x7cc9('0x3'),_0x7cc9('0x4'),_0x7cc9('0x5'),_0x7cc9('0x6'),_0x7cc9('0x7'),_0x7cc9('0x8'))},'tag':{'type':Sequelize[_0x7cc9('0x9')]},'accountcode':{'type':Sequelize[_0x7cc9('0x9')]},'source':{'type':Sequelize[_0x7cc9('0x9')]},'destination':{'type':Sequelize[_0x7cc9('0x9')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x7cc9('0x9')]},'channel':{'type':Sequelize[_0x7cc9('0x9')]},'destinationchannel':{'type':Sequelize[_0x7cc9('0x9')]},'lastapplication':{'type':Sequelize[_0x7cc9('0x9')]},'lastdata':{'type':Sequelize[_0x7cc9('0xa')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x7cc9('0xb')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x7cc9('0xb')]},'duration':{'type':Sequelize[_0x7cc9('0xc')]},'billableseconds':{'type':Sequelize[_0x7cc9('0xc')]},'mohtime':{'type':Sequelize[_0x7cc9('0xc')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x7cc9('0x9')]},'amaflags':{'type':Sequelize[_0x7cc9('0x9')]},'userfield':{'type':Sequelize[_0x7cc9('0x9')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x7cc9('0x9')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x7cc9('0x9')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x7cc9('0x9')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 35998ff..6e7e5cc 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 _0x0b0e=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','VoiceCallReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','fullname','alias','User','findAll','rows','params','find','create','body','catch','describe','update','uniqueid','user','eml-format','zip-dir','request-promise','moment'];(function(_0x34b9c5,_0x42700f){var _0x10b193=function(_0x14df10){while(--_0x14df10){_0x34b9c5['push'](_0x34b9c5['shift']());}};_0x10b193(++_0x42700f);}(_0x0b0e,0x187));var _0xe0b0=function(_0xdb0cc5,_0x33653a){_0xdb0cc5=_0xdb0cc5-0x0;var _0x153aa=_0x0b0e[_0xdb0cc5];return _0x153aa;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['VoiceCallReport'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'attributes':['id',_0xe0b0('0x27'),_0xe0b0('0x41'),_0xe0b0('0x42')],'model':db[_0xe0b0('0x43')],'as':_0xe0b0('0x43')}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x44')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x52ffe4){_0x36d137[_0xe0b0('0x45')]=_0x52ffe4;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))['catch'](handleError(_0x5b7a64,null));};exports['show']=function(_0x327fb4,_0x247f8d){var _0x56e7df={'raw':!![],'where':{'id':_0x327fb4[_0xe0b0('0x46')]['id']}},_0x18a59d={};_0x18a59d[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db[_0xe0b0('0x2a')]['rawAttributes']);_0x18a59d['query']=_['keys'](_0x327fb4[_0xe0b0('0x2e')]);_0x18a59d[_0xe0b0('0x39')]=_['intersection'](_0x18a59d[_0xe0b0('0x31')],_0x18a59d[_0xe0b0('0x2e')]);_0x56e7df[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x18a59d[_0xe0b0('0x31')],qs['fields'](_0x327fb4['query'][_0xe0b0('0x33')]));_0x56e7df[_0xe0b0('0x32')]=_0x56e7df[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x56e7df[_0xe0b0('0x32')]:_0x18a59d['model'];if(_0x327fb4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x56e7df['include']=[{'all':!![]}];}_0x56e7df=_['merge']({},_0x56e7df,_0x327fb4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x47')](_0x56e7df)[_0xe0b0('0x23')](handleEntityNotFound(_0x247f8d,null))[_0xe0b0('0x23')](respondWithResult(_0x247f8d,null))['catch'](handleError(_0x247f8d,null));};exports[_0xe0b0('0x48')]=function(_0x87d8f3,_0x483f12){return db['VoiceCallReport'][_0xe0b0('0x48')](_0x87d8f3[_0xe0b0('0x49')],{})['then'](respondWithResult(_0x483f12,0xc9))[_0xe0b0('0x4a')](handleError(_0x483f12,null));};exports[_0xe0b0('0x24')]=function(_0x504284,_0x5cb2b6){return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x504284[_0xe0b0('0x46')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x5cb2b6,null))[_0xe0b0('0x23')](removeEntity(_0x5cb2b6,null))[_0xe0b0('0x4a')](handleError(_0x5cb2b6,null));};exports[_0xe0b0('0x4b')]=function(_0xf9e694,_0x5f5486){return db['VoiceCallReport'][_0xe0b0('0x4b')]()['then'](respondWithResult(_0x5f5486,null))['catch'](handleError(_0x5f5486,null));};exports[_0xe0b0('0x4c')]=function(_0x222174,_0x54cf7b){if(_0x222174['body'][_0xe0b0('0x4d')]){delete _0x222174[_0xe0b0('0x49')][_0xe0b0('0x4d')];}return db[_0xe0b0('0x2a')][_0xe0b0('0x47')]({'where':{'uniqueid':_0x222174[_0xe0b0('0x46')]['id'],'UserId':{'$or':[null,_0x222174[_0xe0b0('0x4e')]['id']]}}})['then'](handleEntityNotFound(_0x54cf7b,null))[_0xe0b0('0x23')](saveUpdates(_0x222174['body'],null))[_0xe0b0('0x23')](respondWithResult(_0x54cf7b,null))['catch'](handleError(_0x54cf7b,null));}; \ No newline at end of file +var _0x5f2f=['stack','name','send','index','VoiceCallReport','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','fullname','alias','User','findAll','catch','params','keys','find','create','body','destroy','describe','update','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x5f2f,0x73));var _0xf5f2=function(_0x11bda4,_0x608de6){_0x11bda4=_0x11bda4-0x0;var _0x42110e=_0x5f2f[_0x11bda4];return _0x42110e;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'attributes':['id',_0xf5f2('0x26'),_0xf5f2('0x3e'),_0xf5f2('0x3f')],'model':db['User'],'as':_0xf5f2('0x40')}];}return db[_0xf5f2('0x29')][_0xf5f2('0x41')](_0x22c826);})['then'](function(_0x509dbc){_0x11c771['rows']=_0x509dbc;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x42')](handleError(_0x53cb96,null));};exports['show']=function(_0x106272,_0xeed03d){var _0x28e33f={'raw':!![],'where':{'id':_0x106272[_0xf5f2('0x43')]['id']}},_0x31f86c={};_0x31f86c[_0xf5f2('0x31')]=_[_0xf5f2('0x44')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x31f86c[_0xf5f2('0x2e')]=_[_0xf5f2('0x44')](_0x106272[_0xf5f2('0x2e')]);_0x31f86c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x31f86c['model'],_0x31f86c[_0xf5f2('0x2e')]);_0x28e33f['attributes']=_[_0xf5f2('0x30')](_0x31f86c[_0xf5f2('0x31')],qs[_0xf5f2('0x33')](_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x28e33f[_0xf5f2('0x32')]=_0x28e33f['attributes'][_0xf5f2('0x34')]?_0x28e33f[_0xf5f2('0x32')]:_0x31f86c[_0xf5f2('0x31')];if(_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x28e33f[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x28e33f=_[_0xf5f2('0x39')]({},_0x28e33f,_0x106272[_0xf5f2('0x3b')]);return db['VoiceCallReport'][_0xf5f2('0x45')](_0x28e33f)[_0xf5f2('0x24')](handleEntityNotFound(_0xeed03d,null))[_0xf5f2('0x24')](respondWithResult(_0xeed03d,null))['catch'](handleError(_0xeed03d,null));};exports[_0xf5f2('0x46')]=function(_0xc91b64,_0x3179a9){return db['VoiceCallReport']['create'](_0xc91b64[_0xf5f2('0x47')],{})[_0xf5f2('0x24')](respondWithResult(_0x3179a9,0xc9))['catch'](handleError(_0x3179a9,null));};exports[_0xf5f2('0x48')]=function(_0x533cca,_0x740321){return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'id':_0x533cca['params']['id']}})[_0xf5f2('0x24')](handleEntityNotFound(_0x740321,null))[_0xf5f2('0x24')](removeEntity(_0x740321,null))[_0xf5f2('0x42')](handleError(_0x740321,null));};exports[_0xf5f2('0x49')]=function(_0x4fa738,_0x3154c1){return db[_0xf5f2('0x29')]['describe']()['then'](respondWithResult(_0x3154c1,null))[_0xf5f2('0x42')](handleError(_0x3154c1,null));};exports[_0xf5f2('0x4a')]=function(_0x57782c,_0x22b645){if(_0x57782c[_0xf5f2('0x47')][_0xf5f2('0x4b')]){delete _0x57782c[_0xf5f2('0x47')]['uniqueid'];}return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'uniqueid':_0x57782c[_0xf5f2('0x43')]['id'],'UserId':{'$or':[null,_0x57782c['user']['id']]}}})[_0xf5f2('0x24')](handleEntityNotFound(_0x22b645,null))[_0xf5f2('0x24')](saveUpdates(_0x57782c[_0xf5f2('0x47')],null))[_0xf5f2('0x24')](respondWithResult(_0x22b645,null))[_0xf5f2('0x42')](handleError(_0x22b645,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index b0f13eb..abc038b 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 _0x3e27=['VoiceCallReport','report_call','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./voiceCallReport.attributes','exports','define'];(function(_0x29bd36,_0x328301){var _0x379186=function(_0x531f59){while(--_0x531f59){_0x29bd36['push'](_0x29bd36['shift']());}};_0x379186(++_0x328301);}(_0x3e27,0xed));var _0x73e2=function(_0x2fdc6a,_0x537ea1){_0x2fdc6a=_0x2fdc6a-0x0;var _0xa806a6=_0x3e27[_0x2fdc6a];return _0xa806a6;};'use strict';var _=require('lodash');var util=require(_0x73e2('0x0'));var logger=require(_0x73e2('0x1'))(_0x73e2('0x2'));var moment=require(_0x73e2('0x3'));var BPromise=require(_0x73e2('0x4'));var rp=require(_0x73e2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x73e2('0x6'));var config=require('../../config/environment');var attributes=require(_0x73e2('0x7'));module[_0x73e2('0x8')]=function(_0x44cac3,_0x239b7c){return _0x44cac3[_0x73e2('0x9')](_0x73e2('0xa'),attributes,{'tableName':_0x73e2('0xb'),'paranoid':![],'indexes':[{'fields':[_0x73e2('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbcc2=['bluebird','request-promise','path','rimraf','../../config/environment','exports','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x3c73d0,_0x4457cb){var _0x69ca55=function(_0x46abeb){while(--_0x46abeb){_0x3c73d0['push'](_0x3c73d0['shift']());}};_0x69ca55(++_0x4457cb);}(_0xbcc2,0xcd));var _0x2bcc=function(_0x3a4038,_0x420ae5){_0x3a4038=_0x3a4038-0x0;var _0x119c34=_0xbcc2[_0x3a4038];return _0x119c34;};'use strict';var _=require(_0x2bcc('0x0'));var util=require(_0x2bcc('0x1'));var logger=require(_0x2bcc('0x2'))(_0x2bcc('0x3'));var moment=require(_0x2bcc('0x4'));var BPromise=require(_0x2bcc('0x5'));var rp=require(_0x2bcc('0x6'));var fs=require('fs');var path=require(_0x2bcc('0x7'));var rimraf=require(_0x2bcc('0x8'));var config=require(_0x2bcc('0x9'));var attributes=require('./voiceCallReport.attributes');module[_0x2bcc('0xa')]=function(_0x4a80ec,_0x66fe2a){return _0x4a80ec['define'](_0x2bcc('0xb'),attributes,{'tableName':_0x2bcc('0xc'),'paranoid':![],'indexes':[{'fields':[_0x2bcc('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 7e61241..edbc0c9 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 _0x0a5f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','limit','include','model','attributes','map','stringify','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','where'];(function(_0xfe3bc5,_0x2c8bad){var _0x46686a=function(_0x36338f){while(--_0x36338f){_0xfe3bc5['push'](_0xfe3bc5['shift']());}};_0x46686a(++_0x2c8bad);}(_0x0a5f,0x11f));var _0xf0a5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0a5f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xf0a5('0x0'));var util=require(_0xf0a5('0x1'));var moment=require(_0xf0a5('0x2'));var BPromise=require(_0xf0a5('0x3'));var rs=require(_0xf0a5('0x4'));var fs=require('fs');var Redis=require(_0xf0a5('0x5'));var db=require(_0xf0a5('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf0a5('0x7'))(_0xf0a5('0x8'));var config=require(_0xf0a5('0x9'));var jayson=require(_0xf0a5('0xa'));var client=jayson[_0xf0a5('0xb')][_0xf0a5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x11f33b,_0x4bf60b,_0xda087a){return new BPromise(function(_0x365253,_0x4c75fc){return client[_0xf0a5('0xd')](_0x11f33b,_0xda087a)[_0xf0a5('0xe')](function(_0x35c382){logger[_0xf0a5('0xf')](_0xf0a5('0x10'),_0x4bf60b,'request\x20sent');logger[_0xf0a5('0x11')](_0xf0a5('0x12'),_0x4bf60b,_0xf0a5('0x13'),JSON['stringify'](_0x35c382));if(_0x35c382[_0xf0a5('0x14')]){if(_0x35c382[_0xf0a5('0x14')][_0xf0a5('0x15')]===0x1f4){logger[_0xf0a5('0x14')]('VoiceCallReport,\x20%s,\x20%s',_0x4bf60b,_0x35c382[_0xf0a5('0x14')][_0xf0a5('0x16')]);return _0x4c75fc(_0x35c382[_0xf0a5('0x14')][_0xf0a5('0x16')]);}logger[_0xf0a5('0x14')](_0xf0a5('0x10'),_0x4bf60b,_0x35c382[_0xf0a5('0x14')][_0xf0a5('0x16')]);return _0x365253(_0x35c382[_0xf0a5('0x14')][_0xf0a5('0x16')]);}else{logger[_0xf0a5('0xf')](_0xf0a5('0x10'),_0x4bf60b,_0xf0a5('0x13'));_0x365253(_0x35c382['result'][_0xf0a5('0x16')]);}})[_0xf0a5('0x17')](function(_0x529fb9){logger[_0xf0a5('0x14')](_0xf0a5('0x10'),_0x4bf60b,_0x529fb9);_0x4c75fc(_0x529fb9);});});}exports[_0xf0a5('0x18')]=function(_0x4846b0){var _0x253fc7=this;return new Promise(function(_0x4e0f42,_0x942225){return db[_0xf0a5('0x19')][_0xf0a5('0x1a')]({'raw':_0x4846b0[_0xf0a5('0x1b')]?_0x4846b0[_0xf0a5('0x1b')][_0xf0a5('0x1c')]===undefined?!![]:![]:!![],'where':_0x4846b0[_0xf0a5('0x1b')]?_0x4846b0[_0xf0a5('0x1b')]['where']||null:null,'attributes':_0x4846b0[_0xf0a5('0x1b')]?_0x4846b0['options']['attributes']||null:null,'limit':_0x4846b0[_0xf0a5('0x1b')]?_0x4846b0[_0xf0a5('0x1b')][_0xf0a5('0x1d')]||null:null,'include':_0x4846b0['options']?_0x4846b0[_0xf0a5('0x1b')]['include']?_['map'](_0x4846b0[_0xf0a5('0x1b')][_0xf0a5('0x1e')],function(_0x2a3d54){return{'model':db[_0x2a3d54[_0xf0a5('0x1f')]],'as':_0x2a3d54['as'],'attributes':_0x2a3d54[_0xf0a5('0x20')],'include':_0x2a3d54[_0xf0a5('0x1e')]?_[_0xf0a5('0x21')](_0x2a3d54['include'],function(_0x366879){return{'model':db[_0x366879[_0xf0a5('0x1f')]],'as':_0x366879['as'],'attributes':_0x366879[_0xf0a5('0x20')],'include':_0x366879['include']?_['map'](_0x366879['include'],function(_0x12c556){return{'model':db[_0x12c556['model']],'as':_0x12c556['as'],'attributes':_0x12c556[_0xf0a5('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e38d0){logger[_0xf0a5('0xf')]('GetVoiceCallReport',_0x4846b0);logger[_0xf0a5('0x11')](_0xf0a5('0x18'),_0x4846b0,JSON[_0xf0a5('0x22')](_0x3e38d0));_0x4e0f42(_0x3e38d0);})[_0xf0a5('0x17')](function(_0x2c220e){logger[_0xf0a5('0x14')]('GetVoiceCallReport',_0x2c220e[_0xf0a5('0x16')],_0x4846b0);_0x942225(_0x253fc7['error'](0x1f4,_0x2c220e[_0xf0a5('0x16')]));});});};exports[_0xf0a5('0x23')]=function(_0x3bc1d3){var _0x159220=this;return new Promise(function(_0x3e3e2d,_0x28f6a8){return db[_0xf0a5('0x19')][_0xf0a5('0x24')](_0x3bc1d3[_0xf0a5('0x25')],{'raw':_0x3bc1d3['options']?_0x3bc1d3[_0xf0a5('0x1b')][_0xf0a5('0x1c')]===undefined?!![]:![]:!![]})[_0xf0a5('0xe')](function(_0x3cdd89){logger['info'](_0xf0a5('0x23'),_0x3bc1d3);logger['debug']('CreateVoiceCallReport',_0x3bc1d3,JSON[_0xf0a5('0x22')](_0x3cdd89));_0x3e3e2d(_0x3cdd89);})[_0xf0a5('0x17')](function(_0x54d3c9){logger['error'](_0xf0a5('0x23'),_0x54d3c9[_0xf0a5('0x16')],_0x3bc1d3);_0x28f6a8(_0x159220[_0xf0a5('0x14')](0x1f4,_0x54d3c9[_0xf0a5('0x16')]));});});};exports[_0xf0a5('0x26')]=function(_0x540504){var _0x2041ae=this;return new Promise(function(_0x5cddde,_0x102f43){return db[_0xf0a5('0x19')][_0xf0a5('0x27')](_0x540504[_0xf0a5('0x25')],{'raw':_0x540504['options']?_0x540504['options'][_0xf0a5('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x540504[_0xf0a5('0x1b')]?_0x540504[_0xf0a5('0x1b')][_0xf0a5('0x28')]||null:null,'attributes':_0x540504['options']?_0x540504[_0xf0a5('0x1b')][_0xf0a5('0x20')]||null:null,'limit':_0x540504[_0xf0a5('0x1b')]?_0x540504['options'][_0xf0a5('0x1d')]||null:null})['then'](function(_0x365dc4){logger[_0xf0a5('0xf')](_0xf0a5('0x26'),_0x540504);logger[_0xf0a5('0x11')](_0xf0a5('0x26'),_0x540504,JSON[_0xf0a5('0x22')](_0x365dc4));_0x5cddde(_0x365dc4);})[_0xf0a5('0x17')](function(_0x40e432){logger[_0xf0a5('0x14')](_0xf0a5('0x26'),_0x40e432[_0xf0a5('0x16')],_0x540504);_0x102f43(_0x2041ae['error'](0x1f4,_0x40e432[_0xf0a5('0x16')]));});});}; \ No newline at end of file +var _0x5f97=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','GetVoiceCallReport','VoiceCallReport','options','limit','include','model','attributes','map','debug','CreateVoiceCallReport','create','body','raw','UpdateVoiceCallReport','where','lodash','util'];(function(_0x3ed1df,_0x18d47a){var _0x313d39=function(_0x31b135){while(--_0x31b135){_0x3ed1df['push'](_0x3ed1df['shift']());}};_0x313d39(++_0x18d47a);}(_0x5f97,0x6d));var _0x75f9=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x5f97[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x75f9('0x0'));var util=require(_0x75f9('0x1'));var moment=require('moment');var BPromise=require(_0x75f9('0x2'));var rs=require(_0x75f9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x75f9('0x4'))['db'];var utils=require(_0x75f9('0x5'));var logger=require(_0x75f9('0x6'))(_0x75f9('0x7'));var config=require(_0x75f9('0x8'));var jayson=require(_0x75f9('0x9'));var client=jayson[_0x75f9('0xa')][_0x75f9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c85d0,_0x592de6,_0xf190d1){return new BPromise(function(_0x4be2aa,_0x34f8a4){return client[_0x75f9('0xc')](_0x5c85d0,_0xf190d1)[_0x75f9('0xd')](function(_0x16f569){logger['info'](_0x75f9('0xe'),_0x592de6,'request\x20sent');logger['debug']('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x592de6,_0x75f9('0xf'),JSON[_0x75f9('0x10')](_0x16f569));if(_0x16f569[_0x75f9('0x11')]){if(_0x16f569['error']['code']===0x1f4){logger[_0x75f9('0x11')](_0x75f9('0xe'),_0x592de6,_0x16f569[_0x75f9('0x11')][_0x75f9('0x12')]);return _0x34f8a4(_0x16f569[_0x75f9('0x11')][_0x75f9('0x12')]);}logger[_0x75f9('0x11')](_0x75f9('0xe'),_0x592de6,_0x16f569[_0x75f9('0x11')][_0x75f9('0x12')]);return _0x4be2aa(_0x16f569['error'][_0x75f9('0x12')]);}else{logger[_0x75f9('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0x592de6,_0x75f9('0xf'));_0x4be2aa(_0x16f569[_0x75f9('0x14')][_0x75f9('0x12')]);}})[_0x75f9('0x15')](function(_0xf5931c){logger['error'](_0x75f9('0xe'),_0x592de6,_0xf5931c);_0x34f8a4(_0xf5931c);});});}exports[_0x75f9('0x16')]=function(_0x10e12a){var _0x19101c=this;return new Promise(function(_0x127d17,_0x3dd7ab){return db[_0x75f9('0x17')]['findAll']({'raw':_0x10e12a[_0x75f9('0x18')]?_0x10e12a[_0x75f9('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x10e12a['options']?_0x10e12a['options']['where']||null:null,'attributes':_0x10e12a['options']?_0x10e12a[_0x75f9('0x18')]['attributes']||null:null,'limit':_0x10e12a[_0x75f9('0x18')]?_0x10e12a[_0x75f9('0x18')][_0x75f9('0x19')]||null:null,'include':_0x10e12a['options']?_0x10e12a[_0x75f9('0x18')][_0x75f9('0x1a')]?_['map'](_0x10e12a[_0x75f9('0x18')]['include'],function(_0x4ecb38){return{'model':db[_0x4ecb38[_0x75f9('0x1b')]],'as':_0x4ecb38['as'],'attributes':_0x4ecb38[_0x75f9('0x1c')],'include':_0x4ecb38[_0x75f9('0x1a')]?_[_0x75f9('0x1d')](_0x4ecb38[_0x75f9('0x1a')],function(_0xf5919d){return{'model':db[_0xf5919d[_0x75f9('0x1b')]],'as':_0xf5919d['as'],'attributes':_0xf5919d[_0x75f9('0x1c')],'include':_0xf5919d[_0x75f9('0x1a')]?_[_0x75f9('0x1d')](_0xf5919d[_0x75f9('0x1a')],function(_0x5c1daf){return{'model':db[_0x5c1daf[_0x75f9('0x1b')]],'as':_0x5c1daf['as'],'attributes':_0x5c1daf[_0x75f9('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x75f9('0xd')](function(_0x145266){logger['info'](_0x75f9('0x16'),_0x10e12a);logger[_0x75f9('0x1e')](_0x75f9('0x16'),_0x10e12a,JSON[_0x75f9('0x10')](_0x145266));_0x127d17(_0x145266);})[_0x75f9('0x15')](function(_0xea045c){logger[_0x75f9('0x11')](_0x75f9('0x16'),_0xea045c['message'],_0x10e12a);_0x3dd7ab(_0x19101c['error'](0x1f4,_0xea045c[_0x75f9('0x12')]));});});};exports[_0x75f9('0x1f')]=function(_0xc69927){var _0x69c73e=this;return new Promise(function(_0x40e257,_0x3601c5){return db['VoiceCallReport'][_0x75f9('0x20')](_0xc69927[_0x75f9('0x21')],{'raw':_0xc69927['options']?_0xc69927['options'][_0x75f9('0x22')]===undefined?!![]:![]:!![]})[_0x75f9('0xd')](function(_0x4a4ad5){logger[_0x75f9('0x13')]('CreateVoiceCallReport',_0xc69927);logger[_0x75f9('0x1e')](_0x75f9('0x1f'),_0xc69927,JSON[_0x75f9('0x10')](_0x4a4ad5));_0x40e257(_0x4a4ad5);})[_0x75f9('0x15')](function(_0xae4e2e){logger[_0x75f9('0x11')](_0x75f9('0x1f'),_0xae4e2e['message'],_0xc69927);_0x3601c5(_0x69c73e[_0x75f9('0x11')](0x1f4,_0xae4e2e[_0x75f9('0x12')]));});});};exports[_0x75f9('0x23')]=function(_0x21cb00){var _0x129410=this;return new Promise(function(_0x48c828,_0x18e7d5){return db[_0x75f9('0x17')]['update'](_0x21cb00[_0x75f9('0x21')],{'raw':_0x21cb00['options']?_0x21cb00[_0x75f9('0x18')][_0x75f9('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21cb00[_0x75f9('0x18')]?_0x21cb00['options'][_0x75f9('0x24')]||null:null,'attributes':_0x21cb00[_0x75f9('0x18')]?_0x21cb00['options'][_0x75f9('0x1c')]||null:null,'limit':_0x21cb00[_0x75f9('0x18')]?_0x21cb00[_0x75f9('0x18')][_0x75f9('0x19')]||null:null})[_0x75f9('0xd')](function(_0x183a7b){logger[_0x75f9('0x13')]('UpdateVoiceCallReport',_0x21cb00);logger[_0x75f9('0x1e')](_0x75f9('0x23'),_0x21cb00,JSON[_0x75f9('0x10')](_0x183a7b));_0x48c828(_0x183a7b);})[_0x75f9('0x15')](function(_0x5d631b){logger['error'](_0x75f9('0x23'),_0x5d631b[_0x75f9('0x12')],_0x21cb00);_0x18e7d5(_0x129410['error'](0x1f4,_0x5d631b[_0x75f9('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 7c46515..0f8e473 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 _0xdcd5=['connect-timeout','express','Router','fs-extra','../../components/auth/service','./voiceChanSpy.controller','get','isAuthenticated','show','create','put','delete','/:id','util'];(function(_0x46b774,_0x232634){var _0x5773ad=function(_0x62e568){while(--_0x62e568){_0x46b774['push'](_0x46b774['shift']());}};_0x5773ad(++_0x232634);}(_0xdcd5,0x133));var _0x5dcd=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xdcd5[_0x432682];return _0x463d05;};'use strict';var multer=require('multer');var util=require(_0x5dcd('0x0'));var path=require('path');var timeout=require(_0x5dcd('0x1'));var express=require(_0x5dcd('0x2'));var router=express[_0x5dcd('0x3')]();var fs_extra=require(_0x5dcd('0x4'));var auth=require(_0x5dcd('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5dcd('0x6'));router[_0x5dcd('0x7')]('/',auth[_0x5dcd('0x8')](),controller['index']);router['get']('/:id',auth[_0x5dcd('0x8')](),controller[_0x5dcd('0x9')]);router['post']('/',auth[_0x5dcd('0x8')](),controller[_0x5dcd('0xa')]);router[_0x5dcd('0xb')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x5dcd('0xc')](_0x5dcd('0xd'),auth[_0x5dcd('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc273=['../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','index','/:id','isAuthenticated','update','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x7c168b,_0xb733c1){var _0x58349f=function(_0x2e1ae1){while(--_0x2e1ae1){_0x7c168b['push'](_0x7c168b['shift']());}};_0x58349f(++_0xb733c1);}(_0xc273,0xe9));var _0x3c27=function(_0x2e819c,_0x3f99a5){_0x2e819c=_0x2e819c-0x0;var _0x24e271=_0xc273[_0x2e819c];return _0x24e271;};'use strict';var multer=require(_0x3c27('0x0'));var util=require(_0x3c27('0x1'));var path=require(_0x3c27('0x2'));var timeout=require(_0x3c27('0x3'));var express=require(_0x3c27('0x4'));var router=express['Router']();var fs_extra=require(_0x3c27('0x5'));var auth=require(_0x3c27('0x6'));var interaction=require(_0x3c27('0x7'));var config=require(_0x3c27('0x8'));var controller=require(_0x3c27('0x9'));router[_0x3c27('0xa')]('/',auth['isAuthenticated'](),controller[_0x3c27('0xb')]);router[_0x3c27('0xa')](_0x3c27('0xc'),auth[_0x3c27('0xd')](),controller['show']);router['post']('/',auth[_0x3c27('0xd')](),controller['create']);router['put'](_0x3c27('0xc'),auth[_0x3c27('0xd')](),controller[_0x3c27('0xe')]);router['delete']('/:id',auth[_0x3c27('0xd')](),controller['destroy']);module[_0x3c27('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 9ccf80c..65a721d 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 _0xe6b5=['STRING','name','options','join','BOOLEAN','sequelize','exports'];(function(_0x584070,_0x3fae73){var _0x5b36ea=function(_0x1cd483){while(--_0x1cd483){_0x584070['push'](_0x584070['shift']());}};_0x5b36ea(++_0x3fae73);}(_0xe6b5,0xfa));var _0x5e6b=function(_0x3ce3d0,_0x597f99){_0x3ce3d0=_0x3ce3d0-0x0;var _0x23cbe9=_0xe6b5[_0x3ce3d0];return _0x23cbe9;};'use strict';var Sequelize=require(_0x5e6b('0x0'));module[_0x5e6b('0x1')]={'name':{'type':Sequelize[_0x5e6b('0x2')]},'prefix':{'type':Sequelize[_0x5e6b('0x2')],'unique':_0x5e6b('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x184658){this['setDataValue'](_0x5e6b('0x4'),_0x184658?_0x184658[_0x5e6b('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x5e6b('0x4'))?this['getDataValue'](_0x5e6b('0x4'))['split'](''):[];}},'auth':{'type':Sequelize[_0x5e6b('0x6')],'defaultValue':![]},'password':{'type':Sequelize[_0x5e6b('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x5e6b('0x2')]},'description':{'type':Sequelize[_0x5e6b('0x2')]}}; \ No newline at end of file +var _0xe61c=['STRING','name','setDataValue','options','getDataValue','BOOLEAN','sequelize'];(function(_0x26cacc,_0x3c783a){var _0x38f1ca=function(_0x362325){while(--_0x362325){_0x26cacc['push'](_0x26cacc['shift']());}};_0x38f1ca(++_0x3c783a);}(_0xe61c,0x180));var _0xce61=function(_0x1c8cc6,_0x411e5c){_0x1c8cc6=_0x1c8cc6-0x0;var _0x522936=_0xe61c[_0x1c8cc6];return _0x522936;};'use strict';var Sequelize=require(_0xce61('0x0'));module['exports']={'name':{'type':Sequelize[_0xce61('0x1')]},'prefix':{'type':Sequelize['STRING'],'unique':_0xce61('0x2'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x140cbd){this[_0xce61('0x3')](_0xce61('0x4'),_0x140cbd?_0x140cbd['join'](''):[]);},'get':function(){return this['getDataValue'](_0xce61('0x4'))?this[_0xce61('0x5')]('options')['split'](''):[];}},'auth':{'type':Sequelize[_0xce61('0x6')],'defaultValue':![]},'password':{'type':Sequelize[_0xce61('0x1')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xce61('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 7899946..a264fbb 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 _0x97a2=['UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','ChanSpies','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','VIRTUAL','includeAll','include','VoiceChanSpy','findAll','show','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x70fa3,_0x5242af){var _0x55c99f=function(_0x27d035){while(--_0x27d035){_0x70fa3['push'](_0x70fa3['shift']());}};_0x55c99f(++_0x5242af);}(_0x97a2,0x1b1));var _0x297a=function(_0xb91073,_0x5a663c){_0xb91073=_0xb91073-0x0;var _0x1733b1=_0x97a2[_0xb91073];return _0x1733b1;};'use strict';var emlformat=require(_0x297a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x297a('0x1'));var jsonpatch=require(_0x297a('0x2'));var rp=require(_0x297a('0x3'));var moment=require(_0x297a('0x4'));var BPromise=require(_0x297a('0x5'));var Mustache=require(_0x297a('0x6'));var util=require(_0x297a('0x7'));var path=require(_0x297a('0x8'));var sox=require('sox');var csv=require(_0x297a('0x9'));var ejs=require(_0x297a('0xa'));var fs=require('fs');var fs_extra=require(_0x297a('0xb'));var _=require(_0x297a('0xc'));var squel=require(_0x297a('0xd'));var crypto=require(_0x297a('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x297a('0xf'));var toCsv=require(_0x297a('0x9'));var querystring=require(_0x297a('0x10'));var Papa=require(_0x297a('0x11'));var Redis=require(_0x297a('0x12'));var authService=require(_0x297a('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x297a('0x14'))(_0x297a('0x15'));var utils=require(_0x297a('0x16'));var config=require(_0x297a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x297a('0x18'))['db'];function respondWithStatusCode(_0x3db3e9,_0x278334){_0x278334=_0x278334||0xcc;return function(_0x413bc4){if(_0x413bc4){return _0x3db3e9[_0x297a('0x19')](_0x278334);}return _0x3db3e9[_0x297a('0x1a')](_0x278334)[_0x297a('0x1b')]();};}function respondWithResult(_0x5020b0,_0x4d826d){_0x4d826d=_0x4d826d||0xc8;return function(_0x417def){if(_0x417def){return _0x5020b0['status'](_0x4d826d)[_0x297a('0x1c')](_0x417def);}};}function respondWithFilteredResult(_0x1016ea,_0x53f1e4){return function(_0x188540){if(_0x188540){var _0x40f080=typeof _0x53f1e4['offset']===_0x297a('0x1d')&&typeof _0x53f1e4[_0x297a('0x1e')]===_0x297a('0x1d');var _0x4d6b59=_0x188540[_0x297a('0x1f')];var _0x3af847=_0x40f080?0x0:_0x53f1e4[_0x297a('0x20')];var _0x4d6194=_0x40f080?_0x188540[_0x297a('0x1f')]:_0x53f1e4[_0x297a('0x20')]+_0x53f1e4['limit'];var _0x26b878;if(_0x4d6194>=_0x4d6b59){_0x4d6194=_0x4d6b59;_0x26b878=0xc8;}else{_0x26b878=0xce;}_0x1016ea[_0x297a('0x1a')](_0x26b878);return _0x1016ea[_0x297a('0x21')](_0x297a('0x22'),_0x3af847+'-'+_0x4d6194+'/'+_0x4d6b59)[_0x297a('0x1c')](_0x188540);}return null;};}function patchUpdates(_0xde6d1c){return function(_0x3e42c5){try{jsonpatch[_0x297a('0x23')](_0x3e42c5,_0xde6d1c,!![]);}catch(_0x101583){return BPromise[_0x297a('0x24')](_0x101583);}return _0x3e42c5[_0x297a('0x25')]();};}function saveUpdates(_0x5889c7,_0x481f59){return function(_0x5bb38a){if(_0x5bb38a){return _0x5bb38a['update'](_0x5889c7)[_0x297a('0x26')](function(_0xcebadc){return _0xcebadc;});}return null;};}function removeEntity(_0x4ad883,_0xfbf16a){return function(_0x40919d){if(_0x40919d){return _0x40919d[_0x297a('0x27')]()[_0x297a('0x26')](function(){var _0x519f3b=_0x40919d[_0x297a('0x28')]({'plain':!![]});var _0x3267eb=_0x297a('0x29');return db['UserProfileResource'][_0x297a('0x27')]({'where':{'type':_0x3267eb,'resourceId':_0x519f3b['id']}})[_0x297a('0x26')](function(){return _0x40919d;});})[_0x297a('0x26')](function(){_0x4ad883[_0x297a('0x1a')](0xcc)[_0x297a('0x1b')]();});}};}function handleEntityNotFound(_0x3e257d,_0x399965){return function(_0x36564a){if(!_0x36564a){_0x3e257d[_0x297a('0x19')](0x194);}return _0x36564a;};}function handleError(_0x7dd056,_0x1b9184){_0x1b9184=_0x1b9184||0x1f4;return function(_0x57327a){logger[_0x297a('0x2a')](_0x57327a[_0x297a('0x2b')]);if(_0x57327a[_0x297a('0x2c')]){delete _0x57327a['name'];}_0x7dd056['status'](_0x1b9184)[_0x297a('0x2d')](_0x57327a);};}exports[_0x297a('0x2e')]=function(_0x40cc4d,_0xd9c747){var _0x3eddd8={},_0x1da0e7={},_0x48dc2f={'count':0x0,'rows':[]};var _0x53291d=_[_0x297a('0x2f')](db['VoiceChanSpy'][_0x297a('0x30')],function(_0x97281c){return{'name':_0x97281c[_0x297a('0x31')],'type':_0x97281c[_0x297a('0x32')][_0x297a('0x33')]};});_0x1da0e7['model']=_[_0x297a('0x2f')](_0x53291d,_0x297a('0x2c'));_0x1da0e7[_0x297a('0x34')]=_[_0x297a('0x35')](_0x40cc4d[_0x297a('0x34')]);_0x1da0e7[_0x297a('0x36')]=_[_0x297a('0x37')](_0x1da0e7[_0x297a('0x38')],_0x1da0e7[_0x297a('0x34')]);_0x3eddd8['attributes']=_[_0x297a('0x37')](_0x1da0e7['model'],qs[_0x297a('0x39')](_0x40cc4d[_0x297a('0x34')][_0x297a('0x39')]));_0x3eddd8[_0x297a('0x3a')]=_0x3eddd8['attributes'][_0x297a('0x3b')]?_0x3eddd8['attributes']:_0x1da0e7[_0x297a('0x38')];if(!_0x40cc4d[_0x297a('0x34')]['hasOwnProperty'](_0x297a('0x3c'))){_0x3eddd8[_0x297a('0x1e')]=qs[_0x297a('0x1e')](_0x40cc4d['query']['limit']);_0x3eddd8[_0x297a('0x20')]=qs[_0x297a('0x20')](_0x40cc4d[_0x297a('0x34')]['offset']);}_0x3eddd8[_0x297a('0x3d')]=qs[_0x297a('0x3e')](_0x40cc4d[_0x297a('0x34')][_0x297a('0x3e')]);_0x3eddd8[_0x297a('0x3f')]=qs[_0x297a('0x36')](_['pick'](_0x40cc4d[_0x297a('0x34')],_0x1da0e7['filters']),_0x53291d);if(_0x40cc4d[_0x297a('0x34')]['filter']){_0x3eddd8[_0x297a('0x3f')]=_['merge'](_0x3eddd8[_0x297a('0x3f')],{'$or':_['map'](_0x53291d,function(_0x2f3a87){if(_0x2f3a87[_0x297a('0x32')]!==_0x297a('0x40')){var _0x5c5273={};_0x5c5273[_0x2f3a87['name']]={'$like':'%'+_0x40cc4d[_0x297a('0x34')]['filter']+'%'};return _0x5c5273;}})});}_0x3eddd8=_['merge']({},_0x3eddd8,_0x40cc4d['options']);var _0x86eb2f={'where':_0x3eddd8[_0x297a('0x3f')]};return db['VoiceChanSpy'][_0x297a('0x1f')](_0x86eb2f)[_0x297a('0x26')](function(_0x195789){_0x48dc2f['count']=_0x195789;if(_0x40cc4d[_0x297a('0x34')][_0x297a('0x41')]){_0x3eddd8[_0x297a('0x42')]=[{'all':!![]}];}return db[_0x297a('0x43')][_0x297a('0x44')](_0x3eddd8);})['then'](function(_0x441cdf){_0x48dc2f['rows']=_0x441cdf;return _0x48dc2f;})['then'](respondWithFilteredResult(_0xd9c747,_0x3eddd8))['catch'](handleError(_0xd9c747,null));};exports[_0x297a('0x45')]=function(_0x3461dd,_0x239329){var _0x52e7dc={'raw':![],'where':{'id':_0x3461dd['params']['id']}},_0x18eb2b={};_0x18eb2b[_0x297a('0x38')]=_[_0x297a('0x35')](db[_0x297a('0x43')][_0x297a('0x30')]);_0x18eb2b[_0x297a('0x34')]=_[_0x297a('0x35')](_0x3461dd['query']);_0x18eb2b[_0x297a('0x36')]=_[_0x297a('0x37')](_0x18eb2b['model'],_0x18eb2b[_0x297a('0x34')]);_0x52e7dc[_0x297a('0x3a')]=_[_0x297a('0x37')](_0x18eb2b[_0x297a('0x38')],qs[_0x297a('0x39')](_0x3461dd['query'][_0x297a('0x39')]));_0x52e7dc[_0x297a('0x3a')]=_0x52e7dc[_0x297a('0x3a')][_0x297a('0x3b')]?_0x52e7dc[_0x297a('0x3a')]:_0x18eb2b[_0x297a('0x38')];if(_0x3461dd[_0x297a('0x34')][_0x297a('0x41')]){_0x52e7dc['include']=[{'all':!![]}];}_0x52e7dc=_['merge']({},_0x52e7dc,_0x3461dd[_0x297a('0x46')]);return db[_0x297a('0x43')]['find'](_0x52e7dc)['then'](handleEntityNotFound(_0x239329,null))[_0x297a('0x26')](respondWithResult(_0x239329,null))[_0x297a('0x47')](handleError(_0x239329,null));};exports[_0x297a('0x48')]=function(_0x3ea7a8,_0x4baed0){return db[_0x297a('0x43')][_0x297a('0x48')](_0x3ea7a8[_0x297a('0x49')],{})[_0x297a('0x26')](function(_0x392ec3){var _0x173eb8=_0x3ea7a8[_0x297a('0x4a')][_0x297a('0x28')]({'plain':!![]});if(!_0x173eb8)throw new Error(_0x297a('0x4b'));if(_0x173eb8[_0x297a('0x4c')]==='user'){var _0x356f34=_0x392ec3[_0x297a('0x28')]({'plain':!![]});var _0x46ccf9=_0x297a('0x29');return db[_0x297a('0x4d')]['find']({'where':{'name':_0x46ccf9,'userProfileId':_0x173eb8[_0x297a('0x4e')]},'raw':!![]})[_0x297a('0x26')](function(_0x348414){if(_0x348414&&_0x348414[_0x297a('0x4f')]===0x0){return db[_0x297a('0x50')][_0x297a('0x48')]({'name':_0x356f34[_0x297a('0x2c')],'resourceId':_0x356f34['id'],'type':_0x348414[_0x297a('0x2c')],'sectionId':_0x348414['id']},{})[_0x297a('0x26')](function(){return _0x392ec3;});}else{return _0x392ec3;}})['catch'](function(_0x3d1bfd){logger[_0x297a('0x2a')](_0x297a('0x51'),_0x3d1bfd);throw _0x3d1bfd;});}return _0x392ec3;})[_0x297a('0x26')](respondWithResult(_0x4baed0,0xc9))[_0x297a('0x47')](handleError(_0x4baed0,null));};exports[_0x297a('0x52')]=function(_0x56ddff,_0x5f32f5){if(_0x56ddff[_0x297a('0x49')]['id']){delete _0x56ddff[_0x297a('0x49')]['id'];}return db[_0x297a('0x43')][_0x297a('0x53')]({'where':{'id':_0x56ddff['params']['id']}})['then'](handleEntityNotFound(_0x5f32f5,null))[_0x297a('0x26')](saveUpdates(_0x56ddff[_0x297a('0x49')],null))[_0x297a('0x26')](respondWithResult(_0x5f32f5,null))[_0x297a('0x47')](handleError(_0x5f32f5,null));};exports[_0x297a('0x27')]=function(_0x411664,_0x1a62b9){return db['VoiceChanSpy']['find']({'where':{'id':_0x411664[_0x297a('0x54')]['id']}})['then'](handleEntityNotFound(_0x1a62b9,null))['then'](removeEntity(_0x1a62b9,null))['catch'](handleError(_0x1a62b9,null));}; \ No newline at end of file +var _0x6c63=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','ChanSpies','error','stack','name','send','index','map','VoiceChanSpy','rawAttributes','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x195776,_0x51bba9){var _0x46fb18=function(_0x4dc2b0){while(--_0x4dc2b0){_0x195776['push'](_0x195776['shift']());}};_0x46fb18(++_0x51bba9);}(_0x6c63,0x1ee));var _0x36c6=function(_0x187ff8,_0x33001c){_0x187ff8=_0x187ff8-0x0;var _0x12d5e3=_0x6c63[_0x187ff8];return _0x12d5e3;};'use strict';var emlformat=require(_0x36c6('0x0'));var rimraf=require(_0x36c6('0x1'));var zipdir=require(_0x36c6('0x2'));var jsonpatch=require(_0x36c6('0x3'));var rp=require(_0x36c6('0x4'));var moment=require(_0x36c6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x36c6('0x6'));var util=require(_0x36c6('0x7'));var path=require(_0x36c6('0x8'));var sox=require(_0x36c6('0x9'));var csv=require(_0x36c6('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x36c6('0xb'));var _=require(_0x36c6('0xc'));var squel=require(_0x36c6('0xd'));var crypto=require(_0x36c6('0xe'));var jsforce=require(_0x36c6('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x36c6('0xa'));var querystring=require('querystring');var Papa=require(_0x36c6('0x10'));var Redis=require('ioredis');var authService=require(_0x36c6('0x11'));var qs=require(_0x36c6('0x12'));var as=require(_0x36c6('0x13'));var hardwareService=require(_0x36c6('0x14'));var logger=require(_0x36c6('0x15'))(_0x36c6('0x16'));var utils=require(_0x36c6('0x17'));var config=require(_0x36c6('0x18'));var licenseUtil=require(_0x36c6('0x19'));var db=require(_0x36c6('0x1a'))['db'];function respondWithStatusCode(_0x1e5a00,_0x1bbb1b){_0x1bbb1b=_0x1bbb1b||0xcc;return function(_0x20213a){if(_0x20213a){return _0x1e5a00[_0x36c6('0x1b')](_0x1bbb1b);}return _0x1e5a00['status'](_0x1bbb1b)[_0x36c6('0x1c')]();};}function respondWithResult(_0x1a2391,_0x1f9de1){_0x1f9de1=_0x1f9de1||0xc8;return function(_0x531c09){if(_0x531c09){return _0x1a2391[_0x36c6('0x1d')](_0x1f9de1)[_0x36c6('0x1e')](_0x531c09);}};}function respondWithFilteredResult(_0x3c5623,_0x25b30e){return function(_0x9e4cb6){if(_0x9e4cb6){var _0x56b28b=typeof _0x25b30e[_0x36c6('0x1f')]===_0x36c6('0x20')&&typeof _0x25b30e[_0x36c6('0x21')]===_0x36c6('0x20');var _0x5bac6c=_0x9e4cb6[_0x36c6('0x22')];var _0x499c50=_0x56b28b?0x0:_0x25b30e[_0x36c6('0x1f')];var _0x59ab0c=_0x56b28b?_0x9e4cb6[_0x36c6('0x22')]:_0x25b30e[_0x36c6('0x1f')]+_0x25b30e[_0x36c6('0x21')];var _0x539791;if(_0x59ab0c>=_0x5bac6c){_0x59ab0c=_0x5bac6c;_0x539791=0xc8;}else{_0x539791=0xce;}_0x3c5623[_0x36c6('0x1d')](_0x539791);return _0x3c5623[_0x36c6('0x23')](_0x36c6('0x24'),_0x499c50+'-'+_0x59ab0c+'/'+_0x5bac6c)[_0x36c6('0x1e')](_0x9e4cb6);}return null;};}function patchUpdates(_0x4097b1){return function(_0x6daa60){try{jsonpatch[_0x36c6('0x25')](_0x6daa60,_0x4097b1,!![]);}catch(_0x55898b){return BPromise['reject'](_0x55898b);}return _0x6daa60[_0x36c6('0x26')]();};}function saveUpdates(_0x32093d,_0x53911e){return function(_0x597570){if(_0x597570){return _0x597570[_0x36c6('0x27')](_0x32093d)[_0x36c6('0x28')](function(_0x3112af){return _0x3112af;});}return null;};}function removeEntity(_0xdd6931,_0x2e12f7){return function(_0x77240f){if(_0x77240f){return _0x77240f[_0x36c6('0x29')]()[_0x36c6('0x28')](function(){var _0x547251=_0x77240f[_0x36c6('0x2a')]({'plain':!![]});var _0x3c5195=_0x36c6('0x2b');return db['UserProfileResource'][_0x36c6('0x29')]({'where':{'type':_0x3c5195,'resourceId':_0x547251['id']}})[_0x36c6('0x28')](function(){return _0x77240f;});})[_0x36c6('0x28')](function(){_0xdd6931[_0x36c6('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34b08c,_0x524d7e){return function(_0x473aa2){if(!_0x473aa2){_0x34b08c[_0x36c6('0x1b')](0x194);}return _0x473aa2;};}function handleError(_0x544ab8,_0x47f1e6){_0x47f1e6=_0x47f1e6||0x1f4;return function(_0x539d99){logger[_0x36c6('0x2c')](_0x539d99[_0x36c6('0x2d')]);if(_0x539d99[_0x36c6('0x2e')]){delete _0x539d99['name'];}_0x544ab8[_0x36c6('0x1d')](_0x47f1e6)[_0x36c6('0x2f')](_0x539d99);};}exports[_0x36c6('0x30')]=function(_0x1b2a95,_0x27d433){var _0x393894={},_0x3c1973={},_0x24778d={'count':0x0,'rows':[]};var _0x976879=_[_0x36c6('0x31')](db[_0x36c6('0x32')][_0x36c6('0x33')],function(_0x2d8602){return{'name':_0x2d8602['fieldName'],'type':_0x2d8602[_0x36c6('0x34')][_0x36c6('0x35')]};});_0x3c1973['model']=_[_0x36c6('0x31')](_0x976879,_0x36c6('0x2e'));_0x3c1973[_0x36c6('0x36')]=_['keys'](_0x1b2a95['query']);_0x3c1973['filters']=_[_0x36c6('0x37')](_0x3c1973[_0x36c6('0x38')],_0x3c1973[_0x36c6('0x36')]);_0x393894[_0x36c6('0x39')]=_[_0x36c6('0x37')](_0x3c1973[_0x36c6('0x38')],qs[_0x36c6('0x3a')](_0x1b2a95[_0x36c6('0x36')]['fields']));_0x393894['attributes']=_0x393894[_0x36c6('0x39')][_0x36c6('0x3b')]?_0x393894[_0x36c6('0x39')]:_0x3c1973[_0x36c6('0x38')];if(!_0x1b2a95['query'][_0x36c6('0x3c')]('nolimit')){_0x393894[_0x36c6('0x21')]=qs['limit'](_0x1b2a95[_0x36c6('0x36')][_0x36c6('0x21')]);_0x393894['offset']=qs[_0x36c6('0x1f')](_0x1b2a95['query'][_0x36c6('0x1f')]);}_0x393894[_0x36c6('0x3d')]=qs[_0x36c6('0x3e')](_0x1b2a95[_0x36c6('0x36')][_0x36c6('0x3e')]);_0x393894['where']=qs[_0x36c6('0x3f')](_['pick'](_0x1b2a95[_0x36c6('0x36')],_0x3c1973[_0x36c6('0x3f')]),_0x976879);if(_0x1b2a95['query'][_0x36c6('0x40')]){_0x393894[_0x36c6('0x41')]=_[_0x36c6('0x42')](_0x393894['where'],{'$or':_['map'](_0x976879,function(_0xb68d86){if(_0xb68d86[_0x36c6('0x34')]!==_0x36c6('0x43')){var _0x43fdc8={};_0x43fdc8[_0xb68d86[_0x36c6('0x2e')]]={'$like':'%'+_0x1b2a95['query'][_0x36c6('0x40')]+'%'};return _0x43fdc8;}})});}_0x393894=_[_0x36c6('0x42')]({},_0x393894,_0x1b2a95[_0x36c6('0x44')]);var _0x5c3812={'where':_0x393894[_0x36c6('0x41')]};return db[_0x36c6('0x32')]['count'](_0x5c3812)[_0x36c6('0x28')](function(_0x481ab8){_0x24778d[_0x36c6('0x22')]=_0x481ab8;if(_0x1b2a95['query'][_0x36c6('0x45')]){_0x393894['include']=[{'all':!![]}];}return db['VoiceChanSpy'][_0x36c6('0x46')](_0x393894);})[_0x36c6('0x28')](function(_0x76c618){_0x24778d[_0x36c6('0x47')]=_0x76c618;return _0x24778d;})[_0x36c6('0x28')](respondWithFilteredResult(_0x27d433,_0x393894))[_0x36c6('0x48')](handleError(_0x27d433,null));};exports[_0x36c6('0x49')]=function(_0x3659ca,_0x3ce818){var _0x49c955={'raw':![],'where':{'id':_0x3659ca[_0x36c6('0x4a')]['id']}},_0x25f29f={};_0x25f29f[_0x36c6('0x38')]=_[_0x36c6('0x4b')](db[_0x36c6('0x32')][_0x36c6('0x33')]);_0x25f29f[_0x36c6('0x36')]=_['keys'](_0x3659ca['query']);_0x25f29f[_0x36c6('0x3f')]=_[_0x36c6('0x37')](_0x25f29f['model'],_0x25f29f['query']);_0x49c955[_0x36c6('0x39')]=_[_0x36c6('0x37')](_0x25f29f[_0x36c6('0x38')],qs[_0x36c6('0x3a')](_0x3659ca['query']['fields']));_0x49c955[_0x36c6('0x39')]=_0x49c955[_0x36c6('0x39')][_0x36c6('0x3b')]?_0x49c955[_0x36c6('0x39')]:_0x25f29f['model'];if(_0x3659ca['query'][_0x36c6('0x45')]){_0x49c955[_0x36c6('0x4c')]=[{'all':!![]}];}_0x49c955=_[_0x36c6('0x42')]({},_0x49c955,_0x3659ca[_0x36c6('0x44')]);return db[_0x36c6('0x32')][_0x36c6('0x4d')](_0x49c955)[_0x36c6('0x28')](handleEntityNotFound(_0x3ce818,null))['then'](respondWithResult(_0x3ce818,null))[_0x36c6('0x48')](handleError(_0x3ce818,null));};exports[_0x36c6('0x4e')]=function(_0x46b982,_0xa940f){return db[_0x36c6('0x32')][_0x36c6('0x4e')](_0x46b982[_0x36c6('0x4f')],{})['then'](function(_0x3f5a80){var _0x4a980b=_0x46b982[_0x36c6('0x50')]['get']({'plain':!![]});if(!_0x4a980b)throw new Error(_0x36c6('0x51'));if(_0x4a980b[_0x36c6('0x52')]===_0x36c6('0x50')){var _0xca6c8b=_0x3f5a80['get']({'plain':!![]});var _0x2e0e50=_0x36c6('0x2b');return db[_0x36c6('0x53')][_0x36c6('0x4d')]({'where':{'name':_0x2e0e50,'userProfileId':_0x4a980b[_0x36c6('0x54')]},'raw':!![]})['then'](function(_0x2651a2){if(_0x2651a2&&_0x2651a2['autoAssociation']===0x0){return db[_0x36c6('0x55')][_0x36c6('0x4e')]({'name':_0xca6c8b['name'],'resourceId':_0xca6c8b['id'],'type':_0x2651a2[_0x36c6('0x2e')],'sectionId':_0x2651a2['id']},{})['then'](function(){return _0x3f5a80;});}else{return _0x3f5a80;}})[_0x36c6('0x48')](function(_0x1e0eb0){logger[_0x36c6('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e0eb0);throw _0x1e0eb0;});}return _0x3f5a80;})[_0x36c6('0x28')](respondWithResult(_0xa940f,0xc9))[_0x36c6('0x48')](handleError(_0xa940f,null));};exports[_0x36c6('0x27')]=function(_0x378f03,_0x18edfa){if(_0x378f03[_0x36c6('0x4f')]['id']){delete _0x378f03[_0x36c6('0x4f')]['id'];}return db['VoiceChanSpy'][_0x36c6('0x4d')]({'where':{'id':_0x378f03[_0x36c6('0x4a')]['id']}})['then'](handleEntityNotFound(_0x18edfa,null))[_0x36c6('0x28')](saveUpdates(_0x378f03[_0x36c6('0x4f')],null))[_0x36c6('0x28')](respondWithResult(_0x18edfa,null))[_0x36c6('0x48')](handleError(_0x18edfa,null));};exports['destroy']=function(_0x36452b,_0x5b4aea){return db[_0x36c6('0x32')][_0x36c6('0x4d')]({'where':{'id':_0x36452b[_0x36c6('0x4a')]['id']}})[_0x36c6('0x28')](handleEntityNotFound(_0x5b4aea,null))[_0x36c6('0x28')](removeEntity(_0x5b4aea,null))['catch'](handleError(_0x5b4aea,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 21e4340..3d77cce 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 _0xa0b5=['record','push','MixMonitor','${UNIQUEID}.%s,a','auth','Authenticate','password','ChanSpy','name','options','StopMixMonitor','concat','internal','User','findAll','agent','catch','exports','models','define','VoiceChanSpy','voice_chanspy','then','VoiceExtension','bulkCreate','destroy','length','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','prefix','system','merge','Set'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xa0b5,0x14b));var _0x5a0b=function(_0x1664a6,_0x54efde){_0x1664a6=_0x1664a6-0x0;var _0x1be33a=_0xa0b5[_0x1664a6];return _0x1be33a;};'use strict';var _=require(_0x5a0b('0x0'));var util=require(_0x5a0b('0x1'));var BPromise=require(_0x5a0b('0x2'));var attributes=require(_0x5a0b('0x3'));var getUserApplications=function(_0x38f4a3,_0x1ed7ab,_0x6db3a1){var _0x1dbb23=0x1;var _0x26ad68=[];var _0x234212={'context':_0x1ed7ab[_0x5a0b('0x4')]||_0x5a0b('0x5'),'exten':util[_0x5a0b('0x6')]('%s%s',_0x38f4a3[_0x5a0b('0x7')],_0x6db3a1),'type':_0x5a0b('0x8'),'isApp':![],'ChanSpyId':_0x38f4a3['id'],'UserId':_0x1ed7ab['id']};_0x26ad68['push'](_[_0x5a0b('0x9')]({'app':_0x5a0b('0xa'),'appdata':util['format']('CDR(type)=%s','chanspy'),'priority':_0x1dbb23++},_0x234212));if(_0x38f4a3[_0x5a0b('0xb')]){_0x26ad68[_0x5a0b('0xc')](_['merge']({'app':_0x5a0b('0xd'),'appdata':util[_0x5a0b('0x6')](_0x5a0b('0xe'),_0x38f4a3['recordingFormat']),'priority':_0x1dbb23++},_0x234212));}if(_0x38f4a3[_0x5a0b('0xf')]){_0x26ad68[_0x5a0b('0xc')](_[_0x5a0b('0x9')]({'app':_0x5a0b('0x10'),'appdata':_0x38f4a3[_0x5a0b('0x11')],'priority':_0x1dbb23++},_0x234212));}_0x26ad68[_0x5a0b('0xc')](_[_0x5a0b('0x9')]({'app':_0x5a0b('0x12'),'appdata':util[_0x5a0b('0x6')]('SIP/%s,%s',_0x1ed7ab[_0x5a0b('0x13')],_0x38f4a3['options']?_0x38f4a3[_0x5a0b('0x14')]['join'](''):''),'priority':_0x1dbb23++},_0x234212));if(_0x38f4a3['record']){_0x26ad68['push'](_[_0x5a0b('0x9')]({'app':_0x5a0b('0x15'),'priority':_0x1dbb23++},_0x234212));}return _0x26ad68;};var getChanSpyApplications=function(_0x2af1cb,_0x4020bc){var _0x434667=[];for(var _0x97d74a=0x0,_0x27634f=0x1;_0x97d74a<_0x4020bc['length'];_0x97d74a++,_0x27634f=0x1){_0x434667=_0x434667[_0x5a0b('0x16')](getUserApplications(_0x2af1cb,_0x4020bc[_0x97d74a],_0x4020bc[_0x97d74a]['internal']));if(_0x4020bc[_0x97d74a][_0x5a0b('0x17')]!=_0x4020bc[_0x97d74a][_0x5a0b('0x13')]){_0x434667=_0x434667[_0x5a0b('0x16')](getUserApplications(_0x2af1cb,_0x4020bc[_0x97d74a],_0x4020bc[_0x97d74a][_0x5a0b('0x13')]));}}return _0x434667;};var getChanSpyPromise=function(_0x7f908,_0x1b78aa){return new BPromise(function(_0x29522b,_0x5871c9){return _0x7f908[_0x5a0b('0x18')][_0x5a0b('0x19')]({'attributes':['id',_0x5a0b('0x13'),'internal'],'where':{'role':_0x5a0b('0x1a'),'chanspy':!![]},'raw':!![]})['then'](function(_0x1bbec1){if(_0x1bbec1){return _0x29522b(getChanSpyApplications(_0x1b78aa,_0x1bbec1));}return _0x29522b([]);})[_0x5a0b('0x1b')](function(_0x1ae3e5){_0x5871c9(_0x1ae3e5);});});};module[_0x5a0b('0x1c')]=function(_0x4e40df,_0x38463a){var _0x2a0269=_0x4e40df[_0x5a0b('0x1d')];return _0x4e40df[_0x5a0b('0x1e')](_0x5a0b('0x1f'),attributes,{'tableName':_0x5a0b('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4cd852,_0x2b6628,_0x1ffbfd){return getChanSpyPromise(_0x2a0269,_0x4cd852)[_0x5a0b('0x21')](function(_0x424cb6){if(_0x424cb6&&_0x424cb6['length']){return _0x2a0269[_0x5a0b('0x22')][_0x5a0b('0x23')](_0x424cb6);}})[_0x5a0b('0x21')](function(){_0x1ffbfd();})[_0x5a0b('0x1b')](function(_0x3f8850){_0x1ffbfd(_0x3f8850);});},'afterUpdate':function(_0x2133b2,_0x3724e1,_0x69e71d){return _0x2a0269[_0x5a0b('0x22')][_0x5a0b('0x24')]({'where':{'ChanSpyId':_0x2133b2['id']}})[_0x5a0b('0x21')](function(){return getChanSpyPromise(_0x2a0269,_0x2133b2);})[_0x5a0b('0x21')](function(_0x49efad){if(_0x49efad&&_0x49efad[_0x5a0b('0x25')]){return _0x2a0269[_0x5a0b('0x22')][_0x5a0b('0x23')](_0x49efad);}})[_0x5a0b('0x21')](function(){_0x69e71d();})['catch'](function(_0x4a2624){_0x69e71d(_0x4a2624);});},'afterDestroy':function(_0xfaa879,_0x362371,_0x1cb2a0){return _0x2a0269['VoiceExtension'][_0x5a0b('0x24')]({'where':{'ChanSpyId':_0xfaa879['id']}})[_0x5a0b('0x21')](function(){_0x1cb2a0();})[_0x5a0b('0x1b')](function(_0x3dfcb7){_0x1cb2a0(_0x3dfcb7);});}}});}; \ No newline at end of file +var _0x1162=['exports','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','from-sip','format','%s%s','prefix','system','push','merge','Set','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','Authenticate','password','ChanSpy','SIP/%s,%s','join','length','concat','internal','name','User','findAll','agent','then','catch'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x1162,0x1c3));var _0x2116=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x1162[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0x2116('0x0'));var util=require(_0x2116('0x1'));var BPromise=require(_0x2116('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x4edf40,_0x10b324,_0x5aa887){var _0x917e21=0x1;var _0x2c44ea=[];var _0x57ca0a={'context':_0x10b324['context']||_0x2116('0x3'),'exten':util[_0x2116('0x4')](_0x2116('0x5'),_0x4edf40[_0x2116('0x6')],_0x5aa887),'type':_0x2116('0x7'),'isApp':![],'ChanSpyId':_0x4edf40['id'],'UserId':_0x10b324['id']};_0x2c44ea[_0x2116('0x8')](_[_0x2116('0x9')]({'app':_0x2116('0xa'),'appdata':util['format']('CDR(type)=%s',_0x2116('0xb')),'priority':_0x917e21++},_0x57ca0a));if(_0x4edf40[_0x2116('0xc')]){_0x2c44ea[_0x2116('0x8')](_[_0x2116('0x9')]({'app':_0x2116('0xd'),'appdata':util[_0x2116('0x4')](_0x2116('0xe'),_0x4edf40[_0x2116('0xf')]),'priority':_0x917e21++},_0x57ca0a));}if(_0x4edf40['auth']){_0x2c44ea[_0x2116('0x8')](_[_0x2116('0x9')]({'app':_0x2116('0x10'),'appdata':_0x4edf40[_0x2116('0x11')],'priority':_0x917e21++},_0x57ca0a));}_0x2c44ea[_0x2116('0x8')](_['merge']({'app':_0x2116('0x12'),'appdata':util['format'](_0x2116('0x13'),_0x10b324['name'],_0x4edf40['options']?_0x4edf40['options'][_0x2116('0x14')](''):''),'priority':_0x917e21++},_0x57ca0a));if(_0x4edf40[_0x2116('0xc')]){_0x2c44ea[_0x2116('0x8')](_['merge']({'app':'StopMixMonitor','priority':_0x917e21++},_0x57ca0a));}return _0x2c44ea;};var getChanSpyApplications=function(_0x4f0f50,_0x1de05d){var _0x478c22=[];for(var _0x47f301=0x0,_0x23e4c9=0x1;_0x47f301<_0x1de05d[_0x2116('0x15')];_0x47f301++,_0x23e4c9=0x1){_0x478c22=_0x478c22[_0x2116('0x16')](getUserApplications(_0x4f0f50,_0x1de05d[_0x47f301],_0x1de05d[_0x47f301][_0x2116('0x17')]));if(_0x1de05d[_0x47f301]['internal']!=_0x1de05d[_0x47f301][_0x2116('0x18')]){_0x478c22=_0x478c22[_0x2116('0x16')](getUserApplications(_0x4f0f50,_0x1de05d[_0x47f301],_0x1de05d[_0x47f301][_0x2116('0x18')]));}}return _0x478c22;};var getChanSpyPromise=function(_0x2e8755,_0x43e861){return new BPromise(function(_0x427766,_0x471eff){return _0x2e8755[_0x2116('0x19')][_0x2116('0x1a')]({'attributes':['id',_0x2116('0x18'),_0x2116('0x17')],'where':{'role':_0x2116('0x1b'),'chanspy':!![]},'raw':!![]})[_0x2116('0x1c')](function(_0x25f16d){if(_0x25f16d){return _0x427766(getChanSpyApplications(_0x43e861,_0x25f16d));}return _0x427766([]);})[_0x2116('0x1d')](function(_0x1202f6){_0x471eff(_0x1202f6);});});};module[_0x2116('0x1e')]=function(_0x2198e4,_0x3b1ab6){var _0x41de0e=_0x2198e4['models'];return _0x2198e4[_0x2116('0x1f')](_0x2116('0x20'),attributes,{'tableName':_0x2116('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xf51bdc,_0x58e9c3,_0x292e52){return getChanSpyPromise(_0x41de0e,_0xf51bdc)[_0x2116('0x1c')](function(_0x4475a1){if(_0x4475a1&&_0x4475a1[_0x2116('0x15')]){return _0x41de0e[_0x2116('0x22')][_0x2116('0x23')](_0x4475a1);}})['then'](function(){_0x292e52();})[_0x2116('0x1d')](function(_0x421d04){_0x292e52(_0x421d04);});},'afterUpdate':function(_0x67b007,_0x40ea99,_0x51d2e5){return _0x41de0e[_0x2116('0x22')][_0x2116('0x24')]({'where':{'ChanSpyId':_0x67b007['id']}})[_0x2116('0x1c')](function(){return getChanSpyPromise(_0x41de0e,_0x67b007);})[_0x2116('0x1c')](function(_0x58a1f2){if(_0x58a1f2&&_0x58a1f2[_0x2116('0x15')]){return _0x41de0e[_0x2116('0x22')][_0x2116('0x23')](_0x58a1f2);}})['then'](function(){_0x51d2e5();})[_0x2116('0x1d')](function(_0xcb055e){_0x51d2e5(_0xcb055e);});},'afterDestroy':function(_0x21aa2f,_0x2ff72f,_0x30a294){return _0x41de0e[_0x2116('0x22')][_0x2116('0x24')]({'where':{'ChanSpyId':_0x21aa2f['id']}})[_0x2116('0x1c')](function(){_0x30a294();})[_0x2116('0x1d')](function(_0x573f5c){_0x30a294(_0x573f5c);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 7949dec..c729c67 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 _0x1b32=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceChanSpy,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x28162b,_0x3e6d88){var _0x3cbfee=function(_0x577aaa){while(--_0x577aaa){_0x28162b['push'](_0x28162b['shift']());}};_0x3cbfee(++_0x3e6d88);}(_0x1b32,0x85));var _0x21b3=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x1b32[_0x5f3f88];return _0xd08119;};'use strict';var _=require('lodash');var util=require(_0x21b3('0x0'));var moment=require(_0x21b3('0x1'));var BPromise=require(_0x21b3('0x2'));var rs=require(_0x21b3('0x3'));var fs=require('fs');var Redis=require(_0x21b3('0x4'));var db=require(_0x21b3('0x5'))['db'];var utils=require(_0x21b3('0x6'));var logger=require(_0x21b3('0x7'))(_0x21b3('0x8'));var config=require(_0x21b3('0x9'));var jayson=require(_0x21b3('0xa'));var client=jayson[_0x21b3('0xb')][_0x21b3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x47516a,_0x21e881,_0x5c0f36){return new BPromise(function(_0x45b1b7,_0x5639eb){return client['request'](_0x47516a,_0x5c0f36)['then'](function(_0xd7a981){logger[_0x21b3('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x21e881,'request\x20sent');logger[_0x21b3('0xe')](_0x21b3('0xf'),_0x21e881,_0x21b3('0x10'),JSON['stringify'](_0xd7a981));if(_0xd7a981[_0x21b3('0x11')]){if(_0xd7a981[_0x21b3('0x11')][_0x21b3('0x12')]===0x1f4){logger[_0x21b3('0x11')](_0x21b3('0x13'),_0x21e881,_0xd7a981[_0x21b3('0x11')][_0x21b3('0x14')]);return _0x5639eb(_0xd7a981[_0x21b3('0x11')][_0x21b3('0x14')]);}logger['error'](_0x21b3('0x13'),_0x21e881,_0xd7a981[_0x21b3('0x11')][_0x21b3('0x14')]);return _0x45b1b7(_0xd7a981['error'][_0x21b3('0x14')]);}else{logger['info'](_0x21b3('0x13'),_0x21e881,'request\x20sent');_0x45b1b7(_0xd7a981[_0x21b3('0x15')][_0x21b3('0x14')]);}})[_0x21b3('0x16')](function(_0x4217d6){logger['error'](_0x21b3('0x13'),_0x21e881,_0x4217d6);_0x5639eb(_0x4217d6);});});} \ No newline at end of file +var _0xe5b5=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','VoiceChanSpy,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x5aa373,_0x54c7f4){var _0x590e8e=function(_0x505e62){while(--_0x505e62){_0x5aa373['push'](_0x5aa373['shift']());}};_0x590e8e(++_0x54c7f4);}(_0xe5b5,0x12b));var _0x5e5b=function(_0xd02bb,_0x26e2d0){_0xd02bb=_0xd02bb-0x0;var _0x1cdf23=_0xe5b5[_0xd02bb];return _0x1cdf23;};'use strict';var _=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var moment=require(_0x5e5b('0x2'));var BPromise=require(_0x5e5b('0x3'));var rs=require(_0x5e5b('0x4'));var fs=require('fs');var Redis=require(_0x5e5b('0x5'));var db=require(_0x5e5b('0x6'))['db'];var utils=require(_0x5e5b('0x7'));var logger=require(_0x5e5b('0x8'))(_0x5e5b('0x9'));var config=require(_0x5e5b('0xa'));var jayson=require(_0x5e5b('0xb'));var client=jayson[_0x5e5b('0xc')][_0x5e5b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x545eb3,_0x29db2c,_0xe089b1){return new BPromise(function(_0xcbd478,_0x258414){return client[_0x5e5b('0xe')](_0x545eb3,_0xe089b1)[_0x5e5b('0xf')](function(_0x3a37db){logger[_0x5e5b('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x29db2c,_0x5e5b('0x11'));logger['debug'](_0x5e5b('0x12'),_0x29db2c,_0x5e5b('0x11'),JSON[_0x5e5b('0x13')](_0x3a37db));if(_0x3a37db[_0x5e5b('0x14')]){if(_0x3a37db['error']['code']===0x1f4){logger['error'](_0x5e5b('0x15'),_0x29db2c,_0x3a37db[_0x5e5b('0x14')][_0x5e5b('0x16')]);return _0x258414(_0x3a37db[_0x5e5b('0x14')][_0x5e5b('0x16')]);}logger[_0x5e5b('0x14')](_0x5e5b('0x15'),_0x29db2c,_0x3a37db['error'][_0x5e5b('0x16')]);return _0xcbd478(_0x3a37db[_0x5e5b('0x14')]['message']);}else{logger[_0x5e5b('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x29db2c,'request\x20sent');_0xcbd478(_0x3a37db[_0x5e5b('0x17')][_0x5e5b('0x16')]);}})[_0x5e5b('0x18')](function(_0x5c7148){logger[_0x5e5b('0x14')]('VoiceChanSpy,\x20%s,\x20%s',_0x29db2c,_0x5c7148);_0x258414(_0x5c7148);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 8778dce..39a6a73 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 _0x8470=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','isAuthenticated','index','post','create','put','/:id','update','delete','destroy','multer','util','connect-timeout','express'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x8470,0x1d0));var _0x0847=function(_0x10ee67,_0xcc95c3){_0x10ee67=_0x10ee67-0x0;var _0x2536c1=_0x8470[_0x10ee67];return _0x2536c1;};'use strict';var multer=require(_0x0847('0x0'));var util=require(_0x0847('0x1'));var path=require('path');var timeout=require(_0x0847('0x2'));var express=require(_0x0847('0x3'));var router=express[_0x0847('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0847('0x5'));var interaction=require(_0x0847('0x6'));var config=require(_0x0847('0x7'));var controller=require(_0x0847('0x8'));router['get']('/',auth[_0x0847('0x9')](),controller[_0x0847('0xa')]);router['get']('/:id',auth[_0x0847('0x9')](),controller['show']);router[_0x0847('0xb')]('/',auth[_0x0847('0x9')](),controller[_0x0847('0xc')]);router[_0x0847('0xd')](_0x0847('0xe'),auth[_0x0847('0x9')](),controller[_0x0847('0xf')]);router[_0x0847('0x10')](_0x0847('0xe'),auth[_0x0847('0x9')](),controller[_0x0847('0x11')]);module['exports']=router; \ No newline at end of file +var _0xa0ae=['put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','isAuthenticated','index','/:id','show','post','create'];(function(_0x2f5891,_0x5215fa){var _0x2dbe99=function(_0x44508d){while(--_0x44508d){_0x2f5891['push'](_0x2f5891['shift']());}};_0x2dbe99(++_0x5215fa);}(_0xa0ae,0x194));var _0xea0a=function(_0x20a1b0,_0x18fe84){_0x20a1b0=_0x20a1b0-0x0;var _0x321e14=_0xa0ae[_0x20a1b0];return _0x321e14;};'use strict';var multer=require('multer');var util=require(_0xea0a('0x0'));var path=require(_0xea0a('0x1'));var timeout=require(_0xea0a('0x2'));var express=require(_0xea0a('0x3'));var router=express[_0xea0a('0x4')]();var fs_extra=require(_0xea0a('0x5'));var auth=require(_0xea0a('0x6'));var interaction=require(_0xea0a('0x7'));var config=require(_0xea0a('0x8'));var controller=require(_0xea0a('0x9'));router['get']('/',auth[_0xea0a('0xa')](),controller[_0xea0a('0xb')]);router['get'](_0xea0a('0xc'),auth[_0xea0a('0xa')](),controller[_0xea0a('0xd')]);router[_0xea0a('0xe')]('/',auth[_0xea0a('0xa')](),controller[_0xea0a('0xf')]);router[_0xea0a('0x10')](_0xea0a('0xc'),auth[_0xea0a('0xa')](),controller[_0xea0a('0x11')]);router['delete'](_0xea0a('0xc'),auth[_0xea0a('0xa')](),controller[_0xea0a('0x12')]);module[_0xea0a('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 540e23f..e262565 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 _0x90ff=['BOOLEAN','sequelize','STRING','name'];(function(_0xd04139,_0x47094a){var _0x2afb4a=function(_0x4ecce5){while(--_0x4ecce5){_0xd04139['push'](_0xd04139['shift']());}};_0x2afb4a(++_0x47094a);}(_0x90ff,0x1d9));var _0xf90f=function(_0x21d464,_0x17f796){_0x21d464=_0x21d464-0x0;var _0x287666=_0x90ff[_0x21d464];return _0x287666;};'use strict';var Sequelize=require(_0xf90f('0x0'));module['exports']={'name':{'type':Sequelize[_0xf90f('0x1')],'unique':_0xf90f('0x2')},'description':{'type':Sequelize[_0xf90f('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xf90f('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x60c3=['exports','STRING','BOOLEAN','sequelize'];(function(_0x19aa25,_0x2d838d){var _0x907200=function(_0xe4a724){while(--_0xe4a724){_0x19aa25['push'](_0x19aa25['shift']());}};_0x907200(++_0x2d838d);}(_0x60c3,0x173));var _0x360c=function(_0x5305ab,_0x8581ed){_0x5305ab=_0x5305ab-0x0;var _0x2c17a9=_0x60c3[_0x5305ab];return _0x2c17a9;};'use strict';var Sequelize=require(_0x360c('0x0'));module[_0x360c('0x1')]={'name':{'type':Sequelize[_0x360c('0x2')],'unique':'name'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x360c('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 373f219..580921f 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 _0xed5e=['count','set','apply','update','destroy','Contexts','UserProfileResource','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','sort','where','pick','VIRTUAL','merge','options','VoiceContext','findAll','rows','params','includeAll','include','find','create','body','join','server/files/templates/context.ejs','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','role','get','UserProfileSection','userProfileId','autoAssociation','readFileSync','root','render','utf8','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','message','result','catch','VoiceContext,\x20%s,\x20%s','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x345612,_0x496133){var _0x1ab8c3=function(_0x219d9f){while(--_0x219d9f){_0x345612['push'](_0x345612['shift']());}};_0x1ab8c3(++_0x496133);}(_0xed5e,0x1ce));var _0xeed5=function(_0x38cec7,_0x2358b2){_0x38cec7=_0x38cec7-0x0;var _0x3e89d7=_0xed5e[_0x38cec7];return _0x3e89d7;};'use strict';var emlformat=require(_0xeed5('0x0'));var rimraf=require(_0xeed5('0x1'));var zipdir=require(_0xeed5('0x2'));var jsonpatch=require(_0xeed5('0x3'));var rp=require(_0xeed5('0x4'));var moment=require(_0xeed5('0x5'));var BPromise=require(_0xeed5('0x6'));var Mustache=require('mustache');var util=require(_0xeed5('0x7'));var path=require(_0xeed5('0x8'));var sox=require(_0xeed5('0x9'));var csv=require('to-csv');var ejs=require(_0xeed5('0xa'));var fs=require('fs');var fs_extra=require(_0xeed5('0xb'));var _=require(_0xeed5('0xc'));var squel=require(_0xeed5('0xd'));var crypto=require(_0xeed5('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xeed5('0xf'));var querystring=require('querystring');var Papa=require(_0xeed5('0x10'));var Redis=require(_0xeed5('0x11'));var authService=require(_0xeed5('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xeed5('0x13'));var hardwareService=require(_0xeed5('0x14'));var logger=require(_0xeed5('0x15'))(_0xeed5('0x16'));var utils=require(_0xeed5('0x17'));var config=require(_0xeed5('0x18'));var licenseUtil=require(_0xeed5('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0xeed5('0x1a'));var client=jayson[_0xeed5('0x1b')][_0xeed5('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x479930,_0x149bb5,_0x52d1d4,_0xb9e075){return new BPromise(function(_0x16af75,_0x248573){var _0x1b97ac=_0xb9e075||client;return _0x1b97ac[_0xeed5('0x1d')](_0x479930,_0x52d1d4)[_0xeed5('0x1e')](function(_0x1b5ce7){logger[_0xeed5('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x149bb5,_0xeed5('0x20'));logger[_0xeed5('0x21')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x149bb5,'request\x20sent',JSON[_0xeed5('0x22')](_0x1b5ce7));if(_0x1b5ce7[_0xeed5('0x23')]){if(_0x1b5ce7[_0xeed5('0x23')][_0xeed5('0x24')]===0x1f4){logger[_0xeed5('0x23')]('VoiceContext,\x20%s,\x20%s',_0x149bb5,_0x1b5ce7[_0xeed5('0x23')][_0xeed5('0x25')]);return _0x248573(_0x1b5ce7['error'][_0xeed5('0x25')]);}logger[_0xeed5('0x23')]('VoiceContext,\x20%s,\x20%s',_0x149bb5,_0x1b5ce7[_0xeed5('0x23')][_0xeed5('0x25')]);return _0x16af75(_0x1b5ce7[_0xeed5('0x23')][_0xeed5('0x25')]);}else{logger[_0xeed5('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x149bb5,_0xeed5('0x20'));_0x16af75(_0x1b5ce7[_0xeed5('0x26')][_0xeed5('0x25')]);}})[_0xeed5('0x27')](function(_0x5bc998){logger[_0xeed5('0x23')](_0xeed5('0x28'),_0x149bb5,_0x5bc998);_0x248573(_0x5bc998);});});}function respondWithStatusCode(_0x3a7251,_0xd5b5c5){_0xd5b5c5=_0xd5b5c5||0xcc;return function(_0x78c004){if(_0x78c004){return _0x3a7251[_0xeed5('0x29')](_0xd5b5c5);}return _0x3a7251[_0xeed5('0x2a')](_0xd5b5c5)[_0xeed5('0x2b')]();};}function respondWithResult(_0x4b309e,_0x777359){_0x777359=_0x777359||0xc8;return function(_0x38df5a){if(_0x38df5a){return _0x4b309e['status'](_0x777359)[_0xeed5('0x2c')](_0x38df5a);}};}function respondWithFilteredResult(_0x3fa60b,_0x14e34a){return function(_0xefb7e2){if(_0xefb7e2){var _0xc6eeb7=typeof _0x14e34a[_0xeed5('0x2d')]===_0xeed5('0x2e')&&typeof _0x14e34a[_0xeed5('0x2f')]==='undefined';var _0x4977c0=_0xefb7e2[_0xeed5('0x30')];var _0x3148e0=_0xc6eeb7?0x0:_0x14e34a[_0xeed5('0x2d')];var _0xea677b=_0xc6eeb7?_0xefb7e2[_0xeed5('0x30')]:_0x14e34a[_0xeed5('0x2d')]+_0x14e34a[_0xeed5('0x2f')];var _0x374e70;if(_0xea677b>=_0x4977c0){_0xea677b=_0x4977c0;_0x374e70=0xc8;}else{_0x374e70=0xce;}_0x3fa60b[_0xeed5('0x2a')](_0x374e70);return _0x3fa60b[_0xeed5('0x31')]('Content-Range',_0x3148e0+'-'+_0xea677b+'/'+_0x4977c0)[_0xeed5('0x2c')](_0xefb7e2);}return null;};}function patchUpdates(_0x3c08d9){return function(_0x129473){try{jsonpatch[_0xeed5('0x32')](_0x129473,_0x3c08d9,!![]);}catch(_0x5858c9){return BPromise['reject'](_0x5858c9);}return _0x129473['save']();};}function saveUpdates(_0x2e478e,_0x5be4a6){return function(_0x5be7a4){if(_0x5be7a4){return _0x5be7a4[_0xeed5('0x33')](_0x2e478e)[_0xeed5('0x1e')](function(_0x3b5af0){return _0x3b5af0;});}return null;};}function removeEntity(_0x5aa79e,_0x4b2a9b){return function(_0x3c2c65){if(_0x3c2c65){return _0x3c2c65[_0xeed5('0x34')]()[_0xeed5('0x1e')](function(){var _0x307c01=_0x3c2c65['get']({'plain':!![]});var _0x3f4f98=_0xeed5('0x35');return db[_0xeed5('0x36')][_0xeed5('0x34')]({'where':{'type':_0x3f4f98,'resourceId':_0x307c01['id']}})[_0xeed5('0x1e')](function(){return _0x3c2c65;});})[_0xeed5('0x1e')](function(){_0x5aa79e['status'](0xcc)[_0xeed5('0x2b')]();});}};}function handleEntityNotFound(_0x4df78f,_0x52595a){return function(_0x57b569){if(!_0x57b569){_0x4df78f[_0xeed5('0x29')](0x194);}return _0x57b569;};}function handleError(_0x574237,_0x3344c3){_0x3344c3=_0x3344c3||0x1f4;return function(_0x12b847){logger[_0xeed5('0x23')](_0x12b847[_0xeed5('0x37')]);if(_0x12b847[_0xeed5('0x38')]){delete _0x12b847['name'];}_0x574237[_0xeed5('0x2a')](_0x3344c3)[_0xeed5('0x39')](_0x12b847);};}exports['index']=function(_0x7c6258,_0x19f3dd){var _0x48a18c={},_0x19220f={},_0x4c1df1={'count':0x0,'rows':[]};var _0x1794bc=_[_0xeed5('0x3a')](db['VoiceContext'][_0xeed5('0x3b')],function(_0xbe798c){return{'name':_0xbe798c[_0xeed5('0x3c')],'type':_0xbe798c[_0xeed5('0x3d')][_0xeed5('0x3e')]};});_0x19220f[_0xeed5('0x3f')]=_[_0xeed5('0x3a')](_0x1794bc,_0xeed5('0x38'));_0x19220f['query']=_[_0xeed5('0x40')](_0x7c6258[_0xeed5('0x41')]);_0x19220f[_0xeed5('0x42')]=_['intersection'](_0x19220f[_0xeed5('0x3f')],_0x19220f[_0xeed5('0x41')]);_0x48a18c[_0xeed5('0x43')]=_[_0xeed5('0x44')](_0x19220f[_0xeed5('0x3f')],qs[_0xeed5('0x45')](_0x7c6258[_0xeed5('0x41')][_0xeed5('0x45')]));_0x48a18c[_0xeed5('0x43')]=_0x48a18c[_0xeed5('0x43')]['length']?_0x48a18c[_0xeed5('0x43')]:_0x19220f[_0xeed5('0x3f')];if(!_0x7c6258['query'][_0xeed5('0x46')]('nolimit')){_0x48a18c['limit']=qs[_0xeed5('0x2f')](_0x7c6258[_0xeed5('0x41')]['limit']);_0x48a18c[_0xeed5('0x2d')]=qs[_0xeed5('0x2d')](_0x7c6258[_0xeed5('0x41')][_0xeed5('0x2d')]);}_0x48a18c['order']=qs['sort'](_0x7c6258[_0xeed5('0x41')][_0xeed5('0x47')]);_0x48a18c[_0xeed5('0x48')]=qs[_0xeed5('0x42')](_[_0xeed5('0x49')](_0x7c6258[_0xeed5('0x41')],_0x19220f[_0xeed5('0x42')]),_0x1794bc);if(_0x7c6258[_0xeed5('0x41')]['filter']){_0x48a18c[_0xeed5('0x48')]=_['merge'](_0x48a18c['where'],{'$or':_[_0xeed5('0x3a')](_0x1794bc,function(_0x3d2f24){if(_0x3d2f24[_0xeed5('0x3d')]!==_0xeed5('0x4a')){var _0x3da9c6={};_0x3da9c6[_0x3d2f24[_0xeed5('0x38')]]={'$like':'%'+_0x7c6258[_0xeed5('0x41')]['filter']+'%'};return _0x3da9c6;}})});}_0x48a18c=_[_0xeed5('0x4b')]({},_0x48a18c,_0x7c6258[_0xeed5('0x4c')]);var _0x2b411d={'where':_0x48a18c['where']};return db['VoiceContext'][_0xeed5('0x30')](_0x2b411d)['then'](function(_0x54ee26){_0x4c1df1[_0xeed5('0x30')]=_0x54ee26;if(_0x7c6258[_0xeed5('0x41')]['includeAll']){_0x48a18c['include']=[{'all':!![]}];}return db[_0xeed5('0x4d')][_0xeed5('0x4e')](_0x48a18c);})[_0xeed5('0x1e')](function(_0x46703b){_0x4c1df1[_0xeed5('0x4f')]=_0x46703b;return _0x4c1df1;})[_0xeed5('0x1e')](respondWithFilteredResult(_0x19f3dd,_0x48a18c))[_0xeed5('0x27')](handleError(_0x19f3dd,null));};exports['show']=function(_0x68bfc8,_0x3279c9){var _0x3f82e6={'raw':![],'where':{'id':_0x68bfc8[_0xeed5('0x50')]['id']}},_0x1beb12={};_0x1beb12[_0xeed5('0x3f')]=_['keys'](db[_0xeed5('0x4d')][_0xeed5('0x3b')]);_0x1beb12[_0xeed5('0x41')]=_[_0xeed5('0x40')](_0x68bfc8[_0xeed5('0x41')]);_0x1beb12[_0xeed5('0x42')]=_['intersection'](_0x1beb12[_0xeed5('0x3f')],_0x1beb12[_0xeed5('0x41')]);_0x3f82e6['attributes']=_[_0xeed5('0x44')](_0x1beb12[_0xeed5('0x3f')],qs['fields'](_0x68bfc8[_0xeed5('0x41')][_0xeed5('0x45')]));_0x3f82e6[_0xeed5('0x43')]=_0x3f82e6[_0xeed5('0x43')]['length']?_0x3f82e6['attributes']:_0x1beb12[_0xeed5('0x3f')];if(_0x68bfc8[_0xeed5('0x41')][_0xeed5('0x51')]){_0x3f82e6[_0xeed5('0x52')]=[{'all':!![]}];}_0x3f82e6=_[_0xeed5('0x4b')]({},_0x3f82e6,_0x68bfc8[_0xeed5('0x4c')]);return db[_0xeed5('0x4d')][_0xeed5('0x53')](_0x3f82e6)[_0xeed5('0x1e')](handleEntityNotFound(_0x3279c9,null))[_0xeed5('0x1e')](respondWithResult(_0x3279c9,null))[_0xeed5('0x27')](handleError(_0x3279c9,null));};exports['create']=function(_0x4c13d8,_0x13a05d,_0x22cb10){var _0xfef476;return db[_0xeed5('0x4d')][_0xeed5('0x54')](_0x4c13d8[_0xeed5('0x55')],{'raw':!![]})[_0xeed5('0x1e')](function(_0x44ce5a){_0xfef476=_0x44ce5a;return db[_0xeed5('0x4d')][_0xeed5('0x4e')]({'raw':!![]});})[_0xeed5('0x1e')](function(_0x18c393){var _0x7ae544=fs['readFileSync'](path[_0xeed5('0x56')](config['root'],_0xeed5('0x57')),'utf8');var _0x52e882=ejs['render'](_0x7ae544,{'contexts':_0x18c393||[]});fs[_0xeed5('0x58')](_0xeed5('0x59'),_0x52e882);})[_0xeed5('0x1e')](function(){return respondWithRpcPromise(_0xeed5('0x5a'),_0xeed5('0x54'),{'module':_0xeed5('0x5b')});})['then'](function(){var _0x575892=_0x4c13d8[_0xeed5('0x5c')]['get']({'plain':!![]});if(!_0x575892)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x575892[_0xeed5('0x5d')]===_0xeed5('0x5c')){var _0x14e787=_0xfef476[_0xeed5('0x5e')]({'plain':!![]});return db[_0xeed5('0x5f')][_0xeed5('0x53')]({'where':{'name':_0xeed5('0x35'),'userProfileId':_0x575892[_0xeed5('0x60')]},'raw':!![]})[_0xeed5('0x1e')](function(_0x50476f){if(_0x50476f&&_0x50476f[_0xeed5('0x61')]===0x0){return db['UserProfileResource']['create']({'name':_0x14e787[_0xeed5('0x38')],'resourceId':_0x14e787['id'],'type':_0x50476f['name'],'sectionId':_0x50476f['id']},{})[_0xeed5('0x1e')](function(){return _0xfef476;});}else{return _0xfef476;}})[_0xeed5('0x27')](function(_0xf8e61){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf8e61);throw _0xf8e61;});}return _0xfef476;})[_0xeed5('0x1e')](respondWithResult(_0x13a05d,0xc9))[_0xeed5('0x27')](handleError(_0x13a05d,null));};exports[_0xeed5('0x33')]=function(_0x518d8d,_0x3101f8,_0x30f7dc){var _0x58bf6f;return db['VoiceContext']['find']({'where':{'id':_0x518d8d['params']['id']}})['then'](handleEntityNotFound(_0x3101f8,null))[_0xeed5('0x1e')](saveUpdates(_0x518d8d['body'],null))[_0xeed5('0x1e')](function(_0x3de974){if(_0x3de974){_0x58bf6f=_0x3de974;return db[_0xeed5('0x4d')]['findAll']({'raw':!![]});}})['then'](function(_0x31d757){var _0x4ed77a=fs[_0xeed5('0x62')](path[_0xeed5('0x56')](config[_0xeed5('0x63')],'server/files/templates/context.ejs'),'utf8');var _0x4cbd52=ejs[_0xeed5('0x64')](_0x4ed77a,{'contexts':_0x31d757||[]});fs[_0xeed5('0x58')](_0xeed5('0x59'),_0x4cbd52);})[_0xeed5('0x1e')](function(){return respondWithRpcPromise(_0xeed5('0x5a'),_0xeed5('0x33'),{'module':_0xeed5('0x5b')});})[_0xeed5('0x1e')](function(){return _0x58bf6f;})[_0xeed5('0x1e')](respondWithResult(_0x3101f8,null))[_0xeed5('0x27')](handleError(_0x3101f8,null));};exports[_0xeed5('0x34')]=function(_0x519ee1,_0x2abe0b,_0x4de3b5){var _0x4c63fd;return db[_0xeed5('0x4d')][_0xeed5('0x53')]({'where':{'id':_0x519ee1[_0xeed5('0x50')]['id']}})['then'](handleEntityNotFound(_0x2abe0b,null))[_0xeed5('0x1e')](removeEntity(_0x2abe0b,null))['then'](function(){return db[_0xeed5('0x4d')][_0xeed5('0x4e')]({'raw':!![]});})[_0xeed5('0x1e')](function(_0x341653){var _0x58d7da=fs[_0xeed5('0x62')](path['join'](config[_0xeed5('0x63')],_0xeed5('0x57')),_0xeed5('0x65'));var _0x591a19=ejs[_0xeed5('0x64')](_0x58d7da,{'contexts':_0x341653});fs[_0xeed5('0x58')](_0xeed5('0x59'),_0x591a19);return respondWithRpcPromise(_0xeed5('0x5a'),_0xeed5('0x34'),{'module':_0xeed5('0x5b')});})[_0xeed5('0x27')](handleError(_0x2abe0b,null));}; \ No newline at end of file +var _0x9177=['set','Content-Range','apply','reject','save','update','get','Contexts','destroy','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','include','rows','show','includeAll','find','create','body','findAll','readFileSync','join','root','server/files/templates/context.ejs','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','params','utf8','writeFileSync','eml-format','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','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','jayson/promise','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','json','offset','undefined','count','limit','status'];(function(_0x1e0020,_0x4edeb7){var _0x1f44f5=function(_0x7682a0){while(--_0x7682a0){_0x1e0020['push'](_0x1e0020['shift']());}};_0x1f44f5(++_0x4edeb7);}(_0x9177,0xa3));var _0x7917=function(_0xd63e3a,_0x1bd6eb){_0xd63e3a=_0xd63e3a-0x0;var _0x19c178=_0x9177[_0xd63e3a];return _0x19c178;};'use strict';var emlformat=require(_0x7917('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7917('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7917('0x2'));var moment=require(_0x7917('0x3'));var BPromise=require(_0x7917('0x4'));var Mustache=require('mustache');var util=require(_0x7917('0x5'));var path=require('path');var sox=require(_0x7917('0x6'));var csv=require(_0x7917('0x7'));var ejs=require(_0x7917('0x8'));var fs=require('fs');var fs_extra=require(_0x7917('0x9'));var _=require(_0x7917('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7917('0xb'));var deskjs=require(_0x7917('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7917('0xd'));var Papa=require(_0x7917('0xe'));var Redis=require(_0x7917('0xf'));var authService=require(_0x7917('0x10'));var qs=require(_0x7917('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7917('0x12'));var logger=require(_0x7917('0x13'))('api');var utils=require(_0x7917('0x14'));var config=require(_0x7917('0x15'));var licenseUtil=require(_0x7917('0x16'));var db=require(_0x7917('0x17'))['db'];var jayson=require(_0x7917('0x18'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x15af18,_0x1292b7,_0x5b2687,_0x444d11){return new BPromise(function(_0x45012a,_0x74cc41){var _0x19e409=_0x444d11||client;return _0x19e409[_0x7917('0x19')](_0x15af18,_0x5b2687)[_0x7917('0x1a')](function(_0xddbaf2){logger[_0x7917('0x1b')](_0x7917('0x1c'),_0x1292b7,_0x7917('0x1d'));logger[_0x7917('0x1e')](_0x7917('0x1f'),_0x1292b7,'request\x20sent',JSON[_0x7917('0x20')](_0xddbaf2));if(_0xddbaf2[_0x7917('0x21')]){if(_0xddbaf2[_0x7917('0x21')][_0x7917('0x22')]===0x1f4){logger['error'](_0x7917('0x1c'),_0x1292b7,_0xddbaf2[_0x7917('0x21')][_0x7917('0x23')]);return _0x74cc41(_0xddbaf2['error'][_0x7917('0x23')]);}logger['error'](_0x7917('0x1c'),_0x1292b7,_0xddbaf2[_0x7917('0x21')][_0x7917('0x23')]);return _0x45012a(_0xddbaf2['error'][_0x7917('0x23')]);}else{logger[_0x7917('0x1b')](_0x7917('0x1c'),_0x1292b7,'request\x20sent');_0x45012a(_0xddbaf2['result'][_0x7917('0x23')]);}})[_0x7917('0x24')](function(_0x11d6a4){logger[_0x7917('0x21')](_0x7917('0x1c'),_0x1292b7,_0x11d6a4);_0x74cc41(_0x11d6a4);});});}function respondWithStatusCode(_0x34a122,_0x567eda){_0x567eda=_0x567eda||0xcc;return function(_0x1576a7){if(_0x1576a7){return _0x34a122[_0x7917('0x25')](_0x567eda);}return _0x34a122['status'](_0x567eda)[_0x7917('0x26')]();};}function respondWithResult(_0x563bc6,_0x848e4d){_0x848e4d=_0x848e4d||0xc8;return function(_0x257d76){if(_0x257d76){return _0x563bc6['status'](_0x848e4d)[_0x7917('0x27')](_0x257d76);}};}function respondWithFilteredResult(_0x13b7ff,_0x5e8f9d){return function(_0xc8ba46){if(_0xc8ba46){var _0x3c1825=typeof _0x5e8f9d[_0x7917('0x28')]===_0x7917('0x29')&&typeof _0x5e8f9d['limit']===_0x7917('0x29');var _0x88d2f1=_0xc8ba46[_0x7917('0x2a')];var _0x3696de=_0x3c1825?0x0:_0x5e8f9d['offset'];var _0x87c86f=_0x3c1825?_0xc8ba46[_0x7917('0x2a')]:_0x5e8f9d[_0x7917('0x28')]+_0x5e8f9d[_0x7917('0x2b')];var _0x5f0179;if(_0x87c86f>=_0x88d2f1){_0x87c86f=_0x88d2f1;_0x5f0179=0xc8;}else{_0x5f0179=0xce;}_0x13b7ff[_0x7917('0x2c')](_0x5f0179);return _0x13b7ff[_0x7917('0x2d')](_0x7917('0x2e'),_0x3696de+'-'+_0x87c86f+'/'+_0x88d2f1)['json'](_0xc8ba46);}return null;};}function patchUpdates(_0x258a76){return function(_0x5eb29c){try{jsonpatch[_0x7917('0x2f')](_0x5eb29c,_0x258a76,!![]);}catch(_0x534357){return BPromise[_0x7917('0x30')](_0x534357);}return _0x5eb29c[_0x7917('0x31')]();};}function saveUpdates(_0x5dae5c,_0x2f6908){return function(_0x1adc2e){if(_0x1adc2e){return _0x1adc2e[_0x7917('0x32')](_0x5dae5c)['then'](function(_0x3a038b){return _0x3a038b;});}return null;};}function removeEntity(_0x2b38b7,_0xcd9ace){return function(_0xe2a16a){if(_0xe2a16a){return _0xe2a16a['destroy']()[_0x7917('0x1a')](function(){var _0x1b4ecc=_0xe2a16a[_0x7917('0x33')]({'plain':!![]});var _0x52fe35=_0x7917('0x34');return db['UserProfileResource'][_0x7917('0x35')]({'where':{'type':_0x52fe35,'resourceId':_0x1b4ecc['id']}})[_0x7917('0x1a')](function(){return _0xe2a16a;});})[_0x7917('0x1a')](function(){_0x2b38b7[_0x7917('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x740b6a,_0x4b02cc){return function(_0x18a361){if(!_0x18a361){_0x740b6a['sendStatus'](0x194);}return _0x18a361;};}function handleError(_0x380ba1,_0x2a69b8){_0x2a69b8=_0x2a69b8||0x1f4;return function(_0x23d2fb){logger[_0x7917('0x21')](_0x23d2fb[_0x7917('0x36')]);if(_0x23d2fb[_0x7917('0x37')]){delete _0x23d2fb[_0x7917('0x37')];}_0x380ba1[_0x7917('0x2c')](_0x2a69b8)[_0x7917('0x38')](_0x23d2fb);};}exports[_0x7917('0x39')]=function(_0x55592b,_0x476408){var _0x23b294={},_0x50bb95={},_0x49b5ac={'count':0x0,'rows':[]};var _0xc64f4f=_[_0x7917('0x3a')](db[_0x7917('0x3b')][_0x7917('0x3c')],function(_0x235640){return{'name':_0x235640[_0x7917('0x3d')],'type':_0x235640[_0x7917('0x3e')][_0x7917('0x3f')]};});_0x50bb95['model']=_[_0x7917('0x3a')](_0xc64f4f,_0x7917('0x37'));_0x50bb95[_0x7917('0x40')]=_[_0x7917('0x41')](_0x55592b[_0x7917('0x40')]);_0x50bb95[_0x7917('0x42')]=_['intersection'](_0x50bb95[_0x7917('0x43')],_0x50bb95[_0x7917('0x40')]);_0x23b294[_0x7917('0x44')]=_[_0x7917('0x45')](_0x50bb95[_0x7917('0x43')],qs[_0x7917('0x46')](_0x55592b[_0x7917('0x40')][_0x7917('0x46')]));_0x23b294[_0x7917('0x44')]=_0x23b294[_0x7917('0x44')][_0x7917('0x47')]?_0x23b294['attributes']:_0x50bb95[_0x7917('0x43')];if(!_0x55592b['query'][_0x7917('0x48')]('nolimit')){_0x23b294[_0x7917('0x2b')]=qs[_0x7917('0x2b')](_0x55592b[_0x7917('0x40')][_0x7917('0x2b')]);_0x23b294[_0x7917('0x28')]=qs['offset'](_0x55592b[_0x7917('0x40')]['offset']);}_0x23b294[_0x7917('0x49')]=qs[_0x7917('0x4a')](_0x55592b[_0x7917('0x40')][_0x7917('0x4a')]);_0x23b294[_0x7917('0x4b')]=qs[_0x7917('0x42')](_[_0x7917('0x4c')](_0x55592b[_0x7917('0x40')],_0x50bb95['filters']),_0xc64f4f);if(_0x55592b[_0x7917('0x40')][_0x7917('0x4d')]){_0x23b294[_0x7917('0x4b')]=_[_0x7917('0x4e')](_0x23b294[_0x7917('0x4b')],{'$or':_[_0x7917('0x3a')](_0xc64f4f,function(_0x4cd105){if(_0x4cd105[_0x7917('0x3e')]!==_0x7917('0x4f')){var _0xed6bfb={};_0xed6bfb[_0x4cd105['name']]={'$like':'%'+_0x55592b['query'][_0x7917('0x4d')]+'%'};return _0xed6bfb;}})});}_0x23b294=_['merge']({},_0x23b294,_0x55592b['options']);var _0x3342f5={'where':_0x23b294[_0x7917('0x4b')]};return db['VoiceContext']['count'](_0x3342f5)[_0x7917('0x1a')](function(_0x19ec02){_0x49b5ac[_0x7917('0x2a')]=_0x19ec02;if(_0x55592b[_0x7917('0x40')]['includeAll']){_0x23b294[_0x7917('0x50')]=[{'all':!![]}];}return db[_0x7917('0x3b')]['findAll'](_0x23b294);})[_0x7917('0x1a')](function(_0xc08fe){_0x49b5ac[_0x7917('0x51')]=_0xc08fe;return _0x49b5ac;})['then'](respondWithFilteredResult(_0x476408,_0x23b294))[_0x7917('0x24')](handleError(_0x476408,null));};exports[_0x7917('0x52')]=function(_0x953085,_0x5c96d5){var _0x5d927b={'raw':![],'where':{'id':_0x953085['params']['id']}},_0x5e4af9={};_0x5e4af9[_0x7917('0x43')]=_[_0x7917('0x41')](db['VoiceContext'][_0x7917('0x3c')]);_0x5e4af9[_0x7917('0x40')]=_[_0x7917('0x41')](_0x953085[_0x7917('0x40')]);_0x5e4af9['filters']=_[_0x7917('0x45')](_0x5e4af9[_0x7917('0x43')],_0x5e4af9[_0x7917('0x40')]);_0x5d927b[_0x7917('0x44')]=_[_0x7917('0x45')](_0x5e4af9[_0x7917('0x43')],qs['fields'](_0x953085['query'][_0x7917('0x46')]));_0x5d927b[_0x7917('0x44')]=_0x5d927b[_0x7917('0x44')][_0x7917('0x47')]?_0x5d927b['attributes']:_0x5e4af9[_0x7917('0x43')];if(_0x953085['query'][_0x7917('0x53')]){_0x5d927b[_0x7917('0x50')]=[{'all':!![]}];}_0x5d927b=_[_0x7917('0x4e')]({},_0x5d927b,_0x953085['options']);return db[_0x7917('0x3b')][_0x7917('0x54')](_0x5d927b)['then'](handleEntityNotFound(_0x5c96d5,null))['then'](respondWithResult(_0x5c96d5,null))[_0x7917('0x24')](handleError(_0x5c96d5,null));};exports[_0x7917('0x55')]=function(_0x3d757e,_0x2742a8,_0x3c7fc6){var _0x22f718;return db[_0x7917('0x3b')][_0x7917('0x55')](_0x3d757e[_0x7917('0x56')],{'raw':!![]})[_0x7917('0x1a')](function(_0x29d362){_0x22f718=_0x29d362;return db[_0x7917('0x3b')][_0x7917('0x57')]({'raw':!![]});})[_0x7917('0x1a')](function(_0xd198aa){var _0x10086b=fs[_0x7917('0x58')](path[_0x7917('0x59')](config[_0x7917('0x5a')],_0x7917('0x5b')),'utf8');var _0x301ca6=ejs[_0x7917('0x5c')](_0x10086b,{'contexts':_0xd198aa||[]});fs['writeFileSync'](_0x7917('0x5d'),_0x301ca6);})[_0x7917('0x1a')](function(){return respondWithRpcPromise(_0x7917('0x5e'),'create',{'module':_0x7917('0x5f')});})[_0x7917('0x1a')](function(){var _0x587739=_0x3d757e[_0x7917('0x60')][_0x7917('0x33')]({'plain':!![]});if(!_0x587739)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x587739['role']===_0x7917('0x60')){var _0x23aca8=_0x22f718['get']({'plain':!![]});return db[_0x7917('0x61')][_0x7917('0x54')]({'where':{'name':_0x7917('0x34'),'userProfileId':_0x587739[_0x7917('0x62')]},'raw':!![]})[_0x7917('0x1a')](function(_0x1f8240){if(_0x1f8240&&_0x1f8240[_0x7917('0x63')]===0x0){return db[_0x7917('0x64')]['create']({'name':_0x23aca8[_0x7917('0x37')],'resourceId':_0x23aca8['id'],'type':_0x1f8240[_0x7917('0x37')],'sectionId':_0x1f8240['id']},{})[_0x7917('0x1a')](function(){return _0x22f718;});}else{return _0x22f718;}})[_0x7917('0x24')](function(_0x32ccc7){logger[_0x7917('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32ccc7);throw _0x32ccc7;});}return _0x22f718;})[_0x7917('0x1a')](respondWithResult(_0x2742a8,0xc9))['catch'](handleError(_0x2742a8,null));};exports[_0x7917('0x32')]=function(_0x2ef230,_0x4eaaa1,_0x4ce673){var _0x57eaf5;return db['VoiceContext'][_0x7917('0x54')]({'where':{'id':_0x2ef230[_0x7917('0x65')]['id']}})[_0x7917('0x1a')](handleEntityNotFound(_0x4eaaa1,null))[_0x7917('0x1a')](saveUpdates(_0x2ef230['body'],null))[_0x7917('0x1a')](function(_0x36eadf){if(_0x36eadf){_0x57eaf5=_0x36eadf;return db['VoiceContext'][_0x7917('0x57')]({'raw':!![]});}})['then'](function(_0x1848a0){var _0xb6cfe8=fs[_0x7917('0x58')](path[_0x7917('0x59')](config[_0x7917('0x5a')],_0x7917('0x5b')),_0x7917('0x66'));var _0x421f81=ejs[_0x7917('0x5c')](_0xb6cfe8,{'contexts':_0x1848a0||[]});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x421f81);})['then'](function(){return respondWithRpcPromise(_0x7917('0x5e'),_0x7917('0x32'),{'module':_0x7917('0x5f')});})[_0x7917('0x1a')](function(){return _0x57eaf5;})[_0x7917('0x1a')](respondWithResult(_0x4eaaa1,null))[_0x7917('0x24')](handleError(_0x4eaaa1,null));};exports[_0x7917('0x35')]=function(_0x5c9813,_0x532c6c,_0x14abc0){var _0x4f4753;return db['VoiceContext'][_0x7917('0x54')]({'where':{'id':_0x5c9813[_0x7917('0x65')]['id']}})[_0x7917('0x1a')](handleEntityNotFound(_0x532c6c,null))[_0x7917('0x1a')](removeEntity(_0x532c6c,null))[_0x7917('0x1a')](function(){return db['VoiceContext'][_0x7917('0x57')]({'raw':!![]});})[_0x7917('0x1a')](function(_0x51a6eb){var _0x5bc937=fs[_0x7917('0x58')](path[_0x7917('0x59')](config[_0x7917('0x5a')],_0x7917('0x5b')),'utf8');var _0x49cec5=ejs[_0x7917('0x5c')](_0x5bc937,{'contexts':_0x51a6eb});fs[_0x7917('0x67')](_0x7917('0x5d'),_0x49cec5);return respondWithRpcPromise('Reload','destroy',{'module':_0x7917('0x5f')});})[_0x7917('0x24')](handleError(_0x532c6c,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index fc67946..a21c2ac 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 _0xf534=['exports','define','voice_contexts','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./voiceContext.attributes'];(function(_0x5c7e77,_0x372833){var _0x31e43c=function(_0x26fe61){while(--_0x26fe61){_0x5c7e77['push'](_0x5c7e77['shift']());}};_0x31e43c(++_0x372833);}(_0xf534,0x9f));var _0x4f53=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf534[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x4f53('0x0'));var util=require(_0x4f53('0x1'));var logger=require(_0x4f53('0x2'))(_0x4f53('0x3'));var moment=require(_0x4f53('0x4'));var BPromise=require('bluebird');var rp=require(_0x4f53('0x5'));var fs=require('fs');var path=require(_0x4f53('0x6'));var rimraf=require('rimraf');var config=require(_0x4f53('0x7'));var attributes=require(_0x4f53('0x8'));module[_0x4f53('0x9')]=function(_0x33a4df,_0x5b4f16){return _0x33a4df[_0x4f53('0xa')]('VoiceContext',attributes,{'tableName':_0x4f53('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x50b8=['api','request-promise','rimraf','../../config/environment','exports','VoiceContext','voice_contexts','lodash','util','../../config/logger'];(function(_0x51650e,_0x4f6626){var _0x3370f1=function(_0x5e85f2){while(--_0x5e85f2){_0x51650e['push'](_0x51650e['shift']());}};_0x3370f1(++_0x4f6626);}(_0x50b8,0x9d));var _0x850b=function(_0xeb01b2,_0x1050f3){_0xeb01b2=_0xeb01b2-0x0;var _0x58a8e7=_0x50b8[_0xeb01b2];return _0x58a8e7;};'use strict';var _=require(_0x850b('0x0'));var util=require(_0x850b('0x1'));var logger=require(_0x850b('0x2'))(_0x850b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x850b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x850b('0x5'));var config=require(_0x850b('0x6'));var attributes=require('./voiceContext.attributes');module[_0x850b('0x7')]=function(_0x5e29e8,_0x4e16f9){return _0x5e29e8['define'](_0x850b('0x8'),attributes,{'tableName':_0x850b('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 72335d7..9857fc9 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 _0xf8ff=['request\x20sent','debug','stringify','error','code','message','moment','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','info','VoiceContext,\x20%s,\x20%s'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0xf8ff,0x127));var _0xff8f=function(_0x1780f8,_0x11ba93){_0x1780f8=_0x1780f8-0x0;var _0x33a410=_0xf8ff[_0x1780f8];return _0x33a410;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xff8f('0x0'));var BPromise=require('bluebird');var rs=require(_0xff8f('0x1'));var fs=require('fs');var Redis=require(_0xff8f('0x2'));var db=require(_0xff8f('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xff8f('0x4'));var config=require('../../config/environment');var jayson=require(_0xff8f('0x5'));var client=jayson[_0xff8f('0x6')][_0xff8f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4d1e1b,_0x57a767,_0x10bb20){return new BPromise(function(_0x2898af,_0x5ba0fc){return client[_0xff8f('0x8')](_0x4d1e1b,_0x10bb20)['then'](function(_0x5a090a){logger[_0xff8f('0x9')](_0xff8f('0xa'),_0x57a767,_0xff8f('0xb'));logger[_0xff8f('0xc')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x57a767,_0xff8f('0xb'),JSON[_0xff8f('0xd')](_0x5a090a));if(_0x5a090a[_0xff8f('0xe')]){if(_0x5a090a['error'][_0xff8f('0xf')]===0x1f4){logger['error'](_0xff8f('0xa'),_0x57a767,_0x5a090a[_0xff8f('0xe')][_0xff8f('0x10')]);return _0x5ba0fc(_0x5a090a[_0xff8f('0xe')][_0xff8f('0x10')]);}logger[_0xff8f('0xe')]('VoiceContext,\x20%s,\x20%s',_0x57a767,_0x5a090a[_0xff8f('0xe')][_0xff8f('0x10')]);return _0x2898af(_0x5a090a['error']['message']);}else{logger[_0xff8f('0x9')]('VoiceContext,\x20%s,\x20%s',_0x57a767,_0xff8f('0xb'));_0x2898af(_0x5a090a['result'][_0xff8f('0x10')]);}})['catch'](function(_0x399d55){logger[_0xff8f('0xe')](_0xff8f('0xa'),_0x57a767,_0x399d55);_0x5ba0fc(_0x399d55);});});} \ No newline at end of file +var _0x35ff=['request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xb723c9,_0x504795){var _0x3a6730=function(_0x2a2a14){while(--_0x2a2a14){_0xb723c9['push'](_0xb723c9['shift']());}};_0x3a6730(++_0x504795);}(_0x35ff,0xb3));var _0xf35f=function(_0x192610,_0x5d60e){_0x192610=_0x192610-0x0;var _0x18a859=_0x35ff[_0x192610];return _0x18a859;};'use strict';var _=require('lodash');var util=require(_0xf35f('0x0'));var moment=require(_0xf35f('0x1'));var BPromise=require('bluebird');var rs=require(_0xf35f('0x2'));var fs=require('fs');var Redis=require(_0xf35f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf35f('0x4'));var logger=require('../../config/logger')(_0xf35f('0x5'));var config=require(_0xf35f('0x6'));var jayson=require(_0xf35f('0x7'));var client=jayson[_0xf35f('0x8')][_0xf35f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4321e9,_0x58144a,_0x3e3aaa){return new BPromise(function(_0x1922af,_0x37df94){return client[_0xf35f('0xa')](_0x4321e9,_0x3e3aaa)['then'](function(_0x406771){logger[_0xf35f('0xb')](_0xf35f('0xc'),_0x58144a,_0xf35f('0xd'));logger[_0xf35f('0xe')](_0xf35f('0xf'),_0x58144a,_0xf35f('0xd'),JSON['stringify'](_0x406771));if(_0x406771[_0xf35f('0x10')]){if(_0x406771[_0xf35f('0x10')][_0xf35f('0x11')]===0x1f4){logger[_0xf35f('0x10')](_0xf35f('0xc'),_0x58144a,_0x406771[_0xf35f('0x10')][_0xf35f('0x12')]);return _0x37df94(_0x406771[_0xf35f('0x10')]['message']);}logger[_0xf35f('0x10')]('VoiceContext,\x20%s,\x20%s',_0x58144a,_0x406771[_0xf35f('0x10')][_0xf35f('0x12')]);return _0x1922af(_0x406771['error'][_0xf35f('0x12')]);}else{logger[_0xf35f('0xb')](_0xf35f('0xc'),_0x58144a,_0xf35f('0xd'));_0x1922af(_0x406771[_0xf35f('0x13')]['message']);}})[_0xf35f('0x14')](function(_0x3e400b){logger[_0xf35f('0x10')](_0xf35f('0xc'),_0x58144a,_0x3e400b);_0x37df94(_0x3e400b);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index e9ebcd8..617fa4d 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 _0x209f=['/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index'];(function(_0x98e080,_0x2d9a72){var _0x29ba06=function(_0x276fe4){while(--_0x276fe4){_0x98e080['push'](_0x98e080['shift']());}};_0x29ba06(++_0x2d9a72);}(_0x209f,0x199));var _0xf209=function(_0x315a0e,_0x35c0fd){_0x315a0e=_0x315a0e-0x0;var _0x13ef0c=_0x209f[_0x315a0e];return _0x13ef0c;};'use strict';var multer=require(_0xf209('0x0'));var util=require('util');var path=require(_0xf209('0x1'));var timeout=require(_0xf209('0x2'));var express=require('express');var router=express[_0xf209('0x3')]();var fs_extra=require(_0xf209('0x4'));var auth=require(_0xf209('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf209('0x6'));var controller=require(_0xf209('0x7'));router[_0xf209('0x8')]('/',auth[_0xf209('0x9')](),controller[_0xf209('0xa')]);router['get'](_0xf209('0xb'),auth[_0xf209('0x9')](),controller[_0xf209('0xc')]);router[_0xf209('0x8')](_0xf209('0xd'),auth[_0xf209('0x9')](),controller['show']);router[_0xf209('0xe')]('/',auth[_0xf209('0x9')](),controller[_0xf209('0xf')]);router[_0xf209('0x10')]('/:id',auth[_0xf209('0x9')](),controller[_0xf209('0x11')]);router[_0xf209('0x12')](_0xf209('0xd'),auth[_0xf209('0x9')](),controller[_0xf209('0x13')]);module[_0xf209('0x14')]=router; \ No newline at end of file +var _0x3b5c=['get','/describe','describe','/:id','post','create','put','delete','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','isAuthenticated','index'];(function(_0x3a0ad5,_0x4a36ce){var _0x5c3274=function(_0x58d6d5){while(--_0x58d6d5){_0x3a0ad5['push'](_0x3a0ad5['shift']());}};_0x5c3274(++_0x4a36ce);}(_0x3b5c,0x172));var _0xc3b5=function(_0x1ef987,_0x1efae2){_0x1ef987=_0x1ef987-0x0;var _0x3de2cb=_0x3b5c[_0x1ef987];return _0x3de2cb;};'use strict';var multer=require('multer');var util=require(_0xc3b5('0x0'));var path=require('path');var timeout=require(_0xc3b5('0x1'));var express=require(_0xc3b5('0x2'));var router=express[_0xc3b5('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc3b5('0x4'));var interaction=require(_0xc3b5('0x5'));var config=require(_0xc3b5('0x6'));var controller=require(_0xc3b5('0x7'));router['get']('/',auth[_0xc3b5('0x8')](),controller[_0xc3b5('0x9')]);router[_0xc3b5('0xa')](_0xc3b5('0xb'),auth[_0xc3b5('0x8')](),controller[_0xc3b5('0xc')]);router[_0xc3b5('0xa')](_0xc3b5('0xd'),auth[_0xc3b5('0x8')](),controller['show']);router[_0xc3b5('0xe')]('/',auth['isAuthenticated'](),controller[_0xc3b5('0xf')]);router[_0xc3b5('0x10')](_0xc3b5('0xd'),auth[_0xc3b5('0x8')](),controller['update']);router[_0xc3b5('0x11')](_0xc3b5('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xc3b5('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 3bbf43e..3f09f3b 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 _0x6f0d=['STRING','INTEGER','DATE','called,connect,complete','exports'];(function(_0x5b3670,_0x3c0828){var _0x2b609f=function(_0x478406){while(--_0x478406){_0x5b3670['push'](_0x5b3670['shift']());}};_0x2b609f(++_0x3c0828);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x322d85,_0x515de6){_0x322d85=_0x322d85-0x0;var _0x7c2bfc=_0x6f0d[_0x322d85];return _0x7c2bfc;};'use strict';var Sequelize=require('sequelize');module[_0xd6f0('0x0')]={'privilege':{'type':Sequelize[_0xd6f0('0x1')]},'channel':{'type':Sequelize[_0xd6f0('0x1')]},'channelstate':{'type':Sequelize[_0xd6f0('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xd6f0('0x1')]},'calleridname':{'type':Sequelize[_0xd6f0('0x1')]},'connectedlinenum':{'type':Sequelize[_0xd6f0('0x1')]},'connectedlinename':{'type':Sequelize[_0xd6f0('0x1')]},'language':{'type':Sequelize[_0xd6f0('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xd6f0('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xd6f0('0x2')]},'uniqueid':{'type':Sequelize[_0xd6f0('0x1')]},'linkedid':{'type':Sequelize[_0xd6f0('0x1')]},'destchannel':{'type':Sequelize[_0xd6f0('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xd6f0('0x1')]},'destcalleridname':{'type':Sequelize[_0xd6f0('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xd6f0('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xd6f0('0x1')]},'destlanguage':{'type':Sequelize[_0xd6f0('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xd6f0('0x1')]},'destexten':{'type':Sequelize[_0xd6f0('0x1')]},'destpriority':{'type':Sequelize[_0xd6f0('0x2')]},'destuniqueid':{'type':Sequelize[_0xd6f0('0x1')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0xd6f0('0x1')]},'dialstatus':{'type':Sequelize[_0xd6f0('0x1')]},'starttime':{'type':Sequelize[_0xd6f0('0x3')]},'answertime':{'type':Sequelize[_0xd6f0('0x3')]},'endtime':{'type':Sequelize[_0xd6f0('0x3')]},'lastevent':{'type':Sequelize[_0xd6f0('0x1')],'comment':_0xd6f0('0x4')},'routeId':{'type':Sequelize[_0xd6f0('0x2')]},'duration':{'type':Sequelize[_0xd6f0('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xd6f0('0x2')]}}; \ No newline at end of file +var _0x24ca=['STRING','INTEGER','DATE','called,connect,complete','sequelize'];(function(_0x52ef5f,_0x564dae){var _0x45179d=function(_0x14b6ca){while(--_0x14b6ca){_0x52ef5f['push'](_0x52ef5f['shift']());}};_0x45179d(++_0x564dae);}(_0x24ca,0x1bc));var _0xa24c=function(_0x13e300,_0x1bcb41){_0x13e300=_0x13e300-0x0;var _0x5a3eea=_0x24ca[_0x13e300];return _0x5a3eea;};'use strict';var Sequelize=require(_0xa24c('0x0'));module['exports']={'privilege':{'type':Sequelize[_0xa24c('0x1')]},'channel':{'type':Sequelize[_0xa24c('0x1')]},'channelstate':{'type':Sequelize[_0xa24c('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xa24c('0x1')]},'calleridname':{'type':Sequelize[_0xa24c('0x1')]},'connectedlinenum':{'type':Sequelize[_0xa24c('0x1')]},'connectedlinename':{'type':Sequelize[_0xa24c('0x1')]},'language':{'type':Sequelize[_0xa24c('0x1')]},'accountcode':{'type':Sequelize[_0xa24c('0x1')]},'context':{'type':Sequelize[_0xa24c('0x1')]},'exten':{'type':Sequelize[_0xa24c('0x1')]},'priority':{'type':Sequelize[_0xa24c('0x2')]},'uniqueid':{'type':Sequelize[_0xa24c('0x1')]},'linkedid':{'type':Sequelize[_0xa24c('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xa24c('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xa24c('0x1')]},'destcalleridnum':{'type':Sequelize[_0xa24c('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xa24c('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xa24c('0x1')]},'destlanguage':{'type':Sequelize[_0xa24c('0x1')]},'destaccountcode':{'type':Sequelize[_0xa24c('0x1')]},'destcontext':{'type':Sequelize[_0xa24c('0x1')]},'destexten':{'type':Sequelize[_0xa24c('0x1')]},'destpriority':{'type':Sequelize[_0xa24c('0x2')]},'destuniqueid':{'type':Sequelize[_0xa24c('0x1')]},'destlinkedid':{'type':Sequelize[_0xa24c('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xa24c('0x1')]},'starttime':{'type':Sequelize[_0xa24c('0x3')]},'answertime':{'type':Sequelize[_0xa24c('0x3')]},'endtime':{'type':Sequelize[_0xa24c('0x3')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0xa24c('0x4')},'routeId':{'type':Sequelize[_0xa24c('0x2')]},'duration':{'type':Sequelize[_0xa24c('0x2')]},'holdtime':{'type':Sequelize[_0xa24c('0x2')]},'billableseconds':{'type':Sequelize[_0xa24c('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 8c2150a..30eb319 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 _0x072e=['rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','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','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','error','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','findAll','rows','show','params','keys','includeAll','include','find','create','catch','body','describe','eml-format'];(function(_0x382c73,_0x199cab){var _0x1dd0bf=function(_0x358747){while(--_0x358747){_0x382c73['push'](_0x382c73['shift']());}};_0x1dd0bf(++_0x199cab);}(_0x072e,0x18f));var _0xe072=function(_0x3f5308,_0x261b8d){_0x3f5308=_0x3f5308-0x0;var _0x574023=_0x072e[_0x3f5308];return _0x574023;};'use strict';var emlformat=require(_0xe072('0x0'));var rimraf=require(_0xe072('0x1'));var zipdir=require(_0xe072('0x2'));var jsonpatch=require(_0xe072('0x3'));var rp=require(_0xe072('0x4'));var moment=require('moment');var BPromise=require(_0xe072('0x5'));var Mustache=require(_0xe072('0x6'));var util=require('util');var path=require(_0xe072('0x7'));var sox=require(_0xe072('0x8'));var csv=require(_0xe072('0x9'));var ejs=require(_0xe072('0xa'));var fs=require('fs');var fs_extra=require(_0xe072('0xb'));var _=require(_0xe072('0xc'));var squel=require(_0xe072('0xd'));var crypto=require(_0xe072('0xe'));var jsforce=require(_0xe072('0xf'));var deskjs=require(_0xe072('0x10'));var toCsv=require('to-csv');var querystring=require(_0xe072('0x11'));var Papa=require(_0xe072('0x12'));var Redis=require(_0xe072('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xe072('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe072('0x15'));var logger=require(_0xe072('0x16'))(_0xe072('0x17'));var utils=require(_0xe072('0x18'));var config=require(_0xe072('0x19'));var licenseUtil=require(_0xe072('0x1a'));var db=require(_0xe072('0x1b'))['db'];function respondWithStatusCode(_0x21f29f,_0x264747){_0x264747=_0x264747||0xcc;return function(_0x464ab8){if(_0x464ab8){return _0x21f29f[_0xe072('0x1c')](_0x264747);}return _0x21f29f[_0xe072('0x1d')](_0x264747)[_0xe072('0x1e')]();};}function respondWithResult(_0x484232,_0x4e3769){_0x4e3769=_0x4e3769||0xc8;return function(_0x431e8e){if(_0x431e8e){return _0x484232[_0xe072('0x1d')](_0x4e3769)[_0xe072('0x1f')](_0x431e8e);}};}function respondWithFilteredResult(_0x5dff28,_0x5c9ce4){return function(_0x162e44){if(_0x162e44){var _0x58f9a3=typeof _0x5c9ce4[_0xe072('0x20')]===_0xe072('0x21')&&typeof _0x5c9ce4[_0xe072('0x22')]===_0xe072('0x21');var _0x6e18f7=_0x162e44[_0xe072('0x23')];var _0x1f09d9=_0x58f9a3?0x0:_0x5c9ce4[_0xe072('0x20')];var _0x22e535=_0x58f9a3?_0x162e44['count']:_0x5c9ce4[_0xe072('0x20')]+_0x5c9ce4[_0xe072('0x22')];var _0x1673d9;if(_0x22e535>=_0x6e18f7){_0x22e535=_0x6e18f7;_0x1673d9=0xc8;}else{_0x1673d9=0xce;}_0x5dff28['status'](_0x1673d9);return _0x5dff28[_0xe072('0x24')]('Content-Range',_0x1f09d9+'-'+_0x22e535+'/'+_0x6e18f7)[_0xe072('0x1f')](_0x162e44);}return null;};}function patchUpdates(_0x45562d){return function(_0x42697e){try{jsonpatch[_0xe072('0x25')](_0x42697e,_0x45562d,!![]);}catch(_0x52ffe9){return BPromise[_0xe072('0x26')](_0x52ffe9);}return _0x42697e['save']();};}function saveUpdates(_0x42eede,_0x2f2e90){return function(_0x13e36e){if(_0x13e36e){return _0x13e36e[_0xe072('0x27')](_0x42eede)[_0xe072('0x28')](function(_0x426b40){return _0x426b40;});}return null;};}function removeEntity(_0x4d0c97,_0x488ebb){return function(_0x476436){if(_0x476436){return _0x476436[_0xe072('0x29')]()[_0xe072('0x28')](function(){_0x4d0c97[_0xe072('0x1d')](0xcc)[_0xe072('0x1e')]();});}};}function handleEntityNotFound(_0x315e95,_0x2b0375){return function(_0x134583){if(!_0x134583){_0x315e95['sendStatus'](0x194);}return _0x134583;};}function handleError(_0x1b5153,_0x13bdf2){_0x13bdf2=_0x13bdf2||0x1f4;return function(_0x5f16c0){logger[_0xe072('0x2a')](_0x5f16c0['stack']);if(_0x5f16c0['name']){delete _0x5f16c0[_0xe072('0x2b')];}_0x1b5153['status'](_0x13bdf2)[_0xe072('0x2c')](_0x5f16c0);};}exports[_0xe072('0x2d')]=function(_0x37058f,_0x4515f6){var _0x3a37c7={},_0x1e4efa={},_0x256242={'count':0x0,'rows':[]};var _0x45ddeb=_[_0xe072('0x2e')](db[_0xe072('0x2f')][_0xe072('0x30')],function(_0x295fa6){return{'name':_0x295fa6[_0xe072('0x31')],'type':_0x295fa6['type'][_0xe072('0x32')]};});_0x1e4efa[_0xe072('0x33')]=_['map'](_0x45ddeb,_0xe072('0x2b'));_0x1e4efa[_0xe072('0x34')]=_['keys'](_0x37058f['query']);_0x1e4efa[_0xe072('0x35')]=_[_0xe072('0x36')](_0x1e4efa['model'],_0x1e4efa['query']);_0x3a37c7[_0xe072('0x37')]=_[_0xe072('0x36')](_0x1e4efa[_0xe072('0x33')],qs[_0xe072('0x38')](_0x37058f[_0xe072('0x34')][_0xe072('0x38')]));_0x3a37c7[_0xe072('0x37')]=_0x3a37c7['attributes'][_0xe072('0x39')]?_0x3a37c7[_0xe072('0x37')]:_0x1e4efa[_0xe072('0x33')];if(!_0x37058f[_0xe072('0x34')][_0xe072('0x3a')](_0xe072('0x3b'))){_0x3a37c7[_0xe072('0x22')]=qs[_0xe072('0x22')](_0x37058f[_0xe072('0x34')][_0xe072('0x22')]);_0x3a37c7[_0xe072('0x20')]=qs['offset'](_0x37058f[_0xe072('0x34')]['offset']);}_0x3a37c7[_0xe072('0x3c')]=qs[_0xe072('0x3d')](_0x37058f[_0xe072('0x34')]['sort']);_0x3a37c7[_0xe072('0x3e')]=qs['filters'](_[_0xe072('0x3f')](_0x37058f[_0xe072('0x34')],_0x1e4efa['filters']),_0x45ddeb);if(_0x37058f[_0xe072('0x34')]['filter']){_0x3a37c7['where']=_[_0xe072('0x40')](_0x3a37c7[_0xe072('0x3e')],{'$or':_[_0xe072('0x2e')](_0x45ddeb,function(_0x3c1fce){if(_0x3c1fce[_0xe072('0x41')]!=='VIRTUAL'){var _0x2ae52d={};_0x2ae52d[_0x3c1fce[_0xe072('0x2b')]]={'$like':'%'+_0x37058f[_0xe072('0x34')][_0xe072('0x42')]+'%'};return _0x2ae52d;}})});}_0x3a37c7=_['merge']({},_0x3a37c7,_0x37058f[_0xe072('0x43')]);var _0x29ae1f={'where':_0x3a37c7[_0xe072('0x3e')]};return db['VoiceDialReport'][_0xe072('0x23')](_0x29ae1f)[_0xe072('0x28')](function(_0x296876){_0x256242['count']=_0x296876;if(_0x37058f[_0xe072('0x34')]['includeAll']){_0x3a37c7['include']=[{'all':!![]}];}return db['VoiceDialReport'][_0xe072('0x44')](_0x3a37c7);})[_0xe072('0x28')](function(_0x33e208){_0x256242[_0xe072('0x45')]=_0x33e208;return _0x256242;})[_0xe072('0x28')](respondWithFilteredResult(_0x4515f6,_0x3a37c7))['catch'](handleError(_0x4515f6,null));};exports[_0xe072('0x46')]=function(_0x38f8bb,_0x515999){var _0x1fcc61={'raw':!![],'where':{'id':_0x38f8bb[_0xe072('0x47')]['id']}},_0xc2abb0={};_0xc2abb0[_0xe072('0x33')]=_[_0xe072('0x48')](db[_0xe072('0x2f')][_0xe072('0x30')]);_0xc2abb0[_0xe072('0x34')]=_[_0xe072('0x48')](_0x38f8bb[_0xe072('0x34')]);_0xc2abb0['filters']=_['intersection'](_0xc2abb0[_0xe072('0x33')],_0xc2abb0[_0xe072('0x34')]);_0x1fcc61[_0xe072('0x37')]=_[_0xe072('0x36')](_0xc2abb0[_0xe072('0x33')],qs[_0xe072('0x38')](_0x38f8bb['query'][_0xe072('0x38')]));_0x1fcc61[_0xe072('0x37')]=_0x1fcc61[_0xe072('0x37')]['length']?_0x1fcc61[_0xe072('0x37')]:_0xc2abb0[_0xe072('0x33')];if(_0x38f8bb[_0xe072('0x34')][_0xe072('0x49')]){_0x1fcc61[_0xe072('0x4a')]=[{'all':!![]}];}_0x1fcc61=_[_0xe072('0x40')]({},_0x1fcc61,_0x38f8bb[_0xe072('0x43')]);return db['VoiceDialReport'][_0xe072('0x4b')](_0x1fcc61)[_0xe072('0x28')](handleEntityNotFound(_0x515999,null))[_0xe072('0x28')](respondWithResult(_0x515999,null))['catch'](handleError(_0x515999,null));};exports[_0xe072('0x4c')]=function(_0x7e418b,_0x26fd1f){return db[_0xe072('0x2f')][_0xe072('0x4c')](_0x7e418b['body'],{})['then'](respondWithResult(_0x26fd1f,0xc9))[_0xe072('0x4d')](handleError(_0x26fd1f,null));};exports[_0xe072('0x27')]=function(_0x419b5b,_0xadadb4){if(_0x419b5b['body']['id']){delete _0x419b5b[_0xe072('0x4e')]['id'];}return db[_0xe072('0x2f')]['find']({'where':{'id':_0x419b5b['params']['id']}})['then'](handleEntityNotFound(_0xadadb4,null))[_0xe072('0x28')](saveUpdates(_0x419b5b[_0xe072('0x4e')],null))[_0xe072('0x28')](respondWithResult(_0xadadb4,null))['catch'](handleError(_0xadadb4,null));};exports[_0xe072('0x29')]=function(_0x276d8c,_0x3df247){return db[_0xe072('0x2f')][_0xe072('0x4b')]({'where':{'id':_0x276d8c[_0xe072('0x47')]['id']}})['then'](handleEntityNotFound(_0x3df247,null))[_0xe072('0x28')](removeEntity(_0x3df247,null))['catch'](handleError(_0x3df247,null));};exports[_0xe072('0x4f')]=function(_0x4ee4f9,_0x460022){return db[_0xe072('0x2f')][_0xe072('0x4f')]()[_0xe072('0x28')](respondWithResult(_0x460022,null))[_0xe072('0x4d')](handleError(_0x460022,null));}; \ No newline at end of file +var _0xae87=['../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','status','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util'];(function(_0x4a7904,_0x4e5554){var _0xe5d442=function(_0x1cb7d7){while(--_0x1cb7d7){_0x4a7904['push'](_0x4a7904['shift']());}};_0xe5d442(++_0x4e5554);}(_0xae87,0xd5));var _0x7ae8=function(_0x581249,_0x483f03){_0x581249=_0x581249-0x0;var _0x284bae=_0xae87[_0x581249];return _0x284bae;};'use strict';var emlformat=require(_0x7ae8('0x0'));var rimraf=require(_0x7ae8('0x1'));var zipdir=require(_0x7ae8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7ae8('0x3'));var moment=require('moment');var BPromise=require(_0x7ae8('0x4'));var Mustache=require(_0x7ae8('0x5'));var util=require(_0x7ae8('0x6'));var path=require(_0x7ae8('0x7'));var sox=require('sox');var csv=require(_0x7ae8('0x8'));var ejs=require(_0x7ae8('0x9'));var fs=require('fs');var fs_extra=require(_0x7ae8('0xa'));var _=require(_0x7ae8('0xb'));var squel=require(_0x7ae8('0xc'));var crypto=require(_0x7ae8('0xd'));var jsforce=require(_0x7ae8('0xe'));var deskjs=require(_0x7ae8('0xf'));var toCsv=require(_0x7ae8('0x8'));var querystring=require('querystring');var Papa=require(_0x7ae8('0x10'));var Redis=require(_0x7ae8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7ae8('0x12'));var as=require(_0x7ae8('0x13'));var hardwareService=require(_0x7ae8('0x14'));var logger=require('../../config/logger')(_0x7ae8('0x15'));var utils=require('../../config/utils');var config=require(_0x7ae8('0x16'));var licenseUtil=require(_0x7ae8('0x17'));var db=require(_0x7ae8('0x18'))['db'];function respondWithStatusCode(_0x524dfa,_0x18abc4){_0x18abc4=_0x18abc4||0xcc;return function(_0x183dc4){if(_0x183dc4){return _0x524dfa[_0x7ae8('0x19')](_0x18abc4);}return _0x524dfa['status'](_0x18abc4)[_0x7ae8('0x1a')]();};}function respondWithResult(_0x53d84d,_0x4ae0bb){_0x4ae0bb=_0x4ae0bb||0xc8;return function(_0x4faaed){if(_0x4faaed){return _0x53d84d['status'](_0x4ae0bb)[_0x7ae8('0x1b')](_0x4faaed);}};}function respondWithFilteredResult(_0x513326,_0x427601){return function(_0x12deec){if(_0x12deec){var _0x4d6fea=typeof _0x427601[_0x7ae8('0x1c')]===_0x7ae8('0x1d')&&typeof _0x427601[_0x7ae8('0x1e')]===_0x7ae8('0x1d');var _0x1ca472=_0x12deec[_0x7ae8('0x1f')];var _0x462d2d=_0x4d6fea?0x0:_0x427601['offset'];var _0xd623d6=_0x4d6fea?_0x12deec[_0x7ae8('0x1f')]:_0x427601[_0x7ae8('0x1c')]+_0x427601[_0x7ae8('0x1e')];var _0x5590f0;if(_0xd623d6>=_0x1ca472){_0xd623d6=_0x1ca472;_0x5590f0=0xc8;}else{_0x5590f0=0xce;}_0x513326['status'](_0x5590f0);return _0x513326[_0x7ae8('0x20')](_0x7ae8('0x21'),_0x462d2d+'-'+_0xd623d6+'/'+_0x1ca472)['json'](_0x12deec);}return null;};}function patchUpdates(_0x2a90d3){return function(_0x253fb3){try{jsonpatch[_0x7ae8('0x22')](_0x253fb3,_0x2a90d3,!![]);}catch(_0x1f2605){return BPromise['reject'](_0x1f2605);}return _0x253fb3[_0x7ae8('0x23')]();};}function saveUpdates(_0x5df2e8,_0x3e7989){return function(_0x5c2d7e){if(_0x5c2d7e){return _0x5c2d7e[_0x7ae8('0x24')](_0x5df2e8)['then'](function(_0x202f48){return _0x202f48;});}return null;};}function removeEntity(_0x3c8821,_0x2cc960){return function(_0x92d76){if(_0x92d76){return _0x92d76['destroy']()[_0x7ae8('0x25')](function(){_0x3c8821[_0x7ae8('0x26')](0xcc)[_0x7ae8('0x1a')]();});}};}function handleEntityNotFound(_0x32986e,_0x5651a3){return function(_0x19171d){if(!_0x19171d){_0x32986e[_0x7ae8('0x19')](0x194);}return _0x19171d;};}function handleError(_0x34676d,_0x2d376a){_0x2d376a=_0x2d376a||0x1f4;return function(_0x27e5ae){logger[_0x7ae8('0x27')](_0x27e5ae[_0x7ae8('0x28')]);if(_0x27e5ae[_0x7ae8('0x29')]){delete _0x27e5ae[_0x7ae8('0x29')];}_0x34676d['status'](_0x2d376a)[_0x7ae8('0x2a')](_0x27e5ae);};}exports[_0x7ae8('0x2b')]=function(_0x48ae62,_0x2ed90a){var _0x3cf5aa={},_0x2eb5d5={},_0x53b058={'count':0x0,'rows':[]};var _0x4e7e12=_[_0x7ae8('0x2c')](db[_0x7ae8('0x2d')][_0x7ae8('0x2e')],function(_0x5662e9){return{'name':_0x5662e9[_0x7ae8('0x2f')],'type':_0x5662e9[_0x7ae8('0x30')][_0x7ae8('0x31')]};});_0x2eb5d5[_0x7ae8('0x32')]=_[_0x7ae8('0x2c')](_0x4e7e12,_0x7ae8('0x29'));_0x2eb5d5[_0x7ae8('0x33')]=_[_0x7ae8('0x34')](_0x48ae62[_0x7ae8('0x33')]);_0x2eb5d5[_0x7ae8('0x35')]=_[_0x7ae8('0x36')](_0x2eb5d5[_0x7ae8('0x32')],_0x2eb5d5[_0x7ae8('0x33')]);_0x3cf5aa['attributes']=_[_0x7ae8('0x36')](_0x2eb5d5[_0x7ae8('0x32')],qs[_0x7ae8('0x37')](_0x48ae62[_0x7ae8('0x33')][_0x7ae8('0x37')]));_0x3cf5aa[_0x7ae8('0x38')]=_0x3cf5aa[_0x7ae8('0x38')][_0x7ae8('0x39')]?_0x3cf5aa[_0x7ae8('0x38')]:_0x2eb5d5[_0x7ae8('0x32')];if(!_0x48ae62['query'][_0x7ae8('0x3a')](_0x7ae8('0x3b'))){_0x3cf5aa['limit']=qs['limit'](_0x48ae62[_0x7ae8('0x33')]['limit']);_0x3cf5aa['offset']=qs[_0x7ae8('0x1c')](_0x48ae62[_0x7ae8('0x33')][_0x7ae8('0x1c')]);}_0x3cf5aa[_0x7ae8('0x3c')]=qs['sort'](_0x48ae62[_0x7ae8('0x33')][_0x7ae8('0x3d')]);_0x3cf5aa[_0x7ae8('0x3e')]=qs[_0x7ae8('0x35')](_[_0x7ae8('0x3f')](_0x48ae62['query'],_0x2eb5d5[_0x7ae8('0x35')]),_0x4e7e12);if(_0x48ae62['query'][_0x7ae8('0x40')]){_0x3cf5aa[_0x7ae8('0x3e')]=_[_0x7ae8('0x41')](_0x3cf5aa[_0x7ae8('0x3e')],{'$or':_[_0x7ae8('0x2c')](_0x4e7e12,function(_0x49ce21){if(_0x49ce21['type']!==_0x7ae8('0x42')){var _0x4daf69={};_0x4daf69[_0x49ce21[_0x7ae8('0x29')]]={'$like':'%'+_0x48ae62[_0x7ae8('0x33')][_0x7ae8('0x40')]+'%'};return _0x4daf69;}})});}_0x3cf5aa=_[_0x7ae8('0x41')]({},_0x3cf5aa,_0x48ae62[_0x7ae8('0x43')]);var _0xd9d9bb={'where':_0x3cf5aa[_0x7ae8('0x3e')]};return db[_0x7ae8('0x2d')][_0x7ae8('0x1f')](_0xd9d9bb)['then'](function(_0x169e63){_0x53b058['count']=_0x169e63;if(_0x48ae62[_0x7ae8('0x33')][_0x7ae8('0x44')]){_0x3cf5aa[_0x7ae8('0x45')]=[{'all':!![]}];}return db['VoiceDialReport'][_0x7ae8('0x46')](_0x3cf5aa);})[_0x7ae8('0x25')](function(_0x4142bb){_0x53b058[_0x7ae8('0x47')]=_0x4142bb;return _0x53b058;})['then'](respondWithFilteredResult(_0x2ed90a,_0x3cf5aa))['catch'](handleError(_0x2ed90a,null));};exports[_0x7ae8('0x48')]=function(_0x339a0c,_0x32361e){var _0x5d219d={'raw':!![],'where':{'id':_0x339a0c[_0x7ae8('0x49')]['id']}},_0x29f7b4={};_0x29f7b4[_0x7ae8('0x32')]=_[_0x7ae8('0x34')](db['VoiceDialReport']['rawAttributes']);_0x29f7b4[_0x7ae8('0x33')]=_['keys'](_0x339a0c[_0x7ae8('0x33')]);_0x29f7b4[_0x7ae8('0x35')]=_[_0x7ae8('0x36')](_0x29f7b4[_0x7ae8('0x32')],_0x29f7b4[_0x7ae8('0x33')]);_0x5d219d[_0x7ae8('0x38')]=_['intersection'](_0x29f7b4['model'],qs['fields'](_0x339a0c[_0x7ae8('0x33')][_0x7ae8('0x37')]));_0x5d219d[_0x7ae8('0x38')]=_0x5d219d[_0x7ae8('0x38')]['length']?_0x5d219d[_0x7ae8('0x38')]:_0x29f7b4['model'];if(_0x339a0c[_0x7ae8('0x33')][_0x7ae8('0x44')]){_0x5d219d[_0x7ae8('0x45')]=[{'all':!![]}];}_0x5d219d=_['merge']({},_0x5d219d,_0x339a0c[_0x7ae8('0x43')]);return db[_0x7ae8('0x2d')][_0x7ae8('0x4a')](_0x5d219d)[_0x7ae8('0x25')](handleEntityNotFound(_0x32361e,null))[_0x7ae8('0x25')](respondWithResult(_0x32361e,null))[_0x7ae8('0x4b')](handleError(_0x32361e,null));};exports[_0x7ae8('0x4c')]=function(_0x257d60,_0x50a58d){return db[_0x7ae8('0x2d')][_0x7ae8('0x4c')](_0x257d60[_0x7ae8('0x4d')],{})[_0x7ae8('0x25')](respondWithResult(_0x50a58d,0xc9))[_0x7ae8('0x4b')](handleError(_0x50a58d,null));};exports[_0x7ae8('0x24')]=function(_0x3677e9,_0x2f6151){if(_0x3677e9[_0x7ae8('0x4d')]['id']){delete _0x3677e9[_0x7ae8('0x4d')]['id'];}return db[_0x7ae8('0x2d')][_0x7ae8('0x4a')]({'where':{'id':_0x3677e9[_0x7ae8('0x49')]['id']}})[_0x7ae8('0x25')](handleEntityNotFound(_0x2f6151,null))[_0x7ae8('0x25')](saveUpdates(_0x3677e9[_0x7ae8('0x4d')],null))[_0x7ae8('0x25')](respondWithResult(_0x2f6151,null))[_0x7ae8('0x4b')](handleError(_0x2f6151,null));};exports['destroy']=function(_0x436e9a,_0x10c2b6){return db['VoiceDialReport'][_0x7ae8('0x4a')]({'where':{'id':_0x436e9a['params']['id']}})[_0x7ae8('0x25')](handleEntityNotFound(_0x10c2b6,null))[_0x7ae8('0x25')](removeEntity(_0x10c2b6,null))[_0x7ae8('0x4b')](handleError(_0x10c2b6,null));};exports['describe']=function(_0x2b2a26,_0x9a0a8d){return db[_0x7ae8('0x2d')][_0x7ae8('0x4e')]()['then'](respondWithResult(_0x9a0a8d,null))[_0x7ae8('0x4b')](handleError(_0x9a0a8d,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index f614428..234bae3 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 _0x81bb=['exports','VoiceDialReport','report_dial','uniqueid','lodash','../../config/logger','bluebird','../../config/environment'];(function(_0x595f77,_0x3e383e){var _0x413107=function(_0x438a7c){while(--_0x438a7c){_0x595f77['push'](_0x595f77['shift']());}};_0x413107(++_0x3e383e);}(_0x81bb,0x74));var _0xb81b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x81bb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb81b('0x0'));var util=require('util');var logger=require(_0xb81b('0x1'))('api');var moment=require('moment');var BPromise=require(_0xb81b('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb81b('0x3'));var attributes=require('./voiceDialReport.attributes');module[_0xb81b('0x4')]=function(_0x31826f,_0x2fe9dc){return _0x31826f['define'](_0xb81b('0x5'),attributes,{'tableName':_0xb81b('0x6'),'paranoid':![],'indexes':[{'fields':[_0xb81b('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb1ed=['rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','report_dial','uniqueid','../../config/logger','bluebird','request-promise','path'];(function(_0x2f1ebe,_0x2e340a){var _0x522491=function(_0x5d89ba){while(--_0x5d89ba){_0x2f1ebe['push'](_0x2f1ebe['shift']());}};_0x522491(++_0x2e340a);}(_0xb1ed,0x8b));var _0xdb1e=function(_0x296453,_0x219c2a){_0x296453=_0x296453-0x0;var _0x37b596=_0xb1ed[_0x296453];return _0x37b596;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xdb1e('0x0'))('api');var moment=require('moment');var BPromise=require(_0xdb1e('0x1'));var rp=require(_0xdb1e('0x2'));var fs=require('fs');var path=require(_0xdb1e('0x3'));var rimraf=require(_0xdb1e('0x4'));var config=require(_0xdb1e('0x5'));var attributes=require(_0xdb1e('0x6'));module[_0xdb1e('0x7')]=function(_0x5bcc39,_0x250622){return _0x5bcc39[_0xdb1e('0x8')]('VoiceDialReport',attributes,{'tableName':_0xdb1e('0x9'),'paranoid':![],'indexes':[{'fields':[_0xdb1e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index bb8b277..7347a8f 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 _0xbb46=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','body','options','raw','CreateVoiceDialReport','UpdateVoiceDialReport','where','attributes','limit','lodash','util','moment'];(function(_0x34ebf3,_0x5935c5){var _0x3a634d=function(_0x4f5d92){while(--_0x4f5d92){_0x34ebf3['push'](_0x34ebf3['shift']());}};_0x3a634d(++_0x5935c5);}(_0xbb46,0x1dd));var _0x6bb4=function(_0x90f49b,_0x4085a2){_0x90f49b=_0x90f49b-0x0;var _0xd24569=_0xbb46[_0x90f49b];return _0xd24569;};'use strict';var _=require(_0x6bb4('0x0'));var util=require(_0x6bb4('0x1'));var moment=require(_0x6bb4('0x2'));var BPromise=require(_0x6bb4('0x3'));var rs=require(_0x6bb4('0x4'));var fs=require('fs');var Redis=require(_0x6bb4('0x5'));var db=require(_0x6bb4('0x6'))['db'];var utils=require(_0x6bb4('0x7'));var logger=require(_0x6bb4('0x8'))(_0x6bb4('0x9'));var config=require(_0x6bb4('0xa'));var jayson=require(_0x6bb4('0xb'));var client=jayson[_0x6bb4('0xc')][_0x6bb4('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xde98ed,_0x3085e0,_0x310897){return new BPromise(function(_0x16ff46,_0x234c26){return client['request'](_0xde98ed,_0x310897)[_0x6bb4('0xe')](function(_0xb1576){logger[_0x6bb4('0xf')](_0x6bb4('0x10'),_0x3085e0,_0x6bb4('0x11'));logger['debug']('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x3085e0,_0x6bb4('0x11'),JSON[_0x6bb4('0x12')](_0xb1576));if(_0xb1576[_0x6bb4('0x13')]){if(_0xb1576[_0x6bb4('0x13')][_0x6bb4('0x14')]===0x1f4){logger[_0x6bb4('0x13')](_0x6bb4('0x10'),_0x3085e0,_0xb1576[_0x6bb4('0x13')][_0x6bb4('0x15')]);return _0x234c26(_0xb1576['error']['message']);}logger[_0x6bb4('0x13')](_0x6bb4('0x10'),_0x3085e0,_0xb1576[_0x6bb4('0x13')][_0x6bb4('0x15')]);return _0x16ff46(_0xb1576[_0x6bb4('0x13')]['message']);}else{logger[_0x6bb4('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x3085e0,_0x6bb4('0x11'));_0x16ff46(_0xb1576[_0x6bb4('0x16')]['message']);}})[_0x6bb4('0x17')](function(_0x550095){logger[_0x6bb4('0x13')](_0x6bb4('0x10'),_0x3085e0,_0x550095);_0x234c26(_0x550095);});});}exports['CreateVoiceDialReport']=function(_0x5e968d){var _0x5de6b0=this;return new Promise(function(_0x3b13fa,_0x289b29){return db['VoiceDialReport']['create'](_0x5e968d[_0x6bb4('0x18')],{'raw':_0x5e968d[_0x6bb4('0x19')]?_0x5e968d['options'][_0x6bb4('0x1a')]===undefined?!![]:![]:!![]})[_0x6bb4('0xe')](function(_0x29ed08){logger[_0x6bb4('0xf')]('CreateVoiceDialReport',_0x5e968d);logger['debug'](_0x6bb4('0x1b'),_0x5e968d,JSON[_0x6bb4('0x12')](_0x29ed08));_0x3b13fa(_0x29ed08);})[_0x6bb4('0x17')](function(_0x682504){logger[_0x6bb4('0x13')](_0x6bb4('0x1b'),_0x682504[_0x6bb4('0x15')],_0x5e968d);_0x289b29(_0x5de6b0[_0x6bb4('0x13')](0x1f4,_0x682504[_0x6bb4('0x15')]));});});};exports[_0x6bb4('0x1c')]=function(_0x34f48e){var _0x299f93=this;return new Promise(function(_0x5cb0d3,_0x300964){return db['VoiceDialReport']['update'](_0x34f48e[_0x6bb4('0x18')],{'raw':_0x34f48e['options']?_0x34f48e[_0x6bb4('0x19')][_0x6bb4('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34f48e[_0x6bb4('0x19')]?_0x34f48e[_0x6bb4('0x19')][_0x6bb4('0x1d')]||null:null,'attributes':_0x34f48e['options']?_0x34f48e[_0x6bb4('0x19')][_0x6bb4('0x1e')]||null:null,'limit':_0x34f48e[_0x6bb4('0x19')]?_0x34f48e['options'][_0x6bb4('0x1f')]||null:null})[_0x6bb4('0xe')](function(_0x19915d){logger[_0x6bb4('0xf')](_0x6bb4('0x1c'),_0x34f48e);logger['debug']('UpdateVoiceDialReport',_0x34f48e,JSON[_0x6bb4('0x12')](_0x19915d));_0x5cb0d3(_0x19915d);})['catch'](function(_0x1cbd5d){logger[_0x6bb4('0x13')](_0x6bb4('0x1c'),_0x1cbd5d[_0x6bb4('0x15')],_0x34f48e);_0x300964(_0x299f93[_0x6bb4('0x13')](0x1f4,_0x1cbd5d['message']));});});}; \ No newline at end of file +var _0x900b=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','VoiceDialReport,\x20%s,\x20%s','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','VoiceDialReport','body','options','raw','then','CreateVoiceDialReport','debug','UpdateVoiceDialReport','update','where','attributes','limit'];(function(_0x45306d,_0x3eed71){var _0x3e4d84=function(_0x13e07e){while(--_0x13e07e){_0x45306d['push'](_0x45306d['shift']());}};_0x3e4d84(++_0x3eed71);}(_0x900b,0x1ad));var _0xb900=function(_0x56a7cc,_0x27d403){_0x56a7cc=_0x56a7cc-0x0;var _0x505ece=_0x900b[_0x56a7cc];return _0x505ece;};'use strict';var _=require(_0xb900('0x0'));var util=require(_0xb900('0x1'));var moment=require('moment');var BPromise=require(_0xb900('0x2'));var rs=require(_0xb900('0x3'));var fs=require('fs');var Redis=require(_0xb900('0x4'));var db=require(_0xb900('0x5'))['db'];var utils=require(_0xb900('0x6'));var logger=require(_0xb900('0x7'))(_0xb900('0x8'));var config=require(_0xb900('0x9'));var jayson=require(_0xb900('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5a6d5c,_0x5e30bf,_0x4e6ba0){return new BPromise(function(_0x5265b2,_0xfe0f3c){return client[_0xb900('0xb')](_0x5a6d5c,_0x4e6ba0)['then'](function(_0xca5476){logger[_0xb900('0xc')](_0xb900('0xd'),_0x5e30bf,'request\x20sent');logger['debug'](_0xb900('0xe'),_0x5e30bf,_0xb900('0xf'),JSON[_0xb900('0x10')](_0xca5476));if(_0xca5476[_0xb900('0x11')]){if(_0xca5476[_0xb900('0x11')]['code']===0x1f4){logger[_0xb900('0x11')](_0xb900('0xd'),_0x5e30bf,_0xca5476['error'][_0xb900('0x12')]);return _0xfe0f3c(_0xca5476[_0xb900('0x11')][_0xb900('0x12')]);}logger['error'](_0xb900('0xd'),_0x5e30bf,_0xca5476[_0xb900('0x11')][_0xb900('0x12')]);return _0x5265b2(_0xca5476[_0xb900('0x11')][_0xb900('0x12')]);}else{logger[_0xb900('0xc')](_0xb900('0xd'),_0x5e30bf,_0xb900('0xf'));_0x5265b2(_0xca5476[_0xb900('0x13')][_0xb900('0x12')]);}})[_0xb900('0x14')](function(_0x13f05f){logger[_0xb900('0x11')](_0xb900('0xd'),_0x5e30bf,_0x13f05f);_0xfe0f3c(_0x13f05f);});});}exports['CreateVoiceDialReport']=function(_0x22d549){var _0x198940=this;return new Promise(function(_0x11ed6e,_0x589c3e){return db[_0xb900('0x15')]['create'](_0x22d549[_0xb900('0x16')],{'raw':_0x22d549[_0xb900('0x17')]?_0x22d549[_0xb900('0x17')][_0xb900('0x18')]===undefined?!![]:![]:!![]})[_0xb900('0x19')](function(_0x3d3917){logger[_0xb900('0xc')](_0xb900('0x1a'),_0x22d549);logger[_0xb900('0x1b')](_0xb900('0x1a'),_0x22d549,JSON[_0xb900('0x10')](_0x3d3917));_0x11ed6e(_0x3d3917);})[_0xb900('0x14')](function(_0x9e6e35){logger[_0xb900('0x11')](_0xb900('0x1a'),_0x9e6e35['message'],_0x22d549);_0x589c3e(_0x198940[_0xb900('0x11')](0x1f4,_0x9e6e35['message']));});});};exports[_0xb900('0x1c')]=function(_0x1f4b5e){var _0x26fbf5=this;return new Promise(function(_0x4eb39a,_0x6f9677){return db[_0xb900('0x15')][_0xb900('0x1d')](_0x1f4b5e[_0xb900('0x16')],{'raw':_0x1f4b5e[_0xb900('0x17')]?_0x1f4b5e[_0xb900('0x17')][_0xb900('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f4b5e['options']?_0x1f4b5e[_0xb900('0x17')][_0xb900('0x1e')]||null:null,'attributes':_0x1f4b5e['options']?_0x1f4b5e['options'][_0xb900('0x1f')]||null:null,'limit':_0x1f4b5e[_0xb900('0x17')]?_0x1f4b5e[_0xb900('0x17')][_0xb900('0x20')]||null:null})[_0xb900('0x19')](function(_0x2c32a6){logger[_0xb900('0xc')](_0xb900('0x1c'),_0x1f4b5e);logger[_0xb900('0x1b')](_0xb900('0x1c'),_0x1f4b5e,JSON['stringify'](_0x2c32a6));_0x4eb39a(_0x2c32a6);})[_0xb900('0x14')](function(_0x5abe6b){logger['error']('UpdateVoiceDialReport',_0x5abe6b[_0xb900('0x12')],_0x1f4b5e);_0x6f9677(_0x26fbf5[_0xb900('0x11')](0x1f4,_0x5abe6b['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index c7e6e6f..f64753c 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 _0xd3f0=['path','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','index','/:id','isAuthenticated','post','/:id/applications','addApplications','update','delete','destroy','exports'];(function(_0x310be9,_0x354ce){var _0x42d398=function(_0x57b699){while(--_0x57b699){_0x310be9['push'](_0x310be9['shift']());}};_0x42d398(++_0x354ce);}(_0xd3f0,0x177));var _0x0d3f=function(_0x2ba6af,_0x54d419){_0x2ba6af=_0x2ba6af-0x0;var _0x234e00=_0xd3f0[_0x2ba6af];return _0x234e00;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0d3f('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0d3f('0x1'));var config=require(_0x0d3f('0x2'));var controller=require(_0x0d3f('0x3'));router[_0x0d3f('0x4')]('/',auth['isAuthenticated'](),controller[_0x0d3f('0x5')]);router['get'](_0x0d3f('0x6'),auth[_0x0d3f('0x7')](),controller['show']);router[_0x0d3f('0x8')]('/',auth[_0x0d3f('0x7')](),controller['create']);router['post'](_0x0d3f('0x9'),auth[_0x0d3f('0x7')](),controller[_0x0d3f('0xa')]);router['put'](_0x0d3f('0x6'),auth[_0x0d3f('0x7')](),controller[_0x0d3f('0xb')]);router[_0x0d3f('0xc')](_0x0d3f('0x6'),auth[_0x0d3f('0x7')](),controller[_0x0d3f('0xd')]);module[_0x0d3f('0xe')]=router; \ No newline at end of file +var _0x2c32=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','/:id/applications','addApplications','put','update','exports','multer','util','path'];(function(_0x2c8243,_0x32686e){var _0x1121d4=function(_0x1d2d27){while(--_0x1d2d27){_0x2c8243['push'](_0x2c8243['shift']());}};_0x1121d4(++_0x32686e);}(_0x2c32,0x123));var _0x22c3=function(_0xe10dee,_0x4cbea2){_0xe10dee=_0xe10dee-0x0;var _0xa3a6bc=_0x2c32[_0xe10dee];return _0xa3a6bc;};'use strict';var multer=require(_0x22c3('0x0'));var util=require(_0x22c3('0x1'));var path=require(_0x22c3('0x2'));var timeout=require(_0x22c3('0x3'));var express=require(_0x22c3('0x4'));var router=express['Router']();var fs_extra=require(_0x22c3('0x5'));var auth=require(_0x22c3('0x6'));var interaction=require(_0x22c3('0x7'));var config=require(_0x22c3('0x8'));var controller=require(_0x22c3('0x9'));router[_0x22c3('0xa')]('/',auth[_0x22c3('0xb')](),controller[_0x22c3('0xc')]);router[_0x22c3('0xa')](_0x22c3('0xd'),auth['isAuthenticated'](),controller[_0x22c3('0xe')]);router['post']('/',auth[_0x22c3('0xb')](),controller['create']);router[_0x22c3('0xf')](_0x22c3('0x10'),auth[_0x22c3('0xb')](),controller[_0x22c3('0x11')]);router[_0x22c3('0x12')]('/:id',auth[_0x22c3('0xb')](),controller[_0x22c3('0x13')]);router['delete'](_0x22c3('0xd'),auth[_0x22c3('0xb')](),controller['destroy']);module[_0x22c3('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 3c3cfbf..cc3876e 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 _0x8bc0=['ENUM','inbound','outbound','outbound-fax','system','INTEGER','BOOLEAN','wav','VIRTUAL','exten','sequelize','exports','STRING','compositeIndex','NoOp'];(function(_0x11b1bd,_0x442ad5){var _0x31f533=function(_0x4e4e80){while(--_0x4e4e80){_0x11b1bd['push'](_0x11b1bd['shift']());}};_0x31f533(++_0x442ad5);}(_0x8bc0,0xeb));var _0x08bc=function(_0x41e8bb,_0x4681f1){_0x41e8bb=_0x41e8bb-0x0;var _0x6c9c91=_0x8bc0[_0x41e8bb];return _0x6c9c91;};'use strict';var Sequelize=require(_0x08bc('0x0'));module[_0x08bc('0x1')]={'context':{'type':Sequelize[_0x08bc('0x2')],'allowNull':![],'unique':_0x08bc('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x08bc('0x2')],'allowNull':![],'unique':_0x08bc('0x3')},'priority':{'type':Sequelize[_0x08bc('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x08bc('0x3')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x08bc('0x4')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x08bc('0x5')](_0x08bc('0x6'),_0x08bc('0x7'),'internal','inbound-fax',_0x08bc('0x8'),_0x08bc('0x9'),'any'),'allowNull':![]},'description':{'type':Sequelize[_0x08bc('0x2')]},'interval':{'type':Sequelize[_0x08bc('0x2')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0x08bc('0xa')]},'isApp':{'type':Sequelize[_0x08bc('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x08bc('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x08bc('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x08bc('0xa')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x08bc('0xc')},'answer':{'type':Sequelize[_0x08bc('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x08bc('0xd')],'get':function(_0xad7af0){return this['getDataValue'](_0x08bc('0xe'));}},'alias':{'type':Sequelize[_0x08bc('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xe74b=['exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','getDataValue'];(function(_0x12e7d1,_0x3e2c39){var _0x1b55cb=function(_0x24c45c){while(--_0x24c45c){_0x12e7d1['push'](_0x12e7d1['shift']());}};_0x1b55cb(++_0x3e2c39);}(_0xe74b,0x157));var _0xbe74=function(_0x5ad924,_0x3a0103){_0x5ad924=_0x5ad924-0x0;var _0x44ad27=_0xe74b[_0x5ad924];return _0x44ad27;};'use strict';var Sequelize=require(_0xbe74('0x0'));module[_0xbe74('0x1')]={'context':{'type':Sequelize[_0xbe74('0x2')],'allowNull':![],'unique':_0xbe74('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xbe74('0x2')],'allowNull':![],'unique':_0xbe74('0x3')},'priority':{'type':Sequelize[_0xbe74('0x2')],'allowNull':![],'defaultValue':'1','unique':_0xbe74('0x3')},'tag':{'type':Sequelize[_0xbe74('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xbe74('0x2')],'allowNull':![],'defaultValue':_0xbe74('0x4')},'appdata':{'type':Sequelize[_0xbe74('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xbe74('0x5')](_0xbe74('0x6'),_0xbe74('0x7'),_0xbe74('0x8'),_0xbe74('0x9'),_0xbe74('0xa'),_0xbe74('0xb'),_0xbe74('0xc')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xbe74('0x2')],'allowNull':![],'defaultValue':_0xbe74('0xd')},'IntervalId':{'type':Sequelize[_0xbe74('0xe')]},'isApp':{'type':Sequelize[_0xbe74('0xf')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xbe74('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xbe74('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0xbe74('0xf')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xbe74('0xe')]},'recordingFormat':{'type':Sequelize[_0xbe74('0x2')],'defaultValue':_0xbe74('0x10')},'answer':{'type':Sequelize[_0xbe74('0xf')],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x58311d){return this[_0xbe74('0x11')](_0xbe74('0x12'));}},'alias':{'type':Sequelize[_0xbe74('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 1b3e2d3..8c0e906 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 _0x21b1=['userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','mandatoryDisposition','alias','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','findOne','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','ioredis','../../config/logger','api','redis','localhost','socket.io-emitter','./voiceExtension.socket','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','destroy','then','get','InboundRoutes','OutboundRoutes','outbound','internal','ignore','map','value','includes','type','find','name','UserProfileResource','error','send','VoiceExtension','fieldName','key','model','keys','query','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filters','filter','merge','options','includeAll','include','findAll','show','params','rawAttributes','create','body','startsWith','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x21b1,0xbe));var _0x121b=function(_0x16d9db,_0x151ce0){_0x16d9db=_0x16d9db-0x0;var _0x2942a7=_0x21b1[_0x16d9db];return _0x2942a7;};'use strict';var _=require('lodash');var Redis=require(_0x121b('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0x121b('0x1'))(_0x121b('0x2'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x121b('0x3')]=_['defaults'](config[_0x121b('0x3')],{'host':_0x121b('0x4'),'port':0x18eb});var socket=require(_0x121b('0x5'))(new Redis(config['redis']));require(_0x121b('0x6'))['register'](socket);function respondWithStatusCode(_0x2c4e24,_0x149075){_0x149075=_0x149075||0xcc;return function(_0x4bd1d0){if(_0x4bd1d0){return _0x2c4e24[_0x121b('0x7')](_0x149075);}return _0x2c4e24[_0x121b('0x8')](_0x149075)[_0x121b('0x9')]();};}function respondWithResult(_0x25dd04,_0x28a6db){_0x28a6db=_0x28a6db||0xc8;return function(_0x4ca365){if(_0x4ca365){return _0x25dd04['status'](_0x28a6db)['json'](_0x4ca365);}};}function respondWithFilteredResult(_0x43f6e5,_0x278d0a){return function(_0x12a445){if(_0x12a445){var _0x59dee6=typeof _0x278d0a[_0x121b('0xa')]===_0x121b('0xb')&&typeof _0x278d0a[_0x121b('0xc')]===_0x121b('0xb');var _0x23174d=_0x12a445['count'];var _0x16bf5c=_0x59dee6?0x0:_0x278d0a[_0x121b('0xa')];var _0x1e4c13=_0x59dee6?_0x12a445[_0x121b('0xd')]:_0x278d0a[_0x121b('0xa')]+_0x278d0a['limit'];var _0x29bc5e;if(_0x1e4c13>=_0x23174d){_0x1e4c13=_0x23174d;_0x29bc5e=0xc8;}else{_0x29bc5e=0xce;}_0x43f6e5['status'](_0x29bc5e);return _0x43f6e5[_0x121b('0xe')](_0x121b('0xf'),_0x16bf5c+'-'+_0x1e4c13+'/'+_0x23174d)[_0x121b('0x10')](_0x12a445);}return null;};}function removeEntity(_0x5a34bc){return function(_0x3d37cf){if(_0x3d37cf){return _0x3d37cf[_0x121b('0x11')]()[_0x121b('0x12')](function(){var _0x361d74=_0x3d37cf[_0x121b('0x13')]({'plain':!![]});var _0x5ef87c=[{'name':_0x121b('0x14'),'value':'inbound','ignore':![]},{'name':_0x121b('0x15'),'value':_0x121b('0x16'),'ignore':![]},{'name':'InternalRoutes','value':_0x121b('0x17'),'ignore':![]}];var _0x355ca7=_(_0x5ef87c)['filter'](_0x121b('0x18'))[_0x121b('0x19')](_0x121b('0x1a'))[_0x121b('0x1a')]();if(_[_0x121b('0x1b')](_0x355ca7,_0x361d74[_0x121b('0x1c')])){return;}var _0x35a1f4=_[_0x121b('0x1d')](_0x5ef87c,[_0x121b('0x1a'),_0x361d74[_0x121b('0x1c')]])[_0x121b('0x1e')];return db[_0x121b('0x1f')][_0x121b('0x11')]({'where':{'type':_0x35a1f4,'resourceId':_0x361d74['id']}})[_0x121b('0x12')](function(){return _0x3d37cf;});})['then'](function(){_0x5a34bc[_0x121b('0x8')](0xcc)[_0x121b('0x9')]();});}};}function handleEntityNotFound(_0x5a0c41){return function(_0x3e71b7){if(!_0x3e71b7){_0x5a0c41[_0x121b('0x7')](0x194);}return _0x3e71b7;};}function handleError(_0x3acedc,_0x500c0c){_0x500c0c=_0x500c0c||0x1f4;return function(_0x3233bc){logger[_0x121b('0x20')](_0x3233bc['stack']);if(_0x3233bc[_0x121b('0x1e')]){delete _0x3233bc[_0x121b('0x1e')];}_0x3acedc[_0x121b('0x8')](_0x500c0c)[_0x121b('0x21')](_0x3233bc);};}exports['index']=function(_0x5eb692,_0x461b92){var _0x579132={},_0x135fac={},_0x1f964f={'count':0x0,'rows':[]};var _0x511306=_[_0x121b('0x19')](db[_0x121b('0x22')]['rawAttributes'],function(_0x2edb3d){return{'name':_0x2edb3d[_0x121b('0x23')],'type':_0x2edb3d['type'][_0x121b('0x24')]};});_0x135fac[_0x121b('0x25')]=_[_0x121b('0x19')](_0x511306,'name');_0x135fac['query']=_[_0x121b('0x26')](_0x5eb692[_0x121b('0x27')]);_0x135fac['filters']=_['intersection'](_0x135fac[_0x121b('0x25')],_0x135fac[_0x121b('0x27')]);_0x579132[_0x121b('0x28')]=_['intersection'](_0x135fac[_0x121b('0x25')],qs[_0x121b('0x29')](_0x5eb692['query'][_0x121b('0x29')]));_0x579132[_0x121b('0x28')]=_0x579132['attributes']['length']?_0x579132[_0x121b('0x28')]:_0x135fac['model'];if(!_0x5eb692[_0x121b('0x27')][_0x121b('0x2a')](_0x121b('0x2b'))){_0x579132[_0x121b('0xc')]=qs[_0x121b('0xc')](_0x5eb692[_0x121b('0x27')][_0x121b('0xc')]);_0x579132[_0x121b('0xa')]=qs[_0x121b('0xa')](_0x5eb692['query'][_0x121b('0xa')]);}_0x579132[_0x121b('0x2c')]=qs['sort'](_0x5eb692['query']['sort']);_0x579132[_0x121b('0x2d')]=qs['filters'](_[_0x121b('0x2e')](_0x5eb692[_0x121b('0x27')],_0x135fac[_0x121b('0x2f')]),_0x511306);if(_0x5eb692[_0x121b('0x27')][_0x121b('0x30')]){_0x579132[_0x121b('0x2d')]=_[_0x121b('0x31')](_0x579132['where'],{'$or':_[_0x121b('0x19')](_0x511306,function(_0x1d049d){if(_0x1d049d[_0x121b('0x1c')]!=='VIRTUAL'){var _0xc0cc5b={};_0xc0cc5b[_0x1d049d['name']]={'$like':'%'+_0x5eb692[_0x121b('0x27')]['filter']+'%'};return _0xc0cc5b;}})});}_0x579132=_[_0x121b('0x31')]({},_0x579132,_0x5eb692[_0x121b('0x32')]);var _0x51beca={'where':_0x579132['where']};return db[_0x121b('0x22')][_0x121b('0xd')](_0x51beca)[_0x121b('0x12')](function(_0x389d01){_0x1f964f[_0x121b('0xd')]=_0x389d01;if(_0x5eb692[_0x121b('0x27')][_0x121b('0x33')]){_0x579132[_0x121b('0x34')]=[{'all':!![]}];}return db[_0x121b('0x22')][_0x121b('0x35')](_0x579132);})['then'](function(_0x685742){_0x1f964f['rows']=_0x685742;return _0x1f964f;})[_0x121b('0x12')](respondWithFilteredResult(_0x461b92,_0x579132))['catch'](handleError(_0x461b92,null));};exports[_0x121b('0x36')]=function(_0x489a4e,_0x2aa6b0){var _0x477acd={'raw':![],'where':{'id':_0x489a4e[_0x121b('0x37')]['id']}},_0x4700e={};_0x4700e['model']=_[_0x121b('0x26')](db[_0x121b('0x22')][_0x121b('0x38')]);_0x4700e[_0x121b('0x27')]=_['keys'](_0x489a4e[_0x121b('0x27')]);_0x4700e[_0x121b('0x2f')]=_['intersection'](_0x4700e[_0x121b('0x25')],_0x4700e[_0x121b('0x27')]);_0x477acd[_0x121b('0x28')]=_['intersection'](_0x4700e['model'],qs['fields'](_0x489a4e[_0x121b('0x27')][_0x121b('0x29')]));_0x477acd[_0x121b('0x28')]=_0x477acd[_0x121b('0x28')]['length']?_0x477acd[_0x121b('0x28')]:_0x4700e['model'];if(_0x489a4e[_0x121b('0x27')][_0x121b('0x33')]){_0x477acd['include']=[{'all':!![]}];}_0x477acd=_[_0x121b('0x31')]({},_0x477acd,_0x489a4e[_0x121b('0x32')]);return db[_0x121b('0x22')][_0x121b('0x1d')](_0x477acd)['then'](handleEntityNotFound(_0x2aa6b0,null))['then'](respondWithResult(_0x2aa6b0,null))['catch'](handleError(_0x2aa6b0,null));};exports[_0x121b('0x11')]=function(_0x4b8e15,_0x5eed84){return db[_0x121b('0x22')]['find']({'where':{'id':_0x4b8e15[_0x121b('0x37')]['id']}})[_0x121b('0x12')](handleEntityNotFound(_0x5eed84,null))[_0x121b('0x12')](removeEntity(_0x5eed84,null))['catch'](handleError(_0x5eed84,null));};exports[_0x121b('0x39')]=function(_0xdbf292,_0x40ae69){if(_0xdbf292[_0x121b('0x3a')][_0x121b('0x1c')]==='outbound'&&!_[_0x121b('0x3b')](_0xdbf292['body']['exten'],'_')){_0xdbf292[_0x121b('0x3a')][_0x121b('0x3c')]='_'['concat'](_0xdbf292['body'][_0x121b('0x3c')]);}return db[_0x121b('0x22')][_0x121b('0x39')](_0xdbf292['body'],{'raw':![]})[_0x121b('0x12')](function(_0x155370){var _0x1dd225=_0xdbf292[_0x121b('0x3d')][_0x121b('0x13')]({'plain':!![]});if(!_0x1dd225)throw new Error(_0x121b('0x3e'));if(_0x1dd225[_0x121b('0x3f')]==='user'){var _0x136f0e=_0x155370['get']({'plain':!![]});var _0x5223c1=[{'name':_0x121b('0x14'),'value':'inbound'},{'name':_0x121b('0x15'),'value':_0x121b('0x16')},{'name':'InternalRoutes','value':'internal'}];var _0x1c0647=_[_0x121b('0x1d')](_0x5223c1,[_0x121b('0x1a'),_0x136f0e[_0x121b('0x1c')]])[_0x121b('0x1e')];return db[_0x121b('0x40')]['find']({'where':{'name':_0x1c0647,'userProfileId':_0x1dd225[_0x121b('0x41')]},'raw':!![]})[_0x121b('0x12')](function(_0x46494d){if(_0x46494d&&_0x46494d[_0x121b('0x42')]===0x0){return db[_0x121b('0x1f')]['create']({'name':_0x136f0e[_0x121b('0x1e')],'resourceId':_0x136f0e['id'],'type':_0x46494d[_0x121b('0x1e')],'sectionId':_0x46494d['id']},{})['then'](function(){return _0x155370;});}else{return _0x155370;}})[_0x121b('0x43')](function(_0x44140f){logger['error'](_0x121b('0x44'),_0x44140f);throw _0x44140f;});}return _0x155370;})[_0x121b('0x12')](respondWithResult(_0x40ae69,0xc9))['catch'](handleError(_0x40ae69,null));};exports['update']=function(_0x313822,_0x586152){if(_0x313822[_0x121b('0x3a')]['id']){delete _0x313822[_0x121b('0x3a')]['id'];}return db[_0x121b('0x22')][_0x121b('0x1d')]({'where':{'id':_0x313822[_0x121b('0x37')]['id']}})[_0x121b('0x12')](handleEntityNotFound(_0x586152,null))[_0x121b('0x12')](function(_0x2ce90d){if(_0x2ce90d){return db[_0x121b('0x22')][_0x121b('0x45')](_[_0x121b('0x2e')](_0x313822[_0x121b('0x3a')],[_0x121b('0x3c'),_0x121b('0x46'),_0x121b('0x47'),_0x121b('0x48'),'cutdigits',_0x121b('0x49'),_0x121b('0x4a')]),{'where':{'context':_0x2ce90d[_0x121b('0x46')],'exten':_0x2ce90d[_0x121b('0x3c')]},'individualHooks':!![]})[_0x121b('0x12')](function(_0x4f889b){return _0x4f889b;});}return null;})[_0x121b('0x12')](respondWithStatusCode(_0x586152,null))[_0x121b('0x43')](handleError(_0x586152,null));};exports[_0x121b('0x4b')]=function(_0x381e0b,_0x436597){var _0x2c4e78=_0x381e0b[_0x121b('0x37')]['id'];var _0x17d741=_0x381e0b['body'];var _0x2c3304=0xc8;var _0x13f9fb=null;return db[_0x121b('0x4c')][_0x121b('0x4d')]({'isolationLevel':db['sequelize'][_0x121b('0x4e')][_0x121b('0x4f')]['READ_COMMITTED']},function(_0xb82b3a){return db[_0x121b('0x22')][_0x121b('0x50')]({'where':{'id':_0x2c4e78},'transaction':_0xb82b3a})[_0x121b('0x12')](function(_0x23f4d4){if(_0x23f4d4){return db[_0x121b('0x22')][_0x121b('0x11')]({'where':{'VoiceExtensionId':_0x2c4e78},'transaction':_0xb82b3a})[_0x121b('0x12')](function(){var _0xd628e4=_['map'](_0x17d741,function(_0x50a5be){_0x50a5be['VoiceExtensionId']=_0x2c4e78;_0x50a5be['isApp']=!![];return _0x50a5be;});return _0x23f4d4['createRouting'](_0xd628e4);})[_0x121b('0x12')](function(_0x58e023){return db[_0x121b('0x22')][_0x121b('0x51')](_0x58e023,{'transaction':_0xb82b3a});});}else{_0x2c3304=0x194;_0x13f9fb=[];}});})['then'](function(){if(_0x2c3304!==0x194){return db[_0x121b('0x22')][_0x121b('0x52')]({'where':{'isApp':!![],'VoiceExtensionId':_0x2c4e78},'order':_0x121b('0x53')})['then'](function(_0xc33272){_0x13f9fb=_0xc33272;});}})[_0x121b('0x43')](function(_0x1822f1){_0x2c3304=0x1f4;logger[_0x121b('0x20')](_0x1822f1['stack']);if(_0x1822f1[_0x121b('0x1e')]){delete _0x1822f1[_0x121b('0x1e')];}_0x13f9fb=_0x1822f1;})[_0x121b('0x54')](function(){if(_0x13f9fb===null){_0x436597[_0x121b('0x7')](_0x2c3304);}else{if(_0x2c3304===0x1f4){_0x436597[_0x121b('0x8')](_0x2c3304)[_0x121b('0x21')](_0x13f9fb);}else{_0x436597[_0x121b('0x8')](_0x2c3304)[_0x121b('0x10')](_0x13f9fb);}}});}; \ No newline at end of file +var _0xfadd=['ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','offset','undefined','limit','count','set','Content-Range','json','destroy','get','OutboundRoutes','outbound','InternalRoutes','internal','filter','map','includes','type','value','name','UserProfileResource','then','sendStatus','error','stack','send','index','VoiceExtension','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','options','includeAll','include','rows','catch','show','params','find','create','startsWith','body','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InboundRoutes','inbound','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','Transaction'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0xfadd,0x185));var _0xdfad=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xfadd[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xdfad('0x0'));var Redis=require(_0xdfad('0x1'));var qs=require(_0xdfad('0x2'));var logger=require(_0xdfad('0x3'))(_0xdfad('0x4'));var config=require(_0xdfad('0x5'));var db=require(_0xdfad('0x6'))['db'];config[_0xdfad('0x7')]=_[_0xdfad('0x8')](config[_0xdfad('0x7')],{'host':_0xdfad('0x9'),'port':0x18eb});var socket=require(_0xdfad('0xa'))(new Redis(config['redis']));require('./voiceExtension.socket')[_0xdfad('0xb')](socket);function respondWithStatusCode(_0x2fc9d8,_0x2ffaa0){_0x2ffaa0=_0x2ffaa0||0xcc;return function(_0x10c6ac){if(_0x10c6ac){return _0x2fc9d8['sendStatus'](_0x2ffaa0);}return _0x2fc9d8[_0xdfad('0xc')](_0x2ffaa0)['end']();};}function respondWithResult(_0x34dc01,_0x335aed){_0x335aed=_0x335aed||0xc8;return function(_0x4845a8){if(_0x4845a8){return _0x34dc01[_0xdfad('0xc')](_0x335aed)['json'](_0x4845a8);}};}function respondWithFilteredResult(_0x3f17b4,_0x21a154){return function(_0xcb7fce){if(_0xcb7fce){var _0x45c7f4=typeof _0x21a154[_0xdfad('0xd')]===_0xdfad('0xe')&&typeof _0x21a154[_0xdfad('0xf')]===_0xdfad('0xe');var _0x204a6c=_0xcb7fce[_0xdfad('0x10')];var _0x33d750=_0x45c7f4?0x0:_0x21a154[_0xdfad('0xd')];var _0x425131=_0x45c7f4?_0xcb7fce['count']:_0x21a154[_0xdfad('0xd')]+_0x21a154[_0xdfad('0xf')];var _0x16a72c;if(_0x425131>=_0x204a6c){_0x425131=_0x204a6c;_0x16a72c=0xc8;}else{_0x16a72c=0xce;}_0x3f17b4['status'](_0x16a72c);return _0x3f17b4[_0xdfad('0x11')](_0xdfad('0x12'),_0x33d750+'-'+_0x425131+'/'+_0x204a6c)[_0xdfad('0x13')](_0xcb7fce);}return null;};}function removeEntity(_0x4d81af){return function(_0x404dcf){if(_0x404dcf){return _0x404dcf[_0xdfad('0x14')]()['then'](function(){var _0x141b9b=_0x404dcf[_0xdfad('0x15')]({'plain':!![]});var _0x5e2ca4=[{'name':'InboundRoutes','value':'inbound','ignore':![]},{'name':_0xdfad('0x16'),'value':_0xdfad('0x17'),'ignore':![]},{'name':_0xdfad('0x18'),'value':_0xdfad('0x19'),'ignore':![]}];var _0x5f00e8=_(_0x5e2ca4)[_0xdfad('0x1a')]('ignore')[_0xdfad('0x1b')]('value')['value']();if(_[_0xdfad('0x1c')](_0x5f00e8,_0x141b9b[_0xdfad('0x1d')])){return;}var _0x53a9bf=_['find'](_0x5e2ca4,[_0xdfad('0x1e'),_0x141b9b[_0xdfad('0x1d')]])[_0xdfad('0x1f')];return db[_0xdfad('0x20')]['destroy']({'where':{'type':_0x53a9bf,'resourceId':_0x141b9b['id']}})[_0xdfad('0x21')](function(){return _0x404dcf;});})['then'](function(){_0x4d81af[_0xdfad('0xc')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e518f){return function(_0xc465a3){if(!_0xc465a3){_0x5e518f[_0xdfad('0x22')](0x194);}return _0xc465a3;};}function handleError(_0x24d17,_0xcd63e6){_0xcd63e6=_0xcd63e6||0x1f4;return function(_0xc9f33e){logger[_0xdfad('0x23')](_0xc9f33e[_0xdfad('0x24')]);if(_0xc9f33e[_0xdfad('0x1f')]){delete _0xc9f33e[_0xdfad('0x1f')];}_0x24d17[_0xdfad('0xc')](_0xcd63e6)[_0xdfad('0x25')](_0xc9f33e);};}exports[_0xdfad('0x26')]=function(_0x127eec,_0x4b6b07){var _0x444fce={},_0x5abcf3={},_0x24118c={'count':0x0,'rows':[]};var _0xa8b94e=_[_0xdfad('0x1b')](db[_0xdfad('0x27')][_0xdfad('0x28')],function(_0x457949){return{'name':_0x457949[_0xdfad('0x29')],'type':_0x457949[_0xdfad('0x1d')][_0xdfad('0x2a')]};});_0x5abcf3[_0xdfad('0x2b')]=_[_0xdfad('0x1b')](_0xa8b94e,_0xdfad('0x1f'));_0x5abcf3[_0xdfad('0x2c')]=_['keys'](_0x127eec[_0xdfad('0x2c')]);_0x5abcf3[_0xdfad('0x2d')]=_[_0xdfad('0x2e')](_0x5abcf3[_0xdfad('0x2b')],_0x5abcf3[_0xdfad('0x2c')]);_0x444fce['attributes']=_[_0xdfad('0x2e')](_0x5abcf3['model'],qs['fields'](_0x127eec[_0xdfad('0x2c')][_0xdfad('0x2f')]));_0x444fce[_0xdfad('0x30')]=_0x444fce[_0xdfad('0x30')][_0xdfad('0x31')]?_0x444fce[_0xdfad('0x30')]:_0x5abcf3['model'];if(!_0x127eec[_0xdfad('0x2c')][_0xdfad('0x32')](_0xdfad('0x33'))){_0x444fce['limit']=qs[_0xdfad('0xf')](_0x127eec[_0xdfad('0x2c')][_0xdfad('0xf')]);_0x444fce[_0xdfad('0xd')]=qs[_0xdfad('0xd')](_0x127eec[_0xdfad('0x2c')][_0xdfad('0xd')]);}_0x444fce[_0xdfad('0x34')]=qs[_0xdfad('0x35')](_0x127eec[_0xdfad('0x2c')]['sort']);_0x444fce['where']=qs[_0xdfad('0x2d')](_[_0xdfad('0x36')](_0x127eec['query'],_0x5abcf3['filters']),_0xa8b94e);if(_0x127eec[_0xdfad('0x2c')][_0xdfad('0x1a')]){_0x444fce[_0xdfad('0x37')]=_[_0xdfad('0x38')](_0x444fce[_0xdfad('0x37')],{'$or':_['map'](_0xa8b94e,function(_0x175840){if(_0x175840[_0xdfad('0x1d')]!=='VIRTUAL'){var _0x310a17={};_0x310a17[_0x175840[_0xdfad('0x1f')]]={'$like':'%'+_0x127eec[_0xdfad('0x2c')]['filter']+'%'};return _0x310a17;}})});}_0x444fce=_[_0xdfad('0x38')]({},_0x444fce,_0x127eec[_0xdfad('0x39')]);var _0x3a4f59={'where':_0x444fce[_0xdfad('0x37')]};return db['VoiceExtension'][_0xdfad('0x10')](_0x3a4f59)[_0xdfad('0x21')](function(_0x56005e){_0x24118c['count']=_0x56005e;if(_0x127eec[_0xdfad('0x2c')][_0xdfad('0x3a')]){_0x444fce[_0xdfad('0x3b')]=[{'all':!![]}];}return db['VoiceExtension']['findAll'](_0x444fce);})['then'](function(_0x2acd14){_0x24118c[_0xdfad('0x3c')]=_0x2acd14;return _0x24118c;})[_0xdfad('0x21')](respondWithFilteredResult(_0x4b6b07,_0x444fce))[_0xdfad('0x3d')](handleError(_0x4b6b07,null));};exports[_0xdfad('0x3e')]=function(_0x3d3c97,_0x1d78ea){var _0xc1b6a3={'raw':![],'where':{'id':_0x3d3c97[_0xdfad('0x3f')]['id']}},_0x1f35ae={};_0x1f35ae[_0xdfad('0x2b')]=_['keys'](db['VoiceExtension']['rawAttributes']);_0x1f35ae[_0xdfad('0x2c')]=_['keys'](_0x3d3c97[_0xdfad('0x2c')]);_0x1f35ae[_0xdfad('0x2d')]=_[_0xdfad('0x2e')](_0x1f35ae['model'],_0x1f35ae[_0xdfad('0x2c')]);_0xc1b6a3[_0xdfad('0x30')]=_[_0xdfad('0x2e')](_0x1f35ae[_0xdfad('0x2b')],qs[_0xdfad('0x2f')](_0x3d3c97[_0xdfad('0x2c')][_0xdfad('0x2f')]));_0xc1b6a3['attributes']=_0xc1b6a3['attributes'][_0xdfad('0x31')]?_0xc1b6a3['attributes']:_0x1f35ae['model'];if(_0x3d3c97[_0xdfad('0x2c')][_0xdfad('0x3a')]){_0xc1b6a3[_0xdfad('0x3b')]=[{'all':!![]}];}_0xc1b6a3=_[_0xdfad('0x38')]({},_0xc1b6a3,_0x3d3c97[_0xdfad('0x39')]);return db[_0xdfad('0x27')][_0xdfad('0x40')](_0xc1b6a3)[_0xdfad('0x21')](handleEntityNotFound(_0x1d78ea,null))[_0xdfad('0x21')](respondWithResult(_0x1d78ea,null))[_0xdfad('0x3d')](handleError(_0x1d78ea,null));};exports['destroy']=function(_0x550ff4,_0x58b3f7){return db[_0xdfad('0x27')][_0xdfad('0x40')]({'where':{'id':_0x550ff4[_0xdfad('0x3f')]['id']}})[_0xdfad('0x21')](handleEntityNotFound(_0x58b3f7,null))[_0xdfad('0x21')](removeEntity(_0x58b3f7,null))['catch'](handleError(_0x58b3f7,null));};exports[_0xdfad('0x41')]=function(_0x3ac2b3,_0x58bba7){if(_0x3ac2b3['body'][_0xdfad('0x1d')]==='outbound'&&!_[_0xdfad('0x42')](_0x3ac2b3[_0xdfad('0x43')]['exten'],'_')){_0x3ac2b3[_0xdfad('0x43')][_0xdfad('0x44')]='_'['concat'](_0x3ac2b3[_0xdfad('0x43')][_0xdfad('0x44')]);}return db['VoiceExtension'][_0xdfad('0x41')](_0x3ac2b3['body'],{'raw':![]})['then'](function(_0x24e31f){var _0xf262c5=_0x3ac2b3[_0xdfad('0x45')][_0xdfad('0x15')]({'plain':!![]});if(!_0xf262c5)throw new Error(_0xdfad('0x46'));if(_0xf262c5[_0xdfad('0x47')]==='user'){var _0x54d00d=_0x24e31f[_0xdfad('0x15')]({'plain':!![]});var _0x54d469=[{'name':_0xdfad('0x48'),'value':_0xdfad('0x49')},{'name':'OutboundRoutes','value':_0xdfad('0x17')},{'name':_0xdfad('0x18'),'value':_0xdfad('0x19')}];var _0x1f3f66=_[_0xdfad('0x40')](_0x54d469,['value',_0x54d00d['type']])[_0xdfad('0x1f')];return db['UserProfileSection']['find']({'where':{'name':_0x1f3f66,'userProfileId':_0xf262c5[_0xdfad('0x4a')]},'raw':!![]})[_0xdfad('0x21')](function(_0x25faa0){if(_0x25faa0&&_0x25faa0['autoAssociation']===0x0){return db['UserProfileResource'][_0xdfad('0x41')]({'name':_0x54d00d[_0xdfad('0x1f')],'resourceId':_0x54d00d['id'],'type':_0x25faa0[_0xdfad('0x1f')],'sectionId':_0x25faa0['id']},{})[_0xdfad('0x21')](function(){return _0x24e31f;});}else{return _0x24e31f;}})[_0xdfad('0x3d')](function(_0x49dbc1){logger['error'](_0xdfad('0x4b'),_0x49dbc1);throw _0x49dbc1;});}return _0x24e31f;})['then'](respondWithResult(_0x58bba7,0xc9))[_0xdfad('0x3d')](handleError(_0x58bba7,null));};exports[_0xdfad('0x4c')]=function(_0xd889e1,_0x1c5c6b){if(_0xd889e1[_0xdfad('0x43')]['id']){delete _0xd889e1[_0xdfad('0x43')]['id'];}return db[_0xdfad('0x27')]['find']({'where':{'id':_0xd889e1['params']['id']}})[_0xdfad('0x21')](handleEntityNotFound(_0x1c5c6b,null))['then'](function(_0xc87696){if(_0xc87696){return db[_0xdfad('0x27')][_0xdfad('0x4c')](_['pick'](_0xd889e1['body'],[_0xdfad('0x44'),_0xdfad('0x4d'),_0xdfad('0x4e'),_0xdfad('0x4f'),_0xdfad('0x50'),_0xdfad('0x51'),_0xdfad('0x52')]),{'where':{'context':_0xc87696[_0xdfad('0x4d')],'exten':_0xc87696[_0xdfad('0x44')]},'individualHooks':!![]})[_0xdfad('0x21')](function(_0x2afbf4){return _0x2afbf4;});}return null;})[_0xdfad('0x21')](respondWithStatusCode(_0x1c5c6b,null))[_0xdfad('0x3d')](handleError(_0x1c5c6b,null));};exports[_0xdfad('0x53')]=function(_0x214072,_0x3f107c){var _0x2bd8f8=_0x214072[_0xdfad('0x3f')]['id'];var _0x498724=_0x214072['body'];var _0x2bffd7=0xc8;var _0x2a5c13=null;return db[_0xdfad('0x54')]['transaction']({'isolationLevel':db['sequelize'][_0xdfad('0x55')][_0xdfad('0x56')][_0xdfad('0x57')]},function(_0x3c173c){return db['VoiceExtension'][_0xdfad('0x58')]({'where':{'id':_0x2bd8f8},'transaction':_0x3c173c})['then'](function(_0x586439){if(_0x586439){return db[_0xdfad('0x27')][_0xdfad('0x14')]({'where':{'VoiceExtensionId':_0x2bd8f8},'transaction':_0x3c173c})[_0xdfad('0x21')](function(){var _0x4ee09d=_[_0xdfad('0x1b')](_0x498724,function(_0x14efb3){_0x14efb3[_0xdfad('0x59')]=_0x2bd8f8;_0x14efb3[_0xdfad('0x5a')]=!![];return _0x14efb3;});return _0x586439['createRouting'](_0x4ee09d);})['then'](function(_0xa9afaa){return db[_0xdfad('0x27')][_0xdfad('0x5b')](_0xa9afaa,{'transaction':_0x3c173c});});}else{_0x2bffd7=0x194;_0x2a5c13=[];}});})[_0xdfad('0x21')](function(){if(_0x2bffd7!==0x194){return db['VoiceExtension'][_0xdfad('0x5c')]({'where':{'isApp':!![],'VoiceExtensionId':_0x2bd8f8},'order':_0xdfad('0x5d')})[_0xdfad('0x21')](function(_0x2d46c4){_0x2a5c13=_0x2d46c4;});}})[_0xdfad('0x3d')](function(_0x4c639b){_0x2bffd7=0x1f4;logger[_0xdfad('0x23')](_0x4c639b[_0xdfad('0x24')]);if(_0x4c639b[_0xdfad('0x1f')]){delete _0x4c639b[_0xdfad('0x1f')];}_0x2a5c13=_0x4c639b;})[_0xdfad('0x5e')](function(){if(_0x2a5c13===null){_0x3f107c[_0xdfad('0x22')](_0x2bffd7);}else{if(_0x2bffd7===0x1f4){_0x3f107c[_0xdfad('0xc')](_0x2bffd7)[_0xdfad('0x25')](_0x2a5c13);}else{_0x3f107c[_0xdfad('0xc')](_0x2bffd7)[_0xdfad('0x13')](_0x2a5c13);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 7961e4d..64c745c 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 _0x952e=['setMaxListeners','save','update','remove','emit','hook','events'];(function(_0x552f0d,_0x2fbe51){var _0x5dfe61=function(_0x33a88d){while(--_0x33a88d){_0x552f0d['push'](_0x552f0d['shift']());}};_0x5dfe61(++_0x2fbe51);}(_0x952e,0x13a));var _0xe952=function(_0x1c47e3,_0x152257){_0x1c47e3=_0x1c47e3-0x0;var _0x464435=_0x952e[_0x1c47e3];return _0x464435;};'use strict';var EventEmitter=require(_0xe952('0x0'));var VoiceExtension=require('../../mysqldb')['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xe952('0x1')](0x0);var events={'afterCreate':_0xe952('0x2'),'afterUpdate':_0xe952('0x3'),'afterDestroy':_0xe952('0x4')};function emitEvent(_0x4551bd){return function(_0x23eb74,_0xbe3dc4,_0x364fa9){VoiceExtensionEvents[_0xe952('0x5')](_0x4551bd+':'+_0x23eb74['id'],_0x23eb74);VoiceExtensionEvents[_0xe952('0x5')](_0x4551bd,_0x23eb74);_0x364fa9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0xe952('0x6')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0x306f=['setMaxListeners','save','update','hasOwnProperty','hook','exports'];(function(_0x1945ef,_0x3f1cd1){var _0x245dac=function(_0xb87b82){while(--_0xb87b82){_0x1945ef['push'](_0x1945ef['shift']());}};_0x245dac(++_0x3f1cd1);}(_0x306f,0x180));var _0xf306=function(_0x2dffd7,_0x50e766){_0x2dffd7=_0x2dffd7-0x0;var _0x55e83f=_0x306f[_0x2dffd7];return _0x55e83f;};'use strict';var EventEmitter=require('events');var VoiceExtension=require('../../mysqldb')['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xf306('0x0')](0x0);var events={'afterCreate':_0xf306('0x1'),'afterUpdate':_0xf306('0x2'),'afterDestroy':'remove'};function emitEvent(_0xc77a2b){return function(_0x3417e4,_0x42d63d,_0x52fa4d){VoiceExtensionEvents['emit'](_0xc77a2b+':'+_0x3417e4['id'],_0x3417e4);VoiceExtensionEvents['emit'](_0xc77a2b,_0x3417e4);_0x52fa4d(null);};}for(var e in events){if(events[_0xf306('0x3')](e)){var event=events[e];VoiceExtension[_0xf306('0x4')](e,emitEvent(event));}}module[_0xf306('0x5')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 76c446d..ad42fae 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 _0x1560=['splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','concat','catch','define','VoiceExtension','voice_extensions','Hangup','lodash','exports','models','type','Set','CDR(type)=','context','exten','alias','CDR(routeAlias)=','inbound','push','CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','NoOp','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','split','length','name','param','phone','prefix','SIP','join','U(xcally-mixmonitor-context)','replace','Interval','findAll','interval','IntervalId','then','*,*,*,*','intervals','filter','toLowerCase','hasOwnProperty','tag','CDR(tag)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1'];(function(_0x372aa1,_0x3d3204){var _0x527665=function(_0x5989fc){while(--_0x5989fc){_0x372aa1['push'](_0x372aa1['shift']());}};_0x527665(++_0x3d3204);}(_0x1560,0x155));var _0x0156=function(_0x595f7d,_0x46f9ef){_0x595f7d=_0x595f7d-0x0;var _0x4110e4=_0x1560[_0x595f7d];return _0x4110e4;};'use strict';var _=require(_0x0156('0x0'));var attributes=require('./voiceExtension.attributes');module[_0x0156('0x1')]=function(_0x4289b2){var _0x267300=_0x4289b2[_0x0156('0x2')];function _0x4bce82(_0x10f15e){var _0x27218f=0x2;var _0x2f8610=[{'type':_0x10f15e[_0x0156('0x3')],'app':_0x0156('0x4'),'appdata':_0x0156('0x5')+_0x10f15e[_0x0156('0x3')],'context':_0x10f15e[_0x0156('0x6')],'exten':_0x10f15e[_0x0156('0x7')],'priority':_0x27218f++,'VoiceExtensionId':_0x10f15e['id']},{'type':_0x10f15e[_0x0156('0x3')],'app':_0x10f15e[_0x0156('0x8')]?_0x0156('0x4'):'NoOp','appdata':_0x10f15e[_0x0156('0x8')]?_0x0156('0x9')+_0x10f15e[_0x0156('0x8')]:'No\x20alias\x20set','context':_0x10f15e[_0x0156('0x6')],'exten':_0x10f15e['exten'],'priority':_0x27218f++,'VoiceExtensionId':_0x10f15e['id']}];if(_0x10f15e['type']===_0x0156('0xa')){_0x2f8610[_0x0156('0xb')]({'type':_0x0156('0xa'),'app':_0x0156('0x4'),'appdata':_0x0156('0xc')+_0x10f15e['id'],'context':_0x10f15e[_0x0156('0x6')],'exten':_0x10f15e[_0x0156('0x7')],'priority':_0x27218f++,'VoiceExtensionId':_0x10f15e['id']});}_0x2f8610[_0x0156('0xb')]({'type':_0x10f15e[_0x0156('0x3')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x10f15e[_0x0156('0x6')],'exten':_0x10f15e[_0x0156('0x7')],'priority':_0x27218f++,'VoiceExtensionId':_0x10f15e['id']},{'type':_0x10f15e['type'],'app':_0x0156('0x4'),'appdata':_0x0156('0xd'),'context':_0x10f15e[_0x0156('0x6')],'exten':_0x10f15e['exten'],'priority':_0x27218f++,'VoiceExtensionId':_0x10f15e['id']},{'type':_0x10f15e['type'],'app':_0x0156('0x4'),'appdata':_0x0156('0xe'),'context':_0x10f15e[_0x0156('0x6')],'exten':_0x10f15e['exten'],'priority':_0x27218f++,'VoiceExtensionId':_0x10f15e['id']});return _0x2f8610;}function _0x435684(_0x58208a){var _0x266451=0x2;var _0x413472=[{'type':_0x0156('0xf'),'app':_0x0156('0x4'),'appdata':'CDR(type)=outbound','context':_0x58208a[_0x0156('0x6')],'exten':_0x58208a[_0x0156('0x7')],'priority':_0x266451++,'VoiceExtensionId':_0x58208a['id']},{'type':_0x0156('0xf'),'app':_0x58208a[_0x0156('0x8')]?_0x0156('0x4'):_0x0156('0x10'),'appdata':_0x58208a['alias']?_0x0156('0x9')+_0x58208a['alias']:'No\x20alias\x20set','context':_0x58208a[_0x0156('0x6')],'exten':_0x58208a[_0x0156('0x7')],'priority':_0x266451++,'VoiceExtensionId':_0x58208a['id']},{'type':_0x0156('0xf'),'app':'Set','appdata':_0x0156('0x11')+(_0x58208a[_0x0156('0x12')]?_0x0156('0x13')+_0x58208a['cutdigits']+'}':_0x0156('0x14')),'context':_0x58208a['context'],'exten':_0x58208a[_0x0156('0x7')],'priority':_0x266451++,'VoiceExtensionId':_0x58208a['id']},{'type':_0x0156('0xf'),'app':_0x0156('0x4'),'appdata':_0x0156('0xc')+_0x58208a['id'],'context':_0x58208a['context'],'exten':_0x58208a[_0x0156('0x7')],'priority':_0x266451++,'VoiceExtensionId':_0x58208a['id']},{'type':_0x0156('0xf'),'app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x266451+0x2)+_0x0156('0x15')+(_0x266451+0x1)+')','context':_0x58208a['context'],'exten':_0x58208a['exten'],'priority':_0x266451++,'VoiceExtensionId':_0x58208a['id']},{'type':_0x0156('0xf'),'app':'Set','appdata':_0x58208a['cutdigits']?_0x0156('0x16')+_0x58208a[_0x0156('0x12')]+'}':_0x0156('0x17'),'context':_0x58208a[_0x0156('0x6')],'exten':_0x58208a['exten'],'priority':_0x266451++,'VoiceExtensionId':_0x58208a['id']},{'type':_0x0156('0xf'),'app':_0x0156('0x4'),'appdata':_0x0156('0x18'),'context':_0x58208a[_0x0156('0x6')],'exten':_0x58208a[_0x0156('0x7')],'priority':_0x266451++,'VoiceExtensionId':_0x58208a['id']},{'type':_0x0156('0xf'),'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x58208a[_0x0156('0x6')],'exten':_0x58208a[_0x0156('0x7')],'priority':_0x266451++,'VoiceExtensionId':_0x58208a['id']},{'type':_0x0156('0xf'),'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x58208a['context'],'exten':_0x58208a[_0x0156('0x7')],'priority':_0x266451++,'VoiceExtensionId':_0x58208a['id']},{'type':'outbound','app':_0x0156('0x4'),'appdata':_0x0156('0x19')+_0x58208a['id'],'context':_0x58208a[_0x0156('0x6')],'exten':_0x58208a[_0x0156('0x7')],'priority':_0x266451++,'VoiceExtensionId':_0x58208a['id']}];if(_0x58208a['hasOwnProperty'](_0x0156('0x1a'))&&_0x58208a[_0x0156('0x1a')]!==_0x0156('0x1b')){_0x413472[_0x0156('0xb')]({'type':_0x0156('0xf'),'app':_0x0156('0x4'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x58208a[_0x0156('0x6')],'exten':_0x58208a[_0x0156('0x7')],'priority':_0x266451++,'VoiceExtensionId':_0x58208a['id']},{'type':_0x0156('0xf'),'app':'Set','appdata':_0x0156('0x1c')+_0x58208a[_0x0156('0x1a')]||_0x0156('0x1d'),'context':_0x58208a[_0x0156('0x6')],'exten':_0x58208a['exten'],'priority':_0x266451++,'VoiceExtensionId':_0x58208a['id']});}return _0x413472;}function _0x240e31(_0xcd74b8,_0x3dabd3){var _0x31a307=[{'name':_0x0156('0x1e'),'param':0x0},{'name':_0x0156('0x1f'),'param':0x1},{'name':_0x0156('0x20'),'param':0x2},{'name':'url','param':0x3}];var _0x8b4197={};var _0xa13028=_0x3dabd3[_0x0156('0x21')](',');var _0x19e714=[];for(var _0x5df9da=0x0;_0x5df9da<_0x31a307[_0x0156('0x22')];_0x5df9da++){switch(_0x31a307[_0x5df9da][_0x0156('0x23')]){case _0x0156('0x1e'):_0x8b4197[_0x0156('0x1e')]=_0xa13028[_0x31a307[_0x5df9da][_0x0156('0x24')]][_0x0156('0x21')]('/')[0x1];_0x8b4197[_0x0156('0x25')]=_0xa13028[_0x31a307[_0x5df9da][_0x0156('0x24')]][_0x0156('0x21')]('/')[0x2];_0x8b4197[_0x0156('0x26')]=_0x8b4197[_0x0156('0x25')]?_0x8b4197[_0x0156('0x25')]['split']('$')[0x0]:undefined;_0x8b4197['phone']=_0xcd74b8['cutdigits']?(_0x8b4197['prefix']||'')+_0x0156('0x13')+_0xcd74b8['cutdigits']+'}':(_0x8b4197['prefix']||'')+_0x0156('0x14');_0x19e714[_0x31a307[_0x5df9da][_0x0156('0x24')]]=[_0x0156('0x27'),_0x8b4197[_0x0156('0x1e')],_0x8b4197[_0x0156('0x25')]][_0x0156('0x28')]('/');break;case _0x0156('0x20'):_0x8b4197[_0x0156('0x20')]=_0xa13028[_0x31a307[_0x5df9da][_0x0156('0x24')]];if(_0xcd74b8[_0x0156('0x1a')]!=='none'){if(_0x8b4197[_0x0156('0x20')]['indexOf'](_0x0156('0x29'))<0x0){_0x8b4197[_0x0156('0x20')]+=_0x0156('0x29');}}else{_0x8b4197['options']=_0x8b4197[_0x0156('0x20')][_0x0156('0x2a')](_0x0156('0x29'),'');}_0x19e714[_0x31a307[_0x5df9da][_0x0156('0x24')]]=_0x8b4197[_0x0156('0x20')];break;default:_0x19e714[_0x31a307[_0x5df9da][_0x0156('0x24')]]=_0xa13028[_0x31a307[_0x5df9da][_0x0156('0x24')]];}}return _0x19e714[_0x0156('0x28')](',');}function _0x546a09(_0x52cfd3,_0x55d2f4,_0xc5a539){return new Promise(function(_0x5b3db5,_0x445c14){var _0x4e06ab=[];if(_['isEmpty'](_0x55d2f4))return _0x5b3db5(_0x4e06ab);_0x267300[_0x0156('0x2b')][_0x0156('0x2c')]({'attributes':['id',_0x0156('0x2d'),_0x0156('0x2e')],'raw':!![]})[_0x0156('0x2f')](function(_0x3bb06c){for(var _0xe8e27f=0x0,_0x15c881=0x0;_0xe8e27f<_0x55d2f4[_0x0156('0x22')];_0xe8e27f++,_0x15c881=0x0){var _0x44e2c6=_0x55d2f4[_0xe8e27f];var _0x1fea57=[];var _0x49fb80=[];delete _0x44e2c6['id'];if(_0x44e2c6['interval']!==_0x0156('0x30')){_0x44e2c6[_0x0156('0x31')]=[_0x44e2c6[_0x0156('0x2d')]];}else{_0x44e2c6[_0x0156('0x31')]=_0x44e2c6[_0x0156('0x2e')]?_['map'](_[_0x0156('0x32')](_0x3bb06c,{'IntervalId':_0x44e2c6[_0x0156('0x2e')]}),'interval'):[];}_0x44e2c6[_0x0156('0x6')]=_0x52cfd3[_0x0156('0x6')];_0x44e2c6[_0x0156('0x7')]=_0x52cfd3[_0x0156('0x7')];if(_0x44e2c6[_0x0156('0x3')])_0x44e2c6['type']=_0x44e2c6[_0x0156('0x3')][_0x0156('0x33')]();if(_0x52cfd3['type']===_0x0156('0xf')){if(_0x44e2c6[_0x0156('0x34')](_0x0156('0x35'))&&_0x44e2c6[_0x0156('0x35')]&&_0x44e2c6[_0x0156('0x35')]!=='--'){_0x1fea57['push']({'type':_0x44e2c6[_0x0156('0x3')][_0x0156('0x33')](),'app':_0x0156('0x4'),'appdata':_0x0156('0x36')+_0x44e2c6[_0x0156('0x35')],'context':_0x52cfd3[_0x0156('0x6')],'exten':_0x52cfd3[_0x0156('0x7')],'priority':_0x44e2c6['intervals'][_0x0156('0x22')]+_0xc5a539+_0x15c881++,'VoiceExtensionId':_0x52cfd3['id']});}_0x1fea57['push']({'type':_0x44e2c6[_0x0156('0x3')][_0x0156('0x33')](),'app':_0x0156('0x37'),'appdata':_0x0156('0x38')+(_0x44e2c6[_0x0156('0x39')]?'Set(CALLERID(all)='+_0x44e2c6['callerID']+')':_0x0156('0x3a')),'context':_0x52cfd3[_0x0156('0x6')],'exten':_0x52cfd3['exten'],'priority':_0x44e2c6[_0x0156('0x31')][_0x0156('0x22')]+_0xc5a539+_0x15c881++,'VoiceExtensionId':_0x52cfd3['id']});}else{if(_0x44e2c6[_0x0156('0x34')](_0x0156('0x3b'))){if([_0x0156('0x3c'),_0x0156('0x3d')][_0x0156('0x3e')](_0x44e2c6[_0x0156('0x3f')][_0x0156('0x33')]())&&_0x44e2c6[_0x0156('0x40')]!=='custom'){if(_0x44e2c6['answer']){_0x1fea57[_0x0156('0xb')]({'type':_0x44e2c6[_0x0156('0x3')][_0x0156('0x33')](),'app':_0x0156('0x37'),'appdata':_0x0156('0x41'),'context':_0x52cfd3['context'],'exten':_0x52cfd3['exten'],'priority':_0x44e2c6[_0x0156('0x31')]['length']+_0xc5a539+_0x15c881++,'VoiceExtensionId':_0x52cfd3['id']});_0x1fea57[_0x0156('0xb')]({'type':_0x44e2c6[_0x0156('0x3')]['toLowerCase'](),'app':'Set','appdata':_0x0156('0x42'),'context':_0x52cfd3[_0x0156('0x6')],'exten':_0x52cfd3[_0x0156('0x7')],'priority':_0x44e2c6[_0x0156('0x31')][_0x0156('0x22')]+_0xc5a539+_0x15c881++,'VoiceExtensionId':_0x52cfd3['id']});}else{_0x1fea57[_0x0156('0xb')]({'type':_0x44e2c6[_0x0156('0x3')][_0x0156('0x33')](),'app':_0x0156('0x37'),'appdata':_0x0156('0x43'),'context':_0x52cfd3[_0x0156('0x6')],'exten':_0x52cfd3[_0x0156('0x7')],'priority':_0x44e2c6[_0x0156('0x31')]['length']+_0xc5a539+_0x15c881++,'VoiceExtensionId':_0x52cfd3['id']});_0x1fea57[_0x0156('0xb')]({'type':_0x44e2c6[_0x0156('0x3')]['toLowerCase'](),'app':_0x0156('0x4'),'appdata':_0x0156('0x44'),'context':_0x52cfd3['context'],'exten':_0x52cfd3[_0x0156('0x7')],'priority':_0x44e2c6['intervals'][_0x0156('0x22')]+_0xc5a539+_0x15c881++,'VoiceExtensionId':_0x52cfd3['id']});}}}}for(var _0x116036=0x0;_0x116036<_0x44e2c6[_0x0156('0x31')][_0x0156('0x22')];_0x116036++){var _0x6bfd5f=_0xc5a539+_0x44e2c6[_0x0156('0x31')][_0x0156('0x22')];var _0x1304db=_0x116036===_0x44e2c6[_0x0156('0x31')]['length']-0x1?_0xc5a539+_0x1fea57[_0x0156('0x22')]+_0x49fb80[_0x0156('0x22')]+0x2:_0xc5a539+_0x116036+0x1;_0x1fea57[_0x0156('0x45')](_0x116036,0x0,{'type':_0x52cfd3['type'],'app':_0x0156('0x46'),'appdata':_0x44e2c6['intervals'][_0x116036]+'?'+_0x52cfd3[_0x0156('0x6')]+_0x0156('0x47')+_0x6bfd5f+':'+_0x52cfd3[_0x0156('0x6')]+',${EXTEN},'+_0x1304db,'exten':_0x52cfd3[_0x0156('0x7')],'context':_0x52cfd3['context'],'priority':_0xc5a539+_0x116036,'VoiceExtensionId':_0x52cfd3['id']});}if(_0x44e2c6['appType']===_0x0156('0x48'))_0x44e2c6[_0x0156('0x49')]=_0x240e31(_0x52cfd3,_0x44e2c6[_0x0156('0x49')]);_0x44e2c6[_0x0156('0x4a')]=_0x1fea57[_0x0156('0x22')]?_[_0x0156('0x4b')](_0x1fea57)[_0x0156('0x4a')]+0x1:_0xc5a539;_0x4e06ab=_[_0x0156('0x4c')](_0x4e06ab,_0x1fea57,[_0x44e2c6],_0x49fb80);_0xc5a539=_[_0x0156('0x4b')](_0x4e06ab)[_0x0156('0x4a')]+0x1;}return _0x5b3db5(_0x4e06ab);})[_0x0156('0x4d')](function(_0x185a88){_0x445c14(_0x185a88);});});}return _0x4289b2[_0x0156('0x4e')](_0x0156('0x4f'),attributes,{'tableName':_0x0156('0x50'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x2ebaf8){var _0x551972=this['get']({'plain':!![]});var _0x3042c0=_0x551972['type']===_0x0156('0xf')?_0x435684(_0x551972):_0x4bce82(_0x551972);return _0x546a09(_0x551972,_0x2ebaf8,_[_0x0156('0x4b')](_0x3042c0)['priority']+0x1)[_0x0156('0x2f')](function(_0x5c3429){var _0x5a4233=_[_0x0156('0x4c')](_0x3042c0,_0x5c3429);_0x5a4233[_0x0156('0xb')]({'type':_0x551972[_0x0156('0x3')],'app':_0x0156('0x51'),'exten':_0x551972[_0x0156('0x7')],'context':_0x551972[_0x0156('0x6')],'priority':_[_0x0156('0x4b')](_0x5a4233)[_0x0156('0x4a')]+0x1,'VoiceExtensionId':_0x551972['id']});return _0x5a4233;});}}});}; \ No newline at end of file +var _0xb42d=['app','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','catch','define','VoiceExtension','voice_extensions','get','last','Hangup','lodash','./voiceExtension.attributes','exports','models','type','CDR(type)=','context','Set','NoOp','alias','CDR(routeAlias)=','exten','inbound','push','XCALLY-MOTION-ANSWER=0','CDR(type)=outbound','outbound','No\x20alias\x20set','cutdigits','${EXTEN}','ExecIf','CDR(prefix)=noprefix','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','split','length','name','param','phone','prefix','${EXTEN:','indexOf','U(xcally-mixmonitor-context)','replace','join','isEmpty','Interval','IntervalId','then','interval','*,*,*,*','intervals','map','tag','toLowerCase','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','playback','includes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb42d,0x1ed));var _0xdb42=function(_0x407bf7,_0x11ff51){_0x407bf7=_0x407bf7-0x0;var _0x53e678=_0xb42d[_0x407bf7];return _0x53e678;};'use strict';var _=require(_0xdb42('0x0'));var attributes=require(_0xdb42('0x1'));module[_0xdb42('0x2')]=function(_0x26fe9e){var _0x2acfe9=_0x26fe9e[_0xdb42('0x3')];function _0x264700(_0x55af0d){var _0x3bea2a=0x2;var _0x5a2d49=[{'type':_0x55af0d[_0xdb42('0x4')],'app':'Set','appdata':_0xdb42('0x5')+_0x55af0d[_0xdb42('0x4')],'context':_0x55af0d[_0xdb42('0x6')],'exten':_0x55af0d['exten'],'priority':_0x3bea2a++,'VoiceExtensionId':_0x55af0d['id']},{'type':_0x55af0d[_0xdb42('0x4')],'app':_0x55af0d['alias']?_0xdb42('0x7'):_0xdb42('0x8'),'appdata':_0x55af0d[_0xdb42('0x9')]?_0xdb42('0xa')+_0x55af0d[_0xdb42('0x9')]:'No\x20alias\x20set','context':_0x55af0d['context'],'exten':_0x55af0d[_0xdb42('0xb')],'priority':_0x3bea2a++,'VoiceExtensionId':_0x55af0d['id']}];if(_0x55af0d[_0xdb42('0x4')]===_0xdb42('0xc')){_0x5a2d49[_0xdb42('0xd')]({'type':_0xdb42('0xc'),'app':'Set','appdata':'CDR(routeid)='+_0x55af0d['id'],'context':_0x55af0d['context'],'exten':_0x55af0d['exten'],'priority':_0x3bea2a++,'VoiceExtensionId':_0x55af0d['id']});}_0x5a2d49[_0xdb42('0xd')]({'type':_0x55af0d[_0xdb42('0x4')],'app':_0xdb42('0x7'),'appdata':_0xdb42('0xe'),'context':_0x55af0d[_0xdb42('0x6')],'exten':_0x55af0d[_0xdb42('0xb')],'priority':_0x3bea2a++,'VoiceExtensionId':_0x55af0d['id']},{'type':_0x55af0d[_0xdb42('0x4')],'app':_0xdb42('0x7'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x55af0d['context'],'exten':_0x55af0d['exten'],'priority':_0x3bea2a++,'VoiceExtensionId':_0x55af0d['id']},{'type':_0x55af0d[_0xdb42('0x4')],'app':_0xdb42('0x7'),'appdata':'MONITOR_OPTIONS=ab','context':_0x55af0d['context'],'exten':_0x55af0d['exten'],'priority':_0x3bea2a++,'VoiceExtensionId':_0x55af0d['id']});return _0x5a2d49;}function _0x163a6d(_0xa8a86){var _0x1b44b8=0x2;var _0x3122de=[{'type':'outbound','app':_0xdb42('0x7'),'appdata':_0xdb42('0xf'),'context':_0xa8a86[_0xdb42('0x6')],'exten':_0xa8a86[_0xdb42('0xb')],'priority':_0x1b44b8++,'VoiceExtensionId':_0xa8a86['id']},{'type':_0xdb42('0x10'),'app':_0xa8a86[_0xdb42('0x9')]?_0xdb42('0x7'):'NoOp','appdata':_0xa8a86[_0xdb42('0x9')]?_0xdb42('0xa')+_0xa8a86[_0xdb42('0x9')]:_0xdb42('0x11'),'context':_0xa8a86[_0xdb42('0x6')],'exten':_0xa8a86[_0xdb42('0xb')],'priority':_0x1b44b8++,'VoiceExtensionId':_0xa8a86['id']},{'type':_0xdb42('0x10'),'app':_0xdb42('0x7'),'appdata':'CDR(destination)='+(_0xa8a86['cutdigits']?'${EXTEN:'+_0xa8a86[_0xdb42('0x12')]+'}':_0xdb42('0x13')),'context':_0xa8a86[_0xdb42('0x6')],'exten':_0xa8a86[_0xdb42('0xb')],'priority':_0x1b44b8++,'VoiceExtensionId':_0xa8a86['id']},{'type':'outbound','app':_0xdb42('0x7'),'appdata':'CDR(routeid)='+_0xa8a86['id'],'context':_0xa8a86['context'],'exten':_0xa8a86[_0xdb42('0xb')],'priority':_0x1b44b8++,'VoiceExtensionId':_0xa8a86['id']},{'type':_0xdb42('0x10'),'app':_0xdb42('0x14'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x1b44b8+0x2)+'):Goto('+(_0x1b44b8+0x1)+')','context':_0xa8a86[_0xdb42('0x6')],'exten':_0xa8a86[_0xdb42('0xb')],'priority':_0x1b44b8++,'VoiceExtensionId':_0xa8a86['id']},{'type':'outbound','app':_0xdb42('0x7'),'appdata':_0xa8a86[_0xdb42('0x12')]?'CDR(prefix)=${EXTEN:0:'+_0xa8a86['cutdigits']+'}':_0xdb42('0x15'),'context':_0xa8a86[_0xdb42('0x6')],'exten':_0xa8a86[_0xdb42('0xb')],'priority':_0x1b44b8++,'VoiceExtensionId':_0xa8a86['id']},{'type':_0xdb42('0x10'),'app':'Set','appdata':_0xdb42('0xe'),'context':_0xa8a86[_0xdb42('0x6')],'exten':_0xa8a86[_0xdb42('0xb')],'priority':_0x1b44b8++,'VoiceExtensionId':_0xa8a86['id']},{'type':'outbound','app':'Set','appdata':_0xdb42('0x16'),'context':_0xa8a86[_0xdb42('0x6')],'exten':_0xa8a86['exten'],'priority':_0x1b44b8++,'VoiceExtensionId':_0xa8a86['id']},{'type':_0xdb42('0x10'),'app':_0xdb42('0x7'),'appdata':_0xdb42('0x17'),'context':_0xa8a86[_0xdb42('0x6')],'exten':_0xa8a86[_0xdb42('0xb')],'priority':_0x1b44b8++,'VoiceExtensionId':_0xa8a86['id']},{'type':_0xdb42('0x10'),'app':_0xdb42('0x7'),'appdata':_0xdb42('0x18')+_0xa8a86['id'],'context':_0xa8a86['context'],'exten':_0xa8a86[_0xdb42('0xb')],'priority':_0x1b44b8++,'VoiceExtensionId':_0xa8a86['id']}];if(_0xa8a86[_0xdb42('0x19')](_0xdb42('0x1a'))&&_0xa8a86[_0xdb42('0x1a')]!==_0xdb42('0x1b')){_0x3122de['push']({'type':_0xdb42('0x10'),'app':_0xdb42('0x7'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0xa8a86[_0xdb42('0x6')],'exten':_0xa8a86[_0xdb42('0xb')],'priority':_0x1b44b8++,'VoiceExtensionId':_0xa8a86['id']},{'type':_0xdb42('0x10'),'app':_0xdb42('0x7'),'appdata':_0xdb42('0x1c')+_0xa8a86['recordingFormat']||_0xdb42('0x1d'),'context':_0xa8a86['context'],'exten':_0xa8a86[_0xdb42('0xb')],'priority':_0x1b44b8++,'VoiceExtensionId':_0xa8a86['id']});}return _0x3122de;}function _0x44a2b6(_0x26cfba,_0x24ca88){var _0x4c78e3=[{'name':_0xdb42('0x1e'),'param':0x0},{'name':_0xdb42('0x1f'),'param':0x1},{'name':_0xdb42('0x20'),'param':0x2},{'name':'url','param':0x3}];var _0x18b42e={};var _0x2b3e42=_0x24ca88[_0xdb42('0x21')](',');var _0x14d39a=[];for(var _0x357c29=0x0;_0x357c29<_0x4c78e3[_0xdb42('0x22')];_0x357c29++){switch(_0x4c78e3[_0x357c29][_0xdb42('0x23')]){case _0xdb42('0x1e'):_0x18b42e['trunk']=_0x2b3e42[_0x4c78e3[_0x357c29][_0xdb42('0x24')]][_0xdb42('0x21')]('/')[0x1];_0x18b42e[_0xdb42('0x25')]=_0x2b3e42[_0x4c78e3[_0x357c29][_0xdb42('0x24')]][_0xdb42('0x21')]('/')[0x2];_0x18b42e[_0xdb42('0x26')]=_0x18b42e[_0xdb42('0x25')]?_0x18b42e[_0xdb42('0x25')][_0xdb42('0x21')]('$')[0x0]:undefined;_0x18b42e[_0xdb42('0x25')]=_0x26cfba[_0xdb42('0x12')]?(_0x18b42e['prefix']||'')+_0xdb42('0x27')+_0x26cfba['cutdigits']+'}':(_0x18b42e[_0xdb42('0x26')]||'')+_0xdb42('0x13');_0x14d39a[_0x4c78e3[_0x357c29]['param']]=['SIP',_0x18b42e[_0xdb42('0x1e')],_0x18b42e[_0xdb42('0x25')]]['join']('/');break;case _0xdb42('0x20'):_0x18b42e['options']=_0x2b3e42[_0x4c78e3[_0x357c29][_0xdb42('0x24')]];if(_0x26cfba[_0xdb42('0x1a')]!==_0xdb42('0x1b')){if(_0x18b42e['options'][_0xdb42('0x28')]('U(xcally-mixmonitor-context)')<0x0){_0x18b42e['options']+=_0xdb42('0x29');}}else{_0x18b42e[_0xdb42('0x20')]=_0x18b42e[_0xdb42('0x20')][_0xdb42('0x2a')](_0xdb42('0x29'),'');}_0x14d39a[_0x4c78e3[_0x357c29][_0xdb42('0x24')]]=_0x18b42e['options'];break;default:_0x14d39a[_0x4c78e3[_0x357c29][_0xdb42('0x24')]]=_0x2b3e42[_0x4c78e3[_0x357c29]['param']];}}return _0x14d39a[_0xdb42('0x2b')](',');}function _0x4f7845(_0x19ff50,_0x19e145,_0xf8a8df){return new Promise(function(_0xd75667,_0x1e55a2){var _0x4629f0=[];if(_[_0xdb42('0x2c')](_0x19e145))return _0xd75667(_0x4629f0);_0x2acfe9[_0xdb42('0x2d')]['findAll']({'attributes':['id','interval',_0xdb42('0x2e')],'raw':!![]})[_0xdb42('0x2f')](function(_0x3ac289){for(var _0x45f382=0x0,_0x14561b=0x0;_0x45f382<_0x19e145[_0xdb42('0x22')];_0x45f382++,_0x14561b=0x0){var _0x140670=_0x19e145[_0x45f382];var _0x3e1791=[];var _0x412fa9=[];delete _0x140670['id'];if(_0x140670[_0xdb42('0x30')]!==_0xdb42('0x31')){_0x140670[_0xdb42('0x32')]=[_0x140670[_0xdb42('0x30')]];}else{_0x140670[_0xdb42('0x32')]=_0x140670['IntervalId']?_[_0xdb42('0x33')](_['filter'](_0x3ac289,{'IntervalId':_0x140670['IntervalId']}),_0xdb42('0x30')):[];}_0x140670[_0xdb42('0x6')]=_0x19ff50[_0xdb42('0x6')];_0x140670[_0xdb42('0xb')]=_0x19ff50[_0xdb42('0xb')];if(_0x140670[_0xdb42('0x4')])_0x140670[_0xdb42('0x4')]=_0x140670['type']['toLowerCase']();if(_0x19ff50[_0xdb42('0x4')]===_0xdb42('0x10')){if(_0x140670[_0xdb42('0x19')](_0xdb42('0x34'))&&_0x140670['tag']&&_0x140670[_0xdb42('0x34')]!=='--'){_0x3e1791['push']({'type':_0x140670['type'][_0xdb42('0x35')](),'app':_0xdb42('0x7'),'appdata':_0xdb42('0x36')+_0x140670[_0xdb42('0x34')],'context':_0x19ff50[_0xdb42('0x6')],'exten':_0x19ff50['exten'],'priority':_0x140670[_0xdb42('0x32')][_0xdb42('0x22')]+_0xf8a8df+_0x14561b++,'VoiceExtensionId':_0x19ff50['id']});}_0x3e1791[_0xdb42('0xd')]({'type':_0x140670['type']['toLowerCase'](),'app':_0xdb42('0x14'),'appdata':_0xdb42('0x37')+(_0x140670[_0xdb42('0x38')]?'Set(CALLERID(all)='+_0x140670[_0xdb42('0x38')]+')':_0xdb42('0x39')),'context':_0x19ff50[_0xdb42('0x6')],'exten':_0x19ff50[_0xdb42('0xb')],'priority':_0x140670[_0xdb42('0x32')][_0xdb42('0x22')]+_0xf8a8df+_0x14561b++,'VoiceExtensionId':_0x19ff50['id']});}else{if(_0x140670[_0xdb42('0x19')]('answer')){if(['queue',_0xdb42('0x3a')][_0xdb42('0x3b')](_0x140670[_0xdb42('0x3c')][_0xdb42('0x35')]())&&_0x140670[_0xdb42('0x3d')]!==_0xdb42('0x3e')){if(_0x140670['answer']){_0x3e1791['push']({'type':_0x140670[_0xdb42('0x4')][_0xdb42('0x35')](),'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x19ff50[_0xdb42('0x6')],'exten':_0x19ff50['exten'],'priority':_0x140670[_0xdb42('0x32')][_0xdb42('0x22')]+_0xf8a8df+_0x14561b++,'VoiceExtensionId':_0x19ff50['id']});_0x3e1791[_0xdb42('0xd')]({'type':_0x140670[_0xdb42('0x4')]['toLowerCase'](),'app':_0xdb42('0x7'),'appdata':_0xdb42('0x3f'),'context':_0x19ff50[_0xdb42('0x6')],'exten':_0x19ff50[_0xdb42('0xb')],'priority':_0x140670[_0xdb42('0x32')]['length']+_0xf8a8df+_0x14561b++,'VoiceExtensionId':_0x19ff50['id']});}else{_0x3e1791['push']({'type':_0x140670['type'][_0xdb42('0x35')](),'app':_0xdb42('0x14'),'appdata':_0xdb42('0x40'),'context':_0x19ff50['context'],'exten':_0x19ff50[_0xdb42('0xb')],'priority':_0x140670[_0xdb42('0x32')]['length']+_0xf8a8df+_0x14561b++,'VoiceExtensionId':_0x19ff50['id']});_0x3e1791[_0xdb42('0xd')]({'type':_0x140670[_0xdb42('0x4')][_0xdb42('0x35')](),'app':_0xdb42('0x7'),'appdata':_0xdb42('0x41'),'context':_0x19ff50[_0xdb42('0x6')],'exten':_0x19ff50['exten'],'priority':_0x140670[_0xdb42('0x32')]['length']+_0xf8a8df+_0x14561b++,'VoiceExtensionId':_0x19ff50['id']});}}}}for(var _0x342058=0x0;_0x342058<_0x140670[_0xdb42('0x32')][_0xdb42('0x22')];_0x342058++){var _0x1d2463=_0xf8a8df+_0x140670[_0xdb42('0x32')]['length'];var _0x21c432=_0x342058===_0x140670[_0xdb42('0x32')][_0xdb42('0x22')]-0x1?_0xf8a8df+_0x3e1791['length']+_0x412fa9[_0xdb42('0x22')]+0x2:_0xf8a8df+_0x342058+0x1;_0x3e1791[_0xdb42('0x42')](_0x342058,0x0,{'type':_0x19ff50[_0xdb42('0x4')],'app':_0xdb42('0x43'),'appdata':_0x140670[_0xdb42('0x32')][_0x342058]+'?'+_0x19ff50[_0xdb42('0x6')]+_0xdb42('0x44')+_0x1d2463+':'+_0x19ff50['context']+',${EXTEN},'+_0x21c432,'exten':_0x19ff50['exten'],'context':_0x19ff50[_0xdb42('0x6')],'priority':_0xf8a8df+_0x342058,'VoiceExtensionId':_0x19ff50['id']});}if(_0x140670[_0xdb42('0x3d')]===_0xdb42('0x45'))_0x140670[_0xdb42('0x46')]=_0x44a2b6(_0x19ff50,_0x140670['appdata']);_0x140670[_0xdb42('0x47')]=_0x3e1791[_0xdb42('0x22')]?_['last'](_0x3e1791)[_0xdb42('0x47')]+0x1:_0xf8a8df;_0x4629f0=_['concat'](_0x4629f0,_0x3e1791,[_0x140670],_0x412fa9);_0xf8a8df=_['last'](_0x4629f0)[_0xdb42('0x47')]+0x1;}return _0xd75667(_0x4629f0);})[_0xdb42('0x48')](function(_0x2a05dd){_0x1e55a2(_0x2a05dd);});});}return _0x26fe9e[_0xdb42('0x49')](_0xdb42('0x4a'),attributes,{'tableName':_0xdb42('0x4b'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x205065){var _0x36bd14=this[_0xdb42('0x4c')]({'plain':!![]});var _0x3d369a=_0x36bd14[_0xdb42('0x4')]===_0xdb42('0x10')?_0x163a6d(_0x36bd14):_0x264700(_0x36bd14);return _0x4f7845(_0x36bd14,_0x205065,_[_0xdb42('0x4d')](_0x3d369a)['priority']+0x1)['then'](function(_0x347f0a){var _0x39ab4c=_['concat'](_0x3d369a,_0x347f0a);_0x39ab4c[_0xdb42('0xd')]({'type':_0x36bd14['type'],'app':_0xdb42('0x4e'),'exten':_0x36bd14[_0xdb42('0xb')],'context':_0x36bd14[_0xdb42('0x6')],'priority':_[_0xdb42('0x4d')](_0x39ab4c)[_0xdb42('0x47')]+0x1,'VoiceExtensionId':_0x36bd14['id']});return _0x39ab4c;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 10ee005..da831df 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 _0x7f27=['result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','include','map','model','debug','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','register','request','then','VoiceExtension,\x20%s,\x20%s','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info'];(function(_0x35aebb,_0x5d8503){var _0x326b32=function(_0x16f7c5){while(--_0x16f7c5){_0x35aebb['push'](_0x35aebb['shift']());}};_0x326b32(++_0x5d8503);}(_0x7f27,0x12e));var _0x77f2=function(_0x1b7a10,_0x5785cb){_0x1b7a10=_0x1b7a10-0x0;var _0x43d448=_0x7f27[_0x1b7a10];return _0x43d448;};'use strict';var _=require(_0x77f2('0x0'));var util=require(_0x77f2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x77f2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x77f2('0x3'));var logger=require(_0x77f2('0x4'))(_0x77f2('0x5'));var config=require('../../config/environment');var jayson=require(_0x77f2('0x6'));var client=jayson['client'][_0x77f2('0x7')]({'port':0x232a});config[_0x77f2('0x8')]=_['defaults'](config[_0x77f2('0x8')],{'host':_0x77f2('0x9'),'port':0x18eb});var socket=require(_0x77f2('0xa'))(new Redis(config[_0x77f2('0x8')]));require('./voiceExtension.socket')[_0x77f2('0xb')](socket);function respondWithRpcPromise(_0x10c244,_0x5767cb,_0x24e730){return new BPromise(function(_0x10a5fe,_0x265791){return client[_0x77f2('0xc')](_0x10c244,_0x24e730)[_0x77f2('0xd')](function(_0x126dcf){logger['info'](_0x77f2('0xe'),_0x5767cb,'request\x20sent');logger['debug'](_0x77f2('0xf'),_0x5767cb,_0x77f2('0x10'),JSON[_0x77f2('0x11')](_0x126dcf));if(_0x126dcf[_0x77f2('0x12')]){if(_0x126dcf[_0x77f2('0x12')][_0x77f2('0x13')]===0x1f4){logger['error'](_0x77f2('0xe'),_0x5767cb,_0x126dcf[_0x77f2('0x12')][_0x77f2('0x14')]);return _0x265791(_0x126dcf[_0x77f2('0x12')][_0x77f2('0x14')]);}logger[_0x77f2('0x12')](_0x77f2('0xe'),_0x5767cb,_0x126dcf[_0x77f2('0x12')][_0x77f2('0x14')]);return _0x10a5fe(_0x126dcf['error'][_0x77f2('0x14')]);}else{logger[_0x77f2('0x15')](_0x77f2('0xe'),_0x5767cb,_0x77f2('0x10'));_0x10a5fe(_0x126dcf[_0x77f2('0x16')]['message']);}})[_0x77f2('0x17')](function(_0x296900){logger[_0x77f2('0x12')](_0x77f2('0xe'),_0x5767cb,_0x296900);_0x265791(_0x296900);});});}exports[_0x77f2('0x18')]=function(_0x15c7eb){var _0x291633=this;return new Promise(function(_0x171b37,_0x3a8ce2){return db[_0x77f2('0x19')][_0x77f2('0x1a')]({'raw':_0x15c7eb[_0x77f2('0x1b')]?_0x15c7eb[_0x77f2('0x1b')][_0x77f2('0x1c')]===undefined?!![]:![]:!![],'where':_0x15c7eb[_0x77f2('0x1b')]?_0x15c7eb['options'][_0x77f2('0x1d')]||null:null,'attributes':_0x15c7eb[_0x77f2('0x1b')]?_0x15c7eb[_0x77f2('0x1b')][_0x77f2('0x1e')]||null:null,'limit':_0x15c7eb[_0x77f2('0x1b')]?_0x15c7eb['options'][_0x77f2('0x1f')]||null:null,'include':_0x15c7eb[_0x77f2('0x1b')]?_0x15c7eb[_0x77f2('0x1b')][_0x77f2('0x20')]?_[_0x77f2('0x21')](_0x15c7eb[_0x77f2('0x1b')][_0x77f2('0x20')],function(_0x42f510){return{'model':db[_0x42f510['model']],'as':_0x42f510['as'],'attributes':_0x42f510[_0x77f2('0x1e')],'include':_0x42f510[_0x77f2('0x20')]?_[_0x77f2('0x21')](_0x42f510[_0x77f2('0x20')],function(_0x4e4265){return{'model':db[_0x4e4265[_0x77f2('0x22')]],'as':_0x4e4265['as'],'attributes':_0x4e4265[_0x77f2('0x1e')],'include':_0x4e4265[_0x77f2('0x20')]?_[_0x77f2('0x21')](_0x4e4265[_0x77f2('0x20')],function(_0x5a260f){return{'model':db[_0x5a260f['model']],'as':_0x5a260f['as'],'attributes':_0x5a260f['attributes']};}):[]};}):[]};}):[]:[]})[_0x77f2('0xd')](function(_0x4c173e){logger[_0x77f2('0x15')](_0x77f2('0x18'),_0x15c7eb);logger[_0x77f2('0x23')](_0x77f2('0x18'),_0x15c7eb,JSON['stringify'](_0x4c173e));_0x171b37(_0x4c173e);})['catch'](function(_0x1f89e5){logger['error'](_0x77f2('0x18'),_0x1f89e5[_0x77f2('0x14')],_0x15c7eb);_0x3a8ce2(_0x291633[_0x77f2('0x12')](0x1f4,_0x1f89e5[_0x77f2('0x14')]));});});}; \ No newline at end of file +var _0xdc97=['GetVoiceExtension','VoiceExtension','findAll','options','limit','include','map','model','attributes','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceExtension,\x20%s,\x20%s','message','info','catch'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xdc97,0x13b));var _0x7dc9=function(_0xd2b113,_0xebb885){_0xd2b113=_0xd2b113-0x0;var _0x484d83=_0xdc97[_0xd2b113];return _0x484d83;};'use strict';var _=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var moment=require(_0x7dc9('0x2'));var BPromise=require('bluebird');var rs=require(_0x7dc9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7dc9('0x4'))['db'];var utils=require(_0x7dc9('0x5'));var logger=require('../../config/logger')(_0x7dc9('0x6'));var config=require(_0x7dc9('0x7'));var jayson=require(_0x7dc9('0x8'));var client=jayson[_0x7dc9('0x9')]['http']({'port':0x232a});config[_0x7dc9('0xa')]=_['defaults'](config['redis'],{'host':_0x7dc9('0xb'),'port':0x18eb});var socket=require(_0x7dc9('0xc'))(new Redis(config[_0x7dc9('0xa')]));require(_0x7dc9('0xd'))[_0x7dc9('0xe')](socket);function respondWithRpcPromise(_0x5ca05b,_0xb2fa2a,_0x44fe24){return new BPromise(function(_0x37dfc,_0x1dc3f7){return client[_0x7dc9('0xf')](_0x5ca05b,_0x44fe24)[_0x7dc9('0x10')](function(_0x1e336a){logger['info']('VoiceExtension,\x20%s,\x20%s',_0xb2fa2a,'request\x20sent');logger['debug'](_0x7dc9('0x11'),_0xb2fa2a,_0x7dc9('0x12'),JSON['stringify'](_0x1e336a));if(_0x1e336a[_0x7dc9('0x13')]){if(_0x1e336a[_0x7dc9('0x13')][_0x7dc9('0x14')]===0x1f4){logger[_0x7dc9('0x13')](_0x7dc9('0x15'),_0xb2fa2a,_0x1e336a[_0x7dc9('0x13')]['message']);return _0x1dc3f7(_0x1e336a[_0x7dc9('0x13')][_0x7dc9('0x16')]);}logger[_0x7dc9('0x13')](_0x7dc9('0x15'),_0xb2fa2a,_0x1e336a[_0x7dc9('0x13')][_0x7dc9('0x16')]);return _0x37dfc(_0x1e336a[_0x7dc9('0x13')][_0x7dc9('0x16')]);}else{logger[_0x7dc9('0x17')]('VoiceExtension,\x20%s,\x20%s',_0xb2fa2a,_0x7dc9('0x12'));_0x37dfc(_0x1e336a['result'][_0x7dc9('0x16')]);}})[_0x7dc9('0x18')](function(_0x5d61d7){logger[_0x7dc9('0x13')](_0x7dc9('0x15'),_0xb2fa2a,_0x5d61d7);_0x1dc3f7(_0x5d61d7);});});}exports[_0x7dc9('0x19')]=function(_0x4b2703){var _0x43ec33=this;return new Promise(function(_0x184bfd,_0x2dad65){return db[_0x7dc9('0x1a')][_0x7dc9('0x1b')]({'raw':_0x4b2703[_0x7dc9('0x1c')]?_0x4b2703['options']['raw']===undefined?!![]:![]:!![],'where':_0x4b2703[_0x7dc9('0x1c')]?_0x4b2703[_0x7dc9('0x1c')]['where']||null:null,'attributes':_0x4b2703[_0x7dc9('0x1c')]?_0x4b2703[_0x7dc9('0x1c')]['attributes']||null:null,'limit':_0x4b2703[_0x7dc9('0x1c')]?_0x4b2703[_0x7dc9('0x1c')][_0x7dc9('0x1d')]||null:null,'include':_0x4b2703['options']?_0x4b2703[_0x7dc9('0x1c')][_0x7dc9('0x1e')]?_[_0x7dc9('0x1f')](_0x4b2703['options']['include'],function(_0x4b9ba6){return{'model':db[_0x4b9ba6[_0x7dc9('0x20')]],'as':_0x4b9ba6['as'],'attributes':_0x4b9ba6[_0x7dc9('0x21')],'include':_0x4b9ba6['include']?_['map'](_0x4b9ba6[_0x7dc9('0x1e')],function(_0x5afb7d){return{'model':db[_0x5afb7d[_0x7dc9('0x20')]],'as':_0x5afb7d['as'],'attributes':_0x5afb7d[_0x7dc9('0x21')],'include':_0x5afb7d[_0x7dc9('0x1e')]?_[_0x7dc9('0x1f')](_0x5afb7d[_0x7dc9('0x1e')],function(_0x450124){return{'model':db[_0x450124[_0x7dc9('0x20')]],'as':_0x450124['as'],'attributes':_0x450124[_0x7dc9('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7dc9('0x10')](function(_0x3c4379){logger[_0x7dc9('0x17')](_0x7dc9('0x19'),_0x4b2703);logger['debug']('GetVoiceExtension',_0x4b2703,JSON['stringify'](_0x3c4379));_0x184bfd(_0x3c4379);})['catch'](function(_0x4a68f0){logger['error']('GetVoiceExtension',_0x4a68f0['message'],_0x4b2703);_0x2dad65(_0x43ec33[_0x7dc9('0x13')](0x1f4,_0x4a68f0[_0x7dc9('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 83b3546..129c218 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 _0x4975=['length','./voiceExtension.events','remove','update','emit','removeListener','register'];(function(_0x5d9d7b,_0x463267){var _0x33fe6b=function(_0x1e0838){while(--_0x1e0838){_0x5d9d7b['push'](_0x5d9d7b['shift']());}};_0x33fe6b(++_0x463267);}(_0x4975,0x86));var _0x5497=function(_0x2207e2,_0x539a27){_0x2207e2=_0x2207e2-0x0;var _0x2c617f=_0x4975[_0x2207e2];return _0x2c617f;};'use strict';var VoiceExtensionEvents=require(_0x5497('0x0'));var events=['save',_0x5497('0x1'),_0x5497('0x2')];function createListener(_0xfc7927,_0x349f5f){return function(_0x135f6f){_0x349f5f[_0x5497('0x3')](_0xfc7927,_0x135f6f);};}function removeListener(_0x14cecb,_0xeb31af){return function(){VoiceExtensionEvents[_0x5497('0x4')](_0x14cecb,_0xeb31af);};}exports[_0x5497('0x5')]=function(_0x539a27){for(var _0x37e48d=0x0,_0x4f563d=events[_0x5497('0x6')];_0x37e48d<_0x4f563d;_0x37e48d++){var _0x674a2a=events[_0x37e48d];var _0x368e8b=createListener('voiceExtension:'+_0x674a2a,_0x539a27);VoiceExtensionEvents['on'](_0x674a2a,_0x368e8b);}}; \ No newline at end of file +var _0x1cb9=['update','emit','removeListener','register','length','./voiceExtension.events','remove'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0x1cb9,0x14e));var _0x91cb=function(_0x59885d,_0x2d5790){_0x59885d=_0x59885d-0x0;var _0x586799=_0x1cb9[_0x59885d];return _0x586799;};'use strict';var VoiceExtensionEvents=require(_0x91cb('0x0'));var events=['save',_0x91cb('0x1'),_0x91cb('0x2')];function createListener(_0x2b1894,_0x351bdb){return function(_0x57ea48){_0x351bdb[_0x91cb('0x3')](_0x2b1894,_0x57ea48);};}function removeListener(_0x2b7314,_0x5652cd){return function(){VoiceExtensionEvents[_0x91cb('0x4')](_0x2b7314,_0x5652cd);};}exports[_0x91cb('0x5')]=function(_0x186dc3){for(var _0x28543e=0x0,_0x3b9d98=events[_0x91cb('0x6')];_0x28543e<_0x3b9d98;_0x28543e++){var _0x4c1f56=events[_0x28543e];var _0x15c517=createListener('voiceExtension:'+_0x4c1f56,_0x186dc3);VoiceExtensionEvents['on'](_0x4c1f56,_0x15c517);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 8e31e73..f297199 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 _0xb145=['show','/:id/messages','getMessages','post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','get','isAuthenticated','index','/:id'];(function(_0x2f36e2,_0x17699f){var _0x3de763=function(_0x4d02f4){while(--_0x4d02f4){_0x2f36e2['push'](_0x2f36e2['shift']());}};_0x3de763(++_0x17699f);}(_0xb145,0xa3));var _0x5b14=function(_0x49b8db,_0x344f3e){_0x49b8db=_0x49b8db-0x0;var _0x4792c9=_0xb145[_0x49b8db];return _0x4792c9;};'use strict';var multer=require('multer');var util=require(_0x5b14('0x0'));var path=require(_0x5b14('0x1'));var timeout=require(_0x5b14('0x2'));var express=require(_0x5b14('0x3'));var router=express[_0x5b14('0x4')]();var fs_extra=require(_0x5b14('0x5'));var auth=require(_0x5b14('0x6'));var interaction=require(_0x5b14('0x7'));var config=require('../../config/environment');var controller=require(_0x5b14('0x8'));router[_0x5b14('0x9')]('/',auth[_0x5b14('0xa')](),controller[_0x5b14('0xb')]);router['get'](_0x5b14('0xc'),auth[_0x5b14('0xa')](),controller[_0x5b14('0xd')]);router[_0x5b14('0x9')](_0x5b14('0xe'),auth['isAuthenticated'](),controller[_0x5b14('0xf')]);router[_0x5b14('0x10')]('/',auth['isAuthenticated'](),controller[_0x5b14('0x11')]);router[_0x5b14('0x12')](_0x5b14('0xc'),auth[_0x5b14('0xa')](),controller[_0x5b14('0x13')]);router['delete'](_0x5b14('0xc'),auth['isAuthenticated'](),controller[_0x5b14('0x14')]);module[_0x5b14('0x15')]=router; \ No newline at end of file +var _0x0a6b=['fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','isAuthenticated','index','/:id','show','getMessages','post','create','delete','destroy','exports','multer','express'];(function(_0xda6053,_0x46ee69){var _0x26456b=function(_0x53a1b6){while(--_0x53a1b6){_0xda6053['push'](_0xda6053['shift']());}};_0x26456b(++_0x46ee69);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x587f3a,_0x160bad){_0x587f3a=_0x587f3a-0x0;var _0x4fead2=_0x0a6b[_0x587f3a];return _0x4fead2;};'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/messages',auth['isAuthenticated'](),controller[_0xb0a6('0xa')]);router[_0xb0a6('0xb')]('/',auth[_0xb0a6('0x6')](),controller[_0xb0a6('0xc')]);router['put'](_0xb0a6('0x8'),auth[_0xb0a6('0x6')](),controller['update']);router[_0xb0a6('0xd')](_0xb0a6('0x8'),auth[_0xb0a6('0x6')](),controller[_0xb0a6('0xe')]);module[_0xb0a6('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 1358297..4f67b48 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 _0xb5c5=['STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','yes','ENUM','TINYINT(4)','INTEGER','VIRTUAL','getDataValue','\x20-\x20','sequelize','exports'];(function(_0x39dc31,_0x1224b9){var _0x8da6fe=function(_0xc94e8e){while(--_0xc94e8e){_0x39dc31['push'](_0x39dc31['shift']());}};_0x8da6fe(++_0x1224b9);}(_0xb5c5,0xa8));var _0x5b5c=function(_0x52a193,_0x27ee04){_0x52a193=_0x52a193-0x0;var _0x54ecdf=_0xb5c5[_0x52a193];return _0x54ecdf;};'use strict';var Sequelize=require(_0x5b5c('0x0'));module[_0x5b5c('0x1')]={'customer_id':{'type':Sequelize[_0x5b5c('0x2')]},'context':{'type':Sequelize[_0x5b5c('0x2')],'defaultValue':_0x5b5c('0x3'),'unique':_0x5b5c('0x4')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0x5b5c('0x4')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x5b5c('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x9fee){this[_0x5b5c('0x5')](_0x5b5c('0x6'),typeof _0x9fee===_0x5b5c('0x7')&&_0x9fee[_0x5b5c('0x8')]()?_0x9fee[_0x5b5c('0x8')]():null);}},'pager':{'type':Sequelize[_0x5b5c('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x5b5c('0x9')},'attach':{'type':Sequelize['ENUM'](_0x5b5c('0xa'),'no'),'defaultValue':_0x5b5c('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0x5b5c('0xb')](_0x5b5c('0xa'),'no'),'defaultValue':_0x5b5c('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0x5b5c('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x5b5c('0xb')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x5b5c('0xb')](_0x5b5c('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x5b5c('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x5b5c('0xb')](_0x5b5c('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x5b5c('0xc'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x5b5c('0xb')](_0x5b5c('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x5b5c('0xb')](_0x5b5c('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x5b5c('0xb')](_0x5b5c('0xa'),'no'),'defaultValue':_0x5b5c('0xa'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x5b5c('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x5b5c('0xb')](_0x5b5c('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x5b5c('0xb')](_0x5b5c('0xa'),'no'),'defaultValue':_0x5b5c('0xa'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x5b5c('0x2')]},'emailbody':{'type':Sequelize[_0x5b5c('0x2')]},'maxsecs':{'type':Sequelize[_0x5b5c('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x5b5c('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x5b5c('0xe')],'get':function(){return this[_0x5b5c('0xf')]('fullname')+_0x5b5c('0x10')+this[_0x5b5c('0xf')]('mailbox');}}}; \ No newline at end of file +var _0xf47f=['from-voicemail','contest_mailbox','email','string','trim','ENUM','yes','TINYINT(4)','INTEGER','getDataValue','fullname','\x20-\x20','mailbox','STRING'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0xf47f,0xfb));var _0xff47=function(_0x2fe6d7,_0x188b49){_0x2fe6d7=_0x2fe6d7-0x0;var _0x16ca01=_0xf47f[_0x2fe6d7];return _0x16ca01;};'use strict';var Sequelize=require('sequelize');module['exports']={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xff47('0x0')],'defaultValue':_0xff47('0x1'),'unique':_0xff47('0x2')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0xff47('0x2')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0xff47('0x0')]},'email':{'type':Sequelize[_0xff47('0x0')],'validate':{'isEmail':!![]},'set':function(_0x21ede5){this['setDataValue'](_0xff47('0x3'),typeof _0x21ede5===_0xff47('0x4')&&_0x21ede5[_0xff47('0x5')]()?_0x21ede5[_0xff47('0x5')]():null);}},'pager':{'type':Sequelize[_0xff47('0x0')]},'tz':{'type':Sequelize[_0xff47('0x0')],'defaultValue':'central'},'attach':{'type':Sequelize[_0xff47('0x6')](_0xff47('0x7'),'no'),'defaultValue':_0xff47('0x7'),'allowNull':![]},'saycid':{'type':Sequelize[_0xff47('0x6')]('yes','no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0xff47('0x0')]},'callback':{'type':Sequelize[_0xff47('0x0')]},'review':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xff47('0x6')](_0xff47('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xff47('0x6')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xff47('0x8'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xff47('0x6')](_0xff47('0x7'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xff47('0x6')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0xff47('0x7'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0xff47('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xff47('0x6')](_0xff47('0x7'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xff47('0x6')](_0xff47('0x7'),'no'),'defaultValue':_0xff47('0x7'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0xff47('0x0')]},'emailbody':{'type':Sequelize[_0xff47('0x0')]},'maxsecs':{'type':Sequelize[_0xff47('0x9')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xff47('0xa')](_0xff47('0xb'))+_0xff47('0xc')+this[_0xff47('0xa')](_0xff47('0xd'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index b1aa0b5..8a9f5bd 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 _0x96cc=['find','userProfileId','UserProfileResource','getMessages','findOne','mailbox','VoiceMailMessage','findAndCountAll','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','Voicemails','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceMail','includeAll','include','rows','catch','params','keys','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection'];(function(_0x7791d5,_0xdab65f){var _0x5ce288=function(_0x2b818d){while(--_0x2b818d){_0x7791d5['push'](_0x7791d5['shift']());}};_0x5ce288(++_0xdab65f);}(_0x96cc,0x16c));var _0xc96c=function(_0x77e7e8,_0x5a319f){_0x77e7e8=_0x77e7e8-0x0;var _0x205a3e=_0x96cc[_0x77e7e8];return _0x205a3e;};'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(){var _0x40f23d=_0x10ae21[_0xc96c('0x29')]({'plain':!![]});var _0x1a77df=_0xc96c('0x2a');return db['UserProfileResource'][_0xc96c('0x27')]({'where':{'type':_0x1a77df,'resourceId':_0x40f23d['id']}})[_0xc96c('0x28')](function(){return _0x10ae21;});})[_0xc96c('0x28')](function(){_0x4be783[_0xc96c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c00b6,_0x39c191){return function(_0x12c293){if(!_0x12c293){_0x5c00b6[_0xc96c('0x19')](0x194);}return _0x12c293;};}function handleError(_0x1ef845,_0x3c0eb1){_0x3c0eb1=_0x3c0eb1||0x1f4;return function(_0x5e1727){logger[_0xc96c('0x2b')](_0x5e1727[_0xc96c('0x2c')]);if(_0x5e1727[_0xc96c('0x2d')]){delete _0x5e1727[_0xc96c('0x2d')];}_0x1ef845[_0xc96c('0x1a')](_0x3c0eb1)[_0xc96c('0x2e')](_0x5e1727);};}exports[_0xc96c('0x2f')]=function(_0x328ee4,_0x556108){var _0x3aa436={},_0x53c994={},_0x3f4b0e={'count':0x0,'rows':[]};var _0x442c7f=_[_0xc96c('0x30')](db['VoiceMail'][_0xc96c('0x31')],function(_0x3240ba){return{'name':_0x3240ba[_0xc96c('0x32')],'type':_0x3240ba[_0xc96c('0x33')]['key']};});_0x53c994['model']=_[_0xc96c('0x30')](_0x442c7f,_0xc96c('0x2d'));_0x53c994[_0xc96c('0x34')]=_['keys'](_0x328ee4[_0xc96c('0x34')]);_0x53c994[_0xc96c('0x35')]=_[_0xc96c('0x36')](_0x53c994[_0xc96c('0x37')],_0x53c994['query']);_0x3aa436[_0xc96c('0x38')]=_[_0xc96c('0x36')](_0x53c994['model'],qs[_0xc96c('0x39')](_0x328ee4[_0xc96c('0x34')][_0xc96c('0x39')]));_0x3aa436[_0xc96c('0x38')]=_0x3aa436[_0xc96c('0x38')][_0xc96c('0x3a')]?_0x3aa436['attributes']:_0x53c994[_0xc96c('0x37')];if(!_0x328ee4[_0xc96c('0x34')][_0xc96c('0x3b')](_0xc96c('0x3c'))){_0x3aa436[_0xc96c('0x1f')]=qs[_0xc96c('0x1f')](_0x328ee4['query']['limit']);_0x3aa436[_0xc96c('0x1d')]=qs[_0xc96c('0x1d')](_0x328ee4['query']['offset']);}_0x3aa436[_0xc96c('0x3d')]=qs[_0xc96c('0x3e')](_0x328ee4[_0xc96c('0x34')][_0xc96c('0x3e')]);_0x3aa436[_0xc96c('0x3f')]=qs[_0xc96c('0x35')](_[_0xc96c('0x40')](_0x328ee4[_0xc96c('0x34')],_0x53c994[_0xc96c('0x35')]),_0x442c7f);if(_0x328ee4[_0xc96c('0x34')][_0xc96c('0x41')]){_0x3aa436['where']=_[_0xc96c('0x42')](_0x3aa436[_0xc96c('0x3f')],{'$or':_[_0xc96c('0x30')](_0x442c7f,function(_0x16b1f1){if(_0x16b1f1['type']!==_0xc96c('0x43')){var _0x3a0848={};_0x3a0848[_0x16b1f1[_0xc96c('0x2d')]]={'$like':'%'+_0x328ee4['query']['filter']+'%'};return _0x3a0848;}})});}_0x3aa436=_[_0xc96c('0x42')]({},_0x3aa436,_0x328ee4[_0xc96c('0x44')]);var _0x2e3bc3={'where':_0x3aa436['where']};return db[_0xc96c('0x45')][_0xc96c('0x20')](_0x2e3bc3)[_0xc96c('0x28')](function(_0x2a8ea7){_0x3f4b0e[_0xc96c('0x20')]=_0x2a8ea7;if(_0x328ee4[_0xc96c('0x34')][_0xc96c('0x46')]){_0x3aa436[_0xc96c('0x47')]=[{'all':!![]}];}return db[_0xc96c('0x45')]['findAll'](_0x3aa436);})['then'](function(_0x30b3ac){_0x3f4b0e[_0xc96c('0x48')]=_0x30b3ac;return _0x3f4b0e;})[_0xc96c('0x28')](respondWithFilteredResult(_0x556108,_0x3aa436))[_0xc96c('0x49')](handleError(_0x556108,null));};exports['show']=function(_0x5ee6ac,_0x14b712){var _0x1c18c1={'raw':!![],'where':{'id':_0x5ee6ac[_0xc96c('0x4a')]['id']}},_0x44eb20={};_0x44eb20[_0xc96c('0x37')]=_[_0xc96c('0x4b')](db[_0xc96c('0x45')]['rawAttributes']);_0x44eb20[_0xc96c('0x34')]=_[_0xc96c('0x4b')](_0x5ee6ac[_0xc96c('0x34')]);_0x44eb20[_0xc96c('0x35')]=_['intersection'](_0x44eb20['model'],_0x44eb20[_0xc96c('0x34')]);_0x1c18c1[_0xc96c('0x38')]=_[_0xc96c('0x36')](_0x44eb20[_0xc96c('0x37')],qs[_0xc96c('0x39')](_0x5ee6ac[_0xc96c('0x34')][_0xc96c('0x39')]));_0x1c18c1[_0xc96c('0x38')]=_0x1c18c1[_0xc96c('0x38')][_0xc96c('0x3a')]?_0x1c18c1[_0xc96c('0x38')]:_0x44eb20[_0xc96c('0x37')];if(_0x5ee6ac[_0xc96c('0x34')]['includeAll']){_0x1c18c1[_0xc96c('0x47')]=[{'all':!![]}];}_0x1c18c1=_[_0xc96c('0x42')]({},_0x1c18c1,_0x5ee6ac[_0xc96c('0x44')]);return db[_0xc96c('0x45')]['find'](_0x1c18c1)[_0xc96c('0x28')](handleEntityNotFound(_0x14b712,null))['then'](respondWithResult(_0x14b712,null))[_0xc96c('0x49')](handleError(_0x14b712,null));};exports[_0xc96c('0x4c')]=function(_0x565812,_0x2581ae){return db[_0xc96c('0x45')][_0xc96c('0x4c')](_0x565812[_0xc96c('0x4d')],{})[_0xc96c('0x28')](function(_0x1bd694){var _0x57e699=_0x565812['user']['get']({'plain':!![]});if(!_0x57e699)throw new Error(_0xc96c('0x4e'));if(_0x57e699['role']===_0xc96c('0x4f')){var _0x22b2e3=_0x1bd694[_0xc96c('0x29')]({'plain':!![]});var _0x17c764=_0xc96c('0x2a');return db[_0xc96c('0x50')][_0xc96c('0x51')]({'where':{'name':_0x17c764,'userProfileId':_0x57e699[_0xc96c('0x52')]},'raw':!![]})[_0xc96c('0x28')](function(_0xd78e10){if(_0xd78e10&&_0xd78e10['autoAssociation']===0x0){return db[_0xc96c('0x53')][_0xc96c('0x4c')]({'name':_0x22b2e3[_0xc96c('0x2d')],'resourceId':_0x22b2e3['id'],'type':_0xd78e10[_0xc96c('0x2d')],'sectionId':_0xd78e10['id']},{})[_0xc96c('0x28')](function(){return _0x1bd694;});}else{return _0x1bd694;}})[_0xc96c('0x49')](function(_0xad88c3){logger[_0xc96c('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xad88c3);throw _0xad88c3;});}return _0x1bd694;})['then'](respondWithResult(_0x2581ae,0xc9))['catch'](handleError(_0x2581ae,null));};exports['update']=function(_0x356ef3,_0x46c6fb){if(_0x356ef3[_0xc96c('0x4d')]['id']){delete _0x356ef3[_0xc96c('0x4d')]['id'];}return db[_0xc96c('0x45')][_0xc96c('0x51')]({'where':{'id':_0x356ef3[_0xc96c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x46c6fb,null))[_0xc96c('0x28')](saveUpdates(_0x356ef3[_0xc96c('0x4d')],null))[_0xc96c('0x28')](respondWithResult(_0x46c6fb,null))[_0xc96c('0x49')](handleError(_0x46c6fb,null));};exports[_0xc96c('0x27')]=function(_0x1dbea5,_0x3aa216){return db['VoiceMail'][_0xc96c('0x51')]({'where':{'id':_0x1dbea5[_0xc96c('0x4a')]['id']}})[_0xc96c('0x28')](handleEntityNotFound(_0x3aa216,null))[_0xc96c('0x28')](removeEntity(_0x3aa216,null))[_0xc96c('0x49')](handleError(_0x3aa216,null));};exports[_0xc96c('0x54')]=function(_0x258f79,_0x34bb98,_0x10b1b8){return db[_0xc96c('0x45')][_0xc96c('0x55')]({'where':{'id':_0x258f79[_0xc96c('0x4a')]['id']}})[_0xc96c('0x28')](handleEntityNotFound(_0x34bb98,null))[_0xc96c('0x28')](function(_0x5a6e3e){var _0xb1629c;var _0x183211={},_0x3d879a={};_0x3d879a[_0xc96c('0x37')]=_[_0xc96c('0x4b')](db['VoiceMailMessage'][_0xc96c('0x31')]);_0x3d879a[_0xc96c('0x34')]=_[_0xc96c('0x4b')](_0x258f79[_0xc96c('0x34')]);_0x3d879a['filters']=_[_0xc96c('0x36')](_0x3d879a[_0xc96c('0x37')],_0x3d879a['query']);_0x183211['attributes']=_['intersection'](_0x3d879a[_0xc96c('0x37')],qs[_0xc96c('0x39')](_0x258f79[_0xc96c('0x34')][_0xc96c('0x39')]));_0x183211[_0xc96c('0x38')]=_0x183211['attributes']['length']?_0x183211[_0xc96c('0x38')]:_0x3d879a[_0xc96c('0x37')];if(!_0x258f79[_0xc96c('0x34')][_0xc96c('0x3b')](_0xc96c('0x3c'))){_0x183211['limit']=qs[_0xc96c('0x1f')](_0x258f79[_0xc96c('0x34')][_0xc96c('0x1f')]);_0x183211[_0xc96c('0x1d')]=qs['offset'](_0x258f79['query'][_0xc96c('0x1d')]);}_0x183211[_0xc96c('0x3d')]=qs['sort'](_0x258f79[_0xc96c('0x34')]['sort']);_0x183211[_0xc96c('0x3f')]=qs[_0xc96c('0x35')](_[_0xc96c('0x40')](_0x258f79[_0xc96c('0x34')],_0x3d879a[_0xc96c('0x35')]));if(_0x258f79[_0xc96c('0x34')][_0xc96c('0x41')]){_0x183211[_0xc96c('0x3f')]=_[_0xc96c('0x42')](_0x183211[_0xc96c('0x3f')],{'$or':_['map'](_0x183211[_0xc96c('0x38')],function(_0x5e94fa){var _0xe34ef={};_0xe34ef[_0x5e94fa]={'$like':'%'+_0x258f79[_0xc96c('0x34')]['filter']+'%'};return _0xe34ef;})});}_0x183211[_0xc96c('0x3f')]=_['merge'](_0x183211[_0xc96c('0x3f')],{'mailboxuser':_0x5a6e3e[_0xc96c('0x56')]});_0x183211=_[_0xc96c('0x42')]({},_0x183211,_0x258f79[_0xc96c('0x44')]);return db[_0xc96c('0x57')][_0xc96c('0x58')](_0x183211)[_0xc96c('0x28')](respondWithFilteredResult(_0x34bb98,_0x183211));})[_0xc96c('0x49')](handleError(_0x34bb98,null));}; \ No newline at end of file +var _0xea28=['undefined','limit','count','reject','update','then','get','Voicemails','sendStatus','stack','name','send','index','map','VoiceMail','fieldName','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','show','intersection','include','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','UserProfileResource','body','params','destroy','getMessages','VoiceMailMessage','rawAttributes','order','mailbox','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset'];(function(_0x1a4e55,_0x58880d){var _0x312c10=function(_0x1536da){while(--_0x1536da){_0x1a4e55['push'](_0x1a4e55['shift']());}};_0x312c10(++_0x58880d);}(_0xea28,0x13a));var _0x8ea2=function(_0x17df33,_0x2a6999){_0x17df33=_0x17df33-0x0;var _0x4e06b9=_0xea28[_0x17df33];return _0x4e06b9;};'use strict';var emlformat=require(_0x8ea2('0x0'));var rimraf=require(_0x8ea2('0x1'));var zipdir=require(_0x8ea2('0x2'));var jsonpatch=require(_0x8ea2('0x3'));var rp=require(_0x8ea2('0x4'));var moment=require(_0x8ea2('0x5'));var BPromise=require(_0x8ea2('0x6'));var Mustache=require(_0x8ea2('0x7'));var util=require('util');var path=require(_0x8ea2('0x8'));var sox=require(_0x8ea2('0x9'));var csv=require(_0x8ea2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8ea2('0xb'));var _=require(_0x8ea2('0xc'));var squel=require(_0x8ea2('0xd'));var crypto=require(_0x8ea2('0xe'));var jsforce=require(_0x8ea2('0xf'));var deskjs=require(_0x8ea2('0x10'));var toCsv=require(_0x8ea2('0xa'));var querystring=require(_0x8ea2('0x11'));var Papa=require(_0x8ea2('0x12'));var Redis=require(_0x8ea2('0x13'));var authService=require(_0x8ea2('0x14'));var qs=require(_0x8ea2('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ea2('0x16'))(_0x8ea2('0x17'));var utils=require(_0x8ea2('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8ea2('0x19'));var db=require(_0x8ea2('0x1a'))['db'];function respondWithStatusCode(_0x1dfb6e,_0x10aead){_0x10aead=_0x10aead||0xcc;return function(_0xe47c0e){if(_0xe47c0e){return _0x1dfb6e['sendStatus'](_0x10aead);}return _0x1dfb6e[_0x8ea2('0x1b')](_0x10aead)['end']();};}function respondWithResult(_0x4b2192,_0x772bad){_0x772bad=_0x772bad||0xc8;return function(_0x4726a7){if(_0x4726a7){return _0x4b2192[_0x8ea2('0x1b')](_0x772bad)[_0x8ea2('0x1c')](_0x4726a7);}};}function respondWithFilteredResult(_0x393faf,_0xbb9bd1){return function(_0x3cff96){if(_0x3cff96){var _0x11f5e8=typeof _0xbb9bd1[_0x8ea2('0x1d')]===_0x8ea2('0x1e')&&typeof _0xbb9bd1[_0x8ea2('0x1f')]===_0x8ea2('0x1e');var _0x3bc774=_0x3cff96[_0x8ea2('0x20')];var _0x1b64cf=_0x11f5e8?0x0:_0xbb9bd1[_0x8ea2('0x1d')];var _0x467045=_0x11f5e8?_0x3cff96[_0x8ea2('0x20')]:_0xbb9bd1[_0x8ea2('0x1d')]+_0xbb9bd1[_0x8ea2('0x1f')];var _0x134cbe;if(_0x467045>=_0x3bc774){_0x467045=_0x3bc774;_0x134cbe=0xc8;}else{_0x134cbe=0xce;}_0x393faf[_0x8ea2('0x1b')](_0x134cbe);return _0x393faf['set']('Content-Range',_0x1b64cf+'-'+_0x467045+'/'+_0x3bc774)[_0x8ea2('0x1c')](_0x3cff96);}return null;};}function patchUpdates(_0x248c18){return function(_0x29151a){try{jsonpatch['apply'](_0x29151a,_0x248c18,!![]);}catch(_0x46f4fe){return BPromise[_0x8ea2('0x21')](_0x46f4fe);}return _0x29151a['save']();};}function saveUpdates(_0x3d593b,_0x283f00){return function(_0x37229a){if(_0x37229a){return _0x37229a[_0x8ea2('0x22')](_0x3d593b)[_0x8ea2('0x23')](function(_0xe5c943){return _0xe5c943;});}return null;};}function removeEntity(_0x199417,_0x1e4cc9){return function(_0x18ec34){if(_0x18ec34){return _0x18ec34['destroy']()[_0x8ea2('0x23')](function(){var _0x4f48bd=_0x18ec34[_0x8ea2('0x24')]({'plain':!![]});var _0x42bec8=_0x8ea2('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x42bec8,'resourceId':_0x4f48bd['id']}})[_0x8ea2('0x23')](function(){return _0x18ec34;});})['then'](function(){_0x199417[_0x8ea2('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3be291,_0x12fa37){return function(_0x21c526){if(!_0x21c526){_0x3be291[_0x8ea2('0x26')](0x194);}return _0x21c526;};}function handleError(_0x4e1b90,_0x5ce1d4){_0x5ce1d4=_0x5ce1d4||0x1f4;return function(_0xacaa6c){logger['error'](_0xacaa6c[_0x8ea2('0x27')]);if(_0xacaa6c[_0x8ea2('0x28')]){delete _0xacaa6c[_0x8ea2('0x28')];}_0x4e1b90[_0x8ea2('0x1b')](_0x5ce1d4)[_0x8ea2('0x29')](_0xacaa6c);};}exports[_0x8ea2('0x2a')]=function(_0x32e225,_0x316707){var _0x19e868={},_0x9c5fac={},_0x56d914={'count':0x0,'rows':[]};var _0x5b7ff9=_[_0x8ea2('0x2b')](db[_0x8ea2('0x2c')]['rawAttributes'],function(_0x4a110f){return{'name':_0x4a110f[_0x8ea2('0x2d')],'type':_0x4a110f['type'][_0x8ea2('0x2e')]};});_0x9c5fac[_0x8ea2('0x2f')]=_['map'](_0x5b7ff9,_0x8ea2('0x28'));_0x9c5fac[_0x8ea2('0x30')]=_[_0x8ea2('0x31')](_0x32e225['query']);_0x9c5fac['filters']=_['intersection'](_0x9c5fac[_0x8ea2('0x2f')],_0x9c5fac[_0x8ea2('0x30')]);_0x19e868[_0x8ea2('0x32')]=_['intersection'](_0x9c5fac[_0x8ea2('0x2f')],qs[_0x8ea2('0x33')](_0x32e225[_0x8ea2('0x30')][_0x8ea2('0x33')]));_0x19e868[_0x8ea2('0x32')]=_0x19e868[_0x8ea2('0x32')][_0x8ea2('0x34')]?_0x19e868[_0x8ea2('0x32')]:_0x9c5fac['model'];if(!_0x32e225[_0x8ea2('0x30')][_0x8ea2('0x35')](_0x8ea2('0x36'))){_0x19e868[_0x8ea2('0x1f')]=qs['limit'](_0x32e225[_0x8ea2('0x30')]['limit']);_0x19e868[_0x8ea2('0x1d')]=qs[_0x8ea2('0x1d')](_0x32e225[_0x8ea2('0x30')][_0x8ea2('0x1d')]);}_0x19e868['order']=qs[_0x8ea2('0x37')](_0x32e225['query']['sort']);_0x19e868[_0x8ea2('0x38')]=qs['filters'](_[_0x8ea2('0x39')](_0x32e225[_0x8ea2('0x30')],_0x9c5fac[_0x8ea2('0x3a')]),_0x5b7ff9);if(_0x32e225[_0x8ea2('0x30')][_0x8ea2('0x3b')]){_0x19e868['where']=_[_0x8ea2('0x3c')](_0x19e868['where'],{'$or':_[_0x8ea2('0x2b')](_0x5b7ff9,function(_0x282f00){if(_0x282f00[_0x8ea2('0x3d')]!==_0x8ea2('0x3e')){var _0x4f9a8c={};_0x4f9a8c[_0x282f00[_0x8ea2('0x28')]]={'$like':'%'+_0x32e225['query'][_0x8ea2('0x3b')]+'%'};return _0x4f9a8c;}})});}_0x19e868=_['merge']({},_0x19e868,_0x32e225[_0x8ea2('0x3f')]);var _0x450e8f={'where':_0x19e868[_0x8ea2('0x38')]};return db[_0x8ea2('0x2c')][_0x8ea2('0x20')](_0x450e8f)[_0x8ea2('0x23')](function(_0x2f4fa8){_0x56d914['count']=_0x2f4fa8;if(_0x32e225['query'][_0x8ea2('0x40')]){_0x19e868['include']=[{'all':!![]}];}return db['VoiceMail']['findAll'](_0x19e868);})[_0x8ea2('0x23')](function(_0x5d9ba0){_0x56d914[_0x8ea2('0x41')]=_0x5d9ba0;return _0x56d914;})[_0x8ea2('0x23')](respondWithFilteredResult(_0x316707,_0x19e868))[_0x8ea2('0x42')](handleError(_0x316707,null));};exports[_0x8ea2('0x43')]=function(_0x989d9b,_0x8f700f){var _0x3b2219={'raw':!![],'where':{'id':_0x989d9b['params']['id']}},_0x348b17={};_0x348b17[_0x8ea2('0x2f')]=_[_0x8ea2('0x31')](db[_0x8ea2('0x2c')]['rawAttributes']);_0x348b17[_0x8ea2('0x30')]=_[_0x8ea2('0x31')](_0x989d9b[_0x8ea2('0x30')]);_0x348b17[_0x8ea2('0x3a')]=_[_0x8ea2('0x44')](_0x348b17['model'],_0x348b17[_0x8ea2('0x30')]);_0x3b2219[_0x8ea2('0x32')]=_[_0x8ea2('0x44')](_0x348b17['model'],qs[_0x8ea2('0x33')](_0x989d9b[_0x8ea2('0x30')][_0x8ea2('0x33')]));_0x3b2219[_0x8ea2('0x32')]=_0x3b2219[_0x8ea2('0x32')][_0x8ea2('0x34')]?_0x3b2219[_0x8ea2('0x32')]:_0x348b17[_0x8ea2('0x2f')];if(_0x989d9b[_0x8ea2('0x30')][_0x8ea2('0x40')]){_0x3b2219[_0x8ea2('0x45')]=[{'all':!![]}];}_0x3b2219=_[_0x8ea2('0x3c')]({},_0x3b2219,_0x989d9b[_0x8ea2('0x3f')]);return db[_0x8ea2('0x2c')]['find'](_0x3b2219)[_0x8ea2('0x23')](handleEntityNotFound(_0x8f700f,null))[_0x8ea2('0x23')](respondWithResult(_0x8f700f,null))[_0x8ea2('0x42')](handleError(_0x8f700f,null));};exports[_0x8ea2('0x46')]=function(_0x182a46,_0x1daa25){return db[_0x8ea2('0x2c')][_0x8ea2('0x46')](_0x182a46['body'],{})[_0x8ea2('0x23')](function(_0x37a1cf){var _0x24dddb=_0x182a46['user']['get']({'plain':!![]});if(!_0x24dddb)throw new Error(_0x8ea2('0x47'));if(_0x24dddb[_0x8ea2('0x48')]===_0x8ea2('0x49')){var _0x5e5c37=_0x37a1cf[_0x8ea2('0x24')]({'plain':!![]});var _0x315b5d=_0x8ea2('0x25');return db[_0x8ea2('0x4a')][_0x8ea2('0x4b')]({'where':{'name':_0x315b5d,'userProfileId':_0x24dddb['userProfileId']},'raw':!![]})['then'](function(_0x24a22a){if(_0x24a22a&&_0x24a22a[_0x8ea2('0x4c')]===0x0){return db[_0x8ea2('0x4d')]['create']({'name':_0x5e5c37[_0x8ea2('0x28')],'resourceId':_0x5e5c37['id'],'type':_0x24a22a[_0x8ea2('0x28')],'sectionId':_0x24a22a['id']},{})[_0x8ea2('0x23')](function(){return _0x37a1cf;});}else{return _0x37a1cf;}})['catch'](function(_0x5c6524){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c6524);throw _0x5c6524;});}return _0x37a1cf;})['then'](respondWithResult(_0x1daa25,0xc9))[_0x8ea2('0x42')](handleError(_0x1daa25,null));};exports[_0x8ea2('0x22')]=function(_0x5f56f8,_0x49cf11){if(_0x5f56f8[_0x8ea2('0x4e')]['id']){delete _0x5f56f8[_0x8ea2('0x4e')]['id'];}return db[_0x8ea2('0x2c')]['find']({'where':{'id':_0x5f56f8[_0x8ea2('0x4f')]['id']}})[_0x8ea2('0x23')](handleEntityNotFound(_0x49cf11,null))['then'](saveUpdates(_0x5f56f8[_0x8ea2('0x4e')],null))[_0x8ea2('0x23')](respondWithResult(_0x49cf11,null))[_0x8ea2('0x42')](handleError(_0x49cf11,null));};exports[_0x8ea2('0x50')]=function(_0x4728b4,_0x58674d){return db['VoiceMail']['find']({'where':{'id':_0x4728b4[_0x8ea2('0x4f')]['id']}})[_0x8ea2('0x23')](handleEntityNotFound(_0x58674d,null))[_0x8ea2('0x23')](removeEntity(_0x58674d,null))[_0x8ea2('0x42')](handleError(_0x58674d,null));};exports[_0x8ea2('0x51')]=function(_0x3836c3,_0x36fda3,_0x5265e7){return db['VoiceMail']['findOne']({'where':{'id':_0x3836c3[_0x8ea2('0x4f')]['id']}})[_0x8ea2('0x23')](handleEntityNotFound(_0x36fda3,null))[_0x8ea2('0x23')](function(_0x2bbec0){var _0x57720d;var _0x11824e={},_0x2b8662={};_0x2b8662['model']=_[_0x8ea2('0x31')](db[_0x8ea2('0x52')][_0x8ea2('0x53')]);_0x2b8662[_0x8ea2('0x30')]=_[_0x8ea2('0x31')](_0x3836c3['query']);_0x2b8662['filters']=_['intersection'](_0x2b8662[_0x8ea2('0x2f')],_0x2b8662[_0x8ea2('0x30')]);_0x11824e[_0x8ea2('0x32')]=_[_0x8ea2('0x44')](_0x2b8662[_0x8ea2('0x2f')],qs['fields'](_0x3836c3[_0x8ea2('0x30')][_0x8ea2('0x33')]));_0x11824e[_0x8ea2('0x32')]=_0x11824e[_0x8ea2('0x32')]['length']?_0x11824e[_0x8ea2('0x32')]:_0x2b8662['model'];if(!_0x3836c3[_0x8ea2('0x30')]['hasOwnProperty'](_0x8ea2('0x36'))){_0x11824e[_0x8ea2('0x1f')]=qs['limit'](_0x3836c3['query'][_0x8ea2('0x1f')]);_0x11824e['offset']=qs[_0x8ea2('0x1d')](_0x3836c3[_0x8ea2('0x30')][_0x8ea2('0x1d')]);}_0x11824e[_0x8ea2('0x54')]=qs['sort'](_0x3836c3[_0x8ea2('0x30')][_0x8ea2('0x37')]);_0x11824e[_0x8ea2('0x38')]=qs[_0x8ea2('0x3a')](_[_0x8ea2('0x39')](_0x3836c3[_0x8ea2('0x30')],_0x2b8662[_0x8ea2('0x3a')]));if(_0x3836c3[_0x8ea2('0x30')][_0x8ea2('0x3b')]){_0x11824e[_0x8ea2('0x38')]=_[_0x8ea2('0x3c')](_0x11824e[_0x8ea2('0x38')],{'$or':_['map'](_0x11824e[_0x8ea2('0x32')],function(_0x2d130a){var _0x4de6ba={};_0x4de6ba[_0x2d130a]={'$like':'%'+_0x3836c3[_0x8ea2('0x30')][_0x8ea2('0x3b')]+'%'};return _0x4de6ba;})});}_0x11824e[_0x8ea2('0x38')]=_[_0x8ea2('0x3c')](_0x11824e[_0x8ea2('0x38')],{'mailboxuser':_0x2bbec0[_0x8ea2('0x55')]});_0x11824e=_[_0x8ea2('0x3c')]({},_0x11824e,_0x3836c3[_0x8ea2('0x3f')]);return db[_0x8ea2('0x52')]['findAndCountAll'](_0x11824e)[_0x8ea2('0x23')](respondWithFilteredResult(_0x36fda3,_0x11824e));})[_0x8ea2('0x42')](handleError(_0x36fda3,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 3844101..a8da0d2 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 _0x3a34=['bluebird','path','../../config/environment','./voiceMail.attributes','exports','VoiceMail','voice_voicemail','mailbox','lodash','util','../../config/logger','api','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3a34,0x70));var _0x43a3=function(_0x30526f,_0x55a4ec){_0x30526f=_0x30526f-0x0;var _0x4b7be7=_0x3a34[_0x30526f];return _0x4b7be7;};'use strict';var _=require(_0x43a3('0x0'));var util=require(_0x43a3('0x1'));var logger=require(_0x43a3('0x2'))(_0x43a3('0x3'));var moment=require(_0x43a3('0x4'));var BPromise=require(_0x43a3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x43a3('0x6'));var rimraf=require('rimraf');var config=require(_0x43a3('0x7'));var attributes=require(_0x43a3('0x8'));module[_0x43a3('0x9')]=function(_0xa8b291,_0x5e0025){return _0xa8b291['define'](_0x43a3('0xa'),attributes,{'tableName':_0x43a3('0xb'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x43a3('0xc'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb29f=['context','api','bluebird','request-promise','path','rimraf','./voiceMail.attributes','VoiceMail','voice_voicemail','mailbox_context','mailbox'];(function(_0x380d38,_0xd88f3f){var _0x2e29fe=function(_0x554595){while(--_0x554595){_0x380d38['push'](_0x380d38['shift']());}};_0x2e29fe(++_0xd88f3f);}(_0xb29f,0x1ae));var _0xfb29=function(_0x4a6528,_0x1897e9){_0x4a6528=_0x4a6528-0x0;var _0x133ef3=_0xb29f[_0x4a6528];return _0x133ef3;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xfb29('0x0'));var moment=require('moment');var BPromise=require(_0xfb29('0x1'));var rp=require(_0xfb29('0x2'));var fs=require('fs');var path=require(_0xfb29('0x3'));var rimraf=require(_0xfb29('0x4'));var config=require('../../config/environment');var attributes=require(_0xfb29('0x5'));module['exports']=function(_0x3a5a52,_0x2e31fe){return _0x3a5a52['define'](_0xfb29('0x6'),attributes,{'tableName':_0xfb29('0x7'),'paranoid':![],'indexes':[{'name':_0xfb29('0x8'),'fields':[_0xfb29('0x9'),_0xfb29('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 4fae4e7..0ef6739 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 _0x5f31=['../../config/utils','../../config/logger','../../config/environment','client','then','info','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceMail,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5c9f56,_0x42c9ad){var _0x2a726b=function(_0x4a13cd){while(--_0x4a13cd){_0x5c9f56['push'](_0x5c9f56['shift']());}};_0x2a726b(++_0x42c9ad);}(_0x5f31,0x1dc));var _0x15f3=function(_0x401ccd,_0x140815){_0x401ccd=_0x401ccd-0x0;var _0x5a57ad=_0x5f31[_0x401ccd];return _0x5a57ad;};'use strict';var _=require(_0x15f3('0x0'));var util=require(_0x15f3('0x1'));var moment=require(_0x15f3('0x2'));var BPromise=require(_0x15f3('0x3'));var rs=require(_0x15f3('0x4'));var fs=require('fs');var Redis=require(_0x15f3('0x5'));var db=require(_0x15f3('0x6'))['db'];var utils=require(_0x15f3('0x7'));var logger=require(_0x15f3('0x8'))('rpc');var config=require(_0x15f3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x15f3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x49555c,_0x19476f,_0x2f092b){return new BPromise(function(_0x813f90,_0x431eb9){return client['request'](_0x49555c,_0x2f092b)[_0x15f3('0xb')](function(_0x31cea0){logger[_0x15f3('0xc')]('VoiceMail,\x20%s,\x20%s',_0x19476f,_0x15f3('0xd'));logger[_0x15f3('0xe')](_0x15f3('0xf'),_0x19476f,_0x15f3('0xd'),JSON[_0x15f3('0x10')](_0x31cea0));if(_0x31cea0['error']){if(_0x31cea0[_0x15f3('0x11')][_0x15f3('0x12')]===0x1f4){logger[_0x15f3('0x11')](_0x15f3('0x13'),_0x19476f,_0x31cea0[_0x15f3('0x11')]['message']);return _0x431eb9(_0x31cea0[_0x15f3('0x11')][_0x15f3('0x14')]);}logger[_0x15f3('0x11')](_0x15f3('0x13'),_0x19476f,_0x31cea0['error']['message']);return _0x813f90(_0x31cea0[_0x15f3('0x11')]['message']);}else{logger[_0x15f3('0xc')](_0x15f3('0x13'),_0x19476f,'request\x20sent');_0x813f90(_0x31cea0['result'][_0x15f3('0x14')]);}})['catch'](function(_0xf0d0c8){logger['error'](_0x15f3('0x13'),_0x19476f,_0xf0d0c8);_0x431eb9(_0xf0d0c8);});});} \ No newline at end of file +var _0xae39=['../../config/environment','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x555972,_0x335307){var _0x339cf9=function(_0xfb8fa1){while(--_0xfb8fa1){_0x555972['push'](_0x555972['shift']());}};_0x339cf9(++_0x335307);}(_0xae39,0x15d));var _0x9ae3=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xae39[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require(_0x9ae3('0x0'));var moment=require(_0x9ae3('0x1'));var BPromise=require(_0x9ae3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9ae3('0x3'));var db=require(_0x9ae3('0x4'))['db'];var utils=require(_0x9ae3('0x5'));var logger=require(_0x9ae3('0x6'))(_0x9ae3('0x7'));var config=require(_0x9ae3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9ae3('0x9')][_0x9ae3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4bb9cc,_0x297f7d,_0x48ec06){return new BPromise(function(_0xbdde1f,_0xd82faa){return client[_0x9ae3('0xb')](_0x4bb9cc,_0x48ec06)[_0x9ae3('0xc')](function(_0x1aa24c){logger[_0x9ae3('0xd')](_0x9ae3('0xe'),_0x297f7d,_0x9ae3('0xf'));logger['debug'](_0x9ae3('0x10'),_0x297f7d,_0x9ae3('0xf'),JSON[_0x9ae3('0x11')](_0x1aa24c));if(_0x1aa24c[_0x9ae3('0x12')]){if(_0x1aa24c[_0x9ae3('0x12')]['code']===0x1f4){logger[_0x9ae3('0x12')]('VoiceMail,\x20%s,\x20%s',_0x297f7d,_0x1aa24c[_0x9ae3('0x12')][_0x9ae3('0x13')]);return _0xd82faa(_0x1aa24c[_0x9ae3('0x12')]['message']);}logger['error'](_0x9ae3('0xe'),_0x297f7d,_0x1aa24c['error'][_0x9ae3('0x13')]);return _0xbdde1f(_0x1aa24c[_0x9ae3('0x12')][_0x9ae3('0x13')]);}else{logger[_0x9ae3('0xd')](_0x9ae3('0xe'),_0x297f7d,'request\x20sent');_0xbdde1f(_0x1aa24c[_0x9ae3('0x14')]['message']);}})['catch'](function(_0x14c146){logger[_0x9ae3('0x12')](_0x9ae3('0xe'),_0x297f7d,_0x14c146);_0xd82faa(_0x14c146);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 17a6d04..a2ffc07 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 _0x891e=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','/:id','isAuthenticated','show','download','create'];(function(_0x4666fe,_0x2a868e){var _0x5a2611=function(_0x106117){while(--_0x106117){_0x4666fe['push'](_0x4666fe['shift']());}};_0x5a2611(++_0x2a868e);}(_0x891e,0x1bd));var _0xe891=function(_0x104112,_0x342eb6){_0x104112=_0x104112-0x0;var _0x394ab4=_0x891e[_0x104112];return _0x394ab4;};'use strict';var multer=require(_0xe891('0x0'));var util=require(_0xe891('0x1'));var path=require(_0xe891('0x2'));var timeout=require(_0xe891('0x3'));var express=require(_0xe891('0x4'));var router=express[_0xe891('0x5')]();var fs_extra=require(_0xe891('0x6'));var auth=require(_0xe891('0x7'));var interaction=require(_0xe891('0x8'));var config=require(_0xe891('0x9'));var controller=require(_0xe891('0xa'));router[_0xe891('0xb')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xe891('0xc'),auth[_0xe891('0xd')](),controller[_0xe891('0xe')]);router['get']('/:id/download',auth[_0xe891('0xd')](),controller[_0xe891('0xf')]);router['post']('/',auth[_0xe891('0xd')](),controller[_0xe891('0x10')]);router['put'](_0xe891('0xc'),auth[_0xe891('0xd')](),controller[_0xe891('0x11')]);router[_0xe891('0x12')](_0xe891('0xc'),auth[_0xe891('0xd')](),controller[_0xe891('0x13')]);module[_0xe891('0x14')]=router; \ No newline at end of file +var _0x6001=['isAuthenticated','index','/:id','show','download','create','update','delete','destroy','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get'];(function(_0x3e70b5,_0x2f10ae){var _0x317acd=function(_0x1909e3){while(--_0x1909e3){_0x3e70b5['push'](_0x3e70b5['shift']());}};_0x317acd(++_0x2f10ae);}(_0x6001,0x183));var _0x1600=function(_0x322c2f,_0x254da0){_0x322c2f=_0x322c2f-0x0;var _0x33994f=_0x6001[_0x322c2f];return _0x33994f;};'use strict';var multer=require(_0x1600('0x0'));var util=require(_0x1600('0x1'));var path=require('path');var timeout=require(_0x1600('0x2'));var express=require(_0x1600('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1600('0x4'));var interaction=require(_0x1600('0x5'));var config=require(_0x1600('0x6'));var controller=require(_0x1600('0x7'));router[_0x1600('0x8')]('/',auth[_0x1600('0x9')](),controller[_0x1600('0xa')]);router[_0x1600('0x8')](_0x1600('0xb'),auth['isAuthenticated'](),controller[_0x1600('0xc')]);router[_0x1600('0x8')]('/:id/download',auth[_0x1600('0x9')](),controller[_0x1600('0xd')]);router['post']('/',auth[_0x1600('0x9')](),controller[_0x1600('0xe')]);router['put'](_0x1600('0xb'),auth[_0x1600('0x9')](),controller[_0x1600('0xf')]);router[_0x1600('0x10')](_0x1600('0xb'),auth[_0x1600('0x9')](),controller[_0x1600('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 01cbc4f..3b3bbe1 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 _0x0b9b=['getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','exports','VIRTUAL'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x0b9b,0x18e));var _0xb0b9=function(_0xf124a2,_0x11ad05){_0xf124a2=_0xf124a2-0x0;var _0x40cb40=_0x0b9b[_0xf124a2];return _0x40cb40;};'use strict';var Sequelize=require('sequelize');module[_0xb0b9('0x0')]={'name':{'type':Sequelize[_0xb0b9('0x1')],'get':function(_0x425697){return this[_0xb0b9('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xb0b9('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xb0b9('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0xb0b9('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xb0b9('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0xb0b9('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xb0b9('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0xb0b9('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xb0b9('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xb0b9('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0xb0b9('0x5')](_0xb0b9('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0xb0b9('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xb0b9('0x4')],'defaultValue':''},'stamp':{'type':_0xb0b9('0x7'),'defaultValue':Sequelize[_0xb0b9('0x8')](_0xb0b9('0x9'))}}; \ No newline at end of file +var _0x279c=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','VIRTUAL','getDataValue','STRING','BLOB','TIMESTAMP'];(function(_0x4cf3ce,_0x2247e6){var _0x3bda7a=function(_0x57e4e2){while(--_0x57e4e2){_0x4cf3ce['push'](_0x4cf3ce['shift']());}};_0x3bda7a(++_0x2247e6);}(_0x279c,0xb5));var _0xc279=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x279c[_0x2112d4];return _0x434972;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc279('0x0')],'get':function(_0x75a8ae){return this[_0xc279('0x1')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xc279('0x2')],'defaultValue':''},'context':{'type':Sequelize[_0xc279('0x2')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xc279('0x2')],'defaultValue':''},'callerid':{'type':Sequelize[_0xc279('0x2')],'defaultValue':''},'origtime':{'type':Sequelize[_0xc279('0x2')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xc279('0x2')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xc279('0x2')],'defaultValue':''},'recording':{'type':Sequelize[_0xc279('0x3')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xc279('0x2')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0xc279('0x4'),'defaultValue':Sequelize['literal'](_0xc279('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 79db310..ade79bd 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 _0xa0b9=['querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','count','limit','set','reject','update','then','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','query','filters','intersection','fields','length','attributes','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','VoiceMailMessage','include','findAll','rows','catch','show','params','keys','includeAll','options','find','create','body','destroy','download','recording','msg_id','Sequelize','ValidationError','Content-Disposition','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce'];(function(_0x1ee938,_0x22267f){var _0x3ebf3b=function(_0x10611e){while(--_0x10611e){_0x1ee938['push'](_0x1ee938['shift']());}};_0x3ebf3b(++_0x22267f);}(_0xa0b9,0x92));var _0x9a0b=function(_0x5868d2,_0x4ecb9b){_0x5868d2=_0x5868d2-0x0;var _0x2a569c=_0xa0b9[_0x5868d2];return _0x2a569c;};'use strict';var emlformat=require(_0x9a0b('0x0'));var rimraf=require(_0x9a0b('0x1'));var zipdir=require(_0x9a0b('0x2'));var jsonpatch=require(_0x9a0b('0x3'));var rp=require(_0x9a0b('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9a0b('0x5'));var util=require('util');var path=require(_0x9a0b('0x6'));var sox=require(_0x9a0b('0x7'));var csv=require(_0x9a0b('0x8'));var ejs=require(_0x9a0b('0x9'));var fs=require('fs');var fs_extra=require(_0x9a0b('0xa'));var _=require(_0x9a0b('0xb'));var squel=require('squel');var crypto=require(_0x9a0b('0xc'));var jsforce=require(_0x9a0b('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9a0b('0xe'));var Papa=require(_0x9a0b('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9a0b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9a0b('0x11'))(_0x9a0b('0x12'));var utils=require(_0x9a0b('0x13'));var config=require(_0x9a0b('0x14'));var licenseUtil=require(_0x9a0b('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x40a175,_0x242b56){_0x242b56=_0x242b56||0xcc;return function(_0x2cca3a){if(_0x2cca3a){return _0x40a175[_0x9a0b('0x16')](_0x242b56);}return _0x40a175[_0x9a0b('0x17')](_0x242b56)['end']();};}function respondWithResult(_0xfa463e,_0x2a56bd){_0x2a56bd=_0x2a56bd||0xc8;return function(_0x5ddd55){if(_0x5ddd55){return _0xfa463e[_0x9a0b('0x17')](_0x2a56bd)[_0x9a0b('0x18')](_0x5ddd55);}};}function respondWithFilteredResult(_0x29177f,_0x207b27){return function(_0x15dfef){if(_0x15dfef){var _0x30932a=typeof _0x207b27[_0x9a0b('0x19')]==='undefined'&&typeof _0x207b27['limit']==='undefined';var _0x25f214=_0x15dfef[_0x9a0b('0x1a')];var _0x397b94=_0x30932a?0x0:_0x207b27[_0x9a0b('0x19')];var _0x52a219=_0x30932a?_0x15dfef[_0x9a0b('0x1a')]:_0x207b27[_0x9a0b('0x19')]+_0x207b27[_0x9a0b('0x1b')];var _0x424387;if(_0x52a219>=_0x25f214){_0x52a219=_0x25f214;_0x424387=0xc8;}else{_0x424387=0xce;}_0x29177f[_0x9a0b('0x17')](_0x424387);return _0x29177f[_0x9a0b('0x1c')]('Content-Range',_0x397b94+'-'+_0x52a219+'/'+_0x25f214)['json'](_0x15dfef);}return null;};}function patchUpdates(_0x34d4cb){return function(_0x35db4f){try{jsonpatch['apply'](_0x35db4f,_0x34d4cb,!![]);}catch(_0x3635ab){return BPromise[_0x9a0b('0x1d')](_0x3635ab);}return _0x35db4f['save']();};}function saveUpdates(_0x58809a,_0x38aeb8){return function(_0x5db549){if(_0x5db549){return _0x5db549[_0x9a0b('0x1e')](_0x58809a)[_0x9a0b('0x1f')](function(_0x292a8c){return _0x292a8c;});}return null;};}function removeEntity(_0x403ed2,_0x5f1364){return function(_0x17c843){if(_0x17c843){return _0x17c843['destroy']()[_0x9a0b('0x1f')](function(){_0x403ed2[_0x9a0b('0x17')](0xcc)[_0x9a0b('0x20')]();});}};}function handleEntityNotFound(_0x2ab339,_0x1adebe){return function(_0x41ed89){if(!_0x41ed89){_0x2ab339[_0x9a0b('0x16')](0x194);}return _0x41ed89;};}function handleError(_0x2712dc,_0x3bd39c){_0x3bd39c=_0x3bd39c||0x1f4;return function(_0x22b29f){logger[_0x9a0b('0x21')](_0x22b29f[_0x9a0b('0x22')]);if(_0x22b29f[_0x9a0b('0x23')]){delete _0x22b29f[_0x9a0b('0x23')];}_0x2712dc[_0x9a0b('0x17')](_0x3bd39c)[_0x9a0b('0x24')](_0x22b29f);};}exports[_0x9a0b('0x25')]=function(_0x20c8e2,_0x14ca5e){var _0x4a5854={},_0x2d83fd={},_0x2d0386={'count':0x0,'rows':[]};var _0x584775=_[_0x9a0b('0x26')](db['VoiceMailMessage'][_0x9a0b('0x27')],function(_0x41290f){return{'name':_0x41290f[_0x9a0b('0x28')],'type':_0x41290f[_0x9a0b('0x29')][_0x9a0b('0x2a')]};});_0x2d83fd[_0x9a0b('0x2b')]=_[_0x9a0b('0x2c')](_[_0x9a0b('0x26')](_0x584775,_0x9a0b('0x23')),[_0x9a0b('0x23')]);_0x2d83fd[_0x9a0b('0x2d')]=_['keys'](_0x20c8e2[_0x9a0b('0x2d')]);_0x2d83fd[_0x9a0b('0x2e')]=_[_0x9a0b('0x2f')](_0x2d83fd[_0x9a0b('0x2b')],_0x2d83fd['query']);_0x4a5854['attributes']=_[_0x9a0b('0x2f')](_0x2d83fd[_0x9a0b('0x2b')],qs[_0x9a0b('0x30')](_0x20c8e2[_0x9a0b('0x2d')][_0x9a0b('0x30')]));_0x4a5854['attributes']=_0x4a5854['attributes'][_0x9a0b('0x31')]?_0x4a5854[_0x9a0b('0x32')]:_0x2d83fd['model'];if(!_0x20c8e2[_0x9a0b('0x2d')]['hasOwnProperty'](_0x9a0b('0x33'))){_0x4a5854[_0x9a0b('0x1b')]=qs['limit'](_0x20c8e2[_0x9a0b('0x2d')][_0x9a0b('0x1b')]);_0x4a5854[_0x9a0b('0x19')]=qs['offset'](_0x20c8e2[_0x9a0b('0x2d')]['offset']);}_0x4a5854[_0x9a0b('0x34')]=qs['sort'](_0x20c8e2['query'][_0x9a0b('0x35')]);_0x4a5854['where']=qs[_0x9a0b('0x2e')](_[_0x9a0b('0x36')](_0x20c8e2[_0x9a0b('0x2d')],_0x2d83fd['filters']),_0x584775);if(_0x20c8e2[_0x9a0b('0x2d')][_0x9a0b('0x37')]){_0x4a5854[_0x9a0b('0x38')]=_[_0x9a0b('0x39')](_0x4a5854[_0x9a0b('0x38')],{'$or':_[_0x9a0b('0x26')](_0x584775,function(_0x22ce60){if(_0x22ce60[_0x9a0b('0x29')]!==_0x9a0b('0x3a')){var _0x328957={};_0x328957[_0x22ce60[_0x9a0b('0x23')]]={'$like':'%'+_0x20c8e2[_0x9a0b('0x2d')]['filter']+'%'};return _0x328957;}})});}_0x4a5854=_[_0x9a0b('0x39')]({},_0x4a5854,_0x20c8e2['options']);var _0x16d10a={'where':_0x4a5854[_0x9a0b('0x38')]};return db[_0x9a0b('0x3b')][_0x9a0b('0x1a')](_0x16d10a)[_0x9a0b('0x1f')](function(_0x5418f6){_0x2d0386[_0x9a0b('0x1a')]=_0x5418f6;if(_0x20c8e2[_0x9a0b('0x2d')]['includeAll']){_0x4a5854[_0x9a0b('0x3c')]=[{'all':!![]}];}return db[_0x9a0b('0x3b')][_0x9a0b('0x3d')](_0x4a5854);})['then'](function(_0x3e4858){_0x2d0386[_0x9a0b('0x3e')]=_0x3e4858;return _0x2d0386;})['then'](respondWithFilteredResult(_0x14ca5e,_0x4a5854))[_0x9a0b('0x3f')](handleError(_0x14ca5e,null));};exports[_0x9a0b('0x40')]=function(_0xe24874,_0x221fb4){var _0x136f6a={'raw':!![],'where':{'id':_0xe24874[_0x9a0b('0x41')]['id']}},_0x1b19d7={};_0x1b19d7[_0x9a0b('0x2b')]=_[_0x9a0b('0x42')](db[_0x9a0b('0x3b')][_0x9a0b('0x27')]);_0x1b19d7[_0x9a0b('0x2d')]=_['keys'](_0xe24874[_0x9a0b('0x2d')]);_0x1b19d7[_0x9a0b('0x2e')]=_[_0x9a0b('0x2f')](_0x1b19d7[_0x9a0b('0x2b')],_0x1b19d7[_0x9a0b('0x2d')]);_0x136f6a[_0x9a0b('0x32')]=_[_0x9a0b('0x2f')](_0x1b19d7[_0x9a0b('0x2b')],qs[_0x9a0b('0x30')](_0xe24874['query']['fields']));_0x136f6a[_0x9a0b('0x32')]=_0x136f6a[_0x9a0b('0x32')][_0x9a0b('0x31')]?_0x136f6a[_0x9a0b('0x32')]:_0x1b19d7['model'];if(_0xe24874['query'][_0x9a0b('0x43')]){_0x136f6a[_0x9a0b('0x3c')]=[{'all':!![]}];}_0x136f6a=_[_0x9a0b('0x39')]({},_0x136f6a,_0xe24874[_0x9a0b('0x44')]);return db[_0x9a0b('0x3b')][_0x9a0b('0x45')](_0x136f6a)[_0x9a0b('0x1f')](handleEntityNotFound(_0x221fb4,null))[_0x9a0b('0x1f')](respondWithResult(_0x221fb4,null))[_0x9a0b('0x3f')](handleError(_0x221fb4,null));};exports[_0x9a0b('0x46')]=function(_0x2539d0,_0x19dc88){return db['VoiceMailMessage'][_0x9a0b('0x46')](_0x2539d0[_0x9a0b('0x47')],{})[_0x9a0b('0x1f')](respondWithResult(_0x19dc88,0xc9))[_0x9a0b('0x3f')](handleError(_0x19dc88,null));};exports['update']=function(_0x117534,_0x1f8492){if(_0x117534[_0x9a0b('0x47')]['id']){delete _0x117534[_0x9a0b('0x47')]['id'];}return db[_0x9a0b('0x3b')]['find']({'where':{'id':_0x117534[_0x9a0b('0x41')]['id']}})[_0x9a0b('0x1f')](handleEntityNotFound(_0x1f8492,null))[_0x9a0b('0x1f')](saveUpdates(_0x117534[_0x9a0b('0x47')],null))[_0x9a0b('0x1f')](respondWithResult(_0x1f8492,null))['catch'](handleError(_0x1f8492,null));};exports[_0x9a0b('0x48')]=function(_0x4133ed,_0x5e9e02){return db[_0x9a0b('0x3b')]['find']({'where':{'id':_0x4133ed[_0x9a0b('0x41')]['id']}})[_0x9a0b('0x1f')](handleEntityNotFound(_0x5e9e02,null))[_0x9a0b('0x1f')](removeEntity(_0x5e9e02,null))['catch'](handleError(_0x5e9e02,null));};exports[_0x9a0b('0x49')]=function(_0xb89f57,_0x1205c7,_0x48c7f6){return db[_0x9a0b('0x3b')][_0x9a0b('0x45')]({'where':{'id':_0xb89f57['params']['id']},'attributes':['id',_0x9a0b('0x4a'),_0x9a0b('0x4b')]})[_0x9a0b('0x1f')](handleEntityNotFound(_0x1205c7,null))['then'](function(_0x4aab34){if(_0x4aab34){if(!_0x4aab34['recording']){throw new db[(_0x9a0b('0x4c'))][(_0x9a0b('0x4d'))]('VoiceMailMessage\x20not\x20found');}var _0x131693={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0x4aab34[_0x9a0b('0x4b')]){_0x131693[_0x9a0b('0x4e')]='attachment;\x20filename=\x22'+_0x4aab34['msg_id']+_0x9a0b('0x4f');}_0x1205c7[_0x9a0b('0x1c')](_0x131693);return _0x1205c7[_0x9a0b('0x24')](new Buffer(_0x4aab34['recording']));}})[_0x9a0b('0x3f')](handleError(_0x1205c7,null));}; \ No newline at end of file +var _0x4f29=['params','fields','length','create','update','body','find','recording','msg_id','ValidationError','VoiceMailMessage\x20not\x20found','attachment','Content-Disposition','attachment;\x20filename=\x22','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','key','model','differenceBy','keys','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x4f29,0x119));var _0x94f2=function(_0x5e3aa1,_0x3c853d){_0x5e3aa1=_0x5e3aa1-0x0;var _0xac7e95=_0x4f29[_0x5e3aa1];return _0xac7e95;};'use strict';var emlformat=require(_0x94f2('0x0'));var rimraf=require(_0x94f2('0x1'));var zipdir=require(_0x94f2('0x2'));var jsonpatch=require(_0x94f2('0x3'));var rp=require('request-promise');var moment=require(_0x94f2('0x4'));var BPromise=require(_0x94f2('0x5'));var Mustache=require(_0x94f2('0x6'));var util=require(_0x94f2('0x7'));var path=require(_0x94f2('0x8'));var sox=require(_0x94f2('0x9'));var csv=require('to-csv');var ejs=require(_0x94f2('0xa'));var fs=require('fs');var fs_extra=require(_0x94f2('0xb'));var _=require(_0x94f2('0xc'));var squel=require('squel');var crypto=require(_0x94f2('0xd'));var jsforce=require(_0x94f2('0xe'));var deskjs=require(_0x94f2('0xf'));var toCsv=require(_0x94f2('0x10'));var querystring=require(_0x94f2('0x11'));var Papa=require(_0x94f2('0x12'));var Redis=require(_0x94f2('0x13'));var authService=require(_0x94f2('0x14'));var qs=require(_0x94f2('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x94f2('0x16'));var logger=require(_0x94f2('0x17'))('api');var utils=require(_0x94f2('0x18'));var config=require(_0x94f2('0x19'));var licenseUtil=require(_0x94f2('0x1a'));var db=require(_0x94f2('0x1b'))['db'];function respondWithStatusCode(_0x4da25a,_0x480e28){_0x480e28=_0x480e28||0xcc;return function(_0x1367f7){if(_0x1367f7){return _0x4da25a[_0x94f2('0x1c')](_0x480e28);}return _0x4da25a[_0x94f2('0x1d')](_0x480e28)[_0x94f2('0x1e')]();};}function respondWithResult(_0x8a0a74,_0x36ee22){_0x36ee22=_0x36ee22||0xc8;return function(_0x5594ae){if(_0x5594ae){return _0x8a0a74[_0x94f2('0x1d')](_0x36ee22)[_0x94f2('0x1f')](_0x5594ae);}};}function respondWithFilteredResult(_0x54c634,_0x3e967c){return function(_0x37febf){if(_0x37febf){var _0xbf430a=typeof _0x3e967c[_0x94f2('0x20')]===_0x94f2('0x21')&&typeof _0x3e967c[_0x94f2('0x22')]===_0x94f2('0x21');var _0x40f573=_0x37febf['count'];var _0x523e37=_0xbf430a?0x0:_0x3e967c['offset'];var _0x4cac11=_0xbf430a?_0x37febf[_0x94f2('0x23')]:_0x3e967c['offset']+_0x3e967c['limit'];var _0x51db1e;if(_0x4cac11>=_0x40f573){_0x4cac11=_0x40f573;_0x51db1e=0xc8;}else{_0x51db1e=0xce;}_0x54c634[_0x94f2('0x1d')](_0x51db1e);return _0x54c634[_0x94f2('0x24')](_0x94f2('0x25'),_0x523e37+'-'+_0x4cac11+'/'+_0x40f573)[_0x94f2('0x1f')](_0x37febf);}return null;};}function patchUpdates(_0x4edea7){return function(_0x1ff681){try{jsonpatch['apply'](_0x1ff681,_0x4edea7,!![]);}catch(_0x477f81){return BPromise[_0x94f2('0x26')](_0x477f81);}return _0x1ff681[_0x94f2('0x27')]();};}function saveUpdates(_0x8d3c,_0x362dfc){return function(_0x23854d){if(_0x23854d){return _0x23854d['update'](_0x8d3c)[_0x94f2('0x28')](function(_0x29597e){return _0x29597e;});}return null;};}function removeEntity(_0x53e520,_0x9898fd){return function(_0x23f978){if(_0x23f978){return _0x23f978[_0x94f2('0x29')]()[_0x94f2('0x28')](function(){_0x53e520[_0x94f2('0x1d')](0xcc)[_0x94f2('0x1e')]();});}};}function handleEntityNotFound(_0x43dae4,_0x155e98){return function(_0x1f8937){if(!_0x1f8937){_0x43dae4[_0x94f2('0x1c')](0x194);}return _0x1f8937;};}function handleError(_0x51304d,_0x156165){_0x156165=_0x156165||0x1f4;return function(_0x513ea2){logger[_0x94f2('0x2a')](_0x513ea2[_0x94f2('0x2b')]);if(_0x513ea2[_0x94f2('0x2c')]){delete _0x513ea2[_0x94f2('0x2c')];}_0x51304d[_0x94f2('0x1d')](_0x156165)[_0x94f2('0x2d')](_0x513ea2);};}exports[_0x94f2('0x2e')]=function(_0x3e01f3,_0x28f5b6){var _0x5aaae5={},_0x52c4cc={},_0x19dc2b={'count':0x0,'rows':[]};var _0x2bfc8d=_[_0x94f2('0x2f')](db[_0x94f2('0x30')][_0x94f2('0x31')],function(_0xeebda8){return{'name':_0xeebda8[_0x94f2('0x32')],'type':_0xeebda8['type'][_0x94f2('0x33')]};});_0x52c4cc[_0x94f2('0x34')]=_[_0x94f2('0x35')](_['map'](_0x2bfc8d,_0x94f2('0x2c')),[_0x94f2('0x2c')]);_0x52c4cc['query']=_[_0x94f2('0x36')](_0x3e01f3[_0x94f2('0x37')]);_0x52c4cc[_0x94f2('0x38')]=_[_0x94f2('0x39')](_0x52c4cc[_0x94f2('0x34')],_0x52c4cc[_0x94f2('0x37')]);_0x5aaae5[_0x94f2('0x3a')]=_[_0x94f2('0x39')](_0x52c4cc[_0x94f2('0x34')],qs['fields'](_0x3e01f3[_0x94f2('0x37')]['fields']));_0x5aaae5['attributes']=_0x5aaae5[_0x94f2('0x3a')]['length']?_0x5aaae5['attributes']:_0x52c4cc[_0x94f2('0x34')];if(!_0x3e01f3[_0x94f2('0x37')][_0x94f2('0x3b')](_0x94f2('0x3c'))){_0x5aaae5[_0x94f2('0x22')]=qs[_0x94f2('0x22')](_0x3e01f3[_0x94f2('0x37')][_0x94f2('0x22')]);_0x5aaae5[_0x94f2('0x20')]=qs[_0x94f2('0x20')](_0x3e01f3[_0x94f2('0x37')][_0x94f2('0x20')]);}_0x5aaae5[_0x94f2('0x3d')]=qs[_0x94f2('0x3e')](_0x3e01f3['query']['sort']);_0x5aaae5[_0x94f2('0x3f')]=qs[_0x94f2('0x38')](_[_0x94f2('0x40')](_0x3e01f3[_0x94f2('0x37')],_0x52c4cc['filters']),_0x2bfc8d);if(_0x3e01f3[_0x94f2('0x37')][_0x94f2('0x41')]){_0x5aaae5[_0x94f2('0x3f')]=_[_0x94f2('0x42')](_0x5aaae5[_0x94f2('0x3f')],{'$or':_[_0x94f2('0x2f')](_0x2bfc8d,function(_0x3ebf3a){if(_0x3ebf3a[_0x94f2('0x43')]!==_0x94f2('0x44')){var _0x974e0c={};_0x974e0c[_0x3ebf3a['name']]={'$like':'%'+_0x3e01f3['query'][_0x94f2('0x41')]+'%'};return _0x974e0c;}})});}_0x5aaae5=_[_0x94f2('0x42')]({},_0x5aaae5,_0x3e01f3[_0x94f2('0x45')]);var _0x5894d8={'where':_0x5aaae5[_0x94f2('0x3f')]};return db['VoiceMailMessage'][_0x94f2('0x23')](_0x5894d8)[_0x94f2('0x28')](function(_0xb327c1){_0x19dc2b['count']=_0xb327c1;if(_0x3e01f3['query'][_0x94f2('0x46')]){_0x5aaae5[_0x94f2('0x47')]=[{'all':!![]}];}return db[_0x94f2('0x30')][_0x94f2('0x48')](_0x5aaae5);})[_0x94f2('0x28')](function(_0x432dcd){_0x19dc2b['rows']=_0x432dcd;return _0x19dc2b;})[_0x94f2('0x28')](respondWithFilteredResult(_0x28f5b6,_0x5aaae5))[_0x94f2('0x49')](handleError(_0x28f5b6,null));};exports[_0x94f2('0x4a')]=function(_0x17aa25,_0x3cbd6c){var _0x5dcd8d={'raw':!![],'where':{'id':_0x17aa25[_0x94f2('0x4b')]['id']}},_0x35d63d={};_0x35d63d['model']=_[_0x94f2('0x36')](db[_0x94f2('0x30')][_0x94f2('0x31')]);_0x35d63d['query']=_[_0x94f2('0x36')](_0x17aa25[_0x94f2('0x37')]);_0x35d63d[_0x94f2('0x38')]=_['intersection'](_0x35d63d[_0x94f2('0x34')],_0x35d63d[_0x94f2('0x37')]);_0x5dcd8d[_0x94f2('0x3a')]=_[_0x94f2('0x39')](_0x35d63d[_0x94f2('0x34')],qs[_0x94f2('0x4c')](_0x17aa25[_0x94f2('0x37')][_0x94f2('0x4c')]));_0x5dcd8d[_0x94f2('0x3a')]=_0x5dcd8d[_0x94f2('0x3a')][_0x94f2('0x4d')]?_0x5dcd8d[_0x94f2('0x3a')]:_0x35d63d[_0x94f2('0x34')];if(_0x17aa25['query']['includeAll']){_0x5dcd8d[_0x94f2('0x47')]=[{'all':!![]}];}_0x5dcd8d=_[_0x94f2('0x42')]({},_0x5dcd8d,_0x17aa25['options']);return db[_0x94f2('0x30')]['find'](_0x5dcd8d)[_0x94f2('0x28')](handleEntityNotFound(_0x3cbd6c,null))['then'](respondWithResult(_0x3cbd6c,null))['catch'](handleError(_0x3cbd6c,null));};exports[_0x94f2('0x4e')]=function(_0x4ecaa8,_0x56fe69){return db['VoiceMailMessage']['create'](_0x4ecaa8['body'],{})[_0x94f2('0x28')](respondWithResult(_0x56fe69,0xc9))[_0x94f2('0x49')](handleError(_0x56fe69,null));};exports[_0x94f2('0x4f')]=function(_0x88ebcd,_0x344c0d){if(_0x88ebcd['body']['id']){delete _0x88ebcd[_0x94f2('0x50')]['id'];}return db[_0x94f2('0x30')][_0x94f2('0x51')]({'where':{'id':_0x88ebcd[_0x94f2('0x4b')]['id']}})['then'](handleEntityNotFound(_0x344c0d,null))['then'](saveUpdates(_0x88ebcd[_0x94f2('0x50')],null))[_0x94f2('0x28')](respondWithResult(_0x344c0d,null))['catch'](handleError(_0x344c0d,null));};exports[_0x94f2('0x29')]=function(_0x4fce58,_0x1120b0){return db[_0x94f2('0x30')][_0x94f2('0x51')]({'where':{'id':_0x4fce58[_0x94f2('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1120b0,null))[_0x94f2('0x28')](removeEntity(_0x1120b0,null))['catch'](handleError(_0x1120b0,null));};exports['download']=function(_0x158002,_0x46088c,_0x267d9b){return db['VoiceMailMessage'][_0x94f2('0x51')]({'where':{'id':_0x158002[_0x94f2('0x4b')]['id']},'attributes':['id',_0x94f2('0x52'),_0x94f2('0x53')]})[_0x94f2('0x28')](handleEntityNotFound(_0x46088c,null))[_0x94f2('0x28')](function(_0x43d5a7){if(_0x43d5a7){if(!_0x43d5a7[_0x94f2('0x52')]){throw new db['Sequelize'][(_0x94f2('0x54'))](_0x94f2('0x55'));}var _0x4d74f7={'Content-Type':'audio/wav','Content-Disposition':_0x94f2('0x56')};if(_0x43d5a7['msg_id']){_0x4d74f7[_0x94f2('0x57')]=_0x94f2('0x58')+_0x43d5a7['msg_id']+'.wav\x22';}_0x46088c[_0x94f2('0x24')](_0x4d74f7);return _0x46088c[_0x94f2('0x2d')](new Buffer(_0x43d5a7[_0x94f2('0x52')]));}})[_0x94f2('0x49')](handleError(_0x46088c,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 87ab4ad..d11e66c 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 _0xe1b9=['rimraf','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','dir','util','api','bluebird','request-promise','path'];(function(_0x382ff2,_0x45ac63){var _0x40f8d8=function(_0x2e9768){while(--_0x2e9768){_0x382ff2['push'](_0x382ff2['shift']());}};_0x40f8d8(++_0x45ac63);}(_0xe1b9,0x1c9));var _0x9e1b=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0xe1b9[_0x119d5a];return _0x15bff4;};'use strict';var _=require('lodash');var util=require(_0x9e1b('0x0'));var logger=require('../../config/logger')(_0x9e1b('0x1'));var moment=require('moment');var BPromise=require(_0x9e1b('0x2'));var rp=require(_0x9e1b('0x3'));var fs=require('fs');var path=require(_0x9e1b('0x4'));var rimraf=require(_0x9e1b('0x5'));var config=require('../../config/environment');var attributes=require(_0x9e1b('0x6'));module[_0x9e1b('0x7')]=function(_0x61f2b,_0x48b22c){return _0x61f2b[_0x9e1b('0x8')](_0x9e1b('0x9'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':'dir','fields':[_0x9e1b('0xa')]}],'timestamps':![]});}; \ No newline at end of file +var _0x3a62=['api','moment','bluebird','path','../../config/environment','exports','define','VoiceMailMessage','dir','../../config/logger'];(function(_0xc94853,_0x5bf72c){var _0x31b9be=function(_0x240636){while(--_0x240636){_0xc94853['push'](_0xc94853['shift']());}};_0x31b9be(++_0x5bf72c);}(_0x3a62,0xb3));var _0x23a6=function(_0x3056cf,_0x5ba4bf){_0x3056cf=_0x3056cf-0x0;var _0x505963=_0x3a62[_0x3056cf];return _0x505963;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x23a6('0x0'))(_0x23a6('0x1'));var moment=require(_0x23a6('0x2'));var BPromise=require(_0x23a6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x23a6('0x4'));var rimraf=require('rimraf');var config=require(_0x23a6('0x5'));var attributes=require('./voiceMailMessage.attributes');module[_0x23a6('0x6')]=function(_0x19ad24,_0x9e7a26){return _0x19ad24[_0x23a6('0x7')](_0x23a6('0x8'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x23a6('0x9'),'fields':[_0x23a6('0x9')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index d552be7..b0a82b0 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 _0xc2b0=['jayson/promise','client','http','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x15482e,_0x25b23c){var _0x4a0651=function(_0x5afab4){while(--_0x5afab4){_0x15482e['push'](_0x15482e['shift']());}};_0x4a0651(++_0x25b23c);}(_0xc2b0,0x148));var _0x0c2b=function(_0x134de4,_0x49c839){_0x134de4=_0x134de4-0x0;var _0xe97f36=_0xc2b0[_0x134de4];return _0xe97f36;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0c2b('0x0'));var BPromise=require('bluebird');var rs=require(_0x0c2b('0x1'));var fs=require('fs');var Redis=require(_0x0c2b('0x2'));var db=require(_0x0c2b('0x3'))['db'];var utils=require(_0x0c2b('0x4'));var logger=require(_0x0c2b('0x5'))(_0x0c2b('0x6'));var config=require(_0x0c2b('0x7'));var jayson=require(_0x0c2b('0x8'));var client=jayson[_0x0c2b('0x9')][_0x0c2b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4383cd,_0x25a1a8,_0x5228c0){return new BPromise(function(_0x11876d,_0x12f177){return client['request'](_0x4383cd,_0x5228c0)[_0x0c2b('0xb')](function(_0x3d8be9){logger[_0x0c2b('0xc')](_0x0c2b('0xd'),_0x25a1a8,_0x0c2b('0xe'));logger[_0x0c2b('0xf')](_0x0c2b('0x10'),_0x25a1a8,'request\x20sent',JSON['stringify'](_0x3d8be9));if(_0x3d8be9['error']){if(_0x3d8be9[_0x0c2b('0x11')][_0x0c2b('0x12')]===0x1f4){logger['error'](_0x0c2b('0xd'),_0x25a1a8,_0x3d8be9[_0x0c2b('0x11')][_0x0c2b('0x13')]);return _0x12f177(_0x3d8be9[_0x0c2b('0x11')][_0x0c2b('0x13')]);}logger[_0x0c2b('0x11')]('VoiceMailMessage,\x20%s,\x20%s',_0x25a1a8,_0x3d8be9[_0x0c2b('0x11')][_0x0c2b('0x13')]);return _0x11876d(_0x3d8be9[_0x0c2b('0x11')][_0x0c2b('0x13')]);}else{logger[_0x0c2b('0xc')](_0x0c2b('0xd'),_0x25a1a8,_0x0c2b('0xe'));_0x11876d(_0x3d8be9['result']['message']);}})[_0x0c2b('0x14')](function(_0x36162c){logger[_0x0c2b('0x11')]('VoiceMailMessage,\x20%s,\x20%s',_0x25a1a8,_0x36162c);_0x12f177(_0x36162c);});});} \ No newline at end of file +var _0x18f2=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment'];(function(_0x2f9650,_0x516cb3){var _0x13e6f8=function(_0xef4215){while(--_0xef4215){_0x2f9650['push'](_0x2f9650['shift']());}};_0x13e6f8(++_0x516cb3);}(_0x18f2,0x189));var _0x218f=function(_0x21fcea,_0x499d76){_0x21fcea=_0x21fcea-0x0;var _0x1da0b1=_0x18f2[_0x21fcea];return _0x1da0b1;};'use strict';var _=require(_0x218f('0x0'));var util=require(_0x218f('0x1'));var moment=require(_0x218f('0x2'));var BPromise=require(_0x218f('0x3'));var rs=require(_0x218f('0x4'));var fs=require('fs');var Redis=require(_0x218f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x218f('0x6'));var logger=require(_0x218f('0x7'))('rpc');var config=require(_0x218f('0x8'));var jayson=require(_0x218f('0x9'));var client=jayson[_0x218f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11d1ac,_0x59d00c,_0x391619){return new BPromise(function(_0x33f7cf,_0x126e7f){return client[_0x218f('0xb')](_0x11d1ac,_0x391619)[_0x218f('0xc')](function(_0x58ba74){logger[_0x218f('0xd')](_0x218f('0xe'),_0x59d00c,_0x218f('0xf'));logger[_0x218f('0x10')](_0x218f('0x11'),_0x59d00c,_0x218f('0xf'),JSON['stringify'](_0x58ba74));if(_0x58ba74[_0x218f('0x12')]){if(_0x58ba74['error'][_0x218f('0x13')]===0x1f4){logger[_0x218f('0x12')](_0x218f('0xe'),_0x59d00c,_0x58ba74[_0x218f('0x12')]['message']);return _0x126e7f(_0x58ba74[_0x218f('0x12')][_0x218f('0x14')]);}logger['error'](_0x218f('0xe'),_0x59d00c,_0x58ba74[_0x218f('0x12')][_0x218f('0x14')]);return _0x33f7cf(_0x58ba74[_0x218f('0x12')]['message']);}else{logger[_0x218f('0xd')]('VoiceMailMessage,\x20%s,\x20%s',_0x59d00c,_0x218f('0xf'));_0x33f7cf(_0x58ba74['result']['message']);}})[_0x218f('0x15')](function(_0xbeea66){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x59d00c,_0xbeea66);_0x126e7f(_0xbeea66);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 4139335..7c02539 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 _0xd955=['update','delete','destroy','/:id/sounds/:id2','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','/:id','show','/:id/sounds','getSounds','post','create','addSound'];(function(_0x5348dd,_0x9f2699){var _0x8b36b7=function(_0x1ba48d){while(--_0x1ba48d){_0x5348dd['push'](_0x5348dd['shift']());}};_0x8b36b7(++_0x9f2699);}(_0xd955,0x1d3));var _0x5d95=function(_0xe3d5f0,_0x5edf94){_0xe3d5f0=_0xe3d5f0-0x0;var _0x22835b=_0xd955[_0xe3d5f0];return _0x22835b;};'use strict';var multer=require('multer');var util=require(_0x5d95('0x0'));var path=require(_0x5d95('0x1'));var timeout=require('connect-timeout');var express=require(_0x5d95('0x2'));var router=express[_0x5d95('0x3')]();var fs_extra=require(_0x5d95('0x4'));var auth=require(_0x5d95('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5d95('0x6'));var controller=require(_0x5d95('0x7'));router[_0x5d95('0x8')]('/',auth[_0x5d95('0x9')](),controller['index']);router[_0x5d95('0x8')](_0x5d95('0xa'),auth['isAuthenticated'](),controller[_0x5d95('0xb')]);router[_0x5d95('0x8')](_0x5d95('0xc'),auth[_0x5d95('0x9')](),controller[_0x5d95('0xd')]);router[_0x5d95('0xe')]('/',auth[_0x5d95('0x9')](),controller[_0x5d95('0xf')]);router[_0x5d95('0xe')](_0x5d95('0xc'),auth[_0x5d95('0x9')](),controller[_0x5d95('0x10')]);router['put'](_0x5d95('0xa'),auth[_0x5d95('0x9')](),controller[_0x5d95('0x11')]);router[_0x5d95('0x12')](_0x5d95('0xa'),auth['isAuthenticated'](),controller[_0x5d95('0x13')]);router['delete'](_0x5d95('0x14'),auth['isAuthenticated'](),controller['removeSound']);module[_0x5d95('0x15')]=router; \ No newline at end of file +var _0x87cb=['show','/:id/sounds','getSounds','create','post','addSound','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./voiceMusicOnHold.controller','isAuthenticated','get','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x87cb,0x1ed));var _0xb87c=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x87cb[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0xb87c('0x0'));var util=require(_0xb87c('0x1'));var path=require(_0xb87c('0x2'));var timeout=require(_0xb87c('0x3'));var express=require(_0xb87c('0x4'));var router=express['Router']();var fs_extra=require(_0xb87c('0x5'));var auth=require(_0xb87c('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb87c('0x7'));router['get']('/',auth[_0xb87c('0x8')](),controller['index']);router[_0xb87c('0x9')](_0xb87c('0xa'),auth[_0xb87c('0x8')](),controller[_0xb87c('0xb')]);router[_0xb87c('0x9')](_0xb87c('0xc'),auth[_0xb87c('0x8')](),controller[_0xb87c('0xd')]);router['post']('/',auth[_0xb87c('0x8')](),controller[_0xb87c('0xe')]);router[_0xb87c('0xf')](_0xb87c('0xc'),auth[_0xb87c('0x8')](),controller[_0xb87c('0x10')]);router[_0xb87c('0x11')](_0xb87c('0xa'),auth[_0xb87c('0x8')](),controller[_0xb87c('0x12')]);router[_0xb87c('0x13')](_0xb87c('0xa'),auth[_0xb87c('0x8')](),controller['destroy']);router[_0xb87c('0x13')]('/:id/sounds/:id2',auth[_0xb87c('0x8')](),controller['removeSound']);module[_0xb87c('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index c8dacc6..735e347 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 _0x9375=['TIMESTAMP','BOOLEAN','sequelize','exports','mp3nb','quietmp3nb','mp3','files','STRING','alpha'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9375,0x7a));var _0x5937=function(_0x5355aa,_0x17b3f1){_0x5355aa=_0x5355aa-0x0;var _0x53b9f2=_0x9375[_0x5355aa];return _0x53b9f2;};'use strict';var Sequelize=require(_0x5937('0x0'));module[_0x5937('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize['ENUM']('custom','files',_0x5937('0x2'),_0x5937('0x3'),'quietmp3',_0x5937('0x4')),'allowNull':!![],'defaultValue':_0x5937('0x5')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x5937('0x6')],'allowNull':!![]},'digit':{'type':Sequelize[_0x5937('0x6')],'allowNull':!![]},'sort':{'type':Sequelize[_0x5937('0x6')],'allowNull':!![],'defaultValue':_0x5937('0x7')},'format':{'type':Sequelize[_0x5937('0x6')],'allowNull':!![]},'stamp':{'type':_0x5937('0x8')},'defaultEntry':{'type':Sequelize[_0x5937('0x9')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9a7b=['STRING','ENUM','custom','files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','sequelize','exports'];(function(_0x48d33a,_0xdcc91c){var _0x4dec0e=function(_0x4c6036){while(--_0x4c6036){_0x48d33a['push'](_0x48d33a['shift']());}};_0x4dec0e(++_0xdcc91c);}(_0x9a7b,0xbe));var _0xb9a7=function(_0x4f0895,_0x56e95d){_0x4f0895=_0x4f0895-0x0;var _0x2eeaf4=_0x9a7b[_0x4f0895];return _0x2eeaf4;};'use strict';var Sequelize=require(_0xb9a7('0x0'));module[_0xb9a7('0x1')]={'name':{'type':Sequelize[_0xb9a7('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0xb9a7('0x3')](_0xb9a7('0x4'),_0xb9a7('0x5'),_0xb9a7('0x6'),_0xb9a7('0x7'),_0xb9a7('0x8'),_0xb9a7('0x9')),'allowNull':!![],'defaultValue':_0xb9a7('0x5')},'directory':{'type':Sequelize[_0xb9a7('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xb9a7('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xb9a7('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xb9a7('0x2')],'allowNull':!![],'defaultValue':_0xb9a7('0xa')},'format':{'type':Sequelize[_0xb9a7('0x2')],'allowNull':!![]},'stamp':{'type':_0xb9a7('0xb')},'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 576c78c..be56c75 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 _0xac64=['end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','get','destroy','error','stack','name','send','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','body','create','transaction','mode','directory','root','server/files/moh','files','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','readdirSync','forEach','unlinkSync','join','rmdirSync','Sequelize','message','sequelize','addSound','findOne','save_name','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','converted_format','ValidationError','removeSound','id2','Sound','getSounds','order','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status'];(function(_0x9fb081,_0x48f480){var _0x43f8b0=function(_0x418570){while(--_0x418570){_0x9fb081['push'](_0x9fb081['shift']());}};_0x43f8b0(++_0x48f480);}(_0xac64,0x13d));var _0x4ac6=function(_0x4d6185,_0x1b4910){_0x4d6185=_0x4d6185-0x0;var _0x2e4ac6=_0xac64[_0x4d6185];return _0x2e4ac6;};'use strict';var emlformat=require(_0x4ac6('0x0'));var rimraf=require(_0x4ac6('0x1'));var zipdir=require(_0x4ac6('0x2'));var jsonpatch=require(_0x4ac6('0x3'));var rp=require(_0x4ac6('0x4'));var moment=require('moment');var BPromise=require(_0x4ac6('0x5'));var Mustache=require(_0x4ac6('0x6'));var util=require(_0x4ac6('0x7'));var path=require('path');var sox=require(_0x4ac6('0x8'));var csv=require(_0x4ac6('0x9'));var ejs=require(_0x4ac6('0xa'));var fs=require('fs');var fs_extra=require(_0x4ac6('0xb'));var _=require(_0x4ac6('0xc'));var squel=require('squel');var crypto=require(_0x4ac6('0xd'));var jsforce=require(_0x4ac6('0xe'));var deskjs=require(_0x4ac6('0xf'));var toCsv=require(_0x4ac6('0x9'));var querystring=require(_0x4ac6('0x10'));var Papa=require(_0x4ac6('0x11'));var Redis=require(_0x4ac6('0x12'));var authService=require(_0x4ac6('0x13'));var qs=require(_0x4ac6('0x14'));var as=require(_0x4ac6('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4ac6('0x16'))(_0x4ac6('0x17'));var utils=require(_0x4ac6('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x4ac6('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1faba2,_0x434481){_0x434481=_0x434481||0xcc;return function(_0x4ffe30){if(_0x4ffe30){return _0x1faba2[_0x4ac6('0x1a')](_0x434481);}return _0x1faba2[_0x4ac6('0x1b')](_0x434481)[_0x4ac6('0x1c')]();};}function respondWithResult(_0x3c75a7,_0x153c19){_0x153c19=_0x153c19||0xc8;return function(_0x172302){if(_0x172302){return _0x3c75a7[_0x4ac6('0x1b')](_0x153c19)['json'](_0x172302);}};}function respondWithFilteredResult(_0x20267c,_0x561d50){return function(_0xa9a92c){if(_0xa9a92c){var _0x1959ae=typeof _0x561d50[_0x4ac6('0x1d')]===_0x4ac6('0x1e')&&typeof _0x561d50[_0x4ac6('0x1f')]===_0x4ac6('0x1e');var _0x5d5d4e=_0xa9a92c['count'];var _0x452378=_0x1959ae?0x0:_0x561d50[_0x4ac6('0x1d')];var _0x63260a=_0x1959ae?_0xa9a92c[_0x4ac6('0x20')]:_0x561d50[_0x4ac6('0x1d')]+_0x561d50[_0x4ac6('0x1f')];var _0x5da250;if(_0x63260a>=_0x5d5d4e){_0x63260a=_0x5d5d4e;_0x5da250=0xc8;}else{_0x5da250=0xce;}_0x20267c[_0x4ac6('0x1b')](_0x5da250);return _0x20267c['set'](_0x4ac6('0x21'),_0x452378+'-'+_0x63260a+'/'+_0x5d5d4e)[_0x4ac6('0x22')](_0xa9a92c);}return null;};}function patchUpdates(_0x385288){return function(_0x3c9fb3){try{jsonpatch[_0x4ac6('0x23')](_0x3c9fb3,_0x385288,!![]);}catch(_0x21ec07){return BPromise[_0x4ac6('0x24')](_0x21ec07);}return _0x3c9fb3[_0x4ac6('0x25')]();};}function saveUpdates(_0x2e3e29,_0x18954b){return function(_0x399bcb){if(_0x399bcb){return _0x399bcb[_0x4ac6('0x26')](_0x2e3e29)['then'](function(_0xd7eeab){return _0xd7eeab;});}return null;};}function removeEntity(_0x3edf31,_0x135fc6){return function(_0x53dbf9){if(_0x53dbf9){return _0x53dbf9['destroy']()[_0x4ac6('0x27')](function(){var _0x492195=_0x53dbf9[_0x4ac6('0x28')]({'plain':!![]});var _0x2b8d44='MusicOnHolds';return db['UserProfileResource'][_0x4ac6('0x29')]({'where':{'type':_0x2b8d44,'resourceId':_0x492195['id']}})['then'](function(){return _0x53dbf9;});})[_0x4ac6('0x27')](function(){_0x3edf31[_0x4ac6('0x1b')](0xcc)[_0x4ac6('0x1c')]();});}};}function handleEntityNotFound(_0xc5b54e,_0x267415){return function(_0x19395d){if(!_0x19395d){_0xc5b54e[_0x4ac6('0x1a')](0x194);}return _0x19395d;};}function handleError(_0x2c1913,_0x3f0e85){_0x3f0e85=_0x3f0e85||0x1f4;return function(_0x106d65){logger[_0x4ac6('0x2a')](_0x106d65[_0x4ac6('0x2b')]);if(_0x106d65[_0x4ac6('0x2c')]){delete _0x106d65[_0x4ac6('0x2c')];}_0x2c1913[_0x4ac6('0x1b')](_0x3f0e85)[_0x4ac6('0x2d')](_0x106d65);};}exports['index']=function(_0x58d604,_0x54479d){var _0x145164={},_0x315d9d={},_0x1d84af={'count':0x0,'rows':[]};var _0x18c05e=_[_0x4ac6('0x2e')](db[_0x4ac6('0x2f')][_0x4ac6('0x30')],function(_0x45cd86){return{'name':_0x45cd86[_0x4ac6('0x31')],'type':_0x45cd86[_0x4ac6('0x32')][_0x4ac6('0x33')]};});_0x315d9d['model']=_[_0x4ac6('0x2e')](_0x18c05e,_0x4ac6('0x2c'));_0x315d9d[_0x4ac6('0x34')]=_[_0x4ac6('0x35')](_0x58d604[_0x4ac6('0x34')]);_0x315d9d[_0x4ac6('0x36')]=_[_0x4ac6('0x37')](_0x315d9d[_0x4ac6('0x38')],_0x315d9d[_0x4ac6('0x34')]);_0x145164[_0x4ac6('0x39')]=_[_0x4ac6('0x37')](_0x315d9d[_0x4ac6('0x38')],qs[_0x4ac6('0x3a')](_0x58d604[_0x4ac6('0x34')][_0x4ac6('0x3a')]));_0x145164[_0x4ac6('0x39')]=_0x145164[_0x4ac6('0x39')][_0x4ac6('0x3b')]?_0x145164[_0x4ac6('0x39')]:_0x315d9d[_0x4ac6('0x38')];if(!_0x58d604['query'][_0x4ac6('0x3c')](_0x4ac6('0x3d'))){_0x145164[_0x4ac6('0x1f')]=qs[_0x4ac6('0x1f')](_0x58d604[_0x4ac6('0x34')]['limit']);_0x145164[_0x4ac6('0x1d')]=qs[_0x4ac6('0x1d')](_0x58d604[_0x4ac6('0x34')][_0x4ac6('0x1d')]);}_0x145164['order']=qs[_0x4ac6('0x3e')](_0x58d604[_0x4ac6('0x34')][_0x4ac6('0x3e')]);delete _0x58d604[_0x4ac6('0x34')]['sort'];_0x145164[_0x4ac6('0x3f')]=qs[_0x4ac6('0x36')](_[_0x4ac6('0x40')](_0x58d604[_0x4ac6('0x34')],_0x315d9d[_0x4ac6('0x36')]),_0x18c05e);if(_0x58d604[_0x4ac6('0x34')][_0x4ac6('0x41')]){_0x145164[_0x4ac6('0x3f')]=_[_0x4ac6('0x42')](_0x145164[_0x4ac6('0x3f')],{'$or':_[_0x4ac6('0x2e')](_0x18c05e,function(_0x57e1b7){if(_0x57e1b7[_0x4ac6('0x32')]!==_0x4ac6('0x43')){var _0x366c2f={};_0x366c2f[_0x57e1b7[_0x4ac6('0x2c')]]={'$like':'%'+_0x58d604[_0x4ac6('0x34')][_0x4ac6('0x41')]+'%'};return _0x366c2f;}})});}_0x145164=_['merge']({},_0x145164,_0x58d604[_0x4ac6('0x44')]);var _0x393dd3={'where':_0x145164[_0x4ac6('0x3f')]};return db[_0x4ac6('0x2f')][_0x4ac6('0x20')](_0x393dd3)['then'](function(_0x1732ee){_0x1d84af[_0x4ac6('0x20')]=_0x1732ee;if(_0x58d604[_0x4ac6('0x34')][_0x4ac6('0x45')]){_0x145164[_0x4ac6('0x46')]=[{'all':!![]}];}return db[_0x4ac6('0x2f')][_0x4ac6('0x47')](_0x145164);})[_0x4ac6('0x27')](function(_0x5e335b){_0x1d84af[_0x4ac6('0x48')]=_0x5e335b;return _0x1d84af;})[_0x4ac6('0x27')](respondWithFilteredResult(_0x54479d,_0x145164))[_0x4ac6('0x49')](handleError(_0x54479d,null));};exports['show']=function(_0x16a108,_0x345ea2){var _0x5e5495={'raw':![],'where':{'id':_0x16a108[_0x4ac6('0x4a')]['id']}},_0x240638={};_0x240638['model']=_['keys'](db['VoiceMusicOnHold'][_0x4ac6('0x30')]);_0x240638[_0x4ac6('0x34')]=_['keys'](_0x16a108[_0x4ac6('0x34')]);_0x240638[_0x4ac6('0x36')]=_[_0x4ac6('0x37')](_0x240638[_0x4ac6('0x38')],_0x240638['query']);_0x5e5495[_0x4ac6('0x39')]=_[_0x4ac6('0x37')](_0x240638[_0x4ac6('0x38')],qs[_0x4ac6('0x3a')](_0x16a108[_0x4ac6('0x34')][_0x4ac6('0x3a')]));_0x5e5495[_0x4ac6('0x39')]=_0x5e5495[_0x4ac6('0x39')][_0x4ac6('0x3b')]?_0x5e5495[_0x4ac6('0x39')]:_0x240638['model'];if(_0x16a108[_0x4ac6('0x34')][_0x4ac6('0x45')]){_0x5e5495[_0x4ac6('0x46')]=[{'all':!![]}];}_0x5e5495=_['merge']({},_0x5e5495,_0x16a108[_0x4ac6('0x44')]);return db[_0x4ac6('0x2f')][_0x4ac6('0x4b')](_0x5e5495)['then'](handleEntityNotFound(_0x345ea2,null))['then'](respondWithResult(_0x345ea2,null))[_0x4ac6('0x49')](handleError(_0x345ea2,null));};exports[_0x4ac6('0x26')]=function(_0x3cff19,_0x170426){if(_0x3cff19[_0x4ac6('0x4c')]['id']){delete _0x3cff19[_0x4ac6('0x4c')]['id'];}return db[_0x4ac6('0x2f')]['find']({'where':{'id':_0x3cff19[_0x4ac6('0x4a')]['id']}})[_0x4ac6('0x27')](handleEntityNotFound(_0x170426,null))[_0x4ac6('0x27')](saveUpdates(_0x3cff19[_0x4ac6('0x4c')],null))[_0x4ac6('0x27')](respondWithResult(_0x170426,null))[_0x4ac6('0x49')](handleError(_0x170426,null));};exports[_0x4ac6('0x4d')]=function(_0x16486c,_0x1953aa,_0xf31e11){return db['sequelize'][_0x4ac6('0x4e')](function(_0x533bd2){if(_0x16486c[_0x4ac6('0x4c')][_0x4ac6('0x4f')]==='files'){_0x16486c['body'][_0x4ac6('0x50')]=path['join'](config[_0x4ac6('0x51')],_0x4ac6('0x52'),_0x16486c[_0x4ac6('0x4c')][_0x4ac6('0x2c')]);}return db[_0x4ac6('0x2f')][_0x4ac6('0x4d')](_0x16486c[_0x4ac6('0x4c')],{'transaction':_0x533bd2})['then'](function(_0x2fb9e9){if(_0x16486c[_0x4ac6('0x4c')][_0x4ac6('0x4f')]===_0x4ac6('0x53')){fs[_0x4ac6('0x54')](_0x2fb9e9['directory'],parseInt(_0x4ac6('0x55'),0x8));}var _0x5d6ea7=_0x16486c[_0x4ac6('0x56')][_0x4ac6('0x28')]({'plain':!![]});if(!_0x5d6ea7)throw new Error(_0x4ac6('0x57'));if(_0x5d6ea7[_0x4ac6('0x58')]===_0x4ac6('0x56')){var _0x44426d=_0x2fb9e9[_0x4ac6('0x28')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':'MusicOnHolds','userProfileId':_0x5d6ea7[_0x4ac6('0x59')]},'raw':!![]})['then'](function(_0xe77282){if(_0xe77282&&_0xe77282[_0x4ac6('0x5a')]===0x0){return db['UserProfileResource'][_0x4ac6('0x4d')]({'name':_0x44426d[_0x4ac6('0x2c')],'resourceId':_0x44426d['id'],'type':_0xe77282[_0x4ac6('0x2c')],'sectionId':_0xe77282['id']},{})[_0x4ac6('0x27')](function(){return _0x2fb9e9;});}else{return _0x2fb9e9;}})[_0x4ac6('0x49')](function(_0x121bb6){logger[_0x4ac6('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x121bb6);});}return _0x2fb9e9;});})[_0x4ac6('0x27')](respondWithResult(_0x1953aa,0xc9))[_0x4ac6('0x49')](handleError(_0x1953aa,null));};exports[_0x4ac6('0x29')]=function(_0x18f799,_0x111931,_0x5a09e8){var _0x26c895;return db[_0x4ac6('0x2f')][_0x4ac6('0x4b')]({'where':{'id':_0x18f799[_0x4ac6('0x4a')]['id']}})[_0x4ac6('0x27')](function(_0x44debb){if(_0x44debb){return db['sequelize'][_0x4ac6('0x4e')](function(_0x3a4492){return _0x44debb[_0x4ac6('0x29')]({'transaction':_0x3a4492,'raw':!![]})[_0x4ac6('0x27')](function(_0x448da1){if(_0x448da1[_0x4ac6('0x50')]){fs[_0x4ac6('0x5b')](_0x448da1[_0x4ac6('0x50')])[_0x4ac6('0x5c')](function(_0x399c9e){fs[_0x4ac6('0x5d')](path[_0x4ac6('0x5e')](_0x448da1['directory'],_0x399c9e));});fs[_0x4ac6('0x5f')](_0x448da1[_0x4ac6('0x50')]);}return _0x448da1;});})[_0x4ac6('0x49')](function(_0x7b7e5c){throw new db[(_0x4ac6('0x60'))]['ValidationError'](_0x7b7e5c[_0x4ac6('0x61')]);});}})['then'](handleEntityNotFound(_0x111931,null))['then'](removeEntity(_0x111931,null))[_0x4ac6('0x49')](handleError(_0x111931,null));};exports['addSound']=function(_0x1f2f59,_0x55e640,_0x57097d){return db[_0x4ac6('0x62')]['transaction'](function(_0x35aff0){var _0x495cfa;return db[_0x4ac6('0x2f')][_0x4ac6('0x4b')]({'where':{'id':_0x1f2f59[_0x4ac6('0x4a')]['id']}})[_0x4ac6('0x27')](function(_0x2eb740){if(_0x2eb740){_0x495cfa=_0x2eb740;return _0x2eb740[_0x4ac6('0x63')](_0x1f2f59[_0x4ac6('0x4c')]['id'],{'transaction':_0x35aff0});}})[_0x4ac6('0x27')](function(_0x4c0f3f){if(_0x4c0f3f){return db['Sound'][_0x4ac6('0x64')]({'where':{'id':_0x1f2f59[_0x4ac6('0x4c')]['id']},'attributes':['id',_0x4ac6('0x2c'),_0x4ac6('0x65'),'converted_format',_0x4ac6('0x66')],'raw':!![]});}})[_0x4ac6('0x27')](function(_0x50a342){if(_0x50a342){var _0x118f37=path['join'](config[_0x4ac6('0x51')],_0x4ac6('0x67'),util[_0x4ac6('0x68')](_0x4ac6('0x69'),path[_0x4ac6('0x6a')](_0x50a342[_0x4ac6('0x65')],path[_0x4ac6('0x6b')](_0x50a342['save_name'])),_0x50a342['converted_format']));var _0x2a2ab2=path[_0x4ac6('0x5e')](config['root'],_0x4ac6('0x52'),_0x495cfa['name'],util[_0x4ac6('0x68')](_0x4ac6('0x69'),_0x50a342[_0x4ac6('0x2c')],_0x50a342[_0x4ac6('0x6c')]));fs['symlinkSync'](_0x118f37,_0x2a2ab2);return _0x50a342;}})['catch'](function(_0x5f340a){throw new db['Sequelize'][(_0x4ac6('0x6d'))](_0x5f340a[_0x4ac6('0x61')]);});})[_0x4ac6('0x27')](handleEntityNotFound(_0x55e640,null))[_0x4ac6('0x27')](respondWithResult(_0x55e640,0xc9))['catch'](handleError(_0x55e640,null));};exports[_0x4ac6('0x6e')]=function(_0x294f63,_0x571457,_0x52c8c1){return db['sequelize']['transaction'](function(_0x5b0858){var _0x160c45;return db[_0x4ac6('0x2f')]['findOne']({'where':{'id':_0x294f63['params']['id']}})[_0x4ac6('0x27')](handleEntityNotFound(_0x571457,null))[_0x4ac6('0x27')](function(_0x5988ca){if(_0x5988ca){_0x160c45=_0x5988ca;return _0x5988ca[_0x4ac6('0x6e')](_0x294f63[_0x4ac6('0x4a')][_0x4ac6('0x6f')]);}})['then'](function(_0x574ccb){if(_0x574ccb){return db[_0x4ac6('0x70')][_0x4ac6('0x64')]({'where':{'id':_0x294f63[_0x4ac6('0x4a')][_0x4ac6('0x6f')]},'attributes':['id',_0x4ac6('0x2c'),'save_name',_0x4ac6('0x6c'),_0x4ac6('0x66')],'raw':!![]});}})['then'](function(_0x5f8a31){if(_0x5f8a31){fs[_0x4ac6('0x5d')](path[_0x4ac6('0x5e')](_0x160c45[_0x4ac6('0x50')],util[_0x4ac6('0x68')](_0x4ac6('0x69'),_0x5f8a31['name'],_0x5f8a31[_0x4ac6('0x6c')])));return _0x5f8a31;}})[_0x4ac6('0x49')](function(_0x472fca){throw new db[(_0x4ac6('0x60'))]['ValidationError'](_0x472fca[_0x4ac6('0x61')]);});})['then'](handleEntityNotFound(_0x571457,null))[_0x4ac6('0x27')](respondWithStatusCode(_0x571457,0xcc))[_0x4ac6('0x49')](handleError(_0x571457,null));};exports[_0x4ac6('0x71')]=function(_0x363a17,_0x3ce38b,_0x4a91c4){var _0x1ae0a2={};var _0x58ac6a={};var _0x33c958;var _0x1f7417;return db[_0x4ac6('0x2f')][_0x4ac6('0x64')]({'where':{'id':_0x363a17['params']['id']}})['then'](handleEntityNotFound(_0x3ce38b,null))[_0x4ac6('0x27')](function(_0x24a289){if(_0x24a289){_0x33c958=_0x24a289;_0x58ac6a['model']=_[_0x4ac6('0x35')](db[_0x4ac6('0x70')][_0x4ac6('0x30')]);_0x58ac6a['query']=_[_0x4ac6('0x35')](_0x363a17[_0x4ac6('0x34')]);_0x58ac6a[_0x4ac6('0x36')]=_[_0x4ac6('0x37')](_0x58ac6a[_0x4ac6('0x38')],_0x58ac6a[_0x4ac6('0x34')]);_0x1ae0a2[_0x4ac6('0x39')]=_[_0x4ac6('0x37')](_0x58ac6a[_0x4ac6('0x38')],qs['fields'](_0x363a17['query'][_0x4ac6('0x3a')]));_0x1ae0a2[_0x4ac6('0x39')]=_0x1ae0a2[_0x4ac6('0x39')][_0x4ac6('0x3b')]?_0x1ae0a2[_0x4ac6('0x39')]:_0x58ac6a[_0x4ac6('0x38')];_0x1ae0a2[_0x4ac6('0x72')]=qs['sort'](_0x363a17['query']['sort']);_0x1ae0a2['where']=qs[_0x4ac6('0x36')](_[_0x4ac6('0x40')](_0x363a17[_0x4ac6('0x34')],_0x58ac6a['filters']));if(_0x363a17[_0x4ac6('0x34')][_0x4ac6('0x41')]){_0x1ae0a2[_0x4ac6('0x3f')]=_[_0x4ac6('0x42')](_0x1ae0a2['where'],{'$or':_[_0x4ac6('0x2e')](_0x1ae0a2['attributes'],function(_0x30f12f){var _0x6de87c={};_0x6de87c[_0x30f12f]={'$like':'%'+_0x363a17[_0x4ac6('0x34')][_0x4ac6('0x41')]+'%'};return _0x6de87c;})});}_0x1ae0a2=_[_0x4ac6('0x42')]({},_0x1ae0a2,_0x363a17['options']);return _0x33c958[_0x4ac6('0x71')](_0x1ae0a2);}})[_0x4ac6('0x27')](function(_0x39f1c6){if(_0x39f1c6){_0x1f7417=_0x39f1c6['length'];if(!_0x363a17[_0x4ac6('0x34')]['hasOwnProperty'](_0x4ac6('0x3d'))){_0x1ae0a2['limit']=qs[_0x4ac6('0x1f')](_0x363a17[_0x4ac6('0x34')][_0x4ac6('0x1f')]);_0x1ae0a2[_0x4ac6('0x1d')]=qs[_0x4ac6('0x1d')](_0x363a17['query']['offset']);}return _0x33c958[_0x4ac6('0x71')](_0x1ae0a2);}})[_0x4ac6('0x27')](function(_0x105251){if(_0x105251){return _0x105251?{'count':_0x1f7417,'rows':_0x105251}:null;}})[_0x4ac6('0x27')](respondWithResult(_0x3ce38b,null))[_0x4ac6('0x49')](handleError(_0x3ce38b,null));}; \ No newline at end of file +var _0xb6ca=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','forEach','unlinkSync','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','join','server/files/sounds/converted','format','%s.%s','basename','extname','root','symlinkSync','removeSound','id2','Sequelize','getSounds','map','rimraf','zip-dir','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','error','name','VoiceMusicOnHold','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','catch','show','find','body','params','create','sequelize','mode','files','directory','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation'];(function(_0x427217,_0x4039b1){var _0x5b28fb=function(_0x3eaa08){while(--_0x3eaa08){_0x427217['push'](_0x427217['shift']());}};_0x5b28fb(++_0x4039b1);}(_0xb6ca,0x8a));var _0xab6c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb6ca[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xab6c('0x0'));var zipdir=require(_0xab6c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xab6c('0x2'));var Mustache=require(_0xab6c('0x3'));var util=require(_0xab6c('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xab6c('0x5'));var ejs=require(_0xab6c('0x6'));var fs=require('fs');var fs_extra=require(_0xab6c('0x7'));var _=require(_0xab6c('0x8'));var squel=require(_0xab6c('0x9'));var crypto=require(_0xab6c('0xa'));var jsforce=require(_0xab6c('0xb'));var deskjs=require(_0xab6c('0xc'));var toCsv=require(_0xab6c('0x5'));var querystring=require(_0xab6c('0xd'));var Papa=require(_0xab6c('0xe'));var Redis=require(_0xab6c('0xf'));var authService=require(_0xab6c('0x10'));var qs=require(_0xab6c('0x11'));var as=require(_0xab6c('0x12'));var hardwareService=require(_0xab6c('0x13'));var logger=require(_0xab6c('0x14'))(_0xab6c('0x15'));var utils=require('../../config/utils');var config=require(_0xab6c('0x16'));var licenseUtil=require(_0xab6c('0x17'));var db=require(_0xab6c('0x18'))['db'];function respondWithStatusCode(_0x48b16f,_0x2034d6){_0x2034d6=_0x2034d6||0xcc;return function(_0x9bebe3){if(_0x9bebe3){return _0x48b16f[_0xab6c('0x19')](_0x2034d6);}return _0x48b16f[_0xab6c('0x1a')](_0x2034d6)[_0xab6c('0x1b')]();};}function respondWithResult(_0x593c18,_0x4012e3){_0x4012e3=_0x4012e3||0xc8;return function(_0x3fba23){if(_0x3fba23){return _0x593c18[_0xab6c('0x1a')](_0x4012e3)[_0xab6c('0x1c')](_0x3fba23);}};}function respondWithFilteredResult(_0x31ebef,_0x47d03a){return function(_0xde0b41){if(_0xde0b41){var _0x2b9b67=typeof _0x47d03a[_0xab6c('0x1d')]===_0xab6c('0x1e')&&typeof _0x47d03a[_0xab6c('0x1f')]===_0xab6c('0x1e');var _0x2432b0=_0xde0b41[_0xab6c('0x20')];var _0xd512ed=_0x2b9b67?0x0:_0x47d03a[_0xab6c('0x1d')];var _0x13252b=_0x2b9b67?_0xde0b41[_0xab6c('0x20')]:_0x47d03a[_0xab6c('0x1d')]+_0x47d03a[_0xab6c('0x1f')];var _0x3da25d;if(_0x13252b>=_0x2432b0){_0x13252b=_0x2432b0;_0x3da25d=0xc8;}else{_0x3da25d=0xce;}_0x31ebef[_0xab6c('0x1a')](_0x3da25d);return _0x31ebef[_0xab6c('0x21')](_0xab6c('0x22'),_0xd512ed+'-'+_0x13252b+'/'+_0x2432b0)[_0xab6c('0x1c')](_0xde0b41);}return null;};}function patchUpdates(_0x1d2f9c){return function(_0x9e9a26){try{jsonpatch[_0xab6c('0x23')](_0x9e9a26,_0x1d2f9c,!![]);}catch(_0x55cb6d){return BPromise[_0xab6c('0x24')](_0x55cb6d);}return _0x9e9a26[_0xab6c('0x25')]();};}function saveUpdates(_0x376988,_0x1e6e82){return function(_0x4f69ea){if(_0x4f69ea){return _0x4f69ea[_0xab6c('0x26')](_0x376988)[_0xab6c('0x27')](function(_0x47965c){return _0x47965c;});}return null;};}function removeEntity(_0x1fe0d0,_0x5a7467){return function(_0x1f7ced){if(_0x1f7ced){return _0x1f7ced['destroy']()[_0xab6c('0x27')](function(){var _0x33946d=_0x1f7ced[_0xab6c('0x28')]({'plain':!![]});var _0xa91e22='MusicOnHolds';return db[_0xab6c('0x29')][_0xab6c('0x2a')]({'where':{'type':_0xa91e22,'resourceId':_0x33946d['id']}})[_0xab6c('0x27')](function(){return _0x1f7ced;});})[_0xab6c('0x27')](function(){_0x1fe0d0[_0xab6c('0x1a')](0xcc)[_0xab6c('0x1b')]();});}};}function handleEntityNotFound(_0x5be9e2,_0x1f6a95){return function(_0x4bbb6f){if(!_0x4bbb6f){_0x5be9e2['sendStatus'](0x194);}return _0x4bbb6f;};}function handleError(_0x1d3bd1,_0x4cb182){_0x4cb182=_0x4cb182||0x1f4;return function(_0x42785c){logger[_0xab6c('0x2b')](_0x42785c['stack']);if(_0x42785c['name']){delete _0x42785c[_0xab6c('0x2c')];}_0x1d3bd1[_0xab6c('0x1a')](_0x4cb182)['send'](_0x42785c);};}exports['index']=function(_0x1a6589,_0x215af7){var _0x5e65b7={},_0x4352bb={},_0x28b0ef={'count':0x0,'rows':[]};var _0x19288d=_['map'](db[_0xab6c('0x2d')][_0xab6c('0x2e')],function(_0x2ff996){return{'name':_0x2ff996[_0xab6c('0x2f')],'type':_0x2ff996[_0xab6c('0x30')]['key']};});_0x4352bb[_0xab6c('0x31')]=_['map'](_0x19288d,'name');_0x4352bb[_0xab6c('0x32')]=_[_0xab6c('0x33')](_0x1a6589['query']);_0x4352bb[_0xab6c('0x34')]=_[_0xab6c('0x35')](_0x4352bb[_0xab6c('0x31')],_0x4352bb[_0xab6c('0x32')]);_0x5e65b7[_0xab6c('0x36')]=_[_0xab6c('0x35')](_0x4352bb[_0xab6c('0x31')],qs[_0xab6c('0x37')](_0x1a6589[_0xab6c('0x32')][_0xab6c('0x37')]));_0x5e65b7['attributes']=_0x5e65b7[_0xab6c('0x36')][_0xab6c('0x38')]?_0x5e65b7[_0xab6c('0x36')]:_0x4352bb[_0xab6c('0x31')];if(!_0x1a6589[_0xab6c('0x32')][_0xab6c('0x39')](_0xab6c('0x3a'))){_0x5e65b7[_0xab6c('0x1f')]=qs[_0xab6c('0x1f')](_0x1a6589[_0xab6c('0x32')][_0xab6c('0x1f')]);_0x5e65b7[_0xab6c('0x1d')]=qs[_0xab6c('0x1d')](_0x1a6589['query'][_0xab6c('0x1d')]);}_0x5e65b7[_0xab6c('0x3b')]=qs[_0xab6c('0x3c')](_0x1a6589[_0xab6c('0x32')][_0xab6c('0x3c')]);delete _0x1a6589['query'][_0xab6c('0x3c')];_0x5e65b7['where']=qs[_0xab6c('0x34')](_[_0xab6c('0x3d')](_0x1a6589[_0xab6c('0x32')],_0x4352bb[_0xab6c('0x34')]),_0x19288d);if(_0x1a6589[_0xab6c('0x32')][_0xab6c('0x3e')]){_0x5e65b7['where']=_[_0xab6c('0x3f')](_0x5e65b7[_0xab6c('0x40')],{'$or':_['map'](_0x19288d,function(_0x5c2e8a){if(_0x5c2e8a[_0xab6c('0x30')]!==_0xab6c('0x41')){var _0x579725={};_0x579725[_0x5c2e8a[_0xab6c('0x2c')]]={'$like':'%'+_0x1a6589[_0xab6c('0x32')]['filter']+'%'};return _0x579725;}})});}_0x5e65b7=_[_0xab6c('0x3f')]({},_0x5e65b7,_0x1a6589[_0xab6c('0x42')]);var _0x26857b={'where':_0x5e65b7['where']};return db['VoiceMusicOnHold'][_0xab6c('0x20')](_0x26857b)[_0xab6c('0x27')](function(_0x1c2468){_0x28b0ef[_0xab6c('0x20')]=_0x1c2468;if(_0x1a6589[_0xab6c('0x32')][_0xab6c('0x43')]){_0x5e65b7[_0xab6c('0x44')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xab6c('0x45')](_0x5e65b7);})['then'](function(_0x3f6aba){_0x28b0ef['rows']=_0x3f6aba;return _0x28b0ef;})['then'](respondWithFilteredResult(_0x215af7,_0x5e65b7))[_0xab6c('0x46')](handleError(_0x215af7,null));};exports[_0xab6c('0x47')]=function(_0x2a6fd0,_0x1d3042){var _0x2a0ed0={'raw':![],'where':{'id':_0x2a6fd0['params']['id']}},_0x57d74e={};_0x57d74e[_0xab6c('0x31')]=_[_0xab6c('0x33')](db[_0xab6c('0x2d')][_0xab6c('0x2e')]);_0x57d74e['query']=_[_0xab6c('0x33')](_0x2a6fd0[_0xab6c('0x32')]);_0x57d74e['filters']=_[_0xab6c('0x35')](_0x57d74e[_0xab6c('0x31')],_0x57d74e['query']);_0x2a0ed0['attributes']=_[_0xab6c('0x35')](_0x57d74e[_0xab6c('0x31')],qs[_0xab6c('0x37')](_0x2a6fd0[_0xab6c('0x32')]['fields']));_0x2a0ed0['attributes']=_0x2a0ed0['attributes'][_0xab6c('0x38')]?_0x2a0ed0[_0xab6c('0x36')]:_0x57d74e[_0xab6c('0x31')];if(_0x2a6fd0[_0xab6c('0x32')][_0xab6c('0x43')]){_0x2a0ed0['include']=[{'all':!![]}];}_0x2a0ed0=_[_0xab6c('0x3f')]({},_0x2a0ed0,_0x2a6fd0['options']);return db['VoiceMusicOnHold'][_0xab6c('0x48')](_0x2a0ed0)[_0xab6c('0x27')](handleEntityNotFound(_0x1d3042,null))[_0xab6c('0x27')](respondWithResult(_0x1d3042,null))[_0xab6c('0x46')](handleError(_0x1d3042,null));};exports[_0xab6c('0x26')]=function(_0x423736,_0x16c497){if(_0x423736[_0xab6c('0x49')]['id']){delete _0x423736[_0xab6c('0x49')]['id'];}return db['VoiceMusicOnHold'][_0xab6c('0x48')]({'where':{'id':_0x423736[_0xab6c('0x4a')]['id']}})[_0xab6c('0x27')](handleEntityNotFound(_0x16c497,null))[_0xab6c('0x27')](saveUpdates(_0x423736[_0xab6c('0x49')],null))[_0xab6c('0x27')](respondWithResult(_0x16c497,null))[_0xab6c('0x46')](handleError(_0x16c497,null));};exports[_0xab6c('0x4b')]=function(_0x1f65f1,_0x37e229,_0x1f86d8){return db[_0xab6c('0x4c')]['transaction'](function(_0x2078a8){if(_0x1f65f1[_0xab6c('0x49')][_0xab6c('0x4d')]===_0xab6c('0x4e')){_0x1f65f1[_0xab6c('0x49')][_0xab6c('0x4f')]=path['join'](config['root'],'server/files/moh',_0x1f65f1[_0xab6c('0x49')][_0xab6c('0x2c')]);}return db[_0xab6c('0x2d')][_0xab6c('0x4b')](_0x1f65f1[_0xab6c('0x49')],{'transaction':_0x2078a8})[_0xab6c('0x27')](function(_0x2b07c4){if(_0x1f65f1[_0xab6c('0x49')][_0xab6c('0x4d')]===_0xab6c('0x4e')){fs[_0xab6c('0x50')](_0x2b07c4[_0xab6c('0x4f')],parseInt(_0xab6c('0x51'),0x8));}var _0x23f103=_0x1f65f1[_0xab6c('0x52')][_0xab6c('0x28')]({'plain':!![]});if(!_0x23f103)throw new Error(_0xab6c('0x53'));if(_0x23f103[_0xab6c('0x54')]===_0xab6c('0x52')){var _0x357fd4=_0x2b07c4[_0xab6c('0x28')]({'plain':!![]});return db[_0xab6c('0x55')][_0xab6c('0x48')]({'where':{'name':'MusicOnHolds','userProfileId':_0x23f103[_0xab6c('0x56')]},'raw':!![]})[_0xab6c('0x27')](function(_0x56b979){if(_0x56b979&&_0x56b979[_0xab6c('0x57')]===0x0){return db[_0xab6c('0x29')][_0xab6c('0x4b')]({'name':_0x357fd4[_0xab6c('0x2c')],'resourceId':_0x357fd4['id'],'type':_0x56b979['name'],'sectionId':_0x56b979['id']},{})[_0xab6c('0x27')](function(){return _0x2b07c4;});}else{return _0x2b07c4;}})[_0xab6c('0x46')](function(_0x10db8f){logger[_0xab6c('0x2b')](_0xab6c('0x58'),_0x10db8f);});}return _0x2b07c4;});})[_0xab6c('0x27')](respondWithResult(_0x37e229,0xc9))[_0xab6c('0x46')](handleError(_0x37e229,null));};exports[_0xab6c('0x2a')]=function(_0xd874ff,_0x33eefe,_0x5083d3){var _0x4f6bb0;return db[_0xab6c('0x2d')][_0xab6c('0x48')]({'where':{'id':_0xd874ff[_0xab6c('0x4a')]['id']}})['then'](function(_0x56c22d){if(_0x56c22d){return db[_0xab6c('0x4c')][_0xab6c('0x59')](function(_0x515ee2){return _0x56c22d[_0xab6c('0x2a')]({'transaction':_0x515ee2,'raw':!![]})[_0xab6c('0x27')](function(_0x4a8d82){if(_0x4a8d82['directory']){fs['readdirSync'](_0x4a8d82['directory'])[_0xab6c('0x5a')](function(_0x3218d9){fs[_0xab6c('0x5b')](path['join'](_0x4a8d82[_0xab6c('0x4f')],_0x3218d9));});fs['rmdirSync'](_0x4a8d82[_0xab6c('0x4f')]);}return _0x4a8d82;});})[_0xab6c('0x46')](function(_0x31ce61){throw new db['Sequelize'][(_0xab6c('0x5c'))](_0x31ce61[_0xab6c('0x5d')]);});}})[_0xab6c('0x27')](handleEntityNotFound(_0x33eefe,null))['then'](removeEntity(_0x33eefe,null))['catch'](handleError(_0x33eefe,null));};exports[_0xab6c('0x5e')]=function(_0xe25e8e,_0x3acc99,_0x29f666){return db[_0xab6c('0x4c')]['transaction'](function(_0x5ac774){var _0x3be107;return db['VoiceMusicOnHold'][_0xab6c('0x48')]({'where':{'id':_0xe25e8e[_0xab6c('0x4a')]['id']}})[_0xab6c('0x27')](function(_0x216e62){if(_0x216e62){_0x3be107=_0x216e62;return _0x216e62[_0xab6c('0x5e')](_0xe25e8e['body']['id'],{'transaction':_0x5ac774});}})[_0xab6c('0x27')](function(_0x2de35d){if(_0x2de35d){return db[_0xab6c('0x5f')][_0xab6c('0x60')]({'where':{'id':_0xe25e8e[_0xab6c('0x49')]['id']},'attributes':['id',_0xab6c('0x2c'),_0xab6c('0x61'),_0xab6c('0x62'),_0xab6c('0x63')],'raw':!![]});}})[_0xab6c('0x27')](function(_0x5e0272){if(_0x5e0272){var _0x8ec892=path[_0xab6c('0x64')](config['root'],_0xab6c('0x65'),util[_0xab6c('0x66')](_0xab6c('0x67'),path[_0xab6c('0x68')](_0x5e0272['save_name'],path[_0xab6c('0x69')](_0x5e0272[_0xab6c('0x61')])),_0x5e0272[_0xab6c('0x62')]));var _0x201200=path[_0xab6c('0x64')](config[_0xab6c('0x6a')],'server/files/moh',_0x3be107['name'],util['format'](_0xab6c('0x67'),_0x5e0272[_0xab6c('0x2c')],_0x5e0272[_0xab6c('0x62')]));fs[_0xab6c('0x6b')](_0x8ec892,_0x201200);return _0x5e0272;}})[_0xab6c('0x46')](function(_0x1accb2){throw new db['Sequelize'][(_0xab6c('0x5c'))](_0x1accb2[_0xab6c('0x5d')]);});})[_0xab6c('0x27')](handleEntityNotFound(_0x3acc99,null))[_0xab6c('0x27')](respondWithResult(_0x3acc99,0xc9))[_0xab6c('0x46')](handleError(_0x3acc99,null));};exports[_0xab6c('0x6c')]=function(_0x34198e,_0x5f2abc,_0x23a792){return db[_0xab6c('0x4c')][_0xab6c('0x59')](function(_0x31599f){var _0x1462e1;return db[_0xab6c('0x2d')][_0xab6c('0x60')]({'where':{'id':_0x34198e['params']['id']}})[_0xab6c('0x27')](handleEntityNotFound(_0x5f2abc,null))['then'](function(_0x3d014f){if(_0x3d014f){_0x1462e1=_0x3d014f;return _0x3d014f['removeSound'](_0x34198e[_0xab6c('0x4a')][_0xab6c('0x6d')]);}})['then'](function(_0x434c83){if(_0x434c83){return db[_0xab6c('0x5f')][_0xab6c('0x60')]({'where':{'id':_0x34198e[_0xab6c('0x4a')][_0xab6c('0x6d')]},'attributes':['id','name',_0xab6c('0x61'),'converted_format',_0xab6c('0x63')],'raw':!![]});}})['then'](function(_0x55d1df){if(_0x55d1df){fs['unlinkSync'](path[_0xab6c('0x64')](_0x1462e1[_0xab6c('0x4f')],util[_0xab6c('0x66')](_0xab6c('0x67'),_0x55d1df[_0xab6c('0x2c')],_0x55d1df[_0xab6c('0x62')])));return _0x55d1df;}})[_0xab6c('0x46')](function(_0x322a5d){throw new db[(_0xab6c('0x6e'))][(_0xab6c('0x5c'))](_0x322a5d[_0xab6c('0x5d')]);});})['then'](handleEntityNotFound(_0x5f2abc,null))[_0xab6c('0x27')](respondWithStatusCode(_0x5f2abc,0xcc))['catch'](handleError(_0x5f2abc,null));};exports[_0xab6c('0x6f')]=function(_0x955ac1,_0xc6fefc,_0x1f5dc5){var _0x13a4a1={};var _0x15fed6={};var _0x1f2124;var _0x5c7b0b;return db['VoiceMusicOnHold'][_0xab6c('0x60')]({'where':{'id':_0x955ac1[_0xab6c('0x4a')]['id']}})[_0xab6c('0x27')](handleEntityNotFound(_0xc6fefc,null))[_0xab6c('0x27')](function(_0x3b4ae8){if(_0x3b4ae8){_0x1f2124=_0x3b4ae8;_0x15fed6['model']=_['keys'](db[_0xab6c('0x5f')][_0xab6c('0x2e')]);_0x15fed6[_0xab6c('0x32')]=_[_0xab6c('0x33')](_0x955ac1[_0xab6c('0x32')]);_0x15fed6['filters']=_[_0xab6c('0x35')](_0x15fed6['model'],_0x15fed6[_0xab6c('0x32')]);_0x13a4a1[_0xab6c('0x36')]=_[_0xab6c('0x35')](_0x15fed6[_0xab6c('0x31')],qs[_0xab6c('0x37')](_0x955ac1[_0xab6c('0x32')][_0xab6c('0x37')]));_0x13a4a1[_0xab6c('0x36')]=_0x13a4a1[_0xab6c('0x36')][_0xab6c('0x38')]?_0x13a4a1['attributes']:_0x15fed6[_0xab6c('0x31')];_0x13a4a1['order']=qs['sort'](_0x955ac1[_0xab6c('0x32')][_0xab6c('0x3c')]);_0x13a4a1['where']=qs['filters'](_[_0xab6c('0x3d')](_0x955ac1[_0xab6c('0x32')],_0x15fed6['filters']));if(_0x955ac1[_0xab6c('0x32')][_0xab6c('0x3e')]){_0x13a4a1[_0xab6c('0x40')]=_['merge'](_0x13a4a1[_0xab6c('0x40')],{'$or':_[_0xab6c('0x70')](_0x13a4a1[_0xab6c('0x36')],function(_0x556486){var _0x28634a={};_0x28634a[_0x556486]={'$like':'%'+_0x955ac1[_0xab6c('0x32')][_0xab6c('0x3e')]+'%'};return _0x28634a;})});}_0x13a4a1=_[_0xab6c('0x3f')]({},_0x13a4a1,_0x955ac1[_0xab6c('0x42')]);return _0x1f2124[_0xab6c('0x6f')](_0x13a4a1);}})['then'](function(_0x57dba3){if(_0x57dba3){_0x5c7b0b=_0x57dba3[_0xab6c('0x38')];if(!_0x955ac1['query'][_0xab6c('0x39')]('nolimit')){_0x13a4a1[_0xab6c('0x1f')]=qs[_0xab6c('0x1f')](_0x955ac1[_0xab6c('0x32')][_0xab6c('0x1f')]);_0x13a4a1[_0xab6c('0x1d')]=qs[_0xab6c('0x1d')](_0x955ac1[_0xab6c('0x32')]['offset']);}return _0x1f2124[_0xab6c('0x6f')](_0x13a4a1);}})[_0xab6c('0x27')](function(_0x34e4de){if(_0x34e4de){return _0x34e4de?{'count':_0x5c7b0b,'rows':_0x34e4de}:null;}})[_0xab6c('0x27')](respondWithResult(_0xc6fefc,null))[_0xab6c('0x46')](handleError(_0xc6fefc,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index b97cd83..42b27f7 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 _0xa4b5=['path','./voiceMusicOnHold.attributes','exports','util','../../config/logger'];(function(_0x8bb4c1,_0x2d6e53){var _0x67a6e1=function(_0x1155e5){while(--_0x1155e5){_0x8bb4c1['push'](_0x8bb4c1['shift']());}};_0x67a6e1(++_0x2d6e53);}(_0xa4b5,0x1bb));var _0x5a4b=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0xa4b5[_0x5317b5];return _0x3b7ce2;};'use strict';var _=require('lodash');var util=require(_0x5a4b('0x0'));var logger=require(_0x5a4b('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5a4b('0x2'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5a4b('0x3'));module[_0x5a4b('0x4')]=function(_0x1c3e39,_0x4d4273){return _0x1c3e39['define']('VoiceMusicOnHold',attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb4b=['../../config/environment','define','voice_musiconhold','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x182ac7,_0x4accc4){var _0x189184=function(_0x2afce1){while(--_0x2afce1){_0x182ac7['push'](_0x182ac7['shift']());}};_0x189184(++_0x4accc4);}(_0xcb4b,0x1a5));var _0xbcb4=function(_0x480c3c,_0x31ac72){_0x480c3c=_0x480c3c-0x0;var _0x1e81a2=_0xcb4b[_0x480c3c];return _0x1e81a2;};'use strict';var _=require(_0xbcb4('0x0'));var util=require(_0xbcb4('0x1'));var logger=require(_0xbcb4('0x2'))(_0xbcb4('0x3'));var moment=require('moment');var BPromise=require(_0xbcb4('0x4'));var rp=require(_0xbcb4('0x5'));var fs=require('fs');var path=require(_0xbcb4('0x6'));var rimraf=require(_0xbcb4('0x7'));var config=require(_0xbcb4('0x8'));var attributes=require('./voiceMusicOnHold.attributes');module['exports']=function(_0x34fb85,_0xe6e0c5){return _0x34fb85[_0xbcb4('0x9')]('VoiceMusicOnHold',attributes,{'tableName':_0xbcb4('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 9a7d480..5adf4cb 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x31b907,_0x52f3db){var _0x3c66fb=function(_0x44b0b4){while(--_0x44b0b4){_0x31b907['push'](_0x31b907['shift']());}};_0x3c66fb(++_0x52f3db);}(_0xe706,0xa3));var _0x6e70=function(_0x5c65ee,_0x57b017){_0x5c65ee=_0x5c65ee-0x0;var _0x4b8689=_0xe706[_0x5c65ee];return _0x4b8689;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _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(_0x4fd31d,_0x1a1d9e){var _0x1aba6b=function(_0x1d52f8){while(--_0x1d52f8){_0x4fd31d['push'](_0x4fd31d['shift']());}};_0x1aba6b(++_0x1a1d9e);}(_0x9c44,0x178));var _0x49c4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c44[_0x3dd15e];return _0x231fd0;};'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 6dc47ae..ad62cd6 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 _0x7c06=['getTeams','post','create','addAgents','/:id/teams','addTeams','put','update','delete','destroy','removeAgents','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','get','isAuthenticated','/describe','/:id','show','/:id/users','getAgents'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7c06,0x8e));var _0x67c0=function(_0x2667e8,_0x4f7f57){_0x2667e8=_0x2667e8-0x0;var _0x389b67=_0x7c06[_0x2667e8];return _0x389b67;};'use strict';var multer=require('multer');var util=require(_0x67c0('0x0'));var path=require(_0x67c0('0x1'));var timeout=require(_0x67c0('0x2'));var express=require('express');var router=express[_0x67c0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x67c0('0x4'));var interaction=require(_0x67c0('0x5'));var config=require('../../config/environment');var controller=require(_0x67c0('0x6'));router[_0x67c0('0x7')]('/',auth[_0x67c0('0x8')](),controller['index']);router[_0x67c0('0x7')](_0x67c0('0x9'),auth[_0x67c0('0x8')](),controller['describe']);router[_0x67c0('0x7')](_0x67c0('0xa'),auth[_0x67c0('0x8')](),controller[_0x67c0('0xb')]);router['get'](_0x67c0('0xc'),auth[_0x67c0('0x8')](),controller[_0x67c0('0xd')]);router[_0x67c0('0x7')]('/:id/teams',auth['isAuthenticated'](),controller[_0x67c0('0xe')]);router[_0x67c0('0xf')]('/',auth['isAuthenticated'](),controller[_0x67c0('0x10')]);router['post'](_0x67c0('0xc'),auth[_0x67c0('0x8')](),controller[_0x67c0('0x11')]);router['post'](_0x67c0('0x12'),auth[_0x67c0('0x8')](),controller[_0x67c0('0x13')]);router[_0x67c0('0x14')](_0x67c0('0xa'),auth[_0x67c0('0x8')](),controller[_0x67c0('0x15')]);router[_0x67c0('0x16')](_0x67c0('0xa'),auth['isAuthenticated'](),controller[_0x67c0('0x17')]);router[_0x67c0('0x16')](_0x67c0('0xc'),auth[_0x67c0('0x8')](),controller[_0x67c0('0x18')]);router['delete'](_0x67c0('0x12'),auth[_0x67c0('0x8')](),controller['removeTeams']);module[_0x67c0('0x19')]=router; \ No newline at end of file +var _0x1b94=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','get','isAuthenticated','/describe','describe','show','/:id/users','/:id/teams','getTeams','post','addAgents','addTeams','/:id','update','delete','removeTeams','exports','multer','util'];(function(_0x3ab9eb,_0x1a6857){var _0x15729b=function(_0x247c83){while(--_0x247c83){_0x3ab9eb['push'](_0x3ab9eb['shift']());}};_0x15729b(++_0x1a6857);}(_0x1b94,0x1f2));var _0x41b9=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x1b94[_0x42bdad];return _0x122626;};'use strict';var multer=require(_0x41b9('0x0'));var util=require(_0x41b9('0x1'));var path=require(_0x41b9('0x2'));var timeout=require(_0x41b9('0x3'));var express=require(_0x41b9('0x4'));var router=express['Router']();var fs_extra=require(_0x41b9('0x5'));var auth=require(_0x41b9('0x6'));var interaction=require(_0x41b9('0x7'));var config=require('../../config/environment');var controller=require(_0x41b9('0x8'));router[_0x41b9('0x9')]('/',auth[_0x41b9('0xa')](),controller['index']);router[_0x41b9('0x9')](_0x41b9('0xb'),auth[_0x41b9('0xa')](),controller[_0x41b9('0xc')]);router[_0x41b9('0x9')]('/:id',auth[_0x41b9('0xa')](),controller[_0x41b9('0xd')]);router['get'](_0x41b9('0xe'),auth[_0x41b9('0xa')](),controller['getAgents']);router[_0x41b9('0x9')](_0x41b9('0xf'),auth['isAuthenticated'](),controller[_0x41b9('0x10')]);router['post']('/',auth[_0x41b9('0xa')](),controller['create']);router[_0x41b9('0x11')](_0x41b9('0xe'),auth[_0x41b9('0xa')](),controller[_0x41b9('0x12')]);router[_0x41b9('0x11')]('/:id/teams',auth[_0x41b9('0xa')](),controller[_0x41b9('0x13')]);router['put'](_0x41b9('0x14'),auth[_0x41b9('0xa')](),controller[_0x41b9('0x15')]);router[_0x41b9('0x16')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x41b9('0x16')](_0x41b9('0xe'),auth['isAuthenticated'](),controller['removeAgents']);router[_0x41b9('0x16')](_0x41b9('0xf'),auth[_0x41b9('0xa')](),controller[_0x41b9('0x17')]);module[_0x41b9('0x18')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 6d6ce04..5aa1367 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 _0xe112=['getDataValue','STRING','INTEGER','sequelize','exports','name','system-'];(function(_0x47cd41,_0x5f3fa8){var _0x4e1eeb=function(_0x40a325){while(--_0x40a325){_0x47cd41['push'](_0x47cd41['shift']());}};_0x4e1eeb(++_0x5f3fa8);}(_0xe112,0x1f4));var _0x2e11=function(_0x8f7f44,_0x1917fe){_0x8f7f44=_0x8f7f44-0x0;var _0xde4e7=_0xe112[_0x8f7f44];return _0xde4e7;};'use strict';var Sequelize=require(_0x2e11('0x0'));module[_0x2e11('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2e11('0x2')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x46dadd){return _0x2e11('0x3')+this[_0x2e11('0x4')]('name')+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x2e11('0x5')]},'VoiceExtensionId':{'type':Sequelize[_0x2e11('0x6')]}}; \ No newline at end of file +var _0x2895=['VIRTUAL','system-','getDataValue','name','INTEGER','sequelize','exports','STRING'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x2895,0x1d5));var _0x5289=function(_0x13c07b,_0x468f5b){_0x13c07b=_0x13c07b-0x0;var _0x46fc2a=_0x2895[_0x13c07b];return _0x46fc2a;};'use strict';var Sequelize=require(_0x5289('0x0'));module[_0x5289('0x1')]={'name':{'type':Sequelize[_0x5289('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x5289('0x3')],'get':function(_0x103e00){return _0x5289('0x4')+this[_0x5289('0x5')](_0x5289('0x6'))+'-';}},'description':{'type':Sequelize[_0x5289('0x2')]},'callerIdAll':{'type':Sequelize[_0x5289('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x5289('0x7')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 1e0d3a8..9a74393 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 _0xb62e=['all','compact','value','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./voicePrefix.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','VoicePrefixes','UserProfileResource','name','send','index','map','VoicePrefix','type','key','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','describe','create','sequelize','body','get','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','system','description','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','${EXTEN:','charAt','system-','transaction','findById','addAgents','ids','omit','spread','emit','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','nolimit','getTeams','Team','addTeams','Agents','voicePause','flatMap','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','User','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','SELECT','every','TeamId','includes'];(function(_0x5b39c0,_0x5c36c6){var _0x2b4498=function(_0x36c5e4){while(--_0x36c5e4){_0x5b39c0['push'](_0x5b39c0['shift']());}};_0x2b4498(++_0x5c36c6);}(_0xb62e,0x1de));var _0xeb62=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xb62e[_0x618414];return _0x21c19a;};'use strict';var emlformat=require(_0xeb62('0x0'));var rimraf=require(_0xeb62('0x1'));var zipdir=require(_0xeb62('0x2'));var jsonpatch=require(_0xeb62('0x3'));var rp=require('request-promise');var moment=require(_0xeb62('0x4'));var BPromise=require(_0xeb62('0x5'));var Mustache=require(_0xeb62('0x6'));var util=require(_0xeb62('0x7'));var path=require(_0xeb62('0x8'));var sox=require(_0xeb62('0x9'));var csv=require('to-csv');var ejs=require(_0xeb62('0xa'));var fs=require('fs');var fs_extra=require(_0xeb62('0xb'));var _=require(_0xeb62('0xc'));var squel=require('squel');var crypto=require(_0xeb62('0xd'));var jsforce=require(_0xeb62('0xe'));var deskjs=require(_0xeb62('0xf'));var toCsv=require(_0xeb62('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeb62('0x11'));var authService=require(_0xeb62('0x12'));var qs=require(_0xeb62('0x13'));var as=require(_0xeb62('0x14'));var hardwareService=require(_0xeb62('0x15'));var logger=require(_0xeb62('0x16'))(_0xeb62('0x17'));var utils=require(_0xeb62('0x18'));var config=require(_0xeb62('0x19'));var licenseUtil=require(_0xeb62('0x1a'));var db=require('../../mysqldb')['db'];config[_0xeb62('0x1b')]=_[_0xeb62('0x1c')](config[_0xeb62('0x1b')],{'host':_0xeb62('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeb62('0x1b')]));require(_0xeb62('0x1e'))[_0xeb62('0x1f')](socket);function respondWithStatusCode(_0x4da178,_0x26c3fd){_0x26c3fd=_0x26c3fd||0xcc;return function(_0x195837){if(_0x195837){return _0x4da178[_0xeb62('0x20')](_0x26c3fd);}return _0x4da178['status'](_0x26c3fd)[_0xeb62('0x21')]();};}function respondWithResult(_0x15b3e8,_0x184106){_0x184106=_0x184106||0xc8;return function(_0x353e2c){if(_0x353e2c){return _0x15b3e8[_0xeb62('0x22')](_0x184106)[_0xeb62('0x23')](_0x353e2c);}};}function respondWithFilteredResult(_0x1fb460,_0x1324d7){return function(_0x39b138){if(_0x39b138){var _0x27fd84=typeof _0x1324d7[_0xeb62('0x24')]===_0xeb62('0x25')&&typeof _0x1324d7[_0xeb62('0x26')]==='undefined';var _0x38c5e4=_0x39b138[_0xeb62('0x27')];var _0x332396=_0x27fd84?0x0:_0x1324d7[_0xeb62('0x24')];var _0x425817=_0x27fd84?_0x39b138[_0xeb62('0x27')]:_0x1324d7[_0xeb62('0x24')]+_0x1324d7['limit'];var _0x599d0b;if(_0x425817>=_0x38c5e4){_0x425817=_0x38c5e4;_0x599d0b=0xc8;}else{_0x599d0b=0xce;}_0x1fb460[_0xeb62('0x22')](_0x599d0b);return _0x1fb460[_0xeb62('0x28')](_0xeb62('0x29'),_0x332396+'-'+_0x425817+'/'+_0x38c5e4)[_0xeb62('0x23')](_0x39b138);}return null;};}function patchUpdates(_0x122b15){return function(_0x4cafcf){try{jsonpatch['apply'](_0x4cafcf,_0x122b15,!![]);}catch(_0x4664ce){return BPromise[_0xeb62('0x2a')](_0x4664ce);}return _0x4cafcf[_0xeb62('0x2b')]();};}function saveUpdates(_0x395b70,_0x55a169){return function(_0x4e92f5){if(_0x4e92f5){return _0x4e92f5[_0xeb62('0x2c')](_0x395b70)['then'](function(_0x448327){return _0x448327;});}return null;};}function removeEntity(_0x4b0f46,_0xfe3e16){return function(_0x516a72){if(_0x516a72){return _0x516a72[_0xeb62('0x2d')]()[_0xeb62('0x2e')](function(){var _0x46d1bb=_0x516a72['get']({'plain':!![]});var _0x3ef784=_0xeb62('0x2f');return db[_0xeb62('0x30')][_0xeb62('0x2d')]({'where':{'type':_0x3ef784,'resourceId':_0x46d1bb['id']}})[_0xeb62('0x2e')](function(){return _0x516a72;});})[_0xeb62('0x2e')](function(){_0x4b0f46['status'](0xcc)[_0xeb62('0x21')]();});}};}function handleEntityNotFound(_0x1616ee,_0x57169a){return function(_0x157474){if(!_0x157474){_0x1616ee[_0xeb62('0x20')](0x194);}return _0x157474;};}function handleError(_0x2c967c,_0x2c308c){_0x2c308c=_0x2c308c||0x1f4;return function(_0x235448){logger['error'](_0x235448['stack']);if(_0x235448[_0xeb62('0x31')]){delete _0x235448[_0xeb62('0x31')];}_0x2c967c[_0xeb62('0x22')](_0x2c308c)[_0xeb62('0x32')](_0x235448);};}exports[_0xeb62('0x33')]=function(_0x2ad3ec,_0x1ae51e){var _0x4be25d={},_0x411062={},_0x47a94b={'count':0x0,'rows':[]};var _0x555db1=_[_0xeb62('0x34')](db[_0xeb62('0x35')]['rawAttributes'],function(_0x1ade38){return{'name':_0x1ade38['fieldName'],'type':_0x1ade38[_0xeb62('0x36')][_0xeb62('0x37')]};});_0x411062['model']=_[_0xeb62('0x34')](_0x555db1,_0xeb62('0x31'));_0x411062['query']=_[_0xeb62('0x38')](_0x2ad3ec[_0xeb62('0x39')]);_0x411062[_0xeb62('0x3a')]=_[_0xeb62('0x3b')](_0x411062['model'],_0x411062[_0xeb62('0x39')]);_0x4be25d[_0xeb62('0x3c')]=_['intersection'](_0x411062['model'],qs[_0xeb62('0x3d')](_0x2ad3ec[_0xeb62('0x39')]['fields']));_0x4be25d[_0xeb62('0x3c')]=_0x4be25d[_0xeb62('0x3c')][_0xeb62('0x3e')]?_0x4be25d[_0xeb62('0x3c')]:_0x411062[_0xeb62('0x3f')];if(!_0x2ad3ec[_0xeb62('0x39')][_0xeb62('0x40')]('nolimit')){_0x4be25d['limit']=qs[_0xeb62('0x26')](_0x2ad3ec[_0xeb62('0x39')][_0xeb62('0x26')]);_0x4be25d[_0xeb62('0x24')]=qs['offset'](_0x2ad3ec[_0xeb62('0x39')]['offset']);}_0x4be25d[_0xeb62('0x41')]=qs[_0xeb62('0x42')](_0x2ad3ec[_0xeb62('0x39')][_0xeb62('0x42')]);_0x4be25d[_0xeb62('0x43')]=qs[_0xeb62('0x3a')](_[_0xeb62('0x44')](_0x2ad3ec[_0xeb62('0x39')],_0x411062['filters']),_0x555db1);if(_0x2ad3ec[_0xeb62('0x39')][_0xeb62('0x45')]){_0x4be25d[_0xeb62('0x43')]=_[_0xeb62('0x46')](_0x4be25d['where'],{'$or':_['map'](_0x555db1,function(_0x46a560){if(_0x46a560[_0xeb62('0x36')]!=='VIRTUAL'){var _0x1f7036={};_0x1f7036[_0x46a560[_0xeb62('0x31')]]={'$like':'%'+_0x2ad3ec['query'][_0xeb62('0x45')]+'%'};return _0x1f7036;}})});}_0x4be25d=_['merge']({},_0x4be25d,_0x2ad3ec[_0xeb62('0x47')]);var _0x47b815={'where':_0x4be25d[_0xeb62('0x43')]};return db['VoicePrefix'][_0xeb62('0x27')](_0x47b815)[_0xeb62('0x2e')](function(_0x317f50){_0x47a94b['count']=_0x317f50;if(_0x2ad3ec['query'][_0xeb62('0x48')]){_0x4be25d[_0xeb62('0x49')]=[{'all':!![]}];}return db[_0xeb62('0x35')][_0xeb62('0x4a')](_0x4be25d);})[_0xeb62('0x2e')](function(_0x4afd5e){_0x47a94b[_0xeb62('0x4b')]=_0x4afd5e;return _0x47a94b;})['then'](respondWithFilteredResult(_0x1ae51e,_0x4be25d))[_0xeb62('0x4c')](handleError(_0x1ae51e,null));};exports['show']=function(_0xeeced2,_0x4d2f80){var _0x26c77d={'raw':![],'where':{'id':_0xeeced2[_0xeb62('0x4d')]['id']}},_0x4dbcac={};_0x4dbcac[_0xeb62('0x3f')]=_[_0xeb62('0x38')](db[_0xeb62('0x35')][_0xeb62('0x4e')]);_0x4dbcac[_0xeb62('0x39')]=_['keys'](_0xeeced2[_0xeb62('0x39')]);_0x4dbcac[_0xeb62('0x3a')]=_['intersection'](_0x4dbcac['model'],_0x4dbcac['query']);_0x26c77d['attributes']=_[_0xeb62('0x3b')](_0x4dbcac[_0xeb62('0x3f')],qs['fields'](_0xeeced2[_0xeb62('0x39')][_0xeb62('0x3d')]));_0x26c77d[_0xeb62('0x3c')]=_0x26c77d[_0xeb62('0x3c')][_0xeb62('0x3e')]?_0x26c77d['attributes']:_0x4dbcac[_0xeb62('0x3f')];if(_0xeeced2['query'][_0xeb62('0x48')]){_0x26c77d[_0xeb62('0x49')]=[{'all':!![]}];}_0x26c77d=_[_0xeb62('0x46')]({},_0x26c77d,_0xeeced2[_0xeb62('0x47')]);return db[_0xeb62('0x35')][_0xeb62('0x4f')](_0x26c77d)[_0xeb62('0x2e')](handleEntityNotFound(_0x4d2f80,null))[_0xeb62('0x2e')](respondWithResult(_0x4d2f80,null))[_0xeb62('0x4c')](handleError(_0x4d2f80,null));};exports[_0xeb62('0x2d')]=function(_0xe13846,_0x13e102){return db['VoicePrefix'][_0xeb62('0x4f')]({'where':{'id':_0xe13846['params']['id']}})['then'](handleEntityNotFound(_0x13e102,null))[_0xeb62('0x2e')](removeEntity(_0x13e102,null))[_0xeb62('0x4c')](handleError(_0x13e102,null));};exports['describe']=function(_0x373505,_0x462760){return db['VoicePrefix'][_0xeb62('0x50')]()[_0xeb62('0x2e')](respondWithResult(_0x462760,null))[_0xeb62('0x4c')](handleError(_0x462760,null));};exports[_0xeb62('0x51')]=function(_0xe71e83,_0x1e6238){var _0x351027;return db[_0xeb62('0x52')]['transaction'](function(_0x3e2be9){return db['VoicePrefix'][_0xeb62('0x51')](_0xe71e83[_0xeb62('0x53')],{'transaction':_0x3e2be9})[_0xeb62('0x2e')](function(_0x289af0){_0x351027=_0x289af0[_0xeb62('0x54')]({'plain':!![]});return db[_0xeb62('0x55')][_0xeb62('0x4f')]({'where':{'id':_0x351027[_0xeb62('0x56')]},'raw':!![]})['then'](function(_0x4d31a1){return createVoicePrefixExtensions(_0x351027,_0x4d31a1,_0x3e2be9);});});})['then'](function(){var _0x5033eb=_0xe71e83[_0xeb62('0x57')]['get']({'plain':!![]});if(!_0x5033eb)throw new Error(_0xeb62('0x58'));if(_0x5033eb['role']===_0xeb62('0x57')){var _0x342768=_0x351027;return db[_0xeb62('0x59')]['find']({'where':{'name':_0xeb62('0x2f'),'userProfileId':_0x5033eb[_0xeb62('0x5a')]},'raw':!![]})['then'](function(_0x35982a){if(_0x35982a&&_0x35982a[_0xeb62('0x5b')]===0x0){return db[_0xeb62('0x30')][_0xeb62('0x51')]({'name':_0x342768['name'],'resourceId':_0x342768['id'],'type':_0x35982a[_0xeb62('0x31')],'sectionId':_0x35982a['id']},{})[_0xeb62('0x2e')](function(){return _0x351027;});}else{return _0x351027;}})['catch'](function(_0x2eba52){logger[_0xeb62('0x5c')](_0xeb62('0x5d'),_0x2eba52);throw _0x2eba52;});}return _0x351027;})[_0xeb62('0x2e')](respondWithResult(_0x1e6238,null))[_0xeb62('0x4c')](handleError(_0x1e6238,null));};function Extension(_0x46da69,_0x3e55bf,_0x1b354d,_0x222d0c){this[_0xeb62('0x5e')]=_0xeb62('0x5f');this[_0xeb62('0x60')]=_0x46da69;this[_0xeb62('0x61')]=_0x1b354d;this[_0xeb62('0x36')]=_0xeb62('0x62');this[_0xeb62('0x63')]='Voice\x20Prefix\x20Extension';this['priority']=_0x3e55bf;this['appdata']=_0x222d0c;}function createVoicePrefixExtensions(_0x5b28ec,_0x279b83,_0x5f363d){return new BPromise(function(_0x10cc40,_0x136d81){var _0x5b8c4=new Extension(formatPrefixName(_0x5b28ec[_0xeb62('0x64')]),0x1,_0xeb62('0x65'),_0xeb62('0x66'));_0x5b8c4[_0xeb62('0x67')]=_0x5b28ec['id'];return db[_0xeb62('0x55')][_0xeb62('0x51')](_0x5b8c4,{'transaction':_0x5f363d})[_0xeb62('0x2e')](function(_0x52dfbd){var _0x113302=_0x52dfbd[_0xeb62('0x54')]({'plain':!![]});var _0x42e992=_[_0xeb62('0x34')](addVoicePrefixExtensions(_0x5b28ec,_0x279b83),function(_0x4aba1f){_0x4aba1f[_0xeb62('0x56')]=_0x113302['id'];_0x4aba1f[_0xeb62('0x67')]=_0x5b28ec['id'];return _0x4aba1f;});return db[_0xeb62('0x55')][_0xeb62('0x68')](_0x42e992,{'transaction':_0x5f363d})[_0xeb62('0x2e')](function(_0x1679a7){if(!_0x1679a7){return _0x136d81(_0xeb62('0x69'));}else{return _0x10cc40(_0x1679a7);}})[_0xeb62('0x4c')](function(_0x2e1fb8){return _0x136d81(_0x2e1fb8);});});;});};function addVoicePrefixExtensions(_0x2b788e,_0x1d8675){var _0x510275=[];var _0x110224=formatPrefixName(_0x2b788e[_0xeb62('0x64')]);_0x510275[_0xeb62('0x6a')](new Extension(_0x110224,0x2,_0xeb62('0x6b'),_0xeb62('0x6c')+_0x2b788e[_0xeb62('0x31')]));if(_0x2b788e[_0xeb62('0x6d')]){_0x510275[_0xeb62('0x6a')](new Extension(_0x110224,0x3,_0xeb62('0x6b'),_0xeb62('0x6e')+_0x2b788e['callerIdAll']));}else{_0x510275[_0xeb62('0x6a')](new Extension(_0x110224,0x3,_0xeb62('0x65'),_0xeb62('0x6f')));}_0x510275[_0xeb62('0x6a')](new Extension(_0x110224,0x4,'goto',_0x1d8675[_0xeb62('0x5e')]+','+_0xeb62('0x70')+(0x8+_0x2b788e[_0xeb62('0x31')][_0xeb62('0x3e')])+'}'+','+0x1));return _0x510275;}function formatPrefixName(_0xc81d4c){var _0x32642f='_';for(var _0x48488c=0x0;_0x48488c<_0xc81d4c[_0xeb62('0x3e')];_0x48488c++){if(_0xc81d4c[_0xeb62('0x71')](_0x48488c)=='-'){_0x32642f+=_0xc81d4c[_0xeb62('0x71')](_0x48488c);}else{_0x32642f+='['+_0xc81d4c[_0xeb62('0x71')](_0x48488c)+']';}}_0x32642f+='.';return _0x32642f;}exports[_0xeb62('0x2c')]=function(_0x28d0ff,_0x2e4502,_0x313d33){var _0x233715=_0x28d0ff[_0xeb62('0x53')];_0x233715[_0xeb62('0x64')]=_0xeb62('0x72')+_0x233715[_0xeb62('0x31')]+'-';return db[_0xeb62('0x52')][_0xeb62('0x73')](function(_0x2bbbff){return db['VoicePrefix'][_0xeb62('0x2c')](_0x233715,{'where':{'id':_0x233715['id']},'transaction':_0x2bbbff})['then'](function(){return db[_0xeb62('0x55')][_0xeb62('0x2d')]({'where':{'VoicePrefixId':_0x233715['id']},'transaction':_0x2bbbff})['then'](function(){return db[_0xeb62('0x55')][_0xeb62('0x4f')]({'where':{'id':_0x233715[_0xeb62('0x56')]},'raw':!![]})[_0xeb62('0x2e')](function(_0x206e77){return createVoicePrefixExtensions(_0x233715,_0x206e77,_0x2bbbff);});});});})[_0xeb62('0x2e')](function(){return db[_0xeb62('0x35')][_0xeb62('0x74')](_0x233715['id']);})[_0xeb62('0x2e')](respondWithResult(_0x2e4502,null))[_0xeb62('0x4c')](handleError(_0x2e4502,null));};exports[_0xeb62('0x75')]=function(_0x146174,_0x910940,_0x4c6b69){return db[_0xeb62('0x35')][_0xeb62('0x4f')]({'where':{'id':_0x146174['params']['id']}})[_0xeb62('0x2e')](handleEntityNotFound(_0x910940,null))['then'](function(_0x32679a){if(_0x32679a){return _0x32679a[_0xeb62('0x75')](_0x146174[_0xeb62('0x53')][_0xeb62('0x76')],_[_0xeb62('0x77')](_0x146174[_0xeb62('0x53')],['ids','id'])||{})[_0xeb62('0x78')](function(_0x4fc07f){for(var _0x42ee4d=0x0;_0x42ee4d<_0x146174[_0xeb62('0x53')][_0xeb62('0x76')][_0xeb62('0x3e')];_0x42ee4d+=0x1){socket[_0xeb62('0x79')]('userVoicePrefix:save',{'UserId':Number(_0x146174[_0xeb62('0x53')][_0xeb62('0x76')][_0x42ee4d]),'VoicePrefixId':Number(_0x146174[_0xeb62('0x4d')]['id'])});}return _0x4fc07f;});}})['then'](respondWithResult(_0x910940,null))[_0xeb62('0x4c')](handleError(_0x910940,null));};exports[_0xeb62('0x7a')]=function(_0x8a8ef3,_0x7ca547,_0x16c28d){return db[_0xeb62('0x35')]['find']({'where':{'id':_0x8a8ef3['params']['id']}})['then'](handleEntityNotFound(_0x7ca547,null))['then'](function(_0x5bf6f6){if(_0x5bf6f6){return _0x5bf6f6[_0xeb62('0x7a')](_0x8a8ef3[_0xeb62('0x39')][_0xeb62('0x76')])[_0xeb62('0x2e')](function(){if(_[_0xeb62('0x7b')](_0x8a8ef3[_0xeb62('0x39')][_0xeb62('0x76')])){for(var _0x1c01ae=0x0;_0x1c01ae<_0x8a8ef3[_0xeb62('0x39')][_0xeb62('0x76')][_0xeb62('0x3e')];_0x1c01ae+=0x1){socket[_0xeb62('0x79')]('userVoicePrefix:remove',{'UserId':Number(_0x8a8ef3[_0xeb62('0x39')][_0xeb62('0x76')][_0x1c01ae]),'VoicePrefixId':Number(_0x8a8ef3[_0xeb62('0x4d')]['id'])});}}else{socket[_0xeb62('0x79')](_0xeb62('0x7c'),{'UserId':Number(_0x8a8ef3[_0xeb62('0x39')][_0xeb62('0x76')]),'VoicePrefixId':Number(_0x8a8ef3[_0xeb62('0x4d')]['id'])});}});}})[_0xeb62('0x2e')](respondWithStatusCode(_0x7ca547,null))[_0xeb62('0x4c')](handleError(_0x7ca547,null));};exports[_0xeb62('0x7d')]=function(_0x17beef,_0x45b2a3,_0x42c384){var _0xfff29b={};var _0x1cbfab={};var _0x29648f;var _0x2f5f2f;return db['VoicePrefix'][_0xeb62('0x7e')]({'where':{'id':_0x17beef['params']['id']}})[_0xeb62('0x2e')](handleEntityNotFound(_0x45b2a3,null))[_0xeb62('0x2e')](function(_0x48dcf6){if(_0x48dcf6){_0x29648f=_0x48dcf6;_0x1cbfab[_0xeb62('0x3f')]=_['keys'](db['User'][_0xeb62('0x4e')]);_0x1cbfab[_0xeb62('0x39')]=_[_0xeb62('0x38')](_0x17beef[_0xeb62('0x39')]);_0x1cbfab['filters']=_[_0xeb62('0x3b')](_0x1cbfab[_0xeb62('0x3f')],_0x1cbfab['query']);_0xfff29b[_0xeb62('0x3c')]=_[_0xeb62('0x3b')](_0x1cbfab[_0xeb62('0x3f')],qs[_0xeb62('0x3d')](_0x17beef[_0xeb62('0x39')][_0xeb62('0x3d')]));_0xfff29b[_0xeb62('0x3c')]=_0xfff29b[_0xeb62('0x3c')]['length']?_0xfff29b[_0xeb62('0x3c')]:_0x1cbfab[_0xeb62('0x3f')];_0xfff29b['order']=qs[_0xeb62('0x42')](_0x17beef['query']['sort']);_0xfff29b[_0xeb62('0x43')]=qs[_0xeb62('0x3a')](_[_0xeb62('0x44')](_0x17beef[_0xeb62('0x39')],_0x1cbfab[_0xeb62('0x3a')]));if(_0x17beef['query'][_0xeb62('0x45')]){_0xfff29b[_0xeb62('0x43')]=_[_0xeb62('0x46')](_0xfff29b[_0xeb62('0x43')],{'$or':_[_0xeb62('0x34')](_0xfff29b[_0xeb62('0x3c')],function(_0x401ad1){var _0x50170b={};_0x50170b[_0x401ad1]={'$like':'%'+_0x17beef['query']['filter']+'%'};return _0x50170b;})});}_0xfff29b=_[_0xeb62('0x46')]({},_0xfff29b,_0x17beef[_0xeb62('0x47')]);return _0x29648f[_0xeb62('0x7d')](_0xfff29b);}})[_0xeb62('0x2e')](function(_0x599418){if(_0x599418){_0x2f5f2f=_0x599418[_0xeb62('0x3e')];if(!_0x17beef['query']['hasOwnProperty'](_0xeb62('0x7f'))){_0xfff29b[_0xeb62('0x26')]=qs['limit'](_0x17beef[_0xeb62('0x39')]['limit']);_0xfff29b[_0xeb62('0x24')]=qs[_0xeb62('0x24')](_0x17beef[_0xeb62('0x39')]['offset']);}return _0x29648f['getAgents'](_0xfff29b);}})[_0xeb62('0x2e')](function(_0x276e06){if(_0x276e06){return _0x276e06?{'count':_0x2f5f2f,'rows':_0x276e06}:null;}})[_0xeb62('0x2e')](respondWithResult(_0x45b2a3,null))['catch'](handleError(_0x45b2a3,null));};exports[_0xeb62('0x80')]=function(_0x162993,_0x3f5c93,_0x3b15ec){var _0xca3f0e={};var _0x2e4d99={};var _0x518655;var _0x4cd599;return db['VoicePrefix'][_0xeb62('0x7e')]({'where':{'id':_0x162993['params']['id']}})['then'](handleEntityNotFound(_0x3f5c93,null))[_0xeb62('0x2e')](function(_0x49d2c7){if(_0x49d2c7){_0x518655=_0x49d2c7;_0x2e4d99['model']=_['keys'](db[_0xeb62('0x81')]['rawAttributes']);_0x2e4d99[_0xeb62('0x39')]=_[_0xeb62('0x38')](_0x162993[_0xeb62('0x39')]);_0x2e4d99[_0xeb62('0x3a')]=_[_0xeb62('0x3b')](_0x2e4d99[_0xeb62('0x3f')],_0x2e4d99[_0xeb62('0x39')]);_0xca3f0e['attributes']=_['intersection'](_0x2e4d99[_0xeb62('0x3f')],qs[_0xeb62('0x3d')](_0x162993[_0xeb62('0x39')][_0xeb62('0x3d')]));_0xca3f0e[_0xeb62('0x3c')]=_0xca3f0e['attributes'][_0xeb62('0x3e')]?_0xca3f0e[_0xeb62('0x3c')]:_0x2e4d99[_0xeb62('0x3f')];_0xca3f0e['order']=qs[_0xeb62('0x42')](_0x162993['query'][_0xeb62('0x42')]);_0xca3f0e[_0xeb62('0x43')]=qs['filters'](_['pick'](_0x162993[_0xeb62('0x39')],_0x2e4d99[_0xeb62('0x3a')]));if(_0x162993[_0xeb62('0x39')][_0xeb62('0x45')]){_0xca3f0e['where']=_[_0xeb62('0x46')](_0xca3f0e[_0xeb62('0x43')],{'$or':_['map'](_0xca3f0e['attributes'],function(_0x12adf6){var _0x1b9569={};_0x1b9569[_0x12adf6]={'$like':'%'+_0x162993[_0xeb62('0x39')][_0xeb62('0x45')]+'%'};return _0x1b9569;})});}_0xca3f0e=_[_0xeb62('0x46')]({},_0xca3f0e,_0x162993[_0xeb62('0x47')]);return _0x518655[_0xeb62('0x80')](_0xca3f0e);}})[_0xeb62('0x2e')](function(_0x144bc8){if(_0x144bc8){_0x4cd599=_0x144bc8[_0xeb62('0x3e')];if(!_0x162993[_0xeb62('0x39')][_0xeb62('0x40')](_0xeb62('0x7f'))){_0xca3f0e[_0xeb62('0x26')]=qs[_0xeb62('0x26')](_0x162993[_0xeb62('0x39')]['limit']);_0xca3f0e[_0xeb62('0x24')]=qs[_0xeb62('0x24')](_0x162993[_0xeb62('0x39')][_0xeb62('0x24')]);}return _0x518655[_0xeb62('0x80')](_0xca3f0e);}})['then'](function(_0x54984f){if(_0x54984f){return _0x54984f?{'count':_0x4cd599,'rows':_0x54984f}:null;}})[_0xeb62('0x2e')](respondWithResult(_0x3f5c93,null))[_0xeb62('0x4c')](handleError(_0x3f5c93,null));};exports[_0xeb62('0x82')]=function(_0x3d957d,_0x5af4d7,_0x3a0b12){var _0x5f2c1e=_0x3d957d[_0xeb62('0x53')][_0xeb62('0x76')];var _0x3409db;return db[_0xeb62('0x81')][_0xeb62('0x4a')]({'where':{'id':_0x5f2c1e},'attributes':['id'],'include':[{'model':db['User'],'as':_0xeb62('0x83'),'attributes':['id',_0xeb62('0x31'),'online',_0xeb62('0x84'),'interface'],'raw':!![]}]})[_0xeb62('0x2e')](function(_0x43107d){if(_0x43107d){_0x3409db=_0x43107d;var _0x2e503b=_[_0xeb62('0x85')](_0x43107d,function(_0x45a197){var _0x3394e6=_0x45a197['get']({'plain':!![]});return _0x3394e6['Agents'];});return db[_0xeb62('0x35')][_0xeb62('0x4f')]({'where':{'id':_0x3d957d[_0xeb62('0x4d')]['id']}})[_0xeb62('0x2e')](function(_0x582217){return db['sequelize'][_0xeb62('0x73')](function(_0x527de3){return _0x582217[_0xeb62('0x82')](_0x5f2c1e,{'transaction':_0x527de3})[_0xeb62('0x2e')](function(){return BPromise[_0xeb62('0x86')](_0x3409db,function(_0x5e43f0){return db[_0xeb62('0x87')][_0xeb62('0x88')]({'TeamId':_0x5e43f0['id'],'VoicePrefixId':_0x3d957d[_0xeb62('0x4d')]['id']},{'transaction':_0x527de3});});})[_0xeb62('0x2e')](function(){return BPromise[_0xeb62('0x86')](_0x2e503b,function(_0x10731b){return db[_0xeb62('0x89')][_0xeb62('0x8a')]({'where':{'UserId':_0x10731b['id'],'VoicePrefixId':_0x3d957d['params']['id']},'transaction':_0x527de3});});})[_0xeb62('0x2e')](function(){_0x2e503b[_0xeb62('0x8b')](function(_0x35d372){socket[_0xeb62('0x79')]('userVoicePrefix:save',{'UserId':_0x35d372['id'],'VoicePrefixId':_0x582217['id']});});});});});}})[_0xeb62('0x2e')](respondWithStatusCode(_0x5af4d7,null))[_0xeb62('0x4c')](handleError(_0x5af4d7,null));};exports[_0xeb62('0x8c')]=function(_0x146c7e,_0x24c285,_0x59bb00){return db[_0xeb62('0x81')][_0xeb62('0x4a')]({'where':{'id':_0x146c7e[_0xeb62('0x39')][_0xeb62('0x76')]},'attributes':['id'],'include':[{'model':db[_0xeb62('0x8d')],'as':_0xeb62('0x83'),'attributes':['id'],'raw':!![]}]})[_0xeb62('0x2e')](handleEntityNotFound(_0x24c285,null))[_0xeb62('0x2e')](function(_0x30625f){var _0x94d0c9=_['map'](_0x30625f,'id');var _0x3ae667=[];var _0x3338ba=[];var _0x50cf9b=squel['select']();_0x50cf9b[_0xeb62('0x8e')](_0xeb62('0x8f'))[_0xeb62('0x90')](_0xeb62('0x91'),'tq')[_0xeb62('0x92')](_0xeb62('0x93'),'ut',_0xeb62('0x94'))[_0xeb62('0x43')](_0xeb62('0x95'),_0x146c7e['params']['id']);for(var _0x535e7a=0x0;_0x535e7a<_0x30625f[_0xeb62('0x3e')];_0x535e7a+=0x1){let _0x43daef=_0x30625f[_0x535e7a];for(var _0x58ffb2=0x0;_0x58ffb2<_0x43daef['Agents'][_0xeb62('0x3e')];_0x58ffb2+=0x1){let _0x341bd8=_0x43daef[_0xeb62('0x83')][_0x58ffb2];var _0x55ef9d=_0x50cf9b['clone']();_0x55ef9d[_0xeb62('0x43')]('ut.UserId\x20=\x20?',_0x341bd8['id']);_0x3338ba[_0xeb62('0x6a')](db[_0xeb62('0x52')][_0xeb62('0x39')](_0x55ef9d['toString'](),{'type':db['sequelize']['QueryTypes'][_0xeb62('0x96')]})[_0xeb62('0x2e')](function(_0x3517db){if(_0x3517db[_0xeb62('0x3e')]===0x1){return _0x341bd8['id'];}else{var _0x5bd3b6=_[_0xeb62('0x97')](_[_0xeb62('0x34')](_0x3517db,_0xeb62('0x98')),function(_0x22eb23){return _[_0xeb62('0x99')](_0x94d0c9,_0x22eb23);});if(_0x5bd3b6){return _0x341bd8['id'];}}}));}}return BPromise[_0xeb62('0x9a')](_0x3338ba)[_0xeb62('0x2e')](function(_0x394573){_0x3ae667=_(_0x3ae667)['union'](_0x394573)[_0xeb62('0x9b')]()[_0xeb62('0x9c')]();return db[_0xeb62('0x35')][_0xeb62('0x4f')]({'where':{'id':_0x146c7e['params']['id']}})[_0xeb62('0x2e')](function(_0x1f84f0){return db['sequelize'][_0xeb62('0x73')](function(_0x26b456){return _0x1f84f0[_0xeb62('0x8c')](_0x146c7e[_0xeb62('0x39')][_0xeb62('0x76')],{'transaction':_0x26b456})[_0xeb62('0x2e')](function(){if(!_[_0xeb62('0x9d')](_0x3ae667)){return _0x1f84f0['removeAgents'](_0x3ae667,{'transaction':_0x26b456});}})[_0xeb62('0x2e')](function(){_0x3ae667['forEach'](function(_0x3578a9){socket[_0xeb62('0x79')](_0xeb62('0x7c'),{'UserId':_0x3578a9,'VoicePrefixId':_0x1f84f0['id']});});});});});});})['then'](respondWithStatusCode(_0x24c285,null))['catch'](handleError(_0x24c285,null));}; \ No newline at end of file +var _0x1a85=['UserProfileSection','userProfileId','autoAssociation','from-sip','exten','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','push','CDR(prefix)=','callerIdAll','NoOp','No\x20callerid\x20available','goto','context','${EXTEN:','charAt','system-','findById','addAgents','omit','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','order','getTeams','Team','Agents','online','voicePause','addTeams','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','removeTeams','select','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','includes','all','compact','value','isEmpty','forEach','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','get','VoicePrefixes','UserProfileResource','sendStatus','error','stack','name','index','map','VoicePrefix','rawAttributes','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','describe','create','sequelize','transaction','body','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x2facfb,_0x3075af){var _0xe455f6=function(_0x4440e8){while(--_0x4440e8){_0x2facfb['push'](_0x2facfb['shift']());}};_0xe455f6(++_0x3075af);}(_0x1a85,0x178));var _0x51a8=function(_0x366378,_0x33a2fa){_0x366378=_0x366378-0x0;var _0x19bbf0=_0x1a85[_0x366378];return _0x19bbf0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x51a8('0x0'));var jsonpatch=require(_0x51a8('0x1'));var rp=require(_0x51a8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x51a8('0x3'));var util=require(_0x51a8('0x4'));var path=require(_0x51a8('0x5'));var sox=require('sox');var csv=require(_0x51a8('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x51a8('0x7'));var _=require('lodash');var squel=require(_0x51a8('0x8'));var crypto=require(_0x51a8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x51a8('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x51a8('0xb'));var Redis=require(_0x51a8('0xc'));var authService=require(_0x51a8('0xd'));var qs=require(_0x51a8('0xe'));var as=require(_0x51a8('0xf'));var hardwareService=require(_0x51a8('0x10'));var logger=require(_0x51a8('0x11'))(_0x51a8('0x12'));var utils=require(_0x51a8('0x13'));var config=require(_0x51a8('0x14'));var licenseUtil=require(_0x51a8('0x15'));var db=require(_0x51a8('0x16'))['db'];config[_0x51a8('0x17')]=_[_0x51a8('0x18')](config[_0x51a8('0x17')],{'host':_0x51a8('0x19'),'port':0x18eb});var socket=require(_0x51a8('0x1a'))(new Redis(config['redis']));require(_0x51a8('0x1b'))[_0x51a8('0x1c')](socket);function respondWithStatusCode(_0xaec066,_0x50d992){_0x50d992=_0x50d992||0xcc;return function(_0xf4eb6e){if(_0xf4eb6e){return _0xaec066['sendStatus'](_0x50d992);}return _0xaec066[_0x51a8('0x1d')](_0x50d992)[_0x51a8('0x1e')]();};}function respondWithResult(_0x39cd45,_0x2b0521){_0x2b0521=_0x2b0521||0xc8;return function(_0x3fbd02){if(_0x3fbd02){return _0x39cd45[_0x51a8('0x1d')](_0x2b0521)[_0x51a8('0x1f')](_0x3fbd02);}};}function respondWithFilteredResult(_0x516abc,_0x1c2f25){return function(_0x45a433){if(_0x45a433){var _0xd52230=typeof _0x1c2f25[_0x51a8('0x20')]===_0x51a8('0x21')&&typeof _0x1c2f25[_0x51a8('0x22')]==='undefined';var _0x1df8c2=_0x45a433[_0x51a8('0x23')];var _0x2217ce=_0xd52230?0x0:_0x1c2f25[_0x51a8('0x20')];var _0x2a4c4c=_0xd52230?_0x45a433[_0x51a8('0x23')]:_0x1c2f25[_0x51a8('0x20')]+_0x1c2f25[_0x51a8('0x22')];var _0x5ac1c0;if(_0x2a4c4c>=_0x1df8c2){_0x2a4c4c=_0x1df8c2;_0x5ac1c0=0xc8;}else{_0x5ac1c0=0xce;}_0x516abc[_0x51a8('0x1d')](_0x5ac1c0);return _0x516abc['set'](_0x51a8('0x24'),_0x2217ce+'-'+_0x2a4c4c+'/'+_0x1df8c2)[_0x51a8('0x1f')](_0x45a433);}return null;};}function patchUpdates(_0x8bda40){return function(_0x3759d6){try{jsonpatch['apply'](_0x3759d6,_0x8bda40,!![]);}catch(_0xae3588){return BPromise['reject'](_0xae3588);}return _0x3759d6['save']();};}function saveUpdates(_0x23d26a,_0x52e503){return function(_0x384d25){if(_0x384d25){return _0x384d25[_0x51a8('0x25')](_0x23d26a)[_0x51a8('0x26')](function(_0x18e2f3){return _0x18e2f3;});}return null;};}function removeEntity(_0x157554,_0x2f2f05){return function(_0x291ed6){if(_0x291ed6){return _0x291ed6[_0x51a8('0x27')]()['then'](function(){var _0x273ce2=_0x291ed6[_0x51a8('0x28')]({'plain':!![]});var _0xca5746=_0x51a8('0x29');return db[_0x51a8('0x2a')][_0x51a8('0x27')]({'where':{'type':_0xca5746,'resourceId':_0x273ce2['id']}})[_0x51a8('0x26')](function(){return _0x291ed6;});})[_0x51a8('0x26')](function(){_0x157554[_0x51a8('0x1d')](0xcc)[_0x51a8('0x1e')]();});}};}function handleEntityNotFound(_0x20c6b5,_0x347a02){return function(_0x4a1548){if(!_0x4a1548){_0x20c6b5[_0x51a8('0x2b')](0x194);}return _0x4a1548;};}function handleError(_0x58cba0,_0x276424){_0x276424=_0x276424||0x1f4;return function(_0x3bc19a){logger[_0x51a8('0x2c')](_0x3bc19a[_0x51a8('0x2d')]);if(_0x3bc19a[_0x51a8('0x2e')]){delete _0x3bc19a['name'];}_0x58cba0[_0x51a8('0x1d')](_0x276424)['send'](_0x3bc19a);};}exports[_0x51a8('0x2f')]=function(_0x24b39a,_0x253a59){var _0x4b19c8={},_0x2080a1={},_0x499a43={'count':0x0,'rows':[]};var _0x25a858=_[_0x51a8('0x30')](db[_0x51a8('0x31')][_0x51a8('0x32')],function(_0x193e0f){return{'name':_0x193e0f['fieldName'],'type':_0x193e0f[_0x51a8('0x33')]['key']};});_0x2080a1[_0x51a8('0x34')]=_[_0x51a8('0x30')](_0x25a858,_0x51a8('0x2e'));_0x2080a1['query']=_[_0x51a8('0x35')](_0x24b39a[_0x51a8('0x36')]);_0x2080a1[_0x51a8('0x37')]=_[_0x51a8('0x38')](_0x2080a1[_0x51a8('0x34')],_0x2080a1['query']);_0x4b19c8['attributes']=_['intersection'](_0x2080a1[_0x51a8('0x34')],qs[_0x51a8('0x39')](_0x24b39a['query'][_0x51a8('0x39')]));_0x4b19c8['attributes']=_0x4b19c8[_0x51a8('0x3a')][_0x51a8('0x3b')]?_0x4b19c8[_0x51a8('0x3a')]:_0x2080a1[_0x51a8('0x34')];if(!_0x24b39a[_0x51a8('0x36')][_0x51a8('0x3c')]('nolimit')){_0x4b19c8['limit']=qs[_0x51a8('0x22')](_0x24b39a['query']['limit']);_0x4b19c8['offset']=qs[_0x51a8('0x20')](_0x24b39a[_0x51a8('0x36')][_0x51a8('0x20')]);}_0x4b19c8['order']=qs[_0x51a8('0x3d')](_0x24b39a[_0x51a8('0x36')][_0x51a8('0x3d')]);_0x4b19c8[_0x51a8('0x3e')]=qs['filters'](_[_0x51a8('0x3f')](_0x24b39a[_0x51a8('0x36')],_0x2080a1[_0x51a8('0x37')]),_0x25a858);if(_0x24b39a['query'][_0x51a8('0x40')]){_0x4b19c8['where']=_[_0x51a8('0x41')](_0x4b19c8[_0x51a8('0x3e')],{'$or':_[_0x51a8('0x30')](_0x25a858,function(_0x37d50b){if(_0x37d50b['type']!==_0x51a8('0x42')){var _0x3da2cf={};_0x3da2cf[_0x37d50b[_0x51a8('0x2e')]]={'$like':'%'+_0x24b39a[_0x51a8('0x36')][_0x51a8('0x40')]+'%'};return _0x3da2cf;}})});}_0x4b19c8=_[_0x51a8('0x41')]({},_0x4b19c8,_0x24b39a[_0x51a8('0x43')]);var _0x1cdec6={'where':_0x4b19c8[_0x51a8('0x3e')]};return db['VoicePrefix'][_0x51a8('0x23')](_0x1cdec6)[_0x51a8('0x26')](function(_0x4c7c67){_0x499a43['count']=_0x4c7c67;if(_0x24b39a[_0x51a8('0x36')][_0x51a8('0x44')]){_0x4b19c8[_0x51a8('0x45')]=[{'all':!![]}];}return db[_0x51a8('0x31')][_0x51a8('0x46')](_0x4b19c8);})[_0x51a8('0x26')](function(_0x28f5b3){_0x499a43[_0x51a8('0x47')]=_0x28f5b3;return _0x499a43;})[_0x51a8('0x26')](respondWithFilteredResult(_0x253a59,_0x4b19c8))[_0x51a8('0x48')](handleError(_0x253a59,null));};exports['show']=function(_0x416988,_0x218ae0){var _0x190d52={'raw':![],'where':{'id':_0x416988[_0x51a8('0x49')]['id']}},_0x444b0b={};_0x444b0b[_0x51a8('0x34')]=_['keys'](db[_0x51a8('0x31')]['rawAttributes']);_0x444b0b[_0x51a8('0x36')]=_[_0x51a8('0x35')](_0x416988[_0x51a8('0x36')]);_0x444b0b[_0x51a8('0x37')]=_[_0x51a8('0x38')](_0x444b0b['model'],_0x444b0b['query']);_0x190d52[_0x51a8('0x3a')]=_[_0x51a8('0x38')](_0x444b0b[_0x51a8('0x34')],qs[_0x51a8('0x39')](_0x416988[_0x51a8('0x36')]['fields']));_0x190d52['attributes']=_0x190d52[_0x51a8('0x3a')][_0x51a8('0x3b')]?_0x190d52[_0x51a8('0x3a')]:_0x444b0b[_0x51a8('0x34')];if(_0x416988[_0x51a8('0x36')][_0x51a8('0x44')]){_0x190d52[_0x51a8('0x45')]=[{'all':!![]}];}_0x190d52=_[_0x51a8('0x41')]({},_0x190d52,_0x416988[_0x51a8('0x43')]);return db['VoicePrefix']['find'](_0x190d52)['then'](handleEntityNotFound(_0x218ae0,null))[_0x51a8('0x26')](respondWithResult(_0x218ae0,null))[_0x51a8('0x48')](handleError(_0x218ae0,null));};exports[_0x51a8('0x27')]=function(_0x5259f3,_0x3bd492){return db[_0x51a8('0x31')]['find']({'where':{'id':_0x5259f3[_0x51a8('0x49')]['id']}})['then'](handleEntityNotFound(_0x3bd492,null))['then'](removeEntity(_0x3bd492,null))[_0x51a8('0x48')](handleError(_0x3bd492,null));};exports[_0x51a8('0x4a')]=function(_0x41dd1f,_0x56d7f1){return db['VoicePrefix'][_0x51a8('0x4a')]()['then'](respondWithResult(_0x56d7f1,null))[_0x51a8('0x48')](handleError(_0x56d7f1,null));};exports[_0x51a8('0x4b')]=function(_0x3623d4,_0x1ace5b){var _0xee9bee;return db[_0x51a8('0x4c')][_0x51a8('0x4d')](function(_0x406a87){return db[_0x51a8('0x31')]['create'](_0x3623d4[_0x51a8('0x4e')],{'transaction':_0x406a87})[_0x51a8('0x26')](function(_0x823d14){_0xee9bee=_0x823d14[_0x51a8('0x28')]({'plain':!![]});return db['VoiceExtension'][_0x51a8('0x4f')]({'where':{'id':_0xee9bee['VoiceExtensionId']},'raw':!![]})[_0x51a8('0x26')](function(_0x252c20){return createVoicePrefixExtensions(_0xee9bee,_0x252c20,_0x406a87);});});})['then'](function(){var _0x56dd7a=_0x3623d4[_0x51a8('0x50')][_0x51a8('0x28')]({'plain':!![]});if(!_0x56dd7a)throw new Error(_0x51a8('0x51'));if(_0x56dd7a[_0x51a8('0x52')]===_0x51a8('0x50')){var _0x52f60f=_0xee9bee;return db[_0x51a8('0x53')][_0x51a8('0x4f')]({'where':{'name':_0x51a8('0x29'),'userProfileId':_0x56dd7a[_0x51a8('0x54')]},'raw':!![]})[_0x51a8('0x26')](function(_0x5d44fe){if(_0x5d44fe&&_0x5d44fe[_0x51a8('0x55')]===0x0){return db[_0x51a8('0x2a')][_0x51a8('0x4b')]({'name':_0x52f60f[_0x51a8('0x2e')],'resourceId':_0x52f60f['id'],'type':_0x5d44fe[_0x51a8('0x2e')],'sectionId':_0x5d44fe['id']},{})[_0x51a8('0x26')](function(){return _0xee9bee;});}else{return _0xee9bee;}})['catch'](function(_0x4cef4e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4cef4e);throw _0x4cef4e;});}return _0xee9bee;})[_0x51a8('0x26')](respondWithResult(_0x1ace5b,null))[_0x51a8('0x48')](handleError(_0x1ace5b,null));};function Extension(_0x51f9f7,_0x7ac0ae,_0x56d3d7,_0x41cc00){this['context']=_0x51a8('0x56');this[_0x51a8('0x57')]=_0x51f9f7;this['app']=_0x56d3d7;this['type']='system';this[_0x51a8('0x58')]=_0x51a8('0x59');this[_0x51a8('0x5a')]=_0x7ac0ae;this[_0x51a8('0x5b')]=_0x41cc00;}function createVoicePrefixExtensions(_0x149047,_0x21c8e0,_0x3fd347){return new BPromise(function(_0x259153,_0x494e11){var _0x43c2ad=new Extension(formatPrefixName(_0x149047[_0x51a8('0x5c')]),0x1,'NoOp',_0x51a8('0x5d'));_0x43c2ad[_0x51a8('0x5e')]=_0x149047['id'];return db[_0x51a8('0x5f')][_0x51a8('0x4b')](_0x43c2ad,{'transaction':_0x3fd347})[_0x51a8('0x26')](function(_0x2a5684){var _0x4f6d5f=_0x2a5684['get']({'plain':!![]});var _0x31a464=_['map'](addVoicePrefixExtensions(_0x149047,_0x21c8e0),function(_0x4ca01a){_0x4ca01a['VoiceExtensionId']=_0x4f6d5f['id'];_0x4ca01a['VoicePrefixId']=_0x149047['id'];return _0x4ca01a;});return db['VoiceExtension'][_0x51a8('0x60')](_0x31a464,{'transaction':_0x3fd347})['then'](function(_0x1477af){if(!_0x1477af){return _0x494e11(_0x51a8('0x61'));}else{return _0x259153(_0x1477af);}})[_0x51a8('0x48')](function(_0x2d3d37){return _0x494e11(_0x2d3d37);});});;});};function addVoicePrefixExtensions(_0xf05c1a,_0x2d8b9b){var _0x28c539=[];var _0xdafa01=formatPrefixName(_0xf05c1a[_0x51a8('0x5c')]);_0x28c539[_0x51a8('0x62')](new Extension(_0xdafa01,0x2,'Set',_0x51a8('0x63')+_0xf05c1a[_0x51a8('0x2e')]));if(_0xf05c1a[_0x51a8('0x64')]){_0x28c539['push'](new Extension(_0xdafa01,0x3,'Set','PREFIX-CALLERIDALL='+_0xf05c1a[_0x51a8('0x64')]));}else{_0x28c539[_0x51a8('0x62')](new Extension(_0xdafa01,0x3,_0x51a8('0x65'),_0x51a8('0x66')));}_0x28c539[_0x51a8('0x62')](new Extension(_0xdafa01,0x4,_0x51a8('0x67'),_0x2d8b9b[_0x51a8('0x68')]+','+_0x51a8('0x69')+(0x8+_0xf05c1a[_0x51a8('0x2e')][_0x51a8('0x3b')])+'}'+','+0x1));return _0x28c539;}function formatPrefixName(_0x45aabc){var _0x3ba418='_';for(var _0x934ea9=0x0;_0x934ea9<_0x45aabc['length'];_0x934ea9++){if(_0x45aabc[_0x51a8('0x6a')](_0x934ea9)=='-'){_0x3ba418+=_0x45aabc[_0x51a8('0x6a')](_0x934ea9);}else{_0x3ba418+='['+_0x45aabc['charAt'](_0x934ea9)+']';}}_0x3ba418+='.';return _0x3ba418;}exports[_0x51a8('0x25')]=function(_0x5140b8,_0x4ac62e,_0x59c80f){var _0x2b4313=_0x5140b8[_0x51a8('0x4e')];_0x2b4313[_0x51a8('0x5c')]=_0x51a8('0x6b')+_0x2b4313[_0x51a8('0x2e')]+'-';return db[_0x51a8('0x4c')][_0x51a8('0x4d')](function(_0x5a37c1){return db['VoicePrefix']['update'](_0x2b4313,{'where':{'id':_0x2b4313['id']},'transaction':_0x5a37c1})[_0x51a8('0x26')](function(){return db[_0x51a8('0x5f')][_0x51a8('0x27')]({'where':{'VoicePrefixId':_0x2b4313['id']},'transaction':_0x5a37c1})[_0x51a8('0x26')](function(){return db[_0x51a8('0x5f')][_0x51a8('0x4f')]({'where':{'id':_0x2b4313['VoiceExtensionId']},'raw':!![]})[_0x51a8('0x26')](function(_0x481030){return createVoicePrefixExtensions(_0x2b4313,_0x481030,_0x5a37c1);});});});})[_0x51a8('0x26')](function(){return db[_0x51a8('0x31')][_0x51a8('0x6c')](_0x2b4313['id']);})[_0x51a8('0x26')](respondWithResult(_0x4ac62e,null))[_0x51a8('0x48')](handleError(_0x4ac62e,null));};exports[_0x51a8('0x6d')]=function(_0x895b42,_0xc751c3,_0x3540cd){return db[_0x51a8('0x31')][_0x51a8('0x4f')]({'where':{'id':_0x895b42['params']['id']}})['then'](handleEntityNotFound(_0xc751c3,null))[_0x51a8('0x26')](function(_0xf0c644){if(_0xf0c644){return _0xf0c644[_0x51a8('0x6d')](_0x895b42[_0x51a8('0x4e')]['ids'],_[_0x51a8('0x6e')](_0x895b42['body'],[_0x51a8('0x6f'),'id'])||{})[_0x51a8('0x70')](function(_0xbee86f){for(var _0x24fcc3=0x0;_0x24fcc3<_0x895b42[_0x51a8('0x4e')][_0x51a8('0x6f')][_0x51a8('0x3b')];_0x24fcc3+=0x1){socket[_0x51a8('0x71')](_0x51a8('0x72'),{'UserId':Number(_0x895b42['body'][_0x51a8('0x6f')][_0x24fcc3]),'VoicePrefixId':Number(_0x895b42[_0x51a8('0x49')]['id'])});}return _0xbee86f;});}})[_0x51a8('0x26')](respondWithResult(_0xc751c3,null))[_0x51a8('0x48')](handleError(_0xc751c3,null));};exports['removeAgents']=function(_0x529062,_0x1c1d2f,_0x4b517d){return db['VoicePrefix']['find']({'where':{'id':_0x529062[_0x51a8('0x49')]['id']}})['then'](handleEntityNotFound(_0x1c1d2f,null))['then'](function(_0x1325ca){if(_0x1325ca){return _0x1325ca[_0x51a8('0x73')](_0x529062[_0x51a8('0x36')]['ids'])[_0x51a8('0x26')](function(){if(_[_0x51a8('0x74')](_0x529062[_0x51a8('0x36')]['ids'])){for(var _0x3ac9c8=0x0;_0x3ac9c8<_0x529062[_0x51a8('0x36')][_0x51a8('0x6f')][_0x51a8('0x3b')];_0x3ac9c8+=0x1){socket[_0x51a8('0x71')](_0x51a8('0x75'),{'UserId':Number(_0x529062[_0x51a8('0x36')][_0x51a8('0x6f')][_0x3ac9c8]),'VoicePrefixId':Number(_0x529062[_0x51a8('0x49')]['id'])});}}else{socket['emit'](_0x51a8('0x75'),{'UserId':Number(_0x529062[_0x51a8('0x36')]['ids']),'VoicePrefixId':Number(_0x529062[_0x51a8('0x49')]['id'])});}});}})[_0x51a8('0x26')](respondWithStatusCode(_0x1c1d2f,null))['catch'](handleError(_0x1c1d2f,null));};exports[_0x51a8('0x76')]=function(_0x132ce5,_0x3fbdf1,_0x17fd0a){var _0x398fb2={};var _0x53cca9={};var _0x160861;var _0x1e7f04;return db[_0x51a8('0x31')][_0x51a8('0x77')]({'where':{'id':_0x132ce5['params']['id']}})[_0x51a8('0x26')](handleEntityNotFound(_0x3fbdf1,null))[_0x51a8('0x26')](function(_0x2a10ac){if(_0x2a10ac){_0x160861=_0x2a10ac;_0x53cca9[_0x51a8('0x34')]=_[_0x51a8('0x35')](db[_0x51a8('0x78')][_0x51a8('0x32')]);_0x53cca9[_0x51a8('0x36')]=_['keys'](_0x132ce5[_0x51a8('0x36')]);_0x53cca9[_0x51a8('0x37')]=_['intersection'](_0x53cca9[_0x51a8('0x34')],_0x53cca9[_0x51a8('0x36')]);_0x398fb2['attributes']=_[_0x51a8('0x38')](_0x53cca9['model'],qs['fields'](_0x132ce5[_0x51a8('0x36')][_0x51a8('0x39')]));_0x398fb2[_0x51a8('0x3a')]=_0x398fb2['attributes']['length']?_0x398fb2[_0x51a8('0x3a')]:_0x53cca9['model'];_0x398fb2[_0x51a8('0x79')]=qs[_0x51a8('0x3d')](_0x132ce5[_0x51a8('0x36')][_0x51a8('0x3d')]);_0x398fb2[_0x51a8('0x3e')]=qs[_0x51a8('0x37')](_[_0x51a8('0x3f')](_0x132ce5[_0x51a8('0x36')],_0x53cca9[_0x51a8('0x37')]));if(_0x132ce5[_0x51a8('0x36')][_0x51a8('0x40')]){_0x398fb2[_0x51a8('0x3e')]=_[_0x51a8('0x41')](_0x398fb2[_0x51a8('0x3e')],{'$or':_[_0x51a8('0x30')](_0x398fb2['attributes'],function(_0x48f746){var _0x31e7e3={};_0x31e7e3[_0x48f746]={'$like':'%'+_0x132ce5['query']['filter']+'%'};return _0x31e7e3;})});}_0x398fb2=_['merge']({},_0x398fb2,_0x132ce5[_0x51a8('0x43')]);return _0x160861[_0x51a8('0x76')](_0x398fb2);}})[_0x51a8('0x26')](function(_0x125a28){if(_0x125a28){_0x1e7f04=_0x125a28['length'];if(!_0x132ce5[_0x51a8('0x36')][_0x51a8('0x3c')]('nolimit')){_0x398fb2[_0x51a8('0x22')]=qs[_0x51a8('0x22')](_0x132ce5['query']['limit']);_0x398fb2[_0x51a8('0x20')]=qs[_0x51a8('0x20')](_0x132ce5[_0x51a8('0x36')][_0x51a8('0x20')]);}return _0x160861[_0x51a8('0x76')](_0x398fb2);}})[_0x51a8('0x26')](function(_0x4e566a){if(_0x4e566a){return _0x4e566a?{'count':_0x1e7f04,'rows':_0x4e566a}:null;}})[_0x51a8('0x26')](respondWithResult(_0x3fbdf1,null))[_0x51a8('0x48')](handleError(_0x3fbdf1,null));};exports[_0x51a8('0x7a')]=function(_0x566d62,_0x315802,_0x3f4649){var _0x1db1e0={};var _0x58a83c={};var _0x149fa4;var _0x1821a8;return db['VoicePrefix'][_0x51a8('0x77')]({'where':{'id':_0x566d62['params']['id']}})[_0x51a8('0x26')](handleEntityNotFound(_0x315802,null))[_0x51a8('0x26')](function(_0xfb059){if(_0xfb059){_0x149fa4=_0xfb059;_0x58a83c[_0x51a8('0x34')]=_[_0x51a8('0x35')](db[_0x51a8('0x7b')][_0x51a8('0x32')]);_0x58a83c[_0x51a8('0x36')]=_['keys'](_0x566d62[_0x51a8('0x36')]);_0x58a83c[_0x51a8('0x37')]=_[_0x51a8('0x38')](_0x58a83c[_0x51a8('0x34')],_0x58a83c[_0x51a8('0x36')]);_0x1db1e0['attributes']=_['intersection'](_0x58a83c[_0x51a8('0x34')],qs[_0x51a8('0x39')](_0x566d62[_0x51a8('0x36')][_0x51a8('0x39')]));_0x1db1e0[_0x51a8('0x3a')]=_0x1db1e0['attributes'][_0x51a8('0x3b')]?_0x1db1e0['attributes']:_0x58a83c[_0x51a8('0x34')];_0x1db1e0[_0x51a8('0x79')]=qs['sort'](_0x566d62[_0x51a8('0x36')]['sort']);_0x1db1e0[_0x51a8('0x3e')]=qs[_0x51a8('0x37')](_[_0x51a8('0x3f')](_0x566d62[_0x51a8('0x36')],_0x58a83c[_0x51a8('0x37')]));if(_0x566d62['query'][_0x51a8('0x40')]){_0x1db1e0[_0x51a8('0x3e')]=_['merge'](_0x1db1e0[_0x51a8('0x3e')],{'$or':_[_0x51a8('0x30')](_0x1db1e0['attributes'],function(_0x49b0d2){var _0x24b2a9={};_0x24b2a9[_0x49b0d2]={'$like':'%'+_0x566d62[_0x51a8('0x36')][_0x51a8('0x40')]+'%'};return _0x24b2a9;})});}_0x1db1e0=_['merge']({},_0x1db1e0,_0x566d62[_0x51a8('0x43')]);return _0x149fa4[_0x51a8('0x7a')](_0x1db1e0);}})[_0x51a8('0x26')](function(_0x11aab9){if(_0x11aab9){_0x1821a8=_0x11aab9[_0x51a8('0x3b')];if(!_0x566d62[_0x51a8('0x36')][_0x51a8('0x3c')]('nolimit')){_0x1db1e0[_0x51a8('0x22')]=qs[_0x51a8('0x22')](_0x566d62[_0x51a8('0x36')][_0x51a8('0x22')]);_0x1db1e0['offset']=qs['offset'](_0x566d62[_0x51a8('0x36')][_0x51a8('0x20')]);}return _0x149fa4['getTeams'](_0x1db1e0);}})['then'](function(_0x5b44ba){if(_0x5b44ba){return _0x5b44ba?{'count':_0x1821a8,'rows':_0x5b44ba}:null;}})[_0x51a8('0x26')](respondWithResult(_0x315802,null))['catch'](handleError(_0x315802,null));};exports['addTeams']=function(_0x517de1,_0x2164d7,_0x4b03f7){var _0x2cea3f=_0x517de1[_0x51a8('0x4e')]['ids'];var _0x5ab3c0;return db[_0x51a8('0x7b')]['findAll']({'where':{'id':_0x2cea3f},'attributes':['id'],'include':[{'model':db[_0x51a8('0x78')],'as':_0x51a8('0x7c'),'attributes':['id','name',_0x51a8('0x7d'),_0x51a8('0x7e'),'interface'],'raw':!![]}]})[_0x51a8('0x26')](function(_0x3bcc82){if(_0x3bcc82){_0x5ab3c0=_0x3bcc82;var _0x223bd7=_['flatMap'](_0x3bcc82,function(_0x2af315){var _0x2db8da=_0x2af315[_0x51a8('0x28')]({'plain':!![]});return _0x2db8da['Agents'];});return db['VoicePrefix'][_0x51a8('0x4f')]({'where':{'id':_0x517de1[_0x51a8('0x49')]['id']}})[_0x51a8('0x26')](function(_0xabdbd0){return db[_0x51a8('0x4c')][_0x51a8('0x4d')](function(_0x35cd5d){return _0xabdbd0[_0x51a8('0x7f')](_0x2cea3f,{'transaction':_0x35cd5d})[_0x51a8('0x26')](function(){return BPromise[_0x51a8('0x80')](_0x5ab3c0,function(_0x2a8aa1){return db[_0x51a8('0x81')][_0x51a8('0x82')]({'TeamId':_0x2a8aa1['id'],'VoicePrefixId':_0x517de1['params']['id']},{'transaction':_0x35cd5d});});})['then'](function(){return BPromise[_0x51a8('0x80')](_0x223bd7,function(_0x318478){return db[_0x51a8('0x83')][_0x51a8('0x84')]({'where':{'UserId':_0x318478['id'],'VoicePrefixId':_0x517de1[_0x51a8('0x49')]['id']},'transaction':_0x35cd5d});});})['then'](function(){_0x223bd7['forEach'](function(_0x39e8e6){socket[_0x51a8('0x71')]('userVoicePrefix:save',{'UserId':_0x39e8e6['id'],'VoicePrefixId':_0xabdbd0['id']});});});});});}})[_0x51a8('0x26')](respondWithStatusCode(_0x2164d7,null))[_0x51a8('0x48')](handleError(_0x2164d7,null));};exports[_0x51a8('0x85')]=function(_0x19ffd8,_0x121944,_0x4ee800){return db['Team'][_0x51a8('0x46')]({'where':{'id':_0x19ffd8['query'][_0x51a8('0x6f')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x51a8('0x7c'),'attributes':['id'],'raw':!![]}]})[_0x51a8('0x26')](handleEntityNotFound(_0x121944,null))['then'](function(_0x2dc65c){var _0x1837cb=_[_0x51a8('0x30')](_0x2dc65c,'id');var _0x11bee7=[];var _0x5cacc1=[];var _0x57b718=squel[_0x51a8('0x86')]();_0x57b718[_0x51a8('0x87')](_0x51a8('0x88'))[_0x51a8('0x89')]('team_has_voice_prefixes','tq')[_0x51a8('0x8a')]('user_has_teams','ut',_0x51a8('0x8b'))['where'](_0x51a8('0x8c'),_0x19ffd8[_0x51a8('0x49')]['id']);for(var _0x1ae73c=0x0;_0x1ae73c<_0x2dc65c[_0x51a8('0x3b')];_0x1ae73c+=0x1){let _0x5e923f=_0x2dc65c[_0x1ae73c];for(var _0x432e6a=0x0;_0x432e6a<_0x5e923f['Agents'][_0x51a8('0x3b')];_0x432e6a+=0x1){let _0x1e99d0=_0x5e923f[_0x51a8('0x7c')][_0x432e6a];var _0x5e22f4=_0x57b718[_0x51a8('0x8d')]();_0x5e22f4[_0x51a8('0x3e')](_0x51a8('0x8e'),_0x1e99d0['id']);_0x5cacc1['push'](db['sequelize'][_0x51a8('0x36')](_0x5e22f4[_0x51a8('0x8f')](),{'type':db[_0x51a8('0x4c')][_0x51a8('0x90')]['SELECT']})['then'](function(_0x46c310){if(_0x46c310['length']===0x1){return _0x1e99d0['id'];}else{var _0x1b9cd4=_[_0x51a8('0x91')](_[_0x51a8('0x30')](_0x46c310,_0x51a8('0x92')),function(_0x399fa0){return _[_0x51a8('0x93')](_0x1837cb,_0x399fa0);});if(_0x1b9cd4){return _0x1e99d0['id'];}}}));}}return BPromise[_0x51a8('0x94')](_0x5cacc1)['then'](function(_0x593711){_0x11bee7=_(_0x11bee7)['union'](_0x593711)[_0x51a8('0x95')]()[_0x51a8('0x96')]();return db[_0x51a8('0x31')][_0x51a8('0x4f')]({'where':{'id':_0x19ffd8[_0x51a8('0x49')]['id']}})['then'](function(_0x193d27){return db['sequelize'][_0x51a8('0x4d')](function(_0x188991){return _0x193d27[_0x51a8('0x85')](_0x19ffd8[_0x51a8('0x36')]['ids'],{'transaction':_0x188991})['then'](function(){if(!_[_0x51a8('0x97')](_0x11bee7)){return _0x193d27['removeAgents'](_0x11bee7,{'transaction':_0x188991});}})[_0x51a8('0x26')](function(){_0x11bee7[_0x51a8('0x98')](function(_0x292f74){socket[_0x51a8('0x71')]('userVoicePrefix:remove',{'UserId':_0x292f74,'VoicePrefixId':_0x193d27['id']});});});});});});})[_0x51a8('0x26')](respondWithStatusCode(_0x121944,null))[_0x51a8('0x48')](handleError(_0x121944,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 49e4389..49c50c9 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 _0xca7c=['exports','../../mysqldb','VoicePrefix','setMaxListeners','save','emit','hook'];(function(_0x40cff6,_0x25f6bd){var _0x3f57c6=function(_0x34b874){while(--_0x34b874){_0x40cff6['push'](_0x40cff6['shift']());}};_0x3f57c6(++_0x25f6bd);}(_0xca7c,0x127));var _0xcca7=function(_0x325454,_0x143834){_0x325454=_0x325454-0x0;var _0xec9f73=_0xca7c[_0x325454];return _0xec9f73;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0xcca7('0x0'))['db'][_0xcca7('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xcca7('0x2')](0x0);var events={'afterCreate':_0xcca7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x49b9aa){return function(_0x5cd6f3,_0x24d274,_0x543af4){VoicePrefixEvents[_0xcca7('0x4')](_0x49b9aa+':'+_0x5cd6f3['id'],_0x5cd6f3);VoicePrefixEvents[_0xcca7('0x4')](_0x49b9aa,_0x5cd6f3);_0x543af4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0xcca7('0x5')](e,emitEvent(event));}}module[_0xcca7('0x6')]=VoicePrefixEvents; \ No newline at end of file +var _0xe76e=['hook','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x4583a2,_0x2c139b){var _0x4410fa=function(_0x1c62fc){while(--_0x1c62fc){_0x4583a2['push'](_0x4583a2['shift']());}};_0x4410fa(++_0x2c139b);}(_0xe76e,0x1ec));var _0xee76=function(_0x1ef230,_0x34f0c8){_0x1ef230=_0x1ef230-0x0;var _0x239c06=_0xe76e[_0x1ef230];return _0x239c06;};'use strict';var EventEmitter=require(_0xee76('0x0'));var VoicePrefix=require(_0xee76('0x1'))['db'][_0xee76('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xee76('0x3')](0x0);var events={'afterCreate':_0xee76('0x4'),'afterUpdate':'update','afterDestroy':_0xee76('0x5')};function emitEvent(_0x1617d6){return function(_0x5f1b24,_0x53da34,_0x15b7dc){VoicePrefixEvents[_0xee76('0x6')](_0x1617d6+':'+_0x5f1b24['id'],_0x5f1b24);VoicePrefixEvents[_0xee76('0x6')](_0x1617d6,_0x5f1b24);_0x15b7dc(null);};}for(var e in events){if(events[_0xee76('0x7')](e)){var event=events[e];VoicePrefix[_0xee76('0x8')](e,emitEvent(event));}}module[_0xee76('0x9')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index d57ff55..c534886 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 _0xb025=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','define','voice_prefixes','util'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0xb025,0x16a));var _0x5b02=function(_0x59e1f0,_0x5e26f9){_0x59e1f0=_0x59e1f0-0x0;var _0x720503=_0xb025[_0x59e1f0];return _0x720503;};'use strict';var _=require('lodash');var util=require(_0x5b02('0x0'));var logger=require(_0x5b02('0x1'))('api');var moment=require(_0x5b02('0x2'));var BPromise=require(_0x5b02('0x3'));var rp=require(_0x5b02('0x4'));var fs=require('fs');var path=require(_0x5b02('0x5'));var rimraf=require(_0x5b02('0x6'));var config=require(_0x5b02('0x7'));var attributes=require(_0x5b02('0x8'));module['exports']=function(_0x5be74c,_0x1e97bf){return _0x5be74c[_0x5b02('0x9')]('VoicePrefix',attributes,{'tableName':_0x5b02('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeecf=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','VoicePrefix','voice_prefixes','lodash'];(function(_0x14e7f2,_0x4bdd32){var _0x4979a0=function(_0x3e8770){while(--_0x3e8770){_0x14e7f2['push'](_0x14e7f2['shift']());}};_0x4979a0(++_0x4bdd32);}(_0xeecf,0x16b));var _0xfeec=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xeecf[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xfeec('0x0'));var util=require(_0xfeec('0x1'));var logger=require(_0xfeec('0x2'))(_0xfeec('0x3'));var moment=require('moment');var BPromise=require(_0xfeec('0x4'));var rp=require(_0xfeec('0x5'));var fs=require('fs');var path=require(_0xfeec('0x6'));var rimraf=require(_0xfeec('0x7'));var config=require(_0xfeec('0x8'));var attributes=require(_0xfeec('0x9'));module[_0xfeec('0xa')]=function(_0x45340f,_0x10f7a5){return _0x45340f['define'](_0xfeec('0xb'),attributes,{'tableName':_0xfeec('0xc'),'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 b069dec..40dcfa3 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 _0xa498=['result','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x2947bf,_0x174a09){var _0x40421c=function(_0x42939d){while(--_0x42939d){_0x2947bf['push'](_0x2947bf['shift']());}};_0x40421c(++_0x174a09);}(_0xa498,0x1d6));var _0x8a49=function(_0x246115,_0x398123){_0x246115=_0x246115-0x0;var _0x385878=_0xa498[_0x246115];return _0x385878;};'use strict';var _=require('lodash');var util=require(_0x8a49('0x0'));var moment=require(_0x8a49('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a49('0x2'));var db=require(_0x8a49('0x3'))['db'];var utils=require(_0x8a49('0x4'));var logger=require(_0x8a49('0x5'))(_0x8a49('0x6'));var config=require('../../config/environment');var jayson=require(_0x8a49('0x7'));var client=jayson['client'][_0x8a49('0x8')]({'port':0x232a});config[_0x8a49('0x9')]=_[_0x8a49('0xa')](config['redis'],{'host':_0x8a49('0xb'),'port':0x18eb});var socket=require(_0x8a49('0xc'))(new Redis(config[_0x8a49('0x9')]));require(_0x8a49('0xd'))[_0x8a49('0xe')](socket);function respondWithRpcPromise(_0x688ffa,_0x595d79,_0x15e5b4){return new BPromise(function(_0x24bb85,_0x41674b){return client[_0x8a49('0xf')](_0x688ffa,_0x15e5b4)[_0x8a49('0x10')](function(_0x35f2b0){logger[_0x8a49('0x11')](_0x8a49('0x12'),_0x595d79,_0x8a49('0x13'));logger['debug'](_0x8a49('0x14'),_0x595d79,_0x8a49('0x13'),JSON[_0x8a49('0x15')](_0x35f2b0));if(_0x35f2b0['error']){if(_0x35f2b0[_0x8a49('0x16')]['code']===0x1f4){logger[_0x8a49('0x16')](_0x8a49('0x12'),_0x595d79,_0x35f2b0['error'][_0x8a49('0x17')]);return _0x41674b(_0x35f2b0[_0x8a49('0x16')][_0x8a49('0x17')]);}logger[_0x8a49('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x595d79,_0x35f2b0['error'][_0x8a49('0x17')]);return _0x24bb85(_0x35f2b0[_0x8a49('0x16')][_0x8a49('0x17')]);}else{logger[_0x8a49('0x11')]('VoicePrefix,\x20%s,\x20%s',_0x595d79,_0x8a49('0x13'));_0x24bb85(_0x35f2b0[_0x8a49('0x18')][_0x8a49('0x17')]);}})[_0x8a49('0x19')](function(_0x441ab1){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x595d79,_0x441ab1);_0x41674b(_0x441ab1);});});} \ No newline at end of file +var _0x199c=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','moment','bluebird','randomstring','ioredis'];(function(_0x5ef915,_0x5340d6){var _0x4e1fbd=function(_0x364336){while(--_0x364336){_0x5ef915['push'](_0x5ef915['shift']());}};_0x4e1fbd(++_0x5340d6);}(_0x199c,0x1d8));var _0xc199=function(_0x193927,_0x545c88){_0x193927=_0x193927-0x0;var _0x1d21b1=_0x199c[_0x193927];return _0x1d21b1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc199('0x0'));var BPromise=require(_0xc199('0x1'));var rs=require(_0xc199('0x2'));var fs=require('fs');var Redis=require(_0xc199('0x3'));var db=require(_0xc199('0x4'))['db'];var utils=require(_0xc199('0x5'));var logger=require(_0xc199('0x6'))(_0xc199('0x7'));var config=require('../../config/environment');var jayson=require(_0xc199('0x8'));var client=jayson[_0xc199('0x9')]['http']({'port':0x232a});config['redis']=_[_0xc199('0xa')](config[_0xc199('0xb')],{'host':_0xc199('0xc'),'port':0x18eb});var socket=require(_0xc199('0xd'))(new Redis(config[_0xc199('0xb')]));require(_0xc199('0xe'))[_0xc199('0xf')](socket);function respondWithRpcPromise(_0x1fb8d7,_0x53aaa2,_0x30b717){return new BPromise(function(_0x20a57d,_0x921e09){return client[_0xc199('0x10')](_0x1fb8d7,_0x30b717)[_0xc199('0x11')](function(_0x368292){logger['info'](_0xc199('0x12'),_0x53aaa2,_0xc199('0x13'));logger[_0xc199('0x14')](_0xc199('0x15'),_0x53aaa2,_0xc199('0x13'),JSON['stringify'](_0x368292));if(_0x368292[_0xc199('0x16')]){if(_0x368292[_0xc199('0x16')][_0xc199('0x17')]===0x1f4){logger[_0xc199('0x16')](_0xc199('0x12'),_0x53aaa2,_0x368292['error']['message']);return _0x921e09(_0x368292[_0xc199('0x16')]['message']);}logger[_0xc199('0x16')](_0xc199('0x12'),_0x53aaa2,_0x368292['error'][_0xc199('0x18')]);return _0x20a57d(_0x368292['error'][_0xc199('0x18')]);}else{logger[_0xc199('0x19')](_0xc199('0x12'),_0x53aaa2,_0xc199('0x13'));_0x20a57d(_0x368292[_0xc199('0x1a')][_0xc199('0x18')]);}})[_0xc199('0x1b')](function(_0x1e1540){logger[_0xc199('0x16')](_0xc199('0x12'),_0x53aaa2,_0x1e1540);_0x921e09(_0x1e1540);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 189d271..b242940 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 _0xde56=['removeListener','register','length','voicePrefix:','./voicePrefix.events','remove','update','emit'];(function(_0x4394b6,_0x12357f){var _0x360244=function(_0x5689a1){while(--_0x5689a1){_0x4394b6['push'](_0x4394b6['shift']());}};_0x360244(++_0x12357f);}(_0xde56,0x144));var _0x6de5=function(_0x50c492,_0x5c1e67){_0x50c492=_0x50c492-0x0;var _0x3505a8=_0xde56[_0x50c492];return _0x3505a8;};'use strict';var VoicePrefixEvents=require(_0x6de5('0x0'));var events=['save',_0x6de5('0x1'),_0x6de5('0x2')];function createListener(_0x2d8342,_0x44082d){return function(_0x2484e4){_0x44082d[_0x6de5('0x3')](_0x2d8342,_0x2484e4);};}function removeListener(_0x1cdb30,_0x382a2a){return function(){VoicePrefixEvents[_0x6de5('0x4')](_0x1cdb30,_0x382a2a);};}exports[_0x6de5('0x5')]=function(_0x4c65d1){for(var _0x1d6194=0x0,_0x141d65=events[_0x6de5('0x6')];_0x1d6194<_0x141d65;_0x1d6194++){var _0x1f8236=events[_0x1d6194];var _0x1cd11e=createListener(_0x6de5('0x7')+_0x1f8236,_0x4c65d1);VoicePrefixEvents['on'](_0x1f8236,_0x1cd11e);}}; \ No newline at end of file +var _0x49ac=['length','./voicePrefix.events','save','remove','update','emit','removeListener'];(function(_0x382a62,_0x1baa5e){var _0x490a25=function(_0x1b3427){while(--_0x1b3427){_0x382a62['push'](_0x382a62['shift']());}};_0x490a25(++_0x1baa5e);}(_0x49ac,0x19e));var _0xc49a=function(_0x21d36e,_0x5dc096){_0x21d36e=_0x21d36e-0x0;var _0x4cc307=_0x49ac[_0x21d36e];return _0x4cc307;};'use strict';var VoicePrefixEvents=require(_0xc49a('0x0'));var events=[_0xc49a('0x1'),_0xc49a('0x2'),_0xc49a('0x3')];function createListener(_0x310d8e,_0x3ad7a9){return function(_0x40db57){_0x3ad7a9[_0xc49a('0x4')](_0x310d8e,_0x40db57);};}function removeListener(_0x3d6da8,_0x28a560){return function(){VoicePrefixEvents[_0xc49a('0x5')](_0x3d6da8,_0x28a560);};}exports['register']=function(_0x40017e){for(var _0x5acdcf=0x0,_0x353873=events[_0xc49a('0x6')];_0x5acdcf<_0x353873;_0x5acdcf++){var _0x4440e5=events[_0x5acdcf];var _0x457829=createListener('voicePrefix:'+_0x4440e5,_0x40017e);VoicePrefixEvents['on'](_0x4440e5,_0x457829);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 1fd2e84..774c2de 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x60e243,_0x42f155){var _0x53b8cc=function(_0x482b2b){while(--_0x482b2b){_0x60e243['push'](_0x60e243['shift']());}};_0x53b8cc(++_0x42f155);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x1ec836,_0x1ce2d6){var _0x4baf71=function(_0x5b640e){while(--_0x5b640e){_0x1ec836['push'](_0x1ec836['shift']());}};_0x4baf71(++_0x1ce2d6);}(_0xb10b,0x12a));var _0xbb10=function(_0x1699e9,_0x1f2652){_0x1699e9=_0x1699e9-0x0;var _0x14b104=_0xb10b[_0x1699e9];return _0x14b104;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 6dbd824..aa8dfec 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 _0x7e59=['leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','type','getDataValue','outbound','preview','roundrobin','includes','INTEGER','yes','all','periodic_announce','split','joinempty','leavewhenempty','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','progressive','power','predictive','booked','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','name','ENUM','inbound','default','ringall'];(function(_0x102a37,_0x881f9){var _0x2fa196=function(_0xa98303){while(--_0xa98303){_0x102a37['push'](_0x102a37['shift']());}};_0x2fa196(++_0x881f9);}(_0x7e59,0x1c1));var _0x97e5=function(_0x5c52ba,_0x1f8200){_0x5c52ba=_0x5c52ba-0x0;var _0x40c074=_0x7e59[_0x5c52ba];return _0x40c074;};'use strict';var Sequelize=require(_0x97e5('0x0'));module['exports']={'name':{'type':Sequelize[_0x97e5('0x1')],'allowNull':![],'unique':_0x97e5('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x97e5('0x3')](_0x97e5('0x4'),'outbound'),'allowNull':![],'defaultValue':_0x97e5('0x4')},'musiconhold':{'type':Sequelize[_0x97e5('0x1')],'defaultValue':_0x97e5('0x5')},'announce':{'type':Sequelize[_0x97e5('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0x97e5('0x3')]('rr',_0x97e5('0x6'),_0x97e5('0x7'),_0x97e5('0x8'),_0x97e5('0x9'),_0x97e5('0xa'),_0x97e5('0xb'),_0x97e5('0xc'),_0x97e5('0xd')),'allowNull':![],'defaultValue':_0x97e5('0x6'),'set':function(_0x286244){this[_0x97e5('0xe')](_0x97e5('0xf'),_0x286244?_0x286244:'rrmemory');},'get':function(){var _0x12ddb9=this['getDataValue'](_0x97e5('0x10'));var _0x11eaf0=this[_0x97e5('0x11')]('dialMethod');var _0x22167f=this['getDataValue'](_0x97e5('0xf'));if(_0x12ddb9===_0x97e5('0x12')){if(_0x11eaf0===_0x97e5('0x13')){return null;}if(_0x11eaf0==='booked'&&!['rrmemory',_0x97e5('0x14')][_0x97e5('0x15')](_0x22167f)){this['setDataValue'](_0x97e5('0xf'),_0x97e5('0xa'));}}return _0x22167f;}},'servicelevel':{'type':Sequelize[_0x97e5('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x97e5('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x97e5('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x97e5('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x97e5('0x1')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x97e5('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x97e5('0x3')](_0x97e5('0x17'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize['ENUM'](_0x97e5('0x17'),'no',_0x97e5('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x97e5('0x16')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0x97e5('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x97e5('0x3')](_0x97e5('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x97e5('0x3')](_0x97e5('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x97e5('0x3')](_0x97e5('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x97e5('0x3')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0x97e5('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x97e5('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x97e5('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x97e5('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x97e5('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x97e5('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x97e5('0x3')](_0x97e5('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x97e5('0x3')](_0x97e5('0x17'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x97e5('0x3')](_0x97e5('0x17'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x97e5('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0x97e5('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x97e5('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x97e5('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x97e5('0x1')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x97e5('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x97e5('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x97e5('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x97e5('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x97e5('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x97e5('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x97e5('0x1')]},'queue_quantity1':{'type':Sequelize[_0x97e5('0x1')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x97e5('0x1')]},'queue_less_than':{'type':Sequelize[_0x97e5('0x1')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x21a1c0){this[_0x97e5('0xe')]('periodic_announce',_0x21a1c0?_0x21a1c0['join'](','):[]);},'get':function(){return this[_0x97e5('0x11')](_0x97e5('0x19'))?this[_0x97e5('0x11')](_0x97e5('0x19'))[_0x97e5('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x97e5('0x1')],'defaultValue':_0x97e5('0x17'),'set':function(_0x160eeb){this[_0x97e5('0xe')](_0x97e5('0x1b'),_0x160eeb?_0x160eeb['join'](','):undefined);},'get':function(){return this[_0x97e5('0x11')](_0x97e5('0x1b'))?this[_0x97e5('0x11')](_0x97e5('0x1b'))[_0x97e5('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x5ee7d7){this[_0x97e5('0xe')](_0x97e5('0x1c'),_0x5ee7d7?_0x5ee7d7['join'](','):undefined);},'get':function(){return this[_0x97e5('0x11')]('leavewhenempty')?this[_0x97e5('0x11')](_0x97e5('0x1c'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x97e5('0x3')](_0x97e5('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x97e5('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x97e5('0x3')](_0x97e5('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x97e5('0x1')]},'acw':{'type':Sequelize[_0x97e5('0x1d')],'defaultValue':0x0,'set':function(_0x149cfb){this['setDataValue']('acw',_0x149cfb);if(_0x149cfb){if(this[_0x97e5('0x11')]('wrapuptime')<0x2){this[_0x97e5('0xe')](_0x97e5('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x97e5('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x97e5('0x1d')],'defaultValue':0x0,'comment':_0x97e5('0x1f')},'dialMethod':{'type':Sequelize[_0x97e5('0x3')]('preview',_0x97e5('0x20'),_0x97e5('0x21'),_0x97e5('0x22'),_0x97e5('0x23')),'defaultValue':'progressive','comment':_0x97e5('0x24')},'dialLimitChannel':{'type':Sequelize[_0x97e5('0x16')](0x4)[_0x97e5('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x97e5('0x26')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x97e5('0x27')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x97e5('0x28')},'dialPredictiveOptimization':{'type':Sequelize[_0x97e5('0x3')](_0x97e5('0x29'),'dropRate'),'defaultValue':_0x97e5('0x2a'),'comment':_0x97e5('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x97e5('0x27')](0x2)[_0x97e5('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x97e5('0x2c')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0x97e5('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x97e5('0x2d')},'dialOriginateCallerIdName':{'type':Sequelize[_0x97e5('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x97e5('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x97e5('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x97e5('0x2e')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x97e5('0x2f'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0x97e5('0x16')](0x3)[_0x97e5('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize['STRING'],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x97e5('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x97e5('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x97e5('0x16')](0x5)[_0x97e5('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x97e5('0x16')](0x3)[_0x97e5('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x97e5('0x31')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x97e5('0x16')](0x3)[_0x97e5('0x25')],'defaultValue':0x3,'comment':_0x97e5('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x97e5('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x97e5('0x16')](0x3)[_0x97e5('0x25')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x97e5('0x1')],'defaultValue':_0x97e5('0x33')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x97e5('0x34'),_0x97e5('0x35'),'onlyIfOpen'),'defaultValue':_0x97e5('0x34')},'dialAMDActive':{'type':Sequelize[_0x97e5('0x1d')],'defaultValue':0x0,'comment':_0x97e5('0x36')},'dialAMDInitialSilence':{'type':Sequelize[_0x97e5('0x16')](0x9)[_0x97e5('0x25')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x97e5('0x37')},'dialAMDGreeting':{'type':Sequelize[_0x97e5('0x16')](0x9)[_0x97e5('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x97e5('0x38')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x97e5('0x16')](0x9)[_0x97e5('0x25')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x97e5('0x39')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x97e5('0x16')](0x9)[_0x97e5('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x97e5('0x3a')},'dialAMDMinWordLength':{'type':Sequelize[_0x97e5('0x16')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x97e5('0x3b')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x97e5('0x16')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x97e5('0x3c')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x97e5('0x16')](0x9)[_0x97e5('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x97e5('0x3d')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x97e5('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x97e5('0x16')](0x9)[_0x97e5('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0x97e5('0x1d')],'defaultValue':0x0,'comment':_0x97e5('0x3e')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x97e5('0x3f'),_0x97e5('0x40')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0x97e5('0x1')],'comment':_0x97e5('0x41')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x97e5('0x1d')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x97e5('0x16')](0x3)[_0x97e5('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x97e5('0x16')](0x3)[_0x97e5('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x97e5('0x42')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x97e5('0x16')](0x5)[_0x97e5('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x97e5('0x43')},'dialDropMaxRetry':{'type':Sequelize[_0x97e5('0x16')](0x3)[_0x97e5('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x97e5('0x44')},'dialDropRetryFrequency':{'type':Sequelize[_0x97e5('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x97e5('0x16')](0x3)[_0x97e5('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x97e5('0x16')](0x5)[_0x97e5('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x97e5('0x45')},'dialMachineMaxRetry':{'type':Sequelize[_0x97e5('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x97e5('0x46')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x97e5('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x97e5('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x97e5('0x16')](0x3)[_0x97e5('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x97e5('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x97e5('0x16')](0x5)[_0x97e5('0x25')],'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[_0x97e5('0x1d')],'defaultValue':![],'comment':_0x97e5('0x49'),'set':function(_0x1c0951){if(!_0x1c0951)this[_0x97e5('0xe')](_0x97e5('0x4a'),null);this[_0x97e5('0xe')](_0x97e5('0x4b'),_0x1c0951);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x97e5('0x16')](0x3)[_0x97e5('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x97e5('0x16')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x97e5('0x1d')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x97e5('0x16')](0x3)[_0x97e5('0x25')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x97e5('0x1d')],'defaultValue':![]}}; \ No newline at end of file +var _0xd375=['AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','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)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','exports','STRING','ENUM','inbound','outbound','default','ringall','random','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','getDataValue','type','dialMethod','preview','booked','roundrobin','includes','INTEGER','yes','all','TEXT','join','periodic_announce','split','joinempty','leavewhenempty','wrapuptime','Active/Disactive\x20Campaign','progressive','power','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'];(function(_0x62fa16,_0x25ff0e){var _0xb411e9=function(_0x363232){while(--_0x363232){_0x62fa16['push'](_0x62fa16['shift']());}};_0xb411e9(++_0x25ff0e);}(_0xd375,0x170));var _0x5d37=function(_0x8747c3,_0x1de53c){_0x8747c3=_0x8747c3-0x0;var _0x1a03e9=_0xd375[_0x8747c3];return _0x1a03e9;};'use strict';var Sequelize=require(_0x5d37('0x0'));module[_0x5d37('0x1')]={'name':{'type':Sequelize[_0x5d37('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x5d37('0x3')](_0x5d37('0x4'),_0x5d37('0x5')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x5d37('0x2')],'defaultValue':_0x5d37('0x6')},'announce':{'type':Sequelize[_0x5d37('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x5d37('0x3')]('rr',_0x5d37('0x7'),'leastrecent','fewestcalls',_0x5d37('0x8'),_0x5d37('0x9'),_0x5d37('0xa'),_0x5d37('0xb'),_0x5d37('0xc')),'allowNull':![],'defaultValue':_0x5d37('0x7'),'set':function(_0x4685db){this[_0x5d37('0xd')](_0x5d37('0xe'),_0x4685db?_0x4685db:_0x5d37('0x9'));},'get':function(){var _0x2e26f9=this[_0x5d37('0xf')](_0x5d37('0x10'));var _0x4ff1fa=this[_0x5d37('0xf')](_0x5d37('0x11'));var _0x55561d=this[_0x5d37('0xf')](_0x5d37('0xe'));if(_0x2e26f9===_0x5d37('0x5')){if(_0x4ff1fa===_0x5d37('0x12')){return null;}if(_0x4ff1fa===_0x5d37('0x13')&&![_0x5d37('0x9'),_0x5d37('0x14')][_0x5d37('0x15')](_0x55561d)){this[_0x5d37('0xd')](_0x5d37('0xe'),_0x5d37('0x9'));}}return _0x55561d;}},'servicelevel':{'type':Sequelize[_0x5d37('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x5d37('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x5d37('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x5d37('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x5d37('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x5d37('0x3')](_0x5d37('0x17'),'no'),'defaultValue':_0x5d37('0x17')},'autopause':{'type':Sequelize[_0x5d37('0x3')]('yes','no',_0x5d37('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x5d37('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0x5d37('0x3')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0x5d37('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x5d37('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x5d37('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x5d37('0x3')](_0x5d37('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x5d37('0x3')](_0x5d37('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x5d37('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x5d37('0x16')](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[_0x5d37('0x3')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x5d37('0x17'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x5d37('0x3')]('yes','no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x5d37('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x5d37('0x3')](_0x5d37('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0x5d37('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x5d37('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x5d37('0x2')]},'queue_youarenext':{'type':Sequelize[_0x5d37('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x5d37('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x5d37('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x5d37('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x5d37('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x5d37('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x5d37('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x5d37('0x2')]},'queue_quantity1':{'type':Sequelize[_0x5d37('0x2')]},'queue_quantity2':{'type':Sequelize[_0x5d37('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x5d37('0x2')]},'queue_less_than':{'type':Sequelize[_0x5d37('0x2')]},'periodic_announce':{'type':Sequelize[_0x5d37('0x19')],'set':function(_0x443065){this[_0x5d37('0xd')]('periodic_announce',_0x443065?_0x443065[_0x5d37('0x1a')](','):[]);},'get':function(){return this[_0x5d37('0xf')](_0x5d37('0x1b'))?this[_0x5d37('0xf')](_0x5d37('0x1b'))[_0x5d37('0x1c')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0x5d37('0x17'),'set':function(_0x454564){this['setDataValue'](_0x5d37('0x1d'),_0x454564?_0x454564['join'](','):undefined);},'get':function(){return this[_0x5d37('0xf')]('joinempty')?this[_0x5d37('0xf')](_0x5d37('0x1d'))[_0x5d37('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x5d37('0x2')],'defaultValue':'no','set':function(_0x47ed78){this[_0x5d37('0xd')](_0x5d37('0x1e'),_0x47ed78?_0x47ed78[_0x5d37('0x1a')](','):undefined);},'get':function(){return this[_0x5d37('0xf')](_0x5d37('0x1e'))?this[_0x5d37('0xf')](_0x5d37('0x1e'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0x5d37('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x5d37('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x5d37('0x3')](_0x5d37('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5d37('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x58b7e3){this['setDataValue']('acw',_0x58b7e3);if(_0x58b7e3){if(this[_0x5d37('0xf')]('wrapuptime')<0x2){this['setDataValue'](_0x5d37('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x5d37('0x20')},'dialMethod':{'type':Sequelize[_0x5d37('0x3')](_0x5d37('0x12'),_0x5d37('0x21'),_0x5d37('0x22'),'predictive',_0x5d37('0x13')),'defaultValue':_0x5d37('0x21'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0x5d37('0x16')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x5d37('0x23')},'dialLimitQueue':{'type':Sequelize[_0x5d37('0x16')](0x4)[_0x5d37('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x5d37('0x25')](0x2)[_0x5d37('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x5d37('0x26')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0x5d37('0x27'),_0x5d37('0x28')),'defaultValue':'dropRate','comment':_0x5d37('0x29')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x5d37('0x25')](0x2)[_0x5d37('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x5d37('0x2a')},'dialOriginateCallerIdName':{'type':Sequelize[_0x5d37('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x5d37('0x16')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5d37('0x2b')},'dialQueueOptions':{'type':Sequelize[_0x5d37('0x2')],'defaultValue':_0x5d37('0x2c'),'comment':_0x5d37('0x2d')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5d37('0x2e')},'dialQueueProject':{'type':Sequelize[_0x5d37('0x2')],'comment':_0x5d37('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize[_0x5d37('0x16')](0x3)[_0x5d37('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5d37('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x5d37('0x16')](0x5)[_0x5d37('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5d37('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5d37('0x31')},'dialBusyRetryFrequency':{'type':Sequelize[_0x5d37('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5d37('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x5d37('0x16')](0x3)[_0x5d37('0x24')],'defaultValue':0x3,'comment':_0x5d37('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5d37('0x34')},'dialGlobalMaxRetry':{'type':Sequelize[_0x5d37('0x16')](0x3)[_0x5d37('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x5d37('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x5d37('0x2')],'defaultValue':_0x5d37('0x35')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x5d37('0x3')](_0x5d37('0x36'),_0x5d37('0x37'),_0x5d37('0x38')),'defaultValue':_0x5d37('0x36')},'dialAMDActive':{'type':Sequelize[_0x5d37('0x39')],'defaultValue':0x0,'comment':_0x5d37('0x3a')},'dialAMDInitialSilence':{'type':Sequelize[_0x5d37('0x16')](0x9)[_0x5d37('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x5d37('0x3b')},'dialAMDGreeting':{'type':Sequelize[_0x5d37('0x16')](0x9)[_0x5d37('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x5d37('0x3c')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x5d37('0x16')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x5d37('0x3d')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x5d37('0x16')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5d37('0x3e')},'dialAMDMinWordLength':{'type':Sequelize[_0x5d37('0x16')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x5d37('0x3f')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x5d37('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x5d37('0x16')](0x9)[_0x5d37('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x5d37('0x40')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x5d37('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x5d37('0x41')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x5d37('0x16')](0x9)[_0x5d37('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5d37('0x42')},'dialRecallMeTimeout':{'type':Sequelize[_0x5d37('0x16')](0x5)[_0x5d37('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x5d37('0x43')},'dialRecallInQueue':{'type':Sequelize[_0x5d37('0x39')],'defaultValue':0x0,'comment':_0x5d37('0x44')},'dialOrderByScheduledAt':{'type':Sequelize[_0x5d37('0x3')](_0x5d37('0x45'),_0x5d37('0x46')),'defaultValue':_0x5d37('0x45')},'dialQueueProject2':{'type':Sequelize[_0x5d37('0x2')],'comment':_0x5d37('0x2f')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x5d37('0x39')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x5d37('0x39')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x5d37('0x16')](0x3)[_0x5d37('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5d37('0x47')},'dialCutDigit':{'type':Sequelize[_0x5d37('0x16')](0x3)[_0x5d37('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5d37('0x48')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x5d37('0x16')](0x3)[_0x5d37('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5d37('0x49')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x5d37('0x16')](0x5)[_0x5d37('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5d37('0x4a')},'dialDropMaxRetry':{'type':Sequelize[_0x5d37('0x16')](0x3)[_0x5d37('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x5d37('0x16')](0x5)[_0x5d37('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5d37('0x4b')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5d37('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5d37('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5d37('0x4c')},'dialMachineMaxRetry':{'type':Sequelize[_0x5d37('0x16')](0x3)[_0x5d37('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5d37('0x4d')},'dialMachineRetryFrequency':{'type':Sequelize[_0x5d37('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x5d37('0x16')](0x3)[_0x5d37('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5d37('0x4e')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x5d37('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5d37('0x4f')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x5d37('0x50')},'mandatoryDisposition':{'type':Sequelize[_0x5d37('0x39')],'defaultValue':![],'comment':_0x5d37('0x51'),'set':function(_0x2f9528){if(!_0x2f9528)this[_0x5d37('0xd')](_0x5d37('0x52'),null);this[_0x5d37('0xd')]('mandatoryDisposition',_0x2f9528);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x5d37('0x16')](0x3)[_0x5d37('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x5d37('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x5d37('0x39')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x5d37('0x16')](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x5d37('0x39')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 6737d57..d157d43 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 _0x39c7=['stack','send','index','VoiceQueue','rawAttributes','fieldName','key','model','query','filters','attributes','fields','length','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','includeAll','include','rows','catch','params','keys','intersection','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','clone','omit','createdAt','updatedAt','findOne','hasOwnProperty','VoiceQueueId','CmHopper','getHopperHistories','CmHopperHistory','findAll','getHopperFinals','CmHopperFinal','CmHopperBlack','Team','getTeams','addTeams','User','Agents','online','voicePause','interface','flatMap','penalty','sequelize','transaction','upsert','each','findOrCreate','isNil','format','emit','userVoiceQueue:save','removeTeams','ids','field','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','compact','removeAgents','UserVoiceQueueRt','forEach','userVoiceQueue:remove','addAgents','spread','isEmpty','all','getAgents','getMembers','getLists','CmList','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','ContactId','scheduledAt','ListId','from','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_contacts','CmListId','COALESCE(phone,\x27\x27)','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','ListId\x20=\x20?','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','name','UserProfileResource','destroy','then','error'];(function(_0x5c8a28,_0x59ce4d){var _0xfd22ff=function(_0x59421f){while(--_0x59421f){_0x5c8a28['push'](_0x5c8a28['shift']());}};_0xfd22ff(++_0x59ce4d);}(_0x39c7,0x85));var _0x739c=function(_0x1b0181,_0x58de82){_0x1b0181=_0x1b0181-0x0;var _0xb47682=_0x39c7[_0x1b0181];return _0xb47682;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x739c('0x0'));var zipdir=require(_0x739c('0x1'));var jsonpatch=require(_0x739c('0x2'));var rp=require(_0x739c('0x3'));var moment=require(_0x739c('0x4'));var BPromise=require(_0x739c('0x5'));var Mustache=require('mustache');var util=require(_0x739c('0x6'));var path=require(_0x739c('0x7'));var sox=require(_0x739c('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x739c('0x9'));var _=require(_0x739c('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x739c('0xb'));var deskjs=require(_0x739c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x739c('0xd'));var Papa=require(_0x739c('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x739c('0xf'));var as=require(_0x739c('0x10'));var hardwareService=require(_0x739c('0x11'));var logger=require(_0x739c('0x12'))(_0x739c('0x13'));var utils=require(_0x739c('0x14'));var config=require(_0x739c('0x15'));var licenseUtil=require(_0x739c('0x16'));var db=require(_0x739c('0x17'))['db'];config[_0x739c('0x18')]=_[_0x739c('0x19')](config[_0x739c('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x739c('0x1a'))(new Redis(config[_0x739c('0x18')]));require(_0x739c('0x1b'))[_0x739c('0x1c')](socket);function respondWithStatusCode(_0x298049,_0x23be87){_0x23be87=_0x23be87||0xcc;return function(_0x254b5d){if(_0x254b5d){return _0x298049[_0x739c('0x1d')](_0x23be87);}return _0x298049[_0x739c('0x1e')](_0x23be87)[_0x739c('0x1f')]();};}function respondWithResult(_0x4cc36c,_0x50ee8d){_0x50ee8d=_0x50ee8d||0xc8;return function(_0x362095){if(_0x362095){return _0x4cc36c[_0x739c('0x1e')](_0x50ee8d)[_0x739c('0x20')](_0x362095);}};}function respondWithFilteredResult(_0x56034d,_0x1bb4fd){return function(_0x2dc479){if(_0x2dc479){var _0x27141a=typeof _0x1bb4fd[_0x739c('0x21')]===_0x739c('0x22')&&typeof _0x1bb4fd['limit']===_0x739c('0x22');var _0x30259e=_0x2dc479[_0x739c('0x23')];var _0x4fc201=_0x27141a?0x0:_0x1bb4fd[_0x739c('0x21')];var _0x48fc13=_0x27141a?_0x2dc479['count']:_0x1bb4fd[_0x739c('0x21')]+_0x1bb4fd['limit'];var _0x13deaf;if(_0x48fc13>=_0x30259e){_0x48fc13=_0x30259e;_0x13deaf=0xc8;}else{_0x13deaf=0xce;}_0x56034d[_0x739c('0x1e')](_0x13deaf);return _0x56034d['set'](_0x739c('0x24'),_0x4fc201+'-'+_0x48fc13+'/'+_0x30259e)['json'](_0x2dc479);}return null;};}function patchUpdates(_0x147baf){return function(_0x4a36c9){try{jsonpatch[_0x739c('0x25')](_0x4a36c9,_0x147baf,!![]);}catch(_0x34d5d5){return BPromise[_0x739c('0x26')](_0x34d5d5);}return _0x4a36c9[_0x739c('0x27')]();};}function saveUpdates(_0x3799ef,_0xc138ce){return function(_0x147b02){if(_0x147b02){return _0x147b02[_0x739c('0x28')](_0x3799ef)['then'](function(_0x384bc5){return _0x384bc5;});}return null;};}function removeEntity(_0x87b322,_0x5c963f){return function(_0x3dad7f){if(_0x3dad7f){return _0x3dad7f['destroy']()['then'](function(){var _0x4200b3=_0x3dad7f[_0x739c('0x29')]({'plain':!![]});var _0x322139=[{'name':_0x739c('0x2a'),'value':_0x739c('0x2b'),'ignore':![]},{'name':_0x739c('0x2c'),'value':_0x739c('0x2d'),'ignore':![]}];var _0x4b105e=_(_0x322139)[_0x739c('0x2e')](_0x739c('0x2f'))[_0x739c('0x30')](_0x739c('0x31'))[_0x739c('0x31')]();if(_[_0x739c('0x32')](_0x4b105e,_0x4200b3[_0x739c('0x33')])){return;}var _0x5635b2=_['find'](_0x322139,['value',_0x4200b3['type']])[_0x739c('0x34')];return db[_0x739c('0x35')][_0x739c('0x36')]({'where':{'type':_0x5635b2,'resourceId':_0x4200b3['id']}})[_0x739c('0x37')](function(){return _0x3dad7f;});})[_0x739c('0x37')](function(){_0x87b322[_0x739c('0x1e')](0xcc)[_0x739c('0x1f')]();});}};}function handleEntityNotFound(_0x161aa5,_0x2471ad){return function(_0x107396){if(!_0x107396){_0x161aa5[_0x739c('0x1d')](0x194);}return _0x107396;};}function handleError(_0xac8767,_0x368201){_0x368201=_0x368201||0x1f4;return function(_0x2d05cf){logger[_0x739c('0x38')](_0x2d05cf[_0x739c('0x39')]);if(_0x2d05cf[_0x739c('0x34')]){delete _0x2d05cf[_0x739c('0x34')];}_0xac8767[_0x739c('0x1e')](_0x368201)[_0x739c('0x3a')](_0x2d05cf);};}exports[_0x739c('0x3b')]=function(_0x267484,_0x1f2f1a){var _0xe1b735={},_0x46693d={},_0x36eec6={'count':0x0,'rows':[]};var _0x3a4fec=_[_0x739c('0x30')](db[_0x739c('0x3c')][_0x739c('0x3d')],function(_0x1ab70f){return{'name':_0x1ab70f[_0x739c('0x3e')],'type':_0x1ab70f[_0x739c('0x33')][_0x739c('0x3f')]};});_0x46693d[_0x739c('0x40')]=_['map'](_0x3a4fec,_0x739c('0x34'));_0x46693d[_0x739c('0x41')]=_['keys'](_0x267484[_0x739c('0x41')]);_0x46693d[_0x739c('0x42')]=_['intersection'](_0x46693d['model'],_0x46693d[_0x739c('0x41')]);_0xe1b735[_0x739c('0x43')]=_['intersection'](_0x46693d[_0x739c('0x40')],qs[_0x739c('0x44')](_0x267484[_0x739c('0x41')][_0x739c('0x44')]));_0xe1b735[_0x739c('0x43')]=_0xe1b735['attributes'][_0x739c('0x45')]?_0xe1b735[_0x739c('0x43')]:_0x46693d['model'];if(!_0x267484['query']['hasOwnProperty'](_0x739c('0x46'))){_0xe1b735[_0x739c('0x47')]=qs['limit'](_0x267484[_0x739c('0x41')]['limit']);_0xe1b735['offset']=qs[_0x739c('0x21')](_0x267484[_0x739c('0x41')][_0x739c('0x21')]);}_0xe1b735[_0x739c('0x48')]=qs[_0x739c('0x49')](_0x267484[_0x739c('0x41')][_0x739c('0x49')]);_0xe1b735[_0x739c('0x4a')]=qs['filters'](_[_0x739c('0x4b')](_0x267484[_0x739c('0x41')],_0x46693d[_0x739c('0x42')]),_0x3a4fec);if(_0x267484[_0x739c('0x41')]['filter']){_0xe1b735[_0x739c('0x4a')]=_[_0x739c('0x4c')](_0xe1b735['where'],{'$or':_[_0x739c('0x30')](_0x3a4fec,function(_0xc22cd1){if(_0xc22cd1[_0x739c('0x33')]!==_0x739c('0x4d')){var _0x480d22={};_0x480d22[_0xc22cd1[_0x739c('0x34')]]={'$like':'%'+_0x267484[_0x739c('0x41')][_0x739c('0x2e')]+'%'};return _0x480d22;}})});}_0xe1b735=_[_0x739c('0x4c')]({},_0xe1b735,_0x267484['options']);var _0xf96733={'where':_0xe1b735['where']};return db['VoiceQueue']['count'](_0xf96733)[_0x739c('0x37')](function(_0x407d42){_0x36eec6[_0x739c('0x23')]=_0x407d42;if(_0x267484[_0x739c('0x41')][_0x739c('0x4e')]){_0xe1b735[_0x739c('0x4f')]=[{'all':!![]}];}return db['VoiceQueue']['findAll'](_0xe1b735);})['then'](function(_0x4642cc){_0x36eec6[_0x739c('0x50')]=_0x4642cc;return _0x36eec6;})['then'](respondWithFilteredResult(_0x1f2f1a,_0xe1b735))[_0x739c('0x51')](handleError(_0x1f2f1a,null));};exports['show']=function(_0x43a704,_0x483329){var _0x4056da={'raw':![],'where':{'id':_0x43a704[_0x739c('0x52')]['id']}},_0x387596={};_0x387596['model']=_[_0x739c('0x53')](db[_0x739c('0x3c')]['rawAttributes']);_0x387596[_0x739c('0x41')]=_[_0x739c('0x53')](_0x43a704[_0x739c('0x41')]);_0x387596[_0x739c('0x42')]=_[_0x739c('0x54')](_0x387596['model'],_0x387596[_0x739c('0x41')]);_0x4056da[_0x739c('0x43')]=_['intersection'](_0x387596[_0x739c('0x40')],qs[_0x739c('0x44')](_0x43a704['query'][_0x739c('0x44')]));_0x4056da['attributes']=_0x4056da['attributes'][_0x739c('0x45')]?_0x4056da[_0x739c('0x43')]:_0x387596['model'];if(_0x43a704[_0x739c('0x41')]['includeAll']){_0x4056da[_0x739c('0x4f')]=[{'all':!![]}];}_0x4056da=_[_0x739c('0x4c')]({},_0x4056da,_0x43a704[_0x739c('0x55')]);return db[_0x739c('0x3c')][_0x739c('0x56')](_0x4056da)[_0x739c('0x37')](handleEntityNotFound(_0x483329,null))[_0x739c('0x37')](respondWithResult(_0x483329,null))[_0x739c('0x51')](handleError(_0x483329,null));};exports['create']=function(_0x195680,_0x25b22a){return db[_0x739c('0x3c')][_0x739c('0x57')](_0x195680[_0x739c('0x58')],{})[_0x739c('0x37')](function(_0x10b190){var _0x26dcfa=_0x195680[_0x739c('0x59')][_0x739c('0x29')]({'plain':!![]});if(!_0x26dcfa)throw new Error(_0x739c('0x5a'));if(_0x26dcfa[_0x739c('0x5b')]===_0x739c('0x59')){var _0x42d6f3=_0x10b190[_0x739c('0x29')]({'plain':!![]});var _0x4f1e61=[{'name':_0x739c('0x2a'),'value':_0x739c('0x2b')},{'name':'QueueCampaigns','value':_0x739c('0x2d')}];var _0x119ad1=_[_0x739c('0x56')](_0x4f1e61,[_0x739c('0x31'),_0x42d6f3[_0x739c('0x33')]])[_0x739c('0x34')];return db[_0x739c('0x5c')][_0x739c('0x56')]({'where':{'name':_0x119ad1,'userProfileId':_0x26dcfa[_0x739c('0x5d')]},'raw':!![]})[_0x739c('0x37')](function(_0x4edc8f){if(_0x4edc8f&&_0x4edc8f[_0x739c('0x5e')]===0x0){return db[_0x739c('0x35')][_0x739c('0x57')]({'name':_0x42d6f3[_0x739c('0x34')],'resourceId':_0x42d6f3['id'],'type':_0x4edc8f[_0x739c('0x34')],'sectionId':_0x4edc8f['id']},{})[_0x739c('0x37')](function(){return _0x10b190;});}else{return _0x10b190;}})[_0x739c('0x51')](function(_0x24f1f6){logger[_0x739c('0x38')](_0x739c('0x5f'),_0x24f1f6);throw _0x24f1f6;});}return _0x10b190;})['then'](respondWithResult(_0x25b22a,0xc9))['catch'](handleError(_0x25b22a,null));};exports[_0x739c('0x60')]=function(_0x21e03a,_0x20bdc1){var _0x1b8e81={'where':{'id':_0x21e03a[_0x739c('0x52')]['id']}},_0x261af2={};_0x261af2[_0x739c('0x40')]=_[_0x739c('0x53')](db[_0x739c('0x3c')][_0x739c('0x3d')]);_0x1b8e81[_0x739c('0x43')]=_[_0x739c('0x54')](_0x261af2[_0x739c('0x40')],qs[_0x739c('0x44')](_0x21e03a['query'][_0x739c('0x44')]));_0x1b8e81[_0x739c('0x43')]=_0x1b8e81[_0x739c('0x43')][_0x739c('0x45')]?_0x1b8e81['attributes']:_0x261af2[_0x739c('0x40')];if(_0x21e03a[_0x739c('0x41')][_0x739c('0x4e')]){_0x1b8e81['include']=[{'all':!![]}];}_0x1b8e81=_[_0x739c('0x4c')]({},_0x1b8e81,_0x21e03a[_0x739c('0x55')]);return db[_0x739c('0x3c')][_0x739c('0x56')](_0x1b8e81)[_0x739c('0x37')](handleEntityNotFound(_0x20bdc1,null))[_0x739c('0x37')](function(_0x44b7a8){if(_0x44b7a8){var _0x3a746d=_0x44b7a8[_0x739c('0x29')]({'plain':!![]});_0x3a746d=qs[_0x739c('0x61')](_0x3a746d,['id',_0x739c('0x62'),_0x739c('0x63')]);_0x21e03a[_0x739c('0x58')]=_[_0x739c('0x61')](_0x21e03a[_0x739c('0x58')],['id','createdAt',_0x739c('0x63')]);return db['VoiceQueue']['create'](_[_0x739c('0x4c')](_0x3a746d,_0x21e03a[_0x739c('0x58')]),{'include':_0x21e03a[_0x739c('0x41')][_0x739c('0x4e')]?[{'all':!![]}]:undefined})[_0x739c('0x37')](function(_0x401e5f){var _0x3187d8=_0x21e03a[_0x739c('0x59')]['get']({'plain':!![]});if(!_0x3187d8)throw new Error(_0x739c('0x5a'));if(_0x3187d8[_0x739c('0x5b')]===_0x739c('0x59')){var _0x2b0920=_0x401e5f[_0x739c('0x29')]({'plain':!![]});var _0x3737d8=[{'name':_0x739c('0x2a'),'value':_0x739c('0x2b')},{'name':_0x739c('0x2c'),'value':'outbound'}];var _0x52d51a=_[_0x739c('0x56')](_0x3737d8,['value',_0x2b0920[_0x739c('0x33')]])[_0x739c('0x34')];return db['UserProfileSection'][_0x739c('0x56')]({'where':{'name':_0x52d51a,'userProfileId':_0x3187d8[_0x739c('0x5d')]},'raw':!![]})[_0x739c('0x37')](function(_0x12806c){if(_0x12806c&&_0x12806c[_0x739c('0x5e')]===0x0){return db[_0x739c('0x35')]['create']({'name':_0x2b0920['name'],'resourceId':_0x2b0920['id'],'type':_0x12806c['name'],'sectionId':_0x12806c['id']},{})[_0x739c('0x37')](function(){return _0x401e5f;});}else{return _0x401e5f;}})['catch'](function(_0x28555b){logger[_0x739c('0x38')](_0x739c('0x5f'),_0x28555b);throw _0x28555b;});}return _0x401e5f;});}})['then'](respondWithResult(_0x20bdc1,0xc9))[_0x739c('0x51')](handleError(_0x20bdc1,null));};exports[_0x739c('0x28')]=function(_0xd5e2d3,_0x5634dd){if(_0xd5e2d3['body']['id']){delete _0xd5e2d3[_0x739c('0x58')]['id'];}return db['VoiceQueue'][_0x739c('0x56')]({'where':{'id':_0xd5e2d3[_0x739c('0x52')]['id']}})[_0x739c('0x37')](handleEntityNotFound(_0x5634dd,null))[_0x739c('0x37')](saveUpdates(_0xd5e2d3[_0x739c('0x58')],null))['then'](respondWithResult(_0x5634dd,null))[_0x739c('0x51')](handleError(_0x5634dd,null));};exports[_0x739c('0x36')]=function(_0x3bfc06,_0x3519cb){return db[_0x739c('0x3c')][_0x739c('0x56')]({'where':{'id':_0x3bfc06['params']['id']}})[_0x739c('0x37')](handleEntityNotFound(_0x3519cb,null))[_0x739c('0x37')](removeEntity(_0x3519cb,null))['catch'](handleError(_0x3519cb,null));};exports['getHoppers']=function(_0x18e558,_0x52b38c,_0x255602){var _0x4513a8={'raw':![],'where':{}};var _0xe48f99={};var _0xa2fd0a={'count':0x0,'rows':[]};return db[_0x739c('0x3c')][_0x739c('0x64')]({'where':{'id':_0x18e558[_0x739c('0x52')]['id']}})[_0x739c('0x37')](handleEntityNotFound(_0x52b38c,null))['then'](function(_0x346cd2){if(_0x346cd2){_0xe48f99[_0x739c('0x40')]=_[_0x739c('0x53')](db['CmHopper'][_0x739c('0x3d')]);_0xe48f99[_0x739c('0x41')]=_[_0x739c('0x53')](_0x18e558[_0x739c('0x41')]);_0xe48f99['filters']=_[_0x739c('0x54')](_0xe48f99[_0x739c('0x40')],_0xe48f99[_0x739c('0x41')]);_0x4513a8['attributes']=_[_0x739c('0x54')](_0xe48f99[_0x739c('0x40')],qs[_0x739c('0x44')](_0x18e558[_0x739c('0x41')]['fields']));_0x4513a8[_0x739c('0x43')]=_0x4513a8[_0x739c('0x43')]['length']?_0x4513a8[_0x739c('0x43')]:_0xe48f99[_0x739c('0x40')];if(!_0x18e558[_0x739c('0x41')][_0x739c('0x65')](_0x739c('0x46'))){_0x4513a8[_0x739c('0x47')]=qs[_0x739c('0x47')](_0x18e558[_0x739c('0x41')]['limit']);_0x4513a8[_0x739c('0x21')]=qs[_0x739c('0x21')](_0x18e558[_0x739c('0x41')]['offset']);}_0x4513a8[_0x739c('0x48')]=qs[_0x739c('0x49')](_0x18e558[_0x739c('0x41')][_0x739c('0x49')]);_0x4513a8[_0x739c('0x4a')]=qs['filters'](_['pick'](_0x18e558[_0x739c('0x41')],_0xe48f99[_0x739c('0x42')]));_0x4513a8[_0x739c('0x4a')][_0x739c('0x66')]=_0x346cd2['id'];if(_0x18e558['query'][_0x739c('0x2e')]){_0x4513a8[_0x739c('0x4a')]=_['merge'](_0x4513a8[_0x739c('0x4a')],{'$or':_[_0x739c('0x30')](_0x4513a8[_0x739c('0x43')],function(_0xecd770){var _0x3c959b={};_0x3c959b[_0xecd770]={'$like':'%'+_0x18e558[_0x739c('0x41')][_0x739c('0x2e')]+'%'};return _0x3c959b;})});}_0x4513a8=_[_0x739c('0x4c')]({},_0x4513a8,_0x18e558['options']);return db[_0x739c('0x67')][_0x739c('0x23')]({'where':_0x4513a8['where']})[_0x739c('0x37')](function(_0x25fde3){_0xa2fd0a[_0x739c('0x23')]=_0x25fde3;if(_0x18e558['query'][_0x739c('0x4e')]){_0x4513a8['include']=[{'all':!![]}];}return db[_0x739c('0x67')]['findAll'](_0x4513a8);})['then'](function(_0x51a3a7){_0xa2fd0a[_0x739c('0x50')]=_0x51a3a7;return _0xa2fd0a;});}})[_0x739c('0x37')](respondWithFilteredResult(_0x52b38c,_0x4513a8))['catch'](handleError(_0x52b38c,null));};exports[_0x739c('0x68')]=function(_0x30bc51,_0x2c2544,_0x38bcac){var _0xfd84c4={'raw':!![],'where':{}};var _0x273612={};var _0x2e517b={'count':0x0,'rows':[]};return db[_0x739c('0x3c')][_0x739c('0x64')]({'where':{'id':_0x30bc51[_0x739c('0x52')]['id']}})['then'](handleEntityNotFound(_0x2c2544,null))['then'](function(_0x5c0bbe){if(_0x5c0bbe){_0x273612[_0x739c('0x40')]=_[_0x739c('0x53')](db[_0x739c('0x69')][_0x739c('0x3d')]);_0x273612['query']=_[_0x739c('0x53')](_0x30bc51[_0x739c('0x41')]);_0x273612[_0x739c('0x42')]=_[_0x739c('0x54')](_0x273612['model'],_0x273612[_0x739c('0x41')]);_0xfd84c4[_0x739c('0x43')]=_['intersection'](_0x273612[_0x739c('0x40')],qs[_0x739c('0x44')](_0x30bc51[_0x739c('0x41')]['fields']));_0xfd84c4['attributes']=_0xfd84c4['attributes'][_0x739c('0x45')]?_0xfd84c4['attributes']:_0x273612[_0x739c('0x40')];if(!_0x30bc51[_0x739c('0x41')]['hasOwnProperty'](_0x739c('0x46'))){_0xfd84c4['limit']=qs[_0x739c('0x47')](_0x30bc51[_0x739c('0x41')][_0x739c('0x47')]);_0xfd84c4[_0x739c('0x21')]=qs[_0x739c('0x21')](_0x30bc51['query']['offset']);}_0xfd84c4[_0x739c('0x48')]=qs[_0x739c('0x49')](_0x30bc51['query'][_0x739c('0x49')]);_0xfd84c4['where']=qs[_0x739c('0x42')](_[_0x739c('0x4b')](_0x30bc51[_0x739c('0x41')],_0x273612[_0x739c('0x42')]));_0xfd84c4['where'][_0x739c('0x66')]=_0x5c0bbe['id'];if(_0x30bc51[_0x739c('0x41')][_0x739c('0x2e')]){_0xfd84c4['where']=_[_0x739c('0x4c')](_0xfd84c4[_0x739c('0x4a')],{'$or':_[_0x739c('0x30')](_0xfd84c4[_0x739c('0x43')],function(_0x173544){var _0x4996a1={};_0x4996a1[_0x173544]={'$like':'%'+_0x30bc51[_0x739c('0x41')][_0x739c('0x2e')]+'%'};return _0x4996a1;})});}_0xfd84c4=_['merge']({},_0xfd84c4,_0x30bc51[_0x739c('0x55')]);return db['CmHopperHistory']['count']({'where':_0xfd84c4[_0x739c('0x4a')]})[_0x739c('0x37')](function(_0x1b8346){_0x2e517b[_0x739c('0x23')]=_0x1b8346;if(_0x30bc51['query']['includeAll']){_0xfd84c4[_0x739c('0x4f')]=[{'all':!![]}];}return db[_0x739c('0x69')][_0x739c('0x6a')](_0xfd84c4);})[_0x739c('0x37')](function(_0x78fd22){_0x2e517b['rows']=_0x78fd22;return _0x2e517b;});}})[_0x739c('0x37')](respondWithFilteredResult(_0x2c2544,_0xfd84c4))[_0x739c('0x51')](handleError(_0x2c2544,null));};exports[_0x739c('0x6b')]=function(_0x397ec0,_0x4bd4a0,_0x506ad5){var _0x3158fd={'raw':!![],'where':{}};var _0xdf88be={};var _0x4e5059={'count':0x0,'rows':[]};return db[_0x739c('0x3c')][_0x739c('0x64')]({'where':{'id':_0x397ec0[_0x739c('0x52')]['id']}})[_0x739c('0x37')](handleEntityNotFound(_0x4bd4a0,null))['then'](function(_0x38aa67){if(_0x38aa67){_0xdf88be[_0x739c('0x40')]=_[_0x739c('0x53')](db['CmHopperFinal'][_0x739c('0x3d')]);_0xdf88be['query']=_[_0x739c('0x53')](_0x397ec0[_0x739c('0x41')]);_0xdf88be['filters']=_[_0x739c('0x54')](_0xdf88be[_0x739c('0x40')],_0xdf88be['query']);_0x3158fd[_0x739c('0x43')]=_['intersection'](_0xdf88be[_0x739c('0x40')],qs[_0x739c('0x44')](_0x397ec0[_0x739c('0x41')][_0x739c('0x44')]));_0x3158fd['attributes']=_0x3158fd[_0x739c('0x43')][_0x739c('0x45')]?_0x3158fd[_0x739c('0x43')]:_0xdf88be[_0x739c('0x40')];if(!_0x397ec0['query'][_0x739c('0x65')](_0x739c('0x46'))){_0x3158fd[_0x739c('0x47')]=qs[_0x739c('0x47')](_0x397ec0[_0x739c('0x41')][_0x739c('0x47')]);_0x3158fd[_0x739c('0x21')]=qs[_0x739c('0x21')](_0x397ec0[_0x739c('0x41')]['offset']);}_0x3158fd[_0x739c('0x48')]=qs[_0x739c('0x49')](_0x397ec0[_0x739c('0x41')]['sort']);_0x3158fd[_0x739c('0x4a')]=qs[_0x739c('0x42')](_[_0x739c('0x4b')](_0x397ec0['query'],_0xdf88be['filters']));_0x3158fd[_0x739c('0x4a')][_0x739c('0x66')]=_0x38aa67['id'];if(_0x397ec0[_0x739c('0x41')][_0x739c('0x2e')]){_0x3158fd['where']=_[_0x739c('0x4c')](_0x3158fd[_0x739c('0x4a')],{'$or':_[_0x739c('0x30')](_0x3158fd[_0x739c('0x43')],function(_0x537b3b){var _0x5a03be={};_0x5a03be[_0x537b3b]={'$like':'%'+_0x397ec0['query']['filter']+'%'};return _0x5a03be;})});}_0x3158fd=_[_0x739c('0x4c')]({},_0x3158fd,_0x397ec0[_0x739c('0x55')]);return db[_0x739c('0x6c')]['count']({'where':_0x3158fd['where']})[_0x739c('0x37')](function(_0x39a1a0){_0x4e5059[_0x739c('0x23')]=_0x39a1a0;if(_0x397ec0[_0x739c('0x41')][_0x739c('0x4e')]){_0x3158fd[_0x739c('0x4f')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x739c('0x6a')](_0x3158fd);})[_0x739c('0x37')](function(_0x16d8c5){_0x4e5059[_0x739c('0x50')]=_0x16d8c5;return _0x4e5059;});}})[_0x739c('0x37')](respondWithFilteredResult(_0x4bd4a0,_0x3158fd))[_0x739c('0x51')](handleError(_0x4bd4a0,null));};exports['getHopperBlacks']=function(_0x3d7aa4,_0x58ff71,_0x3a0e54){var _0x54f39a={'raw':!![],'where':{}};var _0x244afa={};var _0x28e4c9={'count':0x0,'rows':[]};return db[_0x739c('0x3c')]['findOne']({'where':{'id':_0x3d7aa4[_0x739c('0x52')]['id']}})[_0x739c('0x37')](handleEntityNotFound(_0x58ff71,null))[_0x739c('0x37')](function(_0x2f9ce9){if(_0x2f9ce9){_0x244afa[_0x739c('0x40')]=_[_0x739c('0x53')](db[_0x739c('0x6d')][_0x739c('0x3d')]);_0x244afa[_0x739c('0x41')]=_[_0x739c('0x53')](_0x3d7aa4[_0x739c('0x41')]);_0x244afa[_0x739c('0x42')]=_[_0x739c('0x54')](_0x244afa['model'],_0x244afa['query']);_0x54f39a[_0x739c('0x43')]=_[_0x739c('0x54')](_0x244afa['model'],qs[_0x739c('0x44')](_0x3d7aa4[_0x739c('0x41')][_0x739c('0x44')]));_0x54f39a['attributes']=_0x54f39a[_0x739c('0x43')]['length']?_0x54f39a[_0x739c('0x43')]:_0x244afa[_0x739c('0x40')];if(!_0x3d7aa4[_0x739c('0x41')][_0x739c('0x65')](_0x739c('0x46'))){_0x54f39a[_0x739c('0x47')]=qs[_0x739c('0x47')](_0x3d7aa4['query'][_0x739c('0x47')]);_0x54f39a[_0x739c('0x21')]=qs['offset'](_0x3d7aa4[_0x739c('0x41')][_0x739c('0x21')]);}_0x54f39a[_0x739c('0x48')]=qs['sort'](_0x3d7aa4[_0x739c('0x41')]['sort']);_0x54f39a['where']=qs['filters'](_[_0x739c('0x4b')](_0x3d7aa4['query'],_0x244afa[_0x739c('0x42')]));_0x54f39a[_0x739c('0x4a')][_0x739c('0x66')]=_0x2f9ce9['id'];if(_0x3d7aa4[_0x739c('0x41')][_0x739c('0x2e')]){_0x54f39a[_0x739c('0x4a')]=_[_0x739c('0x4c')](_0x54f39a[_0x739c('0x4a')],{'$or':_[_0x739c('0x30')](_0x54f39a[_0x739c('0x43')],function(_0x5c2b9b){var _0x568e9a={};_0x568e9a[_0x5c2b9b]={'$like':'%'+_0x3d7aa4[_0x739c('0x41')][_0x739c('0x2e')]+'%'};return _0x568e9a;})});}_0x54f39a=_[_0x739c('0x4c')]({},_0x54f39a,_0x3d7aa4['options']);return db[_0x739c('0x6d')][_0x739c('0x23')]({'where':_0x54f39a[_0x739c('0x4a')]})['then'](function(_0x3560cf){_0x28e4c9[_0x739c('0x23')]=_0x3560cf;if(_0x3d7aa4[_0x739c('0x41')]['includeAll']){_0x54f39a[_0x739c('0x4f')]=[{'all':!![]}];}return db[_0x739c('0x6d')]['findAll'](_0x54f39a);})[_0x739c('0x37')](function(_0x451377){_0x28e4c9[_0x739c('0x50')]=_0x451377;return _0x28e4c9;});}})[_0x739c('0x37')](respondWithFilteredResult(_0x58ff71,_0x54f39a))[_0x739c('0x51')](handleError(_0x58ff71,null));};exports['getTeams']=function(_0x5a427,_0x1e2a37,_0x575f32){var _0x54a757={};var _0x355e3c={};var _0x550fe0;var _0xb94413;return db[_0x739c('0x3c')][_0x739c('0x64')]({'where':{'id':_0x5a427[_0x739c('0x52')]['id']}})[_0x739c('0x37')](handleEntityNotFound(_0x1e2a37,null))[_0x739c('0x37')](function(_0x4be1d3){if(_0x4be1d3){_0x550fe0=_0x4be1d3;_0x355e3c[_0x739c('0x40')]=_['keys'](db[_0x739c('0x6e')][_0x739c('0x3d')]);_0x355e3c[_0x739c('0x41')]=_[_0x739c('0x53')](_0x5a427['query']);_0x355e3c[_0x739c('0x42')]=_[_0x739c('0x54')](_0x355e3c[_0x739c('0x40')],_0x355e3c[_0x739c('0x41')]);_0x54a757['attributes']=_[_0x739c('0x54')](_0x355e3c[_0x739c('0x40')],qs[_0x739c('0x44')](_0x5a427[_0x739c('0x41')]['fields']));_0x54a757[_0x739c('0x43')]=_0x54a757[_0x739c('0x43')][_0x739c('0x45')]?_0x54a757[_0x739c('0x43')]:_0x355e3c[_0x739c('0x40')];_0x54a757[_0x739c('0x48')]=qs[_0x739c('0x49')](_0x5a427['query']['sort']);_0x54a757['where']=qs[_0x739c('0x42')](_['pick'](_0x5a427[_0x739c('0x41')],_0x355e3c[_0x739c('0x42')]));if(_0x5a427['query'][_0x739c('0x2e')]){_0x54a757[_0x739c('0x4a')]=_['merge'](_0x54a757['where'],{'$or':_['map'](_0x54a757['attributes'],function(_0x49085b){var _0x61921b={};_0x61921b[_0x49085b]={'$like':'%'+_0x5a427['query']['filter']+'%'};return _0x61921b;})});}_0x54a757=_[_0x739c('0x4c')]({},_0x54a757,_0x5a427['options']);return _0x550fe0[_0x739c('0x6f')](_0x54a757);}})[_0x739c('0x37')](function(_0x2b1b80){if(_0x2b1b80){_0xb94413=_0x2b1b80[_0x739c('0x45')];if(!_0x5a427['query'][_0x739c('0x65')]('nolimit')){_0x54a757[_0x739c('0x47')]=qs[_0x739c('0x47')](_0x5a427[_0x739c('0x41')][_0x739c('0x47')]);_0x54a757[_0x739c('0x21')]=qs[_0x739c('0x21')](_0x5a427['query'][_0x739c('0x21')]);}return _0x550fe0[_0x739c('0x6f')](_0x54a757);}})['then'](function(_0x3cc273){if(_0x3cc273){return _0x3cc273?{'count':_0xb94413,'rows':_0x3cc273}:null;}})[_0x739c('0x37')](respondWithResult(_0x1e2a37,null))[_0x739c('0x51')](handleError(_0x1e2a37,null));};exports[_0x739c('0x70')]=function(_0x26d8e0,_0x4749ff,_0xca838c){var _0x4c783e=_0x26d8e0['body']['teams'];var _0x44058e=_[_0x739c('0x30')](_0x4c783e,'id');return db[_0x739c('0x6e')][_0x739c('0x6a')]({'where':{'id':_0x44058e},'attributes':['id'],'include':[{'model':db[_0x739c('0x71')],'as':_0x739c('0x72'),'attributes':['id',_0x739c('0x34'),_0x739c('0x73'),_0x739c('0x74'),_0x739c('0x75')],'raw':!![]}]})[_0x739c('0x37')](function(_0x13a740){if(_0x13a740){var _0x2e6979=_[_0x739c('0x76')](_0x13a740,function(_0x5010fb){var _0x39008a=_0x5010fb[_0x739c('0x29')]({'plain':!![]});_0x39008a[_0x739c('0x72')]['forEach'](function(_0x24ae62){_0x24ae62[_0x739c('0x77')]=_['find'](_0x4c783e,{'id':_0x39008a['id']})[_0x739c('0x77')];});return _0x39008a[_0x739c('0x72')];});return db[_0x739c('0x3c')][_0x739c('0x56')]({'where':{'id':_0x26d8e0[_0x739c('0x52')]['id']}})[_0x739c('0x37')](function(_0x468519){return db[_0x739c('0x78')][_0x739c('0x79')](function(_0x3e345b){return _0x468519[_0x739c('0x70')](_0x44058e,{'transaction':_0x3e345b})[_0x739c('0x37')](function(){return BPromise['each'](_0x4c783e,function(_0xa15b5d){return db['TeamVoiceQueue'][_0x739c('0x7a')]({'TeamId':_0xa15b5d['id'],'VoiceQueueId':_0x26d8e0['params']['id'],'penalty':_0xa15b5d[_0x739c('0x77')]},{'transaction':_0x3e345b});});})[_0x739c('0x37')](function(){return BPromise[_0x739c('0x7b')](_0x2e6979,function(_0x25011d){return db['UserVoiceQueue'][_0x739c('0x7c')]({'where':{'UserId':_0x25011d['id'],'VoiceQueueId':_0x26d8e0[_0x739c('0x52')]['id']},'defaults':{'penalty':_0x25011d[_0x739c('0x77')]},'transaction':_0x3e345b});});})[_0x739c('0x37')](function(){return BPromise[_0x739c('0x7b')](_[_0x739c('0x2e')](_0x2e6979,{'online':!![]}),function(_0x283e59){return db['UserVoiceQueueRt'][_0x739c('0x7a')]({'membername':_0x283e59[_0x739c('0x34')],'UserId':_0x283e59['id'],'queue_name':_0x468519['name'],'VoiceQueueId':_0x468519['id'],'interface':_[_0x739c('0x7d')](_0x283e59[_0x739c('0x75')])?util[_0x739c('0x7e')]('SIP/%s',_0x283e59['name']):_0x283e59['interface'],'paused':_0x283e59[_0x739c('0x74')]||![],'penalty':_0x283e59[_0x739c('0x77')]},{'transaction':_0x3e345b});});})[_0x739c('0x37')](function(){_0x2e6979['forEach'](function(_0x305c57){socket[_0x739c('0x7f')](_0x739c('0x80'),{'UserId':_0x305c57['id'],'VoiceQueueId':_0x468519['id']});});});});});}})[_0x739c('0x37')](respondWithStatusCode(_0x4749ff,null))['catch'](handleError(_0x4749ff,null));};exports[_0x739c('0x81')]=function(_0x2ab7da,_0x483f48,_0x7d0d88){return db[_0x739c('0x6e')][_0x739c('0x6a')]({'where':{'id':_0x2ab7da[_0x739c('0x41')][_0x739c('0x82')]},'attributes':['id'],'include':[{'model':db[_0x739c('0x71')],'as':_0x739c('0x72'),'attributes':['id'],'raw':!![]}]})[_0x739c('0x37')](handleEntityNotFound(_0x483f48,null))[_0x739c('0x37')](function(_0x835617){var _0x8fe2b8=_['map'](_0x835617,'id');var _0xb4f3ed=[];var _0xfe3534=[];var _0xd43829=squel['select']();_0xd43829[_0x739c('0x83')]('tq.TeamId')['from']('team_has_voice_queues','tq')[_0x739c('0x84')](_0x739c('0x85'),'ut',_0x739c('0x86'))[_0x739c('0x4a')](_0x739c('0x87'),_0x2ab7da[_0x739c('0x52')]['id']);for(var _0x41f3e0=0x0;_0x41f3e0<_0x835617[_0x739c('0x45')];_0x41f3e0+=0x1){let _0x36386d=_0x835617[_0x41f3e0];for(var _0x1a2eb1=0x0;_0x1a2eb1<_0x36386d[_0x739c('0x72')][_0x739c('0x45')];_0x1a2eb1+=0x1){let _0x22853d=_0x36386d[_0x739c('0x72')][_0x1a2eb1];var _0xedf208=_0xd43829[_0x739c('0x60')]();_0xedf208[_0x739c('0x4a')](_0x739c('0x88'),_0x22853d['id']);_0xfe3534[_0x739c('0x89')](db['sequelize'][_0x739c('0x41')](_0xedf208[_0x739c('0x8a')](),{'type':db[_0x739c('0x78')]['QueryTypes'][_0x739c('0x8b')]})[_0x739c('0x37')](function(_0x380518){if(_0x380518[_0x739c('0x45')]===0x1){return _0x22853d['id'];}else{var _0x518132=_[_0x739c('0x8c')](_[_0x739c('0x30')](_0x380518,_0x739c('0x8d')),function(_0x3bfb4f){return _['includes'](_0x8fe2b8,_0x3bfb4f);});if(_0x518132){return _0x22853d['id'];}}}));}}return BPromise['all'](_0xfe3534)[_0x739c('0x37')](function(_0x40f1cc){_0xb4f3ed=_(_0xb4f3ed)['union'](_0x40f1cc)[_0x739c('0x8e')]()[_0x739c('0x31')]();return db['VoiceQueue'][_0x739c('0x56')]({'where':{'id':_0x2ab7da[_0x739c('0x52')]['id']}})[_0x739c('0x37')](function(_0x1fa875){return db[_0x739c('0x78')][_0x739c('0x79')](function(_0x3eaef0){return _0x1fa875[_0x739c('0x81')](_0x2ab7da['query']['ids'],{'transaction':_0x3eaef0})['then'](function(){if(!_['isEmpty'](_0xb4f3ed)){return _0x1fa875[_0x739c('0x8f')](_0xb4f3ed,{'transaction':_0x3eaef0})[_0x739c('0x37')](function(){return db[_0x739c('0x90')][_0x739c('0x36')]({'where':{'VoiceQueueId':_0x2ab7da[_0x739c('0x52')]['id'],'UserId':_0xb4f3ed},'transaction':_0x3eaef0});});}})[_0x739c('0x37')](function(){_0xb4f3ed[_0x739c('0x91')](function(_0x2f2bea){socket[_0x739c('0x7f')](_0x739c('0x92'),{'UserId':_0x2f2bea,'VoiceQueueId':_0x1fa875['id']});});});});});});})[_0x739c('0x37')](respondWithStatusCode(_0x483f48,null))['catch'](handleError(_0x483f48,null));};exports[_0x739c('0x93')]=function(_0x3fdf9a,_0x2c57c8,_0x52d355){var _0x15e176,_0x16819c;return db[_0x739c('0x3c')][_0x739c('0x56')]({'where':{'id':_0x3fdf9a[_0x739c('0x52')]['id']}})[_0x739c('0x37')](handleEntityNotFound(_0x2c57c8,null))[_0x739c('0x37')](function(_0x4f3fb9){if(_0x4f3fb9){_0x16819c=_0x4f3fb9;return _0x4f3fb9[_0x739c('0x93')](_0x3fdf9a[_0x739c('0x58')][_0x739c('0x82')],_[_0x739c('0x61')](_0x3fdf9a[_0x739c('0x58')],[_0x739c('0x82'),'id'])||{})[_0x739c('0x94')](function(_0x39e417){for(var _0x30ddb6=0x0;_0x30ddb6<_0x3fdf9a[_0x739c('0x58')][_0x739c('0x82')]['length'];_0x30ddb6+=0x1){socket[_0x739c('0x7f')]('userVoiceQueue:save',{'UserId':Number(_0x3fdf9a['body'][_0x739c('0x82')][_0x30ddb6]),'VoiceQueueId':Number(_0x3fdf9a[_0x739c('0x52')]['id'])});}return _0x39e417;});}})[_0x739c('0x37')](function(_0x6e1052){_0x15e176=_0x6e1052||[];if(_0x16819c){return db[_0x739c('0x71')]['findAll']({'where':{'id':_0x3fdf9a[_0x739c('0x58')][_0x739c('0x82')]},'attributes':['id',_0x739c('0x34'),_0x739c('0x73'),_0x739c('0x74'),_0x739c('0x75')],'raw':!![]});}})[_0x739c('0x37')](function(_0x1edd4a){if(!_[_0x739c('0x95')](_0x1edd4a)){var _0x3ac19b=[];for(var _0x505391=0x0;_0x505391<_0x1edd4a[_0x739c('0x45')];_0x505391++){if(_0x1edd4a[_0x505391][_0x739c('0x73')]){_0x3ac19b[_0x739c('0x89')](db[_0x739c('0x90')][_0x739c('0x7a')]({'membername':_0x1edd4a[_0x505391][_0x739c('0x34')],'UserId':_0x1edd4a[_0x505391]['id'],'queue_name':_0x16819c[_0x739c('0x34')],'VoiceQueueId':_0x16819c['id'],'interface':_[_0x739c('0x7d')](_0x1edd4a[_0x505391][_0x739c('0x75')])?util[_0x739c('0x7e')]('SIP/%s',_0x1edd4a[_0x505391]['name']):_0x1edd4a[_0x505391][_0x739c('0x75')],'paused':_0x1edd4a[_0x505391][_0x739c('0x74')]||![],'penalty':_0x3fdf9a['body'][_0x739c('0x77')]||0x0}));}}return BPromise[_0x739c('0x96')](_0x3ac19b);}})[_0x739c('0x37')](function(){return _0x15e176;})['then'](respondWithResult(_0x2c57c8,null))[_0x739c('0x51')](handleError(_0x2c57c8,null));};exports['removeAgents']=function(_0xeaaed3,_0x28500b,_0x4a114c){return db[_0x739c('0x3c')][_0x739c('0x56')]({'where':{'id':_0xeaaed3[_0x739c('0x52')]['id']}})[_0x739c('0x37')](handleEntityNotFound(_0x28500b,null))['then'](function(_0x4a0d06){if(_0x4a0d06){return _0x4a0d06[_0x739c('0x8f')](_0xeaaed3[_0x739c('0x41')]['ids'])[_0x739c('0x37')](function(){if(_['isArray'](_0xeaaed3['query']['ids'])){for(var _0x1787a3=0x0;_0x1787a3<_0xeaaed3[_0x739c('0x41')][_0x739c('0x82')][_0x739c('0x45')];_0x1787a3+=0x1){socket['emit']('userVoiceQueue:remove',{'UserId':Number(_0xeaaed3[_0x739c('0x41')][_0x739c('0x82')][_0x1787a3]),'VoiceQueueId':Number(_0xeaaed3[_0x739c('0x52')]['id'])});}}else{socket[_0x739c('0x7f')](_0x739c('0x92'),{'UserId':Number(_0xeaaed3[_0x739c('0x41')][_0x739c('0x82')]),'VoiceQueueId':Number(_0xeaaed3[_0x739c('0x52')]['id'])});}});}})[_0x739c('0x37')](function(_0x57e462){return db[_0x739c('0x90')][_0x739c('0x36')]({'where':{'VoiceQueueId':_0xeaaed3['params']['id'],'UserId':_0xeaaed3[_0x739c('0x41')][_0x739c('0x82')]}})['then'](function(){return _0x57e462;});})[_0x739c('0x37')](respondWithStatusCode(_0x28500b,null))[_0x739c('0x51')](handleError(_0x28500b,null));};exports[_0x739c('0x97')]=function(_0x317456,_0x3dd822,_0x5d9155){var _0x3a0fd1={};var _0x5a6d9b={};var _0x314841;var _0x51ebae;return db[_0x739c('0x3c')][_0x739c('0x64')]({'where':{'id':_0x317456[_0x739c('0x52')]['id']}})[_0x739c('0x37')](handleEntityNotFound(_0x3dd822,null))['then'](function(_0x1b540b){if(_0x1b540b){_0x314841=_0x1b540b;_0x5a6d9b[_0x739c('0x40')]=_[_0x739c('0x53')](db[_0x739c('0x71')]['rawAttributes']);_0x5a6d9b[_0x739c('0x41')]=_[_0x739c('0x53')](_0x317456[_0x739c('0x41')]);_0x5a6d9b['filters']=_['intersection'](_0x5a6d9b['model'],_0x5a6d9b[_0x739c('0x41')]);_0x3a0fd1['attributes']=_['intersection'](_0x5a6d9b[_0x739c('0x40')],qs[_0x739c('0x44')](_0x317456[_0x739c('0x41')]['fields']));_0x3a0fd1[_0x739c('0x43')]=_0x3a0fd1[_0x739c('0x43')][_0x739c('0x45')]?_0x3a0fd1[_0x739c('0x43')]:_0x5a6d9b['model'];_0x3a0fd1[_0x739c('0x48')]=qs['sort'](_0x317456['query'][_0x739c('0x49')]);_0x3a0fd1[_0x739c('0x4a')]=qs[_0x739c('0x42')](_['pick'](_0x317456[_0x739c('0x41')],_0x5a6d9b['filters']));if(_0x317456[_0x739c('0x41')][_0x739c('0x2e')]){_0x3a0fd1[_0x739c('0x4a')]=_[_0x739c('0x4c')](_0x3a0fd1['where'],{'$or':_[_0x739c('0x30')](_0x3a0fd1[_0x739c('0x43')],function(_0x1e71ef){var _0x2d33cc={};_0x2d33cc[_0x1e71ef]={'$like':'%'+_0x317456[_0x739c('0x41')]['filter']+'%'};return _0x2d33cc;})});}_0x3a0fd1=_[_0x739c('0x4c')]({},_0x3a0fd1,_0x317456[_0x739c('0x55')]);return _0x314841[_0x739c('0x97')](_0x3a0fd1);}})[_0x739c('0x37')](function(_0x332d61){if(_0x332d61){_0x51ebae=_0x332d61[_0x739c('0x45')];if(!_0x317456['query'][_0x739c('0x65')](_0x739c('0x46'))){_0x3a0fd1[_0x739c('0x47')]=qs[_0x739c('0x47')](_0x317456[_0x739c('0x41')]['limit']);_0x3a0fd1[_0x739c('0x21')]=qs[_0x739c('0x21')](_0x317456[_0x739c('0x41')][_0x739c('0x21')]);}return _0x314841[_0x739c('0x97')](_0x3a0fd1);}})[_0x739c('0x37')](function(_0x43aeb8){if(_0x43aeb8){return _0x43aeb8?{'count':_0x51ebae,'rows':_0x43aeb8}:null;}})['then'](respondWithResult(_0x3dd822,null))[_0x739c('0x51')](handleError(_0x3dd822,null));};exports['getMembers']=function(_0x222400,_0x171ee4,_0x246b00){var _0x740259={};var _0x9cbfda={};var _0x4347c6;var _0x498380;return db[_0x739c('0x3c')][_0x739c('0x64')]({'where':{'id':_0x222400[_0x739c('0x52')]['id']}})[_0x739c('0x37')](handleEntityNotFound(_0x171ee4,null))[_0x739c('0x37')](function(_0x4429be){if(_0x4429be){_0x4347c6=_0x4429be;_0x9cbfda['model']=_[_0x739c('0x53')](db[_0x739c('0x90')][_0x739c('0x3d')]);_0x9cbfda[_0x739c('0x41')]=_[_0x739c('0x53')](_0x222400['query']);_0x9cbfda[_0x739c('0x42')]=_[_0x739c('0x54')](_0x9cbfda[_0x739c('0x40')],_0x9cbfda[_0x739c('0x41')]);_0x740259[_0x739c('0x43')]=_[_0x739c('0x54')](_0x9cbfda[_0x739c('0x40')],qs['fields'](_0x222400[_0x739c('0x41')][_0x739c('0x44')]));_0x740259[_0x739c('0x43')]=_0x740259[_0x739c('0x43')][_0x739c('0x45')]?_0x740259[_0x739c('0x43')]:_0x9cbfda[_0x739c('0x40')];_0x740259[_0x739c('0x48')]=qs[_0x739c('0x49')](_0x222400[_0x739c('0x41')][_0x739c('0x49')]);_0x740259[_0x739c('0x4a')]=qs[_0x739c('0x42')](_['pick'](_0x222400['query'],_0x9cbfda[_0x739c('0x42')]));if(_0x222400['query']['filter']){_0x740259[_0x739c('0x4a')]=_['merge'](_0x740259[_0x739c('0x4a')],{'$or':_[_0x739c('0x30')](_0x740259[_0x739c('0x43')],function(_0x1dba8b){var _0x525088={};_0x525088[_0x1dba8b]={'$like':'%'+_0x222400['query'][_0x739c('0x2e')]+'%'};return _0x525088;})});}_0x740259=_[_0x739c('0x4c')]({},_0x740259,_0x222400[_0x739c('0x55')]);return _0x4347c6[_0x739c('0x98')](_0x740259);}})[_0x739c('0x37')](function(_0x4134e5){if(_0x4134e5){_0x498380=_0x4134e5[_0x739c('0x45')];if(!_0x222400[_0x739c('0x41')][_0x739c('0x65')](_0x739c('0x46'))){_0x740259[_0x739c('0x47')]=qs[_0x739c('0x47')](_0x222400[_0x739c('0x41')][_0x739c('0x47')]);_0x740259[_0x739c('0x21')]=qs[_0x739c('0x21')](_0x222400[_0x739c('0x41')][_0x739c('0x21')]);}return _0x4347c6[_0x739c('0x98')](_0x740259);}})[_0x739c('0x37')](function(_0x531a0){return _0x531a0?{'count':_0x498380,'rows':_0x531a0}:null;})[_0x739c('0x37')](respondWithResult(_0x171ee4,null))['catch'](handleError(_0x171ee4,null));};exports[_0x739c('0x99')]=function(_0x527322,_0x351232,_0x22dcb2){var _0x1ceea4={};var _0x27e943={};var _0x2249a1;var _0x234899;return db[_0x739c('0x3c')][_0x739c('0x64')]({'where':{'id':_0x527322['params']['id']}})[_0x739c('0x37')](handleEntityNotFound(_0x351232,null))[_0x739c('0x37')](function(_0x211226){if(_0x211226){_0x2249a1=_0x211226;_0x27e943[_0x739c('0x40')]=_[_0x739c('0x53')](db[_0x739c('0x9a')][_0x739c('0x3d')]);_0x27e943[_0x739c('0x41')]=_[_0x739c('0x53')](_0x527322[_0x739c('0x41')]);_0x27e943[_0x739c('0x42')]=_[_0x739c('0x54')](_0x27e943[_0x739c('0x40')],_0x27e943['query']);_0x1ceea4[_0x739c('0x43')]=_[_0x739c('0x54')](_0x27e943[_0x739c('0x40')],qs['fields'](_0x527322[_0x739c('0x41')][_0x739c('0x44')]));_0x1ceea4[_0x739c('0x43')]=_0x1ceea4[_0x739c('0x43')][_0x739c('0x45')]?_0x1ceea4[_0x739c('0x43')]:_0x27e943['model'];_0x1ceea4['order']=qs['sort'](_0x527322[_0x739c('0x41')][_0x739c('0x49')]);_0x1ceea4['where']=qs[_0x739c('0x42')](_[_0x739c('0x4b')](_0x527322[_0x739c('0x41')],_0x27e943[_0x739c('0x42')]));if(_0x527322[_0x739c('0x41')][_0x739c('0x2e')]){_0x1ceea4[_0x739c('0x4a')]=_['merge'](_0x1ceea4[_0x739c('0x4a')],{'$or':_['map'](_0x1ceea4[_0x739c('0x43')],function(_0x12dc80){var _0x12bd61={};_0x12bd61[_0x12dc80]={'$like':'%'+_0x527322[_0x739c('0x41')][_0x739c('0x2e')]+'%'};return _0x12bd61;})});}_0x1ceea4=_[_0x739c('0x4c')]({},_0x1ceea4,_0x527322['options']);return _0x2249a1[_0x739c('0x99')](_0x1ceea4);}})[_0x739c('0x37')](function(_0x38adde){if(_0x38adde){_0x234899=_0x38adde[_0x739c('0x45')];if(!_0x527322[_0x739c('0x41')][_0x739c('0x65')](_0x739c('0x46'))){_0x1ceea4[_0x739c('0x47')]=qs[_0x739c('0x47')](_0x527322['query']['limit']);_0x1ceea4[_0x739c('0x21')]=qs[_0x739c('0x21')](_0x527322[_0x739c('0x41')][_0x739c('0x21')]);}return _0x2249a1[_0x739c('0x99')](_0x1ceea4);}})[_0x739c('0x37')](function(_0x18d03f){if(_0x18d03f){return _0x18d03f?{'count':_0x234899,'rows':_0x18d03f}:null;}})[_0x739c('0x37')](respondWithResult(_0x351232,null))['catch'](handleError(_0x351232,null));};exports['addLists']=function(_0x2eeb64,_0x30e30c,_0x1ae9a8){var _0x5959c3=moment()[_0x739c('0x7e')]('YYYY-MM-DD\x20HH:mm:ss');var _0x299fd0,_0x2845c7;return db[_0x739c('0x3c')]['find']({'where':{'id':_0x2eeb64[_0x739c('0x52')]['id']}})[_0x739c('0x37')](handleEntityNotFound(_0x30e30c,null))[_0x739c('0x37')](function(_0x4a6af1){if(_0x4a6af1){_0x2845c7=_0x4a6af1;return _0x4a6af1['addLists'](_0x2eeb64[_0x739c('0x58')][_0x739c('0x82')],_[_0x739c('0x61')](_0x2eeb64[_0x739c('0x58')],['ids','id'])||{});}return null;})[_0x739c('0x94')](function(_0x503a47){var _0xccc27a;_0x299fd0=_0x503a47||[];var _0x5b5006=[];if(_0x503a47){for(var _0x541e73=0x0;_0x541e73<_0x503a47[_0x739c('0x45')];_0x541e73+=0x1){var _0x1dd699=_0x503a47[_0x541e73][_0x739c('0x29')]({'plain':!![]});_0x2845c7[_0x739c('0x9b')]=_0x2eeb64['body']['dialCheckDuplicateType']?_0x2eeb64[_0x739c('0x58')][_0x739c('0x9b')]:_0x2845c7[_0x739c('0x9b')];switch(_0x2845c7[_0x739c('0x9b')]){case _0x739c('0x9c'):_0xccc27a=squel[_0x739c('0x9d')]()[_0x739c('0x9e')](_0x739c('0x9f'))[_0x739c('0xa0')]([_0x739c('0xa1'),'scheduledAt',_0x739c('0xa2'),'ListId',_0x739c('0x66'),_0x739c('0x62'),'updatedAt'],squel['select']()[_0x739c('0x83')]('phone',_0x739c('0xa1'))[_0x739c('0x83')]('\x27'+_0x5959c3+'\x27',_0x739c('0xa3'))['field']('id',_0x739c('0xa2'))[_0x739c('0x83')](_0x1dd699['CmListId'][_0x739c('0x8a')](),_0x739c('0xa4'))['field'](_0x2eeb64[_0x739c('0x52')]['id'][_0x739c('0x8a')](),'VoiceQueueId')[_0x739c('0x83')]('\x27'+_0x5959c3+'\x27',_0x739c('0x62'))[_0x739c('0x83')]('\x27'+_0x5959c3+'\x27',_0x739c('0x63'))[_0x739c('0xa5')]('cm_contacts')[_0x739c('0x4a')](_0x739c('0xa6'))[_0x739c('0x4a')]('ListId\x20=\x20?',_0x1dd699['CmListId'][_0x739c('0x8a')]())[_0x739c('0x4a')](_0x739c('0xa7'))[_0x739c('0x4a')](_0x739c('0xa8'),squel[_0x739c('0xa9')]()[_0x739c('0x83')](_0x739c('0xaa'))[_0x739c('0xa5')]('cm_hopper_final')[_0x739c('0x4a')]('VoiceQueueId\x20=\x20?',_0x2eeb64[_0x739c('0x52')]['id'][_0x739c('0x8a')]()))[_0x739c('0x4a')]('phone\x20NOT\x20IN\x20(?)',squel['select']()['field']('COALESCE(phone,\x27\x27)')[_0x739c('0xa5')](_0x739c('0x9f'))[_0x739c('0x4a')]('VoiceQueueId\x20=\x20?',_0x2eeb64[_0x739c('0x52')]['id'][_0x739c('0x8a')]())))[_0x739c('0x8a')]();break;case'onlyIfOpen':_0xccc27a=squel[_0x739c('0x9d')]()[_0x739c('0x9e')](_0x739c('0x9f'))['fromQuery']([_0x739c('0xa1'),_0x739c('0xa3'),_0x739c('0xa2'),'ListId',_0x739c('0x66'),_0x739c('0x62'),_0x739c('0x63')],squel[_0x739c('0xa9')]()['field'](_0x739c('0xa1'),_0x739c('0xa1'))[_0x739c('0x83')]('\x27'+_0x5959c3+'\x27',_0x739c('0xa3'))[_0x739c('0x83')]('id',_0x739c('0xa2'))[_0x739c('0x83')](_0x1dd699['CmListId'][_0x739c('0x8a')](),_0x739c('0xa4'))[_0x739c('0x83')](_0x2eeb64['params']['id']['toString'](),'VoiceQueueId')[_0x739c('0x83')]('\x27'+_0x5959c3+'\x27','createdAt')[_0x739c('0x83')]('\x27'+_0x5959c3+'\x27',_0x739c('0x63'))[_0x739c('0xa5')](_0x739c('0xab'))[_0x739c('0x4a')](_0x739c('0xa6'))['where']('ListId\x20=\x20?',_0x1dd699[_0x739c('0xac')][_0x739c('0x8a')]())[_0x739c('0x4a')](_0x739c('0xa7'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x739c('0xa9')]()[_0x739c('0x83')](_0x739c('0xad'))[_0x739c('0xa5')](_0x739c('0x9f'))[_0x739c('0x4a')](_0x739c('0x87'),_0x2eeb64[_0x739c('0x52')]['id'][_0x739c('0x8a')]())))[_0x739c('0x8a')]();break;default:_0xccc27a=squel[_0x739c('0x9d')]()[_0x739c('0x9e')](_0x739c('0x9f'))[_0x739c('0xa0')]([_0x739c('0xa1'),_0x739c('0xa3'),_0x739c('0xa2'),_0x739c('0xa4'),_0x739c('0x66'),_0x739c('0x62'),'updatedAt'],squel[_0x739c('0xa9')]()['field'](_0x739c('0xa1'),_0x739c('0xa1'))['field']('\x27'+_0x5959c3+'\x27',_0x739c('0xa3'))[_0x739c('0x83')]('id',_0x739c('0xa2'))[_0x739c('0x83')](_0x1dd699['CmListId'][_0x739c('0x8a')](),'ListId')['field'](_0x2eeb64[_0x739c('0x52')]['id'][_0x739c('0x8a')](),_0x739c('0x66'))['field']('\x27'+_0x5959c3+'\x27',_0x739c('0x62'))[_0x739c('0x83')]('\x27'+_0x5959c3+'\x27',_0x739c('0x63'))[_0x739c('0xa5')](_0x739c('0xab'))['where'](_0x739c('0xa6'))[_0x739c('0x4a')]('ListId\x20=\x20?',_0x1dd699['CmListId']['toString']())[_0x739c('0x4a')](_0x739c('0xa7')))['toString']();}_0x5b5006[_0x739c('0x89')](db[_0x739c('0x78')][_0x739c('0x41')](_0xccc27a));}return BPromise[_0x739c('0x96')](_0x5b5006);}})[_0x739c('0x37')](function(){var _0x4d4277=[];var _0x5bf1e5=squel[_0x739c('0x9d')]()['into'](_0x739c('0xae'))[_0x739c('0xa0')]([_0x739c('0xaf'),'phone',_0x739c('0xb0'),_0x739c('0x62'),_0x739c('0x63')],squel[_0x739c('0xa9')]()[_0x739c('0x83')](_0x739c('0xb1'))[_0x739c('0x83')](_0x739c('0xb2'))[_0x739c('0x83')](_0x739c('0xb3'))[_0x739c('0x83')]('\x27'+_0x5959c3+'\x27','createdAt')['field']('\x27'+_0x5959c3+'\x27',_0x739c('0x63'))['from'](_0x739c('0xb4'),'ci')[_0x739c('0x84')](_0x739c('0x9f'),'h',_0x739c('0xb5'))[_0x739c('0x4a')](_0x739c('0xb6'),_0x5959c3)['where'](_0x739c('0xb7'),'PHONE'))[_0x739c('0x8a')]();_0x4d4277[_0x739c('0x89')](db[_0x739c('0x78')][_0x739c('0x41')](_0x5bf1e5));return BPromise[_0x739c('0x96')](_0x4d4277);})[_0x739c('0x37')](function(){return _0x299fd0;})[_0x739c('0x37')](respondWithResult(_0x30e30c,null))[_0x739c('0x51')](handleError(_0x30e30c,null));};exports[_0x739c('0xb8')]=function(_0x4a5438,_0x13fdeb,_0x297248){return db[_0x739c('0x3c')][_0x739c('0x56')]({'where':{'id':_0x4a5438[_0x739c('0x52')]['id']}})[_0x739c('0x37')](handleEntityNotFound(_0x13fdeb,null))['then'](function(_0x5844b6){if(_0x5844b6){return _0x5844b6['removeLists'](_0x4a5438[_0x739c('0x41')][_0x739c('0x82')]);}})[_0x739c('0x37')](function(_0x5d8084){if(_0x5d8084){return db[_0x739c('0x67')][_0x739c('0x36')]({'where':{'ListId':_0x4a5438[_0x739c('0x41')]['ids'],'VoiceQueueId':_0x4a5438[_0x739c('0x52')]['id']}})[_0x739c('0x37')](function(){return _0x5d8084;});}})[_0x739c('0x37')](respondWithStatusCode(_0x13fdeb,null))[_0x739c('0x51')](handleError(_0x13fdeb,null));};exports[_0x739c('0xb9')]=function(_0x1ffb54,_0x261c37,_0x33baa7){var _0xe46fcc={};var _0xbe09d={};var _0x43197b;var _0xed2946;return db['VoiceQueue'][_0x739c('0x64')]({'where':{'id':_0x1ffb54[_0x739c('0x52')]['id']}})[_0x739c('0x37')](handleEntityNotFound(_0x261c37,null))[_0x739c('0x37')](function(_0x85c795){if(_0x85c795){_0x43197b=_0x85c795;_0xbe09d['model']=_[_0x739c('0x53')](db['CmList'][_0x739c('0x3d')]);_0xbe09d[_0x739c('0x41')]=_[_0x739c('0x53')](_0x1ffb54[_0x739c('0x41')]);_0xbe09d['filters']=_[_0x739c('0x54')](_0xbe09d[_0x739c('0x40')],_0xbe09d[_0x739c('0x41')]);_0xe46fcc[_0x739c('0x43')]=_['intersection'](_0xbe09d[_0x739c('0x40')],qs['fields'](_0x1ffb54[_0x739c('0x41')][_0x739c('0x44')]));_0xe46fcc[_0x739c('0x43')]=_0xe46fcc[_0x739c('0x43')][_0x739c('0x45')]?_0xe46fcc[_0x739c('0x43')]:_0xbe09d[_0x739c('0x40')];_0xe46fcc[_0x739c('0x48')]=qs[_0x739c('0x49')](_0x1ffb54[_0x739c('0x41')][_0x739c('0x49')]);_0xe46fcc[_0x739c('0x4a')]=qs['filters'](_[_0x739c('0x4b')](_0x1ffb54[_0x739c('0x41')],_0xbe09d[_0x739c('0x42')]));if(_0x1ffb54[_0x739c('0x41')][_0x739c('0x2e')]){_0xe46fcc['where']=_[_0x739c('0x4c')](_0xe46fcc[_0x739c('0x4a')],{'$or':_[_0x739c('0x30')](_0xe46fcc['attributes'],function(_0x4a692a){var _0x5de4fe={};_0x5de4fe[_0x4a692a]={'$like':'%'+_0x1ffb54['query'][_0x739c('0x2e')]+'%'};return _0x5de4fe;})});}_0xe46fcc=_[_0x739c('0x4c')]({},_0xe46fcc,_0x1ffb54[_0x739c('0x55')]);return _0x43197b[_0x739c('0xb9')](_0xe46fcc);}})[_0x739c('0x37')](function(_0x3dbd2f){if(_0x3dbd2f){_0xed2946=_0x3dbd2f['length'];if(!_0x1ffb54['query'][_0x739c('0x65')](_0x739c('0x46'))){_0xe46fcc[_0x739c('0x47')]=qs[_0x739c('0x47')](_0x1ffb54[_0x739c('0x41')][_0x739c('0x47')]);_0xe46fcc[_0x739c('0x21')]=qs['offset'](_0x1ffb54['query'][_0x739c('0x21')]);}return _0x43197b['getBlackLists'](_0xe46fcc);}})[_0x739c('0x37')](function(_0x77e8b5){if(_0x77e8b5){return _0x77e8b5?{'count':_0xed2946,'rows':_0x77e8b5}:null;}})['then'](respondWithResult(_0x261c37,null))[_0x739c('0x51')](handleError(_0x261c37,null));};exports['addBlackLists']=function(_0x23fdc6,_0x4e82b1,_0x176099){var _0x1b21a3,_0x3fcb50;return db[_0x739c('0x3c')][_0x739c('0x56')]({'where':{'id':_0x23fdc6[_0x739c('0x52')]['id']}})[_0x739c('0x37')](handleEntityNotFound(_0x4e82b1,null))[_0x739c('0x37')](function(_0x124c05){if(_0x124c05){_0x3fcb50=_0x124c05;return _0x124c05[_0x739c('0xba')](_0x23fdc6['body']['ids'],_[_0x739c('0x61')](_0x23fdc6[_0x739c('0x58')],['ids','id'])||{});}return null;})['spread'](function(_0x3d0d71){var _0x3726da;_0x1b21a3=_0x3d0d71||[];var _0x3f03d=[];if(_0x3d0d71){for(var _0x4081ab=0x0;_0x4081ab<_0x3d0d71[_0x739c('0x45')];_0x4081ab+=0x1){var _0x530800=_0x3d0d71[_0x4081ab]['get']({'plain':!![]});_0x3726da=squel[_0x739c('0x9d')]()[_0x739c('0x9e')](_0x739c('0xbb'))['fromQuery']([_0x739c('0xa1'),_0x739c('0xa2'),_0x739c('0xa4'),_0x739c('0x66'),_0x739c('0x62'),_0x739c('0x63')],squel[_0x739c('0xa9')]()['field']('phone',_0x739c('0xa1'))[_0x739c('0x83')]('id','ContactId')[_0x739c('0x83')](_0x530800[_0x739c('0xac')]['toString'](),_0x739c('0xa4'))['field'](_0x23fdc6[_0x739c('0x52')]['id'][_0x739c('0x8a')](),_0x739c('0x66'))[_0x739c('0x83')]('NOW()',_0x739c('0x62'))[_0x739c('0x83')](_0x739c('0xbc'),_0x739c('0x63'))[_0x739c('0xa5')](_0x739c('0xab'))[_0x739c('0x4a')]('deletedAt\x20IS\x20NULL')['where'](_0x739c('0xbd'),_0x530800['CmListId'][_0x739c('0x8a')]())[_0x739c('0x4a')](_0x739c('0xa7')))['toString']();_0x3f03d[_0x739c('0x89')](db[_0x739c('0x78')]['query'](_0x3726da));}return BPromise[_0x739c('0x96')](_0x3f03d);}})[_0x739c('0x37')](function(){return _0x1b21a3;})[_0x739c('0x37')](respondWithResult(_0x4e82b1,null))[_0x739c('0x51')](handleError(_0x4e82b1,null));};exports['removeBlackLists']=function(_0x366325,_0x34af99,_0x2f5574){return db['VoiceQueue'][_0x739c('0x56')]({'where':{'id':_0x366325[_0x739c('0x52')]['id']}})[_0x739c('0x37')](handleEntityNotFound(_0x34af99,null))[_0x739c('0x37')](function(_0x31619b){if(_0x31619b){return _0x31619b['removeBlackLists'](_0x366325[_0x739c('0x41')][_0x739c('0x82')]);}})[_0x739c('0x37')](function(_0x4a8d57){if(_0x4a8d57){return db[_0x739c('0x6d')][_0x739c('0x36')]({'where':{'ListId':_0x366325['query'][_0x739c('0x82')],'VoiceQueueId':_0x366325[_0x739c('0x52')]['id']}})[_0x739c('0x37')](function(){return _0x4a8d57;});}})[_0x739c('0x37')](respondWithStatusCode(_0x34af99,null))[_0x739c('0x51')](handleError(_0x34af99,null));}; \ No newline at end of file +var _0x510e=['createdAt','updatedAt','update','getHoppers','CmHopper','pick','VoiceQueueId','findAll','findOne','CmHopperHistory','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','User','online','interface','Agents','forEach','penalty','sequelize','transaction','TeamVoiceQueue','each','findOrCreate','upsert','format','SIP/%s','emit','removeTeams','ids','tq.TeamId','from','team_has_voice_queues','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','removeAgents','UserVoiceQueueRt','userVoiceQueue:remove','addAgents','spread','userVoiceQueue:save','isEmpty','push','voicePause','all','getAgents','getMembers','CmList','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','insert','into','cm_hopper','ListId','field','phone','scheduledAt','ContactId','CmListId','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','fromQuery','cm_contacts','cm_hopper_additional_phones','CmHopperId','h.id','ci.item','cm_contact_has_items','join','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','NOW()','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','value','find','type','name','UserProfileResource','destroy','end','sendStatus','error','send','index','map','VoiceQueue','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','VIRTUAL','merge','options','includeAll','include','rows','catch','show','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x510e,0x1ed));var _0xe510=function(_0x67f95e,_0x3ca797){_0x67f95e=_0x67f95e-0x0;var _0x538f5a=_0x510e[_0x67f95e];return _0x538f5a;};'use strict';var emlformat=require(_0xe510('0x0'));var rimraf=require(_0xe510('0x1'));var zipdir=require(_0xe510('0x2'));var jsonpatch=require(_0xe510('0x3'));var rp=require(_0xe510('0x4'));var moment=require(_0xe510('0x5'));var BPromise=require(_0xe510('0x6'));var Mustache=require(_0xe510('0x7'));var util=require(_0xe510('0x8'));var path=require('path');var sox=require(_0xe510('0x9'));var csv=require(_0xe510('0xa'));var ejs=require(_0xe510('0xb'));var fs=require('fs');var fs_extra=require(_0xe510('0xc'));var _=require(_0xe510('0xd'));var squel=require(_0xe510('0xe'));var crypto=require(_0xe510('0xf'));var jsforce=require(_0xe510('0x10'));var deskjs=require(_0xe510('0x11'));var toCsv=require(_0xe510('0xa'));var querystring=require(_0xe510('0x12'));var Papa=require(_0xe510('0x13'));var Redis=require(_0xe510('0x14'));var authService=require(_0xe510('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xe510('0x16'));var hardwareService=require(_0xe510('0x17'));var logger=require(_0xe510('0x18'))(_0xe510('0x19'));var utils=require(_0xe510('0x1a'));var config=require(_0xe510('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0xe510('0x1c'))['db'];config[_0xe510('0x1d')]=_[_0xe510('0x1e')](config[_0xe510('0x1d')],{'host':_0xe510('0x1f'),'port':0x18eb});var socket=require(_0xe510('0x20'))(new Redis(config[_0xe510('0x1d')]));require(_0xe510('0x21'))[_0xe510('0x22')](socket);function respondWithStatusCode(_0x3af96e,_0x2c92d8){_0x2c92d8=_0x2c92d8||0xcc;return function(_0x1ebbdd){if(_0x1ebbdd){return _0x3af96e['sendStatus'](_0x2c92d8);}return _0x3af96e[_0xe510('0x23')](_0x2c92d8)['end']();};}function respondWithResult(_0x574ce5,_0x62948d){_0x62948d=_0x62948d||0xc8;return function(_0x43b191){if(_0x43b191){return _0x574ce5[_0xe510('0x23')](_0x62948d)[_0xe510('0x24')](_0x43b191);}};}function respondWithFilteredResult(_0x9b92b0,_0x1754e){return function(_0x268736){if(_0x268736){var _0x3831f4=typeof _0x1754e['offset']===_0xe510('0x25')&&typeof _0x1754e[_0xe510('0x26')]===_0xe510('0x25');var _0x4dd3d8=_0x268736[_0xe510('0x27')];var _0x228d03=_0x3831f4?0x0:_0x1754e[_0xe510('0x28')];var _0x55222e=_0x3831f4?_0x268736[_0xe510('0x27')]:_0x1754e[_0xe510('0x28')]+_0x1754e['limit'];var _0x269596;if(_0x55222e>=_0x4dd3d8){_0x55222e=_0x4dd3d8;_0x269596=0xc8;}else{_0x269596=0xce;}_0x9b92b0[_0xe510('0x23')](_0x269596);return _0x9b92b0['set'](_0xe510('0x29'),_0x228d03+'-'+_0x55222e+'/'+_0x4dd3d8)[_0xe510('0x24')](_0x268736);}return null;};}function patchUpdates(_0x4a0c3d){return function(_0x35e2da){try{jsonpatch[_0xe510('0x2a')](_0x35e2da,_0x4a0c3d,!![]);}catch(_0x2ba74a){return BPromise[_0xe510('0x2b')](_0x2ba74a);}return _0x35e2da[_0xe510('0x2c')]();};}function saveUpdates(_0x4c034f,_0x3c3b0a){return function(_0x49da46){if(_0x49da46){return _0x49da46['update'](_0x4c034f)['then'](function(_0x4425ee){return _0x4425ee;});}return null;};}function removeEntity(_0x26988f,_0x5abf44){return function(_0x2bfe96){if(_0x2bfe96){return _0x2bfe96['destroy']()[_0xe510('0x2d')](function(){var _0x45ea1e=_0x2bfe96[_0xe510('0x2e')]({'plain':!![]});var _0x35fa1a=[{'name':_0xe510('0x2f'),'value':_0xe510('0x30'),'ignore':![]},{'name':_0xe510('0x31'),'value':_0xe510('0x32'),'ignore':![]}];var _0x24be64=_(_0x35fa1a)[_0xe510('0x33')](_0xe510('0x34'))['map'](_0xe510('0x35'))[_0xe510('0x35')]();if(_['includes'](_0x24be64,_0x45ea1e['type'])){return;}var _0x171685=_[_0xe510('0x36')](_0x35fa1a,['value',_0x45ea1e[_0xe510('0x37')]])[_0xe510('0x38')];return db[_0xe510('0x39')][_0xe510('0x3a')]({'where':{'type':_0x171685,'resourceId':_0x45ea1e['id']}})[_0xe510('0x2d')](function(){return _0x2bfe96;});})['then'](function(){_0x26988f[_0xe510('0x23')](0xcc)[_0xe510('0x3b')]();});}};}function handleEntityNotFound(_0x1d6a9c,_0x150059){return function(_0x92352b){if(!_0x92352b){_0x1d6a9c[_0xe510('0x3c')](0x194);}return _0x92352b;};}function handleError(_0x2a35bd,_0x3f75f5){_0x3f75f5=_0x3f75f5||0x1f4;return function(_0xf83f9f){logger[_0xe510('0x3d')](_0xf83f9f['stack']);if(_0xf83f9f[_0xe510('0x38')]){delete _0xf83f9f[_0xe510('0x38')];}_0x2a35bd[_0xe510('0x23')](_0x3f75f5)[_0xe510('0x3e')](_0xf83f9f);};}exports[_0xe510('0x3f')]=function(_0x378870,_0xa95d2b){var _0x142b5e={},_0x3b8009={},_0x2f971a={'count':0x0,'rows':[]};var _0x22b714=_[_0xe510('0x40')](db[_0xe510('0x41')][_0xe510('0x42')],function(_0xff73e4){return{'name':_0xff73e4[_0xe510('0x43')],'type':_0xff73e4[_0xe510('0x37')]['key']};});_0x3b8009[_0xe510('0x44')]=_[_0xe510('0x40')](_0x22b714,'name');_0x3b8009[_0xe510('0x45')]=_[_0xe510('0x46')](_0x378870['query']);_0x3b8009['filters']=_[_0xe510('0x47')](_0x3b8009[_0xe510('0x44')],_0x3b8009[_0xe510('0x45')]);_0x142b5e[_0xe510('0x48')]=_['intersection'](_0x3b8009[_0xe510('0x44')],qs['fields'](_0x378870[_0xe510('0x45')][_0xe510('0x49')]));_0x142b5e[_0xe510('0x48')]=_0x142b5e['attributes'][_0xe510('0x4a')]?_0x142b5e[_0xe510('0x48')]:_0x3b8009[_0xe510('0x44')];if(!_0x378870[_0xe510('0x45')][_0xe510('0x4b')](_0xe510('0x4c'))){_0x142b5e[_0xe510('0x26')]=qs[_0xe510('0x26')](_0x378870[_0xe510('0x45')][_0xe510('0x26')]);_0x142b5e[_0xe510('0x28')]=qs[_0xe510('0x28')](_0x378870[_0xe510('0x45')][_0xe510('0x28')]);}_0x142b5e[_0xe510('0x4d')]=qs[_0xe510('0x4e')](_0x378870[_0xe510('0x45')][_0xe510('0x4e')]);_0x142b5e[_0xe510('0x4f')]=qs['filters'](_['pick'](_0x378870['query'],_0x3b8009[_0xe510('0x50')]),_0x22b714);if(_0x378870[_0xe510('0x45')][_0xe510('0x33')]){_0x142b5e[_0xe510('0x4f')]=_['merge'](_0x142b5e['where'],{'$or':_[_0xe510('0x40')](_0x22b714,function(_0x2df9da){if(_0x2df9da['type']!==_0xe510('0x51')){var _0xe12644={};_0xe12644[_0x2df9da['name']]={'$like':'%'+_0x378870[_0xe510('0x45')][_0xe510('0x33')]+'%'};return _0xe12644;}})});}_0x142b5e=_[_0xe510('0x52')]({},_0x142b5e,_0x378870[_0xe510('0x53')]);var _0x4cfa80={'where':_0x142b5e[_0xe510('0x4f')]};return db[_0xe510('0x41')][_0xe510('0x27')](_0x4cfa80)['then'](function(_0x1ef45f){_0x2f971a[_0xe510('0x27')]=_0x1ef45f;if(_0x378870['query'][_0xe510('0x54')]){_0x142b5e[_0xe510('0x55')]=[{'all':!![]}];}return db[_0xe510('0x41')]['findAll'](_0x142b5e);})[_0xe510('0x2d')](function(_0x4b5b3c){_0x2f971a[_0xe510('0x56')]=_0x4b5b3c;return _0x2f971a;})[_0xe510('0x2d')](respondWithFilteredResult(_0xa95d2b,_0x142b5e))[_0xe510('0x57')](handleError(_0xa95d2b,null));};exports[_0xe510('0x58')]=function(_0x4e02e0,_0x2f315a){var _0x5621f9={'raw':![],'where':{'id':_0x4e02e0['params']['id']}},_0x1b89d6={};_0x1b89d6['model']=_['keys'](db[_0xe510('0x41')]['rawAttributes']);_0x1b89d6['query']=_['keys'](_0x4e02e0[_0xe510('0x45')]);_0x1b89d6[_0xe510('0x50')]=_[_0xe510('0x47')](_0x1b89d6[_0xe510('0x44')],_0x1b89d6['query']);_0x5621f9[_0xe510('0x48')]=_[_0xe510('0x47')](_0x1b89d6[_0xe510('0x44')],qs[_0xe510('0x49')](_0x4e02e0['query']['fields']));_0x5621f9['attributes']=_0x5621f9[_0xe510('0x48')][_0xe510('0x4a')]?_0x5621f9[_0xe510('0x48')]:_0x1b89d6[_0xe510('0x44')];if(_0x4e02e0[_0xe510('0x45')]['includeAll']){_0x5621f9[_0xe510('0x55')]=[{'all':!![]}];}_0x5621f9=_['merge']({},_0x5621f9,_0x4e02e0[_0xe510('0x53')]);return db['VoiceQueue']['find'](_0x5621f9)[_0xe510('0x2d')](handleEntityNotFound(_0x2f315a,null))[_0xe510('0x2d')](respondWithResult(_0x2f315a,null))['catch'](handleError(_0x2f315a,null));};exports[_0xe510('0x59')]=function(_0xa9ce64,_0x46170d){return db[_0xe510('0x41')][_0xe510('0x59')](_0xa9ce64[_0xe510('0x5a')],{})['then'](function(_0x315349){var _0x104e95=_0xa9ce64['user']['get']({'plain':!![]});if(!_0x104e95)throw new Error(_0xe510('0x5b'));if(_0x104e95[_0xe510('0x5c')]===_0xe510('0x5d')){var _0x234f77=_0x315349[_0xe510('0x2e')]({'plain':!![]});var _0x253587=[{'name':_0xe510('0x2f'),'value':'inbound'},{'name':'QueueCampaigns','value':_0xe510('0x32')}];var _0x220d16=_['find'](_0x253587,[_0xe510('0x35'),_0x234f77[_0xe510('0x37')]])[_0xe510('0x38')];return db[_0xe510('0x5e')][_0xe510('0x36')]({'where':{'name':_0x220d16,'userProfileId':_0x104e95[_0xe510('0x5f')]},'raw':!![]})['then'](function(_0x57b7fc){if(_0x57b7fc&&_0x57b7fc[_0xe510('0x60')]===0x0){return db[_0xe510('0x39')]['create']({'name':_0x234f77[_0xe510('0x38')],'resourceId':_0x234f77['id'],'type':_0x57b7fc[_0xe510('0x38')],'sectionId':_0x57b7fc['id']},{})[_0xe510('0x2d')](function(){return _0x315349;});}else{return _0x315349;}})['catch'](function(_0xaedb98){logger[_0xe510('0x3d')](_0xe510('0x61'),_0xaedb98);throw _0xaedb98;});}return _0x315349;})[_0xe510('0x2d')](respondWithResult(_0x46170d,0xc9))['catch'](handleError(_0x46170d,null));};exports[_0xe510('0x62')]=function(_0x4b7f96,_0x343152){var _0x53a070={'where':{'id':_0x4b7f96[_0xe510('0x63')]['id']}},_0x3ce31a={};_0x3ce31a[_0xe510('0x44')]=_[_0xe510('0x46')](db[_0xe510('0x41')]['rawAttributes']);_0x53a070['attributes']=_[_0xe510('0x47')](_0x3ce31a[_0xe510('0x44')],qs['fields'](_0x4b7f96[_0xe510('0x45')]['fields']));_0x53a070[_0xe510('0x48')]=_0x53a070['attributes']['length']?_0x53a070['attributes']:_0x3ce31a[_0xe510('0x44')];if(_0x4b7f96[_0xe510('0x45')][_0xe510('0x54')]){_0x53a070[_0xe510('0x55')]=[{'all':!![]}];}_0x53a070=_[_0xe510('0x52')]({},_0x53a070,_0x4b7f96[_0xe510('0x53')]);return db[_0xe510('0x41')][_0xe510('0x36')](_0x53a070)[_0xe510('0x2d')](handleEntityNotFound(_0x343152,null))[_0xe510('0x2d')](function(_0x2184b0){if(_0x2184b0){var _0x27eee7=_0x2184b0[_0xe510('0x2e')]({'plain':!![]});_0x27eee7=qs[_0xe510('0x64')](_0x27eee7,['id',_0xe510('0x65'),_0xe510('0x66')]);_0x4b7f96['body']=_['omit'](_0x4b7f96[_0xe510('0x5a')],['id',_0xe510('0x65'),_0xe510('0x66')]);return db[_0xe510('0x41')][_0xe510('0x59')](_['merge'](_0x27eee7,_0x4b7f96[_0xe510('0x5a')]),{'include':_0x4b7f96[_0xe510('0x45')][_0xe510('0x54')]?[{'all':!![]}]:undefined})[_0xe510('0x2d')](function(_0x331ba2){var _0x1481ec=_0x4b7f96[_0xe510('0x5d')][_0xe510('0x2e')]({'plain':!![]});if(!_0x1481ec)throw new Error(_0xe510('0x5b'));if(_0x1481ec['role']===_0xe510('0x5d')){var _0x2fe5c5=_0x331ba2[_0xe510('0x2e')]({'plain':!![]});var _0x1930fc=[{'name':'VoiceQueues','value':_0xe510('0x30')},{'name':_0xe510('0x31'),'value':'outbound'}];var _0x3093ad=_[_0xe510('0x36')](_0x1930fc,[_0xe510('0x35'),_0x2fe5c5[_0xe510('0x37')]])[_0xe510('0x38')];return db[_0xe510('0x5e')][_0xe510('0x36')]({'where':{'name':_0x3093ad,'userProfileId':_0x1481ec[_0xe510('0x5f')]},'raw':!![]})[_0xe510('0x2d')](function(_0x3a6951){if(_0x3a6951&&_0x3a6951[_0xe510('0x60')]===0x0){return db[_0xe510('0x39')][_0xe510('0x59')]({'name':_0x2fe5c5[_0xe510('0x38')],'resourceId':_0x2fe5c5['id'],'type':_0x3a6951[_0xe510('0x38')],'sectionId':_0x3a6951['id']},{})['then'](function(){return _0x331ba2;});}else{return _0x331ba2;}})[_0xe510('0x57')](function(_0x55235d){logger[_0xe510('0x3d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x55235d);throw _0x55235d;});}return _0x331ba2;});}})[_0xe510('0x2d')](respondWithResult(_0x343152,0xc9))['catch'](handleError(_0x343152,null));};exports[_0xe510('0x67')]=function(_0x5dfc91,_0x3ed73e){if(_0x5dfc91[_0xe510('0x5a')]['id']){delete _0x5dfc91['body']['id'];}return db['VoiceQueue'][_0xe510('0x36')]({'where':{'id':_0x5dfc91[_0xe510('0x63')]['id']}})[_0xe510('0x2d')](handleEntityNotFound(_0x3ed73e,null))['then'](saveUpdates(_0x5dfc91[_0xe510('0x5a')],null))[_0xe510('0x2d')](respondWithResult(_0x3ed73e,null))[_0xe510('0x57')](handleError(_0x3ed73e,null));};exports[_0xe510('0x3a')]=function(_0xb6aed8,_0x48263a){return db['VoiceQueue'][_0xe510('0x36')]({'where':{'id':_0xb6aed8[_0xe510('0x63')]['id']}})[_0xe510('0x2d')](handleEntityNotFound(_0x48263a,null))[_0xe510('0x2d')](removeEntity(_0x48263a,null))[_0xe510('0x57')](handleError(_0x48263a,null));};exports[_0xe510('0x68')]=function(_0x44611e,_0x1509f5,_0x355642){var _0x5df664={'raw':![],'where':{}};var _0x2222c6={};var _0x4358d9={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x44611e[_0xe510('0x63')]['id']}})['then'](handleEntityNotFound(_0x1509f5,null))[_0xe510('0x2d')](function(_0x4136d4){if(_0x4136d4){_0x2222c6[_0xe510('0x44')]=_['keys'](db[_0xe510('0x69')]['rawAttributes']);_0x2222c6[_0xe510('0x45')]=_[_0xe510('0x46')](_0x44611e[_0xe510('0x45')]);_0x2222c6[_0xe510('0x50')]=_[_0xe510('0x47')](_0x2222c6[_0xe510('0x44')],_0x2222c6[_0xe510('0x45')]);_0x5df664['attributes']=_['intersection'](_0x2222c6[_0xe510('0x44')],qs[_0xe510('0x49')](_0x44611e[_0xe510('0x45')]['fields']));_0x5df664[_0xe510('0x48')]=_0x5df664[_0xe510('0x48')]['length']?_0x5df664[_0xe510('0x48')]:_0x2222c6[_0xe510('0x44')];if(!_0x44611e[_0xe510('0x45')]['hasOwnProperty']('nolimit')){_0x5df664['limit']=qs[_0xe510('0x26')](_0x44611e[_0xe510('0x45')][_0xe510('0x26')]);_0x5df664['offset']=qs[_0xe510('0x28')](_0x44611e[_0xe510('0x45')][_0xe510('0x28')]);}_0x5df664['order']=qs[_0xe510('0x4e')](_0x44611e[_0xe510('0x45')][_0xe510('0x4e')]);_0x5df664[_0xe510('0x4f')]=qs[_0xe510('0x50')](_[_0xe510('0x6a')](_0x44611e['query'],_0x2222c6['filters']));_0x5df664[_0xe510('0x4f')][_0xe510('0x6b')]=_0x4136d4['id'];if(_0x44611e[_0xe510('0x45')][_0xe510('0x33')]){_0x5df664[_0xe510('0x4f')]=_[_0xe510('0x52')](_0x5df664[_0xe510('0x4f')],{'$or':_[_0xe510('0x40')](_0x5df664[_0xe510('0x48')],function(_0x95de4c){var _0x17abe8={};_0x17abe8[_0x95de4c]={'$like':'%'+_0x44611e[_0xe510('0x45')][_0xe510('0x33')]+'%'};return _0x17abe8;})});}_0x5df664=_['merge']({},_0x5df664,_0x44611e[_0xe510('0x53')]);return db['CmHopper'][_0xe510('0x27')]({'where':_0x5df664[_0xe510('0x4f')]})['then'](function(_0x29689c){_0x4358d9[_0xe510('0x27')]=_0x29689c;if(_0x44611e['query'][_0xe510('0x54')]){_0x5df664[_0xe510('0x55')]=[{'all':!![]}];}return db[_0xe510('0x69')][_0xe510('0x6c')](_0x5df664);})[_0xe510('0x2d')](function(_0x210ff2){_0x4358d9[_0xe510('0x56')]=_0x210ff2;return _0x4358d9;});}})[_0xe510('0x2d')](respondWithFilteredResult(_0x1509f5,_0x5df664))[_0xe510('0x57')](handleError(_0x1509f5,null));};exports['getHopperHistories']=function(_0x2fd763,_0x2fa086,_0x47412f){var _0x4c4ff1={'raw':!![],'where':{}};var _0x3b0331={};var _0x48eb9d={'count':0x0,'rows':[]};return db[_0xe510('0x41')][_0xe510('0x6d')]({'where':{'id':_0x2fd763[_0xe510('0x63')]['id']}})[_0xe510('0x2d')](handleEntityNotFound(_0x2fa086,null))['then'](function(_0xe996cb){if(_0xe996cb){_0x3b0331['model']=_[_0xe510('0x46')](db['CmHopperHistory'][_0xe510('0x42')]);_0x3b0331[_0xe510('0x45')]=_[_0xe510('0x46')](_0x2fd763['query']);_0x3b0331[_0xe510('0x50')]=_[_0xe510('0x47')](_0x3b0331[_0xe510('0x44')],_0x3b0331[_0xe510('0x45')]);_0x4c4ff1[_0xe510('0x48')]=_[_0xe510('0x47')](_0x3b0331[_0xe510('0x44')],qs['fields'](_0x2fd763[_0xe510('0x45')][_0xe510('0x49')]));_0x4c4ff1[_0xe510('0x48')]=_0x4c4ff1[_0xe510('0x48')][_0xe510('0x4a')]?_0x4c4ff1[_0xe510('0x48')]:_0x3b0331[_0xe510('0x44')];if(!_0x2fd763['query'][_0xe510('0x4b')](_0xe510('0x4c'))){_0x4c4ff1[_0xe510('0x26')]=qs[_0xe510('0x26')](_0x2fd763['query'][_0xe510('0x26')]);_0x4c4ff1[_0xe510('0x28')]=qs[_0xe510('0x28')](_0x2fd763[_0xe510('0x45')][_0xe510('0x28')]);}_0x4c4ff1[_0xe510('0x4d')]=qs[_0xe510('0x4e')](_0x2fd763[_0xe510('0x45')][_0xe510('0x4e')]);_0x4c4ff1[_0xe510('0x4f')]=qs['filters'](_[_0xe510('0x6a')](_0x2fd763[_0xe510('0x45')],_0x3b0331[_0xe510('0x50')]));_0x4c4ff1[_0xe510('0x4f')][_0xe510('0x6b')]=_0xe996cb['id'];if(_0x2fd763[_0xe510('0x45')]['filter']){_0x4c4ff1[_0xe510('0x4f')]=_[_0xe510('0x52')](_0x4c4ff1['where'],{'$or':_[_0xe510('0x40')](_0x4c4ff1[_0xe510('0x48')],function(_0x30aa02){var _0x45225b={};_0x45225b[_0x30aa02]={'$like':'%'+_0x2fd763[_0xe510('0x45')][_0xe510('0x33')]+'%'};return _0x45225b;})});}_0x4c4ff1=_[_0xe510('0x52')]({},_0x4c4ff1,_0x2fd763[_0xe510('0x53')]);return db[_0xe510('0x6e')][_0xe510('0x27')]({'where':_0x4c4ff1['where']})[_0xe510('0x2d')](function(_0x3b7c41){_0x48eb9d[_0xe510('0x27')]=_0x3b7c41;if(_0x2fd763[_0xe510('0x45')]['includeAll']){_0x4c4ff1[_0xe510('0x55')]=[{'all':!![]}];}return db[_0xe510('0x6e')][_0xe510('0x6c')](_0x4c4ff1);})[_0xe510('0x2d')](function(_0x46f1a2){_0x48eb9d[_0xe510('0x56')]=_0x46f1a2;return _0x48eb9d;});}})[_0xe510('0x2d')](respondWithFilteredResult(_0x2fa086,_0x4c4ff1))[_0xe510('0x57')](handleError(_0x2fa086,null));};exports['getHopperFinals']=function(_0xaf1c,_0x2cfbb7,_0x5b639b){var _0x5f2c79={'raw':!![],'where':{}};var _0x28d0fc={};var _0x3683da={'count':0x0,'rows':[]};return db[_0xe510('0x41')][_0xe510('0x6d')]({'where':{'id':_0xaf1c[_0xe510('0x63')]['id']}})[_0xe510('0x2d')](handleEntityNotFound(_0x2cfbb7,null))[_0xe510('0x2d')](function(_0x44f406){if(_0x44f406){_0x28d0fc['model']=_['keys'](db['CmHopperFinal'][_0xe510('0x42')]);_0x28d0fc[_0xe510('0x45')]=_[_0xe510('0x46')](_0xaf1c[_0xe510('0x45')]);_0x28d0fc[_0xe510('0x50')]=_[_0xe510('0x47')](_0x28d0fc[_0xe510('0x44')],_0x28d0fc['query']);_0x5f2c79[_0xe510('0x48')]=_[_0xe510('0x47')](_0x28d0fc['model'],qs['fields'](_0xaf1c[_0xe510('0x45')]['fields']));_0x5f2c79[_0xe510('0x48')]=_0x5f2c79[_0xe510('0x48')][_0xe510('0x4a')]?_0x5f2c79['attributes']:_0x28d0fc[_0xe510('0x44')];if(!_0xaf1c[_0xe510('0x45')][_0xe510('0x4b')](_0xe510('0x4c'))){_0x5f2c79[_0xe510('0x26')]=qs[_0xe510('0x26')](_0xaf1c[_0xe510('0x45')][_0xe510('0x26')]);_0x5f2c79[_0xe510('0x28')]=qs[_0xe510('0x28')](_0xaf1c[_0xe510('0x45')][_0xe510('0x28')]);}_0x5f2c79['order']=qs['sort'](_0xaf1c[_0xe510('0x45')][_0xe510('0x4e')]);_0x5f2c79[_0xe510('0x4f')]=qs[_0xe510('0x50')](_[_0xe510('0x6a')](_0xaf1c[_0xe510('0x45')],_0x28d0fc['filters']));_0x5f2c79[_0xe510('0x4f')]['VoiceQueueId']=_0x44f406['id'];if(_0xaf1c[_0xe510('0x45')][_0xe510('0x33')]){_0x5f2c79[_0xe510('0x4f')]=_[_0xe510('0x52')](_0x5f2c79[_0xe510('0x4f')],{'$or':_[_0xe510('0x40')](_0x5f2c79[_0xe510('0x48')],function(_0x3c1228){var _0x52a8e8={};_0x52a8e8[_0x3c1228]={'$like':'%'+_0xaf1c[_0xe510('0x45')]['filter']+'%'};return _0x52a8e8;})});}_0x5f2c79=_[_0xe510('0x52')]({},_0x5f2c79,_0xaf1c[_0xe510('0x53')]);return db[_0xe510('0x6f')]['count']({'where':_0x5f2c79[_0xe510('0x4f')]})[_0xe510('0x2d')](function(_0x81c769){_0x3683da[_0xe510('0x27')]=_0x81c769;if(_0xaf1c[_0xe510('0x45')][_0xe510('0x54')]){_0x5f2c79[_0xe510('0x55')]=[{'all':!![]}];}return db[_0xe510('0x6f')][_0xe510('0x6c')](_0x5f2c79);})[_0xe510('0x2d')](function(_0x42070e){_0x3683da['rows']=_0x42070e;return _0x3683da;});}})[_0xe510('0x2d')](respondWithFilteredResult(_0x2cfbb7,_0x5f2c79))[_0xe510('0x57')](handleError(_0x2cfbb7,null));};exports['getHopperBlacks']=function(_0x15dcb6,_0x1fed7e,_0xa4aa88){var _0x4ab11a={'raw':!![],'where':{}};var _0x1fe133={};var _0x210ecd={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xe510('0x6d')]({'where':{'id':_0x15dcb6[_0xe510('0x63')]['id']}})[_0xe510('0x2d')](handleEntityNotFound(_0x1fed7e,null))['then'](function(_0x19c562){if(_0x19c562){_0x1fe133[_0xe510('0x44')]=_[_0xe510('0x46')](db[_0xe510('0x70')][_0xe510('0x42')]);_0x1fe133['query']=_[_0xe510('0x46')](_0x15dcb6[_0xe510('0x45')]);_0x1fe133[_0xe510('0x50')]=_[_0xe510('0x47')](_0x1fe133[_0xe510('0x44')],_0x1fe133['query']);_0x4ab11a['attributes']=_['intersection'](_0x1fe133[_0xe510('0x44')],qs[_0xe510('0x49')](_0x15dcb6['query'][_0xe510('0x49')]));_0x4ab11a[_0xe510('0x48')]=_0x4ab11a[_0xe510('0x48')][_0xe510('0x4a')]?_0x4ab11a[_0xe510('0x48')]:_0x1fe133[_0xe510('0x44')];if(!_0x15dcb6[_0xe510('0x45')][_0xe510('0x4b')](_0xe510('0x4c'))){_0x4ab11a[_0xe510('0x26')]=qs[_0xe510('0x26')](_0x15dcb6['query'][_0xe510('0x26')]);_0x4ab11a[_0xe510('0x28')]=qs[_0xe510('0x28')](_0x15dcb6['query'][_0xe510('0x28')]);}_0x4ab11a[_0xe510('0x4d')]=qs[_0xe510('0x4e')](_0x15dcb6[_0xe510('0x45')]['sort']);_0x4ab11a[_0xe510('0x4f')]=qs[_0xe510('0x50')](_[_0xe510('0x6a')](_0x15dcb6[_0xe510('0x45')],_0x1fe133['filters']));_0x4ab11a[_0xe510('0x4f')]['VoiceQueueId']=_0x19c562['id'];if(_0x15dcb6[_0xe510('0x45')][_0xe510('0x33')]){_0x4ab11a[_0xe510('0x4f')]=_[_0xe510('0x52')](_0x4ab11a[_0xe510('0x4f')],{'$or':_[_0xe510('0x40')](_0x4ab11a[_0xe510('0x48')],function(_0x111dc8){var _0x46df5d={};_0x46df5d[_0x111dc8]={'$like':'%'+_0x15dcb6[_0xe510('0x45')][_0xe510('0x33')]+'%'};return _0x46df5d;})});}_0x4ab11a=_[_0xe510('0x52')]({},_0x4ab11a,_0x15dcb6[_0xe510('0x53')]);return db[_0xe510('0x70')][_0xe510('0x27')]({'where':_0x4ab11a['where']})[_0xe510('0x2d')](function(_0x1718cd){_0x210ecd[_0xe510('0x27')]=_0x1718cd;if(_0x15dcb6[_0xe510('0x45')][_0xe510('0x54')]){_0x4ab11a[_0xe510('0x55')]=[{'all':!![]}];}return db[_0xe510('0x70')]['findAll'](_0x4ab11a);})[_0xe510('0x2d')](function(_0x18fadf){_0x210ecd[_0xe510('0x56')]=_0x18fadf;return _0x210ecd;});}})[_0xe510('0x2d')](respondWithFilteredResult(_0x1fed7e,_0x4ab11a))[_0xe510('0x57')](handleError(_0x1fed7e,null));};exports[_0xe510('0x71')]=function(_0x3564ac,_0x622e1c,_0x3bb6a6){var _0x582700={};var _0x356c34={};var _0x3c89e4;var _0x4a3cb9;return db[_0xe510('0x41')][_0xe510('0x6d')]({'where':{'id':_0x3564ac['params']['id']}})[_0xe510('0x2d')](handleEntityNotFound(_0x622e1c,null))[_0xe510('0x2d')](function(_0x5bbb83){if(_0x5bbb83){_0x3c89e4=_0x5bbb83;_0x356c34['model']=_[_0xe510('0x46')](db[_0xe510('0x72')][_0xe510('0x42')]);_0x356c34[_0xe510('0x45')]=_[_0xe510('0x46')](_0x3564ac[_0xe510('0x45')]);_0x356c34[_0xe510('0x50')]=_[_0xe510('0x47')](_0x356c34[_0xe510('0x44')],_0x356c34[_0xe510('0x45')]);_0x582700[_0xe510('0x48')]=_['intersection'](_0x356c34[_0xe510('0x44')],qs[_0xe510('0x49')](_0x3564ac[_0xe510('0x45')][_0xe510('0x49')]));_0x582700[_0xe510('0x48')]=_0x582700['attributes'][_0xe510('0x4a')]?_0x582700[_0xe510('0x48')]:_0x356c34[_0xe510('0x44')];_0x582700[_0xe510('0x4d')]=qs[_0xe510('0x4e')](_0x3564ac[_0xe510('0x45')][_0xe510('0x4e')]);_0x582700['where']=qs[_0xe510('0x50')](_[_0xe510('0x6a')](_0x3564ac['query'],_0x356c34['filters']));if(_0x3564ac[_0xe510('0x45')][_0xe510('0x33')]){_0x582700[_0xe510('0x4f')]=_[_0xe510('0x52')](_0x582700[_0xe510('0x4f')],{'$or':_[_0xe510('0x40')](_0x582700[_0xe510('0x48')],function(_0x3200d2){var _0x250b6e={};_0x250b6e[_0x3200d2]={'$like':'%'+_0x3564ac['query'][_0xe510('0x33')]+'%'};return _0x250b6e;})});}_0x582700=_[_0xe510('0x52')]({},_0x582700,_0x3564ac['options']);return _0x3c89e4[_0xe510('0x71')](_0x582700);}})['then'](function(_0x34a930){if(_0x34a930){_0x4a3cb9=_0x34a930[_0xe510('0x4a')];if(!_0x3564ac[_0xe510('0x45')]['hasOwnProperty']('nolimit')){_0x582700['limit']=qs[_0xe510('0x26')](_0x3564ac['query'][_0xe510('0x26')]);_0x582700[_0xe510('0x28')]=qs[_0xe510('0x28')](_0x3564ac[_0xe510('0x45')][_0xe510('0x28')]);}return _0x3c89e4[_0xe510('0x71')](_0x582700);}})[_0xe510('0x2d')](function(_0x582572){if(_0x582572){return _0x582572?{'count':_0x4a3cb9,'rows':_0x582572}:null;}})[_0xe510('0x2d')](respondWithResult(_0x622e1c,null))[_0xe510('0x57')](handleError(_0x622e1c,null));};exports[_0xe510('0x73')]=function(_0x550e45,_0x1baf99,_0x176463){var _0x183d00=_0x550e45[_0xe510('0x5a')]['teams'];var _0x29c8df=_[_0xe510('0x40')](_0x183d00,'id');return db['Team'][_0xe510('0x6c')]({'where':{'id':_0x29c8df},'attributes':['id'],'include':[{'model':db[_0xe510('0x74')],'as':'Agents','attributes':['id',_0xe510('0x38'),_0xe510('0x75'),'voicePause',_0xe510('0x76')],'raw':!![]}]})[_0xe510('0x2d')](function(_0x17c8fa){if(_0x17c8fa){var _0x1a0171=_['flatMap'](_0x17c8fa,function(_0x50a495){var _0x156c55=_0x50a495[_0xe510('0x2e')]({'plain':!![]});_0x156c55[_0xe510('0x77')][_0xe510('0x78')](function(_0x280318){_0x280318[_0xe510('0x79')]=_['find'](_0x183d00,{'id':_0x156c55['id']})['penalty'];});return _0x156c55[_0xe510('0x77')];});return db[_0xe510('0x41')][_0xe510('0x36')]({'where':{'id':_0x550e45[_0xe510('0x63')]['id']}})[_0xe510('0x2d')](function(_0x2a56ca){return db[_0xe510('0x7a')][_0xe510('0x7b')](function(_0x372d0a){return _0x2a56ca['addTeams'](_0x29c8df,{'transaction':_0x372d0a})[_0xe510('0x2d')](function(){return BPromise['each'](_0x183d00,function(_0x5aea61){return db[_0xe510('0x7c')]['upsert']({'TeamId':_0x5aea61['id'],'VoiceQueueId':_0x550e45[_0xe510('0x63')]['id'],'penalty':_0x5aea61[_0xe510('0x79')]},{'transaction':_0x372d0a});});})['then'](function(){return BPromise[_0xe510('0x7d')](_0x1a0171,function(_0x5c1b6c){return db['UserVoiceQueue'][_0xe510('0x7e')]({'where':{'UserId':_0x5c1b6c['id'],'VoiceQueueId':_0x550e45[_0xe510('0x63')]['id']},'defaults':{'penalty':_0x5c1b6c[_0xe510('0x79')]},'transaction':_0x372d0a});});})[_0xe510('0x2d')](function(){return BPromise[_0xe510('0x7d')](_[_0xe510('0x33')](_0x1a0171,{'online':!![]}),function(_0x5c4e9e){return db['UserVoiceQueueRt'][_0xe510('0x7f')]({'membername':_0x5c4e9e['name'],'UserId':_0x5c4e9e['id'],'queue_name':_0x2a56ca[_0xe510('0x38')],'VoiceQueueId':_0x2a56ca['id'],'interface':_['isNil'](_0x5c4e9e[_0xe510('0x76')])?util[_0xe510('0x80')](_0xe510('0x81'),_0x5c4e9e['name']):_0x5c4e9e[_0xe510('0x76')],'paused':_0x5c4e9e['voicePause']||![],'penalty':_0x5c4e9e[_0xe510('0x79')]},{'transaction':_0x372d0a});});})[_0xe510('0x2d')](function(){_0x1a0171['forEach'](function(_0x452e1a){socket[_0xe510('0x82')]('userVoiceQueue:save',{'UserId':_0x452e1a['id'],'VoiceQueueId':_0x2a56ca['id']});});});});});}})[_0xe510('0x2d')](respondWithStatusCode(_0x1baf99,null))[_0xe510('0x57')](handleError(_0x1baf99,null));};exports[_0xe510('0x83')]=function(_0x45a2cb,_0x35f855,_0x5972aa){return db[_0xe510('0x72')][_0xe510('0x6c')]({'where':{'id':_0x45a2cb[_0xe510('0x45')][_0xe510('0x84')]},'attributes':['id'],'include':[{'model':db[_0xe510('0x74')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xe510('0x2d')](handleEntityNotFound(_0x35f855,null))[_0xe510('0x2d')](function(_0x5929d8){var _0x42fdb6=_['map'](_0x5929d8,'id');var _0x2145f2=[];var _0x2f9061=[];var _0x42eab0=squel['select']();_0x42eab0['field'](_0xe510('0x85'))[_0xe510('0x86')](_0xe510('0x87'),'tq')['join']('user_has_teams','ut',_0xe510('0x88'))['where']('VoiceQueueId\x20=\x20?',_0x45a2cb[_0xe510('0x63')]['id']);for(var _0x913720=0x0;_0x913720<_0x5929d8[_0xe510('0x4a')];_0x913720+=0x1){let _0x4a6c56=_0x5929d8[_0x913720];for(var _0x586721=0x0;_0x586721<_0x4a6c56[_0xe510('0x77')][_0xe510('0x4a')];_0x586721+=0x1){let _0x56b824=_0x4a6c56[_0xe510('0x77')][_0x586721];var _0x11c8df=_0x42eab0['clone']();_0x11c8df[_0xe510('0x4f')](_0xe510('0x89'),_0x56b824['id']);_0x2f9061['push'](db[_0xe510('0x7a')][_0xe510('0x45')](_0x11c8df[_0xe510('0x8a')](),{'type':db[_0xe510('0x7a')][_0xe510('0x8b')][_0xe510('0x8c')]})[_0xe510('0x2d')](function(_0x17edae){if(_0x17edae[_0xe510('0x4a')]===0x1){return _0x56b824['id'];}else{var _0x44378f=_[_0xe510('0x8d')](_[_0xe510('0x40')](_0x17edae,_0xe510('0x8e')),function(_0x31eb38){return _[_0xe510('0x8f')](_0x42fdb6,_0x31eb38);});if(_0x44378f){return _0x56b824['id'];}}}));}}return BPromise['all'](_0x2f9061)[_0xe510('0x2d')](function(_0x29453b){_0x2145f2=_(_0x2145f2)[_0xe510('0x90')](_0x29453b)[_0xe510('0x91')]()[_0xe510('0x35')]();return db['VoiceQueue']['find']({'where':{'id':_0x45a2cb[_0xe510('0x63')]['id']}})[_0xe510('0x2d')](function(_0x5196c4){return db[_0xe510('0x7a')][_0xe510('0x7b')](function(_0x13bbca){return _0x5196c4[_0xe510('0x83')](_0x45a2cb[_0xe510('0x45')][_0xe510('0x84')],{'transaction':_0x13bbca})[_0xe510('0x2d')](function(){if(!_['isEmpty'](_0x2145f2)){return _0x5196c4[_0xe510('0x92')](_0x2145f2,{'transaction':_0x13bbca})[_0xe510('0x2d')](function(){return db[_0xe510('0x93')]['destroy']({'where':{'VoiceQueueId':_0x45a2cb[_0xe510('0x63')]['id'],'UserId':_0x2145f2},'transaction':_0x13bbca});});}})[_0xe510('0x2d')](function(){_0x2145f2[_0xe510('0x78')](function(_0x25ba83){socket[_0xe510('0x82')](_0xe510('0x94'),{'UserId':_0x25ba83,'VoiceQueueId':_0x5196c4['id']});});});});});});})['then'](respondWithStatusCode(_0x35f855,null))[_0xe510('0x57')](handleError(_0x35f855,null));};exports[_0xe510('0x95')]=function(_0xd4948,_0xd94c19,_0x4b93a1){var _0x148004,_0x3ced9d;return db[_0xe510('0x41')][_0xe510('0x36')]({'where':{'id':_0xd4948[_0xe510('0x63')]['id']}})['then'](handleEntityNotFound(_0xd94c19,null))[_0xe510('0x2d')](function(_0x548eed){if(_0x548eed){_0x3ced9d=_0x548eed;return _0x548eed[_0xe510('0x95')](_0xd4948[_0xe510('0x5a')]['ids'],_[_0xe510('0x64')](_0xd4948[_0xe510('0x5a')],['ids','id'])||{})[_0xe510('0x96')](function(_0x1a7fea){for(var _0x2264c7=0x0;_0x2264c7<_0xd4948[_0xe510('0x5a')][_0xe510('0x84')][_0xe510('0x4a')];_0x2264c7+=0x1){socket[_0xe510('0x82')](_0xe510('0x97'),{'UserId':Number(_0xd4948[_0xe510('0x5a')][_0xe510('0x84')][_0x2264c7]),'VoiceQueueId':Number(_0xd4948['params']['id'])});}return _0x1a7fea;});}})['then'](function(_0x5d913e){_0x148004=_0x5d913e||[];if(_0x3ced9d){return db[_0xe510('0x74')][_0xe510('0x6c')]({'where':{'id':_0xd4948[_0xe510('0x5a')][_0xe510('0x84')]},'attributes':['id',_0xe510('0x38'),'online','voicePause',_0xe510('0x76')],'raw':!![]});}})[_0xe510('0x2d')](function(_0x437cdd){if(!_[_0xe510('0x98')](_0x437cdd)){var _0x3dc78e=[];for(var _0xd189c4=0x0;_0xd189c4<_0x437cdd[_0xe510('0x4a')];_0xd189c4++){if(_0x437cdd[_0xd189c4][_0xe510('0x75')]){_0x3dc78e[_0xe510('0x99')](db[_0xe510('0x93')][_0xe510('0x7f')]({'membername':_0x437cdd[_0xd189c4][_0xe510('0x38')],'UserId':_0x437cdd[_0xd189c4]['id'],'queue_name':_0x3ced9d[_0xe510('0x38')],'VoiceQueueId':_0x3ced9d['id'],'interface':_['isNil'](_0x437cdd[_0xd189c4][_0xe510('0x76')])?util[_0xe510('0x80')](_0xe510('0x81'),_0x437cdd[_0xd189c4][_0xe510('0x38')]):_0x437cdd[_0xd189c4]['interface'],'paused':_0x437cdd[_0xd189c4][_0xe510('0x9a')]||![],'penalty':_0xd4948[_0xe510('0x5a')]['penalty']||0x0}));}}return BPromise[_0xe510('0x9b')](_0x3dc78e);}})['then'](function(){return _0x148004;})[_0xe510('0x2d')](respondWithResult(_0xd94c19,null))[_0xe510('0x57')](handleError(_0xd94c19,null));};exports[_0xe510('0x92')]=function(_0x433181,_0x47e52e,_0x16afa9){return db[_0xe510('0x41')][_0xe510('0x36')]({'where':{'id':_0x433181[_0xe510('0x63')]['id']}})[_0xe510('0x2d')](handleEntityNotFound(_0x47e52e,null))['then'](function(_0xfa73a2){if(_0xfa73a2){return _0xfa73a2[_0xe510('0x92')](_0x433181[_0xe510('0x45')][_0xe510('0x84')])[_0xe510('0x2d')](function(){if(_['isArray'](_0x433181['query']['ids'])){for(var _0x41c5c9=0x0;_0x41c5c9<_0x433181[_0xe510('0x45')][_0xe510('0x84')]['length'];_0x41c5c9+=0x1){socket[_0xe510('0x82')](_0xe510('0x94'),{'UserId':Number(_0x433181[_0xe510('0x45')]['ids'][_0x41c5c9]),'VoiceQueueId':Number(_0x433181[_0xe510('0x63')]['id'])});}}else{socket['emit'](_0xe510('0x94'),{'UserId':Number(_0x433181['query'][_0xe510('0x84')]),'VoiceQueueId':Number(_0x433181[_0xe510('0x63')]['id'])});}});}})[_0xe510('0x2d')](function(_0x4b0b09){return db[_0xe510('0x93')]['destroy']({'where':{'VoiceQueueId':_0x433181[_0xe510('0x63')]['id'],'UserId':_0x433181[_0xe510('0x45')]['ids']}})[_0xe510('0x2d')](function(){return _0x4b0b09;});})['then'](respondWithStatusCode(_0x47e52e,null))[_0xe510('0x57')](handleError(_0x47e52e,null));};exports[_0xe510('0x9c')]=function(_0x11eaf1,_0x2f7c5c,_0x249649){var _0xaf683={};var _0x773c0e={};var _0x34b52a;var _0x1135c8;return db[_0xe510('0x41')][_0xe510('0x6d')]({'where':{'id':_0x11eaf1[_0xe510('0x63')]['id']}})['then'](handleEntityNotFound(_0x2f7c5c,null))[_0xe510('0x2d')](function(_0x4cfc6c){if(_0x4cfc6c){_0x34b52a=_0x4cfc6c;_0x773c0e[_0xe510('0x44')]=_[_0xe510('0x46')](db[_0xe510('0x74')][_0xe510('0x42')]);_0x773c0e[_0xe510('0x45')]=_['keys'](_0x11eaf1[_0xe510('0x45')]);_0x773c0e[_0xe510('0x50')]=_[_0xe510('0x47')](_0x773c0e[_0xe510('0x44')],_0x773c0e[_0xe510('0x45')]);_0xaf683['attributes']=_['intersection'](_0x773c0e[_0xe510('0x44')],qs[_0xe510('0x49')](_0x11eaf1['query'][_0xe510('0x49')]));_0xaf683[_0xe510('0x48')]=_0xaf683['attributes'][_0xe510('0x4a')]?_0xaf683['attributes']:_0x773c0e[_0xe510('0x44')];_0xaf683[_0xe510('0x4d')]=qs['sort'](_0x11eaf1[_0xe510('0x45')]['sort']);_0xaf683['where']=qs[_0xe510('0x50')](_[_0xe510('0x6a')](_0x11eaf1['query'],_0x773c0e[_0xe510('0x50')]));if(_0x11eaf1[_0xe510('0x45')][_0xe510('0x33')]){_0xaf683[_0xe510('0x4f')]=_[_0xe510('0x52')](_0xaf683[_0xe510('0x4f')],{'$or':_[_0xe510('0x40')](_0xaf683[_0xe510('0x48')],function(_0x1f334d){var _0x5daef8={};_0x5daef8[_0x1f334d]={'$like':'%'+_0x11eaf1['query'][_0xe510('0x33')]+'%'};return _0x5daef8;})});}_0xaf683=_['merge']({},_0xaf683,_0x11eaf1[_0xe510('0x53')]);return _0x34b52a[_0xe510('0x9c')](_0xaf683);}})[_0xe510('0x2d')](function(_0x40eecc){if(_0x40eecc){_0x1135c8=_0x40eecc[_0xe510('0x4a')];if(!_0x11eaf1[_0xe510('0x45')][_0xe510('0x4b')](_0xe510('0x4c'))){_0xaf683[_0xe510('0x26')]=qs[_0xe510('0x26')](_0x11eaf1[_0xe510('0x45')]['limit']);_0xaf683['offset']=qs['offset'](_0x11eaf1['query'][_0xe510('0x28')]);}return _0x34b52a[_0xe510('0x9c')](_0xaf683);}})['then'](function(_0x45a1a1){if(_0x45a1a1){return _0x45a1a1?{'count':_0x1135c8,'rows':_0x45a1a1}:null;}})['then'](respondWithResult(_0x2f7c5c,null))[_0xe510('0x57')](handleError(_0x2f7c5c,null));};exports['getMembers']=function(_0x30282b,_0x15bf05,_0x1cd7da){var _0x264659={};var _0x27a8a7={};var _0x33ad68;var _0x3ede03;return db['VoiceQueue'][_0xe510('0x6d')]({'where':{'id':_0x30282b[_0xe510('0x63')]['id']}})[_0xe510('0x2d')](handleEntityNotFound(_0x15bf05,null))['then'](function(_0x1df8fb){if(_0x1df8fb){_0x33ad68=_0x1df8fb;_0x27a8a7[_0xe510('0x44')]=_['keys'](db[_0xe510('0x93')]['rawAttributes']);_0x27a8a7[_0xe510('0x45')]=_[_0xe510('0x46')](_0x30282b['query']);_0x27a8a7[_0xe510('0x50')]=_['intersection'](_0x27a8a7[_0xe510('0x44')],_0x27a8a7['query']);_0x264659[_0xe510('0x48')]=_['intersection'](_0x27a8a7['model'],qs['fields'](_0x30282b['query'][_0xe510('0x49')]));_0x264659[_0xe510('0x48')]=_0x264659['attributes']['length']?_0x264659[_0xe510('0x48')]:_0x27a8a7[_0xe510('0x44')];_0x264659[_0xe510('0x4d')]=qs['sort'](_0x30282b[_0xe510('0x45')][_0xe510('0x4e')]);_0x264659[_0xe510('0x4f')]=qs[_0xe510('0x50')](_['pick'](_0x30282b[_0xe510('0x45')],_0x27a8a7[_0xe510('0x50')]));if(_0x30282b[_0xe510('0x45')]['filter']){_0x264659[_0xe510('0x4f')]=_['merge'](_0x264659[_0xe510('0x4f')],{'$or':_[_0xe510('0x40')](_0x264659['attributes'],function(_0x522294){var _0x36fe5b={};_0x36fe5b[_0x522294]={'$like':'%'+_0x30282b['query'][_0xe510('0x33')]+'%'};return _0x36fe5b;})});}_0x264659=_[_0xe510('0x52')]({},_0x264659,_0x30282b[_0xe510('0x53')]);return _0x33ad68[_0xe510('0x9d')](_0x264659);}})['then'](function(_0x53c2d0){if(_0x53c2d0){_0x3ede03=_0x53c2d0[_0xe510('0x4a')];if(!_0x30282b[_0xe510('0x45')]['hasOwnProperty'](_0xe510('0x4c'))){_0x264659['limit']=qs['limit'](_0x30282b[_0xe510('0x45')][_0xe510('0x26')]);_0x264659[_0xe510('0x28')]=qs[_0xe510('0x28')](_0x30282b[_0xe510('0x45')][_0xe510('0x28')]);}return _0x33ad68['getMembers'](_0x264659);}})[_0xe510('0x2d')](function(_0xbcfc7){return _0xbcfc7?{'count':_0x3ede03,'rows':_0xbcfc7}:null;})[_0xe510('0x2d')](respondWithResult(_0x15bf05,null))[_0xe510('0x57')](handleError(_0x15bf05,null));};exports['getLists']=function(_0x127dd6,_0x3822be,_0x510712){var _0x15eb81={};var _0xb77b00={};var _0x5d67d8;var _0x217c52;return db[_0xe510('0x41')]['findOne']({'where':{'id':_0x127dd6[_0xe510('0x63')]['id']}})[_0xe510('0x2d')](handleEntityNotFound(_0x3822be,null))[_0xe510('0x2d')](function(_0x15142c){if(_0x15142c){_0x5d67d8=_0x15142c;_0xb77b00[_0xe510('0x44')]=_['keys'](db[_0xe510('0x9e')][_0xe510('0x42')]);_0xb77b00[_0xe510('0x45')]=_[_0xe510('0x46')](_0x127dd6[_0xe510('0x45')]);_0xb77b00[_0xe510('0x50')]=_[_0xe510('0x47')](_0xb77b00['model'],_0xb77b00[_0xe510('0x45')]);_0x15eb81[_0xe510('0x48')]=_['intersection'](_0xb77b00[_0xe510('0x44')],qs['fields'](_0x127dd6['query']['fields']));_0x15eb81[_0xe510('0x48')]=_0x15eb81[_0xe510('0x48')][_0xe510('0x4a')]?_0x15eb81[_0xe510('0x48')]:_0xb77b00[_0xe510('0x44')];_0x15eb81[_0xe510('0x4d')]=qs[_0xe510('0x4e')](_0x127dd6[_0xe510('0x45')][_0xe510('0x4e')]);_0x15eb81['where']=qs[_0xe510('0x50')](_[_0xe510('0x6a')](_0x127dd6['query'],_0xb77b00[_0xe510('0x50')]));if(_0x127dd6[_0xe510('0x45')][_0xe510('0x33')]){_0x15eb81[_0xe510('0x4f')]=_[_0xe510('0x52')](_0x15eb81['where'],{'$or':_[_0xe510('0x40')](_0x15eb81[_0xe510('0x48')],function(_0x97845a){var _0x49a176={};_0x49a176[_0x97845a]={'$like':'%'+_0x127dd6[_0xe510('0x45')][_0xe510('0x33')]+'%'};return _0x49a176;})});}_0x15eb81=_[_0xe510('0x52')]({},_0x15eb81,_0x127dd6[_0xe510('0x53')]);return _0x5d67d8[_0xe510('0x9f')](_0x15eb81);}})[_0xe510('0x2d')](function(_0x2ab44e){if(_0x2ab44e){_0x217c52=_0x2ab44e[_0xe510('0x4a')];if(!_0x127dd6['query'][_0xe510('0x4b')]('nolimit')){_0x15eb81['limit']=qs[_0xe510('0x26')](_0x127dd6[_0xe510('0x45')]['limit']);_0x15eb81[_0xe510('0x28')]=qs['offset'](_0x127dd6[_0xe510('0x45')][_0xe510('0x28')]);}return _0x5d67d8['getLists'](_0x15eb81);}})[_0xe510('0x2d')](function(_0x1edc1b){if(_0x1edc1b){return _0x1edc1b?{'count':_0x217c52,'rows':_0x1edc1b}:null;}})[_0xe510('0x2d')](respondWithResult(_0x3822be,null))[_0xe510('0x57')](handleError(_0x3822be,null));};exports[_0xe510('0xa0')]=function(_0x12e63c,_0x1251ba,_0x4f3f78){var _0xd53ec5=moment()[_0xe510('0x80')](_0xe510('0xa1'));var _0x2865e1,_0x4d3e1a;return db['VoiceQueue'][_0xe510('0x36')]({'where':{'id':_0x12e63c[_0xe510('0x63')]['id']}})[_0xe510('0x2d')](handleEntityNotFound(_0x1251ba,null))[_0xe510('0x2d')](function(_0xed31b2){if(_0xed31b2){_0x4d3e1a=_0xed31b2;return _0xed31b2[_0xe510('0xa0')](_0x12e63c[_0xe510('0x5a')]['ids'],_[_0xe510('0x64')](_0x12e63c[_0xe510('0x5a')],[_0xe510('0x84'),'id'])||{});}return null;})[_0xe510('0x96')](function(_0x5472e3){var _0x44ffed;_0x2865e1=_0x5472e3||[];var _0x1c1599=[];if(_0x5472e3){for(var _0xc93fd0=0x0;_0xc93fd0<_0x5472e3[_0xe510('0x4a')];_0xc93fd0+=0x1){var _0x4ff135=_0x5472e3[_0xc93fd0][_0xe510('0x2e')]({'plain':!![]});_0x4d3e1a[_0xe510('0xa2')]=_0x12e63c['body'][_0xe510('0xa2')]?_0x12e63c[_0xe510('0x5a')][_0xe510('0xa2')]:_0x4d3e1a[_0xe510('0xa2')];switch(_0x4d3e1a['dialCheckDuplicateType']){case _0xe510('0xa3'):_0x44ffed=squel[_0xe510('0xa4')]()[_0xe510('0xa5')](_0xe510('0xa6'))['fromQuery'](['phone','scheduledAt','ContactId',_0xe510('0xa7'),_0xe510('0x6b'),'createdAt',_0xe510('0x66')],squel['select']()[_0xe510('0xa8')](_0xe510('0xa9'),_0xe510('0xa9'))[_0xe510('0xa8')]('\x27'+_0xd53ec5+'\x27',_0xe510('0xaa'))[_0xe510('0xa8')]('id',_0xe510('0xab'))[_0xe510('0xa8')](_0x4ff135[_0xe510('0xac')][_0xe510('0x8a')](),'ListId')[_0xe510('0xa8')](_0x12e63c[_0xe510('0x63')]['id'][_0xe510('0x8a')](),_0xe510('0x6b'))[_0xe510('0xa8')]('\x27'+_0xd53ec5+'\x27',_0xe510('0x65'))[_0xe510('0xa8')]('\x27'+_0xd53ec5+'\x27','updatedAt')[_0xe510('0x86')]('cm_contacts')[_0xe510('0x4f')](_0xe510('0xad'))[_0xe510('0x4f')](_0xe510('0xae'),_0x4ff135['CmListId']['toString']())[_0xe510('0x4f')](_0xe510('0xaf'))[_0xe510('0x4f')](_0xe510('0xb0'),squel[_0xe510('0xb1')]()['field'](_0xe510('0xb2'))[_0xe510('0x86')]('cm_hopper_final')['where'](_0xe510('0xb3'),_0x12e63c[_0xe510('0x63')]['id']['toString']()))['where'](_0xe510('0xb0'),squel[_0xe510('0xb1')]()['field'](_0xe510('0xb4'))['from'](_0xe510('0xa6'))[_0xe510('0x4f')](_0xe510('0xb3'),_0x12e63c[_0xe510('0x63')]['id'][_0xe510('0x8a')]())))[_0xe510('0x8a')]();break;case'onlyIfOpen':_0x44ffed=squel[_0xe510('0xa4')]()[_0xe510('0xa5')](_0xe510('0xa6'))['fromQuery']([_0xe510('0xa9'),'scheduledAt',_0xe510('0xab'),_0xe510('0xa7'),_0xe510('0x6b'),_0xe510('0x65'),'updatedAt'],squel[_0xe510('0xb1')]()[_0xe510('0xa8')](_0xe510('0xa9'),_0xe510('0xa9'))['field']('\x27'+_0xd53ec5+'\x27',_0xe510('0xaa'))[_0xe510('0xa8')]('id',_0xe510('0xab'))[_0xe510('0xa8')](_0x4ff135['CmListId'][_0xe510('0x8a')](),_0xe510('0xa7'))[_0xe510('0xa8')](_0x12e63c['params']['id'][_0xe510('0x8a')](),_0xe510('0x6b'))['field']('\x27'+_0xd53ec5+'\x27',_0xe510('0x65'))[_0xe510('0xa8')]('\x27'+_0xd53ec5+'\x27',_0xe510('0x66'))['from']('cm_contacts')['where'](_0xe510('0xad'))['where'](_0xe510('0xae'),_0x4ff135[_0xe510('0xac')][_0xe510('0x8a')]())[_0xe510('0x4f')](_0xe510('0xaf'))[_0xe510('0x4f')](_0xe510('0xb0'),squel[_0xe510('0xb1')]()[_0xe510('0xa8')]('COALESCE(phone,\x27\x27)')['from'](_0xe510('0xa6'))[_0xe510('0x4f')](_0xe510('0xb3'),_0x12e63c[_0xe510('0x63')]['id']['toString']())))['toString']();break;default:_0x44ffed=squel[_0xe510('0xa4')]()[_0xe510('0xa5')](_0xe510('0xa6'))[_0xe510('0xb5')]([_0xe510('0xa9'),'scheduledAt',_0xe510('0xab'),_0xe510('0xa7'),'VoiceQueueId',_0xe510('0x65'),_0xe510('0x66')],squel['select']()[_0xe510('0xa8')](_0xe510('0xa9'),_0xe510('0xa9'))[_0xe510('0xa8')]('\x27'+_0xd53ec5+'\x27',_0xe510('0xaa'))[_0xe510('0xa8')]('id',_0xe510('0xab'))[_0xe510('0xa8')](_0x4ff135['CmListId'][_0xe510('0x8a')](),'ListId')[_0xe510('0xa8')](_0x12e63c[_0xe510('0x63')]['id']['toString'](),_0xe510('0x6b'))[_0xe510('0xa8')]('\x27'+_0xd53ec5+'\x27',_0xe510('0x65'))[_0xe510('0xa8')]('\x27'+_0xd53ec5+'\x27',_0xe510('0x66'))['from'](_0xe510('0xb6'))[_0xe510('0x4f')](_0xe510('0xad'))[_0xe510('0x4f')](_0xe510('0xae'),_0x4ff135['CmListId'][_0xe510('0x8a')]())[_0xe510('0x4f')]('phone\x20IS\x20NOT\x20NULL'))[_0xe510('0x8a')]();}_0x1c1599[_0xe510('0x99')](db[_0xe510('0x7a')]['query'](_0x44ffed));}return BPromise[_0xe510('0x9b')](_0x1c1599);}})['then'](function(){var _0x2d8e71=[];var _0x5a5574=squel[_0xe510('0xa4')]()['into'](_0xe510('0xb7'))[_0xe510('0xb5')]([_0xe510('0xb8'),_0xe510('0xa9'),'OrderBy',_0xe510('0x65'),'updatedAt'],squel[_0xe510('0xb1')]()[_0xe510('0xa8')](_0xe510('0xb9'))[_0xe510('0xa8')](_0xe510('0xba'))[_0xe510('0xa8')]('ci.OrderBy+1')[_0xe510('0xa8')]('\x27'+_0xd53ec5+'\x27',_0xe510('0x65'))['field']('\x27'+_0xd53ec5+'\x27','updatedAt')['from'](_0xe510('0xbb'),'ci')[_0xe510('0xbc')](_0xe510('0xa6'),'h',_0xe510('0xbd'))[_0xe510('0x4f')](_0xe510('0xbe'),_0xd53ec5)[_0xe510('0x4f')](_0xe510('0xbf'),_0xe510('0xc0')))[_0xe510('0x8a')]();_0x2d8e71[_0xe510('0x99')](db[_0xe510('0x7a')][_0xe510('0x45')](_0x5a5574));return BPromise[_0xe510('0x9b')](_0x2d8e71);})['then'](function(){return _0x2865e1;})['then'](respondWithResult(_0x1251ba,null))[_0xe510('0x57')](handleError(_0x1251ba,null));};exports[_0xe510('0xc1')]=function(_0x5b95e9,_0x3652b3,_0x38e53c){return db[_0xe510('0x41')][_0xe510('0x36')]({'where':{'id':_0x5b95e9[_0xe510('0x63')]['id']}})['then'](handleEntityNotFound(_0x3652b3,null))['then'](function(_0x1c798d){if(_0x1c798d){return _0x1c798d[_0xe510('0xc1')](_0x5b95e9[_0xe510('0x45')]['ids']);}})[_0xe510('0x2d')](function(_0x129cb0){if(_0x129cb0){return db[_0xe510('0x69')]['destroy']({'where':{'ListId':_0x5b95e9['query']['ids'],'VoiceQueueId':_0x5b95e9[_0xe510('0x63')]['id']}})['then'](function(){return _0x129cb0;});}})['then'](respondWithStatusCode(_0x3652b3,null))['catch'](handleError(_0x3652b3,null));};exports[_0xe510('0xc2')]=function(_0x1a86cf,_0x5a125a,_0x32d9e3){var _0xc0aa5c={};var _0x410601={};var _0x5b9787;var _0x49d9b7;return db['VoiceQueue'][_0xe510('0x6d')]({'where':{'id':_0x1a86cf[_0xe510('0x63')]['id']}})[_0xe510('0x2d')](handleEntityNotFound(_0x5a125a,null))[_0xe510('0x2d')](function(_0x629928){if(_0x629928){_0x5b9787=_0x629928;_0x410601[_0xe510('0x44')]=_['keys'](db[_0xe510('0x9e')][_0xe510('0x42')]);_0x410601[_0xe510('0x45')]=_[_0xe510('0x46')](_0x1a86cf[_0xe510('0x45')]);_0x410601[_0xe510('0x50')]=_['intersection'](_0x410601['model'],_0x410601[_0xe510('0x45')]);_0xc0aa5c['attributes']=_[_0xe510('0x47')](_0x410601[_0xe510('0x44')],qs['fields'](_0x1a86cf[_0xe510('0x45')][_0xe510('0x49')]));_0xc0aa5c[_0xe510('0x48')]=_0xc0aa5c[_0xe510('0x48')][_0xe510('0x4a')]?_0xc0aa5c[_0xe510('0x48')]:_0x410601[_0xe510('0x44')];_0xc0aa5c[_0xe510('0x4d')]=qs[_0xe510('0x4e')](_0x1a86cf[_0xe510('0x45')][_0xe510('0x4e')]);_0xc0aa5c[_0xe510('0x4f')]=qs[_0xe510('0x50')](_['pick'](_0x1a86cf['query'],_0x410601['filters']));if(_0x1a86cf[_0xe510('0x45')]['filter']){_0xc0aa5c[_0xe510('0x4f')]=_[_0xe510('0x52')](_0xc0aa5c[_0xe510('0x4f')],{'$or':_['map'](_0xc0aa5c[_0xe510('0x48')],function(_0x9de9c3){var _0x2315c4={};_0x2315c4[_0x9de9c3]={'$like':'%'+_0x1a86cf[_0xe510('0x45')][_0xe510('0x33')]+'%'};return _0x2315c4;})});}_0xc0aa5c=_[_0xe510('0x52')]({},_0xc0aa5c,_0x1a86cf[_0xe510('0x53')]);return _0x5b9787[_0xe510('0xc2')](_0xc0aa5c);}})[_0xe510('0x2d')](function(_0x41a6ae){if(_0x41a6ae){_0x49d9b7=_0x41a6ae['length'];if(!_0x1a86cf[_0xe510('0x45')][_0xe510('0x4b')]('nolimit')){_0xc0aa5c[_0xe510('0x26')]=qs[_0xe510('0x26')](_0x1a86cf[_0xe510('0x45')][_0xe510('0x26')]);_0xc0aa5c[_0xe510('0x28')]=qs[_0xe510('0x28')](_0x1a86cf['query'][_0xe510('0x28')]);}return _0x5b9787[_0xe510('0xc2')](_0xc0aa5c);}})[_0xe510('0x2d')](function(_0x16abe6){if(_0x16abe6){return _0x16abe6?{'count':_0x49d9b7,'rows':_0x16abe6}:null;}})['then'](respondWithResult(_0x5a125a,null))[_0xe510('0x57')](handleError(_0x5a125a,null));};exports[_0xe510('0xc3')]=function(_0x38e225,_0x16253a,_0x307db9){var _0x157dbd,_0x1d9abf;return db[_0xe510('0x41')][_0xe510('0x36')]({'where':{'id':_0x38e225[_0xe510('0x63')]['id']}})[_0xe510('0x2d')](handleEntityNotFound(_0x16253a,null))['then'](function(_0x337c3a){if(_0x337c3a){_0x1d9abf=_0x337c3a;return _0x337c3a[_0xe510('0xc3')](_0x38e225[_0xe510('0x5a')][_0xe510('0x84')],_[_0xe510('0x64')](_0x38e225[_0xe510('0x5a')],[_0xe510('0x84'),'id'])||{});}return null;})[_0xe510('0x96')](function(_0x5885a7){var _0x111e4e;_0x157dbd=_0x5885a7||[];var _0x565a65=[];if(_0x5885a7){for(var _0x2afa4d=0x0;_0x2afa4d<_0x5885a7[_0xe510('0x4a')];_0x2afa4d+=0x1){var _0x129d6a=_0x5885a7[_0x2afa4d]['get']({'plain':!![]});_0x111e4e=squel['insert']()[_0xe510('0xa5')]('cm_hopper_black')[_0xe510('0xb5')](['phone',_0xe510('0xab'),_0xe510('0xa7'),_0xe510('0x6b'),'createdAt',_0xe510('0x66')],squel['select']()[_0xe510('0xa8')](_0xe510('0xa9'),'phone')[_0xe510('0xa8')]('id',_0xe510('0xab'))[_0xe510('0xa8')](_0x129d6a[_0xe510('0xac')][_0xe510('0x8a')](),_0xe510('0xa7'))['field'](_0x38e225[_0xe510('0x63')]['id']['toString'](),'VoiceQueueId')[_0xe510('0xa8')](_0xe510('0xc4'),_0xe510('0x65'))[_0xe510('0xa8')](_0xe510('0xc4'),_0xe510('0x66'))[_0xe510('0x86')](_0xe510('0xb6'))['where']('deletedAt\x20IS\x20NULL')['where'](_0xe510('0xae'),_0x129d6a[_0xe510('0xac')][_0xe510('0x8a')]())[_0xe510('0x4f')](_0xe510('0xaf')))[_0xe510('0x8a')]();_0x565a65[_0xe510('0x99')](db[_0xe510('0x7a')]['query'](_0x111e4e));}return BPromise[_0xe510('0x9b')](_0x565a65);}})[_0xe510('0x2d')](function(){return _0x157dbd;})[_0xe510('0x2d')](respondWithResult(_0x16253a,null))[_0xe510('0x57')](handleError(_0x16253a,null));};exports['removeBlackLists']=function(_0x35a425,_0xc46485,_0xd37534){return db[_0xe510('0x41')][_0xe510('0x36')]({'where':{'id':_0x35a425[_0xe510('0x63')]['id']}})['then'](handleEntityNotFound(_0xc46485,null))['then'](function(_0x118a2f){if(_0x118a2f){return _0x118a2f[_0xe510('0xc5')](_0x35a425[_0xe510('0x45')][_0xe510('0x84')]);}})['then'](function(_0x1b93ea){if(_0x1b93ea){return db[_0xe510('0x70')][_0xe510('0x3a')]({'where':{'ListId':_0x35a425[_0xe510('0x45')][_0xe510('0x84')],'VoiceQueueId':_0x35a425[_0xe510('0x63')]['id']}})[_0xe510('0x2d')](function(){return _0x1b93ea;});}})[_0xe510('0x2d')](respondWithStatusCode(_0xc46485,null))[_0xe510('0x57')](handleError(_0xc46485,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 82e433c..f74cef1 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 _0xc7ab=['update','remove','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x1877e2,_0x2b76d4){var _0x44e96a=function(_0x8760bf){while(--_0x8760bf){_0x1877e2['push'](_0x1877e2['shift']());}};_0x44e96a(++_0x2b76d4);}(_0xc7ab,0x194));var _0xbc7a=function(_0x20aca6,_0x36ecfa){_0x20aca6=_0x20aca6-0x0;var _0x53ecc4=_0xc7ab[_0x20aca6];return _0x53ecc4;};'use strict';var EventEmitter=require(_0xbc7a('0x0'));var VoiceQueue=require(_0xbc7a('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xbc7a('0x2')](0x0);var events={'afterCreate':_0xbc7a('0x3'),'afterUpdate':_0xbc7a('0x4'),'afterDestroy':_0xbc7a('0x5')};function emitEvent(_0x3cc4c2){return function(_0x286c40,_0x9b10bb,_0x1a65e9){VoiceQueueEvents['emit'](_0x3cc4c2+':'+_0x286c40['id'],_0x286c40);VoiceQueueEvents['emit'](_0x3cc4c2,_0x286c40);_0x1a65e9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0xbc7a('0x6')](e,emitEvent(event));}}module[_0xbc7a('0x7')]=VoiceQueueEvents; \ No newline at end of file +var _0x0b0e=['hook','exports','events','../../mysqldb','VoiceQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x18c80c,_0x18948b){var _0xf48412=function(_0x5162d8){while(--_0x5162d8){_0x18c80c['push'](_0x18c80c['shift']());}};_0xf48412(++_0x18948b);}(_0x0b0e,0x91));var _0xe0b0=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0x0b0e[_0x58e469];return _0x4c01c5;};'use strict';var EventEmitter=require(_0xe0b0('0x0'));var VoiceQueue=require(_0xe0b0('0x1'))['db'][_0xe0b0('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xe0b0('0x3')](0x0);var events={'afterCreate':_0xe0b0('0x4'),'afterUpdate':_0xe0b0('0x5'),'afterDestroy':_0xe0b0('0x6')};function emitEvent(_0x5035de){return function(_0x2e6749,_0x4e1baf,_0x49b776){VoiceQueueEvents['emit'](_0x5035de+':'+_0x2e6749['id'],_0x2e6749);VoiceQueueEvents[_0xe0b0('0x7')](_0x5035de,_0x2e6749);_0x49b776(null);};}for(var e in events){if(events[_0xe0b0('0x8')](e)){var event=events[e];VoiceQueue[_0xe0b0('0x9')](e,emitEvent(event));}}module[_0xe0b0('0xa')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 6e77cc9..2d41466 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(_0x1d034b,_0x2faa1d){var _0x32944a=function(_0x42914e){while(--_0x42914e){_0x1d034b['push'](_0x1d034b['shift']());}};_0x32944a(++_0x2faa1d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x1b58f3,_0x3754d1){var _0xbf2b12=function(_0x49caa3){while(--_0x49caa3){_0x1b58f3['push'](_0x1b58f3['shift']());}};_0xbf2b12(++_0x3754d1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 6c9a9b9..8567bcd 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 _0x7354=['rpc','jayson/promise','client','http','redis','defaults','localhost','./voiceQueue.socket','register','then','VoiceQueue,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','where','attributes','limit','map','model','include','find','raw','ShowVoiceQueue','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x20fe19,_0x541f8c){var _0x2241de=function(_0x4f900b){while(--_0x4f900b){_0x20fe19['push'](_0x20fe19['shift']());}};_0x2241de(++_0x541f8c);}(_0x7354,0x1e4));var _0x4735=function(_0x4d1ee9,_0x394a78){_0x4d1ee9=_0x4d1ee9-0x0;var _0x9a5456=_0x7354[_0x4d1ee9];return _0x9a5456;};'use strict';var _=require('lodash');var util=require(_0x4735('0x0'));var moment=require(_0x4735('0x1'));var BPromise=require(_0x4735('0x2'));var rs=require(_0x4735('0x3'));var fs=require('fs');var Redis=require(_0x4735('0x4'));var db=require(_0x4735('0x5'))['db'];var utils=require(_0x4735('0x6'));var logger=require(_0x4735('0x7'))(_0x4735('0x8'));var config=require('../../config/environment');var jayson=require(_0x4735('0x9'));var client=jayson[_0x4735('0xa')][_0x4735('0xb')]({'port':0x232a});config[_0x4735('0xc')]=_[_0x4735('0xd')](config[_0x4735('0xc')],{'host':_0x4735('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4735('0xc')]));require(_0x4735('0xf'))[_0x4735('0x10')](socket);function respondWithRpcPromise(_0x390f87,_0x553891,_0x292ddd){return new BPromise(function(_0x50d1b7,_0xe97298){return client['request'](_0x390f87,_0x292ddd)[_0x4735('0x11')](function(_0x2eb827){logger['info'](_0x4735('0x12'),_0x553891,'request\x20sent');logger[_0x4735('0x13')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x553891,_0x4735('0x14'),JSON['stringify'](_0x2eb827));if(_0x2eb827[_0x4735('0x15')]){if(_0x2eb827['error'][_0x4735('0x16')]===0x1f4){logger[_0x4735('0x15')](_0x4735('0x12'),_0x553891,_0x2eb827[_0x4735('0x15')][_0x4735('0x17')]);return _0xe97298(_0x2eb827['error'][_0x4735('0x17')]);}logger['error'](_0x4735('0x12'),_0x553891,_0x2eb827['error'][_0x4735('0x17')]);return _0x50d1b7(_0x2eb827[_0x4735('0x15')][_0x4735('0x17')]);}else{logger[_0x4735('0x18')](_0x4735('0x12'),_0x553891,_0x4735('0x14'));_0x50d1b7(_0x2eb827[_0x4735('0x19')][_0x4735('0x17')]);}})[_0x4735('0x1a')](function(_0x173be6){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x553891,_0x173be6);_0xe97298(_0x173be6);});});}exports[_0x4735('0x1b')]=function(_0x8cb55d){var _0x1a0f51=this;return new Promise(function(_0xd06885,_0x3ee8a5){return db[_0x4735('0x1c')][_0x4735('0x1d')]({'raw':_0x8cb55d[_0x4735('0x1e')]?_0x8cb55d['options']['raw']===undefined?!![]:![]:!![],'where':_0x8cb55d[_0x4735('0x1e')]?_0x8cb55d['options'][_0x4735('0x1f')]||null:null,'attributes':_0x8cb55d['options']?_0x8cb55d[_0x4735('0x1e')][_0x4735('0x20')]||null:null,'limit':_0x8cb55d[_0x4735('0x1e')]?_0x8cb55d['options'][_0x4735('0x21')]||null:null,'include':_0x8cb55d['options']?_0x8cb55d[_0x4735('0x1e')]['include']?_[_0x4735('0x22')](_0x8cb55d[_0x4735('0x1e')]['include'],function(_0x22a07c){return{'model':db[_0x22a07c[_0x4735('0x23')]],'as':_0x22a07c['as'],'attributes':_0x22a07c[_0x4735('0x20')],'include':_0x22a07c[_0x4735('0x24')]?_[_0x4735('0x22')](_0x22a07c[_0x4735('0x24')],function(_0x46902c){return{'model':db[_0x46902c[_0x4735('0x23')]],'as':_0x46902c['as'],'attributes':_0x46902c['attributes'],'include':_0x46902c[_0x4735('0x24')]?_[_0x4735('0x22')](_0x46902c['include'],function(_0x505941){return{'model':db[_0x505941[_0x4735('0x23')]],'as':_0x505941['as'],'attributes':_0x505941[_0x4735('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4735('0x11')](function(_0x5e64c9){logger[_0x4735('0x18')](_0x4735('0x1b'),_0x8cb55d);logger[_0x4735('0x13')](_0x4735('0x1b'),_0x8cb55d,JSON['stringify'](_0x5e64c9));_0xd06885(_0x5e64c9);})[_0x4735('0x1a')](function(_0x1a5db4){logger['error'](_0x4735('0x1b'),_0x1a5db4[_0x4735('0x17')],_0x8cb55d);_0x3ee8a5(_0x1a0f51[_0x4735('0x15')](0x1f4,_0x1a5db4['message']));});});};exports['ShowVoiceQueue']=function(_0x1d82c8){var _0x456a3e=this;return new Promise(function(_0x3673d0,_0x1724c9){return db['VoiceQueue'][_0x4735('0x25')]({'raw':_0x1d82c8[_0x4735('0x1e')]?_0x1d82c8['options'][_0x4735('0x26')]===undefined?!![]:![]:!![],'where':_0x1d82c8[_0x4735('0x1e')]?_0x1d82c8[_0x4735('0x1e')][_0x4735('0x1f')]||null:null,'attributes':_0x1d82c8[_0x4735('0x1e')]?_0x1d82c8[_0x4735('0x1e')][_0x4735('0x20')]||null:null,'include':_0x1d82c8[_0x4735('0x1e')]?_0x1d82c8[_0x4735('0x1e')][_0x4735('0x24')]?_[_0x4735('0x22')](_0x1d82c8[_0x4735('0x1e')][_0x4735('0x24')],function(_0x361124){return{'model':db[_0x361124[_0x4735('0x23')]],'as':_0x361124['as'],'attributes':_0x361124[_0x4735('0x20')],'include':_0x361124[_0x4735('0x24')]?_['map'](_0x361124['include'],function(_0x3d7b4a){return{'model':db[_0x3d7b4a[_0x4735('0x23')]],'as':_0x3d7b4a['as'],'attributes':_0x3d7b4a[_0x4735('0x20')],'include':_0x3d7b4a[_0x4735('0x24')]?_['map'](_0x3d7b4a[_0x4735('0x24')],function(_0x3d8288){return{'model':db[_0x3d8288[_0x4735('0x23')]],'as':_0x3d8288['as'],'attributes':_0x3d8288[_0x4735('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4735('0x11')](function(_0x11549f){logger[_0x4735('0x18')]('ShowVoiceQueue',_0x1d82c8);logger[_0x4735('0x13')](_0x4735('0x27'),_0x1d82c8,JSON[_0x4735('0x28')](_0x11549f));_0x3673d0(_0x11549f);})[_0x4735('0x1a')](function(_0x50d618){logger[_0x4735('0x15')](_0x4735('0x27'),_0x50d618[_0x4735('0x17')],_0x1d82c8);_0x1724c9(_0x456a3e[_0x4735('0x15')](0x1f4,_0x50d618[_0x4735('0x17')]));});});}; \ No newline at end of file +var _0xb70f=['VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','include','model','map','then','ShowVoiceQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','register','request'];(function(_0x529f1c,_0x437ed1){var _0x4d57ab=function(_0x39d479){while(--_0x39d479){_0x529f1c['push'](_0x529f1c['shift']());}};_0x4d57ab(++_0x437ed1);}(_0xb70f,0xb8));var _0xfb70=function(_0x496508,_0x338d8f){_0x496508=_0x496508-0x0;var _0x2637e1=_0xb70f[_0x496508];return _0x2637e1;};'use strict';var _=require(_0xfb70('0x0'));var util=require('util');var moment=require(_0xfb70('0x1'));var BPromise=require(_0xfb70('0x2'));var rs=require(_0xfb70('0x3'));var fs=require('fs');var Redis=require(_0xfb70('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfb70('0x5'))(_0xfb70('0x6'));var config=require(_0xfb70('0x7'));var jayson=require(_0xfb70('0x8'));var client=jayson[_0xfb70('0x9')]['http']({'port':0x232a});config['redis']=_[_0xfb70('0xa')](config[_0xfb70('0xb')],{'host':_0xfb70('0xc'),'port':0x18eb});var socket=require(_0xfb70('0xd'))(new Redis(config[_0xfb70('0xb')]));require('./voiceQueue.socket')[_0xfb70('0xe')](socket);function respondWithRpcPromise(_0x31df18,_0x491be7,_0x3d7124){return new BPromise(function(_0x2c6318,_0xdb6c24){return client[_0xfb70('0xf')](_0x31df18,_0x3d7124)['then'](function(_0x3ac676){logger['info'](_0xfb70('0x10'),_0x491be7,_0xfb70('0x11'));logger[_0xfb70('0x12')](_0xfb70('0x13'),_0x491be7,_0xfb70('0x11'),JSON[_0xfb70('0x14')](_0x3ac676));if(_0x3ac676['error']){if(_0x3ac676[_0xfb70('0x15')]['code']===0x1f4){logger[_0xfb70('0x15')]('VoiceQueue,\x20%s,\x20%s',_0x491be7,_0x3ac676['error'][_0xfb70('0x16')]);return _0xdb6c24(_0x3ac676[_0xfb70('0x15')]['message']);}logger[_0xfb70('0x15')]('VoiceQueue,\x20%s,\x20%s',_0x491be7,_0x3ac676[_0xfb70('0x15')][_0xfb70('0x16')]);return _0x2c6318(_0x3ac676[_0xfb70('0x15')][_0xfb70('0x16')]);}else{logger[_0xfb70('0x17')](_0xfb70('0x10'),_0x491be7,_0xfb70('0x11'));_0x2c6318(_0x3ac676[_0xfb70('0x18')][_0xfb70('0x16')]);}})[_0xfb70('0x19')](function(_0x359d44){logger[_0xfb70('0x15')](_0xfb70('0x10'),_0x491be7,_0x359d44);_0xdb6c24(_0x359d44);});});}exports[_0xfb70('0x1a')]=function(_0x58f0a0){var _0x5939d3=this;return new Promise(function(_0xe8e295,_0x2652bc){return db[_0xfb70('0x1b')][_0xfb70('0x1c')]({'raw':_0x58f0a0['options']?_0x58f0a0[_0xfb70('0x1d')][_0xfb70('0x1e')]===undefined?!![]:![]:!![],'where':_0x58f0a0[_0xfb70('0x1d')]?_0x58f0a0[_0xfb70('0x1d')][_0xfb70('0x1f')]||null:null,'attributes':_0x58f0a0[_0xfb70('0x1d')]?_0x58f0a0[_0xfb70('0x1d')][_0xfb70('0x20')]||null:null,'limit':_0x58f0a0['options']?_0x58f0a0[_0xfb70('0x1d')][_0xfb70('0x21')]||null:null,'include':_0x58f0a0['options']?_0x58f0a0['options'][_0xfb70('0x22')]?_['map'](_0x58f0a0[_0xfb70('0x1d')]['include'],function(_0x3767cf){return{'model':db[_0x3767cf[_0xfb70('0x23')]],'as':_0x3767cf['as'],'attributes':_0x3767cf[_0xfb70('0x20')],'include':_0x3767cf[_0xfb70('0x22')]?_[_0xfb70('0x24')](_0x3767cf[_0xfb70('0x22')],function(_0xc7b7dc){return{'model':db[_0xc7b7dc[_0xfb70('0x23')]],'as':_0xc7b7dc['as'],'attributes':_0xc7b7dc[_0xfb70('0x20')],'include':_0xc7b7dc[_0xfb70('0x22')]?_[_0xfb70('0x24')](_0xc7b7dc[_0xfb70('0x22')],function(_0x34e0b8){return{'model':db[_0x34e0b8[_0xfb70('0x23')]],'as':_0x34e0b8['as'],'attributes':_0x34e0b8[_0xfb70('0x20')]};}):[]};}):[]};}):[]:[]})[_0xfb70('0x25')](function(_0xc4816b){logger['info'](_0xfb70('0x1a'),_0x58f0a0);logger[_0xfb70('0x12')](_0xfb70('0x1a'),_0x58f0a0,JSON['stringify'](_0xc4816b));_0xe8e295(_0xc4816b);})[_0xfb70('0x19')](function(_0x3e27af){logger[_0xfb70('0x15')](_0xfb70('0x1a'),_0x3e27af[_0xfb70('0x16')],_0x58f0a0);_0x2652bc(_0x5939d3[_0xfb70('0x15')](0x1f4,_0x3e27af[_0xfb70('0x16')]));});});};exports[_0xfb70('0x26')]=function(_0x133874){var _0x35406d=this;return new Promise(function(_0x313fc1,_0x160aff){return db['VoiceQueue'][_0xfb70('0x27')]({'raw':_0x133874['options']?_0x133874[_0xfb70('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x133874['options']?_0x133874[_0xfb70('0x1d')]['where']||null:null,'attributes':_0x133874[_0xfb70('0x1d')]?_0x133874['options']['attributes']||null:null,'include':_0x133874[_0xfb70('0x1d')]?_0x133874['options']['include']?_[_0xfb70('0x24')](_0x133874[_0xfb70('0x1d')][_0xfb70('0x22')],function(_0x9913df){return{'model':db[_0x9913df[_0xfb70('0x23')]],'as':_0x9913df['as'],'attributes':_0x9913df[_0xfb70('0x20')],'include':_0x9913df['include']?_[_0xfb70('0x24')](_0x9913df[_0xfb70('0x22')],function(_0x3a4c05){return{'model':db[_0x3a4c05[_0xfb70('0x23')]],'as':_0x3a4c05['as'],'attributes':_0x3a4c05[_0xfb70('0x20')],'include':_0x3a4c05[_0xfb70('0x22')]?_[_0xfb70('0x24')](_0x3a4c05[_0xfb70('0x22')],function(_0x5ea1d2){return{'model':db[_0x5ea1d2['model']],'as':_0x5ea1d2['as'],'attributes':_0x5ea1d2[_0xfb70('0x20')]};}):[]};}):[]};}):[]:[]})[_0xfb70('0x25')](function(_0x1c18ff){logger[_0xfb70('0x17')]('ShowVoiceQueue',_0x133874);logger[_0xfb70('0x12')](_0xfb70('0x26'),_0x133874,JSON[_0xfb70('0x14')](_0x1c18ff));_0x313fc1(_0x1c18ff);})[_0xfb70('0x19')](function(_0x54ad3f){logger[_0xfb70('0x15')](_0xfb70('0x26'),_0x54ad3f['message'],_0x133874);_0x160aff(_0x35406d[_0xfb70('0x15')](0x1f4,_0x54ad3f['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 6bafbe9..58ea2ac 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 _0x2cc5=['removeListener','register','length','voiceQueue:','save','remove','update','emit'];(function(_0x52fb7b,_0x5b3bfb){var _0x57113a=function(_0x1113e8){while(--_0x1113e8){_0x52fb7b['push'](_0x52fb7b['shift']());}};_0x57113a(++_0x5b3bfb);}(_0x2cc5,0x174));var _0x52cc=function(_0x1e3c54,_0x55f71c){_0x1e3c54=_0x1e3c54-0x0;var _0x8f074=_0x2cc5[_0x1e3c54];return _0x8f074;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x52cc('0x0'),_0x52cc('0x1'),_0x52cc('0x2')];function createListener(_0xac9d9b,_0x43bfe3){return function(_0x303821){_0x43bfe3[_0x52cc('0x3')](_0xac9d9b,_0x303821);};}function removeListener(_0x1aadf9,_0x2818c9){return function(){VoiceQueueEvents[_0x52cc('0x4')](_0x1aadf9,_0x2818c9);};}exports[_0x52cc('0x5')]=function(_0xbfcaf8){for(var _0x36cfb7=0x0,_0x2f53ad=events[_0x52cc('0x6')];_0x36cfb7<_0x2f53ad;_0x36cfb7++){var _0x2a5c5a=events[_0x36cfb7];var _0x66bd01=createListener(_0x52cc('0x7')+_0x2a5c5a,_0xbfcaf8);VoiceQueueEvents['on'](_0x2a5c5a,_0x66bd01);}}; \ No newline at end of file +var _0x9bb0=['remove','update','emit','length','voiceQueue:','./voiceQueue.events','save'];(function(_0xf26d40,_0x2f4f46){var _0x50b68c=function(_0x10aa58){while(--_0x10aa58){_0xf26d40['push'](_0xf26d40['shift']());}};_0x50b68c(++_0x2f4f46);}(_0x9bb0,0xd7));var _0x09bb=function(_0x4a9d73,_0x404b5f){_0x4a9d73=_0x4a9d73-0x0;var _0x2544c1=_0x9bb0[_0x4a9d73];return _0x2544c1;};'use strict';var VoiceQueueEvents=require(_0x09bb('0x0'));var events=[_0x09bb('0x1'),_0x09bb('0x2'),_0x09bb('0x3')];function createListener(_0x5ed629,_0x2158c8){return function(_0x3cbfef){_0x2158c8[_0x09bb('0x4')](_0x5ed629,_0x3cbfef);};}function removeListener(_0x55ca4f,_0x1bb466){return function(){VoiceQueueEvents['removeListener'](_0x55ca4f,_0x1bb466);};}exports['register']=function(_0x2075ae){for(var _0x3323d1=0x0,_0x4a47d4=events[_0x09bb('0x5')];_0x3323d1<_0x4a47d4;_0x3323d1++){var _0x2ad73e=events[_0x3323d1];var _0x402c66=createListener(_0x09bb('0x6')+_0x2ad73e,_0x2075ae);VoiceQueueEvents['on'](_0x2ad73e,_0x402c66);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 1e325e0..73874ae 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 _0xd112=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller','isAuthenticated','index','describe','get','/:id','show','post','create','put','update','delete'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xd112,0x10a));var _0x2d11=function(_0x1113dc,_0x188e4b){_0x1113dc=_0x1113dc-0x0;var _0x1ebf6e=_0xd112[_0x1113dc];return _0x1ebf6e;};'use strict';var multer=require('multer');var util=require(_0x2d11('0x0'));var path=require(_0x2d11('0x1'));var timeout=require(_0x2d11('0x2'));var express=require(_0x2d11('0x3'));var router=express[_0x2d11('0x4')]();var fs_extra=require(_0x2d11('0x5'));var auth=require(_0x2d11('0x6'));var interaction=require(_0x2d11('0x7'));var config=require('../../config/environment');var controller=require(_0x2d11('0x8'));router['get']('/',auth[_0x2d11('0x9')](),controller[_0x2d11('0xa')]);router['get']('/describe',auth[_0x2d11('0x9')](),controller[_0x2d11('0xb')]);router[_0x2d11('0xc')]('/index',auth['isAuthenticated'](),controller['getVoiceQueuesReport']);router['get'](_0x2d11('0xd'),auth['isAuthenticated'](),controller[_0x2d11('0xe')]);router[_0x2d11('0xf')]('/',auth[_0x2d11('0x9')](),controller[_0x2d11('0x10')]);router[_0x2d11('0x11')]('/:id',auth[_0x2d11('0x9')](),controller[_0x2d11('0x12')]);router[_0x2d11('0x13')](_0x2d11('0xd'),auth[_0x2d11('0x9')](),controller[_0x2d11('0x14')]);module[_0x2d11('0x15')]=router; \ No newline at end of file +var _0x6fe4=['../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','/describe','describe','get','/index','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','express','../../components/auth/service'];(function(_0x51e76f,_0xdfb2ce){var _0x2709e3=function(_0x31a8b2){while(--_0x31a8b2){_0x51e76f['push'](_0x51e76f['shift']());}};_0x2709e3(++_0xdfb2ce);}(_0x6fe4,0xb9));var _0x46fe=function(_0x529e73,_0x472e78){_0x529e73=_0x529e73-0x0;var _0x43c25a=_0x6fe4[_0x529e73];return _0x43c25a;};'use strict';var multer=require(_0x46fe('0x0'));var util=require('util');var path=require(_0x46fe('0x1'));var timeout=require('connect-timeout');var express=require(_0x46fe('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x46fe('0x3'));var interaction=require(_0x46fe('0x4'));var config=require(_0x46fe('0x5'));var controller=require(_0x46fe('0x6'));router['get']('/',auth[_0x46fe('0x7')](),controller['index']);router['get'](_0x46fe('0x8'),auth[_0x46fe('0x7')](),controller[_0x46fe('0x9')]);router[_0x46fe('0xa')](_0x46fe('0xb'),auth['isAuthenticated'](),controller['getVoiceQueuesReport']);router[_0x46fe('0xa')](_0x46fe('0xc'),auth[_0x46fe('0x7')](),controller[_0x46fe('0xd')]);router[_0x46fe('0xe')]('/',auth[_0x46fe('0x7')](),controller[_0x46fe('0xf')]);router[_0x46fe('0x10')](_0x46fe('0xc'),auth[_0x46fe('0x7')](),controller[_0x46fe('0x11')]);router[_0x46fe('0x12')](_0x46fe('0xc'),auth[_0x46fe('0x7')](),controller[_0x46fe('0x13')]);module[_0x46fe('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 96127ee..0da170d 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 _0xea43=['BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER'];(function(_0x116f07,_0x3952d5){var _0xf4e86f=function(_0x4fb524){while(--_0x4fb524){_0x116f07['push'](_0x116f07['shift']());}};_0xf4e86f(++_0x3952d5);}(_0xea43,0xf1));var _0x3ea4=function(_0x5ea032,_0x41fc8c){_0x5ea032=_0x5ea032-0x0;var _0x20625c=_0xea43[_0x5ea032];return _0x20625c;};'use strict';var Sequelize=require(_0x3ea4('0x0'));var moment=require(_0x3ea4('0x1'));module[_0x3ea4('0x2')]={'type':{'type':Sequelize[_0x3ea4('0x3')]},'uniqueid':{'type':Sequelize[_0x3ea4('0x3')]},'calleridnum':{'type':Sequelize[_0x3ea4('0x3')]},'calleridname':{'type':Sequelize[_0x3ea4('0x3')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x3ea4('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x3ea4('0x4')],'set':function(_0x2c71e5){var _0x43e52b=moment(_0x2c71e5);var _0x1c638a=moment(this[_0x3ea4('0x5')](_0x3ea4('0x6')))[_0x3ea4('0x7')](_0x3ea4('0x8'));var _0x519652=_0x43e52b['diff'](_0x1c638a,_0x3ea4('0x9'));this[_0x3ea4('0xa')](_0x3ea4('0xb'),_0x2c71e5);this[_0x3ea4('0xa')](_0x3ea4('0xc'),_0x519652||null);}},'position':{'type':Sequelize[_0x3ea4('0xd')]},'count':{'type':Sequelize[_0x3ea4('0xd')]},'queuecallerabandon':{'type':Sequelize[_0x3ea4('0xe')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x3ea4('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x3ea4('0xe')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x3ea4('0xe')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x3ea4('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x3ea4('0x3')],'comment':_0x3ea4('0xf')},'originalposition':{'type':Sequelize[_0x3ea4('0xd')]},'channel':{'type':Sequelize[_0x3ea4('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x3ea4('0x3')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x3ea4('0x3')]},'priority':{'type':Sequelize[_0x3ea4('0x3')]},'holdtime':{'type':Sequelize[_0x3ea4('0xd')]},'mohtime':{'type':Sequelize[_0x3ea4('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x3ea4('0xe')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x3ea4('0x3')]},'transfer':{'type':Sequelize[_0x3ea4('0xe')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x3ea4('0x10')},'transferexten':{'type':Sequelize[_0x3ea4('0x3')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x3ea4('0x3')]},'secondDisposition':{'type':Sequelize[_0x3ea4('0x3')]},'thirdDisposition':{'type':Sequelize[_0x3ea4('0x3')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize[_0x3ea4('0x3')]}}; \ No newline at end of file +var _0x896b=['STRING','DATE','queuecallerjoinAt','format','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports'];(function(_0x3e151f,_0x15ee9f){var _0x14005e=function(_0x2ffee6){while(--_0x2ffee6){_0x3e151f['push'](_0x3e151f['shift']());}};_0x14005e(++_0x15ee9f);}(_0x896b,0xb2));var _0xb896=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x896b[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xb896('0x0'));var moment=require('moment');module[_0xb896('0x1')]={'type':{'type':Sequelize[_0xb896('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb896('0x2')]},'calleridname':{'type':Sequelize[_0xb896('0x2')]},'queue':{'type':Sequelize[_0xb896('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0xb896('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0xb896('0x3')],'set':function(_0xf3d75c){var _0x593bdc=moment(_0xf3d75c);var _0x16aa39=moment(this['getDataValue'](_0xb896('0x4')))[_0xb896('0x5')]('YYYY-MM-DD\x20HH:mm:ss');var _0x3389dc=_0x593bdc[_0xb896('0x6')](_0x16aa39,_0xb896('0x7'));this[_0xb896('0x8')](_0xb896('0x9'),_0xf3d75c);this[_0xb896('0x8')](_0xb896('0xa'),_0x3389dc||null);}},'position':{'type':Sequelize[_0xb896('0xb')]},'count':{'type':Sequelize[_0xb896('0xb')]},'queuecallerabandon':{'type':Sequelize[_0xb896('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xb896('0x3')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xb896('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xb896('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0xb896('0x2')],'comment':_0xb896('0xd')},'originalposition':{'type':Sequelize[_0xb896('0xb')]},'channel':{'type':Sequelize[_0xb896('0x2')]},'connectedlinenum':{'type':Sequelize[_0xb896('0x2')]},'connectedlinename':{'type':Sequelize[_0xb896('0x2')]},'accountcode':{'type':Sequelize[_0xb896('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xb896('0x2')]},'priority':{'type':Sequelize[_0xb896('0x2')]},'holdtime':{'type':Sequelize[_0xb896('0xb')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xb896('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xb896('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xb896('0x2')],'comment':_0xb896('0xe')},'transferexten':{'type':Sequelize[_0xb896('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xb896('0x2')]},'secondDisposition':{'type':Sequelize[_0xb896('0x2')]},'thirdDisposition':{'type':Sequelize[_0xb896('0x2')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize[_0xb896('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 07055a1..d416dfd 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 _0x246a=['mustache','path','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','save','then','destroy','stack','name','send','map','VoiceQueueReport','rawAttributes','type','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','pick','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','update','describe','getVoiceQueuesReport','sort','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x45988e,_0x307f1f){var _0x1693fc=function(_0x272035){while(--_0x272035){_0x45988e['push'](_0x45988e['shift']());}};_0x1693fc(++_0x307f1f);}(_0x246a,0x94));var _0xa246=function(_0x3173a5,_0x150e7c){_0x3173a5=_0x3173a5-0x0;var _0x26c94c=_0x246a[_0x3173a5];return _0x26c94c;};'use strict';var emlformat=require(_0xa246('0x0'));var rimraf=require(_0xa246('0x1'));var zipdir=require(_0xa246('0x2'));var jsonpatch=require(_0xa246('0x3'));var rp=require('request-promise');var moment=require(_0xa246('0x4'));var BPromise=require(_0xa246('0x5'));var Mustache=require(_0xa246('0x6'));var util=require('util');var path=require(_0xa246('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa246('0x8'));var _=require(_0xa246('0x9'));var squel=require(_0xa246('0xa'));var crypto=require('crypto');var jsforce=require(_0xa246('0xb'));var deskjs=require(_0xa246('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa246('0xd'));var Redis=require(_0xa246('0xe'));var authService=require(_0xa246('0xf'));var qs=require(_0xa246('0x10'));var as=require(_0xa246('0x11'));var hardwareService=require(_0xa246('0x12'));var logger=require(_0xa246('0x13'))(_0xa246('0x14'));var utils=require(_0xa246('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa246('0x16'));var db=require(_0xa246('0x17'))['db'];config[_0xa246('0x18')]=_[_0xa246('0x19')](config[_0xa246('0x18')],{'host':_0xa246('0x1a'),'port':0x18eb});var socket=require(_0xa246('0x1b'))(new Redis(config[_0xa246('0x18')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithStatusCode(_0x590ddb,_0x3c252c){_0x3c252c=_0x3c252c||0xcc;return function(_0x5da37c){if(_0x5da37c){return _0x590ddb[_0xa246('0x1c')](_0x3c252c);}return _0x590ddb[_0xa246('0x1d')](_0x3c252c)[_0xa246('0x1e')]();};}function respondWithResult(_0x24989f,_0x5502a1){_0x5502a1=_0x5502a1||0xc8;return function(_0x51542a){if(_0x51542a){return _0x24989f[_0xa246('0x1d')](_0x5502a1)['json'](_0x51542a);}};}function respondWithFilteredResult(_0x1d3ac9,_0x22e540){return function(_0x161d1f){if(_0x161d1f){var _0x245870=typeof _0x22e540[_0xa246('0x1f')]===_0xa246('0x20')&&typeof _0x22e540[_0xa246('0x21')]==='undefined';var _0x1819eb=_0x161d1f['count'];var _0x2e0443=_0x245870?0x0:_0x22e540[_0xa246('0x1f')];var _0x5735eb=_0x245870?_0x161d1f[_0xa246('0x22')]:_0x22e540[_0xa246('0x1f')]+_0x22e540[_0xa246('0x21')];var _0x5a5035;if(_0x5735eb>=_0x1819eb){_0x5735eb=_0x1819eb;_0x5a5035=0xc8;}else{_0x5a5035=0xce;}_0x1d3ac9[_0xa246('0x1d')](_0x5a5035);return _0x1d3ac9[_0xa246('0x23')](_0xa246('0x24'),_0x2e0443+'-'+_0x5735eb+'/'+_0x1819eb)[_0xa246('0x25')](_0x161d1f);}return null;};}function patchUpdates(_0x450051){return function(_0x4082de){try{jsonpatch['apply'](_0x4082de,_0x450051,!![]);}catch(_0x6b076b){return BPromise['reject'](_0x6b076b);}return _0x4082de[_0xa246('0x26')]();};}function saveUpdates(_0xddb193,_0x40f615){return function(_0x3b7027){if(_0x3b7027){return _0x3b7027['update'](_0xddb193)[_0xa246('0x27')](function(_0x4c3306){return _0x4c3306;});}return null;};}function removeEntity(_0x4cb468,_0x2ee519){return function(_0x1f364b){if(_0x1f364b){return _0x1f364b[_0xa246('0x28')]()['then'](function(){_0x4cb468[_0xa246('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x282af1,_0x2e5cb1){return function(_0x490091){if(!_0x490091){_0x282af1[_0xa246('0x1c')](0x194);}return _0x490091;};}function handleError(_0x1c3d81,_0x18d3d0){_0x18d3d0=_0x18d3d0||0x1f4;return function(_0x54377f){logger['error'](_0x54377f[_0xa246('0x29')]);if(_0x54377f[_0xa246('0x2a')]){delete _0x54377f[_0xa246('0x2a')];}_0x1c3d81[_0xa246('0x1d')](_0x18d3d0)[_0xa246('0x2b')](_0x54377f);};}exports['index']=function(_0x3fa5d2,_0x20726a){var _0x6ce275={},_0x3c8c7b={},_0x5813a6={'count':0x0,'rows':[]};var _0xbe05e7=_[_0xa246('0x2c')](db[_0xa246('0x2d')][_0xa246('0x2e')],function(_0x564bcb){return{'name':_0x564bcb['fieldName'],'type':_0x564bcb[_0xa246('0x2f')]['key']};});_0x3c8c7b['model']=_[_0xa246('0x2c')](_0xbe05e7,_0xa246('0x2a'));_0x3c8c7b[_0xa246('0x30')]=_['keys'](_0x3fa5d2[_0xa246('0x30')]);_0x3c8c7b[_0xa246('0x31')]=_['intersection'](_0x3c8c7b['model'],_0x3c8c7b[_0xa246('0x30')]);_0x6ce275[_0xa246('0x32')]=_[_0xa246('0x33')](_0x3c8c7b[_0xa246('0x34')],qs[_0xa246('0x35')](_0x3fa5d2['query']['fields']));_0x6ce275[_0xa246('0x32')]=_0x6ce275[_0xa246('0x32')][_0xa246('0x36')]?_0x6ce275[_0xa246('0x32')]:_0x3c8c7b[_0xa246('0x34')];if(!_0x3fa5d2['query'][_0xa246('0x37')]('nolimit')){_0x6ce275[_0xa246('0x21')]=qs['limit'](_0x3fa5d2['query'][_0xa246('0x21')]);_0x6ce275['offset']=qs[_0xa246('0x1f')](_0x3fa5d2[_0xa246('0x30')]['offset']);}_0x6ce275['order']=qs['sort'](_0x3fa5d2['query']['sort']);_0x6ce275['where']=qs[_0xa246('0x31')](_[_0xa246('0x38')](_0x3fa5d2[_0xa246('0x30')],_0x3c8c7b['filters']),_0xbe05e7);if(_0x3fa5d2[_0xa246('0x30')]['filter']){_0x6ce275[_0xa246('0x39')]=_['merge'](_0x6ce275[_0xa246('0x39')],{'$or':_[_0xa246('0x2c')](_0xbe05e7,function(_0x2fc315){if(_0x2fc315[_0xa246('0x2f')]!==_0xa246('0x3a')){var _0x38560d={};_0x38560d[_0x2fc315[_0xa246('0x2a')]]={'$like':'%'+_0x3fa5d2[_0xa246('0x30')][_0xa246('0x3b')]+'%'};return _0x38560d;}})});}_0x6ce275=_[_0xa246('0x3c')]({},_0x6ce275,_0x3fa5d2[_0xa246('0x3d')]);var _0x2293a3={'where':_0x6ce275[_0xa246('0x39')]};return db['VoiceQueueReport']['count'](_0x2293a3)[_0xa246('0x27')](function(_0xfbcd26){_0x5813a6[_0xa246('0x22')]=_0xfbcd26;if(_0x3fa5d2[_0xa246('0x30')][_0xa246('0x3e')]){_0x6ce275[_0xa246('0x3f')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0xa246('0x40')](_0x6ce275);})[_0xa246('0x27')](function(_0x4482a6){_0x5813a6[_0xa246('0x41')]=_0x4482a6;return _0x5813a6;})['then'](respondWithFilteredResult(_0x20726a,_0x6ce275))[_0xa246('0x42')](handleError(_0x20726a,null));};exports[_0xa246('0x43')]=function(_0x3e2b1c,_0x3cfcaa){var _0x4ccae4={'raw':![],'where':{'id':_0x3e2b1c[_0xa246('0x44')]['id']}},_0x25def1={};_0x25def1['model']=_[_0xa246('0x45')](db['VoiceQueueReport'][_0xa246('0x2e')]);_0x25def1[_0xa246('0x30')]=_['keys'](_0x3e2b1c[_0xa246('0x30')]);_0x25def1[_0xa246('0x31')]=_[_0xa246('0x33')](_0x25def1[_0xa246('0x34')],_0x25def1[_0xa246('0x30')]);_0x4ccae4[_0xa246('0x32')]=_[_0xa246('0x33')](_0x25def1[_0xa246('0x34')],qs[_0xa246('0x35')](_0x3e2b1c[_0xa246('0x30')][_0xa246('0x35')]));_0x4ccae4[_0xa246('0x32')]=_0x4ccae4[_0xa246('0x32')][_0xa246('0x36')]?_0x4ccae4[_0xa246('0x32')]:_0x25def1[_0xa246('0x34')];if(_0x3e2b1c['query'][_0xa246('0x3e')]){_0x4ccae4['include']=[{'all':!![]}];}_0x4ccae4=_[_0xa246('0x3c')]({},_0x4ccae4,_0x3e2b1c['options']);return db[_0xa246('0x2d')][_0xa246('0x46')](_0x4ccae4)[_0xa246('0x27')](handleEntityNotFound(_0x3cfcaa,null))[_0xa246('0x27')](respondWithResult(_0x3cfcaa,null))[_0xa246('0x42')](handleError(_0x3cfcaa,null));};exports[_0xa246('0x47')]=function(_0x5bb42c,_0x5e1174){return db['VoiceQueueReport'][_0xa246('0x47')](_0x5bb42c[_0xa246('0x48')],{})[_0xa246('0x27')](respondWithResult(_0x5e1174,0xc9))[_0xa246('0x42')](handleError(_0x5e1174,null));};exports[_0xa246('0x49')]=function(_0x484691,_0x16497f){if(_0x484691['body']['id']){delete _0x484691[_0xa246('0x48')]['id'];}return db[_0xa246('0x2d')]['find']({'where':{'id':_0x484691[_0xa246('0x44')]['id']}})[_0xa246('0x27')](handleEntityNotFound(_0x16497f,null))[_0xa246('0x27')](saveUpdates(_0x484691[_0xa246('0x48')],null))['then'](respondWithResult(_0x16497f,null))['catch'](handleError(_0x16497f,null));};exports[_0xa246('0x28')]=function(_0xdf353e,_0x137b38){return db[_0xa246('0x2d')][_0xa246('0x46')]({'where':{'id':_0xdf353e[_0xa246('0x44')]['id']}})['then'](handleEntityNotFound(_0x137b38,null))[_0xa246('0x27')](removeEntity(_0x137b38,null))['catch'](handleError(_0x137b38,null));};exports[_0xa246('0x4a')]=function(_0x18c250,_0x52f8d5){return db[_0xa246('0x2d')][_0xa246('0x4a')]()[_0xa246('0x27')](respondWithResult(_0x52f8d5,null))['catch'](handleError(_0x52f8d5,null));};exports[_0xa246('0x4b')]=function(_0x22385d,_0x588265){var _0x1a5f05={},_0xceb0ad={},_0x878878={'count':0x0,'rows':[]};_0xceb0ad[_0xa246('0x34')]=_[_0xa246('0x45')](db['VoiceQueueReport'][_0xa246('0x2e')]);_0xceb0ad[_0xa246('0x30')]=_['keys'](_0x22385d['query']);_0xceb0ad[_0xa246('0x31')]=_[_0xa246('0x33')](_0xceb0ad[_0xa246('0x34')],_0xceb0ad['query']);_0x1a5f05[_0xa246('0x32')]=_[_0xa246('0x33')](_0xceb0ad[_0xa246('0x34')],qs['fields'](_0x22385d[_0xa246('0x30')][_0xa246('0x35')]));_0x1a5f05[_0xa246('0x32')]=_0x1a5f05[_0xa246('0x32')][_0xa246('0x36')]?_0x1a5f05['attributes']:_0xceb0ad[_0xa246('0x34')];if(!_0x22385d[_0xa246('0x30')][_0xa246('0x37')]('nolimit')){_0x1a5f05['limit']=qs[_0xa246('0x21')](_0x22385d[_0xa246('0x30')]['limit']);_0x1a5f05[_0xa246('0x1f')]=qs[_0xa246('0x1f')](_0x22385d[_0xa246('0x30')][_0xa246('0x1f')]);}_0x1a5f05['order']=qs[_0xa246('0x4c')](_0x22385d[_0xa246('0x30')]['sort']);_0x1a5f05[_0xa246('0x39')]=qs[_0xa246('0x31')](_[_0xa246('0x38')](_0x22385d[_0xa246('0x30')],_0xceb0ad[_0xa246('0x31')]));if(_0x22385d[_0xa246('0x30')][_0xa246('0x3b')]){_0x1a5f05[_0xa246('0x39')]=_[_0xa246('0x3c')](_0x1a5f05['where'],{'$or':_[_0xa246('0x2c')](_0x1a5f05[_0xa246('0x32')],function(_0xd22aa){var _0x32e2af={};_0x32e2af[_0xd22aa]={'$like':'%'+_0x22385d['query'][_0xa246('0x3b')]+'%'};return _0x32e2af;})});}_0x1a5f05=_[_0xa246('0x3c')]({},_0x1a5f05,_0x22385d[_0xa246('0x3d')]);var _0xa2022f={'where':_0x1a5f05[_0xa246('0x39')]};return db['VoiceQueueReport']['count'](_0xa2022f)[_0xa246('0x27')](function(_0x2ba325){_0x878878['count']=_0x2ba325;if(_0x22385d[_0xa246('0x30')]['includeAll']){_0x1a5f05[_0xa246('0x3f')]=[{'all':!![]}];}return db[_0xa246('0x2d')][_0xa246('0x40')](_0x1a5f05);})[_0xa246('0x27')](function(_0x25a2f0){_0x878878[_0xa246('0x41')]=_0x25a2f0;return _0x878878;})[_0xa246('0x27')](respondWithFilteredResult(_0x588265,_0x1a5f05,_0xa246('0x4b')))[_0xa246('0x42')](handleError(_0x588265,null,_0xa246('0x4b')));}; \ No newline at end of file +var _0xa0ce=['then','destroy','sendStatus','error','stack','name','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','find','create','body','describe','getVoiceQueuesReport','sort','include','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','save','update'];(function(_0x4bc65f,_0x39ec43){var _0x44f85f=function(_0x175343){while(--_0x175343){_0x4bc65f['push'](_0x4bc65f['shift']());}};_0x44f85f(++_0x39ec43);}(_0xa0ce,0x1d3));var _0xea0c=function(_0x36b94e,_0x29d52a){_0x36b94e=_0x36b94e-0x0;var _0x45ca07=_0xa0ce[_0x36b94e];return _0x45ca07;};'use strict';var emlformat=require(_0xea0c('0x0'));var rimraf=require(_0xea0c('0x1'));var zipdir=require(_0xea0c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xea0c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xea0c('0x4'));var util=require(_0xea0c('0x5'));var path=require(_0xea0c('0x6'));var sox=require(_0xea0c('0x7'));var csv=require(_0xea0c('0x8'));var ejs=require(_0xea0c('0x9'));var fs=require('fs');var fs_extra=require(_0xea0c('0xa'));var _=require(_0xea0c('0xb'));var squel=require(_0xea0c('0xc'));var crypto=require(_0xea0c('0xd'));var jsforce=require(_0xea0c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xea0c('0x8'));var querystring=require(_0xea0c('0xf'));var Papa=require(_0xea0c('0x10'));var Redis=require(_0xea0c('0x11'));var authService=require(_0xea0c('0x12'));var qs=require(_0xea0c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xea0c('0x14'));var logger=require(_0xea0c('0x15'))(_0xea0c('0x16'));var utils=require(_0xea0c('0x17'));var config=require(_0xea0c('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xea0c('0x19'))['db'];config[_0xea0c('0x1a')]=_['defaults'](config[_0xea0c('0x1a')],{'host':_0xea0c('0x1b'),'port':0x18eb});var socket=require(_0xea0c('0x1c'))(new Redis(config[_0xea0c('0x1a')]));require(_0xea0c('0x1d'))[_0xea0c('0x1e')](socket);function respondWithStatusCode(_0x12e0c0,_0x2e10d3){_0x2e10d3=_0x2e10d3||0xcc;return function(_0x5b4383){if(_0x5b4383){return _0x12e0c0['sendStatus'](_0x2e10d3);}return _0x12e0c0[_0xea0c('0x1f')](_0x2e10d3)[_0xea0c('0x20')]();};}function respondWithResult(_0x4afb78,_0x34ffee){_0x34ffee=_0x34ffee||0xc8;return function(_0x546658){if(_0x546658){return _0x4afb78[_0xea0c('0x1f')](_0x34ffee)[_0xea0c('0x21')](_0x546658);}};}function respondWithFilteredResult(_0x17a463,_0x3136b3){return function(_0x59233c){if(_0x59233c){var _0x3551de=typeof _0x3136b3['offset']===_0xea0c('0x22')&&typeof _0x3136b3[_0xea0c('0x23')]===_0xea0c('0x22');var _0x5a2683=_0x59233c['count'];var _0x14b831=_0x3551de?0x0:_0x3136b3[_0xea0c('0x24')];var _0x4ebad5=_0x3551de?_0x59233c[_0xea0c('0x25')]:_0x3136b3[_0xea0c('0x24')]+_0x3136b3['limit'];var _0x46b2fb;if(_0x4ebad5>=_0x5a2683){_0x4ebad5=_0x5a2683;_0x46b2fb=0xc8;}else{_0x46b2fb=0xce;}_0x17a463[_0xea0c('0x1f')](_0x46b2fb);return _0x17a463[_0xea0c('0x26')](_0xea0c('0x27'),_0x14b831+'-'+_0x4ebad5+'/'+_0x5a2683)['json'](_0x59233c);}return null;};}function patchUpdates(_0x47a276){return function(_0x59263a){try{jsonpatch['apply'](_0x59263a,_0x47a276,!![]);}catch(_0x715c72){return BPromise[_0xea0c('0x28')](_0x715c72);}return _0x59263a[_0xea0c('0x29')]();};}function saveUpdates(_0x4a6a27,_0x251510){return function(_0x32318a){if(_0x32318a){return _0x32318a[_0xea0c('0x2a')](_0x4a6a27)[_0xea0c('0x2b')](function(_0x453699){return _0x453699;});}return null;};}function removeEntity(_0x3dcbc7,_0x279b28){return function(_0x4cdd97){if(_0x4cdd97){return _0x4cdd97[_0xea0c('0x2c')]()[_0xea0c('0x2b')](function(){_0x3dcbc7[_0xea0c('0x1f')](0xcc)[_0xea0c('0x20')]();});}};}function handleEntityNotFound(_0x13318e,_0x5d485a){return function(_0x1b172e){if(!_0x1b172e){_0x13318e[_0xea0c('0x2d')](0x194);}return _0x1b172e;};}function handleError(_0x3ad149,_0x2d6a89){_0x2d6a89=_0x2d6a89||0x1f4;return function(_0x4dd683){logger[_0xea0c('0x2e')](_0x4dd683[_0xea0c('0x2f')]);if(_0x4dd683[_0xea0c('0x30')]){delete _0x4dd683['name'];}_0x3ad149[_0xea0c('0x1f')](_0x2d6a89)['send'](_0x4dd683);};}exports[_0xea0c('0x31')]=function(_0x5d4a19,_0x574925){var _0x5eb69c={},_0x2b351f={},_0x4c54ae={'count':0x0,'rows':[]};var _0x37187e=_[_0xea0c('0x32')](db[_0xea0c('0x33')][_0xea0c('0x34')],function(_0x3b2ecf){return{'name':_0x3b2ecf[_0xea0c('0x35')],'type':_0x3b2ecf[_0xea0c('0x36')][_0xea0c('0x37')]};});_0x2b351f['model']=_['map'](_0x37187e,_0xea0c('0x30'));_0x2b351f[_0xea0c('0x38')]=_[_0xea0c('0x39')](_0x5d4a19[_0xea0c('0x38')]);_0x2b351f['filters']=_[_0xea0c('0x3a')](_0x2b351f['model'],_0x2b351f['query']);_0x5eb69c['attributes']=_[_0xea0c('0x3a')](_0x2b351f[_0xea0c('0x3b')],qs[_0xea0c('0x3c')](_0x5d4a19[_0xea0c('0x38')][_0xea0c('0x3c')]));_0x5eb69c[_0xea0c('0x3d')]=_0x5eb69c[_0xea0c('0x3d')][_0xea0c('0x3e')]?_0x5eb69c[_0xea0c('0x3d')]:_0x2b351f[_0xea0c('0x3b')];if(!_0x5d4a19[_0xea0c('0x38')][_0xea0c('0x3f')](_0xea0c('0x40'))){_0x5eb69c[_0xea0c('0x23')]=qs['limit'](_0x5d4a19[_0xea0c('0x38')][_0xea0c('0x23')]);_0x5eb69c[_0xea0c('0x24')]=qs['offset'](_0x5d4a19[_0xea0c('0x38')][_0xea0c('0x24')]);}_0x5eb69c[_0xea0c('0x41')]=qs['sort'](_0x5d4a19[_0xea0c('0x38')]['sort']);_0x5eb69c[_0xea0c('0x42')]=qs[_0xea0c('0x43')](_[_0xea0c('0x44')](_0x5d4a19[_0xea0c('0x38')],_0x2b351f['filters']),_0x37187e);if(_0x5d4a19['query'][_0xea0c('0x45')]){_0x5eb69c[_0xea0c('0x42')]=_[_0xea0c('0x46')](_0x5eb69c[_0xea0c('0x42')],{'$or':_[_0xea0c('0x32')](_0x37187e,function(_0x384b74){if(_0x384b74[_0xea0c('0x36')]!==_0xea0c('0x47')){var _0x4f98be={};_0x4f98be[_0x384b74['name']]={'$like':'%'+_0x5d4a19[_0xea0c('0x38')][_0xea0c('0x45')]+'%'};return _0x4f98be;}})});}_0x5eb69c=_['merge']({},_0x5eb69c,_0x5d4a19[_0xea0c('0x48')]);var _0x5c6c3b={'where':_0x5eb69c[_0xea0c('0x42')]};return db[_0xea0c('0x33')][_0xea0c('0x25')](_0x5c6c3b)[_0xea0c('0x2b')](function(_0x35d9da){_0x4c54ae[_0xea0c('0x25')]=_0x35d9da;if(_0x5d4a19[_0xea0c('0x38')][_0xea0c('0x49')]){_0x5eb69c['include']=[{'all':!![]}];}return db[_0xea0c('0x33')][_0xea0c('0x4a')](_0x5eb69c);})[_0xea0c('0x2b')](function(_0x817159){_0x4c54ae[_0xea0c('0x4b')]=_0x817159;return _0x4c54ae;})[_0xea0c('0x2b')](respondWithFilteredResult(_0x574925,_0x5eb69c))[_0xea0c('0x4c')](handleError(_0x574925,null));};exports['show']=function(_0x1e5268,_0x5c3bc6){var _0x35b22d={'raw':![],'where':{'id':_0x1e5268[_0xea0c('0x4d')]['id']}},_0x3328e7={};_0x3328e7['model']=_[_0xea0c('0x39')](db['VoiceQueueReport']['rawAttributes']);_0x3328e7[_0xea0c('0x38')]=_[_0xea0c('0x39')](_0x1e5268['query']);_0x3328e7[_0xea0c('0x43')]=_['intersection'](_0x3328e7['model'],_0x3328e7[_0xea0c('0x38')]);_0x35b22d[_0xea0c('0x3d')]=_['intersection'](_0x3328e7[_0xea0c('0x3b')],qs[_0xea0c('0x3c')](_0x1e5268[_0xea0c('0x38')][_0xea0c('0x3c')]));_0x35b22d[_0xea0c('0x3d')]=_0x35b22d[_0xea0c('0x3d')][_0xea0c('0x3e')]?_0x35b22d[_0xea0c('0x3d')]:_0x3328e7[_0xea0c('0x3b')];if(_0x1e5268['query'][_0xea0c('0x49')]){_0x35b22d['include']=[{'all':!![]}];}_0x35b22d=_[_0xea0c('0x46')]({},_0x35b22d,_0x1e5268[_0xea0c('0x48')]);return db['VoiceQueueReport'][_0xea0c('0x4e')](_0x35b22d)[_0xea0c('0x2b')](handleEntityNotFound(_0x5c3bc6,null))[_0xea0c('0x2b')](respondWithResult(_0x5c3bc6,null))['catch'](handleError(_0x5c3bc6,null));};exports['create']=function(_0xcd4ea7,_0x5ced86){return db[_0xea0c('0x33')][_0xea0c('0x4f')](_0xcd4ea7['body'],{})[_0xea0c('0x2b')](respondWithResult(_0x5ced86,0xc9))['catch'](handleError(_0x5ced86,null));};exports[_0xea0c('0x2a')]=function(_0xbbcfee,_0x1c845b){if(_0xbbcfee['body']['id']){delete _0xbbcfee[_0xea0c('0x50')]['id'];}return db[_0xea0c('0x33')][_0xea0c('0x4e')]({'where':{'id':_0xbbcfee['params']['id']}})[_0xea0c('0x2b')](handleEntityNotFound(_0x1c845b,null))[_0xea0c('0x2b')](saveUpdates(_0xbbcfee[_0xea0c('0x50')],null))[_0xea0c('0x2b')](respondWithResult(_0x1c845b,null))[_0xea0c('0x4c')](handleError(_0x1c845b,null));};exports[_0xea0c('0x2c')]=function(_0x9511a2,_0x15dbac){return db[_0xea0c('0x33')][_0xea0c('0x4e')]({'where':{'id':_0x9511a2[_0xea0c('0x4d')]['id']}})[_0xea0c('0x2b')](handleEntityNotFound(_0x15dbac,null))['then'](removeEntity(_0x15dbac,null))['catch'](handleError(_0x15dbac,null));};exports['describe']=function(_0x27467a,_0x464468){return db[_0xea0c('0x33')][_0xea0c('0x51')]()['then'](respondWithResult(_0x464468,null))[_0xea0c('0x4c')](handleError(_0x464468,null));};exports[_0xea0c('0x52')]=function(_0x562b94,_0x2db709){var _0x89fef8={},_0x250a42={},_0x576047={'count':0x0,'rows':[]};_0x250a42[_0xea0c('0x3b')]=_[_0xea0c('0x39')](db[_0xea0c('0x33')]['rawAttributes']);_0x250a42[_0xea0c('0x38')]=_[_0xea0c('0x39')](_0x562b94[_0xea0c('0x38')]);_0x250a42[_0xea0c('0x43')]=_['intersection'](_0x250a42[_0xea0c('0x3b')],_0x250a42[_0xea0c('0x38')]);_0x89fef8[_0xea0c('0x3d')]=_[_0xea0c('0x3a')](_0x250a42['model'],qs[_0xea0c('0x3c')](_0x562b94[_0xea0c('0x38')][_0xea0c('0x3c')]));_0x89fef8[_0xea0c('0x3d')]=_0x89fef8[_0xea0c('0x3d')][_0xea0c('0x3e')]?_0x89fef8[_0xea0c('0x3d')]:_0x250a42[_0xea0c('0x3b')];if(!_0x562b94[_0xea0c('0x38')]['hasOwnProperty'](_0xea0c('0x40'))){_0x89fef8[_0xea0c('0x23')]=qs['limit'](_0x562b94[_0xea0c('0x38')][_0xea0c('0x23')]);_0x89fef8[_0xea0c('0x24')]=qs['offset'](_0x562b94[_0xea0c('0x38')][_0xea0c('0x24')]);}_0x89fef8[_0xea0c('0x41')]=qs[_0xea0c('0x53')](_0x562b94[_0xea0c('0x38')][_0xea0c('0x53')]);_0x89fef8[_0xea0c('0x42')]=qs[_0xea0c('0x43')](_['pick'](_0x562b94['query'],_0x250a42[_0xea0c('0x43')]));if(_0x562b94[_0xea0c('0x38')][_0xea0c('0x45')]){_0x89fef8[_0xea0c('0x42')]=_[_0xea0c('0x46')](_0x89fef8[_0xea0c('0x42')],{'$or':_[_0xea0c('0x32')](_0x89fef8['attributes'],function(_0x3141c1){var _0x59c4fa={};_0x59c4fa[_0x3141c1]={'$like':'%'+_0x562b94[_0xea0c('0x38')][_0xea0c('0x45')]+'%'};return _0x59c4fa;})});}_0x89fef8=_[_0xea0c('0x46')]({},_0x89fef8,_0x562b94[_0xea0c('0x48')]);var _0x1c2814={'where':_0x89fef8[_0xea0c('0x42')]};return db[_0xea0c('0x33')][_0xea0c('0x25')](_0x1c2814)[_0xea0c('0x2b')](function(_0x38ef04){_0x576047[_0xea0c('0x25')]=_0x38ef04;if(_0x562b94[_0xea0c('0x38')][_0xea0c('0x49')]){_0x89fef8[_0xea0c('0x54')]=[{'all':!![]}];}return db[_0xea0c('0x33')][_0xea0c('0x4a')](_0x89fef8);})[_0xea0c('0x2b')](function(_0x159232){_0x576047[_0xea0c('0x4b')]=_0x159232;return _0x576047;})[_0xea0c('0x2b')](respondWithFilteredResult(_0x2db709,_0x89fef8,_0xea0c('0x52')))['catch'](handleError(_0x2db709,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 39e4b7c..0c1c1e5 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 _0x2c07=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueueReport'];(function(_0x1967a3,_0x2e5525){var _0x4647fc=function(_0x3227c8){while(--_0x3227c8){_0x1967a3['push'](_0x1967a3['shift']());}};_0x4647fc(++_0x2e5525);}(_0x2c07,0x13d));var _0x72c0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2c07[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x72c0('0x0'));var VoiceQueueReport=require(_0x72c0('0x1'))['db'][_0x72c0('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x72c0('0x3')](0x0);var events={'afterCreate':_0x72c0('0x4'),'afterUpdate':'update','afterDestroy':_0x72c0('0x5')};function emitEvent(_0x27ccf7){return function(_0x3cf03e,_0x5725e1,_0x277686){VoiceQueueReportEvents[_0x72c0('0x6')](_0x27ccf7+':'+_0x3cf03e['id'],_0x3cf03e);VoiceQueueReportEvents[_0x72c0('0x6')](_0x27ccf7,_0x3cf03e);_0x277686(null);};}for(var e in events){if(events[_0x72c0('0x7')](e)){var event=events[e];VoiceQueueReport[_0x72c0('0x8')](e,emitEvent(event));}}module[_0x72c0('0x9')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x28d0=['exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x131bb1,_0x5c91cc){var _0x4b006b=function(_0x236496){while(--_0x236496){_0x131bb1['push'](_0x131bb1['shift']());}};_0x4b006b(++_0x5c91cc);}(_0x28d0,0x14e));var _0x028d=function(_0x319e9f,_0xd20b4c){_0x319e9f=_0x319e9f-0x0;var _0x4beda8=_0x28d0[_0x319e9f];return _0x4beda8;};'use strict';var EventEmitter=require(_0x028d('0x0'));var VoiceQueueReport=require(_0x028d('0x1'))['db'][_0x028d('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x028d('0x3')](0x0);var events={'afterCreate':_0x028d('0x4'),'afterUpdate':'update','afterDestroy':_0x028d('0x5')};function emitEvent(_0x21160c){return function(_0x52f0c8,_0x2fe58c,_0x405f1e){VoiceQueueReportEvents[_0x028d('0x6')](_0x21160c+':'+_0x52f0c8['id'],_0x52f0c8);VoiceQueueReportEvents[_0x028d('0x6')](_0x21160c,_0x52f0c8);_0x405f1e(null);};}for(var e in events){if(events[_0x028d('0x7')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x028d('0x8')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 01a3e4c..3df7b74 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 _0xaf16=['../../config/logger','api','bluebird','path','rimraf','./voiceQueueReport.attributes','exports','VoiceQueueReport','uniqueid','lodash','util'];(function(_0x3d8427,_0x26d438){var _0x50fbb5=function(_0x35a075){while(--_0x35a075){_0x3d8427['push'](_0x3d8427['shift']());}};_0x50fbb5(++_0x26d438);}(_0xaf16,0xf0));var _0x6af1=function(_0x1dae94,_0x239003){_0x1dae94=_0x1dae94-0x0;var _0x36ce2d=_0xaf16[_0x1dae94];return _0x36ce2d;};'use strict';var _=require(_0x6af1('0x0'));var util=require(_0x6af1('0x1'));var logger=require(_0x6af1('0x2'))(_0x6af1('0x3'));var moment=require('moment');var BPromise=require(_0x6af1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6af1('0x5'));var rimraf=require(_0x6af1('0x6'));var config=require('../../config/environment');var attributes=require(_0x6af1('0x7'));module[_0x6af1('0x8')]=function(_0x4c83f6,_0x544cbd){return _0x4c83f6['define'](_0x6af1('0x9'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x6af1('0xa')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6d7f=['rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','util','../../config/logger','api','moment','bluebird','path'];(function(_0x314d41,_0x389b1f){var _0x4159d8=function(_0x5c922f){while(--_0x5c922f){_0x314d41['push'](_0x314d41['shift']());}};_0x4159d8(++_0x389b1f);}(_0x6d7f,0x94));var _0xf6d7=function(_0x4a990f,_0x52103a){_0x4a990f=_0x4a990f-0x0;var _0x1707d1=_0x6d7f[_0x4a990f];return _0x1707d1;};'use strict';var _=require('lodash');var util=require(_0xf6d7('0x0'));var logger=require(_0xf6d7('0x1'))(_0xf6d7('0x2'));var moment=require(_0xf6d7('0x3'));var BPromise=require(_0xf6d7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf6d7('0x5'));var rimraf=require(_0xf6d7('0x6'));var config=require(_0xf6d7('0x7'));var attributes=require(_0xf6d7('0x8'));module[_0xf6d7('0x9')]=function(_0x621ab2,_0x253056){return _0x621ab2[_0xf6d7('0xa')]('VoiceQueueReport',attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index fe58c00..0c18752 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 _0x27e5=['then','debug','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','raw','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceQueueReport','VoiceQueueReport','options','where','attributes','limit','map','include','model'];(function(_0x2376ff,_0x501212){var _0x38e668=function(_0x3203bd){while(--_0x3203bd){_0x2376ff['push'](_0x2376ff['shift']());}};_0x38e668(++_0x501212);}(_0x27e5,0xdf));var _0x527e=function(_0x5d1a8d,_0x1151c7){_0x5d1a8d=_0x5d1a8d-0x0;var _0x2f641c=_0x27e5[_0x5d1a8d];return _0x2f641c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x527e('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x527e('0x1'));var db=require(_0x527e('0x2'))['db'];var utils=require(_0x527e('0x3'));var logger=require(_0x527e('0x4'))(_0x527e('0x5'));var config=require(_0x527e('0x6'));var jayson=require(_0x527e('0x7'));var client=jayson[_0x527e('0x8')]['http']({'port':0x232a});config[_0x527e('0x9')]=_[_0x527e('0xa')](config[_0x527e('0x9')],{'host':_0x527e('0xb'),'port':0x18eb});var socket=require(_0x527e('0xc'))(new Redis(config[_0x527e('0x9')]));require(_0x527e('0xd'))[_0x527e('0xe')](socket);function respondWithRpcPromise(_0x17ae62,_0x2f9530,_0x4c524e){return new BPromise(function(_0x43cece,_0x15db7f){return client[_0x527e('0xf')](_0x17ae62,_0x4c524e)['then'](function(_0x10648c){logger['info'](_0x527e('0x10'),_0x2f9530,_0x527e('0x11'));logger['debug'](_0x527e('0x12'),_0x2f9530,_0x527e('0x11'),JSON[_0x527e('0x13')](_0x10648c));if(_0x10648c[_0x527e('0x14')]){if(_0x10648c[_0x527e('0x14')][_0x527e('0x15')]===0x1f4){logger[_0x527e('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x2f9530,_0x10648c[_0x527e('0x14')][_0x527e('0x16')]);return _0x15db7f(_0x10648c['error'][_0x527e('0x16')]);}logger[_0x527e('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x2f9530,_0x10648c[_0x527e('0x14')][_0x527e('0x16')]);return _0x43cece(_0x10648c['error'][_0x527e('0x16')]);}else{logger[_0x527e('0x17')](_0x527e('0x10'),_0x2f9530,_0x527e('0x11'));_0x43cece(_0x10648c[_0x527e('0x18')][_0x527e('0x16')]);}})[_0x527e('0x19')](function(_0x7d5623){logger['error'](_0x527e('0x10'),_0x2f9530,_0x7d5623);_0x15db7f(_0x7d5623);});});}exports[_0x527e('0x1a')]=function(_0xf36355){var _0x1f66e6=this;return new Promise(function(_0x3fcfaf,_0x3f433b){return db[_0x527e('0x1b')]['findAll']({'raw':_0xf36355[_0x527e('0x1c')]?_0xf36355['options']['raw']===undefined?!![]:![]:!![],'where':_0xf36355[_0x527e('0x1c')]?_0xf36355['options'][_0x527e('0x1d')]||null:null,'attributes':_0xf36355[_0x527e('0x1c')]?_0xf36355[_0x527e('0x1c')][_0x527e('0x1e')]||null:null,'limit':_0xf36355[_0x527e('0x1c')]?_0xf36355['options'][_0x527e('0x1f')]||null:null,'include':_0xf36355[_0x527e('0x1c')]?_0xf36355['options']['include']?_[_0x527e('0x20')](_0xf36355[_0x527e('0x1c')]['include'],function(_0x10a7ec){return{'model':db[_0x10a7ec['model']],'as':_0x10a7ec['as'],'attributes':_0x10a7ec[_0x527e('0x1e')],'include':_0x10a7ec[_0x527e('0x21')]?_['map'](_0x10a7ec['include'],function(_0x50e080){return{'model':db[_0x50e080[_0x527e('0x22')]],'as':_0x50e080['as'],'attributes':_0x50e080[_0x527e('0x1e')],'include':_0x50e080[_0x527e('0x21')]?_[_0x527e('0x20')](_0x50e080[_0x527e('0x21')],function(_0x212290){return{'model':db[_0x212290['model']],'as':_0x212290['as'],'attributes':_0x212290[_0x527e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x527e('0x23')](function(_0x9c4830){logger[_0x527e('0x17')]('GetVoiceQueueReport',_0xf36355);logger[_0x527e('0x24')](_0x527e('0x1a'),_0xf36355,JSON[_0x527e('0x13')](_0x9c4830));_0x3fcfaf(_0x9c4830);})['catch'](function(_0x21cd6e){logger[_0x527e('0x14')](_0x527e('0x1a'),_0x21cd6e[_0x527e('0x16')],_0xf36355);_0x3f433b(_0x1f66e6['error'](0x1f4,_0x21cd6e[_0x527e('0x16')]));});});};exports[_0x527e('0x25')]=function(_0x150734){var _0x44df0e=this;return new Promise(function(_0xff7d86,_0x3d69ea){return db[_0x527e('0x1b')][_0x527e('0x26')](_0x150734[_0x527e('0x27')],{'raw':_0x150734['options']?_0x150734[_0x527e('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x527e('0x23')](function(_0x2f1484){logger[_0x527e('0x17')](_0x527e('0x25'),_0x150734);logger[_0x527e('0x24')](_0x527e('0x25'),_0x150734,JSON[_0x527e('0x13')](_0x2f1484));_0xff7d86(_0x2f1484);})[_0x527e('0x19')](function(_0x1bb13e){logger[_0x527e('0x14')](_0x527e('0x25'),_0x1bb13e[_0x527e('0x16')],_0x150734);_0x3d69ea(_0x44df0e[_0x527e('0x14')](0x1f4,_0x1bb13e[_0x527e('0x16')]));});});};exports[_0x527e('0x28')]=function(_0x49dc43){var _0x21ea40=this;return new Promise(function(_0x4814df,_0x50e848){return db[_0x527e('0x1b')][_0x527e('0x29')](_0x49dc43['body'],{'raw':_0x49dc43[_0x527e('0x1c')]?_0x49dc43['options'][_0x527e('0x2a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49dc43['options']?_0x49dc43[_0x527e('0x1c')][_0x527e('0x1d')]||null:null,'attributes':_0x49dc43[_0x527e('0x1c')]?_0x49dc43[_0x527e('0x1c')][_0x527e('0x1e')]||null:null,'limit':_0x49dc43[_0x527e('0x1c')]?_0x49dc43[_0x527e('0x1c')][_0x527e('0x1f')]||null:null})[_0x527e('0x23')](function(_0x45553f){logger[_0x527e('0x17')](_0x527e('0x28'),_0x49dc43);logger[_0x527e('0x24')](_0x527e('0x28'),_0x49dc43,JSON[_0x527e('0x13')](_0x45553f));_0x4814df(_0x45553f);})[_0x527e('0x19')](function(_0x287e28){logger[_0x527e('0x14')](_0x527e('0x28'),_0x287e28[_0x527e('0x16')],_0x49dc43);_0x50e848(_0x21ea40[_0x527e('0x14')](0x1f4,_0x287e28[_0x527e('0x16')]));});});}; \ No newline at end of file +var _0xbf2d=['error','code','message','info','request\x20sent','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','attributes','limit','map','include','model','stringify','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','where','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','VoiceQueueReport,\x20%s,\x20%s','debug'];(function(_0x2d4dc7,_0x66d24b){var _0x5552e4=function(_0x5988fd){while(--_0x5988fd){_0x2d4dc7['push'](_0x2d4dc7['shift']());}};_0x5552e4(++_0x66d24b);}(_0xbf2d,0x170));var _0xdbf2=function(_0x25b20a,_0x1eac87){_0x25b20a=_0x25b20a-0x0;var _0x3dbf8a=_0xbf2d[_0x25b20a];return _0x3dbf8a;};'use strict';var _=require(_0xdbf2('0x0'));var util=require(_0xdbf2('0x1'));var moment=require('moment');var BPromise=require(_0xdbf2('0x2'));var rs=require(_0xdbf2('0x3'));var fs=require('fs');var Redis=require(_0xdbf2('0x4'));var db=require(_0xdbf2('0x5'))['db'];var utils=require(_0xdbf2('0x6'));var logger=require(_0xdbf2('0x7'))(_0xdbf2('0x8'));var config=require(_0xdbf2('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xdbf2('0xa')]=_['defaults'](config[_0xdbf2('0xa')],{'host':_0xdbf2('0xb'),'port':0x18eb});var socket=require(_0xdbf2('0xc'))(new Redis(config['redis']));require(_0xdbf2('0xd'))[_0xdbf2('0xe')](socket);function respondWithRpcPromise(_0x2e4950,_0x4e2f35,_0x128f48){return new BPromise(function(_0x48449c,_0x4ca8e5){return client[_0xdbf2('0xf')](_0x2e4950,_0x128f48)[_0xdbf2('0x10')](function(_0x41ea41){logger['info'](_0xdbf2('0x11'),_0x4e2f35,'request\x20sent');logger[_0xdbf2('0x12')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x4e2f35,'request\x20sent',JSON['stringify'](_0x41ea41));if(_0x41ea41[_0xdbf2('0x13')]){if(_0x41ea41['error'][_0xdbf2('0x14')]===0x1f4){logger[_0xdbf2('0x13')](_0xdbf2('0x11'),_0x4e2f35,_0x41ea41['error']['message']);return _0x4ca8e5(_0x41ea41[_0xdbf2('0x13')][_0xdbf2('0x15')]);}logger['error'](_0xdbf2('0x11'),_0x4e2f35,_0x41ea41[_0xdbf2('0x13')][_0xdbf2('0x15')]);return _0x48449c(_0x41ea41[_0xdbf2('0x13')][_0xdbf2('0x15')]);}else{logger[_0xdbf2('0x16')](_0xdbf2('0x11'),_0x4e2f35,_0xdbf2('0x17'));_0x48449c(_0x41ea41[_0xdbf2('0x18')][_0xdbf2('0x15')]);}})[_0xdbf2('0x19')](function(_0x9337d7){logger[_0xdbf2('0x13')](_0xdbf2('0x11'),_0x4e2f35,_0x9337d7);_0x4ca8e5(_0x9337d7);});});}exports[_0xdbf2('0x1a')]=function(_0x582c57){var _0x367bf6=this;return new Promise(function(_0x409ba5,_0x1024f7){return db[_0xdbf2('0x1b')][_0xdbf2('0x1c')]({'raw':_0x582c57[_0xdbf2('0x1d')]?_0x582c57['options'][_0xdbf2('0x1e')]===undefined?!![]:![]:!![],'where':_0x582c57[_0xdbf2('0x1d')]?_0x582c57[_0xdbf2('0x1d')]['where']||null:null,'attributes':_0x582c57[_0xdbf2('0x1d')]?_0x582c57[_0xdbf2('0x1d')][_0xdbf2('0x1f')]||null:null,'limit':_0x582c57[_0xdbf2('0x1d')]?_0x582c57[_0xdbf2('0x1d')][_0xdbf2('0x20')]||null:null,'include':_0x582c57[_0xdbf2('0x1d')]?_0x582c57[_0xdbf2('0x1d')]['include']?_[_0xdbf2('0x21')](_0x582c57[_0xdbf2('0x1d')][_0xdbf2('0x22')],function(_0x487914){return{'model':db[_0x487914['model']],'as':_0x487914['as'],'attributes':_0x487914['attributes'],'include':_0x487914[_0xdbf2('0x22')]?_[_0xdbf2('0x21')](_0x487914['include'],function(_0x4894db){return{'model':db[_0x4894db['model']],'as':_0x4894db['as'],'attributes':_0x4894db['attributes'],'include':_0x4894db['include']?_[_0xdbf2('0x21')](_0x4894db[_0xdbf2('0x22')],function(_0x202883){return{'model':db[_0x202883[_0xdbf2('0x23')]],'as':_0x202883['as'],'attributes':_0x202883[_0xdbf2('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xdbf2('0x10')](function(_0x5b9f40){logger[_0xdbf2('0x16')](_0xdbf2('0x1a'),_0x582c57);logger[_0xdbf2('0x12')]('GetVoiceQueueReport',_0x582c57,JSON[_0xdbf2('0x24')](_0x5b9f40));_0x409ba5(_0x5b9f40);})[_0xdbf2('0x19')](function(_0x438aeb){logger[_0xdbf2('0x13')]('GetVoiceQueueReport',_0x438aeb['message'],_0x582c57);_0x1024f7(_0x367bf6[_0xdbf2('0x13')](0x1f4,_0x438aeb[_0xdbf2('0x15')]));});});};exports[_0xdbf2('0x25')]=function(_0x19d5de){var _0x1db36e=this;return new Promise(function(_0x5c5d58,_0x1eb282){return db[_0xdbf2('0x1b')][_0xdbf2('0x26')](_0x19d5de[_0xdbf2('0x27')],{'raw':_0x19d5de['options']?_0x19d5de[_0xdbf2('0x1d')][_0xdbf2('0x1e')]===undefined?!![]:![]:!![]})[_0xdbf2('0x10')](function(_0x35057c){logger[_0xdbf2('0x16')](_0xdbf2('0x25'),_0x19d5de);logger['debug'](_0xdbf2('0x25'),_0x19d5de,JSON['stringify'](_0x35057c));_0x5c5d58(_0x35057c);})[_0xdbf2('0x19')](function(_0x27a21f){logger['error']('CreateVoiceQueueReport',_0x27a21f[_0xdbf2('0x15')],_0x19d5de);_0x1eb282(_0x1db36e['error'](0x1f4,_0x27a21f['message']));});});};exports[_0xdbf2('0x28')]=function(_0x791b){var _0x4a727c=this;return new Promise(function(_0x402162,_0x2d27c8){return db['VoiceQueueReport'][_0xdbf2('0x29')](_0x791b['body'],{'raw':_0x791b[_0xdbf2('0x1d')]?_0x791b[_0xdbf2('0x1d')][_0xdbf2('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x791b[_0xdbf2('0x1d')]?_0x791b[_0xdbf2('0x1d')][_0xdbf2('0x2a')]||null:null,'attributes':_0x791b[_0xdbf2('0x1d')]?_0x791b['options'][_0xdbf2('0x1f')]||null:null,'limit':_0x791b[_0xdbf2('0x1d')]?_0x791b[_0xdbf2('0x1d')][_0xdbf2('0x20')]||null:null})[_0xdbf2('0x10')](function(_0x27e2d1){logger[_0xdbf2('0x16')]('UpdateVoiceQueueReport',_0x791b);logger[_0xdbf2('0x12')]('UpdateVoiceQueueReport',_0x791b,JSON[_0xdbf2('0x24')](_0x27e2d1));_0x402162(_0x27e2d1);})['catch'](function(_0x164e6b){logger[_0xdbf2('0x13')](_0xdbf2('0x28'),_0x164e6b['message'],_0x791b);_0x2d27c8(_0x4a727c['error'](0x1f4,_0x164e6b['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 9e86ba9..fadd10c 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 _0x3c94=['remove','update','emit','removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events','save'];(function(_0x1671ee,_0x295c2a){var _0x53bae4=function(_0x351ea7){while(--_0x351ea7){_0x1671ee['push'](_0x1671ee['shift']());}};_0x53bae4(++_0x295c2a);}(_0x3c94,0xcd));var _0x43c9=function(_0x8be9fb,_0x2f90d9){_0x8be9fb=_0x8be9fb-0x0;var _0x3b41ac=_0x3c94[_0x8be9fb];return _0x3b41ac;};'use strict';var VoiceQueueReportEvents=require(_0x43c9('0x0'));var events=[_0x43c9('0x1'),_0x43c9('0x2'),_0x43c9('0x3')];function createListener(_0x188507,_0x2da73f){return function(_0xe05adb){_0x2da73f[_0x43c9('0x4')](_0x188507,_0xe05adb);};}function removeListener(_0x170a0d,_0x44fc3){return function(){VoiceQueueReportEvents[_0x43c9('0x5')](_0x170a0d,_0x44fc3);};}exports[_0x43c9('0x6')]=function(_0x4fdfc2){for(var _0x39c220=0x0,_0xf03007=events[_0x43c9('0x7')];_0x39c220<_0xf03007;_0x39c220++){var _0x37c029=events[_0x39c220];var _0x383adb=createListener(_0x43c9('0x8')+_0x37c029,_0x4fdfc2);VoiceQueueReportEvents['on'](_0x37c029,_0x383adb);}}; \ No newline at end of file +var _0x7e1e=['register','length','voiceQueueReport:','./voiceQueueReport.events','save','remove','update','removeListener'];(function(_0x30e36b,_0x303039){var _0xa08092=function(_0x1ae2e1){while(--_0x1ae2e1){_0x30e36b['push'](_0x30e36b['shift']());}};_0xa08092(++_0x303039);}(_0x7e1e,0x183));var _0xe7e1=function(_0xc51cc4,_0xe7cd55){_0xc51cc4=_0xc51cc4-0x0;var _0x4ca42d=_0x7e1e[_0xc51cc4];return _0x4ca42d;};'use strict';var VoiceQueueReportEvents=require(_0xe7e1('0x0'));var events=[_0xe7e1('0x1'),_0xe7e1('0x2'),_0xe7e1('0x3')];function createListener(_0x584966,_0x10218a){return function(_0x30b599){_0x10218a['emit'](_0x584966,_0x30b599);};}function removeListener(_0x3cad81,_0x1fa1fd){return function(){VoiceQueueReportEvents[_0xe7e1('0x4')](_0x3cad81,_0x1fa1fd);};}exports[_0xe7e1('0x5')]=function(_0x55da3d){for(var _0x1ebba9=0x0,_0xecc921=events[_0xe7e1('0x6')];_0x1ebba9<_0xecc921;_0x1ebba9++){var _0x3bb69c=events[_0x1ebba9];var _0x17e3dd=createListener(_0xe7e1('0x7')+_0x3bb69c,_0x55da3d);VoiceQueueReportEvents['on'](_0x3bb69c,_0x17e3dd);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index d098e29..30f2938 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 _0xefd6=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports'];(function(_0x53bfa4,_0x4f13b8){var _0x4b4d37=function(_0x20079d){while(--_0x20079d){_0x53bfa4['push'](_0x53bfa4['shift']());}};_0x4b4d37(++_0x4f13b8);}(_0xefd6,0x126));var _0x6efd=function(_0x37d8f4,_0x260370){_0x37d8f4=_0x37d8f4-0x0;var _0x1592ac=_0xefd6[_0x37d8f4];return _0x1592ac;};'use strict';var multer=require(_0x6efd('0x0'));var util=require(_0x6efd('0x1'));var path=require(_0x6efd('0x2'));var timeout=require(_0x6efd('0x3'));var express=require(_0x6efd('0x4'));var router=express['Router']();var fs_extra=require(_0x6efd('0x5'));var auth=require(_0x6efd('0x6'));var interaction=require(_0x6efd('0x7'));var config=require(_0x6efd('0x8'));var controller=require(_0x6efd('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x6efd('0xa')]);router['get'](_0x6efd('0xb'),auth[_0x6efd('0xc')](),controller[_0x6efd('0xd')]);router[_0x6efd('0xe')]('/',auth[_0x6efd('0xc')](),controller[_0x6efd('0xf')]);router[_0x6efd('0x10')]('/:id',auth[_0x6efd('0xc')](),controller[_0x6efd('0x11')]);router[_0x6efd('0x12')](_0x6efd('0xb'),auth[_0x6efd('0xc')](),controller[_0x6efd('0x13')]);module[_0x6efd('0x14')]=router; \ No newline at end of file +var _0xda33=['/:id','post','create','put','update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated'];(function(_0x56a7bc,_0x41d6f6){var _0x4f5883=function(_0x23e4a4){while(--_0x23e4a4){_0x56a7bc['push'](_0x56a7bc['shift']());}};_0x4f5883(++_0x41d6f6);}(_0xda33,0x1b7));var _0x3da3=function(_0x4f1cb2,_0x2b2fd1){_0x4f1cb2=_0x4f1cb2-0x0;var _0x3fc8e4=_0xda33[_0x4f1cb2];return _0x3fc8e4;};'use strict';var multer=require(_0x3da3('0x0'));var util=require(_0x3da3('0x1'));var path=require(_0x3da3('0x2'));var timeout=require('connect-timeout');var express=require(_0x3da3('0x3'));var router=express[_0x3da3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3da3('0x5'));var interaction=require(_0x3da3('0x6'));var config=require(_0x3da3('0x7'));var controller=require(_0x3da3('0x8'));router[_0x3da3('0x9')]('/',auth[_0x3da3('0xa')](),controller['index']);router[_0x3da3('0x9')](_0x3da3('0xb'),auth[_0x3da3('0xa')](),controller['show']);router[_0x3da3('0xc')]('/',auth['isAuthenticated'](),controller[_0x3da3('0xd')]);router[_0x3da3('0xe')]('/:id',auth[_0x3da3('0xa')](),controller[_0x3da3('0xf')]);router[_0x3da3('0x10')]('/:id',auth[_0x3da3('0xa')](),controller[_0x3da3('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 70ad119..3c284bd 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 _0x61da=['DATE','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment','exports','STRING'];(function(_0x590b1f,_0x891e35){var _0x56c30a=function(_0x9e0d89){while(--_0x9e0d89){_0x590b1f['push'](_0x590b1f['shift']());}};_0x56c30a(++_0x891e35);}(_0x61da,0x13a));var _0xa61d=function(_0x138b0d,_0x49b882){_0x138b0d=_0x138b0d-0x0;var _0x8d1ddc=_0x61da[_0x138b0d];return _0x8d1ddc;};'use strict';var Sequelize=require(_0xa61d('0x0'));var moment=require(_0xa61d('0x1'));module[_0xa61d('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0xa61d('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xa61d('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xa61d('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xa61d('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xa61d('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xa61d('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xa61d('0x4')],'allowNull':![],'defaultValue':Sequelize['literal'](_0xa61d('0x5'))}}; \ No newline at end of file +var _0x1b2d=['STRING','DATE','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','moment','exports'];(function(_0x99ff94,_0x47a1b1){var _0x1b5bc0=function(_0x25821f){while(--_0x25821f){_0x99ff94['push'](_0x99ff94['shift']());}};_0x1b5bc0(++_0x47a1b1);}(_0x1b2d,0x143));var _0xd1b2=function(_0x42bfc2,_0x1cd78f){_0x42bfc2=_0x42bfc2-0x0;var _0xeb6185=_0x1b2d[_0x42bfc2];return _0xeb6185;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xd1b2('0x0'));module[_0xd1b2('0x1')]={'time':{'type':Sequelize[_0xd1b2('0x2')]},'callid':{'type':Sequelize[_0xd1b2('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xd1b2('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xd1b2('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xd1b2('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xd1b2('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xd1b2('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xd1b2('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xd1b2('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xd1b2('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xd1b2('0x3')],'allowNull':![],'defaultValue':Sequelize['literal'](_0xd1b2('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 01a7a22..0685ed5 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 _0xf253=['rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','order','sort','where','merge','VIRTUAL','options','include','findAll','rows','show','params','intersection','includeAll','find','catch','create','body','eml-format'];(function(_0x42d6d0,_0x2693d7){var _0x7e9ed=function(_0x22f692){while(--_0x22f692){_0x42d6d0['push'](_0x42d6d0['shift']());}};_0x7e9ed(++_0x2693d7);}(_0xf253,0x95));var _0x3f25=function(_0x135e32,_0x880d3a){_0x135e32=_0x135e32-0x0;var _0x2cbb45=_0xf253[_0x135e32];return _0x2cbb45;};'use strict';var emlformat=require(_0x3f25('0x0'));var rimraf=require(_0x3f25('0x1'));var zipdir=require(_0x3f25('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3f25('0x3'));var moment=require(_0x3f25('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3f25('0x5'));var util=require(_0x3f25('0x6'));var path=require(_0x3f25('0x7'));var sox=require(_0x3f25('0x8'));var csv=require(_0x3f25('0x9'));var ejs=require(_0x3f25('0xa'));var fs=require('fs');var fs_extra=require(_0x3f25('0xb'));var _=require(_0x3f25('0xc'));var squel=require(_0x3f25('0xd'));var crypto=require('crypto');var jsforce=require(_0x3f25('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3f25('0x9'));var querystring=require(_0x3f25('0xf'));var Papa=require(_0x3f25('0x10'));var Redis=require(_0x3f25('0x11'));var authService=require(_0x3f25('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3f25('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3f25('0x14'))(_0x3f25('0x15'));var utils=require(_0x3f25('0x16'));var config=require(_0x3f25('0x17'));var licenseUtil=require(_0x3f25('0x18'));var db=require(_0x3f25('0x19'))['db'];function respondWithStatusCode(_0xf67545,_0x56e558){_0x56e558=_0x56e558||0xcc;return function(_0x397da5){if(_0x397da5){return _0xf67545['sendStatus'](_0x56e558);}return _0xf67545[_0x3f25('0x1a')](_0x56e558)['end']();};}function respondWithResult(_0x46b3e2,_0x317888){_0x317888=_0x317888||0xc8;return function(_0x3b6f4a){if(_0x3b6f4a){return _0x46b3e2['status'](_0x317888)['json'](_0x3b6f4a);}};}function respondWithFilteredResult(_0x24f079,_0x612380){return function(_0x7c3cd9){if(_0x7c3cd9){var _0x51877a=typeof _0x612380[_0x3f25('0x1b')]==='undefined'&&typeof _0x612380[_0x3f25('0x1c')]===_0x3f25('0x1d');var _0x123d2b=_0x7c3cd9['count'];var _0x21b3ed=_0x51877a?0x0:_0x612380['offset'];var _0x4bb9ea=_0x51877a?_0x7c3cd9[_0x3f25('0x1e')]:_0x612380[_0x3f25('0x1b')]+_0x612380[_0x3f25('0x1c')];var _0x3e6386;if(_0x4bb9ea>=_0x123d2b){_0x4bb9ea=_0x123d2b;_0x3e6386=0xc8;}else{_0x3e6386=0xce;}_0x24f079[_0x3f25('0x1a')](_0x3e6386);return _0x24f079[_0x3f25('0x1f')](_0x3f25('0x20'),_0x21b3ed+'-'+_0x4bb9ea+'/'+_0x123d2b)[_0x3f25('0x21')](_0x7c3cd9);}return null;};}function patchUpdates(_0x452340){return function(_0x1f332a){try{jsonpatch['apply'](_0x1f332a,_0x452340,!![]);}catch(_0x37f63d){return BPromise[_0x3f25('0x22')](_0x37f63d);}return _0x1f332a[_0x3f25('0x23')]();};}function saveUpdates(_0x793d20,_0x3d6078){return function(_0x39c06d){if(_0x39c06d){return _0x39c06d[_0x3f25('0x24')](_0x793d20)[_0x3f25('0x25')](function(_0x2a47e2){return _0x2a47e2;});}return null;};}function removeEntity(_0x48ca98,_0xd46579){return function(_0x2f7fc4){if(_0x2f7fc4){return _0x2f7fc4[_0x3f25('0x26')]()[_0x3f25('0x25')](function(){_0x48ca98['status'](0xcc)[_0x3f25('0x27')]();});}};}function handleEntityNotFound(_0x4e28fe,_0x39c458){return function(_0x4183c0){if(!_0x4183c0){_0x4e28fe[_0x3f25('0x28')](0x194);}return _0x4183c0;};}function handleError(_0x27fe46,_0x359ba0){_0x359ba0=_0x359ba0||0x1f4;return function(_0x21a552){logger[_0x3f25('0x29')](_0x21a552[_0x3f25('0x2a')]);if(_0x21a552[_0x3f25('0x2b')]){delete _0x21a552[_0x3f25('0x2b')];}_0x27fe46[_0x3f25('0x1a')](_0x359ba0)[_0x3f25('0x2c')](_0x21a552);};}exports[_0x3f25('0x2d')]=function(_0x2ebd17,_0x262df6){var _0x11e7b6={},_0x27509f={},_0x1f6033={'count':0x0,'rows':[]};var _0x25d41a=_[_0x3f25('0x2e')](db[_0x3f25('0x2f')][_0x3f25('0x30')],function(_0x59caa8){return{'name':_0x59caa8['fieldName'],'type':_0x59caa8[_0x3f25('0x31')][_0x3f25('0x32')]};});_0x27509f[_0x3f25('0x33')]=_[_0x3f25('0x2e')](_0x25d41a,_0x3f25('0x2b'));_0x27509f[_0x3f25('0x34')]=_[_0x3f25('0x35')](_0x2ebd17[_0x3f25('0x34')]);_0x27509f[_0x3f25('0x36')]=_['intersection'](_0x27509f[_0x3f25('0x33')],_0x27509f['query']);_0x11e7b6[_0x3f25('0x37')]=_['intersection'](_0x27509f[_0x3f25('0x33')],qs[_0x3f25('0x38')](_0x2ebd17[_0x3f25('0x34')][_0x3f25('0x38')]));_0x11e7b6['attributes']=_0x11e7b6[_0x3f25('0x37')]['length']?_0x11e7b6['attributes']:_0x27509f['model'];if(!_0x2ebd17['query'][_0x3f25('0x39')]('nolimit')){_0x11e7b6[_0x3f25('0x1c')]=qs['limit'](_0x2ebd17['query'][_0x3f25('0x1c')]);_0x11e7b6['offset']=qs[_0x3f25('0x1b')](_0x2ebd17[_0x3f25('0x34')]['offset']);}_0x11e7b6[_0x3f25('0x3a')]=qs[_0x3f25('0x3b')](_0x2ebd17[_0x3f25('0x34')][_0x3f25('0x3b')]);_0x11e7b6['where']=qs['filters'](_['pick'](_0x2ebd17[_0x3f25('0x34')],_0x27509f[_0x3f25('0x36')]),_0x25d41a);if(_0x2ebd17[_0x3f25('0x34')]['filter']){_0x11e7b6[_0x3f25('0x3c')]=_[_0x3f25('0x3d')](_0x11e7b6['where'],{'$or':_[_0x3f25('0x2e')](_0x25d41a,function(_0x49fc08){if(_0x49fc08['type']!==_0x3f25('0x3e')){var _0x42504c={};_0x42504c[_0x49fc08[_0x3f25('0x2b')]]={'$like':'%'+_0x2ebd17[_0x3f25('0x34')]['filter']+'%'};return _0x42504c;}})});}_0x11e7b6=_[_0x3f25('0x3d')]({},_0x11e7b6,_0x2ebd17[_0x3f25('0x3f')]);var _0x51db53={'where':_0x11e7b6['where']};return db[_0x3f25('0x2f')]['count'](_0x51db53)[_0x3f25('0x25')](function(_0x1ab008){_0x1f6033[_0x3f25('0x1e')]=_0x1ab008;if(_0x2ebd17[_0x3f25('0x34')]['includeAll']){_0x11e7b6[_0x3f25('0x40')]=[{'all':!![]}];}return db[_0x3f25('0x2f')][_0x3f25('0x41')](_0x11e7b6);})[_0x3f25('0x25')](function(_0x1ba1d9){_0x1f6033[_0x3f25('0x42')]=_0x1ba1d9;return _0x1f6033;})[_0x3f25('0x25')](respondWithFilteredResult(_0x262df6,_0x11e7b6))['catch'](handleError(_0x262df6,null));};exports[_0x3f25('0x43')]=function(_0x2bfc90,_0x3ec14e){var _0x3eb6a1={'raw':!![],'where':{'id':_0x2bfc90[_0x3f25('0x44')]['id']}},_0x3f8edf={};_0x3f8edf[_0x3f25('0x33')]=_[_0x3f25('0x35')](db[_0x3f25('0x2f')][_0x3f25('0x30')]);_0x3f8edf['query']=_[_0x3f25('0x35')](_0x2bfc90[_0x3f25('0x34')]);_0x3f8edf[_0x3f25('0x36')]=_['intersection'](_0x3f8edf[_0x3f25('0x33')],_0x3f8edf[_0x3f25('0x34')]);_0x3eb6a1[_0x3f25('0x37')]=_[_0x3f25('0x45')](_0x3f8edf[_0x3f25('0x33')],qs[_0x3f25('0x38')](_0x2bfc90[_0x3f25('0x34')][_0x3f25('0x38')]));_0x3eb6a1['attributes']=_0x3eb6a1[_0x3f25('0x37')]['length']?_0x3eb6a1[_0x3f25('0x37')]:_0x3f8edf['model'];if(_0x2bfc90[_0x3f25('0x34')][_0x3f25('0x46')]){_0x3eb6a1[_0x3f25('0x40')]=[{'all':!![]}];}_0x3eb6a1=_['merge']({},_0x3eb6a1,_0x2bfc90['options']);return db[_0x3f25('0x2f')][_0x3f25('0x47')](_0x3eb6a1)['then'](handleEntityNotFound(_0x3ec14e,null))['then'](respondWithResult(_0x3ec14e,null))[_0x3f25('0x48')](handleError(_0x3ec14e,null));};exports[_0x3f25('0x49')]=function(_0x45a1d4,_0x1cfc58){return db[_0x3f25('0x2f')][_0x3f25('0x49')](_0x45a1d4['body'],{})[_0x3f25('0x25')](respondWithResult(_0x1cfc58,0xc9))[_0x3f25('0x48')](handleError(_0x1cfc58,null));};exports[_0x3f25('0x24')]=function(_0x56ed74,_0x4b52b3){if(_0x56ed74['body']['id']){delete _0x56ed74[_0x3f25('0x4a')]['id'];}return db[_0x3f25('0x2f')][_0x3f25('0x47')]({'where':{'id':_0x56ed74[_0x3f25('0x44')]['id']}})[_0x3f25('0x25')](handleEntityNotFound(_0x4b52b3,null))[_0x3f25('0x25')](saveUpdates(_0x56ed74[_0x3f25('0x4a')],null))[_0x3f25('0x25')](respondWithResult(_0x4b52b3,null))[_0x3f25('0x48')](handleError(_0x4b52b3,null));};exports[_0x3f25('0x26')]=function(_0x50aee5,_0x35ef89){return db['VoiceQueuesLog'][_0x3f25('0x47')]({'where':{'id':_0x50aee5[_0x3f25('0x44')]['id']}})[_0x3f25('0x25')](handleEntityNotFound(_0x35ef89,null))[_0x3f25('0x25')](removeEntity(_0x35ef89,null))[_0x3f25('0x48')](handleError(_0x35ef89,null));}; \ No newline at end of file +var _0x83ee=['offset','undefined','limit','count','set','json','reject','save','update','destroy','then','send','index','rawAttributes','type','key','model','map','name','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','VoiceQueuesLog','rows','catch','params','length','includeAll','include','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status'];(function(_0x162aec,_0x38b736){var _0x26bff6=function(_0x5ba66c){while(--_0x5ba66c){_0x162aec['push'](_0x162aec['shift']());}};_0x26bff6(++_0x38b736);}(_0x83ee,0x1a9));var _0xe83e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x83ee[_0x45e98e];return _0x374dba;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe83e('0x0'));var zipdir=require(_0xe83e('0x1'));var jsonpatch=require(_0xe83e('0x2'));var rp=require(_0xe83e('0x3'));var moment=require(_0xe83e('0x4'));var BPromise=require(_0xe83e('0x5'));var Mustache=require(_0xe83e('0x6'));var util=require(_0xe83e('0x7'));var path=require(_0xe83e('0x8'));var sox=require(_0xe83e('0x9'));var csv=require('to-csv');var ejs=require(_0xe83e('0xa'));var fs=require('fs');var fs_extra=require(_0xe83e('0xb'));var _=require(_0xe83e('0xc'));var squel=require(_0xe83e('0xd'));var crypto=require(_0xe83e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe83e('0xf'));var toCsv=require(_0xe83e('0x10'));var querystring=require(_0xe83e('0x11'));var Papa=require(_0xe83e('0x12'));var Redis=require(_0xe83e('0x13'));var authService=require(_0xe83e('0x14'));var qs=require(_0xe83e('0x15'));var as=require(_0xe83e('0x16'));var hardwareService=require(_0xe83e('0x17'));var logger=require(_0xe83e('0x18'))('api');var utils=require(_0xe83e('0x19'));var config=require(_0xe83e('0x1a'));var licenseUtil=require(_0xe83e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59aeb8,_0x546517){_0x546517=_0x546517||0xcc;return function(_0x538e58){if(_0x538e58){return _0x59aeb8[_0xe83e('0x1c')](_0x546517);}return _0x59aeb8['status'](_0x546517)[_0xe83e('0x1d')]();};}function respondWithResult(_0x9bb95a,_0x4417a1){_0x4417a1=_0x4417a1||0xc8;return function(_0x59ca6a){if(_0x59ca6a){return _0x9bb95a[_0xe83e('0x1e')](_0x4417a1)['json'](_0x59ca6a);}};}function respondWithFilteredResult(_0x2d0775,_0x24d8fe){return function(_0x361a18){if(_0x361a18){var _0x55896=typeof _0x24d8fe[_0xe83e('0x1f')]===_0xe83e('0x20')&&typeof _0x24d8fe[_0xe83e('0x21')]===_0xe83e('0x20');var _0x1dbe37=_0x361a18[_0xe83e('0x22')];var _0x4de4d9=_0x55896?0x0:_0x24d8fe[_0xe83e('0x1f')];var _0x12f8e7=_0x55896?_0x361a18[_0xe83e('0x22')]:_0x24d8fe[_0xe83e('0x1f')]+_0x24d8fe[_0xe83e('0x21')];var _0x4fb296;if(_0x12f8e7>=_0x1dbe37){_0x12f8e7=_0x1dbe37;_0x4fb296=0xc8;}else{_0x4fb296=0xce;}_0x2d0775[_0xe83e('0x1e')](_0x4fb296);return _0x2d0775[_0xe83e('0x23')]('Content-Range',_0x4de4d9+'-'+_0x12f8e7+'/'+_0x1dbe37)[_0xe83e('0x24')](_0x361a18);}return null;};}function patchUpdates(_0x504ea7){return function(_0x1f6c2c){try{jsonpatch['apply'](_0x1f6c2c,_0x504ea7,!![]);}catch(_0x2dfd30){return BPromise[_0xe83e('0x25')](_0x2dfd30);}return _0x1f6c2c[_0xe83e('0x26')]();};}function saveUpdates(_0x2fb280,_0x13ae9b){return function(_0x4482b7){if(_0x4482b7){return _0x4482b7[_0xe83e('0x27')](_0x2fb280)['then'](function(_0x2c70c1){return _0x2c70c1;});}return null;};}function removeEntity(_0x124a28,_0x1f0fdc){return function(_0x449e97){if(_0x449e97){return _0x449e97[_0xe83e('0x28')]()[_0xe83e('0x29')](function(){_0x124a28[_0xe83e('0x1e')](0xcc)[_0xe83e('0x1d')]();});}};}function handleEntityNotFound(_0x1c05e1,_0x1037cb){return function(_0x143644){if(!_0x143644){_0x1c05e1[_0xe83e('0x1c')](0x194);}return _0x143644;};}function handleError(_0x2a1d13,_0x4952c5){_0x4952c5=_0x4952c5||0x1f4;return function(_0x2e8e2b){logger['error'](_0x2e8e2b['stack']);if(_0x2e8e2b['name']){delete _0x2e8e2b['name'];}_0x2a1d13[_0xe83e('0x1e')](_0x4952c5)[_0xe83e('0x2a')](_0x2e8e2b);};}exports[_0xe83e('0x2b')]=function(_0x2d0b1a,_0x400509){var _0x579d67={},_0x3b79f5={},_0x644bea={'count':0x0,'rows':[]};var _0x173cc9=_['map'](db['VoiceQueuesLog'][_0xe83e('0x2c')],function(_0x46ce93){return{'name':_0x46ce93['fieldName'],'type':_0x46ce93[_0xe83e('0x2d')][_0xe83e('0x2e')]};});_0x3b79f5[_0xe83e('0x2f')]=_[_0xe83e('0x30')](_0x173cc9,_0xe83e('0x31'));_0x3b79f5[_0xe83e('0x32')]=_[_0xe83e('0x33')](_0x2d0b1a[_0xe83e('0x32')]);_0x3b79f5[_0xe83e('0x34')]=_['intersection'](_0x3b79f5[_0xe83e('0x2f')],_0x3b79f5['query']);_0x579d67[_0xe83e('0x35')]=_[_0xe83e('0x36')](_0x3b79f5[_0xe83e('0x2f')],qs[_0xe83e('0x37')](_0x2d0b1a[_0xe83e('0x32')][_0xe83e('0x37')]));_0x579d67['attributes']=_0x579d67[_0xe83e('0x35')]['length']?_0x579d67[_0xe83e('0x35')]:_0x3b79f5['model'];if(!_0x2d0b1a[_0xe83e('0x32')][_0xe83e('0x38')](_0xe83e('0x39'))){_0x579d67[_0xe83e('0x21')]=qs['limit'](_0x2d0b1a['query'][_0xe83e('0x21')]);_0x579d67['offset']=qs['offset'](_0x2d0b1a[_0xe83e('0x32')][_0xe83e('0x1f')]);}_0x579d67[_0xe83e('0x3a')]=qs[_0xe83e('0x3b')](_0x2d0b1a[_0xe83e('0x32')][_0xe83e('0x3b')]);_0x579d67['where']=qs[_0xe83e('0x34')](_[_0xe83e('0x3c')](_0x2d0b1a[_0xe83e('0x32')],_0x3b79f5['filters']),_0x173cc9);if(_0x2d0b1a[_0xe83e('0x32')][_0xe83e('0x3d')]){_0x579d67[_0xe83e('0x3e')]=_[_0xe83e('0x3f')](_0x579d67[_0xe83e('0x3e')],{'$or':_[_0xe83e('0x30')](_0x173cc9,function(_0x441f33){if(_0x441f33['type']!==_0xe83e('0x40')){var _0x47f2a4={};_0x47f2a4[_0x441f33['name']]={'$like':'%'+_0x2d0b1a[_0xe83e('0x32')][_0xe83e('0x3d')]+'%'};return _0x47f2a4;}})});}_0x579d67=_['merge']({},_0x579d67,_0x2d0b1a[_0xe83e('0x41')]);var _0x3ae08b={'where':_0x579d67[_0xe83e('0x3e')]};return db[_0xe83e('0x42')]['count'](_0x3ae08b)[_0xe83e('0x29')](function(_0x5258d0){_0x644bea[_0xe83e('0x22')]=_0x5258d0;if(_0x2d0b1a[_0xe83e('0x32')]['includeAll']){_0x579d67['include']=[{'all':!![]}];}return db[_0xe83e('0x42')]['findAll'](_0x579d67);})[_0xe83e('0x29')](function(_0x11bf4d){_0x644bea[_0xe83e('0x43')]=_0x11bf4d;return _0x644bea;})[_0xe83e('0x29')](respondWithFilteredResult(_0x400509,_0x579d67))[_0xe83e('0x44')](handleError(_0x400509,null));};exports['show']=function(_0x5dad9e,_0x47791c){var _0xf37932={'raw':!![],'where':{'id':_0x5dad9e[_0xe83e('0x45')]['id']}},_0x2b5626={};_0x2b5626[_0xe83e('0x2f')]=_[_0xe83e('0x33')](db[_0xe83e('0x42')][_0xe83e('0x2c')]);_0x2b5626[_0xe83e('0x32')]=_['keys'](_0x5dad9e['query']);_0x2b5626['filters']=_[_0xe83e('0x36')](_0x2b5626[_0xe83e('0x2f')],_0x2b5626[_0xe83e('0x32')]);_0xf37932[_0xe83e('0x35')]=_[_0xe83e('0x36')](_0x2b5626[_0xe83e('0x2f')],qs[_0xe83e('0x37')](_0x5dad9e[_0xe83e('0x32')][_0xe83e('0x37')]));_0xf37932[_0xe83e('0x35')]=_0xf37932[_0xe83e('0x35')][_0xe83e('0x46')]?_0xf37932[_0xe83e('0x35')]:_0x2b5626[_0xe83e('0x2f')];if(_0x5dad9e[_0xe83e('0x32')][_0xe83e('0x47')]){_0xf37932[_0xe83e('0x48')]=[{'all':!![]}];}_0xf37932=_[_0xe83e('0x3f')]({},_0xf37932,_0x5dad9e[_0xe83e('0x41')]);return db[_0xe83e('0x42')][_0xe83e('0x49')](_0xf37932)[_0xe83e('0x29')](handleEntityNotFound(_0x47791c,null))[_0xe83e('0x29')](respondWithResult(_0x47791c,null))[_0xe83e('0x44')](handleError(_0x47791c,null));};exports[_0xe83e('0x4a')]=function(_0x238509,_0x2d2777){return db[_0xe83e('0x42')][_0xe83e('0x4a')](_0x238509[_0xe83e('0x4b')],{})[_0xe83e('0x29')](respondWithResult(_0x2d2777,0xc9))[_0xe83e('0x44')](handleError(_0x2d2777,null));};exports[_0xe83e('0x27')]=function(_0x23c214,_0x25bc0a){if(_0x23c214['body']['id']){delete _0x23c214[_0xe83e('0x4b')]['id'];}return db[_0xe83e('0x42')]['find']({'where':{'id':_0x23c214[_0xe83e('0x45')]['id']}})[_0xe83e('0x29')](handleEntityNotFound(_0x25bc0a,null))['then'](saveUpdates(_0x23c214[_0xe83e('0x4b')],null))[_0xe83e('0x29')](respondWithResult(_0x25bc0a,null))[_0xe83e('0x44')](handleError(_0x25bc0a,null));};exports[_0xe83e('0x28')]=function(_0x2fe1fb,_0x41d156){return db['VoiceQueuesLog'][_0xe83e('0x49')]({'where':{'id':_0x2fe1fb['params']['id']}})['then'](handleEntityNotFound(_0x41d156,null))[_0xe83e('0x29')](removeEntity(_0x41d156,null))[_0xe83e('0x44')](handleError(_0x41d156,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 6230385..97e1355 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 _0x4974=['path','../../config/environment','./voiceQueuesLog.attributes','exports','define','voice_queues_log','dtm','lodash','../../config/logger','api','moment','request-promise'];(function(_0x490b05,_0x7f0934){var _0x37ad3c=function(_0x4260d0){while(--_0x4260d0){_0x490b05['push'](_0x490b05['shift']());}};_0x37ad3c(++_0x7f0934);}(_0x4974,0x127));var _0x4497=function(_0x4b8e98,_0x6cb034){_0x4b8e98=_0x4b8e98-0x0;var _0x3577b2=_0x4974[_0x4b8e98];return _0x3577b2;};'use strict';var _=require(_0x4497('0x0'));var util=require('util');var logger=require(_0x4497('0x1'))(_0x4497('0x2'));var moment=require(_0x4497('0x3'));var BPromise=require('bluebird');var rp=require(_0x4497('0x4'));var fs=require('fs');var path=require(_0x4497('0x5'));var rimraf=require('rimraf');var config=require(_0x4497('0x6'));var attributes=require(_0x4497('0x7'));module[_0x4497('0x8')]=function(_0x4bc5e7,_0x16880a){return _0x4bc5e7[_0x4497('0x9')]('VoiceQueuesLog',attributes,{'tableName':_0x4497('0xa'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':['event',_0x4497('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0xd78b=['define','VoiceQueuesLog','voice_queues_log','event_dtm','event','util','../../config/logger','api','bluebird','request-promise','./voiceQueuesLog.attributes','exports'];(function(_0x33085e,_0x571ae7){var _0x43928b=function(_0x2cc736){while(--_0x2cc736){_0x33085e['push'](_0x33085e['shift']());}};_0x43928b(++_0x571ae7);}(_0xd78b,0x155));var _0xbd78=function(_0x12a62c,_0xc9c41a){_0x12a62c=_0x12a62c-0x0;var _0x268a58=_0xd78b[_0x12a62c];return _0x268a58;};'use strict';var _=require('lodash');var util=require(_0xbd78('0x0'));var logger=require(_0xbd78('0x1'))(_0xbd78('0x2'));var moment=require('moment');var BPromise=require(_0xbd78('0x3'));var rp=require(_0xbd78('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbd78('0x5'));module[_0xbd78('0x6')]=function(_0x4d8ef1,_0x404d1c){return _0x4d8ef1[_0xbd78('0x7')](_0xbd78('0x8'),attributes,{'tableName':_0xbd78('0x9'),'paranoid':![],'indexes':[{'name':_0xbd78('0xa'),'fields':[_0xbd78('0xb'),'dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 334f6ff..152a874 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 _0x167e=['request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http'];(function(_0x3e7ce8,_0x2b9409){var _0xeee8b5=function(_0x597ffd){while(--_0x597ffd){_0x3e7ce8['push'](_0x3e7ce8['shift']());}};_0xeee8b5(++_0x2b9409);}(_0x167e,0xa3));var _0xe167=function(_0x5dc31e,_0x49e000){_0x5dc31e=_0x5dc31e-0x0;var _0x503b06=_0x167e[_0x5dc31e];return _0x503b06;};'use strict';var _=require(_0xe167('0x0'));var util=require(_0xe167('0x1'));var moment=require(_0xe167('0x2'));var BPromise=require(_0xe167('0x3'));var rs=require(_0xe167('0x4'));var fs=require('fs');var Redis=require(_0xe167('0x5'));var db=require(_0xe167('0x6'))['db'];var utils=require(_0xe167('0x7'));var logger=require('../../config/logger')(_0xe167('0x8'));var config=require('../../config/environment');var jayson=require(_0xe167('0x9'));var client=jayson[_0xe167('0xa')][_0xe167('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bad0c,_0x1426ae,_0x56cf9b){return new BPromise(function(_0x3a00d5,_0x5c6694){return client[_0xe167('0xc')](_0x3bad0c,_0x56cf9b)[_0xe167('0xd')](function(_0x26a191){logger[_0xe167('0xe')](_0xe167('0xf'),_0x1426ae,_0xe167('0x10'));logger[_0xe167('0x11')](_0xe167('0x12'),_0x1426ae,'request\x20sent',JSON[_0xe167('0x13')](_0x26a191));if(_0x26a191[_0xe167('0x14')]){if(_0x26a191['error'][_0xe167('0x15')]===0x1f4){logger[_0xe167('0x14')](_0xe167('0xf'),_0x1426ae,_0x26a191[_0xe167('0x14')][_0xe167('0x16')]);return _0x5c6694(_0x26a191[_0xe167('0x14')][_0xe167('0x16')]);}logger[_0xe167('0x14')](_0xe167('0xf'),_0x1426ae,_0x26a191['error'][_0xe167('0x16')]);return _0x3a00d5(_0x26a191[_0xe167('0x14')][_0xe167('0x16')]);}else{logger[_0xe167('0xe')]('VoiceQueuesLog,\x20%s,\x20%s',_0x1426ae,_0xe167('0x10'));_0x3a00d5(_0x26a191[_0xe167('0x17')][_0xe167('0x16')]);}})[_0xe167('0x18')](function(_0x1244d4){logger['error'](_0xe167('0xf'),_0x1426ae,_0x1244d4);_0x5c6694(_0x1244d4);});});} \ No newline at end of file +var _0xae0d=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xae0d,0x188));var _0xdae0=function(_0x3de57b,_0x24523f){_0x3de57b=_0x3de57b-0x0;var _0x1c45e9=_0xae0d[_0x3de57b];return _0x1c45e9;};'use strict';var _=require(_0xdae0('0x0'));var util=require(_0xdae0('0x1'));var moment=require(_0xdae0('0x2'));var BPromise=require(_0xdae0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdae0('0x4'));var db=require(_0xdae0('0x5'))['db'];var utils=require(_0xdae0('0x6'));var logger=require(_0xdae0('0x7'))(_0xdae0('0x8'));var config=require(_0xdae0('0x9'));var jayson=require(_0xdae0('0xa'));var client=jayson[_0xdae0('0xb')][_0xdae0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4326fb,_0x52c5fb,_0x5036a9){return new BPromise(function(_0x1ece37,_0xb4cae1){return client['request'](_0x4326fb,_0x5036a9)[_0xdae0('0xd')](function(_0x1f9ff9){logger['info'](_0xdae0('0xe'),_0x52c5fb,_0xdae0('0xf'));logger[_0xdae0('0x10')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x52c5fb,_0xdae0('0xf'),JSON[_0xdae0('0x11')](_0x1f9ff9));if(_0x1f9ff9[_0xdae0('0x12')]){if(_0x1f9ff9[_0xdae0('0x12')][_0xdae0('0x13')]===0x1f4){logger[_0xdae0('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x52c5fb,_0x1f9ff9[_0xdae0('0x12')][_0xdae0('0x14')]);return _0xb4cae1(_0x1f9ff9[_0xdae0('0x12')][_0xdae0('0x14')]);}logger[_0xdae0('0x12')](_0xdae0('0xe'),_0x52c5fb,_0x1f9ff9[_0xdae0('0x12')]['message']);return _0x1ece37(_0x1f9ff9[_0xdae0('0x12')][_0xdae0('0x14')]);}else{logger['info'](_0xdae0('0xe'),_0x52c5fb,_0xdae0('0xf'));_0x1ece37(_0x1f9ff9['result'][_0xdae0('0x14')]);}})[_0xdae0('0x15')](function(_0x51c3fc){logger['error'](_0xdae0('0xe'),_0x52c5fb,_0x51c3fc);_0xb4cae1(_0x51c3fc);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index ab8b07a..b4b5f64 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 _0xaacb=['downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','delete','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','/describe','isAuthenticated','/:id','show','/:id/download','/:id/downloads'];(function(_0x358806,_0x322b66){var _0x19fdcb=function(_0xe01b8d){while(--_0xe01b8d){_0x358806['push'](_0x358806['shift']());}};_0x19fdcb(++_0x322b66);}(_0xaacb,0xa0));var _0xbaac=function(_0xd1a252,_0x16396f){_0xd1a252=_0xd1a252-0x0;var _0x560ee1=_0xaacb[_0xd1a252];return _0x560ee1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xbaac('0x0'));var timeout=require('connect-timeout');var express=require(_0xbaac('0x1'));var router=express[_0xbaac('0x2')]();var fs_extra=require(_0xbaac('0x3'));var auth=require(_0xbaac('0x4'));var interaction=require(_0xbaac('0x5'));var config=require(_0xbaac('0x6'));var controller=require(_0xbaac('0x7'));router[_0xbaac('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xbaac('0x8')](_0xbaac('0x9'),auth[_0xbaac('0xa')](),controller['describe']);router['get'](_0xbaac('0xb'),auth['isAuthenticated'](),controller[_0xbaac('0xc')]);router[_0xbaac('0x8')](_0xbaac('0xd'),auth['isAuthenticated'](),controller['download']);router[_0xbaac('0x8')](_0xbaac('0xe'),controller[_0xbaac('0xf')]);router[_0xbaac('0x8')](_0xbaac('0x10'),auth[_0xbaac('0xa')](),controller[_0xbaac('0x11')]);router[_0xbaac('0x12')]('/',auth[_0xbaac('0xa')](),controller[_0xbaac('0x13')]);router[_0xbaac('0x12')]('/:id/transcribe',auth[_0xbaac('0xa')](),controller[_0xbaac('0x14')]);router[_0xbaac('0x15')]('/:id',auth[_0xbaac('0xa')](),controller['update']);router[_0xbaac('0x16')](_0xbaac('0xb'),auth[_0xbaac('0xa')](),controller[_0xbaac('0x17')]);module[_0xbaac('0x18')]=router; \ No newline at end of file +var _0x891b=['/:id/transcribe','runTranscribe','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./voiceRecording.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','downloads','downloadTranscribe','post','create'];(function(_0x54b60d,_0x450a24){var _0x9153fa=function(_0x419c2f){while(--_0x419c2f){_0x54b60d['push'](_0x54b60d['shift']());}};_0x9153fa(++_0x450a24);}(_0x891b,0x1b5));var _0xb891=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x891b[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xb891('0x0'));var util=require('util');var path=require(_0xb891('0x1'));var timeout=require(_0xb891('0x2'));var express=require(_0xb891('0x3'));var router=express[_0xb891('0x4')]();var fs_extra=require(_0xb891('0x5'));var auth=require(_0xb891('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb891('0x7'));router[_0xb891('0x8')]('/',auth[_0xb891('0x9')](),controller['index']);router[_0xb891('0x8')](_0xb891('0xa'),auth[_0xb891('0x9')](),controller[_0xb891('0xb')]);router[_0xb891('0x8')](_0xb891('0xc'),auth[_0xb891('0x9')](),controller[_0xb891('0xd')]);router[_0xb891('0x8')](_0xb891('0xe'),auth['isAuthenticated'](),controller['download']);router[_0xb891('0x8')]('/:id/downloads',controller[_0xb891('0xf')]);router['get']('/:id/transcribe',auth[_0xb891('0x9')](),controller[_0xb891('0x10')]);router[_0xb891('0x11')]('/',auth[_0xb891('0x9')](),controller[_0xb891('0x12')]);router[_0xb891('0x11')](_0xb891('0x13'),auth['isAuthenticated'](),controller[_0xb891('0x14')]);router['put']('/:id',auth[_0xb891('0x9')](),controller[_0xb891('0x15')]);router[_0xb891('0x16')]('/:id',auth[_0xb891('0x9')](),controller[_0xb891('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index c513b75..4e4dea1 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(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file +var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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 adaa5da..d439620 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 _0x61dd=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','aws-sdk','../../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','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','VoiceRecording','fieldName','type','key','model','differenceBy','format','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','find','create','body','params','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','extname','unlink','Not\x20found','sequelize','col','token','$and','push','filename','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','runTranscribe','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x61dd,0x1d1));var _0xd61d=function(_0x1dacd4,_0x4259f7){_0x1dacd4=_0x1dacd4-0x0;var _0x5c29c5=_0x61dd[_0x1dacd4];return _0x5c29c5;};'use strict';var emlformat=require(_0xd61d('0x0'));var rimraf=require(_0xd61d('0x1'));var zipdir=require(_0xd61d('0x2'));var jsonpatch=require(_0xd61d('0x3'));var rp=require(_0xd61d('0x4'));var moment=require(_0xd61d('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd61d('0x6'));var path=require(_0xd61d('0x7'));var sox=require(_0xd61d('0x8'));var csv=require(_0xd61d('0x9'));var ejs=require(_0xd61d('0xa'));var fs=require('fs');var fs_extra=require(_0xd61d('0xb'));var _=require(_0xd61d('0xc'));var squel=require(_0xd61d('0xd'));var crypto=require('crypto');var jsforce=require(_0xd61d('0xe'));var deskjs=require(_0xd61d('0xf'));var toCsv=require(_0xd61d('0x9'));var querystring=require(_0xd61d('0x10'));var Papa=require('papaparse');var AWS=require(_0xd61d('0x11'));var uuidv4=require('uuid/v4');var Redis=require('ioredis');var authService=require(_0xd61d('0x12'));var qs=require(_0xd61d('0x13'));var as=require(_0xd61d('0x14'));var hardwareService=require(_0xd61d('0x15'));var logger=require(_0xd61d('0x16'))(_0xd61d('0x17'));var utils=require('../../config/utils');var config=require(_0xd61d('0x18'));var licenseUtil=require(_0xd61d('0x19'));var db=require(_0xd61d('0x1a'))['db'];function respondWithStatusCode(_0x24fa74,_0xd2a875){_0xd2a875=_0xd2a875||0xcc;return function(_0x20aafa){if(_0x20aafa){return _0x24fa74[_0xd61d('0x1b')](_0xd2a875);}return _0x24fa74[_0xd61d('0x1c')](_0xd2a875)[_0xd61d('0x1d')]();};}function respondWithResult(_0x23f705,_0xad051e){_0xad051e=_0xad051e||0xc8;return function(_0x2ef51b){if(_0x2ef51b){return _0x23f705[_0xd61d('0x1c')](_0xad051e)[_0xd61d('0x1e')](_0x2ef51b);}};}function respondWithFilteredResult(_0x245482,_0xffa9e8){return function(_0x3eeee7){if(_0x3eeee7){var _0x5437c1=typeof _0xffa9e8['offset']===_0xd61d('0x1f')&&typeof _0xffa9e8[_0xd61d('0x20')]==='undefined';var _0x3f7637=_0x3eeee7['count'];var _0x5bac9f=_0x5437c1?0x0:_0xffa9e8[_0xd61d('0x21')];var _0x573216=_0x5437c1?_0x3eeee7[_0xd61d('0x22')]:_0xffa9e8[_0xd61d('0x21')]+_0xffa9e8['limit'];var _0x50709e;if(_0x573216>=_0x3f7637){_0x573216=_0x3f7637;_0x50709e=0xc8;}else{_0x50709e=0xce;}_0x245482[_0xd61d('0x1c')](_0x50709e);return _0x245482[_0xd61d('0x23')](_0xd61d('0x24'),_0x5bac9f+'-'+_0x573216+'/'+_0x3f7637)[_0xd61d('0x1e')](_0x3eeee7);}return null;};}function patchUpdates(_0x126ebb){return function(_0x2eca4a){try{jsonpatch[_0xd61d('0x25')](_0x2eca4a,_0x126ebb,!![]);}catch(_0x57974b){return BPromise[_0xd61d('0x26')](_0x57974b);}return _0x2eca4a[_0xd61d('0x27')]();};}function saveUpdates(_0x1d20df,_0x263c25){return function(_0x485871){if(_0x485871){return _0x485871[_0xd61d('0x28')](_0x1d20df)[_0xd61d('0x29')](function(_0x13dc18){return _0x13dc18;});}return null;};}function removeEntity(_0x5e3978,_0x1f3166){return function(_0x3718a7){if(_0x3718a7){return _0x3718a7[_0xd61d('0x2a')]()['then'](function(){_0x5e3978[_0xd61d('0x1c')](0xcc)[_0xd61d('0x1d')]();});}};}function handleEntityNotFound(_0x5ea995,_0x362826){return function(_0x3d3209){if(!_0x3d3209){_0x5ea995[_0xd61d('0x1b')](0x194);}return _0x3d3209;};}function handleError(_0x583af6,_0x17c601){_0x17c601=_0x17c601||0x1f4;return function(_0x5db6f5){logger[_0xd61d('0x2b')](_0x5db6f5['stack']);if(_0x5db6f5[_0xd61d('0x2c')]){delete _0x5db6f5[_0xd61d('0x2c')];}_0x583af6[_0xd61d('0x1c')](_0x17c601)[_0xd61d('0x2d')](_0x5db6f5);};}exports[_0xd61d('0x2e')]=function(_0x4cc6f1,_0x269161){var _0x3ecc44={},_0x5e8281={},_0x2794b4={'count':0x0,'rows':[]};var _0x2dc699=_[_0xd61d('0x2f')](db[_0xd61d('0x30')]['rawAttributes'],function(_0x399b8c){return{'name':_0x399b8c[_0xd61d('0x31')],'type':_0x399b8c[_0xd61d('0x32')][_0xd61d('0x33')]};});_0x5e8281[_0xd61d('0x34')]=_[_0xd61d('0x35')](_['map'](_0x2dc699,_0xd61d('0x2c')),[_0xd61d('0x36')]);_0x5e8281['query']=_[_0xd61d('0x37')](_0x4cc6f1[_0xd61d('0x38')]);_0x5e8281[_0xd61d('0x39')]=_[_0xd61d('0x3a')](_0x5e8281[_0xd61d('0x34')],_0x5e8281['query']);_0x3ecc44[_0xd61d('0x3b')]=_[_0xd61d('0x3a')](_0x5e8281['model'],qs[_0xd61d('0x3c')](_0x4cc6f1[_0xd61d('0x38')]['fields']));_0x3ecc44[_0xd61d('0x3b')]=_0x3ecc44[_0xd61d('0x3b')][_0xd61d('0x3d')]?_0x3ecc44['attributes']:_0x5e8281[_0xd61d('0x34')];if(!_0x4cc6f1['query'][_0xd61d('0x3e')](_0xd61d('0x3f'))){_0x3ecc44[_0xd61d('0x20')]=qs[_0xd61d('0x20')](_0x4cc6f1[_0xd61d('0x38')]['limit']);_0x3ecc44[_0xd61d('0x21')]=qs[_0xd61d('0x21')](_0x4cc6f1[_0xd61d('0x38')][_0xd61d('0x21')]);}_0x3ecc44['order']=qs['sort'](_0x4cc6f1['query'][_0xd61d('0x40')]);_0x3ecc44[_0xd61d('0x41')]=qs[_0xd61d('0x39')](_[_0xd61d('0x42')](_0x4cc6f1[_0xd61d('0x38')],_0x5e8281[_0xd61d('0x39')]),_0x2dc699);if(_0x4cc6f1['query'][_0xd61d('0x43')]){_0x3ecc44[_0xd61d('0x41')]=_['merge'](_0x3ecc44[_0xd61d('0x41')],{'$or':_[_0xd61d('0x2f')](_0x2dc699,function(_0x2e2dbe){if(_0x2e2dbe[_0xd61d('0x32')]!==_0xd61d('0x44')){var _0x56fe99={};_0x56fe99[_0x2e2dbe[_0xd61d('0x2c')]]={'$like':'%'+_0x4cc6f1[_0xd61d('0x38')][_0xd61d('0x43')]+'%'};return _0x56fe99;}})});}_0x3ecc44=_[_0xd61d('0x45')]({},_0x3ecc44,_0x4cc6f1[_0xd61d('0x46')]);var _0x3d112e={'where':_0x3ecc44['where']};return db[_0xd61d('0x30')][_0xd61d('0x22')](_0x3d112e)[_0xd61d('0x29')](function(_0x3f3af5){_0x2794b4[_0xd61d('0x22')]=_0x3f3af5;if(_0x4cc6f1[_0xd61d('0x38')][_0xd61d('0x47')]){_0x3ecc44[_0xd61d('0x48')]=[{'all':!![]}];}return db[_0xd61d('0x30')]['findAll'](_0x3ecc44);})['then'](function(_0x2f70c4){_0x2794b4[_0xd61d('0x49')]=_0x2f70c4;return _0x2794b4;})['then'](respondWithFilteredResult(_0x269161,_0x3ecc44))[_0xd61d('0x4a')](handleError(_0x269161,null));};exports[_0xd61d('0x4b')]=function(_0x682cbc,_0x3e25da){var _0x4679c5={'raw':![],'where':{'id':_0x682cbc['params']['id']}},_0x2ff9f5={};_0x2ff9f5[_0xd61d('0x34')]=_['keys'](db['VoiceRecording']['rawAttributes']);_0x2ff9f5[_0xd61d('0x38')]=_['keys'](_0x682cbc[_0xd61d('0x38')]);_0x2ff9f5[_0xd61d('0x39')]=_['intersection'](_0x2ff9f5['model'],_0x2ff9f5[_0xd61d('0x38')]);_0x4679c5[_0xd61d('0x3b')]=_['intersection'](_0x2ff9f5[_0xd61d('0x34')],qs['fields'](_0x682cbc['query'][_0xd61d('0x3c')]));_0x4679c5['attributes']=_0x4679c5[_0xd61d('0x3b')]['length']?_0x4679c5['attributes']:_0x2ff9f5[_0xd61d('0x34')];if(_0x682cbc[_0xd61d('0x38')][_0xd61d('0x47')]){_0x4679c5[_0xd61d('0x48')]=[{'all':!![]}];}_0x4679c5=_[_0xd61d('0x45')]({},_0x4679c5,_0x682cbc[_0xd61d('0x46')]);return db[_0xd61d('0x30')][_0xd61d('0x4c')](_0x4679c5)['then'](handleEntityNotFound(_0x3e25da,null))[_0xd61d('0x29')](respondWithResult(_0x3e25da,null))['catch'](handleError(_0x3e25da,null));};exports[_0xd61d('0x4d')]=function(_0x49028c,_0x10ac05){return db[_0xd61d('0x30')][_0xd61d('0x4d')](_0x49028c['body'],{})[_0xd61d('0x29')](respondWithResult(_0x10ac05,0xc9))[_0xd61d('0x4a')](handleError(_0x10ac05,null));};exports[_0xd61d('0x28')]=function(_0x5b4258,_0xcfb830){if(_0x5b4258[_0xd61d('0x4e')]['id']){delete _0x5b4258[_0xd61d('0x4e')]['id'];}return db[_0xd61d('0x30')][_0xd61d('0x4c')]({'where':{'id':_0x5b4258[_0xd61d('0x4f')]['id']}})[_0xd61d('0x29')](handleEntityNotFound(_0xcfb830,null))['then'](saveUpdates(_0x5b4258[_0xd61d('0x4e')],null))[_0xd61d('0x29')](respondWithResult(_0xcfb830,null))['catch'](handleError(_0xcfb830,null));};exports[_0xd61d('0x50')]=function(_0x462c27,_0x646036){return db[_0xd61d('0x30')]['describe']()['then'](respondWithResult(_0x646036,null))[_0xd61d('0x4a')](handleError(_0x646036,null));};exports[_0xd61d('0x51')]=function(_0x36dec9,_0x2a4572,_0x5eff39){var _0x2527c4=require(_0xd61d('0x52'));var _0x2eb555=![];var _0x4e8268={};if(_0x36dec9[_0xd61d('0x38')][_0xd61d('0x32')]&&_0x36dec9[_0xd61d('0x38')][_0xd61d('0x32')]===_0xd61d('0x53')){_0x4e8268['uniqueid']=_0x36dec9[_0xd61d('0x4f')]['id'];}else{_0x4e8268['id']=_0x36dec9[_0xd61d('0x4f')]['id'];}return db[_0xd61d('0x30')][_0xd61d('0x4c')]({'where':_0x4e8268,'attributes':['id',_0xd61d('0x54')],'raw':!![]})[_0xd61d('0x29')](handleEntityNotFound(_0x2a4572,null))[_0xd61d('0x29')](function(_0x1b3f8e){if(_0x1b3f8e){var _0x58587a=_0x1b3f8e[_0xd61d('0x54')];var _0x37fc25=util[_0xd61d('0x36')](_0xd61d('0x55'),_0x58587a);if(fs[_0xd61d('0x56')](_0x37fc25)){_0x2eb555=!![];return _0x2527c4[_0xd61d('0x57')](_0x37fc25,_0x58587a,config[_0xd61d('0x58')][_0xd61d('0x59')])[_0xd61d('0x29')](function(){return _0x1b3f8e;});}return _0x1b3f8e;}})[_0xd61d('0x29')](function(_0xd01a02){if(_0xd01a02){var _0x40a506=_0xd01a02[_0xd61d('0x54')];if(!fs['existsSync'](_0x40a506)){throw new db[(_0xd61d('0x5a'))][(_0xd61d('0x5b'))](_0xd61d('0x5c'));}if(_0xd01a02['filename']){return _0x2a4572[_0xd61d('0x51')](_0x40a506,_0xd01a02['filename']+path[_0xd61d('0x5d')](_0x40a506),function(){if(_0x2eb555){fs[_0xd61d('0x5e')](_0x40a506);}});}else{return _0x2a4572[_0xd61d('0x51')](_0x40a506,function(_0x3a9490){if(_0x2eb555){fs['unlink'](_0x40a506);}});}}})['catch'](function(_0x445e3f){if(_0x445e3f['message']===_0xd61d('0x5c')){_0x2a4572[_0xd61d('0x1c')](0x194)['send'](_0xd61d('0x5f'));}else{return handleError(_0x2a4572,null);}});};exports['downloads']=function(_0x3f4f09,_0x51ec9c,_0x516a14){var _0x1b145b=require(_0xd61d('0x52'));var _0x285f5a=![];var _0x96892={'$and':[db[_0xd61d('0x60')]['where'](db[_0xd61d('0x60')]['fn']('MD5',db[_0xd61d('0x60')][_0xd61d('0x61')]('uniqueid')),_0x3f4f09[_0xd61d('0x38')][_0xd61d('0x62')])]};if(_0x3f4f09[_0xd61d('0x38')][_0xd61d('0x32')]&&_0x3f4f09['query'][_0xd61d('0x32')]==='uniqueid'){_0x96892[_0xd61d('0x63')][_0xd61d('0x64')]({'uniqueid':_0x3f4f09[_0xd61d('0x4f')]['id']});}else{_0x96892[_0xd61d('0x63')][_0xd61d('0x64')]({'id':_0x3f4f09[_0xd61d('0x4f')]['id']});}return db[_0xd61d('0x30')][_0xd61d('0x4c')]({'where':_0x96892,'attributes':['id',_0xd61d('0x54')],'raw':!![]})['then'](handleEntityNotFound(_0x51ec9c,null))[_0xd61d('0x29')](function(_0x20e6f8){if(_0x20e6f8){var _0x222e31=util[_0xd61d('0x36')](_0xd61d('0x55'),_0x20e6f8[_0xd61d('0x54')]);if(fs[_0xd61d('0x56')](_0x222e31)){_0x285f5a=!![];return _0x1b145b[_0xd61d('0x57')](_0x222e31,_0x20e6f8[_0xd61d('0x54')],config[_0xd61d('0x58')][_0xd61d('0x59')])[_0xd61d('0x29')](function(){return _0x20e6f8;});}return _0x20e6f8;}})[_0xd61d('0x29')](function(_0xf02e1b){if(_0xf02e1b){if(!fs[_0xd61d('0x56')](_0xf02e1b[_0xd61d('0x54')])){throw new db[(_0xd61d('0x5a'))][(_0xd61d('0x5b'))](_0xd61d('0x5c'));}if(_0xf02e1b['filename']){return _0x51ec9c[_0xd61d('0x51')](_0xf02e1b[_0xd61d('0x54')],_0xf02e1b[_0xd61d('0x65')]+path['extname'](_0xf02e1b[_0xd61d('0x54')]),function(){if(_0x285f5a){fs[_0xd61d('0x5e')](_0xf02e1b[_0xd61d('0x54')]);}});}else{return _0x51ec9c[_0xd61d('0x51')](_0xf02e1b['value'],function(_0x2bc610){if(_0x285f5a){fs[_0xd61d('0x5e')](_0xf02e1b[_0xd61d('0x54')]);}});}}})[_0xd61d('0x4a')](handleError(_0x51ec9c,null));};exports[_0xd61d('0x2a')]=function(_0x1709ec,_0x5b6da5){return db['VoiceRecording']['find']({'where':{'id':_0x1709ec['params']['id']}})[_0xd61d('0x29')](function(_0x2bbe0c){if(_[_0xd61d('0x66')](_0x2bbe0c)){throw new ReferenceError(_0xd61d('0x67'));}return _0x2bbe0c;})[_0xd61d('0x29')](function(_0x2a2cf6){var _0x2fd804=_0x2a2cf6[_0xd61d('0x54')];logger[_0xd61d('0x68')](_0xd61d('0x69'),_0x2fd804);if(!_['isNil'](_0x2a2cf6[_0xd61d('0x54')])&&fs[_0xd61d('0x56')](_0x2fd804)){logger[_0xd61d('0x68')](_0xd61d('0x6a')+_0x2fd804+_0xd61d('0x6b'));fs[_0xd61d('0x6c')](_0x2fd804);}_0x2fd804=_0x2fd804+_0xd61d('0x6d');if(!_[_0xd61d('0x66')](_0x2a2cf6['value'])&&fs['existsSync'](_0x2fd804)){logger['info'](_0xd61d('0x6a')+_0x2fd804+_0xd61d('0x6b'));fs[_0xd61d('0x6c')](_0x2fd804);}return _0x2a2cf6;})[_0xd61d('0x29')](function(_0x758f65){if(!_0x758f65)throw new InternalError();return _0x758f65[_0xd61d('0x2a')]();})[_0xd61d('0x29')](function(){_0x5b6da5[_0xd61d('0x1c')](0xcc)[_0xd61d('0x1d')]();})[_0xd61d('0x4a')](handleError(_0x5b6da5,null));};function getBucketslist(_0x44dfe8,_0x3a98c3,_0x5c4433){return new Promise(function(_0x10fd41,_0x43460d){var _0x33ddaf=new AWS['S3']({'accessKeyId':_0x3a98c3,'secretAccessKey':_0x44dfe8,'region':_0x5c4433});_0x33ddaf[_0xd61d('0x6e')]({},function(_0x32cf04,_0x52b4b8){if(_0x32cf04){return _0x43460d(_0x32cf04);}else{return _0x10fd41(_0x52b4b8);}});});}function createBucket(_0x28947b,_0x53816f,_0x135eef,_0x44da83){return new Promise(function(_0x415b93,_0x2ee09a){var _0x368482=new AWS['S3']({'accessKeyId':_0x53816f,'secretAccessKey':_0x28947b,'region':_0x135eef});_0x368482[_0xd61d('0x6f')]({'Bucket':_0x44da83},function(_0x1aed73,_0x112ccd){if(_0x1aed73){return _0x2ee09a(_0x1aed73);}else{return _0x415b93(_0x112ccd);}});});}function uploadFile(_0x550cc5,_0x299cca,_0x5c4a83,_0x5b8863,_0x876676,_0x35d883){return new Promise(function(_0x2fc587,_0x48d4d7){var _0x406f09=new AWS['S3']({'accessKeyId':_0x299cca,'secretAccessKey':_0x550cc5,'region':_0x5c4a83});_0x406f09[_0xd61d('0x70')]({'Bucket':_0x5b8863,'Key':_0x876676,'Body':_0x35d883},function(_0x3d829b,_0x5c3944){if(_0x3d829b){return _0x48d4d7(_0x3d829b);}else{return _0x2fc587(_0x5c3944);}});});}function startTranscribe(_0x1bc26f,_0x2aaa9f,_0x238fda,_0x12396d,_0x4fec45,_0x568d79){return new Promise(function(_0x4af2bc,_0x321544){var _0x28a62a=new AWS[(_0xd61d('0x71'))]({'accessKeyId':_0x2aaa9f,'secretAccessKey':_0x1bc26f,'region':_0x238fda});_0x28a62a[_0xd61d('0x72')]({'TranscriptionJobName':_0x12396d,'LanguageCode':_0x4fec45,'Media':{'MediaFileUri':_0x568d79}},function(_0x4fbec0,_0x17fab4){if(_0x4fbec0){return _0x321544(_0x4fbec0);}else{return _0x4af2bc(_0x17fab4);}});});}function transcribe(_0x2f8cb4,_0x5648a7,_0x3967df,_0x27e33e,_0xf798d7,_0x1d9007,_0x28b9ee){return new Promise(function(_0x35626c,_0x485fb1){var _0x2dd47f={};logger[_0xd61d('0x68')](util[_0xd61d('0x36')](_0xd61d('0x73'),_0x2f8cb4,_0xf798d7));return uploadFile(_0x5648a7,_0x3967df,_0x27e33e,_0xf798d7,path[_0xd61d('0x74')](_0x1d9007),fs[_0xd61d('0x75')](_0x1d9007))['then'](function(_0x3e52c8){logger[_0xd61d('0x68')](util['format'](_0xd61d('0x76'),_0x2f8cb4,_0xf798d7,_0x3e52c8[_0xd61d('0x77')]));_0x2dd47f[_0xd61d('0x78')]=_0x3e52c8[_0xd61d('0x79')];_0x2dd47f[_0xd61d('0x7a')]=_0x3e52c8['Location'];logger[_0xd61d('0x68')](util[_0xd61d('0x36')](_0xd61d('0x7b'),_0x2f8cb4));return startTranscribe(_0x5648a7,_0x3967df,_0x27e33e,uuidv4(),_0x28b9ee,_0x3e52c8[_0xd61d('0x77')]);})[_0xd61d('0x29')](function(_0xe0d8e1){logger[_0xd61d('0x68')](util[_0xd61d('0x36')](_0xd61d('0x7c'),_0x2f8cb4,_0xe0d8e1[_0xd61d('0x7d')][_0xd61d('0x7e')]));_0x2dd47f[_0xd61d('0x7f')]=_0xe0d8e1[_0xd61d('0x7d')][_0xd61d('0x7e')];_0x2dd47f[_0xd61d('0x80')]=_0xe0d8e1['TranscriptionJob']['TranscriptionJobStatus'];return _0x35626c(_0x2dd47f);})[_0xd61d('0x4a')](function(_0x387100){return _0x485fb1(_0x387100);});});}exports[_0xd61d('0x81')]=function(_0x5a6f6e,_0x22f860,_0x313023){var _0x4e69dc;var _0x1e80cc;var _0x1a88f4;var _0xee7215=require('../../components/encryptor');return db[_0xd61d('0x30')]['findOne']({'where':{'id':_0x5a6f6e[_0xd61d('0x4f')]['id']}})[_0xd61d('0x29')](function(_0x49fbdd){if(_0x49fbdd){var _0x2dceb8=util[_0xd61d('0x36')](_0xd61d('0x55'),_0x49fbdd[_0xd61d('0x54')]);if(fs[_0xd61d('0x56')](_0x2dceb8)){cypher=!![];return _0xee7215[_0xd61d('0x57')](_0x2dceb8,_0x49fbdd[_0xd61d('0x54')],config[_0xd61d('0x58')][_0xd61d('0x59')])[_0xd61d('0x29')](function(){return _0x49fbdd;});}return _0x49fbdd;}})['then'](function(_0x268d00){if(!_0x268d00){throw new db['Sequelize'][(_0xd61d('0x5b'))](_0xd61d('0x82'));}_0x1e80cc=_0x268d00;return db[_0xd61d('0x83')][_0xd61d('0x84')]({'where':{'id':0x1}});})[_0xd61d('0x29')](handleEntityNotFound(_0x22f860,null))['then'](function(_0x452f98){if(_0x452f98){_0x4e69dc=_0x452f98;if(!_0x4e69dc[_0xd61d('0x85')]||!_0x4e69dc[_0xd61d('0x86')]||!_0x4e69dc[_0xd61d('0x87')]||!_0x4e69dc[_0xd61d('0x88')]||!_0x4e69dc[_0xd61d('0x78')]){throw new db[(_0xd61d('0x5a'))]['ValidationError'](_0xd61d('0x89'));}if(_0x5a6f6e['body'][_0xd61d('0x8a')]&&(!_0x4e69dc['sentiment']||!_0x4e69dc[_0xd61d('0x8b')]||!_0x4e69dc[_0xd61d('0x8c')]||!_0x4e69dc[_0xd61d('0x88')]||!_0x4e69dc['bucket'])){throw new db['Sequelize'][(_0xd61d('0x5b'))](_0xd61d('0x8d'));}return db[_0xd61d('0x8e')][_0xd61d('0x84')]({'where':{'id':_0x4e69dc[_0xd61d('0x86')]}});}})[_0xd61d('0x29')](function(_0x5a29ff){if(!_0x5a29ff){throw new db['Sequelize'][(_0xd61d('0x5b'))](_0xd61d('0x8f'));}if(!_0x5a29ff[_0xd61d('0x90')]||!_0x5a29ff[_0xd61d('0x91')]){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x1a88f4=_0x5a29ff;return getBucketslist(_0x1a88f4[_0xd61d('0x90')],_0x1a88f4[_0xd61d('0x91')],_0x4e69dc[_0xd61d('0x87')]);})[_0xd61d('0x29')](function(_0x3968ad){if(_0x3968ad&&_0x3968ad[_0xd61d('0x92')]){var _0x20e7ca=_['find'](_0x3968ad['Buckets'],function(_0x544859){return _0x544859[_0xd61d('0x93')]===_0x4e69dc[_0xd61d('0x78')];});if(!_0x20e7ca){logger[_0xd61d('0x68')](util[_0xd61d('0x36')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x5a6f6e[_0xd61d('0x4f')]['id'],_0x4e69dc['bucket']));return createBucket(_0x1a88f4[_0xd61d('0x90')],_0x1a88f4[_0xd61d('0x91')],_0x4e69dc['transcribeRegion'],_0x4e69dc[_0xd61d('0x78')]);}logger['info'](util[_0xd61d('0x36')](_0xd61d('0x94'),_0x5a6f6e[_0xd61d('0x4f')]['id'],_0x4e69dc['bucket']));return;}})['then'](function(_0x1882d4){if(_0x1e80cc[_0xd61d('0x80')]===_0xd61d('0x95')){return transcribe(_0x5a6f6e[_0xd61d('0x4f')]['id'],_0x1a88f4[_0xd61d('0x90')],_0x1a88f4[_0xd61d('0x91')],_0x4e69dc[_0xd61d('0x87')],_0x4e69dc['bucket'],_0x1e80cc[_0xd61d('0x54')],_0x4e69dc[_0xd61d('0x88')]);}else{logger[_0xd61d('0x68')](util[_0xd61d('0x36')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x5a6f6e[_0xd61d('0x4f')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0xd61d('0x29')](function(_0xf0a3ca){if(_0xf0a3ca){_0xf0a3ca[_0xd61d('0x96')]=_0x5a6f6e[_0xd61d('0x4e')]['runSentiment'];return _0x1e80cc[_0xd61d('0x97')](_0xf0a3ca);}})[_0xd61d('0x29')](respondWithResult(_0x22f860,null))[_0xd61d('0x4a')](handleError(_0x22f860,null));};function writeFile(_0xa0c893,_0x596350){return new Promise(function(_0x14337c,_0x335ad8){fs[_0xd61d('0x98')](_0x596350,_0xa0c893,function(_0x1df4e0,_0x192159){if(_0x1df4e0){return _0x335ad8(_0x1df4e0);}else{return _0x14337c(_0x192159);}});});}exports[_0xd61d('0x99')]=function(_0x49d384,_0x139f79,_0x2a15b7){return db[_0xd61d('0x30')][_0xd61d('0x84')]({'where':{'id':_0x49d384[_0xd61d('0x4f')]['id']}})[_0xd61d('0x29')](handleEntityNotFound(_0x139f79))[_0xd61d('0x29')](function(_0x22a4b9){if(_0x22a4b9&&_0x22a4b9[_0xd61d('0x9a')]){var _0x11074f=_0x22a4b9[_0xd61d('0x9a')];var _0x5ec66d=config[_0xd61d('0x9b')]+_0xd61d('0x9c')+_0x22a4b9['id']+'.txt';if(fs[_0xd61d('0x56')](_0x5ec66d)){return _0x5ec66d;}return writeFile(_0x11074f,_0x5ec66d)['then'](function(){return _0x5ec66d;});}else{throw new db[(_0xd61d('0x5a'))][(_0xd61d('0x5b'))]('Transcript\x20not\x20available');}})['then'](function(_0x135eb1){return _0x139f79[_0xd61d('0x51')](_0x135eb1);})['catch'](handleError(_0x139f79));}; \ No newline at end of file +var _0xd058=['query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','secrets','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','sequelize','MD5','col','token','$and','push','decryptFile','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','transcribeName','TranscriptionJob','transcribeStatus','TranscriptionJobStatus','runTranscribe','recording','Setting','findOne','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','data2','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','IN_PROGRESS','tempSentiment','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','aws-sdk','ioredis','../../components/auth/service','../../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','update','then','destroy','error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','format'];(function(_0x3ec5a3,_0x40cac0){var _0x3bc8dc=function(_0x240980){while(--_0x240980){_0x3ec5a3['push'](_0x3ec5a3['shift']());}};_0x3bc8dc(++_0x40cac0);}(_0xd058,0x6a));var _0x8d05=function(_0x5180c3,_0x4b35f7){_0x5180c3=_0x5180c3-0x0;var _0x55c975=_0xd058[_0x5180c3];return _0x55c975;};'use strict';var emlformat=require(_0x8d05('0x0'));var rimraf=require(_0x8d05('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8d05('0x2'));var rp=require(_0x8d05('0x3'));var moment=require(_0x8d05('0x4'));var BPromise=require(_0x8d05('0x5'));var Mustache=require('mustache');var util=require(_0x8d05('0x6'));var path=require(_0x8d05('0x7'));var sox=require('sox');var csv=require(_0x8d05('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8d05('0x9'));var _=require('lodash');var squel=require(_0x8d05('0xa'));var crypto=require('crypto');var jsforce=require(_0x8d05('0xb'));var deskjs=require(_0x8d05('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8d05('0xd'));var Papa=require(_0x8d05('0xe'));var AWS=require(_0x8d05('0xf'));var uuidv4=require('uuid/v4');var Redis=require(_0x8d05('0x10'));var authService=require(_0x8d05('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8d05('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8d05('0x13'))('api');var utils=require(_0x8d05('0x14'));var config=require(_0x8d05('0x15'));var licenseUtil=require(_0x8d05('0x16'));var db=require(_0x8d05('0x17'))['db'];function respondWithStatusCode(_0x5e05b5,_0x8248b1){_0x8248b1=_0x8248b1||0xcc;return function(_0x2a90cf){if(_0x2a90cf){return _0x5e05b5[_0x8d05('0x18')](_0x8248b1);}return _0x5e05b5[_0x8d05('0x19')](_0x8248b1)[_0x8d05('0x1a')]();};}function respondWithResult(_0x571c64,_0x28af92){_0x28af92=_0x28af92||0xc8;return function(_0x56a989){if(_0x56a989){return _0x571c64['status'](_0x28af92)[_0x8d05('0x1b')](_0x56a989);}};}function respondWithFilteredResult(_0x462377,_0x9e8c50){return function(_0x492cff){if(_0x492cff){var _0x2d50b5=typeof _0x9e8c50[_0x8d05('0x1c')]===_0x8d05('0x1d')&&typeof _0x9e8c50[_0x8d05('0x1e')]===_0x8d05('0x1d');var _0x568ae5=_0x492cff[_0x8d05('0x1f')];var _0x31c1d6=_0x2d50b5?0x0:_0x9e8c50[_0x8d05('0x1c')];var _0x1fe885=_0x2d50b5?_0x492cff[_0x8d05('0x1f')]:_0x9e8c50[_0x8d05('0x1c')]+_0x9e8c50[_0x8d05('0x1e')];var _0x47ed21;if(_0x1fe885>=_0x568ae5){_0x1fe885=_0x568ae5;_0x47ed21=0xc8;}else{_0x47ed21=0xce;}_0x462377[_0x8d05('0x19')](_0x47ed21);return _0x462377[_0x8d05('0x20')](_0x8d05('0x21'),_0x31c1d6+'-'+_0x1fe885+'/'+_0x568ae5)[_0x8d05('0x1b')](_0x492cff);}return null;};}function patchUpdates(_0x2083e5){return function(_0x3ac1e6){try{jsonpatch[_0x8d05('0x22')](_0x3ac1e6,_0x2083e5,!![]);}catch(_0x59a14c){return BPromise['reject'](_0x59a14c);}return _0x3ac1e6['save']();};}function saveUpdates(_0x292173,_0xdb1c59){return function(_0x58b953){if(_0x58b953){return _0x58b953[_0x8d05('0x23')](_0x292173)[_0x8d05('0x24')](function(_0x10b95a){return _0x10b95a;});}return null;};}function removeEntity(_0x156d8e,_0xb4ffe4){return function(_0x551425){if(_0x551425){return _0x551425[_0x8d05('0x25')]()[_0x8d05('0x24')](function(){_0x156d8e[_0x8d05('0x19')](0xcc)[_0x8d05('0x1a')]();});}};}function handleEntityNotFound(_0x4842ce,_0x176f4e){return function(_0x38dd90){if(!_0x38dd90){_0x4842ce[_0x8d05('0x18')](0x194);}return _0x38dd90;};}function handleError(_0x4ea201,_0x996572){_0x996572=_0x996572||0x1f4;return function(_0x3e728a){logger[_0x8d05('0x26')](_0x3e728a[_0x8d05('0x27')]);if(_0x3e728a[_0x8d05('0x28')]){delete _0x3e728a[_0x8d05('0x28')];}_0x4ea201[_0x8d05('0x19')](_0x996572)[_0x8d05('0x29')](_0x3e728a);};}exports[_0x8d05('0x2a')]=function(_0x4ddd13,_0x6fecbd){var _0x554855={},_0x2740e9={},_0x288f83={'count':0x0,'rows':[]};var _0x1b3329=_[_0x8d05('0x2b')](db[_0x8d05('0x2c')][_0x8d05('0x2d')],function(_0x12b5c0){return{'name':_0x12b5c0[_0x8d05('0x2e')],'type':_0x12b5c0[_0x8d05('0x2f')][_0x8d05('0x30')]};});_0x2740e9[_0x8d05('0x31')]=_[_0x8d05('0x32')](_[_0x8d05('0x2b')](_0x1b3329,_0x8d05('0x28')),[_0x8d05('0x33')]);_0x2740e9[_0x8d05('0x34')]=_[_0x8d05('0x35')](_0x4ddd13['query']);_0x2740e9[_0x8d05('0x36')]=_[_0x8d05('0x37')](_0x2740e9[_0x8d05('0x31')],_0x2740e9[_0x8d05('0x34')]);_0x554855['attributes']=_[_0x8d05('0x37')](_0x2740e9['model'],qs['fields'](_0x4ddd13['query'][_0x8d05('0x38')]));_0x554855['attributes']=_0x554855[_0x8d05('0x39')][_0x8d05('0x3a')]?_0x554855[_0x8d05('0x39')]:_0x2740e9[_0x8d05('0x31')];if(!_0x4ddd13[_0x8d05('0x34')][_0x8d05('0x3b')](_0x8d05('0x3c'))){_0x554855[_0x8d05('0x1e')]=qs[_0x8d05('0x1e')](_0x4ddd13['query'][_0x8d05('0x1e')]);_0x554855['offset']=qs['offset'](_0x4ddd13[_0x8d05('0x34')][_0x8d05('0x1c')]);}_0x554855[_0x8d05('0x3d')]=qs['sort'](_0x4ddd13[_0x8d05('0x34')][_0x8d05('0x3e')]);_0x554855[_0x8d05('0x3f')]=qs['filters'](_[_0x8d05('0x40')](_0x4ddd13[_0x8d05('0x34')],_0x2740e9[_0x8d05('0x36')]),_0x1b3329);if(_0x4ddd13[_0x8d05('0x34')][_0x8d05('0x41')]){_0x554855[_0x8d05('0x3f')]=_[_0x8d05('0x42')](_0x554855['where'],{'$or':_[_0x8d05('0x2b')](_0x1b3329,function(_0x434916){if(_0x434916[_0x8d05('0x2f')]!==_0x8d05('0x43')){var _0x46f0cc={};_0x46f0cc[_0x434916[_0x8d05('0x28')]]={'$like':'%'+_0x4ddd13[_0x8d05('0x34')]['filter']+'%'};return _0x46f0cc;}})});}_0x554855=_[_0x8d05('0x42')]({},_0x554855,_0x4ddd13[_0x8d05('0x44')]);var _0x3aaca3={'where':_0x554855[_0x8d05('0x3f')]};return db[_0x8d05('0x2c')][_0x8d05('0x1f')](_0x3aaca3)[_0x8d05('0x24')](function(_0xeb0478){_0x288f83['count']=_0xeb0478;if(_0x4ddd13[_0x8d05('0x34')][_0x8d05('0x45')]){_0x554855[_0x8d05('0x46')]=[{'all':!![]}];}return db[_0x8d05('0x2c')][_0x8d05('0x47')](_0x554855);})[_0x8d05('0x24')](function(_0x3f68e0){_0x288f83[_0x8d05('0x48')]=_0x3f68e0;return _0x288f83;})[_0x8d05('0x24')](respondWithFilteredResult(_0x6fecbd,_0x554855))['catch'](handleError(_0x6fecbd,null));};exports[_0x8d05('0x49')]=function(_0x8c3eef,_0x295107){var _0x2b6820={'raw':![],'where':{'id':_0x8c3eef[_0x8d05('0x4a')]['id']}},_0x2c1ef4={};_0x2c1ef4[_0x8d05('0x31')]=_['keys'](db[_0x8d05('0x2c')][_0x8d05('0x2d')]);_0x2c1ef4[_0x8d05('0x34')]=_[_0x8d05('0x35')](_0x8c3eef[_0x8d05('0x34')]);_0x2c1ef4[_0x8d05('0x36')]=_[_0x8d05('0x37')](_0x2c1ef4[_0x8d05('0x31')],_0x2c1ef4[_0x8d05('0x34')]);_0x2b6820[_0x8d05('0x39')]=_[_0x8d05('0x37')](_0x2c1ef4['model'],qs['fields'](_0x8c3eef[_0x8d05('0x34')][_0x8d05('0x38')]));_0x2b6820[_0x8d05('0x39')]=_0x2b6820['attributes'][_0x8d05('0x3a')]?_0x2b6820[_0x8d05('0x39')]:_0x2c1ef4[_0x8d05('0x31')];if(_0x8c3eef[_0x8d05('0x34')][_0x8d05('0x45')]){_0x2b6820[_0x8d05('0x46')]=[{'all':!![]}];}_0x2b6820=_[_0x8d05('0x42')]({},_0x2b6820,_0x8c3eef['options']);return db[_0x8d05('0x2c')][_0x8d05('0x4b')](_0x2b6820)[_0x8d05('0x24')](handleEntityNotFound(_0x295107,null))[_0x8d05('0x24')](respondWithResult(_0x295107,null))[_0x8d05('0x4c')](handleError(_0x295107,null));};exports[_0x8d05('0x4d')]=function(_0x24ae23,_0x23d4d7){return db['VoiceRecording'][_0x8d05('0x4d')](_0x24ae23['body'],{})[_0x8d05('0x24')](respondWithResult(_0x23d4d7,0xc9))[_0x8d05('0x4c')](handleError(_0x23d4d7,null));};exports['update']=function(_0x488383,_0x4c33b7){if(_0x488383[_0x8d05('0x4e')]['id']){delete _0x488383['body']['id'];}return db[_0x8d05('0x2c')]['find']({'where':{'id':_0x488383[_0x8d05('0x4a')]['id']}})[_0x8d05('0x24')](handleEntityNotFound(_0x4c33b7,null))[_0x8d05('0x24')](saveUpdates(_0x488383[_0x8d05('0x4e')],null))['then'](respondWithResult(_0x4c33b7,null))[_0x8d05('0x4c')](handleError(_0x4c33b7,null));};exports['describe']=function(_0x307b83,_0x650f4d){return db['VoiceRecording'][_0x8d05('0x4f')]()[_0x8d05('0x24')](respondWithResult(_0x650f4d,null))['catch'](handleError(_0x650f4d,null));};exports[_0x8d05('0x50')]=function(_0x1e232a,_0x427c10,_0x1e514a){var _0x5984a7=require(_0x8d05('0x51'));var _0x41511f=![];var _0x150548={};if(_0x1e232a[_0x8d05('0x34')][_0x8d05('0x2f')]&&_0x1e232a[_0x8d05('0x34')]['type']===_0x8d05('0x52')){_0x150548['uniqueid']=_0x1e232a['params']['id'];}else{_0x150548['id']=_0x1e232a[_0x8d05('0x4a')]['id'];}return db[_0x8d05('0x2c')]['find']({'where':_0x150548,'attributes':['id',_0x8d05('0x53')],'raw':!![]})[_0x8d05('0x24')](handleEntityNotFound(_0x427c10,null))[_0x8d05('0x24')](function(_0x3765f4){if(_0x3765f4){var _0x4e413b=_0x3765f4['value'];var _0x1305ad=util[_0x8d05('0x33')](_0x8d05('0x54'),_0x4e413b);if(fs[_0x8d05('0x55')](_0x1305ad)){_0x41511f=!![];return _0x5984a7['decryptFile'](_0x1305ad,_0x4e413b,config[_0x8d05('0x56')]['recording'])['then'](function(){return _0x3765f4;});}return _0x3765f4;}})[_0x8d05('0x24')](function(_0x5c5913){if(_0x5c5913){var _0x320733=_0x5c5913[_0x8d05('0x53')];if(!fs[_0x8d05('0x55')](_0x320733)){throw new db[(_0x8d05('0x57'))][(_0x8d05('0x58'))](_0x8d05('0x59'));}if(_0x5c5913[_0x8d05('0x5a')]){return _0x427c10[_0x8d05('0x50')](_0x320733,_0x5c5913['filename']+path[_0x8d05('0x5b')](_0x320733),function(){if(_0x41511f){fs[_0x8d05('0x5c')](_0x320733);}});}else{return _0x427c10['download'](_0x320733,function(_0x19d7a0){if(_0x41511f){fs[_0x8d05('0x5c')](_0x320733);}});}}})[_0x8d05('0x4c')](function(_0x31267f){if(_0x31267f[_0x8d05('0x5d')]===_0x8d05('0x59')){_0x427c10[_0x8d05('0x19')](0x194)[_0x8d05('0x29')](_0x8d05('0x5e'));}else{return handleError(_0x427c10,null);}});};exports[_0x8d05('0x5f')]=function(_0x18543d,_0x49cc90,_0x454fb4){var _0x1003c1=require('../../components/encryptor');var _0x54216a=![];var _0x2c4937={'$and':[db[_0x8d05('0x60')][_0x8d05('0x3f')](db['sequelize']['fn'](_0x8d05('0x61'),db[_0x8d05('0x60')][_0x8d05('0x62')](_0x8d05('0x52'))),_0x18543d[_0x8d05('0x34')][_0x8d05('0x63')])]};if(_0x18543d[_0x8d05('0x34')][_0x8d05('0x2f')]&&_0x18543d[_0x8d05('0x34')]['type']==='uniqueid'){_0x2c4937[_0x8d05('0x64')][_0x8d05('0x65')]({'uniqueid':_0x18543d['params']['id']});}else{_0x2c4937[_0x8d05('0x64')][_0x8d05('0x65')]({'id':_0x18543d[_0x8d05('0x4a')]['id']});}return db[_0x8d05('0x2c')]['find']({'where':_0x2c4937,'attributes':['id',_0x8d05('0x53')],'raw':!![]})['then'](handleEntityNotFound(_0x49cc90,null))[_0x8d05('0x24')](function(_0x590a4b){if(_0x590a4b){var _0x416011=util[_0x8d05('0x33')](_0x8d05('0x54'),_0x590a4b[_0x8d05('0x53')]);if(fs[_0x8d05('0x55')](_0x416011)){_0x54216a=!![];return _0x1003c1[_0x8d05('0x66')](_0x416011,_0x590a4b[_0x8d05('0x53')],config[_0x8d05('0x56')]['recording'])[_0x8d05('0x24')](function(){return _0x590a4b;});}return _0x590a4b;}})['then'](function(_0x5999c7){if(_0x5999c7){if(!fs[_0x8d05('0x55')](_0x5999c7['value'])){throw new db[(_0x8d05('0x57'))][(_0x8d05('0x58'))](_0x8d05('0x59'));}if(_0x5999c7[_0x8d05('0x5a')]){return _0x49cc90[_0x8d05('0x50')](_0x5999c7['value'],_0x5999c7[_0x8d05('0x5a')]+path[_0x8d05('0x5b')](_0x5999c7['value']),function(){if(_0x54216a){fs[_0x8d05('0x5c')](_0x5999c7['value']);}});}else{return _0x49cc90[_0x8d05('0x50')](_0x5999c7[_0x8d05('0x53')],function(_0xfd4e86){if(_0x54216a){fs[_0x8d05('0x5c')](_0x5999c7['value']);}});}}})[_0x8d05('0x4c')](handleError(_0x49cc90,null));};exports['destroy']=function(_0x321763,_0x402d3e){return db['VoiceRecording'][_0x8d05('0x4b')]({'where':{'id':_0x321763[_0x8d05('0x4a')]['id']}})[_0x8d05('0x24')](function(_0x115d3a){if(_[_0x8d05('0x67')](_0x115d3a)){throw new ReferenceError(_0x8d05('0x68'));}return _0x115d3a;})[_0x8d05('0x24')](function(_0x248f4e){var _0xb4911f=_0x248f4e[_0x8d05('0x53')];logger[_0x8d05('0x69')](_0x8d05('0x6a'),_0xb4911f);if(!_[_0x8d05('0x67')](_0x248f4e['value'])&&fs[_0x8d05('0x55')](_0xb4911f)){logger[_0x8d05('0x69')](_0x8d05('0x6b')+_0xb4911f+_0x8d05('0x6c'));fs[_0x8d05('0x6d')](_0xb4911f);}_0xb4911f=_0xb4911f+_0x8d05('0x6e');if(!_['isNil'](_0x248f4e[_0x8d05('0x53')])&&fs[_0x8d05('0x55')](_0xb4911f)){logger[_0x8d05('0x69')](_0x8d05('0x6b')+_0xb4911f+_0x8d05('0x6c'));fs['unlinkSync'](_0xb4911f);}return _0x248f4e;})['then'](function(_0x3c10e5){if(!_0x3c10e5)throw new InternalError();return _0x3c10e5[_0x8d05('0x25')]();})['then'](function(){_0x402d3e['status'](0xcc)[_0x8d05('0x1a')]();})['catch'](handleError(_0x402d3e,null));};function getBucketslist(_0x112802,_0x5644b5,_0x5959b2){return new Promise(function(_0x1361a8,_0x313990){var _0x5bf238=new AWS['S3']({'accessKeyId':_0x5644b5,'secretAccessKey':_0x112802,'region':_0x5959b2});_0x5bf238[_0x8d05('0x6f')]({},function(_0xafaf49,_0x46d643){if(_0xafaf49){return _0x313990(_0xafaf49);}else{return _0x1361a8(_0x46d643);}});});}function createBucket(_0x3a9252,_0x1b33fc,_0x1e5c8f,_0x17abe1){return new Promise(function(_0x54dd88,_0x2d7109){var _0x114928=new AWS['S3']({'accessKeyId':_0x1b33fc,'secretAccessKey':_0x3a9252,'region':_0x1e5c8f});_0x114928[_0x8d05('0x70')]({'Bucket':_0x17abe1},function(_0x42c7a4,_0x26defa){if(_0x42c7a4){return _0x2d7109(_0x42c7a4);}else{return _0x54dd88(_0x26defa);}});});}function uploadFile(_0x520d4e,_0xb139da,_0x53663c,_0x1f3f7f,_0x4a49ae,_0x11dc9b){return new Promise(function(_0x147a3c,_0x39360d){var _0x50f386=new AWS['S3']({'accessKeyId':_0xb139da,'secretAccessKey':_0x520d4e,'region':_0x53663c});_0x50f386[_0x8d05('0x71')]({'Bucket':_0x1f3f7f,'Key':_0x4a49ae,'Body':_0x11dc9b},function(_0x53f4f1,_0x545336){if(_0x53f4f1){return _0x39360d(_0x53f4f1);}else{return _0x147a3c(_0x545336);}});});}function startTranscribe(_0x949128,_0x3a9461,_0x11b312,_0x1e1f61,_0x243a5e,_0x37900e){return new Promise(function(_0x270709,_0x2ad35a){var _0x2e0ce4=new AWS[(_0x8d05('0x72'))]({'accessKeyId':_0x3a9461,'secretAccessKey':_0x949128,'region':_0x11b312});_0x2e0ce4[_0x8d05('0x73')]({'TranscriptionJobName':_0x1e1f61,'LanguageCode':_0x243a5e,'Media':{'MediaFileUri':_0x37900e}},function(_0x40adce,_0x9378d0){if(_0x40adce){return _0x2ad35a(_0x40adce);}else{return _0x270709(_0x9378d0);}});});}function transcribe(_0xe51095,_0x323ebd,_0x1f0429,_0x4e2bd,_0xd49de3,_0x54bf32,_0xda0cd9){return new Promise(function(_0x2d90e5,_0x4d442f){var _0x3a654c={};logger[_0x8d05('0x69')](util[_0x8d05('0x33')](_0x8d05('0x74'),_0xe51095,_0xd49de3));return uploadFile(_0x323ebd,_0x1f0429,_0x4e2bd,_0xd49de3,path[_0x8d05('0x75')](_0x54bf32),fs[_0x8d05('0x76')](_0x54bf32))[_0x8d05('0x24')](function(_0x498400){logger['info'](util[_0x8d05('0x33')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0xe51095,_0xd49de3,_0x498400[_0x8d05('0x77')]));_0x3a654c[_0x8d05('0x78')]=_0x498400[_0x8d05('0x79')];_0x3a654c[_0x8d05('0x7a')]=_0x498400[_0x8d05('0x77')];logger[_0x8d05('0x69')](util[_0x8d05('0x33')](_0x8d05('0x7b'),_0xe51095));return startTranscribe(_0x323ebd,_0x1f0429,_0x4e2bd,uuidv4(),_0xda0cd9,_0x498400['Location']);})[_0x8d05('0x24')](function(_0x2257b5){logger[_0x8d05('0x69')](util[_0x8d05('0x33')](_0x8d05('0x7c'),_0xe51095,_0x2257b5['TranscriptionJob'][_0x8d05('0x7d')]));_0x3a654c[_0x8d05('0x7e')]=_0x2257b5[_0x8d05('0x7f')]['TranscriptionJobName'];_0x3a654c[_0x8d05('0x80')]=_0x2257b5[_0x8d05('0x7f')][_0x8d05('0x81')];return _0x2d90e5(_0x3a654c);})['catch'](function(_0xa320e){return _0x4d442f(_0xa320e);});});}exports[_0x8d05('0x82')]=function(_0x29922a,_0x95f32a,_0x5d2714){var _0x2a5130;var _0x3cc62d;var _0x175312;var _0x3b2f71=require(_0x8d05('0x51'));return db[_0x8d05('0x2c')]['findOne']({'where':{'id':_0x29922a[_0x8d05('0x4a')]['id']}})['then'](function(_0x48ae50){if(_0x48ae50){var _0x3724c2=util['format'](_0x8d05('0x54'),_0x48ae50[_0x8d05('0x53')]);if(fs['existsSync'](_0x3724c2)){cypher=!![];return _0x3b2f71[_0x8d05('0x66')](_0x3724c2,_0x48ae50[_0x8d05('0x53')],config['secrets'][_0x8d05('0x83')])[_0x8d05('0x24')](function(){return _0x48ae50;});}return _0x48ae50;}})[_0x8d05('0x24')](function(_0x42f29f){if(!_0x42f29f){throw new db[(_0x8d05('0x57'))]['ValidationError']('Voice\x20Recording\x20not\x20found');}_0x3cc62d=_0x42f29f;return db[_0x8d05('0x84')][_0x8d05('0x85')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x95f32a,null))[_0x8d05('0x24')](function(_0x50dd54){if(_0x50dd54){_0x2a5130=_0x50dd54;if(!_0x2a5130['transcribe']||!_0x2a5130[_0x8d05('0x86')]||!_0x2a5130[_0x8d05('0x87')]||!_0x2a5130[_0x8d05('0x88')]||!_0x2a5130[_0x8d05('0x78')]){throw new db[(_0x8d05('0x57'))][(_0x8d05('0x58'))](_0x8d05('0x89'));}if(_0x29922a[_0x8d05('0x4e')][_0x8d05('0x8a')]&&(!_0x2a5130[_0x8d05('0x8b')]||!_0x2a5130[_0x8d05('0x8c')]||!_0x2a5130[_0x8d05('0x8d')]||!_0x2a5130[_0x8d05('0x88')]||!_0x2a5130['bucket'])){throw new db[(_0x8d05('0x57'))]['ValidationError'](_0x8d05('0x8e'));}return db[_0x8d05('0x8f')][_0x8d05('0x85')]({'where':{'id':_0x2a5130[_0x8d05('0x86')]}});}})[_0x8d05('0x24')](function(_0x5402c3){if(!_0x5402c3){throw new db[(_0x8d05('0x57'))][(_0x8d05('0x58'))](_0x8d05('0x90'));}if(!_0x5402c3[_0x8d05('0x91')]||!_0x5402c3['data2']){throw new db[(_0x8d05('0x57'))]['ValidationError'](_0x8d05('0x92'));}_0x175312=_0x5402c3;return getBucketslist(_0x175312[_0x8d05('0x91')],_0x175312['data2'],_0x2a5130[_0x8d05('0x87')]);})['then'](function(_0x3393bd){if(_0x3393bd&&_0x3393bd[_0x8d05('0x93')]){var _0x47c6df=_['find'](_0x3393bd[_0x8d05('0x93')],function(_0x3eb35e){return _0x3eb35e[_0x8d05('0x94')]===_0x2a5130['bucket'];});if(!_0x47c6df){logger['info'](util[_0x8d05('0x33')](_0x8d05('0x95'),_0x29922a['params']['id'],_0x2a5130['bucket']));return createBucket(_0x175312[_0x8d05('0x91')],_0x175312[_0x8d05('0x96')],_0x2a5130['transcribeRegion'],_0x2a5130['bucket']);}logger[_0x8d05('0x69')](util['format'](_0x8d05('0x97'),_0x29922a[_0x8d05('0x4a')]['id'],_0x2a5130['bucket']));return;}})[_0x8d05('0x24')](function(_0x2f1432){if(_0x3cc62d[_0x8d05('0x80')]==='NEW'){return transcribe(_0x29922a[_0x8d05('0x4a')]['id'],_0x175312[_0x8d05('0x91')],_0x175312['data2'],_0x2a5130['transcribeRegion'],_0x2a5130[_0x8d05('0x78')],_0x3cc62d['value'],_0x2a5130[_0x8d05('0x88')]);}else{logger['info'](util[_0x8d05('0x33')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x29922a[_0x8d05('0x4a')]['id']));return{'transcribeStatus':_0x8d05('0x98')};}})[_0x8d05('0x24')](function(_0x17377d){if(_0x17377d){_0x17377d[_0x8d05('0x99')]=_0x29922a[_0x8d05('0x4e')]['runSentiment'];return _0x3cc62d['updateAttributes'](_0x17377d);}})[_0x8d05('0x24')](respondWithResult(_0x95f32a,null))[_0x8d05('0x4c')](handleError(_0x95f32a,null));};function writeFile(_0x409769,_0x5109d0){return new Promise(function(_0x1b1417,_0x2fb2b1){fs['writeFile'](_0x5109d0,_0x409769,function(_0x40de1c,_0x29f2bf){if(_0x40de1c){return _0x2fb2b1(_0x40de1c);}else{return _0x1b1417(_0x29f2bf);}});});}exports[_0x8d05('0x9a')]=function(_0xf166af,_0x348463,_0x3d5e93){return db[_0x8d05('0x2c')]['findOne']({'where':{'id':_0xf166af['params']['id']}})[_0x8d05('0x24')](handleEntityNotFound(_0x348463))[_0x8d05('0x24')](function(_0x2aad7f){if(_0x2aad7f&&_0x2aad7f[_0x8d05('0x9b')]){var _0xb32e3a=_0x2aad7f[_0x8d05('0x9b')];var _0xf53c87=config[_0x8d05('0x9c')]+_0x8d05('0x9d')+_0x2aad7f['id']+'.txt';if(fs[_0x8d05('0x55')](_0xf53c87)){return _0xf53c87;}return writeFile(_0xb32e3a,_0xf53c87)[_0x8d05('0x24')](function(){return _0xf53c87;});}else{throw new db[(_0x8d05('0x57'))][(_0x8d05('0x58'))]('Transcript\x20not\x20available');}})[_0x8d05('0x24')](function(_0xd319a9){return _0x348463[_0x8d05('0x50')](_0xd319a9);})[_0x8d05('0x4c')](handleError(_0x348463));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 2836177..c5e2c37 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 _0xc6d8=['define','voice_recordings','transcribeStatus','./voiceRecording.attributes'];(function(_0x567f8a,_0x1ad54d){var _0x3d3d08=function(_0x16085f){while(--_0x16085f){_0x567f8a['push'](_0x567f8a['shift']());}};_0x3d3d08(++_0x1ad54d);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x48d007,_0x446953){_0x48d007=_0x48d007-0x0;var _0x412d80=_0xc6d8[_0x48d007];return _0x412d80;};'use strict';var attributes=require(_0x8c6d('0x0'));module['exports']=function(_0x170f12,_0x49772b){return _0x170f12[_0x8c6d('0x1')]('VoiceRecording',attributes,{'tableName':_0x8c6d('0x2'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']},{'name':_0x8c6d('0x3'),'fields':[_0x8c6d('0x3')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd52a=['uniqueid','transcribeStatus','exports','define','VoiceRecording'];(function(_0x898178,_0x58302d){var _0x148092=function(_0x1252d1){while(--_0x1252d1){_0x898178['push'](_0x898178['shift']());}};_0x148092(++_0x58302d);}(_0xd52a,0xca));var _0xad52=function(_0x1edf74,_0x28a23d){_0x1edf74=_0x1edf74-0x0;var _0x3a0aae=_0xd52a[_0x1edf74];return _0x3a0aae;};'use strict';var attributes=require('./voiceRecording.attributes');module[_0xad52('0x0')]=function(_0x5e6aa7,_0x14c488){return _0x5e6aa7[_0xad52('0x1')](_0xad52('0x2'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0xad52('0x3'),'fields':[_0xad52('0x3')]},{'name':_0xad52('0x4'),'fields':[_0xad52('0x4')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 8034692..60ece62 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 _0x0424=['stringify','error','message','info','result','catch','UpdateVoiceRecording','VoiceRecording','body','options','raw','where','limit','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s'];(function(_0x4a248b,_0x29e290){var _0x565f8c=function(_0x3944b1){while(--_0x3944b1){_0x4a248b['push'](_0x4a248b['shift']());}};_0x565f8c(++_0x29e290);}(_0x0424,0x159));var _0x4042=function(_0x5087b7,_0x117485){_0x5087b7=_0x5087b7-0x0;var _0x3b4c2b=_0x0424[_0x5087b7];return _0x3b4c2b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4042('0x0'));var BPromise=require(_0x4042('0x1'));var rs=require(_0x4042('0x2'));var fs=require('fs');var Redis=require(_0x4042('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4042('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4042('0x5'));var jayson=require(_0x4042('0x6'));var client=jayson[_0x4042('0x7')][_0x4042('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3abaf1,_0xa5310f,_0x10ec07){return new BPromise(function(_0x5d11bf,_0x509772){return client[_0x4042('0x9')](_0x3abaf1,_0x10ec07)[_0x4042('0xa')](function(_0x103e4a){logger['info'](_0x4042('0xb'),_0xa5310f,_0x4042('0xc'));logger[_0x4042('0xd')](_0x4042('0xe'),_0xa5310f,_0x4042('0xc'),JSON[_0x4042('0xf')](_0x103e4a));if(_0x103e4a[_0x4042('0x10')]){if(_0x103e4a[_0x4042('0x10')]['code']===0x1f4){logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x103e4a['error'][_0x4042('0x11')]);return _0x509772(_0x103e4a[_0x4042('0x10')][_0x4042('0x11')]);}logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x103e4a[_0x4042('0x10')][_0x4042('0x11')]);return _0x5d11bf(_0x103e4a['error'][_0x4042('0x11')]);}else{logger[_0x4042('0x12')]('VoiceRecording,\x20%s,\x20%s',_0xa5310f,_0x4042('0xc'));_0x5d11bf(_0x103e4a[_0x4042('0x13')][_0x4042('0x11')]);}})[_0x4042('0x14')](function(_0x31e765){logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x31e765);_0x509772(_0x31e765);});});}exports[_0x4042('0x15')]=function(_0x466077){var _0x4b02d4=this;return new Promise(function(_0xe5c1ec,_0x4fe024){return db[_0x4042('0x16')]['update'](_0x466077[_0x4042('0x17')],{'raw':_0x466077[_0x4042('0x18')]?_0x466077[_0x4042('0x18')][_0x4042('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x466077['options']?_0x466077[_0x4042('0x18')][_0x4042('0x1a')]||null:null,'attributes':_0x466077[_0x4042('0x18')]?_0x466077[_0x4042('0x18')]['attributes']||null:null,'limit':_0x466077[_0x4042('0x18')]?_0x466077[_0x4042('0x18')][_0x4042('0x1b')]||null:null})[_0x4042('0xa')](function(_0x352631){logger['info'](_0x4042('0x15'),_0x466077);logger[_0x4042('0xd')]('UpdateVoiceRecording',_0x466077,JSON[_0x4042('0xf')](_0x352631));_0xe5c1ec(_0x352631);})['catch'](function(_0x271b82){logger[_0x4042('0x10')](_0x4042('0x15'),_0x271b82['message'],_0x466077);_0x4fe024(_0x4b02d4[_0x4042('0x10')](0x1f4,_0x271b82[_0x4042('0x11')]));});});};exports[_0x4042('0x1c')]=function(_0xbdadc8){var _0x1c4d9f=this;return new Promise(function(_0x52e575,_0x58c409){var _0x1d8d48=require(_0x4042('0x1d'));var _0x26542c;return db[_0x4042('0x1e')][_0x4042('0x1f')]({'attributes':['id',_0x4042('0x20')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x33733b){_0x26542c=_0x33733b;return db[_0x4042('0x16')]['create'](_0xbdadc8[_0x4042('0x17')]);})[_0x4042('0xa')](function(_0xe924fe){if(_0x26542c['callRecordingEncryption']&&fs['existsSync'](_0xe924fe[_0x4042('0x21')])){var _0x43bd1c=util['format'](_0x4042('0x22'),_0xe924fe[_0x4042('0x21')]);return _0x1d8d48[_0x4042('0x23')](_0xe924fe[_0x4042('0x21')],_0x43bd1c,config[_0x4042('0x24')][_0x4042('0x25')])[_0x4042('0xa')](function(){fs[_0x4042('0x26')](_0xe924fe[_0x4042('0x21')]);logger['info'](_0x4042('0x27'));return _0xe924fe;});}return _0xe924fe;})[_0x4042('0xa')](function(_0x5320f8){logger[_0x4042('0x12')](_0x4042('0x1c'),_0xbdadc8);logger['debug'](_0x4042('0x1c'),_0xbdadc8,JSON[_0x4042('0xf')](_0x5320f8));_0x52e575(_0x5320f8);})[_0x4042('0x14')](function(_0xaa7c99){logger[_0x4042('0x10')](_0x4042('0x1c'),_0xaa7c99[_0x4042('0x11')],_0xbdadc8);_0x58c409(_0x1c4d9f[_0x4042('0x10')](0x1f4,_0xaa7c99[_0x4042('0x11')]));});});}; \ No newline at end of file +var _0x14a0=['where','attributes','limit','../../components/encryptor','findOne','callRecordingEncryption','existsSync','format','%s.cypher','value','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','VoiceRecording,\x20%s,\x20%s','message','info','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options'];(function(_0x2ebbd7,_0x587ea4){var _0xa5ff7d=function(_0x2bb53d){while(--_0x2bb53d){_0x2ebbd7['push'](_0x2ebbd7['shift']());}};_0xa5ff7d(++_0x587ea4);}(_0x14a0,0x8e));var _0x014a=function(_0x3c1d7e,_0x31a4a7){_0x3c1d7e=_0x3c1d7e-0x0;var _0x2c5c79=_0x14a0[_0x3c1d7e];return _0x2c5c79;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('VoiceRecording,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});}exports[_0x014a('0x15')]=function(_0x12d339){var _0x61ec9f=this;return new Promise(function(_0x263b07,_0x16490a){return db[_0x014a('0x16')][_0x014a('0x17')](_0x12d339[_0x014a('0x18')],{'raw':_0x12d339[_0x014a('0x19')]?_0x12d339[_0x014a('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12d339[_0x014a('0x19')]?_0x12d339[_0x014a('0x19')][_0x014a('0x1a')]||null:null,'attributes':_0x12d339[_0x014a('0x19')]?_0x12d339[_0x014a('0x19')][_0x014a('0x1b')]||null:null,'limit':_0x12d339[_0x014a('0x19')]?_0x12d339[_0x014a('0x19')][_0x014a('0x1c')]||null:null})['then'](function(_0x3679ed){logger['info'](_0x014a('0x15'),_0x12d339);logger[_0x014a('0xb')](_0x014a('0x15'),_0x12d339,JSON[_0x014a('0xd')](_0x3679ed));_0x263b07(_0x3679ed);})[_0x014a('0x14')](function(_0x113b12){logger[_0x014a('0xe')](_0x014a('0x15'),_0x113b12[_0x014a('0x11')],_0x12d339);_0x16490a(_0x61ec9f['error'](0x1f4,_0x113b12[_0x014a('0x11')]));});});};exports['CreateVoiceRecording']=function(_0x39a432){var _0x28701e=this;return new Promise(function(_0x4f1c44,_0x4ee195){var _0x9a901f=require(_0x014a('0x1d'));var _0x143346;return db['Setting'][_0x014a('0x1e')]({'attributes':['id',_0x014a('0x1f')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x31dc95){_0x143346=_0x31dc95;return db[_0x014a('0x16')]['create'](_0x39a432['body']);})[_0x014a('0xa')](function(_0x3e5a0a){if(_0x143346[_0x014a('0x1f')]&&fs[_0x014a('0x20')](_0x3e5a0a['value'])){var _0x434038=util[_0x014a('0x21')](_0x014a('0x22'),_0x3e5a0a[_0x014a('0x23')]);return _0x9a901f[_0x014a('0x24')](_0x3e5a0a[_0x014a('0x23')],_0x434038,config[_0x014a('0x25')][_0x014a('0x26')])[_0x014a('0xa')](function(){fs[_0x014a('0x27')](_0x3e5a0a[_0x014a('0x23')]);logger['info'](_0x014a('0x28'));return _0x3e5a0a;});}return _0x3e5a0a;})[_0x014a('0xa')](function(_0x1f7a3b){logger[_0x014a('0x12')](_0x014a('0x29'),_0x39a432);logger[_0x014a('0xb')](_0x014a('0x29'),_0x39a432,JSON['stringify'](_0x1f7a3b));_0x4f1c44(_0x1f7a3b);})[_0x014a('0x14')](function(_0x325b3c){logger['error'](_0x014a('0x29'),_0x325b3c[_0x014a('0x11')],_0x39a432);_0x4ee195(_0x28701e[_0x014a('0xe')](0x1f4,_0x325b3c[_0x014a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index a22e1fc..9b0571b 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 _0xb31f=['../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','/describe','describe','post','create','put','/:id','update','delete','destroy','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x256cc1,_0x568424){var _0x330d0a=function(_0x4c8cc1){while(--_0x4c8cc1){_0x256cc1['push'](_0x256cc1['shift']());}};_0x330d0a(++_0x568424);}(_0xb31f,0x1d9));var _0xfb31=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xb31f[_0x54d4fe];return _0x1ab5bb;};'use strict';var multer=require(_0xfb31('0x0'));var util=require(_0xfb31('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfb31('0x2'));var router=express[_0xfb31('0x3')]();var fs_extra=require(_0xfb31('0x4'));var auth=require(_0xfb31('0x5'));var interaction=require(_0xfb31('0x6'));var config=require(_0xfb31('0x7'));var controller=require(_0xfb31('0x8'));router[_0xfb31('0x9')]('/',auth[_0xfb31('0xa')](),controller['index']);router[_0xfb31('0x9')](_0xfb31('0xb'),auth['isAuthenticated'](),controller[_0xfb31('0xc')]);router['get']('/:id',auth[_0xfb31('0xa')](),controller['show']);router[_0xfb31('0xd')]('/',auth[_0xfb31('0xa')](),controller[_0xfb31('0xe')]);router[_0xfb31('0xf')](_0xfb31('0x10'),auth['isAuthenticated'](),controller[_0xfb31('0x11')]);router[_0xfb31('0x12')](_0xfb31('0x10'),auth[_0xfb31('0xa')](),controller[_0xfb31('0x13')]);module['exports']=router; \ No newline at end of file +var _0x6b98=['../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4de877,_0x340170){var _0xb2cfeb=function(_0x488634){while(--_0x488634){_0x4de877['push'](_0x4de877['shift']());}};_0xb2cfeb(++_0x340170);}(_0x6b98,0x175));var _0x86b9=function(_0x1e271f,_0xf14504){_0x1e271f=_0x1e271f-0x0;var _0x2b2ac5=_0x6b98[_0x1e271f];return _0x2b2ac5;};'use strict';var multer=require('multer');var util=require(_0x86b9('0x0'));var path=require(_0x86b9('0x1'));var timeout=require(_0x86b9('0x2'));var express=require(_0x86b9('0x3'));var router=express[_0x86b9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x86b9('0x5'));var interaction=require(_0x86b9('0x6'));var config=require(_0x86b9('0x7'));var controller=require(_0x86b9('0x8'));router[_0x86b9('0x9')]('/',auth[_0x86b9('0xa')](),controller[_0x86b9('0xb')]);router[_0x86b9('0x9')](_0x86b9('0xc'),auth['isAuthenticated'](),controller[_0x86b9('0xd')]);router[_0x86b9('0x9')](_0x86b9('0xe'),auth[_0x86b9('0xa')](),controller['show']);router[_0x86b9('0xf')]('/',auth[_0x86b9('0xa')](),controller[_0x86b9('0x10')]);router[_0x86b9('0x11')](_0x86b9('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x86b9('0xe'),auth[_0x86b9('0xa')](),controller[_0x86b9('0x12')]);module[_0x86b9('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 2960770..157993a 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 _0xaf1b=['exports','ENUM','blind','attended','STRING','Yes','sequelize','moment'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xaf1b,0x166));var _0xbaf1=function(_0x151fac,_0x5292e7){_0x151fac=_0x151fac-0x0;var _0x34f9f1=_0xaf1b[_0x151fac];return _0x34f9f1;};'use strict';var Sequelize=require(_0xbaf1('0x0'));var moment=require(_0xbaf1('0x1'));module[_0xbaf1('0x2')]={'type':{'type':Sequelize[_0xbaf1('0x3')](_0xbaf1('0x4'),_0xbaf1('0x5'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0xbaf1('0x6')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0xbaf1('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0xbaf1('0x6')]},'transfereraccountcode':{'type':Sequelize[_0xbaf1('0x6')]},'transferercontext':{'type':Sequelize[_0xbaf1('0x6')]},'transfererexten':{'type':Sequelize[_0xbaf1('0x6')]},'transfererlinkedid':{'type':Sequelize[_0xbaf1('0x6')]},'transfereechannel':{'type':Sequelize[_0xbaf1('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0xbaf1('0x6')]},'transfereecalleridname':{'type':Sequelize[_0xbaf1('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xbaf1('0x6')]},'transfereeconnectedlinename':{'type':Sequelize[_0xbaf1('0x6')]},'transfereeaccountcode':{'type':Sequelize[_0xbaf1('0x6')]},'transfereecontext':{'type':Sequelize[_0xbaf1('0x6')]},'transfereeexten':{'type':Sequelize[_0xbaf1('0x6')]},'transfereelinkedid':{'type':Sequelize[_0xbaf1('0x6')]},'isexternal':{'type':Sequelize[_0xbaf1('0x3')](_0xbaf1('0x7'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x16cf=['Yes','moment','exports','ENUM','attended','STRING'];(function(_0x12f0ca,_0x2f55ee){var _0x58ee45=function(_0x440acc){while(--_0x440acc){_0x12f0ca['push'](_0x12f0ca['shift']());}};_0x58ee45(++_0x2f55ee);}(_0x16cf,0x91));var _0xf16c=function(_0x510291,_0x3dbb74){_0x510291=_0x510291-0x0;var _0x4d2880=_0x16cf[_0x510291];return _0x4d2880;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xf16c('0x0'));module[_0xf16c('0x1')]={'type':{'type':Sequelize[_0xf16c('0x2')]('blind',_0xf16c('0x3'))},'result':{'type':Sequelize[_0xf16c('0x4')]},'transfererchannel':{'type':Sequelize[_0xf16c('0x4')]},'transferercalleridnum':{'type':Sequelize[_0xf16c('0x4')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0xf16c('0x4')]},'transfereraccountcode':{'type':Sequelize[_0xf16c('0x4')]},'transferercontext':{'type':Sequelize[_0xf16c('0x4')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0xf16c('0x4')]},'transfereechannel':{'type':Sequelize[_0xf16c('0x4')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0xf16c('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xf16c('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0xf16c('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0xf16c('0x4')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0xf16c('0x4')]},'transfereelinkedid':{'type':Sequelize[_0xf16c('0x4')]},'isexternal':{'type':Sequelize['ENUM'](_0xf16c('0x5'),'No')},'context':{'type':Sequelize[_0xf16c('0x4')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 0681180..3437019 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 _0xff10=['reject','update','then','destroy','error','stack','name','send','index','VoiceTransferReport','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','options','includeAll','catch','show','params','rawAttributes','include','merge','find','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xff10,0x158));var _0x0ff1=function(_0x2a0689,_0x33a348){_0x2a0689=_0x2a0689-0x0;var _0x23979e=_0xff10[_0x2a0689];return _0x23979e;};'use strict';var emlformat=require(_0x0ff1('0x0'));var rimraf=require(_0x0ff1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0ff1('0x2'));var rp=require(_0x0ff1('0x3'));var moment=require(_0x0ff1('0x4'));var BPromise=require(_0x0ff1('0x5'));var Mustache=require('mustache');var util=require(_0x0ff1('0x6'));var path=require(_0x0ff1('0x7'));var sox=require(_0x0ff1('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0ff1('0x9'));var _=require(_0x0ff1('0xa'));var squel=require(_0x0ff1('0xb'));var crypto=require(_0x0ff1('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0ff1('0xd'));var querystring=require(_0x0ff1('0xe'));var Papa=require(_0x0ff1('0xf'));var Redis=require(_0x0ff1('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0ff1('0x11'));var as=require(_0x0ff1('0x12'));var hardwareService=require(_0x0ff1('0x13'));var logger=require(_0x0ff1('0x14'))(_0x0ff1('0x15'));var utils=require(_0x0ff1('0x16'));var config=require(_0x0ff1('0x17'));var licenseUtil=require(_0x0ff1('0x18'));var db=require(_0x0ff1('0x19'))['db'];function respondWithStatusCode(_0x1003ca,_0x433dcb){_0x433dcb=_0x433dcb||0xcc;return function(_0x31853e){if(_0x31853e){return _0x1003ca[_0x0ff1('0x1a')](_0x433dcb);}return _0x1003ca[_0x0ff1('0x1b')](_0x433dcb)[_0x0ff1('0x1c')]();};}function respondWithResult(_0x4d68bf,_0x380875){_0x380875=_0x380875||0xc8;return function(_0x2cb667){if(_0x2cb667){return _0x4d68bf['status'](_0x380875)[_0x0ff1('0x1d')](_0x2cb667);}};}function respondWithFilteredResult(_0x90ce99,_0x4fd7f6){return function(_0x5f9b7c){if(_0x5f9b7c){var _0x271adb=typeof _0x4fd7f6[_0x0ff1('0x1e')]==='undefined'&&typeof _0x4fd7f6[_0x0ff1('0x1f')]==='undefined';var _0x147617=_0x5f9b7c[_0x0ff1('0x20')];var _0x77769=_0x271adb?0x0:_0x4fd7f6[_0x0ff1('0x1e')];var _0x2e3d70=_0x271adb?_0x5f9b7c['count']:_0x4fd7f6[_0x0ff1('0x1e')]+_0x4fd7f6['limit'];var _0x14d193;if(_0x2e3d70>=_0x147617){_0x2e3d70=_0x147617;_0x14d193=0xc8;}else{_0x14d193=0xce;}_0x90ce99[_0x0ff1('0x1b')](_0x14d193);return _0x90ce99[_0x0ff1('0x21')](_0x0ff1('0x22'),_0x77769+'-'+_0x2e3d70+'/'+_0x147617)[_0x0ff1('0x1d')](_0x5f9b7c);}return null;};}function patchUpdates(_0x4f46ed){return function(_0x4300a1){try{jsonpatch[_0x0ff1('0x23')](_0x4300a1,_0x4f46ed,!![]);}catch(_0x39c2ca){return BPromise[_0x0ff1('0x24')](_0x39c2ca);}return _0x4300a1['save']();};}function saveUpdates(_0x146ec7,_0x7ec58e){return function(_0x30bda1){if(_0x30bda1){return _0x30bda1[_0x0ff1('0x25')](_0x146ec7)[_0x0ff1('0x26')](function(_0x307693){return _0x307693;});}return null;};}function removeEntity(_0x44c0f7,_0x4c576b){return function(_0x3345ca){if(_0x3345ca){return _0x3345ca[_0x0ff1('0x27')]()[_0x0ff1('0x26')](function(){_0x44c0f7[_0x0ff1('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51c8f0,_0x1786e0){return function(_0x33d58a){if(!_0x33d58a){_0x51c8f0[_0x0ff1('0x1a')](0x194);}return _0x33d58a;};}function handleError(_0x338247,_0x4a0710){_0x4a0710=_0x4a0710||0x1f4;return function(_0x4adf14){logger[_0x0ff1('0x28')](_0x4adf14[_0x0ff1('0x29')]);if(_0x4adf14[_0x0ff1('0x2a')]){delete _0x4adf14['name'];}_0x338247[_0x0ff1('0x1b')](_0x4a0710)[_0x0ff1('0x2b')](_0x4adf14);};}exports[_0x0ff1('0x2c')]=function(_0x5c42f6,_0x4c0b84){var _0x18db10={},_0xf547c2={},_0x12ae2f={'count':0x0,'rows':[]};var _0x2a3596=_['map'](db[_0x0ff1('0x2d')]['rawAttributes'],function(_0x3eeb69){return{'name':_0x3eeb69[_0x0ff1('0x2e')],'type':_0x3eeb69[_0x0ff1('0x2f')][_0x0ff1('0x30')]};});_0xf547c2[_0x0ff1('0x31')]=_[_0x0ff1('0x32')](_0x2a3596,_0x0ff1('0x2a'));_0xf547c2[_0x0ff1('0x33')]=_[_0x0ff1('0x34')](_0x5c42f6[_0x0ff1('0x33')]);_0xf547c2[_0x0ff1('0x35')]=_[_0x0ff1('0x36')](_0xf547c2[_0x0ff1('0x31')],_0xf547c2[_0x0ff1('0x33')]);_0x18db10[_0x0ff1('0x37')]=_[_0x0ff1('0x36')](_0xf547c2['model'],qs[_0x0ff1('0x38')](_0x5c42f6[_0x0ff1('0x33')]['fields']));_0x18db10[_0x0ff1('0x37')]=_0x18db10[_0x0ff1('0x37')][_0x0ff1('0x39')]?_0x18db10[_0x0ff1('0x37')]:_0xf547c2['model'];if(!_0x5c42f6[_0x0ff1('0x33')][_0x0ff1('0x3a')](_0x0ff1('0x3b'))){_0x18db10[_0x0ff1('0x1f')]=qs[_0x0ff1('0x1f')](_0x5c42f6[_0x0ff1('0x33')][_0x0ff1('0x1f')]);_0x18db10['offset']=qs[_0x0ff1('0x1e')](_0x5c42f6[_0x0ff1('0x33')]['offset']);}_0x18db10[_0x0ff1('0x3c')]=qs[_0x0ff1('0x3d')](_0x5c42f6['query'][_0x0ff1('0x3d')]);_0x18db10['where']=qs[_0x0ff1('0x35')](_[_0x0ff1('0x3e')](_0x5c42f6[_0x0ff1('0x33')],_0xf547c2[_0x0ff1('0x35')]),_0x2a3596);if(_0x5c42f6[_0x0ff1('0x33')][_0x0ff1('0x3f')]){_0x18db10['where']=_['merge'](_0x18db10[_0x0ff1('0x40')],{'$or':_[_0x0ff1('0x32')](_0x2a3596,function(_0x10b6c2){if(_0x10b6c2[_0x0ff1('0x2f')]!=='VIRTUAL'){var _0x3917ca={};_0x3917ca[_0x10b6c2[_0x0ff1('0x2a')]]={'$like':'%'+_0x5c42f6[_0x0ff1('0x33')][_0x0ff1('0x3f')]+'%'};return _0x3917ca;}})});}_0x18db10=_['merge']({},_0x18db10,_0x5c42f6[_0x0ff1('0x41')]);var _0x2ee924={'where':_0x18db10[_0x0ff1('0x40')]};return db[_0x0ff1('0x2d')][_0x0ff1('0x20')](_0x2ee924)[_0x0ff1('0x26')](function(_0x549069){_0x12ae2f[_0x0ff1('0x20')]=_0x549069;if(_0x5c42f6[_0x0ff1('0x33')][_0x0ff1('0x42')]){_0x18db10['include']=[{'all':!![]}];}return db[_0x0ff1('0x2d')]['findAll'](_0x18db10);})['then'](function(_0x21c5e6){_0x12ae2f['rows']=_0x21c5e6;return _0x12ae2f;})['then'](respondWithFilteredResult(_0x4c0b84,_0x18db10))[_0x0ff1('0x43')](handleError(_0x4c0b84,null));};exports[_0x0ff1('0x44')]=function(_0x5df797,_0x4d14db){var _0xc750b5={'raw':!![],'where':{'id':_0x5df797[_0x0ff1('0x45')]['id']}},_0x554a3c={};_0x554a3c[_0x0ff1('0x31')]=_[_0x0ff1('0x34')](db[_0x0ff1('0x2d')][_0x0ff1('0x46')]);_0x554a3c['query']=_[_0x0ff1('0x34')](_0x5df797[_0x0ff1('0x33')]);_0x554a3c['filters']=_['intersection'](_0x554a3c[_0x0ff1('0x31')],_0x554a3c[_0x0ff1('0x33')]);_0xc750b5[_0x0ff1('0x37')]=_['intersection'](_0x554a3c[_0x0ff1('0x31')],qs[_0x0ff1('0x38')](_0x5df797['query'][_0x0ff1('0x38')]));_0xc750b5['attributes']=_0xc750b5[_0x0ff1('0x37')][_0x0ff1('0x39')]?_0xc750b5[_0x0ff1('0x37')]:_0x554a3c['model'];if(_0x5df797[_0x0ff1('0x33')][_0x0ff1('0x42')]){_0xc750b5[_0x0ff1('0x47')]=[{'all':!![]}];}_0xc750b5=_[_0x0ff1('0x48')]({},_0xc750b5,_0x5df797[_0x0ff1('0x41')]);return db[_0x0ff1('0x2d')][_0x0ff1('0x49')](_0xc750b5)[_0x0ff1('0x26')](handleEntityNotFound(_0x4d14db,null))['then'](respondWithResult(_0x4d14db,null))[_0x0ff1('0x43')](handleError(_0x4d14db,null));};exports['create']=function(_0x55f596,_0x4f2ed3){return db[_0x0ff1('0x2d')]['create'](_0x55f596[_0x0ff1('0x4a')],{})[_0x0ff1('0x26')](respondWithResult(_0x4f2ed3,0xc9))[_0x0ff1('0x43')](handleError(_0x4f2ed3,null));};exports[_0x0ff1('0x25')]=function(_0x5c2603,_0x13b15a){if(_0x5c2603[_0x0ff1('0x4a')]['id']){delete _0x5c2603[_0x0ff1('0x4a')]['id'];}return db[_0x0ff1('0x2d')][_0x0ff1('0x49')]({'where':{'id':_0x5c2603[_0x0ff1('0x45')]['id']}})['then'](handleEntityNotFound(_0x13b15a,null))[_0x0ff1('0x26')](saveUpdates(_0x5c2603[_0x0ff1('0x4a')],null))['then'](respondWithResult(_0x13b15a,null))['catch'](handleError(_0x13b15a,null));};exports['destroy']=function(_0x4d9e2e,_0x2e4948){return db[_0x0ff1('0x2d')][_0x0ff1('0x49')]({'where':{'id':_0x4d9e2e[_0x0ff1('0x45')]['id']}})[_0x0ff1('0x26')](handleEntityNotFound(_0x2e4948,null))['then'](removeEntity(_0x2e4948,null))['catch'](handleError(_0x2e4948,null));};exports[_0x0ff1('0x4b')]=function(_0x12ca06,_0x6f9a6e){return db[_0x0ff1('0x2d')]['describe']()[_0x0ff1('0x26')](respondWithResult(_0x6f9a6e,null))[_0x0ff1('0x43')](handleError(_0x6f9a6e,null));}; \ No newline at end of file +var _0x40ca=['VoiceTransferReport','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','save','then','destroy','error','stack','name','send','index','map'];(function(_0x27bd59,_0x361211){var _0x15f4dc=function(_0x58e5d3){while(--_0x58e5d3){_0x27bd59['push'](_0x27bd59['shift']());}};_0x15f4dc(++_0x361211);}(_0x40ca,0xf8));var _0xa40c=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x40ca[_0x5b561d];return _0x431060;};'use strict';var emlformat=require(_0xa40c('0x0'));var rimraf=require(_0xa40c('0x1'));var zipdir=require(_0xa40c('0x2'));var jsonpatch=require(_0xa40c('0x3'));var rp=require(_0xa40c('0x4'));var moment=require(_0xa40c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa40c('0x6'));var util=require(_0xa40c('0x7'));var path=require('path');var sox=require(_0xa40c('0x8'));var csv=require(_0xa40c('0x9'));var ejs=require(_0xa40c('0xa'));var fs=require('fs');var fs_extra=require(_0xa40c('0xb'));var _=require(_0xa40c('0xc'));var squel=require(_0xa40c('0xd'));var crypto=require(_0xa40c('0xe'));var jsforce=require(_0xa40c('0xf'));var deskjs=require(_0xa40c('0x10'));var toCsv=require(_0xa40c('0x9'));var querystring=require(_0xa40c('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa40c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa40c('0x13'));var hardwareService=require(_0xa40c('0x14'));var logger=require(_0xa40c('0x15'))(_0xa40c('0x16'));var utils=require(_0xa40c('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xa40c('0x18'));var db=require(_0xa40c('0x19'))['db'];function respondWithStatusCode(_0x40c83c,_0x394b15){_0x394b15=_0x394b15||0xcc;return function(_0x36510){if(_0x36510){return _0x40c83c[_0xa40c('0x1a')](_0x394b15);}return _0x40c83c[_0xa40c('0x1b')](_0x394b15)[_0xa40c('0x1c')]();};}function respondWithResult(_0x5bd60e,_0x2f4f18){_0x2f4f18=_0x2f4f18||0xc8;return function(_0x2fc956){if(_0x2fc956){return _0x5bd60e[_0xa40c('0x1b')](_0x2f4f18)[_0xa40c('0x1d')](_0x2fc956);}};}function respondWithFilteredResult(_0x2c24ac,_0x47429c){return function(_0x3ecf8d){if(_0x3ecf8d){var _0x1a6564=typeof _0x47429c[_0xa40c('0x1e')]===_0xa40c('0x1f')&&typeof _0x47429c['limit']===_0xa40c('0x1f');var _0x56e0c4=_0x3ecf8d[_0xa40c('0x20')];var _0x431c2e=_0x1a6564?0x0:_0x47429c[_0xa40c('0x1e')];var _0x525cf2=_0x1a6564?_0x3ecf8d[_0xa40c('0x20')]:_0x47429c[_0xa40c('0x1e')]+_0x47429c[_0xa40c('0x21')];var _0x30f7d9;if(_0x525cf2>=_0x56e0c4){_0x525cf2=_0x56e0c4;_0x30f7d9=0xc8;}else{_0x30f7d9=0xce;}_0x2c24ac[_0xa40c('0x1b')](_0x30f7d9);return _0x2c24ac[_0xa40c('0x22')]('Content-Range',_0x431c2e+'-'+_0x525cf2+'/'+_0x56e0c4)[_0xa40c('0x1d')](_0x3ecf8d);}return null;};}function patchUpdates(_0x1f2843){return function(_0x4d7833){try{jsonpatch['apply'](_0x4d7833,_0x1f2843,!![]);}catch(_0x2fcc24){return BPromise['reject'](_0x2fcc24);}return _0x4d7833[_0xa40c('0x23')]();};}function saveUpdates(_0x1545b5,_0x3ac570){return function(_0x120734){if(_0x120734){return _0x120734['update'](_0x1545b5)[_0xa40c('0x24')](function(_0x3a1b1b){return _0x3a1b1b;});}return null;};}function removeEntity(_0x504300,_0x25e9ef){return function(_0x3e1a2a){if(_0x3e1a2a){return _0x3e1a2a[_0xa40c('0x25')]()[_0xa40c('0x24')](function(){_0x504300['status'](0xcc)[_0xa40c('0x1c')]();});}};}function handleEntityNotFound(_0x3b2384,_0x113744){return function(_0x3981ca){if(!_0x3981ca){_0x3b2384['sendStatus'](0x194);}return _0x3981ca;};}function handleError(_0x1e85b,_0x402337){_0x402337=_0x402337||0x1f4;return function(_0x40f595){logger[_0xa40c('0x26')](_0x40f595[_0xa40c('0x27')]);if(_0x40f595[_0xa40c('0x28')]){delete _0x40f595[_0xa40c('0x28')];}_0x1e85b[_0xa40c('0x1b')](_0x402337)[_0xa40c('0x29')](_0x40f595);};}exports[_0xa40c('0x2a')]=function(_0x4faecb,_0x2f1b93){var _0x1c5da2={},_0x429795={},_0x35963a={'count':0x0,'rows':[]};var _0x5e83ac=_[_0xa40c('0x2b')](db[_0xa40c('0x2c')][_0xa40c('0x2d')],function(_0x1802ea){return{'name':_0x1802ea['fieldName'],'type':_0x1802ea[_0xa40c('0x2e')][_0xa40c('0x2f')]};});_0x429795[_0xa40c('0x30')]=_[_0xa40c('0x2b')](_0x5e83ac,_0xa40c('0x28'));_0x429795[_0xa40c('0x31')]=_[_0xa40c('0x32')](_0x4faecb[_0xa40c('0x31')]);_0x429795[_0xa40c('0x33')]=_['intersection'](_0x429795[_0xa40c('0x30')],_0x429795[_0xa40c('0x31')]);_0x1c5da2['attributes']=_[_0xa40c('0x34')](_0x429795['model'],qs['fields'](_0x4faecb[_0xa40c('0x31')][_0xa40c('0x35')]));_0x1c5da2[_0xa40c('0x36')]=_0x1c5da2[_0xa40c('0x36')][_0xa40c('0x37')]?_0x1c5da2['attributes']:_0x429795[_0xa40c('0x30')];if(!_0x4faecb[_0xa40c('0x31')][_0xa40c('0x38')]('nolimit')){_0x1c5da2['limit']=qs['limit'](_0x4faecb[_0xa40c('0x31')][_0xa40c('0x21')]);_0x1c5da2[_0xa40c('0x1e')]=qs[_0xa40c('0x1e')](_0x4faecb[_0xa40c('0x31')]['offset']);}_0x1c5da2[_0xa40c('0x39')]=qs[_0xa40c('0x3a')](_0x4faecb[_0xa40c('0x31')][_0xa40c('0x3a')]);_0x1c5da2['where']=qs[_0xa40c('0x33')](_['pick'](_0x4faecb['query'],_0x429795[_0xa40c('0x33')]),_0x5e83ac);if(_0x4faecb[_0xa40c('0x31')]['filter']){_0x1c5da2[_0xa40c('0x3b')]=_[_0xa40c('0x3c')](_0x1c5da2['where'],{'$or':_['map'](_0x5e83ac,function(_0x137ed7){if(_0x137ed7[_0xa40c('0x2e')]!==_0xa40c('0x3d')){var _0x307a3a={};_0x307a3a[_0x137ed7[_0xa40c('0x28')]]={'$like':'%'+_0x4faecb[_0xa40c('0x31')]['filter']+'%'};return _0x307a3a;}})});}_0x1c5da2=_[_0xa40c('0x3c')]({},_0x1c5da2,_0x4faecb[_0xa40c('0x3e')]);var _0x46bb66={'where':_0x1c5da2['where']};return db['VoiceTransferReport']['count'](_0x46bb66)[_0xa40c('0x24')](function(_0x2cb91b){_0x35963a[_0xa40c('0x20')]=_0x2cb91b;if(_0x4faecb[_0xa40c('0x31')][_0xa40c('0x3f')]){_0x1c5da2[_0xa40c('0x40')]=[{'all':!![]}];}return db[_0xa40c('0x2c')][_0xa40c('0x41')](_0x1c5da2);})[_0xa40c('0x24')](function(_0x17450b){_0x35963a['rows']=_0x17450b;return _0x35963a;})['then'](respondWithFilteredResult(_0x2f1b93,_0x1c5da2))[_0xa40c('0x42')](handleError(_0x2f1b93,null));};exports['show']=function(_0x3eb284,_0x46a365){var _0x1a0733={'raw':!![],'where':{'id':_0x3eb284[_0xa40c('0x43')]['id']}},_0x5b9286={};_0x5b9286[_0xa40c('0x30')]=_[_0xa40c('0x32')](db['VoiceTransferReport']['rawAttributes']);_0x5b9286[_0xa40c('0x31')]=_[_0xa40c('0x32')](_0x3eb284[_0xa40c('0x31')]);_0x5b9286[_0xa40c('0x33')]=_['intersection'](_0x5b9286[_0xa40c('0x30')],_0x5b9286[_0xa40c('0x31')]);_0x1a0733[_0xa40c('0x36')]=_['intersection'](_0x5b9286[_0xa40c('0x30')],qs[_0xa40c('0x35')](_0x3eb284[_0xa40c('0x31')]['fields']));_0x1a0733['attributes']=_0x1a0733[_0xa40c('0x36')][_0xa40c('0x37')]?_0x1a0733['attributes']:_0x5b9286[_0xa40c('0x30')];if(_0x3eb284[_0xa40c('0x31')][_0xa40c('0x3f')]){_0x1a0733[_0xa40c('0x40')]=[{'all':!![]}];}_0x1a0733=_[_0xa40c('0x3c')]({},_0x1a0733,_0x3eb284[_0xa40c('0x3e')]);return db[_0xa40c('0x2c')][_0xa40c('0x44')](_0x1a0733)[_0xa40c('0x24')](handleEntityNotFound(_0x46a365,null))[_0xa40c('0x24')](respondWithResult(_0x46a365,null))[_0xa40c('0x42')](handleError(_0x46a365,null));};exports[_0xa40c('0x45')]=function(_0x28d7dc,_0x578ef4){return db[_0xa40c('0x2c')]['create'](_0x28d7dc[_0xa40c('0x46')],{})[_0xa40c('0x24')](respondWithResult(_0x578ef4,0xc9))[_0xa40c('0x42')](handleError(_0x578ef4,null));};exports[_0xa40c('0x47')]=function(_0x353820,_0x1cd1f3){if(_0x353820[_0xa40c('0x46')]['id']){delete _0x353820[_0xa40c('0x46')]['id'];}return db[_0xa40c('0x2c')][_0xa40c('0x44')]({'where':{'id':_0x353820['params']['id']}})['then'](handleEntityNotFound(_0x1cd1f3,null))[_0xa40c('0x24')](saveUpdates(_0x353820[_0xa40c('0x46')],null))['then'](respondWithResult(_0x1cd1f3,null))[_0xa40c('0x42')](handleError(_0x1cd1f3,null));};exports[_0xa40c('0x25')]=function(_0x319b22,_0x18ccb6){return db[_0xa40c('0x2c')][_0xa40c('0x44')]({'where':{'id':_0x319b22['params']['id']}})[_0xa40c('0x24')](handleEntityNotFound(_0x18ccb6,null))[_0xa40c('0x24')](removeEntity(_0x18ccb6,null))['catch'](handleError(_0x18ccb6,null));};exports[_0xa40c('0x48')]=function(_0x4e8f1a,_0x19f8a5){return db[_0xa40c('0x2c')][_0xa40c('0x48')]()[_0xa40c('0x24')](respondWithResult(_0x19f8a5,null))['catch'](handleError(_0x19f8a5,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 575f3a7..e01fb01 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 _0xf0a9=['rimraf','../../config/environment','./voiceTransferReport.attributes','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0xe86179,_0x2cd072){var _0x285061=function(_0x5e88d9){while(--_0x5e88d9){_0xe86179['push'](_0xe86179['shift']());}};_0x285061(++_0x2cd072);}(_0xf0a9,0xc6));var _0x9f0a=function(_0x2f40b4,_0x3140c9){_0x2f40b4=_0x2f40b4-0x0;var _0x10c745=_0xf0a9[_0x2f40b4];return _0x10c745;};'use strict';var _=require(_0x9f0a('0x0'));var util=require(_0x9f0a('0x1'));var logger=require(_0x9f0a('0x2'))('api');var moment=require(_0x9f0a('0x3'));var BPromise=require(_0x9f0a('0x4'));var rp=require(_0x9f0a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9f0a('0x6'));var config=require(_0x9f0a('0x7'));var attributes=require(_0x9f0a('0x8'));module['exports']=function(_0x5e659f,_0x1ed58a){return _0x5e659f[_0x9f0a('0x9')](_0x9f0a('0xa'),attributes,{'tableName':_0x9f0a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x386d=['VoiceTransferReport','api','moment','request-promise','rimraf','../../config/environment','exports','define'];(function(_0xc14e2a,_0xa543c5){var _0x25c580=function(_0x58e3e4){while(--_0x58e3e4){_0xc14e2a['push'](_0xc14e2a['shift']());}};_0x25c580(++_0xa543c5);}(_0x386d,0x199));var _0xd386=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x386d[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd386('0x0'));var moment=require(_0xd386('0x1'));var BPromise=require('bluebird');var rp=require(_0xd386('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd386('0x3'));var config=require(_0xd386('0x4'));var attributes=require('./voiceTransferReport.attributes');module[_0xd386('0x5')]=function(_0x55cce5,_0x22f434){return _0x55cce5[_0xd386('0x6')](_0xd386('0x7'),attributes,{'tableName':'report_call_transfer','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 4a11005..1dff5fe 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 _0x1a73=['request','then','info','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','VoiceTransferReport','create','options','raw','CreateVoiceTransferReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2b7577,_0x422c99){var _0x1a7c9b=function(_0x386a67){while(--_0x386a67){_0x2b7577['push'](_0x2b7577['shift']());}};_0x1a7c9b(++_0x422c99);}(_0x1a73,0xeb));var _0x31a7=function(_0xace0af,_0x3a8558){_0xace0af=_0xace0af-0x0;var _0xe6ddb8=_0x1a73[_0xace0af];return _0xe6ddb8;};'use strict';var _=require(_0x31a7('0x0'));var util=require(_0x31a7('0x1'));var moment=require(_0x31a7('0x2'));var BPromise=require(_0x31a7('0x3'));var rs=require(_0x31a7('0x4'));var fs=require('fs');var Redis=require(_0x31a7('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x31a7('0x6'));var logger=require(_0x31a7('0x7'))(_0x31a7('0x8'));var config=require(_0x31a7('0x9'));var jayson=require(_0x31a7('0xa'));var client=jayson[_0x31a7('0xb')][_0x31a7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xda023a,_0x170c27,_0xc6704f){return new BPromise(function(_0x50d419,_0x307210){return client[_0x31a7('0xd')](_0xda023a,_0xc6704f)[_0x31a7('0xe')](function(_0x1c3eb9){logger[_0x31a7('0xf')](_0x31a7('0x10'),_0x170c27,'request\x20sent');logger[_0x31a7('0x11')](_0x31a7('0x12'),_0x170c27,_0x31a7('0x13'),JSON['stringify'](_0x1c3eb9));if(_0x1c3eb9['error']){if(_0x1c3eb9[_0x31a7('0x14')][_0x31a7('0x15')]===0x1f4){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x170c27,_0x1c3eb9['error'][_0x31a7('0x16')]);return _0x307210(_0x1c3eb9[_0x31a7('0x14')]['message']);}logger[_0x31a7('0x14')](_0x31a7('0x10'),_0x170c27,_0x1c3eb9['error'][_0x31a7('0x16')]);return _0x50d419(_0x1c3eb9[_0x31a7('0x14')][_0x31a7('0x16')]);}else{logger[_0x31a7('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0x170c27,'request\x20sent');_0x50d419(_0x1c3eb9[_0x31a7('0x17')]['message']);}})[_0x31a7('0x18')](function(_0x5af955){logger[_0x31a7('0x14')]('VoiceTransferReport,\x20%s,\x20%s',_0x170c27,_0x5af955);_0x307210(_0x5af955);});});}exports['CreateVoiceTransferReport']=function(_0x99703a){var _0x5e7457=this;return new Promise(function(_0x4433a9,_0x550c46){return db[_0x31a7('0x19')][_0x31a7('0x1a')](_0x99703a['body'],{'raw':_0x99703a[_0x31a7('0x1b')]?_0x99703a['options'][_0x31a7('0x1c')]===undefined?!![]:![]:!![]})[_0x31a7('0xe')](function(_0x241ea5){logger[_0x31a7('0xf')](_0x31a7('0x1d'),_0x99703a);logger[_0x31a7('0x11')](_0x31a7('0x1d'),_0x99703a,JSON[_0x31a7('0x1e')](_0x241ea5));_0x4433a9(_0x241ea5);})['catch'](function(_0x23b7ba){logger['error'](_0x31a7('0x1d'),_0x23b7ba[_0x31a7('0x16')],_0x99703a);_0x550c46(_0x5e7457[_0x31a7('0x14')](0x1f4,_0x23b7ba[_0x31a7('0x16')]));});});}; \ No newline at end of file +var _0xa0dc=['raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceTransferReport,\x20%s,\x20%s','message','info','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','options'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0xa0dc,0x1b4));var _0xca0d=function(_0x3adf3a,_0x221d74){_0x3adf3a=_0x3adf3a-0x0;var _0x1f6ec6=_0xa0dc[_0x3adf3a];return _0x1f6ec6;};'use strict';var _=require(_0xca0d('0x0'));var util=require(_0xca0d('0x1'));var moment=require(_0xca0d('0x2'));var BPromise=require(_0xca0d('0x3'));var rs=require(_0xca0d('0x4'));var fs=require('fs');var Redis=require(_0xca0d('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xca0d('0x6'))(_0xca0d('0x7'));var config=require('../../config/environment');var jayson=require(_0xca0d('0x8'));var client=jayson[_0xca0d('0x9')][_0xca0d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1cd387,_0x340cd8,_0x12c147){return new BPromise(function(_0x58438a,_0x2fe6ef){return client[_0xca0d('0xb')](_0x1cd387,_0x12c147)[_0xca0d('0xc')](function(_0x1e4581){logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x340cd8,'request\x20sent');logger[_0xca0d('0xd')](_0xca0d('0xe'),_0x340cd8,_0xca0d('0xf'),JSON[_0xca0d('0x10')](_0x1e4581));if(_0x1e4581['error']){if(_0x1e4581[_0xca0d('0x11')][_0xca0d('0x12')]===0x1f4){logger[_0xca0d('0x11')](_0xca0d('0x13'),_0x340cd8,_0x1e4581[_0xca0d('0x11')]['message']);return _0x2fe6ef(_0x1e4581['error'][_0xca0d('0x14')]);}logger[_0xca0d('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x340cd8,_0x1e4581['error'][_0xca0d('0x14')]);return _0x58438a(_0x1e4581[_0xca0d('0x11')][_0xca0d('0x14')]);}else{logger[_0xca0d('0x15')](_0xca0d('0x13'),_0x340cd8,_0xca0d('0xf'));_0x58438a(_0x1e4581[_0xca0d('0x16')][_0xca0d('0x14')]);}})[_0xca0d('0x17')](function(_0xbebe24){logger[_0xca0d('0x11')](_0xca0d('0x13'),_0x340cd8,_0xbebe24);_0x2fe6ef(_0xbebe24);});});}exports[_0xca0d('0x18')]=function(_0x254eaf){var _0x5dded8=this;return new Promise(function(_0x2673a3,_0x5ed28f){return db[_0xca0d('0x19')][_0xca0d('0x1a')](_0x254eaf['body'],{'raw':_0x254eaf['options']?_0x254eaf[_0xca0d('0x1b')][_0xca0d('0x1c')]===undefined?!![]:![]:!![]})[_0xca0d('0xc')](function(_0x2832ef){logger[_0xca0d('0x15')](_0xca0d('0x18'),_0x254eaf);logger['debug']('CreateVoiceTransferReport',_0x254eaf,JSON['stringify'](_0x2832ef));_0x2673a3(_0x2832ef);})[_0xca0d('0x17')](function(_0x2e7473){logger[_0xca0d('0x11')](_0xca0d('0x18'),_0x2e7473['message'],_0x254eaf);_0x5ed28f(_0x5dded8['error'](0x1f4,_0x2e7473[_0xca0d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 923cb3f..ba8b36c 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(_0xfbaeb5,_0x52b139){var _0x3a86e9=function(_0x23bc3d){while(--_0x23bc3d){_0xfbaeb5['push'](_0xfbaeb5['shift']());}};_0x3a86e9(++_0x52b139);}(_0x0bb5,0x148));var _0x50bb=function(_0x89e262,_0x210fd6){_0x89e262=_0x89e262-0x0;var _0x31e464=_0x0bb5[_0x89e262];return _0x31e464;};'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 _0x00bb=['answer','hold','/unhold','unhold','calls','/transfer','exports','express','Router','../../components/auth/service','post','isAuthenticated','isWebrtcLicence','/hangup','/answer'];(function(_0x271934,_0x236c06){var _0x26db69=function(_0x1c2314){while(--_0x1c2314){_0x271934['push'](_0x271934['shift']());}};_0x26db69(++_0x236c06);}(_0x00bb,0x1d8));var _0xb00b=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x00bb[_0x4fc9e6];return _0x551d28;};'use strict';var express=require(_0xb00b('0x0'));var router=express[_0xb00b('0x1')]();var auth=require(_0xb00b('0x2'));var controller=require('./webbar.controller');router[_0xb00b('0x3')]('/originate',auth[_0xb00b('0x4')](),auth[_0xb00b('0x5')](),controller['originate']);router[_0xb00b('0x3')](_0xb00b('0x6'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller['hangup']);router[_0xb00b('0x3')](_0xb00b('0x7'),auth[_0xb00b('0x4')](),auth[_0xb00b('0x5')](),controller[_0xb00b('0x8')]);router[_0xb00b('0x3')]('/hold',auth['isAuthenticated'](),auth[_0xb00b('0x5')](),controller[_0xb00b('0x9')]);router[_0xb00b('0x3')](_0xb00b('0xa'),auth[_0xb00b('0x4')](),auth['isWebrtcLicence'](),controller[_0xb00b('0xb')]);router['post']('/calls',auth['isAuthenticated'](),auth[_0xb00b('0x5')](),controller[_0xb00b('0xc')]);router[_0xb00b('0x3')](_0xb00b('0xd'),auth[_0xb00b('0x4')](),auth[_0xb00b('0x5')](),controller['transfer']);module[_0xb00b('0xe')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 6fac37c..138c30d 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 _0x750a=['hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','calls\x20fired:','UserId','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','lodash','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','number','string','callNumber\x20is\x20required','sessionId\x20is\x20required','userId\x20is\x20required','emit','log','error','name','send','NotFound','code','message','result','catch','User','findOne','agent','then','all','filter','rows','sessionId','sessionId\x20','\x20not\x20found!','info','originate\x20fired:','body','validate','status','userId','callNumber','callerId','callbackUrl','format','user:%s','webbar:originate','json','hangup','hangup\x20fired:','length','webbar:hangup','answer\x20fired:','entityFound:','webbar:answer','answer\x20executed!','hold'];(function(_0x400cd1,_0x1d7a4f){var _0x53fcbd=function(_0x5415b1){while(--_0x5415b1){_0x400cd1['push'](_0x400cd1['shift']());}};_0x53fcbd(++_0x1d7a4f);}(_0x750a,0x140));var _0xa750=function(_0x1291a2,_0x48fdb9){_0x1291a2=_0x1291a2-0x0;var _0x5e70f2=_0x750a[_0x1291a2];return _0x5e70f2;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0xa750('0x0'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var util=require(_0xa750('0x1'));var BPromise=require(_0xa750('0x2'));var jayson=require(_0xa750('0x3'));var amiClient=jayson[_0xa750('0x4')][_0xa750('0x5')]({'port':0x232a});var logger=require(_0xa750('0x6'))(_0xa750('0x7'));var Redis=require(_0xa750('0x8'));config[_0xa750('0x9')]=_[_0xa750('0xa')](config[_0xa750('0x9')],{'host':_0xa750('0xb'),'port':0x18eb});var io=require(_0xa750('0xc'))(new Redis(config['redis']));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0xa750('0xd'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0xa750('0xe'),'required':[!![],_0xa750('0xf')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0xa750('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0xa750('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0xa750('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xa750('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xa750('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xa750('0xe'),'required':[!![],_0xa750('0x10')]},'transferNumber':{'type':_0xa750('0xe'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0xa750('0xd'),'required':[!![],_0xa750('0x11')]},'sessionId':{'type':_0xa750('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xa750('0xd'),'required':[!![],_0xa750('0x11')]},'sessionId':{'type':_0xa750('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0xa750('0x11')]}});var conferenceValidation=new Schema({'userId':{'type':_0xa750('0xd'),'required':[!![],_0xa750('0x11')]}});function emit(_0x49fe3b,_0x337095,_0x29480c){logger['info'](_0x49fe3b,_0x337095,JSON['stringify'](_0x29480c));io['to'](_0x49fe3b)[_0xa750('0x12')](_0x337095,_0x29480c);}function handleError(_0x5b1e6b){return function(_0x433dbd){console[_0xa750('0x13')]('handleError:',_0x433dbd,_0x433dbd instanceof RangeError);logger[_0xa750('0x14')](_0x433dbd['stack']);if(_0x433dbd instanceof RangeError){if(_0x433dbd['name']){delete _0x433dbd[_0xa750('0x15')];}_0x5b1e6b['status'](0x194)[_0xa750('0x16')](_0x433dbd);}else{if(_0x433dbd['name']){delete _0x433dbd[_0xa750('0x15')];}_0x5b1e6b['status'](0x1f4)[_0xa750('0x16')](_0x433dbd);}};}function checkError(){return function(_0x500922){if(!_0x500922){throw new RangeError(_0xa750('0x17'));}return _0x500922;};}function respondWithRpcPromise(_0x4d1939,_0x52f166){return new BPromise(function(_0xaa9d3e,_0x52da84){var _0x216fbf=amiClient;return _0x216fbf['request'](_0x4d1939,_0x52f166)['then'](function(_0x5b433d){if(_0x5b433d['error']){if(_0x5b433d[_0xa750('0x14')][_0xa750('0x18')]===0x1f4){return _0x52da84(_0x5b433d[_0xa750('0x14')][_0xa750('0x19')]);}return _0xaa9d3e(_0x5b433d[_0xa750('0x14')][_0xa750('0x19')]);}else{_0xaa9d3e(_0x5b433d[_0xa750('0x1a')]);}})[_0xa750('0x1b')](function(_0x3d52b3){_0x52da84(_0x3d52b3);});});}function getAgent(_0x94697a){return db[_0xa750('0x1c')][_0xa750('0x1d')]({'where':{'id':_0x94697a,'role':_0xa750('0x1e')}})[_0xa750('0x1f')](checkError());}function getAgentCheckSession(_0x310e2d,_0x4ffff4){return new BPromise(function(_0x3d3923,_0x35dfc9){var _0x21cd2c=respondWithRpcPromise('VoiceChannels');var _0x35ab53=getAgent(_0x310e2d);Promise[_0xa750('0x20')]([_0x21cd2c,_0x35ab53])[_0xa750('0x1f')](function(_0x1223d2){var _0x579f1c=_0x1223d2[0x0];var _0x297eef=_0x1223d2[0x1];var _0x34d5e9=_[_0xa750('0x21')](_0x579f1c[_0xa750('0x22')],function(_0x2c5253){return _0x2c5253['UserId']==_0x297eef['id']&&_0x2c5253[_0xa750('0x23')]==_0x4ffff4;});if(_0x34d5e9['length']==0x1){_0x3d3923(_0x297eef);}else{_0x35dfc9(new RangeError(_0xa750('0x24')+_0x4ffff4+_0xa750('0x25')));}});});}exports['originate']=function(_0x8b5c2d,_0x6bc25d){logger[_0xa750('0x26')](_0xa750('0x27'),_0x8b5c2d[_0xa750('0x28')]);var _0xe59fe7=originateValidation[_0xa750('0x29')](_0x8b5c2d[_0xa750('0x28')]);if(_0xe59fe7['length']>0x0){return _0x6bc25d[_0xa750('0x2a')](0x190)['json'](_0xe59fe7);}var _0x18d040=_0x8b5c2d[_0xa750('0x28')][_0xa750('0x2b')];var _0x13465a=_0x8b5c2d['body'][_0xa750('0x2c')];var _0xa700fd=_0x8b5c2d['body'][_0xa750('0x2d')];var _0x330710=_0x8b5c2d[_0xa750('0x28')][_0xa750('0x2e')];return getAgent(_0x18d040)['then'](function(_0xf60128){logger['info']('entityFound:',_0xf60128[_0xa750('0x15')]);emit(util[_0xa750('0x2f')](_0xa750('0x30'),_0xf60128['name']),_0xa750('0x31'),{'callNumber':_0x13465a,'callerId':_0xa700fd,'callbackUrl':_0x330710});return _0x6bc25d[_0xa750('0x2a')](0xc8)[_0xa750('0x32')]({'error':![],'message':'originate\x20executed!'});})[_0xa750('0x1b')](handleError(_0x6bc25d));};exports[_0xa750('0x33')]=function(_0x3f3c41,_0x5d402a){logger[_0xa750('0x26')](_0xa750('0x34'),_0x3f3c41[_0xa750('0x28')]);var _0x4b6438=hangupValidation[_0xa750('0x29')](_0x3f3c41[_0xa750('0x28')]);if(_0x4b6438[_0xa750('0x35')]>0x0){return _0x5d402a[_0xa750('0x2a')](0x190)['json'](_0x4b6438);}var _0x4dc0b8=_0x3f3c41[_0xa750('0x28')][_0xa750('0x2b')];var _0x4c614d=_0x3f3c41[_0xa750('0x28')][_0xa750('0x23')];return getAgent(_0x4dc0b8)[_0xa750('0x1f')](function(_0x1166ff){logger[_0xa750('0x26')]('entityFound:',_0x1166ff[_0xa750('0x15')]);emit(util[_0xa750('0x2f')](_0xa750('0x30'),_0x1166ff[_0xa750('0x15')]),_0xa750('0x36'),{'sessionId':_0x4c614d});return _0x5d402a[_0xa750('0x2a')](0xc8)[_0xa750('0x32')]({'error':![],'message':'hangup\x20executed!'});})[_0xa750('0x1b')](handleError(_0x5d402a));};exports['answer']=function(_0x214fa0,_0x4ab922){logger[_0xa750('0x26')](_0xa750('0x37'),_0x214fa0[_0xa750('0x28')]);var _0x1be24e=answerValidation[_0xa750('0x29')](_0x214fa0[_0xa750('0x28')]);if(_0x1be24e[_0xa750('0x35')]>0x0){return _0x4ab922[_0xa750('0x2a')](0x190)[_0xa750('0x32')](_0x1be24e);}var _0x108a1a=_0x214fa0[_0xa750('0x28')][_0xa750('0x2b')];var _0x3ec860=_0x214fa0[_0xa750('0x28')][_0xa750('0x23')];return getAgent(_0x108a1a)[_0xa750('0x1f')](function(_0x25b82c){logger[_0xa750('0x26')](_0xa750('0x38'),_0x25b82c[_0xa750('0x15')]);emit(util['format'](_0xa750('0x30'),_0x25b82c[_0xa750('0x15')]),_0xa750('0x39'),{'sessionId':_0x3ec860});return _0x4ab922[_0xa750('0x2a')](0xc8)[_0xa750('0x32')]({'error':![],'message':_0xa750('0x3a')});})[_0xa750('0x1b')](handleError(_0x4ab922));};exports[_0xa750('0x3b')]=function(_0x3534b1,_0x5635b9){logger[_0xa750('0x26')](_0xa750('0x3c'),_0x3534b1['body']);var _0xb7d7e=holdValidation[_0xa750('0x29')](_0x3534b1[_0xa750('0x28')]);if(_0xb7d7e[_0xa750('0x35')]>0x0){return _0x5635b9[_0xa750('0x2a')](0x190)[_0xa750('0x32')](_0xb7d7e);}var _0x5e7a95=_0x3534b1[_0xa750('0x28')][_0xa750('0x2b')];var _0x6cd49f=_0x3534b1['body'][_0xa750('0x23')];return getAgent(_0x5e7a95)[_0xa750('0x1f')](function(_0x58afd2){logger[_0xa750('0x26')](_0xa750('0x38'),_0x58afd2[_0xa750('0x15')]);emit(util['format'](_0xa750('0x30'),_0x58afd2[_0xa750('0x15')]),_0xa750('0x3d'),{'sessionId':_0x6cd49f});return _0x5635b9[_0xa750('0x2a')](0xc8)['json']({'error':![],'message':_0xa750('0x3e')});})[_0xa750('0x1b')](handleError(_0x5635b9));};exports[_0xa750('0x3f')]=function(_0xed4f88,_0x4ce363){logger[_0xa750('0x26')](_0xa750('0x40'),_0xed4f88['body']);var _0x38aa35=unholdValidation['validate'](_0xed4f88[_0xa750('0x28')]);if(_0x38aa35[_0xa750('0x35')]>0x0){return _0x4ce363['status'](0x190)['json'](_0x38aa35);}var _0x58eba1=_0xed4f88[_0xa750('0x28')][_0xa750('0x2b')];var _0x4ea12b=_0xed4f88[_0xa750('0x28')][_0xa750('0x23')];return getAgent(_0x58eba1)[_0xa750('0x1f')](function(_0x5e69ea){logger['info']('entityFound:',_0x5e69ea['name']);emit(util[_0xa750('0x2f')]('user:%s',_0x5e69ea[_0xa750('0x15')]),_0xa750('0x41'),{'sessionId':_0x4ea12b});return _0x4ce363['status'](0xc8)[_0xa750('0x32')]({'error':![],'message':'unhold\x20executed!'});})[_0xa750('0x1b')](handleError(_0x4ce363));};exports['calls']=function(_0x54788d,_0x5940be){logger['info'](_0xa750('0x42'),_0x5940be[_0xa750('0x28')]);var _0x5f1313=callsValidation['validate'](_0x54788d['body']);if(_0x5f1313[_0xa750('0x35')]>0x0){return _0x5940be[_0xa750('0x2a')](0x190)[_0xa750('0x32')](_0x5f1313);}var _0x45a7da=_0x54788d[_0xa750('0x28')][_0xa750('0x2b')];var _0x599e7e=respondWithRpcPromise('VoiceChannels');var _0x440975=getAgent(_0x45a7da);return Promise[_0xa750('0x20')]([_0x599e7e,_0x440975])[_0xa750('0x1f')](function(_0x11163d){var _0xa8fe=_0x11163d[0x0];var _0x5a3cd5=_0x11163d[0x1];var _0x4030b3=_[_0xa750('0x21')](_0xa8fe[_0xa750('0x22')],function(_0x16b826){return _0x16b826[_0xa750('0x43')]==_0x5a3cd5['id'];});return _0x5940be[_0xa750('0x2a')](0xc8)[_0xa750('0x32')]({'count':_0x4030b3[_0xa750('0x35')],'rows':_0x4030b3});})['catch'](handleError(_0x5940be));};exports[_0xa750('0x44')]=function(_0x1c7713,_0x130297){logger[_0xa750('0x26')](_0xa750('0x45'),_0x1c7713['body']);var _0xcad347=conferenceValidation[_0xa750('0x29')](_0x1c7713[_0xa750('0x28')]);if(_0xcad347[_0xa750('0x35')]>0x0){return _0x130297[_0xa750('0x2a')](0x190)[_0xa750('0x32')](_0xcad347);}var _0x6053de=_0x1c7713[_0xa750('0x28')][_0xa750('0x2b')];return getAgent(_0x6053de)[_0xa750('0x1f')](function(_0x32fd6b){logger[_0xa750('0x26')](_0xa750('0x38'),_0x32fd6b[_0xa750('0x15')]);emit(util[_0xa750('0x2f')](_0xa750('0x30'),_0x32fd6b['name']),_0xa750('0x46'));return _0x130297['status'](0xc8)[_0xa750('0x32')]({'error':![],'message':_0xa750('0x47')});})[_0xa750('0x1b')](handleError(_0x130297));};exports['transfer']=function(_0x18c242,_0x2ed01a){logger[_0xa750('0x26')](_0xa750('0x48'),_0x18c242[_0xa750('0x28')]);var _0x278a58=transferValidation['validate'](_0x18c242[_0xa750('0x28')]);if(_0x278a58[_0xa750('0x35')]>0x0){return _0x2ed01a['status'](0x190)[_0xa750('0x32')](_0x278a58);}var _0x1bdc5e=_0x18c242[_0xa750('0x28')][_0xa750('0x2b')];var _0x3255c7=_0x18c242[_0xa750('0x28')][_0xa750('0x23')];var _0xc0b61b=_0x18c242[_0xa750('0x28')][_0xa750('0x49')];return getAgent(_0x1bdc5e)[_0xa750('0x1f')](function(_0x5d3ae2){logger['info'](_0xa750('0x38'),_0x5d3ae2[_0xa750('0x15')]);emit(util[_0xa750('0x2f')](_0xa750('0x30'),_0x5d3ae2['name']),_0xa750('0x4a'),{'sessionId':_0x3255c7,'transferNumber':_0xc0b61b});return _0x2ed01a[_0xa750('0x2a')](0xc8)[_0xa750('0x32')]({'error':![],'message':_0xa750('0x4b')});})[_0xa750('0x1b')](handleError(_0x2ed01a));}; \ No newline at end of file +var _0x0a12=['send','code','result','agent','then','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','body','validate','json','callerId','callbackUrl','info','entityFound:','webbar:originate','originate\x20executed!','catch','hangup','hangup\x20fired:','userId','user:%s','hangup\x20executed!','answer','answer\x20fired:','format','webbar:answer','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','conference\x20executed!','transferNumber','webbar:transfer','lodash','bluebird','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','socket.io-emitter','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','error','stack','name','status'];(function(_0x31c73a,_0x2fbc87){var _0x27b7ff=function(_0x2758cb){while(--_0x2758cb){_0x31c73a['push'](_0x31c73a['shift']());}};_0x27b7ff(++_0x2fbc87);}(_0x0a12,0xb8));var _0x20a1=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0x0a12[_0x369151];return _0x4292d5;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x20a1('0x0'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var util=require('util');var BPromise=require(_0x20a1('0x1'));var jayson=require('jayson/promise');var amiClient=jayson[_0x20a1('0x2')][_0x20a1('0x3')]({'port':0x232a});var logger=require(_0x20a1('0x4'))(_0x20a1('0x5'));var Redis=require(_0x20a1('0x6'));config[_0x20a1('0x7')]=_[_0x20a1('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x20a1('0x9'))(new Redis(config['redis']));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x20a1('0xa'),'required':[!![],_0x20a1('0xb')]},'callNumber':{'type':_0x20a1('0xc'),'required':[!![],_0x20a1('0xd')]},'callerId':{'type':_0x20a1('0xc')},'callbackUrl':{'type':_0x20a1('0xc')}});var hangupValidation=new Schema({'userId':{'type':_0x20a1('0xa'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x20a1('0xc'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x20a1('0xa'),'required':[!![],_0x20a1('0xb')]},'sessionId':{'type':_0x20a1('0xc'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x20a1('0xa'),'required':[!![],_0x20a1('0xb')]},'sessionId':{'type':'string','required':[!![],_0x20a1('0xe')]},'transferNumber':{'type':_0x20a1('0xc'),'required':[!![],_0x20a1('0xf')]}});var holdValidation=new Schema({'userId':{'type':_0x20a1('0xa'),'required':[!![],_0x20a1('0xb')]},'sessionId':{'type':_0x20a1('0xc'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x20a1('0xa'),'required':[!![],_0x20a1('0xb')]},'sessionId':{'type':_0x20a1('0xc'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x20a1('0xa'),'required':[!![],_0x20a1('0xb')]}});var conferenceValidation=new Schema({'userId':{'type':_0x20a1('0xa'),'required':[!![],_0x20a1('0xb')]}});function emit(_0xec799b,_0x559a97,_0x50d618){logger['info'](_0xec799b,_0x559a97,JSON['stringify'](_0x50d618));io['to'](_0xec799b)['emit'](_0x559a97,_0x50d618);}function handleError(_0x478974){return function(_0x5c00a6){console['log']('handleError:',_0x5c00a6,_0x5c00a6 instanceof RangeError);logger[_0x20a1('0x10')](_0x5c00a6[_0x20a1('0x11')]);if(_0x5c00a6 instanceof RangeError){if(_0x5c00a6[_0x20a1('0x12')]){delete _0x5c00a6[_0x20a1('0x12')];}_0x478974[_0x20a1('0x13')](0x194)[_0x20a1('0x14')](_0x5c00a6);}else{if(_0x5c00a6['name']){delete _0x5c00a6['name'];}_0x478974[_0x20a1('0x13')](0x1f4)[_0x20a1('0x14')](_0x5c00a6);}};}function checkError(){return function(_0x3720c2){if(!_0x3720c2){throw new RangeError('NotFound');}return _0x3720c2;};}function respondWithRpcPromise(_0x5dfb97,_0x1f6669){return new BPromise(function(_0x2969cd,_0x9089cc){var _0x16605d=amiClient;return _0x16605d['request'](_0x5dfb97,_0x1f6669)['then'](function(_0x4e0100){if(_0x4e0100['error']){if(_0x4e0100[_0x20a1('0x10')][_0x20a1('0x15')]===0x1f4){return _0x9089cc(_0x4e0100[_0x20a1('0x10')]['message']);}return _0x2969cd(_0x4e0100[_0x20a1('0x10')]['message']);}else{_0x2969cd(_0x4e0100[_0x20a1('0x16')]);}})['catch'](function(_0x4bed2d){_0x9089cc(_0x4bed2d);});});}function getAgent(_0x47dcab){return db['User']['findOne']({'where':{'id':_0x47dcab,'role':_0x20a1('0x17')}})[_0x20a1('0x18')](checkError());}function getAgentCheckSession(_0x24d1e2,_0xee9dd8){return new BPromise(function(_0x3927b2,_0x26bd09){var _0x5a1352=respondWithRpcPromise(_0x20a1('0x19'));var _0x47877f=getAgent(_0x24d1e2);Promise[_0x20a1('0x1a')]([_0x5a1352,_0x47877f])[_0x20a1('0x18')](function(_0x522a7b){var _0x1c48cf=_0x522a7b[0x0];var _0x5a7c8b=_0x522a7b[0x1];var _0x4148a0=_[_0x20a1('0x1b')](_0x1c48cf[_0x20a1('0x1c')],function(_0x1cdc2c){return _0x1cdc2c[_0x20a1('0x1d')]==_0x5a7c8b['id']&&_0x1cdc2c[_0x20a1('0x1e')]==_0xee9dd8;});if(_0x4148a0[_0x20a1('0x1f')]==0x1){_0x3927b2(_0x5a7c8b);}else{_0x26bd09(new RangeError(_0x20a1('0x20')+_0xee9dd8+_0x20a1('0x21')));}});});}exports[_0x20a1('0x22')]=function(_0x49e141,_0x1e6b14){logger['info']('originate\x20fired:',_0x49e141[_0x20a1('0x23')]);var _0x38503f=originateValidation[_0x20a1('0x24')](_0x49e141[_0x20a1('0x23')]);if(_0x38503f['length']>0x0){return _0x1e6b14[_0x20a1('0x13')](0x190)[_0x20a1('0x25')](_0x38503f);}var _0x308e15=_0x49e141[_0x20a1('0x23')]['userId'];var _0x4296be=_0x49e141['body']['callNumber'];var _0x2a65c4=_0x49e141[_0x20a1('0x23')][_0x20a1('0x26')];var _0x1a425f=_0x49e141['body'][_0x20a1('0x27')];return getAgent(_0x308e15)[_0x20a1('0x18')](function(_0x4989c1){logger[_0x20a1('0x28')](_0x20a1('0x29'),_0x4989c1[_0x20a1('0x12')]);emit(util['format']('user:%s',_0x4989c1[_0x20a1('0x12')]),_0x20a1('0x2a'),{'callNumber':_0x4296be,'callerId':_0x2a65c4,'callbackUrl':_0x1a425f});return _0x1e6b14[_0x20a1('0x13')](0xc8)[_0x20a1('0x25')]({'error':![],'message':_0x20a1('0x2b')});})[_0x20a1('0x2c')](handleError(_0x1e6b14));};exports[_0x20a1('0x2d')]=function(_0x27927a,_0x4a811d){logger[_0x20a1('0x28')](_0x20a1('0x2e'),_0x27927a[_0x20a1('0x23')]);var _0x2cbdc6=hangupValidation[_0x20a1('0x24')](_0x27927a['body']);if(_0x2cbdc6[_0x20a1('0x1f')]>0x0){return _0x4a811d['status'](0x190)[_0x20a1('0x25')](_0x2cbdc6);}var _0x21f8b7=_0x27927a['body'][_0x20a1('0x2f')];var _0x55120d=_0x27927a[_0x20a1('0x23')]['sessionId'];return getAgent(_0x21f8b7)['then'](function(_0xe1b39b){logger[_0x20a1('0x28')](_0x20a1('0x29'),_0xe1b39b[_0x20a1('0x12')]);emit(util['format'](_0x20a1('0x30'),_0xe1b39b[_0x20a1('0x12')]),'webbar:hangup',{'sessionId':_0x55120d});return _0x4a811d[_0x20a1('0x13')](0xc8)[_0x20a1('0x25')]({'error':![],'message':_0x20a1('0x31')});})[_0x20a1('0x2c')](handleError(_0x4a811d));};exports[_0x20a1('0x32')]=function(_0x51f8f2,_0x475c5d){logger[_0x20a1('0x28')](_0x20a1('0x33'),_0x51f8f2['body']);var _0x8fac61=answerValidation[_0x20a1('0x24')](_0x51f8f2['body']);if(_0x8fac61[_0x20a1('0x1f')]>0x0){return _0x475c5d['status'](0x190)['json'](_0x8fac61);}var _0x55133c=_0x51f8f2['body'][_0x20a1('0x2f')];var _0x29968a=_0x51f8f2['body']['sessionId'];return getAgent(_0x55133c)['then'](function(_0x37118d){logger[_0x20a1('0x28')](_0x20a1('0x29'),_0x37118d['name']);emit(util[_0x20a1('0x34')](_0x20a1('0x30'),_0x37118d[_0x20a1('0x12')]),_0x20a1('0x35'),{'sessionId':_0x29968a});return _0x475c5d[_0x20a1('0x13')](0xc8)['json']({'error':![],'message':'answer\x20executed!'});})['catch'](handleError(_0x475c5d));};exports[_0x20a1('0x36')]=function(_0x183507,_0x5c1fe3){logger[_0x20a1('0x28')](_0x20a1('0x37'),_0x183507[_0x20a1('0x23')]);var _0x49a6fe=holdValidation[_0x20a1('0x24')](_0x183507['body']);if(_0x49a6fe[_0x20a1('0x1f')]>0x0){return _0x5c1fe3[_0x20a1('0x13')](0x190)['json'](_0x49a6fe);}var _0x40fcf7=_0x183507[_0x20a1('0x23')]['userId'];var _0xb11b6f=_0x183507[_0x20a1('0x23')]['sessionId'];return getAgent(_0x40fcf7)[_0x20a1('0x18')](function(_0x85cbfd){logger[_0x20a1('0x28')]('entityFound:',_0x85cbfd[_0x20a1('0x12')]);emit(util[_0x20a1('0x34')](_0x20a1('0x30'),_0x85cbfd['name']),_0x20a1('0x38'),{'sessionId':_0xb11b6f});return _0x5c1fe3['status'](0xc8)[_0x20a1('0x25')]({'error':![],'message':_0x20a1('0x39')});})[_0x20a1('0x2c')](handleError(_0x5c1fe3));};exports[_0x20a1('0x3a')]=function(_0x19bb8d,_0x2c2363){logger[_0x20a1('0x28')]('unhold\x20fired:',_0x19bb8d[_0x20a1('0x23')]);var _0x2a4eb3=unholdValidation['validate'](_0x19bb8d[_0x20a1('0x23')]);if(_0x2a4eb3['length']>0x0){return _0x2c2363[_0x20a1('0x13')](0x190)[_0x20a1('0x25')](_0x2a4eb3);}var _0x57f1f9=_0x19bb8d[_0x20a1('0x23')][_0x20a1('0x2f')];var _0x1f988c=_0x19bb8d[_0x20a1('0x23')][_0x20a1('0x1e')];return getAgent(_0x57f1f9)[_0x20a1('0x18')](function(_0x1686d7){logger[_0x20a1('0x28')](_0x20a1('0x29'),_0x1686d7['name']);emit(util[_0x20a1('0x34')](_0x20a1('0x30'),_0x1686d7[_0x20a1('0x12')]),_0x20a1('0x3b'),{'sessionId':_0x1f988c});return _0x2c2363['status'](0xc8)[_0x20a1('0x25')]({'error':![],'message':_0x20a1('0x3c')});})['catch'](handleError(_0x2c2363));};exports[_0x20a1('0x3d')]=function(_0x57126d,_0xfbcadd){logger[_0x20a1('0x28')](_0x20a1('0x3e'),_0xfbcadd[_0x20a1('0x23')]);var _0x12c17c=callsValidation[_0x20a1('0x24')](_0x57126d[_0x20a1('0x23')]);if(_0x12c17c[_0x20a1('0x1f')]>0x0){return _0xfbcadd[_0x20a1('0x13')](0x190)[_0x20a1('0x25')](_0x12c17c);}var _0x283728=_0x57126d['body'][_0x20a1('0x2f')];var _0x4a12ac=respondWithRpcPromise(_0x20a1('0x19'));var _0x5cf3b4=getAgent(_0x283728);return Promise[_0x20a1('0x1a')]([_0x4a12ac,_0x5cf3b4])[_0x20a1('0x18')](function(_0x2a73cc){var _0x45f6da=_0x2a73cc[0x0];var _0x2fb198=_0x2a73cc[0x1];var _0x442410=_[_0x20a1('0x1b')](_0x45f6da['rows'],function(_0x436500){return _0x436500[_0x20a1('0x1d')]==_0x2fb198['id'];});return _0xfbcadd['status'](0xc8)[_0x20a1('0x25')]({'count':_0x442410[_0x20a1('0x1f')],'rows':_0x442410});})[_0x20a1('0x2c')](handleError(_0xfbcadd));};exports[_0x20a1('0x3f')]=function(_0x38efae,_0x6e85d){logger[_0x20a1('0x28')](_0x20a1('0x40'),_0x38efae[_0x20a1('0x23')]);var _0x4eae72=conferenceValidation[_0x20a1('0x24')](_0x38efae['body']);if(_0x4eae72[_0x20a1('0x1f')]>0x0){return _0x6e85d[_0x20a1('0x13')](0x190)[_0x20a1('0x25')](_0x4eae72);}var _0x1c3d8a=_0x38efae['body'][_0x20a1('0x2f')];return getAgent(_0x1c3d8a)[_0x20a1('0x18')](function(_0x3363a8){logger[_0x20a1('0x28')](_0x20a1('0x29'),_0x3363a8[_0x20a1('0x12')]);emit(util[_0x20a1('0x34')](_0x20a1('0x30'),_0x3363a8[_0x20a1('0x12')]),'webbar:conference');return _0x6e85d[_0x20a1('0x13')](0xc8)[_0x20a1('0x25')]({'error':![],'message':_0x20a1('0x41')});})[_0x20a1('0x2c')](handleError(_0x6e85d));};exports['transfer']=function(_0x4d3f32,_0x240044){logger[_0x20a1('0x28')]('transfer\x20fired:',_0x4d3f32[_0x20a1('0x23')]);var _0x1689f9=transferValidation[_0x20a1('0x24')](_0x4d3f32[_0x20a1('0x23')]);if(_0x1689f9[_0x20a1('0x1f')]>0x0){return _0x240044['status'](0x190)['json'](_0x1689f9);}var _0x221b0a=_0x4d3f32[_0x20a1('0x23')][_0x20a1('0x2f')];var _0x4cc007=_0x4d3f32[_0x20a1('0x23')][_0x20a1('0x1e')];var _0x1e8abe=_0x4d3f32[_0x20a1('0x23')][_0x20a1('0x42')];return getAgent(_0x221b0a)['then'](function(_0x1fb621){logger['info']('entityFound:',_0x1fb621[_0x20a1('0x12')]);emit(util[_0x20a1('0x34')]('user:%s',_0x1fb621[_0x20a1('0x12')]),_0x20a1('0x43'),{'sessionId':_0x4cc007,'transferNumber':_0x1e8abe});return _0x240044[_0x20a1('0x13')](0xc8)['json']({'error':![],'message':'transfer\x20executed!'});})[_0x20a1('0x2c')](handleError(_0x240044));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index d21d1b9..e0d593c 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 _0xb016=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/users','getApplications','addAnswer','post','addAgents','/:id/applications','addApplications','/:id/notify','notify','/:id/send','send','put','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','express','fs-extra','../../components/auth/service'];(function(_0x3e51ff,_0x38babe){var _0x45b5e1=function(_0x3c1008){while(--_0x3c1008){_0x3e51ff['push'](_0x3e51ff['shift']());}};_0x45b5e1(++_0x38babe);}(_0xb016,0x159));var _0x6b01=function(_0x5e9c5f,_0x4649ed){_0x5e9c5f=_0x5e9c5f-0x0;var _0x4bff58=_0xb016[_0x5e9c5f];return _0x4bff58;};'use strict';var multer=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6b01('0x2'));var router=express['Router']();var fs_extra=require(_0x6b01('0x3'));var auth=require(_0x6b01('0x4'));var interaction=require(_0x6b01('0x5'));var config=require(_0x6b01('0x6'));var controller=require('./whatsappAccount.controller');router[_0x6b01('0x7')]('/',auth[_0x6b01('0x8')](),controller[_0x6b01('0x9')]);router['get']('/describe',auth[_0x6b01('0x8')](),controller[_0x6b01('0xa')]);router['get']('/:id',auth[_0x6b01('0x8')](),controller[_0x6b01('0xb')]);router[_0x6b01('0x7')](_0x6b01('0xc'),auth[_0x6b01('0x8')](),controller['getDispositions']);router['get'](_0x6b01('0xd'),auth[_0x6b01('0x8')](),controller[_0x6b01('0xe')]);router['get'](_0x6b01('0xf'),auth['isAuthenticated'](),controller['getAgents']);router[_0x6b01('0x7')]('/:id/applications',auth[_0x6b01('0x8')](),controller[_0x6b01('0x10')]);router['post']('/',auth[_0x6b01('0x8')](),controller['create']);router['post']('/:id/dispositions',auth[_0x6b01('0x8')](),controller['addDisposition']);router['post'](_0x6b01('0xd'),auth[_0x6b01('0x8')](),controller[_0x6b01('0x11')]);router[_0x6b01('0x12')](_0x6b01('0xf'),auth[_0x6b01('0x8')](),controller[_0x6b01('0x13')]);router[_0x6b01('0x12')](_0x6b01('0x14'),auth[_0x6b01('0x8')](),controller[_0x6b01('0x15')]);router['post'](_0x6b01('0x16'),controller[_0x6b01('0x17')]);router[_0x6b01('0x12')](_0x6b01('0x18'),auth[_0x6b01('0x8')](),controller[_0x6b01('0x19')]);router[_0x6b01('0x1a')](_0x6b01('0x1b'),auth['isAuthenticated'](),controller[_0x6b01('0x1c')]);router[_0x6b01('0x1d')](_0x6b01('0x1b'),auth[_0x6b01('0x8')](),controller[_0x6b01('0x1e')]);router[_0x6b01('0x1d')](_0x6b01('0xc'),auth['isAuthenticated'](),controller[_0x6b01('0x1f')]);router[_0x6b01('0x1d')](_0x6b01('0xd'),auth['isAuthenticated'](),controller[_0x6b01('0x20')]);router[_0x6b01('0x1d')](_0x6b01('0xf'),auth[_0x6b01('0x8')](),controller[_0x6b01('0x21')]);module[_0x6b01('0x22')]=router; \ No newline at end of file +var _0xfcf0=['/:id/applications','getApplications','post','addAnswer','/:id/users','addAgents','addApplications','notify','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getAgents'];(function(_0x3d2cec,_0x1437f0){var _0x2bed37=function(_0x4e8413){while(--_0x4e8413){_0x3d2cec['push'](_0x3d2cec['shift']());}};_0x2bed37(++_0x1437f0);}(_0xfcf0,0x138));var _0x0fcf=function(_0x3239f5,_0x50e77c){_0x3239f5=_0x3239f5-0x0;var _0x3559c8=_0xfcf0[_0x3239f5];return _0x3559c8;};'use strict';var multer=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var path=require('path');var timeout=require(_0x0fcf('0x2'));var express=require(_0x0fcf('0x3'));var router=express[_0x0fcf('0x4')]();var fs_extra=require(_0x0fcf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0fcf('0x6'));var config=require(_0x0fcf('0x7'));var controller=require(_0x0fcf('0x8'));router[_0x0fcf('0x9')]('/',auth[_0x0fcf('0xa')](),controller[_0x0fcf('0xb')]);router[_0x0fcf('0x9')](_0x0fcf('0xc'),auth['isAuthenticated'](),controller[_0x0fcf('0xd')]);router[_0x0fcf('0x9')](_0x0fcf('0xe'),auth['isAuthenticated'](),controller[_0x0fcf('0xf')]);router[_0x0fcf('0x9')](_0x0fcf('0x10'),auth['isAuthenticated'](),controller[_0x0fcf('0x11')]);router['get'](_0x0fcf('0x12'),auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x13')]);router['get']('/:id/users',auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x14')]);router['get'](_0x0fcf('0x15'),auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x16')]);router[_0x0fcf('0x17')]('/',auth[_0x0fcf('0xa')](),controller['create']);router[_0x0fcf('0x17')](_0x0fcf('0x10'),auth[_0x0fcf('0xa')](),controller['addDisposition']);router[_0x0fcf('0x17')](_0x0fcf('0x12'),auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x18')]);router['post'](_0x0fcf('0x19'),auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x1a')]);router[_0x0fcf('0x17')](_0x0fcf('0x15'),auth['isAuthenticated'](),controller[_0x0fcf('0x1b')]);router[_0x0fcf('0x17')]('/:id/notify',controller[_0x0fcf('0x1c')]);router[_0x0fcf('0x17')]('/:id/send',auth[_0x0fcf('0xa')](),controller['send']);router[_0x0fcf('0x1d')](_0x0fcf('0xe'),auth['isAuthenticated'](),controller[_0x0fcf('0x1e')]);router[_0x0fcf('0x1f')](_0x0fcf('0xe'),auth['isAuthenticated'](),controller[_0x0fcf('0x20')]);router[_0x0fcf('0x1f')](_0x0fcf('0x10'),auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x21')]);router[_0x0fcf('0x1f')]('/:id/canned_answers',auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x22')]);router[_0x0fcf('0x1f')](_0x0fcf('0x19'),auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x23')]);module[_0x0fcf('0x24')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index ba3e1a0..be63c0f 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 _0x69b0=['sequelize','exports','STRING','name','generate','ENUM','sinch','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x1cc299,_0x54b849){var _0x55fa0a=function(_0x27ebc8){while(--_0x27ebc8){_0x1cc299['push'](_0x1cc299['shift']());}};_0x55fa0a(++_0x54b849);}(_0x69b0,0x1a4));var _0x069b=function(_0x3439ea,_0x3c68ba){_0x3439ea=_0x3439ea-0x0;var _0x3900a3=_0x69b0[_0x3439ea];return _0x3900a3;};'use strict';var Sequelize=require(_0x069b('0x0'));var rs=require('randomstring');module[_0x069b('0x1')]={'name':{'type':Sequelize[_0x069b('0x2')],'unique':_0x069b('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x069b('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x069b('0x2')],'defaultValue':function(){return rs[_0x069b('0x4')]();}},'phone':{'type':Sequelize[_0x069b('0x2')]},'type':{'type':Sequelize[_0x069b('0x5')]('twilio',_0x069b('0x6'))},'accountSid':{'type':Sequelize[_0x069b('0x2')]},'baseUrl':{'type':Sequelize[_0x069b('0x2')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x069b('0x7');}},'notificationSound':{'type':Sequelize[_0x069b('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x069b('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x069b('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x069b('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x069b('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x069b('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x069b('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x069b('0x9')],'comment':_0x069b('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x069b('0x8')],'defaultValue':![],'comment':_0x069b('0xb'),'set':function(_0x50f2d9){if(!_0x50f2d9){this[_0x069b('0xc')](_0x069b('0xd'),null);}this['setDataValue'](_0x069b('0xe'),_0x50f2d9);}},'description':{'type':Sequelize[_0x069b('0x2')]}}; \ No newline at end of file +var _0xff36=['STRING','generate','ENUM','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','mandatoryDispositionPauseId','setDataValue','sequelize','name'];(function(_0x385706,_0x27cd45){var _0x16aa20=function(_0x14f158){while(--_0x14f158){_0x385706['push'](_0x385706['shift']());}};_0x16aa20(++_0x27cd45);}(_0xff36,0xa6));var _0x6ff3=function(_0x53544e,_0x594fde){_0x53544e=_0x53544e-0x0;var _0x529544=_0xff36[_0x53544e];return _0x529544;};'use strict';var Sequelize=require(_0x6ff3('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x6ff3('0x1'),'allowNull':![]},'key':{'type':Sequelize[_0x6ff3('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x6ff3('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x6ff3('0x2')],'defaultValue':function(){return rs[_0x6ff3('0x3')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x6ff3('0x4')]('twilio',_0x6ff3('0x5'))},'accountSid':{'type':Sequelize[_0x6ff3('0x2')]},'baseUrl':{'type':Sequelize[_0x6ff3('0x2')]},'authToken':{'type':Sequelize[_0x6ff3('0x2')]},'notificationTemplate':{'type':Sequelize[_0x6ff3('0x6')],'defaultValue':function(){return _0x6ff3('0x7');}},'notificationSound':{'type':Sequelize[_0x6ff3('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x6ff3('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6ff3('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6ff3('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6ff3('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6ff3('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6ff3('0x9')],'comment':_0x6ff3('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x6ff3('0x8')],'defaultValue':![],'comment':_0x6ff3('0xb'),'set':function(_0x5756d8){if(!_0x5756d8){this['setDataValue'](_0x6ff3('0xc'),null);}this[_0x6ff3('0xd')]('mandatoryDisposition',_0x5756d8);}},'description':{'type':Sequelize[_0x6ff3('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 0b43d1d..2dfbc72 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 _0x937f=['crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','jayson/promise','client','http','request','debug','request\x20sent','stringify','code','WhatsappAccount,\x20%s,\x20%s','error','message','info','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','destroy','then','get','WhatsappAccounts','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','WhatsappAccount','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','Disposition','nolimit','pick','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addAgents','omit','spread','userWhatsappAccount:save','removeAgents','isArray','emit','userWhatsappAccount:remove','getAgents','User','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','priority','stack','finally','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','WhatsappMessage','timestamp','message_id','applications','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','From','replace','whatsapp:','Body','messageId','MessageSid','from','notifications','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','Contacts','contact','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','unshift','agent','startRouting','Start','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','eml-format','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x264183,_0x5b8e62){var _0x1f9e19=function(_0x4e25e7){while(--_0x4e25e7){_0x264183['push'](_0x264183['shift']());}};_0x1f9e19(++_0x5b8e62);}(_0x937f,0x187));var _0xf937=function(_0x16883e,_0x154b07){_0x16883e=_0x16883e-0x0;var _0x29cd6a=_0x937f[_0x16883e];return _0x29cd6a;};'use strict';var emlformat=require(_0xf937('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf937('0x1'));var rp=require(_0xf937('0x2'));var moment=require(_0xf937('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf937('0x4'));var path=require(_0xf937('0x5'));var sox=require('sox');var csv=require(_0xf937('0x6'));var ejs=require(_0xf937('0x7'));var fs=require('fs');var fs_extra=require(_0xf937('0x8'));var _=require(_0xf937('0x9'));var squel=require(_0xf937('0xa'));var crypto=require(_0xf937('0xb'));var jsforce=require(_0xf937('0xc'));var deskjs=require(_0xf937('0xd'));var toCsv=require(_0xf937('0x6'));var querystring=require(_0xf937('0xe'));var Papa=require('papaparse');var Redis=require(_0xf937('0xf'));var authService=require(_0xf937('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf937('0x11'));var logger=require(_0xf937('0x12'))(_0xf937('0x13'));var utils=require(_0xf937('0x14'));var config=require(_0xf937('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xf937('0x16'))['db'];config['redis']=_[_0xf937('0x17')](config[_0xf937('0x18')],{'host':_0xf937('0x19'),'port':0x18eb});var socket=require(_0xf937('0x1a'))(new Redis(config[_0xf937('0x18')]));require('./whatsappAccount.socket')['register'](socket);var jayson=require(_0xf937('0x1b'));var client=jayson[_0xf937('0x1c')][_0xf937('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0xccb552,_0x1c40f6,_0x547d0f,_0x2f0377){return new BPromise(function(_0x154a5e,_0x2368aa){var _0x4f26df=_0x2f0377||client;return _0x4f26df[_0xf937('0x1e')](_0xccb552,_0x547d0f)['then'](function(_0x1b9c2d){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x1c40f6,'request\x20sent');logger[_0xf937('0x1f')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x1c40f6,_0xf937('0x20'),JSON[_0xf937('0x21')](_0x1b9c2d));if(_0x1b9c2d['error']){if(_0x1b9c2d['error'][_0xf937('0x22')]===0x1f4){logger['error'](_0xf937('0x23'),_0x1c40f6,_0x1b9c2d[_0xf937('0x24')][_0xf937('0x25')]);return _0x2368aa(_0x1b9c2d[_0xf937('0x24')][_0xf937('0x25')]);}logger[_0xf937('0x24')](_0xf937('0x23'),_0x1c40f6,_0x1b9c2d[_0xf937('0x24')][_0xf937('0x25')]);return _0x154a5e(_0x1b9c2d[_0xf937('0x24')][_0xf937('0x25')]);}else{logger[_0xf937('0x26')](_0xf937('0x23'),_0x1c40f6,_0xf937('0x20'));_0x154a5e(_0x1b9c2d[_0xf937('0x27')][_0xf937('0x25')]);}})[_0xf937('0x28')](function(_0xa7f99a){logger[_0xf937('0x24')](_0xf937('0x23'),_0x1c40f6,_0xa7f99a);_0x2368aa(_0xa7f99a);});});}function respondWithStatusCode(_0x17b17e,_0x30b41d){_0x30b41d=_0x30b41d||0xcc;return function(_0x3b3edf){if(_0x3b3edf){return _0x17b17e[_0xf937('0x29')](_0x30b41d);}return _0x17b17e[_0xf937('0x2a')](_0x30b41d)[_0xf937('0x2b')]();};}function respondWithResult(_0x3bf053,_0x3aa015){_0x3aa015=_0x3aa015||0xc8;return function(_0x19dd3d){if(_0x19dd3d){return _0x3bf053[_0xf937('0x2a')](_0x3aa015)['json'](_0x19dd3d);}};}function respondWithFilteredResult(_0x1d7dd8,_0x1e8ae7){return function(_0x5ecfc3){if(_0x5ecfc3){var _0x129f54=typeof _0x1e8ae7[_0xf937('0x2c')]===_0xf937('0x2d')&&typeof _0x1e8ae7[_0xf937('0x2e')]===_0xf937('0x2d');var _0x164638=_0x5ecfc3[_0xf937('0x2f')];var _0x39846a=_0x129f54?0x0:_0x1e8ae7[_0xf937('0x2c')];var _0xd6d851=_0x129f54?_0x5ecfc3[_0xf937('0x2f')]:_0x1e8ae7[_0xf937('0x2c')]+_0x1e8ae7[_0xf937('0x2e')];var _0x1dee89;if(_0xd6d851>=_0x164638){_0xd6d851=_0x164638;_0x1dee89=0xc8;}else{_0x1dee89=0xce;}_0x1d7dd8['status'](_0x1dee89);return _0x1d7dd8[_0xf937('0x30')](_0xf937('0x31'),_0x39846a+'-'+_0xd6d851+'/'+_0x164638)[_0xf937('0x32')](_0x5ecfc3);}return null;};}function patchUpdates(_0x27c4a6){return function(_0x8ce5e1){try{jsonpatch[_0xf937('0x33')](_0x8ce5e1,_0x27c4a6,!![]);}catch(_0x20e497){return BPromise['reject'](_0x20e497);}return _0x8ce5e1[_0xf937('0x34')]();};}function saveUpdates(_0x3fe6a9,_0x41eef4){return function(_0x48cc14){if(_0x48cc14){return _0x48cc14[_0xf937('0x35')](_0x3fe6a9)['then'](function(_0x5601d4){return _0x5601d4;});}return null;};}function removeEntity(_0x3cb6d3,_0xeb8619){return function(_0x4ea0f2){if(_0x4ea0f2){return _0x4ea0f2[_0xf937('0x36')]()[_0xf937('0x37')](function(){var _0x51c1f8=_0x4ea0f2[_0xf937('0x38')]({'plain':!![]});var _0x492a80=_0xf937('0x39');return db[_0xf937('0x3a')][_0xf937('0x36')]({'where':{'type':_0x492a80,'resourceId':_0x51c1f8['id']}})[_0xf937('0x37')](function(){return _0x4ea0f2;});})['then'](function(){_0x3cb6d3[_0xf937('0x2a')](0xcc)[_0xf937('0x2b')]();});}};}function handleEntityNotFound(_0x27c89f,_0x3b7687){return function(_0x18850f){if(!_0x18850f){_0x27c89f['sendStatus'](0x194);}return _0x18850f;};}function handleError(_0x584528,_0x40553a){_0x40553a=_0x40553a||0x1f4;return function(_0x39137e){logger['error'](_0x39137e['stack']);if(_0x39137e[_0xf937('0x3b')]){delete _0x39137e[_0xf937('0x3b')];}_0x584528[_0xf937('0x2a')](_0x40553a)[_0xf937('0x3c')](_0x39137e);};}exports[_0xf937('0x3d')]=function(_0x26a1a2,_0x3b2c14){var _0x2b83da={'include':[{'model':db[_0xf937('0x3e')],'as':_0xf937('0x3f')}]},_0x31ff98={},_0x311987={'count':0x0,'rows':[]};var _0x254ba0=_['map'](db[_0xf937('0x40')][_0xf937('0x41')],function(_0x2720eb){return{'name':_0x2720eb[_0xf937('0x42')],'type':_0x2720eb['type'][_0xf937('0x43')]};});_0x31ff98[_0xf937('0x44')]=_[_0xf937('0x45')](_0x254ba0,_0xf937('0x3b'));_0x31ff98[_0xf937('0x46')]=_[_0xf937('0x47')](_0x26a1a2[_0xf937('0x46')]);_0x31ff98[_0xf937('0x48')]=_['intersection'](_0x31ff98[_0xf937('0x44')],_0x31ff98['query']);_0x2b83da[_0xf937('0x49')]=_[_0xf937('0x4a')](_0x31ff98[_0xf937('0x44')],qs[_0xf937('0x4b')](_0x26a1a2[_0xf937('0x46')][_0xf937('0x4b')]));_0x2b83da[_0xf937('0x49')]=_0x2b83da[_0xf937('0x49')]['length']?_0x2b83da['attributes']:_0x31ff98[_0xf937('0x44')];if(!_0x26a1a2[_0xf937('0x46')][_0xf937('0x4c')]('nolimit')){_0x2b83da[_0xf937('0x2e')]=qs['limit'](_0x26a1a2[_0xf937('0x46')][_0xf937('0x2e')]);_0x2b83da['offset']=qs[_0xf937('0x2c')](_0x26a1a2[_0xf937('0x46')][_0xf937('0x2c')]);}_0x2b83da[_0xf937('0x4d')]=qs[_0xf937('0x4e')](_0x26a1a2[_0xf937('0x46')][_0xf937('0x4e')]);_0x2b83da[_0xf937('0x4f')]=qs[_0xf937('0x48')](_['pick'](_0x26a1a2[_0xf937('0x46')],_0x31ff98[_0xf937('0x48')]),_0x254ba0);if(_0x26a1a2[_0xf937('0x46')]['filter']){_0x2b83da[_0xf937('0x4f')]=_[_0xf937('0x50')](_0x2b83da[_0xf937('0x4f')],{'$or':_[_0xf937('0x45')](_0x254ba0,function(_0x45d98c){if(_0x45d98c[_0xf937('0x51')]!==_0xf937('0x52')){var _0x5a067a={};_0x5a067a[_0x45d98c[_0xf937('0x3b')]]={'$like':'%'+_0x26a1a2[_0xf937('0x46')][_0xf937('0x53')]+'%'};return _0x5a067a;}})});}_0x2b83da=_[_0xf937('0x50')]({},_0x2b83da,_0x26a1a2[_0xf937('0x54')]);var _0x483864={'where':_0x2b83da['where']};return db[_0xf937('0x40')][_0xf937('0x2f')](_0x483864)['then'](function(_0x922088){_0x311987['count']=_0x922088;if(_0x26a1a2[_0xf937('0x46')][_0xf937('0x55')]){_0x2b83da[_0xf937('0x56')]=[{'all':!![]}];}return db['WhatsappAccount'][_0xf937('0x57')](_0x2b83da);})[_0xf937('0x37')](function(_0x583a75){_0x311987['rows']=_0x583a75;return _0x311987;})[_0xf937('0x37')](respondWithFilteredResult(_0x3b2c14,_0x2b83da))['catch'](handleError(_0x3b2c14,null));};exports['show']=function(_0x1ddf89,_0x40bab3){var _0x388b48={'raw':![],'where':{'id':_0x1ddf89[_0xf937('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0xf937('0x3f')}]},_0x5f1f99={};_0x5f1f99['model']=_[_0xf937('0x47')](db[_0xf937('0x40')]['rawAttributes']);_0x5f1f99['query']=_[_0xf937('0x47')](_0x1ddf89['query']);_0x5f1f99['filters']=_[_0xf937('0x4a')](_0x5f1f99[_0xf937('0x44')],_0x5f1f99[_0xf937('0x46')]);_0x388b48[_0xf937('0x49')]=_[_0xf937('0x4a')](_0x5f1f99['model'],qs[_0xf937('0x4b')](_0x1ddf89[_0xf937('0x46')][_0xf937('0x4b')]));_0x388b48[_0xf937('0x49')]=_0x388b48[_0xf937('0x49')][_0xf937('0x59')]?_0x388b48[_0xf937('0x49')]:_0x5f1f99[_0xf937('0x44')];if(_0x1ddf89[_0xf937('0x46')][_0xf937('0x55')]){_0x388b48[_0xf937('0x56')]=[{'all':!![]}];}_0x388b48=_[_0xf937('0x50')]({},_0x388b48,_0x1ddf89[_0xf937('0x54')]);return db[_0xf937('0x40')][_0xf937('0x5a')](_0x388b48)[_0xf937('0x37')](handleEntityNotFound(_0x40bab3,null))[_0xf937('0x37')](respondWithResult(_0x40bab3,null))['catch'](handleError(_0x40bab3,null));};exports['create']=function(_0x45c835,_0x3e1b5b){return db[_0xf937('0x40')][_0xf937('0x5b')](_0x45c835[_0xf937('0x5c')],{})[_0xf937('0x37')](function(_0x24346e){var _0x44032d=_0x45c835[_0xf937('0x5d')][_0xf937('0x38')]({'plain':!![]});if(!_0x44032d)throw new Error(_0xf937('0x5e'));if(_0x44032d[_0xf937('0x5f')]===_0xf937('0x5d')){var _0x49a28f=_0x24346e[_0xf937('0x38')]({'plain':!![]});var _0x479d28=_0xf937('0x39');return db[_0xf937('0x60')]['find']({'where':{'name':_0x479d28,'userProfileId':_0x44032d[_0xf937('0x61')]},'raw':!![]})[_0xf937('0x37')](function(_0x35993a){if(_0x35993a&&_0x35993a['autoAssociation']===0x0){return db['UserProfileResource'][_0xf937('0x5b')]({'name':_0x49a28f[_0xf937('0x3b')],'resourceId':_0x49a28f['id'],'type':_0x35993a['name'],'sectionId':_0x35993a['id']},{})[_0xf937('0x37')](function(){return _0x24346e;});}else{return _0x24346e;}})[_0xf937('0x28')](function(_0x261309){logger[_0xf937('0x24')](_0xf937('0x62'),_0x261309);throw _0x261309;});}return _0x24346e;})[_0xf937('0x37')](respondWithResult(_0x3e1b5b,0xc9))[_0xf937('0x28')](handleError(_0x3e1b5b,null));};exports[_0xf937('0x35')]=function(_0xfd1f97,_0x41c8f4){if(_0xfd1f97[_0xf937('0x5c')]['id']){delete _0xfd1f97[_0xf937('0x5c')]['id'];}return db[_0xf937('0x40')][_0xf937('0x5a')]({'where':{'id':_0xfd1f97['params']['id']},'include':[{'model':db[_0xf937('0x3e')],'as':'mandatoryDispositionPause'}]})[_0xf937('0x37')](handleEntityNotFound(_0x41c8f4,null))[_0xf937('0x37')](saveUpdates(_0xfd1f97['body'],null))[_0xf937('0x37')](respondWithResult(_0x41c8f4,null))[_0xf937('0x28')](handleError(_0x41c8f4,null));};exports[_0xf937('0x36')]=function(_0x34f3a9,_0x53a2d1){return db[_0xf937('0x40')][_0xf937('0x5a')]({'where':{'id':_0x34f3a9['params']['id']}})[_0xf937('0x37')](handleEntityNotFound(_0x53a2d1,null))[_0xf937('0x37')](removeEntity(_0x53a2d1,null))['catch'](handleError(_0x53a2d1,null));};exports[_0xf937('0x63')]=function(_0x4cda23,_0x5101aa){return db[_0xf937('0x40')][_0xf937('0x63')]()[_0xf937('0x37')](respondWithResult(_0x5101aa,null))[_0xf937('0x28')](handleError(_0x5101aa,null));};exports[_0xf937('0x64')]=function(_0xfb991f,_0xfa84b,_0x5dcd1d){if(_0xfb991f['body']['id']){delete _0xfb991f['body']['id'];}return db[_0xf937('0x40')]['find']({'where':{'id':_0xfb991f[_0xf937('0x58')]['id']}})[_0xf937('0x37')](handleEntityNotFound(_0xfa84b,null))[_0xf937('0x37')](function(_0x3cc356){if(_0x3cc356){_0xfb991f[_0xf937('0x5c')][_0xf937('0x65')]=_0x3cc356['id'];return db['Disposition'][_0xf937('0x5b')](_0xfb991f[_0xf937('0x5c')]);}})[_0xf937('0x37')](respondWithResult(_0xfa84b,null))['catch'](handleError(_0xfa84b,null));};exports['getDispositions']=function(_0x420331,_0x1d47ad,_0x236ed9){var _0xfb0398={'raw':![],'where':{}};var _0x45b068={};var _0x2a7c7e={'count':0x0,'rows':[]};return db[_0xf937('0x40')]['findOne']({'where':{'id':_0x420331[_0xf937('0x58')]['id']}})[_0xf937('0x37')](handleEntityNotFound(_0x1d47ad,null))[_0xf937('0x37')](function(_0x35377a){if(_0x35377a){_0x45b068['model']=_['keys'](db[_0xf937('0x66')][_0xf937('0x41')]);_0x45b068[_0xf937('0x46')]=_[_0xf937('0x47')](_0x420331['query']);_0x45b068[_0xf937('0x48')]=_[_0xf937('0x4a')](_0x45b068[_0xf937('0x44')],_0x45b068['query']);_0xfb0398['attributes']=_[_0xf937('0x4a')](_0x45b068[_0xf937('0x44')],qs[_0xf937('0x4b')](_0x420331[_0xf937('0x46')][_0xf937('0x4b')]));_0xfb0398['attributes']=_0xfb0398['attributes'][_0xf937('0x59')]?_0xfb0398['attributes']:_0x45b068['model'];if(!_0x420331[_0xf937('0x46')][_0xf937('0x4c')](_0xf937('0x67'))){_0xfb0398[_0xf937('0x2e')]=qs['limit'](_0x420331[_0xf937('0x46')][_0xf937('0x2e')]);_0xfb0398[_0xf937('0x2c')]=qs[_0xf937('0x2c')](_0x420331[_0xf937('0x46')][_0xf937('0x2c')]);}_0xfb0398[_0xf937('0x4d')]=qs['sort'](_0x420331['query'][_0xf937('0x4e')]);_0xfb0398[_0xf937('0x4f')]=qs['filters'](_[_0xf937('0x68')](_0x420331[_0xf937('0x46')],_0x45b068[_0xf937('0x48')]));_0xfb0398[_0xf937('0x4f')][_0xf937('0x65')]=_0x35377a['id'];if(_0x420331[_0xf937('0x46')][_0xf937('0x53')]){_0xfb0398['where']=_[_0xf937('0x50')](_0xfb0398[_0xf937('0x4f')],{'$or':_['map'](_0xfb0398[_0xf937('0x49')],function(_0x549507){var _0x5f5715={};_0x5f5715[_0x549507]={'$like':'%'+_0x420331['query']['filter']+'%'};return _0x5f5715;})});}_0xfb0398=_[_0xf937('0x50')]({},_0xfb0398,_0x420331[_0xf937('0x54')]);return db[_0xf937('0x66')][_0xf937('0x2f')]({'where':_0xfb0398['where']})[_0xf937('0x37')](function(_0x3d176e){_0x2a7c7e[_0xf937('0x2f')]=_0x3d176e;if(_0x420331[_0xf937('0x46')][_0xf937('0x55')]){_0xfb0398[_0xf937('0x56')]=[{'all':!![]}];}return db[_0xf937('0x66')][_0xf937('0x57')](_0xfb0398);})[_0xf937('0x37')](function(_0x1731bf){_0x2a7c7e[_0xf937('0x69')]=_0x1731bf;return _0x2a7c7e;});}})[_0xf937('0x37')](respondWithFilteredResult(_0x1d47ad,_0xfb0398))[_0xf937('0x28')](handleError(_0x1d47ad,null));};exports[_0xf937('0x6a')]=function(_0x5ddcd4,_0x4f248a,_0x2b2756){return db[_0xf937('0x40')][_0xf937('0x5a')]({'where':{'id':_0x5ddcd4['params']['id']}})[_0xf937('0x37')](handleEntityNotFound(_0x4f248a,null))[_0xf937('0x37')](function(_0x6ceec4){if(_0x6ceec4){return _0x6ceec4[_0xf937('0x6a')](_0x5ddcd4['query'][_0xf937('0x6b')]);}})['then'](respondWithStatusCode(_0x4f248a,null))[_0xf937('0x28')](handleError(_0x4f248a,null));};exports[_0xf937('0x6c')]=function(_0x470f29,_0x551604,_0x147f82){if(_0x470f29[_0xf937('0x5c')]['id']){delete _0x470f29['body']['id'];}return db[_0xf937('0x40')][_0xf937('0x5a')]({'where':{'id':_0x470f29[_0xf937('0x58')]['id']}})[_0xf937('0x37')](handleEntityNotFound(_0x551604,null))[_0xf937('0x37')](function(_0x1fbebf){if(_0x1fbebf){_0x470f29['body'][_0xf937('0x65')]=_0x1fbebf['id'];return db[_0xf937('0x6d')][_0xf937('0x5b')](_0x470f29['body']);}})[_0xf937('0x37')](respondWithResult(_0x551604,null))['catch'](handleError(_0x551604,null));};exports[_0xf937('0x6e')]=function(_0x3e3196,_0x2e598e,_0x447603){var _0x10d316={'raw':![],'where':{}};var _0x4e1184={};var _0x5bb935={'count':0x0,'rows':[]};return db[_0xf937('0x40')][_0xf937('0x6f')]({'where':{'id':_0x3e3196['params']['id']}})[_0xf937('0x37')](handleEntityNotFound(_0x2e598e,null))[_0xf937('0x37')](function(_0x4e56dc){if(_0x4e56dc){_0x4e1184['model']=_[_0xf937('0x47')](db[_0xf937('0x6d')][_0xf937('0x41')]);_0x4e1184[_0xf937('0x46')]=_['keys'](_0x3e3196[_0xf937('0x46')]);_0x4e1184[_0xf937('0x48')]=_[_0xf937('0x4a')](_0x4e1184['model'],_0x4e1184['query']);_0x10d316[_0xf937('0x49')]=_[_0xf937('0x4a')](_0x4e1184[_0xf937('0x44')],qs['fields'](_0x3e3196[_0xf937('0x46')]['fields']));_0x10d316[_0xf937('0x49')]=_0x10d316[_0xf937('0x49')]['length']?_0x10d316[_0xf937('0x49')]:_0x4e1184[_0xf937('0x44')];if(!_0x3e3196['query']['hasOwnProperty'](_0xf937('0x67'))){_0x10d316[_0xf937('0x2e')]=qs['limit'](_0x3e3196[_0xf937('0x46')]['limit']);_0x10d316[_0xf937('0x2c')]=qs['offset'](_0x3e3196[_0xf937('0x46')][_0xf937('0x2c')]);}_0x10d316['order']=qs[_0xf937('0x4e')](_0x3e3196[_0xf937('0x46')][_0xf937('0x4e')]);_0x10d316['where']=qs['filters'](_[_0xf937('0x68')](_0x3e3196[_0xf937('0x46')],_0x4e1184['filters']));_0x10d316[_0xf937('0x4f')][_0xf937('0x65')]=_0x4e56dc['id'];if(_0x3e3196[_0xf937('0x46')][_0xf937('0x53')]){_0x10d316[_0xf937('0x4f')]=_[_0xf937('0x50')](_0x10d316[_0xf937('0x4f')],{'$or':_[_0xf937('0x45')](_0x10d316[_0xf937('0x49')],function(_0x21a66a){var _0x1bf338={};_0x1bf338[_0x21a66a]={'$like':'%'+_0x3e3196[_0xf937('0x46')]['filter']+'%'};return _0x1bf338;})});}_0x10d316=_[_0xf937('0x50')]({},_0x10d316,_0x3e3196[_0xf937('0x54')]);return db['CannedAnswer'][_0xf937('0x2f')]({'where':_0x10d316['where']})[_0xf937('0x37')](function(_0x4782e5){_0x5bb935[_0xf937('0x2f')]=_0x4782e5;if(_0x3e3196[_0xf937('0x46')]['includeAll']){_0x10d316[_0xf937('0x56')]=[{'all':!![]}];}return db['CannedAnswer'][_0xf937('0x57')](_0x10d316);})[_0xf937('0x37')](function(_0x3d0fc5){_0x5bb935[_0xf937('0x69')]=_0x3d0fc5;return _0x5bb935;});}})[_0xf937('0x37')](respondWithFilteredResult(_0x2e598e,_0x10d316))[_0xf937('0x28')](handleError(_0x2e598e,null));};exports[_0xf937('0x70')]=function(_0x59d2be,_0x2e5911,_0x538963){return db[_0xf937('0x40')][_0xf937('0x5a')]({'where':{'id':_0x59d2be[_0xf937('0x58')]['id']}})['then'](handleEntityNotFound(_0x2e5911,null))[_0xf937('0x37')](function(_0x3de732){if(_0x3de732){return _0x3de732[_0xf937('0x70')](_0x59d2be[_0xf937('0x46')]['ids']);}})[_0xf937('0x37')](respondWithStatusCode(_0x2e5911,null))[_0xf937('0x28')](handleError(_0x2e5911,null));};exports[_0xf937('0x71')]=function(_0xb0339e,_0x224e07,_0x5500fd){return db[_0xf937('0x40')][_0xf937('0x5a')]({'where':{'id':_0xb0339e[_0xf937('0x58')]['id']}})[_0xf937('0x37')](handleEntityNotFound(_0x224e07,null))[_0xf937('0x37')](function(_0xa91010){if(_0xa91010){return _0xa91010[_0xf937('0x71')](_0xb0339e['body'][_0xf937('0x6b')],_[_0xf937('0x72')](_0xb0339e[_0xf937('0x5c')],[_0xf937('0x6b'),'id'])||{})[_0xf937('0x73')](function(_0x4fa73){for(var _0x10d264=0x0;_0x10d264<_0xb0339e[_0xf937('0x5c')][_0xf937('0x6b')][_0xf937('0x59')];_0x10d264+=0x1){socket['emit'](_0xf937('0x74'),{'UserId':Number(_0xb0339e[_0xf937('0x5c')][_0xf937('0x6b')][_0x10d264]),'WhatsappAccountId':Number(_0xb0339e[_0xf937('0x58')]['id'])});}return _0x4fa73;});}})['then'](respondWithResult(_0x224e07,null))[_0xf937('0x28')](handleError(_0x224e07,null));};exports[_0xf937('0x75')]=function(_0x3f0a78,_0x3171b2,_0x39a500){return db[_0xf937('0x40')][_0xf937('0x5a')]({'where':{'id':_0x3f0a78[_0xf937('0x58')]['id']}})['then'](handleEntityNotFound(_0x3171b2,null))[_0xf937('0x37')](function(_0x49dcca){if(_0x49dcca){return _0x49dcca[_0xf937('0x75')](_0x3f0a78[_0xf937('0x46')]['ids'])[_0xf937('0x37')](function(){if(_[_0xf937('0x76')](_0x3f0a78[_0xf937('0x46')][_0xf937('0x6b')])){for(var _0x55ac5c=0x0;_0x55ac5c<_0x3f0a78['query'][_0xf937('0x6b')][_0xf937('0x59')];_0x55ac5c+=0x1){socket[_0xf937('0x77')](_0xf937('0x78'),{'UserId':Number(_0x3f0a78['query'][_0xf937('0x6b')][_0x55ac5c]),'WhatsappAccountId':Number(_0x3f0a78['params']['id'])});}}else{socket[_0xf937('0x77')](_0xf937('0x78'),{'UserId':Number(_0x3f0a78[_0xf937('0x46')][_0xf937('0x6b')]),'WhatsappAccountId':Number(_0x3f0a78[_0xf937('0x58')]['id'])});}});}})[_0xf937('0x37')](respondWithStatusCode(_0x3171b2,null))['catch'](handleError(_0x3171b2,null));};exports[_0xf937('0x79')]=function(_0x5bb488,_0x4ac54b,_0x47cf16){var _0x129d1f={};var _0x405f02={};var _0x572756;var _0x5bd600;return db[_0xf937('0x40')][_0xf937('0x6f')]({'where':{'id':_0x5bb488['params']['id']}})[_0xf937('0x37')](handleEntityNotFound(_0x4ac54b,null))['then'](function(_0x5e61f9){if(_0x5e61f9){_0x572756=_0x5e61f9;_0x405f02[_0xf937('0x44')]=_[_0xf937('0x47')](db[_0xf937('0x7a')]['rawAttributes']);_0x405f02['query']=_['keys'](_0x5bb488['query']);_0x405f02['filters']=_[_0xf937('0x4a')](_0x405f02['model'],_0x405f02[_0xf937('0x46')]);_0x129d1f[_0xf937('0x49')]=_[_0xf937('0x4a')](_0x405f02[_0xf937('0x44')],qs[_0xf937('0x4b')](_0x5bb488[_0xf937('0x46')][_0xf937('0x4b')]));_0x129d1f[_0xf937('0x49')]=_0x129d1f[_0xf937('0x49')][_0xf937('0x59')]?_0x129d1f['attributes']:_0x405f02[_0xf937('0x44')];_0x129d1f['order']=qs['sort'](_0x5bb488[_0xf937('0x46')][_0xf937('0x4e')]);_0x129d1f[_0xf937('0x4f')]=qs[_0xf937('0x48')](_[_0xf937('0x68')](_0x5bb488[_0xf937('0x46')],_0x405f02[_0xf937('0x48')]));if(_0x5bb488[_0xf937('0x46')][_0xf937('0x53')]){_0x129d1f[_0xf937('0x4f')]=_[_0xf937('0x50')](_0x129d1f['where'],{'$or':_[_0xf937('0x45')](_0x129d1f[_0xf937('0x49')],function(_0x58723a){var _0x4a6ec9={};_0x4a6ec9[_0x58723a]={'$like':'%'+_0x5bb488[_0xf937('0x46')]['filter']+'%'};return _0x4a6ec9;})});}_0x129d1f=_[_0xf937('0x50')]({},_0x129d1f,_0x5bb488['options']);return _0x572756[_0xf937('0x79')](_0x129d1f);}})[_0xf937('0x37')](function(_0x586331){if(_0x586331){_0x5bd600=_0x586331[_0xf937('0x59')];if(!_0x5bb488[_0xf937('0x46')]['hasOwnProperty'](_0xf937('0x67'))){_0x129d1f[_0xf937('0x2e')]=qs[_0xf937('0x2e')](_0x5bb488[_0xf937('0x46')][_0xf937('0x2e')]);_0x129d1f[_0xf937('0x2c')]=qs[_0xf937('0x2c')](_0x5bb488[_0xf937('0x46')][_0xf937('0x2c')]);}return _0x572756[_0xf937('0x79')](_0x129d1f);}})[_0xf937('0x37')](function(_0x50acea){if(_0x50acea){return _0x50acea?{'count':_0x5bd600,'rows':_0x50acea}:null;}})[_0xf937('0x37')](respondWithResult(_0x4ac54b,null))['catch'](handleError(_0x4ac54b,null));};exports[_0xf937('0x7b')]=function(_0x24a802,_0x390512){var _0x3c2e7a=_0x24a802[_0xf937('0x58')]['id'];var _0xd0f9e0=_0x24a802[_0xf937('0x5c')];var _0x53dc67=0xc8;var _0x2a52b8=null;return db['sequelize'][_0xf937('0x7c')]({'isolationLevel':db[_0xf937('0x7d')][_0xf937('0x7e')][_0xf937('0x7f')][_0xf937('0x80')]},function(_0x3a79c8){return db[_0xf937('0x40')][_0xf937('0x6f')]({'where':{'id':_0x3c2e7a},'transaction':_0x3a79c8})[_0xf937('0x37')](function(_0x1ae95f){if(_0x1ae95f){return db[_0xf937('0x81')][_0xf937('0x36')]({'where':{'WhatsappAccountId':_0x3c2e7a},'transaction':_0x3a79c8})['then'](function(){var _0x26c704=_[_0xf937('0x45')](_0xd0f9e0,function(_0x2622c1){_0x2622c1[_0xf937('0x65')]=_0x3c2e7a;return _0x2622c1;});return db['WhatsappApplication'][_0xf937('0x82')](_0x26c704,{'transaction':_0x3a79c8});});}else{_0x53dc67=0x194;_0x2a52b8=[];}});})[_0xf937('0x37')](function(){if(_0x53dc67!==0x194){return db[_0xf937('0x81')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x3c2e7a},'order':_0xf937('0x83')})[_0xf937('0x37')](function(_0x286f80){_0x2a52b8=_0x286f80;});}})[_0xf937('0x28')](function(_0x55f8c9){_0x53dc67=0x1f4;logger[_0xf937('0x24')](_0x55f8c9[_0xf937('0x84')]);if(_0x55f8c9['name']){delete _0x55f8c9[_0xf937('0x3b')];}_0x2a52b8=_0x55f8c9;})[_0xf937('0x85')](function(){if(_0x2a52b8===null){_0x390512[_0xf937('0x29')](_0x53dc67);}else{if(_0x53dc67===0x1f4){_0x390512[_0xf937('0x2a')](_0x53dc67)[_0xf937('0x3c')](_0x2a52b8);}else{_0x390512['status'](_0x53dc67)['json'](_0x2a52b8);}}});};exports[_0xf937('0x86')]=function(_0x47126a,_0x4a52b9,_0xced726){var _0x20d01d={};var _0x341cb1={};var _0x1c6235;var _0xa46167;return db[_0xf937('0x40')][_0xf937('0x6f')]({'where':{'id':_0x47126a[_0xf937('0x58')]['id']}})[_0xf937('0x37')](handleEntityNotFound(_0x4a52b9,null))['then'](function(_0x4d9b6d){if(_0x4d9b6d){_0x1c6235=_0x4d9b6d;_0x341cb1['model']=_['keys'](db[_0xf937('0x81')][_0xf937('0x41')]);_0x341cb1['query']=_['keys'](_0x47126a[_0xf937('0x46')]);_0x341cb1[_0xf937('0x48')]=_['intersection'](_0x341cb1['model'],_0x341cb1[_0xf937('0x46')]);_0x20d01d['attributes']=_[_0xf937('0x4a')](_0x341cb1[_0xf937('0x44')],qs[_0xf937('0x4b')](_0x47126a['query'][_0xf937('0x4b')]));_0x20d01d[_0xf937('0x49')]=_0x20d01d[_0xf937('0x49')][_0xf937('0x59')]?_0x20d01d['attributes']:_0x341cb1['model'];_0x20d01d[_0xf937('0x4d')]=qs['sort'](_0x47126a[_0xf937('0x46')][_0xf937('0x4e')]);_0x20d01d[_0xf937('0x4f')]=qs[_0xf937('0x48')](_[_0xf937('0x68')](_0x47126a['query'],_0x341cb1[_0xf937('0x48')]));if(_0x47126a[_0xf937('0x46')]['filter']){_0x20d01d[_0xf937('0x4f')]=_['merge'](_0x20d01d['where'],{'$or':_[_0xf937('0x45')](_0x20d01d[_0xf937('0x49')],function(_0x291b23){var _0x4bd6a9={};_0x4bd6a9[_0x291b23]={'$like':'%'+_0x47126a[_0xf937('0x46')][_0xf937('0x53')]+'%'};return _0x4bd6a9;})});}_0x20d01d=_[_0xf937('0x50')]({},_0x20d01d,_0x47126a[_0xf937('0x54')]);return _0x1c6235['getApplications'](_0x20d01d);}})[_0xf937('0x37')](function(_0x4b1d6c){if(_0x4b1d6c){_0xa46167=_0x4b1d6c[_0xf937('0x59')];if(!_0x47126a[_0xf937('0x46')][_0xf937('0x4c')]('nolimit')){_0x20d01d['limit']=qs['limit'](_0x47126a[_0xf937('0x46')][_0xf937('0x2e')]);_0x20d01d[_0xf937('0x2c')]=qs[_0xf937('0x2c')](_0x47126a[_0xf937('0x46')][_0xf937('0x2c')]);}return _0x1c6235['getApplications'](_0x20d01d);}})[_0xf937('0x37')](function(_0x514ce0){if(_0x514ce0){return _0x514ce0?{'count':_0xa46167,'rows':_0x514ce0}:null;}})[_0xf937('0x37')](respondWithResult(_0x4a52b9,null))[_0xf937('0x28')](handleError(_0x4a52b9,null));};exports[_0xf937('0x87')]=function(_0x295a6c,_0x285aca,_0x1e5708){var _0x1ae894={'channel':_0xf937('0x88')};var _0x3c7812=[];var _0x414137=[];var _0x5d71af={};return db[_0xf937('0x40')][_0xf937('0x5a')]({'where':{'id':_0x295a6c[_0xf937('0x58')]['id']},'include':[{'model':db[_0xf937('0x81')],'as':_0xf937('0x89')}]})[_0xf937('0x37')](handleEntityNotFound(_0x285aca,null))['then'](function(_0x497979){_0x1ae894[_0xf937('0x8a')]=_0x497979;if(_0x1ae894['account']&&_0x1ae894[_0xf937('0x8a')][_0xf937('0x51')]===_0xf937('0x8b')&&_0x295a6c[_0xf937('0x5c')][_0xf937('0x8c')]){if(_0x295a6c['body']['statuses'][_0xf937('0x59')]===0x0)return;if(_0x295a6c[_0xf937('0x5c')][_0xf937('0x8c')][0x0][_0xf937('0x8d')]!=='read')return;return db[_0xf937('0x8e')][_0xf937('0x35')]({'read':!![],'readAt':_0x295a6c[_0xf937('0x5c')][_0xf937('0x8c')][0x0][_0xf937('0x8f')]},{'where':{'messageId':_0x295a6c['body'][_0xf937('0x8c')][0x0][_0xf937('0x90')]},'individualHooks':!![]})['then'](function(_0x3c3472){return _0x285aca['status'](0xc8)[_0xf937('0x32')](_0x3c3472);});}_0x1ae894[_0xf937('0x91')]=_['orderBy'](_0x497979[_0xf937('0x89')],[_0xf937('0x83')],['asc']);if(_0x1ae894[_0xf937('0x8a')][_0xf937('0x89')]){delete _0x1ae894[_0xf937('0x8a')]['Applications'];}return db[_0xf937('0x92')][_0xf937('0x63')]()['then'](function(_0x2b2f00){if(!_0x2b2f00){throw new db['Sequelize'][(_0xf937('0x93'))](_0xf937('0x94'));}_0x3c7812=_[_0xf937('0x95')](_[_0xf937('0x47')](_0x2b2f00),[_0xf937('0x96'),_0xf937('0x97')]);_0x414137=_[_0xf937('0x95')](_[_0xf937('0x47')](_0x2b2f00),['createdAt','updatedAt',_0xf937('0x98'),_0xf937('0x99')]);_0x1ae894[_0xf937('0x5c')]={'mapKey':_0xf937('0x9a')};if(_0x1ae894[_0xf937('0x8a')]&&_0x1ae894[_0xf937('0x8a')][_0xf937('0x51')]===_0xf937('0x9b')){_0x1ae894[_0xf937('0x5c')]['from']=_0x295a6c[_0xf937('0x5c')][_0xf937('0x9c')][_0xf937('0x9d')](_0xf937('0x9e'),'');_0x1ae894['body'][_0xf937('0x5c')]=_0x295a6c[_0xf937('0x5c')][_0xf937('0x9f')];_0x1ae894['body'][_0xf937('0xa0')]=_0x295a6c['body'][_0xf937('0xa1')];}if(_0x1ae894['account']&&_0x1ae894[_0xf937('0x8a')][_0xf937('0x51')]===_0xf937('0x8b')){_0x1ae894['body'][_0xf937('0xa2')]=_0x295a6c[_0xf937('0x5c')][_0xf937('0xa3')][0x0][_0xf937('0xa2')];_0x1ae894[_0xf937('0x5c')][_0xf937('0x5c')]=_0x295a6c[_0xf937('0x5c')][_0xf937('0xa3')][0x0][_0xf937('0x25')][_0xf937('0x5c')];_0x1ae894['body']['messageId']=_0x295a6c['body'][_0xf937('0xa3')][0x0]['message_id'];}if(_0x1ae894[_0xf937('0x5c')]['id']){delete _0x1ae894['body']['id'];}if(_[_0xf937('0xa4')](_0x1ae894['body'][_0xf937('0xa2')])){throw new db[(_0xf937('0xa5'))][(_0xf937('0x93'))](_0xf937('0xa6'));}if(_['isNil'](_0x1ae894[_0xf937('0x5c')]['body'])||_0x1ae894['body'][_0xf937('0x5c')]===''){throw new db[(_0xf937('0xa5'))][(_0xf937('0x93'))](_0xf937('0xa7'));}if(_[_0xf937('0xa4')](_0x1ae894[_0xf937('0x5c')]['mapKey'])){throw new db[(_0xf937('0xa5'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x414137);}if(!_[_0xf937('0xa8')](_0x414137,_0x1ae894[_0xf937('0x5c')][_0xf937('0xa9')])){throw new db[(_0xf937('0xa5'))][(_0xf937('0x93'))](_0xf937('0xaa')+_0x414137);}_0x5d71af[_0x1ae894[_0xf937('0x5c')]['mapKey']]=_0x1ae894[_0xf937('0x5c')][_0xf937('0xa2')];return db[_0xf937('0xab')][_0xf937('0x5a')]({'where':{'id':_0x1ae894[_0xf937('0x8a')][_0xf937('0x99')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x5d71af,'limit':0x1,'order':[[_0xf937('0x97'),_0xf937('0xac')]]}]});})[_0xf937('0x37')](handleEntityNotFound(_0x285aca,null))[_0xf937('0x37')](function(_0x232a7b){if(_0x232a7b){_0x1ae894['list']=_[_0xf937('0x72')](_0x232a7b,[_0xf937('0xad')]);if(_0x232a7b[_0xf937('0xad')][_0xf937('0x59')]){return _0x232a7b['Contacts'][0x0];}var _0x827422=_[_0xf937('0x17')](_0x1ae894[_0xf937('0x5c')],{'firstName':_0x1ae894[_0xf937('0x5c')][_0xf937('0xa2')],'ListId':_0x232a7b['id']});_0x827422[_0x1ae894[_0xf937('0x5c')][_0xf937('0xa9')]]=_0x1ae894[_0xf937('0x5c')][_0xf937('0xa2')];return db[_0xf937('0x92')][_0xf937('0x5b')](_0x827422,{'fields':_0x3c7812,'raw':!![]});}})[_0xf937('0x37')](handleEntityNotFound(_0x285aca,null))[_0xf937('0x37')](function(_0x5c9e51){if(_0x5c9e51){_0x1ae894[_0xf937('0xae')]=_0x5c9e51;var _0x20c352={'ContactId':_0x5c9e51['id'],'phone':_0x1ae894[_0xf937('0x5c')][_0xf937('0xa2')],'WhatsappAccountId':_0x295a6c[_0xf937('0x58')]['id']};var _0x5917e4={'ContactId':_0x5c9e51['id'],'WhatsappAccountId':_0x295a6c[_0xf937('0x58')]['id'],'closed':![]};return db[_0xf937('0xaf')][_0xf937('0x5a')]({'where':_0x5917e4})[_0xf937('0x37')](function(_0x402069){if(_0x402069){return[_0x402069,![]];}return db[_0xf937('0xaf')][_0xf937('0x5b')](_0x20c352)[_0xf937('0x37')](function(_0x4fa655){return[_0x4fa655,!![]];});});}})[_0xf937('0x73')](function(_0x3c065d,_0x3f8e14){_0x1ae894[_0xf937('0xb0')]=_0x3c065d[_0xf937('0x38')]({'plain':!![]});_0x1ae894[_0xf937('0xb0')][_0xf937('0xb1')]=![];if(_0x3f8e14){if(_0x1ae894['account'][_0xf937('0xb2')]){_0x1ae894[_0xf937('0x91')][_0xf937('0xb3')]({'id':0x0,'priority':_0x1ae894['applications']['length']+0x1,'app':_0xf937('0xb4'),'appdata':_0xf937('0xb5'),'interval':_0xf937('0xb6')});}_0x1ae894[_0xf937('0xb0')][_0xf937('0xb1')]=!![];}return db[_0xf937('0x8e')][_0xf937('0x5b')]({'phone':_0x1ae894[_0xf937('0x5c')][_0xf937('0xa2')],'messageId':_0x1ae894[_0xf937('0x5c')]['messageId'],'body':_0x1ae894[_0xf937('0x5c')][_0xf937('0x5c')],'WhatsappAccountId':_0x295a6c[_0xf937('0x58')]['id'],'WhatsappInteractionId':_0x3c065d['id'],'direction':'in','ContactId':_0x3c065d[_0xf937('0xb7')],'AttachmentId':_0x1ae894['body'][_0xf937('0xb8')]});})[_0xf937('0x37')](function(_0x1b09cd){_0x1ae894[_0xf937('0x25')]=_0x1b09cd;if(_0x1ae894[_0xf937('0xb0')][_0xf937('0xb9')]){return db[_0xf937('0x7a')][_0xf937('0x5a')]({'attributes':['id',_0xf937('0x3b')],'where':{'id':_0x1ae894[_0xf937('0xb0')][_0xf937('0xb9')]}})['then'](function(_0x4a77cb){if(_0x4a77cb){_0x1ae894[_0xf937('0x91')][_0xf937('0xba')]({'id':0x0,'priority':0x0,'app':_0xf937('0xbb'),'appdata':_0x4a77cb[_0xf937('0x3b')]+','+(_0x1ae894['account']['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0xf937('0xbc'),_0x1ae894);});}return respondWithRpcPromise(_0xf937('0xbd'),'startRouting',_0x1ae894);})[_0xf937('0x37')](function(_0x52b7cb){if(_0x52b7cb){var _0x56595e=0xc8;var _0xac707a=_0xf937('0xbe');logger[_0xf937('0x26')](_0xf937('0xbf'),_0xac707a,_0x56595e,_0xf937('0xc0'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0xac707a,_0x56595e,_0xf937('0xc0'),JSON['stringify'](_0x52b7cb));if(_0x1ae894[_0xf937('0x8a')][_0xf937('0x51')]===_0xf937('0x9b')){return _0x285aca[_0xf937('0x2a')](_0x56595e)[_0xf937('0x30')](_0xf937('0xc1'),_0xf937('0xc2'))[_0xf937('0x3c')](_0xf937('0xc3'));}else{return _0x285aca[_0xf937('0x2a')](_0x56595e)['json'](_0x52b7cb);}}});})[_0xf937('0x28')](handleError(_0x285aca,null));};exports[_0xf937('0x3c')]=function(_0x257d88,_0x311547,_0x42aa1e){var _0x1d9541,_0x32710b,_0x1a2e60;if(_[_0xf937('0xa4')](_0x257d88['body'][_0xf937('0x5c')])||_0x257d88['body'][_0xf937('0x5c')]===''){throw new db[(_0xf937('0xa5'))][(_0xf937('0x93'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xf937('0xa4')](_0x257d88['body']['to'])){throw new db[(_0xf937('0xa5'))][(_0xf937('0x93'))](_0xf937('0xc4'));}_0x1d9541=_0x257d88[_0xf937('0x5c')]['to'];return db['WhatsappAccount'][_0xf937('0x5a')]({'where':{'id':_0x257d88[_0xf937('0x58')]['id']},'include':[{'model':db[_0xf937('0xab')],'as':_0xf937('0xc5'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'mobile':_0x1d9541},'limit':0x1,'order':[[_0xf937('0x97'),_0xf937('0xac')]]}]}]})[_0xf937('0x37')](handleEntityNotFound(_0x311547,null))['then'](function(_0x4a9a28){if(_0x4a9a28&&_0x4a9a28[_0xf937('0xc5')]){_0x32710b=_0x4a9a28[_0xf937('0x38')]({'plain':!![]});if(_0x32710b[_0xf937('0xc5')]&&_0x32710b[_0xf937('0xc5')][_0xf937('0xad')]['length']){return _0x32710b['List'][_0xf937('0xad')][0x0];}return db[_0xf937('0x92')][_0xf937('0x5b')](_['defaults'](_0x257d88[_0xf937('0x5c')],{'firstName':_0x1d9541,'mobile':_0x1d9541,'phone':_0x1d9541,'ListId':_0x32710b[_0xf937('0x99')]}));}})[_0xf937('0x37')](handleEntityNotFound(_0x311547,null))[_0xf937('0x37')](function(_0x28cf62){if(_0x28cf62){_0x1a2e60=_0x28cf62;return db[_0xf937('0xaf')][_0xf937('0x5a')]({'where':{'ContactId':_0x1a2e60['id'],'closed':![],'WhatsappAccountId':_0x32710b['id']}})[_0xf937('0x37')](function(_0xda7797){if(_0xda7797){return[_0xda7797,![]];}return db[_0xf937('0xaf')][_0xf937('0x5b')]({'UserId':_0x257d88['user']['id'],'ContactId':_0x1a2e60['id'],'WhatsappAccountId':_0x32710b['id'],'phone':_0x1d9541,'firstMsgDirection':_0xf937('0xc6'),'Messages':[_['merge'](_0x257d88[_0xf937('0x5c')],{'read':![],'body':_0x257d88[_0xf937('0x5c')][_0xf937('0x5c')],'phone':_0x1d9541,'WhatsappAccountId':_0x32710b['id'],'UserId':_0x257d88['user']['id'],'ContactId':_0x1a2e60['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0xf937('0xc7')}]})['then'](function(_0x527a96){return[_0x527a96,!![]];});});}})[_0xf937('0x73')](function(_0x3c9d67,_0x1447b4){if(_0x1447b4){return _0x3c9d67;}return db['WhatsappMessage']['create'](_[_0xf937('0x50')](_0x257d88[_0xf937('0x5c')],{'read':![],'body':_0x257d88[_0xf937('0x5c')]['body'],'phone':_0x1d9541,'WhatsappAccountId':_0x32710b['id'],'WhatsappInteractionId':_0x3c9d67['id'],'UserId':_0x257d88[_0xf937('0x5d')]['id'],'ContactId':_0x1a2e60['id']}))[_0xf937('0x37')](function(_0x3e7eb2){_0x3c9d67[_0xf937('0xc8')][_0xf937('0xc7')]=[];_0x3c9d67[_0xf937('0xc8')][_0xf937('0xc7')][_0xf937('0xb3')](_0x3e7eb2[_0xf937('0xc8')]);return _0x3c9d67;});})[_0xf937('0x37')](respondWithResult(_0x311547,null))['catch'](handleError(_0x311547,null));}; \ No newline at end of file +var _0x8e4f=['replace','Body','messageId','MessageSid','notifications','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','DESC','Contacts','contact','WhatsappInteraction','spread','interaction','created','autoclose','*,*,*,*','AttachmentId','UserId','unshift','waitForTheAssignedAgent','Start','startRouting','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','\x0a','to\x20is\x20mandatory','CmList','List','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','register','jayson/promise','client','http','info','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','save','update','destroy','then','get','WhatsappAccounts','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','filter','options','count','include','findAll','rows','show','includeAll','merge','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','Disposition','getDispositions','findOne','removeDispositions','addAnswer','CannedAnswer','getAnswers','WhatsappAccountId','removeAnswers','ids','omit','emit','userWhatsappAccount:save','removeAgents','isArray','getAgents','User','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','priority','send','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','applications','asc','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x8e4f,0xe0));var _0xf8e4=function(_0x554f90,_0x1636be){_0x554f90=_0x554f90-0x0;var _0xea51a2=_0x8e4f[_0x554f90];return _0xea51a2;};'use strict';var emlformat=require(_0xf8e4('0x0'));var rimraf=require(_0xf8e4('0x1'));var zipdir=require(_0xf8e4('0x2'));var jsonpatch=require(_0xf8e4('0x3'));var rp=require('request-promise');var moment=require(_0xf8e4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf8e4('0x5'));var util=require(_0xf8e4('0x6'));var path=require(_0xf8e4('0x7'));var sox=require('sox');var csv=require(_0xf8e4('0x8'));var ejs=require(_0xf8e4('0x9'));var fs=require('fs');var fs_extra=require(_0xf8e4('0xa'));var _=require(_0xf8e4('0xb'));var squel=require(_0xf8e4('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf8e4('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf8e4('0xe'));var Redis=require('ioredis');var authService=require(_0xf8e4('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf8e4('0x10'));var logger=require(_0xf8e4('0x11'))(_0xf8e4('0x12'));var utils=require(_0xf8e4('0x13'));var config=require(_0xf8e4('0x14'));var licenseUtil=require(_0xf8e4('0x15'));var db=require(_0xf8e4('0x16'))['db'];config['redis']=_[_0xf8e4('0x17')](config[_0xf8e4('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf8e4('0x18')]));require('./whatsappAccount.socket')[_0xf8e4('0x19')](socket);var jayson=require(_0xf8e4('0x1a'));var client=jayson[_0xf8e4('0x1b')][_0xf8e4('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x364c07,_0xf37fb5,_0xbee02a,_0x385636){return new BPromise(function(_0x49c39c,_0x9b08a1){var _0xdcec1d=_0x385636||client;return _0xdcec1d['request'](_0x364c07,_0xbee02a)['then'](function(_0x2bd8bb){logger[_0xf8e4('0x1d')]('WhatsappAccount,\x20%s,\x20%s',_0xf37fb5,'request\x20sent');logger[_0xf8e4('0x1e')](_0xf8e4('0x1f'),_0xf37fb5,_0xf8e4('0x20'),JSON[_0xf8e4('0x21')](_0x2bd8bb));if(_0x2bd8bb[_0xf8e4('0x22')]){if(_0x2bd8bb[_0xf8e4('0x22')][_0xf8e4('0x23')]===0x1f4){logger['error'](_0xf8e4('0x24'),_0xf37fb5,_0x2bd8bb[_0xf8e4('0x22')]['message']);return _0x9b08a1(_0x2bd8bb['error'][_0xf8e4('0x25')]);}logger[_0xf8e4('0x22')](_0xf8e4('0x24'),_0xf37fb5,_0x2bd8bb[_0xf8e4('0x22')][_0xf8e4('0x25')]);return _0x49c39c(_0x2bd8bb[_0xf8e4('0x22')]['message']);}else{logger[_0xf8e4('0x1d')](_0xf8e4('0x24'),_0xf37fb5,_0xf8e4('0x20'));_0x49c39c(_0x2bd8bb[_0xf8e4('0x26')][_0xf8e4('0x25')]);}})[_0xf8e4('0x27')](function(_0x2d3d65){logger[_0xf8e4('0x22')](_0xf8e4('0x24'),_0xf37fb5,_0x2d3d65);_0x9b08a1(_0x2d3d65);});});}function respondWithStatusCode(_0x1599c7,_0x2bd69e){_0x2bd69e=_0x2bd69e||0xcc;return function(_0x6e205a){if(_0x6e205a){return _0x1599c7[_0xf8e4('0x28')](_0x2bd69e);}return _0x1599c7['status'](_0x2bd69e)['end']();};}function respondWithResult(_0x5b800c,_0x34f468){_0x34f468=_0x34f468||0xc8;return function(_0x11a350){if(_0x11a350){return _0x5b800c[_0xf8e4('0x29')](_0x34f468)[_0xf8e4('0x2a')](_0x11a350);}};}function respondWithFilteredResult(_0x346e17,_0x39b4f6){return function(_0x31f65d){if(_0x31f65d){var _0x2920ed=typeof _0x39b4f6[_0xf8e4('0x2b')]===_0xf8e4('0x2c')&&typeof _0x39b4f6[_0xf8e4('0x2d')]===_0xf8e4('0x2c');var _0x88b41b=_0x31f65d['count'];var _0x471186=_0x2920ed?0x0:_0x39b4f6[_0xf8e4('0x2b')];var _0x12d5fc=_0x2920ed?_0x31f65d['count']:_0x39b4f6[_0xf8e4('0x2b')]+_0x39b4f6[_0xf8e4('0x2d')];var _0x3d2a72;if(_0x12d5fc>=_0x88b41b){_0x12d5fc=_0x88b41b;_0x3d2a72=0xc8;}else{_0x3d2a72=0xce;}_0x346e17[_0xf8e4('0x29')](_0x3d2a72);return _0x346e17[_0xf8e4('0x2e')](_0xf8e4('0x2f'),_0x471186+'-'+_0x12d5fc+'/'+_0x88b41b)[_0xf8e4('0x2a')](_0x31f65d);}return null;};}function patchUpdates(_0x124cec){return function(_0xe46511){try{jsonpatch[_0xf8e4('0x30')](_0xe46511,_0x124cec,!![]);}catch(_0x432973){return BPromise['reject'](_0x432973);}return _0xe46511[_0xf8e4('0x31')]();};}function saveUpdates(_0x7e0244,_0x321df3){return function(_0x1beae7){if(_0x1beae7){return _0x1beae7[_0xf8e4('0x32')](_0x7e0244)['then'](function(_0x40e3a3){return _0x40e3a3;});}return null;};}function removeEntity(_0x310787,_0x38ca3f){return function(_0x518c69){if(_0x518c69){return _0x518c69[_0xf8e4('0x33')]()[_0xf8e4('0x34')](function(){var _0x2a8e79=_0x518c69[_0xf8e4('0x35')]({'plain':!![]});var _0x67f7ac=_0xf8e4('0x36');return db[_0xf8e4('0x37')][_0xf8e4('0x33')]({'where':{'type':_0x67f7ac,'resourceId':_0x2a8e79['id']}})['then'](function(){return _0x518c69;});})[_0xf8e4('0x34')](function(){_0x310787[_0xf8e4('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a9a4b,_0x90a086){return function(_0x4a5098){if(!_0x4a5098){_0x4a9a4b[_0xf8e4('0x28')](0x194);}return _0x4a5098;};}function handleError(_0x18e263,_0x5abc30){_0x5abc30=_0x5abc30||0x1f4;return function(_0x2ef611){logger[_0xf8e4('0x22')](_0x2ef611[_0xf8e4('0x38')]);if(_0x2ef611[_0xf8e4('0x39')]){delete _0x2ef611[_0xf8e4('0x39')];}_0x18e263[_0xf8e4('0x29')](_0x5abc30)['send'](_0x2ef611);};}exports[_0xf8e4('0x3a')]=function(_0x553b0d,_0x5d68fa){var _0x49735b={'include':[{'model':db[_0xf8e4('0x3b')],'as':_0xf8e4('0x3c')}]},_0x5e1c2f={},_0x2140a5={'count':0x0,'rows':[]};var _0x552ecd=_[_0xf8e4('0x3d')](db[_0xf8e4('0x3e')][_0xf8e4('0x3f')],function(_0xbd62d6){return{'name':_0xbd62d6[_0xf8e4('0x40')],'type':_0xbd62d6['type']['key']};});_0x5e1c2f['model']=_['map'](_0x552ecd,'name');_0x5e1c2f['query']=_[_0xf8e4('0x41')](_0x553b0d[_0xf8e4('0x42')]);_0x5e1c2f[_0xf8e4('0x43')]=_[_0xf8e4('0x44')](_0x5e1c2f[_0xf8e4('0x45')],_0x5e1c2f['query']);_0x49735b[_0xf8e4('0x46')]=_['intersection'](_0x5e1c2f[_0xf8e4('0x45')],qs[_0xf8e4('0x47')](_0x553b0d[_0xf8e4('0x42')][_0xf8e4('0x47')]));_0x49735b[_0xf8e4('0x46')]=_0x49735b[_0xf8e4('0x46')][_0xf8e4('0x48')]?_0x49735b[_0xf8e4('0x46')]:_0x5e1c2f[_0xf8e4('0x45')];if(!_0x553b0d[_0xf8e4('0x42')][_0xf8e4('0x49')](_0xf8e4('0x4a'))){_0x49735b[_0xf8e4('0x2d')]=qs[_0xf8e4('0x2d')](_0x553b0d[_0xf8e4('0x42')][_0xf8e4('0x2d')]);_0x49735b[_0xf8e4('0x2b')]=qs[_0xf8e4('0x2b')](_0x553b0d[_0xf8e4('0x42')]['offset']);}_0x49735b[_0xf8e4('0x4b')]=qs[_0xf8e4('0x4c')](_0x553b0d[_0xf8e4('0x42')][_0xf8e4('0x4c')]);_0x49735b[_0xf8e4('0x4d')]=qs['filters'](_[_0xf8e4('0x4e')](_0x553b0d['query'],_0x5e1c2f[_0xf8e4('0x43')]),_0x552ecd);if(_0x553b0d[_0xf8e4('0x42')]['filter']){_0x49735b[_0xf8e4('0x4d')]=_['merge'](_0x49735b['where'],{'$or':_[_0xf8e4('0x3d')](_0x552ecd,function(_0x58a786){if(_0x58a786[_0xf8e4('0x4f')]!=='VIRTUAL'){var _0x4c7ce2={};_0x4c7ce2[_0x58a786[_0xf8e4('0x39')]]={'$like':'%'+_0x553b0d[_0xf8e4('0x42')][_0xf8e4('0x50')]+'%'};return _0x4c7ce2;}})});}_0x49735b=_['merge']({},_0x49735b,_0x553b0d[_0xf8e4('0x51')]);var _0x48cfd9={'where':_0x49735b[_0xf8e4('0x4d')]};return db[_0xf8e4('0x3e')]['count'](_0x48cfd9)[_0xf8e4('0x34')](function(_0x20fc46){_0x2140a5[_0xf8e4('0x52')]=_0x20fc46;if(_0x553b0d[_0xf8e4('0x42')]['includeAll']){_0x49735b[_0xf8e4('0x53')]=[{'all':!![]}];}return db[_0xf8e4('0x3e')][_0xf8e4('0x54')](_0x49735b);})['then'](function(_0x3e0618){_0x2140a5[_0xf8e4('0x55')]=_0x3e0618;return _0x2140a5;})['then'](respondWithFilteredResult(_0x5d68fa,_0x49735b))[_0xf8e4('0x27')](handleError(_0x5d68fa,null));};exports[_0xf8e4('0x56')]=function(_0x3fbeef,_0x5db667){var _0x53aafa={'raw':![],'where':{'id':_0x3fbeef['params']['id']},'include':[{'model':db['Pause'],'as':_0xf8e4('0x3c')}]},_0x47c2c3={};_0x47c2c3[_0xf8e4('0x45')]=_[_0xf8e4('0x41')](db[_0xf8e4('0x3e')][_0xf8e4('0x3f')]);_0x47c2c3[_0xf8e4('0x42')]=_['keys'](_0x3fbeef[_0xf8e4('0x42')]);_0x47c2c3['filters']=_[_0xf8e4('0x44')](_0x47c2c3['model'],_0x47c2c3[_0xf8e4('0x42')]);_0x53aafa[_0xf8e4('0x46')]=_[_0xf8e4('0x44')](_0x47c2c3[_0xf8e4('0x45')],qs[_0xf8e4('0x47')](_0x3fbeef[_0xf8e4('0x42')][_0xf8e4('0x47')]));_0x53aafa[_0xf8e4('0x46')]=_0x53aafa[_0xf8e4('0x46')][_0xf8e4('0x48')]?_0x53aafa[_0xf8e4('0x46')]:_0x47c2c3['model'];if(_0x3fbeef[_0xf8e4('0x42')][_0xf8e4('0x57')]){_0x53aafa[_0xf8e4('0x53')]=[{'all':!![]}];}_0x53aafa=_[_0xf8e4('0x58')]({},_0x53aafa,_0x3fbeef[_0xf8e4('0x51')]);return db[_0xf8e4('0x3e')]['find'](_0x53aafa)['then'](handleEntityNotFound(_0x5db667,null))[_0xf8e4('0x34')](respondWithResult(_0x5db667,null))[_0xf8e4('0x27')](handleError(_0x5db667,null));};exports['create']=function(_0x2a045b,_0xe3b1fb){return db[_0xf8e4('0x3e')][_0xf8e4('0x59')](_0x2a045b[_0xf8e4('0x5a')],{})[_0xf8e4('0x34')](function(_0x27b64f){var _0x6bf5d0=_0x2a045b[_0xf8e4('0x5b')]['get']({'plain':!![]});if(!_0x6bf5d0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x6bf5d0[_0xf8e4('0x5c')]==='user'){var _0x33386f=_0x27b64f[_0xf8e4('0x35')]({'plain':!![]});var _0x5e0677=_0xf8e4('0x36');return db[_0xf8e4('0x5d')][_0xf8e4('0x5e')]({'where':{'name':_0x5e0677,'userProfileId':_0x6bf5d0[_0xf8e4('0x5f')]},'raw':!![]})[_0xf8e4('0x34')](function(_0x4b6f6a){if(_0x4b6f6a&&_0x4b6f6a[_0xf8e4('0x60')]===0x0){return db['UserProfileResource'][_0xf8e4('0x59')]({'name':_0x33386f[_0xf8e4('0x39')],'resourceId':_0x33386f['id'],'type':_0x4b6f6a['name'],'sectionId':_0x4b6f6a['id']},{})[_0xf8e4('0x34')](function(){return _0x27b64f;});}else{return _0x27b64f;}})[_0xf8e4('0x27')](function(_0x3a9abe){logger[_0xf8e4('0x22')](_0xf8e4('0x61'),_0x3a9abe);throw _0x3a9abe;});}return _0x27b64f;})[_0xf8e4('0x34')](respondWithResult(_0xe3b1fb,0xc9))[_0xf8e4('0x27')](handleError(_0xe3b1fb,null));};exports[_0xf8e4('0x32')]=function(_0x441e7f,_0x2ee90a){if(_0x441e7f['body']['id']){delete _0x441e7f[_0xf8e4('0x5a')]['id'];}return db[_0xf8e4('0x3e')]['find']({'where':{'id':_0x441e7f['params']['id']},'include':[{'model':db[_0xf8e4('0x3b')],'as':_0xf8e4('0x3c')}]})[_0xf8e4('0x34')](handleEntityNotFound(_0x2ee90a,null))['then'](saveUpdates(_0x441e7f[_0xf8e4('0x5a')],null))[_0xf8e4('0x34')](respondWithResult(_0x2ee90a,null))[_0xf8e4('0x27')](handleError(_0x2ee90a,null));};exports[_0xf8e4('0x33')]=function(_0x471b4d,_0x448211){return db[_0xf8e4('0x3e')]['find']({'where':{'id':_0x471b4d[_0xf8e4('0x62')]['id']}})[_0xf8e4('0x34')](handleEntityNotFound(_0x448211,null))[_0xf8e4('0x34')](removeEntity(_0x448211,null))[_0xf8e4('0x27')](handleError(_0x448211,null));};exports[_0xf8e4('0x63')]=function(_0x14884c,_0x36d6ab){return db['WhatsappAccount'][_0xf8e4('0x63')]()[_0xf8e4('0x34')](respondWithResult(_0x36d6ab,null))[_0xf8e4('0x27')](handleError(_0x36d6ab,null));};exports[_0xf8e4('0x64')]=function(_0x33cd0d,_0x58b8ab,_0x58c08d){if(_0x33cd0d[_0xf8e4('0x5a')]['id']){delete _0x33cd0d[_0xf8e4('0x5a')]['id'];}return db[_0xf8e4('0x3e')][_0xf8e4('0x5e')]({'where':{'id':_0x33cd0d[_0xf8e4('0x62')]['id']}})['then'](handleEntityNotFound(_0x58b8ab,null))[_0xf8e4('0x34')](function(_0x5345fd){if(_0x5345fd){_0x33cd0d[_0xf8e4('0x5a')]['WhatsappAccountId']=_0x5345fd['id'];return db[_0xf8e4('0x65')][_0xf8e4('0x59')](_0x33cd0d[_0xf8e4('0x5a')]);}})[_0xf8e4('0x34')](respondWithResult(_0x58b8ab,null))[_0xf8e4('0x27')](handleError(_0x58b8ab,null));};exports[_0xf8e4('0x66')]=function(_0x44ee8a,_0x4f226a,_0x4695ff){var _0x14646e={'raw':![],'where':{}};var _0x26f1dc={};var _0x3ceb3d={'count':0x0,'rows':[]};return db[_0xf8e4('0x3e')][_0xf8e4('0x67')]({'where':{'id':_0x44ee8a[_0xf8e4('0x62')]['id']}})[_0xf8e4('0x34')](handleEntityNotFound(_0x4f226a,null))[_0xf8e4('0x34')](function(_0x4000ee){if(_0x4000ee){_0x26f1dc[_0xf8e4('0x45')]=_[_0xf8e4('0x41')](db[_0xf8e4('0x65')][_0xf8e4('0x3f')]);_0x26f1dc[_0xf8e4('0x42')]=_['keys'](_0x44ee8a[_0xf8e4('0x42')]);_0x26f1dc[_0xf8e4('0x43')]=_[_0xf8e4('0x44')](_0x26f1dc[_0xf8e4('0x45')],_0x26f1dc[_0xf8e4('0x42')]);_0x14646e[_0xf8e4('0x46')]=_['intersection'](_0x26f1dc[_0xf8e4('0x45')],qs[_0xf8e4('0x47')](_0x44ee8a['query'][_0xf8e4('0x47')]));_0x14646e[_0xf8e4('0x46')]=_0x14646e['attributes']['length']?_0x14646e['attributes']:_0x26f1dc[_0xf8e4('0x45')];if(!_0x44ee8a[_0xf8e4('0x42')]['hasOwnProperty'](_0xf8e4('0x4a'))){_0x14646e[_0xf8e4('0x2d')]=qs[_0xf8e4('0x2d')](_0x44ee8a['query']['limit']);_0x14646e['offset']=qs['offset'](_0x44ee8a[_0xf8e4('0x42')][_0xf8e4('0x2b')]);}_0x14646e[_0xf8e4('0x4b')]=qs[_0xf8e4('0x4c')](_0x44ee8a[_0xf8e4('0x42')][_0xf8e4('0x4c')]);_0x14646e[_0xf8e4('0x4d')]=qs[_0xf8e4('0x43')](_['pick'](_0x44ee8a[_0xf8e4('0x42')],_0x26f1dc[_0xf8e4('0x43')]));_0x14646e[_0xf8e4('0x4d')]['WhatsappAccountId']=_0x4000ee['id'];if(_0x44ee8a[_0xf8e4('0x42')]['filter']){_0x14646e['where']=_['merge'](_0x14646e[_0xf8e4('0x4d')],{'$or':_[_0xf8e4('0x3d')](_0x14646e['attributes'],function(_0x88e007){var _0x170d31={};_0x170d31[_0x88e007]={'$like':'%'+_0x44ee8a[_0xf8e4('0x42')][_0xf8e4('0x50')]+'%'};return _0x170d31;})});}_0x14646e=_[_0xf8e4('0x58')]({},_0x14646e,_0x44ee8a[_0xf8e4('0x51')]);return db['Disposition'][_0xf8e4('0x52')]({'where':_0x14646e[_0xf8e4('0x4d')]})[_0xf8e4('0x34')](function(_0x262162){_0x3ceb3d[_0xf8e4('0x52')]=_0x262162;if(_0x44ee8a[_0xf8e4('0x42')]['includeAll']){_0x14646e['include']=[{'all':!![]}];}return db[_0xf8e4('0x65')][_0xf8e4('0x54')](_0x14646e);})['then'](function(_0x424b18){_0x3ceb3d[_0xf8e4('0x55')]=_0x424b18;return _0x3ceb3d;});}})[_0xf8e4('0x34')](respondWithFilteredResult(_0x4f226a,_0x14646e))[_0xf8e4('0x27')](handleError(_0x4f226a,null));};exports[_0xf8e4('0x68')]=function(_0x49767a,_0x1b77f1,_0x59df69){return db[_0xf8e4('0x3e')][_0xf8e4('0x5e')]({'where':{'id':_0x49767a[_0xf8e4('0x62')]['id']}})['then'](handleEntityNotFound(_0x1b77f1,null))[_0xf8e4('0x34')](function(_0xea2c13){if(_0xea2c13){return _0xea2c13[_0xf8e4('0x68')](_0x49767a[_0xf8e4('0x42')]['ids']);}})['then'](respondWithStatusCode(_0x1b77f1,null))[_0xf8e4('0x27')](handleError(_0x1b77f1,null));};exports[_0xf8e4('0x69')]=function(_0x2a7334,_0x2de9c8,_0x505011){if(_0x2a7334[_0xf8e4('0x5a')]['id']){delete _0x2a7334[_0xf8e4('0x5a')]['id'];}return db[_0xf8e4('0x3e')][_0xf8e4('0x5e')]({'where':{'id':_0x2a7334[_0xf8e4('0x62')]['id']}})[_0xf8e4('0x34')](handleEntityNotFound(_0x2de9c8,null))[_0xf8e4('0x34')](function(_0x20b4f7){if(_0x20b4f7){_0x2a7334[_0xf8e4('0x5a')]['WhatsappAccountId']=_0x20b4f7['id'];return db[_0xf8e4('0x6a')][_0xf8e4('0x59')](_0x2a7334[_0xf8e4('0x5a')]);}})[_0xf8e4('0x34')](respondWithResult(_0x2de9c8,null))[_0xf8e4('0x27')](handleError(_0x2de9c8,null));};exports[_0xf8e4('0x6b')]=function(_0x362407,_0x235f9d,_0x1ced5f){var _0x171674={'raw':![],'where':{}};var _0x4f7cd0={};var _0x4efdda={'count':0x0,'rows':[]};return db[_0xf8e4('0x3e')][_0xf8e4('0x67')]({'where':{'id':_0x362407[_0xf8e4('0x62')]['id']}})[_0xf8e4('0x34')](handleEntityNotFound(_0x235f9d,null))['then'](function(_0x18aeba){if(_0x18aeba){_0x4f7cd0[_0xf8e4('0x45')]=_[_0xf8e4('0x41')](db[_0xf8e4('0x6a')][_0xf8e4('0x3f')]);_0x4f7cd0['query']=_[_0xf8e4('0x41')](_0x362407[_0xf8e4('0x42')]);_0x4f7cd0[_0xf8e4('0x43')]=_[_0xf8e4('0x44')](_0x4f7cd0[_0xf8e4('0x45')],_0x4f7cd0[_0xf8e4('0x42')]);_0x171674['attributes']=_[_0xf8e4('0x44')](_0x4f7cd0[_0xf8e4('0x45')],qs['fields'](_0x362407['query'][_0xf8e4('0x47')]));_0x171674[_0xf8e4('0x46')]=_0x171674['attributes'][_0xf8e4('0x48')]?_0x171674[_0xf8e4('0x46')]:_0x4f7cd0[_0xf8e4('0x45')];if(!_0x362407[_0xf8e4('0x42')][_0xf8e4('0x49')](_0xf8e4('0x4a'))){_0x171674[_0xf8e4('0x2d')]=qs[_0xf8e4('0x2d')](_0x362407['query'][_0xf8e4('0x2d')]);_0x171674['offset']=qs[_0xf8e4('0x2b')](_0x362407[_0xf8e4('0x42')][_0xf8e4('0x2b')]);}_0x171674[_0xf8e4('0x4b')]=qs[_0xf8e4('0x4c')](_0x362407[_0xf8e4('0x42')][_0xf8e4('0x4c')]);_0x171674['where']=qs['filters'](_[_0xf8e4('0x4e')](_0x362407[_0xf8e4('0x42')],_0x4f7cd0[_0xf8e4('0x43')]));_0x171674[_0xf8e4('0x4d')][_0xf8e4('0x6c')]=_0x18aeba['id'];if(_0x362407[_0xf8e4('0x42')][_0xf8e4('0x50')]){_0x171674[_0xf8e4('0x4d')]=_[_0xf8e4('0x58')](_0x171674[_0xf8e4('0x4d')],{'$or':_[_0xf8e4('0x3d')](_0x171674['attributes'],function(_0x20e0f5){var _0x32f924={};_0x32f924[_0x20e0f5]={'$like':'%'+_0x362407[_0xf8e4('0x42')]['filter']+'%'};return _0x32f924;})});}_0x171674=_[_0xf8e4('0x58')]({},_0x171674,_0x362407[_0xf8e4('0x51')]);return db[_0xf8e4('0x6a')][_0xf8e4('0x52')]({'where':_0x171674[_0xf8e4('0x4d')]})['then'](function(_0x3e6bb9){_0x4efdda[_0xf8e4('0x52')]=_0x3e6bb9;if(_0x362407[_0xf8e4('0x42')]['includeAll']){_0x171674['include']=[{'all':!![]}];}return db[_0xf8e4('0x6a')][_0xf8e4('0x54')](_0x171674);})[_0xf8e4('0x34')](function(_0x4d9b85){_0x4efdda['rows']=_0x4d9b85;return _0x4efdda;});}})[_0xf8e4('0x34')](respondWithFilteredResult(_0x235f9d,_0x171674))[_0xf8e4('0x27')](handleError(_0x235f9d,null));};exports[_0xf8e4('0x6d')]=function(_0x3e12fc,_0xfb154f,_0x54d21c){return db['WhatsappAccount'][_0xf8e4('0x5e')]({'where':{'id':_0x3e12fc[_0xf8e4('0x62')]['id']}})['then'](handleEntityNotFound(_0xfb154f,null))[_0xf8e4('0x34')](function(_0x44ff44){if(_0x44ff44){return _0x44ff44[_0xf8e4('0x6d')](_0x3e12fc[_0xf8e4('0x42')]['ids']);}})[_0xf8e4('0x34')](respondWithStatusCode(_0xfb154f,null))[_0xf8e4('0x27')](handleError(_0xfb154f,null));};exports['addAgents']=function(_0x648785,_0x41d0b8,_0x25711d){return db[_0xf8e4('0x3e')][_0xf8e4('0x5e')]({'where':{'id':_0x648785[_0xf8e4('0x62')]['id']}})['then'](handleEntityNotFound(_0x41d0b8,null))[_0xf8e4('0x34')](function(_0x2ddd1c){if(_0x2ddd1c){return _0x2ddd1c['addAgents'](_0x648785[_0xf8e4('0x5a')][_0xf8e4('0x6e')],_[_0xf8e4('0x6f')](_0x648785[_0xf8e4('0x5a')],[_0xf8e4('0x6e'),'id'])||{})['spread'](function(_0xf1fde9){for(var _0xcc8d7f=0x0;_0xcc8d7f<_0x648785[_0xf8e4('0x5a')][_0xf8e4('0x6e')]['length'];_0xcc8d7f+=0x1){socket[_0xf8e4('0x70')](_0xf8e4('0x71'),{'UserId':Number(_0x648785[_0xf8e4('0x5a')][_0xf8e4('0x6e')][_0xcc8d7f]),'WhatsappAccountId':Number(_0x648785['params']['id'])});}return _0xf1fde9;});}})[_0xf8e4('0x34')](respondWithResult(_0x41d0b8,null))['catch'](handleError(_0x41d0b8,null));};exports['removeAgents']=function(_0x2d03c5,_0x540195,_0x3e82cf){return db[_0xf8e4('0x3e')]['find']({'where':{'id':_0x2d03c5[_0xf8e4('0x62')]['id']}})[_0xf8e4('0x34')](handleEntityNotFound(_0x540195,null))[_0xf8e4('0x34')](function(_0x51c538){if(_0x51c538){return _0x51c538[_0xf8e4('0x72')](_0x2d03c5[_0xf8e4('0x42')][_0xf8e4('0x6e')])[_0xf8e4('0x34')](function(){if(_[_0xf8e4('0x73')](_0x2d03c5['query']['ids'])){for(var _0x16df40=0x0;_0x16df40<_0x2d03c5['query'][_0xf8e4('0x6e')]['length'];_0x16df40+=0x1){socket[_0xf8e4('0x70')]('userWhatsappAccount:remove',{'UserId':Number(_0x2d03c5[_0xf8e4('0x42')]['ids'][_0x16df40]),'WhatsappAccountId':Number(_0x2d03c5['params']['id'])});}}else{socket[_0xf8e4('0x70')]('userWhatsappAccount:remove',{'UserId':Number(_0x2d03c5[_0xf8e4('0x42')][_0xf8e4('0x6e')]),'WhatsappAccountId':Number(_0x2d03c5['params']['id'])});}});}})[_0xf8e4('0x34')](respondWithStatusCode(_0x540195,null))[_0xf8e4('0x27')](handleError(_0x540195,null));};exports[_0xf8e4('0x74')]=function(_0xd98667,_0x50ec40,_0x55c11f){var _0x567944={};var _0x2948b6={};var _0x14ccec;var _0x159a58;return db[_0xf8e4('0x3e')][_0xf8e4('0x67')]({'where':{'id':_0xd98667[_0xf8e4('0x62')]['id']}})[_0xf8e4('0x34')](handleEntityNotFound(_0x50ec40,null))[_0xf8e4('0x34')](function(_0x4f64bc){if(_0x4f64bc){_0x14ccec=_0x4f64bc;_0x2948b6[_0xf8e4('0x45')]=_[_0xf8e4('0x41')](db[_0xf8e4('0x75')][_0xf8e4('0x3f')]);_0x2948b6[_0xf8e4('0x42')]=_[_0xf8e4('0x41')](_0xd98667[_0xf8e4('0x42')]);_0x2948b6[_0xf8e4('0x43')]=_[_0xf8e4('0x44')](_0x2948b6[_0xf8e4('0x45')],_0x2948b6[_0xf8e4('0x42')]);_0x567944[_0xf8e4('0x46')]=_[_0xf8e4('0x44')](_0x2948b6['model'],qs[_0xf8e4('0x47')](_0xd98667[_0xf8e4('0x42')][_0xf8e4('0x47')]));_0x567944['attributes']=_0x567944[_0xf8e4('0x46')]['length']?_0x567944[_0xf8e4('0x46')]:_0x2948b6[_0xf8e4('0x45')];_0x567944[_0xf8e4('0x4b')]=qs[_0xf8e4('0x4c')](_0xd98667[_0xf8e4('0x42')]['sort']);_0x567944[_0xf8e4('0x4d')]=qs['filters'](_[_0xf8e4('0x4e')](_0xd98667[_0xf8e4('0x42')],_0x2948b6[_0xf8e4('0x43')]));if(_0xd98667['query']['filter']){_0x567944['where']=_[_0xf8e4('0x58')](_0x567944['where'],{'$or':_['map'](_0x567944[_0xf8e4('0x46')],function(_0x2bfdf3){var _0x502d18={};_0x502d18[_0x2bfdf3]={'$like':'%'+_0xd98667['query'][_0xf8e4('0x50')]+'%'};return _0x502d18;})});}_0x567944=_[_0xf8e4('0x58')]({},_0x567944,_0xd98667[_0xf8e4('0x51')]);return _0x14ccec[_0xf8e4('0x74')](_0x567944);}})['then'](function(_0x49d657){if(_0x49d657){_0x159a58=_0x49d657[_0xf8e4('0x48')];if(!_0xd98667[_0xf8e4('0x42')][_0xf8e4('0x49')](_0xf8e4('0x4a'))){_0x567944[_0xf8e4('0x2d')]=qs[_0xf8e4('0x2d')](_0xd98667[_0xf8e4('0x42')][_0xf8e4('0x2d')]);_0x567944[_0xf8e4('0x2b')]=qs['offset'](_0xd98667[_0xf8e4('0x42')][_0xf8e4('0x2b')]);}return _0x14ccec['getAgents'](_0x567944);}})['then'](function(_0x163234){if(_0x163234){return _0x163234?{'count':_0x159a58,'rows':_0x163234}:null;}})[_0xf8e4('0x34')](respondWithResult(_0x50ec40,null))[_0xf8e4('0x27')](handleError(_0x50ec40,null));};exports['addApplications']=function(_0x1513dc,_0x4f0fdb){var _0x1fda08=_0x1513dc[_0xf8e4('0x62')]['id'];var _0x63b19d=_0x1513dc['body'];var _0x16539a=0xc8;var _0x5f9a35=null;return db['sequelize'][_0xf8e4('0x76')]({'isolationLevel':db[_0xf8e4('0x77')][_0xf8e4('0x78')][_0xf8e4('0x79')][_0xf8e4('0x7a')]},function(_0x116e96){return db[_0xf8e4('0x3e')][_0xf8e4('0x67')]({'where':{'id':_0x1fda08},'transaction':_0x116e96})[_0xf8e4('0x34')](function(_0x5e7e52){if(_0x5e7e52){return db[_0xf8e4('0x7b')]['destroy']({'where':{'WhatsappAccountId':_0x1fda08},'transaction':_0x116e96})[_0xf8e4('0x34')](function(){var _0x468175=_['map'](_0x63b19d,function(_0x1c24e4){_0x1c24e4[_0xf8e4('0x6c')]=_0x1fda08;return _0x1c24e4;});return db[_0xf8e4('0x7b')][_0xf8e4('0x7c')](_0x468175,{'transaction':_0x116e96});});}else{_0x16539a=0x194;_0x5f9a35=[];}});})['then'](function(){if(_0x16539a!==0x194){return db[_0xf8e4('0x7b')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x1fda08},'order':_0xf8e4('0x7d')})[_0xf8e4('0x34')](function(_0x453661){_0x5f9a35=_0x453661;});}})[_0xf8e4('0x27')](function(_0x3fc94c){_0x16539a=0x1f4;logger[_0xf8e4('0x22')](_0x3fc94c[_0xf8e4('0x38')]);if(_0x3fc94c[_0xf8e4('0x39')]){delete _0x3fc94c[_0xf8e4('0x39')];}_0x5f9a35=_0x3fc94c;})['finally'](function(){if(_0x5f9a35===null){_0x4f0fdb[_0xf8e4('0x28')](_0x16539a);}else{if(_0x16539a===0x1f4){_0x4f0fdb[_0xf8e4('0x29')](_0x16539a)[_0xf8e4('0x7e')](_0x5f9a35);}else{_0x4f0fdb[_0xf8e4('0x29')](_0x16539a)[_0xf8e4('0x2a')](_0x5f9a35);}}});};exports[_0xf8e4('0x7f')]=function(_0x56e34e,_0x503fb1,_0x370dca){var _0x4dff1d={};var _0x521e5d={};var _0x466455;var _0x4c99a4;return db['WhatsappAccount'][_0xf8e4('0x67')]({'where':{'id':_0x56e34e[_0xf8e4('0x62')]['id']}})[_0xf8e4('0x34')](handleEntityNotFound(_0x503fb1,null))[_0xf8e4('0x34')](function(_0xaec586){if(_0xaec586){_0x466455=_0xaec586;_0x521e5d['model']=_[_0xf8e4('0x41')](db[_0xf8e4('0x7b')][_0xf8e4('0x3f')]);_0x521e5d[_0xf8e4('0x42')]=_[_0xf8e4('0x41')](_0x56e34e[_0xf8e4('0x42')]);_0x521e5d['filters']=_[_0xf8e4('0x44')](_0x521e5d[_0xf8e4('0x45')],_0x521e5d[_0xf8e4('0x42')]);_0x4dff1d['attributes']=_[_0xf8e4('0x44')](_0x521e5d[_0xf8e4('0x45')],qs['fields'](_0x56e34e[_0xf8e4('0x42')][_0xf8e4('0x47')]));_0x4dff1d['attributes']=_0x4dff1d[_0xf8e4('0x46')][_0xf8e4('0x48')]?_0x4dff1d['attributes']:_0x521e5d['model'];_0x4dff1d[_0xf8e4('0x4b')]=qs[_0xf8e4('0x4c')](_0x56e34e[_0xf8e4('0x42')]['sort']);_0x4dff1d[_0xf8e4('0x4d')]=qs[_0xf8e4('0x43')](_[_0xf8e4('0x4e')](_0x56e34e[_0xf8e4('0x42')],_0x521e5d['filters']));if(_0x56e34e[_0xf8e4('0x42')][_0xf8e4('0x50')]){_0x4dff1d[_0xf8e4('0x4d')]=_[_0xf8e4('0x58')](_0x4dff1d[_0xf8e4('0x4d')],{'$or':_[_0xf8e4('0x3d')](_0x4dff1d[_0xf8e4('0x46')],function(_0x82b5ce){var _0x940eb8={};_0x940eb8[_0x82b5ce]={'$like':'%'+_0x56e34e[_0xf8e4('0x42')]['filter']+'%'};return _0x940eb8;})});}_0x4dff1d=_[_0xf8e4('0x58')]({},_0x4dff1d,_0x56e34e[_0xf8e4('0x51')]);return _0x466455[_0xf8e4('0x7f')](_0x4dff1d);}})['then'](function(_0x1317d6){if(_0x1317d6){_0x4c99a4=_0x1317d6[_0xf8e4('0x48')];if(!_0x56e34e[_0xf8e4('0x42')][_0xf8e4('0x49')]('nolimit')){_0x4dff1d[_0xf8e4('0x2d')]=qs[_0xf8e4('0x2d')](_0x56e34e[_0xf8e4('0x42')][_0xf8e4('0x2d')]);_0x4dff1d[_0xf8e4('0x2b')]=qs[_0xf8e4('0x2b')](_0x56e34e['query'][_0xf8e4('0x2b')]);}return _0x466455[_0xf8e4('0x7f')](_0x4dff1d);}})['then'](function(_0x31662c){if(_0x31662c){return _0x31662c?{'count':_0x4c99a4,'rows':_0x31662c}:null;}})['then'](respondWithResult(_0x503fb1,null))['catch'](handleError(_0x503fb1,null));};exports[_0xf8e4('0x80')]=function(_0x50bb71,_0x27fd34,_0x556c8f){var _0x3dffb0={'channel':_0xf8e4('0x81')};var _0x186724=[];var _0x4883f9=[];var _0x15803c={};return db[_0xf8e4('0x3e')][_0xf8e4('0x5e')]({'where':{'id':_0x50bb71[_0xf8e4('0x62')]['id']},'include':[{'model':db[_0xf8e4('0x7b')],'as':_0xf8e4('0x82')}]})[_0xf8e4('0x34')](handleEntityNotFound(_0x27fd34,null))[_0xf8e4('0x34')](function(_0x338871){_0x3dffb0[_0xf8e4('0x83')]=_0x338871;if(_0x3dffb0[_0xf8e4('0x83')]&&_0x3dffb0[_0xf8e4('0x83')][_0xf8e4('0x4f')]===_0xf8e4('0x84')&&_0x50bb71[_0xf8e4('0x5a')][_0xf8e4('0x85')]){if(_0x50bb71['body'][_0xf8e4('0x85')]['length']===0x0)return;if(_0x50bb71[_0xf8e4('0x5a')]['statuses'][0x0][_0xf8e4('0x86')]!==_0xf8e4('0x87'))return;return db[_0xf8e4('0x88')][_0xf8e4('0x32')]({'read':!![],'readAt':_0x50bb71['body'][_0xf8e4('0x85')][0x0][_0xf8e4('0x89')]},{'where':{'messageId':_0x50bb71[_0xf8e4('0x5a')][_0xf8e4('0x85')][0x0]['message_id']},'individualHooks':!![]})[_0xf8e4('0x34')](function(_0x4d9418){return _0x27fd34[_0xf8e4('0x29')](0xc8)[_0xf8e4('0x2a')](_0x4d9418);});}_0x3dffb0[_0xf8e4('0x8a')]=_['orderBy'](_0x338871[_0xf8e4('0x82')],[_0xf8e4('0x7d')],[_0xf8e4('0x8b')]);if(_0x3dffb0[_0xf8e4('0x83')][_0xf8e4('0x82')]){delete _0x3dffb0[_0xf8e4('0x83')][_0xf8e4('0x82')];}return db[_0xf8e4('0x8c')][_0xf8e4('0x63')]()[_0xf8e4('0x34')](function(_0x3519aa){if(!_0x3519aa){throw new db['Sequelize'][(_0xf8e4('0x8d'))](_0xf8e4('0x8e'));}_0x186724=_[_0xf8e4('0x8f')](_[_0xf8e4('0x41')](_0x3519aa),['createdAt','updatedAt']);_0x4883f9=_[_0xf8e4('0x8f')](_['keys'](_0x3519aa),[_0xf8e4('0x90'),_0xf8e4('0x91'),_0xf8e4('0x92'),_0xf8e4('0x93')]);_0x3dffb0['body']={'mapKey':_0xf8e4('0x94')};if(_0x3dffb0[_0xf8e4('0x83')]&&_0x3dffb0[_0xf8e4('0x83')]['type']===_0xf8e4('0x95')){_0x3dffb0['body'][_0xf8e4('0x96')]=_0x50bb71[_0xf8e4('0x5a')][_0xf8e4('0x97')][_0xf8e4('0x98')]('whatsapp:','');_0x3dffb0[_0xf8e4('0x5a')][_0xf8e4('0x5a')]=_0x50bb71[_0xf8e4('0x5a')][_0xf8e4('0x99')];_0x3dffb0[_0xf8e4('0x5a')][_0xf8e4('0x9a')]=_0x50bb71[_0xf8e4('0x5a')][_0xf8e4('0x9b')];}if(_0x3dffb0[_0xf8e4('0x83')]&&_0x3dffb0[_0xf8e4('0x83')][_0xf8e4('0x4f')]==='sinch'){_0x3dffb0[_0xf8e4('0x5a')][_0xf8e4('0x96')]=_0x50bb71[_0xf8e4('0x5a')]['notifications'][0x0][_0xf8e4('0x96')];_0x3dffb0[_0xf8e4('0x5a')][_0xf8e4('0x5a')]=_0x50bb71[_0xf8e4('0x5a')][_0xf8e4('0x9c')][0x0]['message']['body'];_0x3dffb0[_0xf8e4('0x5a')]['messageId']=_0x50bb71['body'][_0xf8e4('0x9c')][0x0]['message_id'];}if(_0x3dffb0[_0xf8e4('0x5a')]['id']){delete _0x3dffb0[_0xf8e4('0x5a')]['id'];}if(_['isNil'](_0x3dffb0[_0xf8e4('0x5a')][_0xf8e4('0x96')])){throw new db[(_0xf8e4('0x9d'))][(_0xf8e4('0x8d'))](_0xf8e4('0x9e'));}if(_['isNil'](_0x3dffb0[_0xf8e4('0x5a')]['body'])||_0x3dffb0[_0xf8e4('0x5a')][_0xf8e4('0x5a')]===''){throw new db[(_0xf8e4('0x9d'))][(_0xf8e4('0x8d'))](_0xf8e4('0x9f'));}if(_[_0xf8e4('0xa0')](_0x3dffb0[_0xf8e4('0x5a')]['mapKey'])){throw new db[(_0xf8e4('0x9d'))][(_0xf8e4('0x8d'))](_0xf8e4('0xa1')+_0x4883f9);}if(!_[_0xf8e4('0xa2')](_0x4883f9,_0x3dffb0['body'][_0xf8e4('0xa3')])){throw new db[(_0xf8e4('0x9d'))][(_0xf8e4('0x8d'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4883f9);}_0x15803c[_0x3dffb0[_0xf8e4('0x5a')][_0xf8e4('0xa3')]]=_0x3dffb0[_0xf8e4('0x5a')][_0xf8e4('0x96')];return db['CmList']['find']({'where':{'id':_0x3dffb0[_0xf8e4('0x83')][_0xf8e4('0x93')]},'include':[{'model':db[_0xf8e4('0x8c')],'as':'Contacts','where':_0x15803c,'limit':0x1,'order':[['updatedAt',_0xf8e4('0xa4')]]}]});})['then'](handleEntityNotFound(_0x27fd34,null))[_0xf8e4('0x34')](function(_0x44ad78){if(_0x44ad78){_0x3dffb0['list']=_[_0xf8e4('0x6f')](_0x44ad78,[_0xf8e4('0xa5')]);if(_0x44ad78[_0xf8e4('0xa5')][_0xf8e4('0x48')]){return _0x44ad78['Contacts'][0x0];}var _0x58ecd9=_[_0xf8e4('0x17')](_0x3dffb0[_0xf8e4('0x5a')],{'firstName':_0x3dffb0[_0xf8e4('0x5a')][_0xf8e4('0x96')],'ListId':_0x44ad78['id']});_0x58ecd9[_0x3dffb0['body'][_0xf8e4('0xa3')]]=_0x3dffb0['body'][_0xf8e4('0x96')];return db[_0xf8e4('0x8c')][_0xf8e4('0x59')](_0x58ecd9,{'fields':_0x186724,'raw':!![]});}})[_0xf8e4('0x34')](handleEntityNotFound(_0x27fd34,null))[_0xf8e4('0x34')](function(_0x46b17c){if(_0x46b17c){_0x3dffb0[_0xf8e4('0xa6')]=_0x46b17c;var _0x450a8e={'ContactId':_0x46b17c['id'],'phone':_0x3dffb0[_0xf8e4('0x5a')][_0xf8e4('0x96')],'WhatsappAccountId':_0x50bb71[_0xf8e4('0x62')]['id']};var _0x4fa9cf={'ContactId':_0x46b17c['id'],'WhatsappAccountId':_0x50bb71[_0xf8e4('0x62')]['id'],'closed':![]};return db['WhatsappInteraction'][_0xf8e4('0x5e')]({'where':_0x4fa9cf})[_0xf8e4('0x34')](function(_0x1b5e13){if(_0x1b5e13){return[_0x1b5e13,![]];}return db[_0xf8e4('0xa7')]['create'](_0x450a8e)[_0xf8e4('0x34')](function(_0xce4742){return[_0xce4742,!![]];});});}})[_0xf8e4('0xa8')](function(_0x2475b4,_0x39fc41){_0x3dffb0['interaction']=_0x2475b4[_0xf8e4('0x35')]({'plain':!![]});_0x3dffb0[_0xf8e4('0xa9')][_0xf8e4('0xaa')]=![];if(_0x39fc41){if(_0x3dffb0['account'][_0xf8e4('0xab')]){_0x3dffb0[_0xf8e4('0x8a')]['push']({'id':0x0,'priority':_0x3dffb0[_0xf8e4('0x8a')][_0xf8e4('0x48')]+0x1,'app':'close','appdata':'unmanaged','interval':_0xf8e4('0xac')});}_0x3dffb0[_0xf8e4('0xa9')][_0xf8e4('0xaa')]=!![];}return db[_0xf8e4('0x88')][_0xf8e4('0x59')]({'phone':_0x3dffb0['body']['from'],'messageId':_0x3dffb0[_0xf8e4('0x5a')][_0xf8e4('0x9a')],'body':_0x3dffb0[_0xf8e4('0x5a')]['body'],'WhatsappAccountId':_0x50bb71['params']['id'],'WhatsappInteractionId':_0x2475b4['id'],'direction':'in','ContactId':_0x2475b4['ContactId'],'AttachmentId':_0x3dffb0['body'][_0xf8e4('0xad')]});})[_0xf8e4('0x34')](function(_0x5b1e26){_0x3dffb0[_0xf8e4('0x25')]=_0x5b1e26;if(_0x3dffb0[_0xf8e4('0xa9')][_0xf8e4('0xae')]){return db[_0xf8e4('0x75')][_0xf8e4('0x5e')]({'attributes':['id','name'],'where':{'id':_0x3dffb0[_0xf8e4('0xa9')][_0xf8e4('0xae')]}})[_0xf8e4('0x34')](function(_0x3b079b){if(_0x3b079b){_0x3dffb0[_0xf8e4('0x8a')][_0xf8e4('0xaf')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3b079b['name']+','+(_0x3dffb0[_0xf8e4('0x83')][_0xf8e4('0xb0')]||0xa),'interval':_0xf8e4('0xac')});}return respondWithRpcPromise(_0xf8e4('0xb1'),_0xf8e4('0xb2'),_0x3dffb0);});}return respondWithRpcPromise(_0xf8e4('0xb1'),_0xf8e4('0xb2'),_0x3dffb0);})[_0xf8e4('0x34')](function(_0x5c3eaa){if(_0x5c3eaa){var _0x40c9df=0xc8;var _0x1b01e0='receiveMessage';logger['info'](_0xf8e4('0x1f'),_0x1b01e0,_0x40c9df,_0xf8e4('0xb3'));logger[_0xf8e4('0x1e')](_0xf8e4('0xb4'),_0x1b01e0,_0x40c9df,'entity\x20found',JSON['stringify'](_0x5c3eaa));if(_0x3dffb0[_0xf8e4('0x83')][_0xf8e4('0x4f')]===_0xf8e4('0x95')){return _0x27fd34[_0xf8e4('0x29')](_0x40c9df)['set']('Content-Type','text/xml')[_0xf8e4('0x7e')](_0xf8e4('0xb5'));}else{return _0x27fd34['status'](_0x40c9df)[_0xf8e4('0x2a')](_0x5c3eaa);}}});})[_0xf8e4('0x27')](handleError(_0x27fd34,null));};exports[_0xf8e4('0x7e')]=function(_0xede215,_0x5c413e,_0x455e02){var _0x429f7c,_0x2c9066,_0x12e401;if(_[_0xf8e4('0xa0')](_0xede215['body'][_0xf8e4('0x5a')])||_0xede215[_0xf8e4('0x5a')][_0xf8e4('0x5a')]===''){throw new db[(_0xf8e4('0x9d'))][(_0xf8e4('0x8d'))](_0xf8e4('0x9f'));}if(_['isNil'](_0xede215['body']['to'])){throw new db[(_0xf8e4('0x9d'))]['ValidationError'](_0xf8e4('0xb6'));}_0x429f7c=_0xede215[_0xf8e4('0x5a')]['to'];return db['WhatsappAccount'][_0xf8e4('0x5e')]({'where':{'id':_0xede215[_0xf8e4('0x62')]['id']},'include':[{'model':db[_0xf8e4('0xb7')],'as':_0xf8e4('0xb8'),'include':[{'model':db['CmContact'],'as':_0xf8e4('0xa5'),'where':{'mobile':_0x429f7c},'limit':0x1,'order':[['updatedAt',_0xf8e4('0xa4')]]}]}]})['then'](handleEntityNotFound(_0x5c413e,null))[_0xf8e4('0x34')](function(_0x22cf74){if(_0x22cf74&&_0x22cf74[_0xf8e4('0xb8')]){_0x2c9066=_0x22cf74[_0xf8e4('0x35')]({'plain':!![]});if(_0x2c9066[_0xf8e4('0xb8')]&&_0x2c9066[_0xf8e4('0xb8')][_0xf8e4('0xa5')][_0xf8e4('0x48')]){return _0x2c9066[_0xf8e4('0xb8')][_0xf8e4('0xa5')][0x0];}return db[_0xf8e4('0x8c')][_0xf8e4('0x59')](_[_0xf8e4('0x17')](_0xede215[_0xf8e4('0x5a')],{'firstName':_0x429f7c,'mobile':_0x429f7c,'phone':_0x429f7c,'ListId':_0x2c9066[_0xf8e4('0x93')]}));}})[_0xf8e4('0x34')](handleEntityNotFound(_0x5c413e,null))[_0xf8e4('0x34')](function(_0x800f58){if(_0x800f58){_0x12e401=_0x800f58;return db[_0xf8e4('0xa7')][_0xf8e4('0x5e')]({'where':{'ContactId':_0x12e401['id'],'closed':![],'WhatsappAccountId':_0x2c9066['id']}})['then'](function(_0x292bfb){if(_0x292bfb){return[_0x292bfb,![]];}return db[_0xf8e4('0xa7')][_0xf8e4('0x59')]({'UserId':_0xede215[_0xf8e4('0x5b')]['id'],'ContactId':_0x12e401['id'],'WhatsappAccountId':_0x2c9066['id'],'phone':_0x429f7c,'firstMsgDirection':_0xf8e4('0xb9'),'Messages':[_[_0xf8e4('0x58')](_0xede215['body'],{'read':![],'body':_0xede215[_0xf8e4('0x5a')][_0xf8e4('0x5a')],'phone':_0x429f7c,'WhatsappAccountId':_0x2c9066['id'],'UserId':_0xede215['user']['id'],'ContactId':_0x12e401['id']})]},{'include':[{'model':db[_0xf8e4('0x88')],'as':_0xf8e4('0xba')}]})[_0xf8e4('0x34')](function(_0x17d8cb){return[_0x17d8cb,!![]];});});}})['spread'](function(_0x2e6f92,_0x185339){if(_0x185339){return _0x2e6f92;}return db[_0xf8e4('0x88')][_0xf8e4('0x59')](_[_0xf8e4('0x58')](_0xede215[_0xf8e4('0x5a')],{'read':![],'body':_0xede215[_0xf8e4('0x5a')][_0xf8e4('0x5a')],'phone':_0x429f7c,'WhatsappAccountId':_0x2c9066['id'],'WhatsappInteractionId':_0x2e6f92['id'],'UserId':_0xede215[_0xf8e4('0x5b')]['id'],'ContactId':_0x12e401['id']}))[_0xf8e4('0x34')](function(_0x37903e){_0x2e6f92[_0xf8e4('0xbb')][_0xf8e4('0xba')]=[];_0x2e6f92['dataValues'][_0xf8e4('0xba')]['push'](_0x37903e[_0xf8e4('0xbb')]);return _0x2e6f92;});})[_0xf8e4('0x34')](respondWithResult(_0x5c413e,null))[_0xf8e4('0x27')](handleError(_0x5c413e,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index a1d3204..3713271 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 _0x53c3=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','save'];(function(_0x41cfd4,_0x1ed2cc){var _0x190f48=function(_0x4b5b1a){while(--_0x4b5b1a){_0x41cfd4['push'](_0x41cfd4['shift']());}};_0x190f48(++_0x1ed2cc);}(_0x53c3,0x103));var _0x353c=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x53c3[_0x36c5b0];return _0xf19333;};'use strict';var EventEmitter=require(_0x353c('0x0'));var WhatsappAccount=require(_0x353c('0x1'))['db'][_0x353c('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x353c('0x3')](0x0);var events={'afterCreate':_0x353c('0x4'),'afterUpdate':_0x353c('0x5'),'afterDestroy':_0x353c('0x6')};function emitEvent(_0x1e3566){return function(_0x22481f,_0x100e6d,_0x3620f8){WhatsappAccountEvents[_0x353c('0x7')](_0x1e3566+':'+_0x22481f['id'],_0x22481f);WhatsappAccountEvents[_0x353c('0x7')](_0x1e3566,_0x22481f);_0x3620f8(null);};}for(var e in events){if(events[_0x353c('0x8')](e)){var event=events[e];WhatsappAccount[_0x353c('0x9')](e,emitEvent(event));}}module[_0x353c('0xa')]=WhatsappAccountEvents; \ No newline at end of file +var _0x752d=['setMaxListeners','update','remove','hasOwnProperty','exports','events','../../mysqldb','WhatsappAccount'];(function(_0x25df29,_0x33979f){var _0x33da8f=function(_0x1a35c4){while(--_0x1a35c4){_0x25df29['push'](_0x25df29['shift']());}};_0x33da8f(++_0x33979f);}(_0x752d,0xa5));var _0xd752=function(_0x25b3a8,_0x458c8d){_0x25b3a8=_0x25b3a8-0x0;var _0x1eb9bf=_0x752d[_0x25b3a8];return _0x1eb9bf;};'use strict';var EventEmitter=require(_0xd752('0x0'));var WhatsappAccount=require(_0xd752('0x1'))['db'][_0xd752('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xd752('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd752('0x4'),'afterDestroy':_0xd752('0x5')};function emitEvent(_0x100a59){return function(_0x53ce39,_0x1991d6,_0xeaa966){WhatsappAccountEvents['emit'](_0x100a59+':'+_0x53ce39['id'],_0x53ce39);WhatsappAccountEvents['emit'](_0x100a59,_0x53ce39);_0xeaa966(null);};}for(var e in events){if(events[_0xd752('0x6')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0xd752('0x7')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index feb660b..19837b0 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 _0x11c8=['./whatsappAccount.attributes','exports','define','WhatsappAccount','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1aefea,_0x39e5fa){var _0x33a7a1=function(_0x5cef45){while(--_0x5cef45){_0x1aefea['push'](_0x1aefea['shift']());}};_0x33a7a1(++_0x39e5fa);}(_0x11c8,0x94));var _0x811c=function(_0x3c3195,_0x595377){_0x3c3195=_0x3c3195-0x0;var _0x2ee24e=_0x11c8[_0x3c3195];return _0x2ee24e;};'use strict';var _=require('lodash');var util=require(_0x811c('0x0'));var logger=require('../../config/logger')(_0x811c('0x1'));var moment=require(_0x811c('0x2'));var BPromise=require(_0x811c('0x3'));var rp=require(_0x811c('0x4'));var fs=require('fs');var path=require(_0x811c('0x5'));var rimraf=require(_0x811c('0x6'));var config=require(_0x811c('0x7'));var attributes=require(_0x811c('0x8'));module[_0x811c('0x9')]=function(_0x5246e3,_0x4693af){return _0x5246e3[_0x811c('0xa')](_0x811c('0xb'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1e57=['request-promise','path','rimraf','./whatsappAccount.attributes','define','WhatsappAccount','lodash','util','api','bluebird'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0x1e57,0x178));var _0x71e5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1e57[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x71e5('0x0'));var util=require(_0x71e5('0x1'));var logger=require('../../config/logger')(_0x71e5('0x2'));var moment=require('moment');var BPromise=require(_0x71e5('0x3'));var rp=require(_0x71e5('0x4'));var fs=require('fs');var path=require(_0x71e5('0x5'));var rimraf=require(_0x71e5('0x6'));var config=require('../../config/environment');var attributes=require(_0x71e5('0x7'));module['exports']=function(_0x4dfdc4,_0x31b74d){return _0x4dfdc4[_0x71e5('0x8')](_0x71e5('0x9'),attributes,{'tableName':'whatsapp_accounts','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 755e016..ee642e5 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 _0xb923=['../../config/logger','rpc','../../config/environment','client','redis','localhost','./whatsappAccount.socket','register','request','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','ShowWhatsappAccount','WhatsappAccount','find','options','raw','attributes','include','map','model','stringify','moment','bluebird','ioredis','../../config/utils'];(function(_0x5c0034,_0x2ab9b7){var _0x59b18f=function(_0x47043b){while(--_0x47043b){_0x5c0034['push'](_0x5c0034['shift']());}};_0x59b18f(++_0x2ab9b7);}(_0xb923,0x80));var _0x3b92=function(_0x2a2e3d,_0x2b8f7c){_0x2a2e3d=_0x2a2e3d-0x0;var _0x41b39f=_0xb923[_0x2a2e3d];return _0x41b39f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3b92('0x0'));var BPromise=require(_0x3b92('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b92('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3b92('0x3'));var logger=require(_0x3b92('0x4'))(_0x3b92('0x5'));var config=require(_0x3b92('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3b92('0x7')]['http']({'port':0x232a});config[_0x3b92('0x8')]=_['defaults'](config[_0x3b92('0x8')],{'host':_0x3b92('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3b92('0x8')]));require(_0x3b92('0xa'))[_0x3b92('0xb')](socket);function respondWithRpcPromise(_0x4b729d,_0x404427,_0x258014){return new BPromise(function(_0x55da1b,_0x2cdecb){return client[_0x3b92('0xc')](_0x4b729d,_0x258014)[_0x3b92('0xd')](function(_0x490dca){logger[_0x3b92('0xe')]('WhatsappAccount,\x20%s,\x20%s',_0x404427,_0x3b92('0xf'));logger[_0x3b92('0x10')](_0x3b92('0x11'),_0x404427,_0x3b92('0xf'),JSON['stringify'](_0x490dca));if(_0x490dca[_0x3b92('0x12')]){if(_0x490dca[_0x3b92('0x12')][_0x3b92('0x13')]===0x1f4){logger[_0x3b92('0x12')](_0x3b92('0x14'),_0x404427,_0x490dca['error'][_0x3b92('0x15')]);return _0x2cdecb(_0x490dca[_0x3b92('0x12')]['message']);}logger[_0x3b92('0x12')](_0x3b92('0x14'),_0x404427,_0x490dca[_0x3b92('0x12')][_0x3b92('0x15')]);return _0x55da1b(_0x490dca[_0x3b92('0x12')][_0x3b92('0x15')]);}else{logger[_0x3b92('0xe')]('WhatsappAccount,\x20%s,\x20%s',_0x404427,'request\x20sent');_0x55da1b(_0x490dca[_0x3b92('0x16')][_0x3b92('0x15')]);}})['catch'](function(_0x62052d){logger[_0x3b92('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0x404427,_0x62052d);_0x2cdecb(_0x62052d);});});}exports[_0x3b92('0x17')]=function(_0x3f2a14){var _0x36bbf6=this;return new Promise(function(_0x2db315,_0x29a5f2){return db[_0x3b92('0x18')][_0x3b92('0x19')]({'raw':_0x3f2a14[_0x3b92('0x1a')]?_0x3f2a14['options'][_0x3b92('0x1b')]===undefined?!![]:![]:!![],'where':_0x3f2a14[_0x3b92('0x1a')]?_0x3f2a14[_0x3b92('0x1a')]['where']||null:null,'attributes':_0x3f2a14[_0x3b92('0x1a')]?_0x3f2a14['options'][_0x3b92('0x1c')]||null:null,'include':_0x3f2a14['options']?_0x3f2a14[_0x3b92('0x1a')][_0x3b92('0x1d')]?_[_0x3b92('0x1e')](_0x3f2a14[_0x3b92('0x1a')][_0x3b92('0x1d')],function(_0x1fdefd){return{'model':db[_0x1fdefd[_0x3b92('0x1f')]],'as':_0x1fdefd['as'],'attributes':_0x1fdefd[_0x3b92('0x1c')],'include':_0x1fdefd['include']?_[_0x3b92('0x1e')](_0x1fdefd['include'],function(_0xcbe6ed){return{'model':db[_0xcbe6ed[_0x3b92('0x1f')]],'as':_0xcbe6ed['as'],'attributes':_0xcbe6ed[_0x3b92('0x1c')],'include':_0xcbe6ed[_0x3b92('0x1d')]?_[_0x3b92('0x1e')](_0xcbe6ed['include'],function(_0x482f0f){return{'model':db[_0x482f0f[_0x3b92('0x1f')]],'as':_0x482f0f['as'],'attributes':_0x482f0f[_0x3b92('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x32b4dc){logger[_0x3b92('0xe')]('ShowWhatsappAccount',_0x3f2a14);logger['debug'](_0x3b92('0x17'),_0x3f2a14,JSON[_0x3b92('0x20')](_0x32b4dc));_0x2db315(_0x32b4dc);})['catch'](function(_0x4187a3){logger[_0x3b92('0x12')](_0x3b92('0x17'),_0x4187a3['message'],_0x3f2a14);_0x29a5f2(_0x36bbf6[_0x3b92('0x12')](0x1f4,_0x4187a3['message']));});});}; \ No newline at end of file +var _0x9a4d=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','WhatsappAccount,\x20%s,\x20%s','message','find','options','raw','where','attributes','map','include','model','catch','ShowWhatsappAccount','lodash','util'];(function(_0x13e293,_0xe47578){var _0x381297=function(_0x51d31a){while(--_0x51d31a){_0x13e293['push'](_0x13e293['shift']());}};_0x381297(++_0xe47578);}(_0x9a4d,0xb7));var _0xd9a4=function(_0x486338,_0x2ab3f9){_0x486338=_0x486338-0x0;var _0x4c8298=_0x9a4d[_0x486338];return _0x4c8298;};'use strict';var _=require(_0xd9a4('0x0'));var util=require(_0xd9a4('0x1'));var moment=require(_0xd9a4('0x2'));var BPromise=require(_0xd9a4('0x3'));var rs=require(_0xd9a4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd9a4('0x5'))['db'];var utils=require(_0xd9a4('0x6'));var logger=require(_0xd9a4('0x7'))(_0xd9a4('0x8'));var config=require(_0xd9a4('0x9'));var jayson=require(_0xd9a4('0xa'));var client=jayson[_0xd9a4('0xb')]['http']({'port':0x232a});config[_0xd9a4('0xc')]=_[_0xd9a4('0xd')](config[_0xd9a4('0xc')],{'host':_0xd9a4('0xe'),'port':0x18eb});var socket=require(_0xd9a4('0xf'))(new Redis(config[_0xd9a4('0xc')]));require(_0xd9a4('0x10'))[_0xd9a4('0x11')](socket);function respondWithRpcPromise(_0x398af7,_0x3c405c,_0x45b7dc){return new BPromise(function(_0x1c09c8,_0x37c44c){return client[_0xd9a4('0x12')](_0x398af7,_0x45b7dc)[_0xd9a4('0x13')](function(_0x684462){logger[_0xd9a4('0x14')]('WhatsappAccount,\x20%s,\x20%s',_0x3c405c,_0xd9a4('0x15'));logger['debug'](_0xd9a4('0x16'),_0x3c405c,'request\x20sent',JSON['stringify'](_0x684462));if(_0x684462['error']){if(_0x684462[_0xd9a4('0x17')][_0xd9a4('0x18')]===0x1f4){logger['error'](_0xd9a4('0x19'),_0x3c405c,_0x684462[_0xd9a4('0x17')][_0xd9a4('0x1a')]);return _0x37c44c(_0x684462[_0xd9a4('0x17')][_0xd9a4('0x1a')]);}logger[_0xd9a4('0x17')](_0xd9a4('0x19'),_0x3c405c,_0x684462[_0xd9a4('0x17')][_0xd9a4('0x1a')]);return _0x1c09c8(_0x684462[_0xd9a4('0x17')][_0xd9a4('0x1a')]);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x3c405c,_0xd9a4('0x15'));_0x1c09c8(_0x684462['result']['message']);}})['catch'](function(_0x575f5d){logger[_0xd9a4('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x3c405c,_0x575f5d);_0x37c44c(_0x575f5d);});});}exports['ShowWhatsappAccount']=function(_0x2ed7e8){var _0x44de20=this;return new Promise(function(_0x199163,_0x584c3b){return db['WhatsappAccount'][_0xd9a4('0x1b')]({'raw':_0x2ed7e8[_0xd9a4('0x1c')]?_0x2ed7e8[_0xd9a4('0x1c')][_0xd9a4('0x1d')]===undefined?!![]:![]:!![],'where':_0x2ed7e8[_0xd9a4('0x1c')]?_0x2ed7e8[_0xd9a4('0x1c')][_0xd9a4('0x1e')]||null:null,'attributes':_0x2ed7e8[_0xd9a4('0x1c')]?_0x2ed7e8['options'][_0xd9a4('0x1f')]||null:null,'include':_0x2ed7e8['options']?_0x2ed7e8[_0xd9a4('0x1c')]['include']?_[_0xd9a4('0x20')](_0x2ed7e8[_0xd9a4('0x1c')][_0xd9a4('0x21')],function(_0x17a8e8){return{'model':db[_0x17a8e8[_0xd9a4('0x22')]],'as':_0x17a8e8['as'],'attributes':_0x17a8e8[_0xd9a4('0x1f')],'include':_0x17a8e8[_0xd9a4('0x21')]?_[_0xd9a4('0x20')](_0x17a8e8[_0xd9a4('0x21')],function(_0x446f9e){return{'model':db[_0x446f9e[_0xd9a4('0x22')]],'as':_0x446f9e['as'],'attributes':_0x446f9e[_0xd9a4('0x1f')],'include':_0x446f9e[_0xd9a4('0x21')]?_[_0xd9a4('0x20')](_0x446f9e[_0xd9a4('0x21')],function(_0x3d8c2f){return{'model':db[_0x3d8c2f['model']],'as':_0x3d8c2f['as'],'attributes':_0x3d8c2f['attributes']};}):[]};}):[]};}):[]:[]})[_0xd9a4('0x13')](function(_0xd9861c){logger[_0xd9a4('0x14')]('ShowWhatsappAccount',_0x2ed7e8);logger['debug']('ShowWhatsappAccount',_0x2ed7e8,JSON['stringify'](_0xd9861c));_0x199163(_0xd9861c);})[_0xd9a4('0x23')](function(_0x32aa15){logger['error'](_0xd9a4('0x24'),_0x32aa15['message'],_0x2ed7e8);_0x584c3b(_0x44de20[_0xd9a4('0x17')](0x1f4,_0x32aa15[_0xd9a4('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index d8768fc..765cf2c 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 _0x54f4=['./whatsappAccount.events','save','remove','update','emit','register','length'];(function(_0x5cbd7b,_0x207439){var _0x3fdfb8=function(_0x4eb12e){while(--_0x4eb12e){_0x5cbd7b['push'](_0x5cbd7b['shift']());}};_0x3fdfb8(++_0x207439);}(_0x54f4,0x118));var _0x454f=function(_0x111a1b,_0x505ff1){_0x111a1b=_0x111a1b-0x0;var _0x533d2f=_0x54f4[_0x111a1b];return _0x533d2f;};'use strict';var WhatsappAccountEvents=require(_0x454f('0x0'));var events=[_0x454f('0x1'),_0x454f('0x2'),_0x454f('0x3')];function createListener(_0x5689b4,_0x2486a4){return function(_0x40766c){_0x2486a4[_0x454f('0x4')](_0x5689b4,_0x40766c);};}function removeListener(_0x1ef501,_0x11b8a0){return function(){WhatsappAccountEvents['removeListener'](_0x1ef501,_0x11b8a0);};}exports[_0x454f('0x5')]=function(_0x20d6e8){for(var _0x20c9aa=0x0,_0x4fa905=events[_0x454f('0x6')];_0x20c9aa<_0x4fa905;_0x20c9aa++){var _0x208369=events[_0x20c9aa];var _0x31a5ac=createListener('whatsappAccount:'+_0x208369,_0x20d6e8);WhatsappAccountEvents['on'](_0x208369,_0x31a5ac);}}; \ No newline at end of file +var _0xbfc7=['register','whatsappAccount:','./whatsappAccount.events','save','remove','emit'];(function(_0x5135a8,_0x593d1d){var _0x2f511c=function(_0x4d1410){while(--_0x4d1410){_0x5135a8['push'](_0x5135a8['shift']());}};_0x2f511c(++_0x593d1d);}(_0xbfc7,0xc2));var _0x7bfc=function(_0x507756,_0x55479d){_0x507756=_0x507756-0x0;var _0x54ef10=_0xbfc7[_0x507756];return _0x54ef10;};'use strict';var WhatsappAccountEvents=require(_0x7bfc('0x0'));var events=[_0x7bfc('0x1'),_0x7bfc('0x2'),'update'];function createListener(_0x25006c,_0x15ae29){return function(_0x2bc89b){_0x15ae29[_0x7bfc('0x3')](_0x25006c,_0x2bc89b);};}function removeListener(_0x21cbcb,_0x2f77c9){return function(){WhatsappAccountEvents['removeListener'](_0x21cbcb,_0x2f77c9);};}exports[_0x7bfc('0x4')]=function(_0x12c80f){for(var _0x3d92e3=0x0,_0xeb7a57=events['length'];_0x3d92e3<_0xeb7a57;_0x3d92e3++){var _0x74ba95=events[_0x3d92e3];var _0x36f1c5=createListener(_0x7bfc('0x5')+_0x74ba95,_0x12c80f);WhatsappAccountEvents['on'](_0x74ba95,_0x36f1c5);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 36705bb..6c69fcb 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 _0x7a1d=['delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','create','put','/:id'];(function(_0x135c3d,_0xf4d149){var _0x23c7ea=function(_0x2de680){while(--_0x2de680){_0x135c3d['push'](_0x135c3d['shift']());}};_0x23c7ea(++_0xf4d149);}(_0x7a1d,0xad));var _0xd7a1=function(_0x2eb3db,_0x4a32c0){_0x2eb3db=_0x2eb3db-0x0;var _0x358f33=_0x7a1d[_0x2eb3db];return _0x358f33;};'use strict';var multer=require(_0xd7a1('0x0'));var util=require(_0xd7a1('0x1'));var path=require(_0xd7a1('0x2'));var timeout=require(_0xd7a1('0x3'));var express=require(_0xd7a1('0x4'));var router=express[_0xd7a1('0x5')]();var fs_extra=require(_0xd7a1('0x6'));var auth=require(_0xd7a1('0x7'));var interaction=require(_0xd7a1('0x8'));var config=require(_0xd7a1('0x9'));var controller=require('./whatsappApplication.controller');router[_0xd7a1('0xa')]('/',auth[_0xd7a1('0xb')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xd7a1('0xc')]);router[_0xd7a1('0xd')]('/',auth[_0xd7a1('0xb')](),controller[_0xd7a1('0xe')]);router[_0xd7a1('0xf')](_0xd7a1('0x10'),auth[_0xd7a1('0xb')](),controller['update']);router[_0xd7a1('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xd7a1('0x12')]=router; \ No newline at end of file +var _0x34b1=['fs-extra','../../components/auth/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x5e6c33,_0x4f157a){var _0x142bc9=function(_0x2d2415){while(--_0x2d2415){_0x5e6c33['push'](_0x5e6c33['shift']());}};_0x142bc9(++_0x4f157a);}(_0x34b1,0xb5));var _0x134b=function(_0x26393b,_0x449a84){_0x26393b=_0x26393b-0x0;var _0x57230a=_0x34b1[_0x26393b];return _0x57230a;};'use strict';var multer=require(_0x134b('0x0'));var util=require(_0x134b('0x1'));var path=require(_0x134b('0x2'));var timeout=require(_0x134b('0x3'));var express=require(_0x134b('0x4'));var router=express[_0x134b('0x5')]();var fs_extra=require(_0x134b('0x6'));var auth=require(_0x134b('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x134b('0x8'));var controller=require(_0x134b('0x9'));router[_0x134b('0xa')]('/',auth[_0x134b('0xb')](),controller[_0x134b('0xc')]);router[_0x134b('0xa')](_0x134b('0xd'),auth[_0x134b('0xb')](),controller['show']);router['post']('/',auth[_0x134b('0xb')](),controller['create']);router['put'](_0x134b('0xd'),auth[_0x134b('0xb')](),controller[_0x134b('0xe')]);router[_0x134b('0xf')]('/:id',auth[_0x134b('0xb')](),controller['destroy']);module[_0x134b('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index fcd66a8..f7de9ed 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 _0xf04b=['STRING','INTEGER','TEXT'];(function(_0x20874f,_0x49de8f){var _0x276715=function(_0x245f18){while(--_0x245f18){_0x20874f['push'](_0x20874f['shift']());}};_0x276715(++_0x49de8f);}(_0xf04b,0x175));var _0xbf04=function(_0x4fde8d,_0xa952a2){_0x4fde8d=_0x4fde8d-0x0;var _0x5f1fa8=_0xf04b[_0x4fde8d];return _0x5f1fa8;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0xbf04('0x0')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xbf04('0x1')]()},'description':{'type':Sequelize[_0xbf04('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xf2e3=['noop','sequelize','exports','INTEGER','STRING'];(function(_0x338991,_0x1a3836){var _0x503102=function(_0x234048){while(--_0x234048){_0x338991['push'](_0x338991['shift']());}};_0x503102(++_0x1a3836);}(_0xf2e3,0x173));var _0x3f2e=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0xf2e3[_0x176329];return _0x31997c;};'use strict';var Sequelize=require(_0x3f2e('0x0'));module[_0x3f2e('0x1')]={'priority':{'type':Sequelize[_0x3f2e('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x3f2e('0x3')],'allowNull':![],'defaultValue':_0x3f2e('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x3f2e('0x3')]},'interval':{'type':Sequelize[_0x3f2e('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 204a3ca..147a254 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 _0xc1c6=['type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','WhatsappApplication','rawAttributes'];(function(_0x741b9a,_0x44c670){var _0x4bf212=function(_0x55e5b6){while(--_0x55e5b6){_0x741b9a['push'](_0x741b9a['shift']());}};_0x4bf212(++_0x44c670);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x3a7c79,_0x168f3b){_0x3a7c79=_0x3a7c79-0x0;var _0x57535c=_0xc1c6[_0x3a7c79];return _0x57535c;};'use strict';var emlformat=require(_0x6c1c('0x0'));var rimraf=require(_0x6c1c('0x1'));var zipdir=require(_0x6c1c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6c1c('0x3'));var moment=require('moment');var BPromise=require(_0x6c1c('0x4'));var Mustache=require(_0x6c1c('0x5'));var util=require(_0x6c1c('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x6c1c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c1c('0x8'));var _=require('lodash');var squel=require(_0x6c1c('0x9'));var crypto=require(_0x6c1c('0xa'));var jsforce=require(_0x6c1c('0xb'));var deskjs=require(_0x6c1c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6c1c('0xd'));var Papa=require(_0x6c1c('0xe'));var Redis=require('ioredis');var authService=require(_0x6c1c('0xf'));var qs=require(_0x6c1c('0x10'));var as=require(_0x6c1c('0x11'));var hardwareService=require(_0x6c1c('0x12'));var logger=require('../../config/logger')(_0x6c1c('0x13'));var utils=require(_0x6c1c('0x14'));var config=require(_0x6c1c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c1c('0x16'))['db'];function respondWithStatusCode(_0x12a9e6,_0x2067bd){_0x2067bd=_0x2067bd||0xcc;return function(_0x49304f){if(_0x49304f){return _0x12a9e6[_0x6c1c('0x17')](_0x2067bd);}return _0x12a9e6['status'](_0x2067bd)[_0x6c1c('0x18')]();};}function respondWithResult(_0x15a1fc,_0x2d279e){_0x2d279e=_0x2d279e||0xc8;return function(_0x154107){if(_0x154107){return _0x15a1fc[_0x6c1c('0x19')](_0x2d279e)[_0x6c1c('0x1a')](_0x154107);}};}function respondWithFilteredResult(_0x297c33,_0x41aa74){return function(_0x448f35){if(_0x448f35){var _0x5f3758=typeof _0x41aa74[_0x6c1c('0x1b')]===_0x6c1c('0x1c')&&typeof _0x41aa74['limit']===_0x6c1c('0x1c');var _0x237cac=_0x448f35['count'];var _0x137770=_0x5f3758?0x0:_0x41aa74['offset'];var _0x338dc2=_0x5f3758?_0x448f35[_0x6c1c('0x1d')]:_0x41aa74['offset']+_0x41aa74[_0x6c1c('0x1e')];var _0x59ab38;if(_0x338dc2>=_0x237cac){_0x338dc2=_0x237cac;_0x59ab38=0xc8;}else{_0x59ab38=0xce;}_0x297c33[_0x6c1c('0x19')](_0x59ab38);return _0x297c33[_0x6c1c('0x1f')](_0x6c1c('0x20'),_0x137770+'-'+_0x338dc2+'/'+_0x237cac)[_0x6c1c('0x1a')](_0x448f35);}return null;};}function patchUpdates(_0x1acf7f){return function(_0x1efb19){try{jsonpatch[_0x6c1c('0x21')](_0x1efb19,_0x1acf7f,!![]);}catch(_0x2ed830){return BPromise[_0x6c1c('0x22')](_0x2ed830);}return _0x1efb19[_0x6c1c('0x23')]();};}function saveUpdates(_0x3d2bf3,_0x450b1f){return function(_0x2382c0){if(_0x2382c0){return _0x2382c0[_0x6c1c('0x24')](_0x3d2bf3)[_0x6c1c('0x25')](function(_0x19c269){return _0x19c269;});}return null;};}function removeEntity(_0x2319d3,_0x12c638){return function(_0x3a3f13){if(_0x3a3f13){return _0x3a3f13[_0x6c1c('0x26')]()[_0x6c1c('0x25')](function(){_0x2319d3[_0x6c1c('0x19')](0xcc)[_0x6c1c('0x18')]();});}};}function handleEntityNotFound(_0x7ff10d,_0x18452d){return function(_0x80bc05){if(!_0x80bc05){_0x7ff10d[_0x6c1c('0x17')](0x194);}return _0x80bc05;};}function handleError(_0x1b9d7d,_0x2feaf4){_0x2feaf4=_0x2feaf4||0x1f4;return function(_0x5f4568){logger[_0x6c1c('0x27')](_0x5f4568['stack']);if(_0x5f4568[_0x6c1c('0x28')]){delete _0x5f4568['name'];}_0x1b9d7d[_0x6c1c('0x19')](_0x2feaf4)['send'](_0x5f4568);};}exports[_0x6c1c('0x29')]=function(_0xf557ba,_0x504348){var _0x3b1a4f={},_0x24da4c={},_0x4e13e3={'count':0x0,'rows':[]};var _0x3b319a=_[_0x6c1c('0x2a')](db[_0x6c1c('0x2b')][_0x6c1c('0x2c')],function(_0x4fc279){return{'name':_0x4fc279['fieldName'],'type':_0x4fc279[_0x6c1c('0x2d')][_0x6c1c('0x2e')]};});_0x24da4c[_0x6c1c('0x2f')]=_[_0x6c1c('0x2a')](_0x3b319a,_0x6c1c('0x28'));_0x24da4c[_0x6c1c('0x30')]=_['keys'](_0xf557ba[_0x6c1c('0x30')]);_0x24da4c[_0x6c1c('0x31')]=_['intersection'](_0x24da4c[_0x6c1c('0x2f')],_0x24da4c[_0x6c1c('0x30')]);_0x3b1a4f[_0x6c1c('0x32')]=_[_0x6c1c('0x33')](_0x24da4c['model'],qs[_0x6c1c('0x34')](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x34')]));_0x3b1a4f['attributes']=_0x3b1a4f[_0x6c1c('0x32')]['length']?_0x3b1a4f[_0x6c1c('0x32')]:_0x24da4c['model'];if(!_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x35')](_0x6c1c('0x36'))){_0x3b1a4f['limit']=qs['limit'](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x1e')]);_0x3b1a4f[_0x6c1c('0x1b')]=qs['offset'](_0xf557ba[_0x6c1c('0x30')]['offset']);}_0x3b1a4f['order']=qs[_0x6c1c('0x37')](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x37')]);_0x3b1a4f[_0x6c1c('0x38')]=qs['filters'](_[_0x6c1c('0x39')](_0xf557ba[_0x6c1c('0x30')],_0x24da4c[_0x6c1c('0x31')]),_0x3b319a);if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3a')]){_0x3b1a4f[_0x6c1c('0x38')]=_[_0x6c1c('0x3b')](_0x3b1a4f[_0x6c1c('0x38')],{'$or':_[_0x6c1c('0x2a')](_0x3b319a,function(_0x232508){if(_0x232508['type']!==_0x6c1c('0x3c')){var _0x464549={};_0x464549[_0x232508[_0x6c1c('0x28')]]={'$like':'%'+_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3a')]+'%'};return _0x464549;}})});}_0x3b1a4f=_['merge']({},_0x3b1a4f,_0xf557ba['options']);var _0x549db1={'where':_0x3b1a4f[_0x6c1c('0x38')]};return db['WhatsappApplication']['count'](_0x549db1)[_0x6c1c('0x25')](function(_0x37244e){_0x4e13e3['count']=_0x37244e;if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x3b1a4f[_0x6c1c('0x3e')]=[{'all':!![]}];}return db['WhatsappApplication'][_0x6c1c('0x3f')](_0x3b1a4f);})[_0x6c1c('0x25')](function(_0x502e75){_0x4e13e3[_0x6c1c('0x40')]=_0x502e75;return _0x4e13e3;})['then'](respondWithFilteredResult(_0x504348,_0x3b1a4f))[_0x6c1c('0x41')](handleError(_0x504348,null));};exports[_0x6c1c('0x42')]=function(_0x16a389,_0x174f2c){var _0x10764a={'raw':!![],'where':{'id':_0x16a389[_0x6c1c('0x43')]['id']}},_0x595ba2={};_0x595ba2[_0x6c1c('0x2f')]=_[_0x6c1c('0x44')](db['WhatsappApplication'][_0x6c1c('0x2c')]);_0x595ba2[_0x6c1c('0x30')]=_[_0x6c1c('0x44')](_0x16a389[_0x6c1c('0x30')]);_0x595ba2[_0x6c1c('0x31')]=_['intersection'](_0x595ba2[_0x6c1c('0x2f')],_0x595ba2['query']);_0x10764a['attributes']=_['intersection'](_0x595ba2[_0x6c1c('0x2f')],qs[_0x6c1c('0x34')](_0x16a389[_0x6c1c('0x30')][_0x6c1c('0x34')]));_0x10764a[_0x6c1c('0x32')]=_0x10764a[_0x6c1c('0x32')][_0x6c1c('0x45')]?_0x10764a[_0x6c1c('0x32')]:_0x595ba2['model'];if(_0x16a389[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x10764a['include']=[{'all':!![]}];}_0x10764a=_[_0x6c1c('0x3b')]({},_0x10764a,_0x16a389['options']);return db[_0x6c1c('0x2b')][_0x6c1c('0x46')](_0x10764a)[_0x6c1c('0x25')](handleEntityNotFound(_0x174f2c,null))[_0x6c1c('0x25')](respondWithResult(_0x174f2c,null))[_0x6c1c('0x41')](handleError(_0x174f2c,null));};exports['create']=function(_0x1fe6e8,_0x58d075){return db[_0x6c1c('0x2b')][_0x6c1c('0x47')](_0x1fe6e8[_0x6c1c('0x48')],{})[_0x6c1c('0x25')](respondWithResult(_0x58d075,0xc9))[_0x6c1c('0x41')](handleError(_0x58d075,null));};exports[_0x6c1c('0x24')]=function(_0x52c14d,_0xa9889a){if(_0x52c14d[_0x6c1c('0x48')]['id']){delete _0x52c14d['body']['id'];}return db[_0x6c1c('0x2b')][_0x6c1c('0x46')]({'where':{'id':_0x52c14d[_0x6c1c('0x43')]['id']}})[_0x6c1c('0x25')](handleEntityNotFound(_0xa9889a,null))['then'](saveUpdates(_0x52c14d[_0x6c1c('0x48')],null))[_0x6c1c('0x25')](respondWithResult(_0xa9889a,null))[_0x6c1c('0x41')](handleError(_0xa9889a,null));};exports['destroy']=function(_0x5b8d69,_0x56b367){return db['WhatsappApplication']['find']({'where':{'id':_0x5b8d69[_0x6c1c('0x43')]['id']}})[_0x6c1c('0x25')](handleEntityNotFound(_0x56b367,null))['then'](removeEntity(_0x56b367,null))[_0x6c1c('0x41')](handleError(_0x56b367,null));}; \ No newline at end of file +var _0x65cb=['findAll','rows','show','params','fields','includeAll','catch','create','body','find','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','filter','merge','options','WhatsappApplication','include'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x65cb,0xa4));var _0xb65c=function(_0x330d19,_0x4151b4){_0x330d19=_0x330d19-0x0;var _0x239563=_0x65cb[_0x330d19];return _0x239563;};'use strict';var emlformat=require(_0xb65c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb65c('0x1'));var jsonpatch=require(_0xb65c('0x2'));var rp=require(_0xb65c('0x3'));var moment=require('moment');var BPromise=require(_0xb65c('0x4'));var Mustache=require(_0xb65c('0x5'));var util=require(_0xb65c('0x6'));var path=require(_0xb65c('0x7'));var sox=require(_0xb65c('0x8'));var csv=require('to-csv');var ejs=require(_0xb65c('0x9'));var fs=require('fs');var fs_extra=require(_0xb65c('0xa'));var _=require(_0xb65c('0xb'));var squel=require(_0xb65c('0xc'));var crypto=require(_0xb65c('0xd'));var jsforce=require(_0xb65c('0xe'));var deskjs=require(_0xb65c('0xf'));var toCsv=require(_0xb65c('0x10'));var querystring=require('querystring');var Papa=require(_0xb65c('0x11'));var Redis=require(_0xb65c('0x12'));var authService=require(_0xb65c('0x13'));var qs=require(_0xb65c('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb65c('0x15'));var logger=require('../../config/logger')(_0xb65c('0x16'));var utils=require(_0xb65c('0x17'));var config=require(_0xb65c('0x18'));var licenseUtil=require(_0xb65c('0x19'));var db=require(_0xb65c('0x1a'))['db'];function respondWithStatusCode(_0xbab2df,_0x4eb271){_0x4eb271=_0x4eb271||0xcc;return function(_0x340e60){if(_0x340e60){return _0xbab2df[_0xb65c('0x1b')](_0x4eb271);}return _0xbab2df[_0xb65c('0x1c')](_0x4eb271)[_0xb65c('0x1d')]();};}function respondWithResult(_0x3f1e8b,_0x11ebca){_0x11ebca=_0x11ebca||0xc8;return function(_0x2821e2){if(_0x2821e2){return _0x3f1e8b['status'](_0x11ebca)[_0xb65c('0x1e')](_0x2821e2);}};}function respondWithFilteredResult(_0x22eb85,_0x5a4354){return function(_0x288314){if(_0x288314){var _0x5c6d66=typeof _0x5a4354[_0xb65c('0x1f')]===_0xb65c('0x20')&&typeof _0x5a4354[_0xb65c('0x21')]===_0xb65c('0x20');var _0x24c1e2=_0x288314[_0xb65c('0x22')];var _0x1bca9d=_0x5c6d66?0x0:_0x5a4354[_0xb65c('0x1f')];var _0x199b13=_0x5c6d66?_0x288314[_0xb65c('0x22')]:_0x5a4354[_0xb65c('0x1f')]+_0x5a4354[_0xb65c('0x21')];var _0x2fe603;if(_0x199b13>=_0x24c1e2){_0x199b13=_0x24c1e2;_0x2fe603=0xc8;}else{_0x2fe603=0xce;}_0x22eb85[_0xb65c('0x1c')](_0x2fe603);return _0x22eb85[_0xb65c('0x23')]('Content-Range',_0x1bca9d+'-'+_0x199b13+'/'+_0x24c1e2)[_0xb65c('0x1e')](_0x288314);}return null;};}function patchUpdates(_0x2733c6){return function(_0x45b7e9){try{jsonpatch[_0xb65c('0x24')](_0x45b7e9,_0x2733c6,!![]);}catch(_0x37b944){return BPromise[_0xb65c('0x25')](_0x37b944);}return _0x45b7e9[_0xb65c('0x26')]();};}function saveUpdates(_0x2727cc,_0x248364){return function(_0x33fa4c){if(_0x33fa4c){return _0x33fa4c[_0xb65c('0x27')](_0x2727cc)[_0xb65c('0x28')](function(_0xd04d5){return _0xd04d5;});}return null;};}function removeEntity(_0x33961d,_0xe16c8f){return function(_0x5ed03){if(_0x5ed03){return _0x5ed03[_0xb65c('0x29')]()['then'](function(){_0x33961d[_0xb65c('0x1c')](0xcc)[_0xb65c('0x1d')]();});}};}function handleEntityNotFound(_0x29c0c0,_0x585f93){return function(_0x1b7e00){if(!_0x1b7e00){_0x29c0c0[_0xb65c('0x1b')](0x194);}return _0x1b7e00;};}function handleError(_0x49035e,_0x5a34c7){_0x5a34c7=_0x5a34c7||0x1f4;return function(_0x4033bd){logger[_0xb65c('0x2a')](_0x4033bd[_0xb65c('0x2b')]);if(_0x4033bd[_0xb65c('0x2c')]){delete _0x4033bd['name'];}_0x49035e[_0xb65c('0x1c')](_0x5a34c7)[_0xb65c('0x2d')](_0x4033bd);};}exports[_0xb65c('0x2e')]=function(_0x21cb9c,_0x1ffc77){var _0x11b562={},_0x5158d9={},_0x2e06df={'count':0x0,'rows':[]};var _0x2c83aa=_[_0xb65c('0x2f')](db['WhatsappApplication'][_0xb65c('0x30')],function(_0x5f5ca7){return{'name':_0x5f5ca7[_0xb65c('0x31')],'type':_0x5f5ca7[_0xb65c('0x32')]['key']};});_0x5158d9[_0xb65c('0x33')]=_[_0xb65c('0x2f')](_0x2c83aa,_0xb65c('0x2c'));_0x5158d9[_0xb65c('0x34')]=_[_0xb65c('0x35')](_0x21cb9c[_0xb65c('0x34')]);_0x5158d9[_0xb65c('0x36')]=_[_0xb65c('0x37')](_0x5158d9['model'],_0x5158d9[_0xb65c('0x34')]);_0x11b562[_0xb65c('0x38')]=_[_0xb65c('0x37')](_0x5158d9['model'],qs['fields'](_0x21cb9c[_0xb65c('0x34')]['fields']));_0x11b562[_0xb65c('0x38')]=_0x11b562['attributes'][_0xb65c('0x39')]?_0x11b562[_0xb65c('0x38')]:_0x5158d9[_0xb65c('0x33')];if(!_0x21cb9c[_0xb65c('0x34')]['hasOwnProperty'](_0xb65c('0x3a'))){_0x11b562['limit']=qs[_0xb65c('0x21')](_0x21cb9c['query'][_0xb65c('0x21')]);_0x11b562[_0xb65c('0x1f')]=qs[_0xb65c('0x1f')](_0x21cb9c[_0xb65c('0x34')]['offset']);}_0x11b562[_0xb65c('0x3b')]=qs[_0xb65c('0x3c')](_0x21cb9c[_0xb65c('0x34')]['sort']);_0x11b562[_0xb65c('0x3d')]=qs[_0xb65c('0x36')](_['pick'](_0x21cb9c['query'],_0x5158d9[_0xb65c('0x36')]),_0x2c83aa);if(_0x21cb9c[_0xb65c('0x34')][_0xb65c('0x3e')]){_0x11b562[_0xb65c('0x3d')]=_['merge'](_0x11b562[_0xb65c('0x3d')],{'$or':_[_0xb65c('0x2f')](_0x2c83aa,function(_0x2f3125){if(_0x2f3125[_0xb65c('0x32')]!=='VIRTUAL'){var _0x12c685={};_0x12c685[_0x2f3125[_0xb65c('0x2c')]]={'$like':'%'+_0x21cb9c[_0xb65c('0x34')][_0xb65c('0x3e')]+'%'};return _0x12c685;}})});}_0x11b562=_[_0xb65c('0x3f')]({},_0x11b562,_0x21cb9c[_0xb65c('0x40')]);var _0x2c11ae={'where':_0x11b562[_0xb65c('0x3d')]};return db[_0xb65c('0x41')][_0xb65c('0x22')](_0x2c11ae)[_0xb65c('0x28')](function(_0x16c859){_0x2e06df[_0xb65c('0x22')]=_0x16c859;if(_0x21cb9c['query']['includeAll']){_0x11b562[_0xb65c('0x42')]=[{'all':!![]}];}return db[_0xb65c('0x41')][_0xb65c('0x43')](_0x11b562);})['then'](function(_0x42acd6){_0x2e06df[_0xb65c('0x44')]=_0x42acd6;return _0x2e06df;})['then'](respondWithFilteredResult(_0x1ffc77,_0x11b562))['catch'](handleError(_0x1ffc77,null));};exports[_0xb65c('0x45')]=function(_0x18a4da,_0x150ffb){var _0x215e62={'raw':!![],'where':{'id':_0x18a4da[_0xb65c('0x46')]['id']}},_0x199625={};_0x199625['model']=_[_0xb65c('0x35')](db[_0xb65c('0x41')][_0xb65c('0x30')]);_0x199625[_0xb65c('0x34')]=_[_0xb65c('0x35')](_0x18a4da[_0xb65c('0x34')]);_0x199625['filters']=_[_0xb65c('0x37')](_0x199625[_0xb65c('0x33')],_0x199625[_0xb65c('0x34')]);_0x215e62[_0xb65c('0x38')]=_[_0xb65c('0x37')](_0x199625['model'],qs[_0xb65c('0x47')](_0x18a4da[_0xb65c('0x34')][_0xb65c('0x47')]));_0x215e62[_0xb65c('0x38')]=_0x215e62[_0xb65c('0x38')]['length']?_0x215e62['attributes']:_0x199625[_0xb65c('0x33')];if(_0x18a4da[_0xb65c('0x34')][_0xb65c('0x48')]){_0x215e62[_0xb65c('0x42')]=[{'all':!![]}];}_0x215e62=_['merge']({},_0x215e62,_0x18a4da[_0xb65c('0x40')]);return db[_0xb65c('0x41')]['find'](_0x215e62)[_0xb65c('0x28')](handleEntityNotFound(_0x150ffb,null))['then'](respondWithResult(_0x150ffb,null))[_0xb65c('0x49')](handleError(_0x150ffb,null));};exports[_0xb65c('0x4a')]=function(_0x2ad35c,_0x1af087){return db['WhatsappApplication'][_0xb65c('0x4a')](_0x2ad35c[_0xb65c('0x4b')],{})[_0xb65c('0x28')](respondWithResult(_0x1af087,0xc9))[_0xb65c('0x49')](handleError(_0x1af087,null));};exports[_0xb65c('0x27')]=function(_0x5e81e2,_0x481d4d){if(_0x5e81e2[_0xb65c('0x4b')]['id']){delete _0x5e81e2[_0xb65c('0x4b')]['id'];}return db[_0xb65c('0x41')]['find']({'where':{'id':_0x5e81e2[_0xb65c('0x46')]['id']}})['then'](handleEntityNotFound(_0x481d4d,null))[_0xb65c('0x28')](saveUpdates(_0x5e81e2['body'],null))['then'](respondWithResult(_0x481d4d,null))['catch'](handleError(_0x481d4d,null));};exports[_0xb65c('0x29')]=function(_0x5b374c,_0x5e74a8){return db[_0xb65c('0x41')][_0xb65c('0x4c')]({'where':{'id':_0x5b374c[_0xb65c('0x46')]['id']}})[_0xb65c('0x28')](handleEntityNotFound(_0x5e74a8,null))[_0xb65c('0x28')](removeEntity(_0x5e74a8,null))[_0xb65c('0x49')](handleError(_0x5e74a8,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 9ee2324..561a62b 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 _0x0ef0=['api','moment','bluebird','request-promise','path','rimraf','exports','define','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x5e9025,_0x25f9d1){var _0x18b7b3=function(_0x1ffb09){while(--_0x1ffb09){_0x5e9025['push'](_0x5e9025['shift']());}};_0x18b7b3(++_0x25f9d1);}(_0x0ef0,0x80));var _0x00ef=function(_0x5bdd93,_0x208ccb){_0x5bdd93=_0x5bdd93-0x0;var _0x2caf5e=_0x0ef0[_0x5bdd93];return _0x2caf5e;};'use strict';var _=require(_0x00ef('0x0'));var util=require(_0x00ef('0x1'));var logger=require('../../config/logger')(_0x00ef('0x2'));var moment=require(_0x00ef('0x3'));var BPromise=require(_0x00ef('0x4'));var rp=require(_0x00ef('0x5'));var fs=require('fs');var path=require(_0x00ef('0x6'));var rimraf=require(_0x00ef('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappApplication.attributes');module[_0x00ef('0x8')]=function(_0x406d13,_0x471ebf){return _0x406d13[_0x00ef('0x9')]('WhatsappApplication',attributes,{'tableName':_0x00ef('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x00ef('0xb'),'collate':_0x00ef('0xc')});}; \ No newline at end of file +var _0xb18e=['./whatsappApplication.attributes','exports','define','whatsapp_applications','utf8mb4','../../config/logger','moment','request-promise','path','../../config/environment'];(function(_0x3464fe,_0x571c18){var _0x136368=function(_0x522155){while(--_0x522155){_0x3464fe['push'](_0x3464fe['shift']());}};_0x136368(++_0x571c18);}(_0xb18e,0x181));var _0xeb18=function(_0x39a2d6,_0x477459){_0x39a2d6=_0x39a2d6-0x0;var _0x23af66=_0xb18e[_0x39a2d6];return _0x23af66;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xeb18('0x0'))('api');var moment=require(_0xeb18('0x1'));var BPromise=require('bluebird');var rp=require(_0xeb18('0x2'));var fs=require('fs');var path=require(_0xeb18('0x3'));var rimraf=require('rimraf');var config=require(_0xeb18('0x4'));var attributes=require(_0xeb18('0x5'));module[_0xeb18('0x6')]=function(_0x409efb,_0x46d281){return _0x409efb[_0xeb18('0x7')]('WhatsappApplication',attributes,{'tableName':_0xeb18('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xeb18('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 51dafa5..664d233 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 _0xa8a8=['stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug'];(function(_0x34649e,_0x24ac1a){var _0xe8dd1d=function(_0x559ff1){while(--_0x559ff1){_0x34649e['push'](_0x34649e['shift']());}};_0xe8dd1d(++_0x24ac1a);}(_0xa8a8,0xec));var _0x8a8a=function(_0x2ae56d,_0x19bb4f){_0x2ae56d=_0x2ae56d-0x0;var _0xb8e30f=_0xa8a8[_0x2ae56d];return _0xb8e30f;};'use strict';var _=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var moment=require(_0x8a8a('0x2'));var BPromise=require(_0x8a8a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a8a('0x4'));var db=require(_0x8a8a('0x5'))['db'];var utils=require(_0x8a8a('0x6'));var logger=require(_0x8a8a('0x7'))(_0x8a8a('0x8'));var config=require(_0x8a8a('0x9'));var jayson=require(_0x8a8a('0xa'));var client=jayson[_0x8a8a('0xb')][_0x8a8a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x315fe9,_0x1d7121,_0x8e7aa0){return new BPromise(function(_0x4225b9,_0xecaa6f){return client[_0x8a8a('0xd')](_0x315fe9,_0x8e7aa0)['then'](function(_0x576ef9){logger[_0x8a8a('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'));logger[_0x8a8a('0x10')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'),JSON[_0x8a8a('0x11')](_0x576ef9));if(_0x576ef9[_0x8a8a('0x12')]){if(_0x576ef9['error'][_0x8a8a('0x13')]===0x1f4){logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x576ef9[_0x8a8a('0x12')]['message']);return _0xecaa6f(_0x576ef9[_0x8a8a('0x12')]['message']);}logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x576ef9[_0x8a8a('0x12')][_0x8a8a('0x15')]);return _0x4225b9(_0x576ef9[_0x8a8a('0x12')][_0x8a8a('0x15')]);}else{logger[_0x8a8a('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'));_0x4225b9(_0x576ef9['result'][_0x8a8a('0x15')]);}})[_0x8a8a('0x16')](function(_0x46a4f4){logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x46a4f4);_0xecaa6f(_0x46a4f4);});});} \ No newline at end of file +var _0xa41a=['rpc','../../config/environment','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x93ba1c,_0x4d4d9e){var _0x3c0372=function(_0x3d3cc8){while(--_0x3d3cc8){_0x93ba1c['push'](_0x93ba1c['shift']());}};_0x3c0372(++_0x4d4d9e);}(_0xa41a,0x6b));var _0xaa41=function(_0x274cb,_0xee62ed){_0x274cb=_0x274cb-0x0;var _0x551e07=_0xa41a[_0x274cb];return _0x551e07;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 1beed1e..27fb9aa 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 _0x8375=['post','create','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','delete','destroy','removeTags','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','/:id/download'];(function(_0x16b542,_0x10cdb2){var _0x29511d=function(_0xc593ee){while(--_0xc593ee){_0x16b542['push'](_0x16b542['shift']());}};_0x29511d(++_0x10cdb2);}(_0x8375,0xa8));var _0x5837=function(_0x59b461,_0x3770f3){_0x59b461=_0x59b461-0x0;var _0x183194=_0x8375[_0x59b461];return _0x183194;};'use strict';var multer=require(_0x5837('0x0'));var util=require(_0x5837('0x1'));var path=require(_0x5837('0x2'));var timeout=require('connect-timeout');var express=require(_0x5837('0x3'));var router=express[_0x5837('0x4')]();var fs_extra=require(_0x5837('0x5'));var auth=require(_0x5837('0x6'));var interaction=require(_0x5837('0x7'));var config=require(_0x5837('0x8'));var controller=require('./whatsappInteraction.controller');router[_0x5837('0x9')]('/',auth[_0x5837('0xa')](),controller[_0x5837('0xb')]);router[_0x5837('0x9')](_0x5837('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x5837('0x9')](_0x5837('0xd'),auth['isAuthenticated'](),controller[_0x5837('0xe')]);router['get'](_0x5837('0xf'),auth[_0x5837('0xa')](),controller[_0x5837('0x10')]);router[_0x5837('0x9')](_0x5837('0x11'),auth[_0x5837('0xa')](),controller['download']);router[_0x5837('0x12')]('/',auth[_0x5837('0xa')](),controller[_0x5837('0x13')]);router[_0x5837('0x12')](_0x5837('0xf'),auth['isAuthenticated'](),controller['addMessage']);router['post'](_0x5837('0x14'),auth[_0x5837('0xa')](),interaction[_0x5837('0x15')](_0x5837('0x16'),_0x5837('0x17')),controller[_0x5837('0x18')]);router[_0x5837('0x19')](_0x5837('0xd'),auth[_0x5837('0xa')](),interaction['tracked'](_0x5837('0x16'),_0x5837('0x1a')),controller['update']);router[_0x5837('0x1b')](_0x5837('0xd'),auth[_0x5837('0xa')](),interaction['tracked']('whatsapp','whatsappinteraction:destroy'),controller[_0x5837('0x1c')]);router[_0x5837('0x1b')](_0x5837('0x14'),auth['isAuthenticated'](),controller[_0x5837('0x1d')]);module[_0x5837('0x1e')]=router; \ No newline at end of file +var _0xf494=['isAuthenticated','index','describe','/:id','show','/:id/messages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','whatsapp','addTags','put','whatsappinteraction:update','update','removeTags','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get'];(function(_0x3e04c8,_0x3c2635){var _0x5e4b64=function(_0x9a853f){while(--_0x9a853f){_0x3e04c8['push'](_0x3e04c8['shift']());}};_0x5e4b64(++_0x3c2635);}(_0xf494,0x1c6));var _0x4f49=function(_0x5c9723,_0x596528){_0x5c9723=_0x5c9723-0x0;var _0x4be35b=_0xf494[_0x5c9723];return _0x4be35b;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f49('0x3'));var router=express[_0x4f49('0x4')]();var fs_extra=require(_0x4f49('0x5'));var auth=require(_0x4f49('0x6'));var interaction=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var controller=require(_0x4f49('0x9'));router[_0x4f49('0xa')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0xc')]);router[_0x4f49('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x4f49('0xd')]);router[_0x4f49('0xa')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0xf')]);router[_0x4f49('0xa')](_0x4f49('0x10'),auth[_0x4f49('0xb')](),controller['getMessages']);router[_0x4f49('0xa')](_0x4f49('0x11'),auth['isAuthenticated'](),controller[_0x4f49('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4f49('0x13')]);router[_0x4f49('0x14')]('/:id/messages',auth[_0x4f49('0xb')](),controller[_0x4f49('0x15')]);router[_0x4f49('0x14')](_0x4f49('0x16'),auth[_0x4f49('0xb')](),interaction[_0x4f49('0x17')](_0x4f49('0x18'),'whatsappinteraction:addtags'),controller[_0x4f49('0x19')]);router[_0x4f49('0x1a')](_0x4f49('0xe'),auth['isAuthenticated'](),interaction['tracked'](_0x4f49('0x18'),_0x4f49('0x1b')),controller[_0x4f49('0x1c')]);router['delete'](_0x4f49('0xe'),auth[_0x4f49('0xb')](),interaction[_0x4f49('0x17')]('whatsapp','whatsappinteraction:destroy'),controller['destroy']);router['delete'](_0x4f49('0x16'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x1d')]);module[_0x4f49('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index fd57bad..522e58a 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 _0x98a8=['DATE','STRING','ENUM','out','sequelize','moment','exports','BOOLEAN'];(function(_0x6d6a66,_0x2924af){var _0x11eb6e=function(_0x52e55a){while(--_0x52e55a){_0x6d6a66['push'](_0x6d6a66['shift']());}};_0x11eb6e(++_0x2924af);}(_0x98a8,0x12c));var _0x898a=function(_0x545138,_0x82459){_0x545138=_0x545138-0x0;var _0x3485fa=_0x98a8[_0x545138];return _0x3485fa;};'use strict';var Sequelize=require(_0x898a('0x0'));var moment=require(_0x898a('0x1'));module[_0x898a('0x2')]={'closed':{'type':Sequelize[_0x898a('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x898a('0x4')]},'disposition':{'type':Sequelize[_0x898a('0x5')]},'secondDisposition':{'type':Sequelize[_0x898a('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x898a('0x5')]},'phone':{'type':Sequelize[_0x898a('0x5')]},'read1stAt':{'type':Sequelize[_0x898a('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x898a('0x6')]('in',_0x898a('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x898a('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x898a('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x98a8=['DATE','STRING','ENUM','out','sequelize','moment','exports','BOOLEAN'];(function(_0x586fa2,_0x1a45bc){var _0x515be9=function(_0x4e90d5){while(--_0x4e90d5){_0x586fa2['push'](_0x586fa2['shift']());}};_0x515be9(++_0x1a45bc);}(_0x98a8,0x12c));var _0x898a=function(_0x909a48,_0x36a2ea){_0x909a48=_0x909a48-0x0;var _0xaf47ef=_0x98a8[_0x909a48];return _0xaf47ef;};'use strict';var Sequelize=require(_0x898a('0x0'));var moment=require(_0x898a('0x1'));module[_0x898a('0x2')]={'closed':{'type':Sequelize[_0x898a('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x898a('0x4')]},'disposition':{'type':Sequelize[_0x898a('0x5')]},'secondDisposition':{'type':Sequelize[_0x898a('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x898a('0x5')]},'phone':{'type':Sequelize[_0x898a('0x5')]},'read1stAt':{'type':Sequelize[_0x898a('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x898a('0x6')]('in',_0x898a('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x898a('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x898a('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 100bd0b..677ea6d 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 _0xc08c=['omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','pick','where','WhatsappInteractionId','merge','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','setTags','spread','Tag','findAll','color','emit','whatsappInteractionTags:save','removeTags','download','unix','toString','join','root','server','tmp','attachments','format','User','fullname','push','CmContact','Contact','lastName','Attachment','Messages','createdAt','secret','read','Account','Owner','mkdirSync','Whatsapp','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','direction','out','System','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','log','err','unlinkSync','zip-dir','bluebird','util','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./whatsappInteraction.socket','register','end','status','json','offset','limit','undefined','count','update','then','sendStatus','error','stack','name','send','index','map','WhatsappInteraction','type','getOptions','whatsapp','query','catch','show','params','model','rawAttributes','keys','filters','intersection','attributes','fields','length','include','options','create','body','find','describe','addMessage','WhatsappMessage','ids'];(function(_0x30822a,_0x536002){var _0xfd9d33=function(_0xf7d284){while(--_0xf7d284){_0x30822a['push'](_0x30822a['shift']());}};_0xfd9d33(++_0x536002);}(_0xc08c,0x1b7));var _0xcc08=function(_0x304936,_0x260419){_0x304936=_0x304936-0x0;var _0x10349b=_0xc08c[_0x304936];return _0x10349b;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xcc08('0x0'));var moment=require('moment');var BPromise=require(_0xcc08('0x1'));var util=require(_0xcc08('0x2'));var path=require('path');var ejs=require(_0xcc08('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xcc08('0x4'));var interaction=require(_0xcc08('0x5'));var qs=require(_0xcc08('0x6'));var pdf=require(_0xcc08('0x7'));var logger=require(_0xcc08('0x8'))(_0xcc08('0x9'));var config=require(_0xcc08('0xa'));var db=require(_0xcc08('0xb'))['db'];config[_0xcc08('0xc')]=_['defaults'](config[_0xcc08('0xc')],{'host':_0xcc08('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xcc08('0xe'))[_0xcc08('0xf')](socket);function respondWithStatusCode(_0x12d686,_0x1c5c9b){_0x1c5c9b=_0x1c5c9b||0xcc;return function(_0xbcc3aa){if(_0xbcc3aa){return _0x12d686['sendStatus'](_0x1c5c9b);}return _0x12d686['status'](_0x1c5c9b)[_0xcc08('0x10')]();};}function respondWithResult(_0x4c3541,_0x130171){_0x130171=_0x130171||0xc8;return function(_0x20c847){if(_0x20c847){return _0x4c3541[_0xcc08('0x11')](_0x130171)[_0xcc08('0x12')](_0x20c847);}};}function respondWithFilteredResult(_0xc10bfe,_0x501faa){return function(_0x5d0d53){if(_0x5d0d53){var _0x582f95=typeof _0x501faa[_0xcc08('0x13')]==='undefined'&&typeof _0x501faa[_0xcc08('0x14')]===_0xcc08('0x15');var _0x757c6b=_0x5d0d53[_0xcc08('0x16')];var _0x1e8cd6=_0x582f95?0x0:_0x501faa[_0xcc08('0x13')];var _0xd5667=_0x582f95?_0x5d0d53[_0xcc08('0x16')]:_0x501faa[_0xcc08('0x13')]+_0x501faa[_0xcc08('0x14')];var _0x2ab8a2;if(_0xd5667>=_0x757c6b){_0xd5667=_0x757c6b;_0x2ab8a2=0xc8;}else{_0x2ab8a2=0xce;}_0xc10bfe[_0xcc08('0x11')](_0x2ab8a2);return _0xc10bfe['set']('Content-Range',_0x1e8cd6+'-'+_0xd5667+'/'+_0x757c6b)['json'](_0x5d0d53);}return null;};}function saveUpdates(_0x46954b){return function(_0x3fef47){if(_0x3fef47){return _0x3fef47[_0xcc08('0x17')](_0x46954b)[_0xcc08('0x18')](function(_0x15b9e2){return _0x15b9e2;});}return null;};}function removeEntity(_0x5b4f97){return function(_0x35de59){if(_0x35de59){return _0x35de59['destroy']()[_0xcc08('0x18')](function(){_0x5b4f97[_0xcc08('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13c2f0){return function(_0x31cafe){if(!_0x31cafe){_0x13c2f0[_0xcc08('0x19')](0x194);}return _0x31cafe;};}function handleError(_0x1dfa4c,_0x5a3cf7){_0x5a3cf7=_0x5a3cf7||0x1f4;return function(_0x20f3e8){logger[_0xcc08('0x1a')](_0x20f3e8[_0xcc08('0x1b')]);if(_0x20f3e8[_0xcc08('0x1c')]){delete _0x20f3e8[_0xcc08('0x1c')];}_0x1dfa4c['status'](_0x5a3cf7)[_0xcc08('0x1d')](_0x20f3e8);};}exports[_0xcc08('0x1e')]=function(_0x5db177,_0x9b3800){var _0x5180d0={};var _0x359963=_[_0xcc08('0x1f')](db[_0xcc08('0x20')]['rawAttributes'],function(_0x814cbb){return{'name':_0x814cbb['fieldName'],'type':_0x814cbb[_0xcc08('0x21')]['key']};});_0x5180d0=qs[_0xcc08('0x22')](_0x359963,_0x5db177);return interaction['findAll'](_0xcc08('0x23'),_0x5db177[_0xcc08('0x24')],_0x5db177['user'],_0x5180d0,_0x359963)[_0xcc08('0x18')](respondWithFilteredResult(_0x9b3800,_0x5180d0))[_0xcc08('0x25')](handleError(_0x9b3800,null));};exports[_0xcc08('0x26')]=function(_0x9bf1d1,_0x2154fa){var _0x1f4bb4={'raw':![],'where':{'id':_0x9bf1d1[_0xcc08('0x27')]['id']}},_0x14adea={};_0x14adea[_0xcc08('0x28')]=_['keys'](db[_0xcc08('0x20')][_0xcc08('0x29')]);_0x14adea['query']=_[_0xcc08('0x2a')](_0x9bf1d1['query']);_0x14adea[_0xcc08('0x2b')]=_[_0xcc08('0x2c')](_0x14adea[_0xcc08('0x28')],_0x14adea[_0xcc08('0x24')]);_0x1f4bb4[_0xcc08('0x2d')]=_[_0xcc08('0x2c')](_0x14adea[_0xcc08('0x28')],qs[_0xcc08('0x2e')](_0x9bf1d1[_0xcc08('0x24')][_0xcc08('0x2e')]));_0x1f4bb4[_0xcc08('0x2d')]=_0x1f4bb4['attributes'][_0xcc08('0x2f')]?_0x1f4bb4[_0xcc08('0x2d')]:_0x14adea[_0xcc08('0x28')];if(_0x9bf1d1[_0xcc08('0x24')]['includeAll']){_0x1f4bb4[_0xcc08('0x30')]=[{'all':!![]}];}_0x1f4bb4=_['merge']({},_0x1f4bb4,_0x9bf1d1[_0xcc08('0x31')]);return db['WhatsappInteraction']['find'](_0x1f4bb4)['then'](handleEntityNotFound(_0x2154fa,null))['then'](respondWithResult(_0x2154fa,null))['catch'](handleError(_0x2154fa,null));};exports[_0xcc08('0x32')]=function(_0x355b5f,_0x68c7f2){return db[_0xcc08('0x20')][_0xcc08('0x32')](_0x355b5f['body'],{})[_0xcc08('0x18')](respondWithResult(_0x68c7f2,0xc9))[_0xcc08('0x25')](handleError(_0x68c7f2,null));};exports['update']=function(_0x47c671,_0x3d2339){if(_0x47c671[_0xcc08('0x33')]['id']){delete _0x47c671['body']['id'];}return db[_0xcc08('0x20')]['find']({'where':{'id':_0x47c671[_0xcc08('0x27')]['id']}})['then'](handleEntityNotFound(_0x3d2339,null))['then'](saveUpdates(_0x47c671['body'],null))[_0xcc08('0x18')](respondWithResult(_0x3d2339,null))[_0xcc08('0x25')](handleError(_0x3d2339,null));};exports['destroy']=function(_0xaac8ac,_0x135665){return db[_0xcc08('0x20')][_0xcc08('0x34')]({'where':{'id':_0xaac8ac[_0xcc08('0x27')]['id']}})[_0xcc08('0x18')](handleEntityNotFound(_0x135665,null))[_0xcc08('0x18')](removeEntity(_0x135665,null))['catch'](handleError(_0x135665,null));};exports[_0xcc08('0x35')]=function(_0x2bd9c4,_0x55fdb4){return db['WhatsappInteraction']['describe']()[_0xcc08('0x18')](respondWithResult(_0x55fdb4,null))[_0xcc08('0x25')](handleError(_0x55fdb4,null));};exports[_0xcc08('0x36')]=function(_0x3c1334,_0xc66f12){return db[_0xcc08('0x37')]['find']({'where':{'id':_0x3c1334[_0xcc08('0x27')]['id']}})['then'](handleEntityNotFound(_0xc66f12,null))[_0xcc08('0x18')](function(_0xd7eea4){if(_0xd7eea4){return _0xd7eea4[_0xcc08('0x36')](_0x3c1334[_0xcc08('0x33')][_0xcc08('0x38')],_[_0xcc08('0x39')](_0x3c1334[_0xcc08('0x33')],['ids','id'])||{});}})['then'](respondWithResult(_0xc66f12,null))['catch'](handleError(_0xc66f12,null));};exports[_0xcc08('0x3a')]=function(_0x25dc1d,_0x4161b8){var _0x326648={'raw':![],'where':{}};var _0x4311e7={};var _0x326a6f={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0xcc08('0x3b')]({'where':{'id':_0x25dc1d[_0xcc08('0x27')]['id']}})[_0xcc08('0x18')](handleEntityNotFound(_0x4161b8,null))[_0xcc08('0x18')](function(_0x3264f1){if(_0x3264f1){_0x4311e7[_0xcc08('0x28')]=_['keys'](db[_0xcc08('0x37')][_0xcc08('0x29')]);_0x4311e7[_0xcc08('0x24')]=_[_0xcc08('0x2a')](_0x25dc1d[_0xcc08('0x24')]);_0x4311e7[_0xcc08('0x2b')]=_[_0xcc08('0x2c')](_0x4311e7[_0xcc08('0x28')],_0x4311e7[_0xcc08('0x24')]);_0x326648[_0xcc08('0x2d')]=_['intersection'](_0x4311e7[_0xcc08('0x28')],qs[_0xcc08('0x2e')](_0x25dc1d[_0xcc08('0x24')][_0xcc08('0x2e')]));_0x326648[_0xcc08('0x2d')]=_0x326648[_0xcc08('0x2d')][_0xcc08('0x2f')]?_0x326648[_0xcc08('0x2d')]:_0x4311e7[_0xcc08('0x28')];if(!_0x25dc1d[_0xcc08('0x24')][_0xcc08('0x3c')](_0xcc08('0x3d'))){_0x326648[_0xcc08('0x14')]=qs[_0xcc08('0x14')](_0x25dc1d['query'][_0xcc08('0x14')]);_0x326648[_0xcc08('0x13')]=qs[_0xcc08('0x13')](_0x25dc1d[_0xcc08('0x24')][_0xcc08('0x13')]);}_0x326648[_0xcc08('0x3e')]=qs[_0xcc08('0x3f')](_0x25dc1d[_0xcc08('0x24')][_0xcc08('0x3f')]);_0x326648['where']=qs[_0xcc08('0x2b')](_[_0xcc08('0x40')](_0x25dc1d[_0xcc08('0x24')],_0x4311e7[_0xcc08('0x2b')]));_0x326648[_0xcc08('0x41')][_0xcc08('0x42')]=_0x3264f1['id'];if(_0x25dc1d[_0xcc08('0x24')]['filter']){_0x326648['where']=_[_0xcc08('0x43')](_0x326648['where'],{'$or':_[_0xcc08('0x1f')](_0x326648[_0xcc08('0x2d')],function(_0x490aee){var _0x270c90={};_0x270c90[_0x490aee]={'$like':'%'+_0x25dc1d[_0xcc08('0x24')][_0xcc08('0x44')]+'%'};return _0x270c90;})});}if(_0x25dc1d['query']['$gte']){var _0xfedf3c=_0x25dc1d[_0xcc08('0x24')][_0xcc08('0x45')][_0xcc08('0x46')](',');var _0x4eaa92={};_0x4eaa92[_0xfedf3c[0x0]]={'$gte':moment(_0xfedf3c[0x1])['format'](_0xcc08('0x47'))};_0x326648['where']=_['merge'](_0x326648[_0xcc08('0x41')],_0x4eaa92);}_0x326648=_['merge']({},_0x326648,_0x25dc1d[_0xcc08('0x31')]);return db[_0xcc08('0x37')]['count']({'where':_0x326648[_0xcc08('0x41')]})['then'](function(_0x286d5d){_0x326a6f[_0xcc08('0x16')]=_0x286d5d;if(_0x25dc1d[_0xcc08('0x24')]['includeAll']){_0x326648[_0xcc08('0x30')]=[{'all':!![]}];}return db[_0xcc08('0x37')]['findAll'](_0x326648);})[_0xcc08('0x18')](function(_0x238b23){_0x326a6f['rows']=_0x238b23;return _0x326a6f;});}})[_0xcc08('0x18')](respondWithFilteredResult(_0x4161b8,_0x326648))['catch'](handleError(_0x4161b8,null));};exports['addTags']=function(_0x410811,_0x8c711){return db['WhatsappInteraction'][_0xcc08('0x34')]({'where':{'id':_0x410811[_0xcc08('0x27')]['id']}})[_0xcc08('0x18')](handleEntityNotFound(_0x8c711,null))[_0xcc08('0x18')](function(_0x336450){if(_0x336450){return _0x336450[_0xcc08('0x48')](_0x410811[_0xcc08('0x33')]['ids'],_[_0xcc08('0x39')](_0x410811[_0xcc08('0x33')],[_0xcc08('0x38'),'id'])||{})[_0xcc08('0x49')](function(){return db[_0xcc08('0x4a')][_0xcc08('0x4b')]({'attributes':['id',_0xcc08('0x1c'),_0xcc08('0x4c')],'where':{'id':_0x410811[_0xcc08('0x33')]['ids']}});})[_0xcc08('0x18')](function(_0x16b71e){socket[_0xcc08('0x4d')](_0xcc08('0x4e'),{'id':Number(_0x410811[_0xcc08('0x27')]['id']),'tags':_0x16b71e||[]});return{'id':Number(_0x410811['params']['id']),'tags':_0x16b71e||[]};});}})[_0xcc08('0x18')](respondWithResult(_0x8c711,null))['catch'](handleError(_0x8c711,null));};exports['removeTags']=function(_0x1c4ae3,_0x1b1235){return db[_0xcc08('0x20')][_0xcc08('0x34')]({'where':{'id':_0x1c4ae3[_0xcc08('0x27')]['id']}})[_0xcc08('0x18')](handleEntityNotFound(_0x1b1235,null))[_0xcc08('0x18')](function(_0x5d7a3a){if(_0x5d7a3a){return _0x5d7a3a[_0xcc08('0x4f')](_0x1c4ae3[_0xcc08('0x24')][_0xcc08('0x38')]);}})[_0xcc08('0x18')](respondWithStatusCode(_0x1b1235,null))['catch'](handleError(_0x1b1235,null));};exports[_0xcc08('0x50')]=function(_0x466f2d,_0x3b4556){var _0x1f7c04=moment()[_0xcc08('0x51')]()[_0xcc08('0x52')]();var _0x341cfc=path[_0xcc08('0x53')](config[_0xcc08('0x54')],_0xcc08('0x55'),'files',_0xcc08('0x56'));var _0x3b3469=path[_0xcc08('0x53')](config[_0xcc08('0x54')],_0xcc08('0x55'),'files',_0xcc08('0x57'));var _0x17c451=path[_0xcc08('0x53')](_0x341cfc,_0x1f7c04);var _0x3e19ad=util[_0xcc08('0x58')]('transcript-%d-%s.zip',_0x466f2d[_0xcc08('0x27')]['id'],_0x1f7c04);var _0x2b589b=path[_0xcc08('0x53')](_0x341cfc,_0x3e19ad);var _0x139437=[];_0x139437['push']({'model':db[_0xcc08('0x59')],'as':'User','attributes':['id',_0xcc08('0x5a')],'raw':!![]});_0x139437[_0xcc08('0x5b')]({'model':db[_0xcc08('0x5c')],'as':_0xcc08('0x5d'),'attributes':['id','firstName',_0xcc08('0x5e')],'raw':!![]});if(_0x466f2d['query']['attachments']){_0x139437[_0xcc08('0x5b')]({'model':db[_0xcc08('0x5f')],'as':_0xcc08('0x5f'),'raw':!![]});}var _0x571c3a=[{'model':db[_0xcc08('0x37')],'as':_0xcc08('0x60'),'attributes':['id',_0xcc08('0x33'),_0xcc08('0x61'),'direction',_0xcc08('0x62'),_0xcc08('0x63')],'include':_0x139437}];_0x571c3a[_0xcc08('0x5b')]({'model':db['WhatsappAccount'],'as':_0xcc08('0x64'),'attributes':['id','name']});_0x571c3a[_0xcc08('0x5b')]({'model':db[_0xcc08('0x59')],'as':_0xcc08('0x65'),'attributes':['id',_0xcc08('0x5a')]});return db[_0xcc08('0x20')][_0xcc08('0x34')]({'where':{'id':_0x466f2d[_0xcc08('0x27')]['id']},'include':_0x571c3a})[_0xcc08('0x18')](handleEntityNotFound(_0x3b4556,null))[_0xcc08('0x18')](function(_0x2a0be7){if(_0x2a0be7){var _0x31f61d=_0x2a0be7['get']({'plain':!![]});fs[_0xcc08('0x66')](_0x17c451);var _0x105cce={'channel':_0xcc08('0x67'),'account':_0x31f61d[_0xcc08('0x64')][_0xcc08('0x1c')],'agent':_0x31f61d[_0xcc08('0x65')]?_0x31f61d[_0xcc08('0x65')]['fullname']:'N.A.','createdAt':moment(_0x31f61d[_0xcc08('0x61')])[_0xcc08('0x58')](_0xcc08('0x47'))['toString'](),'closedAt':_0x31f61d[_0xcc08('0x68')]?moment(_0x31f61d[_0xcc08('0x69')])[_0xcc08('0x58')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x31f61d[_0xcc08('0x6a')],'messages':_(_0x31f61d[_0xcc08('0x60')])[_0xcc08('0x44')]({'secret':![]})['map'](function(_0x3cb189){if(_0x3cb189['Attachment']){var _0x2cf569=path[_0xcc08('0x53')](_0x3b3469,_0x3cb189['Attachment'][_0xcc08('0x6b')]);if(fs[_0xcc08('0x6c')](_0x2cf569)){fs[_0xcc08('0x6d')](_0x2cf569)[_0xcc08('0x6e')](fs[_0xcc08('0x6f')](path[_0xcc08('0x53')](_0x17c451,_0x3cb189[_0xcc08('0x5f')]['basename'])));}}return{'date':moment(_0x3cb189[_0xcc08('0x61')])[_0xcc08('0x58')](_0xcc08('0x47'))['toString'](),'sender':_0x3cb189[_0xcc08('0x70')]===_0xcc08('0x71')?_0x3cb189[_0xcc08('0x59')]?_0x3cb189[_0xcc08('0x59')]['fullname']:_0xcc08('0x72'):_0x3cb189[_0xcc08('0x5d')]['firstName']+(_0x3cb189[_0xcc08('0x5d')][_0xcc08('0x5e')]?'\x20'+_0x3cb189[_0xcc08('0x5d')][_0xcc08('0x5e')]:''),'body':_0x3cb189[_0xcc08('0x5f')]?_0x3cb189['Attachment']['basename']:_0x3cb189[_0xcc08('0x33')],'direction':_0x3cb189[_0xcc08('0x70')]===_0xcc08('0x71')?'A':'C','secret':_0x3cb189[_0xcc08('0x62')],'read':_0x3cb189[_0xcc08('0x63')],'attachment':_0x3cb189['Attachment']};})[_0xcc08('0x73')]()};return ejs[_0xcc08('0x74')](path['join'](config[_0xcc08('0x54')],_0xcc08('0x55'),_0xcc08('0x75'),_0xcc08('0x76')),{'interaction':_0x105cce})[_0xcc08('0x18')](function(_0x14efec){var _0x50600e=path['join'](_0x17c451,_0xcc08('0x77')+_0x31f61d['id']+'-'+_0x1f7c04+_0xcc08('0x78'));var _0xca18f3={'path':_0x50600e,'channel':_0xcc08('0x67'),'interactionId':_0x31f61d['id']};return pdf['createPdfFromHTML'](_0x14efec,_0xca18f3);})[_0xcc08('0x18')](function(){return new BPromise(function(_0x47903c,_0x2f13e5){zipdir(_0x17c451,{'saveTo':_0x2b589b},function(_0x5e9e5f,_0x2c9c4d){if(_0x5e9e5f)return _0x2f13e5(_0x5e9e5f);return _0x47903c(_0x2c9c4d);});})[_0xcc08('0x18')](function(){return new BPromise(function(_0x3dbf88,_0x4614b8){rimraf(_0x17c451,function(_0x465c93){if(_0x465c93)_0x4614b8(_0x465c93);return _0x3dbf88();});});})['then'](function(){return _0x3b4556[_0xcc08('0x50')](_0x2b589b,_0x3e19ad,function(_0x4339bb){if(_0x4339bb){console[_0xcc08('0x79')](_0xcc08('0x7a'),_0x4339bb);}else{fs[_0xcc08('0x7b')](_0x2b589b);}});});});}else{return _0x3b4556[_0xcc08('0x19')](0xc8);}})['catch'](handleError(_0x3b4556,null));}; \ No newline at end of file +var _0xd0af=['create','catch','body','find','describe','addMessage','WhatsappMessage','ids','findOne','length','hasOwnProperty','nolimit','sort','where','pick','filter','$gte','split','format','includeAll','include','rows','addTags','setTags','omit','spread','Tag','color','emit','whatsappInteractionTags:save','removeTags','download','unix','toString','join','files','tmp','server','attachments','push','User','CmContact','Contact','lastName','Attachment','Messages','direction','secret','WhatsappAccount','Owner','get','mkdirSync','Account','fullname','createdAt','closed','disposition','basename','existsSync','createReadStream','createWriteStream','YYYY-MM-DD\x20HH:mm:ss','out','System','firstName','value','root','views','downloadInteraction.ejs','transcript-','.pdf','Whatsapp','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','stack','name','index','map','WhatsappInteraction','rawAttributes','key','getOptions','findAll','whatsapp','query','user','params','model','keys','filters','intersection','attributes','fields','merge','options'];(function(_0x36cc69,_0x281b82){var _0x25f50b=function(_0x12d15e){while(--_0x12d15e){_0x36cc69['push'](_0x36cc69['shift']());}};_0x25f50b(++_0x281b82);}(_0xd0af,0x1cb));var _0xfd0a=function(_0x49d5c7,_0x3f77aa){_0x49d5c7=_0x49d5c7-0x0;var _0x2f1f5e=_0xd0af[_0x49d5c7];return _0x2f1f5e;};'use strict';var rimraf=require(_0xfd0a('0x0'));var zipdir=require(_0xfd0a('0x1'));var moment=require(_0xfd0a('0x2'));var BPromise=require(_0xfd0a('0x3'));var util=require(_0xfd0a('0x4'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0xfd0a('0x5'));var Redis=require(_0xfd0a('0x6'));var interaction=require(_0xfd0a('0x7'));var qs=require(_0xfd0a('0x8'));var pdf=require(_0xfd0a('0x9'));var logger=require(_0xfd0a('0xa'))(_0xfd0a('0xb'));var config=require(_0xfd0a('0xc'));var db=require(_0xfd0a('0xd'))['db'];config[_0xfd0a('0xe')]=_['defaults'](config[_0xfd0a('0xe')],{'host':_0xfd0a('0xf'),'port':0x18eb});var socket=require(_0xfd0a('0x10'))(new Redis(config[_0xfd0a('0xe')]));require(_0xfd0a('0x11'))[_0xfd0a('0x12')](socket);function respondWithStatusCode(_0x26d8b4,_0x38f6f2){_0x38f6f2=_0x38f6f2||0xcc;return function(_0x38f819){if(_0x38f819){return _0x26d8b4[_0xfd0a('0x13')](_0x38f6f2);}return _0x26d8b4[_0xfd0a('0x14')](_0x38f6f2)[_0xfd0a('0x15')]();};}function respondWithResult(_0x3abb3d,_0x5579c2){_0x5579c2=_0x5579c2||0xc8;return function(_0x132fba){if(_0x132fba){return _0x3abb3d[_0xfd0a('0x14')](_0x5579c2)[_0xfd0a('0x16')](_0x132fba);}};}function respondWithFilteredResult(_0x591384,_0x1f3f4d){return function(_0x7ec104){if(_0x7ec104){var _0x2674b7=typeof _0x1f3f4d[_0xfd0a('0x17')]===_0xfd0a('0x18')&&typeof _0x1f3f4d[_0xfd0a('0x19')]===_0xfd0a('0x18');var _0x35b7f7=_0x7ec104['count'];var _0x2c8592=_0x2674b7?0x0:_0x1f3f4d[_0xfd0a('0x17')];var _0x3875cc=_0x2674b7?_0x7ec104[_0xfd0a('0x1a')]:_0x1f3f4d[_0xfd0a('0x17')]+_0x1f3f4d['limit'];var _0x1855da;if(_0x3875cc>=_0x35b7f7){_0x3875cc=_0x35b7f7;_0x1855da=0xc8;}else{_0x1855da=0xce;}_0x591384['status'](_0x1855da);return _0x591384[_0xfd0a('0x1b')](_0xfd0a('0x1c'),_0x2c8592+'-'+_0x3875cc+'/'+_0x35b7f7)[_0xfd0a('0x16')](_0x7ec104);}return null;};}function saveUpdates(_0x377070){return function(_0x1e6e5b){if(_0x1e6e5b){return _0x1e6e5b[_0xfd0a('0x1d')](_0x377070)[_0xfd0a('0x1e')](function(_0x5ee02d){return _0x5ee02d;});}return null;};}function removeEntity(_0x1932a9){return function(_0x352a94){if(_0x352a94){return _0x352a94[_0xfd0a('0x1f')]()[_0xfd0a('0x1e')](function(){_0x1932a9[_0xfd0a('0x14')](0xcc)[_0xfd0a('0x15')]();});}};}function handleEntityNotFound(_0x5f57ce){return function(_0x3a3f06){if(!_0x3a3f06){_0x5f57ce[_0xfd0a('0x13')](0x194);}return _0x3a3f06;};}function handleError(_0x21eb30,_0x59c4e0){_0x59c4e0=_0x59c4e0||0x1f4;return function(_0x5e6d98){logger['error'](_0x5e6d98[_0xfd0a('0x20')]);if(_0x5e6d98[_0xfd0a('0x21')]){delete _0x5e6d98[_0xfd0a('0x21')];}_0x21eb30['status'](_0x59c4e0)['send'](_0x5e6d98);};}exports[_0xfd0a('0x22')]=function(_0xe32996,_0x116ba1){var _0x40bf37={};var _0x6ef9a0=_[_0xfd0a('0x23')](db[_0xfd0a('0x24')][_0xfd0a('0x25')],function(_0xe5f2bd){return{'name':_0xe5f2bd['fieldName'],'type':_0xe5f2bd['type'][_0xfd0a('0x26')]};});_0x40bf37=qs[_0xfd0a('0x27')](_0x6ef9a0,_0xe32996);return interaction[_0xfd0a('0x28')](_0xfd0a('0x29'),_0xe32996[_0xfd0a('0x2a')],_0xe32996[_0xfd0a('0x2b')],_0x40bf37,_0x6ef9a0)[_0xfd0a('0x1e')](respondWithFilteredResult(_0x116ba1,_0x40bf37))['catch'](handleError(_0x116ba1,null));};exports['show']=function(_0x2c04e4,_0x6cfc3d){var _0x4f885f={'raw':![],'where':{'id':_0x2c04e4[_0xfd0a('0x2c')]['id']}},_0xae68c9={};_0xae68c9[_0xfd0a('0x2d')]=_['keys'](db['WhatsappInteraction'][_0xfd0a('0x25')]);_0xae68c9['query']=_[_0xfd0a('0x2e')](_0x2c04e4[_0xfd0a('0x2a')]);_0xae68c9[_0xfd0a('0x2f')]=_[_0xfd0a('0x30')](_0xae68c9[_0xfd0a('0x2d')],_0xae68c9['query']);_0x4f885f[_0xfd0a('0x31')]=_[_0xfd0a('0x30')](_0xae68c9[_0xfd0a('0x2d')],qs[_0xfd0a('0x32')](_0x2c04e4[_0xfd0a('0x2a')][_0xfd0a('0x32')]));_0x4f885f[_0xfd0a('0x31')]=_0x4f885f['attributes']['length']?_0x4f885f[_0xfd0a('0x31')]:_0xae68c9['model'];if(_0x2c04e4[_0xfd0a('0x2a')]['includeAll']){_0x4f885f['include']=[{'all':!![]}];}_0x4f885f=_[_0xfd0a('0x33')]({},_0x4f885f,_0x2c04e4[_0xfd0a('0x34')]);return db[_0xfd0a('0x24')]['find'](_0x4f885f)[_0xfd0a('0x1e')](handleEntityNotFound(_0x6cfc3d,null))['then'](respondWithResult(_0x6cfc3d,null))['catch'](handleError(_0x6cfc3d,null));};exports[_0xfd0a('0x35')]=function(_0x526808,_0x24da54){return db[_0xfd0a('0x24')][_0xfd0a('0x35')](_0x526808['body'],{})[_0xfd0a('0x1e')](respondWithResult(_0x24da54,0xc9))[_0xfd0a('0x36')](handleError(_0x24da54,null));};exports['update']=function(_0x3f2b41,_0x5f7145){if(_0x3f2b41[_0xfd0a('0x37')]['id']){delete _0x3f2b41['body']['id'];}return db[_0xfd0a('0x24')][_0xfd0a('0x38')]({'where':{'id':_0x3f2b41['params']['id']}})[_0xfd0a('0x1e')](handleEntityNotFound(_0x5f7145,null))[_0xfd0a('0x1e')](saveUpdates(_0x3f2b41[_0xfd0a('0x37')],null))[_0xfd0a('0x1e')](respondWithResult(_0x5f7145,null))[_0xfd0a('0x36')](handleError(_0x5f7145,null));};exports[_0xfd0a('0x1f')]=function(_0x4f7704,_0x2de7ee){return db[_0xfd0a('0x24')][_0xfd0a('0x38')]({'where':{'id':_0x4f7704[_0xfd0a('0x2c')]['id']}})['then'](handleEntityNotFound(_0x2de7ee,null))[_0xfd0a('0x1e')](removeEntity(_0x2de7ee,null))['catch'](handleError(_0x2de7ee,null));};exports[_0xfd0a('0x39')]=function(_0x348bed,_0x3e256a){return db[_0xfd0a('0x24')][_0xfd0a('0x39')]()['then'](respondWithResult(_0x3e256a,null))[_0xfd0a('0x36')](handleError(_0x3e256a,null));};exports[_0xfd0a('0x3a')]=function(_0x3ceb91,_0x2081d1){return db[_0xfd0a('0x3b')][_0xfd0a('0x38')]({'where':{'id':_0x3ceb91[_0xfd0a('0x2c')]['id']}})[_0xfd0a('0x1e')](handleEntityNotFound(_0x2081d1,null))['then'](function(_0x35ccab){if(_0x35ccab){return _0x35ccab[_0xfd0a('0x3a')](_0x3ceb91[_0xfd0a('0x37')]['ids'],_['omit'](_0x3ceb91[_0xfd0a('0x37')],[_0xfd0a('0x3c'),'id'])||{});}})[_0xfd0a('0x1e')](respondWithResult(_0x2081d1,null))[_0xfd0a('0x36')](handleError(_0x2081d1,null));};exports['getMessages']=function(_0x2bc807,_0x5206af){var _0x2715c8={'raw':![],'where':{}};var _0x2b2310={};var _0x588532={'count':0x0,'rows':[]};return db[_0xfd0a('0x24')][_0xfd0a('0x3d')]({'where':{'id':_0x2bc807[_0xfd0a('0x2c')]['id']}})[_0xfd0a('0x1e')](handleEntityNotFound(_0x5206af,null))[_0xfd0a('0x1e')](function(_0x175f01){if(_0x175f01){_0x2b2310[_0xfd0a('0x2d')]=_[_0xfd0a('0x2e')](db[_0xfd0a('0x3b')][_0xfd0a('0x25')]);_0x2b2310['query']=_['keys'](_0x2bc807[_0xfd0a('0x2a')]);_0x2b2310[_0xfd0a('0x2f')]=_['intersection'](_0x2b2310[_0xfd0a('0x2d')],_0x2b2310[_0xfd0a('0x2a')]);_0x2715c8[_0xfd0a('0x31')]=_[_0xfd0a('0x30')](_0x2b2310[_0xfd0a('0x2d')],qs[_0xfd0a('0x32')](_0x2bc807[_0xfd0a('0x2a')][_0xfd0a('0x32')]));_0x2715c8[_0xfd0a('0x31')]=_0x2715c8['attributes'][_0xfd0a('0x3e')]?_0x2715c8[_0xfd0a('0x31')]:_0x2b2310[_0xfd0a('0x2d')];if(!_0x2bc807[_0xfd0a('0x2a')][_0xfd0a('0x3f')](_0xfd0a('0x40'))){_0x2715c8[_0xfd0a('0x19')]=qs['limit'](_0x2bc807[_0xfd0a('0x2a')][_0xfd0a('0x19')]);_0x2715c8[_0xfd0a('0x17')]=qs[_0xfd0a('0x17')](_0x2bc807[_0xfd0a('0x2a')]['offset']);}_0x2715c8['order']=qs[_0xfd0a('0x41')](_0x2bc807[_0xfd0a('0x2a')][_0xfd0a('0x41')]);_0x2715c8[_0xfd0a('0x42')]=qs[_0xfd0a('0x2f')](_[_0xfd0a('0x43')](_0x2bc807['query'],_0x2b2310[_0xfd0a('0x2f')]));_0x2715c8[_0xfd0a('0x42')]['WhatsappInteractionId']=_0x175f01['id'];if(_0x2bc807[_0xfd0a('0x2a')][_0xfd0a('0x44')]){_0x2715c8[_0xfd0a('0x42')]=_['merge'](_0x2715c8[_0xfd0a('0x42')],{'$or':_[_0xfd0a('0x23')](_0x2715c8[_0xfd0a('0x31')],function(_0x11e457){var _0x12dfbf={};_0x12dfbf[_0x11e457]={'$like':'%'+_0x2bc807['query'][_0xfd0a('0x44')]+'%'};return _0x12dfbf;})});}if(_0x2bc807[_0xfd0a('0x2a')][_0xfd0a('0x45')]){var _0x288809=_0x2bc807[_0xfd0a('0x2a')][_0xfd0a('0x45')][_0xfd0a('0x46')](',');var _0x148bed={};_0x148bed[_0x288809[0x0]]={'$gte':moment(_0x288809[0x1])[_0xfd0a('0x47')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2715c8[_0xfd0a('0x42')]=_[_0xfd0a('0x33')](_0x2715c8['where'],_0x148bed);}_0x2715c8=_[_0xfd0a('0x33')]({},_0x2715c8,_0x2bc807[_0xfd0a('0x34')]);return db['WhatsappMessage'][_0xfd0a('0x1a')]({'where':_0x2715c8['where']})[_0xfd0a('0x1e')](function(_0x50105e){_0x588532[_0xfd0a('0x1a')]=_0x50105e;if(_0x2bc807[_0xfd0a('0x2a')][_0xfd0a('0x48')]){_0x2715c8[_0xfd0a('0x49')]=[{'all':!![]}];}return db[_0xfd0a('0x3b')][_0xfd0a('0x28')](_0x2715c8);})['then'](function(_0x2114e4){_0x588532[_0xfd0a('0x4a')]=_0x2114e4;return _0x588532;});}})[_0xfd0a('0x1e')](respondWithFilteredResult(_0x5206af,_0x2715c8))[_0xfd0a('0x36')](handleError(_0x5206af,null));};exports[_0xfd0a('0x4b')]=function(_0x4fbf8f,_0x3e4868){return db[_0xfd0a('0x24')][_0xfd0a('0x38')]({'where':{'id':_0x4fbf8f['params']['id']}})['then'](handleEntityNotFound(_0x3e4868,null))[_0xfd0a('0x1e')](function(_0x2d8174){if(_0x2d8174){return _0x2d8174[_0xfd0a('0x4c')](_0x4fbf8f[_0xfd0a('0x37')]['ids'],_[_0xfd0a('0x4d')](_0x4fbf8f[_0xfd0a('0x37')],[_0xfd0a('0x3c'),'id'])||{})[_0xfd0a('0x4e')](function(){return db[_0xfd0a('0x4f')][_0xfd0a('0x28')]({'attributes':['id','name',_0xfd0a('0x50')],'where':{'id':_0x4fbf8f[_0xfd0a('0x37')][_0xfd0a('0x3c')]}});})[_0xfd0a('0x1e')](function(_0x2383ef){socket[_0xfd0a('0x51')](_0xfd0a('0x52'),{'id':Number(_0x4fbf8f[_0xfd0a('0x2c')]['id']),'tags':_0x2383ef||[]});return{'id':Number(_0x4fbf8f[_0xfd0a('0x2c')]['id']),'tags':_0x2383ef||[]};});}})[_0xfd0a('0x1e')](respondWithResult(_0x3e4868,null))[_0xfd0a('0x36')](handleError(_0x3e4868,null));};exports[_0xfd0a('0x53')]=function(_0x14a200,_0x3e5db4){return db[_0xfd0a('0x24')][_0xfd0a('0x38')]({'where':{'id':_0x14a200[_0xfd0a('0x2c')]['id']}})[_0xfd0a('0x1e')](handleEntityNotFound(_0x3e5db4,null))[_0xfd0a('0x1e')](function(_0x481122){if(_0x481122){return _0x481122[_0xfd0a('0x53')](_0x14a200['query'][_0xfd0a('0x3c')]);}})[_0xfd0a('0x1e')](respondWithStatusCode(_0x3e5db4,null))[_0xfd0a('0x36')](handleError(_0x3e5db4,null));};exports[_0xfd0a('0x54')]=function(_0xaeb884,_0x38fb9f){var _0x29f0a3=moment()[_0xfd0a('0x55')]()[_0xfd0a('0x56')]();var _0x5a932b=path[_0xfd0a('0x57')](config['root'],'server',_0xfd0a('0x58'),_0xfd0a('0x59'));var _0x35c9f0=path[_0xfd0a('0x57')](config['root'],_0xfd0a('0x5a'),'files',_0xfd0a('0x5b'));var _0x19125e=path[_0xfd0a('0x57')](_0x5a932b,_0x29f0a3);var _0x27e4fc=util[_0xfd0a('0x47')]('transcript-%d-%s.zip',_0xaeb884[_0xfd0a('0x2c')]['id'],_0x29f0a3);var _0x40f559=path[_0xfd0a('0x57')](_0x5a932b,_0x27e4fc);var _0x18c5fa=[];_0x18c5fa[_0xfd0a('0x5c')]({'model':db[_0xfd0a('0x5d')],'as':_0xfd0a('0x5d'),'attributes':['id','fullname'],'raw':!![]});_0x18c5fa[_0xfd0a('0x5c')]({'model':db[_0xfd0a('0x5e')],'as':_0xfd0a('0x5f'),'attributes':['id','firstName',_0xfd0a('0x60')],'raw':!![]});if(_0xaeb884[_0xfd0a('0x2a')][_0xfd0a('0x5b')]){_0x18c5fa[_0xfd0a('0x5c')]({'model':db[_0xfd0a('0x61')],'as':_0xfd0a('0x61'),'raw':!![]});}var _0x40001f=[{'model':db[_0xfd0a('0x3b')],'as':_0xfd0a('0x62'),'attributes':['id',_0xfd0a('0x37'),'createdAt',_0xfd0a('0x63'),_0xfd0a('0x64'),'read'],'include':_0x18c5fa}];_0x40001f[_0xfd0a('0x5c')]({'model':db[_0xfd0a('0x65')],'as':'Account','attributes':['id',_0xfd0a('0x21')]});_0x40001f[_0xfd0a('0x5c')]({'model':db[_0xfd0a('0x5d')],'as':_0xfd0a('0x66'),'attributes':['id','fullname']});return db['WhatsappInteraction']['find']({'where':{'id':_0xaeb884[_0xfd0a('0x2c')]['id']},'include':_0x40001f})[_0xfd0a('0x1e')](handleEntityNotFound(_0x38fb9f,null))[_0xfd0a('0x1e')](function(_0xa16a63){if(_0xa16a63){var _0x339f93=_0xa16a63[_0xfd0a('0x67')]({'plain':!![]});fs[_0xfd0a('0x68')](_0x19125e);var _0x14af6d={'channel':'Whatsapp','account':_0x339f93[_0xfd0a('0x69')][_0xfd0a('0x21')],'agent':_0x339f93['Owner']?_0x339f93[_0xfd0a('0x66')][_0xfd0a('0x6a')]:'N.A.','createdAt':moment(_0x339f93[_0xfd0a('0x6b')])[_0xfd0a('0x47')]('YYYY-MM-DD\x20HH:mm:ss')[_0xfd0a('0x56')](),'closedAt':_0x339f93[_0xfd0a('0x6c')]?moment(_0x339f93['closedAt'])[_0xfd0a('0x47')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x339f93[_0xfd0a('0x6d')],'messages':_(_0x339f93['Messages'])[_0xfd0a('0x44')]({'secret':![]})[_0xfd0a('0x23')](function(_0x354296){if(_0x354296['Attachment']){var _0x371610=path[_0xfd0a('0x57')](_0x35c9f0,_0x354296[_0xfd0a('0x61')][_0xfd0a('0x6e')]);if(fs[_0xfd0a('0x6f')](_0x371610)){fs[_0xfd0a('0x70')](_0x371610)['pipe'](fs[_0xfd0a('0x71')](path[_0xfd0a('0x57')](_0x19125e,_0x354296[_0xfd0a('0x61')]['basename'])));}}return{'date':moment(_0x354296[_0xfd0a('0x6b')])[_0xfd0a('0x47')](_0xfd0a('0x72'))[_0xfd0a('0x56')](),'sender':_0x354296['direction']===_0xfd0a('0x73')?_0x354296[_0xfd0a('0x5d')]?_0x354296[_0xfd0a('0x5d')][_0xfd0a('0x6a')]:_0xfd0a('0x74'):_0x354296['Contact'][_0xfd0a('0x75')]+(_0x354296[_0xfd0a('0x5f')]['lastName']?'\x20'+_0x354296['Contact'][_0xfd0a('0x60')]:''),'body':_0x354296['Attachment']?_0x354296[_0xfd0a('0x61')][_0xfd0a('0x6e')]:_0x354296[_0xfd0a('0x37')],'direction':_0x354296[_0xfd0a('0x63')]===_0xfd0a('0x73')?'A':'C','secret':_0x354296[_0xfd0a('0x64')],'read':_0x354296['read'],'attachment':_0x354296[_0xfd0a('0x61')]};})[_0xfd0a('0x76')]()};return ejs['renderFile'](path['join'](config[_0xfd0a('0x77')],_0xfd0a('0x5a'),_0xfd0a('0x78'),_0xfd0a('0x79')),{'interaction':_0x14af6d})[_0xfd0a('0x1e')](function(_0x492577){var _0x158dbc=path[_0xfd0a('0x57')](_0x19125e,_0xfd0a('0x7a')+_0x339f93['id']+'-'+_0x29f0a3+_0xfd0a('0x7b'));var _0x56c973={'path':_0x158dbc,'channel':_0xfd0a('0x7c'),'interactionId':_0x339f93['id']};return pdf['createPdfFromHTML'](_0x492577,_0x56c973);})[_0xfd0a('0x1e')](function(){return new BPromise(function(_0x3d26ed,_0x469f62){zipdir(_0x19125e,{'saveTo':_0x40f559},function(_0x416741,_0xf8f9e1){if(_0x416741)return _0x469f62(_0x416741);return _0x3d26ed(_0xf8f9e1);});})[_0xfd0a('0x1e')](function(){return new BPromise(function(_0x2f0e21,_0xcbfdcc){rimraf(_0x19125e,function(_0xa8e7cf){if(_0xa8e7cf)_0xcbfdcc(_0xa8e7cf);return _0x2f0e21();});});})['then'](function(){return _0x38fb9f['download'](_0x40f559,_0x27e4fc,function(_0x292128){if(_0x292128){console[_0xfd0a('0x7d')](_0xfd0a('0x7e'),_0x292128);}else{fs[_0xfd0a('0x7f')](_0x40f559);}});});});}else{return _0x38fb9f['sendStatus'](0xc8);}})[_0xfd0a('0x36')](handleError(_0x38fb9f,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index b874476..ead21bc 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 _0x834d=['update','remove','getUsers','then','setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','save'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x834d,0x140));var _0xd834=function(_0x585d42,_0x22cd11){_0x585d42=_0x585d42-0x0;var _0x356b3b=_0x834d[_0x585d42];return _0x356b3b;};'use strict';var EventEmitter=require(_0xd834('0x0'));var WhatsappInteraction=require(_0xd834('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0xd834('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd834('0x2'),'afterUpdate':_0xd834('0x3'),'afterDestroy':_0xd834('0x4')};function emitEvent(_0xfee6e0){return function(_0x4a7903,_0x149c3e,_0x3f0759){_0x4a7903[_0xd834('0x5')]({'attributes':['id'],'raw':!![]})[_0xd834('0x6')](function(_0x28907e){_0x4a7903[_0xd834('0x7')](_0xd834('0x8'),_0x28907e[_0xd834('0x9')](function(_0x4565f1){return{'id':_0x4565f1['id']};}));return WhatsappMessage[_0xd834('0xa')]({'where':{'WhatsappInteractionId':_0x4a7903['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x402f47){_0x4a7903[_0xd834('0x7')]('unreadMessages',_0x402f47[_0xd834('0xb')]);WhatsappInteractionEvents[_0xd834('0xc')](_0xfee6e0+':'+_0x4a7903['id'],_0x4a7903);WhatsappInteractionEvents['emit'](_0xfee6e0,_0x4a7903);_0x3f0759(null);})[_0xd834('0xd')](_0x3f0759(null));};}for(var e in events){if(events[_0xd834('0xe')](e)){var event=events[e];WhatsappInteraction[_0xd834('0xf')](e,emitEvent(event));}}module[_0xd834('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x85cf=['map','length','emit','catch','hasOwnProperty','exports','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','then','setDataValue','Users'];(function(_0x4ea88a,_0x2b52be){var _0x4bae74=function(_0x5edcdc){while(--_0x5edcdc){_0x4ea88a['push'](_0x4ea88a['shift']());}};_0x4bae74(++_0x2b52be);}(_0x85cf,0x76));var _0xf85c=function(_0x5d1ae7,_0x5b7ffe){_0x5d1ae7=_0x5d1ae7-0x0;var _0x5ee7e0=_0x85cf[_0x5d1ae7];return _0x5ee7e0;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0xf85c('0x0'))['db'][_0xf85c('0x1')];var WhatsappMessage=require(_0xf85c('0x0'))['db'][_0xf85c('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xf85c('0x3')](0x0);var events={'afterCreate':_0xf85c('0x4'),'afterUpdate':_0xf85c('0x5'),'afterDestroy':_0xf85c('0x6')};function emitEvent(_0x495110){return function(_0x5d7a11,_0x95f9f8,_0x3a5a32){_0x5d7a11['getUsers']({'attributes':['id'],'raw':!![]})[_0xf85c('0x7')](function(_0x41d08d){_0x5d7a11[_0xf85c('0x8')](_0xf85c('0x9'),_0x41d08d[_0xf85c('0xa')](function(_0x55bd07){return{'id':_0x55bd07['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x5d7a11['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf85c('0x7')](function(_0x2de6b4){_0x5d7a11['setDataValue']('unreadMessages',_0x2de6b4[_0xf85c('0xb')]);WhatsappInteractionEvents['emit'](_0x495110+':'+_0x5d7a11['id'],_0x5d7a11);WhatsappInteractionEvents[_0xf85c('0xc')](_0x495110,_0x5d7a11);_0x3a5a32(null);})[_0xf85c('0xd')](_0x3a5a32(null));};}for(var e in events){if(events[_0xf85c('0xe')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xf85c('0xf')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index feadeaa..a4f0d37 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 _0xf935=['changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions'];(function(_0x41da29,_0x5eee3d){var _0x3b288c=function(_0x88d477){while(--_0x88d477){_0x41da29['push'](_0x41da29['shift']());}};_0x3b288c(++_0x5eee3d);}(_0xf935,0x1eb));var _0x5f93=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf935[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x5f93('0x0'));var util=require(_0x5f93('0x1'));var logger=require('../../config/logger')(_0x5f93('0x2'));var moment=require(_0x5f93('0x3'));var BPromise=require(_0x5f93('0x4'));var rp=require(_0x5f93('0x5'));var fs=require('fs');var path=require(_0x5f93('0x6'));var rimraf=require('rimraf');var config=require(_0x5f93('0x7'));var attributes=require(_0x5f93('0x8'));module[_0x5f93('0x9')]=function(_0x4414d1,_0x3c0f72){return _0x4414d1[_0x5f93('0xa')](_0x5f93('0xb'),attributes,{'tableName':_0x5f93('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x34a148,_0x4bb35a,_0x578ad0){if(_0x34a148[_0x5f93('0xd')](_0x5f93('0xe'))){_0x34a148[_0x5f93('0xf')]=moment()[_0x5f93('0x10')](_0x5f93('0x11'));}_0x578ad0(null,_0x34a148);}}});}; \ No newline at end of file +var _0x9144=['exports','define','WhatsappInteraction','closed','closedAt','format','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x429948,_0x1a6851){var _0x35d5d1=function(_0x574853){while(--_0x574853){_0x429948['push'](_0x429948['shift']());}};_0x35d5d1(++_0x1a6851);}(_0x9144,0xca));var _0x4914=function(_0x7611ce,_0x4a4441){_0x7611ce=_0x7611ce-0x0;var _0x67d3ab=_0x9144[_0x7611ce];return _0x67d3ab;};'use strict';var _=require(_0x4914('0x0'));var util=require(_0x4914('0x1'));var logger=require(_0x4914('0x2'))('api');var moment=require(_0x4914('0x3'));var BPromise=require('bluebird');var rp=require(_0x4914('0x4'));var fs=require('fs');var path=require(_0x4914('0x5'));var rimraf=require(_0x4914('0x6'));var config=require(_0x4914('0x7'));var attributes=require('./whatsappInteraction.attributes');module[_0x4914('0x8')]=function(_0x4e9b90,_0x2d9560){return _0x4e9b90[_0x4914('0x9')](_0x4914('0xa'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x9140f,_0x113bd8,_0x3f64f6){if(_0x9140f['changed'](_0x4914('0xb'))){_0x9140f[_0x4914('0xc')]=moment()[_0x4914('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3f64f6(null,_0x9140f);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index c1a066e..662d3fd 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 _0x2674=['UpdateWhatsappInteraction','WhatsappInteraction','update','options','raw','where','attributes','AddTagsToWhatsappInteraction','find','body','omit','spread','AddTags','lodash','moment','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x2674,0x189));var _0x4267=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x2674[_0x513aa5];return _0x1a1a7c;};'use strict';var _=require(_0x4267('0x0'));var util=require('util');var moment=require(_0x4267('0x1'));var BPromise=require('bluebird');var rs=require(_0x4267('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4267('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4267('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4267('0x5'));var client=jayson[_0x4267('0x6')][_0x4267('0x7')]({'port':0x232a});config[_0x4267('0x8')]=_[_0x4267('0x9')](config[_0x4267('0x8')],{'host':_0x4267('0xa'),'port':0x18eb});var socket=require(_0x4267('0xb'))(new Redis(config['redis']));require('./whatsappInteraction.socket')[_0x4267('0xc')](socket);function respondWithRpcPromise(_0x351b54,_0x98feea,_0x498377){return new BPromise(function(_0x358696,_0x54b7e0){return client[_0x4267('0xd')](_0x351b54,_0x498377)[_0x4267('0xe')](function(_0x45aa67){logger[_0x4267('0xf')](_0x4267('0x10'),_0x98feea,_0x4267('0x11'));logger[_0x4267('0x12')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x98feea,_0x4267('0x11'),JSON[_0x4267('0x13')](_0x45aa67));if(_0x45aa67[_0x4267('0x14')]){if(_0x45aa67[_0x4267('0x14')][_0x4267('0x15')]===0x1f4){logger[_0x4267('0x14')](_0x4267('0x10'),_0x98feea,_0x45aa67[_0x4267('0x14')][_0x4267('0x16')]);return _0x54b7e0(_0x45aa67[_0x4267('0x14')]['message']);}logger[_0x4267('0x14')](_0x4267('0x10'),_0x98feea,_0x45aa67[_0x4267('0x14')][_0x4267('0x16')]);return _0x358696(_0x45aa67[_0x4267('0x14')][_0x4267('0x16')]);}else{logger[_0x4267('0xf')]('WhatsappInteraction,\x20%s,\x20%s',_0x98feea,'request\x20sent');_0x358696(_0x45aa67[_0x4267('0x17')][_0x4267('0x16')]);}})[_0x4267('0x18')](function(_0x2533e2){logger[_0x4267('0x14')](_0x4267('0x10'),_0x98feea,_0x2533e2);_0x54b7e0(_0x2533e2);});});}exports[_0x4267('0x19')]=function(_0x52039c){var _0x1fb8ea=this;return new Promise(function(_0x104670,_0x203bb3){return db[_0x4267('0x1a')][_0x4267('0x1b')](_0x52039c['body'],{'raw':_0x52039c[_0x4267('0x1c')]?_0x52039c[_0x4267('0x1c')][_0x4267('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52039c[_0x4267('0x1c')]?_0x52039c[_0x4267('0x1c')][_0x4267('0x1e')]||null:null,'attributes':_0x52039c[_0x4267('0x1c')]?_0x52039c[_0x4267('0x1c')][_0x4267('0x1f')]||null:null,'limit':_0x52039c['options']?_0x52039c[_0x4267('0x1c')]['limit']||null:null})[_0x4267('0xe')](function(_0x4406dc){logger['info'](_0x4267('0x19'),_0x52039c);logger[_0x4267('0x12')](_0x4267('0x19'),_0x52039c,JSON[_0x4267('0x13')](_0x4406dc));_0x104670(_0x4406dc);})[_0x4267('0x18')](function(_0x185847){logger[_0x4267('0x14')](_0x4267('0x19'),_0x185847[_0x4267('0x16')],_0x52039c);_0x203bb3(_0x1fb8ea[_0x4267('0x14')](0x1f4,_0x185847['message']));});});};exports[_0x4267('0x20')]=function(_0x422a11){return new Promise(function(_0x18bade,_0x2f082d){return db['WhatsappInteraction'][_0x4267('0x21')]({'where':_0x422a11[_0x4267('0x1c')]?_0x422a11['options']['where']||null:null})['then'](function(_0x345479){if(_0x345479){return _0x345479['addTags'](_0x422a11[_0x4267('0x22')]['ids'],_[_0x4267('0x23')](_0x422a11[_0x4267('0x22')],['ids','id'])||{});}})[_0x4267('0x24')](function(_0x337a7d){logger[_0x4267('0xf')](_0x4267('0x25'),_0x422a11);logger[_0x4267('0x12')](_0x4267('0x25'),_0x422a11,JSON[_0x4267('0x13')](_0x337a7d));_0x18bade(_0x337a7d);})['catch'](function(_0x4c7b54){logger[_0x4267('0x14')](_0x4267('0x25'),_0x4c7b54[_0x4267('0x16')],_0x422a11);_0x2f082d(_this['error'](0x1f4,_0x4c7b54[_0x4267('0x16')]));});});}; \ No newline at end of file +var _0xf87b=['AddTagsToWhatsappInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','result','catch','body','options','raw','where','limit','UpdateWhatsappInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf87b,0x12d));var _0xbf87=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf87b[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xbf87('0x0'));var util=require(_0xbf87('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf87('0x2'));var db=require(_0xbf87('0x3'))['db'];var utils=require(_0xbf87('0x4'));var logger=require(_0xbf87('0x5'))(_0xbf87('0x6'));var config=require(_0xbf87('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xbf87('0x8')][_0xbf87('0x9')]({'port':0x232a});config[_0xbf87('0xa')]=_[_0xbf87('0xb')](config[_0xbf87('0xa')],{'host':_0xbf87('0xc'),'port':0x18eb});var socket=require(_0xbf87('0xd'))(new Redis(config[_0xbf87('0xa')]));require(_0xbf87('0xe'))[_0xbf87('0xf')](socket);function respondWithRpcPromise(_0x362f44,_0x56f348,_0x354e4e){return new BPromise(function(_0x4b3d34,_0x37d881){return client[_0xbf87('0x10')](_0x362f44,_0x354e4e)[_0xbf87('0x11')](function(_0x21b918){logger[_0xbf87('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x56f348,_0xbf87('0x13'));logger[_0xbf87('0x14')](_0xbf87('0x15'),_0x56f348,_0xbf87('0x13'),JSON[_0xbf87('0x16')](_0x21b918));if(_0x21b918[_0xbf87('0x17')]){if(_0x21b918[_0xbf87('0x17')][_0xbf87('0x18')]===0x1f4){logger['error'](_0xbf87('0x19'),_0x56f348,_0x21b918[_0xbf87('0x17')][_0xbf87('0x1a')]);return _0x37d881(_0x21b918[_0xbf87('0x17')][_0xbf87('0x1a')]);}logger[_0xbf87('0x17')](_0xbf87('0x19'),_0x56f348,_0x21b918[_0xbf87('0x17')][_0xbf87('0x1a')]);return _0x4b3d34(_0x21b918['error'][_0xbf87('0x1a')]);}else{logger['info'](_0xbf87('0x19'),_0x56f348,_0xbf87('0x13'));_0x4b3d34(_0x21b918[_0xbf87('0x1b')]['message']);}})[_0xbf87('0x1c')](function(_0x4d0f0b){logger[_0xbf87('0x17')]('WhatsappInteraction,\x20%s,\x20%s',_0x56f348,_0x4d0f0b);_0x37d881(_0x4d0f0b);});});}exports['UpdateWhatsappInteraction']=function(_0x59e67b){var _0x2aa2d6=this;return new Promise(function(_0x3575e4,_0xea9cc3){return db['WhatsappInteraction']['update'](_0x59e67b[_0xbf87('0x1d')],{'raw':_0x59e67b[_0xbf87('0x1e')]?_0x59e67b[_0xbf87('0x1e')][_0xbf87('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59e67b[_0xbf87('0x1e')]?_0x59e67b[_0xbf87('0x1e')][_0xbf87('0x20')]||null:null,'attributes':_0x59e67b[_0xbf87('0x1e')]?_0x59e67b['options']['attributes']||null:null,'limit':_0x59e67b[_0xbf87('0x1e')]?_0x59e67b[_0xbf87('0x1e')][_0xbf87('0x21')]||null:null})['then'](function(_0x372ee9){logger[_0xbf87('0x12')]('UpdateWhatsappInteraction',_0x59e67b);logger['debug'](_0xbf87('0x22'),_0x59e67b,JSON['stringify'](_0x372ee9));_0x3575e4(_0x372ee9);})[_0xbf87('0x1c')](function(_0x5227f6){logger[_0xbf87('0x17')](_0xbf87('0x22'),_0x5227f6[_0xbf87('0x1a')],_0x59e67b);_0xea9cc3(_0x2aa2d6['error'](0x1f4,_0x5227f6[_0xbf87('0x1a')]));});});};exports[_0xbf87('0x23')]=function(_0x281c53){return new Promise(function(_0x14bf72,_0x587559){return db['WhatsappInteraction'][_0xbf87('0x24')]({'where':_0x281c53['options']?_0x281c53[_0xbf87('0x1e')][_0xbf87('0x20')]||null:null})['then'](function(_0x31d929){if(_0x31d929){return _0x31d929[_0xbf87('0x25')](_0x281c53['body'][_0xbf87('0x26')],_[_0xbf87('0x27')](_0x281c53[_0xbf87('0x1d')],[_0xbf87('0x26'),'id'])||{});}})[_0xbf87('0x28')](function(_0x386be2){logger[_0xbf87('0x12')](_0xbf87('0x29'),_0x281c53);logger[_0xbf87('0x14')]('AddTags',_0x281c53,JSON['stringify'](_0x386be2));_0x14bf72(_0x386be2);})[_0xbf87('0x1c')](function(_0x4b13ec){logger[_0xbf87('0x17')](_0xbf87('0x29'),_0x4b13ec[_0xbf87('0x1a')],_0x281c53);_0x587559(_this['error'](0x1f4,_0x4b13ec[_0xbf87('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index feeaebb..fbcf53b 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 _0xcef9=['update','emit','removeListener','register','whatsappInteraction:','./whatsappInteraction.events','save','remove'];(function(_0x3500f2,_0x142fb1){var _0x7ad03f=function(_0x2a1a07){while(--_0x2a1a07){_0x3500f2['push'](_0x3500f2['shift']());}};_0x7ad03f(++_0x142fb1);}(_0xcef9,0xc5));var _0x9cef=function(_0x19500a,_0x317e84){_0x19500a=_0x19500a-0x0;var _0x21f791=_0xcef9[_0x19500a];return _0x21f791;};'use strict';var WhatsappInteractionEvents=require(_0x9cef('0x0'));var events=[_0x9cef('0x1'),_0x9cef('0x2'),_0x9cef('0x3')];function createListener(_0x58c4a7,_0x35bffb){return function(_0x5f23ff){_0x35bffb[_0x9cef('0x4')](_0x58c4a7,_0x5f23ff);};}function removeListener(_0x35af20,_0x39c6d2){return function(){WhatsappInteractionEvents[_0x9cef('0x5')](_0x35af20,_0x39c6d2);};}exports[_0x9cef('0x6')]=function(_0x50e60f){for(var _0x1d613f=0x0,_0x337a66=events['length'];_0x1d613f<_0x337a66;_0x1d613f++){var _0x481bd0=events[_0x1d613f];var _0x2f6647=createListener(_0x9cef('0x7')+_0x481bd0,_0x50e60f);WhatsappInteractionEvents['on'](_0x481bd0,_0x2f6647);}}; \ No newline at end of file +var _0xc9d4=['register','length','whatsappInteraction:','./whatsappInteraction.events','save','update','emit','removeListener'];(function(_0x105fe4,_0x5ddbfc){var _0x33067a=function(_0x3e5dce){while(--_0x3e5dce){_0x105fe4['push'](_0x105fe4['shift']());}};_0x33067a(++_0x5ddbfc);}(_0xc9d4,0x73));var _0x4c9d=function(_0xd03201,_0x1644c9){_0xd03201=_0xd03201-0x0;var _0x383be4=_0xc9d4[_0xd03201];return _0x383be4;};'use strict';var WhatsappInteractionEvents=require(_0x4c9d('0x0'));var events=[_0x4c9d('0x1'),'remove',_0x4c9d('0x2')];function createListener(_0x5e1f23,_0x3bc7a9){return function(_0x33be64){_0x3bc7a9[_0x4c9d('0x3')](_0x5e1f23,_0x33be64);};}function removeListener(_0xadcb06,_0x170134){return function(){WhatsappInteractionEvents[_0x4c9d('0x4')](_0xadcb06,_0x170134);};}exports[_0x4c9d('0x5')]=function(_0x28ae15){for(var _0x1d9477=0x0,_0x303814=events[_0x4c9d('0x6')];_0x1d9477<_0x303814;_0x1d9477++){var _0x2993e8=events[_0x1d9477];var _0xd65c7=createListener(_0x4c9d('0x7')+_0x2993e8,_0x28ae15);WhatsappInteractionEvents['on'](_0x2993e8,_0xd65c7);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 9236ac2..9014231 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 _0x0184=['/:id/status','update','/:id/accept','accept','put','reject','delete','/:id','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappMessage.controller','get','isAuthenticated','index','describe','show','tracked','whatsapp','whatsappmessage:create','create','post'];(function(_0x3b526c,_0x324f7a){var _0x24472c=function(_0x275511){while(--_0x275511){_0x3b526c['push'](_0x3b526c['shift']());}};_0x24472c(++_0x324f7a);}(_0x0184,0x1ae));var _0x4018=function(_0x4434f7,_0x431595){_0x4434f7=_0x4434f7-0x0;var _0x364db2=_0x0184[_0x4434f7];return _0x364db2;};'use strict';var multer=require(_0x4018('0x0'));var util=require(_0x4018('0x1'));var path=require(_0x4018('0x2'));var timeout=require(_0x4018('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4018('0x4'));var auth=require(_0x4018('0x5'));var interaction=require(_0x4018('0x6'));var config=require('../../config/environment');var controller=require(_0x4018('0x7'));router[_0x4018('0x8')]('/',auth[_0x4018('0x9')](),controller[_0x4018('0xa')]);router['get']('/describe',auth[_0x4018('0x9')](),controller[_0x4018('0xb')]);router[_0x4018('0x8')]('/:id',auth[_0x4018('0x9')](),controller[_0x4018('0xc')]);router['post']('/',auth[_0x4018('0x9')](),interaction[_0x4018('0xd')](_0x4018('0xe'),_0x4018('0xf')),controller[_0x4018('0x10')]);router[_0x4018('0x11')](_0x4018('0x12'),controller['status']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x4018('0x13')]);router['put'](_0x4018('0x14'),auth[_0x4018('0x9')](),controller[_0x4018('0x15')]);router[_0x4018('0x16')]('/:id/reject',auth[_0x4018('0x9')](),controller[_0x4018('0x17')]);router[_0x4018('0x18')](_0x4018('0x19'),auth['isAuthenticated'](),controller[_0x4018('0x1a')]);module[_0x4018('0x1b')]=router; \ No newline at end of file +var _0x6ae0=['multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappMessage.controller','get','/describe','isAuthenticated','describe','/:id','show','tracked','whatsapp','whatsappmessage:create','create','status','put','update','/:id/accept','accept','delete','destroy','exports'];(function(_0x110dc0,_0x3a6615){var _0x39aeb1=function(_0x46fa33){while(--_0x46fa33){_0x110dc0['push'](_0x110dc0['shift']());}};_0x39aeb1(++_0x3a6615);}(_0x6ae0,0x1a0));var _0x06ae=function(_0x5d3b1f,_0x865b0d){_0x5d3b1f=_0x5d3b1f-0x0;var _0x3dc515=_0x6ae0[_0x5d3b1f];return _0x3dc515;};'use strict';var multer=require(_0x06ae('0x0'));var util=require(_0x06ae('0x1'));var path=require(_0x06ae('0x2'));var timeout=require(_0x06ae('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x06ae('0x4'));var auth=require(_0x06ae('0x5'));var interaction=require(_0x06ae('0x6'));var config=require('../../config/environment');var controller=require(_0x06ae('0x7'));router[_0x06ae('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x06ae('0x8')](_0x06ae('0x9'),auth[_0x06ae('0xa')](),controller[_0x06ae('0xb')]);router['get'](_0x06ae('0xc'),auth[_0x06ae('0xa')](),controller[_0x06ae('0xd')]);router['post']('/',auth[_0x06ae('0xa')](),interaction[_0x06ae('0xe')](_0x06ae('0xf'),_0x06ae('0x10')),controller[_0x06ae('0x11')]);router['post']('/:id/status',controller[_0x06ae('0x12')]);router[_0x06ae('0x13')](_0x06ae('0xc'),auth[_0x06ae('0xa')](),controller[_0x06ae('0x14')]);router[_0x06ae('0x13')](_0x06ae('0x15'),auth['isAuthenticated'](),controller[_0x06ae('0x16')]);router[_0x06ae('0x13')]('/:id/reject',auth['isAuthenticated'](),controller['reject']);router[_0x06ae('0x17')]('/:id',auth[_0x06ae('0xa')](),controller[_0x06ae('0x18')]);module[_0x06ae('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 b4f2ed7..6529df9 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 _0x975f=['DATE','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x490742,_0xa571bb){var _0x473ac6=function(_0x372737){while(--_0x372737){_0x490742['push'](_0x490742['shift']());}};_0x473ac6(++_0xa571bb);}(_0x975f,0x1e1));var _0xf975=function(_0x102ff9,_0x907658){_0x102ff9=_0x102ff9-0x0;var _0x24fa97=_0x975f[_0x102ff9];return _0x24fa97;};'use strict';var Sequelize=require('sequelize');module[_0xf975('0x0')]={'body':{'type':Sequelize[_0xf975('0x1')](_0xf975('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xf975('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf975('0x4')]('in',_0xf975('0x5')),'defaultValue':_0xf975('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xf975('0x6')]},'readAt':{'type':Sequelize[_0xf975('0x7')]},'secret':{'type':Sequelize[_0xf975('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xf975('0x6')]},'providerResponse':{'type':Sequelize[_0xf975('0x1')]}}; \ No newline at end of file +var _0x6877=['out','STRING','DATE','sequelize','exports','TEXT','BOOLEAN'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6877,0xa4));var _0x7687=function(_0x4a8bad,_0x4bfb2f){_0x4a8bad=_0x4a8bad-0x0;var _0x30cf32=_0x6877[_0x4a8bad];return _0x30cf32;};'use strict';var Sequelize=require(_0x7687('0x0'));module[_0x7687('0x1')]={'body':{'type':Sequelize[_0x7687('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x7687('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x7687('0x4')),'defaultValue':_0x7687('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x7687('0x5')](0xbe)},'phone':{'type':Sequelize[_0x7687('0x5')]},'readAt':{'type':Sequelize[_0x7687('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x7687('0x5')]},'providerResponse':{'type':Sequelize[_0x7687('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 64c1f64..3f42a6d 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 _0x4c19=['[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','contact','interface','SIP/%s','rejectmessage','WhatsappAccountId','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappMessage.socket','jayson/promise','client','http','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','rows','show','params','keys','length','includeAll','create','body','find','destroy','describe','whatsapp-interactions','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','WhatsappInteraction','WhatsappInteractionId','isNil','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','SELECT','User','agent','fullname','email','internal','manual','channel','motionChannel','event','accept','EventManager'];(function(_0x4b5f0c,_0x4aede3){var _0x579c42=function(_0x3565f0){while(--_0x3565f0){_0x4b5f0c['push'](_0x4b5f0c['shift']());}};_0x579c42(++_0x4aede3);}(_0x4c19,0x1af));var _0x94c1=function(_0x24b852,_0x2bad67){_0x24b852=_0x24b852-0x0;var _0x180ad2=_0x4c19[_0x24b852];return _0x180ad2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x94c1('0x0'));var jsonpatch=require(_0x94c1('0x1'));var rp=require(_0x94c1('0x2'));var moment=require(_0x94c1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x94c1('0x4'));var util=require(_0x94c1('0x5'));var path=require('path');var sox=require(_0x94c1('0x6'));var csv=require('to-csv');var ejs=require(_0x94c1('0x7'));var fs=require('fs');var fs_extra=require(_0x94c1('0x8'));var _=require(_0x94c1('0x9'));var squel=require('squel');var crypto=require(_0x94c1('0xa'));var jsforce=require(_0x94c1('0xb'));var deskjs=require(_0x94c1('0xc'));var toCsv=require(_0x94c1('0xd'));var querystring=require(_0x94c1('0xe'));var Papa=require('papaparse');var Redis=require(_0x94c1('0xf'));var authService=require(_0x94c1('0x10'));var qs=require(_0x94c1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x94c1('0x12'));var logger=require(_0x94c1('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x94c1('0x14'));var db=require(_0x94c1('0x15'))['db'];config[_0x94c1('0x16')]=_[_0x94c1('0x17')](config[_0x94c1('0x16')],{'host':_0x94c1('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x94c1('0x16')]));require(_0x94c1('0x19'))['register'](socket);var jayson=require(_0x94c1('0x1a'));var client=jayson[_0x94c1('0x1b')][_0x94c1('0x1c')]({'port':0x232c});var client9002=jayson[_0x94c1('0x1b')][_0x94c1('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xf7182b,_0x777f3e,_0x997d08,_0x23986d){return new BPromise(function(_0x32e601,_0x31de3d){var _0x3cb399=_0x23986d||client;return _0x3cb399[_0x94c1('0x1d')](_0xf7182b,_0x997d08)['then'](function(_0x285ff6){logger[_0x94c1('0x1e')](_0x94c1('0x1f'),_0x777f3e,_0x94c1('0x20'));logger['debug'](_0x94c1('0x21'),_0x777f3e,_0x94c1('0x20'),JSON[_0x94c1('0x22')](_0x285ff6));if(_0x285ff6[_0x94c1('0x23')]){if(_0x285ff6[_0x94c1('0x23')][_0x94c1('0x24')]===0x1f4){logger[_0x94c1('0x23')](_0x94c1('0x1f'),_0x777f3e,_0x285ff6['error'][_0x94c1('0x25')]);return _0x31de3d(_0x285ff6['error'][_0x94c1('0x25')]);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x777f3e,_0x285ff6[_0x94c1('0x23')]['message']);return _0x32e601(_0x285ff6[_0x94c1('0x23')][_0x94c1('0x25')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x777f3e,'request\x20sent');_0x32e601(_0x285ff6[_0x94c1('0x26')]['message']);}})[_0x94c1('0x27')](function(_0x501f90){logger[_0x94c1('0x23')]('WhatsappMessage,\x20%s,\x20%s',_0x777f3e,_0x501f90);_0x31de3d(_0x501f90);});});}function respondWithStatusCode(_0x35f875,_0x46ce91){_0x46ce91=_0x46ce91||0xcc;return function(_0x40d473){if(_0x40d473){return _0x35f875[_0x94c1('0x28')](_0x46ce91);}return _0x35f875[_0x94c1('0x29')](_0x46ce91)[_0x94c1('0x2a')]();};}function respondWithResult(_0x21fad6,_0x4474b0){_0x4474b0=_0x4474b0||0xc8;return function(_0x1882ca){if(_0x1882ca){return _0x21fad6[_0x94c1('0x29')](_0x4474b0)['json'](_0x1882ca);}};}function respondWithFilteredResult(_0x15d8ec,_0x42a8d7){return function(_0x5ca57f){if(_0x5ca57f){var _0x247a56=typeof _0x42a8d7[_0x94c1('0x2b')]===_0x94c1('0x2c')&&typeof _0x42a8d7[_0x94c1('0x2d')]==='undefined';var _0x4a6ed3=_0x5ca57f[_0x94c1('0x2e')];var _0x320e59=_0x247a56?0x0:_0x42a8d7[_0x94c1('0x2b')];var _0x31ef08=_0x247a56?_0x5ca57f[_0x94c1('0x2e')]:_0x42a8d7[_0x94c1('0x2b')]+_0x42a8d7['limit'];var _0x405799;if(_0x31ef08>=_0x4a6ed3){_0x31ef08=_0x4a6ed3;_0x405799=0xc8;}else{_0x405799=0xce;}_0x15d8ec[_0x94c1('0x29')](_0x405799);return _0x15d8ec['set'](_0x94c1('0x2f'),_0x320e59+'-'+_0x31ef08+'/'+_0x4a6ed3)['json'](_0x5ca57f);}return null;};}function patchUpdates(_0x55c74a){return function(_0x5430de){try{jsonpatch[_0x94c1('0x30')](_0x5430de,_0x55c74a,!![]);}catch(_0x58edd0){return BPromise[_0x94c1('0x31')](_0x58edd0);}return _0x5430de[_0x94c1('0x32')]();};}function saveUpdates(_0x5b6f04,_0x2ab1fd){return function(_0x228d59){if(_0x228d59){return _0x228d59[_0x94c1('0x33')](_0x5b6f04)[_0x94c1('0x34')](function(_0x5af1c6){return _0x5af1c6;});}return null;};}function removeEntity(_0x435c41,_0x8bc6f8){return function(_0x28c44b){if(_0x28c44b){return _0x28c44b['destroy']()[_0x94c1('0x34')](function(){_0x435c41['status'](0xcc)[_0x94c1('0x2a')]();});}};}function handleEntityNotFound(_0x1479c1,_0x110fc0){return function(_0x42406e){if(!_0x42406e){_0x1479c1[_0x94c1('0x28')](0x194);}return _0x42406e;};}function handleError(_0x387cc6,_0x243443){_0x243443=_0x243443||0x1f4;return function(_0x5086b5){logger['error'](_0x5086b5[_0x94c1('0x35')]);if(_0x5086b5[_0x94c1('0x36')]){delete _0x5086b5[_0x94c1('0x36')];}_0x387cc6[_0x94c1('0x29')](_0x243443)[_0x94c1('0x37')](_0x5086b5);};}exports[_0x94c1('0x38')]=function(_0x2bab95,_0x317c41){var _0x578fe0={},_0x3a7fb9={},_0x13a9ec={'count':0x0,'rows':[]};var _0x321fac=_[_0x94c1('0x39')](db[_0x94c1('0x3a')][_0x94c1('0x3b')],function(_0x305200){return{'name':_0x305200[_0x94c1('0x3c')],'type':_0x305200[_0x94c1('0x3d')]['key']};});_0x3a7fb9[_0x94c1('0x3e')]=_['map'](_0x321fac,_0x94c1('0x36'));_0x3a7fb9['query']=_['keys'](_0x2bab95[_0x94c1('0x3f')]);_0x3a7fb9[_0x94c1('0x40')]=_[_0x94c1('0x41')](_0x3a7fb9[_0x94c1('0x3e')],_0x3a7fb9[_0x94c1('0x3f')]);_0x578fe0[_0x94c1('0x42')]=_[_0x94c1('0x41')](_0x3a7fb9[_0x94c1('0x3e')],qs[_0x94c1('0x43')](_0x2bab95[_0x94c1('0x3f')][_0x94c1('0x43')]));_0x578fe0[_0x94c1('0x42')]=_0x578fe0[_0x94c1('0x42')]['length']?_0x578fe0['attributes']:_0x3a7fb9[_0x94c1('0x3e')];if(!_0x2bab95['query'][_0x94c1('0x44')](_0x94c1('0x45'))){_0x578fe0[_0x94c1('0x2d')]=qs['limit'](_0x2bab95[_0x94c1('0x3f')]['limit']);_0x578fe0[_0x94c1('0x2b')]=qs['offset'](_0x2bab95['query'][_0x94c1('0x2b')]);}_0x578fe0[_0x94c1('0x46')]=qs[_0x94c1('0x47')](_0x2bab95[_0x94c1('0x3f')]['sort']);_0x578fe0[_0x94c1('0x48')]=qs[_0x94c1('0x40')](_[_0x94c1('0x49')](_0x2bab95[_0x94c1('0x3f')],_0x3a7fb9['filters']),_0x321fac);if(_0x2bab95[_0x94c1('0x3f')][_0x94c1('0x4a')]){_0x578fe0[_0x94c1('0x48')]=_[_0x94c1('0x4b')](_0x578fe0[_0x94c1('0x48')],{'$or':_[_0x94c1('0x39')](_0x321fac,function(_0x4da376){if(_0x4da376[_0x94c1('0x3d')]!=='VIRTUAL'){var _0x2b9c07={};_0x2b9c07[_0x4da376['name']]={'$like':'%'+_0x2bab95[_0x94c1('0x3f')][_0x94c1('0x4a')]+'%'};return _0x2b9c07;}})});}_0x578fe0=_['merge']({},_0x578fe0,_0x2bab95[_0x94c1('0x4c')]);var _0x1907a6={'where':_0x578fe0[_0x94c1('0x48')]};return db['WhatsappMessage'][_0x94c1('0x2e')](_0x1907a6)[_0x94c1('0x34')](function(_0x81240a){_0x13a9ec['count']=_0x81240a;if(_0x2bab95[_0x94c1('0x3f')]['includeAll']){_0x578fe0[_0x94c1('0x4d')]=[{'all':!![]}];}return db[_0x94c1('0x3a')]['findAll'](_0x578fe0);})[_0x94c1('0x34')](function(_0x57cf6b){_0x13a9ec[_0x94c1('0x4e')]=_0x57cf6b;return _0x13a9ec;})[_0x94c1('0x34')](respondWithFilteredResult(_0x317c41,_0x578fe0))[_0x94c1('0x27')](handleError(_0x317c41,null));};exports[_0x94c1('0x4f')]=function(_0x49b716,_0x13778b){var _0x53b85c={'raw':!![],'where':{'id':_0x49b716[_0x94c1('0x50')]['id']}},_0x331b8f={};_0x331b8f['model']=_[_0x94c1('0x51')](db[_0x94c1('0x3a')]['rawAttributes']);_0x331b8f['query']=_['keys'](_0x49b716[_0x94c1('0x3f')]);_0x331b8f['filters']=_[_0x94c1('0x41')](_0x331b8f[_0x94c1('0x3e')],_0x331b8f['query']);_0x53b85c['attributes']=_[_0x94c1('0x41')](_0x331b8f['model'],qs['fields'](_0x49b716[_0x94c1('0x3f')][_0x94c1('0x43')]));_0x53b85c[_0x94c1('0x42')]=_0x53b85c[_0x94c1('0x42')][_0x94c1('0x52')]?_0x53b85c['attributes']:_0x331b8f[_0x94c1('0x3e')];if(_0x49b716['query'][_0x94c1('0x53')]){_0x53b85c[_0x94c1('0x4d')]=[{'all':!![]}];}_0x53b85c=_['merge']({},_0x53b85c,_0x49b716[_0x94c1('0x4c')]);return db[_0x94c1('0x3a')]['find'](_0x53b85c)['then'](handleEntityNotFound(_0x13778b,null))[_0x94c1('0x34')](respondWithResult(_0x13778b,null))[_0x94c1('0x27')](handleError(_0x13778b,null));};exports[_0x94c1('0x54')]=function(_0x10d4e5,_0x5ef06e){return db[_0x94c1('0x3a')][_0x94c1('0x54')](_0x10d4e5[_0x94c1('0x55')],{})[_0x94c1('0x34')](respondWithResult(_0x5ef06e,0xc9))[_0x94c1('0x27')](handleError(_0x5ef06e,null));};exports[_0x94c1('0x33')]=function(_0x5a53ee,_0x3d46c5){if(_0x5a53ee[_0x94c1('0x55')]['id']){delete _0x5a53ee[_0x94c1('0x55')]['id'];}return db[_0x94c1('0x3a')][_0x94c1('0x56')]({'where':{'id':_0x5a53ee['params']['id']}})['then'](handleEntityNotFound(_0x3d46c5,null))[_0x94c1('0x34')](saveUpdates(_0x5a53ee[_0x94c1('0x55')],null))[_0x94c1('0x34')](respondWithResult(_0x3d46c5,null))[_0x94c1('0x27')](handleError(_0x3d46c5,null));};exports[_0x94c1('0x57')]=function(_0x45650e,_0x108828){return db[_0x94c1('0x3a')]['find']({'where':{'id':_0x45650e['params']['id']}})[_0x94c1('0x34')](handleEntityNotFound(_0x108828,null))[_0x94c1('0x34')](removeEntity(_0x108828,null))[_0x94c1('0x27')](handleError(_0x108828,null));};exports[_0x94c1('0x58')]=function(_0x1d5659,_0x22ca51){return db['WhatsappMessage']['describe']()[_0x94c1('0x34')](respondWithResult(_0x22ca51,null))['catch'](handleError(_0x22ca51,null));};var interaction_log=require(_0x94c1('0x13'))(_0x94c1('0x59'));exports['accept']=function(_0x199eac,_0x5e1262,_0x305aea){var _0xce1ba7={'agent':{},'channel':'whatsapp'};if(_0x199eac[_0x94c1('0x55')]['id']){delete _0x199eac[_0x94c1('0x55')]['id'];}_0x199eac[_0x94c1('0x55')][_0x94c1('0x5a')]=!![];_0x199eac[_0x94c1('0x55')][_0x94c1('0x5b')]=moment()[_0x94c1('0x5c')](_0x94c1('0x5d'));_0x199eac[_0x94c1('0x55')][_0x94c1('0x5e')]=_0x199eac[_0x94c1('0x55')][_0x94c1('0x5e')]||_0x199eac[_0x94c1('0x5f')]['id'];_0xce1ba7['agent']['id']=_0x199eac[_0x94c1('0x55')][_0x94c1('0x5e')];return db[_0x94c1('0x3a')][_0x94c1('0x56')]({'where':{'id':_0x199eac['params']['id'],'UserId':null}})[_0x94c1('0x34')](handleEntityNotFound(_0x5e1262,null))[_0x94c1('0x34')](saveUpdates(_0x199eac[_0x94c1('0x55')],null))[_0x94c1('0x34')](function(_0xe5ba4c){if(_0xe5ba4c){_0xce1ba7[_0x94c1('0x25')]=_0xe5ba4c[_0x94c1('0x60')]({'plain':!![]});return db[_0x94c1('0x61')][_0x94c1('0x56')]({'where':{'id':_0xe5ba4c[_0x94c1('0x62')]}});}return null;})[_0x94c1('0x34')](handleEntityNotFound(_0x5e1262,null))['then'](function(_0x1d4269){if(_0x1d4269){return _0x1d4269[_0x94c1('0x33')]({'UserId':_0x199eac[_0x94c1('0x55')][_0x94c1('0x5e')],'read1stAt':_[_0x94c1('0x63')](_0x1d4269['read1stAt'])?moment()[_0x94c1('0x5c')](_0x94c1('0x5d')):undefined});}return null;})[_0x94c1('0x34')](function(_0x44b9d0){if(_0x44b9d0){_0xce1ba7[_0x94c1('0x64')]=_0x44b9d0[_0x94c1('0x60')]({'plain':!![]});interaction_log[_0x94c1('0x1e')](_0x94c1('0x65'),_0x199eac[_0x94c1('0x5f')]['id'],_0x199eac[_0x94c1('0x5f')]['name'],_0x199eac['user'][_0x94c1('0x66')],_0xce1ba7[_0x94c1('0x64')]['id'],_0x199eac[_0x94c1('0x55')]?JSON[_0x94c1('0x22')](_0x199eac['body']):_0x94c1('0x67'));return respondWithRpcPromise(_0x94c1('0x68'),_0x94c1('0x69'),_0xce1ba7);}return null;})['then'](function(_0x2f54d9){var _0x49bec3=_0x94c1('0x6a')+_0x2f54d9[_0x94c1('0x25')][_0x94c1('0x6b')];return db['sequelize'][_0x94c1('0x3f')](_0x49bec3,{'type':db['Sequelize'][_0x94c1('0x6c')][_0x94c1('0x6d')],'raw':!![]})['then'](function(_0x4754b2){return _0x4754b2;});})[_0x94c1('0x34')](function(_0x196a24){if(_0x196a24){_0xce1ba7[_0x94c1('0x25')]['contact']=_0x196a24[0x0];if(!_0x199eac[_0x94c1('0x55')][_0x94c1('0x5e')])return;return db[_0x94c1('0x6e')][_0x94c1('0x56')]({'where':{'id':_0x199eac['body'][_0x94c1('0x5e')],'role':_0x94c1('0x6f')},'attributes':['id',_0x94c1('0x36'),_0x94c1('0x70'),_0x94c1('0x71'),_0x94c1('0x72')],'raw':!![]});}return null;})['then'](function(_0x34a77e){if(!_0x34a77e)return null;_0xce1ba7['message']['agent']=_0x34a77e;return _0xce1ba7;})['then'](function(_0x120ce4){if(_0x120ce4){if(_0x199eac[_0x94c1('0x55')][_0x94c1('0x73')]){_0xce1ba7[_0x94c1('0x25')]['interface']=util['format']('SIP/%s',_0x199eac[_0x94c1('0x5f')]['name']);_0xce1ba7[_0x94c1('0x25')][_0x94c1('0x74')]=_0xce1ba7[_0x94c1('0x74')];_0xce1ba7[_0x94c1('0x25')][_0x94c1('0x75')]=_0xce1ba7[_0x94c1('0x74')];_0xce1ba7[_0x94c1('0x25')][_0x94c1('0x76')]=_0x94c1('0x77');return respondWithRpcPromise(_0x94c1('0x78'),_0x94c1('0x78'),{'event':'acceptmessage','message':_0xce1ba7[_0x94c1('0x25')]},client9002)[_0x94c1('0x34')](function(){return _0xce1ba7;});}return _0xce1ba7;}return null;})['then'](respondWithResult(_0x5e1262,null))[_0x94c1('0x27')](handleError(_0x5e1262,null));};var interaction_log=require(_0x94c1('0x13'))(_0x94c1('0x59'));exports[_0x94c1('0x31')]=function(_0x252ec7,_0xc618d2,_0x521b50){var _0x2332ee={'agent':{},'channel':'whatsapp'};if(_0x252ec7[_0x94c1('0x55')]['id']){delete _0x252ec7['body']['id'];}_0x252ec7[_0x94c1('0x55')][_0x94c1('0x5e')]=_0x252ec7['body'][_0x94c1('0x5e')]||_0x252ec7[_0x94c1('0x5f')]['id'];_0x2332ee['agent']['id']=_0x252ec7[_0x94c1('0x55')]['UserId'];return db[_0x94c1('0x3a')][_0x94c1('0x56')]({'where':{'id':_0x252ec7[_0x94c1('0x50')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xc618d2,null))[_0x94c1('0x34')](function(_0x16d1ee){if(_0x16d1ee){_0x2332ee[_0x94c1('0x25')]=_0x16d1ee[_0x94c1('0x60')]({'plain':!![]});return db[_0x94c1('0x61')]['find']({'where':{'id':_0x16d1ee[_0x94c1('0x62')]}});}return null;})[_0x94c1('0x34')](handleEntityNotFound(_0xc618d2,null))['then'](function(_0x94cff){if(_0x94cff){_0x2332ee[_0x94c1('0x64')]=_0x94cff['get']({'plain':!![]});interaction_log[_0x94c1('0x1e')](_0x94c1('0x79'),_0x252ec7[_0x94c1('0x5f')]['id'],_0x252ec7[_0x94c1('0x5f')][_0x94c1('0x36')],_0x252ec7['user'][_0x94c1('0x66')],_0x2332ee[_0x94c1('0x64')]['id'],_0x252ec7[_0x94c1('0x55')]?JSON[_0x94c1('0x22')](_0x252ec7[_0x94c1('0x55')]):_0x94c1('0x67'));return respondWithRpcPromise(_0x94c1('0x7a'),_0x94c1('0x7b'),_0x2332ee);}return null;})[_0x94c1('0x34')](function(_0x4e9047){var _0x18c46c='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4e9047[_0x94c1('0x25')][_0x94c1('0x6b')];return db['sequelize'][_0x94c1('0x3f')](_0x18c46c,{'type':db['Sequelize'][_0x94c1('0x6c')]['SELECT'],'raw':!![]})[_0x94c1('0x34')](function(_0x3632a4){return _0x3632a4;});})['then'](function(_0x45db96){if(_0x45db96){_0x2332ee[_0x94c1('0x25')][_0x94c1('0x7c')]=_0x45db96[0x0];if(!_0x252ec7[_0x94c1('0x55')][_0x94c1('0x5e')])return;return db[_0x94c1('0x6e')][_0x94c1('0x56')]({'where':{'id':_0x252ec7[_0x94c1('0x55')][_0x94c1('0x5e')],'role':_0x94c1('0x6f')},'attributes':['id',_0x94c1('0x36'),_0x94c1('0x70'),'email','internal'],'raw':!![]});}return null;})['then'](function(_0x39824e){if(!_0x39824e)return null;_0x2332ee['message'][_0x94c1('0x6f')]=_0x39824e;return _0x2332ee;})[_0x94c1('0x34')](function(_0x52d276){if(_0x52d276){_0x52d276[_0x94c1('0x25')][_0x94c1('0x7d')]=util[_0x94c1('0x5c')](_0x94c1('0x7e'),_0x252ec7[_0x94c1('0x5f')][_0x94c1('0x36')]);_0x52d276[_0x94c1('0x25')][_0x94c1('0x74')]=_0x2332ee[_0x94c1('0x74')];_0x52d276[_0x94c1('0x25')]['motionChannel']=_0x2332ee[_0x94c1('0x74')];_0x52d276[_0x94c1('0x25')][_0x94c1('0x76')]=_0x94c1('0x31');respondWithRpcPromise('EventManager',_0x94c1('0x78'),{'event':_0x94c1('0x7f'),'message':_0x52d276[_0x94c1('0x25')]},client9002);return _0x2332ee;}return null;})[_0x94c1('0x34')](respondWithResult(_0xc618d2,null))[_0x94c1('0x27')](handleError(_0xc618d2,null));};exports['status']=function(_0x2cce06,_0xb7e45b,_0x434e94){if(_0x2cce06[_0x94c1('0x55')]['id']){delete _0x2cce06['body']['id'];}var _0x42bb92;return db[_0x94c1('0x3a')][_0x94c1('0x56')]({'where':{'id':_0x2cce06[_0x94c1('0x50')]['id']}})[_0x94c1('0x34')](handleEntityNotFound(_0xb7e45b,null))[_0x94c1('0x34')](function(_0x985c52){if(_0x985c52){_0x42bb92=_0x985c52;return db['WhatsappAccount'][_0x94c1('0x56')]({'where':{'id':_0x985c52[_0x94c1('0x80')]}});}})[_0x94c1('0x34')](handleEntityNotFound(_0xb7e45b,null))[_0x94c1('0x34')](function(_0x175099){if(_0x175099){logger[_0x94c1('0x81')](_0x94c1('0x82'),_0x94c1('0x29'),_0x94c1('0x83'),_0x175099[_0x94c1('0x3d')],util[_0x94c1('0x84')](_0x2cce06[_0x94c1('0x55')],{'showHidden':![],'depth':null}));switch(_0x175099[_0x94c1('0x3d')]){case'twilio':if(_0x2cce06[_0x94c1('0x55')]['MessageSid']&&_0x2cce06[_0x94c1('0x55')][_0x94c1('0x85')]===_0x42bb92[_0x94c1('0x86')]&&_0x2cce06[_0x94c1('0x55')][_0x94c1('0x87')]&&_0x2cce06[_0x94c1('0x55')][_0x94c1('0x87')]===_0x94c1('0x5a')){return _0x42bb92[_0x94c1('0x33')]({'read':!![]});}else{logger[_0x94c1('0x23')](_0x94c1('0x88'),_0x94c1('0x29'),_0x94c1('0x89'),util[_0x94c1('0x84')](_0x2cce06[_0x94c1('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x42bb92;}})[_0x94c1('0x34')](respondWithResult(_0xb7e45b,null))[_0x94c1('0x27')](handleError(_0xb7e45b,null));}; \ No newline at end of file +var _0x5e26=['acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','interface','SIP/%s','channel','event','EventManager','RejectMessage','rejectMessage','Sequelize','motionChannel','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','jayson/promise','client','http','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','destroy','stack','name','send','index','map','WhatsappMessage','rawAttributes','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','then','include','rows','catch','show','params','find','create','body','describe','whatsapp-interactions','accept','whatsapp','read','format','UserId','user','agent','get','WhatsappInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null'];(function(_0x18e702,_0x4de8f8){var _0x55e556=function(_0x3c87e7){while(--_0x3c87e7){_0x18e702['push'](_0x18e702['shift']());}};_0x55e556(++_0x4de8f8);}(_0x5e26,0x127));var _0x65e2=function(_0x1ee0a1,_0x51058e){_0x1ee0a1=_0x1ee0a1-0x0;var _0x1d2d5b=_0x5e26[_0x1ee0a1];return _0x1d2d5b;};'use strict';var emlformat=require(_0x65e2('0x0'));var rimraf=require(_0x65e2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65e2('0x2'));var rp=require(_0x65e2('0x3'));var moment=require(_0x65e2('0x4'));var BPromise=require(_0x65e2('0x5'));var Mustache=require(_0x65e2('0x6'));var util=require(_0x65e2('0x7'));var path=require(_0x65e2('0x8'));var sox=require('sox');var csv=require(_0x65e2('0x9'));var ejs=require(_0x65e2('0xa'));var fs=require('fs');var fs_extra=require(_0x65e2('0xb'));var _=require(_0x65e2('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x65e2('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x65e2('0x9'));var querystring=require(_0x65e2('0xe'));var Papa=require(_0x65e2('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x65e2('0x10'));var as=require(_0x65e2('0x11'));var hardwareService=require(_0x65e2('0x12'));var logger=require(_0x65e2('0x13'))('api');var utils=require(_0x65e2('0x14'));var config=require(_0x65e2('0x15'));var licenseUtil=require(_0x65e2('0x16'));var db=require('../../mysqldb')['db'];config[_0x65e2('0x17')]=_['defaults'](config['redis'],{'host':_0x65e2('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x65e2('0x17')]));require('./whatsappMessage.socket')['register'](socket);var jayson=require(_0x65e2('0x19'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x65e2('0x1a')][_0x65e2('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x2ef3dc,_0x5c7d1d,_0x276a04,_0x1d8c4d){return new BPromise(function(_0x49b904,_0x152197){var _0x32638c=_0x1d8c4d||client;return _0x32638c[_0x65e2('0x1c')](_0x2ef3dc,_0x276a04)['then'](function(_0x1aa1f9){logger[_0x65e2('0x1d')](_0x65e2('0x1e'),_0x5c7d1d,_0x65e2('0x1f'));logger[_0x65e2('0x20')](_0x65e2('0x21'),_0x5c7d1d,_0x65e2('0x1f'),JSON[_0x65e2('0x22')](_0x1aa1f9));if(_0x1aa1f9['error']){if(_0x1aa1f9['error'][_0x65e2('0x23')]===0x1f4){logger[_0x65e2('0x24')](_0x65e2('0x1e'),_0x5c7d1d,_0x1aa1f9[_0x65e2('0x24')][_0x65e2('0x25')]);return _0x152197(_0x1aa1f9[_0x65e2('0x24')][_0x65e2('0x25')]);}logger[_0x65e2('0x24')](_0x65e2('0x1e'),_0x5c7d1d,_0x1aa1f9[_0x65e2('0x24')][_0x65e2('0x25')]);return _0x49b904(_0x1aa1f9[_0x65e2('0x24')]['message']);}else{logger[_0x65e2('0x1d')](_0x65e2('0x1e'),_0x5c7d1d,_0x65e2('0x1f'));_0x49b904(_0x1aa1f9[_0x65e2('0x26')][_0x65e2('0x25')]);}})['catch'](function(_0x22cc59){logger[_0x65e2('0x24')](_0x65e2('0x1e'),_0x5c7d1d,_0x22cc59);_0x152197(_0x22cc59);});});}function respondWithStatusCode(_0x14fa57,_0x433ee0){_0x433ee0=_0x433ee0||0xcc;return function(_0x2e6f9f){if(_0x2e6f9f){return _0x14fa57[_0x65e2('0x27')](_0x433ee0);}return _0x14fa57[_0x65e2('0x28')](_0x433ee0)[_0x65e2('0x29')]();};}function respondWithResult(_0xf0ea88,_0x6cb5f0){_0x6cb5f0=_0x6cb5f0||0xc8;return function(_0x49caec){if(_0x49caec){return _0xf0ea88[_0x65e2('0x28')](_0x6cb5f0)['json'](_0x49caec);}};}function respondWithFilteredResult(_0x29130a,_0x23b25f){return function(_0x36b665){if(_0x36b665){var _0x3bacdb=typeof _0x23b25f[_0x65e2('0x2a')]==='undefined'&&typeof _0x23b25f[_0x65e2('0x2b')]===_0x65e2('0x2c');var _0x41b30a=_0x36b665[_0x65e2('0x2d')];var _0x162cdb=_0x3bacdb?0x0:_0x23b25f[_0x65e2('0x2a')];var _0x22a35f=_0x3bacdb?_0x36b665[_0x65e2('0x2d')]:_0x23b25f[_0x65e2('0x2a')]+_0x23b25f[_0x65e2('0x2b')];var _0xaf7a6d;if(_0x22a35f>=_0x41b30a){_0x22a35f=_0x41b30a;_0xaf7a6d=0xc8;}else{_0xaf7a6d=0xce;}_0x29130a['status'](_0xaf7a6d);return _0x29130a[_0x65e2('0x2e')](_0x65e2('0x2f'),_0x162cdb+'-'+_0x22a35f+'/'+_0x41b30a)[_0x65e2('0x30')](_0x36b665);}return null;};}function patchUpdates(_0x31c5fa){return function(_0xc4a0f8){try{jsonpatch[_0x65e2('0x31')](_0xc4a0f8,_0x31c5fa,!![]);}catch(_0xde59cd){return BPromise[_0x65e2('0x32')](_0xde59cd);}return _0xc4a0f8['save']();};}function saveUpdates(_0x5a8330,_0x272acf){return function(_0x1b6547){if(_0x1b6547){return _0x1b6547[_0x65e2('0x33')](_0x5a8330)['then'](function(_0x1633b9){return _0x1633b9;});}return null;};}function removeEntity(_0x122dda,_0x2e9708){return function(_0x1229ba){if(_0x1229ba){return _0x1229ba[_0x65e2('0x34')]()['then'](function(){_0x122dda[_0x65e2('0x28')](0xcc)[_0x65e2('0x29')]();});}};}function handleEntityNotFound(_0x4fa84,_0x1f2518){return function(_0x19ba68){if(!_0x19ba68){_0x4fa84['sendStatus'](0x194);}return _0x19ba68;};}function handleError(_0x223bd7,_0x3d78f3){_0x3d78f3=_0x3d78f3||0x1f4;return function(_0x268499){logger['error'](_0x268499[_0x65e2('0x35')]);if(_0x268499['name']){delete _0x268499[_0x65e2('0x36')];}_0x223bd7[_0x65e2('0x28')](_0x3d78f3)[_0x65e2('0x37')](_0x268499);};}exports[_0x65e2('0x38')]=function(_0xe065de,_0xb1f6bc){var _0x368dc3={},_0x3d349c={},_0x1fdeff={'count':0x0,'rows':[]};var _0x2cf513=_[_0x65e2('0x39')](db[_0x65e2('0x3a')][_0x65e2('0x3b')],function(_0x5224d8){return{'name':_0x5224d8['fieldName'],'type':_0x5224d8['type'][_0x65e2('0x3c')]};});_0x3d349c['model']=_['map'](_0x2cf513,_0x65e2('0x36'));_0x3d349c[_0x65e2('0x3d')]=_[_0x65e2('0x3e')](_0xe065de[_0x65e2('0x3d')]);_0x3d349c['filters']=_[_0x65e2('0x3f')](_0x3d349c['model'],_0x3d349c[_0x65e2('0x3d')]);_0x368dc3['attributes']=_[_0x65e2('0x3f')](_0x3d349c[_0x65e2('0x40')],qs[_0x65e2('0x41')](_0xe065de['query'][_0x65e2('0x41')]));_0x368dc3[_0x65e2('0x42')]=_0x368dc3['attributes'][_0x65e2('0x43')]?_0x368dc3['attributes']:_0x3d349c[_0x65e2('0x40')];if(!_0xe065de[_0x65e2('0x3d')][_0x65e2('0x44')](_0x65e2('0x45'))){_0x368dc3[_0x65e2('0x2b')]=qs[_0x65e2('0x2b')](_0xe065de[_0x65e2('0x3d')]['limit']);_0x368dc3[_0x65e2('0x2a')]=qs['offset'](_0xe065de[_0x65e2('0x3d')][_0x65e2('0x2a')]);}_0x368dc3[_0x65e2('0x46')]=qs[_0x65e2('0x47')](_0xe065de[_0x65e2('0x3d')]['sort']);_0x368dc3[_0x65e2('0x48')]=qs[_0x65e2('0x49')](_['pick'](_0xe065de[_0x65e2('0x3d')],_0x3d349c[_0x65e2('0x49')]),_0x2cf513);if(_0xe065de['query'][_0x65e2('0x4a')]){_0x368dc3[_0x65e2('0x48')]=_[_0x65e2('0x4b')](_0x368dc3['where'],{'$or':_[_0x65e2('0x39')](_0x2cf513,function(_0x2176ba){if(_0x2176ba[_0x65e2('0x4c')]!=='VIRTUAL'){var _0x3c1954={};_0x3c1954[_0x2176ba['name']]={'$like':'%'+_0xe065de[_0x65e2('0x3d')][_0x65e2('0x4a')]+'%'};return _0x3c1954;}})});}_0x368dc3=_['merge']({},_0x368dc3,_0xe065de['options']);var _0x386935={'where':_0x368dc3['where']};return db[_0x65e2('0x3a')][_0x65e2('0x2d')](_0x386935)[_0x65e2('0x4d')](function(_0x59d0a7){_0x1fdeff[_0x65e2('0x2d')]=_0x59d0a7;if(_0xe065de[_0x65e2('0x3d')]['includeAll']){_0x368dc3[_0x65e2('0x4e')]=[{'all':!![]}];}return db[_0x65e2('0x3a')]['findAll'](_0x368dc3);})[_0x65e2('0x4d')](function(_0x40507d){_0x1fdeff[_0x65e2('0x4f')]=_0x40507d;return _0x1fdeff;})['then'](respondWithFilteredResult(_0xb1f6bc,_0x368dc3))[_0x65e2('0x50')](handleError(_0xb1f6bc,null));};exports[_0x65e2('0x51')]=function(_0x1fbd7d,_0x3f94df){var _0x413618={'raw':!![],'where':{'id':_0x1fbd7d[_0x65e2('0x52')]['id']}},_0x56cb0e={};_0x56cb0e[_0x65e2('0x40')]=_[_0x65e2('0x3e')](db['WhatsappMessage'][_0x65e2('0x3b')]);_0x56cb0e[_0x65e2('0x3d')]=_[_0x65e2('0x3e')](_0x1fbd7d[_0x65e2('0x3d')]);_0x56cb0e[_0x65e2('0x49')]=_[_0x65e2('0x3f')](_0x56cb0e['model'],_0x56cb0e[_0x65e2('0x3d')]);_0x413618[_0x65e2('0x42')]=_[_0x65e2('0x3f')](_0x56cb0e[_0x65e2('0x40')],qs[_0x65e2('0x41')](_0x1fbd7d[_0x65e2('0x3d')]['fields']));_0x413618['attributes']=_0x413618['attributes']['length']?_0x413618[_0x65e2('0x42')]:_0x56cb0e['model'];if(_0x1fbd7d[_0x65e2('0x3d')]['includeAll']){_0x413618['include']=[{'all':!![]}];}_0x413618=_[_0x65e2('0x4b')]({},_0x413618,_0x1fbd7d['options']);return db[_0x65e2('0x3a')][_0x65e2('0x53')](_0x413618)[_0x65e2('0x4d')](handleEntityNotFound(_0x3f94df,null))[_0x65e2('0x4d')](respondWithResult(_0x3f94df,null))['catch'](handleError(_0x3f94df,null));};exports[_0x65e2('0x54')]=function(_0x174e40,_0x5ea5ab){return db[_0x65e2('0x3a')][_0x65e2('0x54')](_0x174e40['body'],{})[_0x65e2('0x4d')](respondWithResult(_0x5ea5ab,0xc9))[_0x65e2('0x50')](handleError(_0x5ea5ab,null));};exports[_0x65e2('0x33')]=function(_0x3b685d,_0x2c8103){if(_0x3b685d[_0x65e2('0x55')]['id']){delete _0x3b685d['body']['id'];}return db[_0x65e2('0x3a')]['find']({'where':{'id':_0x3b685d[_0x65e2('0x52')]['id']}})[_0x65e2('0x4d')](handleEntityNotFound(_0x2c8103,null))[_0x65e2('0x4d')](saveUpdates(_0x3b685d[_0x65e2('0x55')],null))[_0x65e2('0x4d')](respondWithResult(_0x2c8103,null))[_0x65e2('0x50')](handleError(_0x2c8103,null));};exports[_0x65e2('0x34')]=function(_0x13cc6b,_0x14a7ec){return db['WhatsappMessage'][_0x65e2('0x53')]({'where':{'id':_0x13cc6b[_0x65e2('0x52')]['id']}})[_0x65e2('0x4d')](handleEntityNotFound(_0x14a7ec,null))[_0x65e2('0x4d')](removeEntity(_0x14a7ec,null))[_0x65e2('0x50')](handleError(_0x14a7ec,null));};exports[_0x65e2('0x56')]=function(_0x3e59ff,_0x2be2cc){return db[_0x65e2('0x3a')]['describe']()[_0x65e2('0x4d')](respondWithResult(_0x2be2cc,null))[_0x65e2('0x50')](handleError(_0x2be2cc,null));};var interaction_log=require(_0x65e2('0x13'))(_0x65e2('0x57'));exports[_0x65e2('0x58')]=function(_0x50ea89,_0x547be1,_0x1ad9b4){var _0x4a3b27={'agent':{},'channel':_0x65e2('0x59')};if(_0x50ea89[_0x65e2('0x55')]['id']){delete _0x50ea89[_0x65e2('0x55')]['id'];}_0x50ea89[_0x65e2('0x55')][_0x65e2('0x5a')]=!![];_0x50ea89[_0x65e2('0x55')]['readAt']=moment()[_0x65e2('0x5b')]('YYYY-MM-DD\x20HH:mm:ss');_0x50ea89[_0x65e2('0x55')][_0x65e2('0x5c')]=_0x50ea89['body']['UserId']||_0x50ea89[_0x65e2('0x5d')]['id'];_0x4a3b27[_0x65e2('0x5e')]['id']=_0x50ea89[_0x65e2('0x55')][_0x65e2('0x5c')];return db[_0x65e2('0x3a')][_0x65e2('0x53')]({'where':{'id':_0x50ea89[_0x65e2('0x52')]['id'],'UserId':null}})[_0x65e2('0x4d')](handleEntityNotFound(_0x547be1,null))[_0x65e2('0x4d')](saveUpdates(_0x50ea89[_0x65e2('0x55')],null))['then'](function(_0x431fde){if(_0x431fde){_0x4a3b27[_0x65e2('0x25')]=_0x431fde[_0x65e2('0x5f')]({'plain':!![]});return db['WhatsappInteraction'][_0x65e2('0x53')]({'where':{'id':_0x431fde[_0x65e2('0x60')]}});}return null;})[_0x65e2('0x4d')](handleEntityNotFound(_0x547be1,null))[_0x65e2('0x4d')](function(_0x3789cf){if(_0x3789cf){return _0x3789cf[_0x65e2('0x33')]({'UserId':_0x50ea89[_0x65e2('0x55')][_0x65e2('0x5c')],'read1stAt':_[_0x65e2('0x61')](_0x3789cf[_0x65e2('0x62')])?moment()[_0x65e2('0x5b')](_0x65e2('0x63')):undefined});}return null;})[_0x65e2('0x4d')](function(_0x18ea54){if(_0x18ea54){_0x4a3b27[_0x65e2('0x64')]=_0x18ea54['get']({'plain':!![]});interaction_log['info'](_0x65e2('0x65'),_0x50ea89['user']['id'],_0x50ea89[_0x65e2('0x5d')][_0x65e2('0x36')],_0x50ea89['user'][_0x65e2('0x66')],_0x4a3b27[_0x65e2('0x64')]['id'],_0x50ea89[_0x65e2('0x55')]?JSON[_0x65e2('0x22')](_0x50ea89[_0x65e2('0x55')]):_0x65e2('0x67'));return respondWithRpcPromise('AcceptMessage',_0x65e2('0x68'),_0x4a3b27);}return null;})[_0x65e2('0x4d')](function(_0x318742){var _0x9dd160=_0x65e2('0x69')+_0x318742['message'][_0x65e2('0x6a')];return db[_0x65e2('0x6b')][_0x65e2('0x3d')](_0x9dd160,{'type':db['Sequelize'][_0x65e2('0x6c')][_0x65e2('0x6d')],'raw':!![]})[_0x65e2('0x4d')](function(_0x1d31c9){return _0x1d31c9;});})['then'](function(_0x50f557){if(_0x50f557){_0x4a3b27[_0x65e2('0x25')]['contact']=_0x50f557[0x0];if(!_0x50ea89[_0x65e2('0x55')][_0x65e2('0x5c')])return;return db[_0x65e2('0x6e')]['find']({'where':{'id':_0x50ea89[_0x65e2('0x55')][_0x65e2('0x5c')],'role':_0x65e2('0x5e')},'attributes':['id',_0x65e2('0x36'),_0x65e2('0x6f'),_0x65e2('0x70'),_0x65e2('0x71')],'raw':!![]});}return null;})[_0x65e2('0x4d')](function(_0x5205fc){if(!_0x5205fc)return null;_0x4a3b27[_0x65e2('0x25')][_0x65e2('0x5e')]=_0x5205fc;return _0x4a3b27;})[_0x65e2('0x4d')](function(_0x16c87f){if(_0x16c87f){if(_0x50ea89[_0x65e2('0x55')][_0x65e2('0x72')]){_0x4a3b27[_0x65e2('0x25')][_0x65e2('0x73')]=util[_0x65e2('0x5b')](_0x65e2('0x74'),_0x50ea89[_0x65e2('0x5d')][_0x65e2('0x36')]);_0x4a3b27['message'][_0x65e2('0x75')]=_0x4a3b27['channel'];_0x4a3b27[_0x65e2('0x25')]['motionChannel']=_0x4a3b27[_0x65e2('0x75')];_0x4a3b27[_0x65e2('0x25')][_0x65e2('0x76')]=_0x65e2('0x58');return respondWithRpcPromise('EventManager',_0x65e2('0x77'),{'event':'acceptmessage','message':_0x4a3b27['message']},client9002)[_0x65e2('0x4d')](function(){return _0x4a3b27;});}return _0x4a3b27;}return null;})[_0x65e2('0x4d')](respondWithResult(_0x547be1,null))['catch'](handleError(_0x547be1,null));};var interaction_log=require(_0x65e2('0x13'))(_0x65e2('0x57'));exports[_0x65e2('0x32')]=function(_0x34eddd,_0x1498a9,_0x2fb65e){var _0x326f23={'agent':{},'channel':_0x65e2('0x59')};if(_0x34eddd[_0x65e2('0x55')]['id']){delete _0x34eddd['body']['id'];}_0x34eddd[_0x65e2('0x55')][_0x65e2('0x5c')]=_0x34eddd[_0x65e2('0x55')]['UserId']||_0x34eddd['user']['id'];_0x326f23[_0x65e2('0x5e')]['id']=_0x34eddd[_0x65e2('0x55')][_0x65e2('0x5c')];return db[_0x65e2('0x3a')]['find']({'where':{'id':_0x34eddd[_0x65e2('0x52')]['id'],'UserId':null}})[_0x65e2('0x4d')](handleEntityNotFound(_0x1498a9,null))[_0x65e2('0x4d')](function(_0x30a4e9){if(_0x30a4e9){_0x326f23[_0x65e2('0x25')]=_0x30a4e9[_0x65e2('0x5f')]({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x30a4e9[_0x65e2('0x60')]}});}return null;})[_0x65e2('0x4d')](handleEntityNotFound(_0x1498a9,null))['then'](function(_0x4f7bf9){if(_0x4f7bf9){_0x326f23[_0x65e2('0x64')]=_0x4f7bf9['get']({'plain':!![]});interaction_log[_0x65e2('0x1d')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x34eddd[_0x65e2('0x5d')]['id'],_0x34eddd['user']['name'],_0x34eddd[_0x65e2('0x5d')][_0x65e2('0x66')],_0x326f23[_0x65e2('0x64')]['id'],_0x34eddd[_0x65e2('0x55')]?JSON[_0x65e2('0x22')](_0x34eddd['body']):_0x65e2('0x67'));return respondWithRpcPromise(_0x65e2('0x78'),_0x65e2('0x79'),_0x326f23);}return null;})[_0x65e2('0x4d')](function(_0x189e1d){var _0x27e8d5='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x189e1d['message'][_0x65e2('0x6a')];return db[_0x65e2('0x6b')][_0x65e2('0x3d')](_0x27e8d5,{'type':db[_0x65e2('0x7a')][_0x65e2('0x6c')][_0x65e2('0x6d')],'raw':!![]})[_0x65e2('0x4d')](function(_0x52483b){return _0x52483b;});})['then'](function(_0x5b56be){if(_0x5b56be){_0x326f23[_0x65e2('0x25')]['contact']=_0x5b56be[0x0];if(!_0x34eddd['body'][_0x65e2('0x5c')])return;return db[_0x65e2('0x6e')][_0x65e2('0x53')]({'where':{'id':_0x34eddd[_0x65e2('0x55')]['UserId'],'role':'agent'},'attributes':['id',_0x65e2('0x36'),_0x65e2('0x6f'),'email',_0x65e2('0x71')],'raw':!![]});}return null;})[_0x65e2('0x4d')](function(_0xf6631){if(!_0xf6631)return null;_0x326f23[_0x65e2('0x25')]['agent']=_0xf6631;return _0x326f23;})[_0x65e2('0x4d')](function(_0x493fc7){if(_0x493fc7){_0x493fc7['message'][_0x65e2('0x73')]=util[_0x65e2('0x5b')](_0x65e2('0x74'),_0x34eddd[_0x65e2('0x5d')][_0x65e2('0x36')]);_0x493fc7[_0x65e2('0x25')][_0x65e2('0x75')]=_0x326f23[_0x65e2('0x75')];_0x493fc7[_0x65e2('0x25')][_0x65e2('0x7b')]=_0x326f23['channel'];_0x493fc7['message'][_0x65e2('0x76')]=_0x65e2('0x32');respondWithRpcPromise(_0x65e2('0x77'),_0x65e2('0x77'),{'event':'rejectmessage','message':_0x493fc7[_0x65e2('0x25')]},client9002);return _0x326f23;}return null;})['then'](respondWithResult(_0x1498a9,null))['catch'](handleError(_0x1498a9,null));};exports[_0x65e2('0x28')]=function(_0x594883,_0x3542c7,_0x818aaf){if(_0x594883[_0x65e2('0x55')]['id']){delete _0x594883['body']['id'];}var _0x2a0cba;return db[_0x65e2('0x3a')]['find']({'where':{'id':_0x594883[_0x65e2('0x52')]['id']}})[_0x65e2('0x4d')](handleEntityNotFound(_0x3542c7,null))[_0x65e2('0x4d')](function(_0xc6acc3){if(_0xc6acc3){_0x2a0cba=_0xc6acc3;return db[_0x65e2('0x7c')][_0x65e2('0x53')]({'where':{'id':_0xc6acc3[_0x65e2('0x7d')]}});}})['then'](handleEntityNotFound(_0x3542c7,null))['then'](function(_0x4c42ad){if(_0x4c42ad){logger[_0x65e2('0x20')](_0x65e2('0x7e'),'status',_0x65e2('0x7f'),_0x4c42ad[_0x65e2('0x4c')],util[_0x65e2('0x80')](_0x594883[_0x65e2('0x55')],{'showHidden':![],'depth':null}));switch(_0x4c42ad[_0x65e2('0x4c')]){case'twilio':if(_0x594883[_0x65e2('0x55')]['MessageSid']&&_0x594883[_0x65e2('0x55')]['MessageSid']===_0x2a0cba[_0x65e2('0x81')]&&_0x594883[_0x65e2('0x55')][_0x65e2('0x82')]&&_0x594883['body']['MessageStatus']===_0x65e2('0x5a')){return _0x2a0cba[_0x65e2('0x33')]({'read':!![]});}else{logger[_0x65e2('0x24')](_0x65e2('0x83'),'status',_0x65e2('0x84'),util[_0x65e2('0x80')](_0x594883[_0x65e2('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x2a0cba;}})[_0x65e2('0x4d')](respondWithResult(_0x3542c7,null))[_0x65e2('0x50')](handleError(_0x3542c7,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 8f88615..d7ddc02 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 _0x04b8=['exports','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x4e6fc7,_0x6b9a5d){var _0x3c2ef6=function(_0x3907ed){while(--_0x3907ed){_0x4e6fc7['push'](_0x4e6fc7['shift']());}};_0x3c2ef6(++_0x6b9a5d);}(_0x04b8,0x159));var _0x804b=function(_0x5109c1,_0x37195b){_0x5109c1=_0x5109c1-0x0;var _0x47c577=_0x04b8[_0x5109c1];return _0x47c577;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x804b('0x0'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x804b('0x1')](0x0);var events={'afterCreate':_0x804b('0x2'),'afterUpdate':'update','afterDestroy':_0x804b('0x3')};function emitEvent(_0x1cd188){return function(_0x5857dc,_0x3530f6,_0x1c3474){WhatsappMessageEvents[_0x804b('0x4')](_0x1cd188+':'+_0x5857dc['id'],_0x5857dc);WhatsappMessageEvents['emit'](_0x1cd188,_0x5857dc);_0x1c3474(null);};}for(var e in events){if(events[_0x804b('0x5')](e)){var event=events[e];WhatsappMessage[_0x804b('0x6')](e,emitEvent(event));}}module[_0x804b('0x7')]=WhatsappMessageEvents; \ No newline at end of file +var _0xa45c=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','save'];(function(_0x478de4,_0x4a560b){var _0x3255b6=function(_0x5844f1){while(--_0x5844f1){_0x478de4['push'](_0x478de4['shift']());}};_0x3255b6(++_0x4a560b);}(_0xa45c,0x6d));var _0xca45=function(_0x1584e7,_0x5162f8){_0x1584e7=_0x1584e7-0x0;var _0x39752f=_0xa45c[_0x1584e7];return _0x39752f;};'use strict';var EventEmitter=require(_0xca45('0x0'));var WhatsappMessage=require(_0xca45('0x1'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xca45('0x2'),'afterUpdate':'update','afterDestroy':_0xca45('0x3')};function emitEvent(_0x52e027){return function(_0x16a36c,_0x47d8b9,_0x4d45e6){WhatsappMessageEvents[_0xca45('0x4')](_0x52e027+':'+_0x16a36c['id'],_0x16a36c);WhatsappMessageEvents[_0xca45('0x4')](_0x52e027,_0x16a36c);_0x4d45e6(null);};}for(var e in events){if(events[_0xca45('0x5')](e)){var event=events[e];WhatsappMessage[_0xca45('0x6')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 6984df3..5d805c4 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 _0x73c9=['then','statuses','message_id','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','define','WhatsappMessage','messageId','fti_whatsapp_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','update','catch','error','find','type','twilio','accountSid','authToken','phone','messages','body','whatsapp:','remote','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','/messages/','POST','Bearer\x20'];(function(_0x48f3f8,_0x13e1ca){var _0x176899=function(_0x485046){while(--_0x485046){_0x48f3f8['push'](_0x48f3f8['shift']());}};_0x176899(++_0x13e1ca);}(_0x73c9,0x11a));var _0x973c=function(_0x18c6e1,_0x17c0f2){_0x18c6e1=_0x18c6e1-0x0;var _0x8f13b6=_0x73c9[_0x18c6e1];return _0x8f13b6;};'use strict';var _=require(_0x973c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x973c('0x1'));var moment=require('moment');var BPromise=require(_0x973c('0x2'));var rp=require(_0x973c('0x3'));var fetch=require('node-fetch');var fs=require('fs');var path=require(_0x973c('0x4'));var rimraf=require(_0x973c('0x5'));var config=require(_0x973c('0x6'));var attributes=require(_0x973c('0x7'));module['exports']=function(_0x1a0611,_0x2d31eb){return _0x1a0611[_0x973c('0x8')](_0x973c('0x9'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x973c('0xa')]},{'name':_0x973c('0xb'),'fields':['body'],'type':_0x973c('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x195ac8,_0x205891,_0x54ee1c){var _0xeebda=_0x1a0611[_0x973c('0xd')];var _0x19d316=_0x195ac8[_0x973c('0xe')]({'plain':!![]});if(_0x19d316[_0x973c('0xf')][_0x973c('0x10')]()==='in'||_0x19d316[_0x973c('0xf')][_0x973c('0x10')]()===_0x973c('0x11')&&!_0x19d316[_0x973c('0x12')]&&!_[_0x973c('0x13')](_0x19d316[_0x973c('0x14')])){_0xeebda[_0x973c('0x15')][_0x973c('0x16')]({'where':{'id':_0x19d316[_0x973c('0x17')]}})['then'](function(_0xb1a895){if(_0xb1a895){_0xb1a895[_0x973c('0x18')]({'lastMsgAt':_0x19d316['createdAt'],'lastMsgDirection':_0x19d316[_0x973c('0xf')][_0x973c('0x10')]()});}})[_0x973c('0x19')](function(_0x4c8536){console[_0x973c('0x1a')](_0x4c8536);});}if(_0x19d316[_0x973c('0xf')]===_0x973c('0x11')&&!_0x19d316[_0x973c('0x12')]){var _0x29f85b;_0xeebda['WhatsappAccount'][_0x973c('0x1b')]({'where':{'id':_0x19d316['WhatsappAccountId']},'raw':!![]})['then'](function(_0x1c7cf4){_0x29f85b=_0x1c7cf4;if(_0x29f85b&&_0x29f85b[_0x973c('0x1c')]){switch(_0x29f85b['type']){case _0x973c('0x1d'):var _0x3335d3=require(_0x973c('0x1d'));if(_0x29f85b[_0x973c('0x1e')]&&_0x29f85b[_0x973c('0x1f')]&&_0x29f85b[_0x973c('0x20')]){var _0x44dd72=new _0x3335d3(_0x29f85b[_0x973c('0x1e')],_0x29f85b[_0x973c('0x1f')]);_0x44dd72[_0x973c('0x21')]['create']({'body':_0x19d316[_0x973c('0x22')],'to':_0x973c('0x23')+_0x19d316[_0x973c('0x20')],'from':_0x973c('0x23')+_0x29f85b['phone'],'statusCallback':_0x29f85b[_0x973c('0x24')]+'/api/whatsapp/messages/'+_0x19d316['id']+_0x973c('0x25')+_0x29f85b[_0x973c('0x26')]})['then'](function(_0xc6b044){if(_0xc6b044[_0x973c('0x27')]){return _0x195ac8[_0x973c('0x18')]({'messageId':_0xc6b044['sid']});}})[_0x973c('0x19')](function(_0x220739){logger[_0x973c('0x1a')](_0x973c('0x28'),_0x973c('0x29'),_0x973c('0x1d'),util[_0x973c('0x2a')](_0x220739,{'showHidden':![],'depth':null}));});}else{logger[_0x973c('0x1a')](_0x973c('0x28'),_0x973c('0x29'),_0x973c('0x1d'),_0x973c('0x2b'));}break;case _0x973c('0x2c'):var _0x384cb7=_0x29f85b['accountSid'];var _0x11d09e=_0x29f85b[_0x973c('0x1f')];var _0x5669a0=_0x29f85b['baseUrl']+'/whatsapp/v1/'+_0x384cb7+_0x973c('0x2d');var _0x495215={'to':[_0x19d316['phone']],'message':{'type':'text','text':_0x19d316[_0x973c('0x22')]}};var _0x26e9c3={'method':_0x973c('0x2e'),'uri':_0x5669a0,'headers':{'Authorization':_0x973c('0x2f')+_0x11d09e,'Content-Type':'application/json'},'body':_0x495215,'json':!![]};rp(_0x26e9c3)[_0x973c('0x30')](function(_0x5de5e3){if(_0x5de5e3[_0x973c('0x31')][0x0][_0x973c('0x32')]){return _0x195ac8[_0x973c('0x18')]({'messageId':_0x5de5e3[_0x973c('0x31')][0x0]['message_id']});}})[_0x973c('0x19')](function(_0x19fb21){logger['err'](_0x973c('0x33'),_0x19fb21);});break;}}})[_0x973c('0x34')](function(){_0x54ee1c();});}else{_0x54ee1c();}}},'charset':_0x973c('0x35'),'collate':_0x973c('0x36')});}; \ No newline at end of file +var _0x30a3=['type','twilio','accountSid','phone','authToken','create','whatsapp:','/api/whatsapp/messages/','/status?token=','token','sid','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','statuses','update','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','define','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','findOne','WhatsappInteractionId','then','createdAt','error','WhatsappAccount','find','WhatsappAccountId'];(function(_0xdc83aa,_0x8ebd78){var _0x2c089e=function(_0x5d3aea){while(--_0x5d3aea){_0xdc83aa['push'](_0xdc83aa['shift']());}};_0x2c089e(++_0x8ebd78);}(_0x30a3,0x144));var _0x330a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x30a3[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x330a('0x0'));var util=require('util');var logger=require(_0x330a('0x1'))('api');var moment=require('moment');var BPromise=require(_0x330a('0x2'));var rp=require(_0x330a('0x3'));var fetch=require(_0x330a('0x4'));var fs=require('fs');var path=require(_0x330a('0x5'));var rimraf=require(_0x330a('0x6'));var config=require(_0x330a('0x7'));var attributes=require(_0x330a('0x8'));module['exports']=function(_0x2623d1,_0x522e04){return _0x2623d1[_0x330a('0x9')]('WhatsappMessage',attributes,{'tableName':_0x330a('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x330a('0xb')]},{'name':_0x330a('0xc'),'fields':[_0x330a('0xd')],'type':_0x330a('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x150a2f,_0x4b328e,_0x46f077){var _0x9a4638=_0x2623d1[_0x330a('0xf')];var _0x5d5042=_0x150a2f[_0x330a('0x10')]({'plain':!![]});if(_0x5d5042['direction'][_0x330a('0x11')]()==='in'||_0x5d5042[_0x330a('0x12')][_0x330a('0x11')]()===_0x330a('0x13')&&!_0x5d5042[_0x330a('0x14')]&&!_[_0x330a('0x15')](_0x5d5042['UserId'])){_0x9a4638['WhatsappInteraction'][_0x330a('0x16')]({'where':{'id':_0x5d5042[_0x330a('0x17')]}})[_0x330a('0x18')](function(_0x1aee7f){if(_0x1aee7f){_0x1aee7f['update']({'lastMsgAt':_0x5d5042[_0x330a('0x19')],'lastMsgDirection':_0x5d5042[_0x330a('0x12')]['toLowerCase']()});}})['catch'](function(_0x4ea3c8){console[_0x330a('0x1a')](_0x4ea3c8);});}if(_0x5d5042['direction']==='out'&&!_0x5d5042[_0x330a('0x14')]){var _0x5e3cb2;_0x9a4638[_0x330a('0x1b')][_0x330a('0x1c')]({'where':{'id':_0x5d5042[_0x330a('0x1d')]},'raw':!![]})[_0x330a('0x18')](function(_0x44ea87){_0x5e3cb2=_0x44ea87;if(_0x5e3cb2&&_0x5e3cb2[_0x330a('0x1e')]){switch(_0x5e3cb2[_0x330a('0x1e')]){case _0x330a('0x1f'):var _0xf66aad=require(_0x330a('0x1f'));if(_0x5e3cb2[_0x330a('0x20')]&&_0x5e3cb2['authToken']&&_0x5e3cb2[_0x330a('0x21')]){var _0xe0e27=new _0xf66aad(_0x5e3cb2[_0x330a('0x20')],_0x5e3cb2[_0x330a('0x22')]);_0xe0e27['messages'][_0x330a('0x23')]({'body':_0x5d5042[_0x330a('0xd')],'to':_0x330a('0x24')+_0x5d5042[_0x330a('0x21')],'from':'whatsapp:'+_0x5e3cb2['phone'],'statusCallback':_0x5e3cb2['remote']+_0x330a('0x25')+_0x5d5042['id']+_0x330a('0x26')+_0x5e3cb2[_0x330a('0x27')]})[_0x330a('0x18')](function(_0x582652){if(_0x582652[_0x330a('0x28')]){return _0x150a2f['update']({'messageId':_0x582652[_0x330a('0x28')]});}})[_0x330a('0x29')](function(_0x8b425e){logger['error'](_0x330a('0x2a'),'afterCreate',_0x330a('0x1f'),util[_0x330a('0x2b')](_0x8b425e,{'showHidden':![],'depth':null}));});}else{logger[_0x330a('0x1a')](_0x330a('0x2a'),'afterCreate',_0x330a('0x1f'),_0x330a('0x2c'));}break;case _0x330a('0x2d'):var _0x8ea02a=_0x5e3cb2['accountSid'];var _0x4625ca=_0x5e3cb2[_0x330a('0x22')];var _0x1dd581=_0x5e3cb2[_0x330a('0x2e')]+_0x330a('0x2f')+_0x8ea02a+_0x330a('0x30');var _0x4354e5={'to':[_0x5d5042[_0x330a('0x21')]],'message':{'type':_0x330a('0x31'),'text':_0x5d5042[_0x330a('0xd')]}};var _0x4f6b9e={'method':_0x330a('0x32'),'uri':_0x1dd581,'headers':{'Authorization':_0x330a('0x33')+_0x4625ca,'Content-Type':'application/json'},'body':_0x4354e5,'json':!![]};rp(_0x4f6b9e)['then'](function(_0x3a3db7){if(_0x3a3db7[_0x330a('0x34')][0x0]['message_id']){return _0x150a2f[_0x330a('0x35')]({'messageId':_0x3a3db7[_0x330a('0x34')][0x0]['message_id']});}})[_0x330a('0x29')](function(_0x14b537){logger[_0x330a('0x36')](_0x330a('0x37'),_0x14b537);});break;}}})[_0x330a('0x38')](function(){_0x46f077();});}else{_0x46f077();}}},'charset':_0x330a('0x39'),'collate':_0x330a('0x3a')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 2dd138a..545485d 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 _0xa4bf=['then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateWhatsappMessage','WhatsappMessage','body','options','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','request'];(function(_0x5563fd,_0x1f8c42){var _0x329495=function(_0x363728){while(--_0x363728){_0x5563fd['push'](_0x5563fd['shift']());}};_0x329495(++_0x1f8c42);}(_0xa4bf,0x1c0));var _0xfa4b=function(_0x11a1a6,_0x3bb701){_0x11a1a6=_0x11a1a6-0x0;var _0x38f91e=_0xa4bf[_0x11a1a6];return _0x38f91e;};'use strict';var _=require(_0xfa4b('0x0'));var util=require(_0xfa4b('0x1'));var moment=require(_0xfa4b('0x2'));var BPromise=require(_0xfa4b('0x3'));var rs=require(_0xfa4b('0x4'));var fs=require('fs');var Redis=require(_0xfa4b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xfa4b('0x6'));var logger=require(_0xfa4b('0x7'))(_0xfa4b('0x8'));var config=require(_0xfa4b('0x9'));var jayson=require(_0xfa4b('0xa'));var client=jayson[_0xfa4b('0xb')]['http']({'port':0x232a});config['redis']=_[_0xfa4b('0xc')](config[_0xfa4b('0xd')],{'host':_0xfa4b('0xe'),'port':0x18eb});var socket=require(_0xfa4b('0xf'))(new Redis(config[_0xfa4b('0xd')]));require('./whatsappMessage.socket')['register'](socket);function respondWithRpcPromise(_0xd5ab99,_0x1fa59c,_0x5f823c){return new BPromise(function(_0x5486e7,_0x11dfc1){return client[_0xfa4b('0x10')](_0xd5ab99,_0x5f823c)[_0xfa4b('0x11')](function(_0x43fa22){logger[_0xfa4b('0x12')](_0xfa4b('0x13'),_0x1fa59c,_0xfa4b('0x14'));logger[_0xfa4b('0x15')](_0xfa4b('0x16'),_0x1fa59c,_0xfa4b('0x14'),JSON[_0xfa4b('0x17')](_0x43fa22));if(_0x43fa22[_0xfa4b('0x18')]){if(_0x43fa22['error']['code']===0x1f4){logger[_0xfa4b('0x18')](_0xfa4b('0x13'),_0x1fa59c,_0x43fa22['error'][_0xfa4b('0x19')]);return _0x11dfc1(_0x43fa22[_0xfa4b('0x18')][_0xfa4b('0x19')]);}logger[_0xfa4b('0x18')](_0xfa4b('0x13'),_0x1fa59c,_0x43fa22[_0xfa4b('0x18')][_0xfa4b('0x19')]);return _0x5486e7(_0x43fa22[_0xfa4b('0x18')]['message']);}else{logger[_0xfa4b('0x12')](_0xfa4b('0x13'),_0x1fa59c,_0xfa4b('0x14'));_0x5486e7(_0x43fa22['result'][_0xfa4b('0x19')]);}})[_0xfa4b('0x1a')](function(_0x24a781){logger[_0xfa4b('0x18')](_0xfa4b('0x13'),_0x1fa59c,_0x24a781);_0x11dfc1(_0x24a781);});});}exports[_0xfa4b('0x1b')]=function(_0x582485){var _0x427c2b=this;return new Promise(function(_0x2c88f1,_0x24cc90){return db[_0xfa4b('0x1c')]['create'](_0x582485[_0xfa4b('0x1d')],{'raw':_0x582485['options']?_0x582485[_0xfa4b('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0xfa4b('0x11')](function(_0x938217){logger[_0xfa4b('0x12')](_0xfa4b('0x1b'),_0x582485);logger[_0xfa4b('0x15')](_0xfa4b('0x1b'),_0x582485,JSON[_0xfa4b('0x17')](_0x938217));_0x2c88f1(_0x938217);})[_0xfa4b('0x1a')](function(_0x856121){logger[_0xfa4b('0x18')](_0xfa4b('0x1b'),_0x856121[_0xfa4b('0x19')],_0x582485);_0x24cc90(_0x427c2b[_0xfa4b('0x18')](0x1f4,_0x856121[_0xfa4b('0x19')]));});});}; \ No newline at end of file +var _0xaa74=['./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','WhatsappMessage','create','body','options','raw','CreateWhatsappMessage','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter'];(function(_0x40b898,_0x2fd575){var _0x2ff0bb=function(_0x5a37ae){while(--_0x5a37ae){_0x40b898['push'](_0x40b898['shift']());}};_0x2ff0bb(++_0x2fd575);}(_0xaa74,0x144));var _0x4aa7=function(_0x2a09d9,_0x28f61a){_0x2a09d9=_0x2a09d9-0x0;var _0x4c430e=_0xaa74[_0x2a09d9];return _0x4c430e;};'use strict';var _=require(_0x4aa7('0x0'));var util=require(_0x4aa7('0x1'));var moment=require(_0x4aa7('0x2'));var BPromise=require(_0x4aa7('0x3'));var rs=require(_0x4aa7('0x4'));var fs=require('fs');var Redis=require(_0x4aa7('0x5'));var db=require(_0x4aa7('0x6'))['db'];var utils=require(_0x4aa7('0x7'));var logger=require(_0x4aa7('0x8'))(_0x4aa7('0x9'));var config=require(_0x4aa7('0xa'));var jayson=require(_0x4aa7('0xb'));var client=jayson[_0x4aa7('0xc')]['http']({'port':0x232a});config[_0x4aa7('0xd')]=_['defaults'](config[_0x4aa7('0xd')],{'host':_0x4aa7('0xe'),'port':0x18eb});var socket=require(_0x4aa7('0xf'))(new Redis(config[_0x4aa7('0xd')]));require(_0x4aa7('0x10'))[_0x4aa7('0x11')](socket);function respondWithRpcPromise(_0x4f0e98,_0x1acb8a,_0xceb5a9){return new BPromise(function(_0x3caffc,_0x48b61f){return client[_0x4aa7('0x12')](_0x4f0e98,_0xceb5a9)[_0x4aa7('0x13')](function(_0x66a62){logger[_0x4aa7('0x14')](_0x4aa7('0x15'),_0x1acb8a,_0x4aa7('0x16'));logger[_0x4aa7('0x17')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x1acb8a,_0x4aa7('0x16'),JSON['stringify'](_0x66a62));if(_0x66a62[_0x4aa7('0x18')]){if(_0x66a62[_0x4aa7('0x18')]['code']===0x1f4){logger[_0x4aa7('0x18')](_0x4aa7('0x15'),_0x1acb8a,_0x66a62[_0x4aa7('0x18')][_0x4aa7('0x19')]);return _0x48b61f(_0x66a62[_0x4aa7('0x18')][_0x4aa7('0x19')]);}logger[_0x4aa7('0x18')](_0x4aa7('0x15'),_0x1acb8a,_0x66a62[_0x4aa7('0x18')][_0x4aa7('0x19')]);return _0x3caffc(_0x66a62[_0x4aa7('0x18')][_0x4aa7('0x19')]);}else{logger[_0x4aa7('0x14')](_0x4aa7('0x15'),_0x1acb8a,_0x4aa7('0x16'));_0x3caffc(_0x66a62['result']['message']);}})[_0x4aa7('0x1a')](function(_0x14927b){logger[_0x4aa7('0x18')](_0x4aa7('0x15'),_0x1acb8a,_0x14927b);_0x48b61f(_0x14927b);});});}exports['CreateWhatsappMessage']=function(_0x429c61){var _0x423e34=this;return new Promise(function(_0x10492d,_0x13c5cc){return db[_0x4aa7('0x1b')][_0x4aa7('0x1c')](_0x429c61[_0x4aa7('0x1d')],{'raw':_0x429c61[_0x4aa7('0x1e')]?_0x429c61[_0x4aa7('0x1e')][_0x4aa7('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x509f03){logger[_0x4aa7('0x14')](_0x4aa7('0x20'),_0x429c61);logger[_0x4aa7('0x17')](_0x4aa7('0x20'),_0x429c61,JSON[_0x4aa7('0x21')](_0x509f03));_0x10492d(_0x509f03);})[_0x4aa7('0x1a')](function(_0x1c8d45){logger[_0x4aa7('0x18')]('CreateWhatsappMessage',_0x1c8d45[_0x4aa7('0x19')],_0x429c61);_0x13c5cc(_0x423e34[_0x4aa7('0x18')](0x1f4,_0x1c8d45[_0x4aa7('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 5bdf65a..690c719 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 _0xf1a9=['register','length','./whatsappMessage.events','save','remove','emit'];(function(_0x11309c,_0xe18a74){var _0x3fea9c=function(_0xeb11c3){while(--_0xeb11c3){_0x11309c['push'](_0x11309c['shift']());}};_0x3fea9c(++_0xe18a74);}(_0xf1a9,0x170));var _0x9f1a=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xf1a9[_0x5ddb1c];return _0x354adc;};'use strict';var WhatsappMessageEvents=require(_0x9f1a('0x0'));var events=[_0x9f1a('0x1'),_0x9f1a('0x2'),'update'];function createListener(_0x1b3651,_0x2f3c45){return function(_0x4a6c66){_0x2f3c45[_0x9f1a('0x3')](_0x1b3651,_0x4a6c66);};}function removeListener(_0x2becc4,_0x245ed1){return function(){WhatsappMessageEvents['removeListener'](_0x2becc4,_0x245ed1);};}exports[_0x9f1a('0x4')]=function(_0xddd1b0){for(var _0x444948=0x0,_0x510b2f=events[_0x9f1a('0x5')];_0x444948<_0x510b2f;_0x444948++){var _0x55147a=events[_0x444948];var _0x3c82cc=createListener('whatsappMessage:'+_0x55147a,_0xddd1b0);WhatsappMessageEvents['on'](_0x55147a,_0x3c82cc);}}; \ No newline at end of file +var _0x1142=['remove','update','emit','removeListener','register','length','whatsappMessage:','./whatsappMessage.events'];(function(_0xd74e9a,_0x47e739){var _0x379a59=function(_0x29d976){while(--_0x29d976){_0xd74e9a['push'](_0xd74e9a['shift']());}};_0x379a59(++_0x47e739);}(_0x1142,0xa7));var _0x2114=function(_0x406b08,_0x20fbb0){_0x406b08=_0x406b08-0x0;var _0x2f27b7=_0x1142[_0x406b08];return _0x2f27b7;};'use strict';var WhatsappMessageEvents=require(_0x2114('0x0'));var events=['save',_0x2114('0x1'),_0x2114('0x2')];function createListener(_0x5dea1c,_0x17a068){return function(_0x24b3f6){_0x17a068[_0x2114('0x3')](_0x5dea1c,_0x24b3f6);};}function removeListener(_0x51c482,_0x37d21a){return function(){WhatsappMessageEvents[_0x2114('0x4')](_0x51c482,_0x37d21a);};}exports[_0x2114('0x5')]=function(_0x20077d){for(var _0x58ac44=0x0,_0x2f1381=events[_0x2114('0x6')];_0x58ac44<_0x2f1381;_0x58ac44++){var _0x3c7493=events[_0x58ac44];var _0x5d5003=createListener(_0x2114('0x7')+_0x3c7493,_0x20077d);WhatsappMessageEvents['on'](_0x3c7493,_0x5d5003);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index d2ab4a7..0105a96 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 _0x334f=['fs-extra','../../components/auth/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addAgents','put','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x1a3057,_0x275afb){var _0x3585b5=function(_0x3935c7){while(--_0x3935c7){_0x1a3057['push'](_0x1a3057['shift']());}};_0x3585b5(++_0x275afb);}(_0x334f,0xa2));var _0xf334=function(_0x40851d,_0x23bb4b){_0x40851d=_0x40851d-0x0;var _0x3aea1f=_0x334f[_0x40851d];return _0x3aea1f;};'use strict';var multer=require(_0xf334('0x0'));var util=require(_0xf334('0x1'));var path=require(_0xf334('0x2'));var timeout=require(_0xf334('0x3'));var express=require(_0xf334('0x4'));var router=express[_0xf334('0x5')]();var fs_extra=require(_0xf334('0x6'));var auth=require(_0xf334('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xf334('0x8'));var controller=require(_0xf334('0x9'));router[_0xf334('0xa')]('/',auth[_0xf334('0xb')](),controller[_0xf334('0xc')]);router[_0xf334('0xa')](_0xf334('0xd'),auth['isAuthenticated'](),controller[_0xf334('0xe')]);router['get'](_0xf334('0xf'),auth[_0xf334('0xb')](),controller[_0xf334('0x10')]);router['get'](_0xf334('0x11'),auth[_0xf334('0xb')](),controller[_0xf334('0x12')]);router[_0xf334('0xa')](_0xf334('0x13'),auth[_0xf334('0xb')](),controller[_0xf334('0x14')]);router[_0xf334('0xa')](_0xf334('0x15'),auth[_0xf334('0xb')](),controller[_0xf334('0x16')]);router[_0xf334('0x17')]('/',auth[_0xf334('0xb')](),controller['create']);router[_0xf334('0x17')](_0xf334('0x13'),auth[_0xf334('0xb')](),controller['addTeams']);router[_0xf334('0x17')](_0xf334('0x15'),auth[_0xf334('0xb')](),controller[_0xf334('0x18')]);router[_0xf334('0x19')](_0xf334('0xf'),auth[_0xf334('0xb')](),controller['update']);router[_0xf334('0x1a')](_0xf334('0xf'),auth[_0xf334('0xb')](),controller[_0xf334('0x1b')]);router[_0xf334('0x1a')](_0xf334('0x13'),auth['isAuthenticated'](),controller['removeTeams']);router[_0xf334('0x1a')](_0xf334('0x15'),auth[_0xf334('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x0733=['show','/:id/teams','getTeams','/:id/users','post','create','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x0733,0xc4));var _0x3073=function(_0x53c4b3,_0x607fbd){_0x53c4b3=_0x53c4b3-0x0;var _0x12a4b2=_0x0733[_0x53c4b3];return _0x12a4b2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3073('0x0'));var timeout=require(_0x3073('0x1'));var express=require(_0x3073('0x2'));var router=express['Router']();var fs_extra=require(_0x3073('0x3'));var auth=require(_0x3073('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3073('0x5'));var controller=require(_0x3073('0x6'));router[_0x3073('0x7')]('/',auth[_0x3073('0x8')](),controller[_0x3073('0x9')]);router[_0x3073('0x7')](_0x3073('0xa'),auth[_0x3073('0x8')](),controller[_0x3073('0xb')]);router[_0x3073('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x3073('0xc')]);router[_0x3073('0x7')]('/:id/members',auth[_0x3073('0x8')](),controller['getMembers']);router['get'](_0x3073('0xd'),auth[_0x3073('0x8')](),controller[_0x3073('0xe')]);router[_0x3073('0x7')](_0x3073('0xf'),auth[_0x3073('0x8')](),controller['getAgents']);router[_0x3073('0x10')]('/',auth[_0x3073('0x8')](),controller[_0x3073('0x11')]);router[_0x3073('0x10')](_0x3073('0xd'),auth[_0x3073('0x8')](),controller['addTeams']);router[_0x3073('0x10')](_0x3073('0xf'),auth['isAuthenticated'](),controller[_0x3073('0x12')]);router[_0x3073('0x13')]('/:id',auth[_0x3073('0x8')](),controller[_0x3073('0x14')]);router[_0x3073('0x15')]('/:id',auth[_0x3073('0x8')](),controller[_0x3073('0x16')]);router[_0x3073('0x15')](_0x3073('0xd'),auth['isAuthenticated'](),controller[_0x3073('0x17')]);router[_0x3073('0x15')]('/:id/users',auth[_0x3073('0x8')](),controller[_0x3073('0x18')]);module[_0x3073('0x19')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index c47a10e..94f6094 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 _0xeebe=['rrmemory','beepall','roundrobin','sequelize','STRING','INTEGER','ENUM'];(function(_0x4629ee,_0x5802d8){var _0x47fb5b=function(_0xf899cd){while(--_0xf899cd){_0x4629ee['push'](_0x4629ee['shift']());}};_0x47fb5b(++_0x5802d8);}(_0xeebe,0xff));var _0xeeeb=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0xeebe[_0x1a36a5];return _0x746243;};'use strict';var Sequelize=require(_0xeeeb('0x0'));module['exports']={'name':{'type':Sequelize[_0xeeeb('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xeeeb('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xeeeb('0x3')](_0xeeeb('0x4'),_0xeeeb('0x5'),_0xeeeb('0x6'))},'description':{'type':Sequelize[_0xeeeb('0x1')]}}; \ No newline at end of file +var _0xb469=['ENUM','rrmemory','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xb469,0x13b));var _0x9b46=function(_0x1a4084,_0x5008bb){_0x1a4084=_0x1a4084-0x0;var _0x2bc826=_0xb469[_0x1a4084];return _0x2bc826;};'use strict';var Sequelize=require(_0x9b46('0x0'));module[_0x9b46('0x1')]={'name':{'type':Sequelize[_0x9b46('0x2')],'unique':_0x9b46('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x9b46('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9b46('0x5')](_0x9b46('0x6'),'beepall',_0x9b46('0x7'))},'description':{'type':Sequelize[_0x9b46('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 98b3d2a..3d15b1f 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 _0xf233=['where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','nolimit','WhatsappQueueId','User','findAndCountAll','UserId','agent','whatsappPause','format','%s/%s','SIP','createdAt','updatedAt','getTeams','Team','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','each','forEach','emit','userWhatsappQueue:save','select','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','spread','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','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','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','count','set','apply','reject','save','then','get','WhatsappQueues','UserProfileResource','destroy','end','error','stack','name','index','map','WhatsappQueue','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','filter'];(function(_0x40cd57,_0x478837){var _0x178081=function(_0x2a6ce2){while(--_0x2a6ce2){_0x40cd57['push'](_0x40cd57['shift']());}};_0x178081(++_0x478837);}(_0xf233,0xdd));var _0x3f23=function(_0x234039,_0x5bb31e){_0x234039=_0x234039-0x0;var _0x4dedfa=_0xf233[_0x234039];return _0x4dedfa;};'use strict';var emlformat=require(_0x3f23('0x0'));var rimraf=require(_0x3f23('0x1'));var zipdir=require(_0x3f23('0x2'));var jsonpatch=require(_0x3f23('0x3'));var rp=require(_0x3f23('0x4'));var moment=require(_0x3f23('0x5'));var BPromise=require(_0x3f23('0x6'));var Mustache=require(_0x3f23('0x7'));var util=require('util');var path=require(_0x3f23('0x8'));var sox=require(_0x3f23('0x9'));var csv=require(_0x3f23('0xa'));var ejs=require(_0x3f23('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3f23('0xc'));var crypto=require('crypto');var jsforce=require(_0x3f23('0xd'));var deskjs=require(_0x3f23('0xe'));var toCsv=require(_0x3f23('0xa'));var querystring=require(_0x3f23('0xf'));var Papa=require(_0x3f23('0x10'));var Redis=require(_0x3f23('0x11'));var authService=require(_0x3f23('0x12'));var qs=require(_0x3f23('0x13'));var as=require(_0x3f23('0x14'));var hardwareService=require(_0x3f23('0x15'));var logger=require(_0x3f23('0x16'))(_0x3f23('0x17'));var utils=require(_0x3f23('0x18'));var config=require(_0x3f23('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x3f23('0x1a'))['db'];config[_0x3f23('0x1b')]=_['defaults'](config[_0x3f23('0x1b')],{'host':_0x3f23('0x1c'),'port':0x18eb});var socket=require(_0x3f23('0x1d'))(new Redis(config[_0x3f23('0x1b')]));require('./whatsappQueue.socket')[_0x3f23('0x1e')](socket);function respondWithStatusCode(_0x2c5bcd,_0x58eeeb){_0x58eeeb=_0x58eeeb||0xcc;return function(_0x4671a1){if(_0x4671a1){return _0x2c5bcd[_0x3f23('0x1f')](_0x58eeeb);}return _0x2c5bcd['status'](_0x58eeeb)['end']();};}function respondWithResult(_0x159e02,_0x24ce2a){_0x24ce2a=_0x24ce2a||0xc8;return function(_0x5377d2){if(_0x5377d2){return _0x159e02[_0x3f23('0x20')](_0x24ce2a)[_0x3f23('0x21')](_0x5377d2);}};}function respondWithFilteredResult(_0x2b6f43,_0x50fc0c){return function(_0x164598){if(_0x164598){var _0x66222=typeof _0x50fc0c[_0x3f23('0x22')]===_0x3f23('0x23')&&typeof _0x50fc0c['limit']===_0x3f23('0x23');var _0x33b5a4=_0x164598[_0x3f23('0x24')];var _0x5cb9f4=_0x66222?0x0:_0x50fc0c[_0x3f23('0x22')];var _0x3bf60b=_0x66222?_0x164598[_0x3f23('0x24')]:_0x50fc0c[_0x3f23('0x22')]+_0x50fc0c['limit'];var _0x2b297e;if(_0x3bf60b>=_0x33b5a4){_0x3bf60b=_0x33b5a4;_0x2b297e=0xc8;}else{_0x2b297e=0xce;}_0x2b6f43['status'](_0x2b297e);return _0x2b6f43[_0x3f23('0x25')]('Content-Range',_0x5cb9f4+'-'+_0x3bf60b+'/'+_0x33b5a4)[_0x3f23('0x21')](_0x164598);}return null;};}function patchUpdates(_0x286ce0){return function(_0xa6eede){try{jsonpatch[_0x3f23('0x26')](_0xa6eede,_0x286ce0,!![]);}catch(_0xa3eae8){return BPromise[_0x3f23('0x27')](_0xa3eae8);}return _0xa6eede[_0x3f23('0x28')]();};}function saveUpdates(_0x13c370,_0x51cdcc){return function(_0x3adb4a){if(_0x3adb4a){return _0x3adb4a['update'](_0x13c370)['then'](function(_0x50600c){return _0x50600c;});}return null;};}function removeEntity(_0x1d39d8,_0x140c56){return function(_0x51657b){if(_0x51657b){return _0x51657b['destroy']()[_0x3f23('0x29')](function(){var _0x3d4ee8=_0x51657b[_0x3f23('0x2a')]({'plain':!![]});var _0x292088=_0x3f23('0x2b');return db[_0x3f23('0x2c')][_0x3f23('0x2d')]({'where':{'type':_0x292088,'resourceId':_0x3d4ee8['id']}})[_0x3f23('0x29')](function(){return _0x51657b;});})['then'](function(){_0x1d39d8[_0x3f23('0x20')](0xcc)[_0x3f23('0x2e')]();});}};}function handleEntityNotFound(_0x492781,_0x46d2f4){return function(_0x13950e){if(!_0x13950e){_0x492781[_0x3f23('0x1f')](0x194);}return _0x13950e;};}function handleError(_0x3117b5,_0x5d799d){_0x5d799d=_0x5d799d||0x1f4;return function(_0x531763){logger[_0x3f23('0x2f')](_0x531763[_0x3f23('0x30')]);if(_0x531763[_0x3f23('0x31')]){delete _0x531763[_0x3f23('0x31')];}_0x3117b5[_0x3f23('0x20')](_0x5d799d)['send'](_0x531763);};}exports[_0x3f23('0x32')]=function(_0x20a334,_0x218882){var _0x3c0f0b={},_0x518949={},_0x380224={'count':0x0,'rows':[]};var _0x428c1b=_[_0x3f23('0x33')](db[_0x3f23('0x34')]['rawAttributes'],function(_0x1bdad5){return{'name':_0x1bdad5[_0x3f23('0x35')],'type':_0x1bdad5[_0x3f23('0x36')]['key']};});_0x518949['model']=_[_0x3f23('0x33')](_0x428c1b,_0x3f23('0x31'));_0x518949[_0x3f23('0x37')]=_[_0x3f23('0x38')](_0x20a334[_0x3f23('0x37')]);_0x518949[_0x3f23('0x39')]=_[_0x3f23('0x3a')](_0x518949[_0x3f23('0x3b')],_0x518949['query']);_0x3c0f0b[_0x3f23('0x3c')]=_[_0x3f23('0x3a')](_0x518949['model'],qs['fields'](_0x20a334[_0x3f23('0x37')][_0x3f23('0x3d')]));_0x3c0f0b[_0x3f23('0x3c')]=_0x3c0f0b[_0x3f23('0x3c')][_0x3f23('0x3e')]?_0x3c0f0b[_0x3f23('0x3c')]:_0x518949[_0x3f23('0x3b')];if(!_0x20a334[_0x3f23('0x37')][_0x3f23('0x3f')]('nolimit')){_0x3c0f0b['limit']=qs[_0x3f23('0x40')](_0x20a334['query'][_0x3f23('0x40')]);_0x3c0f0b['offset']=qs[_0x3f23('0x22')](_0x20a334[_0x3f23('0x37')]['offset']);}_0x3c0f0b[_0x3f23('0x41')]=qs[_0x3f23('0x42')](_0x20a334[_0x3f23('0x37')][_0x3f23('0x42')]);_0x3c0f0b['where']=qs[_0x3f23('0x39')](_[_0x3f23('0x43')](_0x20a334[_0x3f23('0x37')],_0x518949['filters']),_0x428c1b);if(_0x20a334[_0x3f23('0x37')][_0x3f23('0x44')]){_0x3c0f0b[_0x3f23('0x45')]=_[_0x3f23('0x46')](_0x3c0f0b['where'],{'$or':_[_0x3f23('0x33')](_0x428c1b,function(_0x411aac){if(_0x411aac[_0x3f23('0x36')]!==_0x3f23('0x47')){var _0x3612a6={};_0x3612a6[_0x411aac[_0x3f23('0x31')]]={'$like':'%'+_0x20a334[_0x3f23('0x37')][_0x3f23('0x44')]+'%'};return _0x3612a6;}})});}_0x3c0f0b=_[_0x3f23('0x46')]({},_0x3c0f0b,_0x20a334[_0x3f23('0x48')]);var _0x4b6ae1={'where':_0x3c0f0b[_0x3f23('0x45')]};return db[_0x3f23('0x34')]['count'](_0x4b6ae1)[_0x3f23('0x29')](function(_0x35eaf6){_0x380224['count']=_0x35eaf6;if(_0x20a334['query'][_0x3f23('0x49')]){_0x3c0f0b[_0x3f23('0x4a')]=[{'all':!![]}];}return db['WhatsappQueue'][_0x3f23('0x4b')](_0x3c0f0b);})[_0x3f23('0x29')](function(_0x3c3276){_0x380224[_0x3f23('0x4c')]=_0x3c3276;return _0x380224;})['then'](respondWithFilteredResult(_0x218882,_0x3c0f0b))[_0x3f23('0x4d')](handleError(_0x218882,null));};exports[_0x3f23('0x4e')]=function(_0x1f047c,_0x4a5d5f){var _0x292efb={'raw':!![],'where':{'id':_0x1f047c[_0x3f23('0x4f')]['id']}},_0x289ab4={};_0x289ab4[_0x3f23('0x3b')]=_[_0x3f23('0x38')](db['WhatsappQueue'][_0x3f23('0x50')]);_0x289ab4[_0x3f23('0x37')]=_[_0x3f23('0x38')](_0x1f047c[_0x3f23('0x37')]);_0x289ab4[_0x3f23('0x39')]=_[_0x3f23('0x3a')](_0x289ab4['model'],_0x289ab4[_0x3f23('0x37')]);_0x292efb[_0x3f23('0x3c')]=_[_0x3f23('0x3a')](_0x289ab4[_0x3f23('0x3b')],qs[_0x3f23('0x3d')](_0x1f047c[_0x3f23('0x37')]['fields']));_0x292efb[_0x3f23('0x3c')]=_0x292efb[_0x3f23('0x3c')]['length']?_0x292efb[_0x3f23('0x3c')]:_0x289ab4[_0x3f23('0x3b')];if(_0x1f047c[_0x3f23('0x37')]['includeAll']){_0x292efb[_0x3f23('0x4a')]=[{'all':!![]}];}_0x292efb=_[_0x3f23('0x46')]({},_0x292efb,_0x1f047c[_0x3f23('0x48')]);return db[_0x3f23('0x34')][_0x3f23('0x51')](_0x292efb)[_0x3f23('0x29')](handleEntityNotFound(_0x4a5d5f,null))['then'](respondWithResult(_0x4a5d5f,null))['catch'](handleError(_0x4a5d5f,null));};exports[_0x3f23('0x52')]=function(_0x3886a9,_0x23cf53){return db['WhatsappQueue'][_0x3f23('0x52')](_0x3886a9[_0x3f23('0x53')],{})[_0x3f23('0x29')](function(_0x5858a5){var _0x4f940e=_0x3886a9[_0x3f23('0x54')][_0x3f23('0x2a')]({'plain':!![]});if(!_0x4f940e)throw new Error(_0x3f23('0x55'));if(_0x4f940e[_0x3f23('0x56')]===_0x3f23('0x54')){var _0x227ba7=_0x5858a5[_0x3f23('0x2a')]({'plain':!![]});var _0x576f34='WhatsappQueues';return db[_0x3f23('0x57')][_0x3f23('0x51')]({'where':{'name':_0x576f34,'userProfileId':_0x4f940e[_0x3f23('0x58')]},'raw':!![]})[_0x3f23('0x29')](function(_0x28f8e0){if(_0x28f8e0&&_0x28f8e0[_0x3f23('0x59')]===0x0){return db[_0x3f23('0x2c')][_0x3f23('0x52')]({'name':_0x227ba7['name'],'resourceId':_0x227ba7['id'],'type':_0x28f8e0[_0x3f23('0x31')],'sectionId':_0x28f8e0['id']},{})[_0x3f23('0x29')](function(){return _0x5858a5;});}else{return _0x5858a5;}})[_0x3f23('0x4d')](function(_0x28aea3){logger[_0x3f23('0x2f')](_0x3f23('0x5a'),_0x28aea3);throw _0x28aea3;});}return _0x5858a5;})[_0x3f23('0x29')](respondWithResult(_0x23cf53,0xc9))[_0x3f23('0x4d')](handleError(_0x23cf53,null));};exports['update']=function(_0x267a02,_0x38d4de){if(_0x267a02[_0x3f23('0x53')]['id']){delete _0x267a02[_0x3f23('0x53')]['id'];}return db['WhatsappQueue'][_0x3f23('0x51')]({'where':{'id':_0x267a02[_0x3f23('0x4f')]['id']}})[_0x3f23('0x29')](handleEntityNotFound(_0x38d4de,null))[_0x3f23('0x29')](saveUpdates(_0x267a02[_0x3f23('0x53')],null))['then'](respondWithResult(_0x38d4de,null))[_0x3f23('0x4d')](handleError(_0x38d4de,null));};exports['destroy']=function(_0xcada51,_0x312dee){return db[_0x3f23('0x34')]['find']({'where':{'id':_0xcada51[_0x3f23('0x4f')]['id']}})[_0x3f23('0x29')](handleEntityNotFound(_0x312dee,null))[_0x3f23('0x29')](removeEntity(_0x312dee,null))[_0x3f23('0x4d')](handleError(_0x312dee,null));};exports[_0x3f23('0x5b')]=function(_0x1f8526,_0x1f6b32){return db[_0x3f23('0x34')]['describe']()[_0x3f23('0x29')](respondWithResult(_0x1f6b32,null))[_0x3f23('0x4d')](handleError(_0x1f6b32,null));};exports[_0x3f23('0x5c')]=function(_0x2727c5,_0x3577b6,_0x4db7ca){var _0x52a939={'raw':!![],'where':{}},_0x3adb01={},_0x452040;return db[_0x3f23('0x34')][_0x3f23('0x5d')]({'where':{'id':_0x2727c5[_0x3f23('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3577b6,null))[_0x3f23('0x29')](function(_0x422053){if(_0x422053){_0x452040=_0x422053[_0x3f23('0x2a')]({'plain':!![]});_0x3adb01[_0x3f23('0x3b')]=_[_0x3f23('0x38')](db[_0x3f23('0x5e')][_0x3f23('0x50')]);_0x3adb01[_0x3f23('0x37')]=_[_0x3f23('0x38')](_0x2727c5[_0x3f23('0x37')]);_0x3adb01[_0x3f23('0x39')]=_[_0x3f23('0x3a')](_0x3adb01['model'],_0x3adb01[_0x3f23('0x37')]);_0x52a939['attributes']=_[_0x3f23('0x3a')](_0x3adb01[_0x3f23('0x3b')],qs[_0x3f23('0x3d')](_0x2727c5[_0x3f23('0x37')]['fields']));_0x52a939['attributes']=_0x52a939[_0x3f23('0x3c')][_0x3f23('0x3e')]?_0x52a939[_0x3f23('0x3c')]:_0x3adb01[_0x3f23('0x3b')];if(!_0x2727c5[_0x3f23('0x37')][_0x3f23('0x3f')](_0x3f23('0x5f'))){_0x52a939[_0x3f23('0x40')]=qs[_0x3f23('0x40')](_0x2727c5[_0x3f23('0x37')][_0x3f23('0x40')]);_0x52a939['offset']=qs['offset'](_0x2727c5[_0x3f23('0x37')]['offset']);}_0x52a939[_0x3f23('0x41')]=qs[_0x3f23('0x42')](_0x2727c5[_0x3f23('0x37')][_0x3f23('0x42')]);_0x52a939[_0x3f23('0x45')]=qs['filters'](_[_0x3f23('0x43')](_0x2727c5['query'],_0x3adb01[_0x3f23('0x39')]));_0x52a939[_0x3f23('0x45')][_0x3f23('0x60')]=_0x422053['id'];if(_0x2727c5[_0x3f23('0x37')][_0x3f23('0x44')]){_0x52a939[_0x3f23('0x45')]=_[_0x3f23('0x46')](_0x52a939['where'],{'$or':_[_0x3f23('0x33')](_0x52a939['attributes'],function(_0x3b4b86){var _0x17b1d1={};_0x17b1d1[_0x3b4b86]={'$like':'%'+_0x2727c5[_0x3f23('0x37')][_0x3f23('0x44')]+'%'};return _0x17b1d1;})});}_0x52a939=_[_0x3f23('0x46')]({},_0x52a939,_0x2727c5[_0x3f23('0x48')]);return db[_0x3f23('0x5e')][_0x3f23('0x4b')](_0x52a939);}})[_0x3f23('0x29')](function(_0x2ce13e){if(_0x2ce13e){return db[_0x3f23('0x61')][_0x3f23('0x62')]({'where':{'id':_[_0x3f23('0x33')](_0x2ce13e,_0x3f23('0x63')),'role':_0x3f23('0x64')},'attributes':['id',_0x3f23('0x31'),_0x3f23('0x65'),'updatedAt','createdAt']});}})[_0x3f23('0x29')](function(_0x3be785){if(_0x3be785){return{'count':_0x3be785[_0x3f23('0x24')],'rows':_[_0x3f23('0x33')](_0x3be785[_0x3f23('0x4c')],function(_0x2879dc){return{'membername':_0x2879dc[_0x3f23('0x31')],'UserId':_0x2879dc['id'],'queue_name':_0x452040['name'],'WhatsappQueueId':_0x452040['id'],'interface':util[_0x3f23('0x66')](_0x3f23('0x67'),_0x3f23('0x68'),_0x2879dc['name']),'penalty':0x0,'paused':_0x2879dc['whatsappPause'],'createdAt':_0x2879dc[_0x3f23('0x69')],'updatedAt':_0x2879dc[_0x3f23('0x6a')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3577b6,_0x52a939))[_0x3f23('0x4d')](handleError(_0x3577b6,null));};exports[_0x3f23('0x6b')]=function(_0x410582,_0x49c6c3,_0x3ee7ed){var _0x1cb5f0={};var _0x369891={};var _0x4b2a52;var _0x34349a;return db[_0x3f23('0x34')][_0x3f23('0x5d')]({'where':{'id':_0x410582[_0x3f23('0x4f')]['id']}})[_0x3f23('0x29')](handleEntityNotFound(_0x49c6c3,null))[_0x3f23('0x29')](function(_0xd9feb3){if(_0xd9feb3){_0x4b2a52=_0xd9feb3;_0x369891[_0x3f23('0x3b')]=_['keys'](db[_0x3f23('0x6c')][_0x3f23('0x50')]);_0x369891[_0x3f23('0x37')]=_[_0x3f23('0x38')](_0x410582[_0x3f23('0x37')]);_0x369891[_0x3f23('0x39')]=_[_0x3f23('0x3a')](_0x369891[_0x3f23('0x3b')],_0x369891[_0x3f23('0x37')]);_0x1cb5f0[_0x3f23('0x3c')]=_[_0x3f23('0x3a')](_0x369891[_0x3f23('0x3b')],qs[_0x3f23('0x3d')](_0x410582['query'][_0x3f23('0x3d')]));_0x1cb5f0[_0x3f23('0x3c')]=_0x1cb5f0[_0x3f23('0x3c')][_0x3f23('0x3e')]?_0x1cb5f0['attributes']:_0x369891['model'];_0x1cb5f0['order']=qs[_0x3f23('0x42')](_0x410582[_0x3f23('0x37')]['sort']);_0x1cb5f0[_0x3f23('0x45')]=qs[_0x3f23('0x39')](_[_0x3f23('0x43')](_0x410582['query'],_0x369891[_0x3f23('0x39')]));if(_0x410582[_0x3f23('0x37')][_0x3f23('0x44')]){_0x1cb5f0[_0x3f23('0x45')]=_[_0x3f23('0x46')](_0x1cb5f0[_0x3f23('0x45')],{'$or':_['map'](_0x1cb5f0[_0x3f23('0x3c')],function(_0x1bc3d5){var _0x3ab975={};_0x3ab975[_0x1bc3d5]={'$like':'%'+_0x410582[_0x3f23('0x37')][_0x3f23('0x44')]+'%'};return _0x3ab975;})});}_0x1cb5f0=_['merge']({},_0x1cb5f0,_0x410582[_0x3f23('0x48')]);return _0x4b2a52['getTeams'](_0x1cb5f0);}})['then'](function(_0x46a1a0){if(_0x46a1a0){_0x34349a=_0x46a1a0[_0x3f23('0x3e')];if(!_0x410582['query'][_0x3f23('0x3f')](_0x3f23('0x5f'))){_0x1cb5f0[_0x3f23('0x40')]=qs[_0x3f23('0x40')](_0x410582[_0x3f23('0x37')][_0x3f23('0x40')]);_0x1cb5f0[_0x3f23('0x22')]=qs[_0x3f23('0x22')](_0x410582[_0x3f23('0x37')]['offset']);}return _0x4b2a52['getTeams'](_0x1cb5f0);}})[_0x3f23('0x29')](function(_0x2bd71d){if(_0x2bd71d){return _0x2bd71d?{'count':_0x34349a,'rows':_0x2bd71d}:null;}})[_0x3f23('0x29')](respondWithResult(_0x49c6c3,null))[_0x3f23('0x4d')](handleError(_0x49c6c3,null));};exports[_0x3f23('0x6d')]=function(_0x4c2658,_0x95cc20,_0x34cf5e){var _0x17f352=_0x4c2658[_0x3f23('0x53')][_0x3f23('0x6e')];return db[_0x3f23('0x6c')][_0x3f23('0x4b')]({'where':{'id':_0x17f352},'attributes':['id'],'include':[{'model':db['User'],'as':_0x3f23('0x6f'),'attributes':['id',_0x3f23('0x31'),_0x3f23('0x70'),_0x3f23('0x71'),'interface'],'raw':!![]}]})[_0x3f23('0x29')](function(_0x8df3fb){if(_0x8df3fb){var _0x456051=_[_0x3f23('0x72')](_0x8df3fb,function(_0x5eb33c){var _0x5731eb=_0x5eb33c[_0x3f23('0x2a')]({'plain':!![]});return _0x5731eb[_0x3f23('0x6f')];});return db['WhatsappQueue']['find']({'where':{'id':_0x4c2658[_0x3f23('0x4f')]['id']}})[_0x3f23('0x29')](function(_0x4639f4){return db[_0x3f23('0x73')][_0x3f23('0x74')](function(_0x3eac5e){return _0x4639f4[_0x3f23('0x6d')](_0x17f352,{'transaction':_0x3eac5e})['then'](function(){return BPromise[_0x3f23('0x75')](_0x456051,function(_0x31fcc4){return db['UserWhatsappQueue']['findOrCreate']({'where':{'UserId':_0x31fcc4['id'],'WhatsappQueueId':_0x4c2658['params']['id']},'transaction':_0x3eac5e});});})['then'](function(){_0x456051[_0x3f23('0x76')](function(_0x2cf58e){socket[_0x3f23('0x77')](_0x3f23('0x78'),{'UserId':_0x2cf58e['id'],'WhatsappQueueId':_0x4639f4['id']});});});});});}})[_0x3f23('0x29')](respondWithStatusCode(_0x95cc20,null))[_0x3f23('0x4d')](handleError(_0x95cc20,null));};exports['removeTeams']=function(_0x2e0a23,_0x2a11c3,_0x5f18a2){return db[_0x3f23('0x6c')]['findAll']({'where':{'id':_0x2e0a23[_0x3f23('0x37')][_0x3f23('0x6e')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x3f23('0x6f'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2a11c3,null))[_0x3f23('0x29')](function(_0x579a9c){var _0xbbfec1=_[_0x3f23('0x33')](_0x579a9c,'id');var _0x5be57e=[];var _0x21de1a=[];var _0x50a990=squel[_0x3f23('0x79')]();_0x50a990['field'](_0x3f23('0x7a'))[_0x3f23('0x7b')](_0x3f23('0x7c'),'tq')[_0x3f23('0x7d')](_0x3f23('0x7e'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x3f23('0x45')](_0x3f23('0x7f'),_0x2e0a23['params']['id']);for(var _0x5a93ab=0x0;_0x5a93ab<_0x579a9c['length'];_0x5a93ab+=0x1){let _0x24af83=_0x579a9c[_0x5a93ab];for(var _0x2a3fcb=0x0;_0x2a3fcb<_0x24af83[_0x3f23('0x6f')][_0x3f23('0x3e')];_0x2a3fcb+=0x1){let _0x594dc9=_0x24af83[_0x3f23('0x6f')][_0x2a3fcb];var _0x42c3c2=_0x50a990[_0x3f23('0x80')]();_0x42c3c2['where'](_0x3f23('0x81'),_0x594dc9['id']);_0x21de1a[_0x3f23('0x82')](db[_0x3f23('0x73')][_0x3f23('0x37')](_0x42c3c2[_0x3f23('0x83')](),{'type':db[_0x3f23('0x73')]['QueryTypes'][_0x3f23('0x84')]})['then'](function(_0x2d13de){if(_0x2d13de[_0x3f23('0x3e')]===0x1){return _0x594dc9['id'];}else{var _0x3dd4ed=_[_0x3f23('0x85')](_[_0x3f23('0x33')](_0x2d13de,_0x3f23('0x86')),function(_0x1ca553){return _[_0x3f23('0x87')](_0xbbfec1,_0x1ca553);});if(_0x3dd4ed){return _0x594dc9['id'];}}}));}}return BPromise[_0x3f23('0x88')](_0x21de1a)[_0x3f23('0x29')](function(_0xadaca4){_0x5be57e=_(_0x5be57e)['union'](_0xadaca4)[_0x3f23('0x89')]()[_0x3f23('0x8a')]();return db[_0x3f23('0x34')][_0x3f23('0x51')]({'where':{'id':_0x2e0a23[_0x3f23('0x4f')]['id']}})['then'](function(_0x53ca9d){return db[_0x3f23('0x73')][_0x3f23('0x74')](function(_0x437559){return _0x53ca9d['removeTeams'](_0x2e0a23[_0x3f23('0x37')][_0x3f23('0x6e')],{'transaction':_0x437559})[_0x3f23('0x29')](function(){if(!_[_0x3f23('0x8b')](_0x5be57e)){return _0x53ca9d[_0x3f23('0x8c')](_0x5be57e,{'transaction':_0x437559});}})[_0x3f23('0x29')](function(){_0x5be57e[_0x3f23('0x76')](function(_0x522aa4){socket['emit'](_0x3f23('0x8d'),{'UserId':_0x522aa4,'WhatsappQueueId':_0x53ca9d['id']});});});});});});})['then'](respondWithStatusCode(_0x2a11c3,null))[_0x3f23('0x4d')](handleError(_0x2a11c3,null));};exports[_0x3f23('0x8e')]=function(_0x1a8449,_0x4ba59f,_0x3f37d6){return db[_0x3f23('0x34')][_0x3f23('0x51')]({'where':{'id':_0x1a8449[_0x3f23('0x4f')]['id']}})[_0x3f23('0x29')](handleEntityNotFound(_0x4ba59f,null))[_0x3f23('0x29')](function(_0x4608d7){if(_0x4608d7){return _0x4608d7['addAgents'](_0x1a8449[_0x3f23('0x53')][_0x3f23('0x6e')],_['omit'](_0x1a8449[_0x3f23('0x53')],[_0x3f23('0x6e'),'id'])||{})[_0x3f23('0x8f')](function(_0x1d1664){for(var _0x5b7682=0x0;_0x5b7682<_0x1a8449[_0x3f23('0x53')]['ids']['length'];_0x5b7682+=0x1){socket[_0x3f23('0x77')](_0x3f23('0x78'),{'UserId':Number(_0x1a8449['body'][_0x3f23('0x6e')][_0x5b7682]),'WhatsappQueueId':Number(_0x1a8449['params']['id'])});}return _0x1d1664;});}})[_0x3f23('0x29')](respondWithResult(_0x4ba59f,null))[_0x3f23('0x4d')](handleError(_0x4ba59f,null));};exports['removeAgents']=function(_0x3e39d4,_0x4fafe7,_0x3d101d){return db[_0x3f23('0x34')]['find']({'where':{'id':_0x3e39d4[_0x3f23('0x4f')]['id']}})[_0x3f23('0x29')](handleEntityNotFound(_0x4fafe7,null))[_0x3f23('0x29')](function(_0x4f5c3c){if(_0x4f5c3c){return _0x4f5c3c[_0x3f23('0x8c')](_0x3e39d4[_0x3f23('0x37')]['ids'])[_0x3f23('0x29')](function(){if(_['isArray'](_0x3e39d4[_0x3f23('0x37')][_0x3f23('0x6e')])){for(var _0x1d152d=0x0;_0x1d152d<_0x3e39d4[_0x3f23('0x37')][_0x3f23('0x6e')][_0x3f23('0x3e')];_0x1d152d+=0x1){socket[_0x3f23('0x77')](_0x3f23('0x8d'),{'UserId':Number(_0x3e39d4['query']['ids'][_0x1d152d]),'WhatsappQueueId':Number(_0x3e39d4[_0x3f23('0x4f')]['id'])});}}else{socket[_0x3f23('0x77')]('userWhatsappQueue:remove',{'UserId':Number(_0x3e39d4['query'][_0x3f23('0x6e')]),'WhatsappQueueId':Number(_0x3e39d4[_0x3f23('0x4f')]['id'])});}});}})['then'](respondWithStatusCode(_0x4fafe7,null))[_0x3f23('0x4d')](handleError(_0x4fafe7,null));};exports['getAgents']=function(_0x5b12f3,_0x28a41a,_0x4ea346){var _0x4d05fb={};var _0x5cd248={};var _0x499cd7;var _0xfc06aa;return db['WhatsappQueue'][_0x3f23('0x5d')]({'where':{'id':_0x5b12f3['params']['id']}})[_0x3f23('0x29')](handleEntityNotFound(_0x28a41a,null))[_0x3f23('0x29')](function(_0x128013){if(_0x128013){_0x499cd7=_0x128013;_0x5cd248['model']=_[_0x3f23('0x38')](db['User'][_0x3f23('0x50')]);_0x5cd248[_0x3f23('0x37')]=_[_0x3f23('0x38')](_0x5b12f3[_0x3f23('0x37')]);_0x5cd248[_0x3f23('0x39')]=_[_0x3f23('0x3a')](_0x5cd248[_0x3f23('0x3b')],_0x5cd248['query']);_0x4d05fb[_0x3f23('0x3c')]=_[_0x3f23('0x3a')](_0x5cd248[_0x3f23('0x3b')],qs['fields'](_0x5b12f3[_0x3f23('0x37')][_0x3f23('0x3d')]));_0x4d05fb['attributes']=_0x4d05fb[_0x3f23('0x3c')][_0x3f23('0x3e')]?_0x4d05fb['attributes']:_0x5cd248[_0x3f23('0x3b')];_0x4d05fb[_0x3f23('0x41')]=qs['sort'](_0x5b12f3[_0x3f23('0x37')][_0x3f23('0x42')]);_0x4d05fb['where']=qs[_0x3f23('0x39')](_[_0x3f23('0x43')](_0x5b12f3[_0x3f23('0x37')],_0x5cd248[_0x3f23('0x39')]));if(_0x5b12f3[_0x3f23('0x37')][_0x3f23('0x44')]){_0x4d05fb[_0x3f23('0x45')]=_[_0x3f23('0x46')](_0x4d05fb['where'],{'$or':_[_0x3f23('0x33')](_0x4d05fb[_0x3f23('0x3c')],function(_0x4290d2){var _0x1fceef={};_0x1fceef[_0x4290d2]={'$like':'%'+_0x5b12f3[_0x3f23('0x37')]['filter']+'%'};return _0x1fceef;})});}_0x4d05fb=_[_0x3f23('0x46')]({},_0x4d05fb,_0x5b12f3['options']);return _0x499cd7[_0x3f23('0x90')](_0x4d05fb);}})[_0x3f23('0x29')](function(_0x1b821d){if(_0x1b821d){_0xfc06aa=_0x1b821d[_0x3f23('0x3e')];if(!_0x5b12f3[_0x3f23('0x37')][_0x3f23('0x3f')](_0x3f23('0x5f'))){_0x4d05fb[_0x3f23('0x40')]=qs[_0x3f23('0x40')](_0x5b12f3[_0x3f23('0x37')][_0x3f23('0x40')]);_0x4d05fb['offset']=qs[_0x3f23('0x22')](_0x5b12f3['query'][_0x3f23('0x22')]);}return _0x499cd7[_0x3f23('0x90')](_0x4d05fb);}})[_0x3f23('0x29')](function(_0x4aec5c){if(_0x4aec5c){return _0x4aec5c?{'count':_0xfc06aa,'rows':_0x4aec5c}:null;}})[_0x3f23('0x29')](respondWithResult(_0x28a41a,null))[_0x3f23('0x4d')](handleError(_0x28a41a,null));}; \ No newline at end of file +var _0x7735=['nolimit','sort','filter','where','merge','type','includeAll','include','findAll','rows','catch','show','params','keys','intersection','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','order','pick','WhatsappQueueId','User','findAndCountAll','UserId','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','Agents','online','voicePause','interface','flatMap','sequelize','addTeams','each','UserWhatsappQueue','forEach','userWhatsappQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','union','compact','value','transaction','removeAgents','emit','userWhatsappQueue:remove','addAgents','omit','getAgents','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/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','localhost','./whatsappQueue.socket','register','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','save','update','then','destroy','get','WhatsappQueues','UserProfileResource','error','stack','name','index','map','WhatsappQueue','rawAttributes','fieldName','key','model','query','filters','attributes','fields','length','hasOwnProperty'];(function(_0x242d29,_0x106133){var _0x2212aa=function(_0x43a66f){while(--_0x43a66f){_0x242d29['push'](_0x242d29['shift']());}};_0x2212aa(++_0x106133);}(_0x7735,0x169));var _0x5773=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x7735[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5773('0x0'));var zipdir=require(_0x5773('0x1'));var jsonpatch=require(_0x5773('0x2'));var rp=require(_0x5773('0x3'));var moment=require(_0x5773('0x4'));var BPromise=require(_0x5773('0x5'));var Mustache=require(_0x5773('0x6'));var util=require(_0x5773('0x7'));var path=require(_0x5773('0x8'));var sox=require(_0x5773('0x9'));var csv=require(_0x5773('0xa'));var ejs=require(_0x5773('0xb'));var fs=require('fs');var fs_extra=require(_0x5773('0xc'));var _=require(_0x5773('0xd'));var squel=require(_0x5773('0xe'));var crypto=require('crypto');var jsforce=require(_0x5773('0xf'));var deskjs=require(_0x5773('0x10'));var toCsv=require(_0x5773('0xa'));var querystring=require(_0x5773('0x11'));var Papa=require(_0x5773('0x12'));var Redis=require(_0x5773('0x13'));var authService=require(_0x5773('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x5773('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5773('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x5773('0x17'));var licenseUtil=require(_0x5773('0x18'));var db=require('../../mysqldb')['db'];config[_0x5773('0x19')]=_[_0x5773('0x1a')](config['redis'],{'host':_0x5773('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5773('0x19')]));require(_0x5773('0x1c'))[_0x5773('0x1d')](socket);function respondWithStatusCode(_0x1058a1,_0x37b930){_0x37b930=_0x37b930||0xcc;return function(_0x484649){if(_0x484649){return _0x1058a1[_0x5773('0x1e')](_0x37b930);}return _0x1058a1['status'](_0x37b930)[_0x5773('0x1f')]();};}function respondWithResult(_0x57a347,_0x4da4d7){_0x4da4d7=_0x4da4d7||0xc8;return function(_0x3d9db0){if(_0x3d9db0){return _0x57a347[_0x5773('0x20')](_0x4da4d7)[_0x5773('0x21')](_0x3d9db0);}};}function respondWithFilteredResult(_0x5e4888,_0x59bb60){return function(_0x4dd1e3){if(_0x4dd1e3){var _0x2969b7=typeof _0x59bb60[_0x5773('0x22')]==='undefined'&&typeof _0x59bb60[_0x5773('0x23')]===_0x5773('0x24');var _0x13ef26=_0x4dd1e3['count'];var _0x51c51a=_0x2969b7?0x0:_0x59bb60[_0x5773('0x22')];var _0x2299d0=_0x2969b7?_0x4dd1e3[_0x5773('0x25')]:_0x59bb60[_0x5773('0x22')]+_0x59bb60[_0x5773('0x23')];var _0x5a9f4f;if(_0x2299d0>=_0x13ef26){_0x2299d0=_0x13ef26;_0x5a9f4f=0xc8;}else{_0x5a9f4f=0xce;}_0x5e4888[_0x5773('0x20')](_0x5a9f4f);return _0x5e4888['set'](_0x5773('0x26'),_0x51c51a+'-'+_0x2299d0+'/'+_0x13ef26)[_0x5773('0x21')](_0x4dd1e3);}return null;};}function patchUpdates(_0x1c9c96){return function(_0x308f49){try{jsonpatch['apply'](_0x308f49,_0x1c9c96,!![]);}catch(_0x6104a8){return BPromise['reject'](_0x6104a8);}return _0x308f49[_0x5773('0x27')]();};}function saveUpdates(_0x54e645,_0x1ad14){return function(_0x19f329){if(_0x19f329){return _0x19f329[_0x5773('0x28')](_0x54e645)[_0x5773('0x29')](function(_0x2efacc){return _0x2efacc;});}return null;};}function removeEntity(_0x293ef2,_0x4ffce7){return function(_0x2542e8){if(_0x2542e8){return _0x2542e8[_0x5773('0x2a')]()[_0x5773('0x29')](function(){var _0x43e60c=_0x2542e8[_0x5773('0x2b')]({'plain':!![]});var _0x4d1332=_0x5773('0x2c');return db[_0x5773('0x2d')][_0x5773('0x2a')]({'where':{'type':_0x4d1332,'resourceId':_0x43e60c['id']}})['then'](function(){return _0x2542e8;});})[_0x5773('0x29')](function(){_0x293ef2[_0x5773('0x20')](0xcc)[_0x5773('0x1f')]();});}};}function handleEntityNotFound(_0x572d09,_0x31bfcb){return function(_0xaab3f0){if(!_0xaab3f0){_0x572d09[_0x5773('0x1e')](0x194);}return _0xaab3f0;};}function handleError(_0x31ef44,_0x1aee42){_0x1aee42=_0x1aee42||0x1f4;return function(_0x57d249){logger[_0x5773('0x2e')](_0x57d249[_0x5773('0x2f')]);if(_0x57d249[_0x5773('0x30')]){delete _0x57d249[_0x5773('0x30')];}_0x31ef44[_0x5773('0x20')](_0x1aee42)['send'](_0x57d249);};}exports[_0x5773('0x31')]=function(_0x689bc0,_0x247c4f){var _0x48ce90={},_0x27c2d6={},_0x4af0fa={'count':0x0,'rows':[]};var _0x27325d=_[_0x5773('0x32')](db[_0x5773('0x33')][_0x5773('0x34')],function(_0x10d47b){return{'name':_0x10d47b[_0x5773('0x35')],'type':_0x10d47b['type'][_0x5773('0x36')]};});_0x27c2d6[_0x5773('0x37')]=_[_0x5773('0x32')](_0x27325d,_0x5773('0x30'));_0x27c2d6[_0x5773('0x38')]=_['keys'](_0x689bc0[_0x5773('0x38')]);_0x27c2d6[_0x5773('0x39')]=_['intersection'](_0x27c2d6['model'],_0x27c2d6['query']);_0x48ce90[_0x5773('0x3a')]=_['intersection'](_0x27c2d6[_0x5773('0x37')],qs[_0x5773('0x3b')](_0x689bc0[_0x5773('0x38')]['fields']));_0x48ce90['attributes']=_0x48ce90[_0x5773('0x3a')][_0x5773('0x3c')]?_0x48ce90[_0x5773('0x3a')]:_0x27c2d6[_0x5773('0x37')];if(!_0x689bc0[_0x5773('0x38')][_0x5773('0x3d')](_0x5773('0x3e'))){_0x48ce90['limit']=qs[_0x5773('0x23')](_0x689bc0[_0x5773('0x38')][_0x5773('0x23')]);_0x48ce90[_0x5773('0x22')]=qs[_0x5773('0x22')](_0x689bc0['query'][_0x5773('0x22')]);}_0x48ce90['order']=qs[_0x5773('0x3f')](_0x689bc0[_0x5773('0x38')][_0x5773('0x3f')]);_0x48ce90['where']=qs[_0x5773('0x39')](_['pick'](_0x689bc0['query'],_0x27c2d6[_0x5773('0x39')]),_0x27325d);if(_0x689bc0['query'][_0x5773('0x40')]){_0x48ce90[_0x5773('0x41')]=_[_0x5773('0x42')](_0x48ce90[_0x5773('0x41')],{'$or':_[_0x5773('0x32')](_0x27325d,function(_0x76c198){if(_0x76c198[_0x5773('0x43')]!=='VIRTUAL'){var _0x47739b={};_0x47739b[_0x76c198[_0x5773('0x30')]]={'$like':'%'+_0x689bc0[_0x5773('0x38')][_0x5773('0x40')]+'%'};return _0x47739b;}})});}_0x48ce90=_[_0x5773('0x42')]({},_0x48ce90,_0x689bc0['options']);var _0x11579b={'where':_0x48ce90['where']};return db[_0x5773('0x33')]['count'](_0x11579b)[_0x5773('0x29')](function(_0x343971){_0x4af0fa[_0x5773('0x25')]=_0x343971;if(_0x689bc0['query'][_0x5773('0x44')]){_0x48ce90[_0x5773('0x45')]=[{'all':!![]}];}return db['WhatsappQueue'][_0x5773('0x46')](_0x48ce90);})[_0x5773('0x29')](function(_0x253f40){_0x4af0fa[_0x5773('0x47')]=_0x253f40;return _0x4af0fa;})[_0x5773('0x29')](respondWithFilteredResult(_0x247c4f,_0x48ce90))[_0x5773('0x48')](handleError(_0x247c4f,null));};exports[_0x5773('0x49')]=function(_0x36ba1d,_0xa581d9){var _0x3f37e8={'raw':!![],'where':{'id':_0x36ba1d[_0x5773('0x4a')]['id']}},_0xddba69={};_0xddba69[_0x5773('0x37')]=_[_0x5773('0x4b')](db[_0x5773('0x33')][_0x5773('0x34')]);_0xddba69[_0x5773('0x38')]=_[_0x5773('0x4b')](_0x36ba1d[_0x5773('0x38')]);_0xddba69[_0x5773('0x39')]=_[_0x5773('0x4c')](_0xddba69[_0x5773('0x37')],_0xddba69[_0x5773('0x38')]);_0x3f37e8[_0x5773('0x3a')]=_['intersection'](_0xddba69['model'],qs[_0x5773('0x3b')](_0x36ba1d[_0x5773('0x38')][_0x5773('0x3b')]));_0x3f37e8[_0x5773('0x3a')]=_0x3f37e8[_0x5773('0x3a')]['length']?_0x3f37e8[_0x5773('0x3a')]:_0xddba69['model'];if(_0x36ba1d[_0x5773('0x38')]['includeAll']){_0x3f37e8['include']=[{'all':!![]}];}_0x3f37e8=_['merge']({},_0x3f37e8,_0x36ba1d[_0x5773('0x4d')]);return db['WhatsappQueue'][_0x5773('0x4e')](_0x3f37e8)[_0x5773('0x29')](handleEntityNotFound(_0xa581d9,null))[_0x5773('0x29')](respondWithResult(_0xa581d9,null))[_0x5773('0x48')](handleError(_0xa581d9,null));};exports['create']=function(_0x343ce8,_0x3f6caf){return db[_0x5773('0x33')][_0x5773('0x4f')](_0x343ce8[_0x5773('0x50')],{})[_0x5773('0x29')](function(_0x3dd2a3){var _0x110671=_0x343ce8[_0x5773('0x51')][_0x5773('0x2b')]({'plain':!![]});if(!_0x110671)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x110671[_0x5773('0x52')]===_0x5773('0x51')){var _0x28979c=_0x3dd2a3['get']({'plain':!![]});var _0x208a48=_0x5773('0x2c');return db[_0x5773('0x53')][_0x5773('0x4e')]({'where':{'name':_0x208a48,'userProfileId':_0x110671[_0x5773('0x54')]},'raw':!![]})['then'](function(_0x3b602c){if(_0x3b602c&&_0x3b602c[_0x5773('0x55')]===0x0){return db[_0x5773('0x2d')][_0x5773('0x4f')]({'name':_0x28979c[_0x5773('0x30')],'resourceId':_0x28979c['id'],'type':_0x3b602c['name'],'sectionId':_0x3b602c['id']},{})['then'](function(){return _0x3dd2a3;});}else{return _0x3dd2a3;}})['catch'](function(_0x19c452){logger[_0x5773('0x2e')](_0x5773('0x56'),_0x19c452);throw _0x19c452;});}return _0x3dd2a3;})[_0x5773('0x29')](respondWithResult(_0x3f6caf,0xc9))[_0x5773('0x48')](handleError(_0x3f6caf,null));};exports[_0x5773('0x28')]=function(_0x13087f,_0x3e807b){if(_0x13087f[_0x5773('0x50')]['id']){delete _0x13087f[_0x5773('0x50')]['id'];}return db[_0x5773('0x33')][_0x5773('0x4e')]({'where':{'id':_0x13087f[_0x5773('0x4a')]['id']}})[_0x5773('0x29')](handleEntityNotFound(_0x3e807b,null))[_0x5773('0x29')](saveUpdates(_0x13087f[_0x5773('0x50')],null))['then'](respondWithResult(_0x3e807b,null))['catch'](handleError(_0x3e807b,null));};exports[_0x5773('0x2a')]=function(_0x5cb103,_0x178045){return db[_0x5773('0x33')]['find']({'where':{'id':_0x5cb103[_0x5773('0x4a')]['id']}})['then'](handleEntityNotFound(_0x178045,null))[_0x5773('0x29')](removeEntity(_0x178045,null))[_0x5773('0x48')](handleError(_0x178045,null));};exports[_0x5773('0x57')]=function(_0x4a4807,_0x19e2b8){return db[_0x5773('0x33')][_0x5773('0x57')]()['then'](respondWithResult(_0x19e2b8,null))[_0x5773('0x48')](handleError(_0x19e2b8,null));};exports[_0x5773('0x58')]=function(_0x51cd9c,_0xf38f7f,_0x4cdfbd){var _0xac49bb={'raw':!![],'where':{}},_0x1ce9bc={},_0x393260;return db[_0x5773('0x33')][_0x5773('0x59')]({'where':{'id':_0x51cd9c['params']['id']}})['then'](handleEntityNotFound(_0xf38f7f,null))['then'](function(_0x5c7160){if(_0x5c7160){_0x393260=_0x5c7160[_0x5773('0x2b')]({'plain':!![]});_0x1ce9bc['model']=_[_0x5773('0x4b')](db['UserWhatsappQueue'][_0x5773('0x34')]);_0x1ce9bc[_0x5773('0x38')]=_['keys'](_0x51cd9c[_0x5773('0x38')]);_0x1ce9bc['filters']=_[_0x5773('0x4c')](_0x1ce9bc[_0x5773('0x37')],_0x1ce9bc[_0x5773('0x38')]);_0xac49bb[_0x5773('0x3a')]=_[_0x5773('0x4c')](_0x1ce9bc[_0x5773('0x37')],qs[_0x5773('0x3b')](_0x51cd9c[_0x5773('0x38')][_0x5773('0x3b')]));_0xac49bb[_0x5773('0x3a')]=_0xac49bb[_0x5773('0x3a')]['length']?_0xac49bb['attributes']:_0x1ce9bc['model'];if(!_0x51cd9c['query'][_0x5773('0x3d')]('nolimit')){_0xac49bb[_0x5773('0x23')]=qs[_0x5773('0x23')](_0x51cd9c[_0x5773('0x38')][_0x5773('0x23')]);_0xac49bb[_0x5773('0x22')]=qs['offset'](_0x51cd9c[_0x5773('0x38')][_0x5773('0x22')]);}_0xac49bb[_0x5773('0x5a')]=qs[_0x5773('0x3f')](_0x51cd9c[_0x5773('0x38')][_0x5773('0x3f')]);_0xac49bb[_0x5773('0x41')]=qs[_0x5773('0x39')](_[_0x5773('0x5b')](_0x51cd9c[_0x5773('0x38')],_0x1ce9bc[_0x5773('0x39')]));_0xac49bb[_0x5773('0x41')][_0x5773('0x5c')]=_0x5c7160['id'];if(_0x51cd9c[_0x5773('0x38')][_0x5773('0x40')]){_0xac49bb[_0x5773('0x41')]=_[_0x5773('0x42')](_0xac49bb['where'],{'$or':_[_0x5773('0x32')](_0xac49bb[_0x5773('0x3a')],function(_0x135faa){var _0xbf907c={};_0xbf907c[_0x135faa]={'$like':'%'+_0x51cd9c['query'][_0x5773('0x40')]+'%'};return _0xbf907c;})});}_0xac49bb=_[_0x5773('0x42')]({},_0xac49bb,_0x51cd9c[_0x5773('0x4d')]);return db['UserWhatsappQueue'][_0x5773('0x46')](_0xac49bb);}})['then'](function(_0x559a8b){if(_0x559a8b){return db[_0x5773('0x5d')][_0x5773('0x5e')]({'where':{'id':_[_0x5773('0x32')](_0x559a8b,_0x5773('0x5f')),'role':'agent'},'attributes':['id',_0x5773('0x30'),_0x5773('0x60'),_0x5773('0x61'),_0x5773('0x62')]});}})['then'](function(_0x393077){if(_0x393077){return{'count':_0x393077[_0x5773('0x25')],'rows':_[_0x5773('0x32')](_0x393077[_0x5773('0x47')],function(_0x28f49c){return{'membername':_0x28f49c[_0x5773('0x30')],'UserId':_0x28f49c['id'],'queue_name':_0x393260[_0x5773('0x30')],'WhatsappQueueId':_0x393260['id'],'interface':util[_0x5773('0x63')](_0x5773('0x64'),_0x5773('0x65'),_0x28f49c[_0x5773('0x30')]),'penalty':0x0,'paused':_0x28f49c['whatsappPause'],'createdAt':_0x28f49c[_0x5773('0x62')],'updatedAt':_0x28f49c['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0xf38f7f,_0xac49bb))['catch'](handleError(_0xf38f7f,null));};exports[_0x5773('0x66')]=function(_0xd5633c,_0x1b539f,_0x53f26f){var _0x19e6b8={};var _0x40aca8={};var _0x20f064;var _0x595024;return db[_0x5773('0x33')]['findOne']({'where':{'id':_0xd5633c[_0x5773('0x4a')]['id']}})[_0x5773('0x29')](handleEntityNotFound(_0x1b539f,null))['then'](function(_0x18701c){if(_0x18701c){_0x20f064=_0x18701c;_0x40aca8[_0x5773('0x37')]=_[_0x5773('0x4b')](db['Team'][_0x5773('0x34')]);_0x40aca8[_0x5773('0x38')]=_[_0x5773('0x4b')](_0xd5633c[_0x5773('0x38')]);_0x40aca8[_0x5773('0x39')]=_[_0x5773('0x4c')](_0x40aca8[_0x5773('0x37')],_0x40aca8[_0x5773('0x38')]);_0x19e6b8[_0x5773('0x3a')]=_['intersection'](_0x40aca8[_0x5773('0x37')],qs[_0x5773('0x3b')](_0xd5633c[_0x5773('0x38')][_0x5773('0x3b')]));_0x19e6b8['attributes']=_0x19e6b8[_0x5773('0x3a')][_0x5773('0x3c')]?_0x19e6b8['attributes']:_0x40aca8[_0x5773('0x37')];_0x19e6b8['order']=qs[_0x5773('0x3f')](_0xd5633c['query']['sort']);_0x19e6b8['where']=qs[_0x5773('0x39')](_['pick'](_0xd5633c[_0x5773('0x38')],_0x40aca8[_0x5773('0x39')]));if(_0xd5633c[_0x5773('0x38')][_0x5773('0x40')]){_0x19e6b8[_0x5773('0x41')]=_[_0x5773('0x42')](_0x19e6b8[_0x5773('0x41')],{'$or':_[_0x5773('0x32')](_0x19e6b8[_0x5773('0x3a')],function(_0x230107){var _0x5f568f={};_0x5f568f[_0x230107]={'$like':'%'+_0xd5633c[_0x5773('0x38')][_0x5773('0x40')]+'%'};return _0x5f568f;})});}_0x19e6b8=_['merge']({},_0x19e6b8,_0xd5633c[_0x5773('0x4d')]);return _0x20f064[_0x5773('0x66')](_0x19e6b8);}})[_0x5773('0x29')](function(_0x1608e8){if(_0x1608e8){_0x595024=_0x1608e8[_0x5773('0x3c')];if(!_0xd5633c['query'][_0x5773('0x3d')](_0x5773('0x3e'))){_0x19e6b8[_0x5773('0x23')]=qs['limit'](_0xd5633c[_0x5773('0x38')]['limit']);_0x19e6b8[_0x5773('0x22')]=qs[_0x5773('0x22')](_0xd5633c[_0x5773('0x38')][_0x5773('0x22')]);}return _0x20f064['getTeams'](_0x19e6b8);}})[_0x5773('0x29')](function(_0x46b33a){if(_0x46b33a){return _0x46b33a?{'count':_0x595024,'rows':_0x46b33a}:null;}})['then'](respondWithResult(_0x1b539f,null))[_0x5773('0x48')](handleError(_0x1b539f,null));};exports['addTeams']=function(_0x375fa2,_0x2e786c,_0x4407cc){var _0xe960b6=_0x375fa2[_0x5773('0x50')]['ids'];return db[_0x5773('0x67')][_0x5773('0x46')]({'where':{'id':_0xe960b6},'attributes':['id'],'include':[{'model':db[_0x5773('0x5d')],'as':_0x5773('0x68'),'attributes':['id',_0x5773('0x30'),_0x5773('0x69'),_0x5773('0x6a'),_0x5773('0x6b')],'raw':!![]}]})['then'](function(_0x4f8773){if(_0x4f8773){var _0x918b0=_[_0x5773('0x6c')](_0x4f8773,function(_0x26ff3a){var _0x107db5=_0x26ff3a[_0x5773('0x2b')]({'plain':!![]});return _0x107db5[_0x5773('0x68')];});return db[_0x5773('0x33')]['find']({'where':{'id':_0x375fa2['params']['id']}})[_0x5773('0x29')](function(_0x45de0b){return db[_0x5773('0x6d')]['transaction'](function(_0x575bdf){return _0x45de0b[_0x5773('0x6e')](_0xe960b6,{'transaction':_0x575bdf})[_0x5773('0x29')](function(){return BPromise[_0x5773('0x6f')](_0x918b0,function(_0x48d6ab){return db[_0x5773('0x70')]['findOrCreate']({'where':{'UserId':_0x48d6ab['id'],'WhatsappQueueId':_0x375fa2[_0x5773('0x4a')]['id']},'transaction':_0x575bdf});});})['then'](function(){_0x918b0[_0x5773('0x71')](function(_0x5a2036){socket['emit'](_0x5773('0x72'),{'UserId':_0x5a2036['id'],'WhatsappQueueId':_0x45de0b['id']});});});});});}})[_0x5773('0x29')](respondWithStatusCode(_0x2e786c,null))[_0x5773('0x48')](handleError(_0x2e786c,null));};exports[_0x5773('0x73')]=function(_0x50bcd5,_0x36a22d,_0x35c393){return db[_0x5773('0x67')][_0x5773('0x46')]({'where':{'id':_0x50bcd5['query'][_0x5773('0x74')]},'attributes':['id'],'include':[{'model':db[_0x5773('0x5d')],'as':_0x5773('0x68'),'attributes':['id'],'raw':!![]}]})[_0x5773('0x29')](handleEntityNotFound(_0x36a22d,null))[_0x5773('0x29')](function(_0x1050cd){var _0xee8bcb=_[_0x5773('0x32')](_0x1050cd,'id');var _0x2dd52c=[];var _0x534409=[];var _0x1d62ef=squel[_0x5773('0x75')]();_0x1d62ef[_0x5773('0x76')](_0x5773('0x77'))[_0x5773('0x78')](_0x5773('0x79'),'tq')[_0x5773('0x7a')](_0x5773('0x7b'),'ut',_0x5773('0x7c'))[_0x5773('0x41')](_0x5773('0x7d'),_0x50bcd5['params']['id']);for(var _0x588e47=0x0;_0x588e47<_0x1050cd[_0x5773('0x3c')];_0x588e47+=0x1){let _0x4ea3b2=_0x1050cd[_0x588e47];for(var _0x4e32b6=0x0;_0x4e32b6<_0x4ea3b2[_0x5773('0x68')][_0x5773('0x3c')];_0x4e32b6+=0x1){let _0x244213=_0x4ea3b2[_0x5773('0x68')][_0x4e32b6];var _0x1b086c=_0x1d62ef['clone']();_0x1b086c['where'](_0x5773('0x7e'),_0x244213['id']);_0x534409['push'](db['sequelize']['query'](_0x1b086c[_0x5773('0x7f')](),{'type':db[_0x5773('0x6d')][_0x5773('0x80')]['SELECT']})[_0x5773('0x29')](function(_0xb4f3c7){if(_0xb4f3c7[_0x5773('0x3c')]===0x1){return _0x244213['id'];}else{var _0x85bc00=_[_0x5773('0x81')](_[_0x5773('0x32')](_0xb4f3c7,_0x5773('0x82')),function(_0x287b4b){return _['includes'](_0xee8bcb,_0x287b4b);});if(_0x85bc00){return _0x244213['id'];}}}));}}return BPromise['all'](_0x534409)[_0x5773('0x29')](function(_0x2d0ede){_0x2dd52c=_(_0x2dd52c)[_0x5773('0x83')](_0x2d0ede)[_0x5773('0x84')]()[_0x5773('0x85')]();return db[_0x5773('0x33')]['find']({'where':{'id':_0x50bcd5['params']['id']}})['then'](function(_0x32946c){return db[_0x5773('0x6d')][_0x5773('0x86')](function(_0x8f9ad1){return _0x32946c[_0x5773('0x73')](_0x50bcd5[_0x5773('0x38')][_0x5773('0x74')],{'transaction':_0x8f9ad1})['then'](function(){if(!_['isEmpty'](_0x2dd52c)){return _0x32946c[_0x5773('0x87')](_0x2dd52c,{'transaction':_0x8f9ad1});}})[_0x5773('0x29')](function(){_0x2dd52c[_0x5773('0x71')](function(_0x1970cb){socket[_0x5773('0x88')](_0x5773('0x89'),{'UserId':_0x1970cb,'WhatsappQueueId':_0x32946c['id']});});});});});});})['then'](respondWithStatusCode(_0x36a22d,null))['catch'](handleError(_0x36a22d,null));};exports[_0x5773('0x8a')]=function(_0x3cc61b,_0x261cd0,_0x53217f){return db[_0x5773('0x33')]['find']({'where':{'id':_0x3cc61b[_0x5773('0x4a')]['id']}})['then'](handleEntityNotFound(_0x261cd0,null))[_0x5773('0x29')](function(_0x225095){if(_0x225095){return _0x225095[_0x5773('0x8a')](_0x3cc61b[_0x5773('0x50')][_0x5773('0x74')],_[_0x5773('0x8b')](_0x3cc61b['body'],[_0x5773('0x74'),'id'])||{})['spread'](function(_0x3ffd29){for(var _0x5e9450=0x0;_0x5e9450<_0x3cc61b[_0x5773('0x50')][_0x5773('0x74')][_0x5773('0x3c')];_0x5e9450+=0x1){socket[_0x5773('0x88')](_0x5773('0x72'),{'UserId':Number(_0x3cc61b['body'][_0x5773('0x74')][_0x5e9450]),'WhatsappQueueId':Number(_0x3cc61b['params']['id'])});}return _0x3ffd29;});}})['then'](respondWithResult(_0x261cd0,null))['catch'](handleError(_0x261cd0,null));};exports[_0x5773('0x87')]=function(_0x376b7e,_0x473382,_0x35a06e){return db[_0x5773('0x33')]['find']({'where':{'id':_0x376b7e[_0x5773('0x4a')]['id']}})[_0x5773('0x29')](handleEntityNotFound(_0x473382,null))[_0x5773('0x29')](function(_0x55e19e){if(_0x55e19e){return _0x55e19e[_0x5773('0x87')](_0x376b7e[_0x5773('0x38')]['ids'])[_0x5773('0x29')](function(){if(_['isArray'](_0x376b7e['query']['ids'])){for(var _0x500ac2=0x0;_0x500ac2<_0x376b7e[_0x5773('0x38')][_0x5773('0x74')][_0x5773('0x3c')];_0x500ac2+=0x1){socket[_0x5773('0x88')](_0x5773('0x89'),{'UserId':Number(_0x376b7e['query'][_0x5773('0x74')][_0x500ac2]),'WhatsappQueueId':Number(_0x376b7e['params']['id'])});}}else{socket[_0x5773('0x88')](_0x5773('0x89'),{'UserId':Number(_0x376b7e[_0x5773('0x38')][_0x5773('0x74')]),'WhatsappQueueId':Number(_0x376b7e[_0x5773('0x4a')]['id'])});}});}})[_0x5773('0x29')](respondWithStatusCode(_0x473382,null))[_0x5773('0x48')](handleError(_0x473382,null));};exports[_0x5773('0x8c')]=function(_0x55b675,_0x5b9eef,_0x324023){var _0x504b2e={};var _0xa3e061={};var _0x25bb1b;var _0x2b2412;return db[_0x5773('0x33')][_0x5773('0x59')]({'where':{'id':_0x55b675[_0x5773('0x4a')]['id']}})[_0x5773('0x29')](handleEntityNotFound(_0x5b9eef,null))[_0x5773('0x29')](function(_0x96b323){if(_0x96b323){_0x25bb1b=_0x96b323;_0xa3e061['model']=_['keys'](db[_0x5773('0x5d')][_0x5773('0x34')]);_0xa3e061['query']=_['keys'](_0x55b675[_0x5773('0x38')]);_0xa3e061[_0x5773('0x39')]=_['intersection'](_0xa3e061[_0x5773('0x37')],_0xa3e061['query']);_0x504b2e['attributes']=_[_0x5773('0x4c')](_0xa3e061['model'],qs[_0x5773('0x3b')](_0x55b675['query']['fields']));_0x504b2e[_0x5773('0x3a')]=_0x504b2e[_0x5773('0x3a')][_0x5773('0x3c')]?_0x504b2e[_0x5773('0x3a')]:_0xa3e061[_0x5773('0x37')];_0x504b2e[_0x5773('0x5a')]=qs[_0x5773('0x3f')](_0x55b675['query'][_0x5773('0x3f')]);_0x504b2e[_0x5773('0x41')]=qs[_0x5773('0x39')](_[_0x5773('0x5b')](_0x55b675['query'],_0xa3e061[_0x5773('0x39')]));if(_0x55b675[_0x5773('0x38')][_0x5773('0x40')]){_0x504b2e[_0x5773('0x41')]=_[_0x5773('0x42')](_0x504b2e['where'],{'$or':_[_0x5773('0x32')](_0x504b2e[_0x5773('0x3a')],function(_0x30c671){var _0x3080fa={};_0x3080fa[_0x30c671]={'$like':'%'+_0x55b675[_0x5773('0x38')][_0x5773('0x40')]+'%'};return _0x3080fa;})});}_0x504b2e=_['merge']({},_0x504b2e,_0x55b675[_0x5773('0x4d')]);return _0x25bb1b['getAgents'](_0x504b2e);}})[_0x5773('0x29')](function(_0x4ce44e){if(_0x4ce44e){_0x2b2412=_0x4ce44e[_0x5773('0x3c')];if(!_0x55b675[_0x5773('0x38')]['hasOwnProperty'](_0x5773('0x3e'))){_0x504b2e[_0x5773('0x23')]=qs['limit'](_0x55b675['query']['limit']);_0x504b2e[_0x5773('0x22')]=qs[_0x5773('0x22')](_0x55b675[_0x5773('0x38')][_0x5773('0x22')]);}return _0x25bb1b[_0x5773('0x8c')](_0x504b2e);}})[_0x5773('0x29')](function(_0x808c8e){if(_0x808c8e){return _0x808c8e?{'count':_0x2b2412,'rows':_0x808c8e}:null;}})[_0x5773('0x29')](respondWithResult(_0x5b9eef,null))['catch'](handleError(_0x5b9eef,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 323acea..ec1d8a2 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 _0x5551=['WhatsappQueue','setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x5b90b6,_0x60eff5){var _0x166130=function(_0x2d640e){while(--_0x2d640e){_0x5b90b6['push'](_0x5b90b6['shift']());}};_0x166130(++_0x60eff5);}(_0x5551,0x10c));var _0x1555=function(_0xe76486,_0x4fa592){_0xe76486=_0xe76486-0x0;var _0x412b8c=_0x5551[_0xe76486];return _0x412b8c;};'use strict';var EventEmitter=require(_0x1555('0x0'));var WhatsappQueue=require(_0x1555('0x1'))['db'][_0x1555('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x1555('0x3')](0x0);var events={'afterCreate':_0x1555('0x4'),'afterUpdate':_0x1555('0x5'),'afterDestroy':_0x1555('0x6')};function emitEvent(_0x5166a8){return function(_0x481bad,_0x5153fe,_0x357437){WhatsappQueueEvents[_0x1555('0x7')](_0x5166a8+':'+_0x481bad['id'],_0x481bad);WhatsappQueueEvents[_0x1555('0x7')](_0x5166a8,_0x481bad);_0x357437(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x1555('0x8')](e,emitEvent(event));}}module[_0x1555('0x9')]=WhatsappQueueEvents; \ No newline at end of file +var _0xaddd=['setMaxListeners','save','update','emit','exports','../../mysqldb'];(function(_0x42ba3b,_0x355441){var _0x17634b=function(_0xb7f687){while(--_0xb7f687){_0x42ba3b['push'](_0x42ba3b['shift']());}};_0x17634b(++_0x355441);}(_0xaddd,0xfb));var _0xdadd=function(_0x127a60,_0x37f33a){_0x127a60=_0x127a60-0x0;var _0xc1f6a3=_0xaddd[_0x127a60];return _0xc1f6a3;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0xdadd('0x0'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xdadd('0x1')](0x0);var events={'afterCreate':_0xdadd('0x2'),'afterUpdate':_0xdadd('0x3'),'afterDestroy':'remove'};function emitEvent(_0x170162){return function(_0x327567,_0x210fbc,_0x5a7459){WhatsappQueueEvents[_0xdadd('0x4')](_0x170162+':'+_0x327567['id'],_0x327567);WhatsappQueueEvents[_0xdadd('0x4')](_0x170162,_0x327567);_0x5a7459(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0xdadd('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 9645b64..3c1c630 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 _0xab6d=['request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','define','WhatsappQueue','whatsapp_queues','lodash','util','api','moment','bluebird'];(function(_0x27c7b7,_0x3ac29c){var _0x22e7d5=function(_0x1a5494){while(--_0x1a5494){_0x27c7b7['push'](_0x27c7b7['shift']());}};_0x22e7d5(++_0x3ac29c);}(_0xab6d,0x97));var _0xdab6=function(_0x3883d4,_0x169286){_0x3883d4=_0x3883d4-0x0;var _0x4385d7=_0xab6d[_0x3883d4];return _0x4385d7;};'use strict';var _=require(_0xdab6('0x0'));var util=require(_0xdab6('0x1'));var logger=require('../../config/logger')(_0xdab6('0x2'));var moment=require(_0xdab6('0x3'));var BPromise=require(_0xdab6('0x4'));var rp=require(_0xdab6('0x5'));var fs=require('fs');var path=require(_0xdab6('0x6'));var rimraf=require(_0xdab6('0x7'));var config=require(_0xdab6('0x8'));var attributes=require(_0xdab6('0x9'));module['exports']=function(_0x2df7f7,_0x1c4914){return _0x2df7f7[_0xdab6('0xa')](_0xdab6('0xb'),attributes,{'tableName':_0xdab6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a77=['WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','./whatsappQueue.attributes'];(function(_0x32d6fd,_0x2b6541){var _0x548066=function(_0x45798f){while(--_0x45798f){_0x32d6fd['push'](_0x32d6fd['shift']());}};_0x548066(++_0x2b6541);}(_0x7a77,0x14c));var _0x77a7=function(_0x81ca57,_0x307808){_0x81ca57=_0x81ca57-0x0;var _0x1d371b=_0x7a77[_0x81ca57];return _0x1d371b;};'use strict';var _=require(_0x77a7('0x0'));var util=require(_0x77a7('0x1'));var logger=require(_0x77a7('0x2'))('api');var moment=require(_0x77a7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x77a7('0x4'));var rimraf=require(_0x77a7('0x5'));var config=require(_0x77a7('0x6'));var attributes=require(_0x77a7('0x7'));module['exports']=function(_0x420675,_0x40be76){return _0x420675['define'](_0x77a7('0x8'),attributes,{'tableName':_0x77a7('0x9'),'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 f06e04e..1dd8acf 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 _0x4e97=['raw','where','attributes','include','map','model','ShowWhatsappQueue','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','defaults','socket.io-emitter','redis','./whatsappQueue.socket','register','request','then','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetWhatsappQueue','WhatsappQueue','options'];(function(_0x41e21a,_0x4169b7){var _0x36604c=function(_0x213eeb){while(--_0x213eeb){_0x41e21a['push'](_0x41e21a['shift']());}};_0x36604c(++_0x4169b7);}(_0x4e97,0x148));var _0x74e9=function(_0x451d53,_0x3c657d){_0x451d53=_0x451d53-0x0;var _0x29087f=_0x4e97[_0x451d53];return _0x29087f;};'use strict';var _=require('lodash');var util=require(_0x74e9('0x0'));var moment=require(_0x74e9('0x1'));var BPromise=require(_0x74e9('0x2'));var rs=require(_0x74e9('0x3'));var fs=require('fs');var Redis=require(_0x74e9('0x4'));var db=require(_0x74e9('0x5'))['db'];var utils=require(_0x74e9('0x6'));var logger=require(_0x74e9('0x7'))(_0x74e9('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x74e9('0x9')][_0x74e9('0xa')]({'port':0x232a});config['redis']=_[_0x74e9('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x74e9('0xc'))(new Redis(config[_0x74e9('0xd')]));require(_0x74e9('0xe'))[_0x74e9('0xf')](socket);function respondWithRpcPromise(_0x448228,_0x1e5724,_0x31e9e4){return new BPromise(function(_0x53142d,_0x2d1d8e){return client[_0x74e9('0x10')](_0x448228,_0x31e9e4)[_0x74e9('0x11')](function(_0x1ea20f){logger['info'](_0x74e9('0x12'),_0x1e5724,_0x74e9('0x13'));logger[_0x74e9('0x14')](_0x74e9('0x15'),_0x1e5724,_0x74e9('0x13'),JSON[_0x74e9('0x16')](_0x1ea20f));if(_0x1ea20f[_0x74e9('0x17')]){if(_0x1ea20f[_0x74e9('0x17')][_0x74e9('0x18')]===0x1f4){logger[_0x74e9('0x17')](_0x74e9('0x12'),_0x1e5724,_0x1ea20f['error'][_0x74e9('0x19')]);return _0x2d1d8e(_0x1ea20f[_0x74e9('0x17')][_0x74e9('0x19')]);}logger[_0x74e9('0x17')](_0x74e9('0x12'),_0x1e5724,_0x1ea20f[_0x74e9('0x17')]['message']);return _0x53142d(_0x1ea20f['error']['message']);}else{logger[_0x74e9('0x1a')](_0x74e9('0x12'),_0x1e5724,_0x74e9('0x13'));_0x53142d(_0x1ea20f[_0x74e9('0x1b')][_0x74e9('0x19')]);}})[_0x74e9('0x1c')](function(_0x46ff65){logger['error'](_0x74e9('0x12'),_0x1e5724,_0x46ff65);_0x2d1d8e(_0x46ff65);});});}exports[_0x74e9('0x1d')]=function(_0x1b3845){var _0x31a7d1=this;return new Promise(function(_0x319f74,_0x4d4408){return db[_0x74e9('0x1e')]['findAll']({'raw':_0x1b3845[_0x74e9('0x1f')]?_0x1b3845['options'][_0x74e9('0x20')]===undefined?!![]:![]:!![],'where':_0x1b3845['options']?_0x1b3845[_0x74e9('0x1f')][_0x74e9('0x21')]||null:null,'attributes':_0x1b3845[_0x74e9('0x1f')]?_0x1b3845[_0x74e9('0x1f')][_0x74e9('0x22')]||null:null,'limit':_0x1b3845[_0x74e9('0x1f')]?_0x1b3845['options']['limit']||null:null,'include':_0x1b3845[_0x74e9('0x1f')]?_0x1b3845[_0x74e9('0x1f')][_0x74e9('0x23')]?_[_0x74e9('0x24')](_0x1b3845['options']['include'],function(_0x516308){return{'model':db[_0x516308['model']],'as':_0x516308['as'],'attributes':_0x516308['attributes'],'include':_0x516308['include']?_[_0x74e9('0x24')](_0x516308[_0x74e9('0x23')],function(_0x371a92){return{'model':db[_0x371a92[_0x74e9('0x25')]],'as':_0x371a92['as'],'attributes':_0x371a92[_0x74e9('0x22')],'include':_0x371a92['include']?_[_0x74e9('0x24')](_0x371a92[_0x74e9('0x23')],function(_0x2c0024){return{'model':db[_0x2c0024[_0x74e9('0x25')]],'as':_0x2c0024['as'],'attributes':_0x2c0024[_0x74e9('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x283e80){logger[_0x74e9('0x1a')](_0x74e9('0x1d'),_0x1b3845);logger[_0x74e9('0x14')]('GetWhatsappQueue',_0x1b3845,JSON[_0x74e9('0x16')](_0x283e80));_0x319f74(_0x283e80);})['catch'](function(_0x3d74fe){logger[_0x74e9('0x17')]('GetWhatsappQueue',_0x3d74fe[_0x74e9('0x19')],_0x1b3845);_0x4d4408(_0x31a7d1[_0x74e9('0x17')](0x1f4,_0x3d74fe['message']));});});};exports[_0x74e9('0x26')]=function(_0x413579){var _0x42c80e=this;return new Promise(function(_0x82d0f2,_0x4a43b){return db[_0x74e9('0x1e')][_0x74e9('0x27')]({'raw':_0x413579[_0x74e9('0x1f')]?_0x413579[_0x74e9('0x1f')][_0x74e9('0x20')]===undefined?!![]:![]:!![],'where':_0x413579[_0x74e9('0x1f')]?_0x413579['options'][_0x74e9('0x21')]||null:null,'attributes':_0x413579[_0x74e9('0x1f')]?_0x413579[_0x74e9('0x1f')][_0x74e9('0x22')]||null:null,'include':_0x413579[_0x74e9('0x1f')]?_0x413579[_0x74e9('0x1f')][_0x74e9('0x23')]?_[_0x74e9('0x24')](_0x413579[_0x74e9('0x1f')]['include'],function(_0x2ef5e1){return{'model':db[_0x2ef5e1['model']],'as':_0x2ef5e1['as'],'attributes':_0x2ef5e1['attributes'],'include':_0x2ef5e1[_0x74e9('0x23')]?_[_0x74e9('0x24')](_0x2ef5e1[_0x74e9('0x23')],function(_0x5da4cf){return{'model':db[_0x5da4cf[_0x74e9('0x25')]],'as':_0x5da4cf['as'],'attributes':_0x5da4cf[_0x74e9('0x22')],'include':_0x5da4cf[_0x74e9('0x23')]?_['map'](_0x5da4cf[_0x74e9('0x23')],function(_0x55a897){return{'model':db[_0x55a897[_0x74e9('0x25')]],'as':_0x55a897['as'],'attributes':_0x55a897[_0x74e9('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5cc3b6){logger[_0x74e9('0x1a')]('ShowWhatsappQueue',_0x413579);logger[_0x74e9('0x14')](_0x74e9('0x26'),_0x413579,JSON[_0x74e9('0x16')](_0x5cc3b6));_0x82d0f2(_0x5cc3b6);})['catch'](function(_0x51f92f){logger['error'](_0x74e9('0x26'),_0x51f92f[_0x74e9('0x19')],_0x413579);_0x4a43b(_0x42c80e[_0x74e9('0x17')](0x1f4,_0x51f92f['message']));});});}; \ No newline at end of file +var _0x3d36=['localhost','socket.io-emitter','redis','./whatsappQueue.socket','register','request','then','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappQueue,\x20%s,\x20%s','message','info','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','attributes','limit','map','include','model','ShowWhatsappQueue','find','where','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults'];(function(_0x4b8826,_0x505200){var _0x4bbfd5=function(_0x3acac3){while(--_0x3acac3){_0x4b8826['push'](_0x4b8826['shift']());}};_0x4bbfd5(++_0x505200);}(_0x3d36,0xc5));var _0x63d3=function(_0x609988,_0x507944){_0x609988=_0x609988-0x0;var _0x159984=_0x3d36[_0x609988];return _0x159984;};'use strict';var _=require(_0x63d3('0x0'));var util=require(_0x63d3('0x1'));var moment=require(_0x63d3('0x2'));var BPromise=require(_0x63d3('0x3'));var rs=require(_0x63d3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x63d3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x63d3('0x6'))(_0x63d3('0x7'));var config=require(_0x63d3('0x8'));var jayson=require(_0x63d3('0x9'));var client=jayson[_0x63d3('0xa')][_0x63d3('0xb')]({'port':0x232a});config['redis']=_[_0x63d3('0xc')](config['redis'],{'host':_0x63d3('0xd'),'port':0x18eb});var socket=require(_0x63d3('0xe'))(new Redis(config[_0x63d3('0xf')]));require(_0x63d3('0x10'))[_0x63d3('0x11')](socket);function respondWithRpcPromise(_0x182c46,_0x176290,_0x4dd33b){return new BPromise(function(_0x27b843,_0x2f79e4){return client[_0x63d3('0x12')](_0x182c46,_0x4dd33b)[_0x63d3('0x13')](function(_0x388748){logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x176290,_0x63d3('0x14'));logger[_0x63d3('0x15')](_0x63d3('0x16'),_0x176290,_0x63d3('0x14'),JSON[_0x63d3('0x17')](_0x388748));if(_0x388748[_0x63d3('0x18')]){if(_0x388748[_0x63d3('0x18')]['code']===0x1f4){logger[_0x63d3('0x18')](_0x63d3('0x19'),_0x176290,_0x388748[_0x63d3('0x18')][_0x63d3('0x1a')]);return _0x2f79e4(_0x388748[_0x63d3('0x18')]['message']);}logger[_0x63d3('0x18')](_0x63d3('0x19'),_0x176290,_0x388748['error'][_0x63d3('0x1a')]);return _0x27b843(_0x388748[_0x63d3('0x18')][_0x63d3('0x1a')]);}else{logger[_0x63d3('0x1b')](_0x63d3('0x19'),_0x176290,'request\x20sent');_0x27b843(_0x388748['result'][_0x63d3('0x1a')]);}})[_0x63d3('0x1c')](function(_0x1bd510){logger[_0x63d3('0x18')](_0x63d3('0x19'),_0x176290,_0x1bd510);_0x2f79e4(_0x1bd510);});});}exports[_0x63d3('0x1d')]=function(_0x5b166f){var _0x2c9c0c=this;return new Promise(function(_0x51b07a,_0x3dc13d){return db[_0x63d3('0x1e')][_0x63d3('0x1f')]({'raw':_0x5b166f[_0x63d3('0x20')]?_0x5b166f[_0x63d3('0x20')][_0x63d3('0x21')]===undefined?!![]:![]:!![],'where':_0x5b166f[_0x63d3('0x20')]?_0x5b166f[_0x63d3('0x20')]['where']||null:null,'attributes':_0x5b166f[_0x63d3('0x20')]?_0x5b166f[_0x63d3('0x20')][_0x63d3('0x22')]||null:null,'limit':_0x5b166f[_0x63d3('0x20')]?_0x5b166f[_0x63d3('0x20')][_0x63d3('0x23')]||null:null,'include':_0x5b166f['options']?_0x5b166f[_0x63d3('0x20')]['include']?_[_0x63d3('0x24')](_0x5b166f[_0x63d3('0x20')][_0x63d3('0x25')],function(_0x1db40e){return{'model':db[_0x1db40e['model']],'as':_0x1db40e['as'],'attributes':_0x1db40e[_0x63d3('0x22')],'include':_0x1db40e['include']?_[_0x63d3('0x24')](_0x1db40e['include'],function(_0x26904a){return{'model':db[_0x26904a[_0x63d3('0x26')]],'as':_0x26904a['as'],'attributes':_0x26904a[_0x63d3('0x22')],'include':_0x26904a[_0x63d3('0x25')]?_['map'](_0x26904a[_0x63d3('0x25')],function(_0x1a4ccf){return{'model':db[_0x1a4ccf['model']],'as':_0x1a4ccf['as'],'attributes':_0x1a4ccf[_0x63d3('0x22')]};}):[]};}):[]};}):[]:[]})[_0x63d3('0x13')](function(_0x5fa0bf){logger[_0x63d3('0x1b')](_0x63d3('0x1d'),_0x5b166f);logger['debug'](_0x63d3('0x1d'),_0x5b166f,JSON[_0x63d3('0x17')](_0x5fa0bf));_0x51b07a(_0x5fa0bf);})[_0x63d3('0x1c')](function(_0x4bfe0c){logger['error'](_0x63d3('0x1d'),_0x4bfe0c['message'],_0x5b166f);_0x3dc13d(_0x2c9c0c['error'](0x1f4,_0x4bfe0c[_0x63d3('0x1a')]));});});};exports[_0x63d3('0x27')]=function(_0x3f8795){var _0x188521=this;return new Promise(function(_0x5bd21d,_0xb2cc0){return db[_0x63d3('0x1e')][_0x63d3('0x28')]({'raw':_0x3f8795[_0x63d3('0x20')]?_0x3f8795['options'][_0x63d3('0x21')]===undefined?!![]:![]:!![],'where':_0x3f8795[_0x63d3('0x20')]?_0x3f8795[_0x63d3('0x20')][_0x63d3('0x29')]||null:null,'attributes':_0x3f8795[_0x63d3('0x20')]?_0x3f8795[_0x63d3('0x20')][_0x63d3('0x22')]||null:null,'include':_0x3f8795['options']?_0x3f8795[_0x63d3('0x20')][_0x63d3('0x25')]?_[_0x63d3('0x24')](_0x3f8795[_0x63d3('0x20')][_0x63d3('0x25')],function(_0x50e96e){return{'model':db[_0x50e96e['model']],'as':_0x50e96e['as'],'attributes':_0x50e96e['attributes'],'include':_0x50e96e['include']?_[_0x63d3('0x24')](_0x50e96e[_0x63d3('0x25')],function(_0x199e85){return{'model':db[_0x199e85['model']],'as':_0x199e85['as'],'attributes':_0x199e85['attributes'],'include':_0x199e85[_0x63d3('0x25')]?_[_0x63d3('0x24')](_0x199e85[_0x63d3('0x25')],function(_0x2aa44d){return{'model':db[_0x2aa44d['model']],'as':_0x2aa44d['as'],'attributes':_0x2aa44d[_0x63d3('0x22')]};}):[]};}):[]};}):[]:[]})[_0x63d3('0x13')](function(_0x171dcb){logger['info'](_0x63d3('0x27'),_0x3f8795);logger['debug'](_0x63d3('0x27'),_0x3f8795,JSON[_0x63d3('0x17')](_0x171dcb));_0x5bd21d(_0x171dcb);})[_0x63d3('0x1c')](function(_0x5beca7){logger[_0x63d3('0x18')](_0x63d3('0x27'),_0x5beca7['message'],_0x3f8795);_0xb2cc0(_0x188521['error'](0x1f4,_0x5beca7[_0x63d3('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 4318bd6..f1f5930 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 _0xf816=['whatsappQueue:','./whatsappQueue.events','save','remove','update','removeListener','register'];(function(_0x3c138b,_0xc9280b){var _0x84d664=function(_0x28429d){while(--_0x28429d){_0x3c138b['push'](_0x3c138b['shift']());}};_0x84d664(++_0xc9280b);}(_0xf816,0x1ac));var _0x6f81=function(_0x41b51b,_0x10aa62){_0x41b51b=_0x41b51b-0x0;var _0x178904=_0xf816[_0x41b51b];return _0x178904;};'use strict';var WhatsappQueueEvents=require(_0x6f81('0x0'));var events=[_0x6f81('0x1'),_0x6f81('0x2'),_0x6f81('0x3')];function createListener(_0x23ef1,_0x4e02ce){return function(_0x13892b){_0x4e02ce['emit'](_0x23ef1,_0x13892b);};}function removeListener(_0x144647,_0x19227c){return function(){WhatsappQueueEvents[_0x6f81('0x4')](_0x144647,_0x19227c);};}exports[_0x6f81('0x5')]=function(_0x430c6b){for(var _0xa81c9f=0x0,_0x1292cc=events['length'];_0xa81c9f<_0x1292cc;_0xa81c9f++){var _0x2400b5=events[_0xa81c9f];var _0x1a79fd=createListener(_0x6f81('0x6')+_0x2400b5,_0x430c6b);WhatsappQueueEvents['on'](_0x2400b5,_0x1a79fd);}}; \ No newline at end of file +var _0x1d27=['update','emit','length','./whatsappQueue.events','remove'];(function(_0x13932d,_0xf930d3){var _0x1a7b81=function(_0x5c7b67){while(--_0x5c7b67){_0x13932d['push'](_0x13932d['shift']());}};_0x1a7b81(++_0xf930d3);}(_0x1d27,0xc1));var _0x71d2=function(_0xe74dad,_0xf19e67){_0xe74dad=_0xe74dad-0x0;var _0x1f9e0a=_0x1d27[_0xe74dad];return _0x1f9e0a;};'use strict';var WhatsappQueueEvents=require(_0x71d2('0x0'));var events=['save',_0x71d2('0x1'),_0x71d2('0x2')];function createListener(_0x239cb5,_0x43c9b3){return function(_0x191e2d){_0x43c9b3[_0x71d2('0x3')](_0x239cb5,_0x191e2d);};}function removeListener(_0x425b8a,_0xe672c5){return function(){WhatsappQueueEvents['removeListener'](_0x425b8a,_0xe672c5);};}exports['register']=function(_0x581b5c){for(var _0x4daa80=0x0,_0x3e66a8=events[_0x71d2('0x4')];_0x4daa80<_0x3e66a8;_0x4daa80++){var _0x3f3ca1=events[_0x4daa80];var _0x5048fd=createListener('whatsappQueue:'+_0x3f3ca1,_0x581b5c);WhatsappQueueEvents['on'](_0x3f3ca1,_0x5048fd);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index ed058dd..7d9e459 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 _0x974b=['../../components/auth/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/:id','post','put','update','destroy','util','path','connect-timeout','express','Router'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x974b,0x14b));var _0xb974=function(_0x214185,_0x2d96bf){_0x214185=_0x214185-0x0;var _0x34abeb=_0x974b[_0x214185];return _0x34abeb;};'use strict';var multer=require('multer');var util=require(_0xb974('0x0'));var path=require(_0xb974('0x1'));var timeout=require(_0xb974('0x2'));var express=require(_0xb974('0x3'));var router=express[_0xb974('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb974('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb974('0x6'));var controller=require(_0xb974('0x7'));router[_0xb974('0x8')]('/',auth[_0xb974('0x9')](),controller[_0xb974('0xa')]);router['get']('/describe',auth[_0xb974('0x9')](),controller['describe']);router['get'](_0xb974('0xb'),auth[_0xb974('0x9')](),controller['show']);router[_0xb974('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb974('0xd')](_0xb974('0xb'),auth[_0xb974('0x9')](),controller[_0xb974('0xe')]);router['delete']('/:id',auth[_0xb974('0x9')](),controller[_0xb974('0xf')]);module['exports']=router; \ No newline at end of file +var _0xfb00=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create'];(function(_0x491803,_0x37bead){var _0x3221ae=function(_0x5e2b4f){while(--_0x5e2b4f){_0x491803['push'](_0x491803['shift']());}};_0x3221ae(++_0x37bead);}(_0xfb00,0x10c));var _0x0fb0=function(_0x4529b3,_0x390ebb){_0x4529b3=_0x4529b3-0x0;var _0x21e907=_0xfb00[_0x4529b3];return _0x21e907;};'use strict';var multer=require(_0x0fb0('0x0'));var util=require(_0x0fb0('0x1'));var path=require(_0x0fb0('0x2'));var timeout=require(_0x0fb0('0x3'));var express=require(_0x0fb0('0x4'));var router=express['Router']();var fs_extra=require(_0x0fb0('0x5'));var auth=require(_0x0fb0('0x6'));var interaction=require(_0x0fb0('0x7'));var config=require(_0x0fb0('0x8'));var controller=require(_0x0fb0('0x9'));router[_0x0fb0('0xa')]('/',auth[_0x0fb0('0xb')](),controller[_0x0fb0('0xc')]);router['get'](_0x0fb0('0xd'),auth[_0x0fb0('0xb')](),controller[_0x0fb0('0xe')]);router['get'](_0x0fb0('0xf'),auth[_0x0fb0('0xb')](),controller['show']);router[_0x0fb0('0x10')]('/',auth[_0x0fb0('0xb')](),controller[_0x0fb0('0x11')]);router['put'](_0x0fb0('0xf'),auth['isAuthenticated'](),controller[_0x0fb0('0x12')]);router[_0x0fb0('0x13')](_0x0fb0('0xf'),auth[_0x0fb0('0xb')](),controller[_0x0fb0('0x14')]);module[_0x0fb0('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 36c45b2..d59f6a6 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x4b0722,_0x582296){var _0x808ebe=function(_0x46188d){while(--_0x46188d){_0x4b0722['push'](_0x4b0722['shift']());}};_0x808ebe(++_0x582296);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x3eedae,_0x5cc12d){var _0x3882a9=function(_0x5d9af3){while(--_0x5d9af3){_0x3eedae['push'](_0x3eedae['shift']());}};_0x3882a9(++_0x5cc12d);}(_0x7a54,0x106));var _0x47a5=function(_0x196ff1,_0x4ff2b6){_0x196ff1=_0x196ff1-0x0;var _0x18797b=_0x7a54[_0x196ff1];return _0x18797b;};'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 bc9b3d3..ad836ae 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 _0x5c00=['request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','error','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','includeAll','catch','create','body','destroy','find','describe','eml-format','rimraf','zip-dir'];(function(_0xac0dde,_0x4fa5f0){var _0x2653f9=function(_0x9ab665){while(--_0x9ab665){_0xac0dde['push'](_0xac0dde['shift']());}};_0x2653f9(++_0x4fa5f0);}(_0x5c00,0x17e));var _0x05c0=function(_0x46003f,_0x18a160){_0x46003f=_0x46003f-0x0;var _0x373521=_0x5c00[_0x46003f];return _0x373521;};'use strict';var emlformat=require(_0x05c0('0x0'));var rimraf=require(_0x05c0('0x1'));var zipdir=require(_0x05c0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x05c0('0x3'));var moment=require('moment');var BPromise=require(_0x05c0('0x4'));var Mustache=require(_0x05c0('0x5'));var util=require(_0x05c0('0x6'));var path=require(_0x05c0('0x7'));var sox=require('sox');var csv=require(_0x05c0('0x8'));var ejs=require(_0x05c0('0x9'));var fs=require('fs');var fs_extra=require(_0x05c0('0xa'));var _=require(_0x05c0('0xb'));var squel=require('squel');var crypto=require(_0x05c0('0xc'));var jsforce=require(_0x05c0('0xd'));var deskjs=require(_0x05c0('0xe'));var toCsv=require('to-csv');var querystring=require(_0x05c0('0xf'));var Papa=require(_0x05c0('0x10'));var Redis=require(_0x05c0('0x11'));var authService=require(_0x05c0('0x12'));var qs=require(_0x05c0('0x13'));var as=require(_0x05c0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x05c0('0x15'));var utils=require('../../config/utils');var config=require(_0x05c0('0x16'));var licenseUtil=require(_0x05c0('0x17'));var db=require(_0x05c0('0x18'))['db'];function respondWithStatusCode(_0x5a3e65,_0x4e39d4){_0x4e39d4=_0x4e39d4||0xcc;return function(_0x5eec41){if(_0x5eec41){return _0x5a3e65[_0x05c0('0x19')](_0x4e39d4);}return _0x5a3e65[_0x05c0('0x1a')](_0x4e39d4)[_0x05c0('0x1b')]();};}function respondWithResult(_0x12deeb,_0x25764b){_0x25764b=_0x25764b||0xc8;return function(_0xe57ed0){if(_0xe57ed0){return _0x12deeb[_0x05c0('0x1a')](_0x25764b)[_0x05c0('0x1c')](_0xe57ed0);}};}function respondWithFilteredResult(_0x4c3e54,_0x238e25){return function(_0x161a5f){if(_0x161a5f){var _0x4bb164=typeof _0x238e25[_0x05c0('0x1d')]===_0x05c0('0x1e')&&typeof _0x238e25[_0x05c0('0x1f')]===_0x05c0('0x1e');var _0xd07ad1=_0x161a5f[_0x05c0('0x20')];var _0x521cbd=_0x4bb164?0x0:_0x238e25[_0x05c0('0x1d')];var _0x1230e5=_0x4bb164?_0x161a5f[_0x05c0('0x20')]:_0x238e25['offset']+_0x238e25[_0x05c0('0x1f')];var _0x2023d6;if(_0x1230e5>=_0xd07ad1){_0x1230e5=_0xd07ad1;_0x2023d6=0xc8;}else{_0x2023d6=0xce;}_0x4c3e54[_0x05c0('0x1a')](_0x2023d6);return _0x4c3e54[_0x05c0('0x21')](_0x05c0('0x22'),_0x521cbd+'-'+_0x1230e5+'/'+_0xd07ad1)['json'](_0x161a5f);}return null;};}function patchUpdates(_0x407c1f){return function(_0x1014ef){try{jsonpatch['apply'](_0x1014ef,_0x407c1f,!![]);}catch(_0x548a0c){return BPromise['reject'](_0x548a0c);}return _0x1014ef[_0x05c0('0x23')]();};}function saveUpdates(_0x2055a3,_0x83f29){return function(_0x8e2d4){if(_0x8e2d4){return _0x8e2d4[_0x05c0('0x24')](_0x2055a3)[_0x05c0('0x25')](function(_0x14224f){return _0x14224f;});}return null;};}function removeEntity(_0x5b4eef,_0x9b4930){return function(_0x1abbf3){if(_0x1abbf3){return _0x1abbf3['destroy']()['then'](function(){_0x5b4eef['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x56aa78,_0x3df135){return function(_0x15b497){if(!_0x15b497){_0x56aa78['sendStatus'](0x194);}return _0x15b497;};}function handleError(_0x41a6a2,_0x336e1b){_0x336e1b=_0x336e1b||0x1f4;return function(_0x3617dc){logger[_0x05c0('0x26')](_0x3617dc['stack']);if(_0x3617dc[_0x05c0('0x27')]){delete _0x3617dc[_0x05c0('0x27')];}_0x41a6a2[_0x05c0('0x1a')](_0x336e1b)[_0x05c0('0x28')](_0x3617dc);};}exports[_0x05c0('0x29')]=function(_0x5d12e0,_0x57886b){var _0x56ba64={},_0x2df109={},_0xbe7d9e={'count':0x0,'rows':[]};var _0x2053d5=_[_0x05c0('0x2a')](db[_0x05c0('0x2b')][_0x05c0('0x2c')],function(_0x1c4c8f){return{'name':_0x1c4c8f[_0x05c0('0x2d')],'type':_0x1c4c8f[_0x05c0('0x2e')][_0x05c0('0x2f')]};});_0x2df109[_0x05c0('0x30')]=_[_0x05c0('0x2a')](_0x2053d5,'name');_0x2df109['query']=_[_0x05c0('0x31')](_0x5d12e0[_0x05c0('0x32')]);_0x2df109[_0x05c0('0x33')]=_['intersection'](_0x2df109[_0x05c0('0x30')],_0x2df109[_0x05c0('0x32')]);_0x56ba64['attributes']=_[_0x05c0('0x34')](_0x2df109['model'],qs[_0x05c0('0x35')](_0x5d12e0[_0x05c0('0x32')][_0x05c0('0x35')]));_0x56ba64[_0x05c0('0x36')]=_0x56ba64[_0x05c0('0x36')][_0x05c0('0x37')]?_0x56ba64[_0x05c0('0x36')]:_0x2df109[_0x05c0('0x30')];if(!_0x5d12e0[_0x05c0('0x32')][_0x05c0('0x38')](_0x05c0('0x39'))){_0x56ba64[_0x05c0('0x1f')]=qs[_0x05c0('0x1f')](_0x5d12e0[_0x05c0('0x32')][_0x05c0('0x1f')]);_0x56ba64[_0x05c0('0x1d')]=qs[_0x05c0('0x1d')](_0x5d12e0[_0x05c0('0x32')][_0x05c0('0x1d')]);}_0x56ba64[_0x05c0('0x3a')]=qs[_0x05c0('0x3b')](_0x5d12e0[_0x05c0('0x32')][_0x05c0('0x3b')]);_0x56ba64[_0x05c0('0x3c')]=qs[_0x05c0('0x33')](_[_0x05c0('0x3d')](_0x5d12e0[_0x05c0('0x32')],_0x2df109[_0x05c0('0x33')]),_0x2053d5);if(_0x5d12e0[_0x05c0('0x32')][_0x05c0('0x3e')]){_0x56ba64[_0x05c0('0x3c')]=_[_0x05c0('0x3f')](_0x56ba64[_0x05c0('0x3c')],{'$or':_['map'](_0x2053d5,function(_0x2a19b4){if(_0x2a19b4[_0x05c0('0x2e')]!==_0x05c0('0x40')){var _0x3eff9e={};_0x3eff9e[_0x2a19b4['name']]={'$like':'%'+_0x5d12e0['query'][_0x05c0('0x3e')]+'%'};return _0x3eff9e;}})});}_0x56ba64=_[_0x05c0('0x3f')]({},_0x56ba64,_0x5d12e0[_0x05c0('0x41')]);var _0x4ced8e={'where':_0x56ba64[_0x05c0('0x3c')]};return db[_0x05c0('0x2b')][_0x05c0('0x20')](_0x4ced8e)[_0x05c0('0x25')](function(_0x47b349){_0xbe7d9e[_0x05c0('0x20')]=_0x47b349;if(_0x5d12e0[_0x05c0('0x32')]['includeAll']){_0x56ba64[_0x05c0('0x42')]=[{'all':!![]}];}return db[_0x05c0('0x2b')][_0x05c0('0x43')](_0x56ba64);})[_0x05c0('0x25')](function(_0x164e3a){_0xbe7d9e[_0x05c0('0x44')]=_0x164e3a;return _0xbe7d9e;})[_0x05c0('0x25')](respondWithFilteredResult(_0x57886b,_0x56ba64))['catch'](handleError(_0x57886b,null));};exports['show']=function(_0x29d62a,_0x1d1d94){var _0xaa5d53={'raw':!![],'where':{'id':_0x29d62a[_0x05c0('0x45')]['id']}},_0x11f079={};_0x11f079['model']=_[_0x05c0('0x31')](db[_0x05c0('0x2b')][_0x05c0('0x2c')]);_0x11f079[_0x05c0('0x32')]=_[_0x05c0('0x31')](_0x29d62a[_0x05c0('0x32')]);_0x11f079[_0x05c0('0x33')]=_['intersection'](_0x11f079[_0x05c0('0x30')],_0x11f079[_0x05c0('0x32')]);_0xaa5d53[_0x05c0('0x36')]=_[_0x05c0('0x34')](_0x11f079[_0x05c0('0x30')],qs[_0x05c0('0x35')](_0x29d62a[_0x05c0('0x32')][_0x05c0('0x35')]));_0xaa5d53[_0x05c0('0x36')]=_0xaa5d53[_0x05c0('0x36')][_0x05c0('0x37')]?_0xaa5d53['attributes']:_0x11f079['model'];if(_0x29d62a[_0x05c0('0x32')][_0x05c0('0x46')]){_0xaa5d53[_0x05c0('0x42')]=[{'all':!![]}];}_0xaa5d53=_[_0x05c0('0x3f')]({},_0xaa5d53,_0x29d62a[_0x05c0('0x41')]);return db[_0x05c0('0x2b')]['find'](_0xaa5d53)[_0x05c0('0x25')](handleEntityNotFound(_0x1d1d94,null))[_0x05c0('0x25')](respondWithResult(_0x1d1d94,null))[_0x05c0('0x47')](handleError(_0x1d1d94,null));};exports[_0x05c0('0x48')]=function(_0x587190,_0x34e94e){return db[_0x05c0('0x2b')][_0x05c0('0x48')](_0x587190[_0x05c0('0x49')],{})['then'](respondWithResult(_0x34e94e,0xc9))[_0x05c0('0x47')](handleError(_0x34e94e,null));};exports[_0x05c0('0x24')]=function(_0x2e5660,_0x9b521b){if(_0x2e5660['body']['id']){delete _0x2e5660[_0x05c0('0x49')]['id'];}return db[_0x05c0('0x2b')]['find']({'where':{'id':_0x2e5660[_0x05c0('0x45')]['id']}})['then'](handleEntityNotFound(_0x9b521b,null))['then'](saveUpdates(_0x2e5660[_0x05c0('0x49')],null))['then'](respondWithResult(_0x9b521b,null))[_0x05c0('0x47')](handleError(_0x9b521b,null));};exports[_0x05c0('0x4a')]=function(_0x2fedc0,_0x371aff){return db[_0x05c0('0x2b')][_0x05c0('0x4b')]({'where':{'id':_0x2fedc0['params']['id']}})[_0x05c0('0x25')](handleEntityNotFound(_0x371aff,null))['then'](removeEntity(_0x371aff,null))[_0x05c0('0x47')](handleError(_0x371aff,null));};exports[_0x05c0('0x4c')]=function(_0x183883,_0x13ad38){return db[_0x05c0('0x2b')][_0x05c0('0x4c')]()[_0x05c0('0x25')](respondWithResult(_0x13ad38,null))['catch'](handleError(_0x13ad38,null));}; \ No newline at end of file +var _0x69d3=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','WhatsappQueueReport','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','find','create','body','catch','update','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','util','to-csv'];(function(_0x3fb879,_0x506d43){var _0x92cf92=function(_0x39a432){while(--_0x39a432){_0x3fb879['push'](_0x3fb879['shift']());}};_0x92cf92(++_0x506d43);}(_0x69d3,0xda));var _0x369d=function(_0x2e50a9,_0x9e6911){_0x2e50a9=_0x2e50a9-0x0;var _0x51d353=_0x69d3[_0x2e50a9];return _0x51d353;};'use strict';var emlformat=require(_0x369d('0x0'));var rimraf=require(_0x369d('0x1'));var zipdir=require(_0x369d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x369d('0x3'));var moment=require(_0x369d('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x369d('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x369d('0x6'));var ejs=require(_0x369d('0x7'));var fs=require('fs');var fs_extra=require(_0x369d('0x8'));var _=require(_0x369d('0x9'));var squel=require(_0x369d('0xa'));var crypto=require(_0x369d('0xb'));var jsforce=require(_0x369d('0xc'));var deskjs=require(_0x369d('0xd'));var toCsv=require(_0x369d('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x369d('0xe'));var authService=require(_0x369d('0xf'));var qs=require(_0x369d('0x10'));var as=require(_0x369d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x369d('0x12'));var utils=require(_0x369d('0x13'));var config=require(_0x369d('0x14'));var licenseUtil=require(_0x369d('0x15'));var db=require(_0x369d('0x16'))['db'];function respondWithStatusCode(_0xee549e,_0x52c126){_0x52c126=_0x52c126||0xcc;return function(_0x15b417){if(_0x15b417){return _0xee549e[_0x369d('0x17')](_0x52c126);}return _0xee549e[_0x369d('0x18')](_0x52c126)[_0x369d('0x19')]();};}function respondWithResult(_0x121307,_0x539536){_0x539536=_0x539536||0xc8;return function(_0x5cd4c3){if(_0x5cd4c3){return _0x121307['status'](_0x539536)[_0x369d('0x1a')](_0x5cd4c3);}};}function respondWithFilteredResult(_0xa126c1,_0x389c43){return function(_0x5b4f55){if(_0x5b4f55){var _0x2c1a4a=typeof _0x389c43[_0x369d('0x1b')]===_0x369d('0x1c')&&typeof _0x389c43['limit']===_0x369d('0x1c');var _0x1f37ff=_0x5b4f55['count'];var _0x572513=_0x2c1a4a?0x0:_0x389c43['offset'];var _0x2946be=_0x2c1a4a?_0x5b4f55[_0x369d('0x1d')]:_0x389c43[_0x369d('0x1b')]+_0x389c43['limit'];var _0x410dbe;if(_0x2946be>=_0x1f37ff){_0x2946be=_0x1f37ff;_0x410dbe=0xc8;}else{_0x410dbe=0xce;}_0xa126c1[_0x369d('0x18')](_0x410dbe);return _0xa126c1[_0x369d('0x1e')](_0x369d('0x1f'),_0x572513+'-'+_0x2946be+'/'+_0x1f37ff)[_0x369d('0x1a')](_0x5b4f55);}return null;};}function patchUpdates(_0x538ca4){return function(_0x5c9fdd){try{jsonpatch[_0x369d('0x20')](_0x5c9fdd,_0x538ca4,!![]);}catch(_0x1edcd5){return BPromise[_0x369d('0x21')](_0x1edcd5);}return _0x5c9fdd[_0x369d('0x22')]();};}function saveUpdates(_0x84cc0f,_0x15fbef){return function(_0x1b262a){if(_0x1b262a){return _0x1b262a['update'](_0x84cc0f)['then'](function(_0x32ef9a){return _0x32ef9a;});}return null;};}function removeEntity(_0xed16e,_0xf7bc3a){return function(_0xcae58){if(_0xcae58){return _0xcae58[_0x369d('0x23')]()[_0x369d('0x24')](function(){_0xed16e[_0x369d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4dfe83,_0x16145e){return function(_0x46de2b){if(!_0x46de2b){_0x4dfe83[_0x369d('0x17')](0x194);}return _0x46de2b;};}function handleError(_0xe01d2b,_0x8aa521){_0x8aa521=_0x8aa521||0x1f4;return function(_0x41e0cf){logger[_0x369d('0x25')](_0x41e0cf['stack']);if(_0x41e0cf[_0x369d('0x26')]){delete _0x41e0cf[_0x369d('0x26')];}_0xe01d2b[_0x369d('0x18')](_0x8aa521)[_0x369d('0x27')](_0x41e0cf);};}exports[_0x369d('0x28')]=function(_0x41367a,_0x3d1ce0){var _0x4d42ea={},_0x157291={},_0x56efb1={'count':0x0,'rows':[]};var _0x57b94c=_[_0x369d('0x29')](db[_0x369d('0x2a')]['rawAttributes'],function(_0x104540){return{'name':_0x104540['fieldName'],'type':_0x104540[_0x369d('0x2b')][_0x369d('0x2c')]};});_0x157291[_0x369d('0x2d')]=_[_0x369d('0x29')](_0x57b94c,_0x369d('0x26'));_0x157291[_0x369d('0x2e')]=_[_0x369d('0x2f')](_0x41367a['query']);_0x157291[_0x369d('0x30')]=_[_0x369d('0x31')](_0x157291[_0x369d('0x2d')],_0x157291[_0x369d('0x2e')]);_0x4d42ea[_0x369d('0x32')]=_[_0x369d('0x31')](_0x157291[_0x369d('0x2d')],qs[_0x369d('0x33')](_0x41367a['query'][_0x369d('0x33')]));_0x4d42ea[_0x369d('0x32')]=_0x4d42ea[_0x369d('0x32')][_0x369d('0x34')]?_0x4d42ea[_0x369d('0x32')]:_0x157291['model'];if(!_0x41367a[_0x369d('0x2e')][_0x369d('0x35')](_0x369d('0x36'))){_0x4d42ea[_0x369d('0x37')]=qs[_0x369d('0x37')](_0x41367a[_0x369d('0x2e')]['limit']);_0x4d42ea[_0x369d('0x1b')]=qs[_0x369d('0x1b')](_0x41367a[_0x369d('0x2e')][_0x369d('0x1b')]);}_0x4d42ea[_0x369d('0x38')]=qs[_0x369d('0x39')](_0x41367a[_0x369d('0x2e')][_0x369d('0x39')]);_0x4d42ea[_0x369d('0x3a')]=qs[_0x369d('0x30')](_[_0x369d('0x3b')](_0x41367a[_0x369d('0x2e')],_0x157291[_0x369d('0x30')]),_0x57b94c);if(_0x41367a[_0x369d('0x2e')][_0x369d('0x3c')]){_0x4d42ea[_0x369d('0x3a')]=_[_0x369d('0x3d')](_0x4d42ea[_0x369d('0x3a')],{'$or':_[_0x369d('0x29')](_0x57b94c,function(_0x7fd64b){if(_0x7fd64b[_0x369d('0x2b')]!==_0x369d('0x3e')){var _0xb7837f={};_0xb7837f[_0x7fd64b[_0x369d('0x26')]]={'$like':'%'+_0x41367a['query']['filter']+'%'};return _0xb7837f;}})});}_0x4d42ea=_[_0x369d('0x3d')]({},_0x4d42ea,_0x41367a[_0x369d('0x3f')]);var _0x8a1ef5={'where':_0x4d42ea[_0x369d('0x3a')]};return db[_0x369d('0x2a')][_0x369d('0x1d')](_0x8a1ef5)[_0x369d('0x24')](function(_0x169340){_0x56efb1[_0x369d('0x1d')]=_0x169340;if(_0x41367a['query'][_0x369d('0x40')]){_0x4d42ea[_0x369d('0x41')]=[{'all':!![]}];}return db[_0x369d('0x2a')][_0x369d('0x42')](_0x4d42ea);})[_0x369d('0x24')](function(_0x25cf4e){_0x56efb1[_0x369d('0x43')]=_0x25cf4e;return _0x56efb1;})[_0x369d('0x24')](respondWithFilteredResult(_0x3d1ce0,_0x4d42ea))['catch'](handleError(_0x3d1ce0,null));};exports['show']=function(_0x20b351,_0x3222ce){var _0x30909a={'raw':!![],'where':{'id':_0x20b351['params']['id']}},_0x4dad71={};_0x4dad71['model']=_[_0x369d('0x2f')](db[_0x369d('0x2a')]['rawAttributes']);_0x4dad71[_0x369d('0x2e')]=_[_0x369d('0x2f')](_0x20b351[_0x369d('0x2e')]);_0x4dad71[_0x369d('0x30')]=_['intersection'](_0x4dad71[_0x369d('0x2d')],_0x4dad71['query']);_0x30909a[_0x369d('0x32')]=_['intersection'](_0x4dad71[_0x369d('0x2d')],qs[_0x369d('0x33')](_0x20b351[_0x369d('0x2e')]['fields']));_0x30909a['attributes']=_0x30909a[_0x369d('0x32')][_0x369d('0x34')]?_0x30909a[_0x369d('0x32')]:_0x4dad71['model'];if(_0x20b351[_0x369d('0x2e')][_0x369d('0x40')]){_0x30909a[_0x369d('0x41')]=[{'all':!![]}];}_0x30909a=_[_0x369d('0x3d')]({},_0x30909a,_0x20b351[_0x369d('0x3f')]);return db[_0x369d('0x2a')][_0x369d('0x44')](_0x30909a)[_0x369d('0x24')](handleEntityNotFound(_0x3222ce,null))[_0x369d('0x24')](respondWithResult(_0x3222ce,null))['catch'](handleError(_0x3222ce,null));};exports[_0x369d('0x45')]=function(_0x41066d,_0xcc1465){return db[_0x369d('0x2a')][_0x369d('0x45')](_0x41066d[_0x369d('0x46')],{})['then'](respondWithResult(_0xcc1465,0xc9))[_0x369d('0x47')](handleError(_0xcc1465,null));};exports[_0x369d('0x48')]=function(_0x16dd8f,_0x44a357){if(_0x16dd8f[_0x369d('0x46')]['id']){delete _0x16dd8f[_0x369d('0x46')]['id'];}return db[_0x369d('0x2a')][_0x369d('0x44')]({'where':{'id':_0x16dd8f[_0x369d('0x49')]['id']}})[_0x369d('0x24')](handleEntityNotFound(_0x44a357,null))[_0x369d('0x24')](saveUpdates(_0x16dd8f[_0x369d('0x46')],null))['then'](respondWithResult(_0x44a357,null))[_0x369d('0x47')](handleError(_0x44a357,null));};exports[_0x369d('0x23')]=function(_0x289eb8,_0x85edd6){return db[_0x369d('0x2a')]['find']({'where':{'id':_0x289eb8[_0x369d('0x49')]['id']}})['then'](handleEntityNotFound(_0x85edd6,null))[_0x369d('0x24')](removeEntity(_0x85edd6,null))[_0x369d('0x47')](handleError(_0x85edd6,null));};exports[_0x369d('0x4a')]=function(_0x851746,_0x46c62c){return db[_0x369d('0x2a')][_0x369d('0x4a')]()[_0x369d('0x24')](respondWithResult(_0x46c62c,null))[_0x369d('0x47')](handleError(_0x46c62c,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index c543c82..6bdd707 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 _0x0895=['path','rimraf','../../config/environment','./whatsappQueueReport.attributes','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0895,0x86));var _0x5089=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0895[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5089('0x0'));var util=require('util');var logger=require(_0x5089('0x1'))(_0x5089('0x2'));var moment=require(_0x5089('0x3'));var BPromise=require(_0x5089('0x4'));var rp=require(_0x5089('0x5'));var fs=require('fs');var path=require(_0x5089('0x6'));var rimraf=require(_0x5089('0x7'));var config=require(_0x5089('0x8'));var attributes=require(_0x5089('0x9'));module['exports']=function(_0x93fe9a,_0xb767ca){return _0x93fe9a[_0x5089('0xa')](_0x5089('0xb'),attributes,{'tableName':_0x5089('0xc'),'paranoid':![],'indexes':[{'name':_0x5089('0xd'),'fields':[_0x5089('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x463a=['api','moment','bluebird','request-promise','rimraf','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger'];(function(_0x18d5d2,_0x4494b2){var _0x257882=function(_0x811505){while(--_0x811505){_0x18d5d2['push'](_0x18d5d2['shift']());}};_0x257882(++_0x4494b2);}(_0x463a,0x176));var _0xa463=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0x463a[_0x521929];return _0x632436;};'use strict';var _=require(_0xa463('0x0'));var util=require(_0xa463('0x1'));var logger=require(_0xa463('0x2'))(_0xa463('0x3'));var moment=require(_0xa463('0x4'));var BPromise=require(_0xa463('0x5'));var rp=require(_0xa463('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa463('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappQueueReport.attributes');module[_0xa463('0x8')]=function(_0x17f13a,_0x5b3cad){return _0x17f13a[_0xa463('0x9')](_0xa463('0xa'),attributes,{'tableName':_0xa463('0xb'),'paranoid':![],'indexes':[{'name':_0xa463('0xc'),'fields':[_0xa463('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 11ff05d..6fa9c6e 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 _0xd999=['client','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','code','error','message','result','catch','WhatsappQueueReport','body','options','raw','CreateWhatsappQueueReport','stringify','UpdateWhatsappQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x7d881,_0x5d6f26){var _0x46bf76=function(_0x2f0306){while(--_0x2f0306){_0x7d881['push'](_0x7d881['shift']());}};_0x46bf76(++_0x5d6f26);}(_0xd999,0x1f3));var _0x9d99=function(_0xf74ddb,_0x8383bd){_0xf74ddb=_0xf74ddb-0x0;var _0x44e4cd=_0xd999[_0xf74ddb];return _0x44e4cd;};'use strict';var _=require(_0x9d99('0x0'));var util=require(_0x9d99('0x1'));var moment=require(_0x9d99('0x2'));var BPromise=require(_0x9d99('0x3'));var rs=require(_0x9d99('0x4'));var fs=require('fs');var Redis=require(_0x9d99('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9d99('0x6'));var logger=require(_0x9d99('0x7'))(_0x9d99('0x8'));var config=require(_0x9d99('0x9'));var jayson=require(_0x9d99('0xa'));var client=jayson[_0x9d99('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x378d1d,_0x2bd800,_0x4c0f5e){return new BPromise(function(_0x76c1e2,_0x1294b1){return client[_0x9d99('0xc')](_0x378d1d,_0x4c0f5e)[_0x9d99('0xd')](function(_0x1847cf){logger[_0x9d99('0xe')](_0x9d99('0xf'),_0x2bd800,_0x9d99('0x10'));logger[_0x9d99('0x11')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x2bd800,_0x9d99('0x10'),JSON['stringify'](_0x1847cf));if(_0x1847cf['error']){if(_0x1847cf['error'][_0x9d99('0x12')]===0x1f4){logger[_0x9d99('0x13')]('WhatsappQueueReport,\x20%s,\x20%s',_0x2bd800,_0x1847cf[_0x9d99('0x13')][_0x9d99('0x14')]);return _0x1294b1(_0x1847cf['error']['message']);}logger[_0x9d99('0x13')](_0x9d99('0xf'),_0x2bd800,_0x1847cf['error'][_0x9d99('0x14')]);return _0x76c1e2(_0x1847cf['error']['message']);}else{logger[_0x9d99('0xe')](_0x9d99('0xf'),_0x2bd800,'request\x20sent');_0x76c1e2(_0x1847cf[_0x9d99('0x15')][_0x9d99('0x14')]);}})[_0x9d99('0x16')](function(_0x3d3e99){logger[_0x9d99('0x13')](_0x9d99('0xf'),_0x2bd800,_0x3d3e99);_0x1294b1(_0x3d3e99);});});}exports['CreateWhatsappQueueReport']=function(_0x3d5dec){var _0x5e0dc9=this;return new Promise(function(_0x3552ea,_0x17a0af){return db[_0x9d99('0x17')]['create'](_0x3d5dec[_0x9d99('0x18')],{'raw':_0x3d5dec[_0x9d99('0x19')]?_0x3d5dec[_0x9d99('0x19')][_0x9d99('0x1a')]===undefined?!![]:![]:!![]})[_0x9d99('0xd')](function(_0x4463fe){logger[_0x9d99('0xe')]('CreateWhatsappQueueReport',_0x3d5dec);logger[_0x9d99('0x11')](_0x9d99('0x1b'),_0x3d5dec,JSON[_0x9d99('0x1c')](_0x4463fe));_0x3552ea(_0x4463fe);})[_0x9d99('0x16')](function(_0x23a12b){logger[_0x9d99('0x13')]('CreateWhatsappQueueReport',_0x23a12b[_0x9d99('0x14')],_0x3d5dec);_0x17a0af(_0x5e0dc9[_0x9d99('0x13')](0x1f4,_0x23a12b[_0x9d99('0x14')]));});});};exports[_0x9d99('0x1d')]=function(_0x4c8968){var _0x403697=this;return new Promise(function(_0x501727,_0x422e4f){return db['WhatsappQueueReport'][_0x9d99('0x1e')](_0x4c8968[_0x9d99('0x18')],{'raw':_0x4c8968[_0x9d99('0x19')]?_0x4c8968[_0x9d99('0x19')][_0x9d99('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c8968['options']?_0x4c8968[_0x9d99('0x19')][_0x9d99('0x1f')]||null:null,'attributes':_0x4c8968[_0x9d99('0x19')]?_0x4c8968[_0x9d99('0x19')][_0x9d99('0x20')]||null:null,'limit':_0x4c8968['options']?_0x4c8968['options'][_0x9d99('0x21')]||null:null})[_0x9d99('0xd')](function(_0x21c5bd){logger['info'](_0x9d99('0x1d'),_0x4c8968);logger['debug'](_0x9d99('0x1d'),_0x4c8968,JSON[_0x9d99('0x1c')](_0x21c5bd));_0x501727(_0x21c5bd);})[_0x9d99('0x16')](function(_0x413cfe){logger[_0x9d99('0x13')](_0x9d99('0x1d'),_0x413cfe['message'],_0x4c8968);_0x422e4f(_0x403697[_0x9d99('0x13')](0x1f4,_0x413cfe[_0x9d99('0x14')]));});});}; \ No newline at end of file +var _0xa72e=['then','info','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappQueueReport,\x20%s,\x20%s','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','options','raw','update','body','where','attributes','limit','UpdateWhatsappQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x50406a,_0x2871ee){var _0xe06568=function(_0xa087a){while(--_0xa087a){_0x50406a['push'](_0x50406a['shift']());}};_0xe06568(++_0x2871ee);}(_0xa72e,0x150));var _0xea72=function(_0x1c6f69,_0x8ffcd1){_0x1c6f69=_0x1c6f69-0x0;var _0x1e0db1=_0xa72e[_0x1c6f69];return _0x1e0db1;};'use strict';var _=require(_0xea72('0x0'));var util=require(_0xea72('0x1'));var moment=require(_0xea72('0x2'));var BPromise=require(_0xea72('0x3'));var rs=require(_0xea72('0x4'));var fs=require('fs');var Redis=require(_0xea72('0x5'));var db=require(_0xea72('0x6'))['db'];var utils=require(_0xea72('0x7'));var logger=require(_0xea72('0x8'))(_0xea72('0x9'));var config=require(_0xea72('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xea72('0xb')][_0xea72('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4de5ff,_0x4659d3,_0x131b75){return new BPromise(function(_0x3c6d64,_0x1c1dd6){return client[_0xea72('0xd')](_0x4de5ff,_0x131b75)[_0xea72('0xe')](function(_0x2c84a2){logger[_0xea72('0xf')]('WhatsappQueueReport,\x20%s,\x20%s',_0x4659d3,_0xea72('0x10'));logger[_0xea72('0x11')](_0xea72('0x12'),_0x4659d3,_0xea72('0x10'),JSON[_0xea72('0x13')](_0x2c84a2));if(_0x2c84a2[_0xea72('0x14')]){if(_0x2c84a2['error']['code']===0x1f4){logger['error'](_0xea72('0x15'),_0x4659d3,_0x2c84a2['error'][_0xea72('0x16')]);return _0x1c1dd6(_0x2c84a2['error']['message']);}logger[_0xea72('0x14')](_0xea72('0x15'),_0x4659d3,_0x2c84a2['error'][_0xea72('0x16')]);return _0x3c6d64(_0x2c84a2[_0xea72('0x14')][_0xea72('0x16')]);}else{logger[_0xea72('0xf')](_0xea72('0x15'),_0x4659d3,_0xea72('0x10'));_0x3c6d64(_0x2c84a2[_0xea72('0x17')][_0xea72('0x16')]);}})[_0xea72('0x18')](function(_0x3d4af8){logger[_0xea72('0x14')](_0xea72('0x15'),_0x4659d3,_0x3d4af8);_0x1c1dd6(_0x3d4af8);});});}exports[_0xea72('0x19')]=function(_0x23eb98){var _0x98ce71=this;return new Promise(function(_0x2a7a68,_0x32f1e7){return db[_0xea72('0x1a')]['create'](_0x23eb98['body'],{'raw':_0x23eb98[_0xea72('0x1b')]?_0x23eb98[_0xea72('0x1b')][_0xea72('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x2e64bf){logger[_0xea72('0xf')](_0xea72('0x19'),_0x23eb98);logger[_0xea72('0x11')](_0xea72('0x19'),_0x23eb98,JSON[_0xea72('0x13')](_0x2e64bf));_0x2a7a68(_0x2e64bf);})[_0xea72('0x18')](function(_0x458986){logger[_0xea72('0x14')](_0xea72('0x19'),_0x458986[_0xea72('0x16')],_0x23eb98);_0x32f1e7(_0x98ce71[_0xea72('0x14')](0x1f4,_0x458986['message']));});});};exports['UpdateWhatsappQueueReport']=function(_0x1f0b29){var _0x1039ab=this;return new Promise(function(_0x4da150,_0x4328fd){return db['WhatsappQueueReport'][_0xea72('0x1d')](_0x1f0b29[_0xea72('0x1e')],{'raw':_0x1f0b29['options']?_0x1f0b29[_0xea72('0x1b')][_0xea72('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f0b29[_0xea72('0x1b')]?_0x1f0b29[_0xea72('0x1b')][_0xea72('0x1f')]||null:null,'attributes':_0x1f0b29[_0xea72('0x1b')]?_0x1f0b29[_0xea72('0x1b')][_0xea72('0x20')]||null:null,'limit':_0x1f0b29['options']?_0x1f0b29[_0xea72('0x1b')][_0xea72('0x21')]||null:null})[_0xea72('0xe')](function(_0x559053){logger[_0xea72('0xf')](_0xea72('0x22'),_0x1f0b29);logger['debug'](_0xea72('0x22'),_0x1f0b29,JSON[_0xea72('0x13')](_0x559053));_0x4da150(_0x559053);})[_0xea72('0x18')](function(_0x34ac24){logger[_0xea72('0x14')](_0xea72('0x22'),_0x34ac24[_0xea72('0x16')],_0x1f0b29);_0x4328fd(_0x1039ab[_0xea72('0x14')](0x1f4,_0x34ac24[_0xea72('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 7d7c137..808c293 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 _0x3137=['/describe','describe','show','post','create','put','update','exports','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index'];(function(_0x50d0ff,_0x4cc080){var _0x36a50c=function(_0x45a73c){while(--_0x45a73c){_0x50d0ff['push'](_0x50d0ff['shift']());}};_0x36a50c(++_0x4cc080);}(_0x3137,0x128));var _0x7313=function(_0x3237a8,_0x32ca63){_0x3237a8=_0x3237a8-0x0;var _0x4516ed=_0x3137[_0x3237a8];return _0x4516ed;};'use strict';var multer=require('multer');var util=require(_0x7313('0x0'));var path=require('path');var timeout=require(_0x7313('0x1'));var express=require(_0x7313('0x2'));var router=express['Router']();var fs_extra=require(_0x7313('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7313('0x4'));var config=require(_0x7313('0x5'));var controller=require(_0x7313('0x6'));router[_0x7313('0x7')]('/',auth[_0x7313('0x8')](),controller[_0x7313('0x9')]);router['get'](_0x7313('0xa'),auth['isAuthenticated'](),controller[_0x7313('0xb')]);router[_0x7313('0x7')]('/:id',auth[_0x7313('0x8')](),controller[_0x7313('0xc')]);router[_0x7313('0xd')]('/',auth[_0x7313('0x8')](),controller[_0x7313('0xe')]);router[_0x7313('0xf')]('/:id',auth[_0x7313('0x8')](),controller[_0x7313('0x10')]);router['delete']('/:id',auth[_0x7313('0x8')](),controller['destroy']);module[_0x7313('0x11')]=router; \ No newline at end of file +var _0x91b3=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete'];(function(_0x13e724,_0x296739){var _0x334a44=function(_0x28f54e){while(--_0x28f54e){_0x13e724['push'](_0x13e724['shift']());}};_0x334a44(++_0x296739);}(_0x91b3,0x1b7));var _0x391b=function(_0x205b57,_0x578f44){_0x205b57=_0x205b57-0x0;var _0x125171=_0x91b3[_0x205b57];return _0x125171;};'use strict';var multer=require(_0x391b('0x0'));var util=require(_0x391b('0x1'));var path=require(_0x391b('0x2'));var timeout=require(_0x391b('0x3'));var express=require(_0x391b('0x4'));var router=express[_0x391b('0x5')]();var fs_extra=require(_0x391b('0x6'));var auth=require(_0x391b('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x391b('0x8'));var controller=require(_0x391b('0x9'));router[_0x391b('0xa')]('/',auth[_0x391b('0xb')](),controller[_0x391b('0xc')]);router[_0x391b('0xa')](_0x391b('0xd'),auth[_0x391b('0xb')](),controller[_0x391b('0xe')]);router['get'](_0x391b('0xf'),auth[_0x391b('0xb')](),controller['show']);router[_0x391b('0x10')]('/',auth['isAuthenticated'](),controller[_0x391b('0x11')]);router[_0x391b('0x12')]('/:id',auth[_0x391b('0xb')](),controller[_0x391b('0x13')]);router[_0x391b('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x391b('0x15')]);module[_0x391b('0x16')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 9b2c18d..f9ef2a0 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 _0xcabe=['sequelize','STRING','ENUM','agent','queue'];(function(_0x15cbce,_0xda8402){var _0x257f29=function(_0x388132){while(--_0x388132){_0x15cbce['push'](_0x15cbce['shift']());}};_0x257f29(++_0xda8402);}(_0xcabe,0x1ef));var _0xecab=function(_0x2a1415,_0x45276b){_0x2a1415=_0x2a1415-0x0;var _0xa6735a=_0xcabe[_0x2a1415];return _0xa6735a;};'use strict';var Sequelize=require(_0xecab('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xecab('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xecab('0x2')]('account',_0xecab('0x3'),_0xecab('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xb2f3=['queue','sequelize','exports','STRING','ENUM','account','agent'];(function(_0x338367,_0xc2ed00){var _0x5ee2b4=function(_0x34968f){while(--_0x34968f){_0x338367['push'](_0x338367['shift']());}};_0x5ee2b4(++_0xc2ed00);}(_0xb2f3,0xfd));var _0x3b2f=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xb2f3[_0x2070da];return _0x4f9fe1;};'use strict';var Sequelize=require(_0x3b2f('0x0'));module[_0x3b2f('0x1')]={'uniqueid':{'type':Sequelize[_0x3b2f('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x3b2f('0x3')](_0x3b2f('0x4'),_0x3b2f('0x5'),_0x3b2f('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 3c1c7dc..bfa5b60 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 _0x884b=['offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','name','send','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','include','findAll','rows','catch','keys','find','create','body','update','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end'];(function(_0x4c7815,_0x2828f3){var _0x3da94f=function(_0x2e4c3c){while(--_0x2e4c3c){_0x4c7815['push'](_0x4c7815['shift']());}};_0x3da94f(++_0x2828f3);}(_0x884b,0x195));var _0xb884=function(_0x314a8c,_0x1c2e8d){_0x314a8c=_0x314a8c-0x0;var _0x1d4607=_0x884b[_0x314a8c];return _0x1d4607;};'use strict';var emlformat=require(_0xb884('0x0'));var rimraf=require(_0xb884('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb884('0x2'));var rp=require(_0xb884('0x3'));var moment=require(_0xb884('0x4'));var BPromise=require(_0xb884('0x5'));var Mustache=require(_0xb884('0x6'));var util=require('util');var path=require(_0xb884('0x7'));var sox=require(_0xb884('0x8'));var csv=require(_0xb884('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb884('0xa'));var _=require(_0xb884('0xb'));var squel=require(_0xb884('0xc'));var crypto=require(_0xb884('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb884('0xe'));var toCsv=require(_0xb884('0x9'));var querystring=require(_0xb884('0xf'));var Papa=require(_0xb884('0x10'));var Redis=require(_0xb884('0x11'));var authService=require(_0xb884('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb884('0x13'));var logger=require(_0xb884('0x14'))(_0xb884('0x15'));var utils=require(_0xb884('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb884('0x17'))['db'];function respondWithStatusCode(_0x412b15,_0x28b71b){_0x28b71b=_0x28b71b||0xcc;return function(_0x18559b){if(_0x18559b){return _0x412b15[_0xb884('0x18')](_0x28b71b);}return _0x412b15[_0xb884('0x19')](_0x28b71b)[_0xb884('0x1a')]();};}function respondWithResult(_0x30e258,_0x1fc799){_0x1fc799=_0x1fc799||0xc8;return function(_0x4c30c5){if(_0x4c30c5){return _0x30e258[_0xb884('0x19')](_0x1fc799)['json'](_0x4c30c5);}};}function respondWithFilteredResult(_0x51f1a4,_0x11c02b){return function(_0x33b3f1){if(_0x33b3f1){var _0x36ea27=typeof _0x11c02b[_0xb884('0x1b')]===_0xb884('0x1c')&&typeof _0x11c02b[_0xb884('0x1d')]===_0xb884('0x1c');var _0x1aaba5=_0x33b3f1[_0xb884('0x1e')];var _0x179d61=_0x36ea27?0x0:_0x11c02b[_0xb884('0x1b')];var _0x11e119=_0x36ea27?_0x33b3f1[_0xb884('0x1e')]:_0x11c02b[_0xb884('0x1b')]+_0x11c02b[_0xb884('0x1d')];var _0x1ac99a;if(_0x11e119>=_0x1aaba5){_0x11e119=_0x1aaba5;_0x1ac99a=0xc8;}else{_0x1ac99a=0xce;}_0x51f1a4['status'](_0x1ac99a);return _0x51f1a4['set'](_0xb884('0x1f'),_0x179d61+'-'+_0x11e119+'/'+_0x1aaba5)['json'](_0x33b3f1);}return null;};}function patchUpdates(_0x3747f9){return function(_0x3b2534){try{jsonpatch[_0xb884('0x20')](_0x3b2534,_0x3747f9,!![]);}catch(_0x1ba7f4){return BPromise[_0xb884('0x21')](_0x1ba7f4);}return _0x3b2534['save']();};}function saveUpdates(_0x10d5b1,_0x47b79b){return function(_0x2eaaf6){if(_0x2eaaf6){return _0x2eaaf6['update'](_0x10d5b1)[_0xb884('0x22')](function(_0x3acfe6){return _0x3acfe6;});}return null;};}function removeEntity(_0x73bcb,_0x39b583){return function(_0x438a32){if(_0x438a32){return _0x438a32[_0xb884('0x23')]()[_0xb884('0x22')](function(){_0x73bcb['status'](0xcc)[_0xb884('0x1a')]();});}};}function handleEntityNotFound(_0x19788d,_0x3fee55){return function(_0x45912c){if(!_0x45912c){_0x19788d[_0xb884('0x18')](0x194);}return _0x45912c;};}function handleError(_0x1e33d1,_0x5490fe){_0x5490fe=_0x5490fe||0x1f4;return function(_0x2380fc){logger['error'](_0x2380fc['stack']);if(_0x2380fc[_0xb884('0x24')]){delete _0x2380fc[_0xb884('0x24')];}_0x1e33d1['status'](_0x5490fe)[_0xb884('0x25')](_0x2380fc);};}exports['index']=function(_0x1eea77,_0x58aa82){var _0x5c26ca={},_0x1be079={},_0x434b4e={'count':0x0,'rows':[]};var _0x166f57=_[_0xb884('0x26')](db[_0xb884('0x27')][_0xb884('0x28')],function(_0x4e1894){return{'name':_0x4e1894[_0xb884('0x29')],'type':_0x4e1894[_0xb884('0x2a')][_0xb884('0x2b')]};});_0x1be079['model']=_[_0xb884('0x26')](_0x166f57,'name');_0x1be079[_0xb884('0x2c')]=_['keys'](_0x1eea77[_0xb884('0x2c')]);_0x1be079[_0xb884('0x2d')]=_[_0xb884('0x2e')](_0x1be079['model'],_0x1be079['query']);_0x5c26ca['attributes']=_[_0xb884('0x2e')](_0x1be079[_0xb884('0x2f')],qs[_0xb884('0x30')](_0x1eea77[_0xb884('0x2c')][_0xb884('0x30')]));_0x5c26ca[_0xb884('0x31')]=_0x5c26ca[_0xb884('0x31')][_0xb884('0x32')]?_0x5c26ca[_0xb884('0x31')]:_0x1be079[_0xb884('0x2f')];if(!_0x1eea77[_0xb884('0x2c')][_0xb884('0x33')](_0xb884('0x34'))){_0x5c26ca[_0xb884('0x1d')]=qs[_0xb884('0x1d')](_0x1eea77[_0xb884('0x2c')][_0xb884('0x1d')]);_0x5c26ca[_0xb884('0x1b')]=qs[_0xb884('0x1b')](_0x1eea77[_0xb884('0x2c')]['offset']);}_0x5c26ca[_0xb884('0x35')]=qs[_0xb884('0x36')](_0x1eea77[_0xb884('0x2c')][_0xb884('0x36')]);_0x5c26ca[_0xb884('0x37')]=qs['filters'](_[_0xb884('0x38')](_0x1eea77[_0xb884('0x2c')],_0x1be079[_0xb884('0x2d')]),_0x166f57);if(_0x1eea77[_0xb884('0x2c')]['filter']){_0x5c26ca[_0xb884('0x37')]=_['merge'](_0x5c26ca['where'],{'$or':_[_0xb884('0x26')](_0x166f57,function(_0xd7cd){if(_0xd7cd[_0xb884('0x2a')]!==_0xb884('0x39')){var _0x291240={};_0x291240[_0xd7cd[_0xb884('0x24')]]={'$like':'%'+_0x1eea77['query'][_0xb884('0x3a')]+'%'};return _0x291240;}})});}_0x5c26ca=_[_0xb884('0x3b')]({},_0x5c26ca,_0x1eea77[_0xb884('0x3c')]);var _0x2b4ccf={'where':_0x5c26ca['where']};return db[_0xb884('0x27')][_0xb884('0x1e')](_0x2b4ccf)[_0xb884('0x22')](function(_0x15c475){_0x434b4e[_0xb884('0x1e')]=_0x15c475;if(_0x1eea77[_0xb884('0x2c')]['includeAll']){_0x5c26ca[_0xb884('0x3d')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0xb884('0x3e')](_0x5c26ca);})[_0xb884('0x22')](function(_0x2ba2a2){_0x434b4e[_0xb884('0x3f')]=_0x2ba2a2;return _0x434b4e;})['then'](respondWithFilteredResult(_0x58aa82,_0x5c26ca))[_0xb884('0x40')](handleError(_0x58aa82,null));};exports['show']=function(_0x1bcfc7,_0x237a80){var _0x5e9d07={'raw':!![],'where':{'id':_0x1bcfc7['params']['id']}},_0x2f08ff={};_0x2f08ff[_0xb884('0x2f')]=_[_0xb884('0x41')](db[_0xb884('0x27')][_0xb884('0x28')]);_0x2f08ff[_0xb884('0x2c')]=_['keys'](_0x1bcfc7[_0xb884('0x2c')]);_0x2f08ff[_0xb884('0x2d')]=_[_0xb884('0x2e')](_0x2f08ff['model'],_0x2f08ff[_0xb884('0x2c')]);_0x5e9d07[_0xb884('0x31')]=_[_0xb884('0x2e')](_0x2f08ff[_0xb884('0x2f')],qs['fields'](_0x1bcfc7['query']['fields']));_0x5e9d07[_0xb884('0x31')]=_0x5e9d07[_0xb884('0x31')][_0xb884('0x32')]?_0x5e9d07[_0xb884('0x31')]:_0x2f08ff[_0xb884('0x2f')];if(_0x1bcfc7[_0xb884('0x2c')]['includeAll']){_0x5e9d07[_0xb884('0x3d')]=[{'all':!![]}];}_0x5e9d07=_['merge']({},_0x5e9d07,_0x1bcfc7[_0xb884('0x3c')]);return db['WhatsappTransferReport'][_0xb884('0x42')](_0x5e9d07)[_0xb884('0x22')](handleEntityNotFound(_0x237a80,null))['then'](respondWithResult(_0x237a80,null))[_0xb884('0x40')](handleError(_0x237a80,null));};exports[_0xb884('0x43')]=function(_0x537753,_0x52b889){return db[_0xb884('0x27')]['create'](_0x537753[_0xb884('0x44')],{})['then'](respondWithResult(_0x52b889,0xc9))[_0xb884('0x40')](handleError(_0x52b889,null));};exports[_0xb884('0x45')]=function(_0x566e69,_0x294f76){if(_0x566e69['body']['id']){delete _0x566e69[_0xb884('0x44')]['id'];}return db[_0xb884('0x27')]['find']({'where':{'id':_0x566e69[_0xb884('0x46')]['id']}})[_0xb884('0x22')](handleEntityNotFound(_0x294f76,null))['then'](saveUpdates(_0x566e69[_0xb884('0x44')],null))['then'](respondWithResult(_0x294f76,null))['catch'](handleError(_0x294f76,null));};exports[_0xb884('0x23')]=function(_0x1b7ccc,_0x1adaa5){return db[_0xb884('0x27')][_0xb884('0x42')]({'where':{'id':_0x1b7ccc[_0xb884('0x46')]['id']}})['then'](handleEntityNotFound(_0x1adaa5,null))['then'](removeEntity(_0x1adaa5,null))[_0xb884('0x40')](handleError(_0x1adaa5,null));};exports[_0xb884('0x47')]=function(_0x564050,_0x42981b){return db[_0xb884('0x27')][_0xb884('0x47')]()[_0xb884('0x22')](respondWithResult(_0x42981b,null))[_0xb884('0x40')](handleError(_0x42981b,null));}; \ No newline at end of file +var _0x973f=['sort','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','fields','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','sendStatus','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','length','order'];(function(_0x4e60f8,_0x33a106){var _0x1255c6=function(_0x469b48){while(--_0x469b48){_0x4e60f8['push'](_0x4e60f8['shift']());}};_0x1255c6(++_0x33a106);}(_0x973f,0x18d));var _0xf973=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x973f[_0x2064e5];return _0x21a233;};'use strict';var emlformat=require(_0xf973('0x0'));var rimraf=require(_0xf973('0x1'));var zipdir=require(_0xf973('0x2'));var jsonpatch=require(_0xf973('0x3'));var rp=require(_0xf973('0x4'));var moment=require(_0xf973('0x5'));var BPromise=require(_0xf973('0x6'));var Mustache=require('mustache');var util=require(_0xf973('0x7'));var path=require('path');var sox=require(_0xf973('0x8'));var csv=require(_0xf973('0x9'));var ejs=require(_0xf973('0xa'));var fs=require('fs');var fs_extra=require(_0xf973('0xb'));var _=require('lodash');var squel=require(_0xf973('0xc'));var crypto=require(_0xf973('0xd'));var jsforce=require(_0xf973('0xe'));var deskjs=require(_0xf973('0xf'));var toCsv=require(_0xf973('0x9'));var querystring=require('querystring');var Papa=require(_0xf973('0x10'));var Redis=require(_0xf973('0x11'));var authService=require(_0xf973('0x12'));var qs=require(_0xf973('0x13'));var as=require(_0xf973('0x14'));var hardwareService=require(_0xf973('0x15'));var logger=require('../../config/logger')(_0xf973('0x16'));var utils=require(_0xf973('0x17'));var config=require(_0xf973('0x18'));var licenseUtil=require(_0xf973('0x19'));var db=require(_0xf973('0x1a'))['db'];function respondWithStatusCode(_0x359703,_0x39ab5e){_0x39ab5e=_0x39ab5e||0xcc;return function(_0xe33a78){if(_0xe33a78){return _0x359703['sendStatus'](_0x39ab5e);}return _0x359703[_0xf973('0x1b')](_0x39ab5e)[_0xf973('0x1c')]();};}function respondWithResult(_0x448ce0,_0x1da223){_0x1da223=_0x1da223||0xc8;return function(_0x166765){if(_0x166765){return _0x448ce0['status'](_0x1da223)[_0xf973('0x1d')](_0x166765);}};}function respondWithFilteredResult(_0x824794,_0x5a3a60){return function(_0x2bf956){if(_0x2bf956){var _0x39ad02=typeof _0x5a3a60[_0xf973('0x1e')]===_0xf973('0x1f')&&typeof _0x5a3a60['limit']===_0xf973('0x1f');var _0x334b64=_0x2bf956[_0xf973('0x20')];var _0x23693e=_0x39ad02?0x0:_0x5a3a60[_0xf973('0x1e')];var _0x4ccf53=_0x39ad02?_0x2bf956[_0xf973('0x20')]:_0x5a3a60[_0xf973('0x1e')]+_0x5a3a60[_0xf973('0x21')];var _0x4e98c2;if(_0x4ccf53>=_0x334b64){_0x4ccf53=_0x334b64;_0x4e98c2=0xc8;}else{_0x4e98c2=0xce;}_0x824794[_0xf973('0x1b')](_0x4e98c2);return _0x824794[_0xf973('0x22')](_0xf973('0x23'),_0x23693e+'-'+_0x4ccf53+'/'+_0x334b64)[_0xf973('0x1d')](_0x2bf956);}return null;};}function patchUpdates(_0x980eac){return function(_0x76e82e){try{jsonpatch['apply'](_0x76e82e,_0x980eac,!![]);}catch(_0x36c1bd){return BPromise[_0xf973('0x24')](_0x36c1bd);}return _0x76e82e[_0xf973('0x25')]();};}function saveUpdates(_0x1f7317,_0x3af519){return function(_0x175cf7){if(_0x175cf7){return _0x175cf7[_0xf973('0x26')](_0x1f7317)[_0xf973('0x27')](function(_0x4aa2ea){return _0x4aa2ea;});}return null;};}function removeEntity(_0xcc3f80,_0x49fc20){return function(_0x3284b8){if(_0x3284b8){return _0x3284b8['destroy']()[_0xf973('0x27')](function(){_0xcc3f80[_0xf973('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x173a39,_0x687420){return function(_0x147446){if(!_0x147446){_0x173a39[_0xf973('0x28')](0x194);}return _0x147446;};}function handleError(_0x11dde0,_0x12a202){_0x12a202=_0x12a202||0x1f4;return function(_0x201803){logger[_0xf973('0x29')](_0x201803[_0xf973('0x2a')]);if(_0x201803[_0xf973('0x2b')]){delete _0x201803[_0xf973('0x2b')];}_0x11dde0[_0xf973('0x1b')](_0x12a202)[_0xf973('0x2c')](_0x201803);};}exports[_0xf973('0x2d')]=function(_0x353a2b,_0x385920){var _0x1eb99c={},_0x582c27={},_0x5d5521={'count':0x0,'rows':[]};var _0x5c4532=_[_0xf973('0x2e')](db[_0xf973('0x2f')][_0xf973('0x30')],function(_0x4d9ae6){return{'name':_0x4d9ae6['fieldName'],'type':_0x4d9ae6[_0xf973('0x31')][_0xf973('0x32')]};});_0x582c27['model']=_[_0xf973('0x2e')](_0x5c4532,_0xf973('0x2b'));_0x582c27[_0xf973('0x33')]=_[_0xf973('0x34')](_0x353a2b[_0xf973('0x33')]);_0x582c27[_0xf973('0x35')]=_[_0xf973('0x36')](_0x582c27[_0xf973('0x37')],_0x582c27[_0xf973('0x33')]);_0x1eb99c[_0xf973('0x38')]=_['intersection'](_0x582c27[_0xf973('0x37')],qs['fields'](_0x353a2b[_0xf973('0x33')]['fields']));_0x1eb99c[_0xf973('0x38')]=_0x1eb99c[_0xf973('0x38')][_0xf973('0x39')]?_0x1eb99c['attributes']:_0x582c27[_0xf973('0x37')];if(!_0x353a2b[_0xf973('0x33')]['hasOwnProperty']('nolimit')){_0x1eb99c['limit']=qs[_0xf973('0x21')](_0x353a2b[_0xf973('0x33')][_0xf973('0x21')]);_0x1eb99c[_0xf973('0x1e')]=qs[_0xf973('0x1e')](_0x353a2b[_0xf973('0x33')][_0xf973('0x1e')]);}_0x1eb99c[_0xf973('0x3a')]=qs['sort'](_0x353a2b[_0xf973('0x33')][_0xf973('0x3b')]);_0x1eb99c['where']=qs[_0xf973('0x35')](_['pick'](_0x353a2b[_0xf973('0x33')],_0x582c27[_0xf973('0x35')]),_0x5c4532);if(_0x353a2b[_0xf973('0x33')][_0xf973('0x3c')]){_0x1eb99c['where']=_['merge'](_0x1eb99c[_0xf973('0x3d')],{'$or':_[_0xf973('0x2e')](_0x5c4532,function(_0x360727){if(_0x360727[_0xf973('0x31')]!==_0xf973('0x3e')){var _0x2d38b4={};_0x2d38b4[_0x360727[_0xf973('0x2b')]]={'$like':'%'+_0x353a2b[_0xf973('0x33')][_0xf973('0x3c')]+'%'};return _0x2d38b4;}})});}_0x1eb99c=_[_0xf973('0x3f')]({},_0x1eb99c,_0x353a2b[_0xf973('0x40')]);var _0x2402b1={'where':_0x1eb99c[_0xf973('0x3d')]};return db[_0xf973('0x2f')][_0xf973('0x20')](_0x2402b1)['then'](function(_0x1c3ca2){_0x5d5521[_0xf973('0x20')]=_0x1c3ca2;if(_0x353a2b[_0xf973('0x33')][_0xf973('0x41')]){_0x1eb99c[_0xf973('0x42')]=[{'all':!![]}];}return db[_0xf973('0x2f')]['findAll'](_0x1eb99c);})[_0xf973('0x27')](function(_0x5c33ce){_0x5d5521[_0xf973('0x43')]=_0x5c33ce;return _0x5d5521;})[_0xf973('0x27')](respondWithFilteredResult(_0x385920,_0x1eb99c))[_0xf973('0x44')](handleError(_0x385920,null));};exports[_0xf973('0x45')]=function(_0x401561,_0x4c92af){var _0x485c08={'raw':!![],'where':{'id':_0x401561[_0xf973('0x46')]['id']}},_0x4b151d={};_0x4b151d[_0xf973('0x37')]=_[_0xf973('0x34')](db['WhatsappTransferReport'][_0xf973('0x30')]);_0x4b151d[_0xf973('0x33')]=_[_0xf973('0x34')](_0x401561[_0xf973('0x33')]);_0x4b151d[_0xf973('0x35')]=_['intersection'](_0x4b151d[_0xf973('0x37')],_0x4b151d[_0xf973('0x33')]);_0x485c08[_0xf973('0x38')]=_['intersection'](_0x4b151d[_0xf973('0x37')],qs[_0xf973('0x47')](_0x401561[_0xf973('0x33')][_0xf973('0x47')]));_0x485c08[_0xf973('0x38')]=_0x485c08[_0xf973('0x38')][_0xf973('0x39')]?_0x485c08[_0xf973('0x38')]:_0x4b151d[_0xf973('0x37')];if(_0x401561[_0xf973('0x33')][_0xf973('0x41')]){_0x485c08['include']=[{'all':!![]}];}_0x485c08=_[_0xf973('0x3f')]({},_0x485c08,_0x401561[_0xf973('0x40')]);return db[_0xf973('0x2f')][_0xf973('0x48')](_0x485c08)['then'](handleEntityNotFound(_0x4c92af,null))[_0xf973('0x27')](respondWithResult(_0x4c92af,null))['catch'](handleError(_0x4c92af,null));};exports[_0xf973('0x49')]=function(_0x37fce5,_0x14db2d){return db[_0xf973('0x2f')][_0xf973('0x49')](_0x37fce5[_0xf973('0x4a')],{})[_0xf973('0x27')](respondWithResult(_0x14db2d,0xc9))[_0xf973('0x44')](handleError(_0x14db2d,null));};exports[_0xf973('0x26')]=function(_0xb0b06b,_0x37d92f){if(_0xb0b06b[_0xf973('0x4a')]['id']){delete _0xb0b06b[_0xf973('0x4a')]['id'];}return db['WhatsappTransferReport'][_0xf973('0x48')]({'where':{'id':_0xb0b06b['params']['id']}})['then'](handleEntityNotFound(_0x37d92f,null))[_0xf973('0x27')](saveUpdates(_0xb0b06b[_0xf973('0x4a')],null))[_0xf973('0x27')](respondWithResult(_0x37d92f,null))[_0xf973('0x44')](handleError(_0x37d92f,null));};exports['destroy']=function(_0x329fc4,_0x128d74){return db[_0xf973('0x2f')]['find']({'where':{'id':_0x329fc4[_0xf973('0x46')]['id']}})[_0xf973('0x27')](handleEntityNotFound(_0x128d74,null))['then'](removeEntity(_0x128d74,null))[_0xf973('0x44')](handleError(_0x128d74,null));};exports['describe']=function(_0x577b0c,_0x113a9c){return db[_0xf973('0x2f')][_0xf973('0x4b')]()['then'](respondWithResult(_0x113a9c,null))[_0xf973('0x44')](handleError(_0x113a9c,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 4fce332..0529e9f 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 _0x0098=['api','moment','bluebird','request-promise','../../config/environment','./whatsappTransferReport.attributes','exports','WhatsappTransferReport','uniqueid','util'];(function(_0x48accc,_0x3142e9){var _0x460cc4=function(_0x4af897){while(--_0x4af897){_0x48accc['push'](_0x48accc['shift']());}};_0x460cc4(++_0x3142e9);}(_0x0098,0x17b));var _0x8009=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x0098[_0x3d42d8];return _0x27fc41;};'use strict';var _=require('lodash');var util=require(_0x8009('0x0'));var logger=require('../../config/logger')(_0x8009('0x1'));var moment=require(_0x8009('0x2'));var BPromise=require(_0x8009('0x3'));var rp=require(_0x8009('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8009('0x5'));var attributes=require(_0x8009('0x6'));module[_0x8009('0x7')]=function(_0x292c7d,_0xbad68e){return _0x292c7d['define'](_0x8009('0x8'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x8009('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc5ec=['uniqueid','lodash','util','../../config/logger','bluebird','request-promise','../../config/environment','./whatsappTransferReport.attributes','exports','define','report_whatsapp_transfer'];(function(_0xbf4ae7,_0x1044b0){var _0x18cb4e=function(_0xea6d34){while(--_0xea6d34){_0xbf4ae7['push'](_0xbf4ae7['shift']());}};_0x18cb4e(++_0x1044b0);}(_0xc5ec,0x140));var _0xcc5e=function(_0x2cfe12,_0x16cc22){_0x2cfe12=_0x2cfe12-0x0;var _0x8647d9=_0xc5ec[_0x2cfe12];return _0x8647d9;};'use strict';var _=require(_0xcc5e('0x0'));var util=require(_0xcc5e('0x1'));var logger=require(_0xcc5e('0x2'))('api');var moment=require('moment');var BPromise=require(_0xcc5e('0x3'));var rp=require(_0xcc5e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcc5e('0x5'));var attributes=require(_0xcc5e('0x6'));module[_0xcc5e('0x7')]=function(_0x58a98a,_0x1bd547){return _0x58a98a[_0xcc5e('0x8')]('WhatsappTransferReport',attributes,{'tableName':_0xcc5e('0x9'),'paranoid':![],'indexes':[{'name':_0xcc5e('0xa'),'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 eda5a6e..8e6eec3 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 _0xf4a7=['info','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','WhatsappTransferReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then'];(function(_0x5ecb82,_0x2bf30f){var _0x4f8dda=function(_0x34c198){while(--_0x34c198){_0x5ecb82['push'](_0x5ecb82['shift']());}};_0x4f8dda(++_0x2bf30f);}(_0xf4a7,0x72));var _0x7f4a=function(_0x15834d,_0x1feb94){_0x15834d=_0x15834d-0x0;var _0xfe2fa9=_0xf4a7[_0x15834d];return _0xfe2fa9;};'use strict';var _=require('lodash');var util=require(_0x7f4a('0x0'));var moment=require(_0x7f4a('0x1'));var BPromise=require(_0x7f4a('0x2'));var rs=require(_0x7f4a('0x3'));var fs=require('fs');var Redis=require(_0x7f4a('0x4'));var db=require(_0x7f4a('0x5'))['db'];var utils=require(_0x7f4a('0x6'));var logger=require('../../config/logger')(_0x7f4a('0x7'));var config=require(_0x7f4a('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7f4a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3bd345,_0x1b6bd6,_0x5df995){return new BPromise(function(_0x63f02e,_0x38c325){return client[_0x7f4a('0xa')](_0x3bd345,_0x5df995)[_0x7f4a('0xb')](function(_0x37ae65){logger[_0x7f4a('0xc')]('WhatsappTransferReport,\x20%s,\x20%s',_0x1b6bd6,_0x7f4a('0xd'));logger[_0x7f4a('0xe')](_0x7f4a('0xf'),_0x1b6bd6,_0x7f4a('0xd'),JSON['stringify'](_0x37ae65));if(_0x37ae65['error']){if(_0x37ae65[_0x7f4a('0x10')]['code']===0x1f4){logger[_0x7f4a('0x10')](_0x7f4a('0x11'),_0x1b6bd6,_0x37ae65[_0x7f4a('0x10')][_0x7f4a('0x12')]);return _0x38c325(_0x37ae65[_0x7f4a('0x10')]['message']);}logger[_0x7f4a('0x10')](_0x7f4a('0x11'),_0x1b6bd6,_0x37ae65[_0x7f4a('0x10')][_0x7f4a('0x12')]);return _0x63f02e(_0x37ae65[_0x7f4a('0x10')][_0x7f4a('0x12')]);}else{logger['info'](_0x7f4a('0x11'),_0x1b6bd6,'request\x20sent');_0x63f02e(_0x37ae65[_0x7f4a('0x13')]['message']);}})[_0x7f4a('0x14')](function(_0x332691){logger[_0x7f4a('0x10')](_0x7f4a('0x11'),_0x1b6bd6,_0x332691);_0x38c325(_0x332691);});});} \ No newline at end of file +var _0x0f5f=['debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info'];(function(_0x5a2dac,_0x5f1c81){var _0x14deec=function(_0x959d5e){while(--_0x959d5e){_0x5a2dac['push'](_0x5a2dac['shift']());}};_0x14deec(++_0x5f1c81);}(_0x0f5f,0x135));var _0xf0f5=function(_0x323d93,_0x235c1f){_0x323d93=_0x323d93-0x0;var _0x4cea93=_0x0f5f[_0x323d93];return _0x4cea93;};'use strict';var _=require(_0xf0f5('0x0'));var util=require(_0xf0f5('0x1'));var moment=require(_0xf0f5('0x2'));var BPromise=require(_0xf0f5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf0f5('0x4'));var db=require(_0xf0f5('0x5'))['db'];var utils=require(_0xf0f5('0x6'));var logger=require(_0xf0f5('0x7'))('rpc');var config=require(_0xf0f5('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf0f5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d702b,_0x3b81f3,_0x107ed0){return new BPromise(function(_0x4a1e54,_0x1f473c){return client[_0xf0f5('0xa')](_0x2d702b,_0x107ed0)[_0xf0f5('0xb')](function(_0x149c71){logger[_0xf0f5('0xc')]('WhatsappTransferReport,\x20%s,\x20%s',_0x3b81f3,'request\x20sent');logger[_0xf0f5('0xd')](_0xf0f5('0xe'),_0x3b81f3,_0xf0f5('0xf'),JSON[_0xf0f5('0x10')](_0x149c71));if(_0x149c71[_0xf0f5('0x11')]){if(_0x149c71['error'][_0xf0f5('0x12')]===0x1f4){logger[_0xf0f5('0x11')](_0xf0f5('0x13'),_0x3b81f3,_0x149c71[_0xf0f5('0x11')][_0xf0f5('0x14')]);return _0x1f473c(_0x149c71[_0xf0f5('0x11')]['message']);}logger[_0xf0f5('0x11')](_0xf0f5('0x13'),_0x3b81f3,_0x149c71[_0xf0f5('0x11')][_0xf0f5('0x14')]);return _0x4a1e54(_0x149c71['error']['message']);}else{logger[_0xf0f5('0xc')](_0xf0f5('0x13'),_0x3b81f3,_0xf0f5('0xf'));_0x4a1e54(_0x149c71[_0xf0f5('0x15')][_0xf0f5('0x14')]);}})[_0xf0f5('0x16')](function(_0x339f39){logger[_0xf0f5('0x11')](_0xf0f5('0x13'),_0x3b81f3,_0x339f39);_0x1f473c(_0x339f39);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 85bfac3..a66d19a 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdded=['./config/seedDB','./config/license','./rpc','./config/environment','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','default','listen','start','info','filter','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','online','Offline\x20apps:','status','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','exit','lodash','./mysqldb'];(function(_0x2d0661,_0x3c4de6){var _0x2fd8ca=function(_0x436d42){while(--_0x436d42){_0x2d0661['push'](_0x2d0661['shift']());}};_0x2fd8ca(++_0x3c4de6);}(_0xdded,0x17a));var _0xddde=function(_0x4202b2,_0x7c754e){_0x4202b2=_0x4202b2-0x0;var _0x5632e0=_0xdded[_0x4202b2];return _0x5632e0;};'use strict';var _=require(_0xddde('0x0'));var db=require(_0xddde('0x1'))['db'];var seedDb=require(_0xddde('0x2'));var checkLicense=require(_0xddde('0x3'));var rpc=require(_0xddde('0x4'));var config=require(_0xddde('0x5'));var logger=require('./config/logger')(_0xddde('0x6'));var pm2=require(_0xddde('0x7'));var pm2Config=require(_0xddde('0x8'));var schedule=require(_0xddde('0x9'));var chat=require(_0xddde('0xa'));var whatsapp=require(_0xddde('0xb'));var transcribe=require(_0xddde('0xc'));var provider=require(_0xddde('0xd'));function main(){return db[_0xddde('0xe')][_0xddde('0xf')]()[_0xddde('0x10')](function(){if(config['seedDB']){return seedDb[_0xddde('0x11')]();}})['then'](function(){return checkLicense['default']();})['then'](function(){return rpc[_0xddde('0x12')]();})['then'](function(_0x247097){logger['info'](_0x247097);return chat[_0xddde('0x13')]();})[_0xddde('0x10')](function(){return whatsapp[_0xddde('0x13')]();})[_0xddde('0x10')](function(){return schedule[_0xddde('0x13')]();})[_0xddde('0x10')](function(){return transcribe[_0xddde('0x13')]();})[_0xddde('0x10')](function(){return provider['start']();})[_0xddde('0x10')](function(_0x218779){logger[_0xddde('0x14')](_0x218779);return pm2[_0xddde('0x13')](pm2Config);})[_0xddde('0x10')](function(_0x31c111){var _0x491be5=_0x31c111[_0xddde('0x15')](function(_0xbe1df5){return typeof _0xbe1df5[_0xddde('0x16')]==='number'&&_0xbe1df5['exitCode']>=0x0;});if(_0x491be5[_0xddde('0x17')]>0x0){throw new Error(_0x491be5['length']+_0xddde('0x18')+_[_0xddde('0x19')](_0x491be5,function(_0x338fa7){return'\x22'+_0x338fa7[_0xddde('0x1a')][_0xddde('0x1b')]+'\x22';}));}logger['info'](_0xddde('0x1c'),_[_0xddde('0x19')](_['filter'](_0x31c111,{'status':_0xddde('0x1d')}),_0xddde('0x1b'))['join']());logger['info'](_0xddde('0x1e'),_['map'](_[_0xddde('0x15')](_0x31c111,function(_0x5175bd){return _0x5175bd[_0xddde('0x1f')]!==_0xddde('0x1d');}),'name')['join']()||_0xddde('0x20'));console[_0xddde('0x21')](_0xddde('0x22'));})[_0xddde('0x23')](function(_0x2a3ea5){console[_0xddde('0x21')](_0xddde('0x24'),_0x2a3ea5);logger['error']('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x2a3ea5);process[_0xddde('0x25')](0x1);});}main(); \ No newline at end of file +var _0x6bac=['lodash','./config/seedDB','./config/license','./rpc','./config/environment','./config/pm2/config','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','info','start','filter','exitCode','number','length','Online\x20apps:','online','join','map','status','name','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit'];(function(_0x56b316,_0x515c05){var _0x3d9d21=function(_0x43cc43){while(--_0x43cc43){_0x56b316['push'](_0x56b316['shift']());}};_0x3d9d21(++_0x515c05);}(_0x6bac,0xa5));var _0xc6ba=function(_0x56df4f,_0x5e9aef){_0x56df4f=_0x56df4f-0x0;var _0x107007=_0x6bac[_0x56df4f];return _0x107007;};'use strict';var _=require(_0xc6ba('0x0'));var db=require('./mysqldb')['db'];var seedDb=require(_0xc6ba('0x1'));var checkLicense=require(_0xc6ba('0x2'));var rpc=require(_0xc6ba('0x3'));var config=require(_0xc6ba('0x4'));var logger=require('./config/logger')('app');var pm2=require('./config/pm2');var pm2Config=require(_0xc6ba('0x5'));var schedule=require(_0xc6ba('0x6'));var chat=require('./config/schedule/chat');var whatsapp=require(_0xc6ba('0x7'));var transcribe=require(_0xc6ba('0x8'));var provider=require(_0xc6ba('0x9'));function main(){return db[_0xc6ba('0xa')][_0xc6ba('0xb')]()[_0xc6ba('0xc')](function(){if(config['seedDB']){return seedDb['default']();}})[_0xc6ba('0xc')](function(){return checkLicense['default']();})['then'](function(){return rpc['listen']();})['then'](function(_0x58adfc){logger[_0xc6ba('0xd')](_0x58adfc);return chat[_0xc6ba('0xe')]();})[_0xc6ba('0xc')](function(){return whatsapp[_0xc6ba('0xe')]();})[_0xc6ba('0xc')](function(){return schedule['start']();})['then'](function(){return transcribe[_0xc6ba('0xe')]();})[_0xc6ba('0xc')](function(){return provider[_0xc6ba('0xe')]();})[_0xc6ba('0xc')](function(_0x2c866f){logger['info'](_0x2c866f);return pm2['start'](pm2Config);})['then'](function(_0x2f6e76){var _0x405677=_0x2f6e76[_0xc6ba('0xf')](function(_0x342007){return typeof _0x342007[_0xc6ba('0x10')]===_0xc6ba('0x11')&&_0x342007[_0xc6ba('0x10')]>=0x0;});if(_0x405677[_0xc6ba('0x12')]>0x0){throw new Error(_0x405677['length']+'\x20processes\x20failed\x20at\x20startup:\x20'+_['map'](_0x405677,function(_0x488fb4){return'\x22'+_0x488fb4['pm2_env']['name']+'\x22';}));}logger[_0xc6ba('0xd')](_0xc6ba('0x13'),_['map'](_['filter'](_0x2f6e76,{'status':_0xc6ba('0x14')}),'name')[_0xc6ba('0x15')]());logger[_0xc6ba('0xd')]('Offline\x20apps:',_[_0xc6ba('0x16')](_[_0xc6ba('0xf')](_0x2f6e76,function(_0x4a463e){return _0x4a463e[_0xc6ba('0x17')]!==_0xc6ba('0x14');}),_0xc6ba('0x18'))[_0xc6ba('0x15')]()||_0xc6ba('0x19'));console[_0xc6ba('0x1a')](_0xc6ba('0x1b'));})[_0xc6ba('0x1c')](function(_0x2d52ea){console[_0xc6ba('0x1a')](_0xc6ba('0x1d'),_0x2d52ea);logger[_0xc6ba('0x1e')](_0xc6ba('0x1f'),_0x2d52ea);process[_0xc6ba('0x20')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 209968a..e556905 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 _0x9c44=['showWebBar','lastLoginAt','crudPermissions','allowmessenger','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','settingsEnabled','wssPort','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswerDelay','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','user','ChatInteraction','findOne','params','then','status','disposition','unmanaged','json','Unmanaged.','catch','isAuthenticated','headers','authorization','startsWith','Basic','authenticate','pass','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','User','find','sub','Setting','allowedLoginAttempts','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blocked','blockDuration','blockedAt','add','minutes','use','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','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','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','unshift','encryptString','sign','options','promisify','toString','hex','floor','now','HS512','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','crypto','util','moment','secrets','session','role','name','internal','email','userpic','voicePause','chatPause','faxPause','smsPause'];(function(_0x141e03,_0x18340e){var _0x2074e3=function(_0x2b7ece){while(--_0x2b7ece){_0x141e03['push'](_0x141e03['shift']());}};_0x2074e3(++_0x18340e);}(_0x9c44,0x178));var _0x49c4=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9c44[_0x167cc1];return _0x10bc4b;};'use strict';var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var hardwareConf=require(_0x49c4('0x0'));var licenseUtil=require(_0x49c4('0x1'));var encryptor=require(_0x49c4('0x2'));var _=require(_0x49c4('0x3'));var jwt=require(_0x49c4('0x4'));var expressJwt=require(_0x49c4('0x5'));var compose=require('composable-middleware');var basicAuth=require('basic-auth');var crypto=require(_0x49c4('0x6'));var BPromise=require('bluebird');var util=require(_0x49c4('0x7'));var moment=require(_0x49c4('0x8'));var validateJwt=expressJwt({'secret':config[_0x49c4('0x9')][_0x49c4('0xa')]});var userAttributes=['id',_0x49c4('0xb'),'fullname',_0x49c4('0xc'),_0x49c4('0xd'),_0x49c4('0xe'),_0x49c4('0xf'),'permissions','md5secret',_0x49c4('0x10'),_0x49c4('0x11'),'mailPause',_0x49c4('0x12'),_0x49c4('0x13'),'openchannelPause','pauseType',_0x49c4('0x14'),_0x49c4('0x15'),'lastPauseAt',_0x49c4('0x16'),_0x49c4('0x17'),'passwordResetAt',_0x49c4('0x18'),_0x49c4('0x19'),_0x49c4('0x1a'),_0x49c4('0x1b'),_0x49c4('0x1c'),_0x49c4('0x1d'),_0x49c4('0x1e'),_0x49c4('0x1f'),'phoneBarPrefixRequired',_0x49c4('0x20'),_0x49c4('0x21'),_0x49c4('0x22'),_0x49c4('0x23'),_0x49c4('0x24'),'privacyEnabled',_0x49c4('0x25'),_0x49c4('0x26'),'downloadVoiceRecordings','downloadOmnichannelInteractions',_0x49c4('0x27'),_0x49c4('0x28'),_0x49c4('0x29'),'chatAutoanswer',_0x49c4('0x2a'),'emailAutoanswer',_0x49c4('0x2b'),_0x49c4('0x2c'),_0x49c4('0x2d'),_0x49c4('0x2e'),_0x49c4('0x2f'),_0x49c4('0x30'),_0x49c4('0x31'),_0x49c4('0x32'),_0x49c4('0x33')];exports['isChatInteractionAuthorized']=function(){return this['isAuthenticated'](!![])['use'](function(_0x1c99b1,_0x4f0b62,_0x592bb8){if(_0x1c99b1[_0x49c4('0x34')]){_0x592bb8();}else{return db[_0x49c4('0x35')][_0x49c4('0x36')]({'where':{'id':_0x1c99b1[_0x49c4('0x37')]['id']},'attributes':['id','closed','disposition'],'raw':!![]})[_0x49c4('0x38')](function(_0x9cb797){if(_0x9cb797&&_0x9cb797['closed']){return _0x4f0b62[_0x49c4('0x39')](_0x9cb797[_0x49c4('0x3a')]===_0x49c4('0x3b')?0x195:0x193)[_0x49c4('0x3c')]({'message':_0x9cb797['disposition']==='unmanaged'?_0x49c4('0x3d'):'Forbidden.'});}else{_0x592bb8();}})[_0x49c4('0x3e')](function(_0x3852b2){_0x592bb8(_0x3852b2);});}});};exports[_0x49c4('0x3f')]=function isAuthenticated(_0x372a47){return compose()['use'](function(_0x889909,_0x2b2793,_0x46e04d){var _0x4f28a2;if(_0x889909[_0x49c4('0x40')][_0x49c4('0x41')]){if(_[_0x49c4('0x42')](_0x889909[_0x49c4('0x40')][_0x49c4('0x41')],_0x49c4('0x43'))){var _0x46f7ea=basicAuth(_0x889909);db['User']['find']({'where':{'name':_0x46f7ea['name']}})[_0x49c4('0x38')](function(_0x7ee704){if(!_0x7ee704||!_0x7ee704[_0x49c4('0x44')](_0x46f7ea[_0x49c4('0x45')])){return _0x2b2793[_0x49c4('0x39')](0x191)['json']({'message':_0x49c4('0x46')});}_0x889909[_0x49c4('0x34')]={'id':_0x7ee704['id']};_0x46e04d();})[_0x49c4('0x3e')](function(_0x24bba9){_0x46e04d(_0x24bba9);});}else if(_['startsWith'](_0x889909['headers'][_0x49c4('0x41')],_0x49c4('0x47'))){validateJwt(_0x889909,_0x2b2793,_0x46e04d);}else{if(_0x372a47){_0x46e04d();}else{return _0x2b2793[_0x49c4('0x39')](0x193)[_0x49c4('0x3c')]({'message':_0x49c4('0x48')});}}}else if(_0x889909['query'][_0x49c4('0x49')]){try{var _0x84c621={'audience':hardwareConf[_0x49c4('0x4a')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x889909['query'][_0x49c4('0x49')],_0x84c621)[_0x49c4('0x38')](function(_0x3bec0a){return db[_0x49c4('0x4b')][_0x49c4('0x4c')]({'where':{'id':_0x3bec0a[_0x49c4('0x4d')]}})[_0x49c4('0x38')](function(_0x27ef5f){_0x4f28a2=_0x27ef5f;return db[_0x49c4('0x4e')]['findOne']({'where':{'id':0x1},'attributes':[_0x49c4('0x4f'),'blockDuration'],'raw':!![]});})[_0x49c4('0x38')](function(_0x349791){if(!_0x4f28a2||!_[_0x49c4('0x50')](_0x4f28a2[_0x49c4('0x51')],_0x3bec0a['nonce'])){return _0x2b2793[_0x49c4('0x39')](0x191)[_0x49c4('0x3c')]({'message':_0x49c4('0x52')});}if(_0x4f28a2['disabled']){return _0x2b2793[_0x49c4('0x39')](0x191)[_0x49c4('0x3c')]({'message':_0x49c4('0x53')});}if(_0x4f28a2[_0x49c4('0x54')]){if(_0x349791[_0x49c4('0x55')]>0x0){if(moment(_0x4f28a2[_0x49c4('0x56')])[_0x49c4('0x57')](_0x349791[_0x49c4('0x55')],_0x49c4('0x58'))>moment()){return _0x2b2793[_0x49c4('0x39')](0x191)[_0x49c4('0x3c')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x2b2793[_0x49c4('0x39')](0x191)[_0x49c4('0x3c')]({'message':_0x49c4('0x53')});}}_0x889909[_0x49c4('0x34')]={'id':_0x4f28a2['id']};_0x46e04d();});})[_0x49c4('0x3e')](function(){return _0x2b2793[_0x49c4('0x39')](0x191)[_0x49c4('0x3c')]({'message':_0x49c4('0x53')});});}catch(_0x248c0a){_0x46e04d(_0x248c0a);}}else if(_0x372a47){_0x46e04d();}else{return _0x2b2793[_0x49c4('0x39')](0x193)[_0x49c4('0x3c')]({'message':_0x49c4('0x48')});}})[_0x49c4('0x59')](function(_0x4e38bc,_0x212366,_0x49829e){if(_0x4e38bc[_0x49c4('0x34')]){db[_0x49c4('0x4b')][_0x49c4('0x4c')]({'where':{'id':_0x4e38bc[_0x49c4('0x34')]['id']},'attributes':userAttributes})[_0x49c4('0x38')](function(_0x281b83){if(!_0x281b83){return _0x212366['status'](0x194)['json']({'message':_0x49c4('0x5a')});}_0x4e38bc[_0x49c4('0x34')]=_0x281b83;_0x49829e();})[_0x49c4('0x3e')](function(_0x117151){_0x49829e(_0x117151);});}else if(_0x372a47){_0x49829e();}else{return _0x212366['status'](0x194)[_0x49c4('0x3c')]({'message':_0x49c4('0x5b')});}});};exports[_0x49c4('0x5c')]=function canUpdate(){return compose()[_0x49c4('0x59')](function(_0x81a674,_0x3bde49,_0x1a9593){return licenseUtil[_0x49c4('0x5d')]()[_0x49c4('0x38')](function(_0x5640d3){if(_0x5640d3[_0x49c4('0x5e')]){_0x1a9593();}else{return _0x3bde49['status'](0x193)[_0x49c4('0x3c')]({'message':_0x49c4('0x5f')});}})[_0x49c4('0x3e')](function(_0x258abe){_0x1a9593(_0x258abe);});});};exports[_0x49c4('0x60')]=function isWebrtcLicence(){return compose()['use'](function(_0x592e8e,_0x15b674,_0x384862){return licenseUtil[_0x49c4('0x5d')]()[_0x49c4('0x38')](function(_0x5d4790){if(_0x5d4790[_0x49c4('0x61')]){_0x384862();}else{return _0x15b674['status'](0x193)[_0x49c4('0x3c')]({'message':'Forbidden'});}})[_0x49c4('0x3e')](function(_0x906d3){_0x384862(_0x906d3);});});};exports[_0x49c4('0x62')]=function(_0x27adfe,_0x2d8087,_0x30bea5){_0x27adfe[_0x49c4('0x62')]=!![];return _0x30bea5();};exports['signToken']=function signToken(_0x3b731f){return signJwt(_0x3b731f);};exports[_0x49c4('0x63')]=function(_0x4a5c34,_0x1e1ac4){if(!_0x4a5c34[_0x49c4('0x34')]){return _0x1e1ac4[_0x49c4('0x39')](0x194)[_0x49c4('0x3c')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x5d8bf0={'payload':{'id':_0x4a5c34[_0x49c4('0x34')]['id'],'role':_0x4a5c34['user'][_0x49c4('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0x5d8bf0)[_0x49c4('0x38')](function(_0x3811b2){_0x1e1ac4[_0x49c4('0x64')](_0x49c4('0x65'),_0x3811b2);_0x1e1ac4[_0x49c4('0x66')](_0x49c4('0x67'));})['catch'](function(_0x1f26c2){return _0x1e1ac4[_0x49c4('0x39')](0x1f4)[_0x49c4('0x68')](_0x1f26c2);});};exports[_0x49c4('0x69')]=function(_0x17ef75){if(_[_0x49c4('0x6a')](_0x17ef75[_0x49c4('0x51')])||_[_0x49c4('0x6a')](_0x17ef75[_0x49c4('0x6b')])){return null;}else{return createJwt(_0x17ef75);}};exports[_0x49c4('0x6c')]=function(_0x5b822f){_0x5b822f['apiKeyNonce']=generateNonce();_0x5b822f[_0x49c4('0x6b')]=generateIssuedAt();return createJwt(_0x5b822f);};exports[_0x49c4('0x6d')]=function(_0x527e74,_0x59a8bc){var _0x77163d=_0x527e74['query']['apikey'];if(_0x77163d){var _0x3208c2={'nonce':_0x59a8bc[_0x49c4('0x51')],'iat':_0x59a8bc[_0x49c4('0x6b')],'audience':hardwareConf[_0x49c4('0x4a')](),'issuer':hardwareConf[_0x49c4('0x4a')]()};return verifyJwt(_0x77163d,_0x3208c2)[_0x49c4('0x38')](function(){return generateApiKey(_0x59a8bc);});}else{throw{'message':_0x49c4('0x6e')};}};exports['validatePasswordPattern']=function(_0x859dde){var _0xcc6a2b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0xcc6a2b[_0x49c4('0x6f')](_0x859dde))throw new db[(_0x49c4('0x70'))][(_0x49c4('0x71'))](_0x49c4('0x72'));return;};exports['validatePasswordHistory']=function(_0x5c7ddd,_0x1ef0c1,_0x155c43){var _0x2a6308=encryptor[_0x49c4('0x73')](_0x1ef0c1)[_0x49c4('0x74')](',');for(var _0x6b2592=0x0;_0x6b2592<_0x155c43;_0x6b2592++){if(!_0x2a6308[_0x6b2592])break;if(_0x5c7ddd[_0x49c4('0x75')]()===_0x2a6308[_0x6b2592]['toLowerCase']()){var _0x45d715=util[_0x49c4('0x76')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x155c43);if(_0x155c43===0x1){_0x45d715=_0x49c4('0x77');}throw new db['Sequelize'][(_0x49c4('0x71'))](_0x45d715);}}return;};exports[_0x49c4('0x78')]=function(_0x9eaa84,_0x2fe89a){var _0x845f7e=_0x2fe89a?encryptor[_0x49c4('0x73')](_0x2fe89a)[_0x49c4('0x74')](','):[];if(_0x845f7e[_0x49c4('0x79')]===0x5){_0x845f7e['splice'](-0x1,0x1);}_0x845f7e[_0x49c4('0x7a')](_0x9eaa84);return encryptor[_0x49c4('0x7b')](_0x845f7e['join'](','));};function signJwt(_0x10dec7){var _0x299e74=BPromise['promisify'](jwt[_0x49c4('0x7c')],{'context':jwt});var _0x42e0e6=_0x10dec7['secret']||config['secrets']['session'];return new BPromise(function(_0x513879,_0xc43386){_0x299e74(_0x10dec7['payload'],_0x42e0e6,_0x10dec7[_0x49c4('0x7d')])[_0x49c4('0x38')](function(_0x515240){_0x513879(_0x515240);})[_0x49c4('0x3e')](function(_0xdb2b33){_0xc43386(_0xdb2b33);});});}function verifyJwt(_0x5ac9f0,_0x34272f,_0x3dcf4c){var _0x167e84=BPromise[_0x49c4('0x7e')](jwt['verify'],{'context':jwt});var _0x431921=_0x3dcf4c||config[_0x49c4('0x9')][_0x49c4('0xa')];return new BPromise(function(_0x20e97d,_0x5d3375){_0x167e84(_0x5ac9f0,_0x431921,_0x34272f)[_0x49c4('0x38')](function(_0x4a93bc){_0x20e97d(_0x4a93bc);})['catch'](function(_0x58259d){_0x5d3375(_0x58259d);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x49c4('0x7f')](_0x49c4('0x80'));}function generateIssuedAt(){return Math[_0x49c4('0x81')](Date[_0x49c4('0x82')]()/0x3e8)['toString']();}function createJwt(_0x4daa6d){var _0x340523={'payload':{'iat':_0x4daa6d[_0x49c4('0x6b')],'nonce':_0x4daa6d[_0x49c4('0x51')]},'options':{'algorithm':_0x49c4('0x83'),'subject':_0x4daa6d['id'][_0x49c4('0x7f')](),'issuer':hardwareConf[_0x49c4('0x4a')](),'audience':hardwareConf[_0x49c4('0x4a')]()}};return signJwt(_0x340523)[_0x49c4('0x38')](function(_0x4d49e0){return{'iat':_0x4daa6d[_0x49c4('0x6b')],'nonce':_0x4daa6d['apiKeyNonce'],'token':_0x4d49e0};});} \ No newline at end of file +var _0x54ef=['../../config/license/hardware','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','moment','secrets','session','fullname','internal','email','permissions','md5secret','voicePause','chatPause','faxPause','smsPause','openchannelPause','pauseType','lastLoginAt','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','smsAutoanswer','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','findOne','params','closed','disposition','then','status','unmanaged','json','Forbidden.','headers','authorization','Basic','User','find','name','authenticate','Wrong\x20credentials.','catch','startsWith','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','allowedLoginAttempts','isEqual','apiKeyNonce','nonce','disabled','blocked','blockDuration','blockedAt','add','minutes','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','update','Forbidden','isWebrtcLicence','getLicense','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','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\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','splice','encryptString','join','promisify','sign','secret','payload','options','toString','hex','floor','HS512','../../mysqldb','../../config/environment'];(function(_0x3fddc0,_0xee11ef){var _0x620989=function(_0x2c4be4){while(--_0x2c4be4){_0x3fddc0['push'](_0x3fddc0['shift']());}};_0x620989(++_0xee11ef);}(_0x54ef,0x112));var _0xf54e=function(_0x4d3605,_0x5eecae){_0x4d3605=_0x4d3605-0x0;var _0x46f8e7=_0x54ef[_0x4d3605];return _0x46f8e7;};'use strict';var db=require(_0xf54e('0x0'))['db'];var config=require(_0xf54e('0x1'));var hardwareConf=require(_0xf54e('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0xf54e('0x3'));var _=require(_0xf54e('0x4'));var jwt=require(_0xf54e('0x5'));var expressJwt=require(_0xf54e('0x6'));var compose=require(_0xf54e('0x7'));var basicAuth=require(_0xf54e('0x8'));var crypto=require(_0xf54e('0x9'));var BPromise=require('bluebird');var util=require('util');var moment=require(_0xf54e('0xa'));var validateJwt=expressJwt({'secret':config[_0xf54e('0xb')][_0xf54e('0xc')]});var userAttributes=['id','role',_0xf54e('0xd'),'name',_0xf54e('0xe'),_0xf54e('0xf'),'userpic',_0xf54e('0x10'),_0xf54e('0x11'),_0xf54e('0x12'),_0xf54e('0x13'),'mailPause',_0xf54e('0x14'),_0xf54e('0x15'),_0xf54e('0x16'),_0xf54e('0x17'),'showWebBar',_0xf54e('0x18'),'lastPauseAt','crudPermissions',_0xf54e('0x19'),_0xf54e('0x1a'),_0xf54e('0x1b'),_0xf54e('0x1c'),'phoneBarAutoAnswerDelay',_0xf54e('0x1d'),_0xf54e('0x1e'),_0xf54e('0x1f'),_0xf54e('0x20'),'phoneBarExpires',_0xf54e('0x21'),_0xf54e('0x22'),_0xf54e('0x23'),'hotdesk','interface',_0xf54e('0x24'),_0xf54e('0x25'),_0xf54e('0x26'),_0xf54e('0x27'),_0xf54e('0x28'),_0xf54e('0x29'),_0xf54e('0x2a'),_0xf54e('0x2b'),_0xf54e('0x2c'),_0xf54e('0x2d'),_0xf54e('0x2e'),'emailAutoanswer','emailAutoanswerDelay',_0xf54e('0x2f'),'smsAutoanswerDelay',_0xf54e('0x30'),_0xf54e('0x31'),_0xf54e('0x32'),_0xf54e('0x33'),_0xf54e('0x34'),_0xf54e('0x35')];exports[_0xf54e('0x36')]=function(){return this[_0xf54e('0x37')](!![])[_0xf54e('0x38')](function(_0x5f9eea,_0x1c58bd,_0x5b83df){if(_0x5f9eea[_0xf54e('0x39')]){_0x5b83df();}else{return db['ChatInteraction'][_0xf54e('0x3a')]({'where':{'id':_0x5f9eea[_0xf54e('0x3b')]['id']},'attributes':['id',_0xf54e('0x3c'),_0xf54e('0x3d')],'raw':!![]})[_0xf54e('0x3e')](function(_0x160160){if(_0x160160&&_0x160160[_0xf54e('0x3c')]){return _0x1c58bd[_0xf54e('0x3f')](_0x160160[_0xf54e('0x3d')]===_0xf54e('0x40')?0x195:0x193)[_0xf54e('0x41')]({'message':_0x160160[_0xf54e('0x3d')]===_0xf54e('0x40')?'Unmanaged.':_0xf54e('0x42')});}else{_0x5b83df();}})['catch'](function(_0x282c63){_0x5b83df(_0x282c63);});}});};exports['isAuthenticated']=function isAuthenticated(_0x15b888){return compose()[_0xf54e('0x38')](function(_0x21ba00,_0xa13cd0,_0x25b643){var _0x3993e4;if(_0x21ba00[_0xf54e('0x43')]['authorization']){if(_['startsWith'](_0x21ba00[_0xf54e('0x43')][_0xf54e('0x44')],_0xf54e('0x45'))){var _0x16d00f=basicAuth(_0x21ba00);db[_0xf54e('0x46')][_0xf54e('0x47')]({'where':{'name':_0x16d00f[_0xf54e('0x48')]}})[_0xf54e('0x3e')](function(_0x3ae704){if(!_0x3ae704||!_0x3ae704[_0xf54e('0x49')](_0x16d00f['pass'])){return _0xa13cd0['status'](0x191)[_0xf54e('0x41')]({'message':_0xf54e('0x4a')});}_0x21ba00['user']={'id':_0x3ae704['id']};_0x25b643();})[_0xf54e('0x4b')](function(_0x82e313){_0x25b643(_0x82e313);});}else if(_[_0xf54e('0x4c')](_0x21ba00[_0xf54e('0x43')]['authorization'],'Bearer')){validateJwt(_0x21ba00,_0xa13cd0,_0x25b643);}else{if(_0x15b888){_0x25b643();}else{return _0xa13cd0['status'](0x193)[_0xf54e('0x41')]({'message':_0xf54e('0x4d')});}}}else if(_0x21ba00[_0xf54e('0x4e')][_0xf54e('0x4f')]){try{var _0x29dc39={'audience':hardwareConf[_0xf54e('0x50')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x21ba00['query']['apikey'],_0x29dc39)[_0xf54e('0x3e')](function(_0x734187){return db['User']['find']({'where':{'id':_0x734187[_0xf54e('0x51')]}})[_0xf54e('0x3e')](function(_0x173e6c){_0x3993e4=_0x173e6c;return db['Setting'][_0xf54e('0x3a')]({'where':{'id':0x1},'attributes':[_0xf54e('0x52'),'blockDuration'],'raw':!![]});})[_0xf54e('0x3e')](function(_0x6e5bdf){if(!_0x3993e4||!_[_0xf54e('0x53')](_0x3993e4[_0xf54e('0x54')],_0x734187[_0xf54e('0x55')])){return _0xa13cd0[_0xf54e('0x3f')](0x191)['json']({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x3993e4[_0xf54e('0x56')]){return _0xa13cd0[_0xf54e('0x3f')](0x191)[_0xf54e('0x41')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x3993e4[_0xf54e('0x57')]){if(_0x6e5bdf[_0xf54e('0x58')]>0x0){if(moment(_0x3993e4[_0xf54e('0x59')])[_0xf54e('0x5a')](_0x6e5bdf[_0xf54e('0x58')],_0xf54e('0x5b'))>moment()){return _0xa13cd0[_0xf54e('0x3f')](0x191)[_0xf54e('0x41')]({'message':_0xf54e('0x5c')});}}else{return _0xa13cd0[_0xf54e('0x3f')](0x191)[_0xf54e('0x41')]({'message':_0xf54e('0x5c')});}}_0x21ba00[_0xf54e('0x39')]={'id':_0x3993e4['id']};_0x25b643();});})[_0xf54e('0x4b')](function(){return _0xa13cd0[_0xf54e('0x3f')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x533423){_0x25b643(_0x533423);}}else if(_0x15b888){_0x25b643();}else{return _0xa13cd0[_0xf54e('0x3f')](0x193)[_0xf54e('0x41')]({'message':'Unknown\x20authorization\x20format'});}})[_0xf54e('0x38')](function(_0x311ce1,_0x381c03,_0x4f61d7){if(_0x311ce1[_0xf54e('0x39')]){db[_0xf54e('0x46')][_0xf54e('0x47')]({'where':{'id':_0x311ce1[_0xf54e('0x39')]['id']},'attributes':userAttributes})[_0xf54e('0x3e')](function(_0x143a39){if(!_0x143a39){return _0x381c03[_0xf54e('0x3f')](0x194)[_0xf54e('0x41')]({'message':_0xf54e('0x5d')});}_0x311ce1['user']=_0x143a39;_0x4f61d7();})[_0xf54e('0x4b')](function(_0x3447fd){_0x4f61d7(_0x3447fd);});}else if(_0x15b888){_0x4f61d7();}else{return _0x381c03[_0xf54e('0x3f')](0x194)[_0xf54e('0x41')]({'message':_0xf54e('0x5e')});}});};exports[_0xf54e('0x5f')]=function canUpdate(){return compose()['use'](function(_0x23a4a1,_0x59af72,_0x1d16e0){return licenseUtil['getLicense']()[_0xf54e('0x3e')](function(_0x331b16){if(_0x331b16[_0xf54e('0x60')]){_0x1d16e0();}else{return _0x59af72['status'](0x193)[_0xf54e('0x41')]({'message':_0xf54e('0x61')});}})[_0xf54e('0x4b')](function(_0x32fb46){_0x1d16e0(_0x32fb46);});});};exports[_0xf54e('0x62')]=function isWebrtcLicence(){return compose()['use'](function(_0x427799,_0x297737,_0x346bb4){return licenseUtil[_0xf54e('0x63')]()['then'](function(_0x1bdb5a){if(_0x1bdb5a[_0xf54e('0x64')]){_0x346bb4();}else{return _0x297737['status'](0x193)[_0xf54e('0x41')]({'message':_0xf54e('0x61')});}})[_0xf54e('0x4b')](function(_0xca0141){_0x346bb4(_0xca0141);});});};exports['isMiddleware']=function(_0x196e68,_0x2b645e,_0x2527f6){_0x196e68[_0xf54e('0x65')]=!![];return _0x2527f6();};exports[_0xf54e('0x66')]=function signToken(_0x3237ef){return signJwt(_0x3237ef);};exports[_0xf54e('0x67')]=function(_0xd7b0c5,_0x15bfef){if(!_0xd7b0c5[_0xf54e('0x39')]){return _0x15bfef[_0xf54e('0x3f')](0x194)[_0xf54e('0x41')]({'message':_0xf54e('0x68')});}var _0x2de1fe={'payload':{'id':_0xd7b0c5[_0xf54e('0x39')]['id'],'role':_0xd7b0c5[_0xf54e('0x39')][_0xf54e('0x69')]},'options':{'expiresIn':0x15180}};return signJwt(_0x2de1fe)[_0xf54e('0x3e')](function(_0x21fd80){_0x15bfef[_0xf54e('0x6a')]('motion.token',_0x21fd80);_0x15bfef['redirect'](_0xf54e('0x6b'));})[_0xf54e('0x4b')](function(_0x45861b){return _0x15bfef[_0xf54e('0x3f')](0x1f4)[_0xf54e('0x6c')](_0x45861b);});};exports[_0xf54e('0x6d')]=function(_0x22763f){if(_[_0xf54e('0x6e')](_0x22763f[_0xf54e('0x54')])||_[_0xf54e('0x6e')](_0x22763f[_0xf54e('0x6f')])){return null;}else{return createJwt(_0x22763f);}};exports['generateApiKey']=function(_0x2aacf6){_0x2aacf6[_0xf54e('0x54')]=generateNonce();_0x2aacf6[_0xf54e('0x6f')]=generateIssuedAt();return createJwt(_0x2aacf6);};exports[_0xf54e('0x70')]=function(_0x1b8f16,_0x30f53b){var _0x18a25f=_0x1b8f16['query'][_0xf54e('0x4f')];if(_0x18a25f){var _0x5fabd2={'nonce':_0x30f53b[_0xf54e('0x54')],'iat':_0x30f53b['apiKeyIat'],'audience':hardwareConf[_0xf54e('0x50')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x18a25f,_0x5fabd2)[_0xf54e('0x3e')](function(){return generateApiKey(_0x30f53b);});}else{throw{'message':_0xf54e('0x71')};}};exports[_0xf54e('0x72')]=function(_0x5b882f){var _0x1d8ccf=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x1d8ccf[_0xf54e('0x73')](_0x5b882f))throw new db[(_0xf54e('0x74'))][(_0xf54e('0x75'))](_0xf54e('0x76'));return;};exports[_0xf54e('0x77')]=function(_0x21d485,_0x55d57f,_0x55de5c){var _0x4270e1=encryptor[_0xf54e('0x78')](_0x55d57f)['split'](',');for(var _0x29743e=0x0;_0x29743e<_0x55de5c;_0x29743e++){if(!_0x4270e1[_0x29743e])break;if(_0x21d485['toLowerCase']()===_0x4270e1[_0x29743e][_0xf54e('0x79')]()){var _0x528a64=util[_0xf54e('0x7a')](_0xf54e('0x7b'),_0x55de5c);if(_0x55de5c===0x1){_0x528a64=_0xf54e('0x7c');}throw new db[(_0xf54e('0x74'))][(_0xf54e('0x75'))](_0x528a64);}}return;};exports[_0xf54e('0x7d')]=function(_0x556e55,_0x479572){var _0x79345=_0x479572?encryptor[_0xf54e('0x78')](_0x479572)['split'](','):[];if(_0x79345['length']===0x5){_0x79345[_0xf54e('0x7e')](-0x1,0x1);}_0x79345['unshift'](_0x556e55);return encryptor[_0xf54e('0x7f')](_0x79345[_0xf54e('0x80')](','));};function signJwt(_0x47596c){var _0x2b11f8=BPromise[_0xf54e('0x81')](jwt[_0xf54e('0x82')],{'context':jwt});var _0x3bf476=_0x47596c[_0xf54e('0x83')]||config[_0xf54e('0xb')][_0xf54e('0xc')];return new BPromise(function(_0x1f9dad,_0x2c6d0e){_0x2b11f8(_0x47596c[_0xf54e('0x84')],_0x3bf476,_0x47596c[_0xf54e('0x85')])['then'](function(_0x302f3d){_0x1f9dad(_0x302f3d);})[_0xf54e('0x4b')](function(_0xb7ff4d){_0x2c6d0e(_0xb7ff4d);});});}function verifyJwt(_0x11908b,_0x1e4c0d,_0x494629){var _0xf50b1b=BPromise[_0xf54e('0x81')](jwt['verify'],{'context':jwt});var _0x51ec35=_0x494629||config[_0xf54e('0xb')]['session'];return new BPromise(function(_0x26322a,_0x39c5eb){_0xf50b1b(_0x11908b,_0x51ec35,_0x1e4c0d)[_0xf54e('0x3e')](function(_0x9789b9){_0x26322a(_0x9789b9);})['catch'](function(_0x2ecda1){_0x39c5eb(_0x2ecda1);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0xf54e('0x86')](_0xf54e('0x87'));}function generateIssuedAt(){return Math[_0xf54e('0x88')](Date['now']()/0x3e8)[_0xf54e('0x86')]();}function createJwt(_0x504ec7){var _0x3f7224={'payload':{'iat':_0x504ec7[_0xf54e('0x6f')],'nonce':_0x504ec7['apiKeyNonce']},'options':{'algorithm':_0xf54e('0x89'),'subject':_0x504ec7['id']['toString'](),'issuer':hardwareConf[_0xf54e('0x50')](),'audience':hardwareConf[_0xf54e('0x50')]()}};return signJwt(_0x3f7224)[_0xf54e('0x3e')](function(_0x38405c){return{'iat':_0x504ec7[_0xf54e('0x6f')],'nonce':_0x504ec7['apiKeyNonce'],'token':_0x38405c};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 7d9e1a2..51d07b4 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 _0xb10b=['user','clause','tags','skip','checkListsRestrictions','ids','tag','countFilteredContacts','count','buildContactsQuery','getFilteredContacts','rows','catch','describe','CmContact','keys','startsWith','cf_','map','CmCustomField','findOne','slice','all','fieldType','type','lodash','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter','parseQueryParameters','default','where','fields','filter'];(function(_0x3fcc9,_0xb274a6){var _0x9137b6=function(_0x477c56){while(--_0x477c56){_0x3fcc9['push'](_0x3fcc9['shift']());}};_0x9137b6(++_0xb274a6);}(_0xb10b,0x12a));var _0xbb10=function(_0x43b88c,_0x46fb04){_0x43b88c=_0x43b88c-0x0;var _0x407299=_0xb10b[_0x43b88c];return _0x407299;};'use strict';var _=require(_0xbb10('0x0'));var sqlUtils=require('./sql-utils');var db=require(_0xbb10('0x1'))['db'];exports[_0xbb10('0x2')]=function(_0x1dcb08,_0x4d688c,_0x4541ae,_0x9bbed){var _0x460981={'count':0x0,'rows':[]};var _0x22320e=sqlUtils[_0xbb10('0x3')](_0x4d688c,_0x1dcb08);if(_0x22320e){return Promise[_0xbb10('0x4')](_0x460981);}var _0x481979=sqlUtils[_0xbb10('0x5')]();var _0x3cdd53={};var _0x513741=![];var _0x1b9e94=![];return Promise[_0xbb10('0x4')]()[_0xbb10('0x6')](function(){if(_0x1dcb08[_0xbb10('0x7')]){return sqlUtils[_0xbb10('0x8')](_0x1dcb08[_0xbb10('0x7')],_0x9bbed);}else{return sqlUtils[_0xbb10('0x9')](_0x1dcb08,_0x9bbed);}})[_0xbb10('0x6')](function(_0x5ab04a){_0x481979['where'](_0x5ab04a[_0xbb10('0xa')]);_0x481979[_0xbb10('0xb')](_0x5ab04a[_0xbb10('0xc')]);_0x481979['where'](_0x5ab04a[_0xbb10('0xd')]);_0x481979['where'](_0x5ab04a[_0xbb10('0xe')][_0xbb10('0xf')]);_0x3cdd53=_0x5ab04a[_0xbb10('0x10')];_0x1b9e94=_0x5ab04a[_0xbb10('0xe')][_0xbb10('0x11')];return sqlUtils[_0xbb10('0x12')](_0x4d688c,_0x1dcb08,_0x1b9e94);})['then'](function(_0x26e021){_0x481979[_0xbb10('0xb')](_0x26e021);var _0x45b9d6=_0x1dcb08[_0xbb10('0x7')]?_0x3cdd53[_0xbb10('0x13')]:_0x1dcb08[_0xbb10('0x14')];_0x513741=_0x45b9d6?!![]:![];return sqlUtils[_0xbb10('0x15')](_0x481979,_0x45b9d6);})[_0xbb10('0x6')](function(_0x3e26f4){_0x460981[_0xbb10('0x16')]=_0x3e26f4;if(_0x460981['count']===0x0){return;}return sqlUtils[_0xbb10('0x17')](_0x481979,_0x1dcb08[_0xbb10('0xc')],_0x4541ae,_0x513741,_0x3cdd53[_0xbb10('0xf')],_0x1b9e94);})[_0xbb10('0x6')](function(_0x378da8){if(!_0x378da8){return[];}return sqlUtils[_0xbb10('0x18')](_0x378da8,_0x1dcb08,_0x4541ae);})[_0xbb10('0x6')](function(_0x30efc6){_0x460981[_0xbb10('0x19')]=_0x30efc6;return _0x460981;})[_0xbb10('0x1a')](function(_0x48b6e9){throw _0x48b6e9;});};exports[_0xbb10('0x1b')]=function(){var _0x19f48d={};var _0x388fab=[];return db[_0xbb10('0x1c')][_0xbb10('0x1b')]()[_0xbb10('0x6')](function(_0x4deb49){_0x19f48d=_0x4deb49;var _0x12f888=Object[_0xbb10('0x1d')](_0x19f48d)['filter'](function(_0x4c4b0d){return _[_0xbb10('0x1e')](_0x4c4b0d,_0xbb10('0x1f'))?_0x4c4b0d:undefined;});var _0x2e911d=_0x12f888[_0xbb10('0x20')](function(_0x445761){return db[_0xbb10('0x21')][_0xbb10('0x22')]({'where':{'id':_0x445761[_0xbb10('0x23')](0x3)},'raw':!![]});});return Promise[_0xbb10('0x24')](_0x2e911d);})[_0xbb10('0x6')](function(_0x3ba6cd){for(var _0x26ad93=0x0;_0x26ad93<_0x3ba6cd['length'];_0x26ad93++){if(_0x3ba6cd[_0x26ad93]){var _0x4fedac='cf_'+_0x3ba6cd[_0x26ad93]['id'];_0x19f48d[_0x4fedac][_0xbb10('0x25')]=_0x3ba6cd[_0x26ad93][_0xbb10('0x26')];}}_0x388fab=_[_0xbb10('0x20')](Object['keys'](_0x19f48d),function(_0x2fdde9){return{'name':_0x2fdde9,'type':_0x19f48d[_0x2fdde9][_0xbb10('0x26')]};});return _0x388fab;})[_0xbb10('0x1a')](function(_0x1d5e95){throw _0x1d5e95;});}; \ No newline at end of file +var _0x5f66=['buildContactsQuery','getFilteredContacts','catch','CmContact','keys','filter','cf_','CmCustomField','slice','all','length','./sql-utils','findAll','resolve','then','search','parseAdvancedSearchFilter','where','default','fields','clause','user','skip','checkListsRestrictions','ids','tag','count'];(function(_0x38e685,_0x234598){var _0x44600a=function(_0x328944){while(--_0x328944){_0x38e685['push'](_0x38e685['shift']());}};_0x44600a(++_0x234598);}(_0x5f66,0x1a0));var _0x65f6=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5f66[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var sqlUtils=require(_0x65f6('0x0'));var db=require('../../mysqldb')['db'];exports[_0x65f6('0x1')]=function(_0x2f06ae,_0x3461cd,_0xbce843,_0x1a330c){var _0x5eb9ad={'count':0x0,'rows':[]};var _0x3c5029=sqlUtils['skipContactsQuery'](_0x3461cd,_0x2f06ae);if(_0x3c5029){return Promise[_0x65f6('0x2')](_0x5eb9ad);}var _0x22b017=sqlUtils['getContactsSubquery']();var _0x4ed98f={};var _0x1c0e12=![];var _0x2c6571=![];return Promise[_0x65f6('0x2')]()[_0x65f6('0x3')](function(){if(_0x2f06ae[_0x65f6('0x4')]){return sqlUtils[_0x65f6('0x5')](_0x2f06ae['search'],_0x1a330c);}else{return sqlUtils['parseQueryParameters'](_0x2f06ae,_0x1a330c);}})[_0x65f6('0x3')](function(_0x2f6d5b){_0x22b017[_0x65f6('0x6')](_0x2f6d5b[_0x65f6('0x7')]);_0x22b017['where'](_0x2f6d5b[_0x65f6('0x8')]);_0x22b017['where'](_0x2f6d5b['filter']);_0x22b017[_0x65f6('0x6')](_0x2f6d5b['user'][_0x65f6('0x9')]);_0x4ed98f=_0x2f6d5b['tags'];_0x2c6571=_0x2f6d5b[_0x65f6('0xa')][_0x65f6('0xb')];return sqlUtils[_0x65f6('0xc')](_0x3461cd,_0x2f06ae,_0x2c6571);})[_0x65f6('0x3')](function(_0x369f96){_0x22b017[_0x65f6('0x6')](_0x369f96);var _0x44144b=_0x2f06ae[_0x65f6('0x4')]?_0x4ed98f[_0x65f6('0xd')]:_0x2f06ae[_0x65f6('0xe')];_0x1c0e12=_0x44144b?!![]:![];return sqlUtils['countFilteredContacts'](_0x22b017,_0x44144b);})[_0x65f6('0x3')](function(_0x49a913){_0x5eb9ad['count']=_0x49a913;if(_0x5eb9ad[_0x65f6('0xf')]===0x0){return;}return sqlUtils[_0x65f6('0x10')](_0x22b017,_0x2f06ae[_0x65f6('0x8')],_0xbce843,_0x1c0e12,_0x4ed98f[_0x65f6('0x9')],_0x2c6571);})[_0x65f6('0x3')](function(_0x1f974c){if(!_0x1f974c){return[];}return sqlUtils[_0x65f6('0x11')](_0x1f974c,_0x2f06ae,_0xbce843);})[_0x65f6('0x3')](function(_0x495dd6){_0x5eb9ad['rows']=_0x495dd6;return _0x5eb9ad;})[_0x65f6('0x12')](function(_0x5b4055){throw _0x5b4055;});};exports['describe']=function(){var _0x5c5b91={};var _0x365159=[];return db[_0x65f6('0x13')]['describe']()[_0x65f6('0x3')](function(_0x270893){_0x5c5b91=_0x270893;var _0xbee6a4=Object[_0x65f6('0x14')](_0x5c5b91)[_0x65f6('0x15')](function(_0xc139c2){return _['startsWith'](_0xc139c2,_0x65f6('0x16'))?_0xc139c2:undefined;});var _0x4bb39e=_0xbee6a4['map'](function(_0x212247){return db[_0x65f6('0x17')]['findOne']({'where':{'id':_0x212247[_0x65f6('0x18')](0x3)},'raw':!![]});});return Promise[_0x65f6('0x19')](_0x4bb39e);})[_0x65f6('0x3')](function(_0x2774a1){for(var _0x4f5a69=0x0;_0x4f5a69<_0x2774a1[_0x65f6('0x1a')];_0x4f5a69++){if(_0x2774a1[_0x4f5a69]){var _0x59ea32=_0x65f6('0x16')+_0x2774a1[_0x4f5a69]['id'];_0x5c5b91[_0x59ea32]['fieldType']=_0x2774a1[_0x4f5a69]['type'];}}_0x365159=_['map'](Object[_0x65f6('0x14')](_0x5c5b91),function(_0x16cde8){return{'name':_0x16cde8,'type':_0x5c5b91[_0x16cde8]['type']};});return _0x365159;})[_0x65f6('0x12')](function(_0x28f710){throw _0x28f710;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 41541b0..bcfa00a 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 _0xeac6=['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)','getFullTextValue','isNumeric','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','conditions','length','name','dateOfBirth','fieldType','datetime','castTo','buildExpression','default','text','start','value','end','Tag','split','map','tags','clause','and','ids','User','user','skip','keys','compact','Contact','push','c.ListId\x20IN\x20?','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','tag','filter','getLists','c.ListId\x20IS\x20NULL','attributes','group','c.id','limit','offset','having','order','DESC','subqry.','findAll','QueryTypes','SELECT','CmContact','sequelize','query','Tags','COUNT(*)','isEmpty','t.id\x20IN\x20?','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','search','ListId','autocomplete','true','select','from','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','fax','createdAt','updatedAt','deletedAt','TagIds','includes'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0xeac6,0x1d5));var _0x6eac=function(_0x3f2d56,_0x2a3da3){_0x3f2d56=_0x3f2d56-0x0;var _0x99f3ac=_0xeac6[_0x3f2d56];return _0x99f3ac;};'use strict';var _=require('lodash');var squel=require('squel');var as=require(_0x6eac('0x0'));var qs=require(_0x6eac('0x1'));var utils=require(_0x6eac('0x2'));var db=require(_0x6eac('0x3'))['db'];function skipContactsQuery(_0x32ac14,_0x31081b){var _0x42af9c=![];if(_0x32ac14[_0x6eac('0x4')]===_0x6eac('0x5')&&!_0x31081b[_0x6eac('0x6')]&&!_0x31081b[_0x6eac('0x7')]&&_0x31081b[_0x6eac('0x8')]!==_0x6eac('0x9')){_0x42af9c=!![];}return _0x42af9c;}function getContactsSubquery(){return squel[_0x6eac('0xa')]()[_0x6eac('0xb')]('cm_contacts','c')[_0x6eac('0xc')](_0x6eac('0xd'));}function applyJoinClauses(_0x2d69eb,_0xdd3dee){var _0x5b6363=_0xdd3dee?'c':_0x6eac('0xe');_0x2d69eb[_0x6eac('0xf')](_0x6eac('0x10'),'uc',_0x6eac('0x11')+_0x5b6363+_0x6eac('0x12'))[_0x6eac('0xf')](_0x6eac('0x13'),'ct',_0x6eac('0x14')+_0x5b6363+_0x6eac('0x12'))[_0x6eac('0xf')](_0x6eac('0x15'),'t',_0x6eac('0x16'));return _0x2d69eb;}function addFieldsToQuery(_0x1672e3,_0x460432,_0x121de9,_0x4dfdc7,_0x2e13b0){var _0x443c62=_0x2e13b0?'c':_0x6eac('0xe');if(!_0x460432){_0x460432=['id',_0x6eac('0x17'),_0x6eac('0x18'),'phone','mobile',_0x6eac('0x19'),'email','ListId','CompanyId',_0x6eac('0x1a'),_0x6eac('0x1b'),_0x6eac('0x1c'),_0x6eac('0x1d')];}else if(!_0x460432[_0x6eac('0x1e')]('id')){_0x460432['push']('id');}var _0xdd34f9=_0x121de9&&_0x2e13b0||!_0x121de9&&!_0x2e13b0;if(_0x4dfdc7){_0xdd34f9=_0x4dfdc7&&_0x2e13b0||!_0x4dfdc7&&!_0x2e13b0;}_0x460432[_0x6eac('0x1f')](function(_0x2ee336){if(_0x2ee336===_0x6eac('0x1d')){if(_0xdd34f9){_0x1672e3['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x2ee336);}else if(_0x121de9||_0x4dfdc7){_0x1672e3[_0x6eac('0x20')](_0x443c62+'.'+_0x2ee336);}}else{_0x1672e3[_0x6eac('0x20')](_0x443c62+'.'+_0x2ee336);}});return _0x1672e3;}function getSqlClauses(){var _0x2ff9aa={'default':squel[_0x6eac('0x21')](),'fields':squel[_0x6eac('0x21')](),'filter':squel[_0x6eac('0x21')](),'tags':{'clause':squel[_0x6eac('0x21')](),'ids':null},'user':{'clause':squel[_0x6eac('0x21')](),'skip':![]}};return _0x2ff9aa;}function parseTagParameter(_0x696bc0){var _0x5c0b75=squel[_0x6eac('0x21')]();if(_0x696bc0){var _0x15ef73=utils[_0x6eac('0x22')](_0x696bc0);_0x15ef73[_0x6eac('0x1f')](function(_0x672235){_0x5c0b75['or'](_0x6eac('0x23'),'%,'+_0x672235+',%');});}return _0x5c0b75;}function parseSearchFilter(_0x403d6a){var _0x32acf2=squel[_0x6eac('0x21')]();if(_0x403d6a){var _0x38ed22=_0x403d6a[_0x6eac('0x24')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(_0x38ed22['split']('\x20')['length']>0x1){_0x32acf2['or'](_0x6eac('0x25'),qs[_0x6eac('0x26')](_0x38ed22),null);}else{if(qs[_0x6eac('0x27')](_0x38ed22)){_0x32acf2['or']('c.id\x20LIKE\x20?',_0x38ed22+'%');_0x32acf2['or'](_0x6eac('0x28'),_0x38ed22+'%');_0x32acf2['or'](_0x6eac('0x29'),_0x38ed22+'%');_0x32acf2['or'](_0x6eac('0x2a'),_0x38ed22+'%');}else if(qs['isEmail'](_0x38ed22)){_0x32acf2['or']('c.email\x20LIKE\x20?',_0x38ed22+'%');}else{_0x32acf2['or']('c.firstName\x20LIKE\x20?','%'+_0x38ed22+'%');_0x32acf2['or'](_0x6eac('0x2b'),'%'+_0x38ed22+'%');_0x32acf2['or']('c.email\x20LIKE\x20?','%'+_0x38ed22+'%');}}}return _0x32acf2;}function parseAdvancedSearchFilter(_0x4e27b1,_0x1bc180){var _0x21d3f0=getSqlClauses();var _0x364b00=as[_0x6eac('0x2c')](_0x4e27b1);var _0x117739=_0x364b00['sqlOperator'];for(var _0x5e9951=0x0;_0x5e9951<_0x364b00[_0x6eac('0x2d')][_0x6eac('0x2e')];_0x5e9951++){var _0x17b712=_0x364b00['conditions'][_0x5e9951];var _0x5edb4d='c';var _0x1d14ed=_['find'](_0x1bc180,[_0x6eac('0x2f'),_0x17b712[_0x6eac('0x20')]]);if(_0x1d14ed){if(_0x17b712[_0x6eac('0x20')]===_0x6eac('0x30')||_0x1d14ed[_0x6eac('0x31')]===_0x6eac('0x32')){_0x17b712[_0x6eac('0x33')]='DATE';}var _0x5b363f=as[_0x6eac('0x34')](_0x5edb4d,_0x1d14ed['type'],_0x17b712);_0x21d3f0[_0x6eac('0x35')][_0x117739](_0x5b363f[_0x6eac('0x36')],_0x5b363f['value'][_0x6eac('0x37')],_0x5b363f[_0x6eac('0x38')][_0x6eac('0x39')]);}else{if(_0x17b712[_0x6eac('0x20')]===_0x6eac('0x3a')){var _0x1da591=_0x17b712[_0x6eac('0x38')][_0x6eac('0x3b')](',')[_0x6eac('0x3c')](function(_0xdad202){return Number(_0xdad202);});var _0xbceddb=parseTagParameter(_0x1da591);_0x21d3f0[_0x6eac('0x3d')][_0x6eac('0x3e')][_0x6eac('0x3f')](_0xbceddb);_0x21d3f0[_0x6eac('0x3d')][_0x6eac('0x40')]=_0x1da591;}else if(_0x17b712[_0x6eac('0x20')]===_0x6eac('0x41')){_0x21d3f0[_0x6eac('0x42')][_0x6eac('0x3e')]['and']('uc.UserId\x20=\x20?',_0x17b712['value']);_0x21d3f0[_0x6eac('0x42')][_0x6eac('0x43')]=!![];}}}return _0x21d3f0;}function parseModelFields(_0xa2eb59,_0x13dd18){var _0x3ae3da=squel[_0x6eac('0x21')]();var _0x38acc2=_(_0xa2eb59)[_0x6eac('0x44')]()[_0x6eac('0x3c')](function(_0x3c7809){return _['some'](_0x13dd18,[_0x6eac('0x2f'),_0x3c7809])?_0x3c7809:undefined;})[_0x6eac('0x45')]()['value']();if(_0xa2eb59[_0x6eac('0x46')]){_0x38acc2[_0x6eac('0x47')](_0x6eac('0x46'));}if(_0x38acc2[_0x6eac('0x2e')]>0x0){_0x38acc2[_0x6eac('0x1f')](function(_0x2eaca5){if(_0x2eaca5===_0x6eac('0x7')){_0x3ae3da[_0x6eac('0x3f')](_0x6eac('0x48'),[]['concat'](_0xa2eb59[_0x2eaca5]));}else if(_0x2eaca5===_0x6eac('0x46')){var _0x40d33f='%'+_0xa2eb59[_0x2eaca5]+'%';_0x3ae3da[_0x6eac('0x3f')](_0x6eac('0x49'),_0x40d33f);}else{_0x3ae3da['and']('c.'+_0x2eaca5+_0x6eac('0x4a'),_0xa2eb59[_0x2eaca5]);}});}return _0x3ae3da;}function parseQueryParameters(_0x1916f2,_0x5e7700){var _0x13ed72=getSqlClauses();return Promise[_0x6eac('0x4b')]()['then'](function(){return parseModelFields(_0x1916f2,_0x5e7700);})[_0x6eac('0x4c')](function(_0x285545){_0x13ed72['fields']['and'](_0x285545);return parseTagParameter(_0x1916f2[_0x6eac('0x4d')]);})['then'](function(_0x21a845){_0x13ed72[_0x6eac('0x3d')][_0x6eac('0x3e')][_0x6eac('0x3f')](_0x21a845);return parseSearchFilter(_0x1916f2[_0x6eac('0x4e')]);})[_0x6eac('0x4c')](function(_0x4a17e4){_0x13ed72[_0x6eac('0x4e')]=_0x4a17e4;return _0x13ed72;});}function checkListsRestrictions(_0x3ccec4,_0x20f8a2,_0x585585){var _0x23a4ea=squel[_0x6eac('0x21')]();return Promise[_0x6eac('0x4b')]()[_0x6eac('0x4c')](function(){if(_0x20f8a2[_0x6eac('0x6')]&&_0x3ccec4[_0x6eac('0x4')]===_0x6eac('0x5')&&!_0x585585){return _0x3ccec4[_0x6eac('0x4f')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0xbedbf2){if(_0xbedbf2){if(_0xbedbf2[_0x6eac('0x2e')]===0x0){_0x23a4ea['and'](_0x6eac('0x50'));}else{_0x23a4ea[_0x6eac('0x3f')](_0x6eac('0x48'),_['map'](_0xbedbf2,'id'));}}})['then'](function(){return _0x23a4ea;});}function buildContactsQuery(_0x44b183,_0x256692,_0x4b082a,_0x2ce418,_0x587233,_0x2d7210){if(_0x256692){_0x256692=_0x4b082a[_0x6eac('0x51')];}_0x44b183=addFieldsToQuery(_0x44b183,_0x256692,_0x2ce418,_0x2d7210,!![]);var _0x46a9cc=squel[_0x6eac('0xa')]();_0x46a9cc=addFieldsToQuery(_0x46a9cc,_0x256692,_0x2ce418,_0x2d7210,![]);if(_0x2ce418||_0x2d7210){_0x44b183=applyJoinClauses(_0x44b183,!![]);_0x44b183[_0x6eac('0x52')](_0x6eac('0x53'));if(_0x4b082a[_0x6eac('0x54')]){_0x46a9cc['limit'](_0x4b082a[_0x6eac('0x54')]);}if(_0x4b082a['offset']){_0x46a9cc[_0x6eac('0x55')](_0x4b082a[_0x6eac('0x55')]);}}else{_0x46a9cc=applyJoinClauses(_0x46a9cc,![]);_0x46a9cc[_0x6eac('0x52')]('subqry.id');if(_0x4b082a[_0x6eac('0x54')]){_0x44b183[_0x6eac('0x54')](_0x4b082a[_0x6eac('0x54')]);}if(_0x4b082a['offset']){_0x44b183[_0x6eac('0x55')](_0x4b082a[_0x6eac('0x55')]);}}_0x46a9cc[_0x6eac('0x56')](_0x587233);if(_0x4b082a[_0x6eac('0x57')]){_0x4b082a['order'][_0x6eac('0x1f')](function(_0xb8aae){_0x44b183[_0x6eac('0x57')]('c.'+_0xb8aae[0x0],_0xb8aae[0x1]===_0x6eac('0x58')?![]:!![]);_0x46a9cc[_0x6eac('0x57')](_0x6eac('0x59')+_0xb8aae[0x0],_0xb8aae[0x1]===_0x6eac('0x58')?![]:!![]);});}_0x46a9cc['from'](_0x44b183,'subqry');return _0x46a9cc;}function getFilteredContacts(_0x24e693){var _0x238f37=[];return db[_0x6eac('0x3a')][_0x6eac('0x5a')]({'attributes':['id',_0x6eac('0x2f'),'color'],'raw':!![]})[_0x6eac('0x4c')](function(_0x1c4442){_0x238f37=_['keyBy'](_0x1c4442,'id');var _0x281c36={'type':db['Sequelize'][_0x6eac('0x5b')][_0x6eac('0x5c')],'model':db[_0x6eac('0x5d')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x6eac('0x5e')][_0x6eac('0x5f')](_0x24e693['toString'](),_0x281c36);})[_0x6eac('0x4c')](function(_0x48ffa5){_0x48ffa5['forEach'](function(_0x300318){if(_0x300318[_0x6eac('0x1d')]){_0x300318[_0x6eac('0x60')]=[];_0x300318[_0x6eac('0x1d')][_0x6eac('0x3b')](',')[_0x6eac('0x1f')](function(_0x3405dd){_0x300318['Tags'][_0x6eac('0x47')](_0x238f37[_0x3405dd]);});}delete _0x300318[_0x6eac('0x1d')];});return _0x48ffa5;});}function countFilteredContacts(_0x5759eb,_0x58e599){var _0x3fabcf=_0x5759eb['clone']();_0x3fabcf[_0x6eac('0x20')](_0x6eac('0x61'));_0x3fabcf=applyJoinClauses(_0x3fabcf,!![]);_0x5759eb[_0x6eac('0x52')]('c.id');var _0x364ce4=utils[_0x6eac('0x22')](_0x58e599);if(!_[_0x6eac('0x62')](_0x364ce4)){_0x3fabcf[_0x6eac('0xc')](_0x6eac('0x63'),_0x364ce4);}var _0xbb0ee0={'type':db['Sequelize'][_0x6eac('0x5b')]['SELECT'],'raw':!![]};return db[_0x6eac('0x5e')]['query'](_0x3fabcf['toString'](),_0xbb0ee0)[_0x6eac('0x4c')](function(_0x3da472){return _0x3da472[0x0]['COUNT(*)'];});}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 _0x7b37=['../parsers/qs','../interaction/utils','../../mysqldb','role','agent','search','ListId','autocomplete','where','c.deletedAt\x20IS\x20NULL','subqry','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','left_join','tools_tags','t.id\x20=\x20ct.TagId','lastName','phone','mobile','fax','email','CompanyId','updatedAt','deletedAt','TagIds','includes','push','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','fieldType','datetime','castTo','buildExpression','type','default','text','value','end','Tag','tags','user','clause','uc.UserId\x20=\x20?','skip','keys','compact','Contact','and','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','tag','filter','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','map','attributes','select','group','c.id','limit','offset','subqry.id','order','DESC','findAll','color','keyBy','QueryTypes','SELECT','CmContact','sequelize','query','toString','Tags','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','Sequelize','lodash','squel','../parsers/advancedSearch'];(function(_0xf91841,_0x182ae3){var _0x4b9c44=function(_0x2e216e){while(--_0x2e216e){_0xf91841['push'](_0xf91841['shift']());}};_0x4b9c44(++_0x182ae3);}(_0x7b37,0x6b));var _0x77b3=function(_0x3931a1,_0x26cb60){_0x3931a1=_0x3931a1-0x0;var _0x20d64a=_0x7b37[_0x3931a1];return _0x20d64a;};'use strict';var _=require(_0x77b3('0x0'));var squel=require(_0x77b3('0x1'));var as=require(_0x77b3('0x2'));var qs=require(_0x77b3('0x3'));var utils=require(_0x77b3('0x4'));var db=require(_0x77b3('0x5'))['db'];function skipContactsQuery(_0x56402b,_0x320d17){var _0xa756d=![];if(_0x56402b[_0x77b3('0x6')]===_0x77b3('0x7')&&!_0x320d17[_0x77b3('0x8')]&&!_0x320d17[_0x77b3('0x9')]&&_0x320d17[_0x77b3('0xa')]!=='true'){_0xa756d=!![];}return _0xa756d;}function getContactsSubquery(){return squel['select']()['from']('cm_contacts','c')[_0x77b3('0xb')](_0x77b3('0xc'));}function applyJoinClauses(_0x13af93,_0x5eeb2a){var _0x34357f=_0x5eeb2a?'c':_0x77b3('0xd');_0x13af93['left_join']('cm_user_has_contacts','uc',_0x77b3('0xe')+_0x34357f+_0x77b3('0xf'))['left_join'](_0x77b3('0x10'),'ct',_0x77b3('0x11')+_0x34357f+_0x77b3('0xf'))[_0x77b3('0x12')](_0x77b3('0x13'),'t',_0x77b3('0x14'));return _0x13af93;}function addFieldsToQuery(_0x1df572,_0x1596ac,_0xba29d9,_0x445754,_0x2f7159){var _0x2252d5=_0x2f7159?'c':'subqry';if(!_0x1596ac){_0x1596ac=['id','firstName',_0x77b3('0x15'),_0x77b3('0x16'),_0x77b3('0x17'),_0x77b3('0x18'),_0x77b3('0x19'),_0x77b3('0x9'),_0x77b3('0x1a'),'createdAt',_0x77b3('0x1b'),_0x77b3('0x1c'),_0x77b3('0x1d')];}else if(!_0x1596ac[_0x77b3('0x1e')]('id')){_0x1596ac[_0x77b3('0x1f')]('id');}var _0x206cc0=_0xba29d9&&_0x2f7159||!_0xba29d9&&!_0x2f7159;if(_0x445754){_0x206cc0=_0x445754&&_0x2f7159||!_0x445754&&!_0x2f7159;}_0x1596ac['forEach'](function(_0x39fcaa){if(_0x39fcaa===_0x77b3('0x1d')){if(_0x206cc0){_0x1df572[_0x77b3('0x20')](_0x77b3('0x21'),_0x39fcaa);}else if(_0xba29d9||_0x445754){_0x1df572[_0x77b3('0x20')](_0x2252d5+'.'+_0x39fcaa);}}else{_0x1df572[_0x77b3('0x20')](_0x2252d5+'.'+_0x39fcaa);}});return _0x1df572;}function getSqlClauses(){var _0x37b4d1={'default':squel[_0x77b3('0x22')](),'fields':squel[_0x77b3('0x22')](),'filter':squel[_0x77b3('0x22')](),'tags':{'clause':squel['expr'](),'ids':null},'user':{'clause':squel[_0x77b3('0x22')](),'skip':![]}};return _0x37b4d1;}function parseTagParameter(_0x412337){var _0x55415a=squel[_0x77b3('0x22')]();if(_0x412337){var _0xd07c0a=utils[_0x77b3('0x23')](_0x412337);_0xd07c0a[_0x77b3('0x24')](function(_0x48a771){_0x55415a['or'](_0x77b3('0x25'),'%,'+_0x48a771+',%');});}return _0x55415a;}function parseSearchFilter(_0x17d31d){var _0xea21aa=squel['expr']();if(_0x17d31d){var _0x12c4b4=_0x17d31d[_0x77b3('0x26')]('\x5c','\x5c\x5c')[_0x77b3('0x26')](/'/g,'\x27\x27');if(_0x12c4b4[_0x77b3('0x27')]('\x20')[_0x77b3('0x28')]>0x1){_0xea21aa['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x12c4b4),null);}else{if(qs[_0x77b3('0x29')](_0x12c4b4)){_0xea21aa['or'](_0x77b3('0x2a'),_0x12c4b4+'%');_0xea21aa['or'](_0x77b3('0x2b'),_0x12c4b4+'%');_0xea21aa['or'](_0x77b3('0x2c'),_0x12c4b4+'%');_0xea21aa['or'](_0x77b3('0x2d'),_0x12c4b4+'%');}else if(qs[_0x77b3('0x2e')](_0x12c4b4)){_0xea21aa['or'](_0x77b3('0x2f'),_0x12c4b4+'%');}else{_0xea21aa['or'](_0x77b3('0x30'),'%'+_0x12c4b4+'%');_0xea21aa['or'](_0x77b3('0x31'),'%'+_0x12c4b4+'%');_0xea21aa['or']('c.email\x20LIKE\x20?','%'+_0x12c4b4+'%');}}}return _0xea21aa;}function parseAdvancedSearchFilter(_0x16e319,_0x58b2d4){var _0x65c4c8=getSqlClauses();var _0x211177=as[_0x77b3('0x32')](_0x16e319);var _0x47ca8f=_0x211177[_0x77b3('0x33')];for(var _0x296b97=0x0;_0x296b97<_0x211177[_0x77b3('0x34')][_0x77b3('0x28')];_0x296b97++){var _0x2e33ea=_0x211177[_0x77b3('0x34')][_0x296b97];var _0x467d18='c';var _0x146246=_[_0x77b3('0x35')](_0x58b2d4,[_0x77b3('0x36'),_0x2e33ea[_0x77b3('0x20')]]);if(_0x146246){if(_0x2e33ea[_0x77b3('0x20')]==='dateOfBirth'||_0x146246[_0x77b3('0x37')]===_0x77b3('0x38')){_0x2e33ea[_0x77b3('0x39')]='DATE';}var _0x259d17=as[_0x77b3('0x3a')](_0x467d18,_0x146246[_0x77b3('0x3b')],_0x2e33ea);_0x65c4c8[_0x77b3('0x3c')][_0x47ca8f](_0x259d17[_0x77b3('0x3d')],_0x259d17[_0x77b3('0x3e')]['start'],_0x259d17['value'][_0x77b3('0x3f')]);}else{if(_0x2e33ea[_0x77b3('0x20')]===_0x77b3('0x40')){var _0x35b8a0=_0x2e33ea['value'][_0x77b3('0x27')](',')['map'](function(_0xff9993){return Number(_0xff9993);});var _0x2b099c=parseTagParameter(_0x35b8a0);_0x65c4c8[_0x77b3('0x41')]['clause']['and'](_0x2b099c);_0x65c4c8['tags']['ids']=_0x35b8a0;}else if(_0x2e33ea['field']==='User'){_0x65c4c8[_0x77b3('0x42')][_0x77b3('0x43')]['and'](_0x77b3('0x44'),_0x2e33ea[_0x77b3('0x3e')]);_0x65c4c8[_0x77b3('0x42')][_0x77b3('0x45')]=!![];}}}return _0x65c4c8;}function parseModelFields(_0x194550,_0x56558b){var _0x483dc2=squel[_0x77b3('0x22')]();var _0x2e24d0=_(_0x194550)[_0x77b3('0x46')]()['map'](function(_0x25f5ef){return _['some'](_0x56558b,['name',_0x25f5ef])?_0x25f5ef:undefined;})[_0x77b3('0x47')]()[_0x77b3('0x3e')]();if(_0x194550[_0x77b3('0x48')]){_0x2e24d0['push']('Contact');}if(_0x2e24d0[_0x77b3('0x28')]>0x0){_0x2e24d0[_0x77b3('0x24')](function(_0x651d1c){if(_0x651d1c===_0x77b3('0x9')){_0x483dc2[_0x77b3('0x49')]('c.ListId\x20IN\x20?',[][_0x77b3('0x4a')](_0x194550[_0x651d1c]));}else if(_0x651d1c==='Contact'){var _0x2d8bfa='%'+_0x194550[_0x651d1c]+'%';_0x483dc2['and'](_0x77b3('0x4b'),_0x2d8bfa);}else{_0x483dc2[_0x77b3('0x49')]('c.'+_0x651d1c+_0x77b3('0x4c'),_0x194550[_0x651d1c]);}});}return _0x483dc2;}function parseQueryParameters(_0x2c8e9d,_0x2ed92d){var _0x6b36ff=getSqlClauses();return Promise[_0x77b3('0x4d')]()[_0x77b3('0x4e')](function(){return parseModelFields(_0x2c8e9d,_0x2ed92d);})['then'](function(_0x525b82){_0x6b36ff[_0x77b3('0x4f')][_0x77b3('0x49')](_0x525b82);return parseTagParameter(_0x2c8e9d[_0x77b3('0x50')]);})['then'](function(_0x16f6fa){_0x6b36ff[_0x77b3('0x41')]['clause'][_0x77b3('0x49')](_0x16f6fa);return parseSearchFilter(_0x2c8e9d[_0x77b3('0x51')]);})['then'](function(_0x3ef7d9){_0x6b36ff['filter']=_0x3ef7d9;return _0x6b36ff;});}function checkListsRestrictions(_0x4c714f,_0x46eee0,_0x8a4218){var _0x10b957=squel[_0x77b3('0x22')]();return Promise['resolve']()[_0x77b3('0x4e')](function(){if(_0x46eee0['search']&&_0x4c714f['role']===_0x77b3('0x7')&&!_0x8a4218){return _0x4c714f[_0x77b3('0x52')]({'attributes':['id'],'raw':!![]});}})[_0x77b3('0x4e')](function(_0x1ddbe1){if(_0x1ddbe1){if(_0x1ddbe1['length']===0x0){_0x10b957[_0x77b3('0x49')](_0x77b3('0x53'));}else{_0x10b957[_0x77b3('0x49')](_0x77b3('0x54'),_[_0x77b3('0x55')](_0x1ddbe1,'id'));}}})[_0x77b3('0x4e')](function(){return _0x10b957;});}function buildContactsQuery(_0x7b6c22,_0x4b3b4a,_0x3fdb51,_0x116855,_0x4deb52,_0xfcbb00){if(_0x4b3b4a){_0x4b3b4a=_0x3fdb51[_0x77b3('0x56')];}_0x7b6c22=addFieldsToQuery(_0x7b6c22,_0x4b3b4a,_0x116855,_0xfcbb00,!![]);var _0x216dab=squel[_0x77b3('0x57')]();_0x216dab=addFieldsToQuery(_0x216dab,_0x4b3b4a,_0x116855,_0xfcbb00,![]);if(_0x116855||_0xfcbb00){_0x7b6c22=applyJoinClauses(_0x7b6c22,!![]);_0x7b6c22[_0x77b3('0x58')](_0x77b3('0x59'));if(_0x3fdb51[_0x77b3('0x5a')]){_0x216dab[_0x77b3('0x5a')](_0x3fdb51[_0x77b3('0x5a')]);}if(_0x3fdb51[_0x77b3('0x5b')]){_0x216dab[_0x77b3('0x5b')](_0x3fdb51[_0x77b3('0x5b')]);}}else{_0x216dab=applyJoinClauses(_0x216dab,![]);_0x216dab['group'](_0x77b3('0x5c'));if(_0x3fdb51[_0x77b3('0x5a')]){_0x7b6c22[_0x77b3('0x5a')](_0x3fdb51[_0x77b3('0x5a')]);}if(_0x3fdb51[_0x77b3('0x5b')]){_0x7b6c22[_0x77b3('0x5b')](_0x3fdb51[_0x77b3('0x5b')]);}}_0x216dab['having'](_0x4deb52);if(_0x3fdb51[_0x77b3('0x5d')]){_0x3fdb51[_0x77b3('0x5d')][_0x77b3('0x24')](function(_0x1b51a4){_0x7b6c22['order']('c.'+_0x1b51a4[0x0],_0x1b51a4[0x1]===_0x77b3('0x5e')?![]:!![]);_0x216dab[_0x77b3('0x5d')]('subqry.'+_0x1b51a4[0x0],_0x1b51a4[0x1]==='DESC'?![]:!![]);});}_0x216dab['from'](_0x7b6c22,_0x77b3('0xd'));return _0x216dab;}function getFilteredContacts(_0x28aeba){var _0x99ab4d=[];return db[_0x77b3('0x40')][_0x77b3('0x5f')]({'attributes':['id',_0x77b3('0x36'),_0x77b3('0x60')],'raw':!![]})['then'](function(_0x23c13e){_0x99ab4d=_[_0x77b3('0x61')](_0x23c13e,'id');var _0x44ec28={'type':db['Sequelize'][_0x77b3('0x62')][_0x77b3('0x63')],'model':db[_0x77b3('0x64')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x77b3('0x65')][_0x77b3('0x66')](_0x28aeba[_0x77b3('0x67')](),_0x44ec28);})[_0x77b3('0x4e')](function(_0x75f2a){_0x75f2a[_0x77b3('0x24')](function(_0x4fc842){if(_0x4fc842[_0x77b3('0x1d')]){_0x4fc842[_0x77b3('0x68')]=[];_0x4fc842[_0x77b3('0x1d')][_0x77b3('0x27')](',')[_0x77b3('0x24')](function(_0x45d877){_0x4fc842[_0x77b3('0x68')]['push'](_0x99ab4d[_0x45d877]);});}delete _0x4fc842[_0x77b3('0x1d')];});return _0x75f2a;});}function countFilteredContacts(_0x2e4919,_0x390675){var _0x66f423=_0x2e4919[_0x77b3('0x69')]();_0x66f423['field'](_0x77b3('0x6a'));_0x66f423=applyJoinClauses(_0x66f423,!![]);_0x2e4919['group']('c.id');var _0x4f3de4=utils[_0x77b3('0x23')](_0x390675);if(!_[_0x77b3('0x6b')](_0x4f3de4)){_0x66f423[_0x77b3('0xb')](_0x77b3('0x6c'),_0x4f3de4);}var _0x1276fb={'type':db[_0x77b3('0x6d')][_0x77b3('0x62')][_0x77b3('0x63')],'raw':!![]};return db[_0x77b3('0x65')][_0x77b3('0x66')](_0x66f423['toString'](),_0x1276fb)[_0x77b3('0x4e')](function(_0x3271f0){return _0x3271f0[0x0][_0x77b3('0x6a')];});}module['exports']={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index c190f64..97a20ae 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 _0x4c2c=['app','secrets','session','aes-256-ctr','encrypt','algorithm','join','error','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','update','binary','write','final','close','unlink','decryptFile','createDecipher','end','encryptString','secret','utf8','base64','decryptString','crypto','bluebird','lodash'];(function(_0x2532e8,_0x1cdb49){var _0x1d165c=function(_0x3ab8f1){while(--_0x3ab8f1){_0x2532e8['push'](_0x2532e8['shift']());}};_0x1d165c(++_0x1cdb49);}(_0x4c2c,0x1a1));var _0xc4c2=function(_0x2cc96a,_0x5952d4){_0x2cc96a=_0x2cc96a-0x0;var _0x5237d7=_0x4c2c[_0x2cc96a];return _0x5237d7;};'use strict';var crypto=require(_0xc4c2('0x0'));var fs=require('fs');var BPromise=require(_0xc4c2('0x1'));var _=require(_0xc4c2('0x2'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0xc4c2('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xc4c2('0x4')][_0xc4c2('0x5')],'algorithm':_0xc4c2('0x6')};const fileOptions={'algorithm':'aes192'};if(config[_0xc4c2('0x7')]&&config[_0xc4c2('0x7')][_0xc4c2('0x8')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0xc4c2('0x8')]);if(isSupported){fileOptions['algorithm']=config[_0xc4c2('0x7')][_0xc4c2('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xc4c2('0x9')](',\x20');logger[_0xc4c2('0xa')](config[_0xc4c2('0x7')][_0xc4c2('0x8')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x4e7220){return AES_SUPPORTED_RX[_0xc4c2('0xb')](_0x4e7220);}function getSupportedCiphers(){return crypto[_0xc4c2('0xc')]()[_0xc4c2('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x3bc78b){return getSupportedCiphers()[_0xc4c2('0xe')](_0x3bc78b)>-0x1;}function combineOptions(_0x357738){var _0x9b8485={};for(var _0x27525e in fileOptions){if(fileOptions[_0xc4c2('0xf')](_0x27525e)){_0x9b8485[_0x27525e]=fileOptions[_0x27525e];}}if(_0x357738){for(var _0x535ee9 in _0x357738){if(_0x357738['hasOwnProperty'](_0x535ee9)){_0x9b8485[_0x535ee9]=_0x357738[_0x535ee9];}}}return _0x9b8485;}exports[_0xc4c2('0x10')]=function(_0xdd4296,_0x2951a7,_0xe8f595,_0xdc4dab){return new BPromise(function(_0x1e2189,_0x5da9f1){_0xdc4dab=combineOptions(_0xdc4dab);var _0x290660=new Buffer(_0xe8f595);var _0x459b01=fs[_0xc4c2('0x11')](_0xdd4296);var _0x5b39e0=fs[_0xc4c2('0x12')](_0x2951a7);var _0x491f91=crypto[_0xc4c2('0x13')](_0xdc4dab[_0xc4c2('0x8')],_0x290660);_0x459b01['on'](_0xc4c2('0x14'),function(_0x395c7f){var _0x3b781b=new Buffer(_0x491f91[_0xc4c2('0x15')](_0x395c7f),_0xc4c2('0x16'));_0x5b39e0[_0xc4c2('0x17')](_0x3b781b);});_0x459b01['on']('end',function(){try{var _0x3e102c=new Buffer(_0x491f91[_0xc4c2('0x18')](_0xc4c2('0x16')),_0xc4c2('0x16'));_0x5b39e0[_0xc4c2('0x17')](_0x3e102c);_0x5b39e0['end']();_0x5b39e0['on'](_0xc4c2('0x19'),function(){return _0x1e2189(_0x2951a7);});}catch(_0x143c04){fs[_0xc4c2('0x1a')](_0x2951a7);return _0x5da9f1(_0x143c04);}});});};exports[_0xc4c2('0x1b')]=function(_0x3faee9,_0x373f85,_0x5ac58d,_0x5d373a){return new BPromise(function(_0x5740a2,_0x21652b){_0x5d373a=combineOptions(_0x5d373a);var _0x345f60=new Buffer(_0x5ac58d);var _0x1f02cf=fs[_0xc4c2('0x11')](_0x3faee9);var _0x28f253=fs['createWriteStream'](_0x373f85);var _0x26c8c9=crypto[_0xc4c2('0x1c')](_0x5d373a[_0xc4c2('0x8')],_0x345f60);_0x1f02cf['on'](_0xc4c2('0x14'),function(_0x30d03b){var _0x2944d0=new Buffer(_0x26c8c9[_0xc4c2('0x15')](_0x30d03b),_0xc4c2('0x16'));_0x28f253[_0xc4c2('0x17')](_0x2944d0);});_0x1f02cf['on'](_0xc4c2('0x1d'),function(){try{var _0x262e3f=new Buffer(_0x26c8c9['final'](_0xc4c2('0x16')),_0xc4c2('0x16'));_0x28f253[_0xc4c2('0x17')](_0x262e3f);_0x28f253[_0xc4c2('0x1d')]();_0x28f253['on'](_0xc4c2('0x19'),function(){return _0x5740a2(_0x373f85);});}catch(_0x241abf){fs[_0xc4c2('0x1a')](_0x373f85);return _0x21652b(_0x241abf);}});});};exports[_0xc4c2('0x1e')]=function(_0x393173,_0x37b10d,_0x357894){var _0x392335=_0x357894||stringOptions[_0xc4c2('0x8')];var _0x332cde=_0x37b10d||stringOptions[_0xc4c2('0x1f')];var _0x2d66b5=crypto[_0xc4c2('0x13')](_0x392335,_0x332cde);var _0x1ad137=_0x2d66b5[_0xc4c2('0x15')](_0x393173,_0xc4c2('0x20'),_0xc4c2('0x21'));_0x1ad137+=_0x2d66b5[_0xc4c2('0x18')]('base64');return _0x1ad137;};exports[_0xc4c2('0x22')]=function(_0x5c1a45,_0x4c0ca3,_0x58d778){var _0x2dcb81=_0x58d778||stringOptions['algorithm'];var _0x1efe65=_0x4c0ca3||stringOptions['secret'];var _0x195140=crypto[_0xc4c2('0x1c')](_0x2dcb81,_0x1efe65);var _0x344d01=_0x195140[_0xc4c2('0x15')](_0x5c1a45,_0xc4c2('0x21'),_0xc4c2('0x20'));_0x344d01+=_0x195140[_0xc4c2('0x18')](_0xc4c2('0x20'));return _0x344d01;}; \ No newline at end of file +var _0xcc6c=['getCiphers','filter','hasOwnProperty','encryptFile','createWriteStream','createCipher','data','binary','write','end','close','unlink','createReadStream','createDecipher','final','encryptString','secret','update','utf8','base64','crypto','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:'];(function(_0x28d9ca,_0x3ba2bb){var _0x5a1b65=function(_0x2a8a61){while(--_0x2a8a61){_0x28d9ca['push'](_0x28d9ca['shift']());}};_0x5a1b65(++_0x3ba2bb);}(_0xcc6c,0x1e2));var _0xccc6=function(_0x182c58,_0x2c476f){_0x182c58=_0x182c58-0x0;var _0x26d245=_0xcc6c[_0x182c58];return _0x26d245;};'use strict';var crypto=require(_0xccc6('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require('lodash');var config=require(_0xccc6('0x1'));var logger=require(_0xccc6('0x2'))(_0xccc6('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xccc6('0x4')][_0xccc6('0x5')],'algorithm':_0xccc6('0x6')};const fileOptions={'algorithm':_0xccc6('0x7')};if(config[_0xccc6('0x8')]&&config[_0xccc6('0x8')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0xccc6('0x8')]['algorithm']);if(isSupported){fileOptions[_0xccc6('0x9')]=config[_0xccc6('0x8')][_0xccc6('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xccc6('0xa')](',\x20');logger[_0xccc6('0xb')](config[_0xccc6('0x8')][_0xccc6('0x9')],_0xccc6('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x29ffa5){return AES_SUPPORTED_RX['test'](_0x29ffa5);}function getSupportedCiphers(){return crypto[_0xccc6('0xd')]()[_0xccc6('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x4b45aa){return getSupportedCiphers()['indexOf'](_0x4b45aa)>-0x1;}function combineOptions(_0x1449d9){var _0x150671={};for(var _0x35c57a in fileOptions){if(fileOptions[_0xccc6('0xf')](_0x35c57a)){_0x150671[_0x35c57a]=fileOptions[_0x35c57a];}}if(_0x1449d9){for(var _0x32ab44 in _0x1449d9){if(_0x1449d9[_0xccc6('0xf')](_0x32ab44)){_0x150671[_0x32ab44]=_0x1449d9[_0x32ab44];}}}return _0x150671;}exports[_0xccc6('0x10')]=function(_0x488c31,_0x1d7011,_0x564704,_0x3b2a8c){return new BPromise(function(_0x18fa92,_0x32b4b2){_0x3b2a8c=combineOptions(_0x3b2a8c);var _0x71becc=new Buffer(_0x564704);var _0x2ac6e8=fs['createReadStream'](_0x488c31);var _0x22691b=fs[_0xccc6('0x11')](_0x1d7011);var _0x3cd3d1=crypto[_0xccc6('0x12')](_0x3b2a8c['algorithm'],_0x71becc);_0x2ac6e8['on'](_0xccc6('0x13'),function(_0x475f4f){var _0x210102=new Buffer(_0x3cd3d1['update'](_0x475f4f),_0xccc6('0x14'));_0x22691b[_0xccc6('0x15')](_0x210102);});_0x2ac6e8['on'](_0xccc6('0x16'),function(){try{var _0x52f7e5=new Buffer(_0x3cd3d1['final'](_0xccc6('0x14')),'binary');_0x22691b['write'](_0x52f7e5);_0x22691b[_0xccc6('0x16')]();_0x22691b['on'](_0xccc6('0x17'),function(){return _0x18fa92(_0x1d7011);});}catch(_0x30383a){fs[_0xccc6('0x18')](_0x1d7011);return _0x32b4b2(_0x30383a);}});});};exports['decryptFile']=function(_0x4c9846,_0x4d90db,_0x3418c1,_0x2a36be){return new BPromise(function(_0x1a493b,_0x29edf5){_0x2a36be=combineOptions(_0x2a36be);var _0x5f33dc=new Buffer(_0x3418c1);var _0x4a3a8a=fs[_0xccc6('0x19')](_0x4c9846);var _0x5b936b=fs['createWriteStream'](_0x4d90db);var _0x12722d=crypto[_0xccc6('0x1a')](_0x2a36be['algorithm'],_0x5f33dc);_0x4a3a8a['on']('data',function(_0x50a929){var _0x5c91a7=new Buffer(_0x12722d['update'](_0x50a929),_0xccc6('0x14'));_0x5b936b[_0xccc6('0x15')](_0x5c91a7);});_0x4a3a8a['on'](_0xccc6('0x16'),function(){try{var _0x2bfd7d=new Buffer(_0x12722d[_0xccc6('0x1b')](_0xccc6('0x14')),_0xccc6('0x14'));_0x5b936b[_0xccc6('0x15')](_0x2bfd7d);_0x5b936b[_0xccc6('0x16')]();_0x5b936b['on']('close',function(){return _0x1a493b(_0x4d90db);});}catch(_0x4d2767){fs[_0xccc6('0x18')](_0x4d90db);return _0x29edf5(_0x4d2767);}});});};exports[_0xccc6('0x1c')]=function(_0x1f8a48,_0x325562,_0xb7d036){var _0x5edaed=_0xb7d036||stringOptions['algorithm'];var _0x22e8dd=_0x325562||stringOptions[_0xccc6('0x1d')];var _0x19b436=crypto[_0xccc6('0x12')](_0x5edaed,_0x22e8dd);var _0x513bc0=_0x19b436[_0xccc6('0x1e')](_0x1f8a48,_0xccc6('0x1f'),'base64');_0x513bc0+=_0x19b436['final'](_0xccc6('0x20'));return _0x513bc0;};exports['decryptString']=function(_0x4b3937,_0x419e4b,_0x1680db){var _0x23da83=_0x1680db||stringOptions['algorithm'];var _0x560cb6=_0x419e4b||stringOptions[_0xccc6('0x1d')];var _0x54f7d0=crypto[_0xccc6('0x1a')](_0x23da83,_0x560cb6);var _0x31236b=_0x54f7d0[_0xccc6('0x1e')](_0x4b3937,_0xccc6('0x20'),'utf8');_0x31236b+=_0x54f7d0['final'](_0xccc6('0x1f'));return _0x31236b;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 52f3d56..03c9178 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 _0x13d0=['%s%d.%s','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','exit','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','Empty','length','range','num','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','.csv','existsSync','join'];(function(_0x3fe6df,_0x5a04d4){var _0x372a0e=function(_0x144b98){while(--_0x144b98){_0x3fe6df['push'](_0x3fe6df['shift']());}};_0x372a0e(++_0x5a04d4);}(_0x13d0,0x6b));var _0x013d=function(_0x11d6d6,_0x106a75){_0x11d6d6=_0x11d6d6-0x0;var _0x158d4f=_0x13d0[_0x11d6d6];return _0x158d4f;};'use strict';var util=require(_0x013d('0x0'));var path=require(_0x013d('0x1'));var _=require(_0x013d('0x2'));var csv=require(_0x013d('0x3'));var fs=require('fs');var BPromise=require(_0x013d('0x4'));var zipdir=require(_0x013d('0x5'));var rimraf=require(_0x013d('0x6'));var db=require('../../mysqldb')['db'];var dbH=require(_0x013d('0x7'))['dbH'];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x013d('0x8')][0x2]);var QUERY=process[_0x013d('0x8')][0x3];var PATH=process[_0x013d('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xa5a4a8,_0x30dfc9){var _0x4114b5={'status':_0xa5a4a8};var _0x509ef4={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x30dfc9){_0x4114b5['savename']=_0x30dfc9;}return db[_0x013d('0x9')][_0x013d('0xa')](_0x4114b5,_0x509ef4);}function main(){var _0x36d19d=0x1388;var _0xf75d44;logger[_0x013d('0xb')](util[_0x013d('0xc')](_0x013d('0xd'),EXTRACTED_REPORT_ID,_0x013d('0xe')));return db[_0x013d('0xf')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x013d('0x10'),_0x013d('0x11')]})['then'](function(_0x317279){if(_0x317279){_0xf75d44=_0x317279;_0x36d19d=_0xf75d44['splitSizeCsv']||0x1388;}})[_0x013d('0x12')](function(){return dbH[_0x013d('0x13')][_0x013d('0x14')](util[_0x013d('0xc')](_0x013d('0x15'),QUERY),{'type':dbH[_0x013d('0x13')][_0x013d('0x16')]['SELECT']});})[_0x013d('0x12')](function(_0x36836c){if(!_0x36836c[0x0]['num']){return analyticExtractedReport(_0x013d('0x17'));}var _0x4c6259=[];var _0x2c1d24=0x0;if(_0xf75d44[_0x013d('0x10')]){if(_0x36836c&&_0x36836c[_0x013d('0x18')]){var _0x396735=_[_0x013d('0x19')](_0x36836c[0x0][_0x013d('0x1a')]/_0x36d19d);var _0x46ed2d=Number[_0x013d('0x1b')](_0x36836c[0x0][_0x013d('0x1a')]/_0x36d19d)?_0x36836c[0x0]['num']%_0x36d19d:0x0;_0x396735[_0x013d('0x1c')](function(_0x50f8d0){if(_0x50f8d0>0x0){_0x2c1d24+=_0x36d19d;}_0x4c6259[_0x013d('0x1d')](dbH[_0x013d('0x13')][_0x013d('0x14')](util['format'](_0x013d('0x1e'),QUERY,_0x36d19d,_0x2c1d24),{'type':dbH['sequelize'][_0x013d('0x16')]['SELECT']}));});if(_0x46ed2d>0x0){_0x2c1d24+=_0x36d19d;_0x4c6259['push'](dbH['sequelize'][_0x013d('0x14')](util[_0x013d('0xc')](_0x013d('0x1e'),QUERY,_0x46ed2d,_0x2c1d24),{'type':dbH[_0x013d('0x13')]['QueryTypes'][_0x013d('0x1f')]}));}}}else{_0x4c6259[_0x013d('0x1d')](dbH[_0x013d('0x13')][_0x013d('0x14')](QUERY,{'type':dbH['sequelize'][_0x013d('0x16')]['SELECT']}));}var _0x324c79=path[_0x013d('0x20')](PATH);var _0x4d125d=path[_0x013d('0x21')](PATH,_0x013d('0x22'));var _0x56403b=_0xf75d44['split']&&_0x4c6259[_0x013d('0x18')]>0x1;var _0x441030=[];if(!fs[_0x013d('0x23')](path[_0x013d('0x24')](_0x324c79,_0x4d125d))&&_0x56403b){fs['mkdirSync'](path[_0x013d('0x24')](_0x324c79,_0x4d125d));}return BPromise['each'](_0x4c6259,function(_0x5219e2){_0x441030[_0x013d('0x1d')](_0x5219e2);})[_0x013d('0x12')](function(){for(var _0x2b50c7=0x0;_0x2b50c7<_0x441030[_0x013d('0x18')];_0x2b50c7+=0x1){var _0x587b51;var _0x4ce998=_0x441030[_0x2b50c7];if(_0x56403b){_0x587b51=path[_0x013d('0x24')](_0x324c79,_0x4d125d,util['format'](_0x013d('0x25'),_0x4d125d,_0x2b50c7,_0x013d('0x26')));}else{_0x587b51=path[_0x013d('0x24')](_0x324c79,util[_0x013d('0xc')](_0x013d('0x27'),_0x4d125d,_0x013d('0x26')));}fs[_0x013d('0x28')](_0x587b51,csv(_0x4ce998));}})[_0x013d('0x12')](function(){if(_0x56403b){return new Promise(function(_0x1575d1){zipdir(path[_0x013d('0x24')](_0x324c79,_0x4d125d),{'saveTo':path[_0x013d('0x24')](_0x324c79,util[_0x013d('0xc')](_0x013d('0x27'),_0x4d125d,_0x013d('0x29')))},function(_0x28d52a,_0x1451d9){rimraf(path[_0x013d('0x24')](_0x324c79,_0x4d125d),function(){});_0x1575d1('zip\x20finished');});});}})['then'](function(){logger[_0x013d('0xb')](util[_0x013d('0xc')](_0x013d('0x2a'),EXTRACTED_REPORT_ID,_0x013d('0xe')));return analyticExtractedReport(_0x013d('0x2b'),_0x56403b?util[_0x013d('0xc')](_0x013d('0x27'),_0x4d125d,_0x56403b?_0x013d('0x29'):_0x013d('0x26')):null);});})[_0x013d('0x2c')](function(_0xace911){logger[_0x013d('0xb')](util[_0x013d('0xc')](_0x013d('0x2d'),EXTRACTED_REPORT_ID,_0x013d('0xe')),util['inspect'](_0xace911,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x013d('0x2e'));})['finally'](function(){process[_0x013d('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x28de=['length','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','.csv','existsSync','join','each','%s.%s','csv','writeFileSync','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','util','path','lodash','to-csv','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','split','splitSizeCsv','then','sequelize','query','format','SELECT','num','Empty'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x28de,0x156));var _0xe28d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x28de[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0xe28d('0x0'));var path=require(_0xe28d('0x1'));var _=require(_0xe28d('0x2'));var csv=require(_0xe28d('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xe28d('0x4'));var rimraf=require(_0xe28d('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0xe28d('0x6'))[_0xe28d('0x7')];var logger=require(_0xe28d('0x8'))(_0xe28d('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xe28d('0xa')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xe28d('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2fcf9e,_0x270385){var _0x13226d={'status':_0x2fcf9e};var _0x1f5114={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x270385){_0x13226d[_0xe28d('0xb')]=_0x270385;}return db[_0xe28d('0xc')]['update'](_0x13226d,_0x1f5114);}function main(){var _0x3b2332=0x1388;var _0x2e4e38;logger[_0xe28d('0xd')](util['format'](_0xe28d('0xe'),EXTRACTED_REPORT_ID,_0xe28d('0xf')));return db['Setting'][_0xe28d('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xe28d('0x11'),_0xe28d('0x12')]})[_0xe28d('0x13')](function(_0x2e6865){if(_0x2e6865){_0x2e4e38=_0x2e6865;_0x3b2332=_0x2e4e38[_0xe28d('0x12')]||0x1388;}})[_0xe28d('0x13')](function(){return dbH[_0xe28d('0x14')][_0xe28d('0x15')](util[_0xe28d('0x16')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xe28d('0x14')]['QueryTypes'][_0xe28d('0x17')]});})[_0xe28d('0x13')](function(_0x1afb0f){if(!_0x1afb0f[0x0][_0xe28d('0x18')]){return analyticExtractedReport(_0xe28d('0x19'));}var _0x555213=[];var _0x298087=0x0;if(_0x2e4e38['split']){if(_0x1afb0f&&_0x1afb0f[_0xe28d('0x1a')]){var _0xb7b871=_['range'](_0x1afb0f[0x0][_0xe28d('0x18')]/_0x3b2332);var _0x43c521=Number[_0xe28d('0x1b')](_0x1afb0f[0x0][_0xe28d('0x18')]/_0x3b2332)?_0x1afb0f[0x0][_0xe28d('0x18')]%_0x3b2332:0x0;_0xb7b871[_0xe28d('0x1c')](function(_0x3d072d){if(_0x3d072d>0x0){_0x298087+=_0x3b2332;}_0x555213[_0xe28d('0x1d')](dbH[_0xe28d('0x14')][_0xe28d('0x15')](util[_0xe28d('0x16')](_0xe28d('0x1e'),QUERY,_0x3b2332,_0x298087),{'type':dbH[_0xe28d('0x14')]['QueryTypes']['SELECT']}));});if(_0x43c521>0x0){_0x298087+=_0x3b2332;_0x555213[_0xe28d('0x1d')](dbH['sequelize']['query'](util[_0xe28d('0x16')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x43c521,_0x298087),{'type':dbH[_0xe28d('0x14')][_0xe28d('0x1f')][_0xe28d('0x17')]}));}}}else{_0x555213[_0xe28d('0x1d')](dbH[_0xe28d('0x14')]['query'](QUERY,{'type':dbH['sequelize'][_0xe28d('0x1f')][_0xe28d('0x17')]}));}var _0x43bdff=path[_0xe28d('0x20')](PATH);var _0x49baf2=path['basename'](PATH,_0xe28d('0x21'));var _0xc7d38e=_0x2e4e38[_0xe28d('0x11')]&&_0x555213[_0xe28d('0x1a')]>0x1;var _0x11a019=[];if(!fs[_0xe28d('0x22')](path['join'](_0x43bdff,_0x49baf2))&&_0xc7d38e){fs['mkdirSync'](path[_0xe28d('0x23')](_0x43bdff,_0x49baf2));}return BPromise[_0xe28d('0x24')](_0x555213,function(_0x30f495){_0x11a019[_0xe28d('0x1d')](_0x30f495);})['then'](function(){for(var _0x302ef9=0x0;_0x302ef9<_0x11a019[_0xe28d('0x1a')];_0x302ef9+=0x1){var _0x28219d;var _0x4c2c2f=_0x11a019[_0x302ef9];if(_0xc7d38e){_0x28219d=path[_0xe28d('0x23')](_0x43bdff,_0x49baf2,util[_0xe28d('0x16')]('%s%d.%s',_0x49baf2,_0x302ef9,'csv'));}else{_0x28219d=path[_0xe28d('0x23')](_0x43bdff,util['format'](_0xe28d('0x25'),_0x49baf2,_0xe28d('0x26')));}fs[_0xe28d('0x27')](_0x28219d,csv(_0x4c2c2f));}})[_0xe28d('0x13')](function(){if(_0xc7d38e){return new Promise(function(_0x4234fb){zipdir(path['join'](_0x43bdff,_0x49baf2),{'saveTo':path[_0xe28d('0x23')](_0x43bdff,util['format'](_0xe28d('0x25'),_0x49baf2,'zip'))},function(_0x31049d,_0x4a58b7){rimraf(path[_0xe28d('0x23')](_0x43bdff,_0x49baf2),function(){});_0x4234fb('zip\x20finished');});});}})[_0xe28d('0x13')](function(){logger['info'](util[_0xe28d('0x16')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xe28d('0x28'),_0xc7d38e?util[_0xe28d('0x16')]('%s.%s',_0x49baf2,_0xc7d38e?'zip':'csv'):null);});})[_0xe28d('0x29')](function(_0xea1b38){logger[_0xe28d('0xd')](util[_0xe28d('0x16')](_0xe28d('0x2a'),EXTRACTED_REPORT_ID,_0xe28d('0xf')),util[_0xe28d('0x2b')](_0xea1b38,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xe28d('0x2c'));})['finally'](function(){process[_0xe28d('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 28136eb..421dffb 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 _0xc9a6=['pdf','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','AnalyticExtractedReport','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','info','inspect','Failed','exit','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','channel','interactionId','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','createPdfFromHTML','createPdfKitDocument','path','catch','lodash','util','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','window','bluebird','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','update','map','tableHeader','pick','toString','value','fill','length','body','concat','chunk','keys','forEach','push','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','pageBreak','before','landscape','footer','Arial','black','right','num','Empty','Setting','find','split','splitSizePdf','then','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','QueryTypes','dirname','basename','.pdf','existsSync','join','mkdirSync','each','flatten','%s%d.%s','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF'];(function(_0x2ae2a7,_0x11ba43){var _0x1b0217=function(_0x1a4343){while(--_0x1a4343){_0x2ae2a7['push'](_0x2ae2a7['shift']());}};_0x1b0217(++_0x11ba43);}(_0xc9a6,0xd5));var _0x6c9a=function(_0x138d24,_0x995883){_0x138d24=_0x138d24-0x0;var _0x5dfeda=_0xc9a6[_0x138d24];return _0x5dfeda;};'use strict';var _=require(_0x6c9a('0x0'));var fs=require('fs');var util=require(_0x6c9a('0x1'));var path=require('path');var moment=require(_0x6c9a('0x2'));var htmlToPdfmake=require(_0x6c9a('0x3'));var PdfPrinter=require(_0x6c9a('0x4'));var zipdir=require(_0x6c9a('0x5'));var rimraf=require(_0x6c9a('0x6'));var JSDOM=require(_0x6c9a('0x7'))['JSDOM'];var window=new JSDOM('')[_0x6c9a('0x8')];var BPromise=require(_0x6c9a('0x9'));var db=require(_0x6c9a('0xa'))['db'];var dbH=require(_0x6c9a('0xa'))[_0x6c9a('0xb')];var logger=require(_0x6c9a('0xc'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x6c9a('0xd')][0x3];var PATH=process[_0x6c9a('0xd')][0x4];var NAME=process[_0x6c9a('0xd')][0x5];var FORMAT=_0x6c9a('0xe');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x144f0f,_0x4d859c){var _0x303966={'status':_0x144f0f};var _0x2a8c9c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4d859c){_0x303966[_0x6c9a('0xf')]=_0x4d859c;}return db['AnalyticExtractedReport'][_0x6c9a('0x10')](_0x303966,_0x2a8c9c);}function getHeaders(_0x34936a){return _[_0x6c9a('0x11')](_0x34936a,function(_0x6fc884){return{'text':_0x6fc884,'style':_0x6c9a('0x12')};});}function getRows(_0x32be0c,_0x16b622){return _['map'](_0x16b622,function(_0x1a2631){return _(_0x1a2631)[_0x6c9a('0x13')](_0x32be0c)[_0x6c9a('0x11')](function(_0x254adb){return _0x254adb?_[_0x6c9a('0x14')](_0x254adb):'';})[_0x6c9a('0x15')]();});}function createTable(_0x205b9e,_0x11a82f){var _0x5c523f={'widths':_[_0x6c9a('0x16')](Array(_0x205b9e[_0x6c9a('0x17')]),0x91),'heights':function(_0x159cf7){return _0x159cf7===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x2a6010=getHeaders(_0x205b9e);_0x5c523f[_0x6c9a('0x18')]['push'](_0x2a6010);var _0x4b1ab8=getRows(_0x205b9e,_0x11a82f);_0x5c523f[_0x6c9a('0x18')]=_0x5c523f[_0x6c9a('0x18')][_0x6c9a('0x19')](_0x4b1ab8);return _0x5c523f;}function createTables(_0x5a8870){var _0x514f63=[];var _0x58fba7=_[_0x6c9a('0x1a')](Object[_0x6c9a('0x1b')](_0x5a8870[0x0]),0x5);_0x58fba7[_0x6c9a('0x1c')](function(_0x36e4d7){_0x514f63[_0x6c9a('0x1d')](createTable(_0x36e4d7,_0x5a8870));});return _0x514f63;}function getPDFDocDefinition(_0x25e3bb){var _0x24d1cd=util[_0x6c9a('0x1e')](_0x6c9a('0x1f'),NAME,EXTRACTED_REPORT[_0x6c9a('0x20')],moment(EXTRACTED_REPORT[_0x6c9a('0x21')])[_0x6c9a('0x1e')](FORMAT),moment(EXTRACTED_REPORT[_0x6c9a('0x22')])['format'](FORMAT));var _0x55b419=[];for(var _0x2dcb6c=0x0;_0x2dcb6c<_0x25e3bb[_0x6c9a('0x17')];_0x2dcb6c++){var _0x4d193f=[];if(_0x2dcb6c===0x0){_0x4d193f[_0x6c9a('0x1d')]({'text':_0x24d1cd,'style':'header'});}var _0x666e5d={'table':_0x25e3bb[_0x2dcb6c]};if(_0x2dcb6c>0x0){_0x666e5d[_0x6c9a('0x23')]=_0x6c9a('0x24');_0x666e5d['margin']=[0x0,0x46,0x0,0x0];}_0x4d193f[_0x6c9a('0x1d')](_0x666e5d);_0x55b419[_0x6c9a('0x1d')](_0x4d193f);}return{'pageSize':'A4','pageOrientation':_0x6c9a('0x25'),'content':_0x55b419,'footer':function(_0x1009b1,_0xa956dd){return{'text':_0x1009b1[_0x6c9a('0x14')]()+'\x20/\x20'+_0xa956dd,'style':_0x6c9a('0x26')};},'defaultStyle':{'font':_0x6c9a('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x6c9a('0x28')},'footer':{'alignment':_0x6c9a('0x29'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0xb22daa){var _0x20ea57=0x1388;var _0x48cc04;if(!_0xb22daa[0x0][_0x6c9a('0x2a')]){return analyticExtractedReport(_0x6c9a('0x2b'));}return db[_0x6c9a('0x2c')][_0x6c9a('0x2d')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x6c9a('0x2e'),_0x6c9a('0x2f')]})['then'](function(_0x13b0dc){if(_0x13b0dc){_0x48cc04=_0x13b0dc;_0x20ea57=_0x48cc04[_0x6c9a('0x2f')]||0x3e8;}})[_0x6c9a('0x30')](function(){var _0xe04909=[];var _0x4af991=0x0;if(_0x48cc04[_0x6c9a('0x2e')]){if(_0xb22daa&&_0xb22daa[_0x6c9a('0x17')]){var _0x365a8a=_['range'](_0xb22daa[0x0]['num']/_0x20ea57);var _0x321659=Number[_0x6c9a('0x31')](_0xb22daa[0x0][_0x6c9a('0x2a')]/_0x20ea57)?_0xb22daa[0x0][_0x6c9a('0x2a')]%_0x20ea57:0x0;_0x365a8a[_0x6c9a('0x1c')](function(_0x102648){if(_0x102648>0x0){_0x4af991+=_0x20ea57;}_0xe04909[_0x6c9a('0x1d')](dbH[_0x6c9a('0x32')][_0x6c9a('0x33')](util['format'](_0x6c9a('0x34'),QUERY,_0x20ea57,_0x4af991),{'type':dbH[_0x6c9a('0x32')]['QueryTypes'][_0x6c9a('0x35')]}));});if(_0x321659>0x0){_0x4af991+=_0x20ea57;_0xe04909[_0x6c9a('0x1d')](dbH[_0x6c9a('0x32')][_0x6c9a('0x33')](util[_0x6c9a('0x1e')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x321659,_0x4af991),{'type':dbH[_0x6c9a('0x32')]['QueryTypes'][_0x6c9a('0x35')]}));}}}else{_0xe04909['push'](dbH[_0x6c9a('0x32')][_0x6c9a('0x33')](QUERY,{'type':dbH[_0x6c9a('0x32')][_0x6c9a('0x36')][_0x6c9a('0x35')]}));}var _0x209b3a=path[_0x6c9a('0x37')](PATH);var _0x5021f0=path[_0x6c9a('0x38')](PATH,_0x6c9a('0x39'));var _0x1c36be=_0x48cc04[_0x6c9a('0x2e')]&&_0xe04909['length']>0x1;var _0x5c032e=[];if(!fs[_0x6c9a('0x3a')](path[_0x6c9a('0x3b')](_0x209b3a,_0x5021f0))&&_0x1c36be){fs[_0x6c9a('0x3c')](path[_0x6c9a('0x3b')](_0x209b3a,_0x5021f0));}return BPromise[_0x6c9a('0x3d')](_0xe04909,function(_0x5916e1){_0x5c032e[_0x6c9a('0x1d')](_0x5916e1);})['then'](function(){var _0x44f798=[];for(var _0x5599c6=0x0;_0x5599c6<_0x5c032e[_0x6c9a('0x17')];_0x5599c6+=0x1){var _0x21cd1b=_0x5c032e[_0x5599c6];var _0x4c2336=createTables(_[_0x6c9a('0x3e')](_0x21cd1b));var _0x1f050c;var _0x2a2f17=getPDFDocDefinition(_0x4c2336);var _0xbfc745=getPDFPrinter();var _0x392b93=_0xbfc745['createPdfKitDocument'](_0x2a2f17);if(_0x1c36be){_0x1f050c=path[_0x6c9a('0x3b')](_0x209b3a,_0x5021f0,util['format'](_0x6c9a('0x3f'),_0x5021f0,_0x5599c6,'pdf'));}else{_0x1f050c=path[_0x6c9a('0x3b')](_0x209b3a,util[_0x6c9a('0x1e')](_0x6c9a('0x40'),_0x5021f0,'pdf'));}_0x44f798['push'](writePDFDocument(_0x392b93,_0x1f050c));}return Promise['all'](_0x44f798);})[_0x6c9a('0x30')](function(){if(_0x1c36be){return new Promise(function(_0x1294da){zipdir(path['join'](_0x209b3a,_0x5021f0),{'saveTo':path[_0x6c9a('0x3b')](_0x209b3a,util[_0x6c9a('0x1e')](_0x6c9a('0x40'),_0x5021f0,_0x6c9a('0x41')))},function(){rimraf(path[_0x6c9a('0x3b')](_0x209b3a,_0x5021f0),function(){});_0x1294da(_0x6c9a('0x42'));});});}})[_0x6c9a('0x30')](function(){if(!_0x1c36be)return;rimraf(path[_0x6c9a('0x3b')](_0x209b3a,_0x5021f0),function(){});})['then'](function(){logger['info'](util[_0x6c9a('0x1e')](_0x6c9a('0x43'),EXTRACTED_REPORT_ID,_0x6c9a('0x44')));return analyticExtractedReport('Completed',_0x1c36be?util['format']('%s.%s',_0x5021f0,_0x1c36be?_0x6c9a('0x41'):_0x6c9a('0x45')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util['format'](_0x6c9a('0x46'),EXTRACTED_REPORT_ID,_0x6c9a('0x44')));return db[_0x6c9a('0x47')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x9505f6){EXTRACTED_REPORT=_0x9505f6;return dbH[_0x6c9a('0x32')][_0x6c9a('0x33')](util[_0x6c9a('0x1e')](_0x6c9a('0x48'),QUERY),{'type':dbH[_0x6c9a('0x32')]['QueryTypes'][_0x6c9a('0x35')]});})[_0x6c9a('0x30')](extractReport)['catch'](function(_0x4576aa){logger[_0x6c9a('0x49')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x6c9a('0x44')),util[_0x6c9a('0x4a')](_0x4576aa,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x6c9a('0x4b'));})['finally'](function(){process[_0x6c9a('0x4c')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x3e5894=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x6c9a('0x4d'),'italics':__dirname+_0x6c9a('0x4e'),'bolditalics':__dirname+_0x6c9a('0x4f')}});return _0x3e5894;}function getPDFDocDefinitionFromHTML(_0x53f28a,_0x4d3c76){var _0x2bfeea=util[_0x6c9a('0x1e')]('%s\x20#%d',_0x4d3c76[_0x6c9a('0x50')],_0x4d3c76[_0x6c9a('0x51')]);var _0x274599=moment()[_0x6c9a('0x1e')]('YYYY-MM-DD')['toString']();var _0x298d06=htmlToPdfmake(_0x53f28a,{'window':window,'tableAutoSize':!![]});return{'content':[_0x298d06],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x6c9a('0x52'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x6c9a('0x52')}},'header':function(){return[{'text':_0x6c9a('0x53'),'style':'header'}];},'footer':function(_0x386ec4,_0x1b31ee){return[{'text':util[_0x6c9a('0x1e')](_0x6c9a('0x54'),_0x2bfeea,_0x386ec4,_0x1b31ee,_0x274599),'style':'footer'}];}};}function writePDFDocument(_0x243aa6,_0x2a5498){return new Promise(function(_0x1f8c69,_0x196212){var _0x39745b=_0x243aa6[_0x6c9a('0x55')](fs[_0x6c9a('0x56')](_0x2a5498));_0x39745b['on'](_0x6c9a('0x57'),function(){_0x1f8c69('finish');});_0x39745b['on'](_0x6c9a('0x58'),function(_0x4c37f7){_0x196212(_0x4c37f7);});_0x243aa6[_0x6c9a('0x59')]();});}exports[_0x6c9a('0x5a')]=function(_0xd5c673,_0x1d3f69){var _0x552904=getPDFPrinter();var _0x17986d=getPDFDocDefinitionFromHTML(_0xd5c673,_0x1d3f69);var _0x3c14ed=_0x552904[_0x6c9a('0x5b')](_0x17986d);return writePDFDocument(_0x3c14ed,_0x1d3f69[_0x6c9a('0x5c')])[_0x6c9a('0x5d')](function(_0x7aacda){throw _0x7aacda;});}; \ No newline at end of file +var _0x27e9=['%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','QueryTypes','dirname','.pdf','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','pdf','%s.%s','Completed','info','findOne','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','inspect','Failed','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','finish','error','end','catch','path','moment','jsdom','JSDOM','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','tableHeader','pick','map','toString','value','fill','length','auto','body','push','concat','chunk','keys','forEach','name','startDate','format','endDate','header','margin','landscape','\x20/\x20','footer','Arial','black','right','num','Setting','find','split','splitSizePdf','then','range','isInteger','sequelize','query'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x27e9,0x1d2));var _0x927e=function(_0x22d12a,_0x4ffb89){_0x22d12a=_0x22d12a-0x0;var _0x52b4bb=_0x27e9[_0x22d12a];return _0x52b4bb;};'use strict';var _=require('lodash');var fs=require('fs');var util=require('util');var path=require(_0x927e('0x0'));var moment=require(_0x927e('0x1'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require('pdfmake/src/printer');var zipdir=require('zip-dir');var rimraf=require('rimraf');var JSDOM=require(_0x927e('0x2'))[_0x927e('0x3')];var window=new JSDOM('')['window'];var BPromise=require(_0x927e('0x4'));var db=require('../../mysqldb')['db'];var dbH=require(_0x927e('0x5'))[_0x927e('0x6')];var logger=require(_0x927e('0x7'))(_0x927e('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x927e('0x9')][0x2]);var QUERY=process[_0x927e('0x9')][0x3];var PATH=process[_0x927e('0x9')][0x4];var NAME=process[_0x927e('0x9')][0x5];var FORMAT=_0x927e('0xa');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x2e16e2,_0x3cc82d){var _0x3b0a9d={'status':_0x2e16e2};var _0x468dc0={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3cc82d){_0x3b0a9d[_0x927e('0xb')]=_0x3cc82d;}return db[_0x927e('0xc')][_0x927e('0xd')](_0x3b0a9d,_0x468dc0);}function getHeaders(_0x1aa00e){return _['map'](_0x1aa00e,function(_0x19a0cd){return{'text':_0x19a0cd,'style':_0x927e('0xe')};});}function getRows(_0x212898,_0x428cf5){return _['map'](_0x428cf5,function(_0x340ae0){return _(_0x340ae0)[_0x927e('0xf')](_0x212898)[_0x927e('0x10')](function(_0x3e1c36){return _0x3e1c36?_[_0x927e('0x11')](_0x3e1c36):'';})[_0x927e('0x12')]();});}function createTable(_0x596f7d,_0x3f354f){var _0x592cfe={'widths':_[_0x927e('0x13')](Array(_0x596f7d[_0x927e('0x14')]),0x91),'heights':function(_0x30f502){return _0x30f502===0x0?_0x927e('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x5bd223=getHeaders(_0x596f7d);_0x592cfe[_0x927e('0x16')][_0x927e('0x17')](_0x5bd223);var _0x2a8989=getRows(_0x596f7d,_0x3f354f);_0x592cfe[_0x927e('0x16')]=_0x592cfe[_0x927e('0x16')][_0x927e('0x18')](_0x2a8989);return _0x592cfe;}function createTables(_0x14e2fc){var _0x381dd1=[];var _0x4a5e86=_[_0x927e('0x19')](Object[_0x927e('0x1a')](_0x14e2fc[0x0]),0x5);_0x4a5e86[_0x927e('0x1b')](function(_0x5b4e67){_0x381dd1['push'](createTable(_0x5b4e67,_0x14e2fc));});return _0x381dd1;}function getPDFDocDefinition(_0x51e515){var _0x37865a=util['format']('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0x927e('0x1c')],moment(EXTRACTED_REPORT[_0x927e('0x1d')])[_0x927e('0x1e')](FORMAT),moment(EXTRACTED_REPORT[_0x927e('0x1f')])[_0x927e('0x1e')](FORMAT));var _0x2c2c11=[];for(var _0x4c33b6=0x0;_0x4c33b6<_0x51e515[_0x927e('0x14')];_0x4c33b6++){var _0x47139c=[];if(_0x4c33b6===0x0){_0x47139c[_0x927e('0x17')]({'text':_0x37865a,'style':_0x927e('0x20')});}var _0x4c7900={'table':_0x51e515[_0x4c33b6]};if(_0x4c33b6>0x0){_0x4c7900['pageBreak']='before';_0x4c7900[_0x927e('0x21')]=[0x0,0x46,0x0,0x0];}_0x47139c[_0x927e('0x17')](_0x4c7900);_0x2c2c11[_0x927e('0x17')](_0x47139c);}return{'pageSize':'A4','pageOrientation':_0x927e('0x22'),'content':_0x2c2c11,'footer':function(_0x3bc0ea,_0xf2ff7e){return{'text':_0x3bc0ea[_0x927e('0x11')]()+_0x927e('0x23')+_0xf2ff7e,'style':_0x927e('0x24')};},'defaultStyle':{'font':_0x927e('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x927e('0x26')},'footer':{'alignment':_0x927e('0x27'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x295d49){var _0x36283c=0x1388;var _0x3a62e7;if(!_0x295d49[0x0][_0x927e('0x28')]){return analyticExtractedReport('Empty');}return db[_0x927e('0x29')][_0x927e('0x2a')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x927e('0x2b'),_0x927e('0x2c')]})[_0x927e('0x2d')](function(_0x42148c){if(_0x42148c){_0x3a62e7=_0x42148c;_0x36283c=_0x3a62e7['splitSizePdf']||0x3e8;}})[_0x927e('0x2d')](function(){var _0x5c29ab=[];var _0x39e1f3=0x0;if(_0x3a62e7['split']){if(_0x295d49&&_0x295d49[_0x927e('0x14')]){var _0xa96f07=_[_0x927e('0x2e')](_0x295d49[0x0][_0x927e('0x28')]/_0x36283c);var _0x1818b8=Number[_0x927e('0x2f')](_0x295d49[0x0]['num']/_0x36283c)?_0x295d49[0x0][_0x927e('0x28')]%_0x36283c:0x0;_0xa96f07[_0x927e('0x1b')](function(_0x53b421){if(_0x53b421>0x0){_0x39e1f3+=_0x36283c;}_0x5c29ab[_0x927e('0x17')](dbH[_0x927e('0x30')][_0x927e('0x31')](util[_0x927e('0x1e')](_0x927e('0x32'),QUERY,_0x36283c,_0x39e1f3),{'type':dbH[_0x927e('0x30')]['QueryTypes'][_0x927e('0x33')]}));});if(_0x1818b8>0x0){_0x39e1f3+=_0x36283c;_0x5c29ab[_0x927e('0x17')](dbH['sequelize'][_0x927e('0x31')](util[_0x927e('0x1e')](_0x927e('0x32'),QUERY,_0x1818b8,_0x39e1f3),{'type':dbH[_0x927e('0x30')][_0x927e('0x34')]['SELECT']}));}}}else{_0x5c29ab[_0x927e('0x17')](dbH[_0x927e('0x30')][_0x927e('0x31')](QUERY,{'type':dbH['sequelize'][_0x927e('0x34')][_0x927e('0x33')]}));}var _0x2ade46=path[_0x927e('0x35')](PATH);var _0x3c377b=path['basename'](PATH,_0x927e('0x36'));var _0x4dfbd0=_0x3a62e7[_0x927e('0x2b')]&&_0x5c29ab['length']>0x1;var _0xb8ed86=[];if(!fs[_0x927e('0x37')](path[_0x927e('0x38')](_0x2ade46,_0x3c377b))&&_0x4dfbd0){fs[_0x927e('0x39')](path[_0x927e('0x38')](_0x2ade46,_0x3c377b));}return BPromise[_0x927e('0x3a')](_0x5c29ab,function(_0x215dbc){_0xb8ed86['push'](_0x215dbc);})[_0x927e('0x2d')](function(){var _0x3f327d=[];for(var _0x1a7fe3=0x0;_0x1a7fe3<_0xb8ed86[_0x927e('0x14')];_0x1a7fe3+=0x1){var _0x4177d2=_0xb8ed86[_0x1a7fe3];var _0x5435ba=createTables(_[_0x927e('0x3b')](_0x4177d2));var _0x3a7085;var _0x412ad7=getPDFDocDefinition(_0x5435ba);var _0x42fc93=getPDFPrinter();var _0x5d2e3a=_0x42fc93[_0x927e('0x3c')](_0x412ad7);if(_0x4dfbd0){_0x3a7085=path['join'](_0x2ade46,_0x3c377b,util[_0x927e('0x1e')]('%s%d.%s',_0x3c377b,_0x1a7fe3,_0x927e('0x3d')));}else{_0x3a7085=path[_0x927e('0x38')](_0x2ade46,util[_0x927e('0x1e')]('%s.%s',_0x3c377b,_0x927e('0x3d')));}_0x3f327d['push'](writePDFDocument(_0x5d2e3a,_0x3a7085));}return Promise['all'](_0x3f327d);})[_0x927e('0x2d')](function(){if(_0x4dfbd0){return new Promise(function(_0x84708c){zipdir(path[_0x927e('0x38')](_0x2ade46,_0x3c377b),{'saveTo':path[_0x927e('0x38')](_0x2ade46,util['format'](_0x927e('0x3e'),_0x3c377b,'zip'))},function(){rimraf(path['join'](_0x2ade46,_0x3c377b),function(){});_0x84708c('zip\x20finished');});});}})['then'](function(){if(!_0x4dfbd0)return;rimraf(path[_0x927e('0x38')](_0x2ade46,_0x3c377b),function(){});})[_0x927e('0x2d')](function(){logger['info'](util[_0x927e('0x1e')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x927e('0x3f'),_0x4dfbd0?util['format'](_0x927e('0x3e'),_0x3c377b,_0x4dfbd0?'zip':'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x927e('0x40')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'PDF'));return db[_0x927e('0xc')][_0x927e('0x41')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x927e('0x2d')](function(_0x22e654){EXTRACTED_REPORT=_0x22e654;return dbH[_0x927e('0x30')][_0x927e('0x31')](util[_0x927e('0x1e')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x927e('0x30')][_0x927e('0x34')]['SELECT']});})[_0x927e('0x2d')](extractReport)['catch'](function(_0x2c2a21){logger[_0x927e('0x40')](util[_0x927e('0x1e')](_0x927e('0x42'),EXTRACTED_REPORT_ID,_0x927e('0x43')),util[_0x927e('0x44')](_0x2c2a21,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x927e('0x45'));})['finally'](function(){process[_0x927e('0x46')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x3a1735=new PdfPrinter({'Arial':{'normal':__dirname+_0x927e('0x47'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x927e('0x48'),'bolditalics':__dirname+_0x927e('0x49')}});return _0x3a1735;}function getPDFDocDefinitionFromHTML(_0x2f7cde,_0x25cfcf){var _0x3bdc36=util[_0x927e('0x1e')](_0x927e('0x4a'),_0x25cfcf[_0x927e('0x4b')],_0x25cfcf[_0x927e('0x4c')]);var _0x1c525b=moment()[_0x927e('0x1e')](_0x927e('0x4d'))[_0x927e('0x11')]();var _0x32c728=htmlToPdfmake(_0x2f7cde,{'window':window,'tableAutoSize':!![]});return{'content':[_0x32c728],'defaultStyle':{'font':_0x927e('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x927e('0x4e'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x927e('0x4e')}},'header':function(){return[{'text':_0x927e('0x4f'),'style':_0x927e('0x20')}];},'footer':function(_0x4fd631,_0x34ec2a){return[{'text':util[_0x927e('0x1e')](_0x927e('0x50'),_0x3bdc36,_0x4fd631,_0x34ec2a,_0x1c525b),'style':'footer'}];}};}function writePDFDocument(_0x5eacbe,_0x3b491e){return new Promise(function(_0x33c7bd,_0x3c2ab2){var _0x42c0f6=_0x5eacbe[_0x927e('0x51')](fs['createWriteStream'](_0x3b491e));_0x42c0f6['on'](_0x927e('0x52'),function(){_0x33c7bd('finish');});_0x42c0f6['on'](_0x927e('0x53'),function(_0x398b37){_0x3c2ab2(_0x398b37);});_0x5eacbe[_0x927e('0x54')]();});}exports['createPdfFromHTML']=function(_0x453bf1,_0x5c76a0){var _0x3f28a5=getPDFPrinter();var _0x42bcb6=getPDFDocDefinitionFromHTML(_0x453bf1,_0x5c76a0);var _0x51d06f=_0x3f28a5[_0x927e('0x3c')](_0x42bcb6);return writePDFDocument(_0x51d06f,_0x5c76a0[_0x927e('0x0')])[_0x927e('0x55')](function(_0x41325f){throw _0x41325f;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index d6d20a1..3ceac5e 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 _0xecf5=['join','mkdirSync','each','xlsx','%s.%s','writeFileSync','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','zip','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','exit','path','lodash','bluebird','zip-dir','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','find','split','splitSizeXlsx','then','sequelize','query','QueryTypes','Empty','length','num','forEach','push','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync'];(function(_0x1cc59c,_0x363029){var _0x45f34c=function(_0x378ab8){while(--_0x378ab8){_0x1cc59c['push'](_0x1cc59c['shift']());}};_0x45f34c(++_0x363029);}(_0xecf5,0x1c5));var _0x5ecf=function(_0x627145,_0x5304ad){_0x627145=_0x627145-0x0;var _0x4ea142=_0xecf5[_0x627145];return _0x4ea142;};'use strict';var util=require('util');var path=require(_0x5ecf('0x0'));var _=require(_0x5ecf('0x1'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x5ecf('0x2'));var zipdir=require(_0x5ecf('0x3'));var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0x5ecf('0x4')];var logger=require(_0x5ecf('0x5'))(_0x5ecf('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x5ecf('0x7')][0x2]);var QUERY=process[_0x5ecf('0x7')][0x3];var PATH=process[_0x5ecf('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4af53e,_0x4972e3){var _0x5d89af={'status':_0x4af53e};var _0x99e0d1={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4972e3){_0x5d89af[_0x5ecf('0x8')]=_0x4972e3;}return db[_0x5ecf('0x9')]['update'](_0x5d89af,_0x99e0d1);}function main(){var _0x28257a=0x1388;var _0x20c40b;logger[_0x5ecf('0xa')](util[_0x5ecf('0xb')](_0x5ecf('0xc'),EXTRACTED_REPORT_ID,'XLSX'));return db['Setting'][_0x5ecf('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x5ecf('0xe'),_0x5ecf('0xf')]})[_0x5ecf('0x10')](function(_0x3d061c){if(_0x3d061c){_0x20c40b=_0x3d061c;_0x28257a=_0x20c40b['splitSizeXlsx']||0x1388;}})['then'](function(){return dbH[_0x5ecf('0x11')][_0x5ecf('0x12')](util[_0x5ecf('0xb')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x5ecf('0x11')][_0x5ecf('0x13')]['SELECT']});})['then'](function(_0x2c2472){if(!_0x2c2472[0x0]['num']){return analyticExtractedReport(_0x5ecf('0x14'));}var _0x54c980=[];var _0x306b6f=0x0;if(_0x20c40b[_0x5ecf('0xe')]){if(_0x2c2472&&_0x2c2472[_0x5ecf('0x15')]){var _0x327fed=_['range'](_0x2c2472[0x0][_0x5ecf('0x16')]/_0x28257a);var _0x5723b7=Number['isInteger'](_0x2c2472[0x0][_0x5ecf('0x16')]/_0x28257a)?_0x2c2472[0x0][_0x5ecf('0x16')]%_0x28257a:0x0;_0x327fed[_0x5ecf('0x17')](function(_0x416726){if(_0x416726>0x0){_0x306b6f+=_0x28257a;}_0x54c980[_0x5ecf('0x18')](dbH[_0x5ecf('0x11')][_0x5ecf('0x12')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x28257a,_0x306b6f),{'type':dbH[_0x5ecf('0x11')]['QueryTypes'][_0x5ecf('0x19')]}));});if(_0x5723b7>0x0){_0x306b6f+=_0x28257a;_0x54c980[_0x5ecf('0x18')](dbH['sequelize'][_0x5ecf('0x12')](util[_0x5ecf('0xb')](_0x5ecf('0x1a'),QUERY,_0x5723b7,_0x306b6f),{'type':dbH[_0x5ecf('0x11')]['QueryTypes']['SELECT']}));}}}else{_0x54c980[_0x5ecf('0x18')](dbH[_0x5ecf('0x11')][_0x5ecf('0x12')](QUERY,{'type':dbH['sequelize'][_0x5ecf('0x13')][_0x5ecf('0x19')]}));}var _0x2b0c61=path[_0x5ecf('0x1b')](PATH);var _0x3b6390=path[_0x5ecf('0x1c')](PATH,_0x5ecf('0x1d'));var _0x137e90=_0x20c40b[_0x5ecf('0xe')]&&_0x54c980[_0x5ecf('0x15')]>0x1;var _0x1786c7=[];if(!fs[_0x5ecf('0x1e')](path[_0x5ecf('0x1f')](_0x2b0c61,_0x3b6390))&&_0x137e90){fs[_0x5ecf('0x20')](path[_0x5ecf('0x1f')](_0x2b0c61,_0x3b6390));}return BPromise[_0x5ecf('0x21')](_0x54c980,function(_0x6dd7b4){_0x1786c7['push'](_0x6dd7b4);})[_0x5ecf('0x10')](function(){for(var _0x5831f8=0x0;_0x5831f8<_0x1786c7['length'];_0x5831f8+=0x1){var _0x4b752b;var _0x460bb2=_0x1786c7[_0x5831f8];if(_0x137e90){_0x4b752b=path[_0x5ecf('0x1f')](_0x2b0c61,_0x3b6390,util[_0x5ecf('0xb')]('%s%d.%s',_0x3b6390,_0x5831f8,_0x5ecf('0x22')));}else{_0x4b752b=path[_0x5ecf('0x1f')](_0x2b0c61,util[_0x5ecf('0xb')](_0x5ecf('0x23'),_0x3b6390,_0x5ecf('0x22')));}fs[_0x5ecf('0x24')](_0x4b752b,json2xls(_0x460bb2),'binary');}})[_0x5ecf('0x10')](function(){if(_0x137e90){return new Promise(function(_0xd28d6){zipdir(path[_0x5ecf('0x1f')](_0x2b0c61,_0x3b6390),{'saveTo':path['join'](_0x2b0c61,util[_0x5ecf('0xb')]('%s.%s',_0x3b6390,'zip'))},function(_0x256f79,_0x17c38b){rimraf(path[_0x5ecf('0x1f')](_0x2b0c61,_0x3b6390),function(){});_0xd28d6('zip\x20finished');});});}})[_0x5ecf('0x10')](function(){logger[_0x5ecf('0xa')](util['format'](_0x5ecf('0x25'),EXTRACTED_REPORT_ID,_0x5ecf('0x26')));return analyticExtractedReport(_0x5ecf('0x27'),_0x137e90?util[_0x5ecf('0xb')]('%s.%s',_0x3b6390,_0x137e90?_0x5ecf('0x28'):_0x5ecf('0x22')):null);});})['catch'](function(_0xb51a7c){logger[_0x5ecf('0xa')](util['format'](_0x5ecf('0x29'),EXTRACTED_REPORT_ID,_0x5ecf('0x26')),util['inspect'](_0xb51a7c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x5ecf('0x2a'));})['finally'](function(){process[_0x5ecf('0x2b')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x61ac=['splitSizeXlsx','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','split','length','forEach','push','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync','join','mkdirSync','%s%d.%s','xlsx','binary','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','path','json2xls','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x61ac,0x82));var _0xc61a=function(_0x5bda3b,_0x41160f){_0x5bda3b=_0x5bda3b-0x0;var _0x431bb9=_0x61ac[_0x5bda3b];return _0x431bb9;};'use strict';var util=require('util');var path=require(_0xc61a('0x0'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0xc61a('0x1'));var BPromise=require(_0xc61a('0x2'));var zipdir=require(_0xc61a('0x3'));var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require(_0xc61a('0x4'))[_0xc61a('0x5')];var logger=require(_0xc61a('0x6'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xc61a('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x44dc3a,_0x18c5f6){var _0x142793={'status':_0x44dc3a};var _0x249565={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x18c5f6){_0x142793[_0xc61a('0x8')]=_0x18c5f6;}return db[_0xc61a('0x9')][_0xc61a('0xa')](_0x142793,_0x249565);}function main(){var _0x3b3109=0x1388;var _0x4bfc53;logger[_0xc61a('0xb')](util[_0xc61a('0xc')](_0xc61a('0xd'),EXTRACTED_REPORT_ID,_0xc61a('0xe')));return db[_0xc61a('0xf')][_0xc61a('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xc61a('0x11')]})[_0xc61a('0x12')](function(_0x5cfcc7){if(_0x5cfcc7){_0x4bfc53=_0x5cfcc7;_0x3b3109=_0x4bfc53[_0xc61a('0x11')]||0x1388;}})['then'](function(){return dbH['sequelize'][_0xc61a('0x13')](util['format'](_0xc61a('0x14'),QUERY),{'type':dbH['sequelize'][_0xc61a('0x15')][_0xc61a('0x16')]});})[_0xc61a('0x12')](function(_0x2e4bac){if(!_0x2e4bac[0x0][_0xc61a('0x17')]){return analyticExtractedReport('Empty');}var _0x48f966=[];var _0x574b5f=0x0;if(_0x4bfc53[_0xc61a('0x18')]){if(_0x2e4bac&&_0x2e4bac[_0xc61a('0x19')]){var _0x5b04eb=_['range'](_0x2e4bac[0x0][_0xc61a('0x17')]/_0x3b3109);var _0x5522a6=Number['isInteger'](_0x2e4bac[0x0][_0xc61a('0x17')]/_0x3b3109)?_0x2e4bac[0x0][_0xc61a('0x17')]%_0x3b3109:0x0;_0x5b04eb[_0xc61a('0x1a')](function(_0x4e4e82){if(_0x4e4e82>0x0){_0x574b5f+=_0x3b3109;}_0x48f966[_0xc61a('0x1b')](dbH[_0xc61a('0x1c')][_0xc61a('0x13')](util[_0xc61a('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3b3109,_0x574b5f),{'type':dbH['sequelize'][_0xc61a('0x15')][_0xc61a('0x16')]}));});if(_0x5522a6>0x0){_0x574b5f+=_0x3b3109;_0x48f966[_0xc61a('0x1b')](dbH[_0xc61a('0x1c')]['query'](util[_0xc61a('0xc')](_0xc61a('0x1d'),QUERY,_0x5522a6,_0x574b5f),{'type':dbH[_0xc61a('0x1c')][_0xc61a('0x15')][_0xc61a('0x16')]}));}}}else{_0x48f966[_0xc61a('0x1b')](dbH[_0xc61a('0x1c')][_0xc61a('0x13')](QUERY,{'type':dbH[_0xc61a('0x1c')][_0xc61a('0x15')][_0xc61a('0x16')]}));}var _0x191fb6=path[_0xc61a('0x1e')](PATH);var _0x1dc6a7=path[_0xc61a('0x1f')](PATH,_0xc61a('0x20'));var _0x45a650=_0x4bfc53[_0xc61a('0x18')]&&_0x48f966[_0xc61a('0x19')]>0x1;var _0x50415a=[];if(!fs[_0xc61a('0x21')](path[_0xc61a('0x22')](_0x191fb6,_0x1dc6a7))&&_0x45a650){fs[_0xc61a('0x23')](path[_0xc61a('0x22')](_0x191fb6,_0x1dc6a7));}return BPromise['each'](_0x48f966,function(_0x5722e3){_0x50415a['push'](_0x5722e3);})[_0xc61a('0x12')](function(){for(var _0x1f120e=0x0;_0x1f120e<_0x50415a[_0xc61a('0x19')];_0x1f120e+=0x1){var _0x198a4d;var _0xfadd70=_0x50415a[_0x1f120e];if(_0x45a650){_0x198a4d=path[_0xc61a('0x22')](_0x191fb6,_0x1dc6a7,util[_0xc61a('0xc')](_0xc61a('0x24'),_0x1dc6a7,_0x1f120e,'xlsx'));}else{_0x198a4d=path[_0xc61a('0x22')](_0x191fb6,util[_0xc61a('0xc')]('%s.%s',_0x1dc6a7,_0xc61a('0x25')));}fs['writeFileSync'](_0x198a4d,json2xls(_0xfadd70),_0xc61a('0x26'));}})[_0xc61a('0x12')](function(){if(_0x45a650){return new Promise(function(_0x1a3fc7){zipdir(path[_0xc61a('0x22')](_0x191fb6,_0x1dc6a7),{'saveTo':path[_0xc61a('0x22')](_0x191fb6,util[_0xc61a('0xc')](_0xc61a('0x27'),_0x1dc6a7,_0xc61a('0x28')))},function(_0x39ea7c,_0x42d4d3){rimraf(path['join'](_0x191fb6,_0x1dc6a7),function(){});_0x1a3fc7(_0xc61a('0x29'));});});}})[_0xc61a('0x12')](function(){logger[_0xc61a('0xb')](util['format'](_0xc61a('0x2a'),EXTRACTED_REPORT_ID,_0xc61a('0xe')));return analyticExtractedReport('Completed',_0x45a650?util[_0xc61a('0xc')](_0xc61a('0x27'),_0x1dc6a7,_0x45a650?_0xc61a('0x28'):_0xc61a('0x25')):null);});})[_0xc61a('0x2b')](function(_0x28eab6){logger[_0xc61a('0xb')](util[_0xc61a('0xc')](_0xc61a('0x2c'),EXTRACTED_REPORT_ID,_0xc61a('0xe')),util[_0xc61a('0x2d')](_0x28eab6,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xc61a('0x2e'));})[_0xc61a('0x2f')](function(){process[_0xc61a('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 9b57ac1..299d681 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 _0x3601=['then','intervals','VoiceExtension','IntervalId','uniq','map','CAST(priority\x20AS\x20UNSIGNED)','filter','exten','queue','priority','extensions','find','push','type','Set','format','CDR(type)=%s','VoiceExtensionId','inbound','CDR(routeid)=','context','outbound','extension','CDR(destination)=','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','length','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)','indexOf','app','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','error','lodash','util','models','findAll'];(function(_0x4f8aa0,_0x113d69){var _0x45557c=function(_0x2e2670){while(--_0x2e2670){_0x4f8aa0['push'](_0x4f8aa0['shift']());}};_0x45557c(++_0x113d69);}(_0x3601,0xd1));var _0x1360=function(_0x1133bb,_0x46c98d){_0x1133bb=_0x1133bb-0x0;var _0x1ebc9b=_0x3601[_0x1133bb];return _0x1ebc9b;};'use strict';var _=require(_0x1360('0x0'));var util=require(_0x1360('0x1'));function rewrite(_0x4860b2,_0x3fb17c){var _0x39016c=this;return _0x4860b2[_0x1360('0x2')]['Interval'][_0x1360('0x3')]({'raw':!![]})[_0x1360('0x4')](function(_0x53a9ec){_0x39016c[_0x1360('0x5')]=_0x53a9ec;return _0x4860b2[_0x1360('0x2')][_0x1360('0x6')][_0x1360('0x3')]({'where':{'IntervalId':_0x3fb17c[_0x1360('0x7')]},'raw':!![]});})[_0x1360('0x4')](function(_0x59e908){return _0x4860b2[_0x1360('0x2')][_0x1360('0x6')]['findAll']({'where':{'exten':{'$in':_[_0x1360('0x8')](_[_0x1360('0x9')](_0x59e908,'exten'))}},'order':[{'raw':_0x1360('0xa')}],'raw':!![]});})['then'](function(_0x2f78b4){var _0x628d49=_[_0x1360('0xb')](_0x2f78b4,{'priority':'1'});var _0x5a0056=_['filter'](_0x2f78b4,{'isApp':0x1});var _0x4ea44c=_['groupBy'](_0x5a0056,_0x1360('0xc'));var _0x2626b5=[_0x1360('0xd'),'playback'];var _0x325a54=[];var _0x16e4df=[];for(var _0x2ef414 in _0x4ea44c){if(_0x4ea44c['hasOwnProperty'](_0x2ef414)){_0x39016c[_0x1360('0xe')]=0x2;_0x39016c[_0x1360('0xf')]=[];_0x39016c['extension']=_[_0x1360('0x10')](_0x628d49,{'exten':_0x4ea44c[_0x2ef414][0x0][_0x1360('0xc')]});_0x39016c[_0x1360('0xf')][_0x1360('0x11')]({'type':_0x4ea44c[_0x2ef414][0x0][_0x1360('0x12')],'app':_0x1360('0x13'),'appdata':util[_0x1360('0x14')](_0x1360('0x15'),_0x4ea44c[_0x2ef414][0x0][_0x1360('0x12')]),'context':_0x4ea44c[_0x2ef414][0x0]['context'],'exten':_0x4ea44c[_0x2ef414][0x0][_0x1360('0xc')],'priority':_0x39016c[_0x1360('0xe')]++,'VoiceExtensionId':_0x4ea44c[_0x2ef414][0x0][_0x1360('0x16')]});if(_0x4ea44c[_0x2ef414][0x0][_0x1360('0x12')]===_0x1360('0x17')){_0x39016c[_0x1360('0xf')][_0x1360('0x11')]({'type':_0x4ea44c[_0x2ef414][0x0]['type'],'app':_0x1360('0x13'),'appdata':_0x1360('0x18')+_0x4ea44c[_0x2ef414][0x0][_0x1360('0x16')],'context':_0x4ea44c[_0x2ef414][0x0][_0x1360('0x19')],'exten':_0x4ea44c[_0x2ef414][0x0]['exten'],'priority':_0x39016c['priority']++,'VoiceExtensionId':_0x4ea44c[_0x2ef414][0x0]['VoiceExtensionId']});}else if(_0x4ea44c[_0x2ef414][0x0][_0x1360('0x12')]===_0x1360('0x1a')){if(_0x39016c[_0x1360('0x1b')]){_0x39016c['extensions']['push']({'type':_0x4ea44c[_0x2ef414][0x0][_0x1360('0x12')],'app':_0x1360('0x13'),'appdata':_0x1360('0x1c')+(_0x39016c[_0x1360('0x1b')][_0x1360('0x1d')]?_0x1360('0x1e')+_0x39016c['extension'][_0x1360('0x1d')]+'}':'${EXTEN}'),'context':_0x4ea44c[_0x2ef414][0x0][_0x1360('0x19')],'exten':_0x4ea44c[_0x2ef414][0x0]['exten'],'priority':_0x39016c['priority']++,'VoiceExtensionId':_0x4ea44c[_0x2ef414][0x0][_0x1360('0x16')]});}_0x39016c['extensions']['push']({'type':_0x4ea44c[_0x2ef414][0x0][_0x1360('0x12')],'app':'Set','appdata':_0x1360('0x18')+_0x4ea44c[_0x2ef414][0x0][_0x1360('0x16')],'context':_0x4ea44c[_0x2ef414][0x0][_0x1360('0x19')],'exten':_0x4ea44c[_0x2ef414][0x0][_0x1360('0xc')],'priority':_0x39016c[_0x1360('0xe')]++,'VoiceExtensionId':_0x4ea44c[_0x2ef414][0x0][_0x1360('0x16')]});var _0x59189c=_0x39016c[_0x1360('0xe')]++;_0x39016c[_0x1360('0xf')][_0x1360('0x11')]({'type':_0x4ea44c[_0x2ef414][0x0]['type'],'app':_0x1360('0x1f'),'appdata':_0x1360('0x20')+(_0x59189c+0x2)+_0x1360('0x21')+(_0x59189c+0x1)+')','context':_0x4ea44c[_0x2ef414][0x0]['context'],'exten':_0x4ea44c[_0x2ef414][0x0]['exten'],'priority':_0x59189c,'VoiceExtensionId':_0x4ea44c[_0x2ef414][0x0][_0x1360('0x16')]});if(_0x39016c[_0x1360('0x1b')]){_0x39016c['extensions'][_0x1360('0x11')]({'type':_0x4ea44c[_0x2ef414][0x0]['type'],'app':'Set','appdata':_0x39016c[_0x1360('0x1b')]['cutdigits']?_0x1360('0x22')+_0x39016c[_0x1360('0x1b')]['cutdigits']+'}':_0x1360('0x23'),'context':_0x4ea44c[_0x2ef414][0x0]['context'],'exten':_0x4ea44c[_0x2ef414][0x0][_0x1360('0xc')],'priority':_0x39016c[_0x1360('0xe')]++,'VoiceExtensionId':_0x4ea44c[_0x2ef414][0x0]['VoiceExtensionId']});}_0x39016c['extensions'][_0x1360('0x11')]({'type':_0x4ea44c[_0x2ef414][0x0][_0x1360('0x12')],'app':_0x1360('0x13'),'appdata':'outboundrouteid='+_0x4ea44c[_0x2ef414][0x0]['VoiceExtensionId'],'context':_0x4ea44c[_0x2ef414][0x0][_0x1360('0x19')],'exten':_0x4ea44c[_0x2ef414][0x0]['exten'],'priority':_0x39016c[_0x1360('0xe')]++,'VoiceExtensionId':_0x4ea44c[_0x2ef414][0x0][_0x1360('0x16')]});if(_0x39016c[_0x1360('0x1b')]&&_0x39016c[_0x1360('0x1b')][_0x1360('0x24')](_0x1360('0x25'))&&_0x39016c['extension'][_0x1360('0x25')]!==_0x1360('0x26')){_0x39016c[_0x1360('0xf')][_0x1360('0x11')]({'type':_0x4ea44c[_0x2ef414][0x0]['type'],'app':_0x1360('0x13'),'appdata':_0x1360('0x27'),'context':_0x4ea44c[_0x2ef414][0x0][_0x1360('0x19')],'exten':_0x4ea44c[_0x2ef414][0x0][_0x1360('0xc')],'priority':_0x39016c[_0x1360('0xe')]++,'VoiceExtensionId':_0x4ea44c[_0x2ef414][0x0][_0x1360('0x16')]});_0x39016c[_0x1360('0xf')][_0x1360('0x11')]({'type':_0x4ea44c[_0x2ef414][0x0][_0x1360('0x12')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x39016c[_0x1360('0x1b')][_0x1360('0x25')]||_0x1360('0x28'),'context':_0x4ea44c[_0x2ef414][0x0][_0x1360('0x19')],'exten':_0x4ea44c[_0x2ef414][0x0]['exten'],'priority':_0x39016c[_0x1360('0xe')]++,'VoiceExtensionId':_0x4ea44c[_0x2ef414][0x0][_0x1360('0x16')]});}}_0x39016c[_0x1360('0xf')][_0x1360('0x11')]({'type':_0x4ea44c[_0x2ef414][0x0][_0x1360('0x12')],'app':'Set','appdata':_0x1360('0x29'),'context':_0x4ea44c[_0x2ef414][0x0][_0x1360('0x19')],'exten':_0x4ea44c[_0x2ef414][0x0][_0x1360('0xc')],'priority':_0x39016c[_0x1360('0xe')]++,'VoiceExtensionId':_0x4ea44c[_0x2ef414][0x0][_0x1360('0x16')]});_0x39016c['extensions'][_0x1360('0x11')]({'type':_0x4ea44c[_0x2ef414][0x0][_0x1360('0x12')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x4ea44c[_0x2ef414][0x0][_0x1360('0x19')],'exten':_0x4ea44c[_0x2ef414][0x0]['exten'],'priority':_0x39016c[_0x1360('0xe')]++,'VoiceExtensionId':_0x4ea44c[_0x2ef414][0x0][_0x1360('0x16')]});_0x39016c[_0x1360('0xf')]['push']({'type':_0x4ea44c[_0x2ef414][0x0][_0x1360('0x12')],'app':_0x1360('0x13'),'appdata':_0x1360('0x2a'),'context':_0x4ea44c[_0x2ef414][0x0][_0x1360('0x19')],'exten':_0x4ea44c[_0x2ef414][0x0][_0x1360('0xc')],'priority':_0x39016c[_0x1360('0xe')]++,'VoiceExtensionId':_0x4ea44c[_0x2ef414][0x0]['VoiceExtensionId']});for(var _0x3c8d90=0x0,_0x35d8d2=0x0;_0x3c8d90<_0x4ea44c[_0x2ef414]['length'];_0x3c8d90+=0x1,_0x35d8d2=0x0){var _0x202fb0=_0x4ea44c[_0x2ef414][_0x3c8d90];if(_0x202fb0[_0x1360('0x12')]){_0x202fb0['type']=_0x202fb0[_0x1360('0x12')][_0x1360('0x2b')]();}var _0x4b9464=[];var _0x135583=[];delete _0x202fb0['id'];delete _0x202fb0[_0x1360('0x2c')];delete _0x202fb0[_0x1360('0x2d')];var _0x5de600=_0x202fb0[_0x1360('0x2e')]!==_0x1360('0x2f')?[_0x202fb0[_0x1360('0x2e')]]:_0x202fb0[_0x1360('0x7')]?_[_0x1360('0x9')](_[_0x1360('0xb')](_0x39016c['intervals'],{'IntervalId':_0x202fb0[_0x1360('0x7')]}),'interval'):[];if(_0x202fb0['hasOwnProperty'](_0x1360('0x30'))){if(_0x202fb0['tag']&&_0x202fb0[_0x1360('0x30')]!=='--'){_0x4b9464['push']({'type':_0x202fb0[_0x1360('0x12')],'app':_0x1360('0x13'),'appdata':_0x1360('0x31')+_0x202fb0['tag'],'context':_0x202fb0[_0x1360('0x19')],'exten':_0x202fb0[_0x1360('0xc')],'priority':_0x5de600[_0x1360('0x32')]+_0x39016c['priority']+_0x35d8d2++,'VoiceExtensionId':_0x202fb0['VoiceExtensionId']});}}if(_0x202fb0['type']===_0x1360('0x1a')&&_0x202fb0[_0x1360('0x24')](_0x1360('0x33'))){if(_0x202fb0['callerID']){_0x4b9464[_0x1360('0x11')]({'type':_0x202fb0[_0x1360('0x12')],'app':_0x1360('0x1f'),'appdata':_0x1360('0x34')+_0x202fb0[_0x1360('0x33')]+')','context':_0x202fb0['context'],'exten':_0x202fb0[_0x1360('0xc')],'priority':_0x5de600[_0x1360('0x32')]+_0x39016c['priority']+_0x35d8d2++,'VoiceExtensionId':_0x202fb0['VoiceExtensionId']});}else{_0x4b9464['push']({'type':_0x202fb0[_0x1360('0x12')],'app':_0x1360('0x1f'),'appdata':_0x1360('0x35'),'context':_0x202fb0[_0x1360('0x19')],'exten':_0x202fb0[_0x1360('0xc')],'priority':_0x5de600['length']+_0x39016c[_0x1360('0xe')]+_0x35d8d2++,'VoiceExtensionId':_0x202fb0['VoiceExtensionId']});}}if(_0x202fb0[_0x1360('0x24')]('answer')){if(_0x2626b5[_0x1360('0x36')](_0x202fb0[_0x1360('0x37')][_0x1360('0x2b')]())>=0x0&&_0x202fb0[_0x1360('0x38')]!==_0x1360('0x39')){if(_0x202fb0['answer']){_0x4b9464[_0x1360('0x11')]({'type':_0x202fb0['type'],'app':_0x1360('0x1f'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x202fb0[_0x1360('0x19')],'exten':_0x202fb0[_0x1360('0xc')],'priority':_0x5de600[_0x1360('0x32')]+_0x39016c[_0x1360('0xe')]+_0x35d8d2++,'VoiceExtensionId':_0x202fb0[_0x1360('0x16')]});_0x4b9464['push']({'type':_0x202fb0[_0x1360('0x12')],'app':_0x1360('0x13'),'appdata':_0x1360('0x3a'),'context':_0x202fb0['context'],'exten':_0x202fb0[_0x1360('0xc')],'priority':_0x5de600[_0x1360('0x32')]+_0x39016c[_0x1360('0xe')]+_0x35d8d2++,'VoiceExtensionId':_0x202fb0[_0x1360('0x16')]});}else{_0x4b9464[_0x1360('0x11')]({'type':_0x202fb0[_0x1360('0x12')],'app':_0x1360('0x1f'),'appdata':_0x1360('0x3b'),'context':_0x202fb0['context'],'exten':_0x202fb0['exten'],'priority':_0x5de600[_0x1360('0x32')]+_0x39016c[_0x1360('0xe')]+_0x35d8d2++,'VoiceExtensionId':_0x202fb0['VoiceExtensionId']});_0x4b9464[_0x1360('0x11')]({'type':_0x202fb0[_0x1360('0x12')],'app':'Set','appdata':_0x1360('0x3c'),'context':_0x202fb0[_0x1360('0x19')],'exten':_0x202fb0[_0x1360('0xc')],'priority':_0x5de600[_0x1360('0x32')]+_0x39016c[_0x1360('0xe')]+_0x35d8d2++,'VoiceExtensionId':_0x202fb0[_0x1360('0x16')]});}}}for(var _0x5c803e=0x0;_0x5c803e<_0x5de600[_0x1360('0x32')];_0x5c803e+=0x1){var _0x588cee=_0x39016c['priority']+_0x5de600['length'];var _0x1d7a38=_0x5c803e===_0x5de600['length']-0x1?_0x39016c[_0x1360('0xe')]+_0x4b9464[_0x1360('0x32')]+_0x135583['length']+0x2:_0x39016c[_0x1360('0xe')]+_0x5c803e+0x1;_0x4b9464['splice'](_0x5c803e,0x0,{'type':_0x202fb0[_0x1360('0x12')],'app':_0x1360('0x3d'),'appdata':_0x5de600[_0x5c803e]+'?'+_0x202fb0[_0x1360('0x19')]+_0x1360('0x3e')+_0x588cee+':'+_0x202fb0[_0x1360('0x19')]+_0x1360('0x3e')+_0x1d7a38,'exten':_0x202fb0[_0x1360('0xc')],'context':_0x202fb0[_0x1360('0x19')],'priority':_0x39016c[_0x1360('0xe')]+_0x5c803e,'VoiceExtensionId':_0x4ea44c[_0x2ef414][0x0][_0x1360('0x16')]});}_0x202fb0[_0x1360('0xe')]=_0x4b9464[_0x1360('0x32')]?_['last'](_0x4b9464)[_0x1360('0xe')]+0x1:_0x39016c[_0x1360('0xe')];_0x39016c[_0x1360('0xe')]=(_0x135583[_0x1360('0x32')]?_[_0x1360('0x3f')](_0x135583)[_0x1360('0xe')]:_0x202fb0[_0x1360('0xe')])+0x1;_0x39016c[_0x1360('0xf')]=_[_0x1360('0x40')](_0x39016c[_0x1360('0xf')],_0x4b9464,[_0x202fb0],_0x135583);}_0x39016c[_0x1360('0xf')][_0x1360('0x11')]({'type':_0x4ea44c[_0x2ef414][0x0][_0x1360('0x12')],'app':_0x1360('0x41'),'exten':_0x4ea44c[_0x2ef414][0x0][_0x1360('0xc')],'context':_0x4ea44c[_0x2ef414][0x0][_0x1360('0x19')],'priority':_0x39016c[_0x1360('0xe')],'VoiceExtensionId':_0x4ea44c[_0x2ef414][0x0]['VoiceExtensionId']});_0x325a54[_0x1360('0x11')](_0x4ea44c[_0x2ef414][0x0][_0x1360('0x16')]);_0x16e4df=_[_0x1360('0x40')](_0x16e4df,_0x39016c[_0x1360('0xf')]);}}return _0x4860b2[_0x1360('0x42')](function(_0x1b2183){return _0x4860b2[_0x1360('0x2')][_0x1360('0x6')][_0x1360('0x43')]({'where':{'VoiceExtensionId':{'$in':_0x325a54}},'transaction':_0x1b2183})[_0x1360('0x4')](function(_0x13f235){return _0x4860b2[_0x1360('0x2')]['VoiceExtension'][_0x1360('0x44')](_[_0x1360('0x45')](_0x16e4df,_0x1360('0xe')),{'transaction':_0x1b2183});});});})['catch'](function(_0x1c12ae){console[_0x1360('0x46')](_0x1c12ae);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0xb216=['$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','ExecIf','answer','indexOf','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','last','Hangup','transaction','destroy','sortBy','error','rewrite','lodash','findAll','intervals','models','IntervalId','then','VoiceExtension','uniq','map','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','exten','queue','hasOwnProperty','priority','extension','push','type','Set','format','CDR(type)=%s','VoiceExtensionId','extensions','CDR(routeid)=','context','outbound','cutdigits','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','callerID'];(function(_0x274167,_0x4f93c3){var _0xd1ffd3=function(_0x2bd164){while(--_0x2bd164){_0x274167['push'](_0x274167['shift']());}};_0xd1ffd3(++_0x4f93c3);}(_0xb216,0x1d7));var _0x6b21=function(_0x5b7788,_0x309ae5){_0x5b7788=_0x5b7788-0x0;var _0x573871=_0xb216[_0x5b7788];return _0x573871;};'use strict';var _=require(_0x6b21('0x0'));var util=require('util');function rewrite(_0x1ac654,_0x155c91){var _0x4845a5=this;return _0x1ac654['models']['Interval'][_0x6b21('0x1')]({'raw':!![]})['then'](function(_0x4b1d24){_0x4845a5[_0x6b21('0x2')]=_0x4b1d24;return _0x1ac654[_0x6b21('0x3')]['VoiceExtension'][_0x6b21('0x1')]({'where':{'IntervalId':_0x155c91[_0x6b21('0x4')]},'raw':!![]});})[_0x6b21('0x5')](function(_0x52aba3){return _0x1ac654[_0x6b21('0x3')][_0x6b21('0x6')][_0x6b21('0x1')]({'where':{'exten':{'$in':_[_0x6b21('0x7')](_[_0x6b21('0x8')](_0x52aba3,'exten'))}},'order':[{'raw':_0x6b21('0x9')}],'raw':!![]});})[_0x6b21('0x5')](function(_0x1d4a5a){var _0x5c6ec7=_[_0x6b21('0xa')](_0x1d4a5a,{'priority':'1'});var _0xf77eda=_[_0x6b21('0xa')](_0x1d4a5a,{'isApp':0x1});var _0x3d635b=_[_0x6b21('0xb')](_0xf77eda,_0x6b21('0xc'));var _0x2c7a80=[_0x6b21('0xd'),'playback'];var _0x154aa0=[];var _0x2204d1=[];for(var _0x101e23 in _0x3d635b){if(_0x3d635b[_0x6b21('0xe')](_0x101e23)){_0x4845a5[_0x6b21('0xf')]=0x2;_0x4845a5['extensions']=[];_0x4845a5[_0x6b21('0x10')]=_['find'](_0x5c6ec7,{'exten':_0x3d635b[_0x101e23][0x0][_0x6b21('0xc')]});_0x4845a5['extensions'][_0x6b21('0x11')]({'type':_0x3d635b[_0x101e23][0x0][_0x6b21('0x12')],'app':_0x6b21('0x13'),'appdata':util[_0x6b21('0x14')](_0x6b21('0x15'),_0x3d635b[_0x101e23][0x0]['type']),'context':_0x3d635b[_0x101e23][0x0]['context'],'exten':_0x3d635b[_0x101e23][0x0][_0x6b21('0xc')],'priority':_0x4845a5[_0x6b21('0xf')]++,'VoiceExtensionId':_0x3d635b[_0x101e23][0x0][_0x6b21('0x16')]});if(_0x3d635b[_0x101e23][0x0][_0x6b21('0x12')]==='inbound'){_0x4845a5[_0x6b21('0x17')][_0x6b21('0x11')]({'type':_0x3d635b[_0x101e23][0x0][_0x6b21('0x12')],'app':_0x6b21('0x13'),'appdata':_0x6b21('0x18')+_0x3d635b[_0x101e23][0x0][_0x6b21('0x16')],'context':_0x3d635b[_0x101e23][0x0][_0x6b21('0x19')],'exten':_0x3d635b[_0x101e23][0x0][_0x6b21('0xc')],'priority':_0x4845a5[_0x6b21('0xf')]++,'VoiceExtensionId':_0x3d635b[_0x101e23][0x0][_0x6b21('0x16')]});}else if(_0x3d635b[_0x101e23][0x0][_0x6b21('0x12')]===_0x6b21('0x1a')){if(_0x4845a5[_0x6b21('0x10')]){_0x4845a5['extensions']['push']({'type':_0x3d635b[_0x101e23][0x0][_0x6b21('0x12')],'app':_0x6b21('0x13'),'appdata':'CDR(destination)='+(_0x4845a5[_0x6b21('0x10')][_0x6b21('0x1b')]?'${EXTEN:'+_0x4845a5['extension'][_0x6b21('0x1b')]+'}':_0x6b21('0x1c')),'context':_0x3d635b[_0x101e23][0x0][_0x6b21('0x19')],'exten':_0x3d635b[_0x101e23][0x0][_0x6b21('0xc')],'priority':_0x4845a5[_0x6b21('0xf')]++,'VoiceExtensionId':_0x3d635b[_0x101e23][0x0][_0x6b21('0x16')]});}_0x4845a5[_0x6b21('0x17')]['push']({'type':_0x3d635b[_0x101e23][0x0]['type'],'app':_0x6b21('0x13'),'appdata':_0x6b21('0x18')+_0x3d635b[_0x101e23][0x0][_0x6b21('0x16')],'context':_0x3d635b[_0x101e23][0x0][_0x6b21('0x19')],'exten':_0x3d635b[_0x101e23][0x0][_0x6b21('0xc')],'priority':_0x4845a5[_0x6b21('0xf')]++,'VoiceExtensionId':_0x3d635b[_0x101e23][0x0][_0x6b21('0x16')]});var _0x3e976c=_0x4845a5['priority']++;_0x4845a5[_0x6b21('0x17')]['push']({'type':_0x3d635b[_0x101e23][0x0]['type'],'app':'ExecIf','appdata':_0x6b21('0x1d')+(_0x3e976c+0x2)+_0x6b21('0x1e')+(_0x3e976c+0x1)+')','context':_0x3d635b[_0x101e23][0x0][_0x6b21('0x19')],'exten':_0x3d635b[_0x101e23][0x0][_0x6b21('0xc')],'priority':_0x3e976c,'VoiceExtensionId':_0x3d635b[_0x101e23][0x0][_0x6b21('0x16')]});if(_0x4845a5[_0x6b21('0x10')]){_0x4845a5['extensions'][_0x6b21('0x11')]({'type':_0x3d635b[_0x101e23][0x0][_0x6b21('0x12')],'app':_0x6b21('0x13'),'appdata':_0x4845a5[_0x6b21('0x10')]['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x4845a5[_0x6b21('0x10')][_0x6b21('0x1b')]+'}':'CDR(prefix)=noprefix','context':_0x3d635b[_0x101e23][0x0][_0x6b21('0x19')],'exten':_0x3d635b[_0x101e23][0x0]['exten'],'priority':_0x4845a5[_0x6b21('0xf')]++,'VoiceExtensionId':_0x3d635b[_0x101e23][0x0][_0x6b21('0x16')]});}_0x4845a5[_0x6b21('0x17')]['push']({'type':_0x3d635b[_0x101e23][0x0]['type'],'app':_0x6b21('0x13'),'appdata':_0x6b21('0x1f')+_0x3d635b[_0x101e23][0x0][_0x6b21('0x16')],'context':_0x3d635b[_0x101e23][0x0]['context'],'exten':_0x3d635b[_0x101e23][0x0][_0x6b21('0xc')],'priority':_0x4845a5[_0x6b21('0xf')]++,'VoiceExtensionId':_0x3d635b[_0x101e23][0x0][_0x6b21('0x16')]});if(_0x4845a5[_0x6b21('0x10')]&&_0x4845a5[_0x6b21('0x10')]['hasOwnProperty'](_0x6b21('0x20'))&&_0x4845a5[_0x6b21('0x10')][_0x6b21('0x20')]!==_0x6b21('0x21')){_0x4845a5[_0x6b21('0x17')]['push']({'type':_0x3d635b[_0x101e23][0x0][_0x6b21('0x12')],'app':_0x6b21('0x13'),'appdata':_0x6b21('0x22'),'context':_0x3d635b[_0x101e23][0x0]['context'],'exten':_0x3d635b[_0x101e23][0x0][_0x6b21('0xc')],'priority':_0x4845a5[_0x6b21('0xf')]++,'VoiceExtensionId':_0x3d635b[_0x101e23][0x0]['VoiceExtensionId']});_0x4845a5[_0x6b21('0x17')][_0x6b21('0x11')]({'type':_0x3d635b[_0x101e23][0x0][_0x6b21('0x12')],'app':_0x6b21('0x13'),'appdata':_0x6b21('0x23')+_0x4845a5[_0x6b21('0x10')]['recordingFormat']||_0x6b21('0x24'),'context':_0x3d635b[_0x101e23][0x0][_0x6b21('0x19')],'exten':_0x3d635b[_0x101e23][0x0][_0x6b21('0xc')],'priority':_0x4845a5[_0x6b21('0xf')]++,'VoiceExtensionId':_0x3d635b[_0x101e23][0x0][_0x6b21('0x16')]});}}_0x4845a5[_0x6b21('0x17')]['push']({'type':_0x3d635b[_0x101e23][0x0][_0x6b21('0x12')],'app':'Set','appdata':_0x6b21('0x25'),'context':_0x3d635b[_0x101e23][0x0]['context'],'exten':_0x3d635b[_0x101e23][0x0][_0x6b21('0xc')],'priority':_0x4845a5['priority']++,'VoiceExtensionId':_0x3d635b[_0x101e23][0x0][_0x6b21('0x16')]});_0x4845a5[_0x6b21('0x17')][_0x6b21('0x11')]({'type':_0x3d635b[_0x101e23][0x0][_0x6b21('0x12')],'app':'Set','appdata':_0x6b21('0x26'),'context':_0x3d635b[_0x101e23][0x0][_0x6b21('0x19')],'exten':_0x3d635b[_0x101e23][0x0][_0x6b21('0xc')],'priority':_0x4845a5[_0x6b21('0xf')]++,'VoiceExtensionId':_0x3d635b[_0x101e23][0x0][_0x6b21('0x16')]});_0x4845a5[_0x6b21('0x17')]['push']({'type':_0x3d635b[_0x101e23][0x0][_0x6b21('0x12')],'app':_0x6b21('0x13'),'appdata':_0x6b21('0x27'),'context':_0x3d635b[_0x101e23][0x0][_0x6b21('0x19')],'exten':_0x3d635b[_0x101e23][0x0][_0x6b21('0xc')],'priority':_0x4845a5[_0x6b21('0xf')]++,'VoiceExtensionId':_0x3d635b[_0x101e23][0x0][_0x6b21('0x16')]});for(var _0x3a7906=0x0,_0x4b903b=0x0;_0x3a7906<_0x3d635b[_0x101e23][_0x6b21('0x28')];_0x3a7906+=0x1,_0x4b903b=0x0){var _0x526c44=_0x3d635b[_0x101e23][_0x3a7906];if(_0x526c44[_0x6b21('0x12')]){_0x526c44[_0x6b21('0x12')]=_0x526c44[_0x6b21('0x12')][_0x6b21('0x29')]();}var _0x68db0e=[];var _0x501c36=[];delete _0x526c44['id'];delete _0x526c44[_0x6b21('0x2a')];delete _0x526c44[_0x6b21('0x2b')];var _0x5c53c7=_0x526c44[_0x6b21('0x2c')]!==_0x6b21('0x2d')?[_0x526c44[_0x6b21('0x2c')]]:_0x526c44['IntervalId']?_[_0x6b21('0x8')](_['filter'](_0x4845a5['intervals'],{'IntervalId':_0x526c44[_0x6b21('0x4')]}),_0x6b21('0x2c')):[];if(_0x526c44['hasOwnProperty'](_0x6b21('0x2e'))){if(_0x526c44['tag']&&_0x526c44[_0x6b21('0x2e')]!=='--'){_0x68db0e['push']({'type':_0x526c44[_0x6b21('0x12')],'app':_0x6b21('0x13'),'appdata':_0x6b21('0x2f')+_0x526c44[_0x6b21('0x2e')],'context':_0x526c44[_0x6b21('0x19')],'exten':_0x526c44[_0x6b21('0xc')],'priority':_0x5c53c7[_0x6b21('0x28')]+_0x4845a5[_0x6b21('0xf')]+_0x4b903b++,'VoiceExtensionId':_0x526c44[_0x6b21('0x16')]});}}if(_0x526c44[_0x6b21('0x12')]===_0x6b21('0x1a')&&_0x526c44[_0x6b21('0xe')](_0x6b21('0x30'))){if(_0x526c44[_0x6b21('0x30')]){_0x68db0e[_0x6b21('0x11')]({'type':_0x526c44[_0x6b21('0x12')],'app':'ExecIf','appdata':_0x6b21('0x31')+_0x526c44[_0x6b21('0x30')]+')','context':_0x526c44[_0x6b21('0x19')],'exten':_0x526c44[_0x6b21('0xc')],'priority':_0x5c53c7[_0x6b21('0x28')]+_0x4845a5[_0x6b21('0xf')]+_0x4b903b++,'VoiceExtensionId':_0x526c44[_0x6b21('0x16')]});}else{_0x68db0e[_0x6b21('0x11')]({'type':_0x526c44[_0x6b21('0x12')],'app':_0x6b21('0x32'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x526c44[_0x6b21('0x19')],'exten':_0x526c44['exten'],'priority':_0x5c53c7[_0x6b21('0x28')]+_0x4845a5['priority']+_0x4b903b++,'VoiceExtensionId':_0x526c44[_0x6b21('0x16')]});}}if(_0x526c44['hasOwnProperty'](_0x6b21('0x33'))){if(_0x2c7a80[_0x6b21('0x34')](_0x526c44['app'][_0x6b21('0x29')]())>=0x0&&_0x526c44[_0x6b21('0x35')]!=='custom'){if(_0x526c44['answer']){_0x68db0e[_0x6b21('0x11')]({'type':_0x526c44[_0x6b21('0x12')],'app':'ExecIf','appdata':_0x6b21('0x36'),'context':_0x526c44[_0x6b21('0x19')],'exten':_0x526c44['exten'],'priority':_0x5c53c7[_0x6b21('0x28')]+_0x4845a5[_0x6b21('0xf')]+_0x4b903b++,'VoiceExtensionId':_0x526c44[_0x6b21('0x16')]});_0x68db0e[_0x6b21('0x11')]({'type':_0x526c44['type'],'app':'Set','appdata':_0x6b21('0x37'),'context':_0x526c44['context'],'exten':_0x526c44['exten'],'priority':_0x5c53c7[_0x6b21('0x28')]+_0x4845a5['priority']+_0x4b903b++,'VoiceExtensionId':_0x526c44[_0x6b21('0x16')]});}else{_0x68db0e[_0x6b21('0x11')]({'type':_0x526c44[_0x6b21('0x12')],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x526c44[_0x6b21('0x19')],'exten':_0x526c44['exten'],'priority':_0x5c53c7[_0x6b21('0x28')]+_0x4845a5[_0x6b21('0xf')]+_0x4b903b++,'VoiceExtensionId':_0x526c44['VoiceExtensionId']});_0x68db0e[_0x6b21('0x11')]({'type':_0x526c44['type'],'app':_0x6b21('0x13'),'appdata':_0x6b21('0x38'),'context':_0x526c44['context'],'exten':_0x526c44[_0x6b21('0xc')],'priority':_0x5c53c7['length']+_0x4845a5[_0x6b21('0xf')]+_0x4b903b++,'VoiceExtensionId':_0x526c44[_0x6b21('0x16')]});}}}for(var _0x4ff17a=0x0;_0x4ff17a<_0x5c53c7[_0x6b21('0x28')];_0x4ff17a+=0x1){var _0x34e156=_0x4845a5[_0x6b21('0xf')]+_0x5c53c7[_0x6b21('0x28')];var _0x4efae4=_0x4ff17a===_0x5c53c7[_0x6b21('0x28')]-0x1?_0x4845a5['priority']+_0x68db0e[_0x6b21('0x28')]+_0x501c36['length']+0x2:_0x4845a5[_0x6b21('0xf')]+_0x4ff17a+0x1;_0x68db0e['splice'](_0x4ff17a,0x0,{'type':_0x526c44[_0x6b21('0x12')],'app':'GotoIfTime','appdata':_0x5c53c7[_0x4ff17a]+'?'+_0x526c44['context']+_0x6b21('0x39')+_0x34e156+':'+_0x526c44[_0x6b21('0x19')]+_0x6b21('0x39')+_0x4efae4,'exten':_0x526c44['exten'],'context':_0x526c44['context'],'priority':_0x4845a5[_0x6b21('0xf')]+_0x4ff17a,'VoiceExtensionId':_0x3d635b[_0x101e23][0x0][_0x6b21('0x16')]});}_0x526c44['priority']=_0x68db0e[_0x6b21('0x28')]?_[_0x6b21('0x3a')](_0x68db0e)[_0x6b21('0xf')]+0x1:_0x4845a5[_0x6b21('0xf')];_0x4845a5[_0x6b21('0xf')]=(_0x501c36[_0x6b21('0x28')]?_[_0x6b21('0x3a')](_0x501c36)[_0x6b21('0xf')]:_0x526c44[_0x6b21('0xf')])+0x1;_0x4845a5[_0x6b21('0x17')]=_['concat'](_0x4845a5[_0x6b21('0x17')],_0x68db0e,[_0x526c44],_0x501c36);}_0x4845a5[_0x6b21('0x17')]['push']({'type':_0x3d635b[_0x101e23][0x0][_0x6b21('0x12')],'app':_0x6b21('0x3b'),'exten':_0x3d635b[_0x101e23][0x0][_0x6b21('0xc')],'context':_0x3d635b[_0x101e23][0x0]['context'],'priority':_0x4845a5[_0x6b21('0xf')],'VoiceExtensionId':_0x3d635b[_0x101e23][0x0]['VoiceExtensionId']});_0x154aa0[_0x6b21('0x11')](_0x3d635b[_0x101e23][0x0][_0x6b21('0x16')]);_0x2204d1=_['concat'](_0x2204d1,_0x4845a5['extensions']);}}return _0x1ac654[_0x6b21('0x3c')](function(_0x27358e){return _0x1ac654[_0x6b21('0x3')]['VoiceExtension'][_0x6b21('0x3d')]({'where':{'VoiceExtensionId':{'$in':_0x154aa0}},'transaction':_0x27358e})['then'](function(_0x5f3abd){return _0x1ac654[_0x6b21('0x3')][_0x6b21('0x6')]['bulkCreate'](_[_0x6b21('0x3e')](_0x2204d1,'priority'),{'transaction':_0x27358e});});});})['catch'](function(_0xfcdf54){console[_0x6b21('0x3f')](_0xfcdf54);});}exports[_0x6b21('0x40')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 2bed7fc..d530071 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 _0x97a3=['email','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','keys','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','cm_hopper','scheduledAt','createdAt','updatedAt','select','field','NOW()','ContactId','toString','from','deletedAt\x20IS\x20NULL','where','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','into','fromQuery','cm_contacts','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','ListId\x20=\x20?','cm_hopper_black','findAll','dialCheckDuplicateType','CmList','Lists','then','get','always','push','sequelize','query','onlyIfOpen','VoiceQueueId','VoiceQueue','outbound','BlackLists','Campaign','CampaignId','all','generalCheckHopper','Error\x20processing\x20rows\x20block:','emit','contact:csv_','resume','resolve','unlinkSync','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','split','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','squel','papaparse','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20binding\x20parameters!','zipObject','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','errors','length','map','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD'];(function(_0xfea60d,_0x5d5f0c){var _0x346960=function(_0x3bf318){while(--_0x3bf318){_0xfea60d['push'](_0xfea60d['shift']());}};_0x346960(++_0x5d5f0c);}(_0x97a3,0xb9));var _0x397a=function(_0x546a4b,_0x55ad70){_0x546a4b=_0x546a4b-0x0;var _0x2367f3=_0x97a3[_0x546a4b];return _0x2367f3;};'use strict';var BPromise=require(_0x397a('0x0'));var util=require('util');var _=require(_0x397a('0x1'));var fs=require('fs');var squel=require(_0x397a('0x2'));var Papa=require(_0x397a('0x3'));var Redis=require('ioredis');var db=require(_0x397a('0x4'))['db'];var config=require(_0x397a('0x5'));var logger=require(_0x397a('0x6'))(_0x397a('0x7'));config[_0x397a('0x8')]=_[_0x397a('0x9')](config[_0x397a('0x8')],{'host':_0x397a('0xa'),'port':0x18eb});var socket=require(_0x397a('0xb'))(new Redis(config['redis']));require(_0x397a('0xc'))[_0x397a('0xd')](socket);try{if(!process[_0x397a('0xe')][0x2]||process[_0x397a('0xe')][0x2]===_0x397a('0xf')||process[_0x397a('0xe')][0x2]===_0x397a('0x10')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0x397a('0xe')][0x2];if(!process[_0x397a('0xe')][0x3]||process[_0x397a('0xe')][0x3]===_0x397a('0xf')||process[_0x397a('0xe')][0x3]===_0x397a('0x10')||!process['argv'][0x4]||process[_0x397a('0xe')][0x4]===_0x397a('0xf')||process[_0x397a('0xe')][0x4]===_0x397a('0x10')){throw new Error(_0x397a('0x11'));}var FIELDS=_[_0x397a('0x12')](process[_0x397a('0xe')][0x3]['split'](','),process[_0x397a('0xe')][0x4]['split'](','));if(!process[_0x397a('0xe')][0x5]||process[_0x397a('0xe')][0x5]===_0x397a('0xf')||process['argv'][0x5]===_0x397a('0x10')){throw new Error(_0x397a('0x13'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x397a('0xe')][0x6]&&process[_0x397a('0xe')][0x6]!=='undefined'&&process[_0x397a('0xe')][0x6]!==_0x397a('0x10')?process[_0x397a('0xe')][0x6]:null;var DUPLICATES=process[_0x397a('0xe')][0x7]&&process['argv'][0x7]!==_0x397a('0xf')&&process[_0x397a('0xe')][0x7]!==_0x397a('0x10')?process[_0x397a('0xe')][0x7]:null;if(!process[_0x397a('0xe')][0x8]||process[_0x397a('0xe')][0x8]===_0x397a('0xf')||process[_0x397a('0xe')][0x8]===_0x397a('0x10')){throw new Error(_0x397a('0x14'));}var SOCKET_TIMESTAMP=process[_0x397a('0xe')][0x8];}catch(_0x10343c){logger[_0x397a('0x15')](_0x10343c);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(_0x17fe0c,_0x34b195,_0x296fbb,_0x7e994d){var _0x429d43={'message':_0x34b195};_0x429d43[_0x17fe0c]=!![];if(_0x296fbb){_0x429d43[_0x397a('0x16')]=_0x296fbb;}if(_0x7e994d){_0x429d43[_0x397a('0x17')]=_0x7e994d;}return _0x429d43;}function isEmail(_0x344e13){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))*$/[_0x397a('0x18')](_0x344e13);}function checkRow(_0x1e2a49,_0x1d4351,_0x4539c9){return new BPromise(function(_0xacfbb,_0x11c7d5){if(_['isNil'](_0x1e2a49)){return _0x11c7d5(handleCheckRowError('error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x4539c9));}if(_0x1e2a49[_0x397a('0x19')]&&_0x1e2a49['errors'][_0x397a('0x1a')]){var _0x47cb1e=_[_0x397a('0x1b')](_0x1e2a49['errors'],_0x397a('0x1c'))['join'](';');return _0x11c7d5(handleCheckRowError(_0x397a('0x15'),_0x47cb1e,null,_0x4539c9));}var _0x2bbd2c={};for(var _0x2c861f in FIELDS){if(FIELDS[_0x397a('0x1d')](_0x2c861f)&&FIELDS[_0x2c861f]){_0x2bbd2c[_0x2c861f]=_0x1e2a49[_0x397a('0x1e')][0x0][FIELDS[_0x2c861f]]||_0x1e2a49['data'][0x0]['\ufeff'+FIELDS[_0x2c861f]];}}if(!_0x2bbd2c[_0x397a('0x1f')]){return _0x11c7d5(handleCheckRowError('error',_0x397a('0x20'),null,_0x4539c9));}if(!_0x2bbd2c[_0x397a('0x21')]){return _0x11c7d5(handleCheckRowError(_0x397a('0x15'),_0x397a('0x22'),null,_0x4539c9));}if(_0x2bbd2c[_0x397a('0x23')]){var _0xa829c6=moment(_0x2bbd2c['birthDate'],_0x397a('0x24'));if(!_0xa829c6['isValid']()){return _0x11c7d5(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x4539c9));}}if(_0x2bbd2c[_0x397a('0x25')]){if(!isEmail(_0x2bbd2c[_0x397a('0x25')])){return _0x11c7d5(handleCheckRowError(_0x397a('0x15'),'email\x20format\x20is\x20not\x20valid!',null,_0x4539c9));}}_0x2bbd2c[_0x397a('0x26')]=LISTID;_0x2bbd2c[_0x397a('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x397a('0x1a')]&&_0x1d4351){var _0x53b9e4={};for(var _0x19f053=0x0,_0x4657b3=DUPLICATES[_0x397a('0x1a')];_0x19f053<_0x4657b3;_0x19f053+=0x1){_0x53b9e4[DUPLICATES[_0x19f053]]=_0x2bbd2c[DUPLICATES[_0x19f053]];}var _0x55eb97=_[_0x397a('0x28')](_0x1d4351,_0x53b9e4);if(_0x55eb97){return _0x11c7d5(handleCheckRowError(_0x397a('0x29'),_0x397a('0x2a'),_0x55eb97,_0x4539c9));}}return db[_0x397a('0x2b')]['create'](_0x2bbd2c,{'raw':!![],'hooks':![],'fields':_[_0x397a('0x2c')](_0x2bbd2c)})['then'](function(_0x14117e){if(DUPLICATES&&DUPLICATES[_0x397a('0x1a')]&&_0x1d4351){_0x1d4351['push'](_[_0x397a('0x2d')](_0x2bbd2c,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x14117e['id'];return _0xacfbb();})[_0x397a('0x2e')](function(_0x1242fa){return _0x11c7d5(handleCheckRowError(_0x397a('0x15'),_0x397a('0x2f')+(_0x1242fa[_0x397a('0x1c')]||JSON[_0x397a('0x30')](_0x1242fa)),null,_0x4539c9));});});}function checkHopper(){function _0x3fd961(){return function(_0x233365){logger[_0x397a('0x15')](_0x397a('0x31'),_0x397a('0x32'),util[_0x397a('0x33')](_0x233365,{'showHidden':![],'depth':null}));};}var _0x30d26f=function(_0x3bab0d,_0x1c9f56){var _0x275c89=squel[_0x397a('0x34')]()['into'](_0x397a('0x35'))['fromQuery']([_0x397a('0x21'),_0x397a('0x36'),'ContactId','ListId',_0x1c9f56,_0x397a('0x37'),_0x397a('0x38')],squel[_0x397a('0x39')]()[_0x397a('0x3a')](_0x397a('0x21'),_0x397a('0x21'))[_0x397a('0x3a')](_0x397a('0x3b'),_0x397a('0x36'))[_0x397a('0x3a')]('id',_0x397a('0x3c'))['field'](LISTID[_0x397a('0x3d')](),_0x397a('0x26'))[_0x397a('0x3a')](_0x3bab0d['id']['toString'](),_0x1c9f56)[_0x397a('0x3a')](_0x397a('0x3b'),'createdAt')[_0x397a('0x3a')](_0x397a('0x3b'),_0x397a('0x38'))[_0x397a('0x3e')]('cm_contacts')['where'](_0x397a('0x3f'))[_0x397a('0x40')]('ListId\x20=\x20?',LISTID[_0x397a('0x3d')]())['where']('phone\x20IS\x20NOT\x20NULL')['where'](_0x397a('0x41'),squel[_0x397a('0x39')]()[_0x397a('0x3a')]('phone')['from'](_0x397a('0x35'))[_0x397a('0x40')](_0x1c9f56+_0x397a('0x42'),_0x3bab0d['id'][_0x397a('0x3d')]())))['toString']();return _0x275c89;};var _0xa63d73=function(_0x46b340,_0x3c9d1b){var _0x1e66a1=squel['insert']()[_0x397a('0x43')](_0x397a('0x35'))[_0x397a('0x44')]([_0x397a('0x21'),_0x397a('0x36'),'ContactId',_0x397a('0x26'),_0x3c9d1b,_0x397a('0x37'),_0x397a('0x38')],squel[_0x397a('0x39')]()[_0x397a('0x3a')](_0x397a('0x21'),_0x397a('0x21'))[_0x397a('0x3a')]('NOW()',_0x397a('0x36'))[_0x397a('0x3a')]('id',_0x397a('0x3c'))[_0x397a('0x3a')](LISTID[_0x397a('0x3d')](),_0x397a('0x26'))[_0x397a('0x3a')](_0x46b340['id']['toString'](),_0x3c9d1b)[_0x397a('0x3a')]('NOW()','createdAt')[_0x397a('0x3a')](_0x397a('0x3b'),_0x397a('0x38'))[_0x397a('0x3e')](_0x397a('0x45'))[_0x397a('0x40')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID['toString']())['where'](_0x397a('0x46'),squel[_0x397a('0x47')](hopperContacts))[_0x397a('0x40')](_0x397a('0x48'))[_0x397a('0x40')](_0x397a('0x41'),squel['select']()[_0x397a('0x3a')](_0x397a('0x49'))[_0x397a('0x3e')](_0x397a('0x4a'))['where'](_0x3c9d1b+'\x20=\x20?',_0x46b340['id'][_0x397a('0x3d')]()))[_0x397a('0x40')](_0x397a('0x41'),squel['select']()['field'](_0x397a('0x21'))[_0x397a('0x3e')](_0x397a('0x35'))[_0x397a('0x40')](_0x3c9d1b+_0x397a('0x42'),_0x46b340['id'][_0x397a('0x3d')]())))[_0x397a('0x3d')]();return _0x1e66a1;};function _0x40f31e(_0x4afc4c,_0x24ef67){var _0x3928fe=squel['insert']()[_0x397a('0x43')]('cm_hopper')['fromQuery']([_0x397a('0x21'),'scheduledAt',_0x397a('0x3c'),_0x397a('0x26'),_0x24ef67,_0x397a('0x37'),'updatedAt'],squel['select']()[_0x397a('0x3a')]('phone',_0x397a('0x21'))['field']('NOW()','scheduledAt')[_0x397a('0x3a')]('id',_0x397a('0x3c'))[_0x397a('0x3a')](LISTID[_0x397a('0x3d')](),_0x397a('0x26'))[_0x397a('0x3a')](_0x4afc4c['id'][_0x397a('0x3d')](),_0x24ef67)['field'](_0x397a('0x3b'),_0x397a('0x37'))[_0x397a('0x3a')]('NOW()',_0x397a('0x38'))[_0x397a('0x3e')](_0x397a('0x45'))[_0x397a('0x40')](_0x397a('0x3f'))['where'](_0x397a('0x4b'),LISTID[_0x397a('0x3d')]())[_0x397a('0x40')](_0x397a('0x46'),squel[_0x397a('0x47')](hopperContacts))[_0x397a('0x40')](_0x397a('0x48')))[_0x397a('0x3d')]();return _0x3928fe;}function _0x417736(_0x46570c,_0x4c4e05){var _0x2b68ea=squel['insert']()[_0x397a('0x43')](_0x397a('0x4c'))[_0x397a('0x44')](['phone',_0x397a('0x3c'),'ListId',_0x4c4e05,_0x397a('0x37'),_0x397a('0x38')],squel[_0x397a('0x39')]()['field'](_0x397a('0x21'),_0x397a('0x21'))[_0x397a('0x3a')]('id',_0x397a('0x3c'))[_0x397a('0x3a')](LISTID[_0x397a('0x3d')](),'ListId')['field'](_0x46570c['id']['toString'](),_0x4c4e05)[_0x397a('0x3a')](_0x397a('0x3b'),_0x397a('0x37'))[_0x397a('0x3a')]('NOW()',_0x397a('0x38'))[_0x397a('0x3e')](_0x397a('0x45'))[_0x397a('0x40')](_0x397a('0x3f'))[_0x397a('0x40')](_0x397a('0x4b'),LISTID[_0x397a('0x3d')]())[_0x397a('0x40')]('id\x20IN\x20?',squel[_0x397a('0x47')](hopperContacts))[_0x397a('0x40')](_0x397a('0x48')))[_0x397a('0x3d')]();return _0x2b68ea;}return db['VoiceQueue'][_0x397a('0x4d')]({'where':{'type':'outbound'},'attributes':['id',_0x397a('0x4e')],'include':[{'model':db[_0x397a('0x4f')],'as':_0x397a('0x50'),'where':{'id':LISTID}}]})[_0x397a('0x51')](function(_0x3c8026){var _0x4516ae=[];if(_0x3c8026){var _0x5b57c4;for(var _0x2a0d15=0x0,_0x5ac564;_0x2a0d15<_0x3c8026['length'];_0x2a0d15+=0x1){_0x5ac564=_0x3c8026[_0x2a0d15][_0x397a('0x52')]({'plain':!![]});switch(_0x5ac564['dialCheckDuplicateType']){case _0x397a('0x53'):_0x4516ae[_0x397a('0x54')](db[_0x397a('0x55')][_0x397a('0x56')](_0xa63d73(_0x5ac564,'VoiceQueueId'))[_0x397a('0x51')](function(){})[_0x397a('0x2e')](_0x3fd961()));break;case _0x397a('0x57'):_0x4516ae[_0x397a('0x54')](db[_0x397a('0x55')][_0x397a('0x56')](_0x30d26f(_0x5ac564,_0x397a('0x58')))[_0x397a('0x51')](function(){})[_0x397a('0x2e')](_0x3fd961()));break;default:_0x4516ae['push'](db[_0x397a('0x55')][_0x397a('0x56')](_0x40f31e(_0x5ac564,_0x397a('0x58')))[_0x397a('0x51')](function(){})[_0x397a('0x2e')](_0x3fd961()));}}}return _0x4516ae;})['all']()[_0x397a('0x51')](function(){return db[_0x397a('0x59')][_0x397a('0x4d')]({'where':{'type':_0x397a('0x5a')},'attributes':['id'],'include':[{'model':db[_0x397a('0x4f')],'as':_0x397a('0x5b'),'where':{'id':LISTID}}]})[_0x397a('0x51')](function(_0x1c402e){var _0x1fe6ef=[];if(_0x1c402e){var _0x5ce316;for(var _0x260a72=0x0,_0x37aac2;_0x260a72<_0x1c402e[_0x397a('0x1a')];_0x260a72+=0x1){_0x37aac2=_0x1c402e[_0x260a72][_0x397a('0x52')]({'plain':!![]});_0x1fe6ef[_0x397a('0x54')](db[_0x397a('0x55')][_0x397a('0x56')](_0x417736(_0x37aac2,_0x397a('0x58')))['then'](function(){})['catch'](_0x3fd961()));}}return _0x1fe6ef;})['all']();})[_0x397a('0x51')](function(){return db[_0x397a('0x5c')][_0x397a('0x4d')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x397a('0x4f')],'as':_0x397a('0x50'),'where':{'id':LISTID}}]})[_0x397a('0x51')](function(_0x46d6dd){var _0x1cd78d=[];if(_0x46d6dd){for(var _0x4c1ec2=0x0,_0x3cc653;_0x4c1ec2<_0x46d6dd[_0x397a('0x1a')];_0x4c1ec2+=0x1){_0x3cc653=_0x46d6dd[_0x4c1ec2][_0x397a('0x52')]({'plain':!![]});switch(_0x3cc653[_0x397a('0x4e')]){case _0x397a('0x53'):_0x1cd78d[_0x397a('0x54')](db[_0x397a('0x55')][_0x397a('0x56')](_0xa63d73(_0x3cc653,_0x397a('0x5d')))[_0x397a('0x51')](function(){})[_0x397a('0x2e')](_0x3fd961()));break;case _0x397a('0x57'):_0x1cd78d[_0x397a('0x54')](db['sequelize'][_0x397a('0x56')](_0x30d26f(_0x3cc653,'CampaignId'))[_0x397a('0x51')](function(){})[_0x397a('0x2e')](_0x3fd961()));break;default:_0x1cd78d[_0x397a('0x54')](db[_0x397a('0x55')][_0x397a('0x56')](_0x40f31e(_0x3cc653,_0x397a('0x5d')))[_0x397a('0x51')](function(){})[_0x397a('0x2e')](_0x3fd961()));}}}return _0x1cd78d;})['all']();})['then'](function(){return db[_0x397a('0x5c')][_0x397a('0x4d')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x397a('0x5b'),'where':{'id':LISTID}}]})[_0x397a('0x51')](function(_0x4db467){var _0x5b4f80=[];if(_0x4db467){for(var _0x226224=0x0,_0x667e6f;_0x226224<_0x4db467[_0x397a('0x1a')];_0x226224+=0x1){_0x667e6f=_0x4db467[_0x226224][_0x397a('0x52')]({'plain':!![]});_0x5b4f80[_0x397a('0x54')](db[_0x397a('0x55')][_0x397a('0x56')](_0x417736(_0x667e6f,_0x397a('0x5d')))[_0x397a('0x51')](function(){})[_0x397a('0x2e')](_0x3fd961()));}}return _0x5b4f80;})[_0x397a('0x5e')]();})[_0x397a('0x2e')](function(_0x1e29ff){logger[_0x397a('0x15')]('cmContact,\x20%s,\x20%s',_0x397a('0x5f'),_0x1e29ff[_0x397a('0x1c')]);});}var processPromises=function(_0x41f2b8){return BPromise[_0x397a('0x5e')](promises)['then'](function(_0x8794e8){})[_0x397a('0x2e')](function(_0x17fdd0){logger['error'](_0x397a('0x60'),JSON[_0x397a('0x30')](_0x17fdd0));})['finally'](function(){socket[_0x397a('0x61')](_0x397a('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x41f2b8){return _0x41f2b8[_0x397a('0x63')]();}});};var endCsv=function(){return BPromise[_0x397a('0x64')]()[_0x397a('0x51')](function(){if(hopperContacts){return checkHopper();}})[_0x397a('0x51')](function(){socket[_0x397a('0x61')](_0x397a('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x397a('0x65')](FILEPATH);}catch(_0x54d996){logger['error']('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x397a('0x30')](_0x54d996));}finally{process[_0x397a('0x66')](0x0);}});};process['on'](_0x397a('0x67'),function(){logger[_0x397a('0x68')](_0x397a('0x69'));endCsv();});function main(){return BPromise[_0x397a('0x64')]()[_0x397a('0x51')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x397a('0x6a')](',');return db['CmContact'][_0x397a('0x4d')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x397a('0x51')](function(_0x1c49db){var _0x979465=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x979465,{'header':!![],'skipEmptyLines':!![],'step':function(_0x3c6761,_0x15abb2){total+=0x1;var _0x2b18a3=total;promises[_0x397a('0x54')](checkRow(_0x3c6761,_0x1c49db,_0x2b18a3)[_0x397a('0x51')](function(){success+=0x1;})[_0x397a('0x2e')](function(_0x7f67ae){if(_0x7f67ae[_0x397a('0x15')]){errors+=0x1;delete _0x7f67ae[_0x397a('0x15')];}else if(_0x7f67ae['duplicate']){duplicates+=0x1;delete _0x7f67ae['duplicate'];}rows[_0x397a('0x54')](_0x7f67ae);}));if(total%0xc8===0x0){_0x15abb2[_0x397a('0x6b')]();return processPromises(_0x15abb2);}},'complete':function(){return processPromises()[_0x397a('0x51')](function(){logger[_0x397a('0x68')](_0x397a('0x6c'));endCsv();});},'error':function(_0x36463a,_0x214fc1){logger[_0x397a('0x68')](_0x397a('0x6d'),JSON['stringify'](_0x36463a));endCsv();}});})['catch'](function(_0x2005e8){logger[_0x397a('0x15')](_0x397a('0x6e'),JSON[_0x397a('0x30')](_0x2005e8));});}main(); \ No newline at end of file +var _0x3775=['isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','length','find','duplicate','keys','push','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','from','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','\x20=\x20?','cm_contacts','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_black','VoiceQueue','findAll','dialCheckDuplicateType','CmList','Lists','then','get','always','catch','onlyIfOpen','sequelize','query','VoiceQueueId','all','outbound','CampaignId','Campaign','BlackLists','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','emit','contact:csv_','unlinkSync','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','CmContact','parse','pause','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','errors','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD'];(function(_0x4deaf0,_0x35450d){var _0x206339=function(_0x24cfa0){while(--_0x24cfa0){_0x4deaf0['push'](_0x4deaf0['shift']());}};_0x206339(++_0x35450d);}(_0x3775,0x1ee));var _0x5377=function(_0x2c755d,_0x2ab7a0){_0x2c755d=_0x2c755d-0x0;var _0x3497ed=_0x3775[_0x2c755d];return _0x3497ed;};'use strict';var BPromise=require(_0x5377('0x0'));var util=require(_0x5377('0x1'));var _=require(_0x5377('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require(_0x5377('0x3'));var Redis=require(_0x5377('0x4'));var db=require(_0x5377('0x5'))['db'];var config=require(_0x5377('0x6'));var logger=require(_0x5377('0x7'))('api');config[_0x5377('0x8')]=_[_0x5377('0x9')](config[_0x5377('0x8')],{'host':_0x5377('0xa'),'port':0x18eb});var socket=require(_0x5377('0xb'))(new Redis(config[_0x5377('0x8')]));require(_0x5377('0xc'))[_0x5377('0xd')](socket);try{if(!process[_0x5377('0xe')][0x2]||process[_0x5377('0xe')][0x2]===_0x5377('0xf')||process[_0x5377('0xe')][0x2]===_0x5377('0x10')){throw new Error(_0x5377('0x11'));}var FILEPATH=process[_0x5377('0xe')][0x2];if(!process[_0x5377('0xe')][0x3]||process[_0x5377('0xe')][0x3]===_0x5377('0xf')||process['argv'][0x3]===_0x5377('0x10')||!process[_0x5377('0xe')][0x4]||process[_0x5377('0xe')][0x4]===_0x5377('0xf')||process['argv'][0x4]===_0x5377('0x10')){throw new Error(_0x5377('0x12'));}var FIELDS=_[_0x5377('0x13')](process['argv'][0x3][_0x5377('0x14')](','),process[_0x5377('0xe')][0x4][_0x5377('0x14')](','));if(!process[_0x5377('0xe')][0x5]||process['argv'][0x5]===_0x5377('0xf')||process[_0x5377('0xe')][0x5]==='null'){throw new Error(_0x5377('0x15'));}var LISTID=process[_0x5377('0xe')][0x5];var COMPANYID=process[_0x5377('0xe')][0x6]&&process['argv'][0x6]!=='undefined'&&process['argv'][0x6]!==_0x5377('0x10')?process[_0x5377('0xe')][0x6]:null;var DUPLICATES=process[_0x5377('0xe')][0x7]&&process['argv'][0x7]!==_0x5377('0xf')&&process['argv'][0x7]!==_0x5377('0x10')?process[_0x5377('0xe')][0x7]:null;if(!process[_0x5377('0xe')][0x8]||process['argv'][0x8]===_0x5377('0xf')||process[_0x5377('0xe')][0x8]===_0x5377('0x10')){throw new Error(_0x5377('0x16'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x6bafa2){logger[_0x5377('0x17')](_0x6bafa2);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(_0x4298f2,_0x176faf,_0x3194c5,_0x21953a){var _0x5dc308={'message':_0x176faf};_0x5dc308[_0x4298f2]=!![];if(_0x3194c5){_0x5dc308[_0x5377('0x18')]=_0x3194c5;}if(_0x21953a){_0x5dc308[_0x5377('0x19')]=_0x21953a;}return _0x5dc308;}function isEmail(_0x288f30){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x288f30);}function checkRow(_0x90aca6,_0x98ad14,_0x469e4c){return new BPromise(function(_0x1906ac,_0xbeafb7){if(_['isNil'](_0x90aca6)){return _0xbeafb7(handleCheckRowError(_0x5377('0x17'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x469e4c));}if(_0x90aca6['errors']&&_0x90aca6[_0x5377('0x1a')]['length']){var _0x1cdc2a=_['map'](_0x90aca6['errors'],_0x5377('0x1b'))[_0x5377('0x1c')](';');return _0xbeafb7(handleCheckRowError(_0x5377('0x17'),_0x1cdc2a,null,_0x469e4c));}var _0x3a1740={};for(var _0x279352 in FIELDS){if(FIELDS[_0x5377('0x1d')](_0x279352)&&FIELDS[_0x279352]){_0x3a1740[_0x279352]=_0x90aca6['data'][0x0][FIELDS[_0x279352]]||_0x90aca6[_0x5377('0x1e')][0x0]['\ufeff'+FIELDS[_0x279352]];}}if(!_0x3a1740[_0x5377('0x1f')]){return _0xbeafb7(handleCheckRowError(_0x5377('0x17'),_0x5377('0x20'),null,_0x469e4c));}if(!_0x3a1740['phone']){return _0xbeafb7(handleCheckRowError(_0x5377('0x17'),_0x5377('0x21'),null,_0x469e4c));}if(_0x3a1740[_0x5377('0x22')]){var _0x58f7bb=moment(_0x3a1740[_0x5377('0x22')],_0x5377('0x23'));if(!_0x58f7bb[_0x5377('0x24')]()){return _0xbeafb7(handleCheckRowError('error',_0x5377('0x25'),null,_0x469e4c));}}if(_0x3a1740[_0x5377('0x26')]){if(!isEmail(_0x3a1740['email'])){return _0xbeafb7(handleCheckRowError('error',_0x5377('0x27'),null,_0x469e4c));}}_0x3a1740[_0x5377('0x28')]=LISTID;_0x3a1740['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x5377('0x29')]&&_0x98ad14){var _0x187545={};for(var _0x6df672=0x0,_0x2fc0d7=DUPLICATES[_0x5377('0x29')];_0x6df672<_0x2fc0d7;_0x6df672+=0x1){_0x187545[DUPLICATES[_0x6df672]]=_0x3a1740[DUPLICATES[_0x6df672]];}var _0x5529ef=_[_0x5377('0x2a')](_0x98ad14,_0x187545);if(_0x5529ef){return _0xbeafb7(handleCheckRowError(_0x5377('0x2b'),'Duplicate\x20Contact',_0x5529ef,_0x469e4c));}}return db['CmContact']['create'](_0x3a1740,{'raw':!![],'hooks':![],'fields':_[_0x5377('0x2c')](_0x3a1740)})['then'](function(_0x5b2ea3){if(DUPLICATES&&DUPLICATES['length']&&_0x98ad14){_0x98ad14[_0x5377('0x2d')](_['pick'](_0x3a1740,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x5b2ea3['id'];return _0x1906ac();})['catch'](function(_0x5136c2){return _0xbeafb7(handleCheckRowError('error',_0x5377('0x2e')+(_0x5136c2[_0x5377('0x1b')]||JSON[_0x5377('0x2f')](_0x5136c2)),null,_0x469e4c));});});}function checkHopper(){function _0x30da45(){return function(_0x14283e){logger[_0x5377('0x17')](_0x5377('0x30'),_0x5377('0x31'),util['inspect'](_0x14283e,{'showHidden':![],'depth':null}));};}var _0x48a8e0=function(_0x1e4d07,_0x4caf59){var _0xc4bf16=squel[_0x5377('0x32')]()[_0x5377('0x33')](_0x5377('0x34'))[_0x5377('0x35')]([_0x5377('0x36'),_0x5377('0x37'),_0x5377('0x38'),_0x5377('0x28'),_0x4caf59,_0x5377('0x39'),_0x5377('0x3a')],squel[_0x5377('0x3b')]()[_0x5377('0x3c')](_0x5377('0x36'),'phone')['field'](_0x5377('0x3d'),_0x5377('0x37'))[_0x5377('0x3c')]('id',_0x5377('0x38'))[_0x5377('0x3c')](LISTID[_0x5377('0x3e')](),_0x5377('0x28'))[_0x5377('0x3c')](_0x1e4d07['id'][_0x5377('0x3e')](),_0x4caf59)[_0x5377('0x3c')](_0x5377('0x3d'),_0x5377('0x39'))['field'](_0x5377('0x3d'),_0x5377('0x3a'))[_0x5377('0x3f')]('cm_contacts')[_0x5377('0x40')](_0x5377('0x41'))[_0x5377('0x40')](_0x5377('0x42'),LISTID[_0x5377('0x3e')]())['where']('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x5377('0x3b')]()[_0x5377('0x3c')](_0x5377('0x36'))[_0x5377('0x3f')](_0x5377('0x34'))[_0x5377('0x40')](_0x4caf59+_0x5377('0x43'),_0x1e4d07['id'][_0x5377('0x3e')]())))[_0x5377('0x3e')]();return _0xc4bf16;};var _0x387f66=function(_0x4dfe47,_0x3efe09){var _0x388cde=squel[_0x5377('0x32')]()[_0x5377('0x33')](_0x5377('0x34'))[_0x5377('0x35')]([_0x5377('0x36'),_0x5377('0x37'),'ContactId',_0x5377('0x28'),_0x3efe09,'createdAt','updatedAt'],squel[_0x5377('0x3b')]()[_0x5377('0x3c')]('phone',_0x5377('0x36'))[_0x5377('0x3c')]('NOW()',_0x5377('0x37'))['field']('id','ContactId')[_0x5377('0x3c')](LISTID[_0x5377('0x3e')](),_0x5377('0x28'))[_0x5377('0x3c')](_0x4dfe47['id'][_0x5377('0x3e')](),_0x3efe09)[_0x5377('0x3c')](_0x5377('0x3d'),'createdAt')['field'](_0x5377('0x3d'),_0x5377('0x3a'))['from'](_0x5377('0x44'))['where'](_0x5377('0x41'))[_0x5377('0x40')](_0x5377('0x42'),LISTID[_0x5377('0x3e')]())['where'](_0x5377('0x45'),squel[_0x5377('0x46')](hopperContacts))['where'](_0x5377('0x47'))[_0x5377('0x40')](_0x5377('0x48'),squel[_0x5377('0x3b')]()[_0x5377('0x3c')](_0x5377('0x49'))[_0x5377('0x3f')]('cm_hopper_final')[_0x5377('0x40')](_0x3efe09+_0x5377('0x43'),_0x4dfe47['id']['toString']()))[_0x5377('0x40')](_0x5377('0x48'),squel['select']()[_0x5377('0x3c')](_0x5377('0x36'))['from'](_0x5377('0x34'))[_0x5377('0x40')](_0x3efe09+'\x20=\x20?',_0x4dfe47['id'][_0x5377('0x3e')]())))[_0x5377('0x3e')]();return _0x388cde;};function _0x202cfb(_0x2a95ab,_0x233b61){var _0x287bee=squel[_0x5377('0x32')]()[_0x5377('0x33')](_0x5377('0x34'))[_0x5377('0x35')]([_0x5377('0x36'),_0x5377('0x37'),_0x5377('0x38'),'ListId',_0x233b61,_0x5377('0x39'),'updatedAt'],squel[_0x5377('0x3b')]()[_0x5377('0x3c')]('phone','phone')[_0x5377('0x3c')]('NOW()',_0x5377('0x37'))[_0x5377('0x3c')]('id',_0x5377('0x38'))[_0x5377('0x3c')](LISTID['toString'](),_0x5377('0x28'))[_0x5377('0x3c')](_0x2a95ab['id'][_0x5377('0x3e')](),_0x233b61)[_0x5377('0x3c')](_0x5377('0x3d'),_0x5377('0x39'))[_0x5377('0x3c')](_0x5377('0x3d'),_0x5377('0x3a'))[_0x5377('0x3f')]('cm_contacts')[_0x5377('0x40')](_0x5377('0x41'))[_0x5377('0x40')](_0x5377('0x42'),LISTID[_0x5377('0x3e')]())[_0x5377('0x40')](_0x5377('0x45'),squel[_0x5377('0x46')](hopperContacts))[_0x5377('0x40')](_0x5377('0x47')))[_0x5377('0x3e')]();return _0x287bee;}function _0xabdb5c(_0x5233fb,_0x126a89){var _0x141156=squel[_0x5377('0x32')]()[_0x5377('0x33')](_0x5377('0x4a'))['fromQuery'](['phone',_0x5377('0x38'),_0x5377('0x28'),_0x126a89,_0x5377('0x39'),'updatedAt'],squel[_0x5377('0x3b')]()['field']('phone',_0x5377('0x36'))[_0x5377('0x3c')]('id','ContactId')[_0x5377('0x3c')](LISTID[_0x5377('0x3e')](),'ListId')[_0x5377('0x3c')](_0x5233fb['id'][_0x5377('0x3e')](),_0x126a89)[_0x5377('0x3c')](_0x5377('0x3d'),'createdAt')[_0x5377('0x3c')]('NOW()',_0x5377('0x3a'))['from']('cm_contacts')[_0x5377('0x40')]('deletedAt\x20IS\x20NULL')[_0x5377('0x40')](_0x5377('0x42'),LISTID[_0x5377('0x3e')]())[_0x5377('0x40')]('id\x20IN\x20?',squel[_0x5377('0x46')](hopperContacts))[_0x5377('0x40')](_0x5377('0x47')))[_0x5377('0x3e')]();return _0x141156;}return db[_0x5377('0x4b')][_0x5377('0x4c')]({'where':{'type':'outbound'},'attributes':['id',_0x5377('0x4d')],'include':[{'model':db[_0x5377('0x4e')],'as':_0x5377('0x4f'),'where':{'id':LISTID}}]})[_0x5377('0x50')](function(_0xb8ed09){var _0x2d4f44=[];if(_0xb8ed09){var _0x313850;for(var _0xb3a1c=0x0,_0x1ffcde;_0xb3a1c<_0xb8ed09[_0x5377('0x29')];_0xb3a1c+=0x1){_0x1ffcde=_0xb8ed09[_0xb3a1c][_0x5377('0x51')]({'plain':!![]});switch(_0x1ffcde[_0x5377('0x4d')]){case _0x5377('0x52'):_0x2d4f44[_0x5377('0x2d')](db['sequelize']['query'](_0x387f66(_0x1ffcde,'VoiceQueueId'))[_0x5377('0x50')](function(){})[_0x5377('0x53')](_0x30da45()));break;case _0x5377('0x54'):_0x2d4f44[_0x5377('0x2d')](db[_0x5377('0x55')][_0x5377('0x56')](_0x48a8e0(_0x1ffcde,_0x5377('0x57')))[_0x5377('0x50')](function(){})[_0x5377('0x53')](_0x30da45()));break;default:_0x2d4f44[_0x5377('0x2d')](db[_0x5377('0x55')][_0x5377('0x56')](_0x202cfb(_0x1ffcde,_0x5377('0x57')))[_0x5377('0x50')](function(){})[_0x5377('0x53')](_0x30da45()));}}}return _0x2d4f44;})[_0x5377('0x58')]()['then'](function(){return db['VoiceQueue'][_0x5377('0x4c')]({'where':{'type':_0x5377('0x59')},'attributes':['id'],'include':[{'model':db[_0x5377('0x4e')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x5377('0x50')](function(_0x2fba33){var _0x265b87=[];if(_0x2fba33){var _0x5e6095;for(var _0x34beaa=0x0,_0x591785;_0x34beaa<_0x2fba33[_0x5377('0x29')];_0x34beaa+=0x1){_0x591785=_0x2fba33[_0x34beaa][_0x5377('0x51')]({'plain':!![]});_0x265b87[_0x5377('0x2d')](db['sequelize'][_0x5377('0x56')](_0xabdb5c(_0x591785,'VoiceQueueId'))['then'](function(){})[_0x5377('0x53')](_0x30da45()));}}return _0x265b87;})[_0x5377('0x58')]();})[_0x5377('0x50')](function(){return db['Campaign'][_0x5377('0x4c')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x5377('0x4e')],'as':_0x5377('0x4f'),'where':{'id':LISTID}}]})['then'](function(_0x1bf7f8){var _0x572eb2=[];if(_0x1bf7f8){for(var _0x285604=0x0,_0x43dd86;_0x285604<_0x1bf7f8[_0x5377('0x29')];_0x285604+=0x1){_0x43dd86=_0x1bf7f8[_0x285604][_0x5377('0x51')]({'plain':!![]});switch(_0x43dd86['dialCheckDuplicateType']){case _0x5377('0x52'):_0x572eb2[_0x5377('0x2d')](db[_0x5377('0x55')][_0x5377('0x56')](_0x387f66(_0x43dd86,'CampaignId'))[_0x5377('0x50')](function(){})[_0x5377('0x53')](_0x30da45()));break;case _0x5377('0x54'):_0x572eb2['push'](db[_0x5377('0x55')][_0x5377('0x56')](_0x48a8e0(_0x43dd86,_0x5377('0x5a')))[_0x5377('0x50')](function(){})[_0x5377('0x53')](_0x30da45()));break;default:_0x572eb2[_0x5377('0x2d')](db[_0x5377('0x55')][_0x5377('0x56')](_0x202cfb(_0x43dd86,'CampaignId'))[_0x5377('0x50')](function(){})['catch'](_0x30da45()));}}}return _0x572eb2;})[_0x5377('0x58')]();})[_0x5377('0x50')](function(){return db[_0x5377('0x5b')]['findAll']({'attributes':['id'],'include':[{'model':db[_0x5377('0x4e')],'as':_0x5377('0x5c'),'where':{'id':LISTID}}]})[_0x5377('0x50')](function(_0xf139ca){var _0x49fdc4=[];if(_0xf139ca){for(var _0x5b5ae8=0x0,_0x4cd7d5;_0x5b5ae8<_0xf139ca['length'];_0x5b5ae8+=0x1){_0x4cd7d5=_0xf139ca[_0x5b5ae8][_0x5377('0x51')]({'plain':!![]});_0x49fdc4[_0x5377('0x2d')](db[_0x5377('0x55')][_0x5377('0x56')](_0xabdb5c(_0x4cd7d5,_0x5377('0x5a')))[_0x5377('0x50')](function(){})[_0x5377('0x53')](_0x30da45()));}}return _0x49fdc4;})[_0x5377('0x58')]();})['catch'](function(_0x212a06){logger['error'](_0x5377('0x5d'),'generalCheckHopper',_0x212a06[_0x5377('0x1b')]);});}var processPromises=function(_0x5c39e1){return BPromise[_0x5377('0x58')](promises)['then'](function(_0xbdc058){})[_0x5377('0x53')](function(_0x452f63){logger[_0x5377('0x17')](_0x5377('0x5e'),JSON[_0x5377('0x2f')](_0x452f63));})['finally'](function(){socket[_0x5377('0x5f')](_0x5377('0x60')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x5c39e1){return _0x5c39e1['resume']();}});};var endCsv=function(){return BPromise['resolve']()[_0x5377('0x50')](function(){if(hopperContacts){return checkHopper();}})[_0x5377('0x50')](function(){socket['emit'](_0x5377('0x60')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x5377('0x61')](FILEPATH);}catch(_0x26a3ac){logger[_0x5377('0x17')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x5377('0x2f')](_0x26a3ac));}finally{process[_0x5377('0x62')](0x0);}});};process['on'](_0x5377('0x63'),function(){logger[_0x5377('0x64')](_0x5377('0x65'));endCsv();});function main(){return BPromise['resolve']()[_0x5377('0x50')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x5377('0x14')](',');return db[_0x5377('0x66')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x72daae){var _0x21daa2=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x5377('0x67')](_0x21daa2,{'header':!![],'skipEmptyLines':!![],'step':function(_0x32224f,_0x1a1e81){total+=0x1;var _0x2c0a33=total;promises['push'](checkRow(_0x32224f,_0x72daae,_0x2c0a33)[_0x5377('0x50')](function(){success+=0x1;})['catch'](function(_0x45c928){if(_0x45c928['error']){errors+=0x1;delete _0x45c928[_0x5377('0x17')];}else if(_0x45c928[_0x5377('0x2b')]){duplicates+=0x1;delete _0x45c928[_0x5377('0x2b')];}rows[_0x5377('0x2d')](_0x45c928);}));if(total%0xc8===0x0){_0x1a1e81[_0x5377('0x68')]();return processPromises(_0x1a1e81);}},'complete':function(){return processPromises()[_0x5377('0x50')](function(){logger[_0x5377('0x64')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x5284a4,_0x59af45){logger[_0x5377('0x64')]('CSV\x20parse\x20error',JSON[_0x5377('0x2f')](_0x5284a4));endCsv();}});})[_0x5377('0x53')](function(_0x2e2b1b){logger['error'](_0x5377('0x69'),JSON[_0x5377('0x2f')](_0x2e2b1b));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 9e0b53a..88032ae 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 _0x5ebc=['query','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','utcOffset','set','offset','main','stringify','start','binding','clone','socket_timestamp','root','server/files/tmp','.csv','includes','header','ContactItemType','name','_description','writeFileSync','parse','data','find','isNil','hasOwnProperty','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNumber','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','replace','itemTypeId','description','SystemRow','rows','emit','contact:import:','Abort\x20parser','abort','step','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','CREATE\x20TABLE\x20','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','VoiceQueueId','CampaignId','campaigns_has_cm_blacklists','voice_queues_has_cm_blacklists','finish','affectedRows','unlink','complete','argv','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','lodash','papaparse','util','bluebird','moment','squel','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','format','test','select','phone','from','join','.id\x20=\x20','where','\x20=\x20','findAll','AdditionalPhones','then','length','push','all','split','CmContactHasItem','findOne','update','create','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','createdAt','UserId','recallme','fields','cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_hopper_black','ListId','cm_contacts.createdAt\x20=\x20?','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','ContactId','updatedAt','cm_contacts.ListId\x20=\x20','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','OrderBy','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','code','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','sequelize'];(function(_0x9f2474,_0x452918){var _0x4bd353=function(_0x2234f7){while(--_0x2234f7){_0x9f2474['push'](_0x9f2474['shift']());}};_0x4bd353(++_0x452918);}(_0x5ebc,0x103));var _0xc5eb=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x5ebc[_0x4e9d3c];return _0x2d0825;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xc5eb('0x0'));var Papa=require(_0xc5eb('0x1'));var util=require(_0xc5eb('0x2'));var BPromise=require(_0xc5eb('0x3'));var moment=require(_0xc5eb('0x4'));var squel=require(_0xc5eb('0x5'));var Redis=require('ioredis');var db=require(_0xc5eb('0x6'))['db'];var config=require(_0xc5eb('0x7'));var shared=require('../../../config/environment/shared');var logger=require(_0xc5eb('0x8'))(_0xc5eb('0x9'));config[_0xc5eb('0xa')]=_[_0xc5eb('0xb')](config[_0xc5eb('0xa')],{'host':_0xc5eb('0xc'),'port':0x18eb});var socket=require(_0xc5eb('0xd'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format'](_0xc5eb('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xc5eb('0xf')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x4d9156){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))*$/[_0xc5eb('0x10')](_0x4d9156);}function selectNotIn(_0x45edba,_0x3a22d3,_0x4228,_0x2c15f6,_0x29fd82){return squel[_0xc5eb('0x11')]()['field'](_0xc5eb('0x12'))[_0xc5eb('0x13')](_0x2c15f6)[_0xc5eb('0x14')](_0x3a22d3,null,_0x3a22d3+_0xc5eb('0x15')+_0x2c15f6+'.'+_0x4228)[_0xc5eb('0x16')](_0x2c15f6+'.'+_0x4228+_0xc5eb('0x17')+_0x45edba+'.'+_0x4228)[_0xc5eb('0x16')](_0x3a22d3+'.dialCheckDuplicateType\x20IN\x20('+_0x29fd82['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x67d2d6,_0x3a9645){promisesAdditionalPhones=[];return db['CmContact'][_0xc5eb('0x18')]({'raw':!![],'attributes':['id',_0xc5eb('0x19')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xc5eb('0x1a')](function(_0x49e5ea){if(_0x49e5ea!==null){var _0x233c92=[];for(var _0x3a8555=0x0;_0x3a8555<_0x49e5ea[_0xc5eb('0x1b')];_0x3a8555++){var _0x3a0817=_0x49e5ea[_0x3a8555];_0x233c92[_0xc5eb('0x1c')](insertAdditionalPhones(_0x3a0817));}}Promise[_0xc5eb('0x1d')](_0x233c92)['then'](function(){_0x67d2d6({'val':0x1});});});});}function insertAdditionalPhones(_0x29ee4c){return new Promise(function(_0x3e6a77,_0x7c6cc6){var _0x4d66f8=_0x29ee4c[_0xc5eb('0x19')];var _0x17ce00=_0x4d66f8[_0xc5eb('0x1e')](';');var _0x1088cc=[];orderBy=0x0;for(var _0x3141ff=0x0;_0x3141ff<_0x17ce00[_0xc5eb('0x1b')];_0x3141ff++){_0x1088cc['push'](splitAdditionalPhone(_0x29ee4c['id'],_0x17ce00[_0x3141ff]));}Promise[_0xc5eb('0x1d')](_0x1088cc)['then'](function(){_0x3e6a77({'val':_0x17ce00[_0xc5eb('0x1b')]});});});}function splitAdditionalPhone(_0x4ee6e2,_0x11a3f6){return new Promise(function(_0x4b4845,_0x4e35dd){var _0x1a0f8b=_0x11a3f6[_0xc5eb('0x1e')](':');var _0x32c1a4=_0x1a0f8b[0x0];var _0xdbfa99=_0x1a0f8b[0x1];if(!_['isNil'](_0xdbfa99)){var _0x1a0da1=_0xdbfa99[_0xc5eb('0x1e')]('|');var _0x284b81=[];for(var _0x2276b1=0x0;_0x2276b1<_0x1a0da1[_0xc5eb('0x1b')];_0x2276b1++){if(_0x1a0da1[_0x2276b1]!==''){var _0x5898ba=_['filter'](promisesAdditionalPhones,{'contactId':_0x4ee6e2,'phone':_0x1a0da1[_0x2276b1]});if(_0x5898ba[_0xc5eb('0x1b')]==0x0){orderBy++;promisesAdditionalPhones[_0xc5eb('0x1c')]({'contactId':_0x4ee6e2,'contactTypeId':_0x32c1a4,'phone':_0x1a0da1[_0x2276b1],'orderBy':orderBy});}}}_0x4b4845({'ok':0x1});}else _0x4b4845({'res':0x0});});}function createAdditionalPhone(_0x42b0bc,_0x1f1429,_0x35b640,_0x5ab0aa){var _0x1459bd='';var _0x281036='';var _0x482194=_0x35b640['split']('§');_0x1459bd=_0x482194[0x0];if(_0x482194[_0xc5eb('0x1b')]==0x2)_0x281036=_0x482194[0x1];return new Promise(function(_0x18abd5,_0xcf081b){return db[_0xc5eb('0x1f')][_0xc5eb('0x20')]({'where':{'CmContactId':_0x42b0bc,'item':_0x1459bd}})['then'](function(_0x3a81f1){if(_0x3a81f1){return db['CmContactHasItem'][_0xc5eb('0x21')]({'ItemTypeId':_0x1f1429,'description':_0x281036,'OrderBy':_0x5ab0aa},{'where':{'CmContactId':_0x42b0bc,'item':_0x1459bd}})['then'](function(_0x9e213f){_0x18abd5({'res':'updated'});});}else{return db[_0xc5eb('0x1f')][_0xc5eb('0x22')]({'CmContactId':_0x42b0bc,'item':_0x1459bd,'description':_0x281036,'ItemTypeId':_0x1f1429,'OrderBy':_0x5ab0aa,'ItemClass':'PHONE'})[_0xc5eb('0x1a')](function(_0x49515c){_0x18abd5({'res':_0xc5eb('0x23')});});}});});}function insertCmHopper(_0x50cd14,_0x477c1b,_0xf12c95,_0x59af50,_0x457f1e){var _0x53e7be=[_0xc5eb('0x24'),_0xc5eb('0x25'),_0xc5eb('0x26'),_0xc5eb('0x27'),_0x477c1b+'.'+_0x59af50,_0xc5eb('0x28'),_0xc5eb('0x29'),_0xc5eb('0x2a'),_0xc5eb('0x2b'),'\x22'+_0x457f1e+'\x22'];return squel[_0xc5eb('0x2c')]()[_0xc5eb('0x2d')](_0xc5eb('0x2e'))[_0xc5eb('0x2f')]([_0xc5eb('0x12'),_0xc5eb('0x30'),'ContactId','ListId',_0x59af50,_0xc5eb('0x31'),'updatedAt','priority',_0xc5eb('0x32'),_0xc5eb('0x33')],squel[_0xc5eb('0x11')]()[_0xc5eb('0x34')](_0x53e7be)[_0xc5eb('0x13')](_0x477c1b)['join'](_0xc5eb('0x35'),null,'cm_contacts.ListId\x20=\x20'+_0x477c1b+_0xc5eb('0x36'))[_0xc5eb('0x14')](_0xf12c95,null,_0xf12c95+'.id\x20=\x20'+_0x477c1b+'.'+_0x59af50)['where'](_0x477c1b+_0xc5eb('0x37'),_0x50cd14)[_0xc5eb('0x16')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0xc5eb('0x38'),selectNotIn(_0x477c1b,_0xf12c95,_0x59af50,'cm_hopper',[_0xc5eb('0x39'),_0xc5eb('0x3a')]))[_0xc5eb('0x16')](_0xc5eb('0x38'),selectNotIn(_0x477c1b,_0xf12c95,_0x59af50,_0xc5eb('0x2e'),['\x22always\x22'])))[_0xc5eb('0x3b')]();}function insertCmHopperBlack(_0x151952,_0x225f68,_0x2a5d10,_0x2d3b5b){var _0x150129=['cm_contacts.phone','cm_contacts.id',_0xc5eb('0x27'),_0x225f68+'.'+_0x2d3b5b,_0xc5eb('0x28'),_0xc5eb('0x29')];return squel[_0xc5eb('0x2c')]()[_0xc5eb('0x2d')](_0xc5eb('0x3c'))[_0xc5eb('0x2f')]([_0xc5eb('0x12'),'ContactId',_0xc5eb('0x3d'),_0x2d3b5b,_0xc5eb('0x31'),'updatedAt'],squel[_0xc5eb('0x11')]()[_0xc5eb('0x34')](_0x150129)[_0xc5eb('0x13')](_0x225f68)[_0xc5eb('0x14')](_0xc5eb('0x35'),null,'cm_contacts.ListId\x20=\x20'+_0x225f68+_0xc5eb('0x36'))[_0xc5eb('0x14')](_0x2a5d10,null,_0x2a5d10+_0xc5eb('0x15')+_0x225f68+'.'+_0x2d3b5b)[_0xc5eb('0x16')](_0x225f68+_0xc5eb('0x37'),_0x151952)[_0xc5eb('0x16')](_0xc5eb('0x3e'),NOW)[_0xc5eb('0x16')](_0xc5eb('0x38'),squel[_0xc5eb('0x11')]()['field'](_0xc5eb('0x12'))[_0xc5eb('0x13')](_0xc5eb('0x3c'))['where'](_0xc5eb('0x3f'),_0x151952)[_0xc5eb('0x16')](_0x2d3b5b+_0xc5eb('0x17')+_0x225f68+'.'+_0x2d3b5b)))['toString']();}function insertTzCmHopper(_0x48c13d,_0x867fb7,_0x1af8c7,_0xb30b51,_0x1b072a,_0x5244fd){var _0x5e8f3b=[_0xc5eb('0x24'),_0xc5eb('0x40')+_0x5244fd+'.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.id',_0xc5eb('0x27'),_0x867fb7+'.'+_0xb30b51,_0xc5eb('0x28'),_0xc5eb('0x29'),_0xc5eb('0x2a'),'cm_contacts.UserId','\x22'+_0x1b072a+'\x22'];var _0x4572fc=squel[_0xc5eb('0x2c')]()['into'](_0xc5eb('0x2e'))[_0xc5eb('0x2f')]([_0xc5eb('0x12'),_0xc5eb('0x30'),_0xc5eb('0x41'),_0xc5eb('0x3d'),_0xb30b51,_0xc5eb('0x31'),_0xc5eb('0x42'),'priority',_0xc5eb('0x32'),_0xc5eb('0x33')],squel[_0xc5eb('0x11')]()[_0xc5eb('0x34')](_0x5e8f3b)[_0xc5eb('0x13')](_0x867fb7)[_0xc5eb('0x14')](_0xc5eb('0x35'),null,_0xc5eb('0x43')+_0x867fb7+_0xc5eb('0x36'))['join'](_0x1af8c7,null,_0x1af8c7+_0xc5eb('0x15')+_0x867fb7+'.'+_0xb30b51)[_0xc5eb('0x14')](_0x5244fd,null,_0x5244fd+_0xc5eb('0x15')+_0x867fb7+'.'+_0xb30b51)[_0xc5eb('0x16')](_0x867fb7+_0xc5eb('0x37'),_0x48c13d)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0xc5eb('0x16')](_0xc5eb('0x38'),selectNotIn(_0x867fb7,_0x1af8c7,_0xb30b51,_0xc5eb('0x2e'),[_0xc5eb('0x39'),_0xc5eb('0x3a')]))[_0xc5eb('0x16')](_0xc5eb('0x38'),selectNotIn(_0x867fb7,_0x1af8c7,_0xb30b51,_0xc5eb('0x2e'),[_0xc5eb('0x39')])))['toString']();return _0x4572fc;}function insertTzCmHopperBlack(_0x18572b,_0x3613d7,_0x113efb,_0x50acfc){var _0x5d9c78=[_0xc5eb('0x24'),_0xc5eb('0x26'),_0xc5eb('0x27'),_0x3613d7+'.'+_0x50acfc,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel[_0xc5eb('0x2c')]()[_0xc5eb('0x2d')]('cm_hopper_black')[_0xc5eb('0x2f')](['phone','ContactId',_0xc5eb('0x3d'),_0x50acfc,_0xc5eb('0x31'),_0xc5eb('0x42')],squel['select']()[_0xc5eb('0x34')](_0x5d9c78)[_0xc5eb('0x13')](_0x3613d7)[_0xc5eb('0x14')]('cm_contacts',null,_0xc5eb('0x43')+_0x3613d7+_0xc5eb('0x36'))[_0xc5eb('0x14')](_0x113efb,null,_0x113efb+_0xc5eb('0x15')+_0x3613d7+'.'+_0x50acfc)[_0xc5eb('0x16')](_0x3613d7+_0xc5eb('0x37'),_0x18572b)[_0xc5eb('0x16')](_0xc5eb('0x3e'),NOW)[_0xc5eb('0x16')](_0xc5eb('0x38'),squel['select']()['field']('phone')[_0xc5eb('0x13')](_0xc5eb('0x3c'))[_0xc5eb('0x16')](_0xc5eb('0x3f'),_0x18572b)['where'](_0x50acfc+'\x20=\x20'+_0x3613d7+'.'+_0x50acfc)))['toString']();}function insertCmHopperAdditionalPhones(_0x17d0f9){var _0x5b7434=[_0xc5eb('0x44'),_0xc5eb('0x45'),_0xc5eb('0x46'),'cm_contact_has_items.createdAt',_0xc5eb('0x47')];return squel[_0xc5eb('0x2c')]()[_0xc5eb('0x2d')](_0xc5eb('0x48'))['fromQuery'](['CmHopperId',_0xc5eb('0x12'),_0xc5eb('0x49'),_0xc5eb('0x31'),_0xc5eb('0x42')],squel[_0xc5eb('0x11')]()[_0xc5eb('0x34')](_0x5b7434)[_0xc5eb('0x13')](_0xc5eb('0x2e'))['join'](_0xc5eb('0x35'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')['join']('cm_contact_has_items',null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0xc5eb('0x16')](_0xc5eb('0x4a'),_0x17d0f9)[_0xc5eb('0x16')](_0xc5eb('0x3e'),NOW))['toString']();}function insertCmContact(_0x10dd4b,_0x2b2fe7,_0x407f3b,_0x413bb4){var _0x5cc3e7=_[_0xc5eb('0x4b')](_[_0xc5eb('0x4c')](_0x413bb4),[_0xc5eb('0x3d'),_0xc5eb('0x4d'),'createdAt',_0xc5eb('0x42')]);return squel['insert']()[_0xc5eb('0x2d')](_0xc5eb('0x35'))[_0xc5eb('0x2f')](_0x5cc3e7,squel[_0xc5eb('0x11')]()[_0xc5eb('0x34')](_0x5cc3e7)[_0xc5eb('0x13')](_0x2b2fe7)[_0xc5eb('0x16')]('('+_0x407f3b['join'](',')+')\x20NOT\x20IN\x20?',squel[_0xc5eb('0x11')]()[_0xc5eb('0x34')](_0x407f3b)[_0xc5eb('0x13')](_0xc5eb('0x35'))[_0xc5eb('0x16')](_0xc5eb('0x3f'),_0x10dd4b)[_0xc5eb('0x16')]('deletedAt\x20IS\x20NULL'))[_0xc5eb('0x16')]('id\x20IN\x20?',squel[_0xc5eb('0x11')]()['field'](_0xc5eb('0x4e'),_0xc5eb('0x4f'))[_0xc5eb('0x13')](_0x2b2fe7)[_0xc5eb('0x50')](_0x407f3b[_0xc5eb('0x14')](','))))['toString']();}function handleStop(){logger[_0xc5eb('0x51')](_0xc5eb('0x52'));stopped=!![];}function handleUncaughtException(_0x12d832){logger[_0xc5eb('0x53')](_0x12d832[_0xc5eb('0x54')]);process[_0xc5eb('0x55')](0x1);}function handleError(_0x568239,_0x4bf8b9){stats[_0xc5eb('0x56')][_0xc5eb('0x1c')]({'name':_0x4bf8b9[_0xc5eb('0x57')],'message':_0x4bf8b9[_0xc5eb('0x54')],'row':_0x568239});}function handleQuery(_0x41ba5a){logger[_0xc5eb('0x51')](_0x41ba5a);return db['sequelize']['query'](_0x41ba5a)[_0xc5eb('0x58')](function(_0x4593d3){results[_0xc5eb('0x1c')](_0x4593d3);})[_0xc5eb('0x59')](function(_0x3ddfa6){logger[_0xc5eb('0x53')](_0x3ddfa6['message']);});}function updateTzCampaigns(_0x40c11d){return new Promise(function(_0x5147c6,_0x29b5c6){var _0x168bd2=squel[_0xc5eb('0x11')]()[_0xc5eb('0x34')]([_0xc5eb('0x5a'),_0xc5eb('0x5b')])['from'](_0xc5eb('0x5c'))[_0xc5eb('0x14')](_0xc5eb('0x5d'),null,_0xc5eb('0x5e'))[_0xc5eb('0x16')](_0xc5eb('0x5f')+_0x40c11d);db[_0xc5eb('0x60')][_0xc5eb('0x61')](_0x168bd2[_0xc5eb('0x3b')]())[_0xc5eb('0x58')](function(_0x1c624a){var _0x93e5e3=[];for(var _0x1061e5=0x0;_0x1061e5<_0x1c624a[_0xc5eb('0x1b')];_0x1061e5++){_0x93e5e3[_0xc5eb('0x1c')](getTimezoneData(_0x1c624a[_0x1061e5],tmp_campaigns));}BPromise[_0xc5eb('0x1d')](_0x93e5e3)[_0xc5eb('0x1a')](function(){_0x5147c6({'val':0x1});});})[_0xc5eb('0x59')](function(_0x4a97db){logger['error'](_0x4a97db[_0xc5eb('0x54')]);_0x5147c6({'val':0x0});});});}function updateTzVoiceQueues(_0xfcaa77){return new Promise(function(_0x253807,_0x41e580){var _0x126453=squel[_0xc5eb('0x11')]()[_0xc5eb('0x34')]([_0xc5eb('0x62'),_0xc5eb('0x63')])[_0xc5eb('0x13')](_0xc5eb('0x64'))[_0xc5eb('0x14')](_0xc5eb('0x65'),null,_0xc5eb('0x66'))[_0xc5eb('0x16')](_0xc5eb('0x67')+_0xfcaa77);db[_0xc5eb('0x60')][_0xc5eb('0x61')](_0x126453[_0xc5eb('0x3b')]())[_0xc5eb('0x58')](function(_0x1ed9a1){var _0x2fd40d=[];for(var _0x3fd641=0x0;_0x3fd641<_0x1ed9a1[_0xc5eb('0x1b')];_0x3fd641++){_0x2fd40d['push'](getTimezoneData(_0x1ed9a1[_0x3fd641],tmp_voice_queues));}BPromise[_0xc5eb('0x1d')](_0x2fd40d)[_0xc5eb('0x1a')](function(){_0x253807({'val':0x1});});})[_0xc5eb('0x59')](function(_0x577e7d){logger[_0xc5eb('0x53')](_0x577e7d[_0xc5eb('0x54')]);_0x253807({'val':0x0});});});}function getTimezoneData(_0xb268aa,_0x2e9dee){return new Promise(function(_0x243282,_0x5e7734){var _0x211c6a=shared[_0xc5eb('0x68')];var _0x3ffe9b=_0x211c6a[_0xb268aa[_0xc5eb('0x69')]];if(_['isNil'](_0x3ffe9b)){_0x243282({'ret':0x1});}else{var _0x1b3a6b=_0x3ffe9b[_0xc5eb('0x6a')];var _0x4a15f8=squel['insert']()[_0xc5eb('0x2d')](_0x2e9dee)[_0xc5eb('0x6b')]('id',_0xb268aa['id'])[_0xc5eb('0x6b')](_0xc5eb('0x6c'),_0x1b3a6b)[_0xc5eb('0x6b')]('dialTimezone',_0xb268aa['dialTimezone'])[_0xc5eb('0x3b')]();return db['sequelize']['query'](_0x4a15f8)[_0xc5eb('0x58')](function(_0x1a8124){_0x243282({'ret':0x1});})[_0xc5eb('0x59')](function(_0x116047){logger[_0xc5eb('0x53')](_0x116047['message']);_0x5e7734({'ret':0x1});});}});}function handleTZQuery(_0x2d4425){logger[_0xc5eb('0x51')](_0x2d4425);return db[_0xc5eb('0x60')][_0xc5eb('0x61')](_0x2d4425)[_0xc5eb('0x58')](function(_0x5154b5){})[_0xc5eb('0x59')](function(_0x74a33e){logger[_0xc5eb('0x53')](_0x74a33e[_0xc5eb('0x54')]);});}function main(_0x5410df,_0x18b780,_0x49bb63,_0x245ddb){logger[_0xc5eb('0x51')](_0xc5eb('0x6d'),_0x5410df,JSON[_0xc5eb('0x6e')](_0x18b780));process['send'](_0xc5eb('0x6f'));var _0x1c9ff0=_0x18b780[_0xc5eb('0x70')];var _0x3c996c=_[_0xc5eb('0x71')](_0x1c9ff0);var _0x21b0d7=_0x18b780[_0xc5eb('0x72')];var _0x548bdd=path['join'](config[_0xc5eb('0x73')],_0xc5eb('0x74'),_0x21b0d7+_0xc5eb('0x75'));hasTZ=_[_0xc5eb('0x4c')](_0x1c9ff0)[_0xc5eb('0x76')](_0xc5eb('0x69'));var _0x17bfbf=_['keys'](_0x1c9ff0)[_0xc5eb('0x14')]();logger['info'](_0xc5eb('0x77'),_0x17bfbf);db[_0xc5eb('0x78')][_0xc5eb('0x18')]({'raw':!![],'attributes':['id',_0xc5eb('0x79')]})[_0xc5eb('0x1a')](function(_0x5e0a05){for(var _0xe03768=0x0;_0xe03768<_0x5e0a05[_0xc5eb('0x1b')];_0xe03768++){if(_0x5e0a05[_0xe03768][_0xc5eb('0x79')]in _0x1c9ff0){contactItemTypes[_0xc5eb('0x1c')](_0x5e0a05[_0xe03768]);delete _0x3c996c[_0x5e0a05[_0xe03768][_0xc5eb('0x79')]];hasAdditionalPhones=!![];}for(var _0x112a6c in _0x1c9ff0){if(_0x5e0a05[_0xe03768][_0xc5eb('0x79')]+_0xc5eb('0x7a')===_0x112a6c){phoneDescriptions[_0xc5eb('0x1c')]({'itemTypeId':_0x5e0a05[_0xe03768]['id'],'description':_0x112a6c});delete _0x3c996c[_0x112a6c];}}}if(hasAdditionalPhones)_0x3c996c[_0xc5eb('0x19')]='';var _0x4ee7d9=_[_0xc5eb('0x4c')](_0x3c996c)[_0xc5eb('0x14')]();logger['info'](_0xc5eb('0x77'),_0x4ee7d9);fs[_0xc5eb('0x7b')](_0x548bdd,_0x4ee7d9+'\x0a');Papa[_0xc5eb('0x7c')](fs['createReadStream'](_0x5410df),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3b0b44,_0x6bebd3){try{for(var _0x51c068=0x0,_0x352458=[];_0x51c068<_0x3b0b44[_0xc5eb('0x7d')][_0xc5eb('0x1b')];_0x51c068++){stats['rows']+=0x1;if(_0x3b0b44[_0xc5eb('0x56')][_0x51c068]){handleError(_0x3b0b44[_0xc5eb('0x7d')][_0x51c068],_0x3b0b44['errors'][_0x51c068]);}else{var _0x2d9c38=[];var _0x37b1e6=[];var _0x1bd26a={};for(var _0x2d7826 in _0x1c9ff0){let _0x301a45=contactItemTypes[_0xc5eb('0x7e')](_0x67a5e4=>_0x67a5e4['name']===_0x2d7826);let _0x2b578f=contactItemTypes[_0xc5eb('0x7e')](_0x527923=>_0x527923[_0xc5eb('0x79')]+'_description'===_0x2d7826);if(_[_0xc5eb('0x7f')](_0x301a45)&&_['isNil'](_0x2b578f)){if(_0x1c9ff0[_0xc5eb('0x80')](_0x2d7826)){if(_0x3b0b44[_0xc5eb('0x7d')][_0x51c068][_0x1c9ff0[_0x2d7826]]){var _0x410681=_[_0xc5eb('0x81')](_0x3b0b44[_0xc5eb('0x7d')][_0x51c068][_0x1c9ff0[_0x2d7826]]['replace'](/"/g,'\x27'));switch(_0x2d7826){case'scheduledat':var _0xfd6d54=moment(_0x410681,_0xc5eb('0xe'),!![]);if(_0xfd6d54[_0xc5eb('0x82')]()){_0x352458[_0xc5eb('0x1c')]('\x22'+_0x410681+'\x22');}else{_0x2d9c38['push'](_0xc5eb('0x83'));}break;case _0xc5eb('0x84'):var _0x3f5379=parseInt(_0x410681);_0x410681=_['isNaN'](_0x3f5379)||_0x3f5379<0x0||_0x3f5379>0x4?_0x245ddb?0x3:0x2:_0x3f5379;_0x352458[_0xc5eb('0x1c')]('\x22'+_0x410681+'\x22');break;case _0xc5eb('0x32'):var _0x41faaa=parseInt(_0x410681);if(_[_0xc5eb('0x85')](_0x41faaa)&&_[_0xc5eb('0x76')](_0x49bb63,_0x41faaa)){_0x352458['push']('\x22'+_0x41faaa+'\x22');}else{_0x2d9c38[_0xc5eb('0x1c')]('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x410681)){_0x352458[_0xc5eb('0x1c')]('\x22'+_0x410681+'\x22');}else{_0x2d9c38[_0xc5eb('0x1c')](_0xc5eb('0x86'));}break;case _0xc5eb('0x87'):var _0x3e4666=moment(_0x410681,'YYYY-MM-DD',!![]);if(_0x3e4666[_0xc5eb('0x82')]()){_0x352458[_0xc5eb('0x1c')]('\x22'+_0x410681+'\x22');}else{_0x2d9c38[_0xc5eb('0x1c')](_0xc5eb('0x88'));}break;case _0xc5eb('0x69'):var _0x1adc6a=shared['timezones'];var _0x354f39=_0x1adc6a[_0x410681];if(!_[_0xc5eb('0x7f')](_0x354f39)){var _0x57f7d5=_0x354f39['utcOffset'];_0x352458[_0xc5eb('0x1c')]('\x22'+_0x410681+'\x22');_0x352458['push']('\x22'+_0x57f7d5+'\x22');}break;default:_0x352458[_0xc5eb('0x1c')]('\x22'+_0x410681+'\x22');}}else{switch(_0x2d7826){case _0xc5eb('0x89'):case _0xc5eb('0x12'):_0x2d9c38[_0xc5eb('0x1c')](_0x2d7826+'\x20not\x20specified');break;default:_0x352458['push']('\x22\x22');}}}}else{var _0x39cc92='';if(!_[_0xc5eb('0x7f')](_0x301a45)){if(!_0x1bd26a['hasOwnProperty'](_0x301a45['id'])){if(!_[_0xc5eb('0x7f')](_0x3b0b44['data'][_0x51c068][_0x1c9ff0[_0x2d7826]])){var _0x410681=_[_0xc5eb('0x81')](_0x3b0b44[_0xc5eb('0x7d')][_0x51c068][_0x1c9ff0[_0x2d7826]][_0xc5eb('0x8a')](/"/g,'\x27'));var _0x564627=phoneDescriptions[_0xc5eb('0x7e')](_0x97cdcc=>_0x97cdcc[_0xc5eb('0x8b')]===_0x301a45['id']);if(!_[_0xc5eb('0x7f')](_0x564627)){var _0x1e4c6a=_[_0xc5eb('0x81')](_0x3b0b44[_0xc5eb('0x7d')][_0x51c068][_0x1c9ff0[_0x564627[_0xc5eb('0x8c')]]][_0xc5eb('0x8a')](/"/g,'\x27'));if(!_[_0xc5eb('0x7f')](_0x1e4c6a))_0x410681=_0x410681+'§'+_0x1e4c6a;}if(_0x39cc92=='')_0x39cc92=_0x410681;else _0x39cc92+='|'+_0x410681;}_0x37b1e6[_0xc5eb('0x1c')](_0x301a45['id']+':'+_0x39cc92);_0x1bd26a[_0x301a45['id']]=0x1;}}}}if(hasAdditionalPhones){_0x352458[_0xc5eb('0x1c')]('\x22'+_0x37b1e6[_0xc5eb('0x14')](';')+'\x22');}if(_0x2d9c38[_0xc5eb('0x1b')]){handleError(_0x3b0b44[_0xc5eb('0x7d')][_0x51c068],{'code':_0xc5eb('0x8d'),'message':_0x2d9c38[_0xc5eb('0x14')]()});}else{fs['appendFileSync'](_0x548bdd,_0x352458[_0xc5eb('0x14')]()+'\x0a');}_0x352458=[];}if(!(stats[_0xc5eb('0x8e')]%0xc8)){socket[_0xc5eb('0x8f')](_0xc5eb('0x90')+_0x21b0d7,stats);stats[_0xc5eb('0x56')]=[];}}if(stopped){logger[_0xc5eb('0x51')](_0xc5eb('0x91'));_0x6bebd3[_0xc5eb('0x92')]();}}catch(_0xe9255f){handleError(_0x3b0b44[_0xc5eb('0x7d')][_0x51c068],{'code':'SystemError','message':_0xe9255f['message']});logger[_0xc5eb('0x53')](_0xc5eb('0x93'),_0xe9255f[_0xc5eb('0x54')]);}},'complete':function(){try{var _0x372780=[];var _0x29183b=[];var _0x264f7b=_0xc5eb('0x35');if(_0x18b780[_0xc5eb('0x94')]&&_0x18b780[_0xc5eb('0x94')][_0xc5eb('0x1b')]){_0x264f7b=_0xc5eb('0x95')+_0x21b0d7;_0x372780['push']('CREATE\x20TABLE\x20'+_0x264f7b+_0xc5eb('0x96'));}tmp_campaigns=_0xc5eb('0x97')+_0x21b0d7;tmp_voice_queues=_0xc5eb('0x98')+_0x21b0d7;_0x29183b[_0xc5eb('0x1c')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0xc5eb('0x99'));_0x29183b[_0xc5eb('0x1c')](_0xc5eb('0x9a')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0xc5eb('0x9b')](_0x29183b,handleTZQuery)[_0xc5eb('0x1a')](function(_0x2dcc74){updateTzCampaigns(_0x18b780[_0xc5eb('0x3d')])[_0xc5eb('0x1a')](function(_0x52ac09){updateTzVoiceQueues(_0x18b780[_0xc5eb('0x3d')])['then'](function(_0x3c96d9){if(hasTZ)_0x4ee7d9=_0x4ee7d9['replace']('dialTimezone',_0xc5eb('0x9c'));var _0x2d78d6=util[_0xc5eb('0xf')](_0xc5eb('0x9d'),_0x548bdd,_0x264f7b,_0x4ee7d9,_0x18b780[_0xc5eb('0x3d')],_0x18b780[_0xc5eb('0x4d')]||null,NOW,NOW);if(_[_0xc5eb('0x7f')](_0x1c9ff0[_0xc5eb('0x30')])){_0x2d78d6+=',\x20scheduledAt\x20=\x20NOW()';}_0x372780[_0xc5eb('0x1c')](_0x2d78d6);if(_0x18b780[_0xc5eb('0x94')]&&_0x18b780['duplicates'][_0xc5eb('0x1b')]){_0x372780['push'](insertCmContact(_0x18b780['ListId'],_0x264f7b,_0x18b780['duplicates'],_0x1c9ff0));_0x372780[_0xc5eb('0x1c')](_0xc5eb('0x9e')+_0x264f7b+';');}BPromise[_0xc5eb('0x9b')](_0x372780,handleQuery)['then'](function(_0x109378){BPromise['all']([handleAdditionalPhones()])[_0xc5eb('0x1a')](function(){_0x372780=[];for(var _0x35b63a=0x0;_0x35b63a\x20\x20');}var _0x1b668d=path[_0xc5eb('0x14')](config[_0xc5eb('0x73')],_0xc5eb('0x74'),process[_0xc5eb('0xaa')][0x2]);if(!fs[_0xc5eb('0xab')](_0x1b668d)){throw new Error(_0xc5eb('0xac'));}var _0x35e960={};try{_0x35e960=JSON['parse'](process[_0xc5eb('0xaa')][0x3]);if(!_0x35e960['binding']){throw new Error(_0xc5eb('0xad'));}if(!_0x35e960[_0xc5eb('0x70')][_0xc5eb('0x12')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x35e960['binding'][_0xc5eb('0x89')]){throw new Error(_0xc5eb('0xae'));}var _0x48303e=0x0;if(_0x35e960[_0xc5eb('0x70')][_0xc5eb('0x32')]){_0x48303e=0x1;}if(!_0x35e960[_0xc5eb('0x3d')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x4f2419){throw new Error('body\x20id\x20mandatory');}var _0x4a7a10=[];try{_0x4a7a10=_[_0xc5eb('0xaf')](JSON[_0xc5eb('0x7c')](process[_0xc5eb('0xaa')][0x4]),'id');}catch(_0xd49c3b){logger[_0xc5eb('0x51')](_0xc5eb('0xb0'));}main(_0x1b668d,_0x35e960,_0x4a7a10,_0x48303e);}validate();process['on'](_0xc5eb('0xb1'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0xa245=['server/files/tmp','.csv','header','ContactItemType','name','_description','parse','createReadStream','data','rows','find','isNil','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','hasOwnProperty','replace','itemTypeId','description','appendFileSync','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','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','CompanyId','DROP\x20TABLE\x20','contactId','contactTypeId','VoiceQueueId','CampaignId','voice_queues_has_cm_blacklists','campaigns_has_cm_blacklists','finish','affectedRows','emit','unlink','complete','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','argv','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../config/environment','../../../config/environment/shared','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','findAll','AdditionalPhones','then','length','push','split','all','findOne','CmContactHasItem','update','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','cm_hopper','scheduledat','ListId','createdAt','recallme','fields','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','\x22always\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_contacts.id','cm_contacts.ListId','into','cm_hopper_black','fromQuery','ContactId','cm_contacts','cm_contacts.createdAt\x20=\x20?','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','UserId','.CmListId','cm_contacts.createdAt','updatedAt','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','concat','keys',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','group','Received\x20SIGINT','error','message','exit','errors','sequelize','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns_has_cm_lists.CmListId=','voice_queues.id','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','dialTimezone','utcOffset','set','offset','info','send','binding','socket_timestamp','root'];(function(_0x35c6e9,_0x222582){var _0x30a040=function(_0x1743f1){while(--_0x1743f1){_0x35c6e9['push'](_0x35c6e9['shift']());}};_0x30a040(++_0x222582);}(_0xa245,0xff));var _0x5a24=function(_0x2b9e50,_0x13df6f){_0x2b9e50=_0x2b9e50-0x0;var _0x5ba4c7=_0xa245[_0x2b9e50];return _0x5ba4c7;};'use strict';var fs=require('fs');var path=require(_0x5a24('0x0'));var _=require(_0x5a24('0x1'));var Papa=require(_0x5a24('0x2'));var util=require(_0x5a24('0x3'));var BPromise=require(_0x5a24('0x4'));var moment=require(_0x5a24('0x5'));var squel=require(_0x5a24('0x6'));var Redis=require(_0x5a24('0x7'));var db=require('../../../mysqldb')['db'];var config=require(_0x5a24('0x8'));var shared=require(_0x5a24('0x9'));var logger=require('../../../config/logger')('import');config[_0x5a24('0xa')]=_[_0x5a24('0xb')](config[_0x5a24('0xa')],{'host':_0x5a24('0xc'),'port':0x18eb});var socket=require(_0x5a24('0xd'))(new Redis(config[_0x5a24('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x5a24('0xe')](_0x5a24('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x5a24('0xe')](_0x5a24('0xf'));function isEmail(_0xadea58){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))*$/[_0x5a24('0x10')](_0xadea58);}function selectNotIn(_0x23931f,_0x37725a,_0xf972d9,_0x21f0fd,_0x50aa76){return squel[_0x5a24('0x11')]()[_0x5a24('0x12')](_0x5a24('0x13'))[_0x5a24('0x14')](_0x21f0fd)[_0x5a24('0x15')](_0x37725a,null,_0x37725a+_0x5a24('0x16')+_0x21f0fd+'.'+_0xf972d9)[_0x5a24('0x17')](_0x21f0fd+'.'+_0xf972d9+_0x5a24('0x18')+_0x23931f+'.'+_0xf972d9)[_0x5a24('0x17')](_0x37725a+_0x5a24('0x19')+_0x50aa76[_0x5a24('0x15')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x42e60b,_0xdcba34){promisesAdditionalPhones=[];return db['CmContact'][_0x5a24('0x1a')]({'raw':!![],'attributes':['id',_0x5a24('0x1b')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x5a24('0x1c')](function(_0x17185a){if(_0x17185a!==null){var _0x1c03ae=[];for(var _0x22c5ed=0x0;_0x22c5ed<_0x17185a[_0x5a24('0x1d')];_0x22c5ed++){var _0x10c981=_0x17185a[_0x22c5ed];_0x1c03ae[_0x5a24('0x1e')](insertAdditionalPhones(_0x10c981));}}Promise['all'](_0x1c03ae)['then'](function(){_0x42e60b({'val':0x1});});});});}function insertAdditionalPhones(_0x27dd41){return new Promise(function(_0x5ce746,_0x4dfc7a){var _0x462b7d=_0x27dd41[_0x5a24('0x1b')];var _0x15d617=_0x462b7d[_0x5a24('0x1f')](';');var _0x44b6b0=[];orderBy=0x0;for(var _0x2f0888=0x0;_0x2f0888<_0x15d617['length'];_0x2f0888++){_0x44b6b0[_0x5a24('0x1e')](splitAdditionalPhone(_0x27dd41['id'],_0x15d617[_0x2f0888]));}Promise[_0x5a24('0x20')](_0x44b6b0)[_0x5a24('0x1c')](function(){_0x5ce746({'val':_0x15d617[_0x5a24('0x1d')]});});});}function splitAdditionalPhone(_0x113043,_0x2167f0){return new Promise(function(_0x3d48b8,_0x484d78){var _0x58f317=_0x2167f0[_0x5a24('0x1f')](':');var _0x232030=_0x58f317[0x0];var _0x1dfc3b=_0x58f317[0x1];if(!_['isNil'](_0x1dfc3b)){var _0x3a9f2f=_0x1dfc3b[_0x5a24('0x1f')]('|');var _0x186805=[];for(var _0x47873f=0x0;_0x47873f<_0x3a9f2f[_0x5a24('0x1d')];_0x47873f++){if(_0x3a9f2f[_0x47873f]!==''){var _0x3afaf0=_['filter'](promisesAdditionalPhones,{'contactId':_0x113043,'phone':_0x3a9f2f[_0x47873f]});if(_0x3afaf0[_0x5a24('0x1d')]==0x0){orderBy++;promisesAdditionalPhones[_0x5a24('0x1e')]({'contactId':_0x113043,'contactTypeId':_0x232030,'phone':_0x3a9f2f[_0x47873f],'orderBy':orderBy});}}}_0x3d48b8({'ok':0x1});}else _0x3d48b8({'res':0x0});});}function createAdditionalPhone(_0x6104ed,_0x7a7700,_0x5877b9,_0x193998){var _0x5195c7='';var _0x1e35c4='';var _0x28048d=_0x5877b9[_0x5a24('0x1f')]('§');_0x5195c7=_0x28048d[0x0];if(_0x28048d[_0x5a24('0x1d')]==0x2)_0x1e35c4=_0x28048d[0x1];return new Promise(function(_0x4155af,_0x407ed1){return db['CmContactHasItem'][_0x5a24('0x21')]({'where':{'CmContactId':_0x6104ed,'item':_0x5195c7}})[_0x5a24('0x1c')](function(_0x388fe1){if(_0x388fe1){return db[_0x5a24('0x22')][_0x5a24('0x23')]({'ItemTypeId':_0x7a7700,'description':_0x1e35c4,'OrderBy':_0x193998},{'where':{'CmContactId':_0x6104ed,'item':_0x5195c7}})[_0x5a24('0x1c')](function(_0x5ca285){_0x4155af({'res':'updated'});});}else{return db[_0x5a24('0x22')][_0x5a24('0x24')]({'CmContactId':_0x6104ed,'item':_0x5195c7,'description':_0x1e35c4,'ItemTypeId':_0x7a7700,'OrderBy':_0x193998,'ItemClass':_0x5a24('0x25')})[_0x5a24('0x1c')](function(_0x1408fb){_0x4155af({'res':_0x5a24('0x26')});});}});});}function insertCmHopper(_0x35732a,_0x3286a5,_0x19ad57,_0x2e9cb8,_0xe30972){var _0x35bcf6=[_0x5a24('0x27'),_0x5a24('0x28'),'cm_contacts.id','cm_contacts.ListId',_0x3286a5+'.'+_0x2e9cb8,'cm_contacts.createdAt',_0x5a24('0x29'),_0x5a24('0x2a'),_0x5a24('0x2b'),'\x22'+_0xe30972+'\x22'];return squel[_0x5a24('0x2c')]()['into'](_0x5a24('0x2d'))['fromQuery']([_0x5a24('0x13'),_0x5a24('0x2e'),'ContactId',_0x5a24('0x2f'),_0x2e9cb8,_0x5a24('0x30'),'updatedAt','priority','UserId',_0x5a24('0x31')],squel[_0x5a24('0x11')]()[_0x5a24('0x32')](_0x35bcf6)[_0x5a24('0x14')](_0x3286a5)[_0x5a24('0x15')]('cm_contacts',null,_0x5a24('0x33')+_0x3286a5+'.CmListId')[_0x5a24('0x15')](_0x19ad57,null,_0x19ad57+_0x5a24('0x16')+_0x3286a5+'.'+_0x2e9cb8)[_0x5a24('0x17')](_0x3286a5+_0x5a24('0x34'),_0x35732a)[_0x5a24('0x17')]('cm_contacts.createdAt\x20=\x20?',NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x3286a5,_0x19ad57,_0x2e9cb8,_0x5a24('0x2d'),[_0x5a24('0x35'),'\x22onlyIfOpen\x22']))['where'](_0x5a24('0x36'),selectNotIn(_0x3286a5,_0x19ad57,_0x2e9cb8,_0x5a24('0x2d'),[_0x5a24('0x35')])))[_0x5a24('0x37')]();}function insertCmHopperBlack(_0x2007b5,_0x4c3acb,_0x1b4280,_0x105bc6){var _0x1e2b12=['cm_contacts.phone',_0x5a24('0x38'),_0x5a24('0x39'),_0x4c3acb+'.'+_0x105bc6,'cm_contacts.createdAt',_0x5a24('0x29')];return squel['insert']()[_0x5a24('0x3a')](_0x5a24('0x3b'))[_0x5a24('0x3c')](['phone',_0x5a24('0x3d'),_0x5a24('0x2f'),_0x105bc6,'createdAt','updatedAt'],squel[_0x5a24('0x11')]()['fields'](_0x1e2b12)[_0x5a24('0x14')](_0x4c3acb)[_0x5a24('0x15')](_0x5a24('0x3e'),null,_0x5a24('0x33')+_0x4c3acb+'.CmListId')[_0x5a24('0x15')](_0x1b4280,null,_0x1b4280+'.id\x20=\x20'+_0x4c3acb+'.'+_0x105bc6)['where'](_0x4c3acb+'.CmListId\x20=\x20?',_0x2007b5)[_0x5a24('0x17')](_0x5a24('0x3f'),NOW)['where'](_0x5a24('0x36'),squel[_0x5a24('0x11')]()[_0x5a24('0x12')]('phone')['from']('cm_hopper_black')[_0x5a24('0x17')](_0x5a24('0x40'),_0x2007b5)['where'](_0x105bc6+_0x5a24('0x18')+_0x4c3acb+'.'+_0x105bc6)))['toString']();}function insertTzCmHopper(_0x336e77,_0x29cbad,_0x5b6dbf,_0x2be118,_0x5d9f2c,_0x233ef5){var _0x53d713=[_0x5a24('0x27'),_0x5a24('0x41')+_0x233ef5+_0x5a24('0x42'),'cm_contacts.id',_0x5a24('0x39'),_0x29cbad+'.'+_0x2be118,'cm_contacts.createdAt','cm_contacts.updatedAt',_0x5a24('0x2a'),_0x5a24('0x2b'),'\x22'+_0x5d9f2c+'\x22'];var _0x19fc0f=squel[_0x5a24('0x2c')]()[_0x5a24('0x3a')](_0x5a24('0x2d'))[_0x5a24('0x3c')]([_0x5a24('0x13'),'scheduledat',_0x5a24('0x3d'),'ListId',_0x2be118,'createdAt','updatedAt','priority',_0x5a24('0x43'),_0x5a24('0x31')],squel[_0x5a24('0x11')]()[_0x5a24('0x32')](_0x53d713)[_0x5a24('0x14')](_0x29cbad)[_0x5a24('0x15')](_0x5a24('0x3e'),null,_0x5a24('0x33')+_0x29cbad+_0x5a24('0x44'))[_0x5a24('0x15')](_0x5b6dbf,null,_0x5b6dbf+'.id\x20=\x20'+_0x29cbad+'.'+_0x2be118)[_0x5a24('0x15')](_0x233ef5,null,_0x233ef5+_0x5a24('0x16')+_0x29cbad+'.'+_0x2be118)[_0x5a24('0x17')](_0x29cbad+'.CmListId\x20=\x20?',_0x336e77)[_0x5a24('0x17')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x5a24('0x17')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x29cbad,_0x5b6dbf,_0x2be118,_0x5a24('0x2d'),[_0x5a24('0x35'),'\x22onlyIfOpen\x22']))['where'](_0x5a24('0x36'),selectNotIn(_0x29cbad,_0x5b6dbf,_0x2be118,_0x5a24('0x2d'),['\x22always\x22'])))[_0x5a24('0x37')]();return _0x19fc0f;}function insertTzCmHopperBlack(_0x2aa797,_0x19ed34,_0xd6e124,_0x18ad54){var _0x3c2883=[_0x5a24('0x27'),_0x5a24('0x38'),_0x5a24('0x39'),_0x19ed34+'.'+_0x18ad54,_0x5a24('0x45'),_0x5a24('0x29')];return squel['insert']()['into']('cm_hopper_black')['fromQuery']([_0x5a24('0x13'),_0x5a24('0x3d'),_0x5a24('0x2f'),_0x18ad54,_0x5a24('0x30'),_0x5a24('0x46')],squel['select']()[_0x5a24('0x32')](_0x3c2883)[_0x5a24('0x14')](_0x19ed34)['join'](_0x5a24('0x3e'),null,_0x5a24('0x33')+_0x19ed34+_0x5a24('0x44'))[_0x5a24('0x15')](_0xd6e124,null,_0xd6e124+_0x5a24('0x16')+_0x19ed34+'.'+_0x18ad54)[_0x5a24('0x17')](_0x19ed34+_0x5a24('0x34'),_0x2aa797)[_0x5a24('0x17')](_0x5a24('0x3f'),NOW)['where'](_0x5a24('0x36'),squel[_0x5a24('0x11')]()[_0x5a24('0x12')](_0x5a24('0x13'))[_0x5a24('0x14')](_0x5a24('0x3b'))[_0x5a24('0x17')](_0x5a24('0x40'),_0x2aa797)['where'](_0x18ad54+_0x5a24('0x18')+_0x19ed34+'.'+_0x18ad54)))['toString']();}function insertCmHopperAdditionalPhones(_0x40ef13){var _0x3bbf09=[_0x5a24('0x47'),_0x5a24('0x48'),'cm_contact_has_items.OrderBy',_0x5a24('0x49'),_0x5a24('0x4a')];return squel['insert']()['into']('cm_hopper_additional_phones')[_0x5a24('0x3c')]([_0x5a24('0x4b'),_0x5a24('0x13'),_0x5a24('0x4c'),'createdAt',_0x5a24('0x46')],squel[_0x5a24('0x11')]()[_0x5a24('0x32')](_0x3bbf09)['from']('cm_hopper')[_0x5a24('0x15')](_0x5a24('0x3e'),null,_0x5a24('0x4d'))[_0x5a24('0x15')](_0x5a24('0x4e'),null,_0x5a24('0x4f'))[_0x5a24('0x17')]('cm_hopper.ListId\x20=\x20?',_0x40ef13)['where'](_0x5a24('0x3f'),NOW))[_0x5a24('0x37')]();}function insertCmContact(_0x481496,_0x4c2e3b,_0x767ce,_0x42d216){var _0x4ac593=_[_0x5a24('0x50')](_[_0x5a24('0x51')](_0x42d216),[_0x5a24('0x2f'),'CompanyId',_0x5a24('0x30'),_0x5a24('0x46')]);return squel[_0x5a24('0x2c')]()[_0x5a24('0x3a')]('cm_contacts')[_0x5a24('0x3c')](_0x4ac593,squel[_0x5a24('0x11')]()['fields'](_0x4ac593)[_0x5a24('0x14')](_0x4c2e3b)[_0x5a24('0x17')]('('+_0x767ce[_0x5a24('0x15')](',')+_0x5a24('0x52'),squel[_0x5a24('0x11')]()['fields'](_0x767ce)[_0x5a24('0x14')]('cm_contacts')[_0x5a24('0x17')](_0x5a24('0x40'),_0x481496)[_0x5a24('0x17')](_0x5a24('0x53')))[_0x5a24('0x17')](_0x5a24('0x54'),squel[_0x5a24('0x11')]()[_0x5a24('0x12')]('MIN(id)',_0x5a24('0x55'))['from'](_0x4c2e3b)[_0x5a24('0x56')](_0x767ce[_0x5a24('0x15')](','))))['toString']();}function handleStop(){logger['info'](_0x5a24('0x57'));stopped=!![];}function handleUncaughtException(_0x124433){logger[_0x5a24('0x58')](_0x124433[_0x5a24('0x59')]);process[_0x5a24('0x5a')](0x1);}function handleError(_0x255ab6,_0x3ae4cb){stats[_0x5a24('0x5b')]['push']({'name':_0x3ae4cb['code'],'message':_0x3ae4cb[_0x5a24('0x59')],'row':_0x255ab6});}function handleQuery(_0x476f70){logger['info'](_0x476f70);return db[_0x5a24('0x5c')][_0x5a24('0x5d')](_0x476f70)[_0x5a24('0x5e')](function(_0x541a7c){results[_0x5a24('0x1e')](_0x541a7c);})[_0x5a24('0x5f')](function(_0x586a3d){logger[_0x5a24('0x58')](_0x586a3d[_0x5a24('0x59')]);});}function updateTzCampaigns(_0x59119f){return new Promise(function(_0x41b230,_0x1e861e){var _0x33ab85=squel['select']()[_0x5a24('0x32')]([_0x5a24('0x60'),_0x5a24('0x61')])[_0x5a24('0x14')](_0x5a24('0x62'))[_0x5a24('0x15')](_0x5a24('0x63'),null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')[_0x5a24('0x17')](_0x5a24('0x64')+_0x59119f);db['sequelize'][_0x5a24('0x5d')](_0x33ab85[_0x5a24('0x37')]())['spread'](function(_0x237f44){var _0x2b7afd=[];for(var _0x410467=0x0;_0x410467<_0x237f44[_0x5a24('0x1d')];_0x410467++){_0x2b7afd[_0x5a24('0x1e')](getTimezoneData(_0x237f44[_0x410467],tmp_campaigns));}BPromise[_0x5a24('0x20')](_0x2b7afd)[_0x5a24('0x1c')](function(){_0x41b230({'val':0x1});});})[_0x5a24('0x5f')](function(_0x19943d){logger[_0x5a24('0x58')](_0x19943d['message']);_0x41b230({'val':0x0});});});}function updateTzVoiceQueues(_0x88a9ae){return new Promise(function(_0x4b5d6b,_0x2471ae){var _0x2b4b41=squel[_0x5a24('0x11')]()[_0x5a24('0x32')]([_0x5a24('0x65'),'voice_queues.dialTimezone'])['from'](_0x5a24('0x66'))[_0x5a24('0x15')](_0x5a24('0x67'),null,_0x5a24('0x68'))['where'](_0x5a24('0x69')+_0x88a9ae);db[_0x5a24('0x5c')][_0x5a24('0x5d')](_0x2b4b41[_0x5a24('0x37')]())['spread'](function(_0x1b82e6){var _0x1530d0=[];for(var _0x174176=0x0;_0x174176<_0x1b82e6['length'];_0x174176++){_0x1530d0[_0x5a24('0x1e')](getTimezoneData(_0x1b82e6[_0x174176],tmp_voice_queues));}BPromise[_0x5a24('0x20')](_0x1530d0)[_0x5a24('0x1c')](function(){_0x4b5d6b({'val':0x1});});})[_0x5a24('0x5f')](function(_0x4d402e){logger[_0x5a24('0x58')](_0x4d402e[_0x5a24('0x59')]);_0x4b5d6b({'val':0x0});});});}function getTimezoneData(_0xec39c6,_0x380796){return new Promise(function(_0x29bd19,_0x10723a){var _0x297766=shared['timezones'];var _0x4b1103=_0x297766[_0xec39c6[_0x5a24('0x6a')]];if(_['isNil'](_0x4b1103)){_0x29bd19({'ret':0x1});}else{var _0x38878c=_0x4b1103[_0x5a24('0x6b')];var _0x16fd9f=squel[_0x5a24('0x2c')]()['into'](_0x380796)[_0x5a24('0x6c')]('id',_0xec39c6['id'])[_0x5a24('0x6c')](_0x5a24('0x6d'),_0x38878c)['set'](_0x5a24('0x6a'),_0xec39c6[_0x5a24('0x6a')])['toString']();return db[_0x5a24('0x5c')][_0x5a24('0x5d')](_0x16fd9f)[_0x5a24('0x5e')](function(_0x2f67b8){_0x29bd19({'ret':0x1});})['catch'](function(_0xb5491a){logger[_0x5a24('0x58')](_0xb5491a[_0x5a24('0x59')]);_0x10723a({'ret':0x1});});}});}function handleTZQuery(_0x394017){logger[_0x5a24('0x6e')](_0x394017);return db[_0x5a24('0x5c')][_0x5a24('0x5d')](_0x394017)[_0x5a24('0x5e')](function(_0x4b38b5){})[_0x5a24('0x5f')](function(_0x536434){logger[_0x5a24('0x58')](_0x536434['message']);});}function main(_0x3404ef,_0x24d78a,_0xfc8d23,_0xef10e7){logger[_0x5a24('0x6e')]('main',_0x3404ef,JSON['stringify'](_0x24d78a));process[_0x5a24('0x6f')]('start');var _0x37d3a4=_0x24d78a[_0x5a24('0x70')];var _0x504542=_['clone'](_0x37d3a4);var _0x2ac921=_0x24d78a[_0x5a24('0x71')];var _0x484bf0=path[_0x5a24('0x15')](config[_0x5a24('0x72')],_0x5a24('0x73'),_0x2ac921+_0x5a24('0x74'));hasTZ=_['keys'](_0x37d3a4)['includes']('dialTimezone');var _0x34ee7e=_[_0x5a24('0x51')](_0x37d3a4)[_0x5a24('0x15')]();logger[_0x5a24('0x6e')](_0x5a24('0x75'),_0x34ee7e);db[_0x5a24('0x76')][_0x5a24('0x1a')]({'raw':!![],'attributes':['id',_0x5a24('0x77')]})[_0x5a24('0x1c')](function(_0x4229d8){for(var _0x7a114=0x0;_0x7a114<_0x4229d8['length'];_0x7a114++){if(_0x4229d8[_0x7a114]['name']in _0x37d3a4){contactItemTypes[_0x5a24('0x1e')](_0x4229d8[_0x7a114]);delete _0x504542[_0x4229d8[_0x7a114][_0x5a24('0x77')]];hasAdditionalPhones=!![];}for(var _0x304d57 in _0x37d3a4){if(_0x4229d8[_0x7a114]['name']+_0x5a24('0x78')===_0x304d57){phoneDescriptions[_0x5a24('0x1e')]({'itemTypeId':_0x4229d8[_0x7a114]['id'],'description':_0x304d57});delete _0x504542[_0x304d57];}}}if(hasAdditionalPhones)_0x504542[_0x5a24('0x1b')]='';var _0x14575c=_[_0x5a24('0x51')](_0x504542)[_0x5a24('0x15')]();logger[_0x5a24('0x6e')](_0x5a24('0x75'),_0x14575c);fs['writeFileSync'](_0x484bf0,_0x14575c+'\x0a');Papa[_0x5a24('0x79')](fs[_0x5a24('0x7a')](_0x3404ef),{'header':!![],'skipEmptyLines':!![],'step':function(_0x225ad4,_0x1cc30c){try{for(var _0x5fcc74=0x0,_0x492829=[];_0x5fcc74<_0x225ad4[_0x5a24('0x7b')][_0x5a24('0x1d')];_0x5fcc74++){stats[_0x5a24('0x7c')]+=0x1;if(_0x225ad4[_0x5a24('0x5b')][_0x5fcc74]){handleError(_0x225ad4[_0x5a24('0x7b')][_0x5fcc74],_0x225ad4[_0x5a24('0x5b')][_0x5fcc74]);}else{var _0x2b28e3=[];var _0x35e839=[];var _0x171bc4={};for(var _0x4fd47f in _0x37d3a4){let _0x3243c9=contactItemTypes[_0x5a24('0x7d')](_0x186795=>_0x186795[_0x5a24('0x77')]===_0x4fd47f);let _0x691dc2=contactItemTypes[_0x5a24('0x7d')](_0x36ae9c=>_0x36ae9c['name']+'_description'===_0x4fd47f);if(_[_0x5a24('0x7e')](_0x3243c9)&&_['isNil'](_0x691dc2)){if(_0x37d3a4['hasOwnProperty'](_0x4fd47f)){if(_0x225ad4['data'][_0x5fcc74][_0x37d3a4[_0x4fd47f]]){var _0x1b01c7=_[_0x5a24('0x7f')](_0x225ad4[_0x5a24('0x7b')][_0x5fcc74][_0x37d3a4[_0x4fd47f]]['replace'](/"/g,'\x27'));switch(_0x4fd47f){case'scheduledat':var _0x51c218=moment(_0x1b01c7,_0x5a24('0xf'),!![]);if(_0x51c218[_0x5a24('0x80')]()){_0x492829[_0x5a24('0x1e')]('\x22'+_0x1b01c7+'\x22');}else{_0x2b28e3['push'](_0x5a24('0x81'));}break;case _0x5a24('0x82'):var _0x11f970=parseInt(_0x1b01c7);_0x1b01c7=_[_0x5a24('0x83')](_0x11f970)||_0x11f970<0x0||_0x11f970>0x4?_0xef10e7?0x3:0x2:_0x11f970;_0x492829['push']('\x22'+_0x1b01c7+'\x22');break;case _0x5a24('0x43'):var _0x28717b=parseInt(_0x1b01c7);if(_['isNumber'](_0x28717b)&&_[_0x5a24('0x84')](_0xfc8d23,_0x28717b)){_0x492829[_0x5a24('0x1e')]('\x22'+_0x28717b+'\x22');}else{_0x2b28e3[_0x5a24('0x1e')](_0x5a24('0x85'));}break;case _0x5a24('0x86'):if(isEmail(_0x1b01c7)){_0x492829[_0x5a24('0x1e')]('\x22'+_0x1b01c7+'\x22');}else{_0x2b28e3[_0x5a24('0x1e')](_0x5a24('0x87'));}break;case _0x5a24('0x88'):var _0x16969d=moment(_0x1b01c7,_0x5a24('0x89'),!![]);if(_0x16969d['isValid']()){_0x492829['push']('\x22'+_0x1b01c7+'\x22');}else{_0x2b28e3['push'](_0x5a24('0x8a'));}break;case'dialTimezone':var _0x1d2799=shared['timezones'];var _0x4125a5=_0x1d2799[_0x1b01c7];if(!_[_0x5a24('0x7e')](_0x4125a5)){var _0xa19e99=_0x4125a5['utcOffset'];_0x492829[_0x5a24('0x1e')]('\x22'+_0x1b01c7+'\x22');_0x492829[_0x5a24('0x1e')]('\x22'+_0xa19e99+'\x22');}break;default:_0x492829[_0x5a24('0x1e')]('\x22'+_0x1b01c7+'\x22');}}else{switch(_0x4fd47f){case _0x5a24('0x8b'):case _0x5a24('0x13'):_0x2b28e3[_0x5a24('0x1e')](_0x4fd47f+_0x5a24('0x8c'));break;default:_0x492829[_0x5a24('0x1e')]('\x22\x22');}}}}else{var _0x59104a='';if(!_['isNil'](_0x3243c9)){if(!_0x171bc4[_0x5a24('0x8d')](_0x3243c9['id'])){if(!_['isNil'](_0x225ad4[_0x5a24('0x7b')][_0x5fcc74][_0x37d3a4[_0x4fd47f]])){var _0x1b01c7=_[_0x5a24('0x7f')](_0x225ad4[_0x5a24('0x7b')][_0x5fcc74][_0x37d3a4[_0x4fd47f]][_0x5a24('0x8e')](/"/g,'\x27'));var _0x2d1a4e=phoneDescriptions[_0x5a24('0x7d')](_0x7001cc=>_0x7001cc[_0x5a24('0x8f')]===_0x3243c9['id']);if(!_[_0x5a24('0x7e')](_0x2d1a4e)){var _0x474295=_['trim'](_0x225ad4[_0x5a24('0x7b')][_0x5fcc74][_0x37d3a4[_0x2d1a4e[_0x5a24('0x90')]]][_0x5a24('0x8e')](/"/g,'\x27'));if(!_[_0x5a24('0x7e')](_0x474295))_0x1b01c7=_0x1b01c7+'§'+_0x474295;}if(_0x59104a=='')_0x59104a=_0x1b01c7;else _0x59104a+='|'+_0x1b01c7;}_0x35e839[_0x5a24('0x1e')](_0x3243c9['id']+':'+_0x59104a);_0x171bc4[_0x3243c9['id']]=0x1;}}}}if(hasAdditionalPhones){_0x492829['push']('\x22'+_0x35e839[_0x5a24('0x15')](';')+'\x22');}if(_0x2b28e3[_0x5a24('0x1d')]){handleError(_0x225ad4[_0x5a24('0x7b')][_0x5fcc74],{'code':'SystemRow','message':_0x2b28e3[_0x5a24('0x15')]()});}else{fs[_0x5a24('0x91')](_0x484bf0,_0x492829[_0x5a24('0x15')]()+'\x0a');}_0x492829=[];}if(!(stats[_0x5a24('0x7c')]%0xc8)){socket['emit'](_0x5a24('0x92')+_0x2ac921,stats);stats['errors']=[];}}if(stopped){logger[_0x5a24('0x6e')](_0x5a24('0x93'));_0x1cc30c[_0x5a24('0x94')]();}}catch(_0x491166){handleError(_0x225ad4[_0x5a24('0x7b')][_0x5fcc74],{'code':_0x5a24('0x95'),'message':_0x491166[_0x5a24('0x59')]});logger[_0x5a24('0x58')](_0x5a24('0x96'),_0x491166['message']);}},'complete':function(){try{var _0x30725=[];var _0x92c815=[];var _0x479d2c='cm_contacts';if(_0x24d78a[_0x5a24('0x97')]&&_0x24d78a['duplicates'][_0x5a24('0x1d')]){_0x479d2c=_0x5a24('0x98')+_0x2ac921;_0x30725[_0x5a24('0x1e')](_0x5a24('0x99')+_0x479d2c+_0x5a24('0x9a'));}tmp_campaigns=_0x5a24('0x9b')+_0x2ac921;tmp_voice_queues=_0x5a24('0x9c')+_0x2ac921;_0x92c815[_0x5a24('0x1e')](_0x5a24('0x99')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x92c815['push'](_0x5a24('0x99')+tmp_voice_queues+_0x5a24('0x9d'));BPromise[_0x5a24('0x9e')](_0x92c815,handleTZQuery)[_0x5a24('0x1c')](function(_0x53b5e8){updateTzCampaigns(_0x24d78a['ListId'])[_0x5a24('0x1c')](function(_0x299a05){updateTzVoiceQueues(_0x24d78a[_0x5a24('0x2f')])[_0x5a24('0x1c')](function(_0x2d6609){if(hasTZ)_0x14575c=_0x14575c[_0x5a24('0x8e')](_0x5a24('0x6a'),_0x5a24('0x9f'));var _0x1cf894=util[_0x5a24('0xe')](_0x5a24('0xa0'),_0x484bf0,_0x479d2c,_0x14575c,_0x24d78a[_0x5a24('0x2f')],_0x24d78a[_0x5a24('0xa1')]||null,NOW,NOW);if(_[_0x5a24('0x7e')](_0x37d3a4[_0x5a24('0x2e')])){_0x1cf894+=',\x20scheduledAt\x20=\x20NOW()';}_0x30725['push'](_0x1cf894);if(_0x24d78a[_0x5a24('0x97')]&&_0x24d78a[_0x5a24('0x97')]['length']){_0x30725['push'](insertCmContact(_0x24d78a[_0x5a24('0x2f')],_0x479d2c,_0x24d78a[_0x5a24('0x97')],_0x37d3a4));_0x30725[_0x5a24('0x1e')](_0x5a24('0xa2')+_0x479d2c+';');}BPromise['each'](_0x30725,handleQuery)['then'](function(_0x82f4b8){BPromise[_0x5a24('0x20')]([handleAdditionalPhones()])[_0x5a24('0x1c')](function(){_0x30725=[];for(var _0x17b96c=0x0;_0x17b96c_0x4dd5c5[_0x778e('0x6a')]===_0x37bb14);let _0x4db150=contactItemTypes['find'](_0x107ce7=>_0x107ce7['name']+_0x778e('0x6b')===_0x37bb14);if(_[_0x778e('0x19')](_0x3708cb)&&_[_0x778e('0x19')](_0x4db150)){if(_0x8fb312[_0x778e('0x72')](_0x37bb14)){if(_0x35541e[_0x778e('0x70')][_0x49a7ab][_0x8fb312[_0x37bb14]]){var _0x185387=_[_0x778e('0x73')](_0x35541e['data'][_0x49a7ab][_0x8fb312[_0x37bb14]][_0x778e('0x74')](/"/g,'\x27'));switch(_0x37bb14){case _0x778e('0x2f'):var _0x16beaa=moment(_0x185387,_0x778e('0xc'),!![]);if(_0x16beaa[_0x778e('0x75')]()){_0xd841b6[_0x778e('0x1b')]('\x22'+_0x185387+'\x22');}else{_0x28c352[_0x778e('0x1b')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x5ec3dc=parseInt(_0x185387);_0x185387=_['isNaN'](_0x5ec3dc)||_0x5ec3dc<0x0||_0x5ec3dc>0x4?_0x3b8699?0x3:0x2:_0x5ec3dc;_0xd841b6[_0x778e('0x1b')]('\x22'+_0x185387+'\x22');break;case'UserId':var _0x4380f0=parseInt(_0x185387);if(_[_0x778e('0x76')](_0x4380f0)&&_['includes'](_0x54bd39,_0x4380f0)){_0xd841b6[_0x778e('0x1b')]('\x22'+_0x4380f0+'\x22');}else{_0x28c352[_0x778e('0x1b')](_0x778e('0x77'));}break;case _0x778e('0x78'):if(isEmail(_0x185387)){_0xd841b6[_0x778e('0x1b')]('\x22'+_0x185387+'\x22');}else{_0x28c352[_0x778e('0x1b')](_0x778e('0x79'));}break;case _0x778e('0x7a'):var _0x5940d8=moment(_0x185387,_0x778e('0x7b'),!![]);if(_0x5940d8[_0x778e('0x75')]()){_0xd841b6[_0x778e('0x1b')]('\x22'+_0x185387+'\x22');}else{_0x28c352[_0x778e('0x1b')](_0x778e('0x7c'));}break;default:_0xd841b6[_0x778e('0x1b')]('\x22'+_0x185387+'\x22');}}else{switch(_0x37bb14){case _0x778e('0x7d'):case'phone':_0x28c352[_0x778e('0x1b')](_0x37bb14+_0x778e('0x7e'));break;default:_0xd841b6[_0x778e('0x1b')]('\x22\x22');}}}}else{var _0xbb8204='';if(!_['isNil'](_0x3708cb)){if(!_0x4d9850[_0x778e('0x72')](_0x3708cb['id'])){for(var _0x28249a=0x0;_0x28249a<_0x8fb312[_0x37bb14][_0x778e('0x18')];_0x28249a++){var _0x185387=_[_0x778e('0x73')](_0x35541e[_0x778e('0x70')][_0x49a7ab][_0x8fb312[_0x37bb14][_0x28249a]][_0x778e('0x74')](/"/g,'\x27'));var _0x29cb7f=phoneDescriptions[_0x778e('0x71')](_0x4a6798=>_0x4a6798[_0x778e('0x7f')]===_0x3708cb['id']);if(!_[_0x778e('0x19')](_0x29cb7f)){var _0x5ee6e7=_['trim'](_0x35541e[_0x778e('0x70')][_0x49a7ab][_0x8fb312[_0x29cb7f[_0x778e('0x80')]][0x0]][_0x778e('0x74')](/"/g,'\x27'));if(!_[_0x778e('0x19')](_0x5ee6e7))_0x185387=_0x185387+'§'+_0x5ee6e7;}if(_0xbb8204=='')_0xbb8204=_0x185387;else _0xbb8204+='|'+_0x185387;}_0x23c383['push'](_0x3708cb['id']+':'+_0xbb8204);_0x4d9850[_0x3708cb['id']]=0x1;}}}}if(hasAdditionalPhones){_0xd841b6[_0x778e('0x1b')]('\x22'+_0x23c383[_0x778e('0x12')](';')+'\x22');}if(_0x28c352['length']){handleError(_0x35541e['data'][_0x49a7ab],{'code':_0x778e('0x81'),'message':_0x28c352[_0x778e('0x12')]()});}else{fs[_0x778e('0x82')](_0x10b556,_0xd841b6['join']()+'\x0a');}_0xd841b6=[];}if(!(stats[_0x778e('0x83')]%0xc8)){socket[_0x778e('0x84')](_0x778e('0x85')+_0x30b7f8,stats);stats['errors']=[];}}if(stopped){logger[_0x778e('0x5a')](_0x778e('0x86'));_0x323f5e[_0x778e('0x87')]();}}catch(_0x482b9e){handleError(_0x35541e[_0x778e('0x70')][_0x49a7ab],{'code':_0x778e('0x88'),'message':_0x482b9e[_0x778e('0x5f')]});logger[_0x778e('0x1d')](_0x778e('0x89'),_0x482b9e[_0x778e('0x5f')]);}},'complete':function(){try{var _0x3179d2=[];var _0x3953e8=tempTableName;_0x3179d2[_0x778e('0x1b')]('CREATE\x20TABLE\x20'+_0x3953e8+'\x20LIKE\x20cm_contacts;');logger[_0x778e('0x5a')](_0x778e('0x8a'),contactItemTypes[_0x778e('0x18')]);var _0x37dbff=util[_0x778e('0xe')](_0x778e('0x8b'),_0x10b556,_0x3953e8,_0x579cb0,_0x57fe7b[_0x778e('0x31')],_0x57fe7b[_0x778e('0x54')]||null,NOW,NOW);if(_['isNil'](_0x8fb312[_0x778e('0x2f')])){_0x37dbff+=_0x778e('0x8c');}_0x3179d2['push'](_0x37dbff);BPromise[_0x778e('0x8d')](_0x3179d2,handleQuery)[_0x778e('0x1c')](function(_0x39ec90){BPromise[_0x778e('0x8e')]([handleAdditionalPhones()])['then'](function(){_0x3179d2=[];for(var _0x212b9b=0x0;_0x212b9b\x20\x20');}var _0x185c13=path[_0x778e('0x12')](config[_0x778e('0x66')],_0x778e('0x67'),process[_0x778e('0x97')][0x2]);if(!fs['existsSync'](_0x185c13)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x3320f0={};try{_0x3320f0=JSON['parse'](process[_0x778e('0x97')][0x3]);if(!_0x3320f0[_0x778e('0x64')]){throw new Error(_0x778e('0x98'));}var _0xc096a4=0x0;if(_0x3320f0['binding'][_0x778e('0x34')]){_0xc096a4=0x1;}if(!_0x3320f0[_0x778e('0x31')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x277bef){throw new Error(_0x778e('0x99'));}var _0x1a8d36=[];try{_0x1a8d36=_[_0x778e('0x9a')](JSON['parse'](process[_0x778e('0x97')][0x4]),'id');}catch(_0x3f6b8e){logger[_0x778e('0x5a')](_0x778e('0x9b'));}main(_0x185c13,_0x3320f0,_0x1a8d36,_0xc096a4);}validate();process['on']('SIGINT',handleStop);process['on'](_0x778e('0x9c'),handleUncaughtException); \ No newline at end of file +var _0x1c9a=['papaparse','bluebird','moment','squel','../../../mysqldb','../../../config/environment','../../../config/logger','import','defaults','localhost','socket.io-emitter','redis','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','format','YYYYMMDDHHmmss','test','select','field','phone','from','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','spread','length','isNil','push','all','then','catch','error','message','split','filter','CmContactHasItem','findOne','update','updated','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','fromQuery','scheduledat','ContactId','ListId','createdAt','priority','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','cm_hopper_black','updatedAt','join','.CmListId','ListId\x20=\x20?','toString','cm_hopper.id','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_hopper.ListId\x20=\x20?','concat','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','min_id','group','info','Received\x20SIGINT','errors','code','main','stringify','binding','clone','root','server/files/tmp','body','ContactItemType','name','_description','AdditionalPhones','header','writeFileSync','createReadStream','data','rows','find','hasOwnProperty','trim','replace','isValid','isNumber','includes','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','description','appendFileSync','emit','contact:import:','Abort\x20parser','abort','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()','contactTypeId','orderBy','DROP\x20TABLE\x20','finish','affectedRows','unlink','exit','complete','argv','arguments\x20\x20\x20','parse','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path'];(function(_0x20e13b,_0x3f7cd9){var _0x44d9d3=function(_0x8f1a5b){while(--_0x8f1a5b){_0x20e13b['push'](_0x20e13b['shift']());}};_0x44d9d3(++_0x3f7cd9);}(_0x1c9a,0x98));var _0xa1c9=function(_0x4f02b5,_0x54dd01){_0x4f02b5=_0x4f02b5-0x0;var _0x5aaada=_0x1c9a[_0x4f02b5];return _0x5aaada;};'use strict';var fs=require('fs');var path=require(_0xa1c9('0x0'));var _=require('lodash');var Papa=require(_0xa1c9('0x1'));var util=require('util');var BPromise=require(_0xa1c9('0x2'));var moment=require(_0xa1c9('0x3'));var squel=require(_0xa1c9('0x4'));var Redis=require('ioredis');var db=require(_0xa1c9('0x5'))['db'];var config=require(_0xa1c9('0x6'));var logger=require(_0xa1c9('0x7'))(_0xa1c9('0x8'));config['redis']=_[_0xa1c9('0x9')](config['redis'],{'host':_0xa1c9('0xa'),'port':0x18eb});var socket=require(_0xa1c9('0xb'))(new Redis(config[_0xa1c9('0xc')]));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()['format'](_0xa1c9('0xd'));var tempTableName=_0xa1c9('0xe')+moment()[_0xa1c9('0xf')](_0xa1c9('0x10'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x493cf6){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))*$/[_0xa1c9('0x11')](_0x493cf6);}function selectNotIn(_0x4437f2,_0x29e24a,_0x99fe9d,_0x30e091,_0xbb76ef){return squel[_0xa1c9('0x12')]()[_0xa1c9('0x13')](_0xa1c9('0x14'))[_0xa1c9('0x15')](_0x30e091)['join'](_0x29e24a,null,_0x29e24a+_0xa1c9('0x16')+_0x30e091+'.'+_0x99fe9d)[_0xa1c9('0x17')](_0x30e091+'.'+_0x99fe9d+_0xa1c9('0x18')+_0x4437f2+'.'+_0x99fe9d)[_0xa1c9('0x17')](_0x29e24a+_0xa1c9('0x19')+_0xbb76ef['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x335dda,_0x4b2fa5){promisesAdditionalPhones=[];promisesContact=[];return db[_0xa1c9('0x1a')][_0xa1c9('0x1b')](_0xa1c9('0x1c')+tempTableName)[_0xa1c9('0x1d')](function(_0x44ab5b){if(_0x44ab5b!==null){var _0x3b51f5=[];for(var _0x1f6d26=0x0;_0x1f6d26<_0x44ab5b[_0xa1c9('0x1e')];_0x1f6d26++){var _0x51b455=_0x44ab5b[_0x1f6d26];if(!_[_0xa1c9('0x1f')](_0x51b455[_0xa1c9('0x14')])){if(!_[_0xa1c9('0x1f')](_0x51b455['AdditionalPhones']))_0x3b51f5[_0xa1c9('0x20')](insertAdditionalPhones(_0x51b455));promisesContact['push']({'contact':_0x51b455});}}}Promise[_0xa1c9('0x21')](_0x3b51f5)[_0xa1c9('0x22')](function(){_0x335dda({'val':0x1});});})[_0xa1c9('0x23')](function(_0x5121a7){logger[_0xa1c9('0x24')](_0x5121a7[_0xa1c9('0x25')]);});});}function insertAdditionalPhones(_0x128732){return new Promise(function(_0x4edf37,_0x41e6d2){var _0x426f66=_0x128732['AdditionalPhones'];if(_[_0xa1c9('0x1f')](_0x426f66))_0x41e6d2({'val':0x0});else{var _0x3468b9=_0x426f66[_0xa1c9('0x26')](';');var _0x4d05d0=[];orderBy=0x0;for(var _0x29f1b1=0x0;_0x29f1b1<_0x3468b9[_0xa1c9('0x1e')];_0x29f1b1++){_0x4d05d0[_0xa1c9('0x20')](splitAdditionalPhone(_0x128732['id'],_0x3468b9[_0x29f1b1]));}Promise[_0xa1c9('0x21')](_0x4d05d0)[_0xa1c9('0x22')](function(){_0x4edf37({'val':_0x3468b9['length']});});}});}function splitAdditionalPhone(_0x50b16b,_0x200749){return new Promise(function(_0x50b16d,_0x380f31){var _0x3d8fa7=_0x200749[_0xa1c9('0x26')](':');var _0x3059eb=_0x3d8fa7[0x0];var _0x339ed1=_0x3d8fa7[0x1];if(_0x339ed1!==''){var _0x522dc0=_0x339ed1[_0xa1c9('0x26')]('|');var _0x3ca2a8=[];for(var _0x20cbe1=0x0;_0x20cbe1<_0x522dc0['length'];_0x20cbe1++){if(_0x522dc0[_0x20cbe1]!==''){var _0x133f80=_[_0xa1c9('0x27')](promisesAdditionalPhones,{'contactId':_0x50b16b,'phone':_0x522dc0[_0x20cbe1]});if(_0x133f80[_0xa1c9('0x1e')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x50b16b,'contactTypeId':_0x3059eb,'phone':_0x522dc0[_0x20cbe1],'orderBy':orderBy});}}}_0x50b16d({'ok':0x1});}else _0x50b16d({'res':0x0});});}function createAdditionalPhone(_0x242a43,_0x2a2e9c,_0x594137,_0x38936f){var _0x48ce34='';var _0xdf6d0c='';var _0x2404c3=_0x594137[_0xa1c9('0x26')]('§');_0x48ce34=_0x2404c3[0x0];if(_0x2404c3[_0xa1c9('0x1e')]==0x2)_0xdf6d0c=_0x2404c3[0x1];return new Promise(function(_0x40b9d5,_0xe8523b){return db[_0xa1c9('0x28')][_0xa1c9('0x29')]({'where':{'CmContactId':_0x242a43,'item':_0x48ce34}})['then'](function(_0x4d23cd){if(_0x4d23cd){return db[_0xa1c9('0x28')][_0xa1c9('0x2a')]({'ItemTypeId':_0x2a2e9c,'description':_0xdf6d0c,'OrderBy':_0x38936f},{'where':{'CmContactId':_0x242a43,'item':_0x48ce34}})[_0xa1c9('0x22')](function(_0xf419d0){_0x40b9d5({'res':_0xa1c9('0x2b')});});}else{return db['CmContactHasItem']['create']({'CmContactId':_0x242a43,'item':_0x48ce34,'ItemTypeId':_0x2a2e9c,'description':_0xdf6d0c,'OrderBy':_0x38936f,'ItemClass':'PHONE'})[_0xa1c9('0x22')](function(_0x3e4845){_0x40b9d5({'res':_0xa1c9('0x2c')});});}});});}function updateContact(_0x2a1268){return new Promise(function(_0x39cf81,_0x33e858){var _0x356ead=_0x2a1268['id'];delete _0x2a1268['id'];return db['CmContact'][_0xa1c9('0x2a')](_0x2a1268,{'where':{'id':_0x356ead}})['then'](function(_0x1b8707){updatedRows+=0x1;return db['CmHopper'][_0xa1c9('0x2a')]({'phone':_0x2a1268[_0xa1c9('0x14')]},{'where':{'ContactId':_0x356ead}})[_0xa1c9('0x22')](function(_0x47a25f){_0x39cf81({'ret':'OK'});});});});}function insertCmHopper(_0x39818f,_0x15e9b2,_0x24b739,_0x3b3a72,_0x5f1c71){var _0x54a8c8=[_0xa1c9('0x2d'),_0xa1c9('0x2e'),_0xa1c9('0x2f'),_0xa1c9('0x30'),_0x15e9b2+'.'+_0x3b3a72,_0xa1c9('0x31'),_0xa1c9('0x32'),_0xa1c9('0x33'),_0xa1c9('0x34'),'\x22'+_0x5f1c71+'\x22'];return squel[_0xa1c9('0x35')]()[_0xa1c9('0x36')]('cm_hopper')[_0xa1c9('0x37')]([_0xa1c9('0x14'),_0xa1c9('0x38'),_0xa1c9('0x39'),_0xa1c9('0x3a'),_0x3b3a72,_0xa1c9('0x3b'),'updatedAt',_0xa1c9('0x3c'),_0xa1c9('0x3d'),_0xa1c9('0x3e')],squel['select']()[_0xa1c9('0x3f')](_0x54a8c8)[_0xa1c9('0x15')](_0x15e9b2)['join'](_0xa1c9('0x40'),null,_0xa1c9('0x41')+_0x15e9b2+'.CmListId')['join'](_0x24b739,null,_0x24b739+_0xa1c9('0x16')+_0x15e9b2+'.'+_0x3b3a72)[_0xa1c9('0x17')](_0x15e9b2+_0xa1c9('0x42'),_0x39818f)[_0xa1c9('0x17')](_0xa1c9('0x43'),NOW)[_0xa1c9('0x17')](_0xa1c9('0x44'),selectNotIn(_0x15e9b2,_0x24b739,_0x3b3a72,_0xa1c9('0x45'),[_0xa1c9('0x46'),_0xa1c9('0x47')]))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x15e9b2,_0x24b739,_0x3b3a72,_0xa1c9('0x45'),[_0xa1c9('0x46')])))['toString']();}function insertCmHopperBlack(_0x30ce3b,_0x102a33,_0x43de42,_0x36c846){var _0x324884=[_0xa1c9('0x2d'),_0xa1c9('0x2f'),_0xa1c9('0x30'),_0x102a33+'.'+_0x36c846,_0xa1c9('0x31'),_0xa1c9('0x32')];return squel[_0xa1c9('0x35')]()['into'](_0xa1c9('0x48'))['fromQuery']([_0xa1c9('0x14'),'ContactId',_0xa1c9('0x3a'),_0x36c846,'createdAt',_0xa1c9('0x49')],squel[_0xa1c9('0x12')]()['fields'](_0x324884)[_0xa1c9('0x15')](_0x102a33)[_0xa1c9('0x4a')]('cm_contacts',null,_0xa1c9('0x41')+_0x102a33+_0xa1c9('0x4b'))[_0xa1c9('0x4a')](_0x43de42,null,_0x43de42+_0xa1c9('0x16')+_0x102a33+'.'+_0x36c846)[_0xa1c9('0x17')](_0x102a33+_0xa1c9('0x42'),_0x30ce3b)['where'](_0xa1c9('0x43'),NOW)[_0xa1c9('0x17')](_0xa1c9('0x44'),squel[_0xa1c9('0x12')]()[_0xa1c9('0x13')]('phone')['from']('cm_hopper_black')[_0xa1c9('0x17')](_0xa1c9('0x4c'),_0x30ce3b)[_0xa1c9('0x17')](_0x36c846+'\x20=\x20?',_0x102a33+'.'+_0x36c846)))[_0xa1c9('0x4d')]();}function insertCmHopperAdditionalPhones(_0xc91f87){var _0x58a27d=[_0xa1c9('0x4e'),'cm_contact_has_items.item','cm_contact_has_items.OrderBy',_0xa1c9('0x4f'),_0xa1c9('0x50')];return squel[_0xa1c9('0x35')]()[_0xa1c9('0x36')](_0xa1c9('0x51'))[_0xa1c9('0x37')]([_0xa1c9('0x52'),_0xa1c9('0x14'),_0xa1c9('0x53'),_0xa1c9('0x3b'),_0xa1c9('0x49')],squel[_0xa1c9('0x12')]()[_0xa1c9('0x3f')](_0x58a27d)[_0xa1c9('0x15')](_0xa1c9('0x45'))[_0xa1c9('0x4a')](_0xa1c9('0x40'),null,_0xa1c9('0x54'))[_0xa1c9('0x4a')]('cm_contact_has_items',null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0xa1c9('0x17')](_0xa1c9('0x55'),_0xc91f87)[_0xa1c9('0x17')](_0xa1c9('0x43'),NOW))['toString']();}function insertCmContact(_0x449e85,_0x2df20d,_0xe227b2,_0x580af2){var _0x4753ff=_[_0xa1c9('0x56')](_['keys'](_0x580af2),['ListId',_0xa1c9('0x57'),'createdAt',_0xa1c9('0x49')]);return squel[_0xa1c9('0x35')]()[_0xa1c9('0x36')]('cm_contacts')['fromQuery'](_0x4753ff,squel[_0xa1c9('0x12')]()['fields'](_0x4753ff)[_0xa1c9('0x15')](_0x2df20d)['where']('('+_0xe227b2[_0xa1c9('0x4a')](',')+_0xa1c9('0x58'),squel[_0xa1c9('0x12')]()[_0xa1c9('0x3f')](_0xe227b2)[_0xa1c9('0x15')](_0xa1c9('0x40'))[_0xa1c9('0x17')]('ListId\x20=\x20?',_0x449e85))[_0xa1c9('0x17')](_0xa1c9('0x59'),squel['select']()['field']('MIN(id)',_0xa1c9('0x5a'))['from'](_0x2df20d)[_0xa1c9('0x5b')](_0xe227b2[_0xa1c9('0x4a')](','))))[_0xa1c9('0x4d')]();}function handleStop(){logger[_0xa1c9('0x5c')](_0xa1c9('0x5d'));stopped=!![];}function handleUncaughtException(_0x5b81f4){logger['error'](_0x5b81f4['message']);process['exit'](0x1);}function handleError(_0x142e50,_0x187bb0){stats[_0xa1c9('0x5e')][_0xa1c9('0x20')]({'name':_0x187bb0[_0xa1c9('0x5f')],'message':_0x187bb0[_0xa1c9('0x25')],'row':_0x142e50});}function handleQuery(_0x6489a5){logger[_0xa1c9('0x5c')](_0x6489a5);return db[_0xa1c9('0x1a')][_0xa1c9('0x1b')](_0x6489a5)[_0xa1c9('0x1d')](function(_0xef5d24){results[_0xa1c9('0x20')](_0xef5d24);})[_0xa1c9('0x23')](function(_0x51f675){logger[_0xa1c9('0x24')](_0x51f675[_0xa1c9('0x25')]);});}function main(_0x10afcb,_0x402ebc,_0x588887,_0x17feab){logger[_0xa1c9('0x5c')](_0xa1c9('0x60'),_0x10afcb,JSON[_0xa1c9('0x61')](_0x402ebc));process['send']('start');var _0x118bef=_0x402ebc[_0xa1c9('0x62')];var _0x3be723=_[_0xa1c9('0x63')](_0x118bef);var _0x22b2f8=_0x402ebc['socket_timestamp'];var _0x966f5e=path[_0xa1c9('0x4a')](config[_0xa1c9('0x64')],_0xa1c9('0x65'),_0x22b2f8+'.csv');logger[_0xa1c9('0x5c')](_0xa1c9('0x66'),_0x402ebc);db[_0xa1c9('0x67')]['findAll']({'raw':!![],'attributes':['id',_0xa1c9('0x68')]})[_0xa1c9('0x22')](function(_0x49fc34){for(var _0x35d443=0x0;_0x35d443<_0x49fc34[_0xa1c9('0x1e')];_0x35d443++){if(_0x49fc34[_0x35d443][_0xa1c9('0x68')]in _0x118bef){contactItemTypes[_0xa1c9('0x20')](_0x49fc34[_0x35d443]);delete _0x3be723[_0x49fc34[_0x35d443][_0xa1c9('0x68')]];hasAdditionalPhones=!![];}for(var _0x39b287 in _0x118bef){if(_0x49fc34[_0x35d443][_0xa1c9('0x68')]+_0xa1c9('0x69')===_0x39b287){phoneDescriptions[_0xa1c9('0x20')]({'itemTypeId':_0x49fc34[_0x35d443]['id'],'description':_0x39b287});delete _0x3be723[_0x39b287];}}}if(hasAdditionalPhones)_0x3be723[_0xa1c9('0x6a')]='';var _0x29a271=_['keys'](_0x3be723)[_0xa1c9('0x4a')]();logger[_0xa1c9('0x5c')](_0xa1c9('0x6b'),_0x29a271);fs[_0xa1c9('0x6c')](_0x966f5e,_0x29a271+'\x0a');Papa['parse'](fs[_0xa1c9('0x6d')](_0x10afcb),{'header':!![],'skipEmptyLines':!![],'step':function(_0xdbc56a,_0x35bbe9){try{for(var _0xd32f52=0x0,_0x257240=[];_0xd32f52<_0xdbc56a[_0xa1c9('0x6e')][_0xa1c9('0x1e')];_0xd32f52++){stats[_0xa1c9('0x6f')]+=0x1;if(_0xdbc56a[_0xa1c9('0x5e')][_0xd32f52]){handleError(_0xdbc56a[_0xa1c9('0x6e')][_0xd32f52],_0xdbc56a[_0xa1c9('0x5e')][_0xd32f52]);}else{var _0xc871ff=[];var _0xfc54f1=[];var _0x3cbf59={};for(var _0x4a2c21 in _0x118bef){let _0x3e46a3=contactItemTypes[_0xa1c9('0x70')](_0x1f219d=>_0x1f219d[_0xa1c9('0x68')]===_0x4a2c21);let _0x20c581=contactItemTypes[_0xa1c9('0x70')](_0x15f4f5=>_0x15f4f5['name']+_0xa1c9('0x69')===_0x4a2c21);if(_[_0xa1c9('0x1f')](_0x3e46a3)&&_['isNil'](_0x20c581)){if(_0x118bef[_0xa1c9('0x71')](_0x4a2c21)){if(_0xdbc56a[_0xa1c9('0x6e')][_0xd32f52][_0x118bef[_0x4a2c21]]){var _0x2a17b7=_[_0xa1c9('0x72')](_0xdbc56a['data'][_0xd32f52][_0x118bef[_0x4a2c21]][_0xa1c9('0x73')](/"/g,'\x27'));switch(_0x4a2c21){case'scheduledat':var _0x57c253=moment(_0x2a17b7,_0xa1c9('0xd'),!![]);if(_0x57c253[_0xa1c9('0x74')]()){_0x257240[_0xa1c9('0x20')]('\x22'+_0x2a17b7+'\x22');}else{_0xc871ff[_0xa1c9('0x20')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xa1c9('0x3c'):var _0x1b2a15=parseInt(_0x2a17b7);_0x2a17b7=_['isNaN'](_0x1b2a15)||_0x1b2a15<0x0||_0x1b2a15>0x4?_0x17feab?0x3:0x2:_0x1b2a15;_0x257240[_0xa1c9('0x20')]('\x22'+_0x2a17b7+'\x22');break;case _0xa1c9('0x3d'):var _0x1a8223=parseInt(_0x2a17b7);if(_[_0xa1c9('0x75')](_0x1a8223)&&_[_0xa1c9('0x76')](_0x588887,_0x1a8223)){_0x257240[_0xa1c9('0x20')]('\x22'+_0x1a8223+'\x22');}else{_0xc871ff['push']('agent\x20not\x20exists');}break;case _0xa1c9('0x77'):if(isEmail(_0x2a17b7)){_0x257240['push']('\x22'+_0x2a17b7+'\x22');}else{_0xc871ff[_0xa1c9('0x20')](_0xa1c9('0x78'));}break;case _0xa1c9('0x79'):var _0x2b2c6c=moment(_0x2a17b7,_0xa1c9('0x7a'),!![]);if(_0x2b2c6c[_0xa1c9('0x74')]()){_0x257240[_0xa1c9('0x20')]('\x22'+_0x2a17b7+'\x22');}else{_0xc871ff[_0xa1c9('0x20')](_0xa1c9('0x7b'));}break;default:_0x257240['push']('\x22'+_0x2a17b7+'\x22');}}else{switch(_0x4a2c21){case _0xa1c9('0x7c'):case'phone':_0xc871ff['push'](_0x4a2c21+_0xa1c9('0x7d'));break;default:_0x257240['push']('\x22\x22');}}}}else{var _0x3b4cfc='';if(!_[_0xa1c9('0x1f')](_0x3e46a3)){if(!_0x3cbf59[_0xa1c9('0x71')](_0x3e46a3['id'])){for(var _0x397a9a=0x0;_0x397a9a<_0x118bef[_0x4a2c21][_0xa1c9('0x1e')];_0x397a9a++){var _0x2a17b7=_[_0xa1c9('0x72')](_0xdbc56a['data'][_0xd32f52][_0x118bef[_0x4a2c21][_0x397a9a]][_0xa1c9('0x73')](/"/g,'\x27'));var _0x326e5a=phoneDescriptions[_0xa1c9('0x70')](_0x4c538f=>_0x4c538f['itemTypeId']===_0x3e46a3['id']);if(!_[_0xa1c9('0x1f')](_0x326e5a)){var _0x4b07b4=_[_0xa1c9('0x72')](_0xdbc56a[_0xa1c9('0x6e')][_0xd32f52][_0x118bef[_0x326e5a[_0xa1c9('0x7e')]][0x0]][_0xa1c9('0x73')](/"/g,'\x27'));if(!_['isNil'](_0x4b07b4))_0x2a17b7=_0x2a17b7+'§'+_0x4b07b4;}if(_0x3b4cfc=='')_0x3b4cfc=_0x2a17b7;else _0x3b4cfc+='|'+_0x2a17b7;}_0xfc54f1[_0xa1c9('0x20')](_0x3e46a3['id']+':'+_0x3b4cfc);_0x3cbf59[_0x3e46a3['id']]=0x1;}}}}if(hasAdditionalPhones){_0x257240[_0xa1c9('0x20')]('\x22'+_0xfc54f1[_0xa1c9('0x4a')](';')+'\x22');}if(_0xc871ff[_0xa1c9('0x1e')]){handleError(_0xdbc56a[_0xa1c9('0x6e')][_0xd32f52],{'code':'SystemRow','message':_0xc871ff[_0xa1c9('0x4a')]()});}else{fs[_0xa1c9('0x7f')](_0x966f5e,_0x257240[_0xa1c9('0x4a')]()+'\x0a');}_0x257240=[];}if(!(stats['rows']%0xc8)){socket[_0xa1c9('0x80')](_0xa1c9('0x81')+_0x22b2f8,stats);stats[_0xa1c9('0x5e')]=[];}}if(stopped){logger[_0xa1c9('0x5c')](_0xa1c9('0x82'));_0x35bbe9[_0xa1c9('0x83')]();}}catch(_0x53ea3b){handleError(_0xdbc56a[_0xa1c9('0x6e')][_0xd32f52],{'code':'SystemError','message':_0x53ea3b[_0xa1c9('0x25')]});logger[_0xa1c9('0x24')]('step',_0x53ea3b[_0xa1c9('0x25')]);}},'complete':function(){try{var _0x5adc36=[];var _0x41afda=tempTableName;_0x5adc36[_0xa1c9('0x20')](_0xa1c9('0x84')+_0x41afda+_0xa1c9('0x85'));logger[_0xa1c9('0x5c')](_0xa1c9('0x86'),contactItemTypes[_0xa1c9('0x1e')]);var _0x200c14=util[_0xa1c9('0xf')](_0xa1c9('0x87'),_0x966f5e,_0x41afda,_0x29a271,_0x402ebc[_0xa1c9('0x3a')],_0x402ebc[_0xa1c9('0x57')]||null,NOW,NOW);if(_[_0xa1c9('0x1f')](_0x118bef[_0xa1c9('0x38')])){_0x200c14+=_0xa1c9('0x88');}_0x5adc36[_0xa1c9('0x20')](_0x200c14);BPromise['each'](_0x5adc36,handleQuery)['then'](function(_0x3e796f){BPromise[_0xa1c9('0x21')]([handleAdditionalPhones()])[_0xa1c9('0x22')](function(){_0x5adc36=[];for(var _0x54ec05=0x0;_0x54ec05\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','TagIds','limit','offset','sequelize','toString','groupBy','Setting','findOne','enableEmailPreview','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','exports','lodash','../parsers/advancedSearch','../parsers/qs','./update-interaction','./utils','../../mysqldb','getAccountFK','search','select','field','name','color','_interactions','u.id','u.fullname','ui.','from','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','getInteractionFK','interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.','me.','\x20=\x20i.id','interactionsTags','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','mail','c.email\x20LIKE\x20?','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','parseSearch','sqlOperator','conditions','text','value','end','read','and','Contact','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','type','start','Tag','split','tags','clause','ids','User','operator','$substring','UserId','buildExpression','body','plainBody','keys','map','compact','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','fields','tag','chat','Accounts','role','agent','i.thirdDisposition','i.secondDisposition','i.disposition','unshift','i.substatus','closed','join','capitalize','Interaction','Sequelize','QueryTypes','SELECT','query','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.updatedAt','i.closed','i.attach','i.lastMsgAt','i.lastMsgDirection'];(function(_0xa1610c,_0x2d5bcc){var _0x5ffdbb=function(_0x220a1e){while(--_0x220a1e){_0xa1610c['push'](_0xa1610c['shift']());}};_0x5ffdbb(++_0x2d5bcc);}(_0x80d9,0x15c));var _0x980d=function(_0x5ba369,_0x5cf30e){_0x5ba369=_0x5ba369-0x0;var _0x2b307a=_0x80d9[_0x5ba369];return _0x2b307a;};'use strict';var _=require(_0x980d('0x0'));var squel=require('squel');var as=require(_0x980d('0x1'));var qs=require(_0x980d('0x2'));var updateInteraction=require(_0x980d('0x3'))['updateInteraction'];var utils=require(_0x980d('0x4'));var db=require(_0x980d('0x5'))['db'];function skipInteractionsQuery(_0x38d1b9,_0x279d93,_0x290800){var _0x4a1d3f=![];var _0x4c3533=utils[_0x980d('0x6')](_0x38d1b9);if(_0x279d93['role']==='agent'&&!_0x290800[_0x980d('0x7')]&&!_0x290800[_0x4c3533]){_0x4a1d3f=!![];}return _0x4a1d3f;}function getTagsQuery(){return squel[_0x980d('0x8')]()[_0x980d('0x9')]('id')[_0x980d('0x9')](_0x980d('0xa'))[_0x980d('0x9')](_0x980d('0xb'))['from']('tools_tags');}function getUsersQuery(_0x533b8c,_0x43a0d8){var _0x10872c=utils['getInteractionFK'](_0x533b8c);var _0x1c8a14='user_has_'+_0x533b8c+_0x980d('0xc');var _0x52cd18=squel[_0x980d('0x8')]()[_0x980d('0x9')](_0x980d('0xd'))[_0x980d('0x9')](_0x980d('0xe'))[_0x980d('0x9')](_0x980d('0xf')+_0x10872c)[_0x980d('0x10')](_0x1c8a14,'ui')['left_join'](_0x980d('0x11'),'u',_0x980d('0x12'));if(_0x43a0d8[_0x980d('0x13')]>0x0){_0x52cd18[_0x980d('0x14')](_0x980d('0xf')+_0x10872c+_0x980d('0x15'),_['map'](_0x43a0d8,'id'));}return _0x52cd18;}function getInteractionsQuery(_0x27dd6a){var _0x393ae2=utils['getInteractionsTables'](_0x27dd6a);var _0x1633cf=utils['getAccountFK'](_0x27dd6a);var _0x23f64c=utils[_0x980d('0x16')](_0x27dd6a);return squel[_0x980d('0x8')]()[_0x980d('0x10')](_0x393ae2[_0x980d('0x17')],'i')[_0x980d('0x18')](_0x980d('0x19'),'c',_0x980d('0x1a'))[_0x980d('0x18')](_0x980d('0x11'),'o',_0x980d('0x1b'))['left_join'](_0x393ae2['accounts'],'a',_0x980d('0x1c')+_0x1633cf)['left_join'](_0x393ae2['messages'],'me',_0x980d('0x1d')+_0x23f64c+_0x980d('0x1e'))[_0x980d('0x18')](_0x393ae2[_0x980d('0x1f')],'it','it.'+_0x23f64c+'\x20=\x20i.id')[_0x980d('0x18')]('tools_tags','t',_0x980d('0x20'));}function getSqlClauses(){var _0x20cea1={'body':squel['expr'](),'contact':squel[_0x980d('0x21')](),'default':squel['expr'](),'fields':squel['expr'](),'filter':squel['expr'](),'read':squel[_0x980d('0x21')](),'tags':{'clause':squel[_0x980d('0x21')](),'ids':null},'user':squel[_0x980d('0x21')]()};return _0x20cea1;}function parseTagParameter(_0x28adb3){var _0x5342dd=squel['expr']();if(_0x28adb3){var _0x26d9c6=utils[_0x980d('0x22')](_0x28adb3);_0x26d9c6[_0x980d('0x23')](function(_0x1da8ea){_0x5342dd['or'](_0x980d('0x24'),'%,'+_0x1da8ea+',%');});}return _0x5342dd;}function parseReadParameter(_0x47b11d){var _0x4a51f9='';if(_0x47b11d){_0x4a51f9=_0x980d('0x25');if(_0x47b11d==='1'){_0x4a51f9=_0x4a51f9[_0x980d('0x26')](_0x980d('0x27'),'=');}else{_0x4a51f9=_0x4a51f9[_0x980d('0x26')](_0x980d('0x27'),'>');}}return _0x4a51f9;}function parseSearchFilter(_0x25542b,_0x513693){var _0x14c61b=squel[_0x980d('0x21')]();if(_0x513693){var _0xaa9cd6=_0x513693[_0x980d('0x26')]('\x5c','\x5c\x5c')[_0x980d('0x26')](/'/g,'\x27\x27');if(qs[_0x980d('0x28')](_0xaa9cd6)){_0x14c61b['or'](_0x980d('0x29'),_0xaa9cd6+'%');if([_0x980d('0x2a'),_0x980d('0x2b')]['includes'](_0x25542b)){_0x14c61b['or'](_0x980d('0x2c'),_0xaa9cd6+'%');}else if(_0x25542b===_0x980d('0x2d')){_0x14c61b['or'](_0x980d('0x2e'),_0xaa9cd6+'%');}else if(_0x25542b==='openchannel'){_0x14c61b['or']('i.from\x20LIKE\x20?',_0xaa9cd6+'%');}}else if(_0x25542b===_0x980d('0x2f')&&qs['isEmail'](_0xaa9cd6)){_0x14c61b['or'](_0x980d('0x30'),_0xaa9cd6+'%');}else{if(_0x25542b==='mail'){_0x14c61b['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0xaa9cd6))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0xaa9cd6));}else{if(_0x25542b!=='fax'){_0x14c61b['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x980d('0x31')](_0xaa9cd6));}_0x14c61b['or'](_0x980d('0x32'),_0xaa9cd6+'%');}}}return _0x14c61b;}function parseAdvancedSearchFilter(_0x12530d,_0x58dcc4){var _0x498081=getSqlClauses();var _0x21a66a=as[_0x980d('0x33')](_0x12530d);var _0x2623d8=_0x21a66a[_0x980d('0x34')];for(var _0x27890f=0x0;_0x27890f<_0x21a66a[_0x980d('0x35')]['length'];_0x27890f++){var _0x43c2e2=_0x21a66a[_0x980d('0x35')][_0x27890f];var _0x5f4502='i';var _0x92c9bd=_['find'](_0x58dcc4,[_0x980d('0xa'),_0x43c2e2[_0x980d('0x9')]]);if(_0x92c9bd){var _0x41159e=as['buildExpression'](_0x5f4502,_0x92c9bd['type'],_0x43c2e2);_0x498081['default'][_0x2623d8](_0x41159e[_0x980d('0x36')],_0x41159e['value']['start'],_0x41159e[_0x980d('0x37')][_0x980d('0x38')]);}else{switch(_0x43c2e2[_0x980d('0x9')]){case'unreadMessages':var _0x41174b=parseReadParameter(_0x43c2e2[_0x980d('0x37')]);_0x498081[_0x980d('0x39')][_0x980d('0x3a')](_0x41174b);break;case _0x980d('0x3b'):if(_0x43c2e2['operator']==='$substring'){if(_0x43c2e2[_0x980d('0x37')]['split']('\x20')['length']>0x1){_0x498081['contact'][_0x2623d8]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x980d('0x31')](_0x43c2e2[_0x980d('0x37')]),null);}else{var _0x8bcd98='%'+_0x43c2e2['value']+'%';_0x498081[_0x980d('0x3c')][_0x2623d8](_0x980d('0x3d'),_0x8bcd98,_0x8bcd98,_0x8bcd98);}}else{_0x92c9bd=_[_0x980d('0x3e')](_0x58dcc4,[_0x980d('0xa'),_0x980d('0x3f')]);_0x43c2e2[_0x980d('0x9')]=_0x980d('0x3f');_0x41159e=as['buildExpression'](_0x5f4502,_0x92c9bd[_0x980d('0x40')],_0x43c2e2);_0x498081[_0x980d('0x3c')][_0x2623d8](_0x41159e[_0x980d('0x36')],_0x41159e['value'][_0x980d('0x41')],_0x41159e[_0x980d('0x37')][_0x980d('0x38')]);}break;case _0x980d('0x42'):var _0x42486b=_0x43c2e2[_0x980d('0x37')][_0x980d('0x43')](',')['map'](function(_0x473c94){return Number(_0x473c94);});var _0x512503=parseTagParameter(_0x42486b);_0x498081[_0x980d('0x44')][_0x980d('0x45')][_0x980d('0x3a')](_0x512503);_0x498081[_0x980d('0x44')][_0x980d('0x46')]=_0x42486b;break;case _0x980d('0x47'):if(_0x43c2e2[_0x980d('0x48')]===_0x980d('0x49')){_0x498081['user'][_0x2623d8]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x43c2e2[_0x980d('0x37')]+'%',null);}else{_0x92c9bd=_[_0x980d('0x3e')](_0x58dcc4,[_0x980d('0xa'),_0x980d('0x4a')]);_0x43c2e2[_0x980d('0x9')]='UserId';_0x41159e=as[_0x980d('0x4b')](_0x5f4502,_0x92c9bd[_0x980d('0x40')],_0x43c2e2);_0x498081['user'][_0x2623d8](_0x41159e[_0x980d('0x36')],_0x41159e[_0x980d('0x37')][_0x980d('0x41')],_0x41159e[_0x980d('0x37')][_0x980d('0x38')]);}break;case _0x980d('0x4c'):case _0x980d('0x4d'):_0x41159e=as[_0x980d('0x4b')]('me',null,_0x43c2e2);_0x498081[_0x980d('0x4c')][_0x2623d8](_0x41159e['text'],_0x41159e[_0x980d('0x37')][_0x980d('0x41')],_0x41159e[_0x980d('0x37')][_0x980d('0x38')]);break;}}}return _0x498081;}function parseModelFields(_0x2e18c6,_0x7d0acf,_0x2e6cdf){var _0x4f0a6e=utils[_0x980d('0x6')](_0x2e18c6);var _0x50de9a=squel[_0x980d('0x21')]();var _0x6e16c1=_(_0x7d0acf)[_0x980d('0x4e')]()[_0x980d('0x4f')](function(_0xb1d509){return _['some'](_0x2e6cdf,[_0x980d('0xa'),_0xb1d509])?_0xb1d509:undefined;})[_0x980d('0x50')]()[_0x980d('0x37')]();if(_0x6e16c1[_0x980d('0x13')]>0x0){_0x6e16c1[_0x980d('0x23')](function(_0x2799a4){if(_0x2799a4===_0x4f0a6e){_0x50de9a[_0x980d('0x3a')]('i.'+_0x4f0a6e+'\x20IN\x20?',[]['concat'](_0x7d0acf[_0x2799a4]));}else if(_0x2799a4==='createdAt'){var _0x4e0f93=JSON[_0x980d('0x51')](_0x7d0acf[_0x2799a4])[_0x980d('0x52')];var _0x2850da=JSON[_0x980d('0x51')](_0x7d0acf[_0x2799a4])[_0x980d('0x53')];_0x50de9a[_0x980d('0x3a')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4e0f93,_0x2850da);}else{if(_0x7d0acf[_0x2799a4]===_0x980d('0x54')){_0x50de9a['and']('i.'+_0x2799a4+_0x980d('0x55'));}else{_0x50de9a[_0x980d('0x3a')]('i.'+_0x2799a4+_0x980d('0x56'),_0x7d0acf[_0x2799a4]);}}});}return _0x50de9a;}function parseQueryParameters(_0x4656f4,_0x522b28,_0x555080){var _0x36a241=getSqlClauses();return Promise[_0x980d('0x57')]()[_0x980d('0x58')](function(){return parseModelFields(_0x4656f4,_0x522b28,_0x555080);})['then'](function(_0x4c95b7){_0x36a241[_0x980d('0x59')]['and'](_0x4c95b7);return parseReadParameter(_0x522b28[_0x980d('0x39')]);})[_0x980d('0x58')](function(_0x409c0f){_0x36a241[_0x980d('0x39')][_0x980d('0x3a')](_0x409c0f);return parseTagParameter(_0x522b28[_0x980d('0x5a')]);})[_0x980d('0x58')](function(_0x4621eb){_0x36a241['tags']['clause'][_0x980d('0x3a')](_0x4621eb);return parseSearchFilter(_0x4656f4,_0x522b28['filter']);})[_0x980d('0x58')](function(_0x21cf36){_0x36a241['filter']=_0x21cf36;return _0x36a241;});}function checkAccountsRestrictions(_0x2b28e4,_0x338128,_0x3204e3){var _0x60969d=utils['getAccountFK'](_0x2b28e4);var _0x2ccfff='get'+_['capitalize'](_0x2b28e4)+(_0x2b28e4===_0x980d('0x5b')?'Websites':_0x980d('0x5c'));var _0x563bb9=squel[_0x980d('0x21')]();return Promise[_0x980d('0x57')]()['then'](function(){if(_0x3204e3[_0x980d('0x7')]&&_0x338128[_0x980d('0x5d')]===_0x980d('0x5e')){return _0x338128[_0x2ccfff]({'attributes':['id'],'raw':!![]});}})[_0x980d('0x58')](function(_0x26a600){if(_0x26a600){if(_0x26a600[_0x980d('0x13')]===0x0){_0x563bb9[_0x980d('0x3a')]('i.'+_0x60969d+_0x980d('0x55'));}else{_0x563bb9[_0x980d('0x3a')]('i.'+_0x60969d+_0x980d('0x15'),_[_0x980d('0x4f')](_0x26a600,'id'));}}else if(!_0x3204e3[_0x60969d]){_0x563bb9[_0x980d('0x3a')]('i.'+_0x60969d+'\x20IS\x20NOT\x20NULL');}})['then'](function(){return _0x563bb9;});}function getClosedOrderClause(_0x4a5719,_0x438b7e){var _0x53a444='';var _0x153c02=[_0x980d('0x5f'),_0x980d('0x60'),_0x980d('0x61')];if(_0x4a5719==='mail'){_0x153c02[_0x980d('0x62')](_0x980d('0x63'));}if(_0x438b7e['closed']==='0'&&_0x4a5719===_0x980d('0x2f')){_0x53a444='i.substatus';}else{if(_0x438b7e[_0x980d('0x64')]==='1'){_0x153c02['shift']();}_0x53a444='CONCAT_WS(\x27\x27,\x20'+_0x153c02[_0x980d('0x65')](',\x20')+')';}return _0x53a444;}function getFilteredInteractions(_0x46e459,_0x3e6234,_0x16f427,_0x4dbcca){var _0x17d4ff=utils['getInteractionFK'](_0x46e459);var _0x5d0fc5=_[_0x980d('0x66')](_0x46e459)+_0x980d('0x67');var _0x3bd029=[];var _0x357f77=getTagsQuery();var _0x1d9e40={'type':db[_0x980d('0x68')][_0x980d('0x69')][_0x980d('0x6a')],'raw':!![]};var _0x392ec3=[];var _0x46ea46=[];return db['sequelize'][_0x980d('0x6b')](_0x357f77['toString'](),_0x1d9e40)[_0x980d('0x58')](function(_0x3020eb){_0x3bd029=_['keyBy'](_0x3020eb,'id');_0x1d9e40=_[_0x980d('0x6c')](_0x1d9e40,{'model':db[_0x5d0fc5],'mapToModel':!![],'nest':!![]});if(_0x16f427[_0x980d('0x59')]){_0x4dbcca[_0x980d('0x6d')][_0x980d('0x23')](function(_0x4debc0){_0x3e6234[_0x980d('0x9')]('i.'+_0x4debc0);});}else{_0x3e6234[_0x980d('0x9')](_0x980d('0x6e'),_0x980d('0x6f'));_0x3e6234[_0x980d('0x9')](_0x980d('0x70'),_0x980d('0x71'));_0x3e6234[_0x980d('0x9')](_0x980d('0x72'),_0x980d('0x73'));if(_0x46e459==='mail'){_0x3e6234[_0x980d('0x9')](_0x980d('0x74'),_0x980d('0x75'));_0x3e6234[_0x980d('0x9')](_0x980d('0x76'),_0x980d('0x77'));_0x3e6234['field']('i.id');_0x3e6234[_0x980d('0x9')](_0x980d('0x78'));_0x3e6234[_0x980d('0x9')](_0x980d('0x79'));_0x3e6234[_0x980d('0x9')](_0x980d('0x7a'));_0x3e6234['field']('i.closedAt');_0x3e6234['field'](_0x980d('0x7b'));_0x3e6234['field'](_0x980d('0x7c'));_0x3e6234[_0x980d('0x9')](_0x980d('0x7d'));_0x3e6234[_0x980d('0x9')]('i.subject');_0x3e6234['field'](_0x980d('0x61'));_0x3e6234['field'](_0x980d('0x60'));_0x3e6234[_0x980d('0x9')](_0x980d('0x5f'));_0x3e6234[_0x980d('0x9')]('i.substatus');_0x3e6234[_0x980d('0x9')]('i.to');_0x3e6234[_0x980d('0x9')](_0x980d('0x7e'));_0x3e6234[_0x980d('0x9')](_0x980d('0x7f'));_0x3e6234['field'](_0x980d('0x80'));}else if(_0x46e459===_0x980d('0x81')){_0x3e6234[_0x980d('0x9')](_0x980d('0x82'),_0x980d('0x77'));}else{_0x3e6234[_0x980d('0x9')]('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',_0x980d('0x77'));}if(_0x46e459!==_0x980d('0x2f')){_0x3e6234['field'](_0x980d('0x83'));}_0x3e6234[_0x980d('0x9')]('c.firstName','Contact.firstName');_0x3e6234['field'](_0x980d('0x84'),_0x980d('0x85'));_0x3e6234[_0x980d('0x9')](_0x980d('0x86'),_0x980d('0x87'));_0x3e6234[_0x980d('0x9')](_0x980d('0x88'),_0x980d('0x89'));_0x3e6234[_0x980d('0x9')](_0x980d('0x8a'),'Contact.mobile');_0x3e6234[_0x980d('0x9')](_0x980d('0x8b'),_0x980d('0x8c'));_0x3e6234[_0x980d('0x9')](_0x980d('0x8d'),_0x980d('0x8e'));_0x3e6234['field']('o.internal',_0x980d('0x8f'));_0x3e6234[_0x980d('0x9')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x980d('0x90'));}if(_0x4dbcca[_0x980d('0x91')]){_0x3e6234[_0x980d('0x91')](_0x4dbcca[_0x980d('0x91')]);}if(_0x4dbcca[_0x980d('0x92')]){_0x3e6234[_0x980d('0x92')](_0x4dbcca['offset']);}return db[_0x980d('0x93')][_0x980d('0x6b')](_0x3e6234[_0x980d('0x94')](),_0x1d9e40);})[_0x980d('0x58')](function(_0x4e4e32){_0x392ec3=_0x4e4e32;var _0x3ad100=getUsersQuery(_0x46e459,_0x392ec3);return db['sequelize']['query'](_0x3ad100['toString'](),_0x1d9e40);})[_0x980d('0x58')](function(_0x584d7d){_0x46ea46=_[_0x980d('0x95')](_0x584d7d,_0x17d4ff);if(_0x46e459===_0x980d('0x2f')){return db[_0x980d('0x96')][_0x980d('0x97')]({'attributes':[_0x980d('0x98')],'raw':!![]});}})[_0x980d('0x58')](function(_0x54eb5e){var _0x1cce28=_0x54eb5e?_0x54eb5e[_0x980d('0x98')]:undefined;var _0x5ea5e4=_0x392ec3[_0x980d('0x4f')](function(_0x573c58){return updateInteraction(_0x573c58,_0x3bd029,_0x46ea46,_0x1cce28);});return Promise['all'](_0x5ea5e4);});}function countFilteredInteractions(_0x336709,_0x172038){var _0x39fa3e=_0x336709[_0x980d('0x99')]();_0x39fa3e[_0x980d('0x9')](_0x980d('0x9a'));_0x39fa3e[_0x980d('0x9')](_0x980d('0x6e'),_0x980d('0x6f'));var _0x3517bd=utils[_0x980d('0x22')](_0x172038);if(!_[_0x980d('0x9b')](_0x3517bd)){_0x39fa3e[_0x980d('0x14')](_0x980d('0x9c'),_0x3517bd);}var _0x5d71f2={'type':db[_0x980d('0x68')]['QueryTypes']['SELECT'],'raw':!![]};return db[_0x980d('0x93')][_0x980d('0x6b')](_0x39fa3e[_0x980d('0x94')](),_0x5d71f2);}module[_0x980d('0x9d')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x2dae=['c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','limit','offset','groupBy','Setting','findOne','enableEmailPreview','all','clone','COUNT(*)','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','isEmpty','t.id\x20IN\x20?','exports','lodash','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','getAccountFK','role','agent','search','select','field','name','from','tools_tags','getInteractionFK','user_has_','u.id','u.fullname','ui.','users','where','\x20IN\x20?','getInteractionsTables','interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','left_join','accounts','a.id\x20=\x20i.','me.','interactionsTags','it.','\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','{OPERATOR}','replace','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','includes','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','mail','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','fax','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','parseSearch','sqlOperator','conditions','length','find','buildExpression','type','default','value','end','unreadMessages','read','and','split','contact','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','map','tags','ids','User','operator','$substring','user','UserId','keys','some','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','resolve','then','tag','clause','filter','get','capitalize','chat','Websites','Accounts','i.thirdDisposition','i.disposition','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','Sequelize','QueryTypes','SELECT','sequelize','query','toString','keyBy','merge','fields','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.subject','i.secondDisposition','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','contactName','i.*','Contact.firstName'];(function(_0x12c901,_0xb2e3aa){var _0x44910e=function(_0x4b07a1){while(--_0x4b07a1){_0x12c901['push'](_0x12c901['shift']());}};_0x44910e(++_0xb2e3aa);}(_0x2dae,0xc3));var _0xe2da=function(_0x2e249d,_0x41b7e7){_0x2e249d=_0x2e249d-0x0;var _0x1faa37=_0x2dae[_0x2e249d];return _0x1faa37;};'use strict';var _=require(_0xe2da('0x0'));var squel=require('squel');var as=require(_0xe2da('0x1'));var qs=require(_0xe2da('0x2'));var updateInteraction=require(_0xe2da('0x3'))[_0xe2da('0x4')];var utils=require(_0xe2da('0x5'));var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x25b9f2,_0x439b5d,_0x77e45e){var _0x28cf6b=![];var _0x523c60=utils[_0xe2da('0x6')](_0x25b9f2);if(_0x439b5d[_0xe2da('0x7')]===_0xe2da('0x8')&&!_0x77e45e[_0xe2da('0x9')]&&!_0x77e45e[_0x523c60]){_0x28cf6b=!![];}return _0x28cf6b;}function getTagsQuery(){return squel[_0xe2da('0xa')]()[_0xe2da('0xb')]('id')[_0xe2da('0xb')](_0xe2da('0xc'))[_0xe2da('0xb')]('color')[_0xe2da('0xd')](_0xe2da('0xe'));}function getUsersQuery(_0x104fb3,_0x17086c){var _0x3c1309=utils[_0xe2da('0xf')](_0x104fb3);var _0x1a29b9=_0xe2da('0x10')+_0x104fb3+'_interactions';var _0xb98909=squel['select']()[_0xe2da('0xb')](_0xe2da('0x11'))[_0xe2da('0xb')](_0xe2da('0x12'))[_0xe2da('0xb')](_0xe2da('0x13')+_0x3c1309)[_0xe2da('0xd')](_0x1a29b9,'ui')['left_join'](_0xe2da('0x14'),'u','u.id\x20=\x20ui.UserId');if(_0x17086c['length']>0x0){_0xb98909[_0xe2da('0x15')](_0xe2da('0x13')+_0x3c1309+_0xe2da('0x16'),_['map'](_0x17086c,'id'));}return _0xb98909;}function getInteractionsQuery(_0x25d4fa){var _0x2c0353=utils[_0xe2da('0x17')](_0x25d4fa);var _0x33568f=utils['getAccountFK'](_0x25d4fa);var _0x45bb92=utils[_0xe2da('0xf')](_0x25d4fa);return squel[_0xe2da('0xa')]()[_0xe2da('0xd')](_0x2c0353[_0xe2da('0x18')],'i')['left_join'](_0xe2da('0x19'),'c',_0xe2da('0x1a'))['left_join'](_0xe2da('0x14'),'o',_0xe2da('0x1b'))[_0xe2da('0x1c')](_0x2c0353[_0xe2da('0x1d')],'a',_0xe2da('0x1e')+_0x33568f)[_0xe2da('0x1c')](_0x2c0353['messages'],'me',_0xe2da('0x1f')+_0x45bb92+'\x20=\x20i.id')[_0xe2da('0x1c')](_0x2c0353[_0xe2da('0x20')],'it',_0xe2da('0x21')+_0x45bb92+_0xe2da('0x22'))[_0xe2da('0x1c')](_0xe2da('0xe'),'t',_0xe2da('0x23'));}function getSqlClauses(){var _0x221e98={'body':squel['expr'](),'contact':squel[_0xe2da('0x24')](),'default':squel[_0xe2da('0x24')](),'fields':squel[_0xe2da('0x24')](),'filter':squel[_0xe2da('0x24')](),'read':squel[_0xe2da('0x24')](),'tags':{'clause':squel[_0xe2da('0x24')](),'ids':null},'user':squel[_0xe2da('0x24')]()};return _0x221e98;}function parseTagParameter(_0x56c37e){var _0x2adc49=squel[_0xe2da('0x24')]();if(_0x56c37e){var _0x1dc228=utils[_0xe2da('0x25')](_0x56c37e);_0x1dc228[_0xe2da('0x26')](function(_0x2b6c9e){_0x2adc49['or'](_0xe2da('0x27'),'%,'+_0x2b6c9e+',%');});}return _0x2adc49;}function parseReadParameter(_0x39f60e){var _0x516f42='';if(_0x39f60e){_0x516f42='unreadMessages\x20{OPERATOR}\x200';if(_0x39f60e==='1'){_0x516f42=_0x516f42['replace'](_0xe2da('0x28'),'=');}else{_0x516f42=_0x516f42[_0xe2da('0x29')](_0xe2da('0x28'),'>');}}return _0x516f42;}function parseSearchFilter(_0x1ab91a,_0x5de7fb){var _0x490794=squel[_0xe2da('0x24')]();if(_0x5de7fb){var _0x1ec8ca=_0x5de7fb[_0xe2da('0x29')]('\x5c','\x5c\x5c')[_0xe2da('0x29')](/'/g,'\x27\x27');if(qs[_0xe2da('0x2a')](_0x1ec8ca)){_0x490794['or'](_0xe2da('0x2b'),_0x1ec8ca+'%');if([_0xe2da('0x2c'),_0xe2da('0x2d')][_0xe2da('0x2e')](_0x1ab91a)){_0x490794['or']('i.phone\x20LIKE\x20?',_0x1ec8ca+'%');}else if(_0x1ab91a==='fax'){_0x490794['or'](_0xe2da('0x2f'),_0x1ec8ca+'%');}else if(_0x1ab91a===_0xe2da('0x30')){_0x490794['or'](_0xe2da('0x31'),_0x1ec8ca+'%');}}else if(_0x1ab91a===_0xe2da('0x32')&&qs[_0xe2da('0x33')](_0x1ec8ca)){_0x490794['or'](_0xe2da('0x34'),_0x1ec8ca+'%');}else{if(_0x1ab91a===_0xe2da('0x32')){_0x490794['or'](_0xe2da('0x35'),qs[_0xe2da('0x36')](_0x1ec8ca))['or'](_0xe2da('0x37'),qs[_0xe2da('0x36')](_0x1ec8ca));}else{if(_0x1ab91a!==_0xe2da('0x38')){_0x490794['or'](_0xe2da('0x39'),qs[_0xe2da('0x36')](_0x1ec8ca));}_0x490794['or'](_0xe2da('0x3a'),_0x1ec8ca+'%');}}}return _0x490794;}function parseAdvancedSearchFilter(_0x2618a1,_0x109d51){var _0x3a6f08=getSqlClauses();var _0x5a078e=as[_0xe2da('0x3b')](_0x2618a1);var _0x8bd0fc=_0x5a078e[_0xe2da('0x3c')];for(var _0x5e1f39=0x0;_0x5e1f39<_0x5a078e[_0xe2da('0x3d')][_0xe2da('0x3e')];_0x5e1f39++){var _0x262bf8=_0x5a078e['conditions'][_0x5e1f39];var _0x4d0963='i';var _0x156deb=_[_0xe2da('0x3f')](_0x109d51,['name',_0x262bf8[_0xe2da('0xb')]]);if(_0x156deb){var _0x15df09=as[_0xe2da('0x40')](_0x4d0963,_0x156deb[_0xe2da('0x41')],_0x262bf8);_0x3a6f08[_0xe2da('0x42')][_0x8bd0fc](_0x15df09['text'],_0x15df09[_0xe2da('0x43')]['start'],_0x15df09['value'][_0xe2da('0x44')]);}else{switch(_0x262bf8['field']){case _0xe2da('0x45'):var _0x27435b=parseReadParameter(_0x262bf8['value']);_0x3a6f08[_0xe2da('0x46')][_0xe2da('0x47')](_0x27435b);break;case'Contact':if(_0x262bf8['operator']==='$substring'){if(_0x262bf8[_0xe2da('0x43')][_0xe2da('0x48')]('\x20')[_0xe2da('0x3e')]>0x1){_0x3a6f08[_0xe2da('0x49')][_0x8bd0fc](_0xe2da('0x4a'),qs[_0xe2da('0x36')](_0x262bf8[_0xe2da('0x43')]),null);}else{var _0x4d4e90='%'+_0x262bf8[_0xe2da('0x43')]+'%';_0x3a6f08[_0xe2da('0x49')][_0x8bd0fc](_0xe2da('0x4b'),_0x4d4e90,_0x4d4e90,_0x4d4e90);}}else{_0x156deb=_[_0xe2da('0x3f')](_0x109d51,[_0xe2da('0xc'),'ContactId']);_0x262bf8[_0xe2da('0xb')]=_0xe2da('0x4c');_0x15df09=as[_0xe2da('0x40')](_0x4d0963,_0x156deb['type'],_0x262bf8);_0x3a6f08[_0xe2da('0x49')][_0x8bd0fc](_0x15df09[_0xe2da('0x4d')],_0x15df09[_0xe2da('0x43')][_0xe2da('0x4e')],_0x15df09[_0xe2da('0x43')][_0xe2da('0x44')]);}break;case _0xe2da('0x4f'):var _0x29ec1a=_0x262bf8['value'][_0xe2da('0x48')](',')[_0xe2da('0x50')](function(_0x2113e8){return Number(_0x2113e8);});var _0x3f970c=parseTagParameter(_0x29ec1a);_0x3a6f08[_0xe2da('0x51')]['clause'][_0xe2da('0x47')](_0x3f970c);_0x3a6f08[_0xe2da('0x51')][_0xe2da('0x52')]=_0x29ec1a;break;case _0xe2da('0x53'):if(_0x262bf8[_0xe2da('0x54')]===_0xe2da('0x55')){_0x3a6f08[_0xe2da('0x56')][_0x8bd0fc]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x262bf8[_0xe2da('0x43')]+'%',null);}else{_0x156deb=_['find'](_0x109d51,[_0xe2da('0xc'),_0xe2da('0x57')]);_0x262bf8[_0xe2da('0xb')]='UserId';_0x15df09=as[_0xe2da('0x40')](_0x4d0963,_0x156deb[_0xe2da('0x41')],_0x262bf8);_0x3a6f08['user'][_0x8bd0fc](_0x15df09[_0xe2da('0x4d')],_0x15df09[_0xe2da('0x43')][_0xe2da('0x4e')],_0x15df09['value'][_0xe2da('0x44')]);}break;case'body':case'plainBody':_0x15df09=as[_0xe2da('0x40')]('me',null,_0x262bf8);_0x3a6f08['body'][_0x8bd0fc](_0x15df09[_0xe2da('0x4d')],_0x15df09[_0xe2da('0x43')]['start'],_0x15df09[_0xe2da('0x43')][_0xe2da('0x44')]);break;}}}return _0x3a6f08;}function parseModelFields(_0x482547,_0x4a6d80,_0x101a46){var _0x49eb90=utils[_0xe2da('0x6')](_0x482547);var _0x448e06=squel[_0xe2da('0x24')]();var _0x1c17f1=_(_0x4a6d80)[_0xe2da('0x58')]()[_0xe2da('0x50')](function(_0x421467){return _[_0xe2da('0x59')](_0x101a46,[_0xe2da('0xc'),_0x421467])?_0x421467:undefined;})['compact']()[_0xe2da('0x43')]();if(_0x1c17f1[_0xe2da('0x3e')]>0x0){_0x1c17f1[_0xe2da('0x26')](function(_0x50c260){if(_0x50c260===_0x49eb90){_0x448e06[_0xe2da('0x47')]('i.'+_0x49eb90+_0xe2da('0x16'),[][_0xe2da('0x5a')](_0x4a6d80[_0x50c260]));}else if(_0x50c260===_0xe2da('0x5b')){var _0x242049=JSON[_0xe2da('0x5c')](_0x4a6d80[_0x50c260])[_0xe2da('0x5d')];var _0x563d1f=JSON['parse'](_0x4a6d80[_0x50c260])[_0xe2da('0x5e')];_0x448e06[_0xe2da('0x47')](_0xe2da('0x5f'),_0x242049,_0x563d1f);}else{if(_0x4a6d80[_0x50c260]==='null'){_0x448e06['and']('i.'+_0x50c260+_0xe2da('0x60'));}else{_0x448e06['and']('i.'+_0x50c260+_0xe2da('0x61'),_0x4a6d80[_0x50c260]);}}});}return _0x448e06;}function parseQueryParameters(_0x153749,_0x8e78b9,_0x3099aa){var _0x9b2155=getSqlClauses();return Promise[_0xe2da('0x62')]()[_0xe2da('0x63')](function(){return parseModelFields(_0x153749,_0x8e78b9,_0x3099aa);})[_0xe2da('0x63')](function(_0x21a19e){_0x9b2155['fields'][_0xe2da('0x47')](_0x21a19e);return parseReadParameter(_0x8e78b9[_0xe2da('0x46')]);})[_0xe2da('0x63')](function(_0x3d1dac){_0x9b2155['read'][_0xe2da('0x47')](_0x3d1dac);return parseTagParameter(_0x8e78b9[_0xe2da('0x64')]);})[_0xe2da('0x63')](function(_0x56f4b0){_0x9b2155[_0xe2da('0x51')][_0xe2da('0x65')][_0xe2da('0x47')](_0x56f4b0);return parseSearchFilter(_0x153749,_0x8e78b9[_0xe2da('0x66')]);})[_0xe2da('0x63')](function(_0x22a571){_0x9b2155[_0xe2da('0x66')]=_0x22a571;return _0x9b2155;});}function checkAccountsRestrictions(_0x377db9,_0x2cbe1c,_0x1d6077){var _0x154877=utils[_0xe2da('0x6')](_0x377db9);var _0x505c24=_0xe2da('0x67')+_[_0xe2da('0x68')](_0x377db9)+(_0x377db9===_0xe2da('0x69')?_0xe2da('0x6a'):_0xe2da('0x6b'));var _0x277e8c=squel[_0xe2da('0x24')]();return Promise['resolve']()[_0xe2da('0x63')](function(){if(_0x1d6077['search']&&_0x2cbe1c[_0xe2da('0x7')]===_0xe2da('0x8')){return _0x2cbe1c[_0x505c24]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x4e6c52){if(_0x4e6c52){if(_0x4e6c52[_0xe2da('0x3e')]===0x0){_0x277e8c['and']('i.'+_0x154877+_0xe2da('0x60'));}else{_0x277e8c['and']('i.'+_0x154877+_0xe2da('0x16'),_[_0xe2da('0x50')](_0x4e6c52,'id'));}}else if(!_0x1d6077[_0x154877]){_0x277e8c[_0xe2da('0x47')]('i.'+_0x154877+'\x20IS\x20NOT\x20NULL');}})['then'](function(){return _0x277e8c;});}function getClosedOrderClause(_0x5f280f,_0x3ef7c7){var _0x1fa149='';var _0x104f47=[_0xe2da('0x6c'),'i.secondDisposition',_0xe2da('0x6d')];if(_0x5f280f===_0xe2da('0x32')){_0x104f47[_0xe2da('0x6e')](_0xe2da('0x6f'));}if(_0x3ef7c7[_0xe2da('0x70')]==='0'&&_0x5f280f===_0xe2da('0x32')){_0x1fa149=_0xe2da('0x6f');}else{if(_0x3ef7c7['closed']==='1'){_0x104f47[_0xe2da('0x71')]();}_0x1fa149=_0xe2da('0x72')+_0x104f47[_0xe2da('0x73')](',\x20')+')';}return _0x1fa149;}function getFilteredInteractions(_0x1bff50,_0x16537b,_0x4cf58d,_0x841de3){var _0x56c488=utils[_0xe2da('0xf')](_0x1bff50);var _0x4d5997=_[_0xe2da('0x68')](_0x1bff50)+'Interaction';var _0x58f9db=[];var _0x12b911=getTagsQuery();var _0x405743={'type':db[_0xe2da('0x74')][_0xe2da('0x75')][_0xe2da('0x76')],'raw':!![]};var _0x44b96e=[];var _0x1d10a1=[];return db[_0xe2da('0x77')][_0xe2da('0x78')](_0x12b911[_0xe2da('0x79')](),_0x405743)['then'](function(_0x430a65){_0x58f9db=_[_0xe2da('0x7a')](_0x430a65,'id');_0x405743=_[_0xe2da('0x7b')](_0x405743,{'model':db[_0x4d5997],'mapToModel':!![],'nest':!![]});if(_0x4cf58d[_0xe2da('0x7c')]){_0x841de3['attributes'][_0xe2da('0x26')](function(_0x9877c2){_0x16537b[_0xe2da('0xb')]('i.'+_0x9877c2);});}else{_0x16537b[_0xe2da('0xb')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xe2da('0x45'));_0x16537b['field'](_0xe2da('0x7d'),_0xe2da('0x7e'));_0x16537b['field'](_0xe2da('0x7f'),_0xe2da('0x80'));if(_0x1bff50===_0xe2da('0x32')){_0x16537b[_0xe2da('0xb')](_0xe2da('0x81'),'Account.email');_0x16537b[_0xe2da('0xb')]('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');_0x16537b['field']('i.id');_0x16537b[_0xe2da('0xb')](_0xe2da('0x82'));_0x16537b[_0xe2da('0xb')](_0xe2da('0x83'));_0x16537b[_0xe2da('0xb')](_0xe2da('0x84'));_0x16537b[_0xe2da('0xb')](_0xe2da('0x85'));_0x16537b[_0xe2da('0xb')]('i.attach');_0x16537b[_0xe2da('0xb')](_0xe2da('0x86'));_0x16537b[_0xe2da('0xb')](_0xe2da('0x87'));_0x16537b[_0xe2da('0xb')](_0xe2da('0x88'));_0x16537b[_0xe2da('0xb')](_0xe2da('0x6d'));_0x16537b[_0xe2da('0xb')](_0xe2da('0x89'));_0x16537b['field'](_0xe2da('0x6c'));_0x16537b[_0xe2da('0xb')](_0xe2da('0x6f'));_0x16537b[_0xe2da('0xb')](_0xe2da('0x8a'));_0x16537b[_0xe2da('0xb')](_0xe2da('0x8b'));_0x16537b[_0xe2da('0xb')](_0xe2da('0x8c'));_0x16537b[_0xe2da('0xb')](_0xe2da('0x8d'));}else if(_0x1bff50===_0xe2da('0x30')){_0x16537b['field'](_0xe2da('0x8e'),'contactName');}else{_0x16537b[_0xe2da('0xb')](_0xe2da('0x8f'),_0xe2da('0x90'));}if(_0x1bff50!==_0xe2da('0x32')){_0x16537b[_0xe2da('0xb')](_0xe2da('0x91'));}_0x16537b[_0xe2da('0xb')]('c.firstName',_0xe2da('0x92'));_0x16537b[_0xe2da('0xb')](_0xe2da('0x93'),_0xe2da('0x94'));_0x16537b[_0xe2da('0xb')](_0xe2da('0x95'),'Contact.email');_0x16537b[_0xe2da('0xb')](_0xe2da('0x96'),_0xe2da('0x97'));_0x16537b[_0xe2da('0xb')](_0xe2da('0x98'),_0xe2da('0x99'));_0x16537b[_0xe2da('0xb')]('c.fax',_0xe2da('0x9a'));_0x16537b[_0xe2da('0xb')](_0xe2da('0x9b'),_0xe2da('0x9c'));_0x16537b[_0xe2da('0xb')](_0xe2da('0x9d'),'Owner.internal');_0x16537b[_0xe2da('0xb')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x841de3[_0xe2da('0x9e')]){_0x16537b[_0xe2da('0x9e')](_0x841de3[_0xe2da('0x9e')]);}if(_0x841de3['offset']){_0x16537b[_0xe2da('0x9f')](_0x841de3[_0xe2da('0x9f')]);}return db[_0xe2da('0x77')][_0xe2da('0x78')](_0x16537b['toString'](),_0x405743);})[_0xe2da('0x63')](function(_0x4e2325){_0x44b96e=_0x4e2325;var _0x4ccff8=getUsersQuery(_0x1bff50,_0x44b96e);return db[_0xe2da('0x77')][_0xe2da('0x78')](_0x4ccff8[_0xe2da('0x79')](),_0x405743);})[_0xe2da('0x63')](function(_0x317dc9){_0x1d10a1=_[_0xe2da('0xa0')](_0x317dc9,_0x56c488);if(_0x1bff50==='mail'){return db[_0xe2da('0xa1')][_0xe2da('0xa2')]({'attributes':[_0xe2da('0xa3')],'raw':!![]});}})['then'](function(_0x3a4104){var _0xfe78a1=_0x3a4104?_0x3a4104[_0xe2da('0xa3')]:undefined;var _0x4af523=_0x44b96e[_0xe2da('0x50')](function(_0x12667e){return updateInteraction(_0x12667e,_0x58f9db,_0x1d10a1,_0xfe78a1);});return Promise[_0xe2da('0xa4')](_0x4af523);});}function countFilteredInteractions(_0x2f4c3a,_0x283fb4){var _0x52fadf=_0x2f4c3a[_0xe2da('0xa5')]();_0x52fadf[_0xe2da('0xb')](_0xe2da('0xa6'));_0x52fadf[_0xe2da('0xb')](_0xe2da('0xa7'),_0xe2da('0x45'));var _0x1fff3f=utils[_0xe2da('0x25')](_0x283fb4);if(!_[_0xe2da('0xa8')](_0x1fff3f)){_0x52fadf['where'](_0xe2da('0xa9'),_0x1fff3f);}var _0x38fc64={'type':db['Sequelize'][_0xe2da('0x75')]['SELECT'],'raw':!![]};return db['sequelize']['query'](_0x52fadf[_0xe2da('0x79')](),_0x38fc64);}module[_0xe2da('0xaa')]={'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 fcf8b74..98ffacb 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 _0xc7d1=['-id','then','lastMsgText','trimStart','catch','updateInteraction','Users','Tags','TagIds','../../mysqldb','map','fullname','split','push','waiting','answered','unmanaged','abandoned','closed','UserId','talking','disposition','total','MailMessage','findOne','out','plainBody'];(function(_0x573c51,_0x499532){var _0x468a50=function(_0x54a005){while(--_0x54a005){_0x573c51['push'](_0x573c51['shift']());}};_0x468a50(++_0x499532);}(_0xc7d1,0xfc));var _0x1c7d=function(_0x91ca02,_0xf7ef3){_0x91ca02=_0x91ca02-0x0;var _0x205c8b=_0xc7d1[_0x91ca02];return _0x205c8b;};'use strict';var _=require('lodash');var db=require(_0x1c7d('0x0'))['db'];function getInteractionUsers(_0x4d6b56,_0x346f6e){return new Promise(function(_0x547dae,_0x159d2e){try{var _0x3729ae=[];if(_0x346f6e[_0x4d6b56]){_0x3729ae=_0x346f6e[_0x4d6b56][_0x1c7d('0x1')](function(_0x4a13a5){return{'id':_0x4a13a5['id'],'fullname':_0x4a13a5[_0x1c7d('0x2')]};});}return _0x547dae(_0x3729ae);}catch(_0x3cc9ca){_0x159d2e(_0x3cc9ca);}});}function getInteractionTags(_0x4c0eeb,_0x18047b){var _0x36e119=[];if(_0x4c0eeb){_0x4c0eeb[_0x1c7d('0x3')](',')['forEach'](function(_0x25a0ff){_0x36e119[_0x1c7d('0x4')](_0x18047b[_0x25a0ff]);});}return _0x36e119;}function updateWaitingCounter(_0x326100){if(_0x326100[_0x1c7d('0x5')]){_0x326100[_0x1c7d('0x5')]-=0x1;}}function updateInteractionCounters(_0xa2448b){_0xa2448b[_0x1c7d('0x5')]=0x0;_0xa2448b['talking']=0x0;_0xa2448b[_0x1c7d('0x6')]=0x0;_0xa2448b[_0x1c7d('0x7')]=0x0;_0xa2448b[_0x1c7d('0x8')]=0x0;_0xa2448b['total']=0x0;if(_0xa2448b[_0x1c7d('0x9')]){if(_0xa2448b['disposition']===_0x1c7d('0x8')){_0xa2448b['abandoned']+=0x1;updateWaitingCounter(_0xa2448b);}if(_0xa2448b[_0x1c7d('0xa')]){_0xa2448b[_0x1c7d('0x6')]+=0x1;if(_0xa2448b[_0x1c7d('0xb')]){_0xa2448b['talking']-=0x1;}}else{if(_0xa2448b[_0x1c7d('0xc')]){_0xa2448b['unmanaged']+=0x1;updateWaitingCounter(_0xa2448b);}}}else{if(!_0xa2448b['UserId']){_0xa2448b[_0x1c7d('0x5')]+=0x1;}if(_0xa2448b['UserId']){_0xa2448b[_0x1c7d('0xb')]+=0x1;updateWaitingCounter(_0xa2448b);}}_0xa2448b[_0x1c7d('0xd')]+=0x1;return _0xa2448b;}function getLastMessageText(_0x260517){return db[_0x1c7d('0xe')][_0x1c7d('0xf')]({'where':{'$and':[{'MailInteractionId':_0x260517['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x1c7d('0x10')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x1c7d('0x11')],'order':_0x1c7d('0x12'),'raw':!![]})[_0x1c7d('0x13')](function(_0x427a5a){if(_0x427a5a&&_0x427a5a[_0x1c7d('0x11')]){_0x260517[_0x1c7d('0x14')]=_[_0x1c7d('0x15')](_0x427a5a[_0x1c7d('0x11')]);}return _0x260517;})[_0x1c7d('0x16')](function(_0x5b81af){throw _0x5b81af;});}exports[_0x1c7d('0x17')]=function(_0x28ad9d,_0x5b2cf1,_0x9fe12d,_0x386593){return new Promise(function(_0x17bc4c,_0x42f3c6){return getInteractionUsers(_0x28ad9d['id'],_0x9fe12d)[_0x1c7d('0x13')](function(_0x4614a3){_0x28ad9d[_0x1c7d('0x18')]=_0x4614a3;return getInteractionTags(_0x28ad9d['TagIds'],_0x5b2cf1);})[_0x1c7d('0x13')](function(_0x3d34ff){_0x28ad9d[_0x1c7d('0x19')]=_0x3d34ff;delete _0x28ad9d[_0x1c7d('0x1a')];return updateInteractionCounters(_0x28ad9d);})[_0x1c7d('0x13')](function(_0x54e490){if(_0x386593){return getLastMessageText(_0x54e490);}else{return _0x54e490;}})[_0x1c7d('0x13')](function(_0x3abbab){_0x17bc4c(_0x3abbab);})[_0x1c7d('0x16')](function(_0x134192){_0x42f3c6(_0x134192);});});}; \ No newline at end of file +var _0xfa69=['-id','then','plainBody','lastMsgText','trimStart','catch','updateInteraction','Users','TagIds','Tags','lodash','../../mysqldb','map','fullname','split','forEach','waiting','talking','unmanaged','total','disposition','abandoned','UserId','answered','MailMessage','out'];(function(_0x2ce846,_0x23aa4e){var _0x4d7802=function(_0x28af5a){while(--_0x28af5a){_0x2ce846['push'](_0x2ce846['shift']());}};_0x4d7802(++_0x23aa4e);}(_0xfa69,0x8c));var _0x9fa6=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xfa69[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x9fa6('0x0'));var db=require(_0x9fa6('0x1'))['db'];function getInteractionUsers(_0x23d74f,_0x4f2665){return new Promise(function(_0x18e31b,_0x3f4fec){try{var _0x1dfeca=[];if(_0x4f2665[_0x23d74f]){_0x1dfeca=_0x4f2665[_0x23d74f][_0x9fa6('0x2')](function(_0x2bb7da){return{'id':_0x2bb7da['id'],'fullname':_0x2bb7da[_0x9fa6('0x3')]};});}return _0x18e31b(_0x1dfeca);}catch(_0x4865bd){_0x3f4fec(_0x4865bd);}});}function getInteractionTags(_0x3c7743,_0x110cbc){var _0x195564=[];if(_0x3c7743){_0x3c7743[_0x9fa6('0x4')](',')[_0x9fa6('0x5')](function(_0x282b63){_0x195564['push'](_0x110cbc[_0x282b63]);});}return _0x195564;}function updateWaitingCounter(_0x1ea8f0){if(_0x1ea8f0[_0x9fa6('0x6')]){_0x1ea8f0[_0x9fa6('0x6')]-=0x1;}}function updateInteractionCounters(_0x398fb1){_0x398fb1[_0x9fa6('0x6')]=0x0;_0x398fb1[_0x9fa6('0x7')]=0x0;_0x398fb1['answered']=0x0;_0x398fb1[_0x9fa6('0x8')]=0x0;_0x398fb1['abandoned']=0x0;_0x398fb1[_0x9fa6('0x9')]=0x0;if(_0x398fb1['closed']){if(_0x398fb1[_0x9fa6('0xa')]===_0x9fa6('0xb')){_0x398fb1[_0x9fa6('0xb')]+=0x1;updateWaitingCounter(_0x398fb1);}if(_0x398fb1[_0x9fa6('0xc')]){_0x398fb1[_0x9fa6('0xd')]+=0x1;if(_0x398fb1[_0x9fa6('0x7')]){_0x398fb1[_0x9fa6('0x7')]-=0x1;}}else{if(_0x398fb1[_0x9fa6('0xa')]){_0x398fb1[_0x9fa6('0x8')]+=0x1;updateWaitingCounter(_0x398fb1);}}}else{if(!_0x398fb1[_0x9fa6('0xc')]){_0x398fb1['waiting']+=0x1;}if(_0x398fb1[_0x9fa6('0xc')]){_0x398fb1['talking']+=0x1;updateWaitingCounter(_0x398fb1);}}_0x398fb1[_0x9fa6('0x9')]+=0x1;return _0x398fb1;}function getLastMessageText(_0x4a1780){return db[_0x9fa6('0xe')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x4a1780['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x9fa6('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x9fa6('0x10'),'raw':!![]})[_0x9fa6('0x11')](function(_0x51828a){if(_0x51828a&&_0x51828a[_0x9fa6('0x12')]){_0x4a1780[_0x9fa6('0x13')]=_[_0x9fa6('0x14')](_0x51828a[_0x9fa6('0x12')]);}return _0x4a1780;})[_0x9fa6('0x15')](function(_0x3f573b){throw _0x3f573b;});}exports[_0x9fa6('0x16')]=function(_0x2789cd,_0x232e8a,_0x3763c6,_0x262f29){return new Promise(function(_0x3f08da,_0x45a789){return getInteractionUsers(_0x2789cd['id'],_0x3763c6)['then'](function(_0x5da77e){_0x2789cd[_0x9fa6('0x17')]=_0x5da77e;return getInteractionTags(_0x2789cd[_0x9fa6('0x18')],_0x232e8a);})['then'](function(_0x261160){_0x2789cd[_0x9fa6('0x19')]=_0x261160;delete _0x2789cd['TagIds'];return updateInteractionCounters(_0x2789cd);})[_0x9fa6('0x11')](function(_0x3860f6){if(_0x262f29){return getLastMessageText(_0x3860f6);}else{return _0x3860f6;}})[_0x9fa6('0x11')](function(_0x2f24e5){_0x3f08da(_0x2f24e5);})[_0x9fa6('0x15')](function(_0x25b3f6){_0x45a789(_0x25b3f6);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index de59930..f322bac 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 _0x87d9=['info','catch','exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','capitalize','chat','Website','InteractionId','upperFirst','unknown','websites','accounts','_interactions','_interaction_has_tags','_messages','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','then','update'];(function(_0x266cb9,_0x43c3a0){var _0x53e316=function(_0x38b707){while(--_0x38b707){_0x266cb9['push'](_0x266cb9['shift']());}};_0x53e316(++_0x43c3a0);}(_0x87d9,0x147));var _0x987d=function(_0x1ce236,_0xca922e){_0x1ce236=_0x1ce236-0x0;var _0x241819=_0x87d9[_0x1ce236];return _0x241819;};'use strict';var _=require(_0x987d('0x0'));var db=require(_0x987d('0x1'))['db'];var loggers={'openchannel':require(_0x987d('0x2'))(_0x987d('0x3')),'mail':require(_0x987d('0x2'))(_0x987d('0x4')),'fax':require(_0x987d('0x2'))(_0x987d('0x5')),'sms':require('../../config/logger')(_0x987d('0x6')),'chat':require(_0x987d('0x2'))(_0x987d('0x7')),'whatsapp':require(_0x987d('0x2'))('whatsapp-interactions')};function getAccountFK(_0x180b7c){return _[_0x987d('0x8')](_0x180b7c)+(_0x180b7c===_0x987d('0x9')?_0x987d('0xa'):'Account')+'Id';}function getInteractionFK(_0x1fb924){return _[_0x987d('0x8')](_0x1fb924)+_0x987d('0xb');}function getInteractionId(_0x41868d,_0x177a51,_0x40d49f){if(_0x41868d&&_0x41868d[_[_0x987d('0xc')](_0x40d49f)+_0x987d('0xb')]){return _0x41868d[_[_0x987d('0xc')](_0x40d49f)+'InteractionId'];}else if(_0x41868d&&_0x41868d['id']){return _0x41868d['id'];}else if(_0x177a51&&_0x177a51['id']){return _0x177a51['id'];}else{return _0x987d('0xd');}}function getInteractionsTables(_0x689c1b){return{'accounts':_0x689c1b+'_'+(_0x689c1b===_0x987d('0x9')?_0x987d('0xe'):_0x987d('0xf')),'interactions':_0x689c1b+_0x987d('0x10'),'interactionsTags':_0x689c1b+_0x987d('0x11'),'messages':_0x689c1b+_0x987d('0x12'),'userInteractions':'user_has_'+_0x689c1b+_0x987d('0x10')};}function getSelectedTags(_0x44d2ee){var _0x17863f=[];if(_0x44d2ee){_0x17863f=Array['isArray'](_0x44d2ee)?_0x44d2ee:[_0x44d2ee];}return _0x17863f;}function log(_0x328db4,_0xfb782c,_0x554965,_0x1f1e55,_0x414683,_0x1c94b7){loggers[_0x414683[_0x987d('0x13')]()][_0x328db4](_0x987d('0x14'),_0x1c94b7[_0x987d('0x15')](),_0xfb782c?_0xfb782c['id']:null,_0xfb782c?_0xfb782c['name']:null,_0xfb782c?_0xfb782c['role']:null,getInteractionId(_0x554965,_0x1f1e55,_0x414683),_0x554965?JSON['stringify'](_0x554965):'null');}function updateUser(_0x1b6214,_0x5d15f2,_0x14791d,_0x21f815,_0x28e82c){db[_['upperFirst'](_0x21f815)+'Interaction']['findOne']({'where':{'id':getInteractionId(_0x5d15f2,_0x14791d,_0x21f815)}})[_0x987d('0x16')](function(_0x273b04){if(_0x273b04){return _0x273b04[_0x987d('0x17')]({'UserId':_0x1b6214?_0x1b6214['id']:null});}})[_0x987d('0x16')](function(_0x1008d1){if(_0x1008d1){log(_0x987d('0x18'),_0x1b6214,_0x5d15f2,_0x14791d,_0x21f815,_0x28e82c);}})[_0x987d('0x19')](function(){log('error',_0x1b6214,_0x5d15f2,_0x14791d,_0x21f815,_0x28e82c);});}module[_0x987d('0x1a')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x0ccd=['capitalize','Website','Account','InteractionId','upperFirst','chat','websites','accounts','_interactions','_interaction_has_tags','_messages','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','then','update','catch','error','exports','lodash','../../mysqldb','openchannel-interactions','../../config/logger','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions'];(function(_0x34750b,_0x34aae5){var _0x244258=function(_0x503bf2){while(--_0x503bf2){_0x34750b['push'](_0x34750b['shift']());}};_0x244258(++_0x34aae5);}(_0x0ccd,0xb7));var _0xd0cc=function(_0x1b7ea6,_0x195a62){_0x1b7ea6=_0x1b7ea6-0x0;var _0x4fcea6=_0x0ccd[_0x1b7ea6];return _0x4fcea6;};'use strict';var _=require(_0xd0cc('0x0'));var db=require(_0xd0cc('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0xd0cc('0x2')),'mail':require(_0xd0cc('0x3'))(_0xd0cc('0x4')),'fax':require('../../config/logger')(_0xd0cc('0x5')),'sms':require('../../config/logger')(_0xd0cc('0x6')),'chat':require('../../config/logger')(_0xd0cc('0x7')),'whatsapp':require('../../config/logger')(_0xd0cc('0x8'))};function getAccountFK(_0x3b0d0f){return _[_0xd0cc('0x9')](_0x3b0d0f)+(_0x3b0d0f==='chat'?_0xd0cc('0xa'):_0xd0cc('0xb'))+'Id';}function getInteractionFK(_0xc1f45){return _[_0xd0cc('0x9')](_0xc1f45)+_0xd0cc('0xc');}function getInteractionId(_0xecad11,_0x386f12,_0x5dcfc2){if(_0xecad11&&_0xecad11[_['upperFirst'](_0x5dcfc2)+_0xd0cc('0xc')]){return _0xecad11[_[_0xd0cc('0xd')](_0x5dcfc2)+_0xd0cc('0xc')];}else if(_0xecad11&&_0xecad11['id']){return _0xecad11['id'];}else if(_0x386f12&&_0x386f12['id']){return _0x386f12['id'];}else{return'unknown';}}function getInteractionsTables(_0x15fe56){return{'accounts':_0x15fe56+'_'+(_0x15fe56===_0xd0cc('0xe')?_0xd0cc('0xf'):_0xd0cc('0x10')),'interactions':_0x15fe56+_0xd0cc('0x11'),'interactionsTags':_0x15fe56+_0xd0cc('0x12'),'messages':_0x15fe56+_0xd0cc('0x13'),'userInteractions':'user_has_'+_0x15fe56+'_interactions'};}function getSelectedTags(_0x5ee92a){var _0x5b6069=[];if(_0x5ee92a){_0x5b6069=Array['isArray'](_0x5ee92a)?_0x5ee92a:[_0x5ee92a];}return _0x5b6069;}function log(_0xe4df29,_0x528a28,_0x267a00,_0x4502ab,_0x49ae02,_0x27503a){loggers[_0x49ae02['toLowerCase']()][_0xe4df29](_0xd0cc('0x14'),_0x27503a[_0xd0cc('0x15')](),_0x528a28?_0x528a28['id']:null,_0x528a28?_0x528a28[_0xd0cc('0x16')]:null,_0x528a28?_0x528a28[_0xd0cc('0x17')]:null,getInteractionId(_0x267a00,_0x4502ab,_0x49ae02),_0x267a00?JSON[_0xd0cc('0x18')](_0x267a00):_0xd0cc('0x19'));}function updateUser(_0x2ee3dd,_0x4fa441,_0x1f3451,_0x424d01,_0x23e04b){db[_[_0xd0cc('0xd')](_0x424d01)+_0xd0cc('0x1a')]['findOne']({'where':{'id':getInteractionId(_0x4fa441,_0x1f3451,_0x424d01)}})[_0xd0cc('0x1b')](function(_0x358c59){if(_0x358c59){return _0x358c59[_0xd0cc('0x1c')]({'UserId':_0x2ee3dd?_0x2ee3dd['id']:null});}})[_0xd0cc('0x1b')](function(_0x14d626){if(_0x14d626){log('info',_0x2ee3dd,_0x4fa441,_0x1f3451,_0x424d01,_0x23e04b);}})[_0xd0cc('0x1d')](function(){log(_0xd0cc('0x1e'),_0x2ee3dd,_0x4fa441,_0x1f3451,_0x424d01,_0x23e04b);});}module[_0xd0cc('0x1f')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 7107b67..a05bd3e 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 _0x2806=['User','admin','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','final','parse','use','License','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users'];(function(_0x22c4d7,_0x519ab3){var _0x2345ec=function(_0x320a08){while(--_0x320a08){_0x22c4d7['push'](_0x22c4d7['shift']());}};_0x2345ec(++_0x519ab3);}(_0x2806,0xf4));var _0x6280=function(_0x14f332,_0x3b2250){_0x14f332=_0x14f332-0x0;var _0x515be8=_0x2806[_0x14f332];return _0x515be8;};'use strict';var crypto=require(_0x6280('0x0'));var util=require(_0x6280('0x1'));var compose=require(_0x6280('0x2'));var db=require(_0x6280('0x3'))['db'];var config=require(_0x6280('0x4'));function getValueFromLicense(_0x1fe7b1,_0x2b0dff){if(_0x1fe7b1&&_0x2b0dff){if(_0x2b0dff[_0x6280('0x5')]&&_0x2b0dff[_0x6280('0x6')]){var _0x549679=_0x2b0dff[_0x6280('0x5')];var _0x40b95a=_0x2b0dff['license'];var _0x4d62f7=_0x549679[_0x6280('0x7')]('-')[0x4];var _0x54b28e=_0x549679[_0x6280('0x7')]('-')[0x0];var _0x144b38=crypto[_0x6280('0x8')](_0x6280('0x9'),util[_0x6280('0xa')](_0x6280('0xb'),_0x4d62f7,_0x549679,_0x54b28e));var _0x483f5d=_0x144b38[_0x6280('0xc')](_0x40b95a,_0x6280('0xd'),'utf8');_0x483f5d+=_0x144b38[_0x6280('0xe')]('utf8');var _0x3f4b8a=JSON[_0x6280('0xf')](_0x483f5d);return _0x3f4b8a['hasOwnProperty'](_0x1fe7b1)?_0x3f4b8a[_0x1fe7b1]:null;}}return null;}function isLimit(_0x63cce4,_0x1dedc9,_0x4e91e8,_0x24f84c){var _0x24d242=_0x1dedc9;return compose()[_0x6280('0x10')](function(_0x4787e2,_0x20354f,_0x532ee1){return db[_0x6280('0x11')][_0x6280('0x12')]({'where':{'id':0x1},'raw':!![]})[_0x6280('0x13')](function(_0x55b676){var _0x31461f=getValueFromLicense(_0x63cce4,_0x55b676);return _0x31461f?_0x31461f:_0x24d242;})[_0x6280('0x13')](function(_0x12dcfc){_0x24d242=_0x12dcfc;return _0x4e91e8[_0x6280('0x14')](_0x24f84c);})[_0x6280('0x13')](function(_0x9cd7fc){if(_0x9cd7fc>=_0x24d242){return _0x20354f[_0x6280('0x15')](0x193)[_0x6280('0x16')]({'message':util[_0x6280('0xa')](_0x6280('0x17'),_0x63cce4)});}_0x532ee1();})[_0x6280('0x18')](function(_0x549fc8){_0x532ee1(_0x549fc8);});});}function isUserLimit(){return isLimit(_0x6280('0x19'),0x1,db[_0x6280('0x1a')],{'where':{'$or':[{'role':_0x6280('0x1b')},{'role':_0x6280('0x1c')}]}});}exports[_0x6280('0x1d')]=isUserLimit; \ No newline at end of file +var _0x3a99=['parse','hasOwnProperty','License','then','status','catch','User','user','isUserLimit','crypto','util','composable-middleware','../../config/environment','license','data1','split','createDecipher','format','%s:%s:%s','update','base64','utf8','final'];(function(_0x5650d7,_0x51f443){var _0x42431d=function(_0x5262c2){while(--_0x5262c2){_0x5650d7['push'](_0x5650d7['shift']());}};_0x42431d(++_0x51f443);}(_0x3a99,0x1d5));var _0x93a9=function(_0x8fa54,_0x4b4fa1){_0x8fa54=_0x8fa54-0x0;var _0x30107d=_0x3a99[_0x8fa54];return _0x30107d;};'use strict';var crypto=require(_0x93a9('0x0'));var util=require(_0x93a9('0x1'));var compose=require(_0x93a9('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0x93a9('0x3'));function getValueFromLicense(_0x6fc639,_0x10ca9a){if(_0x6fc639&&_0x10ca9a){if(_0x10ca9a['data1']&&_0x10ca9a[_0x93a9('0x4')]){var _0x354fac=_0x10ca9a[_0x93a9('0x5')];var _0x54d7e4=_0x10ca9a[_0x93a9('0x4')];var _0x3480e3=_0x354fac[_0x93a9('0x6')]('-')[0x4];var _0x5f4ed1=_0x354fac[_0x93a9('0x6')]('-')[0x0];var _0x335cb6=crypto[_0x93a9('0x7')]('aes-256-ctr',util[_0x93a9('0x8')](_0x93a9('0x9'),_0x3480e3,_0x354fac,_0x5f4ed1));var _0x519e92=_0x335cb6[_0x93a9('0xa')](_0x54d7e4,_0x93a9('0xb'),_0x93a9('0xc'));_0x519e92+=_0x335cb6[_0x93a9('0xd')](_0x93a9('0xc'));var _0x2006b4=JSON[_0x93a9('0xe')](_0x519e92);return _0x2006b4[_0x93a9('0xf')](_0x6fc639)?_0x2006b4[_0x6fc639]:null;}}return null;}function isLimit(_0x486bfd,_0x18b7c3,_0x1c37a5,_0x4ee255){var _0x257a7f=_0x18b7c3;return compose()['use'](function(_0x2f286f,_0x23c0d0,_0x591eca){return db[_0x93a9('0x10')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x93a9('0x11')](function(_0x4ab81a){var _0xf2f6da=getValueFromLicense(_0x486bfd,_0x4ab81a);return _0xf2f6da?_0xf2f6da:_0x257a7f;})[_0x93a9('0x11')](function(_0x12ed8b){_0x257a7f=_0x12ed8b;return _0x1c37a5['count'](_0x4ee255);})[_0x93a9('0x11')](function(_0x1792bc){if(_0x1792bc>=_0x257a7f){return _0x23c0d0[_0x93a9('0x12')](0x193)['json']({'message':util[_0x93a9('0x8')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x486bfd)});}_0x591eca();})[_0x93a9('0x13')](function(_0x18738f){_0x591eca(_0x18738f);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x93a9('0x14')],{'where':{'$or':[{'role':'admin'},{'role':_0x93a9('0x15')}]}});}exports[_0x93a9('0x16')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 3f11869..7de939d 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 _0xf174=['value','includes','$gt','$lte','add','castTo','CAST(','field','\x20AS\x20','text','$ne','$notIn','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','<=\x20?','$gte','>=\x20?','$between','BETWEEN\x20?\x20AND\x20?','start','pop','format','minutes','seconds','moment','parseSearch','sqlOperator','startsWith','[$or]','and','length','split','shift','match','forEach','filter','indexOf','map','conditions','push','buildExpression','DATE','operator','$eq'];(function(_0x17774f,_0x5d24bd){var _0x258615=function(_0x124c33){while(--_0x124c33){_0x17774f['push'](_0x17774f['shift']());}};_0x258615(++_0x5d24bd);}(_0xf174,0x12a));var _0x4f17=function(_0x2df944,_0x5ea810){_0x2df944=_0x2df944-0x0;var _0x1cd642=_0xf174[_0x2df944];return _0x1cd642;};'use strict';var _=require('lodash');var moment=require(_0x4f17('0x0'));exports[_0x4f17('0x1')]=function(_0x35d057){var _0x50a739={'conditions':[]};_0x50a739[_0x4f17('0x2')]=_[_0x4f17('0x3')](_0x35d057,_0x4f17('0x4'))?'or':_0x4f17('0x5');var _0x1cccb1=_0x35d057['replace']('[$and]','')['replace'](_0x4f17('0x4'),'')['split']('||');for(var _0xdce978=0x0;_0xdce978<_0x1cccb1[_0x4f17('0x6')];_0xdce978++){var _0x321ce2=_0x1cccb1[_0xdce978][_0x4f17('0x7')](':=');var _0x44e452=_0x321ce2[0x0];var _0x26b6d5=_0x321ce2['slice'](0x1);_0x26b6d5['forEach'](function(_0x47628f){var _0x33f876=_0x47628f['split']('[')[_0x4f17('0x8')]();var _0x377c77=_0x47628f[_0x4f17('0x9')](/\[(.*?)\]/g);_0x377c77[_0x4f17('0xa')](function(_0x3534ca){var _0x56694b=_0x3534ca[_0x4f17('0x7')]('[')[_0x4f17('0xb')](function(_0x5d4f9c){return _0x5d4f9c[_0x4f17('0xc')](']')>-0x1;})[_0x4f17('0xd')](function(_0x571471){return _0x571471['split'](']')[0x0];})[0x0];_0x50a739[_0x4f17('0xe')][_0x4f17('0xf')]({'field':_0x44e452,'operator':_0x33f876,'value':_0x56694b});});});}return _0x50a739;};exports[_0x4f17('0x10')]=function(_0x2bb5f1,_0x52c292,_0x1e60ea){var _0x107b78={};if(_0x52c292===_0x4f17('0x11')){if(_0x1e60ea[_0x4f17('0x12')]===_0x4f17('0x13')){_0x1e60ea['operator']='$between';_0x1e60ea[_0x4f17('0x14')]+=','+_0x1e60ea['value'];}else if(_[_0x4f17('0x15')]([_0x4f17('0x16'),_0x4f17('0x17')],_0x1e60ea[_0x4f17('0x12')])){_0x1e60ea[_0x4f17('0x14')]=moment(_0x1e60ea['value'])[_0x4f17('0x18')](0x1,'days')['format']('YYYY-MM-DD');}}if(_0x1e60ea[_0x4f17('0x19')]){_0x52c292=_0x1e60ea['castTo'];_0x107b78['text']=_0x4f17('0x1a')+_0x2bb5f1+'.'+_0x1e60ea[_0x4f17('0x1b')]+_0x4f17('0x1c')+_0x1e60ea[_0x4f17('0x19')]+')\x20'+parseOperator(_0x1e60ea[_0x4f17('0x12')]);}else{_0x107b78[_0x4f17('0x1d')]=_0x2bb5f1+'.'+_0x1e60ea[_0x4f17('0x1b')]+'\x20'+parseOperator(_0x1e60ea[_0x4f17('0x12')]);}if(_['includes']([_0x4f17('0x1e'),_0x4f17('0x1f')],_0x1e60ea[_0x4f17('0x12')]))_0x107b78[_0x4f17('0x1d')]='('+_0x107b78[_0x4f17('0x1d')]+'\x20OR\x20'+_0x2bb5f1+'.'+_0x1e60ea[_0x4f17('0x1b')]+_0x4f17('0x20');_0x107b78[_0x4f17('0x14')]=parseValue(_0x52c292,_0x1e60ea[_0x4f17('0x12')],_0x1e60ea['value']);return _0x107b78;};function parseOperator(_0x4ac07a){var _0x105f74;switch(_0x4ac07a){case _0x4f17('0x21'):_0x105f74=_0x4f17('0x22');break;case _0x4f17('0x1f'):_0x105f74=_0x4f17('0x23');break;case _0x4f17('0x13'):_0x105f74='=\x20?';break;case _0x4f17('0x1e'):_0x105f74=_0x4f17('0x24');break;case _0x4f17('0x25'):case _0x4f17('0x26'):case _0x4f17('0x27'):_0x105f74=_0x4f17('0x28');break;case _0x4f17('0x29'):_0x105f74=_0x4f17('0x2a');break;case _0x4f17('0x16'):_0x105f74='>\x20?';break;case'$lte':_0x105f74=_0x4f17('0x2b');break;case _0x4f17('0x2c'):_0x105f74=_0x4f17('0x2d');break;case _0x4f17('0x2e'):_0x105f74=_0x4f17('0x2f');break;}return _0x105f74;}function parseValue(_0x540ea9,_0x1cf24d,_0x38096b){var _0x3d2c11={'start':undefined,'end':undefined};switch(_0x1cf24d){case _0x4f17('0x21'):case _0x4f17('0x1f'):_0x3d2c11['start']=_0x38096b[_0x4f17('0x7')](',');break;case'$substring':_0x3d2c11['start']='%'+_0x38096b+'%';break;case _0x4f17('0x26'):_0x3d2c11['start']=_0x38096b+'%';break;case _0x4f17('0x27'):_0x3d2c11[_0x4f17('0x30')]='%'+_0x38096b;break;case _0x4f17('0x2e'):var _0x5adc96=_0x38096b[_0x4f17('0x7')](',');var _0x38096b=_0x5adc96[_0x4f17('0x8')]();var _0x21cc9a=_0x5adc96[_0x4f17('0x31')]();if(_0x540ea9===_0x4f17('0x11')){_0x38096b=moment(_0x38096b)['utcOffset'](0x0,!![])[_0x4f17('0x32')]();_0x21cc9a=moment(_0x21cc9a)['utcOffset'](0x0,!![])['add'](0x17,'hours')['add'](0x3b,_0x4f17('0x33'))['add'](0x3b,_0x4f17('0x34'))[_0x4f17('0x32')]();}_0x3d2c11={'start':_0x38096b,'end':_0x21cc9a};break;default:_0x3d2c11[_0x4f17('0x30')]=_0x38096b;break;}return _0x3d2c11;} \ No newline at end of file +var _0x8ad3=['>=\x20?','BETWEEN\x20?\x20AND\x20?','start','shift','format','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','[$and]','replace','split','length','forEach','match','indexOf','map','conditions','push','buildExpression','DATE','operator','$eq','$between','value','$lte','add','YYYY-MM-DD','castTo','text','field','\x20AS\x20','includes','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','$gt','>\x20?','<=\x20?'];(function(_0x7cb396,_0x14db87){var _0x51a1ce=function(_0x4f57a5){while(--_0x4f57a5){_0x7cb396['push'](_0x7cb396['shift']());}};_0x51a1ce(++_0x14db87);}(_0x8ad3,0x7a));var _0x38ad=function(_0x2a0960,_0x4af631){_0x2a0960=_0x2a0960-0x0;var _0x1cd8e6=_0x8ad3[_0x2a0960];return _0x1cd8e6;};'use strict';var _=require(_0x38ad('0x0'));var moment=require(_0x38ad('0x1'));exports[_0x38ad('0x2')]=function(_0x428117){var _0x367e55={'conditions':[]};_0x367e55[_0x38ad('0x3')]=_[_0x38ad('0x4')](_0x428117,_0x38ad('0x5'))?'or':_0x38ad('0x6');var _0xb940a9=_0x428117['replace'](_0x38ad('0x7'),'')[_0x38ad('0x8')](_0x38ad('0x5'),'')[_0x38ad('0x9')]('||');for(var _0x1b1626=0x0;_0x1b1626<_0xb940a9[_0x38ad('0xa')];_0x1b1626++){var _0xa3adc9=_0xb940a9[_0x1b1626]['split'](':=');var _0x3c4874=_0xa3adc9[0x0];var _0x502e72=_0xa3adc9['slice'](0x1);_0x502e72[_0x38ad('0xb')](function(_0x4be158){var _0x40b09a=_0x4be158[_0x38ad('0x9')]('[')['shift']();var _0x24cd51=_0x4be158[_0x38ad('0xc')](/\[(.*?)\]/g);_0x24cd51[_0x38ad('0xb')](function(_0x497d17){var _0x17151e=_0x497d17[_0x38ad('0x9')]('[')['filter'](function(_0x7c0b28){return _0x7c0b28[_0x38ad('0xd')](']')>-0x1;})[_0x38ad('0xe')](function(_0x4d7a64){return _0x4d7a64[_0x38ad('0x9')](']')[0x0];})[0x0];_0x367e55[_0x38ad('0xf')][_0x38ad('0x10')]({'field':_0x3c4874,'operator':_0x40b09a,'value':_0x17151e});});});}return _0x367e55;};exports[_0x38ad('0x11')]=function(_0x48c123,_0x39a39d,_0x315064){var _0x52c008={};if(_0x39a39d===_0x38ad('0x12')){if(_0x315064[_0x38ad('0x13')]===_0x38ad('0x14')){_0x315064[_0x38ad('0x13')]=_0x38ad('0x15');_0x315064[_0x38ad('0x16')]+=','+_0x315064[_0x38ad('0x16')];}else if(_['includes'](['$gt',_0x38ad('0x17')],_0x315064[_0x38ad('0x13')])){_0x315064['value']=moment(_0x315064[_0x38ad('0x16')])[_0x38ad('0x18')](0x1,'days')['format'](_0x38ad('0x19'));}}if(_0x315064['castTo']){_0x39a39d=_0x315064[_0x38ad('0x1a')];_0x52c008[_0x38ad('0x1b')]='CAST('+_0x48c123+'.'+_0x315064[_0x38ad('0x1c')]+_0x38ad('0x1d')+_0x315064['castTo']+')\x20'+parseOperator(_0x315064[_0x38ad('0x13')]);}else{_0x52c008[_0x38ad('0x1b')]=_0x48c123+'.'+_0x315064[_0x38ad('0x1c')]+'\x20'+parseOperator(_0x315064['operator']);}if(_[_0x38ad('0x1e')]([_0x38ad('0x1f'),_0x38ad('0x20')],_0x315064[_0x38ad('0x13')]))_0x52c008[_0x38ad('0x1b')]='('+_0x52c008['text']+_0x38ad('0x21')+_0x48c123+'.'+_0x315064['field']+_0x38ad('0x22');_0x52c008[_0x38ad('0x16')]=parseValue(_0x39a39d,_0x315064['operator'],_0x315064[_0x38ad('0x16')]);return _0x52c008;};function parseOperator(_0x4f7493){var _0xd68106;switch(_0x4f7493){case _0x38ad('0x23'):_0xd68106=_0x38ad('0x24');break;case _0x38ad('0x20'):_0xd68106=_0x38ad('0x25');break;case _0x38ad('0x14'):_0xd68106=_0x38ad('0x26');break;case _0x38ad('0x1f'):_0xd68106=_0x38ad('0x27');break;case _0x38ad('0x28'):case _0x38ad('0x29'):case _0x38ad('0x2a'):_0xd68106=_0x38ad('0x2b');break;case _0x38ad('0x2c'):_0xd68106=_0x38ad('0x2d');break;case _0x38ad('0x2e'):_0xd68106=_0x38ad('0x2f');break;case'$lte':_0xd68106=_0x38ad('0x30');break;case'$gte':_0xd68106=_0x38ad('0x31');break;case'$between':_0xd68106=_0x38ad('0x32');break;}return _0xd68106;}function parseValue(_0x361892,_0x16a454,_0x2fc212){var _0x11df0c={'start':undefined,'end':undefined};switch(_0x16a454){case'$in':case'$notIn':_0x11df0c[_0x38ad('0x33')]=_0x2fc212[_0x38ad('0x9')](',');break;case'$substring':_0x11df0c[_0x38ad('0x33')]='%'+_0x2fc212+'%';break;case'$startsWith':_0x11df0c[_0x38ad('0x33')]=_0x2fc212+'%';break;case _0x38ad('0x2a'):_0x11df0c['start']='%'+_0x2fc212;break;case'$between':var _0x240ca3=_0x2fc212['split'](',');var _0x2fc212=_0x240ca3[_0x38ad('0x34')]();var _0x98861c=_0x240ca3['pop']();if(_0x361892===_0x38ad('0x12')){_0x2fc212=moment(_0x2fc212)['utcOffset'](0x0,!![])[_0x38ad('0x35')]();_0x98861c=moment(_0x98861c)['utcOffset'](0x0,!![])[_0x38ad('0x18')](0x17,_0x38ad('0x36'))[_0x38ad('0x18')](0x3b,_0x38ad('0x37'))['add'](0x3b,_0x38ad('0x38'))['format']();}_0x11df0c={'start':_0x2fc212,'end':_0x98861c};break;default:_0x11df0c[_0x38ad('0x33')]=_0x2fc212;break;}return _0x11df0c;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 34f425f..fba6891 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 _0xcca7=['filter','columns','value','merge','VIRTUAL','lower','lodash','sequelize','moment','parse','keys','includes','fields','split','filters','isEmpty','find','type','isPlainObject','format','YYYY-MM-DD','utc','$lte','subtract','isArray','limit','sort','map','indexOf','cast','col','priority','unsigned','DESC','ASC','omit','length','isObject','isString','unset','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','replace','push','join','getOptions','query','$id','name','intersection','model','attributes','hasOwnProperty','offset','order','where'];(function(_0x4ad9f0,_0x6ec64b){var _0x57d2df=function(_0x1d6bfa){while(--_0x1d6bfa){_0x4ad9f0['push'](_0x4ad9f0['shift']());}};_0x57d2df(++_0x6ec64b);}(_0xcca7,0x1aa));var _0x7cca=function(_0x28a7bc,_0x3094c3){_0x28a7bc=_0x28a7bc-0x0;var _0x39aa9c=_0xcca7[_0x28a7bc];return _0x39aa9c;};'use strict';var _=require(_0x7cca('0x0'));var sequelize=require(_0x7cca('0x1'));var moment=require(_0x7cca('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x33db4f){var _0x5cfce5=['ne'];try{var _0x4c311e=JSON[_0x7cca('0x3')](_0x33db4f);var _0x533b00=Object[_0x7cca('0x4')](_0x4c311e)[0x0];return _0x5cfce5[_0x7cca('0x5')](_0x533b00);}catch(_0x2126f7){return![];}}function getOperatorValue(_0x312e98){var _0x1c6c95=JSON[_0x7cca('0x3')](_0x312e98);var _0x5aec51=Object['keys'](_0x1c6c95)[0x0];var _0x937fad=_0x1c6c95[_0x5aec51];return{['$'+_0x5aec51]:_0x937fad};}exports[_0x7cca('0x6')]=function(_0x1aed1b){var _0x1e8cb9=null;if(_0x1aed1b){_0x1e8cb9=_0x1aed1b[_0x7cca('0x7')](',');}return _0x1e8cb9;};exports[_0x7cca('0x8')]=function(_0x20ffa9,_0x2b8b62){var _0x27323a={};if(!_[_0x7cca('0x9')](_0x20ffa9)){_['forOwn'](_0x20ffa9,function(_0x302367,_0x464911){try{if(_0x2b8b62){var _0x275ab2=_[_0x7cca('0xa')](_0x2b8b62,{'name':_0x464911})||{};if(hasSequelizeOperator(_0x302367)){_0x27323a[_0x464911]=getOperatorValue(_0x302367);}else if(_0x275ab2[_0x7cca('0xb')]==='DATE'&&_[_0x7cca('0xc')](_0x302367)){var _0x41e0a2=JSON[_0x7cca('0x3')](_0x302367);var _0x4d0d6d={'$gte':moment(moment(_0x41e0a2['$gte'])[_0x7cca('0xd')](_0x7cca('0xe')))[_0x7cca('0xf')]()[_0x7cca('0xd')](),'$lte':moment(moment(_0x41e0a2[_0x7cca('0x10')])[_0x7cca('0xd')](_0x7cca('0xe')))['utc']()[_0x7cca('0x11')](0x1,'s')['format']()};_0x27323a[_0x464911]=_0x4d0d6d;}else if(_0x275ab2['name']==='uniqueid'){_0x27323a[_0x464911]=_0x302367;}else{_0x27323a[_0x464911]=_[_0x7cca('0x12')](_0x302367)?_0x302367:JSON[_0x7cca('0x3')](_0x302367);}}else{_0x27323a[_0x464911]=_[_0x7cca('0x12')](_0x302367)?_0x302367:JSON[_0x7cca('0x3')](_0x302367);}}catch(_0x44294b){_0x27323a[_0x464911]=_0x302367['split'](',');}});}return _0x27323a;};exports[_0x7cca('0x13')]=function(_0x4fba9e){_0x4fba9e=parseInt(_0x4fba9e,0xa);if(!_0x4fba9e||_0x4fba9e<0x0){_0x4fba9e=LIMIT_VALUE;}return _0x4fba9e;};exports['offset']=function(_0x5d7ac6){_0x5d7ac6=parseInt(_0x5d7ac6,0xa);if(!_0x5d7ac6||_0x5d7ac6<0x0){_0x5d7ac6=0x0;}return _0x5d7ac6;};exports[_0x7cca('0x14')]=function(_0x25297b){var _0x2beb6c,_0x1a20be=null;if(_0x25297b){_0x2beb6c=_0x25297b[_0x7cca('0x7')](',');_0x1a20be=_[_0x7cca('0x15')](_0x2beb6c,function(_0x2e023c){if(_0x2e023c[_0x7cca('0x16')]('-')===0x0){return[_0x2e023c==='priority'?sequelize[_0x7cca('0x17')](sequelize[_0x7cca('0x18')](_0x7cca('0x19')),_0x7cca('0x1a')):_0x2e023c['substr'](0x1),_0x7cca('0x1b')];}else{return[_0x2e023c===_0x7cca('0x19')?sequelize[_0x7cca('0x17')](sequelize[_0x7cca('0x18')](_0x7cca('0x19')),_0x7cca('0x1a')):_0x2e023c,_0x7cca('0x1c')];}});}return _0x1a20be;};exports[_0x7cca('0x1d')]=function(_0x4b99b6,_0xfe121c){if(_[_0x7cca('0x9')](_0x4b99b6)){return _0x4b99b6;}if(_[_0x7cca('0x12')](_0x4b99b6)){for(var _0xdaf07f=0x0;_0xdaf07f<_0x4b99b6[_0x7cca('0x1e')];_0xdaf07f+=0x1){_0x4b99b6[_0xdaf07f]=this[_0x7cca('0x1d')](_0x4b99b6[_0xdaf07f],_0xfe121c);}return _0x4b99b6;}if(!_[_0x7cca('0x1f')](_0x4b99b6)){return _0x4b99b6;}if(_[_0x7cca('0x20')](_0xfe121c)){_0xfe121c=[_0xfe121c];}if(!_['isArray'](_0xfe121c)){return _0x4b99b6;}for(var _0x2cafe1=0x0;_0x2cafe1<_0xfe121c['length'];_0x2cafe1+=0x1){_[_0x7cca('0x21')](_0x4b99b6,_0xfe121c[_0x2cafe1]);}for(var _0x201fbb in _0x4b99b6){if(_0x4b99b6['hasOwnProperty'](_0x201fbb)){_0x4b99b6[_0x201fbb]=this[_0x7cca('0x1d')](_0x4b99b6[_0x201fbb],_0xfe121c);}}return _0x4b99b6;};exports[_0x7cca('0x22')]=function(_0x5533fb){return _0x5533fb[_0x7cca('0x23')](RegExp(_0x7cca('0x24')))?!![]:![];};exports[_0x7cca('0x25')]=function(_0x52fb40){return _0x52fb40['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x7cca('0x26')]=function(_0x13d217){var _0x3797f4=[];_0x13d217[_0x7cca('0x7')](/[ ,]+/)[_0x7cca('0x27')](function(_0xe1ee18){_0xe1ee18=_0xe1ee18[_0x7cca('0x28')](/([^:]")"+/g,'$1');_0xe1ee18='+'+_0xe1ee18+'*';var _0x5a2c7c=/[ `!@#$%^&*()_\-?~]/;if(_0xe1ee18['match'](_0x5a2c7c))_0xe1ee18='\x22'+_0xe1ee18+'\x22';_0x3797f4[_0x7cca('0x29')](_0xe1ee18);});return _0x3797f4[_0x7cca('0x2a')]('\x20');};exports[_0x7cca('0x2b')]=function(_0x4f5fd2,_0x2c4f63,_0x4f8e75){var _0x2061fe={},_0x10558a={};if(_0x2c4f63[_0x7cca('0x2c')][_0x7cca('0x2d')]){_0x2c4f63['query']['id']=_0x2c4f63[_0x7cca('0x2c')][_0x7cca('0x2d')];delete _0x2c4f63[_0x7cca('0x2c')]['$id'];}_0x2061fe['model']=_['map'](_0x4f5fd2,_0x7cca('0x2e'));_0x2061fe[_0x7cca('0x2c')]=_['keys'](_0x2c4f63[_0x7cca('0x2c')]);_0x2061fe[_0x7cca('0x8')]=_[_0x7cca('0x2f')](_0x2061fe[_0x7cca('0x30')],_0x2061fe[_0x7cca('0x2c')]);_0x10558a[_0x7cca('0x31')]=_[_0x7cca('0x2f')](_0x2061fe['model'],this[_0x7cca('0x6')](_0x2c4f63[_0x7cca('0x2c')][_0x7cca('0x6')]));_0x10558a[_0x7cca('0x31')]=_0x10558a['attributes'][_0x7cca('0x1e')]?_0x10558a[_0x7cca('0x31')]:_0x2061fe[_0x7cca('0x30')];if(!_0x2c4f63['query'][_0x7cca('0x32')]('nolimit')){_0x10558a[_0x7cca('0x13')]=this[_0x7cca('0x13')](_0x2c4f63[_0x7cca('0x2c')][_0x7cca('0x13')]);_0x10558a[_0x7cca('0x33')]=this[_0x7cca('0x33')](_0x2c4f63[_0x7cca('0x2c')][_0x7cca('0x33')]);}_0x10558a[_0x7cca('0x34')]=this['sort'](_0x2c4f63['query'][_0x7cca('0x14')]);_0x10558a[_0x7cca('0x35')]=this['filters'](_['pick'](_0x2c4f63[_0x7cca('0x2c')],_0x2061fe[_0x7cca('0x8')]),_0x4f5fd2);if(_0x2c4f63[_0x7cca('0x2c')][_0x7cca('0x36')]){var _0x371c67=_0x4f5fd2;var _0x4cd159=_0x2c4f63[_0x7cca('0x2c')]['filter'];if(typeof _0x4cd159==='object'){_0x371c67=_[_0x7cca('0x36')](_0x4f5fd2,function(_0x33d069){return _['includes'](_0x4cd159[_0x7cca('0x37')],_0x33d069['name']);});_0x4cd159=_0x4cd159[_0x7cca('0x38')];}_0x10558a[_0x7cca('0x35')]=_[_0x7cca('0x39')](_0x10558a['where'],{'$or':_[_0x7cca('0x15')](_0x371c67,function(_0x207250){if(_0x207250[_0x7cca('0xb')]!==_0x7cca('0x3a')){if(_0x4f8e75){return sequelize['where'](sequelize['fn'](_0x7cca('0x3b'),sequelize[_0x7cca('0x18')](_0x207250[_0x7cca('0x2e')])),{'$like':sequelize['fn'](_0x7cca('0x3b'),'%'+_0x2c4f63[_0x7cca('0x2c')][_0x7cca('0x36')]+'%')});}else{var _0x57f440={};_0x57f440[_0x207250['name']]={'$like':'%'+_0x2c4f63['query']['filter']+'%'};return _0x57f440;}}})});}_0x10558a=_[_0x7cca('0x39')]({},_0x10558a,_0x2c4f63['options']);return _0x10558a;}; \ No newline at end of file +var _0x950a=['filters','forOwn','find','DATE','format','YYYY-MM-DD','utc','$lte','subtract','name','isArray','limit','offset','sort','map','indexOf','priority','col','unsigned','substr','DESC','ASC','omit','isEmpty','length','isObject','unset','hasOwnProperty','match','isEmail','getFullTextValue','forEach','replace','getOptions','$id','query','model','attributes','intersection','nolimit','where','pick','filter','object','includes','columns','merge','VIRTUAL','lower','lodash','sequelize','moment','parse','keys','fields','split'];(function(_0x1fbafd,_0x1ba0a5){var _0x2ccceb=function(_0x1b71cf){while(--_0x1b71cf){_0x1fbafd['push'](_0x1fbafd['shift']());}};_0x2ccceb(++_0x1ba0a5);}(_0x950a,0x111));var _0xa950=function(_0x4156ef,_0x4699ca){_0x4156ef=_0x4156ef-0x0;var _0x1a0e21=_0x950a[_0x4156ef];return _0x1a0e21;};'use strict';var _=require(_0xa950('0x0'));var sequelize=require(_0xa950('0x1'));var moment=require(_0xa950('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x13e6a3){var _0x5569f7=['ne'];try{var _0x305b26=JSON[_0xa950('0x3')](_0x13e6a3);var _0x4c027f=Object[_0xa950('0x4')](_0x305b26)[0x0];return _0x5569f7['includes'](_0x4c027f);}catch(_0x1cd8ec){return![];}}function getOperatorValue(_0x46f86d){var _0x512c0e=JSON[_0xa950('0x3')](_0x46f86d);var _0x3645b6=Object['keys'](_0x512c0e)[0x0];var _0x5675f8=_0x512c0e[_0x3645b6];return{['$'+_0x3645b6]:_0x5675f8};}exports[_0xa950('0x5')]=function(_0x12ef5a){var _0x7d87b2=null;if(_0x12ef5a){_0x7d87b2=_0x12ef5a[_0xa950('0x6')](',');}return _0x7d87b2;};exports[_0xa950('0x7')]=function(_0x1b4ec6,_0x4e4700){var _0x523f3c={};if(!_['isEmpty'](_0x1b4ec6)){_[_0xa950('0x8')](_0x1b4ec6,function(_0x48c1b5,_0x37990f){try{if(_0x4e4700){var _0x3c66c7=_[_0xa950('0x9')](_0x4e4700,{'name':_0x37990f})||{};if(hasSequelizeOperator(_0x48c1b5)){_0x523f3c[_0x37990f]=getOperatorValue(_0x48c1b5);}else if(_0x3c66c7['type']===_0xa950('0xa')&&_['isPlainObject'](_0x48c1b5)){var _0x10e64a=JSON[_0xa950('0x3')](_0x48c1b5);var _0x3cdf5d={'$gte':moment(moment(_0x10e64a['$gte'])[_0xa950('0xb')](_0xa950('0xc')))[_0xa950('0xd')]()['format'](),'$lte':moment(moment(_0x10e64a[_0xa950('0xe')])[_0xa950('0xb')](_0xa950('0xc')))['utc']()[_0xa950('0xf')](0x1,'s')[_0xa950('0xb')]()};_0x523f3c[_0x37990f]=_0x3cdf5d;}else if(_0x3c66c7[_0xa950('0x10')]==='uniqueid'){_0x523f3c[_0x37990f]=_0x48c1b5;}else{_0x523f3c[_0x37990f]=_[_0xa950('0x11')](_0x48c1b5)?_0x48c1b5:JSON[_0xa950('0x3')](_0x48c1b5);}}else{_0x523f3c[_0x37990f]=_[_0xa950('0x11')](_0x48c1b5)?_0x48c1b5:JSON[_0xa950('0x3')](_0x48c1b5);}}catch(_0x16aabc){_0x523f3c[_0x37990f]=_0x48c1b5[_0xa950('0x6')](',');}});}return _0x523f3c;};exports[_0xa950('0x12')]=function(_0x36e57c){_0x36e57c=parseInt(_0x36e57c,0xa);if(!_0x36e57c||_0x36e57c<0x0){_0x36e57c=LIMIT_VALUE;}return _0x36e57c;};exports[_0xa950('0x13')]=function(_0x18266c){_0x18266c=parseInt(_0x18266c,0xa);if(!_0x18266c||_0x18266c<0x0){_0x18266c=0x0;}return _0x18266c;};exports[_0xa950('0x14')]=function(_0x38fa5d){var _0xc690ae,_0x5aadd1=null;if(_0x38fa5d){_0xc690ae=_0x38fa5d[_0xa950('0x6')](',');_0x5aadd1=_[_0xa950('0x15')](_0xc690ae,function(_0x50abe1){if(_0x50abe1[_0xa950('0x16')]('-')===0x0){return[_0x50abe1===_0xa950('0x17')?sequelize['cast'](sequelize[_0xa950('0x18')]('priority'),_0xa950('0x19')):_0x50abe1[_0xa950('0x1a')](0x1),_0xa950('0x1b')];}else{return[_0x50abe1===_0xa950('0x17')?sequelize['cast'](sequelize[_0xa950('0x18')](_0xa950('0x17')),_0xa950('0x19')):_0x50abe1,_0xa950('0x1c')];}});}return _0x5aadd1;};exports[_0xa950('0x1d')]=function(_0x22e2c1,_0x300448){if(_[_0xa950('0x1e')](_0x22e2c1)){return _0x22e2c1;}if(_[_0xa950('0x11')](_0x22e2c1)){for(var _0xc4894b=0x0;_0xc4894b<_0x22e2c1[_0xa950('0x1f')];_0xc4894b+=0x1){_0x22e2c1[_0xc4894b]=this[_0xa950('0x1d')](_0x22e2c1[_0xc4894b],_0x300448);}return _0x22e2c1;}if(!_[_0xa950('0x20')](_0x22e2c1)){return _0x22e2c1;}if(_['isString'](_0x300448)){_0x300448=[_0x300448];}if(!_[_0xa950('0x11')](_0x300448)){return _0x22e2c1;}for(var _0x288934=0x0;_0x288934<_0x300448[_0xa950('0x1f')];_0x288934+=0x1){_[_0xa950('0x21')](_0x22e2c1,_0x300448[_0x288934]);}for(var _0x31c168 in _0x22e2c1){if(_0x22e2c1[_0xa950('0x22')](_0x31c168)){_0x22e2c1[_0x31c168]=this[_0xa950('0x1d')](_0x22e2c1[_0x31c168],_0x300448);}}return _0x22e2c1;};exports['isNumeric']=function(_0x19ad7a){return _0x19ad7a[_0xa950('0x23')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0xa950('0x24')]=function(_0x2e7674){return _0x2e7674[_0xa950('0x23')](/^\S+@\S+$/)?!![]:![];};exports[_0xa950('0x25')]=function(_0x152f53){var _0x1945ca=[];_0x152f53[_0xa950('0x6')](/[ ,]+/)[_0xa950('0x26')](function(_0x203703){_0x203703=_0x203703[_0xa950('0x27')](/([^:]")"+/g,'$1');_0x203703='+'+_0x203703+'*';var _0x4de9f0=/[ `!@#$%^&*()_\-?~]/;if(_0x203703[_0xa950('0x23')](_0x4de9f0))_0x203703='\x22'+_0x203703+'\x22';_0x1945ca['push'](_0x203703);});return _0x1945ca['join']('\x20');};exports[_0xa950('0x28')]=function(_0x5db455,_0x118d96,_0x2b43f5){var _0x3ba469={},_0x34f7b9={};if(_0x118d96['query'][_0xa950('0x29')]){_0x118d96['query']['id']=_0x118d96[_0xa950('0x2a')][_0xa950('0x29')];delete _0x118d96['query']['$id'];}_0x3ba469[_0xa950('0x2b')]=_[_0xa950('0x15')](_0x5db455,_0xa950('0x10'));_0x3ba469[_0xa950('0x2a')]=_[_0xa950('0x4')](_0x118d96[_0xa950('0x2a')]);_0x3ba469['filters']=_['intersection'](_0x3ba469[_0xa950('0x2b')],_0x3ba469['query']);_0x34f7b9[_0xa950('0x2c')]=_[_0xa950('0x2d')](_0x3ba469[_0xa950('0x2b')],this[_0xa950('0x5')](_0x118d96[_0xa950('0x2a')][_0xa950('0x5')]));_0x34f7b9[_0xa950('0x2c')]=_0x34f7b9[_0xa950('0x2c')][_0xa950('0x1f')]?_0x34f7b9[_0xa950('0x2c')]:_0x3ba469['model'];if(!_0x118d96[_0xa950('0x2a')]['hasOwnProperty'](_0xa950('0x2e'))){_0x34f7b9[_0xa950('0x12')]=this['limit'](_0x118d96['query'][_0xa950('0x12')]);_0x34f7b9[_0xa950('0x13')]=this['offset'](_0x118d96[_0xa950('0x2a')][_0xa950('0x13')]);}_0x34f7b9['order']=this[_0xa950('0x14')](_0x118d96[_0xa950('0x2a')][_0xa950('0x14')]);_0x34f7b9[_0xa950('0x2f')]=this[_0xa950('0x7')](_[_0xa950('0x30')](_0x118d96[_0xa950('0x2a')],_0x3ba469[_0xa950('0x7')]),_0x5db455);if(_0x118d96['query'][_0xa950('0x31')]){var _0x1764b2=_0x5db455;var _0x52872f=_0x118d96[_0xa950('0x2a')][_0xa950('0x31')];if(typeof _0x52872f===_0xa950('0x32')){_0x1764b2=_['filter'](_0x5db455,function(_0x25c9f3){return _[_0xa950('0x33')](_0x52872f[_0xa950('0x34')],_0x25c9f3['name']);});_0x52872f=_0x52872f['value'];}_0x34f7b9[_0xa950('0x2f')]=_[_0xa950('0x35')](_0x34f7b9[_0xa950('0x2f')],{'$or':_['map'](_0x1764b2,function(_0x49a235){if(_0x49a235['type']!==_0xa950('0x36')){if(_0x2b43f5){return sequelize[_0xa950('0x2f')](sequelize['fn'](_0xa950('0x37'),sequelize[_0xa950('0x18')](_0x49a235[_0xa950('0x10')])),{'$like':sequelize['fn']('lower','%'+_0x118d96[_0xa950('0x2a')][_0xa950('0x31')]+'%')});}else{var _0x531e6a={};_0x531e6a[_0x49a235['name']]={'$like':'%'+_0x118d96[_0xa950('0x2a')][_0xa950('0x31')]+'%'};return _0x531e6a;}}})});}_0x34f7b9=_['merge']({},_0x34f7b9,_0x118d96['options']);return _0x34f7b9;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 3469352..e998a6a 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 _0xfb41=['screenrecording','phoneBarEnableAutomaticScreenRecording','routealias','omit','value','filterAgentAttributes','lodash','../../mysqldb','client','http','chatPause','faxPause','openchannelPause','voicePause','whatsappPause','length','unknown','unavailable','isNil','voiceStatus','idle','chatStatus','faxStatus','mailStatus','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','startCase','Queue','map','findOne','all','getAgentIdsByQueues','filter','includes','getAgentIdsByStatus','resolve','User','findAll','name','fullname','smsPause','pauseType','find','globalStatus','split','fields','order','DESC','getUpdatedSortOptions','internal','substring','indexOf','sort','toLowerCase','online','lastLoginAt','lastPauseAt','address','chatCapacity','openchannelCapacity','smsCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','openchannelStatus','smsStatus','chatStatusTime','openchannelStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum'];(function(_0x399ad3,_0x249e0f){var _0x290fed=function(_0x2c9415){while(--_0x2c9415){_0x399ad3['push'](_0x399ad3['shift']());}};_0x290fed(++_0x249e0f);}(_0xfb41,0x1c3));var _0x1fb4=function(_0x730192,_0x531aed){_0x730192=_0x730192-0x0;var _0x24bd5d=_0xfb41[_0x730192];return _0x24bd5d;};'use strict';var _=require(_0x1fb4('0x0'));var jayson=require('jayson/promise');var db=require(_0x1fb4('0x1'))['db'];var amiClient=jayson[_0x1fb4('0x2')][_0x1fb4('0x3')]({'port':0x232a});var routingClient=jayson['client'][_0x1fb4('0x3')]({'port':0x232c});function isAgentPaused(_0x17408c,_0x2da121){var _0x448654=[_0x17408c[_0x1fb4('0x4')],_0x17408c[_0x1fb4('0x5')],_0x17408c['mailPause'],_0x17408c[_0x1fb4('0x6')],_0x17408c['smsPause'],_0x17408c[_0x1fb4('0x7')],_0x17408c[_0x1fb4('0x8')]];if(!_0x2da121)return _['every'](_0x448654);var _0x24d385=_['filter'](_0x448654);return _0x24d385[_0x1fb4('0x9')]>0x0&&_0x24d385['length']<_0x448654[_0x1fb4('0x9')]?!![]:![];}function isIdle(_0x55c30e){return _0x55c30e==='idle'||_0x55c30e===_0x1fb4('0xa')||_0x55c30e===_0x1fb4('0xb')||_0x55c30e==='ringing'||_[_0x1fb4('0xc')](_0x55c30e);}function isAgentIdle(_0x29d9e2){if(_0x29d9e2[_0x1fb4('0xd')]!==_0x1fb4('0xe')&&_0x29d9e2[_0x1fb4('0x7')]){_0x29d9e2['voiceStatus']='pause';return![];}return _['every']([_0x29d9e2[_0x1fb4('0xf')],_0x29d9e2[_0x1fb4('0x10')],_0x29d9e2[_0x1fb4('0x11')],_0x29d9e2['openchannelStatus'],_0x29d9e2['smsStatus'],_0x29d9e2[_0x1fb4('0xd')],_0x29d9e2[_0x1fb4('0x12')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x1fb4('0x13')](_0x1fb4('0x14'),{})[_0x1fb4('0x15')](function(_0x13170d){if(_0x13170d[_0x1fb4('0x16')]){throw new Error(_0x1fb4('0x17'));}var _0x1c9ca1=_0x13170d[_0x1fb4('0x18')];return routingClient[_0x1fb4('0x13')]('Agents',{})[_0x1fb4('0x15')](function(_0x27c936){if(_0x27c936[_0x1fb4('0x16')]){throw new Error(_0x1fb4('0x19'));}var _0x212806=_0x27c936[_0x1fb4('0x18')];return _[_0x1fb4('0x1a')]({},_0x1c9ca1,_0x212806);});})[_0x1fb4('0x1b')](function(_0x18dd4b){throw _0x18dd4b;});}exports[_0x1fb4('0x1c')]=getRealtimeAgents;function getAgentStatus(_0x9d1d04){var _0x57c63d=_0x1fb4('0xa');if(isAgentPaused(_0x9d1d04))_0x57c63d=_0x1fb4('0x1d');else if(isAgentPaused(_0x9d1d04,!![]))_0x57c63d='*pause';else if(isAgentIdle(_0x9d1d04))_0x57c63d='idle';else _0x57c63d=_0x1fb4('0x1e');return _0x57c63d;}exports[_0x1fb4('0x1f')]=getAgentStatus;function getAgentIdsByQueues(_0x3b288b,_0x97a9b6){var _0x1e9c15=_[_0x1fb4('0x20')](_0x3b288b)?_0x3b288b:[_0x3b288b];var _0x2be1ad=_[_0x1fb4('0x21')](_0x97a9b6)+_0x1fb4('0x22');var _0x3e9d6d=_[_0x1fb4('0x23')](_0x1e9c15,function(_0x5a746a){return db[_0x2be1ad][_0x1fb4('0x24')]({'where':{'id':_0x5a746a}})[_0x1fb4('0x15')](function(_0x597740){if(!_0x597740)return[];return _0x597740['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0x1fb4('0x25')](_0x3e9d6d)[_0x1fb4('0x15')](function(_0x3c952a){var _0x106ab8=_(_0x3c952a)['flatten']()['map']('id')['uniq']()['value']();return _0x106ab8;});}exports[_0x1fb4('0x26')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x46f53d,_0x279c17,_0x4f95de){try{if(_0x279c17['length']>0x0){_0x46f53d=_0x46f53d[_0x1fb4('0x27')](function(_0x1722d1){return _0x279c17[_0x1fb4('0x28')](_0x1722d1['id']);});}var _0xb9bd58=_0x46f53d['filter'](function(_0x19c1af){var _0x34113c=_0x1fb4('0x1e');if(isAgentIdle(_0x19c1af)){_0x34113c=_0x1fb4('0xe');}return _0x34113c===_0x4f95de;});return _['map'](_0xb9bd58,'id');}catch(_0x2c8a67){throw _0x2c8a67;}}exports[_0x1fb4('0x29')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0xec6c79,_0xbfc272,_0x4d06f4){return Promise[_0x1fb4('0x2a')]()[_0x1fb4('0x15')](function(){if(_0xbfc272['length']>0x0){_0xec6c79=_0xec6c79['filter'](function(_0x363d12){return _0xbfc272['includes'](_0x363d12['id']);});}return _0xec6c79;})['then'](function(){return db[_0x1fb4('0x2b')][_0x1fb4('0x2c')]({'attributes':['id',_0x1fb4('0x2d'),_0x1fb4('0x2e'),'chatPause',_0x1fb4('0x5'),'mailPause',_0x1fb4('0x6'),_0x1fb4('0x2f'),_0x1fb4('0x7'),'whatsappPause',_0x1fb4('0x30')],'where':{'id':{'$in':_[_0x1fb4('0x23')](_0xec6c79,'id')}},'raw':!![]});})['then'](function(_0x4eebd7){return _0x4eebd7[_0x1fb4('0x23')](function(_0x32f819){var _0x4a785a=_[_0x1fb4('0x31')](_0xec6c79,['id',_0x32f819['id']]);var _0x458924=filterAgentAttributes(_0x4a785a);_['merge'](_0x32f819,_0x458924);_0x32f819[_0x1fb4('0x32')]=getAgentStatus(_0x32f819);return _0x32f819;});})[_0x1fb4('0x15')](function(_0x3ab1ad){var _0x35c49c=sortAgentsByStatus(_0x3ab1ad,_0x4d06f4);return _['map'](_0x35c49c,'id');})[_0x1fb4('0x1b')](function(_0xbd2f9c){throw _0xbd2f9c;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x48bb41){var _0x1a42f6={'fields':[],'order':null};var _0x4dd19e=_0x48bb41[_0x1fb4('0x33')](',');_0x1a42f6[_0x1fb4('0x34')]=_['filter'](_0x4dd19e,function(_0x40e9c6){if(!_0x40e9c6[_0x1fb4('0x28')]('globalStatus')){return!![];}_0x1a42f6[_0x1fb4('0x35')]=_['startsWith'](_0x40e9c6,'-')?_0x1fb4('0x36'):'ASC';return![];});return _0x1a42f6;}exports[_0x1fb4('0x37')]=getUpdatedSortOptions;function validateSortParameter(_0x3465f1){if(_0x3465f1[_0x1fb4('0x28')](_0x1fb4('0x2e'))&&!_0x3465f1['includes'](_0x1fb4('0x38'))){var _0x1a36af=_0x3465f1[_0x1fb4('0x39')](0x0,_0x3465f1[_0x1fb4('0x3a')]('fullname'));_0x3465f1+=','+_0x1a36af+_0x1fb4('0x38');}return _0x3465f1;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x1c5865,_0x2fcc19){var _0x55508e=_0x1c5865[_0x1fb4('0x3b')](function(_0x128e6d,_0x6a477a){if(_0x128e6d['globalStatus']===_0x6a477a[_0x1fb4('0x32')]){if(_0x128e6d[_0x1fb4('0x32')]===_0x1fb4('0x1d')){if(_0x2fcc19===_0x1fb4('0x36')){return(_0x128e6d[_0x1fb4('0x30')]||'')<(_0x6a477a['pauseType']||'')||_0x128e6d['fullname'][_0x1fb4('0x3c')]()>_0x6a477a[_0x1fb4('0x2e')]['toLowerCase']()?0x1:-0x1;}else{return(_0x128e6d[_0x1fb4('0x30')]||'')<(_0x6a477a[_0x1fb4('0x30')]||'')||_0x128e6d['fullname']['toLowerCase']()>_0x6a477a[_0x1fb4('0x2e')][_0x1fb4('0x3c')]()?-0x1:0x1;}}else{if(_0x2fcc19===_0x1fb4('0x36')){return _0x128e6d[_0x1fb4('0x2e')][_0x1fb4('0x3c')]()<_0x6a477a[_0x1fb4('0x2e')][_0x1fb4('0x3c')]()?0x1:-0x1;}else{return _0x128e6d[_0x1fb4('0x2e')][_0x1fb4('0x3c')]()<_0x6a477a[_0x1fb4('0x2e')][_0x1fb4('0x3c')]()?-0x1:0x1;}}}else{if(_0x2fcc19===_0x1fb4('0x36')){return _0x128e6d[_0x1fb4('0x32')]<_0x6a477a[_0x1fb4('0x32')]?0x1:-0x1;}else{return _0x128e6d[_0x1fb4('0x32')]<_0x6a477a[_0x1fb4('0x32')]?-0x1:0x1;}}});return _0x55508e;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x126472){var _0x474437=['userpic',_0x1fb4('0x3d'),_0x1fb4('0x3e'),'lastPauseAt','pauseType',_0x1fb4('0x3f'),'internal',_0x1fb4('0x40'),'chatPause','openchannelPause','mailPause',_0x1fb4('0x2f'),_0x1fb4('0x8'),_0x1fb4('0x5'),_0x1fb4('0x7'),_0x1fb4('0x41'),_0x1fb4('0x42'),'mailCapacity',_0x1fb4('0x43'),'whatsappCapacity',_0x1fb4('0x44'),_0x1fb4('0x45'),_0x1fb4('0x46'),_0x1fb4('0x47'),_0x1fb4('0x48'),'whatsappCurrentCapacity','faxCurrentCapacity',_0x1fb4('0xf'),_0x1fb4('0x49'),_0x1fb4('0x11'),_0x1fb4('0x4a'),'whatsappStatus',_0x1fb4('0x10'),'voiceStatus',_0x1fb4('0x4b'),_0x1fb4('0x4c'),'mailStatusTime',_0x1fb4('0x4d'),_0x1fb4('0x4e'),_0x1fb4('0x4f'),_0x1fb4('0x50'),_0x1fb4('0x51'),_0x1fb4('0x52'),_0x1fb4('0x53'),'phoneBarEnableScreenRecordingByAgent',_0x1fb4('0x54'),_0x1fb4('0x55')];var _0x2fbca7=['chatPause',_0x1fb4('0x6'),'mailPause','smsPause','whatsappPause','faxPause',_0x1fb4('0x7'),'online'];var _0xd5181c=_(_0x126472)[_0x1fb4('0x56')](_0x2fbca7)['pick'](_0x474437)[_0x1fb4('0x57')]();return _0xd5181c;}exports[_0x1fb4('0x58')]=filterAgentAttributes; \ No newline at end of file +var _0xba5b=['userpic','online','lastLoginAt','lastPauseAt','address','chatCapacity','mailCapacity','smsCapacity','faxCapacity','smsCurrentCapacity','chatStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','routealias','omit','pick','filterAgentAttributes','lodash','jayson/promise','../../mysqldb','client','http','chatPause','smsPause','whatsappPause','every','filter','length','unknown','unavailable','isNil','voiceStatus','idle','voicePause','pause','faxStatus','mailStatus','openchannelStatus','smsStatus','request','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','error','merge','catch','getRealtimeAgents','*pause','busy','getAgentStatus','isArray','startCase','Queue','map','getAgents','all','flatten','uniq','value','getAgentIdsByQueues','getAgentIdsByStatus','resolve','User','findAll','name','fullname','faxPause','mailPause','openchannelPause','pauseType','find','globalStatus','getSortedAgentsIdsByStatus','includes','order','DESC','ASC','getUpdatedSortOptions','internal','substring','validateSortParameter','sort','toLowerCase','sortAgentsByStatus'];(function(_0x40890a,_0x4ce3b1){var _0x5102a2=function(_0x4d6eae){while(--_0x4d6eae){_0x40890a['push'](_0x40890a['shift']());}};_0x5102a2(++_0x4ce3b1);}(_0xba5b,0x77));var _0xbba5=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xba5b[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0xbba5('0x0'));var jayson=require(_0xbba5('0x1'));var db=require(_0xbba5('0x2'))['db'];var amiClient=jayson[_0xbba5('0x3')]['http']({'port':0x232a});var routingClient=jayson[_0xbba5('0x3')][_0xbba5('0x4')]({'port':0x232c});function isAgentPaused(_0xff41e0,_0x288cf6){var _0x282d75=[_0xff41e0[_0xbba5('0x5')],_0xff41e0['faxPause'],_0xff41e0['mailPause'],_0xff41e0['openchannelPause'],_0xff41e0[_0xbba5('0x6')],_0xff41e0['voicePause'],_0xff41e0[_0xbba5('0x7')]];if(!_0x288cf6)return _[_0xbba5('0x8')](_0x282d75);var _0x1edd33=_[_0xbba5('0x9')](_0x282d75);return _0x1edd33[_0xbba5('0xa')]>0x0&&_0x1edd33[_0xbba5('0xa')]<_0x282d75['length']?!![]:![];}function isIdle(_0x4efcad){return _0x4efcad==='idle'||_0x4efcad===_0xbba5('0xb')||_0x4efcad===_0xbba5('0xc')||_0x4efcad==='ringing'||_[_0xbba5('0xd')](_0x4efcad);}function isAgentIdle(_0x5a51b5){if(_0x5a51b5[_0xbba5('0xe')]!==_0xbba5('0xf')&&_0x5a51b5[_0xbba5('0x10')]){_0x5a51b5['voiceStatus']=_0xbba5('0x11');return![];}return _['every']([_0x5a51b5['chatStatus'],_0x5a51b5[_0xbba5('0x12')],_0x5a51b5[_0xbba5('0x13')],_0x5a51b5[_0xbba5('0x14')],_0x5a51b5[_0xbba5('0x15')],_0x5a51b5[_0xbba5('0xe')],_0x5a51b5['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient[_0xbba5('0x16')]('Agents',{})[_0xbba5('0x17')](function(_0x1e3d09){if(_0x1e3d09['error']){throw new Error(_0xbba5('0x18'));}var _0x618cf9=_0x1e3d09[_0xbba5('0x19')];return routingClient[_0xbba5('0x16')]('Agents',{})[_0xbba5('0x17')](function(_0x55258f){if(_0x55258f[_0xbba5('0x1a')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x4dd1d2=_0x55258f[_0xbba5('0x19')];return _[_0xbba5('0x1b')]({},_0x618cf9,_0x4dd1d2);});})[_0xbba5('0x1c')](function(_0x57ed60){throw _0x57ed60;});}exports[_0xbba5('0x1d')]=getRealtimeAgents;function getAgentStatus(_0x3355bb){var _0x8c5384=_0xbba5('0xb');if(isAgentPaused(_0x3355bb))_0x8c5384=_0xbba5('0x11');else if(isAgentPaused(_0x3355bb,!![]))_0x8c5384=_0xbba5('0x1e');else if(isAgentIdle(_0x3355bb))_0x8c5384='idle';else _0x8c5384=_0xbba5('0x1f');return _0x8c5384;}exports[_0xbba5('0x20')]=getAgentStatus;function getAgentIdsByQueues(_0x3920c0,_0x15d287){var _0x109597=_[_0xbba5('0x21')](_0x3920c0)?_0x3920c0:[_0x3920c0];var _0x575d9a=_[_0xbba5('0x22')](_0x15d287)+_0xbba5('0x23');var _0x30590a=_[_0xbba5('0x24')](_0x109597,function(_0x2612ff){return db[_0x575d9a]['findOne']({'where':{'id':_0x2612ff}})[_0xbba5('0x17')](function(_0x3dc691){if(!_0x3dc691)return[];return _0x3dc691[_0xbba5('0x25')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xbba5('0x26')](_0x30590a)[_0xbba5('0x17')](function(_0xbb8607){var _0x3745e9=_(_0xbb8607)[_0xbba5('0x27')]()[_0xbba5('0x24')]('id')[_0xbba5('0x28')]()[_0xbba5('0x29')]();return _0x3745e9;});}exports[_0xbba5('0x2a')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x18ade0,_0x3d3618,_0xf2e6b5){try{if(_0x3d3618[_0xbba5('0xa')]>0x0){_0x18ade0=_0x18ade0[_0xbba5('0x9')](function(_0x48334a){return _0x3d3618['includes'](_0x48334a['id']);});}var _0x16e652=_0x18ade0[_0xbba5('0x9')](function(_0x43702b){var _0x42d8cd=_0xbba5('0x1f');if(isAgentIdle(_0x43702b)){_0x42d8cd=_0xbba5('0xf');}return _0x42d8cd===_0xf2e6b5;});return _[_0xbba5('0x24')](_0x16e652,'id');}catch(_0x47c3fe){throw _0x47c3fe;}}exports[_0xbba5('0x2b')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x4323b3,_0x2b5fb7,_0x16f5c3){return Promise[_0xbba5('0x2c')]()[_0xbba5('0x17')](function(){if(_0x2b5fb7['length']>0x0){_0x4323b3=_0x4323b3[_0xbba5('0x9')](function(_0x218a20){return _0x2b5fb7['includes'](_0x218a20['id']);});}return _0x4323b3;})['then'](function(){return db[_0xbba5('0x2d')][_0xbba5('0x2e')]({'attributes':['id',_0xbba5('0x2f'),_0xbba5('0x30'),_0xbba5('0x5'),_0xbba5('0x31'),_0xbba5('0x32'),_0xbba5('0x33'),_0xbba5('0x6'),_0xbba5('0x10'),'whatsappPause',_0xbba5('0x34')],'where':{'id':{'$in':_['map'](_0x4323b3,'id')}},'raw':!![]});})[_0xbba5('0x17')](function(_0xd2b9e){return _0xd2b9e[_0xbba5('0x24')](function(_0x33ff6c){var _0x5310be=_[_0xbba5('0x35')](_0x4323b3,['id',_0x33ff6c['id']]);var _0x43889c=filterAgentAttributes(_0x5310be);_[_0xbba5('0x1b')](_0x33ff6c,_0x43889c);_0x33ff6c[_0xbba5('0x36')]=getAgentStatus(_0x33ff6c);return _0x33ff6c;});})[_0xbba5('0x17')](function(_0x5f1808){var _0x3d4ebc=sortAgentsByStatus(_0x5f1808,_0x16f5c3);return _['map'](_0x3d4ebc,'id');})['catch'](function(_0x76a94f){throw _0x76a94f;});}exports[_0xbba5('0x37')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x47232e){var _0x46d702={'fields':[],'order':null};var _0x5b115e=_0x47232e['split'](',');_0x46d702['fields']=_[_0xbba5('0x9')](_0x5b115e,function(_0x502ead){if(!_0x502ead[_0xbba5('0x38')]('globalStatus')){return!![];}_0x46d702[_0xbba5('0x39')]=_['startsWith'](_0x502ead,'-')?_0xbba5('0x3a'):_0xbba5('0x3b');return![];});return _0x46d702;}exports[_0xbba5('0x3c')]=getUpdatedSortOptions;function validateSortParameter(_0x27d265){if(_0x27d265[_0xbba5('0x38')]('fullname')&&!_0x27d265[_0xbba5('0x38')](_0xbba5('0x3d'))){var _0x5d9f38=_0x27d265[_0xbba5('0x3e')](0x0,_0x27d265['indexOf']('fullname'));_0x27d265+=','+_0x5d9f38+'internal';}return _0x27d265;}exports[_0xbba5('0x3f')]=validateSortParameter;function sortAgentsByStatus(_0x319ffe,_0x3075f9){var _0x54f6c0=_0x319ffe[_0xbba5('0x40')](function(_0x50ec55,_0x226cc6){if(_0x50ec55['globalStatus']===_0x226cc6[_0xbba5('0x36')]){if(_0x50ec55[_0xbba5('0x36')]===_0xbba5('0x11')){if(_0x3075f9===_0xbba5('0x3a')){return(_0x50ec55['pauseType']||'')<(_0x226cc6[_0xbba5('0x34')]||'')||_0x50ec55['fullname']['toLowerCase']()>_0x226cc6[_0xbba5('0x30')][_0xbba5('0x41')]()?0x1:-0x1;}else{return(_0x50ec55[_0xbba5('0x34')]||'')<(_0x226cc6[_0xbba5('0x34')]||'')||_0x50ec55[_0xbba5('0x30')][_0xbba5('0x41')]()>_0x226cc6[_0xbba5('0x30')][_0xbba5('0x41')]()?-0x1:0x1;}}else{if(_0x3075f9===_0xbba5('0x3a')){return _0x50ec55[_0xbba5('0x30')]['toLowerCase']()<_0x226cc6[_0xbba5('0x30')][_0xbba5('0x41')]()?0x1:-0x1;}else{return _0x50ec55[_0xbba5('0x30')][_0xbba5('0x41')]()<_0x226cc6[_0xbba5('0x30')][_0xbba5('0x41')]()?-0x1:0x1;}}}else{if(_0x3075f9===_0xbba5('0x3a')){return _0x50ec55['globalStatus']<_0x226cc6['globalStatus']?0x1:-0x1;}else{return _0x50ec55[_0xbba5('0x36')]<_0x226cc6[_0xbba5('0x36')]?-0x1:0x1;}}});return _0x54f6c0;}exports[_0xbba5('0x42')]=sortAgentsByStatus;function filterAgentAttributes(_0x1f19ee){var _0xb8bd9b=[_0xbba5('0x43'),_0xbba5('0x44'),_0xbba5('0x45'),_0xbba5('0x46'),_0xbba5('0x34'),'lastPauseAt',_0xbba5('0x3d'),_0xbba5('0x47'),'chatPause',_0xbba5('0x33'),_0xbba5('0x32'),_0xbba5('0x6'),_0xbba5('0x7'),_0xbba5('0x31'),_0xbba5('0x10'),_0xbba5('0x48'),'openchannelCapacity',_0xbba5('0x49'),_0xbba5('0x4a'),'whatsappCapacity',_0xbba5('0x4b'),'chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity',_0xbba5('0x4c'),'whatsappCurrentCapacity','faxCurrentCapacity',_0xbba5('0x4d'),'openchannelStatus',_0xbba5('0x13'),'smsStatus','whatsappStatus',_0xbba5('0x12'),_0xbba5('0xe'),_0xbba5('0x4e'),_0xbba5('0x4f'),_0xbba5('0x50'),_0xbba5('0x51'),_0xbba5('0x52'),_0xbba5('0x53'),_0xbba5('0x54'),_0xbba5('0x55'),_0xbba5('0x56'),_0xbba5('0x57'),'phoneBarEnableScreenRecordingByAgent',_0xbba5('0x58'),_0xbba5('0x59')];var _0x49f613=['chatPause','openchannelPause','mailPause','smsPause',_0xbba5('0x7'),_0xbba5('0x31'),_0xbba5('0x10'),'online'];var _0x54b97c=_(_0x1f19ee)[_0xbba5('0x5a')](_0x49f613)[_0xbba5('0x5b')](_0xb8bd9b)[_0xbba5('0x29')]();return _0x54b97c;}exports[_0xbba5('0x5c')]=filterAgentAttributes; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index e3d08f9..508c4b8 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 _0xb351=['pick','initializeQueues','lodash','util','client','http','available','loggedIn','paused','busy','inUse','notInUse','onHold','ringing','ringInUse','talking','unavailable','unknown','originated','message','dialActive','dialMethod','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','voice','request','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','getRealtimeQueues','inbound','concat','outbound','map','loggedInDb','pTalking','find','merge'];(function(_0x542a4e,_0x23f7ef){var _0x11d75d=function(_0x12c1c7){while(--_0x12c1c7){_0x542a4e['push'](_0x542a4e['shift']());}};_0x11d75d(++_0x23f7ef);}(_0xb351,0x1d6));var _0x1b35=function(_0x3d5a5a,_0x4849d2){_0x3d5a5a=_0x3d5a5a-0x0;var _0x391a33=_0xb351[_0x3d5a5a];return _0x391a33;};'use strict';var _=require(_0x1b35('0x0'));var jayson=require('jayson/promise');var util=require(_0x1b35('0x1'));var amiClient=jayson[_0x1b35('0x2')]['http']({'port':0x232a});var routingClient=jayson['client'][_0x1b35('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x1b35('0x4'),_0x1b35('0x5'),_0x1b35('0x6'),'waiting'];var VOICE_QUEUE_ATTRIBUTES=[_0x1b35('0x7'),_0x1b35('0x8'),'invalid','loggedInDb',_0x1b35('0x9'),_0x1b35('0xa'),_0x1b35('0xb'),_0x1b35('0xc'),_0x1b35('0xd'),_0x1b35('0xe'),_0x1b35('0xf')];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking',_0x1b35('0x10'),_0x1b35('0x11'),'statusMessage',_0x1b35('0x12'),_0x1b35('0x13'),'Trunk','startPredictive',_0x1b35('0x14'),_0x1b35('0x15'),_0x1b35('0x16'),_0x1b35('0x17'),_0x1b35('0x18'),_0x1b35('0x19'),_0x1b35('0x1a'),_0x1b35('0x1b'),_0x1b35('0x1c'),_0x1b35('0x1d'),_0x1b35('0x1e'),_0x1b35('0x1f'),_0x1b35('0x20'),'predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime'];function getRealtimeQueues(_0x12a146,_0x159eee){var _0x41ab7a=_0x159eee===_0x1b35('0x21')?amiClient:routingClient;return _0x41ab7a[_0x1b35('0x22')](_['startCase'](_0x159eee)+_0x1b35('0x23'),_0x12a146)[_0x1b35('0x24')](function(_0x21bf8e){if(_0x21bf8e[_0x1b35('0x25')])throw new Error(util[_0x1b35('0x26')](_0x1b35('0x27'),_0x159eee));return _0x21bf8e[_0x1b35('0x28')];})['catch'](function(_0x182cbe){throw _0x182cbe;});}exports[_0x1b35('0x29')]=getRealtimeQueues;function initializeQueues(_0x250c17,_0x28b4ef,_0x3782fb,_0x3700fb){var _0x3e0513=DEFAULT_QUEUE_ATTRIBUTES;if(_0x3782fb===_0x1b35('0x21')){if(_0x3700fb===_0x1b35('0x2a')){_0x3e0513=_0x3e0513[_0x1b35('0x2b')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x3700fb===_0x1b35('0x2c')){_0x3e0513=_0x3e0513['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x250c17[_0x1b35('0x2d')](function(_0xd5cd64){var _0x28fb14=_0xd5cd64['get']({'plain':!![]});_0x28fb14['paused']=0x0;_0x28fb14[_0x1b35('0x2e')]=0x0;_0x28fb14['loggedIn']=0x0;_0x28fb14[_0x1b35('0x4')]=0x0;_0x28fb14['waiting']=0x0;if(_0x3782fb===_0x1b35('0x21')){_0x28fb14[_0x1b35('0xd')]=0x0;_0x28fb14['busy']=0x0;if(_0x3700fb===_0x1b35('0x2c')){_0x28fb14[_0x1b35('0x2f')]=0x0;_0x28fb14[_0x1b35('0x10')]=0x0;}}var _0x38eeca=_[_0x1b35('0x30')](_0x28b4ef,['id',_0x28fb14['id']]);if(_0x38eeca){_[_0x1b35('0x31')](_0x28fb14,_[_0x1b35('0x32')](_0x38eeca,_0x3e0513));}return _0x28fb14;});}exports[_0x1b35('0x33')]=initializeQueues; \ No newline at end of file +var _0x093d=['pick','initializeQueues','util','client','http','available','loggedIn','paused','waiting','busy','inUse','invalid','loggedInDb','notInUse','onHold','ringing','ringInUse','talking','unavailable','unknown','pTalking','originated','dialActive','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','request','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','voice','inbound','outbound','concat','map','get','find','merge'];(function(_0x1989e2,_0x5a3b47){var _0x218d38=function(_0x572af8){while(--_0x572af8){_0x1989e2['push'](_0x1989e2['shift']());}};_0x218d38(++_0x5a3b47);}(_0x093d,0x1e8));var _0xd093=function(_0x1d9dfa,_0x30598d){_0x1d9dfa=_0x1d9dfa-0x0;var _0x252661=_0x093d[_0x1d9dfa];return _0x252661;};'use strict';var _=require('lodash');var jayson=require('jayson/promise');var util=require(_0xd093('0x0'));var amiClient=jayson[_0xd093('0x1')][_0xd093('0x2')]({'port':0x232a});var routingClient=jayson[_0xd093('0x1')]['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xd093('0x3'),_0xd093('0x4'),_0xd093('0x5'),_0xd093('0x6')];var VOICE_QUEUE_ATTRIBUTES=[_0xd093('0x7'),_0xd093('0x8'),_0xd093('0x9'),_0xd093('0xa'),_0xd093('0xb'),_0xd093('0xc'),_0xd093('0xd'),_0xd093('0xe'),_0xd093('0xf'),_0xd093('0x10'),_0xd093('0x11')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xd093('0x12'),_0xd093('0x13'),'message','statusMessage',_0xd093('0x14'),'dialMethod',_0xd093('0x15'),_0xd093('0x16'),_0xd093('0x17'),_0xd093('0x18'),_0xd093('0x19'),_0xd093('0x1a'),_0xd093('0x1b'),_0xd093('0x1c'),_0xd093('0x1d'),'dialPredictiveIntervalMinThreshold',_0xd093('0x1e'),_0xd093('0x1f'),_0xd093('0x20'),_0xd093('0x21'),_0xd093('0x22'),_0xd093('0x23'),'predictiveIntervalAvgTalktime'];function getRealtimeQueues(_0x30cbc2,_0x597760){var _0x3da051=_0x597760==='voice'?amiClient:routingClient;return _0x3da051[_0xd093('0x24')](_['startCase'](_0x597760)+'Queues',_0x30cbc2)[_0xd093('0x25')](function(_0xec8dc2){if(_0xec8dc2[_0xd093('0x26')])throw new Error(util[_0xd093('0x27')](_0xd093('0x28'),_0x597760));return _0xec8dc2[_0xd093('0x29')];})[_0xd093('0x2a')](function(_0x202a26){throw _0x202a26;});}exports[_0xd093('0x2b')]=getRealtimeQueues;function initializeQueues(_0x3515d5,_0x33e0ef,_0x39df4e,_0x23e591){var _0x4bf591=DEFAULT_QUEUE_ATTRIBUTES;if(_0x39df4e===_0xd093('0x2c')){if(_0x23e591===_0xd093('0x2d')){_0x4bf591=_0x4bf591['concat'](VOICE_QUEUE_ATTRIBUTES);}else if(_0x23e591===_0xd093('0x2e')){_0x4bf591=_0x4bf591[_0xd093('0x2f')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x3515d5[_0xd093('0x30')](function(_0x59deee){var _0x28bb66=_0x59deee[_0xd093('0x31')]({'plain':!![]});_0x28bb66[_0xd093('0x5')]=0x0;_0x28bb66[_0xd093('0xa')]=0x0;_0x28bb66['loggedIn']=0x0;_0x28bb66[_0xd093('0x3')]=0x0;_0x28bb66[_0xd093('0x6')]=0x0;if(_0x39df4e===_0xd093('0x2c')){_0x28bb66[_0xd093('0xf')]=0x0;_0x28bb66[_0xd093('0x7')]=0x0;if(_0x23e591===_0xd093('0x2e')){_0x28bb66['pTalking']=0x0;_0x28bb66[_0xd093('0x13')]=0x0;}}var _0x1c2024=_[_0xd093('0x32')](_0x33e0ef,['id',_0x28bb66['id']]);if(_0x1c2024){_[_0xd093('0x33')](_0x28bb66,_[_0xd093('0x34')](_0x1c2024,_0x4bf591));}return _0x28bb66;});}exports[_0xd093('0x35')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 9f47046..531b914 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(_0x333160,_0x4c1df7){var _0x256d5a=function(_0xa6643e){while(--_0xa6643e){_0x333160['push'](_0x333160['shift']());}};_0x256d5a(++_0x4c1df7);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'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(_0x56c04f,_0x25c86d){var _0x2d1911=function(_0x35b9cd){while(--_0x35b9cd){_0x56c04f['push'](_0x56c04f['shift']());}};_0x2d1911(++_0x25c86d);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'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 4766eab..57646f8 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 _0xf2da=['cpus','map','model','createHash','md5','hex','getUuid','test','licenseToken','win32','utf8','replace','hostname','macAddress','update','digest','substring','lodash','crypto','child_process','../environment','networkInterfaces','keys','length','filter','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface'];(function(_0x43488c,_0x92e2e6){var _0xfe6cab=function(_0x30a263){while(--_0x30a263){_0x43488c['push'](_0x43488c['shift']());}};_0xfe6cab(++_0x92e2e6);}(_0xf2da,0x187));var _0xaf2d=function(_0x3a2e49,_0x21ebea){_0x3a2e49=_0x3a2e49-0x0;var _0x257140=_0xf2da[_0x3a2e49];return _0x257140;};'use strict';var _=require(_0xaf2d('0x0'));var os=require('os');var crypto=require(_0xaf2d('0x1'));var machine=require('bimedia-machine-uuid');var exec=require(_0xaf2d('0x2'))['execSync'];var config=require(_0xaf2d('0x3'));function getInterfaces(){var _0x368494=[];var _0x19090c=os[_0xaf2d('0x4')]();var _0x14e86c=_['orderBy'](_[_0xaf2d('0x5')](_0x19090c));for(var _0x245824=0x0;_0x245824<_0x14e86c[_0xaf2d('0x6')];_0x245824++){var _0x5bcbc0=_0x19090c[_0x14e86c[_0x245824]][_0xaf2d('0x7')](function(_0x8a4475){return _0x8a4475['family']===_0xaf2d('0x8')&&_0x8a4475[_0xaf2d('0x9')]===![];});_0x368494=_0x368494[_0xaf2d('0xa')](_0x5bcbc0);}return _0x368494;}function getFirstInterface(){var _0x1479c5=_[_0xaf2d('0xb')](getInterfaces());return{'macAddress':_0x1479c5&&_0x1479c5[_0xaf2d('0xc')]?_0x1479c5['mac']:_0xaf2d('0xd'),'ipAddress':_0x1479c5&&_0x1479c5['address']?_0x1479c5[_0xaf2d('0xe')]:_0xaf2d('0xf')};}exports[_0xaf2d('0x10')]=getFirstInterface;function getCPUhash(){var _0x381c17=_['orderBy'](os[_0xaf2d('0x11')]()[_0xaf2d('0x12')](function(_0x459ada){return _0x459ada[_0xaf2d('0x13')];}))['join'](':');return crypto[_0xaf2d('0x14')](_0xaf2d('0x15'))['update'](_0x381c17)['digest'](_0xaf2d('0x16'));}exports[_0xaf2d('0x17')]=function(){var _0x1a51ed=os['platform']();var _0x464240=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x464240[_0xaf2d('0x18')](config[_0xaf2d('0x19')])){return config[_0xaf2d('0x19')];}else if(_0x1a51ed===_0xaf2d('0x1a')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0xaf2d('0x1b')})[_0xaf2d('0x1c')]('\x0d\x0a','');}else{var _0x469a2b=getFirstInterface();var _0x54fe0b=getCPUhash();var _0x16c42b=_0x54fe0b+'|'+os[_0xaf2d('0x1d')]()+'|'+_0x469a2b[_0xaf2d('0x1e')]+'|'+_0x469a2b['ipAddress'];var _0x3df6bf=crypto[_0xaf2d('0x14')](_0xaf2d('0x15'))[_0xaf2d('0x1f')](_0x16c42b)[_0xaf2d('0x20')]('hex');return _0x3df6bf[_0xaf2d('0x21')](0x0,0x8)+'-'+_0x3df6bf[_0xaf2d('0x21')](0x8,0xc)+'-'+_0x3df6bf[_0xaf2d('0x21')](0xc,0x10)+'-'+_0x3df6bf[_0xaf2d('0x21')](0x10,0x14)+'-'+_0x3df6bf[_0xaf2d('0x21')](0x14);}}; \ No newline at end of file +var _0xb681=['cpus','model','update','hex','platform','licenseToken','dmidecode\x20--string\x20system-uuid','replace','ipAddress','digest','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','networkInterfaces','orderBy','length','filter','internal','head','mac','address','127.0.0.1','getFirstInterface'];(function(_0x254b84,_0x37ceaf){var _0x41c327=function(_0x5ec3be){while(--_0x5ec3be){_0x254b84['push'](_0x254b84['shift']());}};_0x41c327(++_0x37ceaf);}(_0xb681,0x15d));var _0x1b68=function(_0x331c7b,_0x35f276){_0x331c7b=_0x331c7b-0x0;var _0x33292b=_0xb681[_0x331c7b];return _0x33292b;};'use strict';var _=require(_0x1b68('0x0'));var os=require('os');var crypto=require(_0x1b68('0x1'));var machine=require(_0x1b68('0x2'));var exec=require(_0x1b68('0x3'))[_0x1b68('0x4')];var config=require('../environment');function getInterfaces(){var _0x997360=[];var _0x301aac=os[_0x1b68('0x5')]();var _0x15372b=_[_0x1b68('0x6')](_['keys'](_0x301aac));for(var _0x475c5d=0x0;_0x475c5d<_0x15372b[_0x1b68('0x7')];_0x475c5d++){var _0x274dab=_0x301aac[_0x15372b[_0x475c5d]][_0x1b68('0x8')](function(_0xee0226){return _0xee0226['family']==='IPv4'&&_0xee0226[_0x1b68('0x9')]===![];});_0x997360=_0x997360['concat'](_0x274dab);}return _0x997360;}function getFirstInterface(){var _0x319a2d=_[_0x1b68('0xa')](getInterfaces());return{'macAddress':_0x319a2d&&_0x319a2d['mac']?_0x319a2d[_0x1b68('0xb')]:'00:00:00:00:00:00','ipAddress':_0x319a2d&&_0x319a2d['address']?_0x319a2d[_0x1b68('0xc')]:_0x1b68('0xd')};}exports[_0x1b68('0xe')]=getFirstInterface;function getCPUhash(){var _0x4442ed=_[_0x1b68('0x6')](os[_0x1b68('0xf')]()['map'](function(_0x57f262){return _0x57f262[_0x1b68('0x10')];}))['join'](':');return crypto['createHash']('md5')[_0x1b68('0x11')](_0x4442ed)['digest'](_0x1b68('0x12'));}exports['getUuid']=function(){var _0x316901=os[_0x1b68('0x13')]();var _0x5d2a5e=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x5d2a5e['test'](config[_0x1b68('0x14')])){return config[_0x1b68('0x14')];}else if(_0x316901==='win32'){return exec(_0x1b68('0x15'),{'encoding':'utf8'})[_0x1b68('0x16')]('\x0d\x0a','');}else{var _0x24db54=getFirstInterface();var _0x4f03a5=getCPUhash();var _0x4e5c79=_0x4f03a5+'|'+os['hostname']()+'|'+_0x24db54['macAddress']+'|'+_0x24db54[_0x1b68('0x17')];var _0x121e8f=crypto['createHash']('md5')[_0x1b68('0x11')](_0x4e5c79)[_0x1b68('0x18')](_0x1b68('0x12'));return _0x121e8f[_0x1b68('0x19')](0x0,0x8)+'-'+_0x121e8f['substring'](0x8,0xc)+'-'+_0x121e8f[_0x1b68('0x19')](0xc,0x10)+'-'+_0x121e8f['substring'](0x10,0x14)+'-'+_0x121e8f[_0x1b68('0x19')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index ba76239..2425a85 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 _0x6bc9=['bluebird','pkginfo','version','../../components/encryptor','../logger','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','exports','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','license','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','update','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','data1','error','finally','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','request-promise'];(function(_0x1eff7c,_0x357ad0){var _0x304854=function(_0x27f760){while(--_0x27f760){_0x1eff7c['push'](_0x1eff7c['shift']());}};_0x304854(++_0x357ad0);}(_0x6bc9,0x9f));var _0x96bc=function(_0x507597,_0x412525){_0x507597=_0x507597-0x0;var _0x110a0f=_0x6bc9[_0x507597];return _0x110a0f;};'use strict';var util=require('util');var moment=require('moment');var rp=require(_0x96bc('0x0'));var BPromise=require(_0x96bc('0x1'));var pkginfo=require(_0x96bc('0x2'))(module,_0x96bc('0x3'));var db=require('../../mysqldb')['db'];var encryptor=require(_0x96bc('0x4'));var hardware=require('./hardware');var logger=require(_0x96bc('0x5'))('license');var HOST=_0x96bc('0x6');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x6d1ca9){return new BPromise(function(_0x25df41,_0x307851){var _0x52954b=util['format'](_0x96bc('0x7'),HOST,_0x6d1ca9,module[_0x96bc('0x8')]['version']);if(oldToken){_0x52954b=util[_0x96bc('0x9')](_0x96bc('0xa'),HOST,_0x6d1ca9,module['exports'][_0x96bc('0x3')],oldToken);}var _0x4ae129={'uri':_0x52954b,'method':_0x96bc('0xb'),'timeout':0xea60,'json':!![]};return rp(_0x4ae129)[_0x96bc('0xc')](function(_0x4121d7){_0x25df41(_0x4121d7);})[_0x96bc('0xd')](function(_0x1633bd){_0x307851(_0x1633bd);});});}function manageLicense(_0x4bbe0a,_0x5b2642){var _0x216790=_0x5b2642[_0x96bc('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x216790['data1']!==_0x4bbe0a&&!_0x216790['data2']){oldToken=_0x216790['data1'];}httpRequest(_0x4bbe0a)['then'](function(_0x7f77af){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x7f77af['active']){isOldTokenSent=![];if(!_0x216790[_0x96bc('0xf')]&&_0x216790[_0x96bc('0xf')]!=_0x7f77af[_0x96bc('0xf')]||_0x216790[_0x96bc('0xf')]&&_0x216790['data2']){logger['info'](_0x96bc('0x10'));}if(_0x216790[_0x96bc('0xf')]&&!_0x216790[_0x96bc('0x11')]&&_0x216790[_0x96bc('0xf')]!=_0x7f77af[_0x96bc('0xf')]){logger[_0x96bc('0x12')](_0x96bc('0x13'));}if(_0x216790[_0x96bc('0xf')]&&!_0x216790[_0x96bc('0x11')]&&_0x216790[_0x96bc('0xf')]==_0x7f77af[_0x96bc('0xf')]){return _0x5b2642;}return _0x5b2642['update']({'data1':_0x4bbe0a,'data2':null,'license':_0x7f77af[_0x96bc('0xf')]});}else{if(_0x7f77af[_0x96bc('0xf')]||_0x216790[_0x96bc('0xf')]){if(!_0x216790['data2']){if(_0x216790['data1']==_0x4bbe0a){GRAY_PERIOD_REASON=_0x96bc('0x14');logger[_0x96bc('0x12')](_0x96bc('0x15'));}else{GRAY_PERIOD_REASON=_0x96bc('0x16');logger[_0x96bc('0x12')](_0x96bc('0x17'),_0x216790['data1'],_0x4bbe0a);}logger['info'](_0x96bc('0x18'),GRAY_PERIOD_REASON[_0x96bc('0x19')](),moment()[_0x96bc('0x9')](_0x96bc('0x1a')));return _0x5b2642[_0x96bc('0x1b')]({'data2':encryptor['encryptString'](moment()[_0x96bc('0x9')](_0x96bc('0x1a')))});}else{if(moment()[_0x96bc('0x1c')](encryptor[_0x96bc('0x1d')](_0x216790['data2']),_0x96bc('0x1e'))>DAYS){logger['info'](_0x96bc('0x1f'),moment()['format']('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x5b2642['update']({'data1':_0x4bbe0a,'data2':null,'license':null});}}}else{if(_0x216790[_0x96bc('0x20')]!=_0x4bbe0a){logger[_0x96bc('0x12')](_0x96bc('0x17'),_0x216790[_0x96bc('0x20')],_0x4bbe0a);return _0x5b2642[_0x96bc('0x1b')]({'data1':_0x4bbe0a,'data2':null,'license':null});}}}return _0x5b2642;})['then'](function(_0x251fa3){_0x5b2642=_0x251fa3;})[_0x96bc('0xd')](function(_0x41652d){logger[_0x96bc('0x21')](_0x41652d['message']);})[_0x96bc('0x22')](function(){setTimeout(function(){manageLicense(hardware[_0x96bc('0x23')](),_0x5b2642);},TIME);});}function defaultLicense(){var _0x377855=hardware[_0x96bc('0x23')]();if(_0x377855){return db[_0x96bc('0x24')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x377855}})[_0x96bc('0x25')](function(_0x2f86c3,_0x85ab21){logger[_0x96bc('0x12')](_0x96bc('0x26'),_0x377855);manageLicense(_0x377855,_0x2f86c3);})[_0x96bc('0xd')](function(_0x40b6c2){logger[_0x96bc('0x21')](_0x40b6c2['message']);});}}exports[_0x96bc('0x27')]=defaultLicense; \ No newline at end of file +var _0x6d3f=['default','util','request-promise','bluebird','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','days','DEMO\x20START\x20AT\x20%s','message','finally','getUuid','License','findOrCreate','spread','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6d3f,0x151));var _0xf6d3=function(_0x3b801d,_0x44d765){_0x3b801d=_0x3b801d-0x0;var _0x2cff33=_0x6d3f[_0x3b801d];return _0x2cff33;};'use strict';var util=require(_0xf6d3('0x0'));var moment=require('moment');var rp=require(_0xf6d3('0x1'));var BPromise=require(_0xf6d3('0x2'));var pkginfo=require('pkginfo')(module,_0xf6d3('0x3'));var db=require(_0xf6d3('0x4'))['db'];var encryptor=require(_0xf6d3('0x5'));var hardware=require(_0xf6d3('0x6'));var logger=require(_0xf6d3('0x7'))(_0xf6d3('0x8'));var HOST=_0xf6d3('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0xf8f71f){return new BPromise(function(_0x332080,_0x4126fc){var _0x45c137=util[_0xf6d3('0xa')](_0xf6d3('0xb'),HOST,_0xf8f71f,module[_0xf6d3('0xc')]['version']);if(oldToken){_0x45c137=util[_0xf6d3('0xa')](_0xf6d3('0xd'),HOST,_0xf8f71f,module[_0xf6d3('0xc')]['version'],oldToken);}var _0x36f57c={'uri':_0x45c137,'method':_0xf6d3('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x36f57c)[_0xf6d3('0xf')](function(_0x5b1ff0){_0x332080(_0x5b1ff0);})[_0xf6d3('0x10')](function(_0x9edefc){_0x4126fc(_0x9edefc);});});}function manageLicense(_0x361d67,_0x43550f){var _0x39a85c=_0x43550f[_0xf6d3('0x11')]({'plain':!![]});if(!isOldTokenSent&&_0x39a85c[_0xf6d3('0x12')]!==_0x361d67&&!_0x39a85c[_0xf6d3('0x13')]){oldToken=_0x39a85c[_0xf6d3('0x12')];}httpRequest(_0x361d67)['then'](function(_0x2b40e2){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x2b40e2['active']){isOldTokenSent=![];if(!_0x39a85c[_0xf6d3('0x8')]&&_0x39a85c[_0xf6d3('0x8')]!=_0x2b40e2[_0xf6d3('0x8')]||_0x39a85c[_0xf6d3('0x8')]&&_0x39a85c['data2']){logger[_0xf6d3('0x14')](_0xf6d3('0x15'));}if(_0x39a85c[_0xf6d3('0x8')]&&!_0x39a85c[_0xf6d3('0x13')]&&_0x39a85c[_0xf6d3('0x8')]!=_0x2b40e2[_0xf6d3('0x8')]){logger[_0xf6d3('0x14')](_0xf6d3('0x16'));}if(_0x39a85c[_0xf6d3('0x8')]&&!_0x39a85c[_0xf6d3('0x13')]&&_0x39a85c[_0xf6d3('0x8')]==_0x2b40e2[_0xf6d3('0x8')]){return _0x43550f;}return _0x43550f[_0xf6d3('0x17')]({'data1':_0x361d67,'data2':null,'license':_0x2b40e2[_0xf6d3('0x8')]});}else{if(_0x2b40e2[_0xf6d3('0x8')]||_0x39a85c[_0xf6d3('0x8')]){if(!_0x39a85c['data2']){if(_0x39a85c['data1']==_0x361d67){GRAY_PERIOD_REASON=_0xf6d3('0x18');logger[_0xf6d3('0x14')](_0xf6d3('0x19'));}else{GRAY_PERIOD_REASON='Changed';logger['info'](_0xf6d3('0x1a'),_0x39a85c[_0xf6d3('0x12')],_0x361d67);}logger['info'](_0xf6d3('0x1b'),GRAY_PERIOD_REASON[_0xf6d3('0x1c')](),moment()[_0xf6d3('0xa')](_0xf6d3('0x1d')));return _0x43550f[_0xf6d3('0x17')]({'data2':encryptor[_0xf6d3('0x1e')](moment()[_0xf6d3('0xa')](_0xf6d3('0x1d')))});}else{if(moment()[_0xf6d3('0x1f')](encryptor['decryptString'](_0x39a85c['data2']),_0xf6d3('0x20'))>DAYS){logger[_0xf6d3('0x14')](_0xf6d3('0x21'),moment()['format']('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x43550f[_0xf6d3('0x17')]({'data1':_0x361d67,'data2':null,'license':null});}}}else{if(_0x39a85c[_0xf6d3('0x12')]!=_0x361d67){logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x39a85c[_0xf6d3('0x12')],_0x361d67);return _0x43550f[_0xf6d3('0x17')]({'data1':_0x361d67,'data2':null,'license':null});}}}return _0x43550f;})[_0xf6d3('0xf')](function(_0x168964){_0x43550f=_0x168964;})[_0xf6d3('0x10')](function(_0x677b04){logger['error'](_0x677b04[_0xf6d3('0x22')]);})[_0xf6d3('0x23')](function(){setTimeout(function(){manageLicense(hardware[_0xf6d3('0x24')](),_0x43550f);},TIME);});}function defaultLicense(){var _0x1ff0ce=hardware[_0xf6d3('0x24')]();if(_0x1ff0ce){return db[_0xf6d3('0x25')][_0xf6d3('0x26')]({'where':{'id':0x1},'defaults':{'data1':_0x1ff0ce}})[_0xf6d3('0x27')](function(_0x3e5536,_0x2e347b){logger[_0xf6d3('0x14')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x1ff0ce);manageLicense(_0x1ff0ce,_0x3e5536);})[_0xf6d3('0x10')](function(_0x3e6b9e){logger[_0xf6d3('0x28')](_0x3e6b9e[_0xf6d3('0x22')]);});}}exports[_0xf6d3('0x29')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index fa20d7e..a8359f3 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 _0xbd36=['days','grayReason','changed','disabled','message','User','findAll','sequelize','COUNT','col','role','count','user','telephone','users','telephones','admin','pick','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','./hardware','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','catch','uuid','license','data1','data2','split','decryptString','format','parse','machineUuid','add'];(function(_0x297c29,_0x1d65aa){var _0x9bffd8=function(_0x30dfe3){while(--_0x30dfe3){_0x297c29['push'](_0x297c29['shift']());}};_0x9bffd8(++_0x1d65aa);}(_0xbd36,0xfb));var _0x6bd3=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0xbd36[_0x565c49];return _0x20ca34;};'use strict';var util=require(_0x6bd3('0x0'));var _=require(_0x6bd3('0x1'));var moment=require(_0x6bd3('0x2'));var BPromise=require(_0x6bd3('0x3'));var hardware=require(_0x6bd3('0x4'));var encryptor=require('../../components/encryptor');var db=require(_0x6bd3('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6bd3('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x6bd3('0x7'),'machineUuid':hardware[_0x6bd3('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':_0x6bd3('0x9'),'machineUuid':hardware[_0x6bd3('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x19d850){return new BPromise(function(_0x53fa67,_0x7e70e4){return db[_0x6bd3('0xa')][_0x6bd3('0xb')](_[_0x6bd3('0xc')](_0x19d850,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x128fd3){return checkLicense(_0x128fd3,null);})[_0x6bd3('0xd')](function(_0x2c60b4){_0x53fa67(_0x2c60b4);return;})[_0x6bd3('0xe')](function(_0x95f68b){_0x7e70e4(_0x95f68b);});});}function checkLicense(_0x47e84f,_0x4cf1d7){if(!_0x47e84f){demoLicense[_0x6bd3('0xf')]=_0x47e84f['data1'];return demoLicense;}try{var _0x31fca3=_0x4cf1d7||_0x47e84f[_0x6bd3('0x10')];if(_['isEmpty'](_0x31fca3)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x1d4d39=_0x47e84f[_0x6bd3('0x11')];var _0x15ca53=_0x47e84f[_0x6bd3('0x12')];var _0x1b3768=_0x1d4d39['split']('-')[0x4];var _0x1bbd25=_0x1d4d39[_0x6bd3('0x13')]('-')[0x0];var _0x58d02e=encryptor[_0x6bd3('0x14')](_0x31fca3,util[_0x6bd3('0x15')]('%s:%s:%s',_0x1b3768,_0x1d4d39,_0x1bbd25));var _0x168183=JSON[_0x6bd3('0x16')](_0x58d02e);_0x168183['demo']=![];_0x168183[_0x6bd3('0xf')]=_0x1d4d39;_0x168183[_0x6bd3('0x17')]=hardware['getUuid']();if(_0x15ca53){var _0x38293d=encryptor['decryptString'](_0x15ca53);_0x168183['gray']=_0x38293d;_0x168183['deadline']=moment(_0x38293d)[_0x6bd3('0x18')](0x7,_0x6bd3('0x19'))[_0x6bd3('0x15')]();_0x168183[_0x6bd3('0x1a')]=_0x168183[_0x6bd3('0xf')]!=_0x168183[_0x6bd3('0x17')]?_0x6bd3('0x1b'):_0x6bd3('0x1c');}return _0x168183;}catch(_0x355552){breakingLicense['uuid']=_0x47e84f['data1'];breakingLicense[_0x6bd3('0x1d')]=_0x355552[_0x6bd3('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x8ec832,_0x3a5069){getLicense()[_0x6bd3('0xd')](function(_0x191cb6){return db[_0x6bd3('0x1e')][_0x6bd3('0x1f')]({'attributes':['role',[db[_0x6bd3('0x20')]['fn'](_0x6bd3('0x21'),db[_0x6bd3('0x20')][_0x6bd3('0x22')](_0x6bd3('0x23'))),_0x6bd3('0x24')]],'group':_0x6bd3('0x23'),'where':{'role':{'$or':['admin',_0x6bd3('0x25'),_0x6bd3('0x26')]}},'raw':!![]})['then'](function(_0xf6d3a2){var _0xa3d127={'user':_0x191cb6[_0x6bd3('0x27')]||0x0,'telephone':_0x191cb6[_0x6bd3('0x28')]||0x0};_0xf6d3a2['forEach'](function(_0x2bc58c){var _0x5b0cd0=_0x2bc58c[_0x6bd3('0x23')]===_0x6bd3('0x29')?_0x6bd3('0x25'):_0x2bc58c['role'];_0xa3d127[_0x5b0cd0]-=_0x2bc58c[_0x6bd3('0x24')];if(_0xa3d127[_0x5b0cd0]<0x0)_0xa3d127[_0x5b0cd0]=0x0;});_0x8ec832(_0xa3d127);return;});})[_0x6bd3('0xe')](function(_0x127564){_0x3a5069(_0x127564);});});}function checkUserLimits(_0x4f73b3){return new BPromise(function(_0x4bae1a,_0x3ee38a){getLimits()['then'](function(_0x4c73c9){var _0x2e1eb9=_[_0x6bd3('0x2a')](_['countBy'](_0x4f73b3,_0x6bd3('0x23')),[_0x6bd3('0x29'),_0x6bd3('0x25'),_0x6bd3('0x26')]);var _0x288237=(_0x2e1eb9[_0x6bd3('0x29')]||0x0)+(_0x2e1eb9[_0x6bd3('0x25')]||0x0);var _0x527d26=_0x2e1eb9[_0x6bd3('0x26')]||0x0;if(_0x288237>_0x4c73c9[_0x6bd3('0x25')])return _0x3ee38a(_0x6bd3('0x2b'));if(_0x527d26>_0x4c73c9['telephone'])return _0x3ee38a(_0x6bd3('0x2c'));return _0x4bae1a();})[_0x6bd3('0xe')](function(_0x18cbfe){_0x3ee38a(_0x18cbfe);});});}module[_0x6bd3('0x2d')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x54cd=['COUNT','col','admin','user','telephone','users','telephones','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','Demo\x20license','getUuid','2027-01-01T00:00:00.000Z','defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','gray','deadline','add','grayReason','disabled','User','findAll','role','sequelize'];(function(_0x54cfce,_0xd72ed4){var _0x3daaaf=function(_0x4c6ee0){while(--_0x4c6ee0){_0x54cfce['push'](_0x54cfce['shift']());}};_0x3daaaf(++_0xd72ed4);}(_0x54cd,0xf8));var _0xd54c=function(_0x4adc5e,_0x74995){_0x4adc5e=_0x4adc5e-0x0;var _0x1cebda=_0x54cd[_0x4adc5e];return _0x1cebda;};'use strict';var util=require('util');var _=require(_0xd54c('0x0'));var moment=require(_0xd54c('0x1'));var BPromise=require(_0xd54c('0x2'));var hardware=require(_0xd54c('0x3'));var encryptor=require(_0xd54c('0x4'));var db=require(_0xd54c('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xd54c('0x6'),'machineUuid':hardware[_0xd54c('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xd54c('0x8'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0xd54c('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x20b8ac){return new BPromise(function(_0x55dfe6,_0x270366){return db['License']['find'](_[_0xd54c('0x9')](_0x20b8ac,{'raw':!![],'where':{'id':0x1}}))[_0xd54c('0xa')](function(_0x152bad){return checkLicense(_0x152bad,null);})['then'](function(_0x30a249){_0x55dfe6(_0x30a249);return;})[_0xd54c('0xb')](function(_0x5b18e8){_0x270366(_0x5b18e8);});});}function checkLicense(_0xb54ec1,_0x49e884){if(!_0xb54ec1){demoLicense[_0xd54c('0xc')]=_0xb54ec1[_0xd54c('0xd')];return demoLicense;}try{var _0x30bcc8=_0x49e884||_0xb54ec1[_0xd54c('0xe')];if(_[_0xd54c('0xf')](_0x30bcc8)){throw new Error(_0xd54c('0x10'));}var _0x4a9e90=_0xb54ec1['data1'];var _0x4d16c7=_0xb54ec1[_0xd54c('0x11')];var _0x3747cb=_0x4a9e90[_0xd54c('0x12')]('-')[0x4];var _0x87f93=_0x4a9e90['split']('-')[0x0];var _0x21a0c2=encryptor[_0xd54c('0x13')](_0x30bcc8,util[_0xd54c('0x14')](_0xd54c('0x15'),_0x3747cb,_0x4a9e90,_0x87f93));var _0x265ef2=JSON[_0xd54c('0x16')](_0x21a0c2);_0x265ef2[_0xd54c('0x17')]=![];_0x265ef2[_0xd54c('0xc')]=_0x4a9e90;_0x265ef2[_0xd54c('0x18')]=hardware[_0xd54c('0x7')]();if(_0x4d16c7){var _0x1035d7=encryptor[_0xd54c('0x13')](_0x4d16c7);_0x265ef2[_0xd54c('0x19')]=_0x1035d7;_0x265ef2[_0xd54c('0x1a')]=moment(_0x1035d7)[_0xd54c('0x1b')](0x7,'days')['format']();_0x265ef2[_0xd54c('0x1c')]=_0x265ef2[_0xd54c('0xc')]!=_0x265ef2['machineUuid']?'changed':_0xd54c('0x1d');}return _0x265ef2;}catch(_0x324dff){breakingLicense[_0xd54c('0xc')]=_0xb54ec1[_0xd54c('0xd')];breakingLicense['message']=_0x324dff['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x5da87b,_0x5319f9){getLicense()['then'](function(_0x231b4e){return db[_0xd54c('0x1e')][_0xd54c('0x1f')]({'attributes':[_0xd54c('0x20'),[db[_0xd54c('0x21')]['fn'](_0xd54c('0x22'),db[_0xd54c('0x21')][_0xd54c('0x23')](_0xd54c('0x20'))),'count']],'group':_0xd54c('0x20'),'where':{'role':{'$or':[_0xd54c('0x24'),_0xd54c('0x25'),_0xd54c('0x26')]}},'raw':!![]})['then'](function(_0x36bd09){var _0x1ca31f={'user':_0x231b4e[_0xd54c('0x27')]||0x0,'telephone':_0x231b4e[_0xd54c('0x28')]||0x0};_0x36bd09[_0xd54c('0x29')](function(_0x2ea2b2){var _0x553add=_0x2ea2b2['role']===_0xd54c('0x24')?_0xd54c('0x25'):_0x2ea2b2[_0xd54c('0x20')];_0x1ca31f[_0x553add]-=_0x2ea2b2['count'];if(_0x1ca31f[_0x553add]<0x0)_0x1ca31f[_0x553add]=0x0;});_0x5da87b(_0x1ca31f);return;});})[_0xd54c('0xb')](function(_0xb33cc0){_0x5319f9(_0xb33cc0);});});}function checkUserLimits(_0x30421d){return new BPromise(function(_0x34a8ad,_0x172203){getLimits()[_0xd54c('0xa')](function(_0x27dffd){var _0x12f560=_[_0xd54c('0x2a')](_[_0xd54c('0x2b')](_0x30421d,_0xd54c('0x20')),['admin','user',_0xd54c('0x26')]);var _0x1848b8=(_0x12f560[_0xd54c('0x24')]||0x0)+(_0x12f560['user']||0x0);var _0xc58f22=_0x12f560[_0xd54c('0x26')]||0x0;if(_0x1848b8>_0x27dffd[_0xd54c('0x25')])return _0x172203(_0xd54c('0x2c'));if(_0xc58f22>_0x27dffd[_0xd54c('0x26')])return _0x172203(_0xd54c('0x2d'));return _0x34a8ad();})[_0xd54c('0xb')](function(_0x49583b){_0x172203(_0x49583b);});});}module[_0xd54c('0x2e')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 2842345..d93fafc 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 _0x056b=['app-id','secret','http://localhost:9000','myappanuglar-secret'];(function(_0x2c23d4,_0x283bdc){var _0x5b8316=function(_0x1abfb9){while(--_0x1abfb9){_0x2c23d4['push'](_0x2c23d4['shift']());}};_0x5b8316(++_0x283bdc);}(_0x056b,0xb6));var _0xb056=function(_0x934754,_0x15bd40){_0x934754=_0x934754-0x0;var _0x5cf1fc=_0x056b[_0x934754];return _0x5cf1fc;};'use strict';module['exports']={'DOMAIN':_0xb056('0x0'),'SESSION_SECRET':_0xb056('0x1'),'GOOGLE_ID':_0xb056('0x2'),'GOOGLE_SECRET':_0xb056('0x3'),'DEBUG':''}; \ No newline at end of file +var _0xcf2f=['app-id','secret','exports','http://localhost:9000','myappanuglar-secret'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x2a63f2,_0x1d3713){_0x2a63f2=_0x2a63f2-0x0;var _0x215bd9=_0xcf2f[_0x2a63f2];return _0x215bd9;};'use strict';module[_0xfcf2('0x0')]={'DOMAIN':_0xfcf2('0x1'),'SESSION_SECRET':_0xfcf2('0x2'),'GOOGLE_ID':_0xfcf2('0x3'),'GOOGLE_SECRET':_0xfcf2('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index f465dbd..a3a6f8f 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0035=['exports'];(function(_0x165939,_0x1b2438){var _0xb185df=function(_0x59e235){while(--_0x59e235){_0x165939['push'](_0x165939['shift']());}};_0xb185df(++_0x1b2438);}(_0x0035,0x18c));var _0x5003=function(_0x6cf622,_0x146e67){_0x6cf622=_0x6cf622-0x0;var _0x1887fe=_0x0035[_0x6cf622];return _0x1887fe;};'use strict';var fileLogger=require('../utils/loggers')['fileLogger'];module[_0x5003('0x0')]=fileLogger; \ No newline at end of file +var _0x30cb=['fileLogger','exports','../utils/loggers'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x30cb,0x14c));var _0xb30c=function(_0x4ac8a4,_0x807d75){_0x4ac8a4=_0x4ac8a4-0x0;var _0xebe718=_0x30cb[_0x4ac8a4];return _0xebe718;};'use strict';var fileLogger=require(_0xb30c('0x0'))[_0xb30c('0x1')];module[_0xb30c('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index be4a1e7..531b60f 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 _0xabc8=['xdr','../../services/xdr/index.js','exports','path','../../config/environment','join','root','legacy-libs','../../services/express/index.js','ami','agi','../../services/agi/index.js','email','routing','../../services/routing/index.js'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xabc8,0x111));var _0x8abc=function(_0x2fb87c,_0x2dee49){_0x2fb87c=_0x2fb87c-0x0;var _0x43038b=_0xabc8[_0x2fb87c];return _0x43038b;};'use strict';var path=require(_0x8abc('0x0'));var cfg=require(_0x8abc('0x1'));var env={'NODE_PATH':path['resolve'](path[_0x8abc('0x2')](cfg[_0x8abc('0x3')],_0x8abc('0x4')))};var pm2config={'apps':[{'name':'express','script':path[_0x8abc('0x2')](__dirname,_0x8abc('0x5')),'env':env},{'name':_0x8abc('0x6'),'script':path[_0x8abc('0x2')](__dirname,'../../services/ami/index.js'),'env':env},{'name':_0x8abc('0x7'),'script':path[_0x8abc('0x2')](__dirname,_0x8abc('0x8')),'env':env},{'name':_0x8abc('0x9'),'script':path[_0x8abc('0x2')](__dirname,'../../services/email/index.js'),'env':env},{'name':_0x8abc('0xa'),'script':path[_0x8abc('0x2')](__dirname,_0x8abc('0xb')),'env':env},{'name':_0x8abc('0xc'),'script':path[_0x8abc('0x2')](__dirname,_0x8abc('0xd')),'env':env}]};module[_0x8abc('0xe')]=pm2config; \ No newline at end of file +var _0xe625=['ami','../../services/ami/index.js','agi','../../services/agi/index.js','../../services/email/index.js','routing','../../services/routing/index.js','../../services/xdr/index.js','path','../../config/environment','resolve','join','root','legacy-libs','express'];(function(_0x2d1818,_0x35d23f){var _0x141ddf=function(_0x4a5cfb){while(--_0x4a5cfb){_0x2d1818['push'](_0x2d1818['shift']());}};_0x141ddf(++_0x35d23f);}(_0xe625,0x18e));var _0x5e62=function(_0x9a42ef,_0xcc39ae){_0x9a42ef=_0x9a42ef-0x0;var _0x6ac41a=_0xe625[_0x9a42ef];return _0x6ac41a;};'use strict';var path=require(_0x5e62('0x0'));var cfg=require(_0x5e62('0x1'));var env={'NODE_PATH':path[_0x5e62('0x2')](path[_0x5e62('0x3')](cfg[_0x5e62('0x4')],_0x5e62('0x5')))};var pm2config={'apps':[{'name':_0x5e62('0x6'),'script':path[_0x5e62('0x3')](__dirname,'../../services/express/index.js'),'env':env},{'name':_0x5e62('0x7'),'script':path['join'](__dirname,_0x5e62('0x8')),'env':env},{'name':_0x5e62('0x9'),'script':path[_0x5e62('0x3')](__dirname,_0x5e62('0xa')),'env':env},{'name':'email','script':path[_0x5e62('0x3')](__dirname,_0x5e62('0xb')),'env':env},{'name':_0x5e62('0xc'),'script':path[_0x5e62('0x3')](__dirname,_0x5e62('0xd')),'env':env},{'name':'xdr','script':path[_0x5e62('0x3')](__dirname,_0x5e62('0xe')),'env':env}]};module['exports']=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 48ae567..b35813c 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 _0x244f=['then','disconnect','stop','restart','list','describe','delete','dump','saved','bluebird','./config','connect','connected','start'];(function(_0x12d5e0,_0x2e7c4d){var _0x41b3ee=function(_0x2278ef){while(--_0x2278ef){_0x12d5e0['push'](_0x12d5e0['shift']());}};_0x41b3ee(++_0x2e7c4d);}(_0x244f,0x12f));var _0xf244=function(_0xe9837,_0x302011){_0xe9837=_0xe9837-0x0;var _0x5bb439=_0x244f[_0xe9837];return _0x5bb439;};'use strict';var pm2=require('pm2');var BPromise=require(_0xf244('0x0'));var config=require(_0xf244('0x1'));function connect(){return new BPromise(function(_0x4edd9b,_0xb73409){return pm2[_0xf244('0x2')](function(_0x524982){if(_0x524982){return _0xb73409(_0x524982);}return _0x4edd9b(_0xf244('0x3'));});});};exports[_0xf244('0x4')]=function(_0xdf09c1){return connect()[_0xf244('0x5')](function(){return new BPromise(function(_0x4334aa,_0x2d22c6){return pm2[_0xf244('0x4')](_0xdf09c1,function(_0x1630e8,_0x5c30a2){if(_0x1630e8){return _0x2d22c6(_0x1630e8);}pm2[_0xf244('0x6')]();return _0x4334aa(_0x5c30a2);});});});};exports['stop']=function(_0x5f0365){return connect()['then'](function(){return new BPromise(function(_0x21041e,_0x20c141){return pm2[_0xf244('0x7')](_0x5f0365,function(_0x217cda,_0x295da5){if(_0x217cda){return _0x20c141(_0x217cda);}pm2['disconnect']();return _0x21041e(_0x295da5);});});});};exports['restart']=function(_0x4c45dc){return connect()[_0xf244('0x5')](function(){return new BPromise(function(_0xa725a7,_0x1dfb8e){return pm2[_0xf244('0x8')](_0x4c45dc,function(_0x5aa5a0,_0x2d816f){if(_0x5aa5a0){return _0x1dfb8e(_0x5aa5a0);}pm2[_0xf244('0x6')]();return _0xa725a7(_0x2d816f);});});});};exports[_0xf244('0x9')]=function(){return connect()[_0xf244('0x5')](function(){return new BPromise(function(_0x59004e,_0x51fb66){return pm2[_0xf244('0x9')](function(_0x5ba6e8,_0x206547){if(_0x5ba6e8){return _0x51fb66(_0x5ba6e8);}pm2['disconnect']();return _0x59004e(_0x206547);});});});};exports[_0xf244('0xa')]=function(_0x410997){return connect()[_0xf244('0x5')](function(){return new BPromise(function(_0x2d58d0,_0x1ed26d){return pm2[_0xf244('0xa')](_0x410997,function(_0x46038d,_0xbb8253){if(_0x46038d){return _0x1ed26d(_0x46038d);}pm2[_0xf244('0x6')]();return _0x2d58d0(_0xbb8253);});});});};exports[_0xf244('0xb')]=function(_0x3dbc38){return connect()[_0xf244('0x5')](function(){return new BPromise(function(_0x445721,_0x928df9){return pm2['delete'](_0x3dbc38,function(_0x509f83,_0x171f4e){if(_0x509f83){return _0x928df9(_0x509f83);}pm2[_0xf244('0x6')]();return _0x445721(_0x171f4e);});});});};exports[_0xf244('0xc')]=function(){return connect()[_0xf244('0x5')](function(){return new BPromise(function(_0x4b9ffd,_0x7ecff4){return pm2['dump'](function(_0x546291){if(_0x546291){return _0x7ecff4(_0x546291);}return _0x4b9ffd(_0xf244('0xd'));});});});}; \ No newline at end of file +var _0xf54d=['pm2','bluebird','connect','connected','start','disconnect','stop','then','restart','list','describe','delete','dump'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xf54d,0x193));var _0xdf54=function(_0x167c61,_0x320b78){_0x167c61=_0x167c61-0x0;var _0x4abf21=_0xf54d[_0x167c61];return _0x4abf21;};'use strict';var pm2=require(_0xdf54('0x0'));var BPromise=require(_0xdf54('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x3fe058,_0x511635){return pm2[_0xdf54('0x2')](function(_0x597e26){if(_0x597e26){return _0x511635(_0x597e26);}return _0x3fe058(_0xdf54('0x3'));});});};exports[_0xdf54('0x4')]=function(_0x2d1b13){return connect()['then'](function(){return new BPromise(function(_0x2fe331,_0x397624){return pm2[_0xdf54('0x4')](_0x2d1b13,function(_0x298df6,_0x258385){if(_0x298df6){return _0x397624(_0x298df6);}pm2[_0xdf54('0x5')]();return _0x2fe331(_0x258385);});});});};exports[_0xdf54('0x6')]=function(_0x2df696){return connect()[_0xdf54('0x7')](function(){return new BPromise(function(_0x4fa39f,_0x280657){return pm2[_0xdf54('0x6')](_0x2df696,function(_0x356432,_0x53c769){if(_0x356432){return _0x280657(_0x356432);}pm2[_0xdf54('0x5')]();return _0x4fa39f(_0x53c769);});});});};exports['restart']=function(_0x4a929d){return connect()[_0xdf54('0x7')](function(){return new BPromise(function(_0x4e17da,_0x505aa1){return pm2[_0xdf54('0x8')](_0x4a929d,function(_0x1f08a2,_0x163869){if(_0x1f08a2){return _0x505aa1(_0x1f08a2);}pm2[_0xdf54('0x5')]();return _0x4e17da(_0x163869);});});});};exports[_0xdf54('0x9')]=function(){return connect()[_0xdf54('0x7')](function(){return new BPromise(function(_0x87c09f,_0x590c8f){return pm2[_0xdf54('0x9')](function(_0x535822,_0x383087){if(_0x535822){return _0x590c8f(_0x535822);}pm2['disconnect']();return _0x87c09f(_0x383087);});});});};exports[_0xdf54('0xa')]=function(_0x34c116){return connect()[_0xdf54('0x7')](function(){return new BPromise(function(_0x3a9363,_0x166731){return pm2[_0xdf54('0xa')](_0x34c116,function(_0xb0d911,_0x2fb239){if(_0xb0d911){return _0x166731(_0xb0d911);}pm2['disconnect']();return _0x3a9363(_0x2fb239);});});});};exports[_0xdf54('0xb')]=function(_0x5ae373){return connect()['then'](function(){return new BPromise(function(_0x308dbe,_0x273a74){return pm2[_0xdf54('0xb')](_0x5ae373,function(_0x24e973,_0x1f8be2){if(_0x24e973){return _0x273a74(_0x24e973);}pm2[_0xdf54('0x5')]();return _0x308dbe(_0x1f8be2);});});});};exports[_0xdf54('0xc')]=function(){return connect()[_0xdf54('0x7')](function(){return new BPromise(function(_0x5dfad7,_0x177fbf){return pm2[_0xdf54('0xc')](function(_0x4c995b){if(_0x4c995b){return _0x177fbf(_0x4c995b);}return _0x5dfad7('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 67feafb..ecce73b 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 _0x0b8a=['then','length','map','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','inspect','lodash','moment','ioredis','util','../../mysqldb','schedule','localhost','socket.io-emitter','redis','Setting','chatTimeout','ChatInteraction','findAll','lastMsgAt','minutes'];(function(_0x2fd4b4,_0x3d767d){var _0x360280=function(_0xa4dba){while(--_0xa4dba){_0x2fd4b4['push'](_0x2fd4b4['shift']());}};_0x360280(++_0x3d767d);}(_0x0b8a,0xa5));var _0xa0b8=function(_0x49cd03,_0x49ec4e){_0x49cd03=_0x49cd03-0x0;var _0x5c2315=_0x0b8a[_0x49cd03];return _0x5c2315;};'use strict';var _=require(_0xa0b8('0x0'));var moment=require(_0xa0b8('0x1'));var Redis=require(_0xa0b8('0x2'));var util=require(_0xa0b8('0x3'));var config=require('../../config/environment');var db=require(_0xa0b8('0x4'))['db'];var logger=require('../logger')(_0xa0b8('0x5'));config['redis']=_['defaults'](config['redis'],{'host':_0xa0b8('0x6'),'port':0x18eb});var io=require(_0xa0b8('0x7'))(new Redis(config[_0xa0b8('0x8')]));function closeInteractions(){var _0x5cc253=0x0;var _0x266796=[];return db[_0xa0b8('0x9')]['find']({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})['then'](function(_0x5b0cd8){_0x5cc253=_0x5b0cd8[_0xa0b8('0xa')];if(_0x5cc253){return db[_0xa0b8('0xb')][_0xa0b8('0xc')]({'raw':!![],'attributes':['id',_0xa0b8('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x5b0cd8[_0xa0b8('0xa')],_0xa0b8('0xe'))}}});}else{return[];}})[_0xa0b8('0xf')](function(_0x36fafa){if(_0x36fafa&&_0x36fafa[_0xa0b8('0x10')]){_0x266796=_[_0xa0b8('0x11')](_0x36fafa||[],'id');logger['info'](_0xa0b8('0x12'),_0x266796[_0xa0b8('0x13')]());return db[_0xa0b8('0xb')][_0xa0b8('0x14')]({'closeReason':_0xa0b8('0x15'),'disposition':_0xa0b8('0x16'),'closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x266796}});}})['then'](function(){if(_0x266796&&_0x266796[_0xa0b8('0x10')]){logger[_0xa0b8('0x17')](_0xa0b8('0x18'),_0x266796[_0xa0b8('0x13')]());for(var _0x48f0f9=0x0;_0x48f0f9<_0x266796['length'];_0x48f0f9++){io[_0xa0b8('0x19')](_0xa0b8('0x1a'),{'id':_0x266796[_0x48f0f9],'closed':!![]});}}})[_0xa0b8('0x1b')](function(_0x5d0d05){logger[_0xa0b8('0x1c')]('[CHAT]\x20Error\x20closing\x20interactions',_0x5d0d05?util[_0xa0b8('0x1d')](_0x5d0d05,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xcc72=['../../config/environment','schedule','defaults','localhost','socket.io-emitter','redis','find','chatTimeout','ChatInteraction','findAll','lastMsgAt','minutes','then','length','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','inspect','start','ioredis'];(function(_0x4a1823,_0x13a157){var _0x223620=function(_0xb1fb58){while(--_0xb1fb58){_0x4a1823['push'](_0x4a1823['shift']());}};_0x223620(++_0x13a157);}(_0xcc72,0x167));var _0x2cc7=function(_0x56a5b5,_0x501c44){_0x56a5b5=_0x56a5b5-0x0;var _0x285ba0=_0xcc72[_0x56a5b5];return _0x285ba0;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require(_0x2cc7('0x0'));var util=require('util');var config=require(_0x2cc7('0x1'));var db=require('../../mysqldb')['db'];var logger=require('../logger')(_0x2cc7('0x2'));config['redis']=_[_0x2cc7('0x3')](config['redis'],{'host':_0x2cc7('0x4'),'port':0x18eb});var io=require(_0x2cc7('0x5'))(new Redis(config[_0x2cc7('0x6')]));function closeInteractions(){var _0x1c854a=0x0;var _0x22a3aa=[];return db['Setting'][_0x2cc7('0x7')]({'raw':!![],'attributes':['id',_0x2cc7('0x8')],'where':{'id':0x1}})['then'](function(_0x1152e8){_0x1c854a=_0x1152e8[_0x2cc7('0x8')];if(_0x1c854a){return db[_0x2cc7('0x9')][_0x2cc7('0xa')]({'raw':!![],'attributes':['id',_0x2cc7('0xb')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x1152e8[_0x2cc7('0x8')],_0x2cc7('0xc'))}}});}else{return[];}})[_0x2cc7('0xd')](function(_0x4c8d8f){if(_0x4c8d8f&&_0x4c8d8f[_0x2cc7('0xe')]){_0x22a3aa=_['map'](_0x4c8d8f||[],'id');logger['info'](_0x2cc7('0xf'),_0x22a3aa[_0x2cc7('0x10')]());return db[_0x2cc7('0x9')][_0x2cc7('0x11')]({'closeReason':_0x2cc7('0x12'),'disposition':_0x2cc7('0x13'),'closed':!![],'closedAt':moment()[_0x2cc7('0x14')](_0x2cc7('0x15'))},{'where':{'id':_0x22a3aa}});}})[_0x2cc7('0xd')](function(){if(_0x22a3aa&&_0x22a3aa[_0x2cc7('0xe')]){logger[_0x2cc7('0x16')](_0x2cc7('0x17'),_0x22a3aa[_0x2cc7('0x10')]());for(var _0x46a981=0x0;_0x46a981<_0x22a3aa[_0x2cc7('0xe')];_0x46a981++){io[_0x2cc7('0x18')](_0x2cc7('0x19'),{'id':_0x22a3aa[_0x46a981],'closed':!![]});}}})[_0x2cc7('0x1a')](function(_0x50577e){logger[_0x2cc7('0x1b')]('[CHAT]\x20Error\x20closing\x20interactions',_0x50577e?util[_0x2cc7('0x1c')](_0x50577e,{'showHidden':![],'depth':null}):'');});}exports[_0x2cc7('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 42c12ab..2a79aa7 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 _0x4bf6=['startAllRefreshIntervals','exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x4ff2a7,_0x46fbd1){var _0x562f6e=function(_0x3ad5de){while(--_0x3ad5de){_0x4ff2a7['push'](_0x4ff2a7['shift']());}};_0x562f6e(++_0x46fbd1);}(_0x4bf6,0x1a0));var _0x64bf=function(_0x43907e,_0x15567c){_0x43907e=_0x43907e-0x0;var _0x476a21=_0x4bf6[_0x43907e];return _0x476a21;};'use strict';function start(){var _0x48082c=require(_0x64bf('0x0'));return _0x48082c[_0x64bf('0x1')]();}module[_0x64bf('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0xfd6b=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals','exports'];(function(_0x17e174,_0x4991f8){var _0x3f26f1=function(_0x169012){while(--_0x169012){_0x17e174['push'](_0x17e174['shift']());}};_0x3f26f1(++_0x4991f8);}(_0xfd6b,0x75));var _0xbfd6=function(_0x3fd337,_0x5025f1){_0x3fd337=_0x3fd337-0x0;var _0x336eef=_0xfd6b[_0x3fd337];return _0x336eef;};'use strict';function start(){var _0x46930b=require(_0xbfd6('0x0'));return _0x46930b[_0xbfd6('0x1')]();}module[_0xbfd6('0x2')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 0cf7767..c1655ad 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 _0xd1cd=['isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','exec\x20defaul\x20report\x20id:%s','then','CustomReportId','exec\x20custom\x20report\x20id:%s','findAll','MailServerOut','CloudProvider','keys','jobs','map','toString','keyBy','difference','intersection','length','exists','deleteJob','toRun','index','resolve','run\x20job','cron','active','isBetween','startAt','add','start','add\x20cron','stop','endAt','update','update\x20cron','stop\x20cron','run','util','path','lodash','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','format','MailAccount','name','Smtp','user','bcc','subtractNumber','subtractUnit','join','../../files/reports','%s.%s','basename','savename','extname','zip','existsSync','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','empty\x20file,\x20email\x20not\x20sent','request','SendMail','error','error\x20mail','email\x20sent','catch'];(function(_0x55cc58,_0x5ce0af){var _0x26062e=function(_0x59e29d){while(--_0x59e29d){_0x55cc58['push'](_0x55cc58['shift']());}};_0x26062e(++_0x5ce0af);}(_0xd1cd,0x127));var _0xdd1c=function(_0xf5c773,_0x2d5fcc){_0xf5c773=_0xf5c773-0x0;var _0x20ff9b=_0xd1cd[_0xf5c773];return _0x20ff9b;};'use strict';var fs=require('fs');var util=require(_0xdd1c('0x0'));var path=require(_0xdd1c('0x1'));var _=require(_0xdd1c('0x2'));var moment=require('moment');var CronJobManager=require('cron-job-manager');var jayson=require(_0xdd1c('0x3'));var BPromise=require(_0xdd1c('0x4'));var logger=require(_0xdd1c('0x5'))(_0xdd1c('0x6'));var db=require(_0xdd1c('0x7'))['db'];var analyticCustomReportController=require(_0xdd1c('0x8'));var analyticDefaultReportController=require(_0xdd1c('0x9'));var client=jayson[_0xdd1c('0xa')][_0xdd1c('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x5ae3c4,_0xa56674){return function(){logger[_0xdd1c('0xc')](_0xdd1c('0xd'),_0x5ae3c4[_0xdd1c('0xe')]);var _0x38e2bc=!![];var _0x1c86e6=_0x5ae3c4['MailAccount']['getSmtpOptions']();var _0x5d77c6={'account':_0x1c86e6,'message':{'from':util[_0xdd1c('0xf')]('\x22%s\x22\x20<%s>',_0x5ae3c4[_0xdd1c('0x10')][_0xdd1c('0x11')],_0x5ae3c4[_0xdd1c('0x10')][_0xdd1c('0xe')]||_0x5ae3c4['MailAccount'][_0xdd1c('0x12')][_0xdd1c('0x13')]),'to':_0x5ae3c4['email'],'cc':_0x5ae3c4['cc'],'bcc':_0x5ae3c4[_0xdd1c('0x14')],'subject':util[_0xdd1c('0xf')]('Report\x20%s\x20last\x20%s\x20%s',_0xa56674['name'],_0x5ae3c4[_0xdd1c('0x15')],_0x5ae3c4[_0xdd1c('0x16')])}};var _0x48debc=path[_0xdd1c('0x17')](__dirname,_0xdd1c('0x18'));var _0x20bb89=_0xa56674['savename'];var _0x29dcc9=util[_0xdd1c('0xf')](_0xdd1c('0x19'),path[_0xdd1c('0x1a')](_0xa56674[_0xdd1c('0x1b')],path[_0xdd1c('0x1c')](_0xa56674['savename'])),_0xdd1c('0x1d'));var _0x313637=path['join'](_0x48debc,_0x20bb89);var _0x338175=path[_0xdd1c('0x17')](_0x48debc,_0x29dcc9);if(fs[_0xdd1c('0x1e')](_0x313637)){_0xa56674[_0xdd1c('0x1f')]=_0xdd1c('0x20');_0x5d77c6[_0xdd1c('0x21')][_0xdd1c('0x22')]=[{'filename':_0x20bb89,'path':_0x313637}];_0x5d77c6[_0xdd1c('0x21')][_0xdd1c('0x23')]=util[_0xdd1c('0xf')](_0xdd1c('0x24'),JSON[_0xdd1c('0x25')](_0xa56674,null,0x2));}else if(fs[_0xdd1c('0x1e')](_0x338175)){_0xa56674[_0xdd1c('0x1f')]=_0xdd1c('0x20');_0x5d77c6['message'][_0xdd1c('0x22')]=[{'filename':_0x29dcc9,'path':_0x338175}];}else{_0x5d77c6['message'][_0xdd1c('0x23')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x5ae3c4['sendIfEmpty']){_0x38e2bc=![];logger[_0xdd1c('0xc')](_0xdd1c('0x26'));}}if(_0x38e2bc){return client[_0xdd1c('0x27')](_0xdd1c('0x28'),_0x5d77c6)['then'](function(_0x31953f){if(_0x31953f[_0xdd1c('0x29')]){return logger['error'](_0xdd1c('0x2a'),JSON[_0xdd1c('0x25')](_0x31953f));}return logger[_0xdd1c('0xc')](_0xdd1c('0x2b'));})[_0xdd1c('0x2c')](function(_0x765e62){return logger[_0xdd1c('0x29')](_0xdd1c('0x2a'),JSON[_0xdd1c('0x25')](_0x765e62));});}};}function handleError(){return function(_0x4be5f3){return logger[_0xdd1c('0x29')](JSON[_0xdd1c('0x25')](_0x4be5f3));};}function handleResult(_0xec1a81){return function(_0xb5d7dd){logger[_0xdd1c('0xc')]('data',JSON[_0xdd1c('0x25')](_0xb5d7dd));if(_0xec1a81[_0xdd1c('0x10')]&&_0xec1a81[_0xdd1c('0x10')][_0xdd1c('0x12')]&&!_['isNil'](_0xec1a81['email'])){setTimeout(handleSendEmail(_0xec1a81,_0xb5d7dd),0x3c*0x3e8);}};}function handleJob(_0x57e6fa){return function(){try{if(_[_0xdd1c('0x2d')](_0x57e6fa['subtractNumber'])){return logger[_0xdd1c('0xc')](_0xdd1c('0x2e'));}if(_[_0xdd1c('0x2d')](_0x57e6fa[_0xdd1c('0x16')])){return logger[_0xdd1c('0xc')](_0xdd1c('0x2f'));}var _0x23e482={'startDate':moment()['subtract'](_0x57e6fa['subtractNumber'],_0x57e6fa['subtractUnit'])['format'](_0xdd1c('0x30')),'endDate':moment()['format'](_0xdd1c('0x30')),'type':_0xdd1c('0x31'),'output':_0x57e6fa['output'],'name':_0x57e6fa[_0xdd1c('0x11')]};if(!_[_0xdd1c('0x2d')](_0x57e6fa[_0xdd1c('0x32')])){logger[_0xdd1c('0xc')](_0xdd1c('0x33'),_0x57e6fa[_0xdd1c('0x32')]);return analyticDefaultReportController['runReport']({'id':_0x57e6fa['DefaultReportId']},_0x23e482)[_0xdd1c('0x34')](handleResult(_0x57e6fa))[_0xdd1c('0x2c')](handleError());}if(!_[_0xdd1c('0x2d')](_0x57e6fa[_0xdd1c('0x35')])){logger[_0xdd1c('0xc')](_0xdd1c('0x36'),_0x57e6fa[_0xdd1c('0x35')]);return analyticCustomReportController['runReport']({'id':_0x57e6fa[_0xdd1c('0x35')]},_0x23e482)[_0xdd1c('0x34')](handleResult(_0x57e6fa))[_0xdd1c('0x2c')](handleError());}}catch(_0x524024){logger[_0xdd1c('0x29')](JSON['stringify'](_0x524024));}return logger['info']('no\x20report\x20id');};}function getJobs(_0x12f3bb){var _0x222236={};if(_0x12f3bb){_0x222236['id']=_0x12f3bb;}return db['Schedule'][_0xdd1c('0x37')]({'where':_0x222236,'include':[{'model':db[_0xdd1c('0x10')],'attributes':['id',_0xdd1c('0x11'),_0xdd1c('0xe')],'include':[{'model':db[_0xdd1c('0x38')],'as':_0xdd1c('0x12'),'include':[{'model':db[_0xdd1c('0x39')],'as':_0xdd1c('0x39')}]}]}]})[_0xdd1c('0x34')](function(_0x1ad27c){var _0x4dcfc6=_[_0xdd1c('0x3a')](manager[_0xdd1c('0x3b')]);var _0x9780ca=_[_0xdd1c('0x3c')](_0x1ad27c,function(_0x234ed0){return _0x234ed0['id'][_0xdd1c('0x3d')]();});var _0x1793e2=_[_0xdd1c('0x3e')](_0x1ad27c,function(_0x404774){return _0x404774['id'][_0xdd1c('0x3d')]();});var _0x46990d=_0x12f3bb?_0x9780ca:_[_0xdd1c('0x3f')](_0x9780ca,_0x4dcfc6);var _0x220b10=_[_0xdd1c('0x40')](_0x9780ca,_0x4dcfc6);var _0x1fc05f=_['difference'](_0x4dcfc6,_0x9780ca);var _0x3a84ad;var _0x478cfc;for(_0x3a84ad=0x0;_0x3a84ad<_0x1fc05f[_0xdd1c('0x41')]&&!_0x12f3bb;_0x3a84ad+=0x1){_0x478cfc=_0x1fc05f[_0x3a84ad]['toString']();if(manager[_0xdd1c('0x42')](_0x478cfc)){manager['stop'](_0x478cfc);manager[_0xdd1c('0x43')](_0x478cfc);logger['info']('delete\x20cron',_0x478cfc);}}logger[_0xdd1c('0xc')](_0xdd1c('0x44'),JSON[_0xdd1c('0x25')](_0x46990d));for(_0x3a84ad=0x0;_0x3a84ad<_0x46990d['length'];_0x3a84ad+=0x1){_0x478cfc=_0x46990d[_0x3a84ad]['toString']();logger[_0xdd1c('0xc')](_0xdd1c('0x45'),_0x478cfc);if(_0x12f3bb){logger[_0xdd1c('0xc')]('my\x20id',_0x12f3bb);logger[_0xdd1c('0xc')](JSON['stringify'](_0x1793e2[_0x478cfc]));BPromise[_0xdd1c('0x46')]()[_0xdd1c('0x34')](handleJob(_0x1793e2[_0x478cfc]));logger[_0xdd1c('0xc')](_0xdd1c('0x47'),_0x1793e2[_0x478cfc][_0xdd1c('0x11')],_0x1793e2[_0x478cfc][_0xdd1c('0x48')]);}else if(_0x1793e2[_0x478cfc][_0xdd1c('0x48')]&&_0x1793e2[_0x478cfc][_0xdd1c('0x49')]&&moment()[_0xdd1c('0x4a')](_0x1793e2[_0x478cfc][_0xdd1c('0x4b')],_0x1793e2[_0x478cfc]['endAt'])){manager[_0xdd1c('0x4c')](_0x478cfc,_0x1793e2[_0x478cfc][_0xdd1c('0x48')],handleJob(_0x1793e2[_0x478cfc]));manager[_0xdd1c('0x4d')](_0x478cfc);logger[_0xdd1c('0xc')](_0xdd1c('0x4e'),_0x1793e2[_0x478cfc][_0xdd1c('0x11')],_0x1793e2[_0x478cfc][_0xdd1c('0x48')]);}else if(manager['exists'](_0x478cfc)){manager[_0xdd1c('0x4f')](_0x478cfc);manager[_0xdd1c('0x43')](_0x478cfc);logger[_0xdd1c('0xc')]('stop\x20cron',_0x1793e2[_0x478cfc][_0xdd1c('0x11')],_0x1793e2[_0x478cfc][_0xdd1c('0x48')]);}}for(_0x3a84ad=0x0,_0x478cfc;_0x3a84ad<_0x220b10['length']&&!_0x12f3bb;_0x3a84ad+=0x1){_0x478cfc=_0x220b10[_0x3a84ad][_0xdd1c('0x3d')]();if(manager[_0xdd1c('0x42')](_0x478cfc)){if(_0x1793e2[_0x478cfc][_0xdd1c('0x48')]&&_0x1793e2[_0x478cfc][_0xdd1c('0x49')]&&moment()[_0xdd1c('0x4a')](_0x1793e2[_0x478cfc][_0xdd1c('0x4b')],_0x1793e2[_0x478cfc][_0xdd1c('0x50')])){manager[_0xdd1c('0x51')](_0x478cfc,_0x1793e2[_0x478cfc]['cron'],handleJob(_0x1793e2[_0x478cfc]));logger['info'](_0xdd1c('0x52'),_0x1793e2[_0x478cfc]['name'],_0x1793e2[_0x478cfc][_0xdd1c('0x48')]);}else{manager[_0xdd1c('0x4f')](_0x478cfc);manager[_0xdd1c('0x43')](_0x478cfc);logger[_0xdd1c('0xc')](_0xdd1c('0x53'),_0x1793e2[_0x478cfc][_0xdd1c('0x11')],_0x1793e2[_0x478cfc][_0xdd1c('0x48')]);}}}})[_0xdd1c('0x2c')](function(_0x834c03){logger[_0xdd1c('0x29')](JSON[_0xdd1c('0x25')](_0x834c03));});}exports[_0xdd1c('0x54')]=function(_0x19a8fe){return getJobs(_0x19a8fe);};exports[_0xdd1c('0x4d')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x85c2=['cron-job-manager','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','Smtp','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','../../files/reports','savename','zip','join','existsSync','status','Sent','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','message','attachments','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','request','SendMail','then','error','stringify','info','catch','error\x20mail','isNil','subtractNumber\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20custom\x20report\x20id:%s','CustomReportId','runReport','Schedule','findAll','MailServerOut','CloudProvider','jobs','map','keyBy','toString','difference','stop','deleteJob','toRun','length','index','my\x20id','resolve','run\x20job','cron','startAt','endAt','add','add\x20cron','exists','stop\x20cron','active','isBetween','update','update\x20cron','run','start','util','lodash'];(function(_0x1ad926,_0x3e1fed){var _0x1b81dc=function(_0x506f83){while(--_0x506f83){_0x1ad926['push'](_0x1ad926['shift']());}};_0x1b81dc(++_0x3e1fed);}(_0x85c2,0x1f0));var _0x285c=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x85c2[_0x4b055c];return _0x4b62bb;};'use strict';var fs=require('fs');var util=require(_0x285c('0x0'));var path=require('path');var _=require(_0x285c('0x1'));var moment=require('moment');var CronJobManager=require(_0x285c('0x2'));var jayson=require('jayson/promise');var BPromise=require(_0x285c('0x3'));var logger=require(_0x285c('0x4'))(_0x285c('0x5'));var db=require(_0x285c('0x6'))['db'];var analyticCustomReportController=require(_0x285c('0x7'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x285c('0x8')][_0x285c('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x23df52,_0xb63926){return function(){logger['info'](_0x285c('0xa'),_0x23df52[_0x285c('0xb')]);var _0xe8f852=!![];var _0x3569ea=_0x23df52[_0x285c('0xc')][_0x285c('0xd')]();var _0x5c89cd={'account':_0x3569ea,'message':{'from':util[_0x285c('0xe')](_0x285c('0xf'),_0x23df52[_0x285c('0xc')][_0x285c('0x10')],_0x23df52[_0x285c('0xc')][_0x285c('0xb')]||_0x23df52[_0x285c('0xc')][_0x285c('0x11')]['user']),'to':_0x23df52[_0x285c('0xb')],'cc':_0x23df52['cc'],'bcc':_0x23df52[_0x285c('0x12')],'subject':util['format'](_0x285c('0x13'),_0xb63926[_0x285c('0x10')],_0x23df52[_0x285c('0x14')],_0x23df52[_0x285c('0x15')])}};var _0x321af4=path['join'](__dirname,_0x285c('0x16'));var _0x2bbda8=_0xb63926[_0x285c('0x17')];var _0x488379=util[_0x285c('0xe')]('%s.%s',path['basename'](_0xb63926['savename'],path['extname'](_0xb63926[_0x285c('0x17')])),_0x285c('0x18'));var _0x2177ff=path[_0x285c('0x19')](_0x321af4,_0x2bbda8);var _0x52c8eb=path[_0x285c('0x19')](_0x321af4,_0x488379);if(fs[_0x285c('0x1a')](_0x2177ff)){_0xb63926[_0x285c('0x1b')]=_0x285c('0x1c');_0x5c89cd['message']['attachments']=[{'filename':_0x2bbda8,'path':_0x2177ff}];_0x5c89cd['message'][_0x285c('0x1d')]=util[_0x285c('0xe')](_0x285c('0x1e'),JSON['stringify'](_0xb63926,null,0x2));}else if(fs[_0x285c('0x1a')](_0x52c8eb)){_0xb63926['status']=_0x285c('0x1c');_0x5c89cd[_0x285c('0x1f')][_0x285c('0x20')]=[{'filename':_0x488379,'path':_0x52c8eb}];}else{_0x5c89cd[_0x285c('0x1f')]['text']=_0x285c('0x21');if(!_0x23df52[_0x285c('0x22')]){_0xe8f852=![];logger['info']('empty\x20file,\x20email\x20not\x20sent');}}if(_0xe8f852){return client[_0x285c('0x23')](_0x285c('0x24'),_0x5c89cd)[_0x285c('0x25')](function(_0x485c33){if(_0x485c33[_0x285c('0x26')]){return logger[_0x285c('0x26')]('error\x20mail',JSON[_0x285c('0x27')](_0x485c33));}return logger[_0x285c('0x28')]('email\x20sent');})[_0x285c('0x29')](function(_0x3bd9d2){return logger['error'](_0x285c('0x2a'),JSON['stringify'](_0x3bd9d2));});}};}function handleError(){return function(_0x4f4a1c){return logger[_0x285c('0x26')](JSON[_0x285c('0x27')](_0x4f4a1c));};}function handleResult(_0x3f06c4){return function(_0x51d9af){logger[_0x285c('0x28')]('data',JSON[_0x285c('0x27')](_0x51d9af));if(_0x3f06c4[_0x285c('0xc')]&&_0x3f06c4['MailAccount']['Smtp']&&!_[_0x285c('0x2b')](_0x3f06c4['email'])){setTimeout(handleSendEmail(_0x3f06c4,_0x51d9af),0x3c*0x3e8);}};}function handleJob(_0x348cee){return function(){try{if(_[_0x285c('0x2b')](_0x348cee[_0x285c('0x14')])){return logger[_0x285c('0x28')](_0x285c('0x2c'));}if(_[_0x285c('0x2b')](_0x348cee[_0x285c('0x15')])){return logger['info']('subtractUnit\x20null\x20or\x20undefined');}var _0x3d7ade={'startDate':moment()[_0x285c('0x2d')](_0x348cee[_0x285c('0x14')],_0x348cee['subtractUnit'])['format']('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x285c('0xe')](_0x285c('0x2e')),'type':_0x285c('0x2f'),'output':_0x348cee[_0x285c('0x30')],'name':_0x348cee[_0x285c('0x10')]};if(!_[_0x285c('0x2b')](_0x348cee['DefaultReportId'])){logger['info']('exec\x20defaul\x20report\x20id:%s',_0x348cee[_0x285c('0x31')]);return analyticDefaultReportController['runReport']({'id':_0x348cee[_0x285c('0x31')]},_0x3d7ade)['then'](handleResult(_0x348cee))[_0x285c('0x29')](handleError());}if(!_[_0x285c('0x2b')](_0x348cee['CustomReportId'])){logger[_0x285c('0x28')](_0x285c('0x32'),_0x348cee[_0x285c('0x33')]);return analyticCustomReportController[_0x285c('0x34')]({'id':_0x348cee[_0x285c('0x33')]},_0x3d7ade)[_0x285c('0x25')](handleResult(_0x348cee))['catch'](handleError());}}catch(_0xe6ab49){logger[_0x285c('0x26')](JSON[_0x285c('0x27')](_0xe6ab49));}return logger[_0x285c('0x28')]('no\x20report\x20id');};}function getJobs(_0x58267c){var _0x31ccec={};if(_0x58267c){_0x31ccec['id']=_0x58267c;}return db[_0x285c('0x35')][_0x285c('0x36')]({'where':_0x31ccec,'include':[{'model':db['MailAccount'],'attributes':['id',_0x285c('0x10'),_0x285c('0xb')],'include':[{'model':db[_0x285c('0x37')],'as':_0x285c('0x11'),'include':[{'model':db[_0x285c('0x38')],'as':_0x285c('0x38')}]}]}]})[_0x285c('0x25')](function(_0x1e00eb){var _0x44eafc=_['keys'](manager[_0x285c('0x39')]);var _0x284b34=_[_0x285c('0x3a')](_0x1e00eb,function(_0x4d0204){return _0x4d0204['id']['toString']();});var _0x370afb=_[_0x285c('0x3b')](_0x1e00eb,function(_0x9938aa){return _0x9938aa['id'][_0x285c('0x3c')]();});var _0x162020=_0x58267c?_0x284b34:_[_0x285c('0x3d')](_0x284b34,_0x44eafc);var _0x213e5c=_['intersection'](_0x284b34,_0x44eafc);var _0x3fecc1=_['difference'](_0x44eafc,_0x284b34);var _0x478a82;var _0x590316;for(_0x478a82=0x0;_0x478a82<_0x3fecc1['length']&&!_0x58267c;_0x478a82+=0x1){_0x590316=_0x3fecc1[_0x478a82][_0x285c('0x3c')]();if(manager['exists'](_0x590316)){manager[_0x285c('0x3e')](_0x590316);manager[_0x285c('0x3f')](_0x590316);logger[_0x285c('0x28')]('delete\x20cron',_0x590316);}}logger[_0x285c('0x28')](_0x285c('0x40'),JSON[_0x285c('0x27')](_0x162020));for(_0x478a82=0x0;_0x478a82<_0x162020[_0x285c('0x41')];_0x478a82+=0x1){_0x590316=_0x162020[_0x478a82][_0x285c('0x3c')]();logger[_0x285c('0x28')](_0x285c('0x42'),_0x590316);if(_0x58267c){logger['info'](_0x285c('0x43'),_0x58267c);logger[_0x285c('0x28')](JSON['stringify'](_0x370afb[_0x590316]));BPromise[_0x285c('0x44')]()[_0x285c('0x25')](handleJob(_0x370afb[_0x590316]));logger[_0x285c('0x28')](_0x285c('0x45'),_0x370afb[_0x590316][_0x285c('0x10')],_0x370afb[_0x590316][_0x285c('0x46')]);}else if(_0x370afb[_0x590316][_0x285c('0x46')]&&_0x370afb[_0x590316]['active']&&moment()['isBetween'](_0x370afb[_0x590316][_0x285c('0x47')],_0x370afb[_0x590316][_0x285c('0x48')])){manager[_0x285c('0x49')](_0x590316,_0x370afb[_0x590316][_0x285c('0x46')],handleJob(_0x370afb[_0x590316]));manager['start'](_0x590316);logger[_0x285c('0x28')](_0x285c('0x4a'),_0x370afb[_0x590316][_0x285c('0x10')],_0x370afb[_0x590316][_0x285c('0x46')]);}else if(manager[_0x285c('0x4b')](_0x590316)){manager[_0x285c('0x3e')](_0x590316);manager[_0x285c('0x3f')](_0x590316);logger['info'](_0x285c('0x4c'),_0x370afb[_0x590316][_0x285c('0x10')],_0x370afb[_0x590316]['cron']);}}for(_0x478a82=0x0,_0x590316;_0x478a82<_0x213e5c['length']&&!_0x58267c;_0x478a82+=0x1){_0x590316=_0x213e5c[_0x478a82][_0x285c('0x3c')]();if(manager[_0x285c('0x4b')](_0x590316)){if(_0x370afb[_0x590316][_0x285c('0x46')]&&_0x370afb[_0x590316][_0x285c('0x4d')]&&moment()[_0x285c('0x4e')](_0x370afb[_0x590316][_0x285c('0x47')],_0x370afb[_0x590316]['endAt'])){manager[_0x285c('0x4f')](_0x590316,_0x370afb[_0x590316][_0x285c('0x46')],handleJob(_0x370afb[_0x590316]));logger[_0x285c('0x28')](_0x285c('0x50'),_0x370afb[_0x590316][_0x285c('0x10')],_0x370afb[_0x590316][_0x285c('0x46')]);}else{manager[_0x285c('0x3e')](_0x590316);manager[_0x285c('0x3f')](_0x590316);logger[_0x285c('0x28')]('stop\x20cron',_0x370afb[_0x590316][_0x285c('0x10')],_0x370afb[_0x590316][_0x285c('0x46')]);}}}})[_0x285c('0x29')](function(_0x98f080){logger['error'](JSON[_0x285c('0x27')](_0x98f080));});}exports[_0x285c('0x51')]=function(_0x5039e3){return getJobs(_0x5039e3);};exports[_0x285c('0x52')]=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 3a69a41..d5cfbb8 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 _0xd136=['inspect','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','findOne','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','all','error','start','aws-sdk','request-promise','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','substring','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','info','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','results','transcripts','length','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','language','bucket','Sequelize','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','catch','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis'];(function(_0x5e5671,_0x457d56){var _0x3035f8=function(_0x3397e4){while(--_0x3397e4){_0x5e5671['push'](_0x5e5671['shift']());}};_0x3035f8(++_0x457d56);}(_0xd136,0x94));var _0x6d13=function(_0x59b649,_0x267783){_0x59b649=_0x59b649-0x0;var _0x488069=_0xd136[_0x59b649];return _0x488069;};var _=require('lodash');var AWS=require(_0x6d13('0x0'));var rp=require(_0x6d13('0x1'));var util=require('util');var BPromise=require(_0x6d13('0x2'));var db=require(_0x6d13('0x3'))['db'];var logger=require(_0x6d13('0x4'))(_0x6d13('0x5'));function getTranscriptionJob(_0xec09ab,_0x387947,_0x276099,_0x18fa4f){return new Promise(function(_0x147026,_0x4aabef){var _0x335482=new AWS[(_0x6d13('0x6'))]({'accessKeyId':_0x387947,'secretAccessKey':_0xec09ab,'region':_0x276099});_0x335482['getTranscriptionJob']({'TranscriptionJobName':_0x18fa4f},function(_0x598021,_0x1af16f){if(_0x598021){return _0x4aabef(_0x598021);}else{return _0x147026(_0x1af16f);}});});}function sentiment(_0x1f7d07,_0x240dba,_0x2216d7,_0x5c8282,_0x4f494b){return new Promise(function(_0x1a3613,_0x600fa9){var _0x1cf1e1=new AWS['Comprehend']({'accessKeyId':_0x240dba,'secretAccessKey':_0x1f7d07,'region':_0x2216d7});_0x1cf1e1['detectSentiment']({'Text':_0x5c8282,'LanguageCode':_0x4f494b[_0x6d13('0x7')](0x0,0x2)},function(_0x2a2120,_0x28fe97){if(_0x2a2120){return _0x600fa9(_0x2a2120);}else{return _0x1a3613(_0x28fe97);}});});}function checkTranscribeJob(_0x47d637,_0x1b4cc3,_0x5ef7e6){var _0x37d3c1;return new BPromise(function(_0x2b53e8,_0x5a07f8){logger['info'](util['format'](_0x6d13('0x8'),_0x47d637['id'],_0x47d637[_0x6d13('0x9')]));return getTranscriptionJob(_0x5ef7e6[_0x6d13('0xa')],_0x5ef7e6[_0x6d13('0xb')],_0x1b4cc3[_0x6d13('0xc')],_0x47d637['transcribeName'])[_0x6d13('0xd')](function(_0x405368){logger[_0x6d13('0xe')](util[_0x6d13('0xf')](_0x6d13('0x10'),_0x47d637['id'],_0x47d637[_0x6d13('0x9')],_0x405368[_0x6d13('0x11')][_0x6d13('0x12')]));if(!_0x47d637[_0x6d13('0x13')]){switch(_0x405368['TranscriptionJob'][_0x6d13('0x12')]){case _0x6d13('0x14'):var _0x78eef7={'transcribeStatus':_0x405368[_0x6d13('0x11')][_0x6d13('0x12')],'fileUri':_0x405368[_0x6d13('0x11')][_0x6d13('0x15')][_0x6d13('0x16')]};logger[_0x6d13('0xe')](util[_0x6d13('0xf')](_0x6d13('0x17'),_0x47d637['id']));return rp({'uri':_0x405368[_0x6d13('0x11')][_0x6d13('0x15')][_0x6d13('0x16')],'json':!![]})[_0x6d13('0xd')](function(_0x208876){logger['info'](util[_0x6d13('0xf')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x47d637['id']));if(_0x208876&&_0x208876[_0x6d13('0x18')]&&_0x208876[_0x6d13('0x18')][_0x6d13('0x19')]&&_0x208876['results'][_0x6d13('0x19')][_0x6d13('0x1a')]){_0x78eef7[_0x6d13('0x13')]='';for(var _0x4366a0=0x0;_0x4366a0<_0x208876[_0x6d13('0x18')][_0x6d13('0x19')][_0x6d13('0x1a')];_0x4366a0++){_0x78eef7[_0x6d13('0x13')]+=_0x208876['results'][_0x6d13('0x19')][_0x4366a0]['transcript']+'';}}return _0x47d637['update'](_0x78eef7);})[_0x6d13('0xd')](function(){logger['info'](util[_0x6d13('0xf')](_0x6d13('0x1b'),_0x47d637['id']));if(!_0x47d637[_0x6d13('0x1c')]){throw new db['Sequelize'][(_0x6d13('0x1d'))](_0x6d13('0x1e'));}if(!_0x1b4cc3['sentiment']||!_0x1b4cc3[_0x6d13('0x1f')]||!_0x1b4cc3[_0x6d13('0x20')]||!_0x1b4cc3[_0x6d13('0x21')]||!_0x1b4cc3[_0x6d13('0x22')]){throw new db[(_0x6d13('0x23'))][(_0x6d13('0x1d'))](_0x6d13('0x24'));}if(!_0x78eef7[_0x6d13('0x13')]){throw new Error('Transcript\x20not\x20available');}if(_0x1b4cc3[_0x6d13('0x1f')]===_0x5ef7e6['id']){return _0x5ef7e6;}else{return db[_0x6d13('0x25')]['findOne']({'where':{'id':_settings[_0x6d13('0x1f')]}});}})[_0x6d13('0xd')](function(_0x19eb67){if(!_0x19eb67){throw new db['Sequelize'][(_0x6d13('0x1d'))](_0x6d13('0x26'));}if(!_0x19eb67[_0x6d13('0xa')]||!_0x19eb67[_0x6d13('0xb')]){throw new db[(_0x6d13('0x23'))][(_0x6d13('0x1d'))](_0x6d13('0x27'));}_0x37d3c1=_0x19eb67;logger['info'](util[_0x6d13('0xf')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x47d637['id']));return sentiment(_0x37d3c1[_0x6d13('0xa')],_0x37d3c1[_0x6d13('0xb')],_0x1b4cc3[_0x6d13('0x20')],_0x78eef7[_0x6d13('0x13')],_0x1b4cc3[_0x6d13('0x21')]);})[_0x6d13('0xd')](function(_0x4d7223){logger['info'](util[_0x6d13('0xf')](_0x6d13('0x28'),_0x47d637['id']));return _0x47d637[_0x6d13('0x29')]({'sentiment':_0x4d7223[_0x6d13('0x2a')],'sPositive':_0x4d7223[_0x6d13('0x2b')][_0x6d13('0x2c')],'sNegative':_0x4d7223['SentimentScore'][_0x6d13('0x2d')],'sMixed':_0x4d7223[_0x6d13('0x2b')][_0x6d13('0x2e')],'sNeutral':_0x4d7223[_0x6d13('0x2b')][_0x6d13('0x2f')]});})[_0x6d13('0xd')](function(){logger[_0x6d13('0xe')](util[_0x6d13('0xf')](_0x6d13('0x1b'),_0x47d637['id']));_0x2b53e8();});case _0x6d13('0x30'):return _0x47d637['update']({'transcribeStatus':'FAILED','failureReason':_0x405368[_0x6d13('0x11')]['FailureReason']})['then'](function(){logger[_0x6d13('0xe')](util[_0x6d13('0xf')](_0x6d13('0x1b'),_0x47d637['id']));_0x2b53e8();});default:logger['info'](util[_0x6d13('0xf')](_0x6d13('0x31'),_0x47d637['id']));break;}}else{return BPromise[_0x6d13('0x32')]()['then'](function(){if(!_0x47d637[_0x6d13('0x1c')]){throw new db['Sequelize'][(_0x6d13('0x1d'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x1b4cc3['sentiment']||!_0x1b4cc3[_0x6d13('0x1f')]||!_0x1b4cc3[_0x6d13('0x20')]||!_0x1b4cc3['language']||!_0x1b4cc3['bucket']){throw new db[(_0x6d13('0x23'))][(_0x6d13('0x1d'))](_0x6d13('0x24'));}if(!_0x47d637[_0x6d13('0x13')]){throw new Error('Transcript\x20not\x20available');}if(_0x1b4cc3[_0x6d13('0x1f')]===_0x5ef7e6['id']){return _0x5ef7e6;}else{return db[_0x6d13('0x25')]['findOne']({'where':{'id':_settings[_0x6d13('0x1f')]}});}})[_0x6d13('0xd')](function(_0x42a347){if(!_0x42a347){throw new db[(_0x6d13('0x23'))][(_0x6d13('0x1d'))](_0x6d13('0x26'));}if(!_0x42a347[_0x6d13('0xa')]||!_0x42a347['data2']){throw new db[(_0x6d13('0x23'))][(_0x6d13('0x1d'))](_0x6d13('0x27'));}_0x37d3c1=_0x42a347;logger[_0x6d13('0xe')](util[_0x6d13('0xf')](_0x6d13('0x33'),_0x47d637['id']));return sentiment(_0x37d3c1[_0x6d13('0xa')],_0x37d3c1['data2'],_0x1b4cc3[_0x6d13('0x20')],_0x47d637['fileText'],_0x1b4cc3[_0x6d13('0x21')]);})[_0x6d13('0xd')](function(_0x223b03){logger[_0x6d13('0xe')](util[_0x6d13('0xf')](_0x6d13('0x28'),_0x47d637['id']));return _0x47d637[_0x6d13('0x29')]({'sentiment':_0x223b03[_0x6d13('0x2a')],'sPositive':_0x223b03['SentimentScore'][_0x6d13('0x2c')],'sNegative':_0x223b03['SentimentScore'][_0x6d13('0x2d')],'sMixed':_0x223b03[_0x6d13('0x2b')][_0x6d13('0x2e')],'sNeutral':_0x223b03[_0x6d13('0x2b')][_0x6d13('0x2f')],'transcribeStatus':_0x6d13('0x14')});})[_0x6d13('0xd')](function(){logger[_0x6d13('0xe')](util[_0x6d13('0xf')](_0x6d13('0x1b'),_0x47d637['id']));_0x2b53e8();});}})[_0x6d13('0x34')](function(_0x479b50){if(_0x479b50){if(!_0x479b50[_0x6d13('0x35')]||_0x479b50[_0x6d13('0x35')]!==_0x6d13('0x36')){logger['error'](util['format'](_0x6d13('0x37'),_0x47d637['id']),util[_0x6d13('0x38')](_0x479b50,{'showHidden':![],'depth':null}));}}_0x2b53e8();});});}function checkTranscribe(){var _0x2492b5;var _0x5b00c6;var _0x3ac978;return db[_0x6d13('0x39')][_0x6d13('0x3a')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x6d13('0xd')](function(_0x122adb){if(!_0x122adb||!_0x122adb['length']){throw new db['Sequelize'][(_0x6d13('0x1d'))](_0x6d13('0x3b'));}_0x2492b5=_0x122adb;return db[_0x6d13('0x3c')][_0x6d13('0x3d')]({'where':{'id':0x1}});})[_0x6d13('0xd')](function(_0x3d3244){if(!_0x3d3244){throw new db['Sequelize']['ValidationError'](_0x6d13('0x3e'));}_0x5b00c6=_0x3d3244;if(!_0x5b00c6[_0x6d13('0x5')]||!_0x5b00c6[_0x6d13('0x3f')]||!_0x5b00c6[_0x6d13('0xc')]||!_0x5b00c6[_0x6d13('0x21')]||!_0x5b00c6['bucket']){throw new db[(_0x6d13('0x23'))]['ValidationError'](_0x6d13('0x40'));}return db[_0x6d13('0x25')][_0x6d13('0x3d')]({'where':{'id':_0x5b00c6['transcribeAccountId']}});})[_0x6d13('0xd')](function(_0x53854e){if(!_0x53854e){throw new db['Sequelize'][(_0x6d13('0x1d'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x53854e[_0x6d13('0xa')]||!_0x53854e['data2']){throw new db[(_0x6d13('0x23'))]['ValidationError'](_0x6d13('0x27'));}_0x3ac978=_0x53854e;var _0x42f131=[];_0x2492b5['forEach'](function(_0x95e9c6){_0x42f131['push'](checkTranscribeJob(_0x95e9c6,_0x5b00c6,_0x3ac978));});return BPromise[_0x6d13('0x41')](_0x42f131);})[_0x6d13('0x34')](function(_0x2daf24){if(_0x2daf24){if(!_0x2daf24[_0x6d13('0x35')]||_0x2daf24['name']!==_0x6d13('0x36')){logger[_0x6d13('0x42')](util[_0x6d13('0x38')](_0x2daf24,{'showHidden':![],'depth':null}));}}});}exports[_0x6d13('0x43')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x3c0d=['fileText','Transcript','TranscriptFileUri','then','results','transcripts','length','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','ValidationError','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','SentimentScore','Positive','Negative','Neutral','FAILED','FailureReason','resolve','tempSentiment','Sentiment\x20Analysis\x20not\x20requested','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','catch','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','No\x20transcribe\x20job\x20to\x20check','Setting','findOne','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','CloudProvider','push','all','error','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus'];(function(_0x3ede77,_0x318909){var _0x2c9e87=function(_0x46f00f){while(--_0x46f00f){_0x3ede77['push'](_0x3ede77['shift']());}};_0x2c9e87(++_0x318909);}(_0x3c0d,0xf6));var _0xd3c0=function(_0x279712,_0x173871){_0x279712=_0x279712-0x0;var _0x53a988=_0x3c0d[_0x279712];return _0x53a988;};var _=require('lodash');var AWS=require('aws-sdk');var rp=require('request-promise');var util=require(_0xd3c0('0x0'));var BPromise=require(_0xd3c0('0x1'));var db=require(_0xd3c0('0x2'))['db'];var logger=require(_0xd3c0('0x3'))(_0xd3c0('0x4'));function getTranscriptionJob(_0x39e82b,_0xe14278,_0x161aac,_0x347711){return new Promise(function(_0x4d5cf1,_0x36ce7f){var _0x47fa5f=new AWS[(_0xd3c0('0x5'))]({'accessKeyId':_0xe14278,'secretAccessKey':_0x39e82b,'region':_0x161aac});_0x47fa5f[_0xd3c0('0x6')]({'TranscriptionJobName':_0x347711},function(_0x2c37b8,_0x2d11d5){if(_0x2c37b8){return _0x36ce7f(_0x2c37b8);}else{return _0x4d5cf1(_0x2d11d5);}});});}function sentiment(_0x30775d,_0x1e63c1,_0x2be3c0,_0x3414ff,_0x1d8905){return new Promise(function(_0x281945,_0x51e63b){var _0x2a9f6f=new AWS[(_0xd3c0('0x7'))]({'accessKeyId':_0x1e63c1,'secretAccessKey':_0x30775d,'region':_0x2be3c0});_0x2a9f6f['detectSentiment']({'Text':_0x3414ff,'LanguageCode':_0x1d8905['substring'](0x0,0x2)},function(_0x160824,_0x3599fe){if(_0x160824){return _0x51e63b(_0x160824);}else{return _0x281945(_0x3599fe);}});});}function checkTranscribeJob(_0xbcc62a,_0x34cff9,_0x5cc5ca){var _0x1eb687;return new BPromise(function(_0x43d732,_0x4cb8c8){logger['info'](util[_0xd3c0('0x8')](_0xd3c0('0x9'),_0xbcc62a['id'],_0xbcc62a[_0xd3c0('0xa')]));return getTranscriptionJob(_0x5cc5ca[_0xd3c0('0xb')],_0x5cc5ca[_0xd3c0('0xc')],_0x34cff9[_0xd3c0('0xd')],_0xbcc62a['transcribeName'])['then'](function(_0x36f41c){logger[_0xd3c0('0xe')](util['format'](_0xd3c0('0xf'),_0xbcc62a['id'],_0xbcc62a[_0xd3c0('0xa')],_0x36f41c[_0xd3c0('0x10')][_0xd3c0('0x11')]));if(!_0xbcc62a[_0xd3c0('0x12')]){switch(_0x36f41c[_0xd3c0('0x10')][_0xd3c0('0x11')]){case'COMPLETED':var _0x5a36df={'transcribeStatus':_0x36f41c[_0xd3c0('0x10')]['TranscriptionJobStatus'],'fileUri':_0x36f41c[_0xd3c0('0x10')][_0xd3c0('0x13')][_0xd3c0('0x14')]};logger[_0xd3c0('0xe')](util['format']('[RECORDING:%d]\x20Get\x20transcript',_0xbcc62a['id']));return rp({'uri':_0x36f41c[_0xd3c0('0x10')][_0xd3c0('0x13')][_0xd3c0('0x14')],'json':!![]})[_0xd3c0('0x15')](function(_0x567439){logger[_0xd3c0('0xe')](util['format']('[RECORDING:%d]\x20Transcript\x20downloaded',_0xbcc62a['id']));if(_0x567439&&_0x567439[_0xd3c0('0x16')]&&_0x567439[_0xd3c0('0x16')]['transcripts']&&_0x567439[_0xd3c0('0x16')][_0xd3c0('0x17')]['length']){_0x5a36df[_0xd3c0('0x12')]='';for(var _0x58f4d8=0x0;_0x58f4d8<_0x567439['results'][_0xd3c0('0x17')][_0xd3c0('0x18')];_0x58f4d8++){_0x5a36df['fileText']+=_0x567439['results'][_0xd3c0('0x17')][_0x58f4d8][_0xd3c0('0x19')]+'';}}return _0xbcc62a['update'](_0x5a36df);})['then'](function(){logger[_0xd3c0('0xe')](util[_0xd3c0('0x8')](_0xd3c0('0x1a'),_0xbcc62a['id']));if(!_0xbcc62a['tempSentiment']){throw new db[(_0xd3c0('0x1b'))][(_0xd3c0('0x1c'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x34cff9[_0xd3c0('0x1d')]||!_0x34cff9[_0xd3c0('0x1e')]||!_0x34cff9[_0xd3c0('0x1f')]||!_0x34cff9[_0xd3c0('0x20')]||!_0x34cff9[_0xd3c0('0x21')]){throw new db['Sequelize'][(_0xd3c0('0x1c'))](_0xd3c0('0x22'));}if(!_0x5a36df['fileText']){throw new Error(_0xd3c0('0x23'));}if(_0x34cff9[_0xd3c0('0x1e')]===_0x5cc5ca['id']){return _0x5cc5ca;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings[_0xd3c0('0x1e')]}});}})[_0xd3c0('0x15')](function(_0x43a863){if(!_0x43a863){throw new db[(_0xd3c0('0x1b'))][(_0xd3c0('0x1c'))](_0xd3c0('0x24'));}if(!_0x43a863[_0xd3c0('0xb')]||!_0x43a863[_0xd3c0('0xc')]){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x1eb687=_0x43a863;logger[_0xd3c0('0xe')](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0xbcc62a['id']));return sentiment(_0x1eb687[_0xd3c0('0xb')],_0x1eb687[_0xd3c0('0xc')],_0x34cff9[_0xd3c0('0x1f')],_0x5a36df[_0xd3c0('0x12')],_0x34cff9[_0xd3c0('0x20')]);})['then'](function(_0x4ae39d){logger['info'](util['format'](_0xd3c0('0x25'),_0xbcc62a['id']));return _0xbcc62a[_0xd3c0('0x26')]({'sentiment':_0x4ae39d[_0xd3c0('0x27')],'sPositive':_0x4ae39d[_0xd3c0('0x28')][_0xd3c0('0x29')],'sNegative':_0x4ae39d[_0xd3c0('0x28')][_0xd3c0('0x2a')],'sMixed':_0x4ae39d[_0xd3c0('0x28')]['Mixed'],'sNeutral':_0x4ae39d['SentimentScore'][_0xd3c0('0x2b')]});})['then'](function(){logger[_0xd3c0('0xe')](util[_0xd3c0('0x8')](_0xd3c0('0x1a'),_0xbcc62a['id']));_0x43d732();});case _0xd3c0('0x2c'):return _0xbcc62a[_0xd3c0('0x26')]({'transcribeStatus':_0xd3c0('0x2c'),'failureReason':_0x36f41c['TranscriptionJob'][_0xd3c0('0x2d')]})[_0xd3c0('0x15')](function(){logger[_0xd3c0('0xe')](util[_0xd3c0('0x8')](_0xd3c0('0x1a'),_0xbcc62a['id']));_0x43d732();});default:logger[_0xd3c0('0xe')](util['format']('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0xbcc62a['id']));break;}}else{return BPromise[_0xd3c0('0x2e')]()[_0xd3c0('0x15')](function(){if(!_0xbcc62a[_0xd3c0('0x2f')]){throw new db[(_0xd3c0('0x1b'))][(_0xd3c0('0x1c'))](_0xd3c0('0x30'));}if(!_0x34cff9[_0xd3c0('0x1d')]||!_0x34cff9[_0xd3c0('0x1e')]||!_0x34cff9[_0xd3c0('0x1f')]||!_0x34cff9['language']||!_0x34cff9[_0xd3c0('0x21')]){throw new db[(_0xd3c0('0x1b'))][(_0xd3c0('0x1c'))](_0xd3c0('0x22'));}if(!_0xbcc62a['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x34cff9[_0xd3c0('0x1e')]===_0x5cc5ca['id']){return _0x5cc5ca;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings[_0xd3c0('0x1e')]}});}})[_0xd3c0('0x15')](function(_0x9ed6d5){if(!_0x9ed6d5){throw new db['Sequelize']['ValidationError'](_0xd3c0('0x24'));}if(!_0x9ed6d5['data1']||!_0x9ed6d5[_0xd3c0('0xc')]){throw new db[(_0xd3c0('0x1b'))][(_0xd3c0('0x1c'))](_0xd3c0('0x31'));}_0x1eb687=_0x9ed6d5;logger[_0xd3c0('0xe')](util[_0xd3c0('0x8')](_0xd3c0('0x32'),_0xbcc62a['id']));return sentiment(_0x1eb687[_0xd3c0('0xb')],_0x1eb687[_0xd3c0('0xc')],_0x34cff9[_0xd3c0('0x1f')],_0xbcc62a[_0xd3c0('0x12')],_0x34cff9[_0xd3c0('0x20')]);})[_0xd3c0('0x15')](function(_0x5bc21c){logger[_0xd3c0('0xe')](util[_0xd3c0('0x8')](_0xd3c0('0x25'),_0xbcc62a['id']));return _0xbcc62a['update']({'sentiment':_0x5bc21c[_0xd3c0('0x27')],'sPositive':_0x5bc21c[_0xd3c0('0x28')][_0xd3c0('0x29')],'sNegative':_0x5bc21c[_0xd3c0('0x28')][_0xd3c0('0x2a')],'sMixed':_0x5bc21c['SentimentScore']['Mixed'],'sNeutral':_0x5bc21c[_0xd3c0('0x28')][_0xd3c0('0x2b')],'transcribeStatus':'COMPLETED'});})[_0xd3c0('0x15')](function(){logger[_0xd3c0('0xe')](util[_0xd3c0('0x8')](_0xd3c0('0x1a'),_0xbcc62a['id']));_0x43d732();});}})[_0xd3c0('0x33')](function(_0x457705){if(_0x457705){if(!_0x457705[_0xd3c0('0x34')]||_0x457705['name']!==_0xd3c0('0x35')){logger['error'](util[_0xd3c0('0x8')](_0xd3c0('0x36'),_0xbcc62a['id']),util[_0xd3c0('0x37')](_0x457705,{'showHidden':![],'depth':null}));}}_0x43d732();});});}function checkTranscribe(){var _0x22db6f;var _0x490b32;var _0x57d5f8;return db['VoiceRecording']['findAll']({'where':{'transcribeStatus':'IN_PROGRESS'}})['then'](function(_0x49f124){if(!_0x49f124||!_0x49f124[_0xd3c0('0x18')]){throw new db[(_0xd3c0('0x1b'))][(_0xd3c0('0x1c'))](_0xd3c0('0x38'));}_0x22db6f=_0x49f124;return db[_0xd3c0('0x39')][_0xd3c0('0x3a')]({'where':{'id':0x1}});})[_0xd3c0('0x15')](function(_0x5b6e27){if(!_0x5b6e27){throw new db[(_0xd3c0('0x1b'))][(_0xd3c0('0x1c'))](_0xd3c0('0x3b'));}_0x490b32=_0x5b6e27;if(!_0x490b32['transcribe']||!_0x490b32[_0xd3c0('0x3c')]||!_0x490b32[_0xd3c0('0xd')]||!_0x490b32[_0xd3c0('0x20')]||!_0x490b32[_0xd3c0('0x21')]){throw new db[(_0xd3c0('0x1b'))]['ValidationError'](_0xd3c0('0x3d'));}return db[_0xd3c0('0x3e')][_0xd3c0('0x3a')]({'where':{'id':_0x490b32[_0xd3c0('0x3c')]}});})[_0xd3c0('0x15')](function(_0x2bcd13){if(!_0x2bcd13){throw new db[(_0xd3c0('0x1b'))][(_0xd3c0('0x1c'))](_0xd3c0('0x24'));}if(!_0x2bcd13[_0xd3c0('0xb')]||!_0x2bcd13[_0xd3c0('0xc')]){throw new db[(_0xd3c0('0x1b'))]['ValidationError'](_0xd3c0('0x31'));}_0x57d5f8=_0x2bcd13;var _0x4641c7=[];_0x22db6f['forEach'](function(_0x53bea6){_0x4641c7[_0xd3c0('0x3f')](checkTranscribeJob(_0x53bea6,_0x490b32,_0x57d5f8));});return BPromise[_0xd3c0('0x40')](_0x4641c7);})[_0xd3c0('0x33')](function(_0x4f080a){if(_0x4f080a){if(!_0x4f080a[_0xd3c0('0x34')]||_0x4f080a['name']!==_0xd3c0('0x35')){logger[_0xd3c0('0x41')](util['inspect'](_0x4f080a,{'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 68a0c74..18ff411 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 _0x1f2d=['error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','length','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x1f2d,0x1c4));var _0xd1f2=function(_0xa4c85,_0x2b52a7){_0xa4c85=_0xa4c85-0x0;var _0x172c1f=_0x1f2d[_0xa4c85];return _0x172c1f;};'use strict';var _=require(_0xd1f2('0x0'));var moment=require(_0xd1f2('0x1'));var Redis=require(_0xd1f2('0x2'));var util=require(_0xd1f2('0x3'));var config=require('../../config/environment');var db=require(_0xd1f2('0x4'))['db'];var logger=require(_0xd1f2('0x5'))(_0xd1f2('0x6'));config[_0xd1f2('0x7')]=_[_0xd1f2('0x8')](config[_0xd1f2('0x7')],{'host':_0xd1f2('0x9'),'port':0x18eb});var io=require(_0xd1f2('0xa'))(new Redis(config[_0xd1f2('0x7')]));function closeInteractions(){var _0x3a30cd=[];return db[_0xd1f2('0xb')][_0xd1f2('0xc')]({'raw':!![],'attributes':['id',_0xd1f2('0xd')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xd1f2('0xe')](0x18,_0xd1f2('0xf'))}}})[_0xd1f2('0x10')](function(_0x42014c){if(_0x42014c&&_0x42014c['length']){_0x3a30cd=_[_0xd1f2('0x11')](_0x42014c||[],'id');logger[_0xd1f2('0x12')](_0xd1f2('0x13'),_0x3a30cd[_0xd1f2('0x14')]());return db['WhatsappInteraction'][_0xd1f2('0x15')]({'closeReason':_0xd1f2('0x16'),'disposition':_0xd1f2('0x17'),'closed':!![],'closedAt':moment()['format'](_0xd1f2('0x18'))},{'where':{'id':_0x3a30cd}});}})[_0xd1f2('0x10')](function(){if(_0x3a30cd&&_0x3a30cd[_0xd1f2('0x19')]){logger[_0xd1f2('0x12')](_0xd1f2('0x1a'),_0x3a30cd[_0xd1f2('0x14')]());for(var _0x2def2b=0x0;_0x2def2b<_0x3a30cd['length'];_0x2def2b++){io[_0xd1f2('0x1b')]('whatsappInteraction:update',{'id':_0x3a30cd[_0x2def2b],'closed':!![]});}}})['catch'](function(_0x487bac){logger[_0xd1f2('0x1c')](_0xd1f2('0x1d'),_0x487bac?util[_0xd1f2('0x1e')](_0x487bac,{'showHidden':![],'depth':null}):'');});}exports[_0xd1f2('0x1f')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x3730=['util','../../config/environment','../../mysqldb','schedule','redis','localhost','socket.io-emitter','WhatsappInteraction','lastMsgAt','subtract','hours','then','length','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','timeout','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3730,0x86));var _0x0373=function(_0x3b4b28,_0x4c888d){_0x3b4b28=_0x3b4b28-0x0;var _0x1ab95f=_0x3730[_0x3b4b28];return _0x1ab95f;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require(_0x0373('0x0'));var util=require(_0x0373('0x1'));var config=require(_0x0373('0x2'));var db=require(_0x0373('0x3'))['db'];var logger=require('../logger')(_0x0373('0x4'));config[_0x0373('0x5')]=_['defaults'](config[_0x0373('0x5')],{'host':_0x0373('0x6'),'port':0x18eb});var io=require(_0x0373('0x7'))(new Redis(config[_0x0373('0x5')]));function closeInteractions(){var _0x3731bb=[];return db[_0x0373('0x8')]['findAll']({'raw':!![],'attributes':['id',_0x0373('0x9')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x0373('0xa')](0x18,_0x0373('0xb'))}}})[_0x0373('0xc')](function(_0x5b9d56){if(_0x5b9d56&&_0x5b9d56[_0x0373('0xd')]){_0x3731bb=_['map'](_0x5b9d56||[],'id');logger[_0x0373('0xe')](_0x0373('0xf'),_0x3731bb[_0x0373('0x10')]());return db[_0x0373('0x8')][_0x0373('0x11')]({'closeReason':'system','disposition':_0x0373('0x12'),'closed':!![],'closedAt':moment()['format'](_0x0373('0x13'))},{'where':{'id':_0x3731bb}});}})[_0x0373('0xc')](function(){if(_0x3731bb&&_0x3731bb['length']){logger['info'](_0x0373('0x14'),_0x3731bb[_0x0373('0x10')]());for(var _0x241065=0x0;_0x241065<_0x3731bb[_0x0373('0xd')];_0x241065++){io[_0x0373('0x15')](_0x0373('0x16'),{'id':_0x3731bb[_0x241065],'closed':!![]});}}})[_0x0373('0x17')](function(_0x5e508b){logger['error'](_0x0373('0x18'),_0x5e508b?util[_0x0373('0x19')](_0x5e508b,{'showHidden':![],'depth':null}):'');});}exports[_0x0373('0x1a')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 2f11a4f..fe2b7fd 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd2c7=['../mysqldb','push','Biondo','innocenzo.biondo','@xcally.com','now','then','CmContact','bulkCreate','log','finished\x20populating','contacts1','CmHopper','destroy','hopper1','contacts2','catch','util'];(function(_0x3ec0e9,_0x35ac39){var _0x1c5d9b=function(_0x44598f){while(--_0x44598f){_0x3ec0e9['push'](_0x3ec0e9['shift']());}};_0x1c5d9b(++_0x35ac39);}(_0xd2c7,0xc5));var _0x7d2c=function(_0x94189,_0x302a24){_0x94189=_0x94189-0x0;var _0x7bcba0=_0xd2c7[_0x94189];return _0x7bcba0;};'use strict';var util=require(_0x7d2c('0x0'));var db=require(_0x7d2c('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x7d2c('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x7d2c('0x3')+i,'phone':0xf879fb460+i,'email':_0x7d2c('0x4')+i+_0x7d2c('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x7d2c('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x7d2c('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x7d2c('0x6')](),'updatedAt':Date[_0x7d2c('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x7d2c('0x4')+i+_0x7d2c('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x7d2c('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x7d2c('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x7d2c('0x6')](),'updatedAt':Date[_0x7d2c('0x6')]()});}db['CmContact']['destroy']({'where':{}})[_0x7d2c('0x7')](function(){return db[_0x7d2c('0x8')][_0x7d2c('0x9')](contacts);})[_0x7d2c('0x7')](function(){console[_0x7d2c('0xa')](_0x7d2c('0xb'),_0x7d2c('0xc'));return db[_0x7d2c('0xd')][_0x7d2c('0xe')]({'where':{}});})[_0x7d2c('0x7')](function(){return db[_0x7d2c('0xd')][_0x7d2c('0x9')](hopper);})['then'](function(){console[_0x7d2c('0xa')]('finished\x20populating',_0x7d2c('0xf'));return db[_0x7d2c('0x8')][_0x7d2c('0x9')](contacts2);})['then'](function(){console['log'](_0x7d2c('0xb'),_0x7d2c('0x10'));return db[_0x7d2c('0xd')][_0x7d2c('0x9')](hopper2);})[_0x7d2c('0x7')](function(){console['log']('finished\x20populating','hopper2');})[_0x7d2c('0x11')](function(_0x6f48af){console[_0x7d2c('0xa')](_0x6f48af);}); \ No newline at end of file +var _0xa53f=['hopper2','util','../mysqldb','Innocenzo','Biondo','push','now','innocenzo.biondo','CmContact','then','bulkCreate','log','contacts1','CmHopper','destroy','hopper1','finished\x20populating','contacts2'];(function(_0x453548,_0x494b73){var _0x2fce3d=function(_0x41eb4e){while(--_0x41eb4e){_0x453548['push'](_0x453548['shift']());}};_0x2fce3d(++_0x494b73);}(_0xa53f,0x1e7));var _0xfa53=function(_0x51abab,_0x3fade5){_0x51abab=_0x51abab-0x0;var _0x28ed1b=_0xa53f[_0x51abab];return _0x28ed1b;};'use strict';var util=require(_0xfa53('0x0'));var db=require(_0xfa53('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0xfa53('0x2')+i,'lastName':_0xfa53('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xfa53('0x4')]({'id':i,'active':![],'scheduledat':Date[_0xfa53('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xfa53('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xfa53('0x4')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xfa53('0x3')+i,'phone':0xf879fb460+i,'email':_0xfa53('0x6')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xfa53('0x4')]({'id':i,'active':![],'scheduledat':Date[_0xfa53('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xfa53('0x5')](),'updatedAt':Date[_0xfa53('0x5')]()});}db[_0xfa53('0x7')]['destroy']({'where':{}})[_0xfa53('0x8')](function(){return db[_0xfa53('0x7')][_0xfa53('0x9')](contacts);})[_0xfa53('0x8')](function(){console[_0xfa53('0xa')]('finished\x20populating',_0xfa53('0xb'));return db[_0xfa53('0xc')][_0xfa53('0xd')]({'where':{}});})[_0xfa53('0x8')](function(){return db[_0xfa53('0xc')]['bulkCreate'](hopper);})[_0xfa53('0x8')](function(){console[_0xfa53('0xa')]('finished\x20populating',_0xfa53('0xe'));return db[_0xfa53('0x7')][_0xfa53('0x9')](contacts2);})[_0xfa53('0x8')](function(){console[_0xfa53('0xa')](_0xfa53('0xf'),_0xfa53('0x10'));return db[_0xfa53('0xc')][_0xfa53('0x9')](hopper2);})['then'](function(){console[_0xfa53('0xa')](_0xfa53('0xf'),_0xfa53('0x11'));})['catch'](function(_0x5e0d80){console['log'](_0x5e0d80);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 6ff6b9f..2130132 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa035=['User','bulkCreate','then','add\x20user','catch','log','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss','ulaw','yes','/etc/pki/tls/certs/motion.crt','actpass','\x22%s\x22\x20<%s>'];(function(_0x1d9283,_0x2f3703){var _0x4b3d9f=function(_0xd839c2){while(--_0xd839c2){_0x1d9283['push'](_0x1d9283['shift']());}};_0x4b3d9f(++_0x2f3703);}(_0xa035,0xf8));var _0x5a03=function(_0xc65f44,_0x191a08){_0xc65f44=_0xc65f44-0x0;var _0x5a7f9a=_0xa035[_0xc65f44];return _0x5a7f9a;};'use strict';var util=require(_0x5a03('0x0'));var db=require(_0x5a03('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x5a03('0x2')]({'name':util[_0x5a03('0x3')](_0x5a03('0x4'),_0x5a03('0x5'),i),'fullname':util[_0x5a03('0x3')](_0x5a03('0x4'),'agent',i),'email':util[_0x5a03('0x3')](_0x5a03('0x6'),_0x5a03('0x5'),i),'role':_0x5a03('0x5'),'password':_0x5a03('0x7'),'internal':0xfa0+i,'type':_0x5a03('0x8'),'transport':[_0x5a03('0x9'),'ws',_0x5a03('0xa')],'disallow':['all'],'allow':[_0x5a03('0xb')],'defaultuser':util[_0x5a03('0x3')](_0x5a03('0x4'),'agent',i),'encryption':'yes','avpf':_0x5a03('0xc'),'force_avp':'yes','icesupport':_0x5a03('0xc'),'dtlsenable':_0x5a03('0xc'),'dtlsverify':'no','dtlscertfile':_0x5a03('0xd'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x5a03('0xe'),'callerid':util[_0x5a03('0x3')](_0x5a03('0xf'),util[_0x5a03('0x3')](_0x5a03('0x4'),_0x5a03('0x5'),i),0xfa0+i)});}db[_0x5a03('0x10')][_0x5a03('0x11')](users)[_0x5a03('0x12')](function(){console['log'](_0x5a03('0x13'));})[_0x5a03('0x14')](function(_0x37f09f){console[_0x5a03('0x15')](_0x37f09f);}); \ No newline at end of file +var _0xf1a6=['add\x20user','catch','util','push','format','%s%s','agent','password','friend','udp','wss','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','User','bulkCreate','then','log'];(function(_0x3cdb33,_0xff5c5c){var _0x4fdf7c=function(_0x36e3aa){while(--_0x36e3aa){_0x3cdb33['push'](_0x3cdb33['shift']());}};_0x4fdf7c(++_0xff5c5c);}(_0xf1a6,0xe6));var _0x6f1a=function(_0x44908b,_0x318429){_0x44908b=_0x44908b-0x0;var _0x219ba9=_0xf1a6[_0x44908b];return _0x219ba9;};'use strict';var util=require(_0x6f1a('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x6f1a('0x1')]({'name':util[_0x6f1a('0x2')](_0x6f1a('0x3'),_0x6f1a('0x4'),i),'fullname':util[_0x6f1a('0x2')](_0x6f1a('0x3'),_0x6f1a('0x4'),i),'email':util['format']('%s%s@xcally.com',_0x6f1a('0x4'),i),'role':_0x6f1a('0x4'),'password':_0x6f1a('0x5'),'internal':0xfa0+i,'type':_0x6f1a('0x6'),'transport':[_0x6f1a('0x7'),'ws',_0x6f1a('0x8')],'disallow':['all'],'allow':[_0x6f1a('0x9')],'defaultuser':util[_0x6f1a('0x2')](_0x6f1a('0x3'),'agent',i),'encryption':_0x6f1a('0xa'),'avpf':_0x6f1a('0xa'),'force_avp':_0x6f1a('0xa'),'icesupport':'yes','dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x6f1a('0xb'),'dtlsprivatekey':_0x6f1a('0xc'),'dtlssetup':'actpass','callerid':util[_0x6f1a('0x2')]('\x22%s\x22\x20<%s>',util[_0x6f1a('0x2')]('%s%s',_0x6f1a('0x4'),i),0xfa0+i)});}db[_0x6f1a('0xd')][_0x6f1a('0xe')](users)[_0x6f1a('0xf')](function(){console[_0x6f1a('0x10')](_0x6f1a('0x11'));})[_0x6f1a('0x12')](function(_0x10f4ed){console['log'](_0x10f4ed);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 2d46d03..d6c9058 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x87bc=['resourceId','User','where','role','Campaign','type','format','%s:queue:%s','length','query','find','handshake','ChatInteraction','ChatInteractions','MailInteraction','SmsInteraction','SmsInteractions','WhatsappInteraction','WhatsappInteractions','user:%s','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','user','userProfileId','ChatQueues','WhatsappQueue','Telephones','Trunks','agent','getVoiceQueues','getChatQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','openchannel','whatsapp','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','MailInteractions','user_has_mail_interactions:remove','FaxInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','join','default','connection','setMaxListeners','address','request','remotePort','connectedAt','log','SocketIO\x20','disconnect','DISCONNECTED','CONNECTED','lodash','util','../mysqldb','Agents','name','telephone','ivr','UserProfileSection','findOne','then','autoAssociation','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','IvrCampaigns','UserProfileResource','map'];(function(_0x375492,_0x4ed149){var _0x18ba5b=function(_0x154a12){while(--_0x154a12){_0x375492['push'](_0x375492['shift']());}};_0x18ba5b(++_0x4ed149);}(_0x87bc,0x189));var _0xc87b=function(_0x47944c,_0x94cd2d){_0x47944c=_0x47944c-0x0;var _0x451f93=_0x87bc[_0x47944c];return _0x451f93;};'use strict';var _=require(_0xc87b('0x0'));var util=require(_0xc87b('0x1'));var BPromise=require('bluebird');var db=require(_0xc87b('0x2'))['db'];var config=require('./environment');var queryQueues={'attributes':['id','name'],'include':[{'as':_0xc87b('0x3'),'model':db['User'],'attributes':['id',_0xc87b('0x4'),'role'],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0xc87b('0x5')}};var queryTrunks={'raw':!![],'attributes':['id',_0xc87b('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0xc87b('0x4')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id','name','type'],'where':{'type':_0xc87b('0x6')}};function getAssociatedResources(_0x169bbb,_0x1144cc,_0x19b571){return db[_0xc87b('0x7')][_0xc87b('0x8')]({'where':{'name':_0x169bbb,'userProfileId':_0x1144cc},'raw':!![]})[_0xc87b('0x9')](function(_0x1d834a){if(_0x1d834a){if(_0x1d834a[_0xc87b('0xa')]){switch(_0x169bbb){case'VoiceQueues':case'ChatQueues':case _0xc87b('0xb'):case'SmsQueues':case _0xc87b('0xc'):case _0xc87b('0xd'):case _0xc87b('0xe'):return db[_0x19b571][_0xc87b('0xf')](queryQueues);case'Telephones':return db[_0x19b571][_0xc87b('0xf')](queryTelephones);case'Trunks':return db[_0x19b571][_0xc87b('0xf')](queryTrunks);case _0xc87b('0x10'):return db[_0x19b571]['findAll'](queryCampaigns);}}else{return db[_0xc87b('0x11')][_0xc87b('0xf')]({'attributes':['resourceId'],'where':{'sectionId':_0x1d834a['id']},'raw':!![]})[_0xc87b('0x9')](function(_0x21f1d1){if(_0x21f1d1){var _0x34195e={'where':{'id':_[_0xc87b('0x12')](_0x21f1d1,_0xc87b('0x13'))},'raw':!![]};switch(_0x19b571){case _0xc87b('0x14'):_0x34195e[_0xc87b('0x15')][_0xc87b('0x16')]='telephone';break;case _0xc87b('0x17'):_0x34195e['where'][_0xc87b('0x18')]=_0xc87b('0x6');break;}return db[_0x19b571]['findAll'](_0x34195e);}else{return[];}});}}else{return[];}})[_0xc87b('0x9')](function(_0x372665){return _0x372665;});}function joinOrLeaveQueues(_0x4f56a0,_0x35b58f,_0x4cceeb,_0x36c8c4){_0x4f56a0[_0x35b58f](util[_0xc87b('0x19')](_0xc87b('0x1a'),_0x4cceeb,_0x36c8c4[_0xc87b('0x4')]));if(_0x36c8c4[_0xc87b('0x3')]){for(var _0x211b3c=0x0;_0x211b3c<_0x36c8c4[_0xc87b('0x3')][_0xc87b('0x1b')];_0x211b3c+=0x1){_0x4f56a0[_0x35b58f](util[_0xc87b('0x19')]('user:%s',_0x36c8c4[_0xc87b('0x3')][_0x211b3c]['name']));}}}function joinOrLeave(_0x3c6d50,_0x42d099,_0x147731){var _0x4bff29;if(_0x3c6d50['handshake'][_0xc87b('0x1c')]['id']){db[_0xc87b('0x14')][_0xc87b('0x1d')]({'attributes':['id',_0xc87b('0x4'),_0xc87b('0x16'),'userProfileId'],'where':{'id':_0x3c6d50[_0xc87b('0x1e')][_0xc87b('0x1c')]['id']},'include':[{'model':db[_0xc87b('0x1f')],'as':_0xc87b('0x20'),'attributes':['id'],'raw':!![]},{'model':db[_0xc87b('0x21')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xc87b('0x22')],'as':_0xc87b('0x23'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xc87b('0x24')],'as':_0xc87b('0x25'),'attributes':['id'],'raw':!![]}]})[_0xc87b('0x9')](function(_0x4e02d7){if(_0x4e02d7){_0x4bff29=_0x4e02d7;_0x3c6d50[_0x42d099](util[_0xc87b('0x19')](_0xc87b('0x26'),_0x4e02d7[_0xc87b('0x4')]));var _0x4b1ac6=[];switch(_0x4e02d7[_0xc87b('0x16')]){case _0xc87b('0x27'):_0x3c6d50[_0x42d099](_0xc87b('0x28'));_0x3c6d50[_0x42d099](_0xc87b('0x29'));if(queryQueues[_0xc87b('0x2a')](_0xc87b('0x2b'))){delete queryQueues[_0xc87b('0x2b')];}_0x4b1ac6[_0xc87b('0x2c')](db[_0xc87b('0x2d')][_0xc87b('0xf')](queryQueues));_0x4b1ac6[_0xc87b('0x2c')](db[_0xc87b('0x2e')]['findAll'](queryQueues));_0x4b1ac6[_0xc87b('0x2c')](db[_0xc87b('0x2f')]['findAll'](queryQueues));_0x4b1ac6[_0xc87b('0x2c')](db[_0xc87b('0x30')][_0xc87b('0xf')](queryQueues));_0x4b1ac6['push'](db[_0xc87b('0x31')][_0xc87b('0xf')](queryQueues));_0x4b1ac6[_0xc87b('0x2c')](db[_0xc87b('0x32')][_0xc87b('0xf')](queryQueues));_0x4b1ac6['push'](db['WhatsappQueue'][_0xc87b('0xf')](queryQueues));_0x4b1ac6['push'](db[_0xc87b('0x14')][_0xc87b('0xf')](queryTelephones));_0x4b1ac6[_0xc87b('0x2c')](db[_0xc87b('0x33')]['findAll'](queryTrunks));_0x4b1ac6[_0xc87b('0x2c')](db[_0xc87b('0x17')][_0xc87b('0xf')](queryCampaigns));_0x4b1ac6[_0xc87b('0x2c')](db[_0xc87b('0x14')][_0xc87b('0xf')](queryAgents));break;case _0xc87b('0x34'):_0x3c6d50[_0x42d099]('voice:inbound');_0x3c6d50[_0x42d099](_0xc87b('0x29'));_0x4b1ac6['push'](getAssociatedResources('VoiceQueues',_0x4e02d7[_0xc87b('0x35')],_0xc87b('0x2d')));_0x4b1ac6[_0xc87b('0x2c')](getAssociatedResources(_0xc87b('0x36'),_0x4e02d7[_0xc87b('0x35')],_0xc87b('0x2e')));_0x4b1ac6['push'](getAssociatedResources(_0xc87b('0xb'),_0x4e02d7[_0xc87b('0x35')],_0xc87b('0x2f')));_0x4b1ac6[_0xc87b('0x2c')](getAssociatedResources('SmsQueues',_0x4e02d7[_0xc87b('0x35')],_0xc87b('0x30')));_0x4b1ac6[_0xc87b('0x2c')](getAssociatedResources(_0xc87b('0xc'),_0x4e02d7['userProfileId'],'MailQueue'));_0x4b1ac6['push'](getAssociatedResources(_0xc87b('0xd'),_0x4e02d7[_0xc87b('0x35')],'OpenchannelQueue'));_0x4b1ac6[_0xc87b('0x2c')](getAssociatedResources(_0xc87b('0xe'),_0x4e02d7[_0xc87b('0x35')],_0xc87b('0x37')));_0x4b1ac6[_0xc87b('0x2c')](getAssociatedResources(_0xc87b('0x38'),_0x4e02d7[_0xc87b('0x35')],_0xc87b('0x14')));_0x4b1ac6[_0xc87b('0x2c')](getAssociatedResources(_0xc87b('0x39'),_0x4e02d7[_0xc87b('0x35')],_0xc87b('0x33')));_0x4b1ac6[_0xc87b('0x2c')](getAssociatedResources(_0xc87b('0x10'),_0x4e02d7[_0xc87b('0x35')],'Campaign'));_0x4b1ac6[_0xc87b('0x2c')](db[_0xc87b('0x14')][_0xc87b('0xf')](queryAgents));break;case _0xc87b('0x3a'):_0x3c6d50[_0x42d099](_0xc87b('0x28'));_0x3c6d50[_0x42d099]('voice:outbound');_0x4b1ac6['push'](_0x4e02d7[_0xc87b('0x3b')]({'attributes':['id',_0xc87b('0x4')]}));_0x4b1ac6['push'](_0x4e02d7[_0xc87b('0x3c')]({'attributes':['id',_0xc87b('0x4')]}));_0x4b1ac6[_0xc87b('0x2c')](_0x4e02d7[_0xc87b('0x3d')]({'attributes':['id',_0xc87b('0x4')]}));_0x4b1ac6[_0xc87b('0x2c')](_0x4e02d7['getSmsQueues']({'attributes':['id','name']}));_0x4b1ac6[_0xc87b('0x2c')](_0x4e02d7[_0xc87b('0x3e')]({'attributes':['id',_0xc87b('0x4')]}));_0x4b1ac6[_0xc87b('0x2c')](_0x4e02d7[_0xc87b('0x3f')]({'attributes':['id',_0xc87b('0x4')]}));_0x4b1ac6[_0xc87b('0x2c')](_0x4e02d7[_0xc87b('0x40')]({'attributes':['id',_0xc87b('0x4')]}));break;}return BPromise[_0xc87b('0x41')](_0x4b1ac6);}})[_0xc87b('0x9')](function(_0x2fe333){if(_0x2fe333&&_0x2fe333[_0xc87b('0x1b')]){for(var _0x5ee6ea=0x0;_0x5ee6ea<_0x2fe333[_0xc87b('0x1b')];_0x5ee6ea+=0x1){for(var _0x3b6d31=0x0;_0x3b6d31<_0x2fe333[_0x5ee6ea]['length'];_0x3b6d31+=0x1){switch(_0x5ee6ea){case 0x0:joinOrLeaveQueues(_0x3c6d50,_0x42d099,_0xc87b('0x42'),_0x2fe333[_0x5ee6ea][_0x3b6d31]);break;case 0x1:joinOrLeaveQueues(_0x3c6d50,_0x42d099,_0xc87b('0x43'),_0x2fe333[_0x5ee6ea][_0x3b6d31]);break;case 0x2:joinOrLeaveQueues(_0x3c6d50,_0x42d099,_0xc87b('0x44'),_0x2fe333[_0x5ee6ea][_0x3b6d31]);break;case 0x3:joinOrLeaveQueues(_0x3c6d50,_0x42d099,_0xc87b('0x45'),_0x2fe333[_0x5ee6ea][_0x3b6d31]);break;case 0x4:joinOrLeaveQueues(_0x3c6d50,_0x42d099,_0xc87b('0x46'),_0x2fe333[_0x5ee6ea][_0x3b6d31]);break;case 0x5:joinOrLeaveQueues(_0x3c6d50,_0x42d099,_0xc87b('0x47'),_0x2fe333[_0x5ee6ea][_0x3b6d31]);break;case 0x6:joinOrLeaveQueues(_0x3c6d50,_0x42d099,_0xc87b('0x48'),_0x2fe333[_0x5ee6ea][_0x3b6d31]);break;case 0x7:if(_0x4bff29['role']!=='agent')_0x3c6d50[_0x42d099](util[_0xc87b('0x19')]('telephone:%s',_0x2fe333[_0x5ee6ea][_0x3b6d31][_0xc87b('0x4')]));break;case 0x8:if(_0x4bff29[_0xc87b('0x16')]!==_0xc87b('0x3a'))_0x3c6d50[_0x42d099](util['format'](_0xc87b('0x49'),_0x2fe333[_0x5ee6ea][_0x3b6d31][_0xc87b('0x4')]));break;case 0x9:if(_0x4bff29[_0xc87b('0x16')]!==_0xc87b('0x3a'))_0x3c6d50[_0x42d099](util[_0xc87b('0x19')](_0xc87b('0x4a'),_0x2fe333[_0x5ee6ea][_0x3b6d31][_0xc87b('0x18')],_0x2fe333[_0x5ee6ea][_0x3b6d31]['name']));break;case 0xa:_0x3c6d50[_0x42d099](util['format'](_0xc87b('0x26'),_0x2fe333[_0x5ee6ea][_0x3b6d31][_0xc87b('0x4')]));break;}}}}})[_0xc87b('0x9')](function(){if(_0x42d099===_0xc87b('0x4b')){var _0xe73d52=_['map'](_0x4bff29['ChatInteractions'],'id');return _0x4bff29[_0xc87b('0x4c')](_0xe73d52)[_0xc87b('0x9')](function(){for(var _0x4ac1ca=0x0;_0x4ac1ca<_0xe73d52[_0xc87b('0x1b')];_0x4ac1ca+=0x1){_0x147731[_0xc87b('0x4d')](_0xc87b('0x4e'),{'ChatInteractionId':Number(_0xe73d52[_0x4ac1ca]),'UserId':Number(_0x4bff29['id'])});}});}})[_0xc87b('0x9')](function(){if(_0x42d099==='leave'){var _0x1a38e5=_[_0xc87b('0x12')](_0x4bff29[_0xc87b('0x4f')],'id');return _0x4bff29['removeMailInteractions'](_0x1a38e5)[_0xc87b('0x9')](function(){for(var _0x1d5a58=0x0;_0x1d5a58<_0x1a38e5['length'];_0x1d5a58+=0x1){_0x147731[_0xc87b('0x4d')](_0xc87b('0x50'),{'MailInteractionId':Number(_0x1a38e5[_0x1d5a58]),'UserId':Number(_0x4bff29['id'])});}});}})[_0xc87b('0x9')](function(){if(_0x42d099===_0xc87b('0x4b')){var _0x2fbaf0=_[_0xc87b('0x12')](_0x4bff29[_0xc87b('0x51')],'id');return _0x4bff29['removeFaxInteractions'](_0x2fbaf0)['then'](function(){for(var _0x27f74d=0x0;_0x27f74d<_0x2fbaf0[_0xc87b('0x1b')];_0x27f74d+=0x1){_0x147731[_0xc87b('0x4d')](_0xc87b('0x52'),{'FaxInteractionId':Number(_0x2fbaf0[_0x27f74d]),'UserId':Number(_0x4bff29['id'])});}});}})[_0xc87b('0x9')](function(){if(_0x42d099===_0xc87b('0x4b')){var _0x57dbec=_['map'](_0x4bff29[_0xc87b('0x23')],'id');return _0x4bff29['removeSmsInteractions'](_0x57dbec)['then'](function(){for(var _0x2ef012=0x0;_0x2ef012<_0x57dbec[_0xc87b('0x1b')];_0x2ef012+=0x1){_0x147731[_0xc87b('0x4d')](_0xc87b('0x53'),{'SmsInteractionId':Number(_0x57dbec[_0x2ef012]),'UserId':Number(_0x4bff29['id'])});}});}})[_0xc87b('0x9')](function(){if(_0x42d099===_0xc87b('0x4b')){var _0x3f1a63=_['map'](_0x4bff29[_0xc87b('0x54')],'id');return _0x4bff29[_0xc87b('0x55')](_0x3f1a63)[_0xc87b('0x9')](function(){for(var _0x1594e8=0x0;_0x1594e8<_0x3f1a63[_0xc87b('0x1b')];_0x1594e8+=0x1){_0x147731[_0xc87b('0x4d')](_0xc87b('0x56'),{'OpenchannelInteractionId':Number(_0x3f1a63[_0x1594e8]),'UserId':Number(_0x4bff29['id'])});}});}})[_0xc87b('0x9')](function(){if(_0x42d099===_0xc87b('0x4b')){var _0x5f4553=_[_0xc87b('0x12')](_0x4bff29[_0xc87b('0x25')],'id');return _0x4bff29[_0xc87b('0x57')](_0x5f4553)[_0xc87b('0x9')](function(){for(var _0x5337c9=0x0;_0x5337c9<_0x5f4553[_0xc87b('0x1b')];_0x5337c9+=0x1){_0x147731['emit'](_0xc87b('0x58'),{'WhatsappInteractionId':Number(_0x5f4553[_0x5337c9]),'UserId':Number(_0x4bff29['id'])});}});}})[_0xc87b('0x59')](function(_0xaf8206){_0x3c6d50['log'](_0xaf8206);});}}function onDisconnect(_0x3a7e5b,_0x1900c9){joinOrLeave(_0x3a7e5b,_0xc87b('0x4b'),_0x1900c9);}function onConnect(_0x438abe){joinOrLeave(_0x438abe,_0xc87b('0x5a'));}exports[_0xc87b('0x5b')]=function(_0x342f05){_0x342f05['on'](_0xc87b('0x5c'),function(_0x1c0807){_0x1c0807[_0xc87b('0x5d')](0x0);_0x1c0807[_0xc87b('0x5e')]=_0x1c0807[_0xc87b('0x5f')][_0xc87b('0x5c')]['remoteAddress']+':'+_0x1c0807['request'][_0xc87b('0x5c')][_0xc87b('0x60')];_0x1c0807[_0xc87b('0x61')]=new Date();_0x1c0807[_0xc87b('0x62')]=function(_0x58a215){console[_0xc87b('0x62')](_0xc87b('0x63')+_0x1c0807['nsp'][_0xc87b('0x4')]+'['+_0x1c0807[_0xc87b('0x5e')]+']',_0x58a215);};_0x1c0807['on'](_0xc87b('0x64'),function(){onDisconnect(_0x1c0807,_0x342f05);_0x1c0807[_0xc87b('0x62')](_0xc87b('0x65'));});onConnect(_0x1c0807);_0x1c0807[_0xc87b('0x62')](_0xc87b('0x66'));});}; \ No newline at end of file +var _0x363a=['include','push','VoiceQueue','ChatQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','VoiceQueues','SmsQueue','OpenchannelQueues','IvrCampaigns','getVoiceQueues','getChatQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','chat','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','removeChatInteractions','emit','user_has_chat_interactions:remove','leave','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','address','remoteAddress','request','SocketIO\x20','disconnect','DISCONNECTED','CONNECTED','util','../mysqldb','name','Agents','role','agent','telephone','type','ivr','UserProfileSection','findOne','autoAssociation','ChatQueues','SmsQueues','MailQueues','WhatsappQueues','findAll','Telephones','Trunks','UserProfileResource','resourceId','map','User','where','Campaign','then','format','%s:queue:%s','length','handshake','query','find','userProfileId','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','user:%s','admin','voice:inbound','voice:outbound'];(function(_0x196238,_0x2d03e1){var _0x4dc983=function(_0x4149b6){while(--_0x4149b6){_0x196238['push'](_0x196238['shift']());}};_0x4dc983(++_0x2d03e1);}(_0x363a,0x97));var _0xa363=function(_0x3a15ce,_0x5f0345){_0x3a15ce=_0x3a15ce-0x0;var _0x57cd6b=_0x363a[_0x3a15ce];return _0x57cd6b;};'use strict';var _=require('lodash');var util=require(_0xa363('0x0'));var BPromise=require('bluebird');var db=require(_0xa363('0x1'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0xa363('0x2')],'include':[{'as':_0xa363('0x3'),'model':db['User'],'attributes':['id',_0xa363('0x2'),_0xa363('0x4')],'raw':!![],'where':{'role':_0xa363('0x5')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0xa363('0x6')}};var queryTrunks={'raw':!![],'attributes':['id',_0xa363('0x2')]};var queryAgents={'raw':!![],'attributes':['id',_0xa363('0x2')],'where':{'role':_0xa363('0x5')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xa363('0x2'),_0xa363('0x7')],'where':{'type':_0xa363('0x8')}};function getAssociatedResources(_0x26bcfe,_0x56ee17,_0x351026){return db[_0xa363('0x9')][_0xa363('0xa')]({'where':{'name':_0x26bcfe,'userProfileId':_0x56ee17},'raw':!![]})['then'](function(_0x56e4d2){if(_0x56e4d2){if(_0x56e4d2[_0xa363('0xb')]){switch(_0x26bcfe){case'VoiceQueues':case _0xa363('0xc'):case'FaxQueues':case _0xa363('0xd'):case _0xa363('0xe'):case'OpenchannelQueues':case _0xa363('0xf'):return db[_0x351026][_0xa363('0x10')](queryQueues);case _0xa363('0x11'):return db[_0x351026][_0xa363('0x10')](queryTelephones);case _0xa363('0x12'):return db[_0x351026]['findAll'](queryTrunks);case'IvrCampaigns':return db[_0x351026][_0xa363('0x10')](queryCampaigns);}}else{return db[_0xa363('0x13')][_0xa363('0x10')]({'attributes':[_0xa363('0x14')],'where':{'sectionId':_0x56e4d2['id']},'raw':!![]})['then'](function(_0x570d49){if(_0x570d49){var _0x1d5ef9={'where':{'id':_[_0xa363('0x15')](_0x570d49,_0xa363('0x14'))},'raw':!![]};switch(_0x351026){case _0xa363('0x16'):_0x1d5ef9[_0xa363('0x17')]['role']='telephone';break;case _0xa363('0x18'):_0x1d5ef9[_0xa363('0x17')][_0xa363('0x7')]='ivr';break;}return db[_0x351026]['findAll'](_0x1d5ef9);}else{return[];}});}}else{return[];}})[_0xa363('0x19')](function(_0x31e500){return _0x31e500;});}function joinOrLeaveQueues(_0x1a8b4c,_0x700cfc,_0x2e70b3,_0x3d9ddf){_0x1a8b4c[_0x700cfc](util[_0xa363('0x1a')](_0xa363('0x1b'),_0x2e70b3,_0x3d9ddf['name']));if(_0x3d9ddf[_0xa363('0x3')]){for(var _0x14064a=0x0;_0x14064a<_0x3d9ddf['Agents'][_0xa363('0x1c')];_0x14064a+=0x1){_0x1a8b4c[_0x700cfc](util['format']('user:%s',_0x3d9ddf[_0xa363('0x3')][_0x14064a]['name']));}}}function joinOrLeave(_0x4c5f75,_0x3939ff,_0x104e43){var _0x4a8e07;if(_0x4c5f75[_0xa363('0x1d')][_0xa363('0x1e')]['id']){db['User'][_0xa363('0x1f')]({'attributes':['id',_0xa363('0x2'),_0xa363('0x4'),_0xa363('0x20')],'where':{'id':_0x4c5f75[_0xa363('0x1d')]['query']['id']},'include':[{'model':db['ChatInteraction'],'as':_0xa363('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0xa363('0x22')],'as':_0xa363('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xa363('0x24')],'as':_0xa363('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xa363('0x26')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xa363('0x27')],'as':_0xa363('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0xa363('0x29')],'as':_0xa363('0x2a'),'attributes':['id'],'raw':!![]}]})[_0xa363('0x19')](function(_0x262078){if(_0x262078){_0x4a8e07=_0x262078;_0x4c5f75[_0x3939ff](util[_0xa363('0x1a')](_0xa363('0x2b'),_0x262078[_0xa363('0x2')]));var _0x37cd37=[];switch(_0x262078['role']){case _0xa363('0x2c'):_0x4c5f75[_0x3939ff](_0xa363('0x2d'));_0x4c5f75[_0x3939ff](_0xa363('0x2e'));if(queryQueues['hasOwnProperty']('include')){delete queryQueues[_0xa363('0x2f')];}_0x37cd37[_0xa363('0x30')](db[_0xa363('0x31')][_0xa363('0x10')](queryQueues));_0x37cd37[_0xa363('0x30')](db[_0xa363('0x32')]['findAll'](queryQueues));_0x37cd37[_0xa363('0x30')](db['FaxQueue'][_0xa363('0x10')](queryQueues));_0x37cd37[_0xa363('0x30')](db['SmsQueue']['findAll'](queryQueues));_0x37cd37[_0xa363('0x30')](db[_0xa363('0x33')][_0xa363('0x10')](queryQueues));_0x37cd37['push'](db[_0xa363('0x34')][_0xa363('0x10')](queryQueues));_0x37cd37[_0xa363('0x30')](db[_0xa363('0x35')][_0xa363('0x10')](queryQueues));_0x37cd37[_0xa363('0x30')](db[_0xa363('0x16')][_0xa363('0x10')](queryTelephones));_0x37cd37[_0xa363('0x30')](db[_0xa363('0x36')]['findAll'](queryTrunks));_0x37cd37[_0xa363('0x30')](db[_0xa363('0x18')][_0xa363('0x10')](queryCampaigns));_0x37cd37['push'](db[_0xa363('0x16')]['findAll'](queryAgents));break;case _0xa363('0x37'):_0x4c5f75[_0x3939ff](_0xa363('0x2d'));_0x4c5f75[_0x3939ff](_0xa363('0x2e'));_0x37cd37[_0xa363('0x30')](getAssociatedResources(_0xa363('0x38'),_0x262078[_0xa363('0x20')],_0xa363('0x31')));_0x37cd37[_0xa363('0x30')](getAssociatedResources(_0xa363('0xc'),_0x262078[_0xa363('0x20')],_0xa363('0x32')));_0x37cd37['push'](getAssociatedResources('FaxQueues',_0x262078[_0xa363('0x20')],'FaxQueue'));_0x37cd37['push'](getAssociatedResources('SmsQueues',_0x262078[_0xa363('0x20')],_0xa363('0x39')));_0x37cd37[_0xa363('0x30')](getAssociatedResources(_0xa363('0xe'),_0x262078[_0xa363('0x20')],_0xa363('0x33')));_0x37cd37[_0xa363('0x30')](getAssociatedResources(_0xa363('0x3a'),_0x262078[_0xa363('0x20')],_0xa363('0x34')));_0x37cd37[_0xa363('0x30')](getAssociatedResources(_0xa363('0xf'),_0x262078[_0xa363('0x20')],_0xa363('0x35')));_0x37cd37['push'](getAssociatedResources(_0xa363('0x11'),_0x262078[_0xa363('0x20')],'User'));_0x37cd37[_0xa363('0x30')](getAssociatedResources(_0xa363('0x12'),_0x262078['userProfileId'],_0xa363('0x36')));_0x37cd37[_0xa363('0x30')](getAssociatedResources(_0xa363('0x3b'),_0x262078[_0xa363('0x20')],_0xa363('0x18')));_0x37cd37[_0xa363('0x30')](db[_0xa363('0x16')][_0xa363('0x10')](queryAgents));break;case'agent':_0x4c5f75[_0x3939ff](_0xa363('0x2d'));_0x4c5f75[_0x3939ff](_0xa363('0x2e'));_0x37cd37['push'](_0x262078[_0xa363('0x3c')]({'attributes':['id',_0xa363('0x2')]}));_0x37cd37[_0xa363('0x30')](_0x262078[_0xa363('0x3d')]({'attributes':['id',_0xa363('0x2')]}));_0x37cd37['push'](_0x262078[_0xa363('0x3e')]({'attributes':['id',_0xa363('0x2')]}));_0x37cd37[_0xa363('0x30')](_0x262078['getSmsQueues']({'attributes':['id',_0xa363('0x2')]}));_0x37cd37[_0xa363('0x30')](_0x262078[_0xa363('0x3f')]({'attributes':['id','name']}));_0x37cd37[_0xa363('0x30')](_0x262078[_0xa363('0x40')]({'attributes':['id',_0xa363('0x2')]}));_0x37cd37[_0xa363('0x30')](_0x262078[_0xa363('0x41')]({'attributes':['id',_0xa363('0x2')]}));break;}return BPromise[_0xa363('0x42')](_0x37cd37);}})[_0xa363('0x19')](function(_0x34ead2){if(_0x34ead2&&_0x34ead2['length']){for(var _0x291d6d=0x0;_0x291d6d<_0x34ead2[_0xa363('0x1c')];_0x291d6d+=0x1){for(var _0x5b6df9=0x0;_0x5b6df9<_0x34ead2[_0x291d6d][_0xa363('0x1c')];_0x5b6df9+=0x1){switch(_0x291d6d){case 0x0:joinOrLeaveQueues(_0x4c5f75,_0x3939ff,'voice',_0x34ead2[_0x291d6d][_0x5b6df9]);break;case 0x1:joinOrLeaveQueues(_0x4c5f75,_0x3939ff,_0xa363('0x43'),_0x34ead2[_0x291d6d][_0x5b6df9]);break;case 0x2:joinOrLeaveQueues(_0x4c5f75,_0x3939ff,'fax',_0x34ead2[_0x291d6d][_0x5b6df9]);break;case 0x3:joinOrLeaveQueues(_0x4c5f75,_0x3939ff,_0xa363('0x44'),_0x34ead2[_0x291d6d][_0x5b6df9]);break;case 0x4:joinOrLeaveQueues(_0x4c5f75,_0x3939ff,_0xa363('0x45'),_0x34ead2[_0x291d6d][_0x5b6df9]);break;case 0x5:joinOrLeaveQueues(_0x4c5f75,_0x3939ff,_0xa363('0x46'),_0x34ead2[_0x291d6d][_0x5b6df9]);break;case 0x6:joinOrLeaveQueues(_0x4c5f75,_0x3939ff,_0xa363('0x47'),_0x34ead2[_0x291d6d][_0x5b6df9]);break;case 0x7:if(_0x4a8e07[_0xa363('0x4')]!=='agent')_0x4c5f75[_0x3939ff](util[_0xa363('0x1a')](_0xa363('0x48'),_0x34ead2[_0x291d6d][_0x5b6df9]['name']));break;case 0x8:if(_0x4a8e07[_0xa363('0x4')]!==_0xa363('0x5'))_0x4c5f75[_0x3939ff](util['format'](_0xa363('0x49'),_0x34ead2[_0x291d6d][_0x5b6df9][_0xa363('0x2')]));break;case 0x9:if(_0x4a8e07[_0xa363('0x4')]!==_0xa363('0x5'))_0x4c5f75[_0x3939ff](util[_0xa363('0x1a')]('campaign:%s:%s',_0x34ead2[_0x291d6d][_0x5b6df9][_0xa363('0x7')],_0x34ead2[_0x291d6d][_0x5b6df9][_0xa363('0x2')]));break;case 0xa:_0x4c5f75[_0x3939ff](util['format'](_0xa363('0x2b'),_0x34ead2[_0x291d6d][_0x5b6df9][_0xa363('0x2')]));break;}}}}})['then'](function(){if(_0x3939ff==='leave'){var _0x30c4d6=_[_0xa363('0x15')](_0x4a8e07[_0xa363('0x21')],'id');return _0x4a8e07[_0xa363('0x4a')](_0x30c4d6)[_0xa363('0x19')](function(){for(var _0x5c210b=0x0;_0x5c210b<_0x30c4d6[_0xa363('0x1c')];_0x5c210b+=0x1){_0x104e43[_0xa363('0x4b')](_0xa363('0x4c'),{'ChatInteractionId':Number(_0x30c4d6[_0x5c210b]),'UserId':Number(_0x4a8e07['id'])});}});}})['then'](function(){if(_0x3939ff===_0xa363('0x4d')){var _0x556f49=_[_0xa363('0x15')](_0x4a8e07['MailInteractions'],'id');return _0x4a8e07['removeMailInteractions'](_0x556f49)['then'](function(){for(var _0x364574=0x0;_0x364574<_0x556f49['length'];_0x364574+=0x1){_0x104e43[_0xa363('0x4b')](_0xa363('0x4e'),{'MailInteractionId':Number(_0x556f49[_0x364574]),'UserId':Number(_0x4a8e07['id'])});}});}})['then'](function(){if(_0x3939ff===_0xa363('0x4d')){var _0x2b7660=_['map'](_0x4a8e07[_0xa363('0x25')],'id');return _0x4a8e07[_0xa363('0x4f')](_0x2b7660)[_0xa363('0x19')](function(){for(var _0x30ee24=0x0;_0x30ee24<_0x2b7660[_0xa363('0x1c')];_0x30ee24+=0x1){_0x104e43[_0xa363('0x4b')](_0xa363('0x50'),{'FaxInteractionId':Number(_0x2b7660[_0x30ee24]),'UserId':Number(_0x4a8e07['id'])});}});}})[_0xa363('0x19')](function(){if(_0x3939ff===_0xa363('0x4d')){var _0x34c686=_[_0xa363('0x15')](_0x4a8e07[_0xa363('0x51')],'id');return _0x4a8e07[_0xa363('0x52')](_0x34c686)[_0xa363('0x19')](function(){for(var _0xabef3f=0x0;_0xabef3f<_0x34c686[_0xa363('0x1c')];_0xabef3f+=0x1){_0x104e43[_0xa363('0x4b')](_0xa363('0x53'),{'SmsInteractionId':Number(_0x34c686[_0xabef3f]),'UserId':Number(_0x4a8e07['id'])});}});}})[_0xa363('0x19')](function(){if(_0x3939ff===_0xa363('0x4d')){var _0x2b3fce=_[_0xa363('0x15')](_0x4a8e07[_0xa363('0x28')],'id');return _0x4a8e07['removeOpenchannelInteractions'](_0x2b3fce)['then'](function(){for(var _0xb4fc74=0x0;_0xb4fc74<_0x2b3fce[_0xa363('0x1c')];_0xb4fc74+=0x1){_0x104e43[_0xa363('0x4b')](_0xa363('0x54'),{'OpenchannelInteractionId':Number(_0x2b3fce[_0xb4fc74]),'UserId':Number(_0x4a8e07['id'])});}});}})['then'](function(){if(_0x3939ff===_0xa363('0x4d')){var _0x3261e8=_[_0xa363('0x15')](_0x4a8e07['WhatsappInteractions'],'id');return _0x4a8e07[_0xa363('0x55')](_0x3261e8)[_0xa363('0x19')](function(){for(var _0x4560b0=0x0;_0x4560b0<_0x3261e8[_0xa363('0x1c')];_0x4560b0+=0x1){_0x104e43['emit'](_0xa363('0x56'),{'WhatsappInteractionId':Number(_0x3261e8[_0x4560b0]),'UserId':Number(_0x4a8e07['id'])});}});}})[_0xa363('0x57')](function(_0x29d36e){_0x4c5f75[_0xa363('0x58')](_0x29d36e);});}}function onDisconnect(_0x24884a,_0x5da184){joinOrLeave(_0x24884a,'leave',_0x5da184);}function onConnect(_0x5decba){joinOrLeave(_0x5decba,_0xa363('0x59'));}exports[_0xa363('0x5a')]=function(_0x337a01){_0x337a01['on'](_0xa363('0x5b'),function(_0x26698e){_0x26698e['setMaxListeners'](0x0);_0x26698e[_0xa363('0x5c')]=_0x26698e['request'][_0xa363('0x5b')][_0xa363('0x5d')]+':'+_0x26698e[_0xa363('0x5e')][_0xa363('0x5b')]['remotePort'];_0x26698e['connectedAt']=new Date();_0x26698e[_0xa363('0x58')]=function(_0x45c676){console[_0xa363('0x58')](_0xa363('0x5f')+_0x26698e['nsp'][_0xa363('0x2')]+'['+_0x26698e[_0xa363('0x5c')]+']',_0x45c676);};_0x26698e['on'](_0xa363('0x60'),function(){onDisconnect(_0x26698e,_0x337a01);_0x26698e[_0xa363('0x58')](_0xa363('0x61'));});onConnect(_0x26698e);_0x26698e[_0xa363('0x58')](_0xa363('0x62'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 4f19257..19aafc8 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 _0xddf3=['WhatsappInteraction','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','OpenchannelInteraction','Openchannel','request','EventManager','then','Trigger,\x20%s','error','code','catch','get','channel','direction','resolve','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','QueryTypes','SELECT','UserId','interface','format','SIP/%s','name','incomingmessage','AfterCreateMessage','motionChannel','event','offlineMessage','opened','agent','AfterCreate','changed','closed','substatus','contact','User','find','fullname','internal','default','length','model','hook','callback','toLowerCase','util','jayson/promise','../logger','triggers','client','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','closedinteraction','ChatMessage','ChatOfflineMessage','newmessage','Sms','SmsInteraction','SmsMessage','Whatsapp'];(function(_0x1020ac,_0x20b0d7){var _0xc3d817=function(_0x3150d5){while(--_0x3150d5){_0x1020ac['push'](_0x1020ac['shift']());}};_0xc3d817(++_0x20b0d7);}(_0xddf3,0x10e));var _0x3ddf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xddf3[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x3ddf('0x0'));var db=require('../../mysqldb')['db'];var jayson=require(_0x3ddf('0x1'));var logger=require(_0x3ddf('0x2'))(_0x3ddf('0x3'));var client=jayson[_0x3ddf('0x4')]['http']({'port':0x232a});var triggers=[{'channel':_0x3ddf('0x5'),'model':_0x3ddf('0x6'),'event':_0x3ddf('0x7'),'condition':_0x3ddf('0x8'),'callback':afterCreate},{'channel':'Chat','model':_0x3ddf('0x6'),'event':_0x3ddf('0x9'),'condition':_0x3ddf('0xa'),'callback':afterUpdate},{'channel':'Chat','model':_0x3ddf('0xb'),'event':_0x3ddf('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x3ddf('0x5'),'model':_0x3ddf('0xc'),'event':'afterCreate','condition':_0x3ddf('0xd'),'callback':afterCreateOfflineMessage},{'channel':_0x3ddf('0xe'),'model':_0x3ddf('0xf'),'event':_0x3ddf('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x3ddf('0xe'),'model':_0x3ddf('0xf'),'event':_0x3ddf('0x9'),'condition':_0x3ddf('0xa'),'callback':afterUpdate},{'channel':_0x3ddf('0xe'),'model':_0x3ddf('0x10'),'event':_0x3ddf('0x7'),'condition':_0x3ddf('0xd'),'callback':afterCreateMessage},{'channel':_0x3ddf('0x11'),'model':_0x3ddf('0x12'),'event':_0x3ddf('0x7'),'condition':_0x3ddf('0x8'),'callback':afterCreate},{'channel':_0x3ddf('0x11'),'model':'WhatsappInteraction','event':_0x3ddf('0x9'),'condition':_0x3ddf('0xa'),'callback':afterUpdate},{'channel':_0x3ddf('0x11'),'model':'WhatsappMessage','event':_0x3ddf('0x7'),'condition':_0x3ddf('0xd'),'callback':afterCreateMessage},{'channel':_0x3ddf('0x13'),'model':_0x3ddf('0x14'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0x3ddf('0x13'),'model':_0x3ddf('0x14'),'event':'afterUpdate','condition':_0x3ddf('0xa'),'callback':afterUpdate},{'channel':_0x3ddf('0x13'),'model':_0x3ddf('0x15'),'event':_0x3ddf('0x7'),'condition':_0x3ddf('0xd'),'callback':afterCreateMessage},{'channel':_0x3ddf('0x16'),'model':'MailInteraction','event':_0x3ddf('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x3ddf('0x16'),'model':_0x3ddf('0x17'),'event':_0x3ddf('0x9'),'condition':_0x3ddf('0xa'),'callback':afterUpdate},{'channel':_0x3ddf('0x16'),'model':'MailMessage','event':_0x3ddf('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Openchannel','model':_0x3ddf('0x18'),'event':'afterCreate','condition':_0x3ddf('0x8'),'callback':afterCreate},{'channel':_0x3ddf('0x19'),'model':_0x3ddf('0x18'),'event':_0x3ddf('0x9'),'condition':_0x3ddf('0xa'),'callback':afterUpdate},{'channel':_0x3ddf('0x19'),'model':'OpenchannelMessage','event':_0x3ddf('0x7'),'condition':'newmessage','callback':afterCreateMessage}];function request(_0x2a35e8){return client[_0x3ddf('0x1a')](_0x3ddf('0x1b'),_0x2a35e8)[_0x3ddf('0x1c')](function(_0x1d7934){logger['info'](_0x3ddf('0x1d'),'EventManager',_0x1d7934);if(_0x1d7934[_0x3ddf('0x1e')]){if(_0x1d7934[_0x3ddf('0x1e')][_0x3ddf('0x1f')]===0x1f4){logger[_0x3ddf('0x1e')](_0x3ddf('0x1d'),_0x3ddf('0x1b'),_0x1d7934[_0x3ddf('0x1e')]);}}})[_0x3ddf('0x20')](function(_0x114752){logger[_0x3ddf('0x1e')](_0x3ddf('0x1d'),'EventManager',_0x114752);});}function afterCreateMessage(_0x1a700e){return function(_0x391aab){_0x391aab=_0x391aab[_0x3ddf('0x21')]({'plain':!![]});_0x391aab[_0x3ddf('0x22')]=_0x1a700e;_0x391aab['motionChannel']=_0x1a700e;_0x391aab['event']=_0x391aab[_0x3ddf('0x23')];Promise[_0x3ddf('0x24')]()[_0x3ddf('0x1c')](function(){if(typeof _0x391aab[_0x3ddf('0x25')]===_0x3ddf('0x26'))return null;var _0x13632a=_0x3ddf('0x27')+_0x391aab['ContactId'];return db[_0x3ddf('0x28')][_0x3ddf('0x29')](_0x13632a,{'type':db[_0x3ddf('0x2a')][_0x3ddf('0x2b')][_0x3ddf('0x2c')],'raw':!![]});})['then'](function(_0xb24ab7){if(_0xb24ab7){_0x391aab['contact']=_0xb24ab7[0x0];}if(typeof _0x391aab[_0x3ddf('0x2d')]===_0x3ddf('0x26'))return;return getAgent(_0x391aab[_0x3ddf('0x2d')]);})['then'](function(_0x5aa770){if(_0x5aa770){_0x391aab[_0x3ddf('0x2e')]=util[_0x3ddf('0x2f')](_0x3ddf('0x30'),_0x5aa770[_0x3ddf('0x31')]);_0x391aab['agent']=_0x5aa770;_0x391aab[_0x3ddf('0x22')]=_0x1a700e;return request({'event':_0x3ddf('0x32'),'message':_0x391aab});}else{return request({'event':'outgoingmessage','message':_0x391aab});}})[_0x3ddf('0x20')](function(_0x3bb32d){logger[_0x3ddf('0x1e')]('Trigger,\x20%s',_0x3ddf('0x33'),_0x3bb32d);});};}function afterCreateOfflineMessage(_0x53f478){return function(_0x5a67a8){_0x5a67a8=_0x5a67a8['get']({'plain':!![]});_0x5a67a8[_0x3ddf('0x22')]=_0x53f478;_0x5a67a8[_0x3ddf('0x34')]=_0x53f478;_0x5a67a8[_0x3ddf('0x35')]=_0x3ddf('0x36');return request({'event':_0x5a67a8[_0x3ddf('0x35')],'message':_0x5a67a8});};}function afterCreate(_0x127702,_0x400d76){return function(_0x302aa4){_0x302aa4=_0x302aa4[_0x3ddf('0x21')]({'plain':!![]});_0x302aa4[_0x3ddf('0x22')]=_0x127702;_0x302aa4[_0x3ddf('0x34')]=_0x127702;_0x302aa4[_0x3ddf('0x35')]=_0x3ddf('0x37');Promise[_0x3ddf('0x24')]()[_0x3ddf('0x1c')](function(){var _0x2036a2=_0x3ddf('0x27')+_0x302aa4[_0x3ddf('0x25')];return db[_0x3ddf('0x28')][_0x3ddf('0x29')](_0x2036a2,{'type':db[_0x3ddf('0x2a')][_0x3ddf('0x2b')][_0x3ddf('0x2c')],'raw':!![]});})[_0x3ddf('0x1c')](function(_0x4f2e27){if(_0x4f2e27){_0x302aa4['contact']=_0x4f2e27[0x0];}if(typeof _0x302aa4[_0x3ddf('0x2d')]===_0x3ddf('0x26'))return;return getAgent(_0x302aa4[_0x3ddf('0x2d')]);})['then'](function(_0x263955){if(_0x263955){_0x302aa4['interface']=util['format'](_0x3ddf('0x30'),_0x263955['name']);_0x302aa4[_0x3ddf('0x38')]=_0x263955;}return request({'event':_0x400d76,'message':_0x302aa4});})[_0x3ddf('0x20')](function(_0x2c4cd6){logger[_0x3ddf('0x1e')](_0x3ddf('0x1d'),_0x3ddf('0x39'),_0x2c4cd6);});};}function afterUpdate(_0x1cbfc0){return function(_0x365a71){var _0x1fe34a=_0x365a71[_0x3ddf('0x3a')]('closed')&&_0x365a71[_0x3ddf('0x3b')];var _0x3bb134=_0x365a71[_0x3ddf('0x3a')]('substatus');if(_0x1fe34a||_0x3bb134){var _0x440182=_0x1fe34a?_0x3ddf('0xa'):_0x3ddf('0x3c');var _0x4fa585=_0x365a71['get']({'plain':!![]});_0x4fa585[_0x3ddf('0x22')]=_0x1cbfc0;_0x4fa585[_0x3ddf('0x34')]=_0x1cbfc0;_0x4fa585[_0x3ddf('0x35')]=_0x1fe34a?'closed':'substatus';var _0x36172d=_0x3ddf('0x27')+_0x4fa585[_0x3ddf('0x25')];return db[_0x3ddf('0x28')][_0x3ddf('0x29')](_0x36172d,{'type':db[_0x3ddf('0x2a')][_0x3ddf('0x2b')][_0x3ddf('0x2c')],'raw':!![]})['then'](function(_0x51eb43){if(_0x51eb43){_0x4fa585[_0x3ddf('0x3d')]=_0x51eb43[0x0];}if(typeof _0x4fa585[_0x3ddf('0x2d')]==='undefined')return;return getAgent(_0x4fa585[_0x3ddf('0x2d')]);})[_0x3ddf('0x1c')](function(_0x5cb598){if(_0x5cb598){_0x4fa585[_0x3ddf('0x2e')]=util[_0x3ddf('0x2f')](_0x3ddf('0x30'),_0x5cb598['name']);_0x4fa585['agent']=_0x5cb598;}return request({'event':_0x440182,'message':_0x4fa585});})['catch'](function(_0x1bf69b){logger[_0x3ddf('0x1e')]('Trigger,\x20%s','AfterUpdate',_0x1bf69b);});}};}function getAgent(_0x11369e){return db[_0x3ddf('0x3e')][_0x3ddf('0x3f')]({'where':{'id':_0x11369e},'attributes':['id','name',_0x3ddf('0x40'),'email',_0x3ddf('0x41')],'raw':!![]})[_0x3ddf('0x1c')](function(_0x44ead3){return _0x44ead3;});}exports[_0x3ddf('0x42')]=function(){for(var _0x117d9e=0x0;_0x117d9e=_0x5c8812[_0xc034('0x13')]){throw Error(_0xc034('0x14'));}_0x887167(_0x101768);})[_0xc034('0x15')](function(_0x2916f0){_0x1d5d25(_0x2916f0);});});}; \ No newline at end of file +var _0x1749=['count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','../mysqldb','./license/util','voice','chat','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','isUndefined','blockedAt','updateAttributes','getLicense','role','agent'];(function(_0x1cd0c2,_0x4b75fa){var _0x2c4ec4=function(_0x36ffe8){while(--_0x36ffe8){_0x1cd0c2['push'](_0x1cd0c2['shift']());}};_0x2c4ec4(++_0x4b75fa);}(_0x1749,0xec));var _0x9174=function(_0x392917,_0x503dbe){_0x392917=_0x392917-0x0;var _0x5cd3e8=_0x1749[_0x392917];return _0x5cd3e8;};'use strict';var _=require(_0x9174('0x0'));var BPromise=require('bluebird');var db=require(_0x9174('0x1'))['db'];var util=require(_0x9174('0x2'));var channels=[_0x9174('0x3'),'mail',_0x9174('0x4'),'fax','sms',_0x9174('0x5'),_0x9174('0x6')];exports[_0x9174('0x7')]=function(){return channels;};exports[_0x9174('0x8')]=function(_0x1328ec){_0x1328ec=_0x1328ec[_0x9174('0x9')]();return _['includes'](channels,_0x1328ec);};exports['clearBlockUser']=function(_0x4bb976,_0x580475,_0xa2f6,_0x17bfb0){var _0x533a02={'loginAttempts':_0x580475,'blocked':_0xa2f6};if(!_[_0x9174('0xa')](_0x17bfb0)){_0x533a02[_0x9174('0xb')]=_0x17bfb0;}return _0x4bb976[_0x9174('0xc')](_0x533a02);};exports[_0x9174('0xd')]=function(_0x5cf6c1){return new BPromise(function(_0x1fda3d,_0x3dbef5){var _0x314f63=0x0;if(_0x5cf6c1[_0x9174('0xe')]!==_0x9174('0xf')){_0x1fda3d(_0x5cf6c1);}db['User'][_0x9174('0x10')]({'where':{'role':_0x9174('0xf'),'online':!![],'id':{'$ne':_0x5cf6c1['id']}}})[_0x9174('0x11')](function(_0x410eee){_0x314f63=_0x410eee;return util[_0x9174('0xd')]();})[_0x9174('0x11')](function(_0x680c8e){if(_0x680c8e&&_0x680c8e['agents']&&_0x314f63>=_0x680c8e[_0x9174('0x12')]){throw Error(_0x9174('0x13'));}_0x1fda3d(_0x5cf6c1);})[_0x9174('0x14')](function(_0x384c46){_0x3dbef5(_0x384c46);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index efe7770..f37febf 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x750a=['Error','inherits','Bad\x20Request','Forbidden','OutOfInterval','stack','status','exports','../config/logger','message','Internal\x20Server\x20Error','name'];(function(_0x540fad,_0x5874e5){var _0x8508a2=function(_0x541a07){while(--_0x541a07){_0x540fad['push'](_0x540fad['shift']());}};_0x8508a2(++_0x5874e5);}(_0x750a,0x140));var _0xa750=function(_0x47e7b0,_0x49fc0f){_0x47e7b0=_0x47e7b0-0x0;var _0x326ec5=_0x750a[_0x47e7b0];return _0x326ec5;};'use strict';var util=require('util');var logger=require(_0xa750('0x0'))('api');var APIError=function(_0x499583,_0x139fa5){this[_0xa750('0x1')]=_0x499583||_0xa750('0x2');this[_0xa750('0x3')]=_0x139fa5||_0xa750('0x4');util[_0xa750('0x5')](APIError,Error);};var APIBadRequestError=function(_0x562911){this[_0xa750('0x1')]=_0x562911||_0xa750('0x6');this[_0xa750('0x3')]=_0xa750('0x6');util[_0xa750('0x5')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x3d7c43){this['message']=_0x3d7c43||'Entity\x20not\x20found';this[_0xa750('0x3')]='Not\x20Found';util[_0xa750('0x5')](APINotFoundError,APIError);};function getStatusCode(_0x1760f5){switch(_0x1760f5){case'Bad\x20Request':return 0x190;case _0xa750('0x7'),_0xa750('0x8'):return 0x193;case'Not\x20Found':return 0x194;default:return 0x1f4;}}function handleError(_0x5aca9c){return function(_0xcb62ae){logger['error'](_0xcb62ae[_0xa750('0x9')]);var _0x5adaae=getStatusCode(_0xcb62ae['name']);if(_0xcb62ae[_0xa750('0x3')])delete _0xcb62ae[_0xa750('0x3')];return _0x5aca9c[_0xa750('0xa')](_0x5adaae)['send'](_0xcb62ae);};}module[_0xa750('0xb')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0xf4eb=['Bad\x20Request','name','Not\x20Found','Forbidden','OutOfInterval','stack','send','exports','util','message','Error','inherits'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf4eb,0xec));var _0xbf4e=function(_0x9b6277,_0x17cbf7){_0x9b6277=_0x9b6277-0x0;var _0x4aef35=_0xf4eb[_0x9b6277];return _0x4aef35;};'use strict';var util=require(_0xbf4e('0x0'));var logger=require('../config/logger')('api');var APIError=function(_0x479210,_0x5ed5b9){this[_0xbf4e('0x1')]=_0x479210||'Internal\x20Server\x20Error';this['name']=_0x5ed5b9||_0xbf4e('0x2');util[_0xbf4e('0x3')](APIError,Error);};var APIBadRequestError=function(_0x32d1d7){this[_0xbf4e('0x1')]=_0x32d1d7||_0xbf4e('0x4');this[_0xbf4e('0x5')]=_0xbf4e('0x4');util['inherits'](APIBadRequestError,APIError);};var APINotFoundError=function(_0x449d55){this['message']=_0x449d55||'Entity\x20not\x20found';this[_0xbf4e('0x5')]=_0xbf4e('0x6');util[_0xbf4e('0x3')](APINotFoundError,APIError);};function getStatusCode(_0xc86f04){switch(_0xc86f04){case _0xbf4e('0x4'):return 0x190;case _0xbf4e('0x7'),_0xbf4e('0x8'):return 0x193;case'Not\x20Found':return 0x194;default:return 0x1f4;}}function handleError(_0x4d9a07){return function(_0x7dfb74){logger['error'](_0x7dfb74[_0xbf4e('0x9')]);var _0xcf6ba8=getStatusCode(_0x7dfb74['name']);if(_0x7dfb74[_0xbf4e('0x5')])delete _0x7dfb74['name'];return _0x4d9a07['status'](_0xcf6ba8)[_0xbf4e('0xa')](_0x7dfb74);};}module[_0xbf4e('0xb')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 5e82ff8..14ec298 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1646=['json','exports','status','render'];(function(_0x46d97e,_0x67e2e1){var _0xa8a7db=function(_0x220250){while(--_0x220250){_0x46d97e['push'](_0x46d97e['shift']());}};_0xa8a7db(++_0x67e2e1);}(_0x1646,0x1bd));var _0x6164=function(_0x4b6778,_0x505a76){_0x4b6778=_0x4b6778-0x0;var _0x22dbb9=_0x1646[_0x4b6778];return _0x22dbb9;};'use strict';module[_0x6164('0x0')][0x194]=function pageNotFound(_0xbdcfa,_0x2e94df){var _0x19c912='404';var _0xbfcd93=0x194;var _0x4fab20={'status':_0xbfcd93};_0x2e94df[_0x6164('0x1')](_0x4fab20['status']);_0x2e94df[_0x6164('0x2')](_0x19c912,{},function(_0x5c5c88,_0x277308){if(_0x5c5c88){return _0x2e94df[_0x6164('0x1')](_0x4fab20['status'])[_0x6164('0x3')](_0x4fab20);}_0x2e94df['send'](_0x277308);});}; \ No newline at end of file +var _0xc17c=['status','render','send','404'];(function(_0x33f31b,_0x550ae9){var _0x33514e=function(_0x266538){while(--_0x266538){_0x33f31b['push'](_0x33f31b['shift']());}};_0x33514e(++_0x550ae9);}(_0xc17c,0x17f));var _0xcc17=function(_0xf7dad2,_0x1c18a2){_0xf7dad2=_0xf7dad2-0x0;var _0x3d80e3=_0xc17c[_0xf7dad2];return _0x3d80e3;};'use strict';module['exports'][0x194]=function pageNotFound(_0xbb9fbc,_0x1a171c){var _0x21e956=_0xcc17('0x0');var _0x91f6fb=0x194;var _0x5afded={'status':_0x91f6fb};_0x1a171c[_0xcc17('0x1')](_0x5afded[_0xcc17('0x1')]);_0x1a171c[_0xcc17('0x2')](_0x21e956,{},function(_0xaac142,_0x1fcb80){if(_0xaac142){return _0x1a171c[_0xcc17('0x1')](_0x5afded[_0xcc17('0x1')])['json'](_0x5afded);}_0x1a171c[_0xcc17('0x3')](_0x1fcb80);});}; \ No newline at end of file diff --git a/server/files/chat/iframe.ejs b/server/files/chat/iframe.ejs index 220645c..4a72eae 100644 --- a/server/files/chat/iframe.ejs +++ b/server/files/chat/iframe.ejs @@ -259,9 +259,9 @@ <% } -%> break; case "init": <% if (alignment == 'right' || alignment == 'left') { -%> // Bottom, right - div_tab.style.backgroundColor = textColor; + div_tab.style.backgroundColor = divColor; document.getElementById("chat_tab_text").style.color = textColor; - document.getElementById("chat_tab_arrow").style.color = textColor; + document.getElementById("chat_tab_arrow").style.color = divColor; document.getElementById("chat_tab_arrow").style.backgroundColor = textColor; document.getElementById("motion-chat-iframe-tab").style.display = "flex"; <% } -%> break; diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 18b93aa..20d6b34 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1106=['../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Integration','../api/integration/integration.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../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','WhatsappInteraction','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','WhatsappQueue','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','hasOne','VoiceMail','UserId','User','userSetting','cascade','hasMany','VoiceRecording','Extensions','HopperFinals','HopperHistory','OpenchannelInteraction','ChatInteraction','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotification','UserNotifications','UserProfile','Groups','chat_group_has_users','belongsToMany','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_fax_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','SmsQueues','UserWhatsappQueue','CmList','ChatWebsites','user_has_chat_websites','FaxAccount','FaxAccounts','user_has_fax_accounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','user_has_whatsapp_accounts','SpiedAgents','VoiceContext','Sounds','moh_has_sounds','UserVoiceQueueRt','Members','VoiceQueueId','HopperHistories','JscriptySessions','TrunkId','belongsTo','TrunkBackupId','IntervalId','voice_queues_has_cm_lists','Agents','Teams','TeamVoiceQueue','BlackLists','voice_queues_has_cm_blacklists','mailboxuser','mailbox','VoiceCallReport','QueueCalls','uniqueid','AgentReports','Contact','CloudProviderId','MailAccountId','restrict','Imap','Smtp','Dispositions','CannedAnswer','Answers','Messages','Interactions','List','TemplateId','mandatoryDispositionPause','team_has_mail_queues','ContactId','Owner','mail_interaction_has_tags','Tags','Users','MailInteractionId','Interaction','Account','ChatWebsiteId','ChatOfflineMessageId','TagId','ListId','Dashboard','Items','FaxAccountId','Applications','Exntensions','FaxInteractionId','fax_interaction_has_tags','ThroughTags','team_has_fax_queues','SmsAccountId','mandatoryDispositionPauseId','SmsInteractionId','sms_interaction_has_tags','user_has_sms_interactions','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ProactiveActions','ChatApplication','OpenchannelQueueReport','Queue','ChatQueueId','Website','chat_interaction_has_tags','user_has_chat_interactions','ChatInteractionId','AttachmentId','Attachments','team_has_chat_queues','ChatInternalMessage','ChatGroupId','CompanyId','CmContactHasItem','Phones','Hoppers','OpenchannelInteractions','Company','cm_contact_has_tags','AdditionalPhones','CmHopperId','Agent','CampaignId','OwnerId','CmHopperBlack','All','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','Mohs','whatsapp_interaction_has_tags','ItemTypeId','Hopper','CmContactId','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','CustomReportId','Fields','MetricId','Configurations','SalesforceField','Subjects','Descriptions','DescriptionId','Subject','SubjectId','Description','Field','FieldId','VariableId','AccountId','DeskConfiguration','int_desk_configuration_has_tags','ZohoField','ZendeskAccount','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerField','Dynamics365Configuration','FreshsalesConfiguration','JscriptyProject','ProjectId','MailQueues','FaxQueues','HopperBlacks','TrunkBackup','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromUserId','ToUserId','ToAgent','ToMailQueueId','ToMailAccountId','FromChatWebsiteId','FromAccount','FromAgent','ToChatQueueId','ToQueue','ToAccount','FromFaxAccountId','ToFaxQueueId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','FromSmsAccountId','ToSmsAccountId','CustomFields','Queues','userProfileId','UserProfileSections','Resources','WhatsappAccountId','WhatsappInteractionId','WhatsappQueueReport','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','team_has_whatsapp_queues','user','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xC@LL1234','127.0.0.1','name','utf8','sequelizeHistory','xcall','mysql','utf8_general_ci','username','options','database','password','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','VoiceMusicOnHold','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','UserChatQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/userWhatsappQueue/userWhatsappQueue.model','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','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelMessage','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','CmHopper','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmHopperAdditionalPhone','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','VtigerAccount','VtigerConfiguration'];(function(_0x3e4a72,_0xb90e00){var _0x39aec8=function(_0x2c4c78){while(--_0x2c4c78){_0x3e4a72['push'](_0x3e4a72['shift']());}};_0x39aec8(++_0xb90e00);}(_0x1106,0x146));var _0x6110=function(_0x51fd7e,_0x59ed19){_0x51fd7e=_0x51fd7e-0x0;var _0x25956d=_0x1106[_0x51fd7e];return _0x25956d;};'use strict';var config=require(_0x6110('0x0'));var Sequelize=require(_0x6110('0x1'));var _=require(_0x6110('0x2'));var jstz=require(_0x6110('0x3'));var timezone=jstz[_0x6110('0x4')]();config[_0x6110('0x1')]=_[_0x6110('0x5')](config[_0x6110('0x1')],{'database':_0x6110('0x6'),'username':'xcall','password':_0x6110('0x7'),'options':{'host':_0x6110('0x8'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x6110('0x9')](),'define':{'charset':_0x6110('0xa'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_['defaultsDeep'](config[_0x6110('0xb')],{'database':_0x6110('0x6'),'username':_0x6110('0xc'),'password':_0x6110('0x7'),'options':{'host':_0x6110('0x8'),'port':0xcea,'dialect':_0x6110('0xd'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x6110('0x9')](),'define':{'charset':'utf8','collate':_0x6110('0xe')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x6110('0x1')]['database'],config['sequelize'][_0x6110('0xf')],config[_0x6110('0x1')]['password'],config[_0x6110('0x1')][_0x6110('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x6110('0xb')][_0x6110('0x11')],config[_0x6110('0xb')][_0x6110('0xf')],config['sequelizeHistory'][_0x6110('0x12')],config[_0x6110('0xb')][_0x6110('0x10')])};db['User']=db['sequelize'][_0x6110('0x13')]('../api/user/user.model');db[_0x6110('0x14')]=db[_0x6110('0x1')]['import'](_0x6110('0x15'));db['VoiceContext']=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0x16'));db[_0x6110('0x17')]=db['sequelize'][_0x6110('0x13')]('../api/voiceExtension/voiceExtension.model');db[_0x6110('0x18')]=db[_0x6110('0x1')][_0x6110('0x13')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x6110('0x19')]=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0x1a'));db['VoiceRecording']=db[_0x6110('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x6110('0x1b')]=db['sequelize'][_0x6110('0x13')](_0x6110('0x1c'));db['VoiceMail']=db['sequelize'][_0x6110('0x13')](_0x6110('0x1d'));db[_0x6110('0x1e')]=db['sequelize'][_0x6110('0x13')](_0x6110('0x1f'));db['VoiceCallReport']=db['sequelize']['import'](_0x6110('0x20'));db[_0x6110('0x21')]=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0x22'));db[_0x6110('0x23')]=db['sequelize'][_0x6110('0x13')](_0x6110('0x24'));db[_0x6110('0x25')]=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0x26'));db['MemberReport']=db[_0x6110('0x1')]['import'](_0x6110('0x27'));db[_0x6110('0x28')]=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0x29'));db[_0x6110('0x2a')]=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0x2b'));db['UserVoiceQueueRt']=db['sequelize']['import'](_0x6110('0x2c'));db[_0x6110('0x2d')]=db['sequelize']['import']('../api/userVoiceQueue/userVoiceQueue.model');db[_0x6110('0x2e')]=db['sequelize'][_0x6110('0x13')]('../api/userChatQueue/userChatQueue.model');db[_0x6110('0x2f')]=db['sequelize'][_0x6110('0x13')](_0x6110('0x30'));db[_0x6110('0x31')]=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0x32'));db[_0x6110('0x33')]=db[_0x6110('0x1')][_0x6110('0x13')]('../api/userSmsQueue/userSmsQueue.model');db[_0x6110('0x34')]=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0x35'));db['UserWhatsappQueue']=db[_0x6110('0x1')]['import'](_0x6110('0x36'));db[_0x6110('0x37')]=db['sequelize'][_0x6110('0x13')](_0x6110('0x38'));db[_0x6110('0x39')]=db[_0x6110('0x1')][_0x6110('0x13')]('../api/mailServerOut/mailServerOut.model');db[_0x6110('0x3a')]=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0x3b'));db[_0x6110('0x3c')]=db[_0x6110('0x1')]['import'](_0x6110('0x3d'));db[_0x6110('0x3e')]=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0x3f'));db[_0x6110('0x40')]=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0x41'));db[_0x6110('0x42')]=db[_0x6110('0x1')][_0x6110('0x13')]('../api/mailMessage/mailMessage.model');db[_0x6110('0x43')]=db['sequelize']['import'](_0x6110('0x44'));db[_0x6110('0x45')]=db['sequelize'][_0x6110('0x13')](_0x6110('0x46'));db['Dashboard']=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0x47'));db[_0x6110('0x48')]=db['sequelize'][_0x6110('0x13')](_0x6110('0x49'));db['FaxAccount']=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0x4a'));db[_0x6110('0x4b')]=db['sequelize'][_0x6110('0x13')](_0x6110('0x4c'));db[_0x6110('0x4d')]=db[_0x6110('0x1')]['import'](_0x6110('0x4e'));db[_0x6110('0x4f')]=db[_0x6110('0x1')]['import'](_0x6110('0x50'));db[_0x6110('0x51')]=db[_0x6110('0x1')]['import'](_0x6110('0x52'));db[_0x6110('0x53')]=db[_0x6110('0x1')][_0x6110('0x13')]('../api/faxQueueReport/faxQueueReport.model');db[_0x6110('0x54')]=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0x55'));db[_0x6110('0x56')]=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0x57'));db[_0x6110('0x58')]=db['sequelize'][_0x6110('0x13')](_0x6110('0x59'));db[_0x6110('0x5a')]=db[_0x6110('0x1')]['import'](_0x6110('0x5b'));db[_0x6110('0x5c')]=db[_0x6110('0x1')][_0x6110('0x13')]('../api/smsQueue/smsQueue.model');db[_0x6110('0x5d')]=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0x5e'));db[_0x6110('0x5f')]=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0x60'));db['OpenchannelInteraction']=db[_0x6110('0x1')]['import']('../api/openchannelInteraction/openchannelInteraction.model');db[_0x6110('0x61')]=db[_0x6110('0x1')][_0x6110('0x13')]('../api/openchannelMessage/openchannelMessage.model');db[_0x6110('0x62')]=db[_0x6110('0x1')]['import'](_0x6110('0x63'));db[_0x6110('0x64')]=db[_0x6110('0x1')]['import'](_0x6110('0x65'));db['OpenchannelQueueReport']=db[_0x6110('0x1')]['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db['ChatApplication']=db[_0x6110('0x1')][_0x6110('0x13')]('../api/chatApplication/chatApplication.model');db['ChatInteraction']=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0x66'));db[_0x6110('0x67')]=db[_0x6110('0x1')]['import'](_0x6110('0x68'));db[_0x6110('0x69')]=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0x6a'));db[_0x6110('0x6b')]=db['sequelize'][_0x6110('0x13')](_0x6110('0x6c'));db[_0x6110('0x6d')]=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0x6e'));db[_0x6110('0x6f')]=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0x70'));db[_0x6110('0x71')]=db[_0x6110('0x1')]['import'](_0x6110('0x72'));db[_0x6110('0x73')]=db[_0x6110('0x1')][_0x6110('0x13')]('../api/cmContact/cmContact.model');db[_0x6110('0x74')]=db[_0x6110('0x1')]['import']('../api/cmHopper/cmHopper.model');db['CmHopperBlack']=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0x75'));db[_0x6110('0x76')]=db[_0x6110('0x1')][_0x6110('0x13')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0x6110('0x77')]=db['sequelize'][_0x6110('0x13')](_0x6110('0x78'));db[_0x6110('0x79')]=db['sequelize']['import'](_0x6110('0x7a'));db[_0x6110('0x7b')]=db['sequelize'][_0x6110('0x13')](_0x6110('0x7c'));db[_0x6110('0x7d')]=db[_0x6110('0x1')]['import'](_0x6110('0x7e'));db[_0x6110('0x7f')]=db[_0x6110('0x1')]['import'](_0x6110('0x80'));db['CannedAnswer']=db['sequelize'][_0x6110('0x13')](_0x6110('0x81'));db[_0x6110('0x82')]=db[_0x6110('0x1')]['import'](_0x6110('0x83'));db[_0x6110('0x84')]=db[_0x6110('0x1')][_0x6110('0x13')]('../api/condition/condition.model');db[_0x6110('0x85')]=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0x86'));db[_0x6110('0x87')]=db[_0x6110('0x1')]['import'](_0x6110('0x88'));db[_0x6110('0x89')]=db['sequelize'][_0x6110('0x13')](_0x6110('0x8a'));db[_0x6110('0x8b')]=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0x8c'));db[_0x6110('0x8d')]=db[_0x6110('0x1')][_0x6110('0x13')]('../api/schedule/schedule.model');db[_0x6110('0x8e')]=db[_0x6110('0x1')]['import'](_0x6110('0x8f'));db[_0x6110('0x90')]=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0x91'));db[_0x6110('0x92')]=db['sequelize'][_0x6110('0x13')](_0x6110('0x93'));db['CmContactHasItem']=db['sequelize']['import']('../api/cmContactHasItem/cmContactHasItem.model');db[_0x6110('0x94')]=db[_0x6110('0x1')][_0x6110('0x13')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x6110('0x95')]=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0x96'));db[_0x6110('0x97')]=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0x98'));db[_0x6110('0x99')]=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0x9a'));db['Integration']=db[_0x6110('0x1')][_0x6110('0x13')]('../api/integration/integration.model');db[_0x6110('0x9b')]=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0x9c'));db[_0x6110('0x9d')]=db['sequelize'][_0x6110('0x13')](_0x6110('0x9e'));db[_0x6110('0x9f')]=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0xa0'));db['AnalyticExtractedReport']=db[_0x6110('0x1')]['import'](_0x6110('0xa1'));db[_0x6110('0xa2')]=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0xa3'));db[_0x6110('0xa4')]=db['sequelize'][_0x6110('0x13')](_0x6110('0xa5'));db[_0x6110('0xa6')]=db['sequelize'][_0x6110('0x13')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0x6110('0xa7')]=db['sequelize'][_0x6110('0x13')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0x6110('0xa8')]=db['sequelize'][_0x6110('0x13')](_0x6110('0xa9'));db['SalesforceField']=db[_0x6110('0x1')]['import'](_0x6110('0xaa'));db[_0x6110('0xab')]=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0xac'));db[_0x6110('0xad')]=db['sequelize'][_0x6110('0x13')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x6110('0xae')]=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0xaf'));db[_0x6110('0xb0')]=db[_0x6110('0x1')]['import'](_0x6110('0xb1'));db['DeskConfiguration']=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0xb2'));db[_0x6110('0xb3')]=db[_0x6110('0x1')]['import'](_0x6110('0xb4'));db[_0x6110('0xb5')]=db['sequelize'][_0x6110('0x13')](_0x6110('0xb6'));db[_0x6110('0xb7')]=db[_0x6110('0x1')]['import'](_0x6110('0xb8'));db['ZohoField']=db[_0x6110('0x1')]['import'](_0x6110('0xb9'));db['ZendeskAccount']=db[_0x6110('0x1')][_0x6110('0x13')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0x6110('0xba')]=db['sequelize']['import'](_0x6110('0xbb'));db[_0x6110('0xbc')]=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0xbd'));db[_0x6110('0xbe')]=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0xbf'));db[_0x6110('0xc0')]=db['sequelize'][_0x6110('0x13')](_0x6110('0xc1'));db[_0x6110('0xc2')]=db['sequelize']['import']('../api/intFreshdeskField/intFreshdeskField.model');db[_0x6110('0xc3')]=db[_0x6110('0x1')][_0x6110('0x13')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0x6110('0xc4')]=db['sequelize'][_0x6110('0x13')](_0x6110('0xc5'));db['VtigerField']=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0xc6'));db[_0x6110('0xc7')]=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0xc8'));db[_0x6110('0xc9')]=db['sequelize']['import'](_0x6110('0xca'));db[_0x6110('0xcb')]=db['sequelize'][_0x6110('0x13')](_0x6110('0xcc'));db[_0x6110('0xcd')]=db[_0x6110('0x1')][_0x6110('0x13')]('../api/intDynamics365Account/intDynamics365Account.model');db['Dynamics365Configuration']=db[_0x6110('0x1')]['import'](_0x6110('0xce'));db[_0x6110('0xcf')]=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0xd0'));db[_0x6110('0xd1')]=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0xd2'));db['FreshsalesConfiguration']=db[_0x6110('0x1')]['import'](_0x6110('0xd3'));db[_0x6110('0xd4')]=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0xd5'));db[_0x6110('0xd6')]=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0xd7'));db[_0x6110('0xd8')]=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0xd9'));db[_0x6110('0xda')]=db['sequelize'][_0x6110('0x13')](_0x6110('0xdb'));db['ChatInternalMessage']=db[_0x6110('0x1')]['import'](_0x6110('0xdc'));db[_0x6110('0xdd')]=db[_0x6110('0x1')]['import'](_0x6110('0xde'));db[_0x6110('0xdf')]=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0xe0'));db[_0x6110('0xe1')]=db[_0x6110('0x1')]['import'](_0x6110('0xe2'));db[_0x6110('0xe3')]=db[_0x6110('0x1')]['import'](_0x6110('0xe4'));db['SquareReport']=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0xe5'));db[_0x6110('0xe6')]=db[_0x6110('0x1')]['import'](_0x6110('0xe7'));db['JscriptyProject']=db['sequelize'][_0x6110('0x13')](_0x6110('0xe8'));db[_0x6110('0xe9')]=db[_0x6110('0x1')][_0x6110('0x13')]('../api/setting/setting.model');db['SquareOdbc']=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0xea'));db[_0x6110('0xeb')]=db['sequelize'][_0x6110('0x13')](_0x6110('0xec'));db[_0x6110('0xed')]=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0xee'));db[_0x6110('0xef')]=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0xf0'));db[_0x6110('0xf1')]=db['sequelize'][_0x6110('0x13')]('../api/team/team.model');db['License']=db['sequelize']['import'](_0x6110('0xf2'));db[_0x6110('0xf3')]=db['sequelize'][_0x6110('0x13')](_0x6110('0xf4'));db[_0x6110('0xf5')]=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0xf6'));db[_0x6110('0xf7')]=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0xf8'));db['Plugin']=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0xf9'));db[_0x6110('0xfa')]=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0xfb'));db[_0x6110('0xfc')]=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0xfd'));db[_0x6110('0xfe')]=db[_0x6110('0x1')]['import'](_0x6110('0xff'));db['OpenchannelTransferReport']=db['sequelize'][_0x6110('0x13')](_0x6110('0x100'));db[_0x6110('0x101')]=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0x102'));db['CmList']=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0x103'));db[_0x6110('0x104')]=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0x105'));db['UserProfile']=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0x106'));db[_0x6110('0x107')]=db['sequelize'][_0x6110('0x13')](_0x6110('0x108'));db[_0x6110('0x109')]=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0x10a'));db['UserNotification']=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0x10b'));db[_0x6110('0x10c')]=db[_0x6110('0x1')]['import'](_0x6110('0x10d'));db[_0x6110('0x10e')]=db[_0x6110('0x1')]['import'](_0x6110('0x10f'));db[_0x6110('0x110')]=db[_0x6110('0x1')][_0x6110('0x13')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0x6110('0x111')]=db['sequelize'][_0x6110('0x13')](_0x6110('0x112'));db['WhatsappQueueReport']=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0x113'));db[_0x6110('0x114')]=db[_0x6110('0x1')]['import']('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0x6110('0x115')]=db[_0x6110('0x1')][_0x6110('0x13')]('../api/whatsappQueue/whatsappQueue.model');db[_0x6110('0x116')]=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0x117'));db['TeamVoiceQueue']=db['sequelize'][_0x6110('0x13')]('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0x6110('0x118')]=db['sequelize'][_0x6110('0x13')](_0x6110('0x119'));db[_0x6110('0x11a')]=db[_0x6110('0x1')][_0x6110('0x13')](_0x6110('0x11b'));db[_0x6110('0x11c')]=db['sequelize']['import'](_0x6110('0x11d'));db['User'][_0x6110('0x11e')](db[_0x6110('0x11f')],{'as':_0x6110('0x11f'),'onDelete':'cascade','foreignKey':_0x6110('0x120')});db[_0x6110('0x121')][_0x6110('0x11e')](db[_0x6110('0x11c')],{'as':_0x6110('0x122'),'onDelete':_0x6110('0x123'),'foreignKey':'UserId'});db[_0x6110('0x121')][_0x6110('0x124')](db[_0x6110('0x125')],{'as':'Recordings','foreignKey':_0x6110('0x120')});db[_0x6110('0x121')][_0x6110('0x124')](db['UserVoiceQueueRt'],{'as':'VoiceQueuesRt','foreignKey':_0x6110('0x120')});db['User'][_0x6110('0x124')](db['VoiceExtension'],{'as':_0x6110('0x126'),'onDelete':'cascade','hooks':!![]});db[_0x6110('0x121')]['hasMany'](db[_0x6110('0x76')],{'as':_0x6110('0x127'),'foreignKey':_0x6110('0x120')});db['User'][_0x6110('0x124')](db['CmHopperHistory'],{'as':_0x6110('0x128'),'foreignKey':'UserId'});db['User'][_0x6110('0x124')](db[_0x6110('0x79')],{'as':_0x6110('0x79'),'foreignKey':_0x6110('0x120')});db[_0x6110('0x121')]['hasMany'](db[_0x6110('0x129')],{'as':'OpenchannelInteractions','foreignKey':_0x6110('0x120')});db[_0x6110('0x121')]['hasMany'](db[_0x6110('0x12a')],{'as':_0x6110('0x12b'),'foreignKey':_0x6110('0x120')});db[_0x6110('0x121')][_0x6110('0x124')](db[_0x6110('0x58')],{'as':_0x6110('0x12c'),'foreignKey':_0x6110('0x120')});db[_0x6110('0x121')][_0x6110('0x124')](db[_0x6110('0x4d')],{'as':_0x6110('0x12d'),'foreignKey':_0x6110('0x120')});db[_0x6110('0x121')][_0x6110('0x124')](db[_0x6110('0x40')],{'as':_0x6110('0x12e'),'foreignKey':'UserId'});db[_0x6110('0x121')][_0x6110('0x124')](db[_0x6110('0x110')],{'as':_0x6110('0x12f'),'foreignKey':_0x6110('0x120')});db[_0x6110('0x121')][_0x6110('0x124')](db[_0x6110('0x130')],{'as':_0x6110('0x131'),'foreignKey':'SenderId'});db[_0x6110('0x121')]['belongsTo'](db['UserProfile'],{'as':_0x6110('0x132'),'foreignKey':'userProfileId'});db['User']['belongsToMany'](db['ChatGroup'],{'as':_0x6110('0x133'),'through':_0x6110('0x134')});db[_0x6110('0x121')][_0x6110('0x135')](db[_0x6110('0x73')],{'as':_0x6110('0x136'),'through':_0x6110('0x137')});db['User'][_0x6110('0x135')](db['CmList'],{'as':_0x6110('0x138'),'through':_0x6110('0x139')});db[_0x6110('0x121')][_0x6110('0x135')](db['Team'],{'through':_0x6110('0x13a')});db[_0x6110('0x121')][_0x6110('0x135')](db['MailInteraction'],{'as':_0x6110('0x12e'),'through':_0x6110('0x13b')});db[_0x6110('0x121')][_0x6110('0x135')](db[_0x6110('0x12a')],{'as':'ChatInteractions','through':'user_has_chat_interactions'});db['User'][_0x6110('0x135')](db['FaxInteraction'],{'as':_0x6110('0x12d'),'through':_0x6110('0x13c')});db[_0x6110('0x121')][_0x6110('0x135')](db[_0x6110('0x58')],{'as':'SmsInteractions','through':'user_has_sms_interactions'});db[_0x6110('0x121')]['belongsToMany'](db[_0x6110('0x129')],{'as':'OpenchannelInteractions','through':_0x6110('0x13d')});db[_0x6110('0x121')][_0x6110('0x135')](db[_0x6110('0x110')],{'as':'WhatsappInteractions','through':_0x6110('0x13e')});db['User'][_0x6110('0x135')](db[_0x6110('0x19')],{'as':_0x6110('0x13f'),'through':_0x6110('0x2d'),'required':![]});db[_0x6110('0x121')][_0x6110('0x135')](db[_0x6110('0x104')],{'as':_0x6110('0x140'),'through':'UserVoicePrefix','required':![]});db[_0x6110('0x121')][_0x6110('0x135')](db['MailQueue'],{'as':'MailQueues','through':_0x6110('0x2f'),'required':![]});db[_0x6110('0x121')]['belongsToMany'](db[_0x6110('0x6b')],{'as':_0x6110('0x141'),'through':_0x6110('0x2e'),'required':![],'hooks':!![]});db[_0x6110('0x121')][_0x6110('0x135')](db[_0x6110('0x51')],{'as':'FaxQueues','through':'UserFaxQueue','required':![]});db[_0x6110('0x121')][_0x6110('0x135')](db['SmsQueue'],{'as':_0x6110('0x142'),'through':'UserSmsQueue','required':![]});db['User'][_0x6110('0x135')](db['OpenchannelQueue'],{'as':'OpenchannelQueues','through':_0x6110('0x34'),'required':![]});db[_0x6110('0x121')]['belongsToMany'](db[_0x6110('0x115')],{'as':'WhatsappQueues','through':_0x6110('0x143'),'required':![]});db[_0x6110('0x121')]['belongsToMany'](db[_0x6110('0x144')],{'through':_0x6110('0x139')});db[_0x6110('0x121')]['belongsToMany'](db['ChatWebsite'],{'as':_0x6110('0x145'),'through':_0x6110('0x146')});db[_0x6110('0x121')][_0x6110('0x135')](db[_0x6110('0x147')],{'as':_0x6110('0x148'),'through':_0x6110('0x149')});db['User'][_0x6110('0x135')](db[_0x6110('0x3a')],{'as':'MailAccounts','through':_0x6110('0x14a')});db[_0x6110('0x121')][_0x6110('0x135')](db[_0x6110('0x5d')],{'as':_0x6110('0x14b'),'through':_0x6110('0x14c')});db[_0x6110('0x121')][_0x6110('0x135')](db[_0x6110('0x54')],{'as':_0x6110('0x14d'),'through':_0x6110('0x14e')});db[_0x6110('0x121')]['belongsToMany'](db[_0x6110('0x10c')],{'as':'WhatsappAccounts','through':_0x6110('0x14f')});db[_0x6110('0x14')][_0x6110('0x124')](db[_0x6110('0x17')],{'as':_0x6110('0x150'),'onDelete':_0x6110('0x123'),'foreignKey':'ChanSpyId'});db[_0x6110('0x151')][_0x6110('0x124')](db[_0x6110('0x17')],{'onDelete':_0x6110('0x123')});db['VoiceExtension'][_0x6110('0x124')](db[_0x6110('0x17')],{'as':'Applications','onDelete':_0x6110('0x123')});db[_0x6110('0x18')]['belongsToMany'](db[_0x6110('0x8e')],{'as':_0x6110('0x152'),'through':_0x6110('0x153')});db[_0x6110('0x19')][_0x6110('0x124')](db[_0x6110('0x154')],{'as':_0x6110('0x155'),'foreignKey':_0x6110('0x156')});db[_0x6110('0x19')][_0x6110('0x124')](db[_0x6110('0x74')],{'as':'Hoppers','foreignKey':'VoiceQueueId'});db['VoiceQueue']['hasMany'](db[_0x6110('0x76')],{'as':'HopperFinals','foreignKey':_0x6110('0x156')});db[_0x6110('0x19')]['hasMany'](db[_0x6110('0x77')],{'as':_0x6110('0x157'),'foreignKey':_0x6110('0x156')});db[_0x6110('0x19')][_0x6110('0x124')](db['ReportAgentPreview'],{'as':_0x6110('0x79'),'foreignKey':_0x6110('0x156')});db[_0x6110('0x19')][_0x6110('0x124')](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0x6110('0x156')});db[_0x6110('0x19')][_0x6110('0x124')](db[_0x6110('0xe1')],{'as':_0x6110('0x158'),'foreignKey':_0x6110('0x156')});db['VoiceQueue']['belongsTo'](db['Trunk'],{'as':'Trunk','foreignKey':_0x6110('0x159')});db[_0x6110('0x19')][_0x6110('0x15a')](db[_0x6110('0x28')],{'as':'TrunkBackup','foreignKey':_0x6110('0x15b')});db[_0x6110('0x19')][_0x6110('0x15a')](db[_0x6110('0x85')],{'as':'Interval','foreignKey':_0x6110('0x15c')});db['VoiceQueue'][_0x6110('0x15a')](db[_0x6110('0x87')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x6110('0x19')][_0x6110('0x135')](db[_0x6110('0x144')],{'as':_0x6110('0x138'),'through':_0x6110('0x15d')});db['VoiceQueue'][_0x6110('0x135')](db[_0x6110('0x121')],{'as':_0x6110('0x15e'),'through':_0x6110('0x2d')});db[_0x6110('0x19')][_0x6110('0x135')](db[_0x6110('0xf1')],{'as':_0x6110('0x15f'),'through':_0x6110('0x160')});db[_0x6110('0x19')][_0x6110('0x135')](db[_0x6110('0x144')],{'as':_0x6110('0x161'),'through':_0x6110('0x162')});db[_0x6110('0x125')][_0x6110('0x15a')](db[_0x6110('0x121')],{'as':_0x6110('0x121'),'foreignKey':_0x6110('0x120')});db[_0x6110('0x1b')]['belongsTo'](db['User'],{'as':'User','foreignKey':_0x6110('0x120')});db['VoiceMail']['hasMany'](db[_0x6110('0x1e')],{'as':'Messages','onDelete':_0x6110('0x123'),'foreignKey':'mailboxuser','sourceKey':'mailbox'});db['VoiceMailMessage'][_0x6110('0x15a')](db[_0x6110('0x11f')],{'foreignKey':_0x6110('0x163'),'targetKey':_0x6110('0x164')});db[_0x6110('0x165')][_0x6110('0x124')](db[_0x6110('0x25')],{'as':_0x6110('0x166'),'foreignKey':_0x6110('0x167'),'constraints':![]});db[_0x6110('0x165')][_0x6110('0x124')](db[_0x6110('0x23')],{'as':_0x6110('0x168'),'foreignKey':_0x6110('0x167'),'constraints':![]});db[_0x6110('0x165')]['belongsTo'](db['User'],{'as':'User','foreignKey':_0x6110('0x120')});db[_0x6110('0x165')][_0x6110('0x15a')](db[_0x6110('0x73')],{'as':_0x6110('0x169'),'foreignKey':'ContactId'});db[_0x6110('0x37')]['belongsTo'](db[_0x6110('0x3a')],{'as':_0x6110('0x3a'),'foreignKey':'MailAccountId'});db[_0x6110('0x37')][_0x6110('0x15a')](db['CloudProvider'],{'as':_0x6110('0x116'),'foreignKey':_0x6110('0x16a'),'onDelete':'restrict'});db[_0x6110('0x39')][_0x6110('0x15a')](db[_0x6110('0x3a')],{'as':_0x6110('0x3a'),'foreignKey':_0x6110('0x16b')});db[_0x6110('0x39')][_0x6110('0x15a')](db['CloudProvider'],{'as':'CloudProvider','foreignKey':'CloudProviderId','onDelete':_0x6110('0x16c')});db[_0x6110('0x3a')][_0x6110('0x11e')](db[_0x6110('0x37')],{'as':_0x6110('0x16d'),'onDelete':_0x6110('0x123')});db['MailAccount']['hasOne'](db[_0x6110('0x39')],{'as':_0x6110('0x16e'),'onDelete':_0x6110('0x123')});db[_0x6110('0x3a')][_0x6110('0x124')](db[_0x6110('0x82')],{'as':_0x6110('0x16f'),'foreignKey':'MailAccountId','onDelete':_0x6110('0x123')});db[_0x6110('0x3a')][_0x6110('0x124')](db[_0x6110('0x170')],{'as':_0x6110('0x171'),'foreignKey':'MailAccountId'});db['MailAccount'][_0x6110('0x124')](db[_0x6110('0x42')],{'as':_0x6110('0x172'),'foreignKey':_0x6110('0x16b')});db[_0x6110('0x3a')][_0x6110('0x124')](db[_0x6110('0x40')],{'as':_0x6110('0x173')});db[_0x6110('0x3a')]['hasMany'](db[_0x6110('0x43')],{'as':'Applications'});db[_0x6110('0x3a')]['belongsTo'](db[_0x6110('0x144')],{'as':_0x6110('0x174'),'foreignKey':'ListId'});db[_0x6110('0x3a')][_0x6110('0x15a')](db['Template'],{'as':_0x6110('0x95'),'foreignKey':_0x6110('0x175')});db[_0x6110('0x3a')][_0x6110('0x15a')](db[_0x6110('0x87')],{'as':_0x6110('0x176'),'foreignKey':'mandatoryDispositionPauseId'});db['MailAccount'][_0x6110('0x135')](db['User'],{'as':_0x6110('0x15e'),'through':_0x6110('0x14a')});db[_0x6110('0x3c')][_0x6110('0x135')](db['User'],{'as':_0x6110('0x15e'),'through':_0x6110('0x2f')});db[_0x6110('0x3c')][_0x6110('0x135')](db[_0x6110('0xf1')],{'through':_0x6110('0x177'),'as':_0x6110('0x15f')});db[_0x6110('0x40')][_0x6110('0x124')](db['MailMessage'],{'as':_0x6110('0x172'),'onDelete':'cascade','foreignKey':'MailInteractionId'});db[_0x6110('0x40')]['belongsTo'](db[_0x6110('0x3a')],{'as':'Account','foreignKey':_0x6110('0x16b')});db[_0x6110('0x40')]['belongsTo'](db[_0x6110('0x73')],{'as':'Contact','foreignKey':_0x6110('0x178')});db[_0x6110('0x40')][_0x6110('0x15a')](db[_0x6110('0x121')],{'as':_0x6110('0x179'),'foreignKey':_0x6110('0x120')});db[_0x6110('0x40')][_0x6110('0x135')](db[_0x6110('0x90')],{'through':_0x6110('0x17a'),'as':_0x6110('0x17b')});db[_0x6110('0x40')]['belongsToMany'](db[_0x6110('0x90')],{'through':'mail_interaction_has_tags','as':'ThroughTags'});db[_0x6110('0x40')][_0x6110('0x135')](db['User'],{'as':_0x6110('0x17c'),'through':'user_has_mail_interactions','foreignKey':_0x6110('0x17d')});db[_0x6110('0x42')][_0x6110('0x124')](db[_0x6110('0xf7')],{'as':'Attachments','onDelete':'cascade'});db[_0x6110('0x42')]['belongsTo'](db[_0x6110('0x121')],{'as':_0x6110('0x121')});db[_0x6110('0x42')][_0x6110('0x15a')](db['CmContact'],{'onDelete':_0x6110('0x123'),'as':_0x6110('0x169')});db[_0x6110('0x42')][_0x6110('0x15a')](db[_0x6110('0x40')],{'as':_0x6110('0x17e'),'foreignKey':'MailInteractionId'});db[_0x6110('0x42')][_0x6110('0x15a')](db[_0x6110('0x3a')],{'as':_0x6110('0x17f'),'foreignKey':_0x6110('0x16b')});db['MailMessage'][_0x6110('0x15a')](db[_0x6110('0x64')],{'as':_0x6110('0x64'),'foreignKey':_0x6110('0x180')});db[_0x6110('0x42')][_0x6110('0x15a')](db[_0x6110('0x69')],{'as':_0x6110('0x69'),'foreignKey':_0x6110('0x181')});db[_0x6110('0x43')][_0x6110('0x15a')](db[_0x6110('0x121')],{'onDelete':_0x6110('0x16c')});db[_0x6110('0x43')][_0x6110('0x15a')](db[_0x6110('0x3c')],{'onDelete':_0x6110('0x16c')});db['MailApplication']['belongsTo'](db['MailAccount'],{'onDelete':'restrict'});db['MailApplication'][_0x6110('0x15a')](db[_0x6110('0x85')],{'onDelete':_0x6110('0x16c'),'foreignKey':_0x6110('0x15c')});db['MailApplication']['belongsTo'](db[_0x6110('0x90')],{'onDelete':_0x6110('0x16c'),'foreignKey':_0x6110('0x182')});db['MailQueueReport'][_0x6110('0x15a')](db[_0x6110('0x3a')],{});db[_0x6110('0x45')][_0x6110('0x15a')](db[_0x6110('0x144')],{'as':_0x6110('0x174'),'foreignKey':_0x6110('0x183')});db['MailQueueReport']['belongsTo'](db['CmContact'],{'as':_0x6110('0x169'),'foreignKey':_0x6110('0x178')});db[_0x6110('0x45')][_0x6110('0x15a')](db[_0x6110('0x40')],{});db[_0x6110('0x45')]['belongsTo'](db['MailMessage'],{});db['MailQueueReport'][_0x6110('0x15a')](db[_0x6110('0x121')],{});db[_0x6110('0x45')][_0x6110('0x15a')](db[_0x6110('0x3c')],{});db[_0x6110('0x184')]['hasMany'](db['DashboardItem'],{'as':_0x6110('0x185'),'onDelete':_0x6110('0x123')});db['FaxAccount']['hasMany'](db[_0x6110('0x82')],{'as':'Dispositions','foreignKey':_0x6110('0x186'),'onDelete':'cascade'});db['FaxAccount'][_0x6110('0x124')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x6110('0x186')});db['FaxAccount']['hasMany'](db[_0x6110('0x4d')],{'as':_0x6110('0x173')});db[_0x6110('0x147')][_0x6110('0x124')](db[_0x6110('0x4b')],{'as':_0x6110('0x187')});db[_0x6110('0x147')][_0x6110('0x124')](db[_0x6110('0x17')],{'as':_0x6110('0x188'),'onDelete':_0x6110('0x123')});db[_0x6110('0x147')][_0x6110('0x124')](db[_0x6110('0x4f')],{'as':_0x6110('0x172')});db[_0x6110('0x147')][_0x6110('0x15a')](db[_0x6110('0x28')],{'as':_0x6110('0x28')});db[_0x6110('0x147')]['belongsTo'](db[_0x6110('0x144')],{'as':'List','foreignKey':_0x6110('0x183')});db[_0x6110('0x147')]['belongsTo'](db[_0x6110('0x87')],{'as':_0x6110('0x176'),'foreignKey':'mandatoryDispositionPauseId'});db['FaxAccount'][_0x6110('0x135')](db[_0x6110('0x121')],{'as':_0x6110('0x15e'),'through':_0x6110('0x149')});db[_0x6110('0x4b')]['belongsTo'](db[_0x6110('0x121')],{'onDelete':'restrict'});db[_0x6110('0x4b')]['belongsTo'](db[_0x6110('0x51')],{'onDelete':'restrict'});db[_0x6110('0x4b')]['belongsTo'](db[_0x6110('0x147')],{'onDelete':'restrict'});db['FaxApplication'][_0x6110('0x15a')](db[_0x6110('0x90')],{'onDelete':_0x6110('0x16c'),'foreignKey':_0x6110('0x182')});db[_0x6110('0x4d')]['hasMany'](db[_0x6110('0x4f')],{'as':_0x6110('0x172'),'onDelete':'cascade','foreignKey':_0x6110('0x189')});db['FaxInteraction']['belongsTo'](db[_0x6110('0x147')],{'as':_0x6110('0x17f'),'foreignKey':_0x6110('0x186')});db[_0x6110('0x4d')]['belongsTo'](db['CmContact'],{'as':_0x6110('0x169'),'foreignKey':_0x6110('0x178')});db[_0x6110('0x4d')]['belongsTo'](db[_0x6110('0x121')],{'as':_0x6110('0x179'),'foreignKey':'UserId'});db[_0x6110('0x4d')][_0x6110('0x135')](db[_0x6110('0x90')],{'through':_0x6110('0x18a'),'as':_0x6110('0x17b')});db[_0x6110('0x4d')][_0x6110('0x135')](db['Tag'],{'through':_0x6110('0x18a'),'as':_0x6110('0x18b')});db['FaxInteraction'][_0x6110('0x135')](db[_0x6110('0x121')],{'as':_0x6110('0x17c'),'through':_0x6110('0x13c'),'foreignKey':_0x6110('0x189')});db[_0x6110('0x4f')][_0x6110('0x15a')](db[_0x6110('0x121')],{'onDelete':_0x6110('0x123'),'as':'User'});db[_0x6110('0x4f')][_0x6110('0x15a')](db[_0x6110('0x4d')],{'as':_0x6110('0x17e'),'foreignKey':'FaxInteractionId'});db['FaxMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x6110('0x123'),'as':'Contact'});db[_0x6110('0x4f')][_0x6110('0x15a')](db[_0x6110('0xf7')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x6110('0x4f')][_0x6110('0x15a')](db[_0x6110('0x147')],{'as':_0x6110('0x17f'),'foreignKey':_0x6110('0x186')});db[_0x6110('0x51')]['belongsToMany'](db[_0x6110('0x121')],{'as':_0x6110('0x15e'),'through':_0x6110('0x31')});db[_0x6110('0x51')][_0x6110('0x135')](db[_0x6110('0xf1')],{'through':_0x6110('0x18c'),'as':_0x6110('0x15f')});db[_0x6110('0x53')][_0x6110('0x15a')](db[_0x6110('0x147')],{});db[_0x6110('0x53')][_0x6110('0x15a')](db['CmList'],{'as':_0x6110('0x174'),'foreignKey':_0x6110('0x183')});db[_0x6110('0x53')][_0x6110('0x15a')](db[_0x6110('0x73')],{'as':'Contact','foreignKey':_0x6110('0x178')});db[_0x6110('0x53')][_0x6110('0x15a')](db[_0x6110('0x4d')],{});db[_0x6110('0x53')]['belongsTo'](db[_0x6110('0x4f')],{});db['FaxQueueReport'][_0x6110('0x15a')](db[_0x6110('0x121')],{});db[_0x6110('0x53')][_0x6110('0x15a')](db[_0x6110('0x51')],{});db[_0x6110('0x54')]['hasMany'](db['Disposition'],{'as':_0x6110('0x16f'),'foreignKey':'SmsAccountId','onDelete':'cascade'});db[_0x6110('0x54')][_0x6110('0x124')](db[_0x6110('0x170')],{'as':_0x6110('0x171'),'foreignKey':_0x6110('0x18d')});db[_0x6110('0x54')][_0x6110('0x124')](db[_0x6110('0x5a')],{'as':_0x6110('0x172'),'foreignKey':_0x6110('0x18d')});db[_0x6110('0x54')][_0x6110('0x124')](db[_0x6110('0x58')],{'as':_0x6110('0x173')});db[_0x6110('0x54')][_0x6110('0x124')](db[_0x6110('0x56')],{'as':_0x6110('0x187')});db[_0x6110('0x54')][_0x6110('0x15a')](db['CmList'],{'as':_0x6110('0x174'),'foreignKey':_0x6110('0x183')});db['SmsAccount'][_0x6110('0x15a')](db[_0x6110('0x87')],{'as':_0x6110('0x176'),'foreignKey':_0x6110('0x18e')});db[_0x6110('0x54')]['belongsToMany'](db[_0x6110('0x121')],{'as':_0x6110('0x15e'),'through':_0x6110('0x14e')});db[_0x6110('0x56')][_0x6110('0x15a')](db['User'],{'onDelete':'restrict'});db[_0x6110('0x56')][_0x6110('0x15a')](db[_0x6110('0x5c')],{'onDelete':'restrict'});db[_0x6110('0x56')][_0x6110('0x15a')](db[_0x6110('0x54')],{'onDelete':_0x6110('0x16c')});db[_0x6110('0x56')]['belongsTo'](db['Interval'],{'onDelete':_0x6110('0x16c'),'foreignKey':_0x6110('0x15c')});db[_0x6110('0x56')]['belongsTo'](db[_0x6110('0x90')],{'onDelete':_0x6110('0x16c'),'foreignKey':_0x6110('0x182')});db['SmsInteraction'][_0x6110('0x124')](db['SmsMessage'],{'as':_0x6110('0x172'),'onDelete':_0x6110('0x123'),'foreignKey':_0x6110('0x18f')});db[_0x6110('0x58')]['belongsTo'](db[_0x6110('0x54')],{'as':_0x6110('0x17f'),'foreignKey':'SmsAccountId'});db[_0x6110('0x58')][_0x6110('0x15a')](db[_0x6110('0x73')],{'as':_0x6110('0x169'),'foreignKey':_0x6110('0x178')});db[_0x6110('0x58')][_0x6110('0x15a')](db[_0x6110('0x121')],{'as':_0x6110('0x179'),'foreignKey':_0x6110('0x120')});db[_0x6110('0x58')][_0x6110('0x135')](db[_0x6110('0x90')],{'through':_0x6110('0x190'),'as':_0x6110('0x17b')});db[_0x6110('0x58')]['belongsToMany'](db[_0x6110('0x90')],{'through':_0x6110('0x190'),'as':_0x6110('0x18b')});db['SmsInteraction']['belongsToMany'](db['User'],{'as':_0x6110('0x17c'),'through':_0x6110('0x191'),'foreignKey':_0x6110('0x18f')});db[_0x6110('0x5a')][_0x6110('0x15a')](db[_0x6110('0x121')],{'as':_0x6110('0x121')});db[_0x6110('0x5a')]['belongsTo'](db['CmContact'],{'onDelete':_0x6110('0x123'),'as':'Contact'});db[_0x6110('0x5a')][_0x6110('0x15a')](db[_0x6110('0x58')],{'onDelete':_0x6110('0x123'),'as':_0x6110('0x17e'),'foreignKey':_0x6110('0x18f')});db[_0x6110('0x5a')][_0x6110('0x15a')](db[_0x6110('0x54')],{'as':'Account','foreignKey':_0x6110('0x18d')});db[_0x6110('0x5c')][_0x6110('0x135')](db[_0x6110('0x121')],{'as':_0x6110('0x15e'),'through':_0x6110('0x33'),'foreignKey':_0x6110('0x192')});db['SmsQueue'][_0x6110('0x135')](db[_0x6110('0xf1')],{'through':_0x6110('0x193'),'as':_0x6110('0x15f')});db['OpenchannelAccount'][_0x6110('0x124')](db[_0x6110('0x82')],{'as':_0x6110('0x16f'),'foreignKey':_0x6110('0x194'),'onDelete':_0x6110('0x123')});db[_0x6110('0x5d')]['hasMany'](db[_0x6110('0x170')],{'as':_0x6110('0x171'),'foreignKey':'OpenchannelAccountId'});db[_0x6110('0x5d')]['hasMany'](db['OpenchannelInteraction'],{'as':'Interactions','foreignKey':_0x6110('0x194')});db[_0x6110('0x5d')][_0x6110('0x124')](db[_0x6110('0x61')],{'as':'Messages','foreignKey':_0x6110('0x194')});db[_0x6110('0x5d')][_0x6110('0x124')](db[_0x6110('0x5f')],{'as':_0x6110('0x187'),'foreignKey':_0x6110('0x194')});db['OpenchannelAccount'][_0x6110('0x15a')](db[_0x6110('0x144')],{'as':'List','foreignKey':_0x6110('0x183')});db[_0x6110('0x5d')][_0x6110('0x15a')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x6110('0x18e')});db[_0x6110('0x5d')][_0x6110('0x135')](db[_0x6110('0x121')],{'as':'Agents','through':'user_has_openchannel_accounts'});db['OpenchannelApplication'][_0x6110('0x15a')](db[_0x6110('0x121')],{'onDelete':_0x6110('0x16c')});db[_0x6110('0x5f')][_0x6110('0x15a')](db[_0x6110('0x62')],{'onDelete':_0x6110('0x16c'),'foreignKey':_0x6110('0x195')});db[_0x6110('0x5f')]['belongsTo'](db['OpenchannelAccount'],{'onDelete':_0x6110('0x16c'),'foreignKey':_0x6110('0x194')});db[_0x6110('0x5f')]['belongsTo'](db[_0x6110('0x85')],{'onDelete':_0x6110('0x16c'),'foreignKey':_0x6110('0x15c')});db[_0x6110('0x5f')][_0x6110('0x15a')](db[_0x6110('0x90')],{'onDelete':_0x6110('0x16c'),'foreignKey':_0x6110('0x182')});db[_0x6110('0x129')][_0x6110('0x124')](db['OpenchannelMessage'],{'as':'Messages','onDelete':_0x6110('0x123'),'foreignKey':_0x6110('0x196')});db[_0x6110('0x129')]['belongsTo'](db[_0x6110('0x5d')],{'as':_0x6110('0x17f'),'foreignKey':_0x6110('0x194')});db[_0x6110('0x129')][_0x6110('0x15a')](db[_0x6110('0x73')],{'as':_0x6110('0x169'),'foreignKey':_0x6110('0x178')});db[_0x6110('0x129')][_0x6110('0x15a')](db[_0x6110('0x121')],{'as':_0x6110('0x179'),'foreignKey':'UserId'});db['OpenchannelInteraction'][_0x6110('0x135')](db[_0x6110('0x90')],{'through':_0x6110('0x197'),'as':_0x6110('0x17b')});db[_0x6110('0x129')][_0x6110('0x135')](db[_0x6110('0x90')],{'through':_0x6110('0x197'),'as':_0x6110('0x18b')});db[_0x6110('0x129')]['belongsToMany'](db[_0x6110('0x121')],{'as':_0x6110('0x17c'),'through':'user_has_openchannel_interactions','foreignKey':'OpenchannelInteractionId'});db[_0x6110('0x61')][_0x6110('0x15a')](db[_0x6110('0x121')],{'onDelete':_0x6110('0x123'),'as':_0x6110('0x121')});db[_0x6110('0x61')][_0x6110('0x15a')](db['CmContact'],{'onDelete':_0x6110('0x123'),'as':'Contact'});db['OpenchannelMessage'][_0x6110('0x15a')](db[_0x6110('0x129')],{'onDelete':_0x6110('0x123'),'as':'Interaction','foreignKey':_0x6110('0x196')});db[_0x6110('0x61')][_0x6110('0x15a')](db[_0x6110('0xf7')],{'as':_0x6110('0xf7'),'foreignKey':'AttachmentId'});db['OpenchannelMessage'][_0x6110('0x15a')](db[_0x6110('0x5d')],{'as':_0x6110('0x17f'),'foreignKey':_0x6110('0x194')});db['OpenchannelQueue'][_0x6110('0x135')](db[_0x6110('0x121')],{'as':_0x6110('0x15e'),'through':_0x6110('0x34'),'foreignKey':'OpenchannelQueueId'});db['OpenchannelQueue'][_0x6110('0x135')](db['Team'],{'through':_0x6110('0x198'),'as':_0x6110('0x15f')});db['ChatWebsite'][_0x6110('0x124')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x6110('0x180'),'onDelete':_0x6110('0x123')});db[_0x6110('0x64')][_0x6110('0x124')](db[_0x6110('0x170')],{'as':_0x6110('0x171'),'foreignKey':'ChatWebsiteId'});db[_0x6110('0x64')]['hasMany'](db[_0x6110('0x6f')],{'as':_0x6110('0x199')});db[_0x6110('0x64')]['hasMany'](db[_0x6110('0x12a')],{'as':_0x6110('0x173')});db['ChatWebsite'][_0x6110('0x124')](db[_0x6110('0x19a')],{'as':'Applications'});db['ChatWebsite']['hasMany'](db['ChatMessage'],{'as':_0x6110('0x172')});db[_0x6110('0x64')]['belongsTo'](db['CmList'],{'as':_0x6110('0x174'),'foreignKey':'ListId'});db[_0x6110('0x64')]['belongsTo'](db['Interval'],{'as':_0x6110('0x85'),'foreignKey':_0x6110('0x15c')});db[_0x6110('0x64')]['belongsTo'](db[_0x6110('0x3a')],{'as':'MailAccount','foreignKey':_0x6110('0x16b')});db[_0x6110('0x64')][_0x6110('0x15a')](db['Pause'],{'as':_0x6110('0x176'),'foreignKey':_0x6110('0x18e')});db[_0x6110('0x64')][_0x6110('0x135')](db[_0x6110('0x121')],{'as':'Agents','through':_0x6110('0x146')});db[_0x6110('0x19b')][_0x6110('0x15a')](db[_0x6110('0x5d')],{});db[_0x6110('0x19b')][_0x6110('0x15a')](db[_0x6110('0x144')],{'as':_0x6110('0x174'),'foreignKey':_0x6110('0x183')});db['OpenchannelQueueReport']['belongsTo'](db[_0x6110('0x73')],{'as':'Contact','foreignKey':'ContactId'});db['OpenchannelQueueReport']['belongsTo'](db[_0x6110('0x129')],{});db[_0x6110('0x19b')][_0x6110('0x15a')](db[_0x6110('0x61')],{});db[_0x6110('0x19b')][_0x6110('0x15a')](db[_0x6110('0x121')],{});db[_0x6110('0x19b')]['belongsTo'](db[_0x6110('0x62')],{});db[_0x6110('0x19a')][_0x6110('0x15a')](db['User'],{'as':'Agent','foreignKey':'UserId','onDelete':'restrict'});db['ChatApplication'][_0x6110('0x15a')](db[_0x6110('0x6b')],{'as':_0x6110('0x19c'),'foreignKey':_0x6110('0x19d'),'onDelete':_0x6110('0x16c')});db[_0x6110('0x19a')][_0x6110('0x15a')](db[_0x6110('0x64')],{'as':_0x6110('0x19e'),'foreignKey':_0x6110('0x180'),'onDelete':'restrict'});db[_0x6110('0x19a')][_0x6110('0x15a')](db[_0x6110('0x90')],{'onDelete':'restrict','foreignKey':_0x6110('0x182')});db[_0x6110('0x12a')]['hasMany'](db['ChatMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':'ChatInteractionId'});db[_0x6110('0x12a')][_0x6110('0x15a')](db[_0x6110('0x64')],{'as':_0x6110('0x17f'),'foreignKey':'ChatWebsiteId'});db[_0x6110('0x12a')][_0x6110('0x15a')](db['CmContact'],{'as':_0x6110('0x169'),'foreignKey':'ContactId'});db[_0x6110('0x12a')][_0x6110('0x15a')](db[_0x6110('0x121')],{'as':_0x6110('0x179'),'foreignKey':_0x6110('0x120')});db[_0x6110('0x12a')]['belongsToMany'](db[_0x6110('0x90')],{'through':_0x6110('0x19f'),'as':'Tags'});db['ChatInteraction']['belongsToMany'](db[_0x6110('0x90')],{'through':_0x6110('0x19f'),'as':_0x6110('0x18b')});db[_0x6110('0x12a')]['belongsToMany'](db[_0x6110('0x121')],{'as':'Users','through':_0x6110('0x1a0'),'foreignKey':_0x6110('0x1a1')});db[_0x6110('0x67')]['belongsTo'](db[_0x6110('0x121')],{'onDelete':_0x6110('0x123'),'as':'User'});db['ChatMessage'][_0x6110('0x15a')](db[_0x6110('0x73')],{'onDelete':_0x6110('0x123'),'as':'Contact','foreignKey':'ContactId'});db[_0x6110('0x67')][_0x6110('0x15a')](db[_0x6110('0x12a')],{'onDelete':_0x6110('0x123'),'as':_0x6110('0x17e'),'foreignKey':_0x6110('0x1a1')});db[_0x6110('0x67')]['belongsTo'](db[_0x6110('0xf7')],{'as':_0x6110('0xf7'),'foreignKey':_0x6110('0x1a2')});db[_0x6110('0x67')][_0x6110('0x15a')](db[_0x6110('0x64')],{'as':_0x6110('0x17f'),'foreignKey':_0x6110('0x180')});db['ChatOfflineMessage']['hasMany'](db[_0x6110('0xf7')],{'as':_0x6110('0x1a3'),'foreignKey':_0x6110('0x181'),'onDelete':_0x6110('0x123'),'hooks':!![]});db[_0x6110('0x69')][_0x6110('0x15a')](db[_0x6110('0x73')],{'onDelete':_0x6110('0x123'),'as':_0x6110('0x169'),'foreignKey':_0x6110('0x178')});db[_0x6110('0x69')][_0x6110('0x15a')](db[_0x6110('0x64')],{'as':_0x6110('0x17f'),'foreignKey':'ChatWebsiteId'});db[_0x6110('0x6b')][_0x6110('0x135')](db[_0x6110('0x121')],{'as':_0x6110('0x15e'),'through':'UserChatQueue','hooks':!![]});db[_0x6110('0x6b')][_0x6110('0x135')](db['Team'],{'through':_0x6110('0x1a4'),'as':_0x6110('0x15f')});db[_0x6110('0x6d')][_0x6110('0x124')](db[_0x6110('0x1a5')],{'as':'Messages','foreignKey':_0x6110('0x1a6'),'onDelete':_0x6110('0x123')});db[_0x6110('0x6d')][_0x6110('0x135')](db[_0x6110('0x121')],{'as':_0x6110('0x155'),'through':_0x6110('0x134')});db[_0x6110('0x6f')]['belongsTo'](db[_0x6110('0x64')],{'as':'Website','foreignKey':_0x6110('0x180')});db[_0x6110('0x71')][_0x6110('0x124')](db[_0x6110('0x73')],{'as':_0x6110('0x136'),'foreignKey':_0x6110('0x1a7')});db[_0x6110('0x73')][_0x6110('0x124')](db[_0x6110('0x1a8')],{'as':_0x6110('0x1a9'),'foreignKey':'CmContactId'});db[_0x6110('0x73')][_0x6110('0x124')](db[_0x6110('0x74')],{'as':_0x6110('0x1aa'),'foreignKey':_0x6110('0x178')});db[_0x6110('0x73')]['hasMany'](db[_0x6110('0x76')],{'as':_0x6110('0x127'),'foreignKey':_0x6110('0x178')});db[_0x6110('0x73')]['hasMany'](db[_0x6110('0x77')],{'as':'HopperHistories','foreignKey':_0x6110('0x178')});db[_0x6110('0x73')][_0x6110('0x124')](db[_0x6110('0x79')],{'as':_0x6110('0x79'),'foreignKey':_0x6110('0x178')});db['CmContact'][_0x6110('0x124')](db[_0x6110('0xe1')],{'as':_0x6110('0x158'),'foreignKey':_0x6110('0x178')});db[_0x6110('0x73')][_0x6110('0x124')](db[_0x6110('0x129')],{'as':_0x6110('0x1ab'),'foreignKey':_0x6110('0x178'),'onDelete':'restrict'});db[_0x6110('0x73')][_0x6110('0x124')](db[_0x6110('0x12a')],{'as':_0x6110('0x12b'),'foreignKey':_0x6110('0x178'),'onDelete':_0x6110('0x16c')});db[_0x6110('0x73')]['hasMany'](db[_0x6110('0x58')],{'as':_0x6110('0x12c'),'foreignKey':_0x6110('0x178'),'onDelete':_0x6110('0x16c')});db[_0x6110('0x73')][_0x6110('0x124')](db[_0x6110('0x4d')],{'as':'FaxInteractions','foreignKey':_0x6110('0x178'),'onDelete':_0x6110('0x16c')});db['CmContact'][_0x6110('0x124')](db[_0x6110('0x40')],{'as':_0x6110('0x12e'),'foreignKey':_0x6110('0x178'),'onDelete':_0x6110('0x16c')});db['CmContact'][_0x6110('0x15a')](db[_0x6110('0x71')],{'as':_0x6110('0x1ac'),'foreignKey':_0x6110('0x1a7')});db[_0x6110('0x73')][_0x6110('0x15a')](db[_0x6110('0x144')],{'as':_0x6110('0x174'),'foreignKey':_0x6110('0x183'),'onDelete':_0x6110('0x123')});db[_0x6110('0x73')][_0x6110('0x135')](db['User'],{'as':'Users','through':'cm_user_has_contacts'});db[_0x6110('0x73')][_0x6110('0x135')](db[_0x6110('0x90')],{'as':_0x6110('0x17b'),'through':_0x6110('0x1ad')});db['CmContact'][_0x6110('0x135')](db['Tag'],{'through':'cm_contact_has_tags','as':_0x6110('0x18b')});db['CmHopper'][_0x6110('0x124')](db[_0x6110('0x94')],{'as':_0x6110('0x1ae'),'foreignKey':_0x6110('0x1af')});db[_0x6110('0x74')]['belongsTo'](db[_0x6110('0x73')],{'as':_0x6110('0x169'),'foreignKey':_0x6110('0x178'),'onDelete':_0x6110('0x123')});db[_0x6110('0x74')][_0x6110('0x15a')](db[_0x6110('0x144')],{'as':_0x6110('0x174'),'foreignKey':_0x6110('0x183'),'onDelete':_0x6110('0x123')});db['CmHopper'][_0x6110('0x15a')](db['User'],{'as':_0x6110('0x1b0'),'foreignKey':_0x6110('0x120')});db[_0x6110('0x74')][_0x6110('0x15a')](db['VoiceQueue'],{'as':'Queue','foreignKey':_0x6110('0x156'),'onDelete':_0x6110('0x123')});db[_0x6110('0x74')][_0x6110('0x15a')](db[_0x6110('0xf3')],{'as':_0x6110('0xf3'),'foreignKey':_0x6110('0x1b1'),'onDelete':_0x6110('0x123')});db[_0x6110('0x74')][_0x6110('0x15a')](db['User'],{'as':_0x6110('0x179'),'foreignKey':_0x6110('0x1b2')});db[_0x6110('0x1b3')][_0x6110('0x15a')](db[_0x6110('0x73')],{'as':_0x6110('0x169'),'foreignKey':_0x6110('0x178'),'onDelete':'cascade'});db['CmHopperBlack']['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x6110('0x183'),'onDelete':'cascade'});db['CmHopperBlack'][_0x6110('0x15a')](db['VoiceQueue'],{'as':'Queue','foreignKey':_0x6110('0x156'),'onDelete':_0x6110('0x123')});db[_0x6110('0x1b3')][_0x6110('0x15a')](db[_0x6110('0xf3')],{'as':'Campaign','foreignKey':_0x6110('0x1b1'),'onDelete':_0x6110('0x123')});db['Automation']['hasMany'](db[_0x6110('0x84')],{'as':{'plural':_0x6110('0x1b4'),'singular':'OneAll'},'foreignKey':'AutomationAllId','onDelete':_0x6110('0x123'),'hooks':!![]});db[_0x6110('0x7f')][_0x6110('0x124')](db[_0x6110('0x84')],{'as':{'plural':'Any','singular':_0x6110('0x1b5')},'foreignKey':_0x6110('0x1b6'),'onDelete':_0x6110('0x123'),'hooks':!![]});db[_0x6110('0x7f')][_0x6110('0x124')](db[_0x6110('0x7d')],{'as':_0x6110('0x1b7'),'foreignKey':_0x6110('0x1b8'),'onDelete':_0x6110('0x123'),'hooks':!![]});db[_0x6110('0x82')][_0x6110('0x124')](db[_0x6110('0x82')],{'as':_0x6110('0x16f'),'foreignKey':_0x6110('0x1b9'),'onDelete':_0x6110('0x123')});db[_0x6110('0x85')][_0x6110('0x124')](db['Interval'],{'as':_0x6110('0x1ba'),'foreignKey':_0x6110('0x15c'),'onDelete':_0x6110('0x123'),'hooks':!![],'required':![]});db[_0x6110('0x85')][_0x6110('0x124')](db['VoiceExtension'],{'as':_0x6110('0x126'),'foreignKey':_0x6110('0x15c'),'onDelete':_0x6110('0x16c')});db[_0x6110('0x85')][_0x6110('0x124')](db['MailApplication'],{'as':_0x6110('0x1bb'),'foreignKey':_0x6110('0x15c')});db['Interval'][_0x6110('0x124')](db[_0x6110('0x19a')],{'as':_0x6110('0x1bc'),'foreignKey':_0x6110('0x15c')});db['Interval'][_0x6110('0x124')](db['FaxApplication'],{'as':_0x6110('0x1bd'),'foreignKey':_0x6110('0x15c')});db[_0x6110('0x85')][_0x6110('0x124')](db[_0x6110('0x56')],{'as':_0x6110('0x1be'),'foreignKey':_0x6110('0x15c')});db[_0x6110('0x8d')][_0x6110('0x15a')](db[_0x6110('0x3a')],{});db['Schedule'][_0x6110('0x15a')](db['AnalyticDefaultReport'],{'foreignKey':_0x6110('0x1bf')});db[_0x6110('0x8d')]['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':'CustomReportId'});db[_0x6110('0x8e')][_0x6110('0x135')](db[_0x6110('0x18')],{'as':_0x6110('0x1c0'),'through':_0x6110('0x153'),'onDelete':'restrict'});db[_0x6110('0x90')][_0x6110('0x135')](db[_0x6110('0x73')],{'through':_0x6110('0x1ad')});db['Tag'][_0x6110('0x135')](db[_0x6110('0x12a')],{'through':'chat_interaction_has_tags'});db[_0x6110('0x90')][_0x6110('0x135')](db['MailInteraction'],{'through':_0x6110('0x17a')});db[_0x6110('0x90')]['belongsToMany'](db['SmsInteraction'],{'through':'sms_interaction_has_tags'});db[_0x6110('0x90')][_0x6110('0x135')](db['FaxInteraction'],{'through':_0x6110('0x18a')});db[_0x6110('0x90')][_0x6110('0x135')](db[_0x6110('0x129')],{'through':_0x6110('0x197')});db[_0x6110('0x90')][_0x6110('0x135')](db[_0x6110('0x110')],{'through':_0x6110('0x1c1')});db[_0x6110('0x1a8')]['belongsTo'](db[_0x6110('0x92')],{'as':'ItemType','foreignKey':_0x6110('0x1c2')});db['CmHopperAdditionalPhone'][_0x6110('0x15a')](db[_0x6110('0x74')],{'as':_0x6110('0x1c3'),'foreignKey':_0x6110('0x1af')});db['CmContactHasItem'][_0x6110('0x15a')](db[_0x6110('0x73')],{'as':'Contact','foreignKey':_0x6110('0x1c4')});db[_0x6110('0x97')]['hasMany'](db[_0x6110('0x84')],{'as':{'plural':'AllConditions','singular':_0x6110('0x1c5')},'foreignKey':_0x6110('0x1c6'),'onDelete':_0x6110('0x123'),'hooks':!![]});db[_0x6110('0x97')][_0x6110('0x124')](db['Condition'],{'as':{'plural':_0x6110('0x1c7'),'singular':_0x6110('0x1c8')},'foreignKey':_0x6110('0x1c9'),'onDelete':_0x6110('0x123'),'hooks':!![]});db[_0x6110('0x97')][_0x6110('0x124')](db[_0x6110('0x7d')],{'as':_0x6110('0x1b7'),'foreignKey':_0x6110('0x1ca'),'onDelete':'cascade','hooks':!![]});db[_0x6110('0x9d')][_0x6110('0x124')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':'cascade','foreignKey':_0x6110('0x1cb'),'hooks':!![]});db[_0x6110('0x9f')][_0x6110('0x124')](db[_0x6110('0xa4')],{'as':_0x6110('0x1cc'),'onDelete':_0x6110('0x123'),'foreignKey':_0x6110('0x1bf')});db[_0x6110('0xa2')][_0x6110('0x124')](db[_0x6110('0xa4')],{'as':_0x6110('0x1cc'),'onDelete':_0x6110('0x123'),'foreignKey':_0x6110('0x1cd')});db['AnalyticFieldReport']['belongsTo'](db[_0x6110('0xa2')],{'foreignKey':'MetricId'});db['SalesforceAccount']['hasMany'](db['SalesforceConfiguration'],{'as':_0x6110('0x1ce'),'onDelete':_0x6110('0x123'),'foreignKey':'AccountId'});db[_0x6110('0xa8')][_0x6110('0x124')](db[_0x6110('0x1cf')],{'as':_0x6110('0x1d0'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x6110('0xa8')][_0x6110('0x124')](db[_0x6110('0x1cf')],{'as':_0x6110('0x1d1'),'onDelete':'cascade','foreignKey':_0x6110('0x1d2')});db[_0x6110('0xa8')][_0x6110('0x124')](db[_0x6110('0x1cf')],{'as':'Fields','onDelete':_0x6110('0x123'),'foreignKey':'FieldId'});db[_0x6110('0xa8')][_0x6110('0x15a')](db[_0x6110('0xa7')],{'as':_0x6110('0x17f'),'foreignKey':'AccountId'});db['SalesforceField'][_0x6110('0x124')](db[_0x6110('0x1cf')],{'as':_0x6110('0x1d3'),'foreignKey':_0x6110('0x1d4')});db[_0x6110('0x1cf')][_0x6110('0x124')](db[_0x6110('0x1cf')],{'as':_0x6110('0x1d5'),'foreignKey':_0x6110('0x1d2')});db['SalesforceField'][_0x6110('0x124')](db[_0x6110('0x1cf')],{'as':_0x6110('0x1d6'),'foreignKey':_0x6110('0x1d7')});db[_0x6110('0x1cf')][_0x6110('0x15a')](db['Variable'],{'as':_0x6110('0x99'),'foreignKey':_0x6110('0x1d8')});db[_0x6110('0xab')][_0x6110('0x124')](db[_0x6110('0xad')],{'as':_0x6110('0x1ce'),'onDelete':_0x6110('0x123'),'foreignKey':_0x6110('0x1d9')});db['SugarcrmConfiguration'][_0x6110('0x124')](db['SugarcrmField'],{'as':_0x6110('0x1d0'),'onDelete':_0x6110('0x123'),'foreignKey':_0x6110('0x1d4')});db[_0x6110('0xad')][_0x6110('0x124')](db[_0x6110('0xae')],{'as':'Descriptions','onDelete':_0x6110('0x123'),'foreignKey':_0x6110('0x1d2')});db['SugarcrmConfiguration']['hasMany'](db[_0x6110('0xae')],{'as':_0x6110('0x1cc'),'onDelete':_0x6110('0x123'),'foreignKey':'FieldId'});db[_0x6110('0xad')]['belongsTo'](db[_0x6110('0xab')],{'as':_0x6110('0x17f'),'foreignKey':_0x6110('0x1d9')});db['SugarcrmField'][_0x6110('0x124')](db[_0x6110('0xae')],{'as':_0x6110('0x1d3'),'foreignKey':_0x6110('0x1d4')});db[_0x6110('0xae')]['hasMany'](db[_0x6110('0xae')],{'as':_0x6110('0x1d5'),'foreignKey':_0x6110('0x1d2')});db[_0x6110('0xae')][_0x6110('0x124')](db[_0x6110('0xae')],{'as':_0x6110('0x1d6'),'foreignKey':_0x6110('0x1d7')});db[_0x6110('0xae')][_0x6110('0x15a')](db[_0x6110('0x99')],{'as':'Variable','foreignKey':_0x6110('0x1d8')});db[_0x6110('0xb0')][_0x6110('0x124')](db[_0x6110('0x1da')],{'as':_0x6110('0x1ce'),'onDelete':_0x6110('0x123'),'foreignKey':_0x6110('0x1d9')});db[_0x6110('0x1da')]['hasMany'](db[_0x6110('0xb3')],{'as':_0x6110('0x1d0'),'onDelete':_0x6110('0x123'),'foreignKey':_0x6110('0x1d4')});db[_0x6110('0x1da')][_0x6110('0x124')](db[_0x6110('0xb3')],{'as':_0x6110('0x1d1'),'onDelete':_0x6110('0x123'),'foreignKey':_0x6110('0x1d2')});db['DeskConfiguration']['hasMany'](db[_0x6110('0xb3')],{'as':'Fields','onDelete':_0x6110('0x123'),'foreignKey':_0x6110('0x1d7')});db['DeskConfiguration'][_0x6110('0x15a')](db[_0x6110('0xb0')],{'as':_0x6110('0x17f'),'foreignKey':_0x6110('0x1d9')});db['DeskConfiguration'][_0x6110('0x135')](db[_0x6110('0x90')],{'through':_0x6110('0x1db')});db[_0x6110('0xb3')][_0x6110('0x124')](db[_0x6110('0xb3')],{'as':_0x6110('0x1d3'),'foreignKey':_0x6110('0x1d4')});db[_0x6110('0xb3')][_0x6110('0x124')](db[_0x6110('0xb3')],{'as':_0x6110('0x1d5'),'foreignKey':_0x6110('0x1d2')});db[_0x6110('0xb3')][_0x6110('0x124')](db['DeskField'],{'as':_0x6110('0x1d6'),'foreignKey':_0x6110('0x1d7')});db[_0x6110('0xb3')][_0x6110('0x15a')](db['Variable'],{'as':'Variable','foreignKey':_0x6110('0x1d8')});db[_0x6110('0xb5')][_0x6110('0x124')](db[_0x6110('0xb7')],{'as':_0x6110('0x1ce'),'onDelete':_0x6110('0x123'),'foreignKey':'AccountId'});db['ZohoConfiguration'][_0x6110('0x124')](db[_0x6110('0x1dc')],{'as':_0x6110('0x1d0'),'onDelete':'cascade','foreignKey':_0x6110('0x1d4')});db[_0x6110('0xb7')]['hasMany'](db[_0x6110('0x1dc')],{'as':_0x6110('0x1d1'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x6110('0xb7')]['hasMany'](db['ZohoField'],{'as':_0x6110('0x1cc'),'onDelete':_0x6110('0x123'),'foreignKey':_0x6110('0x1d7')});db[_0x6110('0xb7')]['belongsTo'](db[_0x6110('0xb5')],{'as':_0x6110('0x17f'),'foreignKey':_0x6110('0x1d9')});db[_0x6110('0x1dc')]['hasMany'](db[_0x6110('0x1dc')],{'as':_0x6110('0x1d3'),'foreignKey':_0x6110('0x1d4')});db[_0x6110('0x1dc')]['hasMany'](db[_0x6110('0x1dc')],{'as':'Description','foreignKey':_0x6110('0x1d2')});db[_0x6110('0x1dc')][_0x6110('0x124')](db['ZohoField'],{'as':_0x6110('0x1d6'),'foreignKey':_0x6110('0x1d7')});db[_0x6110('0x1dc')][_0x6110('0x15a')](db[_0x6110('0x99')],{'as':_0x6110('0x99'),'foreignKey':_0x6110('0x1d8')});db[_0x6110('0x1dd')][_0x6110('0x124')](db[_0x6110('0xba')],{'as':_0x6110('0x1ce'),'onDelete':'cascade','foreignKey':_0x6110('0x1d9')});db[_0x6110('0xba')][_0x6110('0x124')](db[_0x6110('0xbc')],{'as':_0x6110('0x1d0'),'foreignKey':_0x6110('0x1d4')});db[_0x6110('0xba')][_0x6110('0x124')](db[_0x6110('0xbc')],{'as':_0x6110('0x1d1'),'foreignKey':_0x6110('0x1d2')});db['ZendeskConfiguration'][_0x6110('0x124')](db[_0x6110('0xbc')],{'as':_0x6110('0x1cc'),'foreignKey':_0x6110('0x1d7')});db[_0x6110('0xba')][_0x6110('0x15a')](db[_0x6110('0x1dd')],{'as':_0x6110('0x17f'),'foreignKey':_0x6110('0x1d9')});db['ZendeskConfiguration'][_0x6110('0x135')](db[_0x6110('0x90')],{'through':_0x6110('0x1de')});db['ZendeskField'][_0x6110('0x124')](db[_0x6110('0xbc')],{'as':_0x6110('0x1d3'),'foreignKey':_0x6110('0x1d4')});db[_0x6110('0xbc')][_0x6110('0x124')](db[_0x6110('0xbc')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x6110('0xbc')][_0x6110('0x124')](db['ZendeskField'],{'as':_0x6110('0x1d6'),'foreignKey':_0x6110('0x1d7')});db[_0x6110('0xbc')]['belongsTo'](db[_0x6110('0x99')],{'as':_0x6110('0x99'),'foreignKey':_0x6110('0x1d8')});db[_0x6110('0xbe')]['hasMany'](db[_0x6110('0xc0')],{'as':'Configurations','onDelete':_0x6110('0x123'),'foreignKey':_0x6110('0x1d9')});db['FreshdeskConfiguration'][_0x6110('0x124')](db[_0x6110('0xc2')],{'as':_0x6110('0x1d0'),'onDelete':_0x6110('0x123'),'foreignKey':'SubjectId'});db[_0x6110('0xc0')][_0x6110('0x124')](db['FreshdeskField'],{'as':_0x6110('0x1d1'),'onDelete':_0x6110('0x123'),'foreignKey':_0x6110('0x1d2')});db[_0x6110('0xc0')]['hasMany'](db['FreshdeskField'],{'as':_0x6110('0x1cc'),'onDelete':'cascade','foreignKey':_0x6110('0x1d7')});db['FreshdeskConfiguration'][_0x6110('0x15a')](db['FreshdeskAccount'],{'as':_0x6110('0x17f'),'foreignKey':_0x6110('0x1d9')});db[_0x6110('0xc0')][_0x6110('0x135')](db['Tag'],{'through':_0x6110('0x1df')});db['FreshdeskField']['hasMany'](db[_0x6110('0xc2')],{'as':_0x6110('0x1d3'),'foreignKey':_0x6110('0x1d4')});db[_0x6110('0xc2')][_0x6110('0x124')](db[_0x6110('0xc2')],{'as':_0x6110('0x1d5'),'foreignKey':_0x6110('0x1d2')});db[_0x6110('0xc2')][_0x6110('0x124')](db[_0x6110('0xc2')],{'as':'Field','foreignKey':_0x6110('0x1d7')});db['FreshdeskField']['belongsTo'](db[_0x6110('0x99')],{'as':_0x6110('0x99'),'foreignKey':_0x6110('0x1d8')});db[_0x6110('0xc3')][_0x6110('0x124')](db[_0x6110('0xc4')],{'as':_0x6110('0x1ce'),'onDelete':_0x6110('0x123'),'foreignKey':_0x6110('0x1d9')});db[_0x6110('0xc4')][_0x6110('0x124')](db['VtigerField'],{'as':'Subjects','foreignKey':_0x6110('0x1d4')});db[_0x6110('0xc4')]['hasMany'](db['VtigerField'],{'as':_0x6110('0x1d1'),'foreignKey':_0x6110('0x1d2')});db[_0x6110('0xc4')]['hasMany'](db[_0x6110('0x1e0')],{'as':_0x6110('0x1cc'),'foreignKey':_0x6110('0x1d7')});db['VtigerConfiguration']['belongsTo'](db['VtigerAccount'],{'as':_0x6110('0x17f'),'foreignKey':_0x6110('0x1d9')});db[_0x6110('0x1e0')][_0x6110('0x124')](db[_0x6110('0x1e0')],{'as':_0x6110('0x1d3'),'foreignKey':'SubjectId'});db['VtigerField'][_0x6110('0x124')](db[_0x6110('0x1e0')],{'as':'Description','foreignKey':_0x6110('0x1d2')});db['VtigerField']['hasMany'](db[_0x6110('0x1e0')],{'as':'Field','foreignKey':_0x6110('0x1d7')});db[_0x6110('0x1e0')][_0x6110('0x15a')](db[_0x6110('0x99')],{'as':_0x6110('0x99'),'foreignKey':_0x6110('0x1d8')});db[_0x6110('0xc7')]['hasMany'](db[_0x6110('0xc9')],{'as':'Configurations','onDelete':_0x6110('0x123'),'foreignKey':'AccountId'});db[_0x6110('0xc9')][_0x6110('0x124')](db['ServicenowField'],{'as':_0x6110('0x1d0'),'foreignKey':_0x6110('0x1d4')});db[_0x6110('0xc9')][_0x6110('0x124')](db[_0x6110('0xcb')],{'as':'Descriptions','foreignKey':_0x6110('0x1d2')});db[_0x6110('0xc9')][_0x6110('0x124')](db['ServicenowField'],{'as':_0x6110('0x1cc'),'foreignKey':_0x6110('0x1d7')});db[_0x6110('0xc9')][_0x6110('0x15a')](db['ServicenowAccount'],{'as':_0x6110('0x17f'),'foreignKey':_0x6110('0x1d9')});db['ServicenowField'][_0x6110('0x124')](db[_0x6110('0xcb')],{'as':_0x6110('0x1d3'),'foreignKey':'SubjectId'});db[_0x6110('0xcb')][_0x6110('0x124')](db[_0x6110('0xcb')],{'as':_0x6110('0x1d5'),'foreignKey':_0x6110('0x1d2')});db[_0x6110('0xcb')][_0x6110('0x124')](db['ServicenowField'],{'as':_0x6110('0x1d6'),'foreignKey':_0x6110('0x1d7')});db[_0x6110('0xcb')]['belongsTo'](db[_0x6110('0x99')],{'as':_0x6110('0x99'),'foreignKey':_0x6110('0x1d8')});db[_0x6110('0xcd')][_0x6110('0x124')](db[_0x6110('0x1e1')],{'as':_0x6110('0x1ce'),'onDelete':_0x6110('0x123'),'foreignKey':'AccountId'});db[_0x6110('0xcd')][_0x6110('0x15a')](db['CloudProvider'],{'as':_0x6110('0x116'),'foreignKey':_0x6110('0x16a')});db[_0x6110('0x1e1')][_0x6110('0x124')](db['Dynamics365Field'],{'as':_0x6110('0x1d0'),'onDelete':'cascade','foreignKey':_0x6110('0x1d4')});db[_0x6110('0x1e1')][_0x6110('0x124')](db[_0x6110('0xcf')],{'as':_0x6110('0x1d1'),'onDelete':_0x6110('0x123'),'foreignKey':_0x6110('0x1d2')});db[_0x6110('0x1e1')][_0x6110('0x124')](db[_0x6110('0xcf')],{'as':_0x6110('0x1cc'),'onDelete':_0x6110('0x123'),'foreignKey':_0x6110('0x1d7')});db[_0x6110('0x1e1')][_0x6110('0x15a')](db[_0x6110('0xcd')],{'as':_0x6110('0x17f'),'foreignKey':_0x6110('0x1d9')});db[_0x6110('0xcf')]['hasMany'](db[_0x6110('0xcf')],{'as':_0x6110('0x1d3'),'foreignKey':_0x6110('0x1d4')});db[_0x6110('0xcf')][_0x6110('0x124')](db[_0x6110('0xcf')],{'as':_0x6110('0x1d5'),'foreignKey':_0x6110('0x1d2')});db[_0x6110('0xcf')][_0x6110('0x124')](db[_0x6110('0xcf')],{'as':'Field','foreignKey':_0x6110('0x1d7')});db['Dynamics365Field'][_0x6110('0x15a')](db[_0x6110('0x99')],{'as':_0x6110('0x99'),'foreignKey':'VariableId'});db[_0x6110('0xd1')][_0x6110('0x124')](db[_0x6110('0x1e2')],{'as':_0x6110('0x1ce'),'onDelete':_0x6110('0x123'),'foreignKey':'AccountId'});db[_0x6110('0x1e2')][_0x6110('0x124')](db[_0x6110('0xd4')],{'as':_0x6110('0x1d0'),'foreignKey':'SubjectId'});db[_0x6110('0x1e2')][_0x6110('0x124')](db[_0x6110('0xd4')],{'as':'Descriptions','foreignKey':_0x6110('0x1d2')});db[_0x6110('0x1e2')]['hasMany'](db['FreshsalesField'],{'as':_0x6110('0x1cc'),'foreignKey':'FieldId'});db[_0x6110('0x1e2')][_0x6110('0x15a')](db['FreshsalesAccount'],{'as':'Account','foreignKey':_0x6110('0x1d9')});db[_0x6110('0xd4')][_0x6110('0x124')](db['FreshsalesField'],{'as':_0x6110('0x1d3'),'foreignKey':_0x6110('0x1d4')});db[_0x6110('0xd4')][_0x6110('0x124')](db[_0x6110('0xd4')],{'as':_0x6110('0x1d5'),'foreignKey':_0x6110('0x1d2')});db['FreshsalesField']['hasMany'](db[_0x6110('0xd4')],{'as':_0x6110('0x1d6'),'foreignKey':_0x6110('0x1d7')});db[_0x6110('0xd4')]['belongsTo'](db[_0x6110('0x99')],{'as':_0x6110('0x99'),'foreignKey':_0x6110('0x1d8')});db[_0x6110('0xda')][_0x6110('0x15a')](db[_0x6110('0x64')],{});db[_0x6110('0xda')]['belongsTo'](db[_0x6110('0x144')],{'as':_0x6110('0x174'),'foreignKey':'ListId'});db[_0x6110('0xda')][_0x6110('0x15a')](db[_0x6110('0x73')],{'as':'Contact','foreignKey':_0x6110('0x178')});db['ChatQueueReport']['belongsTo'](db[_0x6110('0x12a')],{});db['ChatQueueReport'][_0x6110('0x15a')](db[_0x6110('0x67')],{});db[_0x6110('0xda')][_0x6110('0x15a')](db['User'],{});db[_0x6110('0xda')][_0x6110('0x15a')](db[_0x6110('0x6b')],{});db[_0x6110('0x1a5')]['belongsTo'](db[_0x6110('0x121')],{'onDelete':_0x6110('0x123'),'foreignKey':'FromId'});db[_0x6110('0x1a5')][_0x6110('0x15a')](db[_0x6110('0x121')],{'onDelete':'cascade','foreignKey':'ToId'});db[_0x6110('0xe1')]['hasMany'](db[_0x6110('0xdf')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x6110('0xe1')][_0x6110('0x124')](db[_0x6110('0xdd')],{'foreignKey':'SessionId','onDelete':_0x6110('0x123')});db['SmsQueueReport'][_0x6110('0x15a')](db['SmsAccount'],{});db[_0x6110('0xe3')][_0x6110('0x15a')](db[_0x6110('0x144')],{'as':_0x6110('0x174'),'foreignKey':_0x6110('0x183')});db[_0x6110('0xe3')][_0x6110('0x15a')](db[_0x6110('0x73')],{'as':'Contact','foreignKey':_0x6110('0x178')});db[_0x6110('0xe3')][_0x6110('0x15a')](db[_0x6110('0x58')],{});db[_0x6110('0xe3')][_0x6110('0x15a')](db[_0x6110('0x5a')],{});db[_0x6110('0xe3')][_0x6110('0x15a')](db['User'],{});db['SmsQueueReport'][_0x6110('0x15a')](db[_0x6110('0x5c')],{});db[_0x6110('0x1e3')][_0x6110('0x124')](db[_0x6110('0xe1')],{'foreignKey':_0x6110('0x1e4')});db[_0x6110('0x1e3')][_0x6110('0x124')](db['JscriptyQuestionReport'],{'foreignKey':'ProjectId'});db[_0x6110('0x1e3')][_0x6110('0x124')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x6110('0xf1')][_0x6110('0x135')](db['User'],{'as':'Agents','through':'user_has_teams'});db[_0x6110('0xf1')][_0x6110('0x135')](db[_0x6110('0x19')],{'through':'TeamVoiceQueue','as':_0x6110('0x13f')});db[_0x6110('0xf1')][_0x6110('0x135')](db[_0x6110('0x3c')],{'through':_0x6110('0x177'),'as':_0x6110('0x1e5')});db['Team']['belongsToMany'](db[_0x6110('0x6b')],{'through':'team_has_chat_queues','as':_0x6110('0x141')});db[_0x6110('0xf1')][_0x6110('0x135')](db[_0x6110('0x51')],{'through':_0x6110('0x18c'),'as':_0x6110('0x1e6')});db[_0x6110('0xf1')][_0x6110('0x135')](db[_0x6110('0x5c')],{'through':_0x6110('0x193'),'as':'SmsQueues'});db[_0x6110('0xf1')][_0x6110('0x135')](db[_0x6110('0x62')],{'through':_0x6110('0x198'),'as':'OpenchannelQueues'});db[_0x6110('0xf1')][_0x6110('0x135')](db[_0x6110('0x115')],{'through':'team_has_whatsapp_queues','as':'WhatsappQueues'});db[_0x6110('0xf1')]['belongsToMany'](db[_0x6110('0x104')],{'through':_0x6110('0x118'),'as':_0x6110('0x140')});db[_0x6110('0xf3')]['hasMany'](db[_0x6110('0x74')],{'as':_0x6110('0x1aa'),'foreignKey':_0x6110('0x1b1')});db[_0x6110('0xf3')]['hasMany'](db[_0x6110('0x76')],{'as':_0x6110('0x127'),'foreignKey':'CampaignId'});db[_0x6110('0xf3')][_0x6110('0x124')](db[_0x6110('0x77')],{'as':_0x6110('0x157'),'foreignKey':_0x6110('0x1b1')});db['Campaign'][_0x6110('0x124')](db[_0x6110('0x1b3')],{'as':_0x6110('0x1e7'),'foreignKey':_0x6110('0x1b1')});db[_0x6110('0xf3')][_0x6110('0x15a')](db[_0x6110('0x28')],{'as':_0x6110('0x28'),'foreignKey':_0x6110('0x159')});db[_0x6110('0xf3')]['belongsTo'](db[_0x6110('0x28')],{'as':_0x6110('0x1e8'),'foreignKey':_0x6110('0x15b')});db['Campaign'][_0x6110('0x15a')](db['Interval'],{'as':_0x6110('0x85'),'foreignKey':'IntervalId'});db[_0x6110('0xf3')][_0x6110('0x15a')](db['SquareProject'],{'as':'SquareProject','foreignKey':'SquareProjectId'});db[_0x6110('0xf3')][_0x6110('0x135')](db[_0x6110('0x144')],{'as':_0x6110('0x138'),'through':_0x6110('0x1e9')});db[_0x6110('0xf3')][_0x6110('0x135')](db[_0x6110('0x144')],{'as':_0x6110('0x161'),'through':_0x6110('0x1ea')});db[_0x6110('0xf7')]['belongsTo'](db[_0x6110('0x69')],{'as':'ChatOfflineMessage','foreignKey':_0x6110('0x181')});db[_0x6110('0xfa')]['belongsTo'](db[_0x6110('0x42')],{});db[_0x6110('0xfa')][_0x6110('0x15a')](db['MailInteraction'],{});db['MailTransferReport']['belongsTo'](db[_0x6110('0x3a')],{'foreignKey':_0x6110('0x1eb'),'as':'FromAccount'});db[_0x6110('0xfa')][_0x6110('0x15a')](db[_0x6110('0x121')],{'foreignKey':_0x6110('0x1ec'),'as':'FromAgent'});db['MailTransferReport'][_0x6110('0x15a')](db[_0x6110('0x121')],{'foreignKey':_0x6110('0x1ed'),'as':_0x6110('0x1ee')});db[_0x6110('0xfa')]['belongsTo'](db['MailQueue'],{'foreignKey':_0x6110('0x1ef'),'as':'ToQueue'});db['MailTransferReport'][_0x6110('0x15a')](db[_0x6110('0x3a')],{'foreignKey':_0x6110('0x1f0'),'as':'ToAccount'});db[_0x6110('0xfc')][_0x6110('0x15a')](db[_0x6110('0x67')],{});db['ChatTransferReport'][_0x6110('0x15a')](db[_0x6110('0x12a')],{});db[_0x6110('0xfc')]['belongsTo'](db[_0x6110('0x64')],{'foreignKey':_0x6110('0x1f1'),'as':_0x6110('0x1f2')});db[_0x6110('0xfc')][_0x6110('0x15a')](db[_0x6110('0x121')],{'foreignKey':_0x6110('0x1ec'),'as':_0x6110('0x1f3')});db[_0x6110('0xfc')]['belongsTo'](db['User'],{'foreignKey':_0x6110('0x1ed'),'as':_0x6110('0x1ee')});db[_0x6110('0xfc')]['belongsTo'](db[_0x6110('0x6b')],{'foreignKey':_0x6110('0x1f4'),'as':_0x6110('0x1f5')});db[_0x6110('0xfc')][_0x6110('0x15a')](db[_0x6110('0x64')],{'foreignKey':'ToChatWebsiteId','as':_0x6110('0x1f6')});db[_0x6110('0xfe')][_0x6110('0x15a')](db[_0x6110('0x4f')],{});db[_0x6110('0xfe')][_0x6110('0x15a')](db['FaxInteraction'],{});db[_0x6110('0xfe')][_0x6110('0x15a')](db['FaxAccount'],{'foreignKey':_0x6110('0x1f7'),'as':'FromAccount'});db[_0x6110('0xfe')][_0x6110('0x15a')](db[_0x6110('0x121')],{'foreignKey':'FromUserId','as':_0x6110('0x1f3')});db[_0x6110('0xfe')][_0x6110('0x15a')](db[_0x6110('0x121')],{'foreignKey':_0x6110('0x1ed'),'as':'ToAgent'});db[_0x6110('0xfe')]['belongsTo'](db[_0x6110('0x51')],{'foreignKey':_0x6110('0x1f8'),'as':_0x6110('0x1f5')});db[_0x6110('0xfe')][_0x6110('0x15a')](db[_0x6110('0x147')],{'foreignKey':'ToFaxAccountId','as':_0x6110('0x1f6')});db[_0x6110('0x1f9')][_0x6110('0x15a')](db[_0x6110('0x61')],{});db[_0x6110('0x1f9')][_0x6110('0x15a')](db['OpenchannelInteraction'],{});db[_0x6110('0x1f9')][_0x6110('0x15a')](db[_0x6110('0x5d')],{'foreignKey':_0x6110('0x1fa'),'as':_0x6110('0x1f2')});db[_0x6110('0x1f9')][_0x6110('0x15a')](db[_0x6110('0x121')],{'foreignKey':_0x6110('0x1ec'),'as':_0x6110('0x1f3')});db[_0x6110('0x1f9')]['belongsTo'](db['User'],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x6110('0x1f9')][_0x6110('0x15a')](db['OpenchannelQueue'],{'foreignKey':_0x6110('0x1fb'),'as':_0x6110('0x1f5')});db[_0x6110('0x1f9')][_0x6110('0x15a')](db[_0x6110('0x5d')],{'foreignKey':'ToOpenchannelAccountId','as':_0x6110('0x1f6')});db['SmsTransferReport'][_0x6110('0x15a')](db[_0x6110('0x5a')],{});db['SmsTransferReport'][_0x6110('0x15a')](db[_0x6110('0x58')],{});db[_0x6110('0x101')]['belongsTo'](db[_0x6110('0x54')],{'foreignKey':_0x6110('0x1fc'),'as':'FromAccount'});db[_0x6110('0x101')][_0x6110('0x15a')](db['User'],{'foreignKey':'FromUserId','as':_0x6110('0x1f3')});db[_0x6110('0x101')][_0x6110('0x15a')](db[_0x6110('0x121')],{'foreignKey':_0x6110('0x1ed'),'as':_0x6110('0x1ee')});db['SmsTransferReport'][_0x6110('0x15a')](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x6110('0x1f5')});db['SmsTransferReport'][_0x6110('0x15a')](db[_0x6110('0x54')],{'foreignKey':_0x6110('0x1fd'),'as':_0x6110('0x1f6')});db[_0x6110('0x144')]['hasMany'](db[_0x6110('0x82')],{'as':'Dispositions','foreignKey':_0x6110('0x183'),'onDelete':_0x6110('0x123')});db[_0x6110('0x144')][_0x6110('0x124')](db[_0x6110('0x7b')],{'as':_0x6110('0x1fe'),'foreignKey':_0x6110('0x183')});db['CmList']['hasMany'](db[_0x6110('0x73')],{'as':_0x6110('0x136'),'onDelete':_0x6110('0x123'),'foreignKey':'ListId'});db['CmList'][_0x6110('0x124')](db['CmHopperFinal'],{'as':_0x6110('0x127'),'foreignKey':_0x6110('0x183')});db['CmList']['hasMany'](db[_0x6110('0x77')],{'as':'HopperHistory','foreignKey':_0x6110('0x183')});db[_0x6110('0x144')][_0x6110('0x124')](db[_0x6110('0x79')],{'as':'ReportAgentPreview','foreignKey':_0x6110('0x183')});db[_0x6110('0x144')][_0x6110('0x135')](db[_0x6110('0x19')],{'as':_0x6110('0x1ff'),'through':_0x6110('0x15d')});db[_0x6110('0x144')][_0x6110('0x135')](db[_0x6110('0x121')],{'as':'Agents','through':'cm_user_has_lists'});db[_0x6110('0x104')][_0x6110('0x124')](db[_0x6110('0x17')],{'as':'Extensions','onDelete':_0x6110('0x123')});db['VoicePrefix']['belongsToMany'](db[_0x6110('0x121')],{'as':_0x6110('0x15e'),'through':'UserVoicePrefix'});db['VoicePrefix'][_0x6110('0x135')](db[_0x6110('0xf1')],{'through':_0x6110('0x118'),'as':_0x6110('0x15f')});db[_0x6110('0x132')][_0x6110('0x124')](db[_0x6110('0x121')],{'as':_0x6110('0x17c'),'foreignKey':_0x6110('0x200')});db['UserProfile'][_0x6110('0x124')](db[_0x6110('0x107')],{'as':_0x6110('0x201'),'foreignKey':_0x6110('0x200'),'onDelete':'cascade'});db[_0x6110('0x107')][_0x6110('0x124')](db[_0x6110('0x109')],{'as':_0x6110('0x202'),'foreignKey':'sectionId','onDelete':_0x6110('0x123')});db[_0x6110('0x10c')][_0x6110('0x124')](db[_0x6110('0x82')],{'as':_0x6110('0x16f'),'foreignKey':'WhatsappAccountId','onDelete':_0x6110('0x123')});db[_0x6110('0x10c')][_0x6110('0x124')](db['CannedAnswer'],{'as':_0x6110('0x171'),'foreignKey':_0x6110('0x203')});db[_0x6110('0x10c')]['hasMany'](db[_0x6110('0x111')],{'as':_0x6110('0x172'),'foreignKey':_0x6110('0x203')});db[_0x6110('0x10c')][_0x6110('0x124')](db[_0x6110('0x110')],{'as':_0x6110('0x173')});db[_0x6110('0x10c')][_0x6110('0x124')](db[_0x6110('0x10e')],{'as':_0x6110('0x187')});db[_0x6110('0x10c')][_0x6110('0x15a')](db[_0x6110('0x144')],{'as':'List','foreignKey':'ListId'});db[_0x6110('0x10c')][_0x6110('0x15a')](db[_0x6110('0x87')],{'as':_0x6110('0x176'),'foreignKey':_0x6110('0x18e')});db[_0x6110('0x10c')][_0x6110('0x135')](db[_0x6110('0x121')],{'as':_0x6110('0x15e'),'through':_0x6110('0x14f')});db[_0x6110('0x10e')][_0x6110('0x15a')](db['User'],{'onDelete':_0x6110('0x16c')});db[_0x6110('0x10e')]['belongsTo'](db[_0x6110('0x115')],{'onDelete':_0x6110('0x16c')});db['WhatsappApplication'][_0x6110('0x15a')](db[_0x6110('0x10c')],{'onDelete':'restrict'});db[_0x6110('0x10e')]['belongsTo'](db[_0x6110('0x85')],{'onDelete':_0x6110('0x16c'),'foreignKey':_0x6110('0x15c')});db[_0x6110('0x10e')]['belongsTo'](db['Tag'],{'onDelete':_0x6110('0x16c'),'foreignKey':_0x6110('0x182')});db[_0x6110('0x110')][_0x6110('0x124')](db[_0x6110('0x111')],{'as':_0x6110('0x172'),'onDelete':_0x6110('0x123'),'foreignKey':_0x6110('0x204')});db['WhatsappInteraction'][_0x6110('0x15a')](db[_0x6110('0x10c')],{'as':_0x6110('0x17f'),'foreignKey':'WhatsappAccountId'});db['WhatsappInteraction']['belongsTo'](db['CmContact'],{'as':_0x6110('0x169'),'foreignKey':_0x6110('0x178')});db[_0x6110('0x110')]['belongsTo'](db[_0x6110('0x121')],{'as':_0x6110('0x179'),'foreignKey':_0x6110('0x120')});db['WhatsappInteraction']['belongsToMany'](db[_0x6110('0x90')],{'through':_0x6110('0x1c1'),'as':_0x6110('0x17b')});db[_0x6110('0x110')]['belongsToMany'](db[_0x6110('0x90')],{'through':_0x6110('0x1c1'),'as':_0x6110('0x18b')});db[_0x6110('0x110')][_0x6110('0x135')](db['User'],{'as':'Users','through':_0x6110('0x13e'),'foreignKey':_0x6110('0x204')});db[_0x6110('0x111')][_0x6110('0x15a')](db['User'],{'as':'User'});db[_0x6110('0x111')][_0x6110('0x15a')](db[_0x6110('0x73')],{'onDelete':_0x6110('0x123'),'as':_0x6110('0x169')});db[_0x6110('0x111')]['belongsTo'](db[_0x6110('0x110')],{'onDelete':_0x6110('0x123'),'as':_0x6110('0x17e'),'foreignKey':_0x6110('0x204')});db[_0x6110('0x111')]['belongsTo'](db['WhatsappAccount'],{'as':_0x6110('0x17f'),'foreignKey':'WhatsappAccountId'});db[_0x6110('0x205')][_0x6110('0x15a')](db[_0x6110('0x10c')],{});db[_0x6110('0x205')][_0x6110('0x15a')](db[_0x6110('0x144')],{'as':_0x6110('0x174'),'foreignKey':_0x6110('0x183')});db[_0x6110('0x205')][_0x6110('0x15a')](db[_0x6110('0x73')],{'as':'Contact','foreignKey':_0x6110('0x178')});db['WhatsappQueueReport']['belongsTo'](db[_0x6110('0x110')],{});db[_0x6110('0x205')][_0x6110('0x15a')](db[_0x6110('0x115')],{});db[_0x6110('0x205')][_0x6110('0x15a')](db[_0x6110('0x111')],{});db[_0x6110('0x205')][_0x6110('0x15a')](db[_0x6110('0x121')],{});db[_0x6110('0x114')][_0x6110('0x15a')](db['WhatsappMessage'],{});db['WhatsappTransferReport']['belongsTo'](db[_0x6110('0x110')],{});db['WhatsappTransferReport'][_0x6110('0x15a')](db[_0x6110('0x10c')],{'foreignKey':'FromWhatsappAccountId','as':_0x6110('0x1f2')});db['WhatsappTransferReport'][_0x6110('0x15a')](db[_0x6110('0x10c')],{'foreignKey':_0x6110('0x206'),'as':_0x6110('0x1f6')});db['WhatsappTransferReport'][_0x6110('0x15a')](db[_0x6110('0x115')],{'foreignKey':_0x6110('0x207'),'as':'ToQueue'});db[_0x6110('0x114')][_0x6110('0x15a')](db[_0x6110('0x121')],{'foreignKey':_0x6110('0x1ec'),'as':_0x6110('0x1f3')});db[_0x6110('0x114')][_0x6110('0x15a')](db['User'],{'foreignKey':_0x6110('0x1ed'),'as':_0x6110('0x1ee')});db[_0x6110('0x115')][_0x6110('0x135')](db[_0x6110('0x121')],{'as':_0x6110('0x15e'),'through':_0x6110('0x143'),'foreignKey':_0x6110('0x208')});db[_0x6110('0x115')][_0x6110('0x135')](db['Team'],{'through':_0x6110('0x209'),'as':_0x6110('0x15f')});db[_0x6110('0x11c')][_0x6110('0x15a')](db['User'],{'as':_0x6110('0x20a'),'foreignKey':_0x6110('0x120'),'onDelete':'cascade','hooks':!![]});db[_0x6110('0x116')][_0x6110('0x11e')](db[_0x6110('0xcd')],{'as':_0x6110('0xcd'),'onDelete':_0x6110('0x16c')});db[_0x6110('0x116')][_0x6110('0x11e')](db[_0x6110('0x37')],{'as':_0x6110('0x16d'),'onDelete':'restrict'});db[_0x6110('0x116')][_0x6110('0x11e')](db['MailServerOut'],{'as':_0x6110('0x16e'),'onDelete':_0x6110('0x16c')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xbc18=['../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','CmList','../api/cmList/cmList.model','VoicePrefix','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','hasOne','cascade','UserId','userSetting','Recordings','hasMany','VoiceExtension','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','SenderId','belongsTo','userProfileId','Groups','chat_group_has_users','belongsToMany','cm_user_has_contacts','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','WhatsappInteractions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','UserFaxQueue','SmsQueues','OpenchannelQueues','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccount','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','Applications','Sound','Sounds','moh_has_sounds','VoiceQueueId','CmHopper','Hoppers','HopperHistories','JscriptySessionReport','TrunkBackup','Interval','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','mailbox','mailboxuser','VoiceCallReport','VoiceQueueReport','QueueCalls','uniqueid','Contact','ContactId','MailAccountId','CloudProvider','CloudProviderId','restrict','MailServerOut','Imap','Smtp','Dispositions','Answers','Messages','Interactions','List','ListId','Template','TemplateId','team_has_mail_queues','MailInteractionId','Account','Owner','Tag','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachments','Interaction','ChatOfflineMessageId','Dashboard','Items','Disposition','FaxAccountId','FaxApplication','TagId','FaxMessage','FaxInteractionId','fax_interaction_has_tags','team_has_fax_queues','SmsAccountId','SmsMessage','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','OpenchannelQueueReport','Agent','Queue','ChatQueueId','Website','chat_interaction_has_tags','ChatInteractionId','AttachmentId','team_has_chat_queues','ChatGroupId','Members','Contacts','CompanyId','Phones','JscriptySessions','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CampaignId','OwnerId','Automation','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','Schedule','DefaultReportId','AnalyticCustomReport','CustomReportId','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Hopper','CmContactId','TriggerAllId','AnyCondition','Actions','Fields','MetricId','SalesforceAccount','Configurations','AccountId','Subjects','SubjectId','FieldId','Description','DescriptionId','Variable','VariableId','Descriptions','Subject','Field','DeskConfiguration','DeskField','int_desk_configuration_has_tags','ZohoAccount','ZendeskConfiguration','ZendeskField','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','Dynamics365Account','FreshsalesConfiguration','FromId','ToId','JscriptyQuestionReport','SessionId','JscriptyProject','ProjectId','MailQueues','team_has_whatsapp_queues','HopperBlacks','TrunkId','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToAccount','FromChatWebsiteId','FromAgent','ToChatQueueId','FromFaxAccountId','ToFaxAccountId','ToOpenchannelAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','WhatsappAccount','WhatsappAccountId','WhatsappMessage','user_has_whatsapp_accounts','WhatsappInteractionId','user_has_whatsapp_interactions','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','../config/environment','sequelize','lodash','determine','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8_general_ci','sequelizeHistory','defaultsDeep','utf8','username','password','options','User','../api/user/user.model','VoiceChanSpy','import','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Pause','../api/pause/pause.model','VoiceQueuesLog','../api/sound/sound.model','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','../api/template/template.model','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','ServicenowConfiguration','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','SquareRecording','../api/squareRecording/squareRecording.model','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','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport'];(function(_0x10406f,_0x89309b){var _0x28d4d3=function(_0x15608e){while(--_0x15608e){_0x10406f['push'](_0x10406f['shift']());}};_0x28d4d3(++_0x89309b);}(_0xbc18,0x117));var _0x8bc1=function(_0x18a772,_0x1a4d3f){_0x18a772=_0x18a772-0x0;var _0xbaac04=_0xbc18[_0x18a772];return _0xbaac04;};'use strict';var config=require(_0x8bc1('0x0'));var Sequelize=require(_0x8bc1('0x1'));var _=require(_0x8bc1('0x2'));var jstz=require('jstz');var timezone=jstz[_0x8bc1('0x3')]();config[_0x8bc1('0x1')]=_['defaultsDeep'](config[_0x8bc1('0x1')],{'database':_0x8bc1('0x4'),'username':_0x8bc1('0x5'),'password':_0x8bc1('0x6'),'options':{'host':_0x8bc1('0x7'),'port':0xcea,'dialect':_0x8bc1('0x8'),'dialectOptions':{'charset':_0x8bc1('0x9')},'logging':![],'timezone':timezone[_0x8bc1('0xa')](),'define':{'charset':'utf8','collate':_0x8bc1('0xb')}}});config[_0x8bc1('0xc')]=_[_0x8bc1('0xd')](config[_0x8bc1('0xc')],{'database':'motion2','username':_0x8bc1('0x5'),'password':_0x8bc1('0x6'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x8bc1('0x8'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x8bc1('0xe'),'collate':_0x8bc1('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x8bc1('0x1')]['database'],config[_0x8bc1('0x1')][_0x8bc1('0xf')],config[_0x8bc1('0x1')][_0x8bc1('0x10')],config['sequelize'][_0x8bc1('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x8bc1('0xc')]['database'],config[_0x8bc1('0xc')]['username'],config['sequelizeHistory'][_0x8bc1('0x10')],config['sequelizeHistory'][_0x8bc1('0x11')])};db[_0x8bc1('0x12')]=db['sequelize']['import'](_0x8bc1('0x13'));db[_0x8bc1('0x14')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0x8bc1('0x16')]=db['sequelize'][_0x8bc1('0x15')](_0x8bc1('0x17'));db['VoiceExtension']=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0x18'));db[_0x8bc1('0x19')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x8bc1('0x1a')]=db[_0x8bc1('0x1')]['import'](_0x8bc1('0x1b'));db[_0x8bc1('0x1c')]=db[_0x8bc1('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x8bc1('0x1d')]=db['sequelize'][_0x8bc1('0x15')](_0x8bc1('0x1e'));db[_0x8bc1('0x1f')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0x20'));db[_0x8bc1('0x21')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0x22'));db['VoiceCallReport']=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0x23'));db[_0x8bc1('0x24')]=db['sequelize'][_0x8bc1('0x15')](_0x8bc1('0x25'));db[_0x8bc1('0x26')]=db[_0x8bc1('0x1')]['import']('../api/voiceAgentReport/voiceAgentReport.model');db['VoiceQueueReport']=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0x27'));db[_0x8bc1('0x28')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0x29'));db[_0x8bc1('0x2a')]=db['sequelize'][_0x8bc1('0x15')](_0x8bc1('0x2b'));db[_0x8bc1('0x2c')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0x2d'));db[_0x8bc1('0x2e')]=db['sequelize'][_0x8bc1('0x15')](_0x8bc1('0x2f'));db[_0x8bc1('0x30')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0x31'));db['UserChatQueue']=db[_0x8bc1('0x1')]['import'](_0x8bc1('0x32'));db[_0x8bc1('0x33')]=db['sequelize']['import'](_0x8bc1('0x34'));db['UserFaxQueue']=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0x35'));db[_0x8bc1('0x36')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0x37'));db[_0x8bc1('0x38')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x8bc1('0x39')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0x3a'));db[_0x8bc1('0x3b')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0x3c'));db['MailServerOut']=db['sequelize'][_0x8bc1('0x15')](_0x8bc1('0x3d'));db['MailAccount']=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0x3e'));db[_0x8bc1('0x3f')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0x40'));db[_0x8bc1('0x41')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0x42'));db[_0x8bc1('0x43')]=db['sequelize'][_0x8bc1('0x15')]('../api/mailInteraction/mailInteraction.model');db[_0x8bc1('0x44')]=db['sequelize'][_0x8bc1('0x15')](_0x8bc1('0x45'));db[_0x8bc1('0x46')]=db[_0x8bc1('0x1')]['import'](_0x8bc1('0x47'));db[_0x8bc1('0x48')]=db[_0x8bc1('0x1')]['import'](_0x8bc1('0x49'));db['Dashboard']=db[_0x8bc1('0x1')]['import'](_0x8bc1('0x4a'));db[_0x8bc1('0x4b')]=db[_0x8bc1('0x1')]['import']('../api/dashboardItem/dashboardItem.model');db[_0x8bc1('0x4c')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0x4d'));db['FaxApplication']=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0x4e'));db[_0x8bc1('0x4f')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0x50'));db['FaxMessage']=db[_0x8bc1('0x1')]['import'](_0x8bc1('0x51'));db[_0x8bc1('0x52')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0x53'));db[_0x8bc1('0x54')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0x55'));db[_0x8bc1('0x56')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')]('../api/smsAccount/smsAccount.model');db[_0x8bc1('0x57')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')]('../api/smsApplication/smsApplication.model');db[_0x8bc1('0x58')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0x59'));db['SmsMessage']=db['sequelize'][_0x8bc1('0x15')]('../api/smsMessage/smsMessage.model');db[_0x8bc1('0x5a')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0x5b'));db[_0x8bc1('0x5c')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')]('../api/openchannelAccount/openchannelAccount.model');db[_0x8bc1('0x5d')]=db[_0x8bc1('0x1')]['import'](_0x8bc1('0x5e'));db[_0x8bc1('0x5f')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0x60'));db['OpenchannelMessage']=db['sequelize'][_0x8bc1('0x15')](_0x8bc1('0x61'));db[_0x8bc1('0x62')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0x63'));db[_0x8bc1('0x64')]=db[_0x8bc1('0x1')]['import']('../api/chatWebsite/chatWebsite.model');db['OpenchannelQueueReport']=db['sequelize'][_0x8bc1('0x15')](_0x8bc1('0x65'));db[_0x8bc1('0x66')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0x67'));db[_0x8bc1('0x68')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0x69'));db[_0x8bc1('0x6a')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0x6b'));db[_0x8bc1('0x6c')]=db['sequelize'][_0x8bc1('0x15')](_0x8bc1('0x6d'));db[_0x8bc1('0x6e')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0x6f'));db[_0x8bc1('0x70')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0x71'));db[_0x8bc1('0x72')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0x73'));db[_0x8bc1('0x74')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0x75'));db[_0x8bc1('0x76')]=db[_0x8bc1('0x1')]['import'](_0x8bc1('0x77'));db['CmHopper']=db[_0x8bc1('0x1')][_0x8bc1('0x15')]('../api/cmHopper/cmHopper.model');db[_0x8bc1('0x78')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0x79'));db[_0x8bc1('0x7a')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0x8bc1('0x7b')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0x7c'));db[_0x8bc1('0x7d')]=db[_0x8bc1('0x1')]['import']('../api/reportAgentPreview/reportAgentPreview.model');db[_0x8bc1('0x7e')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0x7f'));db[_0x8bc1('0x80')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0x81'));db['Automation']=db[_0x8bc1('0x1')][_0x8bc1('0x15')]('../api/automation/automation.model');db[_0x8bc1('0x82')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0x83'));db['Disposition']=db['sequelize'][_0x8bc1('0x15')](_0x8bc1('0x84'));db[_0x8bc1('0x85')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0x86'));db['Interval']=db['sequelize']['import']('../api/interval/interval.model');db[_0x8bc1('0x87')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0x88'));db['Cdr']=db[_0x8bc1('0x1')][_0x8bc1('0x15')]('../api/cdr/cdr.model');db[_0x8bc1('0x89')]=db[_0x8bc1('0x1')]['import']('../api/voiceQueuesLog/voiceQueuesLog.model');db['Schedule']=db['sequelize'][_0x8bc1('0x15')]('../api/schedule/schedule.model');db['Sound']=db[_0x8bc1('0x1')]['import'](_0x8bc1('0x8a'));db['Tag']=db['sequelize'][_0x8bc1('0x15')](_0x8bc1('0x8b'));db[_0x8bc1('0x8c')]=db[_0x8bc1('0x1')]['import'](_0x8bc1('0x8d'));db[_0x8bc1('0x8e')]=db['sequelize'][_0x8bc1('0x15')]('../api/cmContactHasItem/cmContactHasItem.model');db['CmHopperAdditionalPhone']=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0x8f'));db['Template']=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0x90'));db[_0x8bc1('0x91')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0x92'));db['Variable']=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0x93'));db[_0x8bc1('0x94')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0x95'));db[_0x8bc1('0x96')]=db['sequelize']['import'](_0x8bc1('0x97'));db['AnalyticCustomReport']=db[_0x8bc1('0x1')][_0x8bc1('0x15')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0x8bc1('0x98')]=db[_0x8bc1('0x1')]['import'](_0x8bc1('0x99'));db['AnalyticExtractedReport']=db['sequelize'][_0x8bc1('0x15')](_0x8bc1('0x9a'));db[_0x8bc1('0x9b')]=db[_0x8bc1('0x1')]['import'](_0x8bc1('0x9c'));db[_0x8bc1('0x9d')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0x9e'));db[_0x8bc1('0x9f')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0xa0'));db['SalesforceAccount']=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0xa1'));db[_0x8bc1('0xa2')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0xa3'));db[_0x8bc1('0xa4')]=db['sequelize'][_0x8bc1('0x15')](_0x8bc1('0xa5'));db[_0x8bc1('0xa6')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0xa7'));db[_0x8bc1('0xa8')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0xa9'));db[_0x8bc1('0xaa')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0xab'));db[_0x8bc1('0xac')]=db['sequelize'][_0x8bc1('0x15')](_0x8bc1('0xad'));db['DeskConfiguration']=db[_0x8bc1('0x1')][_0x8bc1('0x15')]('../api/intDeskConfiguration/intDeskConfiguration.model');db['DeskField']=db['sequelize'][_0x8bc1('0x15')]('../api/intDeskField/intDeskField.model');db['ZohoAccount']=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0xae'));db[_0x8bc1('0xaf')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0xb0'));db[_0x8bc1('0xb1')]=db['sequelize'][_0x8bc1('0x15')]('../api/intZohoField/intZohoField.model');db[_0x8bc1('0xb2')]=db['sequelize']['import'](_0x8bc1('0xb3'));db['ZendeskConfiguration']=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0xb4'));db['ZendeskField']=db['sequelize'][_0x8bc1('0x15')](_0x8bc1('0xb5'));db[_0x8bc1('0xb6')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0xb7'));db[_0x8bc1('0xb8')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x8bc1('0xb9')]=db[_0x8bc1('0x1')]['import'](_0x8bc1('0xba'));db[_0x8bc1('0xbb')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0x8bc1('0xbc')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x8bc1('0xbd')]=db['sequelize']['import'](_0x8bc1('0xbe'));db[_0x8bc1('0xbf')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0x8bc1('0xc0')]=db[_0x8bc1('0x1')]['import']('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x8bc1('0xc1')]=db[_0x8bc1('0x1')]['import'](_0x8bc1('0xc2'));db['Dynamics365Account']=db['sequelize'][_0x8bc1('0x15')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x8bc1('0xc3')]=db['sequelize'][_0x8bc1('0x15')](_0x8bc1('0xc4'));db[_0x8bc1('0xc5')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0xc6'));db[_0x8bc1('0xc7')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0xc8'));db['FreshsalesConfiguration']=db['sequelize'][_0x8bc1('0x15')](_0x8bc1('0xc9'));db[_0x8bc1('0xca')]=db['sequelize']['import'](_0x8bc1('0xcb'));db[_0x8bc1('0x94')]=db['sequelize'][_0x8bc1('0x15')](_0x8bc1('0x95'));db[_0x8bc1('0xcc')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0xcd'));db[_0x8bc1('0xce')]=db[_0x8bc1('0x1')]['import']('../api/chatQueueReport/chatQueueReport.model');db[_0x8bc1('0xcf')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x8bc1('0xd0')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0xd1'));db['JscriptyQuestionReport']=db[_0x8bc1('0x1')][_0x8bc1('0x15')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db['JscriptySessionReport']=db[_0x8bc1('0x1')][_0x8bc1('0x15')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x8bc1('0xd2')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0xd3'));db[_0x8bc1('0xd4')]=db[_0x8bc1('0x1')]['import'](_0x8bc1('0xd5'));db[_0x8bc1('0xd6')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0xd7'));db['JscriptyProject']=db['sequelize']['import'](_0x8bc1('0xd8'));db[_0x8bc1('0xd9')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')]('../api/setting/setting.model');db[_0x8bc1('0xda')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0xdb'));db[_0x8bc1('0xdc')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')]('../api/squareProject/squareProject.model');db[_0x8bc1('0xdd')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0xde'));db[_0x8bc1('0xdf')]=db[_0x8bc1('0x1')]['import'](_0x8bc1('0xe0'));db[_0x8bc1('0xe1')]=db['sequelize']['import'](_0x8bc1('0xe2'));db[_0x8bc1('0xe3')]=db[_0x8bc1('0x1')]['import'](_0x8bc1('0xe4'));db[_0x8bc1('0xe5')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0xe6'));db[_0x8bc1('0xe7')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0xe8'));db[_0x8bc1('0xe9')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0xea'));db[_0x8bc1('0xeb')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0xec'));db['MailTransferReport']=db[_0x8bc1('0x1')]['import'](_0x8bc1('0xed'));db[_0x8bc1('0xee')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0xef'));db[_0x8bc1('0xf0')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0xf1'));db[_0x8bc1('0xf2')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0xf3'));db[_0x8bc1('0xf4')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')]('../api/smsTransferReport/smsTransferReport.model');db[_0x8bc1('0xf5')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0xf6'));db[_0x8bc1('0xf7')]=db['sequelize'][_0x8bc1('0x15')]('../api/voicePrefix/voicePrefix.model');db[_0x8bc1('0xf8')]=db['sequelize'][_0x8bc1('0x15')](_0x8bc1('0xf9'));db[_0x8bc1('0xfa')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0xfb'));db[_0x8bc1('0xfc')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0xfd'));db[_0x8bc1('0xfe')]=db['sequelize'][_0x8bc1('0x15')](_0x8bc1('0xff'));db['WhatsappAccount']=db['sequelize']['import'](_0x8bc1('0x100'));db[_0x8bc1('0x101')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0x102'));db[_0x8bc1('0x103')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0x104'));db['WhatsappMessage']=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0x105'));db[_0x8bc1('0x106')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')]('../api/whatsappQueueReport/whatsappQueueReport.model');db['WhatsappTransferReport']=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0x107'));db[_0x8bc1('0x108')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')]('../api/whatsappQueue/whatsappQueue.model');db['CloudProvider']=db['sequelize'][_0x8bc1('0x15')](_0x8bc1('0x109'));db[_0x8bc1('0x10a')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')]('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0x8bc1('0x10b')]=db[_0x8bc1('0x1')][_0x8bc1('0x15')](_0x8bc1('0x10c'));db[_0x8bc1('0x10d')]=db['sequelize'][_0x8bc1('0x15')](_0x8bc1('0x10e'));db[_0x8bc1('0x10f')]=db['sequelize'][_0x8bc1('0x15')](_0x8bc1('0x110'));db[_0x8bc1('0x12')][_0x8bc1('0x111')](db[_0x8bc1('0x1f')],{'as':_0x8bc1('0x1f'),'onDelete':_0x8bc1('0x112'),'foreignKey':_0x8bc1('0x113')});db[_0x8bc1('0x12')]['hasOne'](db['UserSetting'],{'as':_0x8bc1('0x114'),'onDelete':'cascade','foreignKey':'UserId'});db[_0x8bc1('0x12')]['hasMany'](db['VoiceRecording'],{'as':_0x8bc1('0x115'),'foreignKey':_0x8bc1('0x113')});db[_0x8bc1('0x12')][_0x8bc1('0x116')](db[_0x8bc1('0x2e')],{'as':'VoiceQueuesRt','foreignKey':_0x8bc1('0x113')});db[_0x8bc1('0x12')]['hasMany'](db[_0x8bc1('0x117')],{'as':_0x8bc1('0x118'),'onDelete':_0x8bc1('0x112'),'hooks':!![]});db[_0x8bc1('0x12')]['hasMany'](db[_0x8bc1('0x7a')],{'as':_0x8bc1('0x119'),'foreignKey':_0x8bc1('0x113')});db[_0x8bc1('0x12')][_0x8bc1('0x116')](db[_0x8bc1('0x7b')],{'as':_0x8bc1('0x11a'),'foreignKey':_0x8bc1('0x113')});db[_0x8bc1('0x12')][_0x8bc1('0x116')](db[_0x8bc1('0x7d')],{'as':'ReportAgentPreview','foreignKey':'UserId'});db[_0x8bc1('0x12')]['hasMany'](db['OpenchannelInteraction'],{'as':_0x8bc1('0x11b'),'foreignKey':_0x8bc1('0x113')});db[_0x8bc1('0x12')][_0x8bc1('0x116')](db[_0x8bc1('0x68')],{'as':_0x8bc1('0x11c'),'foreignKey':_0x8bc1('0x113')});db[_0x8bc1('0x12')][_0x8bc1('0x116')](db[_0x8bc1('0x58')],{'as':_0x8bc1('0x11d'),'foreignKey':'UserId'});db[_0x8bc1('0x12')][_0x8bc1('0x116')](db[_0x8bc1('0x4f')],{'as':_0x8bc1('0x11e'),'foreignKey':_0x8bc1('0x113')});db[_0x8bc1('0x12')][_0x8bc1('0x116')](db[_0x8bc1('0x43')],{'as':_0x8bc1('0x11f'),'foreignKey':_0x8bc1('0x113')});db[_0x8bc1('0x12')]['hasMany'](db[_0x8bc1('0x103')],{'as':'WhatsappInteractions','foreignKey':_0x8bc1('0x113')});db[_0x8bc1('0x12')][_0x8bc1('0x116')](db[_0x8bc1('0xfe')],{'as':'UserNotifications','foreignKey':_0x8bc1('0x120')});db[_0x8bc1('0x12')][_0x8bc1('0x121')](db['UserProfile'],{'as':'UserProfile','foreignKey':_0x8bc1('0x122')});db['User']['belongsToMany'](db[_0x8bc1('0x70')],{'as':_0x8bc1('0x123'),'through':_0x8bc1('0x124')});db['User'][_0x8bc1('0x125')](db[_0x8bc1('0x76')],{'as':'Contacts','through':_0x8bc1('0x126')});db[_0x8bc1('0x12')][_0x8bc1('0x125')](db[_0x8bc1('0xf5')],{'as':'Lists','through':_0x8bc1('0x127')});db[_0x8bc1('0x12')][_0x8bc1('0x125')](db[_0x8bc1('0xe1')],{'through':_0x8bc1('0x128')});db[_0x8bc1('0x12')][_0x8bc1('0x125')](db[_0x8bc1('0x43')],{'as':_0x8bc1('0x11f'),'through':_0x8bc1('0x129')});db[_0x8bc1('0x12')][_0x8bc1('0x125')](db['ChatInteraction'],{'as':'ChatInteractions','through':_0x8bc1('0x12a')});db[_0x8bc1('0x12')][_0x8bc1('0x125')](db['FaxInteraction'],{'as':_0x8bc1('0x11e'),'through':_0x8bc1('0x12b')});db[_0x8bc1('0x12')][_0x8bc1('0x125')](db['SmsInteraction'],{'as':_0x8bc1('0x11d'),'through':_0x8bc1('0x12c')});db['User'][_0x8bc1('0x125')](db[_0x8bc1('0x5f')],{'as':_0x8bc1('0x11b'),'through':_0x8bc1('0x12d')});db['User'][_0x8bc1('0x125')](db[_0x8bc1('0x103')],{'as':_0x8bc1('0x12e'),'through':'user_has_whatsapp_interactions'});db[_0x8bc1('0x12')][_0x8bc1('0x125')](db['VoiceQueue'],{'as':_0x8bc1('0x12f'),'through':'UserVoiceQueue','required':![]});db[_0x8bc1('0x12')][_0x8bc1('0x125')](db[_0x8bc1('0xf7')],{'as':_0x8bc1('0x130'),'through':_0x8bc1('0x10d'),'required':![]});db['User'][_0x8bc1('0x125')](db[_0x8bc1('0x3f')],{'as':'MailQueues','through':_0x8bc1('0x33'),'required':![]});db[_0x8bc1('0x12')][_0x8bc1('0x125')](db['ChatQueue'],{'as':_0x8bc1('0x131'),'through':_0x8bc1('0x132'),'required':![],'hooks':!![]});db['User']['belongsToMany'](db[_0x8bc1('0x52')],{'as':_0x8bc1('0x133'),'through':_0x8bc1('0x134'),'required':![]});db[_0x8bc1('0x12')][_0x8bc1('0x125')](db['SmsQueue'],{'as':_0x8bc1('0x135'),'through':_0x8bc1('0x36'),'required':![]});db['User']['belongsToMany'](db[_0x8bc1('0x62')],{'as':_0x8bc1('0x136'),'through':_0x8bc1('0x38'),'required':![]});db[_0x8bc1('0x12')][_0x8bc1('0x125')](db[_0x8bc1('0x108')],{'as':_0x8bc1('0x137'),'through':_0x8bc1('0x39'),'required':![]});db['User'][_0x8bc1('0x125')](db['CmList'],{'through':'cm_user_has_lists'});db[_0x8bc1('0x12')][_0x8bc1('0x125')](db[_0x8bc1('0x64')],{'as':_0x8bc1('0x138'),'through':_0x8bc1('0x139')});db[_0x8bc1('0x12')][_0x8bc1('0x125')](db[_0x8bc1('0x4c')],{'as':_0x8bc1('0x13a'),'through':_0x8bc1('0x13b')});db[_0x8bc1('0x12')]['belongsToMany'](db[_0x8bc1('0x13c')],{'as':_0x8bc1('0x13d'),'through':_0x8bc1('0x13e')});db[_0x8bc1('0x12')][_0x8bc1('0x125')](db[_0x8bc1('0x5c')],{'as':_0x8bc1('0x13f'),'through':_0x8bc1('0x140')});db[_0x8bc1('0x12')][_0x8bc1('0x125')](db[_0x8bc1('0x56')],{'as':_0x8bc1('0x141'),'through':_0x8bc1('0x142')});db[_0x8bc1('0x12')][_0x8bc1('0x125')](db['WhatsappAccount'],{'as':_0x8bc1('0x143'),'through':'user_has_whatsapp_accounts'});db[_0x8bc1('0x14')]['hasMany'](db['VoiceExtension'],{'as':'SpiedAgents','onDelete':_0x8bc1('0x112'),'foreignKey':'ChanSpyId'});db[_0x8bc1('0x16')][_0x8bc1('0x116')](db[_0x8bc1('0x117')],{'onDelete':_0x8bc1('0x112')});db['VoiceExtension'][_0x8bc1('0x116')](db[_0x8bc1('0x117')],{'as':_0x8bc1('0x144'),'onDelete':_0x8bc1('0x112')});db[_0x8bc1('0x19')][_0x8bc1('0x125')](db[_0x8bc1('0x145')],{'as':_0x8bc1('0x146'),'through':_0x8bc1('0x147')});db[_0x8bc1('0x1a')][_0x8bc1('0x116')](db[_0x8bc1('0x2e')],{'as':'Members','foreignKey':_0x8bc1('0x148')});db[_0x8bc1('0x1a')][_0x8bc1('0x116')](db[_0x8bc1('0x149')],{'as':_0x8bc1('0x14a'),'foreignKey':_0x8bc1('0x148')});db[_0x8bc1('0x1a')][_0x8bc1('0x116')](db[_0x8bc1('0x7a')],{'as':_0x8bc1('0x119'),'foreignKey':_0x8bc1('0x148')});db[_0x8bc1('0x1a')][_0x8bc1('0x116')](db[_0x8bc1('0x7b')],{'as':_0x8bc1('0x14b'),'foreignKey':'VoiceQueueId'});db[_0x8bc1('0x1a')][_0x8bc1('0x116')](db[_0x8bc1('0x7d')],{'as':_0x8bc1('0x7d'),'foreignKey':_0x8bc1('0x148')});db['VoiceQueue'][_0x8bc1('0x116')](db[_0x8bc1('0x78')],{'as':'HopperBlacks','foreignKey':_0x8bc1('0x148')});db[_0x8bc1('0x1a')]['hasMany'](db[_0x8bc1('0x14c')],{'as':'JscriptySessions','foreignKey':_0x8bc1('0x148')});db[_0x8bc1('0x1a')][_0x8bc1('0x121')](db[_0x8bc1('0x2a')],{'as':'Trunk','foreignKey':'TrunkId'});db[_0x8bc1('0x1a')][_0x8bc1('0x121')](db[_0x8bc1('0x2a')],{'as':_0x8bc1('0x14d'),'foreignKey':'TrunkBackupId'});db[_0x8bc1('0x1a')]['belongsTo'](db[_0x8bc1('0x14e')],{'as':_0x8bc1('0x14e'),'foreignKey':_0x8bc1('0x14f')});db[_0x8bc1('0x1a')][_0x8bc1('0x121')](db[_0x8bc1('0x87')],{'as':_0x8bc1('0x150'),'foreignKey':_0x8bc1('0x151')});db[_0x8bc1('0x1a')][_0x8bc1('0x125')](db[_0x8bc1('0xf5')],{'as':_0x8bc1('0x152'),'through':_0x8bc1('0x153')});db[_0x8bc1('0x1a')][_0x8bc1('0x125')](db[_0x8bc1('0x12')],{'as':_0x8bc1('0x154'),'through':_0x8bc1('0x30')});db[_0x8bc1('0x1a')][_0x8bc1('0x125')](db[_0x8bc1('0xe1')],{'as':_0x8bc1('0x155'),'through':_0x8bc1('0x10a')});db[_0x8bc1('0x1a')][_0x8bc1('0x125')](db[_0x8bc1('0xf5')],{'as':_0x8bc1('0x156'),'through':_0x8bc1('0x157')});db[_0x8bc1('0x1c')][_0x8bc1('0x121')](db[_0x8bc1('0x12')],{'as':_0x8bc1('0x12'),'foreignKey':'UserId'});db[_0x8bc1('0x1d')]['belongsTo'](db[_0x8bc1('0x12')],{'as':_0x8bc1('0x12'),'foreignKey':_0x8bc1('0x113')});db[_0x8bc1('0x1f')][_0x8bc1('0x116')](db['VoiceMailMessage'],{'as':'Messages','onDelete':_0x8bc1('0x112'),'foreignKey':'mailboxuser','sourceKey':_0x8bc1('0x158')});db['VoiceMailMessage'][_0x8bc1('0x121')](db['VoiceMail'],{'foreignKey':_0x8bc1('0x159'),'targetKey':'mailbox'});db[_0x8bc1('0x15a')][_0x8bc1('0x116')](db[_0x8bc1('0x15b')],{'as':_0x8bc1('0x15c'),'foreignKey':_0x8bc1('0x15d'),'constraints':![]});db[_0x8bc1('0x15a')][_0x8bc1('0x116')](db[_0x8bc1('0x26')],{'as':'AgentReports','foreignKey':_0x8bc1('0x15d'),'constraints':![]});db['VoiceCallReport'][_0x8bc1('0x121')](db[_0x8bc1('0x12')],{'as':'User','foreignKey':_0x8bc1('0x113')});db['VoiceCallReport'][_0x8bc1('0x121')](db[_0x8bc1('0x76')],{'as':_0x8bc1('0x15e'),'foreignKey':_0x8bc1('0x15f')});db['MailServerIn'][_0x8bc1('0x121')](db['MailAccount'],{'as':_0x8bc1('0x13c'),'foreignKey':_0x8bc1('0x160')});db[_0x8bc1('0x3b')][_0x8bc1('0x121')](db[_0x8bc1('0x161')],{'as':_0x8bc1('0x161'),'foreignKey':_0x8bc1('0x162'),'onDelete':_0x8bc1('0x163')});db[_0x8bc1('0x164')][_0x8bc1('0x121')](db[_0x8bc1('0x13c')],{'as':_0x8bc1('0x13c'),'foreignKey':_0x8bc1('0x160')});db[_0x8bc1('0x164')][_0x8bc1('0x121')](db[_0x8bc1('0x161')],{'as':_0x8bc1('0x161'),'foreignKey':_0x8bc1('0x162'),'onDelete':_0x8bc1('0x163')});db[_0x8bc1('0x13c')][_0x8bc1('0x111')](db[_0x8bc1('0x3b')],{'as':_0x8bc1('0x165'),'onDelete':_0x8bc1('0x112')});db['MailAccount'][_0x8bc1('0x111')](db['MailServerOut'],{'as':_0x8bc1('0x166'),'onDelete':_0x8bc1('0x112')});db[_0x8bc1('0x13c')][_0x8bc1('0x116')](db['Disposition'],{'as':_0x8bc1('0x167'),'foreignKey':_0x8bc1('0x160'),'onDelete':_0x8bc1('0x112')});db[_0x8bc1('0x13c')][_0x8bc1('0x116')](db[_0x8bc1('0x82')],{'as':_0x8bc1('0x168'),'foreignKey':_0x8bc1('0x160')});db[_0x8bc1('0x13c')]['hasMany'](db[_0x8bc1('0x44')],{'as':_0x8bc1('0x169'),'foreignKey':_0x8bc1('0x160')});db['MailAccount'][_0x8bc1('0x116')](db['MailInteraction'],{'as':_0x8bc1('0x16a')});db[_0x8bc1('0x13c')][_0x8bc1('0x116')](db['MailApplication'],{'as':_0x8bc1('0x144')});db[_0x8bc1('0x13c')][_0x8bc1('0x121')](db['CmList'],{'as':_0x8bc1('0x16b'),'foreignKey':_0x8bc1('0x16c')});db[_0x8bc1('0x13c')][_0x8bc1('0x121')](db[_0x8bc1('0x16d')],{'as':'Template','foreignKey':_0x8bc1('0x16e')});db[_0x8bc1('0x13c')][_0x8bc1('0x121')](db[_0x8bc1('0x87')],{'as':_0x8bc1('0x150'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x8bc1('0x13c')][_0x8bc1('0x125')](db[_0x8bc1('0x12')],{'as':_0x8bc1('0x154'),'through':_0x8bc1('0x13e')});db[_0x8bc1('0x3f')][_0x8bc1('0x125')](db[_0x8bc1('0x12')],{'as':'Agents','through':_0x8bc1('0x33')});db[_0x8bc1('0x3f')][_0x8bc1('0x125')](db[_0x8bc1('0xe1')],{'through':_0x8bc1('0x16f'),'as':'Teams'});db[_0x8bc1('0x43')][_0x8bc1('0x116')](db['MailMessage'],{'as':_0x8bc1('0x169'),'onDelete':'cascade','foreignKey':_0x8bc1('0x170')});db[_0x8bc1('0x43')][_0x8bc1('0x121')](db[_0x8bc1('0x13c')],{'as':_0x8bc1('0x171'),'foreignKey':'MailAccountId'});db[_0x8bc1('0x43')][_0x8bc1('0x121')](db[_0x8bc1('0x76')],{'as':_0x8bc1('0x15e'),'foreignKey':_0x8bc1('0x15f')});db['MailInteraction'][_0x8bc1('0x121')](db['User'],{'as':_0x8bc1('0x172'),'foreignKey':_0x8bc1('0x113')});db['MailInteraction'][_0x8bc1('0x125')](db[_0x8bc1('0x173')],{'through':_0x8bc1('0x174'),'as':_0x8bc1('0x175')});db[_0x8bc1('0x43')]['belongsToMany'](db[_0x8bc1('0x173')],{'through':_0x8bc1('0x174'),'as':_0x8bc1('0x176')});db[_0x8bc1('0x43')][_0x8bc1('0x125')](db['User'],{'as':_0x8bc1('0x177'),'through':_0x8bc1('0x129'),'foreignKey':_0x8bc1('0x170')});db[_0x8bc1('0x44')][_0x8bc1('0x116')](db[_0x8bc1('0xe9')],{'as':_0x8bc1('0x178'),'onDelete':_0x8bc1('0x112')});db[_0x8bc1('0x44')][_0x8bc1('0x121')](db[_0x8bc1('0x12')],{'as':_0x8bc1('0x12')});db[_0x8bc1('0x44')][_0x8bc1('0x121')](db[_0x8bc1('0x76')],{'onDelete':_0x8bc1('0x112'),'as':_0x8bc1('0x15e')});db['MailMessage'][_0x8bc1('0x121')](db[_0x8bc1('0x43')],{'as':_0x8bc1('0x179'),'foreignKey':_0x8bc1('0x170')});db[_0x8bc1('0x44')][_0x8bc1('0x121')](db['MailAccount'],{'as':_0x8bc1('0x171'),'foreignKey':_0x8bc1('0x160')});db[_0x8bc1('0x44')]['belongsTo'](db[_0x8bc1('0x64')],{'as':_0x8bc1('0x64'),'foreignKey':'ChatWebsiteId'});db['MailMessage'][_0x8bc1('0x121')](db[_0x8bc1('0x6c')],{'as':_0x8bc1('0x6c'),'foreignKey':_0x8bc1('0x17a')});db[_0x8bc1('0x46')][_0x8bc1('0x121')](db['User'],{'onDelete':_0x8bc1('0x163')});db[_0x8bc1('0x46')][_0x8bc1('0x121')](db[_0x8bc1('0x3f')],{'onDelete':_0x8bc1('0x163')});db[_0x8bc1('0x46')]['belongsTo'](db[_0x8bc1('0x13c')],{'onDelete':'restrict'});db['MailApplication'][_0x8bc1('0x121')](db[_0x8bc1('0x14e')],{'onDelete':_0x8bc1('0x163'),'foreignKey':_0x8bc1('0x14f')});db[_0x8bc1('0x46')][_0x8bc1('0x121')](db[_0x8bc1('0x173')],{'onDelete':_0x8bc1('0x163'),'foreignKey':'TagId'});db[_0x8bc1('0x48')][_0x8bc1('0x121')](db[_0x8bc1('0x13c')],{});db['MailQueueReport'][_0x8bc1('0x121')](db['CmList'],{'as':_0x8bc1('0x16b'),'foreignKey':'ListId'});db[_0x8bc1('0x48')][_0x8bc1('0x121')](db['CmContact'],{'as':_0x8bc1('0x15e'),'foreignKey':_0x8bc1('0x15f')});db[_0x8bc1('0x48')][_0x8bc1('0x121')](db[_0x8bc1('0x43')],{});db['MailQueueReport']['belongsTo'](db[_0x8bc1('0x44')],{});db[_0x8bc1('0x48')]['belongsTo'](db['User'],{});db[_0x8bc1('0x48')][_0x8bc1('0x121')](db[_0x8bc1('0x3f')],{});db[_0x8bc1('0x17b')][_0x8bc1('0x116')](db[_0x8bc1('0x4b')],{'as':_0x8bc1('0x17c'),'onDelete':_0x8bc1('0x112')});db[_0x8bc1('0x4c')][_0x8bc1('0x116')](db[_0x8bc1('0x17d')],{'as':'Dispositions','foreignKey':_0x8bc1('0x17e'),'onDelete':_0x8bc1('0x112')});db['FaxAccount']['hasMany'](db['CannedAnswer'],{'as':_0x8bc1('0x168'),'foreignKey':_0x8bc1('0x17e')});db['FaxAccount'][_0x8bc1('0x116')](db[_0x8bc1('0x4f')],{'as':'Interactions'});db[_0x8bc1('0x4c')]['hasMany'](db[_0x8bc1('0x17f')],{'as':_0x8bc1('0x144')});db[_0x8bc1('0x4c')][_0x8bc1('0x116')](db[_0x8bc1('0x117')],{'as':'Exntensions','onDelete':'cascade'});db[_0x8bc1('0x4c')][_0x8bc1('0x116')](db['FaxMessage'],{'as':_0x8bc1('0x169')});db[_0x8bc1('0x4c')][_0x8bc1('0x121')](db[_0x8bc1('0x2a')],{'as':_0x8bc1('0x2a')});db[_0x8bc1('0x4c')][_0x8bc1('0x121')](db[_0x8bc1('0xf5')],{'as':_0x8bc1('0x16b'),'foreignKey':'ListId'});db['FaxAccount'][_0x8bc1('0x121')](db[_0x8bc1('0x87')],{'as':_0x8bc1('0x150'),'foreignKey':_0x8bc1('0x151')});db[_0x8bc1('0x4c')][_0x8bc1('0x125')](db[_0x8bc1('0x12')],{'as':'Agents','through':_0x8bc1('0x13b')});db['FaxApplication']['belongsTo'](db[_0x8bc1('0x12')],{'onDelete':_0x8bc1('0x163')});db[_0x8bc1('0x17f')]['belongsTo'](db[_0x8bc1('0x52')],{'onDelete':_0x8bc1('0x163')});db[_0x8bc1('0x17f')][_0x8bc1('0x121')](db[_0x8bc1('0x4c')],{'onDelete':_0x8bc1('0x163')});db[_0x8bc1('0x17f')][_0x8bc1('0x121')](db[_0x8bc1('0x173')],{'onDelete':_0x8bc1('0x163'),'foreignKey':_0x8bc1('0x180')});db['FaxInteraction'][_0x8bc1('0x116')](db[_0x8bc1('0x181')],{'as':_0x8bc1('0x169'),'onDelete':'cascade','foreignKey':_0x8bc1('0x182')});db[_0x8bc1('0x4f')][_0x8bc1('0x121')](db['FaxAccount'],{'as':_0x8bc1('0x171'),'foreignKey':_0x8bc1('0x17e')});db[_0x8bc1('0x4f')]['belongsTo'](db['CmContact'],{'as':_0x8bc1('0x15e'),'foreignKey':_0x8bc1('0x15f')});db[_0x8bc1('0x4f')][_0x8bc1('0x121')](db[_0x8bc1('0x12')],{'as':_0x8bc1('0x172'),'foreignKey':'UserId'});db[_0x8bc1('0x4f')][_0x8bc1('0x125')](db[_0x8bc1('0x173')],{'through':_0x8bc1('0x183'),'as':'Tags'});db['FaxInteraction']['belongsToMany'](db[_0x8bc1('0x173')],{'through':'fax_interaction_has_tags','as':_0x8bc1('0x176')});db[_0x8bc1('0x4f')][_0x8bc1('0x125')](db['User'],{'as':_0x8bc1('0x177'),'through':_0x8bc1('0x12b'),'foreignKey':_0x8bc1('0x182')});db[_0x8bc1('0x181')][_0x8bc1('0x121')](db[_0x8bc1('0x12')],{'onDelete':_0x8bc1('0x112'),'as':_0x8bc1('0x12')});db[_0x8bc1('0x181')]['belongsTo'](db[_0x8bc1('0x4f')],{'as':_0x8bc1('0x179'),'foreignKey':_0x8bc1('0x182')});db['FaxMessage'][_0x8bc1('0x121')](db['CmContact'],{'onDelete':_0x8bc1('0x112'),'as':'Contact'});db[_0x8bc1('0x181')]['belongsTo'](db[_0x8bc1('0xe9')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x8bc1('0x181')][_0x8bc1('0x121')](db[_0x8bc1('0x4c')],{'as':'Account','foreignKey':_0x8bc1('0x17e')});db[_0x8bc1('0x52')][_0x8bc1('0x125')](db[_0x8bc1('0x12')],{'as':_0x8bc1('0x154'),'through':_0x8bc1('0x134')});db['FaxQueue'][_0x8bc1('0x125')](db['Team'],{'through':_0x8bc1('0x184'),'as':_0x8bc1('0x155')});db['FaxQueueReport'][_0x8bc1('0x121')](db[_0x8bc1('0x4c')],{});db[_0x8bc1('0x54')][_0x8bc1('0x121')](db[_0x8bc1('0xf5')],{'as':_0x8bc1('0x16b'),'foreignKey':'ListId'});db[_0x8bc1('0x54')][_0x8bc1('0x121')](db[_0x8bc1('0x76')],{'as':_0x8bc1('0x15e'),'foreignKey':'ContactId'});db[_0x8bc1('0x54')][_0x8bc1('0x121')](db[_0x8bc1('0x4f')],{});db[_0x8bc1('0x54')][_0x8bc1('0x121')](db['FaxMessage'],{});db[_0x8bc1('0x54')]['belongsTo'](db[_0x8bc1('0x12')],{});db[_0x8bc1('0x54')]['belongsTo'](db[_0x8bc1('0x52')],{});db[_0x8bc1('0x56')]['hasMany'](db[_0x8bc1('0x17d')],{'as':_0x8bc1('0x167'),'foreignKey':_0x8bc1('0x185'),'onDelete':'cascade'});db['SmsAccount'][_0x8bc1('0x116')](db[_0x8bc1('0x82')],{'as':_0x8bc1('0x168'),'foreignKey':_0x8bc1('0x185')});db[_0x8bc1('0x56')][_0x8bc1('0x116')](db[_0x8bc1('0x186')],{'as':_0x8bc1('0x169'),'foreignKey':_0x8bc1('0x185')});db[_0x8bc1('0x56')][_0x8bc1('0x116')](db['SmsInteraction'],{'as':_0x8bc1('0x16a')});db[_0x8bc1('0x56')][_0x8bc1('0x116')](db[_0x8bc1('0x57')],{'as':_0x8bc1('0x144')});db[_0x8bc1('0x56')][_0x8bc1('0x121')](db[_0x8bc1('0xf5')],{'as':_0x8bc1('0x16b'),'foreignKey':'ListId'});db[_0x8bc1('0x56')][_0x8bc1('0x121')](db[_0x8bc1('0x87')],{'as':_0x8bc1('0x150'),'foreignKey':_0x8bc1('0x151')});db['SmsAccount']['belongsToMany'](db[_0x8bc1('0x12')],{'as':_0x8bc1('0x154'),'through':'user_has_sms_accounts'});db['SmsApplication'][_0x8bc1('0x121')](db['User'],{'onDelete':'restrict'});db[_0x8bc1('0x57')][_0x8bc1('0x121')](db[_0x8bc1('0x5a')],{'onDelete':_0x8bc1('0x163')});db[_0x8bc1('0x57')][_0x8bc1('0x121')](db[_0x8bc1('0x56')],{'onDelete':_0x8bc1('0x163')});db[_0x8bc1('0x57')][_0x8bc1('0x121')](db[_0x8bc1('0x14e')],{'onDelete':_0x8bc1('0x163'),'foreignKey':_0x8bc1('0x14f')});db[_0x8bc1('0x57')][_0x8bc1('0x121')](db[_0x8bc1('0x173')],{'onDelete':_0x8bc1('0x163'),'foreignKey':_0x8bc1('0x180')});db['SmsInteraction']['hasMany'](db[_0x8bc1('0x186')],{'as':'Messages','onDelete':_0x8bc1('0x112'),'foreignKey':_0x8bc1('0x187')});db[_0x8bc1('0x58')][_0x8bc1('0x121')](db['SmsAccount'],{'as':_0x8bc1('0x171'),'foreignKey':_0x8bc1('0x185')});db[_0x8bc1('0x58')]['belongsTo'](db['CmContact'],{'as':_0x8bc1('0x15e'),'foreignKey':_0x8bc1('0x15f')});db[_0x8bc1('0x58')][_0x8bc1('0x121')](db[_0x8bc1('0x12')],{'as':'Owner','foreignKey':'UserId'});db['SmsInteraction'][_0x8bc1('0x125')](db[_0x8bc1('0x173')],{'through':'sms_interaction_has_tags','as':_0x8bc1('0x175')});db[_0x8bc1('0x58')][_0x8bc1('0x125')](db['Tag'],{'through':_0x8bc1('0x188'),'as':'ThroughTags'});db[_0x8bc1('0x58')][_0x8bc1('0x125')](db[_0x8bc1('0x12')],{'as':_0x8bc1('0x177'),'through':_0x8bc1('0x12c'),'foreignKey':_0x8bc1('0x187')});db[_0x8bc1('0x186')][_0x8bc1('0x121')](db[_0x8bc1('0x12')],{'as':_0x8bc1('0x12')});db[_0x8bc1('0x186')][_0x8bc1('0x121')](db[_0x8bc1('0x76')],{'onDelete':'cascade','as':_0x8bc1('0x15e')});db['SmsMessage'][_0x8bc1('0x121')](db[_0x8bc1('0x58')],{'onDelete':_0x8bc1('0x112'),'as':'Interaction','foreignKey':_0x8bc1('0x187')});db[_0x8bc1('0x186')]['belongsTo'](db[_0x8bc1('0x56')],{'as':_0x8bc1('0x171'),'foreignKey':'SmsAccountId'});db[_0x8bc1('0x5a')][_0x8bc1('0x125')](db['User'],{'as':'Agents','through':_0x8bc1('0x36'),'foreignKey':_0x8bc1('0x189')});db[_0x8bc1('0x5a')]['belongsToMany'](db[_0x8bc1('0xe1')],{'through':_0x8bc1('0x18a'),'as':'Teams'});db[_0x8bc1('0x5c')][_0x8bc1('0x116')](db['Disposition'],{'as':_0x8bc1('0x167'),'foreignKey':_0x8bc1('0x18b'),'onDelete':_0x8bc1('0x112')});db[_0x8bc1('0x5c')]['hasMany'](db['CannedAnswer'],{'as':_0x8bc1('0x168'),'foreignKey':_0x8bc1('0x18b')});db[_0x8bc1('0x5c')]['hasMany'](db[_0x8bc1('0x5f')],{'as':_0x8bc1('0x16a'),'foreignKey':'OpenchannelAccountId'});db[_0x8bc1('0x5c')][_0x8bc1('0x116')](db[_0x8bc1('0x18c')],{'as':_0x8bc1('0x169'),'foreignKey':_0x8bc1('0x18b')});db[_0x8bc1('0x5c')][_0x8bc1('0x116')](db[_0x8bc1('0x5d')],{'as':_0x8bc1('0x144'),'foreignKey':_0x8bc1('0x18b')});db['OpenchannelAccount']['belongsTo'](db[_0x8bc1('0xf5')],{'as':_0x8bc1('0x16b'),'foreignKey':_0x8bc1('0x16c')});db[_0x8bc1('0x5c')]['belongsTo'](db['Pause'],{'as':_0x8bc1('0x150'),'foreignKey':_0x8bc1('0x151')});db[_0x8bc1('0x5c')][_0x8bc1('0x125')](db['User'],{'as':'Agents','through':_0x8bc1('0x140')});db['OpenchannelApplication'][_0x8bc1('0x121')](db[_0x8bc1('0x12')],{'onDelete':_0x8bc1('0x163')});db['OpenchannelApplication'][_0x8bc1('0x121')](db[_0x8bc1('0x62')],{'onDelete':_0x8bc1('0x163'),'foreignKey':_0x8bc1('0x18d')});db[_0x8bc1('0x5d')][_0x8bc1('0x121')](db['OpenchannelAccount'],{'onDelete':_0x8bc1('0x163'),'foreignKey':'OpenchannelAccountId'});db[_0x8bc1('0x5d')][_0x8bc1('0x121')](db['Interval'],{'onDelete':_0x8bc1('0x163'),'foreignKey':_0x8bc1('0x14f')});db['OpenchannelApplication']['belongsTo'](db[_0x8bc1('0x173')],{'onDelete':_0x8bc1('0x163'),'foreignKey':_0x8bc1('0x180')});db[_0x8bc1('0x5f')]['hasMany'](db[_0x8bc1('0x18c')],{'as':_0x8bc1('0x169'),'onDelete':'cascade','foreignKey':'OpenchannelInteractionId'});db['OpenchannelInteraction'][_0x8bc1('0x121')](db[_0x8bc1('0x5c')],{'as':_0x8bc1('0x171'),'foreignKey':'OpenchannelAccountId'});db[_0x8bc1('0x5f')][_0x8bc1('0x121')](db['CmContact'],{'as':'Contact','foreignKey':_0x8bc1('0x15f')});db[_0x8bc1('0x5f')]['belongsTo'](db[_0x8bc1('0x12')],{'as':_0x8bc1('0x172'),'foreignKey':_0x8bc1('0x113')});db[_0x8bc1('0x5f')][_0x8bc1('0x125')](db['Tag'],{'through':_0x8bc1('0x18e'),'as':'Tags'});db[_0x8bc1('0x5f')][_0x8bc1('0x125')](db[_0x8bc1('0x173')],{'through':_0x8bc1('0x18e'),'as':_0x8bc1('0x176')});db[_0x8bc1('0x5f')][_0x8bc1('0x125')](db[_0x8bc1('0x12')],{'as':'Users','through':'user_has_openchannel_interactions','foreignKey':_0x8bc1('0x18f')});db[_0x8bc1('0x18c')]['belongsTo'](db[_0x8bc1('0x12')],{'onDelete':_0x8bc1('0x112'),'as':_0x8bc1('0x12')});db[_0x8bc1('0x18c')][_0x8bc1('0x121')](db[_0x8bc1('0x76')],{'onDelete':_0x8bc1('0x112'),'as':_0x8bc1('0x15e')});db[_0x8bc1('0x18c')][_0x8bc1('0x121')](db[_0x8bc1('0x5f')],{'onDelete':'cascade','as':_0x8bc1('0x179'),'foreignKey':_0x8bc1('0x18f')});db[_0x8bc1('0x18c')][_0x8bc1('0x121')](db[_0x8bc1('0xe9')],{'as':_0x8bc1('0xe9'),'foreignKey':'AttachmentId'});db[_0x8bc1('0x18c')][_0x8bc1('0x121')](db[_0x8bc1('0x5c')],{'as':_0x8bc1('0x171'),'foreignKey':_0x8bc1('0x18b')});db[_0x8bc1('0x62')][_0x8bc1('0x125')](db[_0x8bc1('0x12')],{'as':_0x8bc1('0x154'),'through':_0x8bc1('0x38'),'foreignKey':_0x8bc1('0x18d')});db['OpenchannelQueue'][_0x8bc1('0x125')](db[_0x8bc1('0xe1')],{'through':_0x8bc1('0x190'),'as':_0x8bc1('0x155')});db[_0x8bc1('0x64')]['hasMany'](db[_0x8bc1('0x17d')],{'as':'Dispositions','foreignKey':_0x8bc1('0x191'),'onDelete':_0x8bc1('0x112')});db[_0x8bc1('0x64')][_0x8bc1('0x116')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x8bc1('0x191')});db[_0x8bc1('0x64')]['hasMany'](db['ChatProactiveAction'],{'as':_0x8bc1('0x192')});db[_0x8bc1('0x64')][_0x8bc1('0x116')](db['ChatInteraction'],{'as':_0x8bc1('0x16a')});db[_0x8bc1('0x64')]['hasMany'](db[_0x8bc1('0x66')],{'as':_0x8bc1('0x144')});db[_0x8bc1('0x64')][_0x8bc1('0x116')](db['ChatMessage'],{'as':_0x8bc1('0x169')});db[_0x8bc1('0x64')][_0x8bc1('0x121')](db[_0x8bc1('0xf5')],{'as':_0x8bc1('0x16b'),'foreignKey':_0x8bc1('0x16c')});db[_0x8bc1('0x64')]['belongsTo'](db['Interval'],{'as':_0x8bc1('0x14e'),'foreignKey':_0x8bc1('0x14f')});db[_0x8bc1('0x64')]['belongsTo'](db[_0x8bc1('0x13c')],{'as':_0x8bc1('0x13c'),'foreignKey':_0x8bc1('0x160')});db[_0x8bc1('0x64')][_0x8bc1('0x121')](db[_0x8bc1('0x87')],{'as':_0x8bc1('0x150'),'foreignKey':_0x8bc1('0x151')});db[_0x8bc1('0x64')][_0x8bc1('0x125')](db[_0x8bc1('0x12')],{'as':_0x8bc1('0x154'),'through':'user_has_chat_websites'});db[_0x8bc1('0x193')][_0x8bc1('0x121')](db[_0x8bc1('0x5c')],{});db[_0x8bc1('0x193')][_0x8bc1('0x121')](db[_0x8bc1('0xf5')],{'as':'List','foreignKey':_0x8bc1('0x16c')});db[_0x8bc1('0x193')][_0x8bc1('0x121')](db['CmContact'],{'as':_0x8bc1('0x15e'),'foreignKey':_0x8bc1('0x15f')});db[_0x8bc1('0x193')][_0x8bc1('0x121')](db['OpenchannelInteraction'],{});db[_0x8bc1('0x193')][_0x8bc1('0x121')](db['OpenchannelMessage'],{});db[_0x8bc1('0x193')]['belongsTo'](db[_0x8bc1('0x12')],{});db[_0x8bc1('0x193')][_0x8bc1('0x121')](db[_0x8bc1('0x62')],{});db[_0x8bc1('0x66')][_0x8bc1('0x121')](db[_0x8bc1('0x12')],{'as':_0x8bc1('0x194'),'foreignKey':'UserId','onDelete':_0x8bc1('0x163')});db[_0x8bc1('0x66')]['belongsTo'](db[_0x8bc1('0x6e')],{'as':_0x8bc1('0x195'),'foreignKey':_0x8bc1('0x196'),'onDelete':_0x8bc1('0x163')});db[_0x8bc1('0x66')][_0x8bc1('0x121')](db[_0x8bc1('0x64')],{'as':_0x8bc1('0x197'),'foreignKey':_0x8bc1('0x191'),'onDelete':_0x8bc1('0x163')});db[_0x8bc1('0x66')]['belongsTo'](db[_0x8bc1('0x173')],{'onDelete':_0x8bc1('0x163'),'foreignKey':_0x8bc1('0x180')});db[_0x8bc1('0x68')][_0x8bc1('0x116')](db[_0x8bc1('0x6a')],{'as':_0x8bc1('0x169'),'onDelete':_0x8bc1('0x112'),'foreignKey':'ChatInteractionId'});db[_0x8bc1('0x68')]['belongsTo'](db[_0x8bc1('0x64')],{'as':_0x8bc1('0x171'),'foreignKey':_0x8bc1('0x191')});db[_0x8bc1('0x68')][_0x8bc1('0x121')](db[_0x8bc1('0x76')],{'as':_0x8bc1('0x15e'),'foreignKey':_0x8bc1('0x15f')});db[_0x8bc1('0x68')]['belongsTo'](db[_0x8bc1('0x12')],{'as':_0x8bc1('0x172'),'foreignKey':_0x8bc1('0x113')});db[_0x8bc1('0x68')][_0x8bc1('0x125')](db[_0x8bc1('0x173')],{'through':_0x8bc1('0x198'),'as':_0x8bc1('0x175')});db[_0x8bc1('0x68')][_0x8bc1('0x125')](db[_0x8bc1('0x173')],{'through':'chat_interaction_has_tags','as':_0x8bc1('0x176')});db[_0x8bc1('0x68')][_0x8bc1('0x125')](db[_0x8bc1('0x12')],{'as':_0x8bc1('0x177'),'through':_0x8bc1('0x12a'),'foreignKey':'ChatInteractionId'});db['ChatMessage']['belongsTo'](db['User'],{'onDelete':_0x8bc1('0x112'),'as':_0x8bc1('0x12')});db['ChatMessage']['belongsTo'](db[_0x8bc1('0x76')],{'onDelete':_0x8bc1('0x112'),'as':_0x8bc1('0x15e'),'foreignKey':_0x8bc1('0x15f')});db[_0x8bc1('0x6a')][_0x8bc1('0x121')](db[_0x8bc1('0x68')],{'onDelete':_0x8bc1('0x112'),'as':_0x8bc1('0x179'),'foreignKey':_0x8bc1('0x199')});db[_0x8bc1('0x6a')][_0x8bc1('0x121')](db[_0x8bc1('0xe9')],{'as':_0x8bc1('0xe9'),'foreignKey':_0x8bc1('0x19a')});db[_0x8bc1('0x6a')][_0x8bc1('0x121')](db[_0x8bc1('0x64')],{'as':_0x8bc1('0x171'),'foreignKey':'ChatWebsiteId'});db['ChatOfflineMessage'][_0x8bc1('0x116')](db['Attachment'],{'as':_0x8bc1('0x178'),'foreignKey':_0x8bc1('0x17a'),'onDelete':'cascade','hooks':!![]});db[_0x8bc1('0x6c')][_0x8bc1('0x121')](db[_0x8bc1('0x76')],{'onDelete':_0x8bc1('0x112'),'as':_0x8bc1('0x15e'),'foreignKey':_0x8bc1('0x15f')});db['ChatOfflineMessage'][_0x8bc1('0x121')](db['ChatWebsite'],{'as':_0x8bc1('0x171'),'foreignKey':_0x8bc1('0x191')});db[_0x8bc1('0x6e')]['belongsToMany'](db[_0x8bc1('0x12')],{'as':_0x8bc1('0x154'),'through':_0x8bc1('0x132'),'hooks':!![]});db['ChatQueue'][_0x8bc1('0x125')](db['Team'],{'through':_0x8bc1('0x19b'),'as':'Teams'});db[_0x8bc1('0x70')][_0x8bc1('0x116')](db['ChatInternalMessage'],{'as':'Messages','foreignKey':_0x8bc1('0x19c'),'onDelete':_0x8bc1('0x112')});db[_0x8bc1('0x70')][_0x8bc1('0x125')](db[_0x8bc1('0x12')],{'as':_0x8bc1('0x19d'),'through':_0x8bc1('0x124')});db['ChatProactiveAction'][_0x8bc1('0x121')](db[_0x8bc1('0x64')],{'as':'Website','foreignKey':'ChatWebsiteId'});db[_0x8bc1('0x74')][_0x8bc1('0x116')](db[_0x8bc1('0x76')],{'as':_0x8bc1('0x19e'),'foreignKey':_0x8bc1('0x19f')});db[_0x8bc1('0x76')][_0x8bc1('0x116')](db[_0x8bc1('0x8e')],{'as':_0x8bc1('0x1a0'),'foreignKey':'CmContactId'});db[_0x8bc1('0x76')]['hasMany'](db[_0x8bc1('0x149')],{'as':_0x8bc1('0x14a'),'foreignKey':_0x8bc1('0x15f')});db['CmContact'][_0x8bc1('0x116')](db[_0x8bc1('0x7a')],{'as':_0x8bc1('0x119'),'foreignKey':'ContactId'});db[_0x8bc1('0x76')]['hasMany'](db[_0x8bc1('0x7b')],{'as':_0x8bc1('0x14b'),'foreignKey':_0x8bc1('0x15f')});db[_0x8bc1('0x76')][_0x8bc1('0x116')](db[_0x8bc1('0x7d')],{'as':_0x8bc1('0x7d'),'foreignKey':'ContactId'});db['CmContact'][_0x8bc1('0x116')](db['JscriptySessionReport'],{'as':_0x8bc1('0x1a1'),'foreignKey':'ContactId'});db[_0x8bc1('0x76')][_0x8bc1('0x116')](db[_0x8bc1('0x5f')],{'as':_0x8bc1('0x11b'),'foreignKey':_0x8bc1('0x15f'),'onDelete':'restrict'});db[_0x8bc1('0x76')][_0x8bc1('0x116')](db[_0x8bc1('0x68')],{'as':_0x8bc1('0x11c'),'foreignKey':_0x8bc1('0x15f'),'onDelete':_0x8bc1('0x163')});db[_0x8bc1('0x76')][_0x8bc1('0x116')](db[_0x8bc1('0x58')],{'as':_0x8bc1('0x11d'),'foreignKey':'ContactId','onDelete':_0x8bc1('0x163')});db[_0x8bc1('0x76')][_0x8bc1('0x116')](db['FaxInteraction'],{'as':_0x8bc1('0x11e'),'foreignKey':_0x8bc1('0x15f'),'onDelete':_0x8bc1('0x163')});db[_0x8bc1('0x76')][_0x8bc1('0x116')](db[_0x8bc1('0x43')],{'as':'MailInteractions','foreignKey':_0x8bc1('0x15f'),'onDelete':_0x8bc1('0x163')});db['CmContact']['belongsTo'](db[_0x8bc1('0x74')],{'as':_0x8bc1('0x1a2'),'foreignKey':'CompanyId'});db[_0x8bc1('0x76')][_0x8bc1('0x121')](db['CmList'],{'as':_0x8bc1('0x16b'),'foreignKey':_0x8bc1('0x16c'),'onDelete':_0x8bc1('0x112')});db[_0x8bc1('0x76')]['belongsToMany'](db[_0x8bc1('0x12')],{'as':_0x8bc1('0x177'),'through':_0x8bc1('0x126')});db[_0x8bc1('0x76')][_0x8bc1('0x125')](db[_0x8bc1('0x173')],{'as':'Tags','through':_0x8bc1('0x1a3')});db[_0x8bc1('0x76')][_0x8bc1('0x125')](db[_0x8bc1('0x173')],{'through':_0x8bc1('0x1a3'),'as':'ThroughTags'});db[_0x8bc1('0x149')]['hasMany'](db[_0x8bc1('0x1a4')],{'as':_0x8bc1('0x1a5'),'foreignKey':'CmHopperId'});db[_0x8bc1('0x149')]['belongsTo'](db[_0x8bc1('0x76')],{'as':_0x8bc1('0x15e'),'foreignKey':_0x8bc1('0x15f'),'onDelete':'cascade'});db[_0x8bc1('0x149')][_0x8bc1('0x121')](db[_0x8bc1('0xf5')],{'as':_0x8bc1('0x16b'),'foreignKey':_0x8bc1('0x16c'),'onDelete':'cascade'});db[_0x8bc1('0x149')][_0x8bc1('0x121')](db[_0x8bc1('0x12')],{'as':_0x8bc1('0x194'),'foreignKey':'UserId'});db[_0x8bc1('0x149')][_0x8bc1('0x121')](db['VoiceQueue'],{'as':'Queue','foreignKey':_0x8bc1('0x148'),'onDelete':_0x8bc1('0x112')});db[_0x8bc1('0x149')][_0x8bc1('0x121')](db['Campaign'],{'as':_0x8bc1('0xe5'),'foreignKey':_0x8bc1('0x1a6'),'onDelete':_0x8bc1('0x112')});db[_0x8bc1('0x149')][_0x8bc1('0x121')](db[_0x8bc1('0x12')],{'as':_0x8bc1('0x172'),'foreignKey':_0x8bc1('0x1a7')});db[_0x8bc1('0x78')][_0x8bc1('0x121')](db[_0x8bc1('0x76')],{'as':_0x8bc1('0x15e'),'foreignKey':_0x8bc1('0x15f'),'onDelete':'cascade'});db[_0x8bc1('0x78')]['belongsTo'](db[_0x8bc1('0xf5')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db[_0x8bc1('0x78')][_0x8bc1('0x121')](db[_0x8bc1('0x1a')],{'as':_0x8bc1('0x195'),'foreignKey':_0x8bc1('0x148'),'onDelete':_0x8bc1('0x112')});db[_0x8bc1('0x78')][_0x8bc1('0x121')](db[_0x8bc1('0xe5')],{'as':'Campaign','foreignKey':_0x8bc1('0x1a6'),'onDelete':'cascade'});db[_0x8bc1('0x1a8')][_0x8bc1('0x116')](db[_0x8bc1('0x85')],{'as':{'plural':'All','singular':_0x8bc1('0x1a9')},'foreignKey':_0x8bc1('0x1aa'),'onDelete':_0x8bc1('0x112'),'hooks':!![]});db[_0x8bc1('0x1a8')][_0x8bc1('0x116')](db[_0x8bc1('0x85')],{'as':{'plural':_0x8bc1('0x1ab'),'singular':_0x8bc1('0x1ac')},'foreignKey':_0x8bc1('0x1ad'),'onDelete':_0x8bc1('0x112'),'hooks':!![]});db[_0x8bc1('0x1a8')]['hasMany'](db[_0x8bc1('0x80')],{'as':'Actions','foreignKey':_0x8bc1('0x1ae'),'onDelete':'cascade','hooks':!![]});db[_0x8bc1('0x17d')][_0x8bc1('0x116')](db[_0x8bc1('0x17d')],{'as':'Dispositions','foreignKey':_0x8bc1('0x1af'),'onDelete':_0x8bc1('0x112')});db[_0x8bc1('0x14e')][_0x8bc1('0x116')](db['Interval'],{'as':_0x8bc1('0x1b0'),'foreignKey':_0x8bc1('0x14f'),'onDelete':_0x8bc1('0x112'),'hooks':!![],'required':![]});db[_0x8bc1('0x14e')][_0x8bc1('0x116')](db[_0x8bc1('0x117')],{'as':_0x8bc1('0x118'),'foreignKey':'IntervalId','onDelete':_0x8bc1('0x163')});db['Interval'][_0x8bc1('0x116')](db[_0x8bc1('0x46')],{'as':_0x8bc1('0x1b1'),'foreignKey':_0x8bc1('0x14f')});db[_0x8bc1('0x14e')][_0x8bc1('0x116')](db[_0x8bc1('0x66')],{'as':_0x8bc1('0x1b2'),'foreignKey':_0x8bc1('0x14f')});db[_0x8bc1('0x14e')]['hasMany'](db[_0x8bc1('0x17f')],{'as':_0x8bc1('0x1b3'),'foreignKey':_0x8bc1('0x14f')});db[_0x8bc1('0x14e')][_0x8bc1('0x116')](db[_0x8bc1('0x57')],{'as':_0x8bc1('0x1b4'),'foreignKey':_0x8bc1('0x14f')});db['Schedule'][_0x8bc1('0x121')](db[_0x8bc1('0x13c')],{});db[_0x8bc1('0x1b5')][_0x8bc1('0x121')](db['AnalyticDefaultReport'],{'foreignKey':_0x8bc1('0x1b6')});db[_0x8bc1('0x1b5')][_0x8bc1('0x121')](db[_0x8bc1('0x1b7')],{'foreignKey':_0x8bc1('0x1b8')});db[_0x8bc1('0x145')][_0x8bc1('0x125')](db[_0x8bc1('0x19')],{'as':'Mohs','through':_0x8bc1('0x147'),'onDelete':'restrict'});db['Tag']['belongsToMany'](db['CmContact'],{'through':_0x8bc1('0x1a3')});db[_0x8bc1('0x173')][_0x8bc1('0x125')](db[_0x8bc1('0x68')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x8bc1('0x125')](db['MailInteraction'],{'through':_0x8bc1('0x174')});db[_0x8bc1('0x173')][_0x8bc1('0x125')](db[_0x8bc1('0x58')],{'through':'sms_interaction_has_tags'});db[_0x8bc1('0x173')][_0x8bc1('0x125')](db[_0x8bc1('0x4f')],{'through':_0x8bc1('0x183')});db[_0x8bc1('0x173')][_0x8bc1('0x125')](db[_0x8bc1('0x5f')],{'through':_0x8bc1('0x18e')});db[_0x8bc1('0x173')][_0x8bc1('0x125')](db[_0x8bc1('0x103')],{'through':_0x8bc1('0x1b9')});db['CmContactHasItem'][_0x8bc1('0x121')](db[_0x8bc1('0x8c')],{'as':_0x8bc1('0x1ba'),'foreignKey':_0x8bc1('0x1bb')});db[_0x8bc1('0x1a4')][_0x8bc1('0x121')](db[_0x8bc1('0x149')],{'as':_0x8bc1('0x1bc'),'foreignKey':'CmHopperId'});db[_0x8bc1('0x8e')][_0x8bc1('0x121')](db['CmContact'],{'as':'Contact','foreignKey':_0x8bc1('0x1bd')});db['Trigger'][_0x8bc1('0x116')](db['Condition'],{'as':{'plural':'AllConditions','singular':'AllCondition'},'foreignKey':_0x8bc1('0x1be'),'onDelete':_0x8bc1('0x112'),'hooks':!![]});db[_0x8bc1('0x91')]['hasMany'](db[_0x8bc1('0x85')],{'as':{'plural':'AnyConditions','singular':_0x8bc1('0x1bf')},'foreignKey':'TriggerAnyId','onDelete':'cascade','hooks':!![]});db[_0x8bc1('0x91')][_0x8bc1('0x116')](db[_0x8bc1('0x80')],{'as':_0x8bc1('0x1c0'),'foreignKey':'TriggerId','onDelete':'cascade','hooks':!![]});db[_0x8bc1('0x1b7')][_0x8bc1('0x116')](db[_0x8bc1('0x9d')],{'as':'Fields','onDelete':_0x8bc1('0x112'),'foreignKey':'CustomReportId','hooks':!![]});db[_0x8bc1('0x98')]['hasMany'](db[_0x8bc1('0x9d')],{'as':_0x8bc1('0x1c1'),'onDelete':_0x8bc1('0x112'),'foreignKey':_0x8bc1('0x1b6')});db['AnalyticMetric'][_0x8bc1('0x116')](db[_0x8bc1('0x9d')],{'as':_0x8bc1('0x1c1'),'onDelete':_0x8bc1('0x112'),'foreignKey':_0x8bc1('0x1c2')});db[_0x8bc1('0x9d')][_0x8bc1('0x121')](db[_0x8bc1('0x9b')],{'foreignKey':'MetricId'});db[_0x8bc1('0x1c3')][_0x8bc1('0x116')](db[_0x8bc1('0xa2')],{'as':_0x8bc1('0x1c4'),'onDelete':_0x8bc1('0x112'),'foreignKey':_0x8bc1('0x1c5')});db['SalesforceConfiguration']['hasMany'](db[_0x8bc1('0xa4')],{'as':_0x8bc1('0x1c6'),'onDelete':'cascade','foreignKey':_0x8bc1('0x1c7')});db[_0x8bc1('0xa2')]['hasMany'](db[_0x8bc1('0xa4')],{'as':'Descriptions','onDelete':_0x8bc1('0x112'),'foreignKey':'DescriptionId'});db[_0x8bc1('0xa2')][_0x8bc1('0x116')](db[_0x8bc1('0xa4')],{'as':_0x8bc1('0x1c1'),'onDelete':_0x8bc1('0x112'),'foreignKey':_0x8bc1('0x1c8')});db[_0x8bc1('0xa2')][_0x8bc1('0x121')](db[_0x8bc1('0x1c3')],{'as':'Account','foreignKey':_0x8bc1('0x1c5')});db['SalesforceField']['hasMany'](db['SalesforceField'],{'as':'Subject','foreignKey':_0x8bc1('0x1c7')});db[_0x8bc1('0xa4')][_0x8bc1('0x116')](db['SalesforceField'],{'as':_0x8bc1('0x1c9'),'foreignKey':_0x8bc1('0x1ca')});db[_0x8bc1('0xa4')][_0x8bc1('0x116')](db['SalesforceField'],{'as':'Field','foreignKey':_0x8bc1('0x1c8')});db[_0x8bc1('0xa4')][_0x8bc1('0x121')](db['Variable'],{'as':_0x8bc1('0x1cb'),'foreignKey':_0x8bc1('0x1cc')});db[_0x8bc1('0xa6')]['hasMany'](db[_0x8bc1('0xa8')],{'as':_0x8bc1('0x1c4'),'onDelete':_0x8bc1('0x112'),'foreignKey':'AccountId'});db[_0x8bc1('0xa8')][_0x8bc1('0x116')](db[_0x8bc1('0xaa')],{'as':_0x8bc1('0x1c6'),'onDelete':_0x8bc1('0x112'),'foreignKey':_0x8bc1('0x1c7')});db[_0x8bc1('0xa8')][_0x8bc1('0x116')](db[_0x8bc1('0xaa')],{'as':_0x8bc1('0x1cd'),'onDelete':_0x8bc1('0x112'),'foreignKey':_0x8bc1('0x1ca')});db[_0x8bc1('0xa8')][_0x8bc1('0x116')](db[_0x8bc1('0xaa')],{'as':_0x8bc1('0x1c1'),'onDelete':_0x8bc1('0x112'),'foreignKey':_0x8bc1('0x1c8')});db[_0x8bc1('0xa8')]['belongsTo'](db[_0x8bc1('0xa6')],{'as':_0x8bc1('0x171'),'foreignKey':_0x8bc1('0x1c5')});db[_0x8bc1('0xaa')][_0x8bc1('0x116')](db['SugarcrmField'],{'as':_0x8bc1('0x1ce'),'foreignKey':_0x8bc1('0x1c7')});db[_0x8bc1('0xaa')][_0x8bc1('0x116')](db[_0x8bc1('0xaa')],{'as':_0x8bc1('0x1c9'),'foreignKey':_0x8bc1('0x1ca')});db[_0x8bc1('0xaa')]['hasMany'](db[_0x8bc1('0xaa')],{'as':_0x8bc1('0x1cf'),'foreignKey':_0x8bc1('0x1c8')});db[_0x8bc1('0xaa')]['belongsTo'](db[_0x8bc1('0x1cb')],{'as':_0x8bc1('0x1cb'),'foreignKey':'VariableId'});db[_0x8bc1('0xac')][_0x8bc1('0x116')](db['DeskConfiguration'],{'as':_0x8bc1('0x1c4'),'onDelete':_0x8bc1('0x112'),'foreignKey':_0x8bc1('0x1c5')});db[_0x8bc1('0x1d0')]['hasMany'](db[_0x8bc1('0x1d1')],{'as':'Subjects','onDelete':_0x8bc1('0x112'),'foreignKey':_0x8bc1('0x1c7')});db[_0x8bc1('0x1d0')][_0x8bc1('0x116')](db[_0x8bc1('0x1d1')],{'as':_0x8bc1('0x1cd'),'onDelete':'cascade','foreignKey':_0x8bc1('0x1ca')});db['DeskConfiguration']['hasMany'](db[_0x8bc1('0x1d1')],{'as':_0x8bc1('0x1c1'),'onDelete':_0x8bc1('0x112'),'foreignKey':_0x8bc1('0x1c8')});db[_0x8bc1('0x1d0')]['belongsTo'](db[_0x8bc1('0xac')],{'as':_0x8bc1('0x171'),'foreignKey':_0x8bc1('0x1c5')});db[_0x8bc1('0x1d0')][_0x8bc1('0x125')](db['Tag'],{'through':_0x8bc1('0x1d2')});db[_0x8bc1('0x1d1')]['hasMany'](db['DeskField'],{'as':_0x8bc1('0x1ce'),'foreignKey':'SubjectId'});db[_0x8bc1('0x1d1')][_0x8bc1('0x116')](db[_0x8bc1('0x1d1')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x8bc1('0x1d1')][_0x8bc1('0x116')](db[_0x8bc1('0x1d1')],{'as':_0x8bc1('0x1cf'),'foreignKey':_0x8bc1('0x1c8')});db[_0x8bc1('0x1d1')]['belongsTo'](db[_0x8bc1('0x1cb')],{'as':_0x8bc1('0x1cb'),'foreignKey':_0x8bc1('0x1cc')});db[_0x8bc1('0x1d3')][_0x8bc1('0x116')](db[_0x8bc1('0xaf')],{'as':_0x8bc1('0x1c4'),'onDelete':'cascade','foreignKey':_0x8bc1('0x1c5')});db[_0x8bc1('0xaf')][_0x8bc1('0x116')](db[_0x8bc1('0xb1')],{'as':_0x8bc1('0x1c6'),'onDelete':_0x8bc1('0x112'),'foreignKey':_0x8bc1('0x1c7')});db['ZohoConfiguration']['hasMany'](db[_0x8bc1('0xb1')],{'as':_0x8bc1('0x1cd'),'onDelete':_0x8bc1('0x112'),'foreignKey':_0x8bc1('0x1ca')});db['ZohoConfiguration'][_0x8bc1('0x116')](db[_0x8bc1('0xb1')],{'as':_0x8bc1('0x1c1'),'onDelete':_0x8bc1('0x112'),'foreignKey':_0x8bc1('0x1c8')});db[_0x8bc1('0xaf')][_0x8bc1('0x121')](db[_0x8bc1('0x1d3')],{'as':'Account','foreignKey':_0x8bc1('0x1c5')});db['ZohoField'][_0x8bc1('0x116')](db['ZohoField'],{'as':_0x8bc1('0x1ce'),'foreignKey':_0x8bc1('0x1c7')});db[_0x8bc1('0xb1')][_0x8bc1('0x116')](db[_0x8bc1('0xb1')],{'as':_0x8bc1('0x1c9'),'foreignKey':_0x8bc1('0x1ca')});db[_0x8bc1('0xb1')][_0x8bc1('0x116')](db[_0x8bc1('0xb1')],{'as':_0x8bc1('0x1cf'),'foreignKey':_0x8bc1('0x1c8')});db['ZohoField'][_0x8bc1('0x121')](db[_0x8bc1('0x1cb')],{'as':_0x8bc1('0x1cb'),'foreignKey':_0x8bc1('0x1cc')});db[_0x8bc1('0xb2')][_0x8bc1('0x116')](db[_0x8bc1('0x1d4')],{'as':_0x8bc1('0x1c4'),'onDelete':'cascade','foreignKey':_0x8bc1('0x1c5')});db['ZendeskConfiguration'][_0x8bc1('0x116')](db[_0x8bc1('0x1d5')],{'as':_0x8bc1('0x1c6'),'foreignKey':_0x8bc1('0x1c7')});db['ZendeskConfiguration'][_0x8bc1('0x116')](db['ZendeskField'],{'as':_0x8bc1('0x1cd'),'foreignKey':'DescriptionId'});db[_0x8bc1('0x1d4')][_0x8bc1('0x116')](db[_0x8bc1('0x1d5')],{'as':_0x8bc1('0x1c1'),'foreignKey':_0x8bc1('0x1c8')});db[_0x8bc1('0x1d4')][_0x8bc1('0x121')](db[_0x8bc1('0xb2')],{'as':_0x8bc1('0x171'),'foreignKey':_0x8bc1('0x1c5')});db['ZendeskConfiguration'][_0x8bc1('0x125')](db['Tag'],{'through':_0x8bc1('0x1d6')});db['ZendeskField'][_0x8bc1('0x116')](db[_0x8bc1('0x1d5')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x8bc1('0x1d5')][_0x8bc1('0x116')](db['ZendeskField'],{'as':_0x8bc1('0x1c9'),'foreignKey':_0x8bc1('0x1ca')});db[_0x8bc1('0x1d5')][_0x8bc1('0x116')](db[_0x8bc1('0x1d5')],{'as':'Field','foreignKey':_0x8bc1('0x1c8')});db['ZendeskField']['belongsTo'](db[_0x8bc1('0x1cb')],{'as':_0x8bc1('0x1cb'),'foreignKey':'VariableId'});db[_0x8bc1('0xb6')][_0x8bc1('0x116')](db[_0x8bc1('0xb8')],{'as':_0x8bc1('0x1c4'),'onDelete':_0x8bc1('0x112'),'foreignKey':_0x8bc1('0x1c5')});db[_0x8bc1('0xb8')][_0x8bc1('0x116')](db[_0x8bc1('0xb9')],{'as':_0x8bc1('0x1c6'),'onDelete':'cascade','foreignKey':_0x8bc1('0x1c7')});db[_0x8bc1('0xb8')]['hasMany'](db[_0x8bc1('0xb9')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x8bc1('0x1ca')});db[_0x8bc1('0xb8')][_0x8bc1('0x116')](db['FreshdeskField'],{'as':'Fields','onDelete':'cascade','foreignKey':_0x8bc1('0x1c8')});db['FreshdeskConfiguration'][_0x8bc1('0x121')](db[_0x8bc1('0xb6')],{'as':_0x8bc1('0x171'),'foreignKey':_0x8bc1('0x1c5')});db[_0x8bc1('0xb8')]['belongsToMany'](db['Tag'],{'through':_0x8bc1('0x1d7')});db[_0x8bc1('0xb9')][_0x8bc1('0x116')](db['FreshdeskField'],{'as':_0x8bc1('0x1ce'),'foreignKey':_0x8bc1('0x1c7')});db[_0x8bc1('0xb9')][_0x8bc1('0x116')](db[_0x8bc1('0xb9')],{'as':_0x8bc1('0x1c9'),'foreignKey':_0x8bc1('0x1ca')});db[_0x8bc1('0xb9')][_0x8bc1('0x116')](db[_0x8bc1('0xb9')],{'as':_0x8bc1('0x1cf'),'foreignKey':_0x8bc1('0x1c8')});db[_0x8bc1('0xb9')][_0x8bc1('0x121')](db['Variable'],{'as':_0x8bc1('0x1cb'),'foreignKey':'VariableId'});db['VtigerAccount'][_0x8bc1('0x116')](db[_0x8bc1('0xbc')],{'as':_0x8bc1('0x1c4'),'onDelete':_0x8bc1('0x112'),'foreignKey':_0x8bc1('0x1c5')});db['VtigerConfiguration']['hasMany'](db[_0x8bc1('0xbd')],{'as':_0x8bc1('0x1c6'),'foreignKey':_0x8bc1('0x1c7')});db['VtigerConfiguration']['hasMany'](db[_0x8bc1('0xbd')],{'as':_0x8bc1('0x1cd'),'foreignKey':_0x8bc1('0x1ca')});db['VtigerConfiguration']['hasMany'](db['VtigerField'],{'as':_0x8bc1('0x1c1'),'foreignKey':_0x8bc1('0x1c8')});db[_0x8bc1('0xbc')][_0x8bc1('0x121')](db[_0x8bc1('0xbb')],{'as':'Account','foreignKey':_0x8bc1('0x1c5')});db[_0x8bc1('0xbd')]['hasMany'](db['VtigerField'],{'as':_0x8bc1('0x1ce'),'foreignKey':_0x8bc1('0x1c7')});db[_0x8bc1('0xbd')][_0x8bc1('0x116')](db[_0x8bc1('0xbd')],{'as':_0x8bc1('0x1c9'),'foreignKey':_0x8bc1('0x1ca')});db[_0x8bc1('0xbd')][_0x8bc1('0x116')](db[_0x8bc1('0xbd')],{'as':'Field','foreignKey':'FieldId'});db[_0x8bc1('0xbd')][_0x8bc1('0x121')](db[_0x8bc1('0x1cb')],{'as':_0x8bc1('0x1cb'),'foreignKey':_0x8bc1('0x1cc')});db[_0x8bc1('0xbf')][_0x8bc1('0x116')](db[_0x8bc1('0xc0')],{'as':_0x8bc1('0x1c4'),'onDelete':'cascade','foreignKey':_0x8bc1('0x1c5')});db['ServicenowConfiguration']['hasMany'](db[_0x8bc1('0xc1')],{'as':_0x8bc1('0x1c6'),'foreignKey':_0x8bc1('0x1c7')});db[_0x8bc1('0xc0')][_0x8bc1('0x116')](db[_0x8bc1('0xc1')],{'as':'Descriptions','foreignKey':_0x8bc1('0x1ca')});db[_0x8bc1('0xc0')]['hasMany'](db[_0x8bc1('0xc1')],{'as':_0x8bc1('0x1c1'),'foreignKey':_0x8bc1('0x1c8')});db['ServicenowConfiguration'][_0x8bc1('0x121')](db['ServicenowAccount'],{'as':_0x8bc1('0x171'),'foreignKey':_0x8bc1('0x1c5')});db[_0x8bc1('0xc1')][_0x8bc1('0x116')](db[_0x8bc1('0xc1')],{'as':'Subject','foreignKey':_0x8bc1('0x1c7')});db[_0x8bc1('0xc1')][_0x8bc1('0x116')](db[_0x8bc1('0xc1')],{'as':'Description','foreignKey':_0x8bc1('0x1ca')});db[_0x8bc1('0xc1')][_0x8bc1('0x116')](db[_0x8bc1('0xc1')],{'as':_0x8bc1('0x1cf'),'foreignKey':'FieldId'});db[_0x8bc1('0xc1')][_0x8bc1('0x121')](db[_0x8bc1('0x1cb')],{'as':_0x8bc1('0x1cb'),'foreignKey':_0x8bc1('0x1cc')});db[_0x8bc1('0x1d8')][_0x8bc1('0x116')](db[_0x8bc1('0xc3')],{'as':_0x8bc1('0x1c4'),'onDelete':_0x8bc1('0x112'),'foreignKey':'AccountId'});db['Dynamics365Account']['belongsTo'](db['CloudProvider'],{'as':_0x8bc1('0x161'),'foreignKey':'CloudProviderId'});db['Dynamics365Configuration'][_0x8bc1('0x116')](db[_0x8bc1('0xc5')],{'as':'Subjects','onDelete':_0x8bc1('0x112'),'foreignKey':_0x8bc1('0x1c7')});db[_0x8bc1('0xc3')][_0x8bc1('0x116')](db[_0x8bc1('0xc5')],{'as':_0x8bc1('0x1cd'),'onDelete':_0x8bc1('0x112'),'foreignKey':_0x8bc1('0x1ca')});db[_0x8bc1('0xc3')]['hasMany'](db[_0x8bc1('0xc5')],{'as':'Fields','onDelete':_0x8bc1('0x112'),'foreignKey':_0x8bc1('0x1c8')});db[_0x8bc1('0xc3')][_0x8bc1('0x121')](db[_0x8bc1('0x1d8')],{'as':'Account','foreignKey':_0x8bc1('0x1c5')});db['Dynamics365Field'][_0x8bc1('0x116')](db['Dynamics365Field'],{'as':_0x8bc1('0x1ce'),'foreignKey':_0x8bc1('0x1c7')});db[_0x8bc1('0xc5')][_0x8bc1('0x116')](db[_0x8bc1('0xc5')],{'as':_0x8bc1('0x1c9'),'foreignKey':_0x8bc1('0x1ca')});db[_0x8bc1('0xc5')][_0x8bc1('0x116')](db[_0x8bc1('0xc5')],{'as':_0x8bc1('0x1cf'),'foreignKey':'FieldId'});db[_0x8bc1('0xc5')][_0x8bc1('0x121')](db[_0x8bc1('0x1cb')],{'as':_0x8bc1('0x1cb'),'foreignKey':'VariableId'});db[_0x8bc1('0xc7')][_0x8bc1('0x116')](db[_0x8bc1('0x1d9')],{'as':_0x8bc1('0x1c4'),'onDelete':_0x8bc1('0x112'),'foreignKey':_0x8bc1('0x1c5')});db[_0x8bc1('0x1d9')][_0x8bc1('0x116')](db[_0x8bc1('0xca')],{'as':_0x8bc1('0x1c6'),'foreignKey':_0x8bc1('0x1c7')});db['FreshsalesConfiguration'][_0x8bc1('0x116')](db['FreshsalesField'],{'as':_0x8bc1('0x1cd'),'foreignKey':'DescriptionId'});db[_0x8bc1('0x1d9')][_0x8bc1('0x116')](db[_0x8bc1('0xca')],{'as':_0x8bc1('0x1c1'),'foreignKey':_0x8bc1('0x1c8')});db[_0x8bc1('0x1d9')][_0x8bc1('0x121')](db[_0x8bc1('0xc7')],{'as':_0x8bc1('0x171'),'foreignKey':'AccountId'});db[_0x8bc1('0xca')][_0x8bc1('0x116')](db[_0x8bc1('0xca')],{'as':_0x8bc1('0x1ce'),'foreignKey':_0x8bc1('0x1c7')});db[_0x8bc1('0xca')][_0x8bc1('0x116')](db[_0x8bc1('0xca')],{'as':'Description','foreignKey':_0x8bc1('0x1ca')});db[_0x8bc1('0xca')]['hasMany'](db[_0x8bc1('0xca')],{'as':'Field','foreignKey':_0x8bc1('0x1c8')});db['FreshsalesField'][_0x8bc1('0x121')](db['Variable'],{'as':_0x8bc1('0x1cb'),'foreignKey':'VariableId'});db[_0x8bc1('0xce')]['belongsTo'](db[_0x8bc1('0x64')],{});db[_0x8bc1('0xce')][_0x8bc1('0x121')](db[_0x8bc1('0xf5')],{'as':_0x8bc1('0x16b'),'foreignKey':_0x8bc1('0x16c')});db[_0x8bc1('0xce')][_0x8bc1('0x121')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0x8bc1('0xce')]['belongsTo'](db[_0x8bc1('0x68')],{});db[_0x8bc1('0xce')]['belongsTo'](db[_0x8bc1('0x6a')],{});db[_0x8bc1('0xce')][_0x8bc1('0x121')](db[_0x8bc1('0x12')],{});db[_0x8bc1('0xce')][_0x8bc1('0x121')](db['ChatQueue'],{});db[_0x8bc1('0xcf')]['belongsTo'](db[_0x8bc1('0x12')],{'onDelete':_0x8bc1('0x112'),'foreignKey':_0x8bc1('0x1da')});db[_0x8bc1('0xcf')][_0x8bc1('0x121')](db['User'],{'onDelete':'cascade','foreignKey':_0x8bc1('0x1db')});db[_0x8bc1('0x14c')][_0x8bc1('0x116')](db[_0x8bc1('0x1dc')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x8bc1('0x14c')][_0x8bc1('0x116')](db['JscriptyAnswerReport'],{'foreignKey':_0x8bc1('0x1dd'),'onDelete':'cascade'});db[_0x8bc1('0xd2')][_0x8bc1('0x121')](db['SmsAccount'],{});db[_0x8bc1('0xd2')][_0x8bc1('0x121')](db[_0x8bc1('0xf5')],{'as':_0x8bc1('0x16b'),'foreignKey':'ListId'});db[_0x8bc1('0xd2')]['belongsTo'](db[_0x8bc1('0x76')],{'as':_0x8bc1('0x15e'),'foreignKey':_0x8bc1('0x15f')});db['SmsQueueReport'][_0x8bc1('0x121')](db[_0x8bc1('0x58')],{});db[_0x8bc1('0xd2')][_0x8bc1('0x121')](db[_0x8bc1('0x186')],{});db[_0x8bc1('0xd2')][_0x8bc1('0x121')](db[_0x8bc1('0x12')],{});db['SmsQueueReport'][_0x8bc1('0x121')](db[_0x8bc1('0x5a')],{});db[_0x8bc1('0x1de')][_0x8bc1('0x116')](db['JscriptySessionReport'],{'foreignKey':'ProjectId'});db['JscriptyProject'][_0x8bc1('0x116')](db[_0x8bc1('0x1dc')],{'foreignKey':_0x8bc1('0x1df')});db[_0x8bc1('0x1de')][_0x8bc1('0x116')](db[_0x8bc1('0xd0')],{'foreignKey':_0x8bc1('0x1df')});db[_0x8bc1('0xe1')][_0x8bc1('0x125')](db['User'],{'as':'Agents','through':_0x8bc1('0x128')});db[_0x8bc1('0xe1')][_0x8bc1('0x125')](db['VoiceQueue'],{'through':_0x8bc1('0x10a'),'as':'VoiceQueues'});db[_0x8bc1('0xe1')][_0x8bc1('0x125')](db[_0x8bc1('0x3f')],{'through':_0x8bc1('0x16f'),'as':_0x8bc1('0x1e0')});db[_0x8bc1('0xe1')][_0x8bc1('0x125')](db[_0x8bc1('0x6e')],{'through':'team_has_chat_queues','as':_0x8bc1('0x131')});db[_0x8bc1('0xe1')][_0x8bc1('0x125')](db[_0x8bc1('0x52')],{'through':_0x8bc1('0x184'),'as':'FaxQueues'});db['Team'][_0x8bc1('0x125')](db[_0x8bc1('0x5a')],{'through':'team_has_sms_queues','as':_0x8bc1('0x135')});db[_0x8bc1('0xe1')][_0x8bc1('0x125')](db[_0x8bc1('0x62')],{'through':_0x8bc1('0x190'),'as':_0x8bc1('0x136')});db[_0x8bc1('0xe1')][_0x8bc1('0x125')](db['WhatsappQueue'],{'through':_0x8bc1('0x1e1'),'as':_0x8bc1('0x137')});db[_0x8bc1('0xe1')][_0x8bc1('0x125')](db[_0x8bc1('0xf7')],{'through':_0x8bc1('0x10b'),'as':'VoicePrefixes'});db[_0x8bc1('0xe5')]['hasMany'](db[_0x8bc1('0x149')],{'as':_0x8bc1('0x14a'),'foreignKey':_0x8bc1('0x1a6')});db['Campaign'][_0x8bc1('0x116')](db['CmHopperFinal'],{'as':_0x8bc1('0x119'),'foreignKey':_0x8bc1('0x1a6')});db['Campaign'][_0x8bc1('0x116')](db[_0x8bc1('0x7b')],{'as':_0x8bc1('0x14b'),'foreignKey':_0x8bc1('0x1a6')});db[_0x8bc1('0xe5')][_0x8bc1('0x116')](db[_0x8bc1('0x78')],{'as':_0x8bc1('0x1e2'),'foreignKey':_0x8bc1('0x1a6')});db[_0x8bc1('0xe5')]['belongsTo'](db[_0x8bc1('0x2a')],{'as':'Trunk','foreignKey':_0x8bc1('0x1e3')});db[_0x8bc1('0xe5')][_0x8bc1('0x121')](db[_0x8bc1('0x2a')],{'as':'TrunkBackup','foreignKey':_0x8bc1('0x1e4')});db['Campaign']['belongsTo'](db[_0x8bc1('0x14e')],{'as':_0x8bc1('0x14e'),'foreignKey':_0x8bc1('0x14f')});db[_0x8bc1('0xe5')][_0x8bc1('0x121')](db[_0x8bc1('0xdc')],{'as':_0x8bc1('0xdc'),'foreignKey':_0x8bc1('0x1e5')});db['Campaign'][_0x8bc1('0x125')](db[_0x8bc1('0xf5')],{'as':_0x8bc1('0x152'),'through':_0x8bc1('0x1e6')});db[_0x8bc1('0xe5')][_0x8bc1('0x125')](db[_0x8bc1('0xf5')],{'as':_0x8bc1('0x156'),'through':_0x8bc1('0x1e7')});db['Attachment'][_0x8bc1('0x121')](db[_0x8bc1('0x6c')],{'as':'ChatOfflineMessage','foreignKey':'ChatOfflineMessageId'});db['MailTransferReport'][_0x8bc1('0x121')](db[_0x8bc1('0x44')],{});db[_0x8bc1('0x1e8')][_0x8bc1('0x121')](db[_0x8bc1('0x43')],{});db['MailTransferReport'][_0x8bc1('0x121')](db[_0x8bc1('0x13c')],{'foreignKey':_0x8bc1('0x1e9'),'as':_0x8bc1('0x1ea')});db[_0x8bc1('0x1e8')][_0x8bc1('0x121')](db[_0x8bc1('0x12')],{'foreignKey':_0x8bc1('0x1eb'),'as':'FromAgent'});db[_0x8bc1('0x1e8')][_0x8bc1('0x121')](db['User'],{'foreignKey':_0x8bc1('0x1ec'),'as':_0x8bc1('0x1ed')});db[_0x8bc1('0x1e8')][_0x8bc1('0x121')](db['MailQueue'],{'foreignKey':_0x8bc1('0x1ee'),'as':_0x8bc1('0x1ef')});db[_0x8bc1('0x1e8')][_0x8bc1('0x121')](db[_0x8bc1('0x13c')],{'foreignKey':'ToMailAccountId','as':_0x8bc1('0x1f0')});db[_0x8bc1('0xee')][_0x8bc1('0x121')](db[_0x8bc1('0x6a')],{});db[_0x8bc1('0xee')]['belongsTo'](db[_0x8bc1('0x68')],{});db['ChatTransferReport'][_0x8bc1('0x121')](db[_0x8bc1('0x64')],{'foreignKey':_0x8bc1('0x1f1'),'as':_0x8bc1('0x1ea')});db['ChatTransferReport'][_0x8bc1('0x121')](db[_0x8bc1('0x12')],{'foreignKey':_0x8bc1('0x1eb'),'as':_0x8bc1('0x1f2')});db[_0x8bc1('0xee')][_0x8bc1('0x121')](db[_0x8bc1('0x12')],{'foreignKey':_0x8bc1('0x1ec'),'as':'ToAgent'});db[_0x8bc1('0xee')]['belongsTo'](db['ChatQueue'],{'foreignKey':_0x8bc1('0x1f3'),'as':_0x8bc1('0x1ef')});db[_0x8bc1('0xee')][_0x8bc1('0x121')](db['ChatWebsite'],{'foreignKey':'ToChatWebsiteId','as':_0x8bc1('0x1f0')});db[_0x8bc1('0xf0')][_0x8bc1('0x121')](db[_0x8bc1('0x181')],{});db['FaxTransferReport'][_0x8bc1('0x121')](db['FaxInteraction'],{});db[_0x8bc1('0xf0')][_0x8bc1('0x121')](db[_0x8bc1('0x4c')],{'foreignKey':_0x8bc1('0x1f4'),'as':_0x8bc1('0x1ea')});db[_0x8bc1('0xf0')][_0x8bc1('0x121')](db[_0x8bc1('0x12')],{'foreignKey':_0x8bc1('0x1eb'),'as':_0x8bc1('0x1f2')});db[_0x8bc1('0xf0')]['belongsTo'](db['User'],{'foreignKey':_0x8bc1('0x1ec'),'as':'ToAgent'});db[_0x8bc1('0xf0')][_0x8bc1('0x121')](db[_0x8bc1('0x52')],{'foreignKey':'ToFaxQueueId','as':'ToQueue'});db[_0x8bc1('0xf0')]['belongsTo'](db[_0x8bc1('0x4c')],{'foreignKey':_0x8bc1('0x1f5'),'as':_0x8bc1('0x1f0')});db[_0x8bc1('0xf2')]['belongsTo'](db[_0x8bc1('0x18c')],{});db[_0x8bc1('0xf2')][_0x8bc1('0x121')](db[_0x8bc1('0x5f')],{});db[_0x8bc1('0xf2')][_0x8bc1('0x121')](db[_0x8bc1('0x5c')],{'foreignKey':'FromOpenchannelAccountId','as':_0x8bc1('0x1ea')});db[_0x8bc1('0xf2')]['belongsTo'](db[_0x8bc1('0x12')],{'foreignKey':'FromUserId','as':_0x8bc1('0x1f2')});db[_0x8bc1('0xf2')][_0x8bc1('0x121')](db[_0x8bc1('0x12')],{'foreignKey':_0x8bc1('0x1ec'),'as':_0x8bc1('0x1ed')});db['OpenchannelTransferReport'][_0x8bc1('0x121')](db[_0x8bc1('0x62')],{'foreignKey':'ToOpenchannelQueueId','as':_0x8bc1('0x1ef')});db[_0x8bc1('0xf2')]['belongsTo'](db[_0x8bc1('0x5c')],{'foreignKey':_0x8bc1('0x1f6'),'as':_0x8bc1('0x1f0')});db['SmsTransferReport'][_0x8bc1('0x121')](db['SmsMessage'],{});db[_0x8bc1('0xf4')][_0x8bc1('0x121')](db[_0x8bc1('0x58')],{});db[_0x8bc1('0xf4')][_0x8bc1('0x121')](db[_0x8bc1('0x56')],{'foreignKey':'FromSmsAccountId','as':_0x8bc1('0x1ea')});db[_0x8bc1('0xf4')][_0x8bc1('0x121')](db[_0x8bc1('0x12')],{'foreignKey':_0x8bc1('0x1eb'),'as':_0x8bc1('0x1f2')});db[_0x8bc1('0xf4')][_0x8bc1('0x121')](db[_0x8bc1('0x12')],{'foreignKey':_0x8bc1('0x1ec'),'as':_0x8bc1('0x1ed')});db[_0x8bc1('0xf4')][_0x8bc1('0x121')](db[_0x8bc1('0x5a')],{'foreignKey':_0x8bc1('0x1f7'),'as':_0x8bc1('0x1ef')});db[_0x8bc1('0xf4')][_0x8bc1('0x121')](db[_0x8bc1('0x56')],{'foreignKey':_0x8bc1('0x1f8'),'as':_0x8bc1('0x1f0')});db[_0x8bc1('0xf5')][_0x8bc1('0x116')](db[_0x8bc1('0x17d')],{'as':_0x8bc1('0x167'),'foreignKey':'ListId','onDelete':_0x8bc1('0x112')});db[_0x8bc1('0xf5')][_0x8bc1('0x116')](db['CmCustomField'],{'as':_0x8bc1('0x1f9'),'foreignKey':_0x8bc1('0x16c')});db['CmList']['hasMany'](db[_0x8bc1('0x76')],{'as':_0x8bc1('0x19e'),'onDelete':_0x8bc1('0x112'),'foreignKey':'ListId'});db[_0x8bc1('0xf5')][_0x8bc1('0x116')](db['CmHopperFinal'],{'as':_0x8bc1('0x119'),'foreignKey':'ListId'});db[_0x8bc1('0xf5')][_0x8bc1('0x116')](db[_0x8bc1('0x7b')],{'as':_0x8bc1('0x11a'),'foreignKey':_0x8bc1('0x16c')});db[_0x8bc1('0xf5')][_0x8bc1('0x116')](db['ReportAgentPreview'],{'as':_0x8bc1('0x7d'),'foreignKey':'ListId'});db['CmList'][_0x8bc1('0x125')](db['VoiceQueue'],{'as':_0x8bc1('0x1fa'),'through':_0x8bc1('0x153')});db['CmList'][_0x8bc1('0x125')](db['User'],{'as':_0x8bc1('0x154'),'through':_0x8bc1('0x127')});db[_0x8bc1('0xf7')][_0x8bc1('0x116')](db[_0x8bc1('0x117')],{'as':_0x8bc1('0x118'),'onDelete':'cascade'});db['VoicePrefix'][_0x8bc1('0x125')](db[_0x8bc1('0x12')],{'as':'Agents','through':'UserVoicePrefix'});db[_0x8bc1('0xf7')]['belongsToMany'](db[_0x8bc1('0xe1')],{'through':_0x8bc1('0x10b'),'as':_0x8bc1('0x155')});db[_0x8bc1('0xf8')][_0x8bc1('0x116')](db['User'],{'as':_0x8bc1('0x177'),'foreignKey':'userProfileId'});db[_0x8bc1('0xf8')][_0x8bc1('0x116')](db[_0x8bc1('0xfa')],{'as':'UserProfileSections','foreignKey':'userProfileId','onDelete':_0x8bc1('0x112')});db[_0x8bc1('0xfa')][_0x8bc1('0x116')](db[_0x8bc1('0xfc')],{'as':'Resources','foreignKey':'sectionId','onDelete':_0x8bc1('0x112')});db[_0x8bc1('0x1fb')][_0x8bc1('0x116')](db[_0x8bc1('0x17d')],{'as':_0x8bc1('0x167'),'foreignKey':_0x8bc1('0x1fc'),'onDelete':_0x8bc1('0x112')});db[_0x8bc1('0x1fb')][_0x8bc1('0x116')](db[_0x8bc1('0x82')],{'as':_0x8bc1('0x168'),'foreignKey':_0x8bc1('0x1fc')});db[_0x8bc1('0x1fb')][_0x8bc1('0x116')](db[_0x8bc1('0x1fd')],{'as':_0x8bc1('0x169'),'foreignKey':_0x8bc1('0x1fc')});db['WhatsappAccount'][_0x8bc1('0x116')](db['WhatsappInteraction'],{'as':_0x8bc1('0x16a')});db[_0x8bc1('0x1fb')][_0x8bc1('0x116')](db[_0x8bc1('0x101')],{'as':'Applications'});db[_0x8bc1('0x1fb')][_0x8bc1('0x121')](db[_0x8bc1('0xf5')],{'as':_0x8bc1('0x16b'),'foreignKey':_0x8bc1('0x16c')});db[_0x8bc1('0x1fb')]['belongsTo'](db[_0x8bc1('0x87')],{'as':_0x8bc1('0x150'),'foreignKey':_0x8bc1('0x151')});db['WhatsappAccount'][_0x8bc1('0x125')](db['User'],{'as':_0x8bc1('0x154'),'through':_0x8bc1('0x1fe')});db[_0x8bc1('0x101')][_0x8bc1('0x121')](db[_0x8bc1('0x12')],{'onDelete':_0x8bc1('0x163')});db[_0x8bc1('0x101')][_0x8bc1('0x121')](db[_0x8bc1('0x108')],{'onDelete':_0x8bc1('0x163')});db[_0x8bc1('0x101')][_0x8bc1('0x121')](db[_0x8bc1('0x1fb')],{'onDelete':_0x8bc1('0x163')});db[_0x8bc1('0x101')][_0x8bc1('0x121')](db['Interval'],{'onDelete':_0x8bc1('0x163'),'foreignKey':_0x8bc1('0x14f')});db['WhatsappApplication'][_0x8bc1('0x121')](db[_0x8bc1('0x173')],{'onDelete':_0x8bc1('0x163'),'foreignKey':_0x8bc1('0x180')});db['WhatsappInteraction'][_0x8bc1('0x116')](db[_0x8bc1('0x1fd')],{'as':_0x8bc1('0x169'),'onDelete':'cascade','foreignKey':_0x8bc1('0x1ff')});db['WhatsappInteraction'][_0x8bc1('0x121')](db['WhatsappAccount'],{'as':_0x8bc1('0x171'),'foreignKey':_0x8bc1('0x1fc')});db['WhatsappInteraction'][_0x8bc1('0x121')](db[_0x8bc1('0x76')],{'as':'Contact','foreignKey':'ContactId'});db[_0x8bc1('0x103')][_0x8bc1('0x121')](db[_0x8bc1('0x12')],{'as':_0x8bc1('0x172'),'foreignKey':'UserId'});db['WhatsappInteraction'][_0x8bc1('0x125')](db[_0x8bc1('0x173')],{'through':_0x8bc1('0x1b9'),'as':_0x8bc1('0x175')});db[_0x8bc1('0x103')][_0x8bc1('0x125')](db[_0x8bc1('0x173')],{'through':'whatsapp_interaction_has_tags','as':'ThroughTags'});db[_0x8bc1('0x103')][_0x8bc1('0x125')](db[_0x8bc1('0x12')],{'as':_0x8bc1('0x177'),'through':_0x8bc1('0x200'),'foreignKey':'WhatsappInteractionId'});db[_0x8bc1('0x1fd')][_0x8bc1('0x121')](db[_0x8bc1('0x12')],{'as':_0x8bc1('0x12')});db[_0x8bc1('0x1fd')][_0x8bc1('0x121')](db[_0x8bc1('0x76')],{'onDelete':_0x8bc1('0x112'),'as':_0x8bc1('0x15e')});db['WhatsappMessage'][_0x8bc1('0x121')](db['WhatsappInteraction'],{'onDelete':_0x8bc1('0x112'),'as':'Interaction','foreignKey':_0x8bc1('0x1ff')});db[_0x8bc1('0x1fd')][_0x8bc1('0x121')](db[_0x8bc1('0x1fb')],{'as':_0x8bc1('0x171'),'foreignKey':_0x8bc1('0x1fc')});db['WhatsappQueueReport'][_0x8bc1('0x121')](db[_0x8bc1('0x1fb')],{});db[_0x8bc1('0x106')][_0x8bc1('0x121')](db[_0x8bc1('0xf5')],{'as':_0x8bc1('0x16b'),'foreignKey':_0x8bc1('0x16c')});db[_0x8bc1('0x106')][_0x8bc1('0x121')](db[_0x8bc1('0x76')],{'as':_0x8bc1('0x15e'),'foreignKey':_0x8bc1('0x15f')});db['WhatsappQueueReport'][_0x8bc1('0x121')](db[_0x8bc1('0x103')],{});db[_0x8bc1('0x106')][_0x8bc1('0x121')](db[_0x8bc1('0x108')],{});db[_0x8bc1('0x106')]['belongsTo'](db[_0x8bc1('0x1fd')],{});db[_0x8bc1('0x106')][_0x8bc1('0x121')](db[_0x8bc1('0x12')],{});db[_0x8bc1('0x201')]['belongsTo'](db[_0x8bc1('0x1fd')],{});db['WhatsappTransferReport'][_0x8bc1('0x121')](db[_0x8bc1('0x103')],{});db['WhatsappTransferReport'][_0x8bc1('0x121')](db[_0x8bc1('0x1fb')],{'foreignKey':_0x8bc1('0x202'),'as':_0x8bc1('0x1ea')});db[_0x8bc1('0x201')][_0x8bc1('0x121')](db[_0x8bc1('0x1fb')],{'foreignKey':_0x8bc1('0x203'),'as':_0x8bc1('0x1f0')});db[_0x8bc1('0x201')][_0x8bc1('0x121')](db['WhatsappQueue'],{'foreignKey':_0x8bc1('0x204'),'as':'ToQueue'});db[_0x8bc1('0x201')][_0x8bc1('0x121')](db[_0x8bc1('0x12')],{'foreignKey':_0x8bc1('0x1eb'),'as':_0x8bc1('0x1f2')});db[_0x8bc1('0x201')][_0x8bc1('0x121')](db[_0x8bc1('0x12')],{'foreignKey':'ToUserId','as':_0x8bc1('0x1ed')});db[_0x8bc1('0x108')]['belongsToMany'](db[_0x8bc1('0x12')],{'as':_0x8bc1('0x154'),'through':_0x8bc1('0x39'),'foreignKey':_0x8bc1('0x205')});db[_0x8bc1('0x108')]['belongsToMany'](db['Team'],{'through':_0x8bc1('0x1e1'),'as':_0x8bc1('0x155')});db[_0x8bc1('0x10f')][_0x8bc1('0x121')](db[_0x8bc1('0x12')],{'as':'user','foreignKey':_0x8bc1('0x113'),'onDelete':_0x8bc1('0x112'),'hooks':!![]});db[_0x8bc1('0x161')][_0x8bc1('0x111')](db[_0x8bc1('0x1d8')],{'as':_0x8bc1('0x1d8'),'onDelete':_0x8bc1('0x163')});db[_0x8bc1('0x161')][_0x8bc1('0x111')](db[_0x8bc1('0x3b')],{'as':'Imap','onDelete':_0x8bc1('0x163')});db[_0x8bc1('0x161')][_0x8bc1('0x111')](db['MailServerOut'],{'as':_0x8bc1('0x166'),'onDelete':'restrict'});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 69d6fcc..52f1deb 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4b8c=['/api/cm/hopper_final','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','./api/cannedAnswer','/api/dispositions','./api/disposition','./api/condition','/api/intervals','./api/interval','./api/pause','./api/cdr','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','./api/template','./api/trigger','/api/variables','/api/integrations','./api/integration','/api/integrations/reports','./api/analyticCustomReport','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/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/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','./api/intFreshsalesField','./api/network','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/squareReport','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','./api/user-setting','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','/api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','static','root','/www','join','/snippet','snippet','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','then','use','/api/users','./api/user','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./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/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','./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/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','./api/dashboardItem','./api/faxAccount','/api/fax/applications','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','/api/sms/applications','./api/smsApplication','./api/smsInteraction','/api/sms/messages','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','/api/chat/interactions','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopper','/api/cm/hopper_black'];(function(_0x49d367,_0x2864c5){var _0x1546a1=function(_0x44c309){while(--_0x44c309){_0x49d367['push'](_0x49d367['shift']());}};_0x1546a1(++_0x2864c5);}(_0x4b8c,0xb1));var _0xc4b8=function(_0xe74312,_0x4871c7){_0xe74312=_0xe74312-0x0;var _0x398e39=_0x4b8c[_0xe74312];return _0x398e39;};'use strict';var path=require(_0xc4b8('0x0'));var express=require(_0xc4b8('0x1'));var errors=require(_0xc4b8('0x2'));var config=require(_0xc4b8('0x3'));var setupLoggers=require(_0xc4b8('0x4'))[_0xc4b8('0x5')];var clientSideLogs=require('./api/client-side-logs');exports['default']=function(_0x590268){return setupLoggers(_0x590268)[_0xc4b8('0x6')](function(){_0x590268[_0xc4b8('0x7')](_0xc4b8('0x8'),require(_0xc4b8('0x9')));_0x590268[_0xc4b8('0x7')]('/api/voice/chanspy',require('./api/voiceChanSpy'));_0x590268[_0xc4b8('0x7')](_0xc4b8('0xa'),require(_0xc4b8('0xb')));_0x590268['use'](_0xc4b8('0xc'),require(_0xc4b8('0xd')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0xe'),require(_0xc4b8('0xf')));_0x590268['use'](_0xc4b8('0x10'),require(_0xc4b8('0x11')));_0x590268[_0xc4b8('0x7')]('/api/voice/recordings',require(_0xc4b8('0x12')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0x13'),require('./api/screenRecording'));_0x590268[_0xc4b8('0x7')](_0xc4b8('0x14'),require(_0xc4b8('0x15')));_0x590268['use'](_0xc4b8('0x16'),require(_0xc4b8('0x17')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0x18'),require(_0xc4b8('0x19')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0x1a'),require('./api/voiceDialReport'));_0x590268[_0xc4b8('0x7')]('/api/voice/agents/reports',require(_0xc4b8('0x1b')));_0x590268['use'](_0xc4b8('0x1c'),require(_0xc4b8('0x1d')));_0x590268['use'](_0xc4b8('0x1e'),require('./api/memberReport'));_0x590268[_0xc4b8('0x7')](_0xc4b8('0x1f'),require(_0xc4b8('0x20')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0x21'),require(_0xc4b8('0x22')));_0x590268[_0xc4b8('0x7')]('/api/mail/out_servers',require(_0xc4b8('0x23')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0x24'),require(_0xc4b8('0x25')));_0x590268['use'](_0xc4b8('0x26'),require(_0xc4b8('0x27')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0x28'),require(_0xc4b8('0x29')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0x2a'),require(_0xc4b8('0x2b')));_0x590268['use'](_0xc4b8('0x2c'),require('./api/mailMessage'));_0x590268[_0xc4b8('0x7')](_0xc4b8('0x2d'),require(_0xc4b8('0x2e')));_0x590268['use'](_0xc4b8('0x2f'),require(_0xc4b8('0x30')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0x31'),require('./api/dashboard'));_0x590268[_0xc4b8('0x7')](_0xc4b8('0x32'),require(_0xc4b8('0x33')));_0x590268[_0xc4b8('0x7')]('/api/fax/accounts',require(_0xc4b8('0x34')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0x35'),require('./api/faxApplication'));_0x590268[_0xc4b8('0x7')](_0xc4b8('0x36'),require(_0xc4b8('0x37')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0x38'),require(_0xc4b8('0x39')));_0x590268['use'](_0xc4b8('0x3a'),require(_0xc4b8('0x3b')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0x3c'),require(_0xc4b8('0x3d')));_0x590268[_0xc4b8('0x7')]('/api/sms/accounts',require(_0xc4b8('0x3e')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0x3f'),require(_0xc4b8('0x40')));_0x590268['use']('/api/sms/interactions',require(_0xc4b8('0x41')));_0x590268['use'](_0xc4b8('0x42'),require('./api/smsMessage'));_0x590268[_0xc4b8('0x7')](_0xc4b8('0x43'),require(_0xc4b8('0x44')));_0x590268['use'](_0xc4b8('0x45'),require(_0xc4b8('0x46')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0x47'),require(_0xc4b8('0x48')));_0x590268['use'](_0xc4b8('0x49'),require(_0xc4b8('0x4a')));_0x590268[_0xc4b8('0x7')]('/api/openchannel/messages',require(_0xc4b8('0x4b')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0x4c'),require(_0xc4b8('0x4d')));_0x590268[_0xc4b8('0x7')]('/api/chat/websites',require(_0xc4b8('0x4e')));_0x590268['use'](_0xc4b8('0x4f'),require(_0xc4b8('0x50')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0x51'),require('./api/chatApplication'));_0x590268[_0xc4b8('0x7')](_0xc4b8('0x52'),require('./api/chatInteraction'));_0x590268['use']('/api/chat/messages',require(_0xc4b8('0x53')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0x54'),require('./api/chatOfflineMessage'));_0x590268[_0xc4b8('0x7')](_0xc4b8('0x55'),require(_0xc4b8('0x56')));_0x590268['use'](_0xc4b8('0x57'),require(_0xc4b8('0x58')));_0x590268['use'](_0xc4b8('0x59'),require(_0xc4b8('0x5a')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0x5b'),require(_0xc4b8('0x5c')));_0x590268['use'](_0xc4b8('0x5d'),require(_0xc4b8('0x5e')));_0x590268[_0xc4b8('0x7')]('/api/cm/hopper',require(_0xc4b8('0x5f')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0x60'),require('./api/cmHopperBlack'));_0x590268['use'](_0xc4b8('0x61'),require('./api/cmHopperFinal'));_0x590268['use']('/api/cm/hopper_history',require(_0xc4b8('0x62')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0x63'),require(_0xc4b8('0x64')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0x65'),require(_0xc4b8('0x66')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0x67'),require(_0xc4b8('0x68')));_0x590268[_0xc4b8('0x7')]('/api/canned_answers',require(_0xc4b8('0x69')));_0x590268['use'](_0xc4b8('0x6a'),require(_0xc4b8('0x6b')));_0x590268[_0xc4b8('0x7')]('/api/conditions',require(_0xc4b8('0x6c')));_0x590268['use'](_0xc4b8('0x6d'),require(_0xc4b8('0x6e')));_0x590268['use']('/api/pauses',require(_0xc4b8('0x6f')));_0x590268[_0xc4b8('0x7')]('/api/cdr',require(_0xc4b8('0x70')));_0x590268[_0xc4b8('0x7')]('/api/voiceQueuesLog',require('./api/voiceQueuesLog'));_0x590268[_0xc4b8('0x7')](_0xc4b8('0x71'),require(_0xc4b8('0x72')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0x73'),require(_0xc4b8('0x74')));_0x590268['use'](_0xc4b8('0x75'),require(_0xc4b8('0x76')));_0x590268['use'](_0xc4b8('0x77'),require(_0xc4b8('0x78')));_0x590268['use'](_0xc4b8('0x79'),require(_0xc4b8('0x7a')));_0x590268['use'](_0xc4b8('0x7b'),require(_0xc4b8('0x7c')));_0x590268[_0xc4b8('0x7')]('/api/templates',require(_0xc4b8('0x7d')));_0x590268[_0xc4b8('0x7')]('/api/triggers',require(_0xc4b8('0x7e')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0x7f'),require('./api/variable'));_0x590268['use'](_0xc4b8('0x80'),require(_0xc4b8('0x81')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0x82'),require('./api/integrationReport'));_0x590268[_0xc4b8('0x7')]('/api/analytics/custom_reports',require(_0xc4b8('0x83')));_0x590268[_0xc4b8('0x7')]('/api/analytics/default_reports',require(_0xc4b8('0x84')));_0x590268['use'](_0xc4b8('0x85'),require(_0xc4b8('0x86')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0x87'),require(_0xc4b8('0x88')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0x89'),require(_0xc4b8('0x8a')));_0x590268['use']('/api/analytics/tree_reports',require('./api/analyticTreeReport'));_0x590268[_0xc4b8('0x7')](_0xc4b8('0x8b'),require(_0xc4b8('0x8c')));_0x590268[_0xc4b8('0x7')]('/api/integrations/salesforce/configurations',require(_0xc4b8('0x8d')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0x8e'),require(_0xc4b8('0x8f')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0x90'),require(_0xc4b8('0x91')));_0x590268['use'](_0xc4b8('0x92'),require(_0xc4b8('0x93')));_0x590268[_0xc4b8('0x7')]('/api/integrations/sugarcrm/fields',require(_0xc4b8('0x94')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0x95'),require(_0xc4b8('0x96')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0x97'),require(_0xc4b8('0x98')));_0x590268[_0xc4b8('0x7')]('/api/integrations/desk/fields',require(_0xc4b8('0x99')));_0x590268[_0xc4b8('0x7')]('/api/integrations/zoho/accounts',require(_0xc4b8('0x9a')));_0x590268['use'](_0xc4b8('0x9b'),require(_0xc4b8('0x9c')));_0x590268['use'](_0xc4b8('0x9d'),require('./api/intZohoField'));_0x590268[_0xc4b8('0x7')]('/api/integrations/zendesk/accounts',require('./api/intZendeskAccount'));_0x590268[_0xc4b8('0x7')](_0xc4b8('0x9e'),require('./api/intZendeskConfiguration'));_0x590268['use'](_0xc4b8('0x9f'),require(_0xc4b8('0xa0')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0xa1'),require('./api/intFreshdeskAccount'));_0x590268[_0xc4b8('0x7')](_0xc4b8('0xa2'),require(_0xc4b8('0xa3')));_0x590268['use']('/api/integrations/freshdesk/fields',require(_0xc4b8('0xa4')));_0x590268['use'](_0xc4b8('0xa5'),require(_0xc4b8('0xa6')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0xa7'),require(_0xc4b8('0xa8')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0xa9'),require(_0xc4b8('0xaa')));_0x590268['use'](_0xc4b8('0xab'),require(_0xc4b8('0xac')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0xad'),require(_0xc4b8('0xae')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0xaf'),require(_0xc4b8('0xb0')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0xb1'),require(_0xc4b8('0xb2')));_0x590268[_0xc4b8('0x7')]('/api/integrations/dynamics365/configurations',require(_0xc4b8('0xb3')));_0x590268[_0xc4b8('0x7')]('/api/integrations/dynamics365/fields',require(_0xc4b8('0xb4')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0xb5'),require('./api/intFreshsalesAccount'));_0x590268['use'](_0xc4b8('0xb6'),require(_0xc4b8('0xb7')));_0x590268[_0xc4b8('0x7')]('/api/integrations/freshsales/fields',require(_0xc4b8('0xb8')));_0x590268['use']('/api/networks',require(_0xc4b8('0xb9')));_0x590268['use']('/api/chat/reports/queue',require('./api/chatQueueReport'));_0x590268[_0xc4b8('0x7')](_0xc4b8('0xba'),require(_0xc4b8('0xbb')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0xbc'),require('./api/jscriptyAnswerReport'));_0x590268[_0xc4b8('0x7')](_0xc4b8('0xbd'),require(_0xc4b8('0xbe')));_0x590268['use'](_0xc4b8('0xbf'),require(_0xc4b8('0xc0')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0xc1'),require('./api/smsQueueReport'));_0x590268[_0xc4b8('0x7')]('/api/square/reports',require(_0xc4b8('0xc2')));_0x590268[_0xc4b8('0x7')]('/api/square/details/reports',require('./api/squareReportDetail'));_0x590268[_0xc4b8('0x7')]('/api/jscripty/projects',require(_0xc4b8('0xc3')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0xc4'),require(_0xc4b8('0xc5')));_0x590268['use'](_0xc4b8('0xc6'),require(_0xc4b8('0xc7')));_0x590268['use'](_0xc4b8('0xc8'),require(_0xc4b8('0xc9')));_0x590268['use'](_0xc4b8('0xca'),require(_0xc4b8('0xcb')));_0x590268[_0xc4b8('0x7')]('/api/square/messages',require(_0xc4b8('0xcc')));_0x590268['use'](_0xc4b8('0xcd'),require(_0xc4b8('0xce')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0xcf'),require(_0xc4b8('0xd0')));_0x590268['use'](_0xc4b8('0xd1'),require('./api/campaign'));_0x590268['use'](_0xc4b8('0xd2'),require(_0xc4b8('0xd3')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0xd4'),require(_0xc4b8('0xd5')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0xd6'),require('./api/plugin'));_0x590268[_0xc4b8('0x7')]('/api/mail/reports/transfer',require(_0xc4b8('0xd7')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0xd8'),require(_0xc4b8('0xd9')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0xda'),require('./api/faxTransferReport'));_0x590268[_0xc4b8('0x7')]('/api/openchannel/reports/transfer',require(_0xc4b8('0xdb')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0xdc'),require(_0xc4b8('0xdd')));_0x590268[_0xc4b8('0x7')]('/api/cm/lists',require(_0xc4b8('0xde')));_0x590268[_0xc4b8('0x7')]('/api/voice/prefixes',require('./api/voicePrefix'));_0x590268['use']('/api/userProfiles',require('./api/userProfile'));_0x590268[_0xc4b8('0x7')](_0xc4b8('0xdf'),require(_0xc4b8('0xe0')));_0x590268['use']('/api/userProfile/resources',require(_0xc4b8('0xe1')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0xe2'),require(_0xc4b8('0xe3')));_0x590268['use'](_0xc4b8('0xe4'),require(_0xc4b8('0xe5')));_0x590268[_0xc4b8('0x7')]('/api/whatsapp/applications',require('./api/whatsappApplication'));_0x590268[_0xc4b8('0x7')](_0xc4b8('0xe6'),require(_0xc4b8('0xe7')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0xe8'),require(_0xc4b8('0xe9')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0xea'),require(_0xc4b8('0xeb')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0xec'),require('./api/whatsappTransferReport'));_0x590268['use'](_0xc4b8('0xed'),require(_0xc4b8('0xee')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0xef'),require(_0xc4b8('0xf0')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0xf1'),require(_0xc4b8('0xf2')));_0x590268['use']('/api/user-settings',require(_0xc4b8('0xf3')));_0x590268[_0xc4b8('0x7')]('/api/auth/local',require(_0xc4b8('0xf4')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0xf5'),require(_0xc4b8('0xf6')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0xf7'),require(_0xc4b8('0xf8')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0xf9'),require(_0xc4b8('0xfa')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0xfb'),require(_0xc4b8('0xfc')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0xfd'),require('./api/version'));_0x590268[_0xc4b8('0x7')](_0xc4b8('0xfe'),require('./api/system'));_0x590268[_0xc4b8('0x7')](_0xc4b8('0xff'),require(_0xc4b8('0x100')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0x101'),require(_0xc4b8('0x102')));_0x590268[_0xc4b8('0x7')](_0xc4b8('0x103'),clientSideLogs);_0x590268[_0xc4b8('0x7')]('/apidoc',express[_0xc4b8('0x104')](path['join'](config[_0xc4b8('0x105')],'/apidoc')));_0x590268['use'](_0xc4b8('0x106'),express[_0xc4b8('0x104')](path[_0xc4b8('0x107')](config[_0xc4b8('0x105')],_0xc4b8('0x106'))));_0x590268[_0xc4b8('0x7')]('/demo',express['static'](path['join'](config[_0xc4b8('0x105')],'/demo')));_0x590268['use'](_0xc4b8('0x108'),express[_0xc4b8('0x104')](path['join'](config[_0xc4b8('0x105')],_0xc4b8('0x109'),'3.1.0')));_0x590268[_0xc4b8('0x7')]('/plugins',express[_0xc4b8('0x104')](path[_0xc4b8('0x107')](config[_0xc4b8('0x105')],_0xc4b8('0x10a'))));_0x590268[_0xc4b8('0x10b')](_0xc4b8('0x10c'))[_0xc4b8('0x10d')](errors[0x194]);_0x590268[_0xc4b8('0x10b')]('/*')[_0xc4b8('0x10d')](function(_0x276a2a,_0x53e038){_0x53e038[_0xc4b8('0x10e')](path[_0xc4b8('0x10f')](_0x590268[_0xc4b8('0x10d')](_0xc4b8('0x110'))+_0xc4b8('0x111')));});return _0x590268;});}; \ No newline at end of file +var _0x513a=['./api/plugin','/api/mail/reports/transfer','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','./api/userNotification','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/queue','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','./api/realtime','/api/user-settings','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','static','join','/apidoc','/www','root','/demo','3.1.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','express','./errors','./utils/client-side-logger','setupLoggers','./api/client-side-logs','/api/users','use','/api/voice/chanspy','./api/voiceChanSpy','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','/api/mail/substatuses','./api/mailInteraction','/api/mail/messages','./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/faxMessage','/api/fax/queues','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/queues','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','/api/intervals','./api/interval','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/schedule','/api/sounds','/api/tags','./api/tag','/api/contact_item_types','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','/api/variables','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','/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/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','./api/intFreshdeskField','./api/intVtigerAccount','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','./api/intFreshsalesField','./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/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','/api/teams','./api/team','/api/license','./api/license','./api/campaign','/api/migrations','./api/migration','/api/attachments','/api/plugins'];(function(_0x3b5e02,_0x535469){var _0x59464c=function(_0x2d11cb){while(--_0x2d11cb){_0x3b5e02['push'](_0x3b5e02['shift']());}};_0x59464c(++_0x535469);}(_0x513a,0x153));var _0xa513=function(_0x4e35d2,_0x516864){_0x4e35d2=_0x4e35d2-0x0;var _0x384964=_0x513a[_0x4e35d2];return _0x384964;};'use strict';var path=require(_0xa513('0x0'));var express=require(_0xa513('0x1'));var errors=require(_0xa513('0x2'));var config=require('./config/environment');var setupLoggers=require(_0xa513('0x3'))[_0xa513('0x4')];var clientSideLogs=require(_0xa513('0x5'));exports['default']=function(_0x5b3293){return setupLoggers(_0x5b3293)['then'](function(){_0x5b3293['use'](_0xa513('0x6'),require('./api/user'));_0x5b3293[_0xa513('0x7')](_0xa513('0x8'),require(_0xa513('0x9')));_0x5b3293[_0xa513('0x7')]('/api/voice/contexts',require(_0xa513('0xa')));_0x5b3293[_0xa513('0x7')](_0xa513('0xb'),require(_0xa513('0xc')));_0x5b3293[_0xa513('0x7')](_0xa513('0xd'),require(_0xa513('0xe')));_0x5b3293[_0xa513('0x7')](_0xa513('0xf'),require(_0xa513('0x10')));_0x5b3293[_0xa513('0x7')](_0xa513('0x11'),require('./api/voiceRecording'));_0x5b3293['use'](_0xa513('0x12'),require(_0xa513('0x13')));_0x5b3293[_0xa513('0x7')](_0xa513('0x14'),require(_0xa513('0x15')));_0x5b3293['use'](_0xa513('0x16'),require(_0xa513('0x17')));_0x5b3293[_0xa513('0x7')](_0xa513('0x18'),require('./api/voiceCallReport'));_0x5b3293[_0xa513('0x7')](_0xa513('0x19'),require(_0xa513('0x1a')));_0x5b3293[_0xa513('0x7')]('/api/voice/agents/reports',require(_0xa513('0x1b')));_0x5b3293[_0xa513('0x7')](_0xa513('0x1c'),require(_0xa513('0x1d')));_0x5b3293[_0xa513('0x7')]('/api/members/reports',require(_0xa513('0x1e')));_0x5b3293[_0xa513('0x7')](_0xa513('0x1f'),require(_0xa513('0x20')));_0x5b3293[_0xa513('0x7')]('/api/voice/transfers/reports',require(_0xa513('0x21')));_0x5b3293['use'](_0xa513('0x22'),require(_0xa513('0x23')));_0x5b3293['use'](_0xa513('0x24'),require(_0xa513('0x25')));_0x5b3293[_0xa513('0x7')](_0xa513('0x26'),require('./api/mailQueue'));_0x5b3293['use'](_0xa513('0x27'),require('./api/mailSubstatus'));_0x5b3293[_0xa513('0x7')]('/api/mail/interactions',require(_0xa513('0x28')));_0x5b3293[_0xa513('0x7')](_0xa513('0x29'),require(_0xa513('0x2a')));_0x5b3293['use'](_0xa513('0x2b'),require(_0xa513('0x2c')));_0x5b3293[_0xa513('0x7')](_0xa513('0x2d'),require(_0xa513('0x2e')));_0x5b3293[_0xa513('0x7')](_0xa513('0x2f'),require('./api/dashboard'));_0x5b3293[_0xa513('0x7')](_0xa513('0x30'),require(_0xa513('0x31')));_0x5b3293[_0xa513('0x7')](_0xa513('0x32'),require(_0xa513('0x33')));_0x5b3293['use'](_0xa513('0x34'),require(_0xa513('0x35')));_0x5b3293[_0xa513('0x7')](_0xa513('0x36'),require(_0xa513('0x37')));_0x5b3293[_0xa513('0x7')]('/api/fax/messages',require(_0xa513('0x38')));_0x5b3293[_0xa513('0x7')](_0xa513('0x39'),require('./api/faxQueue'));_0x5b3293[_0xa513('0x7')]('/api/fax/reports/queue',require(_0xa513('0x3a')));_0x5b3293[_0xa513('0x7')](_0xa513('0x3b'),require('./api/smsAccount'));_0x5b3293['use'](_0xa513('0x3c'),require(_0xa513('0x3d')));_0x5b3293['use'](_0xa513('0x3e'),require(_0xa513('0x3f')));_0x5b3293[_0xa513('0x7')]('/api/sms/messages',require(_0xa513('0x40')));_0x5b3293[_0xa513('0x7')](_0xa513('0x41'),require(_0xa513('0x42')));_0x5b3293['use'](_0xa513('0x43'),require(_0xa513('0x44')));_0x5b3293[_0xa513('0x7')](_0xa513('0x45'),require(_0xa513('0x46')));_0x5b3293[_0xa513('0x7')](_0xa513('0x47'),require(_0xa513('0x48')));_0x5b3293[_0xa513('0x7')]('/api/openchannel/messages',require(_0xa513('0x49')));_0x5b3293[_0xa513('0x7')](_0xa513('0x4a'),require(_0xa513('0x4b')));_0x5b3293[_0xa513('0x7')](_0xa513('0x4c'),require('./api/chatWebsite'));_0x5b3293[_0xa513('0x7')](_0xa513('0x4d'),require(_0xa513('0x4e')));_0x5b3293[_0xa513('0x7')](_0xa513('0x4f'),require(_0xa513('0x50')));_0x5b3293[_0xa513('0x7')](_0xa513('0x51'),require(_0xa513('0x52')));_0x5b3293['use'](_0xa513('0x53'),require(_0xa513('0x54')));_0x5b3293[_0xa513('0x7')]('/api/chat/offline_messages',require('./api/chatOfflineMessage'));_0x5b3293[_0xa513('0x7')](_0xa513('0x55'),require('./api/chatQueue'));_0x5b3293[_0xa513('0x7')](_0xa513('0x56'),require(_0xa513('0x57')));_0x5b3293[_0xa513('0x7')](_0xa513('0x58'),require(_0xa513('0x59')));_0x5b3293[_0xa513('0x7')](_0xa513('0x5a'),require(_0xa513('0x5b')));_0x5b3293[_0xa513('0x7')](_0xa513('0x5c'),require('./api/cmContact'));_0x5b3293[_0xa513('0x7')](_0xa513('0x5d'),require('./api/cmHopper'));_0x5b3293[_0xa513('0x7')](_0xa513('0x5e'),require('./api/cmHopperBlack'));_0x5b3293[_0xa513('0x7')]('/api/cm/hopper_final',require(_0xa513('0x5f')));_0x5b3293[_0xa513('0x7')](_0xa513('0x60'),require(_0xa513('0x61')));_0x5b3293[_0xa513('0x7')](_0xa513('0x62'),require('./api/cmCustomField'));_0x5b3293['use'](_0xa513('0x63'),require(_0xa513('0x64')));_0x5b3293[_0xa513('0x7')](_0xa513('0x65'),require(_0xa513('0x66')));_0x5b3293[_0xa513('0x7')](_0xa513('0x67'),require(_0xa513('0x68')));_0x5b3293[_0xa513('0x7')](_0xa513('0x69'),require('./api/disposition'));_0x5b3293['use'](_0xa513('0x6a'),require('./api/condition'));_0x5b3293[_0xa513('0x7')](_0xa513('0x6b'),require(_0xa513('0x6c')));_0x5b3293[_0xa513('0x7')]('/api/pauses',require(_0xa513('0x6d')));_0x5b3293[_0xa513('0x7')](_0xa513('0x6e'),require(_0xa513('0x6f')));_0x5b3293[_0xa513('0x7')](_0xa513('0x70'),require('./api/voiceQueuesLog'));_0x5b3293[_0xa513('0x7')]('/api/schedules',require(_0xa513('0x71')));_0x5b3293['use'](_0xa513('0x72'),require('./api/sound'));_0x5b3293[_0xa513('0x7')](_0xa513('0x73'),require(_0xa513('0x74')));_0x5b3293['use'](_0xa513('0x75'),require('./api/contactItemType'));_0x5b3293[_0xa513('0x7')](_0xa513('0x76'),require(_0xa513('0x77')));_0x5b3293[_0xa513('0x7')](_0xa513('0x78'),require(_0xa513('0x79')));_0x5b3293[_0xa513('0x7')](_0xa513('0x7a'),require(_0xa513('0x7b')));_0x5b3293['use'](_0xa513('0x7c'),require('./api/trigger'));_0x5b3293['use'](_0xa513('0x7d'),require('./api/variable'));_0x5b3293[_0xa513('0x7')](_0xa513('0x7e'),require(_0xa513('0x7f')));_0x5b3293[_0xa513('0x7')](_0xa513('0x80'),require(_0xa513('0x81')));_0x5b3293[_0xa513('0x7')]('/api/analytics/custom_reports',require(_0xa513('0x82')));_0x5b3293[_0xa513('0x7')]('/api/analytics/default_reports',require(_0xa513('0x83')));_0x5b3293[_0xa513('0x7')](_0xa513('0x84'),require(_0xa513('0x85')));_0x5b3293[_0xa513('0x7')]('/api/analytics/metrics',require(_0xa513('0x86')));_0x5b3293['use'](_0xa513('0x87'),require('./api/analyticFieldReport'));_0x5b3293['use'](_0xa513('0x88'),require(_0xa513('0x89')));_0x5b3293[_0xa513('0x7')](_0xa513('0x8a'),require('./api/intSalesforceAccount'));_0x5b3293[_0xa513('0x7')](_0xa513('0x8b'),require(_0xa513('0x8c')));_0x5b3293[_0xa513('0x7')](_0xa513('0x8d'),require('./api/intSalesforceField'));_0x5b3293['use'](_0xa513('0x8e'),require(_0xa513('0x8f')));_0x5b3293[_0xa513('0x7')](_0xa513('0x90'),require('./api/intSugarcrmConfiguration'));_0x5b3293[_0xa513('0x7')](_0xa513('0x91'),require('./api/intSugarcrmField'));_0x5b3293['use'](_0xa513('0x92'),require(_0xa513('0x93')));_0x5b3293[_0xa513('0x7')](_0xa513('0x94'),require(_0xa513('0x95')));_0x5b3293['use'](_0xa513('0x96'),require(_0xa513('0x97')));_0x5b3293['use'](_0xa513('0x98'),require(_0xa513('0x99')));_0x5b3293[_0xa513('0x7')]('/api/integrations/zoho/configurations',require(_0xa513('0x9a')));_0x5b3293[_0xa513('0x7')]('/api/integrations/zoho/fields',require(_0xa513('0x9b')));_0x5b3293['use'](_0xa513('0x9c'),require(_0xa513('0x9d')));_0x5b3293[_0xa513('0x7')]('/api/integrations/zendesk/configurations',require('./api/intZendeskConfiguration'));_0x5b3293[_0xa513('0x7')](_0xa513('0x9e'),require(_0xa513('0x9f')));_0x5b3293[_0xa513('0x7')](_0xa513('0xa0'),require(_0xa513('0xa1')));_0x5b3293[_0xa513('0x7')](_0xa513('0xa2'),require(_0xa513('0xa3')));_0x5b3293[_0xa513('0x7')]('/api/integrations/freshdesk/fields',require(_0xa513('0xa4')));_0x5b3293[_0xa513('0x7')]('/api/integrations/vtiger/accounts',require(_0xa513('0xa5')));_0x5b3293['use']('/api/integrations/vtiger/configurations',require(_0xa513('0xa6')));_0x5b3293[_0xa513('0x7')](_0xa513('0xa7'),require(_0xa513('0xa8')));_0x5b3293[_0xa513('0x7')](_0xa513('0xa9'),require(_0xa513('0xaa')));_0x5b3293[_0xa513('0x7')]('/api/integrations/servicenow/configurations',require(_0xa513('0xab')));_0x5b3293[_0xa513('0x7')](_0xa513('0xac'),require(_0xa513('0xad')));_0x5b3293[_0xa513('0x7')](_0xa513('0xae'),require(_0xa513('0xaf')));_0x5b3293[_0xa513('0x7')](_0xa513('0xb0'),require(_0xa513('0xb1')));_0x5b3293[_0xa513('0x7')]('/api/integrations/dynamics365/fields',require(_0xa513('0xb2')));_0x5b3293[_0xa513('0x7')](_0xa513('0xb3'),require(_0xa513('0xb4')));_0x5b3293['use'](_0xa513('0xb5'),require(_0xa513('0xb6')));_0x5b3293[_0xa513('0x7')]('/api/integrations/freshsales/fields',require(_0xa513('0xb7')));_0x5b3293[_0xa513('0x7')]('/api/networks',require(_0xa513('0xb8')));_0x5b3293[_0xa513('0x7')](_0xa513('0xb9'),require(_0xa513('0xba')));_0x5b3293['use'](_0xa513('0xbb'),require(_0xa513('0xbc')));_0x5b3293[_0xa513('0x7')](_0xa513('0xbd'),require(_0xa513('0xbe')));_0x5b3293[_0xa513('0x7')](_0xa513('0xbf'),require(_0xa513('0xc0')));_0x5b3293[_0xa513('0x7')]('/api/jscripty/sessions/reports',require(_0xa513('0xc1')));_0x5b3293[_0xa513('0x7')](_0xa513('0xc2'),require('./api/smsQueueReport'));_0x5b3293[_0xa513('0x7')](_0xa513('0xc3'),require(_0xa513('0xc4')));_0x5b3293['use'](_0xa513('0xc5'),require(_0xa513('0xc6')));_0x5b3293[_0xa513('0x7')]('/api/jscripty/projects',require(_0xa513('0xc7')));_0x5b3293[_0xa513('0x7')]('/api/settings',require(_0xa513('0xc8')));_0x5b3293[_0xa513('0x7')](_0xa513('0xc9'),require(_0xa513('0xca')));_0x5b3293[_0xa513('0x7')](_0xa513('0xcb'),require(_0xa513('0xcc')));_0x5b3293[_0xa513('0x7')](_0xa513('0xcd'),require(_0xa513('0xce')));_0x5b3293[_0xa513('0x7')](_0xa513('0xcf'),require('./api/squareMessage'));_0x5b3293[_0xa513('0x7')](_0xa513('0xd0'),require(_0xa513('0xd1')));_0x5b3293[_0xa513('0x7')](_0xa513('0xd2'),require(_0xa513('0xd3')));_0x5b3293['use']('/api/campaigns',require(_0xa513('0xd4')));_0x5b3293[_0xa513('0x7')](_0xa513('0xd5'),require(_0xa513('0xd6')));_0x5b3293[_0xa513('0x7')](_0xa513('0xd7'),require('./api/attachment'));_0x5b3293[_0xa513('0x7')](_0xa513('0xd8'),require(_0xa513('0xd9')));_0x5b3293[_0xa513('0x7')](_0xa513('0xda'),require('./api/mailTransferReport'));_0x5b3293[_0xa513('0x7')](_0xa513('0xdb'),require('./api/chatTransferReport'));_0x5b3293[_0xa513('0x7')](_0xa513('0xdc'),require(_0xa513('0xdd')));_0x5b3293[_0xa513('0x7')](_0xa513('0xde'),require(_0xa513('0xdf')));_0x5b3293[_0xa513('0x7')](_0xa513('0xe0'),require(_0xa513('0xe1')));_0x5b3293[_0xa513('0x7')]('/api/cm/lists',require(_0xa513('0xe2')));_0x5b3293[_0xa513('0x7')](_0xa513('0xe3'),require(_0xa513('0xe4')));_0x5b3293[_0xa513('0x7')](_0xa513('0xe5'),require(_0xa513('0xe6')));_0x5b3293[_0xa513('0x7')](_0xa513('0xe7'),require(_0xa513('0xe8')));_0x5b3293['use']('/api/userProfile/resources',require(_0xa513('0xe9')));_0x5b3293['use']('/api/userNotifications',require(_0xa513('0xea')));_0x5b3293[_0xa513('0x7')]('/api/whatsapp/accounts',require(_0xa513('0xeb')));_0x5b3293[_0xa513('0x7')](_0xa513('0xec'),require('./api/whatsappApplication'));_0x5b3293[_0xa513('0x7')]('/api/whatsapp/interactions',require(_0xa513('0xed')));_0x5b3293[_0xa513('0x7')](_0xa513('0xee'),require('./api/whatsappMessage'));_0x5b3293[_0xa513('0x7')](_0xa513('0xef'),require('./api/whatsappQueueReport'));_0x5b3293[_0xa513('0x7')]('/api/whatsapp/reports/transfer',require(_0xa513('0xf0')));_0x5b3293[_0xa513('0x7')](_0xa513('0xf1'),require(_0xa513('0xf2')));_0x5b3293[_0xa513('0x7')](_0xa513('0xf3'),require(_0xa513('0xf4')));_0x5b3293[_0xa513('0x7')]('/api/realtime',require(_0xa513('0xf5')));_0x5b3293['use'](_0xa513('0xf6'),require('./api/user-setting'));_0x5b3293['use']('/api/auth/local',require(_0xa513('0xf7')));_0x5b3293[_0xa513('0x7')](_0xa513('0xf8'),require(_0xa513('0xf9')));_0x5b3293['use'](_0xa513('0xfa'),require(_0xa513('0xfb')));_0x5b3293[_0xa513('0x7')](_0xa513('0xfc'),require('./api/jira'));_0x5b3293['use']('/api/rpc',require(_0xa513('0xfd')));_0x5b3293['use'](_0xa513('0xfe'),require(_0xa513('0xff')));_0x5b3293[_0xa513('0x7')](_0xa513('0x100'),require(_0xa513('0x101')));_0x5b3293['use'](_0xa513('0x102'),require(_0xa513('0x103')));_0x5b3293[_0xa513('0x7')](_0xa513('0x104'),require(_0xa513('0x105')));_0x5b3293['use']('/api/logs',clientSideLogs);_0x5b3293[_0xa513('0x7')]('/apidoc',express[_0xa513('0x106')](path[_0xa513('0x107')](config['root'],_0xa513('0x108'))));_0x5b3293[_0xa513('0x7')](_0xa513('0x109'),express[_0xa513('0x106')](path[_0xa513('0x107')](config[_0xa513('0x10a')],_0xa513('0x109'))));_0x5b3293[_0xa513('0x7')](_0xa513('0x10b'),express['static'](path[_0xa513('0x107')](config['root'],'/demo')));_0x5b3293[_0xa513('0x7')]('/snippet',express[_0xa513('0x106')](path[_0xa513('0x107')](config[_0xa513('0x10a')],'snippet',_0xa513('0x10c'))));_0x5b3293[_0xa513('0x7')](_0xa513('0x10d'),express[_0xa513('0x106')](path[_0xa513('0x107')](config[_0xa513('0x10a')],_0xa513('0x10e'))));_0x5b3293[_0xa513('0x10f')](_0xa513('0x110'))[_0xa513('0x111')](errors[0x194]);_0x5b3293['route']('/*')[_0xa513('0x111')](function(_0x355293,_0x50ab7c){_0x50ab7c[_0xa513('0x112')](path[_0xa513('0x113')](_0x5b3293[_0xa513('0x111')](_0xa513('0x114'))+_0xa513('0x115')));});return _0x5b3293;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 8ca1f89..7bad300 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfb51=['../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','http','rpc','port','localhost','error','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc'];(function(_0x1decf3,_0x5811ea){var _0x24a190=function(_0x14df2a){while(--_0x14df2a){_0x1decf3['push'](_0x1decf3['shift']());}};_0x24a190(++_0x5811ea);}(_0xfb51,0x1b5));var _0x1fb5=function(_0x384447,_0x41669a){_0x384447=_0x384447-0x0;var _0x3810db=_0xfb51[_0x384447];return _0x3810db;};'use strict';var jayson=require(_0x1fb5('0x0'));var _=require(_0x1fb5('0x1'));var config=require(_0x1fb5('0x2'));exports['listen']=function(){return new Promise(function(_0x164ecb,_0x34fe7d){var _0x4ba3ff={};_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require(_0x1fb5('0x4')));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require(_0x1fb5('0x5')));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require('../api/voiceQueue/voiceQueue.rpc'));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require(_0x1fb5('0x6')));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require(_0x1fb5('0x7')));_0x4ba3ff=_['merge'](_0x4ba3ff,require(_0x1fb5('0x8')));_0x4ba3ff=_['merge'](_0x4ba3ff,require(_0x1fb5('0x9')));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require(_0x1fb5('0xa')));_0x4ba3ff=_['merge'](_0x4ba3ff,require(_0x1fb5('0xb')));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require(_0x1fb5('0xc')));_0x4ba3ff=_['merge'](_0x4ba3ff,require(_0x1fb5('0xd')));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require(_0x1fb5('0xe')));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require(_0x1fb5('0xf')));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require(_0x1fb5('0x10')));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require(_0x1fb5('0x11')));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require(_0x1fb5('0x12')));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require('../api/mailMessage/mailMessage.rpc'));_0x4ba3ff=_['merge'](_0x4ba3ff,require(_0x1fb5('0x13')));_0x4ba3ff=_['merge'](_0x4ba3ff,require(_0x1fb5('0x14')));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require(_0x1fb5('0x15')));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require(_0x1fb5('0x16')));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require('../api/faxInteraction/faxInteraction.rpc'));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require(_0x1fb5('0x17')));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require(_0x1fb5('0x18')));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require(_0x1fb5('0x19')));_0x4ba3ff=_['merge'](_0x4ba3ff,require(_0x1fb5('0x1a')));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require('../api/smsInteraction/smsInteraction.rpc'));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require(_0x1fb5('0x1b')));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require(_0x1fb5('0x1c')));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x4ba3ff=_['merge'](_0x4ba3ff,require(_0x1fb5('0x1d')));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require(_0x1fb5('0x1e')));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require(_0x1fb5('0x1f')));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require(_0x1fb5('0x20')));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require(_0x1fb5('0x21')));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require('../api/cmContact/cmContact.rpc'));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require(_0x1fb5('0x22')));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require(_0x1fb5('0x23')));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require(_0x1fb5('0x24')));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require(_0x1fb5('0x25')));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require(_0x1fb5('0x26')));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require('../api/interval/interval.rpc'));_0x4ba3ff=_['merge'](_0x4ba3ff,require(_0x1fb5('0x27')));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require('../api/sound/sound.rpc'));_0x4ba3ff=_['merge'](_0x4ba3ff,require(_0x1fb5('0x28')));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require(_0x1fb5('0x29')));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require(_0x1fb5('0x2a')));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require('../api/variable/variable.rpc'));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x4ba3ff=_['merge'](_0x4ba3ff,require(_0x1fb5('0x2b')));_0x4ba3ff=_['merge'](_0x4ba3ff,require(_0x1fb5('0x2c')));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require(_0x1fb5('0x2d')));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require(_0x1fb5('0x2e')));_0x4ba3ff=_['merge'](_0x4ba3ff,require(_0x1fb5('0x2f')));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require(_0x1fb5('0x30')));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require(_0x1fb5('0x31')));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require(_0x1fb5('0x32')));_0x4ba3ff=_['merge'](_0x4ba3ff,require(_0x1fb5('0x33')));_0x4ba3ff=_['merge'](_0x4ba3ff,require(_0x1fb5('0x34')));_0x4ba3ff=_['merge'](_0x4ba3ff,require(_0x1fb5('0x35')));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require(_0x1fb5('0x36')));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require(_0x1fb5('0x37')));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require('../api/squareOdbc/squareOdbc.rpc'));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require(_0x1fb5('0x38')));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require(_0x1fb5('0x39')));_0x4ba3ff=_['merge'](_0x4ba3ff,require('../api/squareMessage/squareMessage.rpc'));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require(_0x1fb5('0x3a')));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require(_0x1fb5('0x3b')));_0x4ba3ff=_['merge'](_0x4ba3ff,require(_0x1fb5('0x3c')));_0x4ba3ff=_['merge'](_0x4ba3ff,require(_0x1fb5('0x3d')));_0x4ba3ff=_['merge'](_0x4ba3ff,require(_0x1fb5('0x3e')));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require(_0x1fb5('0x3f')));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x4ba3ff=_[_0x1fb5('0x3')](_0x4ba3ff,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x5b96ac=jayson['server'](_0x4ba3ff)[_0x1fb5('0x40')]();var _0x20d65a=config[_0x1fb5('0x41')][_0x1fb5('0x42')]||config[_0x1fb5('0x42')]+0x1;var _0x7cffdd=config[_0x1fb5('0x41')]['ip']||_0x1fb5('0x43');_0x5b96ac['on'](_0x1fb5('0x44'),function(_0x2ff8a4){return _0x34fe7d(_0x2ff8a4);});_0x5b96ac[_0x1fb5('0x45')](_0x20d65a,_0x7cffdd,function(){console[_0x1fb5('0x46')](_0x1fb5('0x47'),_0x7cffdd,_0x20d65a);require(_0x1fb5('0x48'))[_0x1fb5('0x49')]();return _0x164ecb(_0x1fb5('0x4a')+_0x7cffdd+':'+_0x20d65a);});});}; \ No newline at end of file +var _0x49d6=['../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','port','rpc','error','log','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','../config/environment','listen','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc'];(function(_0x2b1bb9,_0x3f85cc){var _0x59f401=function(_0x14ac15){while(--_0x14ac15){_0x2b1bb9['push'](_0x2b1bb9['shift']());}};_0x59f401(++_0x3f85cc);}(_0x49d6,0x1bf));var _0x649d=function(_0x42d1a4,_0x338e3c){_0x42d1a4=_0x42d1a4-0x0;var _0x204d30=_0x49d6[_0x42d1a4];return _0x204d30;};'use strict';var jayson=require(_0x649d('0x0'));var _=require('lodash');var config=require(_0x649d('0x1'));exports[_0x649d('0x2')]=function(){return new Promise(function(_0x44939a,_0x235f61){var _0x54fa96={};_0x54fa96=_['merge'](_0x54fa96,require(_0x649d('0x3')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require(_0x649d('0x5')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require('../api/voiceQueue/voiceQueue.rpc'));_0x54fa96=_['merge'](_0x54fa96,require('../api/voiceRecording/voiceRecording.rpc'));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require(_0x649d('0x6')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require(_0x649d('0x7')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require(_0x649d('0x8')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require(_0x649d('0x9')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require(_0x649d('0xa')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require(_0x649d('0xb')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require(_0x649d('0xc')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require(_0x649d('0xd')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require('../api/mailServerIn/mailServerIn.rpc'));_0x54fa96=_['merge'](_0x54fa96,require(_0x649d('0xe')));_0x54fa96=_['merge'](_0x54fa96,require(_0x649d('0xf')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require(_0x649d('0x10')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require(_0x649d('0x11')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require('../api/mailApplication/mailApplication.rpc'));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require(_0x649d('0x12')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require(_0x649d('0x13')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require(_0x649d('0x14')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require(_0x649d('0x15')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require('../api/faxMessage/faxMessage.rpc'));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require(_0x649d('0x16')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require(_0x649d('0x17')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require(_0x649d('0x18')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require(_0x649d('0x19')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require(_0x649d('0x1a')));_0x54fa96=_['merge'](_0x54fa96,require(_0x649d('0x1b')));_0x54fa96=_['merge'](_0x54fa96,require(_0x649d('0x1c')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require(_0x649d('0x1d')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require(_0x649d('0x1e')));_0x54fa96=_['merge'](_0x54fa96,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x54fa96=_['merge'](_0x54fa96,require(_0x649d('0x1f')));_0x54fa96=_['merge'](_0x54fa96,require(_0x649d('0x20')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require(_0x649d('0x21')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require(_0x649d('0x22')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require(_0x649d('0x23')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require(_0x649d('0x24')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require(_0x649d('0x25')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require('../api/pause/pause.rpc'));_0x54fa96=_['merge'](_0x54fa96,require(_0x649d('0x26')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require(_0x649d('0x27')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require(_0x649d('0x28')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require(_0x649d('0x29')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require(_0x649d('0x2a')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require(_0x649d('0x2b')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x54fa96=_['merge'](_0x54fa96,require(_0x649d('0x2c')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require(_0x649d('0x2d')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require(_0x649d('0x2e')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require(_0x649d('0x2f')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require(_0x649d('0x30')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require(_0x649d('0x31')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require(_0x649d('0x32')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require(_0x649d('0x33')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require('../api/squareReport/squareReport.rpc'));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require(_0x649d('0x34')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require(_0x649d('0x35')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require('../api/squareOdbc/squareOdbc.rpc'));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require(_0x649d('0x36')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require(_0x649d('0x37')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require(_0x649d('0x38')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require('../api/campaign/campaign.rpc'));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require('../api/attachment/attachment.rpc'));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require(_0x649d('0x39')));_0x54fa96=_['merge'](_0x54fa96,require(_0x649d('0x3a')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require(_0x649d('0x3b')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require(_0x649d('0x3c')));_0x54fa96=_[_0x649d('0x4')](_0x54fa96,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x54fa96=_['merge'](_0x54fa96,require(_0x649d('0x3d')));var _0x1e28b9=jayson[_0x649d('0x3e')](_0x54fa96)['http']();var _0x1b4636=config['rpc']['port']||config[_0x649d('0x3f')]+0x1;var _0x16037e=config[_0x649d('0x40')]['ip']||'localhost';_0x1e28b9['on'](_0x649d('0x41'),function(_0x428f4e){return _0x235f61(_0x428f4e);});_0x1e28b9[_0x649d('0x2')](_0x1b4636,_0x16037e,function(){console[_0x649d('0x42')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x16037e,_0x1b4636);require(_0x649d('0x43'))[_0x649d('0x44')]();return _0x44939a(_0x649d('0x45')+_0x16037e+':'+_0x1b4636);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 3dbb5c3..4c9dea0 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 _0x71ab=['sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','continueAt','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','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','lodash','events','EventEmitter','./reply','./error','setEncoding','setTimeout','utf8','headers','emit','ready','line','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','error','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','prototype','sync','answer','ANSWER','getData','beep','sendRequest','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','exec','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','setPriority','HANGUP','setVariable','isBoolean','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s'];(function(_0x2ace97,_0x28d322){var _0x2392cd=function(_0x2b8455){while(--_0x2b8455){_0x2ace97['push'](_0x2ace97['shift']());}};_0x2392cd(++_0x28d322);}(_0x71ab,0xfb));var _0xb71a=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x71ab[_0x19e35c];return _0x3e1fe8;};'use strict';var util=require('util');var _=require(_0xb71a('0x0'));var EventEmitter=require(_0xb71a('0x1'))[_0xb71a('0x2')];var AGIReply=require(_0xb71a('0x3'));var AGIError=require(_0xb71a('0x4'));function AGIChannel(_0x54929d){var _0x35cb44=this,_0x3d5af9=new AGIReply(),_0x496d8b=![],_0x7a021d={};EventEmitter['call'](_0x35cb44);_0x54929d[_0xb71a('0x5')]('utf8');_0x54929d[_0xb71a('0x6')](0x8*0x3c*0x3c*0x3e8);_0x3d5af9[_0xb71a('0x5')](_0xb71a('0x7'));_0x3d5af9['on'](_0xb71a('0x8'),function(_0x5ef2e8){for(var _0x53e784 in _0x5ef2e8){_0x35cb44[_0x53e784]=_0x5ef2e8[_0x53e784];}_0x35cb44[_0xb71a('0x9')](_0xb71a('0xa'));});_0x3d5af9['on'](_0xb71a('0xb'),function(_0x25fac8){if(_0x25fac8['toLowerCase']()==_0xb71a('0xc')){_0x35cb44[_0xb71a('0x9')](_0xb71a('0xc'));return;}if(_0x25fac8[_0xb71a('0xd')](0x0,0xb)==_0xb71a('0xe')){_0x496d8b=!![];}if(_0x496d8b){_0x7a021d['rx']+=_0x25fac8+'\x0a';if(_0x25fac8[_0xb71a('0xf')](_0xb71a('0x10'))!=-0x1){_0x496d8b=![];}}else{_0x7a021d['rx']=_0x25fac8;}if(_0x496d8b){return;}if(typeof _0x7a021d['cb']==_0xb71a('0x11')){var _0x31cc39=_0x7a021d['rx'][_0xb71a('0xd')](0x0,0x3),_0x1d06c6=null,_0x3c2d1f=null;_0x31cc39=parseInt(_0x31cc39);if(isNaN(_0x31cc39)){_0x7a021d['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xb71a('0x12')});return;}if(_0x31cc39!=0xc8){_0x7a021d['cb'](null,{'code':_0x31cc39,'result':-0x1,'extra':'KO'});return;}_0x1d06c6=_0x7a021d['rx'][_0xb71a('0xd')](0x4)[_0xb71a('0x13')](_0xb71a('0x14'),'');if(_0x1d06c6[_0xb71a('0x15')]('\x20')!=-0x1){_0x1d06c6=_0x1d06c6[_0xb71a('0x16')](0x0,_0x1d06c6['indexOf']('\x20'));}if(_[_0xb71a('0x17')](_0x1d06c6,'-1')){_0x1d06c6=parseInt(_0x1d06c6);}_0x3c2d1f=_0x7a021d['rx'][_0xb71a('0x18')]('\x20');if(_0x3c2d1f['length']==0x3){_0x3c2d1f=_0x3c2d1f[0x2][_0xb71a('0xd')](0x1,_0x3c2d1f[0x2][_0xb71a('0x19')]-0x1);}else if(_0x3c2d1f[_0xb71a('0x19')]>0x3){var _0x1b925b=/\((.+)\)/;var _0x566975=_0x7a021d['rx']['match'](_0x1b925b);if(_0x566975){_0x3c2d1f=_0x566975[0x1];}else{_0x3c2d1f=null;}}else{_0x3c2d1f=null;}_0x7a021d['cb'](null,{'code':_0x31cc39,'result':_0x1d06c6,'extra':_0x3c2d1f});}});_0x54929d['on'](_0xb71a('0x1a'),function(_0x4c1661){_0x35cb44[_0xb71a('0x9')](_0xb71a('0x1a'),new AGIError('E_AGI_SOCKET_ERROR',_0x4c1661[_0xb71a('0x1b')]));});_0x54929d['on']('close',function(){_0x35cb44[_0xb71a('0x9')](_0xb71a('0x1c'),new AGIError(_0xb71a('0x1d')));});_0x54929d['on']('timeout',function(){_0x35cb44[_0xb71a('0x9')](_0xb71a('0x1e'),new AGIError(_0xb71a('0x1f')));_0x54929d[_0xb71a('0x20')]();});_0x54929d[_0xb71a('0x21')](_0x3d5af9);this[_0xb71a('0x22')]=function(_0x17f600,_0x23d31b){var _0x17f600=_0x17f600||'',_0x23d31b=typeof _0x23d31b==_0xb71a('0x11')?_0x23d31b:new Function();_0x7a021d={'tx':_0x17f600,'rx':'','cb':_0x23d31b};_0x54929d[_0xb71a('0x23')](_0x17f600+'\x0a');},this[_0xb71a('0x1c')]=function(){_0x54929d[_0xb71a('0x20')]();};}util[_0xb71a('0x24')](AGIChannel,EventEmitter);AGIChannel[_0xb71a('0x25')]['sendRequest']=function(_0x277b31){return this[_0xb71a('0x22')][_0xb71a('0x26')](this,_0x277b31);};AGIChannel[_0xb71a('0x25')][_0xb71a('0x27')]=function(){return this['sendRequest'](_0xb71a('0x28'));};AGIChannel[_0xb71a('0x25')][_0xb71a('0x29')]=function(_0x319010,_0x2bbd6f,_0x9061c4){_0x319010=_0x319010===undefined?_0xb71a('0x2a'):_0x319010;_0x2bbd6f=_0x2bbd6f===undefined?'5':_0x2bbd6f;_0x9061c4=_0x9061c4===undefined?'1':_0x9061c4;return this[_0xb71a('0x2b')](util[_0xb71a('0x2c')](_0xb71a('0x2d'),_0x319010,_0x2bbd6f*0x3e8,_0x9061c4));};AGIChannel[_0xb71a('0x25')][_0xb71a('0x2e')]=function(_0x4da307){_0x4da307=_0x4da307||'NO\x20MESSAGE';return this[_0xb71a('0x2b')](util[_0xb71a('0x2c')](_0xb71a('0x2f'),_0x4da307));};AGIChannel[_0xb71a('0x25')][_0xb71a('0x30')]=function(_0x4768cd,_0x4a8844){if(_['isArray'](_0x4a8844)){return this['sendRequest'](util[_0xb71a('0x2c')](_0xb71a('0x31'),_0x4768cd,_0x4a8844[_0xb71a('0x32')](',')));}return this[_0xb71a('0x2b')](util[_0xb71a('0x2c')]('EXEC\x20%s\x20%s',_0x4768cd,_0x4a8844));};AGIChannel['prototype'][_0xb71a('0x33')]=function(_0x59d3f3){return this[_0xb71a('0x2b')](util['format'](_0xb71a('0x34'),_0x59d3f3));};AGIChannel[_0xb71a('0x25')][_0xb71a('0x35')]=function(_0x12a8b9){return this['sendRequest'](util[_0xb71a('0x2c')]('SET\x20EXTENSION\x20%s',_0x12a8b9));};AGIChannel[_0xb71a('0x25')][_0xb71a('0x36')]=function(_0x26f4ef){return this[_0xb71a('0x2b')](util[_0xb71a('0x2c')]('SET\x20PRIORITY\x20%s',_0x26f4ef));};AGIChannel[_0xb71a('0x25')][_0xb71a('0xc')]=function(){return this[_0xb71a('0x2b')](_0xb71a('0x37'));};AGIChannel[_0xb71a('0x25')][_0xb71a('0x38')]=function(_0x4bf09f,_0x3a643e){var _0x30393e=_[_0xb71a('0x39')](_0x3a643e)||_['isNumber'](_0x3a643e)?_0x3a643e[_0xb71a('0x3a')]():_0x3a643e;return this[_0xb71a('0x2b')](util[_0xb71a('0x2c')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x4bf09f,_0x30393e?_0x30393e[_0xb71a('0x3a')]()[_0xb71a('0x13')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0xb71a('0x3b')]=function(_0x49e47a,_0x5e3807){return this['sendRequest'](util['format'](_0xb71a('0x3c'),_0x49e47a,_0x5e3807));};AGIChannel['prototype'][_0xb71a('0x3d')]=function(_0x43bcad,_0x3e3009){return this[_0xb71a('0x2b')](util[_0xb71a('0x2c')](_0xb71a('0x3e'),_0x43bcad,_0x3e3009));};AGIChannel['prototype'][_0xb71a('0x3f')]=function(_0x261270,_0x14b0df){return this['sendRequest'](util[_0xb71a('0x2c')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x261270,_0x14b0df));};AGIChannel[_0xb71a('0x25')][_0xb71a('0x40')]=function(_0x5c27c9,_0x244008,_0x5beca7){_0x244008=_0x244008||this['extension'];_0x5beca7=_0x5beca7||0x1;this[_0xb71a('0x33')](_0x5c27c9);this[_0xb71a('0x35')](_0x244008);this[_0xb71a('0x36')](_0x5beca7);return this[_0xb71a('0x2e')](util[_0xb71a('0x2c')]('GOTO\x20%s\x20%s\x20%s',_0x5c27c9,_0x244008,_0x5beca7));};AGIChannel['prototype'][_0xb71a('0x41')]=function(_0x104346){return this['sendRequest'](util[_0xb71a('0x2c')](_0xb71a('0x42'),_0x104346));};AGIChannel[_0xb71a('0x25')][_0xb71a('0x43')]=function(_0x30fc58,_0x4b5c03,_0x225ace,_0xe97480,_0x3776cf,_0x2526f5){_0x4b5c03=_0x4b5c03||_0xb71a('0x44');_0x225ace=_0x225ace||'';_0xe97480=_0xe97480===undefined?-0x1:_0xe97480==='-1'?-0x1:_0xe97480*0x3e8;_0x3776cf=_0x3776cf===undefined?'':'s='+_0x3776cf;_0x2526f5=_0x2526f5?_0xb71a('0x45'):'';return this[_0xb71a('0x2b')](util['format'](_0xb71a('0x46'),_0x30fc58,_0x4b5c03,_0x225ace,_0xe97480,_0x2526f5,_0x3776cf));};AGIChannel[_0xb71a('0x25')][_0xb71a('0x47')]=function(_0x209381,_0x189ba1){_0x189ba1=_0x189ba1||'';return this[_0xb71a('0x2b')](util[_0xb71a('0x2c')](_0xb71a('0x48'),_0x209381,_0x189ba1));};AGIChannel['prototype']['agi']=function(_0x217d05){return this[_0xb71a('0x30')](_0xb71a('0x49'),_0x217d05);};AGIChannel[_0xb71a('0x25')][_0xb71a('0x4a')]=function(_0x2dc912){return this['exec'](_0xb71a('0x4b'),_0x2dc912);};AGIChannel[_0xb71a('0x25')][_0xb71a('0x1a')]=function(_0x3ad5e9,_0x5c3c64){this[_0xb71a('0x2e')](util[_0xb71a('0x2c')](_0xb71a('0x4c'),_0x3ad5e9['id'],_0x3ad5e9['label'],_0x5c3c64));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xb71a('0x4d')]=AGIChannel; \ No newline at end of file +var _0xceca=['E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','prototype','sendRequest','answer','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','exec','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','HANGUP','isBoolean','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','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','label','util','events','EventEmitter','./reply','./error','call','setEncoding','utf8','headers','emit','line','toLowerCase','hangup','substring','520-Invalid','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','length','match','error','E_AGI_SOCKET_ERROR','code','close'];(function(_0x3b3106,_0x2e2d2b){var _0x2a503c=function(_0x9ceb25){while(--_0x9ceb25){_0x3b3106['push'](_0x3b3106['shift']());}};_0x2a503c(++_0x2e2d2b);}(_0xceca,0xfd));var _0xacec=function(_0x1bab70,_0x399ccf){_0x1bab70=_0x1bab70-0x0;var _0x44a639=_0xceca[_0x1bab70];return _0x44a639;};'use strict';var util=require(_0xacec('0x0'));var _=require('lodash');var EventEmitter=require(_0xacec('0x1'))[_0xacec('0x2')];var AGIReply=require(_0xacec('0x3'));var AGIError=require(_0xacec('0x4'));function AGIChannel(_0x12a47a){var _0x30d0f8=this,_0x5716b6=new AGIReply(),_0x5c05a0=![],_0xc31768={};EventEmitter[_0xacec('0x5')](_0x30d0f8);_0x12a47a[_0xacec('0x6')]('utf8');_0x12a47a['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x5716b6['setEncoding'](_0xacec('0x7'));_0x5716b6['on'](_0xacec('0x8'),function(_0x159d88){for(var _0xe310c0 in _0x159d88){_0x30d0f8[_0xe310c0]=_0x159d88[_0xe310c0];}_0x30d0f8[_0xacec('0x9')]('ready');});_0x5716b6['on'](_0xacec('0xa'),function(_0xa9324a){if(_0xa9324a[_0xacec('0xb')]()==_0xacec('0xc')){_0x30d0f8['emit'](_0xacec('0xc'));return;}if(_0xa9324a[_0xacec('0xd')](0x0,0xb)==_0xacec('0xe')){_0x5c05a0=!![];}if(_0x5c05a0){_0xc31768['rx']+=_0xa9324a+'\x0a';if(_0xa9324a['search'](_0xacec('0xf'))!=-0x1){_0x5c05a0=![];}}else{_0xc31768['rx']=_0xa9324a;}if(_0x5c05a0){return;}if(typeof _0xc31768['cb']==_0xacec('0x10')){var _0x16ffd9=_0xc31768['rx'][_0xacec('0xd')](0x0,0x3),_0x20bb47=null,_0x19091a=null;_0x16ffd9=parseInt(_0x16ffd9);if(isNaN(_0x16ffd9)){_0xc31768['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xacec('0x11')});return;}if(_0x16ffd9!=0xc8){_0xc31768['cb'](null,{'code':_0x16ffd9,'result':-0x1,'extra':'KO'});return;}_0x20bb47=_0xc31768['rx'][_0xacec('0xd')](0x4)[_0xacec('0x12')](_0xacec('0x13'),'');if(_0x20bb47[_0xacec('0x14')]('\x20')!=-0x1){_0x20bb47=_0x20bb47['substr'](0x0,_0x20bb47[_0xacec('0x14')]('\x20'));}if(_['startsWith'](_0x20bb47,'-1')){_0x20bb47=parseInt(_0x20bb47);}_0x19091a=_0xc31768['rx']['split']('\x20');if(_0x19091a[_0xacec('0x15')]==0x3){_0x19091a=_0x19091a[0x2][_0xacec('0xd')](0x1,_0x19091a[0x2][_0xacec('0x15')]-0x1);}else if(_0x19091a['length']>0x3){var _0x34247e=/\((.+)\)/;var _0x1e40b4=_0xc31768['rx'][_0xacec('0x16')](_0x34247e);if(_0x1e40b4){_0x19091a=_0x1e40b4[0x1];}else{_0x19091a=null;}}else{_0x19091a=null;}_0xc31768['cb'](null,{'code':_0x16ffd9,'result':_0x20bb47,'extra':_0x19091a});}});_0x12a47a['on'](_0xacec('0x17'),function(_0x16cb67){_0x30d0f8[_0xacec('0x9')]('error',new AGIError(_0xacec('0x18'),_0x16cb67[_0xacec('0x19')]));});_0x12a47a['on']('close',function(){_0x30d0f8[_0xacec('0x9')](_0xacec('0x1a'),new AGIError(_0xacec('0x1b')));});_0x12a47a['on'](_0xacec('0x1c'),function(){_0x30d0f8[_0xacec('0x9')](_0xacec('0x1c'),new AGIError(_0xacec('0x1d')));_0x12a47a[_0xacec('0x1e')]();});_0x12a47a[_0xacec('0x1f')](_0x5716b6);this[_0xacec('0x20')]=function(_0x197050,_0x46607f){var _0x197050=_0x197050||'',_0x46607f=typeof _0x46607f=='function'?_0x46607f:new Function();_0xc31768={'tx':_0x197050,'rx':'','cb':_0x46607f};_0x12a47a[_0xacec('0x21')](_0x197050+'\x0a');},this['close']=function(){_0x12a47a['destroy']();};}util[_0xacec('0x22')](AGIChannel,EventEmitter);AGIChannel[_0xacec('0x23')][_0xacec('0x24')]=function(_0x5b720a){return this['command']['sync'](this,_0x5b720a);};AGIChannel[_0xacec('0x23')][_0xacec('0x25')]=function(){return this['sendRequest'](_0xacec('0x26'));};AGIChannel[_0xacec('0x23')][_0xacec('0x27')]=function(_0x3575f5,_0x5cf65d,_0x2ff92f){_0x3575f5=_0x3575f5===undefined?_0xacec('0x28'):_0x3575f5;_0x5cf65d=_0x5cf65d===undefined?'5':_0x5cf65d;_0x2ff92f=_0x2ff92f===undefined?'1':_0x2ff92f;return this['sendRequest'](util[_0xacec('0x29')](_0xacec('0x2a'),_0x3575f5,_0x5cf65d*0x3e8,_0x2ff92f));};AGIChannel[_0xacec('0x23')][_0xacec('0x2b')]=function(_0x48055a){_0x48055a=_0x48055a||'NO\x20MESSAGE';return this[_0xacec('0x24')](util['format'](_0xacec('0x2c'),_0x48055a));};AGIChannel[_0xacec('0x23')][_0xacec('0x2d')]=function(_0x44777,_0x845f31){if(_['isArray'](_0x845f31)){return this['sendRequest'](util['format'](_0xacec('0x2e'),_0x44777,_0x845f31[_0xacec('0x2f')](',')));}return this[_0xacec('0x24')](util['format'](_0xacec('0x2e'),_0x44777,_0x845f31));};AGIChannel[_0xacec('0x23')][_0xacec('0x30')]=function(_0x5b1862){return this[_0xacec('0x24')](util['format'](_0xacec('0x31'),_0x5b1862));};AGIChannel[_0xacec('0x23')]['setExtension']=function(_0x526f8f){return this[_0xacec('0x24')](util[_0xacec('0x29')](_0xacec('0x32'),_0x526f8f));};AGIChannel[_0xacec('0x23')][_0xacec('0x33')]=function(_0x26572b){return this['sendRequest'](util['format']('SET\x20PRIORITY\x20%s',_0x26572b));};AGIChannel['prototype']['hangup']=function(){return this[_0xacec('0x24')](_0xacec('0x34'));};AGIChannel[_0xacec('0x23')]['setVariable']=function(_0x52c6c0,_0x471a3a){var _0x4b1781=_[_0xacec('0x35')](_0x471a3a)||_['isNumber'](_0x471a3a)?_0x471a3a['toString']():_0x471a3a;return this['sendRequest'](util[_0xacec('0x29')](_0xacec('0x36'),_0x52c6c0,_0x4b1781?_0x4b1781['toString']()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xacec('0x23')]['sayNumber']=function(_0x31fe93,_0x40e92e){return this[_0xacec('0x24')](util[_0xacec('0x29')](_0xacec('0x37'),_0x31fe93,_0x40e92e));};AGIChannel[_0xacec('0x23')][_0xacec('0x38')]=function(_0x42c6bf,_0x387cf2){return this[_0xacec('0x24')](util[_0xacec('0x29')](_0xacec('0x39'),_0x42c6bf,_0x387cf2));};AGIChannel[_0xacec('0x23')]['sayPhonetic']=function(_0x1d3cda,_0x48419d){return this[_0xacec('0x24')](util['format'](_0xacec('0x3a'),_0x1d3cda,_0x48419d));};AGIChannel['prototype']['continueAt']=function(_0x586317,_0x25ad23,_0x407b00){_0x25ad23=_0x25ad23||this[_0xacec('0x3b')];_0x407b00=_0x407b00||0x1;this[_0xacec('0x30')](_0x586317);this['setExtension'](_0x25ad23);this[_0xacec('0x33')](_0x407b00);return this[_0xacec('0x2b')](util['format'](_0xacec('0x3c'),_0x586317,_0x25ad23,_0x407b00));};AGIChannel['prototype'][_0xacec('0x3d')]=function(_0x40cbbe){return this['sendRequest'](util[_0xacec('0x29')](_0xacec('0x3e'),_0x40cbbe));};AGIChannel[_0xacec('0x23')]['recordFile']=function(_0x4cbdde,_0x24d877,_0x220716,_0x542f80,_0x14c96f,_0xd2aa4a){_0x24d877=_0x24d877||'wav';_0x220716=_0x220716||'';_0x542f80=_0x542f80===undefined?-0x1:_0x542f80==='-1'?-0x1:_0x542f80*0x3e8;_0x14c96f=_0x14c96f===undefined?'':'s='+_0x14c96f;_0xd2aa4a=_0xd2aa4a?_0xacec('0x3f'):'';return this['sendRequest'](util[_0xacec('0x29')](_0xacec('0x40'),_0x4cbdde,_0x24d877,_0x220716,_0x542f80,_0xd2aa4a,_0x14c96f));};AGIChannel[_0xacec('0x23')][_0xacec('0x41')]=function(_0x12ebc1,_0x3d3c74){_0x3d3c74=_0x3d3c74||'';return this[_0xacec('0x24')](util[_0xacec('0x29')](_0xacec('0x42'),_0x12ebc1,_0x3d3c74));};AGIChannel['prototype'][_0xacec('0x43')]=function(_0x130d32){return this[_0xacec('0x2d')](_0xacec('0x44'),_0x130d32);};AGIChannel[_0xacec('0x23')]['wait']=function(_0x39ce95){return this[_0xacec('0x2d')]('WAIT',_0x39ce95);};AGIChannel[_0xacec('0x23')][_0xacec('0x17')]=function(_0x322224,_0x47d3d3){this[_0xacec('0x2b')](util[_0xacec('0x29')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x322224['id'],_0x322224[_0xacec('0x45')],_0x47d3d3));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 7cce76f..906a207 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 _0x6a4a=['Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','apply','name','exports','Undefined\x20error.'];(function(_0x156eb3,_0x1d2202){var _0x370bcd=function(_0x1af899){while(--_0x1af899){_0x156eb3['push'](_0x156eb3['shift']());}};_0x370bcd(++_0x1d2202);}(_0x6a4a,0xa7));var _0xa6a4=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0x6a4a[_0x37c22c];return _0x119d79;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0xa6a4('0x0'),'E_AGI_ARGUMENT_PORT':_0xa6a4('0x1'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0xa6a4('0x2'),'E_AGI_SERVER_VOICE_DISABLED':_0xa6a4('0x3'),'E_AGI_SOCKET_ERROR':_0xa6a4('0x4'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0xa6a4('0x5'),'E_AGI_COMMAND_EMPTY':_0xa6a4('0x6'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xa6a4('0x7'),'E_AGI_IVR_ENTRY':_0xa6a4('0x8')};function AGIError(_0x22f6be){var _0x22f6be=_0x22f6be||null,_0x57797a=_0x57797a||[],_0x32ccc2=0x1,_0x5d093c='';if(!error[_0x22f6be]){_0x22f6be='E_AGI_UNDEFINED';}_0x57797a[_0xa6a4('0x9')](error[_0x22f6be]);while(arguments[_0x32ccc2]){_0x57797a[_0xa6a4('0x9')](arguments[_0x32ccc2]);_0x32ccc2++;}_0x5d093c=util[_0xa6a4('0xa')][_0xa6a4('0xb')](util,_0x57797a);this['message']=_0x5d093c;this[_0xa6a4('0xc')]=_0x22f6be;}module[_0xa6a4('0xd')]=AGIError; \ No newline at end of file +var _0x9c3d=['Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','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.','push','apply','message','name','exports','util'];(function(_0x50c051,_0x343c59){var _0x1f5d16=function(_0x15f5ba){while(--_0x15f5ba){_0x50c051['push'](_0x50c051['shift']());}};_0x1f5d16(++_0x343c59);}(_0x9c3d,0x9f));var _0xd9c3=function(_0x4b1c73,_0x1a4207){_0x4b1c73=_0x4b1c73-0x0;var _0xfab919=_0x9c3d[_0x4b1c73];return _0xfab919;};'use strict';var util=require(_0xd9c3('0x0'));var error={'E_AGI_UNDEFINED':_0xd9c3('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0xd9c3('0x2'),'E_AGI_SERVER_CLOSE':_0xd9c3('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xd9c3('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0xd9c3('0x5'),'E_AGI_SOCKET_ERROR':_0xd9c3('0x6'),'E_AGI_SOCKET_CLOSE':_0xd9c3('0x7'),'E_AGI_SOCKET_TIMEOUT':_0xd9c3('0x8'),'E_AGI_COMMAND_EMPTY':_0xd9c3('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xd9c3('0xa'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x5c7c92){var _0x5c7c92=_0x5c7c92||null,_0x56dc5b=_0x56dc5b||[],_0x3005c8=0x1,_0x1fe8f7='';if(!error[_0x5c7c92]){_0x5c7c92='E_AGI_UNDEFINED';}_0x56dc5b[_0xd9c3('0xb')](error[_0x5c7c92]);while(arguments[_0x3005c8]){_0x56dc5b[_0xd9c3('0xb')](arguments[_0x3005c8]);_0x3005c8++;}_0x1fe8f7=util['format'][_0xd9c3('0xc')](util,_0x56dc5b);this[_0xd9c3('0xd')]=_0x1fe8f7;this[_0xd9c3('0xe')]=_0x5c7c92;}module[_0xd9c3('0xf')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index aa3e3bf..3e3237a 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 _0x7dc0=['events','EventEmitter','ioredis','./error','redis','defaults','subscribe','agi','emit','error','E_AGI_SERVER_ERROR','message','parse','exports','lodash'];(function(_0x188165,_0x4de657){var _0x2ab64a=function(_0x2ac7d2){while(--_0x2ac7d2){_0x188165['push'](_0x188165['shift']());}};_0x2ab64a(++_0x4de657);}(_0x7dc0,0xb3));var _0x07dc=function(_0x31a938,_0x4daec6){_0x31a938=_0x31a938-0x0;var _0x1bf341=_0x7dc0[_0x31a938];return _0x1bf341;};'use strict';var _=require(_0x07dc('0x0'));var EventEmitter=require(_0x07dc('0x1'))[_0x07dc('0x2')];var Redis=require(_0x07dc('0x3'));var AGIError=require(_0x07dc('0x4'));var config=require('../../config/environment');config[_0x07dc('0x5')]=_[_0x07dc('0x6')](config[_0x07dc('0x5')],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0x07dc('0x7')](_0x07dc('0x8'),function(_0x58b8b8){if(_0x58b8b8)return eventEmitter[_0x07dc('0x9')](_0x07dc('0xa'),new AGIError(_0x07dc('0xb'),_0x58b8b8));});sub['on'](_0x07dc('0xc'),function(_0x3dd050,_0xe3da33){if(_0x3dd050!==_0x07dc('0x8'))return;try{var _0x52bd97=JSON[_0x07dc('0xd')](_0xe3da33);eventEmitter[_0x07dc('0x9')]('projectUpdate',_0x52bd97);}catch(_0x162d94){eventEmitter['emit'](_0x07dc('0xa'),new AGIError(_0x07dc('0xb'),_0x162d94));}});module[_0x07dc('0xe')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0xd923=['agi','emit','error','E_AGI_SERVER_ERROR','parse','projectUpdate','exports','lodash','events','EventEmitter','ioredis','./error','redis','defaults','localhost','subscribe'];(function(_0x178aa9,_0x2e9e7f){var _0x1b4c61=function(_0x383ef4){while(--_0x383ef4){_0x178aa9['push'](_0x178aa9['shift']());}};_0x1b4c61(++_0x2e9e7f);}(_0xd923,0x147));var _0x3d92=function(_0x378cec,_0x54db15){_0x378cec=_0x378cec-0x0;var _0x20aeff=_0xd923[_0x378cec];return _0x20aeff;};'use strict';var _=require(_0x3d92('0x0'));var EventEmitter=require(_0x3d92('0x1'))[_0x3d92('0x2')];var Redis=require(_0x3d92('0x3'));var AGIError=require(_0x3d92('0x4'));var config=require('../../config/environment');config[_0x3d92('0x5')]=_[_0x3d92('0x6')](config[_0x3d92('0x5')],{'host':_0x3d92('0x7'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0x3d92('0x8')](_0x3d92('0x9'),function(_0x401d99){if(_0x401d99)return eventEmitter[_0x3d92('0xa')](_0x3d92('0xb'),new AGIError(_0x3d92('0xc'),_0x401d99));});sub['on']('message',function(_0x19a832,_0x11ed88){if(_0x19a832!=='agi')return;try{var _0x39b778=JSON[_0x3d92('0xd')](_0x11ed88);eventEmitter[_0x3d92('0xa')](_0x3d92('0xe'),_0x39b778);}catch(_0x5a8202){eventEmitter[_0x3d92('0xa')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x5a8202));}});module[_0x3d92('0xf')]={'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 b7ebcb3..ad294ef 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 _0x5c42=['getsecretdigits','vertices','edges','prototype','addVertex','addEdge','push','size','relations','numberOfEdges','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','split','agicommand','vswitch','target','default','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','../../../config/logger','agi','menu','getdigits'];(function(_0x18aee4,_0x362725){var _0x475a7e=function(_0x59b44e){while(--_0x59b44e){_0x18aee4['push'](_0x18aee4['shift']());}};_0x475a7e(++_0x362725);}(_0x5c42,0x10a));var _0x25c4=function(_0x2e5611,_0x284590){_0x2e5611=_0x2e5611-0x0;var _0x136e2b=_0x5c42[_0x2e5611];return _0x136e2b;};'use strict';var _=require('lodash');var logger=require(_0x25c4('0x0'))(_0x25c4('0x1'));var verticesWithRetry=[_0x25c4('0x2'),_0x25c4('0x3'),_0x25c4('0x4')];var Graph=function(){this[_0x25c4('0x5')]={};this[_0x25c4('0x6')]={};this['numberOfEdges']=0x0;};Graph[_0x25c4('0x7')][_0x25c4('0x8')]=function(_0x344813){this[_0x25c4('0x5')][_0x344813['id']]=_0x344813;this[_0x25c4('0x6')][_0x344813['id']]=[];};Graph[_0x25c4('0x7')][_0x25c4('0x9')]=function(_0x109e33,_0x27868b,_0x98d97f){this[_0x25c4('0x6')][_0x109e33][_0x25c4('0xa')]({'target':_0x27868b,'condition':_0x98d97f});this['numberOfEdges']+=0x1;};Graph[_0x25c4('0x7')][_0x25c4('0xb')]=function(){return _['size'](this[_0x25c4('0x5')]);};Graph[_0x25c4('0x7')][_0x25c4('0xc')]=function(){return this[_0x25c4('0xd')];};Graph['prototype'][_0x25c4('0xe')]=function(_0x19e880){return this['vertices'][_0x19e880];};Graph['prototype'][_0x25c4('0xf')]=function(_0x55966c,_0x4c384b){if(!this[_0x25c4('0x5')][_0x55966c]){return logger[_0x25c4('0x10')](_0x25c4('0x11'));}var _0x1b4762=_0x4c384b(this['vertices'][_0x55966c]);if(!_0x1b4762){return logger[_0x25c4('0x10')](_0x25c4('0x12'));}if(this[_0x25c4('0x6')][_0x55966c][_0x25c4('0x13')]===0x0){return logger[_0x25c4('0x10')](_0x25c4('0x14'));}for(var _0x51f70c=0x0,_0x2f335e=[],_0x1ff8c1=![];_0x51f70c\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','evtHangup','createSquareReport','then','catch','hasOwnProperty','indexOf','agi_','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','handleNotFound','production','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','getAll','[LICENSE]','./server','listening'];(function(_0x1bf774,_0x1e42e4){var _0x48518f=function(_0x5b29be){while(--_0x5b29be){_0x1bf774['push'](_0x1bf774['shift']());}};_0x48518f(++_0x1e42e4);}(_0x8044,0x1d1));var _0x4804=function(_0x4fa489,_0x4cba6b){_0x4fa489=_0x4fa489-0x0;var _0x41d2ce=_0x8044[_0x4fa489];return _0x41d2ce;};'use strict';var _=require('lodash');var syncho=require(_0x4804('0x0'));var util=require(_0x4804('0x1'));var config=require(_0x4804('0x2'));var logger=require(_0x4804('0x3'))('agi');var utilLicense=require(_0x4804('0x4'));var rpc=require(_0x4804('0x5'));var Project=require(_0x4804('0x6'));var AGIEmitter=require(_0x4804('0x7'))[_0x4804('0x8')];var projects=[];config['agi']=_['defaults'](config[_0x4804('0x9')],{'ip':_0x4804('0xa'),'port':0x11dd});AGIEmitter['on'](_0x4804('0xb'),projectUpdateHandler);function connectionHandler(_0x35e6cc){process[_0x4804('0xc')](function(){syncho(function(){try{setChannelVariables(_0x35e6cc);agiHandler(_0x35e6cc);}catch(_0x453204){logger['error'](_0x453204[_0x4804('0xd')]);}});});}function projectUpdateHandler(_0x1be1d7){try{var _0x58b48c=_[_0x4804('0xe')](projects,['id',_0x1be1d7['id']]);if(_0x58b48c>-0x1){if(_0x1be1d7['deleted']===!![]){projects[_0x4804('0xf')](_0x58b48c,0x1);}else{projects[_0x58b48c]=_0x1be1d7;}}else{projects[_0x4804('0x10')](_0x1be1d7);}}catch(_0x571e63){logger[_0x4804('0x11')](_0x571e63[_0x4804('0xd')]);}}function listeningHandler(){console[_0x4804('0x12')](_0x4804('0x13'),config['agi'][_0x4804('0x14')]);logger['info'](util[_0x4804('0x15')](_0x4804('0x16'),config[_0x4804('0x9')]['ip'],config[_0x4804('0x9')][_0x4804('0x14')]));}function errorHandler(_0xbb0af4){if(_0xbb0af4&&_0xbb0af4[_0x4804('0x17')]&&_0xbb0af4['message']){logger[_0x4804('0x11')](util[_0x4804('0x15')](_0x4804('0x18'),_0xbb0af4[_0x4804('0x17')],_0xbb0af4['message']));}else{logger[_0x4804('0x11')](util[_0x4804('0x15')](_0x4804('0x19'),_0xbb0af4['stack']));}}function closeHandler(){logger[_0x4804('0x1a')](util['format']('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x4804('0x1b')],this[_0x4804('0x1c')],this[_0x4804('0x1d')],this['dnid'],this['uniqueid']));try{createSquareReport(this);}catch(_0x6f30df){logger[_0x4804('0x11')](_0x6f30df['stack']);}}function timeoutHandler(){logger[_0x4804('0x1a')](util['format']('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0x4804('0x1c')],this[_0x4804('0x1d')],this[_0x4804('0x1e')],this['uniqueid']));}function hangupHandler(){logger[_0x4804('0x1a')](util[_0x4804('0x15')](_0x4804('0x1f'),this[_0x4804('0x1b')],this['calleridname'],this[_0x4804('0x1d')],this[_0x4804('0x1e')],this[_0x4804('0x20')]));this[_0x4804('0x21')]=!![];}function createSquareReport(_0x284d93,_0x7f6127){rpc[_0x4804('0x22')](_0x284d93)[_0x4804('0x23')](function(_0x1a78e6){if(_0x7f6127){_0x7f6127(null,_0x1a78e6);}})[_0x4804('0x24')](function(_0x538a70){if(_0x7f6127){_0x7f6127(null,_0x538a70);}});}function setChannelVariables(_0x1bfe6b){for(var _0x2590b9 in _0x1bfe6b){if(_0x1bfe6b[_0x4804('0x25')](_0x2590b9)){if(_0x2590b9[_0x4804('0x26')](_0x4804('0x27'))===0x0){_0x1bfe6b[_0x2590b9[_0x4804('0x28')](0x4)]=_0x1bfe6b[_0x2590b9];delete _0x1bfe6b[_0x2590b9];}}}}function agiHandler(_0xd7dd8c){logger[_0x4804('0x29')](_0x4804('0x2a'),JSON[_0x4804('0x2b')](_0xd7dd8c,null,0x2));logger[_0x4804('0x1a')](util['format'](_0x4804('0x2c'),_0xd7dd8c[_0x4804('0x1b')],_0xd7dd8c[_0x4804('0x1c')],_0xd7dd8c[_0x4804('0x1d')],_0xd7dd8c['dnid'],_0xd7dd8c[_0x4804('0x20')]));_0xd7dd8c['on'](_0x4804('0x11'),errorHandler);_0xd7dd8c['on'](_0x4804('0x2d'),closeHandler);_0xd7dd8c['on'](_0x4804('0x2e'),timeoutHandler);_0xd7dd8c[_0x4804('0x21')]=![];_0xd7dd8c['on'](_0x4804('0x2f'),hangupHandler);var _0x595f39=_['find'](projects,[_0x4804('0x17'),_0xd7dd8c['arg_1']]);if(!_0x595f39)return Project[_0x4804('0x30')](_0xd7dd8c);if(!_0x595f39[_0x4804('0x31')])return Project['handleUnpublished'](_0xd7dd8c);return Project['initialize'](_0x595f39,_0xd7dd8c);}function main(){var _0x4331ae;return utilLicense[_0x4804('0x32')]()[_0x4804('0x23')](function(_0x4ab618){if(!_0x4ab618)return;if(_0x4ab618['voice']){if(_0x4ab618['callysquare']&&_0x4ab618[_0x4804('0x33')]>0x0){logger['info'](util[_0x4804('0x15')]('[LICENSE]\x20CHANNELS:\x20%s',_0x4ab618[_0x4804('0x33')]));_0x4331ae=_0x4ab618[_0x4804('0x33')];}else{logger[_0x4804('0x1a')](_0x4804('0x34'));}}else{logger['info']('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x4331ae=-0x1;}})[_0x4804('0x23')](function(){return Project[_0x4804('0x35')]();})[_0x4804('0x23')](function(_0x3d20ab){projects=_0x3d20ab;return;})['catch'](function(_0x2f64ff){logger[_0x4804('0x11')](_0x4804('0x36'),_0x2f64ff[_0x4804('0xd')]);})['finally'](function(){var _0x52a74a=require(_0x4804('0x37'))(config['agi']['port'],config[_0x4804('0x9')]['ip'],_0x4331ae);_0x52a74a['on'](_0x4804('0x11'),errorHandler);_0x52a74a['on'](_0x4804('0x38'),listeningHandler);_0x52a74a['on'](_0x4804('0x39'),connectionHandler);_0x52a74a['on'](_0x4804('0x2d'),closeHandler);});}main(); \ No newline at end of file +var _0xd21c=['callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','finally','./server','port','listening','connection','lodash','syncho','util','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./events','EventEmitter','defaults','projectUpdate','error','stack','findIndex','deleted','push','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','[%s]\x20%s','name','message','[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','info','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','indexOf','agi_','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','find','handleNotFound','handleUnpublished','initialize','getLicense','voice'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd21c,0x1f2));var _0xcd21=function(_0x178c6f,_0x1de7fe){_0x178c6f=_0x178c6f-0x0;var _0x6e3770=_0xd21c[_0x178c6f];return _0x6e3770;};'use strict';var _=require(_0xcd21('0x0'));var syncho=require(_0xcd21('0x1'));var util=require(_0xcd21('0x2'));var config=require(_0xcd21('0x3'));var logger=require(_0xcd21('0x4'))(_0xcd21('0x5'));var utilLicense=require(_0xcd21('0x6'));var rpc=require(_0xcd21('0x7'));var Project=require('./project');var AGIEmitter=require(_0xcd21('0x8'))[_0xcd21('0x9')];var projects=[];config[_0xcd21('0x5')]=_[_0xcd21('0xa')](config['agi'],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0xcd21('0xb'),projectUpdateHandler);function connectionHandler(_0x2eb5cb){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x2eb5cb);agiHandler(_0x2eb5cb);}catch(_0x27ea44){logger[_0xcd21('0xc')](_0x27ea44[_0xcd21('0xd')]);}});});}function projectUpdateHandler(_0x45ac34){try{var _0x16c2ab=_[_0xcd21('0xe')](projects,['id',_0x45ac34['id']]);if(_0x16c2ab>-0x1){if(_0x45ac34[_0xcd21('0xf')]===!![]){projects['splice'](_0x16c2ab,0x1);}else{projects[_0x16c2ab]=_0x45ac34;}}else{projects[_0xcd21('0x10')](_0x45ac34);}}catch(_0x150fd9){logger[_0xcd21('0xc')](_0x150fd9[_0xcd21('0xd')]);}}function listeningHandler(){console['log'](_0xcd21('0x11'),config[_0xcd21('0x5')]['port']);logger['info'](util[_0xcd21('0x12')](_0xcd21('0x13'),config[_0xcd21('0x5')]['ip'],config[_0xcd21('0x5')]['port']));}function errorHandler(_0x475f84){if(_0x475f84&&_0x475f84['name']&&_0x475f84['message']){logger[_0xcd21('0xc')](util[_0xcd21('0x12')](_0xcd21('0x14'),_0x475f84[_0xcd21('0x15')],_0x475f84[_0xcd21('0x16')]));}else{logger['error'](util[_0xcd21('0x12')](_0xcd21('0x17'),_0x475f84[_0xcd21('0xd')]));}}function closeHandler(){logger['info'](util[_0xcd21('0x12')](_0xcd21('0x18'),this[_0xcd21('0x19')],this[_0xcd21('0x1a')],this[_0xcd21('0x1b')],this[_0xcd21('0x1c')],this['uniqueid']));try{createSquareReport(this);}catch(_0x832d6e){logger[_0xcd21('0xc')](_0x832d6e['stack']);}}function timeoutHandler(){logger[_0xcd21('0x1d')](util[_0xcd21('0x12')](_0xcd21('0x1e'),this[_0xcd21('0x19')],this[_0xcd21('0x1a')],this[_0xcd21('0x1b')],this[_0xcd21('0x1c')],this['uniqueid']));}function hangupHandler(){logger['info'](util['format'](_0xcd21('0x1f'),this[_0xcd21('0x19')],this['calleridname'],this[_0xcd21('0x1b')],this[_0xcd21('0x1c')],this['uniqueid']));this[_0xcd21('0x20')]=!![];}function createSquareReport(_0x1c550c,_0x43febc){rpc[_0xcd21('0x21')](_0x1c550c)[_0xcd21('0x22')](function(_0x3746a8){if(_0x43febc){_0x43febc(null,_0x3746a8);}})[_0xcd21('0x23')](function(_0x41e3b7){if(_0x43febc){_0x43febc(null,_0x41e3b7);}});}function setChannelVariables(_0x36fcaf){for(var _0xada863 in _0x36fcaf){if(_0x36fcaf['hasOwnProperty'](_0xada863)){if(_0xada863[_0xcd21('0x24')](_0xcd21('0x25'))===0x0){_0x36fcaf[_0xada863[_0xcd21('0x26')](0x4)]=_0x36fcaf[_0xada863];delete _0x36fcaf[_0xada863];}}}}function agiHandler(_0x23615d){logger[_0xcd21('0x27')](_0xcd21('0x28'),JSON[_0xcd21('0x29')](_0x23615d,null,0x2));logger[_0xcd21('0x1d')](util[_0xcd21('0x12')](_0xcd21('0x2a'),_0x23615d['arg_1'],_0x23615d['calleridname'],_0x23615d[_0xcd21('0x1b')],_0x23615d[_0xcd21('0x1c')],_0x23615d['uniqueid']));_0x23615d['on'](_0xcd21('0xc'),errorHandler);_0x23615d['on'](_0xcd21('0x2b'),closeHandler);_0x23615d['on'](_0xcd21('0x2c'),timeoutHandler);_0x23615d[_0xcd21('0x20')]=![];_0x23615d['on']('hangup',hangupHandler);var _0x47c2d9=_[_0xcd21('0x2d')](projects,[_0xcd21('0x15'),_0x23615d[_0xcd21('0x19')]]);if(!_0x47c2d9)return Project[_0xcd21('0x2e')](_0x23615d);if(!_0x47c2d9['production'])return Project[_0xcd21('0x2f')](_0x23615d);return Project[_0xcd21('0x30')](_0x47c2d9,_0x23615d);}function main(){var _0x3d26c2;return utilLicense[_0xcd21('0x31')]()[_0xcd21('0x22')](function(_0x19f695){if(!_0x19f695)return;if(_0x19f695[_0xcd21('0x32')]){if(_0x19f695[_0xcd21('0x33')]&&_0x19f695['callysquare']>0x0){logger[_0xcd21('0x1d')](util[_0xcd21('0x12')](_0xcd21('0x34'),_0x19f695[_0xcd21('0x33')]));_0x3d26c2=_0x19f695['callysquare'];}else{logger[_0xcd21('0x1d')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0xcd21('0x1d')](_0xcd21('0x35'));_0x3d26c2=-0x1;}})[_0xcd21('0x22')](function(){return Project[_0xcd21('0x36')]();})[_0xcd21('0x22')](function(_0x3aaf81){projects=_0x3aaf81;return;})['catch'](function(_0x3f651e){logger[_0xcd21('0xc')](_0xcd21('0x37'),_0x3f651e[_0xcd21('0xd')]);})[_0xcd21('0x38')](function(){var _0xc7516b=require(_0xcd21('0x39'))(config[_0xcd21('0x5')][_0xcd21('0x3a')],config[_0xcd21('0x5')]['ip'],_0x3d26c2);_0xc7516b['on']('error',errorHandler);_0xc7516b['on'](_0xcd21('0x3b'),listeningHandler);_0xc7516b['on'](_0xcd21('0x3c'),connectionHandler);_0xc7516b['on'](_0xcd21('0x2b'),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 afa1284..6fa016a 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 _0x230e=['then','error','result','catch','sendMailMessage','bluebird','client','http','request'];(function(_0xb4f6d6,_0x44b863){var _0x236dad=function(_0x2dbfd6){while(--_0x2dbfd6){_0xb4f6d6['push'](_0xb4f6d6['shift']());}};_0x236dad(++_0x44b863);}(_0x230e,0xdd));var _0xe230=function(_0x5a6eae,_0x2c9ea9){_0x5a6eae=_0x5a6eae-0x0;var _0x486ca5=_0x230e[_0x5a6eae];return _0x486ca5;};'use strict';var BPromise=require(_0xe230('0x0'));var jayson=require('jayson/promise');var client=jayson[_0xe230('0x1')][_0xe230('0x2')]({'port':0x232b});function request(_0x41df2a,_0x3e7d47){return new BPromise(function(_0x3f3dc0,_0x3fe80a){return client[_0xe230('0x3')](_0x41df2a,_0x3e7d47)[_0xe230('0x4')](function(_0x3c06e2){if(_0x3c06e2['error']){return _0x3fe80a(_0x3c06e2[_0xe230('0x5')]['message']);}else{return _0x3f3dc0(_0x3c06e2[_0xe230('0x6')]);}})[_0xe230('0x7')](function(_0x54a6e3){return _0x3fe80a(_0x54a6e3);});});}exports[_0xe230('0x8')]=function(_0x1d9765,_0x22d85c){return request('SendMail',{'account':_0x1d9765,'message':_0x22d85c});}; \ No newline at end of file +var _0x8861=['sendMailMessage','SendMail','bluebird','jayson/promise','client','http','then','error','result','catch'];(function(_0x5d1e84,_0x5e0b20){var _0xd8d4ff=function(_0x3571ee){while(--_0x3571ee){_0x5d1e84['push'](_0x5d1e84['shift']());}};_0xd8d4ff(++_0x5e0b20);}(_0x8861,0x8e));var _0x1886=function(_0x138d1e,_0x5debe4){_0x138d1e=_0x138d1e-0x0;var _0x3c1133=_0x8861[_0x138d1e];return _0x3c1133;};'use strict';var BPromise=require(_0x1886('0x0'));var jayson=require(_0x1886('0x1'));var client=jayson[_0x1886('0x2')][_0x1886('0x3')]({'port':0x232b});function request(_0x242294,_0x560e56){return new BPromise(function(_0x1090b2,_0xa3d82d){return client['request'](_0x242294,_0x560e56)[_0x1886('0x4')](function(_0x55c29f){if(_0x55c29f[_0x1886('0x5')]){return _0xa3d82d(_0x55c29f['error']['message']);}else{return _0x1090b2(_0x55c29f[_0x1886('0x6')]);}})[_0x1886('0x7')](function(_0x32860f){return _0xa3d82d(_0x32860f);});});}exports[_0x1886('0x8')]=function(_0x568c99,_0x48287b){return request(_0x1886('0x9'),{'account':_0x568c99,'message':_0x48287b});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 4c444ec..bd92ef8 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 _0xb606=['error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','length','target','root','inspect','production','start','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','info','format','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','dnid','uniqueid','traverseBFS','clear','debug','vertex','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','result','evtHangup','isUndefined','toString','agicommand\x20not\x20found','finally','callerid','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','lodash','moment','xml2json','util','../../config/logger','agi','./rpc','./graph','./vertices','catch'];(function(_0x104c7a,_0x219911){var _0x2a7492=function(_0x40047e){while(--_0x40047e){_0x104c7a['push'](_0x104c7a['shift']());}};_0x2a7492(++_0x219911);}(_0xb606,0x193));var _0x6b60=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xb606[_0x4b2436];return _0x4f5ab2;};'use strict';var _=require(_0x6b60('0x0'));var moment=require(_0x6b60('0x1'));var parser=require(_0x6b60('0x2'));var util=require(_0x6b60('0x3'));var logger=require(_0x6b60('0x4'))(_0x6b60('0x5'));var rpc=require(_0x6b60('0x6'));var mailRpc=require('./mailRpc');var Graph=require(_0x6b60('0x7'));var Vertices=require(_0x6b60('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()[_0x6b60('0x9')](function(_0x13c37d){logger[_0x6b60('0xa')](_0x6b60('0xb'),_0x13c37d[_0x6b60('0xc')]);return[];});}function addVertex(_0x58614f,_0x1341de,_0x3156bd){_0x1341de[_0x6b60('0xd')]=_0x3156bd;if(_0x1341de[_0x6b60('0xe')](_0x6b60('0xf'))){_0x1341de[_0x6b60('0x10')]=parseInt(_0x1341de[_0x6b60('0xf')],0xa);}_0x58614f[_0x6b60('0x11')](_[_0x6b60('0x12')](_0x1341de,_0x6b60('0x13')));}function initGraph(_0x52e20c,_0xd03c99){var _0x4a845f=new Graph();for(var _0x49af68 in _0x52e20c){if(_0x52e20c[_0x6b60('0xe')](_0x49af68)){if(_['isArray'](_0x52e20c[_0x49af68])){for(var _0x55c8b7=0x0;_0x55c8b7<_0x52e20c[_0x49af68][_0x6b60('0x14')];_0x55c8b7+=0x1){addVertex(_0x4a845f,_0x52e20c[_0x49af68][_0x55c8b7],_0x49af68);}}else{addVertex(_0x4a845f,_0x52e20c[_0x49af68],_0x49af68);}}}for(var _0x5a2a7a=0x0;_0x5a2a7a<_0xd03c99[_0x6b60('0x14')];_0x5a2a7a+=0x1){if(_0xd03c99[_0x5a2a7a]['source']&&_0xd03c99[_0x5a2a7a][_0x6b60('0x15')]){_0x4a845f['addEdge'](_0xd03c99[_0x5a2a7a]['source'],_0xd03c99[_0x5a2a7a]['target'],_0xd03c99[_0x5a2a7a]['value']);}}return _0x4a845f;}function getRoot(_0x233e35){return parser['toJson'](_0x233e35,{'object':!![]})['mxGraphModel'][_0x6b60('0x16')];}function inspect(_0x429b74){return util[_0x6b60('0x17')](_0x429b74,{'showHidden':![],'depth':null});}function initialize(_0x3ae892,_0xfa8915){var _0x100f00=getRoot(_0x3ae892[_0x6b60('0x18')]);if(!_0x100f00||!_0x100f00[_0x6b60('0x19')])return;var _0x4cde5a,_0x22ff3c,_0x57b6f8;logger['debug'](_0x6b60('0x16'),JSON[_0x6b60('0x1a')](_0x100f00,null,0x2));_0xfa8915[_0x6b60('0x1b')]=moment()['format'](_0x6b60('0x1c'));_0x4cde5a=initGraph(_['omit'](_0x100f00,_0x6b60('0x13')),_0x100f00[_0x6b60('0x13')]);_0x22ff3c=new Vertices(_0xfa8915,rpc,mailRpc);logger[_0x6b60('0x1d')](util[_0x6b60('0x1e')](_0x6b60('0x1f'),_0xfa8915[_0x6b60('0x20')],_0xfa8915[_0x6b60('0x21')],_0xfa8915['callerid'],_0xfa8915[_0x6b60('0x22')],_0xfa8915[_0x6b60('0x23')]));_0x4cde5a[_0x6b60('0x24')](_0x100f00[_0x6b60('0x19')]['id'],function(_0x3ba005){try{_0x3ba005=_0x22ff3c[_0x6b60('0x25')](_0x3ba005);logger[_0x6b60('0x26')](_0x6b60('0x27'),JSON[_0x6b60('0x1a')](_0x3ba005,null,0x2));if(_0x3ba005[_0x6b60('0xd')]==='gotoc'){logger[_0x6b60('0x1d')](_0x6b60('0x28'));_0xfa8915[_0x6b60('0x29')]=_0x3ba005[_0x6b60('0x29')]||_0xfa8915[_0x6b60('0x29')];_0xfa8915['extension']=_0x3ba005[_0x6b60('0x2a')];_0xfa8915[_0x6b60('0x2b')]=_0x3ba005['priority']?_0x3ba005[_0x6b60('0x2b')]-0x1:0x1;return null;}else if(_0x3ba005&&_0x22ff3c[_0x3ba005[_0x6b60('0xd')]]){_0x57b6f8=_0x22ff3c[_0x3ba005[_0x6b60('0xd')]](_0x3ba005);logger[_0x6b60('0x1d')](_0x6b60('0x2c'),JSON[_0x6b60('0x1a')](_0x57b6f8,null,0x2));if(_0x57b6f8&&_0x57b6f8['code']===AGI_CODE_SUCCESS&&_0x57b6f8[_0x6b60('0x2d')]!==AGI_RESULT_ERROR&&!_0xfa8915[_0x6b60('0x2e')]){logger[_0x6b60('0x26')](_0x6b60('0x2c'),inspect(_0x57b6f8));return _[_0x6b60('0x2f')](_0x57b6f8[_0x6b60('0x2d')])?null:_0x57b6f8[_0x6b60('0x2d')][_0x6b60('0x30')]();}else{logger[_0x6b60('0xa')]('response',inspect(_0x57b6f8));return null;}}else{logger[_0x6b60('0xa')](_0x6b60('0x31'));return null;}}catch(_0x249259){logger[_0x6b60('0xa')](_0x249259[_0x6b60('0xc')]);return null;}});if(_0x100f00[_0x6b60('0x32')]){logger['info'](util[_0x6b60('0x1e')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0xfa8915['arg_1'],_0xfa8915[_0x6b60('0x21')],_0xfa8915[_0x6b60('0x33')],_0xfa8915['dnid'],_0xfa8915[_0x6b60('0x23')]));_0x4cde5a[_0x6b60('0x24')](_0x100f00['finally']['id'],function(_0x38c415){try{_0x38c415=_0x22ff3c['clear'](_0x38c415);logger[_0x6b60('0x26')](_0x6b60('0x27'),JSON[_0x6b60('0x1a')](_0x38c415,null,0x2));if(_0x38c415&&_0x22ff3c[_0x38c415[_0x6b60('0xd')]]){_0x57b6f8=_0x22ff3c[_0x38c415[_0x6b60('0xd')]](_0x38c415);if(_0x57b6f8){logger['debug'](_0x6b60('0x2c'),inspect(_0x57b6f8));return _[_0x6b60('0x2f')](_0x57b6f8[_0x6b60('0x2d')])?null:_0x57b6f8[_0x6b60('0x2d')][_0x6b60('0x30')]();}else{logger[_0x6b60('0xa')](_0x6b60('0x2c'),inspect(_0x57b6f8));return null;}}else{logger['error'](_0x6b60('0x31'));return null;}}catch(_0x3804c3){logger[_0x6b60('0xa')](_0x3804c3[_0x6b60('0xc')]);return null;}});}logger[_0x6b60('0x1d')](util[_0x6b60('0x1e')](_0x6b60('0x34'),_0xfa8915[_0x6b60('0x20')],_0xfa8915['calleridname'],_0xfa8915['callerid'],_0xfa8915[_0x6b60('0x22')],_0xfa8915['uniqueid']));logger['info'](util[_0x6b60('0x1e')](_0x6b60('0x35'),_0xfa8915[_0x6b60('0x29')],_0xfa8915[_0x6b60('0x2a')],parseInt(_0xfa8915[_0x6b60('0x2b')],0xa)+0x1));_0xfa8915[_0x6b60('0x36')](_0xfa8915['context'],_0xfa8915[_0x6b60('0x2a')],parseInt(_0xfa8915[_0x6b60('0x2b')],0xa)+0x1);_0xfa8915[_0x6b60('0x37')]();}function handleNotFound(_0x1d9aef){logger['error'](util[_0x6b60('0x1e')](_0x6b60('0x38'),_0x1d9aef[_0x6b60('0x20')]));_0x1d9aef[_0x6b60('0x36')](_0x1d9aef[_0x6b60('0x29')],_0x1d9aef[_0x6b60('0x2a')],parseInt(_0x1d9aef[_0x6b60('0x2b')],0xa)+0x1);_0x1d9aef[_0x6b60('0x37')]();}function handleUnpublished(_0x1b0912){logger['error'](util['format'](_0x6b60('0x39'),_0x1b0912['arg_1']));_0x1b0912['continueAt'](_0x1b0912[_0x6b60('0x29')],_0x1b0912[_0x6b60('0x2a')],parseInt(_0x1b0912['priority'],0xa)+0x1);_0x1b0912[_0x6b60('0x37')]();}module[_0x6b60('0x3a')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x69bb=['Project\x20%s\x20not\x20published','exports','lodash','moment','xml2json','util','../../config/logger','agi','./rpc','./mailRpc','./graph','./vertices','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','hasOwnProperty','maxRetry','retry','addVertex','omit','mxCell','isArray','length','source','addEdge','target','toJson','mxGraphModel','root','inspect','start','debug','stringify','info','format','calleridname','callerid','dnid','uniqueid','clear','vertex','agicommand','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','toString','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','result','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found'];(function(_0x575c27,_0x519263){var _0x138552=function(_0x45899d){while(--_0x45899d){_0x575c27['push'](_0x575c27['shift']());}};_0x138552(++_0x519263);}(_0x69bb,0x7a));var _0xb69b=function(_0x14ca34,_0x3d0824){_0x14ca34=_0x14ca34-0x0;var _0xafa717=_0x69bb[_0x14ca34];return _0xafa717;};'use strict';var _=require(_0xb69b('0x0'));var moment=require(_0xb69b('0x1'));var parser=require(_0xb69b('0x2'));var util=require(_0xb69b('0x3'));var logger=require(_0xb69b('0x4'))(_0xb69b('0x5'));var rpc=require(_0xb69b('0x6'));var mailRpc=require(_0xb69b('0x7'));var Graph=require(_0xb69b('0x8'));var Vertices=require(_0xb69b('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()['catch'](function(_0x27e259){logger[_0xb69b('0xa')](_0xb69b('0xb'),_0x27e259[_0xb69b('0xc')]);return[];});}function addVertex(_0x43e7ae,_0xea65a6,_0x426527){_0xea65a6['agicommand']=_0x426527;if(_0xea65a6[_0xb69b('0xd')]('retry')){_0xea65a6[_0xb69b('0xe')]=parseInt(_0xea65a6[_0xb69b('0xf')],0xa);}_0x43e7ae[_0xb69b('0x10')](_[_0xb69b('0x11')](_0xea65a6,_0xb69b('0x12')));}function initGraph(_0x90f2d1,_0x84f015){var _0x21f23f=new Graph();for(var _0x449c3b in _0x90f2d1){if(_0x90f2d1[_0xb69b('0xd')](_0x449c3b)){if(_[_0xb69b('0x13')](_0x90f2d1[_0x449c3b])){for(var _0x3c807a=0x0;_0x3c807a<_0x90f2d1[_0x449c3b][_0xb69b('0x14')];_0x3c807a+=0x1){addVertex(_0x21f23f,_0x90f2d1[_0x449c3b][_0x3c807a],_0x449c3b);}}else{addVertex(_0x21f23f,_0x90f2d1[_0x449c3b],_0x449c3b);}}}for(var _0x33db9b=0x0;_0x33db9b<_0x84f015['length'];_0x33db9b+=0x1){if(_0x84f015[_0x33db9b][_0xb69b('0x15')]&&_0x84f015[_0x33db9b]['target']){_0x21f23f[_0xb69b('0x16')](_0x84f015[_0x33db9b][_0xb69b('0x15')],_0x84f015[_0x33db9b][_0xb69b('0x17')],_0x84f015[_0x33db9b]['value']);}}return _0x21f23f;}function getRoot(_0x23ef8b){return parser[_0xb69b('0x18')](_0x23ef8b,{'object':!![]})[_0xb69b('0x19')][_0xb69b('0x1a')];}function inspect(_0x51bdf3){return util[_0xb69b('0x1b')](_0x51bdf3,{'showHidden':![],'depth':null});}function initialize(_0x4a8620,_0x51916f){var _0x46a976=getRoot(_0x4a8620['production']);if(!_0x46a976||!_0x46a976[_0xb69b('0x1c')])return;var _0x3d9fe2,_0xb4411d,_0x451314;logger[_0xb69b('0x1d')]('root',JSON[_0xb69b('0x1e')](_0x46a976,null,0x2));_0x51916f['joinAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3d9fe2=initGraph(_[_0xb69b('0x11')](_0x46a976,_0xb69b('0x12')),_0x46a976[_0xb69b('0x12')]);_0xb4411d=new Vertices(_0x51916f,rpc,mailRpc);logger[_0xb69b('0x1f')](util[_0xb69b('0x20')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x51916f['arg_1'],_0x51916f[_0xb69b('0x21')],_0x51916f[_0xb69b('0x22')],_0x51916f[_0xb69b('0x23')],_0x51916f[_0xb69b('0x24')]));_0x3d9fe2['traverseBFS'](_0x46a976['start']['id'],function(_0x361981){try{_0x361981=_0xb4411d[_0xb69b('0x25')](_0x361981);logger[_0xb69b('0x1d')](_0xb69b('0x26'),JSON[_0xb69b('0x1e')](_0x361981,null,0x2));if(_0x361981[_0xb69b('0x27')]===_0xb69b('0x28')){logger['info'](_0xb69b('0x29'));_0x51916f['context']=_0x361981['context']||_0x51916f[_0xb69b('0x2a')];_0x51916f[_0xb69b('0x2b')]=_0x361981[_0xb69b('0x2b')];_0x51916f[_0xb69b('0x2c')]=_0x361981['priority']?_0x361981[_0xb69b('0x2c')]-0x1:0x1;return null;}else if(_0x361981&&_0xb4411d[_0x361981['agicommand']]){_0x451314=_0xb4411d[_0x361981[_0xb69b('0x27')]](_0x361981);logger['info'](_0xb69b('0x2d'),JSON[_0xb69b('0x1e')](_0x451314,null,0x2));if(_0x451314&&_0x451314[_0xb69b('0x2e')]===AGI_CODE_SUCCESS&&_0x451314['result']!==AGI_RESULT_ERROR&&!_0x51916f['evtHangup']){logger['debug']('response',inspect(_0x451314));return _['isUndefined'](_0x451314['result'])?null:_0x451314['result'][_0xb69b('0x2f')]();}else{logger[_0xb69b('0xa')](_0xb69b('0x2d'),inspect(_0x451314));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x29c809){logger['error'](_0x29c809[_0xb69b('0xc')]);return null;}});if(_0x46a976[_0xb69b('0x30')]){logger[_0xb69b('0x1f')](util[_0xb69b('0x20')](_0xb69b('0x31'),_0x51916f['arg_1'],_0x51916f[_0xb69b('0x21')],_0x51916f[_0xb69b('0x22')],_0x51916f[_0xb69b('0x23')],_0x51916f[_0xb69b('0x24')]));_0x3d9fe2['traverseBFS'](_0x46a976[_0xb69b('0x30')]['id'],function(_0x18d11b){try{_0x18d11b=_0xb4411d[_0xb69b('0x25')](_0x18d11b);logger[_0xb69b('0x1d')](_0xb69b('0x26'),JSON[_0xb69b('0x1e')](_0x18d11b,null,0x2));if(_0x18d11b&&_0xb4411d[_0x18d11b[_0xb69b('0x27')]]){_0x451314=_0xb4411d[_0x18d11b['agicommand']](_0x18d11b);if(_0x451314){logger['debug'](_0xb69b('0x2d'),inspect(_0x451314));return _['isUndefined'](_0x451314[_0xb69b('0x32')])?null:_0x451314['result'][_0xb69b('0x2f')]();}else{logger[_0xb69b('0xa')]('response',inspect(_0x451314));return null;}}else{logger[_0xb69b('0xa')](_0xb69b('0x33'));return null;}}catch(_0x4ec23c){logger[_0xb69b('0xa')](_0x4ec23c[_0xb69b('0xc')]);return null;}});}logger['info'](util[_0xb69b('0x20')](_0xb69b('0x34'),_0x51916f[_0xb69b('0x35')],_0x51916f[_0xb69b('0x21')],_0x51916f['callerid'],_0x51916f[_0xb69b('0x23')],_0x51916f[_0xb69b('0x24')]));logger[_0xb69b('0x1f')](util['format'](_0xb69b('0x36'),_0x51916f[_0xb69b('0x2a')],_0x51916f['extension'],parseInt(_0x51916f[_0xb69b('0x2c')],0xa)+0x1));_0x51916f[_0xb69b('0x37')](_0x51916f[_0xb69b('0x2a')],_0x51916f['extension'],parseInt(_0x51916f['priority'],0xa)+0x1);_0x51916f[_0xb69b('0x38')]();}function handleNotFound(_0x5e5cd7){logger[_0xb69b('0xa')](util[_0xb69b('0x20')](_0xb69b('0x39'),_0x5e5cd7[_0xb69b('0x35')]));_0x5e5cd7[_0xb69b('0x37')](_0x5e5cd7['context'],_0x5e5cd7[_0xb69b('0x2b')],parseInt(_0x5e5cd7[_0xb69b('0x2c')],0xa)+0x1);_0x5e5cd7[_0xb69b('0x38')]();}function handleUnpublished(_0x173fb2){logger[_0xb69b('0xa')](util[_0xb69b('0x20')](_0xb69b('0x3a'),_0x173fb2[_0xb69b('0x35')]));_0x173fb2[_0xb69b('0x37')](_0x173fb2['context'],_0x173fb2[_0xb69b('0x2b')],parseInt(_0x173fb2['priority'],0xa)+0x1);_0x173fb2[_0xb69b('0x38')]();}module[_0xb69b('0x3b')]={'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 fb524f5..2db5220 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 _0xa503=['util','stream','Transform','call','_localBuffer','_inBody','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','split','trim','emit','headers','exports'];(function(_0x20a381,_0xc2de8d){var _0x2a7e09=function(_0x1fb172){while(--_0x1fb172){_0x20a381['push'](_0x20a381['shift']());}};_0x2a7e09(++_0xc2de8d);}(_0xa503,0x143));var _0x3a50=function(_0x19beb2,_0x3f68c0){_0x19beb2=_0x19beb2-0x0;var _0x4118dd=_0xa503[_0x19beb2];return _0x4118dd;};'use strict';var util=require(_0x3a50('0x0'));var Transform=require(_0x3a50('0x1'))[_0x3a50('0x2')];function AGIReply(_0x3fb8eb){Transform[_0x3a50('0x3')](this,_0x3fb8eb);this[_0x3a50('0x4')]='';this[_0x3a50('0x5')]=![];}util['inherits'](AGIReply,Transform);AGIReply['prototype'][_0x3a50('0x6')]=function(_0x352ef1,_0x574978,_0x5dc625){var _0x1956cd='\x0a',_0x3ad392=['\x0a\x0a',_0x3a50('0x7')],_0x44bd93=-0x1,_0x307280=-0x1,_0x3ffb2f='',_0x1cd114=0x0,_0x58b86e='',_0x2ed3f7='';this[_0x3a50('0x4')]+=_0x352ef1[_0x3a50('0x8')]();_0x58b86e=this[_0x3a50('0x4')];if(!this[_0x3a50('0x5')]){_0x1cd114=0x0;while(_0x3ad392[_0x1cd114]){while((_0x307280=_0x58b86e[_0x3a50('0x9')](_0x3ad392[_0x1cd114]))!=-0x1){_0x3ffb2f=_0x3ad392[_0x1cd114];_0x2ed3f7=_0x58b86e['substring'](0x0,_0x307280);_0x58b86e=_0x58b86e[_0x3a50('0xa')](_0x307280+_0x3ffb2f[_0x3a50('0xb')]);var _0x1c5a82=_0x2ed3f7[_0x3a50('0xc')](_0x1956cd),_0x59df99=0x0,_0x1bfd3f={},_0x4e9a5a='',_0x1719c8='',_0x401060=-0x1;while(_0x1c5a82[_0x59df99]){_0x401060=_0x1c5a82[_0x59df99][_0x3a50('0x9')](':');if(_0x401060!=-0x1){_0x4e9a5a=_0x1c5a82[_0x59df99]['slice'](0x0,_0x401060)[_0x3a50('0xd')]();_0x1719c8=_0x1c5a82[_0x59df99]['slice'](_0x401060+0x1)[_0x3a50('0xd')]();if(_0x4e9a5a[_0x3a50('0xb')]>0x0){_0x1bfd3f[_0x4e9a5a]=_0x1719c8;}}else{}_0x59df99++;}this[_0x3a50('0xe')](_0x3a50('0xf'),_0x1bfd3f);this['_inBody']=!![];}_0x1cd114++;}this[_0x3a50('0x4')]=_0x58b86e;}else{while((_0x44bd93=_0x58b86e['indexOf'](_0x1956cd))!=-0x1){_0x2ed3f7=_0x58b86e[_0x3a50('0xa')](0x0,_0x44bd93);this[_0x3a50('0xe')]('line',_0x2ed3f7);_0x58b86e=_0x58b86e['substring'](_0x44bd93+_0x1956cd[_0x3a50('0xb')]);}this['_localBuffer']=_0x58b86e;}_0x5dc625();};module[_0x3a50('0x10')]=AGIReply; \ No newline at end of file +var _0x5d4c=['\x0d\x0a\x0d\x0a','_inBody','indexOf','substring','split','slice','trim','length','emit','line','util','stream','call','_localBuffer','inherits','_transform'];(function(_0x325c1d,_0xaac33){var _0x41620d=function(_0x44e13c){while(--_0x44e13c){_0x325c1d['push'](_0x325c1d['shift']());}};_0x41620d(++_0xaac33);}(_0x5d4c,0x1ba));var _0xc5d4=function(_0x55f6e3,_0x4d6f68){_0x55f6e3=_0x55f6e3-0x0;var _0x175d12=_0x5d4c[_0x55f6e3];return _0x175d12;};'use strict';var util=require(_0xc5d4('0x0'));var Transform=require(_0xc5d4('0x1'))['Transform'];function AGIReply(_0x16d662){Transform[_0xc5d4('0x2')](this,_0x16d662);this[_0xc5d4('0x3')]='';this['_inBody']=![];}util[_0xc5d4('0x4')](AGIReply,Transform);AGIReply['prototype'][_0xc5d4('0x5')]=function(_0x3c3149,_0x1b522a,_0x368c78){var _0x1c5fe5='\x0a',_0x5aaab0=['\x0a\x0a',_0xc5d4('0x6')],_0x542d3d=-0x1,_0x8092d3=-0x1,_0x15f0cf='',_0x39c059=0x0,_0x1c7475='',_0x50e2e1='';this['_localBuffer']+=_0x3c3149['toString']();_0x1c7475=this[_0xc5d4('0x3')];if(!this[_0xc5d4('0x7')]){_0x39c059=0x0;while(_0x5aaab0[_0x39c059]){while((_0x8092d3=_0x1c7475[_0xc5d4('0x8')](_0x5aaab0[_0x39c059]))!=-0x1){_0x15f0cf=_0x5aaab0[_0x39c059];_0x50e2e1=_0x1c7475[_0xc5d4('0x9')](0x0,_0x8092d3);_0x1c7475=_0x1c7475['substring'](_0x8092d3+_0x15f0cf['length']);var _0x2bef03=_0x50e2e1[_0xc5d4('0xa')](_0x1c5fe5),_0x1fe54d=0x0,_0x322517={},_0xb4b306='',_0x4eb22f='',_0x201b20=-0x1;while(_0x2bef03[_0x1fe54d]){_0x201b20=_0x2bef03[_0x1fe54d][_0xc5d4('0x8')](':');if(_0x201b20!=-0x1){_0xb4b306=_0x2bef03[_0x1fe54d][_0xc5d4('0xb')](0x0,_0x201b20)['trim']();_0x4eb22f=_0x2bef03[_0x1fe54d][_0xc5d4('0xb')](_0x201b20+0x1)[_0xc5d4('0xc')]();if(_0xb4b306[_0xc5d4('0xd')]>0x0){_0x322517[_0xb4b306]=_0x4eb22f;}}else{}_0x1fe54d++;}this[_0xc5d4('0xe')]('headers',_0x322517);this[_0xc5d4('0x7')]=!![];}_0x39c059++;}this[_0xc5d4('0x3')]=_0x1c7475;}else{while((_0x542d3d=_0x1c7475['indexOf'](_0x1c5fe5))!=-0x1){_0x50e2e1=_0x1c7475[_0xc5d4('0x9')](0x0,_0x542d3d);this['emit'](_0xc5d4('0xf'),_0x50e2e1);_0x1c7475=_0x1c7475['substring'](_0x542d3d+_0x1c5fe5[_0xc5d4('0xd')]);}this[_0xc5d4('0x3')]=_0x1c7475;}_0x368c78();};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 f12e99c..a9c745b 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 _0x269f=['ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','PauseUser','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','http','request','then','error','message','result','catch','getSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','GetContactByPhone','save_name','getIntervalById','ShowInterval','Interval','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','ShowCmHopper','phone'];(function(_0x248bf0,_0x29a685){var _0x455c00=function(_0x44da4d){while(--_0x44da4d){_0x248bf0['push'](_0x248bf0['shift']());}};_0x455c00(++_0x29a685);}(_0x269f,0xee));var _0xf269=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x269f[_0x25e7cb];return _0x375d92;};'use strict';var _=require(_0xf269('0x0'));var moment=require(_0xf269('0x1'));var jayson=require(_0xf269('0x2'));var client=jayson['client'][_0xf269('0x3')]({'port':0x2329});function request(_0x59459a,_0x45b72d){return new Promise(function(_0x35e943,_0x230d12){return client[_0xf269('0x4')](_0x59459a,_0x45b72d)[_0xf269('0x5')](function(_0x527acd){if(_0x527acd[_0xf269('0x6')]){return _0x230d12(_0x527acd[_0xf269('0x6')][_0xf269('0x7')]);}else{return _0x35e943(_0x527acd[_0xf269('0x8')]);}})[_0xf269('0x9')](function(_0x43c60c){return _0x230d12(_0x43c60c);});});}exports[_0xf269('0xa')]=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id',_0xf269('0xb'),_0xf269('0xc')]}});};exports[_0xf269('0xd')]=function(_0x2f7c95){return request(_0xf269('0xe'),{'options':{'raw':![],'where':{'name':_0x2f7c95},'attributes':[_0xf269('0xc')]}});};exports[_0xf269('0xf')]=function(_0x424103){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x424103},'include':[{'model':'MailServerOut','as':'Smtp','include':[{'model':'CloudProvider','as':'CloudProvider'}]}],'attributes':['id',_0xf269('0xb'),_0xf269('0x10')],'smtp':!![]}});};exports[_0xf269('0x11')]=function(_0x4d130e){return request(_0xf269('0xe'),{'options':{'where':{'id':_0x4d130e},'attributes':[_0xf269('0xb')]}});};exports[_0xf269('0x12')]=function(_0x34912d){return request(_0xf269('0x13'),{'options':{'where':{'id':_0x34912d},'attributes':[_0xf269('0xb')]}});};exports[_0xf269('0x14')]=function(_0x2bdeb9){return request(_0xf269('0x15'),{'options':{'where':{'id':_0x2bdeb9},'attributes':[_0xf269('0xb')]}});};exports[_0xf269('0x16')]=function(_0xa00717){return request(_0xf269('0x17'),{'options':{'where':{'id':_0xa00717},'attributes':[_0xf269('0x18')]}});};exports[_0xf269('0x19')]=function(_0x2910d0){return request(_0xf269('0x1a'),{'options':{'where':{'id':_0x2910d0},'attributes':[_0xf269('0xb')]}});};exports['getContactByPhone']=function(_0x60f3b0){return request(_0xf269('0x1b'),{'options':{'where':{'phone':_0x60f3b0['phone']},'attributes':['id']}});};exports['getTrunkById']=function(_0x3a7f06){return request('ShowTrunk',{'options':{'where':{'id':_0x3a7f06},'attributes':[_0xf269('0xb')]}});};exports['getSoundById']=function(_0x4e5f0d){return request('ShowSound',{'options':{'where':{'id':_0x4e5f0d},'attributes':[_0xf269('0x1c')]}});};exports[_0xf269('0x1d')]=function(_0x4cedf4){return request(_0xf269('0x1e'),{'options':{'raw':![],'where':{'id':_0x4cedf4},'include':[{'model':_0xf269('0x1f'),'as':'Intervals'}]}});};exports[_0xf269('0x20')]=function(_0x328973){return request(_0xf269('0x21'),{'options':{'where':{'id':_0x328973},'attributes':['id',_0xf269('0xb')]}});};exports[_0xf269('0x22')]=function(_0x30d9b0){return request('CreateSmsMessage',{'body':_0x30d9b0});};exports[_0xf269('0x23')]=function(_0x43b5f2){return request('CreateSquareDetailsReport',{'body':_0x43b5f2});};exports[_0xf269('0x24')]=function(_0x7812a2){return request(_0xf269('0x25'),{'body':_[_0xf269('0x26')](_0x7812a2,{'project_name':_0x7812a2[_0xf269('0x27')],'prev_project_name':_0x7812a2['arg_2']||'','is_subproject':_0x7812a2['arg_2']?!![]:![],'leaveAt':moment()[_0xf269('0x28')](_0xf269('0x29'))})});};exports[_0xf269('0x2a')]=function(_0x1b66ec){return request(_0xf269('0x2b'),{'body':_0x1b66ec});};exports[_0xf269('0x2c')]=function(_0xae9f32){return request('CreateSquareMessage',{'body':_0xae9f32});};exports['createCmContact']=function(_0xeac015){return request(_0xf269('0x2d'),{'options':{'raw':![],'where':{'phone':_0xeac015[_0xf269('0x2e')],'ListId':_0xeac015[_0xf269('0x2f')]}}})[_0xf269('0x5')](function(_0x3441df){if(_0x3441df){return _0x3441df;}return request(_0xf269('0x30'),{'body':_0xeac015});});};exports[_0xf269('0x31')]=function(_0x337050){return request(_0xf269('0x32'),{'options':{'where':{'id':_0x337050},'attributes':[_0xf269('0xb')]}});};exports[_0xf269('0x33')]=function(_0x517f89,_0x4c513d){return request(_0xf269('0x34'),{'body':{'interface':_0x4c513d},'options':{'where':_0x517f89}});};exports['agentPause']=function(_0x3619bd,_0x3eb25c,_0x4c90d5){return request(_0xf269('0x35'),{'body':{'type':_0x3eb25c,'uniqueid':_0x4c90d5},'options':{'where':_0x3619bd}});};exports['agentUnpause']=function(_0x2b3357){return request(_0xf269('0x36'),{'body':{},'options':{'where':_0x2b3357}});};exports[_0xf269('0x37')]=function(_0x233bce){return request(_0xf269('0x38'),{'body':{},'options':{'where':_0x233bce}});}; \ No newline at end of file +var _0xc978=['ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','Interval','Intervals','getSmsAccountById','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','arg_1','arg_2','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','getPauseById','ShowPause','agentLogin','LoginUser','PauseUser','LogoutUser','lodash','moment','jayson/promise','client','http','request','then','error','result','catch','getSquareProjects','GetSquareProjects','name','production','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getVoiceQueueById','getVariableById'];(function(_0x5e908e,_0x30b133){var _0x18c6ca=function(_0x865438){while(--_0x865438){_0x5e908e['push'](_0x5e908e['shift']());}};_0x18c6ca(++_0x30b133);}(_0xc978,0xcd));var _0x8c97=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc978[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8c97('0x0'));var moment=require(_0x8c97('0x1'));var jayson=require(_0x8c97('0x2'));var client=jayson[_0x8c97('0x3')][_0x8c97('0x4')]({'port':0x2329});function request(_0x44d4ea,_0x5ef47d){return new Promise(function(_0x23f5e9,_0x23c28d){return client[_0x8c97('0x5')](_0x44d4ea,_0x5ef47d)[_0x8c97('0x6')](function(_0x426a77){if(_0x426a77[_0x8c97('0x7')]){return _0x23c28d(_0x426a77[_0x8c97('0x7')]['message']);}else{return _0x23f5e9(_0x426a77[_0x8c97('0x8')]);}})[_0x8c97('0x9')](function(_0x332cd1){return _0x23c28d(_0x332cd1);});});}exports[_0x8c97('0xa')]=function(){return request(_0x8c97('0xb'),{'options':{'raw':![],'attributes':['id',_0x8c97('0xc'),_0x8c97('0xd')]}});};exports['getSquareProject']=function(_0x179342){return request(_0x8c97('0xe'),{'options':{'raw':![],'where':{'name':_0x179342},'attributes':[_0x8c97('0xd')]}});};exports[_0x8c97('0xf')]=function(_0x400eb6){return request(_0x8c97('0x10'),{'options':{'raw':![],'where':{'id':_0x400eb6},'include':[{'model':_0x8c97('0x11'),'as':_0x8c97('0x12'),'include':[{'model':_0x8c97('0x13'),'as':'CloudProvider'}]}],'attributes':['id',_0x8c97('0xc'),_0x8c97('0x14')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x31ae92){return request(_0x8c97('0xe'),{'options':{'where':{'id':_0x31ae92},'attributes':['name']}});};exports[_0x8c97('0x15')]=function(_0x4ec9cb){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x4ec9cb},'attributes':['name']}});};exports[_0x8c97('0x16')]=function(_0xab3812){return request(_0x8c97('0x17'),{'options':{'where':{'id':_0xab3812},'attributes':[_0x8c97('0xc')]}});};exports[_0x8c97('0x18')]=function(_0x29767b){return request(_0x8c97('0x19'),{'options':{'where':{'id':_0x29767b},'attributes':[_0x8c97('0x1a')]}});};exports[_0x8c97('0x1b')]=function(_0x5edbc6){return request(_0x8c97('0x1c'),{'options':{'where':{'id':_0x5edbc6},'attributes':[_0x8c97('0xc')]}});};exports[_0x8c97('0x1d')]=function(_0x3b57ed){return request(_0x8c97('0x1e'),{'options':{'where':{'phone':_0x3b57ed[_0x8c97('0x1f')]},'attributes':['id']}});};exports[_0x8c97('0x20')]=function(_0x400bbc){return request(_0x8c97('0x21'),{'options':{'where':{'id':_0x400bbc},'attributes':[_0x8c97('0xc')]}});};exports[_0x8c97('0x22')]=function(_0xb55f9b){return request(_0x8c97('0x23'),{'options':{'where':{'id':_0xb55f9b},'attributes':[_0x8c97('0x24')]}});};exports[_0x8c97('0x25')]=function(_0x2b83a8){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x2b83a8},'include':[{'model':_0x8c97('0x26'),'as':_0x8c97('0x27')}]}});};exports[_0x8c97('0x28')]=function(_0x5ed5ba){return request('ShowSmsAccount',{'options':{'where':{'id':_0x5ed5ba},'attributes':['id',_0x8c97('0xc')]}});};exports['createSmsMessage']=function(_0x41d276){return request(_0x8c97('0x29'),{'body':_0x41d276});};exports[_0x8c97('0x2a')]=function(_0x13a9de){return request(_0x8c97('0x2b'),{'body':_0x13a9de});};exports[_0x8c97('0x2c')]=function(_0x18c81a){return request('CreateSquareReport',{'body':_['merge'](_0x18c81a,{'project_name':_0x18c81a[_0x8c97('0x2d')],'prev_project_name':_0x18c81a[_0x8c97('0x2e')]||'','is_subproject':_0x18c81a[_0x8c97('0x2e')]?!![]:![],'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x8c97('0x2f')]=function(_0x37986d){return request(_0x8c97('0x30'),{'body':_0x37986d});};exports[_0x8c97('0x31')]=function(_0x34f8be){return request(_0x8c97('0x32'),{'body':_0x34f8be});};exports['createCmContact']=function(_0x443dfd){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x443dfd[_0x8c97('0x1f')],'ListId':_0x443dfd['ListId']}}})[_0x8c97('0x6')](function(_0x154592){if(_0x154592){return _0x154592;}return request('CreateCmContact',{'body':_0x443dfd});});};exports[_0x8c97('0x33')]=function(_0x57fef8){return request(_0x8c97('0x34'),{'options':{'where':{'id':_0x57fef8},'attributes':[_0x8c97('0xc')]}});};exports[_0x8c97('0x35')]=function(_0x2ebba4,_0x4451d6){return request(_0x8c97('0x36'),{'body':{'interface':_0x4451d6},'options':{'where':_0x2ebba4}});};exports['agentPause']=function(_0x51ee86,_0x12a7d0,_0x26d5dc){return request(_0x8c97('0x37'),{'body':{'type':_0x12a7d0,'uniqueid':_0x26d5dc},'options':{'where':_0x51ee86}});};exports['agentUnpause']=function(_0x3cf202){return request('UnpauseUser',{'body':{},'options':{'where':_0x3cf202}});};exports['agentLogout']=function(_0x27f76d){return request(_0x8c97('0x38'),{'body':{},'options':{'where':_0x27f76d}});}; \ 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 271708c..96f2819 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 _0x1766=['./polly'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1766,0x17d));var _0x6176=function(_0x175b43,_0x61d0ba){_0x175b43=_0x175b43-0x0;var _0x51d690=_0x1766[_0x175b43];return _0x51d690;};var polly=require(_0x6176('0x0'));var lex=require('./lex');module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x1db9=['./lex','exports','./polly'];(function(_0x2b3442,_0x1a270d){var _0xfdcc5f=function(_0x54ad96){while(--_0x54ad96){_0x2b3442['push'](_0x2b3442['shift']());}};_0xfdcc5f(++_0x1a270d);}(_0x1db9,0x176));var _0x91db=function(_0x28811a,_0x47bb36){_0x28811a=_0x28811a-0x0;var _0x968c4=_0x1db9[_0x28811a];return _0x968c4;};var polly=require(_0x91db('0x0'));var lex=require(_0x91db('0x1'));module[_0x91db('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 6dfebe2..430f654 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 _0xb688=['exports'];(function(_0x361b6d,_0x1ca997){var _0x561256=function(_0x1646f9){while(--_0x1646f9){_0x361b6d['push'](_0x361b6d['shift']());}};_0x561256(++_0x1ca997);}(_0xb688,0xcf));var _0x8b68=function(_0x5a71f7,_0xac2c09){_0x5a71f7=_0x5a71f7-0x0;var _0x488687=_0xb688[_0x5a71f7];return _0x488687;};'use strict';var lex=require('./lib/api');module[_0x8b68('0x0')]=function(_0x196cec,_0x266285,_0x1080e8,_0x23bbaa,_0x446b17,_0x4e281c){return lex(_0x196cec,_0x266285,_0x1080e8,_0x23bbaa,_0x446b17,_0x4e281c);}; \ No newline at end of file +var _0xd64b=['./lib/api'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd64b,0xc1));var _0xbd64=function(_0x56dbbc,_0xcfd730){_0x56dbbc=_0x56dbbc-0x0;var _0x4617b4=_0xd64b[_0x56dbbc];return _0x4617b4;};'use strict';var lex=require(_0xbd64('0x0'));module['exports']=function(_0xf0de04,_0x4bfb7c,_0x30b9b3,_0xcbecd5,_0x64bd3b,_0x3f1f05){return lex(_0xf0de04,_0x4bfb7c,_0x30b9b3,_0xcbecd5,_0x64bd3b,_0x3f1f05);}; \ 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 2d0b278..4948467 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(_0x3a2323,_0x567d26){var _0x3bee6f=function(_0x43b20d){while(--_0x43b20d){_0x3a2323['push'](_0x3a2323['shift']());}};_0x3bee6f(++_0x567d26);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'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(_0x3ded59,_0x1ade22){var _0x3dd62f=function(_0x44fbec){while(--_0x44fbec){_0x3ded59['push'](_0x3ded59['shift']());}};_0x3dd62f(++_0x1ade22);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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 4cb43e4..ce243c8 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 _0xe2d8=['./lib/api','exports'];(function(_0x433d2a,_0x4bb957){var _0x1affe0=function(_0x120a25){while(--_0x120a25){_0x433d2a['push'](_0x433d2a['shift']());}};_0x1affe0(++_0x4bb957);}(_0xe2d8,0x14c));var _0x8e2d=function(_0x4c715a,_0x2d583d){_0x4c715a=_0x4c715a-0x0;var _0x5ceb9c=_0xe2d8[_0x4c715a];return _0x5ceb9c;};'use strict';var polly=require(_0x8e2d('0x0'));module[_0x8e2d('0x1')]=function(_0x2f82f8,_0xfb5e6f,_0x32a551,_0x5a7bc8,_0x19838e,_0x22d051,_0x4ac866){return polly(_0x2f82f8,_0xfb5e6f,_0x32a551,_0x5a7bc8,_0x19838e,_0x22d051,_0x4ac866);}; \ No newline at end of file +var _0xd1b8=['exports','./lib/api'];(function(_0x59eaf4,_0x35d037){var _0x2ae35a=function(_0x46b57a){while(--_0x46b57a){_0x59eaf4['push'](_0x59eaf4['shift']());}};_0x2ae35a(++_0x35d037);}(_0xd1b8,0x65));var _0x8d1b=function(_0x55ff79,_0x3d45e7){_0x55ff79=_0x55ff79-0x0;var _0x579067=_0xd1b8[_0x55ff79];return _0x579067;};'use strict';var polly=require(_0x8d1b('0x0'));module[_0x8d1b('0x1')]=function(_0x18fc05,_0x4b58a9,_0x522144,_0x37af2a,_0x3ec7a9,_0x25541c,_0x518f15){return polly(_0x18fc05,_0x4b58a9,_0x522144,_0x37af2a,_0x3ec7a9,_0x25541c,_0x518f15);}; \ 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 a30639e..89e22bf 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 _0x6310=['aws-sdk','synthesizeSpeech','writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','mp3','path','bluebird','randomstring'];(function(_0xd9dda1,_0x260e39){var _0x57b03b=function(_0x3fd947){while(--_0x3fd947){_0xd9dda1['push'](_0xd9dda1['shift']());}};_0x57b03b(++_0x260e39);}(_0x6310,0xb1));var _0x0631=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x6310[_0x27af45];return _0x18df21;};'use strict';var fs=require('fs');var path=require(_0x0631('0x0'));var BPromise=require(_0x0631('0x1'));var rs=require(_0x0631('0x2'));var AWS=require(_0x0631('0x3'));function pollyResult(_0x14d36c,_0x51284a,_0x25a32d){return new BPromise(function(_0x45f3a6,_0x126955){_0x14d36c[_0x0631('0x4')](_0x51284a,function(_0xfa62f9,_0x507d6b){if(_0xfa62f9){_0x126955(_0xfa62f9);}else if(_0x507d6b){if(_0x507d6b['AudioStream']instanceof Buffer){fs[_0x0631('0x5')](_0x25a32d,_0x507d6b[_0x0631('0x6')],function(_0x11a389){if(_0x11a389){_0x126955(_0x11a389);}else{_0x45f3a6();}});}else{_0x126955(new Error(_0x0631('0x7')));}}else{_0x126955(new Error(_0x0631('0x8')));}});});}module[_0x0631('0x9')]=function(_0x2120ff,_0x7f922,_0x4189cc,_0x2e90d1,_0xbaa78,_0x411c67,_0x189805){var _0x37c55a=new AWS[(_0x0631('0xa'))]({'accessKeyId':_0x2120ff,'secretAccessKey':_0x7f922,'region':_0x4189cc});var _0x378a55={'Text':_0xbaa78,'TextType':_0x411c67||'text','OutputFormat':_0x0631('0xb'),'VoiceId':_0x2e90d1};return pollyResult(_0x37c55a,_0x378a55,_0x189805);}; \ No newline at end of file +var _0x207e=['mp3','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text'];(function(_0x495fdf,_0x4880fa){var _0x2750ec=function(_0x142364){while(--_0x142364){_0x495fdf['push'](_0x495fdf['shift']());}};_0x2750ec(++_0x4880fa);}(_0x207e,0x85));var _0xe207=function(_0x5e0b55,_0x4b8070){_0x5e0b55=_0x5e0b55-0x0;var _0x18eace=_0x207e[_0x5e0b55];return _0x18eace;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0xe207('0x0'));var rs=require(_0xe207('0x1'));var AWS=require(_0xe207('0x2'));function pollyResult(_0x282dd8,_0x37f048,_0x79ee37){return new BPromise(function(_0x209210,_0x9196f3){_0x282dd8[_0xe207('0x3')](_0x37f048,function(_0x236bc1,_0x42a33b){if(_0x236bc1){_0x9196f3(_0x236bc1);}else if(_0x42a33b){if(_0x42a33b[_0xe207('0x4')]instanceof Buffer){fs[_0xe207('0x5')](_0x79ee37,_0x42a33b[_0xe207('0x4')],function(_0x1c734e){if(_0x1c734e){_0x9196f3(_0x1c734e);}else{_0x209210();}});}else{_0x9196f3(new Error(_0xe207('0x6')));}}else{_0x9196f3(new Error(_0xe207('0x7')));}});});}module[_0xe207('0x8')]=function(_0xf24ab5,_0x4f0273,_0x4d2fb5,_0x59b052,_0x418059,_0x22dc6e,_0x4007e2){var _0x1c51ae=new AWS[(_0xe207('0x9'))]({'accessKeyId':_0xf24ab5,'secretAccessKey':_0x4f0273,'region':_0x4d2fb5});var _0xdce985={'Text':_0x418059,'TextType':_0x22dc6e||_0xe207('0xa'),'OutputFormat':_0xe207('0xb'),'VoiceId':_0x59b052};return pollyResult(_0x1c51ae,_0xdce985,_0x4007e2);}; \ 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 f75a741..880876e 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 _0x210d=['./lib/api','exports'];(function(_0x49af52,_0x1ccd54){var _0x35b2af=function(_0x169cdb){while(--_0x169cdb){_0x49af52['push'](_0x49af52['shift']());}};_0x35b2af(++_0x1ccd54);}(_0x210d,0x12c));var _0xd210=function(_0x330414,_0x4f3207){_0x330414=_0x330414-0x0;var _0x99dbff=_0x210d[_0x330414];return _0x99dbff;};'use strict';var asr=require(_0xd210('0x0'));module[_0xd210('0x1')]=function(_0x37f62e,_0x1fdb37,_0xbe3470,_0x563ec2){return asr(_0x37f62e,_0x1fdb37,_0xbe3470);}; \ No newline at end of file +var _0x21e1=['exports'];(function(_0x359e3d,_0x2f6932){var _0x7c89c3=function(_0x18be1e){while(--_0x18be1e){_0x359e3d['push'](_0x359e3d['shift']());}};_0x7c89c3(++_0x2f6932);}(_0x21e1,0x15c));var _0x121e=function(_0x32c27b,_0x304cd2){_0x32c27b=_0x32c27b-0x0;var _0x52e86d=_0x21e1[_0x32c27b];return _0x52e86d;};'use strict';var asr=require('./lib/api');module[_0x121e('0x0')]=function(_0x4f0e56,_0x5cf79a,_0x20677c,_0x5bd03b){return asr(_0x4f0e56,_0x5cf79a,_0x20677c);}; \ 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 5816cb5..52d3fed 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 _0x803f=['/v1/speech:recognize?key=','8000','url','https://speech.googleapis.com','exports','length','filepath\x20should\x20be\x20a\x20string','string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','base64','POST'];(function(_0x1aaa52,_0x442418){var _0x1a3b6a=function(_0x4a168a){while(--_0x4a168a){_0x1aaa52['push'](_0x1aaa52['shift']());}};_0x1a3b6a(++_0x442418);}(_0x803f,0x64));var _0xf803=function(_0x2301f0,_0x5a4621){_0x2301f0=_0x2301f0-0x0;var _0x4db480=_0x803f[_0x2301f0];return _0x4db480;};'use strict';var url=require(_0xf803('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0xf803('0x1');module[_0xf803('0x2')]=function(_0x4ce875,_0x1a8691,_0x43fb3b){return new BPromise(function(_0x19ff73,_0x6baafe){var _0x5c2cd6;if(typeof _0x4ce875!=='string'||_0x4ce875[_0xf803('0x3')]===0x0){return _0x6baafe(_0xf803('0x4'));}if(typeof _0x1a8691!==_0xf803('0x5')||_0x1a8691['length']===0x0){return _0x6baafe(_0xf803('0x6'));}if(typeof _0x43fb3b!==_0xf803('0x7')&&(typeof _0x43fb3b!=='string'||_0x43fb3b[_0xf803('0x3')]===0x0)){return _0x6baafe(_0xf803('0x8'));}try{_0x5c2cd6=fs[_0xf803('0x9')](_0x4ce875)['toString'](_0xf803('0xa'));}catch(_0x5cd4b4){return _0x6baafe(_0x5cd4b4);}return _0x19ff73({'method':_0xf803('0xb'),'uri':host+_0xf803('0xc')+_0x1a8691,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0xf803('0xd'),'languageCode':_0x43fb3b},'audio':{'content':_0x5c2cd6}},'json':!![]});});}; \ No newline at end of file +var _0x3b75=['filepath\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','string','length'];(function(_0x225190,_0x5c58b5){var _0x17189f=function(_0x2b2b99){while(--_0x2b2b99){_0x225190['push'](_0x225190['shift']());}};_0x17189f(++_0x5c58b5);}(_0x3b75,0x144));var _0x53b7=function(_0x5d1044,_0x18f656){_0x5d1044=_0x5d1044-0x0;var _0x3cd90e=_0x3b75[_0x5d1044];return _0x3cd90e;};'use strict';var url=require(_0x53b7('0x0'));var BPromise=require(_0x53b7('0x1'));var fs=require('fs');var host=_0x53b7('0x2');module[_0x53b7('0x3')]=function(_0x3e6c49,_0x175c4e,_0x1925cd){return new BPromise(function(_0x145e6c,_0x5a0a4a){var _0x5c678a;if(typeof _0x3e6c49!==_0x53b7('0x4')||_0x3e6c49[_0x53b7('0x5')]===0x0){return _0x5a0a4a(_0x53b7('0x6'));}if(typeof _0x175c4e!==_0x53b7('0x4')||_0x175c4e['length']===0x0){return _0x5a0a4a('key\x20should\x20be\x20a\x20string');}if(typeof _0x1925cd!==_0x53b7('0x7')&&(typeof _0x1925cd!==_0x53b7('0x4')||_0x1925cd[_0x53b7('0x5')]===0x0)){return _0x5a0a4a(_0x53b7('0x8'));}try{_0x5c678a=fs[_0x53b7('0x9')](_0x3e6c49)['toString'](_0x53b7('0xa'));}catch(_0x41afe3){return _0x5a0a4a(_0x41afe3);}return _0x145e6c({'method':_0x53b7('0xb'),'uri':host+_0x53b7('0xc')+_0x175c4e,'body':{'config':{'encoding':_0x53b7('0xd'),'sampleRateHertz':_0x53b7('0xe'),'languageCode':_0x1925cd},'audio':{'content':_0x5c678a}},'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 10cb4be..105bc32 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 asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file +var _0x96ee=['exports','./asr'];(function(_0x5bb7f3,_0x123521){var _0x4b3349=function(_0x478cb4){while(--_0x478cb4){_0x5bb7f3['push'](_0x5bb7f3['shift']());}};_0x4b3349(++_0x123521);}(_0x96ee,0x1a5));var _0xe96e=function(_0x3cb872,_0x4b26e2){_0x3cb872=_0x3cb872-0x0;var _0x288d59=_0x96ee[_0x3cb872];return _0x288d59;};var asr=require(_0xe96e('0x0'));module[_0xe96e('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 ab42641..e94b17f 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 _0x8295=['.wav','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','stringify','null','generic','parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','writeFileSync','goggleTTS\x20path','googleASR','asr','uri','results','alternatives','transcript','map','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','textRequest','result','source','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','isFallbackIntent','replace','SessionsClient','sessionPath','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','languageCode','queryText','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','parse','nda','text','channelData','CustomAction','AudioFromTts','Data','audiofile','dirName','bluebird','dialogflow','http','https','md5','path','request-promise','randomstring','sox','url','util','./aws','./google','./sestek','./tilde','../../../config/logger','https://api.ispeech.org/api/rest','protocol','https:','get','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','info','finish\x20download\x20file','unlink','download\x20error','end','host','WHAT_EVER','data','transcode','wav','error\x20convert','start','resolve','generate','base64','then','chmodSync','777','split','readFileSync','toString','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','tmp','.mp3','from','audioContent','writeFile'];(function(_0x17521d,_0x5ee0ba){var _0x283d4f=function(_0x4fdad5){while(--_0x4fdad5){_0x17521d['push'](_0x17521d['shift']());}};_0x283d4f(++_0x5ee0ba);}(_0x8295,0xd0));var _0x5829=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x8295[_0x565c49];return _0x20ca34;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0x5829('0x0'));var dialogflow=require(_0x5829('0x1'));var fs=require('fs');var http=require(_0x5829('0x2'));var https=require(_0x5829('0x3'));var md5=require(_0x5829('0x4'));var path=require(_0x5829('0x5'));var querystring=require('querystring');var rp=require(_0x5829('0x6'));var rs=require(_0x5829('0x7'));var sox=require(_0x5829('0x8'));var tts=require('google-tts-api');var urlParse=require(_0x5829('0x9'))['parse'];var util=require(_0x5829('0xa'));var aws=require(_0x5829('0xb'));var google=require(_0x5829('0xc'));var sestek=require(_0x5829('0xd'));var tilde=require(_0x5829('0xe'));var logger=require(_0x5829('0xf'))('agi');var ISPEECH_API=_0x5829('0x10');function downloadFile(_0x3f3d5f,_0x4e35e6){return new BPromise(function(_0x153bb8,_0x52a335){var _0x11500e=urlParse(_0x3f3d5f);var _0x4cbe04=_0x11500e[_0x5829('0x11')]===_0x5829('0x12')?https:http;var _0x1d525a={'host':_0x11500e['host'],'path':_0x11500e[_0x5829('0x5')],'headers':{'user-agent':'WHAT_EVER'}};_0x4cbe04[_0x5829('0x13')](_0x1d525a,function(_0x5303ee){if(_0x5303ee['statusCode']!==0xc8){logger[_0x5829('0x14')](_0x5829('0x15')+_0x3f3d5f+_0x5829('0x16')+_0x5303ee[_0x5829('0x17')]+'\x20('+_0x5303ee[_0x5829('0x18')]+')');_0x52a335(new Error(_0x5829('0x15')+_0x3f3d5f+'\x20failed,\x20status\x20code\x20=\x20'+_0x5303ee['statusCode']+'\x20('+_0x5303ee[_0x5829('0x18')]+')'));return;}var _0x93fba7=fs[_0x5829('0x19')](_0x4e35e6);_0x93fba7['on']('finish',function(){logger[_0x5829('0x1a')](_0x5829('0x1b'));_0x93fba7['close'](_0x153bb8);});_0x93fba7['on']('error',function(_0x1f26ef){fs[_0x5829('0x1c')](_0x4e35e6);logger[_0x5829('0x14')](_0x5829('0x1d'),_0x1f26ef);_0x52a335(_0x1f26ef);});_0x5303ee['pipe'](_0x93fba7);})['on'](_0x5829('0x14'),function(_0x3bca2b){logger[_0x5829('0x14')](_0x3bca2b);_0x52a335(_0x3bca2b);})[_0x5829('0x1e')]();});}function uploadFile(_0x49a42b){return new BPromise(function(_0x373b6b,_0x471512){var _0x1a7941=urlParse(_0x49a42b);var _0x56fc59=_0x1a7941[_0x5829('0x11')]===_0x5829('0x12')?https:http;var _0xe84845={'host':_0x1a7941[_0x5829('0x1f')],'path':_0x1a7941[_0x5829('0x5')],'headers':{'user-agent':_0x5829('0x20')}};_0x56fc59[_0x5829('0x13')](_0xe84845,function(_0x44fc61){if(_0x44fc61[_0x5829('0x17')]!==0xc8){_0x471512(new Error('request\x20to\x20'+_0x49a42b+_0x5829('0x16')+_0x44fc61['statusCode']+'\x20('+_0x44fc61[_0x5829('0x18')]+')'));return;}var _0x4e9145='';_0x44fc61['on'](_0x5829('0x21'),function(_0x19132a){_0x4e9145+=_0x19132a;});_0x44fc61['on']('end',function(){_0x373b6b(_0x4e9145);});})['on'](_0x5829('0x14'),function(_0x427aa2){_0x471512(_0x427aa2);})[_0x5829('0x1e')]();});}function convertFile(_0x45b76e,_0x3c8a53){return new BPromise(function(_0x2bd4ce,_0x3c5f3f){var _0x2667b1=sox[_0x5829('0x22')](_0x45b76e,_0x3c8a53,{'sampleRate':0x1f40,'format':_0x5829('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2667b1['on'](_0x5829('0x14'),function(_0x192628){logger[_0x5829('0x14')](_0x5829('0x24'),_0x192628);_0x3c5f3f(_0x192628);});_0x2667b1['on'](_0x5829('0x1e'),function(){logger[_0x5829('0x1a')]('finish\x20to\x20convert');_0x2bd4ce();});_0x2667b1[_0x5829('0x25')]();});}function base64Decode(_0x2336ef,_0x5338b0){var _0x536ed2=path[_0x5829('0x26')](__dirname,'tmp',rs[_0x5829('0x27')](0x4)+'.wav');fs['writeFileSync'](_0x536ed2,_0x2336ef,_0x5829('0x28'));return convertFile(_0x536ed2,_0x5338b0)[_0x5829('0x29')](function(){try{fs[_0x5829('0x1c')](_0x536ed2);fs[_0x5829('0x2a')](_0x5338b0,_0x5829('0x2b'));}catch(_0x417640){logger['error'](_0x417640);}return _0x5338b0[_0x5829('0x2c')]('.')[0x0];});}function base64Encode(_0x30c01b){var _0xb663bf=fs[_0x5829('0x2d')](_0x30c01b);return new Buffer(_0xb663bf)[_0x5829('0x2e')](_0x5829('0x28'));}exports['googleCloudTTS']=function(_0x11e92f,_0x4256db,_0x5b057a,_0x52fb96,_0x2838df,_0x542bc5){var _0x54f6d3,_0x409ad3;var _0x3d3a0d=_0x5829('0x2f');var _0x2fdb52=_0x5829('0x30')+_0x11e92f;var _0x34542d={};if(_0x4256db===_0x5829('0x31')){_0x34542d['input']={'ssml':_0x5b057a};}else{_0x34542d[_0x5829('0x32')]={'text':_0x5b057a};};_0x34542d[_0x5829('0x33')]={'languageCode':_0x52fb96,'ssmlGender':_0x2838df};_0x34542d[_0x5829('0x34')]={'audioEncoding':_0x5829('0x35'),'sampleRateHertz':0x1f40};var _0xfec57b={'url':_0x3d3a0d+_0x5829('0x36')+_0x2fdb52,'method':'POST','json':!![],'body':_0x34542d};return rp(_0xfec57b)[_0x5829('0x29')](function(_0x129dec){return new BPromise(function(_0x4dc24f,_0x9ef7f5){_0x54f6d3=path['resolve'](__dirname,_0x5829('0x37'),rs[_0x5829('0x27')](0x4)+_0x5829('0x38'));var _0x211a4a=Buffer[_0x5829('0x39')](_0x129dec[_0x5829('0x3a')],'base64');return fs[_0x5829('0x3b')](_0x54f6d3,_0x211a4a,function(_0x1c9b8f){_0x9ef7f5(_0x1c9b8f);},function(_0x3f88ea){fs['chmodSync'](_0x54f6d3,_0x5829('0x2b'));_0x4dc24f(_0x3f88ea);});});})[_0x5829('0x29')](function(_0x23a030){_0x409ad3=path['resolve'](__dirname,_0x5829('0x37'),rs[_0x5829('0x27')](0x4)+_0x5829('0x3c'));return convertFile(_0x54f6d3,_0x409ad3);})[_0x5829('0x29')](function(){try{fs['unlink'](_0x54f6d3);fs['chmodSync'](_0x409ad3,'777');}catch(_0x2a8e53){logger['error'](_0x2a8e53);}logger['info'](_0x5829('0x3d'),_0x409ad3[_0x5829('0x2c')]('.')[0x0]);return _0x409ad3['split']('.')[0x0];});};exports['googleTTS']=function(_0x597036,_0x2f106f){var _0x2f68da=_0x5829('0x3e');var _0x103722,_0x43f06e;var _0x193de6;var _0x5ab0ff={'encoding':_0x5829('0x3f'),'method':'POST','timeout':0x2710,'url':_0x2f68da,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':'f.req='+encodeURIComponent(JSON[_0x5829('0x40')]([[['jQ1olc',JSON[_0x5829('0x40')]([_0x597036,_0x2f106f||'en',![],_0x5829('0x41')]),null,_0x5829('0x42')]]]))};return rp(_0x5ab0ff)['then'](function(_0x1b08f5){try{_0x193de6=eval(_0x1b08f5['slice'](0x5))[0x0][0x2];}catch(_0x3bc38b){throw new Error(_0x5829('0x43')+_0x1b08f5[_0x5829('0x21')]);}if(!_0x193de6){if(_0x597036['length']>0xc8){throw new Error(_0x5829('0x44'));}else{throw new Error(_0x5829('0x45')+_0x2f106f+_0x5829('0x46'));}}try{_0x193de6=eval(_0x193de6)[0x0];}catch(_0x509043){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x5829('0x21')]);}const _0x5c04b6=_0x193de6;_0x103722=path[_0x5829('0x26')](__dirname,_0x5829('0x37'),rs['generate'](0x4)+_0x5829('0x38'));fs[_0x5829('0x47')](_0x103722,_0x193de6,{'encoding':_0x5829('0x28')});_0x43f06e=path[_0x5829('0x26')](__dirname,_0x5829('0x37'),rs[_0x5829('0x27')](0x4)+_0x5829('0x3c'));return convertFile(_0x103722,_0x43f06e);})['then'](function(){try{fs[_0x5829('0x1c')](_0x103722);fs['chmodSync'](_0x43f06e,'777');}catch(_0xa5a872){logger['error'](_0xa5a872);}logger['info'](_0x5829('0x48'),_0x43f06e[_0x5829('0x2c')]('.')[0x0]);return _0x43f06e[_0x5829('0x2c')]('.')[0x0];});};exports[_0x5829('0x49')]=function(_0x2e6b1d,_0x53d48a,_0x49766e){return google[_0x5829('0x4a')](_0x2e6b1d,_0x53d48a,_0x49766e)['then'](function(_0x50b24c){logger[_0x5829('0x1a')](_0x50b24c[_0x5829('0x4b')]);return rp(_0x50b24c);})['then'](function(_0x54f922){var _0x1d4573='';var _0x57a6d5=0x0;try{fs[_0x5829('0x1c')](_0x2e6b1d);}catch(_0x309d8f){logger[_0x5829('0x14')](_0x309d8f);}if(_0x54f922&&_0x54f922[_0x5829('0x4c')]){_0x1d4573=_0x54f922['results']['map'](function(_0x328c07){return _0x328c07&&_0x328c07[_0x5829('0x4d')][0x0]&&_0x328c07[_0x5829('0x4d')][0x0][_0x5829('0x4e')]?_0x328c07[_0x5829('0x4d')][0x0][_0x5829('0x4e')]:'';})['join']('\x0a');_0x57a6d5=_0x54f922[_0x5829('0x4c')][_0x5829('0x4f')](function(_0x4b1d7e){return _0x4b1d7e&&_0x4b1d7e[_0x5829('0x4d')][0x0]&&_0x4b1d7e[_0x5829('0x4d')][0x0][_0x5829('0x50')]?_0x4b1d7e['alternatives'][0x0][_0x5829('0x50')]:0x0;})['join']('\x0a');}logger[_0x5829('0x1a')](_0x5829('0x51'),_0x1d4573);logger[_0x5829('0x1a')](_0x5829('0x52'),_0x57a6d5);return{'transcript':_0x1d4573,'confidence':_0x57a6d5};})[_0x5829('0x53')](function(_0x304ff1){logger[_0x5829('0x14')](_0x5829('0x54'),_0x304ff1[_0x5829('0x17')],_0x304ff1[_0x5829('0x55')],_0x304ff1['message']);});};exports['googleDialogflow']=function(_0x1cf8fd,_0x4c5aaa,_0xb82299,_0x38d6a6){var _0x159b28=apiai(_0x4c5aaa,{'language':_0x38d6a6||'en'});return _0x159b28[_0x5829('0x56')](_0xb82299,{'sessionId':md5(_0x1cf8fd)})[_0x5829('0x29')](function(_0x37b31b){logger['info'](JSON['stringify'](_0x37b31b));return{'source':_0x37b31b[_0x5829('0x57')][_0x5829('0x58')],'resolvedQuery':_0x37b31b[_0x5829('0x57')]['resolvedQuery'],'action':_0x37b31b[_0x5829('0x57')][_0x5829('0x59')],'actionIncomplete':_0x37b31b[_0x5829('0x57')][_0x5829('0x5a')],'speech':_0x37b31b[_0x5829('0x57')][_0x5829('0x5b')][_0x5829('0x5c')],'score':_0x37b31b[_0x5829('0x57')][_0x5829('0x5d')],'statusCode':_0x37b31b[_0x5829('0x5e')][_0x5829('0x5f')],'endConversation':_0x37b31b['result'][_0x5829('0x60')]['endConversation']||![],'isFallbackIntent':_0x37b31b[_0x5829('0x57')]['metadata'][_0x5829('0x61')]};});};exports['googleDialogflowV2']=function(_0x1685f6,_0x2da0ae,_0x5a4e4d,_0x52f5c6,_0x37cec8,_0x16a5af){var _0x56b1c4=_0x52f5c6[_0x5829('0x62')](/\\n/g,'\x0a');var _0x357159={'credentials':{'private_key':_0x56b1c4,'client_email':_0x5a4e4d}};var _0x1967a2=new dialogflow[(_0x5829('0x63'))](_0x357159);var _0x3025b0=_0x1967a2[_0x5829('0x64')](_0x2da0ae,md5(_0x1685f6));var _0x4a97c3={'session':_0x3025b0,'queryInput':{'text':{'text':_0x37cec8,'languageCode':_0x16a5af}}};return _0x1967a2['detectIntent'](_0x4a97c3)[_0x5829('0x29')](function(_0x3cc7ef){if(_0x3cc7ef&&_0x3cc7ef['length']){logger['info'](_0x5829('0x65'),JSON[_0x5829('0x40')](_0x3cc7ef));var _0x31fb59=_0x3cc7ef[0x0];if(_0x31fb59){var _0x5b940d={'action':_0x31fb59[_0x5829('0x66')]['action'],'allRequiredParamsPresent':_0x31fb59['queryResult'][_0x5829('0x67')],'endConversation':_0x31fb59[_0x5829('0x66')]['diagnosticInfo']&&_0x31fb59[_0x5829('0x66')][_0x5829('0x68')]['fields']?_0x31fb59[_0x5829('0x66')][_0x5829('0x68')][_0x5829('0x69')][_0x5829('0x6a')][_0x5829('0x6b')]:![],'fulfillmentText':_0x31fb59['queryResult'][_0x5829('0x6c')],'intentName':_0x31fb59[_0x5829('0x66')][_0x5829('0x6d')][_0x5829('0x55')],'intentDisplayName':_0x31fb59[_0x5829('0x66')][_0x5829('0x6d')][_0x5829('0x6e')],'isFallbackIntent':_0x31fb59[_0x5829('0x66')]['intent']['isFallback'],'languageCode':_0x31fb59['queryResult'][_0x5829('0x6f')],'queryText':_0x31fb59[_0x5829('0x66')][_0x5829('0x70')],'responseId':_0x31fb59['responseId'],'score':_0x31fb59['queryResult']['intentDetectionConfidence'],'speech':_0x31fb59[_0x5829('0x66')][_0x5829('0x6c')],'providerResponse':JSON['stringify'](_0x3cc7ef)};return _0x5b940d;}}});};exports['tildeASR']=function(_0x5252af,_0x10c05d,_0x36b1cc,_0x2a6552){return tilde[_0x5829('0x4a')](_0x5252af,_0x10c05d,_0x36b1cc,_0x2a6552)[_0x5829('0x29')](function(_0x7ab8ab){try{fs[_0x5829('0x1c')](_0x5252af);}catch(_0x573864){logger['error'](_0x573864);}logger['info'](_0x5829('0x71'),_0x7ab8ab[_0x5829('0x4e')]);logger[_0x5829('0x1a')](_0x5829('0x72'),_0x7ab8ab[_0x5829('0x50')]);return _0x7ab8ab;});};exports[_0x5829('0x73')]=function(_0x33c51f,_0x34d4f7,_0x22012f,_0x5ba90b,_0x45730e,_0x5ea28b){var _0xf6c08e=path[_0x5829('0x26')](__dirname,_0x5829('0x37'),rs[_0x5829('0x27')](0x4)+_0x5829('0x38'));var _0x26cb5f;return aws[_0x5829('0x74')](_0x33c51f,_0x34d4f7,_0x22012f,_0x5ba90b,_0x45730e,_0x5ea28b,_0xf6c08e)[_0x5829('0x29')](function(){_0x26cb5f=path['resolve'](__dirname,_0x5829('0x37'),rs[_0x5829('0x27')](0x4)+_0x5829('0x3c'));return convertFile(_0xf6c08e,_0x26cb5f);})[_0x5829('0x29')](function(){try{fs[_0x5829('0x1c')](_0xf6c08e);fs[_0x5829('0x2a')](_0x26cb5f,'777');}catch(_0x373ec6){logger[_0x5829('0x14')](_0x373ec6);}return _0x26cb5f[_0x5829('0x2c')]('.')[0x0];});};exports['awsLex']=function(_0xb8be1b,_0x2a0ce3,_0x1ec739,_0x58df3c,_0x2da6e2,_0x1c3eb4){return aws[_0x5829('0x75')](_0xb8be1b,_0x2a0ce3,_0x1ec739,_0x58df3c,_0x2da6e2,_0x1c3eb4)[_0x5829('0x29')](function(_0x59efcb){logger[_0x5829('0x1a')](JSON[_0x5829('0x40')](_0x59efcb));return _0x59efcb;});};exports[_0x5829('0x76')]=function(_0x4f85f9,_0x41c66d,_0x58b51f,_0x105ef7){var _0x1c5dc8=util['format'](_0x5829('0x77'),ISPEECH_API,_0x4f85f9,encodeURIComponent(_0x41c66d),_0x58b51f,_0x105ef7);var _0x4e284b=path[_0x5829('0x26')](__dirname,_0x5829('0x37'),rs[_0x5829('0x27')](0x4)+'.mp3');var _0x15af87;return downloadFile(_0x1c5dc8,_0x4e284b)[_0x5829('0x29')](function(){_0x15af87=path[_0x5829('0x26')](__dirname,_0x5829('0x37'),rs[_0x5829('0x27')](0x4)+'.wav');return convertFile(_0x4e284b,_0x15af87);})[_0x5829('0x29')](function(){try{fs[_0x5829('0x1c')](_0x4e284b);fs[_0x5829('0x2a')](_0x15af87,_0x5829('0x2b'));}catch(_0x1ac650){logger[_0x5829('0x14')](_0x1ac650);}return _0x15af87[_0x5829('0x2c')]('.')[0x0];});};exports[_0x5829('0x78')]=function(_0x68338f,_0x39fad0,_0x11c74f,_0x28cc5c){var _0x12c08c=util[_0x5829('0x79')](_0x5829('0x7a'),ISPEECH_API,_0x39fad0,_0x11c74f,base64Encode(_0x68338f),_0x28cc5c?util[_0x5829('0x79')](_0x5829('0x7b'),encodeURIComponent(_0x28cc5c)):_0x5829('0x7c'));return uploadFile(_0x12c08c)[_0x5829('0x29')](function(_0x5f31a9){return querystring[_0x5829('0x7d')](_0x5f31a9);});};exports['sestekNDA']=function(_0x440534,_0x35d57c){return sestek[_0x5829('0x7e')](_0x440534,_0x35d57c)[_0x5829('0x29')](function(_0x59f4d7){logger['info'](JSON[_0x5829('0x40')](_0x59f4d7));var _0x51495d={'speech':_0x59f4d7[_0x5829('0x7f')],'action':_0x59f4d7[_0x5829('0x80')]?_0x59f4d7[_0x5829('0x80')][_0x5829('0x81')]:undefined,'actiondata':_0x59f4d7[_0x5829('0x80')]?_0x59f4d7['channelData']['CustomActionData']:undefined};if(_0x59f4d7[_0x5829('0x80')]&&_0x59f4d7[_0x5829('0x80')][_0x5829('0x82')]){return base64Decode(_0x59f4d7['channelData'][_0x5829('0x82')][_0x5829('0x83')],path[_0x5829('0x26')](__dirname,_0x5829('0x37'),rs['generate'](0x4)+'.wav'))[_0x5829('0x29')](function(_0xbff310){_0x51495d[_0x5829('0x84')]=_0xbff310;return _0x51495d;});}return _0x51495d;});};exports[_0x5829('0x85')]=function(){return __dirname;}; \ No newline at end of file +var _0x5e4d=['apiai-promise','bluebird','dialogflow','http','path','querystring','request-promise','randomstring','sox','google-tts-api','parse','util','./aws','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','WHAT_EVER','get','statusCode','error','statusMessage','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish','info','unlink','pipe','end','https:','host','data','transcode','wav','error\x20convert','start','resolve','tmp','generate','writeFileSync','base64','chmodSync','777','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','then','from','googleCloudTTS\x20path','split','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','POST','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','.mp3','.wav','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','catch','name','message','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','speech','score','status','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','allRequiredParamsPresent','queryResult','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','intentDetectionConfidence','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName'];(function(_0x568ae6,_0x345916){var _0x427a6a=function(_0x3c22f5){while(--_0x3c22f5){_0x568ae6['push'](_0x568ae6['shift']());}};_0x427a6a(++_0x345916);}(_0x5e4d,0x11c));var _0xd5e4=function(_0x498246,_0x399ad8){_0x498246=_0x498246-0x0;var _0x41c5a4=_0x5e4d[_0x498246];return _0x41c5a4;};'use strict';var apiai=require(_0xd5e4('0x0'));var BPromise=require(_0xd5e4('0x1'));var dialogflow=require(_0xd5e4('0x2'));var fs=require('fs');var http=require(_0xd5e4('0x3'));var https=require('https');var md5=require('md5');var path=require(_0xd5e4('0x4'));var querystring=require(_0xd5e4('0x5'));var rp=require(_0xd5e4('0x6'));var rs=require(_0xd5e4('0x7'));var sox=require(_0xd5e4('0x8'));var tts=require(_0xd5e4('0x9'));var urlParse=require('url')[_0xd5e4('0xa')];var util=require(_0xd5e4('0xb'));var aws=require(_0xd5e4('0xc'));var google=require('./google');var sestek=require(_0xd5e4('0xd'));var tilde=require(_0xd5e4('0xe'));var logger=require(_0xd5e4('0xf'))(_0xd5e4('0x10'));var ISPEECH_API=_0xd5e4('0x11');function downloadFile(_0x26aaa8,_0x4418ee){return new BPromise(function(_0x386cf2,_0x5097f1){var _0x106535=urlParse(_0x26aaa8);var _0xbde78e=_0x106535[_0xd5e4('0x12')]==='https:'?https:http;var _0x4252e5={'host':_0x106535['host'],'path':_0x106535[_0xd5e4('0x4')],'headers':{'user-agent':_0xd5e4('0x13')}};_0xbde78e[_0xd5e4('0x14')](_0x4252e5,function(_0x5996bf){if(_0x5996bf[_0xd5e4('0x15')]!==0xc8){logger[_0xd5e4('0x16')]('request\x20to\x20'+_0x26aaa8+'\x20failed,\x20status\x20code\x20=\x20'+_0x5996bf['statusCode']+'\x20('+_0x5996bf[_0xd5e4('0x17')]+')');_0x5097f1(new Error(_0xd5e4('0x18')+_0x26aaa8+_0xd5e4('0x19')+_0x5996bf[_0xd5e4('0x15')]+'\x20('+_0x5996bf[_0xd5e4('0x17')]+')'));return;}var _0xbabd58=fs[_0xd5e4('0x1a')](_0x4418ee);_0xbabd58['on'](_0xd5e4('0x1b'),function(){logger[_0xd5e4('0x1c')]('finish\x20download\x20file');_0xbabd58['close'](_0x386cf2);});_0xbabd58['on'](_0xd5e4('0x16'),function(_0x1bcad9){fs[_0xd5e4('0x1d')](_0x4418ee);logger[_0xd5e4('0x16')]('download\x20error',_0x1bcad9);_0x5097f1(_0x1bcad9);});_0x5996bf[_0xd5e4('0x1e')](_0xbabd58);})['on'](_0xd5e4('0x16'),function(_0x145df7){logger[_0xd5e4('0x16')](_0x145df7);_0x5097f1(_0x145df7);})[_0xd5e4('0x1f')]();});}function uploadFile(_0x178277){return new BPromise(function(_0x7d3c72,_0x48b576){var _0x5404d1=urlParse(_0x178277);var _0x3b5918=_0x5404d1[_0xd5e4('0x12')]===_0xd5e4('0x20')?https:http;var _0xd0676={'host':_0x5404d1[_0xd5e4('0x21')],'path':_0x5404d1[_0xd5e4('0x4')],'headers':{'user-agent':_0xd5e4('0x13')}};_0x3b5918[_0xd5e4('0x14')](_0xd0676,function(_0x1c13c6){if(_0x1c13c6[_0xd5e4('0x15')]!==0xc8){_0x48b576(new Error(_0xd5e4('0x18')+_0x178277+'\x20failed,\x20status\x20code\x20=\x20'+_0x1c13c6[_0xd5e4('0x15')]+'\x20('+_0x1c13c6[_0xd5e4('0x17')]+')'));return;}var _0x2b02ad='';_0x1c13c6['on'](_0xd5e4('0x22'),function(_0x3079ab){_0x2b02ad+=_0x3079ab;});_0x1c13c6['on'](_0xd5e4('0x1f'),function(){_0x7d3c72(_0x2b02ad);});})['on'](_0xd5e4('0x16'),function(_0x55bab4){_0x48b576(_0x55bab4);})['end']();});}function convertFile(_0x48dfdb,_0x4f35f0){return new BPromise(function(_0x10a3ef,_0x4ec3e5){var _0x2e179e=sox[_0xd5e4('0x23')](_0x48dfdb,_0x4f35f0,{'sampleRate':0x1f40,'format':_0xd5e4('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2e179e['on'](_0xd5e4('0x16'),function(_0xa4767e){logger[_0xd5e4('0x16')](_0xd5e4('0x25'),_0xa4767e);_0x4ec3e5(_0xa4767e);});_0x2e179e['on'](_0xd5e4('0x1f'),function(){logger['info']('finish\x20to\x20convert');_0x10a3ef();});_0x2e179e[_0xd5e4('0x26')]();});}function base64Decode(_0x485acc,_0x59fb32){var _0x4be9cf=path[_0xd5e4('0x27')](__dirname,_0xd5e4('0x28'),rs[_0xd5e4('0x29')](0x4)+'.wav');fs[_0xd5e4('0x2a')](_0x4be9cf,_0x485acc,_0xd5e4('0x2b'));return convertFile(_0x4be9cf,_0x59fb32)['then'](function(){try{fs['unlink'](_0x4be9cf);fs[_0xd5e4('0x2c')](_0x59fb32,_0xd5e4('0x2d'));}catch(_0x2be086){logger[_0xd5e4('0x16')](_0x2be086);}return _0x59fb32['split']('.')[0x0];});}function base64Encode(_0x552e95){var _0xb682a8=fs[_0xd5e4('0x2e')](_0x552e95);return new Buffer(_0xb682a8)[_0xd5e4('0x2f')](_0xd5e4('0x2b'));}exports[_0xd5e4('0x30')]=function(_0x3c4839,_0x1de184,_0x2e8b1e,_0x5e7219,_0x13f5cf,_0x18106c){var _0x3da0e0,_0x5e3e73;var _0x221d07=_0xd5e4('0x31');var _0x40b396=_0xd5e4('0x32')+_0x3c4839;var _0x335237={};if(_0x1de184===_0xd5e4('0x33')){_0x335237[_0xd5e4('0x34')]={'ssml':_0x2e8b1e};}else{_0x335237['input']={'text':_0x2e8b1e};};_0x335237[_0xd5e4('0x35')]={'languageCode':_0x5e7219,'ssmlGender':_0x13f5cf};_0x335237[_0xd5e4('0x36')]={'audioEncoding':_0xd5e4('0x37'),'sampleRateHertz':0x1f40};var _0x385b05={'url':_0x221d07+_0xd5e4('0x38')+_0x40b396,'method':'POST','json':!![],'body':_0x335237};return rp(_0x385b05)[_0xd5e4('0x39')](function(_0x33dc7d){return new BPromise(function(_0x38bd9c,_0x551b28){_0x3da0e0=path[_0xd5e4('0x27')](__dirname,_0xd5e4('0x28'),rs[_0xd5e4('0x29')](0x4)+'.mp3');var _0xdf3934=Buffer[_0xd5e4('0x3a')](_0x33dc7d['audioContent'],_0xd5e4('0x2b'));return fs['writeFile'](_0x3da0e0,_0xdf3934,function(_0x798b9e){_0x551b28(_0x798b9e);},function(_0x326672){fs['chmodSync'](_0x3da0e0,_0xd5e4('0x2d'));_0x38bd9c(_0x326672);});});})[_0xd5e4('0x39')](function(_0x507b2c){_0x5e3e73=path[_0xd5e4('0x27')](__dirname,_0xd5e4('0x28'),rs[_0xd5e4('0x29')](0x4)+'.wav');return convertFile(_0x3da0e0,_0x5e3e73);})[_0xd5e4('0x39')](function(){try{fs[_0xd5e4('0x1d')](_0x3da0e0);fs['chmodSync'](_0x5e3e73,_0xd5e4('0x2d'));}catch(_0x51beae){logger[_0xd5e4('0x16')](_0x51beae);}logger['info'](_0xd5e4('0x3b'),_0x5e3e73['split']('.')[0x0]);return _0x5e3e73[_0xd5e4('0x3c')]('.')[0x0];});};exports[_0xd5e4('0x3d')]=function(_0x47d82c,_0x53c81f){var _0x184ad5=_0xd5e4('0x3e');var _0x31eeeb,_0x2a3d11;var _0x2f4506;var _0x2d8f41={'encoding':_0xd5e4('0x3f'),'method':_0xd5e4('0x40'),'timeout':0x2710,'url':_0x184ad5,'headers':{'Content-Type':_0xd5e4('0x41')},'body':_0xd5e4('0x42')+encodeURIComponent(JSON[_0xd5e4('0x43')]([[[_0xd5e4('0x44'),JSON[_0xd5e4('0x43')]([_0x47d82c,_0x53c81f||'en',![],_0xd5e4('0x45')]),null,_0xd5e4('0x46')]]]))};return rp(_0x2d8f41)[_0xd5e4('0x39')](function(_0x357424){try{_0x2f4506=eval(_0x357424['slice'](0x5))[0x0][0x2];}catch(_0x41e935){throw new Error(_0xd5e4('0x47')+_0x357424[_0xd5e4('0x22')]);}if(!_0x2f4506){if(_0x47d82c[_0xd5e4('0x48')]>0xc8){throw new Error(_0xd5e4('0x49'));}else{throw new Error('lang\x20\x22'+_0x53c81f+_0xd5e4('0x4a'));}}try{_0x2f4506=eval(_0x2f4506)[0x0];}catch(_0x553a93){throw new Error(_0xd5e4('0x47')+res[_0xd5e4('0x22')]);}const _0x31b12a=_0x2f4506;_0x31eeeb=path[_0xd5e4('0x27')](__dirname,_0xd5e4('0x28'),rs[_0xd5e4('0x29')](0x4)+_0xd5e4('0x4b'));fs[_0xd5e4('0x2a')](_0x31eeeb,_0x2f4506,{'encoding':_0xd5e4('0x2b')});_0x2a3d11=path[_0xd5e4('0x27')](__dirname,_0xd5e4('0x28'),rs[_0xd5e4('0x29')](0x4)+_0xd5e4('0x4c'));return convertFile(_0x31eeeb,_0x2a3d11);})['then'](function(){try{fs[_0xd5e4('0x1d')](_0x31eeeb);fs[_0xd5e4('0x2c')](_0x2a3d11,'777');}catch(_0x52885a){logger[_0xd5e4('0x16')](_0x52885a);}logger[_0xd5e4('0x1c')](_0xd5e4('0x4d'),_0x2a3d11['split']('.')[0x0]);return _0x2a3d11[_0xd5e4('0x3c')]('.')[0x0];});};exports[_0xd5e4('0x4e')]=function(_0x28eddb,_0x2052c6,_0x505319){return google[_0xd5e4('0x4f')](_0x28eddb,_0x2052c6,_0x505319)[_0xd5e4('0x39')](function(_0x3ad7c9){logger[_0xd5e4('0x1c')](_0x3ad7c9[_0xd5e4('0x50')]);return rp(_0x3ad7c9);})[_0xd5e4('0x39')](function(_0x484efe){var _0x43e32a='';var _0x26bfaf=0x0;try{fs[_0xd5e4('0x1d')](_0x28eddb);}catch(_0x47d25c){logger[_0xd5e4('0x16')](_0x47d25c);}if(_0x484efe&&_0x484efe[_0xd5e4('0x51')]){_0x43e32a=_0x484efe[_0xd5e4('0x51')][_0xd5e4('0x52')](function(_0x21c8be){return _0x21c8be&&_0x21c8be[_0xd5e4('0x53')][0x0]&&_0x21c8be['alternatives'][0x0][_0xd5e4('0x54')]?_0x21c8be['alternatives'][0x0][_0xd5e4('0x54')]:'';})[_0xd5e4('0x55')]('\x0a');_0x26bfaf=_0x484efe['results']['map'](function(_0x52245d){return _0x52245d&&_0x52245d[_0xd5e4('0x53')][0x0]&&_0x52245d[_0xd5e4('0x53')][0x0][_0xd5e4('0x56')]?_0x52245d[_0xd5e4('0x53')][0x0][_0xd5e4('0x56')]:0x0;})['join']('\x0a');}logger[_0xd5e4('0x1c')](_0xd5e4('0x57'),_0x43e32a);logger[_0xd5e4('0x1c')]('googleASR\x20confidence',_0x26bfaf);return{'transcript':_0x43e32a,'confidence':_0x26bfaf};})[_0xd5e4('0x58')](function(_0x29e8ec){logger['error']('[%s]\x20%s:%s',_0x29e8ec['statusCode'],_0x29e8ec[_0xd5e4('0x59')],_0x29e8ec[_0xd5e4('0x5a')]);});};exports[_0xd5e4('0x5b')]=function(_0x13268f,_0x4ef32c,_0x20fd6f,_0x2a2c20){var _0x4252fc=apiai(_0x4ef32c,{'language':_0x2a2c20||'en'});return _0x4252fc[_0xd5e4('0x5c')](_0x20fd6f,{'sessionId':md5(_0x13268f)})[_0xd5e4('0x39')](function(_0x5ce82){logger[_0xd5e4('0x1c')](JSON[_0xd5e4('0x43')](_0x5ce82));return{'source':_0x5ce82[_0xd5e4('0x5d')][_0xd5e4('0x5e')],'resolvedQuery':_0x5ce82[_0xd5e4('0x5d')][_0xd5e4('0x5f')],'action':_0x5ce82[_0xd5e4('0x5d')][_0xd5e4('0x60')],'actionIncomplete':_0x5ce82['result'][_0xd5e4('0x61')],'speech':_0x5ce82[_0xd5e4('0x5d')]['fulfillment'][_0xd5e4('0x62')],'score':_0x5ce82['result'][_0xd5e4('0x63')],'statusCode':_0x5ce82[_0xd5e4('0x64')]['code'],'endConversation':_0x5ce82['result'][_0xd5e4('0x65')][_0xd5e4('0x66')]||![],'isFallbackIntent':_0x5ce82[_0xd5e4('0x5d')]['metadata'][_0xd5e4('0x67')]};});};exports[_0xd5e4('0x68')]=function(_0x26f78e,_0x1e8203,_0x2a34fc,_0x1017a4,_0x2bb1ca,_0x4389c2){var _0x14bb5a=_0x1017a4[_0xd5e4('0x69')](/\\n/g,'\x0a');var _0x3c9e04={'credentials':{'private_key':_0x14bb5a,'client_email':_0x2a34fc}};var _0x5ea39f=new dialogflow[(_0xd5e4('0x6a'))](_0x3c9e04);var _0x48bf87=_0x5ea39f[_0xd5e4('0x6b')](_0x1e8203,md5(_0x26f78e));var _0x57839b={'session':_0x48bf87,'queryInput':{'text':{'text':_0x2bb1ca,'languageCode':_0x4389c2}}};return _0x5ea39f[_0xd5e4('0x6c')](_0x57839b)[_0xd5e4('0x39')](function(_0xc1fc22){if(_0xc1fc22&&_0xc1fc22[_0xd5e4('0x48')]){logger[_0xd5e4('0x1c')](_0xd5e4('0x6d'),JSON[_0xd5e4('0x43')](_0xc1fc22));var _0x3b2894=_0xc1fc22[0x0];if(_0x3b2894){var _0x19ed0d={'action':_0x3b2894['queryResult'][_0xd5e4('0x60')],'allRequiredParamsPresent':_0x3b2894['queryResult'][_0xd5e4('0x6e')],'endConversation':_0x3b2894['queryResult']['diagnosticInfo']&&_0x3b2894[_0xd5e4('0x6f')][_0xd5e4('0x70')][_0xd5e4('0x71')]?_0x3b2894[_0xd5e4('0x6f')][_0xd5e4('0x70')]['fields'][_0xd5e4('0x72')][_0xd5e4('0x73')]:![],'fulfillmentText':_0x3b2894[_0xd5e4('0x6f')][_0xd5e4('0x74')],'intentName':_0x3b2894['queryResult'][_0xd5e4('0x75')][_0xd5e4('0x59')],'intentDisplayName':_0x3b2894[_0xd5e4('0x6f')]['intent'][_0xd5e4('0x76')],'isFallbackIntent':_0x3b2894[_0xd5e4('0x6f')][_0xd5e4('0x75')][_0xd5e4('0x77')],'languageCode':_0x3b2894[_0xd5e4('0x6f')][_0xd5e4('0x78')],'queryText':_0x3b2894[_0xd5e4('0x6f')]['queryText'],'responseId':_0x3b2894['responseId'],'score':_0x3b2894[_0xd5e4('0x6f')][_0xd5e4('0x79')],'speech':_0x3b2894[_0xd5e4('0x6f')]['fulfillmentText'],'providerResponse':JSON[_0xd5e4('0x43')](_0xc1fc22)};return _0x19ed0d;}}});};exports['tildeASR']=function(_0xc5f024,_0xc5ff62,_0x2dba3a,_0xbf029){return tilde[_0xd5e4('0x4f')](_0xc5f024,_0xc5ff62,_0x2dba3a,_0xbf029)[_0xd5e4('0x39')](function(_0x92b37){try{fs[_0xd5e4('0x1d')](_0xc5f024);}catch(_0x4a4eab){logger['error'](_0x4a4eab);}logger[_0xd5e4('0x1c')](_0xd5e4('0x7a'),_0x92b37[_0xd5e4('0x54')]);logger['info'](_0xd5e4('0x7b'),_0x92b37[_0xd5e4('0x56')]);return _0x92b37;});};exports[_0xd5e4('0x7c')]=function(_0x2518fd,_0x155021,_0x3857d0,_0x1d30d7,_0x56b558,_0x62e085){var _0x1c4d80=path['resolve'](__dirname,_0xd5e4('0x28'),rs['generate'](0x4)+_0xd5e4('0x4b'));var _0x37d755;return aws[_0xd5e4('0x7d')](_0x2518fd,_0x155021,_0x3857d0,_0x1d30d7,_0x56b558,_0x62e085,_0x1c4d80)['then'](function(){_0x37d755=path[_0xd5e4('0x27')](__dirname,'tmp',rs[_0xd5e4('0x29')](0x4)+_0xd5e4('0x4c'));return convertFile(_0x1c4d80,_0x37d755);})['then'](function(){try{fs[_0xd5e4('0x1d')](_0x1c4d80);fs['chmodSync'](_0x37d755,_0xd5e4('0x2d'));}catch(_0x5420c5){logger[_0xd5e4('0x16')](_0x5420c5);}return _0x37d755[_0xd5e4('0x3c')]('.')[0x0];});};exports[_0xd5e4('0x7e')]=function(_0x561cbc,_0x5651c8,_0x8a81a2,_0xfac15c,_0x41a485,_0x5d4a90){return aws['lex'](_0x561cbc,_0x5651c8,_0x8a81a2,_0xfac15c,_0x41a485,_0x5d4a90)[_0xd5e4('0x39')](function(_0x1c74b9){logger[_0xd5e4('0x1c')](JSON[_0xd5e4('0x43')](_0x1c74b9));return _0x1c74b9;});};exports['ispeechTTS']=function(_0x225018,_0x2fd8fd,_0x2d604b,_0x4f4646){var _0x4959bf=util['format'](_0xd5e4('0x7f'),ISPEECH_API,_0x225018,encodeURIComponent(_0x2fd8fd),_0x2d604b,_0x4f4646);var _0x3c6390=path[_0xd5e4('0x27')](__dirname,_0xd5e4('0x28'),rs[_0xd5e4('0x29')](0x4)+'.mp3');var _0x551a29;return downloadFile(_0x4959bf,_0x3c6390)[_0xd5e4('0x39')](function(){_0x551a29=path[_0xd5e4('0x27')](__dirname,_0xd5e4('0x28'),rs[_0xd5e4('0x29')](0x4)+_0xd5e4('0x4c'));return convertFile(_0x3c6390,_0x551a29);})['then'](function(){try{fs[_0xd5e4('0x1d')](_0x3c6390);fs[_0xd5e4('0x2c')](_0x551a29,'777');}catch(_0x2326a6){logger[_0xd5e4('0x16')](_0x2326a6);}return _0x551a29[_0xd5e4('0x3c')]('.')[0x0];});};exports[_0xd5e4('0x80')]=function(_0x13920a,_0x49f265,_0x565ea1,_0x8bf947){var _0x19f72d=util[_0xd5e4('0x81')](_0xd5e4('0x82'),ISPEECH_API,_0x49f265,_0x565ea1,base64Encode(_0x13920a),_0x8bf947?util[_0xd5e4('0x81')](_0xd5e4('0x83'),encodeURIComponent(_0x8bf947)):'freeform=3');return uploadFile(_0x19f72d)['then'](function(_0x2e59ed){return querystring['parse'](_0x2e59ed);});};exports[_0xd5e4('0x84')]=function(_0x41c172,_0x1a21fb){return sestek[_0xd5e4('0x85')](_0x41c172,_0x1a21fb)[_0xd5e4('0x39')](function(_0x517546){logger[_0xd5e4('0x1c')](JSON['stringify'](_0x517546));var _0x2f478e={'speech':_0x517546[_0xd5e4('0x86')],'action':_0x517546[_0xd5e4('0x87')]?_0x517546[_0xd5e4('0x87')][_0xd5e4('0x88')]:undefined,'actiondata':_0x517546[_0xd5e4('0x87')]?_0x517546['channelData'][_0xd5e4('0x89')]:undefined};if(_0x517546[_0xd5e4('0x87')]&&_0x517546['channelData'][_0xd5e4('0x8a')]){return base64Decode(_0x517546[_0xd5e4('0x87')][_0xd5e4('0x8a')][_0xd5e4('0x8b')],path[_0xd5e4('0x27')](__dirname,_0xd5e4('0x28'),rs['generate'](0x4)+_0xd5e4('0x4c')))[_0xd5e4('0x39')](function(_0x112643){_0x2f478e[_0xd5e4('0x8c')]=_0x112643;return _0x2f478e;});}return _0x2f478e;});};exports[_0xd5e4('0x8d')]=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 97ea379..814f269 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 _0x9522=['exports'];(function(_0x33af94,_0x2744a7){var _0x34763e=function(_0x35654d){while(--_0x35654d){_0x33af94['push'](_0x33af94['shift']());}};_0x34763e(++_0x2744a7);}(_0x9522,0x126));var _0x2952=function(_0x438912,_0x3f7f74){_0x438912=_0x438912-0x0;var _0x18112f=_0x9522[_0x438912];return _0x18112f;};var nda=require('./nda');module[_0x2952('0x0')]={'nda':nda}; \ No newline at end of file +var _0x954a=['./nda','exports'];(function(_0x2a599f,_0x370600){var _0x2422eb=function(_0x2184d6){while(--_0x2184d6){_0x2a599f['push'](_0x2a599f['shift']());}};_0x2422eb(++_0x370600);}(_0x954a,0x104));var _0xa954=function(_0x1b2e8d,_0x317027){_0x1b2e8d=_0x1b2e8d-0x0;var _0x396f73=_0x954a[_0x1b2e8d];return _0x396f73;};var nda=require(_0xa954('0x0'));module[_0xa954('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 0cbfb94..a78686b 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 _0x4a3c=['exports','POST','ndauth_url','/token','password','username','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','../../../../../config/logger','agi'];(function(_0x3eb678,_0x3cd490){var _0x352b17=function(_0x1b6d68){while(--_0x1b6d68){_0x3eb678['push'](_0x3eb678['shift']());}};_0x352b17(++_0x3cd490);}(_0x4a3c,0x13c));var _0xc4a3=function(_0x42f676,_0x57b4e5){_0x42f676=_0x42f676-0x0;var _0x3a45fd=_0x4a3c[_0x42f676];return _0x3a45fd;};'use strict';var rp=require(_0xc4a3('0x0'));var url=require('url');var logger=require(_0xc4a3('0x1'))(_0xc4a3('0x2'));module[_0xc4a3('0x3')]=function(_0x132afa,_0x296209){var _0x123bc4={'method':_0xc4a3('0x4'),'uri':url['resolve'](_0x296209[_0xc4a3('0x5')],_0xc4a3('0x6')),'form':{'grant_type':_0xc4a3('0x7'),'username':_0x296209[_0xc4a3('0x8')],'password':_0x296209['password']},'json':!![]};return rp(_0x123bc4)['then'](function(_0x596b01){var _0xc11c29={'method':'POST','uri':url[_0xc4a3('0x9')](_0x296209[_0xc4a3('0xa')],_0xc4a3('0xb')),'body':{'type':_0x296209[_0xc4a3('0xc')]||_0xc4a3('0xd'),'channelId':_0xc4a3('0xe'),'conversation':{'id':_0x132afa[_0xc4a3('0xf')]},'from':{'id':_0x132afa['callerid'],'name':_0x132afa['calleridname']},'recipient':{'id':_0x132afa['dnid'],'name':_0x132afa['extension']},'text':_0x296209['text'],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x596b01['access_token']},'json':!![]};if(_0x296209[_0xc4a3('0x10')]){_0xc11c29[_0xc4a3('0x11')][_0xc4a3('0x12')][_0xc4a3('0x13')]=_0x296209['project'];}if(_0x296209[_0xc4a3('0x14')]=='1'){_0xc11c29[_0xc4a3('0x11')]['channelData'][_0xc4a3('0x15')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xc4a3('0x16')};}if(_0x296209[_0xc4a3('0x17')]){_0xc11c29[_0xc4a3('0x11')][_0xc4a3('0x12')][_0xc4a3('0x18')]=_0x296209[_0xc4a3('0x17')];if(_0x296209[_0xc4a3('0x19')]){_0xc11c29[_0xc4a3('0x11')]['channelData'][_0xc4a3('0x1a')]=_0x296209[_0xc4a3('0x19')];}}logger[_0xc4a3('0x1b')](JSON[_0xc4a3('0x1c')](_0xc11c29));return rp(_0xc11c29);});}; \ No newline at end of file +var _0xfa20=['extension','text','Bearer\x20','access_token','project','channelData','AudioOutputSettings','audio/wav','custom_action','body','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','callerid','calleridname','dnid'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfa20,0x141));var _0x0fa2=function(_0xf8a7cf,_0x1d008d){_0xf8a7cf=_0xf8a7cf-0x0;var _0x1cfe79=_0xfa20[_0xf8a7cf];return _0x1cfe79;};'use strict';var rp=require(_0x0fa2('0x0'));var url=require(_0x0fa2('0x1'));var logger=require(_0x0fa2('0x2'))(_0x0fa2('0x3'));module[_0x0fa2('0x4')]=function(_0x97b979,_0x10a7c4){var _0x40c116={'method':_0x0fa2('0x5'),'uri':url[_0x0fa2('0x6')](_0x10a7c4[_0x0fa2('0x7')],'/token'),'form':{'grant_type':_0x0fa2('0x8'),'username':_0x10a7c4[_0x0fa2('0x9')],'password':_0x10a7c4['password']},'json':!![]};return rp(_0x40c116)[_0x0fa2('0xa')](function(_0x3fde44){var _0x1f3223={'method':_0x0fa2('0x5'),'uri':url[_0x0fa2('0x6')](_0x10a7c4[_0x0fa2('0xb')],_0x0fa2('0xc')),'body':{'type':_0x10a7c4[_0x0fa2('0xd')]||_0x0fa2('0xe'),'channelId':_0x0fa2('0xf'),'conversation':{'id':_0x97b979['uniqueid']},'from':{'id':_0x97b979[_0x0fa2('0x10')],'name':_0x97b979[_0x0fa2('0x11')]},'recipient':{'id':_0x97b979[_0x0fa2('0x12')],'name':_0x97b979[_0x0fa2('0x13')]},'text':_0x10a7c4[_0x0fa2('0x14')],'channelData':{}},'headers':{'Authorization':_0x0fa2('0x15')+_0x3fde44[_0x0fa2('0x16')]},'json':!![]};if(_0x10a7c4[_0x0fa2('0x17')]){_0x1f3223['body'][_0x0fa2('0x18')]['ProjectName']=_0x10a7c4[_0x0fa2('0x17')];}if(_0x10a7c4['ndagenerate_audio']=='1'){_0x1f3223['body']['channelData'][_0x0fa2('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x0fa2('0x1a')};}if(_0x10a7c4[_0x0fa2('0x1b')]){_0x1f3223[_0x0fa2('0x1c')][_0x0fa2('0x18')][_0x0fa2('0x1d')]=_0x10a7c4[_0x0fa2('0x1b')];if(_0x10a7c4[_0x0fa2('0x1e')]){_0x1f3223['body'][_0x0fa2('0x18')][_0x0fa2('0x1f')]=_0x10a7c4[_0x0fa2('0x1e')];}}logger[_0x0fa2('0x20')](JSON[_0x0fa2('0x21')](_0x1f3223));return rp(_0x1f3223);});}; \ 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 c433ffd..b4d6a16 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 _0x87d0=['exports','./lib/api'];(function(_0xabe4cc,_0x23f307){var _0x4e5111=function(_0x22112d){while(--_0x22112d){_0xabe4cc['push'](_0xabe4cc['shift']());}};_0x4e5111(++_0x23f307);}(_0x87d0,0xbd));var _0x087d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x87d0[_0x14add3];return _0x4a174f;};'use strict';var asr=require(_0x087d('0x0'));module[_0x087d('0x1')]=function(_0x25d75a,_0x545b5f,_0x19a76e,_0x58f4d8){return asr(_0x25d75a,_0x545b5f,_0x19a76e,_0x58f4d8);}; \ No newline at end of file +var _0xbf43=['exports','./lib/api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbf43,0x105));var _0x3bf4=function(_0x153d97,_0x1a3fa3){_0x153d97=_0x153d97-0x0;var _0x94c7cc=_0xbf43[_0x153d97];return _0x94c7cc;};'use strict';var asr=require(_0x3bf4('0x0'));module[_0x3bf4('0x1')]=function(_0x3c8410,_0x4f055d,_0x4b1b59,_0x12f003){return asr(_0x3c8410,_0x4f055d,_0x4b1b59,_0x12f003);}; \ 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 a2d1996..e9fa45d 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 _0x97f3=['bluebird','lodash','moment','crypto','agi','exports','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','update','digest','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','info','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isObject','message'];(function(_0x3accf2,_0x248aa6){var _0x1b4ec8=function(_0x292294){while(--_0x292294){_0x3accf2['push'](_0x3accf2['shift']());}};_0x1b4ec8(++_0x248aa6);}(_0x97f3,0x118));var _0x397f=function(_0x3eb0b6,_0x2336a5){_0x3eb0b6=_0x3eb0b6-0x0;var _0x3d4dc6=_0x97f3[_0x3eb0b6];return _0x3d4dc6;};'use strict';var BPromise=require(_0x397f('0x0'));var _=require(_0x397f('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x397f('0x2'));var crypto=require(_0x397f('0x3'));var logger=require('../../../../../../config/logger')(_0x397f('0x4'));module[_0x397f('0x5')]=function(_0x5eca3f,_0xc9eced,_0x1158cd,_0x1df01e){return new BPromise(function(_0x322a07,_0x23ab31){logger['info']('Tilde\x20URI',_0x1df01e||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x553341=new WebSocket(_0x1df01e||_0x397f('0x6'),{'perMessageDeflate':![]});var _0x58d35a='';var _0x17e2ec='0';var _0x308ac5='1';var _0x4314d7=_0x397f('0x7');function _0x5ab223(_0x25e201){var _0x3e69f5=crypto[_0x397f('0x8')]('sha1');_0x3e69f5[_0x397f('0x9')](_0x25e201);return _0x3e69f5[_0x397f('0xa')]('hex');}function _0x4747a8(){try{logger['info'](_0x397f('0xb'));var _0x5ea1a0=moment()[_0x397f('0xc')]();var _0x11b985=_0x5ab223(_0x5ea1a0+_0xc9eced+_0x1158cd);_0x553341[_0x397f('0xd')](JSON[_0x397f('0xe')]({'appID':_0xc9eced,'timestamp':_0x5ea1a0,'appKey':_0x11b985}));var _0x184399=fs['createReadStream'](_0x5eca3f);_0x184399['on'](_0x397f('0xf'),function(_0x2d80a0){_0x553341['send'](_0x2d80a0);});_0x184399['on'](_0x397f('0x10'),function(){_0x553341[_0x397f('0xd')](_0x397f('0x11'));});}catch(_0x1cf49a){logger[_0x397f('0x12')](_0x397f('0x13'),JSON[_0x397f('0xe')](_0x1cf49a));_0x553341[_0x397f('0x14')]();}}function _0x2f549e(_0x4b7d2e){try{if(_0x4b7d2e){var _0x58e3ab=JSON['parse'](_0x4b7d2e);switch(_0x58e3ab['status']){case 0x0:if(_0x58e3ab[_0x397f('0x15')]){if(_0x58e3ab[_0x397f('0x15')][_0x397f('0x16')]){logger['info'](_0x397f('0x17'),JSON[_0x397f('0xe')](_0x58e3ab['result'][_0x397f('0x18')]));_0x58d35a=_0x58e3ab[_0x397f('0x15')][_0x397f('0x18')][0x0][_0x397f('0x19')];_0x17e2ec=_0x58e3ab[_0x397f('0x15')][_0x397f('0x18')][0x0]['likelihood'];_0x308ac5='0';_0x4314d7='Success.';_0x553341[_0x397f('0x14')]();}}break;case 0x1:logger[_0x397f('0x1a')](_0x397f('0x7'));_0x308ac5='1';_0x4314d7=_0x397f('0x7');break;case 0x2:logger[_0x397f('0x1a')](_0x397f('0x1b'));_0x308ac5='2';_0x4314d7=_0x397f('0x1b');break;case 0x9:logger[_0x397f('0x1a')](_0x397f('0x1c'));_0x308ac5='9';_0x4314d7=_0x397f('0x1c');break;case 0xa:logger[_0x397f('0x1a')]('Authentication\x20failed.');_0x308ac5='10';_0x4314d7=_0x397f('0x1d');break;case 0xb:logger[_0x397f('0x1a')](_0x397f('0x1e'));_0x308ac5='11';_0x4314d7=_0x397f('0x1e');}}}catch(_0x365d16){logger[_0x397f('0x12')](_0x397f('0x1f'),JSON[_0x397f('0xe')](_0x365d16));_0x553341[_0x397f('0x14')]();}}function _0xca588d(){logger[_0x397f('0x1a')]('Close\x20Tilde\x20ASR\x20socket');_0x322a07({'transcript':_0x58d35a,'confidence':_0x17e2ec,'status':_0x308ac5,'status_message':_0x4314d7});}function _0x10b27c(_0x4a1778){logger[_0x397f('0x12')](_0x397f('0x20'));if(!_['isNil'](_0x4a1778)){logger[_0x397f('0x12')](_[_0x397f('0x21')](_0x4a1778)?JSON['stringify'](_0x4a1778):_0x4a1778);}}_0x553341['on']('open',_0x4747a8);_0x553341['on'](_0x397f('0x22'),_0x2f549e);_0x553341['on'](_0x397f('0x10'),_0xca588d);_0x553341['on'](_0x397f('0x12'),_0x10b27c);});}; \ No newline at end of file +var _0x4806=['terminate','parse','status','result','Tilde\x20ASR\x20hypoteses','stringify','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.','error','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isNil','open','message','bluebird','lodash','crypto','../../../../../../config/logger','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','digest','hex','unix','send','createReadStream','close','EOS','Tilde\x20ASR\x20send\x20error'];(function(_0x34c431,_0x29cce7){var _0x1fa6f4=function(_0x3a9b37){while(--_0x3a9b37){_0x34c431['push'](_0x34c431['shift']());}};_0x1fa6f4(++_0x29cce7);}(_0x4806,0xcc));var _0x6480=function(_0x5764b7,_0x175003){_0x5764b7=_0x5764b7-0x0;var _0x50754c=_0x4806[_0x5764b7];return _0x50754c;};'use strict';var BPromise=require(_0x6480('0x0'));var _=require(_0x6480('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x6480('0x2'));var logger=require(_0x6480('0x3'))('agi');module[_0x6480('0x4')]=function(_0xba86d1,_0x92b719,_0x2f5dc4,_0x2436cf){return new BPromise(function(_0x9ef34f,_0xce98a7){logger[_0x6480('0x5')]('Tilde\x20URI',_0x2436cf||_0x6480('0x6'));var _0x36f1bf=new WebSocket(_0x2436cf||_0x6480('0x6'),{'perMessageDeflate':![]});var _0x384d46='';var _0x28aae7='0';var _0x62a18f='1';var _0x5e6439=_0x6480('0x7');function _0x180008(_0x5e171c){var _0x548668=crypto['createHash'](_0x6480('0x8'));_0x548668[_0x6480('0x9')](_0x5e171c);return _0x548668[_0x6480('0xa')](_0x6480('0xb'));}function _0x2c2b5b(){try{logger['info']('Open\x20Tilde\x20ASR\x20socket');var _0x58f78d=moment()[_0x6480('0xc')]();var _0x7e017=_0x180008(_0x58f78d+_0x92b719+_0x2f5dc4);_0x36f1bf[_0x6480('0xd')](JSON['stringify']({'appID':_0x92b719,'timestamp':_0x58f78d,'appKey':_0x7e017}));var _0x495883=fs[_0x6480('0xe')](_0xba86d1);_0x495883['on']('data',function(_0x40b87a){_0x36f1bf[_0x6480('0xd')](_0x40b87a);});_0x495883['on'](_0x6480('0xf'),function(){_0x36f1bf[_0x6480('0xd')](_0x6480('0x10'));});}catch(_0x3ba9f9){logger['error'](_0x6480('0x11'),JSON['stringify'](_0x3ba9f9));_0x36f1bf[_0x6480('0x12')]();}}function _0x477a09(_0x11779b){try{if(_0x11779b){var _0x31bfeb=JSON[_0x6480('0x13')](_0x11779b);switch(_0x31bfeb[_0x6480('0x14')]){case 0x0:if(_0x31bfeb[_0x6480('0x15')]){if(_0x31bfeb[_0x6480('0x15')]['final']){logger[_0x6480('0x5')](_0x6480('0x16'),JSON[_0x6480('0x17')](_0x31bfeb[_0x6480('0x15')]['hypotheses']));_0x384d46=_0x31bfeb[_0x6480('0x15')][_0x6480('0x18')][0x0][_0x6480('0x19')];_0x28aae7=_0x31bfeb[_0x6480('0x15')]['hypotheses'][0x0][_0x6480('0x1a')];_0x62a18f='0';_0x5e6439='Success.';_0x36f1bf[_0x6480('0x12')]();}}break;case 0x1:logger[_0x6480('0x5')](_0x6480('0x7'));_0x62a18f='1';_0x5e6439=_0x6480('0x7');break;case 0x2:logger[_0x6480('0x5')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x62a18f='2';_0x5e6439=_0x6480('0x1b');break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x62a18f='9';_0x5e6439=_0x6480('0x1c');break;case 0xa:logger[_0x6480('0x5')](_0x6480('0x1d'));_0x62a18f='10';_0x5e6439=_0x6480('0x1d');break;case 0xb:logger[_0x6480('0x5')](_0x6480('0x1e'));_0x62a18f='11';_0x5e6439=_0x6480('0x1e');}}}catch(_0x2bc2a7){logger[_0x6480('0x1f')](_0x6480('0x20'),JSON[_0x6480('0x17')](_0x2bc2a7));_0x36f1bf[_0x6480('0x12')]();}}function _0x1c3103(){logger['info'](_0x6480('0x21'));_0x9ef34f({'transcript':_0x384d46,'confidence':_0x28aae7,'status':_0x62a18f,'status_message':_0x5e6439});}function _0x38c279(_0x140acb){logger[_0x6480('0x1f')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x6480('0x22')](_0x140acb)){logger[_0x6480('0x1f')](_['isObject'](_0x140acb)?JSON[_0x6480('0x17')](_0x140acb):_0x140acb);}}_0x36f1bf['on'](_0x6480('0x23'),_0x2c2b5b);_0x36f1bf['on'](_0x6480('0x24'),_0x477a09);_0x36f1bf['on'](_0x6480('0xf'),_0x1c3103);_0x36f1bf['on'](_0x6480('0x1f'),_0x38c279);});}; \ 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 911a96a..d65e1ee 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 _0xe10e=['./asr','exports'];(function(_0x42efa7,_0x2d5d92){var _0x5d1b50=function(_0x4d29bf){while(--_0x4d29bf){_0x42efa7['push'](_0x42efa7['shift']());}};_0x5d1b50(++_0x2d5d92);}(_0xe10e,0x156));var _0xee10=function(_0x5436a1,_0x43ce08){_0x5436a1=_0x5436a1-0x0;var _0x46c586=_0xe10e[_0x5436a1];return _0x46c586;};var asr=require(_0xee10('0x0'));module[_0xee10('0x1')]={'asr':asr}; \ No newline at end of file +var _0x5c75=['./asr','exports'];(function(_0x30249b,_0x4968ef){var _0x3ba03d=function(_0x697d82){while(--_0x697d82){_0x30249b['push'](_0x30249b['shift']());}};_0x3ba03d(++_0x4968ef);}(_0x5c75,0x1d0));var _0x55c7=function(_0x3b04f3,_0x507854){_0x3b04f3=_0x3b04f3-0x0;var _0x2fbc54=_0x5c75[_0x3b04f3];return _0x2fbc54;};var asr=require(_0x55c7('0x0'));module[_0x55c7('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index cd543bc..f024e0e 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 _0x138d=['getTrunk','getTrunkById','getSoundPath','save_name','sendMailMessage','mailRpc','IntervalId','map','interval','format','%s/sounds/converted/%s','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','close','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','context','extension','dnid','createSquareMessage','createCmContact','isEmpty','callback_','random','isNil','lastName','phone','list_id','scheduledAt','callback','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogin','internal','LOCAL','shellCommand','exec','trim','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','audioEncoding','MP3','google_tts_language','restAPI','url','method','number','timeout','includes','POST','body','parse','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','options','googleDialogflow','dialogflow_language','googleDialogflowV2','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','key','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','Amy','aws_text_type','awsLex','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','isString','replaceAllVariables','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','toString','getAndSetVariable','result','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','RECOG_CONFIDENCE()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','agi','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','lumenvoxasr','MRCPRecog','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20query\x20configured','replace','query:\x20%s','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','%s[%s][%s]','%s_ROWS_COUNT','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','getUser','no\x20user\x20found','SIP/%s','opts','Executed\x20command\x20%s','DIAL','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','speech','out','dialogflow','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','DIALOGFLOW_%s','toUpperCase','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','password','no\x20password\x20configured','ndassistant_url','SESTEK_NDA_%s','audiofile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','no\x20file\x20audio\x20selected','getSound','file_id','no\x20file\x20audio\x20found','getData','response','test','mindigit','hiddendigitsnum','hiddendigitspos','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','GOAL\x20%s','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','NOBEEP','recordFile','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','beep','intKey','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','EVAL\x20CONDITION\x20%s\x20%s','false','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','getIntervals','no\x20intervals\x20found','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','toLowerCase','macro','gosub','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','\x22%s\x22\x20<%s>','email','user','bcc','debug','sendMail\x20message','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','getSmsAccount','sms_account_id','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','Enter\x20in\x20START\x20(%s)\x20block','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','getSquareProject','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','system','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','googleTTS','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','util','lodash','odbc','randomstring','moment','mustache','request-promise','../../config/logger','../../config/environment','../../config/environment/shared','./scripts','rawHeaders','rawBody','menu','rpc','getVariable','then','name','catch','prototype','getVoiceQueue','getVoiceQueueById','getSquareProjectById','getSquareOdbc','getSquareOdbcById'];(function(_0xc14df7,_0x163f90){var _0x34a445=function(_0x1bbf28){while(--_0x1bbf28){_0xc14df7['push'](_0xc14df7['shift']());}};_0x34a445(++_0x163f90);}(_0x138d,0x1ab));var _0xd138=function(_0x2d8f6c,_0x44db4c){_0x2d8f6c=_0x2d8f6c-0x0;var _0x3a00f6=_0x138d[_0x2d8f6c];return _0x3a00f6;};'use strict';var fs=require('fs');var util=require(_0xd138('0x0'));var _=require(_0xd138('0x1'));var sh=require('shelljs');var odbc=require(_0xd138('0x2'))();var rs=require(_0xd138('0x3'));var moment=require(_0xd138('0x4'));var Mustache=require(_0xd138('0x5'));var rp=require(_0xd138('0x6'));var logger=require(_0xd138('0x7'))('agi');var config=require(_0xd138('0x8'));var shared=require(_0xd138('0x9'));var scripts=require(_0xd138('0xa'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0xd138('0xb'),_0xd138('0xc')];var verticesWithRetry=[_0xd138('0xd'),'getdigits','getsecretdigits'];var AGIVertices=function(_0x10bdf3,_0x2137eb,_0x121cce){this['channel']=_0x10bdf3;this[_0xd138('0xe')]=_0x2137eb;this['mailRpc']=_0x121cce;};AGIVertices['prototype'][_0xd138('0xf')]=function(_0x765b1,_0x438504){this[_0xd138('0xe')]['getVariableById'](_0x765b1)[_0xd138('0x10')](function(_0x5361ec){_0x438504(null,_0x5361ec?_0x5361ec[_0xd138('0x11')]:![]);})[_0xd138('0x12')](function(_0x11ed68){_0x438504(_0x11ed68);});};AGIVertices[_0xd138('0x13')][_0xd138('0x14')]=function(_0x4339f0,_0x24f99){this[_0xd138('0xe')][_0xd138('0x15')](_0x4339f0)[_0xd138('0x10')](function(_0x44b99a){_0x24f99(null,_0x44b99a?_0x44b99a[_0xd138('0x11')]:![]);})['catch'](function(_0x1526e9){_0x24f99(_0x1526e9);});};AGIVertices[_0xd138('0x13')]['getSquareProject']=function(_0x5b67bf,_0x502d3b){this[_0xd138('0xe')][_0xd138('0x16')](_0x5b67bf)['then'](function(_0x43a67d){_0x502d3b(null,_0x43a67d?_0x43a67d[_0xd138('0x11')]:![]);})[_0xd138('0x12')](function(_0x4056d4){_0x502d3b(_0x4056d4);});};AGIVertices['prototype'][_0xd138('0x17')]=function(_0x36f021,_0x247254){this[_0xd138('0xe')][_0xd138('0x18')](_0x36f021)[_0xd138('0x10')](function(_0x1755e5){_0x247254(null,_0x1755e5?_0x1755e5['dsn']:![]);})[_0xd138('0x12')](function(_0x2a5bfb){_0x247254(_0x2a5bfb);});};AGIVertices['prototype']['getUser']=function(_0x20c57a,_0x5e0f89){this['rpc']['getUserById'](_0x20c57a)[_0xd138('0x10')](function(_0x1bc6ef){_0x5e0f89(null,_0x1bc6ef?_0x1bc6ef[_0xd138('0x11')]:![]);})[_0xd138('0x12')](function(_0x5bd0eb){_0x5e0f89(_0x5bd0eb);});};AGIVertices[_0xd138('0x13')][_0xd138('0x19')]=function(_0x3ed87c,_0x22afdc){this[_0xd138('0xe')][_0xd138('0x1a')](_0x3ed87c)[_0xd138('0x10')](function(_0x2dd210){_0x22afdc(null,_0x2dd210?_0x2dd210[_0xd138('0x11')]:![]);})[_0xd138('0x12')](function(_0x1d45b7){_0x22afdc(_0x1d45b7);});};AGIVertices[_0xd138('0x13')]['getSound']=function(_0x41370f,_0x550979){var _0x3003bb=this;this['rpc']['getSoundById'](_0x41370f)['then'](function(_0x15c73e){_0x550979(null,_0x15c73e?_0x3003bb[_0xd138('0x1b')](_0x15c73e[_0xd138('0x1c')]):![]);})[_0xd138('0x12')](function(_0x5d66e1){_0x550979(_0x5d66e1);});};AGIVertices[_0xd138('0x13')]['getMailAccount']=function(_0x355085,_0x2d60f4){this[_0xd138('0xe')]['getMailAccountById'](_0x355085)[_0xd138('0x10')](function(_0x219d07){_0x2d60f4(null,_0x219d07?_0x219d07:![]);})['catch'](function(_0x2dffcc){_0x2d60f4(_0x2dffcc);});};AGIVertices['prototype'][_0xd138('0x1d')]=function(_0x14e599,_0x896ee3,_0x108567){this[_0xd138('0x1e')][_0xd138('0x1d')](_0x14e599,_0x896ee3)['then'](function(){_0x108567(null);})[_0xd138('0x12')](function(_0x35cb59){_0x108567(_0x35cb59);});};AGIVertices[_0xd138('0x13')]['getIntervals']=function(_0x9bd5c,_0x5798f3){this[_0xd138('0xe')]['getIntervalById'](_0x9bd5c)[_0xd138('0x10')](function(_0xde9b2f){if(_0xde9b2f){if(_0xde9b2f[_0xd138('0x1f')]){_0x5798f3(null,[_0xde9b2f['interval']]);}else{_0x5798f3(null,_[_0xd138('0x20')](_0xde9b2f['Intervals'],_0xd138('0x21')));}}else{_0x5798f3(null,![]);}})[_0xd138('0x12')](function(_0x5a0b21){_0x5798f3(_0x5a0b21);});};AGIVertices['prototype'][_0xd138('0x1b')]=function(_0x584929){return util[_0xd138('0x22')](_0xd138('0x23'),FILES_PATH,_0x584929);};AGIVertices['prototype']['getQueryOdbc']=function(_0x47f545,_0x544cc9,_0x13f9fc){odbc['open'](_0x47f545,function(_0x1a3c43){if(_0x1a3c43){logger[_0xd138('0x24')](_0xd138('0x25'),_0x1a3c43);_0x13f9fc(_0x1a3c43);}else{logger[_0xd138('0x26')](_0xd138('0x27'));odbc[_0xd138('0x28')](_0x544cc9,function(_0x2372f9,_0x2da48f){if(_0x2372f9){logger['info']('Error\x20executing\x20query\x20%s',_0x544cc9);_0x13f9fc(_0x2372f9);}else{logger['info'](_0xd138('0x29'),_0x544cc9);odbc[_0xd138('0x2a')](function(_0x99a40e){if(_0x99a40e){logger[_0xd138('0x24')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x99a40e);}_0x13f9fc(null,_0x2da48f);});}});}});};AGIVertices[_0xd138('0x13')]['getSmsAccount']=function(_0x16680b,_0x4758ff){this[_0xd138('0xe')][_0xd138('0x2b')](_0x16680b)[_0xd138('0x10')](function(_0x429823){_0x4758ff(null,_0x429823?_0x429823:![]);})[_0xd138('0x12')](function(_0x346eeb){_0x4758ff(_0x346eeb);});};AGIVertices[_0xd138('0x13')]['createSmsMessage']=function(_0x2f7e05,_0x273136){this[_0xd138('0xe')][_0xd138('0x2c')](_0x2f7e05)[_0xd138('0x10')](function(_0x5d6eb9){_0x273136(null,_0x5d6eb9);})['catch'](function(_0x16c7e6){_0x273136(_0x16c7e6);});};AGIVertices[_0xd138('0x13')][_0xd138('0x2d')]=function(_0x95282e,_0xac08ed,_0x2ec5a0){this[_0xd138('0xe')][_0xd138('0x2d')]({'uniqueid':this[_0xd138('0x2e')][_0xd138('0x2f')],'node':_0x95282e[_0xd138('0x30')],'application':_0x95282e[_0xd138('0x31')],'data':_0xac08ed||null,'project_name':this['channel'][_0xd138('0x32')],'callerid':this[_0xd138('0x2e')][_0xd138('0x33')]})['then'](function(_0x19d804){if(_0x2ec5a0){_0x2ec5a0(null,_0x19d804);}})[_0xd138('0x12')](function(_0x2be7cf){if(_0x2ec5a0){_0x2ec5a0(_0x2be7cf);}});};AGIVertices[_0xd138('0x13')][_0xd138('0x34')]=function(_0x25430a,_0x4fae45,_0x54a80d,_0x275ed6){this['rpc'][_0xd138('0x34')]({'uniqueid':this['channel'][_0xd138('0x2f')],'callerid':this[_0xd138('0x2e')][_0xd138('0x33')],'calleridname':this['channel']['calleridname'],'context':this[_0xd138('0x2e')][_0xd138('0x35')],'extension':this[_0xd138('0x2e')][_0xd138('0x36')],'priority':this[_0xd138('0x2e')]['priority'],'accountcode':this['channel']['accountcode'],'dnid':this[_0xd138('0x2e')][_0xd138('0x37')],'projectName':this[_0xd138('0x2e')][_0xd138('0x32')],'saveName':_0x4fae45,'filename':_0x25430a['file']||_0x4fae45,'savePath':_0x54a80d})['then'](function(_0xd20679){_0x275ed6(null,_0xd20679);})[_0xd138('0x12')](function(_0x2ac4c5){_0x275ed6(_0x2ac4c5);});};AGIVertices[_0xd138('0x13')]['createSquareMessage']=function(_0x358b46,_0x1b63ea,_0x148299,_0x5a3327,_0x131df5){this[_0xd138('0xe')][_0xd138('0x38')]({'uniqueid':this['channel']['uniqueid'],'body':_0x358b46,'direction':_0x1b63ea,'providerName':_0x148299,'providerResponse':_0x5a3327})['then'](function(_0x295cfc){if(_0x131df5){_0x131df5(null,_0x295cfc);}})[_0xd138('0x12')](function(_0x41b163){if(_0x131df5){_0x131df5(_0x41b163);}});};AGIVertices[_0xd138('0x13')]['createCmContact']=function(_0x293baf,_0x15201a){this[_0xd138('0xe')][_0xd138('0x39')]({'firstName':_[_0xd138('0x3a')](_0x293baf['name'])||_['isNil'](_0x293baf[_0xd138('0x11')])?_0xd138('0x3b')+Math[_0xd138('0x3c')]():_0x293baf[_0xd138('0x11')],'lastName':_[_0xd138('0x3a')](_0x293baf['lastName'])||_[_0xd138('0x3d')](_0x293baf[_0xd138('0x3e')])?null:_0x293baf[_0xd138('0x3e')],'phone':_0x293baf[_0xd138('0x3f')],'ListId':_0x293baf[_0xd138('0x40')],'scheduledat':_0x293baf[_0xd138('0x41')],'callbackUniqueid':this[_0xd138('0x2e')][_0xd138('0x2f')],'tags':_0xd138('0x42'),'description':'Callback\x20scheduled\x20at\x20'+_0x293baf[_0xd138('0x41')]['toString'](),'priority':_0x293baf['callback_priority']})[_0xd138('0x10')](function(_0x594cc6){_0x15201a(null,_0x594cc6);})['catch'](function(_0x4f2c2a){_0x15201a(_0x4f2c2a);});};AGIVertices[_0xd138('0x13')][_0xd138('0x43')]=function(_0x5b752a,_0x815b0d){this[_0xd138('0xe')][_0xd138('0x44')](_0x5b752a)[_0xd138('0x10')](function(_0x11f66b){_0x815b0d(null,_0x11f66b?_0x11f66b[_0xd138('0x11')]:![]);})[_0xd138('0x12')](function(_0x33166d){_0x815b0d(_0x33166d);});};AGIVertices[_0xd138('0x13')][_0xd138('0x45')]=function(_0x547a08,_0xb43f59,_0x567f95){var _0x56f7f1={'role':_0xd138('0x46')};_0x56f7f1[_0x547a08]=this[_0xd138('0x2e')][_0xd138('0x33')];this[_0xd138('0xe')]['agentPause'](_0x56f7f1,_0xb43f59,this[_0xd138('0x2e')][_0xd138('0x2f')])['then'](function(_0x7bcbdd){_0x567f95(null,_['isNil'](_0x7bcbdd)?![]:!![]);})[_0xd138('0x12')](function(_0x4f18dc){logger[_0xd138('0x24')](_0x4f18dc);_0x567f95(null,![]);});};AGIVertices[_0xd138('0x13')][_0xd138('0x47')]=function(_0x1f9ca5,_0x3e23f1){var _0x1c7cf3={'role':_0xd138('0x46')};_0x1c7cf3[_0x1f9ca5]=this['channel'][_0xd138('0x33')];this[_0xd138('0xe')][_0xd138('0x47')](_0x1c7cf3)[_0xd138('0x10')](function(_0x11f7b0){_0x3e23f1(null,_[_0xd138('0x3d')](_0x11f7b0)?![]:!![]);})['catch'](function(_0x4a2e9d){logger['error'](_0x4a2e9d);_0x3e23f1(null,![]);});};AGIVertices[_0xd138('0x13')]['agentLogout']=function(_0x2bc85c,_0x22446b){var _0x472acb={'role':'agent'};_0x472acb[_0x2bc85c]=this[_0xd138('0x2e')]['callerid'];this[_0xd138('0xe')]['agentLogout'](_0x472acb)[_0xd138('0x10')](function(_0x15899f){_0x22446b(null,_[_0xd138('0x3d')](_0x15899f)?![]:!![]);})[_0xd138('0x12')](function(_0x42fc07){logger['error'](_0x42fc07);_0x22446b(null,![]);});};AGIVertices[_0xd138('0x13')][_0xd138('0x48')]=function(_0x55c768,_0x42b483){var _0x197fd4={'role':'agent'};_0x197fd4[_0x55c768]=this[_0xd138('0x2e')]['callerid'];var _0x41948f=_0x55c768!=_0xd138('0x49')?util[_0xd138('0x22')]('%s/%s@from-sip/n',_0xd138('0x4a'),this[_0xd138('0x2e')][_0xd138('0x33')]):undefined;this[_0xd138('0xe')][_0xd138('0x48')](_0x197fd4,_0x41948f)[_0xd138('0x10')](function(_0x37efce){_0x42b483(null,_[_0xd138('0x3d')](_0x37efce)?![]:!![]);})[_0xd138('0x12')](function(_0x447d84){logger[_0xd138('0x24')](_0x447d84);_0x42b483(null,![]);});};AGIVertices[_0xd138('0x13')][_0xd138('0x4b')]=function(_0x263208,_0xb549cf){sh[_0xd138('0x4c')](_[_0xd138('0x4d')](_0x263208),function(_0x4a16ab,_0x5bfe1d){var _0x1864bd=_0x5bfe1d['replace'](/(\r\n|\n|\r)/gm,'');_0xb549cf(null,_0x1864bd);});};AGIVertices[_0xd138('0x13')][_0xd138('0x4e')]=function(_0x15fc60,_0x2735dd){scripts[_0xd138('0x4e')](_0x15fc60[_0xd138('0x4f')],_0x15fc60[_0xd138('0x50')]||_0xd138('0x51'),_0x15fc60[_0xd138('0x51')],_0x15fc60[_0xd138('0x52')]||_0xd138('0x53'),_0x15fc60['ssmlGender']||'MALE',_0x15fc60[_0xd138('0x54')]||_0xd138('0x55'))[_0xd138('0x10')](function(_0x1e4ac2){_0x2735dd(null,_0x1e4ac2);})[_0xd138('0x12')](function(_0x3d3a47){_0x2735dd(_0x3d3a47);});};AGIVertices['prototype']['googleTTS']=function(_0x5d418f,_0x332cd6){scripts['googleTTS'](_0x5d418f[_0xd138('0x51')],_0x5d418f[_0xd138('0x56')]||'en',0x1)[_0xd138('0x10')](function(_0x27d24f){_0x332cd6(null,_0x27d24f);})[_0xd138('0x12')](function(_0x5e5c80){_0x332cd6(_0x5e5c80);});};AGIVertices[_0xd138('0x13')][_0xd138('0x57')]=function(_0x61ce05,_0x232c43){var _0x517da1={'uri':_0x61ce05[_0xd138('0x58')],'method':_0x61ce05[_0xd138('0x59')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x61ce05['timeout'])===_0xd138('0x5a')&&parseInt(_0x61ce05[_0xd138('0x5b')])>=0x1?parseInt(_0x61ce05[_0xd138('0x5b')])*0x3e8:0x5*0x3e8};if(_[_0xd138('0x5c')]([_0xd138('0x5d'),'PUT'],_0x517da1[_0xd138('0x59')]['toUpperCase']())){try{_0x517da1[_0xd138('0x5e')]=_0x61ce05['rawBody']?JSON[_0xd138('0x5f')](_0x61ce05[_0xd138('0xc')]):{};}catch(_0x5e43c9){logger[_0xd138('0x24')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x5e43c9);}}try{_0x517da1[_0xd138('0x60')]=_0x61ce05[_0xd138('0xb')]?JSON[_0xd138('0x5f')](_0x61ce05[_0xd138('0xb')]):{};}catch(_0x1f2ca1){logger[_0xd138('0x24')](_0xd138('0x61'),_0x1f2ca1);}if(_0x61ce05[_0xd138('0x62')]){try{var _0x8fa43a=require(_0x61ce05[_0xd138('0x62')])[_0xd138('0x63')](this,_0x517da1);_0x517da1[_0xd138('0x64')]=Mustache[_0xd138('0x65')](_0x61ce05['url'],_0x8fa43a,{},['$$','$$']);if(_0x517da1[_0xd138('0x60')]){_0x517da1[_0xd138('0x60')]=JSON[_0xd138('0x5f')](Mustache[_0xd138('0x65')](JSON[_0xd138('0x66')](_0x517da1['headers']),_0x8fa43a,{},['$$','$$']));}if(_0x517da1[_0xd138('0x5e')]){_0x517da1['body']=JSON['parse'](Mustache['render'](JSON['stringify'](_0x517da1['body']),_0x8fa43a,{},['$$','$$']));}}catch(_0x1c5878){logger[_0xd138('0x24')](_0xd138('0x67'),_0x1c5878);}}rp(_0x517da1)['then'](function(_0x2a7d40){var _0x393bb2={'statusCode':_0x2a7d40[_0xd138('0x68')]||0xc8,'statusMessage':_0x2a7d40[_0xd138('0x69')]||'OK','headers':_0x2a7d40[_0xd138('0x60')]||{},'body':_0x2a7d40[_0xd138('0x5e')]||{}};_0x232c43(null,_0x393bb2);})[_0xd138('0x12')](function(_0x5807e7){var _0xaffe24={'statusCode':_0x5807e7['statusCode']||0x1f4,'statusMessage':_0x5807e7[_0xd138('0x6a')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x5807e7[_0xd138('0x6b')]['headers']||{},'body':_0x5807e7[_0xd138('0x6b')][_0xd138('0x5e')]||{}};_0x232c43(null,_0xaffe24);});};AGIVertices[_0xd138('0x13')][_0xd138('0x6c')]=function(_0x1b5b6b,_0x220eee){scripts[_0xd138('0x6c')](this['channel']['uniqueid'],_0x1b5b6b['key'],_0x1b5b6b[_0xd138('0x51')],_0x1b5b6b[_0xd138('0x6d')]||'en')[_0xd138('0x10')](function(_0x3ee0f9){_0x220eee(null,_0x3ee0f9);})[_0xd138('0x12')](function(_0x5caabe){_0x220eee(_0x5caabe);});};AGIVertices[_0xd138('0x13')]['googleDialogflowV2']=function(_0x11d725,_0x181bf9){scripts[_0xd138('0x6e')](this['channel'][_0xd138('0x2f')],_0x11d725['dialogflowV2_project_id'],_0x11d725[_0xd138('0x6f')],_0x11d725[_0xd138('0x70')],_0x11d725[_0xd138('0x51')],_0x11d725[_0xd138('0x71')]||'en')[_0xd138('0x10')](function(_0x771e6b){_0x181bf9(null,_0x771e6b);})[_0xd138('0x12')](function(_0x1fe7eb){_0x181bf9(_0x1fe7eb);});};AGIVertices[_0xd138('0x13')]['sestekNDA']=function(_0x53a4e6,_0x491600){scripts[_0xd138('0x72')](this[_0xd138('0x2e')],_0x53a4e6)[_0xd138('0x10')](function(_0x3fbbe9){_0x491600(null,_0x3fbbe9);})[_0xd138('0x12')](function(_0x411cd7){_0x491600(_0x411cd7);});};AGIVertices[_0xd138('0x13')][_0xd138('0x73')]=function(_0x19490a,_0x1e9c02){scripts['ispeechTTS'](_0x19490a[_0xd138('0x74')],_0x19490a[_0xd138('0x51')],_0x19490a[_0xd138('0x75')]||'en-US',_0x19490a[_0xd138('0x76')])[_0xd138('0x10')](function(_0x193cc5){_0x1e9c02(null,_0x193cc5);})['catch'](function(_0x575323){_0x1e9c02(_0x575323);});};AGIVertices[_0xd138('0x13')][_0xd138('0x77')]=function(_0x2987e1,_0x930852,_0x2d8084){scripts['ispeechASR'](_0x930852,_0x2987e1[_0xd138('0x74')],_0x2987e1[_0xd138('0x78')]||_0xd138('0x53'),this[_0xd138('0x79')](_0x2987e1[_0xd138('0x7a')])?_0x2987e1[_0xd138('0x7a')]:undefined)[_0xd138('0x10')](function(_0x2c27af){_0x2d8084(null,_0x2c27af);})[_0xd138('0x12')](function(_0x2706a4){_0x2d8084(_0x2706a4);});};AGIVertices[_0xd138('0x13')][_0xd138('0x7b')]=function(_0x398b2e,_0x41dc75){scripts[_0xd138('0x7b')](_0x398b2e[_0xd138('0x7c')],_0x398b2e[_0xd138('0x7d')],_0x398b2e[_0xd138('0x7e')],_0x398b2e['aws_polly_voice']||_0xd138('0x7f'),_0x398b2e[_0xd138('0x51')],_0x398b2e[_0xd138('0x80')]||_0xd138('0x51'))[_0xd138('0x10')](function(_0x3c9e5f){_0x41dc75(null,_0x3c9e5f);})[_0xd138('0x12')](function(_0x449608){_0x41dc75(_0x449608);});};AGIVertices[_0xd138('0x13')][_0xd138('0x81')]=function(_0xdbde9c,_0x46e67d){scripts[_0xd138('0x81')](this[_0xd138('0x2e')][_0xd138('0x2f')],_0xdbde9c[_0xd138('0x7c')],_0xdbde9c['aws_secret_access_key'],_0xdbde9c['aws_lex_region'],_0xdbde9c[_0xd138('0x51')],_0xdbde9c['aws_bot_name'])[_0xd138('0x10')](function(_0x244284){_0x46e67d(null,_0x244284);})[_0xd138('0x12')](function(_0x9b0a4b){_0x46e67d(_0x9b0a4b);});};AGIVertices['prototype'][_0xd138('0x82')]=function(_0x524ef6,_0x190576,_0x3944f5){scripts[_0xd138('0x82')](_0x190576,_0x524ef6[_0xd138('0x74')],_0x524ef6[_0xd138('0x83')]||'en-US')[_0xd138('0x10')](function(_0xdd9b49){_0x3944f5(null,_0xdd9b49);})[_0xd138('0x12')](function(_0x17a8c4){_0x3944f5(_0x17a8c4);});};AGIVertices[_0xd138('0x13')][_0xd138('0x84')]=function(_0x3e595a,_0x140fa1,_0x4b3117){scripts['tildeASR'](_0x140fa1,_0x3e595a[_0xd138('0x85')],_0x3e595a[_0xd138('0x86')],_0x3e595a[_0xd138('0x64')])[_0xd138('0x10')](function(_0x168222){_0x4b3117(null,_0x168222);})[_0xd138('0x12')](function(_0x2e42c0){_0x4b3117(_0x2e42c0);});};AGIVertices[_0xd138('0x13')][_0xd138('0x87')]=function(_0x23dbe5){var _0x136b65=_['includes'](verticesWithRetry,_0x23dbe5['agicommand'])?_0x23dbe5:_[_0xd138('0x88')](_0x23dbe5);for(var _0x18a5cd in _0x136b65){if(_0x136b65[_0xd138('0x89')](_0x18a5cd)){if(_0x136b65[_0x18a5cd]&&_['isString'](_0x136b65[_0x18a5cd])){if(_[_0xd138('0x5c')](recursiveMapAttributes,_0x18a5cd)){_0x136b65[_0x18a5cd]=this[_0xd138('0x8a')](_0x136b65[_0x18a5cd]);}else{_0x136b65[_0x18a5cd]=this['replaceAllVariables'](_0x136b65[_0x18a5cd]);}}}}return _0x136b65;};AGIVertices[_0xd138('0x13')][_0xd138('0x8b')]=function(_0x256e7d){for(var _0x482bb3 in _0x256e7d){if(_0x256e7d['hasOwnProperty'](_0x482bb3)){if(_[_0xd138('0x8c')](_0x256e7d[_0x482bb3])){this['recursiveNodeIndex'](_0x256e7d[_0x482bb3]);}else if(_[_0xd138('0x8d')](_0x256e7d[_0x482bb3])){for(var _0x4632da=0x0;_0x4632da<_0x256e7d[_0x482bb3][_0xd138('0x8e')];_0x4632da++){this[_0xd138('0x8b')](_0x256e7d[_0x482bb3][_0x4632da]);}}else if(_[_0xd138('0x8f')](_0x256e7d[_0x482bb3])){_0x256e7d[_0x482bb3]=this[_0xd138('0x90')](_0x256e7d[_0x482bb3]);}}}};AGIVertices['prototype']['saveRestApiResult']=function(_0x159517,_0x5a8b10){for(var _0x4fe803 in _0x159517){if(_0x159517[_0xd138('0x89')](_0x4fe803)){if(_[_0xd138('0x8c')](_0x159517[_0x4fe803])){if(!_[_0xd138('0x3a')](_0x159517[_0x4fe803])){this[_0xd138('0x91')](_0x159517[_0x4fe803],util[_0xd138('0x22')](_0xd138('0x92'),_0x5a8b10,_0x4fe803));}}else if(_[_0xd138('0x8d')](_0x159517[_0x4fe803])){for(var _0x2727b7=0x0;_0x2727b7<_0x159517[_0x4fe803][_0xd138('0x8e')];_0x2727b7++){this[_0xd138('0x91')](_0x159517[_0x4fe803][_0x2727b7],util[_0xd138('0x22')](_0xd138('0x92'),_0x5a8b10,_0x4fe803+'['+_0x2727b7+']'));}}else{if(!_[_0xd138('0x3d')](_0x159517[_0x4fe803])){this[_0xd138('0x2e')][_0xd138('0x93')](util[_0xd138('0x22')]('%s.%s',_0x5a8b10,_0x4fe803),_0x159517[_0x4fe803]);}}}}};AGIVertices[_0xd138('0x13')][_0xd138('0x8a')]=function(_0x352457){try{var _0x110d65=JSON[_0xd138('0x5f')](_0x352457);this['recursiveNodeIndex'](_0x110d65);return JSON[_0xd138('0x66')](_0x110d65);}catch(_0x586d9c){return this['replaceAllVariables'](_0x352457);}};AGIVertices[_0xd138('0x13')][_0xd138('0x90')]=function(_0x5e33af){var _0x196472=_0x5e33af[_0xd138('0x94')]('{');for(var _0x1d9b1e=0x1;_0x1d9b1e<_0x196472[_0xd138('0x8e')];_0x1d9b1e+=0x1){var _0x54236e=_0x196472[_0x1d9b1e]['split']('}');if(_0x54236e[_0xd138('0x8e')]>0x1){_0x5e33af=_0x5e33af[_0xd138('0x95')]('{'+_0x54236e[0x0]+'}',this[_0xd138('0x2e')][_0xd138('0xf')](_0x54236e[0x0])[_0xd138('0x96')]||_0x54236e[0x0]);}}if(_0x196472[_0xd138('0x8e')]===0x1){return _0x5e33af[_0xd138('0x97')]();}return this[_0xd138('0x90')](_0x5e33af);};AGIVertices[_0xd138('0x13')][_0xd138('0x98')]=function(_0x392951,_0x1c54fd){var _0x48a1d6=this[_0xd138('0x2e')]['getVariable'](_0x392951);if(_0x48a1d6[_0xd138('0x99')]===-0x1){return _0x48a1d6;}logger[_0xd138('0x26')](util[_0xd138('0x22')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x1c54fd,_0x48a1d6['extra']));return this['channel']['setVariable'](_0x1c54fd,_0x48a1d6['extra']);};AGIVertices[_0xd138('0x13')][_0xd138('0x79')]=function(_0x286600){return _0x286600&&_0x286600!=='0'&&_0x286600!=='-1'&&_0x286600!=='';};AGIVertices[_0xd138('0x13')][_0xd138('0x9a')]=function(_0x339041){this[_0xd138('0x2d')][_0xd138('0x63')](this,_0x339041,'-');_0x339041['retry']=_0x339041[_0xd138('0x9a')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xd138('0x13')][_0xd138('0x9b')]=function(_0x59f833){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0x9c'),_0x59f833[_0xd138('0x30')]));if(!this['isConfigured'](_0x59f833[_0xd138('0x51')])){return this[_0xd138('0x2e')]['noop'](_0xd138('0x9d'));}var _0x102c0d='\x22'+_0x59f833[_0xd138('0x51')]+'\x22';if(this[_0xd138('0x79')](_0x59f833[_0xd138('0x6b')])){_0x102c0d+=','+_0x59f833['options'];}var _0x2f89eb=this[_0xd138('0x2e')][_0xd138('0x4c')](_0xd138('0x9e'),_0x102c0d);if(_0x2f89eb[_0xd138('0x99')]===-0x1){return _0x2f89eb;}return this[_0xd138('0x2e')][_0xd138('0x9f')](util['format'](_0xd138('0xa0'),_0x102c0d));};AGIVertices['prototype'][_0xd138('0xa1')]=function(_0x542881){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0xa2'),_0x542881[_0xd138('0x30')]));if(!this[_0xd138('0x79')](_0x542881[_0xd138('0xa3')])){return this['channel'][_0xd138('0x9f')](_0xd138('0xa4'));}var _0x32d0fe=_0x542881[_0xd138('0xa3')];if(this['isConfigured'](_0x542881[_0xd138('0x6b')])){_0x32d0fe+=','+_0x542881['options'];}var _0x1f4e4b=this[_0xd138('0x2e')][_0xd138('0x4c')]('MRCPRecog',_0x32d0fe);if(_0x1f4e4b[_0xd138('0x99')]===-0x1){return _0x1f4e4b;}var _0x344ef0=this[_0xd138('0x98')](_0xd138('0xa5'),'MRCP_RECOG_CONFIDENCE');if(_0x344ef0['result']===-0x1){return _0x344ef0;}var _0x549cfd=this[_0xd138('0x98')]('RECOG_INPUT()',_0xd138('0xa6'));if(_0x549cfd[_0xd138('0x99')]===-0x1){return _0x549cfd;}var _0x1b8cf2=this[_0xd138('0x98')](_0xd138('0xa7'),_0xd138('0xa8'));if(_0x1b8cf2[_0xd138('0x99')]===-0x1){return _0x1b8cf2;}return this['channel']['noop'](util[_0xd138('0x22')](_0xd138('0xa9'),_0x32d0fe));};AGIVertices[_0xd138('0x13')]['agi']=function(_0x4aa362){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0xaa'),_0x4aa362[_0xd138('0x30')]));return this[_0xd138('0x2e')][_0xd138('0xab')]([_0x4aa362[_0xd138('0xac')],_0x4aa362['args']]);};AGIVertices[_0xd138('0x13')][_0xd138('0xad')]=function(_0x324238){logger[_0xd138('0x26')](util['format'](_0xd138('0xae'),_0x324238[_0xd138('0x30')]));if(this['isConfigured'](_0x324238[_0xd138('0x5b')])){logger['info'](util[_0xd138('0x22')](_0xd138('0xaf'),_0x324238[_0xd138('0x5b')]));var _0x67c832=this[_0xd138('0x2e')][_0xd138('0xb0')](_0x324238[_0xd138('0x5b')]);if(_0x67c832[_0xd138('0x99')]===-0x1){return _0x67c832;}}return this[_0xd138('0x2e')][_0xd138('0xad')]();};AGIVertices[_0xd138('0x13')][_0xd138('0x42')]=function(_0x170394){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0xb1'),_0x170394[_0xd138('0x30')]));if(!this[_0xd138('0x79')](_0x170394[_0xd138('0x40')])){return this['channel'][_0xd138('0x24')](_0x170394,_0xd138('0xb2'));}_0x170394['scheduledAt']=moment();if(this[_0xd138('0x79')](_0x170394[_0xd138('0xb3')])){_0x170394['scheduledAt']=moment()[_0xd138('0xb4')](_0x170394[_0xd138('0xb3')],'minutes');}if(!this[_0xd138('0x79')](_0x170394[_0xd138('0xb5')])){_0x170394[_0xd138('0xb5')]=0x2;}this['createCmContact'][_0xd138('0x63')](this,_0x170394);return this[_0xd138('0x2e')]['noop'](util[_0xd138('0x22')](_0xd138('0xb6'),_0x170394[_0xd138('0x3f')],_0x170394[_0xd138('0x40')],_0x170394[_0xd138('0x41')]));};AGIVertices[_0xd138('0x13')]['custom_app']=function(_0x268efe){logger[_0xd138('0x26')](util['format']('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x268efe['label']));var _0x585d5c=this[_0xd138('0x2e')]['exec'](_0x268efe[_0xd138('0xb7')],_0x268efe[_0xd138('0x6b')]);if(_0x585d5c[_0xd138('0x99')]===-0x1){return _0x585d5c;}return this[_0xd138('0x2e')]['noop'](util[_0xd138('0x22')](_0xd138('0xb8'),_0x268efe['application'],_0x268efe[_0xd138('0x6b')]));};AGIVertices[_0xd138('0x13')][_0xd138('0xb9')]=function(_0x185719){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0xba'),_0x185719[_0xd138('0x30')]));if(!this[_0xd138('0x79')](_0x185719[_0xd138('0x51')])){return this[_0xd138('0x2e')][_0xd138('0x9f')]('no\x20text\x20configured');}var _0x4e2b7c='\x22'+_0x185719[_0xd138('0x51')]+'\x22';if(this[_0xd138('0x79')](_0x185719[_0xd138('0x6b')])){_0x4e2b7c+=','+_0x185719['options'];}var _0x14fdd3=this[_0xd138('0x2e')][_0xd138('0x4c')]('MRCPSynth',_0x4e2b7c);if(_0x14fdd3['result']===-0x1){return _0x14fdd3;}return this[_0xd138('0x2e')][_0xd138('0x9f')](util['format'](_0xd138('0xa0'),_0x4e2b7c));};AGIVertices[_0xd138('0x13')][_0xd138('0xbb')]=function(_0x5b848a){logger[_0xd138('0x26')](util[_0xd138('0x22')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x5b848a[_0xd138('0x30')]));if(!this[_0xd138('0x79')](_0x5b848a[_0xd138('0x51')])){return this[_0xd138('0x2e')][_0xd138('0x9f')](_0xd138('0x9d'));}var _0x2bf712='\x22'+_0x5b848a['text']+'\x22';if(this[_0xd138('0x79')](_0x5b848a[_0xd138('0x6b')])){_0x2bf712+=','+_0x5b848a[_0xd138('0x6b')];}var _0x5f4495=this['channel'][_0xd138('0x4c')](_0xd138('0x9e'),_0x2bf712);if(_0x5f4495['result']===-0x1){return _0x5f4495;}return this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')](_0xd138('0xa0'),_0x2bf712));};AGIVertices[_0xd138('0x13')][_0xd138('0xbc')]=function(_0x345a7e){logger['info'](util[_0xd138('0x22')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x345a7e['label']));if(!this[_0xd138('0x79')](_0x345a7e[_0xd138('0xa3')])){return this[_0xd138('0x2e')][_0xd138('0x9f')](_0xd138('0xa4'));}var _0x1a17e2=_0x345a7e[_0xd138('0xa3')];if(this['isConfigured'](_0x345a7e['options'])){_0x1a17e2+=','+_0x345a7e[_0xd138('0x6b')];}var _0x43c934=this[_0xd138('0x2e')][_0xd138('0x4c')](_0xd138('0xbd'),_0x1a17e2);if(_0x43c934[_0xd138('0x99')]===-0x1){return _0x43c934;}var _0x2abfb0=this[_0xd138('0x98')]('RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE');if(_0x2abfb0['result']===-0x1){return _0x2abfb0;}var _0x58829f=this[_0xd138('0x98')](_0xd138('0xbe'),_0xd138('0xbf'));if(_0x58829f[_0xd138('0x99')]===-0x1){return _0x58829f;}var _0x57bad0=this['getAndSetVariable']('RECOG_INSTANCE()',_0xd138('0xc0'));if(_0x57bad0[_0xd138('0x99')]===-0x1){return _0x57bad0;}return this[_0xd138('0x2e')]['noop'](util[_0xd138('0x22')](_0xd138('0xa9'),_0x1a17e2));};AGIVertices[_0xd138('0x13')][_0xd138('0xc1')]=function(_0x8483b2){logger[_0xd138('0x26')](util['format']('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x8483b2[_0xd138('0x30')]));if(!this[_0xd138('0x79')](_0x8483b2[_0xd138('0xa3')])){return this[_0xd138('0x2e')][_0xd138('0x9f')](_0xd138('0xa4'));}var _0x510614=_0x8483b2[_0xd138('0xa3')];if(this[_0xd138('0x79')](_0x8483b2['options'])){_0x510614+=','+_0x8483b2[_0xd138('0x6b')];}var _0xe42fad=this['channel'][_0xd138('0x4c')](_0xd138('0xbd'),_0x510614);if(_0xe42fad['result']===-0x1){return _0xe42fad;}var _0x47f056=this[_0xd138('0x98')]('RECOG_CONFIDENCE()',_0xd138('0xc2'));if(_0x47f056[_0xd138('0x99')]===-0x1){return _0x47f056;}var _0x152abe=this['getAndSetVariable']('RECOG_INPUT()',_0xd138('0xc3'));if(_0x152abe['result']===-0x1){return _0x152abe;}var _0x3e7d1b=this['getAndSetVariable'](_0xd138('0xa7'),_0xd138('0xc4'));if(_0x3e7d1b[_0xd138('0x99')]===-0x1){return _0x3e7d1b;}return this[_0xd138('0x2e')]['noop'](util[_0xd138('0x22')]('Executed\x20command\x20MRCPRecog\x20%s',_0x510614));};AGIVertices[_0xd138('0x13')][_0xd138('0xc5')]=function(_0x4d84d9){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0xc6'),_0x4d84d9[_0xd138('0x30')]));if(!this['isConfigured'](_0x4d84d9[_0xd138('0xc7')])){return this[_0xd138('0x2e')]['error'](_0x4d84d9,_0xd138('0xc8'));}var _0x227ff3=this['getSquareOdbc'][_0xd138('0x63')](this,_0x4d84d9['odbc_id']);if(!_0x227ff3){return this[_0xd138('0x2e')][_0xd138('0x24')](_0x4d84d9,'no\x20odbc\x20database\x20found');}if(!this[_0xd138('0x79')](_0x4d84d9[_0xd138('0x28')])){return this[_0xd138('0x2e')][_0xd138('0x24')](_0x4d84d9,_0xd138('0xc9'));}var _0x3cccf1=_0x4d84d9[_0xd138('0x28')][_0xd138('0xca')](/(\r\n|\n|\r)/gm,'\x20');this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')](_0xd138('0xcb'),_0x3cccf1));var _0xab98ad=this[_0xd138('0xcc')][_0xd138('0x63')](this,_0x227ff3,_0x3cccf1);this[_0xd138('0x2d')][_0xd138('0x63')](this,_0x4d84d9,_0x3cccf1);if(!this[_0xd138('0x79')](_0x4d84d9[_0xd138('0xcd')])){return this[_0xd138('0x2e')][_0xd138('0x9f')](_0xd138('0xce'));}var _0x5c16dc=this[_0xd138('0xf')][_0xd138('0x63')](this,_0x4d84d9[_0xd138('0xcd')]);if(!_0x5c16dc){return this['channel']['error'](_0x4d84d9,_0xd138('0xcf'));}var _0xceb2a8=this;_0xab98ad['forEach'](function(_0x1d6414,_0x1fcee8){Object['keys'](_0x1d6414)[_0xd138('0xd0')](function(_0x3b1ce1){_0xceb2a8[_0xd138('0x2e')][_0xd138('0x93')](util['format'](_0xd138('0xd1'),_0x5c16dc,_0x1fcee8,_0x3b1ce1),_0x1d6414[_0x3b1ce1]);});});this[_0xd138('0x2e')]['setVariable'](util[_0xd138('0x22')](_0xd138('0xd2'),_0x5c16dc),_0xab98ad[_0xd138('0x8e')]);return this['channel'][_0xd138('0x9f')](util[_0xd138('0x22')]('variable\x20%s\x20set',_0x5c16dc));};AGIVertices[_0xd138('0x13')]['dial']=function(_0x452626){logger['debug'](util['format'](_0xd138('0xd3'),_0x452626['label']));if(!this[_0xd138('0x79')](_0x452626[_0xd138('0xd4')])){return this[_0xd138('0x2e')][_0xd138('0x24')](_0x452626,'no\x20user\x20selected');}var _0x31b439=this[_0xd138('0xd5')][_0xd138('0x63')](this,_0x452626['sip_id']);if(!_0x31b439){return this[_0xd138('0x2e')][_0xd138('0x24')](_0x452626,_0xd138('0xd6'));}var _0x355fd5=this[_0xd138('0x2e')][_0xd138('0x4c')]('DIAL',[util[_0xd138('0x22')](_0xd138('0xd7'),_0x31b439),_0x452626[_0xd138('0x5b')],_0x452626[_0xd138('0xd8')],_0x452626[_0xd138('0x58')]]);if(_0x355fd5[_0xd138('0x99')]===-0x1){return _0x355fd5;}return this[_0xd138('0x2e')][_0xd138('0x9f')](util['format'](_0xd138('0xd9'),_0xd138('0xda')));};AGIVertices[_0xd138('0x13')]['dialogflow']=function(_0x463032){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0xdb'),_0x463032[_0xd138('0x30')]));if(!this[_0xd138('0x79')](_0x463032[_0xd138('0x74')])){return this[_0xd138('0x2e')][_0xd138('0x9f')](_0xd138('0xdc'));}if(!this[_0xd138('0x79')](_0x463032[_0xd138('0x51')])){return this[_0xd138('0x2e')][_0xd138('0x9f')](_0xd138('0x9d'));}this[_0xd138('0x2e')][_0xd138('0xdd')]=!![];this['createSquareDetailsReport'](_0x463032);this[_0xd138('0x38')](_0x463032[_0xd138('0x51')],'in','','');this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')](_0xd138('0xde'),_0x463032[_0xd138('0x51')]));var _0x54b777=this[_0xd138('0x6c')][_0xd138('0x63')](this,_0x463032);if(_0x54b777){for(var _0x198baf in _0x54b777){if(_0x54b777[_0xd138('0x89')](_0x198baf)){this[_0xd138('0x2e')]['setVariable'](util[_0xd138('0x22')]('DIALOGFLOW_%s',_0x198baf['toUpperCase']()),_0x54b777[_0x198baf]);}}this[_0xd138('0x38')](_0x54b777[_0xd138('0xdf')],_0xd138('0xe0'),_0xd138('0xe1'),'');return this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')]('Dialogflow\x20Result\x20%s',_0x54b777[_0xd138('0xdf')]));}return this[_0xd138('0x2e')][_0xd138('0x24')](_0x463032,_0xd138('0xe2'));};AGIVertices['prototype'][_0xd138('0xe3')]=function(_0x4ca290){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0xe4'),_0x4ca290[_0xd138('0x30')]));if(!this[_0xd138('0x79')](_0x4ca290['dialogflowV2_project_id'])){return this['channel'][_0xd138('0x9f')]('no\x20project_id\x20configured');}if(!this[_0xd138('0x79')](_0x4ca290['client_email'])){return this['channel'][_0xd138('0x9f')]('no\x20client_email\x20configured');}if(!this[_0xd138('0x79')](_0x4ca290[_0xd138('0x70')])){return this[_0xd138('0x2e')][_0xd138('0x9f')](_0xd138('0xe5'));}if(!this[_0xd138('0x79')](_0x4ca290[_0xd138('0x71')])){return this[_0xd138('0x2e')][_0xd138('0x9f')](_0xd138('0xe6'));}if(!this['isConfigured'](_0x4ca290[_0xd138('0x51')])){return this[_0xd138('0x2e')][_0xd138('0x9f')](_0xd138('0x9d'));}this[_0xd138('0x2e')][_0xd138('0xdd')]=!![];this[_0xd138('0x2d')](_0x4ca290);this[_0xd138('0x38')](_0x4ca290[_0xd138('0x51')],'in','','');this[_0xd138('0x2e')]['noop'](util[_0xd138('0x22')](_0xd138('0xe7'),_0x4ca290[_0xd138('0x51')]));var _0x214720=this['googleDialogflowV2'][_0xd138('0x63')](this,_0x4ca290);if(_0x214720){for(var _0x29c649 in _0x214720){if(_0x214720[_0xd138('0x89')](_0x29c649)){if(_0x29c649!=='providerResponse'){this[_0xd138('0x2e')][_0xd138('0x93')](util[_0xd138('0x22')](_0xd138('0xe8'),_0x29c649[_0xd138('0xe9')]()),_0x214720[_0x29c649]);}}}this['createSquareMessage'](_0x214720[_0xd138('0xdf')],_0xd138('0xe0'),_0xd138('0xe3'),_0x214720[_0xd138('0xea')]);return this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')](_0xd138('0xeb'),_0x214720[_0xd138('0xdf')]));}return this[_0xd138('0x2e')][_0xd138('0x24')](_0x4ca290,_0xd138('0xec'));};AGIVertices['prototype'][_0xd138('0xed')]=function(_0x5af16d){logger[_0xd138('0x26')](util['format'](_0xd138('0xee'),_0x5af16d[_0xd138('0x30')]));if(!this['isConfigured'](_0x5af16d[_0xd138('0xef')])){return this['channel'][_0xd138('0x9f')](_0xd138('0xf0'));}if(!this[_0xd138('0x79')](_0x5af16d['username'])){return this[_0xd138('0x2e')]['noop']('no\x20username\x20configured');}if(!this[_0xd138('0x79')](_0x5af16d[_0xd138('0xf1')])){return this[_0xd138('0x2e')][_0xd138('0x9f')](_0xd138('0xf2'));}if(!this['isConfigured'](_0x5af16d[_0xd138('0xf3')])){return this[_0xd138('0x2e')]['noop'](_0xd138('0x9d'));}this[_0xd138('0x2e')][_0xd138('0xdd')]=!![];this[_0xd138('0x2d')](_0x5af16d);this['createSquareMessage'](_0x5af16d['text'],'in','','');this[_0xd138('0x2e')]['noop'](util[_0xd138('0x22')]('Trying\x20SestekNDA:\x20%s',_0x5af16d[_0xd138('0x51')]));var _0x48ca9c=this[_0xd138('0x72')]['sync'](this,_0x5af16d);if(_0x48ca9c){for(var _0x11fe66 in _0x48ca9c){if(_0x48ca9c[_0xd138('0x89')](_0x11fe66)){this[_0xd138('0x2e')][_0xd138('0x93')](util['format'](_0xd138('0xf4'),_0x11fe66[_0xd138('0xe9')]()),_0x48ca9c[_0x11fe66]);}}this[_0xd138('0x38')](_0x48ca9c[_0xd138('0xdf')],_0xd138('0xe0'),_0xd138('0xed'),'');if(_0x48ca9c['audiofile']){this[_0xd138('0x2e')]['noop'](util[_0xd138('0x22')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x48ca9c[_0xd138('0xf5')]));var _0x1d39f1=this[_0xd138('0x2e')]['streamFile'](_0x48ca9c['audiofile']);try{fs[_0xd138('0xf6')](_0x48ca9c[_0xd138('0xf5')]+_0xd138('0xf7'));}catch(_0x40489f){logger['error'](_0x40489f);}return _0x1d39f1;}else{return this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')](_0xd138('0xf8'),_0x48ca9c['speech']));}}return this[_0xd138('0x2e')]['error'](_0x5af16d,_0xd138('0xf9'));};AGIVertices[_0xd138('0x13')]['end']=function(_0x5dad5a){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0xfa'),_0x5dad5a[_0xd138('0x30')]));return this[_0xd138('0x2e')][_0xd138('0x9f')](_0xd138('0xfb'));};AGIVertices[_0xd138('0x13')][_0xd138('0xfc')]=function(_0x20ba68){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0xfd'),_0x20ba68[_0xd138('0x30')]));var _0x9032fc='';if(_0x20ba68[_0xd138('0xfe')]){if(!this[_0xd138('0x79')](_0x20ba68[_0xd138('0xfe')])){return this[_0xd138('0x2e')][_0xd138('0x24')](_0x20ba68,'no\x20trunk\x20selected');}else{var _0x5efefc=parseInt(_0x20ba68[_0xd138('0xfe')],0xa);if(isNaN(_0x5efefc)){_0x9032fc=_0x20ba68[_0xd138('0xfe')];}else{_0x9032fc=this[_0xd138('0x19')][_0xd138('0x63')](this,_0x20ba68[_0xd138('0xfe')]);if(!_0x9032fc){return this[_0xd138('0x2e')][_0xd138('0x24')](_0x20ba68,_0xd138('0xff'));}}}}else if(_0x20ba68[_0xd138('0x100')]){_0x9032fc=_0x20ba68['trunk_name'];}else{return this[_0xd138('0x2e')][_0xd138('0x24')](_0x20ba68,_0xd138('0x101'));}var _0x511815=this[_0xd138('0x2e')]['exec'](_0xd138('0xda'),[util[_0xd138('0x22')](_0xd138('0x102'),_0x9032fc,_0x20ba68[_0xd138('0x3f')]),_0x20ba68[_0xd138('0x5b')],_0x20ba68[_0xd138('0xd8')],_0x20ba68[_0xd138('0x58')]]);if(_0x511815[_0xd138('0x99')]===-0x1){return _0x511815;}return this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')](_0xd138('0xd9'),_0xd138('0xda')));};AGIVertices[_0xd138('0x13')][_0xd138('0x103')]=function(_0xac712d){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0x104'),_0xac712d[_0xd138('0x30')]));return this[_0xd138('0x2e')][_0xd138('0x9f')](_0xd138('0x103'));};AGIVertices['prototype'][_0xd138('0x105')]=function(_0x101407){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0x106'),_0x101407[_0xd138('0x30')]));if(_0x101407[_0xd138('0x107')]===0x0){return this[_0xd138('0x9a')](_0x101407);}_0x101407[_0xd138('0x107')]-=0x1;if(!this[_0xd138('0x79')](_0x101407['file_id'])){return this[_0xd138('0x2e')][_0xd138('0x24')](_0x101407,_0xd138('0x108'));}var _0x52f7be=this[_0xd138('0x109')][_0xd138('0x63')](this,_0x101407[_0xd138('0x10a')]);if(!_0x52f7be){return this[_0xd138('0x2e')][_0xd138('0x24')](_0x101407,_0xd138('0x10b'));}if(!this[_0xd138('0x79')](_0x101407[_0xd138('0xcd')])){return this['channel'][_0xd138('0x24')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x393222=this[_0xd138('0x2e')][_0xd138('0x10c')](_0x52f7be,_0x101407[_0xd138('0x10d')],_0x101407['maxdigit']);var _0x471225=_0x393222[_0xd138('0x99')]?_0x393222['result'][_0xd138('0x97')]():'';logger[_0xd138('0x26')](_0xd138('0x10e'),JSON[_0xd138('0x66')](_0x393222));if(_0x393222[_0xd138('0x99')]===-0x1){this['createSquareDetailsReport'][_0xd138('0x63')](this,_0x101407,_0x471225);return _0x393222;}else if(_0x393222[_0xd138('0x96')]===_0xd138('0x5b')){_0x393222[_0xd138('0x99')]=_0x471225[_0xd138('0x8e')]>=parseInt(_0x101407[_0xd138('0x10f')])?'x':'i';}else{_0x393222[_0xd138('0x99')]=_0x471225[_0xd138('0x8e')]>=parseInt(_0x101407[_0xd138('0x10f')])&&_0x471225[_0xd138('0x8e')]<=parseInt(_0x101407['maxdigit'])?'x':'i';}var _0x223127=this[_0xd138('0xf')][_0xd138('0x63')](this,_0x101407[_0xd138('0xcd')]);if(!_0x223127){return this['channel']['error'](_0x101407,_0xd138('0xcf'));}this[_0xd138('0x2e')][_0xd138('0x93')](_0x223127,_0x471225);if(this[_0xd138('0x79')](_0x101407[_0xd138('0x110')])){var _0x575ccf=parseInt(_0x101407[_0xd138('0x110')],0xa);var _0xcb7826=rs['generate']({'charset':'*','length':_0x575ccf});var _0x230b98=_0x471225[_0xd138('0x8e')];if(_0x230b98>0x0){if(_0x230b98>_0x575ccf){this[_0xd138('0x2d')][_0xd138('0x63')](this,_0x101407,_0x101407[_0xd138('0x111')]===_0xd138('0x112')?_0xcb7826+_0x471225['substr'](_0x575ccf):_0x471225[_0xd138('0x113')](0x0,_0x230b98-_0x575ccf)+_0xcb7826);}else{this['createSquareDetailsReport'][_0xd138('0x63')](this,_0x101407,rs[_0xd138('0x114')]({'charset':'*','length':_0x230b98}));}}else{this['createSquareDetailsReport'][_0xd138('0x63')](this,_0x101407,'');}}else{this['createSquareDetailsReport'][_0xd138('0x63')](this,_0x101407,_0x471225);}return _0x393222;};AGIVertices[_0xd138('0x13')]['getsecretdigits']=function(_0xd6e13a){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0x115'),_0xd6e13a['label']));return this[_0xd138('0x105')](_0xd6e13a);};AGIVertices['prototype'][_0xd138('0x116')]=function(_0xb6a0f0){logger[_0xd138('0x26')](util[_0xd138('0x22')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0xb6a0f0[_0xd138('0x30')]));this[_0xd138('0x2d')][_0xd138('0x63')](this,_0xb6a0f0,_0xb6a0f0[_0xd138('0x117')]);return this[_0xd138('0x2e')][_0xd138('0x9f')](util['format'](_0xd138('0x118'),_0xb6a0f0[_0xd138('0x117')]));};AGIVertices[_0xd138('0x13')]['awspolly']=function(_0x40311b){logger[_0xd138('0x26')](util[_0xd138('0x22')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x40311b[_0xd138('0x30')]));if(!this[_0xd138('0x79')](_0x40311b[_0xd138('0x7c')])||!this[_0xd138('0x79')](_0x40311b['aws_secret_access_key'])){return this[_0xd138('0x2e')][_0xd138('0x9f')](_0xd138('0x119'));}if(!this[_0xd138('0x79')](_0x40311b[_0xd138('0x51')])){return this[_0xd138('0x2e')][_0xd138('0x9f')](_0xd138('0x9d'));}this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')](_0xd138('0x11a'),_0x40311b[_0xd138('0x51')]));var _0x22b147=this[_0xd138('0x7b')][_0xd138('0x63')](this,_0x40311b);if(_0x22b147){this[_0xd138('0x2e')]['noop'](util[_0xd138('0x22')](_0xd138('0x11b'),_0x22b147));var _0x9b1041=this['channel'][_0xd138('0x11c')](_0x22b147);try{fs[_0xd138('0xf6')](_0x22b147+_0xd138('0xf7'));}catch(_0x5a6727){logger[_0xd138('0x24')](_0x5a6727);}return _0x9b1041;}return this['channel']['error'](_0x40311b,_0xd138('0x11d'));};AGIVertices[_0xd138('0x13')][_0xd138('0x11e')]=function(_0x208390){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0x11f'),_0x208390[_0xd138('0x30')]));if(!this[_0xd138('0x79')](_0x208390[_0xd138('0x7c')])||!this[_0xd138('0x79')](_0x208390[_0xd138('0x7d')])){return this[_0xd138('0x2e')]['noop'](_0xd138('0x119'));}if(!this[_0xd138('0x79')](_0x208390[_0xd138('0x120')])){return this['channel'][_0xd138('0x9f')](_0xd138('0x121'));}if(!this[_0xd138('0x79')](_0x208390[_0xd138('0x51')])){return this[_0xd138('0x2e')][_0xd138('0x9f')]('no\x20text\x20configured');}this['channel']['bot']=!![];this[_0xd138('0x2d')](_0x208390);this[_0xd138('0x38')](_0x208390['text'],'in','','');this[_0xd138('0x2e')]['noop'](util[_0xd138('0x22')](_0xd138('0x122'),_0x208390[_0xd138('0x51')]));var _0x5d2064=this['awsLex'][_0xd138('0x63')](this,_0x208390);if(_0x5d2064){for(var _0x46a657 in _0x5d2064){if(_0x5d2064['hasOwnProperty'](_0x46a657)&&_['isString'](_0x5d2064[_0x46a657])){this['channel']['setVariable'](util[_0xd138('0x22')]('AWS_LEX_%s',_0x46a657[_0xd138('0xe9')]()),_0x5d2064[_0x46a657]);}}if(_['isNil'](_0x5d2064['message'])){return this[_0xd138('0x2e')][_0xd138('0x9f')](_0xd138('0x123'));}else{this[_0xd138('0x38')](_0x5d2064[_0xd138('0x6a')],_0xd138('0xe0'),'amazonlex','');return this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')]('Amazon\x20Lex\x20Result\x20%s',_0x5d2064[_0xd138('0x6a')]));}}return this[_0xd138('0x2e')][_0xd138('0x24')](_0x208390,_0xd138('0x124'));};AGIVertices[_0xd138('0x13')][_0xd138('0x125')]=function(_0x409de3){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0x126'),_0x409de3[_0xd138('0x30')],_0x409de3['timeout']));if(!this['isConfigured'](_0x409de3['key'])){return this[_0xd138('0x2e')][_0xd138('0x9f')](_0xd138('0xdc'));}var _0x58b73e=_0xd138('0x127');var _0x1e0e87=util[_0xd138('0x22')](_0xd138('0x128'),FILES_PATH,rs['generate'](0x4));var _0x2670de=util['format']('%s.%s',_0x1e0e87,_0x58b73e);var _0x2bd0ac=!![];if(_0x409de3['beep']===_0xd138('0x129')){_0x2bd0ac=![];}var _0xdb93f5=this[_0xd138('0x2e')][_0xd138('0x12a')](_0x1e0e87,_0x58b73e,_0x409de3['intKey'],_0x409de3[_0xd138('0x5b')],undefined,_0x2bd0ac);if(_0xdb93f5[_0xd138('0x99')]!==-0x1){this[_0xd138('0x2e')]['noop'](util[_0xd138('0x22')]('google\x20%s\x20file\x20created',_0x2670de));var _0xe4e811=this[_0xd138('0x82')]['sync'](this,_0x409de3,_0x2670de);if(_0xe4e811){for(var _0x595d30 in _0xe4e811){if(_0xe4e811[_0xd138('0x89')](_0x595d30)){this[_0xd138('0x2e')][_0xd138('0x93')](util['format'](_0xd138('0x12b'),_0x595d30[_0xd138('0xe9')]()),_0xe4e811[_0x595d30]);}}return this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')](_0xd138('0x12c'),JSON[_0xd138('0x66')](_0xe4e811)));}}return _0xdb93f5;};AGIVertices[_0xd138('0x13')][_0xd138('0x12d')]=function(_0x496703){logger['info'](util[_0xd138('0x22')](_0xd138('0x12e'),_0x496703[_0xd138('0x30')]));if(!this[_0xd138('0x79')](_0x496703[_0xd138('0x85')])){return this[_0xd138('0x2e')][_0xd138('0x9f')](_0xd138('0x12f'));}if(!this[_0xd138('0x79')](_0x496703[_0xd138('0x86')])){return this[_0xd138('0x2e')][_0xd138('0x9f')](_0xd138('0x130'));}var _0x152e9c=_0xd138('0x127');var _0x32e04d=util[_0xd138('0x22')]('%s/recordings/%s',FILES_PATH,rs[_0xd138('0x114')](0x4));var _0x2eaf70=util[_0xd138('0x22')](_0xd138('0x92'),_0x32e04d,_0x152e9c);var _0x3986f5=!![];if(_0x496703[_0xd138('0x131')]===_0xd138('0x129')){_0x3986f5=![];}var _0x1aa62a=this[_0xd138('0x2e')][_0xd138('0x12a')](_0x32e04d,_0x152e9c,_0x496703[_0xd138('0x132')],_0x496703['timeout'],undefined,_0x3986f5);if(_0x1aa62a['result']!==-0x1){this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')](_0xd138('0x133'),_0x2eaf70));var _0x4bf1b5=this[_0xd138('0x84')][_0xd138('0x63')](this,_0x496703,_0x2eaf70);if(_0x4bf1b5){for(var _0x189ade in _0x4bf1b5){if(_0x4bf1b5[_0xd138('0x89')](_0x189ade)){this[_0xd138('0x2e')][_0xd138('0x93')](util[_0xd138('0x22')]('TILDE_ASR_%s',_0x189ade[_0xd138('0xe9')]()),_0x4bf1b5[_0x189ade]);}}return this['channel'][_0xd138('0x9f')](util['format'](_0xd138('0x134'),JSON['stringify'](_0x4bf1b5)));}}return _0x1aa62a;};AGIVertices[_0xd138('0x13')]['gotoc']=function(_0x12816b){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0x135'),_0x12816b[_0xd138('0x30')]));return this[_0xd138('0x2e')][_0xd138('0x136')](_0x12816b[_0xd138('0x35')],_0x12816b[_0xd138('0x36')],_0x12816b[_0xd138('0x137')]);};AGIVertices[_0xd138('0x13')][_0xd138('0x138')]=function(_0x22b5b4){logger['info'](util[_0xd138('0x22')](_0xd138('0x139'),_0x22b5b4[_0xd138('0x30')]));if(!this[_0xd138('0x79')](_0x22b5b4[_0xd138('0x13a')])){return this[_0xd138('0x2e')][_0xd138('0x24')](_0x22b5b4,_0xd138('0x13b'));}try{var _0x44f177=eval(_0x22b5b4[_0xd138('0x13a')])?_0xd138('0x13c'):'false';this[_0xd138('0x2e')][_0xd138('0x9f')](util['format'](_0xd138('0x13d'),_0x22b5b4[_0xd138('0x13a')],_0x44f177));return{'code':0xc8,'result':_0x44f177};}catch(_0x3d33f3){return{'code':0xc8,'result':_0xd138('0x13e')};}};AGIVertices[_0xd138('0x13')]['gotoiftime']=function(_0x2dda1c){logger['info'](util['format'](_0xd138('0x13f'),_0x2dda1c['label']));if(!this[_0xd138('0x79')](_0x2dda1c[_0xd138('0x140')])){return this[_0xd138('0x2e')][_0xd138('0x24')](_0x2dda1c,_0xd138('0x141'));}var _0x19e8dc=this[_0xd138('0x142')][_0xd138('0x63')](this,_0x2dda1c['interval_id']);if(!_0x19e8dc){return this[_0xd138('0x2e')][_0xd138('0x24')](_0x2dda1c,_0xd138('0x143'));}for(var _0x57e478=0x0;_0x57e478<_0x19e8dc['length'];_0x57e478+=0x1){var _0x3cf435=this[_0xd138('0x2e')][_0xd138('0xf')](util[_0xd138('0x22')]('IFTIME(%s?true:false)',_0x19e8dc[_0x57e478]));if(_0x3cf435[_0xd138('0x99')]===-0x1){return _0x3cf435;}logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0x144'),_0x19e8dc[_0x57e478],_0x3cf435['extra']));if(_0x3cf435[_0xd138('0x96')]===_0xd138('0x13c')){logger['info'](util[_0xd138('0x22')](_0xd138('0x144'),_0x19e8dc[_0x57e478],_0xd138('0x13c')));this[_0xd138('0x2e')][_0xd138('0x9f')](util['format'](_0xd138('0x144'),_0x19e8dc[_0x57e478],_0xd138('0x13c')));return{'code':0xc8,'result':_0xd138('0x13c')};}else{logger['info'](util[_0xd138('0x22')](_0xd138('0x144'),_0x19e8dc[_0x57e478],'false'));this[_0xd138('0x2e')]['noop'](util['format'](_0xd138('0x144'),_0x19e8dc[_0x57e478],'false'));}}return{'code':0xc8,'result':_0xd138('0x13e')};};AGIVertices[_0xd138('0x13')]['hangup']=function(_0x51b1c6){logger[_0xd138('0x26')](util['format'](_0xd138('0x145'),_0x51b1c6[_0xd138('0x30')]));return this['channel'][_0xd138('0x146')]();};AGIVertices['prototype'][_0xd138('0x147')]=function(_0x51bc2d){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0x148'),_0x51bc2d[_0xd138('0x30')]));if(!this[_0xd138('0x79')](_0x51bc2d[_0xd138('0x74')])){return this[_0xd138('0x2e')][_0xd138('0x9f')](_0xd138('0xdc'));}var _0x5dcd1f=_0xd138('0x127');var _0xe02b1=util[_0xd138('0x22')](_0xd138('0x128'),FILES_PATH,rs['generate'](0x4));var _0x4989e4=util[_0xd138('0x22')](_0xd138('0x92'),_0xe02b1,_0x5dcd1f);var _0x5d948c=!![];if(_0x51bc2d['beep']===_0xd138('0x129')){_0x5d948c=![];}var _0x349612=this['channel'][_0xd138('0x12a')](_0xe02b1,_0x5dcd1f,_0x51bc2d['intKey'],_0x51bc2d[_0xd138('0x5b')],undefined,_0x5d948c);if(_0x349612[_0xd138('0x99')]!==-0x1){this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')](_0xd138('0x149'),_0x4989e4));var _0x5083dc=this[_0xd138('0x77')][_0xd138('0x63')](this,_0x51bc2d,_0x4989e4);if(_0x5083dc){for(var _0x1c463e in _0x5083dc){if(_0x5083dc['hasOwnProperty'](_0x1c463e)){this[_0xd138('0x2e')][_0xd138('0x93')](util[_0xd138('0x22')](_0xd138('0x14a'),_0x1c463e[_0xd138('0xe9')]()),_0x5083dc[_0x1c463e]);}}return this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')](_0xd138('0x14b'),JSON[_0xd138('0x66')](_0x5083dc)));}}return _0x349612;};AGIVertices[_0xd138('0x13')][_0xd138('0x14c')]=function(_0xe9b161){logger[_0xd138('0x26')](util['format'](_0xd138('0x14d'),_0xe9b161['label']));if(!this['isConfigured'](_0xe9b161[_0xd138('0x74')])){return this[_0xd138('0x2e')][_0xd138('0x9f')](_0xd138('0xdc'));}if(!this[_0xd138('0x79')](_0xe9b161['text'])){return this['channel'][_0xd138('0x9f')](_0xd138('0x9d'));}this['channel'][_0xd138('0x9f')](util[_0xd138('0x22')](_0xd138('0x14e'),_0xe9b161[_0xd138('0x51')]));var _0x4f4a73=this[_0xd138('0x73')][_0xd138('0x63')](this,_0xe9b161);if(_0x4f4a73){this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')](_0xd138('0x149'),_0x4f4a73));var _0x4ad507=this[_0xd138('0x2e')][_0xd138('0x11c')](_0x4f4a73,_0xe9b161[_0xd138('0x132')]);try{fs[_0xd138('0xf6')](_0x4f4a73+'.wav');}catch(_0x58f778){logger['error'](_0x58f778);}return _0x4ad507;}return this[_0xd138('0x2e')][_0xd138('0x24')](_0xe9b161,_0xd138('0x14f'));};AGIVertices[_0xd138('0x13')][_0xd138('0x150')]=function(_0x10c6be){logger[_0xd138('0x26')](util['format'](_0xd138('0x151'),_0x10c6be[_0xd138('0x30')]));if(!this[_0xd138('0x79')](_0x10c6be['findBy'])){return this['channel'][_0xd138('0x24')](_0x10c6be,'no\x20find\x20by\x20configured');}logger['info'](util[_0xd138('0x22')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0xd138('0x33')],_0x10c6be[_0xd138('0x152')]));var _0x459905=this[_0xd138('0x48')]['sync'](this,_0x10c6be[_0xd138('0x152')]);if(_0x459905){logger['info'](util[_0xd138('0x22')](_0xd138('0x153'),this['channel'][_0xd138('0x33')],_0x10c6be['findBy']));this[_0xd138('0x2e')]['noop'](util[_0xd138('0x22')](_0xd138('0x153'),this[_0xd138('0x2e')][_0xd138('0x33')],_0x10c6be[_0xd138('0x152')]));return{'code':0xc8,'result':_0xd138('0x154')};}else{logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0x155'),this[_0xd138('0x2e')][_0xd138('0x33')],_0x10c6be[_0xd138('0x152')]));this[_0xd138('0x2e')]['noop'](util['format'](_0xd138('0x155'),this[_0xd138('0x2e')]['callerid'],_0x10c6be['findBy']));return{'code':0xc8,'result':_0xd138('0x156')};}};AGIVertices[_0xd138('0x13')][_0xd138('0x157')]=function(_0x24d862){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0x158'),_0x24d862[_0xd138('0x30')]));if(!this['isConfigured'](_0x24d862['findBy'])){return this[_0xd138('0x2e')][_0xd138('0x24')](_0x24d862,_0xd138('0x159'));}logger[_0xd138('0x26')](util[_0xd138('0x22')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel']['callerid'],_0x24d862[_0xd138('0x152')]));var _0x335aa9=this['agentLogout'][_0xd138('0x63')](this,_0x24d862[_0xd138('0x152')]);if(_0x335aa9){logger[_0xd138('0x26')](util['format'](_0xd138('0x153'),this[_0xd138('0x2e')][_0xd138('0x33')],_0x24d862[_0xd138('0x152')]));this['channel'][_0xd138('0x9f')](util[_0xd138('0x22')](_0xd138('0x153'),this[_0xd138('0x2e')][_0xd138('0x33')],_0x24d862[_0xd138('0x152')]));return{'code':0xc8,'result':_0xd138('0x154')};}else{logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0x155'),this[_0xd138('0x2e')][_0xd138('0x33')],_0x24d862[_0xd138('0x152')]));this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')](_0xd138('0x155'),this['channel']['callerid'],_0x24d862[_0xd138('0x152')]));return{'code':0xc8,'result':_0xd138('0x156')};}};AGIVertices[_0xd138('0x13')]['math']=function(_0x20f261){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0x15a'),_0x20f261['label']));if(!this['isConfigured'](_0x20f261['operation'])){return this[_0xd138('0x2e')]['error'](_0x20f261,_0xd138('0x15b'));}this['channel'][_0xd138('0x9f')](util['format'](_0xd138('0x15c'),_0x20f261[_0xd138('0x15d')]));var _0x49e3ce=eval(_0x20f261[_0xd138('0x15d')]);if(!this[_0xd138('0x79')](_0x20f261[_0xd138('0xcd')])){return this[_0xd138('0x2e')][_0xd138('0x9f')](_0xd138('0xce'));}var _0x434680=this[_0xd138('0xf')][_0xd138('0x63')](this,_0x20f261[_0xd138('0xcd')]);if(!_0x434680){return this[_0xd138('0x2e')]['error'](_0x20f261,_0xd138('0xcf'));}if(_[_0xd138('0x8d')](_0x49e3ce)){var _0x51db0f=this;_0x49e3ce[_0xd138('0xd0')](function(_0x191c46,_0x1d5e14){_0x51db0f[_0xd138('0x2e')][_0xd138('0x93')](util[_0xd138('0x22')](_0xd138('0x15e'),_0x434680,_0x1d5e14),_0x191c46);});return this[_0xd138('0x2e')]['noop'](util[_0xd138('0x22')](_0xd138('0x15f'),_0x434680));}else{return this[_0xd138('0x2e')][_0xd138('0x93')](_0x434680,_0x49e3ce);}};AGIVertices[_0xd138('0x13')]['menu']=function(_0x1b2bd2){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0x160'),_0x1b2bd2[_0xd138('0x30')]));if(_0x1b2bd2[_0xd138('0x107')]===0x0){return this[_0xd138('0x9a')](_0x1b2bd2);}_0x1b2bd2[_0xd138('0x107')]-=0x1;if(!this[_0xd138('0x79')](_0x1b2bd2[_0xd138('0x10a')])){return this[_0xd138('0x2e')]['error'](_0x1b2bd2,_0xd138('0x108'));}var _0x4526fc=this['getSound'][_0xd138('0x63')](this,_0x1b2bd2['file_id']);if(!_0x4526fc){return this[_0xd138('0x2e')][_0xd138('0x24')](_0x1b2bd2,_0xd138('0x10b'));}var _0x1075df=this[_0xd138('0x2e')][_0xd138('0x10c')](_0x4526fc,_0x1b2bd2[_0xd138('0x10d')],_0x1b2bd2[_0xd138('0x161')]);var _0x1f4ebe=_0x1075df[_0xd138('0x99')];if(_0x1075df[_0xd138('0x99')]===-0x1){this[_0xd138('0x2d')][_0xd138('0x63')](this,_0x1b2bd2,'-1');return _0x1075df;}else if(_0x1075df[_0xd138('0x96')]===_0xd138('0x5b')){_0x1075df[_0xd138('0x99')]=_0x1075df[_0xd138('0x99')][_0xd138('0x8e')]>0x0?_0x1075df[_0xd138('0x99')]:'t';}else if(_[_0xd138('0x3a')](_0x1075df[_0xd138('0x99')])){_0x1075df['result']='#';_0x1f4ebe='#';}if(!this[_0xd138('0x79')](_0x1b2bd2[_0xd138('0xcd')])){this['channel'][_0xd138('0x9f')](_0xd138('0xce'));}else{var _0x56d906=this[_0xd138('0xf')][_0xd138('0x63')](this,_0x1b2bd2[_0xd138('0xcd')]);if(!_0x56d906){return this['channel'][_0xd138('0x24')](_0x1b2bd2,_0xd138('0xcf'));}this[_0xd138('0x2e')][_0xd138('0x93')](_0x56d906,_0x1f4ebe);}this[_0xd138('0x2d')][_0xd138('0x63')](this,_0x1b2bd2,_0x1f4ebe);return _0x1075df;};AGIVertices['prototype']['noop']=function(_0xe9076c){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0x162'),_0xe9076c[_0xd138('0x30')]));return this[_0xd138('0x2e')]['noop'](_0xe9076c[_0xd138('0x163')]||_0xe9076c[_0xd138('0x30')]);};AGIVertices[_0xd138('0x13')][_0xd138('0x164')]=function(_0x4d1704){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0x165'),_0x4d1704['label']));if(!this[_0xd138('0x79')](_0x4d1704[_0xd138('0x152')])){return this[_0xd138('0x2e')]['error'](_0x4d1704,'no\x20find\x20by\x20configured');}logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0x166'),this[_0xd138('0x2e')][_0xd138('0x33')],_0x4d1704[_0xd138('0x152')]));var _0x3ad11f=this[_0xd138('0x43')][_0xd138('0x63')](this,_0x4d1704[_0xd138('0x167')]);var _0x279dc3=this[_0xd138('0x45')][_0xd138('0x63')](this,_0x4d1704[_0xd138('0x152')],_0x3ad11f);if(_0x279dc3){logger[_0xd138('0x26')](util[_0xd138('0x22')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xd138('0x2e')][_0xd138('0x33')],_0x4d1704[_0xd138('0x152')]));this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')](_0xd138('0x153'),this[_0xd138('0x2e')][_0xd138('0x33')],_0x4d1704[_0xd138('0x152')]));return{'code':0xc8,'result':'success'};}else{logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0x155'),this[_0xd138('0x2e')][_0xd138('0x33')],_0x4d1704[_0xd138('0x152')]));this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')](_0xd138('0x153'),this[_0xd138('0x2e')][_0xd138('0x33')],_0x4d1704[_0xd138('0x152')]));return{'code':0xc8,'result':_0xd138('0x156')};}};AGIVertices[_0xd138('0x13')]['playback']=function(_0x1040ba){logger[_0xd138('0x26')](util['format'](_0xd138('0x168'),_0x1040ba['label']));if(!this[_0xd138('0x79')](_0x1040ba[_0xd138('0x10a')])){return this[_0xd138('0x2e')][_0xd138('0x24')](_0x1040ba,'no\x20file\x20audio\x20selected');}var _0x5be05a=this[_0xd138('0x109')]['sync'](this,_0x1040ba[_0xd138('0x10a')]);if(!_0x5be05a){return this[_0xd138('0x2e')][_0xd138('0x24')](_0x1040ba,_0xd138('0x10b'));}var _0x47845c=this['channel'][_0xd138('0x4c')](_0xd138('0x169'),[_0x5be05a,_0x1040ba[_0xd138('0xd8')]]);if(_0x47845c['result']===-0x1){return _0x47845c;}return this[_0xd138('0x2e')][_0xd138('0x9f')](util['format'](_0xd138('0xb8'),_0xd138('0x169'),_0x5be05a));};AGIVertices[_0xd138('0x13')]['queue']=function(_0x436cda){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0x16a'),_0x436cda['label']));if(!this[_0xd138('0x79')](_0x436cda['queue_id'])){return this[_0xd138('0x2e')][_0xd138('0x24')](_0x436cda,_0xd138('0x16b'));}var _0x449dc7='';var _0x2fed8e=parseInt(_0x436cda[_0xd138('0x16c')],0xa);if(isNaN(_0x2fed8e)){_0x449dc7=_0x436cda[_0xd138('0x16c')];}else{_0x449dc7=this[_0xd138('0x14')][_0xd138('0x63')](this,_0x436cda['queue_id']);if(!_0x449dc7){return this[_0xd138('0x2e')][_0xd138('0x24')](_0x436cda,_0xd138('0x16d'));}}var _0x5cf006='';if(this[_0xd138('0x79')](_0x436cda[_0xd138('0x10a')])){var _0x72ed74=this[_0xd138('0x109')][_0xd138('0x63')](this,_0x436cda[_0xd138('0x10a')]);if(_0x72ed74){_0x5cf006=_0x72ed74;}}this['createSquareDetailsReport'][_0xd138('0x63')](this,_0x436cda,_0x449dc7);if(_0x436cda[_0xd138('0xd8')]['indexOf']('x')<0x0){_0x436cda['opts']+='x';}if(_0x436cda[_0xd138('0xd8')][_0xd138('0x16e')]('X')<0x0){_0x436cda['opts']+='X';}this[_0xd138('0x2e')][_0xd138('0x93')]('XMCS-QUEUE',_0x449dc7?_0x449dc7[_0xd138('0x16f')]():'');var _0x466c27=this[_0xd138('0x2e')]['exec']('QUEUE',[_0x449dc7,_0x436cda['opts'],_0x436cda[_0xd138('0x58')],_0x5cf006,_0x436cda[_0xd138('0x5b')],_0x436cda[_0xd138('0xab')],_0x436cda[_0xd138('0x170')],_0x436cda[_0xd138('0x171')],'',_0x436cda['position']]);if(_0x466c27[_0xd138('0x99')]===-0x1){return _0x466c27;}return this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')](_0xd138('0xb8'),_0xd138('0x172'),_0x449dc7));};AGIVertices[_0xd138('0x13')][_0xd138('0x173')]=function(_0x3306be){logger[_0xd138('0x26')](util['format'](_0xd138('0x174'),_0x3306be['label']));var _0x45189f=_0x3306be[_0xd138('0x175')]||_0xd138('0x127');var _0x54ad48=util[_0xd138('0x22')](_0xd138('0x176'),this['channel'][_0xd138('0x2f')],rs[_0xd138('0x114')](0x5));var _0x1445a0=util[_0xd138('0x22')]('%s/recordings/%s.%s',FILES_PATH,_0x54ad48,_0x45189f);var _0x14fac3=util[_0xd138('0x22')]('%s/recordings/%s',FILES_PATH,_0x54ad48);this[_0xd138('0x34')][_0xd138('0x63')](this,_0x3306be,_0x54ad48,_0x1445a0);this['channel']['setVariable'](_0xd138('0x177'),_0x54ad48);logger['info']('Recording\x20%s\x20%s\x20%s\x20%s',_0x14fac3,_0x45189f,_0x3306be[_0xd138('0x178')],_0x3306be['timeout']);return this[_0xd138('0x2e')][_0xd138('0x12a')](_0x14fac3,_0x45189f,_0x3306be[_0xd138('0x178')],_0x3306be[_0xd138('0x5b')],undefined,!![]);};AGIVertices[_0xd138('0x13')][_0xd138('0x179')]=function(_0x5dabac){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0x17a'),_0x5dabac[_0xd138('0x30')]));if(!this['isConfigured'](_0x5dabac[_0xd138('0x58')])){return this[_0xd138('0x2e')]['noop']('no\x20url\x20configured');}var _0x20a239=this[_0xd138('0x57')]['sync'](this,_0x5dabac);logger[_0xd138('0x26')](util['format'](_0xd138('0x17b'),util[_0xd138('0x17c')](_0x20a239,{'showHidden':![],'depth':null})));if(!this[_0xd138('0x79')](_0x5dabac[_0xd138('0xcd')])){return this[_0xd138('0x2e')]['noop'](_0xd138('0x17d'));}var _0x1944a5=this['getVariable'][_0xd138('0x63')](this,_0x5dabac['variable_id']);if(!_0x1944a5){return this[_0xd138('0x2e')]['error'](_0x5dabac,_0xd138('0xcf'));}this[_0xd138('0x2e')][_0xd138('0x93')](util[_0xd138('0x22')](_0xd138('0x17e'),_0x1944a5),_0x20a239['statusCode']?_0x20a239[_0xd138('0x68')]:_0xd138('0x17f'));this[_0xd138('0x2e')]['setVariable'](util['format'](_0xd138('0x180'),_0x1944a5),_0x20a239[_0xd138('0x69')]?_0x20a239[_0xd138('0x69')]:'OK');if(_0x20a239[_0xd138('0x5e')]){try{this[_0xd138('0x91')](_0x20a239[_0xd138('0x5e')],_0x1944a5);}catch(_0x47e690){logger['error'](util[_0xd138('0x22')](_0xd138('0x181'),_0x1944a5));}}return this[_0xd138('0x2e')][_0xd138('0x9f')](util['format'](_0xd138('0x182'),_0x1944a5));};AGIVertices[_0xd138('0x13')][_0xd138('0x183')]=function(_0x40902a){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0x184'),_0x40902a['label']));return this['channel'][_0xd138('0x185')](_0x40902a[_0xd138('0x186')][_0xd138('0xca')](/\s+/g,''),_0x40902a['escape_digits']);};AGIVertices['prototype'][_0xd138('0x187')]=function(_0x70209e){logger['info'](util[_0xd138('0x22')](_0xd138('0x188'),_0x70209e[_0xd138('0x30')]));return this[_0xd138('0x2e')][_0xd138('0x189')](_0x70209e['number'][_0xd138('0xca')](/\s+/g,''),_0x70209e[_0xd138('0x178')]);};AGIVertices[_0xd138('0x13')][_0xd138('0x18a')]=function(_0x341433){logger[_0xd138('0x26')](util['format'](_0xd138('0x18b'),_0x341433[_0xd138('0x30')]));return this[_0xd138('0x2e')][_0xd138('0x18c')](_0x341433[_0xd138('0x51')],_0x341433[_0xd138('0x178')]);};AGIVertices[_0xd138('0x13')]['sendMail']=function(_0x13709f){logger['info'](util['format'](_0xd138('0x18d'),_0x13709f[_0xd138('0x30')]));if(!this[_0xd138('0x79')](_0x13709f[_0xd138('0x18e')])){return this[_0xd138('0x2e')][_0xd138('0x9f')](_0xd138('0x18f'));}var _0x36d0eb=this['getMailAccount']['sync'](this,_0x13709f[_0xd138('0x18e')]);if(!_0x36d0eb||!_0x36d0eb[_0xd138('0x190')]){return this[_0xd138('0x2e')][_0xd138('0x24')](_0x13709f,'no\x20mail\x20account\x20found');}var _0x17b4fe={'from':util['format'](_0xd138('0x191'),_0x36d0eb[_0xd138('0x11')],_0x36d0eb[_0xd138('0x192')]||_0x36d0eb['Smtp'][_0xd138('0x193')]),'to':_0x13709f['to']||'','cc':_0x13709f['cc']||'','bcc':_0x13709f[_0xd138('0x194')]||'','subject':_0x13709f['subject'],'html':_0x13709f['text'],'text':_0x13709f[_0xd138('0x51')]};if(this['isConfigured'](_0x13709f['template_id'])){}logger[_0xd138('0x195')](_0xd138('0x196'),JSON['stringify'](_0x17b4fe));this[_0xd138('0x2d')]['sync'](this,_0x13709f,_0x13709f[_0xd138('0x18e')]);this[_0xd138('0x2e')][_0xd138('0x9f')](util['format']('Trying\x20SendMail\x20with\x20account\x20%s',_0x36d0eb[_0xd138('0x11')]));this[_0xd138('0x1d')]['sync'](this,_0x36d0eb[_0xd138('0x197')],_0x17b4fe);return this['channel'][_0xd138('0x9f')](_0xd138('0x198'));};AGIVertices[_0xd138('0x13')]['sendFax']=function(_0x5f008a){logger['info'](util[_0xd138('0x22')](_0xd138('0x199'),_0x5f008a['label']));return this[_0xd138('0x2e')]['noop'](_0xd138('0x19a'));};AGIVertices[_0xd138('0x13')]['sendSMS']=function(_0x104685){logger['info'](util[_0xd138('0x22')](_0xd138('0x19b'),_0x104685[_0xd138('0x30')]));if(!this[_0xd138('0x79')](_0x104685['sms_account_id'])){return this[_0xd138('0x2e')][_0xd138('0x9f')](_0xd138('0x19c'));}var _0x32d046=this[_0xd138('0x19d')]['sync'](this,_0x104685[_0xd138('0x19e')]);if(!_0x32d046){return this['channel'][_0xd138('0x24')](_0x104685,'no\x20sms\x20account\x20found');}var _0x36feff={'body':_0x104685['sms_text'],'phone':_0x104685['to']||'','SmsAccountId':_0x32d046['id']};logger[_0xd138('0x195')](_0xd138('0x19f'),JSON[_0xd138('0x66')](_0x36feff));this['createSquareDetailsReport']['sync'](this,_0x104685,_0x104685['sms_account_id']);this['channel'][_0xd138('0x9f')](util[_0xd138('0x22')](_0xd138('0x1a0'),_0x32d046[_0xd138('0x11')]));this[_0xd138('0x2c')][_0xd138('0x63')](this,_0x36feff);return this[_0xd138('0x2e')][_0xd138('0x9f')](_0xd138('0x1a1'));};AGIVertices[_0xd138('0x13')]['set']=function(_0x3c078d){logger[_0xd138('0x26')](util['format'](_0xd138('0x1a2'),_0x3c078d[_0xd138('0x30')]));if(!this[_0xd138('0x79')](_0x3c078d[_0xd138('0xcd')])){return this[_0xd138('0x2e')][_0xd138('0x24')](_0x3c078d,_0xd138('0x1a3'));}var _0x1524b3=this['getVariable']['sync'](this,_0x3c078d[_0xd138('0xcd')]);if(!_0x1524b3){return this[_0xd138('0x2e')][_0xd138('0x24')](_0x3c078d,'no\x20variable\x20found');}return this[_0xd138('0x2e')]['setVariable'](_0x1524b3,_0x3c078d[_0xd138('0x1a4')]);};AGIVertices[_0xd138('0x13')]['start']=function(_0x2219d4){logger['info'](util[_0xd138('0x22')](_0xd138('0x1a5'),_0x2219d4['label']));this[_0xd138('0x2e')][_0xd138('0x9f')]('START\x20CALLY\x20SQUARE');if(_0x2219d4[_0xd138('0xad')]===_0xd138('0x1a6')){this[_0xd138('0x2e')][_0xd138('0x9f')](_0xd138('0x1a7'));return this[_0xd138('0x2e')][_0xd138('0xad')]();}return this[_0xd138('0x2e')]['noop'](_0xd138('0x1a8'));};AGIVertices[_0xd138('0x13')][_0xd138('0x1a9')]=function(_0x2115e9){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0x1aa'),_0x2115e9[_0xd138('0x30')]));if(!this['isConfigured'](_0x2115e9['project_id'])){return this[_0xd138('0x2e')][_0xd138('0x24')](_0x2115e9,_0xd138('0x1ab'));}var _0x406f48=this[_0xd138('0x1ac')][_0xd138('0x63')](this,_0x2115e9[_0xd138('0x1ad')]);if(!this[_0xd138('0x79')](_0x406f48)){return this[_0xd138('0x2e')][_0xd138('0x24')](_0x2115e9,util[_0xd138('0x22')](_0xd138('0x1ae'),_0x2115e9['project_id']));}if(_0x406f48===this[_0xd138('0x2e')]['arg_1']){return this[_0xd138('0x2e')][_0xd138('0x24')](_0x2115e9,_0xd138('0x1af'));}this[_0xd138('0x2d')][_0xd138('0x63')](this,_0x2115e9,_0x406f48);var _0x46e9b7=this[_0xd138('0x2e')][_0xd138('0x4c')](_0xd138('0x1b0'),util['format'](_0xd138('0x1b1'),config['agi'][_0xd138('0x1b2')]||'127.0.0.1',_0x406f48,this['channel']['arg_1']));if(_0x46e9b7[_0xd138('0x99')]===-0x1){return _0x46e9b7;}return this['channel'][_0xd138('0x9f')](util['format']('Executed\x20command\x20%s\x20%s',_0xd138('0x1b0'),_0x406f48));};AGIVertices[_0xd138('0x13')][_0xd138('0x1b3')]=function(_0x28f212){logger[_0xd138('0x26')](util[_0xd138('0x22')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x28f212['label']));var _0x3aa216=this[_0xd138('0x4b')]['sync'](this,_0x28f212[_0xd138('0xac')]);this[_0xd138('0x2d')][_0xd138('0x63')](this,_0x28f212,_0x28f212[_0xd138('0xac')]);if(this[_0xd138('0x79')](_0x28f212[_0xd138('0xcd')])){var _0x56fef7=this[_0xd138('0xf')]['sync'](this,_0x28f212[_0xd138('0xcd')]);if(_0x56fef7){this[_0xd138('0x2e')][_0xd138('0x93')](_0x56fef7,_0x3aa216);return this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')](_0xd138('0x1b4'),_0x28f212[_0xd138('0xac')],_0x56fef7));}}return this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x28f212['command']));};AGIVertices['prototype']['google_cloud_tts']=function(_0x5f495b){logger[_0xd138('0x26')](util['format'](_0xd138('0x1b5'),_0x5f495b[_0xd138('0x30')]));_0x5f495b[_0xd138('0x51')]=_0x5f495b[_0xd138('0x51')][_0xd138('0xca')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xd138('0x79')](_0x5f495b[_0xd138('0x4f')])){return this[_0xd138('0x2e')]['noop'](_0xd138('0x1b6'));}if(!this['isConfigured'](_0x5f495b[_0xd138('0x51')])){return this[_0xd138('0x2e')][_0xd138('0x9f')]('no\x20text\x20configured');}this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x5f495b[_0xd138('0x51')]));var _0x3f72b5=this[_0xd138('0x4e')][_0xd138('0x63')](this,_0x5f495b);if(_0x3f72b5){this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')](_0xd138('0x1b7'),_0x3f72b5));var _0x1ac579=this[_0xd138('0x2e')][_0xd138('0x11c')](_0x3f72b5);try{fs['unlink'](_0x3f72b5+_0xd138('0xf7'));}catch(_0x1bbb21){logger[_0xd138('0x24')](_0x1bbb21);}return _0x1ac579;}return this[_0xd138('0x2e')][_0xd138('0x24')](_0x5f495b,_0xd138('0x1b8'));};AGIVertices[_0xd138('0x13')][_0xd138('0x1b9')]=function(_0x5d4689){logger['info'](util['format']('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x5d4689[_0xd138('0x30')]));_0x5d4689[_0xd138('0x51')]=_0x5d4689['text'][_0xd138('0xca')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xd138('0x79')](_0x5d4689[_0xd138('0x51')])){return this[_0xd138('0x2e')]['noop'](_0xd138('0x9d'));}this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')]('Trying\x20Google\x20TTS\x20%s',_0x5d4689['text']));var _0x15c255=this[_0xd138('0x1ba')]['sync'](this,_0x5d4689);if(_0x15c255){this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')](_0xd138('0x1bb'),_0x15c255));var _0x28fc7d=this['channel'][_0xd138('0x11c')](_0x15c255);try{fs[_0xd138('0xf6')](_0x15c255+_0xd138('0xf7'));}catch(_0x7afedf){logger[_0xd138('0x24')](_0x7afedf);}return _0x28fc7d;}return this[_0xd138('0x2e')][_0xd138('0x24')](_0x5d4689,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0xd138('0x13')][_0xd138('0x1bc')]=function(_0x2b6f44){logger['info'](util[_0xd138('0x22')](_0xd138('0x1bd'),_0x2b6f44[_0xd138('0x30')]));if(!this['isConfigured'](_0x2b6f44[_0xd138('0x152')])){return this[_0xd138('0x2e')][_0xd138('0x24')](_0x2b6f44,_0xd138('0x159'));}logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0x166'),this[_0xd138('0x2e')][_0xd138('0x33')],_0x2b6f44[_0xd138('0x152')]));var _0x4157fe=this[_0xd138('0x47')][_0xd138('0x63')](this,_0x2b6f44['findBy']);if(_0x4157fe){logger['info'](util[_0xd138('0x22')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xd138('0x2e')][_0xd138('0x33')],_0x2b6f44[_0xd138('0x152')]));this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')](_0xd138('0x153'),this['channel'][_0xd138('0x33')],_0x2b6f44[_0xd138('0x152')]));return{'code':0xc8,'result':'success'};}else{logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0x155'),this[_0xd138('0x2e')][_0xd138('0x33')],_0x2b6f44[_0xd138('0x152')]));this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')](_0xd138('0x155'),this[_0xd138('0x2e')]['callerid'],_0x2b6f44[_0xd138('0x152')]));return{'code':0xc8,'result':_0xd138('0x156')};}};AGIVertices[_0xd138('0x13')]['voicemail']=function(_0x4c2581){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0x1be'),_0x4c2581['label']));var _0x55c6f8=this['channel'][_0xd138('0x4c')]('VOICEMAIL',[_0x4c2581[_0xd138('0x1bf')],_0x4c2581[_0xd138('0x6b')]]);if(_0x55c6f8[_0xd138('0x99')]===-0x1){return _0x55c6f8;}return this['channel'][_0xd138('0x9f')](util[_0xd138('0x22')](_0xd138('0xb8'),_0xd138('0x1c0'),_0x4c2581[_0xd138('0x1bf')]));};AGIVertices[_0xd138('0x13')][_0xd138('0x1c1')]=function(_0x4009f0){logger['info'](util['format'](_0xd138('0x1c2'),_0x4009f0[_0xd138('0x30')]));if(!this[_0xd138('0x79')](_0x4009f0[_0xd138('0xcd')])){return this[_0xd138('0x2e')][_0xd138('0x24')](_0x4009f0,_0xd138('0x1a3'));}var _0x52a095=this[_0xd138('0xf')]['sync'](this,_0x4009f0['variable_id']);if(!_0x52a095){return this[_0xd138('0x2e')]['error'](_0x4009f0,_0xd138('0xcf'));}var _0x1ed2c2=this[_0xd138('0x2e')][_0xd138('0xf')](_0x52a095);return{'code':0xc8,'result':_0x1ed2c2['extra']?_0x1ed2c2['extra']:'-'};};String[_0xd138('0x13')][_0xd138('0x95')]=function(_0x3a153a,_0x3312eb){return this['split'](_0x3a153a)['join'](_0x3312eb);};module[_0xd138('0x1c3')]=AGIVertices; \ No newline at end of file +var _0xd983=['no\x20sms\x20account\x20found','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','no\x20variable\x20selected','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','subproject','project_id','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','util','lodash','shelljs','odbc','randomstring','request-promise','../../config/logger','agi','../../config/environment','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawBody','menu','getdigits','getsecretdigits','channel','rpc','getVariable','name','catch','getVoiceQueue','then','prototype','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','sendMailMessage','mailRpc','getIntervals','interval','map','Intervals','format','getQueryOdbc','open','Error\x20getting\x20ODBC\x20connection\x20%s','query','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','createSquareRecording','calleridname','extension','priority','accountcode','dnid','file','createSquareMessage','isNil','random','isEmpty','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','callerid','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','en-US','audioEncoding','googleTTS','google_tts_language','restAPI','url','method','timeout','includes','POST','PUT','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','headers','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','sestekNDA','ispeechTTS','speed','ispeechASR','ispeech_asr_language','model','awsPolly','aws_access_key_id','aws_polly_region','Amy','aws_text_type','awsLex','aws_secret_access_key','aws_lex_region','googleASR','google_asr_language','tildeASR','appsecret','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','length','saveRestApiResult','isArray','%s.%s','setVariable','split','replaceAll','toString','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','maxRetry','retry','mrcpsynth','noop','no\x20text\x20configured','isConfigured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','no\x20grammar\x20configured','grammar','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','no\x20list\x20selected','delay','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','lumenvoxasr','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','MRCPRecog','RECOG_INPUT()','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s_ROWS_COUNT','variable\x20%s\x20set','debug','no\x20user\x20selected','sip_id','no\x20user\x20found','DIAL','SIP/%s','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','out','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','dialogflowV2_language','Trying\x20DialogflowV2:\x20%s','providerResponse','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','beep','recordFile','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','false','EVAL\x20CONDITION\x20%s\x20%s','condition','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','%s/recordings/%s','NOBEEP','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','streamFile','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','pause_id','playback','PLAYBACK','opts','no\x20queue\x20selected','queue_id','indexOf','toLowerCase','QUEUE','macro','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','sayDigits','digits','saynumber','sayNumber','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','email','user','bcc','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured'];(function(_0x1e1028,_0x3567b0){var _0x485eb1=function(_0x3a1e9a){while(--_0x3a1e9a){_0x1e1028['push'](_0x1e1028['shift']());}};_0x485eb1(++_0x3567b0);}(_0xd983,0x1df));var _0x3d98=function(_0x2c6e35,_0x3c06a0){_0x2c6e35=_0x2c6e35-0x0;var _0x3f9e08=_0xd983[_0x2c6e35];return _0x3f9e08;};'use strict';var fs=require('fs');var util=require(_0x3d98('0x0'));var _=require(_0x3d98('0x1'));var sh=require(_0x3d98('0x2'));var odbc=require(_0x3d98('0x3'))();var rs=require(_0x3d98('0x4'));var moment=require('moment');var Mustache=require('mustache');var rp=require(_0x3d98('0x5'));var logger=require(_0x3d98('0x6'))(_0x3d98('0x7'));var config=require(_0x3d98('0x8'));var shared=require(_0x3d98('0x9'));var scripts=require(_0x3d98('0xa'));var FILES_PATH=_0x3d98('0xb');var recursiveMapAttributes=['rawHeaders',_0x3d98('0xc')];var verticesWithRetry=[_0x3d98('0xd'),_0x3d98('0xe'),_0x3d98('0xf')];var AGIVertices=function(_0x1a9f37,_0x1371ac,_0x274a9f){this[_0x3d98('0x10')]=_0x1a9f37;this[_0x3d98('0x11')]=_0x1371ac;this['mailRpc']=_0x274a9f;};AGIVertices['prototype'][_0x3d98('0x12')]=function(_0x14e758,_0x1d4f59){this[_0x3d98('0x11')]['getVariableById'](_0x14e758)['then'](function(_0x2e98cb){_0x1d4f59(null,_0x2e98cb?_0x2e98cb[_0x3d98('0x13')]:![]);})[_0x3d98('0x14')](function(_0x435621){_0x1d4f59(_0x435621);});};AGIVertices['prototype'][_0x3d98('0x15')]=function(_0x24fbcb,_0x5545b1){this[_0x3d98('0x11')]['getVoiceQueueById'](_0x24fbcb)[_0x3d98('0x16')](function(_0x4fc94d){_0x5545b1(null,_0x4fc94d?_0x4fc94d['name']:![]);})[_0x3d98('0x14')](function(_0xc07e5f){_0x5545b1(_0xc07e5f);});};AGIVertices[_0x3d98('0x17')]['getSquareProject']=function(_0x1e6408,_0x372f29){this['rpc'][_0x3d98('0x18')](_0x1e6408)[_0x3d98('0x16')](function(_0x4e2a73){_0x372f29(null,_0x4e2a73?_0x4e2a73[_0x3d98('0x13')]:![]);})[_0x3d98('0x14')](function(_0x1cea30){_0x372f29(_0x1cea30);});};AGIVertices[_0x3d98('0x17')][_0x3d98('0x19')]=function(_0x55c620,_0x3b6836){this[_0x3d98('0x11')][_0x3d98('0x1a')](_0x55c620)[_0x3d98('0x16')](function(_0x5da20a){_0x3b6836(null,_0x5da20a?_0x5da20a[_0x3d98('0x1b')]:![]);})[_0x3d98('0x14')](function(_0x39c884){_0x3b6836(_0x39c884);});};AGIVertices['prototype'][_0x3d98('0x1c')]=function(_0x9552fb,_0x54177e){this['rpc'][_0x3d98('0x1d')](_0x9552fb)[_0x3d98('0x16')](function(_0x4c4cf8){_0x54177e(null,_0x4c4cf8?_0x4c4cf8[_0x3d98('0x13')]:![]);})[_0x3d98('0x14')](function(_0x366702){_0x54177e(_0x366702);});};AGIVertices[_0x3d98('0x17')]['getTrunk']=function(_0x50de93,_0x4ea96d){this[_0x3d98('0x11')]['getTrunkById'](_0x50de93)[_0x3d98('0x16')](function(_0x867f85){_0x4ea96d(null,_0x867f85?_0x867f85[_0x3d98('0x13')]:![]);})['catch'](function(_0x188041){_0x4ea96d(_0x188041);});};AGIVertices[_0x3d98('0x17')][_0x3d98('0x1e')]=function(_0x2dca32,_0x4409ff){var _0x489a9a=this;this[_0x3d98('0x11')][_0x3d98('0x1f')](_0x2dca32)['then'](function(_0x27b631){_0x4409ff(null,_0x27b631?_0x489a9a[_0x3d98('0x20')](_0x27b631[_0x3d98('0x21')]):![]);})['catch'](function(_0x19d10f){_0x4409ff(_0x19d10f);});};AGIVertices['prototype'][_0x3d98('0x22')]=function(_0x1cfbf4,_0x26df3c){this[_0x3d98('0x11')]['getMailAccountById'](_0x1cfbf4)[_0x3d98('0x16')](function(_0x1b393e){_0x26df3c(null,_0x1b393e?_0x1b393e:![]);})[_0x3d98('0x14')](function(_0xb7f4f5){_0x26df3c(_0xb7f4f5);});};AGIVertices[_0x3d98('0x17')][_0x3d98('0x23')]=function(_0x256e50,_0x4351e2,_0x4f9f13){this[_0x3d98('0x24')][_0x3d98('0x23')](_0x256e50,_0x4351e2)[_0x3d98('0x16')](function(){_0x4f9f13(null);})[_0x3d98('0x14')](function(_0x57c385){_0x4f9f13(_0x57c385);});};AGIVertices['prototype'][_0x3d98('0x25')]=function(_0x4d2ee5,_0x20663e){this['rpc']['getIntervalById'](_0x4d2ee5)[_0x3d98('0x16')](function(_0x561258){if(_0x561258){if(_0x561258['IntervalId']){_0x20663e(null,[_0x561258[_0x3d98('0x26')]]);}else{_0x20663e(null,_[_0x3d98('0x27')](_0x561258[_0x3d98('0x28')],_0x3d98('0x26')));}}else{_0x20663e(null,![]);}})[_0x3d98('0x14')](function(_0x342b8e){_0x20663e(_0x342b8e);});};AGIVertices[_0x3d98('0x17')][_0x3d98('0x20')]=function(_0x44987c){return util[_0x3d98('0x29')]('%s/sounds/converted/%s',FILES_PATH,_0x44987c);};AGIVertices[_0x3d98('0x17')][_0x3d98('0x2a')]=function(_0x35f3d8,_0x48487e,_0x4f4cb2){odbc[_0x3d98('0x2b')](_0x35f3d8,function(_0xffb2b7){if(_0xffb2b7){logger['error'](_0x3d98('0x2c'),_0xffb2b7);_0x4f4cb2(_0xffb2b7);}else{logger['info']('ODBC\x20connection\x20successfully');odbc[_0x3d98('0x2d')](_0x48487e,function(_0x108dc4,_0x384f5b){if(_0x108dc4){logger[_0x3d98('0x2e')](_0x3d98('0x2f'),_0x48487e);_0x4f4cb2(_0x108dc4);}else{logger[_0x3d98('0x2e')](_0x3d98('0x30'),_0x48487e);odbc[_0x3d98('0x31')](function(_0x260cb6){if(_0x260cb6){logger[_0x3d98('0x32')](_0x3d98('0x33'),_0x260cb6);}_0x4f4cb2(null,_0x384f5b);});}});}});};AGIVertices['prototype'][_0x3d98('0x34')]=function(_0x101e22,_0x13bb82){this[_0x3d98('0x11')][_0x3d98('0x35')](_0x101e22)['then'](function(_0x4398c8){_0x13bb82(null,_0x4398c8?_0x4398c8:![]);})['catch'](function(_0x5155d6){_0x13bb82(_0x5155d6);});};AGIVertices[_0x3d98('0x17')][_0x3d98('0x36')]=function(_0x42ce50,_0xf3ffc1){this['rpc'][_0x3d98('0x36')](_0x42ce50)[_0x3d98('0x16')](function(_0xa1b50){_0xf3ffc1(null,_0xa1b50);})[_0x3d98('0x14')](function(_0x4b65fb){_0xf3ffc1(_0x4b65fb);});};AGIVertices['prototype'][_0x3d98('0x37')]=function(_0x821856,_0x170743,_0xfc8cca){this['rpc'][_0x3d98('0x37')]({'uniqueid':this['channel'][_0x3d98('0x38')],'node':_0x821856[_0x3d98('0x39')],'application':_0x821856[_0x3d98('0x3a')],'data':_0x170743||null,'project_name':this[_0x3d98('0x10')][_0x3d98('0x3b')],'callerid':this['channel']['callerid']})[_0x3d98('0x16')](function(_0xbef383){if(_0xfc8cca){_0xfc8cca(null,_0xbef383);}})['catch'](function(_0x2b1c2f){if(_0xfc8cca){_0xfc8cca(_0x2b1c2f);}});};AGIVertices[_0x3d98('0x17')]['createSquareRecording']=function(_0x42de9a,_0x300fd4,_0x9b2474,_0xce93f){this[_0x3d98('0x11')][_0x3d98('0x3c')]({'uniqueid':this[_0x3d98('0x10')][_0x3d98('0x38')],'callerid':this[_0x3d98('0x10')]['callerid'],'calleridname':this['channel'][_0x3d98('0x3d')],'context':this[_0x3d98('0x10')]['context'],'extension':this[_0x3d98('0x10')][_0x3d98('0x3e')],'priority':this[_0x3d98('0x10')][_0x3d98('0x3f')],'accountcode':this['channel'][_0x3d98('0x40')],'dnid':this[_0x3d98('0x10')][_0x3d98('0x41')],'projectName':this[_0x3d98('0x10')][_0x3d98('0x3b')],'saveName':_0x300fd4,'filename':_0x42de9a[_0x3d98('0x42')]||_0x300fd4,'savePath':_0x9b2474})[_0x3d98('0x16')](function(_0x3f3b57){_0xce93f(null,_0x3f3b57);})[_0x3d98('0x14')](function(_0x39b003){_0xce93f(_0x39b003);});};AGIVertices[_0x3d98('0x17')][_0x3d98('0x43')]=function(_0x5ad73a,_0x1245ab,_0x3c1b91,_0xb2456,_0x89b09c){this[_0x3d98('0x11')][_0x3d98('0x43')]({'uniqueid':this['channel']['uniqueid'],'body':_0x5ad73a,'direction':_0x1245ab,'providerName':_0x3c1b91,'providerResponse':_0xb2456})['then'](function(_0xebb2b0){if(_0x89b09c){_0x89b09c(null,_0xebb2b0);}})[_0x3d98('0x14')](function(_0x57f827){if(_0x89b09c){_0x89b09c(_0x57f827);}});};AGIVertices[_0x3d98('0x17')]['createCmContact']=function(_0x1181b9,_0x53be9d){this[_0x3d98('0x11')]['createCmContact']({'firstName':_['isEmpty'](_0x1181b9[_0x3d98('0x13')])||_[_0x3d98('0x44')](_0x1181b9['name'])?'callback_'+Math[_0x3d98('0x45')]():_0x1181b9['name'],'lastName':_[_0x3d98('0x46')](_0x1181b9[_0x3d98('0x47')])||_['isNil'](_0x1181b9[_0x3d98('0x47')])?null:_0x1181b9[_0x3d98('0x47')],'phone':_0x1181b9[_0x3d98('0x48')],'ListId':_0x1181b9[_0x3d98('0x49')],'scheduledat':_0x1181b9[_0x3d98('0x4a')],'callbackUniqueid':this[_0x3d98('0x10')][_0x3d98('0x38')],'tags':_0x3d98('0x4b'),'description':_0x3d98('0x4c')+_0x1181b9[_0x3d98('0x4a')]['toString'](),'priority':_0x1181b9[_0x3d98('0x4d')]})['then'](function(_0x280686){_0x53be9d(null,_0x280686);})['catch'](function(_0x5a0226){_0x53be9d(_0x5a0226);});};AGIVertices[_0x3d98('0x17')][_0x3d98('0x4e')]=function(_0x38e9fa,_0x265ed4){this[_0x3d98('0x11')][_0x3d98('0x4f')](_0x38e9fa)[_0x3d98('0x16')](function(_0x1469f6){_0x265ed4(null,_0x1469f6?_0x1469f6[_0x3d98('0x13')]:![]);})['catch'](function(_0x13156a){_0x265ed4(_0x13156a);});};AGIVertices[_0x3d98('0x17')][_0x3d98('0x50')]=function(_0x196e1a,_0x5b74a9,_0x42f9d1){var _0x2ee695={'role':_0x3d98('0x51')};_0x2ee695[_0x196e1a]=this['channel']['callerid'];this[_0x3d98('0x11')][_0x3d98('0x50')](_0x2ee695,_0x5b74a9,this[_0x3d98('0x10')]['uniqueid'])[_0x3d98('0x16')](function(_0x54efd0){_0x42f9d1(null,_[_0x3d98('0x44')](_0x54efd0)?![]:!![]);})[_0x3d98('0x14')](function(_0x9acea7){logger[_0x3d98('0x32')](_0x9acea7);_0x42f9d1(null,![]);});};AGIVertices[_0x3d98('0x17')][_0x3d98('0x52')]=function(_0x4a8ae9,_0x239992){var _0x1bd569={'role':'agent'};_0x1bd569[_0x4a8ae9]=this[_0x3d98('0x10')][_0x3d98('0x53')];this[_0x3d98('0x11')][_0x3d98('0x52')](_0x1bd569)[_0x3d98('0x16')](function(_0x474e24){_0x239992(null,_[_0x3d98('0x44')](_0x474e24)?![]:!![]);})[_0x3d98('0x14')](function(_0x9ad436){logger[_0x3d98('0x32')](_0x9ad436);_0x239992(null,![]);});};AGIVertices[_0x3d98('0x17')][_0x3d98('0x54')]=function(_0x213a84,_0xd12ea){var _0x16bf38={'role':_0x3d98('0x51')};_0x16bf38[_0x213a84]=this[_0x3d98('0x10')][_0x3d98('0x53')];this[_0x3d98('0x11')][_0x3d98('0x54')](_0x16bf38)[_0x3d98('0x16')](function(_0x63930a){_0xd12ea(null,_['isNil'](_0x63930a)?![]:!![]);})['catch'](function(_0x398c9c){logger['error'](_0x398c9c);_0xd12ea(null,![]);});};AGIVertices[_0x3d98('0x17')][_0x3d98('0x55')]=function(_0x4fef56,_0xf4a5fb){var _0x73964={'role':_0x3d98('0x51')};_0x73964[_0x4fef56]=this['channel'][_0x3d98('0x53')];var _0x3bad17=_0x4fef56!=_0x3d98('0x56')?util['format'](_0x3d98('0x57'),_0x3d98('0x58'),this['channel'][_0x3d98('0x53')]):undefined;this[_0x3d98('0x11')]['agentLogin'](_0x73964,_0x3bad17)['then'](function(_0x4ec95a){_0xf4a5fb(null,_['isNil'](_0x4ec95a)?![]:!![]);})['catch'](function(_0x437630){logger[_0x3d98('0x32')](_0x437630);_0xf4a5fb(null,![]);});};AGIVertices[_0x3d98('0x17')][_0x3d98('0x59')]=function(_0x2ee389,_0x645236){sh[_0x3d98('0x5a')](_[_0x3d98('0x5b')](_0x2ee389),function(_0x4542d4,_0xf29b55){var _0x6df858=_0xf29b55[_0x3d98('0x5c')](/(\r\n|\n|\r)/gm,'');_0x645236(null,_0x6df858);});};AGIVertices['prototype']['googleCloudTTS']=function(_0x2c16eb,_0x5b1184){scripts[_0x3d98('0x5d')](_0x2c16eb['apiKey'],_0x2c16eb[_0x3d98('0x5e')]||'text',_0x2c16eb[_0x3d98('0x5f')],_0x2c16eb[_0x3d98('0x60')]||_0x3d98('0x61'),_0x2c16eb['ssmlGender']||'MALE',_0x2c16eb[_0x3d98('0x62')]||'MP3')[_0x3d98('0x16')](function(_0x5cf6ab){_0x5b1184(null,_0x5cf6ab);})[_0x3d98('0x14')](function(_0x28ff9b){_0x5b1184(_0x28ff9b);});};AGIVertices[_0x3d98('0x17')][_0x3d98('0x63')]=function(_0x228635,_0x583e3f){scripts[_0x3d98('0x63')](_0x228635[_0x3d98('0x5f')],_0x228635[_0x3d98('0x64')]||'en',0x1)[_0x3d98('0x16')](function(_0x1be083){_0x583e3f(null,_0x1be083);})[_0x3d98('0x14')](function(_0x4fe38a){_0x583e3f(_0x4fe38a);});};AGIVertices[_0x3d98('0x17')][_0x3d98('0x65')]=function(_0x10056e,_0x146abf){var _0x55ebfb={'uri':_0x10056e[_0x3d98('0x66')],'method':_0x10056e[_0x3d98('0x67')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x10056e[_0x3d98('0x68')])==='number'&&parseInt(_0x10056e[_0x3d98('0x68')])>=0x1?parseInt(_0x10056e[_0x3d98('0x68')])*0x3e8:0x5*0x3e8};if(_[_0x3d98('0x69')]([_0x3d98('0x6a'),_0x3d98('0x6b')],_0x55ebfb[_0x3d98('0x67')]['toUpperCase']())){try{_0x55ebfb[_0x3d98('0x6c')]=_0x10056e[_0x3d98('0xc')]?JSON[_0x3d98('0x6d')](_0x10056e[_0x3d98('0xc')]):{};}catch(_0x53a659){logger[_0x3d98('0x32')](_0x3d98('0x6e'),_0x53a659);}}try{_0x55ebfb['headers']=_0x10056e[_0x3d98('0x6f')]?JSON[_0x3d98('0x6d')](_0x10056e['rawHeaders']):{};}catch(_0x2ebbf9){logger[_0x3d98('0x32')](_0x3d98('0x70'),_0x2ebbf9);}if(_0x10056e[_0x3d98('0x71')]){try{var _0x2941f4=require(_0x10056e[_0x3d98('0x71')])[_0x3d98('0x72')](this,_0x55ebfb);_0x55ebfb[_0x3d98('0x73')]=Mustache[_0x3d98('0x74')](_0x10056e['url'],_0x2941f4,{},['$$','$$']);if(_0x55ebfb[_0x3d98('0x75')]){_0x55ebfb[_0x3d98('0x75')]=JSON[_0x3d98('0x6d')](Mustache[_0x3d98('0x74')](JSON[_0x3d98('0x76')](_0x55ebfb['headers']),_0x2941f4,{},['$$','$$']));}if(_0x55ebfb[_0x3d98('0x6c')]){_0x55ebfb[_0x3d98('0x6c')]=JSON[_0x3d98('0x6d')](Mustache[_0x3d98('0x74')](JSON[_0x3d98('0x76')](_0x55ebfb['body']),_0x2941f4,{},['$$','$$']));}}catch(_0x20416b){logger[_0x3d98('0x32')](_0x3d98('0x77'),_0x20416b);}}rp(_0x55ebfb)[_0x3d98('0x16')](function(_0xa8dc68){var _0x19c42c={'statusCode':_0xa8dc68[_0x3d98('0x78')]||0xc8,'statusMessage':_0xa8dc68[_0x3d98('0x79')]||'OK','headers':_0xa8dc68['headers']||{},'body':_0xa8dc68['body']||{}};_0x146abf(null,_0x19c42c);})['catch'](function(_0x1935e5){var _0x250afd={'statusCode':_0x1935e5['statusCode']||0x1f4,'statusMessage':_0x1935e5['message']||_0x3d98('0x7a'),'headers':_0x1935e5[_0x3d98('0x7b')][_0x3d98('0x75')]||{},'body':_0x1935e5[_0x3d98('0x7b')][_0x3d98('0x6c')]||{}};_0x146abf(null,_0x250afd);});};AGIVertices['prototype'][_0x3d98('0x7c')]=function(_0x584476,_0x584e70){scripts[_0x3d98('0x7c')](this['channel'][_0x3d98('0x38')],_0x584476[_0x3d98('0x7d')],_0x584476[_0x3d98('0x5f')],_0x584476[_0x3d98('0x7e')]||'en')[_0x3d98('0x16')](function(_0x4b7cf1){_0x584e70(null,_0x4b7cf1);})[_0x3d98('0x14')](function(_0x479d06){_0x584e70(_0x479d06);});};AGIVertices['prototype']['googleDialogflowV2']=function(_0x4e9fee,_0x4ef15f){scripts[_0x3d98('0x7f')](this[_0x3d98('0x10')][_0x3d98('0x38')],_0x4e9fee[_0x3d98('0x80')],_0x4e9fee[_0x3d98('0x81')],_0x4e9fee[_0x3d98('0x82')],_0x4e9fee[_0x3d98('0x5f')],_0x4e9fee['dialogflowV2_language']||'en')['then'](function(_0x3c34af){_0x4ef15f(null,_0x3c34af);})[_0x3d98('0x14')](function(_0x3eb946){_0x4ef15f(_0x3eb946);});};AGIVertices['prototype']['sestekNDA']=function(_0x2db0ed,_0x5bf589){scripts[_0x3d98('0x83')](this[_0x3d98('0x10')],_0x2db0ed)[_0x3d98('0x16')](function(_0x5e5619){_0x5bf589(null,_0x5e5619);})[_0x3d98('0x14')](function(_0x94eba6){_0x5bf589(_0x94eba6);});};AGIVertices['prototype'][_0x3d98('0x84')]=function(_0x23a98f,_0x390cfa){scripts[_0x3d98('0x84')](_0x23a98f[_0x3d98('0x7d')],_0x23a98f['text'],_0x23a98f['ispeech_tts_language']||_0x3d98('0x61'),_0x23a98f[_0x3d98('0x85')])[_0x3d98('0x16')](function(_0x409e2d){_0x390cfa(null,_0x409e2d);})['catch'](function(_0x84a002){_0x390cfa(_0x84a002);});};AGIVertices['prototype'][_0x3d98('0x86')]=function(_0x535e16,_0x22546c,_0x30f7c1){scripts[_0x3d98('0x86')](_0x22546c,_0x535e16[_0x3d98('0x7d')],_0x535e16[_0x3d98('0x87')]||_0x3d98('0x61'),this['isConfigured'](_0x535e16[_0x3d98('0x88')])?_0x535e16[_0x3d98('0x88')]:undefined)[_0x3d98('0x16')](function(_0x46b22b){_0x30f7c1(null,_0x46b22b);})[_0x3d98('0x14')](function(_0x4b9009){_0x30f7c1(_0x4b9009);});};AGIVertices[_0x3d98('0x17')][_0x3d98('0x89')]=function(_0xc06362,_0x1d9ed6){scripts[_0x3d98('0x89')](_0xc06362[_0x3d98('0x8a')],_0xc06362['aws_secret_access_key'],_0xc06362[_0x3d98('0x8b')],_0xc06362['aws_polly_voice']||_0x3d98('0x8c'),_0xc06362[_0x3d98('0x5f')],_0xc06362[_0x3d98('0x8d')]||'text')['then'](function(_0x4a15b2){_0x1d9ed6(null,_0x4a15b2);})['catch'](function(_0x394b65){_0x1d9ed6(_0x394b65);});};AGIVertices[_0x3d98('0x17')][_0x3d98('0x8e')]=function(_0xd25db0,_0x15eb74){scripts[_0x3d98('0x8e')](this['channel']['uniqueid'],_0xd25db0[_0x3d98('0x8a')],_0xd25db0[_0x3d98('0x8f')],_0xd25db0[_0x3d98('0x90')],_0xd25db0['text'],_0xd25db0['aws_bot_name'])[_0x3d98('0x16')](function(_0x36ab1a){_0x15eb74(null,_0x36ab1a);})[_0x3d98('0x14')](function(_0x532145){_0x15eb74(_0x532145);});};AGIVertices['prototype']['googleASR']=function(_0x32e654,_0x5bb287,_0x48cde9){scripts[_0x3d98('0x91')](_0x5bb287,_0x32e654[_0x3d98('0x7d')],_0x32e654[_0x3d98('0x92')]||'en-US')[_0x3d98('0x16')](function(_0x82f544){_0x48cde9(null,_0x82f544);})[_0x3d98('0x14')](function(_0x127ae8){_0x48cde9(_0x127ae8);});};AGIVertices[_0x3d98('0x17')][_0x3d98('0x93')]=function(_0x1115ba,_0x5084b3,_0x5919d3){scripts[_0x3d98('0x93')](_0x5084b3,_0x1115ba['appid'],_0x1115ba[_0x3d98('0x94')],_0x1115ba[_0x3d98('0x73')])['then'](function(_0x49db5a){_0x5919d3(null,_0x49db5a);})[_0x3d98('0x14')](function(_0xf0e7b4){_0x5919d3(_0xf0e7b4);});};AGIVertices['prototype'][_0x3d98('0x95')]=function(_0xb67ce0){var _0x487c80=_[_0x3d98('0x69')](verticesWithRetry,_0xb67ce0[_0x3d98('0x3a')])?_0xb67ce0:_[_0x3d98('0x96')](_0xb67ce0);for(var _0x25f789 in _0x487c80){if(_0x487c80[_0x3d98('0x97')](_0x25f789)){if(_0x487c80[_0x25f789]&&_[_0x3d98('0x98')](_0x487c80[_0x25f789])){if(_[_0x3d98('0x69')](recursiveMapAttributes,_0x25f789)){_0x487c80[_0x25f789]=this[_0x3d98('0x99')](_0x487c80[_0x25f789]);}else{_0x487c80[_0x25f789]=this[_0x3d98('0x9a')](_0x487c80[_0x25f789]);}}}}return _0x487c80;};AGIVertices[_0x3d98('0x17')][_0x3d98('0x9b')]=function(_0x3cf63f){for(var _0x5a6f11 in _0x3cf63f){if(_0x3cf63f[_0x3d98('0x97')](_0x5a6f11)){if(_['isPlainObject'](_0x3cf63f[_0x5a6f11])){this['recursiveNodeIndex'](_0x3cf63f[_0x5a6f11]);}else if(_['isArray'](_0x3cf63f[_0x5a6f11])){for(var _0xe71915=0x0;_0xe71915<_0x3cf63f[_0x5a6f11][_0x3d98('0x9c')];_0xe71915++){this['recursiveNodeIndex'](_0x3cf63f[_0x5a6f11][_0xe71915]);}}else if(_['isString'](_0x3cf63f[_0x5a6f11])){_0x3cf63f[_0x5a6f11]=this[_0x3d98('0x9a')](_0x3cf63f[_0x5a6f11]);}}}};AGIVertices['prototype'][_0x3d98('0x9d')]=function(_0x581f48,_0x31105f){for(var _0x51b9ae in _0x581f48){if(_0x581f48[_0x3d98('0x97')](_0x51b9ae)){if(_['isPlainObject'](_0x581f48[_0x51b9ae])){if(!_[_0x3d98('0x46')](_0x581f48[_0x51b9ae])){this[_0x3d98('0x9d')](_0x581f48[_0x51b9ae],util[_0x3d98('0x29')]('%s.%s',_0x31105f,_0x51b9ae));}}else if(_[_0x3d98('0x9e')](_0x581f48[_0x51b9ae])){for(var _0x338c8f=0x0;_0x338c8f<_0x581f48[_0x51b9ae][_0x3d98('0x9c')];_0x338c8f++){this[_0x3d98('0x9d')](_0x581f48[_0x51b9ae][_0x338c8f],util['format'](_0x3d98('0x9f'),_0x31105f,_0x51b9ae+'['+_0x338c8f+']'));}}else{if(!_[_0x3d98('0x44')](_0x581f48[_0x51b9ae])){this[_0x3d98('0x10')][_0x3d98('0xa0')](util[_0x3d98('0x29')]('%s.%s',_0x31105f,_0x51b9ae),_0x581f48[_0x51b9ae]);}}}}};AGIVertices[_0x3d98('0x17')][_0x3d98('0x99')]=function(_0x42da17){try{var _0x5e2b18=JSON[_0x3d98('0x6d')](_0x42da17);this['recursiveNodeIndex'](_0x5e2b18);return JSON['stringify'](_0x5e2b18);}catch(_0x5873e4){return this[_0x3d98('0x9a')](_0x42da17);}};AGIVertices[_0x3d98('0x17')][_0x3d98('0x9a')]=function(_0x5f4bbc){var _0x41bc30=_0x5f4bbc[_0x3d98('0xa1')]('{');for(var _0x48961a=0x1;_0x48961a<_0x41bc30[_0x3d98('0x9c')];_0x48961a+=0x1){var _0x14a8c4=_0x41bc30[_0x48961a]['split']('}');if(_0x14a8c4['length']>0x1){_0x5f4bbc=_0x5f4bbc[_0x3d98('0xa2')]('{'+_0x14a8c4[0x0]+'}',this[_0x3d98('0x10')]['getVariable'](_0x14a8c4[0x0])['extra']||_0x14a8c4[0x0]);}}if(_0x41bc30[_0x3d98('0x9c')]===0x1){return _0x5f4bbc[_0x3d98('0xa3')]();}return this[_0x3d98('0x9a')](_0x5f4bbc);};AGIVertices[_0x3d98('0x17')]['getAndSetVariable']=function(_0x465398,_0x4d3ab6){var _0x12be46=this[_0x3d98('0x10')]['getVariable'](_0x465398);if(_0x12be46[_0x3d98('0xa4')]===-0x1){return _0x12be46;}logger[_0x3d98('0x2e')](util[_0x3d98('0x29')](_0x3d98('0xa5'),_0x4d3ab6,_0x12be46[_0x3d98('0xa6')]));return this[_0x3d98('0x10')][_0x3d98('0xa0')](_0x4d3ab6,_0x12be46[_0x3d98('0xa6')]);};AGIVertices['prototype']['isConfigured']=function(_0x2f4560){return _0x2f4560&&_0x2f4560!=='0'&&_0x2f4560!=='-1'&&_0x2f4560!=='';};AGIVertices[_0x3d98('0x17')][_0x3d98('0xa7')]=function(_0x5aae9c){this[_0x3d98('0x37')][_0x3d98('0x72')](this,_0x5aae9c,'-');_0x5aae9c[_0x3d98('0xa8')]=_0x5aae9c[_0x3d98('0xa7')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x3d98('0x17')][_0x3d98('0xa9')]=function(_0x5579e6){logger[_0x3d98('0x2e')](util['format']('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x5579e6[_0x3d98('0x39')]));if(!this['isConfigured'](_0x5579e6[_0x3d98('0x5f')])){return this[_0x3d98('0x10')][_0x3d98('0xaa')](_0x3d98('0xab'));}var _0x3f698b='\x22'+_0x5579e6[_0x3d98('0x5f')]+'\x22';if(this[_0x3d98('0xac')](_0x5579e6[_0x3d98('0x7b')])){_0x3f698b+=','+_0x5579e6[_0x3d98('0x7b')];}var _0x177dd1=this[_0x3d98('0x10')][_0x3d98('0x5a')](_0x3d98('0xad'),_0x3f698b);if(_0x177dd1[_0x3d98('0xa4')]===-0x1){return _0x177dd1;}return this['channel'][_0x3d98('0xaa')](util[_0x3d98('0x29')](_0x3d98('0xae'),_0x3f698b));};AGIVertices[_0x3d98('0x17')]['mrcprecog']=function(_0xd2ca7a){logger[_0x3d98('0x2e')](util[_0x3d98('0x29')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0xd2ca7a['label']));if(!this[_0x3d98('0xac')](_0xd2ca7a['grammar'])){return this[_0x3d98('0x10')][_0x3d98('0xaa')](_0x3d98('0xaf'));}var _0x5f0b95=_0xd2ca7a[_0x3d98('0xb0')];if(this[_0x3d98('0xac')](_0xd2ca7a['options'])){_0x5f0b95+=','+_0xd2ca7a[_0x3d98('0x7b')];}var _0x1cb860=this[_0x3d98('0x10')][_0x3d98('0x5a')]('MRCPRecog',_0x5f0b95);if(_0x1cb860['result']===-0x1){return _0x1cb860;}var _0x35de08=this[_0x3d98('0xb1')](_0x3d98('0xb2'),_0x3d98('0xb3'));if(_0x35de08['result']===-0x1){return _0x35de08;}var _0x60707e=this[_0x3d98('0xb1')]('RECOG_INPUT()',_0x3d98('0xb4'));if(_0x60707e[_0x3d98('0xa4')]===-0x1){return _0x60707e;}var _0x291fc1=this[_0x3d98('0xb1')](_0x3d98('0xb5'),_0x3d98('0xb6'));if(_0x291fc1[_0x3d98('0xa4')]===-0x1){return _0x291fc1;}return this[_0x3d98('0x10')][_0x3d98('0xaa')](util[_0x3d98('0x29')](_0x3d98('0xb7'),_0x5f0b95));};AGIVertices[_0x3d98('0x17')][_0x3d98('0x7')]=function(_0x1f0e54){logger[_0x3d98('0x2e')](util['format'](_0x3d98('0xb8'),_0x1f0e54['label']));return this[_0x3d98('0x10')][_0x3d98('0x7')]([_0x1f0e54[_0x3d98('0xb9')],_0x1f0e54[_0x3d98('0xba')]]);};AGIVertices[_0x3d98('0x17')][_0x3d98('0xbb')]=function(_0x4debc6){logger[_0x3d98('0x2e')](util[_0x3d98('0x29')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x4debc6[_0x3d98('0x39')]));if(this[_0x3d98('0xac')](_0x4debc6[_0x3d98('0x68')])){logger[_0x3d98('0x2e')](util[_0x3d98('0x29')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x4debc6[_0x3d98('0x68')]));var _0xb0f038=this[_0x3d98('0x10')]['wait'](_0x4debc6['timeout']);if(_0xb0f038['result']===-0x1){return _0xb0f038;}}return this['channel']['answer']();};AGIVertices['prototype'][_0x3d98('0x4b')]=function(_0x4d7b52){logger[_0x3d98('0x2e')](util['format']('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x4d7b52[_0x3d98('0x39')]));if(!this['isConfigured'](_0x4d7b52['list_id'])){return this[_0x3d98('0x10')]['error'](_0x4d7b52,_0x3d98('0xbc'));}_0x4d7b52[_0x3d98('0x4a')]=moment();if(this[_0x3d98('0xac')](_0x4d7b52[_0x3d98('0xbd')])){_0x4d7b52[_0x3d98('0x4a')]=moment()['add'](_0x4d7b52['delay'],'minutes');}if(!this[_0x3d98('0xac')](_0x4d7b52[_0x3d98('0x4d')])){_0x4d7b52[_0x3d98('0x4d')]=0x2;}this['createCmContact']['sync'](this,_0x4d7b52);return this['channel'][_0x3d98('0xaa')](util['format'](_0x3d98('0xbe'),_0x4d7b52[_0x3d98('0x48')],_0x4d7b52[_0x3d98('0x49')],_0x4d7b52[_0x3d98('0x4a')]));};AGIVertices[_0x3d98('0x17')][_0x3d98('0xbf')]=function(_0x5678cd){logger[_0x3d98('0x2e')](util['format']('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x5678cd[_0x3d98('0x39')]));var _0x4375a4=this['channel'][_0x3d98('0x5a')](_0x5678cd[_0x3d98('0xc0')],_0x5678cd['options']);if(_0x4375a4['result']===-0x1){return _0x4375a4;}return this['channel'][_0x3d98('0xaa')](util[_0x3d98('0x29')](_0x3d98('0xc1'),_0x5678cd[_0x3d98('0xc0')],_0x5678cd['options']));};AGIVertices['prototype'][_0x3d98('0xc2')]=function(_0x19fd56){logger[_0x3d98('0x2e')](util[_0x3d98('0x29')](_0x3d98('0xc3'),_0x19fd56[_0x3d98('0x39')]));if(!this['isConfigured'](_0x19fd56[_0x3d98('0x5f')])){return this[_0x3d98('0x10')][_0x3d98('0xaa')]('no\x20text\x20configured');}var _0x19a45a='\x22'+_0x19fd56[_0x3d98('0x5f')]+'\x22';if(this[_0x3d98('0xac')](_0x19fd56[_0x3d98('0x7b')])){_0x19a45a+=','+_0x19fd56[_0x3d98('0x7b')];}var _0x10e0cc=this[_0x3d98('0x10')]['exec']('MRCPSynth',_0x19a45a);if(_0x10e0cc['result']===-0x1){return _0x10e0cc;}return this[_0x3d98('0x10')][_0x3d98('0xaa')](util[_0x3d98('0x29')](_0x3d98('0xae'),_0x19a45a));};AGIVertices[_0x3d98('0x17')][_0x3d98('0xc4')]=function(_0x31be80){logger[_0x3d98('0x2e')](util[_0x3d98('0x29')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x31be80[_0x3d98('0x39')]));if(!this[_0x3d98('0xac')](_0x31be80['text'])){return this[_0x3d98('0x10')][_0x3d98('0xaa')](_0x3d98('0xab'));}var _0x2d756d='\x22'+_0x31be80[_0x3d98('0x5f')]+'\x22';if(this[_0x3d98('0xac')](_0x31be80[_0x3d98('0x7b')])){_0x2d756d+=','+_0x31be80[_0x3d98('0x7b')];}var _0x1ddc27=this[_0x3d98('0x10')][_0x3d98('0x5a')](_0x3d98('0xad'),_0x2d756d);if(_0x1ddc27['result']===-0x1){return _0x1ddc27;}return this[_0x3d98('0x10')]['noop'](util['format'](_0x3d98('0xae'),_0x2d756d));};AGIVertices[_0x3d98('0x17')][_0x3d98('0xc5')]=function(_0x853057){logger[_0x3d98('0x2e')](util[_0x3d98('0x29')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x853057['label']));if(!this[_0x3d98('0xac')](_0x853057[_0x3d98('0xb0')])){return this['channel'][_0x3d98('0xaa')](_0x3d98('0xaf'));}var _0x35fcf5=_0x853057[_0x3d98('0xb0')];if(this[_0x3d98('0xac')](_0x853057[_0x3d98('0x7b')])){_0x35fcf5+=','+_0x853057[_0x3d98('0x7b')];}var _0x543237=this[_0x3d98('0x10')][_0x3d98('0x5a')]('MRCPRecog',_0x35fcf5);if(_0x543237['result']===-0x1){return _0x543237;}var _0x1d9a8e=this[_0x3d98('0xb1')](_0x3d98('0xb2'),_0x3d98('0xc6'));if(_0x1d9a8e[_0x3d98('0xa4')]===-0x1){return _0x1d9a8e;}var _0x544e67=this[_0x3d98('0xb1')]('RECOG_INPUT()',_0x3d98('0xc7'));if(_0x544e67[_0x3d98('0xa4')]===-0x1){return _0x544e67;}var _0x4b23ea=this[_0x3d98('0xb1')](_0x3d98('0xb5'),_0x3d98('0xc8'));if(_0x4b23ea[_0x3d98('0xa4')]===-0x1){return _0x4b23ea;}return this[_0x3d98('0x10')][_0x3d98('0xaa')](util[_0x3d98('0x29')](_0x3d98('0xb7'),_0x35fcf5));};AGIVertices[_0x3d98('0x17')][_0x3d98('0xc9')]=function(_0x2c005a){logger[_0x3d98('0x2e')](util[_0x3d98('0x29')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x2c005a[_0x3d98('0x39')]));if(!this[_0x3d98('0xac')](_0x2c005a[_0x3d98('0xb0')])){return this[_0x3d98('0x10')][_0x3d98('0xaa')]('no\x20grammar\x20configured');}var _0x21dbba=_0x2c005a[_0x3d98('0xb0')];if(this['isConfigured'](_0x2c005a[_0x3d98('0x7b')])){_0x21dbba+=','+_0x2c005a[_0x3d98('0x7b')];}var _0x30c847=this[_0x3d98('0x10')][_0x3d98('0x5a')](_0x3d98('0xca'),_0x21dbba);if(_0x30c847[_0x3d98('0xa4')]===-0x1){return _0x30c847;}var _0x42cda9=this['getAndSetVariable'](_0x3d98('0xb2'),'SESTEK_ASR_CONFIDENCE');if(_0x42cda9['result']===-0x1){return _0x42cda9;}var _0x4946de=this['getAndSetVariable'](_0x3d98('0xcb'),_0x3d98('0xcc'));if(_0x4946de[_0x3d98('0xa4')]===-0x1){return _0x4946de;}var _0x2b4ab6=this[_0x3d98('0xb1')](_0x3d98('0xb5'),_0x3d98('0xcd'));if(_0x2b4ab6[_0x3d98('0xa4')]===-0x1){return _0x2b4ab6;}return this['channel'][_0x3d98('0xaa')](util[_0x3d98('0x29')](_0x3d98('0xb7'),_0x21dbba));};AGIVertices[_0x3d98('0x17')][_0x3d98('0xce')]=function(_0x57afb0){logger[_0x3d98('0x2e')](util[_0x3d98('0x29')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x57afb0[_0x3d98('0x39')]));if(!this['isConfigured'](_0x57afb0[_0x3d98('0xcf')])){return this[_0x3d98('0x10')][_0x3d98('0x32')](_0x57afb0,_0x3d98('0xd0'));}var _0x53c46e=this[_0x3d98('0x19')][_0x3d98('0x72')](this,_0x57afb0['odbc_id']);if(!_0x53c46e){return this[_0x3d98('0x10')]['error'](_0x57afb0,_0x3d98('0xd1'));}if(!this[_0x3d98('0xac')](_0x57afb0[_0x3d98('0x2d')])){return this[_0x3d98('0x10')][_0x3d98('0x32')](_0x57afb0,_0x3d98('0xd2'));}var _0x3a235d=_0x57afb0['query'][_0x3d98('0x5c')](/(\r\n|\n|\r)/gm,'\x20');this[_0x3d98('0x10')][_0x3d98('0xaa')](util[_0x3d98('0x29')]('query:\x20%s',_0x3a235d));var _0x2e05f1=this[_0x3d98('0x2a')]['sync'](this,_0x53c46e,_0x3a235d);this[_0x3d98('0x37')][_0x3d98('0x72')](this,_0x57afb0,_0x3a235d);if(!this[_0x3d98('0xac')](_0x57afb0[_0x3d98('0xd3')])){return this[_0x3d98('0x10')]['noop'](_0x3d98('0xd4'));}var _0x165911=this[_0x3d98('0x12')][_0x3d98('0x72')](this,_0x57afb0['variable_id']);if(!_0x165911){return this[_0x3d98('0x10')][_0x3d98('0x32')](_0x57afb0,_0x3d98('0xd5'));}var _0x266184=this;_0x2e05f1[_0x3d98('0xd6')](function(_0xee5f9a,_0xb8689e){Object[_0x3d98('0xd7')](_0xee5f9a)[_0x3d98('0xd6')](function(_0x543ea2){_0x266184[_0x3d98('0x10')]['setVariable'](util[_0x3d98('0x29')]('%s[%s][%s]',_0x165911,_0xb8689e,_0x543ea2),_0xee5f9a[_0x543ea2]);});});this[_0x3d98('0x10')][_0x3d98('0xa0')](util['format'](_0x3d98('0xd8'),_0x165911),_0x2e05f1[_0x3d98('0x9c')]);return this[_0x3d98('0x10')]['noop'](util['format'](_0x3d98('0xd9'),_0x165911));};AGIVertices['prototype']['dial']=function(_0x365b46){logger[_0x3d98('0xda')](util[_0x3d98('0x29')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x365b46[_0x3d98('0x39')]));if(!this[_0x3d98('0xac')](_0x365b46['sip_id'])){return this[_0x3d98('0x10')][_0x3d98('0x32')](_0x365b46,_0x3d98('0xdb'));}var _0x5108d1=this['getUser']['sync'](this,_0x365b46[_0x3d98('0xdc')]);if(!_0x5108d1){return this[_0x3d98('0x10')][_0x3d98('0x32')](_0x365b46,_0x3d98('0xdd'));}var _0x358714=this[_0x3d98('0x10')][_0x3d98('0x5a')](_0x3d98('0xde'),[util[_0x3d98('0x29')](_0x3d98('0xdf'),_0x5108d1),_0x365b46['timeout'],_0x365b46['opts'],_0x365b46[_0x3d98('0x66')]]);if(_0x358714[_0x3d98('0xa4')]===-0x1){return _0x358714;}return this[_0x3d98('0x10')]['noop'](util[_0x3d98('0x29')](_0x3d98('0xe0'),_0x3d98('0xde')));};AGIVertices[_0x3d98('0x17')][_0x3d98('0xe1')]=function(_0x566f7c){logger[_0x3d98('0x2e')](util['format'](_0x3d98('0xe2'),_0x566f7c['label']));if(!this[_0x3d98('0xac')](_0x566f7c[_0x3d98('0x7d')])){return this[_0x3d98('0x10')][_0x3d98('0xaa')](_0x3d98('0xe3'));}if(!this['isConfigured'](_0x566f7c[_0x3d98('0x5f')])){return this['channel'][_0x3d98('0xaa')]('no\x20text\x20configured');}this[_0x3d98('0x10')][_0x3d98('0xe4')]=!![];this[_0x3d98('0x37')](_0x566f7c);this[_0x3d98('0x43')](_0x566f7c['text'],'in','','');this['channel'][_0x3d98('0xaa')](util[_0x3d98('0x29')](_0x3d98('0xe5'),_0x566f7c[_0x3d98('0x5f')]));var _0x580762=this[_0x3d98('0x7c')][_0x3d98('0x72')](this,_0x566f7c);if(_0x580762){for(var _0x4dcf3e in _0x580762){if(_0x580762[_0x3d98('0x97')](_0x4dcf3e)){this[_0x3d98('0x10')][_0x3d98('0xa0')](util[_0x3d98('0x29')](_0x3d98('0xe6'),_0x4dcf3e[_0x3d98('0xe7')]()),_0x580762[_0x4dcf3e]);}}this['createSquareMessage'](_0x580762['speech'],_0x3d98('0xe8'),_0x3d98('0xe1'),'');return this[_0x3d98('0x10')][_0x3d98('0xaa')](util[_0x3d98('0x29')]('Dialogflow\x20Result\x20%s',_0x580762[_0x3d98('0xe9')]));}return this[_0x3d98('0x10')][_0x3d98('0x32')](_0x566f7c,_0x3d98('0xea'));};AGIVertices['prototype'][_0x3d98('0xeb')]=function(_0x24bbe9){logger[_0x3d98('0x2e')](util[_0x3d98('0x29')](_0x3d98('0xec'),_0x24bbe9[_0x3d98('0x39')]));if(!this[_0x3d98('0xac')](_0x24bbe9['dialogflowV2_project_id'])){return this[_0x3d98('0x10')][_0x3d98('0xaa')](_0x3d98('0xed'));}if(!this[_0x3d98('0xac')](_0x24bbe9[_0x3d98('0x81')])){return this[_0x3d98('0x10')][_0x3d98('0xaa')](_0x3d98('0xee'));}if(!this[_0x3d98('0xac')](_0x24bbe9[_0x3d98('0x82')])){return this[_0x3d98('0x10')]['noop'](_0x3d98('0xef'));}if(!this[_0x3d98('0xac')](_0x24bbe9[_0x3d98('0xf0')])){return this[_0x3d98('0x10')]['noop']('no\x20anguage\x20configured');}if(!this['isConfigured'](_0x24bbe9[_0x3d98('0x5f')])){return this['channel'][_0x3d98('0xaa')](_0x3d98('0xab'));}this[_0x3d98('0x10')][_0x3d98('0xe4')]=!![];this[_0x3d98('0x37')](_0x24bbe9);this['createSquareMessage'](_0x24bbe9[_0x3d98('0x5f')],'in','','');this[_0x3d98('0x10')][_0x3d98('0xaa')](util[_0x3d98('0x29')](_0x3d98('0xf1'),_0x24bbe9[_0x3d98('0x5f')]));var _0x19bce4=this[_0x3d98('0x7f')][_0x3d98('0x72')](this,_0x24bbe9);if(_0x19bce4){for(var _0x4a5095 in _0x19bce4){if(_0x19bce4[_0x3d98('0x97')](_0x4a5095)){if(_0x4a5095!==_0x3d98('0xf2')){this[_0x3d98('0x10')][_0x3d98('0xa0')](util[_0x3d98('0x29')](_0x3d98('0xe6'),_0x4a5095[_0x3d98('0xe7')]()),_0x19bce4[_0x4a5095]);}}}this[_0x3d98('0x43')](_0x19bce4['speech'],_0x3d98('0xe8'),_0x3d98('0xeb'),_0x19bce4[_0x3d98('0xf2')]);return this[_0x3d98('0x10')][_0x3d98('0xaa')](util[_0x3d98('0x29')]('DialogflowV2\x20Result\x20%s',_0x19bce4[_0x3d98('0xe9')]));}return this[_0x3d98('0x10')][_0x3d98('0x32')](_0x24bbe9,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x3d98('0x17')][_0x3d98('0xf3')]=function(_0x403adc){logger[_0x3d98('0x2e')](util[_0x3d98('0x29')](_0x3d98('0xf4'),_0x403adc['label']));if(!this['isConfigured'](_0x403adc['ndauth_url'])){return this['channel'][_0x3d98('0xaa')](_0x3d98('0xf5'));}if(!this[_0x3d98('0xac')](_0x403adc[_0x3d98('0xf6')])){return this[_0x3d98('0x10')][_0x3d98('0xaa')](_0x3d98('0xf7'));}if(!this[_0x3d98('0xac')](_0x403adc['password'])){return this[_0x3d98('0x10')][_0x3d98('0xaa')](_0x3d98('0xf8'));}if(!this[_0x3d98('0xac')](_0x403adc[_0x3d98('0xf9')])){return this['channel'][_0x3d98('0xaa')](_0x3d98('0xab'));}this['channel'][_0x3d98('0xe4')]=!![];this[_0x3d98('0x37')](_0x403adc);this[_0x3d98('0x43')](_0x403adc[_0x3d98('0x5f')],'in','','');this[_0x3d98('0x10')][_0x3d98('0xaa')](util[_0x3d98('0x29')](_0x3d98('0xfa'),_0x403adc[_0x3d98('0x5f')]));var _0x1069c4=this[_0x3d98('0x83')][_0x3d98('0x72')](this,_0x403adc);if(_0x1069c4){for(var _0x28ada1 in _0x1069c4){if(_0x1069c4[_0x3d98('0x97')](_0x28ada1)){this[_0x3d98('0x10')][_0x3d98('0xa0')](util[_0x3d98('0x29')](_0x3d98('0xfb'),_0x28ada1[_0x3d98('0xe7')]()),_0x1069c4[_0x28ada1]);}}this[_0x3d98('0x43')](_0x1069c4[_0x3d98('0xe9')],_0x3d98('0xe8'),_0x3d98('0xf3'),'');if(_0x1069c4[_0x3d98('0xfc')]){this['channel'][_0x3d98('0xaa')](util['format'](_0x3d98('0xfd'),_0x1069c4[_0x3d98('0xfc')]));var _0x3f461f=this[_0x3d98('0x10')]['streamFile'](_0x1069c4[_0x3d98('0xfc')]);try{fs[_0x3d98('0xfe')](_0x1069c4[_0x3d98('0xfc')]+_0x3d98('0xff'));}catch(_0x25ba47){logger[_0x3d98('0x32')](_0x25ba47);}return _0x3f461f;}else{return this['channel']['noop'](util[_0x3d98('0x29')](_0x3d98('0x100'),_0x1069c4[_0x3d98('0xe9')]));}}return this['channel']['error'](_0x403adc,_0x3d98('0x101'));};AGIVertices[_0x3d98('0x17')][_0x3d98('0x102')]=function(_0x391e7b){logger[_0x3d98('0x2e')](util[_0x3d98('0x29')]('Enter\x20in\x20END\x20(%s)\x20block',_0x391e7b[_0x3d98('0x39')]));return this['channel'][_0x3d98('0xaa')](_0x3d98('0x102'));};AGIVertices['prototype'][_0x3d98('0x103')]=function(_0x40f2a1){logger[_0x3d98('0x2e')](util[_0x3d98('0x29')](_0x3d98('0x104'),_0x40f2a1[_0x3d98('0x39')]));var _0x157107='';if(_0x40f2a1[_0x3d98('0x105')]){if(!this['isConfigured'](_0x40f2a1[_0x3d98('0x105')])){return this[_0x3d98('0x10')][_0x3d98('0x32')](_0x40f2a1,_0x3d98('0x106'));}else{var _0x161df8=parseInt(_0x40f2a1[_0x3d98('0x105')],0xa);if(isNaN(_0x161df8)){_0x157107=_0x40f2a1[_0x3d98('0x105')];}else{_0x157107=this['getTrunk'][_0x3d98('0x72')](this,_0x40f2a1['trunk_id']);if(!_0x157107){return this[_0x3d98('0x10')][_0x3d98('0x32')](_0x40f2a1,_0x3d98('0x107'));}}}}else if(_0x40f2a1[_0x3d98('0x108')]){_0x157107=_0x40f2a1[_0x3d98('0x108')];}else{return this[_0x3d98('0x10')][_0x3d98('0x32')](_0x40f2a1,'no\x20trunk\x20selected');}var _0x21eb54=this[_0x3d98('0x10')][_0x3d98('0x5a')](_0x3d98('0xde'),[util[_0x3d98('0x29')](_0x3d98('0x109'),_0x157107,_0x40f2a1['phone']),_0x40f2a1[_0x3d98('0x68')],_0x40f2a1['opts'],_0x40f2a1[_0x3d98('0x66')]]);if(_0x21eb54[_0x3d98('0xa4')]===-0x1){return _0x21eb54;}return this[_0x3d98('0x10')]['noop'](util[_0x3d98('0x29')]('Executed\x20command\x20%s',_0x3d98('0xde')));};AGIVertices[_0x3d98('0x17')]['finally']=function(_0x5ba495){logger['info'](util[_0x3d98('0x29')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x5ba495[_0x3d98('0x39')]));return this['channel'][_0x3d98('0xaa')](_0x3d98('0x10a'));};AGIVertices[_0x3d98('0x17')]['getdigits']=function(_0x50f842){logger['info'](util[_0x3d98('0x29')](_0x3d98('0x10b'),_0x50f842[_0x3d98('0x39')]));if(_0x50f842[_0x3d98('0xa8')]===0x0){return this[_0x3d98('0xa7')](_0x50f842);}_0x50f842[_0x3d98('0xa8')]-=0x1;if(!this[_0x3d98('0xac')](_0x50f842[_0x3d98('0x10c')])){return this[_0x3d98('0x10')][_0x3d98('0x32')](_0x50f842,_0x3d98('0x10d'));}var _0x4d5545=this['getSound'][_0x3d98('0x72')](this,_0x50f842['file_id']);if(!_0x4d5545){return this[_0x3d98('0x10')]['error'](_0x50f842,_0x3d98('0x10e'));}if(!this[_0x3d98('0xac')](_0x50f842[_0x3d98('0xd3')])){return this[_0x3d98('0x10')]['error'](_0x3d98('0xd4'));}var _0x5ea77a=this[_0x3d98('0x10')][_0x3d98('0x10f')](_0x4d5545,_0x50f842[_0x3d98('0x110')],_0x50f842[_0x3d98('0x111')]);var _0x5eb9f6=_0x5ea77a['result']?_0x5ea77a['result'][_0x3d98('0xa3')]():'';logger[_0x3d98('0x2e')](_0x3d98('0x112'),JSON[_0x3d98('0x76')](_0x5ea77a));if(_0x5ea77a[_0x3d98('0xa4')]===-0x1){this['createSquareDetailsReport']['sync'](this,_0x50f842,_0x5eb9f6);return _0x5ea77a;}else if(_0x5ea77a[_0x3d98('0xa6')]==='timeout'){_0x5ea77a[_0x3d98('0xa4')]=_0x5eb9f6['length']>=parseInt(_0x50f842[_0x3d98('0x113')])?'x':'i';}else{_0x5ea77a[_0x3d98('0xa4')]=_0x5eb9f6[_0x3d98('0x9c')]>=parseInt(_0x50f842[_0x3d98('0x113')])&&_0x5eb9f6[_0x3d98('0x9c')]<=parseInt(_0x50f842[_0x3d98('0x111')])?'x':'i';}var _0x51e643=this['getVariable'][_0x3d98('0x72')](this,_0x50f842[_0x3d98('0xd3')]);if(!_0x51e643){return this['channel']['error'](_0x50f842,_0x3d98('0xd5'));}this[_0x3d98('0x10')][_0x3d98('0xa0')](_0x51e643,_0x5eb9f6);if(this[_0x3d98('0xac')](_0x50f842[_0x3d98('0x114')])){var _0x3c3a16=parseInt(_0x50f842[_0x3d98('0x114')],0xa);var _0x12e868=rs[_0x3d98('0x115')]({'charset':'*','length':_0x3c3a16});var _0x314554=_0x5eb9f6[_0x3d98('0x9c')];if(_0x314554>0x0){if(_0x314554>_0x3c3a16){this[_0x3d98('0x37')]['sync'](this,_0x50f842,_0x50f842[_0x3d98('0x116')]===_0x3d98('0x117')?_0x12e868+_0x5eb9f6[_0x3d98('0x118')](_0x3c3a16):_0x5eb9f6['substr'](0x0,_0x314554-_0x3c3a16)+_0x12e868);}else{this['createSquareDetailsReport'][_0x3d98('0x72')](this,_0x50f842,rs[_0x3d98('0x115')]({'charset':'*','length':_0x314554}));}}else{this[_0x3d98('0x37')][_0x3d98('0x72')](this,_0x50f842,'');}}else{this[_0x3d98('0x37')][_0x3d98('0x72')](this,_0x50f842,_0x5eb9f6);}return _0x5ea77a;};AGIVertices[_0x3d98('0x17')][_0x3d98('0xf')]=function(_0x2af197){logger[_0x3d98('0x2e')](util[_0x3d98('0x29')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x2af197['label']));return this['getdigits'](_0x2af197);};AGIVertices[_0x3d98('0x17')]['goal']=function(_0x6fc3d5){logger[_0x3d98('0x2e')](util[_0x3d98('0x29')](_0x3d98('0x119'),_0x6fc3d5[_0x3d98('0x39')]));this[_0x3d98('0x37')][_0x3d98('0x72')](this,_0x6fc3d5,_0x6fc3d5[_0x3d98('0x11a')]);return this[_0x3d98('0x10')]['noop'](util[_0x3d98('0x29')](_0x3d98('0x11b'),_0x6fc3d5[_0x3d98('0x11a')]));};AGIVertices[_0x3d98('0x17')][_0x3d98('0x11c')]=function(_0x33a616){logger[_0x3d98('0x2e')](util[_0x3d98('0x29')](_0x3d98('0x11d'),_0x33a616[_0x3d98('0x39')]));if(!this[_0x3d98('0xac')](_0x33a616[_0x3d98('0x8a')])||!this['isConfigured'](_0x33a616[_0x3d98('0x8f')])){return this['channel'][_0x3d98('0xaa')](_0x3d98('0x11e'));}if(!this[_0x3d98('0xac')](_0x33a616[_0x3d98('0x5f')])){return this[_0x3d98('0x10')][_0x3d98('0xaa')]('no\x20text\x20configured');}this[_0x3d98('0x10')][_0x3d98('0xaa')](util[_0x3d98('0x29')](_0x3d98('0x11f'),_0x33a616[_0x3d98('0x5f')]));var _0x13b4b3=this[_0x3d98('0x89')][_0x3d98('0x72')](this,_0x33a616);if(_0x13b4b3){this[_0x3d98('0x10')][_0x3d98('0xaa')](util['format'](_0x3d98('0x120'),_0x13b4b3));var _0x2f63eb=this['channel']['streamFile'](_0x13b4b3);try{fs[_0x3d98('0xfe')](_0x13b4b3+_0x3d98('0xff'));}catch(_0xb3e48b){logger['error'](_0xb3e48b);}return _0x2f63eb;}return this[_0x3d98('0x10')][_0x3d98('0x32')](_0x33a616,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x3d98('0x17')]['awslex']=function(_0x577f18){logger['info'](util[_0x3d98('0x29')](_0x3d98('0x121'),_0x577f18[_0x3d98('0x39')]));if(!this[_0x3d98('0xac')](_0x577f18[_0x3d98('0x8a')])||!this['isConfigured'](_0x577f18[_0x3d98('0x8f')])){return this['channel'][_0x3d98('0xaa')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x3d98('0xac')](_0x577f18[_0x3d98('0x122')])){return this['channel'][_0x3d98('0xaa')]('no\x20bot\x20name\x20configured');}if(!this['isConfigured'](_0x577f18[_0x3d98('0x5f')])){return this[_0x3d98('0x10')][_0x3d98('0xaa')](_0x3d98('0xab'));}this[_0x3d98('0x10')][_0x3d98('0xe4')]=!![];this[_0x3d98('0x37')](_0x577f18);this['createSquareMessage'](_0x577f18[_0x3d98('0x5f')],'in','','');this[_0x3d98('0x10')]['noop'](util['format'](_0x3d98('0x123'),_0x577f18['text']));var _0x25da53=this[_0x3d98('0x8e')][_0x3d98('0x72')](this,_0x577f18);if(_0x25da53){for(var _0x2d879a in _0x25da53){if(_0x25da53[_0x3d98('0x97')](_0x2d879a)&&_[_0x3d98('0x98')](_0x25da53[_0x2d879a])){this[_0x3d98('0x10')][_0x3d98('0xa0')](util[_0x3d98('0x29')](_0x3d98('0x124'),_0x2d879a[_0x3d98('0xe7')]()),_0x25da53[_0x2d879a]);}}if(_[_0x3d98('0x44')](_0x25da53[_0x3d98('0x125')])){return this['channel'][_0x3d98('0xaa')](_0x3d98('0x126'));}else{this[_0x3d98('0x43')](_0x25da53[_0x3d98('0x125')],'out',_0x3d98('0x127'),'');return this['channel']['noop'](util[_0x3d98('0x29')](_0x3d98('0x128'),_0x25da53[_0x3d98('0x125')]));}}return this[_0x3d98('0x10')][_0x3d98('0x32')](_0x577f18,_0x3d98('0x129'));};AGIVertices[_0x3d98('0x17')]['googleasr']=function(_0x2481ef){logger[_0x3d98('0x2e')](util[_0x3d98('0x29')](_0x3d98('0x12a'),_0x2481ef[_0x3d98('0x39')],_0x2481ef['timeout']));if(!this['isConfigured'](_0x2481ef[_0x3d98('0x7d')])){return this[_0x3d98('0x10')][_0x3d98('0xaa')](_0x3d98('0xe3'));}var _0x14430f=_0x3d98('0x12b');var _0x102faa=util[_0x3d98('0x29')]('%s/recordings/%s',FILES_PATH,rs[_0x3d98('0x115')](0x4));var _0x533398=util[_0x3d98('0x29')]('%s.%s',_0x102faa,_0x14430f);var _0x430f7d=!![];if(_0x2481ef[_0x3d98('0x12c')]==='NOBEEP'){_0x430f7d=![];}var _0x3789c0=this[_0x3d98('0x10')][_0x3d98('0x12d')](_0x102faa,_0x14430f,_0x2481ef[_0x3d98('0x12e')],_0x2481ef[_0x3d98('0x68')],undefined,_0x430f7d);if(_0x3789c0[_0x3d98('0xa4')]!==-0x1){this[_0x3d98('0x10')][_0x3d98('0xaa')](util[_0x3d98('0x29')](_0x3d98('0x12f'),_0x533398));var _0x351fb3=this[_0x3d98('0x91')][_0x3d98('0x72')](this,_0x2481ef,_0x533398);if(_0x351fb3){for(var _0x479d2e in _0x351fb3){if(_0x351fb3[_0x3d98('0x97')](_0x479d2e)){this['channel'][_0x3d98('0xa0')](util[_0x3d98('0x29')]('GOOGLE_ASR_%s',_0x479d2e[_0x3d98('0xe7')]()),_0x351fb3[_0x479d2e]);}}return this[_0x3d98('0x10')][_0x3d98('0xaa')](util[_0x3d98('0x29')](_0x3d98('0x130'),JSON['stringify'](_0x351fb3)));}}return _0x3789c0;};AGIVertices['prototype'][_0x3d98('0x131')]=function(_0x3510d2){logger[_0x3d98('0x2e')](util['format'](_0x3d98('0x132'),_0x3510d2[_0x3d98('0x39')]));if(!this[_0x3d98('0xac')](_0x3510d2['appid'])){return this[_0x3d98('0x10')][_0x3d98('0xaa')]('no\x20appid\x20configured');}if(!this[_0x3d98('0xac')](_0x3510d2[_0x3d98('0x94')])){return this[_0x3d98('0x10')][_0x3d98('0xaa')](_0x3d98('0x133'));}var _0x300375=_0x3d98('0x12b');var _0x31b370=util[_0x3d98('0x29')]('%s/recordings/%s',FILES_PATH,rs[_0x3d98('0x115')](0x4));var _0x551332=util[_0x3d98('0x29')](_0x3d98('0x9f'),_0x31b370,_0x300375);var _0x47a75b=!![];if(_0x3510d2['beep']==='NOBEEP'){_0x47a75b=![];}var _0x16ba6c=this[_0x3d98('0x10')]['recordFile'](_0x31b370,_0x300375,_0x3510d2[_0x3d98('0x12e')],_0x3510d2['timeout'],undefined,_0x47a75b);if(_0x16ba6c[_0x3d98('0xa4')]!==-0x1){this['channel'][_0x3d98('0xaa')](util[_0x3d98('0x29')](_0x3d98('0x134'),_0x551332));var _0x3c30b4=this[_0x3d98('0x93')][_0x3d98('0x72')](this,_0x3510d2,_0x551332);if(_0x3c30b4){for(var _0x41508e in _0x3c30b4){if(_0x3c30b4['hasOwnProperty'](_0x41508e)){this[_0x3d98('0x10')][_0x3d98('0xa0')](util[_0x3d98('0x29')](_0x3d98('0x135'),_0x41508e['toUpperCase']()),_0x3c30b4[_0x41508e]);}}return this[_0x3d98('0x10')][_0x3d98('0xaa')](util['format'](_0x3d98('0x136'),JSON[_0x3d98('0x76')](_0x3c30b4)));}}return _0x16ba6c;};AGIVertices[_0x3d98('0x17')]['gotoc']=function(_0x15cc88){logger[_0x3d98('0x2e')](util['format'](_0x3d98('0x137'),_0x15cc88[_0x3d98('0x39')]));return this[_0x3d98('0x10')][_0x3d98('0x138')](_0x15cc88['context'],_0x15cc88[_0x3d98('0x3e')],_0x15cc88[_0x3d98('0x3f')]);};AGIVertices[_0x3d98('0x17')][_0x3d98('0x139')]=function(_0x5d85fd){logger['info'](util['format'](_0x3d98('0x13a'),_0x5d85fd['label']));if(!this[_0x3d98('0xac')](_0x5d85fd['condition'])){return this[_0x3d98('0x10')]['error'](_0x5d85fd,'no\x20condition\x20configured');}try{var _0x6a38ff=eval(_0x5d85fd['condition'])?'true':_0x3d98('0x13b');this['channel'][_0x3d98('0xaa')](util['format'](_0x3d98('0x13c'),_0x5d85fd[_0x3d98('0x13d')],_0x6a38ff));return{'code':0xc8,'result':_0x6a38ff};}catch(_0x3ee314){return{'code':0xc8,'result':_0x3d98('0x13b')};}};AGIVertices[_0x3d98('0x17')][_0x3d98('0x13e')]=function(_0x33ae3b){logger['info'](util[_0x3d98('0x29')](_0x3d98('0x13f'),_0x33ae3b['label']));if(!this[_0x3d98('0xac')](_0x33ae3b[_0x3d98('0x140')])){return this[_0x3d98('0x10')]['error'](_0x33ae3b,_0x3d98('0x141'));}var _0x27b7a0=this[_0x3d98('0x25')][_0x3d98('0x72')](this,_0x33ae3b[_0x3d98('0x140')]);if(!_0x27b7a0){return this[_0x3d98('0x10')][_0x3d98('0x32')](_0x33ae3b,_0x3d98('0x142'));}for(var _0x4c0401=0x0;_0x4c0401<_0x27b7a0[_0x3d98('0x9c')];_0x4c0401+=0x1){var _0x4d9436=this[_0x3d98('0x10')]['getVariable'](util['format'](_0x3d98('0x143'),_0x27b7a0[_0x4c0401]));if(_0x4d9436[_0x3d98('0xa4')]===-0x1){return _0x4d9436;}logger[_0x3d98('0x2e')](util[_0x3d98('0x29')](_0x3d98('0x144'),_0x27b7a0[_0x4c0401],_0x4d9436[_0x3d98('0xa6')]));if(_0x4d9436[_0x3d98('0xa6')]===_0x3d98('0x145')){logger['info'](util[_0x3d98('0x29')](_0x3d98('0x144'),_0x27b7a0[_0x4c0401],_0x3d98('0x145')));this[_0x3d98('0x10')][_0x3d98('0xaa')](util['format'](_0x3d98('0x144'),_0x27b7a0[_0x4c0401],_0x3d98('0x145')));return{'code':0xc8,'result':_0x3d98('0x145')};}else{logger['info'](util[_0x3d98('0x29')](_0x3d98('0x144'),_0x27b7a0[_0x4c0401],_0x3d98('0x13b')));this[_0x3d98('0x10')][_0x3d98('0xaa')](util['format'](_0x3d98('0x144'),_0x27b7a0[_0x4c0401],_0x3d98('0x13b')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x3d98('0x17')][_0x3d98('0x146')]=function(_0x15224f){logger[_0x3d98('0x2e')](util[_0x3d98('0x29')](_0x3d98('0x147'),_0x15224f[_0x3d98('0x39')]));return this[_0x3d98('0x10')][_0x3d98('0x146')]();};AGIVertices['prototype'][_0x3d98('0x148')]=function(_0x458060){logger[_0x3d98('0x2e')](util[_0x3d98('0x29')](_0x3d98('0x149'),_0x458060['label']));if(!this['isConfigured'](_0x458060['key'])){return this[_0x3d98('0x10')][_0x3d98('0xaa')]('no\x20key\x20configured');}var _0x1ff787='wav';var _0x4bd8e4=util[_0x3d98('0x29')](_0x3d98('0x14a'),FILES_PATH,rs[_0x3d98('0x115')](0x4));var _0x41a830=util[_0x3d98('0x29')](_0x3d98('0x9f'),_0x4bd8e4,_0x1ff787);var _0xd02a4f=!![];if(_0x458060['beep']===_0x3d98('0x14b')){_0xd02a4f=![];}var _0x2a2d37=this[_0x3d98('0x10')][_0x3d98('0x12d')](_0x4bd8e4,_0x1ff787,_0x458060['intKey'],_0x458060[_0x3d98('0x68')],undefined,_0xd02a4f);if(_0x2a2d37[_0x3d98('0xa4')]!==-0x1){this[_0x3d98('0x10')]['noop'](util[_0x3d98('0x29')](_0x3d98('0x14c'),_0x41a830));var _0x318dde=this['ispeechASR'][_0x3d98('0x72')](this,_0x458060,_0x41a830);if(_0x318dde){for(var _0x45ed25 in _0x318dde){if(_0x318dde[_0x3d98('0x97')](_0x45ed25)){this[_0x3d98('0x10')]['setVariable'](util[_0x3d98('0x29')]('ISPEECH_ASR_%s',_0x45ed25[_0x3d98('0xe7')]()),_0x318dde[_0x45ed25]);}}return this[_0x3d98('0x10')][_0x3d98('0xaa')](util[_0x3d98('0x29')](_0x3d98('0x14d'),JSON[_0x3d98('0x76')](_0x318dde)));}}return _0x2a2d37;};AGIVertices[_0x3d98('0x17')][_0x3d98('0x14e')]=function(_0x38b2f3){logger[_0x3d98('0x2e')](util[_0x3d98('0x29')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x38b2f3['label']));if(!this[_0x3d98('0xac')](_0x38b2f3['key'])){return this[_0x3d98('0x10')]['noop']('no\x20key\x20configured');}if(!this[_0x3d98('0xac')](_0x38b2f3['text'])){return this['channel'][_0x3d98('0xaa')](_0x3d98('0xab'));}this[_0x3d98('0x10')][_0x3d98('0xaa')](util['format'](_0x3d98('0x14f'),_0x38b2f3[_0x3d98('0x5f')]));var _0x209d5e=this['ispeechTTS'][_0x3d98('0x72')](this,_0x38b2f3);if(_0x209d5e){this['channel']['noop'](util['format']('ispeech\x20%s\x20file\x20created',_0x209d5e));var _0x5e59a9=this['channel'][_0x3d98('0x150')](_0x209d5e,_0x38b2f3[_0x3d98('0x12e')]);try{fs[_0x3d98('0xfe')](_0x209d5e+_0x3d98('0xff'));}catch(_0x43699b){logger[_0x3d98('0x32')](_0x43699b);}return _0x5e59a9;}return this['channel']['error'](_0x38b2f3,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x3d98('0x17')][_0x3d98('0x151')]=function(_0x410de0){logger[_0x3d98('0x2e')](util['format'](_0x3d98('0x152'),_0x410de0[_0x3d98('0x39')]));if(!this[_0x3d98('0xac')](_0x410de0['findBy'])){return this['channel'][_0x3d98('0x32')](_0x410de0,_0x3d98('0x153'));}logger[_0x3d98('0x2e')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x3d98('0x10')][_0x3d98('0x53')],_0x410de0[_0x3d98('0x154')]));var _0x462e14=this['agentLogin'][_0x3d98('0x72')](this,_0x410de0['findBy']);if(_0x462e14){logger[_0x3d98('0x2e')](util[_0x3d98('0x29')](_0x3d98('0x155'),this['channel']['callerid'],_0x410de0['findBy']));this[_0x3d98('0x10')][_0x3d98('0xaa')](util['format'](_0x3d98('0x155'),this[_0x3d98('0x10')]['callerid'],_0x410de0[_0x3d98('0x154')]));return{'code':0xc8,'result':_0x3d98('0x156')};}else{logger[_0x3d98('0x2e')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x3d98('0x10')]['callerid'],_0x410de0[_0x3d98('0x154')]));this[_0x3d98('0x10')][_0x3d98('0xaa')](util[_0x3d98('0x29')](_0x3d98('0x157'),this[_0x3d98('0x10')][_0x3d98('0x53')],_0x410de0['findBy']));return{'code':0xc8,'result':_0x3d98('0x158')};}};AGIVertices[_0x3d98('0x17')][_0x3d98('0x159')]=function(_0x36966f){logger[_0x3d98('0x2e')](util[_0x3d98('0x29')](_0x3d98('0x15a'),_0x36966f[_0x3d98('0x39')]));if(!this[_0x3d98('0xac')](_0x36966f[_0x3d98('0x154')])){return this['channel'][_0x3d98('0x32')](_0x36966f,_0x3d98('0x153'));}logger[_0x3d98('0x2e')](util[_0x3d98('0x29')](_0x3d98('0x15b'),this['channel'][_0x3d98('0x53')],_0x36966f[_0x3d98('0x154')]));var _0x46889b=this[_0x3d98('0x54')]['sync'](this,_0x36966f[_0x3d98('0x154')]);if(_0x46889b){logger['info'](util[_0x3d98('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x3d98('0x53')],_0x36966f[_0x3d98('0x154')]));this[_0x3d98('0x10')][_0x3d98('0xaa')](util[_0x3d98('0x29')](_0x3d98('0x155'),this[_0x3d98('0x10')][_0x3d98('0x53')],_0x36966f['findBy']));return{'code':0xc8,'result':_0x3d98('0x156')};}else{logger[_0x3d98('0x2e')](util[_0x3d98('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x3d98('0x10')][_0x3d98('0x53')],_0x36966f[_0x3d98('0x154')]));this['channel']['noop'](util[_0x3d98('0x29')](_0x3d98('0x157'),this[_0x3d98('0x10')]['callerid'],_0x36966f[_0x3d98('0x154')]));return{'code':0xc8,'result':_0x3d98('0x158')};}};AGIVertices['prototype']['math']=function(_0x1c950a){logger[_0x3d98('0x2e')](util[_0x3d98('0x29')](_0x3d98('0x15c'),_0x1c950a['label']));if(!this[_0x3d98('0xac')](_0x1c950a['operation'])){return this[_0x3d98('0x10')][_0x3d98('0x32')](_0x1c950a,_0x3d98('0x15d'));}this[_0x3d98('0x10')][_0x3d98('0xaa')](util[_0x3d98('0x29')](_0x3d98('0x15e'),_0x1c950a[_0x3d98('0x15f')]));var _0x23ec9d=eval(_0x1c950a['operation']);if(!this['isConfigured'](_0x1c950a[_0x3d98('0xd3')])){return this[_0x3d98('0x10')][_0x3d98('0xaa')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x417245=this['getVariable'][_0x3d98('0x72')](this,_0x1c950a['variable_id']);if(!_0x417245){return this[_0x3d98('0x10')][_0x3d98('0x32')](_0x1c950a,_0x3d98('0xd5'));}if(_[_0x3d98('0x9e')](_0x23ec9d)){var _0x1f74b5=this;_0x23ec9d[_0x3d98('0xd6')](function(_0xc5b87d,_0x7c478d){_0x1f74b5[_0x3d98('0x10')][_0x3d98('0xa0')](util[_0x3d98('0x29')](_0x3d98('0x160'),_0x417245,_0x7c478d),_0xc5b87d);});return this[_0x3d98('0x10')][_0x3d98('0xaa')](util[_0x3d98('0x29')](_0x3d98('0x161'),_0x417245));}else{return this[_0x3d98('0x10')][_0x3d98('0xa0')](_0x417245,_0x23ec9d);}};AGIVertices[_0x3d98('0x17')][_0x3d98('0xd')]=function(_0xc81392){logger['info'](util[_0x3d98('0x29')](_0x3d98('0x162'),_0xc81392[_0x3d98('0x39')]));if(_0xc81392['retry']===0x0){return this[_0x3d98('0xa7')](_0xc81392);}_0xc81392[_0x3d98('0xa8')]-=0x1;if(!this[_0x3d98('0xac')](_0xc81392[_0x3d98('0x10c')])){return this[_0x3d98('0x10')]['error'](_0xc81392,_0x3d98('0x10d'));}var _0x4a4aa1=this[_0x3d98('0x1e')]['sync'](this,_0xc81392[_0x3d98('0x10c')]);if(!_0x4a4aa1){return this[_0x3d98('0x10')]['error'](_0xc81392,_0x3d98('0x10e'));}var _0x2ee91d=this[_0x3d98('0x10')][_0x3d98('0x10f')](_0x4a4aa1,_0xc81392['response'],_0xc81392['digit']);var _0x184894=_0x2ee91d[_0x3d98('0xa4')];if(_0x2ee91d['result']===-0x1){this['createSquareDetailsReport'][_0x3d98('0x72')](this,_0xc81392,'-1');return _0x2ee91d;}else if(_0x2ee91d[_0x3d98('0xa6')]===_0x3d98('0x68')){_0x2ee91d[_0x3d98('0xa4')]=_0x2ee91d[_0x3d98('0xa4')][_0x3d98('0x9c')]>0x0?_0x2ee91d[_0x3d98('0xa4')]:'t';}else if(_[_0x3d98('0x46')](_0x2ee91d[_0x3d98('0xa4')])){_0x2ee91d[_0x3d98('0xa4')]='#';_0x184894='#';}if(!this[_0x3d98('0xac')](_0xc81392[_0x3d98('0xd3')])){this[_0x3d98('0x10')][_0x3d98('0xaa')](_0x3d98('0xd4'));}else{var _0xb3ebbb=this[_0x3d98('0x12')][_0x3d98('0x72')](this,_0xc81392['variable_id']);if(!_0xb3ebbb){return this[_0x3d98('0x10')][_0x3d98('0x32')](_0xc81392,_0x3d98('0xd5'));}this[_0x3d98('0x10')]['setVariable'](_0xb3ebbb,_0x184894);}this[_0x3d98('0x37')]['sync'](this,_0xc81392,_0x184894);return _0x2ee91d;};AGIVertices[_0x3d98('0x17')]['noop']=function(_0x4e511f){logger['info'](util[_0x3d98('0x29')](_0x3d98('0x163'),_0x4e511f[_0x3d98('0x39')]));return this[_0x3d98('0x10')]['noop'](_0x4e511f['output']||_0x4e511f[_0x3d98('0x39')]);};AGIVertices['prototype'][_0x3d98('0x164')]=function(_0x17370){logger['info'](util[_0x3d98('0x29')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x17370[_0x3d98('0x39')]));if(!this['isConfigured'](_0x17370[_0x3d98('0x154')])){return this[_0x3d98('0x10')]['error'](_0x17370,'no\x20find\x20by\x20configured');}logger[_0x3d98('0x2e')](util[_0x3d98('0x29')](_0x3d98('0x15b'),this[_0x3d98('0x10')]['callerid'],_0x17370[_0x3d98('0x154')]));var _0x2b79f6=this[_0x3d98('0x4e')]['sync'](this,_0x17370[_0x3d98('0x165')]);var _0x1b5b8c=this[_0x3d98('0x50')]['sync'](this,_0x17370[_0x3d98('0x154')],_0x2b79f6);if(_0x1b5b8c){logger['info'](util[_0x3d98('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x3d98('0x10')][_0x3d98('0x53')],_0x17370['findBy']));this[_0x3d98('0x10')][_0x3d98('0xaa')](util[_0x3d98('0x29')](_0x3d98('0x155'),this['channel'][_0x3d98('0x53')],_0x17370['findBy']));return{'code':0xc8,'result':_0x3d98('0x156')};}else{logger[_0x3d98('0x2e')](util[_0x3d98('0x29')](_0x3d98('0x157'),this[_0x3d98('0x10')]['callerid'],_0x17370[_0x3d98('0x154')]));this[_0x3d98('0x10')][_0x3d98('0xaa')](util[_0x3d98('0x29')](_0x3d98('0x155'),this[_0x3d98('0x10')][_0x3d98('0x53')],_0x17370[_0x3d98('0x154')]));return{'code':0xc8,'result':_0x3d98('0x158')};}};AGIVertices['prototype'][_0x3d98('0x166')]=function(_0x12e96d){logger[_0x3d98('0x2e')](util[_0x3d98('0x29')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x12e96d['label']));if(!this[_0x3d98('0xac')](_0x12e96d['file_id'])){return this['channel'][_0x3d98('0x32')](_0x12e96d,_0x3d98('0x10d'));}var _0x5b5b49=this[_0x3d98('0x1e')][_0x3d98('0x72')](this,_0x12e96d[_0x3d98('0x10c')]);if(!_0x5b5b49){return this[_0x3d98('0x10')][_0x3d98('0x32')](_0x12e96d,_0x3d98('0x10e'));}var _0x58e2f4=this['channel'][_0x3d98('0x5a')](_0x3d98('0x167'),[_0x5b5b49,_0x12e96d[_0x3d98('0x168')]]);if(_0x58e2f4[_0x3d98('0xa4')]===-0x1){return _0x58e2f4;}return this[_0x3d98('0x10')][_0x3d98('0xaa')](util[_0x3d98('0x29')]('Executed\x20command\x20%s\x20%s','PLAYBACK',_0x5b5b49));};AGIVertices[_0x3d98('0x17')]['queue']=function(_0x532f87){logger[_0x3d98('0x2e')](util[_0x3d98('0x29')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x532f87[_0x3d98('0x39')]));if(!this['isConfigured'](_0x532f87['queue_id'])){return this['channel'][_0x3d98('0x32')](_0x532f87,_0x3d98('0x169'));}var _0x467c05='';var _0x18eb22=parseInt(_0x532f87['queue_id'],0xa);if(isNaN(_0x18eb22)){_0x467c05=_0x532f87[_0x3d98('0x16a')];}else{_0x467c05=this[_0x3d98('0x15')][_0x3d98('0x72')](this,_0x532f87[_0x3d98('0x16a')]);if(!_0x467c05){return this['channel'][_0x3d98('0x32')](_0x532f87,'no\x20queue\x20found');}}var _0x1d93e8='';if(this['isConfigured'](_0x532f87[_0x3d98('0x10c')])){var _0x23061c=this[_0x3d98('0x1e')][_0x3d98('0x72')](this,_0x532f87['file_id']);if(_0x23061c){_0x1d93e8=_0x23061c;}}this[_0x3d98('0x37')][_0x3d98('0x72')](this,_0x532f87,_0x467c05);if(_0x532f87[_0x3d98('0x168')][_0x3d98('0x16b')]('x')<0x0){_0x532f87['opts']+='x';}if(_0x532f87[_0x3d98('0x168')][_0x3d98('0x16b')]('X')<0x0){_0x532f87[_0x3d98('0x168')]+='X';}this['channel']['setVariable']('XMCS-QUEUE',_0x467c05?_0x467c05[_0x3d98('0x16c')]():'');var _0x77c081=this[_0x3d98('0x10')][_0x3d98('0x5a')](_0x3d98('0x16d'),[_0x467c05,_0x532f87[_0x3d98('0x168')],_0x532f87[_0x3d98('0x66')],_0x1d93e8,_0x532f87[_0x3d98('0x68')],_0x532f87[_0x3d98('0x7')],_0x532f87[_0x3d98('0x16e')],_0x532f87[_0x3d98('0x16f')],'',_0x532f87[_0x3d98('0x170')]]);if(_0x77c081[_0x3d98('0xa4')]===-0x1){return _0x77c081;}return this['channel'][_0x3d98('0xaa')](util[_0x3d98('0x29')](_0x3d98('0xc1'),_0x3d98('0x16d'),_0x467c05));};AGIVertices[_0x3d98('0x17')]['record']=function(_0x42364a){logger['info'](util[_0x3d98('0x29')](_0x3d98('0x171'),_0x42364a['label']));var _0x43c99e=_0x42364a[_0x3d98('0x172')]||'wav';var _0x4757e8=util[_0x3d98('0x29')]('%s_%s',this['channel'][_0x3d98('0x38')],rs[_0x3d98('0x115')](0x5));var _0x179951=util['format'](_0x3d98('0x173'),FILES_PATH,_0x4757e8,_0x43c99e);var _0x560254=util[_0x3d98('0x29')](_0x3d98('0x14a'),FILES_PATH,_0x4757e8);this[_0x3d98('0x3c')]['sync'](this,_0x42364a,_0x4757e8,_0x179951);this[_0x3d98('0x10')][_0x3d98('0xa0')]('RECORDING_SAVENAME',_0x4757e8);logger[_0x3d98('0x2e')](_0x3d98('0x174'),_0x560254,_0x43c99e,_0x42364a[_0x3d98('0x175')],_0x42364a['timeout']);return this['channel'][_0x3d98('0x12d')](_0x560254,_0x43c99e,_0x42364a[_0x3d98('0x175')],_0x42364a[_0x3d98('0x68')],undefined,!![]);};AGIVertices[_0x3d98('0x17')][_0x3d98('0x176')]=function(_0x47ac1e){logger[_0x3d98('0x2e')](util[_0x3d98('0x29')](_0x3d98('0x177'),_0x47ac1e['label']));if(!this[_0x3d98('0xac')](_0x47ac1e[_0x3d98('0x66')])){return this['channel'][_0x3d98('0xaa')](_0x3d98('0x178'));}var _0x399927=this[_0x3d98('0x65')][_0x3d98('0x72')](this,_0x47ac1e);logger['info'](util[_0x3d98('0x29')](_0x3d98('0x179'),util[_0x3d98('0x17a')](_0x399927,{'showHidden':![],'depth':null})));if(!this[_0x3d98('0xac')](_0x47ac1e[_0x3d98('0xd3')])){return this[_0x3d98('0x10')][_0x3d98('0xaa')](_0x3d98('0x17b'));}var _0x3adbdf=this[_0x3d98('0x12')][_0x3d98('0x72')](this,_0x47ac1e['variable_id']);if(!_0x3adbdf){return this[_0x3d98('0x10')][_0x3d98('0x32')](_0x47ac1e,_0x3d98('0xd5'));}this['channel'][_0x3d98('0xa0')](util[_0x3d98('0x29')]('%s_STATUS_CODE',_0x3adbdf),_0x399927[_0x3d98('0x78')]?_0x399927['statusCode']:_0x3d98('0x17c'));this[_0x3d98('0x10')][_0x3d98('0xa0')](util[_0x3d98('0x29')](_0x3d98('0x17d'),_0x3adbdf),_0x399927[_0x3d98('0x79')]?_0x399927[_0x3d98('0x79')]:'OK');if(_0x399927['body']){try{this[_0x3d98('0x9d')](_0x399927[_0x3d98('0x6c')],_0x3adbdf);}catch(_0x502a95){logger['error'](util[_0x3d98('0x29')](_0x3d98('0x17e'),_0x3adbdf));}}return this[_0x3d98('0x10')]['noop'](util['format'](_0x3d98('0xd9'),_0x3adbdf));};AGIVertices['prototype'][_0x3d98('0x17f')]=function(_0x2e65c9){logger[_0x3d98('0x2e')](util[_0x3d98('0x29')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x2e65c9[_0x3d98('0x39')]));return this[_0x3d98('0x10')][_0x3d98('0x180')](_0x2e65c9[_0x3d98('0x181')][_0x3d98('0x5c')](/\s+/g,''),_0x2e65c9['escape_digits']);};AGIVertices[_0x3d98('0x17')][_0x3d98('0x182')]=function(_0x3d8ea5){logger[_0x3d98('0x2e')](util[_0x3d98('0x29')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x3d8ea5['label']));return this[_0x3d98('0x10')][_0x3d98('0x183')](_0x3d8ea5[_0x3d98('0x184')]['replace'](/\s+/g,''),_0x3d8ea5[_0x3d98('0x175')]);};AGIVertices['prototype'][_0x3d98('0x185')]=function(_0x897a2f){logger['info'](util['format'](_0x3d98('0x186'),_0x897a2f['label']));return this[_0x3d98('0x10')][_0x3d98('0x187')](_0x897a2f[_0x3d98('0x5f')],_0x897a2f[_0x3d98('0x175')]);};AGIVertices[_0x3d98('0x17')][_0x3d98('0x188')]=function(_0x5c01c6){logger['info'](util[_0x3d98('0x29')](_0x3d98('0x189'),_0x5c01c6[_0x3d98('0x39')]));if(!this[_0x3d98('0xac')](_0x5c01c6[_0x3d98('0x18a')])){return this[_0x3d98('0x10')]['noop'](_0x3d98('0x18b'));}var _0x269946=this['getMailAccount'][_0x3d98('0x72')](this,_0x5c01c6[_0x3d98('0x18a')]);if(!_0x269946||!_0x269946[_0x3d98('0x18c')]){return this['channel'][_0x3d98('0x32')](_0x5c01c6,'no\x20mail\x20account\x20found');}var _0x454c27={'from':util[_0x3d98('0x29')]('\x22%s\x22\x20<%s>',_0x269946[_0x3d98('0x13')],_0x269946[_0x3d98('0x18d')]||_0x269946[_0x3d98('0x18c')][_0x3d98('0x18e')]),'to':_0x5c01c6['to']||'','cc':_0x5c01c6['cc']||'','bcc':_0x5c01c6[_0x3d98('0x18f')]||'','subject':_0x5c01c6[_0x3d98('0x190')],'html':_0x5c01c6[_0x3d98('0x5f')],'text':_0x5c01c6[_0x3d98('0x5f')]};if(this[_0x3d98('0xac')](_0x5c01c6[_0x3d98('0x191')])){}logger[_0x3d98('0xda')](_0x3d98('0x192'),JSON[_0x3d98('0x76')](_0x454c27));this[_0x3d98('0x37')][_0x3d98('0x72')](this,_0x5c01c6,_0x5c01c6[_0x3d98('0x18a')]);this[_0x3d98('0x10')][_0x3d98('0xaa')](util[_0x3d98('0x29')](_0x3d98('0x193'),_0x269946[_0x3d98('0x13')]));this['sendMailMessage'][_0x3d98('0x72')](this,_0x269946['smtpOptions'],_0x454c27);return this['channel'][_0x3d98('0xaa')](_0x3d98('0x194'));};AGIVertices[_0x3d98('0x17')][_0x3d98('0x195')]=function(_0x110839){logger[_0x3d98('0x2e')](util[_0x3d98('0x29')](_0x3d98('0x196'),_0x110839[_0x3d98('0x39')]));return this[_0x3d98('0x10')][_0x3d98('0xaa')](_0x3d98('0x197'));};AGIVertices['prototype']['sendSMS']=function(_0x3044ca){logger[_0x3d98('0x2e')](util['format'](_0x3d98('0x198'),_0x3044ca[_0x3d98('0x39')]));if(!this[_0x3d98('0xac')](_0x3044ca[_0x3d98('0x199')])){return this['channel']['noop'](_0x3d98('0x19a'));}var _0x26510c=this[_0x3d98('0x34')][_0x3d98('0x72')](this,_0x3044ca[_0x3d98('0x199')]);if(!_0x26510c){return this[_0x3d98('0x10')][_0x3d98('0x32')](_0x3044ca,_0x3d98('0x19b'));}var _0x1bfd2d={'body':_0x3044ca['sms_text'],'phone':_0x3044ca['to']||'','SmsAccountId':_0x26510c['id']};logger[_0x3d98('0xda')]('sendSMS\x20message',JSON[_0x3d98('0x76')](_0x1bfd2d));this['createSquareDetailsReport'][_0x3d98('0x72')](this,_0x3044ca,_0x3044ca[_0x3d98('0x199')]);this[_0x3d98('0x10')][_0x3d98('0xaa')](util['format'](_0x3d98('0x19c'),_0x26510c[_0x3d98('0x13')]));this[_0x3d98('0x36')]['sync'](this,_0x1bfd2d);return this[_0x3d98('0x10')]['noop'](_0x3d98('0x19d'));};AGIVertices[_0x3d98('0x17')]['set']=function(_0x35400b){logger[_0x3d98('0x2e')](util[_0x3d98('0x29')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x35400b[_0x3d98('0x39')]));if(!this['isConfigured'](_0x35400b[_0x3d98('0xd3')])){return this[_0x3d98('0x10')]['error'](_0x35400b,_0x3d98('0x19e'));}var _0x13e928=this[_0x3d98('0x12')][_0x3d98('0x72')](this,_0x35400b[_0x3d98('0xd3')]);if(!_0x13e928){return this[_0x3d98('0x10')][_0x3d98('0x32')](_0x35400b,'no\x20variable\x20found');}return this['channel'][_0x3d98('0xa0')](_0x13e928,_0x35400b['variable_value']);};AGIVertices[_0x3d98('0x17')]['start']=function(_0x2435ad){logger['info'](util[_0x3d98('0x29')](_0x3d98('0x19f'),_0x2435ad[_0x3d98('0x39')]));this[_0x3d98('0x10')][_0x3d98('0xaa')](_0x3d98('0x1a0'));if(_0x2435ad['answer']===_0x3d98('0x1a1')){this[_0x3d98('0x10')][_0x3d98('0xaa')](_0x3d98('0x1a2'));return this[_0x3d98('0x10')]['answer']();}return this[_0x3d98('0x10')][_0x3d98('0xaa')]('Skipped\x20Answer');};AGIVertices[_0x3d98('0x17')][_0x3d98('0x1a3')]=function(_0x475daa){logger[_0x3d98('0x2e')](util[_0x3d98('0x29')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x475daa[_0x3d98('0x39')]));if(!this[_0x3d98('0xac')](_0x475daa[_0x3d98('0x1a4')])){return this[_0x3d98('0x10')]['error'](_0x475daa,'no\x20subproject\x20selected');}var _0x39f4e7=this[_0x3d98('0x1a5')][_0x3d98('0x72')](this,_0x475daa[_0x3d98('0x1a4')]);if(!this[_0x3d98('0xac')](_0x39f4e7)){return this[_0x3d98('0x10')][_0x3d98('0x32')](_0x475daa,util[_0x3d98('0x29')](_0x3d98('0x1a6'),_0x475daa['project_id']));}if(_0x39f4e7===this[_0x3d98('0x10')]['arg_1']){return this[_0x3d98('0x10')][_0x3d98('0x32')](_0x475daa,_0x3d98('0x1a7'));}this[_0x3d98('0x37')][_0x3d98('0x72')](this,_0x475daa,_0x39f4e7);var _0x3c449c=this[_0x3d98('0x10')]['exec'](_0x3d98('0x1a8'),util[_0x3d98('0x29')](_0x3d98('0x1a9'),config[_0x3d98('0x7')]['host']||'127.0.0.1',_0x39f4e7,this[_0x3d98('0x10')][_0x3d98('0x3b')]));if(_0x3c449c['result']===-0x1){return _0x3c449c;}return this['channel']['noop'](util[_0x3d98('0x29')](_0x3d98('0xc1'),_0x3d98('0x1a8'),_0x39f4e7));};AGIVertices['prototype']['system']=function(_0x412765){logger[_0x3d98('0x2e')](util[_0x3d98('0x29')](_0x3d98('0x1aa'),_0x412765['label']));var _0x27633f=this['shellCommand']['sync'](this,_0x412765[_0x3d98('0xb9')]);this[_0x3d98('0x37')][_0x3d98('0x72')](this,_0x412765,_0x412765[_0x3d98('0xb9')]);if(this['isConfigured'](_0x412765[_0x3d98('0xd3')])){var _0x511df3=this[_0x3d98('0x12')]['sync'](this,_0x412765[_0x3d98('0xd3')]);if(_0x511df3){this[_0x3d98('0x10')]['setVariable'](_0x511df3,_0x27633f);return this[_0x3d98('0x10')]['noop'](util['format'](_0x3d98('0x1ab'),_0x412765['command'],_0x511df3));}}return this[_0x3d98('0x10')][_0x3d98('0xaa')](util[_0x3d98('0x29')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x412765[_0x3d98('0xb9')]));};AGIVertices[_0x3d98('0x17')][_0x3d98('0x1ac')]=function(_0x256190){logger['info'](util[_0x3d98('0x29')](_0x3d98('0x1ad'),_0x256190['label']));_0x256190[_0x3d98('0x5f')]=_0x256190[_0x3d98('0x5f')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x3d98('0xac')](_0x256190[_0x3d98('0x1ae')])){return this[_0x3d98('0x10')][_0x3d98('0xaa')](_0x3d98('0x1af'));}if(!this[_0x3d98('0xac')](_0x256190['text'])){return this['channel'][_0x3d98('0xaa')](_0x3d98('0xab'));}this[_0x3d98('0x10')][_0x3d98('0xaa')](util[_0x3d98('0x29')](_0x3d98('0x1b0'),_0x256190['text']));var _0x25c031=this[_0x3d98('0x5d')]['sync'](this,_0x256190);if(_0x25c031){this['channel'][_0x3d98('0xaa')](util[_0x3d98('0x29')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x25c031));var _0x343649=this[_0x3d98('0x10')][_0x3d98('0x150')](_0x25c031);try{fs[_0x3d98('0xfe')](_0x25c031+_0x3d98('0xff'));}catch(_0x432246){logger[_0x3d98('0x32')](_0x432246);}return _0x343649;}return this[_0x3d98('0x10')]['error'](_0x256190,_0x3d98('0x1b1'));};AGIVertices[_0x3d98('0x17')][_0x3d98('0x1b2')]=function(_0x49f8e0){logger[_0x3d98('0x2e')](util[_0x3d98('0x29')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x49f8e0[_0x3d98('0x39')]));_0x49f8e0['text']=_0x49f8e0['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x49f8e0['text'])){return this[_0x3d98('0x10')][_0x3d98('0xaa')](_0x3d98('0xab'));}this[_0x3d98('0x10')][_0x3d98('0xaa')](util[_0x3d98('0x29')](_0x3d98('0x1b3'),_0x49f8e0[_0x3d98('0x5f')]));var _0xfeae2=this[_0x3d98('0x63')][_0x3d98('0x72')](this,_0x49f8e0);if(_0xfeae2){this[_0x3d98('0x10')]['noop'](util[_0x3d98('0x29')](_0x3d98('0x1b4'),_0xfeae2));var _0x504f52=this[_0x3d98('0x10')]['streamFile'](_0xfeae2);try{fs['unlink'](_0xfeae2+_0x3d98('0xff'));}catch(_0x186785){logger[_0x3d98('0x32')](_0x186785);}return _0x504f52;}return this['channel'][_0x3d98('0x32')](_0x49f8e0,'Google\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0x3d98('0x1b5')]=function(_0x5f4da1){logger[_0x3d98('0x2e')](util[_0x3d98('0x29')](_0x3d98('0x1b6'),_0x5f4da1['label']));if(!this[_0x3d98('0xac')](_0x5f4da1[_0x3d98('0x154')])){return this[_0x3d98('0x10')][_0x3d98('0x32')](_0x5f4da1,_0x3d98('0x153'));}logger[_0x3d98('0x2e')](util[_0x3d98('0x29')](_0x3d98('0x15b'),this[_0x3d98('0x10')][_0x3d98('0x53')],_0x5f4da1[_0x3d98('0x154')]));var _0x57333e=this[_0x3d98('0x52')][_0x3d98('0x72')](this,_0x5f4da1[_0x3d98('0x154')]);if(_0x57333e){logger['info'](util[_0x3d98('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x3d98('0x10')]['callerid'],_0x5f4da1[_0x3d98('0x154')]));this[_0x3d98('0x10')][_0x3d98('0xaa')](util[_0x3d98('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x3d98('0x10')][_0x3d98('0x53')],_0x5f4da1[_0x3d98('0x154')]));return{'code':0xc8,'result':'success'};}else{logger[_0x3d98('0x2e')](util['format'](_0x3d98('0x157'),this[_0x3d98('0x10')][_0x3d98('0x53')],_0x5f4da1[_0x3d98('0x154')]));this[_0x3d98('0x10')][_0x3d98('0xaa')](util['format'](_0x3d98('0x157'),this[_0x3d98('0x10')]['callerid'],_0x5f4da1[_0x3d98('0x154')]));return{'code':0xc8,'result':_0x3d98('0x158')};}};AGIVertices[_0x3d98('0x17')]['voicemail']=function(_0x2c4961){logger['info'](util[_0x3d98('0x29')](_0x3d98('0x1b7'),_0x2c4961[_0x3d98('0x39')]));var _0x226499=this[_0x3d98('0x10')][_0x3d98('0x5a')](_0x3d98('0x1b8'),[_0x2c4961[_0x3d98('0x1b9')],_0x2c4961[_0x3d98('0x7b')]]);if(_0x226499['result']===-0x1){return _0x226499;}return this[_0x3d98('0x10')]['noop'](util[_0x3d98('0x29')](_0x3d98('0xc1'),_0x3d98('0x1b8'),_0x2c4961[_0x3d98('0x1b9')]));};AGIVertices[_0x3d98('0x17')][_0x3d98('0x1ba')]=function(_0x3e7073){logger[_0x3d98('0x2e')](util[_0x3d98('0x29')](_0x3d98('0x1bb'),_0x3e7073[_0x3d98('0x39')]));if(!this['isConfigured'](_0x3e7073[_0x3d98('0xd3')])){return this[_0x3d98('0x10')][_0x3d98('0x32')](_0x3e7073,_0x3d98('0x19e'));}var _0x224cd1=this[_0x3d98('0x12')][_0x3d98('0x72')](this,_0x3e7073[_0x3d98('0xd3')]);if(!_0x224cd1){return this[_0x3d98('0x10')]['error'](_0x3e7073,_0x3d98('0xd5'));}var _0x35ba44=this[_0x3d98('0x10')]['getVariable'](_0x224cd1);return{'code':0xc8,'result':_0x35ba44[_0x3d98('0xa6')]?_0x35ba44[_0x3d98('0xa6')]:'-'};};String[_0x3d98('0x17')][_0x3d98('0xa2')]=function(_0x210ee0,_0x36eb29){return this[_0x3d98('0xa1')](_0x210ee0)['join'](_0x36eb29);};module[_0x3d98('0x1bc')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 08fe192..4ce0902 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 _0x754e=['[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','saveUnpause','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','message','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','lodash','moment','../../../config/logger','acw','../rpc/user','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x754e,0x7a));var _0xe754=function(_0x18e4d2,_0x3298e8){_0x18e4d2=_0x18e4d2-0x0;var _0x17d106=_0x754e[_0x18e4d2];return _0x17d106;};'use strict';var _=require(_0xe754('0x0'));var moment=require(_0xe754('0x1'));var ami=require('../ami');var logger=require(_0xe754('0x2'))(_0xe754('0x3'));var RpcUser=require(_0xe754('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x4cc4f2){this[_0xe754('0x5')]=_0x4cc4f2['voiceQueues'];this[_0xe754('0x6')]=_0x4cc4f2[_0xe754('0x6')];this[_0xe754('0x7')]=_0x4cc4f2[_0xe754('0x7')];this[_0xe754('0x8')]={};ami['on'](_0xe754('0x9'),this[_0xe754('0xa')][_0xe754('0xb')](this));ami['on']('hanguprequest',this['syncHangupRequest'][_0xe754('0xb')](this));ami['on'](_0xe754('0xc'),this[_0xe754('0xd')]['bind'](this));ami['on'](_0xe754('0xe'),this[_0xe754('0xf')][_0xe754('0xb')](this));ami['on'](_0xe754('0x10'),this[_0xe754('0x11')][_0xe754('0xb')](this));ami['on'](_0xe754('0x12'),this[_0xe754('0x13')][_0xe754('0xb')](this));ami['on']('custom:agentConnectPreview',this[_0xe754('0x14')][_0xe754('0xb')](this));}function getDiff(_0x36cf49){var _0x2047c6=moment()[_0xe754('0x15')](0x0);var _0x57d71e=moment(_0x36cf49)[_0xe754('0x15')](0x0);return _0x2047c6[_0xe754('0x16')](_0x57d71e,_0xe754('0x17'));}Acw[_0xe754('0x18')]['startAcw']=function(_0x3320fa){try{var _0x19bc8f=this;var _0x5d2112=this['channels'][_0x3320fa][_0xe754('0x19')];var _0x4c2d16=this['channels'][_0x3320fa][_0xe754('0x1a')];var _0x3796f4=this['voiceQueues'][_0x4c2d16];var _0x4b4172=![];var _0x13ba69=_0xe754('0x1b');if(_0x3796f4[_0xe754('0x1c')]){if(_0x3796f4[_0xe754('0x1d')]['name']){_0x4b4172=!![];_0x13ba69=_0x3796f4[_0xe754('0x1d')][_0xe754('0x1e')];}}return ami['Action']({'action':_0xe754('0x1f'),'interface':_0x5d2112,'paused':!![],'reason':_0x13ba69})[_0xe754('0x20')](function(){if(_0x19bc8f[_0xe754('0x6')][_0x5d2112]){return RpcUser[_0xe754('0x21')](_0x19bc8f[_0xe754('0x6')][_0x5d2112]['id'])[_0xe754('0x20')](function(_0x266cd2){if(_0x266cd2&&!_0x266cd2[_0xe754('0x22')]){logger[_0xe754('0x23')](_0xe754('0x24'),_0x3320fa,_0x5d2112,_0x4c2d16);var _0x44086d=_0x19bc8f[_0xe754('0x8')][_0x3320fa][_0xe754('0x25')]&&_0x19bc8f['channels'][_0x3320fa]['destlinkedid']?_0x19bc8f[_0xe754('0x8')][_0x3320fa][_0xe754('0x26')]:_0x3320fa;return RpcUser[_0xe754('0x27')](_0x19bc8f[_0xe754('0x6')][_0x5d2112],_0x13ba69,_0x44086d)['then'](function(){if(!_0x4b4172){_0x19bc8f[_0xe754('0x7')][_0x5d2112]={};logger[_0xe754('0x23')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x3320fa,_0x19bc8f[_0xe754('0x5')][_0x4c2d16][_0xe754('0x28')],_0x5d2112,_0x4c2d16);_0x19bc8f[_0xe754('0x7')][_0x5d2112][_0xe754('0x29')]=setTimeout(_0x19bc8f[_0xe754('0x2a')][_0xe754('0xb')](_0x19bc8f,_0x5d2112),_0x19bc8f[_0xe754('0x5')][_0x4c2d16]['acwTimeout']*0x3e8);_0x19bc8f[_0xe754('0x7')][_0x5d2112][_0xe754('0x2b')]=moment()[_0xe754('0x2c')](_0xe754('0x2d'));_0x19bc8f['timers'][_0x5d2112][_0xe754('0x2e')]=_0x3320fa;_0x19bc8f['timers'][_0x5d2112]['queue']=_0x4c2d16;_0x19bc8f['timers'][_0x5d2112][_0xe754('0x2f')]=function(){var _0x1bfa81=getDiff(_0x19bc8f['timers'][_0x5d2112]['lastPauseAt']);clearTimeout(_0x19bc8f[_0xe754('0x7')][_0x5d2112][_0xe754('0x29')]);_0x19bc8f[_0xe754('0x7')][_0x5d2112]['timer']=![];RpcVoiceAgentReport['update']({'acwtime':_0x1bfa81},_0x19bc8f[_0xe754('0x7')][_0x5d2112][_0xe754('0x2e')],_0x5d2112)[_0xe754('0x20')](function(_0x5740ec){logger[_0xe754('0x23')](_0xe754('0x30'),_0x3320fa,_0x1bfa81,_0x5740ec);})[_0xe754('0x31')](function(_0xe0fd2){logger['error'](_0xe754('0x32'),_0x3320fa,_0xe0fd2);});delete _0x19bc8f[_0xe754('0x7')][_0x5d2112];};}});}else{logger[_0xe754('0x23')](_0xe754('0x33'),_0x3320fa,_0x5d2112,_0x4c2d16);}});}})['catch'](function(){logger[_0xe754('0x34')](_0xe754('0x35'),_0x3320fa,_0x19bc8f[_0xe754('0x5')][_0x4c2d16][_0xe754('0x28')],_0x5d2112,_0x4c2d16);})[_0xe754('0x36')](function(){delete _0x19bc8f[_0xe754('0x8')][_0x3320fa];});}catch(_0x80a06b){logger[_0xe754('0x34')](_0xe754('0x37'),_0x80a06b['message']);}};Acw['prototype'][_0xe754('0x2a')]=function(_0x4df72f){try{var _0x417a6a=this;if(_0x417a6a[_0xe754('0x7')][_0x4df72f]){_0x417a6a[_0xe754('0x7')][_0x4df72f][_0xe754('0x29')]=![];var _0x3930be=_0x417a6a['timers'][_0x4df72f][_0xe754('0x2e')];var _0x39f5c9=_0x417a6a[_0xe754('0x7')][_0x4df72f][_0xe754('0x1a')];var _0x4499cc=_0x417a6a[_0xe754('0x5')][_0x39f5c9][_0xe754('0x28')];logger[_0xe754('0x23')]('[%s][TIMER][STOP][AGENT:%s]',_0x3930be,_0x4df72f);RpcUser[_0xe754('0x38')](this[_0xe754('0x6')][_0x4df72f]);RpcVoiceAgentReport[_0xe754('0x39')]({'acwtime':_0x4499cc,'agentacw':!![]},_0x3930be,_0x4df72f)['then'](function(_0x3dee94){logger[_0xe754('0x23')](_0xe754('0x30'),_0x3930be,_0x4499cc,_0x3dee94);})[_0xe754('0x31')](function(_0x963b31){logger[_0xe754('0x34')](_0xe754('0x32'),_0x3930be,_0x963b31);});}else{logger[_0xe754('0x34')](_0xe754('0x3a'),_0x4df72f);if(_0x417a6a[_0xe754('0x7')]){logger[_0xe754('0x23')]('[ACW][TIMERS]',JSON[_0xe754('0x3b')](_0x417a6a[_0xe754('0x7')]));}}}catch(_0x578d53){logger[_0xe754('0x34')](_0xe754('0x3c'),_0x578d53[_0xe754('0x3d')]);}};Acw[_0xe754('0x18')]['syncAgentConnect']=function(_0xfba5eb){try{if(this['voiceQueues'][_0xfba5eb[_0xe754('0x1a')]]&&(this[_0xe754('0x5')][_0xfba5eb['queue']]['acw']||this[_0xe754('0x5')][_0xfba5eb[_0xe754('0x1a')]][_0xe754('0x1c')])){if(this[_0xe754('0x6')][_0xfba5eb[_0xe754('0x19')]]){this[_0xe754('0x8')][_0xfba5eb[_0xe754('0x2e')]]={'queue':_0xfba5eb['queue'],'interface':_0xfba5eb[_0xe754('0x19')],'destlinkedid':_0xfba5eb[_0xe754('0x26')]};}}}catch(_0x8ed4c6){logger[_0xe754('0x34')]('[ACW][syncAgentConnect]\x20%s',_0x8ed4c6[_0xe754('0x3d')]);}};Acw[_0xe754('0x18')][_0xe754('0x14')]=function(_0x4f7dc3){try{if(this[_0xe754('0x5')][_0x4f7dc3[_0xe754('0x1a')]]&&(this['voiceQueues'][_0x4f7dc3[_0xe754('0x1a')]][_0xe754('0x3')]||this[_0xe754('0x5')][_0x4f7dc3[_0xe754('0x1a')]][_0xe754('0x1c')])){if(this[_0xe754('0x6')][_0x4f7dc3[_0xe754('0x19')]]){this[_0xe754('0x8')][_0x4f7dc3['uniqueid']]={'queue':_0x4f7dc3['queue'],'interface':_0x4f7dc3[_0xe754('0x19')]};}}}catch(_0x383766){logger[_0xe754('0x34')](_0xe754('0x3e'),_0x383766[_0xe754('0x3d')]);}};Acw['prototype'][_0xe754('0x3f')]=function(_0x133c79){try{if(this[_0xe754('0x8')][_0x133c79[_0xe754('0x2e')]]&&_[_0xe754('0x40')](this['channels'][_0x133c79[_0xe754('0x2e')]]['attended'])){logger[_0xe754('0x23')](_0xe754('0x41'),_0x133c79['uniqueid']);this[_0xe754('0x42')](_0x133c79['uniqueid']);}else if(this[_0xe754('0x8')][_0x133c79[_0xe754('0x43')]]&&_['isUndefined'](this[_0xe754('0x8')][_0x133c79[_0xe754('0x43')]]['attended'])){logger[_0xe754('0x23')](_0xe754('0x44'),_0x133c79['linkedid']);this[_0xe754('0x42')](_0x133c79[_0xe754('0x43')]);}}catch(_0x287480){logger['error'](_0xe754('0x45'),_0x287480[_0xe754('0x3d')]);}};Acw['prototype'][_0xe754('0xd')]=function(_0x1ee26a){try{if(this[_0xe754('0x8')][_0x1ee26a[_0xe754('0x2e')]]&&this[_0xe754('0x8')][_0x1ee26a[_0xe754('0x2e')]][_0xe754('0x25')]){logger[_0xe754('0x23')](_0xe754('0x46'),_0x1ee26a[_0xe754('0x2e')]);this[_0xe754('0x42')](_0x1ee26a[_0xe754('0x2e')]);}else if(this[_0xe754('0x8')][_0x1ee26a[_0xe754('0x43')]]&&this['channels'][_0x1ee26a['linkedid']][_0xe754('0x25')]){logger[_0xe754('0x23')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x1ee26a[_0xe754('0x43')]);this[_0xe754('0x42')](_0x1ee26a[_0xe754('0x43')]);}}catch(_0x1a2564){logger['error'](_0xe754('0x47'),_0x1a2564[_0xe754('0x3d')]);}};Acw[_0xe754('0x18')][_0xe754('0x11')]=function(_0xd25426){try{if(!_[_0xe754('0x48')](this[_0xe754('0x8')][_0xd25426[_0xe754('0x49')]])){this[_0xe754('0x42')](_0xd25426[_0xe754('0x49')]);if(this[_0xe754('0x8')][_0xd25426[_0xe754('0x4a')]]){this[_0xe754('0x8')][_0xd25426[_0xe754('0x4a')]][_0xe754('0x25')]=!![];this[_0xe754('0x8')][_0xd25426[_0xe754('0x4b')]]=this[_0xe754('0x8')][_0xd25426['secondtransfereruniqueid']];delete this['channels'][_0xd25426[_0xe754('0x4a')]];}}else if(!_[_0xe754('0x48')](this[_0xe754('0x8')][_0xd25426[_0xe754('0x4b')]])){this[_0xe754('0x42')](_0xd25426['transfertargetuniqueid']);if(this[_0xe754('0x8')][_0xd25426[_0xe754('0x4c')]]){this[_0xe754('0x8')][_0xd25426[_0xe754('0x4c')]][_0xe754('0x25')]=!![];this[_0xe754('0x8')][_0xd25426[_0xe754('0x49')]]=this[_0xe754('0x8')][_0xd25426['origtransfereruniqueid']];delete this[_0xe754('0x8')][_0xd25426['origtransfereruniqueid']];}}}catch(_0x292a54){logger[_0xe754('0x34')]('[ACW][syncAttendedTransfer]\x20%s',_0x292a54[_0xe754('0x3d')]);}};Acw[_0xe754('0x18')][_0xe754('0x13')]=function(_0x50d858){try{if(this[_0xe754('0x8')][_0x50d858[_0xe754('0x4d')]]){logger['info']('[%s][BLINDTRANSFER:UNIQUEID]',JSON['stringify'](_0x50d858['transfereruniqueid']));this[_0xe754('0x42')](_0x50d858[_0xe754('0x4d')]);}else if(this['channels'][_0x50d858['transfererlinkedid']]){logger[_0xe754('0x23')](_0xe754('0x4e'),JSON['stringify'](_0x50d858['transfererlinkedid']));this[_0xe754('0x42')](_0x50d858[_0xe754('0x4f')]);}}catch(_0x461e58){logger[_0xe754('0x34')](_0xe754('0x50'),_0x461e58[_0xe754('0x3d')]);}};Acw['prototype']['syncAgentRingNoAnswer']=function(_0x5cddb0){try{if(this[_0xe754('0x5')][_0x5cddb0[_0xe754('0x1a')]]&&this[_0xe754('0x5')][_0x5cddb0['queue']][_0xe754('0x51')]==='all'){if(this[_0xe754('0x6')][_0x5cddb0[_0xe754('0x19')]]){logger[_0xe754('0x23')](_0xe754('0x52'),_0x5cddb0[_0xe754('0x2e')],_0x5cddb0[_0xe754('0x19')],_0x5cddb0['queue']);return RpcUser['savePause'](this[_0xe754('0x6')][_0x5cddb0[_0xe754('0x19')]],_0xe754('0x53'),_0x5cddb0[_0xe754('0x2e')]);}}}catch(_0x26b35a){logger[_0xe754('0x34')](_0xe754('0x54'),_0x26b35a['message']);}};module['exports']=Acw; \ No newline at end of file +var _0xd15c=['bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','attendedtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','channels','queue','ACW','name','mandatoryDispositionPause','then','getAgent','info','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','lastPauseAt','format','uniqueid','updateAcw','timer','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][TIMERS]','[ACW][STOP]\x20%s','mandatoryDisposition','interface','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','stringify','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','syncAgentRingNoAnswer','autopause','Auto-Pause','exports','lodash','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','syncAgentConnect'];(function(_0x12a554,_0x3d7ef8){var _0x244ba0=function(_0x5eb5ff){while(--_0x5eb5ff){_0x12a554['push'](_0x12a554['shift']());}};_0x244ba0(++_0x3d7ef8);}(_0xd15c,0x13e));var _0xcd15=function(_0x5f5062,_0x501f11){_0x5f5062=_0x5f5062-0x0;var _0xa7d0f8=_0xd15c[_0x5f5062];return _0xa7d0f8;};'use strict';var _=require(_0xcd15('0x0'));var moment=require('moment');var ami=require('../ami');var logger=require(_0xcd15('0x1'))(_0xcd15('0x2'));var RpcUser=require(_0xcd15('0x3'));var RpcVoiceAgentReport=require(_0xcd15('0x4'));function Acw(_0x33b484){this['voiceQueues']=_0x33b484[_0xcd15('0x5')];this[_0xcd15('0x6')]=_0x33b484[_0xcd15('0x6')];this[_0xcd15('0x7')]=_0x33b484[_0xcd15('0x7')];this['channels']={};ami['on'](_0xcd15('0x8'),this[_0xcd15('0x9')][_0xcd15('0xa')](this));ami['on'](_0xcd15('0xb'),this[_0xcd15('0xc')][_0xcd15('0xa')](this));ami['on'](_0xcd15('0xd'),this[_0xcd15('0xe')][_0xcd15('0xa')](this));ami['on'](_0xcd15('0xf'),this['syncAgentRingNoAnswer'][_0xcd15('0xa')](this));ami['on'](_0xcd15('0x10'),this['syncAttendedTransfer'][_0xcd15('0xa')](this));ami['on']('blindtransfer',this[_0xcd15('0x11')][_0xcd15('0xa')](this));ami['on'](_0xcd15('0x12'),this['syncAgentConnectPreview']['bind'](this));}function getDiff(_0x90b900){var _0x2d90b5=moment()[_0xcd15('0x13')](0x0);var _0x47bccd=moment(_0x90b900)[_0xcd15('0x13')](0x0);return _0x2d90b5[_0xcd15('0x14')](_0x47bccd,_0xcd15('0x15'));}Acw[_0xcd15('0x16')][_0xcd15('0x17')]=function(_0xdcb70a){try{var _0x12f6c8=this;var _0xb8e8a8=this['channels'][_0xdcb70a]['interface'];var _0x34e32e=this[_0xcd15('0x18')][_0xdcb70a][_0xcd15('0x19')];var _0x38e353=this['voiceQueues'][_0x34e32e];var _0x4d2038=![];var _0x3d7e13=_0xcd15('0x1a');if(_0x38e353['mandatoryDisposition']){if(_0x38e353['mandatoryDispositionPause'][_0xcd15('0x1b')]){_0x4d2038=!![];_0x3d7e13=_0x38e353[_0xcd15('0x1c')]['name'];}}return ami['Action']({'action':'QueuePause','interface':_0xb8e8a8,'paused':!![],'reason':_0x3d7e13})[_0xcd15('0x1d')](function(){if(_0x12f6c8[_0xcd15('0x6')][_0xb8e8a8]){return RpcUser[_0xcd15('0x1e')](_0x12f6c8['agents'][_0xb8e8a8]['id'])[_0xcd15('0x1d')](function(_0xad90d7){if(_0xad90d7&&!_0xad90d7['voicePause']){logger[_0xcd15('0x1f')]('[%s][START][AGENT:%s][QUEUE:%s]',_0xdcb70a,_0xb8e8a8,_0x34e32e);var _0x422bf6=_0x12f6c8[_0xcd15('0x18')][_0xdcb70a][_0xcd15('0x20')]&&_0x12f6c8[_0xcd15('0x18')][_0xdcb70a][_0xcd15('0x21')]?_0x12f6c8[_0xcd15('0x18')][_0xdcb70a]['destlinkedid']:_0xdcb70a;return RpcUser[_0xcd15('0x22')](_0x12f6c8[_0xcd15('0x6')][_0xb8e8a8],_0x3d7e13,_0x422bf6)[_0xcd15('0x1d')](function(){if(!_0x4d2038){_0x12f6c8[_0xcd15('0x7')][_0xb8e8a8]={};logger[_0xcd15('0x1f')](_0xcd15('0x23'),_0xdcb70a,_0x12f6c8[_0xcd15('0x5')][_0x34e32e][_0xcd15('0x24')],_0xb8e8a8,_0x34e32e);_0x12f6c8[_0xcd15('0x7')][_0xb8e8a8]['timer']=setTimeout(_0x12f6c8[_0xcd15('0x25')]['bind'](_0x12f6c8,_0xb8e8a8),_0x12f6c8[_0xcd15('0x5')][_0x34e32e]['acwTimeout']*0x3e8);_0x12f6c8[_0xcd15('0x7')][_0xb8e8a8][_0xcd15('0x26')]=moment()[_0xcd15('0x27')]('YYYY-MM-DD\x20HH:mm:ss');_0x12f6c8[_0xcd15('0x7')][_0xb8e8a8][_0xcd15('0x28')]=_0xdcb70a;_0x12f6c8[_0xcd15('0x7')][_0xb8e8a8]['queue']=_0x34e32e;_0x12f6c8[_0xcd15('0x7')][_0xb8e8a8][_0xcd15('0x29')]=function(){var _0x1e0ceb=getDiff(_0x12f6c8[_0xcd15('0x7')][_0xb8e8a8][_0xcd15('0x26')]);clearTimeout(_0x12f6c8[_0xcd15('0x7')][_0xb8e8a8][_0xcd15('0x2a')]);_0x12f6c8['timers'][_0xb8e8a8]['timer']=![];RpcVoiceAgentReport[_0xcd15('0x2b')]({'acwtime':_0x1e0ceb},_0x12f6c8[_0xcd15('0x7')][_0xb8e8a8][_0xcd15('0x28')],_0xb8e8a8)[_0xcd15('0x1d')](function(_0x500ea3){logger['info'](_0xcd15('0x2c'),_0xdcb70a,_0x1e0ceb,_0x500ea3);})[_0xcd15('0x2d')](function(_0xf1bc28){logger[_0xcd15('0x2e')](_0xcd15('0x2f'),_0xdcb70a,_0xf1bc28);});delete _0x12f6c8[_0xcd15('0x7')][_0xb8e8a8];};}});}else{logger[_0xcd15('0x1f')](_0xcd15('0x30'),_0xdcb70a,_0xb8e8a8,_0x34e32e);}});}})['catch'](function(){logger['error'](_0xcd15('0x23'),_0xdcb70a,_0x12f6c8[_0xcd15('0x5')][_0x34e32e]['acwTimeout'],_0xb8e8a8,_0x34e32e);})[_0xcd15('0x31')](function(){delete _0x12f6c8[_0xcd15('0x18')][_0xdcb70a];});}catch(_0x7fb8b0){logger[_0xcd15('0x2e')](_0xcd15('0x32'),_0x7fb8b0[_0xcd15('0x33')]);}};Acw[_0xcd15('0x16')]['stopAcw']=function(_0x353662){try{var _0x3ed96a=this;if(_0x3ed96a[_0xcd15('0x7')][_0x353662]){_0x3ed96a['timers'][_0x353662][_0xcd15('0x2a')]=![];var _0x313f64=_0x3ed96a['timers'][_0x353662][_0xcd15('0x28')];var _0x31377e=_0x3ed96a[_0xcd15('0x7')][_0x353662][_0xcd15('0x19')];var _0x55e4f6=_0x3ed96a[_0xcd15('0x5')][_0x31377e]['acwTimeout'];logger[_0xcd15('0x1f')](_0xcd15('0x34'),_0x313f64,_0x353662);RpcUser[_0xcd15('0x35')](this[_0xcd15('0x6')][_0x353662]);RpcVoiceAgentReport['update']({'acwtime':_0x55e4f6,'agentacw':!![]},_0x313f64,_0x353662)['then'](function(_0x11aceb){logger[_0xcd15('0x1f')]('[%s][UPDATE][ACWTIME:%s]',_0x313f64,_0x55e4f6,_0x11aceb);})[_0xcd15('0x2d')](function(_0x5ca8f7){logger[_0xcd15('0x2e')](_0xcd15('0x2f'),_0x313f64,_0x5ca8f7);});}else{logger[_0xcd15('0x2e')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x353662);if(_0x3ed96a[_0xcd15('0x7')]){logger[_0xcd15('0x1f')](_0xcd15('0x36'),JSON['stringify'](_0x3ed96a[_0xcd15('0x7')]));}}}catch(_0x1fb295){logger['error'](_0xcd15('0x37'),_0x1fb295[_0xcd15('0x33')]);}};Acw[_0xcd15('0x16')][_0xcd15('0x9')]=function(_0x5ab838){try{if(this['voiceQueues'][_0x5ab838[_0xcd15('0x19')]]&&(this[_0xcd15('0x5')][_0x5ab838[_0xcd15('0x19')]]['acw']||this[_0xcd15('0x5')][_0x5ab838[_0xcd15('0x19')]][_0xcd15('0x38')])){if(this[_0xcd15('0x6')][_0x5ab838[_0xcd15('0x39')]]){this['channels'][_0x5ab838['uniqueid']]={'queue':_0x5ab838[_0xcd15('0x19')],'interface':_0x5ab838[_0xcd15('0x39')],'destlinkedid':_0x5ab838['destlinkedid']};}}}catch(_0xc20448){logger[_0xcd15('0x2e')](_0xcd15('0x3a'),_0xc20448[_0xcd15('0x33')]);}};Acw[_0xcd15('0x16')][_0xcd15('0x3b')]=function(_0x33f4bc){try{if(this[_0xcd15('0x5')][_0x33f4bc[_0xcd15('0x19')]]&&(this['voiceQueues'][_0x33f4bc['queue']][_0xcd15('0x2')]||this[_0xcd15('0x5')][_0x33f4bc[_0xcd15('0x19')]][_0xcd15('0x38')])){if(this[_0xcd15('0x6')][_0x33f4bc[_0xcd15('0x39')]]){this[_0xcd15('0x18')][_0x33f4bc[_0xcd15('0x28')]]={'queue':_0x33f4bc[_0xcd15('0x19')],'interface':_0x33f4bc['interface']};}}}catch(_0x5b6d76){logger[_0xcd15('0x2e')]('[ACW][syncAgentConnectPreview]\x20%s',_0x5b6d76[_0xcd15('0x33')]);}};Acw[_0xcd15('0x16')][_0xcd15('0xc')]=function(_0x5f303f){try{if(this[_0xcd15('0x18')][_0x5f303f[_0xcd15('0x28')]]&&_[_0xcd15('0x3c')](this[_0xcd15('0x18')][_0x5f303f['uniqueid']]['attended'])){logger[_0xcd15('0x1f')](_0xcd15('0x3d'),_0x5f303f['uniqueid']);this[_0xcd15('0x17')](_0x5f303f[_0xcd15('0x28')]);}else if(this['channels'][_0x5f303f[_0xcd15('0x3e')]]&&_[_0xcd15('0x3c')](this['channels'][_0x5f303f[_0xcd15('0x3e')]]['attended'])){logger[_0xcd15('0x1f')](_0xcd15('0x3f'),_0x5f303f[_0xcd15('0x3e')]);this['startAcw'](_0x5f303f[_0xcd15('0x3e')]);}}catch(_0x3952fb){logger[_0xcd15('0x2e')](_0xcd15('0x40'),_0x3952fb[_0xcd15('0x33')]);}};Acw[_0xcd15('0x16')][_0xcd15('0xe')]=function(_0x97a7c8){try{if(this[_0xcd15('0x18')][_0x97a7c8['uniqueid']]&&this[_0xcd15('0x18')][_0x97a7c8[_0xcd15('0x28')]][_0xcd15('0x20')]){logger[_0xcd15('0x1f')](_0xcd15('0x41'),_0x97a7c8[_0xcd15('0x28')]);this['startAcw'](_0x97a7c8[_0xcd15('0x28')]);}else if(this[_0xcd15('0x18')][_0x97a7c8['linkedid']]&&this['channels'][_0x97a7c8[_0xcd15('0x3e')]][_0xcd15('0x20')]){logger['info'](_0xcd15('0x42'),_0x97a7c8[_0xcd15('0x3e')]);this[_0xcd15('0x17')](_0x97a7c8[_0xcd15('0x3e')]);}}catch(_0xce8636){logger[_0xcd15('0x2e')]('[ACW][syncHangup]\x20%s',_0xce8636[_0xcd15('0x33')]);}};Acw[_0xcd15('0x16')][_0xcd15('0x43')]=function(_0x47624b){try{if(!_[_0xcd15('0x44')](this['channels'][_0x47624b[_0xcd15('0x45')]])){this['startAcw'](_0x47624b[_0xcd15('0x45')]);if(this['channels'][_0x47624b[_0xcd15('0x46')]]){this[_0xcd15('0x18')][_0x47624b[_0xcd15('0x46')]][_0xcd15('0x20')]=!![];this[_0xcd15('0x18')][_0x47624b[_0xcd15('0x47')]]=this[_0xcd15('0x18')][_0x47624b['secondtransfereruniqueid']];delete this['channels'][_0x47624b[_0xcd15('0x46')]];}}else if(!_[_0xcd15('0x44')](this[_0xcd15('0x18')][_0x47624b[_0xcd15('0x47')]])){this[_0xcd15('0x17')](_0x47624b[_0xcd15('0x47')]);if(this[_0xcd15('0x18')][_0x47624b[_0xcd15('0x48')]]){this[_0xcd15('0x18')][_0x47624b['origtransfereruniqueid']][_0xcd15('0x20')]=!![];this[_0xcd15('0x18')][_0x47624b[_0xcd15('0x45')]]=this[_0xcd15('0x18')][_0x47624b['origtransfereruniqueid']];delete this[_0xcd15('0x18')][_0x47624b[_0xcd15('0x48')]];}}}catch(_0x3ad176){logger[_0xcd15('0x2e')](_0xcd15('0x49'),_0x3ad176[_0xcd15('0x33')]);}};Acw[_0xcd15('0x16')][_0xcd15('0x11')]=function(_0x35840a){try{if(this[_0xcd15('0x18')][_0x35840a[_0xcd15('0x4a')]]){logger[_0xcd15('0x1f')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0xcd15('0x4b')](_0x35840a[_0xcd15('0x4a')]));this[_0xcd15('0x17')](_0x35840a['transfereruniqueid']);}else if(this[_0xcd15('0x18')][_0x35840a['transfererlinkedid']]){logger[_0xcd15('0x1f')](_0xcd15('0x4c'),JSON[_0xcd15('0x4b')](_0x35840a[_0xcd15('0x4d')]));this[_0xcd15('0x17')](_0x35840a[_0xcd15('0x4d')]);}}catch(_0x297fcb){logger['error']('[ACW][syncBlindTransfer]\x20%s',_0x297fcb['message']);}};Acw[_0xcd15('0x16')][_0xcd15('0x4e')]=function(_0x31eea4){try{if(this[_0xcd15('0x5')][_0x31eea4[_0xcd15('0x19')]]&&this[_0xcd15('0x5')][_0x31eea4['queue']][_0xcd15('0x4f')]==='all'){if(this[_0xcd15('0x6')][_0x31eea4[_0xcd15('0x39')]]){logger[_0xcd15('0x1f')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x31eea4[_0xcd15('0x28')],_0x31eea4[_0xcd15('0x39')],_0x31eea4[_0xcd15('0x19')]);return RpcUser[_0xcd15('0x22')](this['agents'][_0x31eea4[_0xcd15('0x39')]],_0xcd15('0x50'),_0x31eea4[_0xcd15('0x28')]);}}}catch(_0x135de6){logger[_0xcd15('0x2e')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x135de6[_0xcd15('0x33')]);}};module[_0xcd15('0x51')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index a525c1d..099b523 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 _0x6843=['promisify','action','error','format','inspect','actionSipShowRegistry','actionDeviceStateList','devicestatelist','sippeerstatus','actionQueueSummary','queuesummary','coreshowchannels','info','once','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipPeerStatus','actionCoreShowChannels','catch','[ami.js][fullybooted]','close','exports','asterisk-manager','bluebird','util','../../config/logger','ami','../../config/environment','asterisk','port','username','password','keepConnected','Action'];(function(_0x2cac05,_0x3c6cdf){var _0x2ea2ef=function(_0x1ff15a){while(--_0x1ff15a){_0x2cac05['push'](_0x2cac05['shift']());}};_0x2ea2ef(++_0x3c6cdf);}(_0x6843,0x14a));var _0x3684=function(_0x3d9330,_0x27955d){_0x3d9330=_0x3d9330-0x0;var _0x200eba=_0x6843[_0x3d9330];return _0x200eba;};'use strict';var Manager=require(_0x3684('0x0'));var BPromise=require(_0x3684('0x1'));var util=require(_0x3684('0x2'));var logger=require(_0x3684('0x3'))(_0x3684('0x4'));var config=require(_0x3684('0x5'));var ami=new Manager(config[_0x3684('0x6')][_0x3684('0x7')],config[_0x3684('0x6')]['ip'],config[_0x3684('0x6')][_0x3684('0x8')],config['asterisk'][_0x3684('0x9')],!![]);ami[_0x3684('0xa')]();ami[_0x3684('0xb')]=BPromise[_0x3684('0xc')](ami[_0x3684('0xd')]);function error(_0x2b9a87){logger[_0x3684('0xe')](util[_0x3684('0xf')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0x3684('0x8')],config['asterisk']['ip'],config[_0x3684('0x6')][_0x3684('0x7')],util[_0x3684('0x10')](_0x2b9a87,![],null)));}function close(){logger['error'](util[_0x3684('0xf')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x3684('0x6')]['username'],config[_0x3684('0x6')]['ip'],config[_0x3684('0x6')][_0x3684('0x7')]));}ami[_0x3684('0x11')]=function(){return function(){return ami[_0x3684('0xb')]({'action':'sipshowregistry'});};};ami[_0x3684('0x12')]=function(){return function(){return ami[_0x3684('0xb')]({'action':_0x3684('0x13')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0x3684('0xb')]({'action':_0x3684('0x14')});};};ami[_0x3684('0x15')]=function(){return function(){return ami['Action']({'action':_0x3684('0x16')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x3684('0xb')]({'action':_0x3684('0x17')});};};function connect(){logger[_0x3684('0x18')](util[_0x3684('0xf')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config['asterisk']['username'],config[_0x3684('0x6')]['ip'],config['asterisk'][_0x3684('0x7')]));ami[_0x3684('0x19')](_0x3684('0xe'),error);ami[_0x3684('0x19')]('close',close);}ami['on'](_0x3684('0x1a'),connect);ami['on']('shutdown',function(_0x4f29d1){logger[_0x3684('0x18')](util[_0x3684('0xf')](_0x3684('0x1b'),config[_0x3684('0x6')]['username'],config[_0x3684('0x6')]['ip'],config['asterisk'][_0x3684('0x7')],util['inspect'](_0x4f29d1,![],null)));});ami['on'](_0x3684('0x1c'),function(){logger[_0x3684('0x18')](util[_0x3684('0xf')](_0x3684('0x1d'),config[_0x3684('0x6')]['username'],config[_0x3684('0x6')]['ip'],config[_0x3684('0x6')][_0x3684('0x7')]));return Promise[_0x3684('0x1e')]()['then'](ami[_0x3684('0x11')]())[_0x3684('0x1f')](ami[_0x3684('0x12')]())[_0x3684('0x1f')](ami[_0x3684('0x20')]())[_0x3684('0x1f')](ami[_0x3684('0x15')]())[_0x3684('0x1f')](ami[_0x3684('0x21')]())[_0x3684('0x22')](function(_0x4b73f5){logger['error'](_0x3684('0x23'),util[_0x3684('0x10')](_0x4b73f5,{'showHidden':![],'depth':null}));});});ami[_0x3684('0x19')](_0x3684('0xe'),error);ami[_0x3684('0x19')](_0x3684('0x24'),close);module[_0x3684('0x25')]=ami; \ No newline at end of file +var _0xe58d=['fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','catch','[ami.js][fullybooted]','exports','asterisk-manager','util','../../config/logger','ami','../../config/environment','asterisk','port','username','password','keepConnected','Action','promisify','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','actionSipPeerStatus','actionQueueSummary','queuesummary','actionCoreShowChannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect'];(function(_0x2bc17e,_0x4c79a6){var _0xcebc15=function(_0x36ff73){while(--_0x36ff73){_0x2bc17e['push'](_0x2bc17e['shift']());}};_0xcebc15(++_0x4c79a6);}(_0xe58d,0x10a));var _0xde58=function(_0x54806f,_0x316e89){_0x54806f=_0x54806f-0x0;var _0xf68b50=_0xe58d[_0x54806f];return _0xf68b50;};'use strict';var Manager=require(_0xde58('0x0'));var BPromise=require('bluebird');var util=require(_0xde58('0x1'));var logger=require(_0xde58('0x2'))(_0xde58('0x3'));var config=require(_0xde58('0x4'));var ami=new Manager(config[_0xde58('0x5')][_0xde58('0x6')],config[_0xde58('0x5')]['ip'],config[_0xde58('0x5')][_0xde58('0x7')],config[_0xde58('0x5')][_0xde58('0x8')],!![]);ami[_0xde58('0x9')]();ami[_0xde58('0xa')]=BPromise[_0xde58('0xb')](ami['action']);function error(_0x36009c){logger[_0xde58('0xc')](util[_0xde58('0xd')](_0xde58('0xe'),config['asterisk']['username'],config[_0xde58('0x5')]['ip'],config['asterisk']['port'],util['inspect'](_0x36009c,![],null)));}function close(){logger[_0xde58('0xc')](util[_0xde58('0xd')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xde58('0x5')][_0xde58('0x7')],config['asterisk']['ip'],config[_0xde58('0x5')]['port']));}ami[_0xde58('0xf')]=function(){return function(){return ami['Action']({'action':_0xde58('0x10')});};};ami[_0xde58('0x11')]=function(){return function(){return ami['Action']({'action':'devicestatelist'});};};ami[_0xde58('0x12')]=function(){return function(){return ami['Action']({'action':'sippeerstatus'});};};ami[_0xde58('0x13')]=function(){return function(){return ami[_0xde58('0xa')]({'action':_0xde58('0x14')});};};ami[_0xde58('0x15')]=function(){return function(){return ami[_0xde58('0xa')]({'action':'coreshowchannels'});};};function connect(){logger['info'](util[_0xde58('0xd')](_0xde58('0x16'),config[_0xde58('0x5')]['username'],config['asterisk']['ip'],config[_0xde58('0x5')][_0xde58('0x6')]));ami[_0xde58('0x17')](_0xde58('0xc'),error);ami[_0xde58('0x17')](_0xde58('0x18'),close);}ami['on'](_0xde58('0x19'),connect);ami['on'](_0xde58('0x1a'),function(_0x87d437){logger[_0xde58('0x1b')](util[_0xde58('0xd')](_0xde58('0x1c'),config[_0xde58('0x5')][_0xde58('0x7')],config['asterisk']['ip'],config[_0xde58('0x5')]['port'],util[_0xde58('0x1d')](_0x87d437,![],null)));});ami['on'](_0xde58('0x1e'),function(){logger[_0xde58('0x1b')](util[_0xde58('0xd')](_0xde58('0x1f'),config[_0xde58('0x5')][_0xde58('0x7')],config[_0xde58('0x5')]['ip'],config[_0xde58('0x5')][_0xde58('0x6')]));return Promise[_0xde58('0x20')]()[_0xde58('0x21')](ami['actionSipShowRegistry']())[_0xde58('0x21')](ami[_0xde58('0x11')]())[_0xde58('0x21')](ami[_0xde58('0x12')]())['then'](ami[_0xde58('0x13')]())[_0xde58('0x21')](ami[_0xde58('0x15')]())[_0xde58('0x22')](function(_0x11f804){logger[_0xde58('0xc')](_0xde58('0x23'),util[_0xde58('0x1d')](_0x11f804,{'showHidden':![],'depth':null}));});});ami[_0xde58('0x17')](_0xde58('0xc'),error);ami['once']('close',close);module[_0xde58('0x24')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 611639a..d257542 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 _0x9bde=['message','result','catch','exports','bluebird','ami','http','Request','request','debug','rpc','memberReport','error'];(function(_0x3b7b8a,_0x52c3b0){var _0x441206=function(_0x5d34d3){while(--_0x5d34d3){_0x3b7b8a['push'](_0x3b7b8a['shift']());}};_0x441206(++_0x52c3b0);}(_0x9bde,0xe1));var _0xe9bd=function(_0x5d97ec,_0x5649cf){_0x5d97ec=_0x5d97ec-0x0;var _0x3f3c5e=_0x9bde[_0x5d97ec];return _0x3f3c5e;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var client=jayson['client'][_0xe9bd('0x2')]({'port':0x2329});client[_0xe9bd('0x3')]=function(_0x131f6a,_0x1c1b34){return new BPromise(function(_0x10822d,_0x1a4d14){return client[_0xe9bd('0x4')](_0x131f6a,_0x1c1b34)['then'](function(_0x4763e9){logger[_0xe9bd('0x5')](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x1c1b34,_0x4763e9);if(_0x4763e9[_0xe9bd('0x8')]){logger[_0xe9bd('0x8')](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x4763e9[_0xe9bd('0x8')][_0xe9bd('0x9')],_0x1c1b34);return _0x1a4d14(_0x4763e9['error']['message']);}else{return _0x10822d(_0x4763e9[_0xe9bd('0xa')]);}})[_0xe9bd('0xb')](function(_0x2601ac){logger['error'](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x2601ac,_0x1c1b34);return _0x1a4d14(_0x2601ac);});});};module[_0xe9bd('0xc')]=client; \ No newline at end of file +var _0xcb91=['request','debug','memberReport','error','rpc','message','result','catch','exports','../../config/logger','ami','client','http'];(function(_0x5e6cb8,_0x16cf56){var _0x3faeb3=function(_0x1a7355){while(--_0x1a7355){_0x5e6cb8['push'](_0x5e6cb8['shift']());}};_0x3faeb3(++_0x16cf56);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x52e0ee,_0x52f7c1){_0x52e0ee=_0x52e0ee-0x0;var _0x32534c=_0xcb91[_0x52e0ee];return _0x32534c;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var client=jayson[_0x1cb9('0x2')][_0x1cb9('0x3')]({'port':0x2329});client['Request']=function(_0x8c392f,_0x2c17b8){return new BPromise(function(_0x545a34,_0x13d5fd){return client[_0x1cb9('0x4')](_0x8c392f,_0x2c17b8)['then'](function(_0x226b69){logger[_0x1cb9('0x5')]('rpc',_0x1cb9('0x6'),_0x8c392f,_0x2c17b8,_0x226b69);if(_0x226b69[_0x1cb9('0x7')]){logger['error'](_0x1cb9('0x8'),'memberReport',_0x8c392f,_0x226b69['error'][_0x1cb9('0x9')],_0x2c17b8);return _0x13d5fd(_0x226b69[_0x1cb9('0x7')][_0x1cb9('0x9')]);}else{return _0x545a34(_0x226b69[_0x1cb9('0xa')]);}})[_0x1cb9('0xb')](function(_0x50ce71){logger[_0x1cb9('0x7')](_0x1cb9('0x8'),_0x1cb9('0x6'),_0x8c392f,_0x50ce71,_0x2c17b8);return _0x13d5fd(_0x50ce71);});});};module[_0x1cb9('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 9e3b648..2d9d7ec 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 _0x3615=['content','indexOf','true','catch','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','resolve','checkIsTrunkReachable','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','power','predictive','Queue','method\x20not\x20recognized','dialGlobalInterval','silly','Dialer::ifTime()','intervalIftime','Global:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','queue','uniqueId','answertime','YYYY-MM-DD\x20HH:mm:ss','uniqueid','outboundAnswerCallsDay','reason','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','ivr','updateOriginated','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','statedesc','dropreason','countdropretry','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','rescheduleContact','add','ContactId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','Drop','calleridname','calleridnum','createHistory','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','dialAbandonedRetryFrequency','countabandonedretry','dialAbandonedMaxRetry','queueCallerAbandonCreateState','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','syncNewExten','actions','channel','syncQueueMember','actionid','strategy','roundrobin','isNil','locked','paused','stateinterface','idHopper','syncQueueStatusComplete','rrmemory','preview','run','[Catch][Preview][syncQueueStatusComplete]','ListId','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','getQueue','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','exten','xcally-motion-dialer','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','AMD','emit','custom:amd','amd','[syncHangupInAMD]','MACHINE','Machine','membername','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','minutes','[rescheduleContact][Machine]','dialAMDActive','value','buildObj','saveInDb','[syncHangupInAMDIvr]','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','outboundUnknownCallsDay','cause-txt','Unknow','queuesSummary','running','statusMessage','getQueueCampaignStatusMessage','available','inUse','talking','ACTIVE','[syncQueueSummary]','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','handleIvr','actionOriginate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','dialQueueOptions','dialAgiAfterHangupAgent','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','createdAt','updatedAt','%s%s','XMD-','toUpper','isTrunkReachable','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','variables','originate','SIP/%s/%s%s','dialPrefix','dialCutDigit','substring','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','object','entity\x20is\x20undefine','[callProgressDetecting]','evt\x20is\x20undefine','verifyAdditionalPhones','outboundNoSuchCallsDay','custom:agentnosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','dialPredictiveOptimizationPercentage','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','round','predictiveIntervalMinThreshold','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','avgHandleTime','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalAvgTalktime','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalHitRate','abandonmentRate','agentBusyFactor','busyFactor','Unknown\x20Predictive','check\x20failure','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','floor','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','dialRecallMeTimeout','voicePause','unlockContact','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','temp','maxNumberOriginate','getContactDialerIvr','dialOrderByScheduledAt','RUNNING','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','getContactDialer','checkContactEmpty','[countReScheduled]\x20','checkIsBlackList','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','checkContactLowerLimitOriginate','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','Ts\x20=\x20','[abandonmentRate]','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','m\x20=\x20','p\x20=\x20','exports','util','uuid','moment','ioredis','./utils/hopper','../../../config/environment/','../../../config/logger','dialer','booked','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','prototype','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','syncQueueSummary','custom:queuesummarycomplete','syncQueueSummaryComplete','syncHangup','newexten','varset','syncVarSet','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','getSettings','then','isUndefined','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','name','info','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','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','predictiveIntervalAvgHoldtime','History\x20information\x20are\x20empty','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','merge','getSeconds','startProgressive','startProgressive\x20value\x20cleared','startPredictive','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','endtime','starttime','queueStatusComplete','[booked][unlockQueueStatus]','stringify','pick','Interval','NULL_INTERVAL','Intervals','\x20INTERVAL_IS_NULL','isEmpty','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','sendMessageOneNotActive','DISACTIVED','[ifTime][Action]','Error','SIP/%s','reachable','status','unmonitored','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','checkIfTime','checkIfTimeIntervals','ifTimeIvr','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','isArray','length','push','Action','command','iftime\x20%s,%s','interval'];(function(_0x3b96c5,_0x407a7b){var _0x367426=function(_0x4b187b){while(--_0x4b187b){_0x3b96c5['push'](_0x3b96c5['shift']());}};_0x367426(++_0x407a7b);}(_0x3615,0x18a));var _0x5361=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x3615[_0x1035c1];return _0x308d67;};'use strict';var util=require(_0x5361('0x0'));var _=require('lodash');var uuid=require(_0x5361('0x1'));var moment=require(_0x5361('0x2'));var rr=require('rr');var Redis=require(_0x5361('0x3'));var utils=require('./utils');var hopperUtils=require(_0x5361('0x4'));var ut=require('../preview/util/util');var config=require(_0x5361('0x5'));var logger=require(_0x5361('0x6'))(_0x5361('0x7'));var loggerBooked=require(_0x5361('0x6'))(_0x5361('0x8'));var loggerPredictive=require(_0x5361('0x6'))('predictive');var loggerPredictiveCalls=require(_0x5361('0x6'))('predictiveCalls');var loggerSyncQueueSummary=require('../../../config/logger')('syncQueueSummary');var ami=require('../ami');config[_0x5361('0x9')]=_['defaults'](config[_0x5361('0x9')],{'host':_0x5361('0xa'),'port':0x18eb});var io=require(_0x5361('0xb'))(new Redis(config['redis']));var cmHopper=require(_0x5361('0xc'));var voiceQueueRt=require(_0x5361('0xd'));var RpcSetting=require(_0x5361('0xe'));var Interval=require(_0x5361('0xf'));var Action=require(_0x5361('0x10'));var History=require('./models/history');var Final=require('./models/final');var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require(_0x5361('0x11'));var Hangup=require(_0x5361('0x12'));var ipAgi=process[_0x5361('0x13')][_0x5361('0x14')]||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x5361('0x15')][_0x5361('0x16')]=function(_0x43704f){this[_0x5361('0x17')]=this['tail']?this[_0x5361('0x17')][_0x5361('0x18')](_0x43704f):_0x43704f();};function Dialer(_0x4d149c,_0x16103f){this[_0x5361('0x19')]=new Sequence();this['preview']=_0x16103f;this[_0x5361('0x1a')]=_0x4d149c[_0x5361('0x1a')];this['campaigns']=_0x4d149c[_0x5361('0x1b')];this[_0x5361('0x1c')]=_0x4d149c[_0x5361('0x1c')];this[_0x5361('0x1d')]=_0x4d149c[_0x5361('0x1d')];this['maxNumberOriginate']=config['maxNumberOriginate']||0x2;this['channels']={};this['actions']={};this['contactsId']={};this['uniqueId']={};this['optionPredictive']={};this['startPredictive']={};this['startProgressive']={};this['ivrOriginated']={};this[_0x5361('0x1e')]={};this[_0x5361('0x1f')]={};this['queuesSummary']={};ami['on'](_0x5361('0x20'),this[_0x5361('0x21')][_0x5361('0x22')](this));ami['on']('queuecallerabandon',this[_0x5361('0x23')][_0x5361('0x22')](this));ami['on'](_0x5361('0x24'),this[_0x5361('0x25')]['bind'](this));ami['on']('agentcomplete',this[_0x5361('0x26')]['bind'](this));ami['on'](_0x5361('0x27'),this[_0x5361('0x28')][_0x5361('0x22')](this));ami['on'](_0x5361('0x29'),this[_0x5361('0x2a')][_0x5361('0x22')](this));ami['on']('hangup',this[_0x5361('0x2b')][_0x5361('0x22')](this));ami['on'](_0x5361('0x2c'),this['syncNewExten'][_0x5361('0x22')](this));ami['on'](_0x5361('0x2d'),this[_0x5361('0x2e')][_0x5361('0x22')](this));ami['on']('queuemember',this['syncQueueMember'][_0x5361('0x22')](this));ami['on'](_0x5361('0x2f'),this['syncQueueStatusComplete']['bind'](this));this[_0x5361('0x30')]();this[_0x5361('0x31')]();RpcSetting[_0x5361('0x32')]()[_0x5361('0x33')](function(_0x8e92a8){previewRecallmeReminderInterval=_0x8e92a8['previewRecallmeReminderInterval'];});}function isNotNull(_0x1e0f5a){return _0x1e0f5a!==null&&!_[_0x5361('0x34')](_0x1e0f5a);}function msgResponse(_0x2b5910,_0x299980,_0x24c742){return{'action':_0x2b5910,'response':_0x299980,'message':_0x24c742,'stack':_0x24c742};}function emit(_0x5c231b,_0xf5f702,_0x4f138d){io['to'](_0x5c231b)['emit'](_0xf5f702,_0x4f138d);}function emitOutboundVoiceQueueSummary(_0x158198){if(_0x158198[_0x5361('0x35')]===_0x5361('0x36')){logger[_0x5361('0x37')](_0x5361('0x38'),util[_0x5361('0x39')](_0x158198,{'showHidden':![],'depth':null}));emit(util[_0x5361('0x3a')](_0x5361('0x3b'),_0x158198[_0x5361('0x3c')]),'voice_queue:save',_0x158198);}}function checkGetDataPredictive(_0x36604e){if(isNotNull(_0x36604e)&&!_['isEmpty'](_0x36604e)){loggerPredictive[_0x5361('0x3d')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x5361('0x3d')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x36604e[_0x5361('0x3e')]);loggerPredictive[_0x5361('0x3d')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x36604e['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x5361('0x3d')](_0x5361('0x3f'),_0x36604e[_0x5361('0x40')]);loggerPredictive[_0x5361('0x3d')](_0x5361('0x41'),_0x36604e['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x5361('0x3d')](_0x5361('0x42'),_0x36604e['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x5361('0x3d')](_0x5361('0x43'),_0x36604e['predictiveIntervalAvgTalktime']);loggerPredictive[_0x5361('0x3d')](_0x5361('0x44'));if(_0x36604e['predictiveIntervalTotalCalls']>0x0){if(!_[_0x5361('0x34')](_0x36604e['predictiveIntervalAvgTalktime'])&&_0x36604e['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x5361('0x3d')](_0x5361('0x45'));if(!_['isUndefined'](_0x36604e[_0x5361('0x46')])&&_0x36604e[_0x5361('0x46')]>0x0){return!![];}loggerPredictive[_0x5361('0x3d')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive['info']('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x5361('0x3d')](_0x5361('0x47'));}return![];}function mergeDataErlangB(_0x31d82d){return function(_0x215683){loggerPredictive[_0x5361('0x3d')]('---------\x20ErlangB\x20---------');loggerPredictive[_0x5361('0x3d')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x215683[_0x5361('0x48')]);loggerPredictive['info'](_0x5361('0x49'),_0x215683['erlangCallToSecond']);loggerPredictive[_0x5361('0x3d')](_0x5361('0x4a'),_0x215683['erlangAbandonmentRate']);loggerPredictive[_0x5361('0x3d')](_0x5361('0x4b'),_0x215683['erlangBusyFactor']);loggerPredictive[_0x5361('0x3d')](_0x5361('0x4a'),_0x215683[_0x5361('0x4c')]);loggerPredictive[_0x5361('0x3d')](_0x5361('0x44'));_[_0x5361('0x4d')](_0x31d82d,_0x215683);};}function ifInterval(_0x2a0990,_0x3f89e9){if(_[_0x5361('0x34')](_0x3f89e9)){return![];}return utils[_0x5361('0x4e')](undefined,_0x3f89e9)<_0x2a0990*0x3c;}function clearPredictiveAttributes(_0x4b3a9b){if(_0x4b3a9b[_0x5361('0x4f')]){_0x4b3a9b[_0x5361('0x4f')]=undefined;loggerPredictive['debug'](_0x4b3a9b[_0x5361('0x3c')],_0x5361('0x50'));}if(_0x4b3a9b[_0x5361('0x51')]){_0x4b3a9b[_0x5361('0x51')]=undefined;loggerPredictive[_0x5361('0x37')](_0x4b3a9b[_0x5361('0x3c')],'startPredictive\x20value\x20cleared');}if(_0x4b3a9b[_0x5361('0x52')]){clearInterval(_0x4b3a9b[_0x5361('0x52')]);_0x4b3a9b['handlePredictive']=undefined;loggerPredictive[_0x5361('0x37')](_0x4b3a9b[_0x5361('0x3c')],_0x5361('0x53'));}}function loggerCatchPredictive(_0x433f96,_0x1f5b47){return function(_0x5934ed){loggerPredictive[_0x5361('0x54')](_0x1f5b47['name'],_0x433f96);loggerPredictive[_0x5361('0x54')](_0x5934ed[_0x5361('0x55')]);clearPredictiveAttributes(_0x1f5b47);};}function loggerCatch(_0x1eb932){return function(_0x356e7f){logger[_0x5361('0x54')](_0x1eb932,util['inspect'](_0x356e7f,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x497da4,_0x39401f,_0x5b4f85){return function(_0x553e66){utils['checkContactLowerLimitOriginate'](_0x39401f,_0x5b4f85,0x0);logger[_0x5361('0x54')](_0x497da4,util[_0x5361('0x39')](_0x553e66,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2da17f){return function(_0x5222ac){if(isNotNull(_0x5222ac)&&isNotNull(_0x5222ac[0x0])){if(_0x5222ac[0x0][_0x5361('0x56')]>0x0){_0x2da17f[_0x5361('0x57')]=utils[_0x5361('0x58')][_0x5361('0x59')];logger[_0x5361('0x3d')](_0x5361('0x5a')+_0x2da17f[_0x5361('0x3c')],_0x5222ac[0x0][_0x5361('0x56')],'contacts');}else{_0x2da17f[_0x5361('0x57')]=utils[_0x5361('0x58')][_0x5361('0x5b')];logger[_0x5361('0x3d')](_0x5361('0x5c')+_0x2da17f['name']);}}};}function createObjHistory(_0xa9cb55,_0x408a70,_0x5b1db8,_0x22a373,_0x2cf52c){_0xa9cb55['message']=_0x5b1db8;var _0xa762f9=new Action(_0xa9cb55,_0x408a70);var _0x45c6bf=new History(_0xa762f9);_0x45c6bf[_0x5361('0x5d')]=_0x22a373;_0x45c6bf['statedesc']=_0x2cf52c;_0x45c6bf[_0x5361('0x5e')]=_0xa762f9[_0x5361('0x5f')];return _0x45c6bf;}function unlockQueueStatus(_0x2e5d73,_0x50d4e5){setTimeout(function(){if(_[_0x5361('0x34')](_0x2e5d73[_0x5361('0x60')])){loggerBooked['error']('[unlockQueueStatus][undefined]',_0x50d4e5);}_0x2e5d73['queueStatusComplete']=!![];loggerBooked[_0x5361('0x3d')](_0x5361('0x61'),_0x50d4e5,JSON[_0x5361('0x62')](_[_0x5361('0x63')](_0x2e5d73,[_0x5361('0x3c'),_0x5361('0x60')])));},0x1f3);}function checkInterval(_0xabef8d){return function(){if(!isNotNull(_0xabef8d[_0x5361('0x64')])){_0xabef8d[_0x5361('0x57')]=utils['CAMPAIGN_STATUS'][_0x5361('0x65')];throw _0xabef8d[_0x5361('0x3c')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0xabef8d[_0x5361('0x64')][_0x5361('0x66')])){_0xabef8d['message']=utils['CAMPAIGN_STATUS'][_0x5361('0x65')];throw _0xabef8d[_0x5361('0x3c')]+_0x5361('0x67');}if(!isNotNull(_[_0x5361('0x68')](_0xabef8d[_0x5361('0x64')]['Intervals']))){_0xabef8d[_0x5361('0x57')]=utils[_0x5361('0x58')]['NULL_INTERVAL'];throw _0xabef8d['name']+'\x20INTERVAL_IS_NULL';}};}function checkIsIVRCampaignActive(_0x54bc24){return function(){if(!utils[_0x5361('0x69')](_0x54bc24)){_0x54bc24['message']=utils[_0x5361('0x58')][_0x5361('0x6a')];throw _0x54bc24['name']+_0x5361('0x6b');}};}function emitCampaignSummary(_0x1ac741){if(utils[_0x5361('0x6c')](_0x1ac741)){emit(util[_0x5361('0x3a')]('campaign:ivr:%s',_0x1ac741[_0x5361('0x3c')]),'campaign:save',_0x1ac741);}}function loggerCatchQueueSummary(_0x1272e2,_0x4b0ea6){return function(_0xb1bffc){clearPredictiveAttributes(_0x4b0ea6);emitCampaignSummary(_0x4b0ea6);loggerSyncQueueSummary[_0x5361('0x37')](_0x1272e2,util[_0x5361('0x39')](_0xb1bffc,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x15f195){if(_0x15f195['sendMessageOneNotActive']){if(_0x15f195['originated']===0x0){_0x15f195[_0x5361('0x6d')]=![];_0x15f195[_0x5361('0x57')]=utils[_0x5361('0x58')][_0x5361('0x6a')];loggerSyncQueueSummary[_0x5361('0x37')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x15f195[_0x5361('0x3c')],'is\x20not\x20active');}else{_0x15f195[_0x5361('0x57')]=utils['CAMPAIGN_STATUS'][_0x5361('0x6e')];loggerSyncQueueSummary[_0x5361('0x37')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x15f195[_0x5361('0x3c')],'is\x20disactive');}emitCampaignSummary(_0x15f195);}}function myreject(_0x1e711e){return function(_0x49ff48){return _0x1e711e(msgResponse(_0x5361('0x6f'),_0x5361('0x70'),JSON[_0x5361('0x62')](_0x49ff48)));};}Dialer[_0x5361('0x15')]['isTrunkReachable']=function(_0x2b7b46){return!_[_0x5361('0x34')](_0x2b7b46)&&_0x2b7b46&&!_[_0x5361('0x34')](_0x2b7b46[_0x5361('0x3c')])&&!_[_0x5361('0x34')](_0x2b7b46['active'])&&_0x2b7b46['active']&&(this[_0x5361('0x1d')][util[_0x5361('0x3a')](_0x5361('0x71'),_0x2b7b46['name'])]['status']===_0x5361('0x72')||this['trunks'][util[_0x5361('0x3a')]('SIP/%s',_0x2b7b46[_0x5361('0x3c')])][_0x5361('0x73')]===_0x5361('0x74'));};Dialer[_0x5361('0x15')]['checkIsTrunkReachable']=function(_0x35f5c4){var _0x31004a=this;return function(){if(!_0x31004a['isTrunkReachable'](_0x35f5c4[_0x5361('0x75')])){if(!_0x31004a['isTrunkReachable'](_0x35f5c4[_0x5361('0x76')])){_0x35f5c4[_0x5361('0x57')]=utils[_0x5361('0x58')][_0x5361('0x77')];throw _0x35f5c4['name']+'\x20trunk\x20is\x20not\x20reachable';}}};};Dialer['prototype'][_0x5361('0x78')]=function(_0x2b7162,_0x433c59,_0x2061c0,_0x3364db){var _0x4d422d=this;return function(){var _0x464167=!![];return _0x4d422d['ifTimeIvr'](_0x2b7162,_0x433c59,_0x2061c0,_0x3364db,_0x464167);};};Dialer[_0x5361('0x15')][_0x5361('0x79')]=function(_0x1f5aa2,_0x1e51fa,_0x1062e8,_0x2c2295){var _0x597766=this;return function(){var _0x4ca275=![];return _0x597766['ifTimeIvr'](_0x1f5aa2[_0x5361('0x66')],_0x1e51fa,_0x1062e8,_0x2c2295,_0x4ca275);};};Dialer[_0x5361('0x15')][_0x5361('0x7a')]=function(_0x375b3e,_0x4df03e,_0x3c4ff6,_0x1c5eaa,_0x225dd5){var _0x104264=[];return new Promise(function(_0x4996f6,_0x2d688d){if(!isNotNull(_0x375b3e)){_0x1c5eaa['message']=utils[_0x5361('0x58')][_0x5361('0x65')];return _0x2d688d(msgResponse(_0x5361('0x7b'),_0x5361('0x7c'),_0x3c4ff6+_0x5361('0x7d')));}if(_[_0x5361('0x68')](_0x375b3e)){_0x1c5eaa['message']=utils['CAMPAIGN_STATUS'][_0x5361('0x7e')];return _0x2d688d(msgResponse(_0x5361('0x7b'),_0x5361('0x7c'),_0x3c4ff6+_0x5361('0x7f')));}if(_0x4df03e&&_[_0x5361('0x34')](config[_0x5361('0x80')][_0x4df03e])){_0x1c5eaa['message']=utils['CAMPAIGN_STATUS'][_0x5361('0x81')];return _0x2d688d(msgResponse(_0x5361('0x7b'),_0x5361('0x7c'),_0x3c4ff6+'\x20Timezone\x20unknow\x20'+_0x4df03e));}if(_[_0x5361('0x82')](_0x375b3e)){for(var _0xcf300f=0x0;_0xcf300f<_0x375b3e[_0x5361('0x83')];_0xcf300f+=0x1){_0x104264[_0x5361('0x84')](ami[_0x5361('0x85')]({'action':_0x5361('0x86'),'command':util[_0x5361('0x3a')](_0x5361('0x87'),_0x375b3e[_0xcf300f][_0x5361('0x88')],!_['isUndefined'](config[_0x5361('0x80')][_0x4df03e])?_0x4df03e:'')})[_0x5361('0x33')](function(_0x1f02e7){return _0x1f02e7[_0x5361('0x89')][_0x5361('0x8a')](_0x5361('0x8b'))>=0x0;})[_0x5361('0x8c')](myreject(_0x2d688d)));}}else{_0x104264[_0x5361('0x84')](ami[_0x5361('0x85')]({'action':_0x5361('0x86'),'command':util['format'](_0x5361('0x87'),_0x375b3e,!_[_0x5361('0x34')](config['timezones'][_0x4df03e])?_0x4df03e:'')})['then'](function(_0x5a9126){return _0x5a9126[_0x5361('0x89')][_0x5361('0x8a')]('true')>=0x0;})[_0x5361('0x8c')](myreject(_0x2d688d)));}Promise['all'](_0x104264)[_0x5361('0x33')](function(_0x119678){var _0x46ed71=_[_0x5361('0x8d')](_0x119678);if(_0x46ed71){return _0x4996f6(_0x46ed71);}else{_0x1c5eaa[_0x5361('0x57')]=_0x225dd5?utils[_0x5361('0x58')][_0x5361('0x8e')]:utils[_0x5361('0x58')][_0x5361('0x8f')];return _0x2d688d(msgResponse(_0x5361('0x90'),'Failure','Global:\x20'+_0x225dd5+'\x20'+_0x3c4ff6+'\x20Interval\x20is\x20overtime:\x20'+util[_0x5361('0x39')](_0x375b3e,{'showHidden':![],'depth':null})+_0x5361('0x91')+_0x4df03e));}})[_0x5361('0x8c')](function(_0x3c1cbc){return _0x2d688d(msgResponse(_0x5361('0x7b'),_0x5361('0x7c'),JSON['stringify'](_0x3c1cbc)));});});};Dialer['prototype'][_0x5361('0x30')]=function(){var _0x119b52=this;return cmHopper[_0x5361('0x92')]({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x119b52[_0x5361('0x93')]();},0x3e8);});};Dialer['prototype'][_0x5361('0x93')]=function(){var _0x1d8198=this;var _0x32c71e;for(var _0x2ef793 in this[_0x5361('0x1b')]){if(typeof this[_0x5361('0x1b')][_0x2ef793]!==_0x5361('0x94')){_0x32c71e=this['campaigns'][_0x2ef793];if(utils['isIVRCampaign'](_0x32c71e)&&utils[_0x5361('0x69')](_0x32c71e)){_0x32c71e[_0x5361('0x6d')]=!![];Promise[_0x5361('0x95')]()[_0x5361('0x33')](checkIsIVRCampaignActive(_0x32c71e))[_0x5361('0x33')](checkInterval(_0x32c71e))['then'](_0x1d8198[_0x5361('0x96')](_0x32c71e))[_0x5361('0x33')](_0x1d8198[_0x5361('0x78')](_0x32c71e['dialGlobalInterval'],_0x32c71e[_0x5361('0x97')],_0x32c71e[_0x5361('0x3c')],_0x32c71e))[_0x5361('0x33')](_0x1d8198['checkIfTimeIntervals'](_0x32c71e[_0x5361('0x64')],_0x32c71e['dialTimezone'],_0x32c71e[_0x5361('0x3c')],_0x32c71e))[_0x5361('0x33')](_0x1d8198[_0x5361('0x98')](_0x32c71e))[_0x5361('0x8c')](loggerCatchQueueSummary(_0x5361('0x99'),_0x32c71e));}else{notSendMessagesCampaign(_0x32c71e);}}}};Dialer[_0x5361('0x15')][_0x5361('0x9a')]=function(_0x696f3b){if(_0x696f3b[_0x5361('0x9b')]!=='predictive'){clearPredictiveAttributes(_0x696f3b);}switch(_0x696f3b['dialMethod']){case _0x5361('0x9c'):this[_0x5361('0x9d')](_0x696f3b,0x1);break;case _0x5361('0x9e'):this[_0x5361('0x9d')](_0x696f3b,_0x696f3b['dialPowerLevel']);break;case'predictive':this[_0x5361('0x9f')](_0x696f3b);break;case _0x5361('0x8'):this['handlePower'](_0x696f3b,0x1);break;default:logger[_0x5361('0x54')](_0x5361('0xa0'),_0x696f3b['name'],_0x5361('0xa1'));}};Dialer[_0x5361('0x15')][_0x5361('0x7b')]=function(_0x33a14a,_0x42edbb){var _0x1eb962=_0x33a14a[_0x5361('0x97')];var _0xf13b02=_0x42edbb?_0x33a14a[_0x5361('0xa2')]:_0x33a14a[_0x5361('0x64')][_0x5361('0x66')];logger[_0x5361('0xa3')](_0x5361('0xa4'),_0xf13b02,_0x1eb962,_0x33a14a['name'],util['format']('Voice\x20Queue\x20%s\x20$s',_0x33a14a['name'],_0x33a14a['id']));var _0x110c72=null;return Interval[_0x5361('0xa5')](_0xf13b02,_0x1eb962)[_0x5361('0x33')](function(_0x55530e){if(_0x55530e===!![]){return _0x55530e;}else{_0x33a14a[_0x5361('0x57')]=_0x42edbb?utils[_0x5361('0x58')][_0x5361('0x8e')]:utils['CAMPAIGN_STATUS']['OVERTIME_INTERVAL'];_0x110c72=msgResponse(_0x5361('0x90'),'Failure',_0x5361('0xa6')+_0x42edbb+'\x20'+_0x33a14a[_0x5361('0x3c')]+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0xf13b02,{'showHidden':![],'depth':null})+_0x5361('0x91')+_0x1eb962);}if(_0x110c72!==null){logger[_0x5361('0xa3')](_0x5361('0xa7'),_0x110c72);_0x110c72[_0x5361('0xa8')]=_0x42edbb;throw _0x110c72;}})[_0x5361('0x8c')](function(_0x1ff4c1){logger['error'](_0x5361('0xa9'),_0x1ff4c1);throw msgResponse('[ifTime][Action]',_0x5361('0x70'),util[_0x5361('0x39')](_0x1ff4c1,{'showHidden':![],'depth':null}));});};Dialer[_0x5361('0x15')][_0x5361('0x21')]=function(_0x41004d){if(this[_0x5361('0x1a')][_0x41004d[_0x5361('0xaa')]]){if(this['uniqueId'][_0x41004d['uniqueid']]&&this[_0x5361('0xab')][_0x41004d['uniqueid']][_0x5361('0x35')]!=='ivr'){this['updateOriginated'](this[_0x5361('0x1a')][_0x41004d[_0x5361('0xaa')]]);this[_0x5361('0xab')][_0x41004d['uniqueid']][_0x5361('0xac')]=moment()[_0x5361('0x3a')](_0x5361('0xad'));}}};Dialer[_0x5361('0x15')][_0x5361('0x26')]=function(_0x2d2089){var _0x52c139=this[_0x5361('0xab')][_0x2d2089[_0x5361('0xae')]];if(this[_0x5361('0x1a')][_0x2d2089[_0x5361('0xaa')]]){if(_0x52c139&&_0x52c139[_0x5361('0x35')]!=='ivr'){delete this[_0x5361('0xab')][_0x2d2089[_0x5361('0xae')]];this[_0x5361('0x1a')][_0x2d2089[_0x5361('0xaa')]][_0x5361('0xaf')]+=0x1;var _0x512b3a=new AgentComplete(_0x52c139,_0x2d2089);if(_0x2d2089[_0x5361('0xb0')]==='agent'){_0x512b3a[_0x5361('0xb1')]=this['voiceQueues'][_0x2d2089[_0x5361('0xaa')]][_0x5361('0xb2')]&&this[_0x5361('0x1a')][_0x2d2089['queue']]['dialAgiAfterHangupAgent']?moment()[_0x5361('0x3a')](_0x5361('0xad')):undefined;}hopperUtils['createHistory'](_0x512b3a)['catch'](loggerCatch(_0x5361('0xb3')));hopperUtils[_0x5361('0xb4')](_0x512b3a)['catch'](loggerCatch(_0x5361('0xb5')));}}};Dialer[_0x5361('0x15')][_0x5361('0x23')]=function(_0xb29c18){var _0x593aee=this[_0x5361('0xab')][_0xb29c18[_0x5361('0xae')]];var _0xdda976=this;var _0x1a877c=![];var _0x24eb21;var _0x12844b;if(this[_0x5361('0x1a')][_0xb29c18[_0x5361('0xaa')]]){if(_0x593aee&&_0x593aee[_0x5361('0x35')]!==_0x5361('0xb6')){delete this['uniqueId'][_0xb29c18[_0x5361('0xae')]];this[_0x5361('0xb7')](this[_0x5361('0x1a')][_0xb29c18[_0x5361('0xaa')]]);_0x593aee[_0x5361('0xb8')]=moment()['format'](_0x5361('0xad'));var _0xcc554a=new QueueCallerAbandon(_0x593aee,_0xb29c18);if(utils[_0x5361('0x4e')](_0x593aee[_0x5361('0xb8')],_0x593aee[_0x5361('0xb9')])>=_0x593aee[_0x5361('0xba')]){this[_0x5361('0x1a')][_0xb29c18[_0x5361('0xaa')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x5361('0x1a')][_0xb29c18[_0x5361('0xaa')]][_0x5361('0xbb')]+=0x1;this[_0x5361('0x1a')][_0xb29c18[_0x5361('0xaa')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0xcc554a[_0x5361('0x5d')]=0xa;_0xcc554a[_0x5361('0xbc')]='Drop';_0xcc554a[_0x5361('0xbd')]='TIMEOUT';_0xcc554a[_0x5361('0xb1')]=this['voiceQueues'][_0xb29c18['queue']][_0x5361('0xb2')]?moment()[_0x5361('0x3a')](_0x5361('0xad')):undefined;_0xcc554a[_0x5361('0xbe')]+=0x1;_0xcc554a[_0x5361('0xbf')]+=0x1;_0x24eb21=this[_0x5361('0x1a')][_0xb29c18['queue']][_0x5361('0xc0')];_0x12844b=this[_0x5361('0x1a')][_0xb29c18[_0x5361('0xaa')]][_0x5361('0xc1')];hopperUtils['verifyAdditionalPhones'](_0xcc554a,_0xcc554a['state'],_0x593aee[_0x5361('0xc2')])[_0x5361('0x33')](function(_0x198773){_0x1a877c=_0x198773[_0x5361('0xc3')]==0x1;if(_0xcc554a[_0x5361('0xbe')]>=_0xdda976[_0x5361('0x1a')][_0xb29c18[_0x5361('0xaa')]][_0x5361('0xc4')]){_0xdda976['queueCallerAbandonCreateState'](_0xcc554a,_0x198773[_0x5361('0xc3')]);}else{hopperUtils[_0x5361('0xc5')]({'active':![],'countdropretry':_0xcc554a[_0x5361('0xbe')],'scheduledat':moment()[_0x5361('0xc6')](_0xdda976['voiceQueues'][_0xb29c18[_0x5361('0xaa')]][_0x5361('0xc0')],'minutes')[_0x5361('0x3a')](_0x5361('0xad')),'ContactId':_0x593aee[_0x5361('0xc7')],'ListId':_0x593aee['ListId'],'VoiceQueueId':_0x593aee[_0x5361('0xc8')]||undefined,'CampaignId':_0x593aee[_0x5361('0xc9')]||undefined})[_0x5361('0x8c')](loggerCatch(_0x5361('0xca')));var _0x27da63=new History(_0xcc554a);_0x27da63[_0x5361('0x5d')]=0xa;_0x27da63[_0x5361('0xbc')]=_0x5361('0xcb');_0x27da63[_0x5361('0x5f')]=moment()[_0x5361('0x3a')](_0x5361('0xad'));_0x27da63[_0x5361('0x5e')]=_0x27da63[_0x5361('0x5f')];_0x27da63[_0x5361('0xcc')]=_0xcc554a[_0x5361('0xcc')];_0x27da63[_0x5361('0xcd')]=_0xcc554a[_0x5361('0xcd')];hopperUtils[_0x5361('0xce')](_0x27da63)['catch'](loggerCatch(_0x5361('0xcf')));}})[_0x5361('0x33')](function(){if(_0x1a877c)hopperUtils[_0x5361('0xd0')](_0xcc554a,_0x24eb21,_0x12844b)[_0x5361('0x33')](function(){return 0x1;});});}else{this['voiceQueues'][_0xb29c18[_0x5361('0xaa')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x5361('0x1a')][_0xb29c18[_0x5361('0xaa')]][_0x5361('0xd1')]+=0x1;_0xcc554a[_0x5361('0x5d')]=0xb;_0xcc554a[_0x5361('0xbc')]=_0x5361('0xd2');_0xcc554a[_0x5361('0xbd')]='CALLEREXIT';_0xcc554a['countabandonedretry']+=0x1;_0xcc554a[_0x5361('0xbf')]+=0x1;_0x24eb21=this['voiceQueues'][_0xb29c18[_0x5361('0xaa')]][_0x5361('0xd3')];_0x12844b=this[_0x5361('0x1a')][_0xb29c18[_0x5361('0xaa')]]['callAdditionalPhoneAfterMin'];hopperUtils['verifyAdditionalPhones'](_0xcc554a,_0xcc554a['state'],_0x593aee[_0x5361('0xc2')])[_0x5361('0x33')](function(_0xc33120){if(_0xcc554a[_0x5361('0xd4')]>=_0xdda976[_0x5361('0x1a')][_0xb29c18['queue']][_0x5361('0xd5')]){_0xdda976[_0x5361('0xd6')](_0xcc554a,_0xc33120[_0x5361('0xc3')]);}else{hopperUtils[_0x5361('0xc5')]({'active':![],'countabandonedretry':_0xcc554a[_0x5361('0xd4')],'scheduledat':moment()['add'](_0xdda976['voiceQueues'][_0xb29c18['queue']][_0x5361('0xd3')],'minutes')[_0x5361('0x3a')](_0x5361('0xad')),'ContactId':_0x593aee[_0x5361('0xc7')],'ListId':_0x593aee['ListId'],'VoiceQueueId':_0x593aee['VoiceQueueId']||undefined,'CampaignId':_0x593aee[_0x5361('0xc9')]||undefined})[_0x5361('0x8c')](loggerCatch(_0x5361('0xd7')));var _0x5ab9b8=new History(_0xcc554a);_0x5ab9b8[_0x5361('0x5d')]=0xb;_0x5ab9b8[_0x5361('0xbc')]=_0x5361('0xd2');_0x5ab9b8[_0x5361('0x5f')]=moment()[_0x5361('0x3a')](_0x5361('0xad'));_0x5ab9b8['endtime']=_0x5ab9b8[_0x5361('0x5f')];_0x5ab9b8[_0x5361('0xcc')]=_0xcc554a[_0x5361('0xcc')];_0x5ab9b8[_0x5361('0xcd')]=_0xcc554a[_0x5361('0xcd')];hopperUtils['createHistory'](_0x5ab9b8)[_0x5361('0x8c')](loggerCatch(_0x5361('0xd8')));}})[_0x5361('0x33')](function(){if(_0x1a877c)hopperUtils[_0x5361('0xd0')](_0xcc554a,_0x24eb21,_0x12844b)[_0x5361('0x33')](function(){return 0x1;});});}}}};Dialer[_0x5361('0x15')][_0x5361('0xd9')]=function(_0x295a7c){if(this[_0x5361('0xda')][_0x295a7c[_0x5361('0xae')]]){this['actions'][_0x295a7c[_0x5361('0xae')]]['channel']=_0x295a7c[_0x5361('0xdb')];}if(this[_0x5361('0xab')][_0x295a7c['uniqueid']]){this[_0x5361('0xab')][_0x295a7c['uniqueid']][_0x5361('0xdb')]=_0x295a7c[_0x5361('0xdb')];}};Dialer[_0x5361('0x15')][_0x5361('0xdc')]=function(_0x9366c9){if(!this[_0x5361('0xda')][_0x9366c9[_0x5361('0xdd')]]){return;}var _0x1fe685=this[_0x5361('0x1a')][this[_0x5361('0xda')][_0x9366c9[_0x5361('0xdd')]][_0x5361('0xaa')]][_0x5361('0xde')]||'rrmemory';if(_0x1fe685===_0x5361('0xdf')){if(this[_0x5361('0xda')][_0x9366c9[_0x5361('0xdd')]]&&_[_0x5361('0xe0')](this[_0x5361('0xda')][_0x9366c9[_0x5361('0xdd')]][_0x5361('0xe1')])&&_0x9366c9['status']==='1'&&_0x9366c9[_0x5361('0xe2')]==='0'){if(this[_0x5361('0x1c')][_0x9366c9[_0x5361('0xe3')]]){if(!this[_0x5361('0x1c')][_0x9366c9[_0x5361('0xe3')]][_0x5361('0xe1')]){this['agents'][_0x9366c9[_0x5361('0xe3')]][_0x5361('0xe1')]=!![];this['actions'][_0x9366c9[_0x5361('0xdd')]]['locked']=!![];this[_0x5361('0xda')][_0x9366c9['actionid']][_0x5361('0xe3')]=_0x9366c9[_0x5361('0xe3')];}}}}else if(_0x1fe685==='rrmemory'){if(this['actions'][_0x9366c9['actionid']]){if(this[_0x5361('0x1c')][_0x9366c9[_0x5361('0xe3')]]){this[_0x5361('0xda')][_0x9366c9[_0x5361('0xdd')]][_0x5361('0xe3')]=_0x9366c9['stateinterface'];if(_['isNil'](this['queueBooked'][this[_0x5361('0xda')][_0x9366c9[_0x5361('0xdd')]][_0x5361('0xaa')]])){this[_0x5361('0x1e')][this[_0x5361('0xda')][_0x9366c9[_0x5361('0xdd')]]['queue']]=[];}this[_0x5361('0x1e')][this[_0x5361('0xda')][_0x9366c9[_0x5361('0xdd')]][_0x5361('0xaa')]]['push'](_[_0x5361('0x4d')](_[_0x5361('0x63')](this[_0x5361('0xda')][_0x9366c9[_0x5361('0xdd')]],[_0x5361('0xe4'),_0x5361('0xe3')]),{'status':_0x9366c9['status'],'paused':_0x9366c9[_0x5361('0xe2')]}));}}}};Dialer[_0x5361('0x15')][_0x5361('0xe5')]=function(_0xdd3d60){if(!this['actions'][_0xdd3d60[_0x5361('0xdd')]]){return;}var _0x10e5ff=this;var _0x4cb40e=this['voiceQueues'][this[_0x5361('0xda')][_0xdd3d60[_0x5361('0xdd')]][_0x5361('0xaa')]];var _0x529496=_0x4cb40e[_0x5361('0xde')]||_0x5361('0xe6');if(_0x529496===_0x5361('0xdf')){if(this['actions'][_0xdd3d60[_0x5361('0xdd')]]&&this[_0x5361('0xda')][_0xdd3d60['actionid']][_0x5361('0xe3')]){this[_0x5361('0xe7')][_0x5361('0xe8')](this[_0x5361('0xda')][_0xdd3d60['actionid']][_0x5361('0xe4')],this[_0x5361('0xda')][_0xdd3d60[_0x5361('0xdd')]][_0x5361('0xe3')])[_0x5361('0x8c')](function(_0x2b2799){logger['error'](_0x5361('0xe9'),util[_0x5361('0x39')](_0x2b2799,{'showHidden':![],'depth':null}));})[_0x5361('0x18')](function(){_0x10e5ff[_0x5361('0xb7')](_0x10e5ff[_0x5361('0x1a')][_0x10e5ff[_0x5361('0xda')][_0xdd3d60[_0x5361('0xdd')]][_0x5361('0xaa')]]);_0x10e5ff[_0x5361('0x1c')][_0x10e5ff['actions'][_0xdd3d60[_0x5361('0xdd')]]['stateinterface']]['locked']=![];delete _0x10e5ff[_0x5361('0xda')][_0xdd3d60[_0x5361('0xdd')]];unlockQueueStatus(_0x4cb40e);});}else{this['updateOriginated'](this['voiceQueues'][this[_0x5361('0xda')][_0xdd3d60['actionid']][_0x5361('0xaa')]]);hopperUtils['rescheduleContact']({'active':![],'ContactId':this[_0x5361('0xda')][_0xdd3d60[_0x5361('0xdd')]][_0x5361('0xc7')],'ListId':this[_0x5361('0xda')][_0xdd3d60[_0x5361('0xdd')]][_0x5361('0xea')],'VoiceQueueId':this[_0x5361('0xda')][_0xdd3d60['actionid']][_0x5361('0xc8')]||undefined,'CampaignId':this[_0x5361('0xda')][_0xdd3d60[_0x5361('0xdd')]][_0x5361('0xc9')]||undefined})[_0x5361('0x8c')](loggerCatch(_0x5361('0xeb')));delete this[_0x5361('0xda')][_0xdd3d60[_0x5361('0xdd')]];unlockQueueStatus(_0x4cb40e);}}else if(_0x529496===_0x5361('0xe6')){var _0x58982f;if(this[_0x5361('0xda')][_0xdd3d60[_0x5361('0xdd')]]&&!_[_0x5361('0x68')](this[_0x5361('0x1e')][this[_0x5361('0xda')][_0xdd3d60[_0x5361('0xdd')]][_0x5361('0xaa')]])){if(this[_0x5361('0x1f')][_0x10e5ff['actions'][_0xdd3d60[_0x5361('0xdd')]]['queue']]){this['queueBookedRR'][_0x10e5ff[_0x5361('0xda')][_0xdd3d60[_0x5361('0xdd')]][_0x5361('0xaa')]]=this[_0x5361('0x1f')][this[_0x5361('0xda')][_0xdd3d60[_0x5361('0xdd')]][_0x5361('0xaa')]]?this[_0x5361('0x1f')][this['actions'][_0xdd3d60[_0x5361('0xdd')]][_0x5361('0xaa')]]:this[_0x5361('0x1e')][this[_0x5361('0xda')][_0xdd3d60[_0x5361('0xdd')]]['queue']]?this[_0x5361('0x1e')][this[_0x5361('0xda')][_0xdd3d60['actionid']][_0x5361('0xaa')]][_0x5361('0xec')]||0x0:0x0;}this[_0x5361('0x1e')][this[_0x5361('0xda')][_0xdd3d60['actionid']]['queue']]['_rr']=this['queueBookedRR'][this[_0x5361('0xda')][_0xdd3d60['actionid']][_0x5361('0xaa')]];for(var _0x42c591=0x0;_0x42c591=_0x2381d6['dialGlobalMaxRetry']){_0x48ad81['stateGlobal'](_0x419894,_0x4ead8b,_0x14c7ba,_0x5361('0x10c'));}else{if(_0x419894['countmachineretry']>=_0x2381d6['dialMachineMaxRetry']){_0x48ad81[_0x5361('0x10d')](_0x419894,_0x4ead8b,_0x14c7ba,_0x5361('0x10e'));}else{hopperUtils[_0x5361('0xc5')]({'active':![],'countmachineretry':_0x419894[_0x5361('0x10a')],'scheduledat':moment()[_0x5361('0xc6')](_0x2381d6[_0x5361('0x10f')],_0x5361('0x110'))[_0x5361('0x3a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x419894[_0x5361('0xc7')],'ListId':_0x419894[_0x5361('0xea')],'VoiceQueueId':_0x419894['VoiceQueueId']||undefined,'CampaignId':_0x419894[_0x5361('0xc9')]||undefined})[_0x5361('0x8c')](loggerCatch(_0x5361('0x111')));_0x4ead8b({'reschedule':0x1});}}});}if(_0x2067ea['type']===_0x5361('0xb6')&&this['campaigns'][_0x2067ea[_0x5361('0xaa')]][_0x5361('0x112')]&&_0x7458a7[_0x5361('0x113')]===_0x5361('0xfb')){delete this[_0x5361('0xab')][_0x7458a7['uniqueid']];this['updateOriginated'](this[_0x5361('0x1b')][_0x2067ea['queue']]);_0xeb48ab=new Hangup(_0x2067ea,_0x7458a7);_0xeb48ab[_0x5361('0x5d')]=0x12;_0xeb48ab[_0x5361('0xbc')]=_0x5361('0xfd');_0xeb48ab[_0x5361('0x105')]=_0x5361('0xfe');ami[_0x5361('0xff')](_0x5361('0x100'),ut[_0x5361('0x114')](_0xeb48ab,_0x5361('0x101')));this[_0x5361('0x115')](_0xeb48ab,'[syncHangupInAMDIvr][createHistory]',_0x5361('0x116'));}if(_0x2067ea['type']===_0x5361('0xb6')&&this['campaigns'][_0x2067ea[_0x5361('0xaa')]][_0x5361('0x112')]&&_0x7458a7['value']===_0x5361('0x103')){return new Promise(function(_0x9958a,_0x230d4b){delete _0x48ad81[_0x5361('0xab')][_0x7458a7[_0x5361('0xae')]];_0x48ad81[_0x5361('0xb7')](_0x48ad81['campaigns'][_0x2067ea['queue']]);_0x48ad81[_0x5361('0x1b')][_0x2067ea['queue']][_0x5361('0xaf')]+=0x1;_0x48ad81[_0x5361('0x1b')][_0x2067ea['queue']][_0x5361('0xfc')]+=0x1;var _0x582163=_0x48ad81['campaigns'][_0x2067ea['queue']];var _0x176ed7=new Hangup(_0x2067ea,_0x7458a7);_0x176ed7['state']=0x13;_0x176ed7[_0x5361('0xbc')]=_0x5361('0x104');_0x176ed7['membername']='AMD';_0x176ed7[_0x5361('0x10a')]+=0x1;_0x176ed7[_0x5361('0xbf')]+=0x1;_0x176ed7[_0x5361('0x101')]=!![];ami[_0x5361('0xff')](_0x5361('0x100'),ut[_0x5361('0x114')](_0x176ed7,_0x5361('0x101')));hopperUtils[_0x5361('0xce')](_0x176ed7)[_0x5361('0x8c')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x176ed7[_0x5361('0x106')]+_0x176ed7[_0x5361('0x107')]+_0x176ed7[_0x5361('0x108')]+_0x176ed7[_0x5361('0x109')]+_0x176ed7[_0x5361('0xbe')]+_0x176ed7['countabandonedretry']+_0x176ed7[_0x5361('0x10a')]+_0x176ed7[_0x5361('0x10b')]>=_0x582163[_0x5361('0x117')]){_0x48ad81[_0x5361('0x118')](_0x176ed7,_0x9958a,_0x230d4b,_0x5361('0x10c'));}else{if(_0x176ed7[_0x5361('0x10a')]>=_0x582163[_0x5361('0x119')]){_0x48ad81[_0x5361('0x10d')](_0x176ed7,_0x9958a,_0x230d4b,_0x5361('0x10e'));}else{hopperUtils[_0x5361('0xc5')]({'active':![],'countmachineretry':_0x176ed7[_0x5361('0x10a')],'scheduledat':moment()[_0x5361('0xc6')](_0x582163[_0x5361('0x10f')],_0x5361('0x110'))[_0x5361('0x3a')](_0x5361('0xad')),'ContactId':_0x176ed7['ContactId'],'ListId':_0x176ed7[_0x5361('0xea')],'VoiceQueueId':_0x176ed7[_0x5361('0xc8')]||undefined,'CampaignId':_0x176ed7[_0x5361('0xc9')]||undefined})[_0x5361('0x8c')](loggerCatch(_0x5361('0x111')));_0x9958a({'reschedule':0x1});}}});}}};Dialer[_0x5361('0x15')]['syncHangup']=function(_0x3dd077){var _0x5dded6=this[_0x5361('0xab')][_0x3dd077['uniqueid']];var _0x3eab28;if(_0x5dded6&&_0x5dded6[_0x5361('0x35')]==='ivr'){delete this[_0x5361('0xab')][_0x3dd077[_0x5361('0xae')]];this['updateOriginated'](this[_0x5361('0x1b')][_0x5dded6[_0x5361('0xaa')]]);this[_0x5361('0x1b')][_0x5dded6['queue']][_0x5361('0x11a')]+=0x1;_0x3eab28=new Hangup(_0x5dded6,_0x3dd077);hopperUtils[_0x5361('0xce')](_0x3eab28)['catch'](loggerCatch(_0x5361('0x11b')));hopperUtils[_0x5361('0xb4')](_0x3eab28)['catch'](loggerCatch(_0x5361('0x11c')));}if(_0x5dded6&&_0x5dded6[_0x5361('0x35')]!==_0x5361('0xb6')&&isNotNull(this[_0x5361('0x1a')][_0x5dded6[_0x5361('0xaa')]][_0x5361('0x11d')])){delete this['uniqueId'][_0x3dd077[_0x5361('0xae')]];this[_0x5361('0xb7')](this['voiceQueues'][_0x5dded6['queue']]);this[_0x5361('0x1a')][_0x5dded6[_0x5361('0xaa')]][_0x5361('0xaf')]+=0x1;this[_0x5361('0x1a')][_0x5dded6[_0x5361('0xaa')]][_0x5361('0xfc')]+=0x1;_0x3eab28=new Hangup(_0x5dded6,_0x3dd077);_0x3eab28[_0x5361('0x5d')]=0x10;_0x3eab28[_0x5361('0xbc')]=_0x5361('0x11e');_0x3eab28[_0x5361('0x105')]='AGI';hopperUtils[_0x5361('0xce')](_0x3eab28)[_0x5361('0x8c')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x5361('0xb4')](_0x3eab28)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x5dded6&&_0x5dded6[_0x5361('0x35')]!=='ivr'&&!isNotNull(this[_0x5361('0x1a')][_0x5dded6[_0x5361('0xaa')]][_0x5361('0x11d')])){delete this[_0x5361('0xab')][_0x3dd077[_0x5361('0xae')]];this['updateOriginated'](this[_0x5361('0x1a')][_0x5dded6[_0x5361('0xaa')]]);this['voiceQueues'][_0x5dded6[_0x5361('0xaa')]][_0x5361('0x11f')]+=0x1;_0x3eab28=new Hangup(_0x5dded6,_0x3dd077);_0x3eab28[_0x5361('0x5d')]=0xc;_0x3eab28[_0x5361('0xbc')]=_0x3dd077[_0x5361('0x120')];_0x3eab28[_0x5361('0x105')]=_0x5361('0x121');hopperUtils[_0x5361('0xce')](_0x3eab28)[_0x5361('0x8c')](loggerCatch(_0x5361('0x11b')));hopperUtils[_0x5361('0xb4')](_0x3eab28)['catch'](loggerCatch(_0x5361('0x11c')));}};Dialer['prototype'][_0x5361('0x28')]=function(_0x4f1131){var _0x350f0b=this;if(!_0x350f0b[_0x5361('0x122')][_0x4f1131[_0x5361('0x3c')]]){_0x350f0b[_0x5361('0x122')][_0x4f1131[_0x5361('0x3c')]]={'running':![]};}else if(_0x350f0b['queuesSummary'][_0x4f1131[_0x5361('0x3c')]][_0x5361('0x123')]===!![]){return;}else if(_0x350f0b['queuesSummary'][_0x4f1131[_0x5361('0x3c')]][_0x5361('0x123')]===![]){_0x350f0b['queuesSummary'][_0x4f1131[_0x5361('0x3c')]][_0x5361('0x123')]=!![];}var _0x598c90=_0x350f0b[_0x5361('0x1a')][_0x4f1131[_0x5361('0x3c')]];var _0x2815bf=_0x598c90[_0x5361('0x57')]!==utils[_0x5361('0x58')][_0x5361('0x6a')];var _0x9770f7=utils['isPreviewCampaign'](_0x598c90);_0x598c90[_0x5361('0x124')]=utils[_0x5361('0x125')](_0x598c90,_0x350f0b[_0x5361('0x1d')]);Promise[_0x5361('0x95')]()[_0x5361('0x33')](function(){if(_0x598c90['statusMessage']===utils[_0x5361('0x58')][_0x5361('0x6a')]){if(_0x2815bf){clearPredictiveAttributes(_0x598c90);_0x4f1131['startPredictive']=undefined;_0x4f1131[_0x5361('0x4f')]=undefined;}if(_0x598c90['statusMessage']===utils[_0x5361('0x58')][_0x5361('0x6a')]){_0x4f1131[_0x5361('0x126')]=0x0;_0x4f1131[_0x5361('0xe2')]=0x0;_0x4f1131[_0x5361('0x127')]=0x0;_0x4f1131[_0x5361('0x128')]=0x0;_0x4f1131['pTalking']=0x0;}}else if(_0x598c90[_0x5361('0x124')]===utils[_0x5361('0x58')][_0x5361('0x129')]&&!_0x9770f7){return _0x350f0b[_0x5361('0x7b')](_0x598c90,!![])['then'](function(){return _0x350f0b[_0x5361('0x7b')](_0x598c90,![]);})[_0x5361('0x33')](function(){return _0x350f0b[_0x5361('0x9a')](_0x598c90);})['catch'](function(_0xe9e8e2){loggerSyncQueueSummary[_0x5361('0x37')](_0x5361('0x12a'),util['inspect'](_0xe9e8e2,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x598c90);});}else{clearPredictiveAttributes(_0x598c90);}})[_0x5361('0x33')](function(){var _0x26774e=_0x4f1131['compareToOutboundQueue'](_0x598c90);if(_0x26774e||_0x598c90[_0x5361('0x12b')]){_0x598c90[_0x5361('0x12b')]=![];_0x4f1131[_0x5361('0x12c')](_0x598c90);Object[_0x5361('0x12d')](_0x598c90,_0x4f1131);emitOutboundVoiceQueueSummary(_0x4f1131);}_0x350f0b[_0x5361('0x122')][_0x598c90[_0x5361('0x3c')]][_0x5361('0x123')]=![];})['catch'](function(_0x3ab0dd){logger['error'](_0x5361('0x12a'),util['inspect'](_0x3ab0dd,{'showHidden':![],'depth':null}));_0x350f0b[_0x5361('0x122')][_0x598c90[_0x5361('0x3c')]]['running']=![];});};Dialer[_0x5361('0x15')][_0x5361('0x2a')]=_[_0x5361('0x12e')](function(){var _0xa4e36b=_[_0x5361('0x12f')](this[_0x5361('0x1a')],function(_0xadadb){return _0xadadb[_0x5361('0x130')];});var _0x521b12=_['filter'](this[_0x5361('0x1c')],function(_0x495b1a){return _0x495b1a[_0x5361('0x131')]&&_0x495b1a[_0x5361('0x73')]==='reachable';});if(_0xa4e36b[_0x5361('0x83')]>0x0&&_0x521b12[_0x5361('0x83')]>0x0){return Promise[_0x5361('0x95')]()[_0x5361('0x33')](cmHopper[_0x5361('0x132')](_['map'](_0xa4e36b,'id'),previewRecallmeReminderInterval,_[_0x5361('0x133')](_0x521b12,'id')))[_0x5361('0x33')](function(_0x326654){for(var _0x12c086=0x0;_0x12c086<_0x326654[_0x5361('0x83')];_0x12c086++){var _0x4a9978=_0x326654[_0x12c086][_0x5361('0x134')][_0x5361('0x3c')];if(_0x4a9978)io['to'](util[_0x5361('0x3a')](_0x5361('0x135'),_0x4a9978))['emit'](_0x5361('0x136'),{'hopper':_0x326654[_0x12c086]});}})[_0x5361('0x8c')](function(_0x461f08){logger['error'](_0x5361('0x137'),_0x461f08);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x5361('0x15')]['loopClearZombieChannels']=function(){var _0xb0bb51=this;setInterval(function(){_0xb0bb51[_0x5361('0x138')](_0xb0bb51['uniqueId'],_0x5361('0x139'));_0xb0bb51[_0x5361('0x138')](_0xb0bb51[_0x5361('0xda')],_0x5361('0x13a'));},0x32c8);};Dialer['prototype'][_0x5361('0x138')]=function(_0x28ef5e,_0x14dbe0){var _0xcbd6df=this;for(var _0x3528fd in _0x28ef5e){if(typeof _0x28ef5e[_0x3528fd]!==_0x5361('0x94')){this['sequence'][_0x5361('0x16')](function(){if(!_['isNil'](_0x28ef5e[_0x3528fd])){return ami['Action']({'action':_0x5361('0x73'),'channel':_0x28ef5e[_0x3528fd][_0x5361('0xdb')]})[_0x5361('0x8c')](function(_0x380b35){if(_0x380b35[_0x5361('0x57')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x28ef5e[_0x3528fd]&&_0x28ef5e[_0x3528fd][_0x5361('0x35')]!=='ivr'){_0xcbd6df['updateOriginated'](_0xcbd6df[_0x5361('0x1a')][_0x28ef5e[_0x3528fd][_0x5361('0xaa')]]);logger[_0x5361('0x54')](_0x5361('0x13b'),_0x14dbe0,_0x3528fd,_0x28ef5e[_0x3528fd][_0x5361('0xaa')]);delete _0x28ef5e[_0x3528fd];}if(_0x28ef5e[_0x3528fd]&&_0x28ef5e[_0x3528fd][_0x5361('0x35')]===_0x5361('0xb6')){_0xcbd6df[_0x5361('0xb7')](_0xcbd6df['campaigns'][_0x28ef5e[_0x3528fd]['queue']]);logger[_0x5361('0x54')](_0x5361('0x13c'),_0x14dbe0,_0x3528fd,_0x28ef5e[_0x3528fd][_0x5361('0xaa')]);delete _0x28ef5e[_0x3528fd];}},0x2328);}});}});}}};Dialer[_0x5361('0x15')][_0x5361('0x13d')]=function(_0x2ebd18){return Promise[_0x5361('0x95')]()[_0x5361('0x33')](voiceQueueRt[_0x5361('0x13d')](_0x2ebd18))[_0x5361('0x8c')](loggerCatch(_0x5361('0x13e')));};Dialer[_0x5361('0x15')][_0x5361('0xb7')]=function(_0x129962){if(!_[_0x5361('0x34')](_0x129962)&&_0x129962!==null){if(typeof _0x129962[_0x5361('0x13f')]!=='undefined'){if(_0x129962[_0x5361('0x13f')]>0x0){_0x129962['originated']-=0x1;}else{logger[_0x5361('0x54')](_0x5361('0x140'));}}}else{logger['error'](_0x5361('0x141'));}};Dialer[_0x5361('0x15')][_0x5361('0x142')]=function(_0x12e9c7,_0x2969cf){var _0x30e999=this;return function(_0xcc66d7){_0x30e999['updateOriginated'](_0x2969cf);logger['error'](_0x12e9c7,util[_0x5361('0x39')](_0xcc66d7,{'showHidden':![],'depth':null}));};};Dialer[_0x5361('0x15')][_0x5361('0x143')]=function(_0x331606,_0x1bc15a,_0x357ccf){var _0x54e0bf={'state':0x19,'statedesc':_0x5361('0x144')};this[_0x5361('0xb7')](_0x1bc15a);this[_0x5361('0x115')](_[_0x5361('0x4d')](_0x54e0bf,_['pick'](_0x357ccf,[_0x5361('0xc7'),_0x5361('0xea'),_0x5361('0x145'),_0x5361('0xc8'),'CampaignId'])),_0x5361('0x146'),_0x5361('0x147'));logger['error'](_0x331606);};Dialer[_0x5361('0x15')]['saveInDb']=function(_0x12498f,_0x2a22ae,_0x1f8d03){hopperUtils[_0x5361('0xce')](_0x12498f)[_0x5361('0x8c')](loggerCatch(_0x2a22ae));hopperUtils['moveContactManagedDialer'](_0x12498f)['catch'](loggerCatch(_0x1f8d03));};Dialer[_0x5361('0x15')][_0x5361('0xd6')]=function(_0x3b084c,_0x59c133){hopperUtils[_0x5361('0xce')](_0x3b084c)[_0x5361('0x8c')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x59c133==0x0){hopperUtils[_0x5361('0xb4')](_0x3b084c)[_0x5361('0x8c')](loggerCatch(_0x5361('0x148')));}};Dialer[_0x5361('0x15')][_0x5361('0x137')]=function(_0x1ec66c){return Promise[_0x5361('0x95')]()['then'](cmHopper[_0x5361('0x132')](_0x1ec66c['id'],previewRecallmeReminderInterval))[_0x5361('0x33')](function(_0x45500a){for(var _0x4c14de=0x0;_0x4c14de<_0x45500a[_0x5361('0x83')];_0x4c14de++){var _0x343574=_0x45500a[_0x4c14de][_0x5361('0x134')][_0x5361('0x3c')];if(_0x343574)io['to'](util['format'](_0x5361('0x135'),_0x343574))[_0x5361('0xff')](_0x5361('0x136'),{'hopper':_0x45500a[_0x4c14de]});}})[_0x5361('0x8c')](function(){});};Dialer[_0x5361('0x15')]['launchHandleIvr']=function(_0x53ef82){var _0x2503f2=this;return function(){_0x2503f2[_0x5361('0x149')](_0x53ef82);};};Dialer['prototype'][_0x5361('0x14a')]=function(_0x301792,_0x54bfdf){var _0x152a79=this;var _0x4e0158=uuid['v4']();this[_0x5361('0xda')][_0x4e0158]=new Action(_0x301792,_0x54bfdf,_0x4e0158);return new Promise(function(_0x4733c0,_0x4c18ce){if(_['isUndefined'](_0x301792)&&typeof _0x301792!=='object'){return _0x4c18ce(msgResponse('originate',_0x5361('0x7c'),_0x5361('0x14b')));}if(_[_0x5361('0x34')](_0x54bfdf[_0x5361('0x14c')])||_0x54bfdf[_0x5361('0x14c')]===null){return _0x4c18ce(msgResponse('originate',_0x5361('0x7c'),_0x5361('0x14d')));}var _0x3db3cb={'XMD-CALLERID':_0x152a79[_0x5361('0xda')][_0x4e0158]['getCaller'](),'XMD-AGI':_0x301792[_0x5361('0x11d')]?util[_0x5361('0x3a')](_0x5361('0x14e'),ipAgi,_0x301792[_0x5361('0x11d')]):_0x5361('0x14f'),'XMD-AGIAFTER':_0x301792[_0x5361('0xb2')]?util[_0x5361('0x3a')](_0x5361('0x14e'),ipAgi,_0x301792[_0x5361('0xb2')]):_0x5361('0x14f'),'XMD-QUEUE':utils[_0x5361('0x150')](_0x301792)?util['format']('\x22%s,%s%s,,,%s\x22',_0x301792[_0x5361('0x3c')],_0x301792[_0x5361('0x151')]||'',_0x301792[_0x5361('0x152')]?'c':'',_0x301792['dialQueueTimeout']||0x3):_0x5361('0x14f'),'XMD-CONTACTID':_0x54bfdf[_0x5361('0xc7')],'XMD-CDRTYPE':_0x5361('0x7'),'CALLERID(all)':_0x152a79['actions'][_0x4e0158]['getCaller'](),'XMD-AMD':_0x301792[_0x5361('0x112')]?'ACTIVE':_0x5361('0x14f'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x301792[_0x5361('0x112')]){_0x3db3cb[_0x5361('0x153')]=_0x301792['dialAMDInitialSilence']||0x9c4;_0x3db3cb[_0x5361('0x154')]=_0x301792[_0x5361('0x155')]||0x5dc;_0x3db3cb['XMD-AMDAFTERGREETINGSILENCE']=_0x301792[_0x5361('0x156')]||0x320;_0x3db3cb[_0x5361('0x157')]=_0x301792[_0x5361('0x158')]||0x1388;_0x3db3cb[_0x5361('0x159')]=_0x301792['dialAMDMinWordLength']||0x64;_0x3db3cb[_0x5361('0x15a')]=_0x301792[_0x5361('0x15b')]||0x32;_0x3db3cb[_0x5361('0x15c')]=_0x301792[_0x5361('0x15d')]||0x3;_0x3db3cb['XMD-AMDSILENCETHRESHOLD']=_0x301792['dialAMDSilenceThreshold']||0x100;_0x3db3cb['XMD-AMDMAXIMUMWORDLENGTH']=_0x301792[_0x5361('0x15e')]||0x1388;}if(utils[_0x5361('0x150')](_0x301792)){_0x3db3cb[_0x5361('0x15f')]=_0x54bfdf[_0x5361('0xc8')];}else{_0x3db3cb[_0x5361('0x160')]=_0x54bfdf['CampaignId'];}for(var _0x42875e in _0x54bfdf['Contact']){if(typeof _0x54bfdf[_0x5361('0x161')][_0x42875e]!==_0x5361('0x94')){if(isNotNull(_0x54bfdf[_0x5361('0x161')][_0x42875e])&&_0x42875e!=='id'&&_0x42875e!=='tags'&&_0x42875e!==_0x5361('0x162')&&_0x42875e!==_0x5361('0x163')){_0x3db3cb[util['format'](_0x5361('0x164'),_0x5361('0x165'),_[_0x5361('0x166')](_0x42875e))]=_0x54bfdf[_0x5361('0x161')][_0x42875e];}}}var _0x3a4e2c=_0x152a79[_0x5361('0x167')](_0x301792['Trunk'])?utils[_0x5361('0x168')](_0x301792[_0x5361('0x75')][_0x5361('0x169')],_0x301792[_0x5361('0x16a')],_0x301792[_0x5361('0x16b')]>0x0?utils[_0x5361('0x16c')](_0x301792['dialOriginateCallerIdNumber'],_0x301792[_0x5361('0x16b')]):_0x301792['dialOriginateCallerIdNumber']):utils[_0x5361('0x168')](_['isNil'](_0x301792[_0x5361('0x76')])?_0x301792[_0x5361('0x75')][_0x5361('0x169')]:_0x301792['TrunkBackup']['callerid'],_0x301792[_0x5361('0x16a')],_0x301792[_0x5361('0x16b')]>0x0?utils[_0x5361('0x16c')](_0x301792[_0x5361('0x16d')],_0x301792['dialRandomLastDigitCallerIdNumber']):_0x301792[_0x5361('0x16d')]);if(_0x3a4e2c){_0x3db3cb[_0x5361('0x16e')]=_0x152a79[_0x5361('0xda')][_0x4e0158][_0x5361('0x16f')]=utils['extractCalleridName'](_0x3a4e2c);_0x3db3cb[_0x5361('0x170')]=_0x54bfdf[_0x5361('0x14c')];}_0x301792[_0x5361('0x171')]=_0x3db3cb;return ami[_0x5361('0x85')]({'actionid':_0x4e0158,'action':_0x5361('0x172'),'channel':_0x152a79[_0x5361('0x167')](_0x301792['Trunk'])?util[_0x5361('0x3a')](_0x5361('0x173'),_0x301792['Trunk'][_0x5361('0x3c')],isNotNull(_0x301792[_0x5361('0x174')])?_0x301792[_0x5361('0x174')]['trim']()||'':'',_0x301792[_0x5361('0x175')]>0x0?_0x54bfdf['phone'][_0x5361('0x176')](_0x301792['dialCutDigit']):_0x54bfdf[_0x5361('0x14c')]):util[_0x5361('0x3a')](_0x5361('0x173'),_[_0x5361('0xe0')](_0x301792[_0x5361('0x76')])?_0x301792[_0x5361('0x75')][_0x5361('0x3c')]:_0x301792[_0x5361('0x76')][_0x5361('0x3c')],isNotNull(_0x301792[_0x5361('0x174')])?_0x301792[_0x5361('0x174')]['trim']()||'':'',_0x301792[_0x5361('0x175')]>0x0?_0x54bfdf[_0x5361('0x14c')]['substring'](_0x301792[_0x5361('0x175')]):_0x54bfdf[_0x5361('0x14c')]),'callerid':_0x3a4e2c,'Exten':_0x5361('0xfa'),'Context':_0x5361('0x177'),'Priority':'1','variable':_0x3db3cb,'timeout':(_0x301792['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x4e0158})['then'](function(_0x515964){return _0x4733c0(_0x515964);})[_0x5361('0x8c')](function(_0x2496bf){_0x301792[_0x5361('0x178')]+=0x1;var _0x18a80b=new History(_0x152a79['actions'][_0x4e0158]);logger[_0x5361('0x54')](util[_0x5361('0x3a')](_0x5361('0x179'),JSON[_0x5361('0x62')](_0x2496bf)));_0x18a80b[_0x5361('0x5d')]=0xe;_0x18a80b[_0x5361('0xbc')]=_0x5361('0x17a');_0x18a80b[_0x5361('0x5f')]=moment()[_0x5361('0x3a')](_0x5361('0xad'));_0x18a80b['endtime']=_0x18a80b[_0x5361('0x5f')];hopperUtils[_0x5361('0xce')](_0x18a80b)[_0x5361('0x8c')](loggerCatch(_0x5361('0x17b')));_0x152a79[_0x5361('0xb4')](_0x18a80b)[_0x5361('0x8c')](loggerCatch(_0x5361('0x17b')))[_0x5361('0x18')](function(){delete _0x152a79['actions'][_0x4e0158];return _0x4c18ce(msgResponse(_0x5361('0x172'),'Error',_0x5361('0x17c')));});});});};Dialer[_0x5361('0x15')][_0x5361('0x17d')]=function(_0x33c428,_0x29aef0,_0x429c0a){var _0x1c4a8c=new History(_0x29aef0);if(_0x1c4a8c[_0x5361('0x106')]+_0x1c4a8c[_0x5361('0x107')]+_0x1c4a8c[_0x5361('0x108')]+_0x1c4a8c[_0x5361('0x109')]+_0x1c4a8c[_0x5361('0xbe')]+_0x1c4a8c[_0x5361('0xd4')]+_0x1c4a8c['countmachineretry']+_0x1c4a8c[_0x5361('0x10b')]>=_0x429c0a[_0x5361('0x117')]-0x1){return!![];}switch(_0x33c428){case 0x3:if(_0x1c4a8c['countnoanswerretry']>=_0x429c0a['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x1c4a8c[_0x5361('0x108')]+=0x1,'scheduledat':moment()[_0x5361('0xc6')](_0x429c0a[_0x5361('0x17e')],'minutes')['format'](_0x5361('0xad')),'ContactId':_0x1c4a8c[_0x5361('0xc7')],'ListId':_0x1c4a8c[_0x5361('0xea')],'VoiceQueueId':_0x1c4a8c[_0x5361('0xc8')]||undefined,'CampaignId':_0x1c4a8c[_0x5361('0xc9')]||undefined})['catch'](loggerCatch(_0x5361('0x17f')));break;case 0x5:if(_0x1c4a8c[_0x5361('0x106')]>=_0x429c0a[_0x5361('0x180')]-0x1){return!![];}hopperUtils[_0x5361('0xc5')]({'active':![],'countbusyretry':_0x1c4a8c[_0x5361('0x106')]+=0x1,'scheduledat':moment()['add'](_0x429c0a[_0x5361('0x181')],_0x5361('0x110'))['format'](_0x5361('0xad')),'ContactId':_0x1c4a8c[_0x5361('0xc7')],'ListId':_0x1c4a8c[_0x5361('0xea')],'VoiceQueueId':_0x1c4a8c[_0x5361('0xc8')]||undefined,'CampaignId':_0x1c4a8c[_0x5361('0xc9')]||undefined})['catch'](loggerCatch(_0x5361('0x182')));break;case 0x8:if(_0x1c4a8c[_0x5361('0x107')]>=_0x429c0a[_0x5361('0x183')]-0x1){return!![];}hopperUtils[_0x5361('0xc5')]({'active':![],'countcongestionretry':_0x1c4a8c[_0x5361('0x107')]+=0x1,'scheduledat':moment()['add'](_0x429c0a[_0x5361('0x184')],_0x5361('0x110'))[_0x5361('0x3a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1c4a8c[_0x5361('0xc7')],'ListId':_0x1c4a8c['ListId'],'VoiceQueueId':_0x1c4a8c['VoiceQueueId']||undefined,'CampaignId':_0x1c4a8c[_0x5361('0xc9')]||undefined})['catch'](loggerCatch(_0x5361('0x185')));break;case 0x0:if(_0x1c4a8c[_0x5361('0x109')]>=_0x429c0a[_0x5361('0x186')]-0x1){return!![];}else{hopperUtils[_0x5361('0xc5')]({'active':![],'countnosuchnumberretry':_0x1c4a8c['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x5361('0xc6')](_0x429c0a[_0x5361('0x187')],'minutes')[_0x5361('0x3a')](_0x5361('0xad')),'ContactId':_0x1c4a8c[_0x5361('0xc7')],'ListId':_0x1c4a8c[_0x5361('0xea')],'VoiceQueueId':_0x1c4a8c[_0x5361('0xc8')]||undefined,'CampaignId':_0x1c4a8c['CampaignId']||undefined})[_0x5361('0x8c')](loggerCatch(_0x5361('0x188')));}break;case 0xa:if(_0x1c4a8c[_0x5361('0xbe')]>=_0x429c0a[_0x5361('0xc4')]-0x1){return!![];}hopperUtils[_0x5361('0xc5')]({'active':![],'countdropretry':_0x1c4a8c[_0x5361('0xbe')]+=0x1,'scheduledat':moment()[_0x5361('0xc6')](_0x429c0a['dialDropRetryFrequency'],_0x5361('0x110'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1c4a8c[_0x5361('0xc7')],'ListId':_0x1c4a8c[_0x5361('0xea')],'VoiceQueueId':_0x1c4a8c[_0x5361('0xc8')]||undefined,'CampaignId':_0x1c4a8c['CampaignId']||undefined})['catch'](loggerCatch(_0x5361('0xca')));break;case 0xb:if(_0x1c4a8c[_0x5361('0xd4')]>=_0x429c0a[_0x5361('0xd5')]-0x1){return!![];}hopperUtils[_0x5361('0xc5')]({'active':![],'countabandonedretry':_0x1c4a8c[_0x5361('0xd4')]+=0x1,'scheduledat':moment()[_0x5361('0xc6')](_0x429c0a[_0x5361('0xd3')],'minutes')[_0x5361('0x3a')](_0x5361('0xad')),'ContactId':_0x1c4a8c['ContactId'],'ListId':_0x1c4a8c[_0x5361('0xea')],'VoiceQueueId':_0x1c4a8c[_0x5361('0xc8')]||undefined,'CampaignId':_0x1c4a8c['CampaignId']||undefined})['catch'](loggerCatch(_0x5361('0xd7')));break;case 0x13:if(_0x1c4a8c[_0x5361('0x10a')]>=_0x429c0a['dialMachineMaxRetry']-0x1){return!![];}hopperUtils[_0x5361('0xc5')]({'active':![],'countmachineretry':_0x1c4a8c[_0x5361('0x10a')]+=0x1,'scheduledat':moment()[_0x5361('0xc6')](_0x429c0a['dialMachineRetryFrequency'],_0x5361('0x110'))[_0x5361('0x3a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1c4a8c[_0x5361('0xc7')],'ListId':_0x1c4a8c['ListId'],'VoiceQueueId':_0x1c4a8c[_0x5361('0xc8')]||undefined,'CampaignId':_0x1c4a8c[_0x5361('0xc9')]||undefined})[_0x5361('0x8c')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x1c4a8c[_0x5361('0x10b')]>=_0x429c0a[_0x5361('0x189')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0x1c4a8c['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x5361('0xc6')](_0x429c0a[_0x5361('0x18a')],_0x5361('0x110'))[_0x5361('0x3a')](_0x5361('0xad')),'ContactId':_0x1c4a8c['ContactId'],'ListId':_0x1c4a8c['ListId'],'VoiceQueueId':_0x1c4a8c[_0x5361('0xc8')]||undefined,'CampaignId':_0x1c4a8c['CampaignId']||undefined})[_0x5361('0x8c')](loggerCatch(_0x5361('0x18b')));break;default:return!![];}};Dialer['prototype']['callProgressDetecting']=function(_0x229164,_0x29cdb5,_0x185535){var _0x438f8b=this;var _0xfb2e80=new History(_0x229164);var _0x5d9e6e=![];var _0x4afb22;var _0x3e5290;return new Promise(function(_0x27f8a6,_0x2e0fdb){if(_['isUndefined'](_0x29cdb5)&&typeof _0x29cdb5!==_0x5361('0x18c')){return _0x2e0fdb(msgResponse('[callProgressDetecting]',_0x5361('0x7c'),_0x5361('0x18d')));}if(_[_0x5361('0x34')](_0x185535)&&typeof _0x185535!==_0x5361('0x18c')){return _0x2e0fdb(msgResponse(_0x5361('0x18e'),_0x5361('0x7c'),_0x5361('0x18f')));}hopperUtils[_0x5361('0x190')](_0xfb2e80,_0x185535[_0x5361('0xb0')],_0x29cdb5)[_0x5361('0x33')](function(_0x2a5cb9){if(_0x2a5cb9[_0x5361('0xc3')]==0x1)_0x5d9e6e=!![];switch(_0x185535[_0x5361('0xb0')]){case'0':_0x29cdb5[_0x5361('0x191')]+=0x1;_0xfb2e80[_0x5361('0x5d')]=0x0;_0xfb2e80[_0x5361('0xbc')]='NoSuchNumber';_0xfb2e80[_0x5361('0x109')]+=0x1;_0xfb2e80['countglobal']+=0x1;ami[_0x5361('0xff')](_0x5361('0x192'),ut[_0x5361('0x114')](_0x229164,'nosuchnumber'));_0x4afb22=_0x29cdb5[_0x5361('0x187')];_0x3e5290=_0x29cdb5[_0x5361('0xc1')];hopperUtils[_0x5361('0xce')](_0xfb2e80)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x438f8b['checkRetriveMax'](0x0,_0x229164,_0x29cdb5)&&!_0x5d9e6e){if(_0xfb2e80[_0x5361('0x109')]>=_0x29cdb5[_0x5361('0x186')]){_0x438f8b[_0x5361('0x10d')](_0xfb2e80,_0x27f8a6,_0x2e0fdb,_0x5361('0x193'));}else{_0x438f8b[_0x5361('0x118')](_0xfb2e80,_0x27f8a6,_0x2e0fdb,_0x5361('0x193'));}}break;case'3':_0x29cdb5[_0x5361('0x194')]+=0x1;_0xfb2e80[_0x5361('0x5d')]=0x3;_0xfb2e80[_0x5361('0xbc')]=_0x5361('0x195');_0xfb2e80['countnoanswerretry']+=0x1;_0xfb2e80['countglobal']+=0x1;var _0x3a01dc=ut[_0x5361('0x196')](_0x229164,_0x29cdb5);ami[_0x5361('0xff')](_0x5361('0x197'),_0x3a01dc);_0x4afb22=_0x29cdb5['dialNoAnswerRetryFrequency'];_0x3e5290=_0x29cdb5[_0x5361('0xc1')];hopperUtils[_0x5361('0xce')](_0xfb2e80)[_0x5361('0x8c')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x438f8b[_0x5361('0x17d')](0x3,_0x229164,_0x29cdb5)&&!_0x5d9e6e){if(_0xfb2e80[_0x5361('0x108')]>=_0x29cdb5[_0x5361('0x198')]){_0x438f8b[_0x5361('0x10d')](_0xfb2e80,_0x27f8a6,_0x2e0fdb,_0x5361('0x199'));}else{_0x438f8b['stateGlobal'](_0xfb2e80,_0x27f8a6,_0x2e0fdb,_0x5361('0x199'));}}break;case'5':_0x29cdb5[_0x5361('0x19a')]+=0x1;_0xfb2e80[_0x5361('0x5d')]=0x5;_0xfb2e80['statedesc']=_0x5361('0x19b');_0xfb2e80['countbusyretry']+=0x1;_0xfb2e80['countglobal']+=0x1;ami['emit'](_0x5361('0x19c'),ut[_0x5361('0x114')](_0x229164,_0x5361('0x19d')));_0x4afb22=_0x29cdb5[_0x5361('0x181')];_0x3e5290=_0x29cdb5[_0x5361('0xc1')];hopperUtils[_0x5361('0xce')](_0xfb2e80)[_0x5361('0x8c')](loggerCatch(_0x5361('0x19e')));if(_0x438f8b['checkRetriveMax'](0x5,_0x229164,_0x29cdb5)&&!_0x5d9e6e){if(_0xfb2e80[_0x5361('0x106')]>=_0x29cdb5[_0x5361('0x180')]){_0x438f8b[_0x5361('0x10d')](_0xfb2e80,_0x27f8a6,_0x2e0fdb,_0x5361('0x19f'));}else{_0x438f8b[_0x5361('0x118')](_0xfb2e80,_0x27f8a6,_0x2e0fdb,_0x5361('0x19f'));}}break;case'8':_0x29cdb5['outboundCongestionCallsDay']+=0x1;_0xfb2e80['state']=0x8;_0xfb2e80[_0x5361('0xbc')]=_0x5361('0x1a0');_0xfb2e80[_0x5361('0x107')]+=0x1;_0xfb2e80['countglobal']+=0x1;_0x4afb22=_0x29cdb5[_0x5361('0x184')];_0x3e5290=_0x29cdb5[_0x5361('0xc1')];ami[_0x5361('0xff')](_0x5361('0x1a1'),ut[_0x5361('0x114')](_0x229164,_0x5361('0x1a2')));hopperUtils[_0x5361('0xce')](_0xfb2e80)[_0x5361('0x8c')](loggerCatch(_0x5361('0x1a3')));if(_0x438f8b[_0x5361('0x17d')](0x8,_0x229164,_0x29cdb5)&&!_0x5d9e6e){if(_0xfb2e80['countcongestionretry']>=_0x29cdb5['dialCongestionMaxRetry']){_0x438f8b[_0x5361('0x10d')](_0xfb2e80,_0x27f8a6,_0x2e0fdb,_0x5361('0x1a4'));}else{_0x438f8b[_0x5361('0x118')](_0xfb2e80,_0x27f8a6,_0x2e0fdb,_0x5361('0x1a4'));}}break;case'11':_0x29cdb5[_0x5361('0x1a5')]+=0x1;_0xfb2e80[_0x5361('0x5d')]=0xb;_0xfb2e80[_0x5361('0xbc')]=_0x5361('0xd2');_0xfb2e80[_0x5361('0xd4')]+=0x1;_0xfb2e80[_0x5361('0xbf')]+=0x1;_0x4afb22=_0x29cdb5[_0x5361('0xd3')];_0x3e5290=_0x29cdb5[_0x5361('0xc1')];hopperUtils[_0x5361('0xce')](_0xfb2e80)[_0x5361('0x8c')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x438f8b[_0x5361('0x17d')](0xb,_0x229164,_0x29cdb5)&&!_0x5d9e6e){if(_0xfb2e80[_0x5361('0xd4')]>=_0x29cdb5[_0x5361('0xd5')]){_0x438f8b[_0x5361('0x10d')](_0xfb2e80,_0x27f8a6,_0x2e0fdb,'reason\x2011\x20abandoned');}else{_0x438f8b[_0x5361('0x118')](_0xfb2e80,_0x27f8a6,_0x2e0fdb,_0x5361('0x1a6'));}}break;case'20':_0x29cdb5[_0x5361('0x1a7')]+=0x1;_0xfb2e80[_0x5361('0x5d')]=0x14;_0xfb2e80[_0x5361('0xbc')]=_0x5361('0x1a8');_0xfb2e80[_0x5361('0x10b')]+=0x1;_0xfb2e80[_0x5361('0xbf')]+=0x1;_0x4afb22=_0x29cdb5[_0x5361('0x18a')];_0x3e5290=_0x29cdb5[_0x5361('0xc1')];ami['emit'](_0x5361('0x1a9'),ut[_0x5361('0x114')](_0x229164,_0x5361('0x1aa')));hopperUtils[_0x5361('0xce')](_0xfb2e80)[_0x5361('0x8c')](loggerCatch(_0x5361('0x1ab')));if(_0x438f8b[_0x5361('0x17d')](0x14,_0x229164,_0x29cdb5)&&!_0x5d9e6e){if(_0xfb2e80[_0x5361('0x10b')]>=_0x29cdb5[_0x5361('0x189')]){_0x438f8b[_0x5361('0x10d')](_0xfb2e80,_0x27f8a6,_0x2e0fdb,'reason\x2020\x20agentreject');}else{_0x438f8b[_0x5361('0x118')](_0xfb2e80,_0x27f8a6,_0x2e0fdb,_0x5361('0x1ac'));}}break;default:_0x29cdb5[_0x5361('0x11f')]+=0x1;_0xfb2e80[_0x5361('0x5d')]=0xc;_0xfb2e80[_0x5361('0xbc')]=_0x185535[_0x5361('0xb0')];_0x4afb22=_0x29cdb5[_0x5361('0x18a')];_0x3e5290=_0x29cdb5[_0x5361('0xc1')];hopperUtils[_0x5361('0xce')](_0xfb2e80)[_0x5361('0x8c')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x438f8b['checkRetriveMax'](_0x185535[_0x5361('0xb0')],_0x229164,_0x29cdb5)&&!_0x5d9e6e){if(_0xfb2e80[_0x5361('0x106')]+_0xfb2e80[_0x5361('0x107')]+_0xfb2e80[_0x5361('0x108')]+_0xfb2e80['countnosuchnumberretry']+_0xfb2e80[_0x5361('0xbe')]+_0xfb2e80[_0x5361('0xd4')]+_0xfb2e80['countmachineretry']+_0xfb2e80[_0x5361('0x10b')]>=_0x29cdb5[_0x5361('0x117')]){_0x438f8b['stateGlobal'](_0xfb2e80,_0x27f8a6,_0x2e0fdb,_0x185535[_0x5361('0xb0')]);}else{_0x438f8b[_0x5361('0x10d')](_0xfb2e80,_0x27f8a6,_0x2e0fdb,_0x185535[_0x5361('0xb0')]);}}}})[_0x5361('0x33')](function(){if(_0x5d9e6e){hopperUtils['swapAdditionalPhones'](_0xfb2e80,_0x4afb22,_0x3e5290)[_0x5361('0x33')](function(){return _0x27f8a6(0x1);});}});});};Dialer[_0x5361('0x15')][_0x5361('0x118')]=function(_0xf0024a,_0x2dcdcc,_0x2c398d,_0x305a3f){var _0x176f92=new Final(_0xf0024a);_0x176f92[_0x5361('0x5d')]=0xf;_0x176f92[_0x5361('0xbc')]='Global';this['createStateFinal'](_0x176f92,_0x2dcdcc,_0x2c398d,_0x305a3f);};Dialer[_0x5361('0x15')][_0x5361('0x10d')]=function(_0x4f1ba4,_0x111a4f,_0x13b5b7,_0x399610){hopperUtils['moveContactManagedDialer'](_0x4f1ba4)[_0x5361('0x33')](function(){return _0x111a4f(msgResponse('[callProgressDetecting]','Success',_0x399610));})[_0x5361('0x8c')](function(){return _0x13b5b7(msgResponse('[moveContactManagedDialer][0]',_0x5361('0x7c'),'contact\x20not\x20moved'));});};Dialer[_0x5361('0x15')][_0x5361('0x9f')]=function(_0x1d33fb){var _0x279126=_0x1d33fb[_0x5361('0x1ad')]/0x64;var _0x816782=_0x1d33fb[_0x5361('0xbb')]/(_0x1d33fb['outboundDropCallsDayTimeout']+_0x1d33fb[_0x5361('0xaf')]);var _0x5af75c=Math['round'](_0x1d33fb[_0x5361('0x1ae')]*(_0x1d33fb[_0x5361('0x1af')]/0x64));var _0x511eb7=Math[_0x5361('0x1b0')](_0x1d33fb[_0x5361('0x1ae')]*(_0x1d33fb[_0x5361('0x1b1')]/0x64));var _0x1e841c=_0x1d33fb[_0x5361('0x126')]+_0x1d33fb['talking'];var _0x36a53d=Math['floor'](_0x1d33fb['erlangCalls']*_0x1d33fb['erlangAbandonmentRate']*_0x1d33fb['predictiveIntervalHitRate']*_0x1d33fb[_0x5361('0x1b2')]);if(_[_0x5361('0x34')](_0x1d33fb[_0x5361('0x4f')])){if(!_[_0x5361('0x34')](_0x1d33fb[_0x5361('0x51')])){_0x1d33fb['startPredictive']=undefined;loggerPredictive['error'](_0x5361('0x1b3'),_0x5361('0x1b4'));}if(!_[_0x5361('0x34')](_0x1d33fb['handlePredictive'])){loggerPredictive[_0x5361('0x54')](_0x5361('0x1b3'),_0x5361('0x1b5'));clearInterval(_0x1d33fb[_0x5361('0x52')]);_0x1d33fb['handlePredictive']=undefined;}_0x1d33fb[_0x5361('0x4f')]=moment()[_0x5361('0x3a')](_0x5361('0xad'));loggerPredictive[_0x5361('0x3d')](_0x1d33fb[_0x5361('0x3c')],_0x5361('0x1b6'),_0x1d33fb[_0x5361('0x4f')]);this[_0x5361('0x9d')](_0x1d33fb,0x1);}else if(ifInterval(_0x1d33fb[_0x5361('0x1b7')],_0x1d33fb[_0x5361('0x4f')])){this['handlePower'](_0x1d33fb,0x1);loggerPredictiveCalls[_0x5361('0x3d')](_0x5361('0x1b8'),_0x1d33fb[_0x5361('0x4f')],_0x1d33fb['name']);_0x1d33fb[_0x5361('0x48')]=0x0;_0x1d33fb[_0x5361('0x1b9')]=0x0;}else if(_0x279126<_0x816782&&_0x1d33fb[_0x5361('0x1ba')]===_0x5361('0x1bb')){clearPredictiveAttributes(_0x1d33fb);loggerPredictive[_0x5361('0x3d')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x5361('0x1bc'),_0x816782,_0x5361('0x4f'),_0x1d33fb[_0x5361('0x3c')]);}else if(_0x36a53d<_0x1d33fb[_0x5361('0x1b9')]&&_0x1d33fb[_0x5361('0x1ba')]===_0x5361('0x1bb')){clearPredictiveAttributes(_0x1d33fb);loggerPredictive[_0x5361('0x3d')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x5361('0x1bd'),_0x36a53d,_0x5361('0x1be'),_0x1d33fb[_0x5361('0x1b9')],'startProgressive',_0x1d33fb[_0x5361('0x3c')]);}else if(!ifInterval(_0x1d33fb[_0x5361('0x1b7')],_0x1d33fb[_0x5361('0x4f')])&&_[_0x5361('0x34')](_0x1d33fb[_0x5361('0x51')])&&!_[_0x5361('0x34')](_0x1d33fb[_0x5361('0x4f')])){_0x1d33fb['startPredictive']=moment()['format'](_0x5361('0xad'));loggerPredictive[_0x5361('0x3d')](_0x1d33fb[_0x5361('0x3c')],'started\x20in\x20predictive\x20at',_0x1d33fb['startPredictive']);hopperUtils[_0x5361('0x1bf')](_0x1d33fb['dialPredictiveInterval'])[_0x5361('0x33')](this['getDataPredictive'](_0x1d33fb))[_0x5361('0x33')](mergeDataErlangB(_0x1d33fb))['then'](this[_0x5361('0x1c0')](_0x1d33fb))['catch'](loggerCatchPredictive(_0x5361('0x1c1'),_0x1d33fb));}else if(!ifInterval(_0x1d33fb[_0x5361('0x1b7')],_0x1d33fb[_0x5361('0x51')])){_0x1d33fb[_0x5361('0x1b9')]=0x0;_0x1d33fb[_0x5361('0x51')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x1d33fb[_0x5361('0x3c')],_0x5361('0x1c2'),_0x1d33fb[_0x5361('0x51')]);clearInterval(_0x1d33fb[_0x5361('0x52')]);_0x1d33fb['handlePredictive']=undefined;hopperUtils['avgHandleTime'](_0x1d33fb[_0x5361('0x1b7')])[_0x5361('0x33')](this[_0x5361('0x1c3')](_0x1d33fb))[_0x5361('0x33')](mergeDataErlangB(_0x1d33fb))[_0x5361('0x33')](this['startMethodPredictive'](_0x1d33fb))['catch'](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x1d33fb));}else if(_0x1d33fb[_0x5361('0x1ae')]&&_0x1e841c<_0x1d33fb['predictiveIntervalAvailable']-_0x511eb7){clearPredictiveAttributes(_0x1d33fb);loggerPredictive[_0x5361('0x3d')](_0x1d33fb['name'],_0x5361('0x1c4'),_0x1e841c,_0x5361('0x1c5'),_0x1d33fb[_0x5361('0x1ae')],'-',_0x511eb7,'=',_0x1d33fb[_0x5361('0x1ae')]-_0x511eb7,')');}else if(_0x1d33fb[_0x5361('0x1ae')]&&_0x1e841c>_0x1d33fb[_0x5361('0x1ae')]+_0x5af75c){clearPredictiveAttributes(_0x1d33fb);loggerPredictive[_0x5361('0x3d')](_0x1d33fb[_0x5361('0x3c')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x1e841c,_0x5361('0x1c6'),_0x1d33fb[_0x5361('0x1ae')],'+',_0x5af75c,'=',_0x1d33fb[_0x5361('0x1ae')]+_0x5af75c,')');}};Dialer[_0x5361('0x15')][_0x5361('0x1c3')]=function(_0x5285b8){var _0x2e3784=this;return function(_0x337f21){return new Promise(function(_0x4c3185,_0x36a4c4){_[_0x5361('0x4d')](_0x5285b8,_0x337f21[0x0]);if(checkGetDataPredictive(_0x337f21[0x0])){var _0x49ef6c=_0x5285b8[_0x5361('0x1ae')]=_0x5285b8['talking']+_0x5285b8[_0x5361('0x126')];var _0x4aac79=_0x5285b8['dialPredictiveInterval']*0x3c;var _0x574a7f=_0x337f21[0x0][_0x5361('0x1c7')]+_0x337f21[0x0][_0x5361('0x46')];var _0x57fd42=(_0x337f21[0x0][_0x5361('0x1c8')]+_0x337f21[0x0][_0x5361('0x40')]+_0x337f21[0x0][_0x5361('0x1c9')])/_0x337f21[0x0][_0x5361('0x3e')];_0x5285b8[_0x5361('0x1ca')]=_0x57fd42>0x0?_0x57fd42:0x1;switch(_0x5285b8[_0x5361('0x1ba')]){case _0x5361('0x1bb'):var _0xbe64af=_0x5285b8[_0x5361('0x1ad')]/0x64;return _0x2e3784[_0x5361('0x1cb')](_0x49ef6c,_0x4aac79,_0x574a7f,_0x57fd42,_0xbe64af)['then'](function(_0x51c41){return _0x4c3185(_0x51c41);});case _0x5361('0x1cc'):var _0x39b897=_0x5285b8[_0x5361('0x1ad')]/0x64;return _0x2e3784[_0x5361('0x1cd')](_0x49ef6c,_0x4aac79,_0x574a7f,_0x57fd42,_0x39b897)[_0x5361('0x33')](function(_0x1c772c){return _0x4c3185(_0x1c772c);});default:return _0x36a4c4(msgResponse('[getDataPredictive]',_0x5361('0x7c'),_0x5361('0x1ce')));}}else{return _0x36a4c4(msgResponse('[getDataPredictive]',_0x5361('0x7c'),_0x5361('0x1cf')));}});};};Dialer['prototype']['getDataPredictiveOld']=function(_0x1fde42){var _0x58cde8=this;return function(_0x11e244){return new Promise(function(_0x52f5b6,_0x54c803){_[_0x5361('0x4d')](_0x1fde42,_0x11e244[0x0]);if(checkGetDataPredictive(_0x11e244[0x0])){loggerPredictive['info'](JSON['stringify'](_0x11e244[0x0]));if(_0x1fde42[_0x5361('0x1ba')]===_0x5361('0x1bb')){return _0x58cde8[_0x5361('0x13d')](_0x1fde42['id'])[_0x5361('0x33')](function(_0x5ad85c){var _0x3edbf0=_0x1fde42[_0x5361('0x1d0')]-_0x5ad85c[0x0][_0x5361('0x1d1')];var _0x14d2ec=_0x1fde42[_0x5361('0x1b7')]*0x3c;var _0x5a7837=_0x11e244[0x0][_0x5361('0x1c7')]+_0x11e244[0x0][_0x5361('0x46')];var _0x473151=(_0x11e244[0x0][_0x5361('0x1c8')]+_0x11e244[0x0][_0x5361('0x40')]+_0x11e244[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x11e244[0x0][_0x5361('0x3e')];var _0x1b3e8a=_0x1fde42[_0x5361('0x1ad')]/0x64;_0x1fde42[_0x5361('0x1d2')]=_0x5ad85c[0x0][_0x5361('0x1d1')]||0x0;_0x1fde42[_0x5361('0x1ca')]=_0x473151>0x0?_0x473151:0x1;return _0x58cde8[_0x5361('0x1cb')](_0x3edbf0,_0x14d2ec,_0x5a7837,_0x473151,_0x1b3e8a);})[_0x5361('0x33')](function(_0x4d2729){return _0x52f5b6(_0x4d2729);})[_0x5361('0x8c')](function(_0x5abb3f){return _0x54c803(msgResponse(_0x5361('0x1d3'),_0x5361('0x7c'),JSON[_0x5361('0x62')](_0x5abb3f)));});}if(_0x1fde42['dialPredictiveOptimization']===_0x5361('0x1cc')){return _0x58cde8[_0x5361('0x13d')](_0x1fde42['id'])[_0x5361('0x33')](function(_0xee9a4c){var _0x2f2ed1=_0x1fde42[_0x5361('0x1d0')]-_0xee9a4c[0x0][_0x5361('0x1d1')];var _0x2c040e=_0x1fde42['dialPredictiveInterval']*0x3c;var _0x97e9eb=_0x11e244[0x0]['predictiveIntervalAvgTalktime']+_0x11e244[0x0]['predictiveIntervalAvgHoldtime'];var _0x4a8be7=(_0x11e244[0x0]['predictiveIntervalAnsweredCalls']+_0x11e244[0x0][_0x5361('0x40')]+_0x11e244[0x0][_0x5361('0x1c9')])/_0x11e244[0x0][_0x5361('0x3e')];var _0x511392=_0x1fde42[_0x5361('0x1ad')]/0x64;_0x1fde42[_0x5361('0x1d2')]=_0xee9a4c[0x0]['outboundQueuePauses']||0x0;_0x1fde42[_0x5361('0x1ca')]=_0x4a8be7>0x0?_0x4a8be7:0x1;return _0x58cde8[_0x5361('0x1cd')](_0x2f2ed1,_0x2c040e,_0x97e9eb,_0x4a8be7,_0x511392);})[_0x5361('0x33')](function(_0x370ace){return _0x52f5b6(_0x370ace);})['catch'](function(_0x5ec4c9){return _0x54c803(msgResponse('[CatchErlangB]',_0x5361('0x7c'),JSON['stringify'](_0x5ec4c9)));});}}else{return _0x54c803(msgResponse('[getDataPredictive]','Failure',_0x5361('0x1cf')));}});};};Dialer[_0x5361('0x15')]['startMethodPredictive']=function(_0x30040d){var _0x473b71=this;return function(){var _0x3034f7=0x0;var _0x3571fa=Math[_0x5361('0x1d4')](_0x30040d['erlangCallToSecond']*0x3e8);if(_0x3571fa>0x0){_0x3571fa=_0x3571fa<0x64?0x64:_0x3571fa;loggerPredictive['info'](_0x30040d[_0x5361('0x3c')],_0x5361('0x1d5'),_0x3571fa,_0x5361('0x1d6'));_0x30040d['handlePredictive']=setInterval(function(){_0x473b71['handlePredictive'](_0x30040d);loggerPredictiveCalls[_0x5361('0x3d')](_0x5361('0x1d7'),_0x3034f7+=0x1);},_0x3571fa);}else{loggerPredictive['info'](_0x30040d[_0x5361('0x3c')],_0x5361('0x1d8'));}};};Dialer[_0x5361('0x15')][_0x5361('0x1d9')]=function(_0x270081,_0x244da9){var _0x10bce6=this;return function(_0x3c0912){if(_[_0x5361('0x68')](_0x3c0912)){if(_[_0x5361('0xe0')](_0x244da9['UserId'])||!_0x244da9[_0x5361('0x1da')]){if(_0x270081[_0x5361('0x9b')]===_0x5361('0x8')){_0x270081[_0x5361('0x60')]=_[_0x5361('0x34')](_0x270081['queueStatusComplete'])?!![]:_0x270081[_0x5361('0x60')];var _0x2bf19b=uuid['v4']();_0x10bce6[_0x5361('0xda')][_0x2bf19b]=new Action(_0x270081,_0x244da9,_0x2bf19b);loggerBooked[_0x5361('0x3d')]('[booked][checkContactBlack]',_0x2bf19b,'queueStatusComplete:\x20',JSON['stringify'](_0x270081[_0x5361('0x60')]),_0x5361('0x1db'),_0x270081[_0x5361('0x3c')]);if(_0x270081[_0x5361('0x60')]){_0x270081['queueStatusComplete']=![];_0x10bce6[_0x5361('0x1e')][_0x10bce6[_0x5361('0xda')][_0x2bf19b][_0x5361('0xaa')]]=[];ami[_0x5361('0x85')]({'actionid':_0x2bf19b,'action':'queuestatus','queue':_0x270081['name']})[_0x5361('0x8c')](function(){_0x10bce6['updateOriginated'](_0x270081);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x10bce6[_0x5361('0xda')][_0x2bf19b]['ContactId'],'ListId':_0x10bce6[_0x5361('0xda')][_0x2bf19b]['ListId'],'VoiceQueueId':_0x10bce6[_0x5361('0xda')][_0x2bf19b]['VoiceQueueId']||undefined,'CampaignId':_0x10bce6[_0x5361('0xda')][_0x2bf19b]['CampaignId']||undefined})[_0x5361('0x8c')](loggerCatch(_0x5361('0x1dc')));delete _0x10bce6[_0x5361('0xda')][_0x2bf19b];});}else{loggerBooked[_0x5361('0x3d')](_0x5361('0x1dd'),JSON['stringify'](_0x270081[_0x5361('0x60')]),_0x5361('0x1db'),_0x270081[_0x5361('0x3c')]);_0x10bce6[_0x5361('0xb7')](_0x270081);hopperUtils[_0x5361('0xc5')]({'active':![],'ContactId':_0x10bce6['actions'][_0x2bf19b][_0x5361('0xc7')],'ListId':_0x10bce6[_0x5361('0xda')][_0x2bf19b][_0x5361('0xea')],'VoiceQueueId':_0x10bce6[_0x5361('0xda')][_0x2bf19b][_0x5361('0xc8')]||undefined,'CampaignId':_0x10bce6['actions'][_0x2bf19b][_0x5361('0xc9')]||undefined})[_0x5361('0x8c')](loggerCatch(_0x5361('0x1dc')));delete _0x10bce6['actions'][_0x2bf19b];}}else{return _0x10bce6[_0x5361('0x14a')](_0x270081,_0x244da9);}}else{if(utils[_0x5361('0x4e')](undefined,_0x244da9['scheduledat'])<_0x270081[_0x5361('0x1de')]*0x3c){if(_0x244da9[_0x5361('0x134')]&&!_0x244da9[_0x5361('0x134')][_0x5361('0x1df')]){_0x10bce6['preview'][_0x5361('0xe8')](_0x244da9['id'])[_0x5361('0x18')](function(){_0x10bce6[_0x5361('0xb7')](_0x270081);});}else{hopperUtils[_0x5361('0x1e0')]({'active':![]},_0x244da9['id'],0x1)[_0x5361('0x18')](function(){_0x10bce6[_0x5361('0xb7')](_0x270081);});}}else{_0x270081['outboundReCallsDay']+=0x1;_0x10bce6['updateOriginated'](_0x270081);if(_0x270081[_0x5361('0x1e1')]){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x244da9[_0x5361('0xc7')],'ListId':_0x244da9[_0x5361('0xea')],'VoiceQueueId':_0x244da9[_0x5361('0xc8')]||undefined,'CampaignId':_0x244da9[_0x5361('0xc9')]||undefined})[_0x5361('0x8c')](loggerCatch(_0x5361('0x1e2')));hopperUtils[_0x5361('0xce')](createObjHistory(_0x270081,_0x244da9,utils[_0x5361('0x58')][_0x5361('0x1e3')],0x17,_0x5361('0x1e4')))[_0x5361('0x8c')](loggerCatch(_0x5361('0x1e5')));}else{_0x10bce6['saveInDb'](createObjHistory(_0x270081,_0x244da9,utils[_0x5361('0x58')][_0x5361('0x1e6')],0x16,'RecallFailedTimeout'),'[Originate][HistoryRecallClose][historyCatch]',_0x5361('0x1e7'));}}}}else{_0x270081[_0x5361('0x1e8')]+=0x1;_0x10bce6['saveInDb'](createObjHistory(_0x270081,_0x244da9,utils[_0x5361('0x58')]['BLACKLIST'],0xd,_0x5361('0x1e9')),_0x5361('0x1ea'),_0x5361('0x1eb'));throw _0x5361('0x1ec');}};};Dialer[_0x5361('0x15')]['handleIvr']=function(_0x362063){var _0x1a6896=this;var _0xb4a4a9=_0x362063['limitCalls']-_0x362063[_0x5361('0x13f')]-_0x362063[_0x5361('0x1ed')];emitCampaignSummary(_0x362063);if(_0xb4a4a9>0x0){if(_0xb4a4a9>this[_0x5361('0x1ee')]){_0xb4a4a9=this[_0x5361('0x1ee')];}_0x362063[_0x5361('0x1ed')]+=_0xb4a4a9;hopperUtils[_0x5361('0x1ef')](_0x362063['id'],_0xb4a4a9,_0x362063[_0x5361('0x1f0')],_0x362063)[_0x5361('0x33')](function(_0x28c89e){_0x362063[_0x5361('0x1ed')]-=_0xb4a4a9;_0x362063[_0x5361('0x1ed')]=_0x362063['temp']>0x0?_0x362063[_0x5361('0x1ed')]:0x0;if(!utils['checkContactEmpty'](_0x28c89e)){_0x362063['message']=utils['CAMPAIGN_STATUS']['NO_AVAILABLE_CONTACTS'];logger[_0x5361('0x3d')]('[getContactCampaign2][Empty]'+_0x362063[_0x5361('0x3c')]);}else{_0x362063[_0x5361('0x13f')]+=_0x28c89e[_0x5361('0x83')];_0x362063[_0x5361('0x57')]=utils['CAMPAIGN_STATUS'][_0x5361('0x1f1')];for(var _0xed11cb=0x0;_0xed11cb<_0x28c89e[_0x5361('0x83')];_0xed11cb+=0x1){_0x362063['ivrTotalCallsDays']+=0x1;if(_[_0x5361('0xe0')](_0x28c89e[_0xed11cb])||_[_0x5361('0xe0')](_0x28c89e[_0xed11cb][_0x5361('0x161')])||_['isNil'](_0x28c89e[_0xed11cb]['phone'])){_0x1a6896['emptyContact'](_0x5361('0x1f2'),_0x362063,_0x28c89e[_0xed11cb]);}else{hopperUtils[_0x5361('0x1f3')](_[_0x5361('0x63')](_0x28c89e[_0xed11cb],['CampaignId',_0x5361('0x14c')]))[_0x5361('0x33')](_0x1a6896[_0x5361('0x1d9')](_0x362063,_0x28c89e[_0xed11cb]))[_0x5361('0x8c')](_0x1a6896[_0x5361('0x142')](_0x5361('0x1f4'),_0x362063));}}}})[_0x5361('0x8c')](loggerGetContactDialer(_0x5361('0x1f5'),_0x362063,_0xb4a4a9));}};Dialer[_0x5361('0x15')]['handlePower']=function(_0x16b39f,_0x381931){var _0x3089f4=this;var _0x440d6b=[];if(_0x381931<0x1||_0x16b39f[_0x5361('0x9b')]===_0x5361('0x8')){_0x381931=0x1;}var _0xf2e7a6=Math[_0x5361('0x1d4')](_0x16b39f[_0x5361('0x126')]*_0x381931)-_0x16b39f[_0x5361('0x13f')]-_0x16b39f[_0x5361('0x1ed')];if(_0x16b39f[_0x5361('0x1f6')]>0x0){var _0x369f3c=_0x16b39f[_0x5361('0x1f6')]-_0x16b39f['originated']-_0x16b39f[_0x5361('0x128')]-_0x16b39f['temp']-_0x16b39f['pTalking'];if(_0xf2e7a6>_0x369f3c){_0xf2e7a6=_0x369f3c;}}if(_0xf2e7a6>0x0){if(_0x16b39f['dialMethod']===_0x5361('0x8')){_0xf2e7a6=0x1;}if(_0xf2e7a6>this[_0x5361('0x1ee')]){_0xf2e7a6=this[_0x5361('0x1ee')];}_0x16b39f[_0x5361('0x1ed')]+=_0xf2e7a6;for(var _0x2a7c29 in this[_0x5361('0x1c')]){if(typeof this['agents'][_0x2a7c29]!=='undefined'){if(this['agents'][_0x2a7c29][_0x5361('0x5d')]===_0x5361('0x1f7')&&this[_0x5361('0x1c')][_0x2a7c29][_0x5361('0x73')]===_0x5361('0x72')){_0x440d6b[_0x5361('0x84')](this[_0x5361('0x1c')][_0x2a7c29]['id']);}}}hopperUtils[_0x5361('0x1f8')](_0x16b39f,_0x440d6b,_0xf2e7a6)['then'](function(_0x177043){_0x16b39f[_0x5361('0x1ed')]-=_0xf2e7a6;_0x16b39f['temp']=_0x16b39f['temp']>0x0?_0x16b39f[_0x5361('0x1ed')]:0x0;if(!utils[_0x5361('0x1f9')](_0x177043)){hopperUtils['countReScheduled'](_0x16b39f)[_0x5361('0x33')](sendMessageReschedule(_0x16b39f))[_0x5361('0x8c')](loggerCatch(_0x5361('0x1fa')));}else{_0x16b39f[_0x5361('0x13f')]+=_0x177043[_0x5361('0x83')];_0x16b39f[_0x5361('0x57')]=_0x16b39f[_0x5361('0x9b')]===_0x5361('0x8')?utils[_0x5361('0x58')][_0x5361('0x129')]:utils[_0x5361('0x58')][_0x5361('0x1f1')];for(var _0x1ef76d=0x0;_0x1ef76d<_0x177043['length'];_0x1ef76d+=0x1){if(_[_0x5361('0xe0')](_0x177043[_0x1ef76d])||_['isNil'](_0x177043[_0x1ef76d][_0x5361('0x161')])||_[_0x5361('0xe0')](_0x177043[_0x1ef76d][_0x5361('0x14c')])){_0x3089f4['emptyContact'](_0x5361('0x1f2'),_0x16b39f,_0x177043[_0x1ef76d]);}else{hopperUtils[_0x5361('0x1fb')](_[_0x5361('0x63')](_0x177043[_0x1ef76d],['VoiceQueueId','phone']))[_0x5361('0x33')](_0x3089f4[_0x5361('0x1d9')](_0x16b39f,_0x177043[_0x1ef76d]))[_0x5361('0x8c')](_0x3089f4[_0x5361('0x142')](_0x5361('0x1f2'),_0x16b39f));}}}})[_0x5361('0x8c')](loggerGetContactDialer(_0x5361('0x1fc'),_0x16b39f,_0xf2e7a6));}};Dialer['prototype']['handlePredictive']=function(_0x399e0a){if(_0x399e0a[_0x5361('0x1f6')]>0x0){var _0x17f6db=_0x399e0a[_0x5361('0x1f6')]-_0x399e0a[_0x5361('0x13f')]-_0x399e0a['talking'];if(_0x17f6db>0x0){this['tryOriginatePredictive'](_0x399e0a);}else{loggerPredictiveCalls[_0x5361('0x3d')](_0x5361('0x1fd'));}}else{this[_0x5361('0x1fe')](_0x399e0a);}};Dialer['prototype']['tryOriginatePredictive']=function(_0x3815e6){var _0x4c6e70=this;var _0x2fa828=[];_0x3815e6['originated']+=0x1;for(var _0x374e4a in this['agents']){if(typeof this[_0x5361('0x1c')][_0x374e4a]!=='undefined'){if(this[_0x5361('0x1c')][_0x374e4a][_0x5361('0x5d')]===_0x5361('0x1f7')&&this['agents'][_0x374e4a][_0x5361('0x73')]===_0x5361('0x72')){_0x2fa828['push'](this[_0x5361('0x1c')][_0x374e4a]['id']);}}}return this[_0x5361('0x1f8')](_0x3815e6['id'],_0x2fa828,0x1,_0x3815e6[_0x5361('0x1f0')],_0x3815e6)[_0x5361('0x33')](function(_0x43e7fe){if(!utils[_0x5361('0x1f9')](_0x43e7fe)){utils[_0x5361('0x1ff')](_0x3815e6,0x1,0x0);return hopperUtils['countReScheduled'](_0x3815e6)[_0x5361('0x33')](sendMessageReschedule(_0x3815e6))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x3815e6[_0x5361('0x57')]=utils[_0x5361('0x58')][_0x5361('0x1f1')];if(_[_0x5361('0xe0')](_0x43e7fe[0x0])||_[_0x5361('0xe0')](_0x43e7fe[0x0]['Contact'])||_[_0x5361('0xe0')](_0x43e7fe[0x0][_0x5361('0x14c')])){_0x4c6e70[_0x5361('0x143')](_0x5361('0x1f2'),_0x3815e6,_0x43e7fe[0x0]);}else{return hopperUtils['checkIsBlackList'](_[_0x5361('0x63')](_0x43e7fe[0x0],[_0x5361('0xc8'),_0x5361('0x14c')]))[_0x5361('0x33')](_0x4c6e70[_0x5361('0x1d9')](_0x3815e6,_0x43e7fe[0x0]))[_0x5361('0x8c')](_0x4c6e70['loggerHandler'](_0x5361('0x200'),_0x3815e6));}}})[_0x5361('0x8c')](loggerGetContactDialer(_0x5361('0x201'),_0x3815e6,0x1));};Dialer[_0x5361('0x15')][_0x5361('0x1cb')]=function(_0x2e66d2,_0x465b2d,_0x5600b7,_0x580ce,_0xd4f325,_0x161560){loggerPredictive[_0x5361('0x3d')](_0x5361('0x202'));loggerPredictive['info'](_0x5361('0x203'),_0x2e66d2);loggerPredictive[_0x5361('0x3d')](_0x5361('0x204'),_0x465b2d);loggerPredictive[_0x5361('0x3d')](_0x5361('0x205'),_0x5600b7);loggerPredictive[_0x5361('0x3d')](_0x5361('0x206'),_0x580ce);loggerPredictive[_0x5361('0x3d')](_0x5361('0x207'),_0xd4f325);loggerPredictive[_0x5361('0x3d')](_0x5361('0x44'));return new Promise(function(_0x36ae34,_0x4d97a9){if(_0x2e66d2<=0x0||isNaN(_0x2e66d2)){return _0x4d97a9(msgResponse('[abandonmentRate]',_0x5361('0x70'),'m\x20=\x20'+_0x2e66d2));}if(_0x5600b7<=0x0||isNaN(_0x5600b7)){return _0x4d97a9(msgResponse('[abandonmentRate]','Error',_0x5361('0x208')+_0x5600b7));}if(_0x580ce<=0x0||isNaN(_0x580ce)){return _0x4d97a9(msgResponse('[abandonmentRate]',_0x5361('0x70'),'p\x20=\x20'+_0x580ce));}if(_0x465b2d<=0x0||isNaN(_0x465b2d)){return _0x4d97a9(msgResponse(_0x5361('0x209'),'Error',_0x5361('0x20a')+_0x465b2d));}if(_0xd4f325<=0x0||isNaN(_0xd4f325)){return _0x4d97a9(msgResponse(_0x5361('0x209'),_0x5361('0x70'),_0x5361('0x20b')+_0xd4f325));}_0x161560=_0x161560||0x0;var _0x40230f=0x1/_0x5600b7;var _0xb43c1b=0x0;var _0x397e01=0x0;var _0x2a9a28=0x0;var _0xf57f0d=0x0;for(var _0x3d058d=0x0;_0x2a9a28<_0xd4f325;_0x3d058d+=0x1){_0x397e01=_0x3d058d/_0x465b2d;_0xb43c1b=(_0x580ce*_0x397e01+_0x161560)/_0x40230f;_0x2a9a28=utils['erlangb'](_0xb43c1b,_0x2e66d2);_0xf57f0d=_0xb43c1b/_0x2e66d2*(0x1-utils[_0x5361('0x20c')](_0xb43c1b,_0x2e66d2));}return _0x36ae34({'erlangCalls':_0x3d058d,'erlangCallToSecond':_0x465b2d/_0x3d058d,'erlangAbandonmentRate':_0x2a9a28,'erlangBusyFactor':_0xf57f0d});});};Dialer[_0x5361('0x15')]['busyFactor']=function(_0x4042a5,_0x10183a,_0x59d4fe,_0x23cd5d,_0x411490,_0x37b8ce){loggerPredictive['info'](_0x5361('0x20d'));loggerPredictive[_0x5361('0x3d')](_0x5361('0x203'),_0x4042a5);loggerPredictive['info'](_0x5361('0x204'),_0x10183a);loggerPredictive[_0x5361('0x3d')](_0x5361('0x205'),_0x59d4fe);loggerPredictive[_0x5361('0x3d')](_0x5361('0x206'),_0x23cd5d);loggerPredictive[_0x5361('0x3d')](_0x5361('0x20e'),_0x411490);loggerPredictive['info'](_0x5361('0x44'));return new Promise(function(_0xb0ca57,_0x15606d){if(_0x4042a5<=0x0||isNaN(_0x4042a5)){return _0x15606d(msgResponse(_0x5361('0x20f'),_0x5361('0x70'),_0x5361('0x210')+_0x4042a5));}if(_0x59d4fe<=0x0||isNaN(_0x59d4fe)){return _0x15606d(msgResponse(_0x5361('0x20f'),'Error',_0x5361('0x208')+_0x59d4fe));}if(_0x23cd5d<=0x0||isNaN(_0x23cd5d)){return _0x15606d(msgResponse('[busyFactor]',_0x5361('0x70'),_0x5361('0x211')+_0x23cd5d));}if(_0x10183a<=0x0||isNaN(_0x10183a)){return _0x15606d(msgResponse(_0x5361('0x20f'),_0x5361('0x70'),_0x5361('0x20a')+_0x10183a));}if(_0x411490<=0x0||isNaN(_0x411490)){return _0x15606d(msgResponse(_0x5361('0x20f'),_0x5361('0x70'),'Umin\x20=\x20'+_0x411490));}_0x37b8ce=_0x37b8ce||0x0;var _0x11dc21=0x1/_0x59d4fe;var _0x35fb93=0x0;var _0x177932=0x0;var _0x23fbe2=0x0;var _0x271433=0x0;for(var _0x58259c=0x0;_0x271433<_0x411490;_0x58259c+=0x1){_0x177932=_0x58259c/_0x10183a;_0x35fb93=(_0x23cd5d*_0x177932+_0x37b8ce)/_0x11dc21;_0x23fbe2=utils['erlangb'](_0x35fb93,_0x4042a5);_0x271433=_0x35fb93/_0x4042a5*(0x1-utils[_0x5361('0x20c')](_0x35fb93,_0x4042a5));}return _0xb0ca57({'erlangCalls':_0x58259c,'erlangCallToSecond':_0x10183a/_0x58259c,'erlangAbandonmentRate':_0x23fbe2,'erlangBusyFactor':_0x271433});});};module[_0x5361('0x212')]=Dialer; \ No newline at end of file +var _0x5c36=['Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','erlangAbandonmentRate','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','getSeconds','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','contactsRescheduled','message','CAMPAIGN_STATUS','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','NULL_INTERVAL','Interval','Intervals','\x20INTERVAL_IS_NULL','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','[ifTime][Action]','Error','prototype','isTrunkReachable','active','status','reachable','SIP/%s','unmonitored','checkIsTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','ifTime','Failure','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','interval','content','true','Action','indexOf','catch','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','loopCampaigns','syncCampaigns','undefined','resolve','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','power','dialPowerLevel','Queue','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','uniqueid','ivr','updateOriginated','answertime','YYYY-MM-DD\x20HH:mm:ss','queue','outboundAnswerCallsDay','reason','agent','[syncAgentComplete][createHistory]','[syncAgentComplete]','syncQueueCallerAbandon','droptime','responsetime','dialQueueTimeout','dropreason','TIMEOUT','dialQueueProject2','countdropretry','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','minutes','ContactId','ListId','VoiceQueueId','[rescheduleContact][Drop]','endtime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','countabandonedretry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','CampaignId','[rescheduleContact][Abandoned]','createHistory','[syncAgentComplete][createHistory][11]','swapAdditionalPhones','channel','actionid','strategy','rrmemory','roundrobin','locked','paused','stateinterface','idHopper','preview','run','[Catch][Preview][syncQueueStatusComplete]','finally','_rr','isNil','unlockRR','[booked][RR]','Agent:\x20','[booked][RR][finaly]','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','Success','[callProgressDetecting]\x20','variable','exten','xcally-motion-dialer','dialAMDActive','value','HangupInAMD','membername','AMD','custom:amd','buildObj','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','outboundAnswerAgiCallsDay','countmachineretry','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','Machine','ivrAnswerCallsDay','moveContactManagedDialer','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr][createHistory]','[syncHangupIvr]','outboundUnknownCallsDay','Unknow','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','available','talking','pTalking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','Agent','user:dialPreviewRecallReminder','[uniqueid]','clearZombieChannels','[actions]','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','loggerHandler','emptyContact','notFound','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','handleIvr','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','dialQueueOptions','dialAgiAfterHangupAgent','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-CAMPAIGNID','Contact','tags','createdAt','%s%s','XMD-','toUpper','callerid','dialOriginateCallerIdName','getCallerIdRandom','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerId','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','callProgressDetecting','[callProgressDetecting]','entity\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberRetryFrequency','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','predictiveIntervalMaxThreshold','round','predictiveIntervalAvailable','predictiveIntervalMinThreshold','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive][Loop]','predictiveIntervalErlangCallsDroppedCalls','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','dialPredictiveInterval','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalAvgTalktime','predictiveIntervalHitRate','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','[CatchErlangB]','predictiveIntervalPauses','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','recallme','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','dialOrderByScheduledAt','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','getContactDialer','[countReScheduled]\x20','[getContactDialer2]','tryOriginatePredictive','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','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','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','[abandonmentRate]','Amax\x20=\x20','erlangb','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]','interval\x20=\x20','Umin\x20=\x20','exports','util','lodash','uuid','ioredis','./utils','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','defaults','localhost','socket.io-emitter','redis','../rpc/voiceQueueRt','../rpc/setting','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','enqueue','tail','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','bind','queuecallerabandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummary','custom:queuesummarycomplete','syncQueueSummaryComplete','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','name','voice_queue:save','isEmpty','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','info','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','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive'];(function(_0x420a0b,_0x339d16){var _0x1f74e5=function(_0x3d8b9a){while(--_0x3d8b9a){_0x420a0b['push'](_0x420a0b['shift']());}};_0x1f74e5(++_0x339d16);}(_0x5c36,0x1c9));var _0x65c3=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5c36[_0x2641f9];return _0x585741;};'use strict';var util=require(_0x65c3('0x0'));var _=require(_0x65c3('0x1'));var uuid=require(_0x65c3('0x2'));var moment=require('moment');var rr=require('rr');var Redis=require(_0x65c3('0x3'));var utils=require(_0x65c3('0x4'));var hopperUtils=require('./utils/hopper');var ut=require(_0x65c3('0x5'));var config=require(_0x65c3('0x6'));var logger=require(_0x65c3('0x7'))(_0x65c3('0x8'));var loggerBooked=require(_0x65c3('0x7'))(_0x65c3('0x9'));var loggerPredictive=require(_0x65c3('0x7'))(_0x65c3('0xa'));var loggerPredictiveCalls=require(_0x65c3('0x7'))(_0x65c3('0xb'));var loggerSyncQueueSummary=require('../../../config/logger')('syncQueueSummary');var ami=require('../ami');config['redis']=_[_0x65c3('0xc')](config['redis'],{'host':_0x65c3('0xd'),'port':0x18eb});var io=require(_0x65c3('0xe'))(new Redis(config[_0x65c3('0xf')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require(_0x65c3('0x10'));var RpcSetting=require(_0x65c3('0x11'));var Interval=require('../rpc/interval');var Action=require('./models/action');var History=require(_0x65c3('0x12'));var Final=require(_0x65c3('0x13'));var AgentComplete=require(_0x65c3('0x14'));var QueueCallerAbandon=require(_0x65c3('0x15'));var Hangup=require(_0x65c3('0x16'));var ipAgi=process[_0x65c3('0x17')][_0x65c3('0x18')]||_0x65c3('0x19');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0x65c3('0x1a')]=function(_0x3836b3){this[_0x65c3('0x1b')]=this[_0x65c3('0x1b')]?this['tail']['finally'](_0x3836b3):_0x3836b3();};function Dialer(_0x194425,_0x483d37){this[_0x65c3('0x1c')]=new Sequence();this['preview']=_0x483d37;this[_0x65c3('0x1d')]=_0x194425[_0x65c3('0x1d')];this[_0x65c3('0x1e')]=_0x194425['campaigns'];this[_0x65c3('0x1f')]=_0x194425[_0x65c3('0x1f')];this[_0x65c3('0x20')]=_0x194425[_0x65c3('0x20')];this[_0x65c3('0x21')]=config[_0x65c3('0x21')]||0x2;this[_0x65c3('0x22')]={};this[_0x65c3('0x23')]={};this[_0x65c3('0x24')]={};this[_0x65c3('0x25')]={};this['optionPredictive']={};this[_0x65c3('0x26')]={};this[_0x65c3('0x27')]={};this[_0x65c3('0x28')]={};this[_0x65c3('0x29')]={};this[_0x65c3('0x2a')]={};this[_0x65c3('0x2b')]={};ami['on'](_0x65c3('0x2c'),this[_0x65c3('0x2d')][_0x65c3('0x2e')](this));ami['on'](_0x65c3('0x2f'),this['syncQueueCallerAbandon'][_0x65c3('0x2e')](this));ami['on'](_0x65c3('0x30'),this[_0x65c3('0x31')][_0x65c3('0x2e')](this));ami['on'](_0x65c3('0x32'),this[_0x65c3('0x33')]['bind'](this));ami['on'](_0x65c3('0x34'),this[_0x65c3('0x35')]['bind'](this));ami['on'](_0x65c3('0x36'),this[_0x65c3('0x37')][_0x65c3('0x2e')](this));ami['on']('hangup',this[_0x65c3('0x38')][_0x65c3('0x2e')](this));ami['on'](_0x65c3('0x39'),this[_0x65c3('0x3a')][_0x65c3('0x2e')](this));ami['on'](_0x65c3('0x3b'),this[_0x65c3('0x3c')][_0x65c3('0x2e')](this));ami['on'](_0x65c3('0x3d'),this[_0x65c3('0x3e')][_0x65c3('0x2e')](this));ami['on'](_0x65c3('0x3f'),this['syncQueueStatusComplete']['bind'](this));this['loopCampaigns']();this[_0x65c3('0x40')]();RpcSetting[_0x65c3('0x41')]()[_0x65c3('0x42')](function(_0x4fb948){previewRecallmeReminderInterval=_0x4fb948[_0x65c3('0x43')];});}function isNotNull(_0x4f1772){return _0x4f1772!==null&&!_[_0x65c3('0x44')](_0x4f1772);}function msgResponse(_0x239e9b,_0x143024,_0x5e344c){return{'action':_0x239e9b,'response':_0x143024,'message':_0x5e344c,'stack':_0x5e344c};}function emit(_0x4aa62e,_0x41307e,_0x4bf3a0){io['to'](_0x4aa62e)[_0x65c3('0x45')](_0x41307e,_0x4bf3a0);}function emitOutboundVoiceQueueSummary(_0x17e81a){if(_0x17e81a[_0x65c3('0x46')]===_0x65c3('0x47')){logger[_0x65c3('0x48')](_0x65c3('0x49'),util[_0x65c3('0x4a')](_0x17e81a,{'showHidden':![],'depth':null}));emit(util[_0x65c3('0x4b')](_0x65c3('0x4c'),_0x17e81a[_0x65c3('0x4d')]),_0x65c3('0x4e'),_0x17e81a);}}function checkGetDataPredictive(_0x12e6bd){if(isNotNull(_0x12e6bd)&&!_[_0x65c3('0x4f')](_0x12e6bd)){loggerPredictive['info']('-----\x20Stats\x20Predictive\x20---');loggerPredictive['info'](_0x65c3('0x50'),_0x12e6bd[_0x65c3('0x51')]);loggerPredictive['info']('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x12e6bd[_0x65c3('0x52')]);loggerPredictive[_0x65c3('0x53')](_0x65c3('0x54'),_0x12e6bd[_0x65c3('0x55')]);loggerPredictive['info'](_0x65c3('0x56'),_0x12e6bd[_0x65c3('0x57')]);loggerPredictive[_0x65c3('0x53')](_0x65c3('0x58'),_0x12e6bd[_0x65c3('0x59')]);loggerPredictive[_0x65c3('0x53')](_0x65c3('0x5a'),_0x12e6bd['predictiveIntervalAvgTalktime']);loggerPredictive['info'](_0x65c3('0x5b'));if(_0x12e6bd['predictiveIntervalTotalCalls']>0x0){if(!_['isUndefined'](_0x12e6bd['predictiveIntervalAvgTalktime'])&&_0x12e6bd['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive['info']('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x65c3('0x44')](_0x12e6bd[_0x65c3('0x59')])&&_0x12e6bd['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x65c3('0x53')](_0x65c3('0x5c'));}else{loggerPredictive['info'](_0x65c3('0x5d'));}}else{loggerPredictive[_0x65c3('0x53')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x47f423){return function(_0x468094){loggerPredictive[_0x65c3('0x53')]('---------\x20ErlangB\x20---------');loggerPredictive['info'](_0x65c3('0x5e'),_0x468094[_0x65c3('0x5f')]);loggerPredictive[_0x65c3('0x53')](_0x65c3('0x60'),_0x468094[_0x65c3('0x61')]);loggerPredictive[_0x65c3('0x53')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x468094[_0x65c3('0x62')]);loggerPredictive['info']('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x468094['erlangBusyFactor']);loggerPredictive['info'](_0x65c3('0x63'),_0x468094[_0x65c3('0x62')]);loggerPredictive[_0x65c3('0x53')](_0x65c3('0x5b'));_[_0x65c3('0x64')](_0x47f423,_0x468094);};}function ifInterval(_0x3e4ddb,_0xf376e5){if(_[_0x65c3('0x44')](_0xf376e5)){return![];}return utils[_0x65c3('0x65')](undefined,_0xf376e5)<_0x3e4ddb*0x3c;}function clearPredictiveAttributes(_0x529868){if(_0x529868[_0x65c3('0x27')]){_0x529868[_0x65c3('0x27')]=undefined;loggerPredictive['debug'](_0x529868[_0x65c3('0x4d')],_0x65c3('0x66'));}if(_0x529868['startPredictive']){_0x529868['startPredictive']=undefined;loggerPredictive[_0x65c3('0x48')](_0x529868['name'],_0x65c3('0x67'));}if(_0x529868['handlePredictive']){clearInterval(_0x529868[_0x65c3('0x68')]);_0x529868['handlePredictive']=undefined;loggerPredictive[_0x65c3('0x48')](_0x529868[_0x65c3('0x4d')],_0x65c3('0x69'));}}function loggerCatchPredictive(_0x37abc4,_0x96e466){return function(_0x27b624){loggerPredictive[_0x65c3('0x6a')](_0x96e466[_0x65c3('0x4d')],_0x37abc4);loggerPredictive[_0x65c3('0x6a')](_0x27b624[_0x65c3('0x6b')]);clearPredictiveAttributes(_0x96e466);};}function loggerCatch(_0x57a975){return function(_0x1b7ad3){logger[_0x65c3('0x6a')](_0x57a975,util['inspect'](_0x1b7ad3,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x322948,_0x5b1d16,_0x587c9b){return function(_0x343d03){utils[_0x65c3('0x6c')](_0x5b1d16,_0x587c9b,0x0);logger[_0x65c3('0x6a')](_0x322948,util[_0x65c3('0x4a')](_0x343d03,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x19ff36){return function(_0x5bd2a3){if(isNotNull(_0x5bd2a3)&&isNotNull(_0x5bd2a3[0x0])){if(_0x5bd2a3[0x0][_0x65c3('0x6d')]>0x0){_0x19ff36[_0x65c3('0x6e')]=utils[_0x65c3('0x6f')]['CONTACTS_RESCHEDULED'];logger[_0x65c3('0x53')]('[getContactDialer2][ReScheduled]'+_0x19ff36[_0x65c3('0x4d')],_0x5bd2a3[0x0]['contactsRescheduled'],_0x65c3('0x70'));}else{_0x19ff36[_0x65c3('0x6e')]=utils['CAMPAIGN_STATUS'][_0x65c3('0x71')];logger['info'](_0x65c3('0x72')+_0x19ff36[_0x65c3('0x4d')]);}}};}function createObjHistory(_0x3a1ebc,_0xe5ac1,_0x425371,_0x7f8c2e,_0x4a1014){_0x3a1ebc[_0x65c3('0x6e')]=_0x425371;var _0x2baf7a=new Action(_0x3a1ebc,_0xe5ac1);var _0x3bc700=new History(_0x2baf7a);_0x3bc700[_0x65c3('0x73')]=_0x7f8c2e;_0x3bc700[_0x65c3('0x74')]=_0x4a1014;_0x3bc700['endtime']=_0x2baf7a[_0x65c3('0x75')];return _0x3bc700;}function unlockQueueStatus(_0x16cd80,_0x44a414){setTimeout(function(){if(_[_0x65c3('0x44')](_0x16cd80[_0x65c3('0x76')])){loggerBooked[_0x65c3('0x6a')](_0x65c3('0x77'),_0x44a414);}_0x16cd80[_0x65c3('0x76')]=!![];loggerBooked[_0x65c3('0x53')](_0x65c3('0x78'),_0x44a414,JSON[_0x65c3('0x79')](_[_0x65c3('0x7a')](_0x16cd80,['name',_0x65c3('0x76')])));},0x1f3);}function checkInterval(_0x58589a){return function(){if(!isNotNull(_0x58589a['Interval'])){_0x58589a[_0x65c3('0x6e')]=utils[_0x65c3('0x6f')][_0x65c3('0x7b')];throw _0x58589a['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x58589a[_0x65c3('0x7c')][_0x65c3('0x7d')])){_0x58589a[_0x65c3('0x6e')]=utils[_0x65c3('0x6f')][_0x65c3('0x7b')];throw _0x58589a[_0x65c3('0x4d')]+_0x65c3('0x7e');}if(!isNotNull(_[_0x65c3('0x4f')](_0x58589a['Interval'][_0x65c3('0x7d')]))){_0x58589a[_0x65c3('0x6e')]=utils['CAMPAIGN_STATUS'][_0x65c3('0x7b')];throw _0x58589a['name']+_0x65c3('0x7e');}};}function checkIsIVRCampaignActive(_0x2f9d6b){return function(){if(!utils[_0x65c3('0x7f')](_0x2f9d6b)){_0x2f9d6b[_0x65c3('0x6e')]=utils[_0x65c3('0x6f')][_0x65c3('0x80')];throw _0x2f9d6b[_0x65c3('0x4d')]+_0x65c3('0x81');}};}function emitCampaignSummary(_0x203023){if(utils[_0x65c3('0x82')](_0x203023)){emit(util[_0x65c3('0x4b')](_0x65c3('0x83'),_0x203023[_0x65c3('0x4d')]),_0x65c3('0x84'),_0x203023);}}function loggerCatchQueueSummary(_0x39c405,_0xe95887){return function(_0x3a2975){clearPredictiveAttributes(_0xe95887);emitCampaignSummary(_0xe95887);loggerSyncQueueSummary[_0x65c3('0x48')](_0x39c405,util[_0x65c3('0x4a')](_0x3a2975,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x2cb802){if(_0x2cb802[_0x65c3('0x85')]){if(_0x2cb802[_0x65c3('0x86')]===0x0){_0x2cb802['sendMessageOneNotActive']=![];_0x2cb802[_0x65c3('0x6e')]=utils['CAMPAIGN_STATUS']['INACTIVE'];loggerSyncQueueSummary[_0x65c3('0x48')](_0x65c3('0x87'),_0x2cb802[_0x65c3('0x4d')],_0x65c3('0x88'));}else{_0x2cb802[_0x65c3('0x6e')]=utils[_0x65c3('0x6f')][_0x65c3('0x89')];loggerSyncQueueSummary['debug']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x2cb802[_0x65c3('0x4d')],'is\x20disactive');}emitCampaignSummary(_0x2cb802);}}function myreject(_0x3189db){return function(_0x26afd5){return _0x3189db(msgResponse(_0x65c3('0x8a'),_0x65c3('0x8b'),JSON['stringify'](_0x26afd5)));};}Dialer[_0x65c3('0x8c')][_0x65c3('0x8d')]=function(_0x518d22){return!_['isUndefined'](_0x518d22)&&_0x518d22&&!_[_0x65c3('0x44')](_0x518d22['name'])&&!_['isUndefined'](_0x518d22[_0x65c3('0x8e')])&&_0x518d22[_0x65c3('0x8e')]&&(this[_0x65c3('0x20')][util['format']('SIP/%s',_0x518d22[_0x65c3('0x4d')])][_0x65c3('0x8f')]===_0x65c3('0x90')||this[_0x65c3('0x20')][util[_0x65c3('0x4b')](_0x65c3('0x91'),_0x518d22['name'])]['status']===_0x65c3('0x92'));};Dialer[_0x65c3('0x8c')][_0x65c3('0x93')]=function(_0x163d57){var _0x5ef104=this;return function(){if(!_0x5ef104[_0x65c3('0x8d')](_0x163d57[_0x65c3('0x94')])){if(!_0x5ef104[_0x65c3('0x8d')](_0x163d57[_0x65c3('0x95')])){_0x163d57[_0x65c3('0x6e')]=utils[_0x65c3('0x6f')][_0x65c3('0x96')];throw _0x163d57[_0x65c3('0x4d')]+_0x65c3('0x97');}}};};Dialer[_0x65c3('0x8c')][_0x65c3('0x98')]=function(_0x1ca08f,_0x418543,_0x4263a6,_0x21d233){var _0x50973e=this;return function(){var _0x4daca4=!![];return _0x50973e[_0x65c3('0x99')](_0x1ca08f,_0x418543,_0x4263a6,_0x21d233,_0x4daca4);};};Dialer[_0x65c3('0x8c')][_0x65c3('0x9a')]=function(_0x52c900,_0x3d443a,_0xd7cee9,_0x920ea){var _0x5a2a90=this;return function(){var _0x57ed3d=![];return _0x5a2a90[_0x65c3('0x99')](_0x52c900['Intervals'],_0x3d443a,_0xd7cee9,_0x920ea,_0x57ed3d);};};Dialer['prototype']['ifTimeIvr']=function(_0x561406,_0x4df361,_0x255ab5,_0x1312bb,_0x11cf68){var _0x3b3a54=[];return new Promise(function(_0x306752,_0x2670c9){if(!isNotNull(_0x561406)){_0x1312bb['message']=utils['CAMPAIGN_STATUS'][_0x65c3('0x7b')];return _0x2670c9(msgResponse('ifTime','Failure',_0x255ab5+_0x65c3('0x9b')));}if(_[_0x65c3('0x4f')](_0x561406)){_0x1312bb[_0x65c3('0x6e')]=utils[_0x65c3('0x6f')][_0x65c3('0x9c')];return _0x2670c9(msgResponse(_0x65c3('0x9d'),_0x65c3('0x9e'),_0x255ab5+_0x65c3('0x9f')));}if(_0x4df361&&_[_0x65c3('0x44')](config[_0x65c3('0xa0')][_0x4df361])){_0x1312bb[_0x65c3('0x6e')]=utils[_0x65c3('0x6f')][_0x65c3('0xa1')];return _0x2670c9(msgResponse(_0x65c3('0x9d'),'Failure',_0x255ab5+_0x65c3('0xa2')+_0x4df361));}if(_[_0x65c3('0xa3')](_0x561406)){for(var _0x112429=0x0;_0x112429<_0x561406[_0x65c3('0xa4')];_0x112429+=0x1){_0x3b3a54[_0x65c3('0xa5')](ami['Action']({'action':'command','command':util['format']('iftime\x20%s,%s',_0x561406[_0x112429][_0x65c3('0xa6')],!_[_0x65c3('0x44')](config[_0x65c3('0xa0')][_0x4df361])?_0x4df361:'')})[_0x65c3('0x42')](function(_0x472304){return _0x472304[_0x65c3('0xa7')]['indexOf'](_0x65c3('0xa8'))>=0x0;})['catch'](myreject(_0x2670c9)));}}else{_0x3b3a54[_0x65c3('0xa5')](ami[_0x65c3('0xa9')]({'action':'command','command':util[_0x65c3('0x4b')]('iftime\x20%s,%s',_0x561406,!_[_0x65c3('0x44')](config[_0x65c3('0xa0')][_0x4df361])?_0x4df361:'')})['then'](function(_0x5ac8b4){return _0x5ac8b4[_0x65c3('0xa7')][_0x65c3('0xaa')]('true')>=0x0;})[_0x65c3('0xab')](myreject(_0x2670c9)));}Promise[_0x65c3('0xac')](_0x3b3a54)['then'](function(_0x24d5f7){var _0x27505b=_[_0x65c3('0xad')](_0x24d5f7);if(_0x27505b){return _0x306752(_0x27505b);}else{_0x1312bb['message']=_0x11cf68?utils[_0x65c3('0x6f')][_0x65c3('0xae')]:utils[_0x65c3('0x6f')][_0x65c3('0xaf')];return _0x2670c9(msgResponse(_0x65c3('0xb0'),_0x65c3('0x9e'),_0x65c3('0xb1')+_0x11cf68+'\x20'+_0x255ab5+_0x65c3('0xb2')+util[_0x65c3('0x4a')](_0x561406,{'showHidden':![],'depth':null})+_0x65c3('0xb3')+_0x4df361));}})[_0x65c3('0xab')](function(_0x4a954a){return _0x2670c9(msgResponse(_0x65c3('0x9d'),_0x65c3('0x9e'),JSON[_0x65c3('0x79')](_0x4a954a)));});});};Dialer[_0x65c3('0x8c')][_0x65c3('0xb4')]=function(){var _0x387dff=this;return cmHopper['resetActiveCalls']({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x387dff[_0x65c3('0xb5')]();},0x3e8);});};Dialer[_0x65c3('0x8c')][_0x65c3('0xb5')]=function(){var _0x2e1a3a=this;var _0x4ad9ee;for(var _0x2604c5 in this[_0x65c3('0x1e')]){if(typeof this['campaigns'][_0x2604c5]!==_0x65c3('0xb6')){_0x4ad9ee=this[_0x65c3('0x1e')][_0x2604c5];if(utils[_0x65c3('0x82')](_0x4ad9ee)&&utils[_0x65c3('0x7f')](_0x4ad9ee)){_0x4ad9ee[_0x65c3('0x85')]=!![];Promise[_0x65c3('0xb7')]()['then'](checkIsIVRCampaignActive(_0x4ad9ee))[_0x65c3('0x42')](checkInterval(_0x4ad9ee))[_0x65c3('0x42')](_0x2e1a3a[_0x65c3('0x93')](_0x4ad9ee))[_0x65c3('0x42')](_0x2e1a3a[_0x65c3('0x98')](_0x4ad9ee[_0x65c3('0xb8')],_0x4ad9ee[_0x65c3('0xb9')],_0x4ad9ee[_0x65c3('0x4d')],_0x4ad9ee))[_0x65c3('0x42')](_0x2e1a3a[_0x65c3('0x9a')](_0x4ad9ee[_0x65c3('0x7c')],_0x4ad9ee['dialTimezone'],_0x4ad9ee['name'],_0x4ad9ee))[_0x65c3('0x42')](_0x2e1a3a[_0x65c3('0xba')](_0x4ad9ee))[_0x65c3('0xab')](loggerCatchQueueSummary(_0x65c3('0xbb'),_0x4ad9ee));}else{notSendMessagesCampaign(_0x4ad9ee);}}}};Dialer[_0x65c3('0x8c')][_0x65c3('0xbc')]=function(_0x492e82){if(_0x492e82[_0x65c3('0xbd')]!=='predictive'){clearPredictiveAttributes(_0x492e82);}switch(_0x492e82['dialMethod']){case _0x65c3('0xbe'):this[_0x65c3('0xbf')](_0x492e82,0x1);break;case _0x65c3('0xc0'):this[_0x65c3('0xbf')](_0x492e82,_0x492e82[_0x65c3('0xc1')]);break;case _0x65c3('0xa'):this[_0x65c3('0xa')](_0x492e82);break;case _0x65c3('0x9'):this[_0x65c3('0xbf')](_0x492e82,0x1);break;default:logger[_0x65c3('0x6a')](_0x65c3('0xc2'),_0x492e82['name'],'method\x20not\x20recognized');}};Dialer[_0x65c3('0x8c')][_0x65c3('0x9d')]=function(_0x3f7c95,_0x17ae9d){var _0x2fb7ac=_0x3f7c95[_0x65c3('0xb9')];var _0x3c38f5=_0x17ae9d?_0x3f7c95[_0x65c3('0xb8')]:_0x3f7c95['Interval']['Intervals'];logger[_0x65c3('0xc3')](_0x65c3('0xc4'),_0x3c38f5,_0x2fb7ac,_0x3f7c95[_0x65c3('0x4d')],util[_0x65c3('0x4b')](_0x65c3('0xc5'),_0x3f7c95['name'],_0x3f7c95['id']));var _0x53efad=null;return Interval[_0x65c3('0xc6')](_0x3c38f5,_0x2fb7ac)[_0x65c3('0x42')](function(_0x450f47){if(_0x450f47===!![]){return _0x450f47;}else{_0x3f7c95[_0x65c3('0x6e')]=_0x17ae9d?utils[_0x65c3('0x6f')][_0x65c3('0xae')]:utils[_0x65c3('0x6f')]['OVERTIME_INTERVAL'];_0x53efad=msgResponse(_0x65c3('0xb0'),_0x65c3('0x9e'),_0x65c3('0xb1')+_0x17ae9d+'\x20'+_0x3f7c95[_0x65c3('0x4d')]+_0x65c3('0xb2')+util['inspect'](_0x3c38f5,{'showHidden':![],'depth':null})+_0x65c3('0xb3')+_0x2fb7ac);}if(_0x53efad!==null){logger[_0x65c3('0xc3')](_0x65c3('0xc7'),_0x53efad);_0x53efad[_0x65c3('0xc8')]=_0x17ae9d;throw _0x53efad;}})[_0x65c3('0xab')](function(_0x1dadc6){logger[_0x65c3('0x6a')](_0x65c3('0xc9'),_0x1dadc6);throw msgResponse(_0x65c3('0x8a'),_0x65c3('0x8b'),util['inspect'](_0x1dadc6,{'showHidden':![],'depth':null}));});};Dialer[_0x65c3('0x8c')][_0x65c3('0x2d')]=function(_0xc8fe85){if(this['voiceQueues'][_0xc8fe85['queue']]){if(this[_0x65c3('0x25')][_0xc8fe85[_0x65c3('0xca')]]&&this[_0x65c3('0x25')][_0xc8fe85[_0x65c3('0xca')]][_0x65c3('0x46')]!==_0x65c3('0xcb')){this[_0x65c3('0xcc')](this[_0x65c3('0x1d')][_0xc8fe85['queue']]);this[_0x65c3('0x25')][_0xc8fe85[_0x65c3('0xca')]][_0x65c3('0xcd')]=moment()[_0x65c3('0x4b')](_0x65c3('0xce'));}}};Dialer[_0x65c3('0x8c')][_0x65c3('0x33')]=function(_0x1982a8){var _0x111b3f=this['uniqueId'][_0x1982a8[_0x65c3('0xca')]];if(this[_0x65c3('0x1d')][_0x1982a8[_0x65c3('0xcf')]]){if(_0x111b3f&&_0x111b3f[_0x65c3('0x46')]!==_0x65c3('0xcb')){delete this['uniqueId'][_0x1982a8['uniqueid']];this[_0x65c3('0x1d')][_0x1982a8[_0x65c3('0xcf')]][_0x65c3('0xd0')]+=0x1;var _0x5c18c4=new AgentComplete(_0x111b3f,_0x1982a8);if(_0x1982a8[_0x65c3('0xd1')]===_0x65c3('0xd2')){_0x5c18c4['agiafterat']=this['voiceQueues'][_0x1982a8[_0x65c3('0xcf')]]['dialQueueProject2']&&this[_0x65c3('0x1d')][_0x1982a8[_0x65c3('0xcf')]]['dialAgiAfterHangupAgent']?moment()['format'](_0x65c3('0xce')):undefined;}hopperUtils['createHistory'](_0x5c18c4)['catch'](loggerCatch(_0x65c3('0xd3')));hopperUtils['moveContactManagedDialer'](_0x5c18c4)[_0x65c3('0xab')](loggerCatch(_0x65c3('0xd4')));}}};Dialer[_0x65c3('0x8c')][_0x65c3('0xd5')]=function(_0x3e73f1){var _0x4baf14=this[_0x65c3('0x25')][_0x3e73f1['uniqueid']];var _0x394128=this;var _0x3c8415=![];var _0x5a0762;var _0x10a20f;if(this[_0x65c3('0x1d')][_0x3e73f1[_0x65c3('0xcf')]]){if(_0x4baf14&&_0x4baf14[_0x65c3('0x46')]!==_0x65c3('0xcb')){delete this[_0x65c3('0x25')][_0x3e73f1[_0x65c3('0xca')]];this[_0x65c3('0xcc')](this['voiceQueues'][_0x3e73f1[_0x65c3('0xcf')]]);_0x4baf14[_0x65c3('0xd6')]=moment()[_0x65c3('0x4b')](_0x65c3('0xce'));var _0x5c164d=new QueueCallerAbandon(_0x4baf14,_0x3e73f1);if(utils[_0x65c3('0x65')](_0x4baf14[_0x65c3('0xd6')],_0x4baf14[_0x65c3('0xd7')])>=_0x4baf14[_0x65c3('0xd8')]){this[_0x65c3('0x1d')][_0x3e73f1[_0x65c3('0xcf')]][_0x65c3('0x55')]+=0x1;this[_0x65c3('0x1d')][_0x3e73f1[_0x65c3('0xcf')]]['outboundDropCallsDayTimeout']+=0x1;this[_0x65c3('0x1d')][_0x3e73f1[_0x65c3('0xcf')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x5c164d[_0x65c3('0x73')]=0xa;_0x5c164d[_0x65c3('0x74')]='Drop';_0x5c164d[_0x65c3('0xd9')]=_0x65c3('0xda');_0x5c164d['agiafterat']=this[_0x65c3('0x1d')][_0x3e73f1[_0x65c3('0xcf')]][_0x65c3('0xdb')]?moment()[_0x65c3('0x4b')](_0x65c3('0xce')):undefined;_0x5c164d[_0x65c3('0xdc')]+=0x1;_0x5c164d[_0x65c3('0xdd')]+=0x1;_0x5a0762=this[_0x65c3('0x1d')][_0x3e73f1['queue']][_0x65c3('0xde')];_0x10a20f=this['voiceQueues'][_0x3e73f1['queue']][_0x65c3('0xdf')];hopperUtils[_0x65c3('0xe0')](_0x5c164d,_0x5c164d[_0x65c3('0x73')],_0x4baf14[_0x65c3('0xe1')])[_0x65c3('0x42')](function(_0x3bf558){_0x3c8415=_0x3bf558[_0x65c3('0xe2')]==0x1;if(_0x5c164d[_0x65c3('0xdc')]>=_0x394128[_0x65c3('0x1d')][_0x3e73f1[_0x65c3('0xcf')]][_0x65c3('0xe3')]){_0x394128[_0x65c3('0xe4')](_0x5c164d,_0x3bf558[_0x65c3('0xe2')]);}else{hopperUtils[_0x65c3('0xe5')]({'active':![],'countdropretry':_0x5c164d['countdropretry'],'scheduledat':moment()['add'](_0x394128[_0x65c3('0x1d')][_0x3e73f1['queue']][_0x65c3('0xde')],_0x65c3('0xe6'))[_0x65c3('0x4b')](_0x65c3('0xce')),'ContactId':_0x4baf14[_0x65c3('0xe7')],'ListId':_0x4baf14[_0x65c3('0xe8')],'VoiceQueueId':_0x4baf14[_0x65c3('0xe9')]||undefined,'CampaignId':_0x4baf14['CampaignId']||undefined})[_0x65c3('0xab')](loggerCatch(_0x65c3('0xea')));var _0x4c07bd=new History(_0x5c164d);_0x4c07bd['state']=0xa;_0x4c07bd['statedesc']='Drop';_0x4c07bd[_0x65c3('0x75')]=moment()[_0x65c3('0x4b')](_0x65c3('0xce'));_0x4c07bd[_0x65c3('0xeb')]=_0x4c07bd[_0x65c3('0x75')];_0x4c07bd[_0x65c3('0xec')]=_0x5c164d[_0x65c3('0xec')];_0x4c07bd['calleridnum']=_0x5c164d[_0x65c3('0xed')];hopperUtils['createHistory'](_0x4c07bd)[_0x65c3('0xab')](loggerCatch(_0x65c3('0xee')));}})['then'](function(){if(_0x3c8415)hopperUtils['swapAdditionalPhones'](_0x5c164d,_0x5a0762,_0x10a20f)['then'](function(){return 0x1;});});}else{this[_0x65c3('0x1d')][_0x3e73f1[_0x65c3('0xcf')]][_0x65c3('0x57')]+=0x1;this['voiceQueues'][_0x3e73f1[_0x65c3('0xcf')]]['outboundDropCallsDayCallersExit']+=0x1;_0x5c164d[_0x65c3('0x73')]=0xb;_0x5c164d[_0x65c3('0x74')]=_0x65c3('0xef');_0x5c164d[_0x65c3('0xd9')]='CALLEREXIT';_0x5c164d[_0x65c3('0xf0')]+=0x1;_0x5c164d[_0x65c3('0xdd')]+=0x1;_0x5a0762=this['voiceQueues'][_0x3e73f1['queue']]['dialAbandonedRetryFrequency'];_0x10a20f=this['voiceQueues'][_0x3e73f1['queue']]['callAdditionalPhoneAfterMin'];hopperUtils[_0x65c3('0xe0')](_0x5c164d,_0x5c164d[_0x65c3('0x73')],_0x4baf14[_0x65c3('0xe1')])[_0x65c3('0x42')](function(_0x2ca0f4){if(_0x5c164d['countabandonedretry']>=_0x394128[_0x65c3('0x1d')][_0x3e73f1[_0x65c3('0xcf')]][_0x65c3('0xf1')]){_0x394128[_0x65c3('0xe4')](_0x5c164d,_0x2ca0f4[_0x65c3('0xe2')]);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x5c164d[_0x65c3('0xf0')],'scheduledat':moment()['add'](_0x394128[_0x65c3('0x1d')][_0x3e73f1['queue']][_0x65c3('0xf2')],'minutes')['format'](_0x65c3('0xce')),'ContactId':_0x4baf14[_0x65c3('0xe7')],'ListId':_0x4baf14['ListId'],'VoiceQueueId':_0x4baf14['VoiceQueueId']||undefined,'CampaignId':_0x4baf14[_0x65c3('0xf3')]||undefined})[_0x65c3('0xab')](loggerCatch(_0x65c3('0xf4')));var _0x2552b4=new History(_0x5c164d);_0x2552b4['state']=0xb;_0x2552b4[_0x65c3('0x74')]=_0x65c3('0xef');_0x2552b4[_0x65c3('0x75')]=moment()[_0x65c3('0x4b')](_0x65c3('0xce'));_0x2552b4[_0x65c3('0xeb')]=_0x2552b4[_0x65c3('0x75')];_0x2552b4[_0x65c3('0xec')]=_0x5c164d[_0x65c3('0xec')];_0x2552b4['calleridnum']=_0x5c164d[_0x65c3('0xed')];hopperUtils[_0x65c3('0xf5')](_0x2552b4)[_0x65c3('0xab')](loggerCatch(_0x65c3('0xf6')));}})[_0x65c3('0x42')](function(){if(_0x3c8415)hopperUtils[_0x65c3('0xf7')](_0x5c164d,_0x5a0762,_0x10a20f)[_0x65c3('0x42')](function(){return 0x1;});});}}}};Dialer[_0x65c3('0x8c')][_0x65c3('0x3a')]=function(_0x342539){if(this[_0x65c3('0x23')][_0x342539[_0x65c3('0xca')]]){this['actions'][_0x342539[_0x65c3('0xca')]][_0x65c3('0xf8')]=_0x342539[_0x65c3('0xf8')];}if(this[_0x65c3('0x25')][_0x342539[_0x65c3('0xca')]]){this['uniqueId'][_0x342539[_0x65c3('0xca')]][_0x65c3('0xf8')]=_0x342539[_0x65c3('0xf8')];}};Dialer['prototype'][_0x65c3('0x3e')]=function(_0x140e1c){if(!this[_0x65c3('0x23')][_0x140e1c[_0x65c3('0xf9')]]){return;}var _0x21817d=this[_0x65c3('0x1d')][this[_0x65c3('0x23')][_0x140e1c[_0x65c3('0xf9')]][_0x65c3('0xcf')]][_0x65c3('0xfa')]||_0x65c3('0xfb');if(_0x21817d===_0x65c3('0xfc')){if(this['actions'][_0x140e1c[_0x65c3('0xf9')]]&&_['isNil'](this[_0x65c3('0x23')][_0x140e1c[_0x65c3('0xf9')]][_0x65c3('0xfd')])&&_0x140e1c[_0x65c3('0x8f')]==='1'&&_0x140e1c[_0x65c3('0xfe')]==='0'){if(this[_0x65c3('0x1f')][_0x140e1c[_0x65c3('0xff')]]){if(!this[_0x65c3('0x1f')][_0x140e1c[_0x65c3('0xff')]][_0x65c3('0xfd')]){this[_0x65c3('0x1f')][_0x140e1c[_0x65c3('0xff')]][_0x65c3('0xfd')]=!![];this[_0x65c3('0x23')][_0x140e1c[_0x65c3('0xf9')]][_0x65c3('0xfd')]=!![];this['actions'][_0x140e1c['actionid']]['stateinterface']=_0x140e1c[_0x65c3('0xff')];}}}}else if(_0x21817d==='rrmemory'){if(this['actions'][_0x140e1c[_0x65c3('0xf9')]]){if(this['agents'][_0x140e1c[_0x65c3('0xff')]]){this[_0x65c3('0x23')][_0x140e1c['actionid']][_0x65c3('0xff')]=_0x140e1c[_0x65c3('0xff')];if(_['isNil'](this[_0x65c3('0x29')][this[_0x65c3('0x23')][_0x140e1c[_0x65c3('0xf9')]][_0x65c3('0xcf')]])){this[_0x65c3('0x29')][this[_0x65c3('0x23')][_0x140e1c[_0x65c3('0xf9')]]['queue']]=[];}this[_0x65c3('0x29')][this[_0x65c3('0x23')][_0x140e1c[_0x65c3('0xf9')]][_0x65c3('0xcf')]][_0x65c3('0xa5')](_[_0x65c3('0x64')](_[_0x65c3('0x7a')](this[_0x65c3('0x23')][_0x140e1c[_0x65c3('0xf9')]],[_0x65c3('0x100'),_0x65c3('0xff')]),{'status':_0x140e1c['status'],'paused':_0x140e1c[_0x65c3('0xfe')]}));}}}};Dialer[_0x65c3('0x8c')]['syncQueueStatusComplete']=function(_0xb9552a){if(!this[_0x65c3('0x23')][_0xb9552a[_0x65c3('0xf9')]]){return;}var _0x4d20fe=this;var _0x53a7a4=this['voiceQueues'][this[_0x65c3('0x23')][_0xb9552a['actionid']]['queue']];var _0x2ab165=_0x53a7a4[_0x65c3('0xfa')]||_0x65c3('0xfb');if(_0x2ab165===_0x65c3('0xfc')){if(this[_0x65c3('0x23')][_0xb9552a[_0x65c3('0xf9')]]&&this[_0x65c3('0x23')][_0xb9552a[_0x65c3('0xf9')]][_0x65c3('0xff')]){this[_0x65c3('0x101')][_0x65c3('0x102')](this[_0x65c3('0x23')][_0xb9552a[_0x65c3('0xf9')]][_0x65c3('0x100')],this[_0x65c3('0x23')][_0xb9552a[_0x65c3('0xf9')]][_0x65c3('0xff')])[_0x65c3('0xab')](function(_0x1b215b){logger['error'](_0x65c3('0x103'),util[_0x65c3('0x4a')](_0x1b215b,{'showHidden':![],'depth':null}));})[_0x65c3('0x104')](function(){_0x4d20fe[_0x65c3('0xcc')](_0x4d20fe[_0x65c3('0x1d')][_0x4d20fe[_0x65c3('0x23')][_0xb9552a[_0x65c3('0xf9')]][_0x65c3('0xcf')]]);_0x4d20fe[_0x65c3('0x1f')][_0x4d20fe[_0x65c3('0x23')][_0xb9552a[_0x65c3('0xf9')]][_0x65c3('0xff')]][_0x65c3('0xfd')]=![];delete _0x4d20fe[_0x65c3('0x23')][_0xb9552a[_0x65c3('0xf9')]];unlockQueueStatus(_0x53a7a4);});}else{this[_0x65c3('0xcc')](this['voiceQueues'][this[_0x65c3('0x23')][_0xb9552a[_0x65c3('0xf9')]][_0x65c3('0xcf')]]);hopperUtils['rescheduleContact']({'active':![],'ContactId':this[_0x65c3('0x23')][_0xb9552a['actionid']][_0x65c3('0xe7')],'ListId':this[_0x65c3('0x23')][_0xb9552a[_0x65c3('0xf9')]][_0x65c3('0xe8')],'VoiceQueueId':this[_0x65c3('0x23')][_0xb9552a[_0x65c3('0xf9')]]['VoiceQueueId']||undefined,'CampaignId':this[_0x65c3('0x23')][_0xb9552a['actionid']][_0x65c3('0xf3')]||undefined})[_0x65c3('0xab')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x65c3('0x23')][_0xb9552a[_0x65c3('0xf9')]];unlockQueueStatus(_0x53a7a4);}}else if(_0x2ab165===_0x65c3('0xfb')){var _0x144437;if(this[_0x65c3('0x23')][_0xb9552a[_0x65c3('0xf9')]]&&!_[_0x65c3('0x4f')](this[_0x65c3('0x29')][this[_0x65c3('0x23')][_0xb9552a[_0x65c3('0xf9')]][_0x65c3('0xcf')]])){if(this[_0x65c3('0x2a')][_0x4d20fe['actions'][_0xb9552a[_0x65c3('0xf9')]]['queue']]){this['queueBookedRR'][_0x4d20fe[_0x65c3('0x23')][_0xb9552a[_0x65c3('0xf9')]][_0x65c3('0xcf')]]=this[_0x65c3('0x2a')][this['actions'][_0xb9552a[_0x65c3('0xf9')]][_0x65c3('0xcf')]]?this[_0x65c3('0x2a')][this['actions'][_0xb9552a[_0x65c3('0xf9')]]['queue']]:this[_0x65c3('0x29')][this[_0x65c3('0x23')][_0xb9552a[_0x65c3('0xf9')]][_0x65c3('0xcf')]]?this[_0x65c3('0x29')][this['actions'][_0xb9552a['actionid']][_0x65c3('0xcf')]][_0x65c3('0x105')]||0x0:0x0;}this[_0x65c3('0x29')][this[_0x65c3('0x23')][_0xb9552a[_0x65c3('0xf9')]][_0x65c3('0xcf')]]['_rr']=this[_0x65c3('0x2a')][this['actions'][_0xb9552a[_0x65c3('0xf9')]]['queue']];for(var _0x1f5a91=0x0;_0x1f5a91=_0x3048ed[_0x65c3('0x12a')]){_0x1a96e7[_0x65c3('0x12b')](_0x5a3206,_0x2b639a,_0x27faa8,_0x65c3('0x12c'));}else{if(_0x5a3206[_0x65c3('0x122')]>=_0x3048ed[_0x65c3('0x12d')]){_0x1a96e7[_0x65c3('0x12e')](_0x5a3206,_0x2b639a,_0x27faa8,_0x65c3('0x12f'));}else{hopperUtils[_0x65c3('0xe5')]({'active':![],'countmachineretry':_0x5a3206['countmachineretry'],'scheduledat':moment()[_0x65c3('0x130')](_0x3048ed[_0x65c3('0x131')],_0x65c3('0xe6'))[_0x65c3('0x4b')](_0x65c3('0xce')),'ContactId':_0x5a3206[_0x65c3('0xe7')],'ListId':_0x5a3206[_0x65c3('0xe8')],'VoiceQueueId':_0x5a3206[_0x65c3('0xe9')]||undefined,'CampaignId':_0x5a3206[_0x65c3('0xf3')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x2b639a({'reschedule':0x1});}}});}if(_0xc3fb1[_0x65c3('0x46')]===_0x65c3('0xcb')&&this['campaigns'][_0xc3fb1[_0x65c3('0xcf')]][_0x65c3('0x116')]&&_0x4b070[_0x65c3('0x117')]==='HANGUP'){delete this[_0x65c3('0x25')][_0x4b070['uniqueid']];this['updateOriginated'](this[_0x65c3('0x1e')][_0xc3fb1[_0x65c3('0xcf')]]);_0x254e80=new Hangup(_0xc3fb1,_0x4b070);_0x254e80['state']=0x12;_0x254e80[_0x65c3('0x74')]=_0x65c3('0x118');_0x254e80[_0x65c3('0x119')]=_0x65c3('0x11a');ami[_0x65c3('0x45')](_0x65c3('0x11b'),ut['buildObj'](_0x254e80,'amd'));this[_0x65c3('0x11d')](_0x254e80,_0x65c3('0x132'),_0x65c3('0x133'));}if(_0xc3fb1[_0x65c3('0x46')]===_0x65c3('0xcb')&&this['campaigns'][_0xc3fb1[_0x65c3('0xcf')]][_0x65c3('0x116')]&&_0x4b070[_0x65c3('0x117')]===_0x65c3('0x120')){return new Promise(function(_0x2b6dc7,_0x297891){delete _0x1a96e7[_0x65c3('0x25')][_0x4b070[_0x65c3('0xca')]];_0x1a96e7[_0x65c3('0xcc')](_0x1a96e7[_0x65c3('0x1e')][_0xc3fb1[_0x65c3('0xcf')]]);_0x1a96e7[_0x65c3('0x1e')][_0xc3fb1[_0x65c3('0xcf')]][_0x65c3('0xd0')]+=0x1;_0x1a96e7[_0x65c3('0x1e')][_0xc3fb1['queue']][_0x65c3('0x121')]+=0x1;var _0xd6637d=_0x1a96e7[_0x65c3('0x1e')][_0xc3fb1[_0x65c3('0xcf')]];var _0x5e9fc3=new Hangup(_0xc3fb1,_0x4b070);_0x5e9fc3[_0x65c3('0x73')]=0x13;_0x5e9fc3[_0x65c3('0x74')]=_0x65c3('0x134');_0x5e9fc3[_0x65c3('0x119')]=_0x65c3('0x11a');_0x5e9fc3[_0x65c3('0x122')]+=0x1;_0x5e9fc3[_0x65c3('0xdd')]+=0x1;_0x5e9fc3[_0x65c3('0x123')]=!![];ami[_0x65c3('0x45')]('custom:amd',ut[_0x65c3('0x11c')](_0x5e9fc3,_0x65c3('0x123')));hopperUtils[_0x65c3('0xf5')](_0x5e9fc3)[_0x65c3('0xab')](loggerCatch(_0x65c3('0x124')));if(_0x5e9fc3['countbusyretry']+_0x5e9fc3['countcongestionretry']+_0x5e9fc3[_0x65c3('0x127')]+_0x5e9fc3['countnosuchnumberretry']+_0x5e9fc3[_0x65c3('0xdc')]+_0x5e9fc3['countabandonedretry']+_0x5e9fc3[_0x65c3('0x122')]+_0x5e9fc3[_0x65c3('0x129')]>=_0xd6637d['dialGlobalMaxRetry']){_0x1a96e7[_0x65c3('0x12b')](_0x5e9fc3,_0x2b6dc7,_0x297891,_0x65c3('0x12c'));}else{if(_0x5e9fc3[_0x65c3('0x122')]>=_0xd6637d[_0x65c3('0x12d')]){_0x1a96e7[_0x65c3('0x12e')](_0x5e9fc3,_0x2b6dc7,_0x297891,_0x65c3('0x12f'));}else{hopperUtils[_0x65c3('0xe5')]({'active':![],'countmachineretry':_0x5e9fc3[_0x65c3('0x122')],'scheduledat':moment()[_0x65c3('0x130')](_0xd6637d[_0x65c3('0x131')],_0x65c3('0xe6'))['format'](_0x65c3('0xce')),'ContactId':_0x5e9fc3[_0x65c3('0xe7')],'ListId':_0x5e9fc3[_0x65c3('0xe8')],'VoiceQueueId':_0x5e9fc3[_0x65c3('0xe9')]||undefined,'CampaignId':_0x5e9fc3[_0x65c3('0xf3')]||undefined})[_0x65c3('0xab')](loggerCatch('[rescheduleContact][Machine]'));_0x2b6dc7({'reschedule':0x1});}}});}}};Dialer[_0x65c3('0x8c')][_0x65c3('0x38')]=function(_0x55c065){var _0x3b4441=this[_0x65c3('0x25')][_0x55c065[_0x65c3('0xca')]];var _0x2f1be1;if(_0x3b4441&&_0x3b4441[_0x65c3('0x46')]===_0x65c3('0xcb')){delete this[_0x65c3('0x25')][_0x55c065[_0x65c3('0xca')]];this['updateOriginated'](this[_0x65c3('0x1e')][_0x3b4441['queue']]);this['campaigns'][_0x3b4441[_0x65c3('0xcf')]][_0x65c3('0x135')]+=0x1;_0x2f1be1=new Hangup(_0x3b4441,_0x55c065);hopperUtils[_0x65c3('0xf5')](_0x2f1be1)[_0x65c3('0xab')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x65c3('0x136')](_0x2f1be1)[_0x65c3('0xab')](loggerCatch('[syncHangupIvr]'));}if(_0x3b4441&&_0x3b4441[_0x65c3('0x46')]!==_0x65c3('0xcb')&&isNotNull(this[_0x65c3('0x1d')][_0x3b4441[_0x65c3('0xcf')]][_0x65c3('0x137')])){delete this[_0x65c3('0x25')][_0x55c065[_0x65c3('0xca')]];this[_0x65c3('0xcc')](this[_0x65c3('0x1d')][_0x3b4441['queue']]);this['voiceQueues'][_0x3b4441['queue']][_0x65c3('0xd0')]+=0x1;this[_0x65c3('0x1d')][_0x3b4441[_0x65c3('0xcf')]]['outboundAnswerAgiCallsDay']+=0x1;_0x2f1be1=new Hangup(_0x3b4441,_0x55c065);_0x2f1be1[_0x65c3('0x73')]=0x10;_0x2f1be1[_0x65c3('0x74')]=_0x65c3('0x138');_0x2f1be1[_0x65c3('0x119')]=_0x65c3('0x139');hopperUtils['createHistory'](_0x2f1be1)['catch'](loggerCatch(_0x65c3('0x13a')));hopperUtils[_0x65c3('0x136')](_0x2f1be1)[_0x65c3('0xab')](loggerCatch(_0x65c3('0x13b')));}if(_0x3b4441&&_0x3b4441['type']!=='ivr'&&!isNotNull(this[_0x65c3('0x1d')][_0x3b4441[_0x65c3('0xcf')]]['dialQueueProject'])){delete this[_0x65c3('0x25')][_0x55c065['uniqueid']];this[_0x65c3('0xcc')](this[_0x65c3('0x1d')][_0x3b4441[_0x65c3('0xcf')]]);this[_0x65c3('0x1d')][_0x3b4441[_0x65c3('0xcf')]][_0x65c3('0x13c')]+=0x1;_0x2f1be1=new Hangup(_0x3b4441,_0x55c065);_0x2f1be1['state']=0xc;_0x2f1be1['statedesc']=_0x55c065['cause-txt'];_0x2f1be1[_0x65c3('0x119')]=_0x65c3('0x13d');hopperUtils[_0x65c3('0xf5')](_0x2f1be1)[_0x65c3('0xab')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x65c3('0x136')](_0x2f1be1)[_0x65c3('0xab')](loggerCatch('[syncHangupIvr]'));}};Dialer['prototype'][_0x65c3('0x35')]=function(_0x1baa91){var _0x3e6675=this;if(!_0x3e6675[_0x65c3('0x2b')][_0x1baa91['name']]){_0x3e6675['queuesSummary'][_0x1baa91[_0x65c3('0x4d')]]={'running':![]};}else if(_0x3e6675[_0x65c3('0x2b')][_0x1baa91[_0x65c3('0x4d')]][_0x65c3('0x13e')]===!![]){return;}else if(_0x3e6675[_0x65c3('0x2b')][_0x1baa91[_0x65c3('0x4d')]][_0x65c3('0x13e')]===![]){_0x3e6675[_0x65c3('0x2b')][_0x1baa91[_0x65c3('0x4d')]][_0x65c3('0x13e')]=!![];}var _0x458f8a=_0x3e6675[_0x65c3('0x1d')][_0x1baa91['name']];var _0xa09ed3=_0x458f8a[_0x65c3('0x6e')]!==utils[_0x65c3('0x6f')]['INACTIVE'];var _0x89efb4=utils[_0x65c3('0x13f')](_0x458f8a);_0x458f8a[_0x65c3('0x140')]=utils[_0x65c3('0x141')](_0x458f8a,_0x3e6675[_0x65c3('0x20')]);Promise[_0x65c3('0xb7')]()[_0x65c3('0x42')](function(){if(_0x458f8a[_0x65c3('0x140')]===utils['CAMPAIGN_STATUS']['INACTIVE']){if(_0xa09ed3){clearPredictiveAttributes(_0x458f8a);_0x1baa91[_0x65c3('0x26')]=undefined;_0x1baa91['startProgressive']=undefined;}if(_0x458f8a[_0x65c3('0x140')]===utils[_0x65c3('0x6f')][_0x65c3('0x80')]){_0x1baa91[_0x65c3('0x142')]=0x0;_0x1baa91['paused']=0x0;_0x1baa91['inUse']=0x0;_0x1baa91[_0x65c3('0x143')]=0x0;_0x1baa91[_0x65c3('0x144')]=0x0;}}else if(_0x458f8a[_0x65c3('0x140')]===utils[_0x65c3('0x6f')][_0x65c3('0x145')]&&!_0x89efb4){return _0x3e6675[_0x65c3('0x9d')](_0x458f8a,!![])[_0x65c3('0x42')](function(){return _0x3e6675['ifTime'](_0x458f8a,![]);})[_0x65c3('0x42')](function(){return _0x3e6675[_0x65c3('0xbc')](_0x458f8a);})['catch'](function(_0x461935){loggerSyncQueueSummary['debug'](_0x65c3('0x146'),util[_0x65c3('0x4a')](_0x461935,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x458f8a);});}else{clearPredictiveAttributes(_0x458f8a);}})[_0x65c3('0x42')](function(){var _0x46b111=_0x1baa91[_0x65c3('0x147')](_0x458f8a);if(_0x46b111||_0x458f8a[_0x65c3('0x148')]){_0x458f8a[_0x65c3('0x148')]=![];_0x1baa91[_0x65c3('0x149')](_0x458f8a);Object[_0x65c3('0x14a')](_0x458f8a,_0x1baa91);emitOutboundVoiceQueueSummary(_0x1baa91);}_0x3e6675['queuesSummary'][_0x458f8a[_0x65c3('0x4d')]][_0x65c3('0x13e')]=![];})['catch'](function(_0x30b4a9){logger[_0x65c3('0x6a')](_0x65c3('0x146'),util[_0x65c3('0x4a')](_0x30b4a9,{'showHidden':![],'depth':null}));_0x3e6675[_0x65c3('0x2b')][_0x458f8a[_0x65c3('0x4d')]][_0x65c3('0x13e')]=![];});};Dialer[_0x65c3('0x8c')][_0x65c3('0x37')]=_[_0x65c3('0x14b')](function(){var _0x1ec474=_[_0x65c3('0x14c')](this['voiceQueues'],function(_0x3b32b3){return _0x3b32b3[_0x65c3('0x14d')];});var _0x53fbaa=_[_0x65c3('0x14c')](this[_0x65c3('0x1f')],function(_0x5b6862){return _0x5b6862[_0x65c3('0x14e')]&&_0x5b6862[_0x65c3('0x8f')]===_0x65c3('0x90');});if(_0x1ec474[_0x65c3('0xa4')]>0x0&&_0x53fbaa[_0x65c3('0xa4')]>0x0){return Promise[_0x65c3('0xb7')]()[_0x65c3('0x42')](cmHopper[_0x65c3('0x14f')](_[_0x65c3('0x150')](_0x1ec474,'id'),previewRecallmeReminderInterval,_[_0x65c3('0x150')](_0x53fbaa,'id')))['then'](function(_0x1d5f06){for(var _0x454ee8=0x0;_0x454ee8<_0x1d5f06['length'];_0x454ee8++){var _0x557d90=_0x1d5f06[_0x454ee8][_0x65c3('0x151')][_0x65c3('0x4d')];if(_0x557d90)io['to'](util[_0x65c3('0x4b')]('user:%s',_0x557d90))[_0x65c3('0x45')](_0x65c3('0x152'),{'hopper':_0x1d5f06[_0x454ee8]});}})[_0x65c3('0xab')](function(_0x165817){logger[_0x65c3('0x6a')]('checkPreviewRecallReminder',_0x165817);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x65c3('0x8c')]['loopClearZombieChannels']=function(){var _0x476f18=this;setInterval(function(){_0x476f18['clearZombieChannels'](_0x476f18[_0x65c3('0x25')],_0x65c3('0x153'));_0x476f18[_0x65c3('0x154')](_0x476f18['actions'],_0x65c3('0x155'));},0x32c8);};Dialer[_0x65c3('0x8c')][_0x65c3('0x154')]=function(_0x5b410e,_0x365709){var _0x2bc970=this;for(var _0x54314b in _0x5b410e){if(typeof _0x5b410e[_0x54314b]!==_0x65c3('0xb6')){this[_0x65c3('0x1c')][_0x65c3('0x1a')](function(){if(!_[_0x65c3('0x106')](_0x5b410e[_0x54314b])){return ami[_0x65c3('0xa9')]({'action':_0x65c3('0x8f'),'channel':_0x5b410e[_0x54314b][_0x65c3('0xf8')]})['catch'](function(_0x4505a3){if(_0x4505a3[_0x65c3('0x6e')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x5b410e[_0x54314b]&&_0x5b410e[_0x54314b][_0x65c3('0x46')]!==_0x65c3('0xcb')){_0x2bc970[_0x65c3('0xcc')](_0x2bc970['voiceQueues'][_0x5b410e[_0x54314b][_0x65c3('0xcf')]]);logger[_0x65c3('0x6a')](_0x65c3('0x156'),_0x365709,_0x54314b,_0x5b410e[_0x54314b][_0x65c3('0xcf')]);delete _0x5b410e[_0x54314b];}if(_0x5b410e[_0x54314b]&&_0x5b410e[_0x54314b]['type']===_0x65c3('0xcb')){_0x2bc970[_0x65c3('0xcc')](_0x2bc970[_0x65c3('0x1e')][_0x5b410e[_0x54314b][_0x65c3('0xcf')]]);logger[_0x65c3('0x6a')](_0x65c3('0x157'),_0x365709,_0x54314b,_0x5b410e[_0x54314b][_0x65c3('0xcf')]);delete _0x5b410e[_0x54314b];}},0x2328);}});}});}}};Dialer['prototype'][_0x65c3('0x158')]=function(_0x504ca4){return Promise['resolve']()[_0x65c3('0x42')](voiceQueueRt[_0x65c3('0x158')](_0x504ca4))[_0x65c3('0xab')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x65c3('0x8c')]['updateOriginated']=function(_0x3879da){if(!_[_0x65c3('0x44')](_0x3879da)&&_0x3879da!==null){if(typeof _0x3879da[_0x65c3('0x86')]!=='undefined'){if(_0x3879da['originated']>0x0){_0x3879da[_0x65c3('0x86')]-=0x1;}else{logger[_0x65c3('0x6a')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x65c3('0x6a')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x65c3('0x8c')][_0x65c3('0x159')]=function(_0x17de96,_0x72a0df){var _0x3b0fea=this;return function(_0x29f796){_0x3b0fea[_0x65c3('0xcc')](_0x72a0df);logger[_0x65c3('0x6a')](_0x17de96,util[_0x65c3('0x4a')](_0x29f796,{'showHidden':![],'depth':null}));};};Dialer[_0x65c3('0x8c')][_0x65c3('0x15a')]=function(_0x1c6635,_0x47daf7,_0x46f552){var _0x3493c2={'state':0x19,'statedesc':_0x65c3('0x15b')};this[_0x65c3('0xcc')](_0x47daf7);this[_0x65c3('0x11d')](_['merge'](_0x3493c2,_['pick'](_0x46f552,[_0x65c3('0xe7'),_0x65c3('0xe8'),'UserId',_0x65c3('0xe9'),_0x65c3('0xf3')])),_0x65c3('0x15c'),_0x65c3('0x15d'));logger[_0x65c3('0x6a')](_0x1c6635);};Dialer[_0x65c3('0x8c')][_0x65c3('0x11d')]=function(_0x1a83e1,_0x487be8,_0x26d974){hopperUtils[_0x65c3('0xf5')](_0x1a83e1)[_0x65c3('0xab')](loggerCatch(_0x487be8));hopperUtils[_0x65c3('0x136')](_0x1a83e1)[_0x65c3('0xab')](loggerCatch(_0x26d974));};Dialer['prototype']['queueCallerAbandonCreateState']=function(_0x169e53,_0x2ec0e7){hopperUtils[_0x65c3('0xf5')](_0x169e53)[_0x65c3('0xab')](loggerCatch(_0x65c3('0xd3')));if(_0x2ec0e7==0x0){hopperUtils[_0x65c3('0x136')](_0x169e53)[_0x65c3('0xab')](loggerCatch(_0x65c3('0x15e')));}};Dialer['prototype']['checkPreviewRecallReminder']=function(_0xdf447a){return Promise[_0x65c3('0xb7')]()[_0x65c3('0x42')](cmHopper[_0x65c3('0x14f')](_0xdf447a['id'],previewRecallmeReminderInterval))['then'](function(_0x957ab5){for(var _0xfc36df=0x0;_0xfc36df<_0x957ab5[_0x65c3('0xa4')];_0xfc36df++){var _0x1dae77=_0x957ab5[_0xfc36df][_0x65c3('0x151')][_0x65c3('0x4d')];if(_0x1dae77)io['to'](util[_0x65c3('0x4b')]('user:%s',_0x1dae77))['emit']('user:dialPreviewRecallReminder',{'hopper':_0x957ab5[_0xfc36df]});}})[_0x65c3('0xab')](function(){});};Dialer[_0x65c3('0x8c')][_0x65c3('0xba')]=function(_0x2c5aed){var _0x2ea2ce=this;return function(){_0x2ea2ce[_0x65c3('0x15f')](_0x2c5aed);};};Dialer[_0x65c3('0x8c')][_0x65c3('0x160')]=function(_0x4c27b4,_0x3237b7){var _0x556a5f=this;var _0x529d2c=uuid['v4']();this[_0x65c3('0x23')][_0x529d2c]=new Action(_0x4c27b4,_0x3237b7,_0x529d2c);return new Promise(function(_0x1487d9,_0x3ecbf2){if(_[_0x65c3('0x44')](_0x4c27b4)&&typeof _0x4c27b4!==_0x65c3('0x161')){return _0x3ecbf2(msgResponse(_0x65c3('0x162'),_0x65c3('0x9e'),_0x65c3('0x163')));}if(_[_0x65c3('0x44')](_0x3237b7[_0x65c3('0x164')])||_0x3237b7[_0x65c3('0x164')]===null){return _0x3ecbf2(msgResponse(_0x65c3('0x162'),_0x65c3('0x9e'),_0x65c3('0x165')));}var _0x29a91b={'XMD-CALLERID':_0x556a5f[_0x65c3('0x23')][_0x529d2c][_0x65c3('0x166')](),'XMD-AGI':_0x4c27b4[_0x65c3('0x137')]?util[_0x65c3('0x4b')](_0x65c3('0x167'),ipAgi,_0x4c27b4[_0x65c3('0x137')]):_0x65c3('0x168'),'XMD-AGIAFTER':_0x4c27b4[_0x65c3('0xdb')]?util[_0x65c3('0x4b')](_0x65c3('0x167'),ipAgi,_0x4c27b4['dialQueueProject2']):_0x65c3('0x168'),'XMD-QUEUE':utils[_0x65c3('0x169')](_0x4c27b4)?util['format']('\x22%s,%s%s,,,%s\x22',_0x4c27b4['name'],_0x4c27b4[_0x65c3('0x16a')]||'',_0x4c27b4[_0x65c3('0x16b')]?'c':'',_0x4c27b4[_0x65c3('0xd8')]||0x3):_0x65c3('0x168'),'XMD-CONTACTID':_0x3237b7[_0x65c3('0xe7')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x556a5f[_0x65c3('0x23')][_0x529d2c]['getCaller'](),'XMD-AMD':_0x4c27b4[_0x65c3('0x116')]?'ACTIVE':_0x65c3('0x168'),'XMD-DESTINATION':_0x65c3('0x115')};if(_0x4c27b4[_0x65c3('0x116')]){_0x29a91b[_0x65c3('0x16c')]=_0x4c27b4[_0x65c3('0x16d')]||0x9c4;_0x29a91b['XMD-AMDGREETING']=_0x4c27b4[_0x65c3('0x16e')]||0x5dc;_0x29a91b[_0x65c3('0x16f')]=_0x4c27b4['dialAMDAfterGreetingSilence']||0x320;_0x29a91b[_0x65c3('0x170')]=_0x4c27b4['dialAMDTotalAnalysisTime']||0x1388;_0x29a91b[_0x65c3('0x171')]=_0x4c27b4[_0x65c3('0x172')]||0x64;_0x29a91b[_0x65c3('0x173')]=_0x4c27b4[_0x65c3('0x174')]||0x32;_0x29a91b['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x4c27b4['dialAMDMaximumNumberOfWords']||0x3;_0x29a91b['XMD-AMDSILENCETHRESHOLD']=_0x4c27b4[_0x65c3('0x175')]||0x100;_0x29a91b[_0x65c3('0x176')]=_0x4c27b4[_0x65c3('0x177')]||0x1388;}if(utils[_0x65c3('0x169')](_0x4c27b4)){_0x29a91b['XMD-VOICEQUEUEID']=_0x3237b7[_0x65c3('0xe9')];}else{_0x29a91b[_0x65c3('0x178')]=_0x3237b7['CampaignId'];}for(var _0x4d8b4e in _0x3237b7[_0x65c3('0x179')]){if(typeof _0x3237b7[_0x65c3('0x179')][_0x4d8b4e]!=='undefined'){if(isNotNull(_0x3237b7[_0x65c3('0x179')][_0x4d8b4e])&&_0x4d8b4e!=='id'&&_0x4d8b4e!==_0x65c3('0x17a')&&_0x4d8b4e!==_0x65c3('0x17b')&&_0x4d8b4e!=='updatedAt'){_0x29a91b[util[_0x65c3('0x4b')](_0x65c3('0x17c'),_0x65c3('0x17d'),_[_0x65c3('0x17e')](_0x4d8b4e))]=_0x3237b7[_0x65c3('0x179')][_0x4d8b4e];}}}var _0x55a6c3=_0x556a5f[_0x65c3('0x8d')](_0x4c27b4['Trunk'])?utils['getCallerId'](_0x4c27b4[_0x65c3('0x94')][_0x65c3('0x17f')],_0x4c27b4[_0x65c3('0x180')],_0x4c27b4['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x65c3('0x181')](_0x4c27b4['dialOriginateCallerIdNumber'],_0x4c27b4[_0x65c3('0x182')]):_0x4c27b4[_0x65c3('0x183')]):utils[_0x65c3('0x184')](_[_0x65c3('0x106')](_0x4c27b4[_0x65c3('0x95')])?_0x4c27b4[_0x65c3('0x94')][_0x65c3('0x17f')]:_0x4c27b4[_0x65c3('0x95')][_0x65c3('0x17f')],_0x4c27b4['dialOriginateCallerIdName'],_0x4c27b4[_0x65c3('0x182')]>0x0?utils[_0x65c3('0x181')](_0x4c27b4[_0x65c3('0x183')],_0x4c27b4[_0x65c3('0x182')]):_0x4c27b4[_0x65c3('0x183')]);if(_0x55a6c3){_0x29a91b[_0x65c3('0x185')]=_0x556a5f[_0x65c3('0x23')][_0x529d2c][_0x65c3('0x186')]=utils[_0x65c3('0x187')](_0x55a6c3);_0x29a91b[_0x65c3('0x188')]=_0x3237b7[_0x65c3('0x164')];}_0x4c27b4[_0x65c3('0x189')]=_0x29a91b;return ami['Action']({'actionid':_0x529d2c,'action':_0x65c3('0x162'),'channel':_0x556a5f[_0x65c3('0x8d')](_0x4c27b4['Trunk'])?util[_0x65c3('0x4b')](_0x65c3('0x18a'),_0x4c27b4['Trunk'][_0x65c3('0x4d')],isNotNull(_0x4c27b4['dialPrefix'])?_0x4c27b4[_0x65c3('0x18b')][_0x65c3('0x18c')]()||'':'',_0x4c27b4[_0x65c3('0x18d')]>0x0?_0x3237b7[_0x65c3('0x164')]['substring'](_0x4c27b4[_0x65c3('0x18d')]):_0x3237b7[_0x65c3('0x164')]):util[_0x65c3('0x4b')](_0x65c3('0x18a'),_[_0x65c3('0x106')](_0x4c27b4['TrunkBackup'])?_0x4c27b4[_0x65c3('0x94')][_0x65c3('0x4d')]:_0x4c27b4[_0x65c3('0x95')][_0x65c3('0x4d')],isNotNull(_0x4c27b4[_0x65c3('0x18b')])?_0x4c27b4[_0x65c3('0x18b')][_0x65c3('0x18c')]()||'':'',_0x4c27b4[_0x65c3('0x18d')]>0x0?_0x3237b7['phone'][_0x65c3('0x18e')](_0x4c27b4[_0x65c3('0x18d')]):_0x3237b7[_0x65c3('0x164')]),'callerid':_0x55a6c3,'Exten':_0x65c3('0x115'),'Context':_0x65c3('0x18f'),'Priority':'1','variable':_0x29a91b,'timeout':(_0x4c27b4['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x529d2c})[_0x65c3('0x42')](function(_0x52a344){return _0x1487d9(_0x52a344);})['catch'](function(_0x2534bb){_0x4c27b4[_0x65c3('0x190')]+=0x1;var _0x1cc5f5=new History(_0x556a5f['actions'][_0x529d2c]);logger['error'](util[_0x65c3('0x4b')](_0x65c3('0x191'),JSON[_0x65c3('0x79')](_0x2534bb)));_0x1cc5f5[_0x65c3('0x73')]=0xe;_0x1cc5f5[_0x65c3('0x74')]=_0x65c3('0x192');_0x1cc5f5[_0x65c3('0x75')]=moment()[_0x65c3('0x4b')](_0x65c3('0xce'));_0x1cc5f5[_0x65c3('0xeb')]=_0x1cc5f5[_0x65c3('0x75')];hopperUtils[_0x65c3('0xf5')](_0x1cc5f5)['catch'](loggerCatch(_0x65c3('0x193')));_0x556a5f[_0x65c3('0x136')](_0x1cc5f5)[_0x65c3('0xab')](loggerCatch(_0x65c3('0x193')))[_0x65c3('0x104')](function(){delete _0x556a5f[_0x65c3('0x23')][_0x529d2c];return _0x3ecbf2(msgResponse(_0x65c3('0x162'),_0x65c3('0x8b'),_0x65c3('0x194')));});});});};Dialer['prototype'][_0x65c3('0x195')]=function(_0x18ca70,_0x4617d7,_0x443ee5){var _0x5700a9=new History(_0x4617d7);if(_0x5700a9['countbusyretry']+_0x5700a9['countcongestionretry']+_0x5700a9['countnoanswerretry']+_0x5700a9[_0x65c3('0x128')]+_0x5700a9['countdropretry']+_0x5700a9['countabandonedretry']+_0x5700a9[_0x65c3('0x122')]+_0x5700a9[_0x65c3('0x129')]>=_0x443ee5[_0x65c3('0x12a')]-0x1){return!![];}switch(_0x18ca70){case 0x3:if(_0x5700a9[_0x65c3('0x127')]>=_0x443ee5[_0x65c3('0x196')]-0x1){return!![];}hopperUtils[_0x65c3('0xe5')]({'active':![],'countnoanswerretry':_0x5700a9['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x65c3('0x130')](_0x443ee5[_0x65c3('0x197')],_0x65c3('0xe6'))['format'](_0x65c3('0xce')),'ContactId':_0x5700a9[_0x65c3('0xe7')],'ListId':_0x5700a9[_0x65c3('0xe8')],'VoiceQueueId':_0x5700a9[_0x65c3('0xe9')]||undefined,'CampaignId':_0x5700a9[_0x65c3('0xf3')]||undefined})[_0x65c3('0xab')](loggerCatch(_0x65c3('0x198')));break;case 0x5:if(_0x5700a9[_0x65c3('0x125')]>=_0x443ee5[_0x65c3('0x199')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x5700a9['countbusyretry']+=0x1,'scheduledat':moment()[_0x65c3('0x130')](_0x443ee5['dialBusyRetryFrequency'],_0x65c3('0xe6'))[_0x65c3('0x4b')](_0x65c3('0xce')),'ContactId':_0x5700a9[_0x65c3('0xe7')],'ListId':_0x5700a9[_0x65c3('0xe8')],'VoiceQueueId':_0x5700a9[_0x65c3('0xe9')]||undefined,'CampaignId':_0x5700a9[_0x65c3('0xf3')]||undefined})[_0x65c3('0xab')](loggerCatch(_0x65c3('0x19a')));break;case 0x8:if(_0x5700a9[_0x65c3('0x126')]>=_0x443ee5[_0x65c3('0x19b')]-0x1){return!![];}hopperUtils[_0x65c3('0xe5')]({'active':![],'countcongestionretry':_0x5700a9[_0x65c3('0x126')]+=0x1,'scheduledat':moment()['add'](_0x443ee5[_0x65c3('0x19c')],'minutes')[_0x65c3('0x4b')](_0x65c3('0xce')),'ContactId':_0x5700a9[_0x65c3('0xe7')],'ListId':_0x5700a9[_0x65c3('0xe8')],'VoiceQueueId':_0x5700a9[_0x65c3('0xe9')]||undefined,'CampaignId':_0x5700a9['CampaignId']||undefined})[_0x65c3('0xab')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x5700a9[_0x65c3('0x128')]>=_0x443ee5[_0x65c3('0x19d')]-0x1){return!![];}else{hopperUtils[_0x65c3('0xe5')]({'active':![],'countnosuchnumberretry':_0x5700a9[_0x65c3('0x128')]+=0x1,'scheduledat':moment()[_0x65c3('0x130')](_0x443ee5['dialNoSuchNumberRetryFrequency'],'minutes')[_0x65c3('0x4b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5700a9[_0x65c3('0xe7')],'ListId':_0x5700a9['ListId'],'VoiceQueueId':_0x5700a9[_0x65c3('0xe9')]||undefined,'CampaignId':_0x5700a9[_0x65c3('0xf3')]||undefined})[_0x65c3('0xab')](loggerCatch(_0x65c3('0x19e')));}break;case 0xa:if(_0x5700a9[_0x65c3('0xdc')]>=_0x443ee5['dialDropMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x5700a9[_0x65c3('0xdc')]+=0x1,'scheduledat':moment()[_0x65c3('0x130')](_0x443ee5['dialDropRetryFrequency'],'minutes')[_0x65c3('0x4b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5700a9['ContactId'],'ListId':_0x5700a9['ListId'],'VoiceQueueId':_0x5700a9[_0x65c3('0xe9')]||undefined,'CampaignId':_0x5700a9['CampaignId']||undefined})[_0x65c3('0xab')](loggerCatch(_0x65c3('0xea')));break;case 0xb:if(_0x5700a9[_0x65c3('0xf0')]>=_0x443ee5[_0x65c3('0xf1')]-0x1){return!![];}hopperUtils[_0x65c3('0xe5')]({'active':![],'countabandonedretry':_0x5700a9[_0x65c3('0xf0')]+=0x1,'scheduledat':moment()[_0x65c3('0x130')](_0x443ee5['dialAbandonedRetryFrequency'],_0x65c3('0xe6'))[_0x65c3('0x4b')](_0x65c3('0xce')),'ContactId':_0x5700a9[_0x65c3('0xe7')],'ListId':_0x5700a9[_0x65c3('0xe8')],'VoiceQueueId':_0x5700a9['VoiceQueueId']||undefined,'CampaignId':_0x5700a9[_0x65c3('0xf3')]||undefined})[_0x65c3('0xab')](loggerCatch(_0x65c3('0xf4')));break;case 0x13:if(_0x5700a9[_0x65c3('0x122')]>=_0x443ee5['dialMachineMaxRetry']-0x1){return!![];}hopperUtils[_0x65c3('0xe5')]({'active':![],'countmachineretry':_0x5700a9[_0x65c3('0x122')]+=0x1,'scheduledat':moment()['add'](_0x443ee5['dialMachineRetryFrequency'],_0x65c3('0xe6'))[_0x65c3('0x4b')](_0x65c3('0xce')),'ContactId':_0x5700a9[_0x65c3('0xe7')],'ListId':_0x5700a9[_0x65c3('0xe8')],'VoiceQueueId':_0x5700a9[_0x65c3('0xe9')]||undefined,'CampaignId':_0x5700a9[_0x65c3('0xf3')]||undefined})[_0x65c3('0xab')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x5700a9[_0x65c3('0x129')]>=_0x443ee5[_0x65c3('0x19f')]-0x1){return!![];}hopperUtils[_0x65c3('0xe5')]({'active':![],'countagentrejectretry':_0x5700a9[_0x65c3('0x129')]+=0x1,'scheduledat':moment()[_0x65c3('0x130')](_0x443ee5[_0x65c3('0x1a0')],_0x65c3('0xe6'))[_0x65c3('0x4b')](_0x65c3('0xce')),'ContactId':_0x5700a9[_0x65c3('0xe7')],'ListId':_0x5700a9[_0x65c3('0xe8')],'VoiceQueueId':_0x5700a9['VoiceQueueId']||undefined,'CampaignId':_0x5700a9[_0x65c3('0xf3')]||undefined})[_0x65c3('0xab')](loggerCatch(_0x65c3('0x1a1')));break;default:return!![];}};Dialer[_0x65c3('0x8c')][_0x65c3('0x1a2')]=function(_0x5660f5,_0x117c38,_0x1503d7){var _0x4ed34f=this;var _0x4d6dd6=new History(_0x5660f5);var _0x13440a=![];var _0x2d2e2a;var _0x26888e;return new Promise(function(_0x1cb3f4,_0x4e6bc3){if(_[_0x65c3('0x44')](_0x117c38)&&typeof _0x117c38!=='object'){return _0x4e6bc3(msgResponse(_0x65c3('0x1a3'),'Failure',_0x65c3('0x1a4')));}if(_[_0x65c3('0x44')](_0x1503d7)&&typeof _0x1503d7!==_0x65c3('0x161')){return _0x4e6bc3(msgResponse(_0x65c3('0x1a3'),'Failure','evt\x20is\x20undefine'));}hopperUtils[_0x65c3('0xe0')](_0x4d6dd6,_0x1503d7['reason'],_0x117c38)[_0x65c3('0x42')](function(_0x26815c){if(_0x26815c[_0x65c3('0xe2')]==0x1)_0x13440a=!![];switch(_0x1503d7['reason']){case'0':_0x117c38['outboundNoSuchCallsDay']+=0x1;_0x4d6dd6[_0x65c3('0x73')]=0x0;_0x4d6dd6['statedesc']=_0x65c3('0x1a5');_0x4d6dd6['countnosuchnumberretry']+=0x1;_0x4d6dd6[_0x65c3('0xdd')]+=0x1;ami[_0x65c3('0x45')](_0x65c3('0x1a6'),ut[_0x65c3('0x11c')](_0x5660f5,_0x65c3('0x1a7')));_0x2d2e2a=_0x117c38[_0x65c3('0x1a8')];_0x26888e=_0x117c38[_0x65c3('0xdf')];hopperUtils[_0x65c3('0xf5')](_0x4d6dd6)[_0x65c3('0xab')](loggerCatch(_0x65c3('0x124')));if(_0x4ed34f[_0x65c3('0x195')](0x0,_0x5660f5,_0x117c38)&&!_0x13440a){if(_0x4d6dd6[_0x65c3('0x128')]>=_0x117c38[_0x65c3('0x19d')]){_0x4ed34f['createStateFinal'](_0x4d6dd6,_0x1cb3f4,_0x4e6bc3,'reason\x200\x20no\x20such\x20number....');}else{_0x4ed34f[_0x65c3('0x12b')](_0x4d6dd6,_0x1cb3f4,_0x4e6bc3,_0x65c3('0x1a9'));}}break;case'3':_0x117c38[_0x65c3('0x1aa')]+=0x1;_0x4d6dd6[_0x65c3('0x73')]=0x3;_0x4d6dd6[_0x65c3('0x74')]='NoAnswer';_0x4d6dd6[_0x65c3('0x127')]+=0x1;_0x4d6dd6[_0x65c3('0xdd')]+=0x1;var _0xca4912=ut['buildNoAnswerEventPayload'](_0x5660f5,_0x117c38);ami[_0x65c3('0x45')](_0x65c3('0x1ab'),_0xca4912);_0x2d2e2a=_0x117c38['dialNoAnswerRetryFrequency'];_0x26888e=_0x117c38[_0x65c3('0xdf')];hopperUtils['createHistory'](_0x4d6dd6)[_0x65c3('0xab')](loggerCatch(_0x65c3('0x1ac')));if(_0x4ed34f[_0x65c3('0x195')](0x3,_0x5660f5,_0x117c38)&&!_0x13440a){if(_0x4d6dd6[_0x65c3('0x127')]>=_0x117c38[_0x65c3('0x196')]){_0x4ed34f[_0x65c3('0x12e')](_0x4d6dd6,_0x1cb3f4,_0x4e6bc3,'reason\x203\x20ringing\x20no\x20answer');}else{_0x4ed34f[_0x65c3('0x12b')](_0x4d6dd6,_0x1cb3f4,_0x4e6bc3,_0x65c3('0x1ad'));}}break;case'5':_0x117c38[_0x65c3('0x1ae')]+=0x1;_0x4d6dd6['state']=0x5;_0x4d6dd6[_0x65c3('0x74')]=_0x65c3('0x1af');_0x4d6dd6['countbusyretry']+=0x1;_0x4d6dd6[_0x65c3('0xdd')]+=0x1;ami[_0x65c3('0x45')]('custom:agentbusy',ut['buildObj'](_0x5660f5,'busy'));_0x2d2e2a=_0x117c38['dialBusyRetryFrequency'];_0x26888e=_0x117c38['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x4d6dd6)['catch'](loggerCatch(_0x65c3('0x1b0')));if(_0x4ed34f[_0x65c3('0x195')](0x5,_0x5660f5,_0x117c38)&&!_0x13440a){if(_0x4d6dd6[_0x65c3('0x125')]>=_0x117c38[_0x65c3('0x199')]){_0x4ed34f[_0x65c3('0x12e')](_0x4d6dd6,_0x1cb3f4,_0x4e6bc3,_0x65c3('0x1b1'));}else{_0x4ed34f[_0x65c3('0x12b')](_0x4d6dd6,_0x1cb3f4,_0x4e6bc3,_0x65c3('0x1b1'));}}break;case'8':_0x117c38['outboundCongestionCallsDay']+=0x1;_0x4d6dd6[_0x65c3('0x73')]=0x8;_0x4d6dd6[_0x65c3('0x74')]=_0x65c3('0x1b2');_0x4d6dd6[_0x65c3('0x126')]+=0x1;_0x4d6dd6['countglobal']+=0x1;_0x2d2e2a=_0x117c38[_0x65c3('0x19c')];_0x26888e=_0x117c38[_0x65c3('0xdf')];ami[_0x65c3('0x45')]('custom:agentcongestion',ut[_0x65c3('0x11c')](_0x5660f5,_0x65c3('0x1b3')));hopperUtils['createHistory'](_0x4d6dd6)['catch'](loggerCatch(_0x65c3('0x1b4')));if(_0x4ed34f[_0x65c3('0x195')](0x8,_0x5660f5,_0x117c38)&&!_0x13440a){if(_0x4d6dd6[_0x65c3('0x126')]>=_0x117c38['dialCongestionMaxRetry']){_0x4ed34f['createStateFinal'](_0x4d6dd6,_0x1cb3f4,_0x4e6bc3,_0x65c3('0x1b5'));}else{_0x4ed34f[_0x65c3('0x12b')](_0x4d6dd6,_0x1cb3f4,_0x4e6bc3,_0x65c3('0x1b5'));}}break;case'11':_0x117c38['outboundAbandonedCallsDay']+=0x1;_0x4d6dd6['state']=0xb;_0x4d6dd6[_0x65c3('0x74')]=_0x65c3('0xef');_0x4d6dd6[_0x65c3('0xf0')]+=0x1;_0x4d6dd6[_0x65c3('0xdd')]+=0x1;_0x2d2e2a=_0x117c38[_0x65c3('0xf2')];_0x26888e=_0x117c38['callAdditionalPhoneAfterMin'];hopperUtils[_0x65c3('0xf5')](_0x4d6dd6)[_0x65c3('0xab')](loggerCatch(_0x65c3('0xf6')));if(_0x4ed34f[_0x65c3('0x195')](0xb,_0x5660f5,_0x117c38)&&!_0x13440a){if(_0x4d6dd6['countabandonedretry']>=_0x117c38[_0x65c3('0xf1')]){_0x4ed34f[_0x65c3('0x12e')](_0x4d6dd6,_0x1cb3f4,_0x4e6bc3,_0x65c3('0x1b6'));}else{_0x4ed34f[_0x65c3('0x12b')](_0x4d6dd6,_0x1cb3f4,_0x4e6bc3,_0x65c3('0x1b6'));}}break;case'20':_0x117c38[_0x65c3('0x1b7')]+=0x1;_0x4d6dd6[_0x65c3('0x73')]=0x14;_0x4d6dd6[_0x65c3('0x74')]=_0x65c3('0x1b8');_0x4d6dd6['countagentrejectretry']+=0x1;_0x4d6dd6[_0x65c3('0xdd')]+=0x1;_0x2d2e2a=_0x117c38[_0x65c3('0x1a0')];_0x26888e=_0x117c38[_0x65c3('0xdf')];ami['emit'](_0x65c3('0x1b9'),ut[_0x65c3('0x11c')](_0x5660f5,_0x65c3('0x1ba')));hopperUtils['createHistory'](_0x4d6dd6)[_0x65c3('0xab')](loggerCatch(_0x65c3('0x1bb')));if(_0x4ed34f[_0x65c3('0x195')](0x14,_0x5660f5,_0x117c38)&&!_0x13440a){if(_0x4d6dd6[_0x65c3('0x129')]>=_0x117c38[_0x65c3('0x19f')]){_0x4ed34f[_0x65c3('0x12e')](_0x4d6dd6,_0x1cb3f4,_0x4e6bc3,_0x65c3('0x1bc'));}else{_0x4ed34f['stateGlobal'](_0x4d6dd6,_0x1cb3f4,_0x4e6bc3,_0x65c3('0x1bc'));}}break;default:_0x117c38[_0x65c3('0x13c')]+=0x1;_0x4d6dd6[_0x65c3('0x73')]=0xc;_0x4d6dd6['statedesc']=_0x1503d7[_0x65c3('0xd1')];_0x2d2e2a=_0x117c38[_0x65c3('0x1a0')];_0x26888e=_0x117c38[_0x65c3('0xdf')];hopperUtils[_0x65c3('0xf5')](_0x4d6dd6)[_0x65c3('0xab')](loggerCatch(_0x65c3('0x1bd')));if(_0x4ed34f['checkRetriveMax'](_0x1503d7[_0x65c3('0xd1')],_0x5660f5,_0x117c38)&&!_0x13440a){if(_0x4d6dd6[_0x65c3('0x125')]+_0x4d6dd6[_0x65c3('0x126')]+_0x4d6dd6[_0x65c3('0x127')]+_0x4d6dd6[_0x65c3('0x128')]+_0x4d6dd6[_0x65c3('0xdc')]+_0x4d6dd6[_0x65c3('0xf0')]+_0x4d6dd6[_0x65c3('0x122')]+_0x4d6dd6[_0x65c3('0x129')]>=_0x117c38['dialGlobalMaxRetry']){_0x4ed34f[_0x65c3('0x12b')](_0x4d6dd6,_0x1cb3f4,_0x4e6bc3,_0x1503d7[_0x65c3('0xd1')]);}else{_0x4ed34f[_0x65c3('0x12e')](_0x4d6dd6,_0x1cb3f4,_0x4e6bc3,_0x1503d7['reason']);}}}})[_0x65c3('0x42')](function(){if(_0x13440a){hopperUtils['swapAdditionalPhones'](_0x4d6dd6,_0x2d2e2a,_0x26888e)[_0x65c3('0x42')](function(){return _0x1cb3f4(0x1);});}});});};Dialer[_0x65c3('0x8c')][_0x65c3('0x12b')]=function(_0x4a2071,_0x373d0e,_0x78f4eb,_0x5ad0da){var _0x151477=new Final(_0x4a2071);_0x151477[_0x65c3('0x73')]=0xf;_0x151477[_0x65c3('0x74')]=_0x65c3('0x1be');this['createStateFinal'](_0x151477,_0x373d0e,_0x78f4eb,_0x5ad0da);};Dialer['prototype'][_0x65c3('0x12e')]=function(_0x34fc3a,_0x137e6e,_0x51e60b,_0x4c63a5){hopperUtils['moveContactManagedDialer'](_0x34fc3a)[_0x65c3('0x42')](function(){return _0x137e6e(msgResponse('[callProgressDetecting]',_0x65c3('0x111'),_0x4c63a5));})['catch'](function(){return _0x51e60b(msgResponse(_0x65c3('0x1bf'),_0x65c3('0x9e'),_0x65c3('0x1c0')));});};Dialer[_0x65c3('0x8c')][_0x65c3('0xa')]=function(_0xc6cbea){var _0x4d1b57=_0xc6cbea[_0x65c3('0x1c1')]/0x64;var _0x4e6def=_0xc6cbea[_0x65c3('0x1c2')]/(_0xc6cbea[_0x65c3('0x1c2')]+_0xc6cbea[_0x65c3('0xd0')]);var _0x127306=Math['round'](_0xc6cbea['predictiveIntervalAvailable']*(_0xc6cbea[_0x65c3('0x1c3')]/0x64));var _0x1c8fb9=Math[_0x65c3('0x1c4')](_0xc6cbea[_0x65c3('0x1c5')]*(_0xc6cbea[_0x65c3('0x1c6')]/0x64));var _0x379e93=_0xc6cbea[_0x65c3('0x142')]+_0xc6cbea[_0x65c3('0x143')];var _0x505352=Math[_0x65c3('0x1c7')](_0xc6cbea[_0x65c3('0x5f')]*_0xc6cbea[_0x65c3('0x62')]*_0xc6cbea['predictiveIntervalHitRate']*_0xc6cbea[_0x65c3('0x1c8')]);if(_['isUndefined'](_0xc6cbea[_0x65c3('0x27')])){if(!_['isUndefined'](_0xc6cbea['startPredictive'])){_0xc6cbea[_0x65c3('0x26')]=undefined;loggerPredictive[_0x65c3('0x6a')](_0x65c3('0x1c9'),_0x65c3('0x1ca'));}if(!_[_0x65c3('0x44')](_0xc6cbea['handlePredictive'])){loggerPredictive['error'](_0x65c3('0x1c9'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0xc6cbea['handlePredictive']);_0xc6cbea[_0x65c3('0x68')]=undefined;}_0xc6cbea['startProgressive']=moment()[_0x65c3('0x4b')](_0x65c3('0xce'));loggerPredictive[_0x65c3('0x53')](_0xc6cbea[_0x65c3('0x4d')],'collection\x20data\x20in\x20progressive\x20at',_0xc6cbea[_0x65c3('0x27')]);this['handlePower'](_0xc6cbea,0x1);}else if(ifInterval(_0xc6cbea['dialPredictiveInterval'],_0xc6cbea['startProgressive'])){this[_0x65c3('0xbf')](_0xc6cbea,0x1);loggerPredictiveCalls[_0x65c3('0x53')](_0x65c3('0x1cb'),_0xc6cbea[_0x65c3('0x27')],_0xc6cbea['name']);_0xc6cbea[_0x65c3('0x5f')]=0x0;_0xc6cbea[_0x65c3('0x1cc')]=0x0;}else if(_0x4d1b57<_0x4e6def&&_0xc6cbea['dialPredictiveOptimization']==='dropRate'){clearPredictiveAttributes(_0xc6cbea);loggerPredictive[_0x65c3('0x53')](_0x65c3('0x1cd'),_0x65c3('0x1ce'),_0x4e6def,_0x65c3('0x27'),_0xc6cbea['name']);}else if(_0x505352<_0xc6cbea[_0x65c3('0x1cc')]&&_0xc6cbea[_0x65c3('0x1cf')]===_0x65c3('0x1d0')){clearPredictiveAttributes(_0xc6cbea);loggerPredictive['info'](_0x65c3('0x1d1'),'Max\x20Drop\x20',_0x505352,_0x65c3('0x1d2'),_0xc6cbea[_0x65c3('0x1cc')],_0x65c3('0x27'),_0xc6cbea[_0x65c3('0x4d')]);}else if(!ifInterval(_0xc6cbea[_0x65c3('0x1d3')],_0xc6cbea['startProgressive'])&&_[_0x65c3('0x44')](_0xc6cbea[_0x65c3('0x26')])&&!_['isUndefined'](_0xc6cbea[_0x65c3('0x27')])){_0xc6cbea['startPredictive']=moment()[_0x65c3('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x65c3('0x53')](_0xc6cbea[_0x65c3('0x4d')],_0x65c3('0x1d4'),_0xc6cbea['startPredictive']);hopperUtils[_0x65c3('0x1d5')](_0xc6cbea[_0x65c3('0x1d3')])['then'](this[_0x65c3('0x1d6')](_0xc6cbea))[_0x65c3('0x42')](mergeDataErlangB(_0xc6cbea))[_0x65c3('0x42')](this[_0x65c3('0x1d7')](_0xc6cbea))[_0x65c3('0xab')](loggerCatchPredictive(_0x65c3('0x1d8'),_0xc6cbea));}else if(!ifInterval(_0xc6cbea[_0x65c3('0x1d3')],_0xc6cbea['startPredictive'])){_0xc6cbea['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0xc6cbea[_0x65c3('0x26')]=moment()[_0x65c3('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0xc6cbea[_0x65c3('0x4d')],_0x65c3('0x1d9'),_0xc6cbea['startPredictive']);clearInterval(_0xc6cbea[_0x65c3('0x68')]);_0xc6cbea[_0x65c3('0x68')]=undefined;hopperUtils[_0x65c3('0x1d5')](_0xc6cbea['dialPredictiveInterval'])['then'](this[_0x65c3('0x1d6')](_0xc6cbea))[_0x65c3('0x42')](mergeDataErlangB(_0xc6cbea))[_0x65c3('0x42')](this[_0x65c3('0x1d7')](_0xc6cbea))[_0x65c3('0xab')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0xc6cbea));}else if(_0xc6cbea[_0x65c3('0x1c5')]&&_0x379e93<_0xc6cbea['predictiveIntervalAvailable']-_0x1c8fb9){clearPredictiveAttributes(_0xc6cbea);loggerPredictive['info'](_0xc6cbea[_0x65c3('0x4d')],_0x65c3('0x1da'),_0x379e93,')\x20are\x20less\x20than\x20threshold\x20(',_0xc6cbea['predictiveIntervalAvailable'],'-',_0x1c8fb9,'=',_0xc6cbea[_0x65c3('0x1c5')]-_0x1c8fb9,')');}else if(_0xc6cbea[_0x65c3('0x1c5')]&&_0x379e93>_0xc6cbea[_0x65c3('0x1c5')]+_0x127306){clearPredictiveAttributes(_0xc6cbea);loggerPredictive['info'](_0xc6cbea[_0x65c3('0x4d')],_0x65c3('0x1da'),_0x379e93,_0x65c3('0x1db'),_0xc6cbea[_0x65c3('0x1c5')],'+',_0x127306,'=',_0xc6cbea[_0x65c3('0x1c5')]+_0x127306,')');}};Dialer['prototype']['getDataPredictive']=function(_0x6d08ac){var _0x5773fb=this;return function(_0x41218f){return new Promise(function(_0x4cba3d,_0x5607ec){_[_0x65c3('0x64')](_0x6d08ac,_0x41218f[0x0]);if(checkGetDataPredictive(_0x41218f[0x0])){var _0x3939c4=_0x6d08ac[_0x65c3('0x1c5')]=_0x6d08ac[_0x65c3('0x143')]+_0x6d08ac[_0x65c3('0x142')];var _0x2eb209=_0x6d08ac[_0x65c3('0x1d3')]*0x3c;var _0x3ff9c6=_0x41218f[0x0][_0x65c3('0x1dc')]+_0x41218f[0x0][_0x65c3('0x59')];var _0x4de2f8=(_0x41218f[0x0]['predictiveIntervalAnsweredCalls']+_0x41218f[0x0][_0x65c3('0x55')]+_0x41218f[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x41218f[0x0][_0x65c3('0x51')];_0x6d08ac[_0x65c3('0x1dd')]=_0x4de2f8>0x0?_0x4de2f8:0x1;switch(_0x6d08ac[_0x65c3('0x1cf')]){case _0x65c3('0x1d0'):var _0x310adc=_0x6d08ac[_0x65c3('0x1c1')]/0x64;return _0x5773fb[_0x65c3('0x1de')](_0x3939c4,_0x2eb209,_0x3ff9c6,_0x4de2f8,_0x310adc)[_0x65c3('0x42')](function(_0x41780f){return _0x4cba3d(_0x41780f);});case _0x65c3('0x1df'):var _0x5a9212=_0x6d08ac['dialPredictiveOptimizationPercentage']/0x64;return _0x5773fb[_0x65c3('0x1e0')](_0x3939c4,_0x2eb209,_0x3ff9c6,_0x4de2f8,_0x5a9212)[_0x65c3('0x42')](function(_0x32f920){return _0x4cba3d(_0x32f920);});default:return _0x5607ec(msgResponse(_0x65c3('0x1e1'),_0x65c3('0x9e'),_0x65c3('0x1e2')));}}else{return _0x5607ec(msgResponse('[getDataPredictive]',_0x65c3('0x9e'),_0x65c3('0x1e3')));}});};};Dialer[_0x65c3('0x8c')][_0x65c3('0x1e4')]=function(_0x34d4a2){var _0x4682e9=this;return function(_0x5e914f){return new Promise(function(_0x1f29c7,_0x4f22b1){_[_0x65c3('0x64')](_0x34d4a2,_0x5e914f[0x0]);if(checkGetDataPredictive(_0x5e914f[0x0])){loggerPredictive[_0x65c3('0x53')](JSON[_0x65c3('0x79')](_0x5e914f[0x0]));if(_0x34d4a2[_0x65c3('0x1cf')]===_0x65c3('0x1d0')){return _0x4682e9['getVoiceQueueRtPauses'](_0x34d4a2['id'])[_0x65c3('0x42')](function(_0x3b1866){var _0x134132=_0x34d4a2[_0x65c3('0x1e5')]-_0x3b1866[0x0][_0x65c3('0x1e6')];var _0xbc70aa=_0x34d4a2[_0x65c3('0x1d3')]*0x3c;var _0x2bebb3=_0x5e914f[0x0]['predictiveIntervalAvgTalktime']+_0x5e914f[0x0][_0x65c3('0x59')];var _0x5dac33=(_0x5e914f[0x0]['predictiveIntervalAnsweredCalls']+_0x5e914f[0x0][_0x65c3('0x55')]+_0x5e914f[0x0][_0x65c3('0x57')])/_0x5e914f[0x0][_0x65c3('0x51')];var _0x5ad964=_0x34d4a2[_0x65c3('0x1c1')]/0x64;_0x34d4a2['predictiveIntervalPauses']=_0x3b1866[0x0]['outboundQueuePauses']||0x0;_0x34d4a2[_0x65c3('0x1dd')]=_0x5dac33>0x0?_0x5dac33:0x1;return _0x4682e9['abandonmentRate'](_0x134132,_0xbc70aa,_0x2bebb3,_0x5dac33,_0x5ad964);})[_0x65c3('0x42')](function(_0x442a73){return _0x1f29c7(_0x442a73);})[_0x65c3('0xab')](function(_0x100c42){return _0x4f22b1(msgResponse(_0x65c3('0x1e7'),_0x65c3('0x9e'),JSON[_0x65c3('0x79')](_0x100c42)));});}if(_0x34d4a2['dialPredictiveOptimization']===_0x65c3('0x1df')){return _0x4682e9[_0x65c3('0x158')](_0x34d4a2['id'])[_0x65c3('0x42')](function(_0x1ce0cd){var _0x42547b=_0x34d4a2[_0x65c3('0x1e5')]-_0x1ce0cd[0x0][_0x65c3('0x1e6')];var _0x267e37=_0x34d4a2[_0x65c3('0x1d3')]*0x3c;var _0x6e0638=_0x5e914f[0x0][_0x65c3('0x1dc')]+_0x5e914f[0x0][_0x65c3('0x59')];var _0x334943=(_0x5e914f[0x0][_0x65c3('0x52')]+_0x5e914f[0x0][_0x65c3('0x55')]+_0x5e914f[0x0][_0x65c3('0x57')])/_0x5e914f[0x0][_0x65c3('0x51')];var _0x1aef9c=_0x34d4a2[_0x65c3('0x1c1')]/0x64;_0x34d4a2[_0x65c3('0x1e8')]=_0x1ce0cd[0x0][_0x65c3('0x1e6')]||0x0;_0x34d4a2[_0x65c3('0x1dd')]=_0x334943>0x0?_0x334943:0x1;return _0x4682e9[_0x65c3('0x1e0')](_0x42547b,_0x267e37,_0x6e0638,_0x334943,_0x1aef9c);})[_0x65c3('0x42')](function(_0xc1b77b){return _0x1f29c7(_0xc1b77b);})[_0x65c3('0xab')](function(_0x2a45c6){return _0x4f22b1(msgResponse(_0x65c3('0x1e7'),_0x65c3('0x9e'),JSON[_0x65c3('0x79')](_0x2a45c6)));});}}else{return _0x4f22b1(msgResponse(_0x65c3('0x1e1'),_0x65c3('0x9e'),_0x65c3('0x1e3')));}});};};Dialer[_0x65c3('0x8c')][_0x65c3('0x1d7')]=function(_0x5f578f){var _0x4d9fd4=this;return function(){var _0x50f39c=0x0;var _0x9b5182=Math[_0x65c3('0x1c7')](_0x5f578f[_0x65c3('0x61')]*0x3e8);if(_0x9b5182>0x0){_0x9b5182=_0x9b5182<0x64?0x64:_0x9b5182;loggerPredictive['info'](_0x5f578f['name'],'one\x20call\x20every:',_0x9b5182,_0x65c3('0x1e9'));_0x5f578f['handlePredictive']=setInterval(function(){_0x4d9fd4[_0x65c3('0x68')](_0x5f578f);loggerPredictiveCalls[_0x65c3('0x53')](_0x65c3('0x1ea'),_0x50f39c+=0x1);},_0x9b5182);}else{loggerPredictive['info'](_0x5f578f[_0x65c3('0x4d')],_0x65c3('0x1eb'));}};};Dialer['prototype'][_0x65c3('0x1ec')]=function(_0x1a5b69,_0x127741){var _0x22977a=this;return function(_0x50f845){if(_['isEmpty'](_0x50f845)){if(_['isNil'](_0x127741[_0x65c3('0x1ed')])||!_0x127741[_0x65c3('0x1ee')]){if(_0x1a5b69[_0x65c3('0xbd')]===_0x65c3('0x9')){_0x1a5b69[_0x65c3('0x76')]=_['isUndefined'](_0x1a5b69['queueStatusComplete'])?!![]:_0x1a5b69[_0x65c3('0x76')];var _0x3df31f=uuid['v4']();_0x22977a[_0x65c3('0x23')][_0x3df31f]=new Action(_0x1a5b69,_0x127741,_0x3df31f);loggerBooked['info']('[booked][checkContactBlack]',_0x3df31f,_0x65c3('0x1ef'),JSON[_0x65c3('0x79')](_0x1a5b69[_0x65c3('0x76')]),_0x65c3('0x1f0'),_0x1a5b69[_0x65c3('0x4d')]);if(_0x1a5b69[_0x65c3('0x76')]){_0x1a5b69[_0x65c3('0x76')]=![];_0x22977a[_0x65c3('0x29')][_0x22977a[_0x65c3('0x23')][_0x3df31f][_0x65c3('0xcf')]]=[];ami['Action']({'actionid':_0x3df31f,'action':_0x65c3('0x1f1'),'queue':_0x1a5b69[_0x65c3('0x4d')]})[_0x65c3('0xab')](function(){_0x22977a[_0x65c3('0xcc')](_0x1a5b69);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x22977a[_0x65c3('0x23')][_0x3df31f]['ContactId'],'ListId':_0x22977a[_0x65c3('0x23')][_0x3df31f][_0x65c3('0xe8')],'VoiceQueueId':_0x22977a['actions'][_0x3df31f][_0x65c3('0xe9')]||undefined,'CampaignId':_0x22977a['actions'][_0x3df31f][_0x65c3('0xf3')]||undefined})[_0x65c3('0xab')](loggerCatch(_0x65c3('0x1f2')));delete _0x22977a[_0x65c3('0x23')][_0x3df31f];});}else{loggerBooked['info'](_0x65c3('0x1f3'),JSON[_0x65c3('0x79')](_0x1a5b69['queueStatusComplete']),_0x65c3('0x1f0'),_0x1a5b69['name']);_0x22977a[_0x65c3('0xcc')](_0x1a5b69);hopperUtils[_0x65c3('0xe5')]({'active':![],'ContactId':_0x22977a[_0x65c3('0x23')][_0x3df31f][_0x65c3('0xe7')],'ListId':_0x22977a[_0x65c3('0x23')][_0x3df31f][_0x65c3('0xe8')],'VoiceQueueId':_0x22977a[_0x65c3('0x23')][_0x3df31f][_0x65c3('0xe9')]||undefined,'CampaignId':_0x22977a[_0x65c3('0x23')][_0x3df31f][_0x65c3('0xf3')]||undefined})[_0x65c3('0xab')](loggerCatch(_0x65c3('0x1f2')));delete _0x22977a[_0x65c3('0x23')][_0x3df31f];}}else{return _0x22977a[_0x65c3('0x160')](_0x1a5b69,_0x127741);}}else{if(utils[_0x65c3('0x65')](undefined,_0x127741['scheduledat'])<_0x1a5b69['dialRecallMeTimeout']*0x3c){if(_0x127741[_0x65c3('0x151')]&&!_0x127741[_0x65c3('0x151')][_0x65c3('0x1f4')]){_0x22977a[_0x65c3('0x101')][_0x65c3('0x102')](_0x127741['id'])['finally'](function(){_0x22977a[_0x65c3('0xcc')](_0x1a5b69);});}else{hopperUtils[_0x65c3('0x1f5')]({'active':![]},_0x127741['id'],0x1)[_0x65c3('0x104')](function(){_0x22977a[_0x65c3('0xcc')](_0x1a5b69);});}}else{_0x1a5b69[_0x65c3('0x1f6')]+=0x1;_0x22977a[_0x65c3('0xcc')](_0x1a5b69);if(_0x1a5b69[_0x65c3('0x1f7')]){hopperUtils[_0x65c3('0xe5')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x127741[_0x65c3('0xe7')],'ListId':_0x127741[_0x65c3('0xe8')],'VoiceQueueId':_0x127741[_0x65c3('0xe9')]||undefined,'CampaignId':_0x127741[_0x65c3('0xf3')]||undefined})[_0x65c3('0xab')](loggerCatch(_0x65c3('0x1f8')));hopperUtils[_0x65c3('0xf5')](createObjHistory(_0x1a5b69,_0x127741,utils[_0x65c3('0x6f')][_0x65c3('0x1f9')],0x17,'RecallInQueue'))['catch'](loggerCatch(_0x65c3('0x1fa')));}else{_0x22977a[_0x65c3('0x11d')](createObjHistory(_0x1a5b69,_0x127741,utils[_0x65c3('0x6f')][_0x65c3('0x1fb')],0x16,_0x65c3('0x1fc')),_0x65c3('0x1fd'),_0x65c3('0x1fe'));}}}}else{_0x1a5b69[_0x65c3('0x1ff')]+=0x1;_0x22977a['saveInDb'](createObjHistory(_0x1a5b69,_0x127741,utils['CAMPAIGN_STATUS'][_0x65c3('0x200')],0xd,_0x65c3('0x201')),_0x65c3('0x202'),_0x65c3('0x203'));throw _0x65c3('0x204');}};};Dialer[_0x65c3('0x8c')][_0x65c3('0x15f')]=function(_0x4a1237){var _0x35fad1=this;var _0x1cf64e=_0x4a1237[_0x65c3('0x205')]-_0x4a1237[_0x65c3('0x86')]-_0x4a1237[_0x65c3('0x206')];emitCampaignSummary(_0x4a1237);if(_0x1cf64e>0x0){if(_0x1cf64e>this['maxNumberOriginate']){_0x1cf64e=this[_0x65c3('0x21')];}_0x4a1237[_0x65c3('0x206')]+=_0x1cf64e;hopperUtils['getContactDialerIvr'](_0x4a1237['id'],_0x1cf64e,_0x4a1237[_0x65c3('0x207')],_0x4a1237)[_0x65c3('0x42')](function(_0xabd59d){_0x4a1237['temp']-=_0x1cf64e;_0x4a1237[_0x65c3('0x206')]=_0x4a1237['temp']>0x0?_0x4a1237['temp']:0x0;if(!utils[_0x65c3('0x208')](_0xabd59d)){_0x4a1237[_0x65c3('0x6e')]=utils['CAMPAIGN_STATUS'][_0x65c3('0x71')];logger[_0x65c3('0x53')](_0x65c3('0x209')+_0x4a1237['name']);}else{_0x4a1237['originated']+=_0xabd59d[_0x65c3('0xa4')];_0x4a1237[_0x65c3('0x6e')]=utils[_0x65c3('0x6f')][_0x65c3('0x20a')];for(var _0x8c827d=0x0;_0x8c827d<_0xabd59d[_0x65c3('0xa4')];_0x8c827d+=0x1){_0x4a1237[_0x65c3('0x20b')]+=0x1;if(_[_0x65c3('0x106')](_0xabd59d[_0x8c827d])||_[_0x65c3('0x106')](_0xabd59d[_0x8c827d][_0x65c3('0x179')])||_[_0x65c3('0x106')](_0xabd59d[_0x8c827d]['phone'])){_0x35fad1['emptyContact'](_0x65c3('0x20c'),_0x4a1237,_0xabd59d[_0x8c827d]);}else{hopperUtils['checkIsBlackListIvr'](_[_0x65c3('0x7a')](_0xabd59d[_0x8c827d],[_0x65c3('0xf3'),_0x65c3('0x164')]))['then'](_0x35fad1[_0x65c3('0x1ec')](_0x4a1237,_0xabd59d[_0x8c827d]))[_0x65c3('0xab')](_0x35fad1[_0x65c3('0x159')](_0x65c3('0x20d'),_0x4a1237));}}}})[_0x65c3('0xab')](loggerGetContactDialer(_0x65c3('0x20e'),_0x4a1237,_0x1cf64e));}};Dialer[_0x65c3('0x8c')]['handlePower']=function(_0x4899be,_0x246bc5){var _0x3b0d3a=this;var _0x3b225a=[];if(_0x246bc5<0x1||_0x4899be[_0x65c3('0xbd')]===_0x65c3('0x9')){_0x246bc5=0x1;}var _0x2b93da=Math[_0x65c3('0x1c7')](_0x4899be[_0x65c3('0x142')]*_0x246bc5)-_0x4899be[_0x65c3('0x86')]-_0x4899be[_0x65c3('0x206')];if(_0x4899be[_0x65c3('0x20f')]>0x0){var _0x4a816c=_0x4899be['dialLimitQueue']-_0x4899be['originated']-_0x4899be[_0x65c3('0x143')]-_0x4899be['temp']-_0x4899be[_0x65c3('0x144')];if(_0x2b93da>_0x4a816c){_0x2b93da=_0x4a816c;}}if(_0x2b93da>0x0){if(_0x4899be[_0x65c3('0xbd')]===_0x65c3('0x9')){_0x2b93da=0x1;}if(_0x2b93da>this[_0x65c3('0x21')]){_0x2b93da=this[_0x65c3('0x21')];}_0x4899be['temp']+=_0x2b93da;for(var _0x4d21ed in this[_0x65c3('0x1f')]){if(typeof this[_0x65c3('0x1f')][_0x4d21ed]!=='undefined'){if(this['agents'][_0x4d21ed][_0x65c3('0x73')]===_0x65c3('0x210')&&this[_0x65c3('0x1f')][_0x4d21ed][_0x65c3('0x8f')]===_0x65c3('0x90')){_0x3b225a[_0x65c3('0xa5')](this['agents'][_0x4d21ed]['id']);}}}hopperUtils[_0x65c3('0x211')](_0x4899be,_0x3b225a,_0x2b93da)['then'](function(_0x369522){_0x4899be[_0x65c3('0x206')]-=_0x2b93da;_0x4899be[_0x65c3('0x206')]=_0x4899be['temp']>0x0?_0x4899be[_0x65c3('0x206')]:0x0;if(!utils[_0x65c3('0x208')](_0x369522)){hopperUtils['countReScheduled'](_0x4899be)['then'](sendMessageReschedule(_0x4899be))[_0x65c3('0xab')](loggerCatch(_0x65c3('0x212')));}else{_0x4899be[_0x65c3('0x86')]+=_0x369522['length'];_0x4899be['message']=_0x4899be['dialMethod']===_0x65c3('0x9')?utils[_0x65c3('0x6f')]['ACTIVE']:utils[_0x65c3('0x6f')]['RUNNING'];for(var _0x2b3c2a=0x0;_0x2b3c2a<_0x369522[_0x65c3('0xa4')];_0x2b3c2a+=0x1){if(_[_0x65c3('0x106')](_0x369522[_0x2b3c2a])||_[_0x65c3('0x106')](_0x369522[_0x2b3c2a][_0x65c3('0x179')])||_[_0x65c3('0x106')](_0x369522[_0x2b3c2a][_0x65c3('0x164')])){_0x3b0d3a[_0x65c3('0x15a')](_0x65c3('0x20c'),_0x4899be,_0x369522[_0x2b3c2a]);}else{hopperUtils['checkIsBlackList'](_[_0x65c3('0x7a')](_0x369522[_0x2b3c2a],[_0x65c3('0xe9'),_0x65c3('0x164')]))[_0x65c3('0x42')](_0x3b0d3a['checkContactBlack'](_0x4899be,_0x369522[_0x2b3c2a]))['catch'](_0x3b0d3a[_0x65c3('0x159')](_0x65c3('0x20c'),_0x4899be));}}}})['catch'](loggerGetContactDialer(_0x65c3('0x213'),_0x4899be,_0x2b93da));}};Dialer[_0x65c3('0x8c')]['handlePredictive']=function(_0x543794){if(_0x543794[_0x65c3('0x20f')]>0x0){var _0x339e81=_0x543794['dialLimitQueue']-_0x543794[_0x65c3('0x86')]-_0x543794[_0x65c3('0x143')];if(_0x339e81>0x0){this['tryOriginatePredictive'](_0x543794);}else{loggerPredictiveCalls[_0x65c3('0x53')]('[handlePredictive][limitChannel]');}}else{this[_0x65c3('0x214')](_0x543794);}};Dialer[_0x65c3('0x8c')][_0x65c3('0x214')]=function(_0x25e8e1){var _0x4d6eb8=this;var _0x435ab2=[];_0x25e8e1[_0x65c3('0x86')]+=0x1;for(var _0x1d76b8 in this[_0x65c3('0x1f')]){if(typeof this['agents'][_0x1d76b8]!=='undefined'){if(this[_0x65c3('0x1f')][_0x1d76b8][_0x65c3('0x73')]===_0x65c3('0x210')&&this[_0x65c3('0x1f')][_0x1d76b8][_0x65c3('0x8f')]===_0x65c3('0x90')){_0x435ab2[_0x65c3('0xa5')](this[_0x65c3('0x1f')][_0x1d76b8]['id']);}}}return this['getContactDialer'](_0x25e8e1['id'],_0x435ab2,0x1,_0x25e8e1[_0x65c3('0x207')],_0x25e8e1)[_0x65c3('0x42')](function(_0x58da37){if(!utils[_0x65c3('0x208')](_0x58da37)){utils['checkContactLowerLimitOriginate'](_0x25e8e1,0x1,0x0);return hopperUtils['countReScheduled'](_0x25e8e1)[_0x65c3('0x42')](sendMessageReschedule(_0x25e8e1))[_0x65c3('0xab')](loggerCatch(_0x65c3('0x212')));}else{_0x25e8e1['message']=utils[_0x65c3('0x6f')][_0x65c3('0x20a')];if(_[_0x65c3('0x106')](_0x58da37[0x0])||_[_0x65c3('0x106')](_0x58da37[0x0][_0x65c3('0x179')])||_['isNil'](_0x58da37[0x0]['phone'])){_0x4d6eb8[_0x65c3('0x15a')]('[actionOriginate]\x20',_0x25e8e1,_0x58da37[0x0]);}else{return hopperUtils['checkIsBlackList'](_['pick'](_0x58da37[0x0],['VoiceQueueId',_0x65c3('0x164')]))[_0x65c3('0x42')](_0x4d6eb8['checkContactBlack'](_0x25e8e1,_0x58da37[0x0]))[_0x65c3('0xab')](_0x4d6eb8[_0x65c3('0x159')](_0x65c3('0x215'),_0x25e8e1));}}})[_0x65c3('0xab')](loggerGetContactDialer(_0x65c3('0x216'),_0x25e8e1,0x1));};Dialer[_0x65c3('0x8c')][_0x65c3('0x1de')]=function(_0x4ae231,_0x7e2adc,_0x27a062,_0x26aa79,_0x3d18cc,_0x56e5c2){loggerPredictive['info']('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x65c3('0x53')]('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',_0x4ae231);loggerPredictive[_0x65c3('0x53')](_0x65c3('0x217'),_0x7e2adc);loggerPredictive[_0x65c3('0x53')](_0x65c3('0x218'),_0x27a062);loggerPredictive['info']('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x26aa79);loggerPredictive[_0x65c3('0x53')](_0x65c3('0x219'),_0x3d18cc);loggerPredictive['info'](_0x65c3('0x5b'));return new Promise(function(_0x118b66,_0x1c16a2){if(_0x4ae231<=0x0||isNaN(_0x4ae231)){return _0x1c16a2(msgResponse('[abandonmentRate]',_0x65c3('0x8b'),_0x65c3('0x21a')+_0x4ae231));}if(_0x27a062<=0x0||isNaN(_0x27a062)){return _0x1c16a2(msgResponse('[abandonmentRate]','Error',_0x65c3('0x21b')+_0x27a062));}if(_0x26aa79<=0x0||isNaN(_0x26aa79)){return _0x1c16a2(msgResponse('[abandonmentRate]','Error',_0x65c3('0x21c')+_0x26aa79));}if(_0x7e2adc<=0x0||isNaN(_0x7e2adc)){return _0x1c16a2(msgResponse(_0x65c3('0x21d'),_0x65c3('0x8b'),'interval\x20=\x20'+_0x7e2adc));}if(_0x3d18cc<=0x0||isNaN(_0x3d18cc)){return _0x1c16a2(msgResponse(_0x65c3('0x21d'),_0x65c3('0x8b'),_0x65c3('0x21e')+_0x3d18cc));}_0x56e5c2=_0x56e5c2||0x0;var _0x22d971=0x1/_0x27a062;var _0x3214b4=0x0;var _0x261c5d=0x0;var _0x24cced=0x0;var _0x3f8f04=0x0;for(var _0x3963ee=0x0;_0x24cced<_0x3d18cc;_0x3963ee+=0x1){_0x261c5d=_0x3963ee/_0x7e2adc;_0x3214b4=(_0x26aa79*_0x261c5d+_0x56e5c2)/_0x22d971;_0x24cced=utils[_0x65c3('0x21f')](_0x3214b4,_0x4ae231);_0x3f8f04=_0x3214b4/_0x4ae231*(0x1-utils[_0x65c3('0x21f')](_0x3214b4,_0x4ae231));}return _0x118b66({'erlangCalls':_0x3963ee,'erlangCallToSecond':_0x7e2adc/_0x3963ee,'erlangAbandonmentRate':_0x24cced,'erlangBusyFactor':_0x3f8f04});});};Dialer[_0x65c3('0x8c')]['busyFactor']=function(_0x4523d0,_0x1ab234,_0x46db78,_0x45bc1a,_0x5ad544,_0x396dd6){loggerPredictive[_0x65c3('0x53')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x65c3('0x53')](_0x65c3('0x220'),_0x4523d0);loggerPredictive[_0x65c3('0x53')](_0x65c3('0x217'),_0x1ab234);loggerPredictive[_0x65c3('0x53')](_0x65c3('0x218'),_0x46db78);loggerPredictive[_0x65c3('0x53')]('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',_0x45bc1a);loggerPredictive['info'](_0x65c3('0x221'),_0x5ad544);loggerPredictive[_0x65c3('0x53')]('---------------------------');return new Promise(function(_0x12b2da,_0x203d03){if(_0x4523d0<=0x0||isNaN(_0x4523d0)){return _0x203d03(msgResponse(_0x65c3('0x222'),_0x65c3('0x8b'),'m\x20=\x20'+_0x4523d0));}if(_0x46db78<=0x0||isNaN(_0x46db78)){return _0x203d03(msgResponse('[busyFactor]',_0x65c3('0x8b'),'Ts\x20=\x20'+_0x46db78));}if(_0x45bc1a<=0x0||isNaN(_0x45bc1a)){return _0x203d03(msgResponse(_0x65c3('0x222'),_0x65c3('0x8b'),_0x65c3('0x21c')+_0x45bc1a));}if(_0x1ab234<=0x0||isNaN(_0x1ab234)){return _0x203d03(msgResponse(_0x65c3('0x222'),'Error',_0x65c3('0x223')+_0x1ab234));}if(_0x5ad544<=0x0||isNaN(_0x5ad544)){return _0x203d03(msgResponse(_0x65c3('0x222'),_0x65c3('0x8b'),_0x65c3('0x224')+_0x5ad544));}_0x396dd6=_0x396dd6||0x0;var _0x2f1b37=0x1/_0x46db78;var _0x9dd2b5=0x0;var _0x505d05=0x0;var _0x3e91a3=0x0;var _0xbb032=0x0;for(var _0x1424ac=0x0;_0xbb032<_0x5ad544;_0x1424ac+=0x1){_0x505d05=_0x1424ac/_0x1ab234;_0x9dd2b5=(_0x45bc1a*_0x505d05+_0x396dd6)/_0x2f1b37;_0x3e91a3=utils[_0x65c3('0x21f')](_0x9dd2b5,_0x4523d0);_0xbb032=_0x9dd2b5/_0x4523d0*(0x1-utils['erlangb'](_0x9dd2b5,_0x4523d0));}return _0x12b2da({'erlangCalls':_0x1424ac,'erlangCallToSecond':_0x1ab234/_0x1424ac,'erlangAbandonmentRate':_0x3e91a3,'erlangBusyFactor':_0xbb032});});};module[_0x65c3('0x225')]=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 442c20d..6697c40 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 _0x0672=['UserId','VoiceQueueId','CampaignId','firstName','starttime','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','dialCutDigit','getQueue','exports','moment','isNil','string','voiceQueue','uniqueid','Contact','lastName','number','phone','name','active','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId'];(function(_0x1edd1c,_0x44f430){var _0x16dde7=function(_0xe6adfd){while(--_0xe6adfd){_0x1edd1c['push'](_0x1edd1c['shift']());}};_0x16dde7(++_0x44f430);}(_0x0672,0x101));var _0x2067=function(_0x163f58,_0x1c8ae4){_0x163f58=_0x163f58-0x0;var _0x472ed9=_0x0672[_0x163f58];return _0x472ed9;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x2067('0x0'));function checkNameSurname(_0x5ef8f4,_0x206c1e,_0x706ac7){var _0x354719='';if(!_[_0x2067('0x1')](_0x206c1e)&&_0x2067('0x2')===typeof _0x206c1e){_0x354719+=_0x206c1e;}if(!_[_0x2067('0x1')](_0x706ac7)&&_0x2067('0x2')===typeof _0x706ac7){_0x354719+='\x20'+_0x706ac7;}if(_0x354719!==''){return _0x354719;}return _0x5ef8f4;}function Action(_0x71429a,_0xa4bcba,_0x47328d){this[_0x2067('0x3')]=_0x71429a;this[_0x2067('0x4')]=_0x47328d||undefined;this['name']=checkNameSurname(_0xa4bcba[_0x2067('0x5')]['phone'],_0xa4bcba[_0x2067('0x5')]['firstName'],_0xa4bcba[_0x2067('0x5')][_0x2067('0x6')]);this[_0x2067('0x7')]=_0xa4bcba[_0x2067('0x8')];this['queue']=_0x71429a[_0x2067('0x9')];this[_0x2067('0xa')]=_0xa4bcba[_0x2067('0xa')]||![];this['type']=_0x71429a['type'];this[_0x2067('0xb')]=_0x71429a[_0x2067('0xb')]||0x3;this[_0x2067('0xc')]=_0xa4bcba[_0x2067('0xc')];this[_0x2067('0xd')]=_0xa4bcba[_0x2067('0xd')];this['countcongestionretry']=_0xa4bcba[_0x2067('0xe')];this['countnoanswerretry']=_0xa4bcba[_0x2067('0xf')];this[_0x2067('0x10')]=_0xa4bcba[_0x2067('0x10')];this[_0x2067('0x11')]=_0xa4bcba[_0x2067('0x11')];this[_0x2067('0x12')]=_0xa4bcba[_0x2067('0x12')];this['countmachineretry']=_0xa4bcba[_0x2067('0x13')];this[_0x2067('0x14')]=_0xa4bcba['countagentrejectretry'];this['ContactId']=_0xa4bcba[_0x2067('0x15')];this[_0x2067('0x16')]=_0xa4bcba[_0x2067('0x16')];this[_0x2067('0x17')]=_0xa4bcba['UserId'];this[_0x2067('0x18')]=_0xa4bcba['VoiceQueueId'];this[_0x2067('0x19')]=_0xa4bcba[_0x2067('0x19')];this['idHopper']=_0xa4bcba['id'];this['ContactFirstName']=_0xa4bcba[_0x2067('0x5')][_0x2067('0x1a')]||'';this[_0x2067('0x1b')]=moment()[_0x2067('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x2067('0x1d')]=_0xa4bcba[_0x2067('0x1d')];this['callbackuniqueid']=_0xa4bcba[_0x2067('0x1e')];this[_0x2067('0x1f')]=_0xa4bcba[_0x2067('0x1f')];this[_0x2067('0x20')]=_0xa4bcba[_0x2067('0x20')];this[_0x2067('0x21')]='';this[_0x2067('0x22')]='';}Action[_0x2067('0x23')][_0x2067('0x24')]=function(){return util['format']('\x22%s\x22\x20<%s>',this[_0x2067('0x9')],this[_0x2067('0x3')][_0x2067('0x25')]>0x0?this['number']['substring'](this[_0x2067('0x3')][_0x2067('0x25')]):this[_0x2067('0x7')]);};Action[_0x2067('0x23')][_0x2067('0x26')]=function(){return this['queue'];};module[_0x2067('0x27')]=Action; \ No newline at end of file +var _0xe339=['getCaller','format','dialCutDigit','getQueue','lodash','moment','isNil','string','voiceQueue','uniqueid','name','phone','Contact','firstName','lastName','number','queue','active','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','prototype'];(function(_0x49ef4d,_0xba2429){var _0x4e4a5a=function(_0x5eae56){while(--_0x5eae56){_0x49ef4d['push'](_0x49ef4d['shift']());}};_0x4e4a5a(++_0xba2429);}(_0xe339,0x154));var _0x9e33=function(_0x220fa9,_0x4255fb){_0x220fa9=_0x220fa9-0x0;var _0x518ed5=_0xe339[_0x220fa9];return _0x518ed5;};'use strict';var util=require('util');var _=require(_0x9e33('0x0'));var moment=require(_0x9e33('0x1'));function checkNameSurname(_0x1aadab,_0xea9d06,_0x5a9183){var _0x34aa20='';if(!_[_0x9e33('0x2')](_0xea9d06)&&_0x9e33('0x3')===typeof _0xea9d06){_0x34aa20+=_0xea9d06;}if(!_[_0x9e33('0x2')](_0x5a9183)&&_0x9e33('0x3')===typeof _0x5a9183){_0x34aa20+='\x20'+_0x5a9183;}if(_0x34aa20!==''){return _0x34aa20;}return _0x1aadab;}function Action(_0x137af0,_0x58fd63,_0x7c40e9){this[_0x9e33('0x4')]=_0x137af0;this[_0x9e33('0x5')]=_0x7c40e9||undefined;this[_0x9e33('0x6')]=checkNameSurname(_0x58fd63['Contact'][_0x9e33('0x7')],_0x58fd63[_0x9e33('0x8')][_0x9e33('0x9')],_0x58fd63['Contact'][_0x9e33('0xa')]);this[_0x9e33('0xb')]=_0x58fd63['phone'];this[_0x9e33('0xc')]=_0x137af0[_0x9e33('0x6')];this[_0x9e33('0xd')]=_0x58fd63[_0x9e33('0xd')]||![];this['type']=_0x137af0['type'];this[_0x9e33('0xe')]=_0x137af0[_0x9e33('0xe')]||0x3;this[_0x9e33('0xf')]=_0x58fd63[_0x9e33('0xf')];this[_0x9e33('0x10')]=_0x58fd63[_0x9e33('0x10')];this[_0x9e33('0x11')]=_0x58fd63['countcongestionretry'];this[_0x9e33('0x12')]=_0x58fd63['countnoanswerretry'];this[_0x9e33('0x13')]=_0x58fd63[_0x9e33('0x13')];this['countdropretry']=_0x58fd63['countdropretry'];this[_0x9e33('0x14')]=_0x58fd63[_0x9e33('0x14')];this[_0x9e33('0x15')]=_0x58fd63[_0x9e33('0x15')];this['countagentrejectretry']=_0x58fd63[_0x9e33('0x16')];this['ContactId']=_0x58fd63[_0x9e33('0x17')];this['ListId']=_0x58fd63[_0x9e33('0x18')];this[_0x9e33('0x19')]=_0x58fd63[_0x9e33('0x19')];this[_0x9e33('0x1a')]=_0x58fd63['VoiceQueueId'];this['CampaignId']=_0x58fd63[_0x9e33('0x1b')];this[_0x9e33('0x1c')]=_0x58fd63['id'];this[_0x9e33('0x1d')]=_0x58fd63[_0x9e33('0x8')][_0x9e33('0x9')]||'';this[_0x9e33('0x1e')]=moment()['format'](_0x9e33('0x1f'));this[_0x9e33('0x20')]=_0x58fd63[_0x9e33('0x20')];this[_0x9e33('0x21')]=_0x58fd63[_0x9e33('0x21')];this['callbackat']=_0x58fd63[_0x9e33('0x22')];this[_0x9e33('0x23')]=_0x58fd63['recallme'];this['originatecalleridnum']='';this[_0x9e33('0x24')]='';}Action[_0x9e33('0x25')][_0x9e33('0x26')]=function(){return util[_0x9e33('0x27')]('\x22%s\x22\x20<%s>',this['name'],this['voiceQueue']['dialCutDigit']>0x0?this[_0x9e33('0xb')]['substring'](this[_0x9e33('0x4')][_0x9e33('0x28')]):this[_0x9e33('0xb')]);};Action[_0x9e33('0x25')][_0x9e33('0x29')]=function(){return this[_0x9e33('0xc')];};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 6811219..1d1b227 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 _0x2330=['endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','../utils','state','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime'];(function(_0x925420,_0x17df34){var _0x8f5a4d=function(_0xde0e2e){while(--_0xde0e2e){_0x925420['push'](_0x925420['shift']());}};_0x8f5a4d(++_0x17df34);}(_0x2330,0x11c));var _0x0233=function(_0x4826f7,_0x14ab8b){_0x4826f7=_0x4826f7-0x0;var _0x88cdac=_0x2330[_0x4826f7];return _0x88cdac;};'use strict';var moment=require('moment');var utils=require(_0x0233('0x0'));function AgentComplete(_0x280517,_0xbf9953){this[_0x0233('0x1')]=0x4;this['statedesc']=_0x0233('0x2');this[_0x0233('0x3')]=_0x280517[_0x0233('0x3')];this[_0x0233('0x4')]=_0x280517[_0x0233('0x4')];this['campaigntype']=_0x280517[_0x0233('0x4')]===_0x0233('0x5')?_0x0233('0x6'):_0x280517[_0x0233('0x4')];this[_0x0233('0x7')]=_0x280517[_0x0233('0x7')];this[_0x0233('0x8')]=_0x280517[_0x0233('0x8')];this['countnoanswerretry']=_0x280517[_0x0233('0x9')];this[_0x0233('0xa')]=_0x280517[_0x0233('0x7')]+_0x280517[_0x0233('0x8')]+_0x280517[_0x0233('0x9')]+_0x280517[_0x0233('0xb')]+_0x280517[_0x0233('0xc')]+_0x280517[_0x0233('0xd')]+_0x280517[_0x0233('0xe')]+_0x280517[_0x0233('0xf')];this[_0x0233('0xb')]=_0x280517[_0x0233('0xb')];this[_0x0233('0xc')]=_0x280517[_0x0233('0xc')];this[_0x0233('0xd')]=_0x280517[_0x0233('0xd')];this['countmachineretry']=_0x280517[_0x0233('0xe')];this[_0x0233('0xf')]=_0x280517['countagentrejectretry'];this['uniqueid']=_0xbf9953[_0x0233('0x10')];this[_0x0233('0x11')]=_0x280517[_0x0233('0x12')];this[_0x0233('0x13')]=_0x280517[_0x0233('0x14')];this[_0x0233('0x15')]=_0x280517[_0x0233('0x15')];this[_0x0233('0x16')]=_0x280517['responsetime'];this[_0x0233('0x17')]=_0x280517[_0x0233('0x17')];this[_0x0233('0x18')]=moment()[_0x0233('0x19')](_0x0233('0x1a'));this[_0x0233('0x1b')]=utils[_0x0233('0x1c')](_0x280517['responsetime'],_0x280517[_0x0233('0x15')]);this['holdtime']=utils[_0x0233('0x1c')](_0x280517[_0x0233('0x17')],_0x280517[_0x0233('0x16')]);this[_0x0233('0x1d')]=utils[_0x0233('0x1c')](this[_0x0233('0x18')],_0x280517['answertime']);this[_0x0233('0x6')]=_0xbf9953[_0x0233('0x6')];this[_0x0233('0x1e')]=_0xbf9953[_0x0233('0x1e')];this['reason']=_0xbf9953[_0x0233('0x1f')];this[_0x0233('0x20')]=_0x280517['callback'];this[_0x0233('0x21')]=_0x280517[_0x0233('0x21')];this[_0x0233('0x22')]=_0x280517[_0x0233('0x22')];this['recallme']=_0x280517[_0x0233('0x23')];this[_0x0233('0x24')]=_0x280517[_0x0233('0x24')];this[_0x0233('0x25')]=_0x280517[_0x0233('0x25')];this['UserId']=_0x280517[_0x0233('0x26')];this[_0x0233('0x27')]=_0x280517[_0x0233('0x27')];this[_0x0233('0x28')]=_0x280517[_0x0233('0x28')];this[_0x0233('0x29')]=_0x280517[_0x0233('0x29')]||'';this[_0x0233('0x2a')]=_0x280517['originatecalleridname']||'';this[_0x0233('0x2b')]=_0x280517[_0x0233('0x2b')];}module['exports']=AgentComplete; \ No newline at end of file +var _0x9fa1=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','state','statedesc','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countdropretry','countagentrejectretry','calleridname','name','number','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','endtime','membername','reason','callback','callbackuniqueid','callbackat'];(function(_0x5c47c9,_0x18210a){var _0x501ff8=function(_0x11d70b){while(--_0x11d70b){_0x5c47c9['push'](_0x5c47c9['shift']());}};_0x501ff8(++_0x18210a);}(_0x9fa1,0xf9));var _0x19fa=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x9fa1[_0x45d55e];return _0x29812a;};'use strict';var moment=require('moment');var utils=require('../utils');function AgentComplete(_0x3f74ed,_0x3dd4ca){this[_0x19fa('0x0')]=0x4;this[_0x19fa('0x1')]='Answer';this['scheduledat']=_0x3f74ed[_0x19fa('0x2')];this[_0x19fa('0x3')]=_0x3f74ed[_0x19fa('0x3')];this[_0x19fa('0x4')]=_0x3f74ed['type']==='outbound'?_0x19fa('0x5'):_0x3f74ed[_0x19fa('0x3')];this['countbusyretry']=_0x3f74ed[_0x19fa('0x6')];this['countcongestionretry']=_0x3f74ed[_0x19fa('0x7')];this['countnoanswerretry']=_0x3f74ed[_0x19fa('0x8')];this['countglobal']=_0x3f74ed[_0x19fa('0x6')]+_0x3f74ed['countcongestionretry']+_0x3f74ed[_0x19fa('0x8')]+_0x3f74ed['countnosuchnumberretry']+_0x3f74ed['countdropretry']+_0x3f74ed[_0x19fa('0x9')]+_0x3f74ed[_0x19fa('0xa')]+_0x3f74ed['countagentrejectretry'];this[_0x19fa('0xb')]=_0x3f74ed[_0x19fa('0xb')];this['countdropretry']=_0x3f74ed[_0x19fa('0xc')];this[_0x19fa('0x9')]=_0x3f74ed['countabandonedretry'];this['countmachineretry']=_0x3f74ed[_0x19fa('0xa')];this[_0x19fa('0xd')]=_0x3f74ed[_0x19fa('0xd')];this['uniqueid']=_0x3dd4ca['uniqueid'];this[_0x19fa('0xe')]=_0x3f74ed[_0x19fa('0xf')];this['calleridnum']=_0x3f74ed[_0x19fa('0x10')];this[_0x19fa('0x11')]=_0x3f74ed['starttime'];this[_0x19fa('0x12')]=_0x3f74ed[_0x19fa('0x12')];this[_0x19fa('0x13')]=_0x3f74ed[_0x19fa('0x13')];this['endtime']=moment()[_0x19fa('0x14')](_0x19fa('0x15'));this[_0x19fa('0x16')]=utils[_0x19fa('0x17')](_0x3f74ed['responsetime'],_0x3f74ed[_0x19fa('0x11')]);this[_0x19fa('0x18')]=utils['getSeconds'](_0x3f74ed[_0x19fa('0x13')],_0x3f74ed['responsetime']);this['talktime']=utils[_0x19fa('0x17')](this[_0x19fa('0x19')],_0x3f74ed['answertime']);this['queue']=_0x3dd4ca['queue'];this[_0x19fa('0x1a')]=_0x3dd4ca[_0x19fa('0x1a')];this[_0x19fa('0x1b')]=_0x3dd4ca[_0x19fa('0x1b')];this[_0x19fa('0x1c')]=_0x3f74ed[_0x19fa('0x1c')];this[_0x19fa('0x1d')]=_0x3f74ed[_0x19fa('0x1d')];this[_0x19fa('0x1e')]=_0x3f74ed[_0x19fa('0x1e')];this['recallme']=_0x3f74ed['recallme'];this['ContactId']=_0x3f74ed[_0x19fa('0x1f')];this[_0x19fa('0x20')]=_0x3f74ed[_0x19fa('0x20')];this[_0x19fa('0x21')]=_0x3f74ed['UserId'];this[_0x19fa('0x22')]=_0x3f74ed['VoiceQueueId'];this[_0x19fa('0x23')]=_0x3f74ed[_0x19fa('0x23')];this[_0x19fa('0x24')]=_0x3f74ed['originatecalleridnum']||'';this[_0x19fa('0x25')]=_0x3f74ed[_0x19fa('0x25')]||'';this[_0x19fa('0x26')]=_0x3f74ed['agiafterat'];}module[_0x19fa('0x27')]=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 7eec236..0f676e8 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 _0x54b3=['calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0x37ea15,_0x5a0470){var _0x453798=function(_0x47b5f9){while(--_0x47b5f9){_0x37ea15['push'](_0x37ea15['shift']());}};_0x453798(++_0x5a0470);}(_0x54b3,0x147));var _0x354b=function(_0x7356b3,_0x39a025){_0x7356b3=_0x7356b3-0x0;var _0x1ab291=_0x54b3[_0x7356b3];return _0x1ab291;};'use strict';function Final(_0x3c673e){this[_0x354b('0x0')]=_0x3c673e['uniqueid'];this[_0x354b('0x1')]=_0x3c673e[_0x354b('0x1')];this[_0x354b('0x2')]=_0x3c673e['type'];this['campaigntype']=_0x3c673e[_0x354b('0x2')]===_0x354b('0x3')?_0x354b('0x4'):_0x3c673e[_0x354b('0x2')];this['countbusyretry']=_0x3c673e[_0x354b('0x5')];this[_0x354b('0x6')]=_0x3c673e[_0x354b('0x6')];this[_0x354b('0x7')]=_0x3c673e['countnoanswerretry'];this['countglobal']=_0x3c673e[_0x354b('0x5')]+_0x3c673e[_0x354b('0x6')]+_0x3c673e[_0x354b('0x7')]+_0x3c673e[_0x354b('0x8')]+_0x3c673e[_0x354b('0x9')]+_0x3c673e[_0x354b('0xa')]+_0x3c673e[_0x354b('0xb')]+_0x3c673e['countagentrejectretry'];this[_0x354b('0x8')]=_0x3c673e[_0x354b('0x8')];this[_0x354b('0x9')]=_0x3c673e[_0x354b('0x9')];this[_0x354b('0xa')]=_0x3c673e[_0x354b('0xa')];this[_0x354b('0xb')]=_0x3c673e[_0x354b('0xb')];this[_0x354b('0xc')]=_0x3c673e['countagentrejectretry'];this[_0x354b('0x4')]=_0x3c673e['queue'];this[_0x354b('0xd')]=_0x3c673e['calleridname'];this['calleridnum']=_0x3c673e[_0x354b('0xe')];this['starttime']=_0x3c673e[_0x354b('0xf')];this[_0x354b('0x10')]=_0x3c673e[_0x354b('0x10')];this[_0x354b('0x11')]=_0x3c673e[_0x354b('0x10')];this['ringtime']=_0x3c673e[_0x354b('0x12')]||0x0;this['holdtime']=_0x3c673e[_0x354b('0x13')]||0x0;this['talktime']=_0x3c673e[_0x354b('0x14')]||0x0;this[_0x354b('0x15')]=_0x3c673e[_0x354b('0x15')];this[_0x354b('0x16')]=_0x3c673e[_0x354b('0x16')];this[_0x354b('0x17')]=_0x3c673e[_0x354b('0x17')];this['recallme']=_0x3c673e[_0x354b('0x18')];this[_0x354b('0x19')]=_0x3c673e[_0x354b('0x19')];this['ListId']=_0x3c673e['ListId'];this[_0x354b('0x1a')]=_0x3c673e[_0x354b('0x1a')];this[_0x354b('0x1b')]=_0x3c673e[_0x354b('0x1b')];this['CampaignId']=_0x3c673e[_0x354b('0x1c')];this[_0x354b('0x1d')]=_0x3c673e[_0x354b('0x1d')]||'';this[_0x354b('0x1e')]=_0x3c673e[_0x354b('0x1e')]||'';this[_0x354b('0x1f')]=_0x3c673e[_0x354b('0x1f')];this[_0x354b('0x20')]=_0x3c673e[_0x354b('0x20')];}module[_0x354b('0x21')]=Final; \ No newline at end of file +var _0x6095=['countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countbusyretry','countnosuchnumberretry','countdropretry'];(function(_0x372f8b,_0x208633){var _0x53a47e=function(_0x85709f){while(--_0x85709f){_0x372f8b['push'](_0x372f8b['shift']());}};_0x53a47e(++_0x208633);}(_0x6095,0x105));var _0x5609=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x6095[_0x53ccf2];return _0x5a2964;};'use strict';function Final(_0x498ad5){this['uniqueid']=_0x498ad5[_0x5609('0x0')];this[_0x5609('0x1')]=_0x498ad5['scheduledat'];this['type']=_0x498ad5[_0x5609('0x2')];this[_0x5609('0x3')]=_0x498ad5[_0x5609('0x2')]===_0x5609('0x4')?_0x5609('0x5'):_0x498ad5[_0x5609('0x2')];this['countbusyretry']=_0x498ad5['countbusyretry'];this[_0x5609('0x6')]=_0x498ad5[_0x5609('0x6')];this[_0x5609('0x7')]=_0x498ad5['countnoanswerretry'];this['countglobal']=_0x498ad5[_0x5609('0x8')]+_0x498ad5[_0x5609('0x6')]+_0x498ad5[_0x5609('0x7')]+_0x498ad5[_0x5609('0x9')]+_0x498ad5[_0x5609('0xa')]+_0x498ad5[_0x5609('0xb')]+_0x498ad5[_0x5609('0xc')]+_0x498ad5[_0x5609('0xd')];this[_0x5609('0x9')]=_0x498ad5[_0x5609('0x9')];this[_0x5609('0xa')]=_0x498ad5[_0x5609('0xa')];this['countabandonedretry']=_0x498ad5[_0x5609('0xb')];this[_0x5609('0xc')]=_0x498ad5[_0x5609('0xc')];this['countagentrejectretry']=_0x498ad5['countagentrejectretry'];this[_0x5609('0x5')]=_0x498ad5[_0x5609('0x5')];this[_0x5609('0xe')]=_0x498ad5[_0x5609('0xe')];this['calleridnum']=_0x498ad5[_0x5609('0xf')];this['starttime']=_0x498ad5[_0x5609('0x10')];this[_0x5609('0x11')]=_0x498ad5[_0x5609('0x11')];this[_0x5609('0x12')]=_0x498ad5[_0x5609('0x11')];this['ringtime']=_0x498ad5['ringtime']||0x0;this[_0x5609('0x13')]=_0x498ad5['holdtime']||0x0;this['talktime']=_0x498ad5['talktime']||0x0;this[_0x5609('0x14')]=_0x498ad5[_0x5609('0x14')];this['callbackuniqueid']=_0x498ad5[_0x5609('0x15')];this[_0x5609('0x16')]=_0x498ad5[_0x5609('0x16')];this[_0x5609('0x17')]=_0x498ad5['recallme'];this[_0x5609('0x18')]=_0x498ad5['ContactId'];this['ListId']=_0x498ad5[_0x5609('0x19')];this[_0x5609('0x1a')]=_0x498ad5[_0x5609('0x1a')];this[_0x5609('0x1b')]=_0x498ad5['VoiceQueueId'];this[_0x5609('0x1c')]=_0x498ad5['CampaignId'];this[_0x5609('0x1d')]=_0x498ad5['originatecalleridnum']||'';this[_0x5609('0x1e')]=_0x498ad5[_0x5609('0x1e')]||'';this[_0x5609('0x1f')]=_0x498ad5['state'];this[_0x5609('0x20')]=_0x498ad5['statedesc'];}module[_0x5609('0x21')]=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 f1b32a2..9cc60b5 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 _0x637d=['Answer','scheduledat','type','campaigntype','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','getSeconds','holdtime','talktime','membername','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','exports','moment','state','statedesc'];(function(_0x9b37de,_0x295218){var _0x3ebb37=function(_0x477a39){while(--_0x477a39){_0x9b37de['push'](_0x9b37de['shift']());}};_0x3ebb37(++_0x295218);}(_0x637d,0xe7));var _0xd637=function(_0x2db274,_0x387f62){_0x2db274=_0x2db274-0x0;var _0x246ab8=_0x637d[_0x2db274];return _0x246ab8;};'use strict';var moment=require(_0xd637('0x0'));var utils=require('../utils');function Hangup(_0x53bcf3,_0x7ab170){this[_0xd637('0x1')]=0x4;this[_0xd637('0x2')]=_0xd637('0x3');this['scheduledat']=_0x53bcf3[_0xd637('0x4')];this[_0xd637('0x5')]=_0x53bcf3[_0xd637('0x5')];this[_0xd637('0x6')]=_0x53bcf3[_0xd637('0x5')]==='outbound'?_0xd637('0x7'):_0x53bcf3[_0xd637('0x5')];this[_0xd637('0x8')]=_0x53bcf3[_0xd637('0x8')]||![];this[_0xd637('0x9')]=_0x53bcf3[_0xd637('0x9')];this[_0xd637('0xa')]=_0x53bcf3[_0xd637('0xa')];this[_0xd637('0xb')]=_0x53bcf3['countnoanswerretry'];this[_0xd637('0xc')]=_0x53bcf3[_0xd637('0x9')]+_0x53bcf3['countcongestionretry']+_0x53bcf3[_0xd637('0xb')]+_0x53bcf3[_0xd637('0xd')]+_0x53bcf3[_0xd637('0xe')]+_0x53bcf3[_0xd637('0xf')]+_0x53bcf3[_0xd637('0x10')]+_0x53bcf3[_0xd637('0x11')];this['countnosuchnumberretry']=_0x53bcf3[_0xd637('0xd')];this[_0xd637('0xe')]=_0x53bcf3[_0xd637('0xe')];this[_0xd637('0xf')]=_0x53bcf3[_0xd637('0xf')];this[_0xd637('0x10')]=_0x53bcf3[_0xd637('0x10')];this['countagentrejectretry']=_0x53bcf3[_0xd637('0x11')];this[_0xd637('0x12')]=_0x7ab170[_0xd637('0x12')];this['calleridname']=_0x53bcf3[_0xd637('0x13')];this['calleridnum']=_0x53bcf3['number'];this[_0xd637('0x14')]=_0x53bcf3['starttime'];this['responsetime']=_0x53bcf3[_0xd637('0x15')];this[_0xd637('0x16')]=moment()['format'](_0xd637('0x17'));this['ringtime']=utils[_0xd637('0x18')](_0x53bcf3[_0xd637('0x15')],_0x53bcf3[_0xd637('0x14')]);this[_0xd637('0x19')]=0x0;this[_0xd637('0x1a')]=utils['getSeconds'](this['endtime'],_0x53bcf3[_0xd637('0x15')]);this[_0xd637('0x7')]=_0x53bcf3[_0xd637('0x7')];this[_0xd637('0x1b')]=_0xd637('0x1c');this[_0xd637('0x1d')]=_0x7ab170['cause-txt'];this[_0xd637('0x1e')]=_0x53bcf3[_0xd637('0x1e')];this[_0xd637('0x1f')]=_0x53bcf3[_0xd637('0x1f')];this[_0xd637('0x20')]=_0x53bcf3[_0xd637('0x20')];this[_0xd637('0x21')]=_0x53bcf3[_0xd637('0x21')];this[_0xd637('0x22')]=_0x53bcf3[_0xd637('0x22')];this[_0xd637('0x23')]=_0x53bcf3[_0xd637('0x23')];this[_0xd637('0x24')]=_0x53bcf3[_0xd637('0x24')];this['VoiceQueueId']=_0x53bcf3['VoiceQueueId'];this[_0xd637('0x25')]=_0x53bcf3[_0xd637('0x25')];}module[_0xd637('0x26')]=Hangup; \ No newline at end of file +var _0x114c=['recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','../utils','state','statedesc','Answer','scheduledat','type','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','starttime','holdtime','talktime','membername','reason','cause-txt','callback','callbackuniqueid','callbackat'];(function(_0x1423f5,_0x1b676d){var _0x544c13=function(_0x34f1a7){while(--_0x34f1a7){_0x1423f5['push'](_0x1423f5['shift']());}};_0x544c13(++_0x1b676d);}(_0x114c,0x1f3));var _0xc114=function(_0x4555ad,_0x382bfe){_0x4555ad=_0x4555ad-0x0;var _0x2b706a=_0x114c[_0x4555ad];return _0x2b706a;};'use strict';var moment=require('moment');var utils=require(_0xc114('0x0'));function Hangup(_0x4f454c,_0x553f80){this[_0xc114('0x1')]=0x4;this[_0xc114('0x2')]=_0xc114('0x3');this[_0xc114('0x4')]=_0x4f454c[_0xc114('0x4')];this[_0xc114('0x5')]=_0x4f454c[_0xc114('0x5')];this['campaigntype']=_0x4f454c[_0xc114('0x5')]==='outbound'?_0xc114('0x6'):_0x4f454c['type'];this['amd']=_0x4f454c[_0xc114('0x7')]||![];this[_0xc114('0x8')]=_0x4f454c['countbusyretry'];this[_0xc114('0x9')]=_0x4f454c[_0xc114('0x9')];this[_0xc114('0xa')]=_0x4f454c[_0xc114('0xa')];this[_0xc114('0xb')]=_0x4f454c[_0xc114('0x8')]+_0x4f454c[_0xc114('0x9')]+_0x4f454c[_0xc114('0xa')]+_0x4f454c[_0xc114('0xc')]+_0x4f454c[_0xc114('0xd')]+_0x4f454c['countabandonedretry']+_0x4f454c[_0xc114('0xe')]+_0x4f454c['countagentrejectretry'];this[_0xc114('0xc')]=_0x4f454c[_0xc114('0xc')];this['countdropretry']=_0x4f454c[_0xc114('0xd')];this[_0xc114('0xf')]=_0x4f454c[_0xc114('0xf')];this[_0xc114('0xe')]=_0x4f454c[_0xc114('0xe')];this[_0xc114('0x10')]=_0x4f454c[_0xc114('0x10')];this['uniqueid']=_0x553f80[_0xc114('0x11')];this[_0xc114('0x12')]=_0x4f454c['name'];this[_0xc114('0x13')]=_0x4f454c[_0xc114('0x14')];this['starttime']=_0x4f454c['starttime'];this[_0xc114('0x15')]=_0x4f454c[_0xc114('0x15')];this[_0xc114('0x16')]=moment()['format'](_0xc114('0x17'));this[_0xc114('0x18')]=utils['getSeconds'](_0x4f454c['responsetime'],_0x4f454c[_0xc114('0x19')]);this[_0xc114('0x1a')]=0x0;this[_0xc114('0x1b')]=utils['getSeconds'](this[_0xc114('0x16')],_0x4f454c[_0xc114('0x15')]);this['queue']=_0x4f454c['queue'];this[_0xc114('0x1c')]='IVR';this[_0xc114('0x1d')]=_0x553f80[_0xc114('0x1e')];this[_0xc114('0x1f')]=_0x4f454c[_0xc114('0x1f')];this[_0xc114('0x20')]=_0x4f454c[_0xc114('0x20')];this['callbackat']=_0x4f454c[_0xc114('0x21')];this[_0xc114('0x22')]=_0x4f454c[_0xc114('0x22')];this[_0xc114('0x23')]=_0x4f454c['ContactId'];this[_0xc114('0x24')]=_0x4f454c[_0xc114('0x24')];this[_0xc114('0x25')]=_0x4f454c['UserId'];this[_0xc114('0x26')]=_0x4f454c[_0xc114('0x26')];this[_0xc114('0x27')]=_0x4f454c['CampaignId'];}module[_0xc114('0x28')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index 841bd86..033bacf 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 _0x8359=['../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countagentrejectretry','countdropretry','countabandonedretry','countmachineretry','calleridname','name','calleridnum','number','starttime','endtime','responsetime','ringtime','getSeconds','holdtime','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','state','statedesc'];(function(_0x18b191,_0x4e0684){var _0x43e146=function(_0x4b464e){while(--_0x4b464e){_0x18b191['push'](_0x18b191['shift']());}};_0x43e146(++_0x4e0684);}(_0x8359,0x1e1));var _0x9835=function(_0x3f9ac2,_0x1b670b){_0x3f9ac2=_0x3f9ac2-0x0;var _0xe6a436=_0x8359[_0x3f9ac2];return _0xe6a436;};'use strict';var utils=require(_0x9835('0x0'));function History(_0x14fc43){this[_0x9835('0x1')]=_0x14fc43['uniqueid'];this[_0x9835('0x2')]=_0x14fc43['scheduledat']||undefined;this[_0x9835('0x3')]=_0x14fc43[_0x9835('0x3')];this[_0x9835('0x4')]=_0x14fc43['type']===_0x9835('0x5')?_0x9835('0x6'):_0x14fc43[_0x9835('0x3')];this['countbusyretry']=_0x14fc43[_0x9835('0x7')];this[_0x9835('0x8')]=_0x14fc43[_0x9835('0x8')];this[_0x9835('0x9')]=_0x14fc43['countnoanswerretry'];this[_0x9835('0xa')]=_0x14fc43[_0x9835('0x7')]+_0x14fc43['countcongestionretry']+_0x14fc43[_0x9835('0x9')]+_0x14fc43[_0x9835('0xb')]+_0x14fc43['countdropretry']+_0x14fc43['countabandonedretry']+_0x14fc43['countmachineretry']+_0x14fc43[_0x9835('0xc')];this[_0x9835('0xb')]=_0x14fc43[_0x9835('0xb')];this[_0x9835('0xd')]=_0x14fc43['countdropretry'];this[_0x9835('0xe')]=_0x14fc43['countabandonedretry'];this[_0x9835('0xf')]=_0x14fc43[_0x9835('0xf')];this[_0x9835('0xc')]=_0x14fc43['countagentrejectretry'];this['queue']=_0x14fc43[_0x9835('0x6')];this[_0x9835('0x10')]=_0x14fc43[_0x9835('0x11')];this[_0x9835('0x12')]=_0x14fc43[_0x9835('0x13')];this[_0x9835('0x14')]=_0x14fc43[_0x9835('0x14')];this['responsetime']=_0x14fc43['responsetime'];this[_0x9835('0x15')]=_0x14fc43[_0x9835('0x16')];this[_0x9835('0x17')]=utils[_0x9835('0x18')](_0x14fc43[_0x9835('0x16')],_0x14fc43[_0x9835('0x14')]);this[_0x9835('0x19')]=0x0;this['talktime']=0x0;this[_0x9835('0x1a')]=_0x14fc43['callback'];this[_0x9835('0x1b')]=_0x14fc43[_0x9835('0x1b')];this['callbackat']=_0x14fc43['callbackat'];this['recallme']=_0x14fc43[_0x9835('0x1c')];this[_0x9835('0x1d')]=_0x14fc43[_0x9835('0x1d')];this[_0x9835('0x1e')]=_0x14fc43[_0x9835('0x1e')];this[_0x9835('0x1f')]=_0x14fc43[_0x9835('0x1f')];this[_0x9835('0x20')]=_0x14fc43[_0x9835('0x20')];this['CampaignId']=_0x14fc43[_0x9835('0x21')];this['originatecalleridnum']=_0x14fc43[_0x9835('0x22')]||'';this['originatecalleridname']=_0x14fc43['originatecalleridname']||'';this[_0x9835('0x23')]=_0x14fc43['state'];this['statedesc']=_0x14fc43[_0x9835('0x24')];}module['exports']=History; \ No newline at end of file +var _0x3a27=['callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','getSeconds','holdtime'];(function(_0x23ea61,_0xe8613b){var _0x5118fb=function(_0x5c1878){while(--_0x5c1878){_0x23ea61['push'](_0x23ea61['shift']());}};_0x5118fb(++_0xe8613b);}(_0x3a27,0xa6));var _0x73a2=function(_0xbdc691,_0xfa7662){_0xbdc691=_0xbdc691-0x0;var _0x203cc4=_0x3a27[_0xbdc691];return _0x203cc4;};'use strict';var utils=require(_0x73a2('0x0'));function History(_0x5cd74a){this[_0x73a2('0x1')]=_0x5cd74a[_0x73a2('0x1')];this[_0x73a2('0x2')]=_0x5cd74a[_0x73a2('0x2')]||undefined;this[_0x73a2('0x3')]=_0x5cd74a[_0x73a2('0x3')];this[_0x73a2('0x4')]=_0x5cd74a[_0x73a2('0x3')]==='outbound'?_0x73a2('0x5'):_0x5cd74a[_0x73a2('0x3')];this[_0x73a2('0x6')]=_0x5cd74a[_0x73a2('0x6')];this[_0x73a2('0x7')]=_0x5cd74a[_0x73a2('0x7')];this[_0x73a2('0x8')]=_0x5cd74a['countnoanswerretry'];this[_0x73a2('0x9')]=_0x5cd74a['countbusyretry']+_0x5cd74a[_0x73a2('0x7')]+_0x5cd74a[_0x73a2('0x8')]+_0x5cd74a[_0x73a2('0xa')]+_0x5cd74a[_0x73a2('0xb')]+_0x5cd74a['countabandonedretry']+_0x5cd74a[_0x73a2('0xc')]+_0x5cd74a[_0x73a2('0xd')];this[_0x73a2('0xa')]=_0x5cd74a[_0x73a2('0xa')];this[_0x73a2('0xb')]=_0x5cd74a[_0x73a2('0xb')];this['countabandonedretry']=_0x5cd74a[_0x73a2('0xe')];this[_0x73a2('0xc')]=_0x5cd74a[_0x73a2('0xc')];this[_0x73a2('0xd')]=_0x5cd74a['countagentrejectretry'];this['queue']=_0x5cd74a['queue'];this[_0x73a2('0xf')]=_0x5cd74a[_0x73a2('0x10')];this[_0x73a2('0x11')]=_0x5cd74a[_0x73a2('0x12')];this['starttime']=_0x5cd74a[_0x73a2('0x13')];this[_0x73a2('0x14')]=_0x5cd74a[_0x73a2('0x14')];this[_0x73a2('0x15')]=_0x5cd74a[_0x73a2('0x14')];this['ringtime']=utils[_0x73a2('0x16')](_0x5cd74a[_0x73a2('0x14')],_0x5cd74a[_0x73a2('0x13')]);this[_0x73a2('0x17')]=0x0;this['talktime']=0x0;this[_0x73a2('0x18')]=_0x5cd74a[_0x73a2('0x18')];this[_0x73a2('0x19')]=_0x5cd74a['callbackuniqueid'];this[_0x73a2('0x1a')]=_0x5cd74a[_0x73a2('0x1a')];this[_0x73a2('0x1b')]=_0x5cd74a['recallme'];this['ContactId']=_0x5cd74a[_0x73a2('0x1c')];this[_0x73a2('0x1d')]=_0x5cd74a['ListId'];this['UserId']=_0x5cd74a[_0x73a2('0x1e')];this['VoiceQueueId']=_0x5cd74a[_0x73a2('0x1f')];this['CampaignId']=_0x5cd74a[_0x73a2('0x20')];this[_0x73a2('0x21')]=_0x5cd74a['originatecalleridnum']||'';this[_0x73a2('0x22')]=_0x5cd74a[_0x73a2('0x22')]||'';this[_0x73a2('0x23')]=_0x5cd74a[_0x73a2('0x23')];this[_0x73a2('0x24')]=_0x5cd74a[_0x73a2('0x24')];}module[_0x73a2('0x25')]=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 9f13d26..049e73f 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 _0x12ce=['type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','getSeconds','holdtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','../utils','scheduledat'];(function(_0x489b87,_0xd51c93){var _0x1823b6=function(_0x451c70){while(--_0x451c70){_0x489b87['push'](_0x489b87['shift']());}};_0x1823b6(++_0xd51c93);}(_0x12ce,0xaa));var _0xe12c=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x12ce[_0x297fd3];return _0x2af381;};'use strict';var utils=require(_0xe12c('0x0'));function QueueCallerAbandon(_0x1984ea,_0x4baa89){this[_0xe12c('0x1')]=_0x1984ea[_0xe12c('0x1')];this['type']=_0x1984ea[_0xe12c('0x2')];this[_0xe12c('0x3')]=_0x1984ea[_0xe12c('0x2')]===_0xe12c('0x4')?_0xe12c('0x5'):_0x1984ea[_0xe12c('0x2')];this[_0xe12c('0x6')]=_0x1984ea[_0xe12c('0x6')];this[_0xe12c('0x7')]=_0x1984ea[_0xe12c('0x7')];this[_0xe12c('0x8')]=_0x1984ea[_0xe12c('0x8')];this[_0xe12c('0x9')]=_0x1984ea[_0xe12c('0x6')]+_0x1984ea[_0xe12c('0x7')]+_0x1984ea['countnoanswerretry']+_0x1984ea['countnosuchnumberretry']+_0x1984ea['countdropretry']+_0x1984ea[_0xe12c('0xa')]+_0x1984ea[_0xe12c('0xb')]+_0x1984ea[_0xe12c('0xc')];this[_0xe12c('0xd')]=_0x1984ea['countnosuchnumberretry'];this[_0xe12c('0xe')]=_0x1984ea['countdropretry'];this[_0xe12c('0xa')]=_0x1984ea['countabandonedretry'];this[_0xe12c('0xb')]=_0x1984ea[_0xe12c('0xb')];this[_0xe12c('0xc')]=_0x1984ea[_0xe12c('0xc')];this[_0xe12c('0xf')]=_0x4baa89[_0xe12c('0xf')];this[_0xe12c('0x10')]=_0x1984ea[_0xe12c('0x11')];this[_0xe12c('0x12')]=_0x1984ea[_0xe12c('0x13')];this[_0xe12c('0x14')]=_0x1984ea[_0xe12c('0x14')];this[_0xe12c('0x15')]=_0x1984ea[_0xe12c('0x15')];this[_0xe12c('0x16')]=_0x1984ea[_0xe12c('0x16')];this[_0xe12c('0x17')]=_0x1984ea['dropreason'];this[_0xe12c('0x18')]=this[_0xe12c('0x16')];this['ringtime']=utils[_0xe12c('0x19')](_0x1984ea['responsetime'],_0x1984ea[_0xe12c('0x14')]);this[_0xe12c('0x1a')]=utils['getSeconds'](this[_0xe12c('0x16')],_0x1984ea[_0xe12c('0x15')]);this[_0xe12c('0x1b')]=0x0;this['queue']=_0x4baa89[_0xe12c('0x5')];this['membername']=_0x4baa89[_0xe12c('0x1c')];this[_0xe12c('0x1d')]=_0x4baa89[_0xe12c('0x1d')];this[_0xe12c('0x1e')]=_0x1984ea[_0xe12c('0x1e')];this[_0xe12c('0x1f')]=_0x1984ea[_0xe12c('0x1f')];this['callbackat']=_0x1984ea[_0xe12c('0x20')];this[_0xe12c('0x21')]=_0x1984ea[_0xe12c('0x21')];this[_0xe12c('0x22')]=_0x1984ea[_0xe12c('0x22')];this[_0xe12c('0x23')]=_0x1984ea[_0xe12c('0x23')];this[_0xe12c('0x24')]=_0x1984ea[_0xe12c('0x24')];this[_0xe12c('0x25')]=_0x1984ea[_0xe12c('0x25')];this['CampaignId']=_0x1984ea[_0xe12c('0x26')];this[_0xe12c('0x27')]=_0x1984ea[_0xe12c('0x27')]||'';this['originatecalleridname']=_0x1984ea[_0xe12c('0x28')]||'';this['agiafterat']=_0x1984ea['agiafterat'];this[_0xe12c('0x29')]=_0x1984ea[_0xe12c('0x29')];this[_0xe12c('0x2a')]=_0x1984ea[_0xe12c('0x2a')];}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0x5527=['agiafterat','state','statedesc','exports','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason','ringtime','getSeconds','holdtime','talktime','queue','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname'];(function(_0x1dac7a,_0x1828ce){var _0x4cb363=function(_0x80f6de){while(--_0x80f6de){_0x1dac7a['push'](_0x1dac7a['shift']());}};_0x4cb363(++_0x1828ce);}(_0x5527,0x164));var _0x7552=function(_0x2bbdd0,_0x1b7adb){_0x2bbdd0=_0x2bbdd0-0x0;var _0x34213f=_0x5527[_0x2bbdd0];return _0x34213f;};'use strict';var utils=require('../utils');function QueueCallerAbandon(_0x48ea58,_0x3efe10){this[_0x7552('0x0')]=_0x48ea58[_0x7552('0x0')];this['type']=_0x48ea58[_0x7552('0x1')];this[_0x7552('0x2')]=_0x48ea58[_0x7552('0x1')]===_0x7552('0x3')?'queue':_0x48ea58[_0x7552('0x1')];this['countbusyretry']=_0x48ea58[_0x7552('0x4')];this['countcongestionretry']=_0x48ea58[_0x7552('0x5')];this[_0x7552('0x6')]=_0x48ea58[_0x7552('0x6')];this[_0x7552('0x7')]=_0x48ea58['countbusyretry']+_0x48ea58[_0x7552('0x5')]+_0x48ea58[_0x7552('0x6')]+_0x48ea58[_0x7552('0x8')]+_0x48ea58[_0x7552('0x9')]+_0x48ea58[_0x7552('0xa')]+_0x48ea58[_0x7552('0xb')]+_0x48ea58[_0x7552('0xc')];this['countnosuchnumberretry']=_0x48ea58['countnosuchnumberretry'];this[_0x7552('0x9')]=_0x48ea58[_0x7552('0x9')];this['countabandonedretry']=_0x48ea58[_0x7552('0xa')];this[_0x7552('0xb')]=_0x48ea58[_0x7552('0xb')];this['countagentrejectretry']=_0x48ea58[_0x7552('0xc')];this['uniqueid']=_0x3efe10['uniqueid'];this[_0x7552('0xd')]=_0x48ea58[_0x7552('0xe')];this[_0x7552('0xf')]=_0x48ea58[_0x7552('0x10')];this[_0x7552('0x11')]=_0x48ea58[_0x7552('0x11')];this['responsetime']=_0x48ea58[_0x7552('0x12')];this[_0x7552('0x13')]=_0x48ea58[_0x7552('0x13')];this[_0x7552('0x14')]=_0x48ea58[_0x7552('0x14')];this['endtime']=this[_0x7552('0x13')];this[_0x7552('0x15')]=utils[_0x7552('0x16')](_0x48ea58[_0x7552('0x12')],_0x48ea58[_0x7552('0x11')]);this[_0x7552('0x17')]=utils[_0x7552('0x16')](this['droptime'],_0x48ea58[_0x7552('0x12')]);this[_0x7552('0x18')]=0x0;this['queue']=_0x3efe10[_0x7552('0x19')];this[_0x7552('0x1a')]=_0x3efe10[_0x7552('0x1b')];this[_0x7552('0x1c')]=_0x3efe10[_0x7552('0x1c')];this[_0x7552('0x1d')]=_0x48ea58[_0x7552('0x1d')];this[_0x7552('0x1e')]=_0x48ea58['callbackuniqueid'];this[_0x7552('0x1f')]=_0x48ea58[_0x7552('0x1f')];this[_0x7552('0x20')]=_0x48ea58['recallme'];this['ContactId']=_0x48ea58[_0x7552('0x21')];this[_0x7552('0x22')]=_0x48ea58[_0x7552('0x22')];this[_0x7552('0x23')]=_0x48ea58[_0x7552('0x23')];this[_0x7552('0x24')]=_0x48ea58[_0x7552('0x24')];this[_0x7552('0x25')]=_0x48ea58[_0x7552('0x25')];this[_0x7552('0x26')]=_0x48ea58[_0x7552('0x26')]||'';this[_0x7552('0x27')]=_0x48ea58[_0x7552('0x27')]||'';this[_0x7552('0x28')]=_0x48ea58[_0x7552('0x28')];this[_0x7552('0x29')]=_0x48ea58[_0x7552('0x29')];this[_0x7552('0x2a')]=_0x48ea58['statedesc'];}module[_0x7552('0x2b')]=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 f2753ff..f6eb750 100644 --- a/server/services/ami/dialer/utils/hopper.js +++ b/server/services/ami/dialer/utils/hopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackListIvr]','checkIsBlackListIvr','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','[createHistory]','createHistory','util','../../../../config/logger','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]'];(function(_0x5bb243,_0x1fd470){var _0xb7589c=function(_0x579d5a){while(--_0x579d5a){_0x5bb243['push'](_0x5bb243['shift']());}};_0xb7589c(++_0x1fd470);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x0d8b('0x0'));var logger=require(_0x0d8b('0x1'))('dialer');var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x0d8b('0x2'));var cmHopperHistory=require(_0x0d8b('0x3'));function inspectError(_0x43bca1){return util[_0x0d8b('0x4')](_0x43bca1,{'showHidden':![],'depth':null});}function getContactDialer(_0x8196ed,_0x577834,_0x5e15e6){return cmHopper[_0x0d8b('0x5')](_0x8196ed['id'],_0x577834,_0x5e15e6,_0x8196ed[_0x0d8b('0x6')])[_0x0d8b('0x7')](function(_0x4a4470){_0x8196ed[_0x0d8b('0x8')]-=_0x5e15e6;if(_0x8196ed[_0x0d8b('0x8')]<0x0){_0x8196ed['temp']=0x0;}logger[_0x0d8b('0x9')](_0x0d8b('0xa'),inspectError(_0x4a4470));});}exports[_0x0d8b('0x5')]=getContactDialer;function getContactDialerIvr(_0x1f4800,_0x28ff7f){return cmHopper[_0x0d8b('0xb')](_0x1f4800['id'],_0x28ff7f,_0x1f4800[_0x0d8b('0x6')])[_0x0d8b('0x7')](function(_0x48fa16){_0x1f4800[_0x0d8b('0x8')]-=_0x28ff7f;if(_0x1f4800['temp']<0x0){_0x1f4800[_0x0d8b('0x8')]=0x0;}logger[_0x0d8b('0x9')](_0x0d8b('0xc'),inspectError(_0x48fa16));});}exports[_0x0d8b('0xb')]=getContactDialerIvr;function countReScheduled(_0x35a07b){return cmHopper[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0x7')](function(_0x31a8cc){logger[_0x0d8b('0x9')](_0x0d8b('0xe'),inspectError(_0x31a8cc));});}exports[_0x0d8b('0xd')]=countReScheduled;function rescheduleContact(_0xe65334){return cmHopper[_0x0d8b('0xf')](_0xe65334)[_0x0d8b('0x7')](function(_0x4f6f21){logger[_0x0d8b('0x9')](_0x0d8b('0x10'),inspectError(_0x4f6f21));});}exports[_0x0d8b('0xf')]=rescheduleContact;function unlockContact(_0xe2e167,_0x2cb03c,_0x5cd485){return cmHopper[_0x0d8b('0x11')](_0xe2e167,_0x2cb03c,_0x5cd485)[_0x0d8b('0x7')](function(_0x2fd0fc){logger[_0x0d8b('0x9')](_0x0d8b('0x12'),inspectError(_0x2fd0fc));});}exports[_0x0d8b('0x11')]=unlockContact;function moveContactManagedDialer(_0x264b39){return cmHopper[_0x0d8b('0x13')](_0x264b39)['catch'](function(_0x27512e){logger[_0x0d8b('0x9')](_0x0d8b('0x14'),inspectError(_0x27512e));});}exports[_0x0d8b('0x13')]=moveContactManagedDialer;function checkIsBlackList(_0x24e8ed){return cmHopperBlack[_0x0d8b('0x15')](_0x24e8ed)[_0x0d8b('0x7')](function(_0x352c17){logger['error']('[checkIsBlackList]',inspectError(_0x352c17));});}exports[_0x0d8b('0x15')]=checkIsBlackList;function checkIsBlackListIvr(_0x54a9a7){return cmHopperBlack['checkIsBlackListIvr'](_0x54a9a7)['catch'](function(_0x238728){logger[_0x0d8b('0x9')](_0x0d8b('0x16'),inspectError(_0x238728));});}exports[_0x0d8b('0x17')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x221071,_0x2c64e2,_0x30980c){return cmHopperAdditionalPhone[_0x0d8b('0x18')](_0x221071,_0x2c64e2,_0x30980c)[_0x0d8b('0x7')](function(_0x5e5bc3){logger[_0x0d8b('0x9')](_0x0d8b('0x19'),inspectError(_0x5e5bc3));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0xe1ef20,_0x4a0ae4,_0x3dd149){return cmHopperAdditionalPhone[_0x0d8b('0x1a')](_0xe1ef20,_0x4a0ae4,_0x3dd149)[_0x0d8b('0x7')](function(_0x4fe6f9){logger['error'](_0x0d8b('0x1b'),inspectError(_0x4fe6f9));});}exports[_0x0d8b('0x1a')]=swapAdditionalPhones;function avgHandleTime(_0x4c05ee){return cmHopperHistory[_0x0d8b('0x1c')](_0x4c05ee)['catch'](function(_0x1b2b59){logger['error'](_0x0d8b('0x1d'),inspectError(_0x1b2b59));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x2ab00d){return cmHopperHistory['createHistory'](_0x2ab00d)[_0x0d8b('0x7')](function(_0x544735){logger[_0x0d8b('0x9')](_0x0d8b('0x1e'),inspectError(_0x544735));});}exports[_0x0d8b('0x1f')]=createHistory; \ No newline at end of file +var _0xd8b0=['moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackListIvr]','checkIsBlackListIvr','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','[createHistory]','createHistory','util','../../../../config/logger','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]'];(function(_0x2436f5,_0xc63f){var _0x2123d7=function(_0x31a690){while(--_0x31a690){_0x2436f5['push'](_0x2436f5['shift']());}};_0x2123d7(++_0xc63f);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x0d8b('0x0'));var logger=require(_0x0d8b('0x1'))('dialer');var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x0d8b('0x2'));var cmHopperHistory=require(_0x0d8b('0x3'));function inspectError(_0x43bca1){return util[_0x0d8b('0x4')](_0x43bca1,{'showHidden':![],'depth':null});}function getContactDialer(_0x8196ed,_0x577834,_0x5e15e6){return cmHopper[_0x0d8b('0x5')](_0x8196ed['id'],_0x577834,_0x5e15e6,_0x8196ed[_0x0d8b('0x6')])[_0x0d8b('0x7')](function(_0x4a4470){_0x8196ed[_0x0d8b('0x8')]-=_0x5e15e6;if(_0x8196ed[_0x0d8b('0x8')]<0x0){_0x8196ed['temp']=0x0;}logger[_0x0d8b('0x9')](_0x0d8b('0xa'),inspectError(_0x4a4470));});}exports[_0x0d8b('0x5')]=getContactDialer;function getContactDialerIvr(_0x1f4800,_0x28ff7f){return cmHopper[_0x0d8b('0xb')](_0x1f4800['id'],_0x28ff7f,_0x1f4800[_0x0d8b('0x6')])[_0x0d8b('0x7')](function(_0x48fa16){_0x1f4800[_0x0d8b('0x8')]-=_0x28ff7f;if(_0x1f4800['temp']<0x0){_0x1f4800[_0x0d8b('0x8')]=0x0;}logger[_0x0d8b('0x9')](_0x0d8b('0xc'),inspectError(_0x48fa16));});}exports[_0x0d8b('0xb')]=getContactDialerIvr;function countReScheduled(_0x35a07b){return cmHopper[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0x7')](function(_0x31a8cc){logger[_0x0d8b('0x9')](_0x0d8b('0xe'),inspectError(_0x31a8cc));});}exports[_0x0d8b('0xd')]=countReScheduled;function rescheduleContact(_0xe65334){return cmHopper[_0x0d8b('0xf')](_0xe65334)[_0x0d8b('0x7')](function(_0x4f6f21){logger[_0x0d8b('0x9')](_0x0d8b('0x10'),inspectError(_0x4f6f21));});}exports[_0x0d8b('0xf')]=rescheduleContact;function unlockContact(_0xe2e167,_0x2cb03c,_0x5cd485){return cmHopper[_0x0d8b('0x11')](_0xe2e167,_0x2cb03c,_0x5cd485)[_0x0d8b('0x7')](function(_0x2fd0fc){logger[_0x0d8b('0x9')](_0x0d8b('0x12'),inspectError(_0x2fd0fc));});}exports[_0x0d8b('0x11')]=unlockContact;function moveContactManagedDialer(_0x264b39){return cmHopper[_0x0d8b('0x13')](_0x264b39)['catch'](function(_0x27512e){logger[_0x0d8b('0x9')](_0x0d8b('0x14'),inspectError(_0x27512e));});}exports[_0x0d8b('0x13')]=moveContactManagedDialer;function checkIsBlackList(_0x24e8ed){return cmHopperBlack[_0x0d8b('0x15')](_0x24e8ed)[_0x0d8b('0x7')](function(_0x352c17){logger['error']('[checkIsBlackList]',inspectError(_0x352c17));});}exports[_0x0d8b('0x15')]=checkIsBlackList;function checkIsBlackListIvr(_0x54a9a7){return cmHopperBlack['checkIsBlackListIvr'](_0x54a9a7)['catch'](function(_0x238728){logger[_0x0d8b('0x9')](_0x0d8b('0x16'),inspectError(_0x238728));});}exports[_0x0d8b('0x17')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x221071,_0x2c64e2,_0x30980c){return cmHopperAdditionalPhone[_0x0d8b('0x18')](_0x221071,_0x2c64e2,_0x30980c)[_0x0d8b('0x7')](function(_0x5e5bc3){logger[_0x0d8b('0x9')](_0x0d8b('0x19'),inspectError(_0x5e5bc3));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0xe1ef20,_0x4a0ae4,_0x3dd149){return cmHopperAdditionalPhone[_0x0d8b('0x1a')](_0xe1ef20,_0x4a0ae4,_0x3dd149)[_0x0d8b('0x7')](function(_0x4fe6f9){logger['error'](_0x0d8b('0x1b'),inspectError(_0x4fe6f9));});}exports[_0x0d8b('0x1a')]=swapAdditionalPhones;function avgHandleTime(_0x4c05ee){return cmHopperHistory[_0x0d8b('0x1c')](_0x4c05ee)['catch'](function(_0x1b2b59){logger['error'](_0x0d8b('0x1d'),inspectError(_0x1b2b59));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x2ab00d){return cmHopperHistory['createHistory'](_0x2ab00d)[_0x0d8b('0x7')](function(_0x544735){logger[_0x0d8b('0x9')](_0x0d8b('0x1e'),inspectError(_0x544735));});}exports[_0x0d8b('0x1f')]=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index 7e9d529..b6aa14c 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 _0x24e7=['unmonitored','includes','status','TrunkBackup','INACTIVE','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','DISACTIVED','getQueueCampaignActiveStatusMessage','match','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','pow','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','lodash','moment','util','dialer','../../../../config/environment/shared','timezones','ACTIVE','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','GLOBAL_INTERVAL_IS_OVERTIME','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','preview','ivr','isIVRCampaign','type','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','getSeconds','dialMethod','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','UNKNOWN_TIMEZONE','SIP/','reachable'];(function(_0x57807e,_0xad9a3f){var _0x1f794a=function(_0x5c9420){while(--_0x5c9420){_0x57807e['push'](_0x57807e['shift']());}};_0x1f794a(++_0xad9a3f);}(_0x24e7,0x155));var _0x724e=function(_0x5833e7,_0x3d3958){_0x5833e7=_0x5833e7-0x0;var _0x5778a5=_0x24e7[_0x5833e7];return _0x5778a5;};'use strict';var _=require(_0x724e('0x0'));var moment=require(_0x724e('0x1'));var util=require(_0x724e('0x2'));var logger=require('../../../../config/logger')(_0x724e('0x3'));var timezones=require(_0x724e('0x4'))[_0x724e('0x5')];var CAMPAIGN_STATUS={'ACTIVE':_0x724e('0x6'),'BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':_0x724e('0x7'),'DISACTIVED':_0x724e('0x8'),'EMPTY_INTERVAL':_0x724e('0x9'),'INACTIVE':_0x724e('0xa'),'NO_AGENTS_LOGGED':_0x724e('0xb'),'NO_AVAILABLE_CONTACTS':_0x724e('0xc'),'NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0x724e('0xd'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':_0x724e('0xe'),'RUNNING':_0x724e('0xf'),'UNKNOWN_TIMEZONE':_0x724e('0x10'),'UNREACHABLE_TRUNK':_0x724e('0x11')};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x547b38){return _0x547b38['dialMethod']===_0x724e('0x12');}exports['isPreviewCampaign']=isPreviewCampaign;function isIVRCampaign(_0x5008bd){return _0x5008bd['type']===_0x724e('0x13');}exports[_0x724e('0x14')]=isIVRCampaign;function isOutboundQueue(_0x128e76){return _0x128e76[_0x724e('0x15')]==='outbound';}exports[_0x724e('0x16')]=isOutboundQueue;function isQueueCampaignActive(_0x46dce3){return _0x46dce3[_0x724e('0x17')];}exports[_0x724e('0x18')]=isQueueCampaignActive;function isIVRCampaignActive(_0x15226f){return _0x15226f[_0x724e('0x19')];}exports[_0x724e('0x1a')]=isIVRCampaignActive;function getSeconds(_0x3a8446,_0xe71ce2){var _0x376567=moment(_0x3a8446)[_0x724e('0x1b')](0x0);var _0x5d2468=moment(_0xe71ce2)[_0x724e('0x1b')](0x0);return _0x376567[_0x724e('0x1c')](_0x5d2468,'seconds');}exports[_0x724e('0x1d')]=getSeconds;function hasQueueCampaignDataChanged(_0x37ae12,_0x3886df){var _0x585a9f=![];var _0x1aef11=_0x37ae12[_0x724e('0x1e')]!==_0x3886df['dialMethod']||_0x37ae12['dialActive']!==_0x3886df['dialActive']||_0x37ae12['message']!==_0x3886df[_0x724e('0x1f')];var _0x16b533=_0x37ae12[_0x724e('0x20')]!==_0x3886df[_0x724e('0x20')]||_0x37ae12[_0x724e('0x21')]!==_0x3886df[_0x724e('0x21')]||_0x37ae12['loggedInDb']!==_0x3886df[_0x724e('0x22')]||_0x37ae12['paused']!==_0x3886df[_0x724e('0x23')]||_0x37ae12[_0x724e('0x24')]!==_0x3886df[_0x724e('0x24')]||_0x37ae12[_0x724e('0x25')]!==_0x3886df[_0x724e('0x25')]||_0x37ae12[_0x724e('0x26')]!==_0x3886df['waiting']||_0x37ae12[_0x724e('0x27')]!==_0x3886df[_0x724e('0x27')]||_0x37ae12[_0x724e('0x28')]!==_0x3886df[_0x724e('0x28')];if(_0x37ae12['Trunk']&&_0x3886df[_0x724e('0x29')]){_0x585a9f=_0x37ae12[_0x724e('0x29')][_0x724e('0x2a')]!==_0x3886df[_0x724e('0x29')][_0x724e('0x2a')]||_0x37ae12['Trunk'][_0x724e('0x19')]!==_0x3886df['Trunk'][_0x724e('0x19')];}return _0x1aef11||_0x16b533||_0x585a9f;}exports[_0x724e('0x2b')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0xc4bca8){var _0x3a4537=null;var _0x4ac781=_0xc4bca8[_0x724e('0x2c')];if(_[_0x724e('0x2d')](_0xc4bca8[_0x724e('0x2e')])||_[_0x724e('0x2d')](_0xc4bca8[_0x724e('0x2f')])||_['isNil'](_0xc4bca8[_0x724e('0x2f')][_0x724e('0x30')])){_0x3a4537=CAMPAIGN_STATUS[_0x724e('0x31')];}else if(_[_0x724e('0x32')](_0xc4bca8['dialGlobalInterval'])||_[_0x724e('0x32')](_0xc4bca8['Interval'][_0x724e('0x30')])){_0x3a4537=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0x4ac781&&!timezones[_0x4ac781]){_0x3a4537=CAMPAIGN_STATUS[_0x724e('0x33')];}return _0x3a4537;}function checkAnyValidTrunk(_0x1d0666,_0x536226){var _0x3f4957=null;var _0x4623b2=_0x724e('0x34');var _0x4f3822=[_0x724e('0x35'),_0x724e('0x36')];var _0x127dea=!![];if(_0x1d0666['Trunk']&&_0x1d0666['Trunk']['active']){_0x4623b2+=_0x1d0666[_0x724e('0x29')][_0x724e('0x2a')];_0x3f4957=_0x536226[_0x4623b2];_0x127dea=_0x4f3822[_0x724e('0x37')](_0x3f4957[_0x724e('0x38')]);}else if(_0x1d0666[_0x724e('0x39')]&&_0x1d0666['TrunkBackup'][_0x724e('0x19')]){_0x4623b2+=_0x1d0666['TrunkBackup'][_0x724e('0x2a')];_0x3f4957=_0x536226[_0x4623b2];_0x127dea=_0x4f3822[_0x724e('0x37')](_0x3f4957[_0x724e('0x38')]);}return _0x127dea;}function getQueueCampaignStatusMessage(_0x4bdbfb,_0xa9dafa){var _0x5a5070=CAMPAIGN_STATUS[_0x724e('0x6')];var _0x182dd3=isPreviewCampaign(_0x4bdbfb);if(!isQueueCampaignActive(_0x4bdbfb)){if(_0x182dd3){_0x5a5070=CAMPAIGN_STATUS[_0x724e('0x3a')];}else{if(_0x4bdbfb[_0x724e('0x28')]===0x0&&_0x4bdbfb[_0x724e('0x24')]===0x0&&_0x4bdbfb['waiting']===0x0&&(_0x4bdbfb[_0x724e('0x25')]||0x0)===0x0){_0x5a5070=CAMPAIGN_STATUS['INACTIVE'];}else{_0x5a5070=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x4bdbfb['loggedIn']===0x0){_0x5a5070=CAMPAIGN_STATUS[_0x724e('0x3b')];}else if(!checkAnyValidTrunk(_0x4bdbfb,_0xa9dafa)){_0x5a5070=CAMPAIGN_STATUS[_0x724e('0x3c')];}else if(!isPreviewCampaign(_0x4bdbfb)){var _0x2509bd=checkAnyValidQueueCampaignInterval(_0x4bdbfb);if(_0x2509bd){_0x5a5070=_0x2509bd;}}return _0x5a5070;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x5e881f){var _0x3d639f=CAMPAIGN_STATUS[_0x724e('0x3d')];if(_0x5e881f[_0x724e('0x28')]===0x0&&_0x5e881f[_0x724e('0x24')]===0x0&&_0x5e881f[_0x724e('0x26')]===0x0&&(_0x5e881f[_0x724e('0x25')]||0x0)===0x0){_0x3d639f=CAMPAIGN_STATUS['INACTIVE'];}return _0x3d639f;}exports[_0x724e('0x3e')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x3bcbb4){var _0x5e65b6=_0x3bcbb4[_0x724e('0x3f')](/"(.*?)"/);return _0x5e65b6?_0x5e65b6[0x1]:_0x3bcbb4;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0x1da289,_0xe30ecb,_0x3a52c3){if(!_['isUndefined'](_0x3a52c3)&&typeof _0x3a52c3==='string'&&!_[_0x724e('0x32')](_0x3a52c3)){if(!_[_0x724e('0x40')](_0xe30ecb)&&typeof _0xe30ecb===_0x724e('0x41')&&!_[_0x724e('0x32')](_0xe30ecb)){return util[_0x724e('0x42')](_0x724e('0x43'),_0xe30ecb,_0x3a52c3);}return util[_0x724e('0x42')](_0x724e('0x43'),_0x3a52c3,_0x3a52c3);}if(!_[_0x724e('0x40')](_0x1da289)&&typeof _0x1da289===_0x724e('0x41')&&!_[_0x724e('0x32')](_0x1da289)){return _0x1da289;}return _0x724e('0x44');}exports[_0x724e('0x45')]=getCallerId;function getCallerIdRandom(_0x3de499,_0x412101){var _0x51bb5f;var _0x1a79ea;var _0x39820f;if(_0x412101<=0x0){_0x412101=0x1;}_0x51bb5f=new RegExp('\x5cw{0,'+_0x412101+'}$');_0x1a79ea=Math[_0x724e('0x46')](0xa,_0x412101-0x1);_0x39820f=Math['pow'](0xa,_0x412101)-0x1;return util[_0x724e('0x42')]('%s',_['replace'](_0x3de499,_0x51bb5f,_['random'](_0x1a79ea,_0x39820f)['toString']()));}exports[_0x724e('0x47')]=getCallerIdRandom;function decrementOriginate(_0xd1eb84){if(_0xd1eb84[_0x724e('0x28')]&&_0xd1eb84[_0x724e('0x28')]>0x0){_0xd1eb84['originated']-=0x1;}else{logger[_0x724e('0x48')](_0x724e('0x49'));}}exports[_0x724e('0x4a')]=decrementOriginate;function checkContactEmpty(_0x669746){return _0x669746&&_0x669746[_0x724e('0x4b')]>0x0;}exports[_0x724e('0x4c')]=checkContactEmpty;function erlangb(_0x36a9e1,_0x33f9ef){if(_0x33f9ef===0x0){return 0x0;}var _0x52525e=0x1;for(var _0x247461=0x1;_0x247461<=_0x33f9ef;_0x247461+=0x1){_0x52525e=0x1+_0x52525e*_0x247461/_0x36a9e1;}return 0x1/_0x52525e;}exports[_0x724e('0x4d')]=erlangb;function checkContactLowerLimitOriginate(_0x303a49,_0x4fc340,_0x12341e){if(_0x4fc340>_0x12341e){for(var _0x1ef44b=0x0;_0x1ef44b<_0x4fc340-_0x12341e;_0x1ef44b+=0x1){decrementOriginate(_0x303a49);}}}exports[_0x724e('0x4e')]=checkContactLowerLimitOriginate; \ No newline at end of file +var _0x514e=['isIVRCampaign','outbound','isOutboundQueue','milliseconds','diff','getSeconds','message','available','loggedIn','loggedInDb','paused','pTalking','waiting','inUse','originated','Trunk','name','active','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','reachable','unmonitored','includes','TrunkBackup','status','ACTIVE','INACTIVE','DISACTIVED','UNREACHABLE_TRUNK','talking','getQueueCampaignActiveStatusMessage','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','moment','util','../../../../config/logger','dialer','../../../../config/environment/shared','timezones','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLFAILEDTIMEOUT','RUNNING','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','type','ivr'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x514e,0xdb));var _0xe514=function(_0x4d9d19,_0x512dae){_0x4d9d19=_0x4d9d19-0x0;var _0x2695bb=_0x514e[_0x4d9d19];return _0x2695bb;};'use strict';var _=require('lodash');var moment=require(_0xe514('0x0'));var util=require(_0xe514('0x1'));var logger=require(_0xe514('0x2'))(_0xe514('0x3'));var timezones=require(_0xe514('0x4'))[_0xe514('0x5')];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':_0xe514('0x6'),'CONTACTS_RESCHEDULED':_0xe514('0x7'),'DEACTIVATED':_0xe514('0x8'),'DISACTIVED':_0xe514('0x9'),'EMPTY_INTERVAL':_0xe514('0xa'),'INACTIVE':_0xe514('0xb'),'NO_AGENTS_LOGGED':_0xe514('0xc'),'NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':_0xe514('0xd'),'OVERTIME_GLOBAL_INTERVAL':_0xe514('0xe'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':_0xe514('0xf'),'RUNNING':_0xe514('0x10'),'UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':_0xe514('0x11')};exports[_0xe514('0x12')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x293014){return _0x293014[_0xe514('0x13')]===_0xe514('0x14');}exports[_0xe514('0x15')]=isPreviewCampaign;function isIVRCampaign(_0x43bd27){return _0x43bd27[_0xe514('0x16')]===_0xe514('0x17');}exports[_0xe514('0x18')]=isIVRCampaign;function isOutboundQueue(_0xe61c8){return _0xe61c8[_0xe514('0x16')]===_0xe514('0x19');}exports[_0xe514('0x1a')]=isOutboundQueue;function isQueueCampaignActive(_0x44b3cd){return _0x44b3cd['dialActive'];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0x2ca24c){return _0x2ca24c['active'];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x1f3794,_0x1b9d32){var _0xb02314=moment(_0x1f3794)[_0xe514('0x1b')](0x0);var _0x58f765=moment(_0x1b9d32)[_0xe514('0x1b')](0x0);return _0xb02314[_0xe514('0x1c')](_0x58f765,'seconds');}exports[_0xe514('0x1d')]=getSeconds;function hasQueueCampaignDataChanged(_0x3ae291,_0x14e2ae){var _0x3916ae=![];var _0x2b5b98=_0x3ae291['dialMethod']!==_0x14e2ae[_0xe514('0x13')]||_0x3ae291['dialActive']!==_0x14e2ae['dialActive']||_0x3ae291[_0xe514('0x1e')]!==_0x14e2ae[_0xe514('0x1e')];var _0x1f59b7=_0x3ae291[_0xe514('0x1f')]!==_0x14e2ae[_0xe514('0x1f')]||_0x3ae291[_0xe514('0x20')]!==_0x14e2ae[_0xe514('0x20')]||_0x3ae291[_0xe514('0x21')]!==_0x14e2ae[_0xe514('0x21')]||_0x3ae291[_0xe514('0x22')]!==_0x14e2ae[_0xe514('0x22')]||_0x3ae291['talking']!==_0x14e2ae['talking']||_0x3ae291[_0xe514('0x23')]!==_0x14e2ae[_0xe514('0x23')]||_0x3ae291[_0xe514('0x24')]!==_0x14e2ae[_0xe514('0x24')]||_0x3ae291[_0xe514('0x25')]!==_0x14e2ae[_0xe514('0x25')]||_0x3ae291[_0xe514('0x26')]!==_0x14e2ae[_0xe514('0x26')];if(_0x3ae291[_0xe514('0x27')]&&_0x14e2ae[_0xe514('0x27')]){_0x3916ae=_0x3ae291[_0xe514('0x27')][_0xe514('0x28')]!==_0x14e2ae['Trunk'][_0xe514('0x28')]||_0x3ae291[_0xe514('0x27')][_0xe514('0x29')]!==_0x14e2ae[_0xe514('0x27')]['active'];}return _0x2b5b98||_0x1f59b7||_0x3916ae;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x2de35b){var _0x4c8bd5=null;var _0x3041a8=_0x2de35b[_0xe514('0x2a')];if(_[_0xe514('0x2b')](_0x2de35b[_0xe514('0x2c')])||_[_0xe514('0x2b')](_0x2de35b[_0xe514('0x2d')])||_[_0xe514('0x2b')](_0x2de35b[_0xe514('0x2d')][_0xe514('0x2e')])){_0x4c8bd5=CAMPAIGN_STATUS[_0xe514('0x2f')];}else if(_[_0xe514('0x30')](_0x2de35b[_0xe514('0x2c')])||_[_0xe514('0x30')](_0x2de35b[_0xe514('0x2d')]['Intervals'])){_0x4c8bd5=CAMPAIGN_STATUS[_0xe514('0x31')];}else if(_0x3041a8&&!timezones[_0x3041a8]){_0x4c8bd5=CAMPAIGN_STATUS[_0xe514('0x32')];}return _0x4c8bd5;}function checkAnyValidTrunk(_0x3621d5,_0x102803){var _0xd4a4b4=null;var _0x5e8e4a='SIP/';var _0x484397=[_0xe514('0x33'),_0xe514('0x34')];var _0x553ecc=!![];if(_0x3621d5[_0xe514('0x27')]&&_0x3621d5[_0xe514('0x27')][_0xe514('0x29')]){_0x5e8e4a+=_0x3621d5[_0xe514('0x27')][_0xe514('0x28')];_0xd4a4b4=_0x102803[_0x5e8e4a];_0x553ecc=_0x484397[_0xe514('0x35')](_0xd4a4b4['status']);}else if(_0x3621d5[_0xe514('0x36')]&&_0x3621d5[_0xe514('0x36')][_0xe514('0x29')]){_0x5e8e4a+=_0x3621d5['TrunkBackup']['name'];_0xd4a4b4=_0x102803[_0x5e8e4a];_0x553ecc=_0x484397[_0xe514('0x35')](_0xd4a4b4[_0xe514('0x37')]);}return _0x553ecc;}function getQueueCampaignStatusMessage(_0x267c83,_0x131681){var _0x14a9be=CAMPAIGN_STATUS[_0xe514('0x38')];var _0x2af6ed=isPreviewCampaign(_0x267c83);if(!isQueueCampaignActive(_0x267c83)){if(_0x2af6ed){_0x14a9be=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x267c83[_0xe514('0x26')]===0x0&&_0x267c83['talking']===0x0&&_0x267c83[_0xe514('0x24')]===0x0&&(_0x267c83[_0xe514('0x23')]||0x0)===0x0){_0x14a9be=CAMPAIGN_STATUS[_0xe514('0x39')];}else{_0x14a9be=CAMPAIGN_STATUS[_0xe514('0x3a')];}}}else if(_0x267c83[_0xe514('0x20')]===0x0){_0x14a9be=CAMPAIGN_STATUS['NO_AGENTS_LOGGED'];}else if(!checkAnyValidTrunk(_0x267c83,_0x131681)){_0x14a9be=CAMPAIGN_STATUS[_0xe514('0x3b')];}else if(!isPreviewCampaign(_0x267c83)){var _0x3c09f5=checkAnyValidQueueCampaignInterval(_0x267c83);if(_0x3c09f5){_0x14a9be=_0x3c09f5;}}return _0x14a9be;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x18c164){var _0x56f7ca=CAMPAIGN_STATUS[_0xe514('0x3a')];if(_0x18c164[_0xe514('0x26')]===0x0&&_0x18c164[_0xe514('0x3c')]===0x0&&_0x18c164[_0xe514('0x24')]===0x0&&(_0x18c164['pTalking']||0x0)===0x0){_0x56f7ca=CAMPAIGN_STATUS[_0xe514('0x39')];}return _0x56f7ca;}exports[_0xe514('0x3d')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x57b62d){var _0xa32b49=_0x57b62d['match'](/"(.*?)"/);return _0xa32b49?_0xa32b49[0x1]:_0x57b62d;}exports[_0xe514('0x3e')]=extractCalleridName;function getCallerId(_0x2426d2,_0x1f6a5c,_0x678f17){if(!_[_0xe514('0x3f')](_0x678f17)&&typeof _0x678f17===_0xe514('0x40')&&!_[_0xe514('0x30')](_0x678f17)){if(!_[_0xe514('0x3f')](_0x1f6a5c)&&typeof _0x1f6a5c==='string'&&!_['isEmpty'](_0x1f6a5c)){return util['format']('\x22%s\x22\x20<%s>',_0x1f6a5c,_0x678f17);}return util[_0xe514('0x41')](_0xe514('0x42'),_0x678f17,_0x678f17);}if(!_['isUndefined'](_0x2426d2)&&typeof _0x2426d2===_0xe514('0x40')&&!_['isEmpty'](_0x2426d2)){return _0x2426d2;}return _0xe514('0x43');}exports[_0xe514('0x44')]=getCallerId;function getCallerIdRandom(_0x4432af,_0x28a36f){var _0x467482;var _0x508c8b;var _0x49c12c;if(_0x28a36f<=0x0){_0x28a36f=0x1;}_0x467482=new RegExp(_0xe514('0x45')+_0x28a36f+'}$');_0x508c8b=Math[_0xe514('0x46')](0xa,_0x28a36f-0x1);_0x49c12c=Math['pow'](0xa,_0x28a36f)-0x1;return util[_0xe514('0x41')]('%s',_[_0xe514('0x47')](_0x4432af,_0x467482,_[_0xe514('0x48')](_0x508c8b,_0x49c12c)[_0xe514('0x49')]()));}exports[_0xe514('0x4a')]=getCallerIdRandom;function decrementOriginate(_0x36fdd7){if(_0x36fdd7[_0xe514('0x26')]&&_0x36fdd7[_0xe514('0x26')]>0x0){_0x36fdd7[_0xe514('0x26')]-=0x1;}else{logger[_0xe514('0x4b')](_0xe514('0x4c'));}}exports[_0xe514('0x4d')]=decrementOriginate;function checkContactEmpty(_0x1ef7a7){return _0x1ef7a7&&_0x1ef7a7['length']>0x0;}exports[_0xe514('0x4e')]=checkContactEmpty;function erlangb(_0x5e1ad2,_0x551f75){if(_0x551f75===0x0){return 0x0;}var _0x5050d3=0x1;for(var _0x23583b=0x1;_0x23583b<=_0x551f75;_0x23583b+=0x1){_0x5050d3=0x1+_0x5050d3*_0x23583b/_0x5e1ad2;}return 0x1/_0x5050d3;}exports[_0xe514('0x4f')]=erlangb;function checkContactLowerLimitOriginate(_0x3c4acc,_0x5576a7,_0xe21890){if(_0x5576a7>_0xe21890){for(var _0x165a2b=0x0;_0x165a2b<_0x5576a7-_0xe21890;_0x165a2b+=0x1){decrementOriginate(_0x3c4acc);}}}exports[_0xe514('0x50')]=checkContactLowerLimitOriginate; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 0a5c84f..3ee4af7 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(_0x526589,_0x2a463f){var _0x2895e6=function(_0x598141){while(--_0x598141){_0x526589['push'](_0x526589['shift']());}};_0x2895e6(++_0x2a463f);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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(_0x391b67,_0x49ddd8){var _0x92d9d0=function(_0x3b3bad){while(--_0x3b3bad){_0x391b67['push'](_0x391b67['shift']());}};_0x92d9d0(++_0x49ddd8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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 68bb019..30e9199 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 _0x0fa5=['pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse','.pdf','application/pdf','notify','catch','error','stringify','merge','pick','response','reason','AttachmentId','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','checkTrunk','FaxAccountId','Trunk','Trunk\x20Reachable','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','trunks','format','reachable','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','fax','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','./rpcDb','./channel','./action','../rpc/faxMessage','channels','actions','syncNewchannel','bind','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','faxAccounts','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','hasOwnProperty','syncFaxStatus','operation','status','filename','\x20syncFaxStatus\x20','remotestationid'];(function(_0x29b205,_0x19d5a7){var _0x10b233=function(_0x57c0fe){while(--_0x57c0fe){_0x29b205['push'](_0x29b205['shift']());}};_0x10b233(++_0x19d5a7);}(_0x0fa5,0x132));var _0x50fa=function(_0x5e709a,_0x1d7975){_0x5e709a=_0x5e709a-0x0;var _0x57401a=_0x0fa5[_0x5e709a];return _0x57401a;};'use strict';var util=require(_0x50fa('0x0'));var _=require(_0x50fa('0x1'));var BPromise=require(_0x50fa('0x2'));var uuid=require(_0x50fa('0x3'));var moment=require(_0x50fa('0x4'));var path=require(_0x50fa('0x5'));var tiff2pdf=require(_0x50fa('0x6'));var gs=require(_0x50fa('0x7'));var logger=require(_0x50fa('0x8'))('fax');var ami=require('../ami');var rpcDb=require(_0x50fa('0x9'));var Channel=require(_0x50fa('0xa'));var ut=require('./util/util');var Action=require(_0x50fa('0xb'));var faxAccount=require('../rpc/faxAccount');var attachment=require('../rpc/attachment');var faxMessage=require(_0x50fa('0xc'));function Fax(_0x4c1368){this[_0x50fa('0xd')]={};this['faxAccounts']=_0x4c1368['faxAccounts'];this['trunks']=_0x4c1368['trunks'];this[_0x50fa('0xe')]={};ami['on']('newchannel',this[_0x50fa('0xf')][_0x50fa('0x10')](this));ami['on']('varset',this[_0x50fa('0x11')][_0x50fa('0x10')](this));ami['on'](_0x50fa('0x12'),this[_0x50fa('0x13')][_0x50fa('0x10')](this));ami['on'](_0x50fa('0x14'),this[_0x50fa('0x15')][_0x50fa('0x10')](this));ami['on'](_0x50fa('0x16'),this['syncFaxStatus']['bind'](this));ami['on'](_0x50fa('0x17'),this[_0x50fa('0x18')][_0x50fa('0x10')](this));ami['on'](_0x50fa('0x19'),this[_0x50fa('0x1a')][_0x50fa('0x10')](this));ami['on'](_0x50fa('0x1b'),this[_0x50fa('0x1c')][_0x50fa('0x10')](this));}Fax[_0x50fa('0x1d')][_0x50fa('0xf')]=function(_0x4475c2){if(_0x4475c2[_0x50fa('0x1e')]===_0x50fa('0x1f')){for(var _0x64142f in this['faxAccounts']){if(this[_0x50fa('0x20')]['hasOwnProperty'](_0x64142f)){if(_0x4475c2[_0x50fa('0x21')]===this['faxAccounts'][_0x64142f][_0x50fa('0x22')]){this[_0x50fa('0xd')][_0x4475c2['uniqueid']]={};this[_0x50fa('0xd')][_0x4475c2[_0x50fa('0x23')]][_0x50fa('0x24')]=_0x4475c2['channel'];this[_0x50fa('0xd')][_0x4475c2[_0x50fa('0x23')]]['id']=this[_0x50fa('0x20')][_0x64142f]['id'];this[_0x50fa('0xd')][_0x4475c2[_0x50fa('0x23')]][_0x50fa('0x25')]=this['faxAccounts'][_0x64142f][_0x50fa('0x25')];logger[_0x50fa('0x26')](_0x4475c2[_0x50fa('0x23')],_0x50fa('0x27'));}}}}if(this[_0x50fa('0xe')][_0x4475c2[_0x50fa('0x23')]]){this['channels'][_0x4475c2['uniqueid']]={};this['channels'][_0x4475c2[_0x50fa('0x23')]][_0x50fa('0x24')]=_0x4475c2['channel'];logger[_0x50fa('0x26')](_0x4475c2['uniqueid'],_0x50fa('0x27'));}};Fax[_0x50fa('0x1d')][_0x50fa('0x11')]=function(_0x2d7958){if(this[_0x50fa('0xd')][_0x2d7958[_0x50fa('0x23')]]){for(var _0x30e6ba in _0x2d7958[_0x50fa('0x28')]){if(_0x2d7958[_0x50fa('0x28')]['hasOwnProperty'](_0x30e6ba)){this[_0x50fa('0xd')][_0x2d7958[_0x50fa('0x23')]][_0x30e6ba]=_0x2d7958[_0x50fa('0x29')];}}}};Fax[_0x50fa('0x1d')][_0x50fa('0x13')]=function(_0x78931d){if(this['channels'][_0x78931d[_0x50fa('0x23')]]){this['channels'][_0x78931d[_0x50fa('0x23')]]['channelstate']=_0x78931d[_0x50fa('0x2a')];this[_0x50fa('0xd')][_0x78931d[_0x50fa('0x23')]][_0x50fa('0x2b')]=_0x78931d[_0x50fa('0x2b')];}};Fax[_0x50fa('0x1d')][_0x50fa('0x15')]=function(_0x1917c2){if(this[_0x50fa('0xd')][_0x1917c2[_0x50fa('0x23')]]){for(var _0x539dbc in _0x1917c2[_0x50fa('0x28')]){if(_0x1917c2[_0x50fa('0x28')][_0x50fa('0x2c')](_0x539dbc)){this[_0x50fa('0xd')][_0x1917c2['uniqueid']][_0x539dbc]=_0x1917c2['value'];}}}};Fax[_0x50fa('0x1d')][_0x50fa('0x2d')]=function(_0x362926){if(this[_0x50fa('0xd')][_0x362926[_0x50fa('0x23')]]){this[_0x50fa('0xd')][_0x362926['uniqueid']][_0x50fa('0x2e')]=_0x362926[_0x50fa('0x2e')];this['channels'][_0x362926[_0x50fa('0x23')]][_0x50fa('0x2f')]=_0x362926[_0x50fa('0x2f')];this[_0x50fa('0xd')][_0x362926['uniqueid']]['localstationid']=_0x362926[_0x50fa('0x22')];this[_0x50fa('0xd')][_0x362926[_0x50fa('0x23')]][_0x50fa('0x30')]=_0x362926[_0x50fa('0x30')];logger[_0x50fa('0x26')](_0x362926['uniqueid'],_0x50fa('0x31'));}};Fax['prototype'][_0x50fa('0x18')]=function(_0x63175c){var _0x1fa674=this;if(this[_0x50fa('0xd')][_0x63175c[_0x50fa('0x23')]]){var _0x28a80d=this['channels'][_0x63175c[_0x50fa('0x23')]]['id'];this[_0x50fa('0xd')][_0x63175c[_0x50fa('0x23')]][_0x50fa('0x32')]=_0x63175c['remotestationid'];this['channels'][_0x63175c[_0x50fa('0x23')]]['pagestransferred']=_0x63175c[_0x50fa('0x33')];this[_0x50fa('0xd')][_0x63175c['uniqueid']][_0x50fa('0x22')]=_0x63175c[_0x50fa('0x22')];this[_0x50fa('0xd')][_0x63175c[_0x50fa('0x23')]][_0x50fa('0x34')]=_0x63175c[_0x50fa('0x34')];this[_0x50fa('0xd')][_0x63175c[_0x50fa('0x23')]]['transferrate']=_0x63175c[_0x50fa('0x35')];this['channels'][_0x63175c[_0x50fa('0x23')]][_0x50fa('0x30')]=_0x63175c['filename'];this['channels'][_0x63175c[_0x50fa('0x23')]][_0x50fa('0x36')]=_0x63175c[_0x50fa('0x36')];if(this[_0x50fa('0xd')][_0x63175c[_0x50fa('0x23')]][_0x50fa('0x33')]>0x0){tiff2pdf(_0x63175c[_0x50fa('0x30')],_0x50fa('0x37'),function(_0x124e7d){logger[_0x50fa('0x26')](_0x63175c[_0x50fa('0x23')],'\x20result\x20conversion\x20file\x20',_0x124e7d[_0x50fa('0x38')]);attachment[_0x50fa('0x39')]({'name':path[_0x50fa('0x3a')](_0x63175c[_0x50fa('0x30')])[_0x50fa('0x25')],'basename':path[_0x50fa('0x3a')](_0x63175c[_0x50fa('0x30')])[_0x50fa('0x25')]+_0x50fa('0x3b'),'type':_0x50fa('0x3c')})['then'](function(_0x3c1934){faxAccount[_0x50fa('0x3d')](_0x28a80d,{'from':_0x63175c['calleridnum'],'mapKey':'fax','body':path[_0x50fa('0x3a')](_0x63175c[_0x50fa('0x30')])['name']+_0x50fa('0x3b'),'AttachmentId':_0x3c1934['id']})[_0x50fa('0x3e')](function(_0x2f7034){logger[_0x50fa('0x3f')](_0x63175c[_0x50fa('0x23')],'\x20notify\x20',JSON['stringify'](_0x2f7034));});})[_0x50fa('0x3e')](function(_0x477b14){logger[_0x50fa('0x3f')](_0x63175c[_0x50fa('0x23')],'\x20receiveFax\x20',JSON[_0x50fa('0x40')](_0x477b14));});});}logger['info'](_0x63175c['uniqueid'],'\x20receiveFax\x20');}};Fax[_0x50fa('0x1d')][_0x50fa('0x1c')]=function(_0x236fd6){if(this[_0x50fa('0xe')][_0x236fd6[_0x50fa('0x23')]]){_[_0x50fa('0x41')](this['channels'][_0x236fd6[_0x50fa('0x23')]],_[_0x50fa('0x42')](_0x236fd6,[_0x50fa('0x43'),_0x50fa('0x44')]));}};function updateStatus(_0x578e16){if(_0x578e16[_0x50fa('0x45')]){faxMessage['update'](_0x578e16[_0x50fa('0x45')],{'failMessage':_0x50fa('0x46')})[_0x50fa('0x47')](function(_0x592376){ut[_0x50fa('0x48')](_0x50fa('0x49'),_0x592376);})[_0x50fa('0x3e')](function(_0x318378){ut['logger'](_0x50fa('0x4a'),_0x318378);});}else{ut[_0x50fa('0x48')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x50fa('0x1d')]['updateStatus']=function(_0x452010,_0x2b63bc,_0x4d36db){var _0x3496c6=this;var _0x3b983a={};if(_0x2b63bc){_0x3b983a={'read':_0x2b63bc};}else{_0x3b983a={'failMessage':_0x4d36db};}if(this[_0x50fa('0xe')][_0x452010]['AttachmentId']){faxMessage[_0x50fa('0x4b')](this[_0x50fa('0xe')][_0x452010][_0x50fa('0x45')],_0x3b983a)['then'](function(_0x45063d){ut[_0x50fa('0x48')](_0x50fa('0x4c'),_0x45063d);})[_0x50fa('0x3e')](function(_0x2b2146){ut[_0x50fa('0x48')](_0x50fa('0x4d'),_0x2b2146);})[_0x50fa('0x4e')](function(){delete _0x3496c6['channels'][_0x452010];delete _0x3496c6[_0x50fa('0xe')][_0x452010];});}else{ut[_0x50fa('0x48')](_0x50fa('0x4f'));delete this[_0x50fa('0xd')][_0x452010];delete this[_0x50fa('0xe')][_0x452010];}};Fax[_0x50fa('0x1d')][_0x50fa('0x1a')]=function(_0x3a2e88){var _0x2db71e=this;if(this['channels'][_0x3a2e88[_0x50fa('0x23')]]){if(this['actions'][_0x3a2e88['uniqueid']]){this['channels'][_0x3a2e88['uniqueid']]['id']=this[_0x50fa('0xe')][_0x3a2e88[_0x50fa('0x23')]]['id'];this['channels'][_0x3a2e88[_0x50fa('0x23')]]['name']=this['actions'][_0x3a2e88[_0x50fa('0x23')]]['name'];}logger[_0x50fa('0x26')](_0x3a2e88[_0x50fa('0x23')],this['actions'][_0x3a2e88[_0x50fa('0x23')]]?_0x50fa('0x50'):_0x50fa('0x51'),JSON[_0x50fa('0x40')](this[_0x50fa('0xd')][_0x3a2e88['uniqueid']]));if(this[_0x50fa('0xe')][_0x3a2e88[_0x50fa('0x23')]]){if(this['channels'][_0x3a2e88[_0x50fa('0x23')]]['faxpages']>0x0&&this['channels'][_0x3a2e88['uniqueid']][_0x50fa('0x16')]===_0x50fa('0x52')){this[_0x50fa('0x53')](_0x3a2e88[_0x50fa('0x23')],!![]);}else{this['updateStatus'](_0x3a2e88[_0x50fa('0x23')],![],this[_0x50fa('0xd')][_0x3a2e88[_0x50fa('0x23')]][_0x50fa('0x54')]?_0x50fa('0x55')+this['channels'][_0x3a2e88[_0x50fa('0x23')]][_0x50fa('0x54')]:_0x50fa('0x56'));}}}};Fax[_0x50fa('0x1d')][_0x50fa('0x57')]=function(_0x130282){var _0x1ccf26=this;return new BPromise(function(_0xd7c8bf,_0x50b399){_0x1ccf26[_0x50fa('0x58')](_0x130282,_0x1ccf26[_0x50fa('0x20')][_0x130282['FaxAccountId']])[_0x50fa('0x47')](function(_0x39d32c){ut[_0x50fa('0x48')](_0x50fa('0x59'),_0x39d32c);_0xd7c8bf(ut['message'](_0x50fa('0x5a')));})[_0x50fa('0x3e')](function(_0x548caa){ut[_0x50fa('0x48')](_0x50fa('0x5b'),_0x548caa);updateStatus(_0x130282);_0x50b399(ut[_0x50fa('0x38')]('Fax\x20failed'));});});};Fax[_0x50fa('0x1d')]['checkAfterSend']=function(_0x2e6579){var _0x16a832=this;return new BPromise(function(_0x48ad2d,_0x343f1f){var _0x57762b=_0x16a832[_0x50fa('0x5c')](_0x16a832['faxAccounts'][_0x2e6579[_0x50fa('0x5d')]][_0x50fa('0x5e')],_0x2e6579);if(_0x57762b['isValid']){_0x48ad2d(ut[_0x50fa('0x38')](_0x50fa('0x5f')));}else{_0x343f1f(ut[_0x50fa('0x38')](_0x57762b[_0x50fa('0x38')]));}});};function originate(_0x183a22,_0x1d55a3,_0x56d1ff){return new BPromise(function(_0xaaed6a,_0x400205){if(_0x56d1ff){var _0x36ae91=util['format'](_0x50fa('0x60'),path[_0x50fa('0x3a')](_0x183a22[_0x50fa('0x5')])[_0x50fa('0x25')],_0x183a22['path']);gs[_0x50fa('0x61')](_0x36ae91)['then'](function(){_0x183a22['path']=util['format'](_0x50fa('0x62'),path[_0x50fa('0x3a')](_0x183a22[_0x50fa('0x5')])['dir'],path[_0x50fa('0x3a')](_0x183a22[_0x50fa('0x5')])[_0x50fa('0x25')]);_0x1d55a3[_0x50fa('0x63')]=_0x183a22[_0x50fa('0x5')];ut[_0x50fa('0x48')](_0x50fa('0x64'),'');ami[_0x50fa('0x65')](ut[_0x50fa('0x66')](_0x183a22,_0x1d55a3))['then'](function(_0x55a9cb){_0xaaed6a(_0x55a9cb);})[_0x50fa('0x3e')](function(_0x463a7a){_0x400205(_0x463a7a);});})['catch'](function(_0x158cd4){_0x400205(_0x158cd4);});}else{ami[_0x50fa('0x65')](ut['variablesAction'](_0x183a22,_0x1d55a3))['then'](function(_0x62ada2){_0xaaed6a(_0x62ada2);})[_0x50fa('0x3e')](function(_0x1f8962){_0x400205(_0x1f8962);});}});}Fax[_0x50fa('0x1d')][_0x50fa('0x58')]=function(_0x3c8ed5,_0xe3eb98){var _0xdf0333=this;return new BPromise(function(_0x4676e2,_0x444c8c){var _0x2c7f2d=uuid['v4']();var _0x2f6776=ut[_0x50fa('0x67')](_0x3c8ed5,_0xe3eb98);_0xdf0333[_0x50fa('0xe')][_0x2c7f2d]=new Action(_0x2c7f2d,_0xe3eb98,_0x3c8ed5);var _0x3081cd=_0xdf0333[_0x50fa('0xe')][_0x2c7f2d];if(path[_0x50fa('0x3a')](_0x3c8ed5[_0x50fa('0x5')])[_0x50fa('0x68')]==='.pdf'){originate(_0x3081cd,_0x2f6776,!![])['then'](function(_0x2b4610){_0x4676e2(_0x2b4610);})['catch'](function(_0x5e66e5){_0x444c8c(_0x5e66e5);});}else{originate(_0x3081cd,_0x2f6776,![])[_0x50fa('0x47')](function(_0x537072){_0x4676e2(_0x537072);})['catch'](function(_0x31209b){_0x444c8c(_0x31209b);});}});};Fax[_0x50fa('0x1d')][_0x50fa('0x69')]=function(_0x762fc4){return!_['isNil'](_0x762fc4)&&!_[_0x50fa('0x6a')](_0x762fc4[_0x50fa('0x25')])&&!_[_0x50fa('0x6a')](_0x762fc4['active'])&&_0x762fc4[_0x50fa('0x6b')]&&!_[_0x50fa('0x6a')](this['trunks'][util['format'](_0x50fa('0x6c'),_0x762fc4['name'])])&&!_[_0x50fa('0x6a')](this[_0x50fa('0x6d')][util['format'](_0x50fa('0x6c'),_0x762fc4[_0x50fa('0x25')])][_0x50fa('0x2f')])&&(this[_0x50fa('0x6d')][util[_0x50fa('0x6e')](_0x50fa('0x6c'),_0x762fc4[_0x50fa('0x25')])][_0x50fa('0x2f')]===_0x50fa('0x6f')||this[_0x50fa('0x6d')][util[_0x50fa('0x6e')]('SIP/%s',_0x762fc4[_0x50fa('0x25')])]['status']==='unmonitored');};Fax[_0x50fa('0x1d')][_0x50fa('0x5c')]=function(_0x5bf952,_0x7280a4){if(!this[_0x50fa('0x69')](_0x5bf952)){ut['logger']('[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]',_[_0x50fa('0x6a')](_0x5bf952)?'':_0x5bf952[_0x50fa('0x25')]+_0x50fa('0x70'));return{'isValid':![],'message':_0x50fa('0x71')};}if(_[_0x50fa('0x6a')](_0x7280a4[_0x50fa('0x72')])){ut[_0x50fa('0x48')](_0x50fa('0x73'),JSON[_0x50fa('0x40')](_0x7280a4));return{'isValid':![],'message':_0x50fa('0x74')};}if(_['isNil'](_0x7280a4[_0x50fa('0x5')])){ut[_0x50fa('0x48')](_0x50fa('0x75'),JSON['stringify'](_0x7280a4));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x50fa('0x76')]=Fax; \ No newline at end of file +var _0xf5e0=['pagestransferred','/var/opt/motion2/server/files/attachments/','message','create','parse','.pdf','application/pdf','then','notify','catch','\x20notify\x20','error','\x20receiveFax\x20','stringify','merge','response','reason','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','AttachmentId','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','faxpages','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','FaxAccountId','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','%s/%s.tif','Convert\x20pdf\x20to\x20tif','Action','variablesAction','isTrunkReachable','isNil','SIP/%s','reachable','unmonitored','checkTrunk','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','util','uuid','tiff2pdf','../../../config/logger','fax','../ami','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','syncOriginateResponse','prototype','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','filename','\x20syncFaxStatus\x20','remotestationid','resolution','transferrate','calleridnum'];(function(_0x4c7d8b,_0x572388){var _0x187158=function(_0x5e956d){while(--_0x5e956d){_0x4c7d8b['push'](_0x4c7d8b['shift']());}};_0x187158(++_0x572388);}(_0xf5e0,0xad));var _0x0f5e=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xf5e0[_0x57b54c];return _0x59cc19;};'use strict';var util=require(_0x0f5e('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0x0f5e('0x1'));var moment=require('moment');var path=require('path');var tiff2pdf=require(_0x0f5e('0x2'));var gs=require('./util/gs');var logger=require(_0x0f5e('0x3'))(_0x0f5e('0x4'));var ami=require(_0x0f5e('0x5'));var rpcDb=require('./rpcDb');var Channel=require(_0x0f5e('0x6'));var ut=require(_0x0f5e('0x7'));var Action=require(_0x0f5e('0x8'));var faxAccount=require(_0x0f5e('0x9'));var attachment=require(_0x0f5e('0xa'));var faxMessage=require(_0x0f5e('0xb'));function Fax(_0x408dcc){this[_0x0f5e('0xc')]={};this[_0x0f5e('0xd')]=_0x408dcc[_0x0f5e('0xd')];this['trunks']=_0x408dcc[_0x0f5e('0xe')];this[_0x0f5e('0xf')]={};ami['on'](_0x0f5e('0x10'),this[_0x0f5e('0x11')][_0x0f5e('0x12')](this));ami['on'](_0x0f5e('0x13'),this[_0x0f5e('0x14')][_0x0f5e('0x12')](this));ami['on'](_0x0f5e('0x15'),this[_0x0f5e('0x16')][_0x0f5e('0x12')](this));ami['on']('newexten',this[_0x0f5e('0x17')]['bind'](this));ami['on'](_0x0f5e('0x18'),this[_0x0f5e('0x19')][_0x0f5e('0x12')](this));ami['on'](_0x0f5e('0x1a'),this[_0x0f5e('0x1b')]['bind'](this));ami['on'](_0x0f5e('0x1c'),this[_0x0f5e('0x1d')]['bind'](this));ami['on']('originateresponse',this[_0x0f5e('0x1e')][_0x0f5e('0x12')](this));}Fax[_0x0f5e('0x1f')][_0x0f5e('0x11')]=function(_0x253f17){if(_0x253f17['context']===_0x0f5e('0x20')){for(var _0x36171f in this[_0x0f5e('0xd')]){if(this[_0x0f5e('0xd')][_0x0f5e('0x21')](_0x36171f)){if(_0x253f17[_0x0f5e('0x22')]===this['faxAccounts'][_0x36171f][_0x0f5e('0x23')]){this[_0x0f5e('0xc')][_0x253f17['uniqueid']]={};this['channels'][_0x253f17[_0x0f5e('0x24')]]['channel']=_0x253f17['channel'];this[_0x0f5e('0xc')][_0x253f17['uniqueid']]['id']=this[_0x0f5e('0xd')][_0x36171f]['id'];this[_0x0f5e('0xc')][_0x253f17['uniqueid']][_0x0f5e('0x25')]=this[_0x0f5e('0xd')][_0x36171f][_0x0f5e('0x25')];logger[_0x0f5e('0x26')](_0x253f17[_0x0f5e('0x24')],'\x20syncNewchannel\x20');}}}}if(this[_0x0f5e('0xf')][_0x253f17[_0x0f5e('0x24')]]){this[_0x0f5e('0xc')][_0x253f17[_0x0f5e('0x24')]]={};this[_0x0f5e('0xc')][_0x253f17[_0x0f5e('0x24')]]['channel']=_0x253f17['channel'];logger[_0x0f5e('0x26')](_0x253f17[_0x0f5e('0x24')],_0x0f5e('0x27'));}};Fax[_0x0f5e('0x1f')]['syncVarSet']=function(_0x1f53b8){if(this['channels'][_0x1f53b8[_0x0f5e('0x24')]]){for(var _0x5bb54e in _0x1f53b8[_0x0f5e('0x28')]){if(_0x1f53b8[_0x0f5e('0x28')][_0x0f5e('0x21')](_0x5bb54e)){this[_0x0f5e('0xc')][_0x1f53b8[_0x0f5e('0x24')]][_0x5bb54e]=_0x1f53b8[_0x0f5e('0x29')];}}}};Fax['prototype'][_0x0f5e('0x16')]=function(_0x2a9d8f){if(this[_0x0f5e('0xc')][_0x2a9d8f[_0x0f5e('0x24')]]){this[_0x0f5e('0xc')][_0x2a9d8f[_0x0f5e('0x24')]][_0x0f5e('0x2a')]=_0x2a9d8f[_0x0f5e('0x2a')];this[_0x0f5e('0xc')][_0x2a9d8f[_0x0f5e('0x24')]][_0x0f5e('0x2b')]=_0x2a9d8f[_0x0f5e('0x2b')];}};Fax[_0x0f5e('0x1f')]['syncNewExten']=function(_0xabec4a){if(this[_0x0f5e('0xc')][_0xabec4a[_0x0f5e('0x24')]]){for(var _0x5251c3 in _0xabec4a[_0x0f5e('0x28')]){if(_0xabec4a['variable'][_0x0f5e('0x21')](_0x5251c3)){this[_0x0f5e('0xc')][_0xabec4a[_0x0f5e('0x24')]][_0x5251c3]=_0xabec4a['value'];}}}};Fax[_0x0f5e('0x1f')]['syncFaxStatus']=function(_0x5522aa){if(this['channels'][_0x5522aa[_0x0f5e('0x24')]]){this['channels'][_0x5522aa[_0x0f5e('0x24')]][_0x0f5e('0x2c')]=_0x5522aa[_0x0f5e('0x2c')];this[_0x0f5e('0xc')][_0x5522aa['uniqueid']]['status']=_0x5522aa['status'];this[_0x0f5e('0xc')][_0x5522aa[_0x0f5e('0x24')]][_0x0f5e('0x23')]=_0x5522aa[_0x0f5e('0x23')];this[_0x0f5e('0xc')][_0x5522aa[_0x0f5e('0x24')]][_0x0f5e('0x2d')]=_0x5522aa['filename'];logger[_0x0f5e('0x26')](_0x5522aa[_0x0f5e('0x24')],_0x0f5e('0x2e'));}};Fax['prototype'][_0x0f5e('0x1b')]=function(_0x24c888){var _0x5a5c44=this;if(this[_0x0f5e('0xc')][_0x24c888[_0x0f5e('0x24')]]){var _0xc7d79c=this[_0x0f5e('0xc')][_0x24c888[_0x0f5e('0x24')]]['id'];this['channels'][_0x24c888['uniqueid']][_0x0f5e('0x2f')]=_0x24c888[_0x0f5e('0x2f')];this[_0x0f5e('0xc')][_0x24c888[_0x0f5e('0x24')]]['pagestransferred']=_0x24c888['pagestransferred'];this[_0x0f5e('0xc')][_0x24c888[_0x0f5e('0x24')]][_0x0f5e('0x23')]=_0x24c888['localstationid'];this[_0x0f5e('0xc')][_0x24c888[_0x0f5e('0x24')]][_0x0f5e('0x30')]=_0x24c888[_0x0f5e('0x30')];this[_0x0f5e('0xc')][_0x24c888[_0x0f5e('0x24')]][_0x0f5e('0x31')]=_0x24c888[_0x0f5e('0x31')];this[_0x0f5e('0xc')][_0x24c888[_0x0f5e('0x24')]][_0x0f5e('0x2d')]=_0x24c888[_0x0f5e('0x2d')];this[_0x0f5e('0xc')][_0x24c888['uniqueid']][_0x0f5e('0x32')]=_0x24c888[_0x0f5e('0x32')];if(this[_0x0f5e('0xc')][_0x24c888[_0x0f5e('0x24')]][_0x0f5e('0x33')]>0x0){tiff2pdf(_0x24c888[_0x0f5e('0x2d')],_0x0f5e('0x34'),function(_0x3593a2){logger[_0x0f5e('0x26')](_0x24c888[_0x0f5e('0x24')],'\x20result\x20conversion\x20file\x20',_0x3593a2[_0x0f5e('0x35')]);attachment[_0x0f5e('0x36')]({'name':path['parse'](_0x24c888[_0x0f5e('0x2d')])[_0x0f5e('0x25')],'basename':path[_0x0f5e('0x37')](_0x24c888['filename'])['name']+_0x0f5e('0x38'),'type':_0x0f5e('0x39')})[_0x0f5e('0x3a')](function(_0x53943d){faxAccount[_0x0f5e('0x3b')](_0xc7d79c,{'from':_0x24c888[_0x0f5e('0x32')],'mapKey':'fax','body':path[_0x0f5e('0x37')](_0x24c888[_0x0f5e('0x2d')])['name']+_0x0f5e('0x38'),'AttachmentId':_0x53943d['id']})[_0x0f5e('0x3c')](function(_0x401f08){logger['error'](_0x24c888[_0x0f5e('0x24')],_0x0f5e('0x3d'),JSON['stringify'](_0x401f08));});})[_0x0f5e('0x3c')](function(_0x516155){logger[_0x0f5e('0x3e')](_0x24c888[_0x0f5e('0x24')],_0x0f5e('0x3f'),JSON[_0x0f5e('0x40')](_0x516155));});});}logger[_0x0f5e('0x26')](_0x24c888[_0x0f5e('0x24')],_0x0f5e('0x3f'));}};Fax['prototype'][_0x0f5e('0x1e')]=function(_0x4e5691){if(this[_0x0f5e('0xf')][_0x4e5691['uniqueid']]){_[_0x0f5e('0x41')](this[_0x0f5e('0xc')][_0x4e5691['uniqueid']],_['pick'](_0x4e5691,[_0x0f5e('0x42'),_0x0f5e('0x43')]));}};function updateStatus(_0x5bdfeb){if(_0x5bdfeb['AttachmentId']){faxMessage[_0x0f5e('0x44')](_0x5bdfeb['AttachmentId'],{'failMessage':_0x0f5e('0x45')})[_0x0f5e('0x3a')](function(_0x17df7a){ut[_0x0f5e('0x46')](_0x0f5e('0x47'),_0x17df7a);})[_0x0f5e('0x3c')](function(_0x1a4b00){ut['logger']('[Fax][Message][Error][NoUpdate1]',_0x1a4b00);});}else{ut[_0x0f5e('0x46')](_0x0f5e('0x48'));}}Fax[_0x0f5e('0x1f')]['updateStatus']=function(_0x31f235,_0x2c33d9,_0x5eb4ad){var _0x1b39aa=this;var _0x466e1e={};if(_0x2c33d9){_0x466e1e={'read':_0x2c33d9};}else{_0x466e1e={'failMessage':_0x5eb4ad};}if(this[_0x0f5e('0xf')][_0x31f235][_0x0f5e('0x49')]){faxMessage[_0x0f5e('0x44')](this[_0x0f5e('0xf')][_0x31f235][_0x0f5e('0x49')],_0x466e1e)['then'](function(_0x18e0b1){ut[_0x0f5e('0x46')](_0x0f5e('0x4a'),_0x18e0b1);})[_0x0f5e('0x3c')](function(_0x32a048){ut['logger'](_0x0f5e('0x4b'),_0x32a048);})[_0x0f5e('0x4c')](function(){delete _0x1b39aa[_0x0f5e('0xc')][_0x31f235];delete _0x1b39aa[_0x0f5e('0xf')][_0x31f235];});}else{ut[_0x0f5e('0x46')](_0x0f5e('0x4d'));delete this[_0x0f5e('0xc')][_0x31f235];delete this[_0x0f5e('0xf')][_0x31f235];}};Fax[_0x0f5e('0x1f')]['syncHangup']=function(_0x1b55c1){var _0x369407=this;if(this[_0x0f5e('0xc')][_0x1b55c1[_0x0f5e('0x24')]]){if(this[_0x0f5e('0xf')][_0x1b55c1['uniqueid']]){this[_0x0f5e('0xc')][_0x1b55c1[_0x0f5e('0x24')]]['id']=this[_0x0f5e('0xf')][_0x1b55c1[_0x0f5e('0x24')]]['id'];this[_0x0f5e('0xc')][_0x1b55c1['uniqueid']][_0x0f5e('0x25')]=this['actions'][_0x1b55c1['uniqueid']][_0x0f5e('0x25')];}logger[_0x0f5e('0x26')](_0x1b55c1[_0x0f5e('0x24')],this[_0x0f5e('0xf')][_0x1b55c1[_0x0f5e('0x24')]]?_0x0f5e('0x4e'):'\x20hangup\x20faxRiceive\x20',JSON[_0x0f5e('0x40')](this[_0x0f5e('0xc')][_0x1b55c1['uniqueid']]));if(this[_0x0f5e('0xf')][_0x1b55c1['uniqueid']]){if(this[_0x0f5e('0xc')][_0x1b55c1['uniqueid']][_0x0f5e('0x4f')]>0x0&&this[_0x0f5e('0xc')][_0x1b55c1['uniqueid']][_0x0f5e('0x18')]==='SUCCESS'){this[_0x0f5e('0x50')](_0x1b55c1['uniqueid'],!![]);}else{this[_0x0f5e('0x50')](_0x1b55c1[_0x0f5e('0x24')],![],this[_0x0f5e('0xc')][_0x1b55c1['uniqueid']][_0x0f5e('0x51')]?_0x0f5e('0x52')+this['channels'][_0x1b55c1[_0x0f5e('0x24')]]['faxstatusstring']:_0x0f5e('0x53'));}}}};Fax[_0x0f5e('0x1f')]['send']=function(_0x19f712){var _0x3acebd=this;return new BPromise(function(_0x491e4a,_0x50094f){_0x3acebd[_0x0f5e('0x54')](_0x19f712,_0x3acebd[_0x0f5e('0xd')][_0x19f712[_0x0f5e('0x55')]])[_0x0f5e('0x3a')](function(_0x36ca50){ut['logger'](_0x0f5e('0x56'),_0x36ca50);_0x491e4a(ut[_0x0f5e('0x35')]('Fax\x20received'));})[_0x0f5e('0x3c')](function(_0x5e5593){ut['logger'](_0x0f5e('0x57'),_0x5e5593);updateStatus(_0x19f712);_0x50094f(ut[_0x0f5e('0x35')](_0x0f5e('0x58')));});});};Fax['prototype'][_0x0f5e('0x59')]=function(_0x250eb2){var _0x1f1673=this;return new BPromise(function(_0x41cff6,_0x3ab1d8){var _0x475087=_0x1f1673['checkTrunk'](_0x1f1673[_0x0f5e('0xd')][_0x250eb2[_0x0f5e('0x55')]][_0x0f5e('0x5a')],_0x250eb2);if(_0x475087[_0x0f5e('0x5b')]){_0x41cff6(ut[_0x0f5e('0x35')](_0x0f5e('0x5c')));}else{_0x3ab1d8(ut[_0x0f5e('0x35')](_0x475087[_0x0f5e('0x35')]));}});};function originate(_0x2dbb1a,_0x46c282,_0x3033c7){return new BPromise(function(_0x185d50,_0x15ee9b){if(_0x3033c7){var _0x15bee6=util[_0x0f5e('0x5d')](_0x0f5e('0x5e'),path['parse'](_0x2dbb1a[_0x0f5e('0x5f')])[_0x0f5e('0x25')],_0x2dbb1a['path']);gs[_0x0f5e('0x60')](_0x15bee6)[_0x0f5e('0x3a')](function(){_0x2dbb1a['path']=util['format'](_0x0f5e('0x61'),path[_0x0f5e('0x37')](_0x2dbb1a[_0x0f5e('0x5f')])['dir'],path[_0x0f5e('0x37')](_0x2dbb1a[_0x0f5e('0x5f')])['name']);_0x46c282['XMF-PATH']=_0x2dbb1a[_0x0f5e('0x5f')];ut[_0x0f5e('0x46')](_0x0f5e('0x62'),'');ami[_0x0f5e('0x63')](ut['variablesAction'](_0x2dbb1a,_0x46c282))['then'](function(_0x4fa287){_0x185d50(_0x4fa287);})[_0x0f5e('0x3c')](function(_0x179daa){_0x15ee9b(_0x179daa);});})[_0x0f5e('0x3c')](function(_0x555077){_0x15ee9b(_0x555077);});}else{ami[_0x0f5e('0x63')](ut[_0x0f5e('0x64')](_0x2dbb1a,_0x46c282))[_0x0f5e('0x3a')](function(_0x102562){_0x185d50(_0x102562);})[_0x0f5e('0x3c')](function(_0x582c36){_0x15ee9b(_0x582c36);});}});}Fax[_0x0f5e('0x1f')]['execOriginate']=function(_0x287fa6,_0x5f3f18){var _0x3e10ce=this;return new BPromise(function(_0x162838,_0x3b96e2){var _0x8795b=uuid['v4']();var _0x37f0a5=ut['addVariables'](_0x287fa6,_0x5f3f18);_0x3e10ce['actions'][_0x8795b]=new Action(_0x8795b,_0x5f3f18,_0x287fa6);var _0x567719=_0x3e10ce[_0x0f5e('0xf')][_0x8795b];if(path['parse'](_0x287fa6[_0x0f5e('0x5f')])['ext']==='.pdf'){originate(_0x567719,_0x37f0a5,!![])['then'](function(_0x457d29){_0x162838(_0x457d29);})['catch'](function(_0x1d5289){_0x3b96e2(_0x1d5289);});}else{originate(_0x567719,_0x37f0a5,![])['then'](function(_0x3b07da){_0x162838(_0x3b07da);})[_0x0f5e('0x3c')](function(_0x32152f){_0x3b96e2(_0x32152f);});}});};Fax['prototype'][_0x0f5e('0x65')]=function(_0x599cba){return!_[_0x0f5e('0x66')](_0x599cba)&&!_[_0x0f5e('0x66')](_0x599cba['name'])&&!_[_0x0f5e('0x66')](_0x599cba['active'])&&_0x599cba['active']&&!_['isNil'](this['trunks'][util[_0x0f5e('0x5d')](_0x0f5e('0x67'),_0x599cba[_0x0f5e('0x25')])])&&!_[_0x0f5e('0x66')](this[_0x0f5e('0xe')][util[_0x0f5e('0x5d')](_0x0f5e('0x67'),_0x599cba[_0x0f5e('0x25')])]['status'])&&(this['trunks'][util[_0x0f5e('0x5d')](_0x0f5e('0x67'),_0x599cba['name'])]['status']===_0x0f5e('0x68')||this[_0x0f5e('0xe')][util['format'](_0x0f5e('0x67'),_0x599cba[_0x0f5e('0x25')])]['status']===_0x0f5e('0x69'));};Fax[_0x0f5e('0x1f')][_0x0f5e('0x6a')]=function(_0x1c77e,_0xce46f6){if(!this['isTrunkReachable'](_0x1c77e)){ut[_0x0f5e('0x46')]('[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]',_[_0x0f5e('0x66')](_0x1c77e)?'':_0x1c77e[_0x0f5e('0x25')]+_0x0f5e('0x6b'));return{'isValid':![],'message':_0x0f5e('0x6c')};}if(_[_0x0f5e('0x66')](_0xce46f6[_0x0f5e('0x4')])){ut[_0x0f5e('0x46')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x0f5e('0x40')](_0xce46f6));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x0f5e('0x66')](_0xce46f6['path'])){ut[_0x0f5e('0x46')](_0x0f5e('0x6d'),JSON[_0x0f5e('0x40')](_0xce46f6));return{'isValid':![],'message':_0x0f5e('0x6e')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x0f5e('0x6f')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index fd45d43..accdc27 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 _0xb6ba=['inspect','util','preview','lodash','../rpc/faxAccount'];(function(_0x1bacf3,_0x17ba1b){var _0x48eedb=function(_0x4eabec){while(--_0x4eabec){_0x1bacf3['push'](_0x1bacf3['shift']());}};_0x48eedb(++_0x17ba1b);}(_0xb6ba,0x65));var _0xab6b=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xb6ba[_0x23e7c1];return _0x1add43;};'use strict';var util=require(_0xab6b('0x0'));var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0xab6b('0x1'));var _=require(_0xab6b('0x2'));var faxAccount=require(_0xab6b('0x3'));function loggerCatch(_0x116fe9){return function(_0x373f7e){logger['error'](_0x116fe9,util[_0xab6b('0x4')](_0x373f7e,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x2e0f8f,_0x21fdba){return BPromise['resolve']()['then'](faxAccount['notify'](_0x2e0f8f,_0x21fdba))['catch'](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0xf095=['notify','then','catch','util','../../../config/logger','preview','../rpc/faxAccount','inspect'];(function(_0x4506ee,_0x468b38){var _0x13abac=function(_0x37b798){while(--_0x37b798){_0x4506ee['push'](_0x4506ee['shift']());}};_0x13abac(++_0x468b38);}(_0xf095,0x16b));var _0x5f09=function(_0x7c0032,_0x9b832d){_0x7c0032=_0x7c0032-0x0;var _0x225fb5=_0xf095[_0x7c0032];return _0x225fb5;};'use strict';var util=require(_0x5f09('0x0'));var BPromise=require('bluebird');var logger=require(_0x5f09('0x1'))(_0x5f09('0x2'));var _=require('lodash');var faxAccount=require(_0x5f09('0x3'));function loggerCatch(_0x37167c){return function(_0x149dda){logger['error'](_0x37167c,util[_0x5f09('0x4')](_0x149dda,{'showHidden':![],'depth':null}));};}exports[_0x5f09('0x5')]=function(_0x3090b3,_0x15a110){return BPromise['resolve']()[_0x5f09('0x6')](faxAccount[_0x5f09('0x5')](_0x3090b3,_0x15a110))[_0x5f09('0x7')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index f3544f7..63c8f5c 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 _0xfb23=['../../../../config/logger','fax','bluebird','child_process','Exec\x20gs','inspect','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfb23,0x68));var _0x3fb2=function(_0x1641c9,_0x24ad29){_0x1641c9=_0x1641c9-0x0;var _0xa46bb6=_0xfb23[_0x1641c9];return _0xa46bb6;};'use strict';var util=require(_0x3fb2('0x0'));var logger=require(_0x3fb2('0x1'))(_0x3fb2('0x2'));var BPromise=require(_0x3fb2('0x3'));var exec=require(_0x3fb2('0x4'))['exec'];exports['execute']=function(_0x11c614){return new BPromise(function(_0x23a8a2,_0x11596c){exec(_0x11c614,function(_0x3ac009,_0x5c9570,_0x47b11a){logger['info'](_0x3fb2('0x5'),_0x5c9570);if(_0x3ac009){logger['info'](_0x3fb2('0x5'),'\x20Error\x20:',util[_0x3fb2('0x6')](_0x3ac009,{'showHidden':![],'depth':null}),_0x5c9570,_0x47b11a);_0x11596c(_0x3ac009);}_0x23a8a2(_0x5c9570);});});}; \ No newline at end of file +var _0xd0ea=['inspect','util','../../../../config/logger','bluebird','child_process','exec','execute','Exec\x20gs','info'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd0ea,0x1b1));var _0xad0e=function(_0x4d9c3b,_0x3c4663){_0x4d9c3b=_0x4d9c3b-0x0;var _0x35c391=_0xd0ea[_0x4d9c3b];return _0x35c391;};'use strict';var util=require(_0xad0e('0x0'));var logger=require(_0xad0e('0x1'))('fax');var BPromise=require(_0xad0e('0x2'));var exec=require(_0xad0e('0x3'))[_0xad0e('0x4')];exports[_0xad0e('0x5')]=function(_0x56a3f6){return new BPromise(function(_0x2bc063,_0x3ae9e7){exec(_0x56a3f6,function(_0x30fff0,_0x58b964,_0xdd3127){logger['info'](_0xad0e('0x6'),_0x58b964);if(_0x30fff0){logger[_0xad0e('0x7')](_0xad0e('0x6'),'\x20Error\x20:',util[_0xad0e('0x8')](_0x30fff0,{'showHidden':![],'depth':null}),_0x58b964,_0xdd3127);_0x3ae9e7(_0x30fff0);}_0x2bc063(_0x58b964);});});}; \ 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 4aa3b04..6abb8b2 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 _0xff34=['lodash','../../../../config/logger','fax','message','logger','info','addVariables','headerinfo','minrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>'];(function(_0x463123,_0x5ca25b){var _0x462071=function(_0x5ba258){while(--_0x5ba258){_0x463123['push'](_0x463123['shift']());}};_0x462071(++_0x5ca25b);}(_0xff34,0x150));var _0x4ff3=function(_0xc4376d,_0x2e6841){_0xc4376d=_0xc4376d-0x0;var _0x291524=_0xff34[_0xc4376d];return _0x291524;};'use strict';var util=require('util');var _=require(_0x4ff3('0x0'));var moment=require('moment');var logger=require(_0x4ff3('0x1'))(_0x4ff3('0x2'));exports[_0x4ff3('0x3')]=function(_0x83b0e2){return{'message':_0x83b0e2};};exports[_0x4ff3('0x4')]=function(_0x472c97,_0x5e4614){logger[_0x4ff3('0x5')](_0x472c97,util['inspect'](_0x5e4614,{'showHidden':![],'depth':null}));};exports[_0x4ff3('0x6')]=function(_0x3c9be5,_0x467e62){var _0x2c83da={'XMF-ECM':_0x467e62['ecm'],'XMF-HEADERINFO':_0x467e62[_0x4ff3('0x7')],'XMF-MINRATE':_0x467e62[_0x4ff3('0x8')],'XMF-MAXRATE':_0x467e62['maxrate'],'XMF-MODEM':util[_0x4ff3('0x9')](_0x4ff3('0xa'),_0x467e62[_0x4ff3('0xb')]),'XMF-GATEWAY':_0x467e62[_0x4ff3('0xc')],'XMF-FAXDETECT':_0x467e62[_0x4ff3('0xd')],'XMF-T38TIMEOUT':_0x467e62[_0x4ff3('0xe')],'XMF-LOCALSTATIONID':_0x467e62[_0x4ff3('0xf')],'XMF-PATH':_0x3c9be5[_0x4ff3('0x10')]};return _0x2c83da;};exports[_0x4ff3('0x11')]=function(_0x2178a1,_0x59c75e){return{'actionid':_0x2178a1[_0x4ff3('0x12')],'action':_0x4ff3('0x13'),'channel':_0x2178a1[_0x4ff3('0x14')],'Exten':_0x4ff3('0x15'),'Context':_0x4ff3('0x16'),'Priority':'1','callerid':util[_0x4ff3('0x9')](_0x4ff3('0x17'),_0x2178a1[_0x4ff3('0x7')]?_0x2178a1[_0x4ff3('0x7')]:'',_0x2178a1[_0x4ff3('0xf')]),'variable':_0x59c75e,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x2178a1['uniqueid']};}; \ No newline at end of file +var _0xc261=['localstationid','path','variablesAction','originate','channel','xcally-motion-fax','from-sip','util','lodash','moment','../../../../config/logger','fax','logger','info','inspect','addVariables','ecm','headerinfo','minrate','format','\x22%s\x22','modem','faxdetect','t38timeout'];(function(_0x34379b,_0x2b55da){var _0x4c80c5=function(_0x44ac5d){while(--_0x44ac5d){_0x34379b['push'](_0x34379b['shift']());}};_0x4c80c5(++_0x2b55da);}(_0xc261,0x1b7));var _0x1c26=function(_0x280eb9,_0x215d61){_0x280eb9=_0x280eb9-0x0;var _0x407e00=_0xc261[_0x280eb9];return _0x407e00;};'use strict';var util=require(_0x1c26('0x0'));var _=require(_0x1c26('0x1'));var moment=require(_0x1c26('0x2'));var logger=require(_0x1c26('0x3'))(_0x1c26('0x4'));exports['message']=function(_0x5debed){return{'message':_0x5debed};};exports[_0x1c26('0x5')]=function(_0x599e52,_0x45ed01){logger[_0x1c26('0x6')](_0x599e52,util[_0x1c26('0x7')](_0x45ed01,{'showHidden':![],'depth':null}));};exports[_0x1c26('0x8')]=function(_0x4a5e6e,_0x5083b9){var _0x171aee={'XMF-ECM':_0x5083b9[_0x1c26('0x9')],'XMF-HEADERINFO':_0x5083b9[_0x1c26('0xa')],'XMF-MINRATE':_0x5083b9[_0x1c26('0xb')],'XMF-MAXRATE':_0x5083b9['maxrate'],'XMF-MODEM':util[_0x1c26('0xc')](_0x1c26('0xd'),_0x5083b9[_0x1c26('0xe')]),'XMF-GATEWAY':_0x5083b9['gateway'],'XMF-FAXDETECT':_0x5083b9[_0x1c26('0xf')],'XMF-T38TIMEOUT':_0x5083b9[_0x1c26('0x10')],'XMF-LOCALSTATIONID':_0x5083b9[_0x1c26('0x11')],'XMF-PATH':_0x4a5e6e[_0x1c26('0x12')]};return _0x171aee;};exports[_0x1c26('0x13')]=function(_0x256339,_0x349580){return{'actionid':_0x256339['uniqueid'],'action':_0x1c26('0x14'),'channel':_0x256339[_0x1c26('0x15')],'Exten':_0x1c26('0x16'),'Context':_0x1c26('0x17'),'Priority':'1','callerid':util[_0x1c26('0xc')]('\x22%s\x22\x20<%s>',_0x256339['headerinfo']?_0x256339[_0x1c26('0xa')]:'',_0x256339[_0x1c26('0x11')]),'variable':_0x349580,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x256339['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index e8f233d..955d026 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 _0xcade=['./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/servicenow','../../config/logger','ami','hour','get','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','listen','sync','[index.js][main]','inspect','util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user'];(function(_0x15d668,_0x322ee5){var _0x595232=function(_0x3ef2e8){while(--_0x3ef2e8){_0x15d668['push'](_0x15d668['shift']());}};_0x595232(++_0x322ee5);}(_0xcade,0x1b7));var _0xecad=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcade[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xecad('0x0'));var moment=require(_0xecad('0x1'));var server=require(_0xecad('0x2'));var Realtime=require(_0xecad('0x3'));var Report=require(_0xecad('0x4'));var Acw=require(_0xecad('0x5'));var Trigger=require(_0xecad('0x6'));var Dialer=require(_0xecad('0x7'));var Preview=require(_0xecad('0x8'));var Fax=require(_0xecad('0x9'));var user=require(_0xecad('0xa'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0xecad('0xb'));var voiceCallReport=require(_0xecad('0xc'));var trunk=require(_0xecad('0xd'));var trigger=require(_0xecad('0xe'));var template=require(_0xecad('0xf'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0xecad('0x10'));var voiceExtension=require(_0xecad('0x11'));var faxAccount=require(_0xecad('0x12'));var zendesk=require(_0xecad('0x13'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xecad('0x14'));var freshdesk=require(_0xecad('0x15'));var desk=require(_0xecad('0x16'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0xecad('0x17'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0xecad('0x18'));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(_0xecad('0x19'))(_0xecad('0x1a'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0xecad('0x1b'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xecad('0x1c')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0xecad('0x1d')]()[_0xecad('0x1e')](user[_0xecad('0x1f')]())[_0xecad('0x1e')](realtime[_0xecad('0x20')]())[_0xecad('0x1e')](user[_0xecad('0x21')]())['then'](realtime[_0xecad('0x22')]())[_0xecad('0x1e')](trunk[_0xecad('0x23')]())[_0xecad('0x1e')](realtime[_0xecad('0x24')]())[_0xecad('0x1e')](voiceQueue[_0xecad('0x25')]())[_0xecad('0x1e')](realtime['initVoiceQueues']())['then'](trigger[_0xecad('0x26')]())['then'](realtime[_0xecad('0x27')]())[_0xecad('0x1e')](template[_0xecad('0x28')]())[_0xecad('0x1e')](realtime[_0xecad('0x29')]())['then'](zendesk[_0xecad('0x2a')]())[_0xecad('0x1e')](realtime[_0xecad('0x2b')]())[_0xecad('0x1e')](salesforce[_0xecad('0x2c')]())[_0xecad('0x1e')](realtime[_0xecad('0x2d')]())[_0xecad('0x1e')](sugarcrm['getSugarcrmAccounts']())['then'](realtime[_0xecad('0x2e')]())['then'](freshdesk[_0xecad('0x2f')]())['then'](realtime['initFreshdeskAccounts']())['then'](desk[_0xecad('0x30')]())[_0xecad('0x1e')](realtime[_0xecad('0x31')]())[_0xecad('0x1e')](zoho[_0xecad('0x32')]())[_0xecad('0x1e')](realtime[_0xecad('0x33')]())[_0xecad('0x1e')](vtiger['getVtigerAccounts']())['then'](realtime[_0xecad('0x34')]())[_0xecad('0x1e')](freshsales[_0xecad('0x35')]())['then'](realtime['initFreshsalesAccounts']())['then'](servicenow['getServicenowAccounts']())['then'](realtime['initServicenowAccounts']())['then'](dynamics365[_0xecad('0x36')]())[_0xecad('0x1e')](realtime[_0xecad('0x37')]())['then'](campaign[_0xecad('0x38')]())[_0xecad('0x1e')](realtime['initCampaigns']())[_0xecad('0x1e')](voiceExtension[_0xecad('0x39')]())[_0xecad('0x1e')](realtime[_0xecad('0x3a')]())[_0xecad('0x1e')](faxAccount[_0xecad('0x3b')]())[_0xecad('0x1e')](realtime[_0xecad('0x3c')]())[_0xecad('0x1e')](function(){return realtime;});}function initParams(){return Promise['resolve']()[_0xecad('0x1e')](voiceQueueReport[_0xecad('0x3d')]())[_0xecad('0x1e')](realtime[_0xecad('0x3e')]())[_0xecad('0x1e')](cmHopperHistory[_0xecad('0x3f')]())[_0xecad('0x1e')](realtime[_0xecad('0x40')]())[_0xecad('0x1e')](cmHopperHistory[_0xecad('0x41')]())['then'](realtime[_0xecad('0x42')]())['then'](voiceCallReport[_0xecad('0x43')]())[_0xecad('0x1e')](realtime[_0xecad('0x44')]())[_0xecad('0x45')](function(_0x596638){logger[_0xecad('0x46')]('[index.js][initParams]',util['inspect'](_0x596638,{'showHidden':![],'depth':null}));});}function main(){return server[_0xecad('0x47')](realtime,preview,fax)[_0xecad('0x1e')](function(){return initRealtime();})[_0xecad('0x1e')](function(){return initParams();})[_0xecad('0x1e')](function(){report[_0xecad('0x48')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x1e6571){logger['error'](_0xecad('0x49'),util[_0xecad('0x4a')](_0x1e6571,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x3f11=['getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getFreshsalesAccounts','initFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','util','./report','./acw','./dialer','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','../../config/logger','ami','get','hour','resolve','getAgents','then','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts'];(function(_0x187efb,_0xcaa75){var _0x4d72f9=function(_0x2d9697){while(--_0x2d9697){_0x187efb['push'](_0x187efb['shift']());}};_0x4d72f9(++_0xcaa75);}(_0x3f11,0x6c));var _0x13f1=function(_0x1b0158,_0x52a68e){_0x1b0158=_0x1b0158-0x0;var _0x191317=_0x3f11[_0x1b0158];return _0x191317;};'use strict';var util=require(_0x13f1('0x0'));var moment=require('moment');var server=require('./server');var Realtime=require('./realtime');var Report=require(_0x13f1('0x1'));var Acw=require(_0x13f1('0x2'));var Trigger=require('./trigger');var Dialer=require(_0x13f1('0x3'));var Preview=require('./preview');var Fax=require(_0x13f1('0x4'));var user=require(_0x13f1('0x5'));var voiceQueue=require(_0x13f1('0x6'));var voiceQueueReport=require(_0x13f1('0x7'));var voiceCallReport=require(_0x13f1('0x8'));var trunk=require(_0x13f1('0x9'));var trigger=require(_0x13f1('0xa'));var template=require(_0x13f1('0xb'));var cmHopperHistory=require(_0x13f1('0xc'));var campaign=require(_0x13f1('0xd'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x13f1('0xe'));var zendesk=require(_0x13f1('0xf'));var salesforce=require(_0x13f1('0x10'));var sugarcrm=require(_0x13f1('0x11'));var freshdesk=require(_0x13f1('0x12'));var desk=require(_0x13f1('0x13'));var zoho=require(_0x13f1('0x14'));var vtiger=require(_0x13f1('0x15'));var freshsales=require(_0x13f1('0x16'));var servicenow=require(_0x13f1('0x17'));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(_0x13f1('0x18'))(_0x13f1('0x19'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x13f1('0x1a')](_0x13f1('0x1b'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x13f1('0x1a')](_0x13f1('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x13f1('0x1c')]()['then'](user[_0x13f1('0x1d')]())[_0x13f1('0x1e')](realtime[_0x13f1('0x1f')]())[_0x13f1('0x1e')](user[_0x13f1('0x20')]())['then'](realtime[_0x13f1('0x21')]())[_0x13f1('0x1e')](trunk[_0x13f1('0x22')]())['then'](realtime[_0x13f1('0x23')]())[_0x13f1('0x1e')](voiceQueue[_0x13f1('0x24')]())[_0x13f1('0x1e')](realtime[_0x13f1('0x25')]())['then'](trigger[_0x13f1('0x26')]())[_0x13f1('0x1e')](realtime[_0x13f1('0x27')]())['then'](template[_0x13f1('0x28')]())[_0x13f1('0x1e')](realtime[_0x13f1('0x29')]())[_0x13f1('0x1e')](zendesk[_0x13f1('0x2a')]())['then'](realtime[_0x13f1('0x2b')]())[_0x13f1('0x1e')](salesforce[_0x13f1('0x2c')]())['then'](realtime[_0x13f1('0x2d')]())['then'](sugarcrm[_0x13f1('0x2e')]())['then'](realtime[_0x13f1('0x2f')]())['then'](freshdesk[_0x13f1('0x30')]())[_0x13f1('0x1e')](realtime[_0x13f1('0x31')]())[_0x13f1('0x1e')](desk['getDeskAccounts']())[_0x13f1('0x1e')](realtime[_0x13f1('0x32')]())[_0x13f1('0x1e')](zoho[_0x13f1('0x33')]())['then'](realtime[_0x13f1('0x34')]())[_0x13f1('0x1e')](vtiger['getVtigerAccounts']())['then'](realtime['initVtigerAccounts']())[_0x13f1('0x1e')](freshsales[_0x13f1('0x35')]())['then'](realtime[_0x13f1('0x36')]())[_0x13f1('0x1e')](servicenow['getServicenowAccounts']())[_0x13f1('0x1e')](realtime[_0x13f1('0x37')]())[_0x13f1('0x1e')](dynamics365[_0x13f1('0x38')]())[_0x13f1('0x1e')](realtime[_0x13f1('0x39')]())[_0x13f1('0x1e')](campaign[_0x13f1('0x3a')]())['then'](realtime[_0x13f1('0x3b')]())[_0x13f1('0x1e')](voiceExtension[_0x13f1('0x3c')]())[_0x13f1('0x1e')](realtime[_0x13f1('0x3d')]())[_0x13f1('0x1e')](faxAccount[_0x13f1('0x3e')]())['then'](realtime['initFaxAccounts']())[_0x13f1('0x1e')](function(){return realtime;});}function initParams(){return Promise['resolve']()['then'](voiceQueueReport[_0x13f1('0x3f')]())[_0x13f1('0x1e')](realtime[_0x13f1('0x40')]())[_0x13f1('0x1e')](cmHopperHistory[_0x13f1('0x41')]())[_0x13f1('0x1e')](realtime[_0x13f1('0x42')]())['then'](cmHopperHistory[_0x13f1('0x43')]())[_0x13f1('0x1e')](realtime['initCampaignHopperHistory']())[_0x13f1('0x1e')](voiceCallReport[_0x13f1('0x44')]())['then'](realtime[_0x13f1('0x45')]())[_0x13f1('0x46')](function(_0x4ab199){logger[_0x13f1('0x47')](_0x13f1('0x48'),util[_0x13f1('0x49')](_0x4ab199,{'showHidden':![],'depth':null}));});}function main(){return server[_0x13f1('0x4a')](realtime,preview,fax)['then'](function(){return initRealtime();})[_0x13f1('0x1e')](function(){return initParams();})[_0x13f1('0x1e')](function(){report[_0x13f1('0x4b')]();setInterval(initRealtime,0x1388);})[_0x13f1('0x46')](function(_0x4548b4){logger[_0x13f1('0x47')](_0x13f1('0x4c'),util[_0x13f1('0x49')](_0x4548b4,{'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 827f4d2..38d6f85 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 _0xe8ed=['email','accountcode','fullname','state','unknown','stateTime','address','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','toLowerCase','not_inuse','idle','inuse','statePause','toNumber','format','status','stringify','user:%s','emit','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name'];(function(_0x5d0609,_0x127562){var _0xaa3fd1=function(_0x47f457){while(--_0x47f457){_0x5d0609['push'](_0x5d0609['shift']());}};_0xaa3fd1(++_0x127562);}(_0xe8ed,0x8a));var _0xde8e=function(_0x447b93,_0x2670ae){_0x447b93=_0x447b93-0x0;var _0x1fd738=_0xe8ed[_0x447b93];return _0x1fd738;};'use strict';var _=require(_0xde8e('0x0'));var util=require('util');var moment=require(_0xde8e('0x1'));var md5=require(_0xde8e('0x2'));var Redis=require(_0xde8e('0x3'));var config=require(_0xde8e('0x4'));config[_0xde8e('0x5')]=_[_0xde8e('0x6')](config[_0xde8e('0x5')],{'host':_0xde8e('0x7'),'port':0x18eb});var io=require(_0xde8e('0x8'))(new Redis(config[_0xde8e('0x5')]));function Agent(_0x324cc3){this['id']=_0x324cc3['id']||0x0;this[_0xde8e('0x9')]=_0x324cc3['name']||'';this[_0xde8e('0xa')]=_0x324cc3[_0xde8e('0xa')]||'';this[_0xde8e('0xb')]=_0x324cc3[_0xde8e('0xb')]||'';this[_0xde8e('0xc')]=_0x324cc3[_0xde8e('0xc')]||'';this[_0xde8e('0xd')]=_0xde8e('0xe');this[_0xde8e('0xf')]=0x0;this['status']='unknown';this[_0xde8e('0x10')]='';this['phone']='';this[_0xde8e('0x11')]='';this[_0xde8e('0x12')]='';this[_0xde8e('0x13')]=_0x324cc3[_0xde8e('0x13')]||![];this[_0xde8e('0x14')]=_0xde8e('0xe');this[_0xde8e('0x15')]=0x0;this[_0xde8e('0x16')]='';this[_0xde8e('0x17')]='';this[_0xde8e('0x18')]=![];this['local']=![];this[_0xde8e('0x2')]='';}Agent['prototype']['updateStatusRealtime']=function(_0x2b7192){var _0x3d0ff2;if(_0x2b7192&&_0x2b7192[_0xde8e('0xd')]){_0x3d0ff2=_0x2b7192[_0xde8e('0xd')][_0xde8e('0x19')]();switch(_0x3d0ff2){case _0xde8e('0x1a'):_0x3d0ff2=_0xde8e('0x1b');break;case _0xde8e('0x1c'):_0x3d0ff2='talking';break;}}if(_0x3d0ff2&&this[_0xde8e('0x14')]!==_0x3d0ff2||_0x2b7192[_0xde8e('0x1d')]){this['voiceStatusTime']=_[_0xde8e('0x1e')](moment()[_0xde8e('0x1f')]('x'));}if(_0x3d0ff2){this[_0xde8e('0x14')]=_0x3d0ff2;}var _0x172d0b={'id':this['id'],'name':this[_0xde8e('0x9')],'email':this['email'],'accountcode':this['accountcode'],'fullname':this[_0xde8e('0xc')],'state':this[_0xde8e('0xd')],'stateTime':this[_0xde8e('0xf')],'status':this[_0xde8e('0x20')],'address':this[_0xde8e('0x10')],'online':this[_0xde8e('0x13')],'voiceStatus':this[_0xde8e('0x14')],'voiceStatusTime':this[_0xde8e('0x15')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0xde8e('0x17')],'interface':this[_0xde8e('0x12')],'onhold':this['onhold']};var _0x4b8352=md5(JSON[_0xde8e('0x21')](_0x172d0b));if(this[_0xde8e('0x2')]!==_0x4b8352){this['md5']=_0x4b8352;io['to'](util['format'](_0xde8e('0x22'),_0x172d0b[_0xde8e('0x9')]))[_0xde8e('0x23')]('user:save',_0x172d0b);io[_0xde8e('0x23')]('user:presence',_0x172d0b);}};module[_0xde8e('0x24')]=Agent; \ No newline at end of file +var _0xfe6e=['voiceStatus','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','state','toLowerCase','not_inuse','talking','statePause','toNumber','format','voiceStatusTime','voiceStatusCallerIdNumber','stringify','md5','user:%s','emit','user:save','user:presence','exports','util','moment','../../../config/environment','localhost','socket.io-emitter','redis','name','email','accountcode','fullname','unknown','stateTime','status','address','phone','interface','online'];(function(_0x290897,_0x38c217){var _0x148b43=function(_0x504917){while(--_0x504917){_0x290897['push'](_0x290897['shift']());}};_0x148b43(++_0x38c217);}(_0xfe6e,0xb2));var _0xefe6=function(_0x119569,_0x83f612){_0x119569=_0x119569-0x0;var _0x115a97=_0xfe6e[_0x119569];return _0x115a97;};'use strict';var _=require('lodash');var util=require(_0xefe6('0x0'));var moment=require(_0xefe6('0x1'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0xefe6('0x2'));config['redis']=_['defaults'](config['redis'],{'host':_0xefe6('0x3'),'port':0x18eb});var io=require(_0xefe6('0x4'))(new Redis(config[_0xefe6('0x5')]));function Agent(_0x2df65a){this['id']=_0x2df65a['id']||0x0;this[_0xefe6('0x6')]=_0x2df65a[_0xefe6('0x6')]||'';this[_0xefe6('0x7')]=_0x2df65a['email']||'';this[_0xefe6('0x8')]=_0x2df65a[_0xefe6('0x8')]||'';this[_0xefe6('0x9')]=_0x2df65a[_0xefe6('0x9')]||'';this['state']=_0xefe6('0xa');this[_0xefe6('0xb')]=0x0;this[_0xefe6('0xc')]=_0xefe6('0xa');this[_0xefe6('0xd')]='';this[_0xefe6('0xe')]='';this['mobile']='';this[_0xefe6('0xf')]='';this[_0xefe6('0x10')]=_0x2df65a['online']||![];this[_0xefe6('0x11')]=_0xefe6('0xa');this['voiceStatusTime']=0x0;this['voiceStatusCallerIdNumber']='';this[_0xefe6('0x12')]='';this[_0xefe6('0x13')]=![];this[_0xefe6('0x14')]=![];this['md5']='';}Agent[_0xefe6('0x15')][_0xefe6('0x16')]=function(_0x54ed2d){var _0x5a3b55;if(_0x54ed2d&&_0x54ed2d[_0xefe6('0x17')]){_0x5a3b55=_0x54ed2d[_0xefe6('0x17')][_0xefe6('0x18')]();switch(_0x5a3b55){case _0xefe6('0x19'):_0x5a3b55='idle';break;case'inuse':_0x5a3b55=_0xefe6('0x1a');break;}}if(_0x5a3b55&&this[_0xefe6('0x11')]!==_0x5a3b55||_0x54ed2d[_0xefe6('0x1b')]){this['voiceStatusTime']=_[_0xefe6('0x1c')](moment()[_0xefe6('0x1d')]('x'));}if(_0x5a3b55){this['voiceStatus']=_0x5a3b55;}var _0x530897={'id':this['id'],'name':this[_0xefe6('0x6')],'email':this[_0xefe6('0x7')],'accountcode':this[_0xefe6('0x8')],'fullname':this[_0xefe6('0x9')],'state':this['state'],'stateTime':this[_0xefe6('0xb')],'status':this[_0xefe6('0xc')],'address':this['address'],'online':this['online'],'voiceStatus':this[_0xefe6('0x11')],'voiceStatusTime':this[_0xefe6('0x1e')],'voiceStatusCallerIdNumber':this[_0xefe6('0x1f')],'voiceStatusQueue':this[_0xefe6('0x12')],'interface':this[_0xefe6('0xf')],'onhold':this['onhold']};var _0x4c7f14=md5(JSON[_0xefe6('0x20')](_0x530897));if(this[_0xefe6('0x21')]!==_0x4c7f14){this[_0xefe6('0x21')]=_0x4c7f14;io['to'](util[_0xefe6('0x1d')](_0xefe6('0x22'),_0x530897['name']))[_0xefe6('0x23')](_0xefe6('0x24'),_0x530897);io[_0xefe6('0x23')](_0xefe6('0x25'),_0x530897);}};module[_0xefe6('0x26')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 23d35b6..9dced8c 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 _0xaf34=['dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry'];(function(_0x27c0e1,_0x14bf90){var _0x3a93d6=function(_0x2d5e35){while(--_0x2d5e35){_0x27c0e1['push'](_0x27c0e1['shift']());}};_0x3a93d6(++_0x14bf90);}(_0xaf34,0xd5));var _0x4af3=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xaf34[_0x46698a];return _0x356db0;};'use strict';function Campaign(_0x5e601a){this['id']=_0x5e601a['id']||0x0;this['name']=_0x5e601a[_0x4af3('0x0')]||'';this[_0x4af3('0x1')]=_0x5e601a[_0x4af3('0x1')]||'campaign';this[_0x4af3('0x2')]=0x0;this[_0x4af3('0x3')]=0x0;this[_0x4af3('0x4')]=0x0;this[_0x4af3('0x5')]=0x0;this['message']='';this['sendMessageOneNotActive']=!![];this['active']=_0x5e601a[_0x4af3('0x6')];this[_0x4af3('0x7')]=_0x5e601a[_0x4af3('0x7')];this[_0x4af3('0x8')]=_0x5e601a[_0x4af3('0x8')]||null;this['dialGlobalInterval']=_0x5e601a[_0x4af3('0x9')]?_0x5e601a['dialGlobalInterval']:null;this[_0x4af3('0xa')]=_0x5e601a[_0x4af3('0xa')];this[_0x4af3('0xb')]=_0x5e601a[_0x4af3('0xb')];this[_0x4af3('0xc')]=_0x5e601a['dialOriginateTimeout']||0x1e;this[_0x4af3('0xd')]=_0x5e601a['dialCongestionMaxRetry'];this[_0x4af3('0xe')]=_0x5e601a['dialCongestionRetryFrequency'];this[_0x4af3('0xf')]=_0x5e601a[_0x4af3('0xf')];this[_0x4af3('0x10')]=_0x5e601a[_0x4af3('0x10')];this['dialNoAnswerMaxRetry']=_0x5e601a['dialNoAnswerMaxRetry'];this[_0x4af3('0x11')]=_0x5e601a[_0x4af3('0x11')];this[_0x4af3('0x12')]=_0x5e601a[_0x4af3('0x12')];this['dialNoSuchNumberMaxRetry']=_0x5e601a[_0x4af3('0x13')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x5e601a[_0x4af3('0x14')]||0x96;this[_0x4af3('0x15')]=_0x5e601a[_0x4af3('0x15')]||0x3;this[_0x4af3('0x16')]=_0x5e601a[_0x4af3('0x16')]||0x96;this[_0x4af3('0x17')]=_0x5e601a[_0x4af3('0x17')]||0x3;this[_0x4af3('0x18')]=_0x5e601a[_0x4af3('0x18')]||0x96;this['dialMachineMaxRetry']=_0x5e601a[_0x4af3('0x19')]||0x3;this[_0x4af3('0x1a')]=_0x5e601a[_0x4af3('0x1a')]||0x96;this[_0x4af3('0x1b')]=_0x5e601a[_0x4af3('0x1b')]||0x3;this[_0x4af3('0x1c')]=_0x5e601a[_0x4af3('0x1c')]||0x96;this['dialOrderByScheduledAt']=_0x5e601a['dialOrderByScheduledAt']||'DESC';this[_0x4af3('0x1d')]=_0x5e601a[_0x4af3('0x1d')]||undefined;this[_0x4af3('0x1e')]=_0x5e601a[_0x4af3('0x1e')]||undefined;this[_0x4af3('0x1f')]=_0x5e601a[_0x4af3('0x1f')]||undefined;this[_0x4af3('0x20')]=_0x5e601a[_0x4af3('0x20')]?_0x5e601a[_0x4af3('0x20')]:undefined;this[_0x4af3('0x21')]=_0x5e601a[_0x4af3('0x21')]?_0x5e601a['Trunk']:undefined;this[_0x4af3('0x22')]=_0x5e601a[_0x4af3('0x22')]?_0x5e601a[_0x4af3('0x22')]:undefined;this[_0x4af3('0x23')]=_0x5e601a[_0x4af3('0x23')]?_0x5e601a[_0x4af3('0x23')]:undefined;this[_0x4af3('0x24')]=_0x5e601a[_0x4af3('0x23')]?_0x5e601a[_0x4af3('0x23')][_0x4af3('0x0')]:undefined;this[_0x4af3('0x25')]=_0x5e601a[_0x4af3('0x25')]||![];this[_0x4af3('0x26')]=_0x5e601a[_0x4af3('0x26')];this[_0x4af3('0x27')]=_0x5e601a['dialAMDGreeting'];this[_0x4af3('0x28')]=_0x5e601a[_0x4af3('0x28')];this[_0x4af3('0x29')]=_0x5e601a[_0x4af3('0x29')];this[_0x4af3('0x2a')]=_0x5e601a[_0x4af3('0x2a')];this['dialAMDBetweenWordsSilence']=_0x5e601a[_0x4af3('0x2b')];this[_0x4af3('0x2c')]=_0x5e601a['dialAMDMaximumNumberOfWords'];this[_0x4af3('0x2d')]=_0x5e601a[_0x4af3('0x2d')];this[_0x4af3('0x2e')]=_0x5e601a[_0x4af3('0x2e')];}module['exports']=Campaign; \ No newline at end of file +var _0x0409=['dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','message','sendMessageOneNotActive','active','dialTimezone','dialGlobalInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence'];(function(_0x1e4150,_0x55b02a){var _0x1ce3ee=function(_0x59324e){while(--_0x59324e){_0x1e4150['push'](_0x1e4150['shift']());}};_0x1ce3ee(++_0x55b02a);}(_0x0409,0x12f));var _0x9040=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x0409[_0xb0f7c3];return _0x28ea68;};'use strict';function Campaign(_0xbf6de9){this['id']=_0xbf6de9['id']||0x0;this[_0x9040('0x0')]=_0xbf6de9[_0x9040('0x0')]||'';this[_0x9040('0x1')]=_0xbf6de9[_0x9040('0x1')]||_0x9040('0x2');this[_0x9040('0x3')]=0x0;this[_0x9040('0x4')]=0x0;this[_0x9040('0x5')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x9040('0x6')]='';this[_0x9040('0x7')]=!![];this[_0x9040('0x8')]=_0xbf6de9['active'];this['limitCalls']=_0xbf6de9['limitCalls'];this['dialTimezone']=_0xbf6de9[_0x9040('0x9')]||null;this['dialGlobalInterval']=_0xbf6de9[_0x9040('0xa')]?_0xbf6de9[_0x9040('0xa')]:null;this['dialOriginateCallerIdName']=_0xbf6de9['dialOriginateCallerIdName'];this[_0x9040('0xb')]=_0xbf6de9[_0x9040('0xb')];this[_0x9040('0xc')]=_0xbf6de9['dialOriginateTimeout']||0x1e;this[_0x9040('0xd')]=_0xbf6de9[_0x9040('0xd')];this[_0x9040('0xe')]=_0xbf6de9['dialCongestionRetryFrequency'];this[_0x9040('0xf')]=_0xbf6de9[_0x9040('0xf')];this['dialBusyRetryFrequency']=_0xbf6de9[_0x9040('0x10')];this[_0x9040('0x11')]=_0xbf6de9[_0x9040('0x11')];this[_0x9040('0x12')]=_0xbf6de9[_0x9040('0x12')];this[_0x9040('0x13')]=_0xbf6de9[_0x9040('0x13')];this[_0x9040('0x14')]=_0xbf6de9['dialNoSuchNumberMaxRetry']||0x3;this[_0x9040('0x15')]=_0xbf6de9[_0x9040('0x15')]||0x96;this[_0x9040('0x16')]=_0xbf6de9['dialDropMaxRetry']||0x3;this[_0x9040('0x17')]=_0xbf6de9[_0x9040('0x17')]||0x96;this['dialAbandonedMaxRetry']=_0xbf6de9[_0x9040('0x18')]||0x3;this[_0x9040('0x19')]=_0xbf6de9[_0x9040('0x19')]||0x96;this['dialMachineMaxRetry']=_0xbf6de9['dialMachineMaxRetry']||0x3;this[_0x9040('0x1a')]=_0xbf6de9[_0x9040('0x1a')]||0x96;this[_0x9040('0x1b')]=_0xbf6de9['dialAgentRejectMaxRetry']||0x3;this[_0x9040('0x1c')]=_0xbf6de9[_0x9040('0x1c')]||0x96;this[_0x9040('0x1d')]=_0xbf6de9[_0x9040('0x1d')]||'DESC';this[_0x9040('0x1e')]=_0xbf6de9['dialPrefix']||undefined;this[_0x9040('0x1f')]=_0xbf6de9['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x9040('0x20')]=_0xbf6de9['dialCutDigit']||undefined;this[_0x9040('0x21')]=_0xbf6de9[_0x9040('0x21')]?_0xbf6de9['TrunkBackup']:undefined;this[_0x9040('0x22')]=_0xbf6de9['Trunk']?_0xbf6de9[_0x9040('0x22')]:undefined;this[_0x9040('0x23')]=_0xbf6de9[_0x9040('0x23')]?_0xbf6de9[_0x9040('0x23')]:undefined;this[_0x9040('0x24')]=_0xbf6de9[_0x9040('0x24')]?_0xbf6de9['SquareProject']:undefined;this[_0x9040('0x25')]=_0xbf6de9['SquareProject']?_0xbf6de9['SquareProject'][_0x9040('0x0')]:undefined;this[_0x9040('0x26')]=_0xbf6de9[_0x9040('0x26')]||![];this[_0x9040('0x27')]=_0xbf6de9[_0x9040('0x27')];this[_0x9040('0x28')]=_0xbf6de9['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0xbf6de9[_0x9040('0x29')];this[_0x9040('0x2a')]=_0xbf6de9['dialAMDTotalAnalysisTime'];this[_0x9040('0x2b')]=_0xbf6de9[_0x9040('0x2b')];this[_0x9040('0x2c')]=_0xbf6de9[_0x9040('0x2c')];this['dialAMDMaximumNumberOfWords']=_0xbf6de9[_0x9040('0x2d')];this[_0x9040('0x2e')]=_0xbf6de9[_0x9040('0x2e')];this['dialAMDMaximumWordLength']=_0xbf6de9[_0x9040('0x2f')];}module[_0x9040('0x30')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index fb4c9e4..56bb376 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 _0x32e7=['transferconnectedlinenum','transferType','mohtime','starttime','destinationchannel','calleridnum','calleridname','connectedlinename','accountcode','context','uniqueid','answered','endtime','unmanaged','lastapplication','lastdata','duration','holdtime','tag','disposition','monitor','monitorFilename','queue','transfercalleridnum'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x32e7,0xc3));var _0x732e=function(_0x176c84,_0x489fb5){_0x176c84=_0x176c84-0x0;var _0xa68703=_0x32e7[_0x176c84];return _0xa68703;};'use strict';function Channel(){this[_0x732e('0x0')]=null;this['channel']='';this[_0x732e('0x1')]='';this[_0x732e('0x2')]=0x0;this[_0x732e('0x3')]='';this['connectedlinenum']=undefined;this[_0x732e('0x4')]=undefined;this[_0x732e('0x5')]=0x0;this[_0x732e('0x6')]='';this[_0x732e('0x7')]=0x0;this['linkedid']=0x0;this['exten']=0x0;this[_0x732e('0x8')]=![];this['answertime']=null;this[_0x732e('0x9')]=null;this[_0x732e('0xa')]=![];this['abandoned']=![];this[_0x732e('0xb')]='';this[_0x732e('0xc')]='';this[_0x732e('0xd')]=0x0;this['billableseconds']=0x0;this[_0x732e('0xe')]=0x0;this['type']=null;this[_0x732e('0xf')]=null;this[_0x732e('0x10')]=null;this[_0x732e('0x11')]=![];this[_0x732e('0x12')]=null;this[_0x732e('0x13')]=null;this['monitors']=[];this[_0x732e('0x14')]=undefined;this[_0x732e('0x15')]=undefined;this[_0x732e('0x16')]=undefined;this[_0x732e('0x17')]=0x0;}module['exports']=Channel; \ No newline at end of file +var _0x4f9a=['billableseconds','holdtime','type','tag','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','channel','destinationchannel','calleridnum','calleridname','connectedlinename','context','uniqueid','linkedid','exten','answered','answertime','endtime','abandoned','lastapplication','lastdata'];(function(_0x418af0,_0x13c39c){var _0x41d4b2=function(_0x2ebe51){while(--_0x2ebe51){_0x418af0['push'](_0x418af0['shift']());}};_0x41d4b2(++_0x13c39c);}(_0x4f9a,0xd1));var _0xa4f9=function(_0xe8b1f4,_0x5427f3){_0xe8b1f4=_0xe8b1f4-0x0;var _0x2ecfe5=_0x4f9a[_0xe8b1f4];return _0x2ecfe5;};'use strict';function Channel(){this['starttime']=null;this[_0xa4f9('0x0')]='';this[_0xa4f9('0x1')]='';this[_0xa4f9('0x2')]=0x0;this[_0xa4f9('0x3')]='';this['connectedlinenum']=undefined;this[_0xa4f9('0x4')]=undefined;this['accountcode']=0x0;this[_0xa4f9('0x5')]='';this[_0xa4f9('0x6')]=0x0;this[_0xa4f9('0x7')]=0x0;this[_0xa4f9('0x8')]=0x0;this[_0xa4f9('0x9')]=![];this[_0xa4f9('0xa')]=null;this[_0xa4f9('0xb')]=null;this['unmanaged']=![];this[_0xa4f9('0xc')]=![];this[_0xa4f9('0xd')]='';this[_0xa4f9('0xe')]='';this['duration']=0x0;this[_0xa4f9('0xf')]=0x0;this[_0xa4f9('0x10')]=0x0;this[_0xa4f9('0x11')]=null;this[_0xa4f9('0x12')]=null;this[_0xa4f9('0x13')]=null;this[_0xa4f9('0x14')]=![];this[_0xa4f9('0x15')]=null;this[_0xa4f9('0x16')]=null;this[_0xa4f9('0x17')]=[];this[_0xa4f9('0x18')]=undefined;this[_0xa4f9('0x19')]=undefined;this['transferType']=undefined;this[_0xa4f9('0x1a')]=0x0;}module[_0xa4f9('0x1b')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 85a15eb..07ad4ff 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 _0x051e=['consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey'];(function(_0x5343a8,_0x7ff6a){var _0x107eed=function(_0x3eb62d){while(--_0x3eb62d){_0x5343a8['push'](_0x5343a8['shift']());}};_0x107eed(++_0x7ff6a);}(_0x051e,0xe4));var _0xe051=function(_0x31a0e2,_0x4350c1){_0x31a0e2=_0x31a0e2-0x0;var _0x56bc64=_0x051e[_0x31a0e2];return _0x56bc64;};'use strict';function DeskAccount(_0x2bb9bc){this['id']=_0x2bb9bc['id']||0x0;this[_0xe051('0x0')]=_0x2bb9bc[_0xe051('0x0')]||'';this[_0xe051('0x1')]=_0x2bb9bc[_0xe051('0x1')]||'';this[_0xe051('0x2')]=_0x2bb9bc[_0xe051('0x2')]||'';this[_0xe051('0x3')]=_0x2bb9bc[_0xe051('0x3')]||'';this[_0xe051('0x4')]=_0x2bb9bc['password']||'';this[_0xe051('0x5')]=_0x2bb9bc[_0xe051('0x5')]||'';this[_0xe051('0x6')]=_0x2bb9bc[_0xe051('0x6')]||'';this['token']=_0x2bb9bc[_0xe051('0x7')]||'';this['tokenSecret']=_0x2bb9bc[_0xe051('0x8')]||'';this[_0xe051('0x9')]=_0x2bb9bc[_0xe051('0x9')]||'';this[_0xe051('0xa')]=_0x2bb9bc['serverUrl']||'';this[_0xe051('0xb')]=_0x2bb9bc[_0xe051('0xb')]||{};}module[_0xe051('0xc')]=DeskAccount; \ No newline at end of file +var _0xac05=['consumerSecret','tokenSecret','type','serverUrl','Configurations','name','username','remoteUri','authType','password','consumerKey'];(function(_0x48d6a3,_0x37c848){var _0x38bfa0=function(_0x3fba2e){while(--_0x3fba2e){_0x48d6a3['push'](_0x48d6a3['shift']());}};_0x38bfa0(++_0x37c848);}(_0xac05,0x15a));var _0x5ac0=function(_0x4ca87a,_0x18bf32){_0x4ca87a=_0x4ca87a-0x0;var _0xe2f2ec=_0xac05[_0x4ca87a];return _0xe2f2ec;};'use strict';function DeskAccount(_0x455762){this['id']=_0x455762['id']||0x0;this[_0x5ac0('0x0')]=_0x455762[_0x5ac0('0x0')]||'';this['username']=_0x455762[_0x5ac0('0x1')]||'';this[_0x5ac0('0x2')]=_0x455762[_0x5ac0('0x2')]||'';this[_0x5ac0('0x3')]=_0x455762[_0x5ac0('0x3')]||'';this[_0x5ac0('0x4')]=_0x455762['password']||'';this[_0x5ac0('0x5')]=_0x455762[_0x5ac0('0x5')]||'';this[_0x5ac0('0x6')]=_0x455762[_0x5ac0('0x6')]||'';this['token']=_0x455762['token']||'';this[_0x5ac0('0x7')]=_0x455762[_0x5ac0('0x7')]||'';this[_0x5ac0('0x8')]=_0x455762[_0x5ac0('0x8')]||'';this[_0x5ac0('0x9')]=_0x455762[_0x5ac0('0x9')]||'';this['Configurations']=_0x455762[_0x5ac0('0xa')]||{};}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 7617fee..096964d 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 _0xfd85=['serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x1ecca2,_0x5bea3e){var _0x89b862=function(_0x3b9c6c){while(--_0x3b9c6c){_0x1ecca2['push'](_0x1ecca2['shift']());}};_0x89b862(++_0x5bea3e);}(_0xfd85,0x13d));var _0x5fd8=function(_0x405868,_0x3b6e2c){_0x405868=_0x405868-0x0;var _0x51873d=_0xfd85[_0x405868];return _0x51873d;};'use strict';function Dynamics365Account(_0x480723){this['id']=_0x480723['id']||0x0;this[_0x5fd8('0x0')]=_0x480723[_0x5fd8('0x0')]||'';this[_0x5fd8('0x1')]=_0x480723[_0x5fd8('0x1')]||'';this[_0x5fd8('0x2')]=_0x480723[_0x5fd8('0x2')]||'';this[_0x5fd8('0x3')]=_0x480723[_0x5fd8('0x3')]||'';this[_0x5fd8('0x4')]=_0x480723[_0x5fd8('0x4')]||'';this[_0x5fd8('0x5')]=_0x480723[_0x5fd8('0x5')]||'';this[_0x5fd8('0x6')]=_0x480723[_0x5fd8('0x6')]||{};this[_0x5fd8('0x7')]=_0x480723[_0x5fd8('0x7')]||'';this[_0x5fd8('0x8')]=_0x480723[_0x5fd8('0x8')]||![];this[_0x5fd8('0x9')]=_0x480723[_0x5fd8('0x9')]||{};this[_0x5fd8('0xa')]=_0x480723[_0x5fd8('0xa')]||{};}module[_0x5fd8('0xb')]=Dynamics365Account; \ No newline at end of file +var _0x980f=['clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','name','username','remoteUri','tenantId'];(function(_0x2460c9,_0x1e53ad){var _0x1e42a3=function(_0x4d26b7){while(--_0x4d26b7){_0x2460c9['push'](_0x2460c9['shift']());}};_0x1e42a3(++_0x1e53ad);}(_0x980f,0x100));var _0xf980=function(_0x5bd103,_0x3b8037){_0x5bd103=_0x5bd103-0x0;var _0xc33b64=_0x980f[_0x5bd103];return _0xc33b64;};'use strict';function Dynamics365Account(_0x4b426f){this['id']=_0x4b426f['id']||0x0;this[_0xf980('0x0')]=_0x4b426f[_0xf980('0x0')]||'';this[_0xf980('0x1')]=_0x4b426f['username']||'';this['password']=_0x4b426f['password']||'';this[_0xf980('0x2')]=_0x4b426f['remoteUri']||'';this[_0xf980('0x3')]=_0x4b426f[_0xf980('0x3')]||'';this[_0xf980('0x4')]=_0x4b426f[_0xf980('0x4')]||'';this['clientSecret']=_0x4b426f[_0xf980('0x5')]||{};this[_0xf980('0x6')]=_0x4b426f[_0xf980('0x6')]||'';this[_0xf980('0x7')]=_0x4b426f[_0xf980('0x7')]||![];this[_0xf980('0x8')]=_0x4b426f['Configurations']||{};this['CloudProvider']=_0x4b426f[_0xf980('0x9')]||{};}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 885cabe..0110d1c 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 _0xffbe=['headerinfo','minrate','maxrate','modem','v17,v27,v29','gateway','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm'];(function(_0x4d5c3c,_0x1a17e9){var _0x1e9eca=function(_0x59ca6){while(--_0x59ca6){_0x4d5c3c['push'](_0x4d5c3c['shift']());}};_0x1e9eca(++_0x1a17e9);}(_0xffbe,0x13d));var _0xeffb=function(_0x481357,_0x1002f4){_0x481357=_0x481357-0x0;var _0x150ad8=_0xffbe[_0x481357];return _0x150ad8;};'use strict';function FaxAccount(_0xc43060){this['id']=_0xc43060['id']||0x0;this['name']=_0xc43060[_0xeffb('0x0')]||'';this[_0xeffb('0x1')]=_0xc43060[_0xeffb('0x1')];this[_0xeffb('0x2')]=_0xc43060['ecm'];this['headerinfo']=_0xc43060[_0xeffb('0x3')];this['localstationid']=_0xc43060['localstationid'];this[_0xeffb('0x4')]=_0xc43060[_0xeffb('0x4')]||0x960;this[_0xeffb('0x5')]=_0xc43060[_0xeffb('0x5')]||0x3840;this[_0xeffb('0x6')]=_0xc43060[_0xeffb('0x6')]||_0xeffb('0x7');this[_0xeffb('0x8')]=_0xc43060['gateway']||'no';this['faxdetect']=_0xc43060['faxdetect']||'no';this[_0xeffb('0x9')]=_0xc43060['t38timeout']||0x1388;this[_0xeffb('0xa')]=_0xc43060[_0xeffb('0xa')]||_0xeffb('0xb');this['Trunk']=_0xc43060[_0xeffb('0xc')]?_0xc43060['Trunk']:undefined;this['ListId']=_0xc43060[_0xeffb('0xd')];this[_0xeffb('0xe')]=_0xc43060[_0xeffb('0xe')];}module[_0xeffb('0xf')]=FaxAccount; \ No newline at end of file +var _0xa81d=['ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk'];(function(_0x1db588,_0x19f5a4){var _0x40a70c=function(_0x3ae7bb){while(--_0x3ae7bb){_0x1db588['push'](_0x1db588['shift']());}};_0x40a70c(++_0x19f5a4);}(_0xa81d,0x135));var _0xda81=function(_0x3c9d62,_0x34edcd){_0x3c9d62=_0x3c9d62-0x0;var _0x5e9629=_0xa81d[_0x3c9d62];return _0x5e9629;};'use strict';function FaxAccount(_0x1c148f){this['id']=_0x1c148f['id']||0x0;this[_0xda81('0x0')]=_0x1c148f[_0xda81('0x0')]||'';this[_0xda81('0x1')]=_0x1c148f[_0xda81('0x1')];this[_0xda81('0x2')]=_0x1c148f['ecm'];this['headerinfo']=_0x1c148f[_0xda81('0x3')];this[_0xda81('0x4')]=_0x1c148f[_0xda81('0x4')];this[_0xda81('0x5')]=_0x1c148f['minrate']||0x960;this[_0xda81('0x6')]=_0x1c148f[_0xda81('0x6')]||0x3840;this['modem']=_0x1c148f['modem']||_0xda81('0x7');this['gateway']=_0x1c148f[_0xda81('0x8')]||'no';this[_0xda81('0x9')]=_0x1c148f['faxdetect']||'no';this[_0xda81('0xa')]=_0x1c148f[_0xda81('0xa')]||0x1388;this[_0xda81('0xb')]=_0x1c148f['tech']||_0xda81('0xc');this[_0xda81('0xd')]=_0x1c148f[_0xda81('0xd')]?_0x1c148f[_0xda81('0xd')]:undefined;this[_0xda81('0xe')]=_0x1c148f['ListId'];this[_0xda81('0xf')]=_0x1c148f['key'];}module[_0xda81('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index f90794a..e930a68 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 _0xb26e=['Configurations','exports','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xb26e,0x1ea));var _0xeb26=function(_0x58d8d7,_0x108377){_0x58d8d7=_0x58d8d7-0x0;var _0x339d20=_0xb26e[_0x58d8d7];return _0x339d20;};'use strict';function FreshdeskAccount(_0x24d9e1){this['id']=_0x24d9e1['id']||0x0;this[_0xeb26('0x0')]=_0x24d9e1[_0xeb26('0x0')]||'';this['username']=_0x24d9e1[_0xeb26('0x1')]||'';this[_0xeb26('0x2')]=_0x24d9e1[_0xeb26('0x3')]||'';this['remoteUri']=_0x24d9e1[_0xeb26('0x4')]||'';this[_0xeb26('0x5')]=_0x24d9e1['serverUrl']||'';this[_0xeb26('0x6')]=_0x24d9e1['Configurations']||{};}module[_0xeb26('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0x7a05=['name','username','apiKey','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x7a05,0xa8));var _0x57a0=function(_0x3110f6,_0x30de52){_0x3110f6=_0x3110f6-0x0;var _0x5ecdb0=_0x7a05[_0x3110f6];return _0x5ecdb0;};'use strict';function FreshdeskAccount(_0x1a320c){this['id']=_0x1a320c['id']||0x0;this[_0x57a0('0x0')]=_0x1a320c['name']||'';this[_0x57a0('0x1')]=_0x1a320c[_0x57a0('0x1')]||'';this[_0x57a0('0x2')]=_0x1a320c[_0x57a0('0x3')]||'';this[_0x57a0('0x4')]=_0x1a320c[_0x57a0('0x4')]||'';this['serverUrl']=_0x1a320c[_0x57a0('0x5')]||'';this[_0x57a0('0x6')]=_0x1a320c[_0x57a0('0x6')]||{};}module[_0x57a0('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 607230f..15ca1e0 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 _0x872a=['remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x4d43bf,_0x1d0cdc){var _0x14afee=function(_0x222cc3){while(--_0x222cc3){_0x4d43bf['push'](_0x4d43bf['shift']());}};_0x14afee(++_0x1d0cdc);}(_0x872a,0x100));var _0xa872=function(_0x29fcf2,_0x147fc9){_0x29fcf2=_0x29fcf2-0x0;var _0x1763f7=_0x872a[_0x29fcf2];return _0x1763f7;};'use strict';function FreshsalesAccount(_0x30eae3){this['id']=_0x30eae3['id']||0x0;this[_0xa872('0x0')]=_0x30eae3[_0xa872('0x0')]||'';this[_0xa872('0x1')]=_0x30eae3['username']||'';this['apiKey']=_0x30eae3['token']||'';this[_0xa872('0x2')]=_0x30eae3[_0xa872('0x2')]||'';this[_0xa872('0x3')]=_0x30eae3[_0xa872('0x3')]||'';this[_0xa872('0x4')]=_0x30eae3[_0xa872('0x4')]||{};}module[_0xa872('0x5')]=FreshsalesAccount; \ No newline at end of file +var _0x93bb=['Configurations','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x11e03f,_0x20b967){var _0x5666fe=function(_0x19ce63){while(--_0x19ce63){_0x11e03f['push'](_0x11e03f['shift']());}};_0x5666fe(++_0x20b967);}(_0x93bb,0x135));var _0xb93b=function(_0x2da304,_0x4abb7d){_0x2da304=_0x2da304-0x0;var _0x275fad=_0x93bb[_0x2da304];return _0x275fad;};'use strict';function FreshsalesAccount(_0x315c5f){this['id']=_0x315c5f['id']||0x0;this[_0xb93b('0x0')]=_0x315c5f[_0xb93b('0x0')]||'';this[_0xb93b('0x1')]=_0x315c5f[_0xb93b('0x1')]||'';this[_0xb93b('0x2')]=_0x315c5f[_0xb93b('0x3')]||'';this[_0xb93b('0x4')]=_0x315c5f[_0xb93b('0x4')]||'';this[_0xb93b('0x5')]=_0x315c5f['serverUrl']||'';this[_0xb93b('0x6')]=_0x315c5f[_0xb93b('0x6')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 26145c3..02428d5 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 _0xfc0d=['count','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','connectedlinenum','connectedlinename','accountcode','context','priority','holdtime','lastAssignedTo','motionChannel','routealias','mohtime','variables','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerleaveAt','position'];(function(_0x131614,_0x500b9a){var _0x13b897=function(_0x5863cb){while(--_0x5863cb){_0x131614['push'](_0x131614['shift']());}};_0x13b897(++_0x500b9a);}(_0xfc0d,0x8e));var _0xdfc0=function(_0x5b99dc,_0x269788){_0x5b99dc=_0x5b99dc-0x0;var _0x1f3df2=_0xfc0d[_0x5b99dc];return _0x1f3df2;};'use strict';function QueueReport(){this[_0xdfc0('0x0')]=_0xdfc0('0x1');this[_0xdfc0('0x2')]='';this[_0xdfc0('0x3')]='';this[_0xdfc0('0x4')]='';this[_0xdfc0('0x5')]='';this['queuecallerjoinAt']=null;this[_0xdfc0('0x6')]=null;this[_0xdfc0('0x7')]=0x1;this[_0xdfc0('0x8')]=0x1;this['queuecallerabandon']=![];this['queuecallerabandonAt']=null;this[_0xdfc0('0x9')]=![];this[_0xdfc0('0xa')]=null;this[_0xdfc0('0xb')]=![];this[_0xdfc0('0xc')]=null;this['originalposition']=0x1;this['channel']='';this[_0xdfc0('0xd')]='';this[_0xdfc0('0xe')]='';this[_0xdfc0('0xf')]='';this[_0xdfc0('0x10')]='';this['exten']='';this[_0xdfc0('0x11')]='';this[_0xdfc0('0x12')]=0x0;this['assigned']=![];this[_0xdfc0('0x13')]='';this[_0xdfc0('0x14')]='voice';this[_0xdfc0('0x15')]=null;this[_0xdfc0('0x16')]=0x0;this[_0xdfc0('0x17')]={};}module[_0xdfc0('0x18')]=QueueReport; \ No newline at end of file +var _0x0526=['mohtime','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinename','accountcode','priority','holdtime','assigned','motionChannel','routealias'];(function(_0x3a0ebd,_0x47f368){var _0x51a660=function(_0x4023e6){while(--_0x4023e6){_0x3a0ebd['push'](_0x3a0ebd['shift']());}};_0x51a660(++_0x47f368);}(_0x0526,0xa2));var _0x6052=function(_0x5d3a6c,_0x283c89){_0x5d3a6c=_0x5d3a6c-0x0;var _0x1bdc8e=_0x0526[_0x5d3a6c];return _0x1bdc8e;};'use strict';function QueueReport(){this[_0x6052('0x0')]=_0x6052('0x1');this[_0x6052('0x2')]='';this[_0x6052('0x3')]='';this[_0x6052('0x4')]='';this[_0x6052('0x5')]='';this[_0x6052('0x6')]=null;this['queuecallerleaveAt']=null;this[_0x6052('0x7')]=0x1;this[_0x6052('0x8')]=0x1;this[_0x6052('0x9')]=![];this[_0x6052('0xa')]=null;this['queuecallercomplete']=![];this['queuecallercompleteAt']=null;this[_0x6052('0xb')]=![];this[_0x6052('0xc')]=null;this[_0x6052('0xd')]=0x1;this[_0x6052('0xe')]='';this['connectedlinenum']='';this[_0x6052('0xf')]='';this[_0x6052('0x10')]='';this['context']='';this['exten']='';this[_0x6052('0x11')]='';this[_0x6052('0x12')]=0x0;this[_0x6052('0x13')]=![];this['lastAssignedTo']='';this[_0x6052('0x14')]='voice';this[_0x6052('0x15')]=null;this[_0x6052('0x16')]=0x0;this['variables']={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 5ddb879..1b010d0 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 _0x176a=['securityToken','type','integrationTab','serverUrl','Configurations','exports','username','remoteUri','password','clientId','clientSecret'];(function(_0x1e6ed7,_0x547958){var _0x57952f=function(_0x86eef){while(--_0x86eef){_0x1e6ed7['push'](_0x1e6ed7['shift']());}};_0x57952f(++_0x547958);}(_0x176a,0x8a));var _0xa176=function(_0x33de28,_0x18208d){_0x33de28=_0x33de28-0x0;var _0x4723f7=_0x176a[_0x33de28];return _0x4723f7;};'use strict';function SalesforceAccount(_0x491f68){this['id']=_0x491f68['id']||0x0;this['name']=_0x491f68['name']||'';this['username']=_0x491f68[_0xa176('0x0')]||'';this[_0xa176('0x1')]=_0x491f68['remoteUri']||'';this[_0xa176('0x2')]=_0x491f68[_0xa176('0x2')]||'';this[_0xa176('0x3')]=_0x491f68[_0xa176('0x3')]||'';this[_0xa176('0x4')]=_0x491f68[_0xa176('0x4')]||'';this[_0xa176('0x5')]=_0x491f68[_0xa176('0x5')]||'';this[_0xa176('0x6')]=_0x491f68[_0xa176('0x6')]||_0xa176('0x7');this[_0xa176('0x8')]=_0x491f68[_0xa176('0x8')]||'';this[_0xa176('0x9')]=_0x491f68['Configurations']||{};}module[_0xa176('0xa')]=SalesforceAccount; \ No newline at end of file +var _0x3369=['remoteUri','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username'];(function(_0x162566,_0x114c26){var _0x3360a9=function(_0x302292){while(--_0x302292){_0x162566['push'](_0x162566['shift']());}};_0x3360a9(++_0x114c26);}(_0x3369,0x13d));var _0x9336=function(_0x292872,_0x5851d6){_0x292872=_0x292872-0x0;var _0x34d038=_0x3369[_0x292872];return _0x34d038;};'use strict';function SalesforceAccount(_0x14decd){this['id']=_0x14decd['id']||0x0;this[_0x9336('0x0')]=_0x14decd[_0x9336('0x0')]||'';this[_0x9336('0x1')]=_0x14decd[_0x9336('0x1')]||'';this[_0x9336('0x2')]=_0x14decd['remoteUri']||'';this['password']=_0x14decd['password']||'';this[_0x9336('0x3')]=_0x14decd['clientId']||'';this[_0x9336('0x4')]=_0x14decd['clientSecret']||'';this[_0x9336('0x5')]=_0x14decd[_0x9336('0x5')]||'';this['type']=_0x14decd[_0x9336('0x6')]||_0x9336('0x7');this[_0x9336('0x8')]=_0x14decd['serverUrl']||'';this['Configurations']=_0x14decd[_0x9336('0x9')]||{};}module[_0x9336('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 3d0addc..2078153 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 _0xa672=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0xac53d2,_0x121075){var _0x2e5759=function(_0x382b9e){while(--_0x382b9e){_0xac53d2['push'](_0xac53d2['shift']());}};_0x2e5759(++_0x121075);}(_0xa672,0xa6));var _0x2a67=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0xa672[_0x1da527];return _0x40fc7c;};'use strict';function ServicenowAccount(_0x26a6f6){this['id']=_0x26a6f6['id']||0x0;this[_0x2a67('0x0')]=_0x26a6f6[_0x2a67('0x0')]||'';this[_0x2a67('0x1')]=_0x26a6f6[_0x2a67('0x1')]||'';this[_0x2a67('0x2')]=_0x26a6f6[_0x2a67('0x2')]||'';this['remoteUri']=_0x26a6f6[_0x2a67('0x3')]||'';this[_0x2a67('0x4')]=_0x26a6f6[_0x2a67('0x4')]||'';this[_0x2a67('0x5')]=_0x26a6f6[_0x2a67('0x5')]||{};}module[_0x2a67('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xa1d5=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0xa1d5,0x10f));var _0x5a1d=function(_0x4b32bf,_0x1068c9){_0x4b32bf=_0x4b32bf-0x0;var _0x507f5a=_0xa1d5[_0x4b32bf];return _0x507f5a;};'use strict';function ServicenowAccount(_0xf9635f){this['id']=_0xf9635f['id']||0x0;this[_0x5a1d('0x0')]=_0xf9635f[_0x5a1d('0x0')]||'';this[_0x5a1d('0x1')]=_0xf9635f[_0x5a1d('0x1')]||'';this[_0x5a1d('0x2')]=_0xf9635f[_0x5a1d('0x2')]||'';this[_0x5a1d('0x3')]=_0xf9635f['remoteUri']||'';this['serverUrl']=_0xf9635f[_0x5a1d('0x4')]||'';this[_0x5a1d('0x5')]=_0xf9635f[_0x5a1d('0x5')]||{};}module[_0x5a1d('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 1fe00ea..2bc9d3c 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 _0x59ad=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0xd50ac1,_0x48173e){var _0x516afe=function(_0x83f3ec){while(--_0x83f3ec){_0xd50ac1['push'](_0xd50ac1['shift']());}};_0x516afe(++_0x48173e);}(_0x59ad,0xee));var _0xd59a=function(_0x9a72ce,_0x3b9865){_0x9a72ce=_0x9a72ce-0x0;var _0xb41f92=_0x59ad[_0x9a72ce];return _0xb41f92;};'use strict';function SugarcrmAccount(_0xc9ee44){this['id']=_0xc9ee44['id']||0x0;this[_0xd59a('0x0')]=_0xc9ee44[_0xd59a('0x0')]||'';this[_0xd59a('0x1')]=_0xc9ee44[_0xd59a('0x1')]||'';this[_0xd59a('0x2')]=_0xc9ee44[_0xd59a('0x2')]||'';this[_0xd59a('0x3')]=_0xc9ee44[_0xd59a('0x3')]||'';this[_0xd59a('0x4')]=_0xc9ee44[_0xd59a('0x4')]||'';this[_0xd59a('0x5')]=_0xc9ee44[_0xd59a('0x5')]||{};}module[_0xd59a('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0xd630=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x3caaed,_0x4b4713){var _0x13ce85=function(_0x546d26){while(--_0x546d26){_0x3caaed['push'](_0x3caaed['shift']());}};_0x13ce85(++_0x4b4713);}(_0xd630,0xec));var _0x0d63=function(_0xe84fb9,_0x308775){_0xe84fb9=_0xe84fb9-0x0;var _0x5ac8c2=_0xd630[_0xe84fb9];return _0x5ac8c2;};'use strict';function SugarcrmAccount(_0x3bc2fb){this['id']=_0x3bc2fb['id']||0x0;this[_0x0d63('0x0')]=_0x3bc2fb['name']||'';this['username']=_0x3bc2fb[_0x0d63('0x1')]||'';this[_0x0d63('0x2')]=_0x3bc2fb[_0x0d63('0x2')]||'';this['remoteUri']=_0x3bc2fb[_0x0d63('0x3')]||'';this[_0x0d63('0x4')]=_0x3bc2fb[_0x0d63('0x4')]||'';this['Configurations']=_0x3bc2fb[_0x0d63('0x5')]||{};}module[_0x0d63('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index f632a5e..6d39b8c 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 _0x4f9b=['exports','name','accountcode','state','unknown','stateTime'];(function(_0x46440c,_0x4da44f){var _0x1cb968=function(_0x2f2b37){while(--_0x2f2b37){_0x46440c['push'](_0x46440c['shift']());}};_0x1cb968(++_0x4da44f);}(_0x4f9b,0x6d));var _0xb4f9=function(_0x523efb,_0x11f34c){_0x523efb=_0x523efb-0x0;var _0xa63c26=_0x4f9b[_0x523efb];return _0xa63c26;};'use strict';function Telephone(_0x250137){this['id']=_0x250137['id']||0x0;this[_0xb4f9('0x0')]=_0x250137[_0xb4f9('0x0')]||'';this[_0xb4f9('0x1')]=_0x250137[_0xb4f9('0x1')]||'';this[_0xb4f9('0x2')]=_0xb4f9('0x3');this[_0xb4f9('0x4')]=0x0;this['status']='unknown';this['address']='';}module[_0xb4f9('0x5')]=Telephone; \ No newline at end of file +var _0xdb51=['stateTime','status','unknown','address','exports','name','accountcode','state'];(function(_0x533e4e,_0x4eba54){var _0x1f14bb=function(_0x33a485){while(--_0x33a485){_0x533e4e['push'](_0x533e4e['shift']());}};_0x1f14bb(++_0x4eba54);}(_0xdb51,0x145));var _0x1db5=function(_0x5e08ae,_0x588248){_0x5e08ae=_0x5e08ae-0x0;var _0x4b4a55=_0xdb51[_0x5e08ae];return _0x4b4a55;};'use strict';function Telephone(_0x515aa1){this['id']=_0x515aa1['id']||0x0;this[_0x1db5('0x0')]=_0x515aa1[_0x1db5('0x0')]||'';this[_0x1db5('0x1')]=_0x515aa1[_0x1db5('0x1')]||'';this[_0x1db5('0x2')]='unknown';this[_0x1db5('0x3')]=0x0;this[_0x1db5('0x4')]=_0x1db5('0x5');this[_0x1db5('0x6')]='';}module[_0x1db5('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 1329914..ce30205 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['exports','name'];(function(_0x4aa97d,_0x263c37){var _0x1f772e=function(_0x38bb51){while(--_0x38bb51){_0x4aa97d['push'](_0x4aa97d['shift']());}};_0x1f772e(++_0x263c37);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x2858d1,_0x4085b0){var _0x18e263=function(_0x1e6fdd){while(--_0x1e6fdd){_0x2858d1['push'](_0x2858d1['shift']());}};_0x18e263(++_0x4085b0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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 08f13fd..10f78fc 100644 --- a/server/services/ami/model/trigger.js +++ b/server/services/ami/model/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4fc2=['name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x409c8b,_0x4892d4){var _0x430500=function(_0x386132){while(--_0x386132){_0x409c8b['push'](_0x409c8b['shift']());}};_0x430500(++_0x4892d4);}(_0x4fc2,0x111));var _0x24fc=function(_0x1e474c,_0x35e2cb){_0x1e474c=_0x1e474c-0x0;var _0x4a769f=_0x4fc2[_0x1e474c];return _0x4a769f;};'use strict';function Trigger(_0x5ea3ab){this['id']=_0x5ea3ab['id']||0x0;this[_0x24fc('0x0')]=_0x5ea3ab[_0x24fc('0x0')]||'';this[_0x24fc('0x1')]=_0x5ea3ab['channel']||_0x24fc('0x2');this[_0x24fc('0x3')]=_0x5ea3ab[_0x24fc('0x3')]||![];this['AllConditions']=_0x5ea3ab[_0x24fc('0x4')]||[];this[_0x24fc('0x5')]=_0x5ea3ab['AnyConditions']||[];this[_0x24fc('0x6')]=_0x5ea3ab[_0x24fc('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file +var _0x8603=['exports','name','channel','status','AllConditions','AnyConditions','Actions'];(function(_0x2eb37b,_0x40e269){var _0xc8c50=function(_0x4bc1d6){while(--_0x4bc1d6){_0x2eb37b['push'](_0x2eb37b['shift']());}};_0xc8c50(++_0x40e269);}(_0x8603,0x190));var _0x3860=function(_0xd2e11d,_0x4608b6){_0xd2e11d=_0xd2e11d-0x0;var _0x253ac2=_0x8603[_0xd2e11d];return _0x253ac2;};'use strict';function Trigger(_0xba4b79){this['id']=_0xba4b79['id']||0x0;this[_0x3860('0x0')]=_0xba4b79[_0x3860('0x0')]||'';this[_0x3860('0x1')]=_0xba4b79['channel']||'voice';this[_0x3860('0x2')]=_0xba4b79[_0x3860('0x2')]||![];this[_0x3860('0x3')]=_0xba4b79['AllConditions']||[];this[_0x3860('0x4')]=_0xba4b79['AnyConditions']||[];this[_0x3860('0x5')]=_0xba4b79[_0x3860('0x5')]||[];}module[_0x3860('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index bed1644..95f3ddd 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 _0x4c03=['split','host','port','domain','domainport','refresh','registrationtime','defaultuser','exports','active','name','state','unknown','status','registry','indexOf'];(function(_0x24e446,_0xb9828d){var _0x200d1e=function(_0x3be5d5){while(--_0x3be5d5){_0x24e446['push'](_0x24e446['shift']());}};_0x200d1e(++_0xb9828d);}(_0x4c03,0x1c9));var _0x34c0=function(_0x4b21e9,_0x34e84a){_0x4b21e9=_0x4b21e9-0x0;var _0x16d6e7=_0x4c03[_0x4b21e9];return _0x16d6e7;};'use strict';function Trunk(_0x2f802f){this['id']=_0x2f802f['id']||0x0;this[_0x34c0('0x0')]=_0x2f802f['active']||![];this[_0x34c0('0x1')]=_0x2f802f[_0x34c0('0x1')]||'';this[_0x34c0('0x2')]=_0x34c0('0x3');this['stateTime']=0x0;this[_0x34c0('0x4')]='unknown';this['registry']=_0x2f802f[_0x34c0('0x5')]&&_0x2f802f[_0x34c0('0x5')][_0x34c0('0x6')](':')?_0x2f802f[_0x34c0('0x5')][_0x34c0('0x7')](':')[0x0]:'';this[_0x34c0('0x8')]='';this[_0x34c0('0x9')]='';this[_0x34c0('0xa')]='';this[_0x34c0('0xb')]='';this[_0x34c0('0xc')]='';this['stateRegistry']='unknown';this[_0x34c0('0xd')]='';this['address']='';this[_0x34c0('0xe')]=_0x2f802f['defaultuser']||'';}module[_0x34c0('0xf')]=Trunk; \ No newline at end of file +var _0xad95=['split','host','port','domain','refresh','stateRegistry','registrationtime','address','defaultuser','active','name','state','status','unknown','registry'];(function(_0x3c4a67,_0x26d5fa){var _0x134d90=function(_0x4781fd){while(--_0x4781fd){_0x3c4a67['push'](_0x3c4a67['shift']());}};_0x134d90(++_0x26d5fa);}(_0xad95,0x135));var _0x5ad9=function(_0x69eba3,_0x110d61){_0x69eba3=_0x69eba3-0x0;var _0x2d736a=_0xad95[_0x69eba3];return _0x2d736a;};'use strict';function Trunk(_0x3132b2){this['id']=_0x3132b2['id']||0x0;this['active']=_0x3132b2[_0x5ad9('0x0')]||![];this['name']=_0x3132b2[_0x5ad9('0x1')]||'';this[_0x5ad9('0x2')]='unknown';this['stateTime']=0x0;this[_0x5ad9('0x3')]=_0x5ad9('0x4');this[_0x5ad9('0x5')]=_0x3132b2[_0x5ad9('0x5')]&&_0x3132b2['registry']['indexOf'](':')?_0x3132b2[_0x5ad9('0x5')][_0x5ad9('0x6')](':')[0x0]:'';this[_0x5ad9('0x7')]='';this[_0x5ad9('0x8')]='';this[_0x5ad9('0x9')]='';this['domainport']='';this[_0x5ad9('0xa')]='';this[_0x5ad9('0xb')]=_0x5ad9('0x4');this[_0x5ad9('0xc')]='';this[_0x5ad9('0xd')]='';this[_0x5ad9('0xe')]=_0x3132b2['defaultuser']||'';}module['exports']=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index d5fac9b..b6f6f22 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 _0x0651=['recordingFormat','none','exten'];(function(_0x3cca58,_0x532517){var _0xad9c74=function(_0x157e31){while(--_0x157e31){_0x3cca58['push'](_0x3cca58['shift']());}};_0xad9c74(++_0x532517);}(_0x0651,0x16d));var _0x1065=function(_0x38e8d6,_0x3fccc0){_0x38e8d6=_0x38e8d6-0x0;var _0x47d157=_0x0651[_0x38e8d6];return _0x47d157;};'use strict';function voiceExtension(_0xccbc39){this['id']=_0xccbc39['id']||0x0;this[_0x1065('0x0')]=_0xccbc39[_0x1065('0x0')]||'';this[_0x1065('0x1')]=_0xccbc39[_0x1065('0x1')]||_0x1065('0x2');this['mandatoryDisposition']=_0xccbc39['mandatoryDisposition']||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0x7cd1=['exten','recordingFormat','none','mandatoryDisposition','exports'];(function(_0x5e2af3,_0xbaf821){var _0x179e7b=function(_0x5d11e3){while(--_0x5d11e3){_0x5e2af3['push'](_0x5e2af3['shift']());}};_0x179e7b(++_0xbaf821);}(_0x7cd1,0x1ef));var _0x17cd=function(_0x2a2166,_0x3a077f){_0x2a2166=_0x2a2166-0x0;var _0x3bcf50=_0x7cd1[_0x2a2166];return _0x3bcf50;};'use strict';function voiceExtension(_0x30cc31){this['id']=_0x30cc31['id']||0x0;this[_0x17cd('0x0')]=_0x30cc31['exten']||'';this['recordingFormat']=_0x30cc31[_0x17cd('0x1')]||_0x17cd('0x2');this['mandatoryDisposition']=_0x30cc31[_0x17cd('0x3')]||![];}module[_0x17cd('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 5ef2c30..6936d78 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 _0x58e5=['dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','startProgressive','startPredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','fewestcalls','leastrecent','linear','random','ringall','rrmemory','rrordered','wrandom','name','monitor_format','type','total','answered','sumDuration','sumHoldTime','unmanaged','abandoned','available','busy','inUse','invalid','loggedIn','notInUse','onHold','ringing','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue'];(function(_0x1cea2b,_0x5e2d5c){var _0x298602=function(_0xf96b75){while(--_0xf96b75){_0x1cea2b['push'](_0x1cea2b['shift']());}};_0x298602(++_0x5e2d5c);}(_0x58e5,0x167));var _0x558e=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x58e5[_0x51020b];return _0x371e47;};'use strict';var monitorFormat={'wav':_0x558e('0x0'),'wav49':_0x558e('0x1'),'gsm':_0x558e('0x2')};var strategy={'fewestcalls':_0x558e('0x3'),'leastrecent':_0x558e('0x4'),'linear':_0x558e('0x5'),'random':_0x558e('0x6'),'ringall':_0x558e('0x7'),'rr':'roundrobin','rrmemory':_0x558e('0x8'),'rrordered':_0x558e('0x9'),'wrandom':_0x558e('0xa')};function VoiceQueue(_0x57d8b5){this['id']=_0x57d8b5['id']||0x0;this[_0x558e('0xb')]=_0x57d8b5[_0x558e('0xb')]||'';this['monitor_format']=_0x57d8b5[_0x558e('0xc')]||'';this[_0x558e('0xd')]=_0x57d8b5[_0x558e('0xd')]||'inbound';this['waiting']=0x0;this[_0x558e('0xe')]=0x0;this[_0x558e('0xf')]=0x0;this[_0x558e('0x10')]=0x0;this[_0x558e('0x11')]=0x0;this['sumBillable']=0x0;this[_0x558e('0x12')]=0x0;this[_0x558e('0x13')]=0x0;this[_0x558e('0x14')]=0x0;this[_0x558e('0x15')]=0x0;this[_0x558e('0x16')]=0x0;this[_0x558e('0x17')]=0x0;this[_0x558e('0x18')]=0x0;this[_0x558e('0x19')]=0x0;this[_0x558e('0x1a')]=0x0;this['paused']=0x0;this[_0x558e('0x1b')]=0x0;this[_0x558e('0x1c')]=0x0;this[_0x558e('0x1d')]=0x0;this[_0x558e('0x1e')]=0x0;this[_0x558e('0x1f')]=0x0;this[_0x558e('0x20')]=_0x57d8b5[_0x558e('0x20')]||![];this[_0x558e('0x21')]=_0x57d8b5[_0x558e('0x21')]||0xa;this['autopause']=_0x57d8b5[_0x558e('0x22')]||'no';this[_0x558e('0x23')]=!![];this[_0x558e('0x24')]='';this[_0x558e('0x25')]='';this['originated']=0x0;this[_0x558e('0x26')]=0x0;this[_0x558e('0x27')]=_0x57d8b5['dialTimezone']||null;this[_0x558e('0x28')]=_0x57d8b5['dialGlobalInterval']?_0x57d8b5[_0x558e('0x28')]:null;this[_0x558e('0x29')]=_0x57d8b5[_0x558e('0x29')];this[_0x558e('0x2a')]=_0x57d8b5['dialMethod']||_0x558e('0x2b');this[_0x558e('0x2c')]=_0x57d8b5[_0x558e('0x2c')]||0x0;this['dialLimitQueue']=_0x57d8b5[_0x558e('0x2d')]||0x0;this['dialPowerLevel']=_0x57d8b5[_0x558e('0x2e')]||0x1;this[_0x558e('0x2f')]=_0x57d8b5[_0x558e('0x2f')]||'dropRate';this[_0x558e('0x30')]=_0x57d8b5[_0x558e('0x30')]||0.03;this[_0x558e('0x31')]=_0x57d8b5[_0x558e('0x31')]||0x258;this[_0x558e('0x32')]=_0x57d8b5[_0x558e('0x32')]||_0x558e('0x33');this['dialOriginateCallerIdNumber']=_0x57d8b5[_0x558e('0x34')]||_0x558e('0x33');this[_0x558e('0x35')]=_0x57d8b5['dialOriginateTimeout']||0x1e;this[_0x558e('0x36')]=_0x57d8b5[_0x558e('0x36')]||_0x558e('0x37');this['dialQueueTimeout']=_0x57d8b5[_0x558e('0x38')]||0x3;this[_0x558e('0x39')]=_0x57d8b5[_0x558e('0x39')]||undefined;this[_0x558e('0x3a')]=_0x57d8b5['dialCongestionMaxRetry']||0x3;this[_0x558e('0x3b')]=_0x57d8b5['dialCongestionRetryFrequency']||0x96;this[_0x558e('0x3c')]=_0x57d8b5[_0x558e('0x3c')]||0x3;this['dialBusyRetryFrequency']=_0x57d8b5[_0x558e('0x3d')]||0x96;this['dialNoAnswerMaxRetry']=_0x57d8b5[_0x558e('0x3e')]||0x3;this[_0x558e('0x3f')]=_0x57d8b5[_0x558e('0x3f')]||0x96;this[_0x558e('0x40')]=_0x57d8b5[_0x558e('0x40')]||0x3;this[_0x558e('0x41')]=_0x57d8b5[_0x558e('0x41')]||0x96;this[_0x558e('0x42')]=_0x57d8b5[_0x558e('0x42')]||0x3;this[_0x558e('0x43')]=_0x57d8b5[_0x558e('0x43')]||0x96;this['dialAbandonedMaxRetry']=_0x57d8b5[_0x558e('0x44')]||0x3;this[_0x558e('0x45')]=_0x57d8b5['dialAbandonedRetryFrequency']||0x96;this[_0x558e('0x46')]=_0x57d8b5['dialMachineMaxRetry']||0x3;this[_0x558e('0x47')]=_0x57d8b5[_0x558e('0x47')]||0x96;this[_0x558e('0x48')]=_0x57d8b5[_0x558e('0x48')]||0x3;this[_0x558e('0x49')]=_0x57d8b5['dialAgentRejectRetryFrequency']||0x96;this[_0x558e('0x4a')]=_0x57d8b5['callAdditionalPhoneAfterMin']||0x3;this[_0x558e('0x4b')]=_0x57d8b5[_0x558e('0x4b')]||0x4;this['Trunk']=_0x57d8b5[_0x558e('0x4c')]?_0x57d8b5['Trunk']:undefined;this[_0x558e('0x4d')]=_0x57d8b5['TrunkBackup']?_0x57d8b5[_0x558e('0x4d')]:undefined;this[_0x558e('0x4e')]=_0x57d8b5[_0x558e('0x4e')]||undefined;this[_0x558e('0x4f')]=_0x57d8b5['Interval']?_0x57d8b5[_0x558e('0x4f')]:undefined;this[_0x558e('0x50')]=_0x57d8b5[_0x558e('0x50')]||'DESC';this['dialRandomLastDigitCallerIdNumber']=_0x57d8b5[_0x558e('0x51')]||undefined;this[_0x558e('0x52')]=_0x57d8b5['dialCutDigit']||undefined;this[_0x558e('0x53')]=strategy[_0x57d8b5[_0x558e('0x53')]];this[_0x558e('0x54')]=!![];this[_0x558e('0x55')]=_0x57d8b5[_0x558e('0x55')]||![];this[_0x558e('0x56')]=_0x57d8b5['dialAMDInitialSilence'];this[_0x558e('0x57')]=_0x57d8b5[_0x558e('0x57')];this[_0x558e('0x58')]=_0x57d8b5['dialAMDAfterGreetingSilence'];this[_0x558e('0x59')]=_0x57d8b5[_0x558e('0x59')];this[_0x558e('0x5a')]=_0x57d8b5[_0x558e('0x5a')];this[_0x558e('0x5b')]=_0x57d8b5[_0x558e('0x5b')];this[_0x558e('0x5c')]=_0x57d8b5[_0x558e('0x5c')];this['dialAMDSilenceThreshold']=_0x57d8b5[_0x558e('0x5d')];this[_0x558e('0x5e')]=_0x57d8b5[_0x558e('0x5e')];this[_0x558e('0x5f')]=0x0;this[_0x558e('0x60')]=0x0;this[_0x558e('0x61')]=_0x57d8b5[_0x558e('0x61')];this[_0x558e('0x62')]=0x0;this[_0x558e('0x63')]=0x0;this[_0x558e('0x64')]=0x0;this['outboundBusyCallsDay']=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x558e('0x65')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x558e('0x66')]=0x0;this[_0x558e('0x67')]=0x0;this[_0x558e('0x68')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x558e('0x69')]=0x0;this[_0x558e('0x6a')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x558e('0x6b')]=undefined;this[_0x558e('0x6c')]=undefined;this['handlePredictive']=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x558e('0x6d')]=0x0;this[_0x558e('0x6e')]=0x0;this[_0x558e('0x6f')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x558e('0x70')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x558e('0x71')]=0x0;this[_0x558e('0x72')]=0x0;this[_0x558e('0x73')]=_0x57d8b5['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x558e('0x74')]=_0x57d8b5['dialPredictiveIntervalMaxThreshold']||0xa;this[_0x558e('0x75')]=0x0;this[_0x558e('0x76')]=0x0;this[_0x558e('0x77')]=0x1;this[_0x558e('0x78')]=0x0;this[_0x558e('0x79')]=0x0;this[_0x558e('0x7a')]=0x0;this[_0x558e('0x7b')]=0x0;this['dialRecallMeTimeout']=_0x57d8b5[_0x558e('0x7c')]||0x1e;this['dialRecallInQueue']=_0x57d8b5[_0x558e('0x7d')]||![];this[_0x558e('0x7e')]=!!_0x57d8b5[_0x558e('0x7e')]||![];this[_0x558e('0x7f')]=!!_0x57d8b5[_0x558e('0x7f')]||![];this[_0x558e('0x80')]=_0x57d8b5[_0x558e('0x80')]||undefined;this[_0x558e('0x81')]=_0x57d8b5[_0x558e('0x81')]||![];this['dialAgiAfterHangupAgent']=_0x57d8b5[_0x558e('0x82')]||![];this['monitor_format']=monitorFormat[_0x57d8b5[_0x558e('0xc')]]?monitorFormat[_0x57d8b5[_0x558e('0xc')]]:undefined;this[_0x558e('0x83')]=_0x57d8b5[_0x558e('0x83')]||![];this[_0x558e('0x84')]=_0x57d8b5[_0x558e('0x84')]?_0x57d8b5[_0x558e('0x84')]:undefined;this[_0x558e('0x85')]=![];}module[_0x558e('0x86')]=VoiceQueue; \ No newline at end of file +var _0x75bc=['outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundAbandonedDay','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','wav','gsm','fewestcalls','leastrecent','linear','random','roundrobin','rrmemory','name','monitor_format','type','waiting','total','answered','sumDuration','unmanaged','abandoned','available','inUse','invalid','loggedIn','onHold','ringing','ringInUse','talking','unavailable','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay'];(function(_0x1c5950,_0x49e128){var _0x2b720a=function(_0x4454f1){while(--_0x4454f1){_0x1c5950['push'](_0x1c5950['shift']());}};_0x2b720a(++_0x49e128);}(_0x75bc,0x196));var _0xc75b=function(_0x26a561,_0x23d6db){_0x26a561=_0x26a561-0x0;var _0x3f0db9=_0x75bc[_0x26a561];return _0x3f0db9;};'use strict';var monitorFormat={'wav':_0xc75b('0x0'),'wav49':'wav49','gsm':_0xc75b('0x1')};var strategy={'fewestcalls':_0xc75b('0x2'),'leastrecent':_0xc75b('0x3'),'linear':_0xc75b('0x4'),'random':_0xc75b('0x5'),'ringall':'ringall','rr':_0xc75b('0x6'),'rrmemory':_0xc75b('0x7'),'rrordered':'rrordered','wrandom':'wrandom'};function VoiceQueue(_0x27256b){this['id']=_0x27256b['id']||0x0;this[_0xc75b('0x8')]=_0x27256b[_0xc75b('0x8')]||'';this[_0xc75b('0x9')]=_0x27256b['monitor_format']||'';this[_0xc75b('0xa')]=_0x27256b[_0xc75b('0xa')]||'inbound';this[_0xc75b('0xb')]=0x0;this[_0xc75b('0xc')]=0x0;this[_0xc75b('0xd')]=0x0;this[_0xc75b('0xe')]=0x0;this['sumHoldTime']=0x0;this['sumBillable']=0x0;this[_0xc75b('0xf')]=0x0;this[_0xc75b('0x10')]=0x0;this[_0xc75b('0x11')]=0x0;this['busy']=0x0;this[_0xc75b('0x12')]=0x0;this[_0xc75b('0x13')]=0x0;this[_0xc75b('0x14')]=0x0;this['notInUse']=0x0;this[_0xc75b('0x15')]=0x0;this['paused']=0x0;this[_0xc75b('0x16')]=0x0;this[_0xc75b('0x17')]=0x0;this[_0xc75b('0x18')]=0x0;this[_0xc75b('0x19')]=0x0;this['unknown']=0x0;this[_0xc75b('0x1a')]=_0x27256b['acw']||![];this['acwTimeout']=_0x27256b[_0xc75b('0x1b')]||0xa;this[_0xc75b('0x1c')]=_0x27256b[_0xc75b('0x1c')]||'no';this[_0xc75b('0x1d')]=!![];this[_0xc75b('0x1e')]='';this['statusMessage']='';this[_0xc75b('0x1f')]=0x0;this[_0xc75b('0x20')]=0x0;this['dialTimezone']=_0x27256b[_0xc75b('0x21')]||null;this['dialGlobalInterval']=_0x27256b[_0xc75b('0x22')]?_0x27256b[_0xc75b('0x22')]:null;this[_0xc75b('0x23')]=_0x27256b['dialActive'];this['dialMethod']=_0x27256b[_0xc75b('0x24')]||_0xc75b('0x25');this['dialLimitChannel']=_0x27256b[_0xc75b('0x26')]||0x0;this['dialLimitQueue']=_0x27256b[_0xc75b('0x27')]||0x0;this[_0xc75b('0x28')]=_0x27256b['dialPowerLevel']||0x1;this[_0xc75b('0x29')]=_0x27256b['dialPredictiveOptimization']||'dropRate';this['dialPredictiveOptimizationPercentage']=_0x27256b['dialPredictiveOptimizationPercentage']||0.03;this[_0xc75b('0x2a')]=_0x27256b[_0xc75b('0x2a')]||0x258;this[_0xc75b('0x2b')]=_0x27256b[_0xc75b('0x2b')]||'anonymous';this['dialOriginateCallerIdNumber']=_0x27256b[_0xc75b('0x2c')]||_0xc75b('0x2d');this[_0xc75b('0x2e')]=_0x27256b[_0xc75b('0x2e')]||0x1e;this['dialQueueOptions']=_0x27256b['dialQueueOptions']||'tTxX';this[_0xc75b('0x2f')]=_0x27256b[_0xc75b('0x2f')]||0x3;this['dialQueueProject']=_0x27256b[_0xc75b('0x30')]||undefined;this[_0xc75b('0x31')]=_0x27256b['dialCongestionMaxRetry']||0x3;this['dialCongestionRetryFrequency']=_0x27256b[_0xc75b('0x32')]||0x96;this[_0xc75b('0x33')]=_0x27256b[_0xc75b('0x33')]||0x3;this[_0xc75b('0x34')]=_0x27256b['dialBusyRetryFrequency']||0x96;this[_0xc75b('0x35')]=_0x27256b['dialNoAnswerMaxRetry']||0x3;this[_0xc75b('0x36')]=_0x27256b[_0xc75b('0x36')]||0x96;this[_0xc75b('0x37')]=_0x27256b[_0xc75b('0x37')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x27256b['dialNoSuchNumberRetryFrequency']||0x96;this[_0xc75b('0x38')]=_0x27256b[_0xc75b('0x38')]||0x3;this[_0xc75b('0x39')]=_0x27256b[_0xc75b('0x39')]||0x96;this['dialAbandonedMaxRetry']=_0x27256b[_0xc75b('0x3a')]||0x3;this[_0xc75b('0x3b')]=_0x27256b['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x27256b['dialMachineMaxRetry']||0x3;this[_0xc75b('0x3c')]=_0x27256b[_0xc75b('0x3c')]||0x96;this[_0xc75b('0x3d')]=_0x27256b['dialAgentRejectMaxRetry']||0x3;this[_0xc75b('0x3e')]=_0x27256b[_0xc75b('0x3e')]||0x96;this['callAdditionalPhoneAfterMin']=_0x27256b[_0xc75b('0x3f')]||0x3;this[_0xc75b('0x40')]=_0x27256b[_0xc75b('0x40')]||0x4;this[_0xc75b('0x41')]=_0x27256b[_0xc75b('0x41')]?_0x27256b[_0xc75b('0x41')]:undefined;this[_0xc75b('0x42')]=_0x27256b[_0xc75b('0x42')]?_0x27256b['TrunkBackup']:undefined;this[_0xc75b('0x43')]=_0x27256b['dialPrefix']||undefined;this[_0xc75b('0x44')]=_0x27256b[_0xc75b('0x44')]?_0x27256b['Interval']:undefined;this[_0xc75b('0x45')]=_0x27256b[_0xc75b('0x45')]||_0xc75b('0x46');this[_0xc75b('0x47')]=_0x27256b[_0xc75b('0x47')]||undefined;this[_0xc75b('0x48')]=_0x27256b[_0xc75b('0x48')]||undefined;this[_0xc75b('0x49')]=strategy[_0x27256b[_0xc75b('0x49')]];this[_0xc75b('0x4a')]=!![];this[_0xc75b('0x4b')]=_0x27256b[_0xc75b('0x4b')]||![];this['dialAMDInitialSilence']=_0x27256b[_0xc75b('0x4c')];this[_0xc75b('0x4d')]=_0x27256b['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x27256b[_0xc75b('0x4e')];this[_0xc75b('0x4f')]=_0x27256b[_0xc75b('0x4f')];this['dialAMDMinWordLength']=_0x27256b['dialAMDMinWordLength'];this[_0xc75b('0x50')]=_0x27256b['dialAMDBetweenWordsSilence'];this[_0xc75b('0x51')]=_0x27256b[_0xc75b('0x51')];this[_0xc75b('0x52')]=_0x27256b['dialAMDSilenceThreshold'];this[_0xc75b('0x53')]=_0x27256b[_0xc75b('0x53')];this[_0xc75b('0x54')]=0x0;this[_0xc75b('0x55')]=0x0;this['timeout']=_0x27256b[_0xc75b('0x56')];this[_0xc75b('0x57')]=0x0;this[_0xc75b('0x58')]=0x0;this[_0xc75b('0x59')]=0x0;this[_0xc75b('0x5a')]=0x0;this[_0xc75b('0x5b')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0xc75b('0x5c')]=0x0;this[_0xc75b('0x5d')]=0x0;this[_0xc75b('0x5e')]=0x0;this[_0xc75b('0x5f')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this['outboundDropCallsDayACS']=0x0;this['outboundReCallsDay']=0x0;this[_0xc75b('0x60')]=0x0;this['startProgressive']=undefined;this[_0xc75b('0x61')]=undefined;this[_0xc75b('0x62')]=undefined;this[_0xc75b('0x63')]=1.05;this[_0xc75b('0x64')]=0x0;this[_0xc75b('0x65')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0xc75b('0x66')]=0x0;this[_0xc75b('0x67')]=0x0;this[_0xc75b('0x68')]=0x0;this[_0xc75b('0x69')]=0x0;this[_0xc75b('0x6a')]=0x0;this[_0xc75b('0x6b')]=_0x27256b[_0xc75b('0x6c')]||0x14;this[_0xc75b('0x6d')]=_0x27256b[_0xc75b('0x6c')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0xc75b('0x6e')]=0x0;this[_0xc75b('0x6f')]=0x1;this[_0xc75b('0x70')]=0x0;this['erlangCallToSecond']=0x0;this[_0xc75b('0x71')]=0x0;this[_0xc75b('0x72')]=0x0;this[_0xc75b('0x73')]=_0x27256b[_0xc75b('0x73')]||0x1e;this[_0xc75b('0x74')]=_0x27256b[_0xc75b('0x74')]||![];this['dialPreviewAutoRecallMe']=!!_0x27256b[_0xc75b('0x75')]||![];this[_0xc75b('0x76')]=!!_0x27256b[_0xc75b('0x76')]||![];this['dialQueueProject2']=_0x27256b[_0xc75b('0x77')]||undefined;this['dialAgiAfterHangupClient']=_0x27256b[_0xc75b('0x78')]||![];this[_0xc75b('0x79')]=_0x27256b[_0xc75b('0x79')]||![];this['monitor_format']=monitorFormat[_0x27256b[_0xc75b('0x9')]]?monitorFormat[_0x27256b[_0xc75b('0x9')]]:undefined;this[_0xc75b('0x7a')]=_0x27256b[_0xc75b('0x7a')]||![];this[_0xc75b('0x7b')]=_0x27256b[_0xc75b('0x7b')]?_0x27256b[_0xc75b('0x7b')]:undefined;this['queueSummaryCountersUpdated']=![];}module[_0xc75b('0x7c')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 5ad221b..1577864 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 _0x04f1=['inUse','invalid','onHold','notInUse','paused','ringing','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','createReport','loggedin','callers','length','online','includes','status','exten','xcally-motion-preview','some','compareToOutboundQueue','updateReportFromOutboundQueue','originated','preview','exports','available','loggedIn','loggedInDb','talking','waiting','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','pTalking','sumBillable','sumDuration','total','name','strategy','abandoned','answered','busy'];(function(_0x928ab1,_0x27a137){var _0x1fab80=function(_0x2040df){while(--_0x2040df){_0x928ab1['push'](_0x928ab1['shift']());}};_0x1fab80(++_0x27a137);}(_0x04f1,0x92));var _0x104f=function(_0x2f412,_0x3affba){_0x2f412=_0x2f412-0x0;var _0xe490f1=_0x04f1[_0x2f412];return _0xe490f1;};'use strict';var INBOUND_COUNTERS=[_0x104f('0x0'),_0x104f('0x1'),_0x104f('0x2'),'paused','ringing',_0x104f('0x3'),_0x104f('0x4')];var OUTBOUND_COUNTERS=[_0x104f('0x0'),'answered','inUse','loggedIn','loggedInDb','originated',_0x104f('0x5'),_0x104f('0x6'),_0x104f('0x7'),_0x104f('0x8'),'outboundCongestionCallsDay',_0x104f('0x9'),_0x104f('0xa'),_0x104f('0xb'),_0x104f('0xc'),'outboundUnknownCallsDay','paused',_0x104f('0xd'),_0x104f('0x3'),_0x104f('0xe'),_0x104f('0xf'),_0x104f('0x10'),_0x104f('0x4')];function VoiceQueueSummary(_0x395321){this['id']=_0x395321['id'];this[_0x104f('0x11')]=_0x395321[_0x104f('0x11')];this[_0x104f('0x12')]=_0x395321['strategy'];this[_0x104f('0x13')]=_0x395321[_0x104f('0x13')]||0x0;this[_0x104f('0x14')]=_0x395321[_0x104f('0x14')]||0x0;this[_0x104f('0x0')]=_0x395321[_0x104f('0x0')]||0x0;this[_0x104f('0x15')]=_0x395321[_0x104f('0x15')]||0x0;this[_0x104f('0x16')]=_0x395321[_0x104f('0x16')]||0x0;this[_0x104f('0x17')]=_0x395321[_0x104f('0x17')]||0x0;this[_0x104f('0x1')]=_0x395321[_0x104f('0x1')]||0x0;this['loggedInDb']=_0x395321[_0x104f('0x2')]||0x0;this[_0x104f('0x18')]=_0x395321[_0x104f('0x18')]||0x0;this[_0x104f('0x19')]=_0x395321['notInUse']||0x0;this[_0x104f('0x1a')]=_0x395321[_0x104f('0x1a')]||0x0;this['ringing']=_0x395321[_0x104f('0x1b')]||0x0;this[_0x104f('0x1c')]=_0x395321['ringInUse'];this[_0x104f('0xe')]=_0x395321[_0x104f('0xe')];this[_0x104f('0xf')]=_0x395321[_0x104f('0xf')];this[_0x104f('0x1d')]=_0x395321[_0x104f('0x1d')]||0x0;this['talking']=_0x395321[_0x104f('0x3')]||0x0;this['total']=_0x395321['total']||0x0;this[_0x104f('0x1e')]=_0x395321[_0x104f('0x1e')];this[_0x104f('0x1f')]=_0x395321['unavailable']||0x0;this['unknown']=_0x395321[_0x104f('0x20')]||0x0;this['unmanaged']=_0x395321[_0x104f('0x21')]||0x0;this[_0x104f('0x4')]=_0x395321[_0x104f('0x4')]||0x0;if(_0x395321['type']===_0x104f('0x22')){this['pTalking']=_0x395321[_0x104f('0xd')]||0x0;this[_0x104f('0x23')]=_0x395321[_0x104f('0x23')];this['dialMethod']=_0x395321[_0x104f('0x24')];this[_0x104f('0x25')]=_0x395321[_0x104f('0x25')];this[_0x104f('0x26')]=_0x395321['dialOriginateCallerIdNumber'];this[_0x104f('0x27')]=_0x395321['dialOriginateTimeout'];this[_0x104f('0x28')]=_0x395321[_0x104f('0x28')];this['temp']=_0x395321[_0x104f('0x29')];this['outboundAnswerAgiCallsDay']=_0x395321[_0x104f('0x2a')];this[_0x104f('0x6')]=_0x395321[_0x104f('0x6')];this[_0x104f('0x7')]=_0x395321[_0x104f('0x7')];this[_0x104f('0x8')]=_0x395321[_0x104f('0x8')];this[_0x104f('0x2b')]=_0x395321[_0x104f('0x2b')];this[_0x104f('0x2c')]=_0x395321['outboundDropCallsDayACS'];this['outboundDropCallsDayCallersExit']=_0x395321[_0x104f('0x2d')];this[_0x104f('0x2e')]=_0x395321[_0x104f('0x2e')];this[_0x104f('0x9')]=_0x395321[_0x104f('0x9')];this[_0x104f('0xa')]=_0x395321['outboundNoSuchCallsDay'];this['outboundOriginateFailureCallsDay']=_0x395321[_0x104f('0x2f')];this[_0x104f('0xb')]=_0x395321[_0x104f('0xb')];this[_0x104f('0xc')]=_0x395321[_0x104f('0xc')];this[_0x104f('0x30')]=_0x395321['outboundUnknownCallsDay'];this['predictiveIntervalAnsweredCalls']=_0x395321['predictiveIntervalAnsweredCalls'];this[_0x104f('0x31')]=_0x395321[_0x104f('0x31')];this['predictiveIntervalAvgTalktime']=_0x395321[_0x104f('0x32')];this['predictiveIntervalDroppedCallsCallersExit']=_0x395321['predictiveIntervalDroppedCallsCallersExit'];this[_0x104f('0x33')]=_0x395321['predictiveIntervalDroppedCallsTimeout'];this['predictiveIntervalErlangCalls']=_0x395321['predictiveIntervalErlangCalls'];this[_0x104f('0x34')]=_0x395321['predictiveIntervalErlangCallsDroppedCalls'];this[_0x104f('0x35')]=_0x395321[_0x104f('0x35')];this['predictiveIntervalMultiplicativeFactor']=_0x395321['predictiveIntervalMultiplicativeFactor'];this[_0x104f('0x36')]=_0x395321['predictiveIntervalPauses'];this[_0x104f('0x37')]=_0x395321[_0x104f('0x37')];this['predictiveIntervalTotalCalls']=_0x395321[_0x104f('0x38')];this['originated']=_0x395321['originated'];this['erlangCalls']=_0x395321[_0x104f('0x39')];this[_0x104f('0x3a')]=_0x395321['erlangCallToSecond'];this['erlangAbandonmentRate']=_0x395321[_0x104f('0x3b')];this[_0x104f('0x3c')]=_0x395321[_0x104f('0x3c')];this[_0x104f('0x3d')]=_0x395321[_0x104f('0x3d')];this[_0x104f('0x3e')]=_0x395321['startProgressive'];this[_0x104f('0x3f')]=_0x395321['message'];this[_0x104f('0x40')]=_0x395321['statusMessage'];}if(_0x395321[_0x104f('0x41')]){this['Trunk']={'id':_0x395321['Trunk']['id'],'name':_0x395321[_0x104f('0x41')][_0x104f('0x11')],'active':_0x395321[_0x104f('0x41')][_0x104f('0x42')],'callerid':_0x395321['Trunk'][_0x104f('0x43')]};}}VoiceQueueSummary[_0x104f('0x44')][_0x104f('0x45')]=function(_0xcf740f,_0x2046ad,_0x18cdbd,_0x58fe76){this['loggedInDb']=0x0;this[_0x104f('0x3')]=0x0;this[_0x104f('0x1a')]=0x0;this[_0x104f('0x20')]=0x0;this[_0x104f('0x19')]=0x0;this[_0x104f('0x16')]=0x0;this[_0x104f('0x15')]=0x0;this['invalid']=0x0;this[_0x104f('0x1f')]=0x0;this['ringing']=0x0;this['ringInUse']=0x0;this['onHold']=0x0;if(_0x18cdbd){if(_0x18cdbd[_0x104f('0x0')]){this['available']=Number(_0x18cdbd[_0x104f('0x0')]);}if(_0x18cdbd[_0x104f('0x46')]){this[_0x104f('0x1')]=Number(_0x18cdbd[_0x104f('0x46')]);}if(_0x18cdbd[_0x104f('0x47')]){this[_0x104f('0x4')]=Number(_0x18cdbd[_0x104f('0x47')]);}}for(var _0x5d5ebf=0x0;_0x5d5ebf<_0xcf740f[_0x104f('0x48')];_0x5d5ebf++){var _0x39266b=_0x2046ad['SIP/'+_0xcf740f[_0x5d5ebf][_0x104f('0x11')]];if(_0x39266b&&_0x39266b[_0x104f('0x49')]){this[_0x104f('0x2')]+=0x1;}if(_0xcf740f[_0x5d5ebf]['incall']==='1'){this[_0x104f('0x3')]+=0x1;}if(_0xcf740f[_0x5d5ebf][_0x104f('0x1a')]==='1'&&!['2','7','8'][_0x104f('0x4a')](_0xcf740f[_0x5d5ebf][_0x104f('0x4b')])){this['paused']+=0x1;}switch(_0xcf740f[_0x5d5ebf][_0x104f('0x4b')]){case'0':this[_0x104f('0x20')]+=0x1;break;case'1':this[_0x104f('0x19')]+=0x1;break;case'2':this[_0x104f('0x16')]+=0x1;break;case'3':this[_0x104f('0x15')]+=0x1;break;case'4':this[_0x104f('0x17')]+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this[_0x104f('0x1b')]+=0x1;break;case'7':this[_0x104f('0x1c')]+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this[_0x104f('0x24')]==='booked'){var _0x79ba52=Object['keys'](_0x58fe76);for(var _0x4e9458=0x0;_0x4e9458<_0x79ba52[_0x104f('0x48')];_0x4e9458++){var _0x5eb872=_0x79ba52[_0x4e9458];var _0x576e8f=_0x58fe76[_0x5eb872];if(_0x576e8f['queue']===this[_0x104f('0x11')]&&_0x576e8f[_0x104f('0x1e')]==='dialer'&&_0x576e8f[_0x104f('0x4c')]===_0x104f('0x4d')){this[_0x104f('0x3')]+=0x1;}}if(this[_0x104f('0x3')]>this['inUse']){this[_0x104f('0x3')]=this[_0x104f('0x16')];}this[_0x104f('0xd')]=0x0;}return this;};VoiceQueueSummary[_0x104f('0x44')]['compareToInboundQueue']=function(_0x4a88f3){var _0x24e0c9=![];if(_0x4a88f3){_0x24e0c9=INBOUND_COUNTERS[_0x104f('0x4e')](function(_0x51b0d5){return this[_0x51b0d5]!==_0x4a88f3[_0x51b0d5];},this);}return _0x24e0c9;};VoiceQueueSummary['prototype'][_0x104f('0x4f')]=function(_0x36eb30){var _0x510453=![];var _0x220818=![];var _0x2f2494=![];if(_0x36eb30){_0x510453=this[_0x104f('0x24')]!==_0x36eb30[_0x104f('0x24')]||this[_0x104f('0x23')]!==_0x36eb30[_0x104f('0x23')]||this['message']!==_0x36eb30['message']||this['statusMessage']!==_0x36eb30[_0x104f('0x40')];_0x220818=OUTBOUND_COUNTERS[_0x104f('0x4e')](function(_0x2de210){return this[_0x2de210]!==_0x36eb30[_0x2de210];},this);if(this['Trunk']&&_0x36eb30[_0x104f('0x41')]){_0x2f2494=this[_0x104f('0x41')][_0x104f('0x11')]!==_0x36eb30['Trunk'][_0x104f('0x11')]||this[_0x104f('0x41')][_0x104f('0x42')]!==_0x36eb30['Trunk']['active'];}}return _0x510453||_0x220818||_0x2f2494;};VoiceQueueSummary[_0x104f('0x44')][_0x104f('0x50')]=function(_0x49ac55){this['answered']=_0x49ac55[_0x104f('0x14')];this['message']=_0x49ac55[_0x104f('0x3f')];this[_0x104f('0x40')]=_0x49ac55[_0x104f('0x40')];this[_0x104f('0x51')]=_0x49ac55['originated'];this['outboundAbandonedCallsDay']=_0x49ac55[_0x104f('0x5')];this['outboundAnswerCallsDay']=_0x49ac55[_0x104f('0x6')];this[_0x104f('0x7')]=_0x49ac55[_0x104f('0x7')];this[_0x104f('0x8')]=_0x49ac55[_0x104f('0x8')];this[_0x104f('0x2b')]=_0x49ac55['outboundCongestionCallsDay'];this[_0x104f('0x9')]=_0x49ac55['outboundNoAnswerCallsDay'];this[_0x104f('0xa')]=_0x49ac55[_0x104f('0xa')];this[_0x104f('0xb')]=_0x49ac55[_0x104f('0xb')];this[_0x104f('0xc')]=_0x49ac55[_0x104f('0xc')];this['outboundUnknownCallsDay']=_0x49ac55[_0x104f('0x30')];this[_0x104f('0xe')]=_0x49ac55[_0x104f('0xe')];this['sumDuration']=_0x49ac55[_0x104f('0xf')];this[_0x104f('0x10')]=_0x49ac55[_0x104f('0x10')];if(this[_0x104f('0x24')]===_0x104f('0x52')){this[_0x104f('0xd')]=_0x49ac55['pTalking'];}};module[_0x104f('0x53')]=VoiceQueueSummary; \ No newline at end of file +var _0x8255=['predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','callerid','createReport','notInUse','loggedin','length','SIP/','online','includes','booked','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','prototype','active','updateReportFromOutboundQueue','preview','exports','available','loggedIn','loggedInDb','paused','ringing','talking','waiting','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','pTalking','sumDuration','total','name','abandoned','answered','busy','inUse','invalid','onHold','ringInUse','sumBillable','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout'];(function(_0x4b9dc9,_0x14b3a2){var _0x57b302=function(_0x4f99ff){while(--_0x4f99ff){_0x4b9dc9['push'](_0x4b9dc9['shift']());}};_0x57b302(++_0x14b3a2);}(_0x8255,0x176));var _0x5825=function(_0x5c8ec6,_0x4380b1){_0x5c8ec6=_0x5c8ec6-0x0;var _0x47b356=_0x8255[_0x5c8ec6];return _0x47b356;};'use strict';var INBOUND_COUNTERS=[_0x5825('0x0'),_0x5825('0x1'),_0x5825('0x2'),_0x5825('0x3'),_0x5825('0x4'),_0x5825('0x5'),_0x5825('0x6')];var OUTBOUND_COUNTERS=['available','answered','inUse',_0x5825('0x1'),_0x5825('0x2'),_0x5825('0x7'),_0x5825('0x8'),_0x5825('0x9'),_0x5825('0xa'),_0x5825('0xb'),'outboundCongestionCallsDay','outboundNoAnswerCallsDay',_0x5825('0xc'),_0x5825('0xd'),_0x5825('0xe'),'outboundUnknownCallsDay','paused',_0x5825('0xf'),_0x5825('0x5'),'sumBillable',_0x5825('0x10'),_0x5825('0x11'),'waiting'];function VoiceQueueSummary(_0x22d36c){this['id']=_0x22d36c['id'];this[_0x5825('0x12')]=_0x22d36c[_0x5825('0x12')];this['strategy']=_0x22d36c['strategy'];this[_0x5825('0x13')]=_0x22d36c[_0x5825('0x13')]||0x0;this[_0x5825('0x14')]=_0x22d36c[_0x5825('0x14')]||0x0;this['available']=_0x22d36c[_0x5825('0x0')]||0x0;this['busy']=_0x22d36c[_0x5825('0x15')]||0x0;this[_0x5825('0x16')]=_0x22d36c[_0x5825('0x16')]||0x0;this[_0x5825('0x17')]=_0x22d36c[_0x5825('0x17')]||0x0;this['loggedIn']=_0x22d36c['loggedIn']||0x0;this[_0x5825('0x2')]=_0x22d36c[_0x5825('0x2')]||0x0;this[_0x5825('0x18')]=_0x22d36c[_0x5825('0x18')]||0x0;this['notInUse']=_0x22d36c['notInUse']||0x0;this[_0x5825('0x3')]=_0x22d36c[_0x5825('0x3')]||0x0;this[_0x5825('0x4')]=_0x22d36c[_0x5825('0x4')]||0x0;this['ringInUse']=_0x22d36c[_0x5825('0x19')];this[_0x5825('0x1a')]=_0x22d36c[_0x5825('0x1a')];this[_0x5825('0x10')]=_0x22d36c[_0x5825('0x10')];this[_0x5825('0x1b')]=_0x22d36c['sumHoldTime']||0x0;this['talking']=_0x22d36c[_0x5825('0x5')]||0x0;this[_0x5825('0x11')]=_0x22d36c[_0x5825('0x11')]||0x0;this['type']=_0x22d36c[_0x5825('0x1c')];this[_0x5825('0x1d')]=_0x22d36c['unavailable']||0x0;this[_0x5825('0x1e')]=_0x22d36c[_0x5825('0x1e')]||0x0;this[_0x5825('0x1f')]=_0x22d36c['unmanaged']||0x0;this['waiting']=_0x22d36c['waiting']||0x0;if(_0x22d36c['type']===_0x5825('0x20')){this[_0x5825('0xf')]=_0x22d36c[_0x5825('0xf')]||0x0;this[_0x5825('0x21')]=_0x22d36c[_0x5825('0x21')];this[_0x5825('0x22')]=_0x22d36c['dialMethod'];this[_0x5825('0x23')]=_0x22d36c[_0x5825('0x23')];this[_0x5825('0x24')]=_0x22d36c[_0x5825('0x24')];this[_0x5825('0x25')]=_0x22d36c[_0x5825('0x25')];this[_0x5825('0x26')]=_0x22d36c[_0x5825('0x26')];this['temp']=_0x22d36c['temp'];this[_0x5825('0x27')]=_0x22d36c[_0x5825('0x27')];this['outboundAnswerCallsDay']=_0x22d36c[_0x5825('0x9')];this[_0x5825('0xa')]=_0x22d36c['outboundBlacklistCallsDay'];this[_0x5825('0xb')]=_0x22d36c['outboundBusyCallsDay'];this['outboundCongestionCallsDay']=_0x22d36c[_0x5825('0x28')];this['outboundDropCallsDayACS']=_0x22d36c[_0x5825('0x29')];this['outboundDropCallsDayCallersExit']=_0x22d36c['outboundDropCallsDayCallersExit'];this[_0x5825('0x2a')]=_0x22d36c[_0x5825('0x2a')];this[_0x5825('0x2b')]=_0x22d36c[_0x5825('0x2b')];this[_0x5825('0xc')]=_0x22d36c[_0x5825('0xc')];this[_0x5825('0x2c')]=_0x22d36c[_0x5825('0x2c')];this[_0x5825('0xd')]=_0x22d36c[_0x5825('0xd')];this[_0x5825('0xe')]=_0x22d36c['outboundRejectCallsDay'];this[_0x5825('0x2d')]=_0x22d36c['outboundUnknownCallsDay'];this[_0x5825('0x2e')]=_0x22d36c[_0x5825('0x2e')];this[_0x5825('0x2f')]=_0x22d36c[_0x5825('0x2f')];this[_0x5825('0x30')]=_0x22d36c[_0x5825('0x30')];this[_0x5825('0x31')]=_0x22d36c[_0x5825('0x31')];this[_0x5825('0x32')]=_0x22d36c[_0x5825('0x32')];this[_0x5825('0x33')]=_0x22d36c[_0x5825('0x33')];this[_0x5825('0x34')]=_0x22d36c[_0x5825('0x34')];this[_0x5825('0x35')]=_0x22d36c[_0x5825('0x35')];this[_0x5825('0x36')]=_0x22d36c['predictiveIntervalMultiplicativeFactor'];this['predictiveIntervalPauses']=_0x22d36c['predictiveIntervalPauses'];this[_0x5825('0x37')]=_0x22d36c[_0x5825('0x37')];this[_0x5825('0x38')]=_0x22d36c[_0x5825('0x38')];this[_0x5825('0x7')]=_0x22d36c['originated'];this[_0x5825('0x39')]=_0x22d36c[_0x5825('0x39')];this[_0x5825('0x3a')]=_0x22d36c['erlangCallToSecond'];this[_0x5825('0x3b')]=_0x22d36c['erlangAbandonmentRate'];this[_0x5825('0x3c')]=_0x22d36c[_0x5825('0x3c')];this[_0x5825('0x3d')]=_0x22d36c[_0x5825('0x3d')];this[_0x5825('0x3e')]=_0x22d36c[_0x5825('0x3e')];this[_0x5825('0x3f')]=_0x22d36c[_0x5825('0x3f')];this['statusMessage']=_0x22d36c[_0x5825('0x40')];}if(_0x22d36c[_0x5825('0x41')]){this[_0x5825('0x41')]={'id':_0x22d36c['Trunk']['id'],'name':_0x22d36c[_0x5825('0x41')]['name'],'active':_0x22d36c[_0x5825('0x41')]['active'],'callerid':_0x22d36c[_0x5825('0x41')][_0x5825('0x42')]};}}VoiceQueueSummary['prototype'][_0x5825('0x43')]=function(_0xb8de42,_0x21bd17,_0x356834,_0x224c59){this['loggedInDb']=0x0;this[_0x5825('0x5')]=0x0;this[_0x5825('0x3')]=0x0;this[_0x5825('0x1e')]=0x0;this[_0x5825('0x44')]=0x0;this[_0x5825('0x16')]=0x0;this[_0x5825('0x15')]=0x0;this[_0x5825('0x17')]=0x0;this[_0x5825('0x1d')]=0x0;this['ringing']=0x0;this[_0x5825('0x19')]=0x0;this[_0x5825('0x18')]=0x0;if(_0x356834){if(_0x356834[_0x5825('0x0')]){this[_0x5825('0x0')]=Number(_0x356834[_0x5825('0x0')]);}if(_0x356834[_0x5825('0x45')]){this[_0x5825('0x1')]=Number(_0x356834[_0x5825('0x45')]);}if(_0x356834['callers']){this['waiting']=Number(_0x356834['callers']);}}for(var _0x3d74de=0x0;_0x3d74de<_0xb8de42[_0x5825('0x46')];_0x3d74de++){var _0x2a83eb=_0x21bd17[_0x5825('0x47')+_0xb8de42[_0x3d74de][_0x5825('0x12')]];if(_0x2a83eb&&_0x2a83eb[_0x5825('0x48')]){this[_0x5825('0x2')]+=0x1;}if(_0xb8de42[_0x3d74de]['incall']==='1'){this[_0x5825('0x5')]+=0x1;}if(_0xb8de42[_0x3d74de]['paused']==='1'&&!['2','7','8'][_0x5825('0x49')](_0xb8de42[_0x3d74de]['status'])){this[_0x5825('0x3')]+=0x1;}switch(_0xb8de42[_0x3d74de]['status']){case'0':this['unknown']+=0x1;break;case'1':this[_0x5825('0x44')]+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0x5825('0x15')]+=0x1;break;case'4':this[_0x5825('0x17')]+=0x1;break;case'5':this[_0x5825('0x1d')]+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this[_0x5825('0x19')]+=0x1;break;case'8':this[_0x5825('0x18')]+=0x1;break;}}if(this[_0x5825('0x22')]===_0x5825('0x4a')){var _0x4562e0=Object['keys'](_0x224c59);for(var _0xf1064e=0x0;_0xf1064e<_0x4562e0[_0x5825('0x46')];_0xf1064e++){var _0x4c09a4=_0x4562e0[_0xf1064e];var _0x439a5f=_0x224c59[_0x4c09a4];if(_0x439a5f['queue']===this[_0x5825('0x12')]&&_0x439a5f[_0x5825('0x1c')]===_0x5825('0x4b')&&_0x439a5f[_0x5825('0x4c')]===_0x5825('0x4d')){this[_0x5825('0x5')]+=0x1;}}if(this[_0x5825('0x5')]>this['inUse']){this['talking']=this[_0x5825('0x16')];}this[_0x5825('0xf')]=0x0;}return this;};VoiceQueueSummary['prototype'][_0x5825('0x4e')]=function(_0x562b4c){var _0x43e571=![];if(_0x562b4c){_0x43e571=INBOUND_COUNTERS[_0x5825('0x4f')](function(_0x1f83e3){return this[_0x1f83e3]!==_0x562b4c[_0x1f83e3];},this);}return _0x43e571;};VoiceQueueSummary[_0x5825('0x50')]['compareToOutboundQueue']=function(_0x488482){var _0x3ac086=![];var _0xbc6e0a=![];var _0x127c92=![];if(_0x488482){_0x3ac086=this[_0x5825('0x22')]!==_0x488482[_0x5825('0x22')]||this[_0x5825('0x21')]!==_0x488482[_0x5825('0x21')]||this['message']!==_0x488482[_0x5825('0x3f')]||this['statusMessage']!==_0x488482[_0x5825('0x40')];_0xbc6e0a=OUTBOUND_COUNTERS[_0x5825('0x4f')](function(_0x3e3609){return this[_0x3e3609]!==_0x488482[_0x3e3609];},this);if(this[_0x5825('0x41')]&&_0x488482[_0x5825('0x41')]){_0x127c92=this['Trunk']['name']!==_0x488482[_0x5825('0x41')]['name']||this[_0x5825('0x41')][_0x5825('0x51')]!==_0x488482['Trunk'][_0x5825('0x51')];}}return _0x3ac086||_0xbc6e0a||_0x127c92;};VoiceQueueSummary[_0x5825('0x50')][_0x5825('0x52')]=function(_0x5c0775){this['answered']=_0x5c0775[_0x5825('0x14')];this[_0x5825('0x3f')]=_0x5c0775['message'];this[_0x5825('0x40')]=_0x5c0775[_0x5825('0x40')];this[_0x5825('0x7')]=_0x5c0775['originated'];this['outboundAbandonedCallsDay']=_0x5c0775['outboundAbandonedCallsDay'];this[_0x5825('0x9')]=_0x5c0775['outboundAnswerCallsDay'];this[_0x5825('0xa')]=_0x5c0775['outboundBlacklistCallsDay'];this[_0x5825('0xb')]=_0x5c0775[_0x5825('0xb')];this[_0x5825('0x28')]=_0x5c0775[_0x5825('0x28')];this[_0x5825('0x2b')]=_0x5c0775[_0x5825('0x2b')];this[_0x5825('0xc')]=_0x5c0775[_0x5825('0xc')];this['outboundReCallsDay']=_0x5c0775[_0x5825('0xd')];this[_0x5825('0xe')]=_0x5c0775[_0x5825('0xe')];this[_0x5825('0x2d')]=_0x5c0775[_0x5825('0x2d')];this[_0x5825('0x1a')]=_0x5c0775[_0x5825('0x1a')];this[_0x5825('0x10')]=_0x5c0775[_0x5825('0x10')];this['total']=_0x5c0775[_0x5825('0x11')];if(this[_0x5825('0x22')]===_0x5825('0x53')){this[_0x5825('0xf')]=_0x5c0775[_0x5825('0xf')];}};module[_0x5825('0x54')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index beb365a..e54bfba 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 _0x26b6=['accessKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x4cf3a0,_0xc29e73){var _0x25adb7=function(_0x1a1052){while(--_0x1a1052){_0x4cf3a0['push'](_0x4cf3a0['shift']());}};_0x25adb7(++_0xc29e73);}(_0x26b6,0x7d));var _0x626b=function(_0x134065,_0x413494){_0x134065=_0x134065-0x0;var _0x46865c=_0x26b6[_0x134065];return _0x46865c;};'use strict';function VtigerAccount(_0x132ce1){this['id']=_0x132ce1['id']||0x0;this['name']=_0x132ce1['name']||'';this['username']=_0x132ce1['username']||'';this[_0x626b('0x0')]=_0x132ce1[_0x626b('0x0')]||'';this[_0x626b('0x1')]=_0x132ce1[_0x626b('0x1')]||'';this['serverUrl']=_0x132ce1[_0x626b('0x2')]||'';this[_0x626b('0x3')]=_0x132ce1[_0x626b('0x3')]||{};}module[_0x626b('0x4')]=VtigerAccount; \ No newline at end of file +var _0x688e=['username','accessKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0xb9271,_0x2cb0bf){var _0x4cbe7c=function(_0x4ec8ec){while(--_0x4ec8ec){_0xb9271['push'](_0xb9271['shift']());}};_0x4cbe7c(++_0x2cb0bf);}(_0x688e,0x13a));var _0xe688=function(_0x189c30,_0x203e90){_0x189c30=_0x189c30-0x0;var _0x1bfaa0=_0x688e[_0x189c30];return _0x1bfaa0;};'use strict';function VtigerAccount(_0x14d9d3){this['id']=_0x14d9d3['id']||0x0;this[_0xe688('0x0')]=_0x14d9d3[_0xe688('0x0')]||'';this[_0xe688('0x1')]=_0x14d9d3[_0xe688('0x1')]||'';this[_0xe688('0x2')]=_0x14d9d3[_0xe688('0x2')]||'';this['remoteUri']=_0x14d9d3[_0xe688('0x3')]||'';this[_0xe688('0x4')]=_0x14d9d3[_0xe688('0x4')]||'';this[_0xe688('0x5')]=_0x14d9d3[_0xe688('0x5')]||{};}module[_0xe688('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 57fcaf8..1c529c6 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 _0x2644=['type','integrationTab','serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType'];(function(_0x293056,_0x14807a){var _0xcefea6=function(_0x3f0808){while(--_0x3f0808){_0x293056['push'](_0x293056['shift']());}};_0xcefea6(++_0x14807a);}(_0x2644,0x186));var _0x4264=function(_0x20118a,_0x3dbdf3){_0x20118a=_0x20118a-0x0;var _0x538b5f=_0x2644[_0x20118a];return _0x538b5f;};'use strict';function ZendeskAccount(_0x33b153){this['id']=_0x33b153['id']||0x0;this[_0x4264('0x0')]=_0x33b153['name']||'';this[_0x4264('0x1')]=_0x33b153['username']||'';this[_0x4264('0x2')]=_0x33b153[_0x4264('0x2')]||'';this[_0x4264('0x3')]=_0x33b153[_0x4264('0x3')]||'';this[_0x4264('0x4')]=_0x33b153[_0x4264('0x4')]||'';this['authType']=_0x33b153[_0x4264('0x5')]||'';this['type']=_0x33b153[_0x4264('0x6')]||_0x4264('0x7');this[_0x4264('0x8')]=_0x33b153[_0x4264('0x8')]||'';this[_0x4264('0x9')]=_0x33b153['Configurations']||{};}module[_0x4264('0xa')]=ZendeskAccount; \ No newline at end of file +var _0xff3e=['serverUrl','Configurations','exports','username','password','token','remoteUri','authType','type'];(function(_0x2ac4af,_0x288c53){var _0x3a36df=function(_0x271b11){while(--_0x271b11){_0x2ac4af['push'](_0x2ac4af['shift']());}};_0x3a36df(++_0x288c53);}(_0xff3e,0x18f));var _0xeff3=function(_0x510608,_0x1b7282){_0x510608=_0x510608-0x0;var _0x117533=_0xff3e[_0x510608];return _0x117533;};'use strict';function ZendeskAccount(_0xcdb10){this['id']=_0xcdb10['id']||0x0;this['name']=_0xcdb10['name']||'';this['username']=_0xcdb10[_0xeff3('0x0')]||'';this[_0xeff3('0x1')]=_0xcdb10[_0xeff3('0x1')]||'';this[_0xeff3('0x2')]=_0xcdb10['token']||'';this[_0xeff3('0x3')]=_0xcdb10[_0xeff3('0x3')]||'';this[_0xeff3('0x4')]=_0xcdb10['authType']||'';this[_0xeff3('0x5')]=_0xcdb10[_0xeff3('0x5')]||'integrationTab';this[_0xeff3('0x6')]=_0xcdb10[_0xeff3('0x6')]||'';this[_0xeff3('0x7')]=_0xcdb10[_0xeff3('0x7')]||{};}module[_0xeff3('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 ca850f5..50e7b94 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 _0xc3b5=['code','refreshToken','Configurations','exports','name','description','host','zone','clientId','serverUrl'];(function(_0x59f202,_0x4ae020){var _0x4fc27b=function(_0x150477){while(--_0x150477){_0x59f202['push'](_0x59f202['shift']());}};_0x4fc27b(++_0x4ae020);}(_0xc3b5,0x1c6));var _0x5c3b=function(_0x161b7e,_0x222ef7){_0x161b7e=_0x161b7e-0x0;var _0x2e21f6=_0xc3b5[_0x161b7e];return _0x2e21f6;};'use strict';function ZohoAccount(_0x389c16){this['id']=_0x389c16['id']||0x0;this[_0x5c3b('0x0')]=_0x389c16['name']||'';this[_0x5c3b('0x1')]=_0x389c16[_0x5c3b('0x1')]||'';this[_0x5c3b('0x2')]=_0x389c16[_0x5c3b('0x2')]||'';this[_0x5c3b('0x3')]=_0x389c16[_0x5c3b('0x3')]||'';this[_0x5c3b('0x4')]=_0x389c16[_0x5c3b('0x4')]||'';this['clientSecret']=_0x389c16['clientSecret']||'';this['serverUrl']=_0x389c16[_0x5c3b('0x5')]||'';this[_0x5c3b('0x6')]=_0x389c16[_0x5c3b('0x6')]||'';this['refreshToken']=_0x389c16[_0x5c3b('0x7')]||'';this['Configurations']=_0x389c16[_0x5c3b('0x8')]||{};}module[_0x5c3b('0x9')]=ZohoAccount; \ No newline at end of file +var _0x51e0=['exports','name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations'];(function(_0x2ac97a,_0x1dec17){var _0x5ca2ca=function(_0x5873aa){while(--_0x5873aa){_0x2ac97a['push'](_0x2ac97a['shift']());}};_0x5ca2ca(++_0x1dec17);}(_0x51e0,0x1c4));var _0x051e=function(_0x2a60b4,_0x338ecf){_0x2a60b4=_0x2a60b4-0x0;var _0x34ed00=_0x51e0[_0x2a60b4];return _0x34ed00;};'use strict';function ZohoAccount(_0x21dab7){this['id']=_0x21dab7['id']||0x0;this[_0x051e('0x0')]=_0x21dab7['name']||'';this[_0x051e('0x1')]=_0x21dab7[_0x051e('0x1')]||'';this['host']=_0x21dab7[_0x051e('0x2')]||'';this[_0x051e('0x3')]=_0x21dab7['zone']||'';this[_0x051e('0x4')]=_0x21dab7[_0x051e('0x4')]||'';this['clientSecret']=_0x21dab7[_0x051e('0x5')]||'';this[_0x051e('0x6')]=_0x21dab7[_0x051e('0x6')]||'';this[_0x051e('0x7')]=_0x21dab7['code']||'';this[_0x051e('0x8')]=_0x21dab7[_0x051e('0x8')]||'';this[_0x051e('0x9')]=_0x21dab7[_0x051e('0x9')]||{};}module[_0x051e('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 43c9b0c..e4e7a9d 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 _0x8f4c=['lodash','moment','isNil','string','idContact','queue','name','type','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','calleridname','number','exports','util'];(function(_0x5bb50e,_0x3f03e0){var _0x46950c=function(_0x1fe690){while(--_0x1fe690){_0x5bb50e['push'](_0x5bb50e['shift']());}};_0x46950c(++_0x3f03e0);}(_0x8f4c,0x113));var _0xc8f4=function(_0x1eebd1,_0x5960dd){_0x1eebd1=_0x1eebd1-0x0;var _0x3f49e9=_0x8f4c[_0x1eebd1];return _0x3f49e9;};'use strict';var util=require(_0xc8f4('0x0'));var _=require(_0xc8f4('0x1'));var moment=require(_0xc8f4('0x2'));function checkNameSurname(_0x43926b,_0x19893b,_0x134d73){var _0x580083='';if(!_[_0xc8f4('0x3')](_0x19893b)&&_0xc8f4('0x4')===typeof _0x19893b){_0x580083+=_0x19893b;}if(!_[_0xc8f4('0x3')](_0x134d73)&&'string'===typeof _0x134d73){_0x580083+='\x20'+_0x134d73;}if(_0x580083!==''){return _0x580083;}return _0x43926b;}function Action(_0x32cd80,_0x5208da,_0x4c86f8,_0x520063,_0x373506){this['uniqueid']=_0x4c86f8||undefined;this[_0xc8f4('0x5')]=_0x32cd80['id'];this[_0xc8f4('0x6')]=_0x5208da[_0xc8f4('0x7')];this[_0xc8f4('0x8')]=_0x5208da[_0xc8f4('0x8')];this['campaigntype']=_0xc8f4('0x6');this[_0xc8f4('0x9')]=![];this[_0xc8f4('0xa')]=_[_0xc8f4('0x3')](_0x32cd80['Agent'])?undefined:_0x32cd80[_0xc8f4('0xb')]['name'];this[_0xc8f4('0xc')]=this[_0xc8f4('0xa')]?util[_0xc8f4('0xd')](_0xc8f4('0xe'),this[_0xc8f4('0xa')]):_0x520063||undefined;this['calleridname']=checkNameSurname(_0x32cd80[_0xc8f4('0xf')][_0xc8f4('0x10')],_0x32cd80[_0xc8f4('0xf')][_0xc8f4('0x11')],_0x32cd80[_0xc8f4('0xf')][_0xc8f4('0x12')]);this['active']=_0x32cd80[_0xc8f4('0x13')]||![];this[_0xc8f4('0x14')]=_0x32cd80[_0xc8f4('0x10')];this[_0xc8f4('0x15')]=_0x32cd80[_0xc8f4('0x15')];this['countbusyretry']=_0x32cd80[_0xc8f4('0x16')]||0x0;this['countcongestionretry']=_0x32cd80['countcongestionretry']||0x0;this[_0xc8f4('0x17')]=_0x32cd80[_0xc8f4('0x17')]||0x0;this[_0xc8f4('0x18')]=(_0x32cd80[_0xc8f4('0x16')]||0x0)+(_0x32cd80[_0xc8f4('0x19')]||0x0)+(_0x32cd80[_0xc8f4('0x17')]||0x0)+(_0x32cd80[_0xc8f4('0x1a')]||0x0)+(_0x32cd80[_0xc8f4('0x1b')]||0x0)+(_0x32cd80[_0xc8f4('0x1c')]||0x0)+(_0x32cd80[_0xc8f4('0x1d')]||0x0)+(_0x32cd80[_0xc8f4('0x1e')]||0x0);this[_0xc8f4('0x1a')]=_0x32cd80[_0xc8f4('0x1a')]||0x0;this['countdropretry']=_0x32cd80[_0xc8f4('0x1b')]||0x0;this[_0xc8f4('0x1c')]=_0x32cd80[_0xc8f4('0x1c')]||0x0;this[_0xc8f4('0x1d')]=_0x32cd80[_0xc8f4('0x1d')]||0x0;this[_0xc8f4('0x1e')]=_0x32cd80[_0xc8f4('0x1e')]||0x0;this[_0xc8f4('0x1f')]=_0x32cd80['callback'];this[_0xc8f4('0x20')]=_0x32cd80[_0xc8f4('0x20')];this[_0xc8f4('0x21')]=_0x32cd80[_0xc8f4('0x21')];this['recallme']=_0x32cd80[_0xc8f4('0x22')];this['ContactId']=_0x32cd80[_0xc8f4('0x23')];this['ListId']=_0x32cd80[_0xc8f4('0x24')];this[_0xc8f4('0x25')]=_['isNil'](_0x32cd80[_0xc8f4('0xb')])?_0x32cd80[_0xc8f4('0x25')]:_0x32cd80[_0xc8f4('0xb')]['id'];this[_0xc8f4('0x26')]=_0x32cd80['VoiceQueueId'];this[_0xc8f4('0x27')]='';this[_0xc8f4('0x28')]='';}Action['prototype'][_0xc8f4('0x29')]=function(){return util[_0xc8f4('0xd')](_0xc8f4('0x2a'),this[_0xc8f4('0x2b')],this[_0xc8f4('0x2c')]);};module[_0xc8f4('0x2d')]=Action; \ No newline at end of file +var _0x5f2f=['phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','exports','util','lodash','moment','isNil','string','idContact','queue','name','type','campaigntype','membername','Agent','format','SIP/%s','calleridname','Contact','firstName','lastName','active','calleridnum'];(function(_0x3b1f25,_0x2c78ba){var _0x230420=function(_0x5afa9b){while(--_0x5afa9b){_0x3b1f25['push'](_0x3b1f25['shift']());}};_0x230420(++_0x2c78ba);}(_0x5f2f,0x73));var _0xf5f2=function(_0xbc6704,_0x257a07){_0xbc6704=_0xbc6704-0x0;var _0x575809=_0x5f2f[_0xbc6704];return _0x575809;};'use strict';var util=require(_0xf5f2('0x0'));var _=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));function checkNameSurname(_0x1a7be1,_0x1172dd,_0x174bc7){var _0x3c72ee='';if(!_[_0xf5f2('0x3')](_0x1172dd)&&'string'===typeof _0x1172dd){_0x3c72ee+=_0x1172dd;}if(!_['isNil'](_0x174bc7)&&_0xf5f2('0x4')===typeof _0x174bc7){_0x3c72ee+='\x20'+_0x174bc7;}if(_0x3c72ee!==''){return _0x3c72ee;}return _0x1a7be1;}function Action(_0x192215,_0xad7f65,_0x3eebf6,_0x3133bc,_0x473100){this['uniqueid']=_0x3eebf6||undefined;this[_0xf5f2('0x5')]=_0x192215['id'];this[_0xf5f2('0x6')]=_0xad7f65[_0xf5f2('0x7')];this['type']=_0xad7f65[_0xf5f2('0x8')];this[_0xf5f2('0x9')]=_0xf5f2('0x6');this['dialAnswer']=![];this[_0xf5f2('0xa')]=_['isNil'](_0x192215['Agent'])?undefined:_0x192215[_0xf5f2('0xb')][_0xf5f2('0x7')];this['channelAgent']=this[_0xf5f2('0xa')]?util[_0xf5f2('0xc')](_0xf5f2('0xd'),this[_0xf5f2('0xa')]):_0x3133bc||undefined;this[_0xf5f2('0xe')]=checkNameSurname(_0x192215[_0xf5f2('0xf')]['phone'],_0x192215[_0xf5f2('0xf')][_0xf5f2('0x10')],_0x192215[_0xf5f2('0xf')][_0xf5f2('0x11')]);this[_0xf5f2('0x12')]=_0x192215['active']||![];this[_0xf5f2('0x13')]=_0x192215[_0xf5f2('0x14')];this[_0xf5f2('0x15')]=_0x192215[_0xf5f2('0x15')];this[_0xf5f2('0x16')]=_0x192215[_0xf5f2('0x16')]||0x0;this[_0xf5f2('0x17')]=_0x192215[_0xf5f2('0x17')]||0x0;this[_0xf5f2('0x18')]=_0x192215[_0xf5f2('0x18')]||0x0;this[_0xf5f2('0x19')]=(_0x192215[_0xf5f2('0x16')]||0x0)+(_0x192215[_0xf5f2('0x17')]||0x0)+(_0x192215[_0xf5f2('0x18')]||0x0)+(_0x192215[_0xf5f2('0x1a')]||0x0)+(_0x192215[_0xf5f2('0x1b')]||0x0)+(_0x192215[_0xf5f2('0x1c')]||0x0)+(_0x192215['countmachineretry']||0x0)+(_0x192215[_0xf5f2('0x1d')]||0x0);this[_0xf5f2('0x1a')]=_0x192215['countnosuchnumberretry']||0x0;this['countdropretry']=_0x192215[_0xf5f2('0x1b')]||0x0;this[_0xf5f2('0x1c')]=_0x192215['countabandonedretry']||0x0;this[_0xf5f2('0x1e')]=_0x192215[_0xf5f2('0x1e')]||0x0;this[_0xf5f2('0x1d')]=_0x192215[_0xf5f2('0x1d')]||0x0;this[_0xf5f2('0x1f')]=_0x192215['callback'];this[_0xf5f2('0x20')]=_0x192215[_0xf5f2('0x20')];this[_0xf5f2('0x21')]=_0x192215[_0xf5f2('0x21')];this[_0xf5f2('0x22')]=_0x192215['recallme'];this['ContactId']=_0x192215[_0xf5f2('0x23')];this[_0xf5f2('0x24')]=_0x192215[_0xf5f2('0x24')];this[_0xf5f2('0x25')]=_[_0xf5f2('0x3')](_0x192215[_0xf5f2('0xb')])?_0x192215[_0xf5f2('0x25')]:_0x192215[_0xf5f2('0xb')]['id'];this[_0xf5f2('0x26')]=_0x192215['VoiceQueueId'];this[_0xf5f2('0x27')]='';this[_0xf5f2('0x28')]='';}Action[_0xf5f2('0x29')][_0xf5f2('0x2a')]=function(){return util[_0xf5f2('0xc')](_0xf5f2('0x2b'),this['calleridname'],this['number']);};module[_0xf5f2('0x2c')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 1bdd916..0cc74f7 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 _0x34e8=['localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','trunks','agents','clockClearZombieChannels','originateresponse','bind','hangup','syncHangupRequest','syncDialEnd','newexten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice:queue:%s','name','emit','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','paused','INACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','message','CAMPAIGN_STATUS','DEACTIVATED','syncCampaigns','hasOwnProperty','dialMethod','booked','outbound','clearZombieChannels','type','dialActive','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','[clearZombieChannels][talking]','Queue','actions','queue','originated:\x20','stringify','dialAnswer','VoiceQueueId','Action','status','channel','catch','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[action]','agentReadyId','isNil','length','getDiff','scheduledat','Agent','voicePause','run','then','logger2','[RecallMe]','disableContact','starttime','format','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','createCustomerHistory','[HistoryRecallClose]','[getContactRecallMe]','setMessage','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','isActive','Trunk','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','totalGlobal','dialGlobalMaxRetry','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','unlockAgent','activeContact','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','[syncHangup][talking][increment]','uniqueid','pTalking:\x20','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','\x20Queue','linkedid','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','outboundNoAnswerCallsDay','countnoanswerretry','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','outboundCongestionCallsDay','countcongestionretry','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','CANCEL','outboundRejectCallsDay','countagentrejectretry','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','Contact\x20is\x20undefined','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','custom:agentcalled','called','Calling','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','isTrunkReachable','active','SIP/%s','reachable','unmonitored','unlock','unlockContact','pick','execRun','recallme','isValid','checkIsBlackList','logger','validateContact','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','dialOriginateCallerIdName','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','toLowerVariables','variables','[originated][increment]','OriginateError','syncNewExten','syncOriginateResponse','lookAgent','logLookAgent','responsetime','isFailure','custom:agentringnoanswer','rejected','syncHangup','[syncHangup][talking]','cause','statedesc','isUndefined','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','destuniqueid','filterKey','keys','addVariable','variable','value','error','inspect','transfertargetlinkedid','transfer','transfererlinkedid','exports','util','lodash','uuid','moment','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','../dialer/utils','redis','defaults'];(function(_0x2da357,_0x1f9b2f){var _0x138fdd=function(_0xe3077d){while(--_0xe3077d){_0x2da357['push'](_0x2da357['shift']());}};_0x138fdd(++_0x1f9b2f);}(_0x34e8,0x12c));var _0x834e=function(_0x48b387,_0x55d1a9){_0x48b387=_0x48b387-0x0;var _0x3fb54b=_0x34e8[_0x48b387];return _0x3fb54b;};'use strict';var util=require(_0x834e('0x0'));var _=require(_0x834e('0x1'));var uuid=require(_0x834e('0x2'));var moment=require(_0x834e('0x3'));var Redis=require('ioredis');var config=require(_0x834e('0x4'));var logger=require(_0x834e('0x5'))(_0x834e('0x6'));var loggerAction=require(_0x834e('0x5'))(_0x834e('0x7'));var ami=require(_0x834e('0x8'));var rpcDb=require(_0x834e('0x9'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x834e('0xa'));var ut=require('./util/util');var utils=require(_0x834e('0xb'));config[_0x834e('0xc')]=_[_0x834e('0xd')](config[_0x834e('0xc')],{'host':_0x834e('0xe'),'port':0x18eb});var io=require(_0x834e('0xf'))(new Redis(config[_0x834e('0xc')]));var Sequence=function(){};Sequence[_0x834e('0x10')][_0x834e('0x11')]=function(_0x186b3b){this[_0x834e('0x12')]=this[_0x834e('0x12')]?this[_0x834e('0x12')][_0x834e('0x13')](_0x186b3b):_0x186b3b();};function Preview(_0x293514){this[_0x834e('0x14')]=new Sequence();this[_0x834e('0x15')]=_0x293514['voiceQueues'];this[_0x834e('0x16')]=_0x293514[_0x834e('0x16')];this['actions']={};this[_0x834e('0x17')]=_0x293514[_0x834e('0x17')];this[_0x834e('0x18')]=0x0;ami['on'](_0x834e('0x19'),this['syncOriginateResponse'][_0x834e('0x1a')](this));ami['on'](_0x834e('0x1b'),this['syncHangup'][_0x834e('0x1a')](this));ami['on']('hanguprequest',this[_0x834e('0x1c')][_0x834e('0x1a')](this));ami['on']('dialend',this[_0x834e('0x1d')][_0x834e('0x1a')](this));ami['on'](_0x834e('0x1e'),this['syncNewExten'][_0x834e('0x1a')](this));ami['on'](_0x834e('0x1f'),this[_0x834e('0x20')][_0x834e('0x1a')](this));ami['on'](_0x834e('0x21'),this[_0x834e('0x22')][_0x834e('0x1a')](this));ami['on']('blindtransfer',this[_0x834e('0x23')][_0x834e('0x1a')](this));this[_0x834e('0x24')](this[_0x834e('0x15')]);}function emit(_0x4ab05d,_0x45a630,_0x62f8f1){io['to'](_0x4ab05d)['emit'](_0x45a630,_0x62f8f1);}function emitVoiceQueueChannelRemove(_0x1b4bdf){logger[_0x834e('0x25')](_0x834e('0x26'),JSON['stringify'](_0x1b4bdf));emit(util['format'](_0x834e('0x27'),_0x1b4bdf[_0x834e('0x28')]),'voice_queue_channel:remove',_0x1b4bdf);io[_0x834e('0x29')](_0x834e('0x2a'),_0x1b4bdf);}function notSendMessagesQueue(_0x58f4fd){if(_0x58f4fd[_0x834e('0x2b')]){if(_0x58f4fd[_0x834e('0x2c')]===0x0&&_0x58f4fd[_0x834e('0x2d')]===0x0){_0x58f4fd['sendMessageOneNotActive']=![];_0x58f4fd[_0x834e('0x2e')]=0x0;_0x58f4fd[_0x834e('0x2f')]=0x0;_0x58f4fd['message']=utils['CAMPAIGN_STATUS'][_0x834e('0x30')];ut['logger'](_0x834e('0x31'),_0x58f4fd[_0x834e('0x28')]+_0x834e('0x32'));}else{_0x58f4fd[_0x834e('0x33')]=utils[_0x834e('0x34')][_0x834e('0x35')];ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x58f4fd['name']+'\x20is\x20deactivated');}}}Preview[_0x834e('0x10')][_0x834e('0x24')]=function(){var _0x106d6a=this;setInterval(function(){_0x106d6a['syncCampaigns']();},0x7cf);};Preview[_0x834e('0x10')][_0x834e('0x36')]=function(){var _0x1f3671=this[_0x834e('0x15')];this[_0x834e('0x18')]+=0x1;for(var _0x390119 in _0x1f3671){if(_0x1f3671[_0x834e('0x37')](_0x390119)&&(_0x1f3671[_0x390119][_0x834e('0x38')]===_0x834e('0x6')||_0x1f3671[_0x390119]['dialMethod']===_0x834e('0x39'))&&_0x1f3671[_0x390119]['type']===_0x834e('0x3a')){if(this[_0x834e('0x18')]>0x7){this[_0x834e('0x18')]=0x0;this[_0x834e('0x3b')]();}}if(_0x1f3671[_0x834e('0x37')](_0x390119)&&_0x1f3671[_0x390119][_0x834e('0x38')]===_0x834e('0x6')&&_0x1f3671[_0x390119][_0x834e('0x3c')]===_0x834e('0x3a')){if(_0x1f3671[_0x390119][_0x834e('0x3d')]){this['setMessage'](_0x1f3671[_0x390119]);if(_0x1f3671[_0x390119][_0x834e('0x3e')])this[_0x834e('0x3f')](_0x1f3671[_0x390119]);}else{notSendMessagesQueue(_0x1f3671[_0x390119]);}}}};Preview[_0x834e('0x10')][_0x834e('0x40')]=function(_0x595cc0){var _0x3f88ad=this;this[_0x834e('0x14')]['enqueue'](function(){if(!_['isNil'](_0x3f88ad['actions'][_0x595cc0])){loggerAction[_0x834e('0x25')](_0x834e('0x41'),_0x595cc0,_0x834e('0x42'),_0x3f88ad[_0x834e('0x43')][_0x595cc0][_0x834e('0x44')],_0x834e('0x45'),JSON['stringify'](_0x3f88ad[_0x834e('0x15')][_0x3f88ad['actions'][_0x595cc0][_0x834e('0x44')]][_0x834e('0x2c')]),'pTalking:\x20',JSON[_0x834e('0x46')](_0x3f88ad[_0x834e('0x15')][_0x3f88ad['actions'][_0x595cc0]['queue']][_0x834e('0x2d')]),JSON[_0x834e('0x46')](_0x3f88ad[_0x834e('0x43')][_0x595cc0][_0x834e('0x47')]),JSON[_0x834e('0x46')](_['pick'](_0x3f88ad[_0x834e('0x43')][_0x595cc0],['contactId','UserId',_0x834e('0x48'),'ListId'])));return ami[_0x834e('0x49')]({'action':_0x834e('0x4a'),'channel':_0x3f88ad[_0x834e('0x43')][_0x595cc0][_0x834e('0x4b')]})[_0x834e('0x4c')](function(_0x574ea8){if(_0x574ea8[_0x834e('0x33')]===_0x834e('0x4d')){setTimeout(function(){if(_0x3f88ad[_0x834e('0x43')][_0x595cc0]){ut['updateOriginated'](_0x3f88ad[_0x834e('0x15')][_0x3f88ad[_0x834e('0x43')][_0x595cc0]['queue']],_0x834e('0x4e'));if(_0x3f88ad['actions'][_0x595cc0][_0x834e('0x47')]===!![]){ut[_0x834e('0x4f')](_0x3f88ad['campaignsPreview'][_0x3f88ad['actions'][_0x595cc0][_0x834e('0x44')]],_0x834e('0x4e'));ut[_0x834e('0x50')](_0x834e('0x51')+_0x595cc0,_0x3f88ad[_0x834e('0x43')][_0x595cc0][_0x834e('0x44')]);}ut[_0x834e('0x50')]('[Dialer][checkChannel][Preview]'+_0x595cc0,_0x3f88ad[_0x834e('0x43')][_0x595cc0]['queue']);delete _0x3f88ad[_0x834e('0x43')][_0x595cc0];}},0x2328);}});}});};Preview['prototype'][_0x834e('0x3b')]=function(){var _0x5a5807=this;loggerAction[_0x834e('0x25')](_0x834e('0x52'),_['size'](this[_0x834e('0x43')]));for(var _0x3f2321 in this[_0x834e('0x43')]){if(_0x5a5807[_0x834e('0x43')][_0x834e('0x37')](_0x3f2321)){_0x5a5807[_0x834e('0x40')](_0x3f2321);}}};Preview[_0x834e('0x10')][_0x834e('0x3f')]=function(_0x5dc63b){var _0x279ea1=this;rpcDb['getContactRecallMe'](_0x5dc63b['id'],ut[_0x834e('0x53')](this[_0x834e('0x17')]))['then'](function(_0x112306){if(!_[_0x834e('0x54')](_0x112306)){for(var _0x25b035=0x0;_0x25b035<_0x112306[_0x834e('0x55')];_0x25b035+=0x1){if(ut[_0x834e('0x56')](_0x112306[_0x25b035][_0x834e('0x57')])<_0x5dc63b['dialRecallMeTimeout']*0x3c){if(_0x112306[_0x25b035]['Agent']&&!_0x112306[_0x25b035][_0x834e('0x58')][_0x834e('0x59')]){_0x279ea1[_0x834e('0x5a')](_0x112306[_0x25b035]['id'])[_0x834e('0x5b')](ut[_0x834e('0x5c')](_0x834e('0x5d')))[_0x834e('0x4c')](ut[_0x834e('0x5c')](_0x834e('0x5d')));}else{rpcDb[_0x834e('0x5e')](_0x112306[_0x25b035]['id']);}}else{var _0xf02f0d=new Action(_0x112306[_0x25b035],_0x5dc63b);_0xf02f0d[_0x834e('0x5f')]=moment()[_0x834e('0x60')](_0x834e('0x61'));_0x5dc63b[_0x834e('0x62')]+=0x1;ut[_0x834e('0x63')](_0xf02f0d,0x17,_0x834e('0x64'));if(_0x5dc63b[_0x834e('0x65')]){rpcDb[_0x834e('0x66')](ut[_0x834e('0x67')](_0x112306[_0x25b035]));rpcDb['createCustomerHistory'](_0xf02f0d,_0x834e('0x68'));}else{ut[_0x834e('0x63')](_0xf02f0d,0x16,'RecallFailedTimeout');rpcDb[_0x834e('0x69')](_0xf02f0d,_0x834e('0x6a'));rpcDb['createCustomerFinal'](_0xf02f0d,_0x834e('0x6a'));}}}}})[_0x834e('0x4c')](ut[_0x834e('0x5c')](_0x834e('0x6b')));};Preview[_0x834e('0x10')][_0x834e('0x6c')]=function(_0x4549ba){_0x4549ba['sendMessageOneNotActive']=!![];if(ut[_0x834e('0x6d')](_0x4549ba[_0x834e('0x6e')])){_0x4549ba[_0x834e('0x33')]=utils[_0x834e('0x34')][_0x834e('0x6f')];}else if(!ut[_0x834e('0x70')](_0x4549ba[_0x834e('0x3d')])){_0x4549ba[_0x834e('0x33')]=utils['CAMPAIGN_STATUS'][_0x834e('0x30')];}else if(!this['isTrunkReachable'](_0x4549ba[_0x834e('0x71')])){if(!this['isTrunkReachable'](_0x4549ba[_0x834e('0x72')])){_0x4549ba['message']=utils['CAMPAIGN_STATUS'][_0x834e('0x73')];}else{_0x4549ba[_0x834e('0x33')]=utils['CAMPAIGN_STATUS']['ACTIVE'];}}else{_0x4549ba[_0x834e('0x33')]=utils[_0x834e('0x34')][_0x834e('0x74')];}};Preview[_0x834e('0x10')][_0x834e('0x75')]=function(_0x315858,_0x3d3f2b,_0x4273f1){var _0x528e66=this;var _0x142334=this[_0x834e('0x43')][_0x3d3f2b];var _0x5d5ac2=this[_0x834e('0x15')][_0x142334['queue']];var _0x3e58ef;var _0x45eceb=![];var _0x5160c4=0x2;var _0x41ef86=0x3;if(_0x5d5ac2){switch(_0x4273f1){case'1':_0x5d5ac2[_0x834e('0x76')]+=0x1;_0x142334[_0x834e('0x77')]+=0x1;_0x142334[_0x834e('0x78')]=ut['totalGlobal'](_0x142334);ut[_0x834e('0x63')](_0x142334,0x0,_0x834e('0x79'));ami[_0x834e('0x29')]('custom:agentnosuchnumber',ut[_0x834e('0x7a')](_0x142334,_0x834e('0x7b')));rpcDb[_0x834e('0x69')](_0x142334,_0x834e('0x7c'));_0x528e66[_0x834e('0x7d')](_0x142334,'0',_0x5d5ac2)[_0x834e('0x5b')](function(_0x3a1426){_0x45eceb=_0x3a1426[_0x834e('0x7e')]==0x1;_0x5160c4=_0x5d5ac2[_0x834e('0x7f')];_0x41ef86=_0x5d5ac2[_0x834e('0x80')];if(!_0x45eceb){if(ut[_0x834e('0x81')](_0x142334)>=_0x5d5ac2[_0x834e('0x82')]){_0x3e58ef=ut[_0x834e('0x83')](_0x142334,0xf,_0x834e('0x84'));rpcDb[_0x834e('0x85')](_0x3e58ef,_0x834e('0x86'));}else{if(_0x142334[_0x834e('0x77')]>=_0x5d5ac2[_0x834e('0x87')]){rpcDb[_0x834e('0x85')](_0x142334,_0x834e('0x86'));}else{rpcDb[_0x834e('0x88')](ut[_0x834e('0x89')](_0x142334,'countnosuchnumberretry',_0x5d5ac2[_0x834e('0x7f')]),_0x142334[_0x834e('0x8a')],_0x142334[_0x834e('0x8b')]);}}delete this[_0x834e('0x43')][_0x315858['linkedid']];}else{_0x142334[_0x834e('0x77')]++;logger['info']('actioncountonusuch',_0x142334[_0x834e('0x77')]);logger[_0x834e('0x25')]('id',_0x142334[_0x834e('0x8c')]);_0x528e66[_0x834e('0x8d')]({'id':_0x142334[_0x834e('0x8c')],'field':{'countnosuchnumberretry':_0x142334[_0x834e('0x77')]}})[_0x834e('0x5b')](function(){_0x528e66[_0x834e('0x8e')](_0x142334,_0x5160c4,_0x41ef86)['then'](function(){});});}});break;case _0x834e('0x8f'):var _0x5a99e6=moment()[_0x834e('0x60')](_0x834e('0x61'));_0x142334['responsetime']=_0x5a99e6;_0x142334['answertime']=_0x5a99e6;_0x142334[_0x834e('0x47')]=!![];_0x5d5ac2[_0x834e('0x2d')]+=0x1;logger[_0x834e('0x25')](_0x834e('0x90'),_0x142334[_0x834e('0x91')],'\x20Queue',_0x5d5ac2[_0x834e('0x28')],_0x834e('0x92'),_0x5d5ac2[_0x834e('0x2d')]);ami[_0x834e('0x29')](_0x834e('0x93'),ut[_0x834e('0x7a')](_0x142334,_0x834e('0x94'),this[_0x834e('0x15')][_0x142334[_0x834e('0x44')]]));if(_0x5d5ac2[_0x834e('0x95')]){ami['emit'](_0x834e('0x96'),ut[_0x834e('0x97')](_0x142334));}break;case'16':ami[_0x834e('0x29')](_0x834e('0x98'),ut['buildObj'](_0x142334,_0x834e('0x99'),this['campaignsPreview'][_0x142334['queue']]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x142334,_0x834e('0x99')));_0x5d5ac2[_0x834e('0x9a')]+=0x1;_0x5d5ac2['total']+=0x1;_0x5d5ac2[_0x834e('0x9b')]+=0x1;ut[_0x834e('0x4f')](_0x5d5ac2,'[16]');_0x142334[_0x834e('0x78')]=ut[_0x834e('0x81')](_0x142334);ut['logCustomer'](_0x142334,0x4,'Answer');rpcDb[_0x834e('0x69')](_0x142334,_0x834e('0x9c'));rpcDb[_0x834e('0x85')](_0x142334,_0x834e('0x9d'));rpcDb[_0x834e('0x9e')](_0x142334);_0x5d5ac2['sumDuration']+=_0x142334[_0x834e('0x9f')];_0x5d5ac2['sumBillable']+=_0x142334[_0x834e('0x9f')];logger[_0x834e('0x25')](_0x834e('0xa0'),_0x142334['uniqueid'],_0x834e('0xa1'),_0x5d5ac2[_0x834e('0x28')],'pTalking:\x20',_0x5d5ac2[_0x834e('0x2d')]);delete this[_0x834e('0x43')][_0x315858[_0x834e('0xa2')]];break;case'BUSY':_0x5d5ac2[_0x834e('0xa3')]+=0x1;_0x142334[_0x834e('0xa4')]+=0x1;_0x142334[_0x834e('0x78')]=ut[_0x834e('0x81')](_0x142334);ut[_0x834e('0x63')](_0x142334,0x5,_0x834e('0xa5'));_0x5160c4=_0x5d5ac2[_0x834e('0xa6')];_0x41ef86=_0x5d5ac2[_0x834e('0x80')];ami[_0x834e('0x29')](_0x834e('0xa7'),ut['buildObj'](_0x142334,'busy'));rpcDb['createCustomerHistory'](_0x142334,_0x834e('0xa8'));_0x528e66[_0x834e('0x7d')](_0x142334,'5',_0x5d5ac2)[_0x834e('0x5b')](function(_0x37fa2c){_0x45eceb=_0x37fa2c[_0x834e('0x7e')]==0x1;if(!_0x45eceb){if(ut['totalGlobal'](_0x142334)>=_0x5d5ac2['dialGlobalMaxRetry']){_0x3e58ef=ut[_0x834e('0x83')](_0x142334,0xf,_0x834e('0x84'));rpcDb[_0x834e('0x85')](_0x3e58ef,_0x834e('0xa9'));}else{if(_0x142334[_0x834e('0xa4')]>=_0x5d5ac2['dialBusyMaxRetry']){rpcDb[_0x834e('0x85')](_0x142334,_0x834e('0xa8'));}else{rpcDb[_0x834e('0x88')](ut['scheduledAt'](_0x142334,_0x834e('0xa4'),_0x5d5ac2[_0x834e('0xa6')]),_0x142334[_0x834e('0x8a')],_0x142334[_0x834e('0x8b')]);}}}else{_0x142334[_0x834e('0xa4')]++;_0x528e66['incrementPreviewCounters']({'id':_0x142334['idContact'],'field':{'countbusyretry':_0x142334[_0x834e('0xa4')]}})[_0x834e('0x5b')](function(){_0x528e66['swapAdditionalPhones'](_0x142334,_0x5160c4,_0x41ef86)[_0x834e('0x5b')](function(){});});}});break;case'NOANSWER':_0x5d5ac2[_0x834e('0xaa')]+=0x1;_0x142334[_0x834e('0xab')]+=0x1;_0x142334[_0x834e('0x78')]=ut['totalGlobal'](_0x142334);ut[_0x834e('0x63')](_0x142334,0x3,'NoAnswer');_0x5160c4=_0x5d5ac2['dialNoAnswerRetryFrequency'];_0x41ef86=_0x5d5ac2['callAdditionalPhoneAfterMin'];var _0x6735e6=ut[_0x834e('0xac')](_0x142334,_0x5d5ac2);ami[_0x834e('0x29')](_0x834e('0xad'),_0x6735e6);rpcDb[_0x834e('0x69')](_0x142334,_0x834e('0xae'));_0x528e66[_0x834e('0x7d')](_0x142334,'3',_0x5d5ac2)[_0x834e('0x5b')](function(_0x17e61a){_0x45eceb=_0x17e61a['additional']==0x1;if(!_0x45eceb){if(ut[_0x834e('0x81')](_0x142334)>=_0x5d5ac2['dialGlobalMaxRetry']){_0x3e58ef=ut[_0x834e('0x83')](_0x142334,0xf,_0x834e('0x84'));rpcDb[_0x834e('0x85')](_0x3e58ef,_0x834e('0xaf'));}else{if(_0x142334[_0x834e('0xab')]>=_0x5d5ac2[_0x834e('0xb0')]){rpcDb['createCustomerFinal'](_0x142334,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x834e('0x88')](ut[_0x834e('0x89')](_0x142334,'countnoanswerretry',_0x5d5ac2[_0x834e('0xb1')]),_0x142334[_0x834e('0x8a')],_0x142334[_0x834e('0x8b')]);}}}else{_0x142334[_0x834e('0xab')]++;_0x528e66[_0x834e('0x8d')]({'id':_0x142334['idContact'],'field':{'countnoanswerretry':_0x142334[_0x834e('0xab')]}})[_0x834e('0x5b')](function(){_0x528e66['swapAdditionalPhones'](_0x142334,_0x5160c4,_0x41ef86)['then'](function(){});});}});break;case'CONGESTION':_0x5d5ac2[_0x834e('0xb2')]+=0x1;_0x142334[_0x834e('0xb3')]+=0x1;_0x142334['countglobal']=ut[_0x834e('0x81')](_0x142334);ut[_0x834e('0x63')](_0x142334,0x8,'Congestion');_0x5160c4=_0x5d5ac2[_0x834e('0xb4')];_0x41ef86=_0x5d5ac2['callAdditionalPhoneAfterMin'];ami['emit'](_0x834e('0xb5'),ut[_0x834e('0x7a')](_0x142334,_0x834e('0xb6')));rpcDb[_0x834e('0x69')](_0x142334,'[callProgressDetectingCustomer][logCongestion]');_0x528e66[_0x834e('0x7d')](_0x142334,'8',_0x5d5ac2)[_0x834e('0x5b')](function(_0x260934){_0x45eceb=_0x260934[_0x834e('0x7e')]==0x1;if(!_0x45eceb){if(ut[_0x834e('0x81')](_0x142334)>=_0x5d5ac2[_0x834e('0x82')]){_0x3e58ef=ut[_0x834e('0x83')](_0x142334,0xf,_0x834e('0x84'));rpcDb[_0x834e('0x85')](_0x3e58ef,_0x834e('0xb7'));}else{if(_0x142334[_0x834e('0xb3')]>=_0x5d5ac2[_0x834e('0xb8')]){rpcDb[_0x834e('0x85')](_0x142334,_0x834e('0xb9'));}else{rpcDb[_0x834e('0x88')](ut[_0x834e('0x89')](_0x142334,_0x834e('0xb3'),_0x5d5ac2[_0x834e('0xa6')]),_0x142334[_0x834e('0x8a')],_0x142334[_0x834e('0x8b')]);}}}else{_0x142334[_0x834e('0xb3')]++;_0x528e66[_0x834e('0x8d')]({'id':_0x142334['idContact'],'field':{'countcongestionretry':_0x142334[_0x834e('0xb3')]}})[_0x834e('0x5b')](function(){_0x528e66[_0x834e('0x8e')](_0x142334,_0x5160c4,_0x41ef86)[_0x834e('0x5b')](function(){});});}});break;case _0x834e('0xba'):_0x5d5ac2[_0x834e('0xbb')]+=0x1;_0x142334[_0x834e('0xbc')]+=0x1;_0x142334[_0x834e('0x78')]=ut[_0x834e('0x81')](_0x142334);ut['logCustomer'](_0x142334,0x14,'AgentReject');_0x5160c4=_0x5d5ac2['dialAgentRejectRetryFrequency'];_0x41ef86=_0x5d5ac2[_0x834e('0x80')];ami['emit'](_0x834e('0xbd'),ut[_0x834e('0x7a')](_0x142334,_0x834e('0xbe')));rpcDb['createCustomerHistory'](_0x142334,_0x834e('0xbf'));_0x528e66[_0x834e('0x7d')](_0x142334,'20',_0x5d5ac2)[_0x834e('0x5b')](function(_0x1594ef){_0x45eceb=_0x1594ef[_0x834e('0x7e')]==0x1;if(!_0x45eceb){if(ut[_0x834e('0x81')](_0x142334)>=_0x5d5ac2['dialGlobalMaxRetry']){_0x3e58ef=ut[_0x834e('0x83')](_0x142334,0x14,_0x834e('0xc0'));rpcDb[_0x834e('0x85')](_0x3e58ef,_0x834e('0xc1'));}else{if(_0x142334[_0x834e('0xbc')]>=_0x5d5ac2['dialAgentRejectMaxRetry']){rpcDb['createCustomerFinal'](_0x142334,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb['rescheduleContact'](ut[_0x834e('0x89')](_0x142334,_0x834e('0xbc'),_0x5d5ac2['dialAgentRejectRetryFrequency']),_0x142334[_0x834e('0x8a')],_0x142334[_0x834e('0x8b')]);}}}else{_0x142334['countnoanswerretry']++;_0x528e66[_0x834e('0x8d')]({'id':_0x142334[_0x834e('0x8c')],'field':{'countnoanswerretry':_0x142334[_0x834e('0xab')]}})[_0x834e('0x5b')](function(){_0x528e66[_0x834e('0x8e')](_0x142334,_0x5160c4,_0x41ef86)[_0x834e('0x5b')](function(){});});}});break;case'ABANDONED':_0x5d5ac2['outboundAbandonedCallsDay']+=0x1;_0x142334[_0x834e('0xc2')]+=0x1;_0x142334[_0x834e('0x78')]=ut[_0x834e('0x81')](_0x142334);ut['logCustomer'](_0x142334,0xb,_0x834e('0xc3'));rpcDb[_0x834e('0x69')](_0x142334,'[callProgressDetectingCustomer][logAbandoned]');_0x528e66[_0x834e('0x7d')](_0x142334,'11',_0x5d5ac2)[_0x834e('0x5b')](function(_0x216d1f){_0x45eceb=_0x216d1f[_0x834e('0x7e')]==0x1;if(!_0x45eceb){if(ut['totalGlobal'](_0x142334)>=_0x5d5ac2[_0x834e('0x82')]){_0x3e58ef=ut['cloneAction'](_0x142334,0xf,'Global');rpcDb[_0x834e('0x85')](_0x3e58ef,_0x834e('0xc4'));}else{if(_0x142334[_0x834e('0xc5')]>=_0x5d5ac2[_0x834e('0xc6')]){rpcDb[_0x834e('0x85')](_0x142334,_0x834e('0xc4'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x142334,_0x834e('0xc2'),_0x5d5ac2[_0x834e('0xc7')]),_0x142334[_0x834e('0x8a')],_0x142334[_0x834e('0x8b')]);}}}else{_0x142334[_0x834e('0xab')]++;_0x528e66[_0x834e('0x8d')]({'id':_0x142334[_0x834e('0x8c')],'field':{'countnoanswerretry':_0x142334['countnoanswerretry']}})[_0x834e('0x5b')](function(){_0x528e66[_0x834e('0x8e')](_0x142334,_0x5160c4,_0x41ef86)['then'](function(){});});}});break;case'18':_0x5d5ac2[_0x834e('0xc8')]+=0x1;_0x142334[_0x834e('0xc9')]+=0x1;_0x142334[_0x834e('0x78')]=ut[_0x834e('0x81')](_0x142334);ut[_0x834e('0x63')](_0x142334,0x12,_0x315858[_0x834e('0xca')]||_0x315858[_0x834e('0xcb')]);ami[_0x834e('0x29')](_0x834e('0xcc'),ut[_0x834e('0x7a')](_0x142334,_0x834e('0xcd')));rpcDb[_0x834e('0x69')](_0x142334,_0x834e('0xce'));_0x528e66[_0x834e('0x7d')](_0x142334,'18',_0x5d5ac2)['then'](function(_0x5f1e3b){_0x45eceb=_0x5f1e3b[_0x834e('0x7e')]==0x1;if(!_0x45eceb){if(ut['totalGlobal'](_0x142334)>=_0x5d5ac2[_0x834e('0x82')]){_0x3e58ef=ut['cloneAction'](_0x142334,0x12,_0x834e('0x84'));rpcDb['createCustomerFinal'](_0x3e58ef,_0x834e('0xce'));}else{rpcDb['createCustomerFinal'](_0x142334,_0x834e('0xce'));}}else{_0x142334[_0x834e('0xab')]++;_0x528e66[_0x834e('0x8d')]({'id':_0x142334[_0x834e('0x8c')],'field':{'countnoanswerretry':_0x142334['countnoanswerretry']}})[_0x834e('0x5b')](function(){_0x528e66[_0x834e('0x8e')](_0x142334,_0x5160c4,_0x41ef86)[_0x834e('0x5b')](function(){});});}});delete this[_0x834e('0x43')][_0x315858[_0x834e('0xa2')]];break;case'19':_0x5d5ac2[_0x834e('0xc8')]+=0x1;_0x142334[_0x834e('0x78')]=ut[_0x834e('0x81')](_0x142334);ut[_0x834e('0x63')](_0x142334,0x13,_0x315858[_0x834e('0xca')]||_0x315858[_0x834e('0xcb')]);ami[_0x834e('0x29')](_0x834e('0xcc'),ut[_0x834e('0x7a')](_0x142334,_0x834e('0xcd')));rpcDb[_0x834e('0x69')](_0x142334,_0x834e('0xcf'));_0x528e66['verifyAdditionalPhones'](_0x142334,'18',_0x5d5ac2)['then'](function(_0x2df814){_0x45eceb=_0x2df814[_0x834e('0x7e')]==0x1;if(!_0x45eceb){if(ut[_0x834e('0x81')](_0x142334)>=_0x5d5ac2[_0x834e('0x82')]){_0x3e58ef=ut[_0x834e('0x83')](_0x142334,0xf,_0x834e('0x84'));rpcDb[_0x834e('0x85')](_0x3e58ef,_0x834e('0xcf'));}else{rpcDb[_0x834e('0x85')](_0x142334,_0x834e('0xcf'));}}else{_0x142334[_0x834e('0xab')]++;_0x528e66[_0x834e('0x8d')]({'id':_0x142334['idContact'],'field':{'countnoanswerretry':_0x142334[_0x834e('0xab')]}})['then'](function(){_0x528e66[_0x834e('0x8e')](_0x142334,_0x5160c4,_0x41ef86)[_0x834e('0x5b')](function(){});});}});delete this[_0x834e('0x43')][_0x315858['linkedid']];break;default:if(_0x142334[_0x834e('0x47')]){ut[_0x834e('0x4f')](_0x5d5ac2,'[default]');ut['loggerError'](_0x834e('0xd0')+_0x5d5ac2[_0x834e('0x28')],_0x315858);}_0x5d5ac2['outboundUnknownCallsDay']+=0x1;_0x142334[_0x834e('0x78')]=ut[_0x834e('0x81')](_0x142334);ut[_0x834e('0x63')](_0x142334,0xc,_0x315858[_0x834e('0xca')]||_0x315858[_0x834e('0xcb')]);_0x5160c4=_0x5d5ac2['dialAgentRejectRetryFrequency'];_0x41ef86=_0x5d5ac2['callAdditionalPhoneAfterMin'];rpcDb[_0x834e('0x69')](_0x142334,'[callProgressDetectingCustomer][logUnknown]');_0x528e66['verifyAdditionalPhones'](_0x142334,'20',_0x5d5ac2)['then'](function(_0xac9d00){_0x45eceb=_0xac9d00[_0x834e('0x7e')]==0x1;if(!_0x45eceb){if(ut['totalGlobal'](_0x142334)>=_0x5d5ac2[_0x834e('0x82')]){_0x3e58ef=ut[_0x834e('0x83')](_0x142334,0xf,_0x834e('0x84'));rpcDb[_0x834e('0x85')](_0x3e58ef,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x834e('0x85')](_0x142334,_0x834e('0xd1'));}delete this[_0x834e('0x43')][_0x315858['linkedid']];}else{_0x528e66[_0x834e('0x8e')](_0x142334,_0x5160c4,_0x41ef86)['then'](function(){});}});}if(!(_0x142334[_0x834e('0x47')]&&_0x4273f1==='16')){ut['updateOriginated'](_0x5d5ac2,_0x834e('0xd2'));logger[_0x834e('0x25')]('[originated][decrement][callProgressDetectingCustomer]',_0x142334[_0x834e('0x91')],_0x834e('0xa1'),_0x5d5ac2[_0x834e('0x28')],_0x834e('0x45'),_0x5d5ac2[_0x834e('0x2c')]);}if(_0x4273f1!==_0x834e('0x8f')){delete this['actions'][_0x315858[_0x834e('0xa2')]];delete this[_0x834e('0x43')][_0x315858[_0x834e('0xd3')]];}_0x5d5ac2[_0x834e('0xd4')]=!![];}};Preview[_0x834e('0x10')][_0x834e('0xd5')]=function(_0x5d3c6d,_0x448420,_0x490a57){if(_['isUndefined'](_0x448420)&&_0x834e('0xd6')!==typeof _0x448420){return;}if(_['isUndefined'](_0x490a57)&&'object'!==typeof _0x490a57){return;}switch(_0x490a57[_0x834e('0xd7')]){case'0':ut[_0x834e('0xd8')](_0x5d3c6d,0x0,_0x834e('0x79'));rpcDb[_0x834e('0xd9')](_0x5d3c6d,_0x834e('0xda'));break;case'3':ut[_0x834e('0xd8')](_0x5d3c6d,0x3,_0x834e('0xdb'));rpcDb[_0x834e('0xd9')](_0x5d3c6d,_0x834e('0xdc'));break;case'5':ut[_0x834e('0xd8')](_0x5d3c6d,0x5,_0x834e('0xa5'));rpcDb[_0x834e('0xd9')](_0x5d3c6d,_0x834e('0xdd'));break;case'8':ut[_0x834e('0xd8')](_0x5d3c6d,0x8,'Congestion');rpcDb[_0x834e('0xd9')](_0x5d3c6d,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x834e('0xd8')](_0x5d3c6d,0x16,_0x834e('0xde'));rpcDb[_0x834e('0xd9')](_0x5d3c6d,_0x834e('0xdf'));break;default:ut['logAgent'](_0x5d3c6d,0xc,_0x490a57['reason']);rpcDb[_0x834e('0xd9')](_0x5d3c6d,_0x834e('0xe0'));}ut['updateOriginated'](_0x448420,_0x834e('0xe1'));logger[_0x834e('0x25')]('[originated][decrement][callProgressDetectingAgent]',_0x5d3c6d[_0x834e('0x91')],_0x834e('0xa1'),_0x448420[_0x834e('0x28')],_0x834e('0x45'),_0x448420['originated']);delete this['actions'][_0x5d3c6d['uniqueid']];};Preview['prototype'][_0x834e('0x7d')]=function(_0x3c4847,_0x47891e,_0x41ba0c){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x3c4847,_0x47891e,_0x41ba0c)[_0x834e('0x4c')](logger[_0x834e('0x25')](_0x834e('0xe2')));};Preview[_0x834e('0x10')][_0x834e('0x8e')]=function(_0xfa6cdb,_0x3c775f,_0x4fc61d){return cmHopperAdditionalPhone[_0x834e('0x8e')](_0xfa6cdb,_0x3c775f,_0x4fc61d)[_0x834e('0x4c')](logger['info'](_0x834e('0xe3')));};Preview[_0x834e('0x10')]['incrementPreviewCounters']=function(_0x486c18){return Promise['resolve']()[_0x834e('0x5b')](cmHopperAdditionalPhone[_0x834e('0x8d')](_0x486c18))[_0x834e('0x4c')](logger['info'](_0x834e('0xe4')));};Preview[_0x834e('0x10')][_0x834e('0xe5')]=function(_0x17e729,_0x4b4f7c,_0xad7b72,_0x19cb0b,_0x13af70){var _0x8804a8=this;return new Promise(function(_0x102640,_0x48b6c4){if(_['isNil'](_0x4b4f7c)||_[_0x834e('0x54')](_0x4b4f7c[_0x834e('0xe6')])||_[_0x834e('0x54')](_0x4b4f7c[_0x834e('0xe7')])||_[_0x834e('0x54')](_0x4b4f7c[_0x834e('0x48')])){_0x48b6c4(ut[_0x834e('0x33')](_0x834e('0xe8'),_0x19cb0b,_0x13af70));return;}var _0x38151c=uuid['v4']();var _0x97a4b2=_0x8804a8[_0x834e('0x15')][_0x4b4f7c[_0x834e('0x42')][_0x834e('0x28')]];var _0x4b12cd=_0xad7b72?_0x8804a8[_0x834e('0x17')][_0xad7b72]['id']:undefined;_0x8804a8[_0x834e('0x43')][_0x38151c]=new Action(_0x4b4f7c,_0x97a4b2,_0x38151c,_0xad7b72,_0x4b12cd);var _0x3f5b2e=_0x8804a8[_0x834e('0x43')][_0x38151c];_0x3f5b2e['unlockAgent']=_0x19cb0b;_0x3f5b2e['activeContact']=_0x13af70;_0x3f5b2e['lookAgent']=_0xad7b72;if(_[_0x834e('0xe9')](_0x17e729)){_0x8804a8[_0x834e('0xea')](_0x3f5b2e,_0x97a4b2,_0x4b4f7c,_0xad7b72)[_0x834e('0x5b')](function(_0x23d7e6){logger[_0x834e('0x25')](_0x834e('0xeb'),_0x834e('0xec')+_0x3f5b2e[_0x834e('0x44')]+'\x20IdHopper:\x20'+_0x3f5b2e['idContact'],JSON['stringify'](_0x23d7e6));ami['emit'](_0x834e('0xed'),ut[_0x834e('0x7a')](_0x3f5b2e,_0x834e('0xee'),_0x8804a8[_0x834e('0x15')][_0x3f5b2e[_0x834e('0x44')]]));_0x102640(ut[_0x834e('0x33')](_0x834e('0xef')));})[_0x834e('0x4c')](function(_0x33757d){ut['logger']('[Preview][execCall][failure]',_0x33757d);_0x48b6c4(ut['message']('Call\x20failed',_0x19cb0b,_0x13af70));});}else{_0x97a4b2[_0x834e('0xf0')]+=0x1;ut[_0x834e('0xf1')](_0x3f5b2e);rpcDb[_0x834e('0xf2')](_0x3f5b2e,_0x834e('0xf3'));delete _0x8804a8[_0x834e('0x43')][_0x38151c];_0x48b6c4(ut[_0x834e('0x33')](_0x834e('0xf4'),_0x19cb0b,_0x13af70));}});};Preview[_0x834e('0x10')][_0x834e('0xf5')]=function(_0xcd64c2){return!_[_0x834e('0x54')](_0xcd64c2)&&!_[_0x834e('0x54')](_0xcd64c2[_0x834e('0x28')])&&!_[_0x834e('0x54')](_0xcd64c2[_0x834e('0xf6')])&&_0xcd64c2[_0x834e('0xf6')]&&!_['isNil'](this[_0x834e('0x16')][util['format'](_0x834e('0xf7'),_0xcd64c2[_0x834e('0x28')])])&&!_[_0x834e('0x54')](this['trunks'][util[_0x834e('0x60')](_0x834e('0xf7'),_0xcd64c2['name'])]['status'])&&(this[_0x834e('0x16')][util[_0x834e('0x60')](_0x834e('0xf7'),_0xcd64c2[_0x834e('0x28')])][_0x834e('0x4a')]===_0x834e('0xf8')||this[_0x834e('0x16')][util[_0x834e('0x60')]('SIP/%s',_0xcd64c2[_0x834e('0x28')])][_0x834e('0x4a')]===_0x834e('0xf9'));};Preview[_0x834e('0x10')][_0x834e('0x5a')]=function(_0x614e15,_0x17aaae){return this['execRun'](_0x614e15,_0x17aaae)[_0x834e('0x5b')](function(_0x59e298){return _['pick'](_0x59e298,[_0x834e('0x33')]);})[_0x834e('0x4c')](function(_0x4b16fa){if(_0x4b16fa[_0x834e('0xfa')]){rpcDb[_0x834e('0xfb')](_0x614e15);}if(_0x4b16fa['active']){rpcDb[_0x834e('0x5e')](_0x614e15);}throw _[_0x834e('0xfc')](_0x4b16fa,['message']);});};Preview['prototype'][_0x834e('0xfd')]=function(_0x2ec9f1,_0x4e6525){var _0x58a935=this;var _0x269ff6,_0xa496aa;return rpcDb['getContactPreview'](_0x2ec9f1)['then'](function(_0x495352){if(!_['isNil'](_0x495352[0x0])){_0xa496aa=_0x495352[0x0][_0x834e('0xfe')]?![]:!![];_0x269ff6=_0x495352[0x0]['recallme']?!![]:![];_0x269ff6=_0x4e6525?!![]:_0x269ff6;}var _0x3be4c3=_0x58a935['validateContact'](_0x495352);if(_0x3be4c3[_0x834e('0xff')]){rpcDb[_0x834e('0x100')](_[_0x834e('0xfc')](_0x495352[0x0],[_0x834e('0x48'),'phone']))[_0x834e('0x5b')](function(_0x446d89){_0x58a935[_0x834e('0xe5')](_0x446d89,_0x495352[0x0],_0x4e6525,_0xa496aa,_0x269ff6)[_0x834e('0x5b')](function(_0x3a3a6c){return _0x3a3a6c;})[_0x834e('0x4c')](function(_0x3d8abb){throw _0x3d8abb;});})[_0x834e('0x4c')](function(_0x464ae6){ut[_0x834e('0x101')]('[Preview][checkIsBlackList]',_0x464ae6);throw ut[_0x834e('0x33')]('Call\x20unsuccessful',_0xa496aa,_0x269ff6);});}else{throw ut[_0x834e('0x33')](_0x3be4c3[_0x834e('0x33')],_0xa496aa,_0x269ff6);}})[_0x834e('0x4c')](function(_0x31a7ae){ut[_0x834e('0x101')]('[Preview][getContactPreview]',_0x31a7ae);throw ut[_0x834e('0x33')]('Call\x20unsuccessful',![],!![]);});};Preview['prototype'][_0x834e('0x102')]=function(_0x30ecb9){if(_[_0x834e('0x54')](_0x30ecb9)||_['isEmpty'](_0x30ecb9)||!_[_0x834e('0x54')](_0x30ecb9[0x0][_0x834e('0x58')])&&_[_0x834e('0x54')](_0x30ecb9[0x0][_0x834e('0x58')][_0x834e('0x28')])){ut[_0x834e('0x101')](_0x834e('0x103'),_0x30ecb9);return{'isValid':![],'message':_0x834e('0x104')};}var _0x125787=this[_0x834e('0x15')][_0x30ecb9[0x0][_0x834e('0x42')]['name']];_0x125787[_0x834e('0x33')]=utils[_0x834e('0x34')][_0x834e('0x74')];if(_[_0x834e('0x54')](_0x125787)){ut[_0x834e('0x101')](_0x834e('0x105'),_0x125787);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0x834e('0xf5')](_0x125787[_0x834e('0x71')])){ut[_0x834e('0x101')](_0x834e('0x106'),_0x834e('0x107')+_0x125787[_0x834e('0x28')]+_0x834e('0x108'));if(!this[_0x834e('0xf5')](_0x125787[_0x834e('0x72')])){ut[_0x834e('0x101')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x125787['name']+_0x834e('0x109'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x834e('0x70')](_0x125787[_0x834e('0x3d')])){ut[_0x834e('0x101')](_0x834e('0x10a'),_0x125787[_0x834e('0x28')]+_0x834e('0x10b'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x125787[_0x834e('0x28')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview['prototype'][_0x834e('0xea')]=function(_0x3b9429,_0x52cdd5,_0x5cb379,_0x494e08){var _0x2515f6=this;return new Promise(function(_0x45c8e6,_0x3512d8){var _0x5e0bfe=_0x3b9429[_0x834e('0x91')];var _0x21cb1d=_0x2515f6[_0x834e('0xf5')](_0x52cdd5[_0x834e('0x71')])?util[_0x834e('0x60')](_0x834e('0x10c'),_0x52cdd5['Trunk']['name'],_['isNil'](_0x52cdd5['dialPrefix'])?'':_0x52cdd5[_0x834e('0x10d')][_0x834e('0x10e')]()||'',_0x52cdd5[_0x834e('0x10f')]>0x0?_0x5cb379[_0x834e('0xe7')][_0x834e('0x110')](_0x52cdd5[_0x834e('0x10f')]):_0x5cb379[_0x834e('0xe7')]):util[_0x834e('0x60')](_0x834e('0x10c'),_[_0x834e('0x54')](_0x52cdd5[_0x834e('0x72')])?_0x52cdd5[_0x834e('0x71')][_0x834e('0x28')]:_0x52cdd5[_0x834e('0x72')][_0x834e('0x28')],_['isNil'](_0x52cdd5['dialPrefix'])?'':_0x52cdd5[_0x834e('0x10d')][_0x834e('0x10e')]()||'',_0x52cdd5[_0x834e('0x10f')]>0x0?_0x5cb379['phone'][_0x834e('0x110')](_0x52cdd5[_0x834e('0x10f')]):_0x5cb379[_0x834e('0xe7')]);var _0x431f18=_0x2515f6[_0x834e('0xf5')](_0x52cdd5[_0x834e('0x71')])?ut[_0x834e('0x111')](_0x52cdd5[_0x834e('0x71')][_0x834e('0x112')],_0x52cdd5['dialOriginateCallerIdName'],_0x52cdd5[_0x834e('0x113')]>0x0?ut[_0x834e('0x114')](_0x52cdd5[_0x834e('0x115')],_0x52cdd5[_0x834e('0x113')]):_0x52cdd5['dialOriginateCallerIdNumber']):ut[_0x834e('0x111')](_[_0x834e('0x54')](_0x52cdd5[_0x834e('0x72')])?_0x52cdd5[_0x834e('0x71')][_0x834e('0x112')]:_0x52cdd5[_0x834e('0x72')][_0x834e('0x112')],_0x52cdd5[_0x834e('0x116')],_0x52cdd5[_0x834e('0x113')]>0x0?ut['getCallerIdRandom'](_0x52cdd5[_0x834e('0x115')],_0x52cdd5['dialRandomLastDigitCallerIdNumber']):_0x52cdd5[_0x834e('0x115')]);if(_0x431f18){_0x3b9429['originatecalleridname']=ut[_0x834e('0x117')](_0x431f18);_0x3b9429[_0x834e('0x118')]=ut[_0x834e('0x119')](_0x431f18);}var _0x2d2268=ut[_0x834e('0x11a')](_0x52cdd5,_0x5cb379,_0x21cb1d,_0x431f18,_0x5e0bfe,_0x3b9429);_['merge'](_0x3b9429,ut[_0x834e('0x11b')](_0x2d2268));_0x3b9429[_0x834e('0x5f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x52cdd5[_0x834e('0x11c')]=_0x2d2268;var _0x4db3c5=ut['variablesAction'](_0x3b9429,_0x52cdd5,_0x2d2268,_0x3b9429['activeContact'],_0x494e08);return ami[_0x834e('0x49')](_0x4db3c5)[_0x834e('0x5b')](function(_0xbd9400){_0x52cdd5[_0x834e('0x2c')]+=0x1;logger[_0x834e('0x25')](_0x834e('0x11d'),_0x5e0bfe,_0x834e('0xa1'),_0x52cdd5['name'],_0x834e('0x45'),_0x52cdd5[_0x834e('0x2c')]);_0x45c8e6(_0xbd9400);})['catch'](function(_0x5df60f){ut[_0x834e('0xd8')](_0x3b9429,0xe,_0x834e('0x11e'));rpcDb['createAgentHistory'](_0x3b9429,'[originateFailure][logOriginateFailure]');_0x3512d8(_0x5df60f);});});};Preview[_0x834e('0x10')][_0x834e('0x11f')]=function(_0x42305c){if(this['actions'][_0x42305c[_0x834e('0xa2')]]){this[_0x834e('0x43')][_0x42305c[_0x834e('0xa2')]]['channel']=_0x42305c[_0x834e('0x4b')];}};Preview['prototype'][_0x834e('0x120')]=function(_0x1debf7){var _0x3a1328=this;var _0x10971d=this[_0x834e('0x43')][_0x1debf7['actionid']];if(_0x10971d){if(_0x10971d[_0x834e('0x121')]&&this[_0x834e('0x17')][_0x10971d[_0x834e('0x121')]]){ut[_0x834e('0x122')](_0x10971d,this[_0x834e('0x17')][_0x10971d['lookAgent']]['name'],this[_0x834e('0x17')][_0x10971d[_0x834e('0x121')]]['id']);}var _0x13d670=_['clone'](_0x10971d);_0x13d670[_0x834e('0x123')]=moment()[_0x834e('0x60')](_0x834e('0x61'));var _0x386b73=_0x3a1328['campaignsPreview'][_0x10971d[_0x834e('0x44')]];if(ut[_0x834e('0x124')](_0x1debf7['response'])){if(_0x10971d[_0x834e('0x8a')]){rpcDb[_0x834e('0xfb')](_0x10971d[_0x834e('0x8c')]);}if(_0x10971d[_0x834e('0x8b')]){rpcDb['disableContact'](_0x10971d[_0x834e('0x8c')]);}ami['emit'](_0x834e('0x125'),ut[_0x834e('0x7a')](_0x10971d,_0x834e('0x126'),this[_0x834e('0x15')][_0x10971d[_0x834e('0x44')]]));this[_0x834e('0xd5')](_0x13d670,_0x386b73,_0x1debf7);}else{_0x10971d['starttime']=moment()['format'](_0x834e('0x61'));ut[_0x834e('0xd8')](_0x13d670,0x4,'Answer');rpcDb[_0x834e('0xd9')](_0x13d670,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x834e('0x10')][_0x834e('0x127')]=function(_0x319d6c){var _0x151b58=this[_0x834e('0x43')][_0x319d6c[_0x834e('0xa2')]];var _0x36836f;if(_0x151b58){_0x36836f=this['campaignsPreview'][_0x151b58[_0x834e('0x44')]];logger[_0x834e('0x25')](_0x834e('0x128'),_0x319d6c[_0x834e('0xa2')],_0x834e('0xa1'),_0x36836f['name'],_0x834e('0x92'),_0x36836f[_0x834e('0x2d')]);}if(this[_0x834e('0x43')][_0x319d6c['linkedid']]&&_0x319d6c['linkedid']!==_0x319d6c['uniqueid']){if(_0x319d6c[_0x834e('0x129')]==='16'&&this[_0x834e('0x43')][_0x319d6c[_0x834e('0xa2')]][_0x834e('0x47')]){this[_0x834e('0x75')](_0x319d6c,_0x319d6c[_0x834e('0xa2')],_0x319d6c[_0x834e('0x129')]);}else if(this[_0x834e('0x43')][_0x319d6c[_0x834e('0xa2')]][_0x834e('0x47')]){logger[_0x834e('0x25')]('[syncHangup][talking][cause]',_0x319d6c[_0x834e('0xa2')],_0x319d6c[_0x834e('0x129')],_0x834e('0xa1'),_0x36836f[_0x834e('0x28')],_0x834e('0x92'),_0x36836f[_0x834e('0x2d')]);this[_0x834e('0x75')](_0x319d6c,_0x319d6c[_0x834e('0xa2')],_0x319d6c['cause']);}}else if(_0x151b58&&_[_0x834e('0x54')](_0x151b58[_0x834e('0x12a')])&&_0x36836f['dialQueueProject']&&_0x319d6c[_0x834e('0xa2')]===_0x319d6c[_0x834e('0x91')]&&_[_0x834e('0x54')](_0x319d6c[_0x834e('0xd7')])&&_0x319d6c['cause']==='16'&&_0x319d6c['channelstate']==='6'&&_[_0x834e('0x12b')](_0x151b58['transfer'])){if(_0x151b58[_0x834e('0x8a')]){rpcDb[_0x834e('0xfb')](_0x151b58[_0x834e('0x8c')]);}if(_0x151b58[_0x834e('0x8b')]){rpcDb[_0x834e('0x5e')](_0x151b58['idContact']);}_0x319d6c[_0x834e('0xd7')]='22';this['callProgressDetectingAgent'](_0x151b58,_0x36836f,_0x319d6c);}else if(_0x151b58&&_0x151b58['transfer']){if(_0x319d6c[_0x834e('0x129')]==='16'&&this[_0x834e('0x43')][_0x319d6c[_0x834e('0xa2')]][_0x834e('0x47')]){logger[_0x834e('0x25')](_0x834e('0x12c'),_0x319d6c['linkedid'],_0x319d6c[_0x834e('0x129')],_0x834e('0xa1'),_0x36836f['name'],_0x834e('0x92'),_0x36836f[_0x834e('0x2d')]);this['callProgressDetectingCustomer'](_0x319d6c,_0x319d6c[_0x834e('0xa2')],_0x319d6c[_0x834e('0x129')]);}else if(this['actions'][_0x319d6c[_0x834e('0xa2')]][_0x834e('0x47')]){logger[_0x834e('0x25')](_0x834e('0x12d'),_0x319d6c[_0x834e('0xa2')],_0x319d6c[_0x834e('0x129')],_0x834e('0xa1'),_0x36836f[_0x834e('0x28')],_0x834e('0x92'),_0x36836f[_0x834e('0x2d')]);this['callProgressDetectingCustomer'](_0x319d6c,_0x319d6c[_0x834e('0xa2')],_0x319d6c[_0x834e('0x129')]);}}};Preview[_0x834e('0x10')][_0x834e('0x1d')]=function(_0x371767){if(this[_0x834e('0x43')][_0x371767[_0x834e('0xd3')]]&&_0x371767[_0x834e('0xd3')]!==_0x371767[_0x834e('0x12e')]){this[_0x834e('0x75')](_0x371767,_0x371767[_0x834e('0xd3')],_0x371767[_0x834e('0xcb')]);}};Preview['prototype'][_0x834e('0x1c')]=function(_0x1cd122){if(this['actions'][_0x1cd122['linkedid']]&&_0x1cd122['linkedid']!==_0x1cd122[_0x834e('0x91')]&&!this[_0x834e('0x43')][_0x1cd122[_0x834e('0xa2')]][_0x834e('0x47')]){if(_0x1cd122[_0x834e('0x129')]==='1'){this[_0x834e('0x75')](_0x1cd122,_0x1cd122[_0x834e('0xa2')],_0x1cd122['cause']);}}};Preview['prototype']['addVariable']=function(_0x47947b,_0x684a97,_0x3c8fc2){if(this[_0x834e('0x43')][_0x47947b]){if(_['isNil'](this['actions'][_0x47947b]['variables'])){this[_0x834e('0x43')][_0x47947b]['variables']={};}this['actions'][_0x47947b][_0x834e('0x11c')][_0x684a97]=_0x3c8fc2;}};Preview[_0x834e('0x10')][_0x834e('0x20')]=function(_0x1acdbd){try{if(!_[_0x834e('0x54')](_0x1acdbd)){if(ut[_0x834e('0x12f')](_[_0x834e('0x130')](_0x1acdbd['variable'])[0x0])){this[_0x834e('0x131')](_0x1acdbd[_0x834e('0x91')],_[_0x834e('0x130')](_0x1acdbd[_0x834e('0x132')])[0x0],_0x1acdbd[_0x834e('0x133')]);}}}catch(_0x488f82){logger[_0x834e('0x134')]('[syncVarSet][Preview]',util[_0x834e('0x135')](_0x488f82,{'showHidden':![],'depth':null}));}};Preview[_0x834e('0x10')][_0x834e('0x22')]=function(_0x57714a){if(_0x57714a){if(this['actions'][_0x57714a['transfertargetlinkedid']]){this['actions'][_0x57714a[_0x834e('0x136')]][_0x834e('0x137')]=!![];}}};Preview['prototype']['syncBlindTransfer']=function(_0x20d61c){if(_0x20d61c){if(this[_0x834e('0x43')][_0x20d61c[_0x834e('0x138')]]){this['actions'][_0x20d61c[_0x834e('0x138')]][_0x834e('0x137')]=!![];}}};module[_0x834e('0x139')]=Preview; \ No newline at end of file +var _0xb43b=['custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','originated','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','logAgent','Congestion','[callProgressDetectingAgent][logCongestion]','AnswerAGI','reason','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','Contact','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','called','[Preview][execCall][failure]','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','isTrunkReachable','active','trunks','SIP/%s','reachable','execRun','unlockContact','getContactPreview','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20Backup\x20is\x20not\x20active','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','dialCutDigit','phone','substring','TrunkBackup','trim','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','agents','clone','isFailure','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','syncHangup','[syncHangup][talking]','cause','statedesc','dialQueueProject','channelstate','transfer','destuniqueid','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','moment','ioredis','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./action','../dialer/utils','redis','defaults','localhost','prototype','tail','finally','campaignsPreview','voiceQueues','actions','clockClearZombieChannels','syncOriginateResponse','bind','hanguprequest','syncHangupRequest','syncDialEnd','syncNewExten','varset','syncAttendedTransfer','loopCampaigns','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice:queue:%s','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','available','paused','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','message','DEACTIVATED','name','\x20is\x20deactivated','syncCampaigns','dialMethod','type','outbound','clearZombieChannels','hasOwnProperty','dialActive','setMessage','recallMe','clearZombieChannel','sequence','enqueue','isNil','info','[clearZombieChannels][talking]','Queue','queue','originated:\x20','stringify','pTalking:\x20','pick','contactId','UserId','VoiceQueueId','Action','status','channel','catch','updateOriginated','[clearZombieChannel]','dialAnswer','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','then','getDiff','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','isActive','Trunk','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','NoSuchNumber','emit','custom:agentnosuchnumber','buildObj','nosuchnumber','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','totalGlobal','dialGlobalMaxRetry','cloneAction','Global','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','incrementPreviewCounters','idContact','swapAdditionalPhones','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','pTalking','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','total','answered','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','sumBillable','talktime','uniqueid','BUSY','outboundBusyCallsDay','countbusyretry','countglobal','Busy','dialBusyRetryFrequency','[callProgressDetectingCustomer][logBusy]','NOANSWER','outboundNoAnswerCallsDay','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','CONGESTION','outboundCongestionCallsDay','countcongestionretry','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus'];(function(_0x14d871,_0x338701){var _0x129af5=function(_0xa0fb1e){while(--_0xa0fb1e){_0x14d871['push'](_0x14d871['shift']());}};_0x129af5(++_0x338701);}(_0xb43b,0x1b2));var _0xbb43=function(_0xc449ff,_0x3c8cbb){_0xc449ff=_0xc449ff-0x0;var _0x52f5b8=_0xb43b[_0xc449ff];return _0x52f5b8;};'use strict';var util=require(_0xbb43('0x0'));var _=require(_0xbb43('0x1'));var uuid=require('uuid');var moment=require(_0xbb43('0x2'));var Redis=require(_0xbb43('0x3'));var config=require(_0xbb43('0x4'));var logger=require('../../../config/logger')(_0xbb43('0x5'));var loggerAction=require(_0xbb43('0x6'))(_0xbb43('0x7'));var ami=require(_0xbb43('0x8'));var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0xbb43('0x9'));var ut=require('./util/util');var utils=require(_0xbb43('0xa'));config[_0xbb43('0xb')]=_[_0xbb43('0xc')](config[_0xbb43('0xb')],{'host':_0xbb43('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbb43('0xb')]));var Sequence=function(){};Sequence[_0xbb43('0xe')]['enqueue']=function(_0x7e0fc2){this[_0xbb43('0xf')]=this[_0xbb43('0xf')]?this[_0xbb43('0xf')][_0xbb43('0x10')](_0x7e0fc2):_0x7e0fc2();};function Preview(_0x2bef86){this['sequence']=new Sequence();this[_0xbb43('0x11')]=_0x2bef86[_0xbb43('0x12')];this['trunks']=_0x2bef86['trunks'];this[_0xbb43('0x13')]={};this['agents']=_0x2bef86['agents'];this[_0xbb43('0x14')]=0x0;ami['on']('originateresponse',this[_0xbb43('0x15')][_0xbb43('0x16')](this));ami['on']('hangup',this['syncHangup']['bind'](this));ami['on'](_0xbb43('0x17'),this[_0xbb43('0x18')]['bind'](this));ami['on']('dialend',this[_0xbb43('0x19')]['bind'](this));ami['on']('newexten',this[_0xbb43('0x1a')][_0xbb43('0x16')](this));ami['on'](_0xbb43('0x1b'),this['syncVarSet'][_0xbb43('0x16')](this));ami['on']('attendedtransfer',this[_0xbb43('0x1c')][_0xbb43('0x16')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0xbb43('0x16')](this));this[_0xbb43('0x1d')](this[_0xbb43('0x11')]);}function emit(_0x2bf2d4,_0x5bcce7,_0x40a650){io['to'](_0x2bf2d4)['emit'](_0x5bcce7,_0x40a650);}function emitVoiceQueueChannelRemove(_0x3a257d){logger['info'](_0xbb43('0x1e'),JSON['stringify'](_0x3a257d));emit(util[_0xbb43('0x1f')](_0xbb43('0x20'),_0x3a257d['name']),_0xbb43('0x21'),_0x3a257d);io['emit'](_0xbb43('0x22'),_0x3a257d);}function notSendMessagesQueue(_0x298ce2){if(_0x298ce2[_0xbb43('0x23')]){if(_0x298ce2['originated']===0x0&&_0x298ce2['pTalking']===0x0){_0x298ce2['sendMessageOneNotActive']=![];_0x298ce2[_0xbb43('0x24')]=0x0;_0x298ce2[_0xbb43('0x25')]=0x0;_0x298ce2['message']=utils[_0xbb43('0x26')][_0xbb43('0x27')];ut[_0xbb43('0x28')](_0xbb43('0x29'),_0x298ce2['name']+'\x20is\x20not\x20active');}else{_0x298ce2[_0xbb43('0x2a')]=utils[_0xbb43('0x26')][_0xbb43('0x2b')];ut[_0xbb43('0x28')](_0xbb43('0x29'),_0x298ce2[_0xbb43('0x2c')]+_0xbb43('0x2d'));}}}Preview[_0xbb43('0xe')]['loopCampaigns']=function(){var _0x2ad6da=this;setInterval(function(){_0x2ad6da['syncCampaigns']();},0x7cf);};Preview[_0xbb43('0xe')][_0xbb43('0x2e')]=function(){var _0x34f5b2=this[_0xbb43('0x11')];this['clockClearZombieChannels']+=0x1;for(var _0x157d62 in _0x34f5b2){if(_0x34f5b2['hasOwnProperty'](_0x157d62)&&(_0x34f5b2[_0x157d62]['dialMethod']==='preview'||_0x34f5b2[_0x157d62][_0xbb43('0x2f')]==='booked')&&_0x34f5b2[_0x157d62][_0xbb43('0x30')]===_0xbb43('0x31')){if(this[_0xbb43('0x14')]>0x7){this['clockClearZombieChannels']=0x0;this[_0xbb43('0x32')]();}}if(_0x34f5b2[_0xbb43('0x33')](_0x157d62)&&_0x34f5b2[_0x157d62][_0xbb43('0x2f')]===_0xbb43('0x5')&&_0x34f5b2[_0x157d62][_0xbb43('0x30')]===_0xbb43('0x31')){if(_0x34f5b2[_0x157d62][_0xbb43('0x34')]){this[_0xbb43('0x35')](_0x34f5b2[_0x157d62]);if(_0x34f5b2[_0x157d62]['dialPreviewAutoRecallMe'])this[_0xbb43('0x36')](_0x34f5b2[_0x157d62]);}else{notSendMessagesQueue(_0x34f5b2[_0x157d62]);}}}};Preview[_0xbb43('0xe')][_0xbb43('0x37')]=function(_0x244d66){var _0x4015ec=this;this[_0xbb43('0x38')][_0xbb43('0x39')](function(){if(!_[_0xbb43('0x3a')](_0x4015ec[_0xbb43('0x13')][_0x244d66])){loggerAction[_0xbb43('0x3b')](_0xbb43('0x3c'),_0x244d66,_0xbb43('0x3d'),_0x4015ec[_0xbb43('0x13')][_0x244d66][_0xbb43('0x3e')],_0xbb43('0x3f'),JSON[_0xbb43('0x40')](_0x4015ec['campaignsPreview'][_0x4015ec[_0xbb43('0x13')][_0x244d66][_0xbb43('0x3e')]]['originated']),_0xbb43('0x41'),JSON[_0xbb43('0x40')](_0x4015ec[_0xbb43('0x11')][_0x4015ec['actions'][_0x244d66]['queue']]['pTalking']),JSON[_0xbb43('0x40')](_0x4015ec[_0xbb43('0x13')][_0x244d66]['dialAnswer']),JSON['stringify'](_[_0xbb43('0x42')](_0x4015ec[_0xbb43('0x13')][_0x244d66],[_0xbb43('0x43'),_0xbb43('0x44'),_0xbb43('0x45'),'ListId'])));return ami[_0xbb43('0x46')]({'action':_0xbb43('0x47'),'channel':_0x4015ec[_0xbb43('0x13')][_0x244d66][_0xbb43('0x48')]})[_0xbb43('0x49')](function(_0x531d96){if(_0x531d96[_0xbb43('0x2a')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x4015ec[_0xbb43('0x13')][_0x244d66]){ut[_0xbb43('0x4a')](_0x4015ec['campaignsPreview'][_0x4015ec[_0xbb43('0x13')][_0x244d66]['queue']],_0xbb43('0x4b'));if(_0x4015ec[_0xbb43('0x13')][_0x244d66][_0xbb43('0x4c')]===!![]){ut[_0xbb43('0x4d')](_0x4015ec['campaignsPreview'][_0x4015ec[_0xbb43('0x13')][_0x244d66][_0xbb43('0x3e')]],'[clearZombieChannel]');ut[_0xbb43('0x4e')]('[Dialer][checkChannel][pTalking][Preview]'+_0x244d66,_0x4015ec[_0xbb43('0x13')][_0x244d66][_0xbb43('0x3e')]);}ut[_0xbb43('0x4e')](_0xbb43('0x4f')+_0x244d66,_0x4015ec[_0xbb43('0x13')][_0x244d66][_0xbb43('0x3e')]);delete _0x4015ec['actions'][_0x244d66];}},0x2328);}});}});};Preview[_0xbb43('0xe')]['clearZombieChannels']=function(){var _0x307f1e=this;loggerAction[_0xbb43('0x3b')](_0xbb43('0x50'),_[_0xbb43('0x51')](this['actions']));for(var _0x4622ea in this[_0xbb43('0x13')]){if(_0x307f1e[_0xbb43('0x13')][_0xbb43('0x33')](_0x4622ea)){_0x307f1e[_0xbb43('0x37')](_0x4622ea);}}};Preview[_0xbb43('0xe')][_0xbb43('0x36')]=function(_0x3592fb){var _0x5a662b=this;rpcDb[_0xbb43('0x52')](_0x3592fb['id'],ut[_0xbb43('0x53')](this['agents']))[_0xbb43('0x54')](function(_0x5d4c19){if(!_['isNil'](_0x5d4c19)){for(var _0x4d7034=0x0;_0x4d7034<_0x5d4c19['length'];_0x4d7034+=0x1){if(ut[_0xbb43('0x55')](_0x5d4c19[_0x4d7034]['scheduledat'])<_0x3592fb[_0xbb43('0x56')]*0x3c){if(_0x5d4c19[_0x4d7034]['Agent']&&!_0x5d4c19[_0x4d7034][_0xbb43('0x57')][_0xbb43('0x58')]){_0x5a662b[_0xbb43('0x59')](_0x5d4c19[_0x4d7034]['id'])['then'](ut[_0xbb43('0x5a')]('[RecallMe]'))[_0xbb43('0x49')](ut[_0xbb43('0x5a')](_0xbb43('0x5b')));}else{rpcDb[_0xbb43('0x5c')](_0x5d4c19[_0x4d7034]['id']);}}else{var _0x417ad9=new Action(_0x5d4c19[_0x4d7034],_0x3592fb);_0x417ad9[_0xbb43('0x5d')]=moment()[_0xbb43('0x1f')]('YYYY-MM-DD\x20HH:mm:ss');_0x3592fb[_0xbb43('0x5e')]+=0x1;ut[_0xbb43('0x5f')](_0x417ad9,0x17,_0xbb43('0x60'));if(_0x3592fb[_0xbb43('0x61')]){rpcDb['rescheduleContactInQueue'](ut[_0xbb43('0x62')](_0x5d4c19[_0x4d7034]));rpcDb[_0xbb43('0x63')](_0x417ad9,_0xbb43('0x64'));}else{ut[_0xbb43('0x5f')](_0x417ad9,0x16,'RecallFailedTimeout');rpcDb[_0xbb43('0x63')](_0x417ad9,_0xbb43('0x65'));rpcDb[_0xbb43('0x66')](_0x417ad9,'[HistoryRecallClose]');}}}}})[_0xbb43('0x49')](ut[_0xbb43('0x5a')](_0xbb43('0x67')));};Preview[_0xbb43('0xe')][_0xbb43('0x35')]=function(_0x59c805){_0x59c805['sendMessageOneNotActive']=!![];if(ut[_0xbb43('0x68')](_0x59c805['loggedIn'])){_0x59c805[_0xbb43('0x2a')]=utils[_0xbb43('0x26')]['NO_AGENTS_LOGGED'];}else if(!ut[_0xbb43('0x69')](_0x59c805[_0xbb43('0x34')])){_0x59c805[_0xbb43('0x2a')]=utils[_0xbb43('0x26')][_0xbb43('0x27')];}else if(!this['isTrunkReachable'](_0x59c805[_0xbb43('0x6a')])){if(!this['isTrunkReachable'](_0x59c805['TrunkBackup'])){_0x59c805[_0xbb43('0x2a')]=utils[_0xbb43('0x26')][_0xbb43('0x6b')];}else{_0x59c805[_0xbb43('0x2a')]=utils[_0xbb43('0x26')]['ACTIVE'];}}else{_0x59c805['message']=utils[_0xbb43('0x26')][_0xbb43('0x6c')];}};Preview[_0xbb43('0xe')][_0xbb43('0x6d')]=function(_0x99cb09,_0x38d540,_0x44691b){var _0x14fce0=this;var _0x1a3f98=this['actions'][_0x38d540];var _0x1b6f96=this[_0xbb43('0x11')][_0x1a3f98[_0xbb43('0x3e')]];var _0x3675d9;var _0x22bceb=![];var _0x1fae27=0x2;var _0x3f7262=0x3;if(_0x1b6f96){switch(_0x44691b){case'1':_0x1b6f96[_0xbb43('0x6e')]+=0x1;_0x1a3f98[_0xbb43('0x6f')]+=0x1;_0x1a3f98['countglobal']=ut['totalGlobal'](_0x1a3f98);ut[_0xbb43('0x5f')](_0x1a3f98,0x0,_0xbb43('0x70'));ami[_0xbb43('0x71')](_0xbb43('0x72'),ut[_0xbb43('0x73')](_0x1a3f98,_0xbb43('0x74')));rpcDb[_0xbb43('0x63')](_0x1a3f98,'[callProgressDetectingCustomer][logNoSuch]');_0x14fce0[_0xbb43('0x75')](_0x1a3f98,'0',_0x1b6f96)['then'](function(_0x5a6ff0){_0x22bceb=_0x5a6ff0[_0xbb43('0x76')]==0x1;_0x1fae27=_0x1b6f96[_0xbb43('0x77')];_0x3f7262=_0x1b6f96[_0xbb43('0x78')];if(!_0x22bceb){if(ut[_0xbb43('0x79')](_0x1a3f98)>=_0x1b6f96[_0xbb43('0x7a')]){_0x3675d9=ut[_0xbb43('0x7b')](_0x1a3f98,0xf,_0xbb43('0x7c'));rpcDb[_0xbb43('0x66')](_0x3675d9,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x1a3f98['countnosuchnumberretry']>=_0x1b6f96[_0xbb43('0x7d')]){rpcDb[_0xbb43('0x66')](_0x1a3f98,_0xbb43('0x7e'));}else{rpcDb[_0xbb43('0x7f')](ut[_0xbb43('0x80')](_0x1a3f98,_0xbb43('0x6f'),_0x1b6f96[_0xbb43('0x77')]),_0x1a3f98[_0xbb43('0x81')],_0x1a3f98[_0xbb43('0x82')]);}}delete this['actions'][_0x99cb09[_0xbb43('0x83')]];}else{_0x1a3f98[_0xbb43('0x6f')]++;logger[_0xbb43('0x3b')](_0xbb43('0x84'),_0x1a3f98[_0xbb43('0x6f')]);logger[_0xbb43('0x3b')]('id',_0x1a3f98['idContact']);_0x14fce0[_0xbb43('0x85')]({'id':_0x1a3f98[_0xbb43('0x86')],'field':{'countnosuchnumberretry':_0x1a3f98[_0xbb43('0x6f')]}})[_0xbb43('0x54')](function(){_0x14fce0[_0xbb43('0x87')](_0x1a3f98,_0x1fae27,_0x3f7262)['then'](function(){});});}});break;case _0xbb43('0x88'):var _0x6f04b3=moment()[_0xbb43('0x1f')](_0xbb43('0x89'));_0x1a3f98[_0xbb43('0x8a')]=_0x6f04b3;_0x1a3f98[_0xbb43('0x8b')]=_0x6f04b3;_0x1a3f98[_0xbb43('0x4c')]=!![];_0x1b6f96[_0xbb43('0x8c')]+=0x1;logger[_0xbb43('0x3b')](_0xbb43('0x8d'),_0x1a3f98['uniqueid'],_0xbb43('0x8e'),_0x1b6f96['name'],_0xbb43('0x41'),_0x1b6f96[_0xbb43('0x8c')]);ami[_0xbb43('0x71')](_0xbb43('0x8f'),ut[_0xbb43('0x73')](_0x1a3f98,'connect',this['campaignsPreview'][_0x1a3f98[_0xbb43('0x3e')]]));if(_0x1b6f96[_0xbb43('0x90')]){ami['emit'](_0xbb43('0x91'),ut[_0xbb43('0x92')](_0x1a3f98));}break;case'16':ami[_0xbb43('0x71')](_0xbb43('0x93'),ut[_0xbb43('0x73')](_0x1a3f98,_0xbb43('0x94'),this[_0xbb43('0x11')][_0x1a3f98[_0xbb43('0x3e')]]));emitVoiceQueueChannelRemove(ut[_0xbb43('0x73')](_0x1a3f98,_0xbb43('0x94')));_0x1b6f96[_0xbb43('0x95')]+=0x1;_0x1b6f96[_0xbb43('0x96')]+=0x1;_0x1b6f96[_0xbb43('0x97')]+=0x1;ut[_0xbb43('0x4d')](_0x1b6f96,'[16]');_0x1a3f98['countglobal']=ut[_0xbb43('0x79')](_0x1a3f98);ut[_0xbb43('0x5f')](_0x1a3f98,0x4,_0xbb43('0x98'));rpcDb['createCustomerHistory'](_0x1a3f98,_0xbb43('0x99'));rpcDb[_0xbb43('0x66')](_0x1a3f98,_0xbb43('0x9a'));rpcDb[_0xbb43('0x9b')](_0x1a3f98);_0x1b6f96[_0xbb43('0x9c')]+=_0x1a3f98['talktime'];_0x1b6f96[_0xbb43('0x9d')]+=_0x1a3f98[_0xbb43('0x9e')];logger[_0xbb43('0x3b')]('[syncHangup][talking][decrement]',_0x1a3f98[_0xbb43('0x9f')],_0xbb43('0x8e'),_0x1b6f96[_0xbb43('0x2c')],_0xbb43('0x41'),_0x1b6f96[_0xbb43('0x8c')]);delete this[_0xbb43('0x13')][_0x99cb09[_0xbb43('0x83')]];break;case _0xbb43('0xa0'):_0x1b6f96[_0xbb43('0xa1')]+=0x1;_0x1a3f98[_0xbb43('0xa2')]+=0x1;_0x1a3f98[_0xbb43('0xa3')]=ut['totalGlobal'](_0x1a3f98);ut[_0xbb43('0x5f')](_0x1a3f98,0x5,_0xbb43('0xa4'));_0x1fae27=_0x1b6f96[_0xbb43('0xa5')];_0x3f7262=_0x1b6f96[_0xbb43('0x78')];ami[_0xbb43('0x71')]('custom:agentbusy',ut['buildObj'](_0x1a3f98,'busy'));rpcDb[_0xbb43('0x63')](_0x1a3f98,_0xbb43('0xa6'));_0x14fce0[_0xbb43('0x75')](_0x1a3f98,'5',_0x1b6f96)[_0xbb43('0x54')](function(_0x8d5a8d){_0x22bceb=_0x8d5a8d[_0xbb43('0x76')]==0x1;if(!_0x22bceb){if(ut[_0xbb43('0x79')](_0x1a3f98)>=_0x1b6f96['dialGlobalMaxRetry']){_0x3675d9=ut[_0xbb43('0x7b')](_0x1a3f98,0xf,_0xbb43('0x7c'));rpcDb[_0xbb43('0x66')](_0x3675d9,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x1a3f98[_0xbb43('0xa2')]>=_0x1b6f96['dialBusyMaxRetry']){rpcDb[_0xbb43('0x66')](_0x1a3f98,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0xbb43('0x7f')](ut[_0xbb43('0x80')](_0x1a3f98,_0xbb43('0xa2'),_0x1b6f96[_0xbb43('0xa5')]),_0x1a3f98[_0xbb43('0x81')],_0x1a3f98[_0xbb43('0x82')]);}}}else{_0x1a3f98[_0xbb43('0xa2')]++;_0x14fce0[_0xbb43('0x85')]({'id':_0x1a3f98['idContact'],'field':{'countbusyretry':_0x1a3f98[_0xbb43('0xa2')]}})[_0xbb43('0x54')](function(){_0x14fce0['swapAdditionalPhones'](_0x1a3f98,_0x1fae27,_0x3f7262)[_0xbb43('0x54')](function(){});});}});break;case _0xbb43('0xa7'):_0x1b6f96[_0xbb43('0xa8')]+=0x1;_0x1a3f98['countnoanswerretry']+=0x1;_0x1a3f98[_0xbb43('0xa3')]=ut[_0xbb43('0x79')](_0x1a3f98);ut[_0xbb43('0x5f')](_0x1a3f98,0x3,_0xbb43('0xa9'));_0x1fae27=_0x1b6f96[_0xbb43('0xaa')];_0x3f7262=_0x1b6f96[_0xbb43('0x78')];var _0x4f356d=ut[_0xbb43('0xab')](_0x1a3f98,_0x1b6f96);ami['emit'](_0xbb43('0xac'),_0x4f356d);rpcDb[_0xbb43('0x63')](_0x1a3f98,'[callProgressDetectingCustomer][logNoAnswer]');_0x14fce0[_0xbb43('0x75')](_0x1a3f98,'3',_0x1b6f96)[_0xbb43('0x54')](function(_0x4d9668){_0x22bceb=_0x4d9668['additional']==0x1;if(!_0x22bceb){if(ut[_0xbb43('0x79')](_0x1a3f98)>=_0x1b6f96[_0xbb43('0x7a')]){_0x3675d9=ut[_0xbb43('0x7b')](_0x1a3f98,0xf,_0xbb43('0x7c'));rpcDb[_0xbb43('0x66')](_0x3675d9,_0xbb43('0xad'));}else{if(_0x1a3f98[_0xbb43('0xae')]>=_0x1b6f96[_0xbb43('0xaf')]){rpcDb[_0xbb43('0x66')](_0x1a3f98,_0xbb43('0xb0'));}else{rpcDb['rescheduleContact'](ut[_0xbb43('0x80')](_0x1a3f98,_0xbb43('0xae'),_0x1b6f96[_0xbb43('0xaa')]),_0x1a3f98['unlockAgent'],_0x1a3f98['activeContact']);}}}else{_0x1a3f98[_0xbb43('0xae')]++;_0x14fce0[_0xbb43('0x85')]({'id':_0x1a3f98[_0xbb43('0x86')],'field':{'countnoanswerretry':_0x1a3f98[_0xbb43('0xae')]}})['then'](function(){_0x14fce0[_0xbb43('0x87')](_0x1a3f98,_0x1fae27,_0x3f7262)['then'](function(){});});}});break;case _0xbb43('0xb1'):_0x1b6f96[_0xbb43('0xb2')]+=0x1;_0x1a3f98[_0xbb43('0xb3')]+=0x1;_0x1a3f98['countglobal']=ut[_0xbb43('0x79')](_0x1a3f98);ut[_0xbb43('0x5f')](_0x1a3f98,0x8,'Congestion');_0x1fae27=_0x1b6f96['dialCongestionRetryFrequency'];_0x3f7262=_0x1b6f96[_0xbb43('0x78')];ami[_0xbb43('0x71')](_0xbb43('0xb4'),ut[_0xbb43('0x73')](_0x1a3f98,_0xbb43('0xb5')));rpcDb[_0xbb43('0x63')](_0x1a3f98,_0xbb43('0xb6'));_0x14fce0[_0xbb43('0x75')](_0x1a3f98,'8',_0x1b6f96)['then'](function(_0xaa42f9){_0x22bceb=_0xaa42f9[_0xbb43('0x76')]==0x1;if(!_0x22bceb){if(ut[_0xbb43('0x79')](_0x1a3f98)>=_0x1b6f96[_0xbb43('0x7a')]){_0x3675d9=ut['cloneAction'](_0x1a3f98,0xf,_0xbb43('0x7c'));rpcDb['createCustomerFinal'](_0x3675d9,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x1a3f98[_0xbb43('0xb3')]>=_0x1b6f96[_0xbb43('0xb7')]){rpcDb[_0xbb43('0x66')](_0x1a3f98,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x1a3f98,_0xbb43('0xb3'),_0x1b6f96[_0xbb43('0xa5')]),_0x1a3f98[_0xbb43('0x81')],_0x1a3f98[_0xbb43('0x82')]);}}}else{_0x1a3f98[_0xbb43('0xb3')]++;_0x14fce0['incrementPreviewCounters']({'id':_0x1a3f98[_0xbb43('0x86')],'field':{'countcongestionretry':_0x1a3f98['countcongestionretry']}})[_0xbb43('0x54')](function(){_0x14fce0['swapAdditionalPhones'](_0x1a3f98,_0x1fae27,_0x3f7262)['then'](function(){});});}});break;case'CANCEL':_0x1b6f96[_0xbb43('0xb8')]+=0x1;_0x1a3f98[_0xbb43('0xb9')]+=0x1;_0x1a3f98['countglobal']=ut[_0xbb43('0x79')](_0x1a3f98);ut[_0xbb43('0x5f')](_0x1a3f98,0x14,_0xbb43('0xba'));_0x1fae27=_0x1b6f96[_0xbb43('0xbb')];_0x3f7262=_0x1b6f96[_0xbb43('0x78')];ami[_0xbb43('0x71')](_0xbb43('0xbc'),ut[_0xbb43('0x73')](_0x1a3f98,_0xbb43('0xbd')));rpcDb[_0xbb43('0x63')](_0x1a3f98,_0xbb43('0xbe'));_0x14fce0['verifyAdditionalPhones'](_0x1a3f98,'20',_0x1b6f96)[_0xbb43('0x54')](function(_0x5bbbf4){_0x22bceb=_0x5bbbf4[_0xbb43('0x76')]==0x1;if(!_0x22bceb){if(ut[_0xbb43('0x79')](_0x1a3f98)>=_0x1b6f96[_0xbb43('0x7a')]){_0x3675d9=ut[_0xbb43('0x7b')](_0x1a3f98,0x14,_0xbb43('0xba'));rpcDb[_0xbb43('0x66')](_0x3675d9,_0xbb43('0xbf'));}else{if(_0x1a3f98[_0xbb43('0xb9')]>=_0x1b6f96[_0xbb43('0xc0')]){rpcDb['createCustomerFinal'](_0x1a3f98,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0xbb43('0x7f')](ut[_0xbb43('0x80')](_0x1a3f98,'countagentrejectretry',_0x1b6f96[_0xbb43('0xbb')]),_0x1a3f98['unlockAgent'],_0x1a3f98[_0xbb43('0x82')]);}}}else{_0x1a3f98[_0xbb43('0xae')]++;_0x14fce0[_0xbb43('0x85')]({'id':_0x1a3f98[_0xbb43('0x86')],'field':{'countnoanswerretry':_0x1a3f98[_0xbb43('0xae')]}})[_0xbb43('0x54')](function(){_0x14fce0['swapAdditionalPhones'](_0x1a3f98,_0x1fae27,_0x3f7262)[_0xbb43('0x54')](function(){});});}});break;case _0xbb43('0xc1'):_0x1b6f96[_0xbb43('0xc2')]+=0x1;_0x1a3f98[_0xbb43('0xc3')]+=0x1;_0x1a3f98[_0xbb43('0xa3')]=ut[_0xbb43('0x79')](_0x1a3f98);ut[_0xbb43('0x5f')](_0x1a3f98,0xb,_0xbb43('0xc4'));rpcDb[_0xbb43('0x63')](_0x1a3f98,_0xbb43('0xc5'));_0x14fce0[_0xbb43('0x75')](_0x1a3f98,'11',_0x1b6f96)[_0xbb43('0x54')](function(_0x14cd97){_0x22bceb=_0x14cd97[_0xbb43('0x76')]==0x1;if(!_0x22bceb){if(ut[_0xbb43('0x79')](_0x1a3f98)>=_0x1b6f96['dialGlobalMaxRetry']){_0x3675d9=ut[_0xbb43('0x7b')](_0x1a3f98,0xf,_0xbb43('0x7c'));rpcDb['createCustomerFinal'](_0x3675d9,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x1a3f98[_0xbb43('0xc6')]>=_0x1b6f96['dialAbandonedMaxRety']){rpcDb['createCustomerFinal'](_0x1a3f98,_0xbb43('0xc5'));}else{rpcDb['rescheduleContact'](ut[_0xbb43('0x80')](_0x1a3f98,_0xbb43('0xc3'),_0x1b6f96[_0xbb43('0xc7')]),_0x1a3f98[_0xbb43('0x81')],_0x1a3f98['activeContact']);}}}else{_0x1a3f98[_0xbb43('0xae')]++;_0x14fce0[_0xbb43('0x85')]({'id':_0x1a3f98[_0xbb43('0x86')],'field':{'countnoanswerretry':_0x1a3f98['countnoanswerretry']}})[_0xbb43('0x54')](function(){_0x14fce0[_0xbb43('0x87')](_0x1a3f98,_0x1fae27,_0x3f7262)['then'](function(){});});}});break;case'18':_0x1b6f96[_0xbb43('0xc8')]+=0x1;_0x1a3f98[_0xbb43('0xc9')]+=0x1;_0x1a3f98[_0xbb43('0xa3')]=ut[_0xbb43('0x79')](_0x1a3f98);ut[_0xbb43('0x5f')](_0x1a3f98,0x12,_0x99cb09[_0xbb43('0xca')]||_0x99cb09[_0xbb43('0xcb')]);ami[_0xbb43('0x71')](_0xbb43('0xcc'),ut[_0xbb43('0x73')](_0x1a3f98,_0xbb43('0xcd')));rpcDb[_0xbb43('0x63')](_0x1a3f98,_0xbb43('0xce'));_0x14fce0[_0xbb43('0x75')](_0x1a3f98,'18',_0x1b6f96)['then'](function(_0x1f5a0a){_0x22bceb=_0x1f5a0a[_0xbb43('0x76')]==0x1;if(!_0x22bceb){if(ut[_0xbb43('0x79')](_0x1a3f98)>=_0x1b6f96[_0xbb43('0x7a')]){_0x3675d9=ut['cloneAction'](_0x1a3f98,0x12,_0xbb43('0x7c'));rpcDb[_0xbb43('0x66')](_0x3675d9,_0xbb43('0xce'));}else{rpcDb[_0xbb43('0x66')](_0x1a3f98,_0xbb43('0xce'));}}else{_0x1a3f98['countnoanswerretry']++;_0x14fce0[_0xbb43('0x85')]({'id':_0x1a3f98[_0xbb43('0x86')],'field':{'countnoanswerretry':_0x1a3f98['countnoanswerretry']}})[_0xbb43('0x54')](function(){_0x14fce0[_0xbb43('0x87')](_0x1a3f98,_0x1fae27,_0x3f7262)['then'](function(){});});}});delete this[_0xbb43('0x13')][_0x99cb09[_0xbb43('0x83')]];break;case'19':_0x1b6f96[_0xbb43('0xc8')]+=0x1;_0x1a3f98[_0xbb43('0xa3')]=ut[_0xbb43('0x79')](_0x1a3f98);ut['logCustomer'](_0x1a3f98,0x13,_0x99cb09[_0xbb43('0xca')]||_0x99cb09[_0xbb43('0xcb')]);ami[_0xbb43('0x71')](_0xbb43('0xcc'),ut[_0xbb43('0x73')](_0x1a3f98,'amd'));rpcDb[_0xbb43('0x63')](_0x1a3f98,'[callProgressDetectingCustomer][machine]');_0x14fce0['verifyAdditionalPhones'](_0x1a3f98,'18',_0x1b6f96)[_0xbb43('0x54')](function(_0x54fd3b){_0x22bceb=_0x54fd3b[_0xbb43('0x76')]==0x1;if(!_0x22bceb){if(ut[_0xbb43('0x79')](_0x1a3f98)>=_0x1b6f96[_0xbb43('0x7a')]){_0x3675d9=ut[_0xbb43('0x7b')](_0x1a3f98,0xf,'Global');rpcDb['createCustomerFinal'](_0x3675d9,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0xbb43('0x66')](_0x1a3f98,_0xbb43('0xcf'));}}else{_0x1a3f98[_0xbb43('0xae')]++;_0x14fce0[_0xbb43('0x85')]({'id':_0x1a3f98[_0xbb43('0x86')],'field':{'countnoanswerretry':_0x1a3f98[_0xbb43('0xae')]}})[_0xbb43('0x54')](function(){_0x14fce0[_0xbb43('0x87')](_0x1a3f98,_0x1fae27,_0x3f7262)['then'](function(){});});}});delete this[_0xbb43('0x13')][_0x99cb09['linkedid']];break;default:if(_0x1a3f98[_0xbb43('0x4c')]){ut[_0xbb43('0x4d')](_0x1b6f96,_0xbb43('0xd0'));ut[_0xbb43('0x4e')](_0xbb43('0xd1')+_0x1b6f96[_0xbb43('0x2c')],_0x99cb09);}_0x1b6f96[_0xbb43('0xc8')]+=0x1;_0x1a3f98[_0xbb43('0xa3')]=ut[_0xbb43('0x79')](_0x1a3f98);ut['logCustomer'](_0x1a3f98,0xc,_0x99cb09[_0xbb43('0xca')]||_0x99cb09[_0xbb43('0xcb')]);_0x1fae27=_0x1b6f96[_0xbb43('0xbb')];_0x3f7262=_0x1b6f96[_0xbb43('0x78')];rpcDb[_0xbb43('0x63')](_0x1a3f98,_0xbb43('0xd2'));_0x14fce0['verifyAdditionalPhones'](_0x1a3f98,'20',_0x1b6f96)[_0xbb43('0x54')](function(_0x2965ec){_0x22bceb=_0x2965ec[_0xbb43('0x76')]==0x1;if(!_0x22bceb){if(ut[_0xbb43('0x79')](_0x1a3f98)>=_0x1b6f96[_0xbb43('0x7a')]){_0x3675d9=ut[_0xbb43('0x7b')](_0x1a3f98,0xf,_0xbb43('0x7c'));rpcDb[_0xbb43('0x66')](_0x3675d9,_0xbb43('0xd3'));}else{rpcDb['createCustomerFinal'](_0x1a3f98,_0xbb43('0xd3'));}delete this[_0xbb43('0x13')][_0x99cb09[_0xbb43('0x83')]];}else{_0x14fce0['swapAdditionalPhones'](_0x1a3f98,_0x1fae27,_0x3f7262)[_0xbb43('0x54')](function(){});}});}if(!(_0x1a3f98['dialAnswer']&&_0x44691b==='16')){ut['updateOriginated'](_0x1b6f96,_0xbb43('0xd4'));logger[_0xbb43('0x3b')]('[originated][decrement][callProgressDetectingCustomer]',_0x1a3f98[_0xbb43('0x9f')],'\x20Queue',_0x1b6f96[_0xbb43('0x2c')],_0xbb43('0x3f'),_0x1b6f96[_0xbb43('0xd5')]);}if(_0x44691b!=='ANSWER'){delete this['actions'][_0x99cb09['linkedid']];delete this[_0xbb43('0x13')][_0x99cb09[_0xbb43('0xd6')]];}_0x1b6f96[_0xbb43('0xd7')]=!![];}};Preview[_0xbb43('0xe')][_0xbb43('0xd8')]=function(_0x53b9ee,_0xb54a91,_0x7271d0){if(_[_0xbb43('0xd9')](_0xb54a91)&&_0xbb43('0xda')!==typeof _0xb54a91){return;}if(_[_0xbb43('0xd9')](_0x7271d0)&&_0xbb43('0xda')!==typeof _0x7271d0){return;}switch(_0x7271d0['reason']){case'0':ut['logAgent'](_0x53b9ee,0x0,_0xbb43('0x70'));rpcDb[_0xbb43('0xdb')](_0x53b9ee,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut['logAgent'](_0x53b9ee,0x3,_0xbb43('0xa9'));rpcDb['createAgentHistory'](_0x53b9ee,_0xbb43('0xdc'));break;case'5':ut[_0xbb43('0xdd')](_0x53b9ee,0x5,_0xbb43('0xa4'));rpcDb[_0xbb43('0xdb')](_0x53b9ee,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0xbb43('0xdd')](_0x53b9ee,0x8,_0xbb43('0xde'));rpcDb[_0xbb43('0xdb')](_0x53b9ee,_0xbb43('0xdf'));break;case'22':ut[_0xbb43('0xdd')](_0x53b9ee,0x16,_0xbb43('0xe0'));rpcDb['createAgentHistory'](_0x53b9ee,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0xbb43('0xdd')](_0x53b9ee,0xc,_0x7271d0[_0xbb43('0xe1')]);rpcDb[_0xbb43('0xdb')](_0x53b9ee,_0xbb43('0xdf'));}ut[_0xbb43('0x4a')](_0xb54a91,'[callProgressDetectingAgent]');logger['info'](_0xbb43('0xe2'),_0x53b9ee[_0xbb43('0x9f')],_0xbb43('0x8e'),_0xb54a91['name'],_0xbb43('0x3f'),_0xb54a91[_0xbb43('0xd5')]);delete this[_0xbb43('0x13')][_0x53b9ee['uniqueid']];};Preview[_0xbb43('0xe')]['verifyAdditionalPhones']=function(_0x2719ce,_0x235409,_0x3386bc){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x2719ce,_0x235409,_0x3386bc)[_0xbb43('0x49')](logger[_0xbb43('0x3b')](_0xbb43('0xe3')));};Preview[_0xbb43('0xe')][_0xbb43('0x87')]=function(_0x34e8b8,_0x339b30,_0x4122e7){return cmHopperAdditionalPhone[_0xbb43('0x87')](_0x34e8b8,_0x339b30,_0x4122e7)[_0xbb43('0x49')](logger[_0xbb43('0x3b')](_0xbb43('0xe4')));};Preview[_0xbb43('0xe')][_0xbb43('0x85')]=function(_0x5e2afe){return Promise[_0xbb43('0xe5')]()[_0xbb43('0x54')](cmHopperAdditionalPhone[_0xbb43('0x85')](_0x5e2afe))[_0xbb43('0x49')](logger[_0xbb43('0x3b')](_0xbb43('0xe6')));};Preview[_0xbb43('0xe')][_0xbb43('0xe7')]=function(_0x1f8f78,_0x3a05be,_0x2dd161,_0x2d2127,_0x3c537a){var _0x36af9a=this;return new Promise(function(_0x199b58,_0x357e45){if(_[_0xbb43('0x3a')](_0x3a05be)||_['isNil'](_0x3a05be[_0xbb43('0xe8')])||_['isNil'](_0x3a05be['phone'])||_[_0xbb43('0x3a')](_0x3a05be[_0xbb43('0x45')])){_0x357e45(ut['message']('Contact\x20is\x20undefined',_0x2d2127,_0x3c537a));return;}var _0x3fce74=uuid['v4']();var _0x5911fc=_0x36af9a['campaignsPreview'][_0x3a05be[_0xbb43('0x3d')]['name']];var _0x41f3fe=_0x2dd161?_0x36af9a['agents'][_0x2dd161]['id']:undefined;_0x36af9a[_0xbb43('0x13')][_0x3fce74]=new Action(_0x3a05be,_0x5911fc,_0x3fce74,_0x2dd161,_0x41f3fe);var _0x5fdbcd=_0x36af9a['actions'][_0x3fce74];_0x5fdbcd[_0xbb43('0x81')]=_0x2d2127;_0x5fdbcd[_0xbb43('0x82')]=_0x3c537a;_0x5fdbcd[_0xbb43('0xe9')]=_0x2dd161;if(_[_0xbb43('0xea')](_0x1f8f78)){_0x36af9a[_0xbb43('0xeb')](_0x5fdbcd,_0x5911fc,_0x3a05be,_0x2dd161)['then'](function(_0x6b0dd){logger[_0xbb43('0x3b')](_0xbb43('0xec'),_0xbb43('0xed')+_0x5fdbcd[_0xbb43('0x3e')]+'\x20IdHopper:\x20'+_0x5fdbcd[_0xbb43('0x86')],JSON[_0xbb43('0x40')](_0x6b0dd));ami[_0xbb43('0x71')]('custom:agentcalled',ut['buildObj'](_0x5fdbcd,_0xbb43('0xee'),_0x36af9a[_0xbb43('0x11')][_0x5fdbcd[_0xbb43('0x3e')]]));_0x199b58(ut['message']('Calling'));})[_0xbb43('0x49')](function(_0x1ab4c4){ut[_0xbb43('0x28')](_0xbb43('0xef'),_0x1ab4c4);_0x357e45(ut[_0xbb43('0x2a')]('Call\x20failed',_0x2d2127,_0x3c537a));});}else{_0x5911fc[_0xbb43('0xf0')]+=0x1;ut[_0xbb43('0xf1')](_0x5fdbcd);rpcDb[_0xbb43('0xf2')](_0x5fdbcd,_0xbb43('0xf3'));delete _0x36af9a[_0xbb43('0x13')][_0x3fce74];_0x357e45(ut[_0xbb43('0x2a')]('Contact\x20in\x20black\x20List',_0x2d2127,_0x3c537a));}});};Preview[_0xbb43('0xe')][_0xbb43('0xf4')]=function(_0x12f7a9){return!_['isNil'](_0x12f7a9)&&!_[_0xbb43('0x3a')](_0x12f7a9['name'])&&!_[_0xbb43('0x3a')](_0x12f7a9[_0xbb43('0xf5')])&&_0x12f7a9[_0xbb43('0xf5')]&&!_[_0xbb43('0x3a')](this['trunks'][util[_0xbb43('0x1f')]('SIP/%s',_0x12f7a9[_0xbb43('0x2c')])])&&!_[_0xbb43('0x3a')](this[_0xbb43('0xf6')][util[_0xbb43('0x1f')](_0xbb43('0xf7'),_0x12f7a9['name'])][_0xbb43('0x47')])&&(this[_0xbb43('0xf6')][util[_0xbb43('0x1f')](_0xbb43('0xf7'),_0x12f7a9[_0xbb43('0x2c')])]['status']===_0xbb43('0xf8')||this[_0xbb43('0xf6')][util[_0xbb43('0x1f')]('SIP/%s',_0x12f7a9[_0xbb43('0x2c')])]['status']==='unmonitored');};Preview['prototype']['run']=function(_0x44b3de,_0x5d7629){return this[_0xbb43('0xf9')](_0x44b3de,_0x5d7629)[_0xbb43('0x54')](function(_0x20be22){return _[_0xbb43('0x42')](_0x20be22,['message']);})[_0xbb43('0x49')](function(_0x12c97f){if(_0x12c97f['unlock']){rpcDb[_0xbb43('0xfa')](_0x44b3de);}if(_0x12c97f[_0xbb43('0xf5')]){rpcDb['disableContact'](_0x44b3de);}throw _['pick'](_0x12c97f,[_0xbb43('0x2a')]);});};Preview[_0xbb43('0xe')][_0xbb43('0xf9')]=function(_0x5d6ec2,_0x17065d){var _0x59fc4a=this;var _0x448d75,_0x33edab;return rpcDb[_0xbb43('0xfb')](_0x5d6ec2)[_0xbb43('0x54')](function(_0x55df31){if(!_[_0xbb43('0x3a')](_0x55df31[0x0])){_0x33edab=_0x55df31[0x0][_0xbb43('0xfc')]?![]:!![];_0x448d75=_0x55df31[0x0][_0xbb43('0xfc')]?!![]:![];_0x448d75=_0x17065d?!![]:_0x448d75;}var _0x7c7f55=_0x59fc4a[_0xbb43('0xfd')](_0x55df31);if(_0x7c7f55['isValid']){rpcDb[_0xbb43('0xfe')](_[_0xbb43('0x42')](_0x55df31[0x0],['VoiceQueueId','phone']))[_0xbb43('0x54')](function(_0x4d0023){_0x59fc4a[_0xbb43('0xe7')](_0x4d0023,_0x55df31[0x0],_0x17065d,_0x33edab,_0x448d75)[_0xbb43('0x54')](function(_0x36fddb){return _0x36fddb;})[_0xbb43('0x49')](function(_0x6bbd30){throw _0x6bbd30;});})[_0xbb43('0x49')](function(_0x21a044){ut[_0xbb43('0x28')](_0xbb43('0xff'),_0x21a044);throw ut[_0xbb43('0x2a')]('Call\x20unsuccessful',_0x33edab,_0x448d75);});}else{throw ut[_0xbb43('0x2a')](_0x7c7f55[_0xbb43('0x2a')],_0x33edab,_0x448d75);}})[_0xbb43('0x49')](function(_0x544418){ut[_0xbb43('0x28')](_0xbb43('0x100'),_0x544418);throw ut[_0xbb43('0x2a')](_0xbb43('0x101'),![],!![]);});};Preview[_0xbb43('0xe')]['validateContact']=function(_0x3f4ab7){if(_['isNil'](_0x3f4ab7)||_['isEmpty'](_0x3f4ab7)||!_['isNil'](_0x3f4ab7[0x0]['Agent'])&&_[_0xbb43('0x3a')](_0x3f4ab7[0x0][_0xbb43('0x57')][_0xbb43('0x2c')])){ut[_0xbb43('0x28')](_0xbb43('0x102'),_0x3f4ab7);return{'isValid':![],'message':_0xbb43('0x103')};}var _0x108e6d=this['campaignsPreview'][_0x3f4ab7[0x0][_0xbb43('0x3d')][_0xbb43('0x2c')]];_0x108e6d[_0xbb43('0x2a')]=utils[_0xbb43('0x26')][_0xbb43('0x6c')];if(_[_0xbb43('0x3a')](_0x108e6d)){ut[_0xbb43('0x28')](_0xbb43('0x104'),_0x108e6d);return{'isValid':![],'message':_0xbb43('0x105')};}if(!this[_0xbb43('0xf4')](_0x108e6d[_0xbb43('0x6a')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0xbb43('0x106')+_0x108e6d[_0xbb43('0x2c')]+_0xbb43('0x107'));if(!this[_0xbb43('0xf4')](_0x108e6d['TrunkBackup'])){ut[_0xbb43('0x28')](_0xbb43('0x108'),_0x108e6d[_0xbb43('0x2c')]+_0xbb43('0x109'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut['isActive'](_0x108e6d[_0xbb43('0x34')])){ut['logger']('[Preview][validateContact][Campaign\x20Active]',_0x108e6d[_0xbb43('0x2c')]+_0xbb43('0x10a'));return{'isValid':![],'message':_0xbb43('0x106')+_0x108e6d[_0xbb43('0x2c')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0xbb43('0x10b')};};Preview[_0xbb43('0xe')][_0xbb43('0xeb')]=function(_0x581645,_0x4e7cdb,_0x3eaada,_0x1c9c7f){var _0x1d5376=this;return new Promise(function(_0x2ba34c,_0x30e984){var _0x5d7a43=_0x581645[_0xbb43('0x9f')];var _0x540b8d=_0x1d5376[_0xbb43('0xf4')](_0x4e7cdb[_0xbb43('0x6a')])?util[_0xbb43('0x1f')](_0xbb43('0x10c'),_0x4e7cdb[_0xbb43('0x6a')][_0xbb43('0x2c')],_['isNil'](_0x4e7cdb[_0xbb43('0x10d')])?'':_0x4e7cdb[_0xbb43('0x10d')]['trim']()||'',_0x4e7cdb[_0xbb43('0x10e')]>0x0?_0x3eaada[_0xbb43('0x10f')][_0xbb43('0x110')](_0x4e7cdb[_0xbb43('0x10e')]):_0x3eaada[_0xbb43('0x10f')]):util[_0xbb43('0x1f')](_0xbb43('0x10c'),_[_0xbb43('0x3a')](_0x4e7cdb['TrunkBackup'])?_0x4e7cdb[_0xbb43('0x6a')][_0xbb43('0x2c')]:_0x4e7cdb[_0xbb43('0x111')][_0xbb43('0x2c')],_['isNil'](_0x4e7cdb[_0xbb43('0x10d')])?'':_0x4e7cdb[_0xbb43('0x10d')][_0xbb43('0x112')]()||'',_0x4e7cdb[_0xbb43('0x10e')]>0x0?_0x3eaada[_0xbb43('0x10f')][_0xbb43('0x110')](_0x4e7cdb[_0xbb43('0x10e')]):_0x3eaada[_0xbb43('0x10f')]);var _0x1f211d=_0x1d5376[_0xbb43('0xf4')](_0x4e7cdb['Trunk'])?ut[_0xbb43('0x113')](_0x4e7cdb[_0xbb43('0x6a')][_0xbb43('0x114')],_0x4e7cdb['dialOriginateCallerIdName'],_0x4e7cdb[_0xbb43('0x115')]>0x0?ut[_0xbb43('0x116')](_0x4e7cdb[_0xbb43('0x117')],_0x4e7cdb[_0xbb43('0x115')]):_0x4e7cdb[_0xbb43('0x117')]):ut['getCallerId'](_[_0xbb43('0x3a')](_0x4e7cdb[_0xbb43('0x111')])?_0x4e7cdb[_0xbb43('0x6a')][_0xbb43('0x114')]:_0x4e7cdb[_0xbb43('0x111')][_0xbb43('0x114')],_0x4e7cdb['dialOriginateCallerIdName'],_0x4e7cdb[_0xbb43('0x115')]>0x0?ut[_0xbb43('0x116')](_0x4e7cdb[_0xbb43('0x117')],_0x4e7cdb[_0xbb43('0x115')]):_0x4e7cdb[_0xbb43('0x117')]);if(_0x1f211d){_0x581645[_0xbb43('0x118')]=ut[_0xbb43('0x119')](_0x1f211d);_0x581645[_0xbb43('0x11a')]=ut[_0xbb43('0x11b')](_0x1f211d);}var _0x19260c=ut[_0xbb43('0x11c')](_0x4e7cdb,_0x3eaada,_0x540b8d,_0x1f211d,_0x5d7a43,_0x581645);_[_0xbb43('0x11d')](_0x581645,ut[_0xbb43('0x11e')](_0x19260c));_0x581645[_0xbb43('0x5d')]=moment()['format'](_0xbb43('0x89'));_0x4e7cdb[_0xbb43('0x11f')]=_0x19260c;var _0x1baf8c=ut[_0xbb43('0x120')](_0x581645,_0x4e7cdb,_0x19260c,_0x581645[_0xbb43('0x82')],_0x1c9c7f);return ami[_0xbb43('0x46')](_0x1baf8c)['then'](function(_0x4345e4){_0x4e7cdb[_0xbb43('0xd5')]+=0x1;logger[_0xbb43('0x3b')](_0xbb43('0x121'),_0x5d7a43,_0xbb43('0x8e'),_0x4e7cdb[_0xbb43('0x2c')],_0xbb43('0x3f'),_0x4e7cdb[_0xbb43('0xd5')]);_0x2ba34c(_0x4345e4);})[_0xbb43('0x49')](function(_0x510584){ut[_0xbb43('0xdd')](_0x581645,0xe,_0xbb43('0x122'));rpcDb[_0xbb43('0xdb')](_0x581645,_0xbb43('0x123'));_0x30e984(_0x510584);});});};Preview[_0xbb43('0xe')]['syncNewExten']=function(_0x26825d){if(this['actions'][_0x26825d['linkedid']]){this['actions'][_0x26825d[_0xbb43('0x83')]][_0xbb43('0x48')]=_0x26825d['channel'];}};Preview['prototype'][_0xbb43('0x15')]=function(_0x59d31f){var _0x400c6e=this;var _0x26c450=this[_0xbb43('0x13')][_0x59d31f[_0xbb43('0x124')]];if(_0x26c450){if(_0x26c450[_0xbb43('0xe9')]&&this['agents'][_0x26c450[_0xbb43('0xe9')]]){ut[_0xbb43('0x125')](_0x26c450,this[_0xbb43('0x126')][_0x26c450[_0xbb43('0xe9')]][_0xbb43('0x2c')],this[_0xbb43('0x126')][_0x26c450['lookAgent']]['id']);}var _0x756278=_[_0xbb43('0x127')](_0x26c450);_0x756278[_0xbb43('0x8a')]=moment()[_0xbb43('0x1f')](_0xbb43('0x89'));var _0x4cd83a=_0x400c6e[_0xbb43('0x11')][_0x26c450[_0xbb43('0x3e')]];if(ut[_0xbb43('0x128')](_0x59d31f[_0xbb43('0x129')])){if(_0x26c450[_0xbb43('0x81')]){rpcDb[_0xbb43('0xfa')](_0x26c450[_0xbb43('0x86')]);}if(_0x26c450[_0xbb43('0x82')]){rpcDb[_0xbb43('0x5c')](_0x26c450['idContact']);}ami[_0xbb43('0x71')](_0xbb43('0x12a'),ut[_0xbb43('0x73')](_0x26c450,_0xbb43('0x12b'),this[_0xbb43('0x11')][_0x26c450[_0xbb43('0x3e')]]));this[_0xbb43('0xd8')](_0x756278,_0x4cd83a,_0x59d31f);}else{_0x26c450['starttime']=moment()[_0xbb43('0x1f')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0xbb43('0xdd')](_0x756278,0x4,'Answer');rpcDb[_0xbb43('0xdb')](_0x756278,_0xbb43('0x12c'));}}};Preview[_0xbb43('0xe')][_0xbb43('0x12d')]=function(_0x31d75c){var _0x570d24=this['actions'][_0x31d75c['linkedid']];var _0x1d4d0b;if(_0x570d24){_0x1d4d0b=this[_0xbb43('0x11')][_0x570d24['queue']];logger['info'](_0xbb43('0x12e'),_0x31d75c[_0xbb43('0x83')],_0xbb43('0x8e'),_0x1d4d0b[_0xbb43('0x2c')],_0xbb43('0x41'),_0x1d4d0b['pTalking']);}if(this[_0xbb43('0x13')][_0x31d75c[_0xbb43('0x83')]]&&_0x31d75c['linkedid']!==_0x31d75c['uniqueid']){if(_0x31d75c[_0xbb43('0x12f')]==='16'&&this[_0xbb43('0x13')][_0x31d75c[_0xbb43('0x83')]]['dialAnswer']){this[_0xbb43('0x6d')](_0x31d75c,_0x31d75c['linkedid'],_0x31d75c[_0xbb43('0x12f')]);}else if(this[_0xbb43('0x13')][_0x31d75c[_0xbb43('0x83')]][_0xbb43('0x4c')]){logger[_0xbb43('0x3b')]('[syncHangup][talking][cause]',_0x31d75c[_0xbb43('0x83')],_0x31d75c[_0xbb43('0x12f')],_0xbb43('0x8e'),_0x1d4d0b[_0xbb43('0x2c')],_0xbb43('0x41'),_0x1d4d0b['pTalking']);this[_0xbb43('0x6d')](_0x31d75c,_0x31d75c[_0xbb43('0x83')],_0x31d75c['cause']);}}else if(_0x570d24&&_['isNil'](_0x570d24[_0xbb43('0x130')])&&_0x1d4d0b[_0xbb43('0x131')]&&_0x31d75c['linkedid']===_0x31d75c['uniqueid']&&_[_0xbb43('0x3a')](_0x31d75c[_0xbb43('0xe1')])&&_0x31d75c[_0xbb43('0x12f')]==='16'&&_0x31d75c[_0xbb43('0x132')]==='6'&&_['isUndefined'](_0x570d24[_0xbb43('0x133')])){if(_0x570d24['unlockAgent']){rpcDb[_0xbb43('0xfa')](_0x570d24[_0xbb43('0x86')]);}if(_0x570d24[_0xbb43('0x82')]){rpcDb['disableContact'](_0x570d24[_0xbb43('0x86')]);}_0x31d75c[_0xbb43('0xe1')]='22';this[_0xbb43('0xd8')](_0x570d24,_0x1d4d0b,_0x31d75c);}else if(_0x570d24&&_0x570d24[_0xbb43('0x133')]){if(_0x31d75c[_0xbb43('0x12f')]==='16'&&this[_0xbb43('0x13')][_0x31d75c[_0xbb43('0x83')]]['dialAnswer']){logger[_0xbb43('0x3b')]('[syncHangup][talking][transfer]',_0x31d75c[_0xbb43('0x83')],_0x31d75c[_0xbb43('0x12f')],_0xbb43('0x8e'),_0x1d4d0b[_0xbb43('0x2c')],'pTalking:\x20',_0x1d4d0b[_0xbb43('0x8c')]);this[_0xbb43('0x6d')](_0x31d75c,_0x31d75c['linkedid'],_0x31d75c[_0xbb43('0x12f')]);}else if(this['actions'][_0x31d75c[_0xbb43('0x83')]][_0xbb43('0x4c')]){logger[_0xbb43('0x3b')]('[syncHangup][talking][cause]',_0x31d75c['linkedid'],_0x31d75c[_0xbb43('0x12f')],'\x20Queue',_0x1d4d0b[_0xbb43('0x2c')],'pTalking:\x20',_0x1d4d0b[_0xbb43('0x8c')]);this[_0xbb43('0x6d')](_0x31d75c,_0x31d75c[_0xbb43('0x83')],_0x31d75c[_0xbb43('0x12f')]);}}};Preview[_0xbb43('0xe')][_0xbb43('0x19')]=function(_0xa1e9ba){if(this[_0xbb43('0x13')][_0xa1e9ba['destlinkedid']]&&_0xa1e9ba[_0xbb43('0xd6')]!==_0xa1e9ba[_0xbb43('0x134')]){this[_0xbb43('0x6d')](_0xa1e9ba,_0xa1e9ba[_0xbb43('0xd6')],_0xa1e9ba['dialstatus']);}};Preview[_0xbb43('0xe')][_0xbb43('0x18')]=function(_0x3178f7){if(this[_0xbb43('0x13')][_0x3178f7[_0xbb43('0x83')]]&&_0x3178f7[_0xbb43('0x83')]!==_0x3178f7['uniqueid']&&!this['actions'][_0x3178f7['linkedid']][_0xbb43('0x4c')]){if(_0x3178f7['cause']==='1'){this[_0xbb43('0x6d')](_0x3178f7,_0x3178f7[_0xbb43('0x83')],_0x3178f7['cause']);}}};Preview[_0xbb43('0xe')][_0xbb43('0x135')]=function(_0xea8659,_0x157391,_0x2b60f0){if(this['actions'][_0xea8659]){if(_[_0xbb43('0x3a')](this[_0xbb43('0x13')][_0xea8659]['variables'])){this['actions'][_0xea8659][_0xbb43('0x11f')]={};}this['actions'][_0xea8659][_0xbb43('0x11f')][_0x157391]=_0x2b60f0;}};Preview[_0xbb43('0xe')]['syncVarSet']=function(_0x18a8d3){try{if(!_[_0xbb43('0x3a')](_0x18a8d3)){if(ut['filterKey'](_[_0xbb43('0x136')](_0x18a8d3['variable'])[0x0])){this['addVariable'](_0x18a8d3['uniqueid'],_['keys'](_0x18a8d3[_0xbb43('0x137')])[0x0],_0x18a8d3[_0xbb43('0x138')]);}}}catch(_0x21ba01){logger[_0xbb43('0x139')](_0xbb43('0x13a'),util[_0xbb43('0x13b')](_0x21ba01,{'showHidden':![],'depth':null}));}};Preview[_0xbb43('0xe')][_0xbb43('0x1c')]=function(_0x53b812){if(_0x53b812){if(this[_0xbb43('0x13')][_0x53b812[_0xbb43('0x13c')]]){this[_0xbb43('0x13')][_0x53b812[_0xbb43('0x13c')]][_0xbb43('0x133')]=!![];}}};Preview[_0xbb43('0xe')]['syncBlindTransfer']=function(_0x47c884){if(_0x47c884){if(this[_0xbb43('0x13')][_0x47c884[_0xbb43('0x13d')]]){this[_0xbb43('0x13')][_0x47c884['transfererlinkedid']][_0xbb43('0x133')]=!![];}}};module[_0xbb43('0x13e')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 76cb577..00e4472 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 _0xa1ac=['../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','catch','[createHistory]\x20','resolve','then','createHistory','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','rescheduleContact','active','countReScheduled','[countReScheduled]\x20','unlockContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','membername','context','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird'];(function(_0x2ea9fd,_0x45d80b){var _0x27d18e=function(_0x20a0c9){while(--_0x20a0c9){_0x2ea9fd['push'](_0x2ea9fd['shift']());}};_0x27d18e(++_0x45d80b);}(_0xa1ac,0x136));var _0xca1a=function(_0x4836db,_0xfcad08){_0x4836db=_0x4836db-0x0;var _0x25f52b=_0xa1ac[_0x4836db];return _0x25f52b;};'use strict';var util=require(_0xca1a('0x0'));var BPromise=require(_0xca1a('0x1'));var logger=require('../../../config/logger')('preview');var cmHopper=require(_0xca1a('0x2'));var cmHopperHistory=require(_0xca1a('0x3'));var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require(_0xca1a('0x4'));var voiceQueueReport=require(_0xca1a('0x5'));function loggerCatch(_0xa554f0){return function(_0x211ddc){logger[_0xca1a('0x6')](_0xa554f0,util[_0xca1a('0x7')](_0x211ddc,{'showHidden':![],'depth':null}));};}function create(_0x55f07b){return cmHopperHistory['createHistory'](_0x55f07b)[_0xca1a('0x8')](loggerCatch(_0xca1a('0x9')));}function createAgent(_0x383ea6){return BPromise[_0xca1a('0xa')]()[_0xca1a('0xb')](agentReportPreview[_0xca1a('0xc')](_0x383ea6))[_0xca1a('0x8')](loggerCatch(_0xca1a('0x9')));}function moveContact(_0x2f8a70){return cmHopper[_0xca1a('0xd')](_0x2f8a70,!![])[_0xca1a('0x8')](loggerCatch(_0xca1a('0xe')));}exports[_0xca1a('0xf')]=function(_0x4aaee7){return cmHopperBlack[_0xca1a('0xf')](_0x4aaee7)['catch'](loggerCatch(_0xca1a('0x10')));};exports[_0xca1a('0x11')]=function(_0x47aedb){return BPromise['resolve']()[_0xca1a('0xb')](cmHopper[_0xca1a('0x11')](_0x47aedb))[_0xca1a('0x8')](loggerCatch(_0xca1a('0x12')));};exports[_0xca1a('0xc')]=function(_0x13ef04,_0x1efd5c){create(_0x13ef04)[_0xca1a('0x8')](loggerCatch(_0x1efd5c));moveContact(_0x13ef04)[_0xca1a('0x8')](loggerCatch(_0x1efd5c));};exports[_0xca1a('0x13')]=function(_0x3ddc58,_0x4e69ed){createAgent(_0x3ddc58)['catch'](loggerCatch(_0x4e69ed));};exports[_0xca1a('0x14')]=function(_0x5b294e,_0x38f39a){create(_0x5b294e)[_0xca1a('0x8')](loggerCatch(_0x38f39a));};exports['createCustomerFinal']=function(_0x550f9c,_0x95878b){moveContact(_0x550f9c)[_0xca1a('0x8')](loggerCatch(_0x95878b));};exports[_0xca1a('0x15')]=function(_0x32864e,_0x4b235a,_0x39ce3d){if(_0x4b235a){_0x32864e['UserId']=null;}if(_0x39ce3d){_0x32864e[_0xca1a('0x16')]=![];}return cmHopper['rescheduleContact'](_0x32864e)[_0xca1a('0x8')](loggerCatch('[rescheduleContact]\x20'));};exports[_0xca1a('0x17')]=function(_0x203359){return cmHopper[_0xca1a('0x17')](_0x203359)['catch'](loggerCatch(_0xca1a('0x18')));};exports['unlockContact']=function(_0x7633fc){return cmHopper[_0xca1a('0x19')]({'UserId':null},_0x7633fc,0x1)['catch'](loggerCatch('[unlockContact]\x20'));};exports['disableContact']=function(_0x4972df){return cmHopper[_0xca1a('0x19')]({'active':![]},_0x4972df,0x1)[_0xca1a('0x8')](loggerCatch(_0xca1a('0x1a')));};exports[_0xca1a('0x1b')]=function(_0x510da5){var _0x3a036b={};_0x3a036b[_0xca1a('0x1c')]=_0x510da5[_0xca1a('0x1c')];_0x3a036b[_0xca1a('0x1d')]=_0x510da5['uniqueid'];_0x3a036b[_0xca1a('0x1e')]=_0x510da5['calleridnum'];_0x3a036b[_0xca1a('0x1f')]=_0x510da5[_0xca1a('0x1f')];_0x3a036b[_0xca1a('0x20')]=_0x510da5[_0xca1a('0x20')];_0x3a036b[_0xca1a('0x21')]=_0x510da5['answertime'];_0x3a036b['queuecallerleaveAt']=_0x510da5[_0xca1a('0x22')];_0x3a036b[_0xca1a('0x23')]=0x1;_0x3a036b[_0xca1a('0x24')]=_0x510da5[_0xca1a('0x25')];_0x3a036b['connectedlinename']=_0x510da5[_0xca1a('0x26')];_0x3a036b[_0xca1a('0x27')]='from-sip';_0x3a036b[_0xca1a('0x28')]=_0xca1a('0x29');_0x3a036b[_0xca1a('0x2a')]=0x0;_0x3a036b[_0xca1a('0x2b')]=0x1;_0x3a036b[_0xca1a('0x2c')]=_0x510da5[_0xca1a('0x26')];_0x3a036b[_0xca1a('0x2d')]=_0xca1a('0x2e');return BPromise[_0xca1a('0xa')]()['then'](voiceQueueReport[_0xca1a('0x2f')](_0x3a036b))['catch'](loggerCatch(_0xca1a('0x30')));};exports[_0xca1a('0x31')]=function(_0x244c17,_0x1b6f3c){return BPromise[_0xca1a('0xa')]()[_0xca1a('0xb')](cmHopper[_0xca1a('0x31')](_0x244c17,_0x1b6f3c))['catch'](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0xca1a('0x32')]=function(_0x8a588d){return cmHopper[_0xca1a('0x15')](_0x8a588d,!![],!![])[_0xca1a('0x8')](loggerCatch(_0xca1a('0x33')));}; \ No newline at end of file +var _0xf3ee=['../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','catch','[createHistory]\x20','then','createHistory','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','resolve','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','create','[voiceQueueReport]\x20','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','../rpc/cmHopper'];(function(_0x40d234,_0x3eb762){var _0xa6a455=function(_0x1c1321){while(--_0x1c1321){_0x40d234['push'](_0x40d234['shift']());}};_0xa6a455(++_0x3eb762);}(_0xf3ee,0x100));var _0xef3e=function(_0x557023,_0xe2ecfd){_0x557023=_0x557023-0x0;var _0x16c4f7=_0xf3ee[_0x557023];return _0x16c4f7;};'use strict';var util=require(_0xef3e('0x0'));var BPromise=require('bluebird');var logger=require(_0xef3e('0x1'))(_0xef3e('0x2'));var cmHopper=require(_0xef3e('0x3'));var cmHopperHistory=require(_0xef3e('0x4'));var cmHopperBlack=require(_0xef3e('0x5'));var agentReportPreview=require(_0xef3e('0x6'));var voiceQueueReport=require(_0xef3e('0x7'));function loggerCatch(_0x2024ff){return function(_0x4d1cc4){logger[_0xef3e('0x8')](_0x2024ff,util[_0xef3e('0x9')](_0x4d1cc4,{'showHidden':![],'depth':null}));};}function create(_0x36f6a2){return cmHopperHistory['createHistory'](_0x36f6a2)[_0xef3e('0xa')](loggerCatch(_0xef3e('0xb')));}function createAgent(_0x27e439){return BPromise['resolve']()[_0xef3e('0xc')](agentReportPreview[_0xef3e('0xd')](_0x27e439))[_0xef3e('0xa')](loggerCatch(_0xef3e('0xb')));}function moveContact(_0x6dab21){return cmHopper[_0xef3e('0xe')](_0x6dab21,!![])[_0xef3e('0xa')](loggerCatch(_0xef3e('0xf')));}exports[_0xef3e('0x10')]=function(_0x48c76b){return cmHopperBlack[_0xef3e('0x10')](_0x48c76b)[_0xef3e('0xa')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0xef3e('0x11')]=function(_0x56151b){return BPromise[_0xef3e('0x12')]()[_0xef3e('0xc')](cmHopper[_0xef3e('0x11')](_0x56151b))['catch'](loggerCatch(_0xef3e('0x13')));};exports[_0xef3e('0xd')]=function(_0x15d0f9,_0x769484){create(_0x15d0f9)[_0xef3e('0xa')](loggerCatch(_0x769484));moveContact(_0x15d0f9)['catch'](loggerCatch(_0x769484));};exports[_0xef3e('0x14')]=function(_0x10a54b,_0x3695e8){createAgent(_0x10a54b)[_0xef3e('0xa')](loggerCatch(_0x3695e8));};exports['createCustomerHistory']=function(_0x2cd55d,_0x417a6b){create(_0x2cd55d)[_0xef3e('0xa')](loggerCatch(_0x417a6b));};exports[_0xef3e('0x15')]=function(_0xe45dc9,_0x26f470){moveContact(_0xe45dc9)['catch'](loggerCatch(_0x26f470));};exports[_0xef3e('0x16')]=function(_0x172ab1,_0x1991cc,_0x1e3585){if(_0x1991cc){_0x172ab1['UserId']=null;}if(_0x1e3585){_0x172ab1[_0xef3e('0x17')]=![];}return cmHopper['rescheduleContact'](_0x172ab1)['catch'](loggerCatch(_0xef3e('0x18')));};exports[_0xef3e('0x19')]=function(_0x379b17){return cmHopper[_0xef3e('0x19')](_0x379b17)['catch'](loggerCatch(_0xef3e('0x1a')));};exports[_0xef3e('0x1b')]=function(_0x310f9c){return cmHopper[_0xef3e('0x1b')]({'UserId':null},_0x310f9c,0x1)[_0xef3e('0xa')](loggerCatch(_0xef3e('0x1c')));};exports['disableContact']=function(_0xcdbe3f){return cmHopper[_0xef3e('0x1b')]({'active':![]},_0xcdbe3f,0x1)['catch'](loggerCatch(_0xef3e('0x1d')));};exports[_0xef3e('0x1e')]=function(_0x221a0c){var _0x117ce5={};_0x117ce5[_0xef3e('0x1f')]=_0x221a0c[_0xef3e('0x1f')];_0x117ce5[_0xef3e('0x20')]=_0x221a0c['uniqueid'];_0x117ce5[_0xef3e('0x21')]=_0x221a0c[_0xef3e('0x21')];_0x117ce5[_0xef3e('0x22')]=_0x221a0c['calleridname'];_0x117ce5['queue']=_0x221a0c[_0xef3e('0x23')];_0x117ce5['queuecallerjoinAt']=_0x221a0c[_0xef3e('0x24')];_0x117ce5[_0xef3e('0x25')]=_0x221a0c[_0xef3e('0x24')];_0x117ce5[_0xef3e('0x26')]=0x1;_0x117ce5[_0xef3e('0x27')]=_0x221a0c[_0xef3e('0x28')];_0x117ce5[_0xef3e('0x29')]=_0x221a0c[_0xef3e('0x2a')];_0x117ce5[_0xef3e('0x2b')]='from-sip';_0x117ce5['exten']=_0xef3e('0x2c');_0x117ce5[_0xef3e('0x2d')]=0x0;_0x117ce5[_0xef3e('0x2e')]=0x1;_0x117ce5[_0xef3e('0x2f')]=_0x221a0c[_0xef3e('0x2a')];_0x117ce5[_0xef3e('0x30')]='COMPLETED';return BPromise[_0xef3e('0x12')]()[_0xef3e('0xc')](voiceQueueReport[_0xef3e('0x31')](_0x117ce5))[_0xef3e('0xa')](loggerCatch(_0xef3e('0x32')));};exports['getContactRecallMe']=function(_0x33503f,_0x13bc37){return BPromise[_0xef3e('0x12')]()['then'](cmHopper['getContactRecallMe'](_0x33503f,_0x13bc37))[_0xef3e('0xa')](loggerCatch('[GetContactRecallMe]\x20'));};exports['rescheduleContactInQueue']=function(_0x5c1960){return cmHopper['rescheduleContact'](_0x5c1960,!![],!![])[_0xef3e('0xa')](loggerCatch(_0xef3e('0x33')));}; \ 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 e20c807..7a92045 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 _0x3db9=['getDiff','milliseconds','createBody','CampaignId','idContact','type','campaigntype','dialAnswer','countglobal','callback','callbackuniqueid','callbackat','recallme','UserId','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqos','rtpaudioqosjitter','rtpaudioqoslossbridged','rtpaudioqosrttbridged','bridgepvtcallid','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','noanswer','variables','keys','forEach','buildNoAnswerEventPayload','util','lodash','../../../../config/logger','env','XCALLY_IP_AGI','127.0.0.1','loggerCatch','error','inspect','logger','info','loggerError','logger2','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','isActive','isNil','addVariables','name','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','createdAt','updatedAt','%s%s','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','membername','talktime','answertime','getSeconds','isFailure','Failure','variablesAction','RECALL','calleridname','uniqueid','originate','channelAgent','from-sip','timeout','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','cloneAction','clone','Global','active','scheduledat','minutes','ListId','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','agentReadyId','not_inuse','status','reachable','push'];(function(_0x51beba,_0x202d19){var _0x167ee0=function(_0x2d5b21){while(--_0x2d5b21){_0x51beba['push'](_0x51beba['shift']());}};_0x167ee0(++_0x202d19);}(_0x3db9,0x1eb));var _0x93db=function(_0x5c1fcd,_0x121471){_0x5c1fcd=_0x5c1fcd-0x0;var _0x4b1065=_0x3db9[_0x5c1fcd];return _0x4b1065;};'use strict';var util=require(_0x93db('0x0'));var _=require(_0x93db('0x1'));var moment=require('moment');var logger=require(_0x93db('0x2'))('preview');var ipAgi=process[_0x93db('0x3')][_0x93db('0x4')]||_0x93db('0x5');var utils=require('../../dialer/utils');exports[_0x93db('0x6')]=function(_0x59460b){return function(_0x5675ba){logger[_0x93db('0x7')](_0x59460b,util[_0x93db('0x8')](_0x5675ba,{'showHidden':![],'depth':null}));};};exports[_0x93db('0x9')]=function(_0x3879e3,_0x187419){logger[_0x93db('0xa')](_0x3879e3,util[_0x93db('0x8')](_0x187419,{'showHidden':![],'depth':null}));};exports[_0x93db('0xb')]=function(_0x33f9cc,_0x53f293){logger[_0x93db('0x7')](_0x33f9cc,util[_0x93db('0x8')](_0x53f293,{'showHidden':![],'depth':null}));};exports[_0x93db('0xc')]=function(_0x145097){return function(_0x358ff1){logger[_0x93db('0xa')](_0x145097,util[_0x93db('0x8')](_0x358ff1,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x5c1a3e,_0x565698,_0x289b05){return{'message':_0x5c1a3e,'unlock':_0x565698,'active':_0x289b05};};exports[_0x93db('0xd')]=function(_0x452059,_0x25d184,_0x493319){if(!_[_0x93db('0xe')](_0x493319)&&_0x93db('0xf')===typeof _0x493319&&!_[_0x93db('0x10')](_0x493319)){if(!_[_0x93db('0xe')](_0x25d184)&&_0x93db('0xf')===typeof _0x25d184&&!_[_0x93db('0x10')](_0x25d184)){return util['format'](_0x93db('0x11'),_0x25d184,_0x493319);}return util[_0x93db('0x12')](_0x93db('0x11'),_0x493319,_0x493319);}if(!_[_0x93db('0xe')](_0x452059)&&_0x93db('0xf')===typeof _0x452059&&!_[_0x93db('0x10')](_0x452059)){return _0x452059;}return _0x93db('0x13');};exports[_0x93db('0x14')]=function(_0x1347b3){if(_[_0x93db('0x15')](_0x1347b3)){return![];}return _0x1347b3;};exports[_0x93db('0x16')]=function(_0x1c1800,_0x515107,_0x14c224,_0x252c30,_0x5a767b,_0x53ef2b){var _0x48d317={'XMD-QUEUE':_0x515107['Queue']?_0x515107['Queue'][_0x93db('0x17')]:'','XMD-CALLERID':_0x252c30,'XMD-CALLERID-PREVIEW':_0x53ef2b?util[_0x93db('0x12')](_0x93db('0x11'),_0x53ef2b['calleridname'],_0x53ef2b[_0x93db('0x18')]):_0x252c30,'XMD-DIALID':_0x5a767b,'XMD-CONTACTID':_0x515107[_0x93db('0x19')],'XMD-CDRTYPE':_0x93db('0x1a'),'CALLERID(all)':_0x252c30,'XMD-VOICEQUEUEID':_0x515107[_0x93db('0x1b')],'XMD-DIALCHANNEL':_0x14c224,'XMD-DIALTIMEOUT':_0x1c1800[_0x93db('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0x93db('0x12')](_0x93db('0x1d'),_0x1c1800[_0x93db('0x1e')]?'g':'',_[_0x93db('0x10')](_0x1c1800[_0x93db('0x1f')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x1c1800[_0x93db('0x20')]||'','XMD-AGI':_0x1c1800['dialQueueProject']?util[_0x93db('0x12')](_0x93db('0x21'),ipAgi,_0x1c1800[_0x93db('0x22')]):_0x93db('0x23'),'XMD-AGIAFTER':_0x1c1800['dialQueueProject2']?util[_0x93db('0x12')](_0x93db('0x21'),ipAgi,_0x1c1800[_0x93db('0x1e')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x53ef2b?_0x53ef2b[_0x93db('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x53ef2b?_0x53ef2b[_0x93db('0x25')]:'','XMD-DESTINATION':_0x93db('0x26'),'SIPADDHEADER':_0x93db('0x27')};if(!_[_0x93db('0x10')](_0x1c1800[_0x93db('0x1f')])){_0x48d317[util[_0x93db('0x12')]('%s',_0x93db('0x28'))]=_0x1c1800[_0x93db('0x1f')];_0x48d317[util[_0x93db('0x12')]('%s',_0x93db('0x29'))]=_0x5a767b;}if(_0x515107&&_0x515107[_0x93db('0x2a')]){for(var _0x4d3560 in _0x515107[_0x93db('0x2a')]){if(_0x515107[_0x93db('0x2a')][_0x93db('0x2b')](_0x4d3560)){if(!_['isNil'](_0x515107[_0x93db('0x2a')][_0x4d3560])&&_0x4d3560!=='id'&&_0x4d3560!=='tags'&&_0x4d3560!==_0x93db('0x2c')&&_0x4d3560!==_0x93db('0x2d')){_0x48d317[util[_0x93db('0x12')](_0x93db('0x2e'),'XMD-',_['toUpper'](_0x4d3560))]=_0x515107[_0x93db('0x2a')][_0x4d3560];}}}}return _0x48d317;};exports['toLowerVariables']=function(_0x4b64a8){var _0x39d288={};for(var _0x5b7ccf in _0x4b64a8){if(_0x4b64a8[_0x93db('0x2b')](_0x5b7ccf)){_0x39d288[util[_0x93db('0x12')]('%s',_[_0x93db('0x2f')](_0x5b7ccf))]=_0x4b64a8[_0x5b7ccf];}}return{'variables':_0x39d288};};exports[_0x93db('0x30')]=function(_0x26a40,_0x374f47){if(!_['isNil'](_0x26a40)){if(_0x26a40[_0x93db('0x2b')](_0x93db('0x31'))){if(_0x26a40[_0x93db('0x31')]>0x0){_0x26a40[_0x93db('0x31')]-=0x1;}else{logger['error'](_0x93db('0x32'),_0x374f47);}}}else{logger['error'](_0x93db('0x33'),_0x374f47);}};exports[_0x93db('0x34')]=function(_0x42ab1f){var _0x2786bf=moment()[_0x93db('0x12')](_0x93db('0x35'));_0x42ab1f[_0x93db('0x36')]=0xd;_0x42ab1f[_0x93db('0x37')]=_0x93db('0x38');_0x42ab1f[_0x93db('0x39')]=_0x2786bf;_0x42ab1f[_0x93db('0x3a')]=_0x2786bf;_0x42ab1f[_0x93db('0x3b')]=_0x2786bf;};exports[_0x93db('0x3c')]=function(_0x3cc5c0,_0x10e4b1,_0x457502){var _0x156963=moment()[_0x93db('0x12')](_0x93db('0x35'));_0x3cc5c0[_0x93db('0x36')]=_0x10e4b1;_0x3cc5c0['statedesc']=_0x457502;_0x3cc5c0[_0x93db('0x3a')]=_0x156963;_0x3cc5c0[_0x93db('0x3d')]=utils['getSeconds'](_0x3cc5c0[_0x93db('0x3a')],_0x3cc5c0[_0x93db('0x39')]);};exports['logLookAgent']=function(_0x2fb2bd,_0x5ce573,_0x4a20f2){_0x2fb2bd[_0x93db('0x3e')]=_0x5ce573;_0x2fb2bd['UserId']=_0x4a20f2;};exports['logCustomer']=function(_0x582906,_0x4e308e,_0xff983){var _0x2e3e49=moment()[_0x93db('0x12')](_0x93db('0x35'));_0x582906[_0x93db('0x36')]=_0x4e308e;_0x582906['statedesc']=_0xff983;_0x582906[_0x93db('0x3a')]=_0x582906['responsetime']?_0x582906[_0x93db('0x3a')]:_0x2e3e49;_0x582906['endtime']=_0x582906[_0x93db('0x3b')]?_0x582906[_0x93db('0x3b')]:_0x2e3e49;_0x582906[_0x93db('0x3d')]=utils['getSeconds'](_0x582906['responsetime']||0x0,_0x582906[_0x93db('0x39')]||0x0);_0x582906[_0x93db('0x3f')]=_0x582906[_0x93db('0x40')]?utils[_0x93db('0x41')](_0x582906[_0x93db('0x3b')],_0x582906[_0x93db('0x40')]):0x0;};exports[_0x93db('0x42')]=function(_0x4fcbb8){return _0x4fcbb8===_0x93db('0x43');};exports[_0x93db('0x44')]=function(_0x5f552c,_0x2f257f,_0x2bed94,_0x155f6d,_0x3cd05d){var _0x3d8ac1=_0x155f6d?_0x93db('0x45'):_0x5f552c[_0x93db('0x46')];_0x3d8ac1=_0x3cd05d?'BOOKED':_0x3d8ac1;return{'actionid':_0x5f552c[_0x93db('0x47')],'action':_0x93db('0x48'),'channel':_0x5f552c[_0x93db('0x49')],'callerid':util[_0x93db('0x12')](_0x93db('0x11'),_0x3d8ac1,_0x5f552c[_0x93db('0x18')]),'Exten':_0x93db('0x26'),'Context':_0x93db('0x4a'),'Priority':'1','variable':_0x2bed94,'timeout':(_0x2f257f[_0x93db('0x4b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5f552c[_0x93db('0x47')]};};exports['totalGlobal']=function(_0x4450cb){return _0x4450cb[_0x93db('0x4c')]+_0x4450cb[_0x93db('0x4d')]+_0x4450cb[_0x93db('0x4e')]+_0x4450cb['countagentrejectretry']+_0x4450cb[_0x93db('0x4f')];};exports[_0x93db('0x50')]=function(_0x230a70){var _0x1c2bad=_[_0x93db('0x51')](_0x230a70);_0x1c2bad[_0x93db('0x36')]=0xf;_0x1c2bad['statedesc']=_0x93db('0x52');return _0x1c2bad;};exports['scheduledAt']=function(_0x19a704,_0x598c67,_0x30e60a){var _0x1e296c={};_0x1e296c[_0x598c67]=_0x19a704[_0x598c67];_0x1e296c[_0x93db('0x53')]=![];_0x1e296c[_0x93db('0x54')]=moment()['add'](_0x30e60a,_0x93db('0x55'))[_0x93db('0x12')](_0x93db('0x35'));_0x1e296c[_0x93db('0x19')]=_0x19a704[_0x93db('0x19')];_0x1e296c[_0x93db('0x56')]=_0x19a704[_0x93db('0x56')];_0x1e296c[_0x93db('0x1b')]=_0x19a704[_0x93db('0x1b')]||undefined;return _0x1e296c;};exports['decrementTalkink']=function(_0x548e5c,_0x1b9344){if(!_['isNil'](_0x548e5c)){if(_0x548e5c['pTalking']>0x0){_0x548e5c['pTalking']-=0x1;}else{logger[_0x93db('0x7')](_0x1b9344,_0x93db('0x57'));}}else{logger[_0x93db('0x7')](_0x1b9344,_0x93db('0x58'));}};exports[_0x93db('0x59')]=function(_0x5f1640){if(_0x5f1640<=0x0){return!![];}return![];};function buildObj(_0x39b1fe,_0x5b07e5,_0x1a0443){_0x39b1fe[_0x93db('0x5a')]=_0x5b07e5;_0x39b1fe[_0x93db('0x17')]=_0x39b1fe[_0x93db('0x5b')];_0x39b1fe[_0x93db('0x5c')]=_0x39b1fe['channelAgent'];_0x39b1fe[_0x93db('0x5d')]=_0x93db('0x5e');if(_0x1a0443){_0x39b1fe[_0x93db('0x5f')]=_0x1a0443['mandatoryDisposition'];}return _0x39b1fe;}exports['buildObj']=buildObj;exports['buildAcw']=function(_0x5c7d5d){var _0x1532be={};_0x1532be[_0x93db('0x5b')]=_0x5c7d5d['queue'];_0x1532be[_0x93db('0x5c')]=_0x5c7d5d[_0x93db('0x49')];_0x1532be['uniqueid']=_0x5c7d5d[_0x93db('0x47')];return _0x1532be;};exports[_0x93db('0x60')]=function(_0x52ffcb){var _0x48c7dd=[];for(var _0x181f26 in _0x52ffcb){if(_0x52ffcb[_0x93db('0x2b')](_0x181f26)){if(!_['isNil'](_0x52ffcb[_0x181f26])&&_0x52ffcb[_0x181f26][_0x93db('0x36')]===_0x93db('0x61')&&_0x52ffcb[_0x181f26][_0x93db('0x62')]===_0x93db('0x63')){_0x48c7dd[_0x93db('0x64')](_0x52ffcb[_0x181f26]['id']);}}}return _0x48c7dd;};exports[_0x93db('0x65')]=function(_0x133133){var _0x2bb998=moment()['milliseconds'](0x0);var _0x37fed7=moment(_0x133133)[_0x93db('0x66')](0x0);return _0x2bb998['diff'](_0x37fed7,'seconds');};exports[_0x93db('0x67')]=function(_0x33bb66){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x33bb66[_0x93db('0x19')],'ListId':_0x33bb66[_0x93db('0x56')],'VoiceQueueId':_0x33bb66[_0x93db('0x1b')]||undefined,'CampaignId':_0x33bb66[_0x93db('0x68')]||undefined};};exports['filterKey']=function(_0x492747){if(_0x492747==='uniqueid'||_0x492747===_0x93db('0x69')||_0x492747===_0x93db('0x5b')||_0x492747===_0x93db('0x6a')||_0x492747===_0x93db('0x6b')||_0x492747===_0x93db('0x6c')||_0x492747===_0x93db('0x3e')||_0x492747===_0x93db('0x49')||_0x492747===_0x93db('0x46')||_0x492747===_0x93db('0x53')||_0x492747===_0x93db('0x18')||_0x492747===_0x93db('0x54')||_0x492747===_0x93db('0x4c')||_0x492747===_0x93db('0x4d')||_0x492747==='countnoanswerretry'||_0x492747===_0x93db('0x6d')||_0x492747===_0x93db('0x6e')||_0x492747===_0x93db('0x6f')||_0x492747===_0x93db('0x70')||_0x492747===_0x93db('0x71')||_0x492747==='ContactId'||_0x492747===_0x93db('0x56')||_0x492747===_0x93db('0x72')||_0x492747==='VoiceQueueId'||_0x492747===_0x93db('0x73')||_0x492747===_0x93db('0x74')||_0x492747===_0x93db('0x75')||_0x492747===_0x93db('0x76')||_0x492747===_0x93db('0x77')||_0x492747==='xmd-dialurl'||_0x492747===_0x93db('0x78')||_0x492747===_0x93db('0x79')||_0x492747===_0x93db('0x7a')||_0x492747===_0x93db('0x7b')||_0x492747==='xmd-contactid'||_0x492747===_0x93db('0x7c')||_0x492747==='xmd-callerid'||_0x492747===_0x93db('0x7d')||_0x492747===_0x93db('0x7e')||_0x492747==='rtpaudioqos'||_0x492747===_0x93db('0x7f')||_0x492747==='rtpaudioqosjitter'||_0x492747===_0x93db('0x80')||_0x492747===_0x93db('0x81')||_0x492747==='rtpaudioqoslossbridged'||_0x492747===_0x93db('0x82')||_0x492747==='rtpaudioqosrttbridged'||_0x492747===_0x93db('0x83')||_0x492747==='rtpaudioqosbridged'||_0x492747===_0x93db('0x84')||_0x492747===_0x93db('0x80')||_0x492747===_0x93db('0x81')||_0x492747===_0x93db('0x85')||_0x492747==='rtpaudioqosrtt'||_0x492747===_0x93db('0x86')||_0x492747==='bridgepeer'||_0x492747===_0x93db('0x87')||_0x492747===_0x93db('0x36')||_0x492747==='statedesc'){return![];}return!![];};exports['getCallerIdRandom']=function(_0x35058a,_0x276f38){var _0x22e528,_0x3207c7,_0x4509ad;if(_0x276f38<=0x0){_0x276f38=0x1;}_0x22e528=new RegExp(_0x93db('0x88')+_0x276f38+'}$');_0x3207c7=Math[_0x93db('0x89')](0xa,_0x276f38-0x1);_0x4509ad=Math[_0x93db('0x89')](0xa,_0x276f38)-0x1;return util[_0x93db('0x12')]('%s',_[_0x93db('0x8a')](_0x35058a,_0x22e528,_[_0x93db('0x8b')](_0x3207c7,_0x4509ad)));};exports[_0x93db('0x8c')]=function(_0xa64290){var _0x1d61fc=_0xa64290[_0x93db('0x8d')](/"(.*?)"/);return _0x1d61fc?_0x1d61fc[0x1]:_0xa64290;};exports[_0x93db('0x8e')]=function(_0x37a76f){var _0x162780=_0x37a76f[_0x93db('0x8d')](/<(.*?)>/);return _0x162780?_0x162780[0x1]:_0x37a76f;};function buildNoAnswerEventPayload(_0x44d6db,_0x439813){var _0x4b4c16=buildObj(_0x44d6db,_0x93db('0x8f'));if(!_['isEmpty'](_0x439813[_0x93db('0x90')])){Object[_0x93db('0x91')](_0x439813[_0x93db('0x90')])[_0x93db('0x92')](function(_0x40167c){_0x4b4c16[_0x40167c['toLowerCase']()]=_0x439813['variables'][_0x40167c];});}return _0x4b4c16;}exports[_0x93db('0x93')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x8be9=['membername','UserId','answertime','Failure','variablesAction','BOOKED','uniqueid','originate','xcally-motion-preview','from-sip','timeout','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','active','scheduledat','add','minutes','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','lastevent','queue','interface','motionChannel','mandatoryDisposition','channelAgent','agentReadyId','not_inuse','status','reachable','getDiff','milliseconds','diff','seconds','createBody','CampaignId','filterKey','type','campaigntype','dialAnswer','calleridname','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrtt','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','replace','extractCalleridName','match','keys','variables','forEach','buildNoAnswerEventPayload','util','lodash','../../../../config/logger','preview','env','loggerCatch','error','logger','info','inspect','loggerError','logger2','message','isUndefined','isEmpty','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isNil','addVariables','Queue','name','calleridnum','ContactId','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','monitor_format','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','originatecalleridname','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','createdAt','updatedAt','%s%s','XMD-','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','statedesc','responsetime','endtime','logAgent','state','ringtime','getSeconds','starttime','logLookAgent'];(function(_0x4165bc,_0x12da20){var _0x30b5ed=function(_0x10041e){while(--_0x10041e){_0x4165bc['push'](_0x4165bc['shift']());}};_0x30b5ed(++_0x12da20);}(_0x8be9,0x166));var _0x98be=function(_0x117d8f,_0x181a06){_0x117d8f=_0x117d8f-0x0;var _0xe92622=_0x8be9[_0x117d8f];return _0xe92622;};'use strict';var util=require(_0x98be('0x0'));var _=require(_0x98be('0x1'));var moment=require('moment');var logger=require(_0x98be('0x2'))(_0x98be('0x3'));var ipAgi=process[_0x98be('0x4')]['XCALLY_IP_AGI']||'127.0.0.1';var utils=require('../../dialer/utils');exports[_0x98be('0x5')]=function(_0x15de7b){return function(_0x3966d3){logger[_0x98be('0x6')](_0x15de7b,util['inspect'](_0x3966d3,{'showHidden':![],'depth':null}));};};exports[_0x98be('0x7')]=function(_0x273a8c,_0x2c37d9){logger[_0x98be('0x8')](_0x273a8c,util[_0x98be('0x9')](_0x2c37d9,{'showHidden':![],'depth':null}));};exports[_0x98be('0xa')]=function(_0x52bc92,_0x62da75){logger[_0x98be('0x6')](_0x52bc92,util['inspect'](_0x62da75,{'showHidden':![],'depth':null}));};exports[_0x98be('0xb')]=function(_0x2f4744){return function(_0x49ba4c){logger[_0x98be('0x8')](_0x2f4744,util[_0x98be('0x9')](_0x49ba4c,{'showHidden':![],'depth':null}));};};exports[_0x98be('0xc')]=function(_0x24789d,_0xb0e07a,_0xb2b108){return{'message':_0x24789d,'unlock':_0xb0e07a,'active':_0xb2b108};};exports['getCallerId']=function(_0x4b800f,_0x37c28e,_0xb21163){if(!_[_0x98be('0xd')](_0xb21163)&&'string'===typeof _0xb21163&&!_[_0x98be('0xe')](_0xb21163)){if(!_[_0x98be('0xd')](_0x37c28e)&&_0x98be('0xf')===typeof _0x37c28e&&!_[_0x98be('0xe')](_0x37c28e)){return util[_0x98be('0x10')](_0x98be('0x11'),_0x37c28e,_0xb21163);}return util[_0x98be('0x10')](_0x98be('0x11'),_0xb21163,_0xb21163);}if(!_['isUndefined'](_0x4b800f)&&_0x98be('0xf')===typeof _0x4b800f&&!_[_0x98be('0xe')](_0x4b800f)){return _0x4b800f;}return _0x98be('0x12');};exports['isActive']=function(_0x29c8c0){if(_[_0x98be('0x13')](_0x29c8c0)){return![];}return _0x29c8c0;};exports[_0x98be('0x14')]=function(_0x408c43,_0x56a610,_0x179ce3,_0x5f3982,_0x523072,_0x5212db){var _0x34e4c5={'XMD-QUEUE':_0x56a610[_0x98be('0x15')]?_0x56a610['Queue'][_0x98be('0x16')]:'','XMD-CALLERID':_0x5f3982,'XMD-CALLERID-PREVIEW':_0x5212db?util[_0x98be('0x10')]('\x22%s\x22\x20<%s>',_0x5212db['calleridname'],_0x5212db[_0x98be('0x17')]):_0x5f3982,'XMD-DIALID':_0x523072,'XMD-CONTACTID':_0x56a610[_0x98be('0x18')],'XMD-CDRTYPE':_0x98be('0x19'),'CALLERID(all)':_0x5f3982,'XMD-VOICEQUEUEID':_0x56a610[_0x98be('0x1a')],'XMD-DIALCHANNEL':_0x179ce3,'XMD-DIALTIMEOUT':_0x408c43['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x98be('0x10')](_0x98be('0x1b'),_0x408c43['dialQueueProject2']?'g':'',_[_0x98be('0xe')](_0x408c43[_0x98be('0x1c')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x408c43[_0x98be('0x1d')]||'','XMD-AGI':_0x408c43[_0x98be('0x1e')]?util[_0x98be('0x10')](_0x98be('0x1f'),ipAgi,_0x408c43['dialQueueProject']):_0x98be('0x20'),'XMD-AGIAFTER':_0x408c43['dialQueueProject2']?util['format'](_0x98be('0x1f'),ipAgi,_0x408c43[_0x98be('0x21')]):_0x98be('0x20'),'XMD-ORIGINATECALLERIDNUM':_0x5212db?_0x5212db[_0x98be('0x22')]:'','XMD-ORIGINATECALLERIDNAME':_0x5212db?_0x5212db[_0x98be('0x23')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x98be('0x24')};if(!_[_0x98be('0xe')](_0x408c43[_0x98be('0x1c')])){_0x34e4c5[util[_0x98be('0x10')]('%s',_0x98be('0x25'))]=_0x408c43[_0x98be('0x1c')];_0x34e4c5[util[_0x98be('0x10')]('%s',_0x98be('0x26'))]=_0x523072;}if(_0x56a610&&_0x56a610[_0x98be('0x27')]){for(var _0x372461 in _0x56a610[_0x98be('0x27')]){if(_0x56a610['Contact'][_0x98be('0x28')](_0x372461)){if(!_[_0x98be('0x13')](_0x56a610[_0x98be('0x27')][_0x372461])&&_0x372461!=='id'&&_0x372461!=='tags'&&_0x372461!==_0x98be('0x29')&&_0x372461!==_0x98be('0x2a')){_0x34e4c5[util[_0x98be('0x10')](_0x98be('0x2b'),_0x98be('0x2c'),_['toUpper'](_0x372461))]=_0x56a610[_0x98be('0x27')][_0x372461];}}}}return _0x34e4c5;};exports[_0x98be('0x2d')]=function(_0x108fdd){var _0x33cf90={};for(var _0x2dd390 in _0x108fdd){if(_0x108fdd[_0x98be('0x28')](_0x2dd390)){_0x33cf90[util[_0x98be('0x10')]('%s',_[_0x98be('0x2e')](_0x2dd390))]=_0x108fdd[_0x2dd390];}}return{'variables':_0x33cf90};};exports[_0x98be('0x2f')]=function(_0x18ade0,_0xbf0e93){if(!_[_0x98be('0x13')](_0x18ade0)){if(_0x18ade0[_0x98be('0x28')](_0x98be('0x30'))){if(_0x18ade0[_0x98be('0x30')]>0x0){_0x18ade0[_0x98be('0x30')]-=0x1;}else{logger[_0x98be('0x6')](_0x98be('0x31'),_0xbf0e93);}}}else{logger[_0x98be('0x6')](_0x98be('0x32'),_0xbf0e93);}};exports[_0x98be('0x33')]=function(_0x5936aa){var _0x504406=moment()[_0x98be('0x10')](_0x98be('0x34'));_0x5936aa['state']=0xd;_0x5936aa[_0x98be('0x35')]='Blacklist';_0x5936aa['starttime']=_0x504406;_0x5936aa[_0x98be('0x36')]=_0x504406;_0x5936aa[_0x98be('0x37')]=_0x504406;};exports[_0x98be('0x38')]=function(_0x29582a,_0x326f47,_0x5428a7){var _0x4859e7=moment()[_0x98be('0x10')](_0x98be('0x34'));_0x29582a[_0x98be('0x39')]=_0x326f47;_0x29582a[_0x98be('0x35')]=_0x5428a7;_0x29582a[_0x98be('0x36')]=_0x4859e7;_0x29582a[_0x98be('0x3a')]=utils[_0x98be('0x3b')](_0x29582a[_0x98be('0x36')],_0x29582a[_0x98be('0x3c')]);};exports[_0x98be('0x3d')]=function(_0x1d0cdc,_0x472057,_0x1c98bc){_0x1d0cdc[_0x98be('0x3e')]=_0x472057;_0x1d0cdc[_0x98be('0x3f')]=_0x1c98bc;};exports['logCustomer']=function(_0xee6044,_0x327ab8,_0x39229f){var _0x3f33c8=moment()['format'](_0x98be('0x34'));_0xee6044[_0x98be('0x39')]=_0x327ab8;_0xee6044[_0x98be('0x35')]=_0x39229f;_0xee6044[_0x98be('0x36')]=_0xee6044[_0x98be('0x36')]?_0xee6044[_0x98be('0x36')]:_0x3f33c8;_0xee6044[_0x98be('0x37')]=_0xee6044[_0x98be('0x37')]?_0xee6044[_0x98be('0x37')]:_0x3f33c8;_0xee6044[_0x98be('0x3a')]=utils[_0x98be('0x3b')](_0xee6044[_0x98be('0x36')]||0x0,_0xee6044['starttime']||0x0);_0xee6044['talktime']=_0xee6044[_0x98be('0x40')]?utils['getSeconds'](_0xee6044[_0x98be('0x37')],_0xee6044[_0x98be('0x40')]):0x0;};exports['isFailure']=function(_0x14e07e){return _0x14e07e===_0x98be('0x41');};exports[_0x98be('0x42')]=function(_0x1b4e76,_0x181a0d,_0x514b7e,_0x59d4f8,_0x4ebd32){var _0x1f2702=_0x59d4f8?'RECALL':_0x1b4e76['calleridname'];_0x1f2702=_0x4ebd32?_0x98be('0x43'):_0x1f2702;return{'actionid':_0x1b4e76[_0x98be('0x44')],'action':_0x98be('0x45'),'channel':_0x1b4e76['channelAgent'],'callerid':util['format']('\x22%s\x22\x20<%s>',_0x1f2702,_0x1b4e76[_0x98be('0x17')]),'Exten':_0x98be('0x46'),'Context':_0x98be('0x47'),'Priority':'1','variable':_0x514b7e,'timeout':(_0x181a0d[_0x98be('0x48')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1b4e76[_0x98be('0x44')]};};exports['totalGlobal']=function(_0x53ccef){return _0x53ccef[_0x98be('0x49')]+_0x53ccef[_0x98be('0x4a')]+_0x53ccef[_0x98be('0x4b')]+_0x53ccef[_0x98be('0x4c')]+_0x53ccef[_0x98be('0x4d')];};exports[_0x98be('0x4e')]=function(_0x481534){var _0x46362f=_[_0x98be('0x4f')](_0x481534);_0x46362f[_0x98be('0x39')]=0xf;_0x46362f[_0x98be('0x35')]=_0x98be('0x50');return _0x46362f;};exports['scheduledAt']=function(_0x5970f7,_0x1bdf19,_0x1ec61a){var _0x433887={};_0x433887[_0x1bdf19]=_0x5970f7[_0x1bdf19];_0x433887[_0x98be('0x51')]=![];_0x433887[_0x98be('0x52')]=moment()[_0x98be('0x53')](_0x1ec61a,_0x98be('0x54'))[_0x98be('0x10')](_0x98be('0x34'));_0x433887['ContactId']=_0x5970f7['ContactId'];_0x433887[_0x98be('0x55')]=_0x5970f7[_0x98be('0x55')];_0x433887[_0x98be('0x1a')]=_0x5970f7[_0x98be('0x1a')]||undefined;return _0x433887;};exports['decrementTalkink']=function(_0x21c851,_0x1d9eed){if(!_[_0x98be('0x13')](_0x21c851)){if(_0x21c851[_0x98be('0x56')]>0x0){_0x21c851['pTalking']-=0x1;}else{logger[_0x98be('0x6')](_0x1d9eed,_0x98be('0x57'));}}else{logger[_0x98be('0x6')](_0x1d9eed,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x98be('0x58')]=function(_0x1c85fb){if(_0x1c85fb<=0x0){return!![];}return![];};function buildObj(_0x1a556a,_0x22a83e,_0x4845ed){_0x1a556a[_0x98be('0x59')]=_0x22a83e;_0x1a556a['name']=_0x1a556a[_0x98be('0x5a')];_0x1a556a[_0x98be('0x5b')]=_0x1a556a['channelAgent'];_0x1a556a[_0x98be('0x5c')]='voice';if(_0x4845ed){_0x1a556a['mandatoryDisposition']=_0x4845ed[_0x98be('0x5d')];}return _0x1a556a;}exports['buildObj']=buildObj;exports['buildAcw']=function(_0x369ca2){var _0x1c4c1a={};_0x1c4c1a[_0x98be('0x5a')]=_0x369ca2[_0x98be('0x5a')];_0x1c4c1a['interface']=_0x369ca2[_0x98be('0x5e')];_0x1c4c1a['uniqueid']=_0x369ca2[_0x98be('0x44')];return _0x1c4c1a;};exports[_0x98be('0x5f')]=function(_0x50b40c){var _0x19d741=[];for(var _0x56c3eb in _0x50b40c){if(_0x50b40c[_0x98be('0x28')](_0x56c3eb)){if(!_[_0x98be('0x13')](_0x50b40c[_0x56c3eb])&&_0x50b40c[_0x56c3eb][_0x98be('0x39')]===_0x98be('0x60')&&_0x50b40c[_0x56c3eb][_0x98be('0x61')]===_0x98be('0x62')){_0x19d741['push'](_0x50b40c[_0x56c3eb]['id']);}}}return _0x19d741;};exports[_0x98be('0x63')]=function(_0x42d5f3){var _0x20b2c0=moment()[_0x98be('0x64')](0x0);var _0x4a82e5=moment(_0x42d5f3)['milliseconds'](0x0);return _0x20b2c0[_0x98be('0x65')](_0x4a82e5,_0x98be('0x66'));};exports[_0x98be('0x67')]=function(_0x45af35){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x45af35[_0x98be('0x18')],'ListId':_0x45af35['ListId'],'VoiceQueueId':_0x45af35['VoiceQueueId']||undefined,'CampaignId':_0x45af35[_0x98be('0x68')]||undefined};};exports[_0x98be('0x69')]=function(_0x432f4a){if(_0x432f4a===_0x98be('0x44')||_0x432f4a==='idContact'||_0x432f4a==='queue'||_0x432f4a===_0x98be('0x6a')||_0x432f4a===_0x98be('0x6b')||_0x432f4a===_0x98be('0x6c')||_0x432f4a===_0x98be('0x3e')||_0x432f4a==='channelAgent'||_0x432f4a===_0x98be('0x6d')||_0x432f4a==='active'||_0x432f4a===_0x98be('0x17')||_0x432f4a===_0x98be('0x52')||_0x432f4a===_0x98be('0x49')||_0x432f4a===_0x98be('0x4a')||_0x432f4a==='countnoanswerretry'||_0x432f4a===_0x98be('0x6e')||_0x432f4a===_0x98be('0x6f')||_0x432f4a===_0x98be('0x70')||_0x432f4a===_0x98be('0x71')||_0x432f4a===_0x98be('0x72')||_0x432f4a===_0x98be('0x18')||_0x432f4a===_0x98be('0x55')||_0x432f4a===_0x98be('0x3f')||_0x432f4a===_0x98be('0x1a')||_0x432f4a===_0x98be('0x73')||_0x432f4a==='xmd-voicequeueid'||_0x432f4a==='xmd-queue'||_0x432f4a===_0x98be('0x74')||_0x432f4a==='xmd-listid'||_0x432f4a===_0x98be('0x75')||_0x432f4a===_0x98be('0x76')||_0x432f4a===_0x98be('0x77')||_0x432f4a===_0x98be('0x78')||_0x432f4a==='xmd-dialchannel'||_0x432f4a==='xmd-contactid'||_0x432f4a==='xmd-cdrtype'||_0x432f4a==='xmd-callerid'||_0x432f4a===_0x98be('0x79')||_0x432f4a==='xmd-agi'||_0x432f4a===_0x98be('0x7a')||_0x432f4a===_0x98be('0x7b')||_0x432f4a==='rtpaudioqosjitter'||_0x432f4a===_0x98be('0x7c')||_0x432f4a==='rtpaudioqosloss'||_0x432f4a===_0x98be('0x7d')||_0x432f4a==='rtpaudioqosrtt'||_0x432f4a==='rtpaudioqosrttbridged'||_0x432f4a===_0x98be('0x7a')||_0x432f4a===_0x98be('0x7b')||_0x432f4a===_0x98be('0x7e')||_0x432f4a===_0x98be('0x7c')||_0x432f4a===_0x98be('0x7f')||_0x432f4a===_0x98be('0x7d')||_0x432f4a===_0x98be('0x80')||_0x432f4a==='rtpaudioqosrttbridged'||_0x432f4a===_0x98be('0x81')||_0x432f4a===_0x98be('0x82')||_0x432f4a===_0x98be('0x39')||_0x432f4a===_0x98be('0x35')){return![];}return!![];};exports[_0x98be('0x83')]=function(_0xa91ad4,_0x9680ae){var _0x383983,_0x2fa764,_0x4129c6;if(_0x9680ae<=0x0){_0x9680ae=0x1;}_0x383983=new RegExp(_0x98be('0x84')+_0x9680ae+'}$');_0x2fa764=Math['pow'](0xa,_0x9680ae-0x1);_0x4129c6=Math['pow'](0xa,_0x9680ae)-0x1;return util[_0x98be('0x10')]('%s',_[_0x98be('0x85')](_0xa91ad4,_0x383983,_['random'](_0x2fa764,_0x4129c6)));};exports[_0x98be('0x86')]=function(_0x5105aa){var _0x2d4c56=_0x5105aa[_0x98be('0x87')](/"(.*?)"/);return _0x2d4c56?_0x2d4c56[0x1]:_0x5105aa;};exports['extractCalleridNumber']=function(_0x1e4f8e){var _0x5514d5=_0x1e4f8e[_0x98be('0x87')](/<(.*?)>/);return _0x5514d5?_0x5514d5[0x1]:_0x1e4f8e;};function buildNoAnswerEventPayload(_0x3b58e8,_0x37571f){var _0x2bd13c=buildObj(_0x3b58e8,'noanswer');if(!_[_0x98be('0xe')](_0x37571f['variables'])){Object[_0x98be('0x88')](_0x37571f[_0x98be('0x89')])[_0x98be('0x8a')](function(_0x26ecda){_0x2bd13c[_0x26ecda['toLowerCase']()]=_0x37571f[_0x98be('0x89')][_0x26ecda];});}return _0x2bd13c;}exports[_0x98be('0x8b')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 21dc843..0100b31 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 _0xbff0=['queuepause','voicechannel','voicequeuechannelhangup','queueadd','string','number','boolean','queueremove'];(function(_0x17df18,_0x5825d6){var _0x8b9727=function(_0x37187d){while(--_0x37187d){_0x17df18['push'](_0x17df18['shift']());}};_0x8b9727(++_0x5825d6);}(_0xbff0,0xdb));var _0x0bff=function(_0x4696db,_0x119f94){_0x4696db=_0x4696db-0x0;var _0x10a7e0=_0xbff0[_0x4696db];return _0x10a7e0;};'use strict';exports[_0x0bff('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x0bff('0x1'),'required':!![]},'membername':{'type':_0x0bff('0x1'),'required':!![]},'penalty':{'type':_0x0bff('0x2'),'required':![]},'paused':{'type':_0x0bff('0x3'),'required':![]}};exports[_0x0bff('0x4')]={'queue':{'type':_0x0bff('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0x0bff('0x5')]={'interface':{'type':_0x0bff('0x1'),'required':!![]},'paused':{'type':_0x0bff('0x3')},'reason':{'type':_0x0bff('0x1'),'required':![]}};exports['reload']={'module':{'type':_0x0bff('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x0bff('0x1'),'required':!![]}};exports[_0x0bff('0x6')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x0bff('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0x0bff('0x1')}};exports[_0x0bff('0x7')]={'uniqueid':{'type':_0x0bff('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0xa93d=['queueremove','voicequeuechannel','voicequeuechannelredirect','queueadd','string','number'];(function(_0x57d1b2,_0x9ca526){var _0x5803a6=function(_0x37395f){while(--_0x37395f){_0x57d1b2['push'](_0x57d1b2['shift']());}};_0x5803a6(++_0x9ca526);}(_0xa93d,0x1b3));var _0xda93=function(_0x1d33ea,_0x236c84){_0x1d33ea=_0x1d33ea-0x0;var _0x44eb8e=_0xa93d[_0x1d33ea];return _0x44eb8e;};'use strict';exports[_0xda93('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0xda93('0x1'),'required':!![]},'penalty':{'type':_0xda93('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xda93('0x3')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xda93('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':_0xda93('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0xda93('0x1'),'required':![]}};exports['reload']={'module':{'type':_0xda93('0x1'),'required':![]}};exports[_0xda93('0x4')]={'uniqueid':{'type':_0xda93('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0xda93('0x1'),'required':!![]},'filename':{'type':_0xda93('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xda93('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0xda93('0x1'),'required':!![]}};exports[_0xda93('0x5')]={'uniqueid':{'type':_0xda93('0x1'),'required':!![]},'exten':{'type':_0xda93('0x1'),'required':!![]},'context':{'type':_0xda93('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 2b642de..23b13c4 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 _0xb10b=['../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','triggers','campaigns','templates','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','SIP/%s','name','interface','format','total','answered','sumHoldTime','sumDuration','ivrTotalCallsDays','isEmpty','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isNil','isUndefined','initTelephones','trunks','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initVoiceQueueHopperHistory','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','outbound','duration','billableseconds','initCampaigns','dialQueueProject','initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','lodash','util','../model/agent','../model/telephone','../model/voiceQueue','../model/trigger','../model/template','../model/campaign'];(function(_0x209748,_0x5bc8dd){var _0x472943=function(_0x553858){while(--_0x553858){_0x209748['push'](_0x209748['shift']());}};_0x472943(++_0x5bc8dd);}(_0xb10b,0x12a));var _0xbb10=function(_0x47195e,_0x347734){_0x47195e=_0x47195e-0x0;var _0x571abb=_0xb10b[_0x47195e];return _0x571abb;};'use strict';var _=require(_0xbb10('0x0'));var moment=require('moment');var util=require(_0xbb10('0x1'));var Agent=require(_0xbb10('0x2'));var Telephone=require(_0xbb10('0x3'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0xbb10('0x4'));var Trigger=require(_0xbb10('0x5'));var Template=require(_0xbb10('0x6'));var Campaign=require(_0xbb10('0x7'));var VoiceExtension=require(_0xbb10('0x8'));var ZendeskAccount=require(_0xbb10('0x9'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xbb10('0xa'));var SugarcrmAccount=require(_0xbb10('0xb'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xbb10('0xc'));var VtigerAccount=require(_0xbb10('0xd'));var ServicenowAccount=require(_0xbb10('0xe'));var Dynamics365Account=require(_0xbb10('0xf'));var FreshsalesAccount=require(_0xbb10('0x10'));var FaxAccount=require(_0xbb10('0x11'));function Realtime(){this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['trunks']={};this['voiceQueues']={};this[_0xbb10('0x14')]={};this[_0xbb10('0x15')]={};this[_0xbb10('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xbb10('0x17')]={};this['channels']={};this[_0xbb10('0x18')]={};this[_0xbb10('0x19')]={};this[_0xbb10('0x1a')]={};this[_0xbb10('0x1b')]={};this[_0xbb10('0x1c')]={};this[_0xbb10('0x1d')]={};this['sugarcrmAccounts']={};this[_0xbb10('0x1e')]={};this[_0xbb10('0x1f')]={};this[_0xbb10('0x20')]={};this[_0xbb10('0x21')]={};this[_0xbb10('0x22')]={};this[_0xbb10('0x23')]={};this[_0xbb10('0x24')]={};this[_0xbb10('0x25')]={};}function freeIsNotKey(_0x3e26f4,_0x2b184e,_0x4a2bfc){var _0x2eca0f=_[_0xbb10('0x26')](_0x3e26f4,function(_0x133ac2){return _0x133ac2[_0x4a2bfc];});for(var _0x42db98 in _0x2b184e){if(_0x2b184e[_0xbb10('0x27')](_0x42db98)){if(!_0x2eca0f[_0x42db98]){delete _0x2b184e[_0x42db98];}}}}function freeIsNotKeySip(_0x1682a4,_0x575cca){var _0x30efc6=_[_0xbb10('0x26')](_0x1682a4,function(_0xe1c665){return util['format'](_0xbb10('0x28'),_0xe1c665[_0xbb10('0x29')]);});for(var _0x388fab in _0x575cca){if(_0x575cca[_0xbb10('0x27')](_0x388fab)){if(!_0x30efc6[_0x388fab]){delete _0x575cca[_0x388fab];}}}}function freeIsNotKeyAgent(_0xdf237d,_0x44e563){var _0x4deb49=_[_0xbb10('0x26')](_0xdf237d,function(_0x12ef77){var _0x50aea1=_['isNil'](_0x12ef77[_0xbb10('0x2a')])?util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x12ef77[_0xbb10('0x29')]):_0x12ef77[_0xbb10('0x2a')];return _0x50aea1;});for(var _0x1824b7 in _0x44e563){if(_0x44e563[_0xbb10('0x27')](_0x1824b7)){if(!_0x4deb49[_0x1824b7]){delete _0x44e563[_0x1824b7];}}}}function clearVoiceCallReports(_0x436104){_0x436104[_0xbb10('0x2c')]=0x0;_0x436104[_0xbb10('0x2d')]=0x0;_0x436104[_0xbb10('0x2e')]=0x0;_0x436104[_0xbb10('0x2f')]=0x0;_0x436104['sumBillable']=0x0;}function clearCampaigns(_0x4fedac){if(!_['isEmpty'](_0x4fedac)){for(var _0xc93a04 in _0x4fedac){if(_0x4fedac[_0xbb10('0x27')](_0xc93a04)){_0x4fedac[_0xc93a04][_0xbb10('0x30')]=0x0;_0x4fedac[_0xc93a04]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x2fdde9){if(!_[_0xbb10('0x31')](_0x2fdde9)){for(var _0x6ed43b in _0x2fdde9){if(_0x2fdde9[_0xbb10('0x27')](_0x6ed43b)){_0x2fdde9[_0x6ed43b][_0xbb10('0x2c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2d')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x32')]=0x0;_0x2fdde9[_0x6ed43b]['abandoned']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2e')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2f')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x33')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x34')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x35')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x36')]=0x0;_0x2fdde9[_0x6ed43b]['outboundCongestionCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x37')]=0x0;_0x2fdde9[_0x6ed43b]['outboundUnknownCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x38')]=0x0;_0x2fdde9[_0x6ed43b]['outboundDropCallsDayCallersExit']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x39')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3a')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3b')]=0x0;_0x2fdde9[_0x6ed43b]['outboundReCallsDay']=0x0;_0x2fdde9[_0x6ed43b]['outboundAnswerAgiCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3d')]=!![];}}}}Realtime['prototype'][_0xbb10('0x3e')]=function(_0x37dde7,_0x2f653f){for(var _0x1c0b57 in _0x2f653f){if(_0x37dde7[_0xbb10('0x27')](_0x1c0b57)){_0x37dde7[_0x1c0b57]=_0x2f653f[_0x1c0b57];}}};Realtime[_0xbb10('0x3f')][_0xbb10('0x40')]=function(){var _0x4975f5=this;return function(_0x25acb3){if(_0x25acb3){freeIsNotKeyAgent(_0x25acb3,_0x4975f5[_0xbb10('0x12')]);for(var _0x441d15=0x0,_0x8c1ce6={};_0x441d15<_0x25acb3[_0xbb10('0x41')];_0x441d15+=0x1){_0x8c1ce6=_0x25acb3[_0x441d15];var _0x9de708=_[_0xbb10('0x42')](_0x8c1ce6[_0xbb10('0x2a')])?util[_0xbb10('0x2b')]('SIP/%s',_0x8c1ce6[_0xbb10('0x29')]):_0x8c1ce6[_0xbb10('0x2a')];if(_[_0xbb10('0x43')](_0x4975f5[_0xbb10('0x12')][_0x9de708])){_0x4975f5['agents'][_0x9de708]=new Agent(_0x8c1ce6);}else{_0x4975f5[_0xbb10('0x3e')](_0x4975f5['agents'][_0x9de708],_0x8c1ce6);}}}return _0x4975f5['agents'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x44')]=function(){var _0x26e76a=this;return function(_0x120d21){if(_0x120d21){freeIsNotKeySip(_0x120d21,_0x26e76a[_0xbb10('0x13')]);for(var _0x29d11a=0x0,_0x547062={};_0x29d11a<_0x120d21[_0xbb10('0x41')];_0x29d11a+=0x1){_0x547062=_0x120d21[_0x29d11a];if(_[_0xbb10('0x43')](_0x26e76a['telephones'][util['format']('SIP/%s',_0x547062[_0xbb10('0x29')])])){_0x26e76a[_0xbb10('0x13')][util[_0xbb10('0x2b')]('SIP/%s',_0x547062[_0xbb10('0x29')])]=new Telephone(_0x547062);}else{_0x26e76a[_0xbb10('0x3e')](_0x26e76a[_0xbb10('0x13')][util['format'](_0xbb10('0x28'),_0x547062[_0xbb10('0x29')])],_0x547062);}}}return _0x26e76a[_0xbb10('0x13')];};};Realtime[_0xbb10('0x3f')]['initTrunks']=function(){var _0xd238e9=this;return function(_0x110eb5){if(_0x110eb5){freeIsNotKeySip(_0x110eb5,_0xd238e9['trunks']);for(var _0xe2040f=0x0,_0x2e3214={};_0xe2040f<_0x110eb5[_0xbb10('0x41')];_0xe2040f+=0x1){_0x2e3214=_0x110eb5[_0xe2040f];if(_[_0xbb10('0x43')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')]('SIP/%s',_0x2e3214[_0xbb10('0x29')])])){_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])]=new Trunk(_0x2e3214);}else{_0xd238e9[_0xbb10('0x3e')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])],_0x2e3214);}}}return _0xd238e9[_0xbb10('0x45')];};};Realtime[_0xbb10('0x3f')]['initTriggers']=function(){var _0x5d9a4f=this;return function(_0x38d78f){if(_0x38d78f){freeIsNotKey(_0x38d78f,_0x5d9a4f['triggers'],'id');for(var _0x318984=0x0,_0x180933={};_0x318984<_0x38d78f['length'];_0x318984+=0x1){_0x180933=_0x38d78f[_0x318984];if(_[_0xbb10('0x43')](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']])){_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']]=new Trigger(_0x180933);}else{_0x5d9a4f['mergeFromDatabase'](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']],_0x180933);}}}return _0x5d9a4f[_0xbb10('0x14')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x46')]=function(){var _0x36e1fa=this;return function(_0x19f94d){if(_0x19f94d){freeIsNotKey(_0x19f94d,_0x36e1fa[_0xbb10('0x16')],'id');for(var _0x3efa96=0x0,_0x205bb4={};_0x3efa96<_0x19f94d[_0xbb10('0x41')];_0x3efa96+=0x1){_0x205bb4=_0x19f94d[_0x3efa96];if(_[_0xbb10('0x43')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']])){_0x36e1fa['templates'][_0x205bb4['id']]=new Template(_0x205bb4);}else{_0x36e1fa[_0xbb10('0x3e')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']],_0x205bb4);}}}return _0x36e1fa['templates'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x47')]=function(){var _0x1a7df6=this;return function(_0x5a5226){if(_0x5a5226){freeIsNotKey(_0x5a5226,_0x1a7df6[_0xbb10('0x1c')],'id');for(var _0x39f0de=0x0,_0x3e06b0={};_0x39f0de<_0x5a5226['length'];_0x39f0de+=0x1){_0x3e06b0=_0x5a5226[_0x39f0de];if(_['isUndefined'](_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']])){_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']]=new ZendeskAccount(_0x3e06b0);}else{_0x1a7df6[_0xbb10('0x3e')](_0x1a7df6['zendeskAccounts'][_0x3e06b0['id']],_0x3e06b0);}}}return _0x1a7df6['zendeskAccounts'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x48')]=function(){var _0x1bd054=this;return function(_0xf820fe){if(_0xf820fe){freeIsNotKey(_0xf820fe,_0x1bd054[_0xbb10('0x1d')],'id');for(var _0x22b315=0x0,_0x2f2552={};_0x22b315<_0xf820fe[_0xbb10('0x41')];_0x22b315+=0x1){_0x2f2552=_0xf820fe[_0x22b315];if(_[_0xbb10('0x43')](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']])){_0x1bd054['salesforceAccounts'][_0x2f2552['id']]=new SalesforceAccount(_0x2f2552);}else{_0x1bd054['mergeFromDatabase'](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']],_0x2f2552);}}}return _0x1bd054[_0xbb10('0x1d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x49')]=function(){var _0x36aa7d=this;return function(_0x440f9e){if(_0x440f9e){freeIsNotKey(_0x440f9e,_0x36aa7d[_0xbb10('0x1e')],'id');for(var _0x445870=0x0,_0x1c0d8f={};_0x445870<_0x440f9e[_0xbb10('0x41')];_0x445870+=0x1){_0x1c0d8f=_0x440f9e[_0x445870];if(_[_0xbb10('0x43')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']])){_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']]=new FreshdeskAccount(_0x1c0d8f);}else{_0x36aa7d[_0xbb10('0x3e')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']],_0x1c0d8f);}}}return _0x36aa7d['freshdeskAccounts'];};};Realtime[_0xbb10('0x3f')]['initZohoAccounts']=function(){var _0x33d60a=this;return function(_0x2e21a0){if(_0x2e21a0){freeIsNotKey(_0x2e21a0,_0x33d60a[_0xbb10('0x1f')],'id');for(var _0x3f27ce=0x0,_0x26e66e={};_0x3f27ce<_0x2e21a0[_0xbb10('0x41')];_0x3f27ce+=0x1){_0x26e66e=_0x2e21a0[_0x3f27ce];if(_[_0xbb10('0x43')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']])){_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']]=new ZohoAccount(_0x26e66e);}else{_0x33d60a[_0xbb10('0x3e')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']],_0x26e66e);}}}return _0x33d60a[_0xbb10('0x1f')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4a')]=function(){var _0x4475e1=this;return function(_0x5de0cc){if(_0x5de0cc){freeIsNotKey(_0x5de0cc,_0x4475e1[_0xbb10('0x20')],'id');for(var _0x466eb7=0x0,_0x1b83a9={};_0x466eb7<_0x5de0cc[_0xbb10('0x41')];_0x466eb7+=0x1){_0x1b83a9=_0x5de0cc[_0x466eb7];if(_[_0xbb10('0x43')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']])){_0x4475e1['deskAccounts'][_0x1b83a9['id']]=new DeskAccount(_0x1b83a9);}else{_0x4475e1[_0xbb10('0x3e')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']],_0x1b83a9);}}}return _0x4475e1[_0xbb10('0x20')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4b')]=function(){var _0x22de7f=this;return function(_0x175872){if(_0x175872){freeIsNotKey(_0x175872,_0x22de7f[_0xbb10('0x4c')],'id');for(var _0x205e01=0x0,_0x40c4fb={};_0x205e01<_0x175872[_0xbb10('0x41')];_0x205e01+=0x1){_0x40c4fb=_0x175872[_0x205e01];if(_[_0xbb10('0x43')](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']])){_0x22de7f['sugarcrmAccounts'][_0x40c4fb['id']]=new SugarcrmAccount(_0x40c4fb);}else{_0x22de7f['mergeFromDatabase'](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']],_0x40c4fb);}}}return _0x22de7f[_0xbb10('0x4c')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4d')]=function(){var _0x5573bb=this;return function(_0x506498){if(_0x506498){freeIsNotKey(_0x506498,_0x5573bb[_0xbb10('0x21')],'id');for(var _0xaf2cc3=0x0,_0x410bef={};_0xaf2cc3<_0x506498[_0xbb10('0x41')];_0xaf2cc3+=0x1){_0x410bef=_0x506498[_0xaf2cc3];if(_[_0xbb10('0x43')](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']])){_0x5573bb[_0xbb10('0x21')][_0x410bef['id']]=new VtigerAccount(_0x410bef);}else{_0x5573bb['mergeFromDatabase'](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']],_0x410bef);}}}return _0x5573bb[_0xbb10('0x21')];};};Realtime['prototype']['initServicenowAccounts']=function(){var _0x5a231f=this;return function(_0x32c1e8){if(_0x32c1e8){freeIsNotKey(_0x32c1e8,_0x5a231f[_0xbb10('0x22')],'id');for(var _0x155dc5=0x0,_0x5bd1c0={};_0x155dc5<_0x32c1e8['length'];_0x155dc5+=0x1){_0x5bd1c0=_0x32c1e8[_0x155dc5];if(_['isUndefined'](_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']])){_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']]=new ServicenowAccount(_0x5bd1c0);}else{_0x5a231f[_0xbb10('0x3e')](_0x5a231f['servicenowAccounts'][_0x5bd1c0['id']],_0x5bd1c0);}}}return _0x5a231f[_0xbb10('0x22')];};};Realtime[_0xbb10('0x3f')]['initDynamics365Accounts']=function(){var _0x4a560c=this;return function(_0x27d7b9){if(_0x27d7b9){freeIsNotKey(_0x27d7b9,_0x4a560c[_0xbb10('0x23')],'id');for(var _0xd77753=0x0,_0x237246={};_0xd77753<_0x27d7b9['length'];_0xd77753+=0x1){_0x237246=_0x27d7b9[_0xd77753];if(_[_0xbb10('0x43')](_0x4a560c[_0xbb10('0x23')][_0x237246['id']])){_0x4a560c[_0xbb10('0x23')][_0x237246['id']]=new Dynamics365Account(_0x237246);}else{_0x4a560c['mergeFromDatabase'](_0x4a560c[_0xbb10('0x23')][_0x237246['id']],_0x237246);}}}return _0x4a560c[_0xbb10('0x23')];};};Realtime[_0xbb10('0x3f')]['initFreshsalesAccounts']=function(){var _0x2ca491=this;return function(_0x31e85e){if(_0x31e85e){freeIsNotKey(_0x31e85e,_0x2ca491[_0xbb10('0x24')],'id');for(var _0x37b65f=0x0,_0x5e4a6e={};_0x37b65f<_0x31e85e[_0xbb10('0x41')];_0x37b65f+=0x1){_0x5e4a6e=_0x31e85e[_0x37b65f];if(_[_0xbb10('0x43')](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']])){_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']]=new FreshsalesAccount(_0x5e4a6e);}else{_0x2ca491['mergeFromDatabase'](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']],_0x5e4a6e);}}}return _0x2ca491[_0xbb10('0x24')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4e')]=function(){var _0x12f750=this;return function(_0x17807e){for(var _0x1e4694=0x0;_0x1e4694<_0x17807e['length'];_0x1e4694+=0x1){_['merge'](_0x12f750['voiceQueues'][_0x17807e[_0x1e4694][_0xbb10('0x29')]],_0x17807e[_0x1e4694]);}return _0x12f750[_0xbb10('0x4f')];};};Realtime[_0xbb10('0x3f')]['initVoiceQueueReports']=function(){var _0x5cd089=this;return function(_0x46f462){clearVoiceQueues(_0x5cd089[_0xbb10('0x4f')]);if(_0x46f462){_0x46f462=_[_0xbb10('0x50')](_0x46f462,_0xbb10('0x51'));for(var _0x260e06 in _0x46f462){if(_0x46f462[_0xbb10('0x27')](_0x260e06)){for(var _0x4cf2f3=0x0;_0x4cf2f3<_0x46f462[_0x260e06][_0xbb10('0x41')];_0x4cf2f3+=0x1){var _0x15fae2=_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x52')];if(_0x5cd089[_0xbb10('0x4f')][_0x15fae2]){if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x53')]){_0x5cd089['voiceQueues'][_0x15fae2]['unmanaged']+=0x1;}if(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerabandon']){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x54')]+=0x1;}_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;if(_0x4cf2f3===_0x46f462[_0x260e06]['length']-0x1){_0x5cd089['voiceQueues'][_0x15fae2]['sumDuration']+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x58')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x59')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5a')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;_0x5cd089['voiceQueues'][_0x15fae2]['total']+=0x1;if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5b')]){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2d')]+=0x1;_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x33')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallercompleteAt'])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')]),_0xbb10('0x57'))||0x0;}}else{_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2f')]+=_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]||0x0;}}}}}}return _0x5cd089['voiceQueues'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x5c')]=function(){var _0x30f3ea=this;return function(_0x322b41){clearVoiceCallReports(_0x30f3ea[_0xbb10('0x5d')]);if(_0x322b41){for(var _0x172be3=0x0;_0x172be3<_0x322b41[_0xbb10('0x41')];_0x172be3+=0x1){_0x30f3ea[_0xbb10('0x5d')]['total']+=0x1;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x2f')]+=_0x322b41[_0x172be3][_0xbb10('0x5e')];if(_0x322b41[_0x172be3]['disposition']==='ANSWERED'){_0x30f3ea['outbound'][_0xbb10('0x2d')]+=0x1;_0x30f3ea['outbound']['sumHoldTime']+=_0x322b41[_0x172be3][_0xbb10('0x5e')]-_0x322b41[_0x172be3][_0xbb10('0x5f')]||0x0;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x33')]+=_0x322b41[_0x172be3][_0xbb10('0x5f')];}}}return _0x30f3ea[_0xbb10('0x5d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x60')]=function(){var _0x188b97=this;return function(_0x5206e1){if(_0x5206e1){freeIsNotKey(_0x5206e1,_0x188b97[_0xbb10('0x15')],_0xbb10('0x29'));for(var _0x46b6d2=0x0,_0x35b811={};_0x46b6d2<_0x5206e1['length'];_0x46b6d2+=0x1){_0x35b811=_0x5206e1[_0x46b6d2];if(_['isUndefined'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]])){_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]]=new Campaign(_0x35b811);}else{_0x188b97['mergeFromDatabase'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]],_0x35b811);_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]][_0xbb10('0x61')]=_0x35b811['SquareProject']?_0x35b811['SquareProject'][_0xbb10('0x29')]:undefined;}}}return _0x188b97[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')]['initVoiceExtensions']=function(){var _0x256b35=this;return function(_0x13e2ab){if(_0x13e2ab){freeIsNotKey(_0x13e2ab,_0x256b35['voiceExtensions'],'id');for(var _0x5caa06=0x0,_0x2f667f={};_0x5caa06<_0x13e2ab[_0xbb10('0x41')];_0x5caa06+=0x1){_0x2f667f=_0x13e2ab[_0x5caa06];if(_[_0xbb10('0x43')](_0x256b35['voiceExtensions'][_0x2f667f['id']])){_0x256b35[_0xbb10('0x17')][_0x2f667f['id']]=new VoiceExtension(_0x2f667f);}else{_0x256b35[_0xbb10('0x3e')](_0x256b35[_0xbb10('0x17')][_0x2f667f['id']],_0x2f667f);}}}return _0x256b35[_0xbb10('0x17')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x62')]=function(){var _0x45bd4e=this;return function(_0x226363){clearCampaigns(_0x45bd4e[_0xbb10('0x15')]);for(var _0x479d51=0x0;_0x479d51<_0x226363[_0xbb10('0x41')];_0x479d51+=0x1){_[_0xbb10('0x63')](_0x45bd4e[_0xbb10('0x15')][_0x226363[_0x479d51][_0xbb10('0x29')]],_0x226363[_0x479d51]);}return _0x45bd4e[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x64')]=function(){var _0x305d52=this;return function(_0x17ed20){if(_0x17ed20){freeIsNotKey(_0x17ed20,_0x305d52[_0xbb10('0x25')],'id');for(var _0x15e043=0x0,_0x2a4278={};_0x15e043<_0x17ed20['length'];_0x15e043+=0x1){_0x2a4278=_0x17ed20[_0x15e043];if(_['isUndefined'](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']])){_0x305d52[_0xbb10('0x25')][_0x2a4278['id']]=new FaxAccount(_0x2a4278);}else{_0x305d52[_0xbb10('0x3e')](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']],_0x2a4278);}}}return _0x305d52[_0xbb10('0x25')];};};Realtime['prototype'][_0xbb10('0x65')]=function(){var _0x332fbe=this;return function(_0x3b4d0b){if(_0x3b4d0b){freeIsNotKey(_0x3b4d0b,_0x332fbe[_0xbb10('0x4f')],_0xbb10('0x29'));for(var _0x379d49=0x0,_0x546db5={};_0x379d49<_0x3b4d0b[_0xbb10('0x41')];_0x379d49+=0x1){_0x546db5=_0x3b4d0b[_0x379d49];if(_[_0xbb10('0x43')](_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]])){_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]]=new VoiceQueue(_0x546db5);}else{_0x332fbe[_0xbb10('0x3e')](_0x332fbe[_0xbb10('0x4f')][_0x546db5[_0xbb10('0x29')]],_0x546db5);}}}return _0x332fbe[_0xbb10('0x4f')];};};module['exports']=Realtime; \ No newline at end of file +var _0x0b0e=['total','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','initAgents','length','isNil','SIP/%s','isUndefined','prototype','initTelephones','initTrunks','trunks','initTriggers','initTemplates','salesforceAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queue','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','diff','queuecallercomplete','answered','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','lodash','util','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','voiceQueues','triggers','templates','outbound','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','faxAccounts','mapKeys','name','hasOwnProperty','format','interface'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x0b0e,0x187));var _0xe0b0=function(_0x75267d,_0x5d286c){_0x75267d=_0x75267d-0x0;var _0x21ccec=_0x0b0e[_0x75267d];return _0x21ccec;};'use strict';var _=require(_0xe0b0('0x0'));var moment=require('moment');var util=require(_0xe0b0('0x1'));var Agent=require('../model/agent');var Telephone=require(_0xe0b0('0x2'));var Trunk=require(_0xe0b0('0x3'));var VoiceQueue=require(_0xe0b0('0x4'));var Trigger=require(_0xe0b0('0x5'));var Template=require(_0xe0b0('0x6'));var Campaign=require(_0xe0b0('0x7'));var VoiceExtension=require(_0xe0b0('0x8'));var ZendeskAccount=require(_0xe0b0('0x9'));var SalesforceAccount=require(_0xe0b0('0xa'));var FreshdeskAccount=require(_0xe0b0('0xb'));var SugarcrmAccount=require(_0xe0b0('0xc'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xe0b0('0xd'));var ServicenowAccount=require(_0xe0b0('0xe'));var Dynamics365Account=require(_0xe0b0('0xf'));var FreshsalesAccount=require(_0xe0b0('0x10'));var FaxAccount=require('../model/faxAccount');function Realtime(){this[_0xe0b0('0x11')]={};this[_0xe0b0('0x12')]={};this['trunks']={};this[_0xe0b0('0x13')]={};this[_0xe0b0('0x14')]={};this['campaigns']={};this[_0xe0b0('0x15')]={};this[_0xe0b0('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xe0b0('0x17')]={};this['channels']={};this[_0xe0b0('0x18')]={};this[_0xe0b0('0x19')]={};this[_0xe0b0('0x1a')]={};this[_0xe0b0('0x1b')]={};this[_0xe0b0('0x1c')]={};this['salesforceAccounts']={};this[_0xe0b0('0x1d')]={};this[_0xe0b0('0x1e')]={};this[_0xe0b0('0x1f')]={};this[_0xe0b0('0x20')]={};this[_0xe0b0('0x21')]={};this['servicenowAccounts']={};this[_0xe0b0('0x22')]={};this['freshsalesAccounts']={};this[_0xe0b0('0x23')]={};}function freeIsNotKey(_0xadee6e,_0x519ae8,_0x11fdca){var _0x4a4cc0=_[_0xe0b0('0x24')](_0xadee6e,function(_0x100204){return _0x100204[_0x11fdca];});for(var _0x56bcc7 in _0x519ae8){if(_0x519ae8['hasOwnProperty'](_0x56bcc7)){if(!_0x4a4cc0[_0x56bcc7]){delete _0x519ae8[_0x56bcc7];}}}}function freeIsNotKeySip(_0x46bb44,_0x50a441){var _0x4df8da=_['mapKeys'](_0x46bb44,function(_0x1920ee){return util['format']('SIP/%s',_0x1920ee[_0xe0b0('0x25')]);});for(var _0x59dff5 in _0x50a441){if(_0x50a441[_0xe0b0('0x26')](_0x59dff5)){if(!_0x4df8da[_0x59dff5]){delete _0x50a441[_0x59dff5];}}}}function freeIsNotKeyAgent(_0x5dba2f,_0x2c84cc){var _0x1cd7c4=_[_0xe0b0('0x24')](_0x5dba2f,function(_0x310a6d){var _0x2cf6a1=_['isNil'](_0x310a6d['interface'])?util[_0xe0b0('0x27')]('SIP/%s',_0x310a6d[_0xe0b0('0x25')]):_0x310a6d[_0xe0b0('0x28')];return _0x2cf6a1;});for(var _0x513e63 in _0x2c84cc){if(_0x2c84cc[_0xe0b0('0x26')](_0x513e63)){if(!_0x1cd7c4[_0x513e63]){delete _0x2c84cc[_0x513e63];}}}}function clearVoiceCallReports(_0x503883){_0x503883[_0xe0b0('0x29')]=0x0;_0x503883['answered']=0x0;_0x503883[_0xe0b0('0x2a')]=0x0;_0x503883['sumDuration']=0x0;_0x503883[_0xe0b0('0x2b')]=0x0;}function clearCampaigns(_0x4de537){if(!_[_0xe0b0('0x2c')](_0x4de537)){for(var _0x4aafbe in _0x4de537){if(_0x4de537[_0xe0b0('0x26')](_0x4aafbe)){_0x4de537[_0x4aafbe]['ivrTotalCallsDays']=0x0;_0x4de537[_0x4aafbe][_0xe0b0('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x3c3bc2){if(!_[_0xe0b0('0x2c')](_0x3c3bc2)){for(var _0x1d91ad in _0x3c3bc2){if(_0x3c3bc2[_0xe0b0('0x26')](_0x1d91ad)){_0x3c3bc2[_0x1d91ad][_0xe0b0('0x29')]=0x0;_0x3c3bc2[_0x1d91ad]['answered']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2e')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2f')]=0x0;_0x3c3bc2[_0x1d91ad]['sumHoldTime']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x30')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2b')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x32')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x33')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x34')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x35')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundUnknownCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x36')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x37')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundBlacklistCallsDay']=0x0;_0x3c3bc2[_0x1d91ad]['outboundOriginateFailureCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x38')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x39')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3a')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3b')]=!![];}}}}Realtime['prototype'][_0xe0b0('0x3c')]=function(_0x3231fc,_0x7867c4){for(var _0x29d725 in _0x7867c4){if(_0x3231fc[_0xe0b0('0x26')](_0x29d725)){_0x3231fc[_0x29d725]=_0x7867c4[_0x29d725];}}};Realtime['prototype'][_0xe0b0('0x3d')]=function(){var _0x208945=this;return function(_0xfc51d3){if(_0xfc51d3){freeIsNotKeyAgent(_0xfc51d3,_0x208945[_0xe0b0('0x11')]);for(var _0x3575bc=0x0,_0x12eeb8={};_0x3575bc<_0xfc51d3[_0xe0b0('0x3e')];_0x3575bc+=0x1){_0x12eeb8=_0xfc51d3[_0x3575bc];var _0x20908f=_[_0xe0b0('0x3f')](_0x12eeb8[_0xe0b0('0x28')])?util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x12eeb8[_0xe0b0('0x25')]):_0x12eeb8[_0xe0b0('0x28')];if(_[_0xe0b0('0x41')](_0x208945['agents'][_0x20908f])){_0x208945[_0xe0b0('0x11')][_0x20908f]=new Agent(_0x12eeb8);}else{_0x208945[_0xe0b0('0x3c')](_0x208945[_0xe0b0('0x11')][_0x20908f],_0x12eeb8);}}}return _0x208945[_0xe0b0('0x11')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x43')]=function(){var _0x12024d=this;return function(_0x533fc7){if(_0x533fc7){freeIsNotKeySip(_0x533fc7,_0x12024d['telephones']);for(var _0x549d9a=0x0,_0x5317df={};_0x549d9a<_0x533fc7[_0xe0b0('0x3e')];_0x549d9a+=0x1){_0x5317df=_0x533fc7[_0x549d9a];if(_[_0xe0b0('0x41')](_0x12024d[_0xe0b0('0x12')][util['format'](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])])){_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')]('SIP/%s',_0x5317df[_0xe0b0('0x25')])]=new Telephone(_0x5317df);}else{_0x12024d[_0xe0b0('0x3c')](_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])],_0x5317df);}}}return _0x12024d[_0xe0b0('0x12')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x44')]=function(){var _0x54f251=this;return function(_0x3e349b){if(_0x3e349b){freeIsNotKeySip(_0x3e349b,_0x54f251['trunks']);for(var _0x34178d=0x0,_0x2d5f47={};_0x34178d<_0x3e349b[_0xe0b0('0x3e')];_0x34178d+=0x1){_0x2d5f47=_0x3e349b[_0x34178d];if(_[_0xe0b0('0x41')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])])){_0x54f251[_0xe0b0('0x45')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])]=new Trunk(_0x2d5f47);}else{_0x54f251[_0xe0b0('0x3c')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47['name'])],_0x2d5f47);}}}return _0x54f251['trunks'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x46')]=function(){var _0x56e7df=this;return function(_0x18a59d){if(_0x18a59d){freeIsNotKey(_0x18a59d,_0x56e7df[_0xe0b0('0x14')],'id');for(var _0x6bca5c=0x0,_0x1c869d={};_0x6bca5c<_0x18a59d[_0xe0b0('0x3e')];_0x6bca5c+=0x1){_0x1c869d=_0x18a59d[_0x6bca5c];if(_['isUndefined'](_0x56e7df['triggers'][_0x1c869d['id']])){_0x56e7df['triggers'][_0x1c869d['id']]=new Trigger(_0x1c869d);}else{_0x56e7df[_0xe0b0('0x3c')](_0x56e7df[_0xe0b0('0x14')][_0x1c869d['id']],_0x1c869d);}}}return _0x56e7df['triggers'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x47')]=function(){var _0x14197b=this;return function(_0x5f037d){if(_0x5f037d){freeIsNotKey(_0x5f037d,_0x14197b[_0xe0b0('0x15')],'id');for(var _0x5c6f94=0x0,_0x57d4b0={};_0x5c6f94<_0x5f037d[_0xe0b0('0x3e')];_0x5c6f94+=0x1){_0x57d4b0=_0x5f037d[_0x5c6f94];if(_[_0xe0b0('0x41')](_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']])){_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']]=new Template(_0x57d4b0);}else{_0x14197b[_0xe0b0('0x3c')](_0x14197b['templates'][_0x57d4b0['id']],_0x57d4b0);}}}return _0x14197b[_0xe0b0('0x15')];};};Realtime[_0xe0b0('0x42')]['initZendeskAccounts']=function(){var _0x50c805=this;return function(_0x5ddad1){if(_0x5ddad1){freeIsNotKey(_0x5ddad1,_0x50c805[_0xe0b0('0x1c')],'id');for(var _0x2184d3=0x0,_0x2419ce={};_0x2184d3<_0x5ddad1[_0xe0b0('0x3e')];_0x2184d3+=0x1){_0x2419ce=_0x5ddad1[_0x2184d3];if(_['isUndefined'](_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']])){_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']]=new ZendeskAccount(_0x2419ce);}else{_0x50c805['mergeFromDatabase'](_0x50c805['zendeskAccounts'][_0x2419ce['id']],_0x2419ce);}}}return _0x50c805[_0xe0b0('0x1c')];};};Realtime[_0xe0b0('0x42')]['initSalesforceAccounts']=function(){var _0x2b1917=this;return function(_0x27fd31){if(_0x27fd31){freeIsNotKey(_0x27fd31,_0x2b1917['salesforceAccounts'],'id');for(var _0x5cb2b6=0x0,_0x123ad2={};_0x5cb2b6<_0x27fd31['length'];_0x5cb2b6+=0x1){_0x123ad2=_0x27fd31[_0x5cb2b6];if(_[_0xe0b0('0x41')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']])){_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']]=new SalesforceAccount(_0x123ad2);}else{_0x2b1917[_0xe0b0('0x3c')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']],_0x123ad2);}}}return _0x2b1917[_0xe0b0('0x48')];};};Realtime['prototype']['initFreshdeskAccounts']=function(){var _0x2ef908=this;return function(_0x5d380a){if(_0x5d380a){freeIsNotKey(_0x5d380a,_0x2ef908['freshdeskAccounts'],'id');for(var _0x249d9a=0x0,_0x222174={};_0x249d9a<_0x5d380a['length'];_0x249d9a+=0x1){_0x222174=_0x5d380a[_0x249d9a];if(_['isUndefined'](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']])){_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']]=new FreshdeskAccount(_0x222174);}else{_0x2ef908[_0xe0b0('0x3c')](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']],_0x222174);}}}return _0x2ef908[_0xe0b0('0x1e')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x49')]=function(){var _0x4ebb0f=this;return function(_0x22c7bc){if(_0x22c7bc){freeIsNotKey(_0x22c7bc,_0x4ebb0f['zohoAccounts'],'id');for(var _0x17b3d4=0x0,_0x54106c={};_0x17b3d4<_0x22c7bc['length'];_0x17b3d4+=0x1){_0x54106c=_0x22c7bc[_0x17b3d4];if(_[_0xe0b0('0x41')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']])){_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']]=new ZohoAccount(_0x54106c);}else{_0x4ebb0f[_0xe0b0('0x3c')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']],_0x54106c);}}}return _0x4ebb0f[_0xe0b0('0x1f')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4a')]=function(){var _0x2e1c9b=this;return function(_0x4e0d87){if(_0x4e0d87){freeIsNotKey(_0x4e0d87,_0x2e1c9b[_0xe0b0('0x20')],'id');for(var _0x57ccc9=0x0,_0x2b5553={};_0x57ccc9<_0x4e0d87[_0xe0b0('0x3e')];_0x57ccc9+=0x1){_0x2b5553=_0x4e0d87[_0x57ccc9];if(_[_0xe0b0('0x41')](_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']])){_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']]=new DeskAccount(_0x2b5553);}else{_0x2e1c9b[_0xe0b0('0x3c')](_0x2e1c9b['deskAccounts'][_0x2b5553['id']],_0x2b5553);}}}return _0x2e1c9b[_0xe0b0('0x20')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4b')]=function(){var _0x271445=this;return function(_0x3bb6d6){if(_0x3bb6d6){freeIsNotKey(_0x3bb6d6,_0x271445[_0xe0b0('0x1d')],'id');for(var _0x234cb7=0x0,_0x1a60d2={};_0x234cb7<_0x3bb6d6[_0xe0b0('0x3e')];_0x234cb7+=0x1){_0x1a60d2=_0x3bb6d6[_0x234cb7];if(_[_0xe0b0('0x41')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']])){_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']]=new SugarcrmAccount(_0x1a60d2);}else{_0x271445[_0xe0b0('0x3c')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']],_0x1a60d2);}}}return _0x271445[_0xe0b0('0x1d')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4c')]=function(){var _0x155738=this;return function(_0x5aa79b){if(_0x5aa79b){freeIsNotKey(_0x5aa79b,_0x155738[_0xe0b0('0x21')],'id');for(var _0xe7fbac=0x0,_0x1182dc={};_0xe7fbac<_0x5aa79b[_0xe0b0('0x3e')];_0xe7fbac+=0x1){_0x1182dc=_0x5aa79b[_0xe7fbac];if(_[_0xe0b0('0x41')](_0x155738[_0xe0b0('0x21')][_0x1182dc['id']])){_0x155738[_0xe0b0('0x21')][_0x1182dc['id']]=new VtigerAccount(_0x1182dc);}else{_0x155738['mergeFromDatabase'](_0x155738['vtigerAccounts'][_0x1182dc['id']],_0x1182dc);}}}return _0x155738[_0xe0b0('0x21')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4d')]=function(){var _0x47ecc1=this;return function(_0x117d20){if(_0x117d20){freeIsNotKey(_0x117d20,_0x47ecc1[_0xe0b0('0x4e')],'id');for(var _0x309efb=0x0,_0x3d820c={};_0x309efb<_0x117d20[_0xe0b0('0x3e')];_0x309efb+=0x1){_0x3d820c=_0x117d20[_0x309efb];if(_['isUndefined'](_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']])){_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']]=new ServicenowAccount(_0x3d820c);}else{_0x47ecc1[_0xe0b0('0x3c')](_0x47ecc1['servicenowAccounts'][_0x3d820c['id']],_0x3d820c);}}}return _0x47ecc1[_0xe0b0('0x4e')];};};Realtime[_0xe0b0('0x42')]['initDynamics365Accounts']=function(){var _0x1bd249=this;return function(_0x4c5478){if(_0x4c5478){freeIsNotKey(_0x4c5478,_0x1bd249['dynamics365Accounts'],'id');for(var _0x4474ac=0x0,_0x57b51e={};_0x4474ac<_0x4c5478['length'];_0x4474ac+=0x1){_0x57b51e=_0x4c5478[_0x4474ac];if(_[_0xe0b0('0x41')](_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']])){_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']]=new Dynamics365Account(_0x57b51e);}else{_0x1bd249[_0xe0b0('0x3c')](_0x1bd249['dynamics365Accounts'][_0x57b51e['id']],_0x57b51e);}}}return _0x1bd249[_0xe0b0('0x22')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4f')]=function(){var _0x41ec8e=this;return function(_0x1b29c){if(_0x1b29c){freeIsNotKey(_0x1b29c,_0x41ec8e[_0xe0b0('0x50')],'id');for(var _0xc5e88c=0x0,_0x224f1e={};_0xc5e88c<_0x1b29c['length'];_0xc5e88c+=0x1){_0x224f1e=_0x1b29c[_0xc5e88c];if(_['isUndefined'](_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']])){_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']]=new FreshsalesAccount(_0x224f1e);}else{_0x41ec8e[_0xe0b0('0x3c')](_0x41ec8e['freshsalesAccounts'][_0x224f1e['id']],_0x224f1e);}}}return _0x41ec8e['freshsalesAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x51')]=function(){var _0x5d7cf4=this;return function(_0x5eca3d){for(var _0x691136=0x0;_0x691136<_0x5eca3d[_0xe0b0('0x3e')];_0x691136+=0x1){_[_0xe0b0('0x52')](_0x5d7cf4[_0xe0b0('0x13')][_0x5eca3d[_0x691136][_0xe0b0('0x25')]],_0x5eca3d[_0x691136]);}return _0x5d7cf4[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x53')]=function(){var _0x51f209=this;return function(_0x1daff7){clearVoiceQueues(_0x51f209[_0xe0b0('0x13')]);if(_0x1daff7){_0x1daff7=_[_0xe0b0('0x54')](_0x1daff7,'uniqueid');for(var _0x4fbf44 in _0x1daff7){if(_0x1daff7['hasOwnProperty'](_0x4fbf44)){for(var _0x56ee83=0x0;_0x56ee83<_0x1daff7[_0x4fbf44]['length'];_0x56ee83+=0x1){var _0x567c06=_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x55')];if(_0x51f209['voiceQueues'][_0x567c06]){if(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexit']){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2e')]+=0x1;}if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x56')]){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2f')]+=0x1;}_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')])['diff'](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x58')]),_0xe0b0('0x59'))||0x0;if(_0x56ee83===_0x1daff7[_0x4fbf44][_0xe0b0('0x3e')]-0x1){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5a')]||_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5b')]||_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexitAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerjoinAt']),_0xe0b0('0x59'))||0x0;_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x29')]+=0x1;if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5d')]){_0x51f209['voiceQueues'][_0x567c06][_0xe0b0('0x5e')]+=0x1;_0x51f209[_0xe0b0('0x13')][_0x567c06]['sumBillable']+=moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallercompleteAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')]),_0xe0b0('0x59'))||0x0;}}else{_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]||0x0;}}}}}}return _0x51f209[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x5f')]=function(){var _0x5a63e6=this;return function(_0x4c512b){clearVoiceCallReports(_0x5a63e6[_0xe0b0('0x16')]);if(_0x4c512b){for(var _0x4880d5=0x0;_0x4880d5<_0x4c512b['length'];_0x4880d5+=0x1){_0x5a63e6['outbound']['total']+=0x1;_0x5a63e6[_0xe0b0('0x16')]['sumDuration']+=_0x4c512b[_0x4880d5][_0xe0b0('0x60')];if(_0x4c512b[_0x4880d5][_0xe0b0('0x61')]===_0xe0b0('0x62')){_0x5a63e6[_0xe0b0('0x16')]['answered']+=0x1;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2a')]+=_0x4c512b[_0x4880d5]['duration']-_0x4c512b[_0x4880d5][_0xe0b0('0x63')]||0x0;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2b')]+=_0x4c512b[_0x4880d5][_0xe0b0('0x63')];}}}return _0x5a63e6[_0xe0b0('0x16')];};};Realtime['prototype']['initCampaigns']=function(){var _0x55aef7=this;return function(_0x545694){if(_0x545694){freeIsNotKey(_0x545694,_0x55aef7['campaigns'],_0xe0b0('0x25'));for(var _0x567e1a=0x0,_0x3c09af={};_0x567e1a<_0x545694['length'];_0x567e1a+=0x1){_0x3c09af=_0x545694[_0x567e1a];if(_[_0xe0b0('0x41')](_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]])){_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]]=new Campaign(_0x3c09af);}else{_0x55aef7[_0xe0b0('0x3c')](_0x55aef7['campaigns'][_0x3c09af['name']],_0x3c09af);_0x55aef7['campaigns'][_0x3c09af['name']][_0xe0b0('0x65')]=_0x3c09af[_0xe0b0('0x66')]?_0x3c09af[_0xe0b0('0x66')][_0xe0b0('0x25')]:undefined;}}}return _0x55aef7[_0xe0b0('0x64')];};};Realtime['prototype'][_0xe0b0('0x67')]=function(){var _0x39a07b=this;return function(_0xf77616){if(_0xf77616){freeIsNotKey(_0xf77616,_0x39a07b[_0xe0b0('0x17')],'id');for(var _0x154e6d=0x0,_0x2a5082={};_0x154e6d<_0xf77616[_0xe0b0('0x3e')];_0x154e6d+=0x1){_0x2a5082=_0xf77616[_0x154e6d];if(_[_0xe0b0('0x41')](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']])){_0x39a07b['voiceExtensions'][_0x2a5082['id']]=new VoiceExtension(_0x2a5082);}else{_0x39a07b['mergeFromDatabase'](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']],_0x2a5082);}}}return _0x39a07b[_0xe0b0('0x17')];};};Realtime['prototype'][_0xe0b0('0x68')]=function(){var _0x4593f1=this;return function(_0x44c475){clearCampaigns(_0x4593f1[_0xe0b0('0x64')]);for(var _0x7358ce=0x0;_0x7358ce<_0x44c475[_0xe0b0('0x3e')];_0x7358ce+=0x1){_[_0xe0b0('0x52')](_0x4593f1[_0xe0b0('0x64')][_0x44c475[_0x7358ce]['name']],_0x44c475[_0x7358ce]);}return _0x4593f1['campaigns'];};};Realtime['prototype'][_0xe0b0('0x69')]=function(){var _0x90d471=this;return function(_0x5d2365){if(_0x5d2365){freeIsNotKey(_0x5d2365,_0x90d471[_0xe0b0('0x23')],'id');for(var _0x448694=0x0,_0x396eec={};_0x448694<_0x5d2365[_0xe0b0('0x3e')];_0x448694+=0x1){_0x396eec=_0x5d2365[_0x448694];if(_['isUndefined'](_0x90d471['faxAccounts'][_0x396eec['id']])){_0x90d471['faxAccounts'][_0x396eec['id']]=new FaxAccount(_0x396eec);}else{_0x90d471[_0xe0b0('0x3c')](_0x90d471[_0xe0b0('0x23')][_0x396eec['id']],_0x396eec);}}}return _0x90d471['faxAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x6a')]=function(){var _0x5547ee=this;return function(_0x576482){if(_0x576482){freeIsNotKey(_0x576482,_0x5547ee[_0xe0b0('0x13')],'name');for(var _0x251195=0x0,_0x5f06c0={};_0x251195<_0x576482[_0xe0b0('0x3e')];_0x251195+=0x1){_0x5f06c0=_0x576482[_0x251195];if(_[_0xe0b0('0x41')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]])){_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]]=new VoiceQueue(_0x5f06c0);}else{_0x5547ee[_0xe0b0('0x3c')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]],_0x5f06c0);}}}return _0x5547ee['voiceQueues'];};};module[_0xe0b0('0x6b')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 635a9ff..acf0249 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 _0x9bc3=['assign','mergeDBDataToRealtime'];(function(_0x522c6d,_0x4d250d){var _0x26300d=function(_0x3ab228){while(--_0x3ab228){_0x522c6d['push'](_0x522c6d['shift']());}};_0x26300d(++_0x4d250d);}(_0x9bc3,0x148));var _0x39bc=function(_0xaa336e,_0x2febee){_0xaa336e=_0xaa336e-0x0;var _0x53f378=_0x9bc3[_0xaa336e];return _0x53f378;};'use strict';function mergeDBDataToRealtime(_0x409e46,_0x260357){var _0x1905c1=Object[_0x39bc('0x0')]({},_0x409e46);for(var _0x556f21 in _0x260357){if(_0x1905c1['hasOwnProperty'](_0x556f21)){_0x1905c1[_0x556f21]=_0x260357[_0x556f21];}}return _0x1905c1;}exports[_0x39bc('0x1')]=mergeDBDataToRealtime; \ No newline at end of file +var _0x16e4=['assign','mergeDBDataToRealtime'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x16e4,0xdc));var _0x416e=function(_0x382a5d,_0x1545b1){_0x382a5d=_0x382a5d-0x0;var _0xe48bd7=_0x16e4[_0x382a5d];return _0xe48bd7;};'use strict';function mergeDBDataToRealtime(_0x2cf942,_0x2f62b6){var _0x3e97d1=Object[_0x416e('0x0')]({},_0x2cf942);for(var _0x18ae31 in _0x2f62b6){if(_0x3e97d1['hasOwnProperty'](_0x18ae31)){_0x3e97d1[_0x18ae31]=_0x2f62b6[_0x18ae31];}}return _0x3e97d1;}exports[_0x416e('0x1')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 30f81a8..2b9d245 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 _0x9c55=['connectedlinenum','calleridname','connectedlinename','membername','isArray','forEach','create','startsWith','Local','substring','indexOf','phone','transfererlinkedid','exports','lodash','util','../../../config/environment','../ami','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','realtime','telephones','prototype','sync','xdr','disabled','voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','agents','SIP/%s','length','assigned','lastAssignedTo','interface','queuecallercomplete','queuecallercompleteAt','format','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','keys','getCallType','channel','split','calleridnum','internal','destination','exten','type','dialer','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','disposition','\x22%s\x22\x20<%s>','transfers','linkedid','transfereelinkedid','uniqueid','UserId','getAgentByInternal','monitor','monitorFilename','monitors','filename','createdAt'];(function(_0x41b463,_0x223cb0){var _0x566854=function(_0x2725b8){while(--_0x2725b8){_0x41b463['push'](_0x41b463['shift']());}};_0x566854(++_0x223cb0);}(_0x9c55,0x68));var _0x59c5=function(_0x5bff0,_0x20716d){_0x5bff0=_0x5bff0-0x0;var _0x3ead2e=_0x9c55[_0x5bff0];return _0x3ead2e;};'use strict';var _=require(_0x59c5('0x0'));var moment=require('moment');var util=require(_0x59c5('0x1'));var config=require(_0x59c5('0x2'));var ami=require(_0x59c5('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x59c5('0x4'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x59c5('0x5'));var RpcVoiceQueueReport=require(_0x59c5('0x6'));var RpcVoiceRecording=require(_0x59c5('0x7'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x59c5('0x8'));var VoiceCallReport=require(_0x59c5('0x9'));var VoiceAgentReport=require(_0x59c5('0xa'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require('./userReport');function Report(_0x3f4117){this[_0x59c5('0xb')]=_0x3f4117;this['agents']=_0x3f4117['agents'];this[_0x59c5('0xc')]=_0x3f4117[_0x59c5('0xc')];}Report[_0x59c5('0xd')][_0x59c5('0xe')]=function(_0x3612f5){var _0x2e7969=new VoiceQueueReport(this['realtime']);var _0x576139=new VoiceAgentReport(this[_0x59c5('0xb')]);var _0x2019a2=new VoiceDialReport(this['realtime']);var _0x32e2c9=new VoiceCallReport(this['realtime']);var _0x32257a=new UserReport(this['realtime']);if(config[_0x59c5('0xf')]&&config[_0x59c5('0xf')][_0x59c5('0x10')]){ami['on']('custom:voiceQueueReport',this[_0x59c5('0x11')]['bind'](this));ami['on'](_0x59c5('0x12'),this[_0x59c5('0x13')][_0x59c5('0x14')](this));ami['on'](_0x59c5('0x15'),this[_0x59c5('0x16')]['bind'](this));ami['on'](_0x59c5('0x17'),this[_0x59c5('0x18')][_0x59c5('0x14')](this));ami['on'](_0x59c5('0x19'),this[_0x59c5('0x1a')]['bind'](this));ami['on']('attendedtransfer',this[_0x59c5('0x1b')][_0x59c5('0x14')](this));}};Report[_0x59c5('0xd')][_0x59c5('0x1c')]=function(_0x2f3c39){var _0x1f0f8d;_0x1f0f8d=_[_0x59c5('0x1d')](this['agents'],function(_0x51f818){return _0x51f818[_0x59c5('0x1e')]==_0x2f3c39||_0x51f818[_0x59c5('0x1f')]==_0x2f3c39;});if(_[_0x59c5('0x20')](_0x1f0f8d)){var _0x2906d9=_[_0x59c5('0x1d')](this['telephones'],function(_0xa8543f){return _0xa8543f[_0x59c5('0x1e')]==_0x2f3c39||_0xa8543f[_0x59c5('0x1f')]==_0x2f3c39;});if(_0x2906d9){_0x1f0f8d=_[_0x59c5('0x1d')](this[_0x59c5('0x21')],function(_0x14d529){return _0x14d529['interface']==util['format'](_0x59c5('0x22'),_0x2906d9[_0x59c5('0x1f')]);});}}return _0x1f0f8d;};Report[_0x59c5('0xd')][_0x59c5('0x11')]=function(_0x3e7eca){for(var _0x231917=0x0;_0x231917<_0x3e7eca[_0x59c5('0x23')];_0x231917+=0x1){var _0x3f5765=this[_0x59c5('0x1c')](_0x3e7eca[_0x231917]['connectedlinenum']);if(_0x3f5765){_0x3e7eca[_0x231917][_0x59c5('0x1e')]=_0x3f5765[_0x59c5('0x1e')];_0x3e7eca[_0x231917][_0x59c5('0x24')]=!![];_0x3e7eca[_0x231917][_0x59c5('0x25')]=_0x3f5765['name'];_0x3e7eca[_0x231917][_0x59c5('0x26')]=_[_0x59c5('0x20')](_0x3f5765[_0x59c5('0x26')])?util['format']('SIP/%s',_0x3f5765['name']):_0x3f5765['interface'];if(_0x3e7eca[_0x231917][_0x59c5('0x27')]){_0x3e7eca[_0x231917][_0x59c5('0x28')]=moment()[_0x59c5('0x29')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x3e7eca[_0x231917]['queuecallerexit']){_0x3e7eca[_0x231917][_0x59c5('0x2a')]=moment()['format'](_0x59c5('0x2b'));}RpcMemberReport['voiceQueueReport'](_0x3e7eca[_0x231917]);}RpcVoiceQueueReport['create'](_0x3e7eca[_0x231917]);}};function extractCalleridNumber(_0x376843){var _0x431b27=_0x376843['match'](/<(.*?)>/);return _0x431b27?_0x431b27[0x1]:_0x376843;}Report[_0x59c5('0xd')]['getAgentByInternal']=function(_0x40d180){for(var _0x2dca8b=0x0;_0x2dca8b','calleridname','transfers','linkedid','uniqueid','UserId','membername','monitors','filename','createdAt','connectedlinename','xcally-motion-dialer','isArray','forEach','Local','substring','indexOf','mobile','phone','lastIndexOf','exports','lodash','moment','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','sync','xdr','disabled','bind','custom:voiceCallReport','voiceCallReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedTransfer','prototype','findAgent','find','accountcode','name'];(function(_0x32cc29,_0x2ca052){var _0x17ba1e=function(_0xaae898){while(--_0xaae898){_0x32cc29['push'](_0x32cc29['shift']());}};_0x17ba1e(++_0x2ca052);}(_0x7bf9,0x156));var _0x97bf=function(_0x426a6b,_0x1a7196){_0x426a6b=_0x426a6b-0x0;var _0x145354=_0x7bf9[_0x426a6b];return _0x145354;};'use strict';var _=require(_0x97bf('0x0'));var moment=require(_0x97bf('0x1'));var util=require('util');var config=require(_0x97bf('0x2'));var ami=require(_0x97bf('0x3'));var RpcVoiceAgentReport=require(_0x97bf('0x4'));var RpcVoiceCallReport=require(_0x97bf('0x5'));var RpcVoiceDialReport=require(_0x97bf('0x6'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x97bf('0x7'));var RpcVoiceRecording=require(_0x97bf('0x8'));var RpcVoiceTransferReport=require(_0x97bf('0x9'));var VoiceQueueReport=require(_0x97bf('0xa'));var VoiceCallReport=require(_0x97bf('0xb'));var VoiceAgentReport=require(_0x97bf('0xc'));var VoiceDialReport=require(_0x97bf('0xd'));var UserReport=require(_0x97bf('0xe'));function Report(_0x3de67a){this[_0x97bf('0xf')]=_0x3de67a;this[_0x97bf('0x10')]=_0x3de67a['agents'];this['telephones']=_0x3de67a['telephones'];}Report['prototype'][_0x97bf('0x11')]=function(_0x5094ce){var _0xf5f341=new VoiceQueueReport(this[_0x97bf('0xf')]);var _0x1039a0=new VoiceAgentReport(this[_0x97bf('0xf')]);var _0x1fd769=new VoiceDialReport(this[_0x97bf('0xf')]);var _0x48650d=new VoiceCallReport(this[_0x97bf('0xf')]);var _0xe09631=new UserReport(this[_0x97bf('0xf')]);if(config[_0x97bf('0x12')]&&config[_0x97bf('0x12')][_0x97bf('0x13')]){ami['on']('custom:voiceQueueReport',this['voiceQueueReport'][_0x97bf('0x14')](this));ami['on'](_0x97bf('0x15'),this[_0x97bf('0x16')][_0x97bf('0x14')](this));ami['on']('custom:voiceAgentReport',this[_0x97bf('0x17')]['bind'](this));ami['on'](_0x97bf('0x18'),this[_0x97bf('0x19')][_0x97bf('0x14')](this));ami['on'](_0x97bf('0x1a'),this[_0x97bf('0x1b')][_0x97bf('0x14')](this));ami['on']('attendedtransfer',this[_0x97bf('0x1c')][_0x97bf('0x14')](this));}};Report[_0x97bf('0x1d')][_0x97bf('0x1e')]=function(_0x2a173b){var _0x33bb5e;_0x33bb5e=_[_0x97bf('0x1f')](this[_0x97bf('0x10')],function(_0x510c0e){return _0x510c0e[_0x97bf('0x20')]==_0x2a173b||_0x510c0e[_0x97bf('0x21')]==_0x2a173b;});if(_[_0x97bf('0x22')](_0x33bb5e)){var _0x179c16=_[_0x97bf('0x1f')](this[_0x97bf('0x23')],function(_0x176af1){return _0x176af1[_0x97bf('0x20')]==_0x2a173b||_0x176af1[_0x97bf('0x21')]==_0x2a173b;});if(_0x179c16){_0x33bb5e=_['find'](this['agents'],function(_0x4cd29e){return _0x4cd29e[_0x97bf('0x24')]==util[_0x97bf('0x25')](_0x97bf('0x26'),_0x179c16['name']);});}}return _0x33bb5e;};Report[_0x97bf('0x1d')][_0x97bf('0x27')]=function(_0x200868){for(var _0x2c5306=0x0;_0x2c5306<_0x200868['length'];_0x2c5306+=0x1){var _0x5f51a6=this['findAgent'](_0x200868[_0x2c5306][_0x97bf('0x28')]);if(_0x5f51a6){_0x200868[_0x2c5306]['accountcode']=_0x5f51a6[_0x97bf('0x20')];_0x200868[_0x2c5306][_0x97bf('0x29')]=!![];_0x200868[_0x2c5306]['lastAssignedTo']=_0x5f51a6[_0x97bf('0x21')];_0x200868[_0x2c5306][_0x97bf('0x24')]=_[_0x97bf('0x22')](_0x5f51a6[_0x97bf('0x24')])?util[_0x97bf('0x25')]('SIP/%s',_0x5f51a6['name']):_0x5f51a6['interface'];if(_0x200868[_0x2c5306][_0x97bf('0x2a')]){_0x200868[_0x2c5306][_0x97bf('0x2b')]=moment()[_0x97bf('0x25')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x200868[_0x2c5306][_0x97bf('0x2c')]){_0x200868[_0x2c5306][_0x97bf('0x2d')]=moment()[_0x97bf('0x25')](_0x97bf('0x2e'));}RpcMemberReport['voiceQueueReport'](_0x200868[_0x2c5306]);}RpcVoiceQueueReport[_0x97bf('0x2f')](_0x200868[_0x2c5306]);}};function extractCalleridNumber(_0xc3da00){var _0x2c7c28=_0xc3da00[_0x97bf('0x30')](/<(.*?)>/);return _0x2c7c28?_0x2c7c28[0x1]:_0xc3da00;}Report['prototype'][_0x97bf('0x31')]=function(_0x5501c3){for(var _0x5015d5=0x0;_0x5015d50x0?!![]:![];if(!_0x16b01a){return this['syncQueueSummaryComplete'](this[_0x9141('0x17')][_0x9141('0x66')]);}};VoiceQueueReport[_0x9141('0xb')][_0x9141('0x1e')]=function(_0x1ac412){var _0x50c302=this[_0x9141('0x17')]['id'];if(this[_0x9141('0x17')]['queuestatus'][_0x50c302]&&this['summary'][_0x9141('0x5c')][_0x50c302][_0x1ac412[_0x9141('0x5b')]]){this[_0x9141('0x17')][_0x9141('0x5c')][_0x50c302][_0x1ac412[_0x9141('0x5b')]][_0x9141('0x12')]['push'](_0x1ac412);}};VoiceQueueReport[_0x9141('0xb')][_0x9141('0x1a')]=function(_0x10a1f8){var _0xcdf152=this;try{if(this['isNotNull'](_0x10a1f8)&&this[_0x9141('0x55')](_0x10a1f8[_0x9141('0x4a')])){logger[_0x9141('0x4d')](_0x9141('0x67'),util[_0x9141('0x3d')](_0x10a1f8,{'showHidden':![],'depth':null}));var _0x61fed9=this[_0x9141('0x15')][_0x10a1f8['queue']];if(_0x61fed9){logger[_0x9141('0x68')]('[voiceQueueReport][queuesummary]\x20name:%s',_0x61fed9[_0x9141('0x53')]);this[_0x9141('0x17')][_0x9141('0x5d')][_0x61fed9[_0x9141('0x53')]]={'summaryEvent':_0x10a1f8};this[_0x9141('0x17')][_0x9141('0x65')]+=0x1;return ami[_0x9141('0x5a')]({'action':_0x9141('0x5c'),'queue':_0x61fed9['name']})[_0x9141('0x69')](function(_0x29821e){if(!_0xcdf152[_0x9141('0x17')]['queuestatus'][_0x10a1f8[_0x9141('0x5b')]]){_0xcdf152[_0x9141('0x17')][_0x9141('0x5c')][_0x10a1f8[_0x9141('0x5b')]]={};}_0xcdf152[_0x9141('0x17')]['queuestatus'][_0x10a1f8['actionid']][_0x29821e['actionid']]={'queue':_0x61fed9[_0x9141('0x53')],'agents':[]};})[_0x9141('0x57')](function(_0x426623){throw _0x426623;});}}}catch(_0x37f651){logger['error'](_0x9141('0x6a'),util[_0x9141('0x3d')](_0x37f651,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x9141('0x1b')]=function(_0x1692a1){if(this[_0x9141('0x17')][_0x9141('0x65')]>0x0){this[_0x9141('0x17')][_0x9141('0x66')]=_0x1692a1;return;}logger[_0x9141('0x4d')](_0x9141('0x6b'),util[_0x9141('0x3d')](_0x1692a1,{'showHidden':![],'depth':null}));this[_0x9141('0x17')]=initializeSummary();ami[_0x9141('0x43')](_0x9141('0x6c'),{});};VoiceQueueReport[_0x9141('0xb')][_0x9141('0x6d')]=function(_0x3bbdb4){try{if(this['isNotNull'](_0x3bbdb4)){logger[_0x9141('0x4d')](_0x9141('0x6e'),_0x3bbdb4[_0x9141('0x47')],util[_0x9141('0x3d')](_0x3bbdb4,{'showHidden':![],'depth':null}));if(_[_0x9141('0x56')](this['queueReports'][_0x3bbdb4[_0x9141('0x47')]])){this[_0x9141('0x10')][_0x3bbdb4[_0x9141('0x47')]]=[];}if(_[_0x9141('0x56')](this[_0x9141('0x13')][_0x3bbdb4[_0x9141('0x47')]])){this[_0x9141('0x13')][_0x3bbdb4[_0x9141('0x47')]]={};}var _0x5a6f4e=new QueueReport();_0x5a6f4e['queue']=_0x3bbdb4[_0x9141('0x4a')];_0x5a6f4e[_0x9141('0x52')]=this[_0x9141('0x15')][_0x5a6f4e[_0x9141('0x4a')]]&&this[_0x9141('0x15')][_0x5a6f4e[_0x9141('0x4a')]]['type']?this['voiceQueues'][_0x5a6f4e['queue']][_0x9141('0x52')]||_0x9141('0x63'):_0x9141('0x63');_0x5a6f4e[_0x9141('0x6f')]=moment()[_0x9141('0x48')](_0x9141('0x70'));_0x5a6f4e[_0x9141('0x71')]=_0x3bbdb4[_0x9141('0x71')];_0x5a6f4e[_0x9141('0x72')]=_0x3bbdb4[_0x9141('0x72')];_0x5a6f4e['uniqueid']=_0x3bbdb4['uniqueid'];_0x5a6f4e[_0x9141('0x73')]=this['channels'][_0x3bbdb4[_0x9141('0x47')]][_0x9141('0x73')];logger[_0x9141('0x68')](_0x9141('0x74'),_0x5a6f4e['queue'],_0x5a6f4e[_0x9141('0x52')]);_[_0x9141('0x75')](_0x5a6f4e,_[_0x9141('0x76')](_0x3bbdb4,_['keys'](_0x5a6f4e)));this['queueReports'][_0x3bbdb4[_0x9141('0x47')]]['push'](_0x5a6f4e);this['channels'][_0x3bbdb4['uniqueid']]=_0x5a6f4e;this[_0x9141('0x44')](_0x5a6f4e,_0x9141('0x21'));}}catch(_0x1247eb){logger[_0x9141('0x3b')](_0x9141('0x6e'),_0x3bbdb4[_0x9141('0x47')],util[_0x9141('0x3d')](_0x1247eb,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x9141('0x77')]=function(_0x25581f){try{if(this['isNotNull'](_0x25581f)){logger[_0x9141('0x4d')](_0x9141('0x78'),_0x25581f[_0x9141('0x47')],util[_0x9141('0x3d')](_0x25581f,{'showHidden':![],'depth':null}));if(this[_0x9141('0x10')][_0x25581f[_0x9141('0x47')]]){var _0x473429=_[_0x9141('0x79')](this[_0x9141('0x10')][_0x25581f[_0x9141('0x47')]]);_0x473429['queuecallercomplete']=![];_0x473429[_0x9141('0x7a')]=null;_0x473429[_0x9141('0x7b')]=_0x25581f['holdtime'];_0x473429[_0x9141('0x7c')]=_0x25581f['originalposition'];_0x473429[_0x9141('0x22')]=!![];_0x473429['queuecallerabandonAt']=moment()[_0x9141('0x48')](_0x9141('0x70'));_0x473429[_0x9141('0x4f')]=_0x9141('0x7d');_0x473429[_0x9141('0x7e')]=null;logger[_0x9141('0x68')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x473429[_0x9141('0x4a')],_0x473429['type']);this[_0x9141('0x13')][_0x25581f['uniqueid']]=_0x473429;this[_0x9141('0x42')](_0x473429,_0x9141('0x22'));}}}catch(_0x272b5a){logger['error'](_0x9141('0x78'),_0x25581f[_0x9141('0x47')],util[_0x9141('0x3d')](_0x272b5a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9141('0xb')][_0x9141('0x7f')]=function(_0x1bae72){try{if(this['isNotNull'](_0x1bae72)){logger[_0x9141('0x4d')](_0x9141('0x80'),_0x1bae72[_0x9141('0x47')],util[_0x9141('0x3d')](_0x1bae72,{'showHidden':![],'depth':null}));if(this[_0x9141('0x10')][_0x1bae72[_0x9141('0x47')]]){var _0x16613a=_[_0x9141('0x79')](this[_0x9141('0x10')][_0x1bae72[_0x9141('0x47')]]);_0x16613a[_0x9141('0x81')]=moment()[_0x9141('0x48')](_0x9141('0x70'));_0x16613a[_0x9141('0x82')]=_0x1bae72['connectedlinenum'];_0x16613a[_0x9141('0x83')]=_0x1bae72[_0x9141('0x83')];logger['info'](_0x9141('0x84'),_0x16613a[_0x9141('0x4a')],_0x16613a['type'],_0x1bae72[_0x9141('0x82')],_0x1bae72[_0x9141('0x83')]);this['channels'][_0x1bae72['uniqueid']]=_0x16613a;this[_0x9141('0x44')](_0x16613a,_0x9141('0x23'));}}}catch(_0x87cea0){logger[_0x9141('0x3b')](_0x9141('0x80'),_0x1bae72[_0x9141('0x47')],util[_0x9141('0x3d')](_0x87cea0,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x9141('0x85')]=function(_0x4a5829){try{if(this[_0x9141('0x55')](_0x4a5829)){logger[_0x9141('0x4d')](_0x9141('0x86'),_0x4a5829[_0x9141('0x47')],util[_0x9141('0x3d')](_0x4a5829,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4a5829['uniqueid']]){var _0x5e7933=_[_0x9141('0x79')](this[_0x9141('0x10')][_0x4a5829[_0x9141('0x47')]]);_0x5e7933['queuecallercomplete']=!![];_0x5e7933[_0x9141('0x4f')]=_0x9141('0x87');logger[_0x9141('0x68')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x5e7933[_0x9141('0x4a')],_0x5e7933[_0x9141('0x52')]);}}}catch(_0x22c927){logger['error'](_0x9141('0x86'),_0x4a5829['uniqueid'],util[_0x9141('0x3d')](_0x22c927,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentComplete']=function(_0x374875){try{if(this[_0x9141('0x55')](_0x374875)){logger[_0x9141('0x4d')]('[%s][voiceQueueReport][agentcomplete]',_0x374875[_0x9141('0x47')],util['inspect'](_0x374875,{'showHidden':![],'depth':null}));if(this[_0x9141('0x10')][_0x374875['uniqueid']]){var _0x55e6c1=_['last'](this['queueReports'][_0x374875[_0x9141('0x47')]]);_0x55e6c1[_0x9141('0x22')]=![];_0x55e6c1[_0x9141('0x88')]=null;_0x55e6c1['assigned']=!![];_0x55e6c1[_0x9141('0x7e')]=_0x374875[_0x9141('0x89')];_0x55e6c1[_0x9141('0x7b')]=_0x374875[_0x9141('0x7b')];_0x55e6c1[_0x9141('0x8a')]=!![];_0x55e6c1['queuecallerexit']=![];_0x55e6c1[_0x9141('0x8b')]=null;if(!_0x55e6c1[_0x9141('0x8c')]){if(_0x374875[_0x9141('0x8d')]==_0x9141('0x8c')){_0x55e6c1[_0x9141('0x4f')]=_0x9141('0x8e');logger[_0x9141('0x68')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x55e6c1['queue'],_0x55e6c1[_0x9141('0x52')]);}else{if(_[_0x9141('0x8f')](_0x374875[_0x9141('0x38')][_0x9141('0x90')](),_0x9141('0x91'))){if(this[_0x9141('0x10')][_0x374875[_0x9141('0x92')]]){var _0x1cecb4=_[_0x9141('0x79')](this[_0x9141('0x10')][_0x374875[_0x9141('0x92')]]);_0x1cecb4['queuecallercomplete']=![];_0x1cecb4['queuecallerexit']=!![];_0x1cecb4[_0x9141('0x8b')]=moment(_0x55e6c1[_0x9141('0x6f')])[_0x9141('0x93')](_0x374875['holdtime'],_0x9141('0x94'))['format'](_0x9141('0x70'));_0x1cecb4[_0x9141('0x4f')]=_0x9141('0x95');_0x1cecb4['transfer']=!![];_0x1cecb4[_0x9141('0x96')]=_0x9141('0x97');_0x1cecb4[_0x9141('0x98')]=_0x374875['destexten'];_0x1cecb4[_0x9141('0x99')]=_0x374875[_0x9141('0x47')];logger[_0x9141('0x68')](_0x9141('0x9a'),_0x1cecb4[_0x9141('0x4a')],_0x1cecb4[_0x9141('0x52')]);var _0x2a50e7=this['queueReports'][_0x374875[_0x9141('0x92')]];this[_0x9141('0x10')][_0x374875['linkedid']]=this[_0x9141('0x10')][_0x374875[_0x9141('0x47')]];this[_0x9141('0x10')][_0x374875[_0x9141('0x47')]]=_0x2a50e7;}}else{_0x55e6c1[_0x9141('0x4f')]=_0x9141('0x9b')+_0x374875[_0x9141('0x8d')][_0x9141('0x9c')]();logger[_0x9141('0x68')](_0x9141('0x9d'),_0x55e6c1[_0x9141('0x4a')],_0x55e6c1['type'],_0x55e6c1[_0x9141('0x4f')]);}}}this['channels'][_0x374875['uniqueid']]=_0x55e6c1;this[_0x9141('0x42')](_0x55e6c1,'agentcomplete');}}}catch(_0x3e9c8c){logger[_0x9141('0x3b')](_0x9141('0x9e'),_0x374875['uniqueid'],util[_0x9141('0x3d')](_0x3e9c8c,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x9141('0x24')]=function(_0x27194c){try{if(this['isNotNull'](_0x27194c)){logger[_0x9141('0x4d')]('[%s][voiceQueueReport][varset]',_0x27194c['uniqueid'],util['inspect'](_0x27194c,{'showHidden':![],'depth':null}));this[_0x9141('0x9f')](_0x27194c[_0x9141('0x47')],_[_0x9141('0xa0')](_0x27194c['variable'])[0x0],_0x27194c[_0x9141('0xa1')]);if(this[_0x9141('0x10')][_0x27194c[_0x9141('0x47')]]){var _0x4aec6c=_['last'](this[_0x9141('0x10')][_0x27194c[_0x9141('0x47')]]);if(_0x4aec6c){if(this[_0x9141('0x55')](_0x27194c[_0x9141('0xa2')])&&this[_0x9141('0x55')](_0x27194c[_0x9141('0xa2')][_0x9141('0x5c')])){switch(_0x27194c[_0x9141('0xa1')]){case _0x9141('0xa3'):_0x4aec6c[_0x9141('0xa4')]=![];_0x4aec6c[_0x9141('0x8b')]=null;break;case'TIMEOUT':_0x4aec6c[_0x9141('0xa5')]='timeout';_0x4aec6c[_0x9141('0xa4')]=!![];_0x4aec6c['queuecallerexitAt']=moment()[_0x9141('0x48')](_0x9141('0x70'));_0x4aec6c[_0x9141('0x81')]=moment()[_0x9141('0x48')](_0x9141('0x70'));logger['debug'](_0x9141('0xa6'),_0x27194c[_0x9141('0x47')],util[_0x9141('0x3d')](_0x4aec6c,{'showHidden':![],'depth':null}));ami[_0x9141('0x43')](_0x9141('0xa7'),_0x4aec6c);break;default:_0x4aec6c[_0x9141('0xa4')]=!![];_0x4aec6c[_0x9141('0x8b')]=moment()[_0x9141('0x48')]('YYYY-MM-DD\x20HH:mm:ss');_0x4aec6c[_0x9141('0x81')]=moment()[_0x9141('0x48')](_0x9141('0x70'));}_0x4aec6c[_0x9141('0x22')]=![];_0x4aec6c[_0x9141('0x88')]=null;_0x4aec6c['queuecallerexitreason']=_0x27194c[_0x9141('0xa1')];this[_0x9141('0x13')][_0x27194c['uniqueid']]=_0x4aec6c;this[_0x9141('0x42')](_0x4aec6c,_0x9141('0xa8'));}else if(this[_0x9141('0x55')](_0x27194c['variable'])&&this[_0x9141('0x55')](_0x27194c[_0x9141('0xa2')][_0x9141('0xa9')])){if(!_0x4aec6c['queuecallerabandon']){_0x4aec6c['queuecallerexit']=!![];_0x4aec6c[_0x9141('0x8b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4aec6c[_0x9141('0x4f')]=_0x9141('0xaa');_0x4aec6c[_0x9141('0x81')]=moment()[_0x9141('0x48')](_0x9141('0x70'));this[_0x9141('0x13')][_0x27194c[_0x9141('0x47')]]=_0x4aec6c;}}logger[_0x9141('0x68')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x27194c[_0x9141('0x47')],_0x4aec6c[_0x9141('0x4a')],_0x4aec6c[_0x9141('0x52')],_[_0x9141('0xa0')](_0x27194c[_0x9141('0xa2')])[0x0],_0x27194c[_0x9141('0xa1')]);_0x4aec6c[_0x9141('0x18')]=this['variables'][_0x27194c['uniqueid']];}}}}catch(_0x35ec31){logger['error'](_0x9141('0xab'),_0x27194c[_0x9141('0x47')],util[_0x9141('0x3d')](_0x35ec31,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9141('0xb')][_0x9141('0x9f')]=function(_0x4d4e1f,_0x12139e,_0x2556ec){var _0x3a2ffc=['rtpaudioqos',_0x9141('0xac'),_0x9141('0xad'),_0x9141('0xae'),_0x9141('0xaf'),'rtpaudioqoslossbridged',_0x9141('0xb0'),'rtpaudioqosrttbridged','sipcallid',_0x9141('0xb1'),'bridgepeer',_0x9141('0xb2'),'membercalls',_0x9141('0xb3'),'memberinterface',_0x9141('0xb4'),_0x9141('0x89'),_0x9141('0xb5'),_0x9141('0xb6')];if(!_[_0x9141('0x37')](_0x12139e)&&!_[_0x9141('0xb7')](_0x3a2ffc,_0x12139e)){if(_['isUndefined'](this[_0x9141('0x18')][_0x4d4e1f])){this['variables'][_0x4d4e1f]={};}this[_0x9141('0x18')][_0x4d4e1f][_0x12139e]=_0x2556ec;}};VoiceQueueReport[_0x9141('0xb')][_0x9141('0xb8')]=function(_0x555575,_0x56325b,_0x5ae111){var _0x114244={};for(var _0x59b45b=0x0;_0x59b45b0x0?!![]:![];if(!_0x3afcc0){return this['syncQueueSummaryComplete'](this['summary'][_0x55d1('0x6b')]);}};VoiceQueueReport['prototype'][_0x55d1('0x6c')]=function(_0x1b8e32){var _0x35700b=this[_0x55d1('0x17')]['id'];if(this[_0x55d1('0x17')][_0x55d1('0x5f')][_0x35700b]&&this[_0x55d1('0x17')][_0x55d1('0x5f')][_0x35700b][_0x1b8e32['actionid']]){this[_0x55d1('0x17')][_0x55d1('0x5f')][_0x35700b][_0x1b8e32['actionid']][_0x55d1('0x12')]['push'](_0x1b8e32);}};VoiceQueueReport[_0x55d1('0xc')][_0x55d1('0x1a')]=function(_0x5673dd){var _0x5d7947=this;try{if(this['isNotNull'](_0x5673dd)&&this[_0x55d1('0x6d')](_0x5673dd['queue'])){logger[_0x55d1('0x50')](_0x55d1('0x6e'),util[_0x55d1('0x42')](_0x5673dd,{'showHidden':![],'depth':null}));var _0x236ba1=this['voiceQueues'][_0x5673dd[_0x55d1('0x4c')]];if(_0x236ba1){logger['info'](_0x55d1('0x6f'),_0x236ba1[_0x55d1('0x56')]);this[_0x55d1('0x17')][_0x55d1('0x61')][_0x236ba1['name']]={'summaryEvent':_0x5673dd};this[_0x55d1('0x17')]['statusRequests']+=0x1;return ami['Action']({'action':'queuestatus','queue':_0x236ba1['name']})[_0x55d1('0x5c')](function(_0x28cdd){if(!_0x5d7947[_0x55d1('0x17')][_0x55d1('0x5f')][_0x5673dd[_0x55d1('0x5d')]]){_0x5d7947['summary'][_0x55d1('0x5f')][_0x5673dd[_0x55d1('0x5d')]]={};}_0x5d7947[_0x55d1('0x17')][_0x55d1('0x5f')][_0x5673dd[_0x55d1('0x5d')]][_0x28cdd[_0x55d1('0x5d')]]={'queue':_0x236ba1[_0x55d1('0x56')],'agents':[]};})[_0x55d1('0x5a')](function(_0xa09e83){throw _0xa09e83;});}}}catch(_0x4ba1b9){logger[_0x55d1('0x40')](_0x55d1('0x70'),util[_0x55d1('0x42')](_0x4ba1b9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x55d1('0xc')][_0x55d1('0x1c')]=function(_0xfc7036){if(this[_0x55d1('0x17')][_0x55d1('0x6a')]>0x0){this[_0x55d1('0x17')][_0x55d1('0x6b')]=_0xfc7036;return;}logger['debug'](_0x55d1('0x71'),util[_0x55d1('0x42')](_0xfc7036,{'showHidden':![],'depth':null}));this[_0x55d1('0x17')]=initializeSummary();ami[_0x55d1('0x46')]('custom:queuesummarycomplete',{});};VoiceQueueReport[_0x55d1('0xc')]['syncQueueCallerJoin']=function(_0x3ac2d2){try{if(this[_0x55d1('0x6d')](_0x3ac2d2)){logger[_0x55d1('0x50')](_0x55d1('0x72'),_0x3ac2d2[_0x55d1('0x49')],util[_0x55d1('0x42')](_0x3ac2d2,{'showHidden':![],'depth':null}));if(_[_0x55d1('0x58')](this[_0x55d1('0x10')][_0x3ac2d2[_0x55d1('0x49')]])){this[_0x55d1('0x10')][_0x3ac2d2['uniqueid']]=[];}if(_[_0x55d1('0x58')](this['channels'][_0x3ac2d2[_0x55d1('0x49')]])){this['channels'][_0x3ac2d2['uniqueid']]={};}var _0x1d5721=new QueueReport();_0x1d5721[_0x55d1('0x4c')]=_0x3ac2d2[_0x55d1('0x4c')];_0x1d5721[_0x55d1('0x54')]=this[_0x55d1('0x15')][_0x1d5721['queue']]&&this[_0x55d1('0x15')][_0x1d5721[_0x55d1('0x4c')]]['type']?this['voiceQueues'][_0x1d5721[_0x55d1('0x4c')]]['type']||_0x55d1('0x55'):_0x55d1('0x55');_0x1d5721['queuecallerjoinAt']=moment()[_0x55d1('0x4a')](_0x55d1('0x73'));_0x1d5721[_0x55d1('0x74')]=_0x3ac2d2[_0x55d1('0x74')];_0x1d5721['count']=_0x3ac2d2[_0x55d1('0x75')];_0x1d5721[_0x55d1('0x49')]=_0x3ac2d2[_0x55d1('0x49')];_0x1d5721[_0x55d1('0x76')]=this['channels'][_0x3ac2d2[_0x55d1('0x49')]][_0x55d1('0x76')];logger[_0x55d1('0x77')](_0x55d1('0x78'),_0x1d5721[_0x55d1('0x4c')],_0x1d5721[_0x55d1('0x54')]);_['merge'](_0x1d5721,_['pick'](_0x3ac2d2,_[_0x55d1('0x79')](_0x1d5721)));this['queueReports'][_0x3ac2d2['uniqueid']][_0x55d1('0x7a')](_0x1d5721);this[_0x55d1('0x13')][_0x3ac2d2['uniqueid']]=_0x1d5721;this[_0x55d1('0x47')](_0x1d5721,'queuecallerjoin');}}catch(_0x3e9e54){logger['error']('[%s][voiceQueueReport][queuecallerjoin]',_0x3ac2d2[_0x55d1('0x49')],util[_0x55d1('0x42')](_0x3e9e54,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x55d1('0xc')][_0x55d1('0x1f')]=function(_0x2a6b73){try{if(this['isNotNull'](_0x2a6b73)){logger[_0x55d1('0x50')](_0x55d1('0x7b'),_0x2a6b73[_0x55d1('0x49')],util[_0x55d1('0x42')](_0x2a6b73,{'showHidden':![],'depth':null}));if(this[_0x55d1('0x10')][_0x2a6b73[_0x55d1('0x49')]]){var _0x8605c1=_[_0x55d1('0x7c')](this[_0x55d1('0x10')][_0x2a6b73[_0x55d1('0x49')]]);_0x8605c1[_0x55d1('0x7d')]=![];_0x8605c1[_0x55d1('0x7e')]=null;_0x8605c1['holdtime']=_0x2a6b73['holdtime'];_0x8605c1[_0x55d1('0x7f')]=_0x2a6b73[_0x55d1('0x7f')];_0x8605c1[_0x55d1('0x1e')]=!![];_0x8605c1[_0x55d1('0x80')]=moment()[_0x55d1('0x4a')](_0x55d1('0x73'));_0x8605c1[_0x55d1('0x81')]=_0x55d1('0x82');_0x8605c1[_0x55d1('0x83')]=null;logger[_0x55d1('0x77')](_0x55d1('0x84'),_0x8605c1[_0x55d1('0x4c')],_0x8605c1[_0x55d1('0x54')]);this['channels'][_0x2a6b73[_0x55d1('0x49')]]=_0x8605c1;this[_0x55d1('0x4f')](_0x8605c1,'queuecallerabandon');}}}catch(_0x484792){logger[_0x55d1('0x40')]('[%s][voiceQueueReport][queuecallerabandon]',_0x2a6b73[_0x55d1('0x49')],util['inspect'](_0x484792,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x55d1('0xc')][_0x55d1('0x21')]=function(_0x4cf2b0){try{if(this[_0x55d1('0x6d')](_0x4cf2b0)){logger[_0x55d1('0x50')](_0x55d1('0x85'),_0x4cf2b0['uniqueid'],util[_0x55d1('0x42')](_0x4cf2b0,{'showHidden':![],'depth':null}));if(this[_0x55d1('0x10')][_0x4cf2b0['uniqueid']]){var _0xdc440d=_['last'](this[_0x55d1('0x10')][_0x4cf2b0[_0x55d1('0x49')]]);_0xdc440d['queuecallerleaveAt']=moment()[_0x55d1('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');_0xdc440d[_0x55d1('0x86')]=_0x4cf2b0[_0x55d1('0x86')];_0xdc440d[_0x55d1('0x87')]=_0x4cf2b0[_0x55d1('0x87')];logger['info']('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0xdc440d['queue'],_0xdc440d[_0x55d1('0x54')],_0x4cf2b0[_0x55d1('0x86')],_0x4cf2b0[_0x55d1('0x87')]);this[_0x55d1('0x13')][_0x4cf2b0[_0x55d1('0x49')]]=_0xdc440d;this['emitVoiceQueueChannelSave'](_0xdc440d,_0x55d1('0x20'));}}}catch(_0x2436cb){logger[_0x55d1('0x40')](_0x55d1('0x85'),_0x4cf2b0[_0x55d1('0x49')],util[_0x55d1('0x42')](_0x2436cb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x55d1('0xc')][_0x55d1('0x24')]=function(_0x5c6b31){try{if(this[_0x55d1('0x6d')](_0x5c6b31)){logger[_0x55d1('0x50')](_0x55d1('0x88'),_0x5c6b31[_0x55d1('0x49')],util[_0x55d1('0x42')](_0x5c6b31,{'showHidden':![],'depth':null}));if(this[_0x55d1('0x10')][_0x5c6b31[_0x55d1('0x49')]]){var _0x2094aa=_[_0x55d1('0x7c')](this['queueReports'][_0x5c6b31['uniqueid']]);_0x2094aa[_0x55d1('0x7d')]=!![];_0x2094aa[_0x55d1('0x81')]=_0x55d1('0x89');logger[_0x55d1('0x77')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x2094aa[_0x55d1('0x4c')],_0x2094aa[_0x55d1('0x54')]);}}}catch(_0x11203b){logger[_0x55d1('0x40')](_0x55d1('0x88'),_0x5c6b31['uniqueid'],util['inspect'](_0x11203b,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x55d1('0x8a')]=function(_0x3dfe9a){try{if(this[_0x55d1('0x6d')](_0x3dfe9a)){logger['debug']('[%s][voiceQueueReport][agentcomplete]',_0x3dfe9a[_0x55d1('0x49')],util[_0x55d1('0x42')](_0x3dfe9a,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x3dfe9a['uniqueid']]){var _0x43330c=_[_0x55d1('0x7c')](this['queueReports'][_0x3dfe9a['uniqueid']]);_0x43330c[_0x55d1('0x1e')]=![];_0x43330c[_0x55d1('0x80')]=null;_0x43330c[_0x55d1('0x8b')]=!![];_0x43330c[_0x55d1('0x83')]=_0x3dfe9a['membername'];_0x43330c[_0x55d1('0x8c')]=_0x3dfe9a[_0x55d1('0x8c')];_0x43330c[_0x55d1('0x7d')]=!![];_0x43330c['queuecallerexit']=![];_0x43330c[_0x55d1('0x8d')]=null;if(!_0x43330c[_0x55d1('0x8e')]){if(_0x3dfe9a[_0x55d1('0x8f')]==_0x55d1('0x8e')){_0x43330c['queuecallerexitreason']=_0x55d1('0x90');logger[_0x55d1('0x77')](_0x55d1('0x91'),_0x43330c[_0x55d1('0x4c')],_0x43330c[_0x55d1('0x54')]);}else{if(_['startsWith'](_0x3dfe9a[_0x55d1('0x3e')][_0x55d1('0x92')](),_0x55d1('0x93'))){if(this[_0x55d1('0x10')][_0x3dfe9a[_0x55d1('0x94')]]){var _0x539f14=_[_0x55d1('0x7c')](this['queueReports'][_0x3dfe9a['linkedid']]);_0x539f14['queuecallercomplete']=![];_0x539f14[_0x55d1('0x95')]=!![];_0x539f14[_0x55d1('0x8d')]=moment(_0x43330c[_0x55d1('0x96')])[_0x55d1('0x97')](_0x3dfe9a[_0x55d1('0x8c')],_0x55d1('0x98'))[_0x55d1('0x4a')](_0x55d1('0x73'));_0x539f14['queuecallerexitreason']=_0x55d1('0x99');_0x539f14[_0x55d1('0x8e')]=!![];_0x539f14[_0x55d1('0x9a')]='FORWARD';_0x539f14[_0x55d1('0x9b')]=_0x3dfe9a[_0x55d1('0x9c')];_0x539f14[_0x55d1('0x9d')]=_0x3dfe9a[_0x55d1('0x49')];logger[_0x55d1('0x77')](_0x55d1('0x9e'),_0x539f14[_0x55d1('0x4c')],_0x539f14[_0x55d1('0x54')]);var _0x556fb2=this[_0x55d1('0x10')][_0x3dfe9a[_0x55d1('0x94')]];this[_0x55d1('0x10')][_0x3dfe9a['linkedid']]=this['queueReports'][_0x3dfe9a[_0x55d1('0x49')]];this[_0x55d1('0x10')][_0x3dfe9a['uniqueid']]=_0x556fb2;}}else{_0x43330c[_0x55d1('0x81')]=_0x55d1('0x9f')+_0x3dfe9a[_0x55d1('0x8f')][_0x55d1('0xa0')]();logger['info'](_0x55d1('0xa1'),_0x43330c['queue'],_0x43330c[_0x55d1('0x54')],_0x43330c[_0x55d1('0x81')]);}}}this['channels'][_0x3dfe9a[_0x55d1('0x49')]]=_0x43330c;this[_0x55d1('0x4f')](_0x43330c,_0x55d1('0x22'));}}}catch(_0x164912){logger[_0x55d1('0x40')](_0x55d1('0xa2'),_0x3dfe9a[_0x55d1('0x49')],util['inspect'](_0x164912,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x55d1('0xc')][_0x55d1('0x26')]=function(_0x2e291f){try{if(this[_0x55d1('0x6d')](_0x2e291f)){logger[_0x55d1('0x50')](_0x55d1('0xa3'),_0x2e291f[_0x55d1('0x49')],util['inspect'](_0x2e291f,{'showHidden':![],'depth':null}));this[_0x55d1('0xa4')](_0x2e291f[_0x55d1('0x49')],_[_0x55d1('0x79')](_0x2e291f[_0x55d1('0xa5')])[0x0],_0x2e291f[_0x55d1('0xa6')]);if(this['queueReports'][_0x2e291f['uniqueid']]){var _0x4ebb83=_[_0x55d1('0x7c')](this[_0x55d1('0x10')][_0x2e291f[_0x55d1('0x49')]]);if(_0x4ebb83){if(this[_0x55d1('0x6d')](_0x2e291f[_0x55d1('0xa5')])&&this[_0x55d1('0x6d')](_0x2e291f['variable'][_0x55d1('0x5f')])){switch(_0x2e291f[_0x55d1('0xa6')]){case _0x55d1('0xa7'):_0x4ebb83[_0x55d1('0x95')]=![];_0x4ebb83[_0x55d1('0x8d')]=null;break;case _0x55d1('0xa8'):_0x4ebb83[_0x55d1('0xa9')]='timeout';_0x4ebb83[_0x55d1('0x95')]=!![];_0x4ebb83[_0x55d1('0x8d')]=moment()[_0x55d1('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');_0x4ebb83['queuecallerleaveAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');logger['debug'](_0x55d1('0xaa'),_0x2e291f[_0x55d1('0x49')],util[_0x55d1('0x42')](_0x4ebb83,{'showHidden':![],'depth':null}));ami[_0x55d1('0x46')](_0x55d1('0xab'),_0x4ebb83);break;default:_0x4ebb83[_0x55d1('0x95')]=!![];_0x4ebb83[_0x55d1('0x8d')]=moment()[_0x55d1('0x4a')](_0x55d1('0x73'));_0x4ebb83[_0x55d1('0xac')]=moment()['format'](_0x55d1('0x73'));}_0x4ebb83[_0x55d1('0x1e')]=![];_0x4ebb83[_0x55d1('0x80')]=null;_0x4ebb83[_0x55d1('0x81')]=_0x2e291f[_0x55d1('0xa6')];this['channels'][_0x2e291f['uniqueid']]=_0x4ebb83;this[_0x55d1('0x4f')](_0x4ebb83,_0x55d1('0x25'));}else if(this['isNotNull'](_0x2e291f[_0x55d1('0xa5')])&&this[_0x55d1('0x6d')](_0x2e291f[_0x55d1('0xa5')][_0x55d1('0xad')])){if(!_0x4ebb83[_0x55d1('0x1e')]){_0x4ebb83[_0x55d1('0x95')]=!![];_0x4ebb83[_0x55d1('0x8d')]=moment()[_0x55d1('0x4a')](_0x55d1('0x73'));_0x4ebb83['queuecallerexitreason']=_0x55d1('0xae');_0x4ebb83['queuecallerleaveAt']=moment()[_0x55d1('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x55d1('0x13')][_0x2e291f[_0x55d1('0x49')]]=_0x4ebb83;}}logger[_0x55d1('0x77')](_0x55d1('0xaf'),_0x2e291f[_0x55d1('0x49')],_0x4ebb83[_0x55d1('0x4c')],_0x4ebb83[_0x55d1('0x54')],_['keys'](_0x2e291f[_0x55d1('0xa5')])[0x0],_0x2e291f['value']);_0x4ebb83[_0x55d1('0x18')]=this['variables'][_0x2e291f[_0x55d1('0x49')]];}}}}catch(_0x14383f){logger[_0x55d1('0x40')]('[%s][voiceQueueReport][varset]',_0x2e291f[_0x55d1('0x49')],util[_0x55d1('0x42')](_0x14383f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x55d1('0xc')][_0x55d1('0xa4')]=function(_0x13694d,_0x39be78,_0x53927b){var _0x105168=[_0x55d1('0xb0'),_0x55d1('0xb1'),_0x55d1('0xb2'),_0x55d1('0xb3'),'rtpaudioqosloss','rtpaudioqoslossbridged',_0x55d1('0xb4'),_0x55d1('0xb5'),'sipcallid',_0x55d1('0xb6'),_0x55d1('0xb7'),'bridgepvtcallid',_0x55d1('0xb8'),_0x55d1('0xb9'),_0x55d1('0xba'),_0x55d1('0xbb'),_0x55d1('0xbc'),_0x55d1('0xbd'),_0x55d1('0xbe')];if(!_[_0x55d1('0x3c')](_0x39be78)&&!_[_0x55d1('0xbf')](_0x105168,_0x39be78)){if(_[_0x55d1('0x58')](this['variables'][_0x13694d])){this[_0x55d1('0x18')][_0x13694d]={};}this[_0x55d1('0x18')][_0x13694d][_0x39be78]=_0x53927b;}};VoiceQueueReport['prototype'][_0x55d1('0xc0')]=function(_0x3d8f48,_0x509aa3,_0x1daea1){var _0x27dec5={};for(var _0x6f71b7=0x0;_0x6f71b7=0x0?moment(_0x1f15da[_0x14f3('0x16')])[_0x14f3('0xc')](_0x1f15da[_0x14f3('0x15')],_0x14f3('0xd')):null,'data1':_0x14f3('0x17'),'data2':_0x1f15da['accountcode'],'data3':_0x1f15da[_0x14f3('0xf')],'data4':_0x1f15da[_0x14f3('0x18')]||null,'role':_0x14f3('0x10'),'internal':_0x1f15da['accountcode']?_[_0x14f3('0x19')](_0x1f15da['accountcode']):undefined,'uniqueid':_0x1f15da[_0x14f3('0x12')]},'log':_0x14f3('0x6')});}; \ No newline at end of file +var _0xd927=['lodash','util','../client','voiceQueueReport','queuecallerexitAt','Request','voice','lastAssignedTo','isNil','interface','format','SIP/%s','TALKING','diff','inbound','calleridnum','exten','queue','agent','accountcode','toNumber','uniqueid','CreateMemberReport','voiceDialReport','endtime','starttime','seconds','outbound','dialstring'];(function(_0x495f97,_0x450a7a){var _0x20eb45=function(_0x274205){while(--_0x274205){_0x495f97['push'](_0x495f97['shift']());}};_0x20eb45(++_0x450a7a);}(_0xd927,0x13f));var _0x7d92=function(_0x5968ab,_0x5d6e8e){_0x5968ab=_0x5968ab-0x0;var _0x3c92cc=_0xd927[_0x5968ab];return _0x3c92cc;};'use strict';var moment=require('moment');var _=require(_0x7d92('0x0'));var util=require(_0x7d92('0x1'));var client=require(_0x7d92('0x2'));exports[_0x7d92('0x3')]=function(_0x47b5a4){var _0x23080b=_0x47b5a4['queuecallercompleteAt']||_0x47b5a4[_0x7d92('0x4')];return client[_0x7d92('0x5')]('CreateMemberReport',{'body':{'channel':_0x7d92('0x6'),'membername':_0x47b5a4[_0x7d92('0x7')],'interface':_[_0x7d92('0x8')](_0x47b5a4[_0x7d92('0x9')])?util[_0x7d92('0xa')](_0x7d92('0xb'),_0x47b5a4[_0x7d92('0x7')]):_0x47b5a4[_0x7d92('0x9')],'type':_0x7d92('0xc'),'enterAt':_0x47b5a4['queuecallerleaveAt'],'exitAt':_0x23080b,'duration':moment(_0x23080b)[_0x7d92('0xd')](_0x47b5a4['queuecallerleaveAt'],'seconds'),'data1':_0x7d92('0xe'),'data2':_0x47b5a4[_0x7d92('0xf')],'data3':_0x47b5a4[_0x7d92('0x10')],'data4':null,'data5':_0x47b5a4[_0x7d92('0x11')],'role':_0x7d92('0x12'),'internal':_0x47b5a4[_0x7d92('0x13')]?_[_0x7d92('0x14')](_0x47b5a4['accountcode']):undefined,'uniqueid':_0x47b5a4[_0x7d92('0x15')]},'log':_0x7d92('0x16')});};exports[_0x7d92('0x17')]=function(_0x484109){return client['Request']('CreateMemberReport',{'body':{'channel':_0x7d92('0x6'),'membername':_0x484109['membername'],'interface':_0x484109[_0x7d92('0x9')],'type':_0x7d92('0xc'),'enterAt':_0x484109['starttime'],'exitAt':_0x484109[_0x7d92('0x18')],'duration':moment(_0x484109[_0x7d92('0x18')])[_0x7d92('0xd')](_0x484109[_0x7d92('0x19')],_0x7d92('0x1a'))>=0x0?moment(_0x484109[_0x7d92('0x18')])[_0x7d92('0xd')](_0x484109[_0x7d92('0x19')],_0x7d92('0x1a')):null,'data1':_0x7d92('0x1b'),'data2':_0x484109['accountcode'],'data3':_0x484109[_0x7d92('0x10')],'data4':_0x484109[_0x7d92('0x1c')]||null,'role':_0x7d92('0x12'),'internal':_0x484109[_0x7d92('0x13')]?_[_0x7d92('0x14')](_0x484109[_0x7d92('0x13')]):undefined,'uniqueid':_0x484109['uniqueid']},'log':_0x7d92('0x16')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index a252f9c..120878e 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 _0xbff2=['ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client','getSettings','Request'];(function(_0x171c89,_0x55bb44){var _0x1fec26=function(_0x2f490c){while(--_0x2f490c){_0x171c89['push'](_0x171c89['shift']());}};_0x1fec26(++_0x55bb44);}(_0xbff2,0x10e));var _0x2bff=function(_0x5b55b1,_0x485316){_0x5b55b1=_0x5b55b1-0x0;var _0x3668de=_0xbff2[_0x5b55b1];return _0x3668de;};'use strict';var client=require(_0x2bff('0x0'));exports[_0x2bff('0x1')]=function(){return client[_0x2bff('0x2')](_0x2bff('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x2bff('0x4'),_0x2bff('0x5')]},'log':_0x2bff('0x6')});}; \ No newline at end of file +var _0x0135=['../client','getSettings','Request','ShowSetting'];(function(_0x109946,_0x3494b7){var _0x4ed20b=function(_0x578aa4){while(--_0x578aa4){_0x109946['push'](_0x109946['shift']());}};_0x4ed20b(++_0x3494b7);}(_0x0135,0x188));var _0x5013=function(_0x180c1f,_0x23c6a5){_0x180c1f=_0x180c1f-0x0;var _0x252453=_0x0135[_0x180c1f];return _0x252453;};'use strict';var client=require(_0x5013('0x0'));exports[_0x5013('0x1')]=function(){return client[_0x5013('0x2')](_0x5013('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer','previewRecallmeReminderInterval']},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 5bd3644..34e589b 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 _0x3bbd=['getTemplates','Request','GetTemplate','name','../client'];(function(_0x529a98,_0x554b38){var _0x170bee=function(_0x507dd6){while(--_0x507dd6){_0x529a98['push'](_0x529a98['shift']());}};_0x170bee(++_0x554b38);}(_0x3bbd,0x1b2));var _0xd3bb=function(_0x17d4a4,_0x24c32b){_0x17d4a4=_0x17d4a4-0x0;var _0x28b29e=_0x3bbd[_0x17d4a4];return _0x28b29e;};'use strict';var client=require(_0xd3bb('0x0'));exports[_0xd3bb('0x1')]=function(_0x1fa2aa){return function(_0x1a2b09){return client[_0xd3bb('0x2')](_0xd3bb('0x3'),{'options':{'raw':!![],'attributes':['id',_0xd3bb('0x4'),'html']},'log':'GetTemplate'});};}; \ No newline at end of file +var _0xcfd7=['html','../client','Request','name'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0xcfd7,0x199));var _0x7cfd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcfd7[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x7cfd('0x0'));exports['getTemplates']=function(_0x205d38){return function(_0xe9f286){return client[_0x7cfd('0x1')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x7cfd('0x2'),_0x7cfd('0x3')]},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 8c83e37..095f823 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 _0xbf3c=['value','Action','Actions','action','data1','data2','data3','data4','data5','data6','data7','../client','getTriggers','Request','GetTrigger','name','channel','status','field','operator','Condition','AnyConditions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbf3c,0xfd));var _0xcbf3=function(_0x5e9684,_0x105399){_0x5e9684=_0x5e9684-0x0;var _0x3e09a1=_0xbf3c[_0x5e9684];return _0x3e09a1;};'use strict';var client=require(_0xcbf3('0x0'));exports[_0xcbf3('0x1')]=function(_0x5966f5){return function(_0x188339){return client[_0xcbf3('0x2')](_0xcbf3('0x3'),{'options':{'raw':![],'attributes':['id',_0xcbf3('0x4'),_0xcbf3('0x5'),_0xcbf3('0x6')],'include':[{'model':'Condition','as':'AllConditions','attributes':['id',_0xcbf3('0x7'),_0xcbf3('0x8'),'value']},{'model':_0xcbf3('0x9'),'as':_0xcbf3('0xa'),'attributes':['id','field',_0xcbf3('0x8'),_0xcbf3('0xb')]},{'model':_0xcbf3('0xc'),'as':_0xcbf3('0xd'),'attributes':['id',_0xcbf3('0xe'),_0xcbf3('0xf'),_0xcbf3('0x10'),_0xcbf3('0x11'),_0xcbf3('0x12'),_0xcbf3('0x13'),_0xcbf3('0x14'),_0xcbf3('0x15')]}]},'log':_0xcbf3('0x3')});};}; \ No newline at end of file +var _0x9c88=['Request','GetTrigger','name','status','field','value','Condition','operator','Action','action','data1','data3','data5','data6','data7','../client','getTriggers'];(function(_0x5f3905,_0x43a651){var _0x2923b1=function(_0x3c72d8){while(--_0x3c72d8){_0x5f3905['push'](_0x5f3905['shift']());}};_0x2923b1(++_0x43a651);}(_0x9c88,0x11f));var _0x89c8=function(_0x18c284,_0x1cd679){_0x18c284=_0x18c284-0x0;var _0x2fdf50=_0x9c88[_0x18c284];return _0x2fdf50;};'use strict';var client=require(_0x89c8('0x0'));exports[_0x89c8('0x1')]=function(_0x5d58bc){return function(_0x395db3){return client[_0x89c8('0x2')](_0x89c8('0x3'),{'options':{'raw':![],'attributes':['id',_0x89c8('0x4'),'channel',_0x89c8('0x5')],'include':[{'model':'Condition','as':'AllConditions','attributes':['id',_0x89c8('0x6'),'operator',_0x89c8('0x7')]},{'model':_0x89c8('0x8'),'as':'AnyConditions','attributes':['id',_0x89c8('0x6'),_0x89c8('0x9'),_0x89c8('0x7')]},{'model':_0x89c8('0xa'),'as':'Actions','attributes':['id',_0x89c8('0xb'),_0x89c8('0xc'),'data2',_0x89c8('0xd'),'data4',_0x89c8('0xe'),_0x89c8('0xf'),_0x89c8('0x10')]}]},'log':_0x89c8('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index e777da9..9ca2ac6 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 _0x368c=['registry','defaultuser','../client','getTrunks','Request','GetTrunk','name'];(function(_0x5f2a5a,_0x246a36){var _0x3a7621=function(_0x320a5f){while(--_0x320a5f){_0x5f2a5a['push'](_0x5f2a5a['shift']());}};_0x3a7621(++_0x246a36);}(_0x368c,0x1b4));var _0xc368=function(_0x2df121,_0x28a27c){_0x2df121=_0x2df121-0x0;var _0x5d9725=_0x368c[_0x2df121];return _0x5d9725;};'use strict';var client=require(_0xc368('0x0'));exports[_0xc368('0x1')]=function(_0x5ab796){return function(_0x499e5b){return client[_0xc368('0x2')](_0xc368('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xc368('0x4'),_0xc368('0x5'),_0xc368('0x6')]},'log':_0xc368('0x3')});};}; \ No newline at end of file +var _0x9bef=['name','defaultuser','../client','getTrunks','GetTrunk'];(function(_0x448ad5,_0x40e259){var _0x15f71b=function(_0x5ed479){while(--_0x5ed479){_0x448ad5['push'](_0x448ad5['shift']());}};_0x15f71b(++_0x40e259);}(_0x9bef,0x133));var _0xf9be=function(_0x1182bd,_0x52ebf2){_0x1182bd=_0x1182bd-0x0;var _0x5c868b=_0x9bef[_0x1182bd];return _0x5c868b;};'use strict';var client=require(_0xf9be('0x0'));exports[_0xf9be('0x1')]=function(_0x5aa3e0){return function(_0x296ac2){return client['Request'](_0xf9be('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xf9be('0x3'),'registry',_0xf9be('0x4')]},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 48eb3e0..b419063 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 _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x4f13b6,_0x45015f){var _0x3876c5=function(_0xda8b0){while(--_0xda8b0){_0x4f13b6['push'](_0x4f13b6['shift']());}};_0x3876c5(++_0x45015f);}(_0x9c44,0x178));var _0x49c4=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x9c44[_0x3ff085];return _0x2b68c3;};'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 +var _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0x3f38df,_0x34e56b){var _0x7a6bc1=function(_0x3ee561){while(--_0x3ee561){_0x3f38df['push'](_0x3f38df['shift']());}};_0x7a6bc1(++_0x34e56b);}(_0x70e0,0x17b));var _0x070e=function(_0x1914d8,_0xd6cf1){_0x1914d8=_0x1914d8-0x0;var _0x1c0c0f=_0x70e0[_0x1914d8];return _0x1c0c0f;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5'),_0x070e('0x6'),'online',_0x070e('0x7'),'pauseType',_0x070e('0x8'),'voicePause','phone','mobile',_0x070e('0x9')]},'log':_0x070e('0x1')});};};exports[_0x070e('0xa')]=function(){return function(){return client[_0x070e('0x2')](_0x070e('0xb'),{'options':{'raw':!![],'where':{'role':_0x070e('0xc')},'attributes':['id',_0x070e('0x3'),'accountcode','internal']},'log':_0x070e('0xa')});};};exports[_0x070e('0xd')]=function(_0x12bb37,_0xb8d819,_0xa927a2){return client[_0x070e('0x2')](_0x070e('0xe'),{'body':{'type':_0xb8d819,'uniqueid':_0xa927a2},'options':{'where':{'id':_0x12bb37['id']}},'log':_0x070e('0xd')});};exports[_0x070e('0xf')]=function(_0x5bf079){return client[_0x070e('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5bf079['id']}},'log':'savePause'});};exports[_0x070e('0x10')]=function(_0x56c7ba){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0x070e('0x11'),'id':_0x56c7ba},'attributes':['id',_0x070e('0x3'),'email','accountcode',_0x070e('0x6'),_0x070e('0x12'),_0x070e('0x7'),_0x070e('0x13'),'lastPauseAt','voicePause',_0x070e('0x9')]},'log':_0x070e('0x10')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index ec03063..3e3daf2 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 _0x1091=['update','UpdateVoiceAgentReport','../client','Request','CreateVoiceAgentReport'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x1091,0x7f));var _0x1109=function(_0x48f405,_0x4bdf54){_0x48f405=_0x48f405-0x0;var _0x344ce6=_0x1091[_0x48f405];return _0x344ce6;};'use strict';var client=require(_0x1109('0x0'));exports['create']=function(_0x1b9359){return client[_0x1109('0x1')]('CreateVoiceAgentReport',{'body':_0x1b9359,'log':_0x1109('0x2')});};exports[_0x1109('0x3')]=function(_0x34391e,_0x372821,_0x528d33){return client[_0x1109('0x1')](_0x1109('0x4'),{'body':_0x34391e,'options':{'where':{'uniqueid':_0x372821,'interface':_0x528d33,'agentcomplete':!![]}},'log':_0x1109('0x4')});}; \ No newline at end of file +var _0x37b2=['../client','create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x591e0c,_0x37e294){var _0x317424=function(_0x1c8c58){while(--_0x1c8c58){_0x591e0c['push'](_0x591e0c['shift']());}};_0x317424(++_0x37e294);}(_0x37b2,0x19e));var _0x237b=function(_0x7f2b67,_0x55cfef){_0x7f2b67=_0x7f2b67-0x0;var _0x9b721a=_0x37b2[_0x7f2b67];return _0x9b721a;};'use strict';var client=require(_0x237b('0x0'));exports[_0x237b('0x1')]=function(_0x38de9b){return client[_0x237b('0x2')](_0x237b('0x3'),{'body':_0x38de9b,'log':_0x237b('0x3')});};exports[_0x237b('0x4')]=function(_0x40a3e8,_0x4c3855,_0x261e2c){return client[_0x237b('0x2')]('UpdateVoiceAgentReport',{'body':_0x40a3e8,'options':{'where':{'uniqueid':_0x4c3855,'interface':_0x261e2c,'agentcomplete':!![]}},'log':_0x237b('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 832b91a..ce576e5 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 _0x4b96=['Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','GetVoiceCallReports','moment','util','lodash','../client'];(function(_0x363606,_0x4bcd42){var _0x177fcf=function(_0x5d6da5){while(--_0x5d6da5){_0x363606['push'](_0x363606['shift']());}};_0x177fcf(++_0x4bcd42);}(_0x4b96,0x10d));var _0x64b9=function(_0x2edfeb,_0x373629){_0x2edfeb=_0x2edfeb-0x0;var _0xeea58a=_0x4b96[_0x2edfeb];return _0xeea58a;};'use strict';var moment=require(_0x64b9('0x0'));var util=require(_0x64b9('0x1'));var _=require(_0x64b9('0x2'));var client=require(_0x64b9('0x3'));exports['create']=function(_0xd743bc){return client[_0x64b9('0x4')](_0x64b9('0x5'),{'body':_[_0x64b9('0x6')](_0xd743bc,{'source':_0xd743bc[_0x64b9('0x7')],'destinationcontext':_0xd743bc[_0x64b9('0x8')],'callerid':_0xd743bc[_0x64b9('0x9')],'amaflags':'DOCUMENTATION'}),'log':'CreateVoiceCallReport'});};exports[_0x64b9('0xa')]=function(){return function(){return client[_0x64b9('0x4')](_0x64b9('0xb'),{'options':{'where':{'type':[_0x64b9('0xc')],'createdAt':{'$between':[moment()[_0x64b9('0xd')](_0x64b9('0xe'))[_0x64b9('0xf')](_0x64b9('0x10')),moment()['endOf'](_0x64b9('0xe'))['format'](_0x64b9('0x10'))]}},'attributes':[_0x64b9('0x11'),_0x64b9('0x12'),_0x64b9('0x13'),'billableseconds']},'log':_0x64b9('0x14')});};}; \ No newline at end of file +var _0x8463=['lodash','create','Request','merge','context','callerid','CreateVoiceCallReport','getVoiceCallReports','GetVoiceCallReport','outbound','format','YYYY-MM-DD\x20HH:mm:ss','endOf','day','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util'];(function(_0x2cc5a2,_0x874db2){var _0x119f71=function(_0x3bcca2){while(--_0x3bcca2){_0x2cc5a2['push'](_0x2cc5a2['shift']());}};_0x119f71(++_0x874db2);}(_0x8463,0x1a2));var _0x3846=function(_0x46bfbd,_0x300ba6){_0x46bfbd=_0x46bfbd-0x0;var _0x47c6a4=_0x8463[_0x46bfbd];return _0x47c6a4;};'use strict';var moment=require(_0x3846('0x0'));var util=require(_0x3846('0x1'));var _=require(_0x3846('0x2'));var client=require('../client');exports[_0x3846('0x3')]=function(_0x31266c){return client[_0x3846('0x4')]('CreateVoiceCallReport',{'body':_[_0x3846('0x5')](_0x31266c,{'source':_0x31266c['calleridnum'],'destinationcontext':_0x31266c[_0x3846('0x6')],'callerid':_0x31266c[_0x3846('0x7')],'amaflags':'DOCUMENTATION'}),'log':_0x3846('0x8')});};exports[_0x3846('0x9')]=function(){return function(){return client[_0x3846('0x4')](_0x3846('0xa'),{'options':{'where':{'type':[_0x3846('0xb')],'createdAt':{'$between':[moment()['startOf']('day')[_0x3846('0xc')](_0x3846('0xd')),moment()[_0x3846('0xe')](_0x3846('0xf'))[_0x3846('0xc')](_0x3846('0xd'))]}},'attributes':[_0x3846('0x10'),_0x3846('0x11'),_0x3846('0x12'),_0x3846('0x13')]},'log':_0x3846('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 4f12e4b..b60c977 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 _0x93a2=['CreateVoiceDialReport','../client','create'];(function(_0x9cc044,_0x21446e){var _0x1dadd9=function(_0x495356){while(--_0x495356){_0x9cc044['push'](_0x9cc044['shift']());}};_0x1dadd9(++_0x21446e);}(_0x93a2,0x14e));var _0x293a=function(_0x2892da,_0x191a40){_0x2892da=_0x2892da-0x0;var _0x28cff2=_0x93a2[_0x2892da];return _0x28cff2;};'use strict';var client=require(_0x293a('0x0'));exports[_0x293a('0x1')]=function(_0x1619c0){return client['Request'](_0x293a('0x2'),{'body':_0x1619c0,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0xc1cc=['Request','CreateVoiceDialReport'];(function(_0x51a7c5,_0xcf74dc){var _0x40f84d=function(_0x2cd84c){while(--_0x2cd84c){_0x51a7c5['push'](_0x51a7c5['shift']());}};_0x40f84d(++_0xcf74dc);}(_0xc1cc,0xa4));var _0xcc1c=function(_0x3bee78,_0x4323b4){_0x3bee78=_0x3bee78-0x0;var _0x3f4e72=_0xc1cc[_0x3bee78];return _0x3f4e72;};'use strict';var client=require('../client');exports['create']=function(_0xeebd21){return client[_0xcc1c('0x0')]('CreateVoiceDialReport',{'body':_0xeebd21,'log':_0xcc1c('0x1')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 41fb5c8..4378878 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 _0xc901=['getVoiceExtensions','../client','recordingFormat'];(function(_0x366e12,_0xa81ea3){var _0x1e96cd=function(_0x1f4186){while(--_0x1f4186){_0x366e12['push'](_0x366e12['shift']());}};_0x1e96cd(++_0xa81ea3);}(_0xc901,0x142));var _0x1c90=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xc901[_0x57b54c];return _0x59cc19;};'use strict';var client=require(_0x1c90('0x0'));exports['getVoiceExtensions']=function(){return function(){return client['Request']('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id','exten',_0x1c90('0x1')],'where':{'VoiceExtensionId':null}},'log':_0x1c90('0x2')});};}; \ No newline at end of file +var _0x5db8=['exten','recordingFormat','../client','getVoiceExtensions','Request'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x5db8,0xbb));var _0x85db=function(_0x50cfc3,_0x526cc6){_0x50cfc3=_0x50cfc3-0x0;var _0x5c11ef=_0x5db8[_0x50cfc3];return _0x5c11ef;};'use strict';var client=require(_0x85db('0x0'));exports[_0x85db('0x1')]=function(){return function(){return client[_0x85db('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x85db('0x3'),_0x85db('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x85db('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index b16d513..5143567 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 _0x29a0=['getVoiceQueues','Request','name','acw','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialQueueProject','dialCongestionMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDSilenceThreshold','timeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client'];(function(_0x1e50ea,_0x2b0b0d){var _0x3a57ae=function(_0x291771){while(--_0x291771){_0x1e50ea['push'](_0x1e50ea['shift']());}};_0x3a57ae(++_0x2b0b0d);}(_0x29a0,0xef));var _0x029a=function(_0x54d0bb,_0x38924f){_0x54d0bb=_0x54d0bb-0x0;var _0x1f4df0=_0x29a0[_0x54d0bb];return _0x1f4df0;};'use strict';var client=require(_0x029a('0x0'));exports[_0x029a('0x1')]=function(){return function(){return client[_0x029a('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x029a('0x3'),_0x029a('0x4'),'acwTimeout','autopause','monitor_format',_0x029a('0x5'),_0x029a('0x6'),_0x029a('0x7'),_0x029a('0x8'),_0x029a('0x9'),_0x029a('0xa'),'dialPredictiveOptimization',_0x029a('0xb'),_0x029a('0xc'),'dialOriginateCallerIdName',_0x029a('0xd'),'dialOriginateTimeout','dialQueueOptions','dialQueueTimeout',_0x029a('0xe'),_0x029a('0xf'),'dialCongestionRetryFrequency','dialBusyMaxRetry',_0x029a('0x10'),_0x029a('0x11'),_0x029a('0x12'),_0x029a('0x13'),'dialTimezone',_0x029a('0x14'),_0x029a('0x15'),_0x029a('0x16'),_0x029a('0x17'),_0x029a('0x18'),_0x029a('0x19'),_0x029a('0x1a'),'dialAMDTotalAnalysisTime',_0x029a('0x1b'),'dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords',_0x029a('0x1c'),'dialAMDMaximumWordLength',_0x029a('0x1d'),'dialRecallMeTimeout',_0x029a('0x1e'),_0x029a('0x1f'),'dialAgiAfterHangupAgent',_0x029a('0x20'),_0x029a('0x21'),_0x029a('0x22'),_0x029a('0x23'),_0x029a('0x24'),_0x029a('0x25'),_0x029a('0x26'),_0x029a('0x27'),_0x029a('0x28'),_0x029a('0x29'),'dialAbandonedMaxRetry',_0x029a('0x2a'),_0x029a('0x2b'),_0x029a('0x2c'),_0x029a('0x2d'),'dialAgentRejectRetryFrequency',_0x029a('0x2e'),_0x029a('0x2f'),_0x029a('0x30'),_0x029a('0x31'),_0x029a('0x32')],'include':[{'model':_0x029a('0x33'),'as':_0x029a('0x33'),'attributes':['id','name',_0x029a('0x34'),_0x029a('0x35')]},{'model':_0x029a('0x36'),'as':_0x029a('0x37'),'attributes':['id',_0x029a('0x3')]},{'model':'Trunk','as':_0x029a('0x38'),'attributes':['id','name',_0x029a('0x34'),_0x029a('0x35')]},{'model':_0x029a('0x39'),'as':_0x029a('0x39'),'attributes':['id','name'],'include':[{'model':'Interval','as':_0x029a('0x3a'),'attributes':['id',_0x029a('0x3'),_0x029a('0x3b')]}]}]},'log':_0x029a('0x1')});};}; \ No newline at end of file +var _0x5c27=['dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency'];(function(_0x22b4e7,_0x414b85){var _0x1ec440=function(_0x23378a){while(--_0x23378a){_0x22b4e7['push'](_0x22b4e7['shift']());}};_0x1ec440(++_0x414b85);}(_0x5c27,0x13c));var _0x75c2=function(_0x21774b,_0x4a6d2b){_0x21774b=_0x21774b-0x0;var _0x4675b2=_0x5c27[_0x21774b];return _0x4675b2;};'use strict';var client=require(_0x75c2('0x0'));exports[_0x75c2('0x1')]=function(){return function(){return client[_0x75c2('0x2')](_0x75c2('0x3'),{'options':{'raw':![],'attributes':['id',_0x75c2('0x4'),_0x75c2('0x5'),'acwTimeout',_0x75c2('0x6'),_0x75c2('0x7'),_0x75c2('0x8'),_0x75c2('0x9'),_0x75c2('0xa'),_0x75c2('0xb'),_0x75c2('0xc'),_0x75c2('0xd'),'dialPredictiveOptimization',_0x75c2('0xe'),_0x75c2('0xf'),_0x75c2('0x10'),_0x75c2('0x11'),_0x75c2('0x12'),_0x75c2('0x13'),_0x75c2('0x14'),_0x75c2('0x15'),_0x75c2('0x16'),_0x75c2('0x17'),_0x75c2('0x18'),_0x75c2('0x19'),_0x75c2('0x1a'),_0x75c2('0x1b'),_0x75c2('0x1c'),_0x75c2('0x1d'),_0x75c2('0x1e'),_0x75c2('0x1f'),_0x75c2('0x20'),_0x75c2('0x21'),_0x75c2('0x22'),'dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime',_0x75c2('0x23'),_0x75c2('0x24'),_0x75c2('0x25'),_0x75c2('0x26'),_0x75c2('0x27'),'timeout','dialRecallMeTimeout',_0x75c2('0x28'),_0x75c2('0x29'),_0x75c2('0x2a'),'dialAgiAfterHangupClient',_0x75c2('0x2b'),'monitor_format',_0x75c2('0x2c'),_0x75c2('0x2d'),_0x75c2('0x2e'),'dialNoSuchNumberMaxRetry',_0x75c2('0x2f'),_0x75c2('0x30'),_0x75c2('0x31'),_0x75c2('0x32'),_0x75c2('0x33'),_0x75c2('0x34'),'dialMachineRetryFrequency',_0x75c2('0x35'),_0x75c2('0x36'),_0x75c2('0x37'),_0x75c2('0x38'),_0x75c2('0x39'),_0x75c2('0x3a'),_0x75c2('0x3b')],'include':[{'model':_0x75c2('0x3c'),'as':_0x75c2('0x3c'),'attributes':['id',_0x75c2('0x4'),'callerid',_0x75c2('0x3d')]},{'model':_0x75c2('0x3e'),'as':_0x75c2('0x3f'),'attributes':['id',_0x75c2('0x4')]},{'model':_0x75c2('0x3c'),'as':_0x75c2('0x40'),'attributes':['id',_0x75c2('0x4'),'callerid',_0x75c2('0x3d')]},{'model':_0x75c2('0x41'),'as':_0x75c2('0x41'),'attributes':['id',_0x75c2('0x4')],'include':[{'model':_0x75c2('0x41'),'as':_0x75c2('0x42'),'attributes':['id','name',_0x75c2('0x43')]}]}]},'log':_0x75c2('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index d22909b..b001010 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(_0x96df96,_0x1284e4){var _0x40054e=function(_0x597ade){while(--_0x597ade){_0x96df96['push'](_0x96df96['shift']());}};_0x40054e(++_0x1284e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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(_0xff9ca2,_0x3927f2){var _0x426791=function(_0x5609c2){while(--_0x5609c2){_0xff9ca2['push'](_0xff9ca2['shift']());}};_0x426791(++_0x3927f2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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 a1e8351..ec0f701 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 _0x6bc5=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses','Request'];(function(_0x1e0dc1,_0x2792a3){var _0x25cc70=function(_0x2e0ad0){while(--_0x2e0ad0){_0x1e0dc1['push'](_0x1e0dc1['shift']());}};_0x25cc70(++_0x2792a3);}(_0x6bc5,0xbd));var _0x56bc=function(_0x1e3156,_0x2327a6){_0x1e3156=_0x1e3156-0x0;var _0x7e9e4=_0x6bc5[_0x1e3156];return _0x7e9e4;};'use strict';var client=require(_0x56bc('0x0'));exports[_0x56bc('0x1')]=function(_0x5dad67){return function(){return client[_0x56bc('0x2')](_0x56bc('0x3'),{'options':{'where':{'VoiceQueueId':_0x5dad67,'paused':!![]},'raw':!![]},'log':_0x56bc('0x1')});};}; \ No newline at end of file +var _0x6eba=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x6eba,0x67));var _0xa6eb=function(_0x275df3,_0x4e0dcd){_0x275df3=_0x275df3-0x0;var _0x310d93=_0x6eba[_0x275df3];return _0x310d93;};'use strict';var client=require(_0xa6eb('0x0'));exports[_0xa6eb('0x1')]=function(_0x277b49){return function(){return client[_0xa6eb('0x2')](_0xa6eb('0x3'),{'options':{'where':{'VoiceQueueId':_0x277b49,'paused':!![]},'raw':!![]},'log':_0xa6eb('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index de78d29..ed55841 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(_0x1c38e4,_0xbbda1d){var _0x39dc71=function(_0x332737){while(--_0x332737){_0x1c38e4['push'](_0x1c38e4['shift']());}};_0x39dc71(++_0xbbda1d);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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(_0x495144,_0x383993){var _0x5a4d28=function(_0x18adf7){while(--_0x18adf7){_0x495144['push'](_0x495144['shift']());}};_0x5a4d28(++_0x383993);}(_0x7a54,0x106));var _0x47a5=function(_0x3b767d,_0x36fd1a){_0x3b767d=_0x3b767d-0x0;var _0x3c188f=_0x7a54[_0x3b767d];return _0x3c188f;};'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 e951e58..aeab854 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 _0x4550=['attended','../client','transfers','Request','result','transfererchannel','transferercalleridnum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereeexten','transfereelinkedid','extension','blind','CreateVoiceTransferReport','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','isexternal','origtransfererexten'];(function(_0xbe4a74,_0x314726){var _0x2b1b8c=function(_0x41d033){while(--_0x41d033){_0xbe4a74['push'](_0xbe4a74['shift']());}};_0x2b1b8c(++_0x314726);}(_0x4550,0x1b9));var _0x0455=function(_0x57deb0,_0xcfa42){_0x57deb0=_0x57deb0-0x0;var _0x21941a=_0x4550[_0x57deb0];return _0x21941a;};'use strict';var client=require(_0x0455('0x0'));exports[_0x0455('0x1')]={};exports['blindTransfer']=function(_0x3f73d4){return client[_0x0455('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x3f73d4[_0x0455('0x3')],'transfererchannel':_0x3f73d4[_0x0455('0x4')],'transferercalleridnum':_0x3f73d4[_0x0455('0x5')],'transferercalleridname':_0x3f73d4['transferercalleridname'],'transfererconnectedlinenum':_0x3f73d4['transfererconnectedlinenum'],'transfererconnectedlinename':_0x3f73d4[_0x0455('0x6')],'transfereraccountcode':_0x3f73d4[_0x0455('0x7')],'transferercontext':_0x3f73d4[_0x0455('0x8')],'transfererexten':_0x3f73d4[_0x0455('0x9')],'transfererlinkedid':_0x3f73d4[_0x0455('0xa')],'transfereechannel':_0x3f73d4['transfereechannel'],'transfereecalleridnum':_0x3f73d4['transfereecalleridnum'],'transfereecalleridname':_0x3f73d4[_0x0455('0xb')],'transfereeconnectedlinenum':_0x3f73d4[_0x0455('0xc')],'transfereeconnectedlinename':_0x3f73d4[_0x0455('0xd')],'transfereeaccountcode':_0x3f73d4[_0x0455('0xe')],'transfereecontext':_0x3f73d4['transfereecontext'],'transfereeexten':_0x3f73d4[_0x0455('0xf')],'transfereelinkedid':_0x3f73d4[_0x0455('0x10')],'isexternal':_0x3f73d4['isexternal'],'context':_0x3f73d4['context'],'extension':_0x3f73d4[_0x0455('0x11')],'type':_0x0455('0x12')},'log':_0x0455('0x13')});};exports[_0x0455('0x14')]=function(_0x393c4d){return client[_0x0455('0x2')](_0x0455('0x13'),{'body':{'result':_0x393c4d[_0x0455('0x3')],'transfererchannel':_0x393c4d[_0x0455('0x15')],'transferercalleridnum':_0x393c4d[_0x0455('0x16')],'transferercalleridname':_0x393c4d[_0x0455('0x17')],'transfererconnectedlinenum':_0x393c4d[_0x0455('0x18')],'transfererconnectedlinename':_0x393c4d[_0x0455('0x19')],'transfereraccountcode':_0x393c4d[_0x0455('0x1a')],'transferercontext':_0x393c4d[_0x0455('0x1b')],'transfererexten':_0x393c4d[_0x0455('0x1c')],'transfererlinkedid':_0x393c4d[_0x0455('0x1d')],'transfereechannel':_0x393c4d[_0x0455('0x1e')],'transfereecalleridnum':_0x393c4d[_0x0455('0x1f')],'transfereecalleridname':_0x393c4d[_0x0455('0x20')],'transfereeconnectedlinenum':_0x393c4d[_0x0455('0x21')],'transfereeconnectedlinename':_0x393c4d['transfertargetconnectedlinename'],'transfereeaccountcode':_0x393c4d[_0x0455('0x22')],'transfereecontext':_0x393c4d[_0x0455('0x23')],'transfereeexten':_0x393c4d['transfertargetexten'],'transfereelinkedid':_0x393c4d[_0x0455('0x24')],'isexternal':_0x393c4d[_0x0455('0x25')],'context':_0x393c4d['origtransferercontext'],'extension':_0x393c4d[_0x0455('0x26')],'type':_0x0455('0x27')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0xfc94=['origtransferercontext','origtransfererexten','attended','transfers','blindTransfer','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfereraccountcode','transfererexten','transfererlinkedid','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereecontext','transfereeexten','transfereelinkedid','context','blind','Request','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten'];(function(_0x5a9644,_0x41197d){var _0x4c9726=function(_0xd4cabc){while(--_0xd4cabc){_0x5a9644['push'](_0x5a9644['shift']());}};_0x4c9726(++_0x41197d);}(_0xfc94,0x13e));var _0x4fc9=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xfc94[_0x2235bf];return _0x4c3a64;};'use strict';var client=require('../client');exports[_0x4fc9('0x0')]={};exports[_0x4fc9('0x1')]=function(_0x1e6d60){return client['Request'](_0x4fc9('0x2'),{'body':{'result':_0x1e6d60[_0x4fc9('0x3')],'transfererchannel':_0x1e6d60[_0x4fc9('0x4')],'transferercalleridnum':_0x1e6d60[_0x4fc9('0x5')],'transferercalleridname':_0x1e6d60['transferercalleridname'],'transfererconnectedlinenum':_0x1e6d60[_0x4fc9('0x6')],'transfererconnectedlinename':_0x1e6d60['transfererconnectedlinename'],'transfereraccountcode':_0x1e6d60[_0x4fc9('0x7')],'transferercontext':_0x1e6d60['transferercontext'],'transfererexten':_0x1e6d60[_0x4fc9('0x8')],'transfererlinkedid':_0x1e6d60[_0x4fc9('0x9')],'transfereechannel':_0x1e6d60['transfereechannel'],'transfereecalleridnum':_0x1e6d60['transfereecalleridnum'],'transfereecalleridname':_0x1e6d60[_0x4fc9('0xa')],'transfereeconnectedlinenum':_0x1e6d60[_0x4fc9('0xb')],'transfereeconnectedlinename':_0x1e6d60[_0x4fc9('0xc')],'transfereeaccountcode':_0x1e6d60['transfereeaccountcode'],'transfereecontext':_0x1e6d60[_0x4fc9('0xd')],'transfereeexten':_0x1e6d60[_0x4fc9('0xe')],'transfereelinkedid':_0x1e6d60[_0x4fc9('0xf')],'isexternal':_0x1e6d60['isexternal'],'context':_0x1e6d60[_0x4fc9('0x10')],'extension':_0x1e6d60['extension'],'type':_0x4fc9('0x11')},'log':_0x4fc9('0x2')});};exports['attendedTransfer']=function(_0x3a6ee9){return client[_0x4fc9('0x12')](_0x4fc9('0x2'),{'body':{'result':_0x3a6ee9[_0x4fc9('0x3')],'transfererchannel':_0x3a6ee9[_0x4fc9('0x13')],'transferercalleridnum':_0x3a6ee9[_0x4fc9('0x14')],'transferercalleridname':_0x3a6ee9[_0x4fc9('0x15')],'transfererconnectedlinenum':_0x3a6ee9['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x3a6ee9['secondtransfererconnectedlinename'],'transfereraccountcode':_0x3a6ee9['origtransfereraccountcode'],'transferercontext':_0x3a6ee9[_0x4fc9('0x16')],'transfererexten':_0x3a6ee9[_0x4fc9('0x17')],'transfererlinkedid':_0x3a6ee9[_0x4fc9('0x18')],'transfereechannel':_0x3a6ee9[_0x4fc9('0x19')],'transfereecalleridnum':_0x3a6ee9[_0x4fc9('0x1a')],'transfereecalleridname':_0x3a6ee9[_0x4fc9('0x1b')],'transfereeconnectedlinenum':_0x3a6ee9[_0x4fc9('0x1c')],'transfereeconnectedlinename':_0x3a6ee9[_0x4fc9('0x1d')],'transfereeaccountcode':_0x3a6ee9[_0x4fc9('0x1e')],'transfereecontext':_0x3a6ee9['transfertargetcontext'],'transfereeexten':_0x3a6ee9[_0x4fc9('0x1f')],'transfereelinkedid':_0x3a6ee9['transfertargetlinkedid'],'isexternal':_0x3a6ee9['isexternal'],'context':_0x3a6ee9[_0x4fc9('0x20')],'extension':_0x3a6ee9[_0x4fc9('0x21')],'type':_0x4fc9('0x22')},'log':_0x4fc9('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 57e4107..2eb4ca6 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 _0x6b8f=['validate','../properties','../ami','listen','format','SIP','name','timers','timer','agents','updateStatusRealtime','pause','QueuePause','error','asterisk','ami\x20disconnected','pick','keys','reload','module','action','then','message','catch','username','join','command','Action','content','voiceQueues','hasOwnProperty','find','omit','undefined','values','length','isConnected','voicechannel','channels','uniqueid','channel','%s.%s','filename','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','push','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','MixMonitor\x20Success','resolve','destinationchannel','stop','StopMixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','queueChannels','type','inbound','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','rows','voicequeuechannel','map','Hangup','voicequeuechannelredirect','Redirect','context','telephones','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util'];(function(_0x434080,_0x3bfe3b){var _0x4c4f6a=function(_0x15a668){while(--_0x15a668){_0x434080['push'](_0x434080['shift']());}};_0x4c4f6a(++_0x3bfe3b);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x39f7c8,_0x227602){_0x39f7c8=_0x39f7c8-0x0;var _0x22de4e=_0x6b8f[_0x39f7c8];return _0x22de4e;};'use strict';var _=require('lodash');var util=require(_0xf6b8('0x0'));var jayson=require('jayson/promise');var schema=require(_0xf6b8('0x1'));var moment=require('moment');var config=require('../../../config/environment');var properties=require(_0xf6b8('0x2'));var ami=require(_0xf6b8('0x3'));var VoiceQueueSummary=require('../model/voiceQueueSummary');exports[_0xf6b8('0x4')]=function(_0xf25536,_0x347a0b,_0x549eac){return new Promise(function(_0x2d035e,_0x79c66d){var _0x446336={'QueuePause':function(_0x3c3430){return new Promise(function(_0x557910){var _0x5f07f4=util[_0xf6b8('0x5')]('%s/%s',_0xf6b8('0x6'),_0x3c3430[_0xf6b8('0x7')]);if(_0xf25536[_0xf6b8('0x8')]&&_0xf25536[_0xf6b8('0x8')][_0x5f07f4]&&_0xf25536[_0xf6b8('0x8')][_0x5f07f4][_0xf6b8('0x9')]){_0xf25536['timers'][_0x5f07f4]['updateAcw']();}if(_0xf25536['agents'][_0x5f07f4]){_0xf25536[_0xf6b8('0xa')][_0x5f07f4][_0xf6b8('0xb')]({'statePause':_0x3c3430[_0xf6b8('0xc')]?!![]:![]});}_0x557910({'code':0xc8,'message':_0xf6b8('0xd')});});},'Reload':function(_0x5a6118){var _0x4e5235=this;return new Promise(function(_0x748e77,_0x3899a9){if(ami['isConnected']()==![]){return _0x3899a9(_0x4e5235[_0xf6b8('0xe')](0x1f4,[config[_0xf6b8('0xf')]['ip'],config[_0xf6b8('0xf')]['username'],_0xf6b8('0x10')]['join']('\x20')));}_0x5a6118=_[_0xf6b8('0x11')](_0x5a6118,_[_0xf6b8('0x12')](properties[_0xf6b8('0x13')][_0xf6b8('0x14')]));_0x5a6118[_0xf6b8('0x15')]='Reload';return ami['Action'](_0x5a6118)[_0xf6b8('0x16')](function(_0x56508b){_0x748e77({'code':0xc8,'message':_0x56508b[_0xf6b8('0x17')]});})[_0xf6b8('0x18')](function(_0x4a93a8){_0x3899a9(_0x4e5235['error'](0x1f5,_0x4a93a8[_0xf6b8('0x17')]));});});},'Command':function(_0x2e2b29){var _0x3081db=this;return new Promise(function(_0x2cac60,_0x4df5f4){if(ami['isConnected']()==![]){return _0x4df5f4(_0x3081db['error'](0x1f4,[config[_0xf6b8('0xf')]['ip'],config[_0xf6b8('0xf')][_0xf6b8('0x19')],'ami\x20disconnected'][_0xf6b8('0x1a')]('\x20')));}_0x2e2b29=_[_0xf6b8('0x11')](_0x2e2b29,_0xf6b8('0x1b'));_0x2e2b29[_0xf6b8('0x15')]='Command';return ami[_0xf6b8('0x1c')](_0x2e2b29)['then'](function(_0x22c52d){_0x2cac60({'code':0xc8,'message':_0x22c52d[_0xf6b8('0x1d')]});})[_0xf6b8('0x18')](function(_0x4127c9){_0x4df5f4(_0x3081db[_0xf6b8('0xe')](0x1f5,_0x4127c9[_0xf6b8('0x17')]));});});},'VoiceQueues':function(){return new Promise(function(_0x4edd29){var _0x1aca8a=[];for(var _0x1ebfea in _0xf25536['voiceQueues']){if(_0xf25536[_0xf6b8('0x1e')][_0xf6b8('0x1f')](_0x1ebfea)){var _0x324057=_0xf25536[_0xf6b8('0x1e')][_0x1ebfea];var _0x3365b8=new VoiceQueueSummary(_0x324057);_0x1aca8a['push'](_0x3365b8);}}_0x4edd29({'count':_0x1aca8a['length'],'rows':_0x1aca8a});});},'UpdateVoiceQueue':function(_0xfa77d3){return new Promise(function(_0x9050c6,_0x5a9514){var _0x459ed0=_[_0xf6b8('0x20')](_0xf25536[_0xf6b8('0x1e')],{'id':parseInt(_0xfa77d3['id'])});var _0x5a7f55=_[_0xf6b8('0x21')](_0xfa77d3,['id']);if(_0x459ed0){for(var _0xc958f4 in _0x5a7f55){if(typeof _0x5a7f55[_0xc958f4]!=='undefined'&&typeof _0x459ed0[_0xc958f4]!==_0xf6b8('0x22')){_0x459ed0[_0xc958f4]=_0x5a7f55[_0xc958f4];}}_0x9050c6(_0x459ed0);}else{_0x5a9514();}});},'VoiceChannels':function(){return new Promise(function(_0xfdf601){var _0x324eeb=_[_0xf6b8('0x23')](_0xf25536['channels']);_0xfdf601({'count':_0x324eeb[_0xf6b8('0x24')],'rows':_0x324eeb});});},'VoiceChannelMixMonitor':function(_0xd984c0){var _0x4006a6=this;return new Promise(function(_0x48b07f,_0x7c7546){if(ami[_0xf6b8('0x25')]()==![]){return _0x7c7546(_0x4006a6[_0xf6b8('0xe')](0x1f4,[config['asterisk']['ip'],config[_0xf6b8('0xf')][_0xf6b8('0x19')],_0xf6b8('0x10')][_0xf6b8('0x1a')]('\x20')));}var _0x4be3cb=schema(properties[_0xf6b8('0x26')])[_0xf6b8('0x1')](_0xd984c0);if(_0x4be3cb[_0xf6b8('0x24')]>0x0){return _0x7c7546(_0x4006a6['error'](0x1f4,_['map'](_0x4be3cb,_0xf6b8('0x17'))[_0xf6b8('0x1a')](',\x20')));}var _0x258e69=_[_0xf6b8('0x20')](_0xf25536[_0xf6b8('0x27')],{'uniqueid':_0xd984c0[_0xf6b8('0x28')]});if(_0x258e69&&_0x258e69[_0xf6b8('0x29')]){var _0x7aaa3c=util[_0xf6b8('0x5')](_0xf6b8('0x2a'),_0xd984c0[_0xf6b8('0x2b')]||_0xd984c0[_0xf6b8('0x28')],_0xd984c0[_0xf6b8('0x5')]||_0xf6b8('0x2c'));return ami[_0xf6b8('0x1c')]({'action':_0xf6b8('0x2d'),'channel':_0x258e69[_0xf6b8('0x29')],'file':_0x7aaa3c,'options':_0xf6b8('0x2e')})['then'](function(_0x54a675){var _0x2b1e36=_[_0xf6b8('0x20')](_0x258e69[_0xf6b8('0x2f')],{'filename':_0xf6b8('0x30')+_0x7aaa3c[_0xf6b8('0x31')]()});if(_[_0xf6b8('0x32')](_0x2b1e36)){_0x258e69[_0xf6b8('0x2f')][_0xf6b8('0x33')]({'filename':_0xf6b8('0x30')+_0x7aaa3c[_0xf6b8('0x31')](),'createdAt':moment()[_0xf6b8('0x5')](_0xf6b8('0x34')),'mixmonitorid':_0x54a675['mixmonitorid'],'status':_0xf6b8('0x35')});}else{_0x2b1e36[_0xf6b8('0x36')]=_0x54a675['mixmonitorid'];_0x2b1e36[_0xf6b8('0x37')]=_0xf6b8('0x35');}_0x48b07f({'code':0xc8,'message':[_0xd984c0[_0xf6b8('0x28')],_0xf6b8('0x38'),_0x54a675[_0xf6b8('0x36')]][_0xf6b8('0x1a')]('\x20'),'mixmonitorid':_0x54a675[_0xf6b8('0x36')]});})[_0xf6b8('0x18')](function(_0x1c42fe){_0x7c7546(_0x4006a6[_0xf6b8('0xe')](0x1f5,[_0xd984c0[_0xf6b8('0x28')],_0x1c42fe[_0xf6b8('0x17')][_0xf6b8('0x31')]()][_0xf6b8('0x1a')]('\x20')));});}else{return _0x7c7546(_0x4006a6['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x5f42c2){var _0x3bb212=this;return new Promise(function(_0x2c68f5,_0x45daea){if(ami[_0xf6b8('0x25')]()==![]){return _0x45daea(_0x3bb212[_0xf6b8('0xe')](0x1f4,[config[_0xf6b8('0xf')]['ip'],config[_0xf6b8('0xf')]['username'],_0xf6b8('0x10')]['join']('\x20')));}var _0x2040fb=schema(properties[_0xf6b8('0x26')])[_0xf6b8('0x1')](_0x5f42c2);if(_0x2040fb[_0xf6b8('0x24')]>0x0){return _0x45daea(_0x3bb212[_0xf6b8('0xe')](0x1f4,_['map'](_0x2040fb,_0xf6b8('0x17'))[_0xf6b8('0x1a')](',\x20')));}var _0x126850=_[_0xf6b8('0x20')](_0xf25536[_0xf6b8('0x27')],{'uniqueid':_0x5f42c2['uniqueid']});if(_0x126850){return Promise[_0xf6b8('0x39')]()[_0xf6b8('0x16')](function(){if(_0x126850[_0xf6b8('0x29')]){return ami['Action']({'action':'StopMixMonitor','channel':_0x126850[_0xf6b8('0x29')],'mixmonitorid':_0x5f42c2[_0xf6b8('0x36')]})[_0xf6b8('0x18')](function(){});}})[_0xf6b8('0x16')](function(){if(_0x126850['destinationchannel']){return ami['Action']({'action':'StopMixMonitor','channel':_0x126850[_0xf6b8('0x3a')],'mixmonitorid':_0x5f42c2['mixmonitorid']})[_0xf6b8('0x18')](function(){});}})[_0xf6b8('0x16')](function(){var _0x12f582=_[_0xf6b8('0x20')](_0x126850[_0xf6b8('0x2f')],{'mixmonitorid':_0x5f42c2[_0xf6b8('0x36')]});if(_0x12f582){_0x12f582[_0xf6b8('0x37')]=_0xf6b8('0x3b');}})[_0xf6b8('0x16')](function(){var _0x597511=util[_0xf6b8('0x5')]('%s.%s',_0x5f42c2[_0xf6b8('0x2b')]||_0x5f42c2[_0xf6b8('0x28')],_0x5f42c2[_0xf6b8('0x5')]||_0xf6b8('0x2c'));var _0x1abf17=_[_0xf6b8('0x20')](_0x126850[_0xf6b8('0x2f')],{'filename':'/var/spool/asterisk/monitor/'+_0x597511[_0xf6b8('0x31')]()});if(_0x1abf17){_0x1abf17[_0xf6b8('0x37')]=_0xf6b8('0x3b');}})[_0xf6b8('0x16')](function(){_0x2c68f5({'code':0xc8,'message':[_0x5f42c2['uniqueid'],_0xf6b8('0x3c')][_0xf6b8('0x1a')]('\x20')});})['catch'](function(_0x3a38eb){_0x45daea(_0x3bb212[_0xf6b8('0xe')](0x1f5,[_0x5f42c2[_0xf6b8('0x28')],_0x3a38eb[_0xf6b8('0x17')][_0xf6b8('0x31')]()]['join']('\x20')));});}else{return _0x45daea(_0x3bb212[_0xf6b8('0xe')](0x1f5,_0xf6b8('0x3d')));}});},'VoiceQueuesChannels':function(_0x5754eb){var _0x497b26=this;return new Promise(function(_0x55c392){var _0x22c1eb=_[_0xf6b8('0x23')](_0xf25536[_0xf6b8('0x3e')]);var _0xc20eee={'count':_0x22c1eb['length'],'rows':_0x22c1eb};if(_0x5754eb&&_0x5754eb[_0xf6b8('0x3f')]){if(![_0xf6b8('0x40'),_0xf6b8('0x41')][_0xf6b8('0x42')](_0x5754eb[_0xf6b8('0x3f')])){return _0x79c66d(_0x497b26[_0xf6b8('0xe')](0x190,_0xf6b8('0x43')));}var _0x4e4c90=_['filter'](_0x22c1eb,function(_0x4b81a0){return _0x4b81a0[_0xf6b8('0x3f')]===_0x5754eb['type'];});_0xc20eee['count']=_0x4e4c90[_0xf6b8('0x24')];_0xc20eee[_0xf6b8('0x44')]=_0x4e4c90;}_0x55c392(_0xc20eee);});},'VoiceQueuesChannel':function(_0x15965a){var _0x25cf3d=this;return new Promise(function(_0x34ca51,_0x1190f3){var _0x4f78e0=schema(properties[_0xf6b8('0x45')])[_0xf6b8('0x1')](_0x15965a);if(_0x4f78e0[_0xf6b8('0x24')]>0x0){return _0x1190f3(_0x25cf3d[_0xf6b8('0xe')](0x1f4,_['map'](_0x4f78e0,_0xf6b8('0x17'))[_0xf6b8('0x1a')](',\x20')));}var _0x5c27b1=_[_0xf6b8('0x20')](_0xf25536[_0xf6b8('0x3e')],{'uniqueid':_0x15965a[_0xf6b8('0x28')]});if(_0x5c27b1){_0x34ca51(_0x5c27b1);}else{return _0x1190f3(_0x25cf3d['error'](0x1f5,_0xf6b8('0x3d')));}});},'VoiceQueuesChannelHangup':function(_0x38720f){var _0x3e8213=this;return new Promise(function(_0x8c5d73,_0x37db90){if(ami[_0xf6b8('0x25')]()==![]){return _0x37db90(_0x3e8213[_0xf6b8('0xe')](0x1f4,[config[_0xf6b8('0xf')]['ip'],config[_0xf6b8('0xf')][_0xf6b8('0x19')],_0xf6b8('0x10')][_0xf6b8('0x1a')]('\x20')));}var _0x5d124b=schema(properties['voicequeuechannelhangup'])['validate'](_0x38720f);if(_0x5d124b[_0xf6b8('0x24')]>0x0){return _0x37db90(_0x3e8213[_0xf6b8('0xe')](0x1f4,_[_0xf6b8('0x46')](_0x5d124b,_0xf6b8('0x17'))['join'](',\x20')));}var _0x1b7c82=_[_0xf6b8('0x20')](_0xf25536[_0xf6b8('0x3e')],{'uniqueid':_0x38720f['uniqueid']});if(_0x1b7c82&&_0x1b7c82[_0xf6b8('0x29')]){return ami[_0xf6b8('0x1c')]({'action':_0xf6b8('0x47'),'channel':_0x1b7c82['channel']})['then'](function(_0x9105bb){_0x8c5d73({'code':0xc8,'message':[_0x38720f[_0xf6b8('0x28')],_0x9105bb[_0xf6b8('0x17')][_0xf6b8('0x31')]()]['join']('\x20')});})[_0xf6b8('0x18')](function(_0x5ebf65){_0x37db90(_0x3e8213[_0xf6b8('0xe')](0x1f5,[_0x38720f[_0xf6b8('0x28')],_0x5ebf65[_0xf6b8('0x17')][_0xf6b8('0x31')]()][_0xf6b8('0x1a')]('\x20')));});}else{return _0x37db90(_0x3e8213['error'](0x1f5,_0xf6b8('0x3d')));}});},'VoiceQueuesChannelRedirect':function(_0x1f869b){var _0x227f5e=this;return new Promise(function(_0x28e1d7,_0x1980de){if(ami[_0xf6b8('0x25')]()==![]){return _0x1980de(_0x227f5e[_0xf6b8('0xe')](0x1f4,[config[_0xf6b8('0xf')]['ip'],config[_0xf6b8('0xf')][_0xf6b8('0x19')],'ami\x20disconnected'][_0xf6b8('0x1a')]('\x20')));}var _0x135ce3=schema(properties[_0xf6b8('0x48')])['validate'](_0x1f869b);if(_0x135ce3[_0xf6b8('0x24')]>0x0){return _0x1980de(_0x227f5e['error'](0x1f4,_[_0xf6b8('0x46')](_0x135ce3,'message')['join'](',\x20')));}var _0x3c4e8a=_[_0xf6b8('0x20')](_0xf25536[_0xf6b8('0x3e')],{'uniqueid':_0x1f869b[_0xf6b8('0x28')]});if(_0x3c4e8a&&_0x3c4e8a[_0xf6b8('0x29')]){return ami['Action']({'action':_0xf6b8('0x49'),'channel':_0x3c4e8a[_0xf6b8('0x29')],'exten':_0x1f869b['exten'],'context':_0x1f869b['context']||_0x3c4e8a[_0xf6b8('0x4a')],'priority':0x1})[_0xf6b8('0x16')](function(_0xdb1c77){_0x28e1d7({'code':0xc8,'message':[_0x1f869b[_0xf6b8('0x28')],_0xdb1c77[_0xf6b8('0x17')]['toLowerCase']()]['join']('\x20')});})[_0xf6b8('0x18')](function(_0x2d86fc){_0x1980de(_0x227f5e[_0xf6b8('0xe')](0x1f5,[_0x1f869b[_0xf6b8('0x28')],_0x2d86fc['message'][_0xf6b8('0x31')]()][_0xf6b8('0x1a')]('\x20')));});}else{return _0x1980de(_0x227f5e[_0xf6b8('0xe')](0x1f5,_0xf6b8('0x3d')));}});},'Agents':function(_0x3b06c8){return new Promise(function(_0x2e43a1){var _0x7a8ae6=_['values'](_0xf25536['agents']);if(_0x3b06c8&&_0x3b06c8['id']){var _0x2d32bb=_[_0xf6b8('0x20')](_0x7a8ae6,function(_0x3f3969){return _0x3f3969['id']===_0x3b06c8['id'];});_0x2e43a1(_0x2d32bb);}else{_0x2e43a1({'count':_0x7a8ae6[_0xf6b8('0x24')],'rows':_0x7a8ae6});}});},'Telephones':function(){return new Promise(function(_0x4707ff){var _0x19c149=_[_0xf6b8('0x23')](_0xf25536[_0xf6b8('0x4b')]);_0x4707ff({'count':_0x19c149['length'],'rows':_0x19c149});});},'Trunks':function(){return new Promise(function(_0x2d3bae){var _0x213a14=_[_0xf6b8('0x23')](_0xf25536[_0xf6b8('0x4c')]);_0x2d3bae({'count':_0x213a14[_0xf6b8('0x24')],'rows':_0x213a14});});},'OutboundChannels':function(){return new Promise(function(_0x55f2ae){var _0x3af46c=_['values'](_0xf25536[_0xf6b8('0x4d')]);_0x55f2ae({'count':_0x3af46c[_0xf6b8('0x24')],'rows':_0x3af46c});});},'Outbound':function(){return new Promise(function(_0x2d6261){_0x2d6261(_0xf25536[_0xf6b8('0x41')]);});},'Campaigns':function(){return new Promise(function(_0x141d6a){var _0x4492f6=_['values'](_0xf25536[_0xf6b8('0x4e')]);_0x141d6a({'count':_0x4492f6[_0xf6b8('0x24')],'rows':_0x4492f6});});},'VoiceQueuesPreview':function(_0x1c6692){var _0x3d76ee=this;return new Promise(function(_0x396a7c,_0x3d6e09){_0x347a0b[_0xf6b8('0x4f')](_0x1c6692['id'])['then'](function(_0x288449){_0x396a7c({'code':0xc8,'message':_0x288449[_0xf6b8('0x17')]});})['catch'](function(_0x286e8d){_0x3d6e09(_0x3d76ee[_0xf6b8('0xe')](0x1f4,_0x286e8d[_0xf6b8('0x17')]));});});},'EventManager':function(_0x288b94){var _0x57fcdb=this;return new Promise(function(_0x23ef5e,_0x452de0){if(!_0x288b94[_0xf6b8('0x50')]){return _0x452de0(_0x57fcdb['error'](0x1f4,_0xf6b8('0x51')));}ami['emit']('custom:'+_0x288b94[_0xf6b8('0x50')],_0x288b94[_0xf6b8('0x17')]);_0x23ef5e({'code':0xc8,'message':_0x288b94});});},'FaxAccounts':function(){return new Promise(function(_0x36a84c){var _0x2b1c7d=_[_0xf6b8('0x23')](_0xf25536[_0xf6b8('0x52')]);_0x36a84c({'count':_0x2b1c7d[_0xf6b8('0x24')],'rows':_0x2b1c7d});});},'SendFax':function(_0x2e66bf){var _0x3292d3=this;return new Promise(function(_0x18949a,_0xa03ad3){_0x549eac[_0xf6b8('0x53')](_0x2e66bf)[_0xf6b8('0x16')](function(_0x4684b2){_0x18949a({'code':0xc8,'message':_0x4684b2[_0xf6b8('0x17')]});})['catch'](function(_0x4d9845){_0xa03ad3(_0x3292d3[_0xf6b8('0xe')](0x1f4,_0x4d9845[_0xf6b8('0x17')]));});});},'CheckAfterSend':function(_0x5b113b){var _0x171db9=this;return new Promise(function(_0x1b4dee,_0x3b4df4){_0x549eac[_0xf6b8('0x54')](_0x5b113b)['then'](function(_0x3cd8fc){_0x1b4dee({'code':0xc8,'message':_0x3cd8fc[_0xf6b8('0x17')]});})[_0xf6b8('0x18')](function(_0x48829d){_0x3b4df4(_0x171db9['error'](0x1f4,_0x48829d['message']));});});}};var _0x3e174b=jayson[_0xf6b8('0x55')](_0x446336)['http']();_0x3e174b['on'](_0xf6b8('0xe'),function(_0x51800b){return _0x79c66d(_0x51800b);});_0x3e174b[_0xf6b8('0x4')](0x232a,_0xf6b8('0x56'),function(){console['log'](_0xf6b8('0x57'),0x232a);return _0x2d035e(_0xf6b8('0x58')+0x232a);});});}; \ No newline at end of file +var _0x7da7=['AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','../../../config/environment','../properties','../model/voiceQueueSummary','listen','format','%s/%s','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','error','asterisk','username','join','keys','reload','module','action','message','catch','ami\x20disconnected','Action','then','content','voiceQueues','push','length','find','undefined','channels','voicechannel','map','uniqueid','channel','%s.%s','wav','MixMonitor','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','isNil','monitors','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','isConnected','validate','resolve','StopMixMonitor','destinationchannel','status','stop','filename','StopMixMonitor\x20Success','queueChannels','type','inbound','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','voicequeuechannelhangup','Hangup','exten','context','values','telephones','outboundChannels','campaigns','run','Event\x20name\x20mandatory','emit','faxAccounts','send','server','http','127.0.0.1','log'];(function(_0x5d283b,_0x14d1de){var _0x3a7d42=function(_0x31ace6){while(--_0x31ace6){_0x5d283b['push'](_0x5d283b['shift']());}};_0x3a7d42(++_0x14d1de);}(_0x7da7,0x10d));var _0x77da=function(_0x5a7d5f,_0x5695cb){_0x5a7d5f=_0x5a7d5f-0x0;var _0x5dcded=_0x7da7[_0x5a7d5f];return _0x5dcded;};'use strict';var _=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var jayson=require(_0x77da('0x2'));var schema=require('validate');var moment=require('moment');var config=require(_0x77da('0x3'));var properties=require(_0x77da('0x4'));var ami=require('../ami');var VoiceQueueSummary=require(_0x77da('0x5'));exports[_0x77da('0x6')]=function(_0x56458c,_0x19331c,_0xc54a12){return new Promise(function(_0x47da81,_0x30afe0){var _0x47cf1d={'QueuePause':function(_0x1191de){return new Promise(function(_0x13992e){var _0x37c5ab=util[_0x77da('0x7')](_0x77da('0x8'),'SIP',_0x1191de[_0x77da('0x9')]);if(_0x56458c[_0x77da('0xa')]&&_0x56458c[_0x77da('0xa')][_0x37c5ab]&&_0x56458c['timers'][_0x37c5ab][_0x77da('0xb')]){_0x56458c[_0x77da('0xa')][_0x37c5ab][_0x77da('0xc')]();}if(_0x56458c[_0x77da('0xd')][_0x37c5ab]){_0x56458c['agents'][_0x37c5ab][_0x77da('0xe')]({'statePause':_0x1191de[_0x77da('0xf')]?!![]:![]});}_0x13992e({'code':0xc8,'message':_0x77da('0x10')});});},'Reload':function(_0x5d6e2f){var _0x4a7748=this;return new Promise(function(_0x26e3ff,_0x4263d9){if(ami['isConnected']()==![]){return _0x4263d9(_0x4a7748[_0x77da('0x11')](0x1f4,[config[_0x77da('0x12')]['ip'],config[_0x77da('0x12')][_0x77da('0x13')],'ami\x20disconnected'][_0x77da('0x14')]('\x20')));}_0x5d6e2f=_['pick'](_0x5d6e2f,_[_0x77da('0x15')](properties[_0x77da('0x16')][_0x77da('0x17')]));_0x5d6e2f[_0x77da('0x18')]='Reload';return ami['Action'](_0x5d6e2f)['then'](function(_0x482b87){_0x26e3ff({'code':0xc8,'message':_0x482b87[_0x77da('0x19')]});})[_0x77da('0x1a')](function(_0x289887){_0x4263d9(_0x4a7748[_0x77da('0x11')](0x1f5,_0x289887[_0x77da('0x19')]));});});},'Command':function(_0x12d2b1){var _0x1d325c=this;return new Promise(function(_0x3b6dde,_0x544104){if(ami['isConnected']()==![]){return _0x544104(_0x1d325c[_0x77da('0x11')](0x1f4,[config[_0x77da('0x12')]['ip'],config['asterisk'][_0x77da('0x13')],_0x77da('0x1b')][_0x77da('0x14')]('\x20')));}_0x12d2b1=_['pick'](_0x12d2b1,'command');_0x12d2b1[_0x77da('0x18')]='Command';return ami[_0x77da('0x1c')](_0x12d2b1)[_0x77da('0x1d')](function(_0xc52f0e){_0x3b6dde({'code':0xc8,'message':_0xc52f0e[_0x77da('0x1e')]});})[_0x77da('0x1a')](function(_0x270318){_0x544104(_0x1d325c[_0x77da('0x11')](0x1f5,_0x270318['message']));});});},'VoiceQueues':function(){return new Promise(function(_0x4885ec){var _0xfd160=[];for(var _0x2d009f in _0x56458c[_0x77da('0x1f')]){if(_0x56458c[_0x77da('0x1f')]['hasOwnProperty'](_0x2d009f)){var _0x42240b=_0x56458c[_0x77da('0x1f')][_0x2d009f];var _0x470c9f=new VoiceQueueSummary(_0x42240b);_0xfd160[_0x77da('0x20')](_0x470c9f);}}_0x4885ec({'count':_0xfd160[_0x77da('0x21')],'rows':_0xfd160});});},'UpdateVoiceQueue':function(_0x5997b6){return new Promise(function(_0xce24b8,_0x3e090d){var _0x1f2279=_[_0x77da('0x22')](_0x56458c['voiceQueues'],{'id':parseInt(_0x5997b6['id'])});var _0x5b4638=_['omit'](_0x5997b6,['id']);if(_0x1f2279){for(var _0x2258e9 in _0x5b4638){if(typeof _0x5b4638[_0x2258e9]!==_0x77da('0x23')&&typeof _0x1f2279[_0x2258e9]!==_0x77da('0x23')){_0x1f2279[_0x2258e9]=_0x5b4638[_0x2258e9];}}_0xce24b8(_0x1f2279);}else{_0x3e090d();}});},'VoiceChannels':function(){return new Promise(function(_0x3394d6){var _0x34228f=_['values'](_0x56458c[_0x77da('0x24')]);_0x3394d6({'count':_0x34228f[_0x77da('0x21')],'rows':_0x34228f});});},'VoiceChannelMixMonitor':function(_0x356bfb){var _0x1d381b=this;return new Promise(function(_0x1e7853,_0x46e6b4){if(ami['isConnected']()==![]){return _0x46e6b4(_0x1d381b[_0x77da('0x11')](0x1f4,[config[_0x77da('0x12')]['ip'],config[_0x77da('0x12')][_0x77da('0x13')],_0x77da('0x1b')][_0x77da('0x14')]('\x20')));}var _0x3343b4=schema(properties[_0x77da('0x25')])['validate'](_0x356bfb);if(_0x3343b4['length']>0x0){return _0x46e6b4(_0x1d381b[_0x77da('0x11')](0x1f4,_[_0x77da('0x26')](_0x3343b4,'message')[_0x77da('0x14')](',\x20')));}var _0x390399=_[_0x77da('0x22')](_0x56458c[_0x77da('0x24')],{'uniqueid':_0x356bfb[_0x77da('0x27')]});if(_0x390399&&_0x390399[_0x77da('0x28')]){var _0x20d1cc=util['format'](_0x77da('0x29'),_0x356bfb['filename']||_0x356bfb['uniqueid'],_0x356bfb['format']||_0x77da('0x2a'));return ami['Action']({'action':_0x77da('0x2b'),'channel':_0x390399[_0x77da('0x28')],'file':_0x20d1cc,'options':_0x77da('0x2c')})[_0x77da('0x1d')](function(_0x3c46d2){var _0x3f0593=_[_0x77da('0x22')](_0x390399['monitors'],{'filename':_0x77da('0x2d')+_0x20d1cc[_0x77da('0x2e')]()});if(_[_0x77da('0x2f')](_0x3f0593)){_0x390399[_0x77da('0x30')][_0x77da('0x20')]({'filename':_0x77da('0x2d')+_0x20d1cc['toLowerCase'](),'createdAt':moment()[_0x77da('0x7')](_0x77da('0x31')),'mixmonitorid':_0x3c46d2[_0x77da('0x32')],'status':'rec'});}else{_0x3f0593[_0x77da('0x32')]=_0x3c46d2['mixmonitorid'];_0x3f0593['status']='rec';}_0x1e7853({'code':0xc8,'message':[_0x356bfb['uniqueid'],_0x77da('0x33'),_0x3c46d2[_0x77da('0x32')]][_0x77da('0x14')]('\x20'),'mixmonitorid':_0x3c46d2['mixmonitorid']});})[_0x77da('0x1a')](function(_0x5b7e63){_0x46e6b4(_0x1d381b[_0x77da('0x11')](0x1f5,[_0x356bfb['uniqueid'],_0x5b7e63[_0x77da('0x19')][_0x77da('0x2e')]()][_0x77da('0x14')]('\x20')));});}else{return _0x46e6b4(_0x1d381b[_0x77da('0x11')](0x1f5,_0x77da('0x34')));}});},'VoiceChannelStopMixMonitor':function(_0x5ecf12){var _0x759b86=this;return new Promise(function(_0x1f48bd,_0x44717a){if(ami[_0x77da('0x35')]()==![]){return _0x44717a(_0x759b86[_0x77da('0x11')](0x1f4,[config[_0x77da('0x12')]['ip'],config['asterisk'][_0x77da('0x13')],_0x77da('0x1b')][_0x77da('0x14')]('\x20')));}var _0x2dfeca=schema(properties[_0x77da('0x25')])[_0x77da('0x36')](_0x5ecf12);if(_0x2dfeca['length']>0x0){return _0x44717a(_0x759b86[_0x77da('0x11')](0x1f4,_['map'](_0x2dfeca,_0x77da('0x19'))[_0x77da('0x14')](',\x20')));}var _0x40a492=_['find'](_0x56458c[_0x77da('0x24')],{'uniqueid':_0x5ecf12[_0x77da('0x27')]});if(_0x40a492){return Promise[_0x77da('0x37')]()[_0x77da('0x1d')](function(){if(_0x40a492[_0x77da('0x28')]){return ami[_0x77da('0x1c')]({'action':_0x77da('0x38'),'channel':_0x40a492[_0x77da('0x28')],'mixmonitorid':_0x5ecf12[_0x77da('0x32')]})['catch'](function(){});}})[_0x77da('0x1d')](function(){if(_0x40a492[_0x77da('0x39')]){return ami[_0x77da('0x1c')]({'action':_0x77da('0x38'),'channel':_0x40a492[_0x77da('0x39')],'mixmonitorid':_0x5ecf12[_0x77da('0x32')]})['catch'](function(){});}})['then'](function(){var _0x240d7b=_[_0x77da('0x22')](_0x40a492[_0x77da('0x30')],{'mixmonitorid':_0x5ecf12[_0x77da('0x32')]});if(_0x240d7b){_0x240d7b[_0x77da('0x3a')]=_0x77da('0x3b');}})['then'](function(){var _0x6ccb8f=util[_0x77da('0x7')](_0x77da('0x29'),_0x5ecf12[_0x77da('0x3c')]||_0x5ecf12['uniqueid'],_0x5ecf12[_0x77da('0x7')]||'wav');var _0x518fd5=_[_0x77da('0x22')](_0x40a492[_0x77da('0x30')],{'filename':_0x77da('0x2d')+_0x6ccb8f[_0x77da('0x2e')]()});if(_0x518fd5){_0x518fd5['status']=_0x77da('0x3b');}})[_0x77da('0x1d')](function(){_0x1f48bd({'code':0xc8,'message':[_0x5ecf12['uniqueid'],_0x77da('0x3d')][_0x77da('0x14')]('\x20')});})['catch'](function(_0x6c0b00){_0x44717a(_0x759b86[_0x77da('0x11')](0x1f5,[_0x5ecf12[_0x77da('0x27')],_0x6c0b00[_0x77da('0x19')][_0x77da('0x2e')]()][_0x77da('0x14')]('\x20')));});}else{return _0x44717a(_0x759b86[_0x77da('0x11')](0x1f5,_0x77da('0x34')));}});},'VoiceQueuesChannels':function(_0x128ce3){var _0x3a34a8=this;return new Promise(function(_0x52aa0a){var _0x3d04a3=_['values'](_0x56458c[_0x77da('0x3e')]);var _0x14cd3c={'count':_0x3d04a3[_0x77da('0x21')],'rows':_0x3d04a3};if(_0x128ce3&&_0x128ce3[_0x77da('0x3f')]){if(![_0x77da('0x40'),_0x77da('0x41')][_0x77da('0x42')](_0x128ce3['type'])){return _0x30afe0(_0x3a34a8[_0x77da('0x11')](0x190,_0x77da('0x43')));}var _0x1a7115=_[_0x77da('0x44')](_0x3d04a3,function(_0x4f30a1){return _0x4f30a1[_0x77da('0x3f')]===_0x128ce3[_0x77da('0x3f')];});_0x14cd3c[_0x77da('0x45')]=_0x1a7115['length'];_0x14cd3c['rows']=_0x1a7115;}_0x52aa0a(_0x14cd3c);});},'VoiceQueuesChannel':function(_0x332763){var _0x3a0396=this;return new Promise(function(_0x42ea9e,_0x1d1ea2){var _0x451897=schema(properties['voicequeuechannel'])['validate'](_0x332763);if(_0x451897[_0x77da('0x21')]>0x0){return _0x1d1ea2(_0x3a0396[_0x77da('0x11')](0x1f4,_['map'](_0x451897,_0x77da('0x19'))[_0x77da('0x14')](',\x20')));}var _0x1e0146=_['find'](_0x56458c[_0x77da('0x3e')],{'uniqueid':_0x332763[_0x77da('0x27')]});if(_0x1e0146){_0x42ea9e(_0x1e0146);}else{return _0x1d1ea2(_0x3a0396['error'](0x1f5,_0x77da('0x34')));}});},'VoiceQueuesChannelHangup':function(_0x27aa8c){var _0xfb06b5=this;return new Promise(function(_0x1a4bab,_0x20cce1){if(ami[_0x77da('0x35')]()==![]){return _0x20cce1(_0xfb06b5[_0x77da('0x11')](0x1f4,[config[_0x77da('0x12')]['ip'],config[_0x77da('0x12')]['username'],_0x77da('0x1b')][_0x77da('0x14')]('\x20')));}var _0x1f6141=schema(properties[_0x77da('0x46')])[_0x77da('0x36')](_0x27aa8c);if(_0x1f6141[_0x77da('0x21')]>0x0){return _0x20cce1(_0xfb06b5['error'](0x1f4,_[_0x77da('0x26')](_0x1f6141,_0x77da('0x19'))[_0x77da('0x14')](',\x20')));}var _0x5b9cf2=_[_0x77da('0x22')](_0x56458c[_0x77da('0x3e')],{'uniqueid':_0x27aa8c[_0x77da('0x27')]});if(_0x5b9cf2&&_0x5b9cf2[_0x77da('0x28')]){return ami[_0x77da('0x1c')]({'action':_0x77da('0x47'),'channel':_0x5b9cf2[_0x77da('0x28')]})['then'](function(_0x100094){_0x1a4bab({'code':0xc8,'message':[_0x27aa8c['uniqueid'],_0x100094[_0x77da('0x19')][_0x77da('0x2e')]()][_0x77da('0x14')]('\x20')});})['catch'](function(_0x30c746){_0x20cce1(_0xfb06b5[_0x77da('0x11')](0x1f5,[_0x27aa8c[_0x77da('0x27')],_0x30c746[_0x77da('0x19')]['toLowerCase']()]['join']('\x20')));});}else{return _0x20cce1(_0xfb06b5['error'](0x1f5,_0x77da('0x34')));}});},'VoiceQueuesChannelRedirect':function(_0x1bca78){var _0x2c4d7c=this;return new Promise(function(_0x2c7c8e,_0x458da6){if(ami[_0x77da('0x35')]()==![]){return _0x458da6(_0x2c4d7c[_0x77da('0x11')](0x1f4,[config[_0x77da('0x12')]['ip'],config[_0x77da('0x12')][_0x77da('0x13')],'ami\x20disconnected'][_0x77da('0x14')]('\x20')));}var _0x6dd79f=schema(properties['voicequeuechannelredirect'])['validate'](_0x1bca78);if(_0x6dd79f[_0x77da('0x21')]>0x0){return _0x458da6(_0x2c4d7c['error'](0x1f4,_[_0x77da('0x26')](_0x6dd79f,_0x77da('0x19'))[_0x77da('0x14')](',\x20')));}var _0x4b9115=_[_0x77da('0x22')](_0x56458c[_0x77da('0x3e')],{'uniqueid':_0x1bca78[_0x77da('0x27')]});if(_0x4b9115&&_0x4b9115[_0x77da('0x28')]){return ami[_0x77da('0x1c')]({'action':'Redirect','channel':_0x4b9115[_0x77da('0x28')],'exten':_0x1bca78[_0x77da('0x48')],'context':_0x1bca78['context']||_0x4b9115[_0x77da('0x49')],'priority':0x1})[_0x77da('0x1d')](function(_0xd14296){_0x2c7c8e({'code':0xc8,'message':[_0x1bca78[_0x77da('0x27')],_0xd14296[_0x77da('0x19')][_0x77da('0x2e')]()][_0x77da('0x14')]('\x20')});})['catch'](function(_0x3f5766){_0x458da6(_0x2c4d7c['error'](0x1f5,[_0x1bca78[_0x77da('0x27')],_0x3f5766[_0x77da('0x19')][_0x77da('0x2e')]()][_0x77da('0x14')]('\x20')));});}else{return _0x458da6(_0x2c4d7c[_0x77da('0x11')](0x1f5,_0x77da('0x34')));}});},'Agents':function(_0xf75c3c){return new Promise(function(_0x103e1b){var _0x195a34=_[_0x77da('0x4a')](_0x56458c[_0x77da('0xd')]);if(_0xf75c3c&&_0xf75c3c['id']){var _0x19065e=_['find'](_0x195a34,function(_0x39d569){return _0x39d569['id']===_0xf75c3c['id'];});_0x103e1b(_0x19065e);}else{_0x103e1b({'count':_0x195a34[_0x77da('0x21')],'rows':_0x195a34});}});},'Telephones':function(){return new Promise(function(_0xeb5121){var _0x16d8cd=_['values'](_0x56458c[_0x77da('0x4b')]);_0xeb5121({'count':_0x16d8cd[_0x77da('0x21')],'rows':_0x16d8cd});});},'Trunks':function(){return new Promise(function(_0x16c7b7){var _0x4f3479=_[_0x77da('0x4a')](_0x56458c['trunks']);_0x16c7b7({'count':_0x4f3479['length'],'rows':_0x4f3479});});},'OutboundChannels':function(){return new Promise(function(_0x2a4f85){var _0x4015f0=_[_0x77da('0x4a')](_0x56458c[_0x77da('0x4c')]);_0x2a4f85({'count':_0x4015f0[_0x77da('0x21')],'rows':_0x4015f0});});},'Outbound':function(){return new Promise(function(_0x337621){_0x337621(_0x56458c[_0x77da('0x41')]);});},'Campaigns':function(){return new Promise(function(_0xf95d48){var _0x470840=_['values'](_0x56458c[_0x77da('0x4d')]);_0xf95d48({'count':_0x470840[_0x77da('0x21')],'rows':_0x470840});});},'VoiceQueuesPreview':function(_0x2d3ab4){var _0x1206c7=this;return new Promise(function(_0x17175,_0x502249){_0x19331c[_0x77da('0x4e')](_0x2d3ab4['id'])[_0x77da('0x1d')](function(_0x27c0a2){_0x17175({'code':0xc8,'message':_0x27c0a2[_0x77da('0x19')]});})[_0x77da('0x1a')](function(_0x94f1e1){_0x502249(_0x1206c7[_0x77da('0x11')](0x1f4,_0x94f1e1[_0x77da('0x19')]));});});},'EventManager':function(_0x352a4e){var _0x37d94a=this;return new Promise(function(_0x4df868,_0x519e38){if(!_0x352a4e['event']){return _0x519e38(_0x37d94a[_0x77da('0x11')](0x1f4,_0x77da('0x4f')));}ami[_0x77da('0x50')]('custom:'+_0x352a4e['event'],_0x352a4e[_0x77da('0x19')]);_0x4df868({'code':0xc8,'message':_0x352a4e});});},'FaxAccounts':function(){return new Promise(function(_0xdbd9d5){var _0x17a2e6=_[_0x77da('0x4a')](_0x56458c[_0x77da('0x51')]);_0xdbd9d5({'count':_0x17a2e6[_0x77da('0x21')],'rows':_0x17a2e6});});},'SendFax':function(_0x3fca4b){var _0x276805=this;return new Promise(function(_0x1523a8,_0x11152b){_0xc54a12[_0x77da('0x52')](_0x3fca4b)[_0x77da('0x1d')](function(_0x1d2944){_0x1523a8({'code':0xc8,'message':_0x1d2944['message']});})['catch'](function(_0x1cdd40){_0x11152b(_0x276805['error'](0x1f4,_0x1cdd40['message']));});});},'CheckAfterSend':function(_0x22de60){var _0x1e37da=this;return new Promise(function(_0x2ae66f,_0x583a7a){_0xc54a12['checkAfterSend'](_0x22de60)[_0x77da('0x1d')](function(_0x4f1ae0){_0x2ae66f({'code':0xc8,'message':_0x4f1ae0[_0x77da('0x19')]});})[_0x77da('0x1a')](function(_0x554c44){_0x583a7a(_0x1e37da[_0x77da('0x11')](0x1f4,_0x554c44['message']));});});}};var _0x15cec0=jayson[_0x77da('0x53')](_0x47cf1d)[_0x77da('0x54')]();_0x15cec0['on'](_0x77da('0x11'),function(_0x4e3014){return _0x30afe0(_0x4e3014);});_0x15cec0[_0x77da('0x6')](0x232a,_0x77da('0x55'),function(){console[_0x77da('0x56')](_0x77da('0x57'),0x232a);return _0x47da81(_0x77da('0x58')+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 7638e64..6e4f215 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 _0xf53b=['map','destcalleridnum','calleridnum','firstName','lastName','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','phone','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','routeId','calleridname','','destcalleridname','Unknown','createContact','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','push','format','name','action','merge','lodash','ioredis','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','localhost','info','[CM][%s][%s]','emit','exec','data2','data5','xmd-contactid','ListId','data3'];(function(_0x1a870b,_0x47da55){var _0x2f883e=function(_0x3be2ca){while(--_0x3be2ca){_0x1a870b['push'](_0x1a870b['shift']());}};_0x2f883e(++_0x47da55);}(_0xf53b,0x12d));var _0xbf53=function(_0x223fce,_0x5292fe){_0x223fce=_0x223fce-0x0;var _0x4ab12c=_0xf53b[_0x223fce];return _0x4ab12c;};'use strict';var _=require(_0xbf53('0x0'));var BPromise=require('bluebird');var Redis=require(_0xbf53('0x1'));var util=require('util');var config=require(_0xbf53('0x2'));var logger=require(_0xbf53('0x3'))(_0xbf53('0x4'));var cmContactRpc=require(_0xbf53('0x5'));config[_0xbf53('0x6')]=_['defaults'](config['redis'],{'host':_0xbf53('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x1912f4,_0x337abb,_0x1ebb66,_0x21b755,_0x14a255){logger[_0xbf53('0x8')](_0xbf53('0x9'),_0x1912f4,_0x337abb['id'],_0x1ebb66,_0x21b755,JSON['stringify'](_0x14a255));io['to'](_0x1ebb66)[_0xbf53('0xa')](_0x21b755,_0x14a255);}exports[_0xbf53('0xb')]=function(_0x1ea610,_0x235459,_0x231171,_0x3e318f){var _0x169806,_0x394214;var _0x831e26={};var _0xbbb4f6;var _0x1d18b8=Number(_0x231171['data1']);var _0x2668d0=_0x231171['data2']?Boolean(Number(_0x231171[_0xbf53('0xc')])):![];var _0x1653e9;var _0x1bab6a=![];if(!_['isNil'](_0x231171[_0xbf53('0xd')])){if(_0x231171['data5']=='1')_0x1bab6a=!![];}if(!_0x1bab6a){if(_0x3e318f[_0xbf53('0xe')]){_0x831e26['id']=_0x3e318f[_0xbf53('0xe')];}}if(!_0x831e26['id']){_0x831e26[_0xbf53('0xf')]=_0x1d18b8;_0x1653e9=_0x231171[_0xbf53('0x10')]&&_0x231171[_0xbf53('0x10')]!=='0'?_0x231171[_0xbf53('0x10')]['split'](','):['phone'];_0x831e26['$or']=_[_0xbf53('0x11')](_0x1653e9,function(_0x4af86f){var _0x2ca94c={};_0x2ca94c[_0x4af86f]=_0x3e318f['routeId']?_0x3e318f[_0xbf53('0x12')]:_0x3e318f[_0xbf53('0x13')];return _0x2ca94c;});_0xbbb4f6=_0x3e318f['routeId']?_0x3e318f[_0xbf53('0x12')]:_0x3e318f[_0xbf53('0x13')];}var _0x16a8cc=['id',_0xbf53('0x14'),_0xbf53('0x15'),'phone','mobile',_0xbf53('0x16'),_0xbf53('0xf'),_0xbf53('0x17'),_0xbf53('0x18'),_0xbf53('0x19')];var _0x8c66fc=_[_0xbf53('0x1a')](_0x16a8cc,_0x1653e9);BPromise[_0xbf53('0x1b')]()[_0xbf53('0x1c')](cmContactRpc['getContacts']({'attributes':_0x8c66fc,'where':_0x831e26,'phone':_0xbbb4f6}))['then'](function(_0x330885){_0x394214=_0x330885;if(!_[_0xbf53('0x1d')](_0x394214)){if(_0x394214[_0xbf53('0x1e')]===0x1){_0x169806=_0x394214[0x0];logger['info'](_0xbf53('0x1f'),_0x3e318f[_0xbf53('0x20')],_0x235459['id'],_0x169806['id']);}else{logger[_0xbf53('0x8')](_0xbf53('0x21'),_0x3e318f[_0xbf53('0x20')],_0x235459['id'],_[_0xbf53('0x11')](_0x394214,'id')[_0xbf53('0x22')](','));}return;}else{logger[_0xbf53('0x8')](_0xbf53('0x23'),_0x3e318f['uniqueid'],_0x235459['id']);var _0x1fec03={'ListId':_0x1d18b8};var _0x8eacf2=_0x231171[_0xbf53('0x24')]&&_0x231171[_0xbf53('0x24')]!=='0'?_0x231171[_0xbf53('0x24')]:_0xbf53('0x25');if(_0x2668d0){logger[_0xbf53('0x8')](_0xbf53('0x26'),_0x3e318f[_0xbf53('0x20')],_0x235459['id']);_0x1fec03[_0x8eacf2]=_[_0xbf53('0x27')](_0x3e318f[_0xbf53('0x28')])?_0x3e318f[_0xbf53('0x13')]:_0x3e318f['destcalleridnum'];if(_['isNil'](_0x3e318f[_0xbf53('0x28')])){_0x1fec03[_0xbf53('0x14')]=_0x3e318f[_0xbf53('0x29')]&&_0x3e318f[_0xbf53('0x29')]!==_0xbf53('0x2a')?_0x3e318f[_0xbf53('0x29')]:'Unknown';}else{_0x1fec03[_0xbf53('0x14')]=_0x3e318f[_0xbf53('0x2b')]&&_0x3e318f['destcalleridname']!==_0xbf53('0x2a')?_0x3e318f[_0xbf53('0x2b')]:_0xbf53('0x2c');}return BPromise[_0xbf53('0x1b')]()[_0xbf53('0x1c')](cmContactRpc[_0xbf53('0x2d')](_0x1fec03))[_0xbf53('0x1c')](function(_0xe6a535){_0x169806=_0xe6a535;_0x394214['push'](_0xe6a535);if(_0x169806){logger[_0xbf53('0x8')](_0xbf53('0x2e'),_0x3e318f[_0xbf53('0x20')],_0x235459['id'],_0x169806['id']);}return;});}else{logger[_0xbf53('0x8')](_0xbf53('0x2f'),_0x3e318f[_0xbf53('0x20')],_0x235459['id']);_0x1fec03[_0x8eacf2]=_['isNil'](_0x3e318f[_0xbf53('0x28')])?_0x3e318f[_0xbf53('0x13')]:_0x3e318f[_0xbf53('0x12')];if(_[_0xbf53('0x27')](_0x3e318f[_0xbf53('0x28')])){_0x1fec03[_0xbf53('0x14')]=_0x3e318f[_0xbf53('0x29')]&&_0x3e318f[_0xbf53('0x29')]!==''?_0x3e318f['calleridname']:_0xbf53('0x2c');}else{_0x1fec03['firstName']=_0x3e318f[_0xbf53('0x2b')]&&_0x3e318f[_0xbf53('0x2b')]!==_0xbf53('0x2a')?_0x3e318f[_0xbf53('0x2b')]:_0xbf53('0x2c');}_0x169806=_0x1fec03;_0x394214[_0xbf53('0x30')](_0x1fec03);return;}}})['then'](function(){if(_0x1ea610){emit(_0x3e318f['uniqueid'],_0x235459,util[_0xbf53('0x31')]('user:%s',_0x1ea610[_0xbf53('0x32')]),util[_0xbf53('0x31')]('trigger:%s',_0x231171[_0xbf53('0x33')]['toLowerCase']()),{'evt':_[_0xbf53('0x34')](_0x3e318f,{'autoCreate':_0x2668d0}),'contact':_0x169806===undefined?{}:_0x169806,'contacts':_0x394214[_0xbf53('0x1e')]===0x0?undefined:_0x394214});}});}; \ No newline at end of file +var _0xbfc7=['socket.io-emitter','[CM][%s][%s]','stringify','emit','exec','data2','data5','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','join','data4','info','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','Unknown','destcalleridname','createContact','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','isNil','format','user:%s','name','trigger:%s','action','merge','bluebird','ioredis','util','../../../../config/logger','trigger','redis','defaults','localhost'];(function(_0x32b867,_0x496ad9){var _0xc2500b=function(_0x4c50b0){while(--_0x4c50b0){_0x32b867['push'](_0x32b867['shift']());}};_0xc2500b(++_0x496ad9);}(_0xbfc7,0x1b8));var _0x7bfc=function(_0x4ca0fa,_0x32b6bf){_0x4ca0fa=_0x4ca0fa-0x0;var _0x266863=_0xbfc7[_0x4ca0fa];return _0x266863;};'use strict';var _=require('lodash');var BPromise=require(_0x7bfc('0x0'));var Redis=require(_0x7bfc('0x1'));var util=require(_0x7bfc('0x2'));var config=require('../../../../config/environment');var logger=require(_0x7bfc('0x3'))(_0x7bfc('0x4'));var cmContactRpc=require('../../rpc/cmContact');config[_0x7bfc('0x5')]=_[_0x7bfc('0x6')](config[_0x7bfc('0x5')],{'host':_0x7bfc('0x7'),'port':0x18eb});var io=require(_0x7bfc('0x8'))(new Redis(config['redis']));function emit(_0x3a01e0,_0x1d112f,_0xa53573,_0x34379e,_0x53c736){logger['info'](_0x7bfc('0x9'),_0x3a01e0,_0x1d112f['id'],_0xa53573,_0x34379e,JSON[_0x7bfc('0xa')](_0x53c736));io['to'](_0xa53573)[_0x7bfc('0xb')](_0x34379e,_0x53c736);}exports[_0x7bfc('0xc')]=function(_0x5c0001,_0x51a126,_0x1c538d,_0x46636b){var _0xee823a,_0x2f5374;var _0x29c4ba={};var _0x5d2058;var _0xbd766a=Number(_0x1c538d['data1']);var _0x5cb935=_0x1c538d[_0x7bfc('0xd')]?Boolean(Number(_0x1c538d[_0x7bfc('0xd')])):![];var _0x214a18;var _0x29d343=![];if(!_['isNil'](_0x1c538d[_0x7bfc('0xe')])){if(_0x1c538d[_0x7bfc('0xe')]=='1')_0x29d343=!![];}if(!_0x29d343){if(_0x46636b['xmd-contactid']){_0x29c4ba['id']=_0x46636b['xmd-contactid'];}}if(!_0x29c4ba['id']){_0x29c4ba[_0x7bfc('0xf')]=_0xbd766a;_0x214a18=_0x1c538d[_0x7bfc('0x10')]&&_0x1c538d[_0x7bfc('0x10')]!=='0'?_0x1c538d[_0x7bfc('0x10')][_0x7bfc('0x11')](','):[_0x7bfc('0x12')];_0x29c4ba[_0x7bfc('0x13')]=_[_0x7bfc('0x14')](_0x214a18,function(_0x9fa16){var _0x31854d={};_0x31854d[_0x9fa16]=_0x46636b[_0x7bfc('0x15')]?_0x46636b[_0x7bfc('0x16')]:_0x46636b[_0x7bfc('0x17')];return _0x31854d;});_0x5d2058=_0x46636b[_0x7bfc('0x15')]?_0x46636b[_0x7bfc('0x16')]:_0x46636b['calleridnum'];}var _0x325d62=['id',_0x7bfc('0x18'),_0x7bfc('0x19'),_0x7bfc('0x12'),_0x7bfc('0x1a'),_0x7bfc('0x1b'),_0x7bfc('0xf'),_0x7bfc('0x1c'),_0x7bfc('0x1d'),_0x7bfc('0x1e')];var _0x1bfb8d=_['union'](_0x325d62,_0x214a18);BPromise[_0x7bfc('0x1f')]()[_0x7bfc('0x20')](cmContactRpc[_0x7bfc('0x21')]({'attributes':_0x1bfb8d,'where':_0x29c4ba,'phone':_0x5d2058}))['then'](function(_0x58d88c){_0x2f5374=_0x58d88c;if(!_[_0x7bfc('0x22')](_0x2f5374)){if(_0x2f5374[_0x7bfc('0x23')]===0x1){_0xee823a=_0x2f5374[0x0];logger['info']('[CM][%s][%s]\x20Contact\x20found:%s',_0x46636b['uniqueid'],_0x51a126['id'],_0xee823a['id']);}else{logger['info'](_0x7bfc('0x24'),_0x46636b[_0x7bfc('0x25')],_0x51a126['id'],_[_0x7bfc('0x14')](_0x2f5374,'id')[_0x7bfc('0x26')](','));}return;}else{logger['info']('[CM][%s][%s]\x20Contact\x20not\x20found',_0x46636b[_0x7bfc('0x25')],_0x51a126['id']);var _0x3cd740={'ListId':_0xbd766a};var _0x537641=_0x1c538d[_0x7bfc('0x27')]&&_0x1c538d['data4']!=='0'?_0x1c538d[_0x7bfc('0x27')]:_0x7bfc('0x12');if(_0x5cb935){logger[_0x7bfc('0x28')](_0x7bfc('0x29'),_0x46636b[_0x7bfc('0x25')],_0x51a126['id']);_0x3cd740[_0x537641]=_['isNil'](_0x46636b[_0x7bfc('0x15')])?_0x46636b[_0x7bfc('0x17')]:_0x46636b['destcalleridnum'];if(_['isNil'](_0x46636b[_0x7bfc('0x15')])){_0x3cd740[_0x7bfc('0x18')]=_0x46636b[_0x7bfc('0x2a')]&&_0x46636b[_0x7bfc('0x2a')]!==_0x7bfc('0x2b')?_0x46636b['calleridname']:_0x7bfc('0x2c');}else{_0x3cd740[_0x7bfc('0x18')]=_0x46636b[_0x7bfc('0x2d')]&&_0x46636b[_0x7bfc('0x2d')]!==_0x7bfc('0x2b')?_0x46636b[_0x7bfc('0x2d')]:_0x7bfc('0x2c');}return BPromise['resolve']()[_0x7bfc('0x20')](cmContactRpc[_0x7bfc('0x2e')](_0x3cd740))[_0x7bfc('0x20')](function(_0x53e567){_0xee823a=_0x53e567;_0x2f5374['push'](_0x53e567);if(_0xee823a){logger[_0x7bfc('0x28')](_0x7bfc('0x2f'),_0x46636b[_0x7bfc('0x25')],_0x51a126['id'],_0xee823a['id']);}return;});}else{logger[_0x7bfc('0x28')](_0x7bfc('0x30'),_0x46636b[_0x7bfc('0x25')],_0x51a126['id']);_0x3cd740[_0x537641]=_[_0x7bfc('0x31')](_0x46636b[_0x7bfc('0x15')])?_0x46636b[_0x7bfc('0x17')]:_0x46636b['destcalleridnum'];if(_[_0x7bfc('0x31')](_0x46636b['routeId'])){_0x3cd740[_0x7bfc('0x18')]=_0x46636b[_0x7bfc('0x2a')]&&_0x46636b[_0x7bfc('0x2a')]!==_0x7bfc('0x2b')?_0x46636b[_0x7bfc('0x2a')]:'Unknown';}else{_0x3cd740[_0x7bfc('0x18')]=_0x46636b[_0x7bfc('0x2d')]&&_0x46636b['destcalleridname']!==_0x7bfc('0x2b')?_0x46636b[_0x7bfc('0x2d')]:_0x7bfc('0x2c');}_0xee823a=_0x3cd740;_0x2f5374['push'](_0x3cd740);return;}}})[_0x7bfc('0x20')](function(){if(_0x5c0001){emit(_0x46636b[_0x7bfc('0x25')],_0x51a126,util[_0x7bfc('0x32')](_0x7bfc('0x33'),_0x5c0001[_0x7bfc('0x34')]),util[_0x7bfc('0x32')](_0x7bfc('0x35'),_0x1c538d[_0x7bfc('0x36')]['toLowerCase']()),{'evt':_[_0x7bfc('0x37')](_0x46636b,{'autoCreate':_0x5cb935}),'contact':_0xee823a===undefined?{}:_0xee823a,'contacts':_0x2f5374['length']===0x0?undefined:_0x2f5374});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 4a4319f..bf14e4d 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 _0x8ac5=['null','substatus','offlineMessage','created','exports','util','lodash','url','mustache','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','trigger','../ami','redis','defaults','localhost','socket.io-emitter','popup','winapp','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','accounts','servicenowAccounts','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentreject','custom:queuecallerabandon','custom:timeout','custom:dialbegin','custom:dialconnect','syncAgentDial','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:rejectmessage','custom:offlineMessage','prototype','info','emit','clone','motionChannel','undefined','voice','checkTriggers','interface','triggers','hasOwnProperty','status','checkTrigger','merge','variables','length','action','toLowerCase','contactmanager','motionbar','browser','data1','TemplateId','render','data2','uri','buildUri','isNil','data3','data4','uriLocation','windowWidth','data5','windowHeight','data6','600','winApplication','format','user:%s','name','trigger:%s:%s','jscripty','trigger:%s','exec','integration','queue','routeId','urlforward','script','search','replace','channel','every','AllConditions','AnyConditions','checkConditions','field','account','chat','operator','value','AccountId','upperFirst','interaction','message','event','agent','membername','lastevent','mailSubstatus'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8ac5,0x105));var _0x58ac=function(_0x3a8c85,_0x4ce1bf){_0x3a8c85=_0x3a8c85-0x0;var _0x3c11bf=_0x8ac5[_0x3a8c85];return _0x3c11bf;};'use strict';var util=require(_0x58ac('0x0'));var _=require(_0x58ac('0x1'));var url=require(_0x58ac('0x2'));var Mustache=require(_0x58ac('0x3'));var Redis=require(_0x58ac('0x4'));var urlforward=require(_0x58ac('0x5'));var integration=require(_0x58ac('0x6'));var cmContact=require(_0x58ac('0x7'));var script=require(_0x58ac('0x8'));var config=require(_0x58ac('0x9'));var logger=require('../../../config/logger')(_0x58ac('0xa'));var ami=require(_0x58ac('0xb'));config[_0x58ac('0xc')]=_[_0x58ac('0xd')](config[_0x58ac('0xc')],{'host':_0x58ac('0xe'),'port':0x18eb});var io=require(_0x58ac('0xf'))(new Redis(config[_0x58ac('0xc')]));var operators={'equals':function(_0x306c05,_0x34d977){return _0x306c05==_0x34d977;},'not_equals':function(_0x35b98a,_0x2ec031){return _0x35b98a!=_0x2ec031;}};var barAndWebActions=[_0x58ac('0x10'),'url',_0x58ac('0x11')];function Trigger(_0x265880){this['triggers']=_0x265880['triggers'];this[_0x58ac('0x12')]=_0x265880[_0x58ac('0x12')];this[_0x58ac('0x13')]=_0x265880[_0x58ac('0x13')];this[_0x58ac('0x14')]=_0x265880['templates'];this[_0x58ac('0x15')]=_0x265880[_0x58ac('0x15')];this[_0x58ac('0x16')]=_0x265880[_0x58ac('0x16')];this[_0x58ac('0x17')]=_0x265880[_0x58ac('0x17')];this['salesforceAccounts']=_0x265880[_0x58ac('0x18')];this[_0x58ac('0x19')]=_0x265880[_0x58ac('0x19')];this[_0x58ac('0x1a')]=_0x265880[_0x58ac('0x1a')];this[_0x58ac('0x1b')]=_0x265880[_0x58ac('0x1b')];this[_0x58ac('0x1c')]=_0x265880[_0x58ac('0x1c')];this['servicenowAccounts']=_0x265880['servicenowAccounts'];this[_0x58ac('0x1d')]=_0x265880['dynamics365Accounts'];this[_0x58ac('0x1e')]=_0x265880[_0x58ac('0x1e')];this[_0x58ac('0x1f')]={'zendesk':this[_0x58ac('0x16')],'salesforce':this[_0x58ac('0x18')],'freshdesk':this[_0x58ac('0x17')],'sugarcrm':this[_0x58ac('0x19')],'zoho':this[_0x58ac('0x1a')],'desk':this[_0x58ac('0x1b')],'vtiger':this[_0x58ac('0x1c')],'dynamics365':this[_0x58ac('0x1d')],'freshsales':this[_0x58ac('0x1e')],'servicenow':this[_0x58ac('0x20')]};ami['on']('custom:agentcalled',this[_0x58ac('0x21')][_0x58ac('0x22')](this));ami['on'](_0x58ac('0x23'),this[_0x58ac('0x21')][_0x58ac('0x22')](this));ami['on'](_0x58ac('0x24'),this['syncCustomEvent'][_0x58ac('0x22')](this));ami['on']('custom:agentcomplete',this[_0x58ac('0x21')]['bind'](this));ami['on'](_0x58ac('0x25'),this[_0x58ac('0x21')]['bind'](this));ami['on'](_0x58ac('0x26'),this[_0x58ac('0x21')][_0x58ac('0x22')](this));ami['on'](_0x58ac('0x27'),this['syncCustomEvent']['bind'](this));ami['on']('custom:agentcongestion',this[_0x58ac('0x21')]['bind'](this));ami['on'](_0x58ac('0x28'),this[_0x58ac('0x21')][_0x58ac('0x22')](this));ami['on']('custom:amd',this[_0x58ac('0x21')][_0x58ac('0x22')](this));ami['on'](_0x58ac('0x29'),this[_0x58ac('0x21')][_0x58ac('0x22')](this));ami['on'](_0x58ac('0x2a'),this[_0x58ac('0x21')]['bind'](this));ami['on'](_0x58ac('0x2b'),this['syncAgentDial'][_0x58ac('0x22')](this));ami['on'](_0x58ac('0x2c'),this[_0x58ac('0x2d')][_0x58ac('0x22')](this));ami['on'](_0x58ac('0x2e'),this['syncAgentDial'][_0x58ac('0x22')](this));ami['on'](_0x58ac('0x2f'),this[_0x58ac('0x21')][_0x58ac('0x22')](this));ami['on'](_0x58ac('0x30'),this['syncCustomEvent'][_0x58ac('0x22')](this));ami['on']('custom:substatus',this[_0x58ac('0x21')]['bind'](this));ami['on'](_0x58ac('0x31'),this['syncCustomEvent']['bind'](this));ami['on'](_0x58ac('0x32'),this[_0x58ac('0x21')][_0x58ac('0x22')](this));ami['on']('custom:acceptmessage',this[_0x58ac('0x21')]['bind'](this));ami['on'](_0x58ac('0x33'),this[_0x58ac('0x21')][_0x58ac('0x22')](this));ami['on'](_0x58ac('0x34'),this[_0x58ac('0x21')][_0x58ac('0x22')](this));}Trigger[_0x58ac('0x35')]['emit']=function(_0x4d1099,_0x23b150,_0x144c6b){logger[_0x58ac('0x36')](_0x4d1099,_0x23b150,JSON['stringify'](_0x144c6b));io['to'](_0x4d1099)[_0x58ac('0x37')](_0x23b150,_0x144c6b);};Trigger['prototype'][_0x58ac('0x21')]=function(_0x4df0e6){var _0xbee8d2=_[_0x58ac('0x38')](_0x4df0e6);if(typeof _0xbee8d2[_0x58ac('0x39')]===_0x58ac('0x3a')){_0xbee8d2[_0x58ac('0x39')]=_0x58ac('0x3b');}this[_0x58ac('0x3c')](_0xbee8d2);};Trigger['prototype'][_0x58ac('0x2d')]=function(_0x2105d7){if(this['agents'][_0x2105d7[_0x58ac('0x3d')]]){this[_0x58ac('0x21')](_0x2105d7);}};Trigger['prototype'][_0x58ac('0x3c')]=function(_0x2e1cfb){var _0x5db1ca;for(var _0x430dd3 in this[_0x58ac('0x3e')]){if(this[_0x58ac('0x3e')][_0x58ac('0x3f')](_0x430dd3)){if(this[_0x58ac('0x3e')][_0x430dd3][_0x58ac('0x40')]){_0x5db1ca=this[_0x58ac('0x41')](this[_0x58ac('0x3e')][_0x430dd3],_0x2e1cfb);if(_0x5db1ca){_[_0x58ac('0x42')](_0x2e1cfb,_0x2e1cfb[_0x58ac('0x43')]);for(var _0x3cef4a=0x0,_0x55a7b6,_0x2883fd,_0x2d411c;_0x3cef4a0x0){_0x59bf34=_[_0xbe14('0x2b')](_0x16f884,_0x29fc64);}return _0x59bf34;}function getCustomFields(_0x1c7cc7,_0x19252f){var _0x34d648=[];var _0x36d4b2={'custom_fields':{}};if(_0x1c7cc7[_0xbe14('0x2a')]>0x0){_[_0xbe14('0x2c')](_0x1c7cc7,function(_0x4168c8){if(_[_0xbe14('0x2d')]([_0xbe14('0x2e'),_0xbe14('0x2f')],_0x4168c8[_0xbe14('0x30')])&&_0x4168c8[_0xbe14('0x31')]&&!_0x4168c8[_0xbe14('0x32')]){_0x36d4b2[_0x4168c8[_0xbe14('0x31')][_0xbe14('0x33')]()]=_0x4168c8[_0xbe14('0x34')][_0xbe14('0x35')]();}else if(_[_0xbe14('0x2d')](['string',_0xbe14('0x2f')],_0x4168c8['type'])&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x36d4b2['custom_fields'][_0x4168c8[_0xbe14('0x36')]]=_0x4168c8[_0xbe14('0x34')]['toString']();}else if(_0x4168c8['type']==='variable'&&_0x4168c8[_0xbe14('0x37')]&&_0x4168c8[_0xbe14('0x36')]&&_0x4168c8['customField']){_0x19252f[_0x4168c8[_0xbe14('0x37')]]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x37')]][_0xbe14('0x35')]());}else if(_0x4168c8['type']==='customVariable'&&_0x4168c8[_0xbe14('0x39')]&&_0x4168c8['Variable']['name']&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()][_0xbe14('0x35')]());}});}if(_0x36d4b2[_0xbe14('0x3b')]){_0x36d4b2[_0xbe14('0x3b')]=Number(_0x36d4b2['priority']);}return _0x36d4b2;}function getTicket(_0x4f51f8,_0x43cdaa,_0x2951e1,_0x13bfcf,_0x520e09){logger[_0xbe14('0x12')](_0xbe14('0x3c'));var _0xeda70e=_[_0xbe14('0x3d')]({'subject':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x3f')],_0x520e09,'\x20'),'type':_0xbe14('0x40'),'status':_0xbe14('0x41'),'labels':[_0xbe14('0x42'),'Motion',_0xbe14('0x43')][_0xbe14('0x44')](getTags(_0x13bfcf[_0xbe14('0x45')],_0xbe14('0x3a'))),'description':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0xbe14('0x47'),_0x43cdaa['id']),'class':_0xbe14('0x48')}},'message':{'direction':'in','body':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a')}},getCustomFields(_0x13bfcf['Fields'],_0x520e09));return request({'uri':util['format'](_0xbe14('0x49'),_0x4f51f8[_0xbe14('0x28')],_0x2951e1['id']),'method':_0xbe14('0x29'),'body':_0xeda70e});}exports['queue']=function(_0x5d5318,_0x6b6aa8,_0x59ae4d,_0x5657fe,_0x3593f8,_0x1f0355){var _0x8216c3,_0x5051e4;_0x1f0355['remoteUri']=intUtil['stripTrailingSlash'](_0x1f0355[_0xbe14('0x28')]);_0x1f0355[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x1f0355['serverUrl']);if(_0x3593f8&&_0x3593f8[_0xbe14('0x4c')]){logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x4e'));_0x6b6aa8['recordingURL']=util['format'](_0xbe14('0x4f'),_0x1f0355[_0xbe14('0x4a')],_0x6b6aa8[_0xbe14('0x50')],md5(_0x6b6aa8[_0xbe14('0x50')]));}else{_0x6b6aa8[_0xbe14('0x51')]='';}headers['Authorization']=getAuth(_0x1f0355);return getUser(_0x1f0355,_0x5657fe['email'])[_0xbe14('0xd')](function(_0x2a3623){_0x8216c3=_0x2a3623;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x8216c3['id']);return getEndUser(_0x1f0355,_0x6b6aa8['calleridname'],_0x6b6aa8[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x53e8ab){_0x5051e4=_0x53e8ab;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x5051e4['id']);return getTicket(_0x1f0355,_0x8216c3,_0x5051e4,_0x59ae4d,_0x6b6aa8);})[_0xbe14('0xd')](function(_0x36c20c){if(_0x36c20c){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x36c20c['id']);switch(_0x1f0355['type']){case'integrationTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x36c20c['id']});break;case'newTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe['name']),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')](_0xbe14('0x5b'),_0x36c20c['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x4d'),_0xbe14('0x5d'));}}})['catch'](function(_0x5aeea9){console[_0xbe14('0x5c')](_0x5aeea9);logger[_0xbe14('0x5c')](_0xbe14('0x4d'),JSON['stringify'](_0x5aeea9));});};exports['outbound']=function(_0x44fe0d,_0x134878,_0x50d78f,_0x339a86,_0x32496a,_0x50c2a0,_0x28f995){var _0x4a40d2,_0x41ba58;_0x50c2a0[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['remoteUri']);_0x50c2a0[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['serverUrl']);if(_0x28f995&&_0x28f995[_0xbe14('0x5e')]&&_0x28f995[_0xbe14('0x5e')]!==_0xbe14('0x5f')){logger[_0xbe14('0x12')](_0xbe14('0x60'),'Recording\x20is\x20enabled!');_0x134878[_0xbe14('0x51')]=util[_0xbe14('0xb')](_0xbe14('0x4f'),_0x50c2a0[_0xbe14('0x4a')],_0x134878[_0xbe14('0x50')],md5(_0x134878[_0xbe14('0x50')]));}headers[_0xbe14('0x61')]=getAuth(_0x50c2a0);return getUser(_0x50c2a0,_0x339a86['email'])[_0xbe14('0xd')](function(_0x1b47a4){_0x4a40d2=_0x1b47a4;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x4a40d2['id']);return getEndUser(_0x50c2a0,_0x134878[_0xbe14('0x62')],_0x134878[_0xbe14('0x63')]);})[_0xbe14('0xd')](function(_0x32df3c){_0x41ba58=_0x32df3c;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x41ba58['id']);return getTicket(_0x50c2a0,_0x4a40d2,_0x41ba58,_0x50d78f,_0x134878);})[_0xbe14('0xd')](function(_0x4bccfc){if(_0x4bccfc){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x4bccfc['id']);switch(_0x50c2a0[_0xbe14('0x30')]){case _0xbe14('0x64'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x4bccfc['id']});break;case _0xbe14('0x65'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')]('%s/agent/tickets/%s',_0x50c2a0[_0xbe14('0x28')],_0x4bccfc['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x60'),_0xbe14('0x5d'));}}})[_0xbe14('0x66')](function(_0x222944){logger[_0xbe14('0x5c')](_0xbe14('0x60'),JSON[_0xbe14('0x19')](_0x222944));});};exports[_0xbe14('0x67')]=function(_0x5917d5,_0x18be56,_0x442ec4,_0x2d4dd4,_0xfd32a3,_0x3ac6d8){var _0x5a1ea6,_0x42b341;_0x3ac6d8[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x3ac6d8[_0xbe14('0x28')]);_0x3ac6d8[_0xbe14('0x4a')]=intUtil['stripTrailingSlash'](_0x3ac6d8[_0xbe14('0x4a')]);if(_0xfd32a3&&_0xfd32a3[_0xbe14('0x4c')]){logger[_0xbe14('0x12')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',_0xbe14('0x4e'));_0x18be56[_0xbe14('0x51')]=util[_0xbe14('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ac6d8[_0xbe14('0x4a')],_0x18be56[_0xbe14('0x50')],md5(_0x18be56[_0xbe14('0x50')]));}else{_0x18be56[_0xbe14('0x51')]='';}headers[_0xbe14('0x61')]=getAuth(_0x3ac6d8);return getUser(_0x3ac6d8)[_0xbe14('0xd')](function(_0x445302){_0x5a1ea6=_0x445302;logger['info']('The\x20User\x20ID\x20is:',_0x5a1ea6['id']);return getEndUser(_0x3ac6d8,_0x18be56[_0xbe14('0x6a')],_0x18be56[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x2510a0){_0x42b341=_0x2510a0;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x42b341['id']);return getTicket(_0x3ac6d8,_0x5a1ea6,_0x42b341,_0x442ec4,_0x18be56);})[_0xbe14('0xd')](function(_0x43511e){if(_0x43511e){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x43511e['id']);}})[_0xbe14('0x66')](function(_0x57729f){logger[_0xbe14('0x5c')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',JSON[_0xbe14('0x19')](_0x57729f));});}; \ No newline at end of file +var _0x3e74=['customField','content','idField','custom_fields','variable','variableName','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','getString','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','stripTrailingSlash','serverUrl','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','newTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','catch','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','The\x20Enduser\x20ID\x20is:','trigger:desk:display','trigger:browser:url','%s/agent/tickets/%s','stringify','unmanaged','monitor_format','lastevent','toUpperCase','calleridnum','lodash','md5','util','ioredis','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Getting\x20agent\x20with\x20email','%s/users','then','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','debug','[HTTP]','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','total_entries','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length','forEach','includes','string','picklist','type','nameField'];(function(_0x214374,_0x5aa975){var _0x185d47=function(_0x19b498){while(--_0x19b498){_0x214374['push'](_0x214374['shift']());}};_0x185d47(++_0x5aa975);}(_0x3e74,0x175));var _0x43e7=function(_0x1f3b26,_0x127e9d){_0x1f3b26=_0x1f3b26-0x0;var _0x2f0759=_0x3e74[_0x1f3b26];return _0x2f0759;};'use strict';var _=require(_0x43e7('0x0'));var rp=require('request-promise');var md5=require(_0x43e7('0x1'));var util=require(_0x43e7('0x2'));var Redis=require(_0x43e7('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x43e7('0x4'))('desk');config[_0x43e7('0x5')]=_[_0x43e7('0x6')](config[_0x43e7('0x5')],{'host':_0x43e7('0x7'),'port':0x18eb});var io=require(_0x43e7('0x8'))(new Redis(config['redis']));function emit(_0x45a0d1,_0x3491d6,_0x2ede2d){io['to'](_0x45a0d1)[_0x43e7('0x9')](_0x3491d6,_0x2ede2d);}var headers={'Content-Type':_0x43e7('0xa'),'Accept':'application/json'};function getUser(_0x212c6c,_0x554d44){if(intUtil['validateEmail'](_0x554d44)===!![]){logger[_0x43e7('0xb')](_0x43e7('0xc'),_0x554d44);return request({'uri':util['format'](_0x43e7('0xd'),_0x212c6c['remoteUri'])})[_0x43e7('0xe')](function(_0x37302c){if(_0x37302c['total_entries']){return _[_0x43e7('0xf')](_0x37302c[_0x43e7('0x10')][_0x43e7('0x11')],{'email':_0x554d44});}})[_0x43e7('0xe')](function(_0x4e008c){if(_0x4e008c){logger['info'](_0x43e7('0x12'));return _0x4e008c;}else{logger[_0x43e7('0xb')](_0x43e7('0x13'));return request({'uri':util['format']('%s/users/me',_0x212c6c[_0x43e7('0x14')])});}});}else{logger[_0x43e7('0xb')](_0x43e7('0x15'));return request({'uri':util[_0x43e7('0x16')]('%s/users/me',_0x212c6c['remoteUri'])});}}function request(_0xdf16c){logger[_0x43e7('0x17')](_0x43e7('0x18'),JSON['stringify'](_0xdf16c));return rp(_['defaults'](_0xdf16c,{'method':_0x43e7('0x19'),'headers':headers,'json':!![]}));}function getAuth(_0x1ca758){var _0x9037d3;if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1b')){_0x9037d3=util[_0x43e7('0x16')](_0x43e7('0x1c'),_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1e')]);}else if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1f')){_0x9037d3=util[_0x43e7('0x16')]('%s/token:%s',_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1f')]);}return util['format'](_0x43e7('0x20'),new Buffer(_0x9037d3)[_0x43e7('0x21')](_0x43e7('0x22')));}function getEndUser(_0x28aacc,_0x4077fb,_0x2f4cb4){logger['info'](_0x43e7('0x23'),_0x2f4cb4);return request({'uri':util['format']('%s/customers/search',_0x28aacc[_0x43e7('0x14')]),'qs':{'phone':_0x2f4cb4}})[_0x43e7('0xe')](function(_0x4b2b9f){if(_0x4b2b9f[_0x43e7('0x24')]){logger['info'](_0x43e7('0x25'));return _0x4b2b9f['_embedded'][_0x43e7('0x11')][0x0];}else{logger[_0x43e7('0xb')](_0x43e7('0x26'));return request({'uri':util[_0x43e7('0x16')]('%s/customers',_0x28aacc['remoteUri']),'method':_0x43e7('0x27'),'body':{'first_name':_0x4077fb,'title':_0x4077fb,'phone_numbers':[{'type':'work','value':_0x2f4cb4}]}});}});}function getTags(_0x2dd5f,_0x40dc8f){var _0x3565cf=[];if(_0x2dd5f&&_0x2dd5f[_0x43e7('0x28')]>0x0){_0x3565cf=_['map'](_0x2dd5f,_0x40dc8f);}return _0x3565cf;}function getCustomFields(_0x33a1a5,_0x4690a6){var _0x45b675=[];var _0x50f9f5={'custom_fields':{}};if(_0x33a1a5[_0x43e7('0x28')]>0x0){_[_0x43e7('0x29')](_0x33a1a5,function(_0x2b85a5){if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5[_0x43e7('0x2d')])&&_0x2b85a5[_0x43e7('0x2e')]&&!_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x2b85a5[_0x43e7('0x2e')]['toLowerCase']()]=_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x21')]();}else if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5['type'])&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x2b85a5['content']['toString']();}else if(_0x2b85a5['type']===_0x43e7('0x33')&&_0x2b85a5[_0x43e7('0x34')]&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x34')]]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5['idField']]=_0x4690a6[_0x2b85a5['variableName']]['toString']());}else if(_0x2b85a5['type']==='customVariable'&&_0x2b85a5['Variable']&&_0x2b85a5['Variable'][_0x43e7('0x35')]&&_0x2b85a5['idField']&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x36')][_0x43e7('0x35')][_0x43e7('0x37')]()]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x4690a6[_0x2b85a5[_0x43e7('0x36')]['name']['toLowerCase']()]['toString']());}});}if(_0x50f9f5[_0x43e7('0x38')]){_0x50f9f5[_0x43e7('0x38')]=Number(_0x50f9f5[_0x43e7('0x38')]);}return _0x50f9f5;}function getTicket(_0x16cdba,_0x1b1440,_0x1ed538,_0x1d4589,_0x2ffd43){logger['info'](_0x43e7('0x39'));var _0x2b0ffe=_['merge']({'subject':intUtil[_0x43e7('0x3a')](_0x1d4589['Subjects'],_0x2ffd43,'\x20'),'type':_0x43e7('0x3b'),'status':_0x43e7('0x3c'),'labels':[_0x43e7('0x3d'),_0x43e7('0x3e'),_0x43e7('0x3f')][_0x43e7('0x40')](getTags(_0x1d4589['Tags'],'name')),'description':intUtil[_0x43e7('0x3a')](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a'),'_links':{'assigned_user':{'href':util[_0x43e7('0x16')](_0x43e7('0x42'),_0x1b1440['id']),'class':_0x43e7('0x43')}},'message':{'direction':'in','body':intUtil['getString'](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a')}},getCustomFields(_0x1d4589[_0x43e7('0x44')],_0x2ffd43));return request({'uri':util['format'](_0x43e7('0x45'),_0x16cdba['remoteUri'],_0x1ed538['id']),'method':_0x43e7('0x27'),'body':_0x2b0ffe});}exports['queue']=function(_0x3d81ae,_0x3b4235,_0x3a5807,_0x1c2c6b,_0x49b866,_0x47d6a1){var _0x103393,_0x40c509;_0x47d6a1[_0x43e7('0x14')]=intUtil[_0x43e7('0x46')](_0x47d6a1['remoteUri']);_0x47d6a1['serverUrl']=intUtil['stripTrailingSlash'](_0x47d6a1[_0x43e7('0x47')]);if(_0x49b866&&_0x49b866['monitor_format']){logger[_0x43e7('0xb')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3b4235[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x47d6a1[_0x43e7('0x47')],_0x3b4235[_0x43e7('0x4a')],md5(_0x3b4235[_0x43e7('0x4a')]));}else{_0x3b4235['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x47d6a1);return getUser(_0x47d6a1,_0x1c2c6b[_0x43e7('0x4c')])[_0x43e7('0xe')](function(_0x1fd277){_0x103393=_0x1fd277;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x103393['id']);return getEndUser(_0x47d6a1,_0x3b4235['calleridname'],_0x3b4235['calleridnum']);})[_0x43e7('0xe')](function(_0x36a09e){_0x40c509=_0x36a09e;logger[_0x43e7('0xb')]('The\x20Enduser\x20ID\x20is:',_0x40c509['id']);return getTicket(_0x47d6a1,_0x103393,_0x40c509,_0x3a5807,_0x3b4235);})['then'](function(_0x56489b){if(_0x56489b){logger[_0x43e7('0xb')](_0x43e7('0x4e'));logger['info'](_0x43e7('0x4f'),_0x56489b['id']);switch(_0x47d6a1[_0x43e7('0x2d')]){case _0x43e7('0x50'):logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0x43e7('0x51'),_0x1c2c6b[_0x43e7('0x35')]),'trigger:desk:display',{'recordId':_0x56489b['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')](_0x43e7('0x53'),_0x43e7('0x54'));emit(util['format'](_0x43e7('0x51'),_0x1c2c6b['name']),'trigger:browser:url',{'uri':util[_0x43e7('0x16')](_0x43e7('0x55'),_0x56489b['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x53'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x1cd87c){console[_0x43e7('0x56')](_0x1cd87c);logger[_0x43e7('0x56')](_0x43e7('0x53'),JSON['stringify'](_0x1cd87c));});};exports[_0x43e7('0x59')]=function(_0x46c910,_0x499c03,_0x39e3ca,_0x4e6f6d,_0x35b799,_0x520857,_0x34e2ec){var _0x1f561f,_0xfe13fa;_0x520857['remoteUri']=intUtil['stripTrailingSlash'](_0x520857[_0x43e7('0x14')]);_0x520857[_0x43e7('0x47')]=intUtil[_0x43e7('0x46')](_0x520857[_0x43e7('0x47')]);if(_0x34e2ec&&_0x34e2ec[_0x43e7('0x5a')]&&_0x34e2ec[_0x43e7('0x5a')]!==_0x43e7('0x5b')){logger[_0x43e7('0xb')](_0x43e7('0x5c'),_0x43e7('0x5d'));_0x499c03[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x520857[_0x43e7('0x47')],_0x499c03['uniqueid'],md5(_0x499c03[_0x43e7('0x4a')]));}headers[_0x43e7('0x4b')]=getAuth(_0x520857);return getUser(_0x520857,_0x4e6f6d[_0x43e7('0x4c')])['then'](function(_0x5d63c6){_0x1f561f=_0x5d63c6;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x1f561f['id']);return getEndUser(_0x520857,_0x499c03['destcalleridname'],_0x499c03[_0x43e7('0x5e')]);})['then'](function(_0x49a6ce){_0xfe13fa=_0x49a6ce;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xfe13fa['id']);return getTicket(_0x520857,_0x1f561f,_0xfe13fa,_0x39e3ca,_0x499c03);})[_0x43e7('0xe')](function(_0x40155c){if(_0x40155c){logger[_0x43e7('0xb')]('Ticket\x20created!');logger[_0x43e7('0xb')](_0x43e7('0x4f'),_0x40155c['id']);switch(_0x520857['type']){case _0x43e7('0x50'):logger[_0x43e7('0xb')](_0x43e7('0x53'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format']('user:%s',_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x60'),{'recordId':_0x40155c['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x43e7('0x16')](_0x43e7('0x51'),_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x61'),{'uri':util['format'](_0x43e7('0x62'),_0x520857[_0x43e7('0x14')],_0x40155c['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x5c'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x4665db){logger[_0x43e7('0x56')](_0x43e7('0x5c'),JSON[_0x43e7('0x63')](_0x4665db));});};exports[_0x43e7('0x64')]=function(_0x57fdfe,_0x5f3824,_0x2b0711,_0x58a3a8,_0x501616,_0x50edb2){var _0xb3e981,_0xe666b0;_0x50edb2['remoteUri']=intUtil[_0x43e7('0x46')](_0x50edb2[_0x43e7('0x14')]);_0x50edb2[_0x43e7('0x47')]=intUtil['stripTrailingSlash'](_0x50edb2[_0x43e7('0x47')]);if(_0x501616&&_0x501616[_0x43e7('0x65')]){logger[_0x43e7('0xb')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',_0x43e7('0x5d'));_0x5f3824[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x50edb2[_0x43e7('0x47')],_0x5f3824[_0x43e7('0x4a')],md5(_0x5f3824['uniqueid']));}else{_0x5f3824['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x50edb2);return getUser(_0x50edb2)['then'](function(_0x5cb26e){_0xb3e981=_0x5cb26e;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0xb3e981['id']);return getEndUser(_0x50edb2,_0x5f3824['calleridname'],_0x5f3824[_0x43e7('0x68')]);})[_0x43e7('0xe')](function(_0x1e2fed){_0xe666b0=_0x1e2fed;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xe666b0['id']);return getTicket(_0x50edb2,_0xb3e981,_0xe666b0,_0x2b0711,_0x5f3824);})[_0x43e7('0xe')](function(_0x398a78){if(_0x398a78){logger['info'](_0x43e7('0x4e'));logger[_0x43e7('0xb')]('The\x20Ticket\x20ID\x20is:',_0x398a78['id']);}})[_0x43e7('0x58')](function(_0x5c2c5f){logger[_0x43e7('0x56')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',JSON[_0x43e7('0x63')](_0x5c2c5f));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 2236991..0dec065 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 _0x60a5=['Subjects','Descriptions','/contacts(','Fields','phonecall','callDirection','queue','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','unmanaged','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','request-promise','util','./util','md5','ioredis','../../../../config/environment','redis','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','tenantId','data5','POST','clientId','username','password','clientSecret','access_token','catch','error',']\x20Wrong\x20credentials!','message','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','isNil','internalemailaddress','email','isdisabled',']\x20Agent\x20found\x20','userId','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','length','toLowerCase','outbound','calleridnum','/systemusers(','Bearer\x20','headers','odata-entityid','substring','lastIndexOf','enduserId','destcalleridnum','telephone1','&$filter=','replace','contactid','info','toUpperCase','includes','string','picklist','customField','indexOf','content','ticketType','incident','assign','getString'];(function(_0x404b5a,_0x255e99){var _0x33bd94=function(_0x5517bb){while(--_0x5517bb){_0x404b5a['push'](_0x404b5a['shift']());}};_0x33bd94(++_0x255e99);}(_0x60a5,0x1b3));var _0x560a=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x60a5[_0x46aff0];return _0x9d78cf;};'use strict';var _=require('lodash');var rp=require(_0x560a('0x0'));var util=require(_0x560a('0x1'));var intUtil=require(_0x560a('0x2'));var md5=require(_0x560a('0x3'));var Redis=require(_0x560a('0x4'));var logger=require('../../../../config/logger')('dynamics365');var config=require(_0x560a('0x5'));config[_0x560a('0x6')]=_['defaults'](config[_0x560a('0x6')],{'host':_0x560a('0x7'),'port':0x18eb});var io=require(_0x560a('0x8'))(new Redis(config[_0x560a('0x6')]));function getAuthToken(_0x4a9b3d,_0x4e1a97,_0x29afb2){if(_0x4a9b3d[_0x560a('0x9')]){_0x4a9b3d[_0x560a('0xa')]=_0x4a9b3d[_0x560a('0xb')]['data7'];_0x4a9b3d[_0x560a('0xc')]=_0x4a9b3d[_0x560a('0xb')]['data2'];return Promise['resolve'](_0x4a9b3d[_0x560a('0xb')][_0x560a('0xd')]);}var _0x3a624d={'method':_0x560a('0xe'),'uri':_0x4e1a97,'form':{'client_id':_0x4a9b3d[_0x560a('0xf')],'resource':_0x4a9b3d[_0x560a('0xa')],'username':_0x4a9b3d[_0x560a('0x10')],'password':_0x4a9b3d[_0x560a('0x11')],'grant_type':_0x560a('0x11'),'client_secret':_0x4a9b3d[_0x560a('0x12')]},'json':!![]};return rp(_0x3a624d)['then'](function(_0x629575){return _0x629575[_0x560a('0x13')];})[_0x560a('0x14')](function(_0x21aa93){logger[_0x560a('0x15')]('['+[_0x29afb2['toUpperCase']()]+_0x560a('0x16'));return _0x21aa93[_0x560a('0x17')];});}function getUser(_0x2435da,_0xacbb48,_0x5d79e7,_0x8967f0,_0x1cce37,_0x55deae){return new Promise(function(_0x129291,_0x411a84){return getAuthToken(_0xacbb48,_0x8967f0,_0x55deae)[_0x560a('0x18')](function(_0x3c8085){var _0xf77f54={'method':_0x560a('0x19'),'uri':_0x1cce37+_0x560a('0x1a'),'headers':{'Authorization':'Bearer\x20'+_0x3c8085,'OData-Version':_0x560a('0x1b')},'json':!![]};return rp(_0xf77f54);})[_0x560a('0x18')](function(_0x2c3f60){var _0x257c34=_0x2c3f60['value'];var _0x4acda7=![];var _0x460729=null;if(!_[_0x560a('0x1c')](_0x5d79e7)){if(intUtil['validateEmail'](_0x5d79e7['email'])){_0x2435da['userEmail']=_0x5d79e7['email'];for(_0x460729=0x0;_0x460729<_0x257c34['length'];_0x460729++){if(_0x257c34[_0x460729][_0x560a('0x1d')]===_0x5d79e7[_0x560a('0x1e')]&&!_0x257c34[_0x460729][_0x560a('0x1f')]){_0x4acda7=!![];logger['info']('['+[_0x55deae['toUpperCase']()]+_0x560a('0x20')+_0x257c34[_0x460729]['systemuserid']+'!');_0x2435da[_0x560a('0x21')]=_0x257c34[_0x460729][_0x560a('0x22')];}}}}if(!_0x4acda7){logger['info']('['+[_0x55deae['toUpperCase']()]+_0x560a('0x23'));_0x2435da[_0x560a('0x24')]=_0xacbb48[_0x560a('0x10')];for(_0x460729=0x0;_0x460729<_0x257c34[_0x560a('0x25')];_0x460729++){if(_0x257c34[_0x460729][_0x560a('0x1d')]===_0xacbb48['username']){_0x2435da[_0x560a('0x21')]=_0x257c34[_0x460729]['systemuserid'];}}}_0x129291(_0x2435da);})[_0x560a('0x14')](function(_0x50fa87){_0x411a84(_0x50fa87[_0x560a('0x17')]);});});}function createEndUser(_0x20ad45,_0x33d6fa,_0x392183,_0xb7422,_0x3ce51f,_0x325388,_0x44fe49){return new Promise(function(_0x5033ec,_0xd8bf38){return getAuthToken(_0x33d6fa,_0x392183,_0x325388)[_0x560a('0x18')](function(_0x3c1c94){var _0x5e723a=_0x325388[_0x560a('0x26')]()===_0x560a('0x27')?_0x3ce51f['destcalleridnum']:_0x3ce51f[_0x560a('0x28')];var _0x2f6dc1={'method':_0x560a('0xe'),'uri':_0xb7422+'contacts','body':{'fullname':_0x5e723a,'firstname':_0x5e723a,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x560a('0x29')+_0x20ad45['userId']+')'},'headers':{'Authorization':_0x560a('0x2a')+_0x3c1c94,'OData-Version':_0x560a('0x1b')},'json':!![],'resolveWithFullResponse':!![]};_0x2f6dc1['body'][_0x44fe49]=_0x5e723a;return rp(_0x2f6dc1);})[_0x560a('0x18')](function(_0x5d04b4){var _0x23674b=_0x5d04b4[_0x560a('0x2b')][_0x560a('0x2c')];var _0x19275d=_0x23674b[_0x560a('0x2d')](_0x23674b[_0x560a('0x2e')]('(')+0x1,_0x23674b['lastIndexOf'](')'));_0x20ad45[_0x560a('0x2f')]=_0x19275d;_0x5033ec(_0x20ad45);})[_0x560a('0x14')](function(_0x4a8db3){_0xd8bf38(_0x4a8db3[_0x560a('0x17')]);});});}function getEndUser(_0x81a0b1,_0x1c3ea1,_0x258dbc,_0x1c560a,_0x18596e,_0x11ef5a,_0x3b9736,_0x53ca1d){var _0x2d0bc1=_0x11ef5a[_0x560a('0x26')]()==='outbound'?_0x18596e[_0x560a('0x30')]:_0x18596e[_0x560a('0x28')];return getAuthToken(_0x1c3ea1,_0x258dbc,_0x11ef5a)['then'](function(_0x266402){_0x53ca1d=_0x53ca1d?_0x53ca1d:_0x560a('0x31');var _0x56be81={'method':'GET','uri':_0x1c560a+'contacts?$select='+_0x53ca1d+_0x560a('0x32')+_0x53ca1d+'\x20eq\x20\x27'+_0x2d0bc1[_0x560a('0x33')]('+','%2b')+'\x27','headers':{'Authorization':_0x560a('0x2a')+_0x266402,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x56be81);})[_0x560a('0x18')](function(_0x322817){var _0x1c5c2b=![];if(!_0x322817)return _0x1c5c2b;var _0x14f68c=_0x322817['value'];for(var _0xd8250b=0x0;_0xd8250b<_0x14f68c[_0x560a('0x25')];_0xd8250b++){if(_0x14f68c[_0xd8250b][_0x53ca1d]===_0x2d0bc1){_0x1c5c2b=!![];_0x81a0b1[_0x560a('0x2f')]=_0x14f68c[_0xd8250b][_0x560a('0x34')];}}return _0x1c5c2b;})['then'](function(_0x2a8ef6){if(_0x2a8ef6)return _0x81a0b1;if(_0x3b9736==='nothing'){logger[_0x560a('0x35')]('['+[_0x11ef5a[_0x560a('0x36')]()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x81a0b1;}return createEndUser(_0x81a0b1,_0x1c3ea1,_0x258dbc,_0x1c560a,_0x18596e,_0x11ef5a,_0x53ca1d)['then'](function(_0x19a8ed){logger[_0x560a('0x35')]('['+[_0x11ef5a[_0x560a('0x36')]()]+']\x20Enduser\x20created!',_0x19a8ed[_0x560a('0x2f')]);return _0x19a8ed;});});}function getCustomFields(_0x11de4b,_0x14023b,_0x1ea71a){var _0x88986b={};if(_0x11de4b[_0x560a('0x25')]>0x0){_['forEach'](_0x11de4b,function(_0x478139){if(_[_0x560a('0x37')]([_0x560a('0x38'),_0x560a('0x39')],_0x478139['type'])&&_0x478139['nameField']&&!_0x478139[_0x560a('0x3a')]){var _0x2e73ac=_0x478139['idField']['toLowerCase']();var _0x10143d=_0x2e73ac['substring'](0x0,_0x2e73ac[_0x560a('0x3b')]('_'));var _0x5e087f=_0x2e73ac[_0x560a('0x2d')](_0x2e73ac[_0x560a('0x3b')]('_')+0x1);if(_0x10143d===_0x1ea71a){_0x88986b[_0x5e087f]=_0x478139[_0x560a('0x3c')];}}});}return _0x88986b;}function getTicket(_0x5b5efa,_0x484e08,_0x432aa7,_0x2b65d4,_0x471623,_0x418966,_0x23a784){return new Promise(function(_0xc432b0,_0x322343){var _0x12c4e8;return getAuthToken(_0x484e08,_0x432aa7,_0x23a784)[_0x560a('0x18')](function(_0x248eea){if(_0x418966[_0x560a('0x3d')]===_0x560a('0x3e')){_0x12c4e8={'method':_0x560a('0xe'),'uri':_0x2b65d4+'incidents','body':Object[_0x560a('0x3f')]({},{'title':intUtil[_0x560a('0x40')](_0x418966[_0x560a('0x41')],_0x471623,'\x20'),'description':intUtil[_0x560a('0x40')](_0x418966[_0x560a('0x42')],_0x471623,'\x0a'),'customerid_contact@odata.bind':_0x5b5efa[_0x560a('0x2f')]?_0x560a('0x43')+_0x5b5efa[_0x560a('0x2f')]+')':undefined,'ownerid@odata.bind':_0x560a('0x29')+_0x5b5efa[_0x560a('0x21')]+')','caseorigincode':'1'},getCustomFields(_0x418966[_0x560a('0x44')],_0x471623,_0x418966['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x248eea,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x418966[_0x560a('0x3d')]===_0x560a('0x45')){var _0x9fd85=_0x5b5efa['enduserId']?[{'partyid_systemuser@odata.bind':_0x560a('0x29')+_0x5b5efa[_0x560a('0x21')]+')','participationtypemask':_0x5b5efa[_0x560a('0x46')]===_0x560a('0x47')?0x2:0x1},{'partyid_contact@odata.bind':_0x560a('0x43')+_0x5b5efa[_0x560a('0x2f')]+')','participationtypemask':_0x5b5efa[_0x560a('0x46')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x560a('0x29')+_0x5b5efa[_0x560a('0x21')]+')','participationtypemask':_0x5b5efa[_0x560a('0x46')]===_0x560a('0x47')?0x2:0x1}];_0x12c4e8={'method':_0x560a('0xe'),'uri':_0x2b65d4+'phonecalls','body':Object[_0x560a('0x3f')]({},{'subject':intUtil[_0x560a('0x40')](_0x418966[_0x560a('0x41')],_0x471623,'\x20'),'phonenumber':String(_0x471623[_0x560a('0x28')]),'description':intUtil['getString'](_0x418966['Descriptions'],_0x471623,'\x0a'),'regardingobjectid_contact@odata.bind':_0x5b5efa['enduserId']?_0x560a('0x43')+_0x5b5efa[_0x560a('0x2f')]+')':undefined,'ownerid@odata.bind':_0x560a('0x29')+_0x5b5efa['userId']+')','directioncode':_0x5b5efa['callDirection']===_0x560a('0x47')?![]:!![],'phonecall_activity_parties':_0x9fd85},getCustomFields(_0x418966[_0x560a('0x44')],_0x471623,_0x418966[_0x560a('0x3d')])),'headers':{'Authorization':_0x560a('0x2a')+_0x248eea,'OData-Version':_0x560a('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x12c4e8);})[_0x560a('0x18')](function(_0xd35726){var _0x22c979=_0xd35726[_0x560a('0x2b')][_0x560a('0x2c')];var _0x4bcdc6=_0x22c979[_0x560a('0x2d')](_0x22c979[_0x560a('0x2e')]('(')+0x1,_0x22c979[_0x560a('0x2e')](')'));_0x5b5efa[_0x560a('0x48')]=_0x4bcdc6;_0xc432b0(_0x5b5efa);})[_0x560a('0x14')](function(_0xce238d){_0x322343(_0xce238d[_0x560a('0x17')]);});});}function emit(_0x369014,_0x5ae8c1,_0x49674a,_0x2f7f49){var _0x240a8c={'uri':util[_0x560a('0x49')](_0x560a('0x4a'),_0x369014,_0x49674a,_0x2f7f49)};io['to'](util['format'](_0x560a('0x4b'),_0x5ae8c1))[_0x560a('0x4c')]('trigger:browser:url',_0x240a8c);}exports['cs']=function(_0x3688b6,_0x71bdcb,_0x3ab286,_0x5a103b,_0x9b59e7,_0x47e7bb,_0x58184e,_0x4e51ab){var _0x3afd8f={};_0x47e7bb[_0x560a('0xa')]=_0x47e7bb['modernAuthentication']?intUtil['stripTrailingSlash'](_0x47e7bb['CloudProvider']['data7']):intUtil[_0x560a('0x4d')](_0x47e7bb[_0x560a('0xa')]);_0x47e7bb[_0x560a('0x4e')]=intUtil[_0x560a('0x4d')](_0x47e7bb[_0x560a('0x4e')]);_0x3afd8f[_0x560a('0x46')]=_0x4e51ab==='queue'||_0x4e51ab==='unmanaged'?_0x560a('0x47'):_0x560a('0x27');var _0x343e80=_0x47e7bb[_0x560a('0x9')]?util['format'](_0x560a('0x4f'),_0x47e7bb['CloudProvider']['data7']):util['format']('%s/api/data/v9.0/',_0x47e7bb[_0x560a('0xa')]);var _0x5e9c0f=util[_0x560a('0x49')](_0x560a('0x50'),_0x47e7bb[_0x560a('0xc')]);var _0x264a14=util[_0x560a('0x49')](_0x560a('0x51'),_0x47e7bb[_0x560a('0x4e')],_0x71bdcb[_0x560a('0x52')],md5(_0x71bdcb[_0x560a('0x52')]));if(_0x9b59e7&&_0x9b59e7[_0x560a('0x53')]){logger[_0x560a('0x35')]('[QUEUE]',_0x560a('0x54'));_0x71bdcb[_0x560a('0x55')]=_0x264a14;}else if(_0x58184e&&_0x58184e['recordingFormat']&&_0x58184e['recordingFormat']!==_0x560a('0x56')){logger[_0x560a('0x35')](_0x560a('0x57'),_0x560a('0x54'));_0x71bdcb[_0x560a('0x55')]=_0x264a14;}else{_0x71bdcb[_0x560a('0x55')]='';}return getUser(_0x3afd8f,_0x47e7bb,_0x5a103b,_0x5e9c0f,_0x343e80,_0x4e51ab)[_0x560a('0x18')](function(_0x1aa393){logger[_0x560a('0x35')]('['+_0x4e51ab[_0x560a('0x36')]()+_0x560a('0x58'),_0x1aa393[_0x560a('0x21')]);logger[_0x560a('0x35')]('['+_0x4e51ab[_0x560a('0x36')]()+_0x560a('0x59'),_0x1aa393[_0x560a('0x24')]);return getEndUser(_0x1aa393,_0x47e7bb,_0x5e9c0f,_0x343e80,_0x71bdcb,_0x4e51ab,_0x3ab286[_0x560a('0x5a')],_0x3ab286[_0x560a('0x5b')]);})['then'](function(_0x41d9e7){logger[_0x560a('0x35')]('['+_0x4e51ab[_0x560a('0x36')]()+_0x560a('0x5c'),_0x41d9e7[_0x560a('0x2f')]);logger[_0x560a('0x35')]('['+_0x4e51ab[_0x560a('0x36')]()+_0x560a('0x5d'),_0x71bdcb['calleridnum']);return getTicket(_0x41d9e7,_0x47e7bb,_0x5e9c0f,_0x343e80,_0x71bdcb,_0x3ab286,_0x4e51ab);})[_0x560a('0x18')](function(_0x450a0a){logger[_0x560a('0x35')](util[_0x560a('0x49')]('['+_0x4e51ab[_0x560a('0x36')]()+_0x560a('0x5e'),_0x3ab286['ticketType'],_0x450a0a[_0x560a('0x48')]));logger['info'](util['format']('['+_0x4e51ab[_0x560a('0x36')]()+']\x20Call\x20direction:\x20%s',_0x4e51ab));if(_0x4e51ab!==_0x560a('0x5f')&&_0x3ab286[_0x560a('0x60')]){logger[_0x560a('0x35')]('['+_0x4e51ab[_0x560a('0x36')]()+']',_0x560a('0x61'));emit(_0x47e7bb[_0x560a('0xa')],_0x5a103b[_0x560a('0x62')],_0x3ab286['ticketType'],_0x450a0a[_0x560a('0x48')]);}})[_0x560a('0x14')](function(_0x3ee9a8){logger[_0x560a('0x15')]('['+_0x4e51ab[_0x560a('0x36')]()+_0x560a('0x63'),_0x3ee9a8[_0x560a('0x17')]);console[_0x560a('0x15')]('Error\x20running\x20Dynamics365\x20integration',_0x3ee9a8);});}; \ No newline at end of file +var _0x9aa9=['indexOf','content','ticketType','incident','incidents','assign','Subjects','getString','Descriptions','/contacts(','/systemusers(','phonecall','callDirection','queue','Fields','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','remoteUri','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:','calleridnum',']\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','defaults','socket.io-emitter','redis','CloudProvider','data7','tenantId','data2','resolve','data5','clientId','username','password','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId','toLowerCase','POST','contacts','headers','odata-entityid','lastIndexOf','enduserId','outbound','destcalleridnum','telephone1','contacts?$select=','&$filter=','%2b','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','forEach','includes','string','picklist','type','nameField','customField','idField','substring'];(function(_0x3ead55,_0x22bc51){var _0x3ea16d=function(_0x2a59e0){while(--_0x2a59e0){_0x3ead55['push'](_0x3ead55['shift']());}};_0x3ea16d(++_0x22bc51);}(_0x9aa9,0x17e));var _0x99aa=function(_0x56f3f3,_0x23568f){_0x56f3f3=_0x56f3f3-0x0;var _0x2f7085=_0x9aa9[_0x56f3f3];return _0x2f7085;};'use strict';var _=require(_0x99aa('0x0'));var rp=require(_0x99aa('0x1'));var util=require('util');var intUtil=require(_0x99aa('0x2'));var md5=require(_0x99aa('0x3'));var Redis=require(_0x99aa('0x4'));var logger=require('../../../../config/logger')(_0x99aa('0x5'));var config=require(_0x99aa('0x6'));config['redis']=_[_0x99aa('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x99aa('0x8'))(new Redis(config[_0x99aa('0x9')]));function getAuthToken(_0x582b20,_0x2be9f5,_0x439562){if(_0x582b20['modernAuthentication']){_0x582b20['remoteUri']=_0x582b20[_0x99aa('0xa')][_0x99aa('0xb')];_0x582b20[_0x99aa('0xc')]=_0x582b20[_0x99aa('0xa')][_0x99aa('0xd')];return Promise[_0x99aa('0xe')](_0x582b20[_0x99aa('0xa')][_0x99aa('0xf')]);}var _0x1dbb55={'method':'POST','uri':_0x2be9f5,'form':{'client_id':_0x582b20[_0x99aa('0x10')],'resource':_0x582b20['remoteUri'],'username':_0x582b20[_0x99aa('0x11')],'password':_0x582b20[_0x99aa('0x12')],'grant_type':_0x99aa('0x12'),'client_secret':_0x582b20['clientSecret']},'json':!![]};return rp(_0x1dbb55)[_0x99aa('0x13')](function(_0x4c6902){return _0x4c6902[_0x99aa('0x14')];})[_0x99aa('0x15')](function(_0x27401c){logger[_0x99aa('0x16')]('['+[_0x439562[_0x99aa('0x17')]()]+_0x99aa('0x18'));return _0x27401c[_0x99aa('0x19')];});}function getUser(_0x39f428,_0x1f73f8,_0x26195c,_0x4ed5c0,_0x541dfe,_0x4c8a42){return new Promise(function(_0x658cbe,_0x2f6f06){return getAuthToken(_0x1f73f8,_0x4ed5c0,_0x4c8a42)[_0x99aa('0x13')](function(_0x26b4fc){var _0xfddca5={'method':_0x99aa('0x1a'),'uri':_0x541dfe+_0x99aa('0x1b'),'headers':{'Authorization':_0x99aa('0x1c')+_0x26b4fc,'OData-Version':_0x99aa('0x1d')},'json':!![]};return rp(_0xfddca5);})[_0x99aa('0x13')](function(_0x210eed){var _0x4f594e=_0x210eed[_0x99aa('0x1e')];var _0x331220=![];var _0x46516b=null;if(!_[_0x99aa('0x1f')](_0x26195c)){if(intUtil[_0x99aa('0x20')](_0x26195c[_0x99aa('0x21')])){_0x39f428[_0x99aa('0x22')]=_0x26195c[_0x99aa('0x21')];for(_0x46516b=0x0;_0x46516b<_0x4f594e[_0x99aa('0x23')];_0x46516b++){if(_0x4f594e[_0x46516b][_0x99aa('0x24')]===_0x26195c['email']&&!_0x4f594e[_0x46516b][_0x99aa('0x25')]){_0x331220=!![];logger[_0x99aa('0x26')]('['+[_0x4c8a42[_0x99aa('0x17')]()]+_0x99aa('0x27')+_0x4f594e[_0x46516b][_0x99aa('0x28')]+'!');_0x39f428[_0x99aa('0x29')]=_0x4f594e[_0x46516b][_0x99aa('0x28')];}}}}if(!_0x331220){logger[_0x99aa('0x26')]('['+[_0x4c8a42[_0x99aa('0x17')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x39f428[_0x99aa('0x22')]=_0x1f73f8['username'];for(_0x46516b=0x0;_0x46516b<_0x4f594e[_0x99aa('0x23')];_0x46516b++){if(_0x4f594e[_0x46516b][_0x99aa('0x24')]===_0x1f73f8[_0x99aa('0x11')]){_0x39f428[_0x99aa('0x29')]=_0x4f594e[_0x46516b][_0x99aa('0x28')];}}}_0x658cbe(_0x39f428);})[_0x99aa('0x15')](function(_0x28bf24){_0x2f6f06(_0x28bf24['message']);});});}function createEndUser(_0x42178c,_0x284ed7,_0x136fc4,_0x452e31,_0x5482ca,_0x169481,_0xe06992){return new Promise(function(_0x1619c9,_0xbe85cd){return getAuthToken(_0x284ed7,_0x136fc4,_0x169481)['then'](function(_0x492b9d){var _0x16a77b=_0x169481[_0x99aa('0x2a')]()==='outbound'?_0x5482ca['destcalleridnum']:_0x5482ca['calleridnum'];var _0x158e3f={'method':_0x99aa('0x2b'),'uri':_0x452e31+_0x99aa('0x2c'),'body':{'fullname':_0x16a77b,'firstname':_0x16a77b,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x42178c[_0x99aa('0x29')]+')'},'headers':{'Authorization':_0x99aa('0x1c')+_0x492b9d,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x158e3f['body'][_0xe06992]=_0x16a77b;return rp(_0x158e3f);})[_0x99aa('0x13')](function(_0x218da3){var _0x3144a0=_0x218da3[_0x99aa('0x2d')][_0x99aa('0x2e')];var _0x80c037=_0x3144a0['substring'](_0x3144a0[_0x99aa('0x2f')]('(')+0x1,_0x3144a0[_0x99aa('0x2f')](')'));_0x42178c[_0x99aa('0x30')]=_0x80c037;_0x1619c9(_0x42178c);})['catch'](function(_0x486d0d){_0xbe85cd(_0x486d0d[_0x99aa('0x19')]);});});}function getEndUser(_0x4cbe63,_0x1aeb54,_0x1aada5,_0x3737c6,_0x526a9a,_0x423d3e,_0x504450,_0x1f621f){var _0xf817f=_0x423d3e[_0x99aa('0x2a')]()===_0x99aa('0x31')?_0x526a9a[_0x99aa('0x32')]:_0x526a9a['calleridnum'];return getAuthToken(_0x1aeb54,_0x1aada5,_0x423d3e)[_0x99aa('0x13')](function(_0x26f184){_0x1f621f=_0x1f621f?_0x1f621f:_0x99aa('0x33');var _0x4b15dd={'method':_0x99aa('0x1a'),'uri':_0x3737c6+_0x99aa('0x34')+_0x1f621f+_0x99aa('0x35')+_0x1f621f+'\x20eq\x20\x27'+_0xf817f['replace']('+',_0x99aa('0x36'))+'\x27','headers':{'Authorization':_0x99aa('0x1c')+_0x26f184,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4b15dd);})[_0x99aa('0x13')](function(_0x4775ef){var _0x6ce3d9=![];if(!_0x4775ef)return _0x6ce3d9;var _0x4fce4c=_0x4775ef[_0x99aa('0x1e')];for(var _0xbee22d=0x0;_0xbee22d<_0x4fce4c[_0x99aa('0x23')];_0xbee22d++){if(_0x4fce4c[_0xbee22d][_0x1f621f]===_0xf817f){_0x6ce3d9=!![];_0x4cbe63['enduserId']=_0x4fce4c[_0xbee22d]['contactid'];}}return _0x6ce3d9;})[_0x99aa('0x13')](function(_0xe5ba41){if(_0xe5ba41)return _0x4cbe63;if(_0x504450===_0x99aa('0x37')){logger[_0x99aa('0x26')]('['+[_0x423d3e[_0x99aa('0x17')]()]+_0x99aa('0x38'));return _0x4cbe63;}return createEndUser(_0x4cbe63,_0x1aeb54,_0x1aada5,_0x3737c6,_0x526a9a,_0x423d3e,_0x1f621f)[_0x99aa('0x13')](function(_0x180c94){logger['info']('['+[_0x423d3e[_0x99aa('0x17')]()]+']\x20Enduser\x20created!',_0x180c94[_0x99aa('0x30')]);return _0x180c94;});});}function getCustomFields(_0x2e53b9,_0x485fe0,_0x32d260){var _0x13fcd1={};if(_0x2e53b9[_0x99aa('0x23')]>0x0){_[_0x99aa('0x39')](_0x2e53b9,function(_0x5330fa){if(_[_0x99aa('0x3a')]([_0x99aa('0x3b'),_0x99aa('0x3c')],_0x5330fa[_0x99aa('0x3d')])&&_0x5330fa[_0x99aa('0x3e')]&&!_0x5330fa[_0x99aa('0x3f')]){var _0x1fe86a=_0x5330fa[_0x99aa('0x40')][_0x99aa('0x2a')]();var _0x453826=_0x1fe86a[_0x99aa('0x41')](0x0,_0x1fe86a[_0x99aa('0x42')]('_'));var _0x38cf85=_0x1fe86a['substring'](_0x1fe86a[_0x99aa('0x42')]('_')+0x1);if(_0x453826===_0x32d260){_0x13fcd1[_0x38cf85]=_0x5330fa[_0x99aa('0x43')];}}});}return _0x13fcd1;}function getTicket(_0x5e0b8f,_0x1c6468,_0x5344e8,_0x5470a7,_0x33d57b,_0x1dd91f,_0xbd1757){return new Promise(function(_0x12eb18,_0x2f64ad){var _0x3c44d6;return getAuthToken(_0x1c6468,_0x5344e8,_0xbd1757)['then'](function(_0x17981f){if(_0x1dd91f[_0x99aa('0x44')]===_0x99aa('0x45')){_0x3c44d6={'method':'POST','uri':_0x5470a7+_0x99aa('0x46'),'body':Object[_0x99aa('0x47')]({},{'title':intUtil['getString'](_0x1dd91f[_0x99aa('0x48')],_0x33d57b,'\x20'),'description':intUtil[_0x99aa('0x49')](_0x1dd91f[_0x99aa('0x4a')],_0x33d57b,'\x0a'),'customerid_contact@odata.bind':_0x5e0b8f[_0x99aa('0x30')]?_0x99aa('0x4b')+_0x5e0b8f[_0x99aa('0x30')]+')':undefined,'ownerid@odata.bind':_0x99aa('0x4c')+_0x5e0b8f[_0x99aa('0x29')]+')','caseorigincode':'1'},getCustomFields(_0x1dd91f['Fields'],_0x33d57b,_0x1dd91f[_0x99aa('0x44')])),'headers':{'Authorization':_0x99aa('0x1c')+_0x17981f,'OData-Version':_0x99aa('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x1dd91f[_0x99aa('0x44')]===_0x99aa('0x4d')){var _0x2b04de=_0x5e0b8f[_0x99aa('0x30')]?[{'partyid_systemuser@odata.bind':_0x99aa('0x4c')+_0x5e0b8f[_0x99aa('0x29')]+')','participationtypemask':_0x5e0b8f[_0x99aa('0x4e')]===_0x99aa('0x4f')?0x2:0x1},{'partyid_contact@odata.bind':_0x99aa('0x4b')+_0x5e0b8f[_0x99aa('0x30')]+')','participationtypemask':_0x5e0b8f[_0x99aa('0x4e')]===_0x99aa('0x4f')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x5e0b8f[_0x99aa('0x29')]+')','participationtypemask':_0x5e0b8f[_0x99aa('0x4e')]==='queue'?0x2:0x1}];_0x3c44d6={'method':_0x99aa('0x2b'),'uri':_0x5470a7+'phonecalls','body':Object[_0x99aa('0x47')]({},{'subject':intUtil[_0x99aa('0x49')](_0x1dd91f[_0x99aa('0x48')],_0x33d57b,'\x20'),'phonenumber':String(_0x33d57b['calleridnum']),'description':intUtil[_0x99aa('0x49')](_0x1dd91f[_0x99aa('0x4a')],_0x33d57b,'\x0a'),'regardingobjectid_contact@odata.bind':_0x5e0b8f[_0x99aa('0x30')]?_0x99aa('0x4b')+_0x5e0b8f[_0x99aa('0x30')]+')':undefined,'ownerid@odata.bind':_0x99aa('0x4c')+_0x5e0b8f[_0x99aa('0x29')]+')','directioncode':_0x5e0b8f[_0x99aa('0x4e')]===_0x99aa('0x4f')?![]:!![],'phonecall_activity_parties':_0x2b04de},getCustomFields(_0x1dd91f[_0x99aa('0x50')],_0x33d57b,_0x1dd91f['ticketType'])),'headers':{'Authorization':_0x99aa('0x1c')+_0x17981f,'OData-Version':_0x99aa('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x3c44d6);})[_0x99aa('0x13')](function(_0x4acd08){var _0x3546ed=_0x4acd08[_0x99aa('0x2d')]['odata-entityid'];var _0x22fbde=_0x3546ed[_0x99aa('0x41')](_0x3546ed[_0x99aa('0x2f')]('(')+0x1,_0x3546ed[_0x99aa('0x2f')](')'));_0x5e0b8f[_0x99aa('0x51')]=_0x22fbde;_0x12eb18(_0x5e0b8f);})['catch'](function(_0x1fde54){_0x2f64ad(_0x1fde54[_0x99aa('0x19')]);});});}function emit(_0x42742d,_0x1a348e,_0x2724a8,_0xf74770){var _0x4be662={'uri':util[_0x99aa('0x52')](_0x99aa('0x53'),_0x42742d,_0x2724a8,_0xf74770)};io['to'](util[_0x99aa('0x52')](_0x99aa('0x54'),_0x1a348e))[_0x99aa('0x55')](_0x99aa('0x56'),_0x4be662);}exports['cs']=function(_0x45bf29,_0x270d7a,_0x4478a3,_0x12191e,_0x92418a,_0x1fb10a,_0x596bac,_0x35a532){var _0x34b8e0={};_0x1fb10a[_0x99aa('0x57')]=_0x1fb10a['modernAuthentication']?intUtil[_0x99aa('0x58')](_0x1fb10a[_0x99aa('0xa')][_0x99aa('0xb')]):intUtil[_0x99aa('0x58')](_0x1fb10a['remoteUri']);_0x1fb10a[_0x99aa('0x59')]=intUtil[_0x99aa('0x58')](_0x1fb10a['serverUrl']);_0x34b8e0[_0x99aa('0x4e')]=_0x35a532===_0x99aa('0x4f')||_0x35a532===_0x99aa('0x5a')?'queue':'outbound';var _0x29046c=_0x1fb10a['modernAuthentication']?util[_0x99aa('0x52')](_0x99aa('0x5b'),_0x1fb10a[_0x99aa('0xa')][_0x99aa('0xb')]):util[_0x99aa('0x52')](_0x99aa('0x5b'),_0x1fb10a['remoteUri']);var _0x130b68=util[_0x99aa('0x52')](_0x99aa('0x5c'),_0x1fb10a[_0x99aa('0xc')]);var _0x3244b2=util[_0x99aa('0x52')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1fb10a[_0x99aa('0x59')],_0x270d7a[_0x99aa('0x5d')],md5(_0x270d7a[_0x99aa('0x5d')]));if(_0x92418a&&_0x92418a['monitor_format']){logger['info'](_0x99aa('0x5e'),_0x99aa('0x5f'));_0x270d7a[_0x99aa('0x60')]=_0x3244b2;}else if(_0x596bac&&_0x596bac['recordingFormat']&&_0x596bac[_0x99aa('0x61')]!==_0x99aa('0x62')){logger[_0x99aa('0x26')](_0x99aa('0x63'),_0x99aa('0x5f'));_0x270d7a[_0x99aa('0x60')]=_0x3244b2;}else{_0x270d7a[_0x99aa('0x60')]='';}return getUser(_0x34b8e0,_0x1fb10a,_0x12191e,_0x130b68,_0x29046c,_0x35a532)['then'](function(_0xdb45da){logger[_0x99aa('0x26')]('['+_0x35a532[_0x99aa('0x17')]()+_0x99aa('0x64'),_0xdb45da[_0x99aa('0x29')]);logger['info']('['+_0x35a532['toUpperCase']()+_0x99aa('0x65'),_0xdb45da[_0x99aa('0x22')]);return getEndUser(_0xdb45da,_0x1fb10a,_0x130b68,_0x29046c,_0x270d7a,_0x35a532,_0x4478a3[_0x99aa('0x66')],_0x4478a3[_0x99aa('0x67')]);})['then'](function(_0x1740af){logger[_0x99aa('0x26')]('['+_0x35a532[_0x99aa('0x17')]()+_0x99aa('0x68'),_0x1740af[_0x99aa('0x30')]);logger[_0x99aa('0x26')]('['+_0x35a532[_0x99aa('0x17')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x270d7a[_0x99aa('0x69')]);return getTicket(_0x1740af,_0x1fb10a,_0x130b68,_0x29046c,_0x270d7a,_0x4478a3,_0x35a532);})[_0x99aa('0x13')](function(_0x10bd9f){logger[_0x99aa('0x26')](util[_0x99aa('0x52')]('['+_0x35a532[_0x99aa('0x17')]()+_0x99aa('0x6a'),_0x4478a3['ticketType'],_0x10bd9f[_0x99aa('0x51')]));logger[_0x99aa('0x26')](util[_0x99aa('0x52')]('['+_0x35a532['toUpperCase']()+_0x99aa('0x6b'),_0x35a532));if(_0x35a532!=='unmanaged'&&_0x4478a3[_0x99aa('0x6c')]){logger[_0x99aa('0x26')]('['+_0x35a532['toUpperCase']()+']',_0x99aa('0x6d'));emit(_0x1fb10a['remoteUri'],_0x12191e['name'],_0x4478a3[_0x99aa('0x44')],_0x10bd9f['ticketId']);}})['catch'](function(_0x3176d9){logger[_0x99aa('0x16')]('['+_0x35a532[_0x99aa('0x17')]()+_0x99aa('0x6e'),_0x3176d9[_0x99aa('0x19')]);console[_0x99aa('0x16')](_0x99aa('0x6f'),_0x3176d9);});}; \ 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 ca10863..b8dfffc 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 _0x81a1=['mapValues','keyBy','value','format','remoteUri','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','Basic\x20%s','toString','base64','debug','[HTTP]','GET','map','type','customField','toLowerCase','content','includes','string','picklist','idField','push','variable','variableName','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','stringify','recordingFormat','none','destcalleridname','The\x20Enduser\x20ID\x20is:','[OUTBOUND]','trigger:browser:url','unmanaged','lastevent','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','calleridname','error','lodash','request-promise','util','ioredis','./util','../../../../config/environment','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','Caller\x20-\x20%s','calleridnum','Subjects','
','Tags','Fields','custom_fields'];(function(_0x5ab558,_0x129080){var _0x4b1d0c=function(_0x122916){while(--_0x122916){_0x5ab558['push'](_0x5ab558['shift']());}};_0x4b1d0c(++_0x129080);}(_0x81a1,0xf5));var _0x181a=function(_0xb68bd6,_0x1ba287){_0xb68bd6=_0xb68bd6-0x0;var _0x45f0bb=_0x81a1[_0xb68bd6];return _0x45f0bb;};'use strict';var _=require(_0x181a('0x0'));var rp=require(_0x181a('0x1'));var md5=require('md5');var util=require(_0x181a('0x2'));var Redis=require(_0x181a('0x3'));var intUtil=require(_0x181a('0x4'));var config=require(_0x181a('0x5'));var logger=require('../../../../config/logger')(_0x181a('0x6'));config[_0x181a('0x7')]=_[_0x181a('0x8')](config[_0x181a('0x7')],{'host':_0x181a('0x9'),'port':0x18eb});var io=require(_0x181a('0xa'))(new Redis(config[_0x181a('0x7')]));var headers={'Content-Type':_0x181a('0xb'),'Accept':_0x181a('0xb')};function emit(_0x41ea71,_0x21769c,_0x1e00a2){io['to'](_0x41ea71)[_0x181a('0xc')](_0x21769c,_0x1e00a2);}function getTicket(_0x5ec094,_0x1b34c6,_0x310b8c,_0x4153fa,_0x14e1ca){logger[_0x181a('0xd')](_0x181a('0xe'));var _0x5357e1=_['merge']({'responder_id':_0x1b34c6['id'],'requester_id':_0x310b8c['id'],'name':util['format'](_0x181a('0xf'),_0x14e1ca['calleridname']),'phone':_0x14e1ca[_0x181a('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x4153fa[_0x181a('0x11')],_0x14e1ca,'\x20'),'description':intUtil['getString'](_0x4153fa['Descriptions'],_0x14e1ca,_0x181a('0x12')),'tags':getTags(_0x4153fa[_0x181a('0x13')],'name')},getCustomFields(_0x4153fa[_0x181a('0x14')],_0x14e1ca));_0x5357e1[_0x181a('0x15')]=_[_0x181a('0x16')](_[_0x181a('0x17')](_0x5357e1[_0x181a('0x15')],'id'),_0x181a('0x18'));return request({'uri':util[_0x181a('0x19')]('%s/api/v2/tickets',_0x5ec094[_0x181a('0x1a')]),'method':'POST','body':_0x5357e1})[_0x181a('0x1b')](function(_0x4c2a98){logger[_0x181a('0xd')](_0x181a('0x1c'));return _0x4c2a98;});}function getUser(_0xac810f,_0xfd0a78){if(intUtil[_0x181a('0x1d')](_0xfd0a78)){return request({'uri':util['format'](_0x181a('0x1e'),_0xac810f[_0x181a('0x1a')]),'qs':{'email':_0xfd0a78}})['then'](function(_0x2969a0){if(_0x2969a0[_0x181a('0x1f')]){logger[_0x181a('0xd')]('Agent\x20found!');return _[_0x181a('0x20')](_0x2969a0,function(_0x31581c){return _0x31581c['contact']['email']===_0xfd0a78;});}else{logger[_0x181a('0xd')](_0x181a('0x21'));return request({'uri':util['format'](_0x181a('0x22'),_0xac810f[_0x181a('0x1a')])})['then'](function(_0x440933){logger['info']('Admin\x20account\x20selected.');return _0x440933;});}});}else{logger[_0x181a('0xd')](_0x181a('0x23'));return request({'uri':util[_0x181a('0x19')](_0x181a('0x22'),_0xac810f[_0x181a('0x1a')])})[_0x181a('0x1b')](function(_0x20dc3a){logger[_0x181a('0xd')](_0x181a('0x24'));return _0x20dc3a;});}}function getEndUser(_0x5d8585,_0x150871,_0x5329c3){logger[_0x181a('0xd')](_0x181a('0x25'),_0x5329c3);return request({'uri':util[_0x181a('0x19')](_0x181a('0x26'),_0x5d8585['remoteUri']),'qs':{'phone':_0x5329c3}})['then'](function(_0x42b862){if(_0x42b862[_0x181a('0x1f')]){logger[_0x181a('0xd')]('Enduser\x20found!');return _['find'](_0x42b862,{'phone':_0x5329c3});}else{logger[_0x181a('0xd')](_0x181a('0x27'));return request({'uri':util[_0x181a('0x19')]('%s/api/v2/contacts',_0x5d8585['remoteUri']),'method':_0x181a('0x28'),'body':{'name':_0x150871,'phone':_0x5329c3}})[_0x181a('0x1b')](function(_0x38559c){logger[_0x181a('0xd')](_0x181a('0x29'));return _0x38559c;});}});}function getAuth(_0x4d20e9){return util[_0x181a('0x19')](_0x181a('0x2a'),new Buffer(_0x4d20e9['apiKey']+':X')[_0x181a('0x2b')](_0x181a('0x2c')));}function request(_0xe80629){logger[_0x181a('0x2d')](_0x181a('0x2e'),JSON['stringify'](_0xe80629));return rp(_['defaults'](_0xe80629,{'method':_0x181a('0x2f'),'headers':headers,'json':!![]}));}function getTags(_0x4cadef,_0x5a81d7){var _0xb09370=[];if(_0x4cadef&&_0x4cadef['length']>0x0){_0xb09370=_[_0x181a('0x30')](_0x4cadef,_0x5a81d7);}return _0xb09370;}function getCustomFields(_0x3fb372,_0xcf63e2){var _0x32d6aa=[];var _0x498bbb={'custom_fields':[]};if(_0x3fb372[_0x181a('0x1f')]>0x0){_['forEach'](_0x3fb372,function(_0x41467c){if(_['includes'](['string','picklist'],_0x41467c[_0x181a('0x31')])&&_0x41467c['nameField']&&!_0x41467c[_0x181a('0x32')]){_0x498bbb[_0x41467c['nameField'][_0x181a('0x33')]()]=_0x41467c[_0x181a('0x34')][_0x181a('0x2b')]();}else if(_[_0x181a('0x35')]([_0x181a('0x36'),_0x181a('0x37')],_0x41467c['type'])&&_0x41467c[_0x181a('0x38')]&&_0x41467c[_0x181a('0x32')]){_0x498bbb[_0x181a('0x15')][_0x181a('0x39')]({'id':_0x41467c[_0x181a('0x38')],'value':_0x41467c['content'][_0x181a('0x2b')]()});}else if(_0x41467c[_0x181a('0x31')]===_0x181a('0x3a')&&_0x41467c[_0x181a('0x3b')]&&_0x41467c['idField']&&_0x41467c[_0x181a('0x32')]){_0xcf63e2[_0x41467c[_0x181a('0x3b')]]&&_0x498bbb['custom_fields'][_0x181a('0x39')]({'id':_0x41467c['idField'],'value':_0xcf63e2[_0x41467c[_0x181a('0x3b')]][_0x181a('0x2b')]()});}else if(_0x41467c[_0x181a('0x31')]==='customVariable'&&_0x41467c[_0x181a('0x3c')]&&_0x41467c[_0x181a('0x3c')]['name']&&_0x41467c[_0x181a('0x38')]&&_0x41467c[_0x181a('0x32')]){_0xcf63e2[_0x41467c[_0x181a('0x3c')][_0x181a('0x3d')][_0x181a('0x33')]()]&&_0x498bbb[_0x181a('0x15')][_0x181a('0x39')]({'id':_0x41467c[_0x181a('0x38')],'value':_0xcf63e2[_0x41467c[_0x181a('0x3c')][_0x181a('0x3d')][_0x181a('0x33')]()][_0x181a('0x2b')]()});}});}return _0x498bbb;}exports[_0x181a('0x3e')]=function(_0x11bca3,_0x3b1667,_0xda7eea,_0x4aa3fd,_0x4b0b18,_0x1ba824){var _0x35749b,_0x977a16;_0x1ba824[_0x181a('0x1a')]=intUtil[_0x181a('0x3f')](_0x1ba824['remoteUri']);_0x1ba824[_0x181a('0x40')]=intUtil[_0x181a('0x3f')](_0x1ba824[_0x181a('0x40')]);if(_0x4b0b18&&_0x4b0b18[_0x181a('0x41')]){logger[_0x181a('0xd')](_0x181a('0x42'),_0x181a('0x43'));_0x3b1667[_0x181a('0x44')]=util[_0x181a('0x19')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1ba824[_0x181a('0x40')],_0x3b1667[_0x181a('0x45')],md5(_0x3b1667[_0x181a('0x45')]));}else{_0x3b1667['recordingURL']='';}headers[_0x181a('0x46')]=getAuth(_0x1ba824);return getUser(_0x1ba824,_0x4aa3fd[_0x181a('0x47')])[_0x181a('0x1b')](function(_0x4c4bef){_0x35749b=_0x4c4bef;logger[_0x181a('0xd')](_0x181a('0x48'),_0x35749b['id']);return getEndUser(_0x1ba824,_0x3b1667['calleridname'],_0x3b1667['calleridnum']);})[_0x181a('0x1b')](function(_0x4b124c){_0x977a16=_0x4b124c;logger[_0x181a('0xd')]('The\x20Enduser\x20ID\x20is:',_0x977a16['id']);return getTicket(_0x1ba824,_0x35749b,_0x977a16,_0xda7eea,_0x3b1667);})[_0x181a('0x1b')](function(_0x610a9){if(_0x610a9&&_0x610a9['id']){logger['info']('Ticket\x20created!');logger[_0x181a('0xd')](_0x181a('0x49'),_0x610a9['id']);logger['info'](_0x181a('0x42'),_0x181a('0x4a'));emit(util['format'](_0x181a('0x4b'),_0x4aa3fd[_0x181a('0x3d')]),'trigger:browser:url',{'uri':util[_0x181a('0x19')]('%s/helpdesk/tickets/%d',_0x1ba824[_0x181a('0x1a')],_0x610a9['id'])});}})[_0x181a('0x4c')](function(_0x2543fa){logger['error'](_0x181a('0x42'),JSON[_0x181a('0x4d')](_0x2543fa));});};exports['outbound']=function(_0x43e27a,_0x580b7e,_0x2e8456,_0x3d5572,_0x503598,_0x50b2c7,_0x481ee2){var _0x472a0e,_0x1105a0;_0x50b2c7[_0x181a('0x1a')]=intUtil['stripTrailingSlash'](_0x50b2c7[_0x181a('0x1a')]);_0x50b2c7['serverUrl']=intUtil[_0x181a('0x3f')](_0x50b2c7[_0x181a('0x40')]);if(_0x481ee2&&_0x481ee2[_0x181a('0x4e')]&&_0x481ee2[_0x181a('0x4e')]!==_0x181a('0x4f')){logger[_0x181a('0xd')]('[OUTBOUND]',_0x181a('0x43'));_0x580b7e[_0x181a('0x44')]=util[_0x181a('0x19')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x50b2c7[_0x181a('0x40')],_0x580b7e[_0x181a('0x45')],md5(_0x580b7e[_0x181a('0x45')]));}headers[_0x181a('0x46')]=getAuth(_0x50b2c7);return getUser(_0x50b2c7,_0x3d5572[_0x181a('0x47')])['then'](function(_0x482dbb){_0x472a0e=_0x482dbb;logger['info'](_0x181a('0x48'),_0x472a0e['id']);return getEndUser(_0x50b2c7,_0x580b7e[_0x181a('0x50')],_0x580b7e['destcalleridnum']);})['then'](function(_0x3b5900){_0x1105a0=_0x3b5900;logger[_0x181a('0xd')](_0x181a('0x51'),_0x1105a0['id']);return getTicket(_0x50b2c7,_0x472a0e,_0x1105a0,_0x2e8456,_0x580b7e);})['then'](function(_0x1d079d){if(_0x1d079d&&_0x1d079d['id']){logger[_0x181a('0xd')](_0x181a('0x1c'));logger[_0x181a('0xd')](_0x181a('0x49'),_0x1d079d['id']);logger[_0x181a('0xd')](_0x181a('0x52'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x181a('0x19')]('user:%s',_0x3d5572[_0x181a('0x3d')]),_0x181a('0x53'),{'uri':util[_0x181a('0x19')]('%s/helpdesk/tickets/%d',_0x50b2c7['remoteUri'],_0x1d079d['id'])});}})[_0x181a('0x4c')](function(_0x4c3202){logger['error'](_0x181a('0x52'),JSON[_0x181a('0x4d')](_0x4c3202));});};exports[_0x181a('0x54')]=function(_0x44afb4,_0xc9224c,_0x3b06e9,_0x7f8fbb,_0x4ff242,_0x2f1cf4){var _0x16e853,_0x596024;_0x2f1cf4[_0x181a('0x1a')]=intUtil[_0x181a('0x3f')](_0x2f1cf4['remoteUri']);_0x2f1cf4[_0x181a('0x40')]=intUtil[_0x181a('0x3f')](_0x2f1cf4['serverUrl']);if(_0x4ff242&&_0x4ff242[_0x181a('0x41')]){logger['info']('['+_0xc9224c[_0x181a('0x55')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0xc9224c[_0x181a('0x44')]=util[_0x181a('0x19')](_0x181a('0x56'),_0x2f1cf4['serverUrl'],_0xc9224c[_0x181a('0x45')],md5(_0xc9224c[_0x181a('0x45')]));}else{_0xc9224c['recordingURL']='';}headers[_0x181a('0x46')]=getAuth(_0x2f1cf4);return getUser(_0x2f1cf4,'')[_0x181a('0x1b')](function(_0xb64be1){_0x16e853=_0xb64be1;logger[_0x181a('0xd')](_0x181a('0x48'),_0x16e853['id']);return getEndUser(_0x2f1cf4,_0xc9224c[_0x181a('0x57')],_0xc9224c[_0x181a('0x10')]);})[_0x181a('0x1b')](function(_0x56d033){_0x596024=_0x56d033;logger[_0x181a('0xd')](_0x181a('0x51'),_0x596024['id']);return getTicket(_0x2f1cf4,_0x16e853,_0x596024,_0x3b06e9,_0xc9224c);})[_0x181a('0x1b')](function(_0x3de1db){if(_0x3de1db){logger[_0x181a('0xd')](_0x181a('0x1c'));logger[_0x181a('0xd')]('The\x20Ticket\x20ID\x20is:',_0x3de1db['id']);}})['catch'](function(_0x79959b){logger[_0x181a('0x58')]('['+_0xc9224c[_0x181a('0x55')]['toUpperCase']()+']',JSON[_0x181a('0x4d')](_0x79959b));});}; \ No newline at end of file +var _0x6b3c=['Creating\x20new\x20ticket...','calleridname','calleridnum','getString','Subjects','name','Fields','custom_fields','mapValues','keyBy','value','format','%s/api/v2/tickets','remoteUri','POST','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','then','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','apiKey','toString','base64','debug','[HTTP]','stringify','GET','map','picklist','type','customField','toLowerCase','content','includes','string','idField','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','unmanaged','lastevent','request-promise','md5','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','socket.io-emitter','application/json','emit','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b3c,0x1b2));var _0xc6b3=function(_0x30898f,_0x272aee){_0x30898f=_0x30898f-0x0;var _0x31e923=_0x6b3c[_0x30898f];return _0x31e923;};'use strict';var _=require('lodash');var rp=require(_0xc6b3('0x0'));var md5=require(_0xc6b3('0x1'));var util=require('util');var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xc6b3('0x2'));var logger=require(_0xc6b3('0x3'))(_0xc6b3('0x4'));config[_0xc6b3('0x5')]=_[_0xc6b3('0x6')](config[_0xc6b3('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xc6b3('0x7'))(new Redis(config['redis']));var headers={'Content-Type':_0xc6b3('0x8'),'Accept':_0xc6b3('0x8')};function emit(_0x54b9e6,_0x1569fc,_0x53fdf8){io['to'](_0x54b9e6)[_0xc6b3('0x9')](_0x1569fc,_0x53fdf8);}function getTicket(_0x207bcc,_0x4880b2,_0x4e3d83,_0x343379,_0x5237aa){logger[_0xc6b3('0xa')](_0xc6b3('0xb'));var _0x535a20=_['merge']({'responder_id':_0x4880b2['id'],'requester_id':_0x4e3d83['id'],'name':util['format']('Caller\x20-\x20%s',_0x5237aa[_0xc6b3('0xc')]),'phone':_0x5237aa[_0xc6b3('0xd')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xc6b3('0xe')](_0x343379[_0xc6b3('0xf')],_0x5237aa,'\x20'),'description':intUtil[_0xc6b3('0xe')](_0x343379['Descriptions'],_0x5237aa,'
'),'tags':getTags(_0x343379['Tags'],_0xc6b3('0x10'))},getCustomFields(_0x343379[_0xc6b3('0x11')],_0x5237aa));_0x535a20[_0xc6b3('0x12')]=_[_0xc6b3('0x13')](_[_0xc6b3('0x14')](_0x535a20[_0xc6b3('0x12')],'id'),_0xc6b3('0x15'));return request({'uri':util[_0xc6b3('0x16')](_0xc6b3('0x17'),_0x207bcc[_0xc6b3('0x18')]),'method':_0xc6b3('0x19'),'body':_0x535a20})['then'](function(_0x26170e){logger[_0xc6b3('0xa')]('Ticket\x20created!');return _0x26170e;});}function getUser(_0x19ae45,_0x2944db){if(intUtil[_0xc6b3('0x1a')](_0x2944db)){return request({'uri':util['format'](_0xc6b3('0x1b'),_0x19ae45[_0xc6b3('0x18')]),'qs':{'email':_0x2944db}})['then'](function(_0x385346){if(_0x385346[_0xc6b3('0x1c')]){logger[_0xc6b3('0xa')](_0xc6b3('0x1d'));return _[_0xc6b3('0x1e')](_0x385346,function(_0x3c8b59){return _0x3c8b59[_0xc6b3('0x1f')]['email']===_0x2944db;});}else{logger[_0xc6b3('0xa')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xc6b3('0x16')]('%s/api/v2/agents/me',_0x19ae45['remoteUri'])})[_0xc6b3('0x20')](function(_0x2fc6d0){logger[_0xc6b3('0xa')](_0xc6b3('0x21'));return _0x2fc6d0;});}});}else{logger[_0xc6b3('0xa')](_0xc6b3('0x22'));return request({'uri':util[_0xc6b3('0x16')](_0xc6b3('0x23'),_0x19ae45[_0xc6b3('0x18')])})[_0xc6b3('0x20')](function(_0x4b1686){logger['info'](_0xc6b3('0x21'));return _0x4b1686;});}}function getEndUser(_0x16a5b2,_0x518503,_0x12bcf5){logger[_0xc6b3('0xa')]('Searching\x20enduser\x20with\x20phone',_0x12bcf5);return request({'uri':util[_0xc6b3('0x16')](_0xc6b3('0x24'),_0x16a5b2['remoteUri']),'qs':{'phone':_0x12bcf5}})[_0xc6b3('0x20')](function(_0x4d3daa){if(_0x4d3daa[_0xc6b3('0x1c')]){logger[_0xc6b3('0xa')](_0xc6b3('0x25'));return _[_0xc6b3('0x1e')](_0x4d3daa,{'phone':_0x12bcf5});}else{logger[_0xc6b3('0xa')](_0xc6b3('0x26'));return request({'uri':util[_0xc6b3('0x16')](_0xc6b3('0x24'),_0x16a5b2['remoteUri']),'method':_0xc6b3('0x19'),'body':{'name':_0x518503,'phone':_0x12bcf5}})[_0xc6b3('0x20')](function(_0xe1bf1d){logger[_0xc6b3('0xa')](_0xc6b3('0x27'));return _0xe1bf1d;});}});}function getAuth(_0xf244fa){return util[_0xc6b3('0x16')]('Basic\x20%s',new Buffer(_0xf244fa[_0xc6b3('0x28')]+':X')[_0xc6b3('0x29')](_0xc6b3('0x2a')));}function request(_0x2806ba){logger[_0xc6b3('0x2b')](_0xc6b3('0x2c'),JSON[_0xc6b3('0x2d')](_0x2806ba));return rp(_['defaults'](_0x2806ba,{'method':_0xc6b3('0x2e'),'headers':headers,'json':!![]}));}function getTags(_0x3bb887,_0x32f60e){var _0x221137=[];if(_0x3bb887&&_0x3bb887[_0xc6b3('0x1c')]>0x0){_0x221137=_[_0xc6b3('0x2f')](_0x3bb887,_0x32f60e);}return _0x221137;}function getCustomFields(_0x4f45b6,_0x517965){var _0x4be886=[];var _0x585196={'custom_fields':[]};if(_0x4f45b6[_0xc6b3('0x1c')]>0x0){_['forEach'](_0x4f45b6,function(_0x279283){if(_['includes'](['string',_0xc6b3('0x30')],_0x279283[_0xc6b3('0x31')])&&_0x279283['nameField']&&!_0x279283[_0xc6b3('0x32')]){_0x585196[_0x279283['nameField'][_0xc6b3('0x33')]()]=_0x279283[_0xc6b3('0x34')][_0xc6b3('0x29')]();}else if(_[_0xc6b3('0x35')]([_0xc6b3('0x36'),_0xc6b3('0x30')],_0x279283[_0xc6b3('0x31')])&&_0x279283[_0xc6b3('0x37')]&&_0x279283[_0xc6b3('0x32')]){_0x585196[_0xc6b3('0x12')][_0xc6b3('0x38')]({'id':_0x279283[_0xc6b3('0x37')],'value':_0x279283[_0xc6b3('0x34')][_0xc6b3('0x29')]()});}else if(_0x279283['type']===_0xc6b3('0x39')&&_0x279283[_0xc6b3('0x3a')]&&_0x279283['idField']&&_0x279283[_0xc6b3('0x32')]){_0x517965[_0x279283[_0xc6b3('0x3a')]]&&_0x585196['custom_fields'][_0xc6b3('0x38')]({'id':_0x279283[_0xc6b3('0x37')],'value':_0x517965[_0x279283[_0xc6b3('0x3a')]][_0xc6b3('0x29')]()});}else if(_0x279283[_0xc6b3('0x31')]===_0xc6b3('0x3b')&&_0x279283[_0xc6b3('0x3c')]&&_0x279283[_0xc6b3('0x3c')][_0xc6b3('0x10')]&&_0x279283['idField']&&_0x279283['customField']){_0x517965[_0x279283['Variable'][_0xc6b3('0x10')]['toLowerCase']()]&&_0x585196['custom_fields'][_0xc6b3('0x38')]({'id':_0x279283[_0xc6b3('0x37')],'value':_0x517965[_0x279283[_0xc6b3('0x3c')]['name'][_0xc6b3('0x33')]()]['toString']()});}});}return _0x585196;}exports[_0xc6b3('0x3d')]=function(_0x5f2ad9,_0x1eb75f,_0x22a290,_0x594d5f,_0x3eba2c,_0x544a44){var _0x3c8900,_0x5a2814;_0x544a44[_0xc6b3('0x18')]=intUtil[_0xc6b3('0x3e')](_0x544a44[_0xc6b3('0x18')]);_0x544a44[_0xc6b3('0x3f')]=intUtil[_0xc6b3('0x3e')](_0x544a44[_0xc6b3('0x3f')]);if(_0x3eba2c&&_0x3eba2c[_0xc6b3('0x40')]){logger[_0xc6b3('0xa')](_0xc6b3('0x41'),_0xc6b3('0x42'));_0x1eb75f[_0xc6b3('0x43')]=util[_0xc6b3('0x16')](_0xc6b3('0x44'),_0x544a44[_0xc6b3('0x3f')],_0x1eb75f[_0xc6b3('0x45')],md5(_0x1eb75f[_0xc6b3('0x45')]));}else{_0x1eb75f[_0xc6b3('0x43')]='';}headers['Authorization']=getAuth(_0x544a44);return getUser(_0x544a44,_0x594d5f[_0xc6b3('0x46')])['then'](function(_0x41f60d){_0x3c8900=_0x41f60d;logger[_0xc6b3('0xa')](_0xc6b3('0x47'),_0x3c8900['id']);return getEndUser(_0x544a44,_0x1eb75f['calleridname'],_0x1eb75f[_0xc6b3('0xd')]);})[_0xc6b3('0x20')](function(_0x24ed67){_0x5a2814=_0x24ed67;logger[_0xc6b3('0xa')](_0xc6b3('0x48'),_0x5a2814['id']);return getTicket(_0x544a44,_0x3c8900,_0x5a2814,_0x22a290,_0x1eb75f);})[_0xc6b3('0x20')](function(_0x32ec8e){if(_0x32ec8e&&_0x32ec8e['id']){logger[_0xc6b3('0xa')]('Ticket\x20created!');logger[_0xc6b3('0xa')]('The\x20Ticket\x20ID\x20is:',_0x32ec8e['id']);logger[_0xc6b3('0xa')](_0xc6b3('0x41'),_0xc6b3('0x49'));emit(util[_0xc6b3('0x16')](_0xc6b3('0x4a'),_0x594d5f[_0xc6b3('0x10')]),_0xc6b3('0x4b'),{'uri':util[_0xc6b3('0x16')](_0xc6b3('0x4c'),_0x544a44[_0xc6b3('0x18')],_0x32ec8e['id'])});}})[_0xc6b3('0x4d')](function(_0x3fc656){logger[_0xc6b3('0x4e')]('[QUEUE]',JSON[_0xc6b3('0x2d')](_0x3fc656));});};exports[_0xc6b3('0x4f')]=function(_0x5bdb5f,_0x4ec5c7,_0x5b6de2,_0x4e490d,_0x270690,_0x2e4ab7,_0x1dd1cd){var _0x47bbc4,_0xbcc71f;_0x2e4ab7[_0xc6b3('0x18')]=intUtil[_0xc6b3('0x3e')](_0x2e4ab7['remoteUri']);_0x2e4ab7[_0xc6b3('0x3f')]=intUtil[_0xc6b3('0x3e')](_0x2e4ab7[_0xc6b3('0x3f')]);if(_0x1dd1cd&&_0x1dd1cd[_0xc6b3('0x50')]&&_0x1dd1cd[_0xc6b3('0x50')]!=='none'){logger[_0xc6b3('0xa')](_0xc6b3('0x51'),'Recording\x20is\x20enabled!');_0x4ec5c7['recordingURL']=util['format'](_0xc6b3('0x44'),_0x2e4ab7[_0xc6b3('0x3f')],_0x4ec5c7[_0xc6b3('0x45')],md5(_0x4ec5c7[_0xc6b3('0x45')]));}headers[_0xc6b3('0x52')]=getAuth(_0x2e4ab7);return getUser(_0x2e4ab7,_0x4e490d[_0xc6b3('0x46')])['then'](function(_0x3eb7ea){_0x47bbc4=_0x3eb7ea;logger[_0xc6b3('0xa')](_0xc6b3('0x47'),_0x47bbc4['id']);return getEndUser(_0x2e4ab7,_0x4ec5c7[_0xc6b3('0x53')],_0x4ec5c7[_0xc6b3('0x54')]);})[_0xc6b3('0x20')](function(_0xb86e78){_0xbcc71f=_0xb86e78;logger[_0xc6b3('0xa')](_0xc6b3('0x48'),_0xbcc71f['id']);return getTicket(_0x2e4ab7,_0x47bbc4,_0xbcc71f,_0x5b6de2,_0x4ec5c7);})[_0xc6b3('0x20')](function(_0xa9796){if(_0xa9796&&_0xa9796['id']){logger[_0xc6b3('0xa')](_0xc6b3('0x55'));logger[_0xc6b3('0xa')](_0xc6b3('0x56'),_0xa9796['id']);logger[_0xc6b3('0xa')](_0xc6b3('0x51'),_0xc6b3('0x49'));emit(util['format'](_0xc6b3('0x4a'),_0x4e490d[_0xc6b3('0x10')]),'trigger:browser:url',{'uri':util[_0xc6b3('0x16')](_0xc6b3('0x4c'),_0x2e4ab7[_0xc6b3('0x18')],_0xa9796['id'])});}})[_0xc6b3('0x4d')](function(_0x530ee1){logger['error']('[OUTBOUND]',JSON['stringify'](_0x530ee1));});};exports[_0xc6b3('0x57')]=function(_0x5d18e5,_0x1b1336,_0x113d69,_0x1356fd,_0x248257,_0x38c169){var _0x3e7dad,_0x70d359;_0x38c169[_0xc6b3('0x18')]=intUtil[_0xc6b3('0x3e')](_0x38c169[_0xc6b3('0x18')]);_0x38c169[_0xc6b3('0x3f')]=intUtil[_0xc6b3('0x3e')](_0x38c169[_0xc6b3('0x3f')]);if(_0x248257&&_0x248257[_0xc6b3('0x40')]){logger[_0xc6b3('0xa')]('['+_0x1b1336[_0xc6b3('0x58')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1b1336[_0xc6b3('0x43')]=util[_0xc6b3('0x16')](_0xc6b3('0x44'),_0x38c169[_0xc6b3('0x3f')],_0x1b1336['uniqueid'],md5(_0x1b1336[_0xc6b3('0x45')]));}else{_0x1b1336[_0xc6b3('0x43')]='';}headers[_0xc6b3('0x52')]=getAuth(_0x38c169);return getUser(_0x38c169,'')[_0xc6b3('0x20')](function(_0x363338){_0x3e7dad=_0x363338;logger[_0xc6b3('0xa')](_0xc6b3('0x47'),_0x3e7dad['id']);return getEndUser(_0x38c169,_0x1b1336['calleridname'],_0x1b1336['calleridnum']);})['then'](function(_0x3530ca){_0x70d359=_0x3530ca;logger[_0xc6b3('0xa')](_0xc6b3('0x48'),_0x70d359['id']);return getTicket(_0x38c169,_0x3e7dad,_0x70d359,_0x113d69,_0x1b1336);})[_0xc6b3('0x20')](function(_0x2b0f47){if(_0x2b0f47){logger['info'](_0xc6b3('0x55'));logger[_0xc6b3('0xa')]('The\x20Ticket\x20ID\x20is:',_0x2b0f47['id']);}})['catch'](function(_0x57c9e4){logger[_0xc6b3('0x4e')]('['+_0x1b1336['lastevent']['toUpperCase']()+']',JSON[_0xc6b3('0x2d')](_0x57c9e4));});}; \ 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 347b428..0e12835 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 _0x7ae8=['message','/api/selector/owners','Getting\x20user\x20list','users','agentEmail','userId','Admin\x20selected','userEmail','toUpperCase','/api/lookup?q=','&f=','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','contactNumber','endUserId','Contact\x20found\x20work_number:','Contact\x20created:','POST','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','Subjects','getString','Descriptions','Contact','add','task','ticketId','error','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','serverUrl','stripTrailingSlash','username','toLowerCase','outbound','destcalleridnum','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format','[QUEUE]','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','inspect','lodash','request-promise','util','moment','../../../../config/environment','redis','defaults','socket.io-emitter','GET','headers','info','Getting\x20admin\x20information','then','length','email','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','catch'];(function(_0x4fa8f4,_0x5799ac){var _0x51e873=function(_0x2b272c){while(--_0x2b272c){_0x4fa8f4['push'](_0x4fa8f4['shift']());}};_0x51e873(++_0x5799ac);}(_0x7ae8,0x1cd));var _0x87ae=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7ae8[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x87ae('0x0'));var rp=require(_0x87ae('0x1'));var md5=require('md5');var util=require(_0x87ae('0x2'));var moment=require(_0x87ae('0x3'));var Promise=require('bluebird');var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x87ae('0x4'));var logger=require('../../../../config/logger')('freshsales');config[_0x87ae('0x5')]=_[_0x87ae('0x6')](config[_0x87ae('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x87ae('0x7'))(new Redis(config[_0x87ae('0x5')]));function getAdminId(_0x191676,_0x500b92,_0x4d1252,_0x17412b){return new Promise(function(_0x26038a,_0x35b381){var _0x5a3488=![];var _0x58e982={'method':_0x87ae('0x8'),'uri':_0x17412b+'/api/selector/owners','json':!![]};_0x58e982[_0x87ae('0x9')]=_0x4d1252;logger[_0x87ae('0xa')](_0x87ae('0xb'));return rp(_0x58e982)[_0x87ae('0xc')](function(_0x57982c){if(_0x57982c){var _0x5e36e2=_0x57982c['users'];var _0x14f3d4=null;for(_0x14f3d4=0x0;_0x14f3d4<_0x5e36e2[_0x87ae('0xd')];_0x14f3d4++){if(_0x5e36e2[_0x14f3d4][_0x87ae('0xe')]===_0x191676[_0x87ae('0xf')]){_0x191676[_0x87ae('0x10')]=_0x5e36e2[_0x14f3d4]['id'];_0x5a3488=!![];}}if(_0x5a3488){logger[_0x87ae('0xa')]('Admin\x20found:',_0x191676[_0x87ae('0x10')]);_0x26038a(_0x191676);}else{_0x35b381({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x35b381({'statusCode':0x194,'message':_0x87ae('0x11')});}})[_0x87ae('0x12')](function(_0x1a4eb1){logger['error']('['+[_0x500b92['toUpperCase']()]+']',_0x1a4eb1[_0x87ae('0x13')]);_0x35b381(_0x1a4eb1);});});}function getUser(_0x27a0cb,_0x55c2b4,_0x34f8d0){return function(_0x4aba80){return new Promise(function(_0x271370,_0x1c3f60){var _0x5c5dcd={'method':_0x87ae('0x8'),'uri':_0x34f8d0+_0x87ae('0x14'),'json':!![]};_0x5c5dcd[_0x87ae('0x9')]=_0x55c2b4;logger[_0x87ae('0xa')](_0x87ae('0x15'));return rp(_0x5c5dcd)[_0x87ae('0xc')](function(_0x45d5e6){if(_0x45d5e6){var _0x162fae=_0x45d5e6[_0x87ae('0x16')];var _0x498a82=![];var _0x6a16cc=null;if(_0x4aba80[_0x87ae('0x17')]!==null){logger['info']('Getting\x20user\x20with\x20email',_0x4aba80['agentEmail']);_0x4aba80['userEmail']=_0x4aba80[_0x87ae('0x17')];for(_0x6a16cc=0x0;_0x6a16cc<_0x162fae[_0x87ae('0xd')];_0x6a16cc++){if(_0x162fae[_0x6a16cc][_0x87ae('0xe')]===_0x4aba80['agentEmail']){_0x498a82=!![];_0x4aba80[_0x87ae('0x18')]=_0x162fae[_0x6a16cc]['id'];logger[_0x87ae('0xa')]('User\x20found:',_0x4aba80[_0x87ae('0x18')]);}}}if(!_0x498a82){logger[_0x87ae('0xa')](_0x87ae('0x19'));_0x4aba80[_0x87ae('0x1a')]=_0x4aba80[_0x87ae('0xf')];_0x4aba80[_0x87ae('0x18')]=_0x4aba80[_0x87ae('0x10')];_0x498a82=!![];}if(_0x498a82){_0x271370(_0x4aba80);}else{_0x1c3f60({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x1c3f60({'statusCode':0x194,'message':_0x87ae('0x11')});}})[_0x87ae('0x12')](function(_0x28cd3c){logger['error']('['+[_0x27a0cb[_0x87ae('0x1b')]()]+']',_0x28cd3c['message']);_0x1c3f60(_0x28cd3c);});});};}function searchContact(_0x3fcf73,_0x4114da,_0x5b4d74,_0x161d9){return new Promise(function(_0x351bd7,_0x2e9fa4){var _0x3591df={'method':_0x87ae('0x8'),'headers':_0x4114da,'uri':_0x3fcf73+_0x87ae('0x1c')+_0x161d9+_0x87ae('0x1d')+_0x5b4d74+'&entities=contact','json':!![]};rp(_0x3591df)[_0x87ae('0xc')](function(_0xe5e646){var _0x8398ae=_[_0x87ae('0x1e')](_0xe5e646[_0x87ae('0x1f')][_0x87ae('0x1f')],[_0x5b4d74,_0x161d9]);_0x351bd7(_0x8398ae);})['catch'](function(_0x5bff32){_0x2e9fa4(_0x5bff32);});});}function getEndUser(_0x17651d,_0x12f28f,_0x7def5c){return function(_0x3be903){return new Promise(function(_0x5ccc80,_0xd55b16){logger[_0x87ae('0xa')](util[_0x87ae('0x20')](_0x87ae('0x21'),_0x3be903['contactNumber']));searchContact(_0x7def5c,_0x12f28f,_0x87ae('0x22'),_0x3be903[_0x87ae('0x23')])[_0x87ae('0xc')](function(_0x38aab3){if(_0x38aab3){_0x3be903[_0x87ae('0x24')]=_0x38aab3['id'];logger[_0x87ae('0xa')]('Contact\x20found\x20mobile_number:',_0x3be903[_0x87ae('0x24')]);return _0x5ccc80(_0x3be903);}searchContact(_0x7def5c,_0x12f28f,'work_number',_0x3be903[_0x87ae('0x23')])[_0x87ae('0xc')](function(_0x2a427a){if(_0x2a427a){_0x3be903[_0x87ae('0x24')]=_0x2a427a['id'];logger[_0x87ae('0xa')](_0x87ae('0x25'),_0x3be903['endUserId']);return _0x5ccc80(_0x3be903);}createEndUser(_0x3be903,_0x17651d,_0x12f28f,_0x7def5c)[_0x87ae('0xc')](function(_0x547648){logger[_0x87ae('0xa')](_0x87ae('0x26'),_0x547648['endUserId']);return _0x5ccc80(_0x547648);});});})[_0x87ae('0x12')](function(_0xf74ca0){_0xd55b16(_0xf74ca0);});});};}function createEndUser(_0x318185,_0x453cae,_0x5ac743,_0x48dcbc){return new Promise(function(_0x5a336b,_0x7e00a4){var _0x33e44a=moment();var _0x4d915d={'method':_0x87ae('0x27'),'uri':_0x48dcbc+'/api/contacts','body':{'contact':{'last_name':_0x318185[_0x87ae('0x23')],'work_number':_0x318185['contactNumber'],'mobile_number':_0x318185[_0x87ae('0x23')],'owner_id':_0x318185[_0x87ae('0x18')],'created_at':_0x33e44a[_0x87ae('0x20')](_0x87ae('0x28'))}},'json':!![]};_0x4d915d[_0x87ae('0x9')]=_0x5ac743;logger[_0x87ae('0xa')](_0x87ae('0x29'));return rp(_0x4d915d)['then'](function(_0x4c3631){_0x318185[_0x87ae('0x24')]=_0x4c3631[_0x87ae('0x2a')]['id'];_0x5a336b(_0x318185);})[_0x87ae('0x12')](function(_0x38f0fe){logger['error']('['+[_0x453cae[_0x87ae('0x1b')]()]+']',_0x38f0fe[_0x87ae('0x13')]);_0x7e00a4(_0x38f0fe[_0x87ae('0x13')]);});});}function getTicket(_0x17bb65,_0x386420,_0x3b0dbe,_0x9feb41,_0x58eb55){return function(_0x43cb0f){logger[_0x87ae('0xa')](_0x87ae('0x2b'));return new Promise(function(_0x38e781,_0x2418a6){var _0x3c0b17=moment();var _0xa596d4={'method':_0x87ae('0x27'),'uri':_0x3b0dbe+_0x87ae('0x2c'),'body':{'title':intUtil['getString'](_0x9feb41[_0x87ae('0x2d')],_0x58eb55,'\x20'),'description':intUtil[_0x87ae('0x2e')](_0x9feb41[_0x87ae('0x2f')],_0x58eb55,'\x0a'),'owner_id':_0x43cb0f[_0x87ae('0x18')],'creater_id':_0x43cb0f[_0x87ae('0x10')],'targetable_id':_0x43cb0f[_0x87ae('0x24')],'targetable_type':_0x87ae('0x30'),'created_at':_0x3c0b17[_0x87ae('0x20')](_0x87ae('0x28')),'due_date':_0x3c0b17[_0x87ae('0x31')](0x1e,'m')['format'](_0x87ae('0x28'))},'json':!![]};_0xa596d4['headers']=_0x386420;return rp(_0xa596d4)[_0x87ae('0xc')](function(_0x3e89b4){_0x43cb0f['ticketId']=_0x3e89b4[_0x87ae('0x32')]['id'];logger[_0x87ae('0xa')]('Task\x20created:',_0x43cb0f[_0x87ae('0x33')]);_0x38e781(_0x43cb0f);})['catch'](function(_0x43663f){logger[_0x87ae('0x34')]('['+[_0x17bb65['toUpperCase']()]+']',_0x43663f[_0x87ae('0x13')]);_0x2418a6(_0x43663f[_0x87ae('0x13')]);});});};}function emit(_0x7085a0,_0x15f4be,_0x44bdc3){var _0x5451aa={'uri':_0x7085a0+_0x87ae('0x35')+_0x44bdc3};io['to'](util[_0x87ae('0x20')](_0x87ae('0x36'),_0x15f4be))[_0x87ae('0x37')](_0x87ae('0x38'),_0x5451aa);}exports['cs']=function(_0x2471be,_0x1b4e67,_0x220e24,_0x254c24,_0xe8bc68,_0x7cef2c,_0x13c889,_0x42e29f){var _0x3f822a={};var _0x51a669={'Authorization':_0x87ae('0x39')+_0x7cef2c[_0x87ae('0x3a')]};_0x7cef2c[_0x87ae('0x3b')]=intUtil['stripTrailingSlash'](_0x7cef2c['remoteUri']);_0x7cef2c[_0x87ae('0x3c')]=intUtil[_0x87ae('0x3d')](_0x7cef2c[_0x87ae('0x3c')]);var _0x34db0a=_0x7cef2c[_0x87ae('0x3b')];_0x3f822a[_0x87ae('0xf')]=_0x7cef2c[_0x87ae('0x3e')];_0x3f822a[_0x87ae('0x23')]=_0x42e29f[_0x87ae('0x3f')]()===_0x87ae('0x40')?_0x1b4e67[_0x87ae('0x41')]:_0x1b4e67[_0x87ae('0x42')];_0x3f822a['callDirection']=_0x42e29f===_0x87ae('0x43')||_0x42e29f===_0x87ae('0x44')?_0x87ae('0x43'):_0x87ae('0x40');if(_0x254c24){_0x3f822a['agentEmail']=_0x254c24[_0x87ae('0xe')];}var _0xd9a7a4=util['format'](_0x87ae('0x45'),_0x7cef2c[_0x87ae('0x3c')],_0x1b4e67['uniqueid'],md5(_0x1b4e67['uniqueid']));if(_0xe8bc68&&_0xe8bc68[_0x87ae('0x46')]){logger[_0x87ae('0xa')](_0x87ae('0x47'),'Recording\x20is\x20enabled!');_0x1b4e67['recordingURL']=_0xd9a7a4;}else if(_0x13c889&&_0x13c889[_0x87ae('0x48')]&&_0x13c889[_0x87ae('0x48')]!==_0x87ae('0x49')){logger[_0x87ae('0xa')](_0x87ae('0x4a'),_0x87ae('0x4b'));_0x1b4e67['recordingURL']=_0xd9a7a4;}else{_0x1b4e67['recordingURL']='';}return getAdminId(_0x3f822a,_0x42e29f,_0x51a669,_0x34db0a)[_0x87ae('0xc')](getUser(_0x42e29f,_0x51a669,_0x34db0a))['then'](getEndUser(_0x42e29f,_0x51a669,_0x34db0a))[_0x87ae('0xc')](getTicket(_0x42e29f,_0x51a669,_0x34db0a,_0x220e24,_0x1b4e67))['then'](function(_0x3be322){logger[_0x87ae('0xa')](util[_0x87ae('0x20')](_0x87ae('0x4c'),_0x3be322[_0x87ae('0x33')]));if(_0x42e29f!=='unmanaged'){logger['info']('['+[_0x42e29f[_0x87ae('0x1b')]()]+']',_0x87ae('0x4d'));emit(_0x34db0a,_0x254c24[_0x87ae('0x4e')],_0x3be322['endUserId']);}})[_0x87ae('0x12')](function(_0x4be401){logger[_0x87ae('0x34')]('['+[_0x42e29f['toUpperCase']()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x87ae('0x4f')](_0x4be401,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x106c=['Task\x20created:','/contacts/','user:%s','emit','Token\x20token=','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','destcalleridnum','calleridnum','queue','unmanaged','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Recording\x20is\x20enabled!','recordingFormat','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','name','inspect','request-promise','util','bluebird','ioredis','../../../../config/environment','freshsales','redis','localhost','socket.io-emitter','GET','/api/selector/owners','info','Getting\x20admin\x20information','users','email','adminEmail','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','message','headers','Getting\x20user\x20list','Getting\x20user\x20with\x20email','agentEmail','length','userId','User\x20found:','Admin\x20selected','userEmail','adminId','toUpperCase','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','then','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','/api/tasks','getString','Subjects','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','add','ticketId','task'];(function(_0xc554a1,_0x3a43c5){var _0x336c82=function(_0x1bbe03){while(--_0x1bbe03){_0xc554a1['push'](_0xc554a1['shift']());}};_0x336c82(++_0x3a43c5);}(_0x106c,0x111));var _0xc106=function(_0x5d80a5,_0x460aad){_0x5d80a5=_0x5d80a5-0x0;var _0x83eb00=_0x106c[_0x5d80a5];return _0x83eb00;};'use strict';var _=require('lodash');var rp=require(_0xc106('0x0'));var md5=require('md5');var util=require(_0xc106('0x1'));var moment=require('moment');var Promise=require(_0xc106('0x2'));var Redis=require(_0xc106('0x3'));var intUtil=require('./util');var config=require(_0xc106('0x4'));var logger=require('../../../../config/logger')(_0xc106('0x5'));config[_0xc106('0x6')]=_['defaults'](config['redis'],{'host':_0xc106('0x7'),'port':0x18eb});var io=require(_0xc106('0x8'))(new Redis(config[_0xc106('0x6')]));function getAdminId(_0x56577e,_0x446d98,_0x4ae070,_0x10afbd){return new Promise(function(_0x2b9834,_0x42fefa){var _0x2b9224=![];var _0x5561c6={'method':_0xc106('0x9'),'uri':_0x10afbd+_0xc106('0xa'),'json':!![]};_0x5561c6['headers']=_0x4ae070;logger[_0xc106('0xb')](_0xc106('0xc'));return rp(_0x5561c6)['then'](function(_0x3726c8){if(_0x3726c8){var _0x4ca58d=_0x3726c8[_0xc106('0xd')];var _0x4fe453=null;for(_0x4fe453=0x0;_0x4fe453<_0x4ca58d['length'];_0x4fe453++){if(_0x4ca58d[_0x4fe453][_0xc106('0xe')]===_0x56577e[_0xc106('0xf')]){_0x56577e['adminId']=_0x4ca58d[_0x4fe453]['id'];_0x2b9224=!![];}}if(_0x2b9224){logger[_0xc106('0xb')](_0xc106('0x10'),_0x56577e['adminId']);_0x2b9834(_0x56577e);}else{_0x42fefa({'statusCode':0x194,'message':_0xc106('0x11')});}}else{_0x42fefa({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xc106('0x12')](function(_0x3667d3){logger[_0xc106('0x13')]('['+[_0x446d98['toUpperCase']()]+']',_0x3667d3[_0xc106('0x14')]);_0x42fefa(_0x3667d3);});});}function getUser(_0x38bcbf,_0x270c9e,_0x52410a){return function(_0x1cc2f2){return new Promise(function(_0x427a48,_0x262964){var _0x453c83={'method':_0xc106('0x9'),'uri':_0x52410a+_0xc106('0xa'),'json':!![]};_0x453c83[_0xc106('0x15')]=_0x270c9e;logger[_0xc106('0xb')](_0xc106('0x16'));return rp(_0x453c83)['then'](function(_0x1ef9ac){if(_0x1ef9ac){var _0x440b50=_0x1ef9ac['users'];var _0x1eb734=![];var _0x3d191e=null;if(_0x1cc2f2['agentEmail']!==null){logger['info'](_0xc106('0x17'),_0x1cc2f2[_0xc106('0x18')]);_0x1cc2f2['userEmail']=_0x1cc2f2[_0xc106('0x18')];for(_0x3d191e=0x0;_0x3d191e<_0x440b50[_0xc106('0x19')];_0x3d191e++){if(_0x440b50[_0x3d191e]['email']===_0x1cc2f2[_0xc106('0x18')]){_0x1eb734=!![];_0x1cc2f2[_0xc106('0x1a')]=_0x440b50[_0x3d191e]['id'];logger[_0xc106('0xb')](_0xc106('0x1b'),_0x1cc2f2[_0xc106('0x1a')]);}}}if(!_0x1eb734){logger[_0xc106('0xb')](_0xc106('0x1c'));_0x1cc2f2[_0xc106('0x1d')]=_0x1cc2f2['adminEmail'];_0x1cc2f2['userId']=_0x1cc2f2[_0xc106('0x1e')];_0x1eb734=!![];}if(_0x1eb734){_0x427a48(_0x1cc2f2);}else{_0x262964({'statusCode':0x194,'message':_0xc106('0x11')});}}else{_0x262964({'statusCode':0x194,'message':_0xc106('0x11')});}})['catch'](function(_0x361752){logger[_0xc106('0x13')]('['+[_0x38bcbf[_0xc106('0x1f')]()]+']',_0x361752[_0xc106('0x14')]);_0x262964(_0x361752);});});};}function searchContact(_0x261a22,_0x29fdba,_0xaa27d4,_0x39bc5e){return new Promise(function(_0xde0803,_0x4aaf2a){var _0x4d5f66={'method':'GET','headers':_0x29fdba,'uri':_0x261a22+_0xc106('0x20')+_0x39bc5e+_0xc106('0x21')+_0xaa27d4+_0xc106('0x22'),'json':!![]};rp(_0x4d5f66)['then'](function(_0x446616){var _0x3097e1=_[_0xc106('0x23')](_0x446616[_0xc106('0x24')]['contacts'],[_0xaa27d4,_0x39bc5e]);_0xde0803(_0x3097e1);})[_0xc106('0x12')](function(_0x543ceb){_0x4aaf2a(_0x543ceb);});});}function getEndUser(_0x39a543,_0x41ef17,_0x460ef4){return function(_0x13c142){return new Promise(function(_0x23b48e,_0x103994){logger[_0xc106('0xb')](util[_0xc106('0x25')](_0xc106('0x26'),_0x13c142['contactNumber']));searchContact(_0x460ef4,_0x41ef17,_0xc106('0x27'),_0x13c142[_0xc106('0x28')])['then'](function(_0x1bde4a){if(_0x1bde4a){_0x13c142[_0xc106('0x29')]=_0x1bde4a['id'];logger[_0xc106('0xb')](_0xc106('0x2a'),_0x13c142['endUserId']);return _0x23b48e(_0x13c142);}searchContact(_0x460ef4,_0x41ef17,_0xc106('0x2b'),_0x13c142[_0xc106('0x28')])[_0xc106('0x2c')](function(_0x43a24e){if(_0x43a24e){_0x13c142[_0xc106('0x29')]=_0x43a24e['id'];logger['info'](_0xc106('0x2d'),_0x13c142[_0xc106('0x29')]);return _0x23b48e(_0x13c142);}createEndUser(_0x13c142,_0x39a543,_0x41ef17,_0x460ef4)[_0xc106('0x2c')](function(_0x410664){logger[_0xc106('0xb')](_0xc106('0x2e'),_0x410664['endUserId']);return _0x23b48e(_0x410664);});});})[_0xc106('0x12')](function(_0x22dcde){_0x103994(_0x22dcde);});});};}function createEndUser(_0x18f4d1,_0x53f784,_0xe91a10,_0x1d4e15){return new Promise(function(_0x1f64ef,_0x1a4df0){var _0x3638b8=moment();var _0x322944={'method':_0xc106('0x2f'),'uri':_0x1d4e15+_0xc106('0x30'),'body':{'contact':{'last_name':_0x18f4d1[_0xc106('0x28')],'work_number':_0x18f4d1['contactNumber'],'mobile_number':_0x18f4d1['contactNumber'],'owner_id':_0x18f4d1['userId'],'created_at':_0x3638b8[_0xc106('0x25')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x322944[_0xc106('0x15')]=_0xe91a10;logger[_0xc106('0xb')](_0xc106('0x31'));return rp(_0x322944)['then'](function(_0x46319c){_0x18f4d1['endUserId']=_0x46319c['contact']['id'];_0x1f64ef(_0x18f4d1);})[_0xc106('0x12')](function(_0xe2da12){logger['error']('['+[_0x53f784['toUpperCase']()]+']',_0xe2da12[_0xc106('0x14')]);_0x1a4df0(_0xe2da12['message']);});});}function getTicket(_0x4ef435,_0x4b768b,_0x28caad,_0xf101e1,_0x56781d){return function(_0x3fc11e){logger[_0xc106('0xb')]('Creating\x20new\x20task');return new Promise(function(_0x171f18,_0x1efa29){var _0x1996e2=moment();var _0x15a948={'method':'POST','uri':_0x28caad+_0xc106('0x32'),'body':{'title':intUtil[_0xc106('0x33')](_0xf101e1[_0xc106('0x34')],_0x56781d,'\x20'),'description':intUtil['getString'](_0xf101e1[_0xc106('0x35')],_0x56781d,'\x0a'),'owner_id':_0x3fc11e['userId'],'creater_id':_0x3fc11e[_0xc106('0x1e')],'targetable_id':_0x3fc11e[_0xc106('0x29')],'targetable_type':_0xc106('0x36'),'created_at':_0x1996e2[_0xc106('0x25')](_0xc106('0x37')),'due_date':_0x1996e2[_0xc106('0x38')](0x1e,'m')[_0xc106('0x25')](_0xc106('0x37'))},'json':!![]};_0x15a948[_0xc106('0x15')]=_0x4b768b;return rp(_0x15a948)[_0xc106('0x2c')](function(_0x37fc17){_0x3fc11e[_0xc106('0x39')]=_0x37fc17[_0xc106('0x3a')]['id'];logger['info'](_0xc106('0x3b'),_0x3fc11e[_0xc106('0x39')]);_0x171f18(_0x3fc11e);})[_0xc106('0x12')](function(_0x424153){logger[_0xc106('0x13')]('['+[_0x4ef435['toUpperCase']()]+']',_0x424153[_0xc106('0x14')]);_0x1efa29(_0x424153[_0xc106('0x14')]);});});};}function emit(_0x3842f5,_0x244c34,_0x41c52d){var _0x579448={'uri':_0x3842f5+_0xc106('0x3c')+_0x41c52d};io['to'](util['format'](_0xc106('0x3d'),_0x244c34))[_0xc106('0x3e')]('trigger:browser:url',_0x579448);}exports['cs']=function(_0x5d2d41,_0x5d41c0,_0x56ccfb,_0x28b8f6,_0x30e637,_0x28b6fd,_0x435a0c,_0x529cda){var _0x3af859={};var _0x3cb356={'Authorization':_0xc106('0x3f')+_0x28b6fd['apiKey']};_0x28b6fd[_0xc106('0x40')]=intUtil[_0xc106('0x41')](_0x28b6fd[_0xc106('0x40')]);_0x28b6fd[_0xc106('0x42')]=intUtil[_0xc106('0x41')](_0x28b6fd[_0xc106('0x42')]);var _0x50c57b=_0x28b6fd['remoteUri'];_0x3af859[_0xc106('0xf')]=_0x28b6fd[_0xc106('0x43')];_0x3af859['contactNumber']=_0x529cda[_0xc106('0x44')]()==='outbound'?_0x5d41c0[_0xc106('0x45')]:_0x5d41c0[_0xc106('0x46')];_0x3af859['callDirection']=_0x529cda===_0xc106('0x47')||_0x529cda===_0xc106('0x48')?_0xc106('0x47'):_0xc106('0x49');if(_0x28b8f6){_0x3af859[_0xc106('0x18')]=_0x28b8f6[_0xc106('0xe')];}var _0x3c1b4b=util[_0xc106('0x25')](_0xc106('0x4a'),_0x28b6fd['serverUrl'],_0x5d41c0[_0xc106('0x4b')],md5(_0x5d41c0[_0xc106('0x4b')]));if(_0x30e637&&_0x30e637['monitor_format']){logger[_0xc106('0xb')]('[QUEUE]',_0xc106('0x4c'));_0x5d41c0['recordingURL']=_0x3c1b4b;}else if(_0x435a0c&&_0x435a0c[_0xc106('0x4d')]&&_0x435a0c[_0xc106('0x4d')]!=='none'){logger['info'](_0xc106('0x4e'),_0xc106('0x4c'));_0x5d41c0[_0xc106('0x4f')]=_0x3c1b4b;}else{_0x5d41c0[_0xc106('0x4f')]='';}return getAdminId(_0x3af859,_0x529cda,_0x3cb356,_0x50c57b)[_0xc106('0x2c')](getUser(_0x529cda,_0x3cb356,_0x50c57b))[_0xc106('0x2c')](getEndUser(_0x529cda,_0x3cb356,_0x50c57b))[_0xc106('0x2c')](getTicket(_0x529cda,_0x3cb356,_0x50c57b,_0x56ccfb,_0x5d41c0))[_0xc106('0x2c')](function(_0x1acae6){logger['info'](util[_0xc106('0x25')](_0xc106('0x50'),_0x1acae6[_0xc106('0x39')]));if(_0x529cda!==_0xc106('0x48')){logger['info']('['+[_0x529cda[_0xc106('0x1f')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x50c57b,_0x28b8f6[_0xc106('0x51')],_0x1acae6[_0xc106('0x29')]);}})[_0xc106('0x12')](function(_0x366f11){logger['error']('['+[_0x529cda[_0xc106('0x1f')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0xc106('0x52')](_0x366f11,{'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 d6d3158..a04d04b 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 _0x1dd4=['./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','zendesk','salesforce','freshdesk','zoho','desk','servicenow','exec','includes','data1','data2','find','Configurations','data3','queue','routeId','EVENT\x20UNKNOWN','unmanaged','toLowerCase','sugarcrm','vtiger','freshsales','log','unknown\x20integration','../../../../config/logger','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','error','lodash','util','./salesforce'];(function(_0x365905,_0x84e027){var _0x7403e8=function(_0x4f00c7){while(--_0x4f00c7){_0x365905['push'](_0x365905['shift']());}};_0x7403e8(++_0x84e027);}(_0x1dd4,0x14a));var _0x41dd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1dd4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x41dd('0x0'));var util=require(_0x41dd('0x1'));var zendesk=require('./zendesk');var salesforce=require(_0x41dd('0x2'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x41dd('0x3'));var zoho=require(_0x41dd('0x4'));var desk=require(_0x41dd('0x5'));var vtiger=require(_0x41dd('0x6'));var servicenow=require(_0x41dd('0x7'));var dynamics365=require(_0x41dd('0x8'));var freshsales=require('./freshsales');var integrations=[_0x41dd('0x9'),_0x41dd('0xa'),'sugarcrm',_0x41dd('0xb'),_0x41dd('0xc'),_0x41dd('0xd'),'vtiger','dynamics365','freshsales',_0x41dd('0xe')];exports[_0x41dd('0xf')]=function(_0x5a06e7,_0x5ae203,_0xadec1e,_0x118f0b,_0x3e6290,_0x31d1d8){if(_0xadec1e){if(_[_0x41dd('0x10')](integrations,_0x5a06e7[_0x41dd('0x11')]['toLowerCase']())){try{var _0x258c12=null;var _0x442e92='';var _0x51c55e=_0xadec1e[_0x5a06e7[_0x41dd('0x11')]['toLowerCase']()];if(_0x51c55e){var _0x5bbef3=_0x51c55e[_0x5a06e7[_0x41dd('0x12')]];if(_0x5bbef3){var _0x2a8541=_[_0x41dd('0x13')](_0x5bbef3[_0x41dd('0x14')],{'id':parseInt(_0x5a06e7[_0x41dd('0x15')],0xa)});if(_0x2a8541){if(_0x118f0b){if(_0x3e6290&&_0x5ae203[_0x41dd('0x16')]){_0x442e92=_0x41dd('0x16');}else if(_0x5ae203[_0x41dd('0x17')]){_0x442e92='outbound';}else{console['log'](_0x41dd('0x18'),_0x5ae203);}}else{_0x442e92=_0x41dd('0x19');}switch(_0x5a06e7['data1'][_0x41dd('0x1a')]()){case _0x41dd('0x9'):zendesk[_0x442e92](_0x5a06e7,_0x5ae203,_0x2a8541,_0x118f0b,_0x3e6290,_0x5bbef3,_0x31d1d8);break;case _0x41dd('0xa'):salesforce[_0x442e92](_0x5a06e7,_0x5ae203,_0x2a8541,_0x118f0b,_0x3e6290,_0x5bbef3,_0x31d1d8);break;case _0x41dd('0x1b'):sugarcrm[_0x442e92](_0x5a06e7,_0x5ae203,_0x2a8541,_0x118f0b,_0x3e6290,_0x5bbef3,_0x31d1d8);break;case _0x41dd('0xb'):freshdesk[_0x442e92](_0x5a06e7,_0x5ae203,_0x2a8541,_0x118f0b,_0x3e6290,_0x5bbef3,_0x31d1d8);break;case'zoho':zoho[_0x442e92](_0x5a06e7,_0x5ae203,_0x2a8541,_0x118f0b,_0x3e6290,_0x5bbef3,_0x31d1d8);break;case _0x41dd('0xd'):desk[_0x442e92](_0x5a06e7,_0x5ae203,_0x2a8541,_0x118f0b,_0x3e6290,_0x5bbef3,_0x31d1d8);break;case _0x41dd('0x1c'):vtiger[_0x442e92](_0x5a06e7,_0x5ae203,_0x2a8541,_0x118f0b,_0x3e6290,_0x5bbef3,_0x31d1d8);break;case _0x41dd('0x1d'):freshsales['cs'](_0x5a06e7,_0x5ae203,_0x2a8541,_0x118f0b,_0x3e6290,_0x5bbef3,_0x31d1d8,_0x442e92);break;case _0x41dd('0xe'):servicenow['cs'](_0x5a06e7,_0x5ae203,_0x2a8541,_0x118f0b,_0x3e6290,_0x5bbef3,_0x31d1d8,_0x442e92);break;case'dynamics365':dynamics365['cs'](_0x5a06e7,_0x5ae203,_0x2a8541,_0x118f0b,_0x3e6290,_0x5bbef3,_0x31d1d8,_0x442e92);break;default:console[_0x41dd('0x1e')](_0x41dd('0x1f'));}}else{_0x258c12=require(_0x41dd('0x20'))(_0x5a06e7['data1'][_0x41dd('0x1a')]());_0x258c12['error'](_0x41dd('0x21'),util[_0x41dd('0x22')](_0x41dd('0x23'),_0x5a06e7[_0x41dd('0x11')][_0x41dd('0x1a')](),_0x5a06e7[_0x41dd('0x15')]));}}else{_0x258c12=require('../../../../config/logger')(_0x5a06e7['data1']['toLowerCase']());_0x258c12[_0x41dd('0x24')](_0x41dd('0x21'),util[_0x41dd('0x22')]('%s\x20account\x20#%s\x20not\x20found',_0x5a06e7['data1'][_0x41dd('0x1a')](),_0x5a06e7[_0x41dd('0x12')]));}}else{}}catch(_0x11d6b1){console[_0x41dd('0x24')](_0x11d6b1);}}}}; \ No newline at end of file +var _0xc6ac=['data1','toLowerCase','find','Configurations','data3','queue','routeId','outbound','sugarcrm','vtiger','log','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','data2','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','freshdesk','zoho','desk','dynamics365','freshsales','servicenow','exec','includes'];(function(_0x1317ed,_0x57217d){var _0xbaeca=function(_0x24e517){while(--_0x24e517){_0x1317ed['push'](_0x1317ed['shift']());}};_0xbaeca(++_0x57217d);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x4ab755,_0xbdaa45){_0x4ab755=_0x4ab755-0x0;var _0x3da799=_0xc6ac[_0x4ab755];return _0x3da799;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var zendesk=require(_0xcc6a('0x2'));var salesforce=require(_0xcc6a('0x3'));var sugarcrm=require(_0xcc6a('0x4'));var freshdesk=require(_0xcc6a('0x5'));var zoho=require(_0xcc6a('0x6'));var desk=require(_0xcc6a('0x7'));var vtiger=require(_0xcc6a('0x8'));var servicenow=require(_0xcc6a('0x9'));var dynamics365=require(_0xcc6a('0xa'));var freshsales=require(_0xcc6a('0xb'));var integrations=[_0xcc6a('0xc'),_0xcc6a('0xd'),'sugarcrm',_0xcc6a('0xe'),_0xcc6a('0xf'),_0xcc6a('0x10'),'vtiger',_0xcc6a('0x11'),_0xcc6a('0x12'),_0xcc6a('0x13')];exports[_0xcc6a('0x14')]=function(_0x3eb04a,_0x5e91a2,_0x30a004,_0x290119,_0x109693,_0x4f034a){if(_0x30a004){if(_[_0xcc6a('0x15')](integrations,_0x3eb04a[_0xcc6a('0x16')][_0xcc6a('0x17')]())){try{var _0x55af93=null;var _0x59ce6d='';var _0xf0f6d5=_0x30a004[_0x3eb04a[_0xcc6a('0x16')][_0xcc6a('0x17')]()];if(_0xf0f6d5){var _0x559a0a=_0xf0f6d5[_0x3eb04a['data2']];if(_0x559a0a){var _0x369dc1=_[_0xcc6a('0x18')](_0x559a0a[_0xcc6a('0x19')],{'id':parseInt(_0x3eb04a[_0xcc6a('0x1a')],0xa)});if(_0x369dc1){if(_0x290119){if(_0x109693&&_0x5e91a2[_0xcc6a('0x1b')]){_0x59ce6d=_0xcc6a('0x1b');}else if(_0x5e91a2[_0xcc6a('0x1c')]){_0x59ce6d=_0xcc6a('0x1d');}else{console['log']('EVENT\x20UNKNOWN',_0x5e91a2);}}else{_0x59ce6d='unmanaged';}switch(_0x3eb04a[_0xcc6a('0x16')][_0xcc6a('0x17')]()){case _0xcc6a('0xc'):zendesk[_0x59ce6d](_0x3eb04a,_0x5e91a2,_0x369dc1,_0x290119,_0x109693,_0x559a0a,_0x4f034a);break;case _0xcc6a('0xd'):salesforce[_0x59ce6d](_0x3eb04a,_0x5e91a2,_0x369dc1,_0x290119,_0x109693,_0x559a0a,_0x4f034a);break;case _0xcc6a('0x1e'):sugarcrm[_0x59ce6d](_0x3eb04a,_0x5e91a2,_0x369dc1,_0x290119,_0x109693,_0x559a0a,_0x4f034a);break;case _0xcc6a('0xe'):freshdesk[_0x59ce6d](_0x3eb04a,_0x5e91a2,_0x369dc1,_0x290119,_0x109693,_0x559a0a,_0x4f034a);break;case _0xcc6a('0xf'):zoho[_0x59ce6d](_0x3eb04a,_0x5e91a2,_0x369dc1,_0x290119,_0x109693,_0x559a0a,_0x4f034a);break;case _0xcc6a('0x10'):desk[_0x59ce6d](_0x3eb04a,_0x5e91a2,_0x369dc1,_0x290119,_0x109693,_0x559a0a,_0x4f034a);break;case _0xcc6a('0x1f'):vtiger[_0x59ce6d](_0x3eb04a,_0x5e91a2,_0x369dc1,_0x290119,_0x109693,_0x559a0a,_0x4f034a);break;case _0xcc6a('0x12'):freshsales['cs'](_0x3eb04a,_0x5e91a2,_0x369dc1,_0x290119,_0x109693,_0x559a0a,_0x4f034a,_0x59ce6d);break;case _0xcc6a('0x13'):servicenow['cs'](_0x3eb04a,_0x5e91a2,_0x369dc1,_0x290119,_0x109693,_0x559a0a,_0x4f034a,_0x59ce6d);break;case'dynamics365':dynamics365['cs'](_0x3eb04a,_0x5e91a2,_0x369dc1,_0x290119,_0x109693,_0x559a0a,_0x4f034a,_0x59ce6d);break;default:console[_0xcc6a('0x20')](_0xcc6a('0x21'));}}else{_0x55af93=require(_0xcc6a('0x22'))(_0x3eb04a[_0xcc6a('0x16')][_0xcc6a('0x17')]());_0x55af93[_0xcc6a('0x23')](_0xcc6a('0x24'),util[_0xcc6a('0x25')](_0xcc6a('0x26'),_0x3eb04a[_0xcc6a('0x16')][_0xcc6a('0x17')](),_0x3eb04a[_0xcc6a('0x1a')]));}}else{_0x55af93=require('../../../../config/logger')(_0x3eb04a[_0xcc6a('0x16')][_0xcc6a('0x17')]());_0x55af93[_0xcc6a('0x23')]('[EXEC]',util[_0xcc6a('0x25')](_0xcc6a('0x27'),_0x3eb04a[_0xcc6a('0x16')][_0xcc6a('0x17')](),_0x3eb04a[_0xcc6a('0x28')]));}}else{}}catch(_0x5fc697){console['error'](_0x5fc697);}}}}; \ 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 8507dba..2509122 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 _0xaf6f=['Salesforce\x20account\x20type\x20not\x20recognized','[OUTBOUND]','unmanaged','toUpperCase','lastevent',']\x20Ticket\x20%s\x20created.','lodash','request-promise','moment','bluebird','md5','jsforce','util','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','assign','Subjects','Descriptions','Task','ActivityDate','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','Case','ContactId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','User','find','execute','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','resolve','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','cloneDeep','merge','$or','Contact','length','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','additionalSearchContact','Name','Phone','attributes','type','toLowerCase','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','forEach','includes','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','password','concat','securityToken','Connection','remoteUri','clientId','clientSecret','login','username','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','calleridname','calleridnum','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','trigger:browser:url','%s/%s/e','instanceUrl','error','catch','outbound','recordingFormat','none','uniqueid','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab'];(function(_0x1ad07b,_0x551d55){var _0x2c447f=function(_0x43340b){while(--_0x43340b){_0x1ad07b['push'](_0x1ad07b['shift']());}};_0x2c447f(++_0x551d55);}(_0xaf6f,0x83));var _0xfaf6=function(_0x363044,_0x5d5c70){_0x363044=_0x363044-0x0;var _0xad109b=_0xaf6f[_0x363044];return _0xad109b;};'use strict';var _=require(_0xfaf6('0x0'));var rp=require(_0xfaf6('0x1'));var moment=require(_0xfaf6('0x2'));var BPromise=require(_0xfaf6('0x3'));var md5=require(_0xfaf6('0x4'));var jsforce=require(_0xfaf6('0x5'));var util=require(_0xfaf6('0x6'));var Redis=require('ioredis');var intUtil=require(_0xfaf6('0x7'));var config=require(_0xfaf6('0x8'));var logger=require(_0xfaf6('0x9'))(_0xfaf6('0xa'));config[_0xfaf6('0xb')]=_[_0xfaf6('0xc')](config[_0xfaf6('0xb')],{'host':_0xfaf6('0xd'),'port':0x18eb});var io=require(_0xfaf6('0xe'))(new Redis(config['redis']));function emit(_0x52daed,_0x557315,_0x2761a0){io['to'](_0x52daed)[_0xfaf6('0xf')](_0x557315,_0x2761a0);}function getTicket(_0x29c4ed,_0x3430a4,_0x166800,_0x584a7b,_0x200b76,_0xa0c2dc,_0x3a11e9,_0x3884df){var _0x570448=Object[_0xfaf6('0x10')]({},{'OwnerId':_0x3430a4['id'],'Subject':intUtil['getString'](_0x584a7b[_0xfaf6('0x11')],_0x200b76,'\x20'),'Description':intUtil['getString'](_0x584a7b[_0xfaf6('0x12')],_0x200b76,'\x0a')},getCustomFields(_0xa0c2dc,_0x200b76));if(_0x166800){if(_0x584a7b['ticketType']===_0xfaf6('0x13')){_0x570448[_0xfaf6('0x14')]=moment['utc']();_0x570448[_0xfaf6('0x15')]=![];_0x570448[_0xfaf6('0x16')]=![];if(_0x166800[_0xfaf6('0x17')]===_0xfaf6('0x18')||_0x166800['endUserType']===_0xfaf6('0x19')){_0x570448[_0xfaf6('0x1a')]=_0x166800['id'];}else if(_0x166800[_0xfaf6('0x17')]===_0xfaf6('0x1b')){_0x570448['WhatId']=_0x166800['id'];}}else if(_0x584a7b['ticketType']===_0xfaf6('0x1c')){if(_0x166800['endUserType']===_0xfaf6('0x18')){_0x570448[_0xfaf6('0x1d')]=_0x166800['id'];}else if(_0x166800['endUserType']===_0xfaf6('0x1b')){_0x570448['AccountId']=_0x166800['id'];}else if(_0x166800[_0xfaf6('0x17')]===_0xfaf6('0x19')&&_0x584a7b[_0xfaf6('0x1e')]){_0x570448[_0x584a7b[_0xfaf6('0x1e')]]=_0x166800['id'];}else{logger[_0xfaf6('0x1f')](_0xfaf6('0x20'));}}}return _0x3a11e9[_0xfaf6('0x21')](_0x584a7b['ticketType'])[_0xfaf6('0x22')](_0x570448);}function getUser(_0x538e62,_0x30a228,_0x102a7c){if(!_['isNil'](_0x30a228)&&intUtil['validateEmail'](_0x30a228)){var _0x4b8359={'Email':_0x30a228};var _0x28e4c6={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x102a7c[_0xfaf6('0x21')](_0xfaf6('0x23'))[_0xfaf6('0x24')](_0x4b8359,_0x28e4c6)[_0xfaf6('0x25')]()['then'](function(_0xc30c7c){if(_0xc30c7c['length']){var _0xcdff81=_[_0xfaf6('0x24')](_0xc30c7c,function(_0x41219c){return _0x41219c['Email']===_0x30a228;});if(_0xcdff81){logger[_0xfaf6('0x1f')]('Agent\x20%s\x20found.',_0x30a228);return BPromise['resolve']({'id':_0xcdff81['Id'],'name':_0xcdff81['Name']});}}else{logger[_0xfaf6('0x1f')](_0xfaf6('0x26'),_0x30a228);return _0x102a7c[_0xfaf6('0x27')]()[_0xfaf6('0x28')](function(_0x2300cf){return BPromise[_0xfaf6('0x29')]({'id':_0x2300cf[_0xfaf6('0x2a')],'name':_0x2300cf[_0xfaf6('0x2b')]});});}});}else{logger[_0xfaf6('0x1f')](_0xfaf6('0x26'),_0x30a228);return _0x102a7c[_0xfaf6('0x27')]()[_0xfaf6('0x28')](function(_0x16b52c){return BPromise[_0xfaf6('0x29')]({'id':_0x16b52c[_0xfaf6('0x2a')],'name':_0x16b52c[_0xfaf6('0x2b')]});});}}function getEndUser(_0x2bb21d,_0x1b91a6,_0x49d84f,_0x1fac83,_0x3592bc){var _0x3872bf={'$or':{'Phone':_0x1fac83}};var _0x3250f6={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xfaf6('0x29')]()[_0xfaf6('0x28')](function(){logger[_0xfaf6('0x1f')](_0xfaf6('0x2c'),_0x1fac83,_0x1b91a6[_0xfaf6('0x2d')]);switch(_0x1b91a6[_0xfaf6('0x2d')]){case'contact_lead':var _0x534a03=_[_0xfaf6('0x2e')](_0x3872bf);if(_0x1b91a6['additionalSearchContact']){var _0x2d634f={};_0x2d634f[_0x1b91a6['additionalSearchContact']]=_0x1fac83;_[_0xfaf6('0x2f')](_0x534a03[_0xfaf6('0x30')],_0x2d634f);}return _0x3592bc[_0xfaf6('0x21')](_0xfaf6('0x31'))[_0xfaf6('0x24')](_0x534a03,_0x3250f6)['execute']()['then'](function(_0x15c0df){if(_0x15c0df&&_0x15c0df[_0xfaf6('0x32')]){return _0x15c0df;}else{var _0x392d6b=_[_0xfaf6('0x2e')](_0x3872bf);if(_0x1b91a6[_0xfaf6('0x33')]){var _0x4492a4={};_0x4492a4[_0x1b91a6[_0xfaf6('0x33')]]=_0x1fac83;_[_0xfaf6('0x2f')](_0x392d6b[_0xfaf6('0x30')],_0x4492a4);}return _0x3592bc[_0xfaf6('0x21')](_0xfaf6('0x34'))[_0xfaf6('0x24')](_0x392d6b,_0x3250f6);}});case _0xfaf6('0x35'):var _0x1ea372=_['cloneDeep'](_0x3872bf);if(_0x1b91a6['additionalSearchAccount']){var _0x2d634f={};_0x2d634f[_0x1b91a6[_0xfaf6('0x36')]]=_0x1fac83;_[_0xfaf6('0x2f')](_0x1ea372[_0xfaf6('0x30')],_0x2d634f);}return _0x3592bc[_0xfaf6('0x21')](_0xfaf6('0x37'))[_0xfaf6('0x24')](_0x1ea372,_0x3250f6)[_0xfaf6('0x25')]()['then'](function(_0x2695a5){if(_0x2695a5&&_0x2695a5['length']){return _0x2695a5;}else{var _0xd5f8fd=_[_0xfaf6('0x2e')](_0x3872bf);if(_0x1b91a6[_0xfaf6('0x38')]){var _0x5e671f={};_0x5e671f[_0x1b91a6[_0xfaf6('0x38')]]=_0x1fac83;_[_0xfaf6('0x2f')](_0xd5f8fd[_0xfaf6('0x30')],_0x5e671f);}return _0x3592bc['sobject'](_0xfaf6('0x31'))[_0xfaf6('0x24')](_0xd5f8fd,_0x3250f6)[_0xfaf6('0x28')](function(_0x265119){if(_0x265119&&_0x265119[_0xfaf6('0x32')]){return _0x265119;}else{var _0x33cbf=_[_0xfaf6('0x2e')](_0x3872bf);if(_0x1b91a6[_0xfaf6('0x33')]){var _0x1e7e85={};_0x1e7e85[_0x1b91a6[_0xfaf6('0x33')]]=_0x1fac83;_[_0xfaf6('0x2f')](_0x33cbf[_0xfaf6('0x30')],_0x1e7e85);}return _0x3592bc['sobject']('Lead')['find'](_0x33cbf,_0x3250f6);}});}});case _0xfaf6('0x18'):var _0x534a03=_[_0xfaf6('0x2e')](_0x3872bf);if(_0x1b91a6[_0xfaf6('0x38')]){var _0x2d634f={};_0x2d634f[_0x1b91a6['additionalSearchContact']]=_0x1fac83;_['merge'](_0x534a03[_0xfaf6('0x30')],_0x2d634f);}return _0x3592bc[_0xfaf6('0x21')]('Contact')[_0xfaf6('0x24')](_0x534a03,_0x3250f6)[_0xfaf6('0x25')]();case _0xfaf6('0x19'):var _0xf3dacc=_['cloneDeep'](_0x3872bf);if(_0x1b91a6[_0xfaf6('0x33')]){var _0x2d634f={};_0x2d634f[_0x1b91a6['additionalSearchLead']]=_0x1fac83;_['merge'](_0xf3dacc[_0xfaf6('0x30')],_0x2d634f);}return _0x3592bc['sobject']('Lead')['find'](_0xf3dacc,_0x3250f6);case _0xfaf6('0x1b'):var _0x1ea372=_[_0xfaf6('0x2e')](_0x3872bf);if(_0x1b91a6[_0xfaf6('0x36')]){var _0x2d634f={};_0x2d634f[_0x1b91a6[_0xfaf6('0x36')]]=_0x1fac83;_[_0xfaf6('0x2f')](_0x1ea372[_0xfaf6('0x30')],_0x2d634f);}return _0x3592bc[_0xfaf6('0x21')]('Account')[_0xfaf6('0x24')](_0x1ea372,_0x3250f6);default:return null;}})['then'](function(_0x347f6e){if(_0x347f6e&&_0x347f6e[_0xfaf6('0x32')]){var _0x215ecc=_['first'](_0x347f6e);if(_0x215ecc){return BPromise[_0xfaf6('0x29')]({'id':_0x215ecc['Id'],'name':_0x215ecc[_0xfaf6('0x39')],'phone':_0x215ecc[_0xfaf6('0x3a')],'endUserType':_0x215ecc[_0xfaf6('0x3b')][_0xfaf6('0x3c')][_0xfaf6('0x3d')]()});}}})['then'](function(_0x3cb7c1){if(_0x3cb7c1){logger[_0xfaf6('0x1f')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x3cb7c1[_0xfaf6('0x17')],_0x1fac83);return BPromise[_0xfaf6('0x29')](_0x3cb7c1);}else{logger[_0xfaf6('0x1f')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x1fac83);var _0x527824={'Phone':_0x1fac83};if(_0x1b91a6[_0xfaf6('0x3e')]){if(_0x1b91a6[_0xfaf6('0x3e')]==='contact'){logger[_0xfaf6('0x1f')](_0xfaf6('0x3f'),_0x1fac83,_0x1b91a6['moduleCreate']);_0x527824[_0xfaf6('0x40')]=_0x49d84f!==_0xfaf6('0x41')?_0x49d84f:util[_0xfaf6('0x42')](_0xfaf6('0x43'),_0x1fac83);}else if(_0x1b91a6[_0xfaf6('0x3e')]===_0xfaf6('0x19')){logger['info'](_0xfaf6('0x3f'),_0x1fac83,_0x1b91a6[_0xfaf6('0x3e')]);_0x527824['LastName']=_0x49d84f!==''?_0x49d84f:util[_0xfaf6('0x42')](_0xfaf6('0x43'),_0x1fac83);_0x527824[_0xfaf6('0x44')]='No\x20Company';}else if(_0x1b91a6[_0xfaf6('0x3e')]===_0xfaf6('0x1b')){logger['info'](_0xfaf6('0x3f'),_0x1fac83,_0x1b91a6[_0xfaf6('0x3e')]);_0x527824[_0xfaf6('0x39')]=_0x49d84f!==_0xfaf6('0x41')?_0x49d84f:util['format']('Caller\x20-\x20%s',_0x1fac83);}else{return null;}}return _0x3592bc[_0xfaf6('0x21')](_['upperFirst'](_0x1b91a6[_0xfaf6('0x3e')]))[_0xfaf6('0x22')](_0x527824)[_0xfaf6('0x28')](function(_0x3ec5fb){return BPromise[_0xfaf6('0x29')]({'id':_0x3ec5fb['id'],'endUserType':_0x1b91a6[_0xfaf6('0x3e')]});});}});}function getCustomFields(_0x3a46db,_0x5e685a){var _0x195bda={};if(_0x3a46db[_0xfaf6('0x32')]>0x0){_[_0xfaf6('0x45')](_0x3a46db,function(_0x4ebadd){if(_[_0xfaf6('0x46')]([_0xfaf6('0x47'),_0xfaf6('0x48')],_0x4ebadd[_0xfaf6('0x3c')])&&_0x4ebadd[_0xfaf6('0x49')]){_0x195bda[_0x4ebadd[_0xfaf6('0x49')]]=_0x4ebadd[_0xfaf6('0x4a')][_0xfaf6('0x4b')]();}else if(_0x4ebadd[_0xfaf6('0x3c')]===_0xfaf6('0x4c')&&_0x4ebadd['variableName']&&_0x4ebadd[_0xfaf6('0x49')]){_0x5e685a[_0x4ebadd[_0xfaf6('0x4d')]]&&(_0x195bda[_0x4ebadd['idField']]=_0x5e685a[_0x4ebadd[_0xfaf6('0x4d')]]['toString']());}else if(_0x4ebadd[_0xfaf6('0x3c')]===_0xfaf6('0x4e')&&_0x4ebadd[_0xfaf6('0x4f')]&&_0x4ebadd[_0xfaf6('0x4f')]['name']&&_0x4ebadd[_0xfaf6('0x49')]){_0x5e685a[_0x4ebadd['Variable'][_0xfaf6('0x50')][_0xfaf6('0x3d')]()]&&(_0x195bda[_0x4ebadd[_0xfaf6('0x49')]]=_0x5e685a[_0x4ebadd[_0xfaf6('0x4f')][_0xfaf6('0x50')][_0xfaf6('0x3d')]()][_0xfaf6('0x4b')]());}});}return _0x195bda;}function getConnection(_0xd8cfd){var _0x5e0447=_0xd8cfd[_0xfaf6('0x51')][_0xfaf6('0x52')](_0xd8cfd[_0xfaf6('0x53')]);var _0x3cedde=new jsforce[(_0xfaf6('0x54'))]({'oauth2':{'loginUrl':_0xd8cfd[_0xfaf6('0x55')]||'https://login.salesforce.com','clientId':_0xd8cfd[_0xfaf6('0x56')],'clientSecret':_0xd8cfd[_0xfaf6('0x57')]}});return _0x3cedde[_0xfaf6('0x58')](_0xd8cfd[_0xfaf6('0x59')],_0x5e0447)[_0xfaf6('0x28')](function(){logger[_0xfaf6('0x1f')]('Connection\x20established.');return _0x3cedde;});}exports[_0xfaf6('0x5a')]=function(_0x44467a,_0x633277,_0x1a7571,_0x404037,_0x310dfe,_0x22df86){var _0x624f92,_0x138455,_0x1494ba,_0x253882;_0x22df86['serverUrl']=intUtil[_0xfaf6('0x5b')](_0x22df86[_0xfaf6('0x5c')]);_0x22df86[_0xfaf6('0x55')]=intUtil['stripTrailingSlash'](_0x22df86['remoteUri']);if(_0x310dfe&&_0x310dfe['monitor_format']){logger['info'](_0xfaf6('0x5d'),_0xfaf6('0x5e'));_0x633277[_0xfaf6('0x5f')]=util[_0xfaf6('0x42')](_0xfaf6('0x60'),_0x22df86['serverUrl'],_0x633277['uniqueid'],md5(_0x633277['uniqueid']));}else{_0x633277[_0xfaf6('0x5f')]='';}return getConnection(_0x22df86)[_0xfaf6('0x28')](function(_0x479cda){_0x253882=_0x479cda;return getUser(_0x22df86,_0x404037[_0xfaf6('0x61')],_0x253882);})[_0xfaf6('0x28')](function(_0x4f9868){_0x624f92=_0x4f9868;return getEndUser(_0x22df86,_0x1a7571,_0x633277[_0xfaf6('0x62')],_0x633277[_0xfaf6('0x63')],_0x253882);})[_0xfaf6('0x28')](function(_0x5ee651){_0x138455=_0x5ee651;return getTicket(_0x22df86,_0x624f92,_0x138455,_0x1a7571,_0x633277,_0x1a7571[_0xfaf6('0x64')],_0x253882,'queue');})[_0xfaf6('0x28')](function(_0x514e38){_0x1494ba=_0x514e38;logger[_0xfaf6('0x1f')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x1494ba['id']);logger[_0xfaf6('0x1f')](_0xfaf6('0x65'),_0x1494ba['id'],_0x404037[_0xfaf6('0x50')],_0x22df86[_0xfaf6('0x3c')]);switch(_0x22df86[_0xfaf6('0x3c')]){case _0xfaf6('0x66'):emit(util[_0xfaf6('0x42')](_0xfaf6('0x67'),_0x404037[_0xfaf6('0x50')]),_0xfaf6('0x68'),{'recordId':_0x1494ba['id']});break;case'newTab':emit(util['format'](_0xfaf6('0x67'),_0x404037[_0xfaf6('0x50')]),_0xfaf6('0x69'),{'uri':util[_0xfaf6('0x42')](_0xfaf6('0x6a'),_0x253882[_0xfaf6('0x6b')],_0x1494ba['id'])});break;default:logger[_0xfaf6('0x6c')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xfaf6('0x6d')](function(_0xa7f12e){logger[_0xfaf6('0x6c')](_0xfaf6('0x5d'),_0xa7f12e);});};exports[_0xfaf6('0x6e')]=function(_0x503ee4,_0x7e1a57,_0x3450fb,_0x46024a,_0x572609,_0x56304e,_0x12ab67){var _0x41932b,_0x127262,_0x1da6d2,_0x3b63f4;_0x56304e[_0xfaf6('0x5c')]=intUtil['stripTrailingSlash'](_0x56304e[_0xfaf6('0x5c')]);_0x56304e[_0xfaf6('0x55')]=intUtil[_0xfaf6('0x5b')](_0x56304e[_0xfaf6('0x55')]);if(_0x12ab67&&_0x12ab67[_0xfaf6('0x6f')]&&_0x12ab67[_0xfaf6('0x6f')]!==_0xfaf6('0x70')){logger[_0xfaf6('0x1f')]('[OUTBOUND]',_0xfaf6('0x5e'));_0x7e1a57['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x56304e[_0xfaf6('0x5c')],_0x7e1a57[_0xfaf6('0x71')],md5(_0x7e1a57[_0xfaf6('0x71')]));}return getConnection(_0x56304e)[_0xfaf6('0x28')](function(_0x568b7c){_0x3b63f4=_0x568b7c;return getUser(_0x56304e,_0x46024a['email'],_0x3b63f4);})[_0xfaf6('0x28')](function(_0x1cb6b6){_0x41932b=_0x1cb6b6;return getEndUser(_0x56304e,_0x3450fb,_0x7e1a57[_0xfaf6('0x72')],_0x7e1a57[_0xfaf6('0x73')],_0x3b63f4);})[_0xfaf6('0x28')](function(_0x540754){_0x127262=_0x540754;return getTicket(_0x56304e,_0x41932b,_0x127262,_0x3450fb,_0x7e1a57,_0x3450fb[_0xfaf6('0x64')],_0x3b63f4,'outbound');})[_0xfaf6('0x28')](function(_0x1b576e){_0x1da6d2=_0x1b576e;logger[_0xfaf6('0x1f')](_0xfaf6('0x74'),_0x1da6d2['id']);logger[_0xfaf6('0x1f')](_0xfaf6('0x75'),_0x1da6d2['id'],_0x46024a[_0xfaf6('0x50')],_0x56304e['type']);switch(_0x56304e['type']){case'integrationTab':emit(util[_0xfaf6('0x42')]('user:%s',_0x46024a[_0xfaf6('0x50')]),_0xfaf6('0x68'),{'recordId':_0x1da6d2['id']});break;case _0xfaf6('0x76'):emit(util[_0xfaf6('0x42')](_0xfaf6('0x67'),_0x46024a[_0xfaf6('0x50')]),_0xfaf6('0x69'),{'uri':util[_0xfaf6('0x42')](_0xfaf6('0x6a'),_0x3b63f4['instanceUrl'],_0x1da6d2['id'])});break;default:logger[_0xfaf6('0x6c')]('[OUTBOUND]',_0xfaf6('0x77'));}})[_0xfaf6('0x6d')](function(_0x4f304a){logger[_0xfaf6('0x6c')](_0xfaf6('0x78'),_0x4f304a);});};exports[_0xfaf6('0x79')]=function(_0x2bebb5,_0x4d96d5,_0xfed7a9,_0x4909fc,_0x698610,_0x4f8645){var _0x55911a,_0x302d38,_0x147f2d,_0x1908a0;_0x4f8645[_0xfaf6('0x5c')]=intUtil[_0xfaf6('0x5b')](_0x4f8645['serverUrl']);_0x4f8645[_0xfaf6('0x55')]=intUtil[_0xfaf6('0x5b')](_0x4f8645['remoteUri']);if(_0x698610&&_0x698610['monitor_format']){logger['info']('['+_0x4d96d5['lastevent'][_0xfaf6('0x7a')]()+']',_0xfaf6('0x5e'));_0x4d96d5['recordingURL']=util[_0xfaf6('0x42')](_0xfaf6('0x60'),_0x4f8645[_0xfaf6('0x5c')],_0x4d96d5[_0xfaf6('0x71')],md5(_0x4d96d5['uniqueid']));}else{_0x4d96d5['recordingURL']='';}return getConnection(_0x4f8645)[_0xfaf6('0x28')](function(_0x51e3aa){_0x1908a0=_0x51e3aa;if(!_['isNil'](_0x4909fc)){return getUser(_0x4f8645,_0x4909fc[_0xfaf6('0x50')],_0x1908a0);}else{return getUser(_0x4f8645,null,_0x1908a0);}})['then'](function(_0x534a1a){_0x55911a=_0x534a1a;return getEndUser(_0x4f8645,_0xfed7a9,_0x4d96d5[_0xfaf6('0x62')],_0x4d96d5[_0xfaf6('0x63')],_0x1908a0);})[_0xfaf6('0x28')](function(_0x5ead3e){_0x302d38=_0x5ead3e;return getTicket(_0x4f8645,_0x55911a,_0x302d38,_0xfed7a9,_0x4d96d5,_0xfed7a9['Fields'],_0x1908a0);})['then'](function(_0x14bdc5){_0x147f2d=_0x14bdc5;logger[_0xfaf6('0x1f')]('['+_0x4d96d5[_0xfaf6('0x7b')][_0xfaf6('0x7a')]()+_0xfaf6('0x7c'),_0x147f2d['id']);logger['info']('['+_0x4d96d5[_0xfaf6('0x7b')]['toUpperCase']()+']\x20Integration\x20account\x20type\x20%s.',_0x4f8645[_0xfaf6('0x3c')]);})[_0xfaf6('0x6d')](function(_0x57bb15){logger['error']('['+_0x4d96d5[_0xfaf6('0x7b')][_0xfaf6('0x7a')]()+']',_0x57bb15);});}; \ No newline at end of file +var _0xc344=['serverUrl','stripTrailingSlash','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','defaults','redis','localhost','emit','getString','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','lead','WhoId','WhatId','Case','ContactId','account','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','execute','then','length','Email','Agent\x20%s\x20found.','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','cloneDeep','additionalSearchContact','Contact','additionalSearchLead','merge','$or','Lead','account_contact_lead','additionalSearchAccount','Account','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','contact','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','format','Caller\x20-\x20%s','LastName','No\x20Company','Name','upperFirst','forEach','includes','string','picklist','idField','variableName','Variable','name','password','concat','Connection','https://login.salesforce.com','clientSecret','login','username','Connection\x20established.','queue'];(function(_0x22a8af,_0xc984c2){var _0xc8c581=function(_0x2f5a4d){while(--_0x2f5a4d){_0x22a8af['push'](_0x22a8af['shift']());}};_0xc8c581(++_0xc984c2);}(_0xc344,0xa2));var _0x4c34=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xc344[_0x2ec461];return _0x28603d;};'use strict';var _=require(_0x4c34('0x0'));var rp=require(_0x4c34('0x1'));var moment=require(_0x4c34('0x2'));var BPromise=require(_0x4c34('0x3'));var md5=require(_0x4c34('0x4'));var jsforce=require(_0x4c34('0x5'));var util=require(_0x4c34('0x6'));var Redis=require(_0x4c34('0x7'));var intUtil=require(_0x4c34('0x8'));var config=require(_0x4c34('0x9'));var logger=require(_0x4c34('0xa'))(_0x4c34('0xb'));config['redis']=_[_0x4c34('0xc')](config[_0x4c34('0xd')],{'host':_0x4c34('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4c34('0xd')]));function emit(_0x40ccd2,_0x590077,_0x312e29){io['to'](_0x40ccd2)[_0x4c34('0xf')](_0x590077,_0x312e29);}function getTicket(_0x3044c6,_0x3e9a64,_0x40bbea,_0x5bca41,_0x53ef72,_0x2ea281,_0x3d9f38,_0x1a098a){var _0x3c9361=Object['assign']({},{'OwnerId':_0x3e9a64['id'],'Subject':intUtil['getString'](_0x5bca41['Subjects'],_0x53ef72,'\x20'),'Description':intUtil[_0x4c34('0x10')](_0x5bca41[_0x4c34('0x11')],_0x53ef72,'\x0a')},getCustomFields(_0x2ea281,_0x53ef72));if(_0x40bbea){if(_0x5bca41[_0x4c34('0x12')]===_0x4c34('0x13')){_0x3c9361[_0x4c34('0x14')]=moment[_0x4c34('0x15')]();_0x3c9361[_0x4c34('0x16')]=![];_0x3c9361[_0x4c34('0x17')]=![];if(_0x40bbea[_0x4c34('0x18')]==='contact'||_0x40bbea[_0x4c34('0x18')]===_0x4c34('0x19')){_0x3c9361[_0x4c34('0x1a')]=_0x40bbea['id'];}else if(_0x40bbea[_0x4c34('0x18')]==='account'){_0x3c9361[_0x4c34('0x1b')]=_0x40bbea['id'];}}else if(_0x5bca41[_0x4c34('0x12')]===_0x4c34('0x1c')){if(_0x40bbea[_0x4c34('0x18')]==='contact'){_0x3c9361[_0x4c34('0x1d')]=_0x40bbea['id'];}else if(_0x40bbea[_0x4c34('0x18')]===_0x4c34('0x1e')){_0x3c9361[_0x4c34('0x1f')]=_0x40bbea['id'];}else if(_0x40bbea[_0x4c34('0x18')]===_0x4c34('0x19')&&_0x5bca41[_0x4c34('0x20')]){_0x3c9361[_0x5bca41[_0x4c34('0x20')]]=_0x40bbea['id'];}else{logger[_0x4c34('0x21')](_0x4c34('0x22'));}}}return _0x3d9f38[_0x4c34('0x23')](_0x5bca41[_0x4c34('0x12')])[_0x4c34('0x24')](_0x3c9361);}function getUser(_0x185bb8,_0x46d15f,_0x485faf){if(!_[_0x4c34('0x25')](_0x46d15f)&&intUtil[_0x4c34('0x26')](_0x46d15f)){var _0x4856a2={'Email':_0x46d15f};var _0x8f5138={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x485faf[_0x4c34('0x23')](_0x4c34('0x27'))[_0x4c34('0x28')](_0x4856a2,_0x8f5138)[_0x4c34('0x29')]()[_0x4c34('0x2a')](function(_0x4ad6a7){if(_0x4ad6a7[_0x4c34('0x2b')]){var _0x2d2fe0=_[_0x4c34('0x28')](_0x4ad6a7,function(_0x28d5d9){return _0x28d5d9[_0x4c34('0x2c')]===_0x46d15f;});if(_0x2d2fe0){logger[_0x4c34('0x21')](_0x4c34('0x2d'),_0x46d15f);return BPromise[_0x4c34('0x2e')]({'id':_0x2d2fe0['Id'],'name':_0x2d2fe0['Name']});}}else{logger['info'](_0x4c34('0x2f'),_0x46d15f);return _0x485faf[_0x4c34('0x30')]()[_0x4c34('0x2a')](function(_0x51e7e7){return BPromise[_0x4c34('0x2e')]({'id':_0x51e7e7[_0x4c34('0x31')],'name':_0x51e7e7[_0x4c34('0x32')]});});}});}else{logger['info'](_0x4c34('0x2f'),_0x46d15f);return _0x485faf[_0x4c34('0x30')]()[_0x4c34('0x2a')](function(_0x3693c9){return BPromise[_0x4c34('0x2e')]({'id':_0x3693c9[_0x4c34('0x31')],'name':_0x3693c9['display_name']});});}}function getEndUser(_0x3dc441,_0x336a25,_0x67b102,_0x5d34a2,_0x569a4d){var _0x2663fa={'$or':{'Phone':_0x5d34a2}};var _0x1f2ccc={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x4c34('0x2e')]()[_0x4c34('0x2a')](function(){logger[_0x4c34('0x21')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x5d34a2,_0x336a25['moduleSearch']);switch(_0x336a25['moduleSearch']){case'contact_lead':var _0x530485=_[_0x4c34('0x33')](_0x2663fa);if(_0x336a25[_0x4c34('0x34')]){var _0x585b95={};_0x585b95[_0x336a25['additionalSearchContact']]=_0x5d34a2;_['merge'](_0x530485['$or'],_0x585b95);}return _0x569a4d['sobject'](_0x4c34('0x35'))[_0x4c34('0x28')](_0x530485,_0x1f2ccc)[_0x4c34('0x29')]()[_0x4c34('0x2a')](function(_0x342666){if(_0x342666&&_0x342666['length']){return _0x342666;}else{var _0x1d7a21=_[_0x4c34('0x33')](_0x2663fa);if(_0x336a25[_0x4c34('0x36')]){var _0x18b73d={};_0x18b73d[_0x336a25[_0x4c34('0x36')]]=_0x5d34a2;_[_0x4c34('0x37')](_0x1d7a21[_0x4c34('0x38')],_0x18b73d);}return _0x569a4d[_0x4c34('0x23')](_0x4c34('0x39'))[_0x4c34('0x28')](_0x1d7a21,_0x1f2ccc);}});case _0x4c34('0x3a'):var _0x203641=_['cloneDeep'](_0x2663fa);if(_0x336a25[_0x4c34('0x3b')]){var _0x585b95={};_0x585b95[_0x336a25[_0x4c34('0x3b')]]=_0x5d34a2;_[_0x4c34('0x37')](_0x203641[_0x4c34('0x38')],_0x585b95);}return _0x569a4d['sobject']('Account')['find'](_0x203641,_0x1f2ccc)['execute']()[_0x4c34('0x2a')](function(_0x3cebda){if(_0x3cebda&&_0x3cebda[_0x4c34('0x2b')]){return _0x3cebda;}else{var _0x4f7a5d=_[_0x4c34('0x33')](_0x2663fa);if(_0x336a25[_0x4c34('0x34')]){var _0x4af4db={};_0x4af4db[_0x336a25[_0x4c34('0x34')]]=_0x5d34a2;_[_0x4c34('0x37')](_0x4f7a5d[_0x4c34('0x38')],_0x4af4db);}return _0x569a4d[_0x4c34('0x23')](_0x4c34('0x35'))['find'](_0x4f7a5d,_0x1f2ccc)[_0x4c34('0x2a')](function(_0x267882){if(_0x267882&&_0x267882[_0x4c34('0x2b')]){return _0x267882;}else{var _0x1b7719=_[_0x4c34('0x33')](_0x2663fa);if(_0x336a25[_0x4c34('0x36')]){var _0x50a394={};_0x50a394[_0x336a25[_0x4c34('0x36')]]=_0x5d34a2;_[_0x4c34('0x37')](_0x1b7719[_0x4c34('0x38')],_0x50a394);}return _0x569a4d[_0x4c34('0x23')]('Lead')[_0x4c34('0x28')](_0x1b7719,_0x1f2ccc);}});}});case'contact':var _0x530485=_[_0x4c34('0x33')](_0x2663fa);if(_0x336a25[_0x4c34('0x34')]){var _0x585b95={};_0x585b95[_0x336a25[_0x4c34('0x34')]]=_0x5d34a2;_[_0x4c34('0x37')](_0x530485[_0x4c34('0x38')],_0x585b95);}return _0x569a4d[_0x4c34('0x23')](_0x4c34('0x35'))[_0x4c34('0x28')](_0x530485,_0x1f2ccc)[_0x4c34('0x29')]();case _0x4c34('0x19'):var _0x558996=_[_0x4c34('0x33')](_0x2663fa);if(_0x336a25[_0x4c34('0x36')]){var _0x585b95={};_0x585b95[_0x336a25[_0x4c34('0x36')]]=_0x5d34a2;_[_0x4c34('0x37')](_0x558996[_0x4c34('0x38')],_0x585b95);}return _0x569a4d['sobject'](_0x4c34('0x39'))[_0x4c34('0x28')](_0x558996,_0x1f2ccc);case'account':var _0x203641=_[_0x4c34('0x33')](_0x2663fa);if(_0x336a25[_0x4c34('0x3b')]){var _0x585b95={};_0x585b95[_0x336a25[_0x4c34('0x3b')]]=_0x5d34a2;_[_0x4c34('0x37')](_0x203641[_0x4c34('0x38')],_0x585b95);}return _0x569a4d[_0x4c34('0x23')](_0x4c34('0x3c'))[_0x4c34('0x28')](_0x203641,_0x1f2ccc);default:return null;}})['then'](function(_0x3d168e){if(_0x3d168e&&_0x3d168e[_0x4c34('0x2b')]){var _0x227076=_[_0x4c34('0x3d')](_0x3d168e);if(_0x227076){return BPromise[_0x4c34('0x2e')]({'id':_0x227076['Id'],'name':_0x227076['Name'],'phone':_0x227076[_0x4c34('0x3e')],'endUserType':_0x227076[_0x4c34('0x3f')][_0x4c34('0x40')][_0x4c34('0x41')]()});}}})[_0x4c34('0x2a')](function(_0x23a2e7){if(_0x23a2e7){logger['info'](_0x4c34('0x42'),_0x23a2e7['endUserType'],_0x5d34a2);return BPromise[_0x4c34('0x2e')](_0x23a2e7);}else{logger[_0x4c34('0x21')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x5d34a2);var _0x39449b={'Phone':_0x5d34a2};if(_0x336a25[_0x4c34('0x43')]){if(_0x336a25[_0x4c34('0x43')]===_0x4c34('0x44')){logger[_0x4c34('0x21')](_0x4c34('0x45'),_0x5d34a2,_0x336a25[_0x4c34('0x43')]);_0x39449b['LastName']=_0x67b102!==_0x4c34('0x46')?_0x67b102:util[_0x4c34('0x47')](_0x4c34('0x48'),_0x5d34a2);}else if(_0x336a25[_0x4c34('0x43')]===_0x4c34('0x19')){logger['info'](_0x4c34('0x45'),_0x5d34a2,_0x336a25['moduleCreate']);_0x39449b[_0x4c34('0x49')]=_0x67b102!==_0x4c34('0x46')?_0x67b102:util[_0x4c34('0x47')](_0x4c34('0x48'),_0x5d34a2);_0x39449b['Company']=_0x4c34('0x4a');}else if(_0x336a25[_0x4c34('0x43')]===_0x4c34('0x1e')){logger[_0x4c34('0x21')](_0x4c34('0x45'),_0x5d34a2,_0x336a25[_0x4c34('0x43')]);_0x39449b[_0x4c34('0x4b')]=_0x67b102!==_0x4c34('0x46')?_0x67b102:util[_0x4c34('0x47')](_0x4c34('0x48'),_0x5d34a2);}else{return null;}}return _0x569a4d[_0x4c34('0x23')](_[_0x4c34('0x4c')](_0x336a25['moduleCreate']))[_0x4c34('0x24')](_0x39449b)[_0x4c34('0x2a')](function(_0x2919cb){return BPromise[_0x4c34('0x2e')]({'id':_0x2919cb['id'],'endUserType':_0x336a25['moduleCreate']});});}});}function getCustomFields(_0x520a00,_0x4f3ad6){var _0x2dd16e={};if(_0x520a00['length']>0x0){_[_0x4c34('0x4d')](_0x520a00,function(_0x5cf3a9){if(_[_0x4c34('0x4e')]([_0x4c34('0x4f'),_0x4c34('0x50')],_0x5cf3a9[_0x4c34('0x40')])&&_0x5cf3a9[_0x4c34('0x51')]){_0x2dd16e[_0x5cf3a9[_0x4c34('0x51')]]=_0x5cf3a9['content']['toString']();}else if(_0x5cf3a9[_0x4c34('0x40')]==='variable'&&_0x5cf3a9[_0x4c34('0x52')]&&_0x5cf3a9['idField']){_0x4f3ad6[_0x5cf3a9[_0x4c34('0x52')]]&&(_0x2dd16e[_0x5cf3a9[_0x4c34('0x51')]]=_0x4f3ad6[_0x5cf3a9[_0x4c34('0x52')]]['toString']());}else if(_0x5cf3a9[_0x4c34('0x40')]==='customVariable'&&_0x5cf3a9[_0x4c34('0x53')]&&_0x5cf3a9['Variable'][_0x4c34('0x54')]&&_0x5cf3a9['idField']){_0x4f3ad6[_0x5cf3a9[_0x4c34('0x53')][_0x4c34('0x54')][_0x4c34('0x41')]()]&&(_0x2dd16e[_0x5cf3a9[_0x4c34('0x51')]]=_0x4f3ad6[_0x5cf3a9[_0x4c34('0x53')]['name'][_0x4c34('0x41')]()]['toString']());}});}return _0x2dd16e;}function getConnection(_0x765b11){var _0x211340=_0x765b11[_0x4c34('0x55')][_0x4c34('0x56')](_0x765b11['securityToken']);var _0x16d5c9=new jsforce[(_0x4c34('0x57'))]({'oauth2':{'loginUrl':_0x765b11['remoteUri']||_0x4c34('0x58'),'clientId':_0x765b11['clientId'],'clientSecret':_0x765b11[_0x4c34('0x59')]}});return _0x16d5c9[_0x4c34('0x5a')](_0x765b11[_0x4c34('0x5b')],_0x211340)[_0x4c34('0x2a')](function(){logger[_0x4c34('0x21')](_0x4c34('0x5c'));return _0x16d5c9;});}exports[_0x4c34('0x5d')]=function(_0x52f18f,_0x9a33a3,_0x1a51d9,_0x23e593,_0x39413b,_0x54c49a){var _0x46f12a,_0x40ddd3,_0x45fd7f,_0x9919d4;_0x54c49a[_0x4c34('0x5e')]=intUtil[_0x4c34('0x5f')](_0x54c49a[_0x4c34('0x5e')]);_0x54c49a[_0x4c34('0x60')]=intUtil[_0x4c34('0x5f')](_0x54c49a[_0x4c34('0x60')]);if(_0x39413b&&_0x39413b[_0x4c34('0x61')]){logger[_0x4c34('0x21')](_0x4c34('0x62'),_0x4c34('0x63'));_0x9a33a3[_0x4c34('0x64')]=util[_0x4c34('0x47')](_0x4c34('0x65'),_0x54c49a['serverUrl'],_0x9a33a3[_0x4c34('0x66')],md5(_0x9a33a3['uniqueid']));}else{_0x9a33a3[_0x4c34('0x64')]='';}return getConnection(_0x54c49a)[_0x4c34('0x2a')](function(_0xc3e9fb){_0x9919d4=_0xc3e9fb;return getUser(_0x54c49a,_0x23e593[_0x4c34('0x67')],_0x9919d4);})[_0x4c34('0x2a')](function(_0x2cb8df){_0x46f12a=_0x2cb8df;return getEndUser(_0x54c49a,_0x1a51d9,_0x9a33a3[_0x4c34('0x68')],_0x9a33a3[_0x4c34('0x69')],_0x9919d4);})[_0x4c34('0x2a')](function(_0x2536bc){_0x40ddd3=_0x2536bc;return getTicket(_0x54c49a,_0x46f12a,_0x40ddd3,_0x1a51d9,_0x9a33a3,_0x1a51d9['Fields'],_0x9919d4,_0x4c34('0x5d'));})['then'](function(_0x445c8a){_0x45fd7f=_0x445c8a;logger[_0x4c34('0x21')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x45fd7f['id']);logger[_0x4c34('0x21')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x45fd7f['id'],_0x23e593[_0x4c34('0x54')],_0x54c49a[_0x4c34('0x40')]);switch(_0x54c49a[_0x4c34('0x40')]){case _0x4c34('0x6a'):emit(util[_0x4c34('0x47')](_0x4c34('0x6b'),_0x23e593[_0x4c34('0x54')]),_0x4c34('0x6c'),{'recordId':_0x45fd7f['id']});break;case _0x4c34('0x6d'):emit(util[_0x4c34('0x47')]('user:%s',_0x23e593[_0x4c34('0x54')]),_0x4c34('0x6e'),{'uri':util[_0x4c34('0x47')](_0x4c34('0x6f'),_0x9919d4[_0x4c34('0x70')],_0x45fd7f['id'])});break;default:logger[_0x4c34('0x71')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x4c34('0x72')](function(_0x459800){logger[_0x4c34('0x71')](_0x4c34('0x62'),_0x459800);});};exports[_0x4c34('0x73')]=function(_0x44ecd2,_0x30f68f,_0x22b60e,_0x3225a9,_0x223ccc,_0x2d6355,_0x385100){var _0x162105,_0x34e61d,_0x3ebd63,_0x3228b8;_0x2d6355['serverUrl']=intUtil['stripTrailingSlash'](_0x2d6355[_0x4c34('0x5e')]);_0x2d6355[_0x4c34('0x60')]=intUtil[_0x4c34('0x5f')](_0x2d6355['remoteUri']);if(_0x385100&&_0x385100[_0x4c34('0x74')]&&_0x385100['recordingFormat']!==_0x4c34('0x75')){logger[_0x4c34('0x21')](_0x4c34('0x76'),_0x4c34('0x63'));_0x30f68f[_0x4c34('0x64')]=util[_0x4c34('0x47')](_0x4c34('0x65'),_0x2d6355['serverUrl'],_0x30f68f['uniqueid'],md5(_0x30f68f[_0x4c34('0x66')]));}return getConnection(_0x2d6355)[_0x4c34('0x2a')](function(_0x2373c2){_0x3228b8=_0x2373c2;return getUser(_0x2d6355,_0x3225a9[_0x4c34('0x67')],_0x3228b8);})[_0x4c34('0x2a')](function(_0x6b3752){_0x162105=_0x6b3752;return getEndUser(_0x2d6355,_0x22b60e,_0x30f68f[_0x4c34('0x77')],_0x30f68f['destcalleridnum'],_0x3228b8);})[_0x4c34('0x2a')](function(_0x1b91cb){_0x34e61d=_0x1b91cb;return getTicket(_0x2d6355,_0x162105,_0x34e61d,_0x22b60e,_0x30f68f,_0x22b60e[_0x4c34('0x78')],_0x3228b8,_0x4c34('0x73'));})[_0x4c34('0x2a')](function(_0x5cf18e){_0x3ebd63=_0x5cf18e;logger[_0x4c34('0x21')](_0x4c34('0x79'),_0x3ebd63['id']);logger[_0x4c34('0x21')](_0x4c34('0x7a'),_0x3ebd63['id'],_0x3225a9['name'],_0x2d6355[_0x4c34('0x40')]);switch(_0x2d6355[_0x4c34('0x40')]){case'integrationTab':emit(util[_0x4c34('0x47')]('user:%s',_0x3225a9[_0x4c34('0x54')]),'trigger:salesforce:display',{'recordId':_0x3ebd63['id']});break;case'newTab':emit(util[_0x4c34('0x47')]('user:%s',_0x3225a9[_0x4c34('0x54')]),'trigger:browser:url',{'uri':util[_0x4c34('0x47')](_0x4c34('0x6f'),_0x3228b8[_0x4c34('0x70')],_0x3ebd63['id'])});break;default:logger[_0x4c34('0x71')]('[OUTBOUND]',_0x4c34('0x7b'));}})[_0x4c34('0x72')](function(_0xf15660){logger[_0x4c34('0x71')]('[OUTBOUND]',_0xf15660);});};exports['unmanaged']=function(_0x15d4c8,_0x40c4e3,_0x2cc4ff,_0x3037f7,_0x48c5a3,_0x363d17){var _0x10d478,_0xdd707d,_0x38c9fe,_0x42252e;_0x363d17['serverUrl']=intUtil[_0x4c34('0x5f')](_0x363d17[_0x4c34('0x5e')]);_0x363d17['remoteUri']=intUtil['stripTrailingSlash'](_0x363d17[_0x4c34('0x60')]);if(_0x48c5a3&&_0x48c5a3[_0x4c34('0x61')]){logger[_0x4c34('0x21')]('['+_0x40c4e3[_0x4c34('0x7c')][_0x4c34('0x7d')]()+']',_0x4c34('0x63'));_0x40c4e3['recordingURL']=util[_0x4c34('0x47')](_0x4c34('0x65'),_0x363d17[_0x4c34('0x5e')],_0x40c4e3[_0x4c34('0x66')],md5(_0x40c4e3['uniqueid']));}else{_0x40c4e3[_0x4c34('0x64')]='';}return getConnection(_0x363d17)[_0x4c34('0x2a')](function(_0xeebe79){_0x42252e=_0xeebe79;if(!_[_0x4c34('0x25')](_0x3037f7)){return getUser(_0x363d17,_0x3037f7['name'],_0x42252e);}else{return getUser(_0x363d17,null,_0x42252e);}})[_0x4c34('0x2a')](function(_0x44f081){_0x10d478=_0x44f081;return getEndUser(_0x363d17,_0x2cc4ff,_0x40c4e3[_0x4c34('0x68')],_0x40c4e3['calleridnum'],_0x42252e);})[_0x4c34('0x2a')](function(_0x1e0ae1){_0xdd707d=_0x1e0ae1;return getTicket(_0x363d17,_0x10d478,_0xdd707d,_0x2cc4ff,_0x40c4e3,_0x2cc4ff[_0x4c34('0x78')],_0x42252e);})[_0x4c34('0x2a')](function(_0x331036){_0x38c9fe=_0x331036;logger[_0x4c34('0x21')]('['+_0x40c4e3[_0x4c34('0x7c')]['toUpperCase']()+_0x4c34('0x7e'),_0x38c9fe['id']);logger[_0x4c34('0x21')]('['+_0x40c4e3[_0x4c34('0x7c')]['toUpperCase']()+_0x4c34('0x7f'),_0x363d17[_0x4c34('0x40')]);})['catch'](function(_0x4675ae){logger[_0x4c34('0x71')]('['+_0x40c4e3[_0x4c34('0x7c')]['toUpperCase']()+']',_0x4675ae);});}; \ 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 5ed2dda..a885687 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 _0xe7e5=['remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','outbound','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','GET','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','error','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','forEach','includes','string','picklist','nameField','customField','toLowerCase','content','toString','type','idField','variable','variableName','customVariable','Variable','name','POST','incident','assign','Subjects','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','number',']\x20getTicket\x20crm','label','label_entry','Incident','ticketId','Incident\x20-\x20','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','/nav_to.do?uri=incident.do?sys_id%3D','format','username','password','sysparm_limit=1','sysparm_display_value=true'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0xe7e5,0x15d));var _0x5e7e=function(_0x26b5aa,_0x2bbac5){_0x26b5aa=_0x26b5aa-0x0;var _0x3171f6=_0xe7e5[_0x26b5aa];return _0x3171f6;};'use strict';var _=require(_0x5e7e('0x0'));var Promise=require(_0x5e7e('0x1'));var rp=require(_0x5e7e('0x2'));var util=require(_0x5e7e('0x3'));var md5=require('md5');var Redis=require(_0x5e7e('0x4'));var intUtil=require(_0x5e7e('0x5'));var config=require(_0x5e7e('0x6'));var logger=require(_0x5e7e('0x7'))('servicenow');config[_0x5e7e('0x8')]=_['defaults'](config['redis'],{'host':_0x5e7e('0x9'),'port':0x18eb});var io=require(_0x5e7e('0xa'))(new Redis(config[_0x5e7e('0x8')]));function getAdminUser(_0x19815a,_0x4c4d53,_0x53133d,_0x3b816a,_0x2deae0,_0x44c809){return new Promise(function(_0x238d19,_0xeab710){var _0x1ea3f4={'method':'GET','uri':_0x3b816a+_0x5e7e('0xb')+'&'+_0x2deae0+'&'+_0x44c809,'auth':_0x4c4d53,'json':!![]};return rp(_0x1ea3f4)[_0x5e7e('0xc')](function(_0x504cb1){if(_0x504cb1[_0x5e7e('0xd')][_0x5e7e('0xe')]>0x0){_0x53133d[_0x5e7e('0xf')]=_0x504cb1[_0x5e7e('0xd')][0x0][_0x5e7e('0x10')];}logger[_0x5e7e('0x11')]('['+[_0x19815a[_0x5e7e('0x12')]()]+_0x5e7e('0x13'),_0x53133d);_0x238d19(_0x53133d);})[_0x5e7e('0x14')](function(_0x2aa917){logger['error']('['+[_0x19815a['toUpperCase']()]+']',_0x2aa917[_0x5e7e('0x15')]);_0xeab710(_0x2aa917[_0x5e7e('0x15')]);});});}function getUser(_0x3aa077,_0x584757,_0x589398,_0x5b49b9,_0x33d712){return function(_0x3a80e7){logger[_0x5e7e('0x11')]('['+[_0x3aa077['toUpperCase']()]+_0x5e7e('0x16'),_0x3a80e7);return new Promise(function(_0x2f0ba3,_0x306ade){if(intUtil[_0x5e7e('0x17')](_0x3a80e7[_0x5e7e('0x18')])){var _0x4e7885={'method':_0x5e7e('0x19'),'uri':_0x589398+'sys_user?sysparm_query=email%3D'+_0x3a80e7[_0x5e7e('0x18')]+'&'+_0x5b49b9+'&'+_0x33d712,'auth':_0x584757,'json':!![]};logger['info']('['+[_0x3aa077[_0x5e7e('0x12')]()]+_0x5e7e('0x1a'),_0x4e7885);return rp(_0x4e7885)[_0x5e7e('0xc')](function(_0x4d85f5){logger[_0x5e7e('0x11')]('['+[_0x3aa077['toUpperCase']()]+_0x5e7e('0x1b'),_0x4d85f5);if(_0x4d85f5[_0x5e7e('0xd')]['length']>0x0&&String(_0x4d85f5['result'][0x0][_0x5e7e('0x1c')])===_0x5e7e('0x1d')){_0x3a80e7[_0x5e7e('0x1e')]=_0x4d85f5[_0x5e7e('0xd')][0x0]['sys_id'];}else{_0x3a80e7[_0x5e7e('0x1e')]=_0x3a80e7[_0x5e7e('0xf')];_0x3a80e7[_0x5e7e('0x18')]=_0x3a80e7[_0x5e7e('0x1f')];}logger[_0x5e7e('0x11')]('['+[_0x3aa077['toUpperCase']()]+_0x5e7e('0x20'),_0x3a80e7);_0x2f0ba3(_0x3a80e7);})[_0x5e7e('0x14')](function(_0xcc9444){logger['error']('['+[_0x3aa077['toUpperCase']()]+']',_0xcc9444['message']);_0x306ade(_0xcc9444[_0x5e7e('0x15')]);});}else{logger[_0x5e7e('0x11')]('['+[_0x3aa077[_0x5e7e('0x12')]()]+_0x5e7e('0x21'));_0x3a80e7[_0x5e7e('0x1e')]=_0x3a80e7[_0x5e7e('0xf')];_0x3a80e7['userEmail']=_0x3a80e7[_0x5e7e('0x1f')];_0x2f0ba3(_0x3a80e7);}});};}function createEndUser(_0x325497,_0x50dd70,_0x34b85b,_0x222b3b,_0x41214f){logger[_0x5e7e('0x11')]('['+[_0x325497['toUpperCase']()]+_0x5e7e('0x22'),_0x34b85b);return new Promise(function(_0x4dac11,_0x12e00b){var _0x162b7d={'method':'POST','uri':_0x222b3b+'sys_user?'+_0x41214f,'body':{'user_name':_0x34b85b[_0x5e7e('0x23')],'roles':_0x5e7e('0x24'),'first_name':_0x34b85b['endUserNumber'],'active':_0x5e7e('0x1d'),'date_format':_0x5e7e('0x25'),'phone':_0x34b85b[_0x5e7e('0x23')]},'auth':_0x50dd70,'json':!![]};return rp(_0x162b7d)[_0x5e7e('0xc')](function(_0x1a52e9){logger['info']('['+[_0x325497[_0x5e7e('0x12')]()]+_0x5e7e('0x26'),_0x1a52e9[_0x5e7e('0xd')]);_0x34b85b[_0x5e7e('0x27')]=_0x1a52e9[_0x5e7e('0xd')][_0x5e7e('0x10')];_0x4dac11(_0x34b85b);})[_0x5e7e('0x14')](function(_0xb0e8d2){logger[_0x5e7e('0x28')]('['+[_0x325497[_0x5e7e('0x12')]()]+']',_0xb0e8d2[_0x5e7e('0x15')]);_0x12e00b(_0xb0e8d2[_0x5e7e('0x15')]);});});}function getEndUser(_0xb5f2d,_0x6887c4,_0x25cb58,_0x1903e9,_0x13d217){return function(_0x290626){logger[_0x5e7e('0x11')]('['+[_0xb5f2d[_0x5e7e('0x12')]()]+_0x5e7e('0x29'),_0x290626);return new Promise(function(_0x48008c,_0xb77567){var _0x31c207={'method':_0x5e7e('0x19'),'uri':_0x25cb58+'sys_user?sysparm_query=phone%3D'+_0x290626[_0x5e7e('0x23')]+'&'+_0x1903e9+'&'+_0x13d217,'auth':_0x6887c4,'json':!![]};return rp(_0x31c207)[_0x5e7e('0xc')](function(_0x3dcd45){if(_0x3dcd45['result'][_0x5e7e('0xe')]>0x0){_0x290626[_0x5e7e('0x27')]=_0x3dcd45[_0x5e7e('0xd')][0x0][_0x5e7e('0x10')];logger[_0x5e7e('0x11')]('['+[_0xb5f2d[_0x5e7e('0x12')]()]+_0x5e7e('0x2a'),_0x290626);_0x48008c(_0x290626);}else{return createEndUser(_0xb5f2d,_0x6887c4,_0x290626,_0x25cb58,_0x1903e9)[_0x5e7e('0xc')](function(_0x208c94){logger[_0x5e7e('0x11')]('['+[_0xb5f2d[_0x5e7e('0x12')]()]+'],\x20createEndUser\x20crm',_0x208c94);_0x48008c(_0x208c94);});}})[_0x5e7e('0x14')](function(_0x20dabe){logger['error']('['+[_0xb5f2d[_0x5e7e('0x12')]()]+']',_0x20dabe['message']);_0xb77567(_0x20dabe[_0x5e7e('0x15')]);});});};}function getCustomFields(_0x14e21b,_0x38474c){var _0x17ccd7={};if(_0x14e21b[_0x5e7e('0xe')]>0x0){_[_0x5e7e('0x2b')](_0x14e21b,function(_0x43f91d){if(_[_0x5e7e('0x2c')]([_0x5e7e('0x2d'),_0x5e7e('0x2e')],_0x43f91d['type'])&&_0x43f91d[_0x5e7e('0x2f')]&&!_0x43f91d[_0x5e7e('0x30')]){_0x17ccd7[_0x43f91d['nameField'][_0x5e7e('0x31')]()]=_0x43f91d[_0x5e7e('0x32')][_0x5e7e('0x33')]();}else if(_[_0x5e7e('0x2c')](['string',_0x5e7e('0x2e')],_0x43f91d[_0x5e7e('0x34')])&&_0x43f91d[_0x5e7e('0x35')]&&_0x43f91d[_0x5e7e('0x30')]){_0x17ccd7[_0x43f91d[_0x5e7e('0x35')][_0x5e7e('0x31')]()]=_0x43f91d['content'][_0x5e7e('0x33')]();}else if(_0x43f91d[_0x5e7e('0x34')]===_0x5e7e('0x36')&&_0x43f91d[_0x5e7e('0x37')]&&_0x43f91d[_0x5e7e('0x35')]&&_0x43f91d[_0x5e7e('0x30')]){_0x17ccd7[_0x43f91d['idField'][_0x5e7e('0x31')]()]=_0x38474c[_0x43f91d['variableName']][_0x5e7e('0x33')]();}else if(_0x43f91d['type']===_0x5e7e('0x38')&&_0x43f91d[_0x5e7e('0x39')]&&_0x43f91d[_0x5e7e('0x39')]['name']&&_0x43f91d[_0x5e7e('0x35')]&&_0x43f91d[_0x5e7e('0x30')]){_0x17ccd7[_0x43f91d[_0x5e7e('0x35')]['toLowerCase']()]=_0x38474c[_0x43f91d[_0x5e7e('0x39')][_0x5e7e('0x3a')][_0x5e7e('0x31')]()][_0x5e7e('0x33')]();}});}return _0x17ccd7;}function getTicket(_0x3a50b0,_0x4fe661,_0x2bcaa1,_0x1d9ee6,_0x505d77,_0x16c0b8){return function(_0x5d6883){logger[_0x5e7e('0x11')]('['+[_0x3a50b0[_0x5e7e('0x12')]()]+']\x20getTicket\x20input\x20crm',_0x5d6883);return new Promise(function(_0x28502f,_0xe5bb46){var _0x314beb=_0x3a50b0['toLowerCase']()==='outbound'?_0x5d6883[_0x5e7e('0x1e')]:_0x5d6883[_0x5e7e('0x27')];var _0x55217c={'method':_0x5e7e('0x3b'),'uri':_0x2bcaa1+_0x5e7e('0x3c')+'?'+_0x16c0b8,'body':Object[_0x5e7e('0x3d')]({},{'active':_0x5e7e('0x1d'),'caller_id':_0x314beb,'assigned_to':_0x5d6883['userId'],'short_description':intUtil['getString'](_0x1d9ee6[_0x5e7e('0x3e')],_0x505d77,'\x20'),'description':intUtil[_0x5e7e('0x3f')](_0x1d9ee6[_0x5e7e('0x40')],_0x505d77,'\x0a')},getCustomFields(_0x1d9ee6[_0x5e7e('0x41')],_0x505d77)),'auth':_0x4fe661,'json':!![]};return rp(_0x55217c)[_0x5e7e('0xc')](function(_0x3f78c3){logger[_0x5e7e('0x11')]('['+[_0x3a50b0[_0x5e7e('0x12')]()]+_0x5e7e('0x42'),_0x3f78c3['result']);_0x5d6883['ticketId']=_0x3f78c3[_0x5e7e('0xd')][_0x5e7e('0x10')];_0x5d6883[_0x5e7e('0x43')]=_0x3f78c3[_0x5e7e('0xd')][_0x5e7e('0x44')];logger['info']('['+[_0x3a50b0[_0x5e7e('0x12')]()]+_0x5e7e('0x45'),_0x5d6883);_0x28502f(_0x5d6883);})[_0x5e7e('0x14')](function(_0x3de8a7){logger[_0x5e7e('0x28')]('['+[_0x3a50b0[_0x5e7e('0x12')]()]+']',_0x3de8a7[_0x5e7e('0x15')]);_0xe5bb46(_0x3de8a7[_0x5e7e('0x15')]);});});};}function createRemoteTag(_0x46e507,_0x41f7d0,_0x323403,_0x23dd13){return new Promise(function(_0x5a4e80,_0x437ef0){var _0x35106d={'method':_0x5e7e('0x3b'),'uri':_0x323403+_0x5e7e('0x46')+'?'+_0x23dd13,'body':{'short_description':_0x46e507,'global':!![],'active':!![],'name':_0x46e507},'auth':_0x41f7d0,'json':!![]};return rp(_0x35106d)[_0x5e7e('0xc')](function(_0x3ebdbe){var _0x49de2c=_0x3ebdbe[_0x5e7e('0xd')][_0x5e7e('0x10')];_0x5a4e80(_0x49de2c);});});}function getRemoteTag(_0x92be30,_0x1b18e1,_0x3e4ac5,_0x94ec7f,_0x83fd82){return new Promise(function(_0x468386,_0x237b99){var _0x2be03f={'method':_0x5e7e('0x19'),'uri':_0x3e4ac5+_0x5e7e('0x46')+'?sysparm_query=name%3D'+_0x92be30+'&'+_0x94ec7f,'auth':_0x1b18e1,'json':!![]};return rp(_0x2be03f)[_0x5e7e('0xc')](function(_0x4b13ee){if(_0x4b13ee[_0x5e7e('0xd')][_0x5e7e('0xe')]>0x0){var _0x19f720=_0x4b13ee[_0x5e7e('0xd')][0x0][_0x5e7e('0x10')];_0x468386(_0x19f720);}else{return createRemoteTag(_0x92be30,_0x1b18e1,_0x3e4ac5,_0x94ec7f)[_0x5e7e('0xc')](function(_0x35bd58){_0x468386(_0x35bd58);});}});});}function assignTagToIncident(_0x359b6e,_0x3e714c,_0x580be2,_0x19ec97,_0x527daf){return new Promise(function(_0x4f008f,_0xa4e788){var _0x267209={'method':'POST','uri':_0x580be2+_0x5e7e('0x47')+'?'+_0x527daf,'body':{'label':_0x359b6e,'table':_0x5e7e('0x3c'),'id_type':_0x5e7e('0x48'),'table_key':_0x19ec97[_0x5e7e('0x49')],'title':_0x5e7e('0x4a')+_0x19ec97['ticketNumber'],'id_display':_0x19ec97['ticketNumber']},'auth':_0x3e714c,'json':!![]};return rp(_0x267209)[_0x5e7e('0xc')](function(_0xac5bbe){_0x4f008f();})[_0x5e7e('0x14')](function(){_0x4f008f();});});}function manageTags(_0xd1e425,_0x510aca,_0x2d943e,_0x6cdebe,_0x5a0c59,_0x1a0450,_0x357aa5){return new Promise(function(_0x21173a,_0x51536d){var _0x1e95eb=[];_0x510aca[_0x5e7e('0x2b')](function(_0x31263f){_0x1e95eb[_0x5e7e('0x4b')](getRemoteTag(_0x31263f,_0x2d943e,_0x6cdebe,_0x1a0450,_0x357aa5));});return Promise[_0x5e7e('0x4c')](_0x1e95eb)['then'](function(_0x3614f4){if(_0x3614f4[_0x5e7e('0xe')]){logger[_0x5e7e('0x11')]('['+[_0xd1e425[_0x5e7e('0x12')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x3614f4);var _0x441c3b=[];_0x3614f4[_0x5e7e('0x2b')](function(_0x424b51){_0x441c3b[_0x5e7e('0x4b')](assignTagToIncident(_0x424b51,_0x2d943e,_0x6cdebe,_0x5a0c59,_0x1a0450));});return Promise['all'](_0x441c3b)[_0x5e7e('0xc')](function(){_0x21173a();})[_0x5e7e('0x14')](function(){_0x21173a();});}else{_0x21173a();}});});}function getTags(_0x1b7ea4,_0x25b4ec,_0x580ea8,_0x2a04ca,_0x4a1a27,_0x420c34){return function(_0x2783d6){return new Promise(function(_0x5d58b9,_0x5eacf8){var _0x20465e=[];var _0x4b361a=_0x2a04ca[_0x5e7e('0x4d')];if(_0x4b361a&&_0x4b361a[_0x5e7e('0xe')]>0x0){_0x20465e=_[_0x5e7e('0x4e')](_0x4b361a,_0x5e7e('0x3a'));}if(_0x20465e[_0x5e7e('0xe')]>0x0){return manageTags(_0x1b7ea4,_0x20465e,_0x25b4ec,_0x580ea8,_0x2783d6,_0x4a1a27,_0x420c34)[_0x5e7e('0xc')](function(){_0x5d58b9(_0x2783d6);});}else{_0x5d58b9(_0x2783d6);}});};}function emit(_0x43dafe,_0x5ef53a,_0x2fccb6){var _0x215c33=_0x5e7e('0x4f')+_0x5e7e('0x50')+'%26sysparm_record_list%3Dactive%253Dtrue'+'%255EORDERBYDESCnumber';var _0x510846={'uri':_0x43dafe+_0x5e7e('0x51')+_0x2fccb6+_0x215c33};io['to'](util[_0x5e7e('0x52')]('user:%s',_0x5ef53a))['emit']('trigger:browser:url',_0x510846);}exports['cs']=function(_0x8724c,_0x53ddb9,_0x2a39d9,_0x4dcff5,_0x27d19a,_0xf959a1,_0x3f8ff9,_0x5bfac5){var _0x46f790={};var _0x5652c0={'user':_0xf959a1[_0x5e7e('0x53')],'pass':_0xf959a1[_0x5e7e('0x54')]};var _0x2b7918=_0x5e7e('0x55');var _0x11ebd4=_0x5e7e('0x56');_0xf959a1[_0x5e7e('0x57')]=intUtil[_0x5e7e('0x58')](_0xf959a1[_0x5e7e('0x57')]);_0xf959a1[_0x5e7e('0x59')]=intUtil[_0x5e7e('0x58')](_0xf959a1['serverUrl']);var _0x43c740=util['format'](_0x5e7e('0x5a'),_0xf959a1['remoteUri']);_0x46f790[_0x5e7e('0x18')]=!_['isNil'](_0x4dcff5)?_0x4dcff5[_0x5e7e('0x5b')]:null;_0x46f790[_0x5e7e('0x1f')]=_0xf959a1[_0x5e7e('0x5b')];_0x46f790[_0x5e7e('0x23')]=_0x5bfac5[_0x5e7e('0x31')]()==='outbound'?_0x53ddb9[_0x5e7e('0x5c')]:_0x53ddb9[_0x5e7e('0x5d')];_0x46f790[_0x5e7e('0x5e')]=_0x5bfac5===_0x5e7e('0x5f')||_0x5bfac5===_0x5e7e('0x60')?'queue':_0x5e7e('0x61');var _0x4b9711=util[_0x5e7e('0x52')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xf959a1['serverUrl'],_0x53ddb9[_0x5e7e('0x62')],md5(_0x53ddb9[_0x5e7e('0x62')]));if(_0x27d19a&&_0x27d19a[_0x5e7e('0x63')]){logger['info'](_0x5e7e('0x64'),_0x5e7e('0x65'));_0x53ddb9[_0x5e7e('0x66')]=_0x4b9711;}else if(_0x3f8ff9&&_0x3f8ff9['recordingFormat']&&_0x3f8ff9[_0x5e7e('0x67')]!==_0x5e7e('0x68')){logger[_0x5e7e('0x11')](_0x5e7e('0x69'),_0x5e7e('0x65'));_0x53ddb9['recordingURL']=_0x4b9711;}else{_0x53ddb9[_0x5e7e('0x66')]='';}return getAdminUser(_0x5bfac5,_0x5652c0,_0x46f790,_0x43c740,_0x11ebd4,_0x2b7918)[_0x5e7e('0xc')](getUser(_0x5bfac5,_0x5652c0,_0x43c740,_0x11ebd4,_0x2b7918))[_0x5e7e('0xc')](getEndUser(_0x5bfac5,_0x5652c0,_0x43c740,_0x11ebd4,_0x2b7918))[_0x5e7e('0xc')](getTicket(_0x5bfac5,_0x5652c0,_0x43c740,_0x2a39d9,_0x53ddb9,_0x11ebd4))[_0x5e7e('0xc')](function(_0xd42ee2){logger[_0x5e7e('0x11')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0xd42ee2[_0x5e7e('0x49')]));logger[_0x5e7e('0x11')](util[_0x5e7e('0x52')]('call\x20direction:\x20%s',_0x5bfac5));if(_0x5bfac5!==_0x5e7e('0x60')){logger['info']('['+[_0x5bfac5['toUpperCase']()]+']',_0x5e7e('0x6a'));emit(_0xf959a1['remoteUri'],_0x4dcff5[_0x5e7e('0x3a')],_0xd42ee2[_0x5e7e('0x49')]);}})['catch'](function(_0x553188){logger[_0x5e7e('0x28')]('['+[_0x5bfac5[_0x5e7e('0x12')]()]+_0x5e7e('0x6b'),util[_0x5e7e('0x6c')](_0x553188,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x1b5a=[']\x20getTicket\x20crm','?sysparm_query=name%3D','label_entry','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','%26sysparm_record_target%3Dincident','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','trigger:browser:url','username','password','sysparm_limit=1','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','adminEmail','outbound','destcalleridnum','calleridnum','queue','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','util','md5','ioredis','../../../../config/environment','servicenow','redis','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','result','length','adminId','info','toUpperCase','],\x20getAdminUser\x20crm','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','userId','],\x20getUser\x20crm','catch',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','user','endUserNumber','true','System','],\x20EndUser\x20schema','endUserId','sys_id','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','variableName','Variable','name',']\x20getTicket\x20input\x20crm','incident','assign','Subjects','getString','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number'];(function(_0x130c89,_0x4471cf){var _0xebb141=function(_0x1b9b27){while(--_0x1b9b27){_0x130c89['push'](_0x130c89['shift']());}};_0xebb141(++_0x4471cf);}(_0x1b5a,0xf3));var _0xa1b5=function(_0x4fac73,_0x308b24){_0x4fac73=_0x4fac73-0x0;var _0x227631=_0x1b5a[_0x4fac73];return _0x227631;};'use strict';var _=require('lodash');var Promise=require('bluebird');var rp=require('request-promise');var util=require(_0xa1b5('0x0'));var md5=require(_0xa1b5('0x1'));var Redis=require(_0xa1b5('0x2'));var intUtil=require('./util');var config=require(_0xa1b5('0x3'));var logger=require('../../../../config/logger')(_0xa1b5('0x4'));config[_0xa1b5('0x5')]=_['defaults'](config[_0xa1b5('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xa1b5('0x6'))(new Redis(config[_0xa1b5('0x5')]));function getAdminUser(_0xe76bd5,_0x506e97,_0x5c6486,_0x142331,_0x3c6760,_0x234295){return new Promise(function(_0x2a9105,_0x196858){var _0x55d1cc={'method':_0xa1b5('0x7'),'uri':_0x142331+_0xa1b5('0x8')+'&'+_0x3c6760+'&'+_0x234295,'auth':_0x506e97,'json':!![]};return rp(_0x55d1cc)['then'](function(_0x47b01f){if(_0x47b01f[_0xa1b5('0x9')][_0xa1b5('0xa')]>0x0){_0x5c6486[_0xa1b5('0xb')]=_0x47b01f[_0xa1b5('0x9')][0x0]['sys_id'];}logger[_0xa1b5('0xc')]('['+[_0xe76bd5[_0xa1b5('0xd')]()]+_0xa1b5('0xe'),_0x5c6486);_0x2a9105(_0x5c6486);})['catch'](function(_0x2bf066){logger[_0xa1b5('0xf')]('['+[_0xe76bd5[_0xa1b5('0xd')]()]+']',_0x2bf066[_0xa1b5('0x10')]);_0x196858(_0x2bf066[_0xa1b5('0x10')]);});});}function getUser(_0x18e086,_0x3c3efa,_0x263603,_0xfa93b9,_0x47f536){return function(_0x5acf6b){logger[_0xa1b5('0xc')]('['+[_0x18e086[_0xa1b5('0xd')]()]+_0xa1b5('0x11'),_0x5acf6b);return new Promise(function(_0x4eb174,_0x418b84){if(intUtil[_0xa1b5('0x12')](_0x5acf6b[_0xa1b5('0x13')])){var _0x1d756b={'method':_0xa1b5('0x7'),'uri':_0x263603+_0xa1b5('0x14')+_0x5acf6b[_0xa1b5('0x13')]+'&'+_0xfa93b9+'&'+_0x47f536,'auth':_0x3c3efa,'json':!![]};logger[_0xa1b5('0xc')]('['+[_0x18e086['toUpperCase']()]+_0xa1b5('0x15'),_0x1d756b);return rp(_0x1d756b)[_0xa1b5('0x16')](function(_0x243eaf){logger[_0xa1b5('0xc')]('['+[_0x18e086['toUpperCase']()]+_0xa1b5('0x17'),_0x243eaf);if(_0x243eaf[_0xa1b5('0x9')][_0xa1b5('0xa')]>0x0&&String(_0x243eaf[_0xa1b5('0x9')][0x0]['active'])==='true'){_0x5acf6b[_0xa1b5('0x18')]=_0x243eaf[_0xa1b5('0x9')][0x0]['sys_id'];}else{_0x5acf6b['userId']=_0x5acf6b[_0xa1b5('0xb')];_0x5acf6b[_0xa1b5('0x13')]=_0x5acf6b['adminEmail'];}logger[_0xa1b5('0xc')]('['+[_0x18e086[_0xa1b5('0xd')]()]+_0xa1b5('0x19'),_0x5acf6b);_0x4eb174(_0x5acf6b);})[_0xa1b5('0x1a')](function(_0x1290e1){logger[_0xa1b5('0xf')]('['+[_0x18e086[_0xa1b5('0xd')]()]+']',_0x1290e1[_0xa1b5('0x10')]);_0x418b84(_0x1290e1[_0xa1b5('0x10')]);});}else{logger[_0xa1b5('0xc')]('['+[_0x18e086[_0xa1b5('0xd')]()]+_0xa1b5('0x1b'));_0x5acf6b[_0xa1b5('0x18')]=_0x5acf6b['adminId'];_0x5acf6b[_0xa1b5('0x13')]=_0x5acf6b['adminEmail'];_0x4eb174(_0x5acf6b);}});};}function createEndUser(_0x3568f5,_0x686171,_0x2cc27b,_0x253d35,_0x3b6931){logger[_0xa1b5('0xc')]('['+[_0x3568f5['toUpperCase']()]+_0xa1b5('0x1c'),_0x2cc27b);return new Promise(function(_0x5f2164,_0x5000e9){var _0x57c4ee={'method':_0xa1b5('0x1d'),'uri':_0x253d35+'sys_user?'+_0x3b6931,'body':{'user_name':_0x2cc27b['endUserNumber'],'roles':_0xa1b5('0x1e'),'first_name':_0x2cc27b[_0xa1b5('0x1f')],'active':_0xa1b5('0x20'),'date_format':_0xa1b5('0x21'),'phone':_0x2cc27b[_0xa1b5('0x1f')]},'auth':_0x686171,'json':!![]};return rp(_0x57c4ee)[_0xa1b5('0x16')](function(_0x237837){logger[_0xa1b5('0xc')]('['+[_0x3568f5[_0xa1b5('0xd')]()]+_0xa1b5('0x22'),_0x237837[_0xa1b5('0x9')]);_0x2cc27b[_0xa1b5('0x23')]=_0x237837[_0xa1b5('0x9')][_0xa1b5('0x24')];_0x5f2164(_0x2cc27b);})[_0xa1b5('0x1a')](function(_0x1fd9ef){logger[_0xa1b5('0xf')]('['+[_0x3568f5[_0xa1b5('0xd')]()]+']',_0x1fd9ef['message']);_0x5000e9(_0x1fd9ef['message']);});});}function getEndUser(_0x42220e,_0x1334f5,_0x27c764,_0x42c190,_0x506f6a){return function(_0x123c67){logger['info']('['+[_0x42220e[_0xa1b5('0xd')]()]+_0xa1b5('0x25'),_0x123c67);return new Promise(function(_0xe1f3cd,_0x508e55){var _0x43f2f3={'method':'GET','uri':_0x27c764+_0xa1b5('0x26')+_0x123c67[_0xa1b5('0x1f')]+'&'+_0x42c190+'&'+_0x506f6a,'auth':_0x1334f5,'json':!![]};return rp(_0x43f2f3)[_0xa1b5('0x16')](function(_0x2ce1d8){if(_0x2ce1d8[_0xa1b5('0x9')][_0xa1b5('0xa')]>0x0){_0x123c67[_0xa1b5('0x23')]=_0x2ce1d8['result'][0x0][_0xa1b5('0x24')];logger[_0xa1b5('0xc')]('['+[_0x42220e[_0xa1b5('0xd')]()]+'],\x20getEndUser\x20crm',_0x123c67);_0xe1f3cd(_0x123c67);}else{return createEndUser(_0x42220e,_0x1334f5,_0x123c67,_0x27c764,_0x42c190)[_0xa1b5('0x16')](function(_0x5d0ca8){logger[_0xa1b5('0xc')]('['+[_0x42220e[_0xa1b5('0xd')]()]+'],\x20createEndUser\x20crm',_0x5d0ca8);_0xe1f3cd(_0x5d0ca8);});}})[_0xa1b5('0x1a')](function(_0x1dcae5){logger[_0xa1b5('0xf')]('['+[_0x42220e[_0xa1b5('0xd')]()]+']',_0x1dcae5['message']);_0x508e55(_0x1dcae5[_0xa1b5('0x10')]);});});};}function getCustomFields(_0x1ed3e9,_0x236097){var _0x24aff1={};if(_0x1ed3e9[_0xa1b5('0xa')]>0x0){_[_0xa1b5('0x27')](_0x1ed3e9,function(_0xa103d2){if(_[_0xa1b5('0x28')]([_0xa1b5('0x29'),_0xa1b5('0x2a')],_0xa103d2[_0xa1b5('0x2b')])&&_0xa103d2[_0xa1b5('0x2c')]&&!_0xa103d2[_0xa1b5('0x2d')]){_0x24aff1[_0xa103d2[_0xa1b5('0x2c')][_0xa1b5('0x2e')]()]=_0xa103d2[_0xa1b5('0x2f')][_0xa1b5('0x30')]();}else if(_[_0xa1b5('0x28')](['string',_0xa1b5('0x2a')],_0xa103d2[_0xa1b5('0x2b')])&&_0xa103d2[_0xa1b5('0x31')]&&_0xa103d2[_0xa1b5('0x2d')]){_0x24aff1[_0xa103d2[_0xa1b5('0x31')][_0xa1b5('0x2e')]()]=_0xa103d2[_0xa1b5('0x2f')][_0xa1b5('0x30')]();}else if(_0xa103d2[_0xa1b5('0x2b')]==='variable'&&_0xa103d2[_0xa1b5('0x32')]&&_0xa103d2[_0xa1b5('0x31')]&&_0xa103d2[_0xa1b5('0x2d')]){_0x24aff1[_0xa103d2[_0xa1b5('0x31')][_0xa1b5('0x2e')]()]=_0x236097[_0xa103d2[_0xa1b5('0x32')]][_0xa1b5('0x30')]();}else if(_0xa103d2[_0xa1b5('0x2b')]==='customVariable'&&_0xa103d2[_0xa1b5('0x33')]&&_0xa103d2[_0xa1b5('0x33')][_0xa1b5('0x34')]&&_0xa103d2[_0xa1b5('0x31')]&&_0xa103d2[_0xa1b5('0x2d')]){_0x24aff1[_0xa103d2[_0xa1b5('0x31')][_0xa1b5('0x2e')]()]=_0x236097[_0xa103d2[_0xa1b5('0x33')][_0xa1b5('0x34')][_0xa1b5('0x2e')]()][_0xa1b5('0x30')]();}});}return _0x24aff1;}function getTicket(_0x615076,_0x1fd18d,_0x6119a9,_0x134399,_0x304810,_0x2d8894){return function(_0x924225){logger[_0xa1b5('0xc')]('['+[_0x615076['toUpperCase']()]+_0xa1b5('0x35'),_0x924225);return new Promise(function(_0x539f5b,_0x1a81ca){var _0x277d95=_0x615076[_0xa1b5('0x2e')]()==='outbound'?_0x924225['userId']:_0x924225[_0xa1b5('0x23')];var _0x285940={'method':_0xa1b5('0x1d'),'uri':_0x6119a9+_0xa1b5('0x36')+'?'+_0x2d8894,'body':Object[_0xa1b5('0x37')]({},{'active':_0xa1b5('0x20'),'caller_id':_0x277d95,'assigned_to':_0x924225['userId'],'short_description':intUtil['getString'](_0x134399[_0xa1b5('0x38')],_0x304810,'\x20'),'description':intUtil[_0xa1b5('0x39')](_0x134399['Descriptions'],_0x304810,'\x0a')},getCustomFields(_0x134399[_0xa1b5('0x3a')],_0x304810)),'auth':_0x1fd18d,'json':!![]};return rp(_0x285940)[_0xa1b5('0x16')](function(_0x12c6f8){logger[_0xa1b5('0xc')]('['+[_0x615076[_0xa1b5('0xd')]()]+_0xa1b5('0x3b'),_0x12c6f8['result']);_0x924225[_0xa1b5('0x3c')]=_0x12c6f8[_0xa1b5('0x9')][_0xa1b5('0x24')];_0x924225[_0xa1b5('0x3d')]=_0x12c6f8[_0xa1b5('0x9')][_0xa1b5('0x3e')];logger['info']('['+[_0x615076[_0xa1b5('0xd')]()]+_0xa1b5('0x3f'),_0x924225);_0x539f5b(_0x924225);})[_0xa1b5('0x1a')](function(_0x44515c){logger[_0xa1b5('0xf')]('['+[_0x615076[_0xa1b5('0xd')]()]+']',_0x44515c[_0xa1b5('0x10')]);_0x1a81ca(_0x44515c['message']);});});};}function createRemoteTag(_0x41a0bb,_0x15fd12,_0xe3cdb7,_0x158e2d){return new Promise(function(_0x377f4d,_0x2b9229){var _0x191fe8={'method':_0xa1b5('0x1d'),'uri':_0xe3cdb7+'label'+'?'+_0x158e2d,'body':{'short_description':_0x41a0bb,'global':!![],'active':!![],'name':_0x41a0bb},'auth':_0x15fd12,'json':!![]};return rp(_0x191fe8)[_0xa1b5('0x16')](function(_0x541a51){var _0x16e5d2=_0x541a51[_0xa1b5('0x9')][_0xa1b5('0x24')];_0x377f4d(_0x16e5d2);});});}function getRemoteTag(_0xc5d6fc,_0x9a06b4,_0x7b6698,_0x3c4912,_0x29b76e){return new Promise(function(_0x51b805,_0x186f40){var _0x17336f={'method':_0xa1b5('0x7'),'uri':_0x7b6698+'label'+_0xa1b5('0x40')+_0xc5d6fc+'&'+_0x3c4912,'auth':_0x9a06b4,'json':!![]};return rp(_0x17336f)[_0xa1b5('0x16')](function(_0x4e65da){if(_0x4e65da[_0xa1b5('0x9')][_0xa1b5('0xa')]>0x0){var _0xd75ecf=_0x4e65da[_0xa1b5('0x9')][0x0]['sys_id'];_0x51b805(_0xd75ecf);}else{return createRemoteTag(_0xc5d6fc,_0x9a06b4,_0x7b6698,_0x3c4912)[_0xa1b5('0x16')](function(_0x46275f){_0x51b805(_0x46275f);});}});});}function assignTagToIncident(_0x19a38f,_0x35f2eb,_0x28906a,_0x40be73,_0x14bcf6){return new Promise(function(_0x308a30,_0x382910){var _0x2b2003={'method':'POST','uri':_0x28906a+_0xa1b5('0x41')+'?'+_0x14bcf6,'body':{'label':_0x19a38f,'table':_0xa1b5('0x36'),'id_type':'Incident','table_key':_0x40be73[_0xa1b5('0x3c')],'title':_0xa1b5('0x42')+_0x40be73['ticketNumber'],'id_display':_0x40be73[_0xa1b5('0x3d')]},'auth':_0x35f2eb,'json':!![]};return rp(_0x2b2003)[_0xa1b5('0x16')](function(_0x2d877d){_0x308a30();})[_0xa1b5('0x1a')](function(){_0x308a30();});});}function manageTags(_0x37531a,_0x374b8f,_0x55830d,_0x37e915,_0x15369d,_0x5bccf9,_0x3e6087){return new Promise(function(_0x15abff,_0xec4b89){var _0x5d56fb=[];_0x374b8f['forEach'](function(_0x623e5b){_0x5d56fb[_0xa1b5('0x43')](getRemoteTag(_0x623e5b,_0x55830d,_0x37e915,_0x5bccf9,_0x3e6087));});return Promise[_0xa1b5('0x44')](_0x5d56fb)[_0xa1b5('0x16')](function(_0x8f15ce){if(_0x8f15ce[_0xa1b5('0xa')]){logger['info']('['+[_0x37531a[_0xa1b5('0xd')]()]+_0xa1b5('0x45'),_0x8f15ce);var _0xc04e2=[];_0x8f15ce[_0xa1b5('0x27')](function(_0x58d30c){_0xc04e2[_0xa1b5('0x43')](assignTagToIncident(_0x58d30c,_0x55830d,_0x37e915,_0x15369d,_0x5bccf9));});return Promise['all'](_0xc04e2)[_0xa1b5('0x16')](function(){_0x15abff();})[_0xa1b5('0x1a')](function(){_0x15abff();});}else{_0x15abff();}});});}function getTags(_0x283a4a,_0x1bce3a,_0x21ffa9,_0xda66ba,_0x935998,_0x2cdeb4){return function(_0x2e618a){return new Promise(function(_0x281dd0,_0x570dd0){var _0xeeba13=[];var _0x229613=_0xda66ba[_0xa1b5('0x46')];if(_0x229613&&_0x229613[_0xa1b5('0xa')]>0x0){_0xeeba13=_['map'](_0x229613,_0xa1b5('0x34'));}if(_0xeeba13[_0xa1b5('0xa')]>0x0){return manageTags(_0x283a4a,_0xeeba13,_0x1bce3a,_0x21ffa9,_0x2e618a,_0x935998,_0x2cdeb4)[_0xa1b5('0x16')](function(){_0x281dd0(_0x2e618a);});}else{_0x281dd0(_0x2e618a);}});};}function emit(_0x5056eb,_0x5413a4,_0x123329){var _0x1e5fdc=_0xa1b5('0x47')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+'%26sysparm_record_list%3Dactive%253Dtrue'+_0xa1b5('0x48');var _0x220619={'uri':_0x5056eb+_0xa1b5('0x49')+_0x123329+_0x1e5fdc};io['to'](util[_0xa1b5('0x4a')](_0xa1b5('0x4b'),_0x5413a4))['emit'](_0xa1b5('0x4c'),_0x220619);}exports['cs']=function(_0x50bee5,_0x253405,_0x599f49,_0x4d029c,_0x541daa,_0x55f614,_0x32d148,_0x6211f5){var _0x18a100={};var _0xaae80b={'user':_0x55f614[_0xa1b5('0x4d')],'pass':_0x55f614[_0xa1b5('0x4e')]};var _0x36fd63=_0xa1b5('0x4f');var _0x5f0d15='sysparm_display_value=true';_0x55f614[_0xa1b5('0x50')]=intUtil[_0xa1b5('0x51')](_0x55f614['remoteUri']);_0x55f614[_0xa1b5('0x52')]=intUtil['stripTrailingSlash'](_0x55f614[_0xa1b5('0x52')]);var _0xfb1f8f=util[_0xa1b5('0x4a')](_0xa1b5('0x53'),_0x55f614[_0xa1b5('0x50')]);_0x18a100[_0xa1b5('0x13')]=!_[_0xa1b5('0x54')](_0x4d029c)?_0x4d029c['email']:null;_0x18a100[_0xa1b5('0x55')]=_0x55f614['email'];_0x18a100[_0xa1b5('0x1f')]=_0x6211f5['toLowerCase']()===_0xa1b5('0x56')?_0x253405[_0xa1b5('0x57')]:_0x253405[_0xa1b5('0x58')];_0x18a100['callDirection']=_0x6211f5==='queue'||_0x6211f5==='unmanaged'?_0xa1b5('0x59'):_0xa1b5('0x56');var _0x47a61e=util[_0xa1b5('0x4a')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x55f614[_0xa1b5('0x52')],_0x253405['uniqueid'],md5(_0x253405[_0xa1b5('0x5a')]));if(_0x541daa&&_0x541daa[_0xa1b5('0x5b')]){logger[_0xa1b5('0xc')](_0xa1b5('0x5c'),'Recording\x20is\x20enabled!');_0x253405[_0xa1b5('0x5d')]=_0x47a61e;}else if(_0x32d148&&_0x32d148[_0xa1b5('0x5e')]&&_0x32d148[_0xa1b5('0x5e')]!=='none'){logger[_0xa1b5('0xc')](_0xa1b5('0x5f'),_0xa1b5('0x60'));_0x253405[_0xa1b5('0x5d')]=_0x47a61e;}else{_0x253405[_0xa1b5('0x5d')]='';}return getAdminUser(_0x6211f5,_0xaae80b,_0x18a100,_0xfb1f8f,_0x5f0d15,_0x36fd63)['then'](getUser(_0x6211f5,_0xaae80b,_0xfb1f8f,_0x5f0d15,_0x36fd63))[_0xa1b5('0x16')](getEndUser(_0x6211f5,_0xaae80b,_0xfb1f8f,_0x5f0d15,_0x36fd63))[_0xa1b5('0x16')](getTicket(_0x6211f5,_0xaae80b,_0xfb1f8f,_0x599f49,_0x253405,_0x5f0d15))[_0xa1b5('0x16')](function(_0x4a7cf2){logger[_0xa1b5('0xc')](util[_0xa1b5('0x4a')](_0xa1b5('0x61'),_0x4a7cf2[_0xa1b5('0x3c')]));logger[_0xa1b5('0xc')](util['format'](_0xa1b5('0x62'),_0x6211f5));if(_0x6211f5!=='unmanaged'){logger['info']('['+[_0x6211f5[_0xa1b5('0xd')]()]+']',_0xa1b5('0x63'));emit(_0x55f614[_0xa1b5('0x50')],_0x4d029c[_0xa1b5('0x34')],_0x4a7cf2[_0xa1b5('0x3c')]);}})[_0xa1b5('0x1a')](function(_0x761784){logger[_0xa1b5('0xf')]('['+[_0x6211f5[_0xa1b5('0xd')]()]+_0xa1b5('0x64'),util[_0xa1b5('0x65')](_0x761784,{'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 fc84ddf..0f63694 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 _0x229a=['toLowerCase','content','idField','variable','custom_fields','customVariable','Variable','push','login','password','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','destcalleridname','destcalleridnum','Outbound','version','[OUTBOUND]','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','calleridname','lodash','request-promise','bluebird','ioredis','./util','../../../../config/environment','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','Subjects','assigned_user_id','created_by','description','getString','Descriptions','toISOString','slice','duration_hours','duration_minutes','parent_type','Contacts','direction','forEach','variableName','set_entry','JSON','Basic\x20%s','apiKey','toString','base64','get_server_info','stringify','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','value','Agent\x20found!','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','phone_home','length','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','type','string','nameField','customField'];(function(_0x31713a,_0x33d4a6){var _0x1f8505=function(_0x278445){while(--_0x278445){_0x31713a['push'](_0x31713a['shift']());}};_0x1f8505(++_0x33d4a6);}(_0x229a,0x12d));var _0xa229=function(_0x2295a2,_0x1ad405){_0x2295a2=_0x2295a2-0x0;var _0x371f46=_0x229a[_0x2295a2];return _0x371f46;};'use strict';var _=require(_0xa229('0x0'));var rp=require(_0xa229('0x1'));var BPromise=require(_0xa229('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0xa229('0x3'));var intUtil=require(_0xa229('0x4'));var config=require(_0xa229('0x5'));var logger=require('../../../../config/logger')(_0xa229('0x6'));config[_0xa229('0x7')]=_[_0xa229('0x8')](config[_0xa229('0x7')],{'host':_0xa229('0x9'),'port':0x18eb});var io=require(_0xa229('0xa'))(new Redis(config[_0xa229('0x7')]));var def={'method':_0xa229('0xb'),'json':!![]};function emit(_0xc4ad54,_0x4fe06f,_0x4410e4){io['to'](_0xc4ad54)[_0xa229('0xc')](_0x4fe06f,_0x4410e4);}function getTicket(_0x42a7d0,_0x281ee3,_0x4a3f36,_0x3a70b9,_0x55e76c,_0x260973,_0x12132c,_0xffeedd){logger[_0xa229('0xd')](_0xa229('0xe'));var _0x32e5bf=new Date();var _0x37102a=[{'name':_0xa229('0xf'),'value':intUtil['getString'](_0x3a70b9[_0xa229('0x10')],_0x55e76c,'\x20')},{'name':_0xa229('0x11'),'value':_0x281ee3['id']},{'name':_0xa229('0x12'),'value':_0x281ee3['id']},{'name':_0xa229('0x13'),'value':intUtil[_0xa229('0x14')](_0x3a70b9[_0xa229('0x15')],_0x55e76c,'\x0a')},{'name':'date_start','value':_0x32e5bf[_0xa229('0x16')]()[_0xa229('0x17')](0x0,0x13)['replace']('T','\x20')},{'name':_0xa229('0x18'),'value':'0'},{'name':_0xa229('0x19'),'value':'15'},{'name':'parent_id','value':_0x4a3f36['id']},{'name':_0xa229('0x1a'),'value':_0xa229('0x1b')},{'name':'parent_name','value':_0x4a3f36[_0xa229('0xf')]},{'name':_0xa229('0x1c'),'value':_0xffeedd}];if(_0x260973['length']){_[_0xa229('0x1d')](_0x260973,function(_0x251c09){if(_0x55e76c[_0x251c09['variableName']]){_0x37102a['push']({'name':_0x251c09['idField'],'value':_0x55e76c[_0x251c09[_0xa229('0x1e')]]});}});}return request({'form':{'method':_0xa229('0x1f'),'input_type':_0xa229('0x20'),'response_type':_0xa229('0x20'),'rest_data':JSON['stringify']({'session':_0x12132c['id'],'module_name':'Calls','name_value_list':_0x37102a})}});}function getAuth(_0x10ccdc){return util['format'](_0xa229('0x21'),new Buffer(_0x10ccdc[_0xa229('0x22')]+':X')[_0xa229('0x23')](_0xa229('0x24')));}function getServerInfo(_0x4b17d3){return request({'form':{'method':_0xa229('0x25'),'input_type':_0xa229('0x20'),'response_type':'JSON','rest_data':JSON[_0xa229('0x26')]({'session':_0x4b17d3['id']})}});}function getUser(_0x9433f1,_0x10b46d,_0x2bb022){if(!_[_0xa229('0x27')](_0x10b46d)){logger[_0xa229('0xd')](_0xa229('0x28'),_0x10b46d);return request({'form':{'method':_0xa229('0x29'),'input_type':_0xa229('0x20'),'response_type':_0xa229('0x20'),'rest_data':JSON[_0xa229('0x26')]({'session':_0x2bb022['id'],'module_name':_0xa229('0x2a'),'query':util[_0xa229('0x2b')](_0xa229('0x2c'),_0x10b46d),'order_by':'','offset':'0','select_fields':['id',_0xa229('0xf'),_0xa229('0x2d')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xa229('0x2e')](function(_0x20282b){if(_0x20282b[_0xa229('0x2f')]['length']){var _0x247ade=_['find'](_0x20282b[_0xa229('0x2f')],function(_0x12a9b1){return _0x12a9b1['name_value_list']['user_name'][_0xa229('0x30')]===_0x10b46d;});if(_0x247ade){logger['info'](_0xa229('0x31'));return BPromise['resolve']({'id':_0x247ade[_0xa229('0x32')]['id']['value'],'name':_0x247ade['name_value_list'][_0xa229('0xf')][_0xa229('0x30')]});}}logger['info'](_0xa229('0x33'));return BPromise[_0xa229('0x34')]({'id':_0x2bb022[_0xa229('0x32')]['user_id'][_0xa229('0x30')],'name':_0x2bb022[_0xa229('0x32')]['user_name'][_0xa229('0x30')]});});}else{logger[_0xa229('0xd')](_0xa229('0x35'));return BPromise[_0xa229('0x34')]({'id':_0x2bb022[_0xa229('0x32')][_0xa229('0x36')][_0xa229('0x30')],'name':_0x2bb022['name_value_list'][_0xa229('0x2d')][_0xa229('0x30')]});}}function getEndUser(_0x556032,_0x42a2a,_0x3853a1,_0x5a36cb){logger[_0xa229('0xd')]('Searching\x20enduser\x20with\x20phone',_0x3853a1);return request({'form':{'method':_0xa229('0x29'),'input_type':_0xa229('0x20'),'response_type':_0xa229('0x20'),'rest_data':JSON[_0xa229('0x26')]({'session':_0x5a36cb['id'],'module_name':_0xa229('0x1b'),'query':util[_0xa229('0x2b')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x3853a1),'order_by':'','offset':'0','select_fields':['id',_0xa229('0xf'),_0xa229('0x37')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xa229('0x2e')](function(_0x2841d2){if(_0x2841d2[_0xa229('0x2f')][_0xa229('0x38')]){var _0x47b51b=_[_0xa229('0x39')](_0x2841d2[_0xa229('0x2f')],function(_0x226ac6){return _0x226ac6[_0xa229('0x32')]['phone_home'][_0xa229('0x30')]===_0x3853a1;});if(_0x47b51b){logger[_0xa229('0xd')](_0xa229('0x3a'));return BPromise[_0xa229('0x34')]({'id':_0x47b51b[_0xa229('0x32')]['id'][_0xa229('0x30')],'name':_0x47b51b[_0xa229('0x32')][_0xa229('0xf')][_0xa229('0x30')],'phone':_0x47b51b[_0xa229('0x32')]['phone_home'][_0xa229('0x30')]});}}else{logger[_0xa229('0xd')](_0xa229('0x3b'));return request({'form':{'method':_0xa229('0x1f'),'input_type':_0xa229('0x20'),'response_type':_0xa229('0x20'),'rest_data':JSON[_0xa229('0x26')]({'session':_0x5a36cb['id'],'module_name':_0xa229('0x1b'),'name_value_list':[{'name':_0xa229('0x3c'),'value':_0x42a2a!==_0xa229('0x3d')?_0x42a2a:util['format'](_0xa229('0x3e'),_0x3853a1)},{'name':_0xa229('0x37'),'value':_0x3853a1}]})}})['then'](function(_0x483082){logger[_0xa229('0xd')](_0xa229('0x3f'));return BPromise['resolve']({'id':_0x483082['id'],'name':_0x483082[_0xa229('0x2f')][_0xa229('0x3c')][_0xa229('0x30')],'phone':_0x483082[_0xa229('0x2f')]['phone_home']['value']});});}});}function request(_0x4b80a1){logger[_0xa229('0x40')](_0xa229('0x41'),JSON[_0xa229('0x26')](_0x4b80a1));return rp(_[_0xa229('0x42')](def,_0x4b80a1));}function getTags(_0x1c685b,_0x45f23a){var _0x5124db=[];if(_0x1c685b&&_0x1c685b[_0xa229('0x38')]>0x0){_0x5124db=_['map'](_0x1c685b,_0x45f23a);}return _0x5124db;}function getCustomFields(_0x45f4d4,_0x44f26f){var _0x260829=[];var _0x3d587d={'custom_fields':[]};if(_0x45f4d4[_0xa229('0x38')]>0x0){_['forEach'](_0x45f4d4,function(_0x2d67f2){if(_0x2d67f2[_0xa229('0x43')]===_0xa229('0x44')&&_0x2d67f2[_0xa229('0x45')]&&!_0x2d67f2[_0xa229('0x46')]){_0x3d587d[_0x2d67f2[_0xa229('0x45')][_0xa229('0x47')]()]=_0x2d67f2[_0xa229('0x48')][_0xa229('0x23')]();}else if(_0x2d67f2[_0xa229('0x43')]==='string'&&_0x2d67f2[_0xa229('0x49')]&&_0x2d67f2[_0xa229('0x46')]){_0x3d587d['custom_fields']['push']({'id':_0x2d67f2[_0xa229('0x49')],'value':_0x2d67f2['content'][_0xa229('0x23')]()});}else if(_0x2d67f2[_0xa229('0x43')]===_0xa229('0x4a')&&_0x2d67f2[_0xa229('0x1e')]&&_0x2d67f2[_0xa229('0x49')]&&_0x2d67f2[_0xa229('0x46')]){_0x44f26f[_0x2d67f2['variableName']]&&_0x3d587d[_0xa229('0x4b')]['push']({'id':_0x2d67f2['idField'],'value':_0x44f26f[_0x2d67f2[_0xa229('0x1e')]][_0xa229('0x23')]()});}else if(_0x2d67f2[_0xa229('0x43')]===_0xa229('0x4c')&&_0x2d67f2[_0xa229('0x4d')]&&_0x2d67f2[_0xa229('0x4d')][_0xa229('0xf')]&&_0x2d67f2[_0xa229('0x49')]&&_0x2d67f2[_0xa229('0x46')]){_0x44f26f[_0x2d67f2[_0xa229('0x4d')]['name'][_0xa229('0x47')]()]&&_0x3d587d[_0xa229('0x4b')][_0xa229('0x4e')]({'id':_0x2d67f2[_0xa229('0x49')],'value':_0x44f26f[_0x2d67f2[_0xa229('0x4d')]['name']['toLowerCase']()][_0xa229('0x23')]()});}});}return _0x3d587d;}function getConnection(_0x558d0b){return request({'method':'POST','form':{'method':_0xa229('0x4f'),'input_type':_0xa229('0x20'),'response_type':_0xa229('0x20'),'rest_data':JSON[_0xa229('0x26')]({'user_auth':{'user_name':_0x558d0b['username'],'password':_0x558d0b[_0xa229('0x50')],'encryption':'PLAIN'},'application':_0xa229('0x51')})}})['then'](function(_0x267e69){var _0x27670e=_0x267e69;if(_0x27670e['id']){def[_0xa229('0x52')]=_0x27670e['id'];return BPromise[_0xa229('0x34')](_0x27670e);}else{throw new Error(util['format'](_0xa229('0x53'),_0x558d0b['id']));}});}function setRelationship(_0x3c1a97,_0x278661,_0x1c8d37,_0x3b9027){return request({'form':{'method':_0xa229('0x54'),'input_type':'JSON','response_type':_0xa229('0x20'),'rest_data':JSON['stringify']({'session':_0x3c1a97['id'],'module_name':_0xa229('0x55'),'module_id':_0x1c8d37['id'],'link_field_name':_0x3b9027,'related_ids':[_0x278661['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x47813f,_0x3c9416,_0x5e1838,_0x5d51d7,_0x21857c,_0x9b7fda){var _0x472c16,_0x12ca58,_0x2e03fa,_0x1ba02b;_0x9b7fda[_0xa229('0x56')]=intUtil[_0xa229('0x57')](_0x9b7fda[_0xa229('0x56')]);_0x9b7fda[_0xa229('0x58')]=intUtil[_0xa229('0x57')](_0x9b7fda['serverUrl']);def[_0xa229('0x59')]=util['format'](_0xa229('0x5a'),_0x9b7fda[_0xa229('0x56')]);if(_0x21857c&&_0x21857c[_0xa229('0x5b')]){logger[_0xa229('0xd')](_0xa229('0x5c'),_0xa229('0x5d'));_0x3c9416[_0xa229('0x5e')]=util[_0xa229('0x2b')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x9b7fda['serverUrl'],_0x3c9416[_0xa229('0x5f')],md5(_0x3c9416[_0xa229('0x5f')]));}else{_0x3c9416[_0xa229('0x5e')]='';}return getConnection(_0x9b7fda)['then'](function(_0x184cfd){_0x1ba02b=_0x184cfd;return getUser(_0x9b7fda,_0x5d51d7['name'],_0x1ba02b);})[_0xa229('0x2e')](function(_0x5e2159){_0x472c16=_0x5e2159;logger[_0xa229('0xd')]('The\x20User\x20ID\x20is:',_0x472c16['id']);return getEndUser(_0x9b7fda,_0x3c9416['calleridname'],_0x3c9416[_0xa229('0x60')],_0x1ba02b);})[_0xa229('0x2e')](function(_0x303ce4){_0x12ca58=_0x303ce4;logger[_0xa229('0xd')](_0xa229('0x61'),_0x12ca58['id']);return getTicket(_0x9b7fda,_0x472c16,_0x12ca58,_0x5e1838,_0x3c9416,_0x5e1838[_0xa229('0x62')],_0x1ba02b,_0xa229('0x63'));})['then'](function(_0x5efe87){_0x2e03fa=_0x5efe87;logger[_0xa229('0xd')](_0xa229('0x64'));logger[_0xa229('0xd')](_0xa229('0x65'),_0x2e03fa['id']);return setRelationship(_0x1ba02b,_0x472c16,_0x2e03fa,_0xa229('0x66'));})[_0xa229('0x2e')](function(){return setRelationship(_0x1ba02b,_0x12ca58,_0x2e03fa,_0xa229('0x67'));})[_0xa229('0x2e')](function(){return getServerInfo(_0x1ba02b);})[_0xa229('0x2e')](function(_0x555311){var _0xe68c47=parseInt(_0x555311['version'][_0xa229('0x68')](0x0));var _0x1156ee=util[_0xa229('0x2b')](_0xa229('0x69'),_0x9b7fda[_0xa229('0x56')],_0x2e03fa['id']);if(_0xe68c47>0x6){_0x1156ee=util['format'](_0xa229('0x6a'),_0x9b7fda[_0xa229('0x56')],_0x2e03fa['id']);}logger[_0xa229('0xd')](_0xa229('0x5c'),_0xa229('0x6b'));emit(util[_0xa229('0x2b')](_0xa229('0x6c'),_0x5d51d7[_0xa229('0xf')]),_0xa229('0x6d'),{'uri':_0x1156ee});})[_0xa229('0x6e')](function(_0xfa9ac2){logger[_0xa229('0x6f')](_0xa229('0x5c'),JSON[_0xa229('0x26')](_0xfa9ac2));});};exports[_0xa229('0x70')]=function(_0x45d809,_0x46d44b,_0xac0369,_0x3fa30a,_0x3dd708,_0x2d4402,_0x5f5c12){var _0x40e6c1,_0x1675b1,_0x4fdf80,_0x438af9;_0x2d4402[_0xa229('0x56')]=intUtil[_0xa229('0x57')](_0x2d4402[_0xa229('0x56')]);_0x2d4402['serverUrl']=intUtil[_0xa229('0x57')](_0x2d4402[_0xa229('0x58')]);def[_0xa229('0x59')]=util[_0xa229('0x2b')]('%s/service/v4_1/rest.php',_0x2d4402[_0xa229('0x56')]);if(_0x5f5c12&&_0x5f5c12[_0xa229('0x71')]&&_0x5f5c12[_0xa229('0x71')]!=='none'){logger['info']('[OUTBOUND]',_0xa229('0x5d'));_0x46d44b[_0xa229('0x5e')]=util[_0xa229('0x2b')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2d4402[_0xa229('0x58')],_0x46d44b['uniqueid'],md5(_0x46d44b[_0xa229('0x5f')]));}return getConnection(_0x2d4402)[_0xa229('0x2e')](function(_0x4738f0){_0x438af9=_0x4738f0;return getUser(_0x2d4402,_0x3fa30a[_0xa229('0xf')],_0x438af9);})[_0xa229('0x2e')](function(_0x6e4d8d){_0x40e6c1=_0x6e4d8d;logger['info']('The\x20User\x20ID\x20is:',_0x40e6c1['id']);return getEndUser(_0x2d4402,_0x46d44b[_0xa229('0x72')],_0x46d44b[_0xa229('0x73')],_0x438af9);})[_0xa229('0x2e')](function(_0x551d71){_0x1675b1=_0x551d71;logger[_0xa229('0xd')](_0xa229('0x61'),_0x1675b1['id']);return getTicket(_0x2d4402,_0x40e6c1,_0x1675b1,_0xac0369,_0x46d44b,_0xac0369[_0xa229('0x62')],_0x438af9,_0xa229('0x74'));})[_0xa229('0x2e')](function(_0x4e31d8){_0x4fdf80=_0x4e31d8;logger['info']('Ticket\x20created!');logger[_0xa229('0xd')]('The\x20Ticket\x20ID\x20is:',_0x4fdf80['id']);return setRelationship(_0x438af9,_0x40e6c1,_0x4fdf80,'users');})[_0xa229('0x2e')](function(){return setRelationship(_0x438af9,_0x1675b1,_0x4fdf80,_0xa229('0x67'));})[_0xa229('0x2e')](function(){return getServerInfo(_0x438af9);})[_0xa229('0x2e')](function(_0x176dd7){var _0x652929=parseInt(_0x176dd7[_0xa229('0x75')][_0xa229('0x68')](0x0));var _0x24e912=util['format'](_0xa229('0x69'),_0x2d4402['remoteUri'],_0x4fdf80['id']);if(_0x652929>0x6){_0x24e912=util['format'](_0xa229('0x6a'),_0x2d4402[_0xa229('0x56')],_0x4fdf80['id']);}logger['info']('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xa229('0x2b')](_0xa229('0x6c'),_0x3fa30a['name']),_0xa229('0x6d'),{'uri':_0x24e912});})[_0xa229('0x6e')](function(_0x597854){logger[_0xa229('0x6f')](_0xa229('0x76'),JSON[_0xa229('0x26')](_0x597854));});};exports['unmanaged']=function(_0x38cf27,_0x230d27,_0x18b486,_0x42d315,_0x4f7ff9,_0x58863b){var _0x172a78,_0x5d9e1a,_0x150d7c,_0x18fd4e;_0x58863b[_0xa229('0x56')]=intUtil['stripTrailingSlash'](_0x58863b['remoteUri']);_0x58863b[_0xa229('0x58')]=intUtil[_0xa229('0x57')](_0x58863b[_0xa229('0x58')]);def[_0xa229('0x59')]=util[_0xa229('0x2b')](_0xa229('0x5a'),_0x58863b['remoteUri']);if(_0x4f7ff9&&_0x4f7ff9[_0xa229('0x5b')]){logger['info']('['+_0x230d27[_0xa229('0x77')][_0xa229('0x78')]()+']',_0xa229('0x5d'));_0x230d27['recordingURL']=util[_0xa229('0x2b')](_0xa229('0x79'),_0x58863b[_0xa229('0x58')],_0x230d27[_0xa229('0x5f')],md5(_0x230d27[_0xa229('0x5f')]));}else{_0x230d27[_0xa229('0x5e')]='';}return getConnection(_0x58863b)[_0xa229('0x2e')](function(_0x5298a6){_0x18fd4e=_0x5298a6;if(!_[_0xa229('0x27')](_0x42d315)){return getUser(_0x58863b,_0x42d315[_0xa229('0xf')],_0x18fd4e);}else{return getUser(_0x58863b,null,_0x18fd4e);}})[_0xa229('0x2e')](function(_0x1bda06){_0x172a78=_0x1bda06;logger['info'](_0xa229('0x7a'),_0x172a78['id']);return getEndUser(_0x58863b,_0x230d27[_0xa229('0x7b')],_0x230d27[_0xa229('0x60')],_0x18fd4e);})[_0xa229('0x2e')](function(_0x2e50f6){_0x5d9e1a=_0x2e50f6;logger['info'](_0xa229('0x61'),_0x5d9e1a['id']);return getTicket(_0x58863b,_0x172a78,_0x5d9e1a,_0x18b486,_0x230d27,_0x18b486[_0xa229('0x62')],_0x18fd4e,_0xa229('0x63'));})[_0xa229('0x2e')](function(_0x46c482){_0x150d7c=_0x46c482;logger[_0xa229('0xd')](_0xa229('0x64'));logger[_0xa229('0xd')](_0xa229('0x65'),_0x150d7c['id']);return setRelationship(_0x18fd4e,_0x172a78,_0x150d7c,'users');})[_0xa229('0x2e')](function(){return setRelationship(_0x18fd4e,_0x5d9e1a,_0x150d7c,_0xa229('0x67'));})[_0xa229('0x2e')](function(){return getServerInfo(_0x18fd4e);})['catch'](function(_0x588070){logger[_0xa229('0x6f')]('['+_0x230d27[_0xa229('0x77')]['toUpperCase']()+']',JSON['stringify'](_0x588070));});}; \ No newline at end of file +var _0x16ea=['sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','serverUrl','stripTrailingSlash','uri','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','outbound','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','version','catch','unmanaged','lastevent','toUpperCase','isNil','calleridnum','The\x20Enduser\x20ID\x20is:','users','contacts','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','name','getString','Subjects','created_by','description','Descriptions','date_start','slice','duration_hours','duration_minutes','parent_id','parent_type','Contacts','direction','length','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','format','toString','get_server_info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','entry_list','name_value_list','Agent\x20found!','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','phone_home','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Enduser\x20created.','debug','merge','type','string','nameField','customField','content','custom_fields','customVariable','Variable','toLowerCase','login','username','password','PLAIN'];(function(_0xda2d99,_0x4f8ccc){var _0x3a911f=function(_0x55e4b7){while(--_0x55e4b7){_0xda2d99['push'](_0xda2d99['shift']());}};_0x3a911f(++_0x4f8ccc);}(_0x16ea,0x193));var _0xa16e=function(_0x56a0b6,_0x345f2c){_0x56a0b6=_0x56a0b6-0x0;var _0x1e0bf8=_0x16ea[_0x56a0b6];return _0x1e0bf8;};'use strict';var _=require('lodash');var rp=require(_0xa16e('0x0'));var BPromise=require('bluebird');var md5=require(_0xa16e('0x1'));var util=require(_0xa16e('0x2'));var Redis=require(_0xa16e('0x3'));var intUtil=require(_0xa16e('0x4'));var config=require(_0xa16e('0x5'));var logger=require(_0xa16e('0x6'))(_0xa16e('0x7'));config[_0xa16e('0x8')]=_[_0xa16e('0x9')](config['redis'],{'host':_0xa16e('0xa'),'port':0x18eb});var io=require(_0xa16e('0xb'))(new Redis(config[_0xa16e('0x8')]));var def={'method':_0xa16e('0xc'),'json':!![]};function emit(_0x2455d1,_0x174731,_0xe8fec5){io['to'](_0x2455d1)[_0xa16e('0xd')](_0x174731,_0xe8fec5);}function getTicket(_0x5228d9,_0x4bbd22,_0x4c0e89,_0x2d27d1,_0x53783c,_0x2ce60c,_0x167fd2,_0x272782){logger[_0xa16e('0xe')]('Creating\x20new\x20ticket...');var _0xb3d2b2=new Date();var _0x250956=[{'name':_0xa16e('0xf'),'value':intUtil[_0xa16e('0x10')](_0x2d27d1[_0xa16e('0x11')],_0x53783c,'\x20')},{'name':'assigned_user_id','value':_0x4bbd22['id']},{'name':_0xa16e('0x12'),'value':_0x4bbd22['id']},{'name':_0xa16e('0x13'),'value':intUtil[_0xa16e('0x10')](_0x2d27d1[_0xa16e('0x14')],_0x53783c,'\x0a')},{'name':_0xa16e('0x15'),'value':_0xb3d2b2['toISOString']()[_0xa16e('0x16')](0x0,0x13)['replace']('T','\x20')},{'name':_0xa16e('0x17'),'value':'0'},{'name':_0xa16e('0x18'),'value':'15'},{'name':_0xa16e('0x19'),'value':_0x4c0e89['id']},{'name':_0xa16e('0x1a'),'value':_0xa16e('0x1b')},{'name':'parent_name','value':_0x4c0e89['name']},{'name':_0xa16e('0x1c'),'value':_0x272782}];if(_0x2ce60c[_0xa16e('0x1d')]){_[_0xa16e('0x1e')](_0x2ce60c,function(_0xcaa750){if(_0x53783c[_0xcaa750[_0xa16e('0x1f')]]){_0x250956[_0xa16e('0x20')]({'name':_0xcaa750[_0xa16e('0x21')],'value':_0x53783c[_0xcaa750[_0xa16e('0x1f')]]});}});}return request({'form':{'method':_0xa16e('0x22'),'input_type':_0xa16e('0x23'),'response_type':'JSON','rest_data':JSON[_0xa16e('0x24')]({'session':_0x167fd2['id'],'module_name':_0xa16e('0x25'),'name_value_list':_0x250956})}});}function getAuth(_0x1b601c){return util[_0xa16e('0x26')]('Basic\x20%s',new Buffer(_0x1b601c['apiKey']+':X')[_0xa16e('0x27')]('base64'));}function getServerInfo(_0x4bfd15){return request({'form':{'method':_0xa16e('0x28'),'input_type':_0xa16e('0x23'),'response_type':_0xa16e('0x23'),'rest_data':JSON['stringify']({'session':_0x4bfd15['id']})}});}function getUser(_0x2cbe2e,_0x2a448d,_0x58eed7){if(!_['isNil'](_0x2a448d)){logger[_0xa16e('0xe')](_0xa16e('0x29'),_0x2a448d);return request({'form':{'method':_0xa16e('0x2a'),'input_type':_0xa16e('0x23'),'response_type':_0xa16e('0x23'),'rest_data':JSON['stringify']({'session':_0x58eed7['id'],'module_name':_0xa16e('0x2b'),'query':util['format'](_0xa16e('0x2c'),_0x2a448d),'order_by':'','offset':'0','select_fields':['id',_0xa16e('0xf'),_0xa16e('0x2d')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x5e484a){if(_0x5e484a[_0xa16e('0x2e')][_0xa16e('0x1d')]){var _0x270846=_['find'](_0x5e484a[_0xa16e('0x2e')],function(_0xe5f4a2){return _0xe5f4a2[_0xa16e('0x2f')]['user_name']['value']===_0x2a448d;});if(_0x270846){logger[_0xa16e('0xe')](_0xa16e('0x30'));return BPromise[_0xa16e('0x31')]({'id':_0x270846[_0xa16e('0x2f')]['id']['value'],'name':_0x270846['name_value_list'][_0xa16e('0xf')][_0xa16e('0x32')]});}}logger[_0xa16e('0xe')](_0xa16e('0x33'));return BPromise[_0xa16e('0x31')]({'id':_0x58eed7[_0xa16e('0x2f')][_0xa16e('0x34')]['value'],'name':_0x58eed7['name_value_list'][_0xa16e('0x2d')][_0xa16e('0x32')]});});}else{logger[_0xa16e('0xe')](_0xa16e('0x35'));return BPromise['resolve']({'id':_0x58eed7[_0xa16e('0x2f')][_0xa16e('0x34')][_0xa16e('0x32')],'name':_0x58eed7[_0xa16e('0x2f')]['user_name'][_0xa16e('0x32')]});}}function getEndUser(_0x2198fa,_0x43d9da,_0x538de4,_0x3b4783){logger[_0xa16e('0xe')](_0xa16e('0x36'),_0x538de4);return request({'form':{'method':_0xa16e('0x2a'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xa16e('0x24')]({'session':_0x3b4783['id'],'module_name':'Contacts','query':util['format']('contacts.phone_home\x20=\x20\x22%s\x22',_0x538de4),'order_by':'','offset':'0','select_fields':['id','name',_0xa16e('0x37')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xa16e('0x38')](function(_0xb86e75){if(_0xb86e75['entry_list'][_0xa16e('0x1d')]){var _0x1290b6=_['find'](_0xb86e75[_0xa16e('0x2e')],function(_0x43f1b0){return _0x43f1b0[_0xa16e('0x2f')][_0xa16e('0x37')][_0xa16e('0x32')]===_0x538de4;});if(_0x1290b6){logger['info'](_0xa16e('0x39'));return BPromise[_0xa16e('0x31')]({'id':_0x1290b6[_0xa16e('0x2f')]['id']['value'],'name':_0x1290b6['name_value_list']['name'][_0xa16e('0x32')],'phone':_0x1290b6['name_value_list']['phone_home']['value']});}}else{logger[_0xa16e('0xe')](_0xa16e('0x3a'));return request({'form':{'method':_0xa16e('0x22'),'input_type':'JSON','response_type':_0xa16e('0x23'),'rest_data':JSON['stringify']({'session':_0x3b4783['id'],'module_name':_0xa16e('0x1b'),'name_value_list':[{'name':_0xa16e('0x3b'),'value':_0x43d9da!==_0xa16e('0x3c')?_0x43d9da:util['format']('Caller\x20-\x20%s',_0x538de4)},{'name':_0xa16e('0x37'),'value':_0x538de4}]})}})[_0xa16e('0x38')](function(_0x5f4f96){logger['info'](_0xa16e('0x3d'));return BPromise[_0xa16e('0x31')]({'id':_0x5f4f96['id'],'name':_0x5f4f96['entry_list'][_0xa16e('0x3b')]['value'],'phone':_0x5f4f96[_0xa16e('0x2e')][_0xa16e('0x37')][_0xa16e('0x32')]});});}});}function request(_0x20fffd){logger[_0xa16e('0x3e')]('[HTTP]',JSON[_0xa16e('0x24')](_0x20fffd));return rp(_[_0xa16e('0x3f')](def,_0x20fffd));}function getTags(_0x3bf14e,_0x4a3ff4){var _0x401f92=[];if(_0x3bf14e&&_0x3bf14e['length']>0x0){_0x401f92=_['map'](_0x3bf14e,_0x4a3ff4);}return _0x401f92;}function getCustomFields(_0x5e328c,_0x4dc773){var _0x30ae68=[];var _0x450910={'custom_fields':[]};if(_0x5e328c['length']>0x0){_[_0xa16e('0x1e')](_0x5e328c,function(_0xc1ec31){if(_0xc1ec31[_0xa16e('0x40')]===_0xa16e('0x41')&&_0xc1ec31[_0xa16e('0x42')]&&!_0xc1ec31[_0xa16e('0x43')]){_0x450910[_0xc1ec31[_0xa16e('0x42')]['toLowerCase']()]=_0xc1ec31[_0xa16e('0x44')][_0xa16e('0x27')]();}else if(_0xc1ec31[_0xa16e('0x40')]===_0xa16e('0x41')&&_0xc1ec31['idField']&&_0xc1ec31[_0xa16e('0x43')]){_0x450910[_0xa16e('0x45')]['push']({'id':_0xc1ec31[_0xa16e('0x21')],'value':_0xc1ec31[_0xa16e('0x44')][_0xa16e('0x27')]()});}else if(_0xc1ec31[_0xa16e('0x40')]==='variable'&&_0xc1ec31['variableName']&&_0xc1ec31[_0xa16e('0x21')]&&_0xc1ec31[_0xa16e('0x43')]){_0x4dc773[_0xc1ec31[_0xa16e('0x1f')]]&&_0x450910[_0xa16e('0x45')][_0xa16e('0x20')]({'id':_0xc1ec31[_0xa16e('0x21')],'value':_0x4dc773[_0xc1ec31[_0xa16e('0x1f')]][_0xa16e('0x27')]()});}else if(_0xc1ec31['type']===_0xa16e('0x46')&&_0xc1ec31[_0xa16e('0x47')]&&_0xc1ec31[_0xa16e('0x47')]['name']&&_0xc1ec31[_0xa16e('0x21')]&&_0xc1ec31[_0xa16e('0x43')]){_0x4dc773[_0xc1ec31[_0xa16e('0x47')][_0xa16e('0xf')][_0xa16e('0x48')]()]&&_0x450910[_0xa16e('0x45')]['push']({'id':_0xc1ec31[_0xa16e('0x21')],'value':_0x4dc773[_0xc1ec31[_0xa16e('0x47')][_0xa16e('0xf')][_0xa16e('0x48')]()][_0xa16e('0x27')]()});}});}return _0x450910;}function getConnection(_0x4627e0){return request({'method':'POST','form':{'method':_0xa16e('0x49'),'input_type':'JSON','response_type':_0xa16e('0x23'),'rest_data':JSON[_0xa16e('0x24')]({'user_auth':{'user_name':_0x4627e0[_0xa16e('0x4a')],'password':_0x4627e0[_0xa16e('0x4b')],'encryption':_0xa16e('0x4c')},'application':'xCALLY\x20Motion\x20integration'})}})[_0xa16e('0x38')](function(_0x564e74){var _0x2dcade=_0x564e74;if(_0x2dcade['id']){def[_0xa16e('0x4d')]=_0x2dcade['id'];return BPromise[_0xa16e('0x31')](_0x2dcade);}else{throw new Error(util[_0xa16e('0x26')](_0xa16e('0x4e'),_0x4627e0['id']));}});}function setRelationship(_0xf8d52f,_0x673e12,_0x3f98c8,_0x19f88e){return request({'form':{'method':_0xa16e('0x4f'),'input_type':'JSON','response_type':_0xa16e('0x23'),'rest_data':JSON['stringify']({'session':_0xf8d52f['id'],'module_name':_0xa16e('0x25'),'module_id':_0x3f98c8['id'],'link_field_name':_0x19f88e,'related_ids':[_0x673e12['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x1772c5,_0x24a237,_0x1a4501,_0x43d6c4,_0x51be4a,_0x29eb29){var _0x4cd4d3,_0x4fdd2e,_0x41ebdd,_0x54b7e6;_0x29eb29[_0xa16e('0x50')]=intUtil['stripTrailingSlash'](_0x29eb29[_0xa16e('0x50')]);_0x29eb29[_0xa16e('0x51')]=intUtil[_0xa16e('0x52')](_0x29eb29[_0xa16e('0x51')]);def[_0xa16e('0x53')]=util[_0xa16e('0x26')](_0xa16e('0x54'),_0x29eb29[_0xa16e('0x50')]);if(_0x51be4a&&_0x51be4a[_0xa16e('0x55')]){logger[_0xa16e('0xe')]('[QUEUE]',_0xa16e('0x56'));_0x24a237['recordingURL']=util[_0xa16e('0x26')](_0xa16e('0x57'),_0x29eb29[_0xa16e('0x51')],_0x24a237[_0xa16e('0x58')],md5(_0x24a237[_0xa16e('0x58')]));}else{_0x24a237[_0xa16e('0x59')]='';}return getConnection(_0x29eb29)['then'](function(_0x4d3531){_0x54b7e6=_0x4d3531;return getUser(_0x29eb29,_0x43d6c4[_0xa16e('0xf')],_0x54b7e6);})[_0xa16e('0x38')](function(_0x566fc2){_0x4cd4d3=_0x566fc2;logger['info'](_0xa16e('0x5a'),_0x4cd4d3['id']);return getEndUser(_0x29eb29,_0x24a237[_0xa16e('0x5b')],_0x24a237['calleridnum'],_0x54b7e6);})['then'](function(_0x2992bb){_0x4fdd2e=_0x2992bb;logger[_0xa16e('0xe')]('The\x20Enduser\x20ID\x20is:',_0x4fdd2e['id']);return getTicket(_0x29eb29,_0x4cd4d3,_0x4fdd2e,_0x1a4501,_0x24a237,_0x1a4501[_0xa16e('0x5c')],_0x54b7e6,_0xa16e('0x5d'));})[_0xa16e('0x38')](function(_0x27de1d){_0x41ebdd=_0x27de1d;logger[_0xa16e('0xe')](_0xa16e('0x5e'));logger[_0xa16e('0xe')](_0xa16e('0x5f'),_0x41ebdd['id']);return setRelationship(_0x54b7e6,_0x4cd4d3,_0x41ebdd,'users');})[_0xa16e('0x38')](function(){return setRelationship(_0x54b7e6,_0x4fdd2e,_0x41ebdd,'contacts');})[_0xa16e('0x38')](function(){return getServerInfo(_0x54b7e6);})[_0xa16e('0x38')](function(_0x157156){var _0x5be512=parseInt(_0x157156['version'][_0xa16e('0x60')](0x0));var _0x26b9c8=util['format'](_0xa16e('0x61'),_0x29eb29[_0xa16e('0x50')],_0x41ebdd['id']);if(_0x5be512>0x6){_0x26b9c8=util[_0xa16e('0x26')](_0xa16e('0x62'),_0x29eb29[_0xa16e('0x50')],_0x41ebdd['id']);}logger[_0xa16e('0xe')](_0xa16e('0x63'),_0xa16e('0x64'));emit(util[_0xa16e('0x26')](_0xa16e('0x65'),_0x43d6c4[_0xa16e('0xf')]),_0xa16e('0x66'),{'uri':_0x26b9c8});})['catch'](function(_0x5d5b30){logger[_0xa16e('0x67')]('[QUEUE]',JSON[_0xa16e('0x24')](_0x5d5b30));});};exports[_0xa16e('0x68')]=function(_0x3ca17c,_0x4cc3a0,_0x197752,_0x2af8b9,_0x2f4f13,_0x3e8ae2,_0x3d2755){var _0x3dc8f1,_0x127d40,_0x3300ac,_0x55c2b9;_0x3e8ae2[_0xa16e('0x50')]=intUtil[_0xa16e('0x52')](_0x3e8ae2[_0xa16e('0x50')]);_0x3e8ae2[_0xa16e('0x51')]=intUtil[_0xa16e('0x52')](_0x3e8ae2[_0xa16e('0x51')]);def[_0xa16e('0x53')]=util[_0xa16e('0x26')]('%s/service/v4_1/rest.php',_0x3e8ae2['remoteUri']);if(_0x3d2755&&_0x3d2755[_0xa16e('0x69')]&&_0x3d2755[_0xa16e('0x69')]!=='none'){logger[_0xa16e('0xe')](_0xa16e('0x6a'),_0xa16e('0x56'));_0x4cc3a0[_0xa16e('0x59')]=util[_0xa16e('0x26')](_0xa16e('0x57'),_0x3e8ae2[_0xa16e('0x51')],_0x4cc3a0[_0xa16e('0x58')],md5(_0x4cc3a0[_0xa16e('0x58')]));}return getConnection(_0x3e8ae2)['then'](function(_0x5a10a9){_0x55c2b9=_0x5a10a9;return getUser(_0x3e8ae2,_0x2af8b9['name'],_0x55c2b9);})[_0xa16e('0x38')](function(_0x20a381){_0x3dc8f1=_0x20a381;logger[_0xa16e('0xe')](_0xa16e('0x5a'),_0x3dc8f1['id']);return getEndUser(_0x3e8ae2,_0x4cc3a0[_0xa16e('0x6b')],_0x4cc3a0[_0xa16e('0x6c')],_0x55c2b9);})['then'](function(_0x5bb7e4){_0x127d40=_0x5bb7e4;logger[_0xa16e('0xe')]('The\x20Enduser\x20ID\x20is:',_0x127d40['id']);return getTicket(_0x3e8ae2,_0x3dc8f1,_0x127d40,_0x197752,_0x4cc3a0,_0x197752['Fields'],_0x55c2b9,_0xa16e('0x6d'));})['then'](function(_0x1d9382){_0x3300ac=_0x1d9382;logger[_0xa16e('0xe')](_0xa16e('0x5e'));logger[_0xa16e('0xe')]('The\x20Ticket\x20ID\x20is:',_0x3300ac['id']);return setRelationship(_0x55c2b9,_0x3dc8f1,_0x3300ac,'users');})[_0xa16e('0x38')](function(){return setRelationship(_0x55c2b9,_0x127d40,_0x3300ac,'contacts');})['then'](function(){return getServerInfo(_0x55c2b9);})['then'](function(_0x2f5280){var _0x4e57d5=parseInt(_0x2f5280[_0xa16e('0x6e')][_0xa16e('0x60')](0x0));var _0x11e54e=util[_0xa16e('0x26')](_0xa16e('0x61'),_0x3e8ae2['remoteUri'],_0x3300ac['id']);if(_0x4e57d5>0x6){_0x11e54e=util[_0xa16e('0x26')](_0xa16e('0x62'),_0x3e8ae2[_0xa16e('0x50')],_0x3300ac['id']);}logger[_0xa16e('0xe')](_0xa16e('0x6a'),_0xa16e('0x64'));emit(util[_0xa16e('0x26')](_0xa16e('0x65'),_0x2af8b9[_0xa16e('0xf')]),_0xa16e('0x66'),{'uri':_0x11e54e});})[_0xa16e('0x6f')](function(_0x4c6f99){logger[_0xa16e('0x67')]('[OUTBOUND]',JSON[_0xa16e('0x24')](_0x4c6f99));});};exports[_0xa16e('0x70')]=function(_0x24f23f,_0x44020f,_0x330958,_0x14ab86,_0x10c31c,_0x454ec6){var _0x31ebac,_0x3641a2,_0x324ab7,_0x1dadfd;_0x454ec6[_0xa16e('0x50')]=intUtil[_0xa16e('0x52')](_0x454ec6[_0xa16e('0x50')]);_0x454ec6['serverUrl']=intUtil[_0xa16e('0x52')](_0x454ec6[_0xa16e('0x51')]);def[_0xa16e('0x53')]=util[_0xa16e('0x26')](_0xa16e('0x54'),_0x454ec6[_0xa16e('0x50')]);if(_0x10c31c&&_0x10c31c[_0xa16e('0x55')]){logger[_0xa16e('0xe')]('['+_0x44020f[_0xa16e('0x71')][_0xa16e('0x72')]()+']',_0xa16e('0x56'));_0x44020f[_0xa16e('0x59')]=util[_0xa16e('0x26')](_0xa16e('0x57'),_0x454ec6[_0xa16e('0x51')],_0x44020f[_0xa16e('0x58')],md5(_0x44020f[_0xa16e('0x58')]));}else{_0x44020f[_0xa16e('0x59')]='';}return getConnection(_0x454ec6)[_0xa16e('0x38')](function(_0x190898){_0x1dadfd=_0x190898;if(!_[_0xa16e('0x73')](_0x14ab86)){return getUser(_0x454ec6,_0x14ab86[_0xa16e('0xf')],_0x1dadfd);}else{return getUser(_0x454ec6,null,_0x1dadfd);}})['then'](function(_0xeec2c5){_0x31ebac=_0xeec2c5;logger[_0xa16e('0xe')](_0xa16e('0x5a'),_0x31ebac['id']);return getEndUser(_0x454ec6,_0x44020f[_0xa16e('0x5b')],_0x44020f[_0xa16e('0x74')],_0x1dadfd);})[_0xa16e('0x38')](function(_0x7210e){_0x3641a2=_0x7210e;logger[_0xa16e('0xe')](_0xa16e('0x75'),_0x3641a2['id']);return getTicket(_0x454ec6,_0x31ebac,_0x3641a2,_0x330958,_0x44020f,_0x330958[_0xa16e('0x5c')],_0x1dadfd,_0xa16e('0x5d'));})[_0xa16e('0x38')](function(_0x58d308){_0x324ab7=_0x58d308;logger[_0xa16e('0xe')](_0xa16e('0x5e'));logger[_0xa16e('0xe')](_0xa16e('0x5f'),_0x324ab7['id']);return setRelationship(_0x1dadfd,_0x31ebac,_0x324ab7,_0xa16e('0x76'));})['then'](function(){return setRelationship(_0x1dadfd,_0x3641a2,_0x324ab7,_0xa16e('0x77'));})[_0xa16e('0x38')](function(){return getServerInfo(_0x1dadfd);})[_0xa16e('0x6f')](function(_0x360657){logger['error']('['+_0x44020f['lastevent'][_0xa16e('0x72')]()+']',JSON['stringify'](_0x360657));});}; \ 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 788b6e1..c06db4d 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 _0x29f4=['keyValue','keyType','format','%s:\x20%s','key','keyContent','join','slice','substring','lastIndexOf','isNil','test','lodash','util','length','sortBy','type','string','variableName','toString','customVariable','Variable','name','toLowerCase','push'];(function(_0x37222f,_0x25a5ab){var _0x5c5a6d=function(_0x27218b){while(--_0x27218b){_0x37222f['push'](_0x37222f['shift']());}};_0x5c5a6d(++_0x25a5ab);}(_0x29f4,0x19c));var _0x429f=function(_0x2367e1,_0xb325a0){_0x2367e1=_0x2367e1-0x0;var _0x356dc8=_0x29f4[_0x2367e1];return _0x356dc8;};'use strict';var _=require(_0x429f('0x0'));var util=require(_0x429f('0x1'));exports['getString']=function(_0x16c605,_0x444d6e,_0x33295e){var _0x27c46a=[];if(_0x16c605[_0x429f('0x2')]>0x0){var _0x10e3ca=_[_0x429f('0x3')](_0x16c605,['id']);for(var _0x491048=0x0;_0x491048<_0x10e3ca[_0x429f('0x2')];_0x491048++){var _0x12c2d5=_0x10e3ca[_0x491048];if(_0x12c2d5[_0x429f('0x4')]===_0x429f('0x5')){_0x27c46a['push'](_0x12c2d5['content']);}else if(_0x12c2d5[_0x429f('0x4')]==='variable'&&_0x12c2d5[_0x429f('0x6')]){_0x444d6e[_0x12c2d5[_0x429f('0x6')]]&&_0x27c46a['push'](_0x444d6e[_0x12c2d5['variableName']][_0x429f('0x7')]());}else if(_0x12c2d5[_0x429f('0x4')]===_0x429f('0x8')&&_0x12c2d5[_0x429f('0x9')]&&_0x12c2d5[_0x429f('0x9')][_0x429f('0xa')]){_0x444d6e[_0x12c2d5[_0x429f('0x9')]['name'][_0x429f('0xb')]()]&&_0x27c46a[_0x429f('0xc')](_0x444d6e[_0x12c2d5[_0x429f('0x9')][_0x429f('0xa')]['toLowerCase']()][_0x429f('0x7')]());}else if(_0x12c2d5[_0x429f('0x4')]===_0x429f('0xd')){if(_0x12c2d5[_0x429f('0xe')]===_0x429f('0x5')&&_0x12c2d5['key']){_0x27c46a[_0x429f('0xc')](util[_0x429f('0xf')](_0x429f('0x10'),_0x12c2d5[_0x429f('0x11')],_0x12c2d5[_0x429f('0x12')]));}else if(_0x12c2d5[_0x429f('0xe')]==='variable'&&_0x12c2d5[_0x429f('0x6')]&&_0x12c2d5[_0x429f('0x11')]){_0x444d6e[_0x12c2d5[_0x429f('0x6')]]&&_0x27c46a[_0x429f('0xc')](util[_0x429f('0xf')](_0x429f('0x10'),_0x12c2d5[_0x429f('0x11')],_0x444d6e[_0x12c2d5[_0x429f('0x6')]]));}else if(_0x12c2d5[_0x429f('0xe')]==='customVariable'&&_0x12c2d5[_0x429f('0x9')]&&_0x12c2d5[_0x429f('0x9')][_0x429f('0xa')]&&_0x12c2d5[_0x429f('0x11')]){_0x444d6e[_0x12c2d5[_0x429f('0x9')][_0x429f('0xa')]['toLowerCase']()]&&_0x27c46a[_0x429f('0xc')](util['format'](_0x429f('0x10'),_0x12c2d5['key'],_0x444d6e[_0x12c2d5[_0x429f('0x9')][_0x429f('0xa')][_0x429f('0xb')]()]));}}}}return _0x27c46a[_0x429f('0x13')](_0x33295e);};exports['stripTrailingSlash']=function(_0x267e4f){var _0x58d211=_0x267e4f[_0x429f('0x14')](-0x1);if(_0x58d211==='/'){_0x267e4f=_0x267e4f[_0x429f('0x15')](0x0,_0x267e4f[_0x429f('0x16')](_0x58d211));}return _0x267e4f;};exports['validateEmail']=function(_0xa49bb){if(!_[_0x429f('0x17')](_0xa49bb)&&_0xa49bb!==''){var _0x1a5111=/^(([^<>()\[\]\\.,;:\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 _0x1a5111[_0x429f('0x18')](String(_0xa49bb)[_0x429f('0xb')]());}else{return![];}}; \ No newline at end of file +var _0x27d1=['key','keyContent','keyType','stripTrailingSlash','substring','lastIndexOf','isNil','sortBy','length','type','string','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','format','%s:\x20%s'];(function(_0x44f34d,_0x17d050){var _0x424d78=function(_0x550234){while(--_0x550234){_0x44f34d['push'](_0x44f34d['shift']());}};_0x424d78(++_0x17d050);}(_0x27d1,0x132));var _0x127d=function(_0x172aab,_0x58c635){_0x172aab=_0x172aab-0x0;var _0x593d16=_0x27d1[_0x172aab];return _0x593d16;};'use strict';var _=require('lodash');var util=require('util');exports['getString']=function(_0x547096,_0x5d4c74,_0x54c820){var _0x2b4147=[];if(_0x547096['length']>0x0){var _0x1c05fc=_[_0x127d('0x0')](_0x547096,['id']);for(var _0x1f9495=0x0;_0x1f9495<_0x1c05fc[_0x127d('0x1')];_0x1f9495++){var _0x4958a9=_0x1c05fc[_0x1f9495];if(_0x4958a9[_0x127d('0x2')]===_0x127d('0x3')){_0x2b4147[_0x127d('0x4')](_0x4958a9[_0x127d('0x5')]);}else if(_0x4958a9[_0x127d('0x2')]===_0x127d('0x6')&&_0x4958a9[_0x127d('0x7')]){_0x5d4c74[_0x4958a9['variableName']]&&_0x2b4147[_0x127d('0x4')](_0x5d4c74[_0x4958a9['variableName']][_0x127d('0x8')]());}else if(_0x4958a9[_0x127d('0x2')]===_0x127d('0x9')&&_0x4958a9[_0x127d('0xa')]&&_0x4958a9['Variable']['name']){_0x5d4c74[_0x4958a9['Variable'][_0x127d('0xb')][_0x127d('0xc')]()]&&_0x2b4147[_0x127d('0x4')](_0x5d4c74[_0x4958a9[_0x127d('0xa')][_0x127d('0xb')][_0x127d('0xc')]()]['toString']());}else if(_0x4958a9[_0x127d('0x2')]===_0x127d('0xd')){if(_0x4958a9['keyType']===_0x127d('0x3')&&_0x4958a9['key']){_0x2b4147[_0x127d('0x4')](util[_0x127d('0xe')](_0x127d('0xf'),_0x4958a9[_0x127d('0x10')],_0x4958a9[_0x127d('0x11')]));}else if(_0x4958a9[_0x127d('0x12')]===_0x127d('0x6')&&_0x4958a9[_0x127d('0x7')]&&_0x4958a9[_0x127d('0x10')]){_0x5d4c74[_0x4958a9['variableName']]&&_0x2b4147[_0x127d('0x4')](util['format'](_0x127d('0xf'),_0x4958a9[_0x127d('0x10')],_0x5d4c74[_0x4958a9['variableName']]));}else if(_0x4958a9[_0x127d('0x12')]===_0x127d('0x9')&&_0x4958a9[_0x127d('0xa')]&&_0x4958a9[_0x127d('0xa')][_0x127d('0xb')]&&_0x4958a9[_0x127d('0x10')]){_0x5d4c74[_0x4958a9[_0x127d('0xa')]['name']['toLowerCase']()]&&_0x2b4147[_0x127d('0x4')](util[_0x127d('0xe')]('%s:\x20%s',_0x4958a9[_0x127d('0x10')],_0x5d4c74[_0x4958a9[_0x127d('0xa')][_0x127d('0xb')]['toLowerCase']()]));}}}}return _0x2b4147['join'](_0x54c820);};exports[_0x127d('0x13')]=function(_0x4e5718){var _0x3d507e=_0x4e5718['slice'](-0x1);if(_0x3d507e==='/'){_0x4e5718=_0x4e5718[_0x127d('0x14')](0x0,_0x4e5718[_0x127d('0x15')](_0x3d507e));}return _0x4e5718;};exports['validateEmail']=function(_0x592adc){if(!_[_0x127d('0x16')](_0x592adc)&&_0x592adc!==''){var _0x48f538=/^(([^<>()\[\]\\.,;:\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 _0x48f538['test'](String(_0x592adc)[_0x127d('0xc')]());}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 91918fa..6dfc46d 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x9c6a31,_0x15d7c6){var _0x37b2d2=function(_0x245576){while(--_0x245576){_0x9c6a31['push'](_0x9c6a31['shift']());}};_0x37b2d2(++_0x15d7c6);}(_0x9c44,0x178));var _0x49c4=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x9c44[_0xdea41a];return _0x15d0d8;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file +var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x2fa91e,_0x11c54f){var _0xe3d554=function(_0x1bb55d){while(--_0x1bb55d){_0x2fa91e['push'](_0x2fa91e['shift']());}};_0xe3d554(++_0x11c54f);}(_0x9c44,0x178));var _0x49c4=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x9c44[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 40964ea..7e6b293 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 _0xc38c=['Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','POST','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/agent/tickets/%s','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','destcalleridname','%s/channels/voice/agents/%d/tickets/%d/display.json','user:%s','replace','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','Tags','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','%s/users/me.json','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','filter','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','end-user','Caller\x20-\x20%s','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','debug','stringify','GET','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','custom_fields','push','variable','variableName','customVariable','Variable','queue','serverUrl','stripTrailingSlash','[QUEUE]'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xc38c,0x1e0));var _0xcc38=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc38c[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var rp=require(_0xcc38('0x0'));var md5=require('md5');var util=require(_0xcc38('0x1'));var Redis=require(_0xcc38('0x2'));var intUtil=require(_0xcc38('0x3'));var config=require(_0xcc38('0x4'));var logger=require(_0xcc38('0x5'))('zendesk');config[_0xcc38('0x6')]=_[_0xcc38('0x7')](config[_0xcc38('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xcc38('0x8'))(new Redis(config[_0xcc38('0x6')]));function emit(_0x42942b,_0xce5c44,_0x53aeb1){io['to'](_0x42942b)[_0xcc38('0x9')](_0xce5c44,_0x53aeb1);}var headers={'Content-Type':_0xcc38('0xa'),'Accept':_0xcc38('0xa')};function getTicket(_0x20b7a3,_0x17725f,_0x5e1868,_0x356b37,_0x5bbc6c){logger[_0xcc38('0xb')](_0xcc38('0xc'));return request({'uri':util[_0xcc38('0xd')](_0xcc38('0xe'),_0x20b7a3[_0xcc38('0xf')]),'method':'POST','body':{'ticket':_['merge']({'requester_id':_0x5e1868['id'],'submitter_id':_0x17725f?_0x17725f['id']:undefined,'assignee_id':_0x17725f?_0x17725f['id']:undefined,'tags':getTags(_0x356b37[_0xcc38('0x10')],_0xcc38('0x11')),'subject':intUtil[_0xcc38('0x12')](_0x356b37[_0xcc38('0x13')],_0x5bbc6c,'\x20'),'description':intUtil[_0xcc38('0x12')](_0x356b37['Descriptions'],_0x5bbc6c,'\x0a'),'comment':{'public':![],'body':intUtil[_0xcc38('0x12')](_0x356b37[_0xcc38('0x14')],_0x5bbc6c,'\x0a')}},getCustomFields(_0x356b37[_0xcc38('0x15')],_0x5bbc6c))}})[_0xcc38('0x16')](function(_0x1d7e6f){logger[_0xcc38('0xb')](_0xcc38('0x17'));return _0x1d7e6f[_0xcc38('0x18')];});}function getUser(_0x12dff3,_0x282682){if(intUtil[_0xcc38('0x19')](_0x282682)){logger['info'](_0xcc38('0x1a'),_0x282682);return request({'uri':util['format']('%s/search.json',_0x12dff3[_0xcc38('0xf')]),'qs':{'query':util[_0xcc38('0xd')](_0xcc38('0x1b'),_0x282682)}})[_0xcc38('0x16')](function(_0x3b2227){if(_0x3b2227[_0xcc38('0x1c')]){logger['info'](_0xcc38('0x1d'));return _[_0xcc38('0x1e')](_0x3b2227[_0xcc38('0x1f')],{'email':_0x282682,'role':_0xcc38('0x20')});}else{logger[_0xcc38('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xcc38('0xd')](_0xcc38('0x21'),_0x12dff3['remoteUri'])})[_0xcc38('0x16')](function(_0xfd3d22){logger[_0xcc38('0xb')]('Admin\x20account\x20selected.');return _0xfd3d22['user'];});}});}else{logger['info'](_0xcc38('0x22'));return request({'uri':util['format'](_0xcc38('0x21'),_0x12dff3[_0xcc38('0xf')])})[_0xcc38('0x16')](function(_0x58f157){logger['info']('Admin\x20account\x20selected.');return _0x58f157[_0xcc38('0x23')];});}}function getEndUser(_0x302a0f,_0x153d96,_0x3e1511){logger['info'](_0xcc38('0x24'),_0x3e1511);return request({'uri':util[_0xcc38('0xd')]('%s/search.json',_0x302a0f[_0xcc38('0xf')]),'qs':{'query':util[_0xcc38('0xd')](_0xcc38('0x25'),_0x3e1511)}})[_0xcc38('0x16')](function(_0x2d1279){var _0x4f63b2;if(_0x2d1279[_0xcc38('0x1f')]['length']){_0x2d1279[_0xcc38('0x1f')]=_[_0xcc38('0x26')](_0x2d1279['results'],{'suspended':![],'role':'end-user'});if(_0x2d1279[_0xcc38('0x1f')][_0xcc38('0x27')]){_0x4f63b2=_['first'](_0x2d1279['results']);}}if(_0x4f63b2){logger[_0xcc38('0xb')](_0xcc38('0x28'));return _0x4f63b2;}else{logger[_0xcc38('0xb')](_0xcc38('0x29'));return request({'uri':util[_0xcc38('0xd')]('%s/users.json',_0x302a0f[_0xcc38('0xf')]),'method':'POST','body':{'user':{'role':_0xcc38('0x2a'),'name':util[_0xcc38('0xd')](_0xcc38('0x2b'),_0x153d96||_0x3e1511),'phone':_0x3e1511}}})[_0xcc38('0x16')](function(_0x503945){logger['info']('Enduser\x20created.');return _0x503945[_0xcc38('0x23')];});}});}function getAuth(_0x23ecf2){var _0xb21763;if(_0x23ecf2[_0xcc38('0x2c')]===_0xcc38('0x2d')){_0xb21763=util[_0xcc38('0xd')](_0xcc38('0x2e'),_0x23ecf2[_0xcc38('0x2f')],_0x23ecf2[_0xcc38('0x2d')]);}else if(_0x23ecf2[_0xcc38('0x2c')]===_0xcc38('0x30')){_0xb21763=util[_0xcc38('0xd')](_0xcc38('0x31'),_0x23ecf2[_0xcc38('0x2f')],_0x23ecf2['token']);}return util[_0xcc38('0xd')](_0xcc38('0x32'),new Buffer(_0xb21763)[_0xcc38('0x33')](_0xcc38('0x34')));}function request(_0x476da2){logger[_0xcc38('0x35')]('[HTTP]',JSON[_0xcc38('0x36')](_0x476da2));return rp(_[_0xcc38('0x7')](_0x476da2,{'method':_0xcc38('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x262963,_0x4c77a9){var _0x229b06=[];if(_0x262963&&_0x262963[_0xcc38('0x27')]>0x0){_0x229b06=_['map'](_0x262963,_0x4c77a9);}return _0x229b06;}function getCustomFields(_0x16f8d6,_0x5386fb){var _0x5dc71c=[];var _0x3f78be={'custom_fields':[]};if(_0x16f8d6['length']>0x0){_['forEach'](_0x16f8d6,function(_0x2361a3){if(_[_0xcc38('0x38')]([_0xcc38('0x39'),_0xcc38('0x3a')],_0x2361a3[_0xcc38('0x3b')])&&_0x2361a3[_0xcc38('0x3c')]&&!_0x2361a3[_0xcc38('0x3d')]){_0x3f78be[_0x2361a3[_0xcc38('0x3c')][_0xcc38('0x3e')]()]=_0x2361a3[_0xcc38('0x3f')][_0xcc38('0x33')]();}else if(_['includes']([_0xcc38('0x39'),'picklist'],_0x2361a3[_0xcc38('0x3b')])&&_0x2361a3[_0xcc38('0x40')]&&_0x2361a3[_0xcc38('0x3d')]){_0x3f78be[_0xcc38('0x41')][_0xcc38('0x42')]({'id':_0x2361a3['idField'],'value':_0x2361a3[_0xcc38('0x3f')][_0xcc38('0x33')]()});}else if(_0x2361a3[_0xcc38('0x3b')]===_0xcc38('0x43')&&_0x2361a3[_0xcc38('0x44')]&&_0x2361a3['idField']&&_0x2361a3[_0xcc38('0x3d')]){_0x5386fb[_0x2361a3[_0xcc38('0x44')]]&&_0x3f78be[_0xcc38('0x41')]['push']({'id':_0x2361a3[_0xcc38('0x40')],'value':_0x5386fb[_0x2361a3['variableName']][_0xcc38('0x33')]()});}else if(_0x2361a3['type']===_0xcc38('0x45')&&_0x2361a3[_0xcc38('0x46')]&&_0x2361a3[_0xcc38('0x46')][_0xcc38('0x11')]&&_0x2361a3[_0xcc38('0x40')]&&_0x2361a3['customField']){_0x5386fb[_0x2361a3[_0xcc38('0x46')][_0xcc38('0x11')][_0xcc38('0x3e')]()]&&_0x3f78be[_0xcc38('0x41')][_0xcc38('0x42')]({'id':_0x2361a3['idField'],'value':_0x5386fb[_0x2361a3[_0xcc38('0x46')][_0xcc38('0x11')][_0xcc38('0x3e')]()][_0xcc38('0x33')]()});}});}return _0x3f78be;}exports[_0xcc38('0x47')]=function(_0x4f6090,_0x504d98,_0x1c5a3b,_0x1c88f3,_0x277af9,_0xbc315a){var _0x12f5da,_0x47ed1e;_0xbc315a[_0xcc38('0xf')]=intUtil['stripTrailingSlash'](_0xbc315a[_0xcc38('0xf')]);_0xbc315a[_0xcc38('0x48')]=intUtil[_0xcc38('0x49')](_0xbc315a[_0xcc38('0x48')]);if(_0x277af9&&_0x277af9['monitor_format']){logger[_0xcc38('0xb')](_0xcc38('0x4a'),_0xcc38('0x4b'));_0x504d98[_0xcc38('0x4c')]=util[_0xcc38('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xbc315a[_0xcc38('0x48')],_0x504d98['uniqueid'],md5(_0x504d98[_0xcc38('0x4d')]));}else{_0x504d98['recordingURL']='';}headers[_0xcc38('0x4e')]=getAuth(_0xbc315a);return getUser(_0xbc315a,_0x1c88f3['email'])['then'](function(_0xd873f9){_0x12f5da=_0xd873f9;logger[_0xcc38('0xb')](_0xcc38('0x4f'),_0x12f5da['id']);return getEndUser(_0xbc315a,_0x504d98[_0xcc38('0x50')],_0x504d98[_0xcc38('0x51')]);})[_0xcc38('0x16')](function(_0x576410){_0x47ed1e=_0x576410;logger[_0xcc38('0xb')](_0xcc38('0x52'),_0x47ed1e['id']);return getTicket(_0xbc315a,_0x12f5da,_0x47ed1e,_0x1c5a3b,_0x504d98);})['then'](function(_0x530c8e){if(_0x530c8e){logger['info'](_0xcc38('0x53'),_0x530c8e['id']);switch(_0xbc315a['type']){case _0xcc38('0x54'):logger[_0xcc38('0xb')]('[QUEUE]',_0xcc38('0x55'));return request({'uri':util[_0xcc38('0xd')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0xbc315a['remoteUri'],_0x12f5da['id'],_0x530c8e['id']),'method':_0xcc38('0x56')});case _0xcc38('0x57'):logger[_0xcc38('0xb')](_0xcc38('0x4a'),_0xcc38('0x58'));emit(util['format']('user:%s',_0x1c88f3[_0xcc38('0x11')]),_0xcc38('0x59'),{'uri':util[_0xcc38('0xd')](_0xcc38('0x5a'),_0xbc315a['remoteUri']['replace'](_0xcc38('0x5b'),''),_0x530c8e['id'])});break;default:logger[_0xcc38('0x5c')]('[QUEUE]',_0xcc38('0x5d'));}}})[_0xcc38('0x5e')](function(_0x81d000){logger[_0xcc38('0x5c')](_0xcc38('0x5f'),util[_0xcc38('0x60')](_0x81d000,{'showHidden':!![],'depth':null}));});};exports[_0xcc38('0x61')]=function(_0x405289,_0x2ccfee,_0x1d9a6e,_0x46c0ca,_0x3610bf,_0x5acd12,_0x1195fd){var _0x1c84e1,_0x3e4988;_0x5acd12['remoteUri']=intUtil[_0xcc38('0x49')](_0x5acd12[_0xcc38('0xf')]);_0x5acd12[_0xcc38('0x48')]=intUtil[_0xcc38('0x49')](_0x5acd12[_0xcc38('0x48')]);if(_0x1195fd&&_0x1195fd[_0xcc38('0x62')]&&_0x1195fd[_0xcc38('0x62')]!==_0xcc38('0x63')){logger['info'](_0xcc38('0x64'),_0xcc38('0x4b'));_0x2ccfee[_0xcc38('0x4c')]=util[_0xcc38('0xd')](_0xcc38('0x65'),_0x5acd12['serverUrl'],_0x2ccfee['uniqueid'],md5(_0x2ccfee[_0xcc38('0x4d')]));}headers[_0xcc38('0x4e')]=getAuth(_0x5acd12);return getUser(_0x5acd12,_0x46c0ca[_0xcc38('0x66')])[_0xcc38('0x16')](function(_0x117dca){_0x1c84e1=_0x117dca;logger[_0xcc38('0xb')](_0xcc38('0x4f'),_0x1c84e1['id']);return getEndUser(_0x5acd12,_0x2ccfee[_0xcc38('0x67')],_0x2ccfee['destcalleridnum']);})[_0xcc38('0x16')](function(_0x1cfc1e){_0x3e4988=_0x1cfc1e;logger[_0xcc38('0xb')](_0xcc38('0x52'),_0x3e4988['id']);return getTicket(_0x5acd12,_0x1c84e1,_0x3e4988,_0x1d9a6e,_0x2ccfee);})[_0xcc38('0x16')](function(_0xc8937e){if(_0xc8937e){logger[_0xcc38('0xb')]('The\x20Ticket\x20ID\x20is:',_0xc8937e['id']);switch(_0x5acd12[_0xcc38('0x3b')]){case _0xcc38('0x54'):logger['info'](_0xcc38('0x64'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xcc38('0xd')](_0xcc38('0x68'),_0x5acd12[_0xcc38('0xf')],_0x1c84e1['id'],_0xc8937e['id']),'method':_0xcc38('0x56')});case _0xcc38('0x57'):logger['info'](_0xcc38('0x64'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xcc38('0xd')](_0xcc38('0x69'),_0x46c0ca[_0xcc38('0x11')]),'trigger:browser:url',{'uri':util[_0xcc38('0xd')]('%s/agent/tickets/%s',_0x5acd12[_0xcc38('0xf')][_0xcc38('0x6a')](_0xcc38('0x5b'),''),_0xc8937e['id'])});break;default:logger[_0xcc38('0x5c')](_0xcc38('0x64'),_0xcc38('0x5d'));}}})['catch'](function(_0x166e72){logger[_0xcc38('0x5c')](_0xcc38('0x6b'),util[_0xcc38('0x60')](_0x166e72,{'showHidden':!![],'depth':null}));});};exports[_0xcc38('0x6c')]=function(_0x19a881,_0x55972f,_0x2252c0,_0xee84ce,_0x39b576,_0x1a280c){var _0x44db38,_0x10c1b2;_0x1a280c[_0xcc38('0xf')]=intUtil[_0xcc38('0x49')](_0x1a280c['remoteUri']);_0x1a280c[_0xcc38('0x48')]=intUtil[_0xcc38('0x49')](_0x1a280c['serverUrl']);if(_0x39b576&&_0x39b576['monitor_format']){logger[_0xcc38('0xb')]('['+_0x55972f['lastevent'][_0xcc38('0x6d')]()+']',_0xcc38('0x4b'));_0x55972f[_0xcc38('0x4c')]=util['format'](_0xcc38('0x65'),_0x1a280c[_0xcc38('0x48')],_0x55972f[_0xcc38('0x4d')],md5(_0x55972f[_0xcc38('0x4d')]));}else{_0x55972f[_0xcc38('0x4c')]='';}headers[_0xcc38('0x4e')]=getAuth(_0x1a280c);return getUser(_0x1a280c)['then'](function(_0x25fe62){_0x44db38=_0x25fe62;logger['info'](_0xcc38('0x4f'),_0x44db38['id']);return getEndUser(_0x1a280c,_0x55972f[_0xcc38('0x50')],_0x55972f[_0xcc38('0x51')]);})['then'](function(_0x1bab55){_0x10c1b2=_0x1bab55;logger['info']('The\x20Enduser\x20ID\x20is:',_0x10c1b2['id']);return getTicket(_0x1a280c,_0x44db38,_0x10c1b2,_0x2252c0,_0x55972f);})[_0xcc38('0x16')](function(_0x1eaa43){if(_0x1eaa43){logger[_0xcc38('0xb')]('The\x20Ticket\x20ID\x20is:',_0x1eaa43['id']);}})['catch'](function(_0x5b65d5){logger[_0xcc38('0x5c')]('['+_0x55972f['lastevent'][_0xcc38('0x6d')]()+']'+_0xcc38('0x6e'),util['inspect'](_0x5b65d5,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x4671=['find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','%s/search.json','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','base64','debug','[HTTP]','stringify','map','forEach','includes','string','type','nameField','customField','toLowerCase','toString','picklist','idField','custom_fields','push','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','%s/channels/voice/agents/%d/tickets/%d/display.json','POST','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/agent/tickets/%s','replace','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','none','[OUTBOUND]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:browser:url','/api/v2','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','monitor_format','lastevent','toUpperCase','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','ioredis','./util','../../../../config/environment','zendesk','defaults','redis','socket.io-emitter','application/json','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','name','getString','Descriptions','Fields','then','info','Ticket\x20created!','ticket','validateEmail','type:user\x20role:agent\x20email:%s'];(function(_0x2b2c49,_0x623189){var _0x53d691=function(_0x20d18d){while(--_0x20d18d){_0x2b2c49['push'](_0x2b2c49['shift']());}};_0x53d691(++_0x623189);}(_0x4671,0xbb));var _0x1467=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4671[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x1467('0x0'));var rp=require(_0x1467('0x1'));var md5=require(_0x1467('0x2'));var util=require('util');var Redis=require(_0x1467('0x3'));var intUtil=require(_0x1467('0x4'));var config=require(_0x1467('0x5'));var logger=require('../../../../config/logger')(_0x1467('0x6'));config['redis']=_[_0x1467('0x7')](config[_0x1467('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x1467('0x9'))(new Redis(config[_0x1467('0x8')]));function emit(_0x5e1f4b,_0x3d2805,_0x431e5b){io['to'](_0x5e1f4b)['emit'](_0x3d2805,_0x431e5b);}var headers={'Content-Type':_0x1467('0xa'),'Accept':_0x1467('0xa')};function getTicket(_0xbeb44f,_0x1d1a8c,_0x2d8196,_0x3c5b3d,_0x5465f8){logger['info'](_0x1467('0xb'));return request({'uri':util[_0x1467('0xc')](_0x1467('0xd'),_0xbeb44f[_0x1467('0xe')]),'method':'POST','body':{'ticket':_['merge']({'requester_id':_0x2d8196['id'],'submitter_id':_0x1d1a8c?_0x1d1a8c['id']:undefined,'assignee_id':_0x1d1a8c?_0x1d1a8c['id']:undefined,'tags':getTags(_0x3c5b3d['Tags'],_0x1467('0xf')),'subject':intUtil[_0x1467('0x10')](_0x3c5b3d['Subjects'],_0x5465f8,'\x20'),'description':intUtil[_0x1467('0x10')](_0x3c5b3d[_0x1467('0x11')],_0x5465f8,'\x0a'),'comment':{'public':![],'body':intUtil[_0x1467('0x10')](_0x3c5b3d[_0x1467('0x11')],_0x5465f8,'\x0a')}},getCustomFields(_0x3c5b3d[_0x1467('0x12')],_0x5465f8))}})[_0x1467('0x13')](function(_0x52de97){logger[_0x1467('0x14')](_0x1467('0x15'));return _0x52de97[_0x1467('0x16')];});}function getUser(_0x119fe2,_0x23936d){if(intUtil[_0x1467('0x17')](_0x23936d)){logger[_0x1467('0x14')]('Getting\x20agent\x20with\x20email',_0x23936d);return request({'uri':util[_0x1467('0xc')]('%s/search.json',_0x119fe2[_0x1467('0xe')]),'qs':{'query':util[_0x1467('0xc')](_0x1467('0x18'),_0x23936d)}})['then'](function(_0x1d5830){if(_0x1d5830['count']){logger[_0x1467('0x14')]('Agent\x20found!');return _[_0x1467('0x19')](_0x1d5830[_0x1467('0x1a')],{'email':_0x23936d,'role':_0x1467('0x1b')});}else{logger[_0x1467('0x14')](_0x1467('0x1c'));return request({'uri':util[_0x1467('0xc')]('%s/users/me.json',_0x119fe2[_0x1467('0xe')])})[_0x1467('0x13')](function(_0x40f013){logger['info'](_0x1467('0x1d'));return _0x40f013[_0x1467('0x1e')];});}});}else{logger[_0x1467('0x14')](_0x1467('0x1c'));return request({'uri':util['format']('%s/users/me.json',_0x119fe2[_0x1467('0xe')])})[_0x1467('0x13')](function(_0x31b4bc){logger[_0x1467('0x14')]('Admin\x20account\x20selected.');return _0x31b4bc[_0x1467('0x1e')];});}}function getEndUser(_0x4c435a,_0x5e8673,_0x53a2df){logger[_0x1467('0x14')]('Searching\x20enduser\x20with\x20phone',_0x53a2df);return request({'uri':util[_0x1467('0xc')](_0x1467('0x1f'),_0x4c435a[_0x1467('0xe')]),'qs':{'query':util['format'](_0x1467('0x20'),_0x53a2df)}})[_0x1467('0x13')](function(_0x437984){var _0x23da81;if(_0x437984['results'][_0x1467('0x21')]){_0x437984[_0x1467('0x1a')]=_[_0x1467('0x22')](_0x437984[_0x1467('0x1a')],{'suspended':![],'role':_0x1467('0x23')});if(_0x437984[_0x1467('0x1a')][_0x1467('0x21')]){_0x23da81=_[_0x1467('0x24')](_0x437984[_0x1467('0x1a')]);}}if(_0x23da81){logger['info']('Enduser\x20found!');return _0x23da81;}else{logger[_0x1467('0x14')](_0x1467('0x25'));return request({'uri':util['format'](_0x1467('0x26'),_0x4c435a[_0x1467('0xe')]),'method':'POST','body':{'user':{'role':_0x1467('0x23'),'name':util[_0x1467('0xc')](_0x1467('0x27'),_0x5e8673||_0x53a2df),'phone':_0x53a2df}}})[_0x1467('0x13')](function(_0x123fe1){logger['info'](_0x1467('0x28'));return _0x123fe1[_0x1467('0x1e')];});}});}function getAuth(_0x341b10){var _0x40a629;if(_0x341b10[_0x1467('0x29')]===_0x1467('0x2a')){_0x40a629=util[_0x1467('0xc')](_0x1467('0x2b'),_0x341b10[_0x1467('0x2c')],_0x341b10[_0x1467('0x2a')]);}else if(_0x341b10[_0x1467('0x29')]==='token'){_0x40a629=util[_0x1467('0xc')]('%s/token:%s',_0x341b10[_0x1467('0x2c')],_0x341b10[_0x1467('0x2d')]);}return util[_0x1467('0xc')]('Basic\x20%s',new Buffer(_0x40a629)['toString'](_0x1467('0x2e')));}function request(_0x4280cd){logger[_0x1467('0x2f')](_0x1467('0x30'),JSON[_0x1467('0x31')](_0x4280cd));return rp(_[_0x1467('0x7')](_0x4280cd,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x34cc50,_0x1c4bb1){var _0x3d3ee3=[];if(_0x34cc50&&_0x34cc50['length']>0x0){_0x3d3ee3=_[_0x1467('0x32')](_0x34cc50,_0x1c4bb1);}return _0x3d3ee3;}function getCustomFields(_0x2ceee7,_0x33225d){var _0x3a9730=[];var _0x41665={'custom_fields':[]};if(_0x2ceee7[_0x1467('0x21')]>0x0){_[_0x1467('0x33')](_0x2ceee7,function(_0x46afeb){if(_[_0x1467('0x34')]([_0x1467('0x35'),'picklist'],_0x46afeb[_0x1467('0x36')])&&_0x46afeb[_0x1467('0x37')]&&!_0x46afeb[_0x1467('0x38')]){_0x41665[_0x46afeb[_0x1467('0x37')][_0x1467('0x39')]()]=_0x46afeb['content'][_0x1467('0x3a')]();}else if(_[_0x1467('0x34')]([_0x1467('0x35'),_0x1467('0x3b')],_0x46afeb[_0x1467('0x36')])&&_0x46afeb[_0x1467('0x3c')]&&_0x46afeb[_0x1467('0x38')]){_0x41665[_0x1467('0x3d')][_0x1467('0x3e')]({'id':_0x46afeb[_0x1467('0x3c')],'value':_0x46afeb['content'][_0x1467('0x3a')]()});}else if(_0x46afeb['type']==='variable'&&_0x46afeb[_0x1467('0x3f')]&&_0x46afeb[_0x1467('0x3c')]&&_0x46afeb[_0x1467('0x38')]){_0x33225d[_0x46afeb['variableName']]&&_0x41665[_0x1467('0x3d')][_0x1467('0x3e')]({'id':_0x46afeb['idField'],'value':_0x33225d[_0x46afeb['variableName']][_0x1467('0x3a')]()});}else if(_0x46afeb['type']===_0x1467('0x40')&&_0x46afeb[_0x1467('0x41')]&&_0x46afeb[_0x1467('0x41')]['name']&&_0x46afeb[_0x1467('0x3c')]&&_0x46afeb['customField']){_0x33225d[_0x46afeb['Variable'][_0x1467('0xf')]['toLowerCase']()]&&_0x41665[_0x1467('0x3d')][_0x1467('0x3e')]({'id':_0x46afeb[_0x1467('0x3c')],'value':_0x33225d[_0x46afeb['Variable'][_0x1467('0xf')][_0x1467('0x39')]()]['toString']()});}});}return _0x41665;}exports[_0x1467('0x42')]=function(_0x3a494d,_0x518c01,_0xdcb13a,_0x1f41c7,_0x7df31f,_0x5c7b2a){var _0xe59868,_0x4c393d;_0x5c7b2a['remoteUri']=intUtil[_0x1467('0x43')](_0x5c7b2a[_0x1467('0xe')]);_0x5c7b2a[_0x1467('0x44')]=intUtil['stripTrailingSlash'](_0x5c7b2a[_0x1467('0x44')]);if(_0x7df31f&&_0x7df31f['monitor_format']){logger[_0x1467('0x14')](_0x1467('0x45'),'Recording\x20is\x20enabled!');_0x518c01[_0x1467('0x46')]=util[_0x1467('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5c7b2a[_0x1467('0x44')],_0x518c01[_0x1467('0x47')],md5(_0x518c01[_0x1467('0x47')]));}else{_0x518c01['recordingURL']='';}headers[_0x1467('0x48')]=getAuth(_0x5c7b2a);return getUser(_0x5c7b2a,_0x1f41c7[_0x1467('0x49')])[_0x1467('0x13')](function(_0x5541eb){_0xe59868=_0x5541eb;logger[_0x1467('0x14')](_0x1467('0x4a'),_0xe59868['id']);return getEndUser(_0x5c7b2a,_0x518c01['calleridname'],_0x518c01['calleridnum']);})['then'](function(_0x7d065c){_0x4c393d=_0x7d065c;logger[_0x1467('0x14')](_0x1467('0x4b'),_0x4c393d['id']);return getTicket(_0x5c7b2a,_0xe59868,_0x4c393d,_0xdcb13a,_0x518c01);})['then'](function(_0x56cdb0){if(_0x56cdb0){logger[_0x1467('0x14')]('The\x20Ticket\x20ID\x20is:',_0x56cdb0['id']);switch(_0x5c7b2a[_0x1467('0x36')]){case'integrationTab':logger[_0x1467('0x14')](_0x1467('0x45'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x1467('0xc')](_0x1467('0x4c'),_0x5c7b2a[_0x1467('0xe')],_0xe59868['id'],_0x56cdb0['id']),'method':_0x1467('0x4d')});case _0x1467('0x4e'):logger[_0x1467('0x14')]('[QUEUE]',_0x1467('0x4f'));emit(util[_0x1467('0xc')]('user:%s',_0x1f41c7[_0x1467('0xf')]),'trigger:browser:url',{'uri':util['format'](_0x1467('0x50'),_0x5c7b2a[_0x1467('0xe')][_0x1467('0x51')]('/api/v2',''),_0x56cdb0['id'])});break;default:logger[_0x1467('0x52')](_0x1467('0x45'),_0x1467('0x53'));}}})[_0x1467('0x54')](function(_0x59453d){logger[_0x1467('0x52')](_0x1467('0x55'),util[_0x1467('0x56')](_0x59453d,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x2bcad7,_0x4ea443,_0x1251b1,_0x500745,_0x46ef97,_0x9d861c,_0x173bfc){var _0xcb5f20,_0x3a7067;_0x9d861c[_0x1467('0xe')]=intUtil[_0x1467('0x43')](_0x9d861c[_0x1467('0xe')]);_0x9d861c[_0x1467('0x44')]=intUtil[_0x1467('0x43')](_0x9d861c['serverUrl']);if(_0x173bfc&&_0x173bfc['recordingFormat']&&_0x173bfc['recordingFormat']!==_0x1467('0x57')){logger['info'](_0x1467('0x58'),_0x1467('0x59'));_0x4ea443[_0x1467('0x46')]=util[_0x1467('0xc')](_0x1467('0x5a'),_0x9d861c['serverUrl'],_0x4ea443[_0x1467('0x47')],md5(_0x4ea443[_0x1467('0x47')]));}headers[_0x1467('0x48')]=getAuth(_0x9d861c);return getUser(_0x9d861c,_0x500745[_0x1467('0x49')])[_0x1467('0x13')](function(_0x3368f7){_0xcb5f20=_0x3368f7;logger['info'](_0x1467('0x4a'),_0xcb5f20['id']);return getEndUser(_0x9d861c,_0x4ea443[_0x1467('0x5b')],_0x4ea443[_0x1467('0x5c')]);})['then'](function(_0x126062){_0x3a7067=_0x126062;logger[_0x1467('0x14')](_0x1467('0x4b'),_0x3a7067['id']);return getTicket(_0x9d861c,_0xcb5f20,_0x3a7067,_0x1251b1,_0x4ea443);})[_0x1467('0x13')](function(_0x43a5dd){if(_0x43a5dd){logger[_0x1467('0x14')]('The\x20Ticket\x20ID\x20is:',_0x43a5dd['id']);switch(_0x9d861c[_0x1467('0x36')]){case'integrationTab':logger[_0x1467('0x14')](_0x1467('0x58'),_0x1467('0x5d'));return request({'uri':util[_0x1467('0xc')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x9d861c[_0x1467('0xe')],_0xcb5f20['id'],_0x43a5dd['id']),'method':_0x1467('0x4d')});case'newTab':logger[_0x1467('0x14')](_0x1467('0x58'),_0x1467('0x4f'));emit(util[_0x1467('0xc')](_0x1467('0x5e'),_0x500745['name']),_0x1467('0x5f'),{'uri':util[_0x1467('0xc')](_0x1467('0x50'),_0x9d861c[_0x1467('0xe')]['replace'](_0x1467('0x60'),''),_0x43a5dd['id'])});break;default:logger[_0x1467('0x52')](_0x1467('0x58'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x1467('0x54')](function(_0x326f95){logger[_0x1467('0x52')](_0x1467('0x61'),util[_0x1467('0x56')](_0x326f95,{'showHidden':!![],'depth':null}));});};exports[_0x1467('0x62')]=function(_0x35c290,_0x4abcb6,_0x58c2ce,_0x16a2c3,_0x4858c6,_0x288467){var _0x35aaa,_0x54e8b5;_0x288467[_0x1467('0xe')]=intUtil['stripTrailingSlash'](_0x288467[_0x1467('0xe')]);_0x288467['serverUrl']=intUtil[_0x1467('0x43')](_0x288467[_0x1467('0x44')]);if(_0x4858c6&&_0x4858c6[_0x1467('0x63')]){logger[_0x1467('0x14')]('['+_0x4abcb6[_0x1467('0x64')][_0x1467('0x65')]()+']',_0x1467('0x59'));_0x4abcb6['recordingURL']=util[_0x1467('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x288467[_0x1467('0x44')],_0x4abcb6[_0x1467('0x47')],md5(_0x4abcb6[_0x1467('0x47')]));}else{_0x4abcb6[_0x1467('0x46')]='';}headers[_0x1467('0x48')]=getAuth(_0x288467);return getUser(_0x288467)[_0x1467('0x13')](function(_0x3f6f06){_0x35aaa=_0x3f6f06;logger[_0x1467('0x14')](_0x1467('0x4a'),_0x35aaa['id']);return getEndUser(_0x288467,_0x4abcb6[_0x1467('0x66')],_0x4abcb6[_0x1467('0x67')]);})[_0x1467('0x13')](function(_0x4256ab){_0x54e8b5=_0x4256ab;logger[_0x1467('0x14')]('The\x20Enduser\x20ID\x20is:',_0x54e8b5['id']);return getTicket(_0x288467,_0x35aaa,_0x54e8b5,_0x58c2ce,_0x4abcb6);})[_0x1467('0x13')](function(_0x403b48){if(_0x403b48){logger[_0x1467('0x14')](_0x1467('0x68'),_0x403b48['id']);}})[_0x1467('0x54')](function(_0x2c4011){logger[_0x1467('0x52')]('['+_0x4abcb6['lastevent']['toUpperCase']()+']'+_0x1467('0x69'),util['inspect'](_0x2c4011,{'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 43abe47..f6d87a7 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 _0xe95f=['Using\x20the\x20admin\x20account!','profile','user','Administrator','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','data','catch','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','details','enduserType','Error:\x20','log','CREATE\x20ERROR','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','contact','lead','nothing','Creating\x20new\x20call...','Subject','Subjects','Description','getString','Descriptions','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','utc','talktime','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','Fields','/crm/v2/Calls','SUCCESS','err','queue','host','stripTrailingSlash','serverUrl','recordingURL','uniqueid','/downloads?type=uniqueid&token=','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','/api/voice/recordings/','zoho.eu','destcalleridname','destcalleridnum','Outbound','https://crm.','/crm/EntityInfo.do?module=Calls&id=','monitor_format','lastevent','toUpperCase','lodash','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/logger','zoho','redis','defaults','localhost','debug','[HTTP]','stringify','length','forEach','includes','string','picklist','type','idField','content','variable','variableName','Variable','name','toLowerCase','toString','indexOf','split','isNil','access_token','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','error','Failing\x20creating\x20the\x20access_token','info','Search\x20user','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!'];(function(_0x4dd8fe,_0x18c473){var _0x2d8aca=function(_0x50d70d){while(--_0x50d70d){_0x4dd8fe['push'](_0x4dd8fe['shift']());}};_0x2d8aca(++_0x18c473);}(_0xe95f,0x64));var _0xfe95=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe95f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfe95('0x0'));var rp=require(_0xfe95('0x1'));var md5=require(_0xfe95('0x2'));var util=require(_0xfe95('0x3'));var intUtil=require(_0xfe95('0x4'));var moment=require(_0xfe95('0x5'));var Redis=require(_0xfe95('0x6'));var BPromise=require(_0xfe95('0x7'));var config=require('../../../../config/environment');var logger=require(_0xfe95('0x8'))(_0xfe95('0x9'));config[_0xfe95('0xa')]=_[_0xfe95('0xb')](config[_0xfe95('0xa')],{'host':_0xfe95('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xfe95('0xa')]));function emit(_0x2dbb30,_0xa208a1,_0x580c10){io['to'](_0x2dbb30)['emit'](_0xa208a1,_0x580c10);}function request(_0x300254){logger[_0xfe95('0xd')](_0xfe95('0xe'),JSON[_0xfe95('0xf')](_0x300254));return rp(_0x300254);}function getCustomFields(_0x258cdf,_0x2ff69e){var _0x1fe7db={};if(_0x258cdf[_0xfe95('0x10')]>0x0){_[_0xfe95('0x11')](_0x258cdf,function(_0x1ad17f){if(_[_0xfe95('0x12')]([_0xfe95('0x13'),_0xfe95('0x14')],_0x1ad17f[_0xfe95('0x15')])&&_0x1ad17f[_0xfe95('0x16')]){_0x1fe7db[_0x1ad17f[_0xfe95('0x16')]]=_0x1ad17f[_0xfe95('0x17')]['toString']();}else if(_0x1ad17f[_0xfe95('0x15')]===_0xfe95('0x18')&&_0x1ad17f[_0xfe95('0x19')]&&_0x1ad17f[_0xfe95('0x16')]&&_0x2ff69e[_0x1ad17f['variableName']]){_0x1fe7db[_0x1ad17f['idField']]=_0x2ff69e[_0x1ad17f[_0xfe95('0x19')]]['toString']();}else if(_0x1ad17f[_0xfe95('0x15')]==='customVariable'&&_0x1ad17f[_0xfe95('0x1a')]&&_0x1ad17f[_0xfe95('0x1a')]['name']&&_0x1ad17f[_0xfe95('0x16')]&&_0x2ff69e[_0x1ad17f[_0xfe95('0x1a')][_0xfe95('0x1b')][_0xfe95('0x1c')]()]){_0x1fe7db[_0x1ad17f[_0xfe95('0x16')]]=_0x2ff69e[_0x1ad17f[_0xfe95('0x1a')][_0xfe95('0x1b')]['toLowerCase']()][_0xfe95('0x1d')]();}});}return _0x1fe7db;}function getName(_0xf951ac){if(_0xf951ac[_0xfe95('0x1e')]('\x20')>0x0){var _0xb565f0=_0xf951ac[_0xfe95('0x1f')](/ (.+)/);if(_0xb565f0[0x1]){return _0xb565f0;}}return[_0xf951ac,_0xf951ac];}var accountsTokens={};function getAccessToken(_0x48a731){return new Promise(function(_0x4319d6,_0x10c6f8){if(!_['isNil'](accountsTokens[_0x48a731['id']])&&!_[_0xfe95('0x20')](accountsTokens[_0x48a731['id']][_0xfe95('0x21')])){if(moment()['isBefore'](accountsTokens[_0x48a731['id']][_0xfe95('0x22')])){_0x4319d6(accountsTokens[_0x48a731['id']][_0xfe95('0x21')]);}}var _0x199e1e;switch(_0x48a731[_0xfe95('0x23')]){case'US':_0x199e1e=_0xfe95('0x24');break;case'AU':_0x199e1e=_0xfe95('0x25');break;case'EU':_0x199e1e=_0xfe95('0x26');break;case'IN':_0x199e1e=_0xfe95('0x27');break;case'CN':_0x199e1e=_0xfe95('0x28');break;default:_0x199e1e='https://accounts.zoho.eu';break;}var _0x4418c0={'method':_0xfe95('0x29'),'uri':_0x199e1e+_0xfe95('0x2a'),'qs':{'refresh_token':_0x48a731[_0xfe95('0x2b')],'client_id':_0x48a731[_0xfe95('0x2c')],'client_secret':_0x48a731[_0xfe95('0x2d')],'grant_type':_0xfe95('0x2e')},'json':!![]};return rp(_0x4418c0)[_0xfe95('0x2f')](function(_0x45b121){accountsTokens[_0x48a731['id']]={'access_token':_0x45b121['access_token'],'expires_in':moment()[_0xfe95('0x30')](_0x45b121['expires_in'],_0xfe95('0x31'))};_0x4319d6(_0x45b121['access_token']);})['catch'](function(_0xaa9431){logger[_0xfe95('0x32')](_0xfe95('0x33'),_0xaa9431['stack']);_0x10c6f8(_0xaa9431);});});}function getUser(_0x59a69d,_0x333a75,_0x2e9d7f,_0x2a627c){logger[_0xfe95('0x34')](_0xfe95('0x35'));return request({'method':'GET','uri':util[_0xfe95('0x36')](_0xfe95('0x37'),_0x333a75),'qs':{'type':_0xfe95('0x38')},'headers':{'Authorization':_0xfe95('0x39')+_0x59a69d},'json':!![]})[_0xfe95('0x2f')](function(_0x545588){if(_0x545588[_0xfe95('0x3a')]){var _0x3e5f95=-0x1;if(_[_0xfe95('0x3b')](_0x545588[_0xfe95('0x3a')])){if(!_[_0xfe95('0x20')](_0x2a627c)){_0x3e5f95=_[_0xfe95('0x3c')](_0x545588[_0xfe95('0x3a')],function(_0x2e7171){return _0x2e7171[_0xfe95('0x3d')]===_0x2a627c;});}if(_0x3e5f95>=0x0){logger[_0xfe95('0x34')](_0xfe95('0x3e'));}else{logger[_0xfe95('0x34')](_0xfe95('0x3f'));_0x3e5f95=_[_0xfe95('0x3c')](_0x545588[_0xfe95('0x3a')],function(_0xd651bc){return _0xd651bc[_0xfe95('0x40')][_0xfe95('0x1b')]==='Administrator';});}return _0x545588['users'][_0x3e5f95];}else{if(_0x545588[_0xfe95('0x41')]['profile']['name']===_0xfe95('0x42')){logger[_0xfe95('0x34')](_0xfe95('0x3f'));user=_0x545588[_0xfe95('0x41')];return user;}else{logger['error']('The\x20failing\x20result\x20is',JSON[_0xfe95('0xf')](_0x545588));throw new Error(_0xfe95('0x43')+JSON[_0xfe95('0xf')](_0x545588));}}}else{logger[_0xfe95('0x32')](_0xfe95('0x44'),JSON[_0xfe95('0xf')](_0x545588));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xfe95('0xf')](_0x545588));}})['catch'](function(_0x1beaaf){console['error'](_0x1beaaf);});}function getZohoUser(_0x3590aa,_0x40aa5f){return new BPromise(function(_0x1bce44,_0x58c3e8){request(_0x3590aa)['then'](function(_0x52ec6e){var _0x432b07=null;if(_0x52ec6e){_0x432b07=_0x52ec6e[_0xfe95('0x45')][0x0];_0x432b07['enduserType']=_0x40aa5f;}_0x1bce44(_0x432b07);})[_0xfe95('0x46')](function(_0x30189d){_0x58c3e8(_0x30189d);});});}function createEndUser(_0x400701,_0x4cbcd2,_0x261072,_0x3986e3,_0x44d147,_0xf2083a){var _0x261072=getName(_0x261072);return request({'method':_0xfe95('0x29'),'uri':_0xfe95('0x47')+_0x4cbcd2+_0xfe95('0x48')+_[_0xfe95('0x49')](_0xf2083a[_0xfe95('0x4a')])+'s','body':{'data':[{'Last_Name':_0x261072[0x1],'First_Name':_0x261072[0x0],'Phone':_0x3986e3,'Owner':{'name':!_[_0xfe95('0x20')](_0x44d147[_0xfe95('0x4b')][_0xfe95('0x1b')])?_0x44d147['role']['name']:!_[_0xfe95('0x20')](_0x44d147[_0xfe95('0x4c')])?_0x44d147[_0xfe95('0x4c')]+'\x20'+_0x44d147[_0xfe95('0x4d')]:_0x44d147[_0xfe95('0x4d')],'id':_0x44d147['id']}}]},'headers':{'Authorization':_0xfe95('0x39')+_0x400701},'json':!![]})['then'](function(_0x11980e){if(_0x11980e&&_0x11980e[_0xfe95('0x45')][0x0][_0xfe95('0x4e')]==='SUCCESS'){var _0x23d420=_0x11980e['data'][0x0][_0xfe95('0x4f')];_0x23d420[_0xfe95('0x50')]=_['startCase'](_0xf2083a[_0xfe95('0x4a')])+'s';return _0x23d420;}logger[_0xfe95('0x32')](_0xfe95('0x44'),JSON[_0xfe95('0xf')](data));throw new Error(_0xfe95('0x51')+JSON[_0xfe95('0xf')](data));})[_0xfe95('0x46')](function(_0x3d0de9){console[_0xfe95('0x52')](_0xfe95('0x53'),_0x3d0de9);});}function getEndUser(_0x1092f6,_0x5c1fb1,_0x3f14c5,_0x2c335c,_0xae67a5,_0x54da20,_0x19c5fa){var _0x9484e6={'method':'GET','uri':'','headers':{'Authorization':_0xfe95('0x39')+_0x1092f6},'json':!![]};switch(_0x19c5fa['moduleSearch']){case _0xfe95('0x54'):_0x9484e6[_0xfe95('0x55')]='https://www.zohoapis.'+_0x5c1fb1+_0xfe95('0x56')+_0xae67a5+'))';return getZohoUser(_0x9484e6,_0xfe95('0x57'))[_0xfe95('0x2f')](function(_0x472732){if(_0x472732)return _0x472732;_0x9484e6[_0xfe95('0x55')]='https://www.zohoapis.'+_0x5c1fb1+_0xfe95('0x58')+_0xae67a5+'))';return getZohoUser(_0x9484e6,_0xfe95('0x59'))[_0xfe95('0x2f')](function(_0xcc0f07){if(_0xcc0f07)return _0xcc0f07;if(_0x19c5fa[_0xfe95('0x4a')]!='nothing'){return createEndUser(_0x1092f6,_0x5c1fb1,_0x2c335c,_0xae67a5,_0x54da20,_0x19c5fa);}else{return{};}});});break;case _0xfe95('0x5a'):_0x9484e6[_0xfe95('0x55')]='https://www.zohoapis.'+_0x5c1fb1+_0xfe95('0x56')+_0xae67a5+'))';return getZohoUser(_0x9484e6,_0xfe95('0x57'))['then'](function(_0x111fcb){if(_0x111fcb)return _0x111fcb;if(_0x19c5fa[_0xfe95('0x4a')]!='nothing'){return createEndUser(_0x1092f6,_0x5c1fb1,_0x2c335c,_0xae67a5,_0x54da20,_0x19c5fa);}else{return{};}});break;case _0xfe95('0x5b'):_0x9484e6[_0xfe95('0x55')]='https://www.zohoapis.'+_0x5c1fb1+_0xfe95('0x58')+_0xae67a5+'))';return getZohoUser(_0x9484e6,_0xfe95('0x59'))[_0xfe95('0x2f')](function(_0x143f31){if(_0x143f31)return _0x143f31;if(_0x19c5fa[_0xfe95('0x4a')]!=_0xfe95('0x5c')){return createEndUser(_0x1092f6,_0x5c1fb1,_0x2c335c,_0xae67a5,_0x54da20,_0x19c5fa);}else{return{};}});break;}}function getCall(_0x3bc387,_0x345f8b,_0x139aeb,_0x327c3f,_0x75a308,_0x35db9e,_0x17e8b2,_0x13bbc5){logger['info'](_0xfe95('0x5d'));var _0xa7308a={};_0xa7308a['Owner']={'name':!_[_0xfe95('0x20')](_0x327c3f[_0xfe95('0x4b')][_0xfe95('0x1b')])&&!_[_0xfe95('0x20')](_0x327c3f[_0xfe95('0x40')][_0xfe95('0x1b')])&&_0x327c3f[_0xfe95('0x40')][_0xfe95('0x1b')]==='administrator'?_0x327c3f[_0xfe95('0x4b')]['name']:!_[_0xfe95('0x20')](_0x327c3f[_0xfe95('0x4c')])?_0x327c3f[_0xfe95('0x4c')]+'\x20'+_0x327c3f[_0xfe95('0x4d')]:_0x327c3f[_0xfe95('0x4d')],'id':_0x327c3f['id']};_0xa7308a[_0xfe95('0x5e')]=intUtil['getString'](_0x35db9e[_0xfe95('0x5f')],_0x17e8b2,'\x20');_0xa7308a[_0xfe95('0x60')]=intUtil[_0xfe95('0x61')](_0x35db9e[_0xfe95('0x62')],_0x17e8b2,'\x0a');if(_0x75a308[_0xfe95('0x50')]===_0xfe95('0x57')){_0xa7308a['Who_Id']={'name':!_['isNil'](_0x75a308['Full_Name'])?_0x75a308[_0xfe95('0x63')]:!_['isNil'](_0x75a308[_0xfe95('0x64')])?_0x75a308[_0xfe95('0x64')]+'\x20'+_0x75a308[_0xfe95('0x65')]:_0x75a308[_0xfe95('0x65')],'id':_0x75a308['id']};}if(_0x75a308['enduserType']===_0xfe95('0x59')){_0xa7308a[_0xfe95('0x66')]={'name':!_['isNil'](_0x75a308[_0xfe95('0x63')])?_0x75a308['Full_Name']:!_[_0xfe95('0x20')](_0x75a308['First_Name'])?_0x75a308[_0xfe95('0x64')]+'\x20'+_0x75a308[_0xfe95('0x65')]:_0x75a308[_0xfe95('0x65')],'id':_0x75a308['id']};_0xa7308a[_0xfe95('0x67')]=_[_0xfe95('0x49')](_0x75a308['enduserType']);}if(_0x17e8b2['talktime']){_0xa7308a[_0xfe95('0x68')]=moment[_0xfe95('0x69')](parseInt(_0x17e8b2[_0xfe95('0x6a')])*0x3e8)[_0xfe95('0x36')](_0xfe95('0x6b'));}else if(_0x17e8b2[_0xfe95('0x6c')]&&_0x17e8b2[_0xfe95('0x6d')]){_0xa7308a[_0xfe95('0x68')]=moment[_0xfe95('0x69')](moment(_0x17e8b2['endtime'],_0xfe95('0x6e'))[_0xfe95('0x6f')](moment(_0x17e8b2[_0xfe95('0x70')],_0xfe95('0x6e'))))[_0xfe95('0x36')](_0xfe95('0x6b'));}switch(_0x17e8b2['lastevent']){case _0xfe95('0x71'):_0xa7308a[_0xfe95('0x72')]=_0xfe95('0x73');break;case _0xfe95('0x74'):case _0xfe95('0x75'):_0xa7308a[_0xfe95('0x72')]=_0xfe95('0x76');break;case _0xfe95('0x77'):_0xa7308a[_0xfe95('0x72')]=_0xfe95('0x78');break;case _0xfe95('0x79'):_0xa7308a[_0xfe95('0x72')]=_0xfe95('0x7a');break;case _0xfe95('0x7b'):_0xa7308a[_0xfe95('0x72')]='Timeout';default:}_0xa7308a[_0xfe95('0x7c')]=(_0x13bbc5===_0xfe95('0x7d')?moment(_0x17e8b2[_0xfe95('0x70')])['format']('YYYY-MM-DDTHH:mm:ss'):moment(_0x17e8b2[_0xfe95('0x7e')])[_0xfe95('0x36')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0xfe95('0x36')](_0xfe95('0x6e'));_0xa7308a[_0xfe95('0x7f')]=_0x13bbc5||_0xfe95('0x80');_0xa7308a=_['merge'](_0xa7308a,getCustomFields(_0x35db9e[_0xfe95('0x81')],_0x17e8b2));return request({'method':'POST','uri':_0xfe95('0x47')+_0x345f8b+_0xfe95('0x82'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3bc387},'body':{'data':[_0xa7308a]},'json':!![]})['then'](function(_0x3da38c){if(_0x3da38c&&_0x3da38c[_0xfe95('0x45')][0x0][_0xfe95('0x4e')]===_0xfe95('0x83')){logger['info']('Call\x20created!');return{'id':_0x3da38c[_0xfe95('0x45')][0x0][_0xfe95('0x4f')]['id']};}})['catch'](function(_0x8874f1){logger['info']('err',_0x8874f1['stack']);console[_0xfe95('0x52')](_0xfe95('0x84'),_0x8874f1);});}exports[_0xfe95('0x85')]=function(_0xd8d31c,_0x146338,_0x1ebe9a,_0x3c3e70,_0x4db536,_0x1fd0e5){var _0x478cc7,_0x299010,_0x1177b1;_0x1fd0e5[_0xfe95('0x86')]=intUtil[_0xfe95('0x87')](_0x1fd0e5['host']);_0x1fd0e5[_0xfe95('0x88')]=intUtil[_0xfe95('0x87')](_0x1fd0e5['serverUrl']);if(_0x4db536&&_0x4db536['monitor_format']){logger[_0xfe95('0x34')]('[QUEUE]','Recording\x20is\x20enabled!');_0x146338[_0xfe95('0x89')]=_0x1fd0e5[_0xfe95('0x88')]+'/api/voice/recordings/'+_0x146338[_0xfe95('0x8a')]+_0xfe95('0x8b')+md5(_0x146338['uniqueid']);}else{_0x146338[_0xfe95('0x89')]='';}var _0xac16f0=_0x1fd0e5[_0xfe95('0x86')]==='zoho.eu'?'eu':_0xfe95('0x8c');return getAccessToken(_0x1fd0e5)[_0xfe95('0x2f')](function(_0xa91395){_0x1177b1=_0xa91395;return getUser(_0x1177b1,_0xac16f0,_0x1fd0e5,_0x3c3e70[_0xfe95('0x3d')]);})[_0xfe95('0x2f')](function(_0x403819){_0x478cc7=_0x403819;logger[_0xfe95('0x34')](_0xfe95('0x8d'),_0x478cc7['id']);return getEndUser(_0x1177b1,_0xac16f0,_0x1fd0e5,_0x146338[_0xfe95('0x8e')],_0x146338[_0xfe95('0x8f')],_0x478cc7,_0x1ebe9a);})[_0xfe95('0x2f')](function(_0x2513dc){_0x299010=_0x2513dc;return getCall(_0x1177b1,_0xac16f0,_0x1fd0e5,_0x478cc7,_0x299010,_0x1ebe9a,_0x146338,'Inbound');})[_0xfe95('0x2f')](function(_0x1c003f){if(_0x1c003f){logger[_0xfe95('0x34')](_0xfe95('0x90'),_0x1c003f['id']);logger['info'](_0xfe95('0x91'),_0xfe95('0x92'));emit(util[_0xfe95('0x36')](_0xfe95('0x93'),_0x3c3e70[_0xfe95('0x1b')]),_0xfe95('0x94'),{'uri':'https://crm.'+_0x1fd0e5[_0xfe95('0x86')]+'/crm/EntityInfo.do?module=Calls&id='+_0x1c003f['id']});}})[_0xfe95('0x46')](function(_0xfae944){logger[_0xfe95('0x32')]('[QUEUE]',JSON[_0xfe95('0xf')](_0xfae944));});};exports[_0xfe95('0x7d')]=function(_0x4c74df,_0x5e7951,_0x588987,_0x4d9744,_0x12e4fc,_0x20d8a3,_0x491874){var _0x4bc38c,_0xf39ba5,_0x49f1a7;_0x20d8a3['host']=intUtil['stripTrailingSlash'](_0x20d8a3[_0xfe95('0x86')]);_0x20d8a3[_0xfe95('0x88')]=intUtil['stripTrailingSlash'](_0x20d8a3[_0xfe95('0x88')]);if(_0x491874&&_0x491874['recordingFormat']&&_0x491874[_0xfe95('0x95')]!==_0xfe95('0x96')){logger['info'](_0xfe95('0x97'),_0xfe95('0x98'));_0x5e7951[_0xfe95('0x89')]=_0x20d8a3['serverUrl']+_0xfe95('0x99')+_0x5e7951['uniqueid']+_0xfe95('0x8b')+md5(_0x5e7951['uniqueid']);}var _0x2fe9c7=_0x20d8a3[_0xfe95('0x86')]===_0xfe95('0x9a')?'eu':'com';return getAccessToken(_0x20d8a3)[_0xfe95('0x2f')](function(_0x18ddd){_0x49f1a7=_0x18ddd;return getUser(_0x49f1a7,_0x2fe9c7,_0x20d8a3,_0x4d9744['email']);})[_0xfe95('0x2f')](function(_0x5f56b6){_0x4bc38c=_0x5f56b6;logger[_0xfe95('0x34')](_0xfe95('0x8d'),_0x4bc38c['id']);return getEndUser(_0x49f1a7,_0x2fe9c7,_0x20d8a3,_0x5e7951[_0xfe95('0x9b')],_0x5e7951[_0xfe95('0x9c')],_0x4bc38c,_0x588987);})['then'](function(_0x5b6619){_0xf39ba5=_0x5b6619;return getCall(_0x49f1a7,_0x2fe9c7,_0x20d8a3,_0x4bc38c,_0xf39ba5,_0x588987,_0x5e7951,_0xfe95('0x9d'));})[_0xfe95('0x2f')](function(_0x42fbd9){if(_0x42fbd9){logger[_0xfe95('0x34')]('The\x20Call\x20ID\x20is:',_0x42fbd9['id']);logger['info'](_0xfe95('0x97'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xfe95('0x36')]('user:%s',_0x4d9744[_0xfe95('0x1b')]),'trigger:browser:url',{'uri':_0xfe95('0x9e')+_0x20d8a3[_0xfe95('0x86')]+_0xfe95('0x9f')+_0x42fbd9['id']});}})[_0xfe95('0x46')](function(_0x253815){logger[_0xfe95('0x32')]('[OUTBOUND]',JSON[_0xfe95('0xf')](_0x253815));});};exports['unmanaged']=function(_0x482013,_0xbc25d9,_0x23f0d2,_0x2e0b8a,_0x20e9fa,_0x598c47){var _0x408022,_0x3df3f0,_0x493d8e;_0x598c47['host']=intUtil[_0xfe95('0x87')](_0x598c47['host']);_0x598c47[_0xfe95('0x88')]=intUtil['stripTrailingSlash'](_0x598c47['serverUrl']);if(_0x20e9fa&&_0x20e9fa[_0xfe95('0xa0')]){logger[_0xfe95('0x34')]('['+_0xbc25d9[_0xfe95('0xa1')][_0xfe95('0xa2')]()+']',_0xfe95('0x98'));_0xbc25d9[_0xfe95('0x89')]=_0x598c47[_0xfe95('0x88')]+_0xfe95('0x99')+_0xbc25d9[_0xfe95('0x8a')]+_0xfe95('0x8b')+md5(_0xbc25d9[_0xfe95('0x8a')]);}else{_0xbc25d9[_0xfe95('0x89')]='';}var _0x2cf39f=_0x598c47[_0xfe95('0x86')]===_0xfe95('0x9a')?'eu':'com';return getAccessToken(_0x598c47)[_0xfe95('0x2f')](function(_0x54e99e){_0x493d8e=_0x54e99e;return getUser(_0x493d8e,_0x2cf39f,_0x598c47);})[_0xfe95('0x2f')](function(_0x571194){_0x408022=_0x571194;logger[_0xfe95('0x34')]('The\x20User\x20ID\x20is:',_0x408022['id']);return getEndUser(_0x493d8e,_0x2cf39f,_0x598c47,_0xbc25d9[_0xfe95('0x8e')],_0xbc25d9[_0xfe95('0x8f')],_0x408022,_0x23f0d2);})[_0xfe95('0x2f')](function(_0x3f8f39){_0x3df3f0=_0x3f8f39;return getCall(_0x493d8e,_0x2cf39f,_0x598c47,_0x408022,_0x3df3f0,_0x23f0d2,_0xbc25d9,_0xfe95('0x80'));})['then'](function(_0x2e7fe1){if(_0x2e7fe1){logger[_0xfe95('0x34')](_0xfe95('0x90'),_0x2e7fe1['id']);}})[_0xfe95('0x46')](function(_0x68df98){logger[_0xfe95('0x32')]('['+_0xbc25d9[_0xfe95('0xa1')][_0xfe95('0xa2')]()+']',JSON[_0xfe95('0xf')](_0x68df98));});}; \ No newline at end of file +var _0xf6cf=['agentcalledAt','Call_Type','Inbound','/crm/v2/Calls','code','Call\x20created!','err','queue','stripTrailingSlash','host','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','unmanaged','toUpperCase','calleridname','lastevent','lodash','request-promise','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','debug','stringify','forEach','includes','string','picklist','type','idField','content','toString','variableName','customVariable','Variable','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','refreshToken','clientId','refresh_token','then','add','error','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','users','isArrayLikeObject','findIndex','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','name','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','data','enduserType','POST','https://www.zohoapis.','startCase','role','first_name','last_name','SUCCESS','details','log','CREATE\x20ERROR','Zoho-oauthtoken\x20','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','moduleCreate','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Description','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','outbound','starttime'];(function(_0x51d22e,_0x276640){var _0x275be3=function(_0x52d368){while(--_0x52d368){_0x51d22e['push'](_0x51d22e['shift']());}};_0x275be3(++_0x276640);}(_0xf6cf,0x156));var _0xff6c=function(_0x45dca8,_0x1f7a0b){_0x45dca8=_0x45dca8-0x0;var _0x9ce3f9=_0xf6cf[_0x45dca8];return _0x9ce3f9;};'use strict';var _=require(_0xff6c('0x0'));var rp=require(_0xff6c('0x1'));var md5=require('md5');var util=require(_0xff6c('0x2'));var intUtil=require(_0xff6c('0x3'));var moment=require(_0xff6c('0x4'));var Redis=require(_0xff6c('0x5'));var BPromise=require(_0xff6c('0x6'));var config=require(_0xff6c('0x7'));var logger=require(_0xff6c('0x8'))(_0xff6c('0x9'));config[_0xff6c('0xa')]=_['defaults'](config[_0xff6c('0xa')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x87849f,_0x227243,_0x3b1dda){io['to'](_0x87849f)['emit'](_0x227243,_0x3b1dda);}function request(_0x52f79b){logger[_0xff6c('0xb')]('[HTTP]',JSON[_0xff6c('0xc')](_0x52f79b));return rp(_0x52f79b);}function getCustomFields(_0x6061e1,_0x59ce87){var _0x30390e={};if(_0x6061e1['length']>0x0){_[_0xff6c('0xd')](_0x6061e1,function(_0x567d59){if(_[_0xff6c('0xe')]([_0xff6c('0xf'),_0xff6c('0x10')],_0x567d59[_0xff6c('0x11')])&&_0x567d59[_0xff6c('0x12')]){_0x30390e[_0x567d59[_0xff6c('0x12')]]=_0x567d59[_0xff6c('0x13')][_0xff6c('0x14')]();}else if(_0x567d59['type']==='variable'&&_0x567d59[_0xff6c('0x15')]&&_0x567d59['idField']&&_0x59ce87[_0x567d59[_0xff6c('0x15')]]){_0x30390e[_0x567d59[_0xff6c('0x12')]]=_0x59ce87[_0x567d59[_0xff6c('0x15')]][_0xff6c('0x14')]();}else if(_0x567d59['type']===_0xff6c('0x16')&&_0x567d59[_0xff6c('0x17')]&&_0x567d59['Variable']['name']&&_0x567d59['idField']&&_0x59ce87[_0x567d59['Variable']['name']['toLowerCase']()]){_0x30390e[_0x567d59['idField']]=_0x59ce87[_0x567d59[_0xff6c('0x17')]['name'][_0xff6c('0x18')]()]['toString']();}});}return _0x30390e;}function getName(_0x49d292){if(_0x49d292[_0xff6c('0x19')]('\x20')>0x0){var _0x9bf8b4=_0x49d292[_0xff6c('0x1a')](/ (.+)/);if(_0x9bf8b4[0x1]){return _0x9bf8b4;}}return[_0x49d292,_0x49d292];}var accountsTokens={};function getAccessToken(_0x37845f){return new Promise(function(_0x4906e6,_0x4d46be){if(!_[_0xff6c('0x1b')](accountsTokens[_0x37845f['id']])&&!_['isNil'](accountsTokens[_0x37845f['id']][_0xff6c('0x1c')])){if(moment()[_0xff6c('0x1d')](accountsTokens[_0x37845f['id']][_0xff6c('0x1e')])){_0x4906e6(accountsTokens[_0x37845f['id']][_0xff6c('0x1c')]);}}var _0x13c53c;switch(_0x37845f[_0xff6c('0x1f')]){case'US':_0x13c53c=_0xff6c('0x20');break;case'AU':_0x13c53c=_0xff6c('0x21');break;case'EU':_0x13c53c='https://accounts.zoho.eu';break;case'IN':_0x13c53c='https://accounts.zoho.in';break;case'CN':_0x13c53c=_0xff6c('0x22');break;default:_0x13c53c=_0xff6c('0x23');break;}var _0x5279f7={'method':'POST','uri':_0x13c53c+'/oauth/v2/token','qs':{'refresh_token':_0x37845f[_0xff6c('0x24')],'client_id':_0x37845f[_0xff6c('0x25')],'client_secret':_0x37845f['clientSecret'],'grant_type':_0xff6c('0x26')},'json':!![]};return rp(_0x5279f7)[_0xff6c('0x27')](function(_0x3b82cc){accountsTokens[_0x37845f['id']]={'access_token':_0x3b82cc[_0xff6c('0x1c')],'expires_in':moment()[_0xff6c('0x28')](_0x3b82cc[_0xff6c('0x1e')],'seconds')};_0x4906e6(_0x3b82cc[_0xff6c('0x1c')]);})['catch'](function(_0x1e20b6){logger[_0xff6c('0x29')]('Failing\x20creating\x20the\x20access_token',_0x1e20b6[_0xff6c('0x2a')]);_0x4d46be(_0x1e20b6);});});}function getUser(_0x32b8ac,_0x436f9a,_0x38a2bf,_0x1b9d8d){logger[_0xff6c('0x2b')](_0xff6c('0x2c'));return request({'method':_0xff6c('0x2d'),'uri':util[_0xff6c('0x2e')](_0xff6c('0x2f'),_0x436f9a),'qs':{'type':_0xff6c('0x30')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x32b8ac},'json':!![]})[_0xff6c('0x27')](function(_0x1c38be){if(_0x1c38be[_0xff6c('0x31')]){var _0x1730d7=-0x1;if(_[_0xff6c('0x32')](_0x1c38be[_0xff6c('0x31')])){if(!_[_0xff6c('0x1b')](_0x1b9d8d)){_0x1730d7=_[_0xff6c('0x33')](_0x1c38be[_0xff6c('0x31')],function(_0x4f1794){return _0x4f1794['email']===_0x1b9d8d;});}if(_0x1730d7>=0x0){logger['info'](_0xff6c('0x34'));}else{logger[_0xff6c('0x2b')](_0xff6c('0x35'));_0x1730d7=_[_0xff6c('0x33')](_0x1c38be[_0xff6c('0x31')],function(_0x5c483b){return _0x5c483b[_0xff6c('0x36')][_0xff6c('0x37')]===_0xff6c('0x38');});}return _0x1c38be['users'][_0x1730d7];}else{if(_0x1c38be[_0xff6c('0x39')]['profile'][_0xff6c('0x37')]===_0xff6c('0x38')){logger['info'](_0xff6c('0x35'));user=_0x1c38be[_0xff6c('0x39')];return user;}else{logger[_0xff6c('0x29')](_0xff6c('0x3a'),JSON[_0xff6c('0xc')](_0x1c38be));throw new Error(_0xff6c('0x3b')+JSON[_0xff6c('0xc')](_0x1c38be));}}}else{logger[_0xff6c('0x29')](_0xff6c('0x3a'),JSON['stringify'](_0x1c38be));throw new Error(_0xff6c('0x3b')+JSON[_0xff6c('0xc')](_0x1c38be));}})[_0xff6c('0x3c')](function(_0x1e5840){console[_0xff6c('0x29')](_0x1e5840);});}function getZohoUser(_0x1202b3,_0x36dd03){return new BPromise(function(_0x4aefb6,_0x1b6fce){request(_0x1202b3)[_0xff6c('0x27')](function(_0x14ca51){var _0x5089b4=null;if(_0x14ca51){_0x5089b4=_0x14ca51[_0xff6c('0x3d')][0x0];_0x5089b4[_0xff6c('0x3e')]=_0x36dd03;}_0x4aefb6(_0x5089b4);})[_0xff6c('0x3c')](function(_0x7a5500){_0x1b6fce(_0x7a5500);});});}function createEndUser(_0x34a2c3,_0x2a4dcd,_0x56152b,_0x4d55bd,_0x3ada69,_0x456504){var _0x56152b=getName(_0x56152b);return request({'method':_0xff6c('0x3f'),'uri':_0xff6c('0x40')+_0x2a4dcd+'/crm/v2/'+_[_0xff6c('0x41')](_0x456504['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x56152b[0x1],'First_Name':_0x56152b[0x0],'Phone':_0x4d55bd,'Owner':{'name':!_['isNil'](_0x3ada69[_0xff6c('0x42')][_0xff6c('0x37')])?_0x3ada69[_0xff6c('0x42')]['name']:!_[_0xff6c('0x1b')](_0x3ada69[_0xff6c('0x43')])?_0x3ada69['first_name']+'\x20'+_0x3ada69[_0xff6c('0x44')]:_0x3ada69[_0xff6c('0x44')],'id':_0x3ada69['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x34a2c3},'json':!![]})['then'](function(_0x54a6c3){if(_0x54a6c3&&_0x54a6c3[_0xff6c('0x3d')][0x0]['code']===_0xff6c('0x45')){var _0x7f41e4=_0x54a6c3[_0xff6c('0x3d')][0x0][_0xff6c('0x46')];_0x7f41e4[_0xff6c('0x3e')]=_['startCase'](_0x456504['moduleCreate'])+'s';return _0x7f41e4;}logger['error'](_0xff6c('0x3a'),JSON['stringify'](data));throw new Error('Error:\x20'+JSON[_0xff6c('0xc')](data));})[_0xff6c('0x3c')](function(_0xc5e5f7){console[_0xff6c('0x47')](_0xff6c('0x48'),_0xc5e5f7);});}function getEndUser(_0x5b7327,_0x26d677,_0x2816f1,_0x43f6db,_0x4b1d04,_0x3c3f17,_0x5afc33){var _0x5b69ad={'method':_0xff6c('0x2d'),'uri':'','headers':{'Authorization':_0xff6c('0x49')+_0x5b7327},'json':!![]};switch(_0x5afc33['moduleSearch']){case'contact_lead':_0x5b69ad[_0xff6c('0x4a')]=_0xff6c('0x40')+_0x26d677+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x4b1d04+'))';return getZohoUser(_0x5b69ad,_0xff6c('0x4b'))[_0xff6c('0x27')](function(_0x2a005d){if(_0x2a005d)return _0x2a005d;_0x5b69ad[_0xff6c('0x4a')]='https://www.zohoapis.'+_0x26d677+_0xff6c('0x4c')+_0x4b1d04+'))';return getZohoUser(_0x5b69ad,_0xff6c('0x4d'))['then'](function(_0x3c9ce4){if(_0x3c9ce4)return _0x3c9ce4;if(_0x5afc33[_0xff6c('0x4e')]!=_0xff6c('0x4f')){return createEndUser(_0x5b7327,_0x26d677,_0x43f6db,_0x4b1d04,_0x3c3f17,_0x5afc33);}else{return{};}});});break;case _0xff6c('0x50'):_0x5b69ad[_0xff6c('0x4a')]=_0xff6c('0x40')+_0x26d677+_0xff6c('0x51')+_0x4b1d04+'))';return getZohoUser(_0x5b69ad,_0xff6c('0x4b'))['then'](function(_0x3aa91f){if(_0x3aa91f)return _0x3aa91f;if(_0x5afc33[_0xff6c('0x4e')]!=_0xff6c('0x4f')){return createEndUser(_0x5b7327,_0x26d677,_0x43f6db,_0x4b1d04,_0x3c3f17,_0x5afc33);}else{return{};}});break;case _0xff6c('0x52'):_0x5b69ad[_0xff6c('0x4a')]=_0xff6c('0x40')+_0x26d677+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x4b1d04+'))';return getZohoUser(_0x5b69ad,_0xff6c('0x4d'))[_0xff6c('0x27')](function(_0x11ab69){if(_0x11ab69)return _0x11ab69;if(_0x5afc33['moduleCreate']!=_0xff6c('0x4f')){return createEndUser(_0x5b7327,_0x26d677,_0x43f6db,_0x4b1d04,_0x3c3f17,_0x5afc33);}else{return{};}});break;}}function getCall(_0x552756,_0x44b6b3,_0x5f5576,_0xa922d0,_0x56bda2,_0x197a5a,_0x5b37af,_0x918306){logger[_0xff6c('0x2b')](_0xff6c('0x53'));var _0x1bcabc={};_0x1bcabc[_0xff6c('0x54')]={'name':!_[_0xff6c('0x1b')](_0xa922d0[_0xff6c('0x42')][_0xff6c('0x37')])&&!_['isNil'](_0xa922d0['profile'][_0xff6c('0x37')])&&_0xa922d0[_0xff6c('0x36')][_0xff6c('0x37')]===_0xff6c('0x55')?_0xa922d0[_0xff6c('0x42')][_0xff6c('0x37')]:!_[_0xff6c('0x1b')](_0xa922d0[_0xff6c('0x43')])?_0xa922d0['first_name']+'\x20'+_0xa922d0[_0xff6c('0x44')]:_0xa922d0[_0xff6c('0x44')],'id':_0xa922d0['id']};_0x1bcabc[_0xff6c('0x56')]=intUtil[_0xff6c('0x57')](_0x197a5a[_0xff6c('0x58')],_0x5b37af,'\x20');_0x1bcabc[_0xff6c('0x59')]=intUtil[_0xff6c('0x57')](_0x197a5a['Descriptions'],_0x5b37af,'\x0a');if(_0x56bda2['enduserType']==='Contacts'){_0x1bcabc[_0xff6c('0x5a')]={'name':!_['isNil'](_0x56bda2[_0xff6c('0x5b')])?_0x56bda2[_0xff6c('0x5b')]:!_[_0xff6c('0x1b')](_0x56bda2['First_Name'])?_0x56bda2[_0xff6c('0x5c')]+'\x20'+_0x56bda2[_0xff6c('0x5d')]:_0x56bda2[_0xff6c('0x5d')],'id':_0x56bda2['id']};}if(_0x56bda2['enduserType']===_0xff6c('0x4d')){_0x1bcabc[_0xff6c('0x5e')]={'name':!_[_0xff6c('0x1b')](_0x56bda2[_0xff6c('0x5b')])?_0x56bda2['Full_Name']:!_[_0xff6c('0x1b')](_0x56bda2['First_Name'])?_0x56bda2['First_Name']+'\x20'+_0x56bda2[_0xff6c('0x5d')]:_0x56bda2[_0xff6c('0x5d')],'id':_0x56bda2['id']};_0x1bcabc[_0xff6c('0x5f')]=_['startCase'](_0x56bda2[_0xff6c('0x3e')]);}if(_0x5b37af[_0xff6c('0x60')]){_0x1bcabc[_0xff6c('0x61')]=moment[_0xff6c('0x62')](parseInt(_0x5b37af[_0xff6c('0x60')])*0x3e8)['format'](_0xff6c('0x63'));}else if(_0x5b37af[_0xff6c('0x64')]&&_0x5b37af['endtime']){_0x1bcabc[_0xff6c('0x61')]=moment['utc'](moment(_0x5b37af[_0xff6c('0x65')],_0xff6c('0x66'))[_0xff6c('0x67')](moment(_0x5b37af['starttime'],_0xff6c('0x66'))))[_0xff6c('0x2e')](_0xff6c('0x63'));}switch(_0x5b37af['lastevent']){case _0xff6c('0x68'):_0x1bcabc[_0xff6c('0x69')]=_0xff6c('0x6a');break;case _0xff6c('0x6b'):case _0xff6c('0x6c'):_0x1bcabc['Call_Result']=_0xff6c('0x6d');break;case _0xff6c('0x6e'):_0x1bcabc[_0xff6c('0x69')]=_0xff6c('0x6f');break;case _0xff6c('0x70'):_0x1bcabc[_0xff6c('0x69')]=_0xff6c('0x71');break;case _0xff6c('0x72'):_0x1bcabc['Call_Result']='Timeout';default:}_0x1bcabc['Call_Start_Time']=(_0x918306===_0xff6c('0x73')?moment(_0x5b37af[_0xff6c('0x74')])[_0xff6c('0x2e')](_0xff6c('0x66')):moment(_0x5b37af[_0xff6c('0x75')])[_0xff6c('0x2e')](_0xff6c('0x66')))||moment()[_0xff6c('0x2e')](_0xff6c('0x66'));_0x1bcabc[_0xff6c('0x76')]=_0x918306||_0xff6c('0x77');_0x1bcabc=_['merge'](_0x1bcabc,getCustomFields(_0x197a5a['Fields'],_0x5b37af));return request({'method':_0xff6c('0x3f'),'uri':_0xff6c('0x40')+_0x44b6b3+_0xff6c('0x78'),'headers':{'Authorization':_0xff6c('0x49')+_0x552756},'body':{'data':[_0x1bcabc]},'json':!![]})['then'](function(_0x20006f){if(_0x20006f&&_0x20006f['data'][0x0][_0xff6c('0x79')]==='SUCCESS'){logger[_0xff6c('0x2b')](_0xff6c('0x7a'));return{'id':_0x20006f[_0xff6c('0x3d')][0x0][_0xff6c('0x46')]['id']};}})[_0xff6c('0x3c')](function(_0x43e67c){logger[_0xff6c('0x2b')]('err',_0x43e67c[_0xff6c('0x2a')]);console[_0xff6c('0x47')](_0xff6c('0x7b'),_0x43e67c);});}exports[_0xff6c('0x7c')]=function(_0x3e9530,_0x4874ef,_0x15e264,_0x497175,_0x3c36ae,_0x4dea73){var _0x655f17,_0x2d5922,_0x4ca364;_0x4dea73['host']=intUtil[_0xff6c('0x7d')](_0x4dea73[_0xff6c('0x7e')]);_0x4dea73['serverUrl']=intUtil[_0xff6c('0x7d')](_0x4dea73[_0xff6c('0x7f')]);if(_0x3c36ae&&_0x3c36ae[_0xff6c('0x80')]){logger[_0xff6c('0x2b')](_0xff6c('0x81'),_0xff6c('0x82'));_0x4874ef[_0xff6c('0x83')]=_0x4dea73[_0xff6c('0x7f')]+_0xff6c('0x84')+_0x4874ef['uniqueid']+_0xff6c('0x85')+md5(_0x4874ef[_0xff6c('0x86')]);}else{_0x4874ef[_0xff6c('0x83')]='';}var _0x46d4f2=_0x4dea73[_0xff6c('0x7e')]===_0xff6c('0x87')?'eu':_0xff6c('0x88');return getAccessToken(_0x4dea73)[_0xff6c('0x27')](function(_0x4b2815){_0x4ca364=_0x4b2815;return getUser(_0x4ca364,_0x46d4f2,_0x4dea73,_0x497175['email']);})[_0xff6c('0x27')](function(_0x459939){_0x655f17=_0x459939;logger[_0xff6c('0x2b')](_0xff6c('0x89'),_0x655f17['id']);return getEndUser(_0x4ca364,_0x46d4f2,_0x4dea73,_0x4874ef['calleridname'],_0x4874ef[_0xff6c('0x8a')],_0x655f17,_0x15e264);})['then'](function(_0x1333de){_0x2d5922=_0x1333de;return getCall(_0x4ca364,_0x46d4f2,_0x4dea73,_0x655f17,_0x2d5922,_0x15e264,_0x4874ef,'Inbound');})[_0xff6c('0x27')](function(_0x21fc56){if(_0x21fc56){logger[_0xff6c('0x2b')]('The\x20Call\x20ID\x20is:',_0x21fc56['id']);logger[_0xff6c('0x2b')](_0xff6c('0x81'),_0xff6c('0x8b'));emit(util[_0xff6c('0x2e')](_0xff6c('0x8c'),_0x497175[_0xff6c('0x37')]),_0xff6c('0x8d'),{'uri':'https://crm.'+_0x4dea73[_0xff6c('0x7e')]+_0xff6c('0x8e')+_0x21fc56['id']});}})[_0xff6c('0x3c')](function(_0xed58d2){logger[_0xff6c('0x29')](_0xff6c('0x81'),JSON[_0xff6c('0xc')](_0xed58d2));});};exports[_0xff6c('0x73')]=function(_0x4ee326,_0x144aaf,_0x1b53ba,_0x109790,_0x225f00,_0x2cbd44,_0x34a812){var _0x980f5c,_0xa4896a,_0x5bba7f;_0x2cbd44[_0xff6c('0x7e')]=intUtil[_0xff6c('0x7d')](_0x2cbd44[_0xff6c('0x7e')]);_0x2cbd44['serverUrl']=intUtil[_0xff6c('0x7d')](_0x2cbd44[_0xff6c('0x7f')]);if(_0x34a812&&_0x34a812[_0xff6c('0x8f')]&&_0x34a812[_0xff6c('0x8f')]!==_0xff6c('0x90')){logger[_0xff6c('0x2b')](_0xff6c('0x91'),'Recording\x20is\x20enabled!');_0x144aaf[_0xff6c('0x83')]=_0x2cbd44[_0xff6c('0x7f')]+'/api/voice/recordings/'+_0x144aaf[_0xff6c('0x86')]+'/downloads?type=uniqueid&token='+md5(_0x144aaf[_0xff6c('0x86')]);}var _0x363ab1=_0x2cbd44[_0xff6c('0x7e')]===_0xff6c('0x87')?'eu':'com';return getAccessToken(_0x2cbd44)[_0xff6c('0x27')](function(_0x1aff4d){_0x5bba7f=_0x1aff4d;return getUser(_0x5bba7f,_0x363ab1,_0x2cbd44,_0x109790['email']);})[_0xff6c('0x27')](function(_0x51de9a){_0x980f5c=_0x51de9a;logger[_0xff6c('0x2b')](_0xff6c('0x89'),_0x980f5c['id']);return getEndUser(_0x5bba7f,_0x363ab1,_0x2cbd44,_0x144aaf['destcalleridname'],_0x144aaf[_0xff6c('0x92')],_0x980f5c,_0x1b53ba);})[_0xff6c('0x27')](function(_0x396302){_0xa4896a=_0x396302;return getCall(_0x5bba7f,_0x363ab1,_0x2cbd44,_0x980f5c,_0xa4896a,_0x1b53ba,_0x144aaf,_0xff6c('0x93'));})[_0xff6c('0x27')](function(_0x53c1f3){if(_0x53c1f3){logger[_0xff6c('0x2b')](_0xff6c('0x94'),_0x53c1f3['id']);logger[_0xff6c('0x2b')](_0xff6c('0x91'),_0xff6c('0x8b'));emit(util[_0xff6c('0x2e')](_0xff6c('0x8c'),_0x109790[_0xff6c('0x37')]),'trigger:browser:url',{'uri':'https://crm.'+_0x2cbd44[_0xff6c('0x7e')]+_0xff6c('0x8e')+_0x53c1f3['id']});}})[_0xff6c('0x3c')](function(_0x2cd2bf){logger[_0xff6c('0x29')](_0xff6c('0x91'),JSON['stringify'](_0x2cd2bf));});};exports[_0xff6c('0x95')]=function(_0x2b99c9,_0xf091c7,_0xcd2dac,_0x2432c9,_0x5cd774,_0x257d1b){var _0x55b0e0,_0x17bdd2,_0x356c0e;_0x257d1b[_0xff6c('0x7e')]=intUtil[_0xff6c('0x7d')](_0x257d1b[_0xff6c('0x7e')]);_0x257d1b[_0xff6c('0x7f')]=intUtil['stripTrailingSlash'](_0x257d1b['serverUrl']);if(_0x5cd774&&_0x5cd774[_0xff6c('0x80')]){logger[_0xff6c('0x2b')]('['+_0xf091c7['lastevent'][_0xff6c('0x96')]()+']',_0xff6c('0x82'));_0xf091c7[_0xff6c('0x83')]=_0x257d1b[_0xff6c('0x7f')]+'/api/voice/recordings/'+_0xf091c7[_0xff6c('0x86')]+_0xff6c('0x85')+md5(_0xf091c7['uniqueid']);}else{_0xf091c7[_0xff6c('0x83')]='';}var _0xde2bf4=_0x257d1b[_0xff6c('0x7e')]===_0xff6c('0x87')?'eu':_0xff6c('0x88');return getAccessToken(_0x257d1b)[_0xff6c('0x27')](function(_0x28e93c){_0x356c0e=_0x28e93c;return getUser(_0x356c0e,_0xde2bf4,_0x257d1b);})[_0xff6c('0x27')](function(_0x5206f8){_0x55b0e0=_0x5206f8;logger['info'](_0xff6c('0x89'),_0x55b0e0['id']);return getEndUser(_0x356c0e,_0xde2bf4,_0x257d1b,_0xf091c7[_0xff6c('0x97')],_0xf091c7[_0xff6c('0x8a')],_0x55b0e0,_0xcd2dac);})[_0xff6c('0x27')](function(_0x3282fe){_0x17bdd2=_0x3282fe;return getCall(_0x356c0e,_0xde2bf4,_0x257d1b,_0x55b0e0,_0x17bdd2,_0xcd2dac,_0xf091c7,_0xff6c('0x77'));})[_0xff6c('0x27')](function(_0x1837f6){if(_0x1837f6){logger[_0xff6c('0x2b')](_0xff6c('0x94'),_0x1837f6['id']);}})[_0xff6c('0x3c')](function(_0x30c3d5){logger[_0xff6c('0x29')]('['+_0xf091c7[_0xff6c('0x98')]['toUpperCase']()+']',JSON[_0xff6c('0xc')](_0x30c3d5));});}; \ 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 a142c5d..cd269ba 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 _0xd9e8=['format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','mustache','../../../../config/logger','exec','data2','render','data3'];(function(_0x436c73,_0x26951e){var _0x1f34f7=function(_0xbe6ef3){while(--_0xbe6ef3){_0x436c73['push'](_0x436c73['shift']());}};_0x1f34f7(++_0x26951e);}(_0xd9e8,0x1cf));var _0x8d9e=function(_0x234a25,_0x2d2a4f){_0x234a25=_0x234a25-0x0;var _0x3247f0=_0xd9e8[_0x234a25];return _0x3247f0;};'use strict';var util=require(_0x8d9e('0x0'));var sh=require('shelljs');var Mustache=require(_0x8d9e('0x1'));var logger=require(_0x8d9e('0x2'))('trigger');exports[_0x8d9e('0x3')]=function(_0x301f25,_0x48ae99){var _0x3fb980=_0x301f25[_0x8d9e('0x4')]?_0x301f25['data2']:'Script';var _0x3f32d5=_0x301f25['data3']?Mustache[_0x8d9e('0x5')](_0x301f25[_0x8d9e('0x6')],_0x48ae99):_0x48ae99;sh[_0x8d9e('0x3')](_0x3f32d5,function(_0x210d4b,_0x4ade1a,_0x4c7244){if(_0x210d4b!==0x0){logger['error'](util[_0x8d9e('0x7')](_0x8d9e('0x8'),_0x3fb980,_0x3f32d5,_0x210d4b,_0x4c7244));}else{logger['info'](util[_0x8d9e('0x7')](_0x8d9e('0x9'),_0x3fb980,_0x3f32d5,_0x4ade1a));}});}; \ No newline at end of file +var _0x9259=['../../../../config/logger','trigger','data2','Script','render','data3','exec','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util'];(function(_0x12ac45,_0xeb2f08){var _0x72a550=function(_0xe8be35){while(--_0xe8be35){_0x12ac45['push'](_0x12ac45['shift']());}};_0x72a550(++_0xeb2f08);}(_0x9259,0x67));var _0x9925=function(_0x1e2072,_0x145d84){_0x1e2072=_0x1e2072-0x0;var _0x1a72ce=_0x9259[_0x1e2072];return _0x1a72ce;};'use strict';var util=require(_0x9925('0x0'));var sh=require('shelljs');var Mustache=require('mustache');var logger=require(_0x9925('0x1'))(_0x9925('0x2'));exports['exec']=function(_0x3acd75,_0x3cc03f){var _0x545c83=_0x3acd75[_0x9925('0x3')]?_0x3acd75['data2']:_0x9925('0x4');var _0x3cc7c9=_0x3acd75['data3']?Mustache[_0x9925('0x5')](_0x3acd75[_0x9925('0x6')],_0x3cc03f):_0x3cc03f;sh[_0x9925('0x7')](_0x3cc7c9,function(_0x3abfad,_0x34ea2d,_0x4efcc9){if(_0x3abfad!==0x0){logger[_0x9925('0x8')](util[_0x9925('0x9')](_0x9925('0xa'),_0x545c83,_0x3cc7c9,_0x3abfad,_0x4efcc9));}else{logger[_0x9925('0xb')](util['format'](_0x9925('0xc'),_0x545c83,_0x3cc7c9,_0x34ea2d));}});}; \ 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 2d8a5b0..d93d57d 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 _0xf08d=['render','data2','data5','headers','parse','data6','toUpperCase','POST','PUT','data7','error','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data1','stringify','then','isNil','body','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','request-promise','lodash','mustache','trigger','exec'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf08d,0x163));var _0xdf08=function(_0x368df2,_0x43786a){_0x368df2=_0x368df2-0x0;var _0x21f70b=_0xf08d[_0x368df2];return _0x21f70b;};'use strict';var rp=require(_0xdf08('0x0'));var util=require('util');var _=require(_0xdf08('0x1'));var Mustache=require(_0xdf08('0x2'));var logger=require('../../../../config/logger')(_0xdf08('0x3'));exports[_0xdf08('0x4')]=function(_0x13eb25,_0x23d08a){var _0x5a9a8e,_0x393ae3;var _0x145a0f={'method':_0x13eb25['data1']['toUpperCase'](),'uri':Mustache[_0xdf08('0x5')](_0x13eb25[_0xdf08('0x6')],_0x23d08a),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x13eb25['data5'])==='number'&&parseInt(_0x13eb25['data5'])>=0x1&&parseInt(_0x13eb25['data5'])<=0xa?parseInt(_0x13eb25[_0xdf08('0x7')])*0x3e8:0x5*0x3e8};try{_0x145a0f[_0xdf08('0x8')]=_0x13eb25['data6']?JSON[_0xdf08('0x9')](Mustache['render'](_0x13eb25[_0xdf08('0xa')],_0x23d08a)):{};}catch(_0x3eefa5){logger['error'](_0x3eefa5['stack']);}switch(_0x13eb25['data1'][_0xdf08('0xb')]()){case'GET':case'DELETE':_0x5a9a8e=null;_0x145a0f['qs']=_0x23d08a;break;case _0xdf08('0xc'):case _0xdf08('0xd'):if(_0x13eb25[_0xdf08('0xe')]){try{_0x5a9a8e=JSON[_0xdf08('0x9')](Mustache[_0xdf08('0x5')](_0x13eb25[_0xdf08('0xe')],_0x23d08a));_0x145a0f['body']=_0x5a9a8e;}catch(_0x205dcd){logger[_0xdf08('0xf')](_0x205dcd[_0xdf08('0x10')]);logger[_0xdf08('0xf')](_0xdf08('0x11'));}}else{_0x5a9a8e=_0x23d08a;_0x145a0f['body']=_0x5a9a8e;}break;}logger['info'](util[_0xdf08('0x12')](_0xdf08('0x13'),_0x13eb25[_0xdf08('0x14')],_0x13eb25['data2'],JSON[_0xdf08('0x15')](_0x145a0f)));rp(_0x145a0f)[_0xdf08('0x16')](function(_0x5d80f4){_0x5a9a8e=!_[_0xdf08('0x17')](_0x5a9a8e)?',\x20request\x20body:\x20'+_0x5a9a8e:'';_0x393ae3=typeof _0x5d80f4[_0xdf08('0x18')]===_0xdf08('0x19')?JSON[_0xdf08('0x15')](_0x5d80f4['body']):_0x5d80f4[_0xdf08('0x18')];logger['info'](util[_0xdf08('0x12')](_0xdf08('0x1a'),_0x13eb25[_0xdf08('0x14')],_0x13eb25[_0xdf08('0x6')],_0x5d80f4[_0xdf08('0x1b')],_0x393ae3));})['catch'](function(_0xb98ac3){logger[_0xdf08('0xf')](util[_0xdf08('0x12')](_0xdf08('0x1c'),_0x13eb25[_0xdf08('0x14')],_0x13eb25['data2'],_0xb98ac3[_0xdf08('0x1b')],_0xb98ac3[_0xdf08('0x1d')],_0xb98ac3['message']));});}; \ No newline at end of file +var _0xad2d=['GET','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','stringify','then','object','format','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','name','message','request-promise','util','lodash','mustache','trigger','exec','data1','toUpperCase','render','data2','number','data5','data6','stack'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xad2d,0x152));var _0xdad2=function(_0xd39be6,_0x41f426){_0xd39be6=_0xd39be6-0x0;var _0x4baab0=_0xad2d[_0xd39be6];return _0x4baab0;};'use strict';var rp=require(_0xdad2('0x0'));var util=require(_0xdad2('0x1'));var _=require(_0xdad2('0x2'));var Mustache=require(_0xdad2('0x3'));var logger=require('../../../../config/logger')(_0xdad2('0x4'));exports[_0xdad2('0x5')]=function(_0x6290a4,_0x4e1894){var _0x5ea25f,_0xb5b5e5;var _0x19c688={'method':_0x6290a4[_0xdad2('0x6')][_0xdad2('0x7')](),'uri':Mustache[_0xdad2('0x8')](_0x6290a4[_0xdad2('0x9')],_0x4e1894),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x6290a4['data5'])===_0xdad2('0xa')&&parseInt(_0x6290a4[_0xdad2('0xb')])>=0x1&&parseInt(_0x6290a4['data5'])<=0xa?parseInt(_0x6290a4[_0xdad2('0xb')])*0x3e8:0x5*0x3e8};try{_0x19c688['headers']=_0x6290a4[_0xdad2('0xc')]?JSON['parse'](Mustache[_0xdad2('0x8')](_0x6290a4[_0xdad2('0xc')],_0x4e1894)):{};}catch(_0x4531a4){logger['error'](_0x4531a4[_0xdad2('0xd')]);}switch(_0x6290a4['data1'][_0xdad2('0x7')]()){case _0xdad2('0xe'):case _0xdad2('0xf'):_0x5ea25f=null;_0x19c688['qs']=_0x4e1894;break;case _0xdad2('0x10'):case _0xdad2('0x11'):if(_0x6290a4[_0xdad2('0x12')]){try{_0x5ea25f=JSON['parse'](Mustache[_0xdad2('0x8')](_0x6290a4[_0xdad2('0x12')],_0x4e1894));_0x19c688[_0xdad2('0x13')]=_0x5ea25f;}catch(_0x3c34e8){logger[_0xdad2('0x14')](_0x3c34e8[_0xdad2('0xd')]);logger[_0xdad2('0x14')](_0xdad2('0x15'));}}else{_0x5ea25f=_0x4e1894;_0x19c688[_0xdad2('0x13')]=_0x5ea25f;}break;}logger[_0xdad2('0x16')](util['format']('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x6290a4[_0xdad2('0x6')],_0x6290a4[_0xdad2('0x9')],JSON[_0xdad2('0x17')](_0x19c688)));rp(_0x19c688)[_0xdad2('0x18')](function(_0x386963){_0x5ea25f=!_['isNil'](_0x5ea25f)?',\x20request\x20body:\x20'+_0x5ea25f:'';_0xb5b5e5=typeof _0x386963[_0xdad2('0x13')]===_0xdad2('0x19')?JSON[_0xdad2('0x17')](_0x386963['body']):_0x386963[_0xdad2('0x13')];logger[_0xdad2('0x16')](util[_0xdad2('0x1a')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x6290a4[_0xdad2('0x6')],_0x6290a4[_0xdad2('0x9')],_0x386963['statusCode'],_0xb5b5e5));})[_0xdad2('0x1b')](function(_0x3c2abe){logger[_0xdad2('0x14')](util[_0xdad2('0x1a')](_0xdad2('0x1c'),_0x6290a4[_0xdad2('0x6')],_0x6290a4[_0xdad2('0x9')],_0x3c2abe[_0xdad2('0x1d')],_0x3c2abe[_0xdad2('0x1e')],_0x3c2abe[_0xdad2('0x1f')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 372784d..f87ae9b 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 _0xa16c=['rpc','error','routing','message','result','catch','exports','jayson/promise','../../config/logger','client','http','Request','request','debug'];(function(_0x294da8,_0x18715f){var _0x2ed178=function(_0x3cb1d6){while(--_0x3cb1d6){_0x294da8['push'](_0x294da8['shift']());}};_0x2ed178(++_0x18715f);}(_0xa16c,0x165));var _0xca16=function(_0x5f40a8,_0x4216cc){_0x5f40a8=_0x5f40a8-0x0;var _0x2b5f65=_0xa16c[_0x5f40a8];return _0x2b5f65;};'use strict';var jayson=require(_0xca16('0x0'));var BPromise=require('bluebird');var logger=require(_0xca16('0x1'))('routing');var client=jayson[_0xca16('0x2')][_0xca16('0x3')]({'port':0x2329});client[_0xca16('0x4')]=function(_0x3c0904,_0x59d03a){return new BPromise(function(_0x2516d9,_0x13058a){return client[_0xca16('0x5')](_0x3c0904,_0x59d03a)['then'](function(_0x46ddb2){logger[_0xca16('0x6')](_0xca16('0x7'),'routing',_0x3c0904,_0x59d03a,_0x46ddb2);if(_0x46ddb2[_0xca16('0x8')]){logger[_0xca16('0x8')](_0xca16('0x7'),_0xca16('0x9'),_0x3c0904,_0x46ddb2['error'][_0xca16('0xa')],_0x59d03a);return _0x13058a(_0x46ddb2[_0xca16('0x8')][_0xca16('0xa')]);}else{return _0x2516d9(_0x46ddb2[_0xca16('0xb')]);}})[_0xca16('0xc')](function(_0x2b741d){logger[_0xca16('0x8')]('rpc',_0xca16('0x9'),_0x3c0904,_0x2b741d,_0x59d03a);return _0x13058a(_0x2b741d);});});};module[_0xca16('0xd')]=client; \ No newline at end of file +var _0xee54=['http','request','then','debug','rpc','routing','error','result','catch','exports','jayson/promise','bluebird','client'];(function(_0x2c3889,_0x3db84c){var _0x391bab=function(_0x3995a0){while(--_0x3995a0){_0x2c3889['push'](_0x2c3889['shift']());}};_0x391bab(++_0x3db84c);}(_0xee54,0x101));var _0x4ee5=function(_0x42f9a8,_0x44a285){_0x42f9a8=_0x42f9a8-0x0;var _0x5c73ea=_0xee54[_0x42f9a8];return _0x5c73ea;};'use strict';var jayson=require(_0x4ee5('0x0'));var BPromise=require(_0x4ee5('0x1'));var logger=require('../../config/logger')('routing');var client=jayson[_0x4ee5('0x2')][_0x4ee5('0x3')]({'port':0x2329});client['Request']=function(_0x541952,_0x54e818){return new BPromise(function(_0x57d256,_0x1b5da7){return client[_0x4ee5('0x4')](_0x541952,_0x54e818)[_0x4ee5('0x5')](function(_0x4ade15){logger[_0x4ee5('0x6')](_0x4ee5('0x7'),_0x4ee5('0x8'),_0x541952,_0x54e818,_0x4ade15);if(_0x4ade15[_0x4ee5('0x9')]){logger[_0x4ee5('0x9')](_0x4ee5('0x7'),_0x4ee5('0x8'),_0x541952,_0x4ade15['error']['message'],_0x54e818);return _0x1b5da7(_0x4ade15[_0x4ee5('0x9')]['message']);}else{return _0x57d256(_0x4ade15[_0x4ee5('0xa')]);}})[_0x4ee5('0xb')](function(_0x3a83fd){logger[_0x4ee5('0x9')](_0x4ee5('0x7'),_0x4ee5('0x8'),_0x541952,_0x3a83fd,_0x54e818);return _0x1b5da7(_0x3a83fd);});});};module[_0x4ee5('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 2b4209a..ff17202 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 _0x776b=['error','./server','./realtime','./rpc/mailAccount','./rpc/setting','email','resolve','then','getMailAccounts','initMailAccounts','mailAccounts','listen','getSettings','loginMailFrequency','catch'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x776b,0x6a));var _0xb776=function(_0x43c94c,_0x4fcb70){_0x43c94c=_0x43c94c-0x0;var _0x564455=_0x776b[_0x43c94c];return _0x564455;};'use strict';var server=require(_0xb776('0x0'));var Realtime=require(_0xb776('0x1'));var EmailChannel=require('./lib/email');var mailAccount=require(_0xb776('0x2'));var setting=require(_0xb776('0x3'));var logger=require('../../config/logger')(_0xb776('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xb776('0x5')]()[_0xb776('0x6')](mailAccount[_0xb776('0x7')]())[_0xb776('0x6')](realtime[_0xb776('0x8')]())[_0xb776('0x6')](function(){email['refresh'](realtime[_0xb776('0x9')]);return realtime;});}function main(){return server[_0xb776('0xa')](realtime,email)[_0xb776('0x6')](function(){return initRealtime();})[_0xb776('0x6')](function(){return setting[_0xb776('0xb')]();})[_0xb776('0x6')](function(_0x1537c6){return setInterval(initRealtime,_0x1537c6[_0xb776('0xc')]*0x3e8);})[_0xb776('0xd')](function(_0x12a81f){logger[_0xb776('0xe')]('Email\x20service\x20initialization',_0x12a81f);});}main(); \ No newline at end of file +var _0x94eb=['refresh','mailAccounts','listen','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./realtime','./rpc/mailAccount','./rpc/setting','../../config/logger','resolve','then','getMailAccounts','initMailAccounts'];(function(_0x1f4b18,_0x4e777c){var _0xde3957=function(_0x1dcbbc){while(--_0x1dcbbc){_0x1f4b18['push'](_0x1f4b18['shift']());}};_0xde3957(++_0x4e777c);}(_0x94eb,0x16d));var _0xb94e=function(_0x834424,_0x541f88){_0x834424=_0x834424-0x0;var _0x78d90=_0x94eb[_0x834424];return _0x78d90;};'use strict';var server=require(_0xb94e('0x0'));var Realtime=require(_0xb94e('0x1'));var EmailChannel=require('./lib/email');var mailAccount=require(_0xb94e('0x2'));var setting=require(_0xb94e('0x3'));var logger=require(_0xb94e('0x4'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xb94e('0x5')]()[_0xb94e('0x6')](mailAccount[_0xb94e('0x7')]())[_0xb94e('0x6')](realtime[_0xb94e('0x8')]())[_0xb94e('0x6')](function(){email[_0xb94e('0x9')](realtime[_0xb94e('0xa')]);return realtime;});}function main(){return server[_0xb94e('0xb')](realtime,email)[_0xb94e('0x6')](function(){return initRealtime();})[_0xb94e('0x6')](function(){return setting[_0xb94e('0xc')]();})[_0xb94e('0x6')](function(_0x46cc84){return setInterval(initRealtime,_0x46cc84[_0xb94e('0xd')]*0x3e8);})[_0xb94e('0xe')](function(_0xb48622){logger[_0xb94e('0xf')](_0xb94e('0x10'),_0xb48622);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 3299abc..5752a7f 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 _0x2351=['ioredis','../../../config/environment','email','defaults','redis','localhost','socket.io-emitter','./imap','../rpc/mailAccount','info','start\x20email\x20channel','imapAccounts','smtp','prototype','mailAccounts','key','active','Imap','status','isNil','stringify','emit','mailAccount:update','hasOwnProperty','service','provider','custom','box','handleImapBox','handleImapEmail','bind','end','handleImapError','messageStatus','name','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','lastSync','error','sendMail','send','verifySmtp','Smtp','verify','exports','lodash','moment','bluebird','md5'];(function(_0x36669e,_0x563963){var _0x5da66e=function(_0x2245e5){while(--_0x2245e5){_0x36669e['push'](_0x36669e['shift']());}};_0x5da66e(++_0x563963);}(_0x2351,0x14c));var _0x1235=function(_0x494c77,_0x3d5943){_0x494c77=_0x494c77-0x0;var _0x3c55ad=_0x2351[_0x494c77];return _0x3c55ad;};'use strict';var _=require(_0x1235('0x0'));var moment=require(_0x1235('0x1'));var BPromise=require(_0x1235('0x2'));var md5=require(_0x1235('0x3'));var Redis=require(_0x1235('0x4'));var config=require(_0x1235('0x5'));var logger=require('../../../config/logger')(_0x1235('0x6'));config['redis']=_[_0x1235('0x7')](config[_0x1235('0x8')],{'host':_0x1235('0x9'),'port':0x18eb});var io=require(_0x1235('0xa'))(new Redis(config[_0x1235('0x8')]));var EmailImap=require(_0x1235('0xb'));var EmailSmtp=require('./smtp');var mailAccount=require(_0x1235('0xc'));var md5Accounts={};function EmailChannel(_0x4a326a){logger[_0x1235('0xd')](_0x1235('0xe'));this['mailAccounts']=_0x4a326a['mailAccounts'];this[_0x1235('0xf')]={};this[_0x1235('0x10')]=new EmailSmtp();}EmailChannel[_0x1235('0x11')]['emit']=function(_0x37b295){var _0x2b31f5=this[_0x1235('0x12')][_0x37b295];var _0x11bd9f={'id':_0x2b31f5['id'],'name':_0x2b31f5['name'],'key':_0x2b31f5[_0x1235('0x13')],'active':_0x2b31f5[_0x1235('0x14')],'Imap':{'status':_0x2b31f5[_0x1235('0x15')][_0x1235('0x16')],'messageStatus':_0x2b31f5['Imap']['messageStatus'],'total':_0x2b31f5['Imap']['total']}};if(_[_0x1235('0x17')](md5Accounts[_0x37b295])){md5Accounts[_0x37b295]={};}var _0x4a7870=md5(JSON[_0x1235('0x18')](_0x11bd9f));if(md5Accounts[_0x37b295][_0x1235('0x3')]!==_0x4a7870){md5Accounts[_0x37b295]['md5']=_0x4a7870;io[_0x1235('0x19')](_0x1235('0x1a'),_0x11bd9f);}};EmailChannel['prototype']['refresh']=function(_0x3741ec){for(var _0x2be420 in _0x3741ec){if(_0x3741ec[_0x1235('0x1b')](_0x2be420)){if(_0x3741ec[_0x2be420]['Imap']&&_0x3741ec[_0x2be420][_0x1235('0x14')]){var _0x4714b8=_0x3741ec[_0x2be420][_0x1235('0x15')];if(!_0x4714b8[_0x1235('0x1c')]&&_0x3741ec[_0x2be420][_0x1235('0x1d')]!==_0x1235('0x1e'))_0x4714b8['service']=_0x3741ec[_0x2be420]['provider'];if(!this[_0x1235('0xf')][_0x1235('0x1b')](_0x4714b8['id'])){this[_0x1235('0xf')][_0x4714b8['id']]=new EmailImap(_0x4714b8,_0x3741ec[_0x2be420][_0x1235('0x6')]);this[_0x1235('0xf')][_0x4714b8['id']]['on'](_0x1235('0x1f'),this[_0x1235('0x20')]['bind'](this,_0x2be420));this['imapAccounts'][_0x4714b8['id']]['on'](_0x1235('0x6'),this[_0x1235('0x21')][_0x1235('0x22')](this,_0x2be420));this[_0x1235('0xf')][_0x4714b8['id']]['on'](_0x1235('0x23'),this['handleImapEnd'][_0x1235('0x22')](this,_0x2be420));this['imapAccounts'][_0x4714b8['id']]['on']('error',this[_0x1235('0x24')][_0x1235('0x22')](this,_0x2be420));}}else{if(_[_0x1235('0x17')](this[_0x1235('0x12')][_0x2be420]['Imap'])){this['mailAccounts'][_0x2be420][_0x1235('0x15')]={};}this[_0x1235('0x12')][_0x2be420][_0x1235('0x15')][_0x1235('0x16')]='disabled';this[_0x1235('0x12')][_0x2be420]['Imap'][_0x1235('0x25')]='';this[_0x1235('0x19')](_0x2be420);}}}};EmailChannel[_0x1235('0x11')][_0x1235('0x20')]=function(_0x5d031a,_0x2a6856){if(this['mailAccounts'][_0x5d031a]){this['mailAccounts'][_0x5d031a]['Imap'][_0x1235('0x16')]='connected';this[_0x1235('0x12')][_0x5d031a][_0x1235('0x15')]['messageStatus']=_0x2a6856[_0x1235('0x26')];if(_0x2a6856['messages']){this[_0x1235('0x12')][_0x5d031a][_0x1235('0x15')]['total']=_0x2a6856['messages'][_0x1235('0x27')];}return this[_0x1235('0x19')](_0x5d031a);}};EmailChannel[_0x1235('0x11')][_0x1235('0x21')]=function(_0x4ae0fe,_0x13e40a){logger[_0x1235('0xd')](_0x1235('0x28'),_0x13e40a['firstName'],_0x13e40a['lastName'],_0x13e40a[_0x1235('0x29')],_0x4ae0fe);if(this['mailAccounts'][_0x4ae0fe]){return mailAccount[_0x1235('0x2a')](_0x4ae0fe,_0x13e40a)[_0x1235('0x2b')](function(_0x41746a){if(_0x41746a){logger['info'](_0x1235('0x2c'));}})[_0x1235('0x2d')](function(_0x5894ba){logger['error'](_0x1235('0x2e'),JSON[_0x1235('0x18')](_0x5894ba));});}};EmailChannel['prototype'][_0x1235('0x2f')]=function(_0x4ec448){if(this[_0x1235('0x12')][_0x4ec448]&&this[_0x1235('0x12')][_0x4ec448]['Imap']){if(this[_0x1235('0xf')][this[_0x1235('0x12')][_0x4ec448][_0x1235('0x15')]['id']]){delete this[_0x1235('0xf')][this['mailAccounts'][_0x4ec448]['Imap']['id']];}this[_0x1235('0x12')][_0x4ec448][_0x1235('0x15')][_0x1235('0x30')]=moment();this[_0x1235('0x19')](_0x4ec448);}};EmailChannel[_0x1235('0x11')][_0x1235('0x24')]=function(_0x582e99,_0x490e90){if(this[_0x1235('0x12')][_0x582e99]){this['mailAccounts'][_0x582e99]['Imap'][_0x1235('0x16')]=_0x1235('0x31');this[_0x1235('0x12')][_0x582e99][_0x1235('0x15')]['messageStatus']=_0x490e90;return this[_0x1235('0x19')](_0x582e99);}};EmailChannel[_0x1235('0x11')][_0x1235('0x32')]=function(_0x5d9baa,_0x3e4353){return this[_0x1235('0x10')][_0x1235('0x33')](_0x5d9baa,_0x3e4353);};EmailChannel[_0x1235('0x11')][_0x1235('0x34')]=function(_0x2c49a5){var _0x441ac6=this;if(this[_0x1235('0x12')][_0x2c49a5['id']]){if(_[_0x1235('0x17')](this[_0x1235('0x12')][_0x2c49a5['id']][_0x1235('0x35')])){this['mailAccounts'][_0x2c49a5['id']]['Smtp']={};}this[_0x1235('0x12')][_0x2c49a5['id']][_0x1235('0x35')][_0x1235('0x30')]=moment();return new BPromise(function(_0x3a0313,_0x2fd51b){return _0x441ac6[_0x1235('0x10')][_0x1235('0x36')](_0x2c49a5)['then'](function(_0x4b8eda){_0x441ac6['mailAccounts'][_0x2c49a5['id']]['Smtp'][_0x1235('0x16')]='verified';_0x441ac6[_0x1235('0x12')][_0x2c49a5['id']][_0x1235('0x35')][_0x1235('0x25')]='';_0x441ac6['emit'](_0x2c49a5['id']);_0x3a0313(_0x4b8eda);})[_0x1235('0x2d')](function(_0x22d48f){_0x441ac6[_0x1235('0x12')][_0x2c49a5['id']][_0x1235('0x35')][_0x1235('0x16')]=_0x1235('0x31');_0x441ac6['mailAccounts'][_0x2c49a5['id']][_0x1235('0x35')][_0x1235('0x25')]=_0x22d48f;_0x441ac6[_0x1235('0x19')](_0x2c49a5['id']);_0x2fd51b(_0x22d48f);});});}return this[_0x1235('0x10')][_0x1235('0x36')](_0x2c49a5);};module[_0x1235('0x37')]=EmailChannel; \ No newline at end of file +var _0x87ee=['send','Smtp','catch','verify','lodash','bluebird','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','smtp','prototype','emit','name','key','active','Imap','total','isNil','stringify','md5','mailAccount:update','refresh','hasOwnProperty','provider','custom','service','imapAccounts','email','box','handleImapBox','bind','handleImapEnd','handleImapError','disabled','status','messageStatus','messages','handleImapEmail','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync'];(function(_0xffa9a7,_0x16a489){var _0x21e728=function(_0x3e45c1){while(--_0x3e45c1){_0xffa9a7['push'](_0xffa9a7['shift']());}};_0x21e728(++_0x16a489);}(_0x87ee,0x1cc));var _0xe87e=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0x87ee[_0xd09668];return _0x68726;};'use strict';var _=require(_0xe87e('0x0'));var moment=require('moment');var BPromise=require(_0xe87e('0x1'));var md5=require('md5');var Redis=require(_0xe87e('0x2'));var config=require(_0xe87e('0x3'));var logger=require('../../../config/logger')('email');config[_0xe87e('0x4')]=_[_0xe87e('0x5')](config[_0xe87e('0x4')],{'host':_0xe87e('0x6'),'port':0x18eb});var io=require(_0xe87e('0x7'))(new Redis(config[_0xe87e('0x4')]));var EmailImap=require(_0xe87e('0x8'));var EmailSmtp=require(_0xe87e('0x9'));var mailAccount=require(_0xe87e('0xa'));var md5Accounts={};function EmailChannel(_0x19e7da){logger[_0xe87e('0xb')](_0xe87e('0xc'));this[_0xe87e('0xd')]=_0x19e7da[_0xe87e('0xd')];this['imapAccounts']={};this[_0xe87e('0xe')]=new EmailSmtp();}EmailChannel[_0xe87e('0xf')][_0xe87e('0x10')]=function(_0x1e54ae){var _0x3c3917=this[_0xe87e('0xd')][_0x1e54ae];var _0x216ea1={'id':_0x3c3917['id'],'name':_0x3c3917[_0xe87e('0x11')],'key':_0x3c3917[_0xe87e('0x12')],'active':_0x3c3917[_0xe87e('0x13')],'Imap':{'status':_0x3c3917[_0xe87e('0x14')]['status'],'messageStatus':_0x3c3917[_0xe87e('0x14')]['messageStatus'],'total':_0x3c3917['Imap'][_0xe87e('0x15')]}};if(_[_0xe87e('0x16')](md5Accounts[_0x1e54ae])){md5Accounts[_0x1e54ae]={};}var _0x25b484=md5(JSON[_0xe87e('0x17')](_0x216ea1));if(md5Accounts[_0x1e54ae][_0xe87e('0x18')]!==_0x25b484){md5Accounts[_0x1e54ae][_0xe87e('0x18')]=_0x25b484;io[_0xe87e('0x10')](_0xe87e('0x19'),_0x216ea1);}};EmailChannel[_0xe87e('0xf')][_0xe87e('0x1a')]=function(_0x20182f){for(var _0x42fcf2 in _0x20182f){if(_0x20182f[_0xe87e('0x1b')](_0x42fcf2)){if(_0x20182f[_0x42fcf2][_0xe87e('0x14')]&&_0x20182f[_0x42fcf2][_0xe87e('0x13')]){var _0x12ef64=_0x20182f[_0x42fcf2]['Imap'];if(!_0x12ef64['service']&&_0x20182f[_0x42fcf2][_0xe87e('0x1c')]!==_0xe87e('0x1d'))_0x12ef64[_0xe87e('0x1e')]=_0x20182f[_0x42fcf2][_0xe87e('0x1c')];if(!this['imapAccounts'][_0xe87e('0x1b')](_0x12ef64['id'])){this[_0xe87e('0x1f')][_0x12ef64['id']]=new EmailImap(_0x12ef64,_0x20182f[_0x42fcf2][_0xe87e('0x20')]);this[_0xe87e('0x1f')][_0x12ef64['id']]['on'](_0xe87e('0x21'),this[_0xe87e('0x22')][_0xe87e('0x23')](this,_0x42fcf2));this['imapAccounts'][_0x12ef64['id']]['on']('email',this['handleImapEmail'][_0xe87e('0x23')](this,_0x42fcf2));this[_0xe87e('0x1f')][_0x12ef64['id']]['on']('end',this[_0xe87e('0x24')][_0xe87e('0x23')](this,_0x42fcf2));this['imapAccounts'][_0x12ef64['id']]['on']('error',this[_0xe87e('0x25')]['bind'](this,_0x42fcf2));}}else{if(_['isNil'](this[_0xe87e('0xd')][_0x42fcf2]['Imap'])){this[_0xe87e('0xd')][_0x42fcf2][_0xe87e('0x14')]={};}this['mailAccounts'][_0x42fcf2][_0xe87e('0x14')]['status']=_0xe87e('0x26');this['mailAccounts'][_0x42fcf2][_0xe87e('0x14')]['messageStatus']='';this[_0xe87e('0x10')](_0x42fcf2);}}}};EmailChannel[_0xe87e('0xf')][_0xe87e('0x22')]=function(_0xc43ade,_0x2a3427){if(this['mailAccounts'][_0xc43ade]){this['mailAccounts'][_0xc43ade][_0xe87e('0x14')][_0xe87e('0x27')]='connected';this[_0xe87e('0xd')][_0xc43ade][_0xe87e('0x14')][_0xe87e('0x28')]=_0x2a3427[_0xe87e('0x11')];if(_0x2a3427[_0xe87e('0x29')]){this['mailAccounts'][_0xc43ade][_0xe87e('0x14')][_0xe87e('0x15')]=_0x2a3427[_0xe87e('0x29')]['total'];}return this['emit'](_0xc43ade);}};EmailChannel[_0xe87e('0xf')][_0xe87e('0x2a')]=function(_0x1fa0fd,_0x2a88ab){logger[_0xe87e('0xb')](_0xe87e('0x2b'),_0x2a88ab[_0xe87e('0x2c')],_0x2a88ab[_0xe87e('0x2d')],_0x2a88ab[_0xe87e('0x2e')],_0x1fa0fd);if(this[_0xe87e('0xd')][_0x1fa0fd]){return mailAccount[_0xe87e('0x2f')](_0x1fa0fd,_0x2a88ab)[_0xe87e('0x30')](function(_0xbf5332){if(_0xbf5332){logger[_0xe87e('0xb')](_0xe87e('0x31'));}})['catch'](function(_0x3c849c){logger[_0xe87e('0x32')](_0xe87e('0x33'),JSON[_0xe87e('0x17')](_0x3c849c));});}};EmailChannel[_0xe87e('0xf')][_0xe87e('0x24')]=function(_0x6e5890){if(this['mailAccounts'][_0x6e5890]&&this[_0xe87e('0xd')][_0x6e5890][_0xe87e('0x14')]){if(this[_0xe87e('0x1f')][this['mailAccounts'][_0x6e5890][_0xe87e('0x14')]['id']]){delete this['imapAccounts'][this[_0xe87e('0xd')][_0x6e5890]['Imap']['id']];}this[_0xe87e('0xd')][_0x6e5890][_0xe87e('0x14')][_0xe87e('0x34')]=moment();this['emit'](_0x6e5890);}};EmailChannel[_0xe87e('0xf')]['handleImapError']=function(_0x4355e3,_0x4f067){if(this['mailAccounts'][_0x4355e3]){this['mailAccounts'][_0x4355e3][_0xe87e('0x14')]['status']=_0xe87e('0x32');this[_0xe87e('0xd')][_0x4355e3]['Imap']['messageStatus']=_0x4f067;return this[_0xe87e('0x10')](_0x4355e3);}};EmailChannel[_0xe87e('0xf')]['sendMail']=function(_0x547149,_0x47cd05){return this['smtp'][_0xe87e('0x35')](_0x547149,_0x47cd05);};EmailChannel[_0xe87e('0xf')]['verifySmtp']=function(_0x5cccbd){var _0x28e4d8=this;if(this[_0xe87e('0xd')][_0x5cccbd['id']]){if(_[_0xe87e('0x16')](this[_0xe87e('0xd')][_0x5cccbd['id']][_0xe87e('0x36')])){this[_0xe87e('0xd')][_0x5cccbd['id']][_0xe87e('0x36')]={};}this[_0xe87e('0xd')][_0x5cccbd['id']][_0xe87e('0x36')][_0xe87e('0x34')]=moment();return new BPromise(function(_0x680737,_0x5ad9c8){return _0x28e4d8['smtp']['verify'](_0x5cccbd)[_0xe87e('0x30')](function(_0xb3c0d5){_0x28e4d8['mailAccounts'][_0x5cccbd['id']][_0xe87e('0x36')]['status']='verified';_0x28e4d8[_0xe87e('0xd')][_0x5cccbd['id']][_0xe87e('0x36')]['messageStatus']='';_0x28e4d8[_0xe87e('0x10')](_0x5cccbd['id']);_0x680737(_0xb3c0d5);})[_0xe87e('0x37')](function(_0x298572){_0x28e4d8['mailAccounts'][_0x5cccbd['id']][_0xe87e('0x36')][_0xe87e('0x27')]=_0xe87e('0x32');_0x28e4d8[_0xe87e('0xd')][_0x5cccbd['id']][_0xe87e('0x36')][_0xe87e('0x28')]=_0x298572;_0x28e4d8[_0xe87e('0x10')](_0x5cccbd['id']);_0x5ad9c8(_0x298572);});});}return this[_0xe87e('0xe')][_0xe87e('0x38')](_0x5cccbd);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index e009ec6..026ed6d 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 _0x3391=['handleFetchMessage','closeBox','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','emit','handleFetchEnd','handleFetchError','stringify','textCode','hasOwnProperty','upperFirst','lodash','util','imap','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','account','getAccount','ready','handleReady','bind','once','end','handleEnd','error','connect','inherits','prototype','connTimeout','authTimeout','service','modernAuthentication','xoauth2','generateXOAuth2Token','user','password','authentication','host','port','tls','handleError','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','message'];(function(_0xd22d95,_0xc59f8f){var _0x15d7a3=function(_0x3db95c){while(--_0x3db95c){_0xd22d95['push'](_0xd22d95['shift']());}};_0x15d7a3(++_0xc59f8f);}(_0x3391,0x17d));var _0x1339=function(_0x3b419e,_0x4109bc){_0x3b419e=_0x3b419e-0x0;var _0x1c0147=_0x3391[_0x3b419e];return _0x1c0147;};'use strict';var _=require(_0x1339('0x0'));var util=require(_0x1339('0x1'));var Imap=require(_0x1339('0x2'));var simpleParser=require(_0x1339('0x3'))[_0x1339('0x4')];var Iconv=require(_0x1339('0x5'))[_0x1339('0x6')];var EventEmitter=require(_0x1339('0x7'))[_0x1339('0x8')];var utils=require(_0x1339('0x9'));var logger=require(_0x1339('0xa'))(_0x1339('0xb'));function EmailImap(_0x1a111b,_0x3bad30){this[_0x1339('0xc')]=_0x1a111b[_0x1339('0xc')];this[_0x1339('0xd')]=this[_0x1339('0xe')](_0x1a111b,_0x3bad30);this[_0x1339('0x2')]=new Imap(this[_0x1339('0xd')]);this[_0x1339('0x2')]['once'](_0x1339('0xf'),this[_0x1339('0x10')][_0x1339('0x11')](this));this[_0x1339('0x2')][_0x1339('0x12')](_0x1339('0x13'),this[_0x1339('0x14')][_0x1339('0x11')](this));this[_0x1339('0x2')]['on'](_0x1339('0x15'),this['handleError'][_0x1339('0x11')](this));this[_0x1339('0x2')][_0x1339('0x16')]();}util[_0x1339('0x17')](EmailImap,EventEmitter);EmailImap[_0x1339('0x18')][_0x1339('0xe')]=function(_0x1c09b1,_0x10921c){var _0x2acd4d={'connTimeout':_0x1c09b1['connTimeout']?_0x1c09b1[_0x1339('0x19')]*0x3e8:0x2710,'authTimeout':_0x1c09b1[_0x1339('0x1a')]?_0x1c09b1[_0x1339('0x1a')]*0x3e8:0x1388};if(_0x1c09b1[_0x1339('0x1b')]){_0x2acd4d['user']=_0x1c09b1['user'];if(_0x1c09b1[_0x1339('0x1c')]){_0x2acd4d[_0x1339('0x1d')]=utils[_0x1339('0x1e')](_0x1c09b1['CloudProvider']['data5'],_0x1c09b1[_0x1339('0x1f')]);}else{_0x2acd4d[_0x1339('0x20')]=_0x1c09b1[_0x1339('0x20')];}}else{if(_0x1c09b1[_0x1339('0x21')]){_0x2acd4d[_0x1339('0x1f')]=_0x1c09b1[_0x1339('0x1f')];_0x2acd4d[_0x1339('0x20')]=_0x1c09b1['password'];}}_0x2acd4d[_0x1339('0xb')]=_0x10921c||_0x1c09b1[_0x1339('0x1f')]||'anonymous@xcally.com';_0x2acd4d[_0x1339('0x22')]=_0x1c09b1['host'];_0x2acd4d[_0x1339('0x23')]=_0x1c09b1[_0x1339('0x23')]||0x3e1;if(_0x1c09b1[_0x1339('0x24')]){_0x2acd4d['tls']=!![];}else{_0x2acd4d[_0x1339('0x24')]=![];_0x2acd4d['autotls']='required';}return _0x2acd4d;};EmailImap[_0x1339('0x18')][_0x1339('0x10')]=function(){this[_0x1339('0x2')]['openBox'](this[_0x1339('0xc')],![],this['handleOpenBox'][_0x1339('0x11')](this));};EmailImap[_0x1339('0x18')]['handleOpenBox']=function(_0x9fd40d,_0x47fad3){if(_0x9fd40d){this[_0x1339('0x25')](_0x9fd40d,!![]);}else{this['emit']('box',_0x47fad3);this[_0x1339('0x26')]();}};EmailImap['prototype'][_0x1339('0x27')]=function(_0x218094){if(_0x218094){this[_0x1339('0x25')](_0x218094,!![]);}else{this[_0x1339('0x2')][_0x1339('0x13')]();}};EmailImap[_0x1339('0x18')][_0x1339('0x26')]=function(){this[_0x1339('0x2')][_0x1339('0x28')]([_0x1339('0x29')],this[_0x1339('0x2a')][_0x1339('0x11')](this));};EmailImap[_0x1339('0x18')][_0x1339('0x2a')]=function(_0x5e9faa,_0x47b87e){if(_0x5e9faa){this[_0x1339('0x25')](_0x5e9faa,!![]);}else{if(_0x47b87e[_0x1339('0x2b')]){try{var _0x29c691=this[_0x1339('0x2')][_0x1339('0x2c')](_0x47b87e,{'bodies':'','markSeen':!![]});_0x29c691['on'](_0x1339('0x2d'),this[_0x1339('0x2e')][_0x1339('0x11')](this));_0x29c691[_0x1339('0x12')]('error',this['handleFetchError'][_0x1339('0x11')](this));_0x29c691[_0x1339('0x12')](_0x1339('0x13'),this['handleFetchEnd']['bind'](this));}catch(_0x1978cf){logger[_0x1339('0x15')](_0x1978cf);}}else{this[_0x1339('0x2')][_0x1339('0x2f')](!![],this[_0x1339('0x27')][_0x1339('0x11')](this));}}};EmailImap[_0x1339('0x18')]['handleFetchMessage']=function(_0x38815c){_0x38815c['on']('body',this[_0x1339('0x30')][_0x1339('0x11')](this));_0x38815c[_0x1339('0x12')](_0x1339('0x31'),this[_0x1339('0x32')][_0x1339('0x11')](this));_0x38815c[_0x1339('0x12')]('end',this[_0x1339('0x33')]['bind'](this));};EmailImap[_0x1339('0x18')]['handleMessageBody']=function(_0x51dc5b){simpleParser(_0x51dc5b,{'Iconv':Iconv},this['handleSimpleParser']['bind'](this));};EmailImap[_0x1339('0x18')][_0x1339('0x32')]=function(){};EmailImap[_0x1339('0x18')]['handleMessageEnd']=function(){};EmailImap['prototype'][_0x1339('0x34')]=function(_0x36d7a7,_0x30e8d4){if(_0x36d7a7){logger[_0x1339('0x15')](_0x36d7a7);}else{var _0x3f836b=this;utils[_0x1339('0x35')](this['account'],_0x30e8d4,function(_0x48c3f2){_0x3f836b[_0x1339('0x36')](_0x1339('0xb'),_0x48c3f2);});}};EmailImap[_0x1339('0x18')][_0x1339('0x37')]=function(){this[_0x1339('0x2')][_0x1339('0x2f')](!![],this[_0x1339('0x27')][_0x1339('0x11')](this));};EmailImap['prototype'][_0x1339('0x38')]=function(_0x1cca97){this[_0x1339('0x25')](_0x1cca97);this['imap']['closeBox'](!![],this[_0x1339('0x27')][_0x1339('0x11')](this));};EmailImap[_0x1339('0x18')][_0x1339('0x14')]=function(){this[_0x1339('0x36')](_0x1339('0x13'));};EmailImap[_0x1339('0x18')]['handleError']=function(_0x1a1508,_0x300561){logger[_0x1339('0x15')](_0x1339('0x25'),this['account'][_0x1339('0xb')],JSON[_0x1339('0x39')](_0x1a1508));var _0x2b4c92='';if(_0x1a1508){if(_0x1a1508[_0x1339('0x3a')]){_0x2b4c92=_0x1a1508[_0x1339('0x3a')];}else{for(var _0x5ad2df in _0x1a1508){if(_0x1a1508[_0x1339('0x3b')](_0x5ad2df)){_0x2b4c92+=_[_0x1339('0x3c')](_0x5ad2df)+':\x20'+_0x1a1508[_0x5ad2df]+'\x0a';}}}}if(_0x300561){this[_0x1339('0x2')][_0x1339('0x13')]();}else{this['emit']('error',_0x2b4c92);this['emit'](_0x1339('0x13'));}};module['exports']=EmailImap; \ No newline at end of file +var _0xfd4d=['handleError','connect','inherits','connTimeout','authTimeout','service','user','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','host','port','tls','autotls','prototype','handleReady','openBox','handleOpenBox','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','emit','stringify','textCode','upperFirst','lodash','util','imap','mailparser','simpleParser','iconv','Iconv','EventEmitter','../../../config/logger','email','mailbox','account','getAccount','ready','bind','once','end','handleEnd','error'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfd4d,0x167));var _0xdfd4=function(_0x487908,_0x424207){_0x487908=_0x487908-0x0;var _0x85c2d3=_0xfd4d[_0x487908];return _0x85c2d3;};'use strict';var _=require(_0xdfd4('0x0'));var util=require(_0xdfd4('0x1'));var Imap=require(_0xdfd4('0x2'));var simpleParser=require(_0xdfd4('0x3'))[_0xdfd4('0x4')];var Iconv=require(_0xdfd4('0x5'))[_0xdfd4('0x6')];var EventEmitter=require('events')[_0xdfd4('0x7')];var utils=require('./utils');var logger=require(_0xdfd4('0x8'))(_0xdfd4('0x9'));function EmailImap(_0x2718f4,_0x2fa5b5){this[_0xdfd4('0xa')]=_0x2718f4[_0xdfd4('0xa')];this[_0xdfd4('0xb')]=this[_0xdfd4('0xc')](_0x2718f4,_0x2fa5b5);this[_0xdfd4('0x2')]=new Imap(this[_0xdfd4('0xb')]);this[_0xdfd4('0x2')]['once'](_0xdfd4('0xd'),this['handleReady'][_0xdfd4('0xe')](this));this['imap'][_0xdfd4('0xf')](_0xdfd4('0x10'),this[_0xdfd4('0x11')][_0xdfd4('0xe')](this));this[_0xdfd4('0x2')]['on'](_0xdfd4('0x12'),this[_0xdfd4('0x13')][_0xdfd4('0xe')](this));this[_0xdfd4('0x2')][_0xdfd4('0x14')]();}util[_0xdfd4('0x15')](EmailImap,EventEmitter);EmailImap['prototype']['getAccount']=function(_0x13c6b4,_0x36f99d){var _0x303846={'connTimeout':_0x13c6b4[_0xdfd4('0x16')]?_0x13c6b4['connTimeout']*0x3e8:0x2710,'authTimeout':_0x13c6b4[_0xdfd4('0x17')]?_0x13c6b4['authTimeout']*0x3e8:0x1388};if(_0x13c6b4[_0xdfd4('0x18')]){_0x303846[_0xdfd4('0x19')]=_0x13c6b4[_0xdfd4('0x19')];if(_0x13c6b4['modernAuthentication']){_0x303846[_0xdfd4('0x1a')]=utils[_0xdfd4('0x1b')](_0x13c6b4[_0xdfd4('0x1c')][_0xdfd4('0x1d')],_0x13c6b4[_0xdfd4('0x19')]);}else{_0x303846[_0xdfd4('0x1e')]=_0x13c6b4[_0xdfd4('0x1e')];}}else{if(_0x13c6b4[_0xdfd4('0x1f')]){_0x303846['user']=_0x13c6b4[_0xdfd4('0x19')];_0x303846[_0xdfd4('0x1e')]=_0x13c6b4[_0xdfd4('0x1e')];}}_0x303846[_0xdfd4('0x9')]=_0x36f99d||_0x13c6b4[_0xdfd4('0x19')]||'anonymous@xcally.com';_0x303846[_0xdfd4('0x20')]=_0x13c6b4[_0xdfd4('0x20')];_0x303846[_0xdfd4('0x21')]=_0x13c6b4[_0xdfd4('0x21')]||0x3e1;if(_0x13c6b4[_0xdfd4('0x22')]){_0x303846[_0xdfd4('0x22')]=!![];}else{_0x303846[_0xdfd4('0x22')]=![];_0x303846[_0xdfd4('0x23')]='required';}return _0x303846;};EmailImap[_0xdfd4('0x24')][_0xdfd4('0x25')]=function(){this[_0xdfd4('0x2')][_0xdfd4('0x26')](this[_0xdfd4('0xa')],![],this['handleOpenBox'][_0xdfd4('0xe')](this));};EmailImap[_0xdfd4('0x24')][_0xdfd4('0x27')]=function(_0x3ec86e,_0x345777){if(_0x3ec86e){this[_0xdfd4('0x13')](_0x3ec86e,!![]);}else{this['emit'](_0xdfd4('0x28'),_0x345777);this[_0xdfd4('0x29')]();}};EmailImap[_0xdfd4('0x24')][_0xdfd4('0x2a')]=function(_0x51e134){if(_0x51e134){this[_0xdfd4('0x13')](_0x51e134,!![]);}else{this[_0xdfd4('0x2')][_0xdfd4('0x10')]();}};EmailImap[_0xdfd4('0x24')][_0xdfd4('0x29')]=function(){this['imap'][_0xdfd4('0x2b')]([_0xdfd4('0x2c')],this['handleReadUnseen'][_0xdfd4('0xe')](this));};EmailImap['prototype'][_0xdfd4('0x2d')]=function(_0x3da25a,_0x31d170){if(_0x3da25a){this[_0xdfd4('0x13')](_0x3da25a,!![]);}else{if(_0x31d170[_0xdfd4('0x2e')]){try{var _0xa9b918=this['imap'][_0xdfd4('0x2f')](_0x31d170,{'bodies':'','markSeen':!![]});_0xa9b918['on'](_0xdfd4('0x30'),this[_0xdfd4('0x31')]['bind'](this));_0xa9b918[_0xdfd4('0xf')](_0xdfd4('0x12'),this[_0xdfd4('0x32')]['bind'](this));_0xa9b918[_0xdfd4('0xf')]('end',this[_0xdfd4('0x33')][_0xdfd4('0xe')](this));}catch(_0x37c256){logger['error'](_0x37c256);}}else{this['imap'][_0xdfd4('0x34')](!![],this[_0xdfd4('0x2a')][_0xdfd4('0xe')](this));}}};EmailImap['prototype']['handleFetchMessage']=function(_0x34771e){_0x34771e['on'](_0xdfd4('0x35'),this[_0xdfd4('0x36')]['bind'](this));_0x34771e['once'](_0xdfd4('0x37'),this[_0xdfd4('0x38')]['bind'](this));_0x34771e[_0xdfd4('0xf')](_0xdfd4('0x10'),this[_0xdfd4('0x39')]['bind'](this));};EmailImap[_0xdfd4('0x24')][_0xdfd4('0x36')]=function(_0x4fde2d){simpleParser(_0x4fde2d,{'Iconv':Iconv},this[_0xdfd4('0x3a')][_0xdfd4('0xe')](this));};EmailImap[_0xdfd4('0x24')][_0xdfd4('0x38')]=function(){};EmailImap[_0xdfd4('0x24')]['handleMessageEnd']=function(){};EmailImap[_0xdfd4('0x24')][_0xdfd4('0x3a')]=function(_0x8bdd31,_0x3762f7){if(_0x8bdd31){logger[_0xdfd4('0x12')](_0x8bdd31);}else{var _0x1844f0=this;utils['parser'](this[_0xdfd4('0xb')],_0x3762f7,function(_0x1f8525){_0x1844f0[_0xdfd4('0x3b')](_0xdfd4('0x9'),_0x1f8525);});}};EmailImap[_0xdfd4('0x24')][_0xdfd4('0x33')]=function(){this[_0xdfd4('0x2')][_0xdfd4('0x34')](!![],this['handleCloseBox'][_0xdfd4('0xe')](this));};EmailImap[_0xdfd4('0x24')]['handleFetchError']=function(_0x3ff79c){this['handleError'](_0x3ff79c);this['imap'][_0xdfd4('0x34')](!![],this[_0xdfd4('0x2a')][_0xdfd4('0xe')](this));};EmailImap['prototype']['handleEnd']=function(){this['emit']('end');};EmailImap['prototype'][_0xdfd4('0x13')]=function(_0x4dd5e6,_0x4831fc){logger[_0xdfd4('0x12')]('handleError',this[_0xdfd4('0xb')][_0xdfd4('0x9')],JSON[_0xdfd4('0x3c')](_0x4dd5e6));var _0x5c01f4='';if(_0x4dd5e6){if(_0x4dd5e6['textCode']){_0x5c01f4=_0x4dd5e6[_0xdfd4('0x3d')];}else{for(var _0x3f2bfd in _0x4dd5e6){if(_0x4dd5e6['hasOwnProperty'](_0x3f2bfd)){_0x5c01f4+=_[_0xdfd4('0x3e')](_0x3f2bfd)+':\x20'+_0x4dd5e6[_0x3f2bfd]+'\x0a';}}}}if(_0x4831fc){this[_0xdfd4('0x2')][_0xdfd4('0x10')]();}else{this[_0xdfd4('0x3b')](_0xdfd4('0x12'),_0x5c01f4);this[_0xdfd4('0x3b')](_0xdfd4('0x10'));}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 8c46aca..dac406b 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 _0x79d3=['nodemailer','nodemailer-plugin-inline-base64','send','createTransport','use','compile','sendMail','toString','verify','Not\x20verifired'];(function(_0x19505d,_0x59e380){var _0x455fdb=function(_0x2a68a9){while(--_0x2a68a9){_0x19505d['push'](_0x19505d['shift']());}};_0x455fdb(++_0x59e380);}(_0x79d3,0xd2));var _0x379d=function(_0x32bbb1,_0xa0e27e){_0x32bbb1=_0x32bbb1-0x0;var _0x42b415=_0x79d3[_0x32bbb1];return _0x42b415;};'use strict';var nodemailer=require(_0x379d('0x0'));var inlineBase64=require(_0x379d('0x1'));function EmailSmtp(){}EmailSmtp['prototype'][_0x379d('0x2')]=function(_0xb14d92,_0x1dcabb){return new Promise(function(_0x29666d,_0x1e7194){var _0xfa0bc5=nodemailer[_0x379d('0x3')](_0xb14d92);_0xfa0bc5[_0x379d('0x4')](_0x379d('0x5'),inlineBase64());_0xfa0bc5[_0x379d('0x6')](_0x1dcabb,function(_0x8a00c,_0x3c93e1){if(_0x8a00c){_0x1e7194(_0x8a00c[_0x379d('0x7')]());}else{_0x29666d(_0x3c93e1);}});});};EmailSmtp['prototype'][_0x379d('0x8')]=function(_0x6b9a73){return new Promise(function(_0x35fbfa,_0x4be47d){var _0x20a124=nodemailer[_0x379d('0x3')](_0x6b9a73);_0x20a124[_0x379d('0x8')](function(_0x2fd684,_0x6f1a80){if(_0x2fd684){_0x4be47d(_0x2fd684[_0x379d('0x7')]());}else{if(_0x6f1a80){_0x35fbfa(_0x6f1a80);}else{_0x4be47d(_0x379d('0x9'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0xcf3a=['compile','sendMail','toString','Not\x20verifired','nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport','use'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcf3a,0x7c));var _0xacf3=function(_0x417333,_0xc52e8){_0x417333=_0x417333-0x0;var _0x307402=_0xcf3a[_0x417333];return _0x307402;};'use strict';var nodemailer=require(_0xacf3('0x0'));var inlineBase64=require(_0xacf3('0x1'));function EmailSmtp(){}EmailSmtp[_0xacf3('0x2')][_0xacf3('0x3')]=function(_0x40ce4b,_0xc79bfe){return new Promise(function(_0x35195e,_0x512c21){var _0x108fb7=nodemailer[_0xacf3('0x4')](_0x40ce4b);_0x108fb7[_0xacf3('0x5')](_0xacf3('0x6'),inlineBase64());_0x108fb7[_0xacf3('0x7')](_0xc79bfe,function(_0x312996,_0x2807be){if(_0x312996){_0x512c21(_0x312996[_0xacf3('0x8')]());}else{_0x35195e(_0x2807be);}});});};EmailSmtp[_0xacf3('0x2')]['verify']=function(_0x222de5){return new Promise(function(_0x37eca8,_0x4a5a00){var _0x25cf39=nodemailer[_0xacf3('0x4')](_0x222de5);_0x25cf39['verify'](function(_0x3e296b,_0x22962d){if(_0x3e296b){_0x4a5a00(_0x3e296b[_0xacf3('0x8')]());}else{if(_0x22962d){_0x37eca8(_0x22962d);}else{_0x4a5a00(_0xacf3('0x9'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 71ca3ab..69dec34 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 _0xbf6f=['head','value','address','anonymous','generate','@xcally.com','name','substring','split','length','slice','join','Anonymous','pop','html','test','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','auth=Bearer\x20','toString','lodash','moment','randomstring','util','../../../config/logger','email','../../../config/environment'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xbf6f,0x157));var _0xfbf6=function(_0x5c52e6,_0x2a98fa){_0x5c52e6=_0x5c52e6-0x0;var _0x48c5ef=_0xbf6f[_0x5c52e6];return _0x48c5ef;};'use strict';var _=require(_0xfbf6('0x0'));var moment=require(_0xfbf6('0x1'));var random=require(_0xfbf6('0x2'));var fs=require('fs');var path=require('path');var util=require(_0xfbf6('0x3'));var tnef=require('node-tnef');var logger=require(_0xfbf6('0x4'))(_0xfbf6('0x5'));var config=require(_0xfbf6('0x6'));function getAddress(_0x3f6fc3){var _0x41053d=_[_0xfbf6('0x7')](_0x3f6fc3[_0xfbf6('0x8')]);return _0x41053d&&_0x41053d[_0xfbf6('0x9')]?_0x41053d[_0xfbf6('0x9')]:_0xfbf6('0xa')+random[_0xfbf6('0xb')](0x6)+_0xfbf6('0xc');}function getFirstName(_0x1c97d1){var _0x4cfae1=_[_0xfbf6('0x7')](_0x1c97d1[_0xfbf6('0x8')]);if(_0x4cfae1&&_0x4cfae1['name']){if(_0x4cfae1[_0xfbf6('0xd')]==_0x4cfae1[_0xfbf6('0x9')]){return _0x4cfae1['name'][_0xfbf6('0xe')](0x0,_0x4cfae1['name']['indexOf']('@'));}var _0x4db9b3=_0x4cfae1[_0xfbf6('0xd')][_0xfbf6('0xf')](/\s+/);return _0x4db9b3[_0xfbf6('0x10')]>0x1?_0x4db9b3[_0xfbf6('0x11')](0x0,-0x1)[_0xfbf6('0x12')]('\x20'):_0x4cfae1[_0xfbf6('0xd')];}return _0xfbf6('0x13');}function getLastName(_0x16d13e){var _0x454553=_[_0xfbf6('0x7')](_0x16d13e[_0xfbf6('0x8')]);if(_0x454553&&_0x454553[_0xfbf6('0xd')]){var _0x1ebfeb=_0x454553['name']['split'](/\s+/);return _0x1ebfeb['length']>0x1?_0x1ebfeb[_0xfbf6('0x14')]():'';}return'';}function getMails(_0x128ce0,_0x94393a){var _0x2bbdf4='';for(var _0x45aed8=0x0;_0x45aed8<_0x94393a[_0xfbf6('0x8')][_0xfbf6('0x10')];_0x45aed8+=0x1){if(_0x94393a[_0xfbf6('0x8')][_0x45aed8]['address']!==_0x128ce0){if(!_['isEmpty'](_0x2bbdf4)){_0x2bbdf4+=',';}_0x2bbdf4+=_0x94393a[_0xfbf6('0x8')][_0x45aed8][_0xfbf6('0xd')]||_0x94393a[_0xfbf6('0x8')][_0x45aed8][_0xfbf6('0x9')]||'';_0x2bbdf4+='\x20<';_0x2bbdf4+=_0x94393a[_0xfbf6('0x8')][_0x45aed8][_0xfbf6('0x9')]?_0x94393a['value'][_0x45aed8][_0xfbf6('0x9')]:_0xfbf6('0xa')+random[_0xfbf6('0xb')](0x6)+_0xfbf6('0xc');_0x2bbdf4+='>';}}return _0x2bbdf4;}function parseEmail(_0x4ebd4c,_0x52414e,_0x4a4374){if(_0x52414e[_0xfbf6('0x15')]){var _0x581789=/)<[^<]*)*<\/script>/gi;while(_0x581789[_0xfbf6('0x16')](_0x52414e[_0xfbf6('0x15')])){_0x52414e[_0xfbf6('0x15')]=_0x52414e[_0xfbf6('0x15')]['replace'](_0x581789,'');}if(_0x52414e[_0xfbf6('0x15')][_0xfbf6('0x17')](_0xfbf6('0x18'))){var _0x272bc7=[];_0x52414e[_0xfbf6('0x19')]['forEach'](_0x42c644=>{_0x272bc7[_0xfbf6('0x1a')](_0x42c644[_0xfbf6('0x1b')]);});var _0x1222ca=/]+>/g;var _0x283461=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x3694ca=_0x52414e[_0xfbf6('0x15')][_0xfbf6('0x1c')](_0x283461,'_SRC');var _0x308cc8=_0x3694ca[_0xfbf6('0x1c')](_0x1222ca,_0xfbf6('0x1d'));for(let _0xce065=0x0;_0xce065<_0x272bc7['length'];_0xce065++){var _0x1ede15=_0x308cc8[_0xfbf6('0x1c')](_0xfbf6('0x1d'),_0xfbf6('0x1e')+_0x272bc7[_0xce065]+_0xfbf6('0x1f'));_0x308cc8=_0x1ede15;}_0x52414e[_0xfbf6('0x15')]=_0x308cc8;}_0x4a4374[_0xfbf6('0x20')]=_0x52414e[_0xfbf6('0x15')];}else{_0x4a4374[_0xfbf6('0x20')]=_0x52414e[_0xfbf6('0x21')];}if(_0x4a4374[_0xfbf6('0x20')]){_0x4a4374[_0xfbf6('0x20')]=_0x4a4374[_0xfbf6('0x20')][_0xfbf6('0x1c')](/0x0){var _0x511abf=[_0xfbf6('0x2f'),'X-Auto-Response-Suppress:\x20All',_0xfbf6('0x30')];for(var _0x318e51=0x0;_0x318e51<_0x52414e['headerLines'][_0xfbf6('0x10')];_0x318e51++){var _0x10f042=_['indexOf'](_0x511abf,_0x52414e['headerLines'][_0x318e51][_0xfbf6('0x31')]);if(_0x10f042>=0x0){_0x4a4374[_0xfbf6('0x32')]=!![];}}}return _0x4a4374;}exports[_0xfbf6('0x33')]=function(_0x454ba1,_0x49a70b,_0x4c197b){var _0x14c0e4={'from':getAddress(_0x49a70b['from']),'firstName':getFirstName(_0x49a70b[_0xfbf6('0x34')]),'lastName':getLastName(_0x49a70b[_0xfbf6('0x34')]),'mapKey':_0xfbf6('0x5'),'message':{'from':getMails(_0x454ba1[_0xfbf6('0x5')],_0x49a70b['from']),'to':_0x454ba1['email'],'cc':'','subject':_0x49a70b[_0xfbf6('0x35')]||'','messageId':_0x49a70b[_0xfbf6('0x36')],'inReplyTo':_0x49a70b[_0xfbf6('0x37')],'sentAt':moment(_0x49a70b[_0xfbf6('0x38')])[_0xfbf6('0x39')](_0xfbf6('0x3a')),'attach':![],'attachments':[]}};if(!_0x49a70b[_0xfbf6('0x15')]&&!_0x49a70b[_0xfbf6('0x21')]){var _0x264474=_[_0xfbf6('0x3b')](_0x49a70b[_0xfbf6('0x19')],{'contentType':'application/ms-tnef'});if(_0x264474['length']){logger[_0xfbf6('0x3c')](util[_0xfbf6('0x39')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x49a70b[_0xfbf6('0x36')]));tnef[_0xfbf6('0x3d')](_['first'](_0x264474)['content'],function(_0x45ae8c,_0x39862c){if(_0x39862c){_0x49a70b[_0xfbf6('0x15')]=_0x39862c[_0xfbf6('0x3e')]||_0xfbf6('0x3f');if(_0x39862c['Attachments']){for(var _0x5d00ab=0x0;_0x5d00ab<_0x39862c['Attachments'][_0xfbf6('0x10')];_0x5d00ab++){var _0x5ca842=_0x39862c[_0xfbf6('0x40')][_0x5d00ab];_0x14c0e4[_0xfbf6('0x23')][_0xfbf6('0x19')][_0xfbf6('0x1a')]({'filename':_0x5ca842[_0xfbf6('0x41')],'content':Buffer['from'](_0x5ca842[_0xfbf6('0x42')])});}}}_0x4c197b(parseEmail(_0x454ba1,_0x49a70b,_0x14c0e4));});}else{_0x49a70b[_0xfbf6('0x15')]=_0xfbf6('0x3f');_0x4c197b(parseEmail(_0x454ba1,_0x49a70b,_0x14c0e4));}}else{_0x4c197b(parseEmail(_0x454ba1,_0x49a70b,_0x14c0e4));}};exports[_0xfbf6('0x43')]=function(_0xad670b,_0x291433){var _0x4d4e8d=['user='+(_0x291433||''),_0xfbf6('0x44')+_0xad670b,'',''];return Buffer['from'](_0x4d4e8d['join'](''),'utf-8')[_0xfbf6('0x45')]('base64');}; \ No newline at end of file +var _0x114b=['name','indexOf','split','slice','join','Anonymous','length','pop','isEmpty','html','test','replace','\x20[Attachment:\x20','body','textAsHtml','Empty\x20message

','Attachments','Title','Data','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com'];(function(_0x18f446,_0x5f5b86){var _0x1d7062=function(_0x3768b5){while(--_0x3768b5){_0x18f446['push'](_0x18f446['shift']());}};_0x1d7062(++_0x5f5b86);}(_0x114b,0x1ba));var _0xb114=function(_0x5f12fc,_0x4f7c5f){_0x5f12fc=_0x5f12fc-0x0;var _0x91b425=_0x114b[_0x5f12fc];return _0x91b425;};'use strict';var _=require(_0xb114('0x0'));var moment=require('moment');var random=require(_0xb114('0x1'));var fs=require('fs');var path=require(_0xb114('0x2'));var util=require(_0xb114('0x3'));var tnef=require(_0xb114('0x4'));var logger=require(_0xb114('0x5'))(_0xb114('0x6'));var config=require(_0xb114('0x7'));function getAddress(_0x17ad74){var _0x3cf6a9=_[_0xb114('0x8')](_0x17ad74[_0xb114('0x9')]);return _0x3cf6a9&&_0x3cf6a9['address']?_0x3cf6a9[_0xb114('0xa')]:_0xb114('0xb')+random[_0xb114('0xc')](0x6)+_0xb114('0xd');}function getFirstName(_0x33d9ad){var _0x32425b=_[_0xb114('0x8')](_0x33d9ad['value']);if(_0x32425b&&_0x32425b['name']){if(_0x32425b[_0xb114('0xe')]==_0x32425b[_0xb114('0xa')]){return _0x32425b[_0xb114('0xe')]['substring'](0x0,_0x32425b[_0xb114('0xe')][_0xb114('0xf')]('@'));}var _0x381344=_0x32425b[_0xb114('0xe')][_0xb114('0x10')](/\s+/);return _0x381344['length']>0x1?_0x381344[_0xb114('0x11')](0x0,-0x1)[_0xb114('0x12')]('\x20'):_0x32425b[_0xb114('0xe')];}return _0xb114('0x13');}function getLastName(_0x3a2849){var _0x18d855=_[_0xb114('0x8')](_0x3a2849[_0xb114('0x9')]);if(_0x18d855&&_0x18d855['name']){var _0x3a2352=_0x18d855[_0xb114('0xe')][_0xb114('0x10')](/\s+/);return _0x3a2352[_0xb114('0x14')]>0x1?_0x3a2352[_0xb114('0x15')]():'';}return'';}function getMails(_0x30647c,_0x2b5f54){var _0x538171='';for(var _0x554146=0x0;_0x554146<_0x2b5f54[_0xb114('0x9')]['length'];_0x554146+=0x1){if(_0x2b5f54[_0xb114('0x9')][_0x554146][_0xb114('0xa')]!==_0x30647c){if(!_[_0xb114('0x16')](_0x538171)){_0x538171+=',';}_0x538171+=_0x2b5f54[_0xb114('0x9')][_0x554146][_0xb114('0xe')]||_0x2b5f54[_0xb114('0x9')][_0x554146][_0xb114('0xa')]||'';_0x538171+='\x20<';_0x538171+=_0x2b5f54[_0xb114('0x9')][_0x554146][_0xb114('0xa')]?_0x2b5f54[_0xb114('0x9')][_0x554146]['address']:_0xb114('0xb')+random[_0xb114('0xc')](0x6)+_0xb114('0xd');_0x538171+='>';}}return _0x538171;}function parseEmail(_0x33f4f6,_0x47f886,_0x5c2b27){if(_0x47f886[_0xb114('0x17')]){var _0x31adf4=/)<[^<]*)*<\/script>/gi;while(_0x31adf4[_0xb114('0x18')](_0x47f886[_0xb114('0x17')])){_0x47f886[_0xb114('0x17')]=_0x47f886[_0xb114('0x17')][_0xb114('0x19')](_0x31adf4,'');}if(_0x47f886['html']['includes'](_0xb114('0x1a'))){var _0x4b7177=[];_0x47f886['attachments'][_0xb114('0x1b')](_0x30ea0e=>{_0x4b7177['push'](_0x30ea0e[_0xb114('0x1c')]);});var _0x393f88=/]+>/g;var _0x4c351f=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x57a717=_0x47f886[_0xb114('0x17')]['replace'](_0x4c351f,_0xb114('0x1d'));var _0x2bbf38=_0x57a717[_0xb114('0x19')](_0x393f88,_0xb114('0x1e'));for(let _0x5c8fc4=0x0;_0x5c8fc4<_0x4b7177[_0xb114('0x14')];_0x5c8fc4++){var _0x22f035=_0x2bbf38[_0xb114('0x19')]('_IMG',_0xb114('0x1f')+_0x4b7177[_0x5c8fc4]+'\x20]');_0x2bbf38=_0x22f035;}_0x47f886[_0xb114('0x17')]=_0x2bbf38;}_0x5c2b27[_0xb114('0x20')]=_0x47f886[_0xb114('0x17')];}else{_0x5c2b27[_0xb114('0x20')]=_0x47f886[_0xb114('0x21')];}if(_0x5c2b27[_0xb114('0x20')]){_0x5c2b27[_0xb114('0x20')]=_0x5c2b27[_0xb114('0x20')][_0xb114('0x19')](/0x0){var _0x123239=[_0xb114('0x35'),_0xb114('0x36'),'Precedence:\x20auto_reply'];for(var _0x420caa=0x0;_0x420caa<_0x47f886[_0xb114('0x34')][_0xb114('0x14')];_0x420caa++){var _0x47cf38=_[_0xb114('0xf')](_0x123239,_0x47f886[_0xb114('0x34')][_0x420caa][_0xb114('0x37')]);if(_0x47cf38>=0x0){_0x5c2b27['isAutoreply']=!![];}}}return _0x5c2b27;}exports[_0xb114('0x38')]=function(_0x10f224,_0x5cfe60,_0x4037a9){var _0x9f606c={'from':getAddress(_0x5cfe60[_0xb114('0x39')]),'firstName':getFirstName(_0x5cfe60[_0xb114('0x39')]),'lastName':getLastName(_0x5cfe60[_0xb114('0x39')]),'mapKey':_0xb114('0x6'),'message':{'from':getMails(_0x10f224[_0xb114('0x6')],_0x5cfe60[_0xb114('0x39')]),'to':_0x10f224[_0xb114('0x6')],'cc':'','subject':_0x5cfe60['subject']||'','messageId':_0x5cfe60[_0xb114('0x3a')],'inReplyTo':_0x5cfe60[_0xb114('0x3b')],'sentAt':moment(_0x5cfe60[_0xb114('0x3c')])[_0xb114('0x2d')](_0xb114('0x3d')),'attach':![],'attachments':[]}};if(!_0x5cfe60[_0xb114('0x17')]&&!_0x5cfe60[_0xb114('0x21')]){var _0x326418=_['filter'](_0x5cfe60[_0xb114('0x28')],{'contentType':_0xb114('0x3e')});if(_0x326418[_0xb114('0x14')]){logger[_0xb114('0x3f')](util[_0xb114('0x2d')](_0xb114('0x40'),_0x5cfe60[_0xb114('0x3a')]));tnef[_0xb114('0x41')](_['first'](_0x326418)[_0xb114('0x31')],function(_0x2474ff,_0x48072a){if(_0x48072a){_0x5cfe60[_0xb114('0x17')]=_0x48072a[_0xb114('0x42')]||_0xb114('0x43');if(_0x48072a['Attachments']){for(var _0x232452=0x0;_0x232452<_0x48072a['Attachments']['length'];_0x232452++){var _0x38b541=_0x48072a[_0xb114('0x44')][_0x232452];_0x9f606c[_0xb114('0x23')]['attachments'][_0xb114('0x32')]({'filename':_0x38b541[_0xb114('0x45')],'content':Buffer[_0xb114('0x39')](_0x38b541[_0xb114('0x46')])});}}}_0x4037a9(parseEmail(_0x10f224,_0x5cfe60,_0x9f606c));});}else{_0x5cfe60[_0xb114('0x17')]=_0xb114('0x43');_0x4037a9(parseEmail(_0x10f224,_0x5cfe60,_0x9f606c));}}else{_0x4037a9(parseEmail(_0x10f224,_0x5cfe60,_0x9f606c));}};exports['generateXOAuth2Token']=function(_0x89359,_0x4562c1){var _0x498568=[_0xb114('0x47')+(_0x4562c1||''),_0xb114('0x48')+_0x89359,'',''];return Buffer[_0xb114('0x39')](_0x498568[_0xb114('0x12')](''),_0xb114('0x49'))[_0xb114('0x4a')](_0xb114('0x4b'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 831d3e3..1ced2d1 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 _0xa727=['lodash','name','key','SERV','active','Imap','Smtp','exports'];(function(_0xed36d2,_0x49cb7b){var _0x18bdd5=function(_0x1e522f){while(--_0x1e522f){_0xed36d2['push'](_0xed36d2['shift']());}};_0x18bdd5(++_0x49cb7b);}(_0xa727,0x190));var _0x7a72=function(_0x2031c1,_0x593e31){_0x2031c1=_0x2031c1-0x0;var _0x4dfeba=_0xa727[_0x2031c1];return _0x4dfeba;};'use strict';var _=require(_0x7a72('0x0'));function MailAccount(_0xb09165){this['id']=_0xb09165['id']||0x0;this[_0x7a72('0x1')]=_0xb09165[_0x7a72('0x1')]||'Service';this[_0x7a72('0x2')]=_0xb09165[_0x7a72('0x2')]||_0x7a72('0x3');this[_0x7a72('0x4')]=_0xb09165[_0x7a72('0x4')]||![];this['Imap']=_0xb09165[_0x7a72('0x5')]||[];this[_0x7a72('0x6')]=_0xb09165[_0x7a72('0x6')]||[];}module[_0x7a72('0x7')]=MailAccount; \ No newline at end of file +var _0xb08b=['Service','SERV','active','Imap','Smtp','exports','lodash','name'];(function(_0x58ccd5,_0x1f3697){var _0x7c4be2=function(_0x3561a0){while(--_0x3561a0){_0x58ccd5['push'](_0x58ccd5['shift']());}};_0x7c4be2(++_0x1f3697);}(_0xb08b,0xe6));var _0xbb08=function(_0x552a17,_0x25ddd5){_0x552a17=_0x552a17-0x0;var _0x4105e8=_0xb08b[_0x552a17];return _0x4105e8;};'use strict';var _=require(_0xbb08('0x0'));function MailAccount(_0x19ae13){this['id']=_0x19ae13['id']||0x0;this[_0xbb08('0x1')]=_0x19ae13[_0xbb08('0x1')]||_0xbb08('0x2');this['key']=_0x19ae13['key']||_0xbb08('0x3');this[_0xbb08('0x4')]=_0x19ae13[_0xbb08('0x4')]||![];this[_0xbb08('0x5')]=_0x19ae13['Imap']||[];this[_0xbb08('0x6')]=_0x19ae13['Smtp']||[];}module[_0xbb08('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 260088a..a42b5b8 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 _0x5c4c=['exports','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length','merge'];(function(_0x311686,_0x3e6112){var _0x1b47f8=function(_0x5161c5){while(--_0x5161c5){_0x311686['push'](_0x311686['shift']());}};_0x1b47f8(++_0x3e6112);}(_0x5c4c,0x156));var _0xc5c4=function(_0x4f5b0c,_0xc3d777){_0x4f5b0c=_0x4f5b0c-0x0;var _0x29b45d=_0x5c4c[_0x4f5b0c];return _0x29b45d;};'use strict';var _=require(_0xc5c4('0x0'));var MailAccount=require(_0xc5c4('0x1'));var Realtime=function(){this[_0xc5c4('0x2')]={};};function freeIsNotKey(_0x53f708,_0x4dbead,_0x6fb0b3){var _0x29dcf0=_[_0xc5c4('0x3')](_0x53f708,function(_0x2d53cf,_0x4e879a){return _0x2d53cf[_0x6fb0b3];});for(var _0x53eac6 in _0x4dbead){if(_0x4dbead[_0xc5c4('0x4')](_0x53eac6)){if(!_0x29dcf0[_0x53eac6]){delete _0x4dbead[_0x53eac6];}}}}Realtime[_0xc5c4('0x5')][_0xc5c4('0x6')]=function(_0x4799e9,_0x56011e){for(var _0x35ccfc in _0x56011e){if(_0x4799e9[_0xc5c4('0x4')](_0x35ccfc)){_0x4799e9[_0x35ccfc]=_0x56011e[_0x35ccfc];}}};Realtime[_0xc5c4('0x5')][_0xc5c4('0x7')]=function(){var _0x171c8c=this;return function(_0x1164bd){if(_0x1164bd){freeIsNotKey(_0x1164bd,_0x171c8c['mailAccounts'],'id');for(var _0x22e89a=0x0,_0x3d17f6={},_0x27faf3={};_0x22e89a<_0x1164bd[_0xc5c4('0x8')];_0x22e89a+=0x1){_0x3d17f6=_0x1164bd[_0x22e89a];if(_['isUndefined'](_0x171c8c['mailAccounts'][_0x3d17f6['id']])){_0x171c8c[_0xc5c4('0x2')][_0x3d17f6['id']]=new MailAccount(_0x3d17f6);}else{_[_0xc5c4('0x9')](_0x171c8c['mailAccounts'][_0x3d17f6['id']],_0x3d17f6);}}}return _0x171c8c[_0xc5c4('0x2')];};};module[_0xc5c4('0xa')]=Realtime; \ No newline at end of file +var _0xd8a8=['mergeFromDatabase','prototype','initMailAccounts','isUndefined','merge','exports','lodash','mailAccounts','hasOwnProperty'];(function(_0x3f16e2,_0x5ddde8){var _0x565889=function(_0x1d443e){while(--_0x1d443e){_0x3f16e2['push'](_0x3f16e2['shift']());}};_0x565889(++_0x5ddde8);}(_0xd8a8,0xf9));var _0x8d8a=function(_0x28cc96,_0x2bd849){_0x28cc96=_0x28cc96-0x0;var _0x3414f4=_0xd8a8[_0x28cc96];return _0x3414f4;};'use strict';var _=require(_0x8d8a('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0x8d8a('0x1')]={};};function freeIsNotKey(_0x3edab7,_0x19fe7f,_0x544888){var _0x1f94c=_['mapKeys'](_0x3edab7,function(_0x20f82b,_0x155d3f){return _0x20f82b[_0x544888];});for(var _0x146a6b in _0x19fe7f){if(_0x19fe7f[_0x8d8a('0x2')](_0x146a6b)){if(!_0x1f94c[_0x146a6b]){delete _0x19fe7f[_0x146a6b];}}}}Realtime['prototype'][_0x8d8a('0x3')]=function(_0x4f07a3,_0x5d6ef5){for(var _0x3b10d7 in _0x5d6ef5){if(_0x4f07a3[_0x8d8a('0x2')](_0x3b10d7)){_0x4f07a3[_0x3b10d7]=_0x5d6ef5[_0x3b10d7];}}};Realtime[_0x8d8a('0x4')][_0x8d8a('0x5')]=function(){var _0xe25ff6=this;return function(_0x4012c3){if(_0x4012c3){freeIsNotKey(_0x4012c3,_0xe25ff6[_0x8d8a('0x1')],'id');for(var _0x53af67=0x0,_0x3a3947={},_0x218223={};_0x53af67<_0x4012c3['length'];_0x53af67+=0x1){_0x3a3947=_0x4012c3[_0x53af67];if(_[_0x8d8a('0x6')](_0xe25ff6[_0x8d8a('0x1')][_0x3a3947['id']])){_0xe25ff6[_0x8d8a('0x1')][_0x3a3947['id']]=new MailAccount(_0x3a3947);}else{_[_0x8d8a('0x7')](_0xe25ff6[_0x8d8a('0x1')][_0x3a3947['id']],_0x3a3947);}}}return _0xe25ff6['mailAccounts'];};};module[_0x8d8a('0x8')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 9462286..2e82c6f 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 _0x8991=['ListId','TemplateId','MailServerIn','Imap','CloudProvider','type','MailServerOut','data5','getMailAccount','notify','Request','NotifyMailAccount','../client','getMailAccounts','name','provider','service','email','active','key'];(function(_0x5e3b59,_0x242eb3){var _0x5c3434=function(_0x1c9bc5){while(--_0x1c9bc5){_0x5e3b59['push'](_0x5e3b59['shift']());}};_0x5c3434(++_0x242eb3);}(_0x8991,0x1b0));var _0x1899=function(_0xbc9b18,_0x4b8e42){_0xbc9b18=_0xbc9b18-0x0;var _0x432f8a=_0x8991[_0xbc9b18];return _0x432f8a;};'use strict';var client=require(_0x1899('0x0'));exports[_0x1899('0x1')]=function(){return function(){return client['Request']('GetMailAccount',{'options':{'attributes':['id',_0x1899('0x2'),_0x1899('0x3'),_0x1899('0x4'),_0x1899('0x5'),_0x1899('0x6'),_0x1899('0x7'),_0x1899('0x8'),_0x1899('0x9')],'raw':![],'include':[{'model':_0x1899('0xa'),'as':_0x1899('0xb'),'include':[{'model':_0x1899('0xc'),'attributes':['id',_0x1899('0x2'),_0x1899('0x4'),_0x1899('0xd'),'data5'],'as':_0x1899('0xc')}]},{'model':_0x1899('0xe'),'as':'Smtp','include':[{'model':_0x1899('0xc'),'attributes':['id',_0x1899('0x2'),_0x1899('0x4'),'type',_0x1899('0xf')],'as':_0x1899('0xc')}]}]},'log':_0x1899('0x10')});};};exports[_0x1899('0x11')]=function(_0x56fa3a,_0x4811fb){return client[_0x1899('0x12')]('NotifyMailAccount',{'account':{'id':_0x56fa3a},'body':_0x4811fb,'log':_0x1899('0x13')});}; \ No newline at end of file +var _0xaf79=['getMailAccount','notify','NotifyMailAccount','../client','Request','GetMailAccount','name','provider','service','TemplateId','MailServerIn','Imap','CloudProvider','type','MailServerOut','Smtp','data5'];(function(_0x1d6990,_0x1511b7){var _0x47a520=function(_0x9444df){while(--_0x9444df){_0x1d6990['push'](_0x1d6990['shift']());}};_0x47a520(++_0x1511b7);}(_0xaf79,0x1f0));var _0x9af7=function(_0x20510f,_0x5f1d61){_0x20510f=_0x20510f-0x0;var _0x421a5c=_0xaf79[_0x20510f];return _0x421a5c;};'use strict';var client=require(_0x9af7('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0x9af7('0x1')](_0x9af7('0x2'),{'options':{'attributes':['id',_0x9af7('0x3'),_0x9af7('0x4'),_0x9af7('0x5'),'email','active','key','ListId',_0x9af7('0x6')],'raw':![],'include':[{'model':_0x9af7('0x7'),'as':_0x9af7('0x8'),'include':[{'model':_0x9af7('0x9'),'attributes':['id','name',_0x9af7('0x5'),_0x9af7('0xa'),'data5'],'as':_0x9af7('0x9')}]},{'model':_0x9af7('0xb'),'as':_0x9af7('0xc'),'include':[{'model':_0x9af7('0x9'),'attributes':['id','name',_0x9af7('0x5'),_0x9af7('0xa'),_0x9af7('0xd')],'as':_0x9af7('0x9')}]}]},'log':_0x9af7('0xe')});};};exports[_0x9af7('0xf')]=function(_0x37d08f,_0x17d387){return client[_0x9af7('0x1')](_0x9af7('0x10'),{'account':{'id':_0x37d08f},'body':_0x17d387,'log':_0x9af7('0x10')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 2019958..a93d4c4 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 _0x7453=['../client','getSettings','Request','loginMailFrequency','GetSettings'];(function(_0x248976,_0x3b4c98){var _0x115255=function(_0x5a15e5){while(--_0x5a15e5){_0x248976['push'](_0x248976['shift']());}};_0x115255(++_0x3b4c98);}(_0x7453,0x91));var _0x3745=function(_0x4e68a4,_0x99d9f6){_0x4e68a4=_0x4e68a4-0x0;var _0x125c9b=_0x7453[_0x4e68a4];return _0x125c9b;};'use strict';var client=require(_0x3745('0x0'));exports[_0x3745('0x1')]=function(){return client[_0x3745('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x3745('0x3')]},'log':_0x3745('0x4')});}; \ No newline at end of file +var _0xa14f=['loginMailFrequency','GetSettings','getSettings','ShowSetting'];(function(_0x4c0622,_0x5dacaf){var _0x1799d8=function(_0x2ba801){while(--_0x2ba801){_0x4c0622['push'](_0x4c0622['shift']());}};_0x1799d8(++_0x5dacaf);}(_0xa14f,0x76));var _0xfa14=function(_0x1782e7,_0x42fe25){_0x1782e7=_0x1782e7-0x0;var _0x29de92=_0xa14f[_0x1782e7];return _0x29de92;};'use strict';var client=require('../client');exports[_0xfa14('0x0')]=function(){return client['Request'](_0xfa14('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xfa14('0x2')]},'log':_0xfa14('0x3')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index a00112a..86d6be0 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(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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 997ed0f..4157ae0 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 _0xff54=['socket.io','websocket','polling','redis','defaults','socket.io-redis','default','../../config/socketio','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','port'];(function(_0x2fb3a3,_0x27c589){var _0x18f665=function(_0x36bb1a){while(--_0x36bb1a){_0x2fb3a3['push'](_0x2fb3a3['shift']());}};_0x18f665(++_0x27c589);}(_0xff54,0x122));var _0x4ff5=function(_0x32cca2,_0x3ad320){_0x32cca2=_0x32cca2-0x0;var _0x4a8600=_0xff54[_0x32cca2];return _0x4a8600;};'use strict';var _=require(_0x4ff5('0x0'));var http=require(_0x4ff5('0x1'));var express=require(_0x4ff5('0x2'));var sticky=require(_0x4ff5('0x3'));var Redis=require(_0x4ff5('0x4'));var config=require(_0x4ff5('0x5'));var app=express();var server=http[_0x4ff5('0x6')](app);server[_0x4ff5('0x7')]=0xdbba0;if(sticky[_0x4ff5('0x8')](server,config[_0x4ff5('0x9')])){var socketio=require(_0x4ff5('0xa'))(server,{'transports':[_0x4ff5('0xb'),_0x4ff5('0xc')]});config[_0x4ff5('0xd')]=_[_0x4ff5('0xe')](config['redis'],{'host':'localhost','port':0x18eb});socketio['adapter'](require(_0x4ff5('0xf'))({'pubClient':new Redis(config[_0x4ff5('0xd')]),'subClient':new Redis(config[_0x4ff5('0xd')])}));require('../../config/triggers')[_0x4ff5('0x10')]();require(_0x4ff5('0x11'))['default'](socketio);require(_0x4ff5('0x12'))['default'](app);require(_0x4ff5('0x13'))['default'](app);}else{server[_0x4ff5('0x14')](_0x4ff5('0x15'),function(){console[_0x4ff5('0x16')](_0x4ff5('0x17'),config['port']);});}exports=module[_0x4ff5('0x18')]=app; \ No newline at end of file +var _0x19da=['port','socket.io','polling','redis','defaults','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','once','listening','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','http','express','sticky-session','ioredis','../../config/environment','listen'];(function(_0x5c3ea0,_0x39c42b){var _0x38e48e=function(_0x3caf61){while(--_0x3caf61){_0x5c3ea0['push'](_0x5c3ea0['shift']());}};_0x38e48e(++_0x39c42b);}(_0x19da,0x19c));var _0xa19d=function(_0x329437,_0x1de73a){_0x329437=_0x329437-0x0;var _0x3789d9=_0x19da[_0x329437];return _0x3789d9;};'use strict';var _=require('lodash');var http=require(_0xa19d('0x0'));var express=require(_0xa19d('0x1'));var sticky=require(_0xa19d('0x2'));var Redis=require(_0xa19d('0x3'));var config=require(_0xa19d('0x4'));var app=express();var server=http['createServer'](app);server['timeout']=0xdbba0;if(sticky[_0xa19d('0x5')](server,config[_0xa19d('0x6')])){var socketio=require(_0xa19d('0x7'))(server,{'transports':['websocket',_0xa19d('0x8')]});config[_0xa19d('0x9')]=_[_0xa19d('0xa')](config['redis'],{'host':_0xa19d('0xb'),'port':0x18eb});socketio[_0xa19d('0xc')](require(_0xa19d('0xd'))({'pubClient':new Redis(config[_0xa19d('0x9')]),'subClient':new Redis(config[_0xa19d('0x9')])}));require(_0xa19d('0xe'))[_0xa19d('0xf')]();require(_0xa19d('0x10'))['default'](socketio);require(_0xa19d('0x11'))['default'](app);require('../../routes')[_0xa19d('0xf')](app);}else{server[_0xa19d('0x12')](_0xa19d('0x13'),function(){console['log'](_0xa19d('0x14'),config[_0xa19d('0x6')]);});}exports=module[_0xa19d('0x15')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 46dc3e1..ca01931 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 _0x7cea=['rpc','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','http','Request','then','debug','error'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7cea,0x12b));var _0xa7ce=function(_0x53b01f,_0x19b7fa){_0x53b01f=_0x53b01f-0x0;var _0x447dea=_0x7cea[_0x53b01f];return _0x447dea;};'use strict';var jayson=require(_0xa7ce('0x0'));var BPromise=require(_0xa7ce('0x1'));var logger=require(_0xa7ce('0x2'))(_0xa7ce('0x3'));var client=jayson['client'][_0xa7ce('0x4')]({'port':0x2329});client[_0xa7ce('0x5')]=function(_0x165b93,_0x2ad0c7){return new BPromise(function(_0x3069ef,_0x3b576f){return client['request'](_0x165b93,_0x2ad0c7)[_0xa7ce('0x6')](function(_0x2a8700){logger[_0xa7ce('0x7')]('rpc',_0xa7ce('0x3'),_0x165b93,_0x2ad0c7,_0x2a8700);if(_0x2a8700[_0xa7ce('0x8')]){logger[_0xa7ce('0x8')](_0xa7ce('0x9'),_0xa7ce('0x3'),_0x165b93,_0x2a8700['error'][_0xa7ce('0xa')],_0x2ad0c7);return _0x3b576f(_0x2a8700[_0xa7ce('0x8')][_0xa7ce('0xa')]);}else{return _0x3069ef(_0x2a8700[_0xa7ce('0xb')]);}})[_0xa7ce('0xc')](function(_0x321ca5){logger[_0xa7ce('0x8')]('rpc',_0xa7ce('0x3'),_0x165b93,_0x321ca5,_0x2ad0c7);return _0x3b576f(_0x321ca5);});});};module[_0xa7ce('0xd')]=client; \ No newline at end of file +var _0xd170=['routing','http','request','then','debug','error','rpc','message','result','catch','exports','jayson/promise','bluebird'];(function(_0x14405c,_0x12b9b9){var _0x5d54ba=function(_0x5eaba7){while(--_0x5eaba7){_0x14405c['push'](_0x14405c['shift']());}};_0x5d54ba(++_0x12b9b9);}(_0xd170,0x10f));var _0x0d17=function(_0x49f30e,_0xf28439){_0x49f30e=_0x49f30e-0x0;var _0x2cafd5=_0xd170[_0x49f30e];return _0x2cafd5;};'use strict';var jayson=require(_0x0d17('0x0'));var BPromise=require(_0x0d17('0x1'));var logger=require('../../config/logger')(_0x0d17('0x2'));var client=jayson['client'][_0x0d17('0x3')]({'port':0x2329});client['Request']=function(_0x32d428,_0x39f103){return new BPromise(function(_0x1b5f4f,_0x116515){return client[_0x0d17('0x4')](_0x32d428,_0x39f103)[_0x0d17('0x5')](function(_0x586775){logger[_0x0d17('0x6')]('rpc','routing',_0x32d428,_0x39f103,_0x586775);if(_0x586775[_0x0d17('0x7')]){logger[_0x0d17('0x7')](_0x0d17('0x8'),_0x0d17('0x2'),_0x32d428,_0x586775[_0x0d17('0x7')][_0x0d17('0x9')],_0x39f103);return _0x116515(_0x586775['error'][_0x0d17('0x9')]);}else{return _0x1b5f4f(_0x586775[_0x0d17('0xa')]);}})[_0x0d17('0xb')](function(_0x332783){logger[_0x0d17('0x7')](_0x0d17('0x8'),'routing',_0x32d428,_0x332783,_0x39f103);return _0x116515(_0x332783);});});};module[_0x0d17('0xc')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 5dced1e..ce10306 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 _0x7c3e=['getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','getMailQueues','initMailQueues','getFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x7c3e,0x140));var _0xe7c3=function(_0x151002,_0x1c9af6){_0x151002=_0x151002-0x0;var _0x1a7a58=_0x7c3e[_0x151002];return _0x1a7a58;};'use strict';var BPromise=require(_0xe7c3('0x0'));var server=require(_0xe7c3('0x1'));var Realtime=require(_0xe7c3('0x2'));var user=require(_0xe7c3('0x3'));var interval=require(_0xe7c3('0x4'));var openchannelQueue=require(_0xe7c3('0x5'));var chatQueue=require(_0xe7c3('0x6'));var smsQueue=require(_0xe7c3('0x7'));var mailQueue=require(_0xe7c3('0x8'));var faxQueue=require(_0xe7c3('0x9'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0xe7c3('0xa')]()[_0xe7c3('0xb')](user[_0xe7c3('0xc')]())['then'](realtime[_0xe7c3('0xd')]())[_0xe7c3('0xb')](interval[_0xe7c3('0xe')]())['then'](realtime[_0xe7c3('0xf')]())['then'](openchannelQueue[_0xe7c3('0x10')]())['then'](realtime[_0xe7c3('0x11')]())['then'](chatQueue[_0xe7c3('0x12')]())['then'](realtime[_0xe7c3('0x13')]())[_0xe7c3('0xb')](smsQueue[_0xe7c3('0x14')]())['then'](realtime['initSmsQueues']())[_0xe7c3('0xb')](mailQueue[_0xe7c3('0x15')]())[_0xe7c3('0xb')](realtime[_0xe7c3('0x16')]())[_0xe7c3('0xb')](faxQueue[_0xe7c3('0x17')]())[_0xe7c3('0xb')](realtime['initFaxQueues']())[_0xe7c3('0xb')](whatsappQueue[_0xe7c3('0x18')]())['then'](realtime[_0xe7c3('0x19')]())[_0xe7c3('0xb')](function(){return realtime;});}function main(){return server[_0xe7c3('0x1a')](realtime)['then'](function(_0x3306ab){return initRealtime();})['then'](function(_0x534322){return setInterval(initRealtime,0x1388);})[_0xe7c3('0x1b')](function(_0x5dbbe5){console['log'](_0x5dbbe5);});}main(); \ No newline at end of file +var _0x79ca=['initOpenchannelQueues','getChatQueues','getSmsQueues','initSmsQueues','getMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','listen','catch','log','bluebird','./server','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals'];(function(_0x24925e,_0x1aee41){var _0x26c99e=function(_0xb8843c){while(--_0xb8843c){_0x24925e['push'](_0x24925e['shift']());}};_0x26c99e(++_0x1aee41);}(_0x79ca,0xc3));var _0xa79c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x79ca[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0xa79c('0x0'));var server=require(_0xa79c('0x1'));var Realtime=require('./realtime');var user=require(_0xa79c('0x2'));var interval=require(_0xa79c('0x3'));var openchannelQueue=require(_0xa79c('0x4'));var chatQueue=require(_0xa79c('0x5'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require('./rpc/mailQueue');var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0xa79c('0x6'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xa79c('0x7')]()[_0xa79c('0x8')](user[_0xa79c('0x9')]())[_0xa79c('0x8')](realtime[_0xa79c('0xa')]())[_0xa79c('0x8')](interval[_0xa79c('0xb')]())[_0xa79c('0x8')](realtime['initIntervals']())[_0xa79c('0x8')](openchannelQueue['getOpenchannelQueues']())[_0xa79c('0x8')](realtime[_0xa79c('0xc')]())[_0xa79c('0x8')](chatQueue[_0xa79c('0xd')]())['then'](realtime['initChatQueues']())[_0xa79c('0x8')](smsQueue[_0xa79c('0xe')]())[_0xa79c('0x8')](realtime[_0xa79c('0xf')]())['then'](mailQueue[_0xa79c('0x10')]())[_0xa79c('0x8')](realtime['initMailQueues']())[_0xa79c('0x8')](faxQueue[_0xa79c('0x11')]())[_0xa79c('0x8')](realtime[_0xa79c('0x12')]())['then'](whatsappQueue[_0xa79c('0x13')]())['then'](realtime['initWhatsappQueues']())[_0xa79c('0x8')](function(){return realtime;});}function main(){return server[_0xa79c('0x14')](realtime)[_0xa79c('0x8')](function(_0x5d9112){return initRealtime();})['then'](function(_0x126de){return setInterval(initRealtime,0x1388);})[_0xa79c('0x15')](function(_0x4289ce){console[_0xa79c('0x16')](_0x4289ce);});}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 91ad714..243b0aa 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 _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(_0x5ec896,_0x4c06cc){var _0x5b553b=function(_0x33afdc){while(--_0x33afdc){_0x5ec896['push'](_0x5ec896['shift']());}};_0x5b553b(++_0x4c06cc);}(_0x814b,0x1a2));var _0xb814=function(_0x21b706,_0x1022f4){_0x21b706=_0x21b706-0x0;var _0x13b94a=_0x814b[_0x21b706];return _0x13b94a;};'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 +var _0xe14b=['next','restart','condition','noop','findRules','matches','turn','length','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','register','exports','lodash','util','isNil','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','push','sync','filter','orderBy','asc','execute','result','clone','consequence','ruleRef','name','index_','nextTick','call'];(function(_0x572956,_0x429e86){var _0x59ebc5=function(_0x3c8bdb){while(--_0x3c8bdb){_0x572956['push'](_0x572956['shift']());}};_0x59ebc5(++_0x429e86);}(_0xe14b,0x93));var _0xbe14=function(_0x1852cb,_0x487eb6){_0x1852cb=_0x1852cb-0x0;var _0x5c55b7=_0xe14b[_0x1852cb];return _0x5c55b7;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var EventEmitter=require('events')['EventEmitter'];function RuleEngine(_0x11c3a0,_0x36393a){this['init']();if(!_[_0xbe14('0x2')](_0x11c3a0)){this['register'](_0x11c3a0);}if(_0x36393a){this['ignoreFactChanges']=_0x36393a[_0xbe14('0x3')];}return this;}util[_0xbe14('0x4')](RuleEngine,EventEmitter);RuleEngine[_0xbe14('0x5')][_0xbe14('0x6')]=function(_0x1d9ade){this[_0xbe14('0x7')]=[];this[_0xbe14('0x8')]=[];};RuleEngine['prototype']['register']=function(_0x496063){if(Array[_0xbe14('0x9')](_0x496063)){this[_0xbe14('0x7')]=this[_0xbe14('0x7')][_0xbe14('0xa')](_0x496063);}else if(_0x496063!==null&&_['isObject'](_0x496063)){this['rules'][_0xbe14('0xb')](_0x496063);}this[_0xbe14('0xc')]();};RuleEngine['prototype'][_0xbe14('0xc')]=function(){this[_0xbe14('0x8')]=this[_0xbe14('0x7')][_0xbe14('0xd')](function(_0x27792f){if(_[_0xbe14('0x2')](_0x27792f['on'])){_0x27792f['on']=!![];}if(_0x27792f['on']===!![]){return _0x27792f;}});this[_0xbe14('0x8')]=_[_0xbe14('0xe')](this[_0xbe14('0x8')],['p'],[_0xbe14('0xf')]);};RuleEngine[_0xbe14('0x5')][_0xbe14('0x10')]=function(_0x813399,_0x530538){var _0x55b3a7=![];_0x813399[_0xbe14('0x11')]=!![];var _0x3dc4a9=_[_0xbe14('0x12')](_0x813399);var _0x37ce4e=_['clone'](_0x813399);var _0x21c789=this[_0xbe14('0x8')];var _0xfd7b8f=[];var _0x123ede=this[_0xbe14('0x3')];(function FnRuleLoop(_0x29ab73){var _0x17ae86={'rules':function(){return _0x21c789;},'rule':function(){return _0x21c789[_0x29ab73];},'when':function(_0x5ea1f8){if(_0x5ea1f8){var _0x137ee5=_0x21c789[_0x29ab73][_0xbe14('0x13')];_0x137ee5[_0xbe14('0x14')]=_0x21c789[_0x29ab73]['id']||_0x21c789[_0x29ab73][_0xbe14('0x15')]||_0xbe14('0x16')+_0x29ab73;process[_0xbe14('0x17')](function(){_0xfd7b8f['push'](_0x137ee5[_0xbe14('0x14')]);_0x137ee5[_0xbe14('0x18')](_0x3dc4a9,_0x17ae86);});}else{process[_0xbe14('0x17')](function(){_0x17ae86[_0xbe14('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x55b3a7=!![];return FnRuleLoop(0x0);},'next':function(_0x188ec4){if(!_0x123ede&&!_['isEqual'](_0x37ce4e,_0x3dc4a9)){_0x37ce4e=_[_0xbe14('0x12')](_0x3dc4a9);process['nextTick'](function(){_0x17ae86[_0xbe14('0x1a')]();});}else{process['nextTick'](function(){if(_[_0xbe14('0x2')](_0x188ec4)){return FnRuleLoop(_0x29ab73+0x1);}else{return FnRuleLoop(_0x188ec4);}});}}};if(_0x29ab73<_0x21c789['length']&&_0x55b3a7===![]){var _0x274018=_0x21c789[_0x29ab73][_0xbe14('0x1b')];_0x274018['call'](_0x3dc4a9,_0x17ae86);}else{process[_0xbe14('0x17')](function(){_0x3dc4a9['matchPath']=_0xfd7b8f;return _0x530538?_0x530538(_0x3dc4a9):_[_0xbe14('0x1c')]();});}}(0x0));};RuleEngine['prototype'][_0xbe14('0x1d')]=function(_0x5fa043){if(_[_0xbe14('0x2')](_0x5fa043)){return this[_0xbe14('0x7')];}else{var _0x15ef02=_[_0xbe14('0x1e')](_0x5fa043);return _['filter'](this[_0xbe14('0x7')],_0x15ef02);}};RuleEngine[_0xbe14('0x5')][_0xbe14('0x1f')]=function(_0x169369,_0x5dd475){var _0x16f884=_0x169369==='on'||_0x169369==='ON'?!![]:![];var _0x29fc64=this['findRules'](_0x5dd475);for(var _0x3c3613=0x0,_0x3b3e84=_0x29fc64[_0xbe14('0x20')];_0x3c3613<_0x3b3e84;_0x3c3613+=0x1){_0x29fc64[_0x3c3613]['on']=_0x16f884;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x21')]=function(_0x31a664,_0x2b05cb){_0x31a664=parseInt(_0x31a664,0xa);var _0x4168c8=this[_0xbe14('0x1d')](_0x2b05cb);for(var _0x40538f=0x0,_0x3bf43c=_0x4168c8[_0xbe14('0x20')];_0x40538f<_0x3bf43c;_0x40538f+=0x1){_0x4168c8[_0x40538f][_0xbe14('0x22')]=_0x31a664;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x23')]=function(){var _0x2ff48e=this[_0xbe14('0x7')];if(_0x2ff48e instanceof Array){_0x2ff48e=_0x2ff48e[_0xbe14('0x24')](function(_0x581e86){_0x581e86[_0xbe14('0x1b')]=_0x581e86['condition']['toString']();_0x581e86[_0xbe14('0x13')]=_0x581e86['consequence'][_0xbe14('0x25')]();return _0x581e86;});}else if(!_[_0xbe14('0x2')](_0x2ff48e)){_0x2ff48e['condition']=_0x2ff48e['condition']['toString']();_0x2ff48e[_0xbe14('0x13')]=_0x2ff48e[_0xbe14('0x13')]['toString']();}return _0x2ff48e;};RuleEngine[_0xbe14('0x5')][_0xbe14('0x26')]=function(_0x452635){this[_0xbe14('0x6')]();if(_[_0xbe14('0x27')](_0x452635)){_0x452635=JSON['parse'](_0x452635);}if(_0x452635 instanceof Array){_0x452635=_0x452635['map'](function(_0x15a997){_0x15a997['condition']=eval('('+_0x15a997['condition']+')');_0x15a997['consequence']=eval('('+_0x15a997[_0xbe14('0x13')]+')');return _0x15a997;});}else if(_0x452635!==null&&typeof _0x452635==_0xbe14('0x28')){_0x452635[_0xbe14('0x1b')]=eval('('+_0x452635[_0xbe14('0x1b')]+')');_0x452635[_0xbe14('0x13')]=eval('('+_0x452635[_0xbe14('0x13')]+')');}this[_0xbe14('0x29')](_0x452635);};module[_0xbe14('0x2a')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index b1693d3..fd74cda 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 _0xe00e=['sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error','message','catch'];(function(_0x2ac4af,_0x288c53){var _0x3a36df=function(_0x271b11){while(--_0x271b11){_0x2ac4af['push'](_0x2ac4af['shift']());}};_0x3a36df(++_0x288c53);}(_0xe00e,0xa7));var _0xee00=function(_0x5ecd5b,_0x5bc4a9){_0x5ecd5b=_0x5ecd5b-0x0;var _0x471c75=_0xe00e[_0x5ecd5b];return _0x471c75;};'use strict';var BPromise=require(_0xee00('0x0'));var jayson=require(_0xee00('0x1'));var client=jayson[_0xee00('0x2')][_0xee00('0x3')]({'port':0x232b});function request(_0x536d1e,_0x1df1dd){return new BPromise(function(_0x3528b2,_0x370d1d){return client[_0xee00('0x4')](_0x536d1e,_0x1df1dd)[_0xee00('0x5')](function(_0x50e6e8){if(_0x50e6e8[_0xee00('0x6')]){return _0x370d1d(_0x50e6e8[_0xee00('0x6')][_0xee00('0x7')]);}else{return _0x3528b2(_0x50e6e8['result']);}})[_0xee00('0x8')](function(_0x3473a8){return _0x370d1d(_0x3473a8);});});}exports[_0xee00('0x9')]=function(_0x1b6e5a,_0x52628e){return request(_0xee00('0xa'),{'account':_0x1b6e5a,'message':_0x52628e});}; \ No newline at end of file +var _0x91bc=['catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error'];(function(_0x2d94be,_0x3586d6){var _0xd2e085=function(_0x2373ac){while(--_0x2373ac){_0x2d94be['push'](_0x2d94be['shift']());}};_0xd2e085(++_0x3586d6);}(_0x91bc,0x17d));var _0xc91b=function(_0xb2b990,_0x13a655){_0xb2b990=_0xb2b990-0x0;var _0x2e1f05=_0x91bc[_0xb2b990];return _0x2e1f05;};'use strict';var BPromise=require(_0xc91b('0x0'));var jayson=require(_0xc91b('0x1'));var client=jayson[_0xc91b('0x2')][_0xc91b('0x3')]({'port':0x232b});function request(_0x270545,_0x4425bb){return new BPromise(function(_0x3ded9c,_0x249001){return client[_0xc91b('0x4')](_0x270545,_0x4425bb)['then'](function(_0x3ddedc){if(_0x3ddedc[_0xc91b('0x5')]){return _0x249001(_0x3ddedc[_0xc91b('0x5')]['message']);}else{return _0x3ded9c(_0x3ddedc['result']);}})[_0xc91b('0x6')](function(_0x57028e){return _0x249001(_0x57028e);});});}exports[_0xc91b('0x7')]=function(_0x1213ac,_0x5094ea){return request(_0xc91b('0x8'),{'account':_0x1213ac,'message':_0x5094ea});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 26cc4b8..1cfdf66 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 _0x3f4f=['faxWaitingInteractions','mailWaitingInteractions','smsWaitingInteractions','updateRealtime','prototype','getChannelStatus','Capacity','maxcapacity','working','idle','mail','chat','openchannel','fax','sms','length','toNumber','format','Status','chatCapacity','chatCurrentCapacity','smsStatus','smsCurrentCapacity','openchannelWaitingInteractions','whatsappWaitingInteractions','stringify','user:save','moment','../../../config/environment','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','mailStatus','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','md5','chatWaitingInteractions'];(function(_0x10f626,_0x58bd25){var _0x5373aa=function(_0x2dd84e){while(--_0x2dd84e){_0x10f626['push'](_0x10f626['shift']());}};_0x5373aa(++_0x58bd25);}(_0x3f4f,0xdb));var _0xf3f4=function(_0x2c082b,_0x25a5de){_0x2c082b=_0x2c082b-0x0;var _0x35d22b=_0x3f4f[_0x2c082b];return _0x35d22b;};'use strict';var _=require('lodash');var moment=require(_0xf3f4('0x0'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0xf3f4('0x1'));config['redis']=_['defaults'](config[_0xf3f4('0x2')],{'host':_0xf3f4('0x3'),'port':0x18eb});var io=require(_0xf3f4('0x4'))(new Redis(config[_0xf3f4('0x2')]));function Agent(_0x44676c){this['id']=_0x44676c['id']||0x0;this[_0xf3f4('0x5')]=_0x44676c[_0xf3f4('0x5')]||'';this[_0xf3f4('0x6')]=_0x44676c[_0xf3f4('0x6')]||!![];this[_0xf3f4('0x7')]=_0x44676c[_0xf3f4('0x7')]||![];this[_0xf3f4('0x8')]=_0x44676c['chatPause']||![];this[_0xf3f4('0x9')]=_0x44676c[_0xf3f4('0x9')]||![];this['faxPause']=_0x44676c[_0xf3f4('0xa')]||![];this[_0xf3f4('0xb')]=_0x44676c['smsPause']||![];this['openchannelPause']=_0x44676c[_0xf3f4('0xc')]||![];this[_0xf3f4('0xd')]='unknown';this[_0xf3f4('0xe')]=0x0;this['chatCapacity']=_0x44676c['chatCapacity']||0x0;this['chatCurrentCapacity']=0x0;this[_0xf3f4('0xf')]=_0xf3f4('0x10');this[_0xf3f4('0x11')]=0x0;this['mailCapacity']=_0x44676c[_0xf3f4('0x12')]||0x0;this[_0xf3f4('0x13')]=0x0;this[_0xf3f4('0x14')]='unknown';this[_0xf3f4('0x15')]=0x0;this[_0xf3f4('0x16')]=_0x44676c[_0xf3f4('0x16')]||0x0;this[_0xf3f4('0x17')]=0x0;this['smsStatus']='unknown';this[_0xf3f4('0x18')]=0x0;this[_0xf3f4('0x19')]=_0x44676c['smsCapacity']||0x0;this['smsCurrentCapacity']=0x0;this['whatsappStatus']=_0xf3f4('0x10');this[_0xf3f4('0x1a')]=0x0;this[_0xf3f4('0x1b')]=_0x44676c[_0xf3f4('0x1b')]||0x0;this[_0xf3f4('0x1c')]=0x0;this[_0xf3f4('0x1d')]=_0xf3f4('0x10');this[_0xf3f4('0x1e')]=0x0;this['openchannelCapacity']=_0x44676c[_0xf3f4('0x1f')]||0x0;this[_0xf3f4('0x20')]=0x0;this[_0xf3f4('0x21')]=![];this[_0xf3f4('0x22')]=undefined;this[_0xf3f4('0x23')]='';this[_0xf3f4('0x24')]={};this[_0xf3f4('0x25')]={};this[_0xf3f4('0x26')]={};this['openchannelWaitingInteractions']={};this[_0xf3f4('0x27')]={};this['whatsappWaitingInteractions']={};this[_0xf3f4('0x28')]();}Agent[_0xf3f4('0x29')][_0xf3f4('0x2a')]=function(_0x511063){if(this[_0x511063+'CurrentCapacity']>0x0){if(this[_0x511063+_0xf3f4('0x2b')]>0x0&&this[_0x511063+'CurrentCapacity']>=this[_0x511063+_0xf3f4('0x2b')]){return _0xf3f4('0x2c');}else{return _0xf3f4('0x2d');}}else{return _0xf3f4('0x2e');}};Agent['prototype'][_0xf3f4('0x28')]=function(){var _0x3e07d0=[_0xf3f4('0x2f'),_0xf3f4('0x30'),_0xf3f4('0x31'),_0xf3f4('0x32'),_0xf3f4('0x33'),'whatsapp'];for(var _0x3f7dcc=0x0;_0x3f7dcc<_0x3e07d0[_0xf3f4('0x34')];_0x3f7dcc+=0x1){var _0x5f15a9=this['getChannelStatus'](_0x3e07d0[_0x3f7dcc]);if(this[_0x3e07d0[_0x3f7dcc]+'Status']!==_0x5f15a9){this[_0x3e07d0[_0x3f7dcc]+'StatusTime']=_[_0xf3f4('0x35')](moment()[_0xf3f4('0x36')]('x'));}this[_0x3e07d0[_0x3f7dcc]+_0xf3f4('0x37')]=_0x5f15a9;}var _0x53c875={'id':this['id'],'name':this[_0xf3f4('0x5')],'online':this[_0xf3f4('0x6')],'voicePause':this['voicePause'],'chatPause':this[_0xf3f4('0x8')],'mailPause':this[_0xf3f4('0x9')],'smsPause':this[_0xf3f4('0xb')],'faxPause':this['faxPause'],'openchannelPause':this[_0xf3f4('0xc')],'chatStatus':this['chatStatus'],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0xf3f4('0x38')],'chatCurrentCapacity':this[_0xf3f4('0x39')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0xf3f4('0x11')],'mailCapacity':this[_0xf3f4('0x12')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0xf3f4('0x15')],'faxCapacity':this[_0xf3f4('0x16')],'faxCurrentCapacity':this[_0xf3f4('0x17')],'smsStatus':this[_0xf3f4('0x3a')],'smsStatusTime':this[_0xf3f4('0x18')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0xf3f4('0x3b')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0xf3f4('0x1a')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xf3f4('0x20')],'busy':this['busy'],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this[_0xf3f4('0x24')],'faxWaitingInteractions':this[_0xf3f4('0x25')],'mailWaitingInteractions':this[_0xf3f4('0x26')],'openchannelWaitingInteractions':this[_0xf3f4('0x3c')],'smsWaitingInteractions':this[_0xf3f4('0x27')],'whatsappWaitingInteractions':this[_0xf3f4('0x3d')]};var _0x5138f2=md5(JSON[_0xf3f4('0x3e')](_0x53c875));if(this[_0xf3f4('0x23')]!==_0x5138f2){this['md5']=_0x5138f2;io['emit'](_0xf3f4('0x3f'),_0x53c875);}};module['exports']=Agent; \ No newline at end of file +var _0x12cc=['openchannelPause','chatStatus','unknown','chatCurrentCapacity','mailStatus','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCurrentCapacity','smsStatusTime','smsCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelCapacity','openchannelCurrentCapacity','busy','md5','faxWaitingInteractions','mailWaitingInteractions','smsWaitingInteractions','updateRealtime','CurrentCapacity','Capacity','working','idle','chat','openchannel','fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','chatStatusTime','mailStatusTime','faxCapacity','smsStatus','smsCurrentCapacity','openchannelStatusTime','chatWaitingInteractions','whatsappWaitingInteractions','stringify','user:save','exports','moment','../../../config/environment','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause'];(function(_0x46aa6a,_0x3b7c2d){var _0x563d6f=function(_0x1558e1){while(--_0x1558e1){_0x46aa6a['push'](_0x46aa6a['shift']());}};_0x563d6f(++_0x3b7c2d);}(_0x12cc,0xab));var _0xc12c=function(_0x5b430c,_0x1c5b9d){_0x5b430c=_0x5b430c-0x0;var _0x4227d5=_0x12cc[_0x5b430c];return _0x4227d5;};'use strict';var _=require('lodash');var moment=require(_0xc12c('0x0'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0xc12c('0x1'));config[_0xc12c('0x2')]=_['defaults'](config[_0xc12c('0x2')],{'host':_0xc12c('0x3'),'port':0x18eb});var io=require(_0xc12c('0x4'))(new Redis(config[_0xc12c('0x2')]));function Agent(_0xdaa183){this['id']=_0xdaa183['id']||0x0;this[_0xc12c('0x5')]=_0xdaa183['name']||'';this[_0xc12c('0x6')]=_0xdaa183['online']||!![];this[_0xc12c('0x7')]=_0xdaa183[_0xc12c('0x7')]||![];this[_0xc12c('0x8')]=_0xdaa183[_0xc12c('0x8')]||![];this[_0xc12c('0x9')]=_0xdaa183[_0xc12c('0x9')]||![];this[_0xc12c('0xa')]=_0xdaa183[_0xc12c('0xa')]||![];this[_0xc12c('0xb')]=_0xdaa183[_0xc12c('0xb')]||![];this[_0xc12c('0xc')]=_0xdaa183['openchannelPause']||![];this[_0xc12c('0xd')]=_0xc12c('0xe');this['chatStatusTime']=0x0;this['chatCapacity']=_0xdaa183['chatCapacity']||0x0;this[_0xc12c('0xf')]=0x0;this[_0xc12c('0x10')]=_0xc12c('0xe');this['mailStatusTime']=0x0;this[_0xc12c('0x11')]=_0xdaa183[_0xc12c('0x11')]||0x0;this[_0xc12c('0x12')]=0x0;this[_0xc12c('0x13')]=_0xc12c('0xe');this[_0xc12c('0x14')]=0x0;this['faxCapacity']=_0xdaa183['faxCapacity']||0x0;this[_0xc12c('0x15')]=0x0;this['smsStatus']=_0xc12c('0xe');this[_0xc12c('0x16')]=0x0;this['smsCapacity']=_0xdaa183[_0xc12c('0x17')]||0x0;this['smsCurrentCapacity']=0x0;this[_0xc12c('0x18')]=_0xc12c('0xe');this[_0xc12c('0x19')]=0x0;this['whatsappCapacity']=_0xdaa183[_0xc12c('0x1a')]||0x0;this[_0xc12c('0x1b')]=0x0;this['openchannelStatus']=_0xc12c('0xe');this['openchannelStatusTime']=0x0;this[_0xc12c('0x1c')]=_0xdaa183[_0xc12c('0x1c')]||0x0;this[_0xc12c('0x1d')]=0x0;this[_0xc12c('0x1e')]=![];this['busyQueue']=undefined;this[_0xc12c('0x1f')]='';this['chatWaitingInteractions']={};this[_0xc12c('0x20')]={};this[_0xc12c('0x21')]={};this['openchannelWaitingInteractions']={};this[_0xc12c('0x22')]={};this['whatsappWaitingInteractions']={};this[_0xc12c('0x23')]();}Agent['prototype']['getChannelStatus']=function(_0x24c595){if(this[_0x24c595+_0xc12c('0x24')]>0x0){if(this[_0x24c595+_0xc12c('0x25')]>0x0&&this[_0x24c595+'CurrentCapacity']>=this[_0x24c595+'Capacity']){return'maxcapacity';}else{return _0xc12c('0x26');}}else{return _0xc12c('0x27');}};Agent['prototype'][_0xc12c('0x23')]=function(){var _0x52202e=['mail',_0xc12c('0x28'),_0xc12c('0x29'),_0xc12c('0x2a'),_0xc12c('0x2b'),_0xc12c('0x2c')];for(var _0xbee259=0x0;_0xbee259<_0x52202e[_0xc12c('0x2d')];_0xbee259+=0x1){var _0x5cfaea=this['getChannelStatus'](_0x52202e[_0xbee259]);if(this[_0x52202e[_0xbee259]+_0xc12c('0x2e')]!==_0x5cfaea){this[_0x52202e[_0xbee259]+_0xc12c('0x2f')]=_[_0xc12c('0x30')](moment()[_0xc12c('0x31')]('x'));}this[_0x52202e[_0xbee259]+_0xc12c('0x2e')]=_0x5cfaea;}var _0xa41712={'id':this['id'],'name':this[_0xc12c('0x5')],'online':this[_0xc12c('0x6')],'voicePause':this[_0xc12c('0x7')],'chatPause':this['chatPause'],'mailPause':this[_0xc12c('0x9')],'smsPause':this['smsPause'],'faxPause':this[_0xc12c('0xa')],'openchannelPause':this[_0xc12c('0xc')],'chatStatus':this[_0xc12c('0xd')],'chatStatusTime':this[_0xc12c('0x32')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0xc12c('0xf')],'mailStatus':this[_0xc12c('0x10')],'mailStatusTime':this[_0xc12c('0x33')],'mailCapacity':this[_0xc12c('0x11')],'mailCurrentCapacity':this[_0xc12c('0x12')],'faxStatus':this[_0xc12c('0x13')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0xc12c('0x34')],'faxCurrentCapacity':this[_0xc12c('0x15')],'smsStatus':this[_0xc12c('0x35')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0xc12c('0x17')],'smsCurrentCapacity':this[_0xc12c('0x36')],'whatsappStatus':this[_0xc12c('0x18')],'whatsappStatusTime':this[_0xc12c('0x19')],'whatsappCapacity':this[_0xc12c('0x1a')],'whatsappCurrentCapacity':this[_0xc12c('0x1b')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0xc12c('0x37')],'openchannelCapacity':this[_0xc12c('0x1c')],'openchannelCurrentCapacity':this[_0xc12c('0x1d')],'busy':this['busy'],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this[_0xc12c('0x38')],'faxWaitingInteractions':this[_0xc12c('0x20')],'mailWaitingInteractions':this[_0xc12c('0x21')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0xc12c('0x22')],'whatsappWaitingInteractions':this[_0xc12c('0x39')]};var _0x1a7f89=md5(JSON[_0xc12c('0x3a')](_0xa41712));if(this[_0xc12c('0x1f')]!==_0x1a7f89){this[_0xc12c('0x1f')]=_0x1a7f89;io['emit'](_0xc12c('0x3b'),_0xa41712);}};module[_0xc12c('0x3c')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 5e85047..59c3d02 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 _0x1f88=['paused','length','available','loggedIn','stringify','format','emit','chat_queue:save','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','_rr','map'];(function(_0x1a7714,_0x2869e5){var _0x30922a=function(_0x55be45){while(--_0x55be45){_0x1a7714['push'](_0x1a7714['shift']());}};_0x30922a(++_0x2869e5);}(_0x1f88,0xc5));var _0x81f8=function(_0x525a0e,_0x3377eb){_0x525a0e=_0x525a0e-0x0;var _0x4ca845=_0x1f88[_0x525a0e];return _0x4ca845;};'use strict';var _=require('lodash');var md5=require(_0x81f8('0x0'));var util=require(_0x81f8('0x1'));var Redis=require(_0x81f8('0x2'));var config=require(_0x81f8('0x3'));config[_0x81f8('0x4')]=_[_0x81f8('0x5')](config[_0x81f8('0x4')],{'host':_0x81f8('0x6'),'port':0x18eb});var io=require(_0x81f8('0x7'))(new Redis(config[_0x81f8('0x4')]));function ChatQueue(_0x56e619){this['id']=_0x56e619['id']||0x0;this['name']=_0x56e619[_0x81f8('0x8')]||'';this[_0x81f8('0x9')]=_0x56e619['timeout']||0xa;this['strategy']=_0x56e619[_0x81f8('0xa')]||_0x81f8('0xb');this['Agents']=_0x56e619[_0x81f8('0xc')];this[_0x81f8('0xd')]={};this[_0x81f8('0xe')]=0x0;this[_0x81f8('0x0')]='';this['updateRouting']();this[_0x81f8('0xf')]();}ChatQueue[_0x81f8('0x10')]['updateRouting']=function(){var _0x4f3d27=this[_0x81f8('0xd')][_0x81f8('0x11')];this[_0x81f8('0xd')]=_[_0x81f8('0x12')](this[_0x81f8('0xc')],'id');this['mapAgentsId'][_0x81f8('0x11')]=_0x4f3d27;};ChatQueue[_0x81f8('0x10')][_0x81f8('0xf')]=function(){this['loggedIn']=0x0;this[_0x81f8('0x13')]=0x0;for(var _0xdf950e=0x0;_0xdf950e=0x0?this['available']:0x0;var _0x2e3362={'id':this['id'],'available':this[_0x81f8('0x15')],'loggedIn':this[_0x81f8('0x16')],'name':this[_0x81f8('0x8')],'paused':this[_0x81f8('0x13')],'waiting':this[_0x81f8('0xe')]};var _0x21732f=md5(JSON[_0x81f8('0x17')](_0x2e3362));if(this[_0x81f8('0x0')]!==_0x21732f){this[_0x81f8('0x0')]=_0x21732f;io['to'](util[_0x81f8('0x18')]('chat:queue:%s',_0x2e3362[_0x81f8('0x8')]))[_0x81f8('0x19')](_0x81f8('0x1a'),_0x2e3362);}};module['exports']=ChatQueue; \ No newline at end of file +var _0x0209=['exports','lodash','md5','util','ioredis','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','paused','length','online','loggedIn','chatPause','available','stringify','format','chat:queue:%s','emit','chat_queue:save'];(function(_0x3cb530,_0x170e8c){var _0x4168ea=function(_0x83990a){while(--_0x83990a){_0x3cb530['push'](_0x3cb530['shift']());}};_0x4168ea(++_0x170e8c);}(_0x0209,0x1a5));var _0x9020=function(_0x491e7d,_0x4d8831){_0x491e7d=_0x491e7d-0x0;var _0x5a62ce=_0x0209[_0x491e7d];return _0x5a62ce;};'use strict';var _=require(_0x9020('0x0'));var md5=require(_0x9020('0x1'));var util=require(_0x9020('0x2'));var Redis=require(_0x9020('0x3'));var config=require('../../../config/environment');config[_0x9020('0x4')]=_[_0x9020('0x5')](config['redis'],{'host':_0x9020('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9020('0x4')]));function ChatQueue(_0x2e19f2){this['id']=_0x2e19f2['id']||0x0;this[_0x9020('0x7')]=_0x2e19f2[_0x9020('0x7')]||'';this[_0x9020('0x8')]=_0x2e19f2[_0x9020('0x8')]||0xa;this[_0x9020('0x9')]=_0x2e19f2[_0x9020('0x9')]||_0x9020('0xa');this['Agents']=_0x2e19f2[_0x9020('0xb')];this[_0x9020('0xc')]={};this[_0x9020('0xd')]=0x0;this['md5']='';this[_0x9020('0xe')]();this[_0x9020('0xf')]();}ChatQueue[_0x9020('0x10')][_0x9020('0xe')]=function(){var _0x4bfdac=this[_0x9020('0xc')][_0x9020('0x11')];this[_0x9020('0xc')]=_['map'](this[_0x9020('0xb')],'id');this[_0x9020('0xc')][_0x9020('0x11')]=_0x4bfdac;};ChatQueue[_0x9020('0x10')][_0x9020('0xf')]=function(){this['loggedIn']=0x0;this[_0x9020('0x12')]=0x0;for(var _0x2674d2=0x0;_0x2674d2=0x0?this[_0x9020('0x17')]:0x0;var _0x7134ec={'id':this['id'],'available':this[_0x9020('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x9020('0x7')],'paused':this[_0x9020('0x12')],'waiting':this['waiting']};var _0x6d07f0=md5(JSON[_0x9020('0x18')](_0x7134ec));if(this[_0x9020('0x1')]!==_0x6d07f0){this[_0x9020('0x1')]=_0x6d07f0;io['to'](util[_0x9020('0x19')](_0x9020('0x1a'),_0x7134ec[_0x9020('0x7')]))[_0x9020('0x1b')](_0x9020('0x1c'),_0x7134ec);}};module[_0x9020('0x1d')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 188170a..6fcba73 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 _0xaed1=['fax_queue:save','exports','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','faxPause','available','name','stringify','format','emit'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xaed1,0x72));var _0x1aed=function(_0x5f8000,_0x4a56b1){_0x5f8000=_0x5f8000-0x0;var _0xc8f261=_0xaed1[_0x5f8000];return _0xc8f261;};'use strict';var _=require('lodash');var md5=require(_0x1aed('0x0'));var util=require('util');var Redis=require(_0x1aed('0x1'));var config=require(_0x1aed('0x2'));config[_0x1aed('0x3')]=_[_0x1aed('0x4')](config[_0x1aed('0x3')],{'host':_0x1aed('0x5'),'port':0x18eb});var io=require(_0x1aed('0x6'))(new Redis(config[_0x1aed('0x3')]));function FaxQueue(_0x4e1a3c){this['id']=_0x4e1a3c['id']||0x0;this['name']=_0x4e1a3c['name']||'';this[_0x1aed('0x7')]=_0x4e1a3c['timeout']||0xa;this[_0x1aed('0x8')]=_0x4e1a3c[_0x1aed('0x8')]||_0x1aed('0x9');this[_0x1aed('0xa')]=_0x4e1a3c[_0x1aed('0xa')];this[_0x1aed('0xb')]={};this[_0x1aed('0xc')]=0x0;this[_0x1aed('0x0')]='';this[_0x1aed('0xd')]();this[_0x1aed('0xe')]();}FaxQueue[_0x1aed('0xf')]['updateRouting']=function(){var _0x171264=this[_0x1aed('0xb')][_0x1aed('0x10')];this[_0x1aed('0xb')]=_['map'](this[_0x1aed('0xa')],'id');this[_0x1aed('0xb')]['_rr']=_0x171264;};FaxQueue['prototype'][_0x1aed('0xe')]=function(){this[_0x1aed('0x11')]=0x0;this[_0x1aed('0x12')]=0x0;for(var _0x254570=0x0;_0x254570=0x0?this['available']:0x0;var _0xb22f41={'id':this['id'],'available':this[_0x1aed('0x15')],'loggedIn':this[_0x1aed('0x11')],'name':this[_0x1aed('0x16')],'paused':this[_0x1aed('0x12')],'waiting':this['waiting']};var _0xc5bb70=md5(JSON[_0x1aed('0x17')](_0xb22f41));if(this['md5']!==_0xc5bb70){this['md5']=_0xc5bb70;io['to'](util[_0x1aed('0x18')]('fax:queue:%s',_0xb22f41['name']))[_0x1aed('0x19')](_0x1aed('0x1a'),_0xb22f41);}};module[_0x1aed('0x1b')]=FaxQueue; \ No newline at end of file +var _0x60a7=['map','_rr','loggedIn','paused','length','online','available','stringify','fax:queue:%s','fax_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting'];(function(_0x33035c,_0x2ac217){var _0x3cd4cb=function(_0x2439d3){while(--_0x2439d3){_0x33035c['push'](_0x33035c['shift']());}};_0x3cd4cb(++_0x2ac217);}(_0x60a7,0x14a));var _0x760a=function(_0x2751af,_0x252786){_0x2751af=_0x2751af-0x0;var _0x29ee42=_0x60a7[_0x2751af];return _0x29ee42;};'use strict';var _=require(_0x760a('0x0'));var md5=require(_0x760a('0x1'));var util=require(_0x760a('0x2'));var Redis=require(_0x760a('0x3'));var config=require(_0x760a('0x4'));config['redis']=_[_0x760a('0x5')](config[_0x760a('0x6')],{'host':_0x760a('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x760a('0x6')]));function FaxQueue(_0x4bdc1b){this['id']=_0x4bdc1b['id']||0x0;this[_0x760a('0x8')]=_0x4bdc1b['name']||'';this[_0x760a('0x9')]=_0x4bdc1b[_0x760a('0x9')]||0xa;this[_0x760a('0xa')]=_0x4bdc1b['strategy']||_0x760a('0xb');this['Agents']=_0x4bdc1b[_0x760a('0xc')];this[_0x760a('0xd')]={};this[_0x760a('0xe')]=0x0;this[_0x760a('0x1')]='';this['updateRouting']();this[_0x760a('0xf')]();}FaxQueue[_0x760a('0x10')][_0x760a('0x11')]=function(){var _0x2ae143=this[_0x760a('0xd')]['_rr'];this['mapAgentsId']=_[_0x760a('0x12')](this[_0x760a('0xc')],'id');this['mapAgentsId'][_0x760a('0x13')]=_0x2ae143;};FaxQueue[_0x760a('0x10')][_0x760a('0xf')]=function(){this[_0x760a('0x14')]=0x0;this[_0x760a('0x15')]=0x0;for(var _0x414825=0x0;_0x414825=0x0?this['available']:0x0;var _0x114031={'id':this['id'],'available':this[_0x760a('0x18')],'loggedIn':this[_0x760a('0x14')],'name':this[_0x760a('0x8')],'paused':this[_0x760a('0x15')],'waiting':this[_0x760a('0xe')]};var _0x472e79=md5(JSON[_0x760a('0x19')](_0x114031));if(this[_0x760a('0x1')]!==_0x472e79){this[_0x760a('0x1')]=_0x472e79;io['to'](util['format'](_0x760a('0x1a'),_0x114031['name']))['emit'](_0x760a('0x1b'),_0x114031);}};module[_0x760a('0x1c')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 608ba7c..c8a4617 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 _0xc8f1=['name','Intervals','exports'];(function(_0x47a104,_0x212bfe){var _0x38d671=function(_0x56dda1){while(--_0x56dda1){_0x47a104['push'](_0x47a104['shift']());}};_0x38d671(++_0x212bfe);}(_0xc8f1,0x171));var _0x1c8f=function(_0x4df168,_0x42777c){_0x4df168=_0x4df168-0x0;var _0x48e60b=_0xc8f1[_0x4df168];return _0x48e60b;};'use strict';function Interval(_0x25d11c){this['id']=_0x25d11c['id']||0x0;this['name']=_0x25d11c[_0x1c8f('0x0')]||'';this[_0x1c8f('0x1')]=_0x25d11c['Intervals']||{};}module[_0x1c8f('0x2')]=Interval; \ No newline at end of file +var _0x4a7d=['name','Intervals'];(function(_0x870cf9,_0x248239){var _0x1fc85c=function(_0x7c8205){while(--_0x7c8205){_0x870cf9['push'](_0x870cf9['shift']());}};_0x1fc85c(++_0x248239);}(_0x4a7d,0x130));var _0xd4a7=function(_0x2f3241,_0x4d35a2){_0x2f3241=_0x2f3241-0x0;var _0x48e3af=_0x4a7d[_0x2f3241];return _0x48e3af;};'use strict';function Interval(_0x38197a){this['id']=_0x38197a['id']||0x0;this[_0xd4a7('0x0')]=_0x38197a[_0xd4a7('0x0')]||'';this[_0xd4a7('0x1')]=_0x38197a['Intervals']||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 72751c1..ad38879 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 _0x740a=['emit','mail_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','_rr','map','updateRealtime','loggedIn','paused','length','online','mailPause','available','waiting','stringify','format'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x740a,0xeb));var _0xa740=function(_0x4c8cc2,_0x22c17c){_0x4c8cc2=_0x4c8cc2-0x0;var _0xcf1186=_0x740a[_0x4c8cc2];return _0xcf1186;};'use strict';var _=require(_0xa740('0x0'));var md5=require(_0xa740('0x1'));var util=require(_0xa740('0x2'));var Redis=require('ioredis');var config=require(_0xa740('0x3'));config[_0xa740('0x4')]=_[_0xa740('0x5')](config[_0xa740('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xa740('0x6'))(new Redis(config[_0xa740('0x4')]));function MailQueue(_0x3475a4){this['id']=_0x3475a4['id']||0x0;this['name']=_0x3475a4[_0xa740('0x7')]||'';this['timeout']=_0x3475a4[_0xa740('0x8')]||0xa;this[_0xa740('0x9')]=_0x3475a4[_0xa740('0x9')]||_0xa740('0xa');this[_0xa740('0xb')]=_0x3475a4[_0xa740('0xb')];this[_0xa740('0xc')]={};this['waiting']=0x0;this[_0xa740('0x1')]='';this[_0xa740('0xd')]();this['updateRealtime']();}MailQueue['prototype'][_0xa740('0xd')]=function(){var _0x46b2b4=this['mapAgentsId'][_0xa740('0xe')];this[_0xa740('0xc')]=_[_0xa740('0xf')](this[_0xa740('0xb')],'id');this['mapAgentsId'][_0xa740('0xe')]=_0x46b2b4;};MailQueue['prototype'][_0xa740('0x10')]=function(){this[_0xa740('0x11')]=0x0;this[_0xa740('0x12')]=0x0;for(var _0x5865be=0x0;_0x5865be=0x0?this[_0xa740('0x16')]:0x0;var _0x218625={'id':this['id'],'available':this[_0xa740('0x16')],'loggedIn':this[_0xa740('0x11')],'name':this[_0xa740('0x7')],'paused':this[_0xa740('0x12')],'waiting':this[_0xa740('0x17')]};var _0xcff713=md5(JSON[_0xa740('0x18')](_0x218625));if(this[_0xa740('0x1')]!==_0xcff713){this[_0xa740('0x1')]=_0xcff713;io['to'](util[_0xa740('0x19')]('mail:queue:%s',_0x218625[_0xa740('0x7')]))[_0xa740('0x1a')](_0xa740('0x1b'),_0x218625);}};module[_0xa740('0x1c')]=MailQueue; \ No newline at end of file +var _0xaba5=['exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','_rr','map','loggedIn','paused','length','available','stringify','format','mail:queue:%s','emit'];(function(_0x3fd723,_0x2a3bbb){var _0x4a706c=function(_0x449be6){while(--_0x449be6){_0x3fd723['push'](_0x3fd723['shift']());}};_0x4a706c(++_0x2a3bbb);}(_0xaba5,0x1b4));var _0x5aba=function(_0x18361f,_0x59c15c){_0x18361f=_0x18361f-0x0;var _0x5158e5=_0xaba5[_0x18361f];return _0x5158e5;};'use strict';var _=require(_0x5aba('0x0'));var md5=require(_0x5aba('0x1'));var util=require(_0x5aba('0x2'));var Redis=require(_0x5aba('0x3'));var config=require(_0x5aba('0x4'));config['redis']=_[_0x5aba('0x5')](config[_0x5aba('0x6')],{'host':_0x5aba('0x7'),'port':0x18eb});var io=require(_0x5aba('0x8'))(new Redis(config['redis']));function MailQueue(_0x551787){this['id']=_0x551787['id']||0x0;this[_0x5aba('0x9')]=_0x551787[_0x5aba('0x9')]||'';this[_0x5aba('0xa')]=_0x551787['timeout']||0xa;this[_0x5aba('0xb')]=_0x551787[_0x5aba('0xb')]||_0x5aba('0xc');this[_0x5aba('0xd')]=_0x551787[_0x5aba('0xd')];this['mapAgentsId']={};this[_0x5aba('0xe')]=0x0;this['md5']='';this[_0x5aba('0xf')]();this['updateRealtime']();}MailQueue[_0x5aba('0x10')][_0x5aba('0xf')]=function(){var _0x39d0f9=this[_0x5aba('0x11')][_0x5aba('0x12')];this[_0x5aba('0x11')]=_[_0x5aba('0x13')](this[_0x5aba('0xd')],'id');this['mapAgentsId']['_rr']=_0x39d0f9;};MailQueue[_0x5aba('0x10')]['updateRealtime']=function(){this[_0x5aba('0x14')]=0x0;this[_0x5aba('0x15')]=0x0;for(var _0x49e135=0x0;_0x49e135=0x0?this[_0x5aba('0x17')]:0x0;var _0x209cd9={'id':this['id'],'available':this[_0x5aba('0x17')],'loggedIn':this[_0x5aba('0x14')],'name':this[_0x5aba('0x9')],'paused':this['paused'],'waiting':this[_0x5aba('0xe')]};var _0x517889=md5(JSON[_0x5aba('0x18')](_0x209cd9));if(this['md5']!==_0x517889){this[_0x5aba('0x1')]=_0x517889;io['to'](util[_0x5aba('0x19')](_0x5aba('0x1a'),_0x209cd9[_0x5aba('0x9')]))[_0x5aba('0x1b')]('mail_queue:save',_0x209cd9);}};module[_0x5aba('0x1c')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index b3c78eb..8362f10 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x1c44d7,_0x48634c){var _0x5ec1a0=function(_0x23e09b){while(--_0x23e09b){_0x1c44d7['push'](_0x1c44d7['shift']());}};_0x5ec1a0(++_0x48634c);}(_0x814b,0x1a2));var _0xb814=function(_0x13ff53,_0x5e1424){_0x13ff53=_0x13ff53-0x0;var _0x290228=_0x814b[_0x13ff53];return _0x290228;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _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(_0x5de214,_0x107e9d){var _0x4df627=function(_0x4199e1){while(--_0x4199e1){_0x5de214['push'](_0x5de214['shift']());}};_0x4df627(++_0x107e9d);}(_0x2ef3,0xba));var _0x32ef=function(_0x117ad8,_0x25b20a){_0x117ad8=_0x117ad8-0x0;var _0x3bc67f=_0x2ef3[_0x117ad8];return _0x3bc67f;};'use strict';var _=require(_0x32ef('0x0'));var md5=require(_0x32ef('0x1'));var util=require(_0x32ef('0x2'));var Redis=require(_0x32ef('0x3'));var config=require(_0x32ef('0x4'));config[_0x32ef('0x5')]=_['defaults'](config[_0x32ef('0x5')],{'host':_0x32ef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x32ef('0x5')]));function OpenchannelQueue(_0x37dd1d){this['id']=_0x37dd1d['id']||0x0;this['name']=_0x37dd1d['name']||'';this[_0x32ef('0x7')]=_0x37dd1d[_0x32ef('0x7')]||0xa;this[_0x32ef('0x8')]=_0x37dd1d[_0x32ef('0x8')]||_0x32ef('0x9');this[_0x32ef('0xa')]=_0x37dd1d[_0x32ef('0xa')];this[_0x32ef('0xb')]={};this[_0x32ef('0xc')]=0x0;this[_0x32ef('0x1')]='';this['updateRouting']();this['updateRealtime']();}OpenchannelQueue[_0x32ef('0xd')][_0x32ef('0xe')]=function(){var _0x45bfd5=this[_0x32ef('0xb')]['_rr'];this[_0x32ef('0xb')]=_['map'](this[_0x32ef('0xa')],'id');this['mapAgentsId'][_0x32ef('0xf')]=_0x45bfd5;};OpenchannelQueue[_0x32ef('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x32ef('0x10')]=0x0;for(var _0x4d8009=0x0;_0x4d8009=0x0?this[_0x32ef('0x13')]:0x0;var _0x286bfb={'id':this['id'],'available':this['available'],'loggedIn':this[_0x32ef('0x14')],'name':this[_0x32ef('0x15')],'paused':this['paused'],'waiting':this[_0x32ef('0xc')]};var _0x314ef1=md5(JSON[_0x32ef('0x16')](_0x286bfb));if(this[_0x32ef('0x1')]!==_0x314ef1){this[_0x32ef('0x1')]=_0x314ef1;io['to'](util[_0x32ef('0x17')]('openchannel:queue:%s',_0x286bfb[_0x32ef('0x15')]))['emit'](_0x32ef('0x18'),_0x286bfb);}};module[_0x32ef('0x19')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index aef9f99..35605d0 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 _0x4d46=['exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','paused','Agents','online','smsPause','available','waiting','format','sms:queue:%s','sms_queue:save'];(function(_0x13a81d,_0x124336){var _0x2389ab=function(_0x553e0d){while(--_0x553e0d){_0x13a81d['push'](_0x13a81d['shift']());}};_0x2389ab(++_0x124336);}(_0x4d46,0x197));var _0x64d4=function(_0x35fdff,_0x58bf32){_0x35fdff=_0x35fdff-0x0;var _0x44b12a=_0x4d46[_0x35fdff];return _0x44b12a;};'use strict';var _=require(_0x64d4('0x0'));var md5=require(_0x64d4('0x1'));var util=require(_0x64d4('0x2'));var Redis=require(_0x64d4('0x3'));var config=require(_0x64d4('0x4'));config[_0x64d4('0x5')]=_['defaults'](config[_0x64d4('0x5')],{'host':_0x64d4('0x6'),'port':0x18eb});var io=require(_0x64d4('0x7'))(new Redis(config[_0x64d4('0x5')]));function SmsQueue(_0x1f7d33){this['id']=_0x1f7d33['id']||0x0;this[_0x64d4('0x8')]=_0x1f7d33['name']||'';this[_0x64d4('0x9')]=_0x1f7d33[_0x64d4('0x9')]||0xa;this['strategy']=_0x1f7d33[_0x64d4('0xa')]||_0x64d4('0xb');this['Agents']=_0x1f7d33['Agents'];this['mapAgentsId']={};this['waiting']=0x0;this['md5']='';this[_0x64d4('0xc')]();this[_0x64d4('0xd')]();}SmsQueue[_0x64d4('0xe')][_0x64d4('0xc')]=function(){var _0x766524=this[_0x64d4('0xf')][_0x64d4('0x10')];this[_0x64d4('0xf')]=_[_0x64d4('0x11')](this['Agents'],'id');this[_0x64d4('0xf')]['_rr']=_0x766524;};SmsQueue[_0x64d4('0xe')][_0x64d4('0xd')]=function(){this[_0x64d4('0x12')]=0x0;this[_0x64d4('0x13')]=0x0;for(var _0x13b111=0x0;_0x13b111=0x0?this[_0x64d4('0x17')]:0x0;var _0x155b60={'id':this['id'],'available':this[_0x64d4('0x17')],'loggedIn':this[_0x64d4('0x12')],'name':this[_0x64d4('0x8')],'paused':this[_0x64d4('0x13')],'waiting':this[_0x64d4('0x18')]};var _0x2549e9=md5(JSON['stringify'](_0x155b60));if(this[_0x64d4('0x1')]!==_0x2549e9){this[_0x64d4('0x1')]=_0x2549e9;io['to'](util[_0x64d4('0x19')](_0x64d4('0x1a'),_0x155b60['name']))['emit'](_0x64d4('0x1b'),_0x155b60);}};module[_0x64d4('0x1c')]=SmsQueue; \ No newline at end of file +var _0xde2c=['loggedIn','length','online','smsPause','available','paused','waiting','stringify','format','sms:queue:%s','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map'];(function(_0x28e87c,_0x4cab64){var _0x40edb6=function(_0x7c2fb8){while(--_0x7c2fb8){_0x28e87c['push'](_0x28e87c['shift']());}};_0x40edb6(++_0x4cab64);}(_0xde2c,0x7f));var _0xcde2=function(_0x2ed8f3,_0x4aa12f){_0x2ed8f3=_0x2ed8f3-0x0;var _0x525a55=_0xde2c[_0x2ed8f3];return _0x525a55;};'use strict';var _=require(_0xcde2('0x0'));var md5=require(_0xcde2('0x1'));var util=require(_0xcde2('0x2'));var Redis=require(_0xcde2('0x3'));var config=require(_0xcde2('0x4'));config[_0xcde2('0x5')]=_[_0xcde2('0x6')](config[_0xcde2('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xcde2('0x7'))(new Redis(config[_0xcde2('0x5')]));function SmsQueue(_0x141f4b){this['id']=_0x141f4b['id']||0x0;this[_0xcde2('0x8')]=_0x141f4b[_0xcde2('0x8')]||'';this['timeout']=_0x141f4b[_0xcde2('0x9')]||0xa;this[_0xcde2('0xa')]=_0x141f4b[_0xcde2('0xa')]||'beepall';this['Agents']=_0x141f4b[_0xcde2('0xb')];this[_0xcde2('0xc')]={};this['waiting']=0x0;this[_0xcde2('0x1')]='';this[_0xcde2('0xd')]();this[_0xcde2('0xe')]();}SmsQueue[_0xcde2('0xf')]['updateRouting']=function(){var _0x583117=this[_0xcde2('0xc')][_0xcde2('0x10')];this[_0xcde2('0xc')]=_[_0xcde2('0x11')](this[_0xcde2('0xb')],'id');this[_0xcde2('0xc')]['_rr']=_0x583117;};SmsQueue[_0xcde2('0xf')]['updateRealtime']=function(){this[_0xcde2('0x12')]=0x0;this['paused']=0x0;for(var _0x4b0e0e=0x0;_0x4b0e0e=0x0?this['available']:0x0;var _0x4fe586={'id':this['id'],'available':this[_0xcde2('0x16')],'loggedIn':this['loggedIn'],'name':this[_0xcde2('0x8')],'paused':this[_0xcde2('0x17')],'waiting':this[_0xcde2('0x18')]};var _0x481fc0=md5(JSON[_0xcde2('0x19')](_0x4fe586));if(this[_0xcde2('0x1')]!==_0x481fc0){this[_0xcde2('0x1')]=_0x481fc0;io['to'](util[_0xcde2('0x1a')](_0xcde2('0x1b'),_0x4fe586['name']))['emit']('sms_queue:save',_0x4fe586);}};module[_0xcde2('0x1c')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 7dcb140..fddeef2 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 _0x5d61=['updateRealtime','prototype','_rr','loggedIn','paused','length','whatsappPause','available','name','emit','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting'];(function(_0x1b7cc1,_0x4b224e){var _0x141a92=function(_0x2345f8){while(--_0x2345f8){_0x1b7cc1['push'](_0x1b7cc1['shift']());}};_0x141a92(++_0x4b224e);}(_0x5d61,0x12a));var _0x15d6=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5d61[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x15d6('0x0'));var md5=require(_0x15d6('0x1'));var util=require(_0x15d6('0x2'));var Redis=require(_0x15d6('0x3'));var config=require(_0x15d6('0x4'));config[_0x15d6('0x5')]=_[_0x15d6('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x15d6('0x5')]));function WhatsappQueue(_0x1cf2fc){this['id']=_0x1cf2fc['id']||0x0;this['name']=_0x1cf2fc['name']||'';this['timeout']=_0x1cf2fc[_0x15d6('0x7')]||0xa;this[_0x15d6('0x8')]=_0x1cf2fc[_0x15d6('0x8')]||_0x15d6('0x9');this['Agents']=_0x1cf2fc[_0x15d6('0xa')];this[_0x15d6('0xb')]={};this[_0x15d6('0xc')]=0x0;this[_0x15d6('0x1')]='';this[_0x15d6('0xd')]();this[_0x15d6('0xe')]();}WhatsappQueue[_0x15d6('0xf')][_0x15d6('0xd')]=function(){var _0x255a1a=this['mapAgentsId'][_0x15d6('0x10')];this[_0x15d6('0xb')]=_['map'](this['Agents'],'id');this[_0x15d6('0xb')][_0x15d6('0x10')]=_0x255a1a;};WhatsappQueue[_0x15d6('0xf')][_0x15d6('0xe')]=function(){this[_0x15d6('0x11')]=0x0;this[_0x15d6('0x12')]=0x0;for(var _0x34c056=0x0;_0x34c056=0x0?this[_0x15d6('0x15')]:0x0;var _0x24ee4b={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x15d6('0x16')],'paused':this[_0x15d6('0x12')],'waiting':this[_0x15d6('0xc')]};var _0x3cca50=md5(JSON['stringify'](_0x24ee4b));if(this['md5']!==_0x3cca50){this[_0x15d6('0x1')]=_0x3cca50;io['to'](util['format']('whatsapp:queue:%s',_0x24ee4b['name']))[_0x15d6('0x17')]('whatsapp_queue:save',_0x24ee4b);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0x854d=['whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','paused','length','online','whatsappPause','available','stringify','format','whatsapp:queue:%s','emit'];(function(_0x44a59b,_0x18f8a5){var _0x5382c5=function(_0x453223){while(--_0x453223){_0x44a59b['push'](_0x44a59b['shift']());}};_0x5382c5(++_0x18f8a5);}(_0x854d,0x142));var _0xd854=function(_0x5e12db,_0x527a89){_0x5e12db=_0x5e12db-0x0;var _0xcbdc0c=_0x854d[_0x5e12db];return _0xcbdc0c;};'use strict';var _=require(_0xd854('0x0'));var md5=require(_0xd854('0x1'));var util=require(_0xd854('0x2'));var Redis=require(_0xd854('0x3'));var config=require(_0xd854('0x4'));config['redis']=_['defaults'](config[_0xd854('0x5')],{'host':_0xd854('0x6'),'port':0x18eb});var io=require(_0xd854('0x7'))(new Redis(config[_0xd854('0x5')]));function WhatsappQueue(_0x169836){this['id']=_0x169836['id']||0x0;this['name']=_0x169836[_0xd854('0x8')]||'';this['timeout']=_0x169836[_0xd854('0x9')]||0xa;this[_0xd854('0xa')]=_0x169836[_0xd854('0xa')]||_0xd854('0xb');this[_0xd854('0xc')]=_0x169836[_0xd854('0xc')];this[_0xd854('0xd')]={};this[_0xd854('0xe')]=0x0;this[_0xd854('0x1')]='';this['updateRouting']();this[_0xd854('0xf')]();}WhatsappQueue[_0xd854('0x10')][_0xd854('0x11')]=function(){var _0x1ca830=this[_0xd854('0xd')][_0xd854('0x12')];this[_0xd854('0xd')]=_[_0xd854('0x13')](this['Agents'],'id');this[_0xd854('0xd')][_0xd854('0x12')]=_0x1ca830;};WhatsappQueue[_0xd854('0x10')][_0xd854('0xf')]=function(){this[_0xd854('0x14')]=0x0;this[_0xd854('0x15')]=0x0;for(var _0x3faead=0x0;_0x3faead=0x0?this[_0xd854('0x19')]:0x0;var _0x318f16={'id':this['id'],'available':this[_0xd854('0x19')],'loggedIn':this['loggedIn'],'name':this[_0xd854('0x8')],'paused':this[_0xd854('0x15')],'waiting':this[_0xd854('0xe')]};var _0x138739=md5(JSON[_0xd854('0x1a')](_0x318f16));if(this[_0xd854('0x1')]!==_0x138739){this[_0xd854('0x1')]=_0x138739;io['to'](util[_0xd854('0x1b')](_0xd854('0x1c'),_0x318f16[_0xd854('0x8')]))[_0xd854('0x1d')](_0xd854('0x1e'),_0x318f16);}};module[_0xd854('0x1f')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 196464f..4526808 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x41afee,_0x4f3f48){var _0xc574f9=function(_0x10988e){while(--_0x10988e){_0x41afee['push'](_0x41afee['shift']());}};_0xc574f9(++_0x4f3f48);}(_0xb10b,0x12a));var _0xbb10=function(_0x101152,_0x397ab0){_0x101152=_0x101152-0x0;var _0xe1c465=_0xb10b[_0x101152];return _0xe1c465;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x41d408,_0x31318c){var _0x5b8e29=function(_0x5a41c9){while(--_0x5a41c9){_0x41d408['push'](_0x41d408['shift']());}};_0x5b8e29(++_0x31318c);}(_0xb10b,0x12a));var _0xbb10=function(_0x4d453c,_0x311b8c){_0x4d453c=_0x4d453c-0x0;var _0x4c80ac=_0xb10b[_0x4d453c];return _0x4c80ac;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index e996664..597ea0a 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 _0x37ea=['../client','Request','UpdateChatInteraction','AddTagsToChatInteraction','addTagsToChatInteraction'];(function(_0x1474e8,_0xeb6790){var _0x282d40=function(_0x23b1d2){while(--_0x23b1d2){_0x1474e8['push'](_0x1474e8['shift']());}};_0x282d40(++_0xeb6790);}(_0x37ea,0x154));var _0xa37e=function(_0x1b5b28,_0x5b0630){_0x1b5b28=_0x1b5b28-0x0;var _0x3fe596=_0x37ea[_0x1b5b28];return _0x3fe596;};'use strict';var client=require(_0xa37e('0x0'));exports['update']=function(_0x1fd526,_0x440423){return client[_0xa37e('0x1')](_0xa37e('0x2'),{'body':_0x440423,'options':{'where':{'id':_0x1fd526}},'log':'updateChatInteraction'});};exports['addTags']=function(_0x10832f,_0x20df0a){return client['Request'](_0xa37e('0x3'),{'body':_0x20df0a,'options':{'where':{'id':_0x10832f}},'log':_0xa37e('0x4')});}; \ No newline at end of file +var _0x6790=['../client','update','Request','UpdateChatInteraction','updateChatInteraction','addTagsToChatInteraction'];(function(_0x597ffe,_0x1dc565){var _0x30bd20=function(_0x1ead2e){while(--_0x1ead2e){_0x597ffe['push'](_0x597ffe['shift']());}};_0x30bd20(++_0x1dc565);}(_0x6790,0x186));var _0x0679=function(_0x3f369c,_0x1c5793){_0x3f369c=_0x3f369c-0x0;var _0x3f851a=_0x6790[_0x3f369c];return _0x3f851a;};'use strict';var client=require(_0x0679('0x0'));exports[_0x0679('0x1')]=function(_0x696663,_0x33ab9b){return client[_0x0679('0x2')](_0x0679('0x3'),{'body':_0x33ab9b,'options':{'where':{'id':_0x696663}},'log':_0x0679('0x4')});};exports['addTags']=function(_0x282113,_0x3c2b32){return client['Request']('AddTagsToChatInteraction',{'body':_0x3c2b32,'options':{'where':{'id':_0x282113}},'log':_0x0679('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 7e9b7e9..d642ed9 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 _0x8c5d=['Request','../client','create'];(function(_0x58d5ac,_0x11c4bc){var _0x37985c=function(_0x419671){while(--_0x419671){_0x58d5ac['push'](_0x58d5ac['shift']());}};_0x37985c(++_0x11c4bc);}(_0x8c5d,0x199));var _0xd8c5=function(_0x7db524,_0x4d0675){_0x7db524=_0x7db524-0x0;var _0x2fdbfa=_0x8c5d[_0x7db524];return _0x2fdbfa;};'use strict';var client=require(_0xd8c5('0x0'));exports[_0xd8c5('0x1')]=function(_0x504db2){return client[_0xd8c5('0x2')]('CreateChatMessage',{'body':_0x504db2,'log':'createChatMessage'});}; \ No newline at end of file +var _0xe561=['create','Request','CreateChatMessage','createChatMessage'];(function(_0x1f16ab,_0x4d1d1f){var _0x134d89=function(_0x5db76a){while(--_0x5db76a){_0x1f16ab['push'](_0x1f16ab['shift']());}};_0x134d89(++_0x4d1d1f);}(_0xe561,0xf0));var _0x1e56=function(_0x205f24,_0x19d9ca){_0x205f24=_0x205f24-0x0;var _0xa40691=_0xe561[_0x205f24];return _0xa40691;};'use strict';var client=require('../client');exports[_0x1e56('0x0')]=function(_0x4c689a){return client[_0x1e56('0x1')](_0x1e56('0x2'),{'body':_0x4c689a,'log':_0x1e56('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 6d91952..3853698 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 _0x2e65=['User','online','chatPause','../client','getChatQueues','Request','GetChatQueue','name','timeout','strategy'];(function(_0x4f02e,_0x4ac328){var _0x5a09cd=function(_0x358155){while(--_0x358155){_0x4f02e['push'](_0x4f02e['shift']());}};_0x5a09cd(++_0x4ac328);}(_0x2e65,0x193));var _0x52e6=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0x2e65[_0x38ced4];return _0x547c07;};'use strict';var client=require(_0x52e6('0x0'));exports[_0x52e6('0x1')]=function(){return function(){return client[_0x52e6('0x2')](_0x52e6('0x3'),{'options':{'raw':![],'attributes':['id',_0x52e6('0x4'),_0x52e6('0x5'),_0x52e6('0x6')],'include':[{'model':_0x52e6('0x7'),'as':'Agents','attributes':['id',_0x52e6('0x4'),_0x52e6('0x8'),_0x52e6('0x9')]}]},'log':_0x52e6('0x1')});};}; \ No newline at end of file +var _0x29af=['../client','getChatQueues','Request','name','timeout','User','online'];(function(_0x516d69,_0x3b6ecd){var _0xf8722c=function(_0xd1a117){while(--_0xd1a117){_0x516d69['push'](_0x516d69['shift']());}};_0xf8722c(++_0x3b6ecd);}(_0x29af,0x134));var _0xf29a=function(_0x469d4d,_0x45ab56){_0x469d4d=_0x469d4d-0x0;var _0x28a509=_0x29af[_0x469d4d];return _0x28a509;};'use strict';var client=require(_0xf29a('0x0'));exports[_0xf29a('0x1')]=function(){return function(){return client[_0xf29a('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0xf29a('0x3'),_0xf29a('0x4'),'strategy'],'include':[{'model':_0xf29a('0x5'),'as':'Agents','attributes':['id',_0xf29a('0x3'),_0xf29a('0x6'),'chatPause']}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 4a79bc0..2d6db64 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 _0xc7b4=['DESC','UpdateChatQueueReport','../client','Request','CreateChatQueueReport','update'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc7b4,0x15e));var _0x4c7b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc7b4[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x4c7b('0x0'));exports['create']=function(_0x6edfa6){return client[_0x4c7b('0x1')]('CreateChatQueueReport',{'body':_0x6edfa6,'log':_0x4c7b('0x2')});};exports[_0x4c7b('0x3')]=function(_0x279c21,_0x2a8b1d){return client[_0x4c7b('0x1')]('UpdateChatQueueReport',{'body':_0x2a8b1d,'options':{'where':{'uniqueid':_0x279c21},'order':[['id',_0x4c7b('0x4')]],'limit':0x1},'log':_0x4c7b('0x5')});}; \ No newline at end of file +var _0xc30d=['UpdateChatQueueReport','DESC','../client','Request','CreateChatQueueReport','update'];(function(_0x504df1,_0x289598){var _0x1063b5=function(_0x627abd){while(--_0x627abd){_0x504df1['push'](_0x504df1['shift']());}};_0x1063b5(++_0x289598);}(_0xc30d,0x6e));var _0xdc30=function(_0x4c0622,_0x5dacaf){_0x4c0622=_0x4c0622-0x0;var _0x1799d8=_0xc30d[_0x4c0622];return _0x1799d8;};'use strict';var client=require(_0xdc30('0x0'));exports['create']=function(_0x26986e){return client[_0xdc30('0x1')](_0xdc30('0x2'),{'body':_0x26986e,'log':_0xdc30('0x2')});};exports[_0xdc30('0x3')]=function(_0x50c802,_0x1cc1bc){return client['Request'](_0xdc30('0x4'),{'body':_0x1cc1bc,'options':{'where':{'uniqueid':_0x50c802},'order':[['id',_0xdc30('0x5')]],'limit':0x1},'log':_0xdc30('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 7305c2e..62db1f9 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x2a7202,_0x4be59d){var _0xc463b1=function(_0x3e7a5b){while(--_0x3e7a5b){_0x2a7202['push'](_0x2a7202['shift']());}};_0xc463b1(++_0x4be59d);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x2637ac,_0x377857){var _0x4a5758=function(_0x5d5043){while(--_0x5d5043){_0x2637ac['push'](_0x2637ac['shift']());}};_0x4a5758(++_0x377857);}(_0x7a54,0x106));var _0x47a5=function(_0xd4b435,_0x6ac81b){_0xd4b435=_0xd4b435-0x0;var _0xf88178=_0x7a54[_0xd4b435];return _0xf88178;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 7fffb1d..ac8f28d 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 _0x07d8=['CreateFaxMessage','createFaxMessage'];(function(_0x520236,_0x5c8564){var _0x4d6664=function(_0x398c51){while(--_0x398c51){_0x520236['push'](_0x520236['shift']());}};_0x4d6664(++_0x5c8564);}(_0x07d8,0x174));var _0x807d=function(_0x263a16,_0x489c01){_0x263a16=_0x263a16-0x0;var _0x251824=_0x07d8[_0x263a16];return _0x251824;};'use strict';var client=require('../client');exports['create']=function(_0x1e03f6){return client['Request'](_0x807d('0x0'),{'body':_0x1e03f6,'log':_0x807d('0x1')});}; \ No newline at end of file +var _0x5ad2=['../client','create','createFaxMessage'];(function(_0x317d6f,_0x18463f){var _0x4a5911=function(_0x1ca81a){while(--_0x1ca81a){_0x317d6f['push'](_0x317d6f['shift']());}};_0x4a5911(++_0x18463f);}(_0x5ad2,0x1b3));var _0x25ad=function(_0x4de5bc,_0x50fa9f){_0x4de5bc=_0x4de5bc-0x0;var _0x1d498c=_0x5ad2[_0x4de5bc];return _0x1d498c;};'use strict';var client=require(_0x25ad('0x0'));exports[_0x25ad('0x1')]=function(_0x2efb24){return client['Request']('CreateFaxMessage',{'body':_0x2efb24,'log':_0x25ad('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index f126acf..973314d 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 _0x8b6b=['GetFaxQueue','name','strategy','User','Agents','online','faxPause','Request'];(function(_0x4b0de6,_0x5e4036){var _0x170e0f=function(_0x30ef44){while(--_0x30ef44){_0x4b0de6['push'](_0x4b0de6['shift']());}};_0x170e0f(++_0x5e4036);}(_0x8b6b,0x1c7));var _0xb8b6=function(_0x417249,_0x5b462a){_0x417249=_0x417249-0x0;var _0x5c5fa5=_0x8b6b[_0x417249];return _0x5c5fa5;};'use strict';var client=require('../client');exports['getFaxQueues']=function(){return function(){return client[_0xb8b6('0x0')](_0xb8b6('0x1'),{'options':{'raw':![],'attributes':['id',_0xb8b6('0x2'),'timeout',_0xb8b6('0x3')],'include':[{'model':_0xb8b6('0x4'),'as':_0xb8b6('0x5'),'attributes':['id',_0xb8b6('0x2'),_0xb8b6('0x6'),_0xb8b6('0x7')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file +var _0x3ae7=['timeout','strategy','User','Agents','name','online','../client','getFaxQueues','GetFaxQueue'];(function(_0x5ab11e,_0x5928cf){var _0xccc333=function(_0x4caeb5){while(--_0x4caeb5){_0x5ab11e['push'](_0x5ab11e['shift']());}};_0xccc333(++_0x5928cf);}(_0x3ae7,0x1ad));var _0x73ae=function(_0x40232b,_0x21b4dc){_0x40232b=_0x40232b-0x0;var _0x4b93d1=_0x3ae7[_0x40232b];return _0x4b93d1;};'use strict';var client=require(_0x73ae('0x0'));exports[_0x73ae('0x1')]=function(){return function(){return client['Request'](_0x73ae('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x73ae('0x3'),_0x73ae('0x4')],'include':[{'model':_0x73ae('0x5'),'as':_0x73ae('0x6'),'attributes':['id',_0x73ae('0x7'),_0x73ae('0x8'),'faxPause']}]},'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 33b8322..89c6375 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 _0xa2a3=['CreateFaxQueueReport','update','Request','DESC','UpdateFaxQueueReport','../client','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa2a3,0x194));var _0x3a2a=function(_0x5dfee3,_0x5e3bbe){_0x5dfee3=_0x5dfee3-0x0;var _0x1e1785=_0xa2a3[_0x5dfee3];return _0x1e1785;};'use strict';var client=require(_0x3a2a('0x0'));exports[_0x3a2a('0x1')]=function(_0x530306){return client['Request']('CreateFaxQueueReport',{'body':_0x530306,'log':_0x3a2a('0x2')});};exports[_0x3a2a('0x3')]=function(_0x4ad5c4,_0x2fcbb9){return client[_0x3a2a('0x4')]('UpdateFaxQueueReport',{'body':_0x2fcbb9,'options':{'where':{'uniqueid':_0x4ad5c4},'order':[['id',_0x3a2a('0x5')]],'limit':0x1},'log':_0x3a2a('0x6')});}; \ No newline at end of file +var _0x8c8a=['create','Request','CreateFaxQueueReport','update','DESC','UpdateFaxQueueReport'];(function(_0xe4232c,_0x4b6d96){var _0x19262b=function(_0x5471bc){while(--_0x5471bc){_0xe4232c['push'](_0xe4232c['shift']());}};_0x19262b(++_0x4b6d96);}(_0x8c8a,0x17a));var _0xa8c8=function(_0x31cb77,_0x348021){_0x31cb77=_0x31cb77-0x0;var _0x710374=_0x8c8a[_0x31cb77];return _0x710374;};'use strict';var client=require('../client');exports[_0xa8c8('0x0')]=function(_0x542780){return client[_0xa8c8('0x1')]('CreateFaxQueueReport',{'body':_0x542780,'log':_0xa8c8('0x2')});};exports[_0xa8c8('0x3')]=function(_0x5a97bd,_0x31240a){return client[_0xa8c8('0x1')]('UpdateFaxQueueReport',{'body':_0x31240a,'options':{'where':{'uniqueid':_0x5a97bd},'order':[['id',_0xa8c8('0x4')]],'limit':0x1},'log':_0xa8c8('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index f634f35..d95d4ad 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 _0xdda4=['interval','../client','getIntervals','Request','GetInterval','name','Interval'];(function(_0x2e092e,_0x1bbef3){var _0x4d4f52=function(_0x260843){while(--_0x260843){_0x2e092e['push'](_0x2e092e['shift']());}};_0x4d4f52(++_0x1bbef3);}(_0xdda4,0x94));var _0x4dda=function(_0x11dc39,_0x491115){_0x11dc39=_0x11dc39-0x0;var _0x457277=_0xdda4[_0x11dc39];return _0x457277;};'use strict';var client=require(_0x4dda('0x0'));exports[_0x4dda('0x1')]=function(){return function(){return client[_0x4dda('0x2')](_0x4dda('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x4dda('0x4')],'include':[{'model':_0x4dda('0x5'),'as':'Intervals','attributes':['id',_0x4dda('0x4'),_0x4dda('0x6')]}]},'log':_0x4dda('0x1')});};}; \ No newline at end of file +var _0xa77f=['Interval','Intervals','interval','../client','getIntervals','name'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0xa77f,0x129));var _0xfa77=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa77f[_0x122ef9];return _0x42fba0;};'use strict';var client=require(_0xfa77('0x0'));exports[_0xfa77('0x1')]=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xfa77('0x2')],'include':[{'model':_0xfa77('0x3'),'as':_0xfa77('0x4'),'attributes':['id',_0xfa77('0x2'),_0xfa77('0x5')]}]},'log':_0xfa77('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index d653e8b..21a75e3 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 _0x7916=['Request','addTagsToChatInteraction','../client','UpdateMailInteraction','updateMailInteraction','addTags'];(function(_0x301348,_0x1a08a6){var _0x3b4a76=function(_0x361360){while(--_0x361360){_0x301348['push'](_0x301348['shift']());}};_0x3b4a76(++_0x1a08a6);}(_0x7916,0x128));var _0x6791=function(_0x8f82c5,_0x163934){_0x8f82c5=_0x8f82c5-0x0;var _0x12f69c=_0x7916[_0x8f82c5];return _0x12f69c;};'use strict';var client=require(_0x6791('0x0'));exports['update']=function(_0xeb0b9f,_0xdaaf2b){return client['Request'](_0x6791('0x1'),{'body':_0xdaaf2b,'options':{'where':{'id':_0xeb0b9f}},'log':_0x6791('0x2')});};exports[_0x6791('0x3')]=function(_0x330476,_0x5e6303){return client[_0x6791('0x4')]('AddTagsToMailInteraction',{'body':_0x5e6303,'options':{'where':{'id':_0x330476}},'log':_0x6791('0x5')});}; \ No newline at end of file +var _0x2032=['addTagsToChatInteraction','update','UpdateMailInteraction','updateMailInteraction','Request','AddTagsToMailInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2032,0xd9));var _0x2203=function(_0x3b1ac9,_0x1e44f5){_0x3b1ac9=_0x3b1ac9-0x0;var _0x5bb2b3=_0x2032[_0x3b1ac9];return _0x5bb2b3;};'use strict';var client=require('../client');exports[_0x2203('0x0')]=function(_0x1e103d,_0xcd892f){return client['Request'](_0x2203('0x1'),{'body':_0xcd892f,'options':{'where':{'id':_0x1e103d}},'log':_0x2203('0x2')});};exports['addTags']=function(_0x46c49a,_0x880dcd){return client[_0x2203('0x3')](_0x2203('0x4'),{'body':_0x880dcd,'options':{'where':{'id':_0x46c49a}},'log':_0x2203('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 6c4aea3..9afdf95 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 _0x86b0=['CreateMailMessage','../client','create','Request'];(function(_0x123d83,_0x273569){var _0x1d8af6=function(_0x297eb7){while(--_0x297eb7){_0x123d83['push'](_0x123d83['shift']());}};_0x1d8af6(++_0x273569);}(_0x86b0,0x89));var _0x086b=function(_0x5b31fb,_0x38009b){_0x5b31fb=_0x5b31fb-0x0;var _0x42f7e7=_0x86b0[_0x5b31fb];return _0x42f7e7;};'use strict';var client=require(_0x086b('0x0'));exports[_0x086b('0x1')]=function(_0x10219b){return client[_0x086b('0x2')](_0x086b('0x3'),{'body':_0x10219b,'log':'createMailMessage'});}; \ No newline at end of file +var _0x6d8c=['CreateMailMessage','createMailMessage','../client'];(function(_0x57aff4,_0x51128f){var _0x22acc5=function(_0x144647){while(--_0x144647){_0x57aff4['push'](_0x57aff4['shift']());}};_0x22acc5(++_0x51128f);}(_0x6d8c,0x89));var _0xc6d8=function(_0x445f80,_0x2e75e4){_0x445f80=_0x445f80-0x0;var _0x3d73cb=_0x6d8c[_0x445f80];return _0x3d73cb;};'use strict';var client=require(_0xc6d8('0x0'));exports['create']=function(_0x3d8062){return client['Request'](_0xc6d8('0x1'),{'body':_0x3d8062,'log':_0xc6d8('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 4f66bb4..f4c5c47 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 _0xeef7=['Agents','online','../client','getMailQueues','Request','GetMailQueue','strategy','User'];(function(_0x3420c5,_0x5eaf8b){var _0x49aae3=function(_0x54d52e){while(--_0x54d52e){_0x3420c5['push'](_0x3420c5['shift']());}};_0x49aae3(++_0x5eaf8b);}(_0xeef7,0x1ca));var _0x7eef=function(_0x17fbc2,_0x1f2de7){_0x17fbc2=_0x17fbc2-0x0;var _0x38b500=_0xeef7[_0x17fbc2];return _0x38b500;};'use strict';var client=require(_0x7eef('0x0'));exports[_0x7eef('0x1')]=function(){return function(){return client[_0x7eef('0x2')](_0x7eef('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x7eef('0x4')],'include':[{'model':_0x7eef('0x5'),'as':_0x7eef('0x6'),'attributes':['id','name',_0x7eef('0x7'),'mailPause']}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0xb044=['strategy','User','Agents','mailPause','getMailQueues','GetMailQueue','name','timeout'];(function(_0x18baf4,_0x33086b){var _0x278ed1=function(_0x3ea0a2){while(--_0x3ea0a2){_0x18baf4['push'](_0x18baf4['shift']());}};_0x278ed1(++_0x33086b);}(_0xb044,0x74));var _0x4b04=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xb044[_0x42cae2];return _0x5f256f;};'use strict';var client=require('../client');exports[_0x4b04('0x0')]=function(){return function(){return client['Request'](_0x4b04('0x1'),{'options':{'raw':![],'attributes':['id',_0x4b04('0x2'),_0x4b04('0x3'),_0x4b04('0x4')],'include':[{'model':_0x4b04('0x5'),'as':_0x4b04('0x6'),'attributes':['id',_0x4b04('0x2'),'online',_0x4b04('0x7')]}]},'log':_0x4b04('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 30a8191..6767ed4 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 _0xde2f=['../client','CreateMailQueueReport','update','Request','UpdateMailQueueReport','DESC'];(function(_0x291147,_0x4f833d){var _0x530153=function(_0x3a2797){while(--_0x3a2797){_0x291147['push'](_0x291147['shift']());}};_0x530153(++_0x4f833d);}(_0xde2f,0x132));var _0xfde2=function(_0x1ebe43,_0x27443d){_0x1ebe43=_0x1ebe43-0x0;var _0x3652b0=_0xde2f[_0x1ebe43];return _0x3652b0;};'use strict';var client=require(_0xfde2('0x0'));exports['create']=function(_0x4656f8){return client['Request']('CreateMailQueueReport',{'body':_0x4656f8,'log':_0xfde2('0x1')});};exports[_0xfde2('0x2')]=function(_0x8b2569,_0x6d15b){return client[_0xfde2('0x3')](_0xfde2('0x4'),{'body':_0x6d15b,'options':{'where':{'uniqueid':_0x8b2569},'order':[['id',_0xfde2('0x5')]],'limit':0x1},'log':_0xfde2('0x4')});}; \ No newline at end of file +var _0xdb31=['UpdateMailQueueReport','create','Request','CreateMailQueueReport','update'];(function(_0x268916,_0x1c27e1){var _0x38f8a4=function(_0x5e9ea6){while(--_0x5e9ea6){_0x268916['push'](_0x268916['shift']());}};_0x38f8a4(++_0x1c27e1);}(_0xdb31,0x169));var _0x1db3=function(_0x544099,_0x372b30){_0x544099=_0x544099-0x0;var _0x20ab09=_0xdb31[_0x544099];return _0x20ab09;};'use strict';var client=require('../client');exports[_0x1db3('0x0')]=function(_0x1b1766){return client[_0x1db3('0x1')](_0x1db3('0x2'),{'body':_0x1b1766,'log':_0x1db3('0x2')});};exports[_0x1db3('0x3')]=function(_0x4f56c4,_0x378a3e){return client['Request'](_0x1db3('0x4'),{'body':_0x378a3e,'options':{'where':{'uniqueid':_0x4f56c4},'order':[['id','DESC']],'limit':0x1},'log':_0x1db3('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index b06d856..1c701bd 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 _0x37d1=['Request','addTagsToChatInteraction','update','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags'];(function(_0x1c1d05,_0x255116){var _0x432813=function(_0x384005){while(--_0x384005){_0x1c1d05['push'](_0x1c1d05['shift']());}};_0x432813(++_0x255116);}(_0x37d1,0xf2));var _0x137d=function(_0x4ca3bc,_0x16ff7d){_0x4ca3bc=_0x4ca3bc-0x0;var _0x519648=_0x37d1[_0x4ca3bc];return _0x519648;};'use strict';var client=require('../client');exports[_0x137d('0x0')]=function(_0x67f6c3,_0x7037b5){return client['Request'](_0x137d('0x1'),{'body':_0x7037b5,'options':{'where':{'id':_0x67f6c3}},'log':_0x137d('0x2')});};exports[_0x137d('0x3')]=function(_0x224cdb,_0x1efa02){return client[_0x137d('0x4')]('AddTagsToOpenchannelInteraction',{'body':_0x1efa02,'options':{'where':{'id':_0x224cdb}},'log':_0x137d('0x5')});}; \ No newline at end of file +var _0x6150=['addTagsToChatInteraction','updateOpenchannelInteraction','addTags','Request','AddTagsToOpenchannelInteraction'];(function(_0x330b83,_0x51475a){var _0x46489f=function(_0x3eea2d){while(--_0x3eea2d){_0x330b83['push'](_0x330b83['shift']());}};_0x46489f(++_0x51475a);}(_0x6150,0x128));var _0x0615=function(_0x352d00,_0x3363da){_0x352d00=_0x352d00-0x0;var _0x72c307=_0x6150[_0x352d00];return _0x72c307;};'use strict';var client=require('../client');exports['update']=function(_0x325a9d,_0x29f33a){return client['Request']('UpdateOpenchannelInteraction',{'body':_0x29f33a,'options':{'where':{'id':_0x325a9d}},'log':_0x0615('0x0')});};exports[_0x0615('0x1')]=function(_0x2752a5,_0xa9c3b2){return client[_0x0615('0x2')](_0x0615('0x3'),{'body':_0xa9c3b2,'options':{'where':{'id':_0x2752a5}},'log':_0x0615('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index e51be6a..94e5925 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 _0xb217=['../client','create'];(function(_0xfb0cfd,_0x500179){var _0x2fd8aa=function(_0xccb501){while(--_0xccb501){_0xfb0cfd['push'](_0xfb0cfd['shift']());}};_0x2fd8aa(++_0x500179);}(_0xb217,0x172));var _0x7b21=function(_0x2ed4f7,_0x461cec){_0x2ed4f7=_0x2ed4f7-0x0;var _0x849b17=_0xb217[_0x2ed4f7];return _0x849b17;};'use strict';var client=require(_0x7b21('0x0'));exports[_0x7b21('0x1')]=function(_0x5c30ea){return client['Request']('CreateOpenchannelMessage',{'body':_0x5c30ea,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0x15de=['CreateOpenchannelMessage','createOpenchannelMessage','create'];(function(_0x2b30fe,_0xe92c0a){var _0x2d1e4e=function(_0x43366d){while(--_0x43366d){_0x2b30fe['push'](_0x2b30fe['shift']());}};_0x2d1e4e(++_0xe92c0a);}(_0x15de,0x173));var _0xe15d=function(_0x2bf6be,_0x5b23f1){_0x2bf6be=_0x2bf6be-0x0;var _0x532ef4=_0x15de[_0x2bf6be];return _0x532ef4;};'use strict';var client=require('../client');exports[_0xe15d('0x0')]=function(_0xdd9901){return client['Request'](_0xe15d('0x1'),{'body':_0xdd9901,'log':_0xe15d('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 086433f..656a6b3 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 _0xcee2=['Agents','name','online','getOpenchannelQueues','../client','Request','GetOpenchannelQueue','timeout','strategy','User'];(function(_0x310d10,_0x3fe887){var _0x1fb8af=function(_0x42965b){while(--_0x42965b){_0x310d10['push'](_0x310d10['shift']());}};_0x1fb8af(++_0x3fe887);}(_0xcee2,0x1e4));var _0x2cee=function(_0x5cd9d9,_0x5545e7){_0x5cd9d9=_0x5cd9d9-0x0;var _0x2c6c14=_0xcee2[_0x5cd9d9];return _0x2c6c14;};'use strict';var client=require(_0x2cee('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0x2cee('0x1')](_0x2cee('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x2cee('0x3'),_0x2cee('0x4')],'include':[{'model':_0x2cee('0x5'),'as':_0x2cee('0x6'),'attributes':['id',_0x2cee('0x7'),_0x2cee('0x8'),'openchannelPause']}]},'log':_0x2cee('0x9')});};}; \ No newline at end of file +var _0x9a67=['GetOpenchannelQueue','name','User','openchannelPause','getOpenchannelQueues','../client','Request'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x9a67,0x1da));var _0x79a6=function(_0x28a03c,_0x123a4a){_0x28a03c=_0x28a03c-0x0;var _0x4bbb1e=_0x9a67[_0x28a03c];return _0x4bbb1e;};'use strict';var client=require(_0x79a6('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0x79a6('0x1')](_0x79a6('0x2'),{'options':{'raw':![],'attributes':['id',_0x79a6('0x3'),'timeout','strategy'],'include':[{'model':_0x79a6('0x4'),'as':'Agents','attributes':['id',_0x79a6('0x3'),'online',_0x79a6('0x5')]}]},'log':_0x79a6('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 5aea630..27b9d05 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 _0x51ab=['update','UpdateOpenchannelQueueReport','DESC','CreateOpenchannelQueueReport'];(function(_0x490e61,_0x7f848e){var _0x169bc6=function(_0x1c70bf){while(--_0x1c70bf){_0x490e61['push'](_0x490e61['shift']());}};_0x169bc6(++_0x7f848e);}(_0x51ab,0x103));var _0xb51a=function(_0x2b4aa8,_0xc42bf5){_0x2b4aa8=_0x2b4aa8-0x0;var _0x43b854=_0x51ab[_0x2b4aa8];return _0x43b854;};'use strict';var client=require('../client');exports['create']=function(_0x6ca902){return client['Request']('CreateOpenchannelQueueReport',{'body':_0x6ca902,'log':_0xb51a('0x0')});};exports[_0xb51a('0x1')]=function(_0x4b6a7c,_0x490cc5){return client['Request'](_0xb51a('0x2'),{'body':_0x490cc5,'options':{'where':{'uniqueid':_0x4b6a7c},'order':[['id',_0xb51a('0x3')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0x3505=['update','Request','CreateOpenchannelQueueReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3505,0x10a));var _0x5350=function(_0x16acdb,_0x7fec2b){_0x16acdb=_0x16acdb-0x0;var _0x1733ee=_0x3505[_0x16acdb];return _0x1733ee;};'use strict';var client=require('../client');exports['create']=function(_0x3cb12e){return client['Request'](_0x5350('0x0'),{'body':_0x3cb12e,'log':_0x5350('0x0')});};exports[_0x5350('0x1')]=function(_0x38fd6a,_0x2d1c53){return client[_0x5350('0x2')]('UpdateOpenchannelQueueReport',{'body':_0x2d1c53,'options':{'where':{'uniqueid':_0x38fd6a},'order':[['id','DESC']],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index c84bed9..ff0e808 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 _0x8a8b=['Request','updateSmsInteraction','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client'];(function(_0x48bb77,_0x8d9a85){var _0x288bbe=function(_0x8a10db){while(--_0x8a10db){_0x48bb77['push'](_0x48bb77['shift']());}};_0x288bbe(++_0x8d9a85);}(_0x8a8b,0xae));var _0xb8a8=function(_0x4e16ee,_0x47b5b3){_0x4e16ee=_0x4e16ee-0x0;var _0x48cce5=_0x8a8b[_0x4e16ee];return _0x48cce5;};'use strict';var client=require(_0xb8a8('0x0'));exports['update']=function(_0x54e14e,_0x30a142){return client[_0xb8a8('0x1')]('UpdateSmsInteraction',{'body':_0x30a142,'options':{'where':{'id':_0x54e14e}},'log':_0xb8a8('0x2')});};exports['addTags']=function(_0xca9854,_0x4fe301){return client[_0xb8a8('0x1')](_0xb8a8('0x3'),{'body':_0x4fe301,'options':{'where':{'id':_0xca9854}},'log':_0xb8a8('0x4')});}; \ No newline at end of file +var _0x7250=['addTags','../client','update','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x2ad008,_0x45c253){var _0x4538cf=function(_0xe143e4){while(--_0xe143e4){_0x2ad008['push'](_0x2ad008['shift']());}};_0x4538cf(++_0x45c253);}(_0x7250,0x1b1));var _0x0725=function(_0x3949ab,_0x4c06df){_0x3949ab=_0x3949ab-0x0;var _0x66bae2=_0x7250[_0x3949ab];return _0x66bae2;};'use strict';var client=require(_0x0725('0x0'));exports[_0x0725('0x1')]=function(_0x56da03,_0x3ecf7f){return client[_0x0725('0x2')](_0x0725('0x3'),{'body':_0x3ecf7f,'options':{'where':{'id':_0x56da03}},'log':_0x0725('0x4')});};exports[_0x0725('0x5')]=function(_0x4724ef,_0x53cc59){return client[_0x0725('0x2')]('AddTagsToSmsInteraction',{'body':_0x53cc59,'options':{'where':{'id':_0x4724ef}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 2f1f0c8..5d00f12 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 _0x1e90=['create','Request','createSmsMessage'];(function(_0x510c60,_0x50247e){var _0x49c4aa=function(_0x3149c7){while(--_0x3149c7){_0x510c60['push'](_0x510c60['shift']());}};_0x49c4aa(++_0x50247e);}(_0x1e90,0x1e9));var _0x01e9=function(_0x540ec3,_0x49044d){_0x540ec3=_0x540ec3-0x0;var _0x38910d=_0x1e90[_0x540ec3];return _0x38910d;};'use strict';var client=require('../client');exports[_0x01e9('0x0')]=function(_0x5eae80){return client[_0x01e9('0x1')]('CreateSmsMessage',{'body':_0x5eae80,'log':_0x01e9('0x2')});}; \ No newline at end of file +var _0x3b14=['../client','create','Request','CreateSmsMessage','createSmsMessage'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x3b14,0x181));var _0x43b1=function(_0x31e598,_0x3255ee){_0x31e598=_0x31e598-0x0;var _0x2eba55=_0x3b14[_0x31e598];return _0x2eba55;};'use strict';var client=require(_0x43b1('0x0'));exports[_0x43b1('0x1')]=function(_0x16efcf){return client[_0x43b1('0x2')](_0x43b1('0x3'),{'body':_0x16efcf,'log':_0x43b1('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 6951fca..a4b4ab6 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 _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x12ce46,_0x53e1a5){var _0xe2feb0=function(_0x5e5bd3){while(--_0x5e5bd3){_0x12ce46['push'](_0x12ce46['shift']());}};_0xe2feb0(++_0x53e1a5);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file +var _0xe706=['Agents','online','smsPause','../client','getSmsQueues','Request','name','timeout','strategy','User'];(function(_0xbe25f5,_0x5693cd){var _0x22cdd6=function(_0x17ae8a){while(--_0x17ae8a){_0xbe25f5['push'](_0xbe25f5['shift']());}};_0x22cdd6(++_0x5693cd);}(_0xe706,0xa3));var _0x6e70=function(_0x1d69ba,_0x4090c9){_0x1d69ba=_0x1d69ba-0x0;var _0x8bab8c=_0xe706[_0x1d69ba];return _0x8bab8c;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x6e70('0x3'),_0x6e70('0x4'),_0x6e70('0x5')],'include':[{'model':_0x6e70('0x6'),'as':_0x6e70('0x7'),'attributes':['id',_0x6e70('0x3'),_0x6e70('0x8'),_0x6e70('0x9')]}]},'log':_0x6e70('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 47bdd7c..d4e40d5 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0x2538f1,_0x575840){var _0x85122e=function(_0x48b38e){while(--_0x48b38e){_0x2538f1['push'](_0x2538f1['shift']());}};_0x85122e(++_0x575840);}(_0x55ca,0x126));var _0xa55c=function(_0x3a441a,_0x43eb56){_0x3a441a=_0x3a441a-0x0;var _0x3128a2=_0x55ca[_0x3a441a];return _0x3128a2;};'use strict';var client=require(_0xa55c('0x0'));exports[_0xa55c('0x1')]=function(_0x4e78b4){return client['Request']('CreateSmsQueueReport',{'body':_0x4e78b4,'log':_0xa55c('0x2')});};exports[_0xa55c('0x3')]=function(_0x5dc716,_0x3b478a){return client[_0xa55c('0x4')](_0xa55c('0x5'),{'body':_0x3b478a,'options':{'where':{'uniqueid':_0x5dc716},'order':[['id',_0xa55c('0x6')]],'limit':0x1},'log':_0xa55c('0x5')});}; \ No newline at end of file +var _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x68f9f,_0x4f8e85){var _0x10f944=function(_0x2d93b2){while(--_0x2d93b2){_0x68f9f['push'](_0x68f9f['shift']());}};_0x10f944(++_0x4f8e85);}(_0x70e0,0x17b));var _0x070e=function(_0x5ad22d,_0x24208f){_0x5ad22d=_0x5ad22d-0x0;var _0x4390e8=_0x70e0[_0x5ad22d];return _0x4390e8;};'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 d7e7d15..fc91c57 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(_0x3e44cb,_0x2e4af7){var _0x554dd4=function(_0x593a17){while(--_0x593a17){_0x3e44cb['push'](_0x3e44cb['shift']());}};_0x554dd4(++_0x2e4af7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file +var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x3be670,_0x3df80f){var _0x5de4f2=function(_0x21ad16){while(--_0x21ad16){_0x3be670['push'](_0x3be670['shift']());}};_0x5de4f2(++_0x3df80f);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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 8488d5a..0cb8a8e 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 _0xa498=['update','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction'];(function(_0x41ce34,_0x22932a){var _0x580c63=function(_0x46a806){while(--_0x46a806){_0x41ce34['push'](_0x41ce34['shift']());}};_0x580c63(++_0x22932a);}(_0xa498,0x1d6));var _0x8a49=function(_0x4fe496,_0x1d8673){_0x4fe496=_0x4fe496-0x0;var _0x422b24=_0xa498[_0x4fe496];return _0x422b24;};'use strict';var client=require('../client');exports[_0x8a49('0x0')]=function(_0xafd977,_0x48e111){return client['Request'](_0x8a49('0x1'),{'body':_0x48e111,'options':{'where':{'id':_0xafd977}},'log':_0x8a49('0x2')});};exports[_0x8a49('0x3')]=function(_0x65eb15,_0x2f362e){return client['Request'](_0x8a49('0x4'),{'body':_0x2f362e,'options':{'where':{'id':_0x65eb15}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0xe2fe=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xee2f('0x0'));exports['update']=function(_0x521787,_0xb0780a){return client['Request'](_0xee2f('0x1'),{'body':_0xb0780a,'options':{'where':{'id':_0x521787}},'log':_0xee2f('0x2')});};exports[_0xee2f('0x3')]=function(_0x2d2b03,_0xcb45e6){return client['Request'](_0xee2f('0x4'),{'body':_0xcb45e6,'options':{'where':{'id':_0x2d2b03}},'log':_0xee2f('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 5ec2972..6a62517 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 _0xddb3=['../client','create','Request','createWhatsappMessage'];(function(_0x51423e,_0x21a8e8){var _0x5addc4=function(_0x1b2662){while(--_0x1b2662){_0x51423e['push'](_0x51423e['shift']());}};_0x5addc4(++_0x21a8e8);}(_0xddb3,0x190));var _0x3ddb=function(_0xad46e8,_0x5de468){_0xad46e8=_0xad46e8-0x0;var _0x5697ed=_0xddb3[_0xad46e8];return _0x5697ed;};'use strict';var client=require(_0x3ddb('0x0'));exports[_0x3ddb('0x1')]=function(_0x50c755){return client[_0x3ddb('0x2')]('CreateWhatsappMessage',{'body':_0x50c755,'log':_0x3ddb('0x3')});}; \ No newline at end of file +var _0xfbad=['create','Request','CreateWhatsappMessage','createWhatsappMessage','../client'];(function(_0x1d667d,_0x5bfcdf){var _0x4c55a6=function(_0x2cb6d0){while(--_0x2cb6d0){_0x1d667d['push'](_0x1d667d['shift']());}};_0x4c55a6(++_0x5bfcdf);}(_0xfbad,0xe5));var _0xdfba=function(_0x520ac6,_0x3cc594){_0x520ac6=_0x520ac6-0x0;var _0x48699d=_0xfbad[_0x520ac6];return _0x48699d;};'use strict';var client=require(_0xdfba('0x0'));exports[_0xdfba('0x1')]=function(_0x5cbe11){return client[_0xdfba('0x2')](_0xdfba('0x3'),{'body':_0x5cbe11,'log':_0xdfba('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index ce88b7b..215e427 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 _0x575b=['name','timeout','strategy','whatsappPause','getWhatsappQueues','../client'];(function(_0x15e984,_0x5078bf){var _0x6011a=function(_0x3a16c8){while(--_0x3a16c8){_0x15e984['push'](_0x15e984['shift']());}};_0x6011a(++_0x5078bf);}(_0x575b,0x1af));var _0xb575=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x575b[_0x2c91e9];return _0x13f0ff;};'use strict';var client=require(_0xb575('0x0'));exports['getWhatsappQueues']=function(){return function(){return client['Request']('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0xb575('0x1'),_0xb575('0x2'),_0xb575('0x3')],'include':[{'model':'User','as':'Agents','attributes':['id','name','online',_0xb575('0x4')]}]},'log':_0xb575('0x5')});};}; \ No newline at end of file +var _0xb37c=['User','Agents','whatsappPause','Request','GetWhatsappQueue','name','timeout','strategy'];(function(_0x74200e,_0x1d38a5){var _0x2c0033=function(_0x2c4c1e){while(--_0x2c4c1e){_0x74200e['push'](_0x74200e['shift']());}};_0x2c0033(++_0x1d38a5);}(_0xb37c,0xf3));var _0xcb37=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xb37c[_0x2b4411];return _0x8e41ef;};'use strict';var client=require('../client');exports['getWhatsappQueues']=function(){return function(){return client[_0xcb37('0x0')](_0xcb37('0x1'),{'options':{'raw':![],'attributes':['id',_0xcb37('0x2'),_0xcb37('0x3'),_0xcb37('0x4')],'include':[{'model':_0xcb37('0x5'),'as':_0xcb37('0x6'),'attributes':['id','name','online',_0xcb37('0x7')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 5bbfc8b..0e4382c 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 _0x949b=['Request','DESC','UpdateWhatsappQueueReport','../client','create','CreateWhatsappQueueReport'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x949b,0xcf));var _0xb949=function(_0x3c9399,_0x385d5f){_0x3c9399=_0x3c9399-0x0;var _0x42b2e9=_0x949b[_0x3c9399];return _0x42b2e9;};'use strict';var client=require(_0xb949('0x0'));exports[_0xb949('0x1')]=function(_0x5ead3b){return client['Request'](_0xb949('0x2'),{'body':_0x5ead3b,'log':_0xb949('0x2')});};exports['update']=function(_0x3fd106,_0x4ebf97){return client[_0xb949('0x3')]('UpdateWhatsappQueueReport',{'body':_0x4ebf97,'options':{'where':{'uniqueid':_0x3fd106},'order':[['id',_0xb949('0x4')]],'limit':0x1},'log':_0xb949('0x5')});}; \ No newline at end of file +var _0xc13a=['CreateWhatsappQueueReport','Request','UpdateWhatsappQueueReport','DESC','../client','create'];(function(_0x256979,_0x2e0a21){var _0x16c9d2=function(_0x534e80){while(--_0x534e80){_0x256979['push'](_0x256979['shift']());}};_0x16c9d2(++_0x2e0a21);}(_0xc13a,0x1cc));var _0xac13=function(_0x48d250,_0x13cdb3){_0x48d250=_0x48d250-0x0;var _0x420fc1=_0xc13a[_0x48d250];return _0x420fc1;};'use strict';var client=require(_0xac13('0x0'));exports[_0xac13('0x1')]=function(_0x5d5ffb){return client['Request'](_0xac13('0x2'),{'body':_0x5d5ffb,'log':'CreateWhatsappQueueReport'});};exports['update']=function(_0x529feb,_0x2bbd6c){return client[_0xac13('0x3')](_0xac13('0x4'),{'body':_0x2bbd6c,'options':{'where':{'uniqueid':_0x529feb},'order':[['id',_0xac13('0x5')]],'limit':0x1},'log':_0xac13('0x4')});}; \ 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 ae0df65..b2fa8f2 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 _0x2755=['channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','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','number','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','map','message','join','stop','agents','timeout','createQueue'];(function(_0x1f622f,_0x892de9){var _0xa9a796=function(_0x7f8bfc){while(--_0x7f8bfc){_0x1f622f['push'](_0x1f622f['shift']());}};_0xa9a796(++_0x892de9);}(_0x2755,0x80));var _0x5275=function(_0x1a7bec,_0x31bbd7){_0x1a7bec=_0x1a7bec-0x0;var _0x55bf92=_0x2755[_0x1a7bec];return _0x55bf92;};'use strict';var schema=require(_0x5275('0x0'));var _=require(_0x5275('0x1'));var util=require(_0x5275('0x2'));var seqqueue=require(_0x5275('0x3'));var logger=require(_0x5275('0x4'))(_0x5275('0x5'));var strategy=require(_0x5275('0x6'));var queue=schema({'name':{'type':_0x5275('0x7'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x5275('0x8'),'message':_0x5275('0x9')}});function writeLog(_0x5f34d3,_0x233243,_0x574206){return logger['info'](util[_0x5275('0xa')](_0x5275('0xb'),_0x5f34d3,_0x233243['name'],_0x574206));}function handleFindAgent(_0x1e864c){return function(_0x3b984e){return _0x3b984e[_0x5275('0xc')]['toLowerCase']()===_0x1e864c[_0x5275('0xd')]();};}exports[_0x5275('0xe')]=function(_0x3dbab5,_0x3a618f,_0x5e16fd,_0xbf0c21){return function(_0x4e301b){try{var _0x220a8a={'name':_0x3a618f[0x0],'timeout':_0x3a618f[0x1]};var _0x3e2fad=queue[_0x5275('0x0')](_0x220a8a,{'typecast':!![]});if(_0x3e2fad[_0x5275('0xf')]){logger[_0x5275('0x10')]('[%s][AGENT]\x20%s',_0x3dbab5,_[_0x5275('0x11')](_0x3e2fad,_0x5275('0x12'))[_0x5275('0x13')](',\x20'));_0x4e301b[_0x5275('0x14')]();}else{var _0x4f9319=_['find'](_0x5e16fd[_0x5275('0x15')],handleFindAgent(_0x220a8a[_0x5275('0xc')]));if(_0x4f9319){var _0x2efde3=(_0x220a8a[_0x5275('0x16')]||0xa)*0x3e8;var _0x4e3187,_0x37ae23;var _0x14a4c1=seqqueue[_0x5275('0x17')](_0x2efde3);_0x14a4c1['id']=_0x3dbab5;_0x14a4c1['atimeout']=_0x2efde3;_0x14a4c1[_0x5275('0x18')]=_0xbf0c21[_0x5275('0x18')];writeLog(_0x3dbab5,_0x4f9319,util[_0x5275('0xa')](_0x5275('0x19'),_0x2efde3));_0x5e16fd[_0x5275('0x1a')][_0x3dbab5]['on'](_0x5275('0x1b'),function(){logger['info'](_0x5275('0x1c'),_0x3dbab5);clearTimeout(_0x37ae23);_0x37ae23=undefined;_0x14a4c1[_0x5275('0x1d')]();if(_0x5e16fd[_0x5275('0x1a')][_0x3dbab5]){delete _0x5e16fd[_0x5275('0x1a')][_0x3dbab5];}_0x4e301b[_0x5275('0x14')]();});_0x5e16fd['rules'][_0x3dbab5]['on'](_0x5275('0x1e'),function(){if(_0x5e16fd['rules'][_0x3dbab5]){delete _0x5e16fd['rules'][_0x3dbab5];}});_0x37ae23=setTimeout(function(){logger['info'](_0x5275('0x1f'),_0x3dbab5);clearTimeout(_0x37ae23);_0x14a4c1['close']();_0x4e301b[_0x5275('0x20')]();},_0x2efde3);strategy[_0x5275('0x21')](_0x14a4c1,_0x4f9319,_0x5e16fd,_0xbf0c21);}else{logger['error'](_0x5275('0x22'),_0x3dbab5,_0x220a8a[_0x5275('0xc')]);_0x4e301b[_0x5275('0x14')]();}}}catch(_0x3e3d76){console[_0x5275('0x23')](_0x3e3d76);logger[_0x5275('0x10')](_0x5275('0x24'),_0x3dbab5,_0x3e3d76[_0x5275('0x25')]);_0x4e301b[_0x5275('0x14')]();}};}; \ No newline at end of file +var _0xde32=['[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','validate','lodash','seq-queue','../../../../config/logger','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','format','name','toLowerCase','length','error','[%s][AGENT]\x20%s','map','message','stop','timeout','createQueue','channel','rules','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','close','next','agent'];(function(_0x238671,_0x34aea0){var _0x474844=function(_0x26cab4){while(--_0x26cab4){_0x238671['push'](_0x238671['shift']());}};_0x474844(++_0x34aea0);}(_0xde32,0xd5));var _0x2de3=function(_0x2d5331,_0xf871cf){_0x2d5331=_0x2d5331-0x0;var _0x556370=_0xde32[_0x2d5331];return _0x556370;};'use strict';var schema=require(_0x2de3('0x0'));var _=require(_0x2de3('0x1'));var util=require('util');var seqqueue=require(_0x2de3('0x2'));var logger=require(_0x2de3('0x3'))('routing');var strategy=require(_0x2de3('0x4'));var queue=schema({'name':{'type':_0x2de3('0x5'),'required':!![],'message':_0x2de3('0x6')},'timeout':{'type':_0x2de3('0x7'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x6a80f6,_0x299326,_0x18ae95){return logger['info'](util[_0x2de3('0x8')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x6a80f6,_0x299326[_0x2de3('0x9')],_0x18ae95));}function handleFindAgent(_0x4ccd5d){return function(_0xeb90a5){return _0xeb90a5[_0x2de3('0x9')][_0x2de3('0xa')]()===_0x4ccd5d[_0x2de3('0xa')]();};}exports['consequence']=function(_0x42d874,_0x3a60fd,_0x562630,_0x243aae){return function(_0x40ad35){try{var _0x12af2d={'name':_0x3a60fd[0x0],'timeout':_0x3a60fd[0x1]};var _0x218e73=queue[_0x2de3('0x0')](_0x12af2d,{'typecast':!![]});if(_0x218e73[_0x2de3('0xb')]){logger[_0x2de3('0xc')](_0x2de3('0xd'),_0x42d874,_[_0x2de3('0xe')](_0x218e73,_0x2de3('0xf'))['join'](',\x20'));_0x40ad35[_0x2de3('0x10')]();}else{var _0x581407=_['find'](_0x562630['agents'],handleFindAgent(_0x12af2d[_0x2de3('0x9')]));if(_0x581407){var _0x21b60f=(_0x12af2d[_0x2de3('0x11')]||0xa)*0x3e8;var _0x3587b5,_0x4ba450;var _0x7e7c2d=seqqueue[_0x2de3('0x12')](_0x21b60f);_0x7e7c2d['id']=_0x42d874;_0x7e7c2d['atimeout']=_0x21b60f;_0x7e7c2d[_0x2de3('0x13')]=_0x243aae[_0x2de3('0x13')];writeLog(_0x42d874,_0x581407,util['format']('START:%s',_0x21b60f));_0x562630[_0x2de3('0x14')][_0x42d874]['on'](_0x2de3('0x15'),function(){logger[_0x2de3('0x16')](_0x2de3('0x17'),_0x42d874);clearTimeout(_0x4ba450);_0x4ba450=undefined;_0x7e7c2d[_0x2de3('0x18')]();if(_0x562630[_0x2de3('0x14')][_0x42d874]){delete _0x562630[_0x2de3('0x14')][_0x42d874];}_0x40ad35['stop']();});_0x562630[_0x2de3('0x14')][_0x42d874]['on']('complete',function(){if(_0x562630[_0x2de3('0x14')][_0x42d874]){delete _0x562630[_0x2de3('0x14')][_0x42d874];}});_0x4ba450=setTimeout(function(){logger[_0x2de3('0x16')]('[%s][AGENT]\x20ROUTING\x20END',_0x42d874);clearTimeout(_0x4ba450);_0x7e7c2d[_0x2de3('0x18')]();_0x40ad35[_0x2de3('0x19')]();},_0x21b60f);strategy[_0x2de3('0x1a')](_0x7e7c2d,_0x581407,_0x562630,_0x243aae);}else{logger[_0x2de3('0xc')](_0x2de3('0x1b'),_0x42d874,_0x12af2d[_0x2de3('0x9')]);_0x40ad35[_0x2de3('0x10')]();}}}catch(_0x307336){console[_0x2de3('0x1c')](_0x307336);logger[_0x2de3('0xc')]('[%s][QUEUE]\x20%s',_0x42d874,_0x307336[_0x2de3('0x1d')]);_0x40ad35[_0x2de3('0x10')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 6796899..cd76987 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 _0x1380=['message','postText','next','amazonlex','providerResponse','Message','create','then','Failed','catch','lodash','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','consequence','interaction','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','getMustacheRender','body','error','[%s][AMAZONLEX]\x20%s','stringify','finally','info','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x1380,0x13e));var _0x0138=function(_0x514e58,_0x381db6){_0x514e58=_0x514e58-0x0;var _0x5a539a=_0x1380[_0x514e58];return _0x5a539a;};'use strict';var _=require(_0x0138('0x0'));var moment=require(_0x0138('0x1'));var AWS=require('aws-sdk');var utils=require(_0x0138('0x2'));var logger=require(_0x0138('0x3'))('routing');var rpc={'chatMessage':require(_0x0138('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x0138('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x0138('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x0138('0x7')]=function(_0x3fe196,_0x4c4d86){return function(_0x1c53cf){try{if(!_['isNil'](this[_0x0138('0x8')]['UserId'])){logger['info']('[%s][AMAZONLEX]\x20%s',_0x3fe196,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x1c53cf['next']();}var _0x5808b9={'ContactId':this[_0x0138('0x9')]['id'],'sentAt':moment()[_0x0138('0xa')](_0x0138('0xb')),'direction':_0x0138('0xc')};if(this['channel']===_0x0138('0xd')||this[_0x0138('0xe')]===_0x0138('0xf')){_0x5808b9[_0x0138('0x10')]=this[_0x0138('0x8')][_0x0138('0x10')];}var _0x233e1e=this[_0x0138('0xe')];if(_0x233e1e===_0x0138('0x11')){_0x5808b9[_0x0138('0x12')]=this[_0x0138('0x13')]['id'];}else{_0x5808b9[_[_0x0138('0x14')](_0x233e1e)+_0x0138('0x15')]=this[_0x0138('0x13')]['id'];}_0x5808b9[_[_0x0138('0x14')](_0x233e1e)+'InteractionId']=this['interaction']['id'];if(this[_0x0138('0x8')]['created']){var _0x5eb2e3=_0x4c4d86[0x4];if(!_['isEmpty'](_0x5eb2e3)){_0x5808b9['body']=utils[_0x0138('0x16')](_0x5eb2e3,this);return rpc[_0x233e1e+'Message']['create'](_0x5808b9)['then'](function(_0x33ebc3){logger['info']('[%s][AMAZONLEX]\x20%s',_0x3fe196,_0x5808b9[_0x0138('0x17')]);})['catch'](function(_0x318257){logger[_0x0138('0x18')](_0x0138('0x19'),_0x3fe196,JSON[_0x0138('0x1a')](_0x318257));})[_0x0138('0x1b')](function(){logger[_0x0138('0x1c')](_0x0138('0x1d'),_0x3fe196);_0x1c53cf[_0x0138('0x1e')]();});}else{logger['info'](_0x0138('0x1f'),_0x3fe196);_0x1c53cf[_0x0138('0x1e')]();}}else{var _0x3d545f=this;var _0x4a38a5=new AWS[(_0x0138('0x20'))]({'accessKeyId':_0x4c4d86[0x0],'secretAccessKey':_0x4c4d86[0x1],'region':_0x4c4d86[0x2]});var _0x584e7a={'botAlias':_0x0138('0x21'),'botName':_0x4c4d86[0x3],'inputText':this[_0x0138('0x22')]['body'],'userId':this[_0x0138('0xe')]+':'+this[_0x0138('0x8')]['id']['toString']()};_0x4a38a5[_0x0138('0x23')](_0x584e7a,function(_0x59e535,_0x494adb){if(_0x59e535){logger[_0x0138('0x18')]('[%s][AMAZONLEX]\x20%s',_0x3fe196,_0x59e535[_0x0138('0x22')]);_0x1c53cf[_0x0138('0x24')]();}else if(_0x494adb&&_0x494adb[_0x0138('0x22')]){_0x3d545f[_0x0138('0x17')][_0x0138('0x25')]=_0x494adb;_0x5808b9[_0x0138('0x17')]=_0x494adb[_0x0138('0x22')];_0x5808b9['providerName']=_0x0138('0x25');_0x5808b9[_0x0138('0x26')]=JSON[_0x0138('0x1a')](_0x494adb);return rpc[_0x233e1e+_0x0138('0x27')][_0x0138('0x28')](_0x5808b9)[_0x0138('0x29')](function(_0x16c233){logger[_0x0138('0x1c')](_0x0138('0x19'),_0x3fe196,_0x5808b9['body']);if(_0x494adb['dialogState']==_0x0138('0x2a')){_0x1c53cf[_0x0138('0x24')]();}else{_0x1c53cf[_0x0138('0x1e')]();}})[_0x0138('0x2b')](function(_0x5df518){logger[_0x0138('0x18')](_0x0138('0x19'),_0x3fe196,JSON[_0x0138('0x1a')](_0x5df518));_0x1c53cf[_0x0138('0x24')]();});}else{_0x1c53cf[_0x0138('0x24')]();}});}}catch(_0x1954d4){logger[_0x0138('0x18')](_0x0138('0x19'),_0x3fe196,JSON[_0x0138('0x1a')](_0x1954d4));_0x1c53cf[_0x0138('0x1e')]();}};}; \ No newline at end of file +var _0xa5d9=['out','channel','phone','chat','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','create','then','[%s][AMAZONLEX]\x20%s','catch','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','message','toString','postText','error','amazonlex','providerName','stringify','Failed','moment','aws-sdk','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x56a061,_0x53fb1b){var _0x105fa0=function(_0x164d08){while(--_0x164d08){_0x56a061['push'](_0x56a061['shift']());}};_0x105fa0(++_0x53fb1b);}(_0xa5d9,0x141));var _0x9a5d=function(_0x2d869b,_0xdfe855){_0x2d869b=_0x2d869b-0x0;var _0x33de7b=_0xa5d9[_0x2d869b];return _0x33de7b;};'use strict';var _=require('lodash');var moment=require(_0x9a5d('0x0'));var AWS=require(_0x9a5d('0x1'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x9a5d('0x2'));var rpc={'chatMessage':require(_0x9a5d('0x3')),'openchannelMessage':require(_0x9a5d('0x4')),'mailMessage':require(_0x9a5d('0x5')),'smsMessage':require(_0x9a5d('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x9a5d('0x7'))};exports['consequence']=function(_0x4cd1cc,_0x35f1fe){return function(_0x3fbb15){try{if(!_[_0x9a5d('0x8')](this[_0x9a5d('0x9')][_0x9a5d('0xa')])){logger[_0x9a5d('0xb')]('[%s][AMAZONLEX]\x20%s',_0x4cd1cc,_0x9a5d('0xc'));return _0x3fbb15[_0x9a5d('0xd')]();}var _0x258854={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0x9a5d('0xe')),'direction':_0x9a5d('0xf')};if(this[_0x9a5d('0x10')]==='sms'||this['channel']==='whatsapp'){_0x258854[_0x9a5d('0x11')]=this[_0x9a5d('0x9')][_0x9a5d('0x11')];}var _0x598b79=this['channel'];if(_0x598b79===_0x9a5d('0x12')){_0x258854['ChatWebsiteId']=this[_0x9a5d('0x13')]['id'];}else{_0x258854[_[_0x9a5d('0x14')](_0x598b79)+_0x9a5d('0x15')]=this['account']['id'];}_0x258854[_[_0x9a5d('0x14')](_0x598b79)+_0x9a5d('0x16')]=this['interaction']['id'];if(this[_0x9a5d('0x9')][_0x9a5d('0x17')]){var _0x2b723d=_0x35f1fe[0x4];if(!_[_0x9a5d('0x18')](_0x2b723d)){_0x258854[_0x9a5d('0x19')]=utils['getMustacheRender'](_0x2b723d,this);return rpc[_0x598b79+'Message'][_0x9a5d('0x1a')](_0x258854)[_0x9a5d('0x1b')](function(_0x231189){logger['info'](_0x9a5d('0x1c'),_0x4cd1cc,_0x258854['body']);})[_0x9a5d('0x1d')](function(_0x4dedbe){logger['error'](_0x9a5d('0x1c'),_0x4cd1cc,JSON['stringify'](_0x4dedbe));})['finally'](function(){logger['info'](_0x9a5d('0x1e'),_0x4cd1cc);_0x3fbb15[_0x9a5d('0x1f')]();});}else{logger[_0x9a5d('0xb')](_0x9a5d('0x20'),_0x4cd1cc);_0x3fbb15[_0x9a5d('0x1f')]();}}else{var _0x1ff35b=this;var _0xf39ce4=new AWS['LexRuntime']({'accessKeyId':_0x35f1fe[0x0],'secretAccessKey':_0x35f1fe[0x1],'region':_0x35f1fe[0x2]});var _0x3a8a7f={'botAlias':_0x9a5d('0x21'),'botName':_0x35f1fe[0x3],'inputText':this[_0x9a5d('0x22')][_0x9a5d('0x19')],'userId':this[_0x9a5d('0x10')]+':'+this[_0x9a5d('0x9')]['id'][_0x9a5d('0x23')]()};_0xf39ce4[_0x9a5d('0x24')](_0x3a8a7f,function(_0x7055ae,_0x2de25b){if(_0x7055ae){logger[_0x9a5d('0x25')](_0x9a5d('0x1c'),_0x4cd1cc,_0x7055ae['message']);_0x3fbb15[_0x9a5d('0xd')]();}else if(_0x2de25b&&_0x2de25b[_0x9a5d('0x22')]){_0x1ff35b[_0x9a5d('0x19')][_0x9a5d('0x26')]=_0x2de25b;_0x258854[_0x9a5d('0x19')]=_0x2de25b['message'];_0x258854[_0x9a5d('0x27')]='amazonlex';_0x258854['providerResponse']=JSON[_0x9a5d('0x28')](_0x2de25b);return rpc[_0x598b79+'Message']['create'](_0x258854)[_0x9a5d('0x1b')](function(_0x4465c5){logger[_0x9a5d('0xb')](_0x9a5d('0x1c'),_0x4cd1cc,_0x258854[_0x9a5d('0x19')]);if(_0x2de25b['dialogState']==_0x9a5d('0x29')){_0x3fbb15[_0x9a5d('0xd')]();}else{_0x3fbb15['stop']();}})['catch'](function(_0x180e32){logger[_0x9a5d('0x25')](_0x9a5d('0x1c'),_0x4cd1cc,JSON[_0x9a5d('0x28')](_0x180e32));_0x3fbb15[_0x9a5d('0xd')]();});}else{_0x3fbb15[_0x9a5d('0xd')]();}});}}catch(_0x2e28c8){logger[_0x9a5d('0x25')]('[%s][AMAZONLEX]\x20%s',_0x4cd1cc,JSON[_0x9a5d('0x28')](_0x2e28c8));_0x3fbb15['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 9f31be9..db88f04 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 _0xa643=['from','message','phone','read','subject','startsWith','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','inReplyTo','messageId','html','','replace','','headers','auto_reply','sendMailMessage','smtpOptions','then','Message','create','catch','[RPC][%s][AUTOREPLY]\x20%s','stringify','finally','error','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','resolve','update','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','interaction','info','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','mail','body','getMustacheRender'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa643,0xa9));var _0x3a64=function(_0x593ba6,_0x2b4aac){_0x593ba6=_0x593ba6-0x0;var _0x150292=_0xa643[_0x593ba6];return _0x150292;};'use strict';var _=require('lodash');var moment=require(_0x3a64('0x0'));var utils=require(_0x3a64('0x1'));var logger=require(_0x3a64('0x2'))('routing');var rpc={'chatMessage':require(_0x3a64('0x3')),'openchannelMessage':require(_0x3a64('0x4')),'mailMessage':require(_0x3a64('0x5')),'smsMessage':require(_0x3a64('0x6')),'faxMessage':require(_0x3a64('0x7')),'whatsappMessage':require(_0x3a64('0x8')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x3a64('0x9')),'mailInteraction':require(_0x3a64('0xa')),'smsInteraction':require(_0x3a64('0xb')),'faxInteraction':require(_0x3a64('0xc')),'whatsappInteraction':require(_0x3a64('0xd'))};var mailRpc=require(_0x3a64('0xe'));exports[_0x3a64('0xf')]=function(_0x30af25,_0x23f452,_0x3605fd,_0x25a1c1){return function(_0x41c22a){try{var _0x4f0ffc=this[_0x3a64('0x10')];if(_0x4f0ffc==='mail'&&_0x25a1c1['body']['isAutoreply']){logger['info'](_0x3a64('0x11'),_0x30af25,_0x3a64('0x12'));return _0x41c22a[_0x3a64('0x13')]();}if(_0x23f452[0x0]==='1'&&(_['isNil'](this[_0x3a64('0x14')]['created'])||!this[_0x3a64('0x14')]['created'])){logger[_0x3a64('0x15')]('[%s][AUTOREPLY]\x20%s',_0x30af25,_0x3a64('0x16'));return _0x41c22a[_0x3a64('0x13')]();}if(_0x23f452[0x0]==='2'&&this[_0x3a64('0x14')][_0x3a64('0x17')]){logger[_0x3a64('0x15')](_0x3a64('0x18'),_0x30af25,'One\x20Time\x20already\x20sent');return _0x41c22a['next']();}var _0x353e9d={'ContactId':this[_0x3a64('0x19')]['id'],'sentAt':moment()[_0x3a64('0x1a')](_0x3a64('0x1b')),'direction':_0x3a64('0x1c')};if(this['channel']===_0x3a64('0x1d')){_0x353e9d[_0x3a64('0x1e')]=utils['getMustacheRender'](_0x23f452[0x2],this);}else{_0x353e9d[_0x3a64('0x1e')]=utils[_0x3a64('0x1f')](_0x23f452[0x1],this);}if(this['message']){_0x353e9d['to']=this['message'][_0x3a64('0x20')]||'';if(this[_0x3a64('0x10')]==='mail'&&_0x23f452[0x1]==='1'){_0x353e9d['cc']=this[_0x3a64('0x21')]['cc']||'';}_0x353e9d[_0x3a64('0x20')]=this[_0x3a64('0x21')]['to']||'';_0x353e9d[_0x3a64('0x22')]=this[_0x3a64('0x21')][_0x3a64('0x22')]||'';_0x353e9d[_0x3a64('0x23')]=!![];if(this[_0x3a64('0x21')][_0x3a64('0x24')]){_0x353e9d[_0x3a64('0x24')]='';_0x353e9d[_0x3a64('0x24')]+=_[_0x3a64('0x25')](this['message'][_0x3a64('0x24')],'Re:')?'':_0x3a64('0x26');_0x353e9d['subject']+=this[_0x3a64('0x21')][_0x3a64('0x24')];}}if(this[_0x3a64('0x10')]===_0x3a64('0x27')){_0x353e9d[_0x3a64('0x28')]=this[_0x3a64('0x29')]['id'];}else{_0x353e9d[_[_0x3a64('0x2a')](this['channel'])+_0x3a64('0x2b')]=this[_0x3a64('0x29')]['id'];}_0x353e9d[_['upperFirst'](this[_0x3a64('0x10')])+_0x3a64('0x2c')]=this[_0x3a64('0x14')]['id'];var _0x2a3a2=this[_0x3a64('0x14')];if(rpc[this[_0x3a64('0x10')]+'Message']){if(this[_0x3a64('0x10')]==='mail'){_0x353e9d[_0x3a64('0x2d')]=this[_0x3a64('0x21')][_0x3a64('0x2e')];_0x353e9d[_0x3a64('0x2f')]=_0x3a64('0x30')+_[_0x3a64('0x31')](_0x353e9d[_0x3a64('0x1e')],_0x3a64('0x32'),'','replace','','headers','auto-replied','All','auto_reply','sendMailMessage','smtpOptions','then','messageId','create','stringify','catch','finally','resolve','Interaction','update','error','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','moment','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../mailRpc','channel','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','isNil'];(function(_0x1f727f,_0x1bf6b8){var _0x522928=function(_0x715eb6){while(--_0x715eb6){_0x1f727f['push'](_0x1f727f['shift']());}};_0x522928(++_0x1bf6b8);}(_0xe242,0x138));var _0x2e24=function(_0x277c98,_0x4b857b){_0x277c98=_0x277c98-0x0;var _0x20512c=_0xe242[_0x277c98];return _0x20512c;};'use strict';var _=require('lodash');var moment=require(_0x2e24('0x0'));var utils=require('./utils');var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0x2e24('0x1')),'openchannelMessage':require(_0x2e24('0x2')),'mailMessage':require(_0x2e24('0x3')),'smsMessage':require(_0x2e24('0x4')),'faxMessage':require(_0x2e24('0x5')),'whatsappMessage':require(_0x2e24('0x6')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x2e24('0x7')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require(_0x2e24('0x8')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0x2e24('0x9'));exports['consequence']=function(_0xb56b04,_0x25720c,_0x18f088,_0x44a5b3){return function(_0x344bc7){try{var _0x3bdfb4=this[_0x2e24('0xa')];if(_0x3bdfb4===_0x2e24('0xb')&&_0x44a5b3[_0x2e24('0xc')][_0x2e24('0xd')]){logger[_0x2e24('0xe')](_0x2e24('0xf'),_0xb56b04,_0x2e24('0x10'));return _0x344bc7['next']();}if(_0x25720c[0x0]==='1'&&(_[_0x2e24('0x11')](this[_0x2e24('0x12')][_0x2e24('0x13')])||!this['interaction'][_0x2e24('0x13')])){logger['info']('[%s][AUTOREPLY]\x20%s',_0xb56b04,_0x2e24('0x14'));return _0x344bc7[_0x2e24('0x15')]();}if(_0x25720c[0x0]==='2'&&this[_0x2e24('0x12')][_0x2e24('0x16')]){logger[_0x2e24('0xe')](_0x2e24('0x17'),_0xb56b04,_0x2e24('0x18'));return _0x344bc7[_0x2e24('0x15')]();}var _0x4a1df7={'ContactId':this[_0x2e24('0x19')]['id'],'sentAt':moment()[_0x2e24('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x2e24('0x1b')};if(this[_0x2e24('0xa')]===_0x2e24('0xb')){_0x4a1df7[_0x2e24('0xc')]=utils[_0x2e24('0x1c')](_0x25720c[0x2],this);}else{_0x4a1df7[_0x2e24('0xc')]=utils[_0x2e24('0x1c')](_0x25720c[0x1],this);}if(this[_0x2e24('0x1d')]){_0x4a1df7['to']=this[_0x2e24('0x1d')][_0x2e24('0x1e')]||'';if(this[_0x2e24('0xa')]===_0x2e24('0xb')&&_0x25720c[0x1]==='1'){_0x4a1df7['cc']=this[_0x2e24('0x1d')]['cc']||'';}_0x4a1df7[_0x2e24('0x1e')]=this[_0x2e24('0x1d')]['to']||'';_0x4a1df7[_0x2e24('0x1f')]=this['message'][_0x2e24('0x1f')]||'';_0x4a1df7[_0x2e24('0x20')]=!![];if(this[_0x2e24('0x1d')]['subject']){_0x4a1df7[_0x2e24('0x21')]='';_0x4a1df7[_0x2e24('0x21')]+=_[_0x2e24('0x22')](this[_0x2e24('0x1d')][_0x2e24('0x21')],'Re:')?'':_0x2e24('0x23');_0x4a1df7['subject']+=this[_0x2e24('0x1d')][_0x2e24('0x21')];}}if(this['channel']===_0x2e24('0x24')){_0x4a1df7['ChatWebsiteId']=this['account']['id'];}else{_0x4a1df7[_[_0x2e24('0x25')](this[_0x2e24('0xa')])+_0x2e24('0x26')]=this[_0x2e24('0x27')]['id'];}_0x4a1df7[_[_0x2e24('0x25')](this[_0x2e24('0xa')])+_0x2e24('0x28')]=this[_0x2e24('0x12')]['id'];var _0x587ef5=this[_0x2e24('0x12')];if(rpc[this[_0x2e24('0xa')]+_0x2e24('0x29')]){if(this['channel']===_0x2e24('0xb')){_0x4a1df7['inReplyTo']=this[_0x2e24('0x1d')]['messageId'];_0x4a1df7[_0x2e24('0x2a')]=_0x2e24('0x2b')+_[_0x2e24('0x2c')](_0x4a1df7[_0x2e24('0xc')],_0x2e24('0x2d'),_0x2e24('0x2e'))+_0x2e24('0x2f');_0x4a1df7[_0x2e24('0x30')]={'Auto-Submitted':_0x2e24('0x31'),'X-Auto-Response-Suppress':_0x2e24('0x32'),'Precedence':_0x2e24('0x33')};return mailRpc[_0x2e24('0x34')](this[_0x2e24('0x27')][_0x2e24('0x35')],_0x4a1df7)[_0x2e24('0x36')](function(_0x18631e){logger[_0x2e24('0xe')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0xb56b04);_0x4a1df7[_0x2e24('0x37')]=_0x18631e['message']['messageId'];return rpc[_0x3bdfb4+_0x2e24('0x29')][_0x2e24('0x38')](_0x4a1df7);})[_0x2e24('0x36')](function(_0x2c38b7){logger[_0x2e24('0xe')](_0x2e24('0xf'),_0xb56b04,JSON[_0x2e24('0x39')](_0x2c38b7));})[_0x2e24('0x3a')](function(_0x5bdfee){logger['error']('[RPC][%s][AUTOREPLY]\x20%s',_0xb56b04,JSON[_0x2e24('0x39')](_0x5bdfee));})[_0x2e24('0x3b')](function(){Promise[_0x2e24('0x3c')]()[_0x2e24('0x36')](function(){if(_0x25720c[0x0]!=='2'||_0x587ef5[_0x2e24('0x16')])return;return rpc[_0x3bdfb4+_0x2e24('0x3d')][_0x2e24('0x3e')](_0x587ef5['id'],{'autoreplyExecuted':!![]})[_0x2e24('0x36')](function(_0x1ea30b){logger[_0x2e24('0xe')](_0x2e24('0x17'),_0xb56b04,JSON[_0x2e24('0x39')](_0x1ea30b));})['catch'](function(_0x144ab5){logger[_0x2e24('0x3f')](_0x2e24('0x40'),_0xb56b04,JSON['stringify'](_0x144ab5));});})['then'](function(){_0x344bc7[_0x2e24('0x15')]();});});}else{return rpc[this[_0x2e24('0xa')]+_0x2e24('0x29')]['create'](_0x4a1df7)['then'](function(){logger[_0x2e24('0xe')]('[%s][AUTOREPLY]\x20%s',_0xb56b04,_0x4a1df7[_0x2e24('0xc')]);})[_0x2e24('0x3a')](function(_0xc3dfe6){logger[_0x2e24('0x3f')](_0x2e24('0xf'),_0xb56b04,JSON['stringify'](_0xc3dfe6));})[_0x2e24('0x3b')](function(){Promise[_0x2e24('0x3c')]()[_0x2e24('0x36')](function(){if(_0x25720c[0x0]!=='2'||_0x587ef5[_0x2e24('0x16')])return;return rpc[_0x3bdfb4+_0x2e24('0x3d')][_0x2e24('0x3e')](_0x587ef5['id'],{'autoreplyExecuted':!![]})['then'](function(_0x567f21){logger[_0x2e24('0xe')](_0x2e24('0x17'),_0xb56b04,JSON[_0x2e24('0x39')](_0x567f21));})['catch'](function(_0x486ed9){logger[_0x2e24('0x3f')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0xb56b04,JSON[_0x2e24('0x39')](_0x486ed9));});})[_0x2e24('0x36')](function(){_0x344bc7[_0x2e24('0x15')]();});});}}}catch(_0x399625){logger['error'](_0x2e24('0xf'),_0xb56b04,JSON['stringify'](_0x399625));_0x344bc7[_0x2e24('0x41')]();}};}; \ 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 0998679..67dc751 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 _0x6071=['channel','Interaction','update','interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','[%s][CLOSE]\x20%s','stringify','finally','stop','error','moment','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system'];(function(_0x5ede77,_0x1342ae){var _0x29906e=function(_0x14ef33){while(--_0x14ef33){_0x5ede77['push'](_0x5ede77['shift']());}};_0x29906e(++_0x1342ae);}(_0x6071,0xab));var _0x1607=function(_0x58cc77,_0x2fdaf4){_0x58cc77=_0x58cc77-0x0;var _0x27e091=_0x6071[_0x58cc77];return _0x27e091;};'use strict';var moment=require(_0x1607('0x0'));var logger=require('../../../../config/logger')(_0x1607('0x1'));var rpc={'chatInteraction':require(_0x1607('0x2')),'openchannelInteraction':require(_0x1607('0x3')),'smsInteraction':require(_0x1607('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x1607('0x5')),'whatsappInteraction':require(_0x1607('0x6'))};exports[_0x1607('0x7')]=function(_0x102c65,_0x331306,_0x1aec5e,_0xd24da8){return function(_0x5e6d2f){try{logger[_0x1607('0x8')](_0x1607('0x9'),_0x102c65,_0x331306[0x0]);var _0x53d923={'closed':0x1,'closedAt':moment()[_0x1607('0xa')](_0x1607('0xb')),'closeReason':_0x1607('0xc'),'disposition':_0x331306[0x0]};if(rpc[_0xd24da8[_0x1607('0xd')]+_0x1607('0xe')]){rpc[_0xd24da8[_0x1607('0xd')]+_0x1607('0xe')][_0x1607('0xf')](_0xd24da8[_0x1607('0x10')]['id'],_0x53d923)['then'](function(_0x42e60a){logger[_0x1607('0x8')](_0x1607('0x11'),_0x102c65,_0xd24da8[_0x1607('0x10')]['id']);})['catch'](function(_0xb27572){logger['error'](_0x1607('0x12'),_0x102c65,JSON[_0x1607('0x13')](_0xb27572));})[_0x1607('0x14')](function(){_0x5e6d2f[_0x1607('0x15')]();});}}catch(_0x2cd791){logger[_0x1607('0x16')](_0x1607('0x12'),_0x102c65,JSON[_0x1607('0x13')](_0x2cd791));_0x5e6d2f[_0x1607('0x15')]();}};}; \ No newline at end of file +var _0xa78a=['../../rpc/mailInteraction','../../rpc/faxInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','[%s][CLOSE]\x20%s','stringify','stop','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xa78a,0x16a));var _0xaa78=function(_0x4f0549,_0x2ab75c){_0x4f0549=_0x4f0549-0x0;var _0x352ad9=_0xa78a[_0x4f0549];return _0x352ad9;};'use strict';var moment=require(_0xaa78('0x0'));var logger=require(_0xaa78('0x1'))(_0xaa78('0x2'));var rpc={'chatInteraction':require(_0xaa78('0x3')),'openchannelInteraction':require(_0xaa78('0x4')),'smsInteraction':require(_0xaa78('0x5')),'mailInteraction':require(_0xaa78('0x6')),'faxInteraction':require(_0xaa78('0x7')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0xaa78('0x8')]=function(_0x36ecb9,_0x522123,_0x3deeb0,_0x4daff6){return function(_0x19ce33){try{logger[_0xaa78('0x9')](_0xaa78('0xa'),_0x36ecb9,_0x522123[0x0]);var _0x3a367d={'closed':0x1,'closedAt':moment()[_0xaa78('0xb')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0xaa78('0xc'),'disposition':_0x522123[0x0]};if(rpc[_0x4daff6[_0xaa78('0xd')]+'Interaction']){rpc[_0x4daff6[_0xaa78('0xd')]+_0xaa78('0xe')][_0xaa78('0xf')](_0x4daff6[_0xaa78('0x10')]['id'],_0x3a367d)[_0xaa78('0x11')](function(_0x4d3b57){logger['info'](_0xaa78('0x12'),_0x36ecb9,_0x4daff6[_0xaa78('0x10')]['id']);})['catch'](function(_0x732593){logger[_0xaa78('0x13')](_0xaa78('0x14'),_0x36ecb9,JSON[_0xaa78('0x15')](_0x732593));})['finally'](function(){_0x19ce33[_0xaa78('0x16')]();});}}catch(_0x5cb4cd){logger['error'](_0xaa78('0x14'),_0x36ecb9,JSON[_0xaa78('0x15')](_0x5cb4cd));_0x19ce33[_0xaa78('0x16')]();}};}; \ 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 f74eb05..097aec7 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 _0x9b8e=['consequence','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','interaction','chat','account','created','isEmpty','body','Message','create','then','catch','error','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','providerName','providerResponse','metadata','endConversation','next','lodash','apiai-promise','md5','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x9b8e,0x158));var _0xe9b8=function(_0x4e09c9,_0x13f6e0){_0x4e09c9=_0x4e09c9-0x0;var _0x6c9d4b=_0x9b8e[_0x4e09c9];return _0x6c9d4b;};'use strict';var _=require(_0xe9b8('0x0'));var moment=require('moment');var apiai=require(_0xe9b8('0x1'));var md5=require(_0xe9b8('0x2'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0xe9b8('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xe9b8('0x4')),'mailMessage':require(_0xe9b8('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xe9b8('0x6')),'whatsappMessage':require(_0xe9b8('0x7'))};exports[_0xe9b8('0x8')]=function(_0x260234,_0x4ae5fa){return function(_0x3b67fe){try{if(!_['isNil'](this['interaction'][_0xe9b8('0x9')])){logger[_0xe9b8('0xa')](_0xe9b8('0xb'),_0x260234,_0xe9b8('0xc'));return _0x3b67fe['next']();}var _0x5ead88={'ContactId':this['contact']['id'],'sentAt':moment()[_0xe9b8('0xd')](_0xe9b8('0xe')),'direction':_0xe9b8('0xf')};if(this[_0xe9b8('0x10')]===_0xe9b8('0x11')||this[_0xe9b8('0x10')]===_0xe9b8('0x12')){_0x5ead88[_0xe9b8('0x13')]=this[_0xe9b8('0x14')][_0xe9b8('0x13')];}var _0x3ecb54=this[_0xe9b8('0x10')];if(_0x3ecb54===_0xe9b8('0x15')){_0x5ead88['ChatWebsiteId']=this['account']['id'];}else{_0x5ead88[_['upperFirst'](_0x3ecb54)+'AccountId']=this[_0xe9b8('0x16')]['id'];}_0x5ead88[_['upperFirst'](_0x3ecb54)+'InteractionId']=this[_0xe9b8('0x14')]['id'];if(this[_0xe9b8('0x14')][_0xe9b8('0x17')]){var _0xdff91b=_0x4ae5fa[0x2];if(!_[_0xe9b8('0x18')](_0xdff91b)){_0x5ead88[_0xe9b8('0x19')]=utils['getMustacheRender'](_0xdff91b,this);return rpc[_0x3ecb54+_0xe9b8('0x1a')][_0xe9b8('0x1b')](_0x5ead88)[_0xe9b8('0x1c')](function(_0x3e8123){logger[_0xe9b8('0xa')](_0xe9b8('0xb'),_0x260234,_0x5ead88['body']);})[_0xe9b8('0x1d')](function(_0x4a3482){logger[_0xe9b8('0x1e')](_0xe9b8('0xb'),_0x260234,JSON[_0xe9b8('0x1f')](_0x4a3482));})['finally'](function(){logger[_0xe9b8('0xa')](_0xe9b8('0x20'),_0x260234);_0x3b67fe[_0xe9b8('0x21')]();});}else{logger[_0xe9b8('0xa')](_0xe9b8('0x22'),_0x260234);_0x3b67fe['stop']();}}else{var _0x362fb8=this;var _0x4839f7=apiai(_0x4ae5fa[0x0],{'language':_0x4ae5fa[0x1]||'en'});return _0x4839f7[_0xe9b8('0x23')](this[_0xe9b8('0x24')][_0xe9b8('0x19')],{'sessionId':md5(this[_0xe9b8('0x14')]['id'])})[_0xe9b8('0x1c')](function(_0x5c905c){_0x362fb8['body'][_0xe9b8('0x25')]=_0x5c905c;_0x5ead88[_0xe9b8('0x19')]=_0x5c905c[_0xe9b8('0x26')]['fulfillment']['speech'];_0x5ead88[_0xe9b8('0x27')]='dialogflow';_0x5ead88[_0xe9b8('0x28')]=JSON['stringify'](_0x5c905c);return rpc[_0x3ecb54+_0xe9b8('0x1a')][_0xe9b8('0x1b')](_0x5ead88)[_0xe9b8('0x1c')](function(_0x4f69d2){logger[_0xe9b8('0xa')]('[%s][DIALOGFLOW]\x20%s',_0x260234,_0x5ead88[_0xe9b8('0x19')]);if(_0x5c905c['result'][_0xe9b8('0x29')][_0xe9b8('0x2a')]){_0x3b67fe[_0xe9b8('0x2b')]();}else{_0x3b67fe[_0xe9b8('0x21')]();}})[_0xe9b8('0x1d')](function(_0xb878d1){logger[_0xe9b8('0x1e')](_0xe9b8('0xb'),_0x260234,JSON['stringify'](_0xb878d1));_0x3b67fe[_0xe9b8('0x2b')]();});})[_0xe9b8('0x1d')](function(_0x2b8fe5){logger[_0xe9b8('0x1e')](_0xe9b8('0xb'),_0x260234,_0x2b8fe5['message']);_0x3b67fe[_0xe9b8('0x2b')]();});}}catch(_0x31303){logger[_0xe9b8('0x1e')](_0xe9b8('0xb'),_0x260234,JSON[_0xe9b8('0x1f')](_0x31303));_0x3b67fe[_0xe9b8('0x21')]();}};}; \ No newline at end of file +var _0xf9d5=['fulfillment','providerName','providerResponse','create','metadata','endConversation','next','catch','moment','apiai-promise','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','upperFirst','AccountId','InteractionId','created','Message','then','body','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','message','dialogflow','result'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xf9d5,0x122));var _0x5f9d=function(_0xe6894,_0x25d3ef){_0xe6894=_0xe6894-0x0;var _0x2cb14f=_0xf9d5[_0xe6894];return _0x2cb14f;};'use strict';var _=require('lodash');var moment=require(_0x5f9d('0x0'));var apiai=require(_0x5f9d('0x1'));var md5=require('md5');var utils=require(_0x5f9d('0x2'));var logger=require(_0x5f9d('0x3'))(_0x5f9d('0x4'));var rpc={'chatMessage':require(_0x5f9d('0x5')),'openchannelMessage':require(_0x5f9d('0x6')),'mailMessage':require(_0x5f9d('0x7')),'smsMessage':require(_0x5f9d('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x5f9d('0x9'))};exports['consequence']=function(_0x24999e,_0x38fb6b){return function(_0x4fb9f7){try{if(!_[_0x5f9d('0xa')](this[_0x5f9d('0xb')][_0x5f9d('0xc')])){logger[_0x5f9d('0xd')](_0x5f9d('0xe'),_0x24999e,_0x5f9d('0xf'));return _0x4fb9f7['next']();}var _0x156129={'ContactId':this[_0x5f9d('0x10')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x5f9d('0x11')};if(this[_0x5f9d('0x12')]===_0x5f9d('0x13')||this['channel']===_0x5f9d('0x14')){_0x156129[_0x5f9d('0x15')]=this[_0x5f9d('0xb')][_0x5f9d('0x15')];}var _0x550655=this[_0x5f9d('0x12')];if(_0x550655===_0x5f9d('0x16')){_0x156129[_0x5f9d('0x17')]=this['account']['id'];}else{_0x156129[_[_0x5f9d('0x18')](_0x550655)+_0x5f9d('0x19')]=this['account']['id'];}_0x156129[_['upperFirst'](_0x550655)+_0x5f9d('0x1a')]=this[_0x5f9d('0xb')]['id'];if(this[_0x5f9d('0xb')][_0x5f9d('0x1b')]){var _0x3ffb29=_0x38fb6b[0x2];if(!_['isEmpty'](_0x3ffb29)){_0x156129['body']=utils['getMustacheRender'](_0x3ffb29,this);return rpc[_0x550655+_0x5f9d('0x1c')]['create'](_0x156129)[_0x5f9d('0x1d')](function(_0x48448e){logger[_0x5f9d('0xd')](_0x5f9d('0xe'),_0x24999e,_0x156129[_0x5f9d('0x1e')]);})['catch'](function(_0x42e2f9){logger[_0x5f9d('0x1f')](_0x5f9d('0xe'),_0x24999e,JSON[_0x5f9d('0x20')](_0x42e2f9));})[_0x5f9d('0x21')](function(){logger[_0x5f9d('0xd')](_0x5f9d('0x22'),_0x24999e);_0x4fb9f7[_0x5f9d('0x23')]();});}else{logger[_0x5f9d('0xd')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x24999e);_0x4fb9f7['stop']();}}else{var _0x5465b1=this;var _0x1bc76b=apiai(_0x38fb6b[0x0],{'language':_0x38fb6b[0x1]||'en'});return _0x1bc76b['textRequest'](this[_0x5f9d('0x24')]['body'],{'sessionId':md5(this[_0x5f9d('0xb')]['id'])})['then'](function(_0x4875c5){_0x5465b1['body'][_0x5f9d('0x25')]=_0x4875c5;_0x156129[_0x5f9d('0x1e')]=_0x4875c5[_0x5f9d('0x26')][_0x5f9d('0x27')]['speech'];_0x156129[_0x5f9d('0x28')]=_0x5f9d('0x25');_0x156129[_0x5f9d('0x29')]=JSON[_0x5f9d('0x20')](_0x4875c5);return rpc[_0x550655+_0x5f9d('0x1c')][_0x5f9d('0x2a')](_0x156129)[_0x5f9d('0x1d')](function(_0x21cc63){logger[_0x5f9d('0xd')](_0x5f9d('0xe'),_0x24999e,_0x156129['body']);if(_0x4875c5[_0x5f9d('0x26')][_0x5f9d('0x2b')][_0x5f9d('0x2c')]){_0x4fb9f7[_0x5f9d('0x2d')]();}else{_0x4fb9f7[_0x5f9d('0x23')]();}})[_0x5f9d('0x2e')](function(_0x38b10d){logger[_0x5f9d('0x1f')](_0x5f9d('0xe'),_0x24999e,JSON['stringify'](_0x38b10d));_0x4fb9f7['next']();});})['catch'](function(_0x118f77){logger['error'](_0x5f9d('0xe'),_0x24999e,_0x118f77['message']);_0x4fb9f7[_0x5f9d('0x2d')]();});}}catch(_0x5388a3){logger[_0x5f9d('0x1f')](_0x5f9d('0xe'),_0x24999e,JSON[_0x5f9d('0x20')](_0x5388a3));_0x4fb9f7[_0x5f9d('0x23')]();}};}; \ 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 4a90cf0..58fbb72 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 _0x1312=['upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender','catch','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','detectIntent','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','providerResponse','length','fulfillmentText','push','error','stack','lodash','dialogflow','moment','bluebird','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','Message','create','then','[%s][DIALOGFLOWV2]\x20%s','body','stringify','consequence','isNil','interaction','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','channel','phone','chat','ChatWebsiteId','account'];(function(_0x1f43df,_0x123f85){var _0x35475d=function(_0x25a530){while(--_0x25a530){_0x1f43df['push'](_0x1f43df['shift']());}};_0x35475d(++_0x123f85);}(_0x1312,0x6b));var _0x2131=function(_0x4cdf87,_0x200caf){_0x4cdf87=_0x4cdf87-0x0;var _0x14d49d=_0x1312[_0x4cdf87];return _0x14d49d;};'use strict';var _=require(_0x2131('0x0'));var dialogflow=require(_0x2131('0x1'));var md5=require('md5');var moment=require(_0x2131('0x2'));var Promise=require(_0x2131('0x3'));var logger=require('../../../../config/logger')(_0x2131('0x4'));var utils=require('./utils');var rpc={'chatMessage':require(_0x2131('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x2131('0x6')),'smsMessage':require(_0x2131('0x7')),'faxMessage':require(_0x2131('0x8')),'whatsappMessage':require(_0x2131('0x9'))};function createMessage(_0x2519ca,_0x2f886d,_0xb7e7d2,_0x484dab){return new Promise(function(_0x4e5435,_0x589ed5){var _0x221b4b=_[_0x2131('0xa')](_0xb7e7d2);_0x221b4b['body']=_0x484dab;return rpc[_0x2f886d+_0x2131('0xb')][_0x2131('0xc')](_0x221b4b)[_0x2131('0xd')](function(){logger['info'](_0x2131('0xe'),_0x2519ca,_0x221b4b[_0x2131('0xf')]);_0x4e5435();})['catch'](function(_0x3a2758){logger['error'](_0x2131('0xe'),_0x2519ca,JSON[_0x2131('0x10')](_0x3a2758));_0x589ed5(_0x3a2758);});});}exports[_0x2131('0x11')]=function(_0x559a12,_0x53f745){return function(_0xcbd51d){try{if(!_[_0x2131('0x12')](this[_0x2131('0x13')]['UserId'])){logger[_0x2131('0x14')](_0x2131('0xe'),_0x559a12,_0x2131('0x15'));return _0xcbd51d[_0x2131('0x16')]();}var _0x5646b6={'ContactId':this[_0x2131('0x17')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0x2131('0x18')]==='sms'||this[_0x2131('0x18')]==='whatsapp'){_0x5646b6[_0x2131('0x19')]=this[_0x2131('0x13')][_0x2131('0x19')];}var _0x412b43=this['channel'];if(_0x412b43===_0x2131('0x1a')){_0x5646b6[_0x2131('0x1b')]=this[_0x2131('0x1c')]['id'];}else{_0x5646b6[_[_0x2131('0x1d')](_0x412b43)+_0x2131('0x1e')]=this[_0x2131('0x1c')]['id'];}_0x5646b6[_[_0x2131('0x1d')](_0x412b43)+_0x2131('0x1f')]=this[_0x2131('0x13')]['id'];if(this[_0x2131('0x13')][_0x2131('0x20')]){var _0x4e6cb7=_0x53f745[0x4];if(!_[_0x2131('0x21')](_0x4e6cb7)){_0x5646b6[_0x2131('0xf')]=utils[_0x2131('0x22')](_0x4e6cb7,this);return rpc[_0x412b43+_0x2131('0xb')]['create'](_0x5646b6)[_0x2131('0xd')](function(_0x7e322){logger[_0x2131('0x14')]('[%s][DIALOGFLOWV2]\x20%s',_0x559a12,_0x5646b6[_0x2131('0xf')]);})[_0x2131('0x23')](function(_0x5e398a){logger['error'](_0x2131('0xe'),_0x559a12,JSON['stringify'](_0x5e398a));})['finally'](function(){logger[_0x2131('0x14')](_0x2131('0x24'),_0x559a12);_0xcbd51d[_0x2131('0x25')]();});}else{logger[_0x2131('0x14')](_0x2131('0x26'),_0x559a12);_0xcbd51d[_0x2131('0x25')]();}}else{var _0x514683=this;var _0x1d310e=_0x53f745[0x2]['replace'](/\\n/g,'\x0a');var _0x32bdc3={'credentials':{'private_key':_0x1d310e,'client_email':_0x53f745[0x1]}};var _0x138efc=new dialogflow['SessionsClient'](_0x32bdc3);var _0x4d6b03=_0x138efc['sessionPath'](_0x53f745[0x0],md5(_0x514683[_0x2131('0x13')]['id']));var _0x61c7cc={'session':_0x4d6b03,'queryInput':{'text':{'text':_0x514683[_0x2131('0x27')]['body'],'languageCode':_0x53f745[0x3]||'en'}}};return _0x138efc[_0x2131('0x28')](_0x61c7cc)[_0x2131('0xd')](function(_0x470735){if(_0x470735&&_0x470735['length']){_0x514683['body'][_0x2131('0x29')]=_0x470735;var _0x38d4ec=_0x470735[0x0];var _0x303efd=_0x38d4ec[_0x2131('0x2a')][_0x2131('0x2b')]&&_0x38d4ec[_0x2131('0x2a')][_0x2131('0x2b')][_0x2131('0x2c')]?_0x38d4ec[_0x2131('0x2a')][_0x2131('0x2b')][_0x2131('0x2c')][_0x2131('0x2d')][_0x2131('0x2e')]:![];_0x514683['body'][_0x2131('0x2f')]=_0x38d4ec['queryResult']['action'];_0x514683['body'][_0x2131('0x30')]=_0x38d4ec[_0x2131('0x2a')][_0x2131('0x31')];_0x514683['body'][_0x2131('0x32')]=_0x38d4ec['queryResult']['diagnosticInfo']&&_0x38d4ec['queryResult'][_0x2131('0x2b')][_0x2131('0x2c')]?_0x38d4ec[_0x2131('0x2a')][_0x2131('0x2b')][_0x2131('0x2c')][_0x2131('0x2d')][_0x2131('0x2e')]:![];_0x514683['body']['DIALOGFLOWV2_INTENTNAME']=_0x38d4ec['queryResult'][_0x2131('0x33')][_0x2131('0x34')];_0x514683[_0x2131('0xf')][_0x2131('0x35')]=_0x38d4ec[_0x2131('0x2a')][_0x2131('0x33')][_0x2131('0x36')];_0x514683['body'][_0x2131('0x37')]=_0x38d4ec['queryResult']['intent'][_0x2131('0x38')];_0x514683[_0x2131('0xf')][_0x2131('0x39')]=_0x38d4ec[_0x2131('0x2a')][_0x2131('0x3a')];_0x514683[_0x2131('0xf')][_0x2131('0x3b')]=_0x38d4ec['queryResult'][_0x2131('0x3c')];_0x514683[_0x2131('0xf')][_0x2131('0x3d')]=_0x38d4ec[_0x2131('0x2a')]['intentDetectionConfidence'];_0x5646b6['providerName']=_0x2131('0x29');_0x5646b6[_0x2131('0x3e')]=JSON['stringify'](_0x470735);var _0xe80a7d=[];for(var _0x5f0aa4=0x0;_0x5f0aa4<_0x470735[_0x2131('0x3f')];_0x5f0aa4++){var _0x597857=_0x470735[_0x5f0aa4];if(_0x597857&&_0x597857[_0x2131('0x2a')]&&_0x597857[_0x2131('0x2a')][_0x2131('0x40')]){_0xe80a7d[_0x2131('0x41')](createMessage(_0x559a12,_0x412b43,_0x5646b6,_0x597857[_0x2131('0x2a')]['fulfillmentText']));}}return Promise['all'](_0xe80a7d)[_0x2131('0xd')](function(){if(_0x303efd){_0xcbd51d[_0x2131('0x16')]();}else{_0xcbd51d['stop']();}})[_0x2131('0x23')](function(_0x10cb66){logger[_0x2131('0x42')](_0x2131('0xe'),_0x559a12,JSON[_0x2131('0x10')](_0x10cb66));_0xcbd51d[_0x2131('0x16')]();});}})[_0x2131('0x23')](function(_0x4b0e6a){logger['error'](_0x2131('0xe'),_0x559a12,_0x4b0e6a[_0x2131('0x27')],_0x4b0e6a[_0x2131('0x43')]);_0xcbd51d[_0x2131('0x16')]();});}}catch(_0x59f32b){logger[_0x2131('0x42')](_0x2131('0xe'),_0x559a12,JSON[_0x2131('0x10')](_0x59f32b));_0xcbd51d[_0x2131('0x25')]();}};}; \ No newline at end of file +var _0x08ae=['upperFirst','isEmpty','then','catch','error','finally','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','message','detectIntent','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','length','fulfillmentText','push','all','next','stack','lodash','dialogflow','md5','bluebird','routing','./utils','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','create','info','body','[%s][DIALOGFLOWV2]\x20%s','stringify','consequence','isNil','interaction','UserId','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','account'];(function(_0xf2436c,_0x29c73a){var _0x572a5a=function(_0xaa6536){while(--_0xaa6536){_0xf2436c['push'](_0xf2436c['shift']());}};_0x572a5a(++_0x29c73a);}(_0x08ae,0x71));var _0xe08a=function(_0x55fac,_0x31b254){_0x55fac=_0x55fac-0x0;var _0x22909e=_0x08ae[_0x55fac];return _0x22909e;};'use strict';var _=require(_0xe08a('0x0'));var dialogflow=require(_0xe08a('0x1'));var md5=require(_0xe08a('0x2'));var moment=require('moment');var Promise=require(_0xe08a('0x3'));var logger=require('../../../../config/logger')(_0xe08a('0x4'));var utils=require(_0xe08a('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xe08a('0x6')),'mailMessage':require(_0xe08a('0x7')),'smsMessage':require(_0xe08a('0x8')),'faxMessage':require(_0xe08a('0x9')),'whatsappMessage':require(_0xe08a('0xa'))};function createMessage(_0x133b71,_0x4663d2,_0x1bf80a,_0x58dd6d){return new Promise(function(_0x40cd7c,_0x342d77){var _0x10d7fe=_[_0xe08a('0xb')](_0x1bf80a);_0x10d7fe['body']=_0x58dd6d;return rpc[_0x4663d2+'Message'][_0xe08a('0xc')](_0x10d7fe)['then'](function(){logger[_0xe08a('0xd')]('[%s][DIALOGFLOWV2]\x20%s',_0x133b71,_0x10d7fe[_0xe08a('0xe')]);_0x40cd7c();})['catch'](function(_0xe2f90){logger['error'](_0xe08a('0xf'),_0x133b71,JSON[_0xe08a('0x10')](_0xe2f90));_0x342d77(_0xe2f90);});});}exports[_0xe08a('0x11')]=function(_0x3335b9,_0x38b61d){return function(_0x1a2fc2){try{if(!_[_0xe08a('0x12')](this[_0xe08a('0x13')][_0xe08a('0x14')])){logger['info'](_0xe08a('0xf'),_0x3335b9,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x1a2fc2['next']();}var _0x50b682={'ContactId':this[_0xe08a('0x15')]['id'],'sentAt':moment()['format'](_0xe08a('0x16')),'direction':_0xe08a('0x17')};if(this[_0xe08a('0x18')]===_0xe08a('0x19')||this[_0xe08a('0x18')]===_0xe08a('0x1a')){_0x50b682['phone']=this[_0xe08a('0x13')][_0xe08a('0x1b')];}var _0x68739c=this['channel'];if(_0x68739c==='chat'){_0x50b682['ChatWebsiteId']=this[_0xe08a('0x1c')]['id'];}else{_0x50b682[_[_0xe08a('0x1d')](_0x68739c)+'AccountId']=this['account']['id'];}_0x50b682[_[_0xe08a('0x1d')](_0x68739c)+'InteractionId']=this[_0xe08a('0x13')]['id'];if(this[_0xe08a('0x13')]['created']){var _0x469632=_0x38b61d[0x4];if(!_[_0xe08a('0x1e')](_0x469632)){_0x50b682[_0xe08a('0xe')]=utils['getMustacheRender'](_0x469632,this);return rpc[_0x68739c+'Message'][_0xe08a('0xc')](_0x50b682)[_0xe08a('0x1f')](function(_0x27b0f4){logger[_0xe08a('0xd')](_0xe08a('0xf'),_0x3335b9,_0x50b682[_0xe08a('0xe')]);})[_0xe08a('0x20')](function(_0x1f5642){logger[_0xe08a('0x21')](_0xe08a('0xf'),_0x3335b9,JSON['stringify'](_0x1f5642));})[_0xe08a('0x22')](function(){logger['info']('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x3335b9);_0x1a2fc2[_0xe08a('0x23')]();});}else{logger[_0xe08a('0xd')](_0xe08a('0x24'),_0x3335b9);_0x1a2fc2['stop']();}}else{var _0x4742e5=this;var _0x400e72=_0x38b61d[0x2][_0xe08a('0x25')](/\\n/g,'\x0a');var _0x4427da={'credentials':{'private_key':_0x400e72,'client_email':_0x38b61d[0x1]}};var _0x30d823=new dialogflow[(_0xe08a('0x26'))](_0x4427da);var _0x272466=_0x30d823['sessionPath'](_0x38b61d[0x0],md5(_0x4742e5[_0xe08a('0x13')]['id']));var _0x2340db={'session':_0x272466,'queryInput':{'text':{'text':_0x4742e5[_0xe08a('0x27')][_0xe08a('0xe')],'languageCode':_0x38b61d[0x3]||'en'}}};return _0x30d823[_0xe08a('0x28')](_0x2340db)['then'](function(_0x3d1afe){if(_0x3d1afe&&_0x3d1afe['length']){_0x4742e5['body'][_0xe08a('0x29')]=_0x3d1afe;var _0x14e3b5=_0x3d1afe[0x0];var _0x2a41db=_0x14e3b5[_0xe08a('0x2a')][_0xe08a('0x2b')]&&_0x14e3b5[_0xe08a('0x2a')]['diagnosticInfo'][_0xe08a('0x2c')]?_0x14e3b5[_0xe08a('0x2a')][_0xe08a('0x2b')]['fields'][_0xe08a('0x2d')][_0xe08a('0x2e')]:![];_0x4742e5[_0xe08a('0xe')][_0xe08a('0x2f')]=_0x14e3b5[_0xe08a('0x2a')][_0xe08a('0x30')];_0x4742e5[_0xe08a('0xe')][_0xe08a('0x31')]=_0x14e3b5['queryResult'][_0xe08a('0x32')];_0x4742e5['body'][_0xe08a('0x33')]=_0x14e3b5[_0xe08a('0x2a')][_0xe08a('0x2b')]&&_0x14e3b5[_0xe08a('0x2a')][_0xe08a('0x2b')][_0xe08a('0x2c')]?_0x14e3b5[_0xe08a('0x2a')]['diagnosticInfo'][_0xe08a('0x2c')][_0xe08a('0x2d')]['boolValue']:![];_0x4742e5[_0xe08a('0xe')][_0xe08a('0x34')]=_0x14e3b5[_0xe08a('0x2a')][_0xe08a('0x35')][_0xe08a('0x36')];_0x4742e5[_0xe08a('0xe')][_0xe08a('0x37')]=_0x14e3b5[_0xe08a('0x2a')][_0xe08a('0x35')][_0xe08a('0x38')];_0x4742e5[_0xe08a('0xe')][_0xe08a('0x39')]=_0x14e3b5[_0xe08a('0x2a')][_0xe08a('0x35')]['isFallback'];_0x4742e5[_0xe08a('0xe')][_0xe08a('0x3a')]=_0x14e3b5[_0xe08a('0x2a')]['languageCode'];_0x4742e5['body'][_0xe08a('0x3b')]=_0x14e3b5[_0xe08a('0x2a')][_0xe08a('0x3c')];_0x4742e5['body'][_0xe08a('0x3d')]=_0x14e3b5[_0xe08a('0x2a')][_0xe08a('0x3e')];_0x50b682[_0xe08a('0x3f')]=_0xe08a('0x29');_0x50b682[_0xe08a('0x40')]=JSON['stringify'](_0x3d1afe);var _0x4ce917=[];for(var _0x55d418=0x0;_0x55d418<_0x3d1afe[_0xe08a('0x41')];_0x55d418++){var _0x239270=_0x3d1afe[_0x55d418];if(_0x239270&&_0x239270[_0xe08a('0x2a')]&&_0x239270['queryResult'][_0xe08a('0x42')]){_0x4ce917[_0xe08a('0x43')](createMessage(_0x3335b9,_0x68739c,_0x50b682,_0x239270[_0xe08a('0x2a')][_0xe08a('0x42')]));}}return Promise[_0xe08a('0x44')](_0x4ce917)[_0xe08a('0x1f')](function(){if(_0x2a41db){_0x1a2fc2[_0xe08a('0x45')]();}else{_0x1a2fc2['stop']();}})['catch'](function(_0x49e0e2){logger[_0xe08a('0x21')](_0xe08a('0xf'),_0x3335b9,JSON[_0xe08a('0x10')](_0x49e0e2));_0x1a2fc2[_0xe08a('0x45')]();});}})[_0xe08a('0x20')](function(_0x33917b){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x3335b9,_0x33917b['message'],_0x33917b[_0xe08a('0x46')]);_0x1a2fc2[_0xe08a('0x45')]();});}}catch(_0x465924){logger[_0xe08a('0x21')](_0xe08a('0xf'),_0x3335b9,JSON['stringify'](_0x465924));_0x1a2fc2[_0xe08a('0x23')]();}};}; \ 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 1669830..4de5908 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 _0x14a6=['consequence','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join','condition','priorityTrue','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','number'];(function(_0x503ea4,_0x144197){var _0x24f36f=function(_0x3cf297){while(--_0x3cf297){_0x503ea4['push'](_0x503ea4['shift']());}};_0x24f36f(++_0x144197);}(_0x14a6,0x124));var _0x614a=function(_0x308408,_0x37d440){_0x308408=_0x308408-0x0;var _0x9dc073=_0x14a6[_0x308408];return _0x9dc073;};'use strict';var schema=require(_0x614a('0x0'));var _=require(_0x614a('0x1'));var htmlToText=require(_0x614a('0x2'));var utils=require(_0x614a('0x3'));var logger=require(_0x614a('0x4'))(_0x614a('0x5'));var gotoif=schema({'condition':{'type':_0x614a('0x6'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x614a('0x7'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':'number','message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x614a('0x8')]=function(_0x2f4b3c,_0x3fa5c5){return function(_0x14233a){try{var _0x5a065b={'condition':htmlToText[_0x614a('0x9')](utils[_0x614a('0xa')](_0x3fa5c5[0x0],this),{'wordwrap':![]})[_0x614a('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x3fa5c5[0x1],'priorityFalse':_0x3fa5c5[0x2]};var _0x26edd1=gotoif[_0x614a('0x0')](_0x5a065b,{'typecast':!![]});if(_0x26edd1[_0x614a('0xc')]){logger[_0x614a('0xd')](_0x614a('0xe'),_0x2f4b3c,_[_0x614a('0xf')](_0x26edd1,_0x614a('0x10'))[_0x614a('0x11')](',\x20'));_0x14233a['stop']();}else{try{var _0x4eeb62=eval('('+_0x5a065b[_0x614a('0x12')]+')');var _0x1eb021=_0x4eeb62?_0x5a065b[_0x614a('0x13')]:_0x5a065b['priorityFalse'];logger[_0x614a('0x14')](_0x614a('0x15'),_0x2f4b3c,_0x5a065b[_0x614a('0x12')],_0x4eeb62,_0x1eb021||_0x614a('0x16'));if(_0x1eb021){var _0x430eb3=_[_0x614a('0x17')](_0x14233a[_0x614a('0x18')](),{'p':_0x1eb021});if(_0x430eb3>=0x0){logger[_0x614a('0x14')](_0x614a('0x19'),_0x2f4b3c,_0x1eb021||_0x614a('0x16'),_0x430eb3);_0x14233a[_0x614a('0x16')](_0x430eb3);}else{logger[_0x614a('0x14')](_0x614a('0x1a'),_0x2f4b3c,_0x1eb021||_0x614a('0x16'));_0x14233a[_0x614a('0x1b')]();}}else{_0x14233a[_0x614a('0x16')]();}}catch(_0x12e8fd){logger[_0x614a('0xd')](_0x614a('0x1c'),_0x2f4b3c,_0x12e8fd[_0x614a('0x10')]);_0x14233a[_0x614a('0x1b')]();}}}catch(_0x82b28b){logger['error']('[%s][GOTOIF]\x20%s',_0x2f4b3c,JSON[_0x614a('0x1d')](_0x82b28b));_0x14233a[_0x614a('0x1b')]();}};}; \ No newline at end of file +var _0x9c6d=['info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20eval\x20error:\x20%s','error','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','fromString','getMustacheRender','replace','length','[%s][GOTOIF]\x20%s','message','stop','condition','priorityTrue','priorityFalse'];(function(_0x4e4810,_0x441d17){var _0xbd0d9d=function(_0x32a743){while(--_0x32a743){_0x4e4810['push'](_0x4e4810['shift']());}};_0xbd0d9d(++_0x441d17);}(_0x9c6d,0x164));var _0xd9c6=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9c6d[_0x2641f9];return _0x585741;};'use strict';var schema=require(_0xd9c6('0x0'));var _=require(_0xd9c6('0x1'));var htmlToText=require(_0xd9c6('0x2'));var utils=require(_0xd9c6('0x3'));var logger=require(_0xd9c6('0x4'))(_0xd9c6('0x5'));var gotoif=schema({'condition':{'type':_0xd9c6('0x6'),'required':!![],'message':_0xd9c6('0x7')},'priorityTrue':{'type':_0xd9c6('0x8'),'message':_0xd9c6('0x9')},'priorityFalse':{'type':_0xd9c6('0x8'),'message':_0xd9c6('0xa')}});exports['consequence']=function(_0x2ab0d6,_0x552366){return function(_0x373a27){try{var _0x4fd869={'condition':htmlToText[_0xd9c6('0xb')](utils[_0xd9c6('0xc')](_0x552366[0x0],this),{'wordwrap':![]})[_0xd9c6('0xd')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x552366[0x1],'priorityFalse':_0x552366[0x2]};var _0xb268c5=gotoif[_0xd9c6('0x0')](_0x4fd869,{'typecast':!![]});if(_0xb268c5[_0xd9c6('0xe')]){logger['error'](_0xd9c6('0xf'),_0x2ab0d6,_['map'](_0xb268c5,_0xd9c6('0x10'))['join'](',\x20'));_0x373a27[_0xd9c6('0x11')]();}else{try{var _0x143d2f=eval('('+_0x4fd869[_0xd9c6('0x12')]+')');var _0x5ca9c4=_0x143d2f?_0x4fd869[_0xd9c6('0x13')]:_0x4fd869[_0xd9c6('0x14')];logger[_0xd9c6('0x15')](_0xd9c6('0x16'),_0x2ab0d6,_0x4fd869[_0xd9c6('0x12')],_0x143d2f,_0x5ca9c4||_0xd9c6('0x17'));if(_0x5ca9c4){var _0xab2acb=_[_0xd9c6('0x18')](_0x373a27[_0xd9c6('0x19')](),{'p':_0x5ca9c4});if(_0xab2acb>=0x0){logger[_0xd9c6('0x15')](_0xd9c6('0x1a'),_0x2ab0d6,_0x5ca9c4||_0xd9c6('0x17'),_0xab2acb);_0x373a27[_0xd9c6('0x17')](_0xab2acb);}else{logger[_0xd9c6('0x15')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x2ab0d6,_0x5ca9c4||_0xd9c6('0x17'));_0x373a27['stop']();}}else{_0x373a27[_0xd9c6('0x17')]();}}catch(_0xa5945e){logger['error'](_0xd9c6('0x1b'),_0x2ab0d6,_0xa5945e[_0xd9c6('0x10')]);_0x373a27[_0xd9c6('0x11')]();}}}catch(_0x194d86){logger[_0xd9c6('0x1c')](_0xd9c6('0xf'),_0x2ab0d6,JSON['stringify'](_0x194d86));_0x373a27[_0xd9c6('0x11')]();}};}; \ 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 d3d7148..7873319 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 _0x7d81=['message','join','stop','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate','lodash','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','[%s][GOTOP]\x20%s','map'];(function(_0x138c15,_0x357fff){var _0x50a854=function(_0x38f423){while(--_0x38f423){_0x138c15['push'](_0x138c15['shift']());}};_0x50a854(++_0x357fff);}(_0x7d81,0x77));var _0x17d8=function(_0x59cf14,_0x3ba23e){_0x59cf14=_0x59cf14-0x0;var _0x2e62cb=_0x7d81[_0x59cf14];return _0x2e62cb;};'use strict';var schema=require(_0x17d8('0x0'));var _=require(_0x17d8('0x1'));var logger=require('../../../../config/logger')(_0x17d8('0x2'));var gotop=schema({'priority':{'type':_0x17d8('0x3'),'required':!![],'message':_0x17d8('0x4')}});exports['consequence']=function(_0xf9a026,_0x2520d8){return function(_0x102c86){try{var _0x4735b2={'priority':_0x2520d8[0x0]};var _0x213593=gotop[_0x17d8('0x0')](_0x4735b2,{'typecast':!![]});if(_0x213593['length']){logger['error'](_0x17d8('0x5'),_0xf9a026,_[_0x17d8('0x6')](_0x213593,_0x17d8('0x7'))[_0x17d8('0x8')](',\x20'));_0x102c86[_0x17d8('0x9')]();}else{logger['info'](_0x17d8('0xa'),_0xf9a026,_0x4735b2[_0x17d8('0xb')]);if(_0x4735b2[_0x17d8('0xb')]){var _0x4afee8=_[_0x17d8('0xc')](_0x102c86[_0x17d8('0xd')](),{'p':_0x4735b2[_0x17d8('0xb')]});if(_0x4afee8>=0x0){logger[_0x17d8('0xe')](_0x17d8('0xf'),_0xf9a026,_0x4735b2[_0x17d8('0xb')]||_0x17d8('0x10'),_0x4afee8);_0x102c86[_0x17d8('0x10')](_0x4afee8);}else{logger[_0x17d8('0xe')](_0x17d8('0x11'),_0xf9a026,_0x4735b2[_0x17d8('0xb')]||_0x17d8('0x10'));_0x102c86['stop']();}}else{_0x102c86['next']();}}}catch(_0x31b000){logger['error'](_0x17d8('0x5'),_0xf9a026,JSON['stringify'](_0x31b000));_0x102c86['stop']();}};}; \ No newline at end of file +var _0xbc50=['info','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','[%s][GOTOP]\x20%s','stringify','validate','lodash','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error','map','message','stop','priority','findIndex','rules'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0xbc50,0x95));var _0x0bc5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc50[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0x0bc5('0x0'));var _=require(_0x0bc5('0x1'));var logger=require('../../../../config/logger')(_0x0bc5('0x2'));var gotop=schema({'priority':{'type':_0x0bc5('0x3'),'required':!![],'message':_0x0bc5('0x4')}});exports['consequence']=function(_0x4d768c,_0x390724){return function(_0x225d29){try{var _0x4ccb8d={'priority':_0x390724[0x0]};var _0x293718=gotop[_0x0bc5('0x0')](_0x4ccb8d,{'typecast':!![]});if(_0x293718[_0x0bc5('0x5')]){logger[_0x0bc5('0x6')]('[%s][GOTOP]\x20%s',_0x4d768c,_[_0x0bc5('0x7')](_0x293718,_0x0bc5('0x8'))['join'](',\x20'));_0x225d29[_0x0bc5('0x9')]();}else{logger['info']('[%s][GOTOP]\x20priority\x20%s',_0x4d768c,_0x4ccb8d[_0x0bc5('0xa')]);if(_0x4ccb8d['priority']){var _0x34f4c9=_[_0x0bc5('0xb')](_0x225d29[_0x0bc5('0xc')](),{'p':_0x4ccb8d[_0x0bc5('0xa')]});if(_0x34f4c9>=0x0){logger[_0x0bc5('0xd')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x4d768c,_0x4ccb8d[_0x0bc5('0xa')]||_0x0bc5('0xe'),_0x34f4c9);_0x225d29['next'](_0x34f4c9);}else{logger[_0x0bc5('0xd')](_0x0bc5('0xf'),_0x4d768c,_0x4ccb8d[_0x0bc5('0xa')]||'next');_0x225d29[_0x0bc5('0x9')]();}}else{_0x225d29[_0x0bc5('0xe')]();}}}catch(_0xe4cf1e){logger[_0x0bc5('0x6')](_0x0bc5('0x10'),_0x4d768c,JSON[_0x0bc5('0x11')](_0xe4cf1e));_0x225d29['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 9977542..3e8a5e1 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 _0x8262=['info','[%s][MESSAGE]\x20%s','body','catch','stringify','stop','error','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','getMustacheRender','contact','channel','chat','ChatWebsiteId','upperFirst','AccountId','InteractionId','interaction','Message','then'];(function(_0x46383b,_0x5b398c){var _0x5b1a50=function(_0x268e47){while(--_0x268e47){_0x46383b['push'](_0x46383b['shift']());}};_0x5b1a50(++_0x5b398c);}(_0x8262,0x9d));var _0x2826=function(_0x2befdd,_0x318672){_0x2befdd=_0x2befdd-0x0;var _0xcfa797=_0x8262[_0x2befdd];return _0xcfa797;};'use strict';var _=require(_0x2826('0x0'));var utils=require(_0x2826('0x1'));var logger=require(_0x2826('0x2'))(_0x2826('0x3'));var rpc={'chatMessage':require(_0x2826('0x4')),'openchannelMessage':require(_0x2826('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x2826('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x4567c5,_0x22d692){return function(_0x2ba3ea){try{var _0x429187={'body':utils[_0x2826('0x7')](_0x22d692[0x0],this),'ContactId':this[_0x2826('0x8')]['id']};if(this[_0x2826('0x9')]===_0x2826('0xa')){_0x429187[_0x2826('0xb')]=this['account']['id'];}else{_0x429187[_[_0x2826('0xc')](this[_0x2826('0x9')])+_0x2826('0xd')]=this['account']['id'];}_0x429187[_[_0x2826('0xc')](this[_0x2826('0x9')])+_0x2826('0xe')]=this[_0x2826('0xf')]['id'];if(rpc[this[_0x2826('0x9')]+_0x2826('0x10')]){return rpc[this[_0x2826('0x9')]+'Message']['create'](_0x429187)[_0x2826('0x11')](function(_0x9c30c5){logger[_0x2826('0x12')](_0x2826('0x13'),_0x4567c5,_0x429187[_0x2826('0x14')]);_0x2ba3ea['next']();})[_0x2826('0x15')](function(_0x479ddb){logger['error'](_0x2826('0x13'),_0x4567c5,JSON[_0x2826('0x16')](_0x479ddb));_0x2ba3ea[_0x2826('0x17')]();});}}catch(_0x33e850){logger[_0x2826('0x18')]('[%s][MESSAGE]\x20%s',_0x4567c5,JSON[_0x2826('0x16')](_0x33e850));_0x2ba3ea[_0x2826('0x17')]();}};}; \ No newline at end of file +var _0x2080=['stop','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','contact','channel','chat','ChatWebsiteId','account','upperFirst','interaction','Message','create','then','info','body','next','[%s][MESSAGE]\x20%s','stringify'];(function(_0x2afc4c,_0x9e22c7){var _0x28ab34=function(_0x360995){while(--_0x360995){_0x2afc4c['push'](_0x2afc4c['shift']());}};_0x28ab34(++_0x9e22c7);}(_0x2080,0x19f));var _0x0208=function(_0x2ed4f4,_0x56f24f){_0x2ed4f4=_0x2ed4f4-0x0;var _0x58f9a0=_0x2080[_0x2ed4f4];return _0x58f9a0;};'use strict';var _=require('lodash');var utils=require('./utils');var logger=require(_0x0208('0x0'))(_0x0208('0x1'));var rpc={'chatMessage':require(_0x0208('0x2')),'openchannelMessage':require(_0x0208('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x0208('0x4')),'faxMessage':require(_0x0208('0x5')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x0208('0x6')]=function(_0x4f4e99,_0x2f21c1){return function(_0x115952){try{var _0x29ab94={'body':utils['getMustacheRender'](_0x2f21c1[0x0],this),'ContactId':this[_0x0208('0x7')]['id']};if(this[_0x0208('0x8')]===_0x0208('0x9')){_0x29ab94[_0x0208('0xa')]=this[_0x0208('0xb')]['id'];}else{_0x29ab94[_['upperFirst'](this[_0x0208('0x8')])+'AccountId']=this[_0x0208('0xb')]['id'];}_0x29ab94[_[_0x0208('0xc')](this['channel'])+'InteractionId']=this[_0x0208('0xd')]['id'];if(rpc[this[_0x0208('0x8')]+_0x0208('0xe')]){return rpc[this[_0x0208('0x8')]+_0x0208('0xe')][_0x0208('0xf')](_0x29ab94)[_0x0208('0x10')](function(_0x157a6c){logger[_0x0208('0x11')]('[%s][MESSAGE]\x20%s',_0x4f4e99,_0x29ab94[_0x0208('0x12')]);_0x115952[_0x0208('0x13')]();})['catch'](function(_0x12c9ea){logger['error'](_0x0208('0x14'),_0x4f4e99,JSON[_0x0208('0x15')](_0x12c9ea));_0x115952['stop']();});}}catch(_0x46ba60){logger['error'](_0x0208('0x14'),_0x4f4e99,JSON[_0x0208('0x15')](_0x46ba60));_0x115952[_0x0208('0x16')]();}};}; \ 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 77fd8df..f1fd2d3 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 _0x1f2b=['../../../../config/logger','routing','[%s][NOOP]\x20%s','next','error','stringify','./utils'];(function(_0x248e3f,_0x5cbaa5){var _0x1feab9=function(_0x1a7ccf){while(--_0x1a7ccf){_0x248e3f['push'](_0x248e3f['shift']());}};_0x1feab9(++_0x5cbaa5);}(_0x1f2b,0x76));var _0xb1f2=function(_0x32e26e,_0x5b9732){_0x32e26e=_0x32e26e-0x0;var _0x139dc3=_0x1f2b[_0x32e26e];return _0x139dc3;};'use strict';var utils=require(_0xb1f2('0x0'));var logger=require(_0xb1f2('0x1'))(_0xb1f2('0x2'));exports['consequence']=function(_0x56bb40,_0xaa39f3){return function(_0x5afe7e){try{logger['info'](_0xb1f2('0x3'),_0x56bb40,utils['getMustacheRender'](_0xaa39f3[0x0],this));_0x5afe7e[_0xb1f2('0x4')]();}catch(_0x421a5e){logger[_0xb1f2('0x5')](_0xb1f2('0x3'),_0x56bb40,JSON[_0xb1f2('0x6')](_0x421a5e));_0x5afe7e['stop']();}};}; \ No newline at end of file +var _0x55a5=['../../../../config/logger','routing','info','getMustacheRender','next','error','stringify','stop'];(function(_0x40bb36,_0x5cb9a1){var _0x37adb0=function(_0x39bb98){while(--_0x39bb98){_0x40bb36['push'](_0x40bb36['shift']());}};_0x37adb0(++_0x5cb9a1);}(_0x55a5,0x1d0));var _0x555a=function(_0x59f0dc,_0x1e2497){_0x59f0dc=_0x59f0dc-0x0;var _0x5b5445=_0x55a5[_0x59f0dc];return _0x5b5445;};'use strict';var utils=require('./utils');var logger=require(_0x555a('0x0'))(_0x555a('0x1'));exports['consequence']=function(_0x301eac,_0x77f19b){return function(_0x56edde){try{logger[_0x555a('0x2')]('[%s][NOOP]\x20%s',_0x301eac,utils[_0x555a('0x3')](_0x77f19b[0x0],this));_0x56edde[_0x555a('0x4')]();}catch(_0x226e25){logger[_0x555a('0x5')]('[%s][NOOP]\x20%s',_0x301eac,JSON[_0x555a('0x6')](_0x226e25));_0x56edde[_0x555a('0x7')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index a8e8690..5915a67 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 _0xda11=['../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','joinAt','emit','clone','push','capitalize','InteractionId','%sQueuesWaitingInteractions','pick','%s:queue:%s','format','save','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','channel','interaction','MessageId','message','chat','[%s][START:QUEUE][NAME:%s]','name','QueueReport','error','create\x20queue\x20report','waiting','accepted','info','update','catch','update\x20queue\x20report','toLowerCase','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','timeout','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','util','seq-queue','moment'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0xda11,0x18b));var _0x1da1=function(_0x35e837,_0x444a5b){_0x35e837=_0x35e837-0x0;var _0x408efa=_0xda11[_0x35e837];return _0x408efa;};'use strict';var schema=require(_0x1da1('0x0'));var _=require(_0x1da1('0x1'));var util=require(_0x1da1('0x2'));var seqqueue=require(_0x1da1('0x3'));var moment=require(_0x1da1('0x4'));var Redis=require('ioredis');var config=require(_0x1da1('0x5'));var logger=require(_0x1da1('0x6'))('routing');var strategy=require('./strategy');config[_0x1da1('0x7')]=_[_0x1da1('0x8')](config[_0x1da1('0x7')],{'host':_0x1da1('0x9'),'port':0x18eb});var io=require(_0x1da1('0xa'))(new Redis(config['redis']));var attributes=['id',_0x1da1('0xb'),_0x1da1('0xc'),_0x1da1('0xd'),'from',_0x1da1('0xe')];function emit(_0xbde431,_0x50cd75,_0x653026){io['to'](_0xbde431)[_0x1da1('0xf')](_0x50cd75,_0x653026);}function emitChannelQueueInteraction(_0x5bea92,_0x26ead4,_0x30654e,_0x526cb3,_0x2ebeec,_0x894ed0,_0x10fa84,_0x3a93f9){var _0x2567e3=_[_0x1da1('0x10')](_0x30654e);_0x2567e3[_0x1da1('0xb')]=_0x3a93f9;_0x2567e3[_0x1da1('0xd')]=_0x26ead4;_0x2567e3['account']=_0x526cb3;_0x2567e3['id']=_0x2ebeec;if(_0x894ed0){attributes[_0x1da1('0x11')](_[_0x1da1('0x12')](_0x5bea92)+_0x1da1('0x13'));_0x10fa84[util['format'](_0x1da1('0x14'),_0x5bea92)][_0x2ebeec]=_[_0x1da1('0x15')](_0x2567e3,attributes);}else{delete _0x10fa84[util['format']('%sQueuesWaitingInteractions',_0x5bea92)][_0x2ebeec];}emit(util['format'](_0x1da1('0x16'),_0x5bea92,_0x26ead4),util[_0x1da1('0x17')]('%s_queue_waiting_interaction:%s',_0x5bea92,_0x894ed0?_0x1da1('0x18'):_0x1da1('0x19')),_[_0x1da1('0x15')](_0x2567e3,attributes));}var rpc={'openchannelQueueReport':require(_0x1da1('0x1a')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x1da1('0x1b')),'smsQueueReport':require(_0x1da1('0x1c')),'faxQueueReport':require(_0x1da1('0x1d')),'whatsappQueueReport':require(_0x1da1('0x1e'))};var queue=schema({'name':{'type':_0x1da1('0x1f'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0x1da1('0x20')}});function startRouting(_0x12e4e5,_0x3daa4f,_0x110e8a,_0x3c978c){if(_0x12e4e5&&_0x3daa4f&&_0x110e8a){_0x3daa4f['waiting']+=0x1;var _0x401207={'uniqueid':_0x12e4e5,'from':_0x110e8a['body']?_0x110e8a[_0x1da1('0x21')]['from']:'','joinAt':moment()[_0x1da1('0x17')](_0x1da1('0x22')),'ContactId':_0x110e8a[_0x1da1('0x23')]?_0x110e8a[_0x1da1('0x23')]['id']:null,'ListId':_0x110e8a[_0x1da1('0x24')]?_0x110e8a[_0x1da1('0x24')]['id']:null};_0x401207[_[_0x1da1('0x25')](_0x110e8a['channel'])+_0x1da1('0x26')]=_0x3daa4f['id']||null;_0x401207[_[_0x1da1('0x25')](_0x110e8a[_0x1da1('0x27')])+'InteractionId']=_0x110e8a['interaction']?_0x110e8a[_0x1da1('0x28')]['id']:null;_0x401207[_[_0x1da1('0x25')](_0x110e8a[_0x1da1('0x27')])+_0x1da1('0x29')]=_0x110e8a[_0x1da1('0x2a')]?_0x110e8a['message']['id']:null;_0x401207[_['upperFirst'](_0x110e8a['channel'])+(_0x110e8a['channel']!==_0x1da1('0x2b')?'AccountId':'WebsiteId')]=_0x110e8a[_0x1da1('0xc')]?_0x110e8a[_0x1da1('0xc')]['id']:null;logger['info'](util['format'](_0x1da1('0x2c'),_0x12e4e5,_0x3daa4f[_0x1da1('0x2d')]));emitChannelQueueInteraction(_0x110e8a[_0x1da1('0x27')],_0x3daa4f[_0x1da1('0x2d')],_0x401207,_0x110e8a[_0x1da1('0xc')][_0x1da1('0x2d')],_0x110e8a['message']['id'],!![],_0x3c978c,_0x3daa4f['id']);if(rpc[_0x110e8a[_0x1da1('0x27')]+_0x1da1('0x2e')]){return rpc[_0x110e8a[_0x1da1('0x27')]+_0x1da1('0x2e')]['create'](_0x401207)['catch'](function(_0x1bff0a){logger[_0x1da1('0x2f')](_0x1da1('0x30'));});}}}function stopRouting(_0x68cf82,_0x365573,_0x4caa62,_0x4072af){if(_0x68cf82&&_0x365573){_0x365573[_0x1da1('0x31')]-=0x1;var _0x4a82b1={'leaveAt':moment()[_0x1da1('0x17')](_0x1da1('0x22')),'acceptAt':moment()['format'](_0x1da1('0x22')),'reason':_0x1da1('0x32')};logger[_0x1da1('0x33')](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x68cf82,_0x365573[_0x1da1('0x2d')]));emitChannelQueueInteraction(_0x4caa62[_0x1da1('0x27')],_0x365573[_0x1da1('0x2d')],_0x4caa62[_0x1da1('0x21')],_0x4caa62[_0x1da1('0xc')][_0x1da1('0x2d')],_0x4caa62['message']['id'],![],_0x4072af,_0x365573['id']);if(rpc[_0x4caa62['channel']+_0x1da1('0x2e')]){return rpc[_0x4caa62[_0x1da1('0x27')]+_0x1da1('0x2e')][_0x1da1('0x34')](_0x68cf82,_0x4a82b1)[_0x1da1('0x35')](function(_0x2fb112){logger[_0x1da1('0x2f')](_0x1da1('0x36'));});}}}function endRouting(_0x32fff0,_0x36d00d,_0x5c0e38,_0x5cee73){if(_0x32fff0&&_0x36d00d){_0x36d00d[_0x1da1('0x31')]-=0x1;var _0x4f506e={'leaveAt':moment()[_0x1da1('0x17')](_0x1da1('0x22')),'exitAt':moment()[_0x1da1('0x17')](_0x1da1('0x22')),'reason':'timeout'};logger[_0x1da1('0x33')](util[_0x1da1('0x17')]('[%s][END:QUEUE][NAME:%s]',_0x32fff0,_0x36d00d['name']));emitChannelQueueInteraction(_0x5c0e38['channel'],_0x36d00d[_0x1da1('0x2d')],_0x5c0e38[_0x1da1('0x21')],_0x5c0e38[_0x1da1('0xc')][_0x1da1('0x2d')],_0x5c0e38[_0x1da1('0x2a')]['id'],![],_0x5cee73);if(rpc[_0x5c0e38[_0x1da1('0x27')]+_0x1da1('0x2e')]){return rpc[_0x5c0e38[_0x1da1('0x27')]+_0x1da1('0x2e')][_0x1da1('0x34')](_0x32fff0,_0x4f506e)[_0x1da1('0x35')](function(_0x43aa11){logger[_0x1da1('0x2f')](_0x1da1('0x36'));});}}}function handleFindQueue(_0x11f7c9){return function(_0x9a0424){return _0x9a0424[_0x1da1('0x2d')][_0x1da1('0x37')]()===_0x11f7c9[_0x1da1('0x37')]();};}exports['consequence']=function(_0x32b406,_0x130ea0,_0x2a421f,_0x4c4296){return function(_0x425727){try{var _0x9e082f={'name':_0x130ea0[0x0],'timeout':_0x130ea0[0x1]};var _0x476b73=queue[_0x1da1('0x0')](_0x9e082f,{'typecast':!![]});if(_0x476b73[_0x1da1('0x38')]){logger[_0x1da1('0x2f')](_0x1da1('0x39'),_0x32b406,_[_0x1da1('0x3a')](_0x476b73,_0x1da1('0x2a'))[_0x1da1('0x3b')](',\x20'));_0x425727[_0x1da1('0x3c')]();}else{var _0x3b53bf=_[_0x1da1('0x3d')](_0x2a421f[_0x4c4296['channel']+_0x1da1('0x3e')],handleFindQueue(_0x9e082f[_0x1da1('0x2d')]));if(_0x3b53bf){startRouting(_0x32b406,_0x3b53bf,_0x4c4296,_0x2a421f);var _0x48b367=(_0x3b53bf[_0x1da1('0x3f')]||0xa)*0x3e8;var _0xf2b2b=(_0x9e082f[_0x1da1('0x3f')]||0x14)*0x3e8;var _0x2ec09e;if(_0x48b367>_0xf2b2b){_0xf2b2b=_0x48b367;}var _0x19157a=seqqueue[_0x1da1('0x40')](_0x48b367);_0x19157a['id']=_0x32b406;_0x19157a[_0x1da1('0x41')]=_0x48b367;_0x19157a[_0x1da1('0x42')]=_0xf2b2b;_0x19157a['channel']=_0x4c4296['channel'];_0x2a421f[_0x1da1('0x43')][_0x32b406]['on'](_0x1da1('0x44'),function(){logger[_0x1da1('0x33')](_0x1da1('0x45'),_0x32b406);stopRouting(_0x32b406,_0x3b53bf,_0x4c4296,_0x2a421f);clearTimeout(_0x2ec09e);_0x2ec09e=undefined;_0x19157a[_0x1da1('0x46')](!![]);if(_0x2a421f[_0x1da1('0x43')][_0x32b406]){delete _0x2a421f[_0x1da1('0x43')][_0x32b406];}_0x425727[_0x1da1('0x3c')]();});_0x2a421f[_0x1da1('0x43')][_0x32b406]['on'](_0x1da1('0x47'),function(){if(_0x2a421f['rules'][_0x32b406]){delete _0x2a421f[_0x1da1('0x43')][_0x32b406];}});_0x2ec09e=setTimeout(function(){logger[_0x1da1('0x33')](_0x1da1('0x48'),_0x32b406);endRouting(_0x32b406,_0x3b53bf,_0x4c4296,_0x2a421f);clearTimeout(_0x2ec09e);_0x19157a[_0x1da1('0x46')](!![]);_0x425727[_0x1da1('0x49')]();},_0xf2b2b);switch(_0x3b53bf[_0x1da1('0x4a')]){case _0x1da1('0x4b'):strategy[_0x1da1('0x4b')](_0x19157a,_0x3b53bf,_0x2a421f,_0x4c4296);break;default:strategy[_0x1da1('0x4c')](_0x19157a,_0x3b53bf,_0x2a421f,_0x4c4296);}}else{logger['error'](_0x1da1('0x4d'),_0x32b406,_0x9e082f[_0x1da1('0x2d')]);_0x425727[_0x1da1('0x3c')]();}}}catch(_0x5e4f6e){console[_0x1da1('0x4e')](_0x5e4f6e);logger['error'](_0x1da1('0x39'),_0x32b406,_0x5e4f6e[_0x1da1('0x4f')]);_0x425727[_0x1da1('0x3c')]();}};}; \ No newline at end of file +var _0x6fdb=['name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','interaction','MessageId','message','chat','AccountId','info','name','QueueReport','create','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','update','error','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','catch','toLowerCase','consequence','map','stop','Queues','createQueue','atimeout','qtimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','clone','push','capitalize','InteractionId','format','pick','%sQueuesWaitingInteractions','save','remove','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport'];(function(_0x24825b,_0x1fd527){var _0x7c1f2f=function(_0x4f73f6){while(--_0x4f73f6){_0x24825b['push'](_0x24825b['shift']());}};_0x7c1f2f(++_0x1fd527);}(_0x6fdb,0xd0));var _0xb6fd=function(_0x4f5b68,_0x3c50f3){_0x4f5b68=_0x4f5b68-0x0;var _0x4ad265=_0x6fdb[_0x4f5b68];return _0x4ad265;};'use strict';var schema=require(_0xb6fd('0x0'));var _=require(_0xb6fd('0x1'));var util=require(_0xb6fd('0x2'));var seqqueue=require(_0xb6fd('0x3'));var moment=require(_0xb6fd('0x4'));var Redis=require(_0xb6fd('0x5'));var config=require(_0xb6fd('0x6'));var logger=require(_0xb6fd('0x7'))(_0xb6fd('0x8'));var strategy=require(_0xb6fd('0x9'));config[_0xb6fd('0xa')]=_[_0xb6fd('0xb')](config[_0xb6fd('0xa')],{'host':_0xb6fd('0xc'),'port':0x18eb});var io=require(_0xb6fd('0xd'))(new Redis(config[_0xb6fd('0xa')]));var attributes=['id',_0xb6fd('0xe'),_0xb6fd('0xf'),_0xb6fd('0x10'),_0xb6fd('0x11'),_0xb6fd('0x12')];function emit(_0x3dc9f8,_0x4678c8,_0x1565d2){io['to'](_0x3dc9f8)[_0xb6fd('0x13')](_0x4678c8,_0x1565d2);}function emitChannelQueueInteraction(_0x228777,_0x3c7666,_0x51d7ff,_0x34127c,_0x3c9e60,_0x2f54f6,_0x8378eb,_0x17b667){var _0x9baf4f=_[_0xb6fd('0x14')](_0x51d7ff);_0x9baf4f['queue_id']=_0x17b667;_0x9baf4f['queue']=_0x3c7666;_0x9baf4f[_0xb6fd('0xf')]=_0x34127c;_0x9baf4f['id']=_0x3c9e60;if(_0x2f54f6){attributes[_0xb6fd('0x15')](_[_0xb6fd('0x16')](_0x228777)+_0xb6fd('0x17'));_0x8378eb[util[_0xb6fd('0x18')]('%sQueuesWaitingInteractions',_0x228777)][_0x3c9e60]=_[_0xb6fd('0x19')](_0x9baf4f,attributes);}else{delete _0x8378eb[util[_0xb6fd('0x18')](_0xb6fd('0x1a'),_0x228777)][_0x3c9e60];}emit(util[_0xb6fd('0x18')]('%s:queue:%s',_0x228777,_0x3c7666),util[_0xb6fd('0x18')]('%s_queue_waiting_interaction:%s',_0x228777,_0x2f54f6?_0xb6fd('0x1b'):_0xb6fd('0x1c')),_[_0xb6fd('0x19')](_0x9baf4f,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0xb6fd('0x1d')),'smsQueueReport':require(_0xb6fd('0x1e')),'faxQueueReport':require(_0xb6fd('0x1f')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':'string','required':!![],'message':_0xb6fd('0x20')},'timeout':{'type':_0xb6fd('0x21'),'message':_0xb6fd('0x22')}});function startRouting(_0x1e1009,_0x40931b,_0x2d4051,_0x3a983d){if(_0x1e1009&&_0x40931b&&_0x2d4051){_0x40931b[_0xb6fd('0x23')]+=0x1;var _0x2f02fc={'uniqueid':_0x1e1009,'from':_0x2d4051[_0xb6fd('0x24')]?_0x2d4051[_0xb6fd('0x24')][_0xb6fd('0x11')]:'','joinAt':moment()[_0xb6fd('0x18')](_0xb6fd('0x25')),'ContactId':_0x2d4051[_0xb6fd('0x26')]?_0x2d4051[_0xb6fd('0x26')]['id']:null,'ListId':_0x2d4051[_0xb6fd('0x27')]?_0x2d4051[_0xb6fd('0x27')]['id']:null};_0x2f02fc[_[_0xb6fd('0x28')](_0x2d4051[_0xb6fd('0x29')])+'QueueId']=_0x40931b['id']||null;_0x2f02fc[_[_0xb6fd('0x28')](_0x2d4051['channel'])+_0xb6fd('0x17')]=_0x2d4051[_0xb6fd('0x2a')]?_0x2d4051[_0xb6fd('0x2a')]['id']:null;_0x2f02fc[_['upperFirst'](_0x2d4051['channel'])+_0xb6fd('0x2b')]=_0x2d4051[_0xb6fd('0x2c')]?_0x2d4051[_0xb6fd('0x2c')]['id']:null;_0x2f02fc[_[_0xb6fd('0x28')](_0x2d4051[_0xb6fd('0x29')])+(_0x2d4051['channel']!==_0xb6fd('0x2d')?_0xb6fd('0x2e'):'WebsiteId')]=_0x2d4051[_0xb6fd('0xf')]?_0x2d4051[_0xb6fd('0xf')]['id']:null;logger[_0xb6fd('0x2f')](util[_0xb6fd('0x18')]('[%s][START:QUEUE][NAME:%s]',_0x1e1009,_0x40931b[_0xb6fd('0x30')]));emitChannelQueueInteraction(_0x2d4051['channel'],_0x40931b['name'],_0x2f02fc,_0x2d4051['account'][_0xb6fd('0x30')],_0x2d4051[_0xb6fd('0x2c')]['id'],!![],_0x3a983d,_0x40931b['id']);if(rpc[_0x2d4051[_0xb6fd('0x29')]+_0xb6fd('0x31')]){return rpc[_0x2d4051[_0xb6fd('0x29')]+_0xb6fd('0x31')][_0xb6fd('0x32')](_0x2f02fc)['catch'](function(_0x3c9c12){logger['error'](_0xb6fd('0x33'));});}}}function stopRouting(_0x2cadc0,_0x259334,_0x2a7f88,_0x1d5219){if(_0x2cadc0&&_0x259334){_0x259334[_0xb6fd('0x23')]-=0x1;var _0x45c95c={'leaveAt':moment()[_0xb6fd('0x18')](_0xb6fd('0x25')),'acceptAt':moment()['format'](_0xb6fd('0x25')),'reason':_0xb6fd('0x34')};logger[_0xb6fd('0x2f')](util[_0xb6fd('0x18')](_0xb6fd('0x35'),_0x2cadc0,_0x259334[_0xb6fd('0x30')]));emitChannelQueueInteraction(_0x2a7f88['channel'],_0x259334['name'],_0x2a7f88[_0xb6fd('0x24')],_0x2a7f88[_0xb6fd('0xf')][_0xb6fd('0x30')],_0x2a7f88[_0xb6fd('0x2c')]['id'],![],_0x1d5219,_0x259334['id']);if(rpc[_0x2a7f88[_0xb6fd('0x29')]+_0xb6fd('0x31')]){return rpc[_0x2a7f88[_0xb6fd('0x29')]+_0xb6fd('0x31')][_0xb6fd('0x36')](_0x2cadc0,_0x45c95c)['catch'](function(_0x53d406){logger[_0xb6fd('0x37')](_0xb6fd('0x38'));});}}}function endRouting(_0x10fedc,_0x21649e,_0x41c6f0,_0x2466fa){if(_0x10fedc&&_0x21649e){_0x21649e[_0xb6fd('0x23')]-=0x1;var _0x10657c={'leaveAt':moment()[_0xb6fd('0x18')](_0xb6fd('0x25')),'exitAt':moment()[_0xb6fd('0x18')](_0xb6fd('0x25')),'reason':_0xb6fd('0x39')};logger[_0xb6fd('0x2f')](util[_0xb6fd('0x18')](_0xb6fd('0x3a'),_0x10fedc,_0x21649e[_0xb6fd('0x30')]));emitChannelQueueInteraction(_0x41c6f0[_0xb6fd('0x29')],_0x21649e[_0xb6fd('0x30')],_0x41c6f0[_0xb6fd('0x24')],_0x41c6f0[_0xb6fd('0xf')][_0xb6fd('0x30')],_0x41c6f0[_0xb6fd('0x2c')]['id'],![],_0x2466fa);if(rpc[_0x41c6f0[_0xb6fd('0x29')]+'QueueReport']){return rpc[_0x41c6f0[_0xb6fd('0x29')]+'QueueReport'][_0xb6fd('0x36')](_0x10fedc,_0x10657c)[_0xb6fd('0x3b')](function(_0x4245e2){logger[_0xb6fd('0x37')](_0xb6fd('0x38'));});}}}function handleFindQueue(_0xe133a4){return function(_0x5c6daa){return _0x5c6daa['name'][_0xb6fd('0x3c')]()===_0xe133a4['toLowerCase']();};}exports[_0xb6fd('0x3d')]=function(_0x239bea,_0x35b97f,_0x479b26,_0x6677b1){return function(_0x2b8ecc){try{var _0x316b3b={'name':_0x35b97f[0x0],'timeout':_0x35b97f[0x1]};var _0x78c100=queue[_0xb6fd('0x0')](_0x316b3b,{'typecast':!![]});if(_0x78c100['length']){logger[_0xb6fd('0x37')]('[%s][QUEUE]\x20%s',_0x239bea,_[_0xb6fd('0x3e')](_0x78c100,_0xb6fd('0x2c'))['join'](',\x20'));_0x2b8ecc[_0xb6fd('0x3f')]();}else{var _0x5991fa=_['find'](_0x479b26[_0x6677b1[_0xb6fd('0x29')]+_0xb6fd('0x40')],handleFindQueue(_0x316b3b[_0xb6fd('0x30')]));if(_0x5991fa){startRouting(_0x239bea,_0x5991fa,_0x6677b1,_0x479b26);var _0x44bcb3=(_0x5991fa[_0xb6fd('0x39')]||0xa)*0x3e8;var _0xe61a17=(_0x316b3b[_0xb6fd('0x39')]||0x14)*0x3e8;var _0x2ba8bf;if(_0x44bcb3>_0xe61a17){_0xe61a17=_0x44bcb3;}var _0x14f56d=seqqueue[_0xb6fd('0x41')](_0x44bcb3);_0x14f56d['id']=_0x239bea;_0x14f56d[_0xb6fd('0x42')]=_0x44bcb3;_0x14f56d[_0xb6fd('0x43')]=_0xe61a17;_0x14f56d[_0xb6fd('0x29')]=_0x6677b1['channel'];_0x479b26[_0xb6fd('0x44')][_0x239bea]['on']('end',function(){logger['info'](_0xb6fd('0x45'),_0x239bea);stopRouting(_0x239bea,_0x5991fa,_0x6677b1,_0x479b26);clearTimeout(_0x2ba8bf);_0x2ba8bf=undefined;_0x14f56d[_0xb6fd('0x46')](!![]);if(_0x479b26[_0xb6fd('0x44')][_0x239bea]){delete _0x479b26['rules'][_0x239bea];}_0x2b8ecc[_0xb6fd('0x3f')]();});_0x479b26[_0xb6fd('0x44')][_0x239bea]['on'](_0xb6fd('0x47'),function(){if(_0x479b26[_0xb6fd('0x44')][_0x239bea]){delete _0x479b26[_0xb6fd('0x44')][_0x239bea];}});_0x2ba8bf=setTimeout(function(){logger[_0xb6fd('0x2f')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x239bea);endRouting(_0x239bea,_0x5991fa,_0x6677b1,_0x479b26);clearTimeout(_0x2ba8bf);_0x14f56d[_0xb6fd('0x46')](!![]);_0x2b8ecc[_0xb6fd('0x48')]();},_0xe61a17);switch(_0x5991fa[_0xb6fd('0x49')]){case _0xb6fd('0x4a'):strategy[_0xb6fd('0x4a')](_0x14f56d,_0x5991fa,_0x479b26,_0x6677b1);break;default:strategy[_0xb6fd('0x4b')](_0x14f56d,_0x5991fa,_0x479b26,_0x6677b1);}}else{logger[_0xb6fd('0x37')](_0xb6fd('0x4c'),_0x239bea,_0x316b3b[_0xb6fd('0x30')]);_0x2b8ecc[_0xb6fd('0x3f')]();}}}catch(_0x973e3){console[_0xb6fd('0x4d')](_0x973e3);logger[_0xb6fd('0x37')](_0xb6fd('0x4e'),_0x239bea,_0x973e3[_0xb6fd('0x4f')]);_0x2b8ecc[_0xb6fd('0x3f')]();}};}; \ 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 281309e..da4b424 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 _0x6737=['realtime','handleTimeout','timeout','bind','drained','prototype','push','handleRun','handleDrained','debug','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','busy','saveWaitingNotification','showNotification','writeLog',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','removeWaitingNotification','channel','STOP','TIMEOUT','uuid','./util','routing','notificationId','squeue'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x6737,0xe2));var _0x7673=function(_0x5e8157,_0x3b4ab8){_0x5e8157=_0x5e8157-0x0;var _0x3ec40c=_0x6737[_0x5e8157];return _0x3ec40c;};'use strict';var _=require('lodash');var uuid=require(_0x7673('0x0'));var util=require(_0x7673('0x1'));var logger=require('../../../../../config/logger')(_0x7673('0x2'));var Agent=function(_0x2a9cd0,_0x43ee27,_0x12efff,_0x54002e){this[_0x7673('0x3')]=uuid['v4']();this[_0x7673('0x4')]=_0x2a9cd0;this['agent']=_0x43ee27;this[_0x7673('0x5')]=_0x12efff;this[_0x7673('0x2')]=_0x54002e;this['squeue']['push'](this['handleRun']['bind'](this),this[_0x7673('0x6')]['bind'](this));this[_0x7673('0x4')]['on'](_0x7673('0x7'),this['handleTimeout'][_0x7673('0x8')](this));this[_0x7673('0x4')]['on'](_0x7673('0x9'),this['handleDrained']['bind'](this));};Agent[_0x7673('0xa')]['push']=function(){this[_0x7673('0x4')][_0x7673('0xb')](this[_0x7673('0xc')][_0x7673('0x8')](this),this[_0x7673('0x6')][_0x7673('0x8')](this));};Agent[_0x7673('0xa')][_0x7673('0xd')]=function(){this[_0x7673('0x6')](!![]);};Agent[_0x7673('0xa')]['handleRun']=function(){logger[_0x7673('0xe')](_0x7673('0xf'),this[_0x7673('0x4')]['id'],this[_0x7673('0x10')]['id']);if(_[_0x7673('0x11')](this[_0x7673('0x5')][_0x7673('0x12')][this['agent']['id']])){logger['debug'](_0x7673('0x13'),this[_0x7673('0x4')]['id'],this['agent']['id']);setTimeout(this[_0x7673('0xb')][_0x7673('0x8')](this),0x3e8);}else{if(this['routing'][_0x7673('0x14')]||util[_0x7673('0x15')](this[_0x7673('0x4')]['id'],this['realtime']['agents'][this[_0x7673('0x10')]['id']],this[_0x7673('0x4')]['channel'],![])){this[_0x7673('0x5')][_0x7673('0x12')][this[_0x7673('0x10')]['id']][_0x7673('0x16')]=!![];this[_0x7673('0x5')][_0x7673('0x12')][this['agent']['id']]['busyQueue']=undefined;util[_0x7673('0x17')](this[_0x7673('0x5')],this[_0x7673('0x2')],this[_0x7673('0x10')],this[_0x7673('0x4')]['channel']);util[_0x7673('0x18')](this[_0x7673('0x3')],this[_0x7673('0x4')]['id'],this[_0x7673('0x5')][_0x7673('0x12')][this[_0x7673('0x10')]['id']],null,this['routing']);util[_0x7673('0x19')](this[_0x7673('0x4')]['id'],this[_0x7673('0x5')][_0x7673('0x12')][this['agent']['id']],'RINGING'+(this[_0x7673('0x2')][_0x7673('0x14')]?_0x7673('0x1a'):''));}else{logger[_0x7673('0xe')](_0x7673('0x1b'),this[_0x7673('0x4')]['id'],this[_0x7673('0x10')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}}};Agent[_0x7673('0xa')][_0x7673('0x6')]=function(_0x1dd436){if(_[_0x7673('0x11')](this[_0x7673('0x5')][_0x7673('0x12')][this[_0x7673('0x10')]['id']])){return logger['debug']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x7673('0x4')]['id'],this[_0x7673('0x10')]['id']);}else{logger[_0x7673('0xe')](_0x7673('0x1c'),this['squeue']['id'],this[_0x7673('0x10')]['id']);util['hideNotification'](this[_0x7673('0x3')],this[_0x7673('0x4')]['id'],this[_0x7673('0x5')][_0x7673('0x12')][this[_0x7673('0x10')]['id']],null,this[_0x7673('0x2')]);this[_0x7673('0x5')][_0x7673('0x12')][this[_0x7673('0x10')]['id']][_0x7673('0x16')]=![];this[_0x7673('0x5')][_0x7673('0x12')][this[_0x7673('0x10')]['id']]['busyQueue']=undefined;util[_0x7673('0x1d')](this[_0x7673('0x5')],this[_0x7673('0x2')],this[_0x7673('0x10')],this[_0x7673('0x4')][_0x7673('0x1e')]);util[_0x7673('0x19')](this['squeue']['id'],this['realtime'][_0x7673('0x12')][this[_0x7673('0x10')]['id']],_0x1dd436?_0x7673('0x1f'):_0x7673('0x20'));}if(!_0x1dd436){setTimeout(this[_0x7673('0xb')][_0x7673('0x8')](this),0x3e8);}};function agent(_0x159afd,_0x47c9a3,_0x2845f6,_0x13c591){return new Agent(_0x159afd,_0x47c9a3,_0x2845f6,_0x13c591);}module['exports']=agent; \ No newline at end of file +var _0x7a2c=['squeue','isNil','agents','forcedOwnership','busy','busyQueue','saveWaitingNotification','showNotification','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','removeWaitingNotification','channel','STOP','TIMEOUT','exports','lodash','./util','../../../../../config/logger','routing','notificationId','agent','realtime','handleRun','bind','handleTimeout','timeout','drained','prototype','push','handleDrained','debug','[%s][AGENT]\x20try\x20with\x20%s'];(function(_0x1ae79a,_0x1c17fe){var _0x26c687=function(_0x16630a){while(--_0x16630a){_0x1ae79a['push'](_0x1ae79a['shift']());}};_0x26c687(++_0x1c17fe);}(_0x7a2c,0x17b));var _0xc7a2=function(_0x57e49c,_0x5ce5dc){_0x57e49c=_0x57e49c-0x0;var _0x313008=_0x7a2c[_0x57e49c];return _0x313008;};'use strict';var _=require(_0xc7a2('0x0'));var uuid=require('uuid');var util=require(_0xc7a2('0x1'));var logger=require(_0xc7a2('0x2'))(_0xc7a2('0x3'));var Agent=function(_0x26fb61,_0x44d702,_0x2abba8,_0x3f2b0d){this[_0xc7a2('0x4')]=uuid['v4']();this['squeue']=_0x26fb61;this[_0xc7a2('0x5')]=_0x44d702;this[_0xc7a2('0x6')]=_0x2abba8;this['routing']=_0x3f2b0d;this['squeue']['push'](this[_0xc7a2('0x7')][_0xc7a2('0x8')](this),this[_0xc7a2('0x9')][_0xc7a2('0x8')](this));this['squeue']['on'](_0xc7a2('0xa'),this[_0xc7a2('0x9')][_0xc7a2('0x8')](this));this['squeue']['on'](_0xc7a2('0xb'),this['handleDrained'][_0xc7a2('0x8')](this));};Agent[_0xc7a2('0xc')][_0xc7a2('0xd')]=function(){this['squeue'][_0xc7a2('0xd')](this[_0xc7a2('0x7')][_0xc7a2('0x8')](this),this['handleTimeout'][_0xc7a2('0x8')](this));};Agent[_0xc7a2('0xc')][_0xc7a2('0xe')]=function(){this[_0xc7a2('0x9')](!![]);};Agent[_0xc7a2('0xc')][_0xc7a2('0x7')]=function(){logger[_0xc7a2('0xf')](_0xc7a2('0x10'),this[_0xc7a2('0x11')]['id'],this[_0xc7a2('0x5')]['id']);if(_[_0xc7a2('0x12')](this[_0xc7a2('0x6')][_0xc7a2('0x13')][this[_0xc7a2('0x5')]['id']])){logger[_0xc7a2('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xc7a2('0x11')]['id'],this['agent']['id']);setTimeout(this[_0xc7a2('0xd')][_0xc7a2('0x8')](this),0x3e8);}else{if(this[_0xc7a2('0x3')][_0xc7a2('0x14')]||util['isAgentAvailable'](this['squeue']['id'],this[_0xc7a2('0x6')][_0xc7a2('0x13')][this['agent']['id']],this['squeue']['channel'],![])){this[_0xc7a2('0x6')]['agents'][this[_0xc7a2('0x5')]['id']][_0xc7a2('0x15')]=!![];this['realtime'][_0xc7a2('0x13')][this[_0xc7a2('0x5')]['id']][_0xc7a2('0x16')]=undefined;util[_0xc7a2('0x17')](this[_0xc7a2('0x6')],this[_0xc7a2('0x3')],this[_0xc7a2('0x5')],this['squeue']['channel']);util[_0xc7a2('0x18')](this[_0xc7a2('0x4')],this['squeue']['id'],this[_0xc7a2('0x6')][_0xc7a2('0x13')][this[_0xc7a2('0x5')]['id']],null,this[_0xc7a2('0x3')]);util[_0xc7a2('0x19')](this[_0xc7a2('0x11')]['id'],this[_0xc7a2('0x6')][_0xc7a2('0x13')][this['agent']['id']],_0xc7a2('0x1a')+(this['routing'][_0xc7a2('0x14')]?':FORCED':''));}else{logger[_0xc7a2('0xf')](_0xc7a2('0x1b'),this[_0xc7a2('0x11')]['id'],this[_0xc7a2('0x5')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}}};Agent[_0xc7a2('0xc')][_0xc7a2('0x9')]=function(_0x272c6b){if(_[_0xc7a2('0x12')](this[_0xc7a2('0x6')][_0xc7a2('0x13')][this[_0xc7a2('0x5')]['id']])){return logger['debug'](_0xc7a2('0x1c'),this[_0xc7a2('0x11')]['id'],this['agent']['id']);}else{logger[_0xc7a2('0xf')](_0xc7a2('0x1d'),this[_0xc7a2('0x11')]['id'],this['agent']['id']);util[_0xc7a2('0x1e')](this['notificationId'],this[_0xc7a2('0x11')]['id'],this['realtime']['agents'][this[_0xc7a2('0x5')]['id']],null,this['routing']);this['realtime'][_0xc7a2('0x13')][this['agent']['id']][_0xc7a2('0x15')]=![];this['realtime'][_0xc7a2('0x13')][this[_0xc7a2('0x5')]['id']][_0xc7a2('0x16')]=undefined;util[_0xc7a2('0x1f')](this[_0xc7a2('0x6')],this[_0xc7a2('0x3')],this[_0xc7a2('0x5')],this[_0xc7a2('0x11')][_0xc7a2('0x20')]);util[_0xc7a2('0x19')](this['squeue']['id'],this[_0xc7a2('0x6')][_0xc7a2('0x13')][this['agent']['id']],_0x272c6b?_0xc7a2('0x21'):_0xc7a2('0x22'));}if(!_0x272c6b){setTimeout(this[_0xc7a2('0xd')][_0xc7a2('0x8')](this),0x3e8);}};function agent(_0x178c3e,_0x46a665,_0x3a7845,_0x4972a4){return new Agent(_0x178c3e,_0x46a665,_0x3a7845,_0x4972a4);}module[_0xc7a2('0x23')]=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 84efa1f..f8561a3 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 _0x5f04=['channel','RINGING','busy','busyQueue','name','notificationId','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','TIMEOUT','removeWaitingNotification','exports','lodash','./util','../../../../../config/logger','routing','queue','squeue','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','isNil','Agents','length','agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','realtime'];(function(_0x134058,_0x423995){var _0x14a1a9=function(_0x47a2c9){while(--_0x47a2c9){_0x134058['push'](_0x134058['shift']());}};_0x14a1a9(++_0x423995);}(_0x5f04,0x102));var _0x45f0=function(_0x16ba74,_0x2ebcfa){_0x16ba74=_0x16ba74-0x0;var _0x4333a6=_0x5f04[_0x16ba74];return _0x4333a6;};'use strict';var _=require(_0x45f0('0x0'));var uuid=require('uuid');var util=require(_0x45f0('0x1'));var logger=require(_0x45f0('0x2'))(_0x45f0('0x3'));var Beepall=function(_0x1471c8,_0x3681ba,_0x111664,_0x2e7179){this['notificationId']=uuid['v4']();this['squeue']=_0x1471c8;this[_0x45f0('0x4')]=_0x3681ba;this['realtime']=_0x111664;this[_0x45f0('0x3')]=_0x2e7179;this[_0x45f0('0x5')][_0x45f0('0x6')](this[_0x45f0('0x7')][_0x45f0('0x8')](this),this[_0x45f0('0x9')][_0x45f0('0x8')](this));this[_0x45f0('0x5')]['on'](_0x45f0('0xa'),this['handleTimeout']['bind'](this));this['squeue']['on'](_0x45f0('0xb'),this[_0x45f0('0xc')][_0x45f0('0x8')](this));};Beepall[_0x45f0('0xd')][_0x45f0('0x6')]=function(){this['squeue'][_0x45f0('0x6')](this[_0x45f0('0x7')][_0x45f0('0x8')](this),this['handleTimeout'][_0x45f0('0x8')](this));};Beepall['prototype'][_0x45f0('0xc')]=function(){this['handleTimeout'](!![]);};Beepall[_0x45f0('0xd')]['handleRun']=function(){var _0x3a2ccd=!![];if(!_[_0x45f0('0xe')](this[_0x45f0('0x4')])&&!_[_0x45f0('0xe')](this[_0x45f0('0x4')][_0x45f0('0xf')])&&this[_0x45f0('0x4')][_0x45f0('0xf')][_0x45f0('0x10')]>0x0){for(var _0x36f98d=0x0,_0x2d662f;_0x36f98d0x0){for(var _0x4da90e=0x0,_0x1390d2;_0x4da90e0x0&&_0x3201a4[_0x3a15b4+_0xe2f3('0x26')]>=_0x3201a4[_0x3a15b4+_0xe2f3('0x25')]){writeLog(_0x520b21,_0x3201a4,_0x3a15b4[_0xe2f3('0x27')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0xe2f3('0x28')]=function(_0x2cd854,_0x109303,_0x583627,_0x536c89,_0x4cf878){return sendNotification(!![],_0x2cd854,_0x109303,_0x583627,_0x536c89,_0x4cf878);};exports['hideNotification']=function(_0x56cdc6,_0x2f9838,_0x48f08f,_0x5058ce,_0x1e2d11){return sendNotification(![],_0x56cdc6,_0x2f9838,_0x48f08f,_0x5058ce,_0x1e2d11);};exports[_0xe2f3('0x29')]=function(_0xc49dfd,_0x32249d,_0x35808f){var _0xa5435e=_0x32249d[_0xe2f3('0x2a')][_0xe2f3('0x2b')];if(!_0xa5435e&&_0x35808f){_0xa5435e=_0x35808f['id'];}var _0x5174bf=_[_0xe2f3('0x2c')](_0xc49dfd[_0x32249d[_0xe2f3('0x2d')]+'QueuesWaitingInteractions'],function(_0x13d3ad){var _0x3c1541=_[_0xe2f3('0x2e')](_0x32249d['channel'])+_0xe2f3('0x2f');return _0x13d3ad[_0x3c1541]===_0x32249d[_0xe2f3('0x2a')]['id'];});if(!_0x5174bf&&_0xa5435e){_0x5174bf=_[_0xe2f3('0x2c')](_0xc49dfd[_0xe2f3('0x30')][_0xa5435e][_0x32249d['channel']+'WaitingInteractions'],function(_0x41ba10){return _0x41ba10['id']===_0x32249d[_0xe2f3('0x2a')]['id'];});}return _0x5174bf;};exports[_0xe2f3('0x31')]=function(_0x13643a,_0x48cb42,_0x1dbd5d,_0xbedcd9){_0x13643a[_0xe2f3('0x30')][_0x1dbd5d['id']][_0xbedcd9+_0xe2f3('0x32')][_0x48cb42['message']['id']]={'id':_0x48cb42[_0xe2f3('0x2a')]['id']};};exports[_0xe2f3('0x33')]=function(_0xb33ec5,_0x379ab3,_0x2a727f,_0x4189d3){delete _0xb33ec5[_0xe2f3('0x30')][_0x2a727f['id']][_0x4189d3+'WaitingInteractions'][_0x379ab3[_0xe2f3('0x18')]['id']];};exports[_0xe2f3('0x34')]=writeLog; \ No newline at end of file +var _0xab18=['interaction','UserId','some','channel','QueuesWaitingInteractions','capitalize','InteractionId','agents','WaitingInteractions','saveWaitingNotification','removeWaitingNotification','writeLog','lodash','util','../utils','ioredis','../../../../../config/logger','defaults','socket.io-emitter','redis','format','user:%s','name','emit','\x20interaction','notificationSound','account','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','notification:%s','save','remove','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','Pause','Capacity','hasOwnProperty','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','checkWaitingNotifications'];(function(_0x3c9ce5,_0x3e5a42){var _0x1a040c=function(_0x3eff65){while(--_0x3eff65){_0x3c9ce5['push'](_0x3c9ce5['shift']());}};_0x1a040c(++_0x3e5a42);}(_0xab18,0x178));var _0x8ab1=function(_0x3a1bf4,_0x2e92c9){_0x3a1bf4=_0x3a1bf4-0x0;var _0xaab93c=_0xab18[_0x3a1bf4];return _0xaab93c;};'use strict';var _=require(_0x8ab1('0x0'));var util=require(_0x8ab1('0x1'));var utils=require(_0x8ab1('0x2'));var Redis=require(_0x8ab1('0x3'));var config=require('../../../../../config/environment');var logger=require(_0x8ab1('0x4'))('routing');config['redis']=_[_0x8ab1('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x8ab1('0x6'))(new Redis(config[_0x8ab1('0x7')]));function sendNotification(_0x3a5325,_0x32a266,_0x2121af,_0x379963,_0x5b5639,_0x4b0e3e){io['to'](util[_0x8ab1('0x8')](_0x8ab1('0x9'),_0x379963[_0x8ab1('0xa')]))[_0x8ab1('0xb')]('user:save',_0x379963);var _0x527680=_0x4b0e3e||{};var _0x425e8d=_0x2121af['split']('.');var _0x3a2a49={'uniqueid':_0x32a266,'channel':_0x425e8d[0x0],'id':_0x425e8d[0x1],'title':_0x425e8d[0x0]+_0x8ab1('0xc'),'interactionId':_0x425e8d[0x2],'queue':_0x5b5639?_0x5b5639[_0x8ab1('0xa')]:null,'sound':_0x527680['account'][_0x8ab1('0xd')],'shake':_0x527680[_0x8ab1('0xe')]['notificationShake']};try{if(!_0x527680[_0x8ab1('0xf')]){_0x527680[_0x8ab1('0xf')]={};}if(_0x5b5639){_0x527680['body'][_0x8ab1('0x10')]=_0x5b5639;}else if(_0x527680[_0x8ab1('0xf')][_0x8ab1('0x10')]){delete _0x527680['body'][_0x8ab1('0x10')];}_0x3a2a49[_0x8ab1('0x11')]=utils[_0x8ab1('0x12')](_0x527680[_0x8ab1('0xe')][_0x8ab1('0x13')],_0x527680);}catch(_0x2045e4){_0x3a2a49[_0x8ab1('0x11')]=_0x8ab1('0x14');logger[_0x8ab1('0x15')](util[_0x8ab1('0x8')](_0x8ab1('0x16'),_0x32a266,_0x2045e4[_0x8ab1('0x17')]));}io['to'](util['format'](_0x8ab1('0x9'),_0x379963[_0x8ab1('0xa')]))[_0x8ab1('0xb')](util['format'](_0x8ab1('0x18'),_0x3a5325?_0x8ab1('0x19'):_0x8ab1('0x1a')),_0x3a2a49);}function writeLog(_0x23f666,_0x305fc0,_0x500720){return logger[_0x8ab1('0x1b')](util[_0x8ab1('0x8')](_0x8ab1('0x1c'),_0x23f666,_0x305fc0[_0x8ab1('0xa')],_0x500720));}exports[_0x8ab1('0x1d')]=function(_0x502cbf,_0x107f11,_0x42766a,_0x1443de){if(_0x107f11[_0x8ab1('0x1e')]){writeLog(_0x502cbf,_0x107f11,'BUSY');return![];}if(!_0x107f11['online']){writeLog(_0x502cbf,_0x107f11,'OFFLINE');return![];}if(_0x107f11[_0x42766a+_0x8ab1('0x1f')]){writeLog(_0x502cbf,_0x107f11,'PAUSE');return![];}if(_0x1443de&&_0x107f11['hasOwnProperty'](_0x42766a+_0x8ab1('0x20'))&&_0x107f11[_0x8ab1('0x21')](_0x42766a+_0x8ab1('0x22'))){if(_0x107f11[_0x42766a+'Capacity']>0x0&&_0x107f11[_0x42766a+'CurrentCapacity']>=_0x107f11[_0x42766a+_0x8ab1('0x20')]){writeLog(_0x502cbf,_0x107f11,_0x42766a[_0x8ab1('0x23')]()+_0x8ab1('0x24'));return![];}}return!![];};exports[_0x8ab1('0x25')]=function(_0x3c53b5,_0x1e770,_0x3701ab,_0x417796,_0x5cd624){return sendNotification(!![],_0x3c53b5,_0x1e770,_0x3701ab,_0x417796,_0x5cd624);};exports[_0x8ab1('0x26')]=function(_0xeaff4b,_0x28cac8,_0x354f09,_0x12f4d7,_0x10e90b){return sendNotification(![],_0xeaff4b,_0x28cac8,_0x354f09,_0x12f4d7,_0x10e90b);};exports[_0x8ab1('0x27')]=function(_0x2e5222,_0x4c6523,_0x3443d4){var _0x519eca=_0x4c6523[_0x8ab1('0x28')][_0x8ab1('0x29')];if(!_0x519eca&&_0x3443d4){_0x519eca=_0x3443d4['id'];}var _0x2c0adc=_[_0x8ab1('0x2a')](_0x2e5222[_0x4c6523[_0x8ab1('0x2b')]+_0x8ab1('0x2c')],function(_0x3343bc){var _0x6fc3bf=_[_0x8ab1('0x2d')](_0x4c6523[_0x8ab1('0x2b')])+_0x8ab1('0x2e');return _0x3343bc[_0x6fc3bf]===_0x4c6523[_0x8ab1('0x28')]['id'];});if(!_0x2c0adc&&_0x519eca){_0x2c0adc=_[_0x8ab1('0x2a')](_0x2e5222[_0x8ab1('0x2f')][_0x519eca][_0x4c6523[_0x8ab1('0x2b')]+_0x8ab1('0x30')],function(_0x3a4ebc){return _0x3a4ebc['id']===_0x4c6523['interaction']['id'];});}return _0x2c0adc;};exports[_0x8ab1('0x31')]=function(_0x3ffd45,_0x50cb02,_0x5abab4,_0x1bf908){_0x3ffd45[_0x8ab1('0x2f')][_0x5abab4['id']][_0x1bf908+_0x8ab1('0x30')][_0x50cb02[_0x8ab1('0x17')]['id']]={'id':_0x50cb02[_0x8ab1('0x28')]['id']};};exports[_0x8ab1('0x32')]=function(_0x5efe09,_0x476a73,_0x3f7c4f,_0x1788f3){delete _0x5efe09['agents'][_0x3f7c4f['id']][_0x1788f3+_0x8ab1('0x30')][_0x476a73[_0x8ab1('0x17')]['id']];};exports[_0x8ab1('0x33')]=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 4148ab7..ef502cd 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 _0x028d=['consequence','validate','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','shelljs','lodash','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'];(function(_0x2531dc,_0x32f449){var _0x38bdf2=function(_0x1d2977){while(--_0x1d2977){_0x2531dc['push'](_0x2531dc['shift']());}};_0x38bdf2(++_0x32f449);}(_0x028d,0xff));var _0xd028=function(_0x14991d,_0x1e10e6){_0x14991d=_0x14991d-0x0;var _0x3b2047=_0x028d[_0x14991d];return _0x3b2047;};'use strict';var schema=require('validate');var sh=require(_0xd028('0x0'));var _=require(_0xd028('0x1'));var utils=require('./utils');var logger=require(_0xd028('0x2'))(_0xd028('0x3'));var system=schema({'command':{'type':_0xd028('0x4'),'required':!![],'message':_0xd028('0x5')}});exports[_0xd028('0x6')]=function(_0x67d150,_0x5094d8){return function(_0x153af8){try{var _0x4592fd={'command':_0x5094d8[0x0]};var _0x20588f=system[_0xd028('0x7')](_0x4592fd,{'typecast':!![]});if(_0x20588f[_0xd028('0x8')]){logger[_0xd028('0x9')](_0xd028('0xa'),_0x67d150,_[_0xd028('0xb')](_0x20588f,_0xd028('0xc'))[_0xd028('0xd')](',\x20'));logger[_0xd028('0xe')](_0xd028('0xf'),_0x67d150);_0x153af8[_0xd028('0x10')]();}else{var _0x383982=this;var _0x4ec82c=utils[_0xd028('0x11')](_0x5094d8[0x0],this);logger[_0xd028('0xe')](_0xd028('0x12'),_0x67d150,_0x4ec82c);sh[_0xd028('0x13')](_[_0xd028('0x14')](_0x4ec82c),function(_0x3eb4d0,_0x4d6018){logger[_0xd028('0xe')](_0xd028('0x15'),_0x67d150,_0x3eb4d0);if(_0x3eb4d0==0x0){var _0x4817a4=_0x4d6018[_0xd028('0x16')](/(\r\n|\n|\r)/gm,'');if(_[_0xd028('0x17')](_0x5094d8[0x1])||_[_0xd028('0x18')](_0x5094d8[0x1])){logger[_0xd028('0xe')](_0xd028('0x19'),_0x67d150);_0x383982[_0xd028('0x1a')][_0x5094d8[0x1]]=_0x4817a4;}else{logger[_0xd028('0xe')](_0xd028('0x1b'),_0x67d150,_0x5094d8[0x1],_0x4817a4);_0x383982[_0xd028('0x1a')][_0x5094d8[0x1]]=_0x4817a4;}}_0x153af8[_0xd028('0x10')]();});}}catch(_0x12450d){logger[_0xd028('0x9')]('[%s][SYSTEM]\x20%s',_0x67d150,_[_0xd028('0x1c')](_0x12450d)?JSON['stringify'](_0x12450d):_0x12450d);logger[_0xd028('0xe')](_0xd028('0xf'),_0x67d150);_0x153af8[_0xd028('0x10')]();}};}; \ No newline at end of file +var _0xbcbe=['./utils','../../../../config/logger','routing','consequence','length','error','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','[%s][SYSTEM]\x20%s','isObject','stringify','validate','shelljs','lodash'];(function(_0x466e82,_0x3b5a8c){var _0x195ff8=function(_0x5d0ded){while(--_0x5d0ded){_0x466e82['push'](_0x466e82['shift']());}};_0x195ff8(++_0x3b5a8c);}(_0xbcbe,0x1bd));var _0xebcb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbcbe[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0xebcb('0x0'));var sh=require(_0xebcb('0x1'));var _=require(_0xebcb('0x2'));var utils=require(_0xebcb('0x3'));var logger=require(_0xebcb('0x4'))(_0xebcb('0x5'));var system=schema({'command':{'type':'string','required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xebcb('0x6')]=function(_0x287f02,_0x4f606d){return function(_0x571a5a){try{var _0x11948f={'command':_0x4f606d[0x0]};var _0x12d0d1=system[_0xebcb('0x0')](_0x11948f,{'typecast':!![]});if(_0x12d0d1[_0xebcb('0x7')]){logger[_0xebcb('0x8')]('[%s][SYSTEM]\x20%s',_0x287f02,_[_0xebcb('0x9')](_0x12d0d1,_0xebcb('0xa'))[_0xebcb('0xb')](',\x20'));logger[_0xebcb('0xc')](_0xebcb('0xd'),_0x287f02);_0x571a5a[_0xebcb('0xe')]();}else{var _0x33d673=this;var _0x15fbb3=utils[_0xebcb('0xf')](_0x4f606d[0x0],this);logger['info'](_0xebcb('0x10'),_0x287f02,_0x15fbb3);sh['exec'](_[_0xebcb('0x11')](_0x15fbb3),function(_0x428be5,_0x4eca98){logger[_0xebcb('0xc')](_0xebcb('0x12'),_0x287f02,_0x428be5);if(_0x428be5==0x0){var _0x4a0de8=_0x4eca98[_0xebcb('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0xebcb('0x14')](_0x4f606d[0x1])||_[_0xebcb('0x15')](_0x4f606d[0x1])){logger[_0xebcb('0xc')](_0xebcb('0x16'),_0x287f02);_0x33d673[_0xebcb('0x17')][_0x4f606d[0x1]]=_0x4a0de8;}else{logger[_0xebcb('0xc')](_0xebcb('0x18'),_0x287f02,_0x4f606d[0x1],_0x4a0de8);_0x33d673[_0xebcb('0x17')][_0x4f606d[0x1]]=_0x4a0de8;}}_0x571a5a[_0xebcb('0xe')]();});}}catch(_0x16f0c9){logger[_0xebcb('0x8')](_0xebcb('0x19'),_0x287f02,_[_0xebcb('0x1a')](_0x16f0c9)?JSON[_0xebcb('0x1b')](_0x16f0c9):_0x16f0c9);logger[_0xebcb('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x287f02);_0x571a5a[_0xebcb('0xe')]();}};}; \ 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 565a634..6d4d2a6 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 _0xfadf=['finally','stringify','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','Interaction','channel','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','[%s][TAG]\x20%s'];(function(_0x6fc5ba,_0x4a75c6){var _0x26e04c=function(_0x5e7173){while(--_0x5e7173){_0x6fc5ba['push'](_0x6fc5ba['shift']());}};_0x26e04c(++_0x4a75c6);}(_0xfadf,0x198));var _0xffad=function(_0x58110e,_0x3a67bf){_0x58110e=_0x58110e-0x0;var _0x14495d=_0xfadf[_0x58110e];return _0x14495d;};'use strict';var schema=require('validate');var _=require(_0xffad('0x0'));var rpc={'chatInteraction':require(_0xffad('0x1')),'openchannelInteraction':require(_0xffad('0x2')),'smsInteraction':require(_0xffad('0x3')),'mailInteraction':require(_0xffad('0x4')),'faxInteraction':require(_0xffad('0x5')),'whatsappInteraction':require(_0xffad('0x6'))};var logger=require('../../../../config/logger')('routing');var tag=schema({'tag':{'type':_0xffad('0x7'),'required':!![],'message':_0xffad('0x8')}});exports[_0xffad('0x9')]=function(_0x542f9c,_0x53cd56,_0x896e88,_0x10e7a1){return function(_0x62e6de){try{var _0x20258a={'tag':_0x53cd56[0x0]};var _0x144cd5=tag[_0xffad('0xa')](_0x20258a,{'typecast':!![]});if(_0x144cd5[_0xffad('0xb')]){logger[_0xffad('0xc')]('[%s][TAG]\x20%s',_0x542f9c,_[_0xffad('0xd')](_0x144cd5,_0xffad('0xe'))[_0xffad('0xf')](',\x20'));logger[_0xffad('0x10')](_0xffad('0x11'),_0x542f9c);_0x62e6de[_0xffad('0x12')]();}else{var _0x21a5ca={'ids':[_0x53cd56[0x0]]};if(rpc[_0x10e7a1['channel']+_0xffad('0x13')]){rpc[_0x10e7a1[_0xffad('0x14')]+'Interaction'][_0xffad('0x15')](_0x10e7a1[_0xffad('0x16')]['id'],_0x21a5ca)[_0xffad('0x17')](function(_0x3246e6){logger[_0xffad('0x10')](_0xffad('0x18'),_0x542f9c,_0x53cd56[0x1],_0x10e7a1[_0xffad('0x14')],_0x10e7a1['interaction']['id']);})[_0xffad('0x19')](function(_0x4c188c){logger[_0xffad('0xc')](_0xffad('0x1a'),_0x542f9c,JSON['stringify'](_0x4c188c));logger[_0xffad('0x10')](_0xffad('0x11'),_0x542f9c);})[_0xffad('0x1b')](function(){_0x62e6de['next']();});}}}catch(_0x4c896e){logger[_0xffad('0xc')](_0xffad('0x1a'),_0x542f9c,_['isObject'](_0x4c896e)?JSON[_0xffad('0x1c')](_0x4c896e):_0x4c896e);logger['info'](_0xffad('0x11'),_0x542f9c);_0x62e6de[_0xffad('0x12')]();}};}; \ No newline at end of file +var _0xc40d=['../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','routing','consequence','validate','length','error','[%s][TAG]\x20%s','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','Interaction','channel','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally'];(function(_0x4944a2,_0x57cc7a){var _0x49396c=function(_0xb9609c){while(--_0xb9609c){_0x4944a2['push'](_0x4944a2['shift']());}};_0x49396c(++_0x57cc7a);}(_0xc40d,0x1b0));var _0xdc40=function(_0x32f613,_0x24d51a){_0x32f613=_0x32f613-0x0;var _0x87d58f=_0xc40d[_0x32f613];return _0x87d58f;};'use strict';var schema=require('validate');var _=require('lodash');var rpc={'chatInteraction':require(_0xdc40('0x0')),'openchannelInteraction':require(_0xdc40('0x1')),'smsInteraction':require(_0xdc40('0x2')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xdc40('0x3')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require('../../../../config/logger')(_0xdc40('0x4'));var tag=schema({'tag':{'type':'number','required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xdc40('0x5')]=function(_0xd63f3b,_0x537985,_0x48300b,_0x5e636c){return function(_0x256400){try{var _0x171e52={'tag':_0x537985[0x0]};var _0x1bb8d3=tag[_0xdc40('0x6')](_0x171e52,{'typecast':!![]});if(_0x1bb8d3[_0xdc40('0x7')]){logger[_0xdc40('0x8')](_0xdc40('0x9'),_0xd63f3b,_['map'](_0x1bb8d3,_0xdc40('0xa'))[_0xdc40('0xb')](',\x20'));logger[_0xdc40('0xc')](_0xdc40('0xd'),_0xd63f3b);_0x256400[_0xdc40('0xe')]();}else{var _0x3e4113={'ids':[_0x537985[0x0]]};if(rpc[_0x5e636c['channel']+_0xdc40('0xf')]){rpc[_0x5e636c[_0xdc40('0x10')]+_0xdc40('0xf')][_0xdc40('0x11')](_0x5e636c[_0xdc40('0x12')]['id'],_0x3e4113)[_0xdc40('0x13')](function(_0x5aa342){logger[_0xdc40('0xc')](_0xdc40('0x14'),_0xd63f3b,_0x537985[0x1],_0x5e636c['channel'],_0x5e636c['interaction']['id']);})[_0xdc40('0x15')](function(_0x11a084){logger[_0xdc40('0x8')](_0xdc40('0x9'),_0xd63f3b,JSON[_0xdc40('0x16')](_0x11a084));logger[_0xdc40('0xc')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0xd63f3b);})[_0xdc40('0x17')](function(){_0x256400[_0xdc40('0xe')]();});}}}catch(_0xfca86d){logger[_0xdc40('0x8')](_0xdc40('0x9'),_0xd63f3b,_['isObject'](_0xfca86d)?JSON['stringify'](_0xfca86d):_0xfca86d);logger[_0xdc40('0xc')](_0xdc40('0xd'),_0xd63f3b);_0x256400[_0xdc40('0xe')]();}};}; \ 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 071a46f..2da41ea 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 _0xc633=['isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','request-promise','../../../../config/logger','lodash','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','title','jsonrpc','2.0','method','login','params','stringify','utf8','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&sessionId=','info','stop','catch','error','[%s][TVOX]\x20%s'];(function(_0x165d61,_0x20c2fb){var _0x51bdd5=function(_0x48982e){while(--_0x48982e){_0x165d61['push'](_0x165d61['shift']());}};_0x51bdd5(++_0x20c2fb);}(_0xc633,0x138));var _0x3c63=function(_0x285c2f,_0x2b8c92){_0x285c2f=_0x285c2f-0x0;var _0x3e174f=_0xc633[_0x285c2f];return _0x3e174f;};'use strict';var rp=require(_0x3c63('0x0'));var logger=require(_0x3c63('0x1'))('routing');var _=require(_0x3c63('0x2'));var arr=[];exports['consequence']=function(_0x2ad5e9,_0x1aa72c){return function(_0x579e65){var _0x1a2e8c=_0x1aa72c[0xa];var _0x31d563=_0x1aa72c[0xb];var _0xab1a0a=_0x1aa72c[0xc];var _0x4eeec7=_0x1aa72c[0xd];var _0x1c8d15=_0x1aa72c[0xe];var _0x1bc56f=_0x1aa72c[0xf][_0x3c63('0x3')](/\n/g,_0x3c63('0x4'));var _0x5a5027=_0x1aa72c[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x3c63('0x5')](_0x31d563)){arr[_0x3c63('0x6')](_0x31d563);var _0x448aea=_0x1aa72c[0x3];var _0x4fda94=_0x1aa72c[0x4];var _0x14b3d0=_0x1aa72c[0x1];var _0x120fce=_0x1aa72c[0x0];var _0x86e3d5={};_0x86e3d5[_0x3c63('0x7')]=_0x1aa72c[0x8]+_0x3c63('0x8')+_0xab1a0a+'|'+_0x1a2e8c+'|'+_0x4eeec7+'|'+_0x31d563+'|'+_0x1c8d15;_0x86e3d5['urlOnRing']=_0x1aa72c[0x7]+_0x3c63('0x8')+_0xab1a0a+'|'+_0x1a2e8c+'|'+_0x4eeec7+'|'+_0x31d563+'|'+_0x1c8d15+'|'+_0x1bc56f+'|'+_0x5a5027;_0x86e3d5[_0x3c63('0x9')]=_0x1aa72c[0x9];var _0x4cdbe5={};_0x4cdbe5[_0x3c63('0xa')]=_0x3c63('0xb');_0x4cdbe5[_0x3c63('0xc')]=_0x3c63('0xd');var _0x36b607=[];_0x36b607['push'](_0x1aa72c[0x2]);_0x36b607['push'](_0x1aa72c[0x5]);_0x36b607[_0x3c63('0x6')](_0x1aa72c[0x6]);_0x4cdbe5[_0x3c63('0xe')]=_0x36b607;_0x4cdbe5['id']=0x1;var _0x518b05=JSON[_0x3c63('0xf')](_0x4cdbe5);var _0x1bdee1={'encoding':_0x3c63('0x10'),'method':'POST','timeout':0x2710,'url':_0x448aea,'headers':{'Content-Type':'application/json-rpc'},'body':_0x518b05};return rp(_0x1bdee1)[_0x3c63('0x11')](function(_0x525817){const _0x149d6d=JSON[_0x3c63('0x12')](_0x525817);if(!_0x149d6d[_0x3c63('0x13')][_0x3c63('0x14')]){throw new Error(_0x3c63('0x15'));}var _0x2dadfa=_0x31d563;var _0x53e226=_0x3c63('0x16')+_0x14b3d0+'&serviceId='+_0x120fce+_0x3c63('0x17')+_0x2dadfa+'&data='+JSON['stringify'](_0x86e3d5);var _0x4cdc85=_0x4fda94+'?'+_0x53e226;return rp(_0x4cdc85);})['then'](function(_0x472538){logger[_0x3c63('0x18')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x2ad5e9,_0x472538);_0x579e65[_0x3c63('0x19')]();})[_0x3c63('0x1a')](function(_0x4fa377){logger[_0x3c63('0x1b')](_0x3c63('0x1c'),_0x2ad5e9,_[_0x3c63('0x1d')](_0x4fa377)?JSON[_0x3c63('0xf')](_0x4fa377):_0x4fa377);_0x579e65[_0x3c63('0x19')]();});}else{logger[_0x3c63('0x18')](_0x3c63('0x1e'),_0x2ad5e9);_0x579e65['next']();}};}; \ No newline at end of file +var _0x9d7b=['Unable\x20to\x20login\x20with\x20TVox\x20application','&serviceId=','then','info','stop','catch','error','[%s][TVOX]\x20%s','isObject','next','../../../../config/logger','lodash','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','urlOnRing','jsonrpc','2.0','stringify','POST','application/json-rpc','logged'];(function(_0x241625,_0x5d77c0){var _0x22f42d=function(_0x3f4e99){while(--_0x3f4e99){_0x241625['push'](_0x241625['shift']());}};_0x22f42d(++_0x5d77c0);}(_0x9d7b,0x176));var _0xb9d7=function(_0x162c18,_0x40f488){_0x162c18=_0x162c18-0x0;var _0x3f22cc=_0x9d7b[_0x162c18];return _0x3f22cc;};'use strict';var rp=require('request-promise');var logger=require(_0xb9d7('0x0'))('routing');var _=require(_0xb9d7('0x1'));var arr=[];exports[_0xb9d7('0x2')]=function(_0x25aa47,_0x45dfda){return function(_0x4db184){var _0x5bf09e=_0x45dfda[0xa];var _0x5a0f61=_0x45dfda[0xb];var _0x1d3676=_0x45dfda[0xc];var _0x3f8c0e=_0x45dfda[0xd];var _0x2d79f1=_0x45dfda[0xe];var _0xd7ed5e=_0x45dfda[0xf][_0xb9d7('0x3')](/\n/g,_0xb9d7('0x4'));var _0x38d48c=_0x45dfda[0x10][_0xb9d7('0x3')](/\n/g,'\x20');if(!arr[_0xb9d7('0x5')](_0x5a0f61)){arr[_0xb9d7('0x6')](_0x5a0f61);var _0x29b1ad=_0x45dfda[0x3];var _0x185e29=_0x45dfda[0x4];var _0x4bc990=_0x45dfda[0x1];var _0x4cf23d=_0x45dfda[0x0];var _0x2b4832={};_0x2b4832[_0xb9d7('0x7')]=_0x45dfda[0x8]+_0xb9d7('0x8')+_0x1d3676+'|'+_0x5bf09e+'|'+_0x3f8c0e+'|'+_0x5a0f61+'|'+_0x2d79f1;_0x2b4832[_0xb9d7('0x9')]=_0x45dfda[0x7]+_0xb9d7('0x8')+_0x1d3676+'|'+_0x5bf09e+'|'+_0x3f8c0e+'|'+_0x5a0f61+'|'+_0x2d79f1+'|'+_0xd7ed5e+'|'+_0x38d48c;_0x2b4832['title']=_0x45dfda[0x9];var _0x3883e4={};_0x3883e4[_0xb9d7('0xa')]=_0xb9d7('0xb');_0x3883e4['method']='login';var _0x2c65c0=[];_0x2c65c0['push'](_0x45dfda[0x2]);_0x2c65c0[_0xb9d7('0x6')](_0x45dfda[0x5]);_0x2c65c0[_0xb9d7('0x6')](_0x45dfda[0x6]);_0x3883e4['params']=_0x2c65c0;_0x3883e4['id']=0x1;var _0x1bbb01=JSON[_0xb9d7('0xc')](_0x3883e4);var _0x2ec234={'encoding':'utf8','method':_0xb9d7('0xd'),'timeout':0x2710,'url':_0x29b1ad,'headers':{'Content-Type':_0xb9d7('0xe')},'body':_0x1bbb01};return rp(_0x2ec234)['then'](function(_0x566452){const _0x198be2=JSON['parse'](_0x566452);if(!_0x198be2['result'][_0xb9d7('0xf')]){throw new Error(_0xb9d7('0x10'));}var _0x4a1476=_0x5a0f61;var _0x2d15b9='channelId='+_0x4bc990+_0xb9d7('0x11')+_0x4cf23d+'&sessionId='+_0x4a1476+'&data='+JSON[_0xb9d7('0xc')](_0x2b4832);var _0xea792e=_0x185e29+'?'+_0x2d15b9;return rp(_0xea792e);})[_0xb9d7('0x12')](function(_0x23aa6f){logger[_0xb9d7('0x13')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x25aa47,_0x23aa6f);_0x4db184[_0xb9d7('0x14')]();})[_0xb9d7('0x15')](function(_0x5337ec){logger[_0xb9d7('0x16')](_0xb9d7('0x17'),_0x25aa47,_[_0xb9d7('0x18')](_0x5337ec)?JSON[_0xb9d7('0xc')](_0x5337ec):_0x5337ec);_0x4db184[_0xb9d7('0x14')]();});}else{logger[_0xb9d7('0x13')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x25aa47);_0x4db184[_0xb9d7('0x19')]();}};}; \ 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 19a9e73..5bfa30e 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['list','lodash','exports','render','merge','contact','message','account','interaction'];(function(_0x38c3c9,_0x54426f){var _0x1d5e65=function(_0x1e50f6){while(--_0x1e50f6){_0x38c3c9['push'](_0x38c3c9['shift']());}};_0x1d5e65(++_0x54426f);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var Mustache=require('mustache');var _=require(_0x0baf('0x0'));module[_0x0baf('0x1')]={'getMustacheRender':function(_0x1e212d,_0x263f79){return Mustache[_0x0baf('0x2')](_0x1e212d,_[_0x0baf('0x3')](_0x263f79['body'],{'contact':_0x263f79[_0x0baf('0x4')],'message':_0x263f79[_0x0baf('0x5')],'account':_0x263f79[_0x0baf('0x6')],'interaction':_0x263f79[_0x0baf('0x7')],'list':_0x263f79[_0x0baf('0x8')]}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x5f312c,_0x5cb631){var _0x339a53=function(_0x3cd551){while(--_0x3cd551){_0x5f312c['push'](_0x5f312c['shift']());}};_0x339a53(++_0x5cb631);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index d48c155..716be81 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 _0x253b=['format','%s.%s.%s','isNil','IntervalId','map','Intervals','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','applications','isArray','length','existsSync','app','.js','toLowerCase','autoreply','mail','push','slice','join','dialogflow','split','amazonlex','tag','TagId','appdata','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','execute','Applications\x20executed','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','error','agent','agents','busy','busyQueue','end','QueueReport','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','values','find','chatQueues','paused','waiting','mailQueues','name','openchannelQueues','available','smsQueues','loggedIn','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','stringify','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine'];(function(_0xbaeba7,_0x578dfa){var _0x4b42e7=function(_0x23bd26){while(--_0x23bd26){_0xbaeba7['push'](_0xbaeba7['shift']());}};_0x4b42e7(++_0x578dfa);}(_0x253b,0x199));var _0xb253=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x253b[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xb253('0x0'));var util=require(_0xb253('0x1'));var path=require(_0xb253('0x2'));var fs=require('fs');var jayson=require(_0xb253('0x3'));var BPromise=require(_0xb253('0x4'));var utils=require('./applications/utils');var sUtils=require(_0xb253('0x5'));var logger=require(_0xb253('0x6'))(_0xb253('0x7'));var rpc={'openchannelQueueReport':require(_0xb253('0x8')),'mailQueueReport':require(_0xb253('0x9')),'chatQueueReport':require(_0xb253('0xa')),'smsQueueReport':require(_0xb253('0xb')),'faxQueueReport':require(_0xb253('0xc')),'whatsappQueueReport':require(_0xb253('0xd'))};var RuleEngine=require(_0xb253('0xe'));function getId(_0x109687,_0x3831b5,_0x512c63){return util[_0xb253('0xf')](_0xb253('0x10'),_0x109687,_0x3831b5||0x0,_0x512c63||0x0);}function getIntervals(_0x3add9a,_0x5df0a5){var _0x171d68=[];if(!_[_0xb253('0x11')](_0x5df0a5[_0xb253('0x12')])&&!_[_0xb253('0x11')](_0x3add9a[_0x5df0a5['IntervalId']])&&!_['isNil'](_0x3add9a[_0x5df0a5[_0xb253('0x12')]]['Intervals'])){_0x171d68=_[_0xb253('0x13')](_0x3add9a[_0x5df0a5[_0xb253('0x12')]][_0xb253('0x14')],_0xb253('0x15'));}else if(!_['isNil'](_0x5df0a5[_0xb253('0x15')])){_0x171d68=[_0x5df0a5[_0xb253('0x15')]];}return _0x171d68;}exports[_0xb253('0x16')]=function(_0xe4b96b){_0xe4b96b[_0xb253('0x17')]={};return new BPromise(function(_0x37ed21,_0x353b8e){var _0x4bb04f={'Start':function(_0x3c67ea){var _0x28d336=this;return new Promise(function(_0x30e2ec,_0x140169){if(_0x3c67ea){try{var _0x580ac9=[];var _0x1df1de=getId(_0x3c67ea[_0xb253('0x18')],_0x3c67ea[_0xb253('0x19')]?_0x3c67ea[_0xb253('0x19')]['id']:0x0,_0x3c67ea[_0xb253('0x1a')]?_0x3c67ea[_0xb253('0x1a')]['id']:0x0);var _0x53d29f=sUtils[_0xb253('0x1b')](_0xe4b96b,_0x3c67ea);if(!_0x53d29f&&_0x3c67ea[_0xb253('0x1c')]&&_[_0xb253('0x1d')](_0x3c67ea[_0xb253('0x1c')])&&_0x3c67ea[_0xb253('0x1c')][_0xb253('0x1e')]){for(var _0x35976e=0x0;_0x35976e<_0x3c67ea['applications']['length'];_0x35976e+=0x1){var _0x981a3=_0x3c67ea[_0xb253('0x1c')][_0x35976e];if(fs[_0xb253('0x1f')](path['join'](__dirname,_0xb253('0x1c'),_0x981a3[_0xb253('0x20')]+_0xb253('0x21')))){var _0x19c3de=[];switch(_0x981a3['app'][_0xb253('0x22')]()){case _0xb253('0x23'):var _0x31992e=_0x981a3['appdata']['split'](',');if(_0x3c67ea[_0xb253('0x18')]===_0xb253('0x24')){_0x19c3de[_0xb253('0x25')](_0x31992e[0x0]);_0x19c3de[_0xb253('0x25')](_0x31992e[0x1]);_0x19c3de[_0xb253('0x25')](_0x31992e[_0xb253('0x26')](0x2,_0x31992e[_0xb253('0x1e')])['join'](','));}else{_0x19c3de[_0xb253('0x25')](_0x31992e[0x0]);_0x19c3de[_0xb253('0x25')](_0x31992e['slice'](0x1,_0x31992e[_0xb253('0x1e')])[_0xb253('0x27')](','));}break;case _0xb253('0x28'):var _0x2be76c=_0x981a3['appdata'][_0xb253('0x29')](',');_0x19c3de['push'](_0x2be76c[0x0]);_0x19c3de[_0xb253('0x25')](_0x2be76c[0x1]);_0x19c3de['push'](_0x2be76c[_0xb253('0x26')](0x2,_0x2be76c['length'])[_0xb253('0x27')](','));break;case'dialogflowv2':var _0xda366=_0x981a3['appdata']['split'](',');_0x19c3de[_0xb253('0x25')](_0xda366[0x0]);_0x19c3de['push'](_0xda366[0x1]);_0x19c3de[_0xb253('0x25')](_0xda366[0x2]);_0x19c3de[_0xb253('0x25')](_0xda366[0x3]);_0x19c3de[_0xb253('0x25')](_0xda366[_0xb253('0x26')](0x4,_0xda366[_0xb253('0x1e')])[_0xb253('0x27')](','));break;case _0xb253('0x2a'):var _0x183656=_0x981a3['appdata']['split'](',');_0x19c3de['push'](_0x183656[0x0]);_0x19c3de[_0xb253('0x25')](_0x183656[0x1]);_0x19c3de[_0xb253('0x25')](_0x183656[0x2]);_0x19c3de[_0xb253('0x25')](_0x183656[0x3]);_0x19c3de[_0xb253('0x25')](_0x183656[_0xb253('0x26')](0x4,_0x183656[_0xb253('0x1e')])[_0xb253('0x27')](','));break;case _0xb253('0x19'):_0x19c3de['push'](_0x981a3['appdata']);break;case _0xb253('0x2b'):_0x19c3de[_0xb253('0x25')](_0x981a3[_0xb253('0x2c')]);_0x19c3de[_0xb253('0x25')](_0x981a3[_0xb253('0x2d')]);break;case'tvox':var _0x418094=utils[_0xb253('0x2e')](_0x3c67ea[_0xb253('0x2f')][_0xb253('0x30')],_0x3c67ea);var _0x5403f4=_0x981a3['appdata']['split'](',');_0x19c3de['push'](_0x5403f4[0x0]);_0x19c3de[_0xb253('0x25')](_0x5403f4[0x1]);_0x19c3de[_0xb253('0x25')](_0x5403f4[0x2]);_0x19c3de[_0xb253('0x25')](_0x5403f4[0x3]);_0x19c3de[_0xb253('0x25')](_0x5403f4[0x4]);_0x19c3de[_0xb253('0x25')](_0x5403f4[0x5]);_0x19c3de[_0xb253('0x25')](_0x5403f4[0x6]);_0x19c3de[_0xb253('0x25')](_0x5403f4[0x7]);_0x19c3de[_0xb253('0x25')](_0x5403f4[0x8]);_0x19c3de[_0xb253('0x25')](_0x5403f4[0x9]);_0x19c3de[_0xb253('0x25')](_0x5403f4[0xa]);_0x19c3de[_0xb253('0x25')](_0x3c67ea[_0xb253('0x1a')]['id']);_0x19c3de[_0xb253('0x25')](_0x3c67ea['message']['id']);_0x19c3de[_0xb253('0x25')](_0x981a3[_0xb253('0x31')]);_0x19c3de['push'](_0x3c67ea[_0xb253('0x1a')][_0xb253('0x32')]);_0x19c3de['push'](_0x3c67ea[_0xb253('0x33')][_0xb253('0x33')]);_0x19c3de[_0xb253('0x25')](_0x418094);break;default:_0x19c3de=_[_0xb253('0x11')](_0x981a3[_0xb253('0x2d')])?[]:_0x981a3[_0xb253('0x2d')]['split'](',');}var _0x1a2dc9={'id':util[_0xb253('0xf')](_0xb253('0x34'),_0x1df1de,_0x981a3['id'],_0x981a3[_0xb253('0x20')]),'condition':require(_0xb253('0x35'))['condition'](_0x1df1de,getIntervals(_0xe4b96b[_0xb253('0x36')],_0x981a3),_0xe4b96b),'consequence':require(_0xb253('0x37')+_0x981a3[_0xb253('0x20')])[_0xb253('0x38')](_0x1df1de,_0x19c3de,_0xe4b96b,_0x3c67ea),'p':_0x981a3[_0xb253('0x39')]||0x0};logger[_0xb253('0x3a')](_0xb253('0x3b'),_0x1a2dc9['id'],_0xb253('0x3c'),getIntervals(_0xe4b96b[_0xb253('0x36')],_0x981a3)[_0xb253('0x27')](_0xb253('0x3d')));_0x580ac9['push'](_0x1a2dc9);}else{logger['error']('Please\x20create\x20a\x20new\x20file\x20under',path[_0xb253('0x27')](__dirname,_0xb253('0x1c'),_0x981a3[_0xb253('0x20')]+'.js'));}}_0xe4b96b[_0xb253('0x17')][_0x1df1de]=new RuleEngine(_0x580ac9);_0xe4b96b[_0xb253('0x17')][_0x1df1de][_0xb253('0x3e')](_0x3c67ea,function(_0x4e0aec){logger[_0xb253('0x3a')](_0xb253('0x3f'),JSON['stringify'](_0x4e0aec[_0xb253('0x40')]));if(_0xe4b96b[_0xb253('0x17')][_0x1df1de]){_0xe4b96b['rules'][_0x1df1de][_0xb253('0x41')](_0xb253('0x42'));}});return _0x30e2ec({'code':0xc8,'message':_0x3c67ea});}else{if(_0x53d29f){logger[_0xb253('0x3a')](util['format'](_0xb253('0x43'),_0x1df1de));}else{logger[_0xb253('0x3a')](_0xb253('0x44'));}return _0x30e2ec({'code':0xc8,'message':_0x3c67ea});}}catch(_0x3498b2){logger['error'](_0x3498b2[_0xb253('0x45')]);return _0x140169(_0x28d336[_0xb253('0x46')](0x1f4,_0x3498b2));}}return _0x140169('routing\x20is\x20empty');});},'AcceptMessage':function(_0x520b11){var _0x7fbc95=this;return new Promise(function(_0x3afb3e,_0x56fafd){if(_0x520b11['agent']&&_0x520b11['agent']['id']){if(_0xe4b96b['agents'][_0x520b11[_0xb253('0x47')]['id']]){_0xe4b96b[_0xb253('0x48')][_0x520b11[_0xb253('0x47')]['id']][_0xb253('0x49')]=![];_0xe4b96b[_0xb253('0x48')][_0x520b11[_0xb253('0x47')]['id']][_0xb253('0x4a')]=undefined;}}if(_0x520b11[_0xb253('0x19')]&&_0x520b11[_0xb253('0x19')]['id']){try{var _0x3fd0ad=getId(_0x520b11[_0xb253('0x18')],_0x520b11[_0xb253('0x19')]?_0x520b11[_0xb253('0x19')]['id']:0x0,_0x520b11[_0xb253('0x1a')]?_0x520b11['interaction']['id']:0x0);if(_0xe4b96b[_0xb253('0x17')][_0x3fd0ad]){_0xe4b96b[_0xb253('0x17')][_0x3fd0ad][_0xb253('0x41')](_0xb253('0x4b'));if(rpc[_0x520b11[_0xb253('0x18')]+'QueueReport']){rpc[_0x520b11[_0xb253('0x18')]+_0xb253('0x4c')]['update'](_0x3fd0ad,{'UserId':_0x520b11[_0xb253('0x19')][_0xb253('0x4d')]})['catch'](function(){logger['error'](_0xb253('0x4e'));});}}return _0x3afb3e({'code':0xc8,'message':_0x520b11});}catch(_0x2cba39){logger[_0xb253('0x46')](_0x2cba39[_0xb253('0x45')]);return _0x56fafd(_0x7fbc95['error'](0x1f4,_0x2cba39));}}logger[_0xb253('0x46')](_0xb253('0x4f'));return _0x56fafd(_0x7fbc95[_0xb253('0x46')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x33783a){var _0xeabbac=this;return new Promise(function(_0x1a15ae,_0x1f66c3){if(_0x33783a['agent']&&_0x33783a['agent']['id']){try{if(_0xe4b96b['agents'][_0x33783a[_0xb253('0x47')]['id']]){_0xe4b96b[_0xb253('0x48')][_0x33783a['agent']['id']][_0xb253('0x49')]=![];_0xe4b96b[_0xb253('0x48')][_0x33783a['agent']['id']][_0xb253('0x4a')]=undefined;}return _0x1a15ae({'code':0xc8,'message':_0x33783a});}catch(_0x53762f){logger[_0xb253('0x46')](_0x53762f[_0xb253('0x45')]);return _0x1f66c3(_0xeabbac[_0xb253('0x46')](0x1f4,_0x53762f));}}logger[_0xb253('0x46')](_0xb253('0x4f'));return _0x1f66c3(_0xeabbac['error'](0x1f4,_0xb253('0x4f')));});},'AbandonInteraction':function(_0x366611){var _0x497d0a=this;return new Promise(function(_0x512a68,_0x267bb8){if(_0x366611[_0xb253('0x18')]&&_0x366611[_0xb253('0x1a')]&&_0x366611[_0xb253('0x1a')]['id']){try{var _0x1a4227=getId(_0x366611[_0xb253('0x18')],_0x366611[_0xb253('0x19')]?_0x366611[_0xb253('0x19')]['id']:0x0,_0x366611[_0xb253('0x1a')]?_0x366611[_0xb253('0x1a')]['id']:0x0);if(_0xe4b96b[_0xb253('0x17')][_0x1a4227]){_0xe4b96b[_0xb253('0x17')][_0x1a4227][_0xb253('0x41')](_0xb253('0x4b'));}return _0x512a68({'code':0xc8,'message':_0x366611});}catch(_0x3e5104){logger[_0xb253('0x46')](_0x3e5104[_0xb253('0x45')]);return _0x267bb8(_0x497d0a[_0xb253('0x46')](0x1f4,_0x3e5104));}}logger[_0xb253('0x46')](_0xb253('0x4f'));return _0x267bb8(_0x497d0a[_0xb253('0x46')](0x1f4,_0xb253('0x4f')));});},'AgentCapacity':function(_0x1b709c){var _0x2bf1a5=this;return new Promise(function(_0x20e9ba,_0x49e870){if(_0xe4b96b[_0xb253('0x48')][_0xb253('0x50')](_0x1b709c['id'])){for(var _0x17ca0c in _0x1b709c['capacity']){if(_0x1b709c[_0xb253('0x51')][_0xb253('0x50')](_0x17ca0c)){if(_0xe4b96b['agents'][_0x1b709c['id']][_0xb253('0x50')](_0x17ca0c+'CurrentCapacity')){_0xe4b96b[_0xb253('0x48')][_0x1b709c['id']][_0x17ca0c+_0xb253('0x52')]=parseInt(_0x1b709c[_0xb253('0x51')][_0x17ca0c],0xa);}}}_0xe4b96b[_0xb253('0x48')][_0x1b709c['id']][_0xb253('0x53')]();return _0x20e9ba({'code':0xc8,'message':_0xe4b96b[_0xb253('0x48')][_0x1b709c['id']]});}else{return _0x49e870(_0x2bf1a5[_0xb253('0x46')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x1588e4){return new Promise(function(_0xf465b9){var _0x42eee2=_[_0xb253('0x54')](_0xe4b96b[_0xb253('0x48')]);if(_0x1588e4&&_0x1588e4['id']){var _0x3f59f8=_[_0xb253('0x55')](_0x42eee2,function(_0x2697c7){return _0x2697c7['id']===_0x1588e4['id'];});_0xf465b9(_0x3f59f8);}else{_0xf465b9({'count':_0x42eee2[_0xb253('0x1e')],'rows':_0x42eee2});}});},'ChatQueues':function(){return new Promise(function(_0x4fe049){var _0x443380=[];for(var _0x29694a in _0xe4b96b[_0xb253('0x56')]){if(_0xe4b96b[_0xb253('0x56')][_0xb253('0x50')](_0x29694a)){var _0xd57260=_0xe4b96b[_0xb253('0x56')][_0x29694a];var _0x549e4c={'id':_0xd57260['id'],'available':_0xd57260['available'],'loggedIn':_0xd57260['loggedIn'],'name':_0xd57260['name'],'paused':_0xd57260[_0xb253('0x57')],'waiting':_0xd57260[_0xb253('0x58')]};_0x443380['push'](_0x549e4c);}}_0x4fe049({'count':_0x443380[_0xb253('0x1e')],'rows':_0x443380});});},'MailQueues':function(){return new Promise(function(_0x4f9210){var _0x240264=[];for(var _0x21ae98 in _0xe4b96b[_0xb253('0x59')]){if(_0xe4b96b[_0xb253('0x59')]['hasOwnProperty'](_0x21ae98)){var _0x562a78=_0xe4b96b[_0xb253('0x59')][_0x21ae98];var _0x557124={'id':_0x562a78['id'],'available':_0x562a78['available'],'loggedIn':_0x562a78['loggedIn'],'name':_0x562a78[_0xb253('0x5a')],'paused':_0x562a78[_0xb253('0x57')],'waiting':_0x562a78[_0xb253('0x58')]};_0x240264[_0xb253('0x25')](_0x557124);}}_0x4f9210({'count':_0x240264[_0xb253('0x1e')],'rows':_0x240264});});},'OpenchannelQueues':function(){return new Promise(function(_0x871c5a){var _0x5900d3=[];for(var _0x5b76ca in _0xe4b96b[_0xb253('0x5b')]){if(_0xe4b96b[_0xb253('0x5b')][_0xb253('0x50')](_0x5b76ca)){var _0x579c88=_0xe4b96b['openchannelQueues'][_0x5b76ca];var _0x2b1601={'id':_0x579c88['id'],'available':_0x579c88[_0xb253('0x5c')],'loggedIn':_0x579c88['loggedIn'],'name':_0x579c88[_0xb253('0x5a')],'paused':_0x579c88[_0xb253('0x57')],'waiting':_0x579c88['waiting']};_0x5900d3[_0xb253('0x25')](_0x2b1601);}}_0x871c5a({'count':_0x5900d3[_0xb253('0x1e')],'rows':_0x5900d3});});},'SmsQueues':function(){return new Promise(function(_0x415e5c){var _0x59d6cb=[];for(var _0x29462d in _0xe4b96b['smsQueues']){if(_0xe4b96b[_0xb253('0x5d')][_0xb253('0x50')](_0x29462d)){var _0x17a46b=_0xe4b96b['smsQueues'][_0x29462d];var _0x41468c={'id':_0x17a46b['id'],'available':_0x17a46b[_0xb253('0x5c')],'loggedIn':_0x17a46b[_0xb253('0x5e')],'name':_0x17a46b[_0xb253('0x5a')],'paused':_0x17a46b[_0xb253('0x57')],'waiting':_0x17a46b[_0xb253('0x58')]};_0x59d6cb['push'](_0x41468c);}}_0x415e5c({'count':_0x59d6cb[_0xb253('0x1e')],'rows':_0x59d6cb});});},'FaxQueues':function(){return new Promise(function(_0x283a30){var _0x17ccf8=[];for(var _0x403976 in _0xe4b96b[_0xb253('0x5f')]){if(_0xe4b96b[_0xb253('0x5f')][_0xb253('0x50')](_0x403976)){var _0x4a7fdb=_0xe4b96b[_0xb253('0x5f')][_0x403976];var _0x2e0eda={'id':_0x4a7fdb['id'],'available':_0x4a7fdb['available'],'loggedIn':_0x4a7fdb['loggedIn'],'name':_0x4a7fdb[_0xb253('0x5a')],'paused':_0x4a7fdb[_0xb253('0x57')],'waiting':_0x4a7fdb[_0xb253('0x58')]};_0x17ccf8['push'](_0x2e0eda);}}_0x283a30({'count':_0x17ccf8[_0xb253('0x1e')],'rows':_0x17ccf8});});},'WhatsappQueues':function(){return new Promise(function(_0x2cf170){var _0x195523=[];for(var _0x90e4dc in _0xe4b96b[_0xb253('0x60')]){if(_0xe4b96b[_0xb253('0x60')]['hasOwnProperty'](_0x90e4dc)){var _0x3b3a0b=_0xe4b96b[_0xb253('0x60')][_0x90e4dc];var _0x32559e={'id':_0x3b3a0b['id'],'available':_0x3b3a0b['available'],'loggedIn':_0x3b3a0b['loggedIn'],'name':_0x3b3a0b[_0xb253('0x5a')],'paused':_0x3b3a0b[_0xb253('0x57')],'waiting':_0x3b3a0b[_0xb253('0x58')]};_0x195523[_0xb253('0x25')](_0x32559e);}}_0x2cf170({'count':_0x195523[_0xb253('0x1e')],'rows':_0x195523});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x11e251){var _0x168fef=_[_0xb253('0x54')](_0xe4b96b[_0xb253('0x61')]);_0x11e251({'count':_0x168fef[_0xb253('0x1e')],'rows':_0x168fef});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x1fe1d1){var _0x1bb7d3=_['values'](_0xe4b96b[_0xb253('0x62')]);_0x1fe1d1({'count':_0x1bb7d3[_0xb253('0x1e')],'rows':_0x1bb7d3});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x5a25fc){var _0xd1ea79=_['values'](_0xe4b96b[_0xb253('0x63')]);_0x5a25fc({'count':_0xd1ea79[_0xb253('0x1e')],'rows':_0xd1ea79});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x4e7705){var _0x175cbf=_[_0xb253('0x54')](_0xe4b96b[_0xb253('0x64')]);_0x4e7705({'count':_0x175cbf['length'],'rows':_0x175cbf});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x267eaa){var _0x4a0fdd=_['values'](_0xe4b96b['faxQueuesWaitingInteractions']);_0x267eaa({'count':_0x4a0fdd[_0xb253('0x1e')],'rows':_0x4a0fdd});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0xe5f59c){var _0x4beaa2=_['values'](_0xe4b96b[_0xb253('0x65')]);_0xe5f59c({'count':_0x4beaa2[_0xb253('0x1e')],'rows':_0x4beaa2});});}};var _0x156c32=jayson['server'](_0x4bb04f)[_0xb253('0x66')]();_0x156c32['on'](_0xb253('0x46'),function(_0x29d03e){logger['error'](JSON[_0xb253('0x67')](_0x29d03e));return _0x353b8e(_0x29d03e);});_0x156c32[_0xb253('0x16')](0x232c,_0xb253('0x68'),function(){console['log']('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x37ed21(_0xb253('0x69')+0x232c);});});}; \ No newline at end of file +var _0x4955=['./interval','condition','./applications/','consequence','info','Push\x20new\x20rule','on\x20interval','intervals','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','agent','agents','busy','busyQueue','end','QueueReport','update','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','listen','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','bluebird','./applications/utils','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','rules','channel','message','applications','length','join','app','.js','toLowerCase','appdata','push','slice','dialogflowv2','split','amazonlex','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','interaction','body'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x4955,0x157));var _0x5495=function(_0x579a21,_0x178f7f){_0x579a21=_0x579a21-0x0;var _0x4c71c8=_0x4955[_0x579a21];return _0x4c71c8;};'use strict';var _=require(_0x5495('0x0'));var util=require('util');var path=require('path');var fs=require('fs');var jayson=require(_0x5495('0x1'));var BPromise=require(_0x5495('0x2'));var utils=require(_0x5495('0x3'));var sUtils=require('./applications/strategy/util');var logger=require(_0x5495('0x4'))(_0x5495('0x5'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x5495('0x6')),'chatQueueReport':require(_0x5495('0x7')),'smsQueueReport':require(_0x5495('0x8')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x5495('0x9'));function getId(_0x18069c,_0x110213,_0x34d9e6){return util[_0x5495('0xa')](_0x5495('0xb'),_0x18069c,_0x110213||0x0,_0x34d9e6||0x0);}function getIntervals(_0x29ff2f,_0x474349){var _0x1afc59=[];if(!_[_0x5495('0xc')](_0x474349[_0x5495('0xd')])&&!_[_0x5495('0xc')](_0x29ff2f[_0x474349[_0x5495('0xd')]])&&!_[_0x5495('0xc')](_0x29ff2f[_0x474349[_0x5495('0xd')]][_0x5495('0xe')])){_0x1afc59=_[_0x5495('0xf')](_0x29ff2f[_0x474349[_0x5495('0xd')]][_0x5495('0xe')],'interval');}else if(!_[_0x5495('0xc')](_0x474349[_0x5495('0x10')])){_0x1afc59=[_0x474349[_0x5495('0x10')]];}return _0x1afc59;}exports['listen']=function(_0x1bee35){_0x1bee35[_0x5495('0x11')]={};return new BPromise(function(_0x15abb0,_0x29a8e9){var _0xdd3efd={'Start':function(_0x7600e7){var _0x23c902=this;return new Promise(function(_0x2720c7,_0x175f2b){if(_0x7600e7){try{var _0x5717eb=[];var _0xf3b234=getId(_0x7600e7[_0x5495('0x12')],_0x7600e7[_0x5495('0x13')]?_0x7600e7[_0x5495('0x13')]['id']:0x0,_0x7600e7['interaction']?_0x7600e7['interaction']['id']:0x0);var _0x1a7e5d=sUtils['checkWaitingNotifications'](_0x1bee35,_0x7600e7);if(!_0x1a7e5d&&_0x7600e7[_0x5495('0x14')]&&_['isArray'](_0x7600e7[_0x5495('0x14')])&&_0x7600e7[_0x5495('0x14')][_0x5495('0x15')]){for(var _0x18ac47=0x0;_0x18ac47<_0x7600e7[_0x5495('0x14')][_0x5495('0x15')];_0x18ac47+=0x1){var _0x2be404=_0x7600e7[_0x5495('0x14')][_0x18ac47];if(fs['existsSync'](path[_0x5495('0x16')](__dirname,_0x5495('0x14'),_0x2be404[_0x5495('0x17')]+_0x5495('0x18')))){var _0x275982=[];switch(_0x2be404['app'][_0x5495('0x19')]()){case'autoreply':var _0x20bf6d=_0x2be404[_0x5495('0x1a')]['split'](',');if(_0x7600e7['channel']==='mail'){_0x275982[_0x5495('0x1b')](_0x20bf6d[0x0]);_0x275982[_0x5495('0x1b')](_0x20bf6d[0x1]);_0x275982[_0x5495('0x1b')](_0x20bf6d[_0x5495('0x1c')](0x2,_0x20bf6d[_0x5495('0x15')])[_0x5495('0x16')](','));}else{_0x275982['push'](_0x20bf6d[0x0]);_0x275982['push'](_0x20bf6d[_0x5495('0x1c')](0x1,_0x20bf6d[_0x5495('0x15')])['join'](','));}break;case'dialogflow':var _0x5f4220=_0x2be404['appdata']['split'](',');_0x275982[_0x5495('0x1b')](_0x5f4220[0x0]);_0x275982[_0x5495('0x1b')](_0x5f4220[0x1]);_0x275982['push'](_0x5f4220['slice'](0x2,_0x5f4220[_0x5495('0x15')])[_0x5495('0x16')](','));break;case _0x5495('0x1d'):var _0x113033=_0x2be404['appdata'][_0x5495('0x1e')](',');_0x275982['push'](_0x113033[0x0]);_0x275982[_0x5495('0x1b')](_0x113033[0x1]);_0x275982[_0x5495('0x1b')](_0x113033[0x2]);_0x275982[_0x5495('0x1b')](_0x113033[0x3]);_0x275982['push'](_0x113033[_0x5495('0x1c')](0x4,_0x113033[_0x5495('0x15')])[_0x5495('0x16')](','));break;case _0x5495('0x1f'):var _0x17cdba=_0x2be404[_0x5495('0x1a')][_0x5495('0x1e')](',');_0x275982[_0x5495('0x1b')](_0x17cdba[0x0]);_0x275982['push'](_0x17cdba[0x1]);_0x275982[_0x5495('0x1b')](_0x17cdba[0x2]);_0x275982[_0x5495('0x1b')](_0x17cdba[0x3]);_0x275982[_0x5495('0x1b')](_0x17cdba[_0x5495('0x1c')](0x4,_0x17cdba[_0x5495('0x15')])[_0x5495('0x16')](','));break;case _0x5495('0x13'):_0x275982[_0x5495('0x1b')](_0x2be404[_0x5495('0x1a')]);break;case _0x5495('0x20'):_0x275982['push'](_0x2be404[_0x5495('0x21')]);_0x275982[_0x5495('0x1b')](_0x2be404[_0x5495('0x1a')]);break;case _0x5495('0x22'):var _0x3ac8b8=utils[_0x5495('0x23')](_0x7600e7[_0x5495('0x24')][_0x5495('0x25')],_0x7600e7);var _0x407153=_0x2be404['appdata'][_0x5495('0x1e')](',');_0x275982[_0x5495('0x1b')](_0x407153[0x0]);_0x275982['push'](_0x407153[0x1]);_0x275982['push'](_0x407153[0x2]);_0x275982[_0x5495('0x1b')](_0x407153[0x3]);_0x275982[_0x5495('0x1b')](_0x407153[0x4]);_0x275982[_0x5495('0x1b')](_0x407153[0x5]);_0x275982['push'](_0x407153[0x6]);_0x275982[_0x5495('0x1b')](_0x407153[0x7]);_0x275982[_0x5495('0x1b')](_0x407153[0x8]);_0x275982[_0x5495('0x1b')](_0x407153[0x9]);_0x275982[_0x5495('0x1b')](_0x407153[0xa]);_0x275982[_0x5495('0x1b')](_0x7600e7['interaction']['id']);_0x275982[_0x5495('0x1b')](_0x7600e7[_0x5495('0x13')]['id']);_0x275982[_0x5495('0x1b')](_0x2be404[_0x5495('0x26')]);_0x275982[_0x5495('0x1b')](_0x7600e7[_0x5495('0x27')]['ContactId']);_0x275982[_0x5495('0x1b')](_0x7600e7[_0x5495('0x28')][_0x5495('0x28')]);_0x275982[_0x5495('0x1b')](_0x3ac8b8);break;default:_0x275982=_['isNil'](_0x2be404[_0x5495('0x1a')])?[]:_0x2be404['appdata']['split'](',');}var _0x2d4801={'id':util[_0x5495('0xa')]('%s:%s:%s',_0xf3b234,_0x2be404['id'],_0x2be404['app']),'condition':require(_0x5495('0x29'))[_0x5495('0x2a')](_0xf3b234,getIntervals(_0x1bee35['intervals'],_0x2be404),_0x1bee35),'consequence':require(_0x5495('0x2b')+_0x2be404[_0x5495('0x17')])[_0x5495('0x2c')](_0xf3b234,_0x275982,_0x1bee35,_0x7600e7),'p':_0x2be404['priority']||0x0};logger[_0x5495('0x2d')](_0x5495('0x2e'),_0x2d4801['id'],_0x5495('0x2f'),getIntervals(_0x1bee35[_0x5495('0x30')],_0x2be404)['join'](_0x5495('0x31')));_0x5717eb[_0x5495('0x1b')](_0x2d4801);}else{logger[_0x5495('0x32')](_0x5495('0x33'),path[_0x5495('0x16')](__dirname,_0x5495('0x14'),_0x2be404[_0x5495('0x17')]+_0x5495('0x18')));}}_0x1bee35[_0x5495('0x11')][_0xf3b234]=new RuleEngine(_0x5717eb);_0x1bee35[_0x5495('0x11')][_0xf3b234][_0x5495('0x34')](_0x7600e7,function(_0x28d63e){logger[_0x5495('0x2d')](_0x5495('0x35'),JSON[_0x5495('0x36')](_0x28d63e[_0x5495('0x37')]));if(_0x1bee35[_0x5495('0x11')][_0xf3b234]){_0x1bee35[_0x5495('0x11')][_0xf3b234][_0x5495('0x38')](_0x5495('0x39'));}});return _0x2720c7({'code':0xc8,'message':_0x7600e7});}else{if(_0x1a7e5d){logger['info'](util['format']('Skipped\x20routing\x20for\x20%s',_0xf3b234));}else{logger[_0x5495('0x2d')](_0x5495('0x3a'));}return _0x2720c7({'code':0xc8,'message':_0x7600e7});}}catch(_0x19ff74){logger[_0x5495('0x32')](_0x19ff74[_0x5495('0x3b')]);return _0x175f2b(_0x23c902[_0x5495('0x32')](0x1f4,_0x19ff74));}}return _0x175f2b('routing\x20is\x20empty');});},'AcceptMessage':function(_0x4fa402){var _0x7903da=this;return new Promise(function(_0x552e63,_0x445882){if(_0x4fa402[_0x5495('0x3c')]&&_0x4fa402[_0x5495('0x3c')]['id']){if(_0x1bee35[_0x5495('0x3d')][_0x4fa402['agent']['id']]){_0x1bee35[_0x5495('0x3d')][_0x4fa402[_0x5495('0x3c')]['id']][_0x5495('0x3e')]=![];_0x1bee35['agents'][_0x4fa402['agent']['id']][_0x5495('0x3f')]=undefined;}}if(_0x4fa402[_0x5495('0x13')]&&_0x4fa402[_0x5495('0x13')]['id']){try{var _0x503728=getId(_0x4fa402[_0x5495('0x12')],_0x4fa402['message']?_0x4fa402[_0x5495('0x13')]['id']:0x0,_0x4fa402[_0x5495('0x27')]?_0x4fa402[_0x5495('0x27')]['id']:0x0);if(_0x1bee35[_0x5495('0x11')][_0x503728]){_0x1bee35[_0x5495('0x11')][_0x503728][_0x5495('0x38')](_0x5495('0x40'));if(rpc[_0x4fa402[_0x5495('0x12')]+_0x5495('0x41')]){rpc[_0x4fa402[_0x5495('0x12')]+'QueueReport'][_0x5495('0x42')](_0x503728,{'UserId':_0x4fa402[_0x5495('0x13')]['UserId']})[_0x5495('0x43')](function(){logger[_0x5495('0x32')](_0x5495('0x44'));});}}return _0x552e63({'code':0xc8,'message':_0x4fa402});}catch(_0x46be12){logger['error'](_0x46be12['stack']);return _0x445882(_0x7903da[_0x5495('0x32')](0x1f4,_0x46be12));}}logger[_0x5495('0x32')](_0x5495('0x45'));return _0x445882(_0x7903da[_0x5495('0x32')](0x1f4,_0x5495('0x45')));});},'RejectMessage':function(_0x30aea){var _0x270c8c=this;return new Promise(function(_0x2e04a1,_0x3ac1ff){if(_0x30aea[_0x5495('0x3c')]&&_0x30aea['agent']['id']){try{if(_0x1bee35[_0x5495('0x3d')][_0x30aea[_0x5495('0x3c')]['id']]){_0x1bee35[_0x5495('0x3d')][_0x30aea['agent']['id']]['busy']=![];_0x1bee35[_0x5495('0x3d')][_0x30aea[_0x5495('0x3c')]['id']][_0x5495('0x3f')]=undefined;}return _0x2e04a1({'code':0xc8,'message':_0x30aea});}catch(_0x3fb583){logger[_0x5495('0x32')](_0x3fb583['stack']);return _0x3ac1ff(_0x270c8c[_0x5495('0x32')](0x1f4,_0x3fb583));}}logger[_0x5495('0x32')](_0x5495('0x45'));return _0x3ac1ff(_0x270c8c['error'](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0xc0bcb4){var _0x52c626=this;return new Promise(function(_0x434189,_0x1be667){if(_0xc0bcb4['channel']&&_0xc0bcb4[_0x5495('0x27')]&&_0xc0bcb4[_0x5495('0x27')]['id']){try{var _0x417e22=getId(_0xc0bcb4['channel'],_0xc0bcb4[_0x5495('0x13')]?_0xc0bcb4[_0x5495('0x13')]['id']:0x0,_0xc0bcb4['interaction']?_0xc0bcb4[_0x5495('0x27')]['id']:0x0);if(_0x1bee35[_0x5495('0x11')][_0x417e22]){_0x1bee35['rules'][_0x417e22][_0x5495('0x38')](_0x5495('0x40'));}return _0x434189({'code':0xc8,'message':_0xc0bcb4});}catch(_0x4cf6b0){logger[_0x5495('0x32')](_0x4cf6b0[_0x5495('0x3b')]);return _0x1be667(_0x52c626[_0x5495('0x32')](0x1f4,_0x4cf6b0));}}logger[_0x5495('0x32')](_0x5495('0x45'));return _0x1be667(_0x52c626[_0x5495('0x32')](0x1f4,_0x5495('0x45')));});},'AgentCapacity':function(_0x526ed1){var _0x8ac615=this;return new Promise(function(_0x4899a9,_0x5d85bd){if(_0x1bee35['agents']['hasOwnProperty'](_0x526ed1['id'])){for(var _0x41e9f9 in _0x526ed1[_0x5495('0x46')]){if(_0x526ed1[_0x5495('0x46')][_0x5495('0x47')](_0x41e9f9)){if(_0x1bee35[_0x5495('0x3d')][_0x526ed1['id']]['hasOwnProperty'](_0x41e9f9+_0x5495('0x48'))){_0x1bee35[_0x5495('0x3d')][_0x526ed1['id']][_0x41e9f9+_0x5495('0x48')]=parseInt(_0x526ed1[_0x5495('0x46')][_0x41e9f9],0xa);}}}_0x1bee35[_0x5495('0x3d')][_0x526ed1['id']][_0x5495('0x49')]();return _0x4899a9({'code':0xc8,'message':_0x1bee35[_0x5495('0x3d')][_0x526ed1['id']]});}else{return _0x5d85bd(_0x8ac615[_0x5495('0x32')](0x1f4,_0x5495('0x4a')));}});},'Agents':function(_0x284e96){return new Promise(function(_0x5d4462){var _0x54d84c=_[_0x5495('0x4b')](_0x1bee35[_0x5495('0x3d')]);if(_0x284e96&&_0x284e96['id']){var _0x1891c2=_[_0x5495('0x4c')](_0x54d84c,function(_0x40544c){return _0x40544c['id']===_0x284e96['id'];});_0x5d4462(_0x1891c2);}else{_0x5d4462({'count':_0x54d84c[_0x5495('0x15')],'rows':_0x54d84c});}});},'ChatQueues':function(){return new Promise(function(_0x4cba80){var _0x276631=[];for(var _0x439e33 in _0x1bee35[_0x5495('0x4d')]){if(_0x1bee35[_0x5495('0x4d')][_0x5495('0x47')](_0x439e33)){var _0x19ae0f=_0x1bee35[_0x5495('0x4d')][_0x439e33];var _0x5c42ce={'id':_0x19ae0f['id'],'available':_0x19ae0f[_0x5495('0x4e')],'loggedIn':_0x19ae0f[_0x5495('0x4f')],'name':_0x19ae0f[_0x5495('0x50')],'paused':_0x19ae0f[_0x5495('0x51')],'waiting':_0x19ae0f[_0x5495('0x52')]};_0x276631[_0x5495('0x1b')](_0x5c42ce);}}_0x4cba80({'count':_0x276631[_0x5495('0x15')],'rows':_0x276631});});},'MailQueues':function(){return new Promise(function(_0xb4212e){var _0x38549f=[];for(var _0x39fbb8 in _0x1bee35[_0x5495('0x53')]){if(_0x1bee35[_0x5495('0x53')][_0x5495('0x47')](_0x39fbb8)){var _0x55d6cd=_0x1bee35[_0x5495('0x53')][_0x39fbb8];var _0x1a4fc6={'id':_0x55d6cd['id'],'available':_0x55d6cd['available'],'loggedIn':_0x55d6cd['loggedIn'],'name':_0x55d6cd['name'],'paused':_0x55d6cd['paused'],'waiting':_0x55d6cd['waiting']};_0x38549f[_0x5495('0x1b')](_0x1a4fc6);}}_0xb4212e({'count':_0x38549f[_0x5495('0x15')],'rows':_0x38549f});});},'OpenchannelQueues':function(){return new Promise(function(_0x5f03ab){var _0x289905=[];for(var _0x20c755 in _0x1bee35['openchannelQueues']){if(_0x1bee35[_0x5495('0x54')]['hasOwnProperty'](_0x20c755)){var _0x32f94a=_0x1bee35[_0x5495('0x54')][_0x20c755];var _0x330e06={'id':_0x32f94a['id'],'available':_0x32f94a['available'],'loggedIn':_0x32f94a['loggedIn'],'name':_0x32f94a[_0x5495('0x50')],'paused':_0x32f94a['paused'],'waiting':_0x32f94a[_0x5495('0x52')]};_0x289905['push'](_0x330e06);}}_0x5f03ab({'count':_0x289905['length'],'rows':_0x289905});});},'SmsQueues':function(){return new Promise(function(_0xab6d3f){var _0x2a8e4e=[];for(var _0x310827 in _0x1bee35['smsQueues']){if(_0x1bee35[_0x5495('0x55')][_0x5495('0x47')](_0x310827)){var _0x3eda03=_0x1bee35[_0x5495('0x55')][_0x310827];var _0x353dc2={'id':_0x3eda03['id'],'available':_0x3eda03[_0x5495('0x4e')],'loggedIn':_0x3eda03[_0x5495('0x4f')],'name':_0x3eda03[_0x5495('0x50')],'paused':_0x3eda03['paused'],'waiting':_0x3eda03['waiting']};_0x2a8e4e['push'](_0x353dc2);}}_0xab6d3f({'count':_0x2a8e4e[_0x5495('0x15')],'rows':_0x2a8e4e});});},'FaxQueues':function(){return new Promise(function(_0x15e03e){var _0x548050=[];for(var _0x47f790 in _0x1bee35[_0x5495('0x56')]){if(_0x1bee35[_0x5495('0x56')][_0x5495('0x47')](_0x47f790)){var _0xf3f7d9=_0x1bee35[_0x5495('0x56')][_0x47f790];var _0xc0135e={'id':_0xf3f7d9['id'],'available':_0xf3f7d9[_0x5495('0x4e')],'loggedIn':_0xf3f7d9[_0x5495('0x4f')],'name':_0xf3f7d9['name'],'paused':_0xf3f7d9['paused'],'waiting':_0xf3f7d9[_0x5495('0x52')]};_0x548050[_0x5495('0x1b')](_0xc0135e);}}_0x15e03e({'count':_0x548050[_0x5495('0x15')],'rows':_0x548050});});},'WhatsappQueues':function(){return new Promise(function(_0x5b4e28){var _0x5a9d3c=[];for(var _0x447f8f in _0x1bee35[_0x5495('0x57')]){if(_0x1bee35['whatsappQueues'][_0x5495('0x47')](_0x447f8f)){var _0x3d2d40=_0x1bee35[_0x5495('0x57')][_0x447f8f];var _0x3901d8={'id':_0x3d2d40['id'],'available':_0x3d2d40[_0x5495('0x4e')],'loggedIn':_0x3d2d40[_0x5495('0x4f')],'name':_0x3d2d40[_0x5495('0x50')],'paused':_0x3d2d40[_0x5495('0x51')],'waiting':_0x3d2d40[_0x5495('0x52')]};_0x5a9d3c['push'](_0x3901d8);}}_0x5b4e28({'count':_0x5a9d3c[_0x5495('0x15')],'rows':_0x5a9d3c});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x4fb121){var _0x31cab7=_[_0x5495('0x4b')](_0x1bee35['chatQueuesWaitingInteractions']);_0x4fb121({'count':_0x31cab7[_0x5495('0x15')],'rows':_0x31cab7});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x5df289){var _0x28f1f2=_[_0x5495('0x4b')](_0x1bee35[_0x5495('0x58')]);_0x5df289({'count':_0x28f1f2[_0x5495('0x15')],'rows':_0x28f1f2});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x47efe9){var _0x35bd3a=_[_0x5495('0x4b')](_0x1bee35[_0x5495('0x59')]);_0x47efe9({'count':_0x35bd3a[_0x5495('0x15')],'rows':_0x35bd3a});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0xa8bc55){var _0x222ed8=_[_0x5495('0x4b')](_0x1bee35[_0x5495('0x5a')]);_0xa8bc55({'count':_0x222ed8[_0x5495('0x15')],'rows':_0x222ed8});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x42f8ad){var _0x183ca1=_['values'](_0x1bee35[_0x5495('0x5b')]);_0x42f8ad({'count':_0x183ca1['length'],'rows':_0x183ca1});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0xbe42c8){var _0xb1e93b=_[_0x5495('0x4b')](_0x1bee35['whatsappQueuesWaitingInteractions']);_0xbe42c8({'count':_0xb1e93b['length'],'rows':_0xb1e93b});});}};var _0x1da351=jayson[_0x5495('0x5c')](_0xdd3efd)[_0x5495('0x5d')]();_0x1da351['on'](_0x5495('0x32'),function(_0x36d3f6){logger['error'](JSON['stringify'](_0x36d3f6));return _0x29a8e9(_0x36d3f6);});_0x1da351[_0x5495('0x5e')](0x232c,'127.0.0.1',function(){console['log']('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x15abb0(_0x5495('0x5f')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index d4ce2d4..465dbd4 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 _0xca23=['then','error','message','catch','condition','rules','info','stop','push','format','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','log','bluebird','jayson/promise','../../../config/logger','http','request'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xca23,0xbb));var _0x3ca2=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0xca23[_0x20589d];return _0x422de9;};'use strict';var util=require('util');var BPromise=require(_0x3ca2('0x0'));var jayson=require(_0x3ca2('0x1'));var _=require('lodash');var logger=require(_0x3ca2('0x2'))('routing');var client=jayson['client'][_0x3ca2('0x3')]({'port':0x232a});function request(_0x3107c9,_0x25ff18){return new BPromise(function(_0x55d8e4,_0x32fdf1){return client[_0x3ca2('0x4')](_0x3107c9,_0x25ff18)[_0x3ca2('0x5')](function(_0x3cb905){if(_0x3cb905[_0x3ca2('0x6')]){return _0x32fdf1(_0x3cb905[_0x3ca2('0x6')][_0x3ca2('0x7')]);}else{return _0x55d8e4(_0x3cb905['result']);}})[_0x3ca2('0x8')](function(_0x293378){return _0x32fdf1(_0x293378);});});}exports[_0x3ca2('0x9')]=function(_0x411bcd,_0x42641f,_0x323fcb){return function(_0x412c2e){if(_0x323fcb[_0x3ca2('0xa')]&&!_0x323fcb[_0x3ca2('0xa')][_0x411bcd]){logger[_0x3ca2('0xb')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x411bcd);return _0x412c2e[_0x3ca2('0xc')]();}var _0x4f9c80=[];for(var _0x41c993=0x0;_0x41c993<_0x42641f['length'];_0x41c993+=0x1){_0x4f9c80[_0x3ca2('0xd')](request('Command',{'command':util[_0x3ca2('0xe')](_0x3ca2('0xf'),_0x42641f[_0x41c993])})[_0x3ca2('0x5')](function(_0x43890c){return _0x43890c&&_0x43890c['message']&&_0x43890c['message'][_0x3ca2('0x10')](_0x3ca2('0x11'))>=0x0?!![]:![];})[_0x3ca2('0x8')](function(_0x3d6b75){logger['error'](_0x3ca2('0x12'),_0x411bcd,_0x42641f[_0x41c993]);}));}BPromise['all'](_0x4f9c80)[_0x3ca2('0x5')](function(_0x4018d7){var _0x4a9cd7=_[_0x3ca2('0x13')](_0x4018d7);logger[_0x3ca2('0xb')](_0x3ca2('0x14'),_0x411bcd,_0x42641f[_0x3ca2('0x15')](_0x3ca2('0x16')),_0x4a9cd7);_0x412c2e['when'](_0x4a9cd7);})[_0x3ca2('0x8')](function(_0x1926c3){console[_0x3ca2('0x17')](_0x1926c3);logger[_0x3ca2('0x6')](_0x3ca2('0x14'),_0x411bcd,_0x42641f[_0x3ca2('0x15')](_0x3ca2('0x16')),_0x1926c3['stack']);_0x412c2e[_0x3ca2('0xc')]();});};}; \ No newline at end of file +var _0xef13=['catch','[%s][INTERVAL]\x20%s','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stop','util','bluebird','jayson/promise','../../../config/logger','routing','client','then','error','message','result','condition','rules','info','length','Command','true'];(function(_0x1af0e5,_0x152990){var _0x3c444a=function(_0x3b3d13){while(--_0x3b3d13){_0x1af0e5['push'](_0x1af0e5['shift']());}};_0x3c444a(++_0x152990);}(_0xef13,0x9f));var _0x3ef1=function(_0x2c1504,_0x31a3d8){_0x2c1504=_0x2c1504-0x0;var _0x75f0b9=_0xef13[_0x2c1504];return _0x75f0b9;};'use strict';var util=require(_0x3ef1('0x0'));var BPromise=require(_0x3ef1('0x1'));var jayson=require(_0x3ef1('0x2'));var _=require('lodash');var logger=require(_0x3ef1('0x3'))(_0x3ef1('0x4'));var client=jayson[_0x3ef1('0x5')]['http']({'port':0x232a});function request(_0xe76403,_0x5a3d40){return new BPromise(function(_0x283a18,_0x4e9669){return client['request'](_0xe76403,_0x5a3d40)[_0x3ef1('0x6')](function(_0x51bc2a){if(_0x51bc2a[_0x3ef1('0x7')]){return _0x4e9669(_0x51bc2a[_0x3ef1('0x7')][_0x3ef1('0x8')]);}else{return _0x283a18(_0x51bc2a[_0x3ef1('0x9')]);}})['catch'](function(_0x4cec5a){return _0x4e9669(_0x4cec5a);});});}exports[_0x3ef1('0xa')]=function(_0x58e0e2,_0x8a8657,_0x2216f1){return function(_0x795d80){if(_0x2216f1[_0x3ef1('0xb')]&&!_0x2216f1[_0x3ef1('0xb')][_0x58e0e2]){logger[_0x3ef1('0xc')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x58e0e2);return _0x795d80['stop']();}var _0x636eb5=[];for(var _0xe1e6d5=0x0;_0xe1e6d5<_0x8a8657[_0x3ef1('0xd')];_0xe1e6d5+=0x1){_0x636eb5['push'](request(_0x3ef1('0xe'),{'command':util['format']('iftime\x20%s',_0x8a8657[_0xe1e6d5])})['then'](function(_0x21f1c9){return _0x21f1c9&&_0x21f1c9[_0x3ef1('0x8')]&&_0x21f1c9[_0x3ef1('0x8')]['indexOf'](_0x3ef1('0xf'))>=0x0?!![]:![];})[_0x3ef1('0x10')](function(_0x171916){logger[_0x3ef1('0x7')](_0x3ef1('0x11'),_0x58e0e2,_0x8a8657[_0xe1e6d5]);}));}BPromise['all'](_0x636eb5)[_0x3ef1('0x6')](function(_0x54d93d){var _0x255d01=_[_0x3ef1('0x12')](_0x54d93d);logger[_0x3ef1('0xc')](_0x3ef1('0x13'),_0x58e0e2,_0x8a8657[_0x3ef1('0x14')](_0x3ef1('0x15')),_0x255d01);_0x795d80[_0x3ef1('0x16')](_0x255d01);})[_0x3ef1('0x10')](function(_0x38ff9e){console[_0x3ef1('0x17')](_0x38ff9e);logger[_0x3ef1('0x7')]('[%s][INTERVAL]\x20%s\x20%s',_0x58e0e2,_0x8a8657[_0x3ef1('0x14')](_0x3ef1('0x15')),_0x38ff9e['stack']);_0x795d80[_0x3ef1('0x18')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index c75e9cf..a8ed95d 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 _0xbaf0=['includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','talktime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','agent','[%s][agents][hangup]','util','./utils','info','format','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','agentcalledAt','now','connectedlinename','error','agentringnoanswer','isNil','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','push','forIn'];(function(_0x34342a,_0x3e16f5){var _0x427cdf=function(_0x6aafbd){while(--_0x6aafbd){_0x34342a['push'](_0x34342a['shift']());}};_0x427cdf(++_0x3e16f5);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var utils=require(_0x0baf('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x1e212d,_0x263f79){utils[_0x0baf('0x2')](util[_0x0baf('0x3')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x1e212d[_0x0baf('0x4')],_0x1e212d[_0x0baf('0x5')],_0x1e212d[_0x0baf('0x6')],_0x1e212d[_0x0baf('0x7')],_0x1e212d[_0x0baf('0x8')],_0x1e212d[_0x0baf('0x9')],_0x1e212d[_0x0baf('0xa')],_0x1e212d[_0x0baf('0xb')]));if(_0x1e212d[_0x0baf('0x6')]){utils['getVoiceQueueByName'](_0x1e212d[_0x0baf('0x6')])['then'](function(_0x4605c3){if(_0x4605c3){_0x1e212d[_0x0baf('0xc')]=_0x4605c3[_0x0baf('0xc')];_0x1e212d[_0x0baf('0xd')]=_0x1e212d[_0x0baf('0xe')]?_0x4605c3[_0x0baf('0xf')]:![];_0x1e212d[_0x0baf('0x10')]=_0x1e212d[_0x0baf('0xd')]?_0x4605c3[_0x0baf('0x11')]:0x0;}utils[_0x0baf('0x12')](_0x0baf('0x13'),_0x1e212d);});}else{utils['request']('CreateVoiceAgentReport',_0x1e212d);}if(_0x263f79){delete transfers[_0x1e212d[_0x0baf('0x4')]];}else{delete agents[_0x1e212d[_0x0baf('0x14')]];}}exports[_0x0baf('0x15')]=function(_0x13df17){try{utils['debug'](util[_0x0baf('0x3')]('[%s][agents][agentcalled]',_0x13df17[_0x0baf('0x4')]),_0x13df17);agents[_0x13df17[_0x0baf('0x14')]]=_0x13df17;agents[_0x13df17[_0x0baf('0x14')]][_0x0baf('0x16')]=utils[_0x0baf('0x17')]();agents[_0x13df17[_0x0baf('0x14')]]['lastevent']='called';agents[_0x13df17[_0x0baf('0x14')]][_0x0baf('0xa')]=null;agents[_0x13df17[_0x0baf('0x14')]][_0x0baf('0x18')]=null;utils[_0x0baf('0x2')](util[_0x0baf('0x3')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x13df17[_0x0baf('0x4')],agents[_0x13df17[_0x0baf('0x14')]][_0x0baf('0x7')],_0x13df17[_0x0baf('0x14')]));}catch(_0x47070d){utils[_0x0baf('0x19')](util['format']('[%s][agents][agentcalled]',_0x13df17[_0x0baf('0x4')]),_0x47070d);}};exports[_0x0baf('0x1a')]=function(_0x32e839){try{if(!_[_0x0baf('0x1b')](agents[_0x32e839[_0x0baf('0x14')]])){utils[_0x0baf('0x1c')](util[_0x0baf('0x3')](_0x0baf('0x1d'),_0x32e839[_0x0baf('0x4')]),_0x32e839);utils[_0x0baf('0x2')](util['format'](_0x0baf('0x1e'),_0x32e839['uniqueid'],agents[_0x32e839[_0x0baf('0x14')]]['membername'],_0x32e839['destuniqueid']));agents[_0x32e839[_0x0baf('0x14')]]['agentringnoanswer']=!![];agents[_0x32e839['destuniqueid']][_0x0baf('0x1f')]=utils[_0x0baf('0x17')]();agents[_0x32e839[_0x0baf('0x14')]][_0x0baf('0xb')]=_0x0baf('0x20');agents[_0x32e839['destuniqueid']][_0x0baf('0x21')]=_0x0baf('0x20');agents[_0x32e839[_0x0baf('0x14')]][_0x0baf('0x22')]=_0x32e839[_0x0baf('0x23')]?parseInt(_0x32e839[_0x0baf('0x23')])/0x3e8:0x0;agents[_0x32e839[_0x0baf('0x14')]]['talktime']=0x0;unanswered[_0x0baf('0x24')](_0x32e839[_0x0baf('0x14')]);}}catch(_0xcaf13d){utils[_0x0baf('0x19')](util['format'](_0x0baf('0x1d'),_0x32e839[_0x0baf('0x4')]),_0xcaf13d);}};exports['queuecallerabandon']=function(_0x44ec31){try{_[_0x0baf('0x25')](agents,function(_0x478ce8,_0xb4dbb1){if(_0x478ce8[_0x0baf('0x4')]==_0x44ec31[_0x0baf('0x4')]&&!_[_0x0baf('0x26')](unanswered,_0x478ce8['destuniqueid'])){utils[_0x0baf('0x1c')](util[_0x0baf('0x3')](_0x0baf('0x27'),_0x44ec31[_0x0baf('0x4')]),_0x44ec31);utils[_0x0baf('0x2')](util[_0x0baf('0x3')](_0x0baf('0x28'),_0x44ec31[_0x0baf('0x4')],_0x478ce8[_0x0baf('0x7')],_0x478ce8[_0x0baf('0x14')]));_0x478ce8[_0x0baf('0x1a')]=!![];_0x478ce8[_0x0baf('0x1f')]=utils[_0x0baf('0x17')]();_0x478ce8[_0x0baf('0xb')]='abandoned';_0x478ce8[_0x0baf('0x21')]='abandoned';_0x478ce8[_0x0baf('0x22')]=_0x44ec31[_0x0baf('0x22')];_0x478ce8[_0x0baf('0x29')]=0x0;writeDB(_0x478ce8);}});}catch(_0x3d65f2){utils['error'](util[_0x0baf('0x3')](_0x0baf('0x27'),_0x44ec31['uniqueid']),_0x3d65f2);}};exports[_0x0baf('0x2a')]=function(_0x2447c2){try{if(agents[_0x2447c2[_0x0baf('0x14')]]){utils[_0x0baf('0x1c')](util[_0x0baf('0x3')](_0x0baf('0x2b'),_0x2447c2[_0x0baf('0x4')]),_0x2447c2);utils[_0x0baf('0x2')](util['format'](_0x0baf('0x2c'),_0x2447c2[_0x0baf('0x4')],agents[_0x2447c2['destuniqueid']][_0x0baf('0x7')],_0x2447c2['destuniqueid']));agents[_0x2447c2['destuniqueid']][_0x0baf('0x2d')]=utils[_0x0baf('0x17')]();agents[_0x2447c2['destuniqueid']]['connectedlinenum']=_0x2447c2[_0x0baf('0xa')];agents[_0x2447c2[_0x0baf('0x14')]][_0x0baf('0x18')]=_0x2447c2[_0x0baf('0x18')];agents[_0x2447c2[_0x0baf('0x14')]][_0x0baf('0x22')]=_0x2447c2[_0x0baf('0x23')];agents[_0x2447c2[_0x0baf('0x14')]][_0x0baf('0xb')]=_0x0baf('0x2e');_[_0x0baf('0x25')](agents,function(_0x148540,_0x354cb1){if(_0x148540[_0x0baf('0x14')]!=_0x2447c2['destuniqueid']&&_0x148540[_0x0baf('0x4')]==_0x2447c2[_0x0baf('0x4')]){_0x148540['talktime']=0x0;_0x148540[_0x0baf('0x22')]=_0x2447c2[_0x0baf('0x23')];_0x148540[_0x0baf('0x1a')]=!![];_0x148540[_0x0baf('0x1f')]=utils[_0x0baf('0x17')]();_0x148540[_0x0baf('0xb')]='answered_elsewhere';_0x148540[_0x0baf('0x21')]=_0x0baf('0x2f');_0x148540['answeredelsewheredestinationuniqueid']=_0x2447c2[_0x0baf('0x14')];_0x148540[_0x0baf('0x30')]=_0x2447c2[_0x0baf('0x7')];writeDB(_0x148540);}});}}catch(_0x57903e){utils['error'](util[_0x0baf('0x3')](_0x0baf('0x2b'),_0x2447c2[_0x0baf('0x4')]),_0x57903e);}};exports[_0x0baf('0xe')]=function(_0x2b6d54){try{if(!_[_0x0baf('0x1b')](agents[_0x2b6d54[_0x0baf('0x14')]])){utils[_0x0baf('0x1c')](util[_0x0baf('0x3')](_0x0baf('0x31'),_0x2b6d54['uniqueid']),_0x2b6d54);utils[_0x0baf('0x2')](util[_0x0baf('0x3')](_0x0baf('0x32'),_0x2b6d54[_0x0baf('0x4')],agents[_0x2b6d54[_0x0baf('0x14')]]['membername'],_0x2b6d54[_0x0baf('0x14')]));agents[_0x2b6d54[_0x0baf('0x14')]][_0x0baf('0xe')]=!![];agents[_0x2b6d54[_0x0baf('0x14')]][_0x0baf('0x33')]=utils['now']();agents[_0x2b6d54[_0x0baf('0x14')]][_0x0baf('0x29')]=utils[_0x0baf('0x34')](agents[_0x2b6d54[_0x0baf('0x14')]][_0x0baf('0x33')],agents[_0x2b6d54[_0x0baf('0x14')]][_0x0baf('0x2d')]);agents[_0x2b6d54['destuniqueid']][_0x0baf('0x21')]=_0x2b6d54[_0x0baf('0x21')];agents[_0x2b6d54[_0x0baf('0x14')]]['lastevent']=_0x0baf('0x35');writeDB(agents[_0x2b6d54[_0x0baf('0x14')]]);}}catch(_0x10fa62){utils[_0x0baf('0x19')](util[_0x0baf('0x3')](_0x0baf('0x31'),_0x2b6d54[_0x0baf('0x4')]),_0x10fa62);}};exports['blindtransfer']=function(_0x22c451){try{if(!_[_0x0baf('0x1b')](agents[_0x22c451[_0x0baf('0x36')]])){utils[_0x0baf('0x1c')](util[_0x0baf('0x3')](_0x0baf('0x37'),_0x22c451[_0x0baf('0x4')]),_0x22c451);utils[_0x0baf('0x2')](util[_0x0baf('0x3')](_0x0baf('0x38'),_0x22c451[_0x0baf('0x4')],agents[_0x22c451['transfereruniqueid']]['membername'],agents[_0x22c451[_0x0baf('0x36')]][_0x0baf('0x4')]));agents[_0x22c451[_0x0baf('0x36')]][_0x0baf('0x39')]=!![];agents[_0x22c451[_0x0baf('0x36')]][_0x0baf('0x3a')]=_0x0baf('0x3b');agents[_0x22c451['transfereruniqueid']][_0x0baf('0x3c')]=_0x22c451[_0x0baf('0x3d')];agents[_0x22c451[_0x0baf('0x36')]][_0x0baf('0x3e')]=agents[_0x22c451[_0x0baf('0x36')]][_0x0baf('0x4')];}}catch(_0x5e1849){utils[_0x0baf('0x19')](util['format'](_0x0baf('0x37'),_0x22c451['uniqueid']),_0x5e1849);}};exports[_0x0baf('0x3f')]=function(_0x5eaeb2){try{utils[_0x0baf('0x1c')](util['format'](_0x0baf('0x40'),_0x5eaeb2[_0x0baf('0x41')]),_0x5eaeb2);if(_0x5eaeb2[_0x0baf('0x41')]==_0x5eaeb2[_0x0baf('0x42')]){if(!_[_0x0baf('0x1b')](agents[_0x5eaeb2['secondtransfereruniqueid']])){utils[_0x0baf('0x2')](util[_0x0baf('0x3')](_0x0baf('0x43'),_0x5eaeb2[_0x0baf('0x41')],agents[_0x5eaeb2[_0x0baf('0x44')]][_0x0baf('0x7')]));agents[_0x5eaeb2['secondtransfereruniqueid']][_0x0baf('0x39')]=!![];agents[_0x5eaeb2[_0x0baf('0x44')]][_0x0baf('0x3a')]=_0x0baf('0x45');agents[_0x5eaeb2[_0x0baf('0x44')]][_0x0baf('0x3c')]=_0x5eaeb2[_0x0baf('0x46')];agents[_0x5eaeb2['secondtransfereruniqueid']]['transferuniqueid']=_0x5eaeb2[_0x0baf('0x41')];}if(_0x5eaeb2[_0x0baf('0x47')]&&agents[_0x5eaeb2[_0x0baf('0x47')]]){agents[_0x5eaeb2[_0x0baf('0x47')]][_0x0baf('0x48')]=0x1;transfers[_0x5eaeb2[_0x0baf('0x47')]]=_[_0x0baf('0x49')](agents[_0x5eaeb2[_0x0baf('0x47')]]);transfers[_0x5eaeb2[_0x0baf('0x47')]]['calleridnum']=agents[_0x5eaeb2[_0x0baf('0x44')]][_0x0baf('0x9')];transfers[_0x5eaeb2[_0x0baf('0x47')]][_0x0baf('0x4a')]=agents[_0x5eaeb2[_0x0baf('0x44')]][_0x0baf('0x4a')];transfers[_0x5eaeb2[_0x0baf('0x47')]]['agentcalledAt']=utils[_0x0baf('0x17')]();transfers[_0x5eaeb2[_0x0baf('0x47')]][_0x0baf('0x2d')]=utils[_0x0baf('0x17')]();transfers[_0x5eaeb2[_0x0baf('0x47')]][_0x0baf('0x22')]=0x0;transfers[_0x5eaeb2[_0x0baf('0x47')]][_0x0baf('0x48')]=0x2;}}else if(_0x5eaeb2['secondtransfereruniqueid']==_0x5eaeb2[_0x0baf('0x4b')]){if(!_['isNil'](agents[_0x5eaeb2[_0x0baf('0x41')]])){utils['info'](util['format'](_0x0baf('0x43'),_0x5eaeb2['origtransfereruniqueid'],agents[_0x5eaeb2[_0x0baf('0x41')]][_0x0baf('0x7')]));agents[_0x5eaeb2['origtransfereruniqueid']][_0x0baf('0x39')]=!![];agents[_0x5eaeb2[_0x0baf('0x41')]][_0x0baf('0x3a')]='ATTENDED';agents[_0x5eaeb2['origtransfereruniqueid']][_0x0baf('0x3c')]=_0x5eaeb2[_0x0baf('0x4c')];agents[_0x5eaeb2[_0x0baf('0x41')]][_0x0baf('0x3e')]=_0x5eaeb2[_0x0baf('0x44')];}if(_0x5eaeb2['transfertargetuniqueid']&&agents[_0x5eaeb2[_0x0baf('0x4d')]]){agents[_0x5eaeb2['transfertargetuniqueid']]['agententerreason']=0x1;transfers[_0x5eaeb2['transfertargetuniqueid']]=_[_0x0baf('0x49')](agents[_0x5eaeb2['transfertargetuniqueid']]);transfers[_0x5eaeb2['transfertargetuniqueid']][_0x0baf('0x9')]=agents[_0x5eaeb2[_0x0baf('0x41')]][_0x0baf('0x9')];transfers[_0x5eaeb2[_0x0baf('0x4d')]][_0x0baf('0x4a')]=agents[_0x5eaeb2[_0x0baf('0x41')]]['calleridname'];transfers[_0x5eaeb2[_0x0baf('0x4d')]][_0x0baf('0x16')]=utils[_0x0baf('0x17')]();transfers[_0x5eaeb2[_0x0baf('0x4d')]][_0x0baf('0x2d')]=utils[_0x0baf('0x17')]();transfers[_0x5eaeb2['transfertargetuniqueid']][_0x0baf('0x22')]=0x0;transfers[_0x5eaeb2[_0x0baf('0x4d')]][_0x0baf('0x48')]=0x2;}}}catch(_0x5d4053){utils[_0x0baf('0x19')](util[_0x0baf('0x3')](_0x0baf('0x40'),_0x5eaeb2[_0x0baf('0x41')]),_0x5d4053);}};exports[_0x0baf('0x4e')]=function(_0x27a959){try{utils[_0x0baf('0x1c')](util['format']('[%s][agents][hangup]',_0x27a959['uniqueid']),_0x27a959);if(agents[_0x27a959[_0x0baf('0x4')]]&&agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x21')]===_0x0baf('0x20')){if(_0x27a959[_0x0baf('0x4f')]==='21'){agents[_0x27a959[_0x0baf('0x4')]]['reason']='rejected';agents[_0x27a959[_0x0baf('0x4')]]['lastevent']=_0x0baf('0x50');}utils[_0x0baf('0x2')](util['format'](_0x0baf('0x51'),_0x27a959[_0x0baf('0x4')],agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x7')],agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x21')],agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0xb')]));writeDB(agents[_0x27a959[_0x0baf('0x4')]]);var _0x5ea0f3=unanswered['indexOf'](_0x27a959['uniqueid']);if(_0x5ea0f3>-0x1){unanswered['splice'](_0x5ea0f3,0x1);}}if(transfers[_0x27a959['uniqueid']]){transfers[_0x27a959[_0x0baf('0x4')]][_0x0baf('0xe')]=!![];transfers[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x33')]=utils['now']();transfers[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x29')]=utils['diffTime'](transfers[_0x27a959['uniqueid']][_0x0baf('0x33')],transfers[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x2d')]);transfers[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x21')]=_0x0baf('0x52');transfers[_0x27a959[_0x0baf('0x4')]][_0x0baf('0xb')]='complete';utils[_0x0baf('0x2')](util[_0x0baf('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x27a959[_0x0baf('0x4')],transfers[_0x27a959[_0x0baf('0x4')]]['membername'],transfers[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x21')],transfers[_0x27a959[_0x0baf('0x4')]][_0x0baf('0xb')]));writeDB(transfers[_0x27a959[_0x0baf('0x4')]],!![]);}if(agents[_0x27a959['uniqueid']]&&agents[_0x27a959['uniqueid']][_0x0baf('0x2d')]){agents[_0x27a959[_0x0baf('0x4')]]['agentcomplete']=!![];agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x33')]=utils[_0x0baf('0x17')]();agents[_0x27a959['uniqueid']][_0x0baf('0x29')]=utils[_0x0baf('0x34')](agents[_0x27a959[_0x0baf('0x4')]]['agentcompleteAt'],agents[_0x27a959[_0x0baf('0x4')]]['agentconnectAt']);agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x21')]=agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x39')]?_0x0baf('0x39'):'agent';agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0xb')]='complete';utils[_0x0baf('0x2')](util[_0x0baf('0x3')](_0x0baf('0x51'),_0x27a959[_0x0baf('0x4')],agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x7')],agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x21')],agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0xb')]));writeDB(agents[_0x27a959[_0x0baf('0x4')]]);}}catch(_0x2c2f09){utils['error'](util['format'](_0x0baf('0x53'),_0x27a959[_0x0baf('0x4')]),_0x2c2f09);}}; \ No newline at end of file +var _0xde2c=['[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','reason','agentconnect','[%s][agents][agentconnect]','agentconnectAt','connect','answered_elsewhere','diffTime','agentcompleteAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','transfereeuniqueid','clone','calleridname','agententerreason','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','lastevent','getVoiceQueueByName','type','agentacw','agentcomplete','acw','acwtime','request','CreateVoiceAgentReport','uniqueid','destuniqueid','agentcalledAt','now','called','connectedlinenum','connectedlinename','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','timeout','holdtime','ringtime','talktime','push','forIn','debug','[%s][agents][queuecallerabandon]'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0xde2c,0x7f));var _0xcde2=function(_0x60286b,_0x3247c1){_0x60286b=_0x60286b-0x0;var _0x5dff69=_0xde2c[_0x60286b];return _0x5dff69;};'use strict';var _=require(_0xcde2('0x0'));var util=require(_0xcde2('0x1'));var utils=require(_0xcde2('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x1a777c,_0x7595ed){utils[_0xcde2('0x3')](util[_0xcde2('0x4')](_0xcde2('0x5'),_0x1a777c['uniqueid'],_0x1a777c[_0xcde2('0x6')],_0x1a777c[_0xcde2('0x7')],_0x1a777c[_0xcde2('0x8')],_0x1a777c[_0xcde2('0x9')],_0x1a777c[_0xcde2('0xa')],_0x1a777c['connectedlinenum'],_0x1a777c[_0xcde2('0xb')]));if(_0x1a777c[_0xcde2('0x7')]){utils[_0xcde2('0xc')](_0x1a777c['queue'])['then'](function(_0x13ca2e){if(_0x13ca2e){_0x1a777c[_0xcde2('0xd')]=_0x13ca2e['type'];_0x1a777c[_0xcde2('0xe')]=_0x1a777c[_0xcde2('0xf')]?_0x13ca2e[_0xcde2('0x10')]:![];_0x1a777c[_0xcde2('0x11')]=_0x1a777c['agentacw']?_0x13ca2e['acwTimeout']:0x0;}utils[_0xcde2('0x12')](_0xcde2('0x13'),_0x1a777c);});}else{utils[_0xcde2('0x12')](_0xcde2('0x13'),_0x1a777c);}if(_0x7595ed){delete transfers[_0x1a777c[_0xcde2('0x14')]];}else{delete agents[_0x1a777c[_0xcde2('0x15')]];}}exports['agentcalled']=function(_0x211215){try{utils['debug'](util[_0xcde2('0x4')]('[%s][agents][agentcalled]',_0x211215['uniqueid']),_0x211215);agents[_0x211215[_0xcde2('0x15')]]=_0x211215;agents[_0x211215[_0xcde2('0x15')]][_0xcde2('0x16')]=utils[_0xcde2('0x17')]();agents[_0x211215[_0xcde2('0x15')]]['lastevent']=_0xcde2('0x18');agents[_0x211215['destuniqueid']][_0xcde2('0x19')]=null;agents[_0x211215[_0xcde2('0x15')]][_0xcde2('0x1a')]=null;utils[_0xcde2('0x3')](util['format']('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x211215['uniqueid'],agents[_0x211215[_0xcde2('0x15')]]['membername'],_0x211215[_0xcde2('0x15')]));}catch(_0x6cda4e){utils[_0xcde2('0x1b')](util['format'](_0xcde2('0x1c'),_0x211215[_0xcde2('0x14')]),_0x6cda4e);}};exports[_0xcde2('0x1d')]=function(_0x3c1d7e){try{if(!_[_0xcde2('0x1e')](agents[_0x3c1d7e['destuniqueid']])){utils['debug'](util['format'](_0xcde2('0x1f'),_0x3c1d7e[_0xcde2('0x14')]),_0x3c1d7e);utils[_0xcde2('0x3')](util[_0xcde2('0x4')](_0xcde2('0x20'),_0x3c1d7e['uniqueid'],agents[_0x3c1d7e[_0xcde2('0x15')]]['membername'],_0x3c1d7e[_0xcde2('0x15')]));agents[_0x3c1d7e[_0xcde2('0x15')]][_0xcde2('0x1d')]=!![];agents[_0x3c1d7e['destuniqueid']]['agentringnoanswerAt']=utils[_0xcde2('0x17')]();agents[_0x3c1d7e[_0xcde2('0x15')]][_0xcde2('0xb')]=_0xcde2('0x21');agents[_0x3c1d7e[_0xcde2('0x15')]]['reason']=_0xcde2('0x21');agents[_0x3c1d7e[_0xcde2('0x15')]][_0xcde2('0x22')]=_0x3c1d7e['ringtime']?parseInt(_0x3c1d7e[_0xcde2('0x23')])/0x3e8:0x0;agents[_0x3c1d7e[_0xcde2('0x15')]][_0xcde2('0x24')]=0x0;unanswered[_0xcde2('0x25')](_0x3c1d7e[_0xcde2('0x15')]);}}catch(_0x5b2b7){utils[_0xcde2('0x1b')](util[_0xcde2('0x4')]('[%s][agents][agentringnoanswer]',_0x3c1d7e[_0xcde2('0x14')]),_0x5b2b7);}};exports['queuecallerabandon']=function(_0x141072){try{_[_0xcde2('0x26')](agents,function(_0x43706c,_0x49cb58){if(_0x43706c[_0xcde2('0x14')]==_0x141072[_0xcde2('0x14')]&&!_['includes'](unanswered,_0x43706c[_0xcde2('0x15')])){utils[_0xcde2('0x27')](util[_0xcde2('0x4')](_0xcde2('0x28'),_0x141072[_0xcde2('0x14')]),_0x141072);utils[_0xcde2('0x3')](util[_0xcde2('0x4')](_0xcde2('0x29'),_0x141072['uniqueid'],_0x43706c[_0xcde2('0x8')],_0x43706c[_0xcde2('0x15')]));_0x43706c[_0xcde2('0x1d')]=!![];_0x43706c[_0xcde2('0x2a')]=utils['now']();_0x43706c[_0xcde2('0xb')]=_0xcde2('0x2b');_0x43706c[_0xcde2('0x2c')]=_0xcde2('0x2b');_0x43706c['holdtime']=_0x141072[_0xcde2('0x22')];_0x43706c[_0xcde2('0x24')]=0x0;writeDB(_0x43706c);}});}catch(_0x29e3e0){utils[_0xcde2('0x1b')](util['format'](_0xcde2('0x28'),_0x141072[_0xcde2('0x14')]),_0x29e3e0);}};exports[_0xcde2('0x2d')]=function(_0x3090b6){try{if(agents[_0x3090b6[_0xcde2('0x15')]]){utils['debug'](util[_0xcde2('0x4')](_0xcde2('0x2e'),_0x3090b6[_0xcde2('0x14')]),_0x3090b6);utils[_0xcde2('0x3')](util['format']('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x3090b6[_0xcde2('0x14')],agents[_0x3090b6[_0xcde2('0x15')]][_0xcde2('0x8')],_0x3090b6[_0xcde2('0x15')]));agents[_0x3090b6[_0xcde2('0x15')]][_0xcde2('0x2f')]=utils[_0xcde2('0x17')]();agents[_0x3090b6[_0xcde2('0x15')]][_0xcde2('0x19')]=_0x3090b6['connectedlinenum'];agents[_0x3090b6[_0xcde2('0x15')]][_0xcde2('0x1a')]=_0x3090b6[_0xcde2('0x1a')];agents[_0x3090b6[_0xcde2('0x15')]][_0xcde2('0x22')]=_0x3090b6['ringtime'];agents[_0x3090b6['destuniqueid']][_0xcde2('0xb')]=_0xcde2('0x30');_[_0xcde2('0x26')](agents,function(_0x383899,_0x144de9){if(_0x383899[_0xcde2('0x15')]!=_0x3090b6['destuniqueid']&&_0x383899['uniqueid']==_0x3090b6['uniqueid']){_0x383899[_0xcde2('0x24')]=0x0;_0x383899[_0xcde2('0x22')]=_0x3090b6[_0xcde2('0x23')];_0x383899[_0xcde2('0x1d')]=!![];_0x383899[_0xcde2('0x2a')]=utils[_0xcde2('0x17')]();_0x383899[_0xcde2('0xb')]='answered_elsewhere';_0x383899['reason']=_0xcde2('0x31');_0x383899['answeredelsewheredestinationuniqueid']=_0x3090b6[_0xcde2('0x15')];_0x383899['answeredelsewheremembername']=_0x3090b6[_0xcde2('0x8')];writeDB(_0x383899);}});}}catch(_0x3239a0){utils[_0xcde2('0x1b')](util['format'](_0xcde2('0x2e'),_0x3090b6['uniqueid']),_0x3239a0);}};exports[_0xcde2('0xf')]=function(_0x24a46a){try{if(!_[_0xcde2('0x1e')](agents[_0x24a46a[_0xcde2('0x15')]])){utils[_0xcde2('0x27')](util[_0xcde2('0x4')]('[%s][agents][agentcomplete]',_0x24a46a['uniqueid']),_0x24a46a);utils[_0xcde2('0x3')](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x24a46a[_0xcde2('0x14')],agents[_0x24a46a['destuniqueid']][_0xcde2('0x8')],_0x24a46a[_0xcde2('0x15')]));agents[_0x24a46a['destuniqueid']][_0xcde2('0xf')]=!![];agents[_0x24a46a['destuniqueid']]['agentcompleteAt']=utils[_0xcde2('0x17')]();agents[_0x24a46a[_0xcde2('0x15')]]['talktime']=utils[_0xcde2('0x32')](agents[_0x24a46a['destuniqueid']][_0xcde2('0x33')],agents[_0x24a46a[_0xcde2('0x15')]][_0xcde2('0x2f')]);agents[_0x24a46a[_0xcde2('0x15')]][_0xcde2('0x2c')]=_0x24a46a['reason'];agents[_0x24a46a[_0xcde2('0x15')]][_0xcde2('0xb')]=_0xcde2('0x34');writeDB(agents[_0x24a46a[_0xcde2('0x15')]]);}}catch(_0x47f8c3){utils['error'](util[_0xcde2('0x4')]('[%s][agents][agentcomplete]',_0x24a46a[_0xcde2('0x14')]),_0x47f8c3);}};exports[_0xcde2('0x35')]=function(_0x381bd4){try{if(!_[_0xcde2('0x1e')](agents[_0x381bd4[_0xcde2('0x36')]])){utils[_0xcde2('0x27')](util['format'](_0xcde2('0x37'),_0x381bd4['uniqueid']),_0x381bd4);utils[_0xcde2('0x3')](util['format'](_0xcde2('0x38'),_0x381bd4[_0xcde2('0x14')],agents[_0x381bd4[_0xcde2('0x36')]][_0xcde2('0x8')],agents[_0x381bd4[_0xcde2('0x36')]][_0xcde2('0x14')]));agents[_0x381bd4['transfereruniqueid']][_0xcde2('0x39')]=!![];agents[_0x381bd4['transfereruniqueid']][_0xcde2('0x3a')]=_0xcde2('0x3b');agents[_0x381bd4[_0xcde2('0x36')]][_0xcde2('0x3c')]=_0x381bd4[_0xcde2('0x3d')];agents[_0x381bd4[_0xcde2('0x36')]][_0xcde2('0x3e')]=agents[_0x381bd4[_0xcde2('0x36')]][_0xcde2('0x14')];}}catch(_0x21585a){utils[_0xcde2('0x1b')](util[_0xcde2('0x4')]('[%s][agents][blindtransfer]',_0x381bd4['uniqueid']),_0x21585a);}};exports['attendedtransfer']=function(_0x16502d){try{utils['debug'](util[_0xcde2('0x4')](_0xcde2('0x3f'),_0x16502d[_0xcde2('0x40')]),_0x16502d);if(_0x16502d['origtransfereruniqueid']==_0x16502d[_0xcde2('0x41')]){if(!_['isNil'](agents[_0x16502d[_0xcde2('0x42')]])){utils['info'](util[_0xcde2('0x4')](_0xcde2('0x43'),_0x16502d['origtransfereruniqueid'],agents[_0x16502d[_0xcde2('0x42')]]['membername']));agents[_0x16502d['secondtransfereruniqueid']][_0xcde2('0x39')]=!![];agents[_0x16502d[_0xcde2('0x42')]][_0xcde2('0x3a')]=_0xcde2('0x44');agents[_0x16502d[_0xcde2('0x42')]][_0xcde2('0x3c')]=_0x16502d['origtransfererexten'];agents[_0x16502d[_0xcde2('0x42')]][_0xcde2('0x3e')]=_0x16502d[_0xcde2('0x40')];}if(_0x16502d[_0xcde2('0x45')]&&agents[_0x16502d[_0xcde2('0x45')]]){agents[_0x16502d[_0xcde2('0x45')]]['agententerreason']=0x1;transfers[_0x16502d['transfereeuniqueid']]=_[_0xcde2('0x46')](agents[_0x16502d[_0xcde2('0x45')]]);transfers[_0x16502d[_0xcde2('0x45')]][_0xcde2('0xa')]=agents[_0x16502d['secondtransfereruniqueid']][_0xcde2('0xa')];transfers[_0x16502d[_0xcde2('0x45')]][_0xcde2('0x47')]=agents[_0x16502d[_0xcde2('0x42')]][_0xcde2('0x47')];transfers[_0x16502d[_0xcde2('0x45')]]['agentcalledAt']=utils[_0xcde2('0x17')]();transfers[_0x16502d[_0xcde2('0x45')]]['agentconnectAt']=utils[_0xcde2('0x17')]();transfers[_0x16502d[_0xcde2('0x45')]][_0xcde2('0x22')]=0x0;transfers[_0x16502d[_0xcde2('0x45')]][_0xcde2('0x48')]=0x2;}}else if(_0x16502d[_0xcde2('0x42')]==_0x16502d[_0xcde2('0x49')]){if(!_[_0xcde2('0x1e')](agents[_0x16502d[_0xcde2('0x40')]])){utils[_0xcde2('0x3')](util['format'](_0xcde2('0x43'),_0x16502d[_0xcde2('0x40')],agents[_0x16502d['origtransfereruniqueid']][_0xcde2('0x8')]));agents[_0x16502d[_0xcde2('0x40')]][_0xcde2('0x39')]=!![];agents[_0x16502d['origtransfereruniqueid']][_0xcde2('0x3a')]=_0xcde2('0x44');agents[_0x16502d[_0xcde2('0x40')]][_0xcde2('0x3c')]=_0x16502d[_0xcde2('0x4a')];agents[_0x16502d[_0xcde2('0x40')]][_0xcde2('0x3e')]=_0x16502d[_0xcde2('0x42')];}if(_0x16502d[_0xcde2('0x4b')]&&agents[_0x16502d[_0xcde2('0x4b')]]){agents[_0x16502d[_0xcde2('0x4b')]]['agententerreason']=0x1;transfers[_0x16502d['transfertargetuniqueid']]=_[_0xcde2('0x46')](agents[_0x16502d[_0xcde2('0x4b')]]);transfers[_0x16502d[_0xcde2('0x4b')]]['calleridnum']=agents[_0x16502d['origtransfereruniqueid']]['calleridnum'];transfers[_0x16502d[_0xcde2('0x4b')]][_0xcde2('0x47')]=agents[_0x16502d[_0xcde2('0x40')]][_0xcde2('0x47')];transfers[_0x16502d[_0xcde2('0x4b')]][_0xcde2('0x16')]=utils['now']();transfers[_0x16502d['transfertargetuniqueid']][_0xcde2('0x2f')]=utils[_0xcde2('0x17')]();transfers[_0x16502d[_0xcde2('0x4b')]][_0xcde2('0x22')]=0x0;transfers[_0x16502d[_0xcde2('0x4b')]][_0xcde2('0x48')]=0x2;}}}catch(_0x45fc0c){utils[_0xcde2('0x1b')](util[_0xcde2('0x4')](_0xcde2('0x3f'),_0x16502d[_0xcde2('0x40')]),_0x45fc0c);}};exports[_0xcde2('0x4c')]=function(_0xa71d46){try{utils[_0xcde2('0x27')](util[_0xcde2('0x4')](_0xcde2('0x4d'),_0xa71d46[_0xcde2('0x14')]),_0xa71d46);if(agents[_0xa71d46[_0xcde2('0x14')]]&&agents[_0xa71d46[_0xcde2('0x14')]][_0xcde2('0x2c')]==='timeout'){if(_0xa71d46[_0xcde2('0x4e')]==='21'){agents[_0xa71d46[_0xcde2('0x14')]][_0xcde2('0x2c')]=_0xcde2('0x4f');agents[_0xa71d46[_0xcde2('0x14')]]['lastevent']=_0xcde2('0x4f');}utils['info'](util[_0xcde2('0x4')](_0xcde2('0x50'),_0xa71d46[_0xcde2('0x14')],agents[_0xa71d46[_0xcde2('0x14')]][_0xcde2('0x8')],agents[_0xa71d46[_0xcde2('0x14')]][_0xcde2('0x2c')],agents[_0xa71d46['uniqueid']]['lastevent']));writeDB(agents[_0xa71d46[_0xcde2('0x14')]]);var _0x5942c9=unanswered[_0xcde2('0x51')](_0xa71d46[_0xcde2('0x14')]);if(_0x5942c9>-0x1){unanswered[_0xcde2('0x52')](_0x5942c9,0x1);}}if(transfers[_0xa71d46[_0xcde2('0x14')]]){transfers[_0xa71d46[_0xcde2('0x14')]][_0xcde2('0xf')]=!![];transfers[_0xa71d46[_0xcde2('0x14')]]['agentcompleteAt']=utils[_0xcde2('0x17')]();transfers[_0xa71d46[_0xcde2('0x14')]][_0xcde2('0x24')]=utils[_0xcde2('0x32')](transfers[_0xa71d46['uniqueid']][_0xcde2('0x33')],transfers[_0xa71d46[_0xcde2('0x14')]][_0xcde2('0x2f')]);transfers[_0xa71d46[_0xcde2('0x14')]][_0xcde2('0x2c')]=_0xcde2('0x53');transfers[_0xa71d46[_0xcde2('0x14')]][_0xcde2('0xb')]=_0xcde2('0x34');utils[_0xcde2('0x3')](util[_0xcde2('0x4')](_0xcde2('0x50'),_0xa71d46[_0xcde2('0x14')],transfers[_0xa71d46['uniqueid']][_0xcde2('0x8')],transfers[_0xa71d46[_0xcde2('0x14')]][_0xcde2('0x2c')],transfers[_0xa71d46[_0xcde2('0x14')]][_0xcde2('0xb')]));writeDB(transfers[_0xa71d46[_0xcde2('0x14')]],!![]);}if(agents[_0xa71d46[_0xcde2('0x14')]]&&agents[_0xa71d46[_0xcde2('0x14')]][_0xcde2('0x2f')]){agents[_0xa71d46[_0xcde2('0x14')]][_0xcde2('0xf')]=!![];agents[_0xa71d46[_0xcde2('0x14')]][_0xcde2('0x33')]=utils[_0xcde2('0x17')]();agents[_0xa71d46[_0xcde2('0x14')]][_0xcde2('0x24')]=utils['diffTime'](agents[_0xa71d46['uniqueid']][_0xcde2('0x33')],agents[_0xa71d46[_0xcde2('0x14')]][_0xcde2('0x2f')]);agents[_0xa71d46[_0xcde2('0x14')]]['reason']=agents[_0xa71d46[_0xcde2('0x14')]]['transfer']?_0xcde2('0x39'):'agent';agents[_0xa71d46[_0xcde2('0x14')]][_0xcde2('0xb')]='complete';utils[_0xcde2('0x3')](util[_0xcde2('0x4')](_0xcde2('0x50'),_0xa71d46['uniqueid'],agents[_0xa71d46[_0xcde2('0x14')]][_0xcde2('0x8')],agents[_0xa71d46[_0xcde2('0x14')]][_0xcde2('0x2c')],agents[_0xa71d46['uniqueid']]['lastevent']));writeDB(agents[_0xa71d46[_0xcde2('0x14')]]);}}catch(_0x3fa065){utils[_0xcde2('0x1b')](util[_0xcde2('0x4')](_0xcde2('0x4d'),_0xa71d46[_0xcde2('0x14')]),_0x3fa065);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index f533ef2..10ff8a3 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 _0x46a0=['toLowerCase','cdr','substring','lastIndexOf','includes','noop','set','gotoif','lastdata','lodash','./utils','NO\x20ANSWER','FAILED','ANSWERED','uniqueid','blinds','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','calleridnum','lastevent','accountcode','getUserByInternal','then','UserId','CreateVoiceCallReport','request','recording','newchannel','debug','format','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','error','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','duration','diffTime','starttime','billableseconds','attendedtransfer','[%s][calls][attendedtransfer]','localtwolinkedid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','transfertargetchannel','origtransfererchannel','userfield','_attended','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','now','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','startsWith'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x46a0,0xe3));var _0x046a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x46a0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x046a('0x0'));var util=require('util');var utils=require(_0x046a('0x1'));var transfers=require('./transfers.controller');var dispositions=[_0x046a('0x2'),_0x046a('0x3'),_0x046a('0x3'),'NO\x20ANSWER',_0x046a('0x2'),_0x046a('0x2'),_0x046a('0x4'),'BUSY','FAILED',_0x046a('0x3'),_0x046a('0x3')];var channels={};function writeDB(_0x6e3311){var _0x1fd243;if(transfers['blinds'][_0x6e3311[_0x046a('0x5')]]){_0x1fd243=_0x6e3311[_0x046a('0x5')];_0x6e3311[_0x046a('0x5')]=transfers[_0x046a('0x6')][_0x6e3311[_0x046a('0x5')]]['transfereeuniqueid'];}utils['info'](util['format'](_0x046a('0x7'),_0x6e3311[_0x046a('0x5')],_0x6e3311[_0x046a('0x8')],_0x6e3311[_0x046a('0x9')],_0x6e3311[_0x046a('0xa')],_0x6e3311['interface'],_0x6e3311[_0x046a('0xb')],_0x6e3311['connectedlinenum'],_0x6e3311[_0x046a('0xc')]));if(_0x6e3311[_0x046a('0xd')]){utils[_0x046a('0xe')](_0x6e3311['accountcode'])[_0x046a('0xf')](function(_0x35221f){if(_0x35221f){_0x6e3311[_0x046a('0x10')]=_0x35221f['id'];}utils['request'](_0x046a('0x11'),_0x6e3311);});}else{utils[_0x046a('0x12')](_0x046a('0x11'),_0x6e3311);}if(channels[_0x6e3311[_0x046a('0x5')]]){delete channels[_0x6e3311[_0x046a('0x5')]];}else if(_0x1fd243&&channels[_0x1fd243]){if(!transfers[_0x046a('0x6')][_0x1fd243][_0x046a('0x13')])delete transfers['blinds'][_0x1fd243];delete channels[_0x1fd243];}}exports[_0x046a('0x14')]=function(_0x308658){try{utils[_0x046a('0x15')](util[_0x046a('0x16')](_0x046a('0x17'),_0x308658[_0x046a('0x5')]),_0x308658);if(_0x308658['uniqueid']==_0x308658[_0x046a('0x18')]&&_0x308658[_0x046a('0x8')]!=_0x046a('0x19')){utils[_0x046a('0x1a')](util[_0x046a('0x16')](_0x046a('0x1b'),_0x308658[_0x046a('0x5')],_0x308658[_0x046a('0x1c')],_0x308658['exten']));channels[_0x308658['uniqueid']]={'uniqueid':_0x308658[_0x046a('0x5')],'accountcode':_0x308658['accountcode'],'source':_0x308658[_0x046a('0xb')],'destination':_0x308658[_0x046a('0x1d')],'destinationcontext':_0x308658[_0x046a('0x1c')],'channel':_0x308658[_0x046a('0x8')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x046a('0x2'),'amaflags':'DOCUMENTATION'};}}catch(_0x33200b){utils[_0x046a('0x1e')](util[_0x046a('0x16')](_0x046a('0x17'),_0x308658['uniqueid']),_0x33200b);}};exports[_0x046a('0x1f')]=function(_0x3181d6){try{utils['debug'](util[_0x046a('0x16')](_0x046a('0x20'),_0x3181d6[_0x046a('0x5')]),_0x3181d6);if(!_[_0x046a('0x21')](channels[_0x3181d6[_0x046a('0x5')]])&&_0x3181d6[_0x046a('0x22')]==0x6){utils[_0x046a('0x1a')](util['format'](_0x046a('0x23'),_0x3181d6['uniqueid'],_0x3181d6[_0x046a('0x1c')],_0x3181d6[_0x046a('0x8')]));if(_[_0x046a('0x21')](channels[_0x3181d6[_0x046a('0x5')]][_0x046a('0x24')])){channels[_0x3181d6[_0x046a('0x5')]][_0x046a('0x24')]=utils['now']();}}else if(!_['isNil'](channels[_0x3181d6['linkedid']])&&_0x3181d6[_0x046a('0x22')]==0x6&&_0x3181d6[_0x046a('0x1c')]!=_0x046a('0x25')){utils[_0x046a('0x1a')](util[_0x046a('0x16')](_0x046a('0x26'),_0x3181d6[_0x046a('0x5')],_0x3181d6[_0x046a('0x18')],_0x3181d6[_0x046a('0x1c')],_0x3181d6[_0x046a('0x8')]));channels[_0x3181d6['linkedid']]['accountcode']=_0x3181d6[_0x046a('0xd')];channels[_0x3181d6[_0x046a('0x18')]][_0x046a('0x27')]=_0x3181d6[_0x046a('0x8')];if(_['isNil'](channels[_0x3181d6[_0x046a('0x18')]]['answertime'])){channels[_0x3181d6[_0x046a('0x18')]][_0x046a('0x28')]=utils['now']();}channels[_0x3181d6[_0x046a('0x18')]][_0x046a('0x29')]=dispositions[_[_0x046a('0x2a')](_0x3181d6[_0x046a('0x22')])]||_0x046a('0x4');}}catch(_0x992393){utils[_0x046a('0x1e')](util['format'](_0x046a('0x20'),_0x3181d6[_0x046a('0x5')]),_0x992393);}};exports[_0x046a('0x2b')]=function(_0x410055){try{if(!_[_0x046a('0x21')](channels[_0x410055['uniqueid']])){utils[_0x046a('0x15')](util['format'](_0x046a('0x2c'),_0x410055[_0x046a('0x5')]),_0x410055);if(_[_0x046a('0x21')](channels[_0x410055[_0x046a('0x5')]][_0x046a('0x2d')])){channels[_0x410055[_0x046a('0x5')]][_0x046a('0x2d')]=_0x410055[_0x046a('0x2e')]+'\x20<'+_0x410055['calleridnum']+'>';}utils['info'](util['format'](_0x046a('0x2f'),_0x410055[_0x046a('0x5')],channels[_0x410055[_0x046a('0x5')]]['callerid'],_0x410055[_0x046a('0x30')]));channels[_0x410055[_0x046a('0x5')]]['endtime']=utils['now']();channels[_0x410055[_0x046a('0x5')]][_0x046a('0x31')]=utils[_0x046a('0x32')](channels[_0x410055[_0x046a('0x5')]]['endtime'],channels[_0x410055[_0x046a('0x5')]][_0x046a('0x33')]);channels[_0x410055[_0x046a('0x5')]][_0x046a('0x34')]=channels[_0x410055[_0x046a('0x5')]][_0x046a('0x28')]?utils[_0x046a('0x32')](channels[_0x410055[_0x046a('0x5')]]['endtime'],channels[_0x410055[_0x046a('0x5')]][_0x046a('0x28')]):0x0;writeDB(channels[_0x410055['uniqueid']]);}}catch(_0x55cf87){utils[_0x046a('0x1e')](util[_0x046a('0x16')](_0x046a('0x2c'),_0x410055[_0x046a('0x5')]),_0x55cf87);}};exports[_0x046a('0x35')]=function(_0x78d294){try{if(!_[_0x046a('0x21')](channels[_0x78d294['localtwolinkedid']])){utils[_0x046a('0x15')](util['format'](_0x046a('0x36'),_0x78d294['origtransfereruniqueid']),_0x78d294);if(channels[_0x78d294[_0x046a('0x37')]][_0x046a('0x8')]==_0x78d294['transfereechannel']){utils['info'](util[_0x046a('0x16')](_0x046a('0x38'),_0x78d294[_0x046a('0x39')],_0x78d294['localtwolinkedid'],_0x78d294[_0x046a('0x3a')]));channels[_0x78d294[_0x046a('0x37')]][_0x046a('0x27')]=_0x78d294[_0x046a('0x3a')];channels[_0x78d294[_0x046a('0x37')]]['userfield']='_attended';}else if(channels[_0x78d294[_0x046a('0x37')]][_0x046a('0x8')]=_0x78d294[_0x046a('0x3b')]){utils[_0x046a('0x1a')](util['format'](_0x046a('0x38'),_0x78d294[_0x046a('0x39')],_0x78d294[_0x046a('0x37')],_0x78d294['origtransfererchannel']));channels[_0x78d294[_0x046a('0x37')]][_0x046a('0x27')]=_0x78d294[_0x046a('0x3c')];channels[_0x78d294[_0x046a('0x37')]][_0x046a('0x3d')]=_0x046a('0x3e');}}}catch(_0x1b9ff3){utils[_0x046a('0x1e')](util[_0x046a('0x16')](_0x046a('0x36'),_0x78d294[_0x046a('0x39')]),_0x1b9ff3);}};exports[_0x046a('0x3f')]=function(_0x24b458){try{if(!_[_0x046a('0x21')](channels[_0x24b458[_0x046a('0x5')]])){utils[_0x046a('0x15')](util[_0x046a('0x16')](_0x046a('0x40'),_0x24b458[_0x046a('0x5')]),_0x24b458);channels[_0x24b458[_0x046a('0x5')]][_0x046a('0x41')]=utils[_0x046a('0x42')]();utils['info'](util[_0x046a('0x16')](_0x046a('0x43'),_0x24b458['uniqueid'],channels[_0x24b458[_0x046a('0x5')]]['musiconholdstartAt']));}}catch(_0xb2add8){utils['error'](util[_0x046a('0x16')](_0x046a('0x40'),_0x24b458[_0x046a('0x5')]),_0xb2add8);}};exports[_0x046a('0x44')]=function(_0x23da87){try{if(!_['isNil'](channels[_0x23da87[_0x046a('0x5')]])){utils['debug'](util['format'](_0x046a('0x45'),_0x23da87[_0x046a('0x5')]),_0x23da87);if(!_[_0x046a('0x21')](channels[_0x23da87[_0x046a('0x5')]][_0x046a('0x41')])){channels[_0x23da87[_0x046a('0x5')]]['mohtime']+=utils[_0x046a('0x32')](utils[_0x046a('0x42')](),channels[_0x23da87['uniqueid']][_0x046a('0x41')]);utils['info'](util[_0x046a('0x16')](_0x046a('0x46'),_0x23da87[_0x046a('0x5')],channels[_0x23da87[_0x046a('0x5')]][_0x046a('0x47')]));delete channels[_0x23da87[_0x046a('0x5')]]['musiconholdstartAt'];}}}catch(_0x23a7ff){utils[_0x046a('0x1e')](util[_0x046a('0x16')](_0x046a('0x45'),_0x23da87['uniqueid']),_0x23a7ff);}};exports['varset']=function(_0x172a50){try{if(!_[_0x046a('0x21')](channels[_0x172a50[_0x046a('0x5')]])){utils['debug'](util[_0x046a('0x16')](_0x046a('0x48'),_0x172a50[_0x046a('0x5')]),_0x172a50);if(!_[_0x046a('0x21')](_0x172a50[_0x046a('0x49')][_0x046a('0x4a')])){utils['info'](util['format'](_0x046a('0x4b'),_0x172a50[_0x046a('0x5')],_0x172a50[_0x046a('0x4c')]));channels[_0x172a50[_0x046a('0x5')]]['source']=_0x172a50[_0x046a('0x4c')];}if(!_[_0x046a('0x21')](_0x172a50['variable'][_0x046a('0x4d')])){utils[_0x046a('0x1a')](util['format'](_0x046a('0x4e'),_0x172a50[_0x046a('0x5')],_0x172a50['value']));channels[_0x172a50['uniqueid']][_0x046a('0x4f')]=_0x172a50[_0x046a('0x4c')];channels[_0x172a50['uniqueid']][_0x046a('0x2d')]='\x22'+_0x172a50['value']+_0x046a('0x50')+_0x172a50[_0x046a('0x4c')]+'>';}if(!_['isNil'](_0x172a50[_0x046a('0x49')][_0x046a('0x51')])||!_[_0x046a('0x21')](_0x172a50['variable'][_0x046a('0x52')])){utils[_0x046a('0x1a')](util[_0x046a('0x16')](_0x046a('0x53'),_0x172a50[_0x046a('0x5')],!_[_0x046a('0x21')](_0x172a50[_0x046a('0x49')][_0x046a('0x51')])?_0x046a('0x51'):_0x046a('0x52'),_0x172a50[_0x046a('0x4c')]));channels[_0x172a50[_0x046a('0x5')]][_0x046a('0x2d')]=_0x172a50['value'];}if(!_['isNil'](_0x172a50[_0x046a('0x49')][_0x046a('0x54')])||!_['isNil'](_0x172a50[_0x046a('0x49')][_0x046a('0x55')])){utils['info'](util[_0x046a('0x16')](_0x046a('0x53'),_0x172a50[_0x046a('0x5')],!_[_0x046a('0x21')](_0x172a50['variable'][_0x046a('0x54')])?_0x046a('0x54'):'xmcs-queue',_0x172a50['value']));channels[_0x172a50[_0x046a('0x5')]][_0x046a('0x56')]='Queue';channels[_0x172a50[_0x046a('0x5')]]['lastdata']=_0x172a50[_0x046a('0x4c')];channels[_0x172a50[_0x046a('0x5')]][_0x046a('0x9')]=!![];}if(!_[_0x046a('0x21')](_0x172a50[_0x046a('0x49')][_0x046a('0x57')])){utils['info'](util[_0x046a('0x16')](_0x046a('0x58'),_0x172a50[_0x046a('0x5')],_0x172a50[_0x046a('0x4c')]));channels[_0x172a50[_0x046a('0x5')]][_0x046a('0x59')]=_0x172a50[_0x046a('0x4c')];}if(!_[_0x046a('0x21')](_0x172a50[_0x046a('0x49')][_0x046a('0x5a')])){utils[_0x046a('0x1a')](util[_0x046a('0x16')](_0x046a('0x5b'),_0x172a50[_0x046a('0x5')],_0x172a50[_0x046a('0x4c')]));channels[_0x172a50[_0x046a('0x5')]]['type']=_0x172a50[_0x046a('0x4c')];}if(!_[_0x046a('0x21')](_0x172a50[_0x046a('0x49')]['outboundrouteid'])){utils['info'](util['format'](_0x046a('0x5c'),_0x172a50[_0x046a('0x5')],_0x172a50['value']));channels[_0x172a50[_0x046a('0x5')]][_0x046a('0x5d')]=_0x172a50['value'];}if(!_[_0x046a('0x21')](_0x172a50['variable'][_0x046a('0x5e')])){utils[_0x046a('0x1a')](util['format']('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x172a50['uniqueid'],_0x172a50[_0x046a('0x4c')]));channels[_0x172a50[_0x046a('0x5')]][_0x046a('0x5e')]=_0x172a50['value'];}}}catch(_0x111672){utils['error'](util[_0x046a('0x16')](_0x046a('0x48'),_0x172a50[_0x046a('0x5')]),_0x111672);}};exports['newexten']=function(_0x309b96){try{if(!_[_0x046a('0x21')](channels[_0x309b96[_0x046a('0x5')]])){utils[_0x046a('0x15')](util[_0x046a('0x16')](_0x046a('0x5f'),_0x309b96[_0x046a('0x5')]),_0x309b96);utils['info'](util[_0x046a('0x16')](_0x046a('0x60'),_0x309b96[_0x046a('0x5')],_0x309b96[_0x046a('0x61')],_0x309b96[_0x046a('0x62')]));if(_0x309b96['application']['toLowerCase']()=='set'&&_[_0x046a('0x63')](_0x309b96[_0x046a('0x62')][_0x046a('0x64')](),_0x046a('0x65'))){var _0x3e857f=_0x309b96['appdata']['split']('=');var _0x190da4=_0x3e857f[0x0][_0x046a('0x66')](_0x3e857f[0x0][_0x046a('0x67')]('(')+0x1,_0x3e857f[0x0][_0x046a('0x67')](')'));var _0x3f5c26=_0x3e857f[0x1];channels[_0x309b96[_0x046a('0x5')]][_0x190da4]=_0x3f5c26;}if(!_[_0x046a('0x68')]([_0x046a('0x2b'),_0x046a('0x69'),'execif',_0x046a('0x6a'),_0x046a('0x6b')],_0x309b96[_0x046a('0x61')]['toLowerCase']())){channels[_0x309b96[_0x046a('0x5')]][_0x046a('0x56')]=_0x309b96[_0x046a('0x61')];channels[_0x309b96['uniqueid']][_0x046a('0x6c')]=_0x309b96[_0x046a('0x62')];}}}catch(_0x180160){utils[_0x046a('0x1e')](util[_0x046a('0x16')](_0x046a('0x5f'),_0x309b96['uniqueid']),_0x180160);}}; \ No newline at end of file +var _0x90b1=['source','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','routeid','sipcallid','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','substring','noop','execif','gotoif','lodash','util','./utils','FAILED','NO\x20ANSWER','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','membername','interface','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','recording','[%s][calls][newchannel]','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','systemanswertime','linkedid','channelstate','transfer','destinationchannel','answertime','toNumber','ANSWERED','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','duration','diffTime','billableseconds','debug','origtransfereruniqueid','localtwolinkedid','secondtransfererchannel','_attended','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','userfield','[%s][calls][attendedtransfer]','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value'];(function(_0x79ef34,_0x42d1a1){var _0x43d708=function(_0x36576e){while(--_0x36576e){_0x79ef34['push'](_0x79ef34['shift']());}};_0x43d708(++_0x42d1a1);}(_0x90b1,0x1bb));var _0x190b=function(_0x54de1b,_0x3cbe78){_0x54de1b=_0x54de1b-0x0;var _0x1fe2e2=_0x90b1[_0x54de1b];return _0x1fe2e2;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var utils=require(_0x190b('0x2'));var transfers=require('./transfers.controller');var dispositions=['NO\x20ANSWER',_0x190b('0x3'),_0x190b('0x3'),_0x190b('0x4'),_0x190b('0x4'),'NO\x20ANSWER','ANSWERED','BUSY','FAILED',_0x190b('0x3'),_0x190b('0x3')];var channels={};function writeDB(_0x3b57f7){var _0x626aa1;if(transfers[_0x190b('0x5')][_0x3b57f7[_0x190b('0x6')]]){_0x626aa1=_0x3b57f7[_0x190b('0x6')];_0x3b57f7['uniqueid']=transfers[_0x190b('0x5')][_0x3b57f7[_0x190b('0x6')]][_0x190b('0x7')];}utils[_0x190b('0x8')](util[_0x190b('0x9')](_0x190b('0xa'),_0x3b57f7[_0x190b('0x6')],_0x3b57f7[_0x190b('0xb')],_0x3b57f7['queue'],_0x3b57f7[_0x190b('0xc')],_0x3b57f7[_0x190b('0xd')],_0x3b57f7['calleridnum'],_0x3b57f7[_0x190b('0xe')],_0x3b57f7[_0x190b('0xf')]));if(_0x3b57f7[_0x190b('0x10')]){utils[_0x190b('0x11')](_0x3b57f7[_0x190b('0x10')])[_0x190b('0x12')](function(_0x2e12d4){if(_0x2e12d4){_0x3b57f7[_0x190b('0x13')]=_0x2e12d4['id'];}utils[_0x190b('0x14')](_0x190b('0x15'),_0x3b57f7);});}else{utils[_0x190b('0x14')](_0x190b('0x15'),_0x3b57f7);}if(channels[_0x3b57f7[_0x190b('0x6')]]){delete channels[_0x3b57f7[_0x190b('0x6')]];}else if(_0x626aa1&&channels[_0x626aa1]){if(!transfers[_0x190b('0x5')][_0x626aa1][_0x190b('0x16')])delete transfers[_0x190b('0x5')][_0x626aa1];delete channels[_0x626aa1];}}exports['newchannel']=function(_0x428fec){try{utils['debug'](util[_0x190b('0x9')](_0x190b('0x17'),_0x428fec[_0x190b('0x6')]),_0x428fec);if(_0x428fec[_0x190b('0x6')]==_0x428fec['linkedid']&&_0x428fec[_0x190b('0xb')]!=_0x190b('0x18')){utils[_0x190b('0x8')](util[_0x190b('0x9')](_0x190b('0x19'),_0x428fec[_0x190b('0x6')],_0x428fec['context'],_0x428fec[_0x190b('0x1a')]));channels[_0x428fec[_0x190b('0x6')]]={'uniqueid':_0x428fec['uniqueid'],'accountcode':_0x428fec[_0x190b('0x10')],'source':_0x428fec['calleridnum'],'destination':_0x428fec['exten'],'destinationcontext':_0x428fec[_0x190b('0x1b')],'channel':_0x428fec[_0x190b('0xb')],'starttime':utils[_0x190b('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x190b('0x1d')};}}catch(_0x2e633e){utils[_0x190b('0x1e')](util[_0x190b('0x9')](_0x190b('0x17'),_0x428fec[_0x190b('0x6')]),_0x2e633e);}};exports[_0x190b('0x1f')]=function(_0x519a76){try{utils['debug'](util[_0x190b('0x9')](_0x190b('0x20'),_0x519a76['uniqueid']),_0x519a76);if(!_['isNil'](channels[_0x519a76[_0x190b('0x6')]])&&_0x519a76['channelstate']==0x6){utils[_0x190b('0x8')](util[_0x190b('0x9')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x519a76[_0x190b('0x6')],_0x519a76[_0x190b('0x1b')],_0x519a76['channel']));if(_[_0x190b('0x21')](channels[_0x519a76[_0x190b('0x6')]][_0x190b('0x22')])){channels[_0x519a76['uniqueid']]['systemanswertime']=utils[_0x190b('0x1c')]();}}else if(!_['isNil'](channels[_0x519a76[_0x190b('0x23')]])&&_0x519a76[_0x190b('0x24')]==0x6&&_0x519a76['context']!=_0x190b('0x25')){utils['info'](util[_0x190b('0x9')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x519a76[_0x190b('0x6')],_0x519a76['linkedid'],_0x519a76[_0x190b('0x1b')],_0x519a76[_0x190b('0xb')]));channels[_0x519a76['linkedid']][_0x190b('0x10')]=_0x519a76[_0x190b('0x10')];channels[_0x519a76[_0x190b('0x23')]][_0x190b('0x26')]=_0x519a76[_0x190b('0xb')];if(_[_0x190b('0x21')](channels[_0x519a76[_0x190b('0x23')]][_0x190b('0x27')])){channels[_0x519a76['linkedid']]['answertime']=utils[_0x190b('0x1c')]();}channels[_0x519a76[_0x190b('0x23')]]['disposition']=dispositions[_[_0x190b('0x28')](_0x519a76[_0x190b('0x24')])]||_0x190b('0x29');}}catch(_0x3fbba1){utils[_0x190b('0x1e')](util[_0x190b('0x9')](_0x190b('0x20'),_0x519a76['uniqueid']),_0x3fbba1);}};exports['hangup']=function(_0x44c04c){try{if(!_[_0x190b('0x21')](channels[_0x44c04c[_0x190b('0x6')]])){utils['debug'](util[_0x190b('0x9')](_0x190b('0x2a'),_0x44c04c[_0x190b('0x6')]),_0x44c04c);if(_['isNil'](channels[_0x44c04c[_0x190b('0x6')]]['callerid'])){channels[_0x44c04c['uniqueid']][_0x190b('0x2b')]=_0x44c04c[_0x190b('0x2c')]+'\x20<'+_0x44c04c['calleridnum']+'>';}utils[_0x190b('0x8')](util[_0x190b('0x9')](_0x190b('0x2d'),_0x44c04c['uniqueid'],channels[_0x44c04c[_0x190b('0x6')]][_0x190b('0x2b')],_0x44c04c['cause-txt']));channels[_0x44c04c['uniqueid']][_0x190b('0x2e')]=utils['now']();channels[_0x44c04c[_0x190b('0x6')]][_0x190b('0x2f')]=utils[_0x190b('0x30')](channels[_0x44c04c[_0x190b('0x6')]]['endtime'],channels[_0x44c04c[_0x190b('0x6')]]['starttime']);channels[_0x44c04c[_0x190b('0x6')]][_0x190b('0x31')]=channels[_0x44c04c['uniqueid']][_0x190b('0x27')]?utils[_0x190b('0x30')](channels[_0x44c04c[_0x190b('0x6')]]['endtime'],channels[_0x44c04c[_0x190b('0x6')]]['answertime']):0x0;writeDB(channels[_0x44c04c['uniqueid']]);}}catch(_0x554486){utils[_0x190b('0x1e')](util[_0x190b('0x9')](_0x190b('0x2a'),_0x44c04c[_0x190b('0x6')]),_0x554486);}};exports['attendedtransfer']=function(_0x50729e){try{if(!_[_0x190b('0x21')](channels[_0x50729e['localtwolinkedid']])){utils[_0x190b('0x32')](util[_0x190b('0x9')]('[%s][calls][attendedtransfer]',_0x50729e[_0x190b('0x33')]),_0x50729e);if(channels[_0x50729e[_0x190b('0x34')]][_0x190b('0xb')]==_0x50729e['transfereechannel']){utils[_0x190b('0x8')](util[_0x190b('0x9')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x50729e[_0x190b('0x33')],_0x50729e['localtwolinkedid'],_0x50729e[_0x190b('0x35')]));channels[_0x50729e[_0x190b('0x34')]][_0x190b('0x26')]=_0x50729e['secondtransfererchannel'];channels[_0x50729e[_0x190b('0x34')]]['userfield']=_0x190b('0x36');}else if(channels[_0x50729e[_0x190b('0x34')]][_0x190b('0xb')]=_0x50729e[_0x190b('0x37')]){utils[_0x190b('0x8')](util[_0x190b('0x9')](_0x190b('0x38'),_0x50729e['origtransfereruniqueid'],_0x50729e[_0x190b('0x34')],_0x50729e[_0x190b('0x39')]));channels[_0x50729e[_0x190b('0x34')]]['destinationchannel']=_0x50729e[_0x190b('0x39')];channels[_0x50729e[_0x190b('0x34')]][_0x190b('0x3a')]=_0x190b('0x36');}}}catch(_0x37d130){utils['error'](util[_0x190b('0x9')](_0x190b('0x3b'),_0x50729e[_0x190b('0x33')]),_0x37d130);}};exports['musiconholdstart']=function(_0x129a53){try{if(!_[_0x190b('0x21')](channels[_0x129a53[_0x190b('0x6')]])){utils['debug'](util['format'](_0x190b('0x3c'),_0x129a53[_0x190b('0x6')]),_0x129a53);channels[_0x129a53[_0x190b('0x6')]][_0x190b('0x3d')]=utils[_0x190b('0x1c')]();utils[_0x190b('0x8')](util['format'](_0x190b('0x3e'),_0x129a53[_0x190b('0x6')],channels[_0x129a53[_0x190b('0x6')]]['musiconholdstartAt']));}}catch(_0x3054b9){utils[_0x190b('0x1e')](util[_0x190b('0x9')]('[%s][calls][musiconholdstart]',_0x129a53[_0x190b('0x6')]),_0x3054b9);}};exports[_0x190b('0x3f')]=function(_0x181c53){try{if(!_[_0x190b('0x21')](channels[_0x181c53[_0x190b('0x6')]])){utils[_0x190b('0x32')](util[_0x190b('0x9')](_0x190b('0x40'),_0x181c53[_0x190b('0x6')]),_0x181c53);if(!_[_0x190b('0x21')](channels[_0x181c53[_0x190b('0x6')]]['musiconholdstartAt'])){channels[_0x181c53[_0x190b('0x6')]]['mohtime']+=utils[_0x190b('0x30')](utils[_0x190b('0x1c')](),channels[_0x181c53['uniqueid']][_0x190b('0x3d')]);utils[_0x190b('0x8')](util[_0x190b('0x9')](_0x190b('0x41'),_0x181c53[_0x190b('0x6')],channels[_0x181c53[_0x190b('0x6')]][_0x190b('0x42')]));delete channels[_0x181c53[_0x190b('0x6')]]['musiconholdstartAt'];}}}catch(_0x2f034e){utils[_0x190b('0x1e')](util[_0x190b('0x9')]('[%s][calls][musiconholdstop]',_0x181c53[_0x190b('0x6')]),_0x2f034e);}};exports['varset']=function(_0x4a3db4){try{if(!_[_0x190b('0x21')](channels[_0x4a3db4[_0x190b('0x6')]])){utils[_0x190b('0x32')](util[_0x190b('0x9')](_0x190b('0x43'),_0x4a3db4[_0x190b('0x6')]),_0x4a3db4);if(!_[_0x190b('0x21')](_0x4a3db4[_0x190b('0x44')][_0x190b('0x45')])){utils[_0x190b('0x8')](util[_0x190b('0x9')](_0x190b('0x46'),_0x4a3db4[_0x190b('0x6')],_0x4a3db4[_0x190b('0x47')]));channels[_0x4a3db4['uniqueid']][_0x190b('0x48')]=_0x4a3db4[_0x190b('0x47')];}if(!_[_0x190b('0x21')](_0x4a3db4[_0x190b('0x44')]['xmd-phone'])){utils['info'](util[_0x190b('0x9')](_0x190b('0x49'),_0x4a3db4['uniqueid'],_0x4a3db4[_0x190b('0x47')]));channels[_0x4a3db4['uniqueid']][_0x190b('0x4a')]=_0x4a3db4[_0x190b('0x47')];channels[_0x4a3db4[_0x190b('0x6')]]['callerid']='\x22'+_0x4a3db4[_0x190b('0x47')]+_0x190b('0x4b')+_0x4a3db4[_0x190b('0x47')]+'>';}if(!_[_0x190b('0x21')](_0x4a3db4[_0x190b('0x44')][_0x190b('0x4c')])||!_[_0x190b('0x21')](_0x4a3db4[_0x190b('0x44')][_0x190b('0x4d')])){utils['info'](util['format'](_0x190b('0x4e'),_0x4a3db4[_0x190b('0x6')],!_[_0x190b('0x21')](_0x4a3db4[_0x190b('0x44')]['xmd-callerid-preview'])?_0x190b('0x4c'):_0x190b('0x4d'),_0x4a3db4['value']));channels[_0x4a3db4[_0x190b('0x6')]][_0x190b('0x2b')]=_0x4a3db4[_0x190b('0x47')];}if(!_[_0x190b('0x21')](_0x4a3db4[_0x190b('0x44')][_0x190b('0x4f')])||!_[_0x190b('0x21')](_0x4a3db4[_0x190b('0x44')]['xmcs-queue'])){utils[_0x190b('0x8')](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x4a3db4[_0x190b('0x6')],!_[_0x190b('0x21')](_0x4a3db4[_0x190b('0x44')]['xmd-queue'])?'xmd-queue':_0x190b('0x50'),_0x4a3db4[_0x190b('0x47')]));channels[_0x4a3db4[_0x190b('0x6')]][_0x190b('0x51')]=_0x190b('0x52');channels[_0x4a3db4[_0x190b('0x6')]][_0x190b('0x53')]=_0x4a3db4[_0x190b('0x47')];channels[_0x4a3db4['uniqueid']][_0x190b('0x54')]=!![];}if(!_[_0x190b('0x21')](_0x4a3db4[_0x190b('0x44')][_0x190b('0x55')])){utils[_0x190b('0x8')](util['format'](_0x190b('0x56'),_0x4a3db4[_0x190b('0x6')],_0x4a3db4[_0x190b('0x47')]));channels[_0x4a3db4['uniqueid']][_0x190b('0x57')]=_0x4a3db4[_0x190b('0x47')];}if(!_[_0x190b('0x21')](_0x4a3db4[_0x190b('0x44')]['xmd-cdrtype'])){utils[_0x190b('0x8')](util[_0x190b('0x9')](_0x190b('0x58'),_0x4a3db4[_0x190b('0x6')],_0x4a3db4['value']));channels[_0x4a3db4[_0x190b('0x6')]]['type']=_0x4a3db4[_0x190b('0x47')];}if(!_[_0x190b('0x21')](_0x4a3db4[_0x190b('0x44')][_0x190b('0x59')])){utils['info'](util[_0x190b('0x9')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x4a3db4[_0x190b('0x6')],_0x4a3db4['value']));channels[_0x4a3db4['uniqueid']][_0x190b('0x5a')]=_0x4a3db4['value'];}if(!_[_0x190b('0x21')](_0x4a3db4[_0x190b('0x44')][_0x190b('0x5b')])){utils[_0x190b('0x8')](util[_0x190b('0x9')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x4a3db4[_0x190b('0x6')],_0x4a3db4[_0x190b('0x47')]));channels[_0x4a3db4[_0x190b('0x6')]]['sipcallid']=_0x4a3db4[_0x190b('0x47')];}}}catch(_0x311c85){utils['error'](util[_0x190b('0x9')](_0x190b('0x43'),_0x4a3db4[_0x190b('0x6')]),_0x311c85);}};exports['newexten']=function(_0x1446a4){try{if(!_[_0x190b('0x21')](channels[_0x1446a4[_0x190b('0x6')]])){utils[_0x190b('0x32')](util['format'](_0x190b('0x5c'),_0x1446a4[_0x190b('0x6')]),_0x1446a4);utils[_0x190b('0x8')](util['format'](_0x190b('0x5d'),_0x1446a4[_0x190b('0x6')],_0x1446a4[_0x190b('0x5e')],_0x1446a4['appdata']));if(_0x1446a4[_0x190b('0x5e')][_0x190b('0x5f')]()==_0x190b('0x60')&&_[_0x190b('0x61')](_0x1446a4[_0x190b('0x62')]['toLowerCase'](),'cdr')){var _0x10b7ae=_0x1446a4[_0x190b('0x62')]['split']('=');var _0xfce26a=_0x10b7ae[0x0][_0x190b('0x63')](_0x10b7ae[0x0]['lastIndexOf']('(')+0x1,_0x10b7ae[0x0]['lastIndexOf'](')'));var _0xbfd0f3=_0x10b7ae[0x1];channels[_0x1446a4[_0x190b('0x6')]][_0xfce26a]=_0xbfd0f3;}if(!_['includes'](['hangup',_0x190b('0x64'),_0x190b('0x65'),_0x190b('0x60'),_0x190b('0x66')],_0x1446a4[_0x190b('0x5e')]['toLowerCase']())){channels[_0x1446a4['uniqueid']][_0x190b('0x51')]=_0x1446a4['application'];channels[_0x1446a4[_0x190b('0x6')]][_0x190b('0x53')]=_0x1446a4[_0x190b('0x62')];}}}catch(_0x3c9653){utils[_0x190b('0x1e')](util[_0x190b('0x9')](_0x190b('0x5c'),_0x1446a4[_0x190b('0x6')]),_0x3c9653);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index e5d6f83..6250845 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 _0x1b3d=['shutdown','[core]\x20shutdown','fullybooted','error','[core]\x20error','close','managerevent','./utils','info','[core]\x20connected'];(function(_0x2962d5,_0x38deda){var _0x273406=function(_0x3e0775){while(--_0x3e0775){_0x2962d5['push'](_0x2962d5['shift']());}};_0x273406(++_0x38deda);}(_0x1b3d,0xc5));var _0xd1b3=function(_0x5231f9,_0x14bbe9){_0x5231f9=_0x5231f9-0x0;var _0x3eae55=_0x1b3d[_0x5231f9];return _0x3eae55;};'use strict';var utils=require(_0xd1b3('0x0'));exports['connect']=function(){utils[_0xd1b3('0x1')](_0xd1b3('0x2'));};exports[_0xd1b3('0x3')]=function(){utils[_0xd1b3('0x1')](_0xd1b3('0x4'));};exports[_0xd1b3('0x5')]=function(){utils[_0xd1b3('0x1')]('[core]\x20fullybooted');};exports[_0xd1b3('0x6')]=function(_0x1d3a99){utils[_0xd1b3('0x6')](_0xd1b3('0x7'),_0x1d3a99);};exports[_0xd1b3('0x8')]=function(){utils[_0xd1b3('0x1')]('[core]\x20close');};exports[_0xd1b3('0x9')]=function(_0x78f290){}; \ No newline at end of file +var _0xcb31=['connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','[core]\x20fullybooted','error','close','[core]\x20close','managerevent'];(function(_0x1092be,_0x1e5cd3){var _0x2aa8ab=function(_0x3f6d3e){while(--_0x3f6d3e){_0x1092be['push'](_0x1092be['shift']());}};_0x2aa8ab(++_0x1e5cd3);}(_0xcb31,0x118));var _0x1cb3=function(_0x44105b,_0x2642b2){_0x44105b=_0x44105b-0x0;var _0x552761=_0xcb31[_0x44105b];return _0x552761;};'use strict';var utils=require('./utils');exports[_0x1cb3('0x0')]=function(){utils[_0x1cb3('0x1')](_0x1cb3('0x2'));};exports[_0x1cb3('0x3')]=function(){utils[_0x1cb3('0x1')](_0x1cb3('0x4'));};exports['fullybooted']=function(){utils[_0x1cb3('0x1')](_0x1cb3('0x5'));};exports[_0x1cb3('0x6')]=function(_0x54ff27){utils[_0x1cb3('0x6')]('[core]\x20error',_0x54ff27);};exports[_0x1cb3('0x7')]=function(){utils[_0x1cb3('0x1')](_0x1cb3('0x8'));};exports[_0x1cb3('0x9')]=function(_0x46a084){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 4a45a30..d195b57 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 _0xf2de=['set','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialbegin]','dialend','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','calleridname','cause-txt','complete','duration','endtime','holdtime','diffTime','util','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','dialstatus','request','newexten','debug','format','[%s][dials][newexten]','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata'];(function(_0x1de64d,_0x458b9e){var _0x548350=function(_0x4daf40){while(--_0x4daf40){_0x1de64d['push'](_0x1de64d['shift']());}};_0x548350(++_0x458b9e);}(_0xf2de,0x1db));var _0xef2d=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xf2de[_0x618414];return _0x21c19a;};'use strict';var _=require('lodash');var util=require(_0xef2d('0x0'));var utils=require('./utils');var dials={};function writeDB(_0x34d8d4){utils['info'](util['format'](_0xef2d('0x1'),_0x34d8d4[_0xef2d('0x2')],_0x34d8d4[_0xef2d('0x3')],_0x34d8d4[_0xef2d('0x4')],_0x34d8d4['calleridnum'],_0x34d8d4['connectedlinenum'],_0x34d8d4[_0xef2d('0x5')]));utils[_0xef2d('0x6')]('CreateVoiceDialReport',_0x34d8d4);delete dials[_0x34d8d4[_0xef2d('0x2')]];}exports[_0xef2d('0x7')]=function(_0x35ea09){try{utils[_0xef2d('0x8')](util[_0xef2d('0x9')](_0xef2d('0xa'),_0x35ea09[_0xef2d('0x2')]),_0x35ea09);utils[_0xef2d('0xb')](util['format'](_0xef2d('0xc'),_0x35ea09[_0xef2d('0x2')],_0x35ea09[_0xef2d('0xd')],_0x35ea09[_0xef2d('0xe')]));if(_0x35ea09[_0xef2d('0xd')]['toLowerCase']()==_0xef2d('0xf')&&_['startsWith'](_0x35ea09['appdata']['toLowerCase'](),_0xef2d('0x10'))){var _0x31d175=_0x35ea09['appdata'][_0xef2d('0x11')]('=');dials[_0x35ea09[_0xef2d('0x2')]]={'routeId':_0x31d175[0x1]};}}catch(_0x5f0b92){utils[_0xef2d('0x12')](util[_0xef2d('0x9')](_0xef2d('0xa'),_0x35ea09[_0xef2d('0x2')]),_0x5f0b92);}};exports[_0xef2d('0x13')]=function(_0x41a5b8){try{utils[_0xef2d('0x8')](util[_0xef2d('0x9')](_0xef2d('0x14'),_0x41a5b8['uniqueid']),_0x41a5b8);if(!_[_0xef2d('0x15')](_0x41a5b8[_0xef2d('0x16')]['outboundrouteid'])){utils[_0xef2d('0xb')](util[_0xef2d('0x9')](_0xef2d('0x17'),_0x41a5b8[_0xef2d('0x2')],_0x41a5b8[_0xef2d('0x18')]));dials[_0x41a5b8[_0xef2d('0x2')]]={'routeId':_0x41a5b8[_0xef2d('0x18')]};}}catch(_0x340a91){utils[_0xef2d('0x12')](util[_0xef2d('0x9')]('[%s][dials][varset]',_0x41a5b8[_0xef2d('0x2')]),_0x340a91);}};exports[_0xef2d('0x19')]=function(_0x263956){try{if(!_['isNil'](dials[_0x263956['uniqueid']])){utils[_0xef2d('0x8')](util[_0xef2d('0x9')]('[%s][dials][dialbegin]',_0x263956[_0xef2d('0x2')]),_0x263956);dials[_0x263956[_0xef2d('0x2')]]=_[_0xef2d('0x1a')](dials[_0x263956[_0xef2d('0x2')]],_0x263956);dials[_0x263956['uniqueid']][_0xef2d('0x1b')]=utils[_0xef2d('0x1c')]();dials[_0x263956[_0xef2d('0x2')]][_0xef2d('0x1d')]=_0xef2d('0x1e');utils[_0xef2d('0xb')](util['format'](_0xef2d('0x1f'),_0x263956['uniqueid'],dials[_0x263956[_0xef2d('0x2')]][_0xef2d('0x1b')]));}}catch(_0x59be1d){utils[_0xef2d('0x12')](util[_0xef2d('0x9')](_0xef2d('0x20'),_0x263956[_0xef2d('0x2')]),_0x59be1d);}};exports[_0xef2d('0x21')]=function(_0x532042){try{if(!_[_0xef2d('0x15')](dials[_0x532042[_0xef2d('0x2')]])){utils['debug'](util[_0xef2d('0x9')]('[%s][dials][dialend]',_0x532042[_0xef2d('0x2')]),_0x532042);dials[_0x532042['uniqueid']][_0xef2d('0x5')]=_0x532042[_0xef2d('0x5')];if(_0x532042['dialstatus']==_0xef2d('0x22')){dials[_0x532042[_0xef2d('0x2')]]=_[_0xef2d('0x1a')](dials[_0x532042['uniqueid']],_0x532042);dials[_0x532042[_0xef2d('0x2')]][_0xef2d('0x23')]=utils[_0xef2d('0x1c')]();dials[_0x532042['uniqueid']]['lastevent']=_0xef2d('0x24');utils[_0xef2d('0xb')](util[_0xef2d('0x9')](_0xef2d('0x25'),_0x532042['uniqueid'],_0x532042[_0xef2d('0x5')],dials[_0x532042[_0xef2d('0x2')]][_0xef2d('0x23')]));}else{utils['info'](util[_0xef2d('0x9')](_0xef2d('0x26'),_0x532042[_0xef2d('0x2')],_0x532042['dialstatus']));}}}catch(_0x312ee8){utils[_0xef2d('0x12')](util[_0xef2d('0x9')]('[%s][dials][dialend]',_0x532042['uniqueid']),_0x312ee8);}};exports['hangup']=function(_0x42c493){try{if(!_[_0xef2d('0x15')](dials[_0x42c493[_0xef2d('0x2')]])){utils['debug'](util['format'](_0xef2d('0x27'),_0x42c493[_0xef2d('0x2')]),_0x42c493);utils[_0xef2d('0xb')](util[_0xef2d('0x9')](_0xef2d('0x28'),_0x42c493[_0xef2d('0x2')],_0x42c493[_0xef2d('0x29')],_0x42c493[_0xef2d('0x2a')],_0x42c493[_0xef2d('0x2b')]));dials[_0x42c493[_0xef2d('0x2')]]=_['assign'](dials[_0x42c493['uniqueid']],{'endtime':utils[_0xef2d('0x1c')](),'lastevent':_0xef2d('0x2c')});dials[_0x42c493['uniqueid']][_0xef2d('0x2d')]=utils['diffTime'](dials[_0x42c493['uniqueid']][_0xef2d('0x2e')],dials[_0x42c493[_0xef2d('0x2')]]['starttime']);dials[_0x42c493[_0xef2d('0x2')]][_0xef2d('0x2f')]=utils[_0xef2d('0x30')](dials[_0x42c493[_0xef2d('0x2')]][_0xef2d('0x23')]||dials[_0x42c493['uniqueid']][_0xef2d('0x2e')],dials[_0x42c493[_0xef2d('0x2')]]['starttime']);dials[_0x42c493[_0xef2d('0x2')]]['billableseconds']=dials[_0x42c493['uniqueid']][_0xef2d('0x23')]?utils[_0xef2d('0x30')](dials[_0x42c493[_0xef2d('0x2')]][_0xef2d('0x2e')],dials[_0x42c493['uniqueid']][_0xef2d('0x23')]):0x0;writeDB(dials[_0x42c493['uniqueid']]);}}catch(_0x1fb8f1){utils['error'](util[_0xef2d('0x9')]('[%s][dials][hangup]',_0x42c493['uniqueid']),_0x1fb8f1);}}; \ No newline at end of file +var _0x5c36=['[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','duration','endtime','holdtime','diffTime','util','info','format','calleridnum','connectedlinenum','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','uniqueid','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','split','error','varset','[%s][dials][varset]','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','isNil','[%s][dials][dialbegin]','assign','starttime','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','dialstatus','ANSWER','answertime','now','connect'];(function(_0x1242d9,_0x528442){var _0x4a2770=function(_0x1b6627){while(--_0x1b6627){_0x1242d9['push'](_0x1242d9['shift']());}};_0x4a2770(++_0x528442);}(_0x5c36,0x64));var _0x65c3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5c36[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x65c3('0x0'));var utils=require('./utils');var dials={};function writeDB(_0x1f1a13){utils[_0x65c3('0x1')](util[_0x65c3('0x2')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x1f1a13['uniqueid'],_0x1f1a13['channel'],_0x1f1a13['dialstring'],_0x1f1a13[_0x65c3('0x3')],_0x1f1a13[_0x65c3('0x4')],_0x1f1a13['dialstatus']));utils['request'](_0x65c3('0x5'),_0x1f1a13);delete dials[_0x1f1a13['uniqueid']];}exports[_0x65c3('0x6')]=function(_0xb596c0){try{utils[_0x65c3('0x7')](util[_0x65c3('0x2')](_0x65c3('0x8'),_0xb596c0[_0x65c3('0x9')]),_0xb596c0);utils['info'](util[_0x65c3('0x2')](_0x65c3('0xa'),_0xb596c0['uniqueid'],_0xb596c0[_0x65c3('0xb')],_0xb596c0[_0x65c3('0xc')]));if(_0xb596c0[_0x65c3('0xb')][_0x65c3('0xd')]()=='set'&&_[_0x65c3('0xe')](_0xb596c0['appdata'][_0x65c3('0xd')](),'cdr(routeid)')){var _0x4b692c=_0xb596c0[_0x65c3('0xc')][_0x65c3('0xf')]('=');dials[_0xb596c0[_0x65c3('0x9')]]={'routeId':_0x4b692c[0x1]};}}catch(_0x2f4b3c){utils[_0x65c3('0x10')](util[_0x65c3('0x2')](_0x65c3('0x8'),_0xb596c0['uniqueid']),_0x2f4b3c);}};exports[_0x65c3('0x11')]=function(_0x443015){try{utils['debug'](util['format'](_0x65c3('0x12'),_0x443015['uniqueid']),_0x443015);if(!_['isNil'](_0x443015[_0x65c3('0x13')][_0x65c3('0x14')])){utils['info'](util['format'](_0x65c3('0x15'),_0x443015[_0x65c3('0x9')],_0x443015['value']));dials[_0x443015[_0x65c3('0x9')]]={'routeId':_0x443015[_0x65c3('0x16')]};}}catch(_0x36e061){utils[_0x65c3('0x10')](util[_0x65c3('0x2')](_0x65c3('0x12'),_0x443015[_0x65c3('0x9')]),_0x36e061);}};exports[_0x65c3('0x17')]=function(_0x1fe41b){try{if(!_[_0x65c3('0x18')](dials[_0x1fe41b[_0x65c3('0x9')]])){utils['debug'](util[_0x65c3('0x2')](_0x65c3('0x19'),_0x1fe41b[_0x65c3('0x9')]),_0x1fe41b);dials[_0x1fe41b[_0x65c3('0x9')]]=_[_0x65c3('0x1a')](dials[_0x1fe41b[_0x65c3('0x9')]],_0x1fe41b);dials[_0x1fe41b[_0x65c3('0x9')]][_0x65c3('0x1b')]=utils['now']();dials[_0x1fe41b['uniqueid']][_0x65c3('0x1c')]=_0x65c3('0x1d');utils[_0x65c3('0x1')](util[_0x65c3('0x2')](_0x65c3('0x1e'),_0x1fe41b[_0x65c3('0x9')],dials[_0x1fe41b[_0x65c3('0x9')]][_0x65c3('0x1b')]));}}catch(_0x55b344){utils[_0x65c3('0x10')](util[_0x65c3('0x2')](_0x65c3('0x19'),_0x1fe41b[_0x65c3('0x9')]),_0x55b344);}};exports[_0x65c3('0x1f')]=function(_0x306b2a){try{if(!_[_0x65c3('0x18')](dials[_0x306b2a['uniqueid']])){utils['debug'](util[_0x65c3('0x2')](_0x65c3('0x20'),_0x306b2a[_0x65c3('0x9')]),_0x306b2a);dials[_0x306b2a[_0x65c3('0x9')]][_0x65c3('0x21')]=_0x306b2a['dialstatus'];if(_0x306b2a['dialstatus']==_0x65c3('0x22')){dials[_0x306b2a[_0x65c3('0x9')]]=_['assign'](dials[_0x306b2a[_0x65c3('0x9')]],_0x306b2a);dials[_0x306b2a['uniqueid']][_0x65c3('0x23')]=utils[_0x65c3('0x24')]();dials[_0x306b2a[_0x65c3('0x9')]][_0x65c3('0x1c')]=_0x65c3('0x25');utils['info'](util[_0x65c3('0x2')](_0x65c3('0x26'),_0x306b2a[_0x65c3('0x9')],_0x306b2a[_0x65c3('0x21')],dials[_0x306b2a[_0x65c3('0x9')]][_0x65c3('0x23')]));}else{utils[_0x65c3('0x1')](util[_0x65c3('0x2')](_0x65c3('0x27'),_0x306b2a[_0x65c3('0x9')],_0x306b2a[_0x65c3('0x21')]));}}}catch(_0x3a48fa){utils['error'](util[_0x65c3('0x2')]('[%s][dials][dialend]',_0x306b2a[_0x65c3('0x9')]),_0x3a48fa);}};exports['hangup']=function(_0x24bb56){try{if(!_[_0x65c3('0x18')](dials[_0x24bb56['uniqueid']])){utils['debug'](util[_0x65c3('0x2')](_0x65c3('0x28'),_0x24bb56[_0x65c3('0x9')]),_0x24bb56);utils['info'](util[_0x65c3('0x2')](_0x65c3('0x29'),_0x24bb56[_0x65c3('0x9')],_0x24bb56[_0x65c3('0x3')],_0x24bb56['calleridname'],_0x24bb56['cause-txt']));dials[_0x24bb56[_0x65c3('0x9')]]=_[_0x65c3('0x1a')](dials[_0x24bb56['uniqueid']],{'endtime':utils[_0x65c3('0x24')](),'lastevent':'complete'});dials[_0x24bb56[_0x65c3('0x9')]][_0x65c3('0x2a')]=utils['diffTime'](dials[_0x24bb56[_0x65c3('0x9')]][_0x65c3('0x2b')],dials[_0x24bb56[_0x65c3('0x9')]][_0x65c3('0x1b')]);dials[_0x24bb56['uniqueid']][_0x65c3('0x2c')]=utils[_0x65c3('0x2d')](dials[_0x24bb56['uniqueid']][_0x65c3('0x23')]||dials[_0x24bb56[_0x65c3('0x9')]]['endtime'],dials[_0x24bb56[_0x65c3('0x9')]][_0x65c3('0x1b')]);dials[_0x24bb56[_0x65c3('0x9')]]['billableseconds']=dials[_0x24bb56[_0x65c3('0x9')]][_0x65c3('0x23')]?utils[_0x65c3('0x2d')](dials[_0x24bb56[_0x65c3('0x9')]][_0x65c3('0x2b')],dials[_0x24bb56[_0x65c3('0x9')]]['answertime']):0x0;writeDB(dials[_0x24bb56['uniqueid']]);}}catch(_0x47d8c3){utils[_0x65c3('0x10')](util['format']('[%s][dials][hangup]',_0x24bb56[_0x65c3('0x9')]),_0x47d8c3);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index a062164..7d3b4b6 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 _0x1992=['agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','[%s][index][cdr]','cdr','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','../../config/environment','./utils','util','xdr','disabled','env','production','local','asterisk','username','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','uniqueid','agentconnect','[%s][index][agentconnect]'];(function(_0x1280cc,_0x29172f){var _0x409fca=function(_0x44e19b){while(--_0x44e19b){_0x1280cc['push'](_0x1280cc['shift']());}};_0x409fca(++_0x29172f);}(_0x1992,0x1ca));var _0x2199=function(_0x17f579,_0x35ec3c){_0x17f579=_0x17f579-0x0;var _0x8c949b=_0x1992[_0x17f579];return _0x8c949b;};var AsteriskManager=require('asterisk-manager');var config=require(_0x2199('0x0'));var utils=require(_0x2199('0x1'));var util=require(_0x2199('0x2'));var isXDREnabled=config[_0x2199('0x3')]&&config[_0x2199('0x3')][_0x2199('0x4')]?!config['xdr'][_0x2199('0x4')]:!![];var isProduction=config[_0x2199('0x5')]===_0x2199('0x6')||![];var isLocalAsterisk=config[_0x2199('0x3')]&&config[_0x2199('0x3')][_0x2199('0x7')]===!![]||![];var ami=new AsteriskManager(config['asterisk']['port'],config[_0x2199('0x8')]['ip'],config[_0x2199('0x8')][_0x2199('0x9')],config[_0x2199('0x8')]['password'],!![]);ami[_0x2199('0xa')]();if(!isXDREnabled){utils[_0x2199('0xb')](_0x2199('0xc'));}else if(!isProduction&&!isLocalAsterisk){utils['info'](_0x2199('0xd'));}else{var agents=require(_0x2199('0xe'));var calls=require(_0x2199('0xf'));var queues=require(_0x2199('0x10'));var recordings=require('./recordings.controller');var members=require(_0x2199('0x11'));var dials=require(_0x2199('0x12'));var transfers=require(_0x2199('0x13'));var core=require(_0x2199('0x14'));ami['on'](_0x2199('0x15'),core[_0x2199('0x15')]);ami['on'](_0x2199('0x16'),core['shutdown']);ami['on'](_0x2199('0x17'),core[_0x2199('0x17')]);ami['on'](_0x2199('0x18'),core[_0x2199('0x18')]);ami['on']('close',core[_0x2199('0x19')]);ami['on'](_0x2199('0x1a'),core[_0x2199('0x1a')]);ami['on'](_0x2199('0x1b'),function(_0x41233c){try{utils[_0x2199('0x1c')](util[_0x2199('0x1d')](_0x2199('0x1e'),_0x41233c['device']),_0x41233c);members[_0x2199('0x1b')](_0x41233c);}catch(_0x2ccfcd){utils['error'](util[_0x2199('0x1d')](_0x2199('0x1e'),_0x41233c[_0x2199('0x1f')]),_0x2ccfcd);}});ami['on'](_0x2199('0x20'),function(_0x396032){try{utils[_0x2199('0x1c')](util[_0x2199('0x1d')](_0x2199('0x21'),_0x396032['uniqueid']),_0x396032);agents[_0x2199('0x20')](_0x396032);}catch(_0x18a6a7){utils[_0x2199('0x18')](util[_0x2199('0x1d')](_0x2199('0x21'),_0x396032['uniqueid']),_0x18a6a7);}});ami['on'](_0x2199('0x22'),function(_0x510282){try{utils['debug'](util['format'](_0x2199('0x23'),_0x510282['uniqueid']),_0x510282);agents[_0x2199('0x22')](_0x510282);}catch(_0x4d7b4e){utils[_0x2199('0x18')](util[_0x2199('0x1d')](_0x2199('0x23'),_0x510282[_0x2199('0x24')]),_0x4d7b4e);}});ami['on'](_0x2199('0x25'),function(_0x5b62a1){try{utils['debug'](util[_0x2199('0x1d')](_0x2199('0x26'),_0x5b62a1['uniqueid']),_0x5b62a1);agents['agentconnect'](_0x5b62a1);queues[_0x2199('0x25')](_0x5b62a1);}catch(_0x40cd11){utils[_0x2199('0x18')](util[_0x2199('0x1d')](_0x2199('0x26'),_0x5b62a1['uniqueid']),_0x40cd11);}});ami['on'](_0x2199('0x27'),function(_0x1e7ac9){try{utils[_0x2199('0x1c')](util[_0x2199('0x1d')](_0x2199('0x28'),_0x1e7ac9[_0x2199('0x24')]),_0x1e7ac9);agents[_0x2199('0x27')](_0x1e7ac9);queues[_0x2199('0x27')](_0x1e7ac9);members['agentcomplete'](_0x1e7ac9);}catch(_0x5268c1){utils['error'](util[_0x2199('0x1d')]('[%s][index][agentcomplete]',_0x1e7ac9[_0x2199('0x24')]),_0x5268c1);}});ami['on'](_0x2199('0x29'),function(_0x539cba){try{utils[_0x2199('0x1c')](util[_0x2199('0x1d')](_0x2199('0x2a'),_0x539cba[_0x2199('0x24')]),_0x539cba);agents['queuecallerabandon'](_0x539cba);queues[_0x2199('0x29')](_0x539cba);}catch(_0x15a9ce){utils['error'](util[_0x2199('0x1d')]('[%s][index][queuecallerabandon]',_0x539cba[_0x2199('0x24')]),_0x15a9ce);}});ami['on'](_0x2199('0x2b'),function(_0x3ca3ec){try{utils[_0x2199('0x1c')](util[_0x2199('0x1d')](_0x2199('0x2c'),_0x3ca3ec[_0x2199('0x24')]),_0x3ca3ec);queues[_0x2199('0x2b')](_0x3ca3ec);recordings[_0x2199('0x2b')](_0x3ca3ec);}catch(_0x25367c){utils[_0x2199('0x18')](util[_0x2199('0x1d')](_0x2199('0x2c'),_0x3ca3ec['uniqueid']),_0x25367c);}});ami['on'](_0x2199('0x2d'),function(_0x33c05e){try{utils[_0x2199('0x1c')](util[_0x2199('0x1d')]('[%s][index][queuecallerleave]',_0x33c05e['uniqueid']),_0x33c05e);queues[_0x2199('0x2d')](_0x33c05e);}catch(_0xdb6813){utils[_0x2199('0x18')](util[_0x2199('0x1d')](_0x2199('0x2e'),_0x33c05e['uniqueid']),_0xdb6813);}});ami['on'](_0x2199('0x2f'),function(_0x3620fa){try{utils[_0x2199('0x1c')](util[_0x2199('0x1d')]('[%s][index][musiconholdstart]',_0x3620fa[_0x2199('0x24')]),_0x3620fa);queues[_0x2199('0x2f')](_0x3620fa);calls['musiconholdstart'](_0x3620fa);}catch(_0x4febad){utils[_0x2199('0x18')](util[_0x2199('0x1d')](_0x2199('0x30'),_0x3620fa['uniqueid']),_0x4febad);}});ami['on']('musiconholdstop',function(_0x553866){try{utils[_0x2199('0x1c')](util[_0x2199('0x1d')](_0x2199('0x31'),_0x553866[_0x2199('0x24')]),_0x553866);queues[_0x2199('0x32')](_0x553866);calls[_0x2199('0x32')](_0x553866);}catch(_0x21a8a3){utils['error'](util[_0x2199('0x1d')](_0x2199('0x31'),_0x553866['uniqueid']),_0x21a8a3);}});ami['on'](_0x2199('0x33'),function(_0x509cff){try{utils[_0x2199('0x1c')](util[_0x2199('0x1d')](_0x2199('0x34'),_0x509cff[_0x2199('0x24')]),_0x509cff);calls[_0x2199('0x33')](_0x509cff);recordings[_0x2199('0x33')](_0x509cff);}catch(_0x32a53e){utils[_0x2199('0x18')](util[_0x2199('0x1d')](_0x2199('0x34'),_0x509cff[_0x2199('0x24')]),_0x32a53e);}});ami['on'](_0x2199('0x35'),function(_0x3aecbe){try{utils[_0x2199('0x1c')](util[_0x2199('0x1d')](_0x2199('0x36'),_0x3aecbe[_0x2199('0x24')]),_0x3aecbe);calls[_0x2199('0x35')](_0x3aecbe);recordings[_0x2199('0x35')](_0x3aecbe);dials[_0x2199('0x35')](_0x3aecbe);agents['hangup'](_0x3aecbe);queues[_0x2199('0x35')](_0x3aecbe);}catch(_0x1bfbb3){utils['error'](util[_0x2199('0x1d')](_0x2199('0x36'),_0x3aecbe[_0x2199('0x24')]),_0x1bfbb3);}});ami['on']('cdr',function(_0x51e6cf){try{utils[_0x2199('0x1c')](util[_0x2199('0x1d')](_0x2199('0x37'),_0x51e6cf[_0x2199('0x24')]),_0x51e6cf);members[_0x2199('0x38')](_0x51e6cf);}catch(_0x149d77){utils[_0x2199('0x18')](util[_0x2199('0x1d')](_0x2199('0x37'),_0x51e6cf[_0x2199('0x24')]),_0x149d77);}});ami['on'](_0x2199('0x39'),function(_0x30f52c){try{utils[_0x2199('0x1c')](util[_0x2199('0x1d')]('[%s][index][blindtransfer]',_0x30f52c[_0x2199('0x24')]),_0x30f52c);queues[_0x2199('0x39')](_0x30f52c);agents['blindtransfer'](_0x30f52c);transfers[_0x2199('0x39')](_0x30f52c);recordings['blindtransfer'](_0x30f52c);}catch(_0x4a0378){utils[_0x2199('0x18')](util[_0x2199('0x1d')]('[%s][index][blindtransfer]',_0x30f52c['uniqueid']),_0x4a0378);}});ami['on'](_0x2199('0x3a'),function(_0x106c28){try{utils[_0x2199('0x1c')](util['format'](_0x2199('0x3b'),_0x106c28[_0x2199('0x3c')]),_0x106c28);queues['attendedtransfer'](_0x106c28);transfers[_0x2199('0x3a')](_0x106c28);agents[_0x2199('0x3a')](_0x106c28);calls[_0x2199('0x3a')](_0x106c28);}catch(_0x80c039){utils[_0x2199('0x18')](util[_0x2199('0x1d')]('[%s][index][attendedtransfer]',_0x106c28[_0x2199('0x3c')]),_0x80c039);}});ami['on'](_0x2199('0x3d'),function(_0x2e599b){try{utils[_0x2199('0x1c')](util[_0x2199('0x1d')](_0x2199('0x3e'),_0x2e599b[_0x2199('0x24')]),_0x2e599b);queues['varset'](_0x2e599b);recordings[_0x2199('0x3d')](_0x2e599b);calls['varset'](_0x2e599b);dials[_0x2199('0x3d')](_0x2e599b);}catch(_0x16b030){utils[_0x2199('0x18')](util[_0x2199('0x1d')](_0x2199('0x3e'),_0x2e599b[_0x2199('0x24')]),_0x16b030);}});ami['on'](_0x2199('0x3f'),function(_0x5f60ac){try{utils[_0x2199('0x1c')](util[_0x2199('0x1d')](_0x2199('0x40'),_0x5f60ac[_0x2199('0x24')]),_0x5f60ac);calls[_0x2199('0x3f')](_0x5f60ac);recordings[_0x2199('0x3f')](_0x5f60ac);dials['newexten'](_0x5f60ac);}catch(_0x333a12){utils['error'](util['format'](_0x2199('0x40'),_0x5f60ac[_0x2199('0x24')]),_0x333a12);}});ami['on']('newchannel',function(_0x5bfcc7){try{utils[_0x2199('0x1c')](util[_0x2199('0x1d')](_0x2199('0x41'),_0x5bfcc7[_0x2199('0x24')]),_0x5bfcc7);calls[_0x2199('0x42')](_0x5bfcc7);recordings[_0x2199('0x42')](_0x5bfcc7);}catch(_0x3ee4c4){utils[_0x2199('0x18')](util[_0x2199('0x1d')](_0x2199('0x41'),_0x5bfcc7[_0x2199('0x24')]),_0x3ee4c4);}});ami['on'](_0x2199('0x43'),function(_0x45c398){try{utils[_0x2199('0x1c')](util['format']('[%s][index][dialbegin]',_0x45c398[_0x2199('0x24')]),_0x45c398);dials[_0x2199('0x43')](_0x45c398);}catch(_0x9885e5){utils[_0x2199('0x18')](util[_0x2199('0x1d')](_0x2199('0x44'),_0x45c398[_0x2199('0x24')]),_0x9885e5);}});ami['on'](_0x2199('0x45'),function(_0x446a71){try{utils[_0x2199('0x1c')](util[_0x2199('0x1d')](_0x2199('0x46'),_0x446a71[_0x2199('0x24')]),_0x446a71);dials[_0x2199('0x45')](_0x446a71);}catch(_0x5111c5){utils[_0x2199('0x18')](util[_0x2199('0x1d')](_0x2199('0x46'),_0x446a71[_0x2199('0x24')]),_0x5111c5);}});} \ No newline at end of file +var _0x1b08=['[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','[%s][index][newstate]','newstate','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','origtransfereruniqueid','attendedtransfer','[%s][index][attendedtransfer]','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','dialbegin','[%s][index][dialbegin]','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','local','asterisk','port','password','keepConnected','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled'];(function(_0x5da875,_0x475a8b){var _0x25d687=function(_0xb8a423){while(--_0xb8a423){_0x5da875['push'](_0x5da875['shift']());}};_0x25d687(++_0x475a8b);}(_0x1b08,0x1d0));var _0x81b0=function(_0xcd81b8,_0x18d9fd){_0xcd81b8=_0xcd81b8-0x0;var _0xc3ae18=_0x1b08[_0xcd81b8];return _0xc3ae18;};var AsteriskManager=require(_0x81b0('0x0'));var config=require(_0x81b0('0x1'));var utils=require(_0x81b0('0x2'));var util=require(_0x81b0('0x3'));var isXDREnabled=config[_0x81b0('0x4')]&&config[_0x81b0('0x4')][_0x81b0('0x5')]?!config[_0x81b0('0x4')][_0x81b0('0x5')]:!![];var isProduction=config[_0x81b0('0x6')]==='production'||![];var isLocalAsterisk=config[_0x81b0('0x4')]&&config[_0x81b0('0x4')][_0x81b0('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0x81b0('0x8')][_0x81b0('0x9')],config['asterisk']['ip'],config[_0x81b0('0x8')]['username'],config[_0x81b0('0x8')][_0x81b0('0xa')],!![]);ami[_0x81b0('0xb')]();if(!isXDREnabled){utils[_0x81b0('0xc')](_0x81b0('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x81b0('0xc')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0x81b0('0xe'));var calls=require(_0x81b0('0xf'));var queues=require(_0x81b0('0x10'));var recordings=require(_0x81b0('0x11'));var members=require(_0x81b0('0x12'));var dials=require(_0x81b0('0x13'));var transfers=require(_0x81b0('0x14'));var core=require('./core.controller');ami['on'](_0x81b0('0x15'),core[_0x81b0('0x15')]);ami['on'](_0x81b0('0x16'),core[_0x81b0('0x16')]);ami['on'](_0x81b0('0x17'),core[_0x81b0('0x17')]);ami['on'](_0x81b0('0x18'),core[_0x81b0('0x18')]);ami['on'](_0x81b0('0x19'),core[_0x81b0('0x19')]);ami['on'](_0x81b0('0x1a'),core[_0x81b0('0x1a')]);ami['on'](_0x81b0('0x1b'),function(_0x31b7ff){try{utils[_0x81b0('0x1c')](util[_0x81b0('0x1d')]('[%s][index][devicestatechange]',_0x31b7ff['device']),_0x31b7ff);members[_0x81b0('0x1b')](_0x31b7ff);}catch(_0x33a404){utils[_0x81b0('0x18')](util['format'](_0x81b0('0x1e'),_0x31b7ff[_0x81b0('0x1f')]),_0x33a404);}});ami['on'](_0x81b0('0x20'),function(_0xb92fbc){try{utils[_0x81b0('0x1c')](util[_0x81b0('0x1d')](_0x81b0('0x21'),_0xb92fbc['uniqueid']),_0xb92fbc);agents[_0x81b0('0x20')](_0xb92fbc);}catch(_0x19256c){utils[_0x81b0('0x18')](util[_0x81b0('0x1d')](_0x81b0('0x21'),_0xb92fbc[_0x81b0('0x22')]),_0x19256c);}});ami['on'](_0x81b0('0x23'),function(_0x259c62){try{utils[_0x81b0('0x1c')](util['format'](_0x81b0('0x24'),_0x259c62[_0x81b0('0x22')]),_0x259c62);agents[_0x81b0('0x23')](_0x259c62);}catch(_0x301a04){utils[_0x81b0('0x18')](util[_0x81b0('0x1d')](_0x81b0('0x24'),_0x259c62[_0x81b0('0x22')]),_0x301a04);}});ami['on'](_0x81b0('0x25'),function(_0x2515ab){try{utils['debug'](util[_0x81b0('0x1d')](_0x81b0('0x26'),_0x2515ab[_0x81b0('0x22')]),_0x2515ab);agents['agentconnect'](_0x2515ab);queues[_0x81b0('0x25')](_0x2515ab);}catch(_0x1366a0){utils[_0x81b0('0x18')](util[_0x81b0('0x1d')]('[%s][index][agentconnect]',_0x2515ab[_0x81b0('0x22')]),_0x1366a0);}});ami['on'](_0x81b0('0x27'),function(_0x5f0272){try{utils[_0x81b0('0x1c')](util[_0x81b0('0x1d')](_0x81b0('0x28'),_0x5f0272[_0x81b0('0x22')]),_0x5f0272);agents['agentcomplete'](_0x5f0272);queues[_0x81b0('0x27')](_0x5f0272);members[_0x81b0('0x27')](_0x5f0272);}catch(_0x329378){utils['error'](util[_0x81b0('0x1d')](_0x81b0('0x28'),_0x5f0272[_0x81b0('0x22')]),_0x329378);}});ami['on']('queuecallerabandon',function(_0x1fb6fe){try{utils[_0x81b0('0x1c')](util[_0x81b0('0x1d')](_0x81b0('0x29'),_0x1fb6fe['uniqueid']),_0x1fb6fe);agents[_0x81b0('0x2a')](_0x1fb6fe);queues[_0x81b0('0x2a')](_0x1fb6fe);}catch(_0x41da5f){utils[_0x81b0('0x18')](util[_0x81b0('0x1d')](_0x81b0('0x29'),_0x1fb6fe['uniqueid']),_0x41da5f);}});ami['on'](_0x81b0('0x2b'),function(_0x4889ce){try{utils['debug'](util[_0x81b0('0x1d')](_0x81b0('0x2c'),_0x4889ce[_0x81b0('0x22')]),_0x4889ce);queues[_0x81b0('0x2b')](_0x4889ce);recordings['queuecallerjoin'](_0x4889ce);}catch(_0x3bf173){utils[_0x81b0('0x18')](util[_0x81b0('0x1d')](_0x81b0('0x2c'),_0x4889ce[_0x81b0('0x22')]),_0x3bf173);}});ami['on'](_0x81b0('0x2d'),function(_0x2a4d1b){try{utils[_0x81b0('0x1c')](util['format'](_0x81b0('0x2e'),_0x2a4d1b[_0x81b0('0x22')]),_0x2a4d1b);queues[_0x81b0('0x2d')](_0x2a4d1b);}catch(_0x1d9f74){utils[_0x81b0('0x18')](util[_0x81b0('0x1d')]('[%s][index][queuecallerleave]',_0x2a4d1b[_0x81b0('0x22')]),_0x1d9f74);}});ami['on'](_0x81b0('0x2f'),function(_0x495210){try{utils[_0x81b0('0x1c')](util[_0x81b0('0x1d')](_0x81b0('0x30'),_0x495210[_0x81b0('0x22')]),_0x495210);queues[_0x81b0('0x2f')](_0x495210);calls['musiconholdstart'](_0x495210);}catch(_0x4f2e09){utils[_0x81b0('0x18')](util[_0x81b0('0x1d')](_0x81b0('0x30'),_0x495210[_0x81b0('0x22')]),_0x4f2e09);}});ami['on']('musiconholdstop',function(_0x5704b6){try{utils['debug'](util[_0x81b0('0x1d')](_0x81b0('0x31'),_0x5704b6[_0x81b0('0x22')]),_0x5704b6);queues['musiconholdstop'](_0x5704b6);calls[_0x81b0('0x32')](_0x5704b6);}catch(_0x51e362){utils['error'](util[_0x81b0('0x1d')](_0x81b0('0x31'),_0x5704b6[_0x81b0('0x22')]),_0x51e362);}});ami['on']('newstate',function(_0x13eaaf){try{utils[_0x81b0('0x1c')](util['format'](_0x81b0('0x33'),_0x13eaaf[_0x81b0('0x22')]),_0x13eaaf);calls[_0x81b0('0x34')](_0x13eaaf);recordings[_0x81b0('0x34')](_0x13eaaf);}catch(_0x12cbef){utils[_0x81b0('0x18')](util['format']('[%s][index][newstate]',_0x13eaaf[_0x81b0('0x22')]),_0x12cbef);}});ami['on'](_0x81b0('0x35'),function(_0x402538){try{utils[_0x81b0('0x1c')](util['format'](_0x81b0('0x36'),_0x402538[_0x81b0('0x22')]),_0x402538);calls[_0x81b0('0x35')](_0x402538);recordings[_0x81b0('0x35')](_0x402538);dials[_0x81b0('0x35')](_0x402538);agents[_0x81b0('0x35')](_0x402538);queues[_0x81b0('0x35')](_0x402538);}catch(_0x4e691b){utils['error'](util[_0x81b0('0x1d')]('[%s][index][hangup]',_0x402538[_0x81b0('0x22')]),_0x4e691b);}});ami['on'](_0x81b0('0x37'),function(_0x289f1f){try{utils[_0x81b0('0x1c')](util[_0x81b0('0x1d')]('[%s][index][cdr]',_0x289f1f['uniqueid']),_0x289f1f);members[_0x81b0('0x37')](_0x289f1f);}catch(_0x2461f8){utils[_0x81b0('0x18')](util[_0x81b0('0x1d')](_0x81b0('0x38'),_0x289f1f[_0x81b0('0x22')]),_0x2461f8);}});ami['on'](_0x81b0('0x39'),function(_0x2e3a26){try{utils[_0x81b0('0x1c')](util[_0x81b0('0x1d')](_0x81b0('0x3a'),_0x2e3a26[_0x81b0('0x22')]),_0x2e3a26);queues[_0x81b0('0x39')](_0x2e3a26);agents[_0x81b0('0x39')](_0x2e3a26);transfers[_0x81b0('0x39')](_0x2e3a26);recordings['blindtransfer'](_0x2e3a26);}catch(_0x4baeef){utils[_0x81b0('0x18')](util[_0x81b0('0x1d')](_0x81b0('0x3a'),_0x2e3a26[_0x81b0('0x22')]),_0x4baeef);}});ami['on']('attendedtransfer',function(_0x58d81c){try{utils[_0x81b0('0x1c')](util[_0x81b0('0x1d')]('[%s][index][attendedtransfer]',_0x58d81c[_0x81b0('0x3b')]),_0x58d81c);queues[_0x81b0('0x3c')](_0x58d81c);transfers[_0x81b0('0x3c')](_0x58d81c);agents[_0x81b0('0x3c')](_0x58d81c);calls[_0x81b0('0x3c')](_0x58d81c);}catch(_0x52eb94){utils[_0x81b0('0x18')](util[_0x81b0('0x1d')](_0x81b0('0x3d'),_0x58d81c[_0x81b0('0x3b')]),_0x52eb94);}});ami['on']('varset',function(_0x41420d){try{utils[_0x81b0('0x1c')](util[_0x81b0('0x1d')]('[%s][index][varset]',_0x41420d['uniqueid']),_0x41420d);queues[_0x81b0('0x3e')](_0x41420d);recordings[_0x81b0('0x3e')](_0x41420d);calls[_0x81b0('0x3e')](_0x41420d);dials['varset'](_0x41420d);}catch(_0x17f688){utils[_0x81b0('0x18')](util['format'](_0x81b0('0x3f'),_0x41420d[_0x81b0('0x22')]),_0x17f688);}});ami['on'](_0x81b0('0x40'),function(_0x2455fc){try{utils[_0x81b0('0x1c')](util[_0x81b0('0x1d')]('[%s][index][newexten]',_0x2455fc[_0x81b0('0x22')]),_0x2455fc);calls[_0x81b0('0x40')](_0x2455fc);recordings[_0x81b0('0x40')](_0x2455fc);dials['newexten'](_0x2455fc);}catch(_0xfaf2c7){utils[_0x81b0('0x18')](util[_0x81b0('0x1d')](_0x81b0('0x41'),_0x2455fc[_0x81b0('0x22')]),_0xfaf2c7);}});ami['on']('newchannel',function(_0x15ce7c){try{utils[_0x81b0('0x1c')](util['format']('[%s][index][newchannel]',_0x15ce7c[_0x81b0('0x22')]),_0x15ce7c);calls['newchannel'](_0x15ce7c);recordings[_0x81b0('0x42')](_0x15ce7c);}catch(_0x43ab73){utils[_0x81b0('0x18')](util[_0x81b0('0x1d')]('[%s][index][newchannel]',_0x15ce7c['uniqueid']),_0x43ab73);}});ami['on'](_0x81b0('0x43'),function(_0x10cdc5){try{utils[_0x81b0('0x1c')](util[_0x81b0('0x1d')](_0x81b0('0x44'),_0x10cdc5[_0x81b0('0x22')]),_0x10cdc5);dials[_0x81b0('0x43')](_0x10cdc5);}catch(_0xcaccfe){utils[_0x81b0('0x18')](util[_0x81b0('0x1d')]('[%s]dialbegin',_0x10cdc5[_0x81b0('0x22')]),_0xcaccfe);}});ami['on'](_0x81b0('0x45'),function(_0x3806f8){try{utils[_0x81b0('0x1c')](util['format'](_0x81b0('0x46'),_0x3806f8[_0x81b0('0x22')]),_0x3806f8);dials['dialend'](_0x3806f8);}catch(_0x4be851){utils[_0x81b0('0x18')](util[_0x81b0('0x1d')](_0x81b0('0x46'),_0x3806f8[_0x81b0('0x22')]),_0x4be851);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 5ce179b..4fd906d 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 _0x97da=['interface','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','split','error','[%s][members][writeDB]','some','startsWith','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','[%s][members][agentcomplete]','info','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','cdr','[%s][members][cdr]','channel','assign','data1','data2','source','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','destinationchannel','destination','lodash','./utils','Local/_attended@transfer','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','membername','type'];(function(_0x4d1643,_0x28a790){var _0x43eec4=function(_0xea9983){while(--_0xea9983){_0x4d1643['push'](_0x4d1643['shift']());}};_0x43eec4(++_0x28a790);}(_0x97da,0x164));var _0xa97d=function(_0x51cd61,_0x5ac573){_0x51cd61=_0x51cd61-0x0;var _0x474e89=_0x97da[_0x51cd61];return _0x474e89;};'use strict';var _=require(_0xa97d('0x0'));var util=require('util');var utils=require(_0xa97d('0x1'));var members={};var exclude=[_0xa97d('0x2'),'Queue:'];function writeDB(_0x275c14){utils['info'](util[_0xa97d('0x3')](_0xa97d('0x4'),_0x275c14[_0xa97d('0x5')],_0x275c14['interface'],_0x275c14['channel'],_0x275c14['data2'],_0x275c14[_0xa97d('0x6')],_0x275c14[_0xa97d('0x7')]));if(_0x275c14[_0xa97d('0x8')]){utils[_0xa97d('0x9')](_0x275c14[_0xa97d('0x8')])[_0xa97d('0xa')](function(_0x1d0ab0){if(_0x1d0ab0){_0x275c14['membername']=_0x1d0ab0[_0xa97d('0xb')];_0x275c14[_0xa97d('0xc')]=_0x1d0ab0['internal'];utils[_0xa97d('0xd')](_0xa97d('0xe'),_0x275c14);}else{utils[_0xa97d('0xf')](_0x275c14[_0xa97d('0x8')][_0xa97d('0x10')]('/')[0x1])['then'](function(_0x1002ba){if(_0x1002ba){_0x275c14[_0xa97d('0x6')]=_0x1002ba[_0xa97d('0xb')];_0x275c14[_0xa97d('0xc')]=_0x1002ba['internal'];utils[_0xa97d('0xd')](_0xa97d('0xe'),_0x275c14);}});}})['catch'](function(_0x4d10d1){utils[_0xa97d('0x11')](util['format'](_0xa97d('0x12'),_0x275c14[_0xa97d('0x5')]),_0x4d10d1);});}delete members[_0x275c14[_0xa97d('0x8')]];}function startsWith(_0xd23310,_0x2c94f6){return _[_0xa97d('0x13')](_0xd23310,function(_0xbe54ea){return _[_0xa97d('0x14')](_0x2c94f6,_0xbe54ea);});}exports[_0xa97d('0x15')]=function(_0x4f73f3){try{utils[_0xa97d('0x16')](util[_0xa97d('0x3')](_0xa97d('0x17'),members[_0x4f73f3[_0xa97d('0x18')]]?members[_0x4f73f3[_0xa97d('0x18')]][_0xa97d('0x5')]:_0x4f73f3[_0xa97d('0x18')]),_0x4f73f3);utils['info'](util[_0xa97d('0x3')](_0xa97d('0x19'),members[_0x4f73f3[_0xa97d('0x18')]]?members[_0x4f73f3[_0xa97d('0x18')]]['uniqueid']:_0x4f73f3[_0xa97d('0x18')],_0x4f73f3[_0xa97d('0x1a')],_0x4f73f3[_0xa97d('0x18')]));switch(_0x4f73f3[_0xa97d('0x1a')]){case _0xa97d('0x1b'):case _0xa97d('0x1c'):if(!startsWith(exclude,_0x4f73f3[_0xa97d('0x18')])){members[_0x4f73f3[_0xa97d('0x18')]]={'channel':_0xa97d('0x1d'),'interface':_0x4f73f3[_0xa97d('0x18')],'type':_0xa97d('0x1e'),'enterAt':utils[_0xa97d('0x1f')](),'role':_0xa97d('0x20')};}break;case _0xa97d('0x21'):if(!_[_0xa97d('0x22')](members[_0x4f73f3[_0xa97d('0x18')]])){members[_0x4f73f3[_0xa97d('0x18')]][_0xa97d('0x23')]=utils[_0xa97d('0x1f')]();members[_0x4f73f3['device']][_0xa97d('0x24')]=utils['diffTime'](members[_0x4f73f3[_0xa97d('0x18')]][_0xa97d('0x23')],members[_0x4f73f3[_0xa97d('0x18')]]['enterAt']);if(members[_0x4f73f3['device']][_0xa97d('0x5')]){writeDB(members[_0x4f73f3[_0xa97d('0x18')]]);}}break;default:break;}}catch(_0x583ba5){utils[_0xa97d('0x11')](util['format'](_0xa97d('0x17'),members[_0x4f73f3[_0xa97d('0x18')]]?members[_0x4f73f3[_0xa97d('0x18')]]['uniqueid']:_0x4f73f3[_0xa97d('0x18')]),_0x583ba5);}};exports['agentcomplete']=function(_0xac5f0e){try{if(!_[_0xa97d('0x22')](members[_0xac5f0e[_0xa97d('0x8')]])){utils[_0xa97d('0x16')](util['format'](_0xa97d('0x25'),_0xac5f0e['uniqueid']),_0xac5f0e);utils[_0xa97d('0x26')](util['format'](_0xa97d('0x27'),_0xac5f0e[_0xa97d('0x5')],_0xac5f0e[_0xa97d('0x8')],_0xac5f0e[_0xa97d('0x28')]));members[_0xac5f0e[_0xa97d('0x8')]]=_['assign'](members[_0xac5f0e[_0xa97d('0x8')]],{'data4':_0xac5f0e['queue'],'uniqueid':_0xac5f0e[_0xa97d('0x5')]});}}catch(_0x5c44be){utils[_0xa97d('0x11')](util[_0xa97d('0x3')]('[%s][members][agentcomplete]',_0xac5f0e[_0xa97d('0x5')]),_0x5c44be);}};exports[_0xa97d('0x29')]=function(_0x3917df){try{utils[_0xa97d('0x16')](util['format'](_0xa97d('0x2a'),_0x3917df['uniqueid']),_0x3917df);if(_0x3917df[_0xa97d('0x2b')]){var _0x278e2d=_0x3917df[_0xa97d('0x2b')]['split']('-')[0x0];if(!_[_0xa97d('0x22')](members[_0x278e2d])){members[_0x278e2d]=_[_0xa97d('0x2c')](members[_0x278e2d],{'data1':members[_0x278e2d][_0xa97d('0x2d')]||_0x3917df[_0xa97d('0x7')],'data2':members[_0x278e2d][_0xa97d('0x2e')]||_0x3917df[_0xa97d('0x2f')],'data3':members[_0x278e2d]['data3']||_0x3917df['destination'],'uniqueid':members[_0x278e2d][_0xa97d('0x5')]||_0x3917df['uniqueid']});utils['info'](util[_0xa97d('0x3')](_0xa97d('0x30'),_0x3917df[_0xa97d('0x5')],members[_0x278e2d][_0xa97d('0x2d')],members[_0x278e2d][_0xa97d('0x2e')],members[_0x278e2d][_0xa97d('0x31')]));if(members[_0x278e2d]['exitAt']){writeDB(members[_0x278e2d]);}}}if(_0x3917df[_0xa97d('0x32')]){var _0x53ad72=_0x3917df['destinationchannel'][_0xa97d('0x10')]('-')[0x0];if(!_['isNil'](members[_0x53ad72])){members[_0x53ad72]=_[_0xa97d('0x2c')](members[_0x53ad72],{'data1':members[_0x53ad72]['data1']||_0x3917df['type'],'data2':members[_0x53ad72][_0xa97d('0x2e')]||_0x3917df[_0xa97d('0x2f')],'data3':members[_0x53ad72]['data3']||_0x3917df[_0xa97d('0x33')],'uniqueid':members[_0x53ad72][_0xa97d('0x5')]||_0x3917df['uniqueid']});utils[_0xa97d('0x26')](util['format'](_0xa97d('0x30'),_0x3917df[_0xa97d('0x5')],members[_0x53ad72][_0xa97d('0x2d')],members[_0x53ad72]['data2'],members[_0x53ad72][_0xa97d('0x31')]));if(members[_0x53ad72]['exitAt']){writeDB(members[_0x53ad72]);}}}}catch(_0x2d3f71){utils[_0xa97d('0x11')](util[_0xa97d('0x3')]('[%s][members][cdr]',_0x3917df[_0xa97d('0x5')]),_0x2d3f71);}}; \ No newline at end of file +var _0x2608=['error','format','[%s][members][writeDB]','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','agent','exitAt','duration','diffTime','enterAt','agentcomplete','isNil','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','data1','source','data3','destinationchannel','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','./utils','Local/_attended@transfer','Queue:','info','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','channel','data2','membername','type','interface','getUserByInterface','internal','request','CreateMemberReport','getUserByName','split','then','name','catch'];(function(_0x590b63,_0x14debb){var _0x3c9380=function(_0x58fc67){while(--_0x58fc67){_0x590b63['push'](_0x590b63['shift']());}};_0x3c9380(++_0x14debb);}(_0x2608,0x1c8));var _0x8260=function(_0x3d3db2,_0x1a7757){_0x3d3db2=_0x3d3db2-0x0;var _0x5e83aa=_0x2608[_0x3d3db2];return _0x5e83aa;};'use strict';var _=require(_0x8260('0x0'));var util=require('util');var utils=require(_0x8260('0x1'));var members={};var exclude=[_0x8260('0x2'),_0x8260('0x3')];function writeDB(_0x4d1712){utils[_0x8260('0x4')](util['format'](_0x8260('0x5'),_0x4d1712[_0x8260('0x6')],_0x4d1712['interface'],_0x4d1712[_0x8260('0x7')],_0x4d1712[_0x8260('0x8')],_0x4d1712[_0x8260('0x9')],_0x4d1712[_0x8260('0xa')]));if(_0x4d1712[_0x8260('0xb')]){utils[_0x8260('0xc')](_0x4d1712['interface'])['then'](function(_0x5a8580){if(_0x5a8580){_0x4d1712[_0x8260('0x9')]=_0x5a8580['name'];_0x4d1712[_0x8260('0xd')]=_0x5a8580[_0x8260('0xd')];utils[_0x8260('0xe')](_0x8260('0xf'),_0x4d1712);}else{utils[_0x8260('0x10')](_0x4d1712[_0x8260('0xb')][_0x8260('0x11')]('/')[0x1])[_0x8260('0x12')](function(_0x24408d){if(_0x24408d){_0x4d1712[_0x8260('0x9')]=_0x24408d[_0x8260('0x13')];_0x4d1712['internal']=_0x24408d['internal'];utils[_0x8260('0xe')](_0x8260('0xf'),_0x4d1712);}});}})[_0x8260('0x14')](function(_0x3e607e){utils[_0x8260('0x15')](util[_0x8260('0x16')](_0x8260('0x17'),_0x4d1712['uniqueid']),_0x3e607e);});}delete members[_0x4d1712['interface']];}function startsWith(_0x1da39c,_0x5e95b5){return _['some'](_0x1da39c,function(_0x3253b2){return _[_0x8260('0x18')](_0x5e95b5,_0x3253b2);});}exports[_0x8260('0x19')]=function(_0x21b4e5){try{utils[_0x8260('0x1a')](util[_0x8260('0x16')](_0x8260('0x1b'),members[_0x21b4e5[_0x8260('0x1c')]]?members[_0x21b4e5['device']]['uniqueid']:_0x21b4e5['device']),_0x21b4e5);utils['info'](util[_0x8260('0x16')](_0x8260('0x1d'),members[_0x21b4e5['device']]?members[_0x21b4e5[_0x8260('0x1c')]][_0x8260('0x6')]:_0x21b4e5[_0x8260('0x1c')],_0x21b4e5['state'],_0x21b4e5[_0x8260('0x1c')]));switch(_0x21b4e5[_0x8260('0x1e')]){case _0x8260('0x1f'):case _0x8260('0x20'):if(!startsWith(exclude,_0x21b4e5[_0x8260('0x1c')])){members[_0x21b4e5[_0x8260('0x1c')]]={'channel':_0x8260('0x21'),'interface':_0x21b4e5[_0x8260('0x1c')],'type':_0x8260('0x22'),'enterAt':utils[_0x8260('0x23')](),'role':_0x8260('0x24')};}break;case'NOT_INUSE':if(!_['isNil'](members[_0x21b4e5[_0x8260('0x1c')]])){members[_0x21b4e5['device']][_0x8260('0x25')]=utils[_0x8260('0x23')]();members[_0x21b4e5[_0x8260('0x1c')]][_0x8260('0x26')]=utils[_0x8260('0x27')](members[_0x21b4e5[_0x8260('0x1c')]][_0x8260('0x25')],members[_0x21b4e5['device']][_0x8260('0x28')]);if(members[_0x21b4e5[_0x8260('0x1c')]][_0x8260('0x6')]){writeDB(members[_0x21b4e5[_0x8260('0x1c')]]);}}break;default:break;}}catch(_0x43fe69){utils['error'](util['format']('[%s][members][devicestatechange]',members[_0x21b4e5[_0x8260('0x1c')]]?members[_0x21b4e5['device']][_0x8260('0x6')]:_0x21b4e5[_0x8260('0x1c')]),_0x43fe69);}};exports[_0x8260('0x29')]=function(_0x5e69f3){try{if(!_[_0x8260('0x2a')](members[_0x5e69f3[_0x8260('0xb')]])){utils[_0x8260('0x1a')](util[_0x8260('0x16')](_0x8260('0x2b'),_0x5e69f3['uniqueid']),_0x5e69f3);utils[_0x8260('0x4')](util[_0x8260('0x16')](_0x8260('0x2c'),_0x5e69f3[_0x8260('0x6')],_0x5e69f3[_0x8260('0xb')],_0x5e69f3[_0x8260('0x2d')]));members[_0x5e69f3[_0x8260('0xb')]]=_[_0x8260('0x2e')](members[_0x5e69f3['interface']],{'data4':_0x5e69f3[_0x8260('0x2d')],'uniqueid':_0x5e69f3[_0x8260('0x6')]});}}catch(_0x5680ca){utils[_0x8260('0x15')](util[_0x8260('0x16')](_0x8260('0x2b'),_0x5e69f3[_0x8260('0x6')]),_0x5680ca);}};exports[_0x8260('0x2f')]=function(_0x40435a){try{utils[_0x8260('0x1a')](util[_0x8260('0x16')]('[%s][members][cdr]',_0x40435a[_0x8260('0x6')]),_0x40435a);if(_0x40435a[_0x8260('0x7')]){var _0x58c310=_0x40435a[_0x8260('0x7')][_0x8260('0x11')]('-')[0x0];if(!_['isNil'](members[_0x58c310])){members[_0x58c310]=_[_0x8260('0x2e')](members[_0x58c310],{'data1':members[_0x58c310][_0x8260('0x30')]||_0x40435a[_0x8260('0xa')],'data2':members[_0x58c310]['data2']||_0x40435a[_0x8260('0x31')],'data3':members[_0x58c310][_0x8260('0x32')]||_0x40435a['destination'],'uniqueid':members[_0x58c310][_0x8260('0x6')]||_0x40435a[_0x8260('0x6')]});utils[_0x8260('0x4')](util[_0x8260('0x16')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x40435a[_0x8260('0x6')],members[_0x58c310][_0x8260('0x30')],members[_0x58c310][_0x8260('0x8')],members[_0x58c310][_0x8260('0x32')]));if(members[_0x58c310][_0x8260('0x25')]){writeDB(members[_0x58c310]);}}}if(_0x40435a[_0x8260('0x33')]){var _0x36a5db=_0x40435a[_0x8260('0x33')][_0x8260('0x11')]('-')[0x0];if(!_[_0x8260('0x2a')](members[_0x36a5db])){members[_0x36a5db]=_['assign'](members[_0x36a5db],{'data1':members[_0x36a5db][_0x8260('0x30')]||_0x40435a[_0x8260('0xa')],'data2':members[_0x36a5db][_0x8260('0x8')]||_0x40435a[_0x8260('0x31')],'data3':members[_0x36a5db][_0x8260('0x32')]||_0x40435a['destination'],'uniqueid':members[_0x36a5db][_0x8260('0x6')]||_0x40435a[_0x8260('0x6')]});utils[_0x8260('0x4')](util[_0x8260('0x16')](_0x8260('0x34'),_0x40435a[_0x8260('0x6')],members[_0x36a5db][_0x8260('0x30')],members[_0x36a5db][_0x8260('0x8')],members[_0x36a5db][_0x8260('0x32')]));if(members[_0x36a5db][_0x8260('0x25')]){writeDB(members[_0x36a5db]);}}}}catch(_0x3bce85){utils[_0x8260('0x15')](util[_0x8260('0x16')]('[%s][members][cdr]',_0x40435a['uniqueid']),_0x3bce85);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 7b41b82..68ba3a4 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 _0xa63a=['now','error','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','varset','[%s][queues][varset]','queuestatus','toUpperCase','CONTINUE','queuecallerexitAt','value','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queuecallerabandonAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleave','holdtime','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','accountcode','[%s][queues][agentconnect]','agentcomplete','[%s][queues][agentcomplete]','transfer','TRANSFER','reason','blindtransfer','transfereeuniqueid','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','transfertype','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','queuecallerenterreason','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','lastAssignedTo','calleridnum','queuecallerexitreason','queue','then','type','request','CreateVoiceQueueReport','transfereduniqueid','debug','[%s][queues][queuecallerjoin]','format','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0xa63a,0x12a));var _0xaa63=function(_0x4fe19c,_0x45d0fe){_0x4fe19c=_0x4fe19c-0x0;var _0x952ac7=_0xa63a[_0x4fe19c];return _0x952ac7;};'use strict';var _=require(_0xaa63('0x0'));var util=require(_0xaa63('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x37209e){utils[_0xaa63('0x2')](util['format'](_0xaa63('0x3'),_0x37209e[_0xaa63('0x4')],_0x37209e[_0xaa63('0x5')],_0x37209e['queue'],_0x37209e[_0xaa63('0x6')],_0x37209e[_0xaa63('0x7')],_0x37209e['accountcode'],_0x37209e[_0xaa63('0x8')]));if(_0x37209e[_0xaa63('0x9')]){utils['getVoiceQueueByName'](_0x37209e[_0xaa63('0x9')])[_0xaa63('0xa')](function(_0xd9ec4e){if(_0xd9ec4e){_0x37209e[_0xaa63('0xb')]=_0xd9ec4e['type'];}utils['request']('CreateVoiceQueueReport',_0x37209e);});}else{utils[_0xaa63('0xc')](_0xaa63('0xd'),_0x37209e);}if(_0x37209e[_0xaa63('0xe')]){delete queues[_0x37209e[_0xaa63('0xe')]];}else{delete queues[_0x37209e['uniqueid']];}}exports['queuecallerjoin']=function(_0x25e14b){try{utils[_0xaa63('0xf')](util['format'](_0xaa63('0x10'),_0x25e14b[_0xaa63('0x4')]),_0x25e14b);utils[_0xaa63('0x2')](util[_0xaa63('0x11')](_0xaa63('0x12'),_0x25e14b[_0xaa63('0x4')],_0x25e14b[_0xaa63('0x9')],_0x25e14b['position']));queues[_0x25e14b[_0xaa63('0x4')]]=_['assign'](_0x25e14b,{'originalposition':_0x25e14b[_0xaa63('0x13')],'queuecallerjoinAt':utils[_0xaa63('0x14')](),'mohtime':0x0});}catch(_0x4d7f94){utils[_0xaa63('0x15')](util[_0xaa63('0x11')](_0xaa63('0x10'),_0x25e14b['uniqueid']),_0x4d7f94);}};exports[_0xaa63('0x16')]=function(_0x407654){try{if(!_[_0xaa63('0x17')](queues[_0x407654['uniqueid']])){utils[_0xaa63('0xf')](util['format'](_0xaa63('0x18'),_0x407654[_0xaa63('0x4')]),_0x407654);if(queues[_0x407654[_0xaa63('0x4')]][_0xaa63('0x19')]){if(!queues[_0x407654['uniqueid']][_0xaa63('0x1a')]&&!queues[_0x407654[_0xaa63('0x4')]][_0xaa63('0x1b')]){queues[_0x407654[_0xaa63('0x4')]][_0xaa63('0x1c')]=!![];queues[_0x407654[_0xaa63('0x4')]][_0xaa63('0x1d')]=utils[_0xaa63('0x14')]();queues[_0x407654[_0xaa63('0x4')]][_0xaa63('0x8')]='COMPLETEDBYAGENT';}utils[_0xaa63('0x2')](util[_0xaa63('0x11')](_0xaa63('0x1e'),_0x407654[_0xaa63('0x4')],queues[_0x407654[_0xaa63('0x4')]][_0xaa63('0x1f')],queues[_0x407654['uniqueid']][_0xaa63('0x8')]));writeDB(queues[_0x407654[_0xaa63('0x4')]]);}else if(queues[_0x407654[_0xaa63('0x4')]][_0xaa63('0xe')]){utils[_0xaa63('0x2')](util['format'](_0xaa63('0x20'),_0x407654[_0xaa63('0x4')],queues[_0x407654['uniqueid']][_0xaa63('0x1f')],queues[_0x407654['uniqueid']][_0xaa63('0xe')]));queues[queues[_0x407654['uniqueid']][_0xaa63('0xe')]]=queues[_0x407654['uniqueid']];queues[queues[_0x407654[_0xaa63('0x4')]][_0xaa63('0xe')]]['queuecallerenterreason']=0x2;delete queues[_0x407654[_0xaa63('0x4')]];}}}catch(_0x404682){utils[_0xaa63('0x15')](util[_0xaa63('0x11')]('[%s][queues][hangup]',_0x407654[_0xaa63('0x4')]),_0x404682);}};exports[_0xaa63('0x21')]=function(_0x3f33ed){try{utils[_0xaa63('0xf')](util[_0xaa63('0x11')](_0xaa63('0x22'),_0x3f33ed[_0xaa63('0x4')]),_0x3f33ed);if(!_[_0xaa63('0x17')](_0x3f33ed['variable'][_0xaa63('0x23')])&&_0x3f33ed['value'][_0xaa63('0x24')]()!==_0xaa63('0x25')){if(!_[_0xaa63('0x17')](queues[_0x3f33ed[_0xaa63('0x4')]])){queues[_0x3f33ed[_0xaa63('0x4')]]['queuecallerabandon']=![];queues[_0x3f33ed[_0xaa63('0x4')]]['queuecallerabandonAt']=null;queues[_0x3f33ed[_0xaa63('0x4')]]['queuecallerexit']=!![];queues[_0x3f33ed['uniqueid']][_0xaa63('0x26')]=utils[_0xaa63('0x14')]();queues[_0x3f33ed[_0xaa63('0x4')]][_0xaa63('0x8')]=_0x3f33ed[_0xaa63('0x27')]['toUpperCase']();utils[_0xaa63('0x2')](util['format'](_0xaa63('0x28'),_0x3f33ed[_0xaa63('0x4')],queues[_0x3f33ed[_0xaa63('0x4')]]['name'],_0x3f33ed[_0xaa63('0x27')],queues[_0x3f33ed['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x3f33ed['uniqueid']]);}}else if(!_[_0xaa63('0x17')](_0x3f33ed[_0xaa63('0x29')]['queueposition'])){if(!_[_0xaa63('0x17')](queues[_0x3f33ed['uniqueid']])&&!queues[_0x3f33ed['uniqueid']]['queuecallerabandon']){queues[_0x3f33ed[_0xaa63('0x4')]][_0xaa63('0x1a')]=![];queues[_0x3f33ed['uniqueid']][_0xaa63('0x2a')]=null;queues[_0x3f33ed['uniqueid']][_0xaa63('0x1b')]=!![];queues[_0x3f33ed['uniqueid']][_0xaa63('0x26')]=utils[_0xaa63('0x14')]();queues[_0x3f33ed['uniqueid']][_0xaa63('0x8')]=_0xaa63('0x2b');utils[_0xaa63('0x2')](util[_0xaa63('0x11')](_0xaa63('0x2c'),_0x3f33ed[_0xaa63('0x4')],queues[_0x3f33ed[_0xaa63('0x4')]]['name'],_0x3f33ed[_0xaa63('0x27')],queues[_0x3f33ed[_0xaa63('0x4')]]['queuecallerexitreason']));}}}catch(_0x3f565e){utils['error'](util['format'](_0xaa63('0x22'),_0x3f33ed[_0xaa63('0x4')]),_0x3f565e);}};exports['queuecallerabandon']=function(_0x2f1907){try{if(!_[_0xaa63('0x17')](queues[_0x2f1907[_0xaa63('0x4')]])){utils['debug'](util[_0xaa63('0x11')](_0xaa63('0x2d'),_0x2f1907[_0xaa63('0x4')]),_0x2f1907);queues[_0x2f1907[_0xaa63('0x4')]][_0xaa63('0x1b')]=![];queues[_0x2f1907['uniqueid']][_0xaa63('0x26')]=null;queues[_0x2f1907[_0xaa63('0x4')]]['queuecallerabandon']=!![];queues[_0x2f1907[_0xaa63('0x4')]][_0xaa63('0x2a')]=utils[_0xaa63('0x14')]();queues[_0x2f1907['uniqueid']][_0xaa63('0x8')]=_0xaa63('0x2e');utils[_0xaa63('0x2')](util['format'](_0xaa63('0x2f'),_0x2f1907['uniqueid'],queues[_0x2f1907[_0xaa63('0x4')]][_0xaa63('0x1f')],queues[_0x2f1907['uniqueid']]['queuecallerexitreason']));}}catch(_0x1eb86f){utils[_0xaa63('0x15')](util[_0xaa63('0x11')]('[%s][queues][queuecallerabandon]',_0x2f1907['uniqueid']),_0x1eb86f);}};exports['queuecallerleave']=function(_0x23984f){try{if(!_[_0xaa63('0x17')](queues[_0x23984f[_0xaa63('0x4')]])){utils[_0xaa63('0xf')](util[_0xaa63('0x11')](_0xaa63('0x30'),_0x23984f[_0xaa63('0x4')]),_0x23984f);utils[_0xaa63('0x2')](util[_0xaa63('0x11')](_0xaa63('0x31'),_0x23984f[_0xaa63('0x4')],queues[_0x23984f[_0xaa63('0x4')]][_0xaa63('0x1f')],_0x23984f[_0xaa63('0x32')],_0x23984f[_0xaa63('0x33')]));queues[_0x23984f['uniqueid']][_0xaa63('0x34')]=!![];queues[_0x23984f[_0xaa63('0x4')]][_0xaa63('0x19')]=utils[_0xaa63('0x14')]();queues[_0x23984f[_0xaa63('0x4')]][_0xaa63('0x35')]=utils[_0xaa63('0x36')](queues[_0x23984f[_0xaa63('0x4')]]['queuecallerleaveAt'],queues[_0x23984f[_0xaa63('0x4')]][_0xaa63('0x37')]);queues[_0x23984f['uniqueid']][_0xaa63('0x13')]=_0x23984f[_0xaa63('0x13')];queues[_0x23984f[_0xaa63('0x4')]][_0xaa63('0x38')]=_0x23984f['count'];queues[_0x23984f['uniqueid']][_0xaa63('0x32')]=_0x23984f[_0xaa63('0x32')];queues[_0x23984f[_0xaa63('0x4')]][_0xaa63('0x33')]=_0x23984f[_0xaa63('0x33')];}}catch(_0x372dde){utils['error'](util[_0xaa63('0x11')](_0xaa63('0x30'),_0x23984f[_0xaa63('0x4')]),_0x372dde);}};exports[_0xaa63('0x39')]=function(_0x101c04){try{if(!_[_0xaa63('0x17')](queues[_0x101c04[_0xaa63('0x4')]])){utils['debug'](util['format']('[%s][queues][agentconnect]',_0x101c04[_0xaa63('0x4')]),_0x101c04);utils['info'](util[_0xaa63('0x11')](_0xaa63('0x3a'),_0x101c04[_0xaa63('0x4')],queues[_0x101c04[_0xaa63('0x4')]][_0xaa63('0x1f')],_0x101c04[_0xaa63('0x3b')],_0x101c04[_0xaa63('0x3c')]));queues[_0x101c04[_0xaa63('0x4')]][_0xaa63('0x1a')]=![];queues[_0x101c04[_0xaa63('0x4')]][_0xaa63('0x1a')]=![];queues[_0x101c04[_0xaa63('0x4')]][_0xaa63('0x2a')]=null;queues[_0x101c04[_0xaa63('0x4')]]['queuecallerexit']=![];queues[_0x101c04['uniqueid']][_0xaa63('0x8')]=null;queues[_0x101c04[_0xaa63('0x4')]][_0xaa63('0x26')]=null;queues[_0x101c04[_0xaa63('0x4')]][_0xaa63('0x3d')]=!![];queues[_0x101c04[_0xaa63('0x4')]][_0xaa63('0x3e')]=_0x101c04[_0xaa63('0x3c')];queues[_0x101c04['uniqueid']][_0xaa63('0x6')]=_0x101c04[_0xaa63('0x3b')];}}catch(_0x3c454d){utils[_0xaa63('0x15')](util['format'](_0xaa63('0x3f'),_0x101c04[_0xaa63('0x4')]),_0x3c454d);}};exports[_0xaa63('0x40')]=function(_0x3e6a2d){try{if(!_[_0xaa63('0x17')](queues[_0x3e6a2d[_0xaa63('0x4')]])){if(queues[_0x3e6a2d[_0xaa63('0x4')]][_0xaa63('0x19')]){utils[_0xaa63('0xf')](util[_0xaa63('0x11')](_0xaa63('0x41'),_0x3e6a2d[_0xaa63('0x4')]),_0x3e6a2d);queues[_0x3e6a2d[_0xaa63('0x4')]][_0xaa63('0x1a')]=![];queues[_0x3e6a2d[_0xaa63('0x4')]][_0xaa63('0x1a')]=![];queues[_0x3e6a2d[_0xaa63('0x4')]][_0xaa63('0x2a')]=null;queues[_0x3e6a2d['uniqueid']][_0xaa63('0x1b')]=![];queues[_0x3e6a2d[_0xaa63('0x4')]][_0xaa63('0x26')]=null;queues[_0x3e6a2d[_0xaa63('0x4')]][_0xaa63('0x3d')]=!![];queues[_0x3e6a2d[_0xaa63('0x4')]][_0xaa63('0x6')]=_0x3e6a2d[_0xaa63('0x3b')];queues[_0x3e6a2d[_0xaa63('0x4')]][_0xaa63('0x1c')]=!![];queues[_0x3e6a2d[_0xaa63('0x4')]][_0xaa63('0x1d')]=utils[_0xaa63('0x14')]();if(_0x3e6a2d['reason']==_0xaa63('0x42')){if(!queues[_0x3e6a2d[_0xaa63('0x4')]][_0xaa63('0x42')]){queues[_0x3e6a2d[_0xaa63('0x4')]][_0xaa63('0x8')]=_0xaa63('0x43');}}else{queues[_0x3e6a2d['uniqueid']]['queuecallerexitreason']='COMPLETEDBY'+_0x3e6a2d[_0xaa63('0x44')][_0xaa63('0x24')]();}utils['info'](util[_0xaa63('0x11')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x3e6a2d[_0xaa63('0x4')],queues[_0x3e6a2d[_0xaa63('0x4')]]['name'],_0x3e6a2d[_0xaa63('0x3b')],queues[_0x3e6a2d['uniqueid']][_0xaa63('0x8')]));writeDB(queues[_0x3e6a2d[_0xaa63('0x4')]]);}}}catch(_0x1696dd){utils[_0xaa63('0x15')](util[_0xaa63('0x11')](_0xaa63('0x41'),_0x3e6a2d['uniqueid']),_0x1696dd);}};exports[_0xaa63('0x45')]=function(_0x1e19e6){try{if(!_[_0xaa63('0x17')](queues[_0x1e19e6['transfereeuniqueid']])){utils['debug'](util[_0xaa63('0x11')]('[%s][queues][blindtransfer]',_0x1e19e6[_0xaa63('0x4')]),_0x1e19e6);queues[_0x1e19e6[_0xaa63('0x46')]][_0xaa63('0x42')]=!![];queues[_0x1e19e6[_0xaa63('0x46')]]['transfertype']=_0xaa63('0x47');queues[_0x1e19e6[_0xaa63('0x46')]][_0xaa63('0x48')]=_0x1e19e6[_0xaa63('0x49')];queues[_0x1e19e6['transfereeuniqueid']][_0xaa63('0x4a')]=_0x1e19e6[_0xaa63('0x46')];queues[_0x1e19e6[_0xaa63('0x46')]][_0xaa63('0x8')]=_0xaa63('0x4b');utils[_0xaa63('0x2')](util['format'](_0xaa63('0x4c'),_0x1e19e6[_0xaa63('0x4')],queues[_0x1e19e6[_0xaa63('0x46')]][_0xaa63('0x1f')],_0x1e19e6[_0xaa63('0x46')],_0x1e19e6['extension']));}}catch(_0x5c5ee2){utils[_0xaa63('0x15')](util[_0xaa63('0x11')](_0xaa63('0x4d'),_0x1e19e6['uniqueid']),_0x5c5ee2);}};exports['attendedtransfer']=function(_0x2de417){try{utils[_0xaa63('0xf')](util[_0xaa63('0x11')](_0xaa63('0x4e'),_0x2de417[_0xaa63('0x4f')]),_0x2de417);if(_0x2de417[_0xaa63('0x4f')]==_0x2de417[_0xaa63('0x50')]){if(!_[_0xaa63('0x17')](queues[_0x2de417[_0xaa63('0x51')]])){utils['info'](util[_0xaa63('0x11')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x2de417[_0xaa63('0x4f')],queues[_0x2de417[_0xaa63('0x51')]]['name'],_0x2de417[_0xaa63('0x52')]));queues[_0x2de417[_0xaa63('0x51')]][_0xaa63('0x42')]=!![];queues[_0x2de417[_0xaa63('0x51')]][_0xaa63('0x53')]=_0xaa63('0x54');queues[_0x2de417[_0xaa63('0x51')]][_0xaa63('0x48')]=_0x2de417[_0xaa63('0x52')];queues[_0x2de417['secondtransfererlinkedid']][_0xaa63('0x4a')]=_0x2de417[_0xaa63('0x4f')];queues[_0x2de417[_0xaa63('0x51')]][_0xaa63('0x8')]=_0xaa63('0x55');}if(!_[_0xaa63('0x17')](queues[_0x2de417[_0xaa63('0x50')]])){if(_0x2de417['transfereelinkedid']&&queues[_0x2de417['transfereelinkedid']]){queues[_0x2de417[_0xaa63('0x56')]]['queuecallerenterreason']=0x1;queues[_0x2de417[_0xaa63('0x46')]]=_[_0xaa63('0x57')](queues[_0x2de417[_0xaa63('0x56')]]);queues[_0x2de417[_0xaa63('0x46')]]['transfereduniqueid']=_0x2de417[_0xaa63('0x58')];queues[_0x2de417[_0xaa63('0x46')]][_0xaa63('0x59')]=0x2;queues[_0x2de417[_0xaa63('0x46')]][_0xaa63('0x7')]=queues[_0x2de417[_0xaa63('0x51')]][_0xaa63('0x7')];queues[_0x2de417[_0xaa63('0x46')]]['calleridname']=queues[_0x2de417['secondtransfererlinkedid']][_0xaa63('0x5a')];queues[_0x2de417[_0xaa63('0x46')]][_0xaa63('0x37')]=utils[_0xaa63('0x14')]();queues[_0x2de417[_0xaa63('0x46')]][_0xaa63('0x19')]=utils[_0xaa63('0x14')]();queues[_0x2de417['transfereeuniqueid']][_0xaa63('0x35')]=0x0;queues[_0x2de417[_0xaa63('0x46')]]['mohtime']=0x0;utils['info'](util[_0xaa63('0x11')](_0xaa63('0x5b'),_0x2de417[_0xaa63('0x4f')],queues[_0x2de417[_0xaa63('0x46')]][_0xaa63('0x1f')],queues[_0x2de417[_0xaa63('0x46')]][_0xaa63('0x7')],queues[_0x2de417[_0xaa63('0x46')]][_0xaa63('0x5a')]));}else{utils['info'](util['format'](_0xaa63('0x5c'),_0x2de417['origtransfereruniqueid'],queues[_0x2de417[_0xaa63('0x50')]][_0xaa63('0x1f')],_0x2de417[_0xaa63('0x51')]));queues[_0x2de417[_0xaa63('0x50')]][_0xaa63('0xe')]=_0x2de417[_0xaa63('0x51')];}}}else if(_0x2de417[_0xaa63('0x5d')]==_0x2de417[_0xaa63('0x51')]){if(!_[_0xaa63('0x17')](queues[_0x2de417[_0xaa63('0x50')]])){utils[_0xaa63('0x2')](util[_0xaa63('0x11')](_0xaa63('0x5e'),_0x2de417[_0xaa63('0x4f')],queues[_0x2de417[_0xaa63('0x50')]][_0xaa63('0x1f')],_0x2de417[_0xaa63('0x5d')],_0x2de417[_0xaa63('0x5f')]));queues[_0x2de417['origtransfererlinkedid']]['transfer']=!![];queues[_0x2de417[_0xaa63('0x50')]][_0xaa63('0x53')]='ATTENDED';queues[_0x2de417[_0xaa63('0x50')]][_0xaa63('0x48')]=_0x2de417[_0xaa63('0x5f')];queues[_0x2de417['origtransfererlinkedid']][_0xaa63('0x4a')]=_0x2de417[_0xaa63('0x5d')];queues[_0x2de417[_0xaa63('0x50')]][_0xaa63('0x8')]=_0xaa63('0x55');}if(!_['isNil'](queues[_0x2de417[_0xaa63('0x51')]])){if(_0x2de417[_0xaa63('0x60')]&&queues[_0x2de417['transfertargetlinkedid']]){queues[_0x2de417[_0xaa63('0x60')]]['queuecallerenterreason']=0x1;queues[_0x2de417[_0xaa63('0x58')]]=_[_0xaa63('0x57')](queues[_0x2de417['transfertargetlinkedid']]);queues[_0x2de417[_0xaa63('0x58')]]['transfereduniqueid']=_0x2de417[_0xaa63('0x58')];queues[_0x2de417[_0xaa63('0x58')]][_0xaa63('0x59')]=0x2;queues[_0x2de417['transfertargetuniqueid']][_0xaa63('0x7')]=queues[_0x2de417[_0xaa63('0x50')]]['calleridnum'];queues[_0x2de417[_0xaa63('0x58')]][_0xaa63('0x5a')]=queues[_0x2de417[_0xaa63('0x50')]][_0xaa63('0x5a')];queues[_0x2de417[_0xaa63('0x58')]][_0xaa63('0x37')]=utils['now']();queues[_0x2de417[_0xaa63('0x58')]][_0xaa63('0x19')]=utils[_0xaa63('0x14')]();queues[_0x2de417['transfertargetuniqueid']][_0xaa63('0x35')]=0x0;queues[_0x2de417[_0xaa63('0x58')]][_0xaa63('0x61')]=0x0;utils[_0xaa63('0x2')](util[_0xaa63('0x11')](_0xaa63('0x62'),_0x2de417['origtransfereruniqueid'],queues[_0x2de417[_0xaa63('0x58')]][_0xaa63('0x1f')],queues[_0x2de417[_0xaa63('0x58')]]['transfereduniqueid'],queues[_0x2de417[_0xaa63('0x58')]]['calleridnum'],queues[_0x2de417[_0xaa63('0x58')]][_0xaa63('0x5a')]));}else{utils[_0xaa63('0x2')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x2de417[_0xaa63('0x4f')],queues[_0x2de417[_0xaa63('0x51')]][_0xaa63('0x1f')],_0x2de417[_0xaa63('0x50')]));queues[_0x2de417['secondtransfererlinkedid']][_0xaa63('0xe')]=_0x2de417[_0xaa63('0x50')];}}}}catch(_0x5086b7){utils[_0xaa63('0x15')](util[_0xaa63('0x11')](_0xaa63('0x4e'),_0x2de417[_0xaa63('0x4f')]),_0x5086b7);}};exports[_0xaa63('0x63')]=function(_0x50c3f0){try{if(!_['isNil'](queues[_0x50c3f0['uniqueid']])){utils[_0xaa63('0xf')](util[_0xaa63('0x11')]('[%s][queues][musiconholdstart]',_0x50c3f0[_0xaa63('0x4')]),_0x50c3f0);queues[_0x50c3f0[_0xaa63('0x4')]][_0xaa63('0x64')]=utils[_0xaa63('0x14')]();utils[_0xaa63('0x2')](util[_0xaa63('0x11')](_0xaa63('0x65'),_0x50c3f0[_0xaa63('0x4')],queues[_0x50c3f0[_0xaa63('0x4')]]['name'],queues[_0x50c3f0[_0xaa63('0x4')]][_0xaa63('0x64')]));}}catch(_0x121650){utils['error'](util[_0xaa63('0x11')](_0xaa63('0x66'),_0x50c3f0[_0xaa63('0x4')]),_0x121650);}};exports[_0xaa63('0x67')]=function(_0x33a921){try{if(!_['isNil'](queues[_0x33a921[_0xaa63('0x4')]])){if(!_[_0xaa63('0x17')](queues[_0x33a921[_0xaa63('0x4')]][_0xaa63('0x64')])){utils[_0xaa63('0xf')](util[_0xaa63('0x11')](_0xaa63('0x68'),_0x33a921[_0xaa63('0x4')]),_0x33a921);queues[_0x33a921['uniqueid']][_0xaa63('0x61')]+=utils['diffTime'](utils[_0xaa63('0x14')](),queues[_0x33a921['uniqueid']][_0xaa63('0x64')]);utils[_0xaa63('0x2')](util['format'](_0xaa63('0x69'),_0x33a921[_0xaa63('0x4')],queues[_0x33a921['uniqueid']][_0xaa63('0x1f')],queues[_0x33a921[_0xaa63('0x4')]]['mohtime']));delete queues[_0x33a921['uniqueid']][_0xaa63('0x64')];}}}catch(_0x3a9a12){utils[_0xaa63('0x15')](util['format']('[%s][queues][musiconholdstop]',_0x33a921[_0xaa63('0x4')]),_0x3a9a12);}}; \ No newline at end of file +var _0x12bd=['CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','format','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','membername','assigned','destaccountcode','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','BLIND','transferexten','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','ATTENDED','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','transfertargetuniqueid','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','./utils','info','uniqueid','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type'];(function(_0x1f7201,_0x141b79){var _0x289fd2=function(_0x20ce23){while(--_0x20ce23){_0x1f7201['push'](_0x1f7201['shift']());}};_0x289fd2(++_0x141b79);}(_0x12bd,0xc0));var _0xd12b=function(_0x28d1ea,_0x426311){_0x28d1ea=_0x28d1ea-0x0;var _0x1667b6=_0x12bd[_0x28d1ea];return _0x1667b6;};'use strict';var _=require(_0xd12b('0x0'));var util=require('util');var utils=require(_0xd12b('0x1'));var queues={};function writeDB(_0x31544e){utils[_0xd12b('0x2')](util['format']('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x31544e[_0xd12b('0x3')],_0x31544e['channel'],_0x31544e[_0xd12b('0x4')],_0x31544e[_0xd12b('0x5')],_0x31544e[_0xd12b('0x6')],_0x31544e[_0xd12b('0x7')],_0x31544e[_0xd12b('0x8')]));if(_0x31544e[_0xd12b('0x4')]){utils[_0xd12b('0x9')](_0x31544e['queue'])[_0xd12b('0xa')](function(_0x27cb0e){if(_0x27cb0e){_0x31544e['type']=_0x27cb0e[_0xd12b('0xb')];}utils['request']('CreateVoiceQueueReport',_0x31544e);});}else{utils['request'](_0xd12b('0xc'),_0x31544e);}if(_0x31544e['transfereduniqueid']){delete queues[_0x31544e[_0xd12b('0xd')]];}else{delete queues[_0x31544e[_0xd12b('0x3')]];}}exports[_0xd12b('0xe')]=function(_0x34e439){try{utils[_0xd12b('0xf')](util[_0xd12b('0x10')](_0xd12b('0x11'),_0x34e439[_0xd12b('0x3')]),_0x34e439);utils['info'](util['format'](_0xd12b('0x12'),_0x34e439[_0xd12b('0x3')],_0x34e439[_0xd12b('0x4')],_0x34e439[_0xd12b('0x13')]));queues[_0x34e439['uniqueid']]=_[_0xd12b('0x14')](_0x34e439,{'originalposition':_0x34e439['position'],'queuecallerjoinAt':utils[_0xd12b('0x15')](),'mohtime':0x0});}catch(_0x1f9d9f){utils[_0xd12b('0x16')](util[_0xd12b('0x10')](_0xd12b('0x11'),_0x34e439[_0xd12b('0x3')]),_0x1f9d9f);}};exports[_0xd12b('0x17')]=function(_0x9786b){try{if(!_[_0xd12b('0x18')](queues[_0x9786b['uniqueid']])){utils[_0xd12b('0xf')](util[_0xd12b('0x10')](_0xd12b('0x19'),_0x9786b[_0xd12b('0x3')]),_0x9786b);if(queues[_0x9786b['uniqueid']][_0xd12b('0x1a')]){if(!queues[_0x9786b[_0xd12b('0x3')]][_0xd12b('0x1b')]&&!queues[_0x9786b[_0xd12b('0x3')]][_0xd12b('0x1c')]){queues[_0x9786b['uniqueid']][_0xd12b('0x1d')]=!![];queues[_0x9786b[_0xd12b('0x3')]]['queuecallercompleteAt']=utils['now']();queues[_0x9786b[_0xd12b('0x3')]][_0xd12b('0x8')]='COMPLETEDBYAGENT';}utils[_0xd12b('0x2')](util[_0xd12b('0x10')](_0xd12b('0x1e'),_0x9786b[_0xd12b('0x3')],queues[_0x9786b[_0xd12b('0x3')]][_0xd12b('0x1f')],queues[_0x9786b[_0xd12b('0x3')]]['queuecallerexitreason']));writeDB(queues[_0x9786b[_0xd12b('0x3')]]);}else if(queues[_0x9786b[_0xd12b('0x3')]][_0xd12b('0xd')]){utils['info'](util[_0xd12b('0x10')](_0xd12b('0x20'),_0x9786b[_0xd12b('0x3')],queues[_0x9786b[_0xd12b('0x3')]][_0xd12b('0x1f')],queues[_0x9786b[_0xd12b('0x3')]][_0xd12b('0xd')]));queues[queues[_0x9786b[_0xd12b('0x3')]]['transfereduniqueid']]=queues[_0x9786b[_0xd12b('0x3')]];queues[queues[_0x9786b[_0xd12b('0x3')]][_0xd12b('0xd')]][_0xd12b('0x21')]=0x2;delete queues[_0x9786b[_0xd12b('0x3')]];}}}catch(_0x38c22f){utils['error'](util[_0xd12b('0x10')]('[%s][queues][hangup]',_0x9786b[_0xd12b('0x3')]),_0x38c22f);}};exports[_0xd12b('0x22')]=function(_0x10aed5){try{utils[_0xd12b('0xf')](util['format'](_0xd12b('0x23'),_0x10aed5[_0xd12b('0x3')]),_0x10aed5);if(!_['isNil'](_0x10aed5[_0xd12b('0x24')][_0xd12b('0x25')])&&_0x10aed5[_0xd12b('0x26')][_0xd12b('0x27')]()!==_0xd12b('0x28')){if(!_[_0xd12b('0x18')](queues[_0x10aed5[_0xd12b('0x3')]])){queues[_0x10aed5[_0xd12b('0x3')]][_0xd12b('0x1b')]=![];queues[_0x10aed5[_0xd12b('0x3')]][_0xd12b('0x29')]=null;queues[_0x10aed5['uniqueid']][_0xd12b('0x1c')]=!![];queues[_0x10aed5[_0xd12b('0x3')]][_0xd12b('0x2a')]=utils[_0xd12b('0x15')]();queues[_0x10aed5[_0xd12b('0x3')]][_0xd12b('0x8')]=_0x10aed5[_0xd12b('0x26')][_0xd12b('0x27')]();utils[_0xd12b('0x2')](util[_0xd12b('0x10')](_0xd12b('0x2b'),_0x10aed5[_0xd12b('0x3')],queues[_0x10aed5['uniqueid']][_0xd12b('0x1f')],_0x10aed5[_0xd12b('0x26')],queues[_0x10aed5[_0xd12b('0x3')]][_0xd12b('0x8')]));writeDB(queues[_0x10aed5[_0xd12b('0x3')]]);}}else if(!_[_0xd12b('0x18')](_0x10aed5[_0xd12b('0x24')][_0xd12b('0x2c')])){if(!_[_0xd12b('0x18')](queues[_0x10aed5[_0xd12b('0x3')]])&&!queues[_0x10aed5[_0xd12b('0x3')]][_0xd12b('0x1b')]){queues[_0x10aed5[_0xd12b('0x3')]][_0xd12b('0x1b')]=![];queues[_0x10aed5[_0xd12b('0x3')]][_0xd12b('0x29')]=null;queues[_0x10aed5['uniqueid']][_0xd12b('0x1c')]=!![];queues[_0x10aed5[_0xd12b('0x3')]]['queuecallerexitAt']=utils[_0xd12b('0x15')]();queues[_0x10aed5[_0xd12b('0x3')]][_0xd12b('0x8')]=_0xd12b('0x2d');utils[_0xd12b('0x2')](util[_0xd12b('0x10')](_0xd12b('0x2e'),_0x10aed5[_0xd12b('0x3')],queues[_0x10aed5[_0xd12b('0x3')]]['name'],_0x10aed5['value'],queues[_0x10aed5[_0xd12b('0x3')]]['queuecallerexitreason']));}}}catch(_0x36f384){utils['error'](util[_0xd12b('0x10')](_0xd12b('0x23'),_0x10aed5[_0xd12b('0x3')]),_0x36f384);}};exports['queuecallerabandon']=function(_0x32a21a){try{if(!_[_0xd12b('0x18')](queues[_0x32a21a['uniqueid']])){utils[_0xd12b('0xf')](util[_0xd12b('0x10')](_0xd12b('0x2f'),_0x32a21a[_0xd12b('0x3')]),_0x32a21a);queues[_0x32a21a[_0xd12b('0x3')]][_0xd12b('0x1c')]=![];queues[_0x32a21a[_0xd12b('0x3')]][_0xd12b('0x2a')]=null;queues[_0x32a21a[_0xd12b('0x3')]][_0xd12b('0x1b')]=!![];queues[_0x32a21a[_0xd12b('0x3')]][_0xd12b('0x29')]=utils[_0xd12b('0x15')]();queues[_0x32a21a['uniqueid']][_0xd12b('0x8')]=_0xd12b('0x30');utils[_0xd12b('0x2')](util[_0xd12b('0x10')](_0xd12b('0x31'),_0x32a21a['uniqueid'],queues[_0x32a21a[_0xd12b('0x3')]][_0xd12b('0x1f')],queues[_0x32a21a[_0xd12b('0x3')]][_0xd12b('0x8')]));}}catch(_0x6e0caf){utils[_0xd12b('0x16')](util['format'](_0xd12b('0x2f'),_0x32a21a[_0xd12b('0x3')]),_0x6e0caf);}};exports[_0xd12b('0x32')]=function(_0x17e7d9){try{if(!_[_0xd12b('0x18')](queues[_0x17e7d9[_0xd12b('0x3')]])){utils[_0xd12b('0xf')](util[_0xd12b('0x10')](_0xd12b('0x33'),_0x17e7d9[_0xd12b('0x3')]),_0x17e7d9);utils[_0xd12b('0x2')](util[_0xd12b('0x10')](_0xd12b('0x34'),_0x17e7d9[_0xd12b('0x3')],queues[_0x17e7d9[_0xd12b('0x3')]]['name'],_0x17e7d9[_0xd12b('0x35')],_0x17e7d9[_0xd12b('0x36')]));queues[_0x17e7d9[_0xd12b('0x3')]]['queuecallerleave']=!![];queues[_0x17e7d9[_0xd12b('0x3')]][_0xd12b('0x1a')]=utils[_0xd12b('0x15')]();queues[_0x17e7d9['uniqueid']][_0xd12b('0x37')]=utils['diffTime'](queues[_0x17e7d9[_0xd12b('0x3')]][_0xd12b('0x1a')],queues[_0x17e7d9[_0xd12b('0x3')]][_0xd12b('0x38')]);queues[_0x17e7d9['uniqueid']]['position']=_0x17e7d9[_0xd12b('0x13')];queues[_0x17e7d9[_0xd12b('0x3')]][_0xd12b('0x39')]=_0x17e7d9[_0xd12b('0x39')];queues[_0x17e7d9[_0xd12b('0x3')]][_0xd12b('0x35')]=_0x17e7d9[_0xd12b('0x35')];queues[_0x17e7d9['uniqueid']]['connectedlinename']=_0x17e7d9[_0xd12b('0x36')];}}catch(_0x42322d){utils[_0xd12b('0x16')](util[_0xd12b('0x10')](_0xd12b('0x33'),_0x17e7d9[_0xd12b('0x3')]),_0x42322d);}};exports[_0xd12b('0x3a')]=function(_0x4b0948){try{if(!_[_0xd12b('0x18')](queues[_0x4b0948[_0xd12b('0x3')]])){utils['debug'](util['format'](_0xd12b('0x3b'),_0x4b0948['uniqueid']),_0x4b0948);utils['info'](util[_0xd12b('0x10')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x4b0948[_0xd12b('0x3')],queues[_0x4b0948[_0xd12b('0x3')]][_0xd12b('0x1f')],_0x4b0948[_0xd12b('0x3c')],_0x4b0948['destaccountcode']));queues[_0x4b0948[_0xd12b('0x3')]][_0xd12b('0x1b')]=![];queues[_0x4b0948[_0xd12b('0x3')]][_0xd12b('0x1b')]=![];queues[_0x4b0948['uniqueid']][_0xd12b('0x29')]=null;queues[_0x4b0948[_0xd12b('0x3')]]['queuecallerexit']=![];queues[_0x4b0948[_0xd12b('0x3')]][_0xd12b('0x8')]=null;queues[_0x4b0948[_0xd12b('0x3')]][_0xd12b('0x2a')]=null;queues[_0x4b0948[_0xd12b('0x3')]][_0xd12b('0x3d')]=!![];queues[_0x4b0948[_0xd12b('0x3')]][_0xd12b('0x7')]=_0x4b0948[_0xd12b('0x3e')];queues[_0x4b0948[_0xd12b('0x3')]][_0xd12b('0x5')]=_0x4b0948[_0xd12b('0x3c')];}}catch(_0x51856a){utils[_0xd12b('0x16')](util[_0xd12b('0x10')](_0xd12b('0x3b'),_0x4b0948[_0xd12b('0x3')]),_0x51856a);}};exports[_0xd12b('0x3f')]=function(_0x3ec82b){try{if(!_[_0xd12b('0x18')](queues[_0x3ec82b[_0xd12b('0x3')]])){if(queues[_0x3ec82b[_0xd12b('0x3')]][_0xd12b('0x1a')]){utils[_0xd12b('0xf')](util[_0xd12b('0x10')](_0xd12b('0x40'),_0x3ec82b['uniqueid']),_0x3ec82b);queues[_0x3ec82b[_0xd12b('0x3')]][_0xd12b('0x1b')]=![];queues[_0x3ec82b['uniqueid']][_0xd12b('0x1b')]=![];queues[_0x3ec82b[_0xd12b('0x3')]][_0xd12b('0x29')]=null;queues[_0x3ec82b[_0xd12b('0x3')]]['queuecallerexit']=![];queues[_0x3ec82b[_0xd12b('0x3')]]['queuecallerexitAt']=null;queues[_0x3ec82b[_0xd12b('0x3')]][_0xd12b('0x3d')]=!![];queues[_0x3ec82b[_0xd12b('0x3')]][_0xd12b('0x5')]=_0x3ec82b[_0xd12b('0x3c')];queues[_0x3ec82b[_0xd12b('0x3')]][_0xd12b('0x1d')]=!![];queues[_0x3ec82b[_0xd12b('0x3')]]['queuecallercompleteAt']=utils[_0xd12b('0x15')]();if(_0x3ec82b[_0xd12b('0x41')]==_0xd12b('0x42')){if(!queues[_0x3ec82b[_0xd12b('0x3')]][_0xd12b('0x42')]){queues[_0x3ec82b[_0xd12b('0x3')]]['queuecallerexitreason']=_0xd12b('0x43');}}else{queues[_0x3ec82b['uniqueid']]['queuecallerexitreason']=_0xd12b('0x44')+_0x3ec82b['reason'][_0xd12b('0x27')]();}utils[_0xd12b('0x2')](util[_0xd12b('0x10')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x3ec82b['uniqueid'],queues[_0x3ec82b[_0xd12b('0x3')]][_0xd12b('0x1f')],_0x3ec82b[_0xd12b('0x3c')],queues[_0x3ec82b[_0xd12b('0x3')]][_0xd12b('0x8')]));writeDB(queues[_0x3ec82b['uniqueid']]);}}}catch(_0x21125e){utils[_0xd12b('0x16')](util[_0xd12b('0x10')](_0xd12b('0x40'),_0x3ec82b[_0xd12b('0x3')]),_0x21125e);}};exports['blindtransfer']=function(_0x4c3d4c){try{if(!_['isNil'](queues[_0x4c3d4c['transfereeuniqueid']])){utils['debug'](util[_0xd12b('0x10')](_0xd12b('0x45'),_0x4c3d4c[_0xd12b('0x3')]),_0x4c3d4c);queues[_0x4c3d4c[_0xd12b('0x46')]][_0xd12b('0x42')]=!![];queues[_0x4c3d4c[_0xd12b('0x46')]][_0xd12b('0x47')]=_0xd12b('0x48');queues[_0x4c3d4c[_0xd12b('0x46')]][_0xd12b('0x49')]=_0x4c3d4c['extension'];queues[_0x4c3d4c[_0xd12b('0x46')]][_0xd12b('0x4a')]=_0x4c3d4c[_0xd12b('0x46')];queues[_0x4c3d4c['transfereeuniqueid']][_0xd12b('0x8')]='BLINDTRANSFER';utils[_0xd12b('0x2')](util[_0xd12b('0x10')](_0xd12b('0x4b'),_0x4c3d4c[_0xd12b('0x3')],queues[_0x4c3d4c['transfereeuniqueid']][_0xd12b('0x1f')],_0x4c3d4c[_0xd12b('0x46')],_0x4c3d4c['extension']));}}catch(_0x31a8f4){utils[_0xd12b('0x16')](util[_0xd12b('0x10')](_0xd12b('0x45'),_0x4c3d4c[_0xd12b('0x3')]),_0x31a8f4);}};exports[_0xd12b('0x4c')]=function(_0x58c090){try{utils[_0xd12b('0xf')](util[_0xd12b('0x10')]('[%s][queues][attendedtransfer]',_0x58c090[_0xd12b('0x4d')]),_0x58c090);if(_0x58c090[_0xd12b('0x4d')]==_0x58c090[_0xd12b('0x4e')]){if(!_[_0xd12b('0x18')](queues[_0x58c090[_0xd12b('0x4f')]])){utils[_0xd12b('0x2')](util[_0xd12b('0x10')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x58c090['origtransfereruniqueid'],queues[_0x58c090[_0xd12b('0x4f')]]['name'],_0x58c090[_0xd12b('0x50')]));queues[_0x58c090[_0xd12b('0x4f')]][_0xd12b('0x42')]=!![];queues[_0x58c090[_0xd12b('0x4f')]][_0xd12b('0x47')]='ATTENDED';queues[_0x58c090['secondtransfererlinkedid']][_0xd12b('0x49')]=_0x58c090[_0xd12b('0x50')];queues[_0x58c090[_0xd12b('0x4f')]][_0xd12b('0x4a')]=_0x58c090[_0xd12b('0x4d')];queues[_0x58c090[_0xd12b('0x4f')]][_0xd12b('0x8')]='ATTENDEDTRANSFER';}if(!_[_0xd12b('0x18')](queues[_0x58c090[_0xd12b('0x4e')]])){if(_0x58c090['transfereelinkedid']&&queues[_0x58c090['transfereelinkedid']]){queues[_0x58c090['transfereelinkedid']][_0xd12b('0x21')]=0x1;queues[_0x58c090['transfereeuniqueid']]=_['clone'](queues[_0x58c090['transfereelinkedid']]);queues[_0x58c090['transfereeuniqueid']][_0xd12b('0xd')]=_0x58c090['transfertargetuniqueid'];queues[_0x58c090[_0xd12b('0x46')]][_0xd12b('0x21')]=0x2;queues[_0x58c090[_0xd12b('0x46')]][_0xd12b('0x6')]=queues[_0x58c090['secondtransfererlinkedid']][_0xd12b('0x6')];queues[_0x58c090[_0xd12b('0x46')]][_0xd12b('0x51')]=queues[_0x58c090['secondtransfererlinkedid']]['calleridname'];queues[_0x58c090[_0xd12b('0x46')]][_0xd12b('0x38')]=utils[_0xd12b('0x15')]();queues[_0x58c090[_0xd12b('0x46')]][_0xd12b('0x1a')]=utils['now']();queues[_0x58c090[_0xd12b('0x46')]][_0xd12b('0x37')]=0x0;queues[_0x58c090['transfereeuniqueid']][_0xd12b('0x52')]=0x0;utils[_0xd12b('0x2')](util[_0xd12b('0x10')](_0xd12b('0x53'),_0x58c090[_0xd12b('0x4d')],queues[_0x58c090[_0xd12b('0x46')]][_0xd12b('0x1f')],queues[_0x58c090[_0xd12b('0x46')]]['calleridnum'],queues[_0x58c090[_0xd12b('0x46')]][_0xd12b('0x51')]));}else{utils[_0xd12b('0x2')](util[_0xd12b('0x10')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x58c090['origtransfereruniqueid'],queues[_0x58c090[_0xd12b('0x4e')]][_0xd12b('0x1f')],_0x58c090[_0xd12b('0x4f')]));queues[_0x58c090['origtransfererlinkedid']][_0xd12b('0xd')]=_0x58c090[_0xd12b('0x4f')];}}}else if(_0x58c090[_0xd12b('0x54')]==_0x58c090[_0xd12b('0x4f')]){if(!_['isNil'](queues[_0x58c090['origtransfererlinkedid']])){utils[_0xd12b('0x2')](util[_0xd12b('0x10')](_0xd12b('0x55'),_0x58c090['origtransfereruniqueid'],queues[_0x58c090[_0xd12b('0x4e')]][_0xd12b('0x1f')],_0x58c090[_0xd12b('0x54')],_0x58c090['secondtransfererexten']));queues[_0x58c090[_0xd12b('0x4e')]][_0xd12b('0x42')]=!![];queues[_0x58c090[_0xd12b('0x4e')]][_0xd12b('0x47')]=_0xd12b('0x56');queues[_0x58c090[_0xd12b('0x4e')]][_0xd12b('0x49')]=_0x58c090[_0xd12b('0x57')];queues[_0x58c090['origtransfererlinkedid']][_0xd12b('0x4a')]=_0x58c090[_0xd12b('0x54')];queues[_0x58c090[_0xd12b('0x4e')]][_0xd12b('0x8')]=_0xd12b('0x58');}if(!_[_0xd12b('0x18')](queues[_0x58c090[_0xd12b('0x4f')]])){if(_0x58c090[_0xd12b('0x59')]&&queues[_0x58c090[_0xd12b('0x59')]]){queues[_0x58c090['transfertargetlinkedid']][_0xd12b('0x21')]=0x1;queues[_0x58c090[_0xd12b('0x5a')]]=_[_0xd12b('0x5b')](queues[_0x58c090['transfertargetlinkedid']]);queues[_0x58c090[_0xd12b('0x5a')]][_0xd12b('0xd')]=_0x58c090[_0xd12b('0x5a')];queues[_0x58c090[_0xd12b('0x5a')]][_0xd12b('0x21')]=0x2;queues[_0x58c090[_0xd12b('0x5a')]][_0xd12b('0x6')]=queues[_0x58c090[_0xd12b('0x4e')]][_0xd12b('0x6')];queues[_0x58c090[_0xd12b('0x5a')]][_0xd12b('0x51')]=queues[_0x58c090[_0xd12b('0x4e')]]['calleridname'];queues[_0x58c090[_0xd12b('0x5a')]][_0xd12b('0x38')]=utils[_0xd12b('0x15')]();queues[_0x58c090[_0xd12b('0x5a')]][_0xd12b('0x1a')]=utils['now']();queues[_0x58c090[_0xd12b('0x5a')]][_0xd12b('0x37')]=0x0;queues[_0x58c090['transfertargetuniqueid']]['mohtime']=0x0;utils[_0xd12b('0x2')](util[_0xd12b('0x10')](_0xd12b('0x5c'),_0x58c090[_0xd12b('0x4d')],queues[_0x58c090[_0xd12b('0x5a')]]['name'],queues[_0x58c090[_0xd12b('0x5a')]][_0xd12b('0xd')],queues[_0x58c090[_0xd12b('0x5a')]][_0xd12b('0x6')],queues[_0x58c090[_0xd12b('0x5a')]][_0xd12b('0x51')]));}else{utils['info'](util[_0xd12b('0x10')](_0xd12b('0x5d'),_0x58c090[_0xd12b('0x4d')],queues[_0x58c090['secondtransfererlinkedid']][_0xd12b('0x1f')],_0x58c090['origtransfererlinkedid']));queues[_0x58c090[_0xd12b('0x4f')]]['transfereduniqueid']=_0x58c090[_0xd12b('0x4e')];}}}}catch(_0x1a2e86){utils['error'](util[_0xd12b('0x10')]('[%s][queues][attendedtransfer]',_0x58c090[_0xd12b('0x4d')]),_0x1a2e86);}};exports[_0xd12b('0x5e')]=function(_0x1d8173){try{if(!_[_0xd12b('0x18')](queues[_0x1d8173[_0xd12b('0x3')]])){utils[_0xd12b('0xf')](util['format'](_0xd12b('0x5f'),_0x1d8173[_0xd12b('0x3')]),_0x1d8173);queues[_0x1d8173[_0xd12b('0x3')]][_0xd12b('0x60')]=utils[_0xd12b('0x15')]();utils[_0xd12b('0x2')](util['format'](_0xd12b('0x61'),_0x1d8173[_0xd12b('0x3')],queues[_0x1d8173['uniqueid']]['name'],queues[_0x1d8173[_0xd12b('0x3')]][_0xd12b('0x60')]));}}catch(_0x336253){utils[_0xd12b('0x16')](util['format'](_0xd12b('0x5f'),_0x1d8173['uniqueid']),_0x336253);}};exports[_0xd12b('0x62')]=function(_0xd073e8){try{if(!_[_0xd12b('0x18')](queues[_0xd073e8['uniqueid']])){if(!_[_0xd12b('0x18')](queues[_0xd073e8[_0xd12b('0x3')]][_0xd12b('0x60')])){utils[_0xd12b('0xf')](util[_0xd12b('0x10')](_0xd12b('0x63'),_0xd073e8[_0xd12b('0x3')]),_0xd073e8);queues[_0xd073e8[_0xd12b('0x3')]][_0xd12b('0x52')]+=utils[_0xd12b('0x64')](utils['now'](),queues[_0xd073e8['uniqueid']][_0xd12b('0x60')]);utils[_0xd12b('0x2')](util[_0xd12b('0x10')](_0xd12b('0x65'),_0xd073e8['uniqueid'],queues[_0xd073e8['uniqueid']]['name'],queues[_0xd073e8['uniqueid']][_0xd12b('0x52')]));delete queues[_0xd073e8[_0xd12b('0x3')]][_0xd12b('0x60')];}}}catch(_0x4122f4){utils[_0xd12b('0x16')](util[_0xd12b('0x10')](_0xd12b('0x63'),_0xd073e8[_0xd12b('0x3')]),_0x4122f4);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index a4a41a7..56a3eee 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 _0xf972=['then','name','UserId','request','CreateVoiceRecording','blinds','newchannel','debug','format','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','isNil','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','[%s][recordings][newstate]','varset','variable','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','monitors','push','hangup','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','newexten','application','appdata','toLowerCase','set','startsWith','cdr','substring','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][queuecallerjoin]','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','util','./utils','./transfers.controller','info','[%s][recordings][writeDB]','uniqueid','transfereeuniqueid','accountcode'];(function(_0x44c24b,_0x1bed36){var _0x574d2e=function(_0x4082cc){while(--_0x4082cc){_0x44c24b['push'](_0x44c24b['shift']());}};_0x574d2e(++_0x1bed36);}(_0xf972,0xd0));var _0x2f97=function(_0x520f9b,_0x66cba9){_0x520f9b=_0x520f9b-0x0;var _0x321d5a=_0xf972[_0x520f9b];return _0x321d5a;};'use strict';var _=require('lodash');var util=require(_0x2f97('0x0'));var utils=require(_0x2f97('0x1'));var transfers=require(_0x2f97('0x2'));var recordings={};function writeDB(_0xa521dd){var _0x18e633;utils[_0x2f97('0x3')](util['format'](_0x2f97('0x4'),_0xa521dd[_0x2f97('0x5')]));if(transfers['blinds'][_0xa521dd[_0x2f97('0x5')]]){_0x18e633=_0xa521dd[_0x2f97('0x5')];_0xa521dd[_0x2f97('0x5')]=transfers['blinds'][_0xa521dd[_0x2f97('0x5')]][_0x2f97('0x6')];}if(_0xa521dd['accountcode']){utils['getUserByInternal'](_0xa521dd[_0x2f97('0x7')])[_0x2f97('0x8')](function(_0x2cb50d){if(_0x2cb50d){_0xa521dd['membername']=_0x2cb50d[_0x2f97('0x9')];_0xa521dd[_0x2f97('0xa')]=_0x2cb50d['id'];}utils[_0x2f97('0xb')](_0x2f97('0xc'),_0xa521dd);});}else{utils[_0x2f97('0xb')]('CreateVoiceRecording',_0xa521dd);}if(_0x18e633)delete transfers[_0x2f97('0xd')][_0x18e633];}exports[_0x2f97('0xe')]=function(_0x273a3f){try{utils[_0x2f97('0xf')](util[_0x2f97('0x10')](_0x2f97('0x11'),_0x273a3f[_0x2f97('0x5')]),_0x273a3f);if(_0x273a3f['uniqueid']==_0x273a3f[_0x2f97('0x12')]){utils[_0x2f97('0x3')](util['format'](_0x2f97('0x13'),_0x273a3f[_0x2f97('0x5')],_0x273a3f[_0x2f97('0x14')],_0x273a3f[_0x2f97('0x15')]));recordings[_0x273a3f[_0x2f97('0x5')]]={'uniqueid':_0x273a3f[_0x2f97('0x5')],'accountcode':_0x273a3f['accountcode'],'exten':_0x273a3f[_0x2f97('0x15')],'context':_0x273a3f['context'],'channel':_0x273a3f[_0x2f97('0x16')],'monitors':[]};}}catch(_0x57f7df){utils[_0x2f97('0x17')](util[_0x2f97('0x10')](_0x2f97('0x11'),_0x273a3f[_0x2f97('0x5')]),_0x57f7df);}};exports[_0x2f97('0x18')]=function(_0x539072){try{utils[_0x2f97('0xf')](util[_0x2f97('0x10')]('[%s][recordings][newstate]',_0x539072[_0x2f97('0x5')]),_0x539072);if(!_['isNil'](recordings[_0x539072['uniqueid']])&&_0x539072['channelstate']==0x6){utils[_0x2f97('0x3')](util[_0x2f97('0x10')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x539072['uniqueid'],_0x539072[_0x2f97('0x14')],_0x539072[_0x2f97('0x16')]));}else if(!_[_0x2f97('0x19')](recordings[_0x539072['linkedid']])&&_0x539072[_0x2f97('0x1a')]==0x6&&_0x539072['context']!=_0x2f97('0x1b')){utils['info'](util[_0x2f97('0x10')](_0x2f97('0x1c'),_0x539072[_0x2f97('0x5')],_0x539072[_0x2f97('0x12')],_0x539072['context'],_0x539072[_0x2f97('0x16')]));recordings[_0x539072[_0x2f97('0x12')]]['accountcode']=_0x539072[_0x2f97('0x7')];}}catch(_0x52b155){utils[_0x2f97('0x17')](util['format'](_0x2f97('0x1d'),_0x539072[_0x2f97('0x5')]),_0x52b155);}};exports[_0x2f97('0x1e')]=function(_0x443d83){try{if(!_['isNil'](_0x443d83[_0x2f97('0x1f')])&&!_[_0x2f97('0x19')](_0x443d83[_0x2f97('0x1f')]['mixmonitor_filename'])){utils['debug'](util[_0x2f97('0x10')](_0x2f97('0x20'),_0x443d83[_0x2f97('0x5')]),_0x443d83);utils[_0x2f97('0x3')](util['format'](_0x2f97('0x21'),_0x443d83[_0x2f97('0x5')],_0x443d83[_0x2f97('0x1f')],_0x443d83[_0x2f97('0x22')]));if(_[_0x2f97('0x23')](_0x443d83[_0x2f97('0x22')],_0x2f97('0x24'))){_0x443d83[_0x2f97('0x22')]=_0x443d83[_0x2f97('0x22')][_0x2f97('0x25')](_0x2f97('0x24'),_0x2f97('0x26'));}if(recordings[_0x443d83['linkedid']]){var _0x1703dd=_['find'](recordings[_0x443d83[_0x2f97('0x12')]][_0x2f97('0x27')],{'value':_0x443d83[_0x2f97('0x22')]});if(_[_0x2f97('0x19')](_0x1703dd)){recordings[_0x443d83[_0x2f97('0x12')]][_0x2f97('0x27')][_0x2f97('0x28')]({'value':_0x443d83[_0x2f97('0x22')]});}}}}catch(_0x172e7b){utils[_0x2f97('0x17')](util[_0x2f97('0x10')](_0x2f97('0x20'),_0x443d83[_0x2f97('0x5')]),_0x172e7b);}};exports[_0x2f97('0x29')]=function(_0x164a6a){try{if(!_[_0x2f97('0x19')](recordings[_0x164a6a[_0x2f97('0x5')]])){utils[_0x2f97('0xf')](util[_0x2f97('0x10')]('[%s][recordings][hangup]',_0x164a6a['uniqueid']),_0x164a6a);utils[_0x2f97('0x3')](util[_0x2f97('0x10')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x164a6a[_0x2f97('0x5')],_0x164a6a[_0x2f97('0x2a')],_0x164a6a[_0x2f97('0x2b')],_0x164a6a[_0x2f97('0x2c')]));recordings[_0x164a6a[_0x2f97('0x5')]][_0x2f97('0x2a')]=_0x164a6a['calleridnum'];recordings[_0x164a6a[_0x2f97('0x5')]][_0x2f97('0x2b')]=_0x164a6a[_0x2f97('0x2b')];recordings[_0x164a6a['uniqueid']][_0x2f97('0x2d')]=_0x164a6a[_0x2f97('0x2d')];recordings[_0x164a6a[_0x2f97('0x5')]][_0x2f97('0x2e')]=_0x164a6a['connectedlinename'];if(recordings[_0x164a6a[_0x2f97('0x5')]][_0x2f97('0x2f')]==_0x2f97('0x30')&&recordings[_0x164a6a[_0x2f97('0x5')]][_0x2f97('0x7')]){recordings[_0x164a6a[_0x2f97('0x5')]]['connectedlinenum']=recordings[_0x164a6a[_0x2f97('0x5')]][_0x2f97('0x7')];recordings[_0x164a6a[_0x2f97('0x5')]][_0x2f97('0x2e')]='';}recordings[_0x164a6a['uniqueid']][_0x2f97('0x27')]['forEach'](function(_0x2936bc){var _0x94578b=_['clone'](recordings[_0x164a6a[_0x2f97('0x5')]]);_0x94578b[_0x2f97('0x22')]=_0x2936bc[_0x2f97('0x22')];writeDB(_0x94578b);});delete recordings[_0x164a6a[_0x2f97('0x5')]];}}catch(_0x1cbb43){utils[_0x2f97('0x17')](util[_0x2f97('0x10')]('[%s][recordings][hangup]',_0x164a6a[_0x2f97('0x5')]),_0x1cbb43);}};exports[_0x2f97('0x31')]=function(_0x39de83){try{if(!_[_0x2f97('0x19')](recordings[_0x39de83[_0x2f97('0x5')]])){utils[_0x2f97('0xf')](util[_0x2f97('0x10')]('[%s][recordings][newexten]',_0x39de83[_0x2f97('0x5')]),_0x39de83);utils['info'](util[_0x2f97('0x10')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x39de83[_0x2f97('0x5')],_0x39de83[_0x2f97('0x32')],_0x39de83[_0x2f97('0x33')]));if(_0x39de83[_0x2f97('0x32')][_0x2f97('0x34')]()==_0x2f97('0x35')&&_[_0x2f97('0x36')](_0x39de83[_0x2f97('0x33')][_0x2f97('0x34')](),_0x2f97('0x37'))){var _0x36acd8=_0x39de83[_0x2f97('0x33')]['split']('=');var _0x36a816=_0x36acd8[0x0][_0x2f97('0x38')](_0x36acd8[0x0][_0x2f97('0x39')]('(')+0x1,_0x36acd8[0x0][_0x2f97('0x39')](')'));var _0x35d99c=_0x36acd8[0x1];recordings[_0x39de83['uniqueid']][_0x36a816]=_0x35d99c;}}}catch(_0x8647a3){utils[_0x2f97('0x17')](util['format'](_0x2f97('0x3a'),_0x39de83[_0x2f97('0x5')]),_0x8647a3);}};exports[_0x2f97('0x3b')]=function(_0x35f32a){try{if(!_[_0x2f97('0x19')](recordings[_0x35f32a[_0x2f97('0x5')]])){utils[_0x2f97('0xf')](util['format']('[%s][recordings][queuecallerjoin]',_0x35f32a[_0x2f97('0x5')]),_0x35f32a);utils['info'](util[_0x2f97('0x10')](_0x2f97('0x3c'),_0x35f32a[_0x2f97('0x5')],_0x35f32a['queue']));recordings[_0x35f32a[_0x2f97('0x5')]]['queue']=_0x35f32a[_0x2f97('0x3d')];}}catch(_0x381296){utils[_0x2f97('0x17')](util['format'](_0x2f97('0x3e'),_0x35f32a[_0x2f97('0x5')]),_0x381296);}};exports[_0x2f97('0x3f')]=function(_0x1d6535){try{utils[_0x2f97('0xf')](util[_0x2f97('0x10')](_0x2f97('0x40'),_0x1d6535[_0x2f97('0x5')]),_0x1d6535);utils[_0x2f97('0x3')](util[_0x2f97('0x10')](_0x2f97('0x41'),_0x1d6535[_0x2f97('0x5')],_0x1d6535[_0x2f97('0x42')],_0x1d6535[_0x2f97('0x43')],_0x1d6535[_0x2f97('0x44')],_0x1d6535[_0x2f97('0x45')]));if(recordings[_0x1d6535[_0x2f97('0x46')]]&&transfers[_0x2f97('0xd')][_0x1d6535[_0x2f97('0x46')]]){transfers[_0x2f97('0xd')][_0x1d6535[_0x2f97('0x46')]][_0x2f97('0x47')]=!![];}}catch(_0xd4e001){utils['error'](util[_0x2f97('0x10')]('[%s][recordings][blindtransfer]',_0x1d6535[_0x2f97('0x5')]),_0xd4e001);}}; \ No newline at end of file +var _0xc536=['transfereruniqueid','recording','[%s][recordings][blindtransfer]','util','./utils','./transfers.controller','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','then','membername','name','UserId','CreateVoiceRecording','request','newchannel','debug','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','[%s][recordings][newchannel]','newstate','[%s][recordings][newstate]','info','[%s][recordings][newstate]\x20context:%s\x20channel:%s','isNil','channelstate','varset','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','replace','.wav49','find','monitors','push','[%s][recordings][varset]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname'];(function(_0x4fc19e,_0x9c0b06){var _0x3f220d=function(_0x1cb053){while(--_0x1cb053){_0x4fc19e['push'](_0x4fc19e['shift']());}};_0x3f220d(++_0x9c0b06);}(_0xc536,0x137));var _0x6c53=function(_0x7d7f69,_0xeea368){_0x7d7f69=_0x7d7f69-0x0;var _0x5399e8=_0xc536[_0x7d7f69];return _0x5399e8;};'use strict';var _=require('lodash');var util=require(_0x6c53('0x0'));var utils=require(_0x6c53('0x1'));var transfers=require(_0x6c53('0x2'));var recordings={};function writeDB(_0x4b8160){var _0x48b623;utils['info'](util[_0x6c53('0x3')](_0x6c53('0x4'),_0x4b8160[_0x6c53('0x5')]));if(transfers[_0x6c53('0x6')][_0x4b8160['uniqueid']]){_0x48b623=_0x4b8160[_0x6c53('0x5')];_0x4b8160[_0x6c53('0x5')]=transfers[_0x6c53('0x6')][_0x4b8160[_0x6c53('0x5')]][_0x6c53('0x7')];}if(_0x4b8160[_0x6c53('0x8')]){utils[_0x6c53('0x9')](_0x4b8160[_0x6c53('0x8')])[_0x6c53('0xa')](function(_0x3e91dc){if(_0x3e91dc){_0x4b8160[_0x6c53('0xb')]=_0x3e91dc[_0x6c53('0xc')];_0x4b8160[_0x6c53('0xd')]=_0x3e91dc['id'];}utils['request'](_0x6c53('0xe'),_0x4b8160);});}else{utils[_0x6c53('0xf')](_0x6c53('0xe'),_0x4b8160);}if(_0x48b623)delete transfers[_0x6c53('0x6')][_0x48b623];}exports[_0x6c53('0x10')]=function(_0x36648e){try{utils[_0x6c53('0x11')](util[_0x6c53('0x3')]('[%s][recordings][newchannel]',_0x36648e[_0x6c53('0x5')]),_0x36648e);if(_0x36648e[_0x6c53('0x5')]==_0x36648e[_0x6c53('0x12')]){utils['info'](util[_0x6c53('0x3')](_0x6c53('0x13'),_0x36648e['uniqueid'],_0x36648e[_0x6c53('0x14')],_0x36648e[_0x6c53('0x15')]));recordings[_0x36648e[_0x6c53('0x5')]]={'uniqueid':_0x36648e[_0x6c53('0x5')],'accountcode':_0x36648e['accountcode'],'exten':_0x36648e['exten'],'context':_0x36648e['context'],'channel':_0x36648e[_0x6c53('0x16')],'monitors':[]};}}catch(_0x1379a3){utils[_0x6c53('0x17')](util['format'](_0x6c53('0x18'),_0x36648e[_0x6c53('0x5')]),_0x1379a3);}};exports[_0x6c53('0x19')]=function(_0x5317da){try{utils[_0x6c53('0x11')](util['format'](_0x6c53('0x1a'),_0x5317da[_0x6c53('0x5')]),_0x5317da);if(!_['isNil'](recordings[_0x5317da[_0x6c53('0x5')]])&&_0x5317da['channelstate']==0x6){utils[_0x6c53('0x1b')](util[_0x6c53('0x3')](_0x6c53('0x1c'),_0x5317da['uniqueid'],_0x5317da[_0x6c53('0x14')],_0x5317da[_0x6c53('0x16')]));}else if(!_[_0x6c53('0x1d')](recordings[_0x5317da[_0x6c53('0x12')]])&&_0x5317da[_0x6c53('0x1e')]==0x6&&_0x5317da[_0x6c53('0x14')]!='transfer'){utils['info'](util[_0x6c53('0x3')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x5317da[_0x6c53('0x5')],_0x5317da[_0x6c53('0x12')],_0x5317da[_0x6c53('0x14')],_0x5317da['channel']));recordings[_0x5317da[_0x6c53('0x12')]]['accountcode']=_0x5317da[_0x6c53('0x8')];}}catch(_0x5cf9ed){utils[_0x6c53('0x17')](util['format'](_0x6c53('0x1a'),_0x5317da['uniqueid']),_0x5cf9ed);}};exports[_0x6c53('0x1f')]=function(_0x3c0594){try{if(!_[_0x6c53('0x1d')](_0x3c0594[_0x6c53('0x20')])&&!_[_0x6c53('0x1d')](_0x3c0594['variable'][_0x6c53('0x21')])){utils[_0x6c53('0x11')](util['format']('[%s][recordings][varset]',_0x3c0594[_0x6c53('0x5')]),_0x3c0594);utils[_0x6c53('0x1b')](util[_0x6c53('0x3')](_0x6c53('0x22'),_0x3c0594[_0x6c53('0x5')],_0x3c0594[_0x6c53('0x20')],_0x3c0594[_0x6c53('0x23')]));if(_['endsWith'](_0x3c0594[_0x6c53('0x23')],'.wav49')){_0x3c0594['value']=_0x3c0594[_0x6c53('0x23')][_0x6c53('0x24')](_0x6c53('0x25'),'.WAV');}if(recordings[_0x3c0594[_0x6c53('0x12')]]){var _0x2cb51c=_[_0x6c53('0x26')](recordings[_0x3c0594[_0x6c53('0x12')]][_0x6c53('0x27')],{'value':_0x3c0594[_0x6c53('0x23')]});if(_[_0x6c53('0x1d')](_0x2cb51c)){recordings[_0x3c0594[_0x6c53('0x12')]][_0x6c53('0x27')][_0x6c53('0x28')]({'value':_0x3c0594[_0x6c53('0x23')]});}}}}catch(_0x36d234){utils[_0x6c53('0x17')](util['format'](_0x6c53('0x29'),_0x3c0594['uniqueid']),_0x36d234);}};exports['hangup']=function(_0x2e61d8){try{if(!_['isNil'](recordings[_0x2e61d8[_0x6c53('0x5')]])){utils['debug'](util[_0x6c53('0x3')]('[%s][recordings][hangup]',_0x2e61d8[_0x6c53('0x5')]),_0x2e61d8);utils[_0x6c53('0x1b')](util[_0x6c53('0x3')](_0x6c53('0x2a'),_0x2e61d8[_0x6c53('0x5')],_0x2e61d8[_0x6c53('0x2b')],_0x2e61d8[_0x6c53('0x2c')],_0x2e61d8[_0x6c53('0x2d')]));recordings[_0x2e61d8['uniqueid']]['calleridnum']=_0x2e61d8['calleridnum'];recordings[_0x2e61d8['uniqueid']][_0x6c53('0x2c')]=_0x2e61d8[_0x6c53('0x2c')];recordings[_0x2e61d8[_0x6c53('0x5')]][_0x6c53('0x2e')]=_0x2e61d8[_0x6c53('0x2e')];recordings[_0x2e61d8[_0x6c53('0x5')]][_0x6c53('0x2f')]=_0x2e61d8[_0x6c53('0x2f')];if(recordings[_0x2e61d8[_0x6c53('0x5')]][_0x6c53('0x30')]==_0x6c53('0x31')&&recordings[_0x2e61d8['uniqueid']][_0x6c53('0x8')]){recordings[_0x2e61d8[_0x6c53('0x5')]]['connectedlinenum']=recordings[_0x2e61d8[_0x6c53('0x5')]][_0x6c53('0x8')];recordings[_0x2e61d8[_0x6c53('0x5')]][_0x6c53('0x2f')]='';}recordings[_0x2e61d8['uniqueid']][_0x6c53('0x27')][_0x6c53('0x32')](function(_0x5bd966){var _0x1a39e5=_[_0x6c53('0x33')](recordings[_0x2e61d8[_0x6c53('0x5')]]);_0x1a39e5['value']=_0x5bd966[_0x6c53('0x23')];writeDB(_0x1a39e5);});delete recordings[_0x2e61d8[_0x6c53('0x5')]];}}catch(_0x1db94c){utils[_0x6c53('0x17')](util[_0x6c53('0x3')](_0x6c53('0x34'),_0x2e61d8[_0x6c53('0x5')]),_0x1db94c);}};exports[_0x6c53('0x35')]=function(_0x4d95a5){try{if(!_['isNil'](recordings[_0x4d95a5[_0x6c53('0x5')]])){utils[_0x6c53('0x11')](util[_0x6c53('0x3')](_0x6c53('0x36'),_0x4d95a5[_0x6c53('0x5')]),_0x4d95a5);utils['info'](util[_0x6c53('0x3')](_0x6c53('0x37'),_0x4d95a5[_0x6c53('0x5')],_0x4d95a5[_0x6c53('0x38')],_0x4d95a5[_0x6c53('0x39')]));if(_0x4d95a5['application'][_0x6c53('0x3a')]()==_0x6c53('0x3b')&&_[_0x6c53('0x3c')](_0x4d95a5['appdata']['toLowerCase'](),'cdr')){var _0x2a2aeb=_0x4d95a5[_0x6c53('0x39')][_0x6c53('0x3d')]('=');var _0x1d6f9e=_0x2a2aeb[0x0][_0x6c53('0x3e')](_0x2a2aeb[0x0][_0x6c53('0x3f')]('(')+0x1,_0x2a2aeb[0x0][_0x6c53('0x3f')](')'));var _0x2175c8=_0x2a2aeb[0x1];recordings[_0x4d95a5['uniqueid']][_0x1d6f9e]=_0x2175c8;}}}catch(_0x4c4364){utils[_0x6c53('0x17')](util['format'](_0x6c53('0x36'),_0x4d95a5['uniqueid']),_0x4c4364);}};exports[_0x6c53('0x40')]=function(_0x2346cd){try{if(!_[_0x6c53('0x1d')](recordings[_0x2346cd[_0x6c53('0x5')]])){utils[_0x6c53('0x11')](util[_0x6c53('0x3')](_0x6c53('0x41'),_0x2346cd[_0x6c53('0x5')]),_0x2346cd);utils[_0x6c53('0x1b')](util[_0x6c53('0x3')](_0x6c53('0x42'),_0x2346cd[_0x6c53('0x5')],_0x2346cd[_0x6c53('0x43')]));recordings[_0x2346cd['uniqueid']][_0x6c53('0x43')]=_0x2346cd[_0x6c53('0x43')];}}catch(_0x2f0f49){utils['error'](util[_0x6c53('0x3')](_0x6c53('0x41'),_0x2346cd[_0x6c53('0x5')]),_0x2f0f49);}};exports[_0x6c53('0x44')]=function(_0x33b8e1){try{utils[_0x6c53('0x11')](util[_0x6c53('0x3')]('[%s][recordings][blindtransfer]',_0x33b8e1[_0x6c53('0x5')]),_0x33b8e1);utils[_0x6c53('0x1b')](util['format'](_0x6c53('0x45'),_0x33b8e1['uniqueid'],_0x33b8e1[_0x6c53('0x46')],_0x33b8e1[_0x6c53('0x47')],_0x33b8e1[_0x6c53('0x48')],_0x33b8e1[_0x6c53('0x49')]));if(recordings[_0x33b8e1[_0x6c53('0x4a')]]&&transfers[_0x6c53('0x6')][_0x33b8e1[_0x6c53('0x4a')]]){transfers[_0x6c53('0x6')][_0x33b8e1[_0x6c53('0x4a')]][_0x6c53('0x4b')]=!![];}}catch(_0x35ac6e){utils['error'](util[_0x6c53('0x3')](_0x6c53('0x4c'),_0x33b8e1[_0x6c53('0x5')]),_0x35ac6e);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index ca6951b..8d474f4 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 _0xc85f=['transfereruniqueid','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','isNil','transfereechannel','assign','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','error','lodash','./utils','info','[%s][transfers][writeDB]\x20type:%s','type','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blinds','debug','format','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridname'];(function(_0x3d60e4,_0x2a4db3){var _0x5c927d=function(_0x500232){while(--_0x500232){_0x3d60e4['push'](_0x3d60e4['shift']());}};_0x5c927d(++_0x2a4db3);}(_0xc85f,0x16a));var _0xfc85=function(_0xa26a73,_0x321c67){_0xa26a73=_0xa26a73-0x0;var _0x49fd7b=_0xc85f[_0xa26a73];return _0x49fd7b;};'use strict';var _=require(_0xfc85('0x0'));var util=require('util');var utils=require(_0xfc85('0x1'));function writeDB(_0x87a4b4){utils[_0xfc85('0x2')](util['format'](_0xfc85('0x3'),_0x87a4b4[_0xfc85('0x4')]==='attended'?_0x87a4b4[_0xfc85('0x5')]:_0x87a4b4[_0xfc85('0x6')],_0x87a4b4['type']));utils[_0xfc85('0x7')](_0xfc85('0x8'),_0x87a4b4);}exports[_0xfc85('0x9')]={};exports['blindtransfer']=function(_0x49767a){try{utils[_0xfc85('0xa')](util[_0xfc85('0xb')]('[%s][transfers][blindtransfer]',_0x49767a[_0xfc85('0x6')]),_0x49767a);utils[_0xfc85('0x2')](util[_0xfc85('0xb')](_0xfc85('0xc'),_0x49767a[_0xfc85('0x6')],_0x49767a[_0xfc85('0xd')],_0x49767a[_0xfc85('0xe')],_0x49767a['transfereecalleridnum'],_0x49767a[_0xfc85('0xf')]));_0x49767a['type']='blind';exports[_0xfc85('0x9')][_0x49767a[_0xfc85('0x10')]]=_0x49767a;writeDB(_0x49767a);}catch(_0x373a50){utils['error'](util[_0xfc85('0xb')]('[%s][transfers][blindtransfer]',_0x49767a['uniqueid']),_0x373a50);}};exports[_0xfc85('0x11')]=function(_0x507234){try{utils[_0xfc85('0xa')](util['format'](_0xfc85('0x12'),_0x507234[_0xfc85('0x5')]),_0x507234);utils['info'](util[_0xfc85('0xb')](_0xfc85('0x13'),_0x507234[_0xfc85('0x5')],_0x507234[_0xfc85('0x14')],_0x507234[_0xfc85('0x15')],_0x507234[_0xfc85('0x16')],_0x507234[_0xfc85('0x17')]));_0x507234=_['assign'](_0x507234,{'transfererchannel':_0x507234['origtransfererchannel'],'transferercalleridnum':_0x507234[_0xfc85('0x14')],'transferercalleridname':_0x507234[_0xfc85('0x15')],'transfererconnectedlinenum':_0x507234['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x507234[_0xfc85('0x18')],'transfereraccountcode':_0x507234[_0xfc85('0x19')],'transferercontext':_0x507234[_0xfc85('0x1a')],'transfererexten':_0x507234[_0xfc85('0x1b')],'transfererlinkedid':_0x507234[_0xfc85('0x1c')],'context':_0x507234[_0xfc85('0x1d')],'extension':_0x507234[_0xfc85('0x1e')],'type':_0xfc85('0x1f')});if(_[_0xfc85('0x20')](_0x507234[_0xfc85('0x21')])){_0x507234=_[_0xfc85('0x22')](_0x507234,{'transfereechannel':_0x507234[_0xfc85('0x23')],'transfereecalleridnum':_0x507234[_0xfc85('0x16')],'transfereecalleridname':_0x507234[_0xfc85('0x17')],'transfereeconnectedlinenum':_0x507234[_0xfc85('0x24')],'transfereeconnectedlinename':_0x507234[_0xfc85('0x25')],'transfereeaccountcode':_0x507234[_0xfc85('0x26')],'transfereecontext':_0x507234['transfertargetcontext'],'transfereeexten':_0x507234[_0xfc85('0x27')],'transfereelinkedid':_0x507234[_0xfc85('0x28')]});}writeDB(_0x507234);}catch(_0x22a6e8){utils[_0xfc85('0x29')](util[_0xfc85('0xb')](_0xfc85('0x12'),_0x507234['origtransfereruniqueid']),_0x22a6e8);}}; \ No newline at end of file +var _0x9302=['transfertargetchannel','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','origtransfereruniqueid','lodash','util','./utils','[%s][transfers][writeDB]\x20type:%s','type','attended','uniqueid','request','blinds','blindtransfer','debug','format','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','isNil','transfereechannel'];(function(_0x3fdd23,_0x368248){var _0x46d56a=function(_0x49c6d6){while(--_0x49c6d6){_0x3fdd23['push'](_0x3fdd23['shift']());}};_0x46d56a(++_0x368248);}(_0x9302,0x83));var _0x2930=function(_0x37fc1d,_0x54b533){_0x37fc1d=_0x37fc1d-0x0;var _0x4dcaa6=_0x9302[_0x37fc1d];return _0x4dcaa6;};'use strict';var _=require(_0x2930('0x0'));var util=require(_0x2930('0x1'));var utils=require(_0x2930('0x2'));function writeDB(_0x51beef){utils['info'](util['format'](_0x2930('0x3'),_0x51beef[_0x2930('0x4')]===_0x2930('0x5')?_0x51beef['origtransfereruniqueid']:_0x51beef[_0x2930('0x6')],_0x51beef[_0x2930('0x4')]));utils[_0x2930('0x7')]('CreateVoiceTransferReport',_0x51beef);}exports[_0x2930('0x8')]={};exports[_0x2930('0x9')]=function(_0x33a8c7){try{utils[_0x2930('0xa')](util[_0x2930('0xb')]('[%s][transfers][blindtransfer]',_0x33a8c7[_0x2930('0x6')]),_0x33a8c7);utils['info'](util[_0x2930('0xb')](_0x2930('0xc'),_0x33a8c7[_0x2930('0x6')],_0x33a8c7[_0x2930('0xd')],_0x33a8c7[_0x2930('0xe')],_0x33a8c7[_0x2930('0xf')],_0x33a8c7[_0x2930('0x10')]));_0x33a8c7[_0x2930('0x4')]=_0x2930('0x11');exports[_0x2930('0x8')][_0x33a8c7[_0x2930('0x12')]]=_0x33a8c7;writeDB(_0x33a8c7);}catch(_0x40651d){utils[_0x2930('0x13')](util[_0x2930('0xb')]('[%s][transfers][blindtransfer]',_0x33a8c7[_0x2930('0x6')]),_0x40651d);}};exports[_0x2930('0x14')]=function(_0x1a2fec){try{utils[_0x2930('0xa')](util['format'](_0x2930('0x15'),_0x1a2fec['origtransfereruniqueid']),_0x1a2fec);utils['info'](util[_0x2930('0xb')](_0x2930('0x16'),_0x1a2fec['origtransfereruniqueid'],_0x1a2fec[_0x2930('0x17')],_0x1a2fec[_0x2930('0x18')],_0x1a2fec[_0x2930('0x19')],_0x1a2fec[_0x2930('0x1a')]));_0x1a2fec=_[_0x2930('0x1b')](_0x1a2fec,{'transfererchannel':_0x1a2fec['origtransfererchannel'],'transferercalleridnum':_0x1a2fec[_0x2930('0x17')],'transferercalleridname':_0x1a2fec[_0x2930('0x18')],'transfererconnectedlinenum':_0x1a2fec[_0x2930('0x1c')],'transfererconnectedlinename':_0x1a2fec[_0x2930('0x1d')],'transfereraccountcode':_0x1a2fec[_0x2930('0x1e')],'transferercontext':_0x1a2fec[_0x2930('0x1f')],'transfererexten':_0x1a2fec[_0x2930('0x20')],'transfererlinkedid':_0x1a2fec['origtransfererlinkedid'],'context':_0x1a2fec[_0x2930('0x21')],'extension':_0x1a2fec[_0x2930('0x22')],'type':_0x2930('0x5')});if(_[_0x2930('0x23')](_0x1a2fec[_0x2930('0x24')])){_0x1a2fec=_[_0x2930('0x1b')](_0x1a2fec,{'transfereechannel':_0x1a2fec[_0x2930('0x25')],'transfereecalleridnum':_0x1a2fec[_0x2930('0x19')],'transfereecalleridname':_0x1a2fec[_0x2930('0x1a')],'transfereeconnectedlinenum':_0x1a2fec['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x1a2fec['transfertargetconnectedlinename'],'transfereeaccountcode':_0x1a2fec[_0x2930('0x26')],'transfereecontext':_0x1a2fec['transfertargetcontext'],'transfereeexten':_0x1a2fec[_0x2930('0x27')],'transfereelinkedid':_0x1a2fec[_0x2930('0x28')]});}writeDB(_0x1a2fec);}catch(_0x41bc21){utils[_0x2930('0x13')](util[_0x2930('0xb')](_0x2930('0x15'),_0x1a2fec[_0x2930('0x29')]),_0x41bc21);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 855ff74..4eca30e 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 _0x94ba=['moment','util','client','../../config/logger','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','name','interface','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','GetVoiceQueue','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise'];(function(_0x3800cb,_0x25bbc6){var _0x326528=function(_0x5b82c4){while(--_0x5b82c4){_0x3800cb['push'](_0x3800cb['shift']());}};_0x326528(++_0x25bbc6);}(_0x94ba,0xbe));var _0xa94b=function(_0x410c9f,_0x1c464a){_0x410c9f=_0x410c9f-0x0;var _0xfc4322=_0x94ba[_0x410c9f];return _0xfc4322;};'use strict';var BPromise=require(_0xa94b('0x0'));var jayson=require(_0xa94b('0x1'));var moment=require(_0xa94b('0x2'));var util=require(_0xa94b('0x3'));var client=jayson[_0xa94b('0x4')]['http']({'port':0x2329});var logger=require(_0xa94b('0x5'))('xdr');exports[_0xa94b('0x6')]=function(_0xd72e72,_0x4c63b5){logger['info'](_0xd72e72,_0x4c63b5?util[_0xa94b('0x7')](_0x4c63b5,{'showHidden':![],'depth':null}):'');};exports[_0xa94b('0x8')]=function(_0x363129,_0x262c09){logger['debug'](_0x363129,_0x262c09?util[_0xa94b('0x7')](_0x262c09,{'showHidden':![],'depth':null}):'');};exports[_0xa94b('0x9')]=function(_0x4b3f86,_0x4d9b9a){logger[_0xa94b('0x9')](_0x4b3f86,_0x4d9b9a?util[_0xa94b('0x7')](_0x4d9b9a,{'showHidden':![],'depth':null}):'');};exports[_0xa94b('0xa')]=function(_0x5233ee,_0x30bdd2){return client[_0xa94b('0xa')](_0x5233ee,{'body':_0x30bdd2})[_0xa94b('0xb')](function(_0x34e4bf){logger[_0xa94b('0x8')](_0xa94b('0xc'),_0x5233ee,_0x34e4bf?util['inspect'](_0x34e4bf,{'showHidden':![],'depth':null}):'');})[_0xa94b('0xd')](function(_0x107c24){logger[_0xa94b('0x9')](_0xa94b('0xc'),_0x5233ee,_0x107c24?util[_0xa94b('0x7')](_0x107c24,{'showHidden':![],'depth':null}):'');});};function getUser(_0xfc303c){return client[_0xa94b('0xa')](_0xa94b('0xe'),{'options':{'raw':!![],'attributes':['id','internal',_0xa94b('0xf'),_0xa94b('0x10')],'where':_0xfc303c,'limit':0x1}})['then'](function(_0xea3a9f){logger['debug']('[utils][getUser]\x20where:%s',JSON['stringify'](_0xfc303c),_0xea3a9f?util[_0xa94b('0x7')](_0xea3a9f,{'showHidden':![],'depth':null}):'');return _0xea3a9f[_0xa94b('0x11')][_0xa94b('0x12')]?_0xea3a9f[_0xa94b('0x11')][0x0]:null;});}exports[_0xa94b('0x13')]=function(_0x38e446){return new BPromise(function(_0x37a08d,_0x1b0e14){if(_0x38e446){return getUser({'internal':_0x38e446})[_0xa94b('0xb')](function(_0x32406e){logger[_0xa94b('0x6')](_0xa94b('0x14'),_0x38e446,_0x32406e?_0xa94b('0x15'):_0xa94b('0x16'));return _0x37a08d(_0x32406e);})[_0xa94b('0xd')](function(_0x103e03){logger[_0xa94b('0x9')](_0xa94b('0x17'),_0x103e03?util[_0xa94b('0x7')](_0x103e03,{'showHidden':![],'depth':null}):'');return _0x37a08d(null);});}return _0x37a08d(null);});};exports[_0xa94b('0x18')]=function(_0x394ac9){return new BPromise(function(_0x55baa8,_0x460818){if(_0x394ac9){return getUser({'interface':_0x394ac9})[_0xa94b('0xb')](function(_0x2740b4){logger[_0xa94b('0x6')](_0xa94b('0x19'),_0x394ac9,_0x2740b4?_0xa94b('0x15'):_0xa94b('0x16'));return _0x55baa8(_0x2740b4);})['catch'](function(_0x426ded){logger[_0xa94b('0x9')](_0xa94b('0x1a'),_0x426ded?util[_0xa94b('0x7')](_0x426ded,{'showHidden':![],'depth':null}):'');return _0x55baa8(null);});}return _0x55baa8(null);});};exports[_0xa94b('0x1b')]=function(_0x1d2869){return new BPromise(function(_0x6aa3e1,_0x3750dd){if(_0x1d2869){return getUser({'name':_0x1d2869})[_0xa94b('0xb')](function(_0x4bd212){logger['info'](_0xa94b('0x1c'),_0x1d2869,_0x4bd212?_0xa94b('0x15'):_0xa94b('0x16'));return _0x6aa3e1(_0x4bd212);})[_0xa94b('0xd')](function(_0x242a7e){logger[_0xa94b('0x9')](_0xa94b('0x1d'),_0x242a7e?util['inspect'](_0x242a7e,{'showHidden':![],'depth':null}):'');return _0x6aa3e1(null);});}return _0x6aa3e1(null);});};exports['getVoiceQueueByName']=function(_0x1508e3){return new BPromise(function(_0x5e3579,_0x2ade99){if(_0x1508e3){return client[_0xa94b('0xa')](_0xa94b('0x1e'),{'options':{'raw':!![],'attributes':['id',_0xa94b('0xf'),_0xa94b('0x1f'),'acw',_0xa94b('0x20')],'where':{'name':_0x1508e3},'limit':0x1}})[_0xa94b('0xb')](function(_0x5783cf){logger[_0xa94b('0x8')](_0xa94b('0x21'),_0x1508e3,_0x5783cf?util[_0xa94b('0x7')](_0x5783cf,{'showHidden':![],'depth':null}):'');logger[_0xa94b('0x6')](_0xa94b('0x22'),_0x1508e3,_0x5783cf?_0xa94b('0x15'):_0xa94b('0x16'));return _0x5e3579(_0x5783cf[_0xa94b('0x11')][_0xa94b('0x12')]?_0x5783cf[_0xa94b('0x11')][0x0]:null);})[_0xa94b('0xd')](function(_0x1d6df6){logger[_0xa94b('0x9')]('[utils][getVoiceQueueByName]',_0x1d6df6?util[_0xa94b('0x7')](_0x1d6df6,{'showHidden':![],'depth':null}):'');return _0x5e3579(null);});}return _0x5e3579(null);});};exports[_0xa94b('0x23')]=function(_0x32a6b4,_0x2f5ed1){return moment(_0x32a6b4)[_0xa94b('0x24')](_0x2f5ed1,_0xa94b('0x25'))[_0xa94b('0x26')](_0xa94b('0x27'));};exports[_0xa94b('0x28')]=function(_0x32ad3b,_0x274d0a){return moment(_0x32ad3b)[_0xa94b('0x29')](_0x274d0a,_0xa94b('0x25'))[_0xa94b('0x26')](_0xa94b('0x27'));};exports[_0xa94b('0x2a')]=function(_0x473727,_0x4d380f){return moment(_0x473727)[_0xa94b('0x2b')](moment(_0x4d380f),_0xa94b('0x25'));};exports[_0xa94b('0x2c')]=function(_0x299ab,_0x557214){return parseInt(_0x299ab,0xa)+parseInt(_0x557214,0xa);};exports[_0xa94b('0x2d')]=function(){return moment()[_0xa94b('0x26')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xa94b('0x2e')]=function(_0x3f7451,_0x5bac41){if(_0x5bac41){return moment(_0x3f7451)[_0xa94b('0x2e')](_0x5bac41);}return!![];};exports[_0xa94b('0x2f')]=function(_0x2be830,_0x3fc5a7){if(_0x3fc5a7){return moment(_0x2be830)[_0xa94b('0x2f')](_0x3fc5a7);}else if(_0x2be830){return!![];}return![];}; \ No newline at end of file +var _0xb9e0=['request','then','[utils][request]\x20name:%s','catch','GetUser','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','[utils][getUserByInternal]\x20internal:%s\x20%s','found','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','notfound','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','format','diffTime','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','../../config/logger','xdr','info','inspect','debug','error'];(function(_0xff9fa7,_0x5eb1ef){var _0x29bb2c=function(_0x3142f7){while(--_0x3142f7){_0xff9fa7['push'](_0xff9fa7['shift']());}};_0x29bb2c(++_0x5eb1ef);}(_0xb9e0,0x18c));var _0x0b9e=function(_0x55e95b,_0x54eef4){_0x55e95b=_0x55e95b-0x0;var _0x575aaf=_0xb9e0[_0x55e95b];return _0x575aaf;};'use strict';var BPromise=require(_0x0b9e('0x0'));var jayson=require(_0x0b9e('0x1'));var moment=require(_0x0b9e('0x2'));var util=require(_0x0b9e('0x3'));var client=jayson[_0x0b9e('0x4')][_0x0b9e('0x5')]({'port':0x2329});var logger=require(_0x0b9e('0x6'))(_0x0b9e('0x7'));exports[_0x0b9e('0x8')]=function(_0x1b5d2d,_0x3d2c84){logger[_0x0b9e('0x8')](_0x1b5d2d,_0x3d2c84?util[_0x0b9e('0x9')](_0x3d2c84,{'showHidden':![],'depth':null}):'');};exports[_0x0b9e('0xa')]=function(_0x2cf5dd,_0x2dbec5){logger['debug'](_0x2cf5dd,_0x2dbec5?util[_0x0b9e('0x9')](_0x2dbec5,{'showHidden':![],'depth':null}):'');};exports[_0x0b9e('0xb')]=function(_0x320a80,_0x25eee5){logger[_0x0b9e('0xb')](_0x320a80,_0x25eee5?util[_0x0b9e('0x9')](_0x25eee5,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x5a343f,_0x2d8943){return client[_0x0b9e('0xc')](_0x5a343f,{'body':_0x2d8943})[_0x0b9e('0xd')](function(_0x24c3c7){logger[_0x0b9e('0xa')](_0x0b9e('0xe'),_0x5a343f,_0x24c3c7?util[_0x0b9e('0x9')](_0x24c3c7,{'showHidden':![],'depth':null}):'');})[_0x0b9e('0xf')](function(_0x542eba){logger[_0x0b9e('0xb')]('[utils][request]\x20name:%s',_0x5a343f,_0x542eba?util[_0x0b9e('0x9')](_0x542eba,{'showHidden':![],'depth':null}):'');});};function getUser(_0x2f959a){return client[_0x0b9e('0xc')](_0x0b9e('0x10'),{'options':{'raw':!![],'attributes':['id','internal',_0x0b9e('0x11'),_0x0b9e('0x12')],'where':_0x2f959a,'limit':0x1}})[_0x0b9e('0xd')](function(_0x24a562){logger[_0x0b9e('0xa')](_0x0b9e('0x13'),JSON[_0x0b9e('0x14')](_0x2f959a),_0x24a562?util[_0x0b9e('0x9')](_0x24a562,{'showHidden':![],'depth':null}):'');return _0x24a562[_0x0b9e('0x15')][_0x0b9e('0x16')]?_0x24a562[_0x0b9e('0x15')][0x0]:null;});}exports['getUserByInternal']=function(_0x4af2c2){return new BPromise(function(_0x2c7f13,_0x28d91d){if(_0x4af2c2){return getUser({'internal':_0x4af2c2})[_0x0b9e('0xd')](function(_0x11cde8){logger[_0x0b9e('0x8')](_0x0b9e('0x17'),_0x4af2c2,_0x11cde8?_0x0b9e('0x18'):'notfound');return _0x2c7f13(_0x11cde8);})[_0x0b9e('0xf')](function(_0x1fb8be){logger[_0x0b9e('0xb')](_0x0b9e('0x19'),_0x1fb8be?util['inspect'](_0x1fb8be,{'showHidden':![],'depth':null}):'');return _0x2c7f13(null);});}return _0x2c7f13(null);});};exports[_0x0b9e('0x1a')]=function(_0x5f39d0){return new BPromise(function(_0x3d0b9d,_0x1baf98){if(_0x5f39d0){return getUser({'interface':_0x5f39d0})['then'](function(_0x1b4d9a){logger['info'](_0x0b9e('0x1b'),_0x5f39d0,_0x1b4d9a?_0x0b9e('0x18'):'notfound');return _0x3d0b9d(_0x1b4d9a);})[_0x0b9e('0xf')](function(_0x290ac5){logger[_0x0b9e('0xb')](_0x0b9e('0x1c'),_0x290ac5?util[_0x0b9e('0x9')](_0x290ac5,{'showHidden':![],'depth':null}):'');return _0x3d0b9d(null);});}return _0x3d0b9d(null);});};exports[_0x0b9e('0x1d')]=function(_0x3299fe){return new BPromise(function(_0x3b29bf,_0x15a31d){if(_0x3299fe){return getUser({'name':_0x3299fe})[_0x0b9e('0xd')](function(_0x1508b5){logger[_0x0b9e('0x8')](_0x0b9e('0x1e'),_0x3299fe,_0x1508b5?_0x0b9e('0x18'):_0x0b9e('0x1f'));return _0x3b29bf(_0x1508b5);})[_0x0b9e('0xf')](function(_0x4c7aee){logger[_0x0b9e('0xb')](_0x0b9e('0x20'),_0x4c7aee?util[_0x0b9e('0x9')](_0x4c7aee,{'showHidden':![],'depth':null}):'');return _0x3b29bf(null);});}return _0x3b29bf(null);});};exports[_0x0b9e('0x21')]=function(_0x3b0fc1){return new BPromise(function(_0x25b74a,_0x54a82e){if(_0x3b0fc1){return client[_0x0b9e('0xc')](_0x0b9e('0x22'),{'options':{'raw':!![],'attributes':['id',_0x0b9e('0x11'),'type','acw',_0x0b9e('0x23')],'where':{'name':_0x3b0fc1},'limit':0x1}})['then'](function(_0x43ff09){logger[_0x0b9e('0xa')](_0x0b9e('0x24'),_0x3b0fc1,_0x43ff09?util['inspect'](_0x43ff09,{'showHidden':![],'depth':null}):'');logger['info'](_0x0b9e('0x25'),_0x3b0fc1,_0x43ff09?_0x0b9e('0x18'):_0x0b9e('0x1f'));return _0x25b74a(_0x43ff09[_0x0b9e('0x15')]['length']?_0x43ff09[_0x0b9e('0x15')][0x0]:null);})[_0x0b9e('0xf')](function(_0x6d1b0f){logger['error'](_0x0b9e('0x26'),_0x6d1b0f?util[_0x0b9e('0x9')](_0x6d1b0f,{'showHidden':![],'depth':null}):'');return _0x25b74a(null);});}return _0x25b74a(null);});};exports[_0x0b9e('0x27')]=function(_0x344de9,_0x189947){return moment(_0x344de9)[_0x0b9e('0x28')](_0x189947,_0x0b9e('0x29'))['format'](_0x0b9e('0x2a'));};exports[_0x0b9e('0x2b')]=function(_0x14e9cf,_0xee4539){return moment(_0x14e9cf)[_0x0b9e('0x2c')](_0xee4539,_0x0b9e('0x29'))[_0x0b9e('0x2d')](_0x0b9e('0x2a'));};exports[_0x0b9e('0x2e')]=function(_0x4518e5,_0x2893e5){return moment(_0x4518e5)['diff'](moment(_0x2893e5),_0x0b9e('0x29'));};exports[_0x0b9e('0x2f')]=function(_0x5b6eae,_0x221433){return parseInt(_0x5b6eae,0xa)+parseInt(_0x221433,0xa);};exports[_0x0b9e('0x30')]=function(){return moment()['format'](_0x0b9e('0x2a'));};exports[_0x0b9e('0x31')]=function(_0x3aa93c,_0x1020c0){if(_0x1020c0){return moment(_0x3aa93c)[_0x0b9e('0x31')](_0x1020c0);}return!![];};exports[_0x0b9e('0x32')]=function(_0x3c3dda,_0x37be11){if(_0x37be11){return moment(_0x3c3dda)[_0x0b9e('0x32')](_0x37be11);}else if(_0x3c3dda){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 388727b..03b6de7 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 _0xf626=['/var','xcally','role','name','ensureDir','client','catch','log','user','then','no-user','data','timestamp','api','auth','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','x-forwarded-for','connection','remoteAddress','statusCode','responseTime','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','method','headers','url','agent_name','test','setupLoggers','fs-extra','path','util','./loggers','./safe-template','safeTemplate','./mask-sensitive-data','join'];(function(_0x23cfc8,_0x2f8716){var _0x137f73=function(_0xcab6fe){while(--_0xcab6fe){_0x23cfc8['push'](_0x23cfc8['shift']());}};_0x137f73(++_0x2f8716);}(_0xf626,0x82));var _0x6f62=function(_0xe9ae4d,_0x8e268e){_0xe9ae4d=_0xe9ae4d-0x0;var _0x3a11da=_0xf626[_0xe9ae4d];return _0x3a11da;};var fs=require(_0x6f62('0x0'));var _=require('lodash');var ewinston=require('express-winston');var path=require(_0x6f62('0x1'));var util=require(_0x6f62('0x2'));var fileLogger=require(_0x6f62('0x3'))['fileLogger'];var safeTemplate=require(_0x6f62('0x4'))[_0x6f62('0x5')];var maskSensitiveData=require(_0x6f62('0x6'))['maskSensitiveData'];function ClientSideLogger(){function _0x528c33(_0x10cd77){var _0x32f93e=path[_0x6f62('0x7')](_0x6f62('0x8'),'log',_0x6f62('0x9'));var _0x3c322c=path['join']('client',_0x10cd77[_0x6f62('0xa')]+'-'+_0x10cd77[_0x6f62('0xb')]);return fs[_0x6f62('0xc')](path[_0x6f62('0x7')](_0x32f93e,_0x3c322c))['then'](function(){var _0x515dbd=fileLogger(_0x6f62('0xd'),path[_0x6f62('0x7')](_0x32f93e,_0x3c322c));return _0x515dbd;})[_0x6f62('0xe')](function(_0x329b9d){throw _0x329b9d;});}this[_0x6f62('0xf')]=function(_0x438eee,_0x3d29ec,_0x43629f,_0xf5f133){return _0x528c33(_0x438eee[_0x6f62('0x10')])[_0x6f62('0x11')](function(_0x3fb2ee){var _0x3c7744=_0x3fb2ee[_0x3d29ec];return _0x3c7744;})[_0x6f62('0x11')](function(_0x1d28aa){var _0x1c1de6=_0x438eee['user']?_0x438eee[_0x6f62('0x10')]['id']:_0x6f62('0x12');var _0x556602=_0xf5f133[_0x6f62('0x13')];var _0x1f3b6d=_0xf5f133[_0x6f62('0x14')];var _0x1455c8=new Date(Number(_0x1f3b6d));return _0x1d28aa(_0x1c1de6,_0x1455c8,_0x43629f,_0x556602);})[_0x6f62('0xe')](function(_0x549dae){fileLogger(_0x6f62('0xd'))['error'](_0x549dae);});};}function setupLoggers(_0x4b6727){return new Promise(function(_0x5c04b3){var _0x2b7af6=new ClientSideLogger();var _0x28cba3=fileLogger(_0x6f62('0x15'));var _0x4b8234=fileLogger(_0x6f62('0x16'));_0x4b6727['set'](_0x6f62('0x17'),_0x2b7af6);_0x4b6727[_0x6f62('0x18')](ewinston[_0x6f62('0x19')]({'winstonInstance':_0x28cba3,'meta':![],'statusLevels':!![],'msg':function(_0x60fa6,_0x2f4b2c){var _0x24e036=_0x6f62('0x1a');if(!_[_0x6f62('0x1b')](_0x60fa6[_0x6f62('0x1c')])){_0x24e036+=_0x6f62('0x1d');var _0x4e067f=_0x60fa6['body'];maskSensitiveData(_0x4e067f);}return safeTemplate(util[_0x6f62('0x1e')](_0x24e036,_0x60fa6['method'],_0x60fa6['headers'][_0x6f62('0x1f')]?_0x60fa6['headers'][_0x6f62('0x1f')]:_0x60fa6[_0x6f62('0x20')][_0x6f62('0x21')]||_0x60fa6['ip'],_0x60fa6['url'],_0x2f4b2c[_0x6f62('0x22')],_0x2f4b2c[_0x6f62('0x23')],_0x60fa6[_0x6f62('0x10')]?_0x60fa6[_0x6f62('0x10')]['id']:null,_0x60fa6[_0x6f62('0x10')]?_0x60fa6[_0x6f62('0x10')][_0x6f62('0xb')]:null,_0x60fa6['user']?_0x60fa6[_0x6f62('0x10')][_0x6f62('0xa')]:null,_0x4e067f?util[_0x6f62('0x24')](_0x4e067f,![],null):''));}}));_0x4b6727[_0x6f62('0x18')](ewinston[_0x6f62('0x19')]({'winstonInstance':_0x4b8234,'meta':![],'statusLevels':!![],'msg':function(_0x2955d5,_0xc00499){var _0xb85ace=_0x6f62('0x25');if(_0x2955d5[_0x6f62('0x1c')]&&_0x2955d5[_0x6f62('0x1c')][_0x6f62('0x26')]&&_0x2955d5[_0x6f62('0x1c')]['agent_id']){_0xb85ace=_0x6f62('0x27');}return util[_0x6f62('0x1e')](_0xb85ace,_0x2955d5[_0x6f62('0x28')],_0x2955d5[_0x6f62('0x29')]['x-forwarded-for']?_0x2955d5[_0x6f62('0x29')][_0x6f62('0x1f')]:_0x2955d5[_0x6f62('0x20')][_0x6f62('0x21')]||_0x2955d5['ip'],_0x2955d5[_0x6f62('0x2a')],_0xc00499[_0x6f62('0x22')],_0xc00499[_0x6f62('0x23')],_0x2955d5[_0x6f62('0x10')]?_0x2955d5['user']['id']:null,_0x2955d5[_0x6f62('0x10')]?_0x2955d5[_0x6f62('0x10')][_0x6f62('0xb')]:null,_0x2955d5[_0x6f62('0x10')]?_0x2955d5['user']['role']:null,_0x2955d5[_0x6f62('0x1c')]&&_0x2955d5['body'][_0x6f62('0x26')]?_0x2955d5[_0x6f62('0x1c')][_0x6f62('0x26')]:'other',_0x2955d5[_0x6f62('0x1c')]&&_0x2955d5['body']['agent_id']?_0x2955d5[_0x6f62('0x1c')]['agent_id']:'',_0x2955d5[_0x6f62('0x1c')]&&_0x2955d5[_0x6f62('0x1c')]['agent_name']?_0x2955d5[_0x6f62('0x1c')][_0x6f62('0x2b')]:'');},'ignoreRoute':function(_0x34214b){var _0x4b7860=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x4b7860[_0x6f62('0x2c')](_0x34214b[_0x6f62('0x2a')]);}}));return _0x5c04b3();});}exports[_0x6f62('0x2d')]=setupLoggers; \ No newline at end of file +var _0xd103=['set','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','headers','remoteAddress','url','responseTime','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','format','method','x-forwarded-for','connection','statusCode','device','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','util','./loggers','fileLogger','./safe-template','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally','client','name','ensureDir','then','user','no-user','data','timestamp','catch','error','api','auth'];(function(_0x177fbd,_0x522cc7){var _0x39a845=function(_0x5b9638){while(--_0x5b9638){_0x177fbd['push'](_0x177fbd['shift']());}};_0x39a845(++_0x522cc7);}(_0xd103,0x1d1));var _0x3d10=function(_0x300c0f,_0x128fd5){_0x300c0f=_0x300c0f-0x0;var _0x20b0c0=_0xd103[_0x300c0f];return _0x20b0c0;};var fs=require(_0x3d10('0x0'));var _=require(_0x3d10('0x1'));var ewinston=require(_0x3d10('0x2'));var path=require('path');var util=require(_0x3d10('0x3'));var fileLogger=require(_0x3d10('0x4'))[_0x3d10('0x5')];var safeTemplate=require(_0x3d10('0x6'))['safeTemplate'];var maskSensitiveData=require(_0x3d10('0x7'))[_0x3d10('0x8')];function ClientSideLogger(){function _0x51a77(_0xae1296){var _0x2581fe=path[_0x3d10('0x9')](_0x3d10('0xa'),_0x3d10('0xb'),_0x3d10('0xc'));var _0x2e6923=path[_0x3d10('0x9')](_0x3d10('0xd'),_0xae1296['role']+'-'+_0xae1296[_0x3d10('0xe')]);return fs[_0x3d10('0xf')](path['join'](_0x2581fe,_0x2e6923))[_0x3d10('0x10')](function(){var _0x50814b=fileLogger(_0x3d10('0xd'),path[_0x3d10('0x9')](_0x2581fe,_0x2e6923));return _0x50814b;})['catch'](function(_0x59d5fe){throw _0x59d5fe;});}this[_0x3d10('0xb')]=function(_0x482a43,_0x567ede,_0xd7885,_0x5ad56d){return _0x51a77(_0x482a43[_0x3d10('0x11')])[_0x3d10('0x10')](function(_0x30b09c){var _0x498712=_0x30b09c[_0x567ede];return _0x498712;})[_0x3d10('0x10')](function(_0x29fe04){var _0x5c5f2e=_0x482a43[_0x3d10('0x11')]?_0x482a43['user']['id']:_0x3d10('0x12');var _0x854a3f=_0x5ad56d[_0x3d10('0x13')];var _0x34f900=_0x5ad56d[_0x3d10('0x14')];var _0x1942ae=new Date(Number(_0x34f900));return _0x29fe04(_0x5c5f2e,_0x1942ae,_0xd7885,_0x854a3f);})[_0x3d10('0x15')](function(_0x1a5a79){fileLogger(_0x3d10('0xd'))[_0x3d10('0x16')](_0x1a5a79);});};}function setupLoggers(_0x582229){return new Promise(function(_0x536eb8){var _0x25f7e7=new ClientSideLogger();var _0x49a22f=fileLogger(_0x3d10('0x17'));var _0xc14638=fileLogger(_0x3d10('0x18'));_0x582229[_0x3d10('0x19')]('client-side-logger',_0x25f7e7);_0x582229[_0x3d10('0x1a')](ewinston[_0x3d10('0x1b')]({'winstonInstance':_0x49a22f,'meta':![],'statusLevels':!![],'msg':function(_0x42ddb3,_0x2508e1){var _0x36120e=_0x3d10('0x1c');if(!_[_0x3d10('0x1d')](_0x42ddb3[_0x3d10('0x1e')])){_0x36120e+=_0x3d10('0x1f');var _0x94c96c=_0x42ddb3[_0x3d10('0x1e')];maskSensitiveData(_0x94c96c);}return safeTemplate(util['format'](_0x36120e,_0x42ddb3['method'],_0x42ddb3[_0x3d10('0x20')]['x-forwarded-for']?_0x42ddb3[_0x3d10('0x20')]['x-forwarded-for']:_0x42ddb3['connection'][_0x3d10('0x21')]||_0x42ddb3['ip'],_0x42ddb3[_0x3d10('0x22')],_0x2508e1['statusCode'],_0x2508e1[_0x3d10('0x23')],_0x42ddb3[_0x3d10('0x11')]?_0x42ddb3[_0x3d10('0x11')]['id']:null,_0x42ddb3[_0x3d10('0x11')]?_0x42ddb3[_0x3d10('0x11')][_0x3d10('0xe')]:null,_0x42ddb3[_0x3d10('0x11')]?_0x42ddb3[_0x3d10('0x11')][_0x3d10('0x24')]:null,_0x94c96c?util[_0x3d10('0x25')](_0x94c96c,![],null):''));}}));_0x582229[_0x3d10('0x1a')](ewinston[_0x3d10('0x1b')]({'winstonInstance':_0xc14638,'meta':![],'statusLevels':!![],'msg':function(_0x5baf1f,_0x145dfb){var _0x43e3ef=_0x3d10('0x26');if(_0x5baf1f[_0x3d10('0x1e')]&&_0x5baf1f[_0x3d10('0x1e')]['device']&&_0x5baf1f[_0x3d10('0x1e')][_0x3d10('0x27')]){_0x43e3ef='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x3d10('0x28')](_0x43e3ef,_0x5baf1f[_0x3d10('0x29')],_0x5baf1f[_0x3d10('0x20')]['x-forwarded-for']?_0x5baf1f[_0x3d10('0x20')][_0x3d10('0x2a')]:_0x5baf1f[_0x3d10('0x2b')][_0x3d10('0x21')]||_0x5baf1f['ip'],_0x5baf1f[_0x3d10('0x22')],_0x145dfb[_0x3d10('0x2c')],_0x145dfb[_0x3d10('0x23')],_0x5baf1f[_0x3d10('0x11')]?_0x5baf1f[_0x3d10('0x11')]['id']:null,_0x5baf1f[_0x3d10('0x11')]?_0x5baf1f['user'][_0x3d10('0xe')]:null,_0x5baf1f[_0x3d10('0x11')]?_0x5baf1f[_0x3d10('0x11')][_0x3d10('0x24')]:null,_0x5baf1f['body']&&_0x5baf1f[_0x3d10('0x1e')][_0x3d10('0x2d')]?_0x5baf1f[_0x3d10('0x1e')][_0x3d10('0x2d')]:'other',_0x5baf1f[_0x3d10('0x1e')]&&_0x5baf1f[_0x3d10('0x1e')][_0x3d10('0x27')]?_0x5baf1f[_0x3d10('0x1e')][_0x3d10('0x27')]:'',_0x5baf1f[_0x3d10('0x1e')]&&_0x5baf1f[_0x3d10('0x1e')][_0x3d10('0x2e')]?_0x5baf1f[_0x3d10('0x1e')][_0x3d10('0x2e')]:'');},'ignoreRoute':function(_0x311499){var _0x645615=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x645615[_0x3d10('0x2f')](_0x311499[_0x3d10('0x22')]);}}));return _0x536eb8();});}exports[_0x3d10('0x30')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 00ecf1b..68df9f9 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54f5=['minutes','startOf','day','endOf','isBetween','timeCompare','format','includes','date','daysInMonth','max','min','MMM','guess','isMoment','length','iftime','lodash','moment-timezone','map','source','join','isValid','split','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','circularMonthInterval','clone','hours'];(function(_0x4147fc,_0x535c6d){var _0x5295fc=function(_0x131a74){while(--_0x131a74){_0x4147fc['push'](_0x4147fc['shift']());}};_0x5295fc(++_0x535c6d);}(_0x54f5,0x1e5));var _0x554f=function(_0x1ba43c,_0x5bd2e8){_0x1ba43c=_0x1ba43c-0x0;var _0x2f60eb=_0x54f5[_0x1ba43c];return _0x2f60eb;};var _=require(_0x554f('0x0'));var moment=require(_0x554f('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][_0x554f('0x2')](function(_0x3b133e){return _0x3b133e[_0x554f('0x3')];})[_0x554f('0x4')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING='Interval\x20string\x20not\x20valid';var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0xa5d48b){if(!_0xa5d48b[_0x554f('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x47ef0f){var _0x54bd64=_0x47ef0f[_0x554f('0x6')](':')['map'](function(_0x1a8d16){return parseInt(_0x1a8d16,0xa);});var _0x6e9dfb=_0x54bd64[0x0];var _0x33d43b=_0x54bd64[0x1];if(_0x6e9dfb<0x0||_0x6e9dfb>0x17||_0x33d43b<0x0||_0x33d43b>0x3b){throw new Error(EINVALID_DATE);}return[_0x6e9dfb,_0x33d43b];}function circularDoWInterval(_0x53015e,_0x5c4057){if(_0x53015e===_0x5c4057){return[_0x53015e];}else{var _0x35e211=moment[_0x554f('0x7')]();moment[_0x554f('0x7')]('en');var _0x40fc15=moment[_0x554f('0x8')]()[_0x554f('0x2')](function(_0x1e6bd8){return _0x1e6bd8[_0x554f('0x9')]();});moment[_0x554f('0x7')](_0x35e211);var _0x7d6eb4=_0x40fc15['indexOf'](_0x53015e);var _0x6afb81=_0x40fc15[_0x554f('0xa')](_0x5c4057);if(_0x6afb81>_0x7d6eb4){return _0x40fc15['slice'](_0x7d6eb4,_0x6afb81+0x1);}else{var _0x54cbce=_0x40fc15['slice'](0x0,_0x6afb81+0x1);var _0x3b45ba=_0x40fc15[_0x554f('0xb')](_0x7d6eb4);return _0x3b45ba[_0x554f('0xc')](_0x54cbce);}}}module[_0x554f('0xd')][_0x554f('0xe')]=circularDoWInterval;function circularMonthInterval(_0x1a5e1d,_0x1e3c42){if(_0x1a5e1d===_0x1e3c42){return[_0x1a5e1d];}else{var _0x4603c0=moment['locale']();moment[_0x554f('0x7')]('en');var _0x230136=moment[_0x554f('0xf')]()['map'](function(_0x2dc3e2){return _0x2dc3e2[_0x554f('0x9')]();});moment[_0x554f('0x7')](_0x4603c0);var _0x398524=_0x230136['indexOf'](_0x1a5e1d);var _0x22064b=_0x230136['indexOf'](_0x1e3c42);if(_0x22064b>_0x398524){return _0x230136[_0x554f('0xb')](_0x398524,_0x22064b+0x1);}else{var _0x3150bf=_0x230136[_0x554f('0xb')](0x0,_0x22064b+0x1);var _0x2804c9=_0x230136[_0x554f('0xb')](_0x398524);return _0x2804c9[_0x554f('0xc')](_0x3150bf);}}}module['exports'][_0x554f('0x10')]=circularMonthInterval;function parseDom(_0x2742f8){var _0x20ba7e=parseInt(_0x2742f8,0xa);if(_0x20ba7e<0x1||_0x20ba7e>0x1f){throw new Error(EINVALID_DATE);}return _0x20ba7e;}function timeCompare(_0x5f4604,_0x32c9e9,_0x48f499){var _0x2e0a86=_0x5f4604[_0x554f('0x11')]();var _0x2f5fee=extractTime(_0x32c9e9);var _0x4d7360=_0x2f5fee[0x0];var _0x588be6=_0x2f5fee[0x1];var _0x43c6db=_0x5f4604[_0x554f('0x11')]()[_0x554f('0x12')](_0x4d7360)[_0x554f('0x13')](_0x588be6);throwIfDateNotValid(_0x43c6db);var _0x1603b2=extractTime(_0x48f499);var _0x510bcf=_0x1603b2[0x0];var _0x483823=_0x1603b2[0x1];var _0x28780d=_0x5f4604[_0x554f('0x11')]()['hours'](_0x510bcf)['minutes'](_0x483823);throwIfDateNotValid(_0x28780d);if(_0x28780d['isBefore'](_0x43c6db)){var _0x53b023=_0x2e0a86['clone']()[_0x554f('0x14')](_0x554f('0x15'));var _0x21ba93=_0x2e0a86[_0x554f('0x11')]()[_0x554f('0x16')]('day');return _0x2e0a86[_0x554f('0x17')](_0x43c6db,_0x21ba93,undefined,'[]')||_0x2e0a86['isBetween'](_0x53b023,_0x28780d,undefined,'[]');}else{return _0x2e0a86[_0x554f('0x17')](_0x43c6db,_0x28780d,undefined,'[]');}}module['exports'][_0x554f('0x18')]=timeCompare;function dowCompare(_0x2a6cbd,_0x51280e,_0x13655d){var _0x1b8a00=_0x2a6cbd['locale']('en')[_0x554f('0x19')]('ddd')[_0x554f('0x9')]();return circularDoWInterval(_0x51280e,_0x13655d)[_0x554f('0x1a')](_0x1b8a00);}module['exports']['dowCompare']=dowCompare;function domCompare(_0x106383,_0x73d24,_0x519d18){var _0x236462=_0x106383[_0x554f('0x1b')]();if(_0x73d24===_0x519d18){return _0x236462===_0x73d24;}else{var _0x924ba=_0x106383[_0x554f('0x1c')]();var _0x109fa=_0x73d24<_0x519d18;let _0x507b61=![];var _0x3c1b8d=0x0;var _0x3e48ce=0x0;if(_0x109fa){_0x3c1b8d=Math[_0x554f('0x1d')](0x1,_0x73d24);_0x3e48ce=Math[_0x554f('0x1e')](_0x519d18,_0x924ba);_0x507b61=_0x236462>=_0x3c1b8d&&_0x236462<=_0x3e48ce;}else{_0x3c1b8d=Math['min'](_0x73d24,_0x924ba);_0x3e48ce=Math[_0x554f('0x1d')](0x1,_0x519d18);_0x507b61=_0x236462>=_0x3c1b8d||_0x236462<=_0x3e48ce;}return _0x507b61;}}module['exports']['domCompare']=domCompare;function monthCompare(_0x35996d,_0xcf9c8b,_0x146bba){var _0xd4ddf7=_0x35996d['locale']('en')[_0x554f('0x19')](_0x554f('0x1f'))[_0x554f('0x9')]();return circularMonthInterval(_0xcf9c8b,_0x146bba)[_0x554f('0x1a')](_0xd4ddf7);}module['exports']['monthCompare']=monthCompare;function iftime(_0x5f07d5,_0x4c5921=moment['tz'][_0x554f('0x20')](),_0x59cf26=moment()){if(!validateRx['test'](_0x5f07d5)){throw new Error(EINVALID_STRING);}else{var _0xbdab05=(moment[_0x554f('0x21')](_0x59cf26)?_0x59cf26['clone']():moment(_0x59cf26))['tz'](_0x4c5921)[_0x554f('0x7')]('en');throwIfDateNotValid(_0xbdab05);var _0x26187a=_0x5f07d5[_0x554f('0x6')](',');var _0x4c8058=_0x26187a[0x0];var _0x4abf2d=_0x26187a[0x1];var _0x3bf0aa=_0x26187a[0x2];var _0x1debf6=_0x26187a[0x3];let _0x3b9496=!![];if(_0x4c8058!=='*'){var _0x34ce9f=_0x4c8058[_0x554f('0x6')]('-');var _0x40daee=_['padStart'](_0x34ce9f[0x0],0x5,'0');var _0x513280=_0x34ce9f['length']===0x2?_['padStart'](_0x34ce9f[0x1],0x5,'0'):_0x40daee;_0x3b9496=timeCompare(_0xbdab05,_0x40daee,_0x513280);}let _0x2ca6a3=!![];if(_0x4abf2d!=='*'){var _0x5b1f4c=_0x4abf2d['split']('-');var _0xf23d7f=_0x5b1f4c[0x0];var _0x54dec0=_0x5b1f4c[_0x554f('0x22')]===0x2?_0x5b1f4c[0x1]:_0xf23d7f;_0x2ca6a3=dowCompare(_0xbdab05,_0xf23d7f,_0x54dec0);}let _0x2ad01a=!![];if(_0x3bf0aa!=='*'){var _0x24ef90=_0x3bf0aa['split']('-');var _0x123b0d=parseDom(_0x24ef90[0x0]);var _0x473dad=_0x24ef90[_0x554f('0x22')]===0x2?parseDom(_0x24ef90[0x1]):_0x123b0d;_0x2ad01a=domCompare(_0xbdab05,_0x123b0d,_0x473dad);}let _0x3b8ba4=!![];if(_0x1debf6!=='*'){var _0x4cb4ad=_0x1debf6[_0x554f('0x6')]('-');var _0x35ec11=_0x4cb4ad[0x0];var _0x286018=_0x4cb4ad[_0x554f('0x22')]===0x2?_0x4cb4ad[0x1]:_0x4cb4ad[0x0];_0x3b8ba4=monthCompare(_0xbdab05,_0x35ec11,_0x286018);}return _0x3b9496&&_0x2ca6a3&&_0x2ad01a&&_0x3b8ba4;}}module[_0x554f('0xd')][_0x554f('0x23')]=iftime; \ No newline at end of file +var _0x0597=['Date\x20not\x20valid','isValid','split','locale','weekdaysShort','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','toLowerCase','circularMonthInterval','clone','hours','minutes','isBefore','day','isBetween','timeCompare','format','ddd','includes','date','daysInMonth','min','max','monthCompare','guess','padStart','length','iftime','lodash','moment-timezone','map','source','join','Interval\x20string\x20not\x20valid'];(function(_0xa651d4,_0x5df6cb){var _0x1301be=function(_0x5aa409){while(--_0x5aa409){_0xa651d4['push'](_0xa651d4['shift']());}};_0x1301be(++_0x5df6cb);}(_0x0597,0x176));var _0x7059=function(_0x5f3728,_0x267611){_0x5f3728=_0x5f3728-0x0;var _0x30e6c6=_0x0597[_0x5f3728];return _0x30e6c6;};var _=require(_0x7059('0x0'));var moment=require(_0x7059('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][_0x7059('0x2')](function(_0x1e8506){return _0x1e8506[_0x7059('0x3')];})[_0x7059('0x4')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x7059('0x5');var EINVALID_DATE=_0x7059('0x6');function throwIfDateNotValid(_0x7eec60){if(!_0x7eec60[_0x7059('0x7')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x62984){var _0x455fc1=_0x62984[_0x7059('0x8')](':')[_0x7059('0x2')](function(_0x417c24){return parseInt(_0x417c24,0xa);});var _0x2c96fe=_0x455fc1[0x0];var _0x49a5bc=_0x455fc1[0x1];if(_0x2c96fe<0x0||_0x2c96fe>0x17||_0x49a5bc<0x0||_0x49a5bc>0x3b){throw new Error(EINVALID_DATE);}return[_0x2c96fe,_0x49a5bc];}function circularDoWInterval(_0x502ac3,_0x3469bb){if(_0x502ac3===_0x3469bb){return[_0x502ac3];}else{var _0x44a7da=moment[_0x7059('0x9')]();moment[_0x7059('0x9')]('en');var _0x4f443f=moment[_0x7059('0xa')]()[_0x7059('0x2')](function(_0x211737){return _0x211737['toLowerCase']();});moment[_0x7059('0x9')](_0x44a7da);var _0x468876=_0x4f443f[_0x7059('0xb')](_0x502ac3);var _0x2c42d2=_0x4f443f['indexOf'](_0x3469bb);if(_0x2c42d2>_0x468876){return _0x4f443f[_0x7059('0xc')](_0x468876,_0x2c42d2+0x1);}else{var _0x46b965=_0x4f443f[_0x7059('0xc')](0x0,_0x2c42d2+0x1);var _0x1bea27=_0x4f443f[_0x7059('0xc')](_0x468876);return _0x1bea27[_0x7059('0xd')](_0x46b965);}}}module[_0x7059('0xe')][_0x7059('0xf')]=circularDoWInterval;function circularMonthInterval(_0x50ede3,_0x51ea12){if(_0x50ede3===_0x51ea12){return[_0x50ede3];}else{var _0x1396c2=moment['locale']();moment['locale']('en');var _0x5e7782=moment[_0x7059('0x10')]()[_0x7059('0x2')](function(_0x4d9ae9){return _0x4d9ae9[_0x7059('0x11')]();});moment['locale'](_0x1396c2);var _0x53127f=_0x5e7782['indexOf'](_0x50ede3);var _0x1df504=_0x5e7782[_0x7059('0xb')](_0x51ea12);if(_0x1df504>_0x53127f){return _0x5e7782[_0x7059('0xc')](_0x53127f,_0x1df504+0x1);}else{var _0x13e59f=_0x5e7782[_0x7059('0xc')](0x0,_0x1df504+0x1);var _0x5ed367=_0x5e7782['slice'](_0x53127f);return _0x5ed367[_0x7059('0xd')](_0x13e59f);}}}module['exports'][_0x7059('0x12')]=circularMonthInterval;function parseDom(_0x214985){var _0x2016ed=parseInt(_0x214985,0xa);if(_0x2016ed<0x1||_0x2016ed>0x1f){throw new Error(EINVALID_DATE);}return _0x2016ed;}function timeCompare(_0x4e62d4,_0x1da626,_0x3941bd){var _0x341f3a=_0x4e62d4['clone']();var _0x489a22=extractTime(_0x1da626);var _0x16f725=_0x489a22[0x0];var _0x19c17d=_0x489a22[0x1];var _0x2ed884=_0x4e62d4[_0x7059('0x13')]()['hours'](_0x16f725)['minutes'](_0x19c17d);throwIfDateNotValid(_0x2ed884);var _0x1f8152=extractTime(_0x3941bd);var _0x3da177=_0x1f8152[0x0];var _0x401dcf=_0x1f8152[0x1];var _0x4e3faf=_0x4e62d4['clone']()[_0x7059('0x14')](_0x3da177)[_0x7059('0x15')](_0x401dcf);throwIfDateNotValid(_0x4e3faf);if(_0x4e3faf[_0x7059('0x16')](_0x2ed884)){var _0x44d91e=_0x341f3a[_0x7059('0x13')]()['startOf']('day');var _0x3582c3=_0x341f3a[_0x7059('0x13')]()['endOf'](_0x7059('0x17'));return _0x341f3a['isBetween'](_0x2ed884,_0x3582c3,undefined,'[]')||_0x341f3a['isBetween'](_0x44d91e,_0x4e3faf,undefined,'[]');}else{return _0x341f3a[_0x7059('0x18')](_0x2ed884,_0x4e3faf,undefined,'[]');}}module[_0x7059('0xe')][_0x7059('0x19')]=timeCompare;function dowCompare(_0x27933a,_0x4f23f0,_0x5b708e){var _0x1be164=_0x27933a[_0x7059('0x9')]('en')[_0x7059('0x1a')](_0x7059('0x1b'))['toLowerCase']();return circularDoWInterval(_0x4f23f0,_0x5b708e)[_0x7059('0x1c')](_0x1be164);}module[_0x7059('0xe')]['dowCompare']=dowCompare;function domCompare(_0x2f5f39,_0x204b11,_0x42ec65){var _0x5d0d01=_0x2f5f39[_0x7059('0x1d')]();if(_0x204b11===_0x42ec65){return _0x5d0d01===_0x204b11;}else{var _0xcef008=_0x2f5f39[_0x7059('0x1e')]();var _0x5926b5=_0x204b11<_0x42ec65;let _0x4bf5b6=![];var _0x2727f5=0x0;var _0x57ea78=0x0;if(_0x5926b5){_0x2727f5=Math['max'](0x1,_0x204b11);_0x57ea78=Math[_0x7059('0x1f')](_0x42ec65,_0xcef008);_0x4bf5b6=_0x5d0d01>=_0x2727f5&&_0x5d0d01<=_0x57ea78;}else{_0x2727f5=Math[_0x7059('0x1f')](_0x204b11,_0xcef008);_0x57ea78=Math[_0x7059('0x20')](0x1,_0x42ec65);_0x4bf5b6=_0x5d0d01>=_0x2727f5||_0x5d0d01<=_0x57ea78;}return _0x4bf5b6;}}module[_0x7059('0xe')]['domCompare']=domCompare;function monthCompare(_0x14a82e,_0x19239e,_0x5438a7){var _0x39759e=_0x14a82e[_0x7059('0x9')]('en')[_0x7059('0x1a')]('MMM')[_0x7059('0x11')]();return circularMonthInterval(_0x19239e,_0x5438a7)[_0x7059('0x1c')](_0x39759e);}module['exports'][_0x7059('0x21')]=monthCompare;function iftime(_0x1f12e7,_0x1ca4e7=moment['tz'][_0x7059('0x22')](),_0x9752eb=moment()){if(!validateRx['test'](_0x1f12e7)){throw new Error(EINVALID_STRING);}else{var _0x22d09e=(moment['isMoment'](_0x9752eb)?_0x9752eb['clone']():moment(_0x9752eb))['tz'](_0x1ca4e7)[_0x7059('0x9')]('en');throwIfDateNotValid(_0x22d09e);var _0x4346d6=_0x1f12e7[_0x7059('0x8')](',');var _0xb8b372=_0x4346d6[0x0];var _0x5bd692=_0x4346d6[0x1];var _0x12b6d7=_0x4346d6[0x2];var _0x13fb6f=_0x4346d6[0x3];let _0x7ce9aa=!![];if(_0xb8b372!=='*'){var _0x1b1d1b=_0xb8b372[_0x7059('0x8')]('-');var _0x2540de=_[_0x7059('0x23')](_0x1b1d1b[0x0],0x5,'0');var _0x50a756=_0x1b1d1b[_0x7059('0x24')]===0x2?_['padStart'](_0x1b1d1b[0x1],0x5,'0'):_0x2540de;_0x7ce9aa=timeCompare(_0x22d09e,_0x2540de,_0x50a756);}let _0x2d7b4e=!![];if(_0x5bd692!=='*'){var _0x58c374=_0x5bd692[_0x7059('0x8')]('-');var _0x40534f=_0x58c374[0x0];var _0x10f449=_0x58c374[_0x7059('0x24')]===0x2?_0x58c374[0x1]:_0x40534f;_0x2d7b4e=dowCompare(_0x22d09e,_0x40534f,_0x10f449);}let _0x43c5d6=!![];if(_0x12b6d7!=='*'){var _0x340c89=_0x12b6d7[_0x7059('0x8')]('-');var _0x3c285e=parseDom(_0x340c89[0x0]);var _0x6dc4b1=_0x340c89[_0x7059('0x24')]===0x2?parseDom(_0x340c89[0x1]):_0x3c285e;_0x43c5d6=domCompare(_0x22d09e,_0x3c285e,_0x6dc4b1);}let _0x3fccd6=!![];if(_0x13fb6f!=='*'){var _0x1e3f7f=_0x13fb6f[_0x7059('0x8')]('-');var _0x2d262f=_0x1e3f7f[0x0];var _0x1360d5=_0x1e3f7f[_0x7059('0x24')]===0x2?_0x1e3f7f[0x1]:_0x1e3f7f[0x0];_0x3fccd6=monthCompare(_0x22d09e,_0x2d262f,_0x1360d5);}return _0x7ce9aa&&_0x2d7b4e&&_0x43c5d6&&_0x3fccd6;}}module[_0x7059('0xe')][_0x7059('0x25')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 48b900b..dde997a 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaded=['%s-%s.log','message','replace','{{{','}}}','format','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','meta','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','level','Logger','transports','Console','File','error','warn','fileLogger','path','util','winston','../config/environment','debugLevel','info','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20green','bold\x20cyan','addColors','join'];(function(_0x52defa,_0x492e7f){var _0x4f95d6=function(_0x482de6){while(--_0x482de6){_0x52defa['push'](_0x52defa['shift']());}};_0x4f95d6(++_0x492e7f);}(_0xaded,0x195));var _0xdade=function(_0x5cedf6,_0x4d9400){_0x5cedf6=_0x5cedf6-0x0;var _0x8ccd35=_0xaded[_0x5cedf6];return _0x8ccd35;};'use strict';var path=require(_0xdade('0x0'));var util=require(_0xdade('0x1'));var moment=require('moment');var winston=require(_0xdade('0x2'));var config=require(_0xdade('0x3'));var debugLevel=config[_0xdade('0x4')]?config['debugLevel']['toLowerCase']():_0xdade('0x5');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0xdade('0x6'),'error':_0xdade('0x7'),'warn':_0xdade('0x8'),'info':_0xdade('0x9'),'print':_0xdade('0xa'),'success':_0xdade('0xb'),'http':'gray','verbose':'bold\x20magenta','debug':'bold\x20blue','silly':_0xdade('0xc')};winston[_0xdade('0xd')](XC_LOG_COLORS);function getLogFileName(_0x36624f,_0x1e1b81,_0x493576){var _0x43e2a5=_0x36624f||'/var/log/xcally';return path[_0xdade('0xe')](_0x43e2a5,util['format'](_0xdade('0xf'),_0x1e1b81,_0x493576));}function formatter(_0x510889,_0x32557d){_0x32557d[_0xdade('0x10')]=_0x32557d[_0xdade('0x10')][_0xdade('0x11')](/@@{/g,_0xdade('0x12'))[_0xdade('0x11')](/}@@/g,_0xdade('0x13'))[_0xdade('0x11')](/@{/g,'{{')[_0xdade('0x11')](/}@/g,'}}');return util[_0xdade('0x14')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xdade('0x14')](_0xdade('0x15')),_0x32557d['level'][_0xdade('0x16')](),_0x510889,_0x32557d[_0xdade('0x10')]);}function fileFormat(_0x2d9c52,_0x5ece58){_0x5ece58[_0xdade('0x10')]=_0x5ece58['message']['replace'](/@@{/g,_0xdade('0x12'))['replace'](/}@@/g,_0xdade('0x13'))['replace'](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x3aecf1=_0x5ece58[_0xdade('0x17')]&&Object['keys'](_0x5ece58['meta'])[_0xdade('0x18')]?'\x0a\x09'+JSON[_0xdade('0x19')](_0x5ece58[_0xdade('0x17')]):'';return util[_0xdade('0x14')](_0xdade('0x1a'),moment()['format'](_0xdade('0x15')),_0x5ece58[_0xdade('0x1b')][_0xdade('0x16')](),_0x2d9c52,_0x5ece58['message'],_0x3aecf1);}function consoleLogger(){var _0x2083bc=new winston[(_0xdade('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xdade('0x1d'))][(_0xdade('0x1e'))]({'level':'warn','json':![],'formatter':function(_0x46dceb){return formatter('',_0x46dceb);}})]});return _0x2083bc;}function fileLogger(_0x3496f7,_0x17c66c){var _0x1d935b=new winston[(_0xdade('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xdade('0x1d'))][(_0xdade('0x1f'))]({'name':util[_0xdade('0x14')]('%s-%s',_0x3496f7,_0xdade('0x20')),'filename':getLogFileName(_0x17c66c,_0x3496f7,_0xdade('0x20')),'level':_0xdade('0x20'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x333b9c){return fileFormat(_0x3496f7,_0x333b9c);}}),new winston['transports'][(_0xdade('0x1f'))]({'name':util[_0xdade('0x14')]('%s-%s',_0x3496f7,debugLevel),'filename':getLogFileName(_0x17c66c,_0x3496f7,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xcd87ab){return fileFormat(_0x3496f7,_0xcd87ab);}}),new winston[(_0xdade('0x1d'))][(_0xdade('0x1e'))]({'level':_0xdade('0x21'),'json':![],'formatter':function(_0x108af6){return fileFormat(_0x3496f7,_0x108af6);}})]});return _0x1d935b;}exports['consoleLogger']=consoleLogger;exports[_0xdade('0x22')]=fileLogger; \ No newline at end of file +var _0xe041=['message','replace','}}}','format','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','{{{','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','Console','warn','transports','%s-%s','error','fileLogger','path','util','moment','winston','../config/environment','debugLevel','toLowerCase','red','white','bold\x20white','bold\x20green','gray','bold\x20magenta','/var/log/xcally','join','%s-%s.log'];(function(_0x442835,_0x3c08d7){var _0x11bec8=function(_0x5ae538){while(--_0x5ae538){_0x442835['push'](_0x442835['shift']());}};_0x11bec8(++_0x3c08d7);}(_0xe041,0xa4));var _0x1e04=function(_0x418853,_0x4921f0){_0x418853=_0x418853-0x0;var _0x367193=_0xe041[_0x418853];return _0x367193;};'use strict';var path=require(_0x1e04('0x0'));var util=require(_0x1e04('0x1'));var moment=require(_0x1e04('0x2'));var winston=require(_0x1e04('0x3'));var config=require(_0x1e04('0x4'));var debugLevel=config[_0x1e04('0x5')]?config[_0x1e04('0x5')][_0x1e04('0x6')]():'info';var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':'redBG\x20white','error':_0x1e04('0x7'),'warn':'bold\x20yellow','info':_0x1e04('0x8'),'print':_0x1e04('0x9'),'success':_0x1e04('0xa'),'http':_0x1e04('0xb'),'verbose':_0x1e04('0xc'),'debug':'bold\x20blue','silly':'bold\x20cyan'};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x179f80,_0x40d533,_0x36b144){var _0x3e6797=_0x179f80||_0x1e04('0xd');return path[_0x1e04('0xe')](_0x3e6797,util['format'](_0x1e04('0xf'),_0x40d533,_0x36b144));}function formatter(_0xfe73bb,_0x14def1){_0x14def1[_0x1e04('0x10')]=_0x14def1['message'][_0x1e04('0x11')](/@@{/g,'{{{')['replace'](/}@@/g,_0x1e04('0x12'))[_0x1e04('0x11')](/@{/g,'{{')[_0x1e04('0x11')](/}@/g,'}}');return util[_0x1e04('0x13')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x1e04('0x13')](_0x1e04('0x14')),_0x14def1[_0x1e04('0x15')][_0x1e04('0x16')](),_0xfe73bb,_0x14def1[_0x1e04('0x10')]);}function fileFormat(_0x41b8c3,_0x27e39b){_0x27e39b['message']=_0x27e39b['message'][_0x1e04('0x11')](/@@{/g,_0x1e04('0x17'))['replace'](/}@@/g,_0x1e04('0x12'))[_0x1e04('0x11')](/@{/g,'{{')[_0x1e04('0x11')](/}@/g,'}}');var _0x51ceeb=_0x27e39b[_0x1e04('0x18')]&&Object[_0x1e04('0x19')](_0x27e39b[_0x1e04('0x18')])[_0x1e04('0x1a')]?'\x0a\x09'+JSON[_0x1e04('0x1b')](_0x27e39b[_0x1e04('0x18')]):'';return util['format'](_0x1e04('0x1c'),moment()[_0x1e04('0x13')](_0x1e04('0x14')),_0x27e39b[_0x1e04('0x15')][_0x1e04('0x16')](),_0x41b8c3,_0x27e39b[_0x1e04('0x10')],_0x51ceeb);}function consoleLogger(){var _0xbc54f3=new winston[(_0x1e04('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x1e04('0x1e'))]({'level':_0x1e04('0x1f'),'json':![],'formatter':function(_0x12e684){return formatter('',_0x12e684);}})]});return _0xbc54f3;}function fileLogger(_0x4cd175,_0x9efdf2){var _0x286e8a=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x1e04('0x20'))]['File']({'name':util[_0x1e04('0x13')](_0x1e04('0x21'),_0x4cd175,_0x1e04('0x22')),'filename':getLogFileName(_0x9efdf2,_0x4cd175,_0x1e04('0x22')),'level':_0x1e04('0x22'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4f5766){return fileFormat(_0x4cd175,_0x4f5766);}}),new winston['transports']['File']({'name':util[_0x1e04('0x13')](_0x1e04('0x21'),_0x4cd175,debugLevel),'filename':getLogFileName(_0x9efdf2,_0x4cd175,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3120e7){return fileFormat(_0x4cd175,_0x3120e7);}}),new winston[(_0x1e04('0x20'))]['Console']({'level':_0x1e04('0x1f'),'json':![],'formatter':function(_0x2da122){return fileFormat(_0x4cd175,_0x2da122);}})]});return _0x286e8a;}exports['consoleLogger']=consoleLogger;exports[_0x1e04('0x23')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 30d12f9..5fc1d9c 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 _0x14a0=['membername','calleridnum','exten','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','accountSid','localstationid','dsn','secret','registry','isArray','length','isPlainObject','isString','replace','@@{','}@@','includes','exports','maskSensitiveData','username','password','newPassword','apiKey','firstName','lastName','street','fax','email','clientId','code','accessKey','tenantId','accessToken'];(function(_0x18697f,_0x1229a2){var _0x2cd42d=function(_0xf18867){while(--_0xf18867){_0x18697f['push'](_0x18697f['shift']());}};_0x2cd42d(++_0x1229a2);}(_0x14a0,0x8e));var _0x014a=function(_0x4e4b8d,_0x1d9168){_0x4e4b8d=_0x4e4b8d-0x0;var _0x366450=_0x14a0[_0x4e4b8d];return _0x366450;};var _=require('lodash');var sensitiveFields=[_0x014a('0x0'),_0x014a('0x1'),_0x014a('0x2'),_0x014a('0x3'),_0x014a('0x4'),_0x014a('0x5'),_0x014a('0x6'),'phone','mobile',_0x014a('0x7'),_0x014a('0x8'),_0x014a('0x9'),'clientSecret','securityToken',_0x014a('0xa'),_0x014a('0xb'),_0x014a('0xc'),'token','channelSecret',_0x014a('0xd'),'accessTokenSecret','authToken','consumerKey','consumerSecret',_0x014a('0xe'),'calleridname',_0x014a('0xf'),_0x014a('0x10'),'vidaooApiKey',_0x014a('0x11'),_0x014a('0x12'),_0x014a('0x13'),_0x014a('0x14'),_0x014a('0x15'),_0x014a('0x16'),_0x014a('0x17'),_0x014a('0x18'),_0x014a('0x19'),_0x014a('0x1a'),_0x014a('0x1b'),_0x014a('0x1c'),'oldPassword'];function maskSensitiveData(_0x130d13){const _0x3cf92f=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x130d13)){for(const _0x3a836f in _0x130d13){if(_[_0x014a('0x1d')](_0x130d13[_0x3a836f])){for(let _0x59a4ea=0x0;_0x59a4ea<_0x130d13[_0x3a836f][_0x014a('0x1e')];_0x59a4ea++){maskSensitiveData(_0x130d13[_0x3a836f][_0x59a4ea]);}}else if(_[_0x014a('0x1f')](_0x130d13[_0x3a836f])){maskSensitiveData(_0x130d13[_0x3a836f]);}else if(_[_0x014a('0x20')](_0x130d13[_0x3a836f])){_0x130d13[_0x3a836f]=_0x130d13[_0x3a836f][_0x014a('0x21')](/{{{/g,_0x014a('0x22'))[_0x014a('0x21')](/}}}/g,_0x014a('0x23'))[_0x014a('0x21')](/{{/g,'@{')[_0x014a('0x21')](/}}/g,'}@');if(_[_0x014a('0x24')](sensitiveFields,_0x3a836f)){_0x130d13[_0x3a836f]=_0x130d13[_0x3a836f][_0x014a('0x21')](_0x3cf92f,'*');}}}}}module[_0x014a('0x25')][_0x014a('0x26')]=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(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x57ca,0x108));var _0xa57c=function(_0x1f8726,_0x193bd5){_0x1f8726=_0x1f8726-0x0;var _0x463a5c=_0x57ca[_0x1f8726];return _0x463a5c;};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/safe-template.js b/server/utils/safe-template.js index 1661762..b8de613 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 _0xe605=['isArray','map','isPlainObject','keys','reduce','exports','lodash','\x20}\x20}','string','replace'];(function(_0x578fdc,_0x184671){var _0x3366d2=function(_0x2335d4){while(--_0x2335d4){_0x578fdc['push'](_0x578fdc['shift']());}};_0x3366d2(++_0x184671);}(_0xe605,0x92));var _0x5e60=function(_0x3fc5d9,_0x46857a){_0x3fc5d9=_0x3fc5d9-0x0;var _0x20f23d=_0xe605[_0x3fc5d9];return _0x20f23d;};var _=require(_0x5e60('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x455628){return _0x455628==='{{'?'{\x20{\x20':_0x5e60('0x1');}function safeTemplate(_0x455efd){var _0x342132=_0x455efd;if(typeof _0x455efd===_0x5e60('0x2')){_0x342132=_0x455efd[_0x5e60('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x5e60('0x4')](_0x455efd)){_0x342132=_0x455efd[_0x5e60('0x5')](function(_0x30d8fb){return safeTemplate(_0x30d8fb);});}else if(_[_0x5e60('0x6')](_0x455efd)){_0x342132=Object[_0x5e60('0x7')](_0x455efd)[_0x5e60('0x8')](function(_0x168a14,_0x4e3501){_0x168a14[_0x4e3501]=safeTemplate(_0x455efd[_0x4e3501]);return _0x168a14;},{});}return _0x342132;}module[_0x5e60('0x9')]['safeTemplate']=safeTemplate; \ No newline at end of file +var _0x14a0=['string','replace','isPlainObject','keys','exports','safeTemplate','{\x20{\x20','\x20}\x20}'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0x14a0,0x8e));var _0x014a=function(_0x3a61b1,_0xe64783){_0x3a61b1=_0x3a61b1-0x0;var _0x401ff0=_0x14a0[_0x3a61b1];return _0x401ff0;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x105436){return _0x105436==='{{'?_0x014a('0x0'):_0x014a('0x1');}function safeTemplate(_0x28b0f6){var _0x32e88c=_0x28b0f6;if(typeof _0x28b0f6===_0x014a('0x2')){_0x32e88c=_0x28b0f6[_0x014a('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x28b0f6)){_0x32e88c=_0x28b0f6['map'](function(_0x1730a5){return safeTemplate(_0x1730a5);});}else if(_[_0x014a('0x4')](_0x28b0f6)){_0x32e88c=Object[_0x014a('0x5')](_0x28b0f6)['reduce'](function(_0x5a61ac,_0x11b8ce){_0x5a61ac[_0x11b8ce]=safeTemplate(_0x28b0f6[_0x11b8ce]);return _0x5a61ac;},{});}return _0x32e88c;}module[_0x014a('0x6')][_0x014a('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 7e6b21a..5c5b25c 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 _0x4336=['server/app.json','apps','name','motion2','env','NODE_PATH','string','pathExists','then','readJSON','updated','Updating\x20app.json','writeJSON','exports','fs-extra','../config/environment','root','resolve'];(function(_0x5ede1a,_0x51e4d0){var _0x9b0761=function(_0x3cf50b){while(--_0x3cf50b){_0x5ede1a['push'](_0x5ede1a['shift']());}};_0x9b0761(++_0x51e4d0);}(_0x4336,0x140));var _0x6433=function(_0x1d98db,_0x571a42){_0x1d98db=_0x1d98db-0x0;var _0x223203=_0x4336[_0x1d98db];return _0x223203;};var fs=require(_0x6433('0x0'));var path=require('path');var config=require(_0x6433('0x1'));var root=config[_0x6433('0x2')];var APP_JSON_PATH=path[_0x6433('0x3')](root,_0x6433('0x4'));var NODEPATH=path[_0x6433('0x3')](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0x1044bb){let _0x4e9857=![];if(Array['isArray'](_0x1044bb[_0x6433('0x5')])){var _0xd5fd8a=_0x1044bb[_0x6433('0x5')]['findIndex'](function(_0xa8bc07){return _0xa8bc07[_0x6433('0x6')]===_0x6433('0x7');});if(_0xd5fd8a>-0x1){var _0x509238=_0x1044bb[_0x6433('0x5')][_0xd5fd8a];if(typeof _0x509238[_0x6433('0x8')][_0x6433('0x9')]!==_0x6433('0xa')){_0x509238[_0x6433('0x8')]['NODE_PATH']=NODEPATH;_0x4e9857=!![];}}return{'appConfig':_0x1044bb,'updated':_0x4e9857};}}function updateAppConfig(_0x27b3ef){return fs[_0x6433('0xb')](APP_JSON_PATH)[_0x6433('0xc')](function(_0x42e295){if(_0x42e295){return fs[_0x6433('0xd')](APP_JSON_PATH)['then'](function(_0x3ecd7b){var _0xefcca3=setLegacyLibsNodeEnvPath(_0x3ecd7b);if(_0xefcca3[_0x6433('0xe')]){_0x27b3ef['info'](_0x6433('0xf'));return fs[_0x6433('0x10')](APP_JSON_PATH,_0x3ecd7b,{'spaces':0x2});}else{return Promise[_0x6433('0x3')]();}});}else{return Promise[_0x6433('0x3')]();}});}module[_0x6433('0x11')]=updateAppConfig; \ No newline at end of file +var _0x8b1e=['server/app.json','resolve','legacy-libs','isArray','apps','findIndex','name','motion2','env','NODE_PATH','string','then','readJSON','info','exports','fs-extra','../config/environment','root'];(function(_0x3ee4bc,_0x55538c){var _0xd7e1d7=function(_0x245e80){while(--_0x245e80){_0x3ee4bc['push'](_0x3ee4bc['shift']());}};_0xd7e1d7(++_0x55538c);}(_0x8b1e,0x165));var _0xe8b1=function(_0x3a8f3e,_0x4af13e){_0x3a8f3e=_0x3a8f3e-0x0;var _0x2d4178=_0x8b1e[_0x3a8f3e];return _0x2d4178;};var fs=require(_0xe8b1('0x0'));var path=require('path');var config=require(_0xe8b1('0x1'));var root=config[_0xe8b1('0x2')];var APP_JSON_PATH=path['resolve'](root,_0xe8b1('0x3'));var NODEPATH=path[_0xe8b1('0x4')](root,_0xe8b1('0x5'));function setLegacyLibsNodeEnvPath(_0x3b42bf){let _0x3ac59c=![];if(Array[_0xe8b1('0x6')](_0x3b42bf[_0xe8b1('0x7')])){var _0xd30662=_0x3b42bf[_0xe8b1('0x7')][_0xe8b1('0x8')](function(_0xafca79){return _0xafca79[_0xe8b1('0x9')]===_0xe8b1('0xa');});if(_0xd30662>-0x1){var _0x381363=_0x3b42bf[_0xe8b1('0x7')][_0xd30662];if(typeof _0x381363[_0xe8b1('0xb')][_0xe8b1('0xc')]!==_0xe8b1('0xd')){_0x381363['env']['NODE_PATH']=NODEPATH;_0x3ac59c=!![];}}return{'appConfig':_0x3b42bf,'updated':_0x3ac59c};}}function updateAppConfig(_0x496cda){return fs['pathExists'](APP_JSON_PATH)[_0xe8b1('0xe')](function(_0x4f5a64){if(_0x4f5a64){return fs[_0xe8b1('0xf')](APP_JSON_PATH)[_0xe8b1('0xe')](function(_0x360e9f){var _0x42a8a7=setLegacyLibsNodeEnvPath(_0x360e9f);if(_0x42a8a7['updated']){_0x496cda[_0xe8b1('0x10')]('Updating\x20app.json');return fs['writeJSON'](APP_JSON_PATH,_0x360e9f,{'spaces':0x2});}else{return Promise[_0xe8b1('0x4')]();}});}else{return Promise[_0xe8b1('0x4')]();}});}module[_0xe8b1('0x11')]=updateAppConfig; \ No newline at end of file